@byteplus/rtc 4.45.0-blw.12 → 4.45.0-blw.13

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.45.0-blw.12
4
+ * version: 4.45.0-blw.13
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(i){if("default"!==i&&!(i in e)){var r=Object.getOwnPropertyDescriptor(t,i);Object.defineProperty(e,i,r.get?r:{enumerable:!0,get:function(){return t[i]}})}}))})),Object.freeze(e)}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 i="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function r(e){if(e.__esModule)return e;var t=Object.defineProperty({},"__esModule",{value:!0});return Object.keys(e).forEach((function(i){var r=Object.getOwnPropertyDescriptor(e,i);Object.defineProperty(t,i,r.get?r:{enumerable:!0,get:function(){return e[i]}})})),t}var n=function(e){return e&&e.Math==Math&&e},o=n("object"==typeof globalThis&&globalThis)||n("object"==typeof window&&window)||n("object"==typeof self&&self)||n("object"==typeof i&&i)||function(){return this}()||Function("return this")(),a={},s=function(e){try{return!!e()}catch(e){return!0}},c=!s((function(){return 7!=Object.defineProperty({},1,{get:function(){return 7}})[1]})),u=!s((function(){var e=function(){}.bind();return"function"!=typeof e||e.hasOwnProperty("prototype")})),d=u,l=Function.prototype.call,h=d?l.bind(l):function(){return l.apply(l,arguments)},p={},_={}.propertyIsEnumerable,f=Object.getOwnPropertyDescriptor,v=f&&!_.call({1:2},1);p.f=v?function(e){var t=f(this,e);return!!t&&t.enumerable}:_;var m,y,S=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}},g=u,E=Function.prototype,b=E.bind,I=E.call,T=g&&b.bind(I,I),A=g?function(e){return e&&T(e)}:function(e){return e&&function(){return I.apply(e,arguments)}},R=A,C=R({}.toString),O=R("".slice),w=function(e){return O(C(e),8,-1)},k=A,N=s,P=w,D=o.Object,M=k("".split),L=N((function(){return!D("z").propertyIsEnumerable(0)}))?function(e){return"String"==P(e)?M(e,""):D(e)}:D,U=o.TypeError,x=function(e){if(null==e)throw U("Can't call method on "+e);return e},V=L,F=x,B=function(e){return V(F(e))},j=function(e){return"function"==typeof e},G=j,H=function(e){return"object"==typeof e?null!==e:G(e)},z=o,K=j,W=function(e){return K(e)?e:void 0},X=function(e,t){return arguments.length<2?W(z[e]):z[e]&&z[e][t]},q=A({}.isPrototypeOf),Y=X("navigator","userAgent")||"",J=o,Q=Y,Z=J.process,$=J.Deno,ee=Z&&Z.versions||$&&$.version,te=ee&&ee.v8;te&&(y=(m=te.split("."))[0]>0&&m[0]<4?1:+(m[0]+m[1])),!y&&Q&&(!(m=Q.match(/Edge\/(\d+)/))||m[1]>=74)&&(m=Q.match(/Chrome\/(\d+)/))&&(y=+m[1]);var ie=y,re=ie,ne=s,oe=!!Object.getOwnPropertySymbols&&!ne((function(){var e=Symbol();return!String(e)||!(Object(e)instanceof Symbol)||!Symbol.sham&&re&&re<41})),ae=oe&&!Symbol.sham&&"symbol"==typeof Symbol.iterator,se=X,ce=j,ue=q,de=ae,le=o.Object,he=de?function(e){return"symbol"==typeof e}:function(e){var t=se("Symbol");return ce(t)&&ue(t.prototype,le(e))},pe=o.String,_e=function(e){try{return pe(e)}catch(e){return"Object"}},fe=j,ve=_e,me=o.TypeError,ye=function(e){if(fe(e))return e;throw me(ve(e)+" is not a function")},Se=ye,ge=function(e,t){var i=e[t];return null==i?void 0:Se(i)},Ee=h,be=j,Ie=H,Te=o.TypeError,Ae={exports:{}},Re=o,Ce=Object.defineProperty,Oe=function(e,t){try{Ce(Re,e,{value:t,configurable:!0,writable:!0})}catch(i){Re[e]=t}return t},we=Oe,ke="__core-js_shared__",Ne=o[ke]||we(ke,{}),Pe=Ne;(Ae.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=x,Me=o.Object,Le=function(e){return Me(De(e))},Ue=Le,xe=A({}.hasOwnProperty),Ve=Object.hasOwn||function(e,t){return xe(Ue(e),t)},Fe=A,Be=0,je=Math.random(),Ge=Fe(1..toString),He=function(e){return"Symbol("+(void 0===e?"":e)+")_"+Ge(++Be+je,36)},ze=o,Ke=Ae.exports,We=Ve,Xe=He,qe=oe,Ye=ae,Je=Ke("wks"),Qe=ze.Symbol,Ze=Qe&&Qe.for,$e=Ye?Qe:Qe&&Qe.withoutSetter||Xe,et=function(e){if(!We(Je,e)||!qe&&"string"!=typeof Je[e]){var t="Symbol."+e;qe&&We(Qe,e)?Je[e]=Qe[e]:Je[e]=Ye&&Ze?Ze(t):$e(t)}return Je[e]},tt=h,it=H,rt=he,nt=ge,ot=function(e,t){var i,r;if("string"===t&&be(i=e.toString)&&!Ie(r=Ee(i,e)))return r;if(be(i=e.valueOf)&&!Ie(r=Ee(i,e)))return r;if("string"!==t&&be(i=e.toString)&&!Ie(r=Ee(i,e)))return r;throw Te("Can't convert object to primitive value")},at=et,st=o.TypeError,ct=at("toPrimitive"),ut=function(e,t){if(!it(e)||rt(e))return e;var i,r=nt(e,ct);if(r){if(void 0===t&&(t="default"),i=tt(r,e,t),!it(i)||rt(i))return i;throw st("Can't convert object to primitive value")}return void 0===t&&(t="number"),ot(e,t)},dt=ut,lt=he,ht=function(e){var t=dt(e,"string");return lt(t)?t:t+""},pt=H,_t=o.document,ft=pt(_t)&&pt(_t.createElement),vt=function(e){return ft?_t.createElement(e):{}},mt=vt,yt=!c&&!s((function(){return 7!=Object.defineProperty(mt("div"),"a",{get:function(){return 7}}).a})),St=c,gt=h,Et=p,bt=S,It=B,Tt=ht,At=Ve,Rt=yt,Ct=Object.getOwnPropertyDescriptor;a.f=St?Ct:function(e,t){if(e=It(e),t=Tt(t),Rt)try{return Ct(e,t)}catch(e){}if(At(e,t))return bt(!gt(Et.f,e,t),e[t])};var Ot={},wt=c&&s((function(){return 42!=Object.defineProperty((function(){}),"prototype",{value:42,writable:!1}).prototype})),kt=o,Nt=H,Pt=kt.String,Dt=kt.TypeError,Mt=function(e){if(Nt(e))return e;throw Dt(Pt(e)+" is not an object")},Lt=c,Ut=yt,xt=wt,Vt=Mt,Ft=ht,Bt=o.TypeError,jt=Object.defineProperty,Gt=Object.getOwnPropertyDescriptor,Ht="enumerable",zt="configurable",Kt="writable";Ot.f=Lt?xt?function(e,t,i){if(Vt(e),t=Ft(t),Vt(i),"function"==typeof e&&"prototype"===t&&"value"in i&&Kt in i&&!i.writable){var r=Gt(e,t);r&&r.writable&&(e[t]=i.value,i={configurable:zt in i?i.configurable:r.configurable,enumerable:Ht in i?i.enumerable:r.enumerable,writable:!1})}return jt(e,t,i)}:jt:function(e,t,i){if(Vt(e),t=Ft(t),Vt(i),Ut)try{return jt(e,t,i)}catch(e){}if("get"in i||"set"in i)throw Bt("Accessors not supported");return"value"in i&&(e[t]=i.value),e};var Wt=Ot,Xt=S,qt=c?function(e,t,i){return Wt.f(e,t,Xt(1,i))}:function(e,t,i){return e[t]=i,e},Yt={exports:{}},Jt=j,Qt=Ne,Zt=A(Function.toString);Jt(Qt.inspectSource)||(Qt.inspectSource=function(e){return Zt(e)});var $t,ei,ti,ii=Qt.inspectSource,ri=j,ni=ii,oi=o.WeakMap,ai=ri(oi)&&/native code/.test(ni(oi)),si=Ae.exports,ci=He,ui=si("keys"),di=function(e){return ui[e]||(ui[e]=ci(e))},li={},hi=ai,pi=o,_i=A,fi=H,vi=qt,mi=Ve,yi=Ne,Si=di,gi=li,Ei="Object already initialized",bi=pi.TypeError,Ii=pi.WeakMap;if(hi||yi.state){var Ti=yi.state||(yi.state=new Ii),Ai=_i(Ti.get),Ri=_i(Ti.has),Ci=_i(Ti.set);$t=function(e,t){if(Ri(Ti,e))throw new bi(Ei);return t.facade=e,Ci(Ti,e,t),t},ei=function(e){return Ai(Ti,e)||{}},ti=function(e){return Ri(Ti,e)}}else{var Oi=Si("state");gi[Oi]=!0,$t=function(e,t){if(mi(e,Oi))throw new bi(Ei);return t.facade=e,vi(e,Oi,t),t},ei=function(e){return mi(e,Oi)?e[Oi]:{}},ti=function(e){return mi(e,Oi)}}var wi={set:$t,get:ei,has:ti,enforce:function(e){return ti(e)?ei(e):$t(e,{})},getterFor:function(e){return function(t){var i;if(!fi(t)||(i=ei(t)).type!==e)throw bi("Incompatible receiver, "+e+" required");return i}}},ki=c,Ni=Ve,Pi=Function.prototype,Di=ki&&Object.getOwnPropertyDescriptor,Mi=Ni(Pi,"name"),Li={EXISTS:Mi,PROPER:Mi&&"something"===function(){}.name,CONFIGURABLE:Mi&&(!ki||ki&&Di(Pi,"name").configurable)},Ui=o,xi=j,Vi=Ve,Fi=qt,Bi=Oe,ji=ii,Gi=Li.CONFIGURABLE,Hi=wi.get,zi=wi.enforce,Ki=String(String).split("String");(Yt.exports=function(e,t,i,r){var n,o=!!r&&!!r.unsafe,a=!!r&&!!r.enumerable,s=!!r&&!!r.noTargetGet,c=r&&void 0!==r.name?r.name:t;xi(i)&&("Symbol("===String(c).slice(0,7)&&(c="["+String(c).replace(/^Symbol\(([^)]*)\)/,"$1")+"]"),(!Vi(i,"name")||Gi&&i.name!==c)&&Fi(i,"name",c),(n=zi(i)).source||(n.source=Ki.join("string"==typeof c?c:""))),e!==Ui?(o?!s&&e[t]&&(a=!0):delete e[t],a?e[t]=i:Fi(e,t,i)):a?e[t]=i:Bi(t,i)})(Function.prototype,"toString",(function(){return xi(this)&&Hi(this).source||ji(this)}));var Wi={},Xi=Math.ceil,qi=Math.floor,Yi=function(e){var t=+e;return t!=t||0===t?0:(t>0?qi:Xi)(t)},Ji=Yi,Qi=Math.max,Zi=Math.min,$i=function(e,t){var i=Ji(e);return i<0?Qi(i+t,0):Zi(i,t)},er=Yi,tr=Math.min,ir=function(e){return e>0?tr(er(e),9007199254740991):0},rr=ir,nr=function(e){return rr(e.length)},or=B,ar=$i,sr=nr,cr=function(e){return function(t,i,r){var n,o=or(t),a=sr(o),s=ar(r,a);if(e&&i!=i){for(;a>s;)if((n=o[s++])!=n)return!0}else for(;a>s;s++)if((e||s in o)&&o[s]===i)return e||s||0;return!e&&-1}},ur={includes:cr(!0),indexOf:cr(!1)},dr=Ve,lr=B,hr=ur.indexOf,pr=li,_r=A([].push),fr=function(e,t){var i,r=lr(e),n=0,o=[];for(i in r)!dr(pr,i)&&dr(r,i)&&_r(o,i);for(;t.length>n;)dr(r,i=t[n++])&&(~hr(o,i)||_r(o,i));return o},vr=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],mr=fr,yr=vr.concat("length","prototype");Wi.f=Object.getOwnPropertyNames||function(e){return mr(e,yr)};var Sr={};Sr.f=Object.getOwnPropertySymbols;var gr=X,Er=Wi,br=Sr,Ir=Mt,Tr=A([].concat),Ar=gr("Reflect","ownKeys")||function(e){var t=Er.f(Ir(e)),i=br.f;return i?Tr(t,i(e)):t},Rr=Ve,Cr=Ar,Or=a,wr=Ot,kr=function(e,t,i){for(var r=Cr(t),n=wr.f,o=Or.f,a=0;a<r.length;a++){var s=r[a];Rr(e,s)||i&&Rr(i,s)||n(e,s,o(t,s))}},Nr=s,Pr=j,Dr=/#|\.prototype\./,Mr=function(e,t){var i=Ur[Lr(e)];return i==Vr||i!=xr&&(Pr(t)?Nr(t):!!t)},Lr=Mr.normalize=function(e){return String(e).replace(Dr,".").toLowerCase()},Ur=Mr.data={},xr=Mr.NATIVE="N",Vr=Mr.POLYFILL="P",Fr=Mr,Br=o,jr=a.f,Gr=qt,Hr=Yt.exports,zr=Oe,Kr=kr,Wr=Fr,Xr=function(e,t){var i,r,n,o,a,s=e.target,c=e.global,u=e.stat;if(i=c?Br:u?Br[s]||zr(s,{}):(Br[s]||{}).prototype)for(r in t){if(o=t[r],n=e.noTargetGet?(a=jr(i,r))&&a.value:i[r],!Wr(c?r:s+(u?".":"#")+r,e.forced)&&void 0!==n){if(typeof o==typeof n)continue;Kr(o,n)}(e.sham||n&&n.sham)&&Gr(o,"sham",!0),Hr(i,r,o,e)}},qr=o,Yr=j,Jr=qr.String,Qr=qr.TypeError,Zr=A,$r=Mt,en=function(e){if("object"==typeof e||Yr(e))return e;throw Qr("Can't set "+Jr(e)+" as a prototype")},tn=Object.setPrototypeOf||("__proto__"in{}?function(){var e,t=!1,i={};try{(e=Zr(Object.getOwnPropertyDescriptor(Object.prototype,"__proto__").set))(i,[]),t=i instanceof Array}catch(e){}return function(i,r){return $r(i),en(r),t?e(i,r):i.__proto__=r,i}}():void 0);Xr({target:"Object",stat:!0},{setPrototypeOf:tn});var rn={},nn=fr,on=vr,an=Object.keys||function(e){return nn(e,on)},sn=c,cn=wt,un=Ot,dn=Mt,ln=B,hn=an;rn.f=sn&&!cn?Object.defineProperties:function(e,t){dn(e);for(var i,r=ln(t),n=hn(t),o=n.length,a=0;o>a;)un.f(e,i=n[a++],r[i]);return e};var pn,_n=X("document","documentElement"),fn=Mt,vn=rn,mn=vr,yn=li,Sn=_n,gn=vt,En=di("IE_PROTO"),bn=function(){},In=function(e){return"<script>"+e+"</"+"script>"},Tn=function(e){e.write(In("")),e.close();var t=e.parentWindow.Object;return e=null,t},An=function(){try{pn=new ActiveXObject("htmlfile")}catch(e){}var e,t;An="undefined"!=typeof document?document.domain&&pn?Tn(pn):((t=gn("iframe")).style.display="none",Sn.appendChild(t),t.src=String("javascript:"),(e=t.contentWindow.document).open(),e.write(In("document.F=Object")),e.close(),e.F):Tn(pn);for(var i=mn.length;i--;)delete An.prototype[mn[i]];return An()};yn[En]=!0;var Rn=Object.create||function(e,t){var i;return null!==e?(bn.prototype=fn(e),i=new bn,bn.prototype=null,i[En]=e):i=An(),void 0===t?i:vn.f(i,t)};Xr({target:"Object",stat:!0,sham:!c},{create:Rn});var Cn=c,On=A,wn=h,kn=s,Nn=an,Pn=Sr,Dn=p,Mn=Le,Ln=L,Un=Object.assign,xn=Object.defineProperty,Vn=On([].concat),Fn=!Un||kn((function(){if(Cn&&1!==Un({b:1},Un(xn({},"a",{enumerable:!0,get:function(){xn(this,"b",{value:3,enumerable:!1})}}),{b:2})).b)return!0;var e={},t={},i=Symbol(),r="abcdefghijklmnopqrst";return e[i]=7,r.split("").forEach((function(e){t[e]=e})),7!=Un({},e)[i]||Nn(Un({},t)).join("")!=r}))?function(e,t){for(var i=Mn(e),r=arguments.length,n=1,o=Pn.f,a=Dn.f;r>n;)for(var s,c=Ln(arguments[n++]),u=o?Vn(Nn(c),o(c)):Nn(c),d=u.length,l=0;d>l;)s=u[l++],Cn&&!wn(a,c,s)||(i[s]=c[s]);return i}:Un,Bn=Fn;Xr({target:"Object",stat:!0,forced:Object.assign!==Bn},{assign:Bn});var jn=s,Gn=function(e,t){var i=[][e];return!!i&&jn((function(){i.call(null,t||function(){throw 1},1)}))},Hn=Xr,zn=ur.indexOf,Kn=Gn,Wn=A([].indexOf),Xn=!!Wn&&1/Wn([1],1,-0)<0,qn=Kn("indexOf");Hn({target:"Array",proto:!0,forced:Xn||!qn},{indexOf:function(e){var t=arguments.length>1?arguments[1]:void 0;return Xn?Wn(this,e,t)||0:zn(this,e,t)}});var Yn=u,Jn=Function.prototype,Qn=Jn.apply,Zn=Jn.call,$n="object"==typeof Reflect&&Reflect.apply||(Yn?Zn.bind(Qn):function(){return Zn.apply(Qn,arguments)}),eo=w,to=Array.isArray||function(e){return"Array"==eo(e)},io={};io[et("toStringTag")]="z";var ro="[object z]"===String(io),no=o,oo=ro,ao=j,so=w,co=et("toStringTag"),uo=no.Object,lo="Arguments"==so(function(){return arguments}()),ho=oo?so:function(e){var t,i,r;return void 0===e?"Undefined":null===e?"Null":"string"==typeof(i=function(e,t){try{return e[t]}catch(e){}}(t=uo(e),co))?i:lo?so(t):"Object"==(r=so(t))&&ao(t.callee)?"Arguments":r},po=ho,_o=o.String,fo=function(e){if("Symbol"===po(e))throw TypeError("Cannot convert a Symbol value to a string");return _o(e)},vo={},mo=ht,yo=Ot,So=S,go=function(e,t,i){var r=mo(t);r in e?yo.f(e,r,So(0,i)):e[r]=i},Eo=$i,bo=nr,Io=go,To=o.Array,Ao=Math.max,Ro=function(e,t,i){for(var r=bo(e),n=Eo(t,r),o=Eo(void 0===i?r:i,r),a=To(Ao(o-n,0)),s=0;n<o;n++,s++)Io(a,s,e[n]);return a.length=s,a},Co=w,Oo=B,wo=Wi.f,ko=Ro,No="object"==typeof window&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[];vo.f=function(e){return No&&"Window"==Co(e)?function(e){try{return wo(e)}catch(e){return ko(No)}}(e):wo(Oo(e))};var Po=A([].slice),Do={},Mo=et;Do.f=Mo;var Lo=o,Uo=Ve,xo=Do,Vo=Ot.f,Fo=function(e){var t=Lo.Symbol||(Lo.Symbol={});Uo(t,e)||Vo(t,e,{value:xo.f(e)})},Bo=Ot.f,jo=Ve,Go=et("toStringTag"),Ho=function(e,t,i){e&&!i&&(e=e.prototype),e&&!jo(e,Go)&&Bo(e,Go,{configurable:!0,value:t})},zo=ye,Ko=u,Wo=A(A.bind),Xo=function(e,t){return zo(e),void 0===t?e:Ko?Wo(e,t):function(){return e.apply(t,arguments)}},qo=A,Yo=s,Jo=j,Qo=ho,Zo=ii,$o=function(){},ea=[],ta=X("Reflect","construct"),ia=/^\s*(?:class|function)\b/,ra=qo(ia.exec),na=!ia.exec($o),oa=function(e){if(!Jo(e))return!1;try{return ta($o,ea,e),!0}catch(e){return!1}},aa=function(e){if(!Jo(e))return!1;switch(Qo(e)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return na||!!ra(ia,Zo(e))}catch(e){return!0}};aa.sham=!0;var sa=!ta||Yo((function(){var e;return oa(oa.call)||!oa(Object)||!oa((function(){e=!0}))||e}))?aa:oa,ca=o,ua=to,da=sa,la=H,ha=et("species"),pa=ca.Array,_a=function(e){var t;return ua(e)&&(t=e.constructor,(da(t)&&(t===pa||ua(t.prototype))||la(t)&&null===(t=t[ha]))&&(t=void 0)),void 0===t?pa:t},fa=function(e,t){return new(_a(e))(0===t?0:t)},va=Xo,ma=L,ya=Le,Sa=nr,ga=fa,Ea=A([].push),ba=function(e){var t=1==e,i=2==e,r=3==e,n=4==e,o=6==e,a=7==e,s=5==e||o;return function(c,u,d,l){for(var h,p,_=ya(c),f=ma(_),v=va(u,d),m=Sa(f),y=0,S=l||ga,g=t?S(c,m):i||a?S(c,0):void 0;m>y;y++)if((s||y in f)&&(p=v(h=f[y],y,_),e))if(t)g[y]=p;else if(p)switch(e){case 3:return!0;case 5:return h;case 6:return y;case 2:Ea(g,h)}else switch(e){case 4:return!1;case 7:Ea(g,h)}return o?-1:r||n?n:g}},Ia={forEach:ba(0),map:ba(1),filter:ba(2),some:ba(3),every:ba(4),find:ba(5),findIndex:ba(6),filterReject:ba(7)},Ta=Xr,Aa=o,Ra=X,Ca=$n,Oa=h,wa=A,ka=c,Na=oe,Pa=s,Da=Ve,Ma=to,La=j,Ua=H,xa=q,Va=he,Fa=Mt,Ba=Le,ja=B,Ga=ht,Ha=fo,za=S,Ka=Rn,Wa=an,Xa=Wi,qa=vo,Ya=Sr,Ja=a,Qa=Ot,Za=rn,$a=p,es=Po,ts=Yt.exports,is=Ae.exports,rs=li,ns=He,os=et,as=Do,ss=Fo,cs=Ho,us=wi,ds=Ia.forEach,ls=di("hidden"),hs="Symbol",ps=os("toPrimitive"),_s=us.set,fs=us.getterFor(hs),vs=Object.prototype,ms=Aa.Symbol,ys=ms&&ms.prototype,Ss=Aa.TypeError,gs=Aa.QObject,Es=Ra("JSON","stringify"),bs=Ja.f,Is=Qa.f,Ts=qa.f,As=$a.f,Rs=wa([].push),Cs=is("symbols"),Os=is("op-symbols"),ws=is("string-to-symbol-registry"),ks=is("symbol-to-string-registry"),Ns=is("wks"),Ps=!gs||!gs.prototype||!gs.prototype.findChild,Ds=ka&&Pa((function(){return 7!=Ka(Is({},"a",{get:function(){return Is(this,"a",{value:7}).a}})).a}))?function(e,t,i){var r=bs(vs,t);r&&delete vs[t],Is(e,t,i),r&&e!==vs&&Is(vs,t,r)}:Is,Ms=function(e,t){var i=Cs[e]=Ka(ys);return _s(i,{type:hs,tag:e,description:t}),ka||(i.description=t),i},Ls=function(e,t,i){e===vs&&Ls(Os,t,i),Fa(e);var r=Ga(t);return Fa(i),Da(Cs,r)?(i.enumerable?(Da(e,ls)&&e[ls][r]&&(e[ls][r]=!1),i=Ka(i,{enumerable:za(0,!1)})):(Da(e,ls)||Is(e,ls,za(1,{})),e[ls][r]=!0),Ds(e,r,i)):Is(e,r,i)},Us=function(e,t){Fa(e);var i=ja(t),r=Wa(i).concat(Bs(i));return ds(r,(function(t){ka&&!Oa(xs,i,t)||Ls(e,t,i[t])})),e},xs=function(e){var t=Ga(e),i=Oa(As,this,t);return!(this===vs&&Da(Cs,t)&&!Da(Os,t))&&(!(i||!Da(this,t)||!Da(Cs,t)||Da(this,ls)&&this[ls][t])||i)},Vs=function(e,t){var i=ja(e),r=Ga(t);if(i!==vs||!Da(Cs,r)||Da(Os,r)){var n=bs(i,r);return!n||!Da(Cs,r)||Da(i,ls)&&i[ls][r]||(n.enumerable=!0),n}},Fs=function(e){var t=Ts(ja(e)),i=[];return ds(t,(function(e){Da(Cs,e)||Da(rs,e)||Rs(i,e)})),i},Bs=function(e){var t=e===vs,i=Ts(t?Os:ja(e)),r=[];return ds(i,(function(e){!Da(Cs,e)||t&&!Da(vs,e)||Rs(r,Cs[e])})),r};(Na||(ms=function(){if(xa(ys,this))throw Ss("Symbol is not a constructor");var e=arguments.length&&void 0!==arguments[0]?Ha(arguments[0]):void 0,t=ns(e),i=function(e){this===vs&&Oa(i,Os,e),Da(this,ls)&&Da(this[ls],t)&&(this[ls][t]=!1),Ds(this,t,za(1,e))};return ka&&Ps&&Ds(vs,t,{configurable:!0,set:i}),Ms(t,e)},ts(ys=ms.prototype,"toString",(function(){return fs(this).tag})),ts(ms,"withoutSetter",(function(e){return Ms(ns(e),e)})),$a.f=xs,Qa.f=Ls,Za.f=Us,Ja.f=Vs,Xa.f=qa.f=Fs,Ya.f=Bs,as.f=function(e){return Ms(os(e),e)},ka&&(Is(ys,"description",{configurable:!0,get:function(){return fs(this).description}}),ts(vs,"propertyIsEnumerable",xs,{unsafe:!0}))),Ta({global:!0,wrap:!0,forced:!Na,sham:!Na},{Symbol:ms}),ds(Wa(Ns),(function(e){ss(e)})),Ta({target:hs,stat:!0,forced:!Na},{for:function(e){var t=Ha(e);if(Da(ws,t))return ws[t];var i=ms(t);return ws[t]=i,ks[i]=t,i},keyFor:function(e){if(!Va(e))throw Ss(e+" is not a symbol");if(Da(ks,e))return ks[e]},useSetter:function(){Ps=!0},useSimple:function(){Ps=!1}}),Ta({target:"Object",stat:!0,forced:!Na,sham:!ka},{create:function(e,t){return void 0===t?Ka(e):Us(Ka(e),t)},defineProperty:Ls,defineProperties:Us,getOwnPropertyDescriptor:Vs}),Ta({target:"Object",stat:!0,forced:!Na},{getOwnPropertyNames:Fs,getOwnPropertySymbols:Bs}),Ta({target:"Object",stat:!0,forced:Pa((function(){Ya.f(1)}))},{getOwnPropertySymbols:function(e){return Ya.f(Ba(e))}}),Es)&&Ta({target:"JSON",stat:!0,forced:!Na||Pa((function(){var e=ms();return"[null]"!=Es([e])||"{}"!=Es({a:e})||"{}"!=Es(Object(e))}))},{stringify:function(e,t,i){var r=es(arguments),n=t;if((Ua(t)||void 0!==e)&&!Va(e))return Ma(t)||(t=function(e,t){if(La(n)&&(t=Oa(n,this,e,t)),!Va(t))return t}),r[1]=t,Ca(Es,null,r)}});if(!ys[ps]){var js=ys.valueOf;ts(ys,ps,(function(e){return Oa(js,this)}))}cs(ms,hs),rs[ls]=!0;var Gs=Xr,Hs=s,zs=B,Ks=a.f,Ws=c,Xs=Hs((function(){Ks(1)}));Gs({target:"Object",stat:!0,forced:!Ws||Xs,sham:!Ws},{getOwnPropertyDescriptor:function(e,t){return Ks(zs(e),t)}});var qs=ho,Ys=ro?{}.toString:function(){return"[object "+qs(this)+"]"},Js=ro,Qs=Yt.exports,Zs=Ys;Js||Qs(Object.prototype,"toString",Zs,{unsafe:!0});var $s=Xr,ec=c,tc=Ot.f;$s({target:"Object",stat:!0,forced:Object.defineProperty!==tc,sham:!ec},{defineProperty:tc});var ic=o.Promise,rc=Yt.exports,nc=function(e,t,i){for(var r in t)rc(e,r,t[r],i);return e},oc=X,ac=Ot,sc=c,cc=et("species"),uc=function(e){var t=oc(e),i=ac.f;sc&&t&&!t[cc]&&i(t,cc,{configurable:!0,get:function(){return this}})},dc=q,lc=o.TypeError,hc=function(e,t){if(dc(t,e))return e;throw lc("Incorrect invocation")},pc={},_c=pc,fc=et("iterator"),vc=Array.prototype,mc=function(e){return void 0!==e&&(_c.Array===e||vc[fc]===e)},yc=ho,Sc=ge,gc=pc,Ec=et("iterator"),bc=function(e){if(null!=e)return Sc(e,Ec)||Sc(e,"@@iterator")||gc[yc(e)]},Ic=h,Tc=ye,Ac=Mt,Rc=_e,Cc=bc,Oc=o.TypeError,wc=function(e,t){var i=arguments.length<2?Cc(e):t;if(Tc(i))return Ac(Ic(i,e));throw Oc(Rc(e)+" is not iterable")},kc=h,Nc=Mt,Pc=ge,Dc=function(e,t,i){var r,n;Nc(e);try{if(!(r=Pc(e,"return"))){if("throw"===t)throw i;return i}r=kc(r,e)}catch(e){n=!0,r=e}if("throw"===t)throw i;if(n)throw r;return Nc(r),i},Mc=Xo,Lc=h,Uc=Mt,xc=_e,Vc=mc,Fc=nr,Bc=q,jc=wc,Gc=bc,Hc=Dc,zc=o.TypeError,Kc=function(e,t){this.stopped=e,this.result=t},Wc=Kc.prototype,Xc=function(e,t,i){var r,n,o,a,s,c,u,d=i&&i.that,l=!(!i||!i.AS_ENTRIES),h=!(!i||!i.IS_ITERATOR),p=!(!i||!i.INTERRUPTED),_=Mc(t,d),f=function(e){return r&&Hc(r,"normal",e),new Kc(!0,e)},v=function(e){return l?(Uc(e),p?_(e[0],e[1],f):_(e[0],e[1])):p?_(e,f):_(e)};if(h)r=e;else{if(!(n=Gc(e)))throw zc(xc(e)+" is not iterable");if(Vc(n)){for(o=0,a=Fc(e);a>o;o++)if((s=v(e[o]))&&Bc(Wc,s))return s;return new Kc(!1)}r=jc(e,n)}for(c=r.next;!(u=Lc(c,r)).done;){try{s=v(u.value)}catch(e){Hc(r,"throw",e)}if("object"==typeof s&&s&&Bc(Wc,s))return s}return new Kc(!1)},qc=et("iterator"),Yc=!1;try{var Jc=0,Qc={next:function(){return{done:!!Jc++}},return:function(){Yc=!0}};Qc[qc]=function(){return this},Array.from(Qc,(function(){throw 2}))}catch(e){}var Zc,$c,eu,tu,iu=function(e,t){if(!t&&!Yc)return!1;var i=!1;try{var r={};r[qc]=function(){return{next:function(){return{done:i=!0}}}},e(r)}catch(e){}return i},ru=sa,nu=_e,ou=o.TypeError,au=function(e){if(ru(e))return e;throw ou(nu(e)+" is not a constructor")},su=Mt,cu=au,uu=et("species"),du=function(e,t){var i,r=su(e).constructor;return void 0===r||null==(i=su(r)[uu])?t:cu(i)},lu=o.TypeError,hu=function(e,t){if(e<t)throw lu("Not enough arguments");return e},pu=/(?:ipad|iphone|ipod).*applewebkit/i.test(Y),_u="process"==w(o.process),fu=o,vu=$n,mu=Xo,yu=j,Su=Ve,gu=s,Eu=_n,bu=Po,Iu=vt,Tu=hu,Au=pu,Ru=_u,Cu=fu.setImmediate,Ou=fu.clearImmediate,wu=fu.process,ku=fu.Dispatch,Nu=fu.Function,Pu=fu.MessageChannel,Du=fu.String,Mu=0,Lu={},Uu="onreadystatechange";try{Zc=fu.location}catch(e){}var xu=function(e){if(Su(Lu,e)){var t=Lu[e];delete Lu[e],t()}},Vu=function(e){return function(){xu(e)}},Fu=function(e){xu(e.data)},Bu=function(e){fu.postMessage(Du(e),Zc.protocol+"//"+Zc.host)};Cu&&Ou||(Cu=function(e){Tu(arguments.length,1);var t=yu(e)?e:Nu(e),i=bu(arguments,1);return Lu[++Mu]=function(){vu(t,void 0,i)},$c(Mu),Mu},Ou=function(e){delete Lu[e]},Ru?$c=function(e){wu.nextTick(Vu(e))}:ku&&ku.now?$c=function(e){ku.now(Vu(e))}:Pu&&!Au?(tu=(eu=new Pu).port2,eu.port1.onmessage=Fu,$c=mu(tu.postMessage,tu)):fu.addEventListener&&yu(fu.postMessage)&&!fu.importScripts&&Zc&&"file:"!==Zc.protocol&&!gu(Bu)?($c=Bu,fu.addEventListener("message",Fu,!1)):$c=Uu in Iu("script")?function(e){Eu.appendChild(Iu("script")).onreadystatechange=function(){Eu.removeChild(this),xu(e)}}:function(e){setTimeout(Vu(e),0)});var ju,Gu,Hu,zu,Ku,Wu,Xu,qu,Yu={set:Cu,clear:Ou},Ju=o,Qu=/ipad|iphone|ipod/i.test(Y)&&void 0!==Ju.Pebble,Zu=/web0s(?!.*chrome)/i.test(Y),$u=o,ed=Xo,td=a.f,id=Yu.set,rd=pu,nd=Qu,od=Zu,ad=_u,sd=$u.MutationObserver||$u.WebKitMutationObserver,cd=$u.document,ud=$u.process,dd=$u.Promise,ld=td($u,"queueMicrotask"),hd=ld&&ld.value;hd||(ju=function(){var e,t;for(ad&&(e=ud.domain)&&e.exit();Gu;){t=Gu.fn,Gu=Gu.next;try{t()}catch(e){throw Gu?zu():Hu=void 0,e}}Hu=void 0,e&&e.enter()},rd||ad||od||!sd||!cd?!nd&&dd&&dd.resolve?((Xu=dd.resolve(void 0)).constructor=dd,qu=ed(Xu.then,Xu),zu=function(){qu(ju)}):ad?zu=function(){ud.nextTick(ju)}:(id=ed(id,$u),zu=function(){id(ju)}):(Ku=!0,Wu=cd.createTextNode(""),new sd(ju).observe(Wu,{characterData:!0}),zu=function(){Wu.data=Ku=!Ku}));var pd=hd||function(e){var t={fn:e,next:void 0};Hu&&(Hu.next=t),Gu||(Gu=t,zu()),Hu=t},_d={},fd=ye,vd=function(e){var t,i;this.promise=new e((function(e,r){if(void 0!==t||void 0!==i)throw TypeError("Bad Promise constructor");t=e,i=r})),this.resolve=fd(t),this.reject=fd(i)};_d.f=function(e){return new vd(e)};var md=Mt,yd=H,Sd=_d,gd=function(e,t){if(md(e),yd(t)&&t.constructor===e)return t;var i=Sd.f(e);return(0,i.resolve)(t),i.promise},Ed=o,bd=function(){this.head=null,this.tail=null};bd.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 Id,Td,Ad,Rd,Cd=bd,Od="object"==typeof window,wd=Xr,kd=o,Nd=X,Pd=h,Dd=ic,Md=Yt.exports,Ld=nc,Ud=tn,xd=Ho,Vd=uc,Fd=ye,Bd=j,jd=H,Gd=hc,Hd=ii,zd=Xc,Kd=iu,Wd=du,Xd=Yu.set,qd=pd,Yd=gd,Jd=function(e,t){var i=Ed.console;i&&i.error&&(1==arguments.length?i.error(e):i.error(e,t))},Qd=_d,Zd=function(e){try{return{error:!1,value:e()}}catch(e){return{error:!0,value:e}}},$d=Cd,el=wi,tl=Fr,il=Od,rl=_u,nl=ie,ol=et("species"),al="Promise",sl=el.getterFor(al),cl=el.set,ul=el.getterFor(al),dl=Dd&&Dd.prototype,ll=Dd,hl=dl,pl=kd.TypeError,_l=kd.document,fl=kd.process,vl=Qd.f,ml=vl,yl=!!(_l&&_l.createEvent&&kd.dispatchEvent),Sl=Bd(kd.PromiseRejectionEvent),gl="unhandledrejection",El=!1,bl=tl(al,(function(){var e=Hd(ll),t=e!==String(ll);if(!t&&66===nl)return!0;if(nl>=51&&/native code/.test(e))return!1;var i=new ll((function(e){e(1)})),r=function(e){e((function(){}),(function(){}))};return(i.constructor={})[ol]=r,!(El=i.then((function(){}))instanceof r)||!t&&il&&!Sl})),Il=bl||!Kd((function(e){ll.all(e).catch((function(){}))})),Tl=function(e){var t;return!(!jd(e)||!Bd(t=e.then))&&t},Al=function(e,t){var i,r,n,o=t.value,a=1==t.state,s=a?e.ok:e.fail,c=e.resolve,u=e.reject,d=e.domain;try{s?(a||(2===t.rejection&&kl(t),t.rejection=1),!0===s?i=o:(d&&d.enter(),i=s(o),d&&(d.exit(),n=!0)),i===e.promise?u(pl("Promise-chain cycle")):(r=Tl(i))?Pd(r,i,c,u):c(i)):u(o)}catch(e){d&&!n&&d.exit(),u(e)}},Rl=function(e,t){e.notified||(e.notified=!0,qd((function(){for(var i,r=e.reactions;i=r.get();)Al(i,e);e.notified=!1,t&&!e.rejection&&Ol(e)})))},Cl=function(e,t,i){var r,n;yl?((r=_l.createEvent("Event")).promise=t,r.reason=i,r.initEvent(e,!1,!0),kd.dispatchEvent(r)):r={promise:t,reason:i},!Sl&&(n=kd["on"+e])?n(r):e===gl&&Jd("Unhandled promise rejection",i)},Ol=function(e){Pd(Xd,kd,(function(){var t,i=e.facade,r=e.value;if(wl(e)&&(t=Zd((function(){rl?fl.emit("unhandledRejection",r,i):Cl(gl,i,r)})),e.rejection=rl||wl(e)?2:1,t.error))throw t.value}))},wl=function(e){return 1!==e.rejection&&!e.parent},kl=function(e){Pd(Xd,kd,(function(){var t=e.facade;rl?fl.emit("rejectionHandled",t):Cl("rejectionhandled",t,e.value)}))},Nl=function(e,t,i){return function(r){e(t,r,i)}},Pl=function(e,t,i){e.done||(e.done=!0,i&&(e=i),e.value=t,e.state=2,Rl(e,!0))},Dl=function(e,t,i){if(!e.done){e.done=!0,i&&(e=i);try{if(e.facade===t)throw pl("Promise can't be resolved itself");var r=Tl(t);r?qd((function(){var i={done:!1};try{Pd(r,t,Nl(Dl,i,e),Nl(Pl,i,e))}catch(t){Pl(i,t,e)}})):(e.value=t,e.state=1,Rl(e,!1))}catch(t){Pl({done:!1},t,e)}}};if(bl&&(hl=(ll=function(e){Gd(this,hl),Fd(e),Pd(Id,this);var t=sl(this);try{e(Nl(Dl,t),Nl(Pl,t))}catch(e){Pl(t,e)}}).prototype,(Id=function(e){cl(this,{type:al,done:!1,notified:!1,parent:!1,reactions:new $d,rejection:!1,state:0,value:void 0})}).prototype=Ld(hl,{then:function(e,t){var i=ul(this),r=vl(Wd(this,ll));return i.parent=!0,r.ok=!Bd(e)||e,r.fail=Bd(t)&&t,r.domain=rl?fl.domain:void 0,0==i.state?i.reactions.add(r):qd((function(){Al(r,i)})),r.promise},catch:function(e){return this.then(void 0,e)}}),Td=function(){var e=new Id,t=sl(e);this.promise=e,this.resolve=Nl(Dl,t),this.reject=Nl(Pl,t)},Qd.f=vl=function(e){return e===ll||e===Ad?new Td(e):ml(e)},Bd(Dd)&&dl!==Object.prototype)){Rd=dl.then,El||(Md(dl,"then",(function(e,t){var i=this;return new ll((function(e,t){Pd(Rd,i,e,t)})).then(e,t)}),{unsafe:!0}),Md(dl,"catch",hl.catch,{unsafe:!0}));try{delete dl.constructor}catch(e){}Ud&&Ud(dl,hl)}wd({global:!0,wrap:!0,forced:bl},{Promise:ll}),xd(ll,al,!1),Vd(al),Ad=Nd(al),wd({target:al,stat:!0,forced:bl},{reject:function(e){var t=vl(this);return Pd(t.reject,void 0,e),t.promise}}),wd({target:al,stat:!0,forced:bl},{resolve:function(e){return Yd(this,e)}}),wd({target:al,stat:!0,forced:Il},{all:function(e){var t=this,i=vl(t),r=i.resolve,n=i.reject,o=Zd((function(){var i=Fd(t.resolve),o=[],a=0,s=1;zd(e,(function(e){var c=a++,u=!1;s++,Pd(i,t,e).then((function(e){u||(u=!0,o[c]=e,--s||r(o))}),n)})),--s||r(o)}));return o.error&&n(o.value),i.promise},race:function(e){var t=this,i=vl(t),r=i.reject,n=Zd((function(){var n=Fd(t.resolve);zd(e,(function(e){Pd(n,t,e).then(i.resolve,r)}))}));return n.error&&r(n.value),i.promise}});var Ml=Xr,Ll=c,Ul=o,xl=A,Vl=Ve,Fl=j,Bl=q,jl=fo,Gl=Ot.f,Hl=kr,zl=Ul.Symbol,Kl=zl&&zl.prototype;if(Ll&&Fl(zl)&&(!("description"in Kl)||void 0!==zl().description)){var Wl={},Xl=function(){var e=arguments.length<1||void 0===arguments[0]?void 0:jl(arguments[0]),t=Bl(Kl,this)?new zl(e):void 0===e?zl():zl(e);return""===e&&(Wl[t]=!0),t};Hl(Xl,zl),Xl.prototype=Kl,Kl.constructor=Xl;var ql="Symbol(test)"==String(zl("test")),Yl=xl(Kl.toString),Jl=xl(Kl.valueOf),Ql=/^Symbol\((.*)\)[^)]+$/,Zl=xl("".replace),$l=xl("".slice);Gl(Kl,"description",{configurable:!0,get:function(){var e=Jl(this),t=Yl(e);if(Vl(Wl,e))return"";var i=ql?$l(t,7,-1):Zl(t,Ql,"$1");return""===i?void 0:i}}),Ml({global:!0,forced:!0},{Symbol:Xl})}Fo("iterator");var eh=Rn,th=Ot,ih=et("unscopables"),rh=Array.prototype;null==rh[ih]&&th.f(rh,ih,{configurable:!0,value:eh(null)});var nh,oh,ah,sh=function(e){rh[ih][e]=!0},ch=!s((function(){function e(){}return e.prototype.constructor=null,Object.getPrototypeOf(new e)!==e.prototype})),uh=o,dh=Ve,lh=j,hh=Le,ph=ch,_h=di("IE_PROTO"),fh=uh.Object,vh=fh.prototype,mh=ph?fh.getPrototypeOf:function(e){var t=hh(e);if(dh(t,_h))return t[_h];var i=t.constructor;return lh(i)&&t instanceof i?i.prototype:t instanceof fh?vh:null},yh=s,Sh=j,gh=mh,Eh=Yt.exports,bh=et("iterator"),Ih=!1;[].keys&&("next"in(ah=[].keys())?(oh=gh(gh(ah)))!==Object.prototype&&(nh=oh):Ih=!0);var Th=null==nh||yh((function(){var e={};return nh[bh].call(e)!==e}));Th&&(nh={}),Sh(nh[bh])||Eh(nh,bh,(function(){return this}));var Ah={IteratorPrototype:nh,BUGGY_SAFARI_ITERATORS:Ih},Rh=Ah.IteratorPrototype,Ch=Rn,Oh=S,wh=Ho,kh=pc,Nh=function(){return this},Ph=function(e,t,i,r){var n=t+" Iterator";return e.prototype=Ch(Rh,{next:Oh(+!r,i)}),wh(e,n,!1),kh[n]=Nh,e},Dh=Xr,Mh=h,Lh=Li,Uh=j,xh=Ph,Vh=mh,Fh=tn,Bh=Ho,jh=qt,Gh=Yt.exports,Hh=pc,zh=Lh.PROPER,Kh=Lh.CONFIGURABLE,Wh=Ah.IteratorPrototype,Xh=Ah.BUGGY_SAFARI_ITERATORS,qh=et("iterator"),Yh="keys",Jh="values",Qh="entries",Zh=function(){return this},$h=function(e,t,i,r,n,o,a){xh(i,t,r);var s,c,u,d=function(e){if(e===n&&f)return f;if(!Xh&&e in p)return p[e];switch(e){case Yh:case Jh:case Qh:return function(){return new i(this,e)}}return function(){return new i(this)}},l=t+" Iterator",h=!1,p=e.prototype,_=p[qh]||p["@@iterator"]||n&&p[n],f=!Xh&&_||d(n),v="Array"==t&&p.entries||_;if(v&&(s=Vh(v.call(new e)))!==Object.prototype&&s.next&&(Vh(s)!==Wh&&(Fh?Fh(s,Wh):Uh(s[qh])||Gh(s,qh,Zh)),Bh(s,l,!0)),zh&&n==Jh&&_&&_.name!==Jh&&(Kh?jh(p,"name",Jh):(h=!0,f=function(){return Mh(_,this)})),n)if(c={values:d(Jh),keys:o?f:d(Yh),entries:d(Qh)},a)for(u in c)(Xh||h||!(u in p))&&Gh(p,u,c[u]);else Dh({target:t,proto:!0,forced:Xh||h},c);return p[qh]!==f&&Gh(p,qh,f,{name:n}),Hh[t]=f,c},ep=B,tp=sh,ip=pc,rp=wi,np=Ot.f,op=$h,ap=c,sp="Array Iterator",cp=rp.set,up=rp.getterFor(sp),dp=op(Array,"Array",(function(e,t){cp(this,{type:sp,target:ep(e),index:0,kind:t})}),(function(){var e=up(this),t=e.target,i=e.kind,r=e.index++;return!t||r>=t.length?(e.target=void 0,{value:void 0,done:!0}):"keys"==i?{value:r,done:!1}:"values"==i?{value:t[r],done:!1}:{value:[r,t[r]],done:!1}}),"values"),lp=ip.Arguments=ip.Array;if(tp("keys"),tp("values"),tp("entries"),ap&&"values"!==lp.name)try{np(lp,"name",{value:"values"})}catch(e){}var hp=A,pp=Yi,_p=fo,fp=x,vp=hp("".charAt),mp=hp("".charCodeAt),yp=hp("".slice),Sp=function(e){return function(t,i){var r,n,o=_p(fp(t)),a=pp(i),s=o.length;return a<0||a>=s?e?"":void 0:(r=mp(o,a))<55296||r>56319||a+1===s||(n=mp(o,a+1))<56320||n>57343?e?vp(o,a):r:e?yp(o,a,a+2):n-56320+(r-55296<<10)+65536}},gp={codeAt:Sp(!1),charAt:Sp(!0)},Ep=gp.charAt,bp=fo,Ip=wi,Tp=$h,Ap="String Iterator",Rp=Ip.set,Cp=Ip.getterFor(Ap);Tp(String,"String",(function(e){Rp(this,{type:Ap,string:bp(e),index:0})}),(function(){var e,t=Cp(this),i=t.string,r=t.index;return r>=i.length?{value:void 0,done:!0}:(e=Ep(i,r),t.index+=e.length,{value:e,done:!1})}));var Op={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},wp=vt("span").classList,kp=wp&&wp.constructor&&wp.constructor.prototype,Np=kp===Object.prototype?void 0:kp,Pp=o,Dp=Op,Mp=Np,Lp=dp,Up=qt,xp=et,Vp=xp("iterator"),Fp=xp("toStringTag"),Bp=Lp.values,jp=function(e,t){if(e){if(e[Vp]!==Bp)try{Up(e,Vp,Bp)}catch(t){e[Vp]=Bp}if(e[Fp]||Up(e,Fp,t),Dp[t])for(var i in Lp)if(e[i]!==Lp[i])try{Up(e,i,Lp[i])}catch(t){e[i]=Lp[i]}}};for(var Gp in Dp)jp(Pp[Gp]&&Pp[Gp].prototype,Gp);jp(Mp,"DOMTokenList");var Hp=s,zp=ie,Kp=et("species"),Wp=function(e){return zp>=51||!Hp((function(){var t=[];return(t.constructor={})[Kp]=function(){return{foo:1}},1!==t[e](Boolean).foo}))},Xp=Xr,qp=o,Yp=s,Jp=to,Qp=H,Zp=Le,$p=nr,e_=go,t_=fa,i_=Wp,r_=ie,n_=et("isConcatSpreadable"),o_=9007199254740991,a_="Maximum allowed index exceeded",s_=qp.TypeError,c_=r_>=51||!Yp((function(){var e=[];return e[n_]=!1,e.concat()[0]!==e})),u_=i_("concat"),d_=function(e){if(!Qp(e))return!1;var t=e[n_];return void 0!==t?!!t:Jp(e)};Xp({target:"Array",proto:!0,forced:!c_||!u_},{concat:function(e){var t,i,r,n,o,a=Zp(this),s=t_(a,0),c=0;for(t=-1,r=arguments.length;t<r;t++)if(d_(o=-1===t?a:arguments[t])){if(c+(n=$p(o))>o_)throw s_(a_);for(i=0;i<n;i++,c++)i in o&&e_(s,c,o[i])}else{if(c>=o_)throw s_(a_);e_(s,c++,o)}return s.length=c,s}});var l_=Xr,h_=o,p_=to,__=sa,f_=H,v_=$i,m_=nr,y_=B,S_=go,g_=et,E_=Po,b_=Wp("slice"),I_=g_("species"),T_=h_.Array,A_=Math.max;l_({target:"Array",proto:!0,forced:!b_},{slice:function(e,t){var i,r,n,o=y_(this),a=m_(o),s=v_(e,a),c=v_(void 0===t?a:t,a);if(p_(o)&&(i=o.constructor,(__(i)&&(i===T_||p_(i.prototype))||f_(i)&&null===(i=i[I_]))&&(i=void 0),i===T_||void 0===i))return E_(o,s,c);for(r=new(void 0===i?T_:i)(A_(c-s,0)),n=0;s<c;s++,n++)s in o&&S_(r,n,o[s]);return r.length=n,r}}),Fo("asyncIterator");var R_=function(e,t){return R_=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i])},R_(e,t)};function C_(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function i(){this.constructor=e}R_(e,t),e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)}var O_,w_,k_,N_,P_,D_,M_,L_,U_,x_,V_,F_,B_,j_,G_,H_,z_,K_,W_,X_,q_,Y_,J_,Q_,Z_,$_=function(){return $_=Object.assign||function(e){for(var t,i=1,r=arguments.length;i<r;i++)for(var n in t=arguments[i])Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e},$_.apply(this,arguments)};function ef(e,i,r,n){var o,a=arguments.length,s=a<3?i:null===n?n=Object.getOwnPropertyDescriptor(i,r):n;if("object"===("undefined"==typeof Reflect?"undefined":t(Reflect))&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,i,r,n);else for(var c=e.length-1;c>=0;c--)(o=e[c])&&(s=(a<3?o(s):a>3?o(i,r,s):o(i,r))||s);return a>3&&s&&Object.defineProperty(i,r,s),s}function tf(e,t,i,r){return new(i||(i=Promise))((function(n,o){function a(e){try{c(r.next(e))}catch(e){o(e)}}function s(e){try{c(r.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?n(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(a,s)}c((r=r.apply(e,t||[])).next())}))}function rf(e,t){var i,r,n,o,a={label:0,sent:function(){if(1&n[0])throw n[1];return n[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(i)throw new TypeError("Generator is already executing.");for(;a;)try{if(i=1,r&&(n=2&o[0]?r.return:o[0]?r.throw||((n=r.return)&&n.call(r),0):r.next)&&!(n=n.call(r,o[1])).done)return n;switch(r=0,n&&(o=[2&o[0],n.value]),o[0]){case 0:case 1:n=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(n=a.trys,(n=n.length>0&&n[n.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!n||o[1]>n[0]&&o[1]<n[3])){a.label=o[1];break}if(6===o[0]&&a.label<n[1]){a.label=n[1],n=o;break}if(n&&a.label<n[2]){a.label=n[2],a.ops.push(o);break}n[2]&&a.ops.pop(),a.trys.pop();continue}o=t.call(e,a)}catch(e){o=[6,e],r=0}finally{i=n=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}}function nf(e){var t="function"==typeof Symbol&&Symbol.iterator,i=t&&e[t],r=0;if(i)return i.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function of(e,t){var i="function"==typeof Symbol&&e[Symbol.iterator];if(!i)return e;var r,n,o=i.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=o.next()).done;)a.push(r.value)}catch(e){n={error:e}}finally{try{r&&!r.done&&(i=o.return)&&i.call(o)}finally{if(n)throw n.error}}return a}function af(e,t,i){if(i||2===arguments.length)for(var r,n=0,o=t.length;n<o;n++)!r&&n in t||(r||(r=Array.prototype.slice.call(t,0,n)),r[n]=t[n]);return e.concat(r||Array.prototype.slice.call(t))}function sf(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t,i=e[Symbol.asyncIterator];return i?i.call(e):(e=nf(e),t={},r("next"),r("throw"),r("return"),t[Symbol.asyncIterator]=function(){return this},t);function r(i){t[i]=e[i]&&function(t){return new Promise((function(r,n){(function(e,t,i,r){Promise.resolve(r).then((function(t){e({value:t,done:i})}),t)})(r,n,(t=e[i](t)).done,t.value)}))}}}!function(e){e[e.VIDEO_SOURCE_TYPE_EXTERNAL=0]="VIDEO_SOURCE_TYPE_EXTERNAL",e[e.VIDEO_SOURCE_TYPE_INTERNAL=1]="VIDEO_SOURCE_TYPE_INTERNAL"}(O_||(O_={})),function(e){e[e.AUDIO_SOURCE_TYPE_EXTERNAL=0]="AUDIO_SOURCE_TYPE_EXTERNAL",e[e.AUDIO_SOURCE_TYPE_INTERNAL=1]="AUDIO_SOURCE_TYPE_INTERNAL"}(w_||(w_={})),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"}(k_||(k_={})),function(e){e[e.CHANNEL_PROFILE_COMMUNICATION=0]="CHANNEL_PROFILE_COMMUNICATION",e[e.CHANNEL_PROFILE_LIVE_BROADCASTING=1]="CHANNEL_PROFILE_LIVE_BROADCASTING"}(N_||(N_={})),function(e){e[e.AUTO_SUBSCRIBE_MODE=0]="AUTO_SUBSCRIBE_MODE",e[e.MANUAL_SUBSCRIBE_MODE=1]="MANUAL_SUBSCRIBE_MODE"}(P_||(P_={})),function(e){e[e.SUBSCRIBE_SUCC=0]="SUBSCRIBE_SUCC",e[e.SUBSCRIBE_FAIL=1]="SUBSCRIBE_FAIL"}(D_||(D_={})),function(e){e[e.PUBLISH_SUCC=0]="PUBLISH_SUCC",e[e.PUBLISH_FAIL=1]="PUBLISH_FAIL"}(M_||(M_={})),function(e){e[e.MIRROR_MODE_OFF=0]="MIRROR_MODE_OFF",e[e.MIRROR_MODE_ON=1]="MIRROR_MODE_ON"}(L_||(L_={})),function(e){e[e.RENDER_MODE_HIDDEN=0]="RENDER_MODE_HIDDEN",e[e.RENDER_MODE_FIT=1]="RENDER_MODE_FIT"}(U_||(U_={})),function(e){e[e.STREAM_INDEX_MAIN=0]="STREAM_INDEX_MAIN",e[e.STREAM_INDEX_SCREEN=1]="STREAM_INDEX_SCREEN"}(x_||(x_={})),function(e){e[e.AUDIO=1]="AUDIO",e[e.VIDEO=2]="VIDEO",e[e.AUDIO_AND_VIDEO=3]="AUDIO_AND_VIDEO"}(V_||(V_={})),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"}(F_||(F_={})),function(e){e[e.CONNECTION_START=0]="CONNECTION_START",e[e.CONNECTION_STATE_DISCONNECTED=1]="CONNECTION_STATE_DISCONNECTED",e[e.CONNECTION_STATE_CONNECTING=2]="CONNECTION_STATE_CONNECTING",e[e.CONNECTION_STATE_CONNECTED=3]="CONNECTION_STATE_CONNECTED",e[e.CONNECTION_STATE_RECONNECTING=4]="CONNECTION_STATE_RECONNECTING",e[e.CONNECTION_STATE_RECONNECTED=5]="CONNECTION_STATE_RECONNECTED",e[e.CONNECTION_STATE_LOST=6]="CONNECTION_STATE_LOST"}(B_||(B_={})),function(e){e[e.MIRROR_TYPE_NONE=0]="MIRROR_TYPE_NONE",e[e.MIRROR_TYPE_RENDER=1]="MIRROR_TYPE_RENDER"}(j_||(j_={})),function(e){e[e.domestic=0]="domestic",e[e.overseas=1]="overseas"}(G_||(G_={})),function(e){e[e.OFFLINE=0]="OFFLINE",e[e.ONLINE=1]="ONLINE",e[e.UNREACHABLE=2]="UNREACHABLE"}(H_||(H_={})),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"}(z_||(z_={})),function(e){e[e.PREV_FRAME=0]="PREV_FRAME",e[e.OTHER_FRAME=1]="OTHER_FRAME"}(K_||(K_={})),function(e){e[e.DISABLE=0]="DISABLE",e[e.VIDEO_STREAM_LOW=1]="VIDEO_STREAM_LOW",e[e.AUDIO_ONLY=2]="AUDIO_ONLY"}(W_||(W_={})),function(e){e[e.LOW=0]="LOW",e[e.MEDIUM=100]="MEDIUM",e[e.HIGH=200]="HIGH"}(X_||(X_={})),function(e){e[e.UNKNOWN=0]="UNKNOWN",e[e.EXCELLENT=1]="EXCELLENT",e[e.GOOD=2]="GOOD",e[e.POOR=3]="POOR",e[e.BAD=4]="BAD",e[e.VBAD=5]="VBAD"}(q_||(q_={})),function(e){e[e.Unknown=-1]="Unknown",e[e.SubscribeFallbackByBandwidth=0]="SubscribeFallbackByBandwidth",e[e.SubscribeRecoverByBandwidth=2]="SubscribeRecoverByBandwidth"}(Y_||(Y_={})),function(e){e[e.communication=0]="communication",e[e.chat=5]="chat",e[e.chatRoom=6]="chatRoom",e[e.coHost=9]="coHost",e[e.meeting=16]="meeting",e[e.classRoom=18]="classRoom"}(J_||(J_={})),function(e){e[e.default=0]="default",e[e.fluent=1]="fluent",e[e.standard=2]="standard",e[e.hd=3]="hd",e[e.standardStereo=4]="standardStereo",e[e.hdMono=5]="hdMono"}(Q_||(Q_={})),function(e){e[e.AUTO_PLAY=0]="AUTO_PLAY",e[e.VIDEO_ONLY=1]="VIDEO_ONLY",e[e.PLAY_MANUALLY=2]="PLAY_MANUALLY"}(Z_||(Z_={}));var cf,uf,df,lf=Object.freeze({__proto__:null,get VideoSourceType(){return O_},get AudioSourceType(){return w_},get UserOfflineReason(){return k_},get ChannelProfile(){return N_},get SubscribeMode(){return P_},get SubscribeState(){return D_},get PublishState(){return M_},get MirrorMode(){return L_},get VideoRenderMode(){return U_},get StreamIndex(){return x_},get MediaType(){return V_},get StreamRemoveReason(){return F_},get ConnectionState(){return B_},get MirrorType(){return j_},get LogChannel(){return G_},get USER_ONLINE_STATUS(){return H_},get PublicStreamType(){return z_},get PublicInterpolationMode(){return K_},get SubscribeFallbackOption(){return W_},get RemoteUserPriority(){return X_},get NetworkQuality(){return q_},get FallbackOrRecoverReason(){return Y_},get RoomProfileType(){return J_},get AudioProfileType(){return Q_},get RTCAutoPlayPolicy(){return Z_}});!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"}(cf||(cf={})),function(e){e[e.PLAYOUT=0]="PLAYOUT",e[e.PUBLISH=1]="PUBLISH",e[e.PLAYOUT_AND_PUBLISH=2]="PLAYOUT_AND_PUBLISH"}(uf||(uf={})),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"}(df||(df={}));var hf,pf,_f=Object.freeze({__proto__:null,get AudioMixingDualMonoMode(){return cf},get AudioMixingType(){return uf},get AudioMixingState(){return df}});!function(e){e.onTrackEnded="onTrackEnded",e.onPlayerEvent="onPlayerEvent",e.onAutoplayFailed="onAutoplayFailed",e.onUserJoined="onUserJoined",e.onUserLeave="onUserLeave",e.onConnectionStateChanged="onConnectionStateChanged",e.onUserPublishStream="onUserPublishStream",e.onUserUnpublishStream="onUserUnpublishStream",e.onUserPublishScreen="onUserPublishScreen",e.onUserUnpublishScreen="onUserUnpublishScreen",e.onRoomMessageReceived="onRoomMessageReceived",e.onRoomBinaryMessageReceived="onRoomBinaryMessageReceived",e.onUserMessageReceived="onUserMessageReceived",e.onUserBinaryMessageReceived="onUserBinaryMessageReceived",e.onVideoFirstFrameRendered="onVideoFirstFrameRendered",e.onVideoFirstFrameDecoded="onVideoFirstFrameDecoded",e.onAudioFirstFrameDecoded="onAudioFirstFrameDecoded",e.onFirstPublicStreamVideoFrameRendered="onFirstPublicStreamVideoFrameRendered",e.onFirstPublicStreamVideoFrameDecoded="onFirstPublicStreamVideoFrameDecoded",e.onFirstPublicStreamAudioFrameDecoded="onFirstPublicStreamAudioFrameDecoded",e.onVideoDeviceStateChanged="onVideoDeviceStateChanged",e.onAudioDeviceStateChanged="onAudioDeviceStateChanged",e.onRemoteStreamStats="onRemoteStreamStats",e.onPublicStreamStats="onPublicStreamStats",e.onLocalStreamStats="onLocalStreamStats",e.onAudioVolumeIndication="onAudioVolumeIndication",e.onLocalAudioPropertiesReport="onLocalAudioPropertiesReport",e.onRemoteAudioPropertiesReport="onRemoteAudioPropertiesReport",e.onAudioPlaybackDeviceChanged="onAudioPlaybackDeviceChanged",e.onUserStartVideoCapture="onUserStartVideoCapture",e.onUserStopVideoCapture="onUserStopVideoCapture",e.onUserStartAudioCapture="onUserStartAudioCapture",e.onUserStopAudioCapture="onUserStopAudioCapture",e.onAutoPublishResult="onAutoPublishResult",e.onAutoSubscribeResult="onAutoSubscribeResult",e.onLiveTranscodingResult="onLiveTranscodingResult",e.onStreamMixingEvent="onStreamMixingEvent",e.onAudioPlaybackDeviceTestVolume="onAudioPlaybackDeviceTestVolume",e.onSEIMessageReceived="onSEIMessageReceived",e.onError="onError",e.onAudioMixingStateChanged="onAudioMixingStateChanged",e.onUserMessageReceivedOutsideRoom="onUserMessageReceivedOutsideRoom",e.onUserBinaryMessageReceivedOutsideRoom="onUserBinaryMessageReceivedOutsideRoom",e.onTokenWillExpire="onTokenWillExpire",e.onCloudProxyConnected="onCloudProxyConnected",e.onPushPublicStreamResult="onPushPublicStreamResult",e.onPublicStreamSEIMessageReceived="onPublicStreamSEIMessageReceived",e.onNetworkQuality="onNetworkQuality",e.onSimulcastSubscribeFallback="onSimulcastSubscribeFallback",e.onRemoteVideoSizeChanged="onRemoteVideoSizeChanged",e.onLocalVideoSizeChanged="onLocalVideoSizeChanged",e.onLocalCameraStalled="onLocalCameraStalled"}(hf||(hf={})),function(e){e[e.ERR_OK=0]="ERR_OK",e[e.ERR_PARAM_INVALID=1]="ERR_PARAM_INVALID",e[e.ERR_FRAME_TIMEOUT=2]="ERR_FRAME_TIMEOUT",e[e.ERR_POSTPROCESS=3]="ERR_POSTPROCESS",e[e.ERR_PUSH_CDN=4]="ERR_PUSH_CDN",e[e.ERR_UNKNOWN=9999]="ERR_UNKNOWN"}(pf||(pf={}));var ff=Ia.forEach,vf=Gn("forEach")?[].forEach:function(e){return ff(this,e,arguments.length>1?arguments[1]:void 0)};Xr({target:"Array",proto:!0,forced:[].forEach!=vf},{forEach:vf});var mf=o,yf=Op,Sf=Np,gf=vf,Ef=qt,bf=function(e){if(e&&e.forEach!==gf)try{Ef(e,"forEach",gf)}catch(t){e.forEach=gf}};for(var If in yf)yf[If]&&bf(mf[If]&&mf[If].prototype);bf(Sf);var Tf=ur.includes,Af=sh;Xr({target:"Array",proto:!0},{includes:function(e){return Tf(this,e,arguments.length>1?arguments[1]:void 0)}}),Af("includes");var Rf=H,Cf=w,Of=et("match"),wf=function(e){var t;return Rf(e)&&(void 0!==(t=e[Of])?!!t:"RegExp"==Cf(e))},kf=wf,Nf=o.TypeError,Pf=function(e){if(kf(e))throw Nf("The method doesn't accept regular expressions");return e},Df=et("match"),Mf=function(e){var t=/./;try{"/./"[e](t)}catch(i){try{return t[Df]=!1,"/./"[e](t)}catch(e){}}return!1},Lf=Xr,Uf=Pf,xf=x,Vf=fo,Ff=Mf,Bf=A("".indexOf);Lf({target:"String",proto:!0,forced:!Ff("includes")},{includes:function(e){return!!~Bf(Vf(xf(this)),Vf(Uf(e)),arguments.length>1?arguments[1]:void 0)}});var jf=Mt,Gf=function(){var e=jf(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},Hf=s,zf=o.RegExp,Kf=Hf((function(){var e=zf("a","y");return e.lastIndex=2,null!=e.exec("abcd")})),Wf=Kf||Hf((function(){return!zf("a","y").sticky})),Xf={BROKEN_CARET:Kf||Hf((function(){var e=zf("^r","gy");return e.lastIndex=2,null!=e.exec("str")})),MISSED_STICKY:Wf,UNSUPPORTED_Y:Kf},qf=s,Yf=o.RegExp,Jf=qf((function(){var e=Yf(".","s");return!(e.dotAll&&e.exec("\n")&&"s"===e.flags)})),Qf=s,Zf=o.RegExp,$f=Qf((function(){var e=Zf("(?<a>b)","g");return"b"!==e.exec("b").groups.a||"bc"!=="b".replace(e,"$<a>c")})),ev=h,tv=A,iv=fo,rv=Gf,nv=Xf,ov=Ae.exports,av=Rn,sv=wi.get,cv=Jf,uv=$f,dv=ov("native-string-replace",String.prototype.replace),lv=RegExp.prototype.exec,hv=lv,pv=tv("".charAt),_v=tv("".indexOf),fv=tv("".replace),vv=tv("".slice),mv=function(){var e=/a/,t=/b*/g;return ev(lv,e,"a"),ev(lv,t,"a"),0!==e.lastIndex||0!==t.lastIndex}(),yv=nv.BROKEN_CARET,Sv=void 0!==/()??/.exec("")[1];(mv||Sv||yv||cv||uv)&&(hv=function(e){var t,i,r,n,o,a,s,c=this,u=sv(c),d=iv(e),l=u.raw;if(l)return l.lastIndex=c.lastIndex,t=ev(hv,l,d),c.lastIndex=l.lastIndex,t;var h=u.groups,p=yv&&c.sticky,_=ev(rv,c),f=c.source,v=0,m=d;if(p&&(_=fv(_,"y",""),-1===_v(_,"g")&&(_+="g"),m=vv(d,c.lastIndex),c.lastIndex>0&&(!c.multiline||c.multiline&&"\n"!==pv(d,c.lastIndex-1))&&(f="(?: "+f+")",m=" "+m,v++),i=new RegExp("^(?:"+f+")",_)),Sv&&(i=new RegExp("^"+f+"$(?!\\s)",_)),mv&&(r=c.lastIndex),n=ev(lv,p?i:c,m),p?n?(n.input=vv(n.input,v),n[0]=vv(n[0],v),n.index=c.lastIndex,c.lastIndex+=n[0].length):c.lastIndex=0:mv&&n&&(c.lastIndex=c.global?n.index+n[0].length:r),Sv&&n&&n.length>1&&ev(dv,n[0],i,(function(){for(o=1;o<arguments.length-2;o++)void 0===arguments[o]&&(n[o]=void 0)})),n&&h)for(n.groups=a=av(null),o=0;o<h.length;o++)a[(s=h[o])[0]]=n[s[1]];return n});var gv=hv;Xr({target:"RegExp",proto:!0,forced:/./.exec!==gv},{exec:gv});var Ev=A,bv=Yt.exports,Iv=gv,Tv=s,Av=et,Rv=qt,Cv=Av("species"),Ov=RegExp.prototype,wv=function(e,t,i,r){var n=Av(e),o=!Tv((function(){var t={};return t[n]=function(){return 7},7!=""[e](t)})),a=o&&!Tv((function(){var t=!1,i=/a/;return"split"===e&&((i={}).constructor={},i.constructor[Cv]=function(){return i},i.flags="",i[n]=/./[n]),i.exec=function(){return t=!0,null},i[n](""),!t}));if(!o||!a||i){var s=Ev(/./[n]),c=t(n,""[e],(function(e,t,i,r,n){var a=Ev(e),c=t.exec;return c===Iv||c===Ov.exec?o&&!n?{done:!0,value:s(t,i,r)}:{done:!0,value:a(i,t,r)}:{done:!1}}));bv(String.prototype,e,c[0]),bv(Ov,n,c[1])}r&&Rv(Ov[n],"sham",!0)},kv=Object.is||function(e,t){return e===t?0!==e||1/e==1/t:e!=e&&t!=t},Nv=h,Pv=Mt,Dv=j,Mv=w,Lv=gv,Uv=o.TypeError,xv=function(e,t){var i=e.exec;if(Dv(i)){var r=Nv(i,e,t);return null!==r&&Pv(r),r}if("RegExp"===Mv(e))return Nv(Lv,e,t);throw Uv("RegExp#exec called on incompatible receiver")},Vv=h,Fv=Mt,Bv=x,jv=kv,Gv=fo,Hv=ge,zv=xv;wv("search",(function(e,t,i){return[function(t){var i=Bv(this),r=null==t?void 0:Hv(t,e);return r?Vv(r,t,i):new RegExp(t)[e](Gv(i))},function(e){var r=Fv(this),n=Gv(e),o=i(t,r,n);if(o.done)return o.value;var a=r.lastIndex;jv(a,0)||(r.lastIndex=0);var s=zv(r,n);return jv(r.lastIndex,a)||(r.lastIndex=a),null===s?-1:s.index}]}));var Kv=Xr,Wv=A,Xv=o.Date,qv=Wv(Xv.prototype.getTime);Kv({target:"Date",stat:!0},{now:function(){return qv(new Xv)}});var Yv=A,Jv=Yt.exports,Qv=Date.prototype,Zv="Invalid Date",$v="toString",em=Yv(Qv.toString),tm=Yv(Qv.getTime);function im(e,t,i){return t in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}String(new Date(NaN))!=Zv&&Jv(Qv,$v,(function(){var e=tm(this);return e==e?em(this):Zv}));var rm=gp.charAt,nm=function(e,t,i){return t+(i?rm(e,t).length:1)},om=h,am=Mt,sm=ir,cm=fo,um=x,dm=ge,lm=nm,hm=xv;wv("match",(function(e,t,i){return[function(t){var i=um(this),r=null==t?void 0:dm(t,e);return r?om(r,t,i):new RegExp(t)[e](cm(i))},function(e){var r=am(this),n=cm(e),o=i(t,r,n);if(o.done)return o.value;if(!r.global)return hm(r,n);var a=r.unicode;r.lastIndex=0;for(var s,c=[],u=0;null!==(s=hm(r,n));){var d=cm(s[0]);c[u]=d,""===d&&(r.lastIndex=lm(n,sm(r.lastIndex),a)),u++}return 0===u?null:c}]}));var pm="\t\n\v\f\r                 \u2028\u2029\ufeff",_m=x,fm=fo,vm=A("".replace),mm="[\t\n\v\f\r                 \u2028\u2029\ufeff]",ym=RegExp("^"+mm+mm+"*"),Sm=RegExp(mm+mm+"*$"),gm=function(e){return function(t){var i=fm(_m(t));return 1&e&&(i=vm(i,ym,"")),2&e&&(i=vm(i,Sm,"")),i}},Em={start:gm(1),end:gm(2),trim:gm(3)},bm=o,Im=s,Tm=A,Am=fo,Rm=Em.trim,Cm=pm,Om=bm.parseInt,wm=bm.Symbol,km=wm&&wm.iterator,Nm=/^[+-]?0x/i,Pm=Tm(Nm.exec),Dm=8!==Om(Cm+"08")||22!==Om(Cm+"0x16")||km&&!Im((function(){Om(Object(km))}))?function(e,t){var i=Rm(Am(e));return Om(i,t>>>0||(Pm(Nm,i)?16:10))}:Om;Xr({global:!0,forced:parseInt!=Dm},{parseInt:Dm});var Mm={exports:{}},Lm=s((function(){if("function"==typeof ArrayBuffer){var e=new ArrayBuffer(8);Object.isExtensible(e)&&Object.defineProperty(e,"a",{value:8})}})),Um=s,xm=H,Vm=w,Fm=Lm,Bm=Object.isExtensible,jm=Um((function(){Bm(1)}))||Fm?function(e){return!!xm(e)&&((!Fm||"ArrayBuffer"!=Vm(e))&&(!Bm||Bm(e)))}:Bm,Gm=!s((function(){return Object.isExtensible(Object.preventExtensions({}))})),Hm=Xr,zm=A,Km=li,Wm=H,Xm=Ve,qm=Ot.f,Ym=Wi,Jm=vo,Qm=jm,Zm=Gm,$m=!1,ey=He("meta"),ty=0,iy=function(e){qm(e,ey,{value:{objectID:"O"+ty++,weakData:{}}})},ry=Mm.exports={enable:function(){ry.enable=function(){},$m=!0;var e=Ym.f,t=zm([].splice),i={};i[ey]=1,e(i).length&&(Ym.f=function(i){for(var r=e(i),n=0,o=r.length;n<o;n++)if(r[n]===ey){t(r,n,1);break}return r},Hm({target:"Object",stat:!0,forced:!0},{getOwnPropertyNames:Jm.f}))},fastKey:function(e,t){if(!Wm(e))return"symbol"==typeof e?e:("string"==typeof e?"S":"P")+e;if(!Xm(e,ey)){if(!Qm(e))return"F";if(!t)return"E";iy(e)}return e[ey].objectID},getWeakData:function(e,t){if(!Xm(e,ey)){if(!Qm(e))return!0;if(!t)return!1;iy(e)}return e[ey].weakData},onFreeze:function(e){return Zm&&$m&&Qm(e)&&!Xm(e,ey)&&iy(e),e}};Km[ey]=!0;var ny=j,oy=H,ay=tn,sy=function(e,t,i){var r,n;return ay&&ny(r=t.constructor)&&r!==i&&oy(n=r.prototype)&&n!==i.prototype&&ay(e,n),e},cy=Xr,uy=o,dy=A,ly=Fr,hy=Yt.exports,py=Mm.exports,_y=Xc,fy=hc,vy=j,my=H,yy=s,Sy=iu,gy=Ho,Ey=sy,by=function(e,t,i){var r=-1!==e.indexOf("Map"),n=-1!==e.indexOf("Weak"),o=r?"set":"add",a=uy[e],s=a&&a.prototype,c=a,u={},d=function(e){var t=dy(s[e]);hy(s,e,"add"==e?function(e){return t(this,0===e?0:e),this}:"delete"==e?function(e){return!(n&&!my(e))&&t(this,0===e?0:e)}:"get"==e?function(e){return n&&!my(e)?void 0:t(this,0===e?0:e)}:"has"==e?function(e){return!(n&&!my(e))&&t(this,0===e?0:e)}:function(e,i){return t(this,0===e?0:e,i),this})};if(ly(e,!vy(a)||!(n||s.forEach&&!yy((function(){(new a).entries().next()})))))c=i.getConstructor(t,e,r,o),py.enable();else if(ly(e,!0)){var l=new c,h=l[o](n?{}:-0,1)!=l,p=yy((function(){l.has(1)})),_=Sy((function(e){new a(e)})),f=!n&&yy((function(){for(var e=new a,t=5;t--;)e[o](t,t);return!e.has(-0)}));_||((c=t((function(e,t){fy(e,s);var i=Ey(new a,e,c);return null!=t&&_y(t,i[o],{that:i,AS_ENTRIES:r}),i}))).prototype=s,s.constructor=c),(p||f)&&(d("delete"),d("has"),r&&d("get")),(f||h)&&d(o),n&&s.clear&&delete s.clear}return u[e]=c,cy({global:!0,forced:c!=a},u),gy(c,e),n||i.setStrong(c,e,r),c},Iy=Ot.f,Ty=Rn,Ay=nc,Ry=Xo,Cy=hc,Oy=Xc,wy=$h,ky=uc,Ny=c,Py=Mm.exports.fastKey,Dy=wi.set,My=wi.getterFor,Ly={getConstructor:function(e,t,i,r){var n=e((function(e,n){Cy(e,o),Dy(e,{type:t,index:Ty(null),first:void 0,last:void 0,size:0}),Ny||(e.size=0),null!=n&&Oy(n,e[r],{that:e,AS_ENTRIES:i})})),o=n.prototype,a=My(t),s=function(e,t,i){var r,n,o=a(e),s=c(e,t);return s?s.value=i:(o.last=s={index:n=Py(t,!0),key:t,value:i,previous:r=o.last,next:void 0,removed:!1},o.first||(o.first=s),r&&(r.next=s),Ny?o.size++:e.size++,"F"!==n&&(o.index[n]=s)),e},c=function(e,t){var i,r=a(e),n=Py(t);if("F"!==n)return r.index[n];for(i=r.first;i;i=i.next)if(i.key==t)return i};return Ay(o,{clear:function(){for(var e=a(this),t=e.index,i=e.first;i;)i.removed=!0,i.previous&&(i.previous=i.previous.next=void 0),delete t[i.index],i=i.next;e.first=e.last=void 0,Ny?e.size=0:this.size=0},delete:function(e){var t=this,i=a(t),r=c(t,e);if(r){var n=r.next,o=r.previous;delete i.index[r.index],r.removed=!0,o&&(o.next=n),n&&(n.previous=o),i.first==r&&(i.first=n),i.last==r&&(i.last=o),Ny?i.size--:t.size--}return!!r},forEach:function(e){for(var t,i=a(this),r=Ry(e,arguments.length>1?arguments[1]:void 0);t=t?t.next:i.first;)for(r(t.value,t.key,this);t&&t.removed;)t=t.previous},has:function(e){return!!c(this,e)}}),Ay(o,i?{get:function(e){var t=c(this,e);return t&&t.value},set:function(e,t){return s(this,0===e?0:e,t)}}:{add:function(e){return s(this,e=0===e?0:e,e)}}),Ny&&Iy(o,"size",{get:function(){return a(this).size}}),n},setStrong:function(e,t,i){var r=t+" Iterator",n=My(t),o=My(r);wy(e,t,(function(e,t){Dy(this,{type:r,target:e,state:n(e),kind:t,last:void 0})}),(function(){for(var e=o(this),t=e.kind,i=e.last;i&&i.removed;)i=i.previous;return e.target&&(e.last=i=i?i.next:e.state.first)?"keys"==t?{value:i.key,done:!1}:"values"==t?{value:i.value,done:!1}:{value:[i.key,i.value],done:!1}:(e.target=void 0,{value:void 0,done:!0})}),i?"entries":"values",!i,!0),ky(t)}};by("Map",(function(e){return function(){return e(this,arguments.length?arguments[0]:void 0)}}),Ly);var Uy=Le,xy=an;Xr({target:"Object",stat:!0,forced:s((function(){xy(1)}))},{keys:function(e){return xy(Uy(e))}});var Vy=ye,Fy=Le,By=L,jy=nr,Gy=o.TypeError,Hy=function(e){return function(t,i,r,n){Vy(i);var o=Fy(t),a=By(o),s=jy(o),c=e?s-1:0,u=e?-1:1;if(r<2)for(;;){if(c in a){n=a[c],c+=u;break}if(c+=u,e?c<0:s<=c)throw Gy("Reduce of empty array with no initial value")}for(;e?c>=0:s>c;c+=u)c in a&&(n=i(n,a[c],c,o));return n}},zy={left:Hy(!1),right:Hy(!0)},Ky=zy.left,Wy=ie,Xy=_u;Xr({target:"Array",proto:!0,forced:!Gn("reduce")||!Xy&&Wy>79&&Wy<83},{reduce:function(e){var t=arguments.length;return Ky(this,e,t,t>1?arguments[1]:void 0)}});var qy,Yy=Xr,Jy=A,Qy=a.f,Zy=ir,$y=fo,eS=Pf,tS=x,iS=Mf,rS=Jy("".endsWith),nS=Jy("".slice),oS=Math.min,aS=iS("endsWith");Yy({target:"String",proto:!0,forced:!!(aS||(qy=Qy(String.prototype,"endsWith"),!qy||qy.writable))&&!aS},{endsWith:function(e){var t=$y(tS(this));eS(e);var i=arguments.length>1?arguments[1]:void 0,r=t.length,n=void 0===i?r:oS(Zy(i),r),o=$y(e);return rS?rS(t,o,n):nS(t,n-o.length,n)===o}});var sS=!0,cS=!0;function uS(e,t,i){var r=e.match(t);return r&&r.length>=i&&parseInt(r[i],10)}function dS(e,t,i){if(e.RTCPeerConnection){var r=e.RTCPeerConnection.prototype,n=r.addEventListener;r.addEventListener=function(e,r){if(e!==t)return n.apply(this,arguments);var o=function(e){var t=i(e);t&&(r.handleEvent?r.handleEvent(t):r(t))};return this._eventMap=this._eventMap||{},this._eventMap[t]||(this._eventMap[t]=new Map),this._eventMap[t].set(r,o),n.apply(this,[e,o])};var o=r.removeEventListener;r.removeEventListener=function(e,i){if(e!==t||!this._eventMap||!this._eventMap[t])return o.apply(this,arguments);if(!this._eventMap[t].has(i))return o.apply(this,arguments);var r=this._eventMap[t].get(i);return this._eventMap[t].delete(i),0===this._eventMap[t].size&&delete this._eventMap[t],0===Object.keys(this._eventMap).length&&delete this._eventMap,o.apply(this,[e,r])},Object.defineProperty(r,"on"+t,{get:function(){return this["_on"+t]},set:function(e){this["_on"+t]&&(this.removeEventListener(t,this["_on"+t]),delete this["_on"+t]),e&&this.addEventListener(t,this["_on"+t]=e)},enumerable:!0,configurable:!0})}}function lS(e){return"boolean"!=typeof e?new Error("Argument type: "+t(e)+". Please use a boolean."):(sS=e,e?"adapter.js logging disabled":"adapter.js logging enabled")}function hS(e){return"boolean"!=typeof e?new Error("Argument type: "+t(e)+". Please use a boolean."):(cS=!e,"adapter.js deprecation warnings "+(e?"disabled":"enabled"))}function pS(){if("object"===("undefined"==typeof window?"undefined":t(window))){if(sS)return;"undefined"!=typeof console&&"function"==typeof console.log&&console.log.apply(console,arguments)}}function _S(e,t){cS&&console.warn(e+" is deprecated, please use "+t+" instead.")}function fS(e){var t={browser:null,version:null};if(void 0===e||!e.navigator)return t.browser="Not a browser.",t;var i=e.navigator;if(i.mozGetUserMedia)t.browser="firefox",t.version=uS(i.userAgent,/Firefox\/(\d+)\./,1);else if(i.webkitGetUserMedia||!1===e.isSecureContext&&e.webkitRTCPeerConnection&&!e.RTCIceGatherer)t.browser="chrome",t.version=uS(i.userAgent,/Chrom(e|ium)\/(\d+)\./,2);else{if(!e.RTCPeerConnection||!i.userAgent.match(/AppleWebKit\/(\d+)\./))return t.browser="Not a supported browser.",t;t.browser="safari",t.version=uS(i.userAgent,/AppleWebKit\/(\d+)\./,1),t.supportsUnifiedPlan=e.RTCRtpTransceiver&&"currentDirection"in e.RTCRtpTransceiver.prototype}return t}function vS(e){return"[object Object]"===Object.prototype.toString.call(e)}function mS(e){return vS(e)?Object.keys(e).reduce((function(t,i){var r=vS(e[i]),n=r?mS(e[i]):e[i],o=r&&!Object.keys(n).length;return void 0===n||o?t:Object.assign(t,im({},i,n))}),{}):e}function yS(e,t,i){t&&!i.has(t.id)&&(i.set(t.id,t),Object.keys(t).forEach((function(r){r.endsWith("Id")?yS(e,e.get(t[r]),i):r.endsWith("Ids")&&t[r].forEach((function(t){yS(e,e.get(t),i)}))})))}function SS(e,t,i){var r=i?"outbound-rtp":"inbound-rtp",n=new Map;if(null===t)return n;var o=[];return e.forEach((function(e){"track"===e.type&&e.trackIdentifier===t.id&&o.push(e)})),o.forEach((function(t){e.forEach((function(i){i.type===r&&i.trackId===t.id&&yS(e,i,n)}))})),n}var gS=Xr,ES=Ia.find,bS=sh,IS="find",TS=!0;IS in[]&&Array(1).find((function(){TS=!1})),gS({target:"Array",proto:!0,forced:TS},{find:function(e){return ES(this,e,arguments.length>1?arguments[1]:void 0)}}),bS(IS);var AS=Xr,RS=o,CS=$i,OS=Yi,wS=nr,kS=Le,NS=fa,PS=go,DS=Wp("splice"),MS=RS.TypeError,LS=Math.max,US=Math.min,xS=9007199254740991,VS="Maximum allowed length exceeded";AS({target:"Array",proto:!0,forced:!DS},{splice:function(e,t){var i,r,n,o,a,s,c=kS(this),u=wS(c),d=CS(e,u),l=arguments.length;if(0===l?i=r=0:1===l?(i=0,r=u-d):(i=l-2,r=US(LS(OS(t),0),u-d)),u+i-r>xS)throw MS(VS);for(n=NS(c,r),o=0;o<r;o++)(a=d+o)in c&&PS(n,o,c[a]);if(n.length=r,i<r){for(o=d;o<u-r;o++)s=o+i,(a=o+r)in c?c[s]=c[a]:delete c[s];for(o=u;o>u-r+i;o--)delete c[o-1]}else if(i>r)for(o=u-r;o>d;o--)s=o+i-1,(a=o+r-1)in c?c[s]=c[a]:delete c[s];for(o=0;o<i;o++)c[o+d]=arguments[o+2];return c.length=u-r+i,n}});var FS=Ia.map;Xr({target:"Array",proto:!0,forced:!Wp("map")},{map:function(e){return FS(this,e,arguments.length>1?arguments[1]:void 0)}});var BS=Ia.filter;Xr({target:"Array",proto:!0,forced:!Wp("filter")},{filter:function(e){return BS(this,e,arguments.length>1?arguments[1]:void 0)}});var jS=A,GS=Le,HS=Math.floor,zS=jS("".charAt),KS=jS("".replace),WS=jS("".slice),XS=/\$([$&'`]|\d{1,2}|<[^>]*>)/g,qS=/\$([$&'`]|\d{1,2})/g,YS=function(e,t,i,r,n,o){var a=i+e.length,s=r.length,c=qS;return void 0!==n&&(n=GS(n),c=XS),KS(o,c,(function(o,c){var u;switch(zS(c,0)){case"$":return"$";case"&":return e;case"`":return WS(t,0,i);case"'":return WS(t,a);case"<":u=n[WS(c,1,-1)];break;default:var d=+c;if(0===d)return o;if(d>s){var l=HS(d/10);return 0===l?o:l<=s?void 0===r[l-1]?zS(c,1):r[l-1]+zS(c,1):o}u=r[d-1]}return void 0===u?"":u}))},JS=$n,QS=h,ZS=A,$S=wv,eg=s,tg=Mt,ig=j,rg=Yi,ng=ir,og=fo,ag=x,sg=nm,cg=ge,ug=YS,dg=xv,lg=et("replace"),hg=Math.max,pg=Math.min,_g=ZS([].concat),fg=ZS([].push),vg=ZS("".indexOf),mg=ZS("".slice),yg="$0"==="a".replace(/./,"$0"),Sg=!!/./[lg]&&""===/./[lg]("a","$0");$S("replace",(function(e,t,i){var r=Sg?"$":"$0";return[function(e,i){var r=ag(this),n=null==e?void 0:cg(e,lg);return n?QS(n,e,r,i):QS(t,og(r),e,i)},function(e,n){var o=tg(this),a=og(e);if("string"==typeof n&&-1===vg(n,r)&&-1===vg(n,"$<")){var s=i(t,o,a,n);if(s.done)return s.value}var c=ig(n);c||(n=og(n));var u=o.global;if(u){var d=o.unicode;o.lastIndex=0}for(var l=[];;){var h=dg(o,a);if(null===h)break;if(fg(l,h),!u)break;""===og(h[0])&&(o.lastIndex=sg(a,ng(o.lastIndex),d))}for(var p,_="",f=0,v=0;v<l.length;v++){for(var m=og((h=l[v])[0]),y=hg(pg(rg(h.index),a.length),0),S=[],g=1;g<h.length;g++)fg(S,void 0===(p=h[g])?p:String(p));var E=h.groups;if(c){var b=_g([m],S,y,a);void 0!==E&&fg(b,E);var I=og(JS(n,void 0,b))}else I=ug(m,a,y,S,E,n);y>=f&&(_+=mg(a,f,y)+I,f=y+m.length)}return _+mg(a,f)}]}),!!eg((function(){var e=/./;return e.exec=function(){var e=[];return e.groups={a:"7"},e},"7"!=="".replace(e,"$<a>")}))||!yg||Sg);var gg=c,Eg=o,bg=A,Ig=Fr,Tg=sy,Ag=qt,Rg=Ot.f,Cg=Wi.f,Og=q,wg=wf,kg=fo,Ng=Gf,Pg=Xf,Dg=Yt.exports,Mg=s,Lg=Ve,Ug=wi.enforce,xg=uc,Vg=Jf,Fg=$f,Bg=et("match"),jg=Eg.RegExp,Gg=jg.prototype,Hg=Eg.SyntaxError,zg=bg(Ng),Kg=bg(Gg.exec),Wg=bg("".charAt),Xg=bg("".replace),qg=bg("".indexOf),Yg=bg("".slice),Jg=/^\?<[^\s\d!#%&*+<=>@^][^\s!#%&*+<=>@^]*>/,Qg=/a/g,Zg=/a/g,$g=new jg(Qg)!==Qg,eE=Pg.MISSED_STICKY,tE=Pg.UNSUPPORTED_Y,iE=gg&&(!$g||eE||Vg||Fg||Mg((function(){return Zg[Bg]=!1,jg(Qg)!=Qg||jg(Zg)==Zg||"/a/i"!=jg(Qg,"i")})));if(Ig("RegExp",iE)){for(var rE=function(e,t){var i,r,n,o,a,s,c=Og(Gg,this),u=wg(e),d=void 0===t,l=[],h=e;if(!c&&u&&d&&e.constructor===rE)return e;if((u||Og(Gg,e))&&(e=e.source,d&&(t="flags"in h?h.flags:zg(h))),e=void 0===e?"":kg(e),t=void 0===t?"":kg(t),h=e,Vg&&"dotAll"in Qg&&(r=!!t&&qg(t,"s")>-1)&&(t=Xg(t,/s/g,"")),i=t,eE&&"sticky"in Qg&&(n=!!t&&qg(t,"y")>-1)&&tE&&(t=Xg(t,/y/g,"")),Fg&&(o=function(e){for(var t,i=e.length,r=0,n="",o=[],a={},s=!1,c=!1,u=0,d="";r<=i;r++){if("\\"===(t=Wg(e,r)))t+=Wg(e,++r);else if("]"===t)s=!1;else if(!s)switch(!0){case"["===t:s=!0;break;case"("===t:Kg(Jg,Yg(e,r+1))&&(r+=2,c=!0),n+=t,u++;continue;case">"===t&&c:if(""===d||Lg(a,d))throw new Hg("Invalid capture group name");a[d]=!0,o[o.length]=[d,u],c=!1,d="";continue}c?d+=t:n+=t}return[n,o]}(e),e=o[0],l=o[1]),a=Tg(jg(e,t),c?this:Gg,rE),(r||n||l.length)&&(s=Ug(a),r&&(s.dotAll=!0,s.raw=rE(function(e){for(var t,i=e.length,r=0,n="",o=!1;r<=i;r++)"\\"!==(t=Wg(e,r))?o||"."!==t?("["===t?o=!0:"]"===t&&(o=!1),n+=t):n+="[\\s\\S]":n+=t+Wg(e,++r);return n}(e),i)),n&&(s.sticky=!0),l.length&&(s.groups=l)),e!==h)try{Ag(a,"source",""===h?"(?:)":h)}catch(e){}return a},nE=function(e){e in rE||Rg(rE,e,{configurable:!0,get:function(){return jg[e]},set:function(t){jg[e]=t}})},oE=Cg(jg),aE=0;oE.length>aE;)nE(oE[aE++]);Gg.constructor=rE,rE.prototype=Gg,Dg(Eg,"RegExp",rE)}xg("RegExp");var sE=A,cE=Li.PROPER,uE=Yt.exports,dE=Mt,lE=q,hE=fo,pE=s,_E=Gf,fE="toString",vE=RegExp.prototype,mE=vE.toString,yE=sE(_E),SE=pE((function(){return"/a/b"!=mE.call({source:"a",flags:"b"})})),gE=cE&&mE.name!=fE;(SE||gE)&&uE(RegExp.prototype,fE,(function(){var e=dE(this),t=hE(e.source),i=e.flags;return"/"+t+"/"+hE(void 0===i&&lE(vE,e)&&!("flags"in vE)?yE(e):i)}),{unsafe:!0});var EE=Ia.some;Xr({target:"Array",proto:!0,forced:!Gn("some")},{some:function(e){return EE(this,e,arguments.length>1?arguments[1]:void 0)}});var bE=c,IE=Li.EXISTS,TE=A,AE=Ot.f,RE=Function.prototype,CE=TE(RE.toString),OE=/function\b(?:\s|\/\*[\S\s]*?\*\/|\/\/[^\n\r]*[\n\r]+)*([^\s(/]*)/,wE=TE(OE.exec);bE&&!IE&&AE(RE,"name",{configurable:!0,get:function(){try{return wE(OE,CE(this))[1]}catch(e){return""}}});var kE=A,NE=ye,PE=H,DE=Ve,ME=Po,LE=u,UE=o.Function,xE=kE([].concat),VE=kE([].join),FE={},BE=function(e,t,i){if(!DE(FE,t)){for(var r=[],n=0;n<t;n++)r[n]="a["+n+"]";FE[t]=UE("C,a","return new C("+VE(r,",")+")")}return FE[t](e,i)},jE=LE?UE.bind:function(e){var t=NE(this),i=t.prototype,r=ME(arguments,1),n=function(){var i=xE(r,ME(arguments));return this instanceof n?BE(t,i.length,i):t.apply(e,i)};return PE(i)&&(n.prototype=i),n},GE=jE;Xr({target:"Function",proto:!0,forced:Function.bind!==GE},{bind:GE});var HE=pS;function zE(e,i){var r=e&&e.navigator;if(r.mediaDevices){var n=function(e){if("object"!==t(e)||e.mandatory||e.optional)return e;var i={};return Object.keys(e).forEach((function(r){if("require"!==r&&"advanced"!==r&&"mediaSource"!==r){var n="object"===t(e[r])?e[r]:{ideal:e[r]};void 0!==n.exact&&"number"==typeof n.exact&&(n.min=n.max=n.exact);var o=function(e,t){return e?e+t.charAt(0).toUpperCase()+t.slice(1):"deviceId"===t?"sourceId":t};if(void 0!==n.ideal){i.optional=i.optional||[];var a={};"number"==typeof n.ideal?(a[o("min",r)]=n.ideal,i.optional.push(a),(a={})[o("max",r)]=n.ideal,i.optional.push(a)):(a[o("",r)]=n.ideal,i.optional.push(a))}void 0!==n.exact&&"number"!=typeof n.exact?(i.mandatory=i.mandatory||{},i.mandatory[o("",r)]=n.exact):["min","max"].forEach((function(e){void 0!==n[e]&&(i.mandatory=i.mandatory||{},i.mandatory[o(e,r)]=n[e])}))}})),e.advanced&&(i.optional=(i.optional||[]).concat(e.advanced)),i},o=function(e,o){if(i.version>=61)return o(e);if((e=JSON.parse(JSON.stringify(e)))&&"object"===t(e.audio)){var a=function(e,t,i){t in e&&!(i in e)&&(e[i]=e[t],delete e[t])};a((e=JSON.parse(JSON.stringify(e))).audio,"autoGainControl","googAutoGainControl"),a(e.audio,"noiseSuppression","googNoiseSuppression"),e.audio=n(e.audio)}if(e&&"object"===t(e.video)){var s=e.video.facingMode;s=s&&("object"===t(s)?s:{ideal:s});var c,u=i.version<66;if(s&&("user"===s.exact||"environment"===s.exact||"user"===s.ideal||"environment"===s.ideal)&&(!r.mediaDevices.getSupportedConstraints||!r.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 r.mediaDevices.enumerateDevices().then((function(t){var i=(t=t.filter((function(e){return"videoinput"===e.kind}))).find((function(e){return c.some((function(t){return e.label.toLowerCase().includes(t)}))}));return!i&&t.length&&c.includes("back")&&(i=t[t.length-1]),i&&(e.video.deviceId=s.exact?{exact:i.deviceId}:{ideal:i.deviceId}),e.video=n(e.video),HE("chrome: "+JSON.stringify(e)),o(e)}));e.video=n(e.video)}return HE("chrome: "+JSON.stringify(e)),o(e)},a=function(e){return i.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(r.getUserMedia=function(e,t,i){o(e,(function(e){r.webkitGetUserMedia(e,t,(function(e){i&&i(a(e))}))}))}.bind(r),r.mediaDevices.getUserMedia){var s=r.mediaDevices.getUserMedia.bind(r.mediaDevices);r.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 KE(e){e.MediaStream=e.MediaStream||e.webkitMediaStream}function WE(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 i=e.RTCPeerConnection.prototype.setRemoteDescription;e.RTCPeerConnection.prototype.setRemoteDescription=function(){var t=this;return this._ontrackpoly||(this._ontrackpoly=function(i){i.stream.addEventListener("addtrack",(function(r){var n;n=e.RTCPeerConnection.prototype.getReceivers?t.getReceivers().find((function(e){return e.track&&e.track.id===r.track.id})):{track:r.track};var o=new Event("track");o.track=r.track,o.receiver=n,o.transceiver={receiver:n},o.streams=[i.stream],t.dispatchEvent(o)})),i.stream.getTracks().forEach((function(r){var n;n=e.RTCPeerConnection.prototype.getReceivers?t.getReceivers().find((function(e){return e.track&&e.track.id===r.id})):{track:r};var o=new Event("track");o.track=r,o.receiver=n,o.transceiver={receiver:n},o.streams=[i.stream],t.dispatchEvent(o)}))},this.addEventListener("addstream",this._ontrackpoly)),i.apply(this,arguments)}}else dS(e,"track",(function(e){return e.transceiver||Object.defineProperty(e,"transceiver",{value:{receiver:e.receiver}}),e}))}function XE(e){if("object"===t(e)&&e.RTCPeerConnection&&!("getSenders"in e.RTCPeerConnection.prototype)&&"createDTMFSender"in e.RTCPeerConnection.prototype){var i=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 r=e.RTCPeerConnection.prototype.addTrack;e.RTCPeerConnection.prototype.addTrack=function(e,t){var n=r.apply(this,arguments);return n||(n=i(this,e),this._senders.push(n)),n};var n=e.RTCPeerConnection.prototype.removeTrack;e.RTCPeerConnection.prototype.removeTrack=function(e){n.apply(this,arguments);var t=this._senders.indexOf(e);-1!==t&&this._senders.splice(t,1)}}var o=e.RTCPeerConnection.prototype.addStream;e.RTCPeerConnection.prototype.addStream=function(e){var t=this;this._senders=this._senders||[],o.apply(this,[e]),e.getTracks().forEach((function(e){t._senders.push(i(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 i=t._senders.find((function(t){return t.track===e}));i&&t._senders.splice(t._senders.indexOf(i),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 qE(e){if(e.RTCPeerConnection){var t=e.RTCPeerConnection.prototype.getStats;e.RTCPeerConnection.prototype.getStats=function(){var e=this,i=Array.prototype.slice.call(arguments),r=i[0],n=i[1],o=i[2];if(arguments.length>0&&"function"==typeof r)return t.apply(this,arguments);if(0===t.length&&(0===arguments.length||"function"!=typeof r))return t.apply(this,[]);var a=function(e){var t={};return e.result().forEach((function(e){var i={id:e.id,timestamp:e.timestamp,type:{localcandidate:"local-candidate",remotecandidate:"remote-candidate"}[e.type]||e.type};e.names().forEach((function(t){i[t]=e.stat(t)})),t[i.id]=i})),t},s=function(e){return new Map(Object.keys(e).map((function(t){return[t,e[t]]})))};if(arguments.length>=2){var c=function(e){n(s(a(e)))};return t.apply(this,[c,r])}return new Promise((function(i,r){t.apply(e,[function(e){i(s(a(e)))},r])})).then(n,o)}}}function YE(e){if("object"===t(e)&&e.RTCPeerConnection&&e.RTCRtpSender&&e.RTCRtpReceiver){if(!("getStats"in e.RTCRtpSender.prototype)){var i=e.RTCPeerConnection.prototype.getSenders;i&&(e.RTCPeerConnection.prototype.getSenders=function(){var e=this,t=i.apply(this,[]);return t.forEach((function(t){return t._pc=e})),t});var r=e.RTCPeerConnection.prototype.addTrack;r&&(e.RTCPeerConnection.prototype.addTrack=function(){var e=r.apply(this,arguments);return e._pc=this,e}),e.RTCRtpSender.prototype.getStats=function(){var e=this;return this._pc.getStats().then((function(t){return SS(t,e.track,!0)}))}}if(!("getStats"in e.RTCRtpReceiver.prototype)){var n=e.RTCPeerConnection.prototype.getReceivers;n&&(e.RTCPeerConnection.prototype.getReceivers=function(){var e=this,t=n.apply(this,[]);return t.forEach((function(t){return t._pc=e})),t}),dS(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 SS(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,i,r,n=arguments[0];return this.getSenders().forEach((function(e){e.track===n&&(t?r=!0:t=e)})),this.getReceivers().forEach((function(e){return e.track===n&&(i?r=!0:i=e),e.track===n})),r||t&&i?Promise.reject(new DOMException("There are more than one sender or receiver for the track.","InvalidAccessError")):t?t.getStats():i?i.getStats():Promise.reject(new DOMException("There is no sender or receiver for the track.","InvalidAccessError"))}return o.apply(this,arguments)}}}}function JE(e){e.RTCPeerConnection.prototype.getLocalStreams=function(){var e=this;return this._shimmedLocalStreams=this._shimmedLocalStreams||{},Object.keys(this._shimmedLocalStreams).map((function(t){return e._shimmedLocalStreams[t][0]}))};var t=e.RTCPeerConnection.prototype.addTrack;e.RTCPeerConnection.prototype.addTrack=function(e,i){if(!i)return t.apply(this,arguments);this._shimmedLocalStreams=this._shimmedLocalStreams||{};var r=t.apply(this,arguments);return this._shimmedLocalStreams[i.id]?-1===this._shimmedLocalStreams[i.id].indexOf(r)&&this._shimmedLocalStreams[i.id].push(r):this._shimmedLocalStreams[i.id]=[i,r],r};var i=e.RTCPeerConnection.prototype.addStream;e.RTCPeerConnection.prototype.addStream=function(e){var t=this;this._shimmedLocalStreams=this._shimmedLocalStreams||{},e.getTracks().forEach((function(e){if(t.getSenders().find((function(t){return t.track===e})))throw new DOMException("Track already exists.","InvalidAccessError")}));var r=this.getSenders();i.apply(this,arguments);var n=this.getSenders().filter((function(e){return-1===r.indexOf(e)}));this._shimmedLocalStreams[e.id]=[e].concat(n)};var r=e.RTCPeerConnection.prototype.removeStream;e.RTCPeerConnection.prototype.removeStream=function(e){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},delete this._shimmedLocalStreams[e.id],r.apply(this,arguments)};var n=e.RTCPeerConnection.prototype.removeTrack;e.RTCPeerConnection.prototype.removeTrack=function(e){var t=this;return this._shimmedLocalStreams=this._shimmedLocalStreams||{},e&&Object.keys(this._shimmedLocalStreams).forEach((function(i){var r=t._shimmedLocalStreams[i].indexOf(e);-1!==r&&t._shimmedLocalStreams[i].splice(r,1),1===t._shimmedLocalStreams[i].length&&delete t._shimmedLocalStreams[i]})),n.apply(this,arguments)}}function QE(e,t){if(e.RTCPeerConnection){if(e.RTCPeerConnection.prototype.addTrack&&t.version>=65)return JE(e);var i=e.RTCPeerConnection.prototype.getLocalStreams;e.RTCPeerConnection.prototype.getLocalStreams=function(){var e=this,t=i.apply(this);return this._reverseStreams=this._reverseStreams||{},t.map((function(t){return e._reverseStreams[t.id]}))};var r=e.RTCPeerConnection.prototype.addStream;e.RTCPeerConnection.prototype.addStream=function(t){var i=this;if(this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{},t.getTracks().forEach((function(e){if(i.getSenders().find((function(t){return t.track===e})))throw new DOMException("Track already exists.","InvalidAccessError")})),!this._reverseStreams[t.id]){var n=new e.MediaStream(t.getTracks());this._streams[t.id]=n,this._reverseStreams[n.id]=t,t=n}r.apply(this,[t])};var n=e.RTCPeerConnection.prototype.removeStream;e.RTCPeerConnection.prototype.removeStream=function(e){this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{},n.apply(this,[this._streams[e.id]||e]),delete this._reverseStreams[this._streams[e.id]?this._streams[e.id].id:e.id],delete this._streams[e.id]},e.RTCPeerConnection.prototype.addTrack=function(t,i){var r=this;if("closed"===this.signalingState)throw new DOMException("The RTCPeerConnection's signalingState is 'closed'.","InvalidStateError");var n=[].slice.call(arguments,1);if(1!==n.length||!n[0].getTracks().find((function(e){return e===t})))throw new DOMException("The adapter.js addTrack polyfill only supports a single stream which is associated with the specified track.","NotSupportedError");var o=this.getSenders().find((function(e){return e.track===t}));if(o)throw new DOMException("Track already exists.","InvalidAccessError");this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{};var a=this._streams[i.id];if(a)a.addTrack(t),Promise.resolve().then((function(){r.dispatchEvent(new Event("negotiationneeded"))}));else{var s=new e.MediaStream([t]);this._streams[i.id]=s,this._reverseStreams[s.id]=i,this.addStream(s)}return this.getSenders().find((function(e){return e.track===t}))},["createOffer","createAnswer"].forEach((function(t){var i=e.RTCPeerConnection.prototype[t],r=im({},t,(function(){var e=this,t=arguments,r=arguments.length&&"function"==typeof arguments[0];return r?i.apply(this,[function(i){var r=s(e,i);t[0].apply(null,[r])},function(e){t[1]&&t[1].apply(null,e)},arguments[2]]):i.apply(this,arguments).then((function(t){return s(e,t)}))}));e.RTCPeerConnection.prototype[t]=r[t]}));var o=e.RTCPeerConnection.prototype.setLocalDescription;e.RTCPeerConnection.prototype.setLocalDescription=function(){return arguments.length&&arguments[0].type?(arguments[0]=c(this,arguments[0]),o.apply(this,arguments)):o.apply(this,arguments)};var a=Object.getOwnPropertyDescriptor(e.RTCPeerConnection.prototype,"localDescription");Object.defineProperty(e.RTCPeerConnection.prototype,"localDescription",{get:function(){var e=a.get.apply(this);return""===e.type?e:s(this,e)}}),e.RTCPeerConnection.prototype.removeTrack=function(e){var t,i=this;if("closed"===this.signalingState)throw new DOMException("The RTCPeerConnection's signalingState is 'closed'.","InvalidStateError");if(!e._pc)throw new DOMException("Argument 1 of RTCPeerConnection.removeTrack does not implement interface RTCRtpSender.","TypeError");if(!(e._pc===this))throw new DOMException("Sender was not created by this connection.","InvalidAccessError");this._streams=this._streams||{},Object.keys(this._streams).forEach((function(r){i._streams[r].getTracks().find((function(t){return e.track===t}))&&(t=i._streams[r])})),t&&(1===t.getTracks().length?this.removeStream(this._reverseStreams[t.id]):t.removeTrack(e.track),this.dispatchEvent(new Event("negotiationneeded")))}}function s(e,t){var i=t.sdp;return Object.keys(e._reverseStreams||[]).forEach((function(t){var r=e._reverseStreams[t],n=e._streams[r.id];i=i.replace(new RegExp(n.id,"g"),r.id)})),new RTCSessionDescription({type:t.type,sdp:i})}function c(e,t){var i=t.sdp;return Object.keys(e._reverseStreams||[]).forEach((function(t){var r=e._reverseStreams[t],n=e._streams[r.id];i=i.replace(new RegExp(r.id,"g"),n.id)})),new RTCSessionDescription({type:t.type,sdp:i})}}function ZE(e,t){!e.RTCPeerConnection&&e.webkitRTCPeerConnection&&(e.RTCPeerConnection=e.webkitRTCPeerConnection),e.RTCPeerConnection&&t.version<53&&["setLocalDescription","setRemoteDescription","addIceCandidate"].forEach((function(t){var i=e.RTCPeerConnection.prototype[t],r=im({},t,(function(){return arguments[0]=new("addIceCandidate"===t?e.RTCIceCandidate:e.RTCSessionDescription)(arguments[0]),i.apply(this,arguments)}));e.RTCPeerConnection.prototype[t]=r[t]}))}function $E(e,t){dS(e,"negotiationneeded",(function(e){var i=e.target;if(!(t.version<72||i.getConfiguration&&"plan-b"===i.getConfiguration().sdpSemantics)||"stable"===i.signalingState)return e}))}var eb=Object.freeze({__proto__:null,shimMediaStream:KE,shimOnTrack:WE,shimGetSendersWithDtmf:XE,shimGetStats:qE,shimSenderReceiverGetStats:YE,shimAddTrackRemoveTrackWithNative:JE,shimAddTrackRemoveTrack:QE,shimPeerConnection:ZE,fixNegotiationNeeded:$E,shimGetUserMedia:zE,shimGetDisplayMedia:function(e,t){e.navigator.mediaDevices&&"getDisplayMedia"in e.navigator.mediaDevices||e.navigator.mediaDevices&&("function"==typeof t?e.navigator.mediaDevices.getDisplayMedia=function(i){return t(i).then((function(t){var r=i.video&&i.video.width,n=i.video&&i.video.height,o=i.video&&i.video.frameRate;return i.video={mandatory:{chromeMediaSource:"desktop",chromeMediaSourceId:t,maxFrameRate:o||3}},r&&(i.video.mandatory.maxWidth=r),n&&(i.video.mandatory.maxHeight=n),e.navigator.mediaDevices.getUserMedia(i)}))}:console.error("shimGetDisplayMedia: getSourceId argument is not a function"))}}),tb=o,ib=s,rb=fo,nb=Em.trim,ob=A("".charAt),ab=tb.parseFloat,sb=tb.Symbol,cb=sb&&sb.iterator,ub=1/ab("\t\n\v\f\r                 \u2028\u2029\ufeff-0")!=-1/0||cb&&!ib((function(){ab(Object(cb))}))?function(e){var t=nb(rb(e)),i=ab(t);return 0===i&&"-"==ob(t,0)?-0:i}:ab;Xr({global:!0,forced:parseFloat!=ub},{parseFloat:ub});var db=Xr,lb=ic,hb=s,pb=X,_b=j,fb=du,vb=gd,mb=Yt.exports;if(db({target:"Promise",proto:!0,real:!0,forced:!!lb&&hb((function(){lb.prototype.finally.call({then:function(){}},(function(){}))}))},{finally:function(e){var t=fb(this,pb("Promise")),i=_b(e);return this.then(i?function(i){return vb(t,e()).then((function(){return i}))}:e,i?function(i){return vb(t,e()).then((function(){throw i}))}:e)}}),_b(lb)){var yb=pb("Promise").prototype.finally;lb.prototype.finally!==yb&&mb(lb.prototype,"finally",yb,{unsafe:!0})}function Sb(e,i){var r=e&&e.navigator,n=e&&e.MediaStreamTrack;if(r.getUserMedia=function(e,t,i){_S("navigator.getUserMedia","navigator.mediaDevices.getUserMedia"),r.mediaDevices.getUserMedia(e).then(t,i)},!(i.version>55&&"autoGainControl"in r.mediaDevices.getSupportedConstraints())){var o=function(e,t,i){t in e&&!(i in e)&&(e[i]=e[t],delete e[t])},a=r.mediaDevices.getUserMedia.bind(r.mediaDevices);if(r.mediaDevices.getUserMedia=function(e){return"object"===t(e)&&"object"===t(e.audio)&&(e=JSON.parse(JSON.stringify(e)),o(e.audio,"autoGainControl","mozAutoGainControl"),o(e.audio,"noiseSuppression","mozNoiseSuppression")),a(e)},n&&n.prototype.getSettings){var s=n.prototype.getSettings;n.prototype.getSettings=function(){var e=s.apply(this,arguments);return o(e,"mozAutoGainControl","autoGainControl"),o(e,"mozNoiseSuppression","noiseSuppression"),e}}if(n&&n.prototype.applyConstraints){var c=n.prototype.applyConstraints;n.prototype.applyConstraints=function(e){return"audio"===this.kind&&"object"===t(e)&&(e=JSON.parse(JSON.stringify(e)),o(e,"autoGainControl","mozAutoGainControl"),o(e,"noiseSuppression","mozNoiseSuppression")),c.apply(this,[e])}}}}function gb(e){"object"===t(e)&&e.RTCTrackEvent&&"receiver"in e.RTCTrackEvent.prototype&&!("transceiver"in e.RTCTrackEvent.prototype)&&Object.defineProperty(e.RTCTrackEvent.prototype,"transceiver",{get:function(){return{receiver:this.receiver}}})}function Eb(e,i){if("object"===t(e)&&(e.RTCPeerConnection||e.mozRTCPeerConnection)){!e.RTCPeerConnection&&e.mozRTCPeerConnection&&(e.RTCPeerConnection=e.mozRTCPeerConnection),i.version<53&&["setLocalDescription","setRemoteDescription","addIceCandidate"].forEach((function(t){var i=e.RTCPeerConnection.prototype[t],r=im({},t,(function(){return arguments[0]=new("addIceCandidate"===t?e.RTCIceCandidate:e.RTCSessionDescription)(arguments[0]),i.apply(this,arguments)}));e.RTCPeerConnection.prototype[t]=r[t]}));var r={inboundrtp:"inbound-rtp",outboundrtp:"outbound-rtp",candidatepair:"candidate-pair",localcandidate:"local-candidate",remotecandidate:"remote-candidate"},n=e.RTCPeerConnection.prototype.getStats;e.RTCPeerConnection.prototype.getStats=function(){var e=Array.prototype.slice.call(arguments),t=e[0],o=e[1],a=e[2];return n.apply(this,[t||null]).then((function(e){if(i.version<53&&!o)try{e.forEach((function(e){e.type=r[e.type]||e.type}))}catch(t){if("TypeError"!==t.name)throw t;e.forEach((function(t,i){e.set(i,Object.assign({},t,{type:r[t.type]||t.type}))}))}return e})).then(o,a)}}}function bb(e){if("object"===t(e)&&e.RTCPeerConnection&&e.RTCRtpSender&&(!e.RTCRtpSender||!("getStats"in e.RTCRtpSender.prototype))){var i=e.RTCPeerConnection.prototype.getSenders;i&&(e.RTCPeerConnection.prototype.getSenders=function(){var e=this,t=i.apply(this,[]);return t.forEach((function(t){return t._pc=e})),t});var r=e.RTCPeerConnection.prototype.addTrack;r&&(e.RTCPeerConnection.prototype.addTrack=function(){var e=r.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 Ib(e){if("object"===t(e)&&e.RTCPeerConnection&&e.RTCRtpSender&&(!e.RTCRtpSender||!("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}),dS(e,"track",(function(e){return e.receiver._pc=e.srcElement,e})),e.RTCRtpReceiver.prototype.getStats=function(){return this._pc.getStats(this.track)}}}function Tb(e){e.RTCPeerConnection&&!("removeStream"in e.RTCPeerConnection.prototype)&&(e.RTCPeerConnection.prototype.removeStream=function(e){var t=this;_S("removeStream","removeTrack"),this.getSenders().forEach((function(i){i.track&&e.getTracks().includes(i.track)&&t.removeTrack(i)}))})}function Ab(e){e.DataChannel&&!e.RTCDataChannel&&(e.RTCDataChannel=e.DataChannel)}function Rb(e){if("object"===t(e)&&e.RTCPeerConnection){var i=e.RTCPeerConnection.prototype.addTransceiver;i&&(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 r=i.apply(this,arguments);if(t){var n=r.sender,o=n.getParameters();(!("encodings"in o)||1===o.encodings.length&&0===Object.keys(o.encodings[0]).length)&&(o.encodings=e.sendEncodings,n.sendEncodings=e.sendEncodings,this.setParametersPromises.push(n.setParameters(o).then((function(){delete n.sendEncodings})).catch((function(){delete n.sendEncodings}))))}return r})}}function Cb(e){if("object"===t(e)&&e.RTCRtpSender){var i=e.RTCRtpSender.prototype.getParameters;i&&(e.RTCRtpSender.prototype.getParameters=function(){var e=i.apply(this,arguments);return"encodings"in e||(e.encodings=[].concat(this.sendEncodings||[{}])),e})}}function Ob(e){if("object"===t(e)&&e.RTCPeerConnection){var i=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 i.apply(t,e)})).finally((function(){t.setParametersPromises=[]})):i.apply(this,arguments)}}}function wb(e){if("object"===t(e)&&e.RTCPeerConnection){var i=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 i.apply(t,e)})).finally((function(){t.setParametersPromises=[]})):i.apply(this,arguments)}}}var kb=Object.freeze({__proto__:null,shimOnTrack:gb,shimPeerConnection:Eb,shimSenderGetStats:bb,shimReceiverGetStats:Ib,shimRemoveStream:Tb,shimRTCDataChannel:Ab,shimAddTransceiver:Rb,shimGetParameters:Cb,shimCreateOffer:Ob,shimCreateAnswer:wb,shimGetUserMedia:Sb,shimGetDisplayMedia:function(e,t){e.navigator.mediaDevices&&"getDisplayMedia"in e.navigator.mediaDevices||e.navigator.mediaDevices&&(e.navigator.mediaDevices.getDisplayMedia=function(i){if(!i||!i.video){var r=new DOMException("getDisplayMedia without video constraints is undefined");return r.name="NotFoundError",r.code=8,Promise.reject(r)}return!0===i.video?i.video={mediaSource:t}:i.video.mediaSource=t,e.navigator.mediaDevices.getUserMedia(i)})}});function Nb(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 i=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(r){return i.call(t,r,e)})),e.getVideoTracks().forEach((function(r){return i.call(t,r,e)}))},e.RTCPeerConnection.prototype.addTrack=function(e){for(var t=this,r=arguments.length,n=new Array(r>1?r-1:0),o=1;o<r;o++)n[o-1]=arguments[o];return n&&n.forEach((function(e){t._localStreams?t._localStreams.includes(e)||t._localStreams.push(e):t._localStreams=[e]})),i.apply(this,arguments)}}"removeStream"in e.RTCPeerConnection.prototype||(e.RTCPeerConnection.prototype.removeStream=function(e){var t=this;this._localStreams||(this._localStreams=[]);var i=this._localStreams.indexOf(e);if(-1!==i){this._localStreams.splice(i,1);var r=e.getTracks();this.getSenders().forEach((function(e){r.includes(e.track)&&t.removeTrack(e)}))}})}}function Pb(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 i=new Event("addstream");i.stream=e,t.dispatchEvent(i)}}))})}});var i=e.RTCPeerConnection.prototype.setRemoteDescription;e.RTCPeerConnection.prototype.setRemoteDescription=function(){var e=this;return this._onaddstreampoly||this.addEventListener("track",this._onaddstreampoly=function(t){t.streams.forEach((function(t){if(e._remoteStreams||(e._remoteStreams=[]),!(e._remoteStreams.indexOf(t)>=0)){e._remoteStreams.push(t);var i=new Event("addstream");i.stream=t,e.dispatchEvent(i)}}))}),i.apply(e,arguments)}}}function Db(e){if("object"===t(e)&&e.RTCPeerConnection){var i=e.RTCPeerConnection.prototype,r=i.createOffer,n=i.createAnswer,o=i.setLocalDescription,a=i.setRemoteDescription,s=i.addIceCandidate;i.createOffer=function(e,t){var i=arguments.length>=2?arguments[2]:arguments[0],n=r.apply(this,[i]);return t?(n.then(e,t),Promise.resolve()):n},i.createAnswer=function(e,t){var i=arguments.length>=2?arguments[2]:arguments[0],r=n.apply(this,[i]);return t?(r.then(e,t),Promise.resolve()):r};var c=function(e,t,i){var r=o.apply(this,[e]);return i?(r.then(t,i),Promise.resolve()):r};i.setLocalDescription=c,c=function(e,t,i){var r=a.apply(this,[e]);return i?(r.then(t,i),Promise.resolve()):r},i.setRemoteDescription=c,c=function(e,t,i){var r=s.apply(this,[e]);return i?(r.then(t,i),Promise.resolve()):r},i.addIceCandidate=c}}function Mb(e){var t=e&&e.navigator;if(t.mediaDevices&&t.mediaDevices.getUserMedia){var i=t.mediaDevices,r=i.getUserMedia.bind(i);t.mediaDevices.getUserMedia=function(e){return r(Lb(e))}}!t.getUserMedia&&t.mediaDevices&&t.mediaDevices.getUserMedia&&(t.getUserMedia=function(e,i,r){t.mediaDevices.getUserMedia(e).then(i,r)}.bind(t))}function Lb(e){return e&&void 0!==e.video?Object.assign({},e,{video:mS(e.video)}):e}function Ub(e){if(e.RTCPeerConnection){var t=e.RTCPeerConnection;e.RTCPeerConnection=function(e,i){if(e&&e.iceServers){for(var r=[],n=0;n<e.iceServers.length;n++){var o=e.iceServers[n];!o.hasOwnProperty("urls")&&o.hasOwnProperty("url")?(_S("RTCIceServer.url","RTCIceServer.urls"),(o=JSON.parse(JSON.stringify(o))).urls=o.url,delete o.url,r.push(o)):r.push(e.iceServers[n])}e.iceServers=r}return new t(e,i)},e.RTCPeerConnection.prototype=t.prototype,"generateCertificate"in t&&Object.defineProperty(e.RTCPeerConnection,"generateCertificate",{get:function(){return t.generateCertificate}})}}function xb(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 Vb(e){var t=e.RTCPeerConnection.prototype.createOffer;e.RTCPeerConnection.prototype.createOffer=function(e){if(e){void 0!==e.offerToReceiveAudio&&(e.offerToReceiveAudio=!!e.offerToReceiveAudio);var i=this.getTransceivers().find((function(e){return"audio"===e.receiver.track.kind}));!1===e.offerToReceiveAudio&&i?"sendrecv"===i.direction?i.setDirection?i.setDirection("sendonly"):i.direction="sendonly":"recvonly"===i.direction&&(i.setDirection?i.setDirection("inactive"):i.direction="inactive"):!0!==e.offerToReceiveAudio||i||this.addTransceiver("audio",{direction:"recvonly"}),void 0!==e.offerToReceiveVideo&&(e.offerToReceiveVideo=!!e.offerToReceiveVideo);var r=this.getTransceivers().find((function(e){return"video"===e.receiver.track.kind}));!1===e.offerToReceiveVideo&&r?"sendrecv"===r.direction?r.setDirection?r.setDirection("sendonly"):r.direction="sendonly":"recvonly"===r.direction&&(r.setDirection?r.setDirection("inactive"):r.direction="inactive"):!0!==e.offerToReceiveVideo||r||this.addTransceiver("video",{direction:"recvonly"})}return t.apply(this,arguments)}}function Fb(e){"object"!==t(e)||e.AudioContext||(e.AudioContext=e.webkitAudioContext)}var Bb=Object.freeze({__proto__:null,shimLocalStreamsAPI:Nb,shimRemoteStreamsAPI:Pb,shimCallbacksAPI:Db,shimGetUserMedia:Mb,shimConstraints:Lb,shimRTCIceServerUrls:Ub,shimTrackEventTransceiver:xb,shimCreateOfferLegacy:Vb,shimAudioContext:Fb}),jb=Le,Gb=ut;Xr({target:"Date",proto:!0,forced:s((function(){return null!==new Date(NaN).toJSON()||1!==Date.prototype.toJSON.call({toISOString:function(){return 1}})}))},{toJSON:function(e){var t=jb(this),i=Gb(t,"number");return"number"!=typeof i||isFinite(i)?t.toISOString():null}});var Hb=h;Xr({target:"URL",proto:!0,enumerable:!0},{toJSON:function(){return Hb(URL.prototype.toString,this)}});var zb=A(1..valueOf),Kb=c,Wb=o,Xb=A,qb=Fr,Yb=Yt.exports,Jb=Ve,Qb=sy,Zb=q,$b=he,eI=ut,tI=s,iI=Wi.f,rI=a.f,nI=Ot.f,oI=zb,aI=Em.trim,sI="Number",cI=Wb.Number,uI=cI.prototype,dI=Wb.TypeError,lI=Xb("".slice),hI=Xb("".charCodeAt),pI=function(e){var t=eI(e,"number");return"bigint"==typeof t?t:_I(t)},_I=function(e){var t,i,r,n,o,a,s,c,u=eI(e,"number");if($b(u))throw dI("Cannot convert a Symbol value to a number");if("string"==typeof u&&u.length>2)if(u=aI(u),43===(t=hI(u,0))||45===t){if(88===(i=hI(u,2))||120===i)return NaN}else if(48===t){switch(hI(u,1)){case 66:case 98:r=2,n=49;break;case 79:case 111:r=8,n=55;break;default:return+u}for(a=(o=lI(u,2)).length,s=0;s<a;s++)if((c=hI(o,s))<48||c>n)return NaN;return parseInt(o,r)}return+u};if(qb(sI,!cI(" 0o1")||!cI("0b1")||cI("+0x1"))){for(var fI,vI=function(e){var t=arguments.length<1?0:cI(pI(e)),i=this;return Zb(uI,i)&&tI((function(){oI(i)}))?Qb(Object(t),i,vI):t},mI=Kb?iI(cI):"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(","),yI=0;mI.length>yI;yI++)Jb(cI,fI=mI[yI])&&!Jb(vI,fI)&&nI(vI,fI,rI(cI,fI));vI.prototype=uI,uI.constructor=vI,Yb(Wb,sI,vI)}var SI=Xr,gI=L,EI=B,bI=Gn,II=A([].join),TI=gI!=Object,AI=bI("join",",");SI({target:"Array",proto:!0,forced:TI||!AI},{join:function(e){return II(EI(this),void 0===e?",":e)}});var RI=$n,CI=h,OI=A,wI=wv,kI=wf,NI=Mt,PI=x,DI=du,MI=nm,LI=ir,UI=fo,xI=ge,VI=Ro,FI=xv,BI=gv,jI=s,GI=Xf.UNSUPPORTED_Y,HI=4294967295,zI=Math.min,KI=[].push,WI=OI(/./.exec),XI=OI(KI),qI=OI("".slice),YI=!jI((function(){var e=/(?:)/,t=e.exec;e.exec=function(){return t.apply(this,arguments)};var i="ab".split(e);return 2!==i.length||"a"!==i[0]||"b"!==i[1]}));wI("split",(function(e,t,i){var r;return r="c"=="abbc".split(/(b)*/)[1]||4!="test".split(/(?:)/,-1).length||2!="ab".split(/(?:ab)*/).length||4!=".".split(/(.?)(.?)/).length||".".split(/()()/).length>1||"".split(/.?/).length?function(e,i){var r=UI(PI(this)),n=void 0===i?HI:i>>>0;if(0===n)return[];if(void 0===e)return[r];if(!kI(e))return CI(t,r,e,n);for(var o,a,s,c=[],u=(e.ignoreCase?"i":"")+(e.multiline?"m":"")+(e.unicode?"u":"")+(e.sticky?"y":""),d=0,l=new RegExp(e.source,u+"g");(o=CI(BI,l,r))&&!((a=l.lastIndex)>d&&(XI(c,qI(r,d,o.index)),o.length>1&&o.index<r.length&&RI(KI,c,VI(o,1)),s=o[0].length,d=a,c.length>=n));)l.lastIndex===o.index&&l.lastIndex++;return d===r.length?!s&&WI(l,"")||XI(c,""):XI(c,qI(r,d)),c.length>n?VI(c,0,n):c}:"0".split(void 0,0).length?function(e,i){return void 0===e&&0===i?[]:CI(t,this,e,i)}:t,[function(t,i){var n=PI(this),o=null==t?void 0:xI(t,e);return o?CI(o,t,n,i):CI(r,UI(n),t,i)},function(e,n){var o=NI(this),a=UI(e),s=i(r,o,a,n,r!==t);if(s.done)return s.value;var c=DI(o,RegExp),u=o.unicode,d=(o.ignoreCase?"i":"")+(o.multiline?"m":"")+(o.unicode?"u":"")+(GI?"g":"y"),l=new c(GI?"^(?:"+o.source+")":o,d),h=void 0===n?HI:n>>>0;if(0===h)return[];if(0===a.length)return null===FI(l,a)?[a]:[];for(var p=0,_=0,f=[];_<a.length;){l.lastIndex=GI?0:_;var v,m=FI(l,GI?qI(a,_):a);if(null===m||(v=zI(LI(l.lastIndex+(GI?_:0)),a.length))===p)_=MI(a,_,u);else{if(XI(f,qI(a,p,_)),f.length===h)return f;for(var y=1;y<=m.length-1;y++)if(XI(f,m[y]),f.length===h)return f;_=p=v}}return XI(f,qI(a,p)),f}]}),!YI,GI);var JI=Li.PROPER,QI=s,ZI=pm,$I=Em.trim;Xr({target:"String",proto:!0,forced:function(e){return QI((function(){return!!ZI[e]()||"​…᠎"!=="​…᠎"[e]()||JI&&ZI[e].name!==e}))}("trim")},{trim:function(){return $I(this)}});var eT={exports:{}};!function(e){var i={generateIdentifier:function(){return Math.random().toString(36).substr(2,10)}};i.localCName=i.generateIdentifier(),i.splitLines=function(e){return e.trim().split("\n").map((function(e){return e.trim()}))},i.splitSections=function(e){return e.split("\nm=").map((function(e,t){return(t>0?"m="+e:e).trim()+"\r\n"}))},i.getDescription=function(e){var t=i.splitSections(e);return t&&t[0]},i.getMediaSections=function(e){var t=i.splitSections(e);return t.shift(),t},i.matchPrefix=function(e,t){return i.splitLines(e).filter((function(e){return 0===e.indexOf(t)}))},i.parseCandidate=function(e){for(var t,i={foundation:(t=0===e.indexOf("a=candidate:")?e.substring(12).split(" "):e.substring(10).split(" "))[0],component:{1:"rtp",2:"rtcp"}[t[1]]||t[1],protocol:t[2].toLowerCase(),priority:parseInt(t[3],10),ip:t[4],address:t[4],port:parseInt(t[5],10),type:t[7]},r=8;r<t.length;r+=2)switch(t[r]){case"raddr":i.relatedAddress=t[r+1];break;case"rport":i.relatedPort=parseInt(t[r+1],10);break;case"tcptype":i.tcpType=t[r+1];break;case"ufrag":i.ufrag=t[r+1],i.usernameFragment=t[r+1];break;default:void 0===i[t[r]]&&(i[t[r]]=t[r+1])}return i},i.writeCandidate=function(e){var t=[];t.push(e.foundation);var i=e.component;"rtp"===i?t.push(1):"rtcp"===i?t.push(2):t.push(i),t.push(e.protocol.toUpperCase()),t.push(e.priority),t.push(e.address||e.ip),t.push(e.port);var r=e.type;return t.push("typ"),t.push(r),"host"!==r&&e.relatedAddress&&e.relatedPort&&(t.push("raddr"),t.push(e.relatedAddress),t.push("rport"),t.push(e.relatedPort)),e.tcpType&&"tcp"===e.protocol.toLowerCase()&&(t.push("tcptype"),t.push(e.tcpType)),(e.usernameFragment||e.ufrag)&&(t.push("ufrag"),t.push(e.usernameFragment||e.ufrag)),"candidate:"+t.join(" ")},i.parseIceOptions=function(e){return e.substr(14).split(" ")},i.parseRtpMap=function(e){var t=e.substr(9).split(" "),i={payloadType:parseInt(t.shift(),10)};return t=t[0].split("/"),i.name=t[0],i.clockRate=parseInt(t[1],10),i.channels=3===t.length?parseInt(t[2],10):1,i.numChannels=i.channels,i},i.writeRtpMap=function(e){var t=e.payloadType;void 0!==e.preferredPayloadType&&(t=e.preferredPayloadType);var i=e.channels||e.numChannels||1;return"a=rtpmap:"+t+" "+e.name+"/"+e.clockRate+(1!==i?"/"+i:"")+"\r\n"},i.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]}},i.writeExtmap=function(e){return"a=extmap:"+(e.id||e.preferredId)+(e.direction&&"sendrecv"!==e.direction?"/"+e.direction:"")+" "+e.uri+"\r\n"},i.parseFmtp=function(e){for(var t,i={},r=e.substr(e.indexOf(" ")+1).split(";"),n=0;n<r.length;n++)i[(t=r[n].trim().split("="))[0].trim()]=t[1];return i},i.writeFmtp=function(e){var t="",i=e.payloadType;if(void 0!==e.preferredPayloadType&&(i=e.preferredPayloadType),e.parameters&&Object.keys(e.parameters).length){var r=[];Object.keys(e.parameters).forEach((function(t){void 0!==e.parameters[t]?r.push(t+"="+e.parameters[t]):r.push(t)})),t+="a=fmtp:"+i+" "+r.join(";")+"\r\n"}return t},i.parseRtcpFb=function(e){var t=e.substr(e.indexOf(" ")+1).split(" ");return{type:t.shift(),parameter:t.join(" ")}},i.writeRtcpFb=function(e){var t="",i=e.payloadType;return void 0!==e.preferredPayloadType&&(i=e.preferredPayloadType),e.rtcpFeedback&&e.rtcpFeedback.length&&e.rtcpFeedback.forEach((function(e){t+="a=rtcp-fb:"+i+" "+e.type+(e.parameter&&e.parameter.length?" "+e.parameter:"")+"\r\n"})),t},i.parseSsrcMedia=function(e){var t=e.indexOf(" "),i={ssrc:parseInt(e.substr(7,t-7),10)},r=e.indexOf(":",t);return r>-1?(i.attribute=e.substr(t+1,r-t-1),i.value=e.substr(r+1)):i.attribute=e.substr(t+1),i},i.parseSsrcGroup=function(e){var t=e.substr(13).split(" ");return{semantics:t.shift(),ssrcs:t.map((function(e){return parseInt(e,10)}))}},i.getMid=function(e){var t=i.matchPrefix(e,"a=mid:")[0];if(t)return t.substr(6)},i.parseFingerprint=function(e){var t=e.substr(14).split(" ");return{algorithm:t[0].toLowerCase(),value:t[1].toUpperCase()}},i.getDtlsParameters=function(e,t){return{role:"auto",fingerprints:i.matchPrefix(e+t,"a=fingerprint:").map(i.parseFingerprint)}},i.writeDtlsParameters=function(e,t){var i="a=setup:"+t+"\r\n";return e.fingerprints.forEach((function(e){i+="a=fingerprint:"+e.algorithm+" "+e.value+"\r\n"})),i},i.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)}},i.writeCryptoLine=function(e){return"a=crypto:"+e.tag+" "+e.cryptoSuite+" "+("object"===t(e.keyParams)?i.writeCryptoKeyParams(e.keyParams):e.keyParams)+(e.sessionParams?" "+e.sessionParams.join(" "):"")+"\r\n"},i.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}},i.writeCryptoKeyParams=function(e){return e.keyMethod+":"+e.keySalt+(e.lifeTime?"|"+e.lifeTime:"")+(e.mkiValue&&e.mkiLength?"|"+e.mkiValue+":"+e.mkiLength:"")},i.getCryptoParameters=function(e,t){return i.matchPrefix(e+t,"a=crypto:").map(i.parseCryptoLine)},i.getIceParameters=function(e,t){var r=i.matchPrefix(e+t,"a=ice-ufrag:")[0],n=i.matchPrefix(e+t,"a=ice-pwd:")[0];return r&&n?{usernameFragment:r.substr(12),password:n.substr(10)}:null},i.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},i.parseRtpParameters=function(e){for(var t={codecs:[],headerExtensions:[],fecMechanisms:[],rtcp:[]},r=i.splitLines(e)[0].split(" "),n=3;n<r.length;n++){var o=r[n],a=i.matchPrefix(e,"a=rtpmap:"+o+" ")[0];if(a){var s=i.parseRtpMap(a),c=i.matchPrefix(e,"a=fmtp:"+o+" ");switch(s.parameters=c.length?i.parseFmtp(c[0]):{},s.rtcpFeedback=i.matchPrefix(e,"a=rtcp-fb:"+o+" ").map(i.parseRtcpFb),t.codecs.push(s),s.name.toUpperCase()){case"RED":case"ULPFEC":t.fecMechanisms.push(s.name.toUpperCase())}}}return i.matchPrefix(e,"a=extmap:").forEach((function(e){t.headerExtensions.push(i.parseExtmap(e))})),t},i.writeRtpDescription=function(e,t){var r="";r+="m="+e+" ",r+=t.codecs.length>0?"9":"0",r+=" UDP/TLS/RTP/SAVPF ",r+=t.codecs.map((function(e){return void 0!==e.preferredPayloadType?e.preferredPayloadType:e.payloadType})).join(" ")+"\r\n",r+="c=IN IP4 0.0.0.0\r\n",r+="a=rtcp:9 IN IP4 0.0.0.0\r\n",t.codecs.forEach((function(e){r+=i.writeRtpMap(e),r+=i.writeFmtp(e),r+=i.writeRtcpFb(e)}));var n=0;return t.codecs.forEach((function(e){e.maxptime>n&&(n=e.maxptime)})),n>0&&(r+="a=maxptime:"+n+"\r\n"),t.headerExtensions&&t.headerExtensions.forEach((function(e){r+=i.writeExtmap(e)})),r},i.parseRtpEncodingParameters=function(e){var t,r=[],n=i.parseRtpParameters(e),o=-1!==n.fecMechanisms.indexOf("RED"),a=-1!==n.fecMechanisms.indexOf("ULPFEC"),s=i.matchPrefix(e,"a=ssrc:").map((function(e){return i.parseSsrcMedia(e)})).filter((function(e){return"cname"===e.attribute})),c=s.length>0&&s[0].ssrc,u=i.matchPrefix(e,"a=ssrc-group:FID").map((function(e){return e.substr(17).split(" ").map((function(e){return parseInt(e,10)}))}));u.length>0&&u[0].length>1&&u[0][0]===c&&(t=u[0][1]),n.codecs.forEach((function(e){if("RTX"===e.name.toUpperCase()&&e.parameters.apt){var i={ssrc:c,codecPayloadType:parseInt(e.parameters.apt,10)};c&&t&&(i.rtx={ssrc:t}),r.push(i),o&&((i=JSON.parse(JSON.stringify(i))).fec={ssrc:c,mechanism:a?"red+ulpfec":"red"},r.push(i))}})),0===r.length&&c&&r.push({ssrc:c});var d=i.matchPrefix(e,"b=");return d.length&&(d=0===d[0].indexOf("b=TIAS:")?parseInt(d[0].substr(7),10):0===d[0].indexOf("b=AS:")?1e3*parseInt(d[0].substr(5),10)*.95-16e3:void 0,r.forEach((function(e){e.maxBitrate=d}))),r},i.parseRtcpParameters=function(e){var t={},r=i.matchPrefix(e,"a=ssrc:").map((function(e){return i.parseSsrcMedia(e)})).filter((function(e){return"cname"===e.attribute}))[0];r&&(t.cname=r.value,t.ssrc=r.ssrc);var n=i.matchPrefix(e,"a=rtcp-rsize");t.reducedSize=n.length>0,t.compound=0===n.length;var o=i.matchPrefix(e,"a=rtcp-mux");return t.mux=o.length>0,t},i.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},i.parseMsid=function(e){var t,r=i.matchPrefix(e,"a=msid:");if(1===r.length)return{stream:(t=r[0].substr(7).split(" "))[0],track:t[1]};var n=i.matchPrefix(e,"a=ssrc:").map((function(e){return i.parseSsrcMedia(e)})).filter((function(e){return"msid"===e.attribute}));return n.length>0?{stream:(t=n[0].value.split(" "))[0],track:t[1]}:void 0},i.parseSctpDescription=function(e){var t,r=i.parseMLine(e),n=i.matchPrefix(e,"a=max-message-size:");n.length>0&&(t=parseInt(n[0].substr(19),10)),isNaN(t)&&(t=65536);var o=i.matchPrefix(e,"a=sctp-port:");if(o.length>0)return{port:parseInt(o[0].substr(12),10),protocol:r.fmt,maxMessageSize:t};var a=i.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}}},i.writeSctpDescription=function(e,t){var i=[];return i="DTLS/SCTP"!==e.protocol?["m="+e.kind+" 9 "+e.protocol+" "+t.protocol+"\r\n","c=IN IP4 0.0.0.0\r\n","a=sctp-port:"+t.port+"\r\n"]:["m="+e.kind+" 9 "+e.protocol+" "+t.port+"\r\n","c=IN IP4 0.0.0.0\r\n","a=sctpmap:"+t.port+" "+t.protocol+" 65535\r\n"],void 0!==t.maxMessageSize&&i.push("a=max-message-size:"+t.maxMessageSize+"\r\n"),i.join("")},i.generateSessionId=function(){return Math.random().toString().substr(2,21)},i.writeSessionBoilerplate=function(e,t,r){var n=void 0!==t?t:2;return"v=0\r\no="+(r||"thisisadapterortc")+" "+(e||i.generateSessionId())+" "+n+" IN IP4 127.0.0.1\r\ns=-\r\nt=0 0\r\n"},i.getDirection=function(e,t){for(var r=i.splitLines(e),n=0;n<r.length;n++)switch(r[n]){case"a=sendrecv":case"a=sendonly":case"a=recvonly":case"a=inactive":return r[n].substr(2)}return t?i.getDirection(t):"sendrecv"},i.getKind=function(e){return i.splitLines(e)[0].split(" ")[0].substr(2)},i.isRejected=function(e){return"0"===e.split(" ",2)[1]},i.parseMLine=function(e){var t=i.splitLines(e)[0].substr(2).split(" ");return{kind:t[0],port:parseInt(t[1],10),protocol:t[2],fmt:t.slice(3).join(" ")}},i.parseOLine=function(e){var t=i.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]}},i.isValidSDP=function(e){if("string"!=typeof e||0===e.length)return!1;for(var t=i.splitLines(e),r=0;r<t.length;r++)if(t[r].length<2||"="!==t[r].charAt(1))return!1;return!0},e.exports=i}(eT);var tT=eT.exports,iT=Object.freeze(e({__proto__:null,default:tT},[eT.exports]));function rT(e){if(!(!e.RTCIceCandidate||e.RTCIceCandidate&&"foundation"in e.RTCIceCandidate.prototype)){var i=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 r=new i(e),n=tT.parseCandidate(e.candidate),o=Object.assign(r,n);return o.toJSON=function(){return{candidate:o.candidate,sdpMid:o.sdpMid,sdpMLineIndex:o.sdpMLineIndex,usernameFragment:o.usernameFragment}},o}return new i(e)},e.RTCIceCandidate.prototype=i.prototype,dS(e,"icecandidate",(function(t){return t.candidate&&Object.defineProperty(t,"candidate",{value:new e.RTCIceCandidate(t.candidate),writable:"false"}),t}))}}function nT(e,t){if(e.RTCPeerConnection){"sctp"in e.RTCPeerConnection.prototype||Object.defineProperty(e.RTCPeerConnection.prototype,"sctp",{get:function(){return void 0===this._sctp?null:this._sctp}});var i=function(e){if(!e||!e.sdp)return!1;var t=tT.splitSections(e.sdp);return t.shift(),t.some((function(e){var t=tT.parseMLine(e);return t&&"application"===t.kind&&-1!==t.protocol.indexOf("SCTP")}))},r=function(e){var t=e.sdp.match(/mozilla...THIS_IS_SDPARTA-(\d+)/);if(null===t||t.length<2)return-1;var i=parseInt(t[1],10);return i!=i?-1:i},n=function(e){var i=65536;return"firefox"===t.browser&&(i=t.version<57?-1===e?16384:2147483637:t.version<60?57===t.version?65535:65536:2147483637),i},o=function(e,i){var r=65536;"firefox"===t.browser&&57===t.version&&(r=65535);var n=tT.matchPrefix(e.sdp,"a=max-message-size:");return n.length>0?r=parseInt(n[0].substr(19),10):"firefox"===t.browser&&-1!==i&&(r=2147483637),r},a=e.RTCPeerConnection.prototype.setRemoteDescription;e.RTCPeerConnection.prototype.setRemoteDescription=function(){if(this._sctp=null,"chrome"===t.browser&&t.version>=76){var e=this.getConfiguration(),s=e.sdpSemantics;"plan-b"===s&&Object.defineProperty(this,"sctp",{get:function(){return void 0===this._sctp?null:this._sctp},enumerable:!0,configurable:!0})}if(i(arguments[0])){var c,u=r(arguments[0]),d=n(u),l=o(arguments[0],u);c=0===d&&0===l?Number.POSITIVE_INFINITY:0===d||0===l?Math.max(d,l):Math.min(d,l);var h={};Object.defineProperty(h,"maxMessageSize",{get:function(){return c}}),this._sctp=h}return a.apply(this,arguments)}}}function oT(e){if(e.RTCPeerConnection&&"createDataChannel"in e.RTCPeerConnection.prototype){var t=e.RTCPeerConnection.prototype.createDataChannel;e.RTCPeerConnection.prototype.createDataChannel=function(){var e=t.apply(this,arguments);return i(e,this),e},dS(e,"datachannel",(function(e){return i(e.channel,e.target),e}))}function i(e,t){var i=e.send;e.send=function(){var r=arguments[0],n=r.length||r.size||r.byteLength;if("open"===e.readyState&&t.sctp&&n>t.sctp.maxMessageSize)throw new TypeError("Message too large (can send a maximum of "+t.sctp.maxMessageSize+" bytes)");return i.apply(e,arguments)}}}function aT(e){if(e.RTCPeerConnection&&!("connectionState"in e.RTCPeerConnection.prototype)){var t=e.RTCPeerConnection.prototype;Object.defineProperty(t,"connectionState",{get:function(){return{completed:"connected",checking:"connecting"}[this.iceConnectionState]||this.iceConnectionState},enumerable:!0,configurable:!0}),Object.defineProperty(t,"onconnectionstatechange",{get:function(){return this._onconnectionstatechange||null},set:function(e){this._onconnectionstatechange&&(this.removeEventListener("connectionstatechange",this._onconnectionstatechange),delete this._onconnectionstatechange),e&&this.addEventListener("connectionstatechange",this._onconnectionstatechange=e)},enumerable:!0,configurable:!0}),["setLocalDescription","setRemoteDescription"].forEach((function(e){var i=t[e];t[e]=function(){return this._connectionstatechangepoly||(this._connectionstatechangepoly=function(e){var t=e.target;if(t._lastConnectionState!==t.connectionState){t._lastConnectionState=t.connectionState;var i=new Event("connectionstatechange",e);t.dispatchEvent(i)}return e},this.addEventListener("iceconnectionstatechange",this._connectionstatechangepoly)),i.apply(this,arguments)}}))}}function sT(e,t){if(e.RTCPeerConnection&&!("chrome"===t.browser&&t.version>=71||"safari"===t.browser&&t.version>=605)){var i=e.RTCPeerConnection.prototype.setRemoteDescription;e.RTCPeerConnection.prototype.setRemoteDescription=function(t){if(t&&t.sdp&&-1!==t.sdp.indexOf("\na=extmap-allow-mixed")){var r=t.sdp.split("\n").filter((function(e){return"a=extmap-allow-mixed"!==e.trim()})).join("\n");e.RTCSessionDescription&&t instanceof e.RTCSessionDescription?arguments[0]=new e.RTCSessionDescription({type:t.type,sdp:r}):t.sdp=r}return i.apply(this,arguments)}}}function cT(e,t){if(e.RTCPeerConnection&&e.RTCPeerConnection.prototype){var i=e.RTCPeerConnection.prototype.addIceCandidate;i&&0!==i.length&&(e.RTCPeerConnection.prototype.addIceCandidate=function(){return arguments[0]?("chrome"===t.browser&&t.version<78||"firefox"===t.browser&&t.version<68||"safari"===t.browser)&&arguments[0]&&""===arguments[0].candidate?Promise.resolve():i.apply(this,arguments):(arguments[1]&&arguments[1].apply(null),Promise.resolve())})}}function uT(e,i){if(e.RTCPeerConnection&&e.RTCPeerConnection.prototype){var r=e.RTCPeerConnection.prototype.setLocalDescription;r&&0!==r.length&&(e.RTCPeerConnection.prototype.setLocalDescription=function(){var e=this,i=arguments[0]||{};if("object"!==t(i)||i.type&&i.sdp)return r.apply(this,arguments);if(!(i={type:i.type,sdp:i.sdp}).type)switch(this.signalingState){case"stable":case"have-local-offer":case"have-remote-pranswer":i.type="offer";break;default:i.type="answer"}if(i.sdp||"offer"!==i.type&&"answer"!==i.type)return r.apply(this,[i]);var n="offer"===i.type?this.createOffer:this.createAnswer;return n.apply(this).then((function(t){return r.apply(e,[t])}))})}}var dT=Object.freeze({__proto__:null,shimRTCIceCandidate:rT,shimMaxMessageSize:nT,shimSendThrowTypeError:oT,shimConnectionState:aT,removeExtmapAllowMixed:sT,shimAddIceCandidateNullOrEmpty:cT,shimParameterlessSetLocalDescription:uT});function lT(e,t,i,r,n,o,a){try{var s=e[o](a),c=s.value}catch(e){return void i(e)}s.done?t(c):Promise.resolve(c).then(r,n)}function hT(e){return function(){var t=this,i=arguments;return new Promise((function(r,n){var o=e.apply(t,i);function a(e){lT(o,r,n,a,s,"next",e)}function s(e){lT(o,r,n,a,s,"throw",e)}a(void 0)}))}}!function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.window,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{shimChrome:!0,shimFirefox:!0,shimSafari:!0},r=pS,n=fS(t),o={browserDetails:n,commonShim:dT,extractVersion:uS,disableLog:lS,disableWarnings:hS,sdp:iT};switch(n.browser){case"chrome":if(!eb||!ZE||!i.shimChrome)return r("Chrome shim is not included in this adapter release."),o;if(null===n.version)return r("Chrome shim can not determine version, not shimming."),o;r("adapter.js shimming chrome."),o.browserShim=eb,cT(t,n),uT(t),zE(t,n),KE(t),ZE(t,n),WE(t),QE(t,n),XE(t),qE(t),YE(t),$E(t,n),rT(t),aT(t),nT(t,n),oT(t),sT(t,n);break;case"firefox":if(!kb||!Eb||!i.shimFirefox)return r("Firefox shim is not included in this adapter release."),o;r("adapter.js shimming firefox."),o.browserShim=kb,cT(t,n),uT(t),Sb(t,n),Eb(t,n),gb(t),Tb(t),bb(t),Ib(t),Ab(t),Rb(t),Cb(t),Ob(t),wb(t),rT(t),aT(t),nT(t,n),oT(t);break;case"safari":if(!Bb||!i.shimSafari)return r("Safari shim is not included in this adapter release."),o;r("adapter.js shimming safari."),o.browserShim=Bb,cT(t,n),uT(t),Ub(t),Vb(t),Db(t),Nb(t),Pb(t),xb(t),Mb(t),Fb(t),rT(t),nT(t,n),oT(t),sT(t,n);break;default:r("Unsupported browser!")}}({window:"undefined"==typeof window?void 0:window}),Fo("toStringTag"),Ho(o.JSON,"JSON",!0),Ho(Math,"Math",!0);var pT=Le,_T=mh,fT=ch;Xr({target:"Object",stat:!0,forced:s((function(){_T(1)})),sham:!fT},{getPrototypeOf:function(e){return _T(pT(e))}});var vT=Xr,mT=to,yT=A([].reverse),ST=[1,2];vT({target:"Array",proto:!0,forced:String(ST)===String(ST.reverse())},{reverse:function(){return mT(this)&&(this.length=this.length),yT(this)}}),Xr({global:!0},{globalThis:o});var gT={exports:{}};!function(e){var i=function(e){var i,r=Object.prototype,n=r.hasOwnProperty,o="function"==typeof Symbol?Symbol:{},a=o.iterator||"@@iterator",s=o.asyncIterator||"@@asyncIterator",c=o.toStringTag||"@@toStringTag";function u(e,t,i){return Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{u({},"")}catch(e){u=function(e,t,i){return e[t]=i}}function d(e,t,i,r){var n=t&&t.prototype instanceof m?t:m,o=Object.create(n.prototype),a=new w(r||[]);return o._invoke=function(e,t,i){var r=h;return function(n,o){if(r===_)throw new Error("Generator is already running");if(r===f){if("throw"===n)throw o;return N()}for(i.method=n,i.arg=o;;){var a=i.delegate;if(a){var s=R(a,i);if(s){if(s===v)continue;return s}}if("next"===i.method)i.sent=i._sent=i.arg;else if("throw"===i.method){if(r===h)throw r=f,i.arg;i.dispatchException(i.arg)}else"return"===i.method&&i.abrupt("return",i.arg);r=_;var c=l(e,t,i);if("normal"===c.type){if(r=i.done?f:p,c.arg===v)continue;return{value:c.arg,done:i.done}}"throw"===c.type&&(r=f,i.method="throw",i.arg=c.arg)}}}(e,i,a),o}function l(e,t,i){try{return{type:"normal",arg:e.call(t,i)}}catch(e){return{type:"throw",arg:e}}}e.wrap=d;var h="suspendedStart",p="suspendedYield",_="executing",f="completed",v={};function m(){}function y(){}function S(){}var g={};u(g,a,(function(){return this}));var E=Object.getPrototypeOf,b=E&&E(E(k([])));b&&b!==r&&n.call(b,a)&&(g=b);var I=S.prototype=m.prototype=Object.create(g);function T(e){["next","throw","return"].forEach((function(t){u(e,t,(function(e){return this._invoke(t,e)}))}))}function A(e,i){function r(o,a,s,c){var u=l(e[o],e,a);if("throw"!==u.type){var d=u.arg,h=d.value;return h&&"object"===t(h)&&n.call(h,"__await")?i.resolve(h.__await).then((function(e){r("next",e,s,c)}),(function(e){r("throw",e,s,c)})):i.resolve(h).then((function(e){d.value=e,s(d)}),(function(e){return r("throw",e,s,c)}))}c(u.arg)}var o;this._invoke=function(e,t){function n(){return new i((function(i,n){r(e,t,i,n)}))}return o=o?o.then(n,n):n()}}function R(e,t){var r=e.iterator[t.method];if(r===i){if(t.delegate=null,"throw"===t.method){if(e.iterator.return&&(t.method="return",t.arg=i,R(e,t),"throw"===t.method))return v;t.method="throw",t.arg=new TypeError("The iterator does not provide a 'throw' method")}return v}var n=l(r,e.iterator,t.arg);if("throw"===n.type)return t.method="throw",t.arg=n.arg,t.delegate=null,v;var o=n.arg;return o?o.done?(t[e.resultName]=o.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=i),t.delegate=null,v):o:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,v)}function C(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function O(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function w(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(C,this),this.reset(!0)}function k(e){if(e){var t=e[a];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var r=-1,o=function t(){for(;++r<e.length;)if(n.call(e,r))return t.value=e[r],t.done=!1,t;return t.value=i,t.done=!0,t};return o.next=o}}return{next:N}}function N(){return{value:i,done:!0}}return y.prototype=S,u(I,"constructor",S),u(S,"constructor",y),y.displayName=u(S,c,"GeneratorFunction"),e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===y||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,S):(e.__proto__=S,u(e,c,"GeneratorFunction")),e.prototype=Object.create(I),e},e.awrap=function(e){return{__await:e}},T(A.prototype),u(A.prototype,s,(function(){return this})),e.AsyncIterator=A,e.async=function(t,i,r,n,o){void 0===o&&(o=Promise);var a=new A(d(t,i,r,n),o);return e.isGeneratorFunction(i)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},T(I),u(I,c,"Generator"),u(I,a,(function(){return this})),u(I,"toString",(function(){return"[object Generator]"})),e.keys=function(e){var t=[];for(var i in e)t.push(i);return t.reverse(),function i(){for(;t.length;){var r=t.pop();if(r in e)return i.value=r,i.done=!1,i}return i.done=!0,i}},e.values=k,w.prototype={constructor:w,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=i,this.done=!1,this.delegate=null,this.method="next",this.arg=i,this.tryEntries.forEach(O),!e)for(var t in this)"t"===t.charAt(0)&&n.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=i)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function r(r,n){return s.type="throw",s.arg=e,t.next=r,n&&(t.method="next",t.arg=i),!!n}for(var o=this.tryEntries.length-1;o>=0;--o){var a=this.tryEntries[o],s=a.completion;if("root"===a.tryLoc)return r("end");if(a.tryLoc<=this.prev){var c=n.call(a,"catchLoc"),u=n.call(a,"finallyLoc");if(c&&u){if(this.prev<a.catchLoc)return r(a.catchLoc,!0);if(this.prev<a.finallyLoc)return r(a.finallyLoc)}else if(c){if(this.prev<a.catchLoc)return r(a.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return r(a.finallyLoc)}}}},abrupt:function(e,t){for(var i=this.tryEntries.length-1;i>=0;--i){var r=this.tryEntries[i];if(r.tryLoc<=this.prev&&n.call(r,"finallyLoc")&&this.prev<r.finallyLoc){var o=r;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var a=o?o.completion:{};return a.type=e,a.arg=t,o?(this.method="next",this.next=o.finallyLoc,v):this.complete(a)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),v},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var i=this.tryEntries[t];if(i.finallyLoc===e)return this.complete(i.completion,i.afterLoc),O(i),v}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var i=this.tryEntries[t];if(i.tryLoc===e){var r=i.completion;if("throw"===r.type){var n=r.arg;O(i)}return n}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,r){return this.delegate={iterator:k(e),resultName:t,nextLoc:r},"next"===this.method&&(this.arg=i),v}},e}(e.exports);try{regeneratorRuntime=i}catch(e){"object"===("undefined"==typeof globalThis?"undefined":t(globalThis))?globalThis.regeneratorRuntime=i:Function("r","regeneratorRuntime = r")(i)}}(gT);var ET=gT.exports,bT=Xr,IT=o,TT=$n,AT=j,RT=Po,CT=hu,OT=/MSIE .\./.test(Y),wT=IT.Function,kT=function(e){return function(t,i){var r=CT(arguments.length,1)>2,n=AT(t)?t:wT(t),o=r?RT(arguments,2):void 0;return e(r?function(){TT(n,this,o)}:n,i)}};bT({global:!0,bind:!0,forced:OT},{setTimeout:kT(IT.setTimeout),setInterval:kT(IT.setInterval)});var NT=Mt,PT=Dc,DT=Xo,MT=h,LT=Le,UT=function(e,t,i,r){try{return r?t(NT(i)[0],i[1]):t(i)}catch(t){PT(e,"throw",t)}},xT=mc,VT=sa,FT=nr,BT=go,jT=wc,GT=bc,HT=o.Array,zT=function(e){var t=LT(e),i=VT(this),r=arguments.length,n=r>1?arguments[1]:void 0,o=void 0!==n;o&&(n=DT(n,r>2?arguments[2]:void 0));var a,s,c,u,d,l,h=GT(t),p=0;if(!h||this==HT&&xT(h))for(a=FT(t),s=i?new this(a):HT(a);a>p;p++)l=o?n(t[p],p):t[p],BT(s,p,l);else for(d=(u=jT(t,h)).next,s=i?new this:[];!(c=MT(d,u)).done;p++)l=o?UT(u,n,[c.value,p],!0):c.value,BT(s,p,l);return s.length=p,s},KT=zT;Xr({target:"Array",stat:!0,forced:!iu((function(e){Array.from(e)}))},{from:KT});var WT=s,XT=et("iterator"),qT=!WT((function(){var e=new URL("b?a=1&b=2&c=3","http://a"),t=e.searchParams,i="";return e.pathname="c%20d",t.forEach((function(e,r){t.delete("b"),i+=r+e})),!t.sort||"http://a/c%20d?a=1&c=3"!==e.href||"3"!==t.get("c")||"a=1"!==String(new URLSearchParams("?a=1"))||!t[XT]||"a"!==new URL("https://a@b").username||"b"!==new URLSearchParams(new URLSearchParams("a=b")).get("a")||"xn--e1aybc"!==new URL("http://тест").host||"#%D0%B1"!==new URL("http://a#б").hash||"a1c3"!==i||"x"!==new URL("http://x",void 0).host})),YT=A,JT=2147483647,QT=/[^\0-\u007E]/,ZT=/[.\u3002\uFF0E\uFF61]/g,$T="Overflow: input needs wider integers to process",eA=o.RangeError,tA=YT(ZT.exec),iA=Math.floor,rA=String.fromCharCode,nA=YT("".charCodeAt),oA=YT([].join),aA=YT([].push),sA=YT("".replace),cA=YT("".split),uA=YT("".toLowerCase),dA=function(e){return e+22+75*(e<26)},lA=function(e,t,i){var r=0;for(e=i?iA(e/700):e>>1,e+=iA(e/t);e>455;)e=iA(e/35),r+=36;return iA(r+36*e/(e+38))},hA=function(e){var t=[];e=function(e){for(var t=[],i=0,r=e.length;i<r;){var n=nA(e,i++);if(n>=55296&&n<=56319&&i<r){var o=nA(e,i++);56320==(64512&o)?aA(t,((1023&n)<<10)+(1023&o)+65536):(aA(t,n),i--)}else aA(t,n)}return t}(e);var i,r,n=e.length,o=128,a=0,s=72;for(i=0;i<e.length;i++)(r=e[i])<128&&aA(t,rA(r));var c=t.length,u=c;for(c&&aA(t,"-");u<n;){var d=JT;for(i=0;i<e.length;i++)(r=e[i])>=o&&r<d&&(d=r);var l=u+1;if(d-o>iA((JT-a)/l))throw eA($T);for(a+=(d-o)*l,o=d,i=0;i<e.length;i++){if((r=e[i])<o&&++a>JT)throw eA($T);if(r==o){for(var h=a,p=36;;){var _=p<=s?1:p>=s+26?26:p-s;if(h<_)break;var f=h-_,v=36-_;aA(t,rA(dA(_+f%v))),h=iA(f/v),p+=36}aA(t,rA(dA(h))),s=lA(a,l,u==c),a=0,u++}}a++,o++}return oA(t,"")},pA=Ro,_A=Math.floor,fA=function(e,t){var i=e.length,r=_A(i/2);return i<8?vA(e,t):mA(e,fA(pA(e,0,r),t),fA(pA(e,r),t),t)},vA=function(e,t){for(var i,r,n=e.length,o=1;o<n;){for(r=o,i=e[o];r&&t(e[r-1],i)>0;)e[r]=e[--r];r!==o++&&(e[r]=i)}return e},mA=function(e,t,i,r){for(var n=t.length,o=i.length,a=0,s=0;a<n||s<o;)e[a+s]=a<n&&s<o?r(t[a],i[s])<=0?t[a++]:i[s++]:a<n?t[a++]:i[s++];return e},yA=fA,SA=Xr,gA=o,EA=X,bA=h,IA=A,TA=qT,AA=Yt.exports,RA=nc,CA=Ho,OA=Ph,wA=wi,kA=hc,NA=j,PA=Ve,DA=Xo,MA=ho,LA=Mt,UA=H,xA=fo,VA=Rn,FA=S,BA=wc,jA=bc,GA=hu,HA=yA,zA=et("iterator"),KA="URLSearchParams",WA="URLSearchParamsIterator",XA=wA.set,qA=wA.getterFor(KA),YA=wA.getterFor(WA),JA=EA("fetch"),QA=EA("Request"),ZA=EA("Headers"),$A=QA&&QA.prototype,eR=ZA&&ZA.prototype,tR=gA.RegExp,iR=gA.TypeError,rR=gA.decodeURIComponent,nR=gA.encodeURIComponent,oR=IA("".charAt),aR=IA([].join),sR=IA([].push),cR=IA("".replace),uR=IA([].shift),dR=IA([].splice),lR=IA("".split),hR=IA("".slice),pR=/\+/g,_R=Array(4),fR=function(e){return _R[e-1]||(_R[e-1]=tR("((?:%[\\da-f]{2}){"+e+"})","gi"))},vR=function(e){try{return rR(e)}catch(t){return e}},mR=function(e){var t=cR(e,pR," "),i=4;try{return rR(t)}catch(e){for(;i;)t=cR(t,fR(i--),vR);return t}},yR=/[!'()~]|%20/g,SR={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+"},gR=function(e){return SR[e]},ER=function(e){return cR(nR(e),yR,gR)},bR=OA((function(e,t){XA(this,{type:WA,iterator:BA(qA(e).entries),kind:t})}),"Iterator",(function(){var e=YA(this),t=e.kind,i=e.iterator.next(),r=i.value;return i.done||(i.value="keys"===t?r.key:"values"===t?r.value:[r.key,r.value]),i}),!0),IR=function(e){this.entries=[],this.url=null,void 0!==e&&(UA(e)?this.parseObject(e):this.parseQuery("string"==typeof e?"?"===oR(e,0)?hR(e,1):e:xA(e)))};IR.prototype={type:KA,bindURL:function(e){this.url=e,this.update()},parseObject:function(e){var t,i,r,n,o,a,s,c=jA(e);if(c)for(i=(t=BA(e,c)).next;!(r=bA(i,t)).done;){if(o=(n=BA(LA(r.value))).next,(a=bA(o,n)).done||(s=bA(o,n)).done||!bA(o,n).done)throw iR("Expected sequence with length 2");sR(this.entries,{key:xA(a.value),value:xA(s.value)})}else for(var u in e)PA(e,u)&&sR(this.entries,{key:u,value:xA(e[u])})},parseQuery:function(e){if(e)for(var t,i,r=lR(e,"&"),n=0;n<r.length;)(t=r[n++]).length&&(i=lR(t,"="),sR(this.entries,{key:mR(uR(i)),value:mR(aR(i,"="))}))},serialize:function(){for(var e,t=this.entries,i=[],r=0;r<t.length;)e=t[r++],sR(i,ER(e.key)+"="+ER(e.value));return aR(i,"&")},update:function(){this.entries.length=0,this.parseQuery(this.url.query)},updateURL:function(){this.url&&this.url.update()}};var TR=function(){kA(this,AR);var e=arguments.length>0?arguments[0]:void 0;XA(this,new IR(e))},AR=TR.prototype;if(RA(AR,{append:function(e,t){GA(arguments.length,2);var i=qA(this);sR(i.entries,{key:xA(e),value:xA(t)}),i.updateURL()},delete:function(e){GA(arguments.length,1);for(var t=qA(this),i=t.entries,r=xA(e),n=0;n<i.length;)i[n].key===r?dR(i,n,1):n++;t.updateURL()},get:function(e){GA(arguments.length,1);for(var t=qA(this).entries,i=xA(e),r=0;r<t.length;r++)if(t[r].key===i)return t[r].value;return null},getAll:function(e){GA(arguments.length,1);for(var t=qA(this).entries,i=xA(e),r=[],n=0;n<t.length;n++)t[n].key===i&&sR(r,t[n].value);return r},has:function(e){GA(arguments.length,1);for(var t=qA(this).entries,i=xA(e),r=0;r<t.length;)if(t[r++].key===i)return!0;return!1},set:function(e,t){GA(arguments.length,1);for(var i,r=qA(this),n=r.entries,o=!1,a=xA(e),s=xA(t),c=0;c<n.length;c++)(i=n[c]).key===a&&(o?dR(n,c--,1):(o=!0,i.value=s));o||sR(n,{key:a,value:s}),r.updateURL()},sort:function(){var e=qA(this);HA(e.entries,(function(e,t){return e.key>t.key?1:-1})),e.updateURL()},forEach:function(e){for(var t,i=qA(this).entries,r=DA(e,arguments.length>1?arguments[1]:void 0),n=0;n<i.length;)r((t=i[n++]).value,t.key,this)},keys:function(){return new bR(this,"keys")},values:function(){return new bR(this,"values")},entries:function(){return new bR(this,"entries")}},{enumerable:!0}),AA(AR,zA,AR.entries,{name:"entries"}),AA(AR,"toString",(function(){return qA(this).serialize()}),{enumerable:!0}),CA(TR,KA),SA({global:!0,forced:!TA},{URLSearchParams:TR}),!TA&&NA(ZA)){var RR=IA(eR.has),CR=IA(eR.set),OR=function(e){if(UA(e)){var t,i=e.body;if(MA(i)===KA)return t=e.headers?new ZA(e.headers):new ZA,RR(t,"content-type")||CR(t,"content-type","application/x-www-form-urlencoded;charset=UTF-8"),VA(e,{body:FA(0,xA(i)),headers:FA(0,t)})}return e};if(NA(JA)&&SA({global:!0,enumerable:!0,forced:!0},{fetch:function(e){return JA(e,arguments.length>1?OR(arguments[1]):{})}}),NA(QA)){var wR=function(e){return kA(this,$A),new QA(e,arguments.length>1?OR(arguments[1]):{})};$A.constructor=wR,wR.prototype=$A,SA({global:!0,forced:!0},{Request:wR})}}var kR,NR={URLSearchParams:TR,getState:qA},PR=Xr,DR=c,MR=qT,LR=o,UR=Xo,xR=A,VR=rn.f,FR=Yt.exports,BR=hc,jR=Ve,GR=Fn,HR=zT,zR=Ro,KR=gp.codeAt,WR=function(e){var t,i,r=[],n=cA(sA(uA(e),ZT,"."),".");for(t=0;t<n.length;t++)i=n[t],aA(r,tA(QT,i)?"xn--"+hA(i):i);return oA(r,".")},XR=fo,qR=Ho,YR=hu,JR=NR,QR=wi,ZR=QR.set,$R=QR.getterFor("URL"),eC=JR.URLSearchParams,tC=JR.getState,iC=LR.URL,rC=LR.TypeError,nC=LR.parseInt,oC=Math.floor,aC=Math.pow,sC=xR("".charAt),cC=xR(/./.exec),uC=xR([].join),dC=xR(1..toString),lC=xR([].pop),hC=xR([].push),pC=xR("".replace),_C=xR([].shift),fC=xR("".split),vC=xR("".slice),mC=xR("".toLowerCase),yC=xR([].unshift),SC="Invalid scheme",gC="Invalid host",EC="Invalid port",bC=/[a-z]/i,IC=/[\d+-.a-z]/i,TC=/\d/,AC=/^0x/i,RC=/^[0-7]+$/,CC=/^\d+$/,OC=/^[\da-f]+$/i,wC=/[\0\t\n\r #%/:<>?@[\\\]^|]/,kC=/[\0\t\n\r #/:<>?@[\\\]^|]/,NC=/^[\u0000-\u0020]+|[\u0000-\u0020]+$/g,PC=/[\t\n\r]/g,DC=function(e){var t,i,r,n;if("number"==typeof e){for(t=[],i=0;i<4;i++)yC(t,e%256),e=oC(e/256);return uC(t,".")}if("object"==typeof e){for(t="",r=function(e){for(var t=null,i=1,r=null,n=0,o=0;o<8;o++)0!==e[o]?(n>i&&(t=r,i=n),r=null,n=0):(null===r&&(r=o),++n);return n>i&&(t=r,i=n),t}(e),i=0;i<8;i++)n&&0===e[i]||(n&&(n=!1),r===i?(t+=i?":":"::",n=!0):(t+=dC(e[i],16),i<7&&(t+=":")));return"["+t+"]"}return e},MC={},LC=GR({},MC,{" ":1,'"':1,"<":1,">":1,"`":1}),UC=GR({},LC,{"#":1,"?":1,"{":1,"}":1}),xC=GR({},UC,{"/":1,":":1,";":1,"=":1,"@":1,"[":1,"\\":1,"]":1,"^":1,"|":1}),VC=function(e,t){var i=KR(e,0);return i>32&&i<127&&!jR(t,e)?e:encodeURIComponent(e)},FC={ftp:21,file:null,http:80,https:443,ws:80,wss:443},BC=function(e,t){var i;return 2==e.length&&cC(bC,sC(e,0))&&(":"==(i=sC(e,1))||!t&&"|"==i)},jC=function(e){var t;return e.length>1&&BC(vC(e,0,2))&&(2==e.length||"/"===(t=sC(e,2))||"\\"===t||"?"===t||"#"===t)},GC=function(e){return"."===e||"%2e"===mC(e)},HC={},zC={},KC={},WC={},XC={},qC={},YC={},JC={},QC={},ZC={},$C={},eO={},tO={},iO={},rO={},nO={},oO={},aO={},sO={},cO={},uO={},dO=function(e,t,i){var r,n,o,a=XR(e);if(t){if(n=this.parse(a))throw rC(n);this.searchParams=null}else{if(void 0!==i&&(r=new dO(i,!0)),n=this.parse(a,null,r))throw rC(n);(o=tC(new eC)).bindURL(this),this.searchParams=o}};dO.prototype={type:"URL",parse:function(e,t,i){var r,n,o,a,s,c=this,u=t||HC,d=0,l="",h=!1,p=!1,_=!1;for(e=XR(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=pC(e,NC,"")),e=pC(e,PC,""),r=HR(e);d<=r.length;){switch(n=r[d],u){case HC:if(!n||!cC(bC,n)){if(t)return SC;u=KC;continue}l+=mC(n),u=zC;break;case zC:if(n&&(cC(IC,n)||"+"==n||"-"==n||"."==n))l+=mC(n);else{if(":"!=n){if(t)return SC;l="",u=KC,d=0;continue}if(t&&(c.isSpecial()!=jR(FC,l)||"file"==l&&(c.includesCredentials()||null!==c.port)||"file"==c.scheme&&!c.host))return;if(c.scheme=l,t)return void(c.isSpecial()&&FC[c.scheme]==c.port&&(c.port=null));l="","file"==c.scheme?u=iO:c.isSpecial()&&i&&i.scheme==c.scheme?u=WC:c.isSpecial()?u=JC:"/"==r[d+1]?(u=XC,d++):(c.cannotBeABaseURL=!0,hC(c.path,""),u=sO)}break;case KC:if(!i||i.cannotBeABaseURL&&"#"!=n)return SC;if(i.cannotBeABaseURL&&"#"==n){c.scheme=i.scheme,c.path=zR(i.path),c.query=i.query,c.fragment="",c.cannotBeABaseURL=!0,u=uO;break}u="file"==i.scheme?iO:qC;continue;case WC:if("/"!=n||"/"!=r[d+1]){u=qC;continue}u=QC,d++;break;case XC:if("/"==n){u=ZC;break}u=aO;continue;case qC:if(c.scheme=i.scheme,n==kR)c.username=i.username,c.password=i.password,c.host=i.host,c.port=i.port,c.path=zR(i.path),c.query=i.query;else if("/"==n||"\\"==n&&c.isSpecial())u=YC;else if("?"==n)c.username=i.username,c.password=i.password,c.host=i.host,c.port=i.port,c.path=zR(i.path),c.query="",u=cO;else{if("#"!=n){c.username=i.username,c.password=i.password,c.host=i.host,c.port=i.port,c.path=zR(i.path),c.path.length--,u=aO;continue}c.username=i.username,c.password=i.password,c.host=i.host,c.port=i.port,c.path=zR(i.path),c.query=i.query,c.fragment="",u=uO}break;case YC:if(!c.isSpecial()||"/"!=n&&"\\"!=n){if("/"!=n){c.username=i.username,c.password=i.password,c.host=i.host,c.port=i.port,u=aO;continue}u=ZC}else u=QC;break;case JC:if(u=QC,"/"!=n||"/"!=sC(l,d+1))continue;d++;break;case QC:if("/"!=n&&"\\"!=n){u=ZC;continue}break;case ZC:if("@"==n){h&&(l="%40"+l),h=!0,o=HR(l);for(var f=0;f<o.length;f++){var v=o[f];if(":"!=v||_){var m=VC(v,xC);_?c.password+=m:c.username+=m}else _=!0}l=""}else if(n==kR||"/"==n||"?"==n||"#"==n||"\\"==n&&c.isSpecial()){if(h&&""==l)return"Invalid authority";d-=HR(l).length+1,l="",u=$C}else l+=n;break;case $C:case eO:if(t&&"file"==c.scheme){u=nO;continue}if(":"!=n||p){if(n==kR||"/"==n||"?"==n||"#"==n||"\\"==n&&c.isSpecial()){if(c.isSpecial()&&""==l)return gC;if(t&&""==l&&(c.includesCredentials()||null!==c.port))return;if(a=c.parseHost(l))return a;if(l="",u=oO,t)return;continue}"["==n?p=!0:"]"==n&&(p=!1),l+=n}else{if(""==l)return gC;if(a=c.parseHost(l))return a;if(l="",u=tO,t==eO)return}break;case tO:if(!cC(TC,n)){if(n==kR||"/"==n||"?"==n||"#"==n||"\\"==n&&c.isSpecial()||t){if(""!=l){var y=nC(l,10);if(y>65535)return EC;c.port=c.isSpecial()&&y===FC[c.scheme]?null:y,l=""}if(t)return;u=oO;continue}return EC}l+=n;break;case iO:if(c.scheme="file","/"==n||"\\"==n)u=rO;else{if(!i||"file"!=i.scheme){u=aO;continue}if(n==kR)c.host=i.host,c.path=zR(i.path),c.query=i.query;else if("?"==n)c.host=i.host,c.path=zR(i.path),c.query="",u=cO;else{if("#"!=n){jC(uC(zR(r,d),""))||(c.host=i.host,c.path=zR(i.path),c.shortenPath()),u=aO;continue}c.host=i.host,c.path=zR(i.path),c.query=i.query,c.fragment="",u=uO}}break;case rO:if("/"==n||"\\"==n){u=nO;break}i&&"file"==i.scheme&&!jC(uC(zR(r,d),""))&&(BC(i.path[0],!0)?hC(c.path,i.path[0]):c.host=i.host),u=aO;continue;case nO:if(n==kR||"/"==n||"\\"==n||"?"==n||"#"==n){if(!t&&BC(l))u=aO;else if(""==l){if(c.host="",t)return;u=oO}else{if(a=c.parseHost(l))return a;if("localhost"==c.host&&(c.host=""),t)return;l="",u=oO}continue}l+=n;break;case oO:if(c.isSpecial()){if(u=aO,"/"!=n&&"\\"!=n)continue}else if(t||"?"!=n)if(t||"#"!=n){if(n!=kR&&(u=aO,"/"!=n))continue}else c.fragment="",u=uO;else c.query="",u=cO;break;case aO:if(n==kR||"/"==n||"\\"==n&&c.isSpecial()||!t&&("?"==n||"#"==n)){if(".."===(s=mC(s=l))||"%2e."===s||".%2e"===s||"%2e%2e"===s?(c.shortenPath(),"/"==n||"\\"==n&&c.isSpecial()||hC(c.path,"")):GC(l)?"/"==n||"\\"==n&&c.isSpecial()||hC(c.path,""):("file"==c.scheme&&!c.path.length&&BC(l)&&(c.host&&(c.host=""),l=sC(l,0)+":"),hC(c.path,l)),l="","file"==c.scheme&&(n==kR||"?"==n||"#"==n))for(;c.path.length>1&&""===c.path[0];)_C(c.path);"?"==n?(c.query="",u=cO):"#"==n&&(c.fragment="",u=uO)}else l+=VC(n,UC);break;case sO:"?"==n?(c.query="",u=cO):"#"==n?(c.fragment="",u=uO):n!=kR&&(c.path[0]+=VC(n,MC));break;case cO:t||"#"!=n?n!=kR&&("'"==n&&c.isSpecial()?c.query+="%27":c.query+="#"==n?"%23":VC(n,MC)):(c.fragment="",u=uO);break;case uO:n!=kR&&(c.fragment+=VC(n,LC))}d++}},parseHost:function(e){var t,i,r;if("["==sC(e,0)){if("]"!=sC(e,e.length-1))return gC;if(t=function(e){var t,i,r,n,o,a,s,c=[0,0,0,0,0,0,0,0],u=0,d=null,l=0,h=function(){return sC(e,l)};if(":"==h()){if(":"!=sC(e,1))return;l+=2,d=++u}for(;h();){if(8==u)return;if(":"!=h()){for(t=i=0;i<4&&cC(OC,h());)t=16*t+nC(h(),16),l++,i++;if("."==h()){if(0==i)return;if(l-=i,u>6)return;for(r=0;h();){if(n=null,r>0){if(!("."==h()&&r<4))return;l++}if(!cC(TC,h()))return;for(;cC(TC,h());){if(o=nC(h(),10),null===n)n=o;else{if(0==n)return;n=10*n+o}if(n>255)return;l++}c[u]=256*c[u]+n,2!=++r&&4!=r||u++}if(4!=r)return;break}if(":"==h()){if(l++,!h())return}else if(h())return;c[u++]=t}else{if(null!==d)return;l++,d=++u}}if(null!==d)for(a=u-d,u=7;0!=u&&a>0;)s=c[u],c[u--]=c[d+a-1],c[d+--a]=s;else if(8!=u)return;return c}(vC(e,1,-1)),!t)return gC;this.host=t}else if(this.isSpecial()){if(e=WR(e),cC(wC,e))return gC;if(t=function(e){var t,i,r,n,o,a,s,c=fC(e,".");if(c.length&&""==c[c.length-1]&&c.length--,(t=c.length)>4)return e;for(i=[],r=0;r<t;r++){if(""==(n=c[r]))return e;if(o=10,n.length>1&&"0"==sC(n,0)&&(o=cC(AC,n)?16:8,n=vC(n,8==o?1:2)),""===n)a=0;else{if(!cC(10==o?CC:8==o?RC:OC,n))return e;a=nC(n,o)}hC(i,a)}for(r=0;r<t;r++)if(a=i[r],r==t-1){if(a>=aC(256,5-t))return null}else if(a>255)return null;for(s=lC(i),r=0;r<i.length;r++)s+=i[r]*aC(256,3-r);return s}(e),null===t)return gC;this.host=t}else{if(cC(kC,e))return gC;for(t="",i=HR(e),r=0;r<i.length;r++)t+=VC(i[r],MC);this.host=t}},cannotHaveUsernamePasswordPort:function(){return!this.host||this.cannotBeABaseURL||"file"==this.scheme},includesCredentials:function(){return""!=this.username||""!=this.password},isSpecial:function(){return jR(FC,this.scheme)},shortenPath:function(){var e=this.path,t=e.length;!t||"file"==this.scheme&&1==t&&BC(e[0],!0)||e.length--},serialize:function(){var e=this,t=e.scheme,i=e.username,r=e.password,n=e.host,o=e.port,a=e.path,s=e.query,c=e.fragment,u=t+":";return null!==n?(u+="//",e.includesCredentials()&&(u+=i+(r?":"+r:"")+"@"),u+=DC(n),null!==o&&(u+=":"+o)):"file"==t&&(u+="//"),u+=e.cannotBeABaseURL?a[0]:a.length?"/"+uC(a,"/"):"",null!==s&&(u+="?"+s),null!==c&&(u+="#"+c),u},setHref:function(e){var t=this.parse(e);if(t)throw rC(t);this.searchParams.update()},getOrigin:function(){var e=this.scheme,t=this.port;if("blob"==e)try{return new lO(e.path[0]).origin}catch(e){return"null"}return"file"!=e&&this.isSpecial()?e+"://"+DC(this.host)+(null!==t?":"+t:""):"null"},getProtocol:function(){return this.scheme+":"},setProtocol:function(e){this.parse(XR(e)+":",HC)},getUsername:function(){return this.username},setUsername:function(e){var t=HR(XR(e));if(!this.cannotHaveUsernamePasswordPort()){this.username="";for(var i=0;i<t.length;i++)this.username+=VC(t[i],xC)}},getPassword:function(){return this.password},setPassword:function(e){var t=HR(XR(e));if(!this.cannotHaveUsernamePasswordPort()){this.password="";for(var i=0;i<t.length;i++)this.password+=VC(t[i],xC)}},getHost:function(){var e=this.host,t=this.port;return null===e?"":null===t?DC(e):DC(e)+":"+t},setHost:function(e){this.cannotBeABaseURL||this.parse(e,$C)},getHostname:function(){var e=this.host;return null===e?"":DC(e)},setHostname:function(e){this.cannotBeABaseURL||this.parse(e,eO)},getPort:function(){var e=this.port;return null===e?"":XR(e)},setPort:function(e){this.cannotHaveUsernamePasswordPort()||(""==(e=XR(e))?this.port=null:this.parse(e,tO))},getPathname:function(){var e=this.path;return this.cannotBeABaseURL?e[0]:e.length?"/"+uC(e,"/"):""},setPathname:function(e){this.cannotBeABaseURL||(this.path=[],this.parse(e,oO))},getSearch:function(){var e=this.query;return e?"?"+e:""},setSearch:function(e){""==(e=XR(e))?this.query=null:("?"==sC(e,0)&&(e=vC(e,1)),this.query="",this.parse(e,cO)),this.searchParams.update()},getSearchParams:function(){return this.searchParams.facade},getHash:function(){var e=this.fragment;return e?"#"+e:""},setHash:function(e){""!=(e=XR(e))?("#"==sC(e,0)&&(e=vC(e,1)),this.fragment="",this.parse(e,uO)):this.fragment=null},update:function(){this.query=this.searchParams.serialize()||null}};var lO=function(e){var t=BR(this,hO),i=YR(arguments.length,1)>1?arguments[1]:void 0,r=ZR(t,new dO(e,!1,i));DR||(t.href=r.serialize(),t.origin=r.getOrigin(),t.protocol=r.getProtocol(),t.username=r.getUsername(),t.password=r.getPassword(),t.host=r.getHost(),t.hostname=r.getHostname(),t.port=r.getPort(),t.pathname=r.getPathname(),t.search=r.getSearch(),t.searchParams=r.getSearchParams(),t.hash=r.getHash())},hO=lO.prototype,pO=function(e,t){return{get:function(){return $R(this)[e]()},set:t&&function(e){return $R(this)[t](e)},configurable:!0,enumerable:!0}};if(DR&&VR(hO,{href:pO("serialize","setHref"),origin:pO("getOrigin"),protocol:pO("getProtocol","setProtocol"),username:pO("getUsername","setUsername"),password:pO("getPassword","setPassword"),host:pO("getHost","setHost"),hostname:pO("getHostname","setHostname"),port:pO("getPort","setPort"),pathname:pO("getPathname","setPathname"),search:pO("getSearch","setSearch"),searchParams:pO("getSearchParams"),hash:pO("getHash","setHash")}),FR(hO,"toJSON",(function(){return $R(this).serialize()}),{enumerable:!0}),FR(hO,"toString",(function(){return $R(this).serialize()}),{enumerable:!0}),iC){var _O=iC.createObjectURL,fO=iC.revokeObjectURL;_O&&FR(lO,"createObjectURL",UR(_O,iC)),fO&&FR(lO,"revokeObjectURL",UR(fO,iC))}qR(lO,"URL"),PR({global:!0,forced:!MR,sham:!DR},{URL:lO});var vO=Xr,mO=o,yO=h,SO=A,gO=x,EO=j,bO=wf,IO=fo,TO=ge,AO=Gf,RO=YS,CO=et("replace"),OO=RegExp.prototype,wO=mO.TypeError,kO=SO(AO),NO=SO("".indexOf);SO("".replace);var PO=SO("".slice),DO=Math.max,MO=function(e,t,i){return i>e.length?-1:""===t?i:NO(e,t,i)};vO({target:"String",proto:!0},{replaceAll:function(e,t){var i,r,n,o,a,s,c,u,d=gO(this),l=0,h=0,p="";if(null!=e){if(bO(e)&&(i=IO(gO("flags"in OO?e.flags:kO(e))),!~NO(i,"g")))throw wO("`.replaceAll` does not allow non-global regexes");if(r=TO(e,CO))return yO(r,e,d,t)}for(n=IO(d),o=IO(e),(a=EO(t))||(t=IO(t)),s=o.length,c=DO(1,s),l=MO(n,o,0);-1!==l;)u=a?IO(t(o,l,n)):RO(o,n,l,[],void 0,t),p+=PO(n,h,l)+u,h=l+s,l=MO(n,o,l+c);return h<n.length&&(p+=PO(n,h)),p}});var LO="undefined"!=typeof ArrayBuffer&&"undefined"!=typeof DataView,UO=Yi,xO=ir,VO=o.RangeError,FO=function(e){if(void 0===e)return 0;var t=UO(e),i=xO(t);if(t!==i)throw VO("Wrong length or index");return i},BO=o.Array,jO=Math.abs,GO=Math.pow,HO=Math.floor,zO=Math.log,KO=Math.LN2,WO={pack:function(e,t,i){var r,n,o,a=BO(i),s=8*i-t-1,c=(1<<s)-1,u=c>>1,d=23===t?GO(2,-24)-GO(2,-77):0,l=e<0||0===e&&1/e<0?1:0,h=0;for((e=jO(e))!=e||e===1/0?(n=e!=e?1:0,r=c):(r=HO(zO(e)/KO),e*(o=GO(2,-r))<1&&(r--,o*=2),(e+=r+u>=1?d/o:d*GO(2,1-u))*o>=2&&(r++,o/=2),r+u>=c?(n=0,r=c):r+u>=1?(n=(e*o-1)*GO(2,t),r+=u):(n=e*GO(2,u-1)*GO(2,t),r=0));t>=8;)a[h++]=255&n,n/=256,t-=8;for(r=r<<t|n,s+=t;s>0;)a[h++]=255&r,r/=256,s-=8;return a[--h]|=128*l,a},unpack:function(e,t){var i,r=e.length,n=8*r-t-1,o=(1<<n)-1,a=o>>1,s=n-7,c=r-1,u=e[c--],d=127&u;for(u>>=7;s>0;)d=256*d+e[c--],s-=8;for(i=d&(1<<-s)-1,d>>=-s,s+=t;s>0;)i=256*i+e[c--],s-=8;if(0===d)d=1-a;else{if(d===o)return i?NaN:u?-1/0:1/0;i+=GO(2,t),d-=a}return(u?-1:1)*i*GO(2,d-t)}},XO=Le,qO=$i,YO=nr,JO=function(e){for(var t=XO(this),i=YO(t),r=arguments.length,n=qO(r>1?arguments[1]:void 0,i),o=r>2?arguments[2]:void 0,a=void 0===o?i:qO(o,i);a>n;)t[n++]=e;return t},QO=o,ZO=A,$O=c,ew=LO,tw=Li,iw=qt,rw=nc,nw=s,ow=hc,aw=Yi,sw=ir,cw=FO,uw=WO,dw=mh,lw=tn,hw=Wi.f,pw=Ot.f,_w=JO,fw=Ro,vw=Ho,mw=tw.PROPER,yw=tw.CONFIGURABLE,Sw=wi.get,gw=wi.set,Ew="ArrayBuffer",bw="DataView",Iw="Wrong index",Tw=QO.ArrayBuffer,Aw=Tw,Rw=Aw&&Aw.prototype,Cw=QO.DataView,Ow=Cw&&Cw.prototype,ww=Object.prototype,kw=QO.Array,Nw=QO.RangeError,Pw=ZO(_w),Dw=ZO([].reverse),Mw=uw.pack,Lw=uw.unpack,Uw=function(e){return[255&e]},xw=function(e){return[255&e,e>>8&255]},Vw=function(e){return[255&e,e>>8&255,e>>16&255,e>>24&255]},Fw=function(e){return e[3]<<24|e[2]<<16|e[1]<<8|e[0]},Bw=function(e){return Mw(e,23,4)},jw=function(e){return Mw(e,52,8)},Gw=function(e,t){pw(e.prototype,t,{get:function(){return Sw(this)[t]}})},Hw=function(e,t,i,r){var n=cw(i),o=Sw(e);if(n+t>o.byteLength)throw Nw(Iw);var a=Sw(o.buffer).bytes,s=n+o.byteOffset,c=fw(a,s,s+t);return r?c:Dw(c)},zw=function(e,t,i,r,n,o){var a=cw(i),s=Sw(e);if(a+t>s.byteLength)throw Nw(Iw);for(var c=Sw(s.buffer).bytes,u=a+s.byteOffset,d=r(+n),l=0;l<t;l++)c[u+l]=d[o?l:t-l-1]};if(ew){var Kw=mw&&Tw.name!==Ew;if(nw((function(){Tw(1)}))&&nw((function(){new Tw(-1)}))&&!nw((function(){return new Tw,new Tw(1.5),new Tw(NaN),Kw&&!yw})))Kw&&yw&&iw(Tw,"name",Ew);else{(Aw=function(e){return ow(this,Rw),new Tw(cw(e))}).prototype=Rw;for(var Ww,Xw=hw(Tw),qw=0;Xw.length>qw;)(Ww=Xw[qw++])in Aw||iw(Aw,Ww,Tw[Ww]);Rw.constructor=Aw}lw&&dw(Ow)!==ww&&lw(Ow,ww);var Yw=new Cw(new Aw(2)),Jw=ZO(Ow.setInt8);Yw.setInt8(0,2147483648),Yw.setInt8(1,2147483649),!Yw.getInt8(0)&&Yw.getInt8(1)||rw(Ow,{setInt8:function(e,t){Jw(this,e,t<<24>>24)},setUint8:function(e,t){Jw(this,e,t<<24>>24)}},{unsafe:!0})}else Rw=(Aw=function(e){ow(this,Rw);var t=cw(e);gw(this,{bytes:Pw(kw(t),0),byteLength:t}),$O||(this.byteLength=t)}).prototype,Ow=(Cw=function(e,t,i){ow(this,Ow),ow(e,Rw);var r=Sw(e).byteLength,n=aw(t);if(n<0||n>r)throw Nw("Wrong offset");if(n+(i=void 0===i?r-n:sw(i))>r)throw Nw("Wrong length");gw(this,{buffer:e,byteLength:i,byteOffset:n}),$O||(this.buffer=e,this.byteLength=i,this.byteOffset=n)}).prototype,$O&&(Gw(Aw,"byteLength"),Gw(Cw,"buffer"),Gw(Cw,"byteLength"),Gw(Cw,"byteOffset")),rw(Ow,{getInt8:function(e){return Hw(this,1,e)[0]<<24>>24},getUint8:function(e){return Hw(this,1,e)[0]},getInt16:function(e){var t=Hw(this,2,e,arguments.length>1?arguments[1]:void 0);return(t[1]<<8|t[0])<<16>>16},getUint16:function(e){var t=Hw(this,2,e,arguments.length>1?arguments[1]:void 0);return t[1]<<8|t[0]},getInt32:function(e){return Fw(Hw(this,4,e,arguments.length>1?arguments[1]:void 0))},getUint32:function(e){return Fw(Hw(this,4,e,arguments.length>1?arguments[1]:void 0))>>>0},getFloat32:function(e){return Lw(Hw(this,4,e,arguments.length>1?arguments[1]:void 0),23)},getFloat64:function(e){return Lw(Hw(this,8,e,arguments.length>1?arguments[1]:void 0),52)},setInt8:function(e,t){zw(this,1,e,Uw,t)},setUint8:function(e,t){zw(this,1,e,Uw,t)},setInt16:function(e,t){zw(this,2,e,xw,t,arguments.length>2?arguments[2]:void 0)},setUint16:function(e,t){zw(this,2,e,xw,t,arguments.length>2?arguments[2]:void 0)},setInt32:function(e,t){zw(this,4,e,Vw,t,arguments.length>2?arguments[2]:void 0)},setUint32:function(e,t){zw(this,4,e,Vw,t,arguments.length>2?arguments[2]:void 0)},setFloat32:function(e,t){zw(this,4,e,Bw,t,arguments.length>2?arguments[2]:void 0)},setFloat64:function(e,t){zw(this,8,e,jw,t,arguments.length>2?arguments[2]:void 0)}});vw(Aw,Ew),vw(Cw,bw);var Qw={ArrayBuffer:Aw,DataView:Cw},Zw=Xr,$w=A,ek=s,tk=Mt,ik=$i,rk=ir,nk=du,ok=Qw.ArrayBuffer,ak=Qw.DataView,sk=ak.prototype,ck=$w(ok.prototype.slice),uk=$w(sk.getUint8),dk=$w(sk.setUint8);Zw({target:"ArrayBuffer",proto:!0,unsafe:!0,forced:ek((function(){return!new ok(2).slice(1,void 0).byteLength}))},{slice:function(e,t){if(ck&&void 0===t)return ck(tk(this),e);for(var i=tk(this).byteLength,r=ik(e,i),n=ik(void 0===t?i:t,i),o=new(nk(this,ok))(rk(n-r)),a=new ak(this),s=new ak(o),c=0;r<n;)dk(s,c++,uk(a,r++));return o}});var lk,hk,pk,_k={exports:{}},fk=LO,vk=c,mk=o,yk=j,Sk=H,gk=Ve,Ek=ho,bk=_e,Ik=qt,Tk=Yt.exports,Ak=Ot.f,Rk=q,Ck=mh,Ok=tn,wk=et,kk=He,Nk=mk.Int8Array,Pk=Nk&&Nk.prototype,Dk=mk.Uint8ClampedArray,Mk=Dk&&Dk.prototype,Lk=Nk&&Ck(Nk),Uk=Pk&&Ck(Pk),xk=Object.prototype,Vk=mk.TypeError,Fk=wk("toStringTag"),Bk=kk("TYPED_ARRAY_TAG"),jk=kk("TYPED_ARRAY_CONSTRUCTOR"),Gk=fk&&!!Ok&&"Opera"!==Ek(mk.opera),Hk=!1,zk={Int8Array:1,Uint8Array:1,Uint8ClampedArray:1,Int16Array:2,Uint16Array:2,Int32Array:4,Uint32Array:4,Float32Array:4,Float64Array:8},Kk={BigInt64Array:8,BigUint64Array:8},Wk=function(e){if(!Sk(e))return!1;var t=Ek(e);return gk(zk,t)||gk(Kk,t)};for(lk in zk)(pk=(hk=mk[lk])&&hk.prototype)?Ik(pk,jk,hk):Gk=!1;for(lk in Kk)(pk=(hk=mk[lk])&&hk.prototype)&&Ik(pk,jk,hk);if((!Gk||!yk(Lk)||Lk===Function.prototype)&&(Lk=function(){throw Vk("Incorrect invocation")},Gk))for(lk in zk)mk[lk]&&Ok(mk[lk],Lk);if((!Gk||!Uk||Uk===xk)&&(Uk=Lk.prototype,Gk))for(lk in zk)mk[lk]&&Ok(mk[lk].prototype,Uk);if(Gk&&Ck(Mk)!==Uk&&Ok(Mk,Uk),vk&&!gk(Uk,Fk))for(lk in Hk=!0,Ak(Uk,Fk,{get:function(){return Sk(this)?this[Bk]:void 0}}),zk)mk[lk]&&Ik(mk[lk],Bk,lk);var Xk={NATIVE_ARRAY_BUFFER_VIEWS:Gk,TYPED_ARRAY_CONSTRUCTOR:jk,TYPED_ARRAY_TAG:Hk&&Bk,aTypedArray:function(e){if(Wk(e))return e;throw Vk("Target is not a typed array")},aTypedArrayConstructor:function(e){if(yk(e)&&(!Ok||Rk(Lk,e)))return e;throw Vk(bk(e)+" is not a typed array constructor")},exportTypedArrayMethod:function(e,t,i,r){if(vk){if(i)for(var n in zk){var o=mk[n];if(o&&gk(o.prototype,e))try{delete o.prototype[e]}catch(i){try{o.prototype[e]=t}catch(e){}}}Uk[e]&&!i||Tk(Uk,e,i?t:Gk&&Pk[e]||t,r)}},exportTypedArrayStaticMethod:function(e,t,i){var r,n;if(vk){if(Ok){if(i)for(r in zk)if((n=mk[r])&&gk(n,e))try{delete n[e]}catch(e){}if(Lk[e]&&!i)return;try{return Tk(Lk,e,i?t:Gk&&Lk[e]||t)}catch(e){}}for(r in zk)!(n=mk[r])||n[e]&&!i||Tk(n,e,t)}},isView:function(e){if(!Sk(e))return!1;var t=Ek(e);return"DataView"===t||gk(zk,t)||gk(Kk,t)},isTypedArray:Wk,TypedArray:Lk,TypedArrayPrototype:Uk},qk=o,Yk=s,Jk=iu,Qk=Xk.NATIVE_ARRAY_BUFFER_VIEWS,Zk=qk.ArrayBuffer,$k=qk.Int8Array,eN=!Qk||!Yk((function(){$k(1)}))||!Yk((function(){new $k(-1)}))||!Jk((function(e){new $k,new $k(null),new $k(1.5),new $k(e)}),!0)||Yk((function(){return 1!==new $k(new Zk(2),1,void 0).length})),tN=H,iN=Math.floor,rN=Number.isInteger||function(e){return!tN(e)&&isFinite(e)&&iN(e)===e},nN=Yi,oN=o.RangeError,aN=function(e){var t=nN(e);if(t<0)throw oN("The argument can't be less than 0");return t},sN=o.RangeError,cN=function(e,t){var i=aN(e);if(i%t)throw sN("Wrong offset");return i},uN=Xo,dN=h,lN=au,hN=Le,pN=nr,_N=wc,fN=bc,vN=mc,mN=Xk.aTypedArrayConstructor,yN=Xr,SN=o,gN=h,EN=c,bN=eN,IN=Xk,TN=Qw,AN=hc,RN=S,CN=qt,ON=rN,wN=ir,kN=FO,NN=cN,PN=ht,DN=Ve,MN=ho,LN=H,UN=he,xN=Rn,VN=q,FN=tn,BN=Wi.f,jN=function(e){var t,i,r,n,o,a,s=lN(this),c=hN(e),u=arguments.length,d=u>1?arguments[1]:void 0,l=void 0!==d,h=fN(c);if(h&&!vN(h))for(a=(o=_N(c,h)).next,c=[];!(n=dN(a,o)).done;)c.push(n.value);for(l&&u>2&&(d=uN(d,arguments[2])),i=pN(c),r=new(mN(s))(i),t=0;i>t;t++)r[t]=l?d(c[t],t):c[t];return r},GN=Ia.forEach,HN=uc,zN=Ot,KN=a,WN=sy,XN=wi.get,qN=wi.set,YN=zN.f,JN=KN.f,QN=Math.round,ZN=SN.RangeError,$N=TN.ArrayBuffer,eP=$N.prototype,tP=TN.DataView,iP=IN.NATIVE_ARRAY_BUFFER_VIEWS,rP=IN.TYPED_ARRAY_CONSTRUCTOR,nP=IN.TYPED_ARRAY_TAG,oP=IN.TypedArray,aP=IN.TypedArrayPrototype,sP=IN.aTypedArrayConstructor,cP=IN.isTypedArray,uP="BYTES_PER_ELEMENT",dP="Wrong length",lP=function(e,t){sP(e);for(var i=0,r=t.length,n=new e(r);r>i;)n[i]=t[i++];return n},hP=function(e,t){YN(e,t,{get:function(){return XN(this)[t]}})},pP=function(e){var t;return VN(eP,e)||"ArrayBuffer"==(t=MN(e))||"SharedArrayBuffer"==t},_P=function(e,t){return cP(e)&&!UN(t)&&t in e&&ON(+t)&&t>=0},fP=function(e,t){return t=PN(t),_P(e,t)?RN(2,e[t]):JN(e,t)},vP=function(e,t,i){return t=PN(t),!(_P(e,t)&&LN(i)&&DN(i,"value"))||DN(i,"get")||DN(i,"set")||i.configurable||DN(i,"writable")&&!i.writable||DN(i,"enumerable")&&!i.enumerable?YN(e,t,i):(e[t]=i.value,e)};EN?(iP||(KN.f=fP,zN.f=vP,hP(aP,"buffer"),hP(aP,"byteOffset"),hP(aP,"byteLength"),hP(aP,"length")),yN({target:"Object",stat:!0,forced:!iP},{getOwnPropertyDescriptor:fP,defineProperty:vP}),_k.exports=function(e,t,i){var r=e.match(/\d+$/)[0]/8,n=e+(i?"Clamped":"")+"Array",o="get"+e,a="set"+e,s=SN[n],c=s,u=c&&c.prototype,d={},l=function(e,t){YN(e,t,{get:function(){return function(e,t){var i=XN(e);return i.view[o](t*r+i.byteOffset,!0)}(this,t)},set:function(e){return function(e,t,n){var o=XN(e);i&&(n=(n=QN(n))<0?0:n>255?255:255&n),o.view[a](t*r+o.byteOffset,n,!0)}(this,t,e)},enumerable:!0})};iP?bN&&(c=t((function(e,t,i,n){return AN(e,u),WN(LN(t)?pP(t)?void 0!==n?new s(t,NN(i,r),n):void 0!==i?new s(t,NN(i,r)):new s(t):cP(t)?lP(c,t):gN(jN,c,t):new s(kN(t)),e,c)})),FN&&FN(c,oP),GN(BN(s),(function(e){e in c||CN(c,e,s[e])})),c.prototype=u):(c=t((function(e,t,i,n){AN(e,u);var o,a,s,d=0,h=0;if(LN(t)){if(!pP(t))return cP(t)?lP(c,t):gN(jN,c,t);o=t,h=NN(i,r);var p=t.byteLength;if(void 0===n){if(p%r)throw ZN(dP);if((a=p-h)<0)throw ZN(dP)}else if((a=wN(n)*r)+h>p)throw ZN(dP);s=a/r}else s=kN(t),o=new $N(a=s*r);for(qN(e,{buffer:o,byteOffset:h,byteLength:a,length:s,view:new tP(o)});d<s;)l(e,d++)})),FN&&FN(c,oP),u=c.prototype=xN(aP)),u.constructor!==c&&CN(u,"constructor",c),CN(u,rP,c),nP&&CN(u,nP,n),d[n]=c,yN({global:!0,forced:c!=s,sham:!iP},d),uP in c||CN(c,uP,r),uP in u||CN(u,uP,r),HN(n)}):_k.exports=function(){},(0,_k.exports)("Uint8",(function(e){return function(t,i,r){return e(this,t,i,r)}}));var mP=Le,yP=$i,SP=nr,gP=Math.min,EP=[].copyWithin||function(e,t){var i=mP(this),r=SP(i),n=yP(e,r),o=yP(t,r),a=arguments.length>2?arguments[2]:void 0,s=gP((void 0===a?r:yP(a,r))-o,r-n),c=1;for(o<n&&n<o+s&&(c=-1,o+=s-1,n+=s-1);s-- >0;)o in i?i[n]=i[o]:delete i[n],n+=c,o+=c;return i},bP=Xk,IP=A(EP),TP=bP.aTypedArray;(0,bP.exportTypedArrayMethod)("copyWithin",(function(e,t){return IP(TP(this),e,t,arguments.length>2?arguments[2]:void 0)}));var AP=Ia.every,RP=Xk.aTypedArray;(0,Xk.exportTypedArrayMethod)("every",(function(e){return AP(RP(this),e,arguments.length>1?arguments[1]:void 0)}));var CP=h,OP=JO,wP=Xk.aTypedArray;(0,Xk.exportTypedArrayMethod)("fill",(function(e){var t=arguments.length;return CP(OP,wP(this),e,t>1?arguments[1]:void 0,t>2?arguments[2]:void 0)}));var kP=nr,NP=du,PP=Xk.TYPED_ARRAY_CONSTRUCTOR,DP=Xk.aTypedArrayConstructor,MP=function(e){return DP(NP(e,e[PP]))},LP=function(e,t){for(var i=0,r=kP(t),n=new e(r);r>i;)n[i]=t[i++];return n},UP=MP,xP=Ia.filter,VP=function(e,t){return LP(UP(e),t)},FP=Xk.aTypedArray;(0,Xk.exportTypedArrayMethod)("filter",(function(e){var t=xP(FP(this),e,arguments.length>1?arguments[1]:void 0);return VP(this,t)}));var BP=Ia.find,jP=Xk.aTypedArray;(0,Xk.exportTypedArrayMethod)("find",(function(e){return BP(jP(this),e,arguments.length>1?arguments[1]:void 0)}));var GP=Ia.findIndex,HP=Xk.aTypedArray;(0,Xk.exportTypedArrayMethod)("findIndex",(function(e){return GP(HP(this),e,arguments.length>1?arguments[1]:void 0)}));var zP=Ia.forEach,KP=Xk.aTypedArray;(0,Xk.exportTypedArrayMethod)("forEach",(function(e){zP(KP(this),e,arguments.length>1?arguments[1]:void 0)}));var WP=ur.includes,XP=Xk.aTypedArray;(0,Xk.exportTypedArrayMethod)("includes",(function(e){return WP(XP(this),e,arguments.length>1?arguments[1]:void 0)}));var qP=ur.indexOf,YP=Xk.aTypedArray;(0,Xk.exportTypedArrayMethod)("indexOf",(function(e){return qP(YP(this),e,arguments.length>1?arguments[1]:void 0)}));var JP=o,QP=s,ZP=A,$P=Xk,eD=dp,tD=et("iterator"),iD=JP.Uint8Array,rD=ZP(eD.values),nD=ZP(eD.keys),oD=ZP(eD.entries),aD=$P.aTypedArray,sD=$P.exportTypedArrayMethod,cD=iD&&iD.prototype,uD=!QP((function(){cD[tD].call([1])})),dD=!!cD&&cD.values&&cD[tD]===cD.values&&"values"===cD.values.name,lD=function(){return rD(aD(this))};sD("entries",(function(){return oD(aD(this))}),uD),sD("keys",(function(){return nD(aD(this))}),uD),sD("values",lD,uD||!dD,{name:"values"}),sD(tD,lD,uD||!dD,{name:"values"});var hD=Xk.aTypedArray,pD=Xk.exportTypedArrayMethod,_D=A([].join);pD("join",(function(e){return _D(hD(this),e)}));var fD=$n,vD=B,mD=Yi,yD=nr,SD=Gn,gD=Math.min,ED=[].lastIndexOf,bD=!!ED&&1/[1].lastIndexOf(1,-0)<0,ID=SD("lastIndexOf"),TD=bD||!ID?function(e){if(bD)return fD(ED,this,arguments)||0;var t=vD(this),i=yD(t),r=i-1;for(arguments.length>1&&(r=gD(r,mD(arguments[1]))),r<0&&(r=i+r);r>=0;r--)if(r in t&&t[r]===e)return r||0;return-1}:ED,AD=$n,RD=TD,CD=Xk.aTypedArray;(0,Xk.exportTypedArrayMethod)("lastIndexOf",(function(e){var t=arguments.length;return AD(RD,CD(this),t>1?[e,arguments[1]]:[e])}));var OD=Ia.map,wD=MP,kD=Xk.aTypedArray;(0,Xk.exportTypedArrayMethod)("map",(function(e){return OD(kD(this),e,arguments.length>1?arguments[1]:void 0,(function(e,t){return new(wD(e))(t)}))}));var ND=zy.left,PD=Xk.aTypedArray;(0,Xk.exportTypedArrayMethod)("reduce",(function(e){var t=arguments.length;return ND(PD(this),e,t,t>1?arguments[1]:void 0)}));var DD=zy.right,MD=Xk.aTypedArray;(0,Xk.exportTypedArrayMethod)("reduceRight",(function(e){var t=arguments.length;return DD(MD(this),e,t,t>1?arguments[1]:void 0)}));var LD=Xk.aTypedArray,UD=Xk.exportTypedArrayMethod,xD=Math.floor;UD("reverse",(function(){for(var e,t=this,i=LD(t).length,r=xD(i/2),n=0;n<r;)e=t[n],t[n++]=t[--i],t[i]=e;return t}));var VD=o,FD=h,BD=Xk,jD=nr,GD=cN,HD=Le,zD=s,KD=VD.RangeError,WD=VD.Int8Array,XD=WD&&WD.prototype,qD=XD&&XD.set,YD=BD.aTypedArray,JD=BD.exportTypedArrayMethod,QD=!zD((function(){var e=new Uint8ClampedArray(2);return FD(qD,e,{length:1,0:3},1),3!==e[1]})),ZD=QD&&BD.NATIVE_ARRAY_BUFFER_VIEWS&&zD((function(){var e=new WD(2);return e.set(1),e.set("2",1),0!==e[0]||2!==e[1]}));JD("set",(function(e){YD(this);var t=GD(arguments.length>1?arguments[1]:void 0,1),i=HD(e);if(QD)return FD(qD,this,i,t);var r=this.length,n=jD(i),o=0;if(n+t>r)throw KD("Wrong length");for(;o<n;)this[t+o]=i[o++]}),!QD||ZD);var $D=MP,eM=Po,tM=Xk.aTypedArray;(0,Xk.exportTypedArrayMethod)("slice",(function(e,t){for(var i=eM(tM(this),e,t),r=$D(this),n=0,o=i.length,a=new r(o);o>n;)a[n]=i[n++];return a}),s((function(){new Int8Array(1).slice()})));var iM=Ia.some,rM=Xk.aTypedArray;(0,Xk.exportTypedArrayMethod)("some",(function(e){return iM(rM(this),e,arguments.length>1?arguments[1]:void 0)}));var nM=Y.match(/firefox\/(\d+)/i),oM=!!nM&&+nM[1],aM=/MSIE|Trident/.test(Y),sM=Y.match(/AppleWebKit\/(\d+)\./),cM=!!sM&&+sM[1],uM=o,dM=A,lM=s,hM=ye,pM=yA,_M=Xk,fM=oM,vM=aM,mM=ie,yM=cM,SM=uM.Array,gM=_M.aTypedArray,EM=_M.exportTypedArrayMethod,bM=uM.Uint16Array,IM=bM&&dM(bM.prototype.sort),TM=!(!IM||lM((function(){IM(new bM(2),null)}))&&lM((function(){IM(new bM(2),{})}))),AM=!!IM&&!lM((function(){if(mM)return mM<74;if(fM)return fM<67;if(vM)return!0;if(yM)return yM<602;var e,t,i=new bM(516),r=SM(516);for(e=0;e<516;e++)t=e%4,i[e]=515-e,r[e]=e-2*t+3;for(IM(i,(function(e,t){return(e/4|0)-(t/4|0)})),e=0;e<516;e++)if(i[e]!==r[e])return!0}));EM("sort",(function(e){return void 0!==e&&hM(e),AM?IM(this,e):pM(gM(this),function(e){return function(t,i){return void 0!==e?+e(t,i)||0:i!=i?-1:t!=t?1:0===t&&0===i?1/t>0&&1/i<0?1:-1:t>i}}(e))}),!AM||TM);var RM=ir,CM=$i,OM=MP,wM=Xk.aTypedArray;(0,Xk.exportTypedArrayMethod)("subarray",(function(e,t){var i=wM(this),r=i.length,n=CM(e,r);return new(OM(i))(i.buffer,i.byteOffset+n*i.BYTES_PER_ELEMENT,RM((void 0===t?r:CM(t,r))-n))}));var kM=$n,NM=Xk,PM=s,DM=Po,MM=o.Int8Array,LM=NM.aTypedArray,UM=NM.exportTypedArrayMethod,xM=[].toLocaleString,VM=!!MM&&PM((function(){xM.call(new MM(1))}));UM("toLocaleString",(function(){return kM(xM,VM?DM(LM(this)):LM(this),DM(arguments))}),PM((function(){return[1,2].toLocaleString()!=new MM([1,2]).toLocaleString()}))||!PM((function(){MM.prototype.toLocaleString.call([1,2])})));var FM=Xk.exportTypedArrayMethod,BM=s,jM=A,GM=o.Uint8Array,HM=GM&&GM.prototype||{},zM=[].toString,KM=jM([].join);BM((function(){zM.call({})}))&&(zM=function(){return KM(this)});var WM=HM.toString!=zM;FM("toString",zM,WM),Xr({target:"Array",stat:!0},{isArray:to});var XM=c,qM=A,YM=an,JM=B,QM=qM(p.f),ZM=qM([].push),$M=function(e){return function(t){for(var i,r=JM(t),n=YM(r),o=n.length,a=0,s=[];o>a;)i=n[a++],XM&&!QM(r,i)||ZM(s,e?[i,r[i]]:r[i]);return s}},eL={entries:$M(!0),values:$M(!1)}.entries;Xr({target:"Object",stat:!0},{entries:function(e){return eL(e)}});var tL=Yi,iL=fo,rL=x,nL=o.RangeError,oL=function(e){var t=iL(rL(this)),i="",r=tL(e);if(r<0||r==1/0)throw nL("Wrong number of repetitions");for(;r>0;(r>>>=1)&&(t+=t))1&r&&(i+=t);return i},aL=A,sL=ir,cL=fo,uL=x,dL=aL(oL),lL=aL("".slice),hL=Math.ceil,pL=function(e){return function(t,i,r){var n,o,a=cL(uL(t)),s=sL(i),c=a.length,u=void 0===r?" ":cL(r);return s<=c||""==u?a:((o=dL(u,hL((n=s-c)/u.length))).length>n&&(o=lL(o,0,n)),e?a+o:o+a)}},_L={start:pL(!1),end:pL(!0)},fL=/Version\/10(?:\.\d+){1,2}(?: [\w./]+)?(?: Mobile\/\w+)? Safari\//.test(Y),vL=_L.end;Xr({target:"String",proto:!0,forced:fL},{padEnd:function(e){return vL(this,e,arguments.length>1?arguments[1]:void 0)}});var mL=Dm;Xr({target:"Number",stat:!0,forced:Number.parseInt!=mL},{parseInt:mL});var yL=uc,SL="ArrayBuffer",gL=Qw.ArrayBuffer;Xr({global:!0,forced:o.ArrayBuffer!==gL},{ArrayBuffer:gL}),yL(SL);Xr({target:"ArrayBuffer",stat:!0,forced:!Xk.NATIVE_ARRAY_BUFFER_VIEWS},{isView:Xk.isView}),Xr({global:!0,forced:!LO},{DataView:Qw.DataView});var EL=Xr,bL=o,IL=A,TL=Yi,AL=zb,RL=oL,CL=s,OL=bL.RangeError,wL=bL.String,kL=Math.floor,NL=IL(RL),PL=IL("".slice),DL=IL(1..toFixed),ML=function(e,t,i){return 0===t?i:t%2==1?ML(e,t-1,i*e):ML(e*e,t/2,i)},LL=function(e,t,i){for(var r=-1,n=i;++r<6;)n+=t*e[r],e[r]=n%1e7,n=kL(n/1e7)},UL=function(e,t){for(var i=6,r=0;--i>=0;)r+=e[i],e[i]=kL(r/t),r=r%t*1e7},xL=function(e){for(var t=6,i="";--t>=0;)if(""!==i||0===t||0!==e[t]){var r=wL(e[t]);i=""===i?r:i+NL("0",7-r.length)+r}return i};EL({target:"Number",proto:!0,forced:CL((function(){return"0.000"!==DL(8e-5,3)||"1"!==DL(.9,0)||"1.25"!==DL(1.255,2)||"1000000000000000128"!==DL(0xde0b6b3a7640080,0)}))||!CL((function(){DL({})}))},{toFixed:function(e){var t,i,r,n,o=AL(this),a=TL(e),s=[0,0,0,0,0,0],c="",u="0";if(a<0||a>20)throw OL("Incorrect fraction digits");if(o!=o)return"NaN";if(o<=-1e21||o>=1e21)return wL(o);if(o<0&&(c="-",o=-o),o>1e-21)if(i=(t=function(e){for(var t=0,i=e;i>=4096;)t+=12,i/=4096;for(;i>=2;)t+=1,i/=2;return t}(o*ML(2,69,1))-69)<0?o*ML(2,-t,1):o/ML(2,t,1),i*=4503599627370496,(t=52-t)>0){for(LL(s,0,i),r=a;r>=7;)LL(s,1e7,0),r-=7;for(LL(s,ML(10,r,1),0),r=t-1;r>=23;)UL(s,1<<23),r-=23;UL(s,1<<r),LL(s,1,1),UL(s,2),u=xL(s)}else LL(s,0,i),LL(s,1<<-t,0),u=xL(s)+NL("0",a);return u=a>0?c+((n=u.length)<=a?"0."+NL("0",a-n)+u:PL(u,0,n-a)+"."+PL(u,n-a)):c+u}});var VL=Math.log,FL=Math.LOG10E;Xr({target:"Math",stat:!0},{log10:Math.log10||function(e){return VL(e)*FL}});var BL=Xr,jL=A,GL=a.f,HL=ir,zL=fo,KL=Pf,WL=x,XL=Mf,qL=jL("".startsWith),YL=jL("".slice),JL=Math.min,QL=XL("startsWith"),ZL=!QL&&!!function(){var e=GL(String.prototype,"startsWith");return e&&!e.writable}();BL({target:"String",proto:!0,forced:!ZL&&!QL},{startsWith:function(e){var t=zL(WL(this));KL(e);var i=HL(JL(arguments.length>1?arguments[1]:void 0,t.length)),r=zL(e);return qL?qL(t,r,i):YL(t,i,i+r.length)===r}});var $L,eU=["click","contextmenu","mousedown","mouseup","pointerup","touchend","keydown","keyup"],tU=function(){function e(){var e=this;this._contextStuckAt=0,this._haslistener=!1,this._hasIOSListener=!1;var t=0;setInterval((function(){if(e._audioContextInstance){var i=e._audioContextInstance.currentTime;e._contextStuckAt?e._contextStuckAt!==i&&(e._contextStuckAt=0):t===i&&(e._contextStuckAt=i),t=i}}),5e3)}return e.prototype.resume=function(){var e,t,i=this;"running"!==(null===(e=this._audioContextInstance)||void 0===e?void 0:e.state)&&(null===(t=this._audioContextInstance)||void 0===t||t.resume().then((function(){var e;"running"!==(null===(e=i._audioContextInstance)||void 0===e?void 0:e.state)&&i.addInteractionListener()})).catch((function(){i.addInteractionListener()})))},e.prototype.getAudioContextInstance=function(){var e=this;if(!this._audioContextInstance){var t=window.AudioContext||window.webkitAudioContext;this._audioContextInstance=new t,this._audioContextInstance.onstatechange=function(){var t,i,r;"suspended"!==(null===(t=e._audioContextInstance)||void 0===t?void 0:t.state)&&"interrupted"!==(null===(i=e._audioContextInstance)||void 0===i?void 0:i.state)||(null===(r=e._audioContextInstance)||void 0===r||r.resume(),e.addInteractionListener())},this.addInteractionListener()}return this._audioContextInstance},e.prototype.addInteractionListener=function(){var e=this;this._haslistener||(this._resumeContext||(this._resumeContext=function(){var t,i;"running"===(null===(t=e._audioContextInstance)||void 0===t?void 0:t.state)?(eU.forEach((function(t){window.removeEventListener(t,e._resumeContext)})),e._haslistener=!1):null===(i=e._audioContextInstance)||void 0===i||i.resume()}),eU.forEach((function(t){window.addEventListener(t,e._resumeContext)})),this._haslistener=!0),AU&&!this._hasIOSListener&&(this._playSoundInIOS||(this._playSoundInIOS=function(){window.removeEventListener("touchend",e._playSoundInIOS),e._hasIOSListener=!1;var t=e._audioContextInstance;if(t){var i=t.createBuffer(1,1,44100),r=t.createBufferSource();r.buffer=i,r.connect(t.destination),r.start(0),r.disconnect()}}),window.addEventListener("touchend",this._playSoundInIOS),this._hasIOSListener=!0)},e}(),iU=function(){function e(e){this._buffer=[];var t=rU.getAudioContextInstance();if(e instanceof MediaStreamTrack){var i=new MediaStream;i.addTrack(e),this._stream=i,this._audioSource=t.createMediaStreamSource(i)}else this._audioSource=t.createMediaElementSource(e),this._audioSource.connect(t.destination);var r=t.createAnalyser();this._audioSource.connect(r),this._analyserNode=r,this._ctx=t}return e.prototype.getAudioLevel=function(){var e;"suspended"===(null===(e=this._ctx)||void 0===e?void 0:e.state)&&this._ctx.resume();var t=new Uint8Array(2048);this._analyserNode.getByteTimeDomainData(t);var i=0;return t.forEach((function(e){return i=Math.max(i,Math.abs(e-128))})),i/128*255},e.prototype.checkHasInput=function(){var e=new Uint8Array(2048);this._analyserNode.getByteTimeDomainData(e);var t=!1;return e.forEach((function(e){0!==e&&(t=!0)})),t},e.prototype.reset=function(){if(this._stream){this._audioSource.disconnect(),this._analyserNode.disconnect();var e=rU.getAudioContextInstance(),t=e.createAnalyser();this._audioSource=e.createMediaStreamSource(this._stream),this._audioSource.connect(t),this._analyserNode=t,this._ctx=e}},e.prototype.destroy=function(){this._audioSource.disconnect(),this._analyserNode.disconnect(),delete this._stream},e}(),rU=new tU,nU=new Uint8Array(16);function oU(){if(!$L&&!($L="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 $L(nU)}var aU=/^(?:[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 sU(e){return"string"==typeof e&&aU.test(e)}for(var cU,uU=[],dU=0;dU<256;++dU)uU.push((dU+256).toString(16).substr(1));function lU(e,t,i){var r=(e=e||{}).random||(e.rng||oU)();if(r[6]=15&r[6]|64,r[8]=63&r[8]|128,t){i=i||0;for(var n=0;n<16;++n)t[i+n]=r[n];return t}return function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=(uU[e[t+0]]+uU[e[t+1]]+uU[e[t+2]]+uU[e[t+3]]+"-"+uU[e[t+4]]+uU[e[t+5]]+"-"+uU[e[t+6]]+uU[e[t+7]]+"-"+uU[e[t+8]]+uU[e[t+9]]+"-"+uU[e[t+10]]+uU[e[t+11]]+uU[e[t+12]]+uU[e[t+13]]+uU[e[t+14]]+uU[e[t+15]]).toLowerCase();if(!sU(i))throw TypeError("Stringified UUID is invalid");return i}(r)}var hU=new TextDecoder,pU=new TextEncoder,_U=function(){return lU()},fU=function(){return Date.now()};function vU(e){for(var t,i,r,n,o=[],a=1;a<arguments.length;a++)o[a-1]=arguments[a];var s=0;try{for(var c=nf(o),u=c.next();!u.done;u=c.next()){s+=(_=u.value).length}}catch(e){t={error:e}}finally{try{u&&!u.done&&(i=c.return)&&i.call(c)}finally{if(t)throw t.error}}var d=new e(s),l=0;try{for(var h=nf(o),p=h.next();!p.done;p=h.next()){var _=p.value;d.set(_,l),l+=_.length}}catch(e){r={error:e}}finally{try{p&&!p.done&&(n=h.return)&&n.call(h)}finally{if(r)throw r.error}}return d}var mU=function(){return"undefined"==typeof window},yU=function(){function e(){}return e.token2auth=function(t,i,r,n){return n?"Bearer ".concat(n):"Basic ".concat(e.createUnsafeToken(t,i,r))},e.createUnsafeToken=function(e,t,i){return window.btoa([e,t,i].filter((function(e){return null!==e})).join(":"))},e.merge=function(i,r){var n,o;void 0===i&&(i={}),void 0===r&&(r={});try{for(var a=nf(Object.entries(i)),s=a.next();!s.done;s=a.next()){var c=of(s.value,2),u=c[0],d=c[1];null!==d&&"object"===t(d)?e.merge(i[u],r[u]):void 0!==r[u]&&(i[u]=r[u])}}catch(e){n={error:e}}finally{try{s&&!s.done&&(o=a.return)&&o.call(a)}finally{if(n)throw n.error}}},e.ab2str=function(e){return hU.decode(e)},e.ab2obj=function(t){try{var i=e.ab2str(t);return JSON.parse(i)}catch(e){return{}}},e.str2ab=function(e){return pU.encode(e).buffer},e.ab2b64str=function(e){return tf(this,void 0,void 0,(function(){return rf(this,(function(t){switch(t.label){case 0:return[4,new Promise((function(t){var i=new FileReader;i.onload=function(){return t(i.result)},i.readAsDataURL(new Blob([e]))}))];case 1:return[2,t.sent().split(",",2)[1]]}}))}))},e.b64str2ab=function(e){return tf(this,void 0,void 0,(function(){return rf(this,(function(t){return[2,fetch("data:application/octet;base64,"+e).then((function(e){return e.arrayBuffer()}))]}))}))},e}();function SU(){var e="none";return mU()||(null!==window.navigator.userAgent.match("Firefox")?e="mozilla":null!==window.navigator.userAgent.match("Chrome")?(e="chrome-stable",null!==window.navigator.userAgent.match("Electron")&&(e="electron")):(null!==window.navigator.userAgent.match("Safari")||null!==window.navigator.userAgent.match("AppleWebKit"))&&(e="safari")),e}var gU="mozilla"===SU(),EU="safari"===SU(),bU=0,IU=null===(cU=navigator.userAgent.match(/version\/(\d+)/i))||void 0===cU?void 0:cU[1];EU&&IU&&(bU=+IU);var TU=bU,AU=!mU()&&!!/(iPhone|iPad|iPod)/i.exec(navigator.userAgent);!mU()&&/(iPhone|iPod)/i.exec(navigator.userAgent),!mU()&&(/(iPad)/i.exec(navigator.userAgent)||/Macintosh/i.test(navigator.userAgent)&&document);var RU=!mU()&&/MicroMessenger/i.test(navigator.userAgent),CU=!mU()&&/Android/i.test(navigator.userAgent),OU=!mU()&&navigator.userAgent.toLowerCase().includes("mobile"),wU=!mU()&&/chrome\/(86)|(87)|(88)|(89)|(90)|(91)|(92)/i.test(navigator.userAgent),kU=!mU()&&/DingTalk/i.test(navigator.userAgent);function NU(){for(var e=(+"".concat(Math.random()).slice(-7).padEnd(7,"0")).toString(2).padEnd(28,"1").split(""),t=[];e.length;)t.push(e.splice(0,7));return t.map((function(e,i){var r=i===t.length-1?"0":"1";return Number.parseInt(r+e.join(""),2)}))}var PU=function(){return Math.floor(65535*Math.random())};function DU(e){return"string"==typeof e&&e.indexOf("__web__rtc__rtt__")>-1}function MU(e){return e.map((function e(t){if(t instanceof HTMLElement)return t.toString();if(t instanceof ArrayBuffer||ArrayBuffer.isView(t)){var i=ArrayBuffer.isView(t)?t.buffer:t,r=i.byteLength,n=[];if(r>10){var o=new DataView(i),a=Array.from({length:5}).map((function(e,t){return o.getUint8(t)})),s=Array.from({length:5}).map((function(e,t){return r-1-t})).reverse().map((function(e){return o.getUint8(e)}));n=af(af(af([],of(a),!1),["..."],!1),of(s),!1)}else n=Array.from(new Uint8Array(i));return"".concat(t.constructor.name,"(").concat(r,") [").concat(n.join(", "),"]")}if(Array.isArray(t))return t.map(e);if("[object Object]"===Object.prototype.toString.call(t)){var c={};for(var u in t)c[u]=e(t[u]);return c}return t}))}var LU=function(e){return void 0===e&&(e=!1),tf(void 0,void 0,void 0,(function(){var t,i;return rf(this,(function(r){switch(r.label){case 0:return r.trys.push([0,2,,3]),(t=new RTCPeerConnection({iceServers:[],iceTransportPolicy:"all",bundlePolicy:"max-bundle",rtcpMuxPolicy:"require",sdpSemantics:"unified-plan"})).createDataChannel("default"),t.addTransceiver("audio",{direction:"recvonly"}),t.addTransceiver("video",{direction:"recvonly"}),e&&(t.addTransceiver("audio",{direction:"sendonly"}),t.addTransceiver("video",{direction:"sendonly"})),[4,t.createOffer()];case 1:return i=r.sent(),t.close(),[2,i.sdp];case 2:return r.sent(),[3,3];case 3:return[2]}}))}))},UU=function(e){return new Promise((function(t,i){var r=(e=Array.isArray(e)?e:[]).length,n=[];0===r?i([]):e.forEach((function(e){e.then((function(e){t(e)}),(function(e){r--,n.push(e),0===r&&i(n)}))}))}))};function xU(e){return+Math.max(-127,10*Math.log10(Math.pow(e/255,2))).toFixed(2)}function VU(e){return(e&V_.AUDIO)===V_.AUDIO}function FU(e){return(e&V_.VIDEO)===V_.VIDEO}function BU(e){var i={};return Object.keys(e).forEach((function(r){"object"===t(e[r])?i[r]=BU(e[r]):r.startsWith("_")||(i[r]=e[r])})),i}function jU(e){return null==e?"undefined | null":"string"==typeof e?e:JSON.stringify({contentHint:e.contentHint,enabled:e.enabled,id:e.id,kind:e.kind,label:e.label,muted:e.muted,readyState:e.readyState})}function GU(e){return"number"==typeof e?e:"number"==typeof(null==e?void 0:e.exact)?e.exact:"number"==typeof(null==e?void 0:e.ideal)?e.ideal:"number"==typeof(null==e?void 0:e.max)?e.max:"number"==typeof(null==e?void 0:e.min)?e.min:1}var HU=function(){if("chrome-stable"===SU()){var e=window.navigator.userAgent.match(/Chrome\/([\d.]+)/);if(e&&e.length>1)if(Number(e[1].split(".")[0])<117)return!0}return!1}();(0,_k.exports)("Uint16",(function(e){return function(t,i,r){return e(this,t,i,r)}})),(0,_k.exports)("Int32",(function(e){return function(t,i,r){return e(this,t,i,r)}}));var zU={};!function(e){var i="undefined"!=typeof Uint8Array&&"undefined"!=typeof Uint16Array&&"undefined"!=typeof Int32Array;function r(e,t){return Object.prototype.hasOwnProperty.call(e,t)}e.assign=function(e){for(var i=Array.prototype.slice.call(arguments,1);i.length;){var n=i.shift();if(n){if("object"!==t(n))throw new TypeError(n+"must be non-object");for(var o in n)r(n,o)&&(e[o]=n[o])}}return e},e.shrinkBuf=function(e,t){return e.length===t?e:e.subarray?e.subarray(0,t):(e.length=t,e)};var n={arraySet:function(e,t,i,r,n){if(t.subarray&&e.subarray)e.set(t.subarray(i,i+r),n);else for(var o=0;o<r;o++)e[n+o]=t[i+o]},flattenChunks:function(e){var t,i,r,n,o,a;for(r=0,t=0,i=e.length;t<i;t++)r+=e[t].length;for(a=new Uint8Array(r),n=0,t=0,i=e.length;t<i;t++)o=e[t],a.set(o,n),n+=o.length;return a}},o={arraySet:function(e,t,i,r,n){for(var o=0;o<r;o++)e[n+o]=t[i+o]},flattenChunks:function(e){return[].concat.apply([],e)}};e.setTyped=function(t){t?(e.Buf8=Uint8Array,e.Buf16=Uint16Array,e.Buf32=Int32Array,e.assign(e,n)):(e.Buf8=Array,e.Buf16=Array,e.Buf32=Array,e.assign(e,o))},e.setTyped(i)}(zU);var KU={},WU={},XU={},qU=zU;function YU(e){for(var t=e.length;--t>=0;)e[t]=0}var JU=256,QU=286,ZU=30,$U=15,ex=[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],tx=[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],ix=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],rx=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],nx=new Array(576);YU(nx);var ox=new Array(60);YU(ox);var ax=new Array(512);YU(ax);var sx=new Array(256);YU(sx);var cx=new Array(29);YU(cx);var ux,dx,lx,hx=new Array(ZU);function px(e,t,i,r,n){this.static_tree=e,this.extra_bits=t,this.extra_base=i,this.elems=r,this.max_length=n,this.has_stree=e&&e.length}function _x(e,t){this.dyn_tree=e,this.max_code=0,this.stat_desc=t}function fx(e){return e<256?ax[e]:ax[256+(e>>>7)]}function vx(e,t){e.pending_buf[e.pending++]=255&t,e.pending_buf[e.pending++]=t>>>8&255}function mx(e,t,i){e.bi_valid>16-i?(e.bi_buf|=t<<e.bi_valid&65535,vx(e,e.bi_buf),e.bi_buf=t>>16-e.bi_valid,e.bi_valid+=i-16):(e.bi_buf|=t<<e.bi_valid&65535,e.bi_valid+=i)}function yx(e,t,i){mx(e,i[2*t],i[2*t+1])}function Sx(e,t){var i=0;do{i|=1&e,e>>>=1,i<<=1}while(--t>0);return i>>>1}function gx(e,t,i){var r,n,o=new Array(16),a=0;for(r=1;r<=$U;r++)o[r]=a=a+i[r-1]<<1;for(n=0;n<=t;n++){var s=e[2*n+1];0!==s&&(e[2*n]=Sx(o[s]++,s))}}function Ex(e){var t;for(t=0;t<QU;t++)e.dyn_ltree[2*t]=0;for(t=0;t<ZU;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 bx(e){e.bi_valid>8?vx(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 Ix(e,t,i,r){var n=2*t,o=2*i;return e[n]<e[o]||e[n]===e[o]&&r[t]<=r[i]}function Tx(e,t,i){for(var r=e.heap[i],n=i<<1;n<=e.heap_len&&(n<e.heap_len&&Ix(t,e.heap[n+1],e.heap[n],e.depth)&&n++,!Ix(t,r,e.heap[n],e.depth));)e.heap[i]=e.heap[n],i=n,n<<=1;e.heap[i]=r}function Ax(e,t,i){var r,n,o,a,s=0;if(0!==e.last_lit)do{r=e.pending_buf[e.d_buf+2*s]<<8|e.pending_buf[e.d_buf+2*s+1],n=e.pending_buf[e.l_buf+s],s++,0===r?yx(e,n,t):(yx(e,(o=sx[n])+JU+1,t),0!==(a=ex[o])&&mx(e,n-=cx[o],a),yx(e,o=fx(--r),i),0!==(a=tx[o])&&mx(e,r-=hx[o],a))}while(s<e.last_lit);yx(e,256,t)}function Rx(e,t){var i,r,n,o=t.dyn_tree,a=t.stat_desc.static_tree,s=t.stat_desc.has_stree,c=t.stat_desc.elems,u=-1;for(e.heap_len=0,e.heap_max=573,i=0;i<c;i++)0!==o[2*i]?(e.heap[++e.heap_len]=u=i,e.depth[i]=0):o[2*i+1]=0;for(;e.heap_len<2;)o[2*(n=e.heap[++e.heap_len]=u<2?++u:0)]=1,e.depth[n]=0,e.opt_len--,s&&(e.static_len-=a[2*n+1]);for(t.max_code=u,i=e.heap_len>>1;i>=1;i--)Tx(e,o,i);n=c;do{i=e.heap[1],e.heap[1]=e.heap[e.heap_len--],Tx(e,o,1),r=e.heap[1],e.heap[--e.heap_max]=i,e.heap[--e.heap_max]=r,o[2*n]=o[2*i]+o[2*r],e.depth[n]=(e.depth[i]>=e.depth[r]?e.depth[i]:e.depth[r])+1,o[2*i+1]=o[2*r+1]=n,e.heap[1]=n++,Tx(e,o,1)}while(e.heap_len>=2);e.heap[--e.heap_max]=e.heap[1],function(e,t){var i,r,n,o,a,s,c=t.dyn_tree,u=t.max_code,d=t.stat_desc.static_tree,l=t.stat_desc.has_stree,h=t.stat_desc.extra_bits,p=t.stat_desc.extra_base,_=t.stat_desc.max_length,f=0;for(o=0;o<=$U;o++)e.bl_count[o]=0;for(c[2*e.heap[e.heap_max]+1]=0,i=e.heap_max+1;i<573;i++)(o=c[2*c[2*(r=e.heap[i])+1]+1]+1)>_&&(o=_,f++),c[2*r+1]=o,r>u||(e.bl_count[o]++,a=0,r>=p&&(a=h[r-p]),s=c[2*r],e.opt_len+=s*(o+a),l&&(e.static_len+=s*(d[2*r+1]+a)));if(0!==f){do{for(o=_-1;0===e.bl_count[o];)o--;e.bl_count[o]--,e.bl_count[o+1]+=2,e.bl_count[_]--,f-=2}while(f>0);for(o=_;0!==o;o--)for(r=e.bl_count[o];0!==r;)(n=e.heap[--i])>u||(c[2*n+1]!==o&&(e.opt_len+=(o-c[2*n+1])*c[2*n],c[2*n+1]=o),r--)}}(e,t),gx(o,u,e.bl_count)}function Cx(e,t,i){var r,n,o=-1,a=t[1],s=0,c=7,u=4;for(0===a&&(c=138,u=3),t[2*(i+1)+1]=65535,r=0;r<=i;r++)n=a,a=t[2*(r+1)+1],++s<c&&n===a||(s<u?e.bl_tree[2*n]+=s:0!==n?(n!==o&&e.bl_tree[2*n]++,e.bl_tree[32]++):s<=10?e.bl_tree[34]++:e.bl_tree[36]++,s=0,o=n,0===a?(c=138,u=3):n===a?(c=6,u=3):(c=7,u=4))}function Ox(e,t,i){var r,n,o=-1,a=t[1],s=0,c=7,u=4;for(0===a&&(c=138,u=3),r=0;r<=i;r++)if(n=a,a=t[2*(r+1)+1],!(++s<c&&n===a)){if(s<u)do{yx(e,n,e.bl_tree)}while(0!=--s);else 0!==n?(n!==o&&(yx(e,n,e.bl_tree),s--),yx(e,16,e.bl_tree),mx(e,s-3,2)):s<=10?(yx(e,17,e.bl_tree),mx(e,s-3,3)):(yx(e,18,e.bl_tree),mx(e,s-11,7));s=0,o=n,0===a?(c=138,u=3):n===a?(c=6,u=3):(c=7,u=4)}}YU(hx);var wx=!1;function kx(e,t,i,r){mx(e,0+(r?1:0),3),function(e,t,i,r){bx(e),r&&(vx(e,i),vx(e,~i)),qU.arraySet(e.pending_buf,e.window,t,i,e.pending),e.pending+=i}(e,t,i,!0)}XU._tr_init=function(e){wx||(!function(){var e,t,i,r,n,o=new Array(16);for(i=0,r=0;r<28;r++)for(cx[r]=i,e=0;e<1<<ex[r];e++)sx[i++]=r;for(sx[i-1]=r,n=0,r=0;r<16;r++)for(hx[r]=n,e=0;e<1<<tx[r];e++)ax[n++]=r;for(n>>=7;r<ZU;r++)for(hx[r]=n<<7,e=0;e<1<<tx[r]-7;e++)ax[256+n++]=r;for(t=0;t<=$U;t++)o[t]=0;for(e=0;e<=143;)nx[2*e+1]=8,e++,o[8]++;for(;e<=255;)nx[2*e+1]=9,e++,o[9]++;for(;e<=279;)nx[2*e+1]=7,e++,o[7]++;for(;e<=287;)nx[2*e+1]=8,e++,o[8]++;for(gx(nx,287,o),e=0;e<ZU;e++)ox[2*e+1]=5,ox[2*e]=Sx(e,5);ux=new px(nx,ex,257,QU,$U),dx=new px(ox,tx,0,ZU,$U),lx=new px(new Array(0),ix,0,19,7)}(),wx=!0),e.l_desc=new _x(e.dyn_ltree,ux),e.d_desc=new _x(e.dyn_dtree,dx),e.bl_desc=new _x(e.bl_tree,lx),e.bi_buf=0,e.bi_valid=0,Ex(e)},XU._tr_stored_block=kx,XU._tr_flush_block=function(e,t,i,r){var n,o,a=0;e.level>0?(2===e.strm.data_type&&(e.strm.data_type=function(e){var t,i=4093624447;for(t=0;t<=31;t++,i>>>=1)if(1&i&&0!==e.dyn_ltree[2*t])return 0;if(0!==e.dyn_ltree[18]||0!==e.dyn_ltree[20]||0!==e.dyn_ltree[26])return 1;for(t=32;t<JU;t++)if(0!==e.dyn_ltree[2*t])return 1;return 0}(e)),Rx(e,e.l_desc),Rx(e,e.d_desc),a=function(e){var t;for(Cx(e,e.dyn_ltree,e.l_desc.max_code),Cx(e,e.dyn_dtree,e.d_desc.max_code),Rx(e,e.bl_desc),t=18;t>=3&&0===e.bl_tree[2*rx[t]+1];t--);return e.opt_len+=3*(t+1)+5+5+4,t}(e),n=e.opt_len+3+7>>>3,(o=e.static_len+3+7>>>3)<=n&&(n=o)):n=o=i+5,i+4<=n&&-1!==t?kx(e,t,i,r):4===e.strategy||o===n?(mx(e,2+(r?1:0),3),Ax(e,nx,ox)):(mx(e,4+(r?1:0),3),function(e,t,i,r){var n;for(mx(e,t-257,5),mx(e,i-1,5),mx(e,r-4,4),n=0;n<r;n++)mx(e,e.bl_tree[2*rx[n]+1],3);Ox(e,e.dyn_ltree,t-1),Ox(e,e.dyn_dtree,i-1)}(e,e.l_desc.max_code+1,e.d_desc.max_code+1,a+1),Ax(e,e.dyn_ltree,e.dyn_dtree)),Ex(e),r&&bx(e)},XU._tr_tally=function(e,t,i){return e.pending_buf[e.d_buf+2*e.last_lit]=t>>>8&255,e.pending_buf[e.d_buf+2*e.last_lit+1]=255&t,e.pending_buf[e.l_buf+e.last_lit]=255&i,e.last_lit++,0===t?e.dyn_ltree[2*i]++:(e.matches++,t--,e.dyn_ltree[2*(sx[i]+JU+1)]++,e.dyn_dtree[2*fx(t)]++),e.last_lit===e.lit_bufsize-1},XU._tr_align=function(e){mx(e,2,3),yx(e,256,nx),function(e){16===e.bi_valid?(vx(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 Nx=function(e,t,i,r){for(var n=65535&e|0,o=e>>>16&65535|0,a=0;0!==i;){i-=a=i>2e3?2e3:i;do{o=o+(n=n+t[r++]|0)|0}while(--a);n%=65521,o%=65521}return n|o<<16|0};var Px=function(){for(var e,t=[],i=0;i<256;i++){e=i;for(var r=0;r<8;r++)e=1&e?3988292384^e>>>1:e>>>1;t[i]=e}return t}();var Dx,Mx=function(e,t,i,r){var n=Px,o=r+i;e^=-1;for(var a=r;a<o;a++)e=e>>>8^n[255&(e^t[a])];return-1^e},Lx={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"},Ux=zU,xx=XU,Vx=Nx,Fx=Mx,Bx=Lx,jx=-2,Gx=258,Hx=262,zx=103,Kx=113,Wx=666;function Xx(e,t){return e.msg=Bx[t],t}function qx(e){return(e<<1)-(e>4?9:0)}function Yx(e){for(var t=e.length;--t>=0;)e[t]=0}function Jx(e){var t=e.state,i=t.pending;i>e.avail_out&&(i=e.avail_out),0!==i&&(Ux.arraySet(e.output,t.pending_buf,t.pending_out,i,e.next_out),e.next_out+=i,t.pending_out+=i,e.total_out+=i,e.avail_out-=i,t.pending-=i,0===t.pending&&(t.pending_out=0))}function Qx(e,t){xx._tr_flush_block(e,e.block_start>=0?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,Jx(e.strm)}function Zx(e,t){e.pending_buf[e.pending++]=t}function $x(e,t){e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=255&t}function eV(e,t){var i,r,n=e.max_chain_length,o=e.strstart,a=e.prev_length,s=e.nice_match,c=e.strstart>e.w_size-Hx?e.strstart-(e.w_size-Hx):0,u=e.window,d=e.w_mask,l=e.prev,h=e.strstart+Gx,p=u[o+a-1],_=u[o+a];e.prev_length>=e.good_match&&(n>>=2),s>e.lookahead&&(s=e.lookahead);do{if(u[(i=t)+a]===_&&u[i+a-1]===p&&u[i]===u[o]&&u[++i]===u[o+1]){o+=2,i++;do{}while(u[++o]===u[++i]&&u[++o]===u[++i]&&u[++o]===u[++i]&&u[++o]===u[++i]&&u[++o]===u[++i]&&u[++o]===u[++i]&&u[++o]===u[++i]&&u[++o]===u[++i]&&o<h);if(r=Gx-(h-o),o=h-Gx,r>a){if(e.match_start=t,a=r,r>=s)break;p=u[o+a-1],_=u[o+a]}}}while((t=l[t&d])>c&&0!=--n);return a<=e.lookahead?a:e.lookahead}function tV(e){var t,i,r,n,o,a,s,c,u,d,l=e.w_size;do{if(n=e.window_size-e.lookahead-e.strstart,e.strstart>=l+(l-Hx)){Ux.arraySet(e.window,e.window,l,l,0),e.match_start-=l,e.strstart-=l,e.block_start-=l,t=i=e.hash_size;do{r=e.head[--t],e.head[t]=r>=l?r-l:0}while(--i);t=i=l;do{r=e.prev[--t],e.prev[t]=r>=l?r-l:0}while(--i);n+=l}if(0===e.strm.avail_in)break;if(a=e.strm,s=e.window,c=e.strstart+e.lookahead,u=n,d=void 0,(d=a.avail_in)>u&&(d=u),i=0===d?0:(a.avail_in-=d,Ux.arraySet(s,a.input,a.next_in,d,c),1===a.state.wrap?a.adler=Vx(a.adler,s,d,c):2===a.state.wrap&&(a.adler=Fx(a.adler,s,d,c)),a.next_in+=d,a.total_in+=d,d),e.lookahead+=i,e.lookahead+e.insert>=3)for(o=e.strstart-e.insert,e.ins_h=e.window[o],e.ins_h=(e.ins_h<<e.hash_shift^e.window[o+1])&e.hash_mask;e.insert&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[o+3-1])&e.hash_mask,e.prev[o&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=o,o++,e.insert--,!(e.lookahead+e.insert<3)););}while(e.lookahead<Hx&&0!==e.strm.avail_in)}function iV(e,t){for(var i,r;;){if(e.lookahead<Hx){if(tV(e),e.lookahead<Hx&&0===t)return 1;if(0===e.lookahead)break}if(i=0,e.lookahead>=3&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+3-1])&e.hash_mask,i=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),0!==i&&e.strstart-i<=e.w_size-Hx&&(e.match_length=eV(e,i)),e.match_length>=3)if(r=xx._tr_tally(e,e.strstart-e.match_start,e.match_length-3),e.lookahead-=e.match_length,e.match_length<=e.max_lazy_match&&e.lookahead>=3){e.match_length--;do{e.strstart++,e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+3-1])&e.hash_mask,i=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart}while(0!=--e.match_length);e.strstart++}else e.strstart+=e.match_length,e.match_length=0,e.ins_h=e.window[e.strstart],e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+1])&e.hash_mask;else r=xx._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++;if(r&&(Qx(e,!1),0===e.strm.avail_out))return 1}return e.insert=e.strstart<2?e.strstart:2,4===t?(Qx(e,!0),0===e.strm.avail_out?3:4):e.last_lit&&(Qx(e,!1),0===e.strm.avail_out)?1:2}function rV(e,t){for(var i,r,n;;){if(e.lookahead<Hx){if(tV(e),e.lookahead<Hx&&0===t)return 1;if(0===e.lookahead)break}if(i=0,e.lookahead>=3&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+3-1])&e.hash_mask,i=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),e.prev_length=e.match_length,e.prev_match=e.match_start,e.match_length=2,0!==i&&e.prev_length<e.max_lazy_match&&e.strstart-i<=e.w_size-Hx&&(e.match_length=eV(e,i),e.match_length<=5&&(1===e.strategy||3===e.match_length&&e.strstart-e.match_start>4096)&&(e.match_length=2)),e.prev_length>=3&&e.match_length<=e.prev_length){n=e.strstart+e.lookahead-3,r=xx._tr_tally(e,e.strstart-1-e.prev_match,e.prev_length-3),e.lookahead-=e.prev_length-1,e.prev_length-=2;do{++e.strstart<=n&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+3-1])&e.hash_mask,i=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart)}while(0!=--e.prev_length);if(e.match_available=0,e.match_length=2,e.strstart++,r&&(Qx(e,!1),0===e.strm.avail_out))return 1}else if(e.match_available){if((r=xx._tr_tally(e,0,e.window[e.strstart-1]))&&Qx(e,!1),e.strstart++,e.lookahead--,0===e.strm.avail_out)return 1}else e.match_available=1,e.strstart++,e.lookahead--}return e.match_available&&(r=xx._tr_tally(e,0,e.window[e.strstart-1]),e.match_available=0),e.insert=e.strstart<2?e.strstart:2,4===t?(Qx(e,!0),0===e.strm.avail_out?3:4):e.last_lit&&(Qx(e,!1),0===e.strm.avail_out)?1:2}function nV(e,t,i,r,n){this.good_length=e,this.max_lazy=t,this.nice_length=i,this.max_chain=r,this.func=n}function oV(){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 Ux.Buf16(1146),this.dyn_dtree=new Ux.Buf16(122),this.bl_tree=new Ux.Buf16(78),Yx(this.dyn_ltree),Yx(this.dyn_dtree),Yx(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new Ux.Buf16(16),this.heap=new Ux.Buf16(573),Yx(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Ux.Buf16(573),Yx(this.depth),this.l_buf=0,this.lit_bufsize=0,this.last_lit=0,this.d_buf=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}function aV(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:Kx,e.adler=2===t.wrap?0:1,t.last_flush=0,xx._tr_init(t),0):Xx(e,jx)}function sV(e){var t,i=aV(e);return 0===i&&((t=e.state).window_size=2*t.w_size,Yx(t.head),t.max_lazy_match=Dx[t.level].max_lazy,t.good_match=Dx[t.level].good_length,t.nice_match=Dx[t.level].nice_length,t.max_chain_length=Dx[t.level].max_chain,t.strstart=0,t.block_start=0,t.lookahead=0,t.insert=0,t.match_length=t.prev_length=2,t.match_available=0,t.ins_h=0),i}function cV(e,t,i,r,n,o){if(!e)return jx;var a=1;if(-1===t&&(t=6),r<0?(a=0,r=-r):r>15&&(a=2,r-=16),n<1||n>9||8!==i||r<8||r>15||t<0||t>9||o<0||o>4)return Xx(e,jx);8===r&&(r=9);var s=new oV;return e.state=s,s.strm=e,s.wrap=a,s.gzhead=null,s.w_bits=r,s.w_size=1<<s.w_bits,s.w_mask=s.w_size-1,s.hash_bits=n+7,s.hash_size=1<<s.hash_bits,s.hash_mask=s.hash_size-1,s.hash_shift=~~((s.hash_bits+3-1)/3),s.window=new Ux.Buf8(2*s.w_size),s.head=new Ux.Buf16(s.hash_size),s.prev=new Ux.Buf16(s.w_size),s.lit_bufsize=1<<n+6,s.pending_buf_size=4*s.lit_bufsize,s.pending_buf=new Ux.Buf8(s.pending_buf_size),s.d_buf=1*s.lit_bufsize,s.l_buf=3*s.lit_bufsize,s.level=t,s.strategy=o,s.method=i,sV(e)}Dx=[new nV(0,0,0,0,(function(e,t){var i=65535;for(i>e.pending_buf_size-5&&(i=e.pending_buf_size-5);;){if(e.lookahead<=1){if(tV(e),0===e.lookahead&&0===t)return 1;if(0===e.lookahead)break}e.strstart+=e.lookahead,e.lookahead=0;var r=e.block_start+i;if((0===e.strstart||e.strstart>=r)&&(e.lookahead=e.strstart-r,e.strstart=r,Qx(e,!1),0===e.strm.avail_out))return 1;if(e.strstart-e.block_start>=e.w_size-Hx&&(Qx(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,4===t?(Qx(e,!0),0===e.strm.avail_out?3:4):(e.strstart>e.block_start&&(Qx(e,!1),e.strm.avail_out),1)})),new nV(4,4,8,4,iV),new nV(4,5,16,8,iV),new nV(4,6,32,32,iV),new nV(4,4,16,16,rV),new nV(8,16,32,32,rV),new nV(8,16,128,128,rV),new nV(8,32,128,256,rV),new nV(32,128,258,1024,rV),new nV(32,258,258,4096,rV)],WU.deflateInit=function(e,t){return cV(e,t,8,15,8,0)},WU.deflateInit2=cV,WU.deflateReset=sV,WU.deflateResetKeep=aV,WU.deflateSetHeader=function(e,t){return e&&e.state?2!==e.state.wrap?jx:(e.state.gzhead=t,0):jx},WU.deflate=function(e,t){var i,r,n,o;if(!e||!e.state||t>5||t<0)return e?Xx(e,jx):jx;if(r=e.state,!e.output||!e.input&&0!==e.avail_in||r.status===Wx&&4!==t)return Xx(e,0===e.avail_out?-5:jx);if(r.strm=e,i=r.last_flush,r.last_flush=t,42===r.status)if(2===r.wrap)e.adler=0,Zx(r,31),Zx(r,139),Zx(r,8),r.gzhead?(Zx(r,(r.gzhead.text?1:0)+(r.gzhead.hcrc?2:0)+(r.gzhead.extra?4:0)+(r.gzhead.name?8:0)+(r.gzhead.comment?16:0)),Zx(r,255&r.gzhead.time),Zx(r,r.gzhead.time>>8&255),Zx(r,r.gzhead.time>>16&255),Zx(r,r.gzhead.time>>24&255),Zx(r,9===r.level?2:r.strategy>=2||r.level<2?4:0),Zx(r,255&r.gzhead.os),r.gzhead.extra&&r.gzhead.extra.length&&(Zx(r,255&r.gzhead.extra.length),Zx(r,r.gzhead.extra.length>>8&255)),r.gzhead.hcrc&&(e.adler=Fx(e.adler,r.pending_buf,r.pending,0)),r.gzindex=0,r.status=69):(Zx(r,0),Zx(r,0),Zx(r,0),Zx(r,0),Zx(r,0),Zx(r,9===r.level?2:r.strategy>=2||r.level<2?4:0),Zx(r,3),r.status=Kx);else{var a=8+(r.w_bits-8<<4)<<8;a|=(r.strategy>=2||r.level<2?0:r.level<6?1:6===r.level?2:3)<<6,0!==r.strstart&&(a|=32),a+=31-a%31,r.status=Kx,$x(r,a),0!==r.strstart&&($x(r,e.adler>>>16),$x(r,65535&e.adler)),e.adler=1}if(69===r.status)if(r.gzhead.extra){for(n=r.pending;r.gzindex<(65535&r.gzhead.extra.length)&&(r.pending!==r.pending_buf_size||(r.gzhead.hcrc&&r.pending>n&&(e.adler=Fx(e.adler,r.pending_buf,r.pending-n,n)),Jx(e),n=r.pending,r.pending!==r.pending_buf_size));)Zx(r,255&r.gzhead.extra[r.gzindex]),r.gzindex++;r.gzhead.hcrc&&r.pending>n&&(e.adler=Fx(e.adler,r.pending_buf,r.pending-n,n)),r.gzindex===r.gzhead.extra.length&&(r.gzindex=0,r.status=73)}else r.status=73;if(73===r.status)if(r.gzhead.name){n=r.pending;do{if(r.pending===r.pending_buf_size&&(r.gzhead.hcrc&&r.pending>n&&(e.adler=Fx(e.adler,r.pending_buf,r.pending-n,n)),Jx(e),n=r.pending,r.pending===r.pending_buf_size)){o=1;break}o=r.gzindex<r.gzhead.name.length?255&r.gzhead.name.charCodeAt(r.gzindex++):0,Zx(r,o)}while(0!==o);r.gzhead.hcrc&&r.pending>n&&(e.adler=Fx(e.adler,r.pending_buf,r.pending-n,n)),0===o&&(r.gzindex=0,r.status=91)}else r.status=91;if(91===r.status)if(r.gzhead.comment){n=r.pending;do{if(r.pending===r.pending_buf_size&&(r.gzhead.hcrc&&r.pending>n&&(e.adler=Fx(e.adler,r.pending_buf,r.pending-n,n)),Jx(e),n=r.pending,r.pending===r.pending_buf_size)){o=1;break}o=r.gzindex<r.gzhead.comment.length?255&r.gzhead.comment.charCodeAt(r.gzindex++):0,Zx(r,o)}while(0!==o);r.gzhead.hcrc&&r.pending>n&&(e.adler=Fx(e.adler,r.pending_buf,r.pending-n,n)),0===o&&(r.status=zx)}else r.status=zx;if(r.status===zx&&(r.gzhead.hcrc?(r.pending+2>r.pending_buf_size&&Jx(e),r.pending+2<=r.pending_buf_size&&(Zx(r,255&e.adler),Zx(r,e.adler>>8&255),e.adler=0,r.status=Kx)):r.status=Kx),0!==r.pending){if(Jx(e),0===e.avail_out)return r.last_flush=-1,0}else if(0===e.avail_in&&qx(t)<=qx(i)&&4!==t)return Xx(e,-5);if(r.status===Wx&&0!==e.avail_in)return Xx(e,-5);if(0!==e.avail_in||0!==r.lookahead||0!==t&&r.status!==Wx){var s=2===r.strategy?function(e,t){for(var i;;){if(0===e.lookahead&&(tV(e),0===e.lookahead)){if(0===t)return 1;break}if(e.match_length=0,i=xx._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,i&&(Qx(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,4===t?(Qx(e,!0),0===e.strm.avail_out?3:4):e.last_lit&&(Qx(e,!1),0===e.strm.avail_out)?1:2}(r,t):3===r.strategy?function(e,t){for(var i,r,n,o,a=e.window;;){if(e.lookahead<=Gx){if(tV(e),e.lookahead<=Gx&&0===t)return 1;if(0===e.lookahead)break}if(e.match_length=0,e.lookahead>=3&&e.strstart>0&&(r=a[n=e.strstart-1])===a[++n]&&r===a[++n]&&r===a[++n]){o=e.strstart+Gx;do{}while(r===a[++n]&&r===a[++n]&&r===a[++n]&&r===a[++n]&&r===a[++n]&&r===a[++n]&&r===a[++n]&&r===a[++n]&&n<o);e.match_length=Gx-(o-n),e.match_length>e.lookahead&&(e.match_length=e.lookahead)}if(e.match_length>=3?(i=xx._tr_tally(e,1,e.match_length-3),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(i=xx._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),i&&(Qx(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,4===t?(Qx(e,!0),0===e.strm.avail_out?3:4):e.last_lit&&(Qx(e,!1),0===e.strm.avail_out)?1:2}(r,t):Dx[r.level].func(r,t);if(3!==s&&4!==s||(r.status=Wx),1===s||3===s)return 0===e.avail_out&&(r.last_flush=-1),0;if(2===s&&(1===t?xx._tr_align(r):5!==t&&(xx._tr_stored_block(r,0,0,!1),3===t&&(Yx(r.head),0===r.lookahead&&(r.strstart=0,r.block_start=0,r.insert=0))),Jx(e),0===e.avail_out))return r.last_flush=-1,0}return 4!==t?0:r.wrap<=0?1:(2===r.wrap?(Zx(r,255&e.adler),Zx(r,e.adler>>8&255),Zx(r,e.adler>>16&255),Zx(r,e.adler>>24&255),Zx(r,255&e.total_in),Zx(r,e.total_in>>8&255),Zx(r,e.total_in>>16&255),Zx(r,e.total_in>>24&255)):($x(r,e.adler>>>16),$x(r,65535&e.adler)),Jx(e),r.wrap>0&&(r.wrap=-r.wrap),0!==r.pending?0:1)},WU.deflateEnd=function(e){var t;return e&&e.state?42!==(t=e.state.status)&&69!==t&&73!==t&&91!==t&&t!==zx&&t!==Kx&&t!==Wx?Xx(e,jx):(e.state=null,t===Kx?Xx(e,-3):0):jx},WU.deflateSetDictionary=function(e,t){var i,r,n,o,a,s,c,u,d=t.length;if(!e||!e.state)return jx;if(2===(o=(i=e.state).wrap)||1===o&&42!==i.status||i.lookahead)return jx;for(1===o&&(e.adler=Vx(e.adler,t,d,0)),i.wrap=0,d>=i.w_size&&(0===o&&(Yx(i.head),i.strstart=0,i.block_start=0,i.insert=0),u=new Ux.Buf8(i.w_size),Ux.arraySet(u,t,d-i.w_size,i.w_size,0),t=u,d=i.w_size),a=e.avail_in,s=e.next_in,c=e.input,e.avail_in=d,e.next_in=0,e.input=t,tV(i);i.lookahead>=3;){r=i.strstart,n=i.lookahead-2;do{i.ins_h=(i.ins_h<<i.hash_shift^i.window[r+3-1])&i.hash_mask,i.prev[r&i.w_mask]=i.head[i.ins_h],i.head[i.ins_h]=r,r++}while(--n);i.strstart=r,i.lookahead=2,tV(i)}return i.strstart+=i.lookahead,i.block_start=i.strstart,i.insert=i.lookahead,i.lookahead=0,i.match_length=i.prev_length=2,i.match_available=0,e.next_in=s,e.input=c,e.avail_in=a,i.wrap=o,0},WU.deflateInfo="pako deflate (from Nodeca project)";var uV={},dV=zU,lV=!0,hV=!0;try{String.fromCharCode.apply(null,[0])}catch(e){lV=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(e){hV=!1}for(var pV=new dV.Buf8(256),_V=0;_V<256;_V++)pV[_V]=_V>=252?6:_V>=248?5:_V>=240?4:_V>=224?3:_V>=192?2:1;function fV(e,t){if(t<65534&&(e.subarray&&hV||!e.subarray&&lV))return String.fromCharCode.apply(null,dV.shrinkBuf(e,t));for(var i="",r=0;r<t;r++)i+=String.fromCharCode(e[r]);return i}pV[254]=pV[254]=1,uV.string2buf=function(e){var t,i,r,n,o,a=e.length,s=0;for(n=0;n<a;n++)55296==(64512&(i=e.charCodeAt(n)))&&n+1<a&&56320==(64512&(r=e.charCodeAt(n+1)))&&(i=65536+(i-55296<<10)+(r-56320),n++),s+=i<128?1:i<2048?2:i<65536?3:4;for(t=new dV.Buf8(s),o=0,n=0;o<s;n++)55296==(64512&(i=e.charCodeAt(n)))&&n+1<a&&56320==(64512&(r=e.charCodeAt(n+1)))&&(i=65536+(i-55296<<10)+(r-56320),n++),i<128?t[o++]=i:i<2048?(t[o++]=192|i>>>6,t[o++]=128|63&i):i<65536?(t[o++]=224|i>>>12,t[o++]=128|i>>>6&63,t[o++]=128|63&i):(t[o++]=240|i>>>18,t[o++]=128|i>>>12&63,t[o++]=128|i>>>6&63,t[o++]=128|63&i);return t},uV.buf2binstring=function(e){return fV(e,e.length)},uV.binstring2buf=function(e){for(var t=new dV.Buf8(e.length),i=0,r=t.length;i<r;i++)t[i]=e.charCodeAt(i);return t},uV.buf2string=function(e,t){var i,r,n,o,a=t||e.length,s=new Array(2*a);for(r=0,i=0;i<a;)if((n=e[i++])<128)s[r++]=n;else if((o=pV[n])>4)s[r++]=65533,i+=o-1;else{for(n&=2===o?31:3===o?15:7;o>1&&i<a;)n=n<<6|63&e[i++],o--;o>1?s[r++]=65533:n<65536?s[r++]=n:(n-=65536,s[r++]=55296|n>>10&1023,s[r++]=56320|1023&n)}return fV(s,r)},uV.utf8border=function(e,t){var i;for((t=t||e.length)>e.length&&(t=e.length),i=t-1;i>=0&&128==(192&e[i]);)i--;return i<0||0===i?t:i+pV[e[i]]>t?i:t};var vV=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},mV=WU,yV=zU,SV=uV,gV=Lx,EV=vV,bV=Object.prototype.toString;function IV(e){if(!(this instanceof IV))return new IV(e);this.options=yV.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 EV,this.strm.avail_out=0;var i=mV.deflateInit2(this.strm,t.level,t.method,t.windowBits,t.memLevel,t.strategy);if(0!==i)throw new Error(gV[i]);if(t.header&&mV.deflateSetHeader(this.strm,t.header),t.dictionary){var r;if(r="string"==typeof t.dictionary?SV.string2buf(t.dictionary):"[object ArrayBuffer]"===bV.call(t.dictionary)?new Uint8Array(t.dictionary):t.dictionary,0!==(i=mV.deflateSetDictionary(this.strm,r)))throw new Error(gV[i]);this._dict_set=!0}}function TV(e,t){var i=new IV(t);if(i.push(e,!0),i.err)throw i.msg||gV[i.err];return i.result}IV.prototype.push=function(e,t){var i,r,n=this.strm,o=this.options.chunkSize;if(this.ended)return!1;r=t===~~t?t:!0===t?4:0,"string"==typeof e?n.input=SV.string2buf(e):"[object ArrayBuffer]"===bV.call(e)?n.input=new Uint8Array(e):n.input=e,n.next_in=0,n.avail_in=n.input.length;do{if(0===n.avail_out&&(n.output=new yV.Buf8(o),n.next_out=0,n.avail_out=o),1!==(i=mV.deflate(n,r))&&0!==i)return this.onEnd(i),this.ended=!0,!1;0!==n.avail_out&&(0!==n.avail_in||4!==r&&2!==r)||("string"===this.options.to?this.onData(SV.buf2binstring(yV.shrinkBuf(n.output,n.next_out))):this.onData(yV.shrinkBuf(n.output,n.next_out)))}while((n.avail_in>0||0===n.avail_out)&&1!==i);return 4===r?(i=mV.deflateEnd(this.strm),this.onEnd(i),this.ended=!0,0===i):2!==r||(this.onEnd(0),n.avail_out=0,!0)},IV.prototype.onData=function(e){this.chunks.push(e)},IV.prototype.onEnd=function(e){0===e&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=yV.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg},KU.Deflate=IV,KU.deflate=TV,KU.deflateRaw=function(e,t){return(t=t||{}).raw=!0,TV(e,t)},KU.gzip=function(e,t){return(t=t||{}).gzip=!0,TV(e,t)};var AV={},RV=c,CV=Ot,OV=Gf,wV=s,kV=RegExp.prototype;RV&&wV((function(){return"sy"!==Object.getOwnPropertyDescriptor(kV,"flags").get.call({dotAll:!0,sticky:!0})}))&&CV.f(kV,"flags",{configurable:!0,get:OV});var NV={},PV=zU,DV=15,MV=[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],LV=[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],UV=[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],xV=[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],VV=zU,FV=Nx,BV=Mx,jV=function(e,t){var i,r,n,o,a,s,c,u,d,l,h,p,_,f,v,m,y,S,g,E,b,I,T,A,R;i=e.state,r=e.next_in,A=e.input,n=r+(e.avail_in-5),o=e.next_out,R=e.output,a=o-(t-e.avail_out),s=o+(e.avail_out-257),c=i.dmax,u=i.wsize,d=i.whave,l=i.wnext,h=i.window,p=i.hold,_=i.bits,f=i.lencode,v=i.distcode,m=(1<<i.lenbits)-1,y=(1<<i.distbits)-1;e:do{_<15&&(p+=A[r++]<<_,_+=8,p+=A[r++]<<_,_+=8),S=f[p&m];t:for(;;){if(p>>>=g=S>>>24,_-=g,0===(g=S>>>16&255))R[o++]=65535&S;else{if(!(16&g)){if(0==(64&g)){S=f[(65535&S)+(p&(1<<g)-1)];continue t}if(32&g){i.mode=12;break e}e.msg="invalid literal/length code",i.mode=30;break e}E=65535&S,(g&=15)&&(_<g&&(p+=A[r++]<<_,_+=8),E+=p&(1<<g)-1,p>>>=g,_-=g),_<15&&(p+=A[r++]<<_,_+=8,p+=A[r++]<<_,_+=8),S=v[p&y];i:for(;;){if(p>>>=g=S>>>24,_-=g,!(16&(g=S>>>16&255))){if(0==(64&g)){S=v[(65535&S)+(p&(1<<g)-1)];continue i}e.msg="invalid distance code",i.mode=30;break e}if(b=65535&S,_<(g&=15)&&(p+=A[r++]<<_,(_+=8)<g&&(p+=A[r++]<<_,_+=8)),(b+=p&(1<<g)-1)>c){e.msg="invalid distance too far back",i.mode=30;break e}if(p>>>=g,_-=g,b>(g=o-a)){if((g=b-g)>d&&i.sane){e.msg="invalid distance too far back",i.mode=30;break e}if(I=0,T=h,0===l){if(I+=u-g,g<E){E-=g;do{R[o++]=h[I++]}while(--g);I=o-b,T=R}}else if(l<g){if(I+=u+l-g,(g-=l)<E){E-=g;do{R[o++]=h[I++]}while(--g);if(I=0,l<E){E-=g=l;do{R[o++]=h[I++]}while(--g);I=o-b,T=R}}}else if(I+=l-g,g<E){E-=g;do{R[o++]=h[I++]}while(--g);I=o-b,T=R}for(;E>2;)R[o++]=T[I++],R[o++]=T[I++],R[o++]=T[I++],E-=3;E&&(R[o++]=T[I++],E>1&&(R[o++]=T[I++]))}else{I=o-b;do{R[o++]=R[I++],R[o++]=R[I++],R[o++]=R[I++],E-=3}while(E>2);E&&(R[o++]=R[I++],E>1&&(R[o++]=R[I++]))}break}}break}}while(r<n&&o<s);r-=E=_>>3,p&=(1<<(_-=E<<3))-1,e.next_in=r,e.next_out=o,e.avail_in=r<n?n-r+5:5-(r-n),e.avail_out=o<s?s-o+257:257-(o-s),i.hold=p,i.bits=_},GV=function(e,t,i,r,n,o,a,s){var c,u,d,l,h,p,_,f,v,m=s.bits,y=0,S=0,g=0,E=0,b=0,I=0,T=0,A=0,R=0,C=0,O=null,w=0,k=new PV.Buf16(16),N=new PV.Buf16(16),P=null,D=0;for(y=0;y<=DV;y++)k[y]=0;for(S=0;S<r;S++)k[t[i+S]]++;for(b=m,E=DV;E>=1&&0===k[E];E--);if(b>E&&(b=E),0===E)return n[o++]=20971520,n[o++]=20971520,s.bits=1,0;for(g=1;g<E&&0===k[g];g++);for(b<g&&(b=g),A=1,y=1;y<=DV;y++)if(A<<=1,(A-=k[y])<0)return-1;if(A>0&&(0===e||1!==E))return-1;for(N[1]=0,y=1;y<DV;y++)N[y+1]=N[y]+k[y];for(S=0;S<r;S++)0!==t[i+S]&&(a[N[t[i+S]]++]=S);if(0===e?(O=P=a,p=19):1===e?(O=MV,w-=257,P=LV,D-=257,p=256):(O=UV,P=xV,p=-1),C=0,S=0,y=g,h=o,I=b,T=0,d=-1,l=(R=1<<b)-1,1===e&&R>852||2===e&&R>592)return 1;for(;;){_=y-T,a[S]<p?(f=0,v=a[S]):a[S]>p?(f=P[D+a[S]],v=O[w+a[S]]):(f=96,v=0),c=1<<y-T,g=u=1<<I;do{n[h+(C>>T)+(u-=c)]=_<<24|f<<16|v|0}while(0!==u);for(c=1<<y-1;C&c;)c>>=1;if(0!==c?(C&=c-1,C+=c):C=0,S++,0==--k[y]){if(y===E)break;y=t[i+a[S]]}if(y>b&&(C&l)!==d){for(0===T&&(T=b),h+=g,A=1<<(I=y-T);I+T<E&&!((A-=k[I+T])<=0);)I++,A<<=1;if(R+=1<<I,1===e&&R>852||2===e&&R>592)return 1;n[d=C&l]=b<<24|I<<16|h-o|0}}return 0!==C&&(n[h+C]=y-T<<24|64<<16|0),s.bits=b,0},HV=-2,zV=12,KV=30;function WV(e){return(e>>>24&255)+(e>>>8&65280)+((65280&e)<<8)+((255&e)<<24)}function XV(){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 VV.Buf16(320),this.work=new VV.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function qV(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 VV.Buf32(852),t.distcode=t.distdyn=new VV.Buf32(592),t.sane=1,t.back=-1,0):HV}function YV(e){var t;return e&&e.state?((t=e.state).wsize=0,t.whave=0,t.wnext=0,qV(e)):HV}function JV(e,t){var i,r;return e&&e.state?(r=e.state,t<0?(i=0,t=-t):(i=1+(t>>4),t<48&&(t&=15)),t&&(t<8||t>15)?HV:(null!==r.window&&r.wbits!==t&&(r.window=null),r.wrap=i,r.wbits=t,YV(e))):HV}function QV(e,t){var i,r;return e?(r=new XV,e.state=r,r.window=null,0!==(i=JV(e,t))&&(e.state=null),i):HV}var ZV,$V,eF=!0;function tF(e){if(eF){var t;for(ZV=new VV.Buf32(512),$V=new VV.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(GV(1,e.lens,0,288,ZV,0,e.work,{bits:9}),t=0;t<32;)e.lens[t++]=5;GV(2,e.lens,0,32,$V,0,e.work,{bits:5}),eF=!1}e.lencode=ZV,e.lenbits=9,e.distcode=$V,e.distbits=5}function iF(e,t,i,r){var n,o=e.state;return null===o.window&&(o.wsize=1<<o.wbits,o.wnext=0,o.whave=0,o.window=new VV.Buf8(o.wsize)),r>=o.wsize?(VV.arraySet(o.window,t,i-o.wsize,o.wsize,0),o.wnext=0,o.whave=o.wsize):((n=o.wsize-o.wnext)>r&&(n=r),VV.arraySet(o.window,t,i-r,n,o.wnext),(r-=n)?(VV.arraySet(o.window,t,i-r,r,0),o.wnext=r,o.whave=o.wsize):(o.wnext+=n,o.wnext===o.wsize&&(o.wnext=0),o.whave<o.wsize&&(o.whave+=n))),0}NV.inflateReset=YV,NV.inflateReset2=JV,NV.inflateResetKeep=qV,NV.inflateInit=function(e){return QV(e,15)},NV.inflateInit2=QV,NV.inflate=function(e,t){var i,r,n,o,a,s,c,u,d,l,h,p,_,f,v,m,y,S,g,E,b,I,T,A,R=0,C=new VV.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 HV;(i=e.state).mode===zV&&(i.mode=13),a=e.next_out,n=e.output,c=e.avail_out,o=e.next_in,r=e.input,s=e.avail_in,u=i.hold,d=i.bits,l=s,h=c,I=0;e:for(;;)switch(i.mode){case 1:if(0===i.wrap){i.mode=13;break}for(;d<16;){if(0===s)break e;s--,u+=r[o++]<<d,d+=8}if(2&i.wrap&&35615===u){i.check=0,C[0]=255&u,C[1]=u>>>8&255,i.check=BV(i.check,C,2,0),u=0,d=0,i.mode=2;break}if(i.flags=0,i.head&&(i.head.done=!1),!(1&i.wrap)||(((255&u)<<8)+(u>>8))%31){e.msg="incorrect header check",i.mode=KV;break}if(8!=(15&u)){e.msg="unknown compression method",i.mode=KV;break}if(d-=4,b=8+(15&(u>>>=4)),0===i.wbits)i.wbits=b;else if(b>i.wbits){e.msg="invalid window size",i.mode=KV;break}i.dmax=1<<b,e.adler=i.check=1,i.mode=512&u?10:zV,u=0,d=0;break;case 2:for(;d<16;){if(0===s)break e;s--,u+=r[o++]<<d,d+=8}if(i.flags=u,8!=(255&i.flags)){e.msg="unknown compression method",i.mode=KV;break}if(57344&i.flags){e.msg="unknown header flags set",i.mode=KV;break}i.head&&(i.head.text=u>>8&1),512&i.flags&&(C[0]=255&u,C[1]=u>>>8&255,i.check=BV(i.check,C,2,0)),u=0,d=0,i.mode=3;case 3:for(;d<32;){if(0===s)break e;s--,u+=r[o++]<<d,d+=8}i.head&&(i.head.time=u),512&i.flags&&(C[0]=255&u,C[1]=u>>>8&255,C[2]=u>>>16&255,C[3]=u>>>24&255,i.check=BV(i.check,C,4,0)),u=0,d=0,i.mode=4;case 4:for(;d<16;){if(0===s)break e;s--,u+=r[o++]<<d,d+=8}i.head&&(i.head.xflags=255&u,i.head.os=u>>8),512&i.flags&&(C[0]=255&u,C[1]=u>>>8&255,i.check=BV(i.check,C,2,0)),u=0,d=0,i.mode=5;case 5:if(1024&i.flags){for(;d<16;){if(0===s)break e;s--,u+=r[o++]<<d,d+=8}i.length=u,i.head&&(i.head.extra_len=u),512&i.flags&&(C[0]=255&u,C[1]=u>>>8&255,i.check=BV(i.check,C,2,0)),u=0,d=0}else i.head&&(i.head.extra=null);i.mode=6;case 6:if(1024&i.flags&&((p=i.length)>s&&(p=s),p&&(i.head&&(b=i.head.extra_len-i.length,i.head.extra||(i.head.extra=new Array(i.head.extra_len)),VV.arraySet(i.head.extra,r,o,p,b)),512&i.flags&&(i.check=BV(i.check,r,p,o)),s-=p,o+=p,i.length-=p),i.length))break e;i.length=0,i.mode=7;case 7:if(2048&i.flags){if(0===s)break e;p=0;do{b=r[o+p++],i.head&&b&&i.length<65536&&(i.head.name+=String.fromCharCode(b))}while(b&&p<s);if(512&i.flags&&(i.check=BV(i.check,r,p,o)),s-=p,o+=p,b)break e}else i.head&&(i.head.name=null);i.length=0,i.mode=8;case 8:if(4096&i.flags){if(0===s)break e;p=0;do{b=r[o+p++],i.head&&b&&i.length<65536&&(i.head.comment+=String.fromCharCode(b))}while(b&&p<s);if(512&i.flags&&(i.check=BV(i.check,r,p,o)),s-=p,o+=p,b)break e}else i.head&&(i.head.comment=null);i.mode=9;case 9:if(512&i.flags){for(;d<16;){if(0===s)break e;s--,u+=r[o++]<<d,d+=8}if(u!==(65535&i.check)){e.msg="header crc mismatch",i.mode=KV;break}u=0,d=0}i.head&&(i.head.hcrc=i.flags>>9&1,i.head.done=!0),e.adler=i.check=0,i.mode=zV;break;case 10:for(;d<32;){if(0===s)break e;s--,u+=r[o++]<<d,d+=8}e.adler=i.check=WV(u),u=0,d=0,i.mode=11;case 11:if(0===i.havedict)return e.next_out=a,e.avail_out=c,e.next_in=o,e.avail_in=s,i.hold=u,i.bits=d,2;e.adler=i.check=1,i.mode=zV;case zV:if(5===t||6===t)break e;case 13:if(i.last){u>>>=7&d,d-=7&d,i.mode=27;break}for(;d<3;){if(0===s)break e;s--,u+=r[o++]<<d,d+=8}switch(i.last=1&u,d-=1,3&(u>>>=1)){case 0:i.mode=14;break;case 1:if(tF(i),i.mode=20,6===t){u>>>=2,d-=2;break e}break;case 2:i.mode=17;break;case 3:e.msg="invalid block type",i.mode=KV}u>>>=2,d-=2;break;case 14:for(u>>>=7&d,d-=7&d;d<32;){if(0===s)break e;s--,u+=r[o++]<<d,d+=8}if((65535&u)!=(u>>>16^65535)){e.msg="invalid stored block lengths",i.mode=KV;break}if(i.length=65535&u,u=0,d=0,i.mode=15,6===t)break e;case 15:i.mode=16;case 16:if(p=i.length){if(p>s&&(p=s),p>c&&(p=c),0===p)break e;VV.arraySet(n,r,o,p,a),s-=p,o+=p,c-=p,a+=p,i.length-=p;break}i.mode=zV;break;case 17:for(;d<14;){if(0===s)break e;s--,u+=r[o++]<<d,d+=8}if(i.nlen=257+(31&u),u>>>=5,d-=5,i.ndist=1+(31&u),u>>>=5,d-=5,i.ncode=4+(15&u),u>>>=4,d-=4,i.nlen>286||i.ndist>30){e.msg="too many length or distance symbols",i.mode=KV;break}i.have=0,i.mode=18;case 18:for(;i.have<i.ncode;){for(;d<3;){if(0===s)break e;s--,u+=r[o++]<<d,d+=8}i.lens[O[i.have++]]=7&u,u>>>=3,d-=3}for(;i.have<19;)i.lens[O[i.have++]]=0;if(i.lencode=i.lendyn,i.lenbits=7,T={bits:i.lenbits},I=GV(0,i.lens,0,19,i.lencode,0,i.work,T),i.lenbits=T.bits,I){e.msg="invalid code lengths set",i.mode=KV;break}i.have=0,i.mode=19;case 19:for(;i.have<i.nlen+i.ndist;){for(;m=(R=i.lencode[u&(1<<i.lenbits)-1])>>>16&255,y=65535&R,!((v=R>>>24)<=d);){if(0===s)break e;s--,u+=r[o++]<<d,d+=8}if(y<16)u>>>=v,d-=v,i.lens[i.have++]=y;else{if(16===y){for(A=v+2;d<A;){if(0===s)break e;s--,u+=r[o++]<<d,d+=8}if(u>>>=v,d-=v,0===i.have){e.msg="invalid bit length repeat",i.mode=KV;break}b=i.lens[i.have-1],p=3+(3&u),u>>>=2,d-=2}else if(17===y){for(A=v+3;d<A;){if(0===s)break e;s--,u+=r[o++]<<d,d+=8}d-=v,b=0,p=3+(7&(u>>>=v)),u>>>=3,d-=3}else{for(A=v+7;d<A;){if(0===s)break e;s--,u+=r[o++]<<d,d+=8}d-=v,b=0,p=11+(127&(u>>>=v)),u>>>=7,d-=7}if(i.have+p>i.nlen+i.ndist){e.msg="invalid bit length repeat",i.mode=KV;break}for(;p--;)i.lens[i.have++]=b}}if(i.mode===KV)break;if(0===i.lens[256]){e.msg="invalid code -- missing end-of-block",i.mode=KV;break}if(i.lenbits=9,T={bits:i.lenbits},I=GV(1,i.lens,0,i.nlen,i.lencode,0,i.work,T),i.lenbits=T.bits,I){e.msg="invalid literal/lengths set",i.mode=KV;break}if(i.distbits=6,i.distcode=i.distdyn,T={bits:i.distbits},I=GV(2,i.lens,i.nlen,i.ndist,i.distcode,0,i.work,T),i.distbits=T.bits,I){e.msg="invalid distances set",i.mode=KV;break}if(i.mode=20,6===t)break e;case 20:i.mode=21;case 21:if(s>=6&&c>=258){e.next_out=a,e.avail_out=c,e.next_in=o,e.avail_in=s,i.hold=u,i.bits=d,jV(e,h),a=e.next_out,n=e.output,c=e.avail_out,o=e.next_in,r=e.input,s=e.avail_in,u=i.hold,d=i.bits,i.mode===zV&&(i.back=-1);break}for(i.back=0;m=(R=i.lencode[u&(1<<i.lenbits)-1])>>>16&255,y=65535&R,!((v=R>>>24)<=d);){if(0===s)break e;s--,u+=r[o++]<<d,d+=8}if(m&&0==(240&m)){for(S=v,g=m,E=y;m=(R=i.lencode[E+((u&(1<<S+g)-1)>>S)])>>>16&255,y=65535&R,!(S+(v=R>>>24)<=d);){if(0===s)break e;s--,u+=r[o++]<<d,d+=8}u>>>=S,d-=S,i.back+=S}if(u>>>=v,d-=v,i.back+=v,i.length=y,0===m){i.mode=26;break}if(32&m){i.back=-1,i.mode=zV;break}if(64&m){e.msg="invalid literal/length code",i.mode=KV;break}i.extra=15&m,i.mode=22;case 22:if(i.extra){for(A=i.extra;d<A;){if(0===s)break e;s--,u+=r[o++]<<d,d+=8}i.length+=u&(1<<i.extra)-1,u>>>=i.extra,d-=i.extra,i.back+=i.extra}i.was=i.length,i.mode=23;case 23:for(;m=(R=i.distcode[u&(1<<i.distbits)-1])>>>16&255,y=65535&R,!((v=R>>>24)<=d);){if(0===s)break e;s--,u+=r[o++]<<d,d+=8}if(0==(240&m)){for(S=v,g=m,E=y;m=(R=i.distcode[E+((u&(1<<S+g)-1)>>S)])>>>16&255,y=65535&R,!(S+(v=R>>>24)<=d);){if(0===s)break e;s--,u+=r[o++]<<d,d+=8}u>>>=S,d-=S,i.back+=S}if(u>>>=v,d-=v,i.back+=v,64&m){e.msg="invalid distance code",i.mode=KV;break}i.offset=y,i.extra=15&m,i.mode=24;case 24:if(i.extra){for(A=i.extra;d<A;){if(0===s)break e;s--,u+=r[o++]<<d,d+=8}i.offset+=u&(1<<i.extra)-1,u>>>=i.extra,d-=i.extra,i.back+=i.extra}if(i.offset>i.dmax){e.msg="invalid distance too far back",i.mode=KV;break}i.mode=25;case 25:if(0===c)break e;if(p=h-c,i.offset>p){if((p=i.offset-p)>i.whave&&i.sane){e.msg="invalid distance too far back",i.mode=KV;break}p>i.wnext?(p-=i.wnext,_=i.wsize-p):_=i.wnext-p,p>i.length&&(p=i.length),f=i.window}else f=n,_=a-i.offset,p=i.length;p>c&&(p=c),c-=p,i.length-=p;do{n[a++]=f[_++]}while(--p);0===i.length&&(i.mode=21);break;case 26:if(0===c)break e;n[a++]=i.length,c--,i.mode=21;break;case 27:if(i.wrap){for(;d<32;){if(0===s)break e;s--,u|=r[o++]<<d,d+=8}if(h-=c,e.total_out+=h,i.total+=h,h&&(e.adler=i.check=i.flags?BV(i.check,n,h,a-h):FV(i.check,n,h,a-h)),h=c,(i.flags?u:WV(u))!==i.check){e.msg="incorrect data check",i.mode=KV;break}u=0,d=0}i.mode=28;case 28:if(i.wrap&&i.flags){for(;d<32;){if(0===s)break e;s--,u+=r[o++]<<d,d+=8}if(u!==(4294967295&i.total)){e.msg="incorrect length check",i.mode=KV;break}u=0,d=0}i.mode=29;case 29:I=1;break e;case KV:I=-3;break e;case 31:return-4;default:return HV}return e.next_out=a,e.avail_out=c,e.next_in=o,e.avail_in=s,i.hold=u,i.bits=d,(i.wsize||h!==e.avail_out&&i.mode<KV&&(i.mode<27||4!==t))&&iF(e,e.output,e.next_out,h-e.avail_out),l-=e.avail_in,h-=e.avail_out,e.total_in+=l,e.total_out+=h,i.total+=h,i.wrap&&h&&(e.adler=i.check=i.flags?BV(i.check,n,h,e.next_out-h):FV(i.check,n,h,e.next_out-h)),e.data_type=i.bits+(i.last?64:0)+(i.mode===zV?128:0)+(20===i.mode||15===i.mode?256:0),(0===l&&0===h||4===t)&&0===I&&(I=-5),I},NV.inflateEnd=function(e){if(!e||!e.state)return HV;var t=e.state;return t.window&&(t.window=null),e.state=null,0},NV.inflateGetHeader=function(e,t){var i;return e&&e.state?0==(2&(i=e.state).wrap)?HV:(i.head=t,t.done=!1,0):HV},NV.inflateSetDictionary=function(e,t){var i,r=t.length;return e&&e.state?0!==(i=e.state).wrap&&11!==i.mode?HV:11===i.mode&&FV(1,t,r,0)!==i.check?-3:iF(e,t,r,r)?(i.mode=31,-4):(i.havedict=1,0):HV},NV.inflateInfo="pako inflate (from Nodeca project)";var rF={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 nF=NV,oF=zU,aF=uV,sF=rF,cF=Lx,uF=vV,dF=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},lF=Object.prototype.toString;function hF(e){if(!(this instanceof hF))return new hF(e);this.options=oF.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 uF,this.strm.avail_out=0;var i=nF.inflateInit2(this.strm,t.windowBits);if(i!==sF.Z_OK)throw new Error(cF[i]);if(this.header=new dF,nF.inflateGetHeader(this.strm,this.header),t.dictionary&&("string"==typeof t.dictionary?t.dictionary=aF.string2buf(t.dictionary):"[object ArrayBuffer]"===lF.call(t.dictionary)&&(t.dictionary=new Uint8Array(t.dictionary)),t.raw&&(i=nF.inflateSetDictionary(this.strm,t.dictionary))!==sF.Z_OK))throw new Error(cF[i])}function pF(e,t){var i=new hF(t);if(i.push(e,!0),i.err)throw i.msg||cF[i.err];return i.result}hF.prototype.push=function(e,t){var i,r,n,o,a,s=this.strm,c=this.options.chunkSize,u=this.options.dictionary,d=!1;if(this.ended)return!1;r=t===~~t?t:!0===t?sF.Z_FINISH:sF.Z_NO_FLUSH,"string"==typeof e?s.input=aF.binstring2buf(e):"[object ArrayBuffer]"===lF.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 oF.Buf8(c),s.next_out=0,s.avail_out=c),(i=nF.inflate(s,sF.Z_NO_FLUSH))===sF.Z_NEED_DICT&&u&&(i=nF.inflateSetDictionary(this.strm,u)),i===sF.Z_BUF_ERROR&&!0===d&&(i=sF.Z_OK,d=!1),i!==sF.Z_STREAM_END&&i!==sF.Z_OK)return this.onEnd(i),this.ended=!0,!1;s.next_out&&(0!==s.avail_out&&i!==sF.Z_STREAM_END&&(0!==s.avail_in||r!==sF.Z_FINISH&&r!==sF.Z_SYNC_FLUSH)||("string"===this.options.to?(n=aF.utf8border(s.output,s.next_out),o=s.next_out-n,a=aF.buf2string(s.output,n),s.next_out=o,s.avail_out=c-o,o&&oF.arraySet(s.output,s.output,n,o,0),this.onData(a)):this.onData(oF.shrinkBuf(s.output,s.next_out)))),0===s.avail_in&&0===s.avail_out&&(d=!0)}while((s.avail_in>0||0===s.avail_out)&&i!==sF.Z_STREAM_END);return i===sF.Z_STREAM_END&&(r=sF.Z_FINISH),r===sF.Z_FINISH?(i=nF.inflateEnd(this.strm),this.onEnd(i),this.ended=!0,i===sF.Z_OK):r!==sF.Z_SYNC_FLUSH||(this.onEnd(sF.Z_OK),s.avail_out=0,!0)},hF.prototype.onData=function(e){this.chunks.push(e)},hF.prototype.onEnd=function(e){e===sF.Z_OK&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=oF.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg},AV.Inflate=hF,AV.inflate=pF,AV.inflateRaw=function(e,t){return(t=t||{}).raw=!0,pF(e,t)},AV.ungzip=pF;var _F={};(0,zU.assign)(_F,KU,AV,rF);var fF=_F,vF="RTC_DEVICE_ID",mF="RTC_ACCESS_NODE",yF="RTC_ACCESS_URLS",SF="RTC_H264_BLACK_LIST",gF="engine_BAC",EF=function(){function e(){}return e.prototype.get=function(e){var t=localStorage.getItem(e);if(!t)return null;try{var i=JSON.parse(t);return i.ttl>0&&Date.now()-i.saveTime>i.ttl?(this.delete(e),null):i.message}catch(e){return null}},e.prototype.set=function(e,t,i){void 0===i&&(i=-1);var r={ttl:i,saveTime:Date.now(),message:t};try{return localStorage.setItem(e,JSON.stringify(r)),!0}catch(e){return!1}},e.prototype.delete=function(e){try{return localStorage.removeItem(e),!0}catch(e){return!1}},e}(),bF=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return C_(t,e),t.prototype.getDeviceId=function(){if(mU())return"";var e=this.get(vF);return e||(e=lU()),this.set(vF,e),e},t.prototype.setDeviceId=function(e){return[zB,KB,WB].forEach((function(t){return t.setStats({device_id:e})})),this.set(vF,e),e},t.prototype.getAccessNode=function(e){return this.get("".concat(mF,"_").concat(e,"-BytePlus"))},t.prototype.setAccessNode=function(e,t,i){},t.prototype.clearAccessNode=function(e){this.delete("".concat(mF,"_").concat(e,"-BytePlus"))},t.prototype.getAccessUrls=function(){return this.get("".concat(yF,"-BytePlus"))},t.prototype.setAccessUrls=function(e){},t.prototype.clearAccessUrls=function(){this.delete("".concat(yF,"-BytePlus"))},t.prototype.getH264BlackList=function(){return this.get(SF)},t.prototype.setH264BlackList=function(e){return this.set(SF,e)},t.prototype.getAudioProfile=function(){return this.get(gF)},t.prototype.setAudioProfile=function(e){return this.set(gF,e)},t}(EF),IF=new bF,TF="rtc-access.rtcplus.com,rtc-access-sg.rtcplus.com,rtc-access-va.rtcplus.com,rtc-access-fr.rtcplus.com".split(",");function AF(e){return void 0===e&&(e=""),"https://".concat(e,"/dispatch/v1/AccessInfo?Action=GetAccessInfo")}var RF="https://web-log-report.rtcplus.com/video/v1/webrtc_log/",CF="rtc.rtcplus.com".split(","),OF={VERSION:"4.45.0-blw.12",ICE_CONFIG_REQUEST_URLS_INTERNAL:TF.map(AF),ICE_CONFIG_REQUEST_URLS:[],EXPECTED_ADDR:"",LOG_SERVER_URL:RF,CONFIG_REQUEST_DOMAINS:CF,DEVICE_ID:"",OVERSEA:!1};function wF(e,t){if("VERSION"!==e)return"ICE_CONFIG_REQUEST_URLS"===e?("string"==typeof t&&(t=[t]),void(OF.ICE_CONFIG_REQUEST_URLS=t.map(AF))):void("LOG_SERVER_URL"!==e||t!==G_.overseas?"LOG_SERVER_URL"!==e||t!==G_.domestic?"LOG_SERVER_URL"!==e||"string"!=typeof t?"OVERSEA"!==e?("DEVICE_ID"===e&&IF.setDeviceId(t),OF[e]=t):OF.OVERSEA=t:OF.LOG_SERVER_URL=t:OF.LOG_SERVER_URL=RF:OF.LOG_SERVER_URL="https://web-log-report.rtcplus.com/video/v1/webrtc_log/")}function kF(e){return"DEVICE_ID"===e?IF.getDeviceId():OF[e]}function NF(e,t){var i,r,n,o,a,s,c,u,d,l,h,p,_,f,v,m,y;return{type:"transcode",action:e,transcodeMeta:{transcode:{url:t.url},control:{protocol:"2.0"},audio:{codec:(null===(i=t.audio)||void 0===i?void 0:i.codec)||DF.audio.codec,bitRate:1e3*((null===(r=t.audio)||void 0===r?void 0:r.kBitRate)||DF.audio.kBitRate),sampleRate:1e3*((null===(n=t.audio)||void 0===n?void 0:n.sampleRate)||DF.audio.sampleRate),channels:(null===(o=t.audio)||void 0===o?void 0:o.channels)||DF.audio.channels,profile:(null===(a=t.audio)||void 0===a?void 0:a.AACProfile)||DF.audio.AACProfile},video:{codec:(null===(s=t.video)||void 0===s?void 0:s.codec)||DF.video.codec,fps:(null===(c=t.video)||void 0===c?void 0:c.fps)||DF.video.fps,gop:(null===(u=t.video)||void 0===u?void 0:u.gop)||DF.video.gop,lowLatency:null!==(l=null===(d=t.video)||void 0===d?void 0:d.lowLatency)&&void 0!==l?l:DF.video.lowLatency,bitRate:1e3*((null===(h=t.video)||void 0===h?void 0:h.kBitRate)||DF.video.kBitRate),width:(null===(p=t.video)||void 0===p?void 0:p.width)||DF.video.width,height:(null===(_=t.video)||void 0===_?void 0:_.height)||DF.video.height},layout:{canvas:{bgnd:(null===(f=t.layout)||void 0===f?void 0:f.backgroundColor)||DF.layout.backgroundColor},regions:(null===(m=null===(v=t.layout)||void 0===v?void 0:v.regions)||void 0===m?void 0:m.map((function(e){return{alpha:Math.min(Math.max(+e.alpha,0),1),uid:e.userId,zorder:e.zorder,x:Math.min(Math.max(+e.x,0),1),y:Math.min(Math.max(+e.y,0),1),w:Math.min(Math.max(+e.w,0),1),h:Math.min(Math.max(+e.h,0),1),renderMode:e.renderMode||1,contentControl:e.contentControl||0,screen:e.isScreenStream,local_user:e.isLocalUser}})))||[],app_data:(null===(y=t.layout)||void 0===y?void 0:y.appData)||DF.layout.appData}}}}function PF(e,t,i){var r,n,o,a,s,c,u,d,l;return{type:"publicstream",action:t,publicStreamID:e,publicStreamMeta:{audio:{},video:{fps:(null===(r=i.video)||void 0===r?void 0:r.fps)||15,bitrate:1e3*((null===(n=i.video)||void 0===n?void 0:n.kBitRate)||40),width:(null===(o=i.video)||void 0===o?void 0:o.width)||640,height:(null===(a=i.video)||void 0===a?void 0:a.height)||360},layout:{layoutMode:2,interpolationMode:(null===(s=i.layout)||void 0===s?void 0:s.interpolationMode)||K_.PREV_FRAME,canvas:{bgColor:(null===(c=i.layout)||void 0===c?void 0:c.backgroundColor)||"#000000",bgImage:(null===(u=i.layout)||void 0===u?void 0:u.backgroundImage)||""},regions:(null===(l=null===(d=i.layout)||void 0===d?void 0:d.regions)||void 0===l?void 0:l.map((function(e){return{roomId:e.roomId,userId:e.userId,alterImage:e.alertImage||"",alpha:e.alpha,x:Math.min(Math.max(+e.x,0),1),y:Math.min(Math.max(+e.y,0),1),w:Math.min(Math.max(+e.w,0),1),h:Math.min(Math.max(+e.h,0),1),zorder:e.zorder,renderMode:void 0===e.renderMode?1:e.renderMode,streamType:e.isScreenStream?1:0,mediaType:e.mediaType||0,sourceCrop:e.sourceCrop}})))||[]}}}}var DF={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"}},MF=[{width:320,height:180,frameRate:15,maxKbps:200},{width:640,height:360,frameRate:15,maxKbps:500},{width:640,height:480,frameRate:15,maxKbps:600},{width:960,height:540,frameRate:15,maxKbps:900},{width:1280,height:720,frameRate:15,maxKbps:2e3},{width:1920,height:1080,frameRate:15,maxKbps:3500}];var LF={width:640,height:360,frameRate:30,maxKbps:600},UF={width:1920,height:1080,frameRate:15,maxKbps:3e3},xF={exports:{}};!function(e){var t=Object.prototype.hasOwnProperty,i="~";function r(){}function n(e,t,i){this.fn=e,this.context=t,this.once=i||!1}function o(e,t,r,o,a){if("function"!=typeof r)throw new TypeError("The listener must be a function");var s=new n(r,o||e,a),c=i?i+t:t;return e._events[c]?e._events[c].fn?e._events[c]=[e._events[c],s]:e._events[c].push(s):(e._events[c]=s,e._eventsCount++),e}function a(e,t){0==--e._eventsCount?e._events=new r:delete e._events[t]}function s(){this._events=new r,this._eventsCount=0}Object.create&&(r.prototype=Object.create(null),(new r).__proto__||(i=!1)),s.prototype.eventNames=function(){var e,r,n=[];if(0===this._eventsCount)return n;for(r in e=this._events)t.call(e,r)&&n.push(i?r.slice(1):r);return Object.getOwnPropertySymbols?n.concat(Object.getOwnPropertySymbols(e)):n},s.prototype.listeners=function(e){var t=i?i+e:e,r=this._events[t];if(!r)return[];if(r.fn)return[r.fn];for(var n=0,o=r.length,a=new Array(o);n<o;n++)a[n]=r[n].fn;return a},s.prototype.listenerCount=function(e){var t=i?i+e:e,r=this._events[t];return r?r.fn?1:r.length:0},s.prototype.emit=function(e,t,r,n,o,a){var s=i?i+e:e;if(!this._events[s])return!1;var c,u,d=this._events[s],l=arguments.length;if(d.fn){switch(d.once&&this.removeListener(e,d.fn,void 0,!0),l){case 1:return d.fn.call(d.context),!0;case 2:return d.fn.call(d.context,t),!0;case 3:return d.fn.call(d.context,t,r),!0;case 4:return d.fn.call(d.context,t,r,n),!0;case 5:return d.fn.call(d.context,t,r,n,o),!0;case 6:return d.fn.call(d.context,t,r,n,o,a),!0}for(u=1,c=new Array(l-1);u<l;u++)c[u-1]=arguments[u];d.fn.apply(d.context,c)}else{var h,p=d.length;for(u=0;u<p;u++)switch(d[u].once&&this.removeListener(e,d[u].fn,void 0,!0),l){case 1:d[u].fn.call(d[u].context);break;case 2:d[u].fn.call(d[u].context,t);break;case 3:d[u].fn.call(d[u].context,t,r);break;case 4:d[u].fn.call(d[u].context,t,r,n);break;default:if(!c)for(h=1,c=new Array(l-1);h<l;h++)c[h-1]=arguments[h];d[u].fn.apply(d[u].context,c)}}return!0},s.prototype.on=function(e,t,i){return o(this,e,t,i,!1)},s.prototype.once=function(e,t,i){return o(this,e,t,i,!0)},s.prototype.removeListener=function(e,t,r,n){var o=i?i+e:e;if(!this._events[o])return this;if(!t)return a(this,o),this;var s=this._events[o];if(s.fn)s.fn!==t||n&&!s.once||r&&s.context!==r||a(this,o);else{for(var c=0,u=[],d=s.length;c<d;c++)(s[c].fn!==t||n&&!s[c].once||r&&s[c].context!==r)&&u.push(s[c]);u.length?this._events[o]=1===u.length?u[0]:u:a(this,o)}return this},s.prototype.removeAllListeners=function(e){var t;return e?(t=i?i+e:e,this._events[t]&&a(this,t)):(this._events=new r,this._eventsCount=0),this},s.prototype.off=s.prototype.removeListener,s.prototype.addListener=s.prototype.on,s.prefixed=i,s.EventEmitter=s,e.exports=s}(xF);var VF,FF,BF,jF,GF,HF,zF,KF,WF,XF,qF,YF,JF,QF,ZF,$F,eB,tB,iB,rB,nB,oB,aB,sB,cB,uB,dB,lB,hB,pB,_B,fB,vB,mB,yB,SB,gB,EB,bB,IB,TB,AB,RB,CB,OB,wB,kB,NB=xF.exports,PB="[VERTC]",DB=["#0050b3","#0050b3","#0050b3","#0050b3","#0050b3"],MB=!mU()&&window.location.search.includes("_rtc_debug_"),LB=function(){function e(e,t,i){this._module=e,this._indent=t}return e.prototype.print=function(e){for(var t=[],i=1;i<arguments.length;i++)t[i-1]=arguments[i];if(window._ve_sdk_cb&&window._ve_sdk_cb.apply(window,af(["".concat(PB,"[").concat(this._module,".").concat(e,"] ").concat(t.shift())],of(t),!1)),MB){for(var r="",n=0;n<this._indent;n++)r+=" ";console.log.apply(console,af(["%c".concat(UB(),"-").concat(PB).concat(r,"[").concat(this._module,".").concat(e,"] ").concat(t.shift()),"color:".concat(DB[this._indent],";")],of(t),!1))}},e}(),UB=function(){var e=new Date;return e.toTimeString().split(" ")[0]+":"+e.getMilliseconds()},xB=new LB("VERTC",0),VB=function(e){function t(){return e.call(this)||this}return C_(t,e),t.prototype.safeEmit=function(t){for(var i=[],r=1;r<arguments.length;r++)i[r-1]=arguments[r];var n=this.listenerCount(t);try{return e.prototype.emit.apply(this,af([t],of(i),!1))}catch(e){return xB.print("safaEmit","safeEmit() | event listener threw an error [event:%s]:%o",t,e),Boolean(n)}},t.prototype.safeEmitAsPromise=function(e){for(var t=[],i=1;i<arguments.length;i++)t[i-1]=arguments[i];return tf(this,void 0,void 0,(function(){var i=this;return rf(this,(function(r){return[2,new Promise((function(r,n){try{i.emit.apply(i,af(af([e],of(t),!1),[r,n],!1))}catch(t){xB.print("safeEmitAsPromise","safeEmitAsPromise() | event listener threw an error [event:%s]:%o",e,t),n(t)}}))]}))}))},t}(xF.exports.EventEmitter);!function(e){e.RTC_SDK_API_CALL="rtc_sdk_api_call",e.RTC_SDK_CALLBACK="rtc_sdk_callback",e.RTC_GET_CONFIG="rtc_get_config",e.RTC_RECONNECT="rtc_reconnect",e.RTC_RECONNECTED="rtc_reconnected",e.RTC_GET_ACCESS="rtc_get_access",e.RTC_PRE_ICE_STATE="rtc_pre_ice_state",e.RTC_NODE_CHANGE="rtc_node_change",e.RTC_SIGNALING_MSG_ERROR="rtc_signaling_msg_error",e.RTC_SIGNALING="rtc_signaling",e.RTC_JOIN_ROOM="rtc_join_room",e.RTC_LEAVE_ROOM="rtc_leave_room",e.RTC_BEGIN_CREATE_OFFER="rtc_begin_create_offer",e.RTC_CREATE_OFFER="rtc_create_offer",e.RTC_SET_DESCRIPTION="rtc_set_description",e.RTC_RECV_ANSWER="rtc_recv_answer",e.FIRST_REMOTE_AUDIO_RENDER="first_remote_audio_render",e.FIRST_REMOTE_VIDEO_RENDER="first_remote_video_render",e.RTC_PUBLISH_STAT="rtc_publish_stat",e.RTC_SUBSCRIBE_STAT="rtc_subscribe_stat",e.RTC_AUDIO_DEVICE="rtc_audio_device",e.RTC_MEDIA_STATISTICS="rtc_media_statistics",e.RTC_MESSAGE_STATISTICS="rtc_message_statistics",e.RTC_ERROR="rtc_error",e.RTC_INVOKE_STATUS="rtc_invoke_status",e.RTC_FIRST_FRAME="rtc_first_frame",e.RTC_MUTE_REMOTE="rtc_mute_remote",e.SDK_INIT_ENGINE="sdk_init_engine",e.JOIN_ROOM="join_room",e.P2P_CONNECTION_STATUS="p2p_connection_status",e.P2P_CONNECT_CLOSED="p2p_connect_closed",e.RTC_DEVICE_ERROR="rtc_device_error",e.RTC_VIDEO_DEVICE="rtc_video_device",e.RTC_VIDEO_CAPTURE_EVENT="rtc_video_capture_event",e.RTC_ENCODE_FIRST_FRAME="rtc_encode_first_frame",e.RTC_FIRST_FRAME_ENCODED="rtc_first_frame_encoded",e.RTC_SEND_FIRST_PACKET="rtc_send_first_packet",e.RTC_RECV_FIRST_PACKET="rtc_recv_first_packet",e.RTC_RECV_FIRST_FRAME="rtc_recv_first_frame",e.RTC_DECODE_FIRST_FRAME="rtc_decode_first_frame"}(VF||(VF={})),function(e){e.RTC="rtc"}(FF||(FF={})),function(e){e.W_5="5"}(BF||(BF={})),function(e){e.IOS="ios",e.ANDROID="android",e.WEB="web",e.WINDOWS="windows",e.MAC="mac",e.LINUX="linux"}(jF||(jF={})),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"}(GF||(GF={})),function(e){e.UNKNOWN="unknown",e.BROADCASTER="broadcaster",e.AUDIENCE="audience",e.SILENTAUDIENCE="silentAudience"}(HF||(HF={})),function(e){e.REQUEST="request",e.RESPONSE="response"}(zF||(zF={})),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"}(KF||(KF={})),function(e){e.WEBSOCKET="websocket",e.NETWORKCHANGED="networkChanged",e.PEERCONNECTION="peerconnection"}(WF||(WF={})),function(e){e.WEBSOCKET_RECONNECTED="websocket reconnected",e.PEERCONNECTION_RECONNECTED="peerconnection reconnected"}(XF||(XF={})),function(e){e.WEBSOCKET="websocket",e.NETWORKCHANGED="networkChanged",e.PEERCONNECTION="peerconnection"}(qF||(qF={})),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"}(YF||(YF={})),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"}(JF||(JF={})),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"}(QF||(QF={})),function(e){e.CALL_JOINROOM="call-joinRoom",e.JOINROOM="joinRoom",e.CALL_RECONNECTED="call-reconnected",e.RECONNECTED="reconnected",e.CALL_PUBLISH="call-publish",e.PUBLISH="publish",e.CALL_UPDATESTREAMATTRIBUTES="call-updateStreamAttributes",e.UPDATESTREAMATTRIBUTES="updateStreamAttributes",e.CALL_UNPUBLISH="call-unpublish",e.UNPUBLISH="unpublish",e.CALL_SUBSCRIBE="call-subscribe",e.SUBSCRIBE="subscribe",e.CALL_UPDATESUBSCRIBE="call-updateSubscribe",e.UPDATESUBSCRIBE="updateSubscribe",e.CALL_UNSUBSCRIBE="call-unsubscribe",e.UNSUBSCRIBE="unsubscribe",e.CALL_UPDATEUSERATTRIBUTES="call-updateUserAttributes",e.UPDATEUSERATTRIBUTES="updateUserAttributes",e.CALL_LEAVEROOM="call-leaveRoom",e.LEAVEROOM="leaveRoom",e.ON_USERCONNECTION="on-userConnection",e.ON_USERDISCONNECTION="on-userDisconnection",e.ON_ONADDSTREAM="on-onAddStream",e.ON_ONPUSHSTREAM="on-onPushStream",e.ON_ONREMOVESTREAM="on-onRemoveStream",e.ON_ONPUSHTRACK="on-onPushTrack",e.ON_ONREMOVETRACK="on-onRemoveTrack",e.ON_ONUPDATEUSERATTRIBUTES="on-onUpdateUserAttributes",e.ON_ONUPDATEROOMATTRIBUTES="on-onUpdateRoomAttributes",e.ON_ONUPDATESTREAMATTRIBUTES="on-onUpdateStreamAttributes",e.ON_STREAMFAILED="on-streamFailed",e.ON_POSTPROCESSINGMESSAGE="on-postProcessingMessage",e.ON_ENGINECONTROLMESSAGE="on-engineControlMessage",e.ON_WEBSOCKETENGINECUSTOMMESSAGE="on-websocketEngineCustomMessage",e.UNKNOWN="unknown",e.CALL_UPDATEPUBLISHSTREAMCHANNEL="call-updatePublishStreamChannel",e.UPDATEPUBLISHSTREAMCHANNEL="updatePublishStreamChannel",e.CALL_UPDATESUBSCRIBESTREAMCHANNEL="call-updateSubscribeStreamChannel",e.UPDATESUBSCRIBESTREAMCHANNEL="updateSubscribeStreamChannel",e.ON_ONSTREAMCHANNELCHANGE="on-onStreamChannelChange",e.P2PDIRECT="p2pdirect",e.INTERNAL_CUSTOM="internal_custom",e.REPORT="report",e.CONNECTION_CONTROL="connection_control",e.ON_INTERNAL_CUSTOM="on_internal_custom",e.CONTROLMESSAGE="controlMessage",e.CALL_LOGIN="call-login",e.LOGIN="login",e.CALL_RECONNECTLOGIN="call-reconnectLogin",e.RECONNECTLOGIN="reconnectLogin",e.CALL_LOGOUT="call-logout",e.LOGOUT="logout",e.CALL_UPDATELOGINTOKEN="call-updateLoginToken",e.UPDATELOGINTOKEN="updateLoginToken",e.CALL_SETSERVERPARAMS="call-setServerParams",e.SETSERVERPARAMS="setServerParams",e.CALL_GETPEERONLINESTATUS="call-getPeerOnlineStatus",e.GETPEERONLINESTATUS="getPeerOnlineStatus",e.ON_ONSCENECONFIG="on-onSceneConfig",e.ON_STREAMCONTROLMESSAGE="on-streamControlMessage",e.CALL_STARTPUSHSTREAM="call-startPushStream",e.STARTPUSHSTREAM="startPushStream",e.CALL_STOPPUSHSTREAM="call-stopPushStream",e.STOPPUSHSTREAM="stopPushStream",e.CALL_STARTPULLSTREAM="call-startPullStream",e.STARTPULLSTREAM="startPullStream",e.CALL_STOPPULLSTREAM="call-stopPullStream",e.STOPPULLSTREAM="stopPullStream",e.CALL_UPDATEPULLSTREAM="call-updatePullStream",e.UPDATEPULLSTREAM="updatePullStream",e.ON_ONSTREAMPUSHEDBYOTHER="on-onStreamPushedByOther",e.CALL_UPDATETOKEN="call-updateToken",e.UPDATETOKEN="updateToken",e.ON_ONTOKENWILLEXPIRE="on-onTokenWillExpire",e.ON_ONPUSHCLIENTCONFIG="on-onPushClientConfig",e.CALL_GETCLIENTCONFIG="call-getClientConfig",e.GETCLIENTCONFIG="getClientConfig"}(ZF||(ZF={})),function(e){e.UP="up",e.DOWN="down",e.DIRECT="direct"}($F||($F={})),function(e){e.UP="up",e.DOWN="down",e.PRE="pre"}(eB||(eB={})),function(e){e.UP="up",e.DOWN="down",e.PRE="pre"}(tB||(tB={})),function(e){e.W_0="0",e.W_1="1"}(iB||(iB={})),function(e){e.UP="up",e.DOWN="down"}(rB||(rB={})),function(e){e.ANSWER="answer",e.INCRANSWER="incranswer"}(nB||(nB={})),function(e){e.UP="up",e.DOWN="down"}(oB||(oB={})),function(e){e.SUCCESS="success",e.FAIL="fail"}(aB||(aB={})),function(e){e.W_0="0",e.W_1="1"}(sB||(sB={})),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"}(cB||(cB={})),function(e){e.SUCCESS="success",e.FAIL="fail",e.IGNORE="ignore"}(uB||(uB={})),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"}(dB||(dB={})),function(e){e.PLAYOUT_DEVICE_SWITCH="playout_device_switch",e.RECORD_DEVICE_SWITCH="record_device_switch",e.UNKNOWN="unknown"}(lB||(lB={})),function(e){e.BEGIN_SEND="begin_send",e.SENT_END="sent_end",e.BEGIN_RECV="begin_recv",e.RECV_END="recv_end"}(hB||(hB={})),function(e){e.AUDIO="audio",e.VIDEO="video",e.SCREEN_VIDEO="screen_video",e.SCREEN_AUDIO="screen_audio"}(pB||(pB={})),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"}(_B||(_B={})),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"}(fB||(fB={})),function(e){e.AUDIO="audio",e.VIDEO="video"}(vB||(vB={})),function(e){e.BEGIN="begin",e.END="end"}(mB||(mB={})),function(e){e.BEGIN="begin",e.END="end"}(yB||(yB={})),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"}(SB||(SB={})),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"}(gB||(gB={})),function(e){e.NOMINAL="Nominal",e.FAIR="Fair",e.SERIOUS="Serious",e.CRITICAL="Critical",e.UNKNWON="Unknwon"}(EB||(EB={})),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"}(bB||(bB={})),function(e){e.P2P="p2p",e.P2P_OUTSIDE_ROOM="p2p_outside_room",e.P2SERVER="p2server"}(IB||(IB={})),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"}(TB||(TB={})),function(e){e.DSHOW="dshow",e.MF="mf",e.AVCAPTURESESSION="avcapturesession",e.CAMERA1="camera1",e.CAMERA2="camera2",e.VECAMERA="vecamera"}(AB||(AB={})),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"}(RB||(RB={})),function(e){e.UNKNOWN="unknown",e.MUSIC="music",e.HIGHQUALITY_COMMUNICATION="highquality_communication",e.COMMUNICATION="communication",e.MEDIA="media",e.GAME_STREAMING="game_streaming"}(CB||(CB={})),function(e){e.UNKNOWN="unknown",e.MEDIA="media",e.COMMUNICATION="communication"}(OB||(OB={})),function(e){e.UNKNOWN="unknown",e.SLEEP="Sleep",e.AWAKE="Awake"}(wB||(wB={})),function(e){e.UNKNOWN="unknown",e.PRODUCT="product",e.BOE="boe",e.TEST="test"}(kB||(kB={}));var FB=function(){function e(e){this.monitor=e}return e.prototype.setStats=function(e){var t=this;Object.keys(e).forEach((function(i){t["_"+i]=e[i]})),this.monitor.StartUp()},Object.defineProperty(e.prototype,"event_key",{get:function(){return this._event_key},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"device_id",{get:function(){return this._device_id},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"rtc_app_id",{get:function(){return this._rtc_app_id},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"product_line",{get:function(){return this._product_line},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"report_version",{get:function(){return this._report_version},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"os",{get:function(){return this._os},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"rtc_sdk_version",{get:function(){return this._rtc_sdk_version},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"rtc_timestamp",{get:function(){return this._rtc_timestamp},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"rtc_sdk_git_commit",{get:function(){return this._rtc_sdk_git_commit},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"report_id",{get:function(){return this._report_id},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"connection_id",{get:function(){return this._connection_id},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"rtc_sid",{get:function(){return this._rtc_sid},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"engine_session_id",{get:function(){return this._engine_session_id},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"rtc_business_id",{get:function(){return this._rtc_business_id},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"project_key",{get:function(){return this._project_key},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"network_type",{get:function(){return this._network_type},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"app_version",{get:function(){return this._app_version},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"aid",{get:function(){return this._aid},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"device_model",{get:function(){return this._device_model},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"device_brand",{get:function(){return this._device_brand},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"common_extra_info",{get:function(){return this._common_extra_info},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"had_selected_p2p",{get:function(){return this._had_selected_p2p},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"rtc_env_type",{get:function(){return this._rtc_env_type},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"room_id",{get:function(){return this._room_id},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"user_id",{get:function(){return this._user_id},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"rtc_session_id",{get:function(){return this._rtc_session_id},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"user_agent",{get:function(){return this._user_agent},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"auto_play_policy",{get:function(){return this._auto_play_policy},enumerable:!1,configurable:!0}),e}(),BB=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 FB(t),mU()||window.addEventListener("beforeunload",(function(){clearTimeout(t.errSendTimer),clearTimeout(t.sucSendTimer),t.send(null,!0)})),t}return C_(t,e),t.prototype.push=function(e,t){t?this.send(e):(this.dataBuffer.push(e),!this.posting&&!this.errSendTimer&&Date.now()-this.preSucTime>2e3&&(clearTimeout(this.sucSendTimer),this.send()))},t.prototype.unshift=function(e){this.dataBuffer=e.concat(this.dataBuffer)},t.prototype.send=function(e,t){var i=this;if(e||this.dataBuffer.length){var r={data:e||this.dataBuffer.splice(0,4e3),header:this.report_common,from:"web",os:"web",version:"1"},n=new XMLHttpRequest;n.timeout=1e4,n.onreadystatechange=function(){if(4===n.readyState){e||(i.posting=!1);var o=void 0;if(200===n.status||304===n.status)try{o=JSON.parse(n.responseText)}catch(e){}o&&0===o.StatusCode?e||t||i.sucSend():e?i.send(e):(i.unshift(r.data),t?i.send():i.errSend())}};var o=OF.LOG_SERVER_URL;if(n.open("POST",o,!0),e||(this.posting=!0),!mU()&&location.search.includes("_rtc_autotest_"))this.safeEmit("report_event",r),0!==this.dataBuffer.length?this.sucSend():this.posting=!1;else if(!mU()&&location.search.includes("_rtc_debug_"))n.send(JSON.stringify(r));else{var a=fF.gzip(JSON.stringify(r));n.setRequestHeader("Content-Encoding","gzip"),n.setRequestHeader("Content-Type","application/x-www-form-urlencoded; charset=UTF-8"),n.send(a)}}},t.prototype.sucSend=function(){this.errSendDelay=100,this.preSucTime=Date.now(),this.sucSendTimer=setTimeout(this.send.bind(this),2e3)},t.prototype.errSend=function(){var e=this;this.errSendTimer=setTimeout((function(){e.send(),e.errSendTimer=null}),this.errSendDelay),this.errSendDelay*=2},t.prototype.StartUp=function(){var e=this.report_common,t=this.commonStats,i=t.event_key,r=t.device_id,n=t.rtc_app_id,o=t.product_line,a=t.report_version,s=t.os,c=t.rtc_sdk_version,u=t.rtc_timestamp,d=t.rtc_sdk_git_commit,l=t.report_id,h=t.rtc_sid,p=t.engine_session_id,_=t.rtc_business_id,f=t.project_key,v=t.network_type,m=t.app_version,y=t.aid,S=t.device_model,g=t.device_brand,E=t.common_extra_info,b=t.had_selected_p2p,I=t.rtc_env_type,T=t.user_agent,A=t.auto_play_policy;Object.assign(e,{event_key:i,device_id:r,rtc_app_id:n,product_line:o,report_version:a,os:s,rtc_sdk_version:c,rtc_timestamp:u,rtc_sdk_git_commit:d,report_id:l,rtc_sid:h,engine_session_id:p,rtc_business_id:_,project_key:f,network_type:v,app_version:m,aid:y,device_model:S,device_brand:g,common_extra_info:E,had_selected_p2p:b,rtc_env_type:I,user_agent:T,auto_play_policy:A}),this.commonStats.room_id&&(this.modify_ids.room_id=this.commonStats.room_id),this.commonStats.user_id&&(this.modify_ids.user_id=this.commonStats.user_id),this.commonStats.rtc_session_id&&(this.modify_ids.rtc_session_id=this.commonStats.rtc_session_id),this.commonStats.connection_id&&(this.modify_ids.connection_id=this.commonStats.connection_id)},t.prototype.rtcSdkApiCall=function(e,t,i,r){void 0===r&&(r={});var n=$_($_({event_key:"rtc_sdk_api_call",report_id:this.report_id++,rtc_timestamp:Date.now(),sdk_api_name:e,error_code:t,message:i},this.modify_ids),{common_extra_info:JSON.stringify(r)});r.streamId&&(n.stream_id=r.streamId),this.push(n)},t.prototype.rtcSdkCallback=function(e,t,i,r){void 0===r&&(r={});var n=$_($_({event_key:"rtc_sdk_callback",report_id:this.report_id++,rtc_timestamp:Date.now(),sdk_callback_name:e,error_code:t,message:i},this.modify_ids),{common_extra_info:JSON.stringify(r)});this.push(n)},t.prototype.rtcGetConfig=function(e,t,i,r,n,o,a,s){void 0===s&&(s={});var c=$_($_({event_key:"rtc_get_config",report_id:this.report_id++,rtc_timestamp:Date.now(),error_code:e,message:t,elapse:i,host:r,type:n,config_id:o,enable_cloud_proxy:a},this.modify_ids),{common_extra_info:JSON.stringify(s)});this.push(c)},t.prototype.rtcReconnect=function(e,t,i,r,n){void 0===n&&(n={});var o=$_($_({event_key:"rtc_reconnect",report_id:this.report_id++,rtc_timestamp:Date.now(),error_code:e,message:t,reconnect_id:i,reconnect_type:r},this.modify_ids),{common_extra_info:JSON.stringify(n)});this.push(o)},t.prototype.rtcReconnected=function(e,t,i){void 0===i&&(i={});var r=$_($_({event_key:"rtc_reconnected",report_id:this.report_id++,rtc_timestamp:Date.now(),message:e,reconnect_type:t},this.modify_ids),{common_extra_info:JSON.stringify(i)});this.push(r)},t.prototype.rtcGetAccess=function(e,t,i,r,n,o,a){void 0===a&&(a={});var s=$_($_({event_key:"rtc_get_access",report_id:this.report_id++,rtc_timestamp:Date.now(),error_code:e,message:t,elapse:i,type:r,host:n,connect_session_id:o},this.modify_ids),{common_extra_info:JSON.stringify(a)});this.push(s)},t.prototype.rtcPreIceState=function(e,t,i){void 0===i&&(i={});var r=$_($_({event_key:"rtc_pre_ice_state",report_id:this.report_id++,rtc_timestamp:Date.now(),message:e,ice_state:t},this.modify_ids),{common_extra_info:JSON.stringify(i)});this.push(r)},t.prototype.rtcNodeChange=function(e,t,i,r){void 0===r&&(r={});var n=$_($_({event_key:"rtc_node_change",report_id:this.report_id++,rtc_timestamp:Date.now(),error_code:e,message:t,reason:i},this.modify_ids),{common_extra_info:JSON.stringify(r)});this.push(n)},t.prototype.rtcSignalingMsgError=function(e,t,i,r){void 0===r&&(r={});var n=$_($_({event_key:"rtc_signaling_msg_error",report_id:this.report_id++,rtc_timestamp:Date.now(),error_code:e,message:t,reason:i},this.modify_ids),{common_extra_info:JSON.stringify(r)});this.push(n)},t.prototype.rtcSignaling=function(e,t,i,r,n,o){void 0===o&&(o={});var a=$_($_({event_key:"rtc_signaling",report_id:this.report_id++,rtc_timestamp:Date.now(),error_code:e,message:t,signaling_event:i,signaling_type:r,direction:n},this.modify_ids),{common_extra_info:JSON.stringify(o)});this.push(a)},t.prototype.rtcJoinRoom=function(e,t,i,r,n){void 0===n&&(n={});var o=$_($_({event_key:"rtc_join_room",report_id:this.report_id++,rtc_timestamp:Date.now(),error_code:e,deviceModel:t,deviceManufacturer:i,elapse:r},this.modify_ids),{common_extra_info:JSON.stringify(n)});this.push(o)},t.prototype.rtcLeaveRoom=function(e,t,i,r){void 0===r&&(r={});var n=$_($_({event_key:"rtc_leave_room",report_id:this.report_id++,rtc_timestamp:Date.now(),error_code:e,message:t,elapse:i},this.modify_ids),{common_extra_info:JSON.stringify(r)});this.push(n)},t.prototype.rtcBeginCreateOffer=function(e,t,i,r){void 0===r&&(r={});var n=$_($_({event_key:"rtc_begin_create_offer",report_id:this.report_id++,rtc_timestamp:Date.now(),direction:e,stream_id:t,stream_user_id:i},this.modify_ids),{common_extra_info:JSON.stringify(r)});this.push(n)},t.prototype.rtcCreateOffer=function(e,t,i,r,n,o){void 0===o&&(o={});var a=$_($_({event_key:"rtc_create_offer",report_id:this.report_id++,rtc_timestamp:Date.now(),error_code:e,direction:t,stream_id:i,stream_user_id:r,elapse:n},this.modify_ids),{common_extra_info:JSON.stringify(o)});this.push(a)},t.prototype.rtcSetDescription=function(e,t,i,r,n,o,a,s){void 0===s&&(s={});var c=$_($_({event_key:"rtc_set_description",report_id:this.report_id++,rtc_timestamp:Date.now(),error_code:e,message:t,is_local:i,direction:r,stream_id:n,stream_user_id:o,elapse:a},this.modify_ids),{common_extra_info:JSON.stringify(s)});this.push(c)},t.prototype.rtcRecvAnswer=function(e,t,i,r,n,o,a,s){void 0===s&&(s={});var c=$_($_({event_key:"rtc_recv_answer",report_id:this.report_id++,rtc_timestamp:Date.now(),error_code:e,answer_type:t,sequence_id:i,message:r,direction:n,stream_id:o,stream_user_id:a},this.modify_ids),{common_extra_info:JSON.stringify(s)});this.push(c)},t.prototype.firstRemoteAudioRender=function(e,t,i){void 0===i&&(i={});var r=$_($_({event_key:"first_remote_audio_render",report_id:this.report_id++,rtc_timestamp:Date.now(),stream_id:e,stream_user_id:t},this.modify_ids),{common_extra_info:JSON.stringify(i)});this.push(r)},t.prototype.firstRemoteVideoRender=function(e,t,i){void 0===i&&(i={});var r=$_($_({event_key:"first_remote_video_render",report_id:this.report_id++,rtc_timestamp:Date.now(),stream_id:e,stream_user_id:t},this.modify_ids),{common_extra_info:JSON.stringify(i)});this.push(r)},t.prototype.rtcPublishStat=function(e,t,i,r,n){void 0===n&&(n={});var o=$_($_({event_key:"rtc_publish_stat",report_id:this.report_id++,rtc_timestamp:Date.now(),result:e,is_screen:t,start:i,message:r},this.modify_ids),{common_extra_info:JSON.stringify(n)});this.push(o)},t.prototype.rtcSubscribeStat=function(e,t,i,r,n){void 0===n&&(n={});var o=$_($_({event_key:"rtc_subscribe_stat",report_id:this.report_id++,rtc_timestamp:Date.now(),result:e,start:t,message:i,stream_user_id:r},this.modify_ids),{common_extra_info:JSON.stringify(n)});this.push(o)},t.prototype.rtcAudioDevice=function(e,t,i,r){void 0===r&&(r={});var n=$_($_({event_key:"rtc_audio_device",report_id:this.report_id++,rtc_timestamp:Date.now(),audio_event:e,message:t,error_code:i},this.modify_ids),{common_extra_info:JSON.stringify(r)});this.push(n)},t.prototype.rtcMediaStatistics=function(e,t,i){void 0===i&&(i={});var r=$_($_($_($_({event_key:"rtc_media_statistics",report_id:this.report_id++,rtc_timestamp:Date.now()},e),t),this.modify_ids),{common_extra_info:JSON.stringify(i)});this.push(r)},t.prototype.rtcMessageStatistics=function(e,t,i,r){void 0===r&&(r={});var n=$_($_({event_key:"rtc_message_statistics",report_id:this.report_id++,rtc_timestamp:Date.now(),dc_user_message:e,dc_room_message:t,media_server_ip:i},this.modify_ids),{common_extra_info:JSON.stringify(r)});this.push(n)},t.prototype.rtcError=function(e,t,i){void 0===i&&(i={});var r=$_($_({event_key:"rtc_error",report_id:this.report_id++,rtc_timestamp:Date.now(),message:e,error_code:t},this.modify_ids),{common_extra_info:JSON.stringify(i)});this.push(r)},t.prototype.rtcInvokeStatus=function(e,t,i,r,n,o){void 0===o&&(o={});var a=$_($_({event_key:"rtc_invoke_status",report_id:this.report_id++,rtc_timestamp:Date.now(),message:e,error_code:t,sdk_api_name:i,stream_id:r,elapse:n},this.modify_ids),{common_extra_info:JSON.stringify(o)});this.push(a)},t.prototype.rtcFirstFrame=function(e,t){void 0===t&&(t={});var i=$_($_($_({event_key:"rtc_first_frame",report_id:this.report_id++,rtc_timestamp:Date.now()},e),this.modify_ids),{common_extra_info:JSON.stringify(t)});this.push(i)},t.prototype.rtcMuteRemote=function(e,t,i){void 0===i&&(i={});var r=$_($_({event_key:"rtc_mute_remote",report_id:this.report_id++,rtc_timestamp:Date.now(),mute_info:e,media_type:t},this.modify_ids),{common_extra_info:JSON.stringify(i)});this.push(r)},t.prototype.sdkInitEngine=function(e,t,i){void 0===i&&(i={});var r=$_($_({event_key:"sdk_init_engine",report_id:this.report_id++,rtc_timestamp:Date.now(),start:e,type:t},this.modify_ids),{common_extra_info:JSON.stringify(i)});this.push(r)},t.prototype.joinRoom=function(e,t,i,r,n){void 0===n&&(n={});var o=$_($_({event_key:"join_room",report_id:this.report_id++,rtc_timestamp:Date.now(),type:e,start:t,result:i,reason:r},this.modify_ids),{common_extra_info:JSON.stringify(n)});this.push(o)},t.prototype.p2pConnectionStatus=function(e,t,i,r,n,o){void 0===o&&(o={});var a=$_($_({event_key:"p2p_connection_status",report_id:this.report_id++,rtc_timestamp:Date.now(),room_id:e,user_id:t,peer_user_id:i,status:r,elapse:n},this.modify_ids),{common_extra_info:JSON.stringify(o)});this.push(a)},t.prototype.p2pConnectClosed=function(e,t){void 0===t&&(t={});var i=$_($_({event_key:"p2p_connect_closed",report_id:this.report_id++,rtc_timestamp:Date.now(),p2p_selected:e},this.modify_ids),{common_extra_info:JSON.stringify(t)});this.push(i)},t.prototype.rtcDeviceError=function(e,t,i,r,n,o,a,s,c,u,d,l,h,p,_,f,v){void 0===v&&(v={});var m=$_($_({event_key:"rtc_device_error",report_id:this.report_id++,rtc_timestamp:Date.now(),device_type:e,device_stage:t,error_code:i,system_error_code:r,system_api:n,call_parameters:o,location:a,message:s,media_device_id:c,media_device_name:u,elapse:d,scenario:l,event_session_id:h,device_pid:p,device_vid:_,media_mode:f},this.modify_ids),{common_extra_info:JSON.stringify(v)});this.push(m)},t.prototype.rtcVideoDevice=function(e,t,i){void 0===i&&(i={});var r=$_($_({event_key:"rtc_video_device",report_id:this.report_id++,rtc_timestamp:Date.now(),media_device_id:e,media_device_name:t},this.modify_ids),{common_extra_info:JSON.stringify(i)});this.push(r)},t.prototype.rtcVideoCaptureEvent=function(e,t){void 0===t&&(t={});var i=$_($_($_({event_key:"rtc_video_capture_event",report_id:this.report_id++,rtc_timestamp:Date.now()},e),this.modify_ids),{common_extra_info:JSON.stringify(t)});this.push(i)},t.prototype.rtcEncodeFirstFrame=function(e,t,i){void 0===i&&(i={});var r=$_($_($_($_({event_key:"rtc_encode_first_frame",report_id:this.report_id++,rtc_timestamp:Date.now()},e),t),this.modify_ids),{common_extra_info:JSON.stringify(i)});this.push(r)},t.prototype.rtcFirstFrameEncoded=function(e,t,i){void 0===i&&(i={});var r=$_($_($_($_({event_key:"rtc_first_frame_encoded",report_id:this.report_id++,rtc_timestamp:Date.now()},e),t),this.modify_ids),{common_extra_info:JSON.stringify(i)});this.push(r)},t.prototype.rtcSendFirstPacket=function(e,t,i){void 0===i&&(i={});var r=$_($_($_($_({event_key:"rtc_send_first_packet",report_id:this.report_id++,rtc_timestamp:Date.now()},e),t),this.modify_ids),{common_extra_info:JSON.stringify(i)});this.push(r)},t.prototype.rtcRecvFirstPacket=function(e,t,i){void 0===i&&(i={});var r=$_($_($_($_({event_key:"rtc_recv_first_packet",report_id:this.report_id++,rtc_timestamp:Date.now()},e),t),this.modify_ids),{common_extra_info:JSON.stringify(i)});this.push(r)},t.prototype.rtcRecvFirstFrame=function(e,t,i){void 0===i&&(i={});var r=$_($_($_($_({event_key:"rtc_recv_first_frame",report_id:this.report_id++,rtc_timestamp:Date.now()},e),t),this.modify_ids),{common_extra_info:JSON.stringify(i)});this.push(r)},t.prototype.rtcDecodeFirstFrame=function(e,t,i){void 0===i&&(i={});var r=$_($_($_($_({event_key:"rtc_decode_first_frame",report_id:this.report_id++,rtc_timestamp:Date.now()},e),t),this.modify_ids),{common_extra_info:JSON.stringify(i)});this.push(r)},t}(VB),jB=new BB,GB=new BB,HB=new BB,zB=jB.commonStats,KB=GB.commonStats,WB=HB.commonStats,XB={default:jB,rtm:GB,outsideRoom:HB};function qB(e){void 0===e&&(e="default");for(var t=[],i=1;i<arguments.length;i++)t[i-1]=arguments[i];return function(i,r,n){if("function"==typeof n.value){var o=n.value;n.value=function(){for(var i=[],n=0;n<arguments.length;n++)i[n]=arguments[n];var a={};t.forEach((function(e,t){a[e]=i[t]})),"joinRoom"===r&&zB.setStats({room_id:i[1]}),XB[e].rtcSdkApiCall(r,0,JSON.stringify(MU(i)),a);var s=o.apply(this,i);return"function"==typeof(null==s?void 0:s.then)?s.then((function(t){return XB[e].rtcSdkCallback(r,0,JSON.stringify(MU([t||{}]))),t})).catch((function(t){throw XB[e].rtcSdkCallback(r,t.code,JSON.stringify(t.message)),t})):(XB[e].rtcSdkCallback(r,0,JSON.stringify(MU([s||{}]))),s)}}}}function YB(e,t,i){var r,n;void 0===i&&(i=0);var o=e===hf.onUserMessageReceivedOutsideRoom||e===hf.onUserBinaryMessageReceivedOutsideRoom;Array.isArray(t)&&(null===(r=t[0])||void 0===r?void 0:r.userId)&&(e="".concat(e,"_").concat(null===(n=t[0])||void 0===n?void 0:n.userId)),(o?GB:jB).rtcSdkCallback(e,i,JSON.stringify(t))}function JB(e,t,i,r){void 0===i&&(i=0),void 0===r&&(r=!1),(r?GB:jB).rtcInvokeStatus(JSON.stringify(t),i,e,"",0)}var QB=r(Object.freeze({__proto__:null,Monitor:BB,monitor:jB,reportRtcSdkApiCall:qB,reportRtcSdkCallback:YB,reportRtcInvokeStatus:JB,get CommonEventKey(){return VF},get CommonProductLine(){return FF},get CommonReportVersion(){return BF},get CommonOs(){return jF},get CommonNetworkType(){return GF},get RoominfoChannelRole(){return HF},get RtcgetconfigType(){return zF},get RtcreconnectMessage(){return KF},get RtcreconnectReconnectType(){return WF},get RtcreconnectedMessage(){return XF},get RtcreconnectedReconnectType(){return qF},get RtcgetaccessType(){return YF},get RtcpreicestateIceState(){return JF},get RtcsignalingmsgerrorReason(){return QF},get RtcsignalingSignalingEvent(){return ZF},get RtcsignalingDirection(){return $F},get RtcbegincreateofferDirection(){return eB},get RtccreateofferDirection(){return tB},get RtcsetdescriptionIsLocal(){return iB},get RtcsetdescriptionDirection(){return rB},get RtcrecvanswerAnswerType(){return nB},get RtcrecvanswerDirection(){return oB},get RtcpublishstatResult(){return aB},get RtcpublishstatIsScreen(){return sB},get RtcpublishstatMessage(){return cB},get RtcsubscribestatResult(){return uB},get RtcsubscribestatMessage(){return dB},get RtcaudiodeviceAudioEvent(){return lB},get FirstframeinfoEventType(){return hB},get FirstframeinfoMediaType(){return pB},get FirstframeinfoType(){return _B},get FirstframeinfoReason(){return fB},get RtcmuteremoteMediaType(){return vB},get SdkinitengineType(){return mB},get JoinroomType(){return yB},get JoinroomReason(){return SB},get P2pconnectionstatusStatus(){return gB},get PerformanceinfoThermalState(){return EB},get RtcdeviceerrorDeviceType(){return bB},get DcusermessageDcMessageType(){return IB},get CaptureeventinfoEventType(){return TB},get CaptureeventinfoType(){return AB},get CaptureeventinfoReason(){return RB},get RtcdeviceerrorScenario(){return CB},get RtcdeviceerrorMediaMode(){return OB},get PerformanceinfoDeviceStatus(){return wB},get CommonRtcEnvType(){return kB},commonStats:zB,rtmCommonStats:KB,rtmMonitor:GB,outsideRoomMonitor:HB,outsideRoomCommonStats:WB})).monitor,ZB=!1,$B=[];function ej(){var e;if(ZB){var t=[].slice.call(arguments);$B.push(t)}(e=console).log.apply(e,arguments)}function tj(){var e=window.__rtc_engine__,t=e._localVideoTrack,i=e._localAudioTrack;function r(e){if(e){var t=e.getTrack(),i=t.kind,r=t.id.slice(-6);ej(i+"track("+r+").getSettings(): ",t.getSettings()),ej(i+"track("+r+").readyState: ",t.readyState),ej(i+"track("+r+").muted: ",t.muted),ej(i+"track("+r+").enabled: ",t.enabled)}}ej("engine._localVideoTrack: ",e._localVideoTrack),ej("engine._localAudioTrack: ",e._localAudioTrack),r(t),r(i)}function ij(){var e=setInterval((function(){__rtc_engine__._room._mediaServerClient._handler.pc.getStats().then((function(e){var t={};e.forEach((function(i){if("track"===i.type){var r=i.trackIdentifier;__rtc_engine__._room._remoteStreams.forEach((function(n){n.forEach((function(n,o){var a,s;n&&n.videoTrack&&n.videoTrack._mediaTrack&&(n.videoTrack.getTrack().id===r&&(e.forEach((function(e){"inbound-rtp"===e.type&&i.id===e.trackId&&(a=e)})),t[n.userId+"(video-".concat(o,")")]={userId:n.userId+"(video-".concat(o,")"),track:i,inboundRTP:a}));n&&n.audioTrack&&n.audioTrack._mediaTrack&&(n.audioTrack.getTrack().id===r&&(e.forEach((function(e){"inbound-rtp"===e.type&&i.id===e.trackId&&(s=e)})),t[n.userId+"(audio-".concat(o,")")]={userId:n.userId+"(audio-".concat(o,")"),track:i,inboundRTP:s}))}))}));try{if(!__rtc_engine__._room._localStream.videoTrack)return;if(__rtc_engine__._room._localStream.videoTrack.getTrack().id===r){var n;e.forEach((function(e){"outbound-rtp"===e.type&&i.id===e.trackId&&(n=e)}));var o=__rtc_engine__._room._roomInfo.userInfo.userId+" (localVideo)";t[o]={userId:o,track:i,outboundRTP:n}}}catch(e){ej(e)}try{if(!__rtc_engine__._room._localStream.audioTrack)return;if(__rtc_engine__._room._localStream.audioTrack.getTrack().id===r){var a;e.forEach((function(e){"outbound-rtp"===e.type&&i.id===e.trackId&&(a=e)}));var s=__rtc_engine__._room._roomInfo.userInfo.userId+" (localAudio)";t[s]={userId:s,track:i,outboundRTP:a}}}catch(e){ej(e)}}})),ej(t)}))}),1e3);setTimeout((function(){clearInterval(e)}),2e3)}function rj(){return(rj=hT(ET.mark((function e(){var t;return ET.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=window.__rtc_engine__,e.next=3,t.stopVideoCapture();case 3:return e.next=5,t.startVideoCapture();case 5:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function nj(){return(nj=hT(ET.mark((function e(){var t;return ET.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=window.__rtc_engine__,e.next=3,t.stopAudioCapture();case 3:return e.next=5,t.startAudioCapture();case 5:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function oj(){return(oj=hT(ET.mark((function e(t){var i;return ET.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=window.__rtc_engine__,e.next=3,i.unsubscribeStream(t,3);case 3:return e.next=5,i.subscribeStream(t,3);case 5:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function aj(){for(var e=window.__rtc_engine__,t=0;t<5;t++)setTimeout((function(){e._room._remoteStreams.forEach((function(e){e.forEach((function(e,t){e&&e.audioTrack&&ej(e.userId+" volume:"+e.audioTrack.getAudioLevel())}))})),ej("local volume: ",e._localAudioTrack.getAudioLevel())}),200*t)}function sj(){var e=window.__rtc_engine__._remoteVideoPlayer;ej("videoplayers: ",e.size,Array.from(e.keys())),e&&e.size>=1&&e.forEach((function(e,t){var i=e._videoDom;ej("videoplayer("+t+(e.isScreen?"_screen":"")+").readyState: ",i.readyState),ej("videoplayer("+t+(e.isScreen?"_screen":"")+").currentTime: ",10*Math.floor(i.currentTime/10)),ej("videoplayer("+t+(e.isScreen?"_screen":"")+").paused: ",i.paused),ej("videoplayer("+t+(e.isScreen?"_screen":"")+").srcObject.id: ",i.srcObject.id),ej("videoplayer("+t+(e.isScreen?"_screen":"")+").srcObject.active: ",i.srcObject.active)}))}function cj(){var e=window.__rtc_engine__._remoteAudioPlayer;e&&e.size>=1&&e.forEach((function(e,t){var i=e._audioDom;ej("audioplayer("+t+").readyState: ",i.readyState),ej("audioplayer("+t+").currentTime: ",i.currentTime),ej("audioplayer("+t+").paused: ",i.paused),ej("audioplayer("+t+").srcObject.id: ",i.srcObject.id),ej("audioplayer("+t+").srcObject.active: ",i.srcObject.active)}))}function uj(e){if(!e)return!1;var t=document.createElement("div");t.style.width="100%",t.style.height="100%",t.style.position="absolute",t.style.backgroundColor="rgba(0, 0, 0, 0.2)",t.style.color="wheat",t.style.zIndex="9999999",t.style.pointerEvents="none",document.body.insertBefore(t,document.body.firstChild),window.counter=0,window.panel=t;try{var i=localStorage.getItem("ve_crash_log"),r=URL.createObjectURL(new Blob([i])),n=document.createElement("a");n.download="ve_crash_log.log",n.href=r,n.click(),localStorage.removeItem("ve_crash_log")}catch(e){}function o(e){var t=localStorage.getItem("ve_crash_log");localStorage.setItem("ve_crash_log",t+"\r\n"+e)}window._ve_sdk_cb=function(){var e,t=Array.prototype.slice.call(arguments);try{e=JSON.stringify(t)}catch(t){e="JSON.stringify failed"}e.length>1e3&&(e=e.slice(0,1e3)+"... <too large to show>"),e="seq".concat(window.counter++," - ").concat(e);var i=document.createElement("div");i.style.whiteSpace="nowrap",i.innerHTML=e,panel.childNodes.length>20&&panel.removeChild(panel.childNodes[0]),window.panel.append(i);try{o(e)}catch(e){}}}window.location.search.includes("adp")?uj(!0):uj(!1);var dj=function(){var e=new Date;return e.toDateString().replaceAll(" ","_")+"-"+e.toTimeString().split(" ")[0]+":"+e.getMilliseconds()};window.rvc=function(){return rj.apply(this,arguments)},window.rac=function(){return nj.apply(this,arguments)},window.rs=function(e){return oj.apply(this,arguments)},window.wrv=sj,window.wra=cj,window.wlt=tj,window.ws=function(){var e=window.__rtc_engine__;if(e._room){var t=[];try{t=e._room._mediaServerClient.handler.pc.getSenders()}catch(e){t=[]}ej("senders: ",t.length,";empty senders: ",t.filter((function(e){return!!e.track})).length),t.forEach((function(e,t){var i=e.track,r=Object.assign({},e.getParameters());(r.transactionId&&delete r.transactionId,i)?ej(i.kind+"sender("+i.id.slice(-6)+").getParameters(): ",r):ej("emptysender("+t+").getParameters(): ",r)}))}},window.ss5=ij,window.gv5=aj,window.ap=uj,window.dv=function(e,t,i,r){var n=[],o=null,a=!1,s=__rtc_engine__._room.roomInfo.userInfo.userId,c=function(r,s){if(e===r){if("key"===s.type&&(a=!0,o||(ej(" ============ start dump ============="),o=setTimeout(u,1e3*(t||7)))),i&&!a)return;ej("dump video: ",s),n.push(new Uint8Array(s.data))}},u=function(){__rtc_engine__._room._remoteStreams.get(e)[0].off("onTransformData",c);var t=n.reduce((function(e,t){return e+t.byteLength}),0);ej("byteLength: ",t);var i=n.reduce((function(e,t){return e.data.set(t,e.offset),e.offset+=t.byteLength,e}),{data:new Uint8Array(t),offset:0}),o=i.data.reduce((function(e,t){return e+String.fromCharCode(t)}),""),a=window.btoa(o);console.log("base64str:",a),QB.rtcInvokeStatus(a,0,"dumpVideo_".concat(s,"_sub_").concat(e,"_").concat(dj()),"",0);var u=URL.createObjectURL(new Blob([i.data])),d=document.createElement("a");d.download="dumpVideo_".concat(s,"_sub_").concat(e,"_").concat(dj(),".").concat(r||"h264"),d.href=u,d.click()};__rtc_engine__._room._remoteStreams.get(e)[0].on("onTransformData",c),i||(o=setTimeout(u,1e3*(t||7)))},window.cs=function(){ZB=!0,setTimeout((function(){console.log($B);var e=[],i=JSON.stringify($B,(function(i,r){if("object"===t(r)&&null!==r){if(-1!==e.indexOf(r))return;e.push(r)}return r}));e=null,console.log(i.length),QB.rtcInvokeStatus(i,0,"console.monitor","",0),$B=[]}),1e4);try{sj()}catch(e){}try{cj()}catch(e){}try{tj()}catch(e){}try{ij()}catch(e){}try{aj()}catch(e){}},by("Set",(function(e){return function(){return e(this,arguments.length?arguments[0]:void 0)}}),Ly);var lj=Xr,hj=A,pj=ye,_j=Le,fj=nr,vj=fo,mj=s,yj=yA,Sj=Gn,gj=oM,Ej=aM,bj=ie,Ij=cM,Tj=[],Aj=hj(Tj.sort),Rj=hj(Tj.push),Cj=mj((function(){Tj.sort(void 0)})),Oj=mj((function(){Tj.sort(null)})),wj=Sj("sort"),kj=!mj((function(){if(bj)return bj<70;if(!(gj&&gj>3)){if(Ej)return!0;if(Ij)return Ij<603;var e,t,i,r,n="";for(e=65;e<76;e++){switch(t=String.fromCharCode(e),e){case 66:case 69:case 70:case 72:i=3;break;case 68:case 71:i=4;break;default:i=2}for(r=0;r<47;r++)Tj.push({k:t+r,v:i})}for(Tj.sort((function(e,t){return t.v-e.v})),r=0;r<Tj.length;r++)t=Tj[r].k.charAt(0),n.charAt(n.length-1)!==t&&(n+=t);return"DGBEFHACIJK"!==n}}));lj({target:"Array",proto:!0,forced:Cj||!Oj||!wj||!kj},{sort:function(e){void 0!==e&&pj(e);var t=_j(this);if(kj)return void 0===e?Aj(t):Aj(t,e);var i,r,n=[],o=fj(t);for(r=0;r<o;r++)r in t&&Rj(n,t[r]);for(yj(n,function(e){return function(t,i){return void 0===i?-1:void 0===t?1:void 0!==e?+e(t,i)||0:vj(t)>vj(i)?1:-1}}(e)),i=n.length,r=0;r<i;)t[r]=n[r++];for(;r<o;)delete t[r++];return t}});var Nj,Pj,Dj=Xr,Mj=Ia.findIndex,Lj=sh,Uj="findIndex",xj=!0;Uj in[]&&Array(1).findIndex((function(){xj=!1})),Dj({target:"Array",proto:!0,forced:xj},{findIndex:function(e){return Mj(this,e,arguments.length>1?arguments[1]:void 0)}}),Lj(Uj),function(e){e.INVALID_ENGINE="INVALID_ENGINE",e.INVALID_PARAMS="INVALID_PARAMS",e.INVOKED_BEFORE_JOIN_ROOM="INVOKED_BEFORE_JOIN_ROOM",e.INVALID_TOKEN="INVALID_TOKEN",e.EXPIRED_TOKEN="EXPIRED_TOKEN",e.JOIN_ROOM_FAILED="JOIN_ROOM_FAILED",e.UPDATE_TOKEN_WITH_INVALID_TOKEN="UPDATE_TOKEN_WITH_INVALID_TOKEN",e.UPDATE_TOKEN_BEFORE_JOIN="UPDATE_TOKEN_BEFORE_JOIN",e.REPEAT_JOIN="REPEAT_JOIN",e.REPEAT_PUBLISH="REPEAT_PUBLISH",e.REPEAT_PUSH="REPEAT_PUSH",e.REPEAT_PLAY="REPEAT_PLAY",e.PUBLISH_BEFORE_JOIN="PUBLISH_BEFORE_JOIN",e.UNPUBLISH_BEFORE_JOIN="UNPUBLISH_BEFORE_JOIN",e.SUBSCRIBE_BEFORE_JOIN="SUBSCRIBE_BEFORE_JOIN",e.UNSUBSCRIBE_BEFORE_JOIN="UNSUBSCRIBE_BEFORE_JOIN",e.NO_PUBLISH_PERMISSION="NO_PUBLISH_PERMISSION",e.STREAM_NOT_EXIST="STREAM_NOT_EXIST",e.EMPTY_STREAM="EMPTY_STREAM",e.NOT_CONNECTED_YET="NOT_CONNECTED_YET",e.IM_BEFORE_JOIN="IM_BEFORE_JOIN",e.USER_NOT_EXIST="USER_NOT_EXIST",e.ALREADY_IN_ROOM="ALREADY_IN_ROOM",e.KICKED_OUT="KICKED_OUT",e.ROOM_DISMISS="ROOM_DISMISS",e.TOKEN_EXPIRED="TOKEN_EXPIRED",e.DUPLICATE_LOGIN="DUPLICATE_LOGIN",e.REPEAT_CAPTURE="REPEAT_CAPTURE",e.GET_VIDEO_TRACK_FAILED="GET_VIDEO_TRACK_FAILED",e.GET_AUDIO_TRACK_FAILED="GET_AUDIO_TRACK_FAILED",e.GET_SCREEN_TRACK_FAILED="GET_SCREEN_TRACK_FAILED",e.STREAM_TYPE_NOT_MATCH="STREAM_TYPE_NOT_MATCH",e.CANT_FIND_DOM="CANT_FIND_DOM",e.INVALID_DEVICE_ID="INVALID_DEVICE_ID",e.NO_PERMISSION="NO_PERMISSION",e.NOT_SUPPORTED="NOT_SUPPORTED",e.ICE_SERVER_WRONG="ICE_SERVER_WRONG",e.ESTABLISH_DATACHANNEL_FAILED="ESTABLISH_DATACHANNEL_FAILED",e.LOAD_RESOURCES_FAILED="LOAD_RESOURCES_FAILED",e.SIGNALING_CHANNEL_NOT_OPEN="SIGNALING_CHANNEL_NOT_OPEN",e.TIME_OUT="TIME_OUT",e.REFUSE_OPERATION_IN_DISCONNECT="REFUSE_OPERATION_IN_DISCONNECT",e.ADD_TRANSCEIVER_FAILED="ADD_TRANSCEIVER_FAILED",e.UPDATE_TRACK_FAILED="UPDATE_TRACK_FAILED",e.PUBLISH_FAILED="PUBLISH_FAILED",e.UNPUBLISH_FAILED="UNPUBLISH_FAILED",e.SUBSCRIBE_FAILED="SUBSCRIBE_FAILED",e.UNSUBSCRIBE_FAILED="UNSUBSCRIBE_FAILED",e.OPERATION_CANCEL="OPERATION_CANCEL",e.START_CLOUD_PROXY_AFTER_JOIN="START_CLOUD_PROXY_AFTER_JOIN",e.STOP_CLOUD_PROXY_BEFORE_LEAVE="STOP_CLOUD_PROXY_BEFORE_LEAVE",e.UNEXPECTED_ERROR="UNEXPECTED_ERROR",e.REPEAT_DEVICE_TEST="REPEAT_DEVICE_TEST",e.AUDIO_DEVICE_TEST_FAILED="AUDIO_DEVICE_RECORD_FAILED",e.ALREADY_LOGIN="ALREADY_LOGIN",e.LOGIN_FAILED="LOGIN_FAILED",e.NOT_LOGIN="NOT_LOGIN",e.RTM_DUPLICATE_LOGIN="RTM_DUPLICATE_LOGIN",e.RTM_TOKEN_ERROR="RTM_TOKEN_ERROR",e.USER_MESSAGE_TIMEOUT="USER_MESSAGE_TIMEOUT",e.USER_MESSAGE_BROKEN="USER_MESSAGE_BROKEN",e.USER_MESSAGE_NO_RECEIVER="USER_MESSAGE_NO_RECEIVER",e.USER_MESSAGE_NO_RELAYPATH="USER_MESSAGE_NO_RELAYPATH",e.USER_MESSAGE_SEND_TO_SERVER_ERROR="USER_MESSAGE_SEND_TO_SERVER_ERROR",e.USER_MESSAGE_SERVER_RESPONSE_ERROR="USER_MESSAGE_SERVER_RESPONSE_ERROR",e.USER_MESSAGE_NOT_JOIN="USER_MESSAGE_NOT_JOIN",e.USER_MESSAGE_INIT="USER_MESSAGE_INIT",e.USER_MESSAGE_NO_CONNECTION="USER_MESSAGE_NO_CONNECTION",e.USER_MESSAGE_EXCEED_MAX_LENGTH="USER_MESSAGE_EXCEED_MAX_LENGTH",e.USER_MESSAGE_EMPTY_USER="USER_MESSAGE_EMPTY_USER",e.USER_MESSAGE_NOT_LOGIN="USER_MESSAGE_NOT_LOGIN",e.USER_MESSAGE_SERVER_PARAMS_NOTSET="USER_MESSAGE_SERVER_PARAMS_NOTSET",e.USER_MESSAGE_UNKNOWN="USER_MESSAGE_UNKNOWN",e.START_PUBLIC_STREAM_BEFORE_JOIN="START_PUBLIC_STREAM_BEFORE_JOIN",e.RECONNECT_FAILED="RECONNECT_FAILED",e.PUBLIC_STREAM_DECODE_FAILED="PUBLIC_STREAM_DECODE_FAILED"}(Nj||(Nj={})),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"}(Pj||(Pj={}));var Vj=function(e,t,i){this.code=e,this.message=t,this.error=i};function Fj(e,t){if("boolean"!=typeof e)throw new Vj(Nj.INVALID_PARAMS,"Invalid ".concat(t,": The value should be boolean type."))}function Bj(e,t,i,r){if(void 0===i&&(i=1),void 0===r&&(r=Number.POSITIVE_INFINITY),e<i||e>r||"number"!=typeof e)throw new Vj(Nj.INVALID_PARAMS,"Invalid ".concat(t,": the value range is [").concat(i,", ").concat(r,"]. integer only"))}function jj(e,t,i,r){if(void 0===i&&(i=1),void 0===r&&(r=Number.POSITIVE_INFINITY),null==e)throw new Vj(Nj.INVALID_PARAMS,"".concat(t," cannot be empty"));if(!function(e,t,i){void 0===t&&(t=1);void 0===i&&(i=Number.POSITIVE_INFINITY);return"string"==typeof e&&e.length<=i&&e.length>=t}(e,i,r))throw new Vj(Nj.INVALID_PARAMS,"Invalid ".concat(t,": The value should be string type. Length of the string: [").concat(i,",").concat(r,"]"))}function Gj(e,t,i){if(!i.includes(e))throw new Vj(Nj.INVALID_PARAMS,"Invalid ".concat(t,": The value can only be set as ").concat(JSON.stringify(i)))}function Hj(e,t){if(Kj(e))throw new Vj(Nj.INVALID_PARAMS,"Invalid ".concat(t,", should not be empty"))}function zj(e,t){if(!(e instanceof ArrayBuffer))throw new Vj(Nj.INVALID_PARAMS,"Invalid ".concat(t,", should be ArrayBuffer"))}function Kj(e){return null==e}function Wj(e){if("string"!=typeof e||!/^[a-zA-Z0-9@._\-]{1,128}$/.test(e))throw new Vj(Nj.INVALID_PARAMS,"The userId must be within 128 bytes. The supported characters: a-z,A-Z,0-9,@,-,_,.")}function Xj(e){if("string"!=typeof e||!/^[a-zA-Z0-9@._\-]{1,128}$/.test(e))throw new Vj(Nj.INVALID_PARAMS,"The publicStreamId must be within 128 bytes. The supported characters: a-z,A-Z,0-9,@,-,_,.")}function qj(e){Hj(e,"videoPlayerOption")}function Yj(e,t){var i,r;if(void 0===t&&(t=64),!e||0===(null===(i=e)||void 0===i?void 0:i.byteLength))throw new Vj(Nj.INVALID_PARAMS,"The message cannot be empty");if((null==(r=e instanceof ArrayBuffer?e:yU.str2ab(JSON.stringify(e)))?void 0:r.byteLength)>1e3*t)throw new Vj(Nj.INVALID_PARAMS,"The message length must be less than ".concat(t,"K"))}function Jj(e){return![hf.onRemoteStreamStats,hf.onLocalStreamStats,hf.onAudioVolumeIndication,hf.onLocalAudioPropertiesReport,hf.onRemoteAudioPropertiesReport].includes(e)}var Qj=Ve,Zj=function(e){return void 0!==e&&(Qj(e,"value")||Qj(e,"writable"))},$j=h,eG=H,tG=Mt,iG=Zj,rG=a,nG=mh;Xr({target:"Reflect",stat:!0},{get:function e(t,i){var r,n,o=arguments.length<3?t:arguments[2];return tG(t)===o?t[i]:(r=rG.f(t,i))?iG(r)?r.value:void 0===r.get?void 0:$j(r.get,o):eG(n=nG(t))?e(n,i,o):void 0}});var oG=Xr,aG=h,sG=Mt,cG=H,uG=Zj,dG=Ot,lG=a,hG=mh,pG=S;var _G,fG,vG,mG,yG,SG,gG,EG,bG,IG,TG,AG=s((function(){var e=function(){},t=dG.f(new e,"a",{configurable:!0});return!1!==Reflect.set(e.prototype,"a",1,t)}));oG({target:"Reflect",stat:!0,forced:AG},{set:function e(t,i,r){var n,o,a,s=arguments.length<4?t:arguments[3],c=lG.f(sG(t),i);if(!c){if(cG(o=hG(t)))return e(o,i,r,s);c=pG(0)}if(uG(c)){if(!1===c.writable||!cG(s))return!1;if(n=lG.f(s,i)){if(n.get||n.set||!1===n.writable)return!1;n.value=r,dG.f(s,i,n)}else dG.f(s,i,pG(0,r))}else{if(void 0===(a=c.set))return!1;aG(a,s,r)}return!0}}),function(e){e.streamRemovedBySchedule308="stream removed",e.clientRePublish="client republish",e.publishStreamFaied="publish failed",e.clientUnPublish="client unpublished",e.clientDisconnected="client disconnected",e.videoMuted="video muted"}(_G||(_G={})),function(e){e.PushLimitWarn="PushLimitWarn"}(fG||(fG={})),function(e){e.ON_ADD_STREAM="onAddStream",e.ON_REMOVE_STREAM="onRemoveStream",e.USER_DISCONNECTION="userDisconnection",e.USER_CONNECTION="userConnection",e.ON_UPDATE_STREAM_ATTRIBUTES="onUpdateStreamAttributes",e.ON_UPDATE_ROOM_ATTRIBUTES="onUpdateRoomAttributes",e.ON_PUSH_TRACK="onPushTrack",e.ON_REMOVE_TRACK="onRemoveTrack",e.ON_CUSTOM_MESSAGE="onCustomMessage",e.NODE_CHANGE="nodeChange",e.USER_MESSAGE_RECEIVED="userMessageReceived",e.USER_BINARY_MESSAGE_RECEIVED="userBinaryMessageReceived",e.USER_MESSAGE_RECEIVED_OUTSIDE_ROOM="userMessageReceivedOutsideRoom",e.USER_BINARY_MESSAGE_RECEIVED_OUTSIDE_ROOM="userBinaryMessageReceivedOutsideRoom",e.POST_PROCESSING_MESSAGE="postProcessingMessage",e.ON_USER_TOKEN_WILL_EXPIRE="onUserTokenWillExpire",e.STREAM_CONTROL_MESSAGE="streamControlMessage",e.ON_SCENE_CONFIG="onSceneConfig",e.ON_STREAM_FAILED="streamFailed"}(vG||(vG={})),function(e){e.RSCP="RSCP"}(mG||(mG={})),function(e){e.ON_CONNECTION_STATE_CHANGE="onConnectionStateChange",e.ABNORMAL_DISCONNECTION="normalConnection"}(yG||(yG={})),function(e){e.userLeave="userLeave",e.connectionLost="connectionLost",e.userDuplicateLogin="userDuplicateLogin",e.kickedByAdmin="kickedByAdmin",e.roleChanged="roleChanged",e.onUserTokenDidExpire="onUserTokenDidExpire"}(SG||(SG={})),function(e){e[e.roomDismissByAdmin=2]="roomDismissByAdmin"}(gG||(gG={})),function(e){e[e.SEND=0]="SEND",e[e.FEEDBACK=1]="FEEDBACK"}(bG||(bG={})),function(e){e[e.P2P=0]="P2P",e[e.SIGNAL=1]="SIGNAL",e[e.BROADCAST=2]="BROADCAST",e[e.BUSINESS_SERVER=3]="BUSINESS_SERVER"}(IG||(IG={})),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"}(TG||(TG={}));var RG,CG,OG=((EG={})[TG.SUCCESS]=[0,"success"],EG[TG.TIMEOUT]=[Nj.USER_MESSAGE_TIMEOUT,"timeout, failed to send."],EG[TG.BROKEN]=[Nj.USER_MESSAGE_BROKEN,"dataChannel broken, failed to send."],EG[TG.NO_RECEIVER]=[Nj.USER_MESSAGE_NO_RECEIVER,"cannot find the receiver."],EG[TG.NO_RELAYPATH]=[Nj.USER_MESSAGE_NO_RELAYPATH,"cannot find relay path."],EG[TG.SEND_TO_SERVER_ERROR]=[Nj.USER_MESSAGE_SEND_TO_SERVER_ERROR,"failed to send to business server."],EG[TG.SERVER_RESPONSE_ERROR]=[Nj.USER_MESSAGE_SERVER_RESPONSE_ERROR,"business server response error."],EG[TG.NOT_JOIN]=[Nj.USER_MESSAGE_NOT_JOIN,"not join room"],EG[TG.INIT]=[Nj.USER_MESSAGE_INIT,"not init."],EG[TG.NO_CONNECTION]=[Nj.USER_MESSAGE_NO_CONNECTION,"no connection."],EG[TG.EXCEED_MAX_LENGTH]=[Nj.USER_MESSAGE_EXCEED_MAX_LENGTH,"message exceeds max length."],EG[TG.EMPTY_USER]=[Nj.USER_MESSAGE_EMPTY_USER,"user id is empty."],EG[TG.NOT_LOGIN]=[Nj.USER_MESSAGE_NOT_LOGIN,"not login."],EG[TG.SERVER_PARAMS_NOTSET]=[Nj.USER_MESSAGE_SERVER_PARAMS_NOTSET,"server param is not set."],EG[TG.UNKNOWN]=[Nj.USER_MESSAGE_UNKNOWN,"unknown."],EG),wG=new LB("DataChannelSignaling",3);!function(e){e[e.SEND=0]="SEND",e[e.ACK=1]="ACK"}(RG||(RG={})),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"}(CG||(CG={}));var kG=function(e){function t(t){var i=e.call(this)||this;return i._dataChannel=t,i._singlingCache=new Map,i._p2pCache=new Map,i._rttIds={},i._p2pMessageId=0,i._clearDataChannelListener=i._handleHandler(),window.__rtc_mock_signaling__=i.emit.bind(i),i}return C_(t,e),t.prototype.destroy=function(){this._dataChannel&&(this._clearDataChannelListener(),this._dataChannel.close()),this._singlingCache.clear(),this._p2pCache.clear(),this._p2pMessageId=0,this._rttIds={}},t.prototype.sendSignaling=function(e,t,i){var r=this;return jB.rtcSignaling(0,JSON.stringify(t),"call-".concat(e),"Send",$F.UP),new Promise((function(n,o){var a=r._genHeader(i);a.id=NU();var s=a.id.join("-"),c=setTimeout((function(){r._singlingCache.delete(s),o(new Vj(Nj.TIME_OUT,"".concat(e," message time out")))}),6e4);r._singlingCache.set(s,{signalingType:e,success:function(e){clearTimeout(c),n(e)},error:function(e){clearTimeout(c),o(e)}}),wG.print("Signal",">>>>>> [".concat(e,"][").concat(s,"]"),t),r._sendMessage(e,a,t)}))},t.prototype.sendPingSignaling=function(){return this.sendSignaling("CheckConnectivity",{ts:Date.now()},{functionType:CG.C2GW})},t.prototype.sendP2PMessage=function(e,t){var i=e.msg,r=function(e,t){var i={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(i[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(r=Object.getOwnPropertySymbols(e);n<r.length;n++)t.indexOf(r[n])<0&&Object.prototype.propertyIsEnumerable.call(e,r[n])&&(i[r[n]]=e[r[n]])}return i}(e,["msg"]);return tf(this,void 0,void 0,(function(){var e,n,o,a,s;return rf(this,(function(c){switch(c.label){case 0:return e=i instanceof ArrayBuffer,n=this._sendP2PMessage,o=[$_({ver:1,id:this._p2pMessageId++,time:Date.now(),dir:bG.SEND,type:IG.P2P,err:TG.SUCCESS},r)],s={binary:e},e?[4,yU.ab2b64str(i)]:[3,2];case 1:return a=c.sent(),[3,3];case 2:a=i,c.label=3;case 3:return[2,n.apply(this,[$_.apply(void 0,o.concat([(s.msg=a,s)])),t])]}}))}))},t.prototype._sendP2PMessage=function(e,t){var i=this;return void 0===t&&(t={}),DU(e.msg)?this._rttIds[e.id]=e.id:e.dir===bG.SEND&&wG.print("_sendP2PMessage [DC Signaling p2p >>]",JSON.stringify(e)),new Promise((function(r,n){var o=i._genHeader($_($_({needAck:!0,functionType:CG.C2C},t),{id:NU()}));if(e.dir===bG.SEND){var a=setTimeout((function(){i._p2pCache.delete(e.id),n(new Vj(Nj.TIME_OUT,"P2P message timeout"))}),6e4);i._p2pCache.set(e.id,{success:function(e,t){clearTimeout(a),r(t)},error:function(e){clearTimeout(a);var t=of(OG[e.err]||[Nj.USER_MESSAGE_UNKNOWN,"err: ".concat(e.err,", msg: ").concat(e.msg)],2),i=t[0],r=t[1];n({code:i,message:e.msg||r})}})}i._sendMessage("p2p",o,e)}))},t.prototype._sendMessage=function(e,t,i){if(!this._dataChannel||"open"!==this._dataChannel.readyState)throw new Vj(Nj.SIGNALING_CHANNEL_NOT_OPEN,"DataChannel not open");var r=t.version+(+t.zip<<5)+(+t.encrypt<<6),n=+t.needAck+(+t.direction<<1)+(+t.functionType<<2)+(+t.binary<<6),o=yU.str2ab(JSON.stringify([e,i])),a=vU(Uint8Array,af([r,n],of(t.id||[]),!1),new Uint8Array(o));this._dataChannel.send(a.buffer)},t.prototype._dispartData=function(e){var t=new Uint8Array(e),i=0,r=t[i++],n=t[i++],o={version:15&r,zip:16==(16&r),encrypt:32==(32&r),needAck:1==(1&n),direction:(2&n)>>1,functionType:(60&n)>>2,binary:64==(64&n)};if(o.needAck||o.direction===RG.ACK){for(;i<=6;i++)if(128!=(128&t[i])){i++;break}o.id=Array.from(t.slice(2,i))}return{header:o,data:t.slice(i)}},t.prototype._feedbackSignaling=function(e,t){var i=this._genHeader({needAck:!0,direction:RG.ACK,id:e.split("-").map((function(e){return+e}))});wG.print("Signal",">>>>>> [".concat(t,"-res][").concat(e,"]")),this._sendMessage("".concat(t,"-res"),i,"")},t.prototype._handleMessage=function(e){var t,i;return tf(this,void 0,void 0,(function(){var r,n,o,a,s,c,u,d,l,h,p,_,f,v,m,y,S,g,E,b,I,T,A,R,C,O,w,k,N,P,D,M,L,U,x;return rf(this,(function(V){switch(V.label){case 0:r=this._dispartData(e),n=r.header,o=r.data,n.zip&&((a=new fF.Inflate).push(o,!0),o=a.result),s=yU.ab2str(o),c=[];try{c=JSON.parse(s)}catch(e){return e instanceof Error&&jB.rtcSignalingMsgError(-1,e.message,QF.MESSAGE_PARSE_FAILED),[2]}switch(n.functionType){case CG.C2S:return[3,1];case CG.C2C:return[3,6];case CG.C2GW:return[3,18]}return[3,19];case 1:return u=(null===(t=n.id)||void 0===t?void 0:t.join("-"))||"",n.direction!==RG.ACK?[3,2]:(this._handleAckMessage(u,c[0]||{},s),[3,5]);case 2:return Array.isArray(c)?(d=c[0],c=c[1],wG.print("Signal","<<<<<< ".concat(d),c,u),this._feedbackSignaling(u,d),c.binary&&"string"==typeof c.message?(l=c,[4,yU.b64str2ab(c.message)]):[3,4]):[3,5];case 3:l.message=V.sent(),V.label=4;case 4:this.emit(d,$_({},c)),jB.rtcSignaling(0,s,"on-".concat(d),"Recv",$F.DOWN),V.label=5;case 5:return[3,19];case 6:switch(Array.isArray(c)&&(c=c[1]),h=null==c?void 0:c.id,this._rttIds[h]||(null==c?void 0:c.dir)===bG.FEEDBACK||DU(null==c?void 0:c.msg)?delete this._rttIds[h]:wG.print("Signal","<<<<<< p2p response",c),c.dir){case bG.SEND:return[3,7];case bG.FEEDBACK:return[3,16]}return[3,17];case 7:return DU(null==c?void 0:c.msg)?[3,15]:(_=(p=c).binary,f=p.msg,v=p.room,m=p.to,y=p.from,S=""===v?_?vG.USER_BINARY_MESSAGE_RECEIVED_OUTSIDE_ROOM:vG.USER_MESSAGE_RECEIVED_OUTSIDE_ROOM:_?vG.USER_BINARY_MESSAGE_RECEIVED:vG.USER_MESSAGE_RECEIVED,m?[3,11]:(g=this.emit,E=[vG.ON_CUSTOM_MESSAGE],U={clientId:y,binary:_},_?[4,yU.b64str2ab(f)]:[3,9]));case 8:return b=V.sent(),[3,10];case 9:b=f,V.label=10;case 10:return g.apply(this,E.concat([(U.message=b,U)])),[3,15];case 11:return I=this.emit,T=[S],A=[$_({},c)],x={},_?[4,yU.b64str2ab(f)]:[3,13];case 12:return R=V.sent(),[3,14];case 13:R=f,V.label=14;case 14:I.apply(this,T.concat([$_.apply(void 0,A.concat([(x.msg=R,x)]))])),V.label=15;case 15:return this._sendP2PMessage($_($_({},c),{dir:bG.FEEDBACK,msg:""})),[3,17];case 16:return(C=this._p2pCache.get(c.id))&&(this._p2pCache.delete(c.id),c.err===TG.SUCCESS?C.success(c.id,c):C.error(c)),[3,17];case 17:return[3,19];case 18:if(n.direction===RG.ACK)O=(null===(i=n.id)||void 0===i?void 0:i.join("-"))||"",this._handleAckMessage(O,c[0]||{},s);else if(w=of(c,2),k=w[0],N=w[1],P=void 0===N?{}:N,"RXMediaMsg"===k&&(D=P.type,M=P.data,jB.rtcSignaling(0,s,"on-".concat(D),"Recv",$F.DOWN),"RSCP"===D))try{L=JSON.parse(M),Array.isArray(L)&&this.emit(D,L)}catch(e){}V.label=19;case 19:return[2]}}))}))},t.prototype._handleHandler=function(){var e=this,t=function(t){wG.print("_handleHandler","dataChannel close",t),e.emit("close",t)},i=function(t){wG.print("_handleHandler","dataChannel error",t),e.emit("close",t)},r=function(t){e._handleMessage(t.data)};return this._dataChannel.addEventListener("close",t),this._dataChannel.addEventListener("error",i),this._dataChannel.addEventListener("message",r),function(){e._dataChannel.removeEventListener("close",t),e._dataChannel.removeEventListener("error",i),e._dataChannel.removeEventListener("message",r)}},t.prototype._genHeader=function(e){return void 0===e&&(e={}),$_({version:2,zip:!1,encrypt:!1,needAck:!0,direction:RG.SEND,functionType:CG.C2S,binary:!1},e)},t.prototype._handleAckMessage=function(e,t,i){var r=this._singlingCache.get(e);r&&(this._singlingCache.delete(e),200===t.code?r.success(t):r.error(t),wG.print("Signal","<<<<<< [".concat(r.signalingType,"-ack]"),t)),jB.rtcSignaling(0,i,null==r?void 0:r.signalingType,"Ack",$F.DOWN)},t}(xF.exports.EventEmitter),NG=function(){function e(){this.isSending=!1}return e.prototype.ajax=function(e){var t=this,i=e.method,r=e.url,n=e.body,o=void 0===n?{}:n,a=e.headers,s=void 0===a?{}:a,c=e.stringify,u=void 0===c||c;return new Promise((function(e,n){var a,c;t.isSending=!0;var d=new XMLHttpRequest;d.open(i,r,!0);try{for(var l=nf(Object.entries(s)),h=l.next();!h.done;h=l.next()){var p=of(h.value,2),_=p[0],f=p[1];d.setRequestHeader(_,f)}}catch(e){a={error:e}}finally{try{h&&!h.done&&(c=l.return)&&c.call(l)}finally{if(a)throw a.error}}d.onreadystatechange=function(){4===d.readyState&&(t.isSending=!1,200===d.status?e(JSON.parse(d.responseText)):n({message:d.statusText,code:d.status})),0===d.status&&n({code:0,message:"Request abort"})},d.onerror=function(e){t.isSending=!1,n({code:-1,message:d.responseText||"unknown"})},t.timeout&&(d.timeout=t.timeout),u&&(o=JSON.stringify(o)),d.send(o),t.xhr=d}))},e.prototype.get=function(e,t){return this.ajax({method:"GET",url:e,headers:t})},e.prototype.post=function(e,t,i,r){return this.ajax({method:"POST",url:e,body:t,headers:i,stringify:r})},e.prototype.abort=function(){var e;null===(e=this.xhr)||void 0===e||e.abort()},e}(),PG=new LB("ICE Request",3),DG=function(){function e(){this._request=new NG}return e.prototype.getAccessNode=function(e,t,i,r,n,o,a){return tf(this,void 0,void 0,(function(){var s;return rf(this,(function(c){return(s=IF.getAccessNode(e))?(this.getAccessNodeFromServer(e,t,i,r,n,o,a),JB("es.R.node.cache",s),Array.isArray(s)?[2,Promise.resolve(s)]:[2,Promise.resolve([s])]):[2,this.getAccessNodeFromServer(e,t,i,r,n,o,a)]}))}))},e.prototype.getAccessNodeFromServer=function(e,t,i,r,n,o,a){return tf(this,void 0,void 0,(function(){var s,c,u=this;return rf(this,(function(d){return s=IF.getAccessUrls(),c=!0,JB("es.R.req.cache.urls",s),(null==s?void 0:s.length)>0||(s=OF.ICE_CONFIG_REQUEST_URLS,c=!1,JB("es.R.req.external.urls",s)),(null==s?void 0:s.length)>0||(s=OF.ICE_CONFIG_REQUEST_URLS_INTERNAL,c=!1,JB("es.R.req.internal.urls",s)),[2,this.getICEConfigFromServer(s,e,t,i,r,n,o,a).then((function(t){var i=t.nodes;return IF.setAccessNode(e,i,t.ttl||11200),t.dispatchDomains&&IF.setAccessUrls(t.dispatchDomains),i})).catch((function(s){if(c)return JB("es.R.req.fallback",""),IF.clearAccessUrls(),u.getAccessNodeFromServer(e,t,i,r,n,o,a);throw s}))]}))}))},e.prototype.getICEConfigFromServer=function(e,t,i,r,n,o,a,s){var c;return tf(this,void 0,void 0,(function(){var i,u,d,l=this;return rf(this,(function(h){return i={appID:t,userID:r,deviceID:n,connectSessionID:_U(),os:"web",sdkVersion:OF.VERSION,isOversea:OF.OVERSEA,expectedAddr:kF("EXPECTED_ADDR"),productPlatform:"BytePlus",enableCloudProxy:s},o&&a&&(i.feedbackInfo=[{feedbackIP:null===(c=a.publicIPs[0])||void 0===c?void 0:c.ip,feedbackReason:{type:"NODE_CHANGED",reason:o}}],delete i.expectedAddr),u=Date.now(),jB.rtcGetAccess(0,JSON.stringify(i),0,YF.REQUEST,e.join(","),i.connectSessionID),d=e.map((function(e,t){return tf(l,void 0,void 0,(function(){var r,n,o;return rf(this,(function(a){switch(a.label){case 0:return a.trys.push([0,2,,3]),[4,this._request.post(e,i)];case 1:return r=a.sent(),[3,3];case 2:throw n=a.sent(),new Vj(Nj.ICE_SERVER_WRONG,"get ICE config failed",n);case 3:if(200!==r.code)throw new Vj(Nj.ICE_SERVER_WRONG,"get ICE config failed",{server_code:r.code,message:JSON.stringify(r)});if(!(o=r.nodes[0]))throw new Vj(Nj.ICE_SERVER_WRONG,"ICE config server return empty nodes",{code:r.code,message:JSON.stringify(r)});return[2,{result:r,firstNode:o,index:t}]}}))}))})),[2,UU(d).then((function(t){var r=t.result;t.firstNode;var n=t.index;return jB.rtcGetAccess(200,JSON.stringify(r),Date.now()-u,YF.RESPONSE,e[n],i.connectSessionID),r})).catch((function(t){var r,n,o=null===(r=t[0])||void 0===r?void 0:r.error;throw jB.rtcGetAccess(+((null==o?void 0:o.code)||(null==o?void 0:o.server_code)),null===(n=t[0])||void 0===n?void 0:n.message,Date.now()-u,YF.RESPONSE,e.join(","),i.connectSessionID,{error:JSON.stringify(o)}),t}))]}))}))},e.prototype.abort=function(){this._request.isSending&&(PG.print("abort","HTTP Request of [getICEConfigFromServer] abort"),this._request.abort())},e}(),MG=function(){function e(){this._request=new NG}return e.prototype.getH264BlackList=function(){var e=this,t={keys:["web_h264_black_list"],labelSelector:"",sdkVersion:"4.45.0-blw.12",deviceType:"web"};this._request.timeout=800;var i=OF.CONFIG_REQUEST_DOMAINS.map((function(e){return"https://".concat(e,"/decision/v1/multi")}));jB.rtcGetConfig(0,JSON.stringify(t),0,i.join(","),zF.REQUEST,"",!1);var r=i.map((function(i,r){return tf(e,void 0,void 0,(function(){var e;return rf(this,(function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),[4,this._request.post(i,t)];case 1:return e=n.sent(),[3,3];case 2:throw n.sent(),new Vj(Nj.ICE_SERVER_WRONG,"get config failed");case 3:if(!Array.isArray(null==e?void 0:e.web_h264_black_list))throw new Vj(Nj.ICE_SERVER_WRONG,"get config failed");return[2,{result:e,index:r}]}}))}))}));return new Promise((function(e){UU(r).then((function(t){var r=t.result,n=t.index;IF.setH264BlackList(r.web_h264_black_list),jB.rtcGetConfig(200,JSON.stringify(r),0,i[n],zF.RESPONSE,"",!1),e(r.web_h264_black_list)})).catch((function(t){jB.rtcGetConfig(500,t.message,0,"",zF.RESPONSE,"",!1),e(IF.getH264BlackList()||[])}))}))},e.prototype.getAudioProfile=function(){var e=this,t={keys:["engine_BAC"],labelSelector:"",sdkVersion:"4.45.0-blw.12",deviceType:"web"},i=OF.CONFIG_REQUEST_DOMAINS.map((function(e){return"https://".concat(e,"/decision/v1/multi")}));jB.rtcGetConfig(0,JSON.stringify(t),0,i.join(","),zF.REQUEST,"",!1);var r=i.map((function(i,r){return tf(e,void 0,void 0,(function(){var e;return rf(this,(function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),[4,this._request.post(i,t)];case 1:return e=n.sent(),[3,3];case 2:throw n.sent(),new Vj(Nj.ICE_SERVER_WRONG,"get config failed");case 3:if(!Array.isArray(null==e?void 0:e.engine_BAC))throw new Vj(Nj.ICE_SERVER_WRONG,"get config failed");return[2,{result:e,index:r}]}}))}))}));return new Promise((function(e){UU(r).then((function(t){var r=t.result,n=t.index;IF.setAudioProfile(r.engine_BAC),jB.rtcGetConfig(200,JSON.stringify(r),0,i[n],zF.RESPONSE,"",!1),e(r.engine_BAC)})).catch((function(t){jB.rtcGetConfig(500,t.message,0,"",zF.RESPONSE,"",!1),e(IF.getAudioProfile()||[])}))}))},e}();function LG(e,t){var i=1,r=e;(e.width>t.width||e.height>t.height)&&(i=e.width/e.height>t.width/t.height?e.width/t.width:e.height/t.height,r={width:Math.floor(e.width/i),height:Math.floor(e.height/i)});return $_($_({},r),{scaleResolutionDownBy:i})}var UG=[{sub_index:0,video_index:0,framerate:30,height:1080,maxkbps:3e3,width:1920},{sub_index:1,video_index:0,framerate:30,height:720,maxkbps:1200,width:1280},{sub_index:2,video_index:0,framerate:30,height:630,maxkbps:1100,width:1120},{sub_index:3,video_index:0,framerate:30,height:540,maxkbps:1e3,width:960},{sub_index:4,video_index:1,framerate:30,height:450,maxkbps:800,width:800},{sub_index:5,video_index:1,framerate:30,height:360,maxkbps:600,width:640},{sub_index:6,video_index:1,framerate:30,height:270,maxkbps:400,width:480},{sub_index:7,video_index:2,framerate:15,height:180,maxkbps:300,width:320},{sub_index:8,video_index:2,framerate:15,height:144,maxkbps:200,width:256},{sub_index:9,video_index:3,framerate:15,height:90,maxkbps:100,width:160}],xG=[{width:1920,height:1080,maxLayers:3,totalPixels:2073600},{width:1280,height:720,maxLayers:3,totalPixels:921600},{width:960,height:540,maxLayers:3,totalPixels:518400},{width:640,height:360,maxLayers:2,totalPixels:230400},{width:480,height:270,maxLayers:2,totalPixels:129600},{width:320,height:180,maxLayers:1,totalPixels:57600},{width:0,height:0,maxLayers:1,totalPixels:0}];var VG={width:160,height:90,frameRate:15,maxkbps:100},FG={width:480,height:270,frameRate:15,maxkbps:400};function BG(e){if(!e.length)return[];var t=e.shift(),i=t.width/t.height,r=0,n=0,o=$_($_({},t),{video_index:n,sub_index:r++});delete o.rid;for(var a=[o],s=0,c=0;c<UG.length;c++)if(UG[c].height<t.height){s=c;break}var u=e.shift();for(c=s;c<UG.length;c++){var d=UG[c];if(u&&d.height<=(null==u?void 0:u.height)){var l=d.height===(null==u?void 0:u.height),h=$_($_({},u),{video_index:++n,sub_index:r++});if(delete h.rid,a.push(h),u=e.shift(),l)continue}a.push($_($_({},d),{width:Math.floor(d.height*i),video_index:n,sub_index:r++}))}return a}var jG,GG,HG,zG,KG=new Map,WG=function(e){return tf(void 0,void 0,void 0,(function(){return rf(this,(function(t){return[2,new Promise((function(t,i){if("chrome-stable"===SU()&&void 0===window.InstallTrigger)try{e.getStats((function(e){var i=[];e.result().forEach((function(e){if(!JG.includes(e.type)){var t={};e.names().forEach((function(i){t[i]=e.stat(i)})),i.push($_($_({},t),{id:e.id,type:e.type,timestamp:e.timestamp}))}})),t({all:i,getTrackStats:function(e){return i.filter((function(t){return"ssrc"!==t.type||t.googTrackId===e}))}})}))}catch(e){i(e)}else t({all:[],getTrackStats:function(){return[]}})}))]}))}))},XG=function(e){return tf(void 0,void 0,void 0,(function(){var t,i,r,n,o,a;return rf(this,(function(s){switch(s.label){case 0:return[4,e.getStats()];case 1:return t=s.sent(),i={all:[]},r=new Map,t.forEach((function(e){var t=r.get(e.type)||new Map;t.set(e.id,e),r.set(e.type,t),i.all.push(e)})),n=function(e,t){e.forEach((function(e){var i,n,o,a,s,c,u,d,l,h,p=e.codecId,_=e.transportId,f=e.trackId,v=e.playoutId;if(null===(i=r.get(jG.codec))||void 0===i||i.forEach((function(e){e.id===p&&t.add(e)})),null===(n=r.get(jG.transport))||void 0===n||n.forEach((function(e){e.id===_&&(l=e,t.add(e))})),null===(o=r.get(jG.track))||void 0===o||o.forEach((function(e){e.id===f&&t.add(e)})),null===(a=r.get(jG.mediaPlayout))||void 0===a||a.forEach((function(e){e.id===v&&t.add(e)})),l){var m=l.localCertificateId,y=l.remoteCertificateId,S=l.selectedCandidatePairId;null===(s=r.get(jG.certificate))||void 0===s||s.forEach((function(e){(e.id===m||e.id===y)&&t.add(e)})),null===(c=r.get(jG.candidatePair))||void 0===c||c.forEach((function(e){e.id===S&&(h=e,t.add(e))}))}if(h){var g=h.localCandidateId,E=h.remoteCandidateId;null===(u=r.get(jG.localCandidate))||void 0===u||u.forEach((function(e){e.id===g&&t.add(e)})),null===(d=r.get(jG.remoteCandidate))||void 0===d||d.forEach((function(e){e.id===E&&t.add(e)}))}}))},null===(o=r.get(jG.mediaSource))||void 0===o||o.forEach((function(e){var t,o=new Set;o.add(e);var a=[];null===(t=r.get(jG.outboundRtp))||void 0===t||t.forEach((function(t){var i;t.mediaSourceId===e.id&&(o.add(t),a.push(t),null===(i=r.get(jG.remoteInboundRtp))||void 0===i||i.forEach((function(e){e.localId===t.id&&o.add(e)})))})),n(a,o),i[e.trackIdentifier]=Array.from(o)})),null===(a=r.get(jG.inboundRtp))||void 0===a||a.forEach((function(e){var t,o,a=new Set;a.add(e),null===(t=r.get(jG.remoteOutboundRtp))||void 0===t||t.forEach((function(t){t.localId===e.id&&a.add(t)})),n([e],a);var s=e.trackIdentifier;s||null===(o=r.get(jG.track))||void 0===o||o.forEach((function(t){t.id===e.trackId&&(s=t.trackIdentifier)})),i[s]=Array.from(a)})),[2,i]}}))}))},qG=function(e,t,i){return tf(void 0,void 0,void 0,(function(){var r,n,o,a,s;return rf(this,(function(c){switch(c.label){case 0:return r=null==t?void 0:t.id,e instanceof RTCPeerConnection?((!(n=KG.get(e))||Date.now()-n.timestamp>100)&&(n={timestamp:Date.now(),statsPromise:XG(e),extraStatsPromise:HU?WG(e):Promise.resolve(void 0)},KG.set(e,n)),[4,n.statsPromise]):[2,[]];case 1:return o=c.sent(),a=(r?o[r]:o.all)||[],i||!HU?[3,3]:[4,n.extraStatsPromise];case 2:(s=c.sent())&&(a=a.concat((r?s.getTrackStats(r):s.all)||[])),c.label=3;case 3:return[2,a]}}))}))};SU(),function(e){e.codec="codec",e.inboundRtp="inbound-rtp",e.outboundRtp="outbound-rtp",e.remoteInboundRtp="remote-inbound-rtp",e.remoteOutboundRtp="remote-outbound-rtp",e.mediaSource="media-source",e.csrc="csrc",e.peerConnection="peer-connection",e.dataChannel="data-channel",e.stream="stream",e.track="track",e.transceiver="transceiver",e.sender="sender",e.receiver="receiver",e.transport="transport",e.sctpTransport="sctp-transport",e.candidatePair="candidate-pair",e.localCandidate="local-candidate",e.remoteCandidate="remote-candidate",e.certificate="certificate",e.iceServer="ice-server",e.mediaPlayout="media-playout"}(jG||(jG={})),function(e){e[e.encode=0]="encode",e[e.decode=1]="decode"}(GG||(GG={})),function(e){e[e.none=0]="none",e[e.cpu=1]="cpu",e[e.bandwidth=2]="bandwidth",e[e.other=3]="other"}(HG||(HG={})),function(e){e[e.unknown=0]="unknown",e[e.controlling=1]="controlling",e[e.controlled=2]="controlled"}(zG||(zG={}));var YG,JG=["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"],QG=function(){return tf(void 0,void 0,void 0,(function(){var e,t,i,r,n,o,a,s,c,u,d,l,h,p;return rf(this,(function(_){switch(_.label){case 0:if(YG)return[2,YG];e=[],_.label=1;case 1:return _.trys.push([1,5,,6]),[4,LU()];case 2:if(!(t=_.sent()))return[2,e];i=t.split("\n"),r=!1;try{for(n=nf(i),o=n.next();!o.done;o=n.next())if((a=o.value).includes("level-asymmetry-allowed=1")&&a.includes("packetization-mode=1")&&a.includes("profile-level-id=42e0")){r=!0;break}}catch(e){h={error:e}}finally{try{o&&!o.done&&(p=n.return)&&p.call(n)}finally{if(h)throw h.error}}return r?(s=navigator.userAgent.toLowerCase(),c=!1,u=["mqqbrowser","miuibrowser"],[4,(new MG).getH264BlackList()]):[3,4];case 3:for(d=_.sent(),u.push.apply(u,af([],of(d),!1)),l=0;l<u.length;l++)s.includes(u[l])&&(c=!0);!c&&e.push("H264"),_.label=4;case 4:return(null==t?void 0:t.includes("VP8"))&&e.push("vp8"),YG=e,[2,e];case 5:return _.sent(),[2,e];case 6:return[2]}}))}))},ZG=function(){return"undefined"!=typeof TransformStream&&"undefined"!=typeof RTCRtpSender&&"undefined"!=typeof RTCRtpReceiver&&void 0!==RTCRtpSender.prototype.createEncodedStreams&&void 0!==RTCRtpReceiver.prototype.createEncodedStreams},$G=new LB("BasicHandler",3),eH={iceServers:[],iceTransportPolicy:"all",bundlePolicy:"max-bundle",rtcpMuxPolicy:"require",sdpSemantics:"unified-plan",encodedInsertableStreams:!!ZG()||void 0};function tH(e){return Math.ceil(e)}var iH=function(e){function t(t,i){var r=e.call(this)||this;return r._offerIce={},r._answerIce={},r._initSctpEvents=!1,r.monitor=t,r._peerConnection=new RTCPeerConnection(eH),r._dataChannel=r._peerConnection.createDataChannel("signaling",{negotiated:!0,id:100}),r._context=i,r._dataChannel.binaryType="arraybuffer",r._peerConnection.ontrack=function(e){var t,i;$G.print("constructor","pc.ontrack ".concat(e.track.kind," ").concat(e.track.id," ").concat(null===(i=null===(t=e.streams)||void 0===t?void 0:t[0])||void 0===i?void 0:i.id)),r.emit("ontrack",e)},r._peerConnection.onconnectionstatechange=function(e){$G.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,JF["".concat(e.toUpperCase())])},r}return C_(t,e),t.prototype.disconnect=function(){this._peerConnection.close(),this._dataChannel.close(),this._peerConnection.ontrack=null},t.prototype.destroy=function(){$G.print("destroy"),this.disconnect(),this._context=void 0},t.prototype._simulcast=function(e,t,i,r,n){var o=[];1===e.videoEncodeConfig.length?(o=function(e,t){var i=[];if(t<=1)return i;var r=1,n=1;return e.width/e.height>16/9?(r=e.width/VG.width,n=e.width/FG.width):(r=e.height/VG.height,n=e.height/FG.height),i.push({maxkbps:VG.maxkbps,scaleResolutionDownBy:r,frameRate:VG.frameRate,width:Math.floor(e.width/r),height:Math.floor(e.height/r)}),t<=2||r>2&&i.unshift({maxkbps:FG.maxkbps,scaleResolutionDownBy:n,frameRate:FG.frameRate,width:Math.floor(e.width/n),height:Math.floor(e.height/n)}),i}(t,n),$G.print("simulcast() ","simulcastLayers: %o",o)):(o=e.videoEncodeConfig.slice(1).slice(1-n).map((function(e){return $_({frameRate:e.frameRate||15,maxkbps:e.maxKbps||600},LG(t,e))})),$G.print("simulcast() ","simulcastLayers2: %o",o)),o.forEach((function(e,t){var n={maxBitrate:1e3*e.maxkbps,scaleResolutionDownBy:tH(e.scaleResolutionDownBy),rid:"".concat(t+1),maxFramerate:e.frameRate};i.sendEncodings&&i.sendEncodings.unshift(n),r.push({width:e.width,height:e.height,framerate:e.frameRate,maxkbps:e.maxkbps,rid:"".concat(t+1)})}))},t.prototype.internalPublish=function(e,t){var i=e.stream,r=e.videoTrack,n=e.audioTrack,o=e.enableSimulcast,a=e.pubAudio,s=e.pubVideo,c={direction:"sendonly",streams:[i]},u={direction:"sendonly",streams:[i]},d=[],l=[];if(Array.isArray(null==e?void 0:e.videoEncodeConfig)&&e.videoEncodeConfig.length){var h=null==r?void 0:r.getTrack(),p={width:640,height:360,frameRate:30};if(h){var _=null==h?void 0:h.getSettings();p={width:Math.floor(_.width),height:Math.floor(_.height),frameRate:Math.floor(_.frameRate)}}var f=null==e?void 0:e.videoEncodeConfig[0],v=LG(p,f);e.prevScaleResolutionDownBy=v.scaleResolutionDownBy,e.videoInputConfig=p;var m={maxBitrate:1e3*f.maxKbps,scaleResolutionDownBy:tH(v.scaleResolutionDownBy),rid:"0",maxFramerate:f.frameRate||15};if(u.sendEncodings=[m],d.push({width:v.width,height:v.height,framerate:f.frameRate,maxkbps:f.maxKbps,rid:"0"}),o){var y=function(e){for(var t=0,i=e.width*e.height,r=0;r<xG.length;r++)if(i>=xG[r].totalPixels){t=r;break}if(0===t)return xG[t].maxLayers;var n=xG[t-1].totalPixels;return(n-i)/(n-xG[t].totalPixels)<.1?xG[t-1].maxLayers:xG[t].maxLayers}(v);$G.print("simulcast() ","maxLayers: %o",y),y>1&&(this._simulcast(e,p,u,d,y),(null==t?void 0:t.simulcastOnDemand)&&(l=BG(af([],of(d),!1))),$G.print("subVideoDesc","desc: %o ",l))}}$G.print("publish videoTransceiverInit videoDescriptions","",u,d);var S=null==n?void 0:n.getTrack();(null==n?void 0:n.mixType)!==uf.PLAYOUT&&(null==n?void 0:n.mixedAudioTrack)&&(S=null==n?void 0:n.mixedAudioTrack),S=a&&S?S:"audio";var g=null==r?void 0:r.getTrack();g=s&&g?g:"video";try{this.monitor.rtcInvokeStatus(JSON.stringify({aTrack:jU(S),vTrack:jU(g),audioTransceiverInit:c,videoTransceiverInit:u}),0,"Handler.internalPublish","",0)}catch(e){}return{semantics:"unified-plan",videoDescriptions:d,subVideoDescriptions:l,transceiverInit:{aTrack:S,vTrack:g,audioTransceiverInit:c,videoTransceiverInit:u}}},t.prototype.updateDegradationPreference=function(e){var t,i;return tf(this,void 0,void 0,(function(){var r,n,o;return rf(this,(function(a){switch(a.label){case 0:return $G.print("updateDegradationPreference()"),r=null===(t=e.videoTrack)||void 0===t?void 0:t.getTrack(),n=e.videoTransceiver,r&&e.pubVideo&&n?(o=null===(i=n.sender)||void 0===i?void 0:i.getParameters())?(r.contentHint?o.degradationPreference=r.degradationPreference?r.degradationPreference:"motion"===(s=r.contentHint)?"maintain-framerate":"detail"===s||"text"===s?"maintain-resolution":void 0:delete o.degradationPreference,[4,null==n?void 0:n.sender.setParameters(o)]):[3,2]:($G.print("updateDegradationPreference()","no pub"),[2]);case 1:a.sent();try{this.monitor.rtcInvokeStatus(JSON.stringify(o),0,"Handler.updateDegradationPreference","",0)}catch(e){}a.label=2;case 2:return[2]}var s}))}))},t.prototype.updateMaxBitrate=function(e){var t,i,r;$G.print("updateMaxBitrate()");var n=null===(t=e.videoTrack)||void 0===t?void 0:t.getTrack(),o=e.videoTransceiver;if(n&&e.pubVideo&&o){var a=null===(i=o.sender)||void 0===i?void 0:i.getParameters();if(a){a.encodings=null===(r=null==a?void 0:a.encodings)||void 0===r?void 0:r.map((function(t){var i,r=+t.rid||0,n=null===(i=e.videoEncodeConfig[r])||void 0===i?void 0:i.maxKbps;return"number"==typeof n&&(t.maxBitrate=1e3*n),t})),null==o||o.sender.setParameters(a);try{this.monitor.rtcInvokeStatus(JSON.stringify(a.encodings),0,"Handler.updateScaleResolutionDownBy","",0)}catch(e){}}}else $G.print("updateMaxBitrate()","no pub")},t.prototype.updateScaleResolutionDownBy=function(e){var t,i,r;return tf(this,void 0,void 0,(function(){var n,o,a,s,c,u,d;return rf(this,(function(l){if($G.print("updateScaleResolutionDownBy()"),n=null===(t=e.videoTrack)||void 0===t?void 0:t.getTrack(),o=e.videoTransceiver,!n||!e.pubVideo||!o)return $G.print("updateScaleResolutionDownBy()","no pub"),[2];if(a=null==n?void 0:n.getSettings(),s={width:Math.floor(a.width),height:Math.floor(a.height),frameRate:Math.floor(a.frameRate)},(c=LG(s,e.videoEncodeConfig[0])).scaleResolutionDownBy===e.prevScaleResolutionDownBy&&$G.print("updateScaleResolutionDownBy()","no change %o",e.prevScaleResolutionDownBy),u=null===(i=o.sender)||void 0===i?void 0:i.getParameters()){d=c.scaleResolutionDownBy/e.prevScaleResolutionDownBy,u.encodings=null===(r=null==u?void 0:u.encodings)||void 0===r?void 0:r.map((function(t){var i;Math.max(t.scaleResolutionDownBy=(t.scaleResolutionDownBy||1)*d,1);var r=+t.rid||0;return t.maxFramerate=(null===(i=e.videoEncodeConfig[r])||void 0===i?void 0:i.frameRate)||t.maxFramerate,t})),e.prevScaleResolutionDownBy=c.scaleResolutionDownBy,e.videoInputConfig=s,null==o||o.sender.setParameters(u);try{this.monitor.rtcInvokeStatus(JSON.stringify(u.encodings),0,"Handler.updateScaleResolutionDownBy","",0)}catch(e){}}return[2]}))}))},t.prototype.getStats=function(e,t){return qG(this._peerConnection,e,t)},t.prototype.setLocalDescription=function(e,t){var i;return tf(this,void 0,void 0,(function(){var r,n,o,a=this;return rf(this,(function(s){switch(s.label){case 0:r=fU(),s.label=1;case 1:return s.trys.push([1,3,,4]),[4,this._peerConnection.setLocalDescription(new RTCSessionDescription({type:"offer",sdp:e}))];case 2:return s.sent(),this.monitor.rtcSetDescription(0,e,iB.W_1,"local"===(null==t?void 0:t.streamUserId)?rB.UP:rB.DOWN,(null==t?void 0:t.streamId)||"",(null==t?void 0:t.streamUserId)||"",fU()-r,{type:"offer"}),this._initSctpEvents||(this._initSctpEvents=!0,(n=null===(i=this._peerConnection)||void 0===i?void 0:i.sctp)&&(n.onstatechange=function(){a.monitor.rtcInvokeStatus("sctp state change TO: ".concat(n.state),0,"sctp","",0)},n.transport&&(n.transport.onstatechange=function(){var e;a.monitor.rtcInvokeStatus("dtls state change TO: ".concat(null===(e=null==n?void 0:n.transport)||void 0===e?void 0:e.state),0,"dtls","",0)}))),[3,4];case 3:return o=s.sent(),this.monitor.rtcSetDescription(-1,o.message+e,iB.W_1,"local"===(null==t?void 0:t.streamUserId)?rB.UP:rB.DOWN,"","",fU()-r,{type:"offer"}),[3,4];case 4:return[2]}}))}))},t.prototype.setRemoteDescription=function(e,t){return tf(this,void 0,void 0,(function(){var i,r;return rf(this,(function(n){switch(n.label){case 0:i=fU(),n.label=1;case 1:return n.trys.push([1,3,,4]),[4,this._peerConnection.setRemoteDescription(new RTCSessionDescription({type:"answer",sdp:e}))];case 2:return n.sent(),this.monitor.rtcSetDescription(0,e,iB.W_0,"local"===(null==t?void 0:t.streamUserId)?rB.UP:rB.DOWN,(null==t?void 0:t.streamId)||"",(null==t?void 0:t.streamUserId)||"",fU()-i,{type:"answer"}),[3,4];case 3:return r=n.sent(),this.monitor.rtcSetDescription(-1,r.message+e,iB.W_1,"local"===(null==t?void 0:t.streamUserId)?rB.UP:rB.DOWN,(null==t?void 0:t.streamId)||"",(null==t?void 0:t.streamUserId)||"",fU()-i,{type:"answer"}),[3,4];case 4:return[2]}}))}))},t.prototype.setCurrentDescription=function(){return tf(this,void 0,void 0,(function(){return rf(this,(function(e){return[2]}))}))},Object.defineProperty(t.prototype,"pc",{get:function(){return this._peerConnection},enumerable:!1,configurable:!0}),t.prototype.addBitrateLimit=function(e,t){null==e||e.rtp.forEach((function(i){var r=i.codec,n=i.payload;if(["vp8","h264"].includes(r.toLocaleLowerCase())){var o=e.fmtp.find((function(e){return e.payload===n}));o?o.config=af(af([],of(o.config.split(";")),!1),["x-google-min-bitrate=100","x-google-start-bitrate=".concat(t)],!1).join(";"):e.fmtp.push({payload:n,config:"x-google-min-bitrate=100;x-google-start-bitrate=".concat(t)})}}))},t}(xF.exports.EventEmitter),rH={},nH={},oH={exports:{}},aH=oH.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(aH).forEach((function(e){aH[e].forEach((function(e){e.reg||(e.reg=/(.*)/),e.format||(e.format="%s")}))})),function(e){var t=function(e){return String(Number(e))===e?Number(e):e},i=function(e,i,r){var n=e.name&&e.names;e.push&&!i[e.push]?i[e.push]=[]:n&&!i[e.name]&&(i[e.name]={});var o=e.push?{}:n?i[e.name]:i;!function(e,i,r,n){if(n&&!r)i[n]=t(e[1]);else for(var o=0;o<r.length;o+=1)null!=e[o+1]&&(i[r[o]]=t(e[o+1]))}(r.match(e.reg),o,e.names,e.name),e.push&&i[e.push].push(o)},r=oH.exports,n=RegExp.prototype.test.bind(/^([a-z])=(.*)/);e.parse=function(e){var t={},o=[],a=t;return e.split(/(\r\n|\r|\n)/).filter(n).forEach((function(e){var t=e[0],n=e.slice(2);"m"===t&&(o.push({rtp:[],fmtp:[]}),a=o[o.length-1]);for(var s=0;s<(r[t]||[]).length;s+=1){var c=r[t][s];if(c.reg.test(n))return i(c,a,n)}})),t.media=o,t};var o=function(e,i){var r=i.split(/=(.+)/,2);return 2===r.length?e[r[0]]=t(r[1]):1===r.length&&i.length>1&&(e[r[0]]=void 0),e};e.parseParams=function(e){return e.split(/;\s?/).reduce(o,{})},e.parseFmtpConfig=e.parseParams,e.parsePayloads=function(e){return e.toString().split(" ").map(Number)},e.parseRemoteCandidates=function(e){for(var i=[],r=e.split(" ").map(t),n=0;n<r.length;n+=3)i.push({component:r[n],ip:r[n+1],port:r[n+2]});return i},e.parseImageAttributes=function(e){return e.split(" ").map((function(e){return e.substring(1,e.length-1).split(",").reduce(o,{})}))},e.parseSimulcastStreamList=function(e){return e.split(";").map((function(e){return e.split(",").map((function(e){var i,r=!1;return"~"!==e[0]?i=t(e):(i=t(e.substring(1,e.length)),r=!0),{scid:i,paused:r}}))}))}}(nH);var sH=oH.exports,cH=/%[sdv%]/g,uH=function(e){var t=1,i=arguments,r=i.length;return e.replace(cH,(function(e){if(t>=r)return e;var n=i[t];switch(t+=1,e){case"%%":return"%";case"%s":return String(n);case"%d":return Number(n);case"%v":return""}}))},dH=function(e,t,i){var r=[e+"="+(t.format instanceof Function?t.format(t.push?i:i[t.name]):t.format)];if(t.names)for(var n=0;n<t.names.length;n+=1){var o=t.names[n];t.name?r.push(i[t.name][o]):r.push(i[t.names[n]])}else r.push(i[t.name]);return uH.apply(null,r)},lH=["v","o","s","i","u","e","p","c","b","t","r","z","a"],hH=["i","c","b","a"],pH=nH,_H=function(e,t){t=t||{},null==e.version&&(e.version=0),null==e.name&&(e.name=" "),e.media.forEach((function(e){null==e.payloads&&(e.payloads="")}));var i=t.outerOrder||lH,r=t.innerOrder||hH,n=[];return i.forEach((function(t){sH[t].forEach((function(i){i.name in e&&null!=e[i.name]?n.push(dH(t,i,e)):i.push in e&&null!=e[i.push]&&e[i.push].forEach((function(e){n.push(dH(t,i,e))}))}))})),e.media.forEach((function(e){n.push(dH("m",sH.m[0],e)),r.forEach((function(t){sH[t].forEach((function(i){i.name in e&&null!=e[i.name]?n.push(dH(t,i,e)):i.push in e&&null!=e[i.push]&&e[i.push].forEach((function(e){n.push(dH(t,i,e))}))}))}))})),n.join("\r\n")+"\r\n"};rH.write=_H,rH.parse=pH.parse,rH.parseParams=pH.parseParams,rH.parseFmtpConfig=pH.parseFmtpConfig,rH.parsePayloads=pH.parsePayloads,rH.parseRemoteCandidates=pH.parseRemoteCandidates,rH.parseImageAttributes=pH.parseImageAttributes,rH.parseSimulcastStreamList=pH.parseSimulcastStreamList;var fH=Math.pow(2,32),vH=function(){return Math.floor(Math.random()*fH+1e3)},mH=function(e,t,i){return i||(i=vH()),[{id:i,attribute:"cname",value:"kp34Za0H+aVf862l"},{id:i,attribute:"msid",value:"".concat(e.id," ").concat(e.id,"-").concat(t)},{id:i,attribute:"mslabel",value:"".concat(e.id)},{id:i,attribute:"label",value:"".concat(e.id,"-").concat(t)}]};function yH(e){return e.direction="inactive",e.port=0,delete e.ext,delete e.ssrcs,delete e.ssrcGroups,delete e.simulcast,delete e.simulcast_03,delete e.rids,delete e.extmapAllowMixed,delete e.bundleOnly,e}var SH=function(e,t,i){var r=$_($_({},e),{invalid:[{value:"realx-exts:rscp"}],media:[t,i]});return delete r.groups,delete r.msidSemantic,rH.write(r)};function gH(e){return tf(this,void 0,void 0,(function(){var t,i,r,n,o;return rf(this,(function(a){switch(a.label){case 0:return t={},i=e.publicIPs,r=e.certFingerprint,n=e.iceParams,t.fingerprint={type:"sha-256",hash:r},t.icePwd=n.serverIcePwd,o=t,[4,EH(n.serverIceUfrag)];case 1:return o.iceUfrag=a.sent(),zB.setStats({connection_id:t.iceUfrag}),t.candidates=function(e){if(!Array.isArray(e))return[];var t=0,i=2130706431,r=[];return e.forEach((function(e){var n={component:1,ip:e.ip,type:"host",generation:e.generation};e.udpPorts&&e.udpPorts.forEach((function(e){r.push($_($_({},n),{foundation:t++,transport:"udp",port:e,priority:i}))})),e.tcpPorts&&e.tcpPorts.forEach((function(e){r.push($_($_({},n),{foundation:t++,transport:"tcp",port:e,tcptype:"passive",priority:i-1e3}))}))})),r}(i),t.setup="active",t.iceOptions="renomination",[2,t]}}))}))}var EH=function(e){return tf(void 0,void 0,void 0,(function(){var t,i,r,n,o,a,s;return rf(this,(function(c){switch(c.label){case 0:return t=new TextEncoder,i=t.encode("PREC"),n=Uint8Array.bind,[4,yU.b64str2ab(e)];case 1:return r=new(n.apply(Uint8Array,[void 0,c.sent()])),o=t.encode(Date.now().toString()).slice(-4),(a=new Uint8Array(2))[0]=0,a[1]=1,s=vU(Uint8Array,i,r,o,a),[4,yU.ab2b64str(s.buffer)];case 2:return[2,c.sent()]}}))}))},bH=function(e,t){var i,r,n=0;if(Array.isArray(e.fmtp)&&Array.isArray(e.rtp)){try{for(var o=nf(e.fmtp),a=o.next();!a.done;a=o.next()){var s=a.value;if(s.config.includes("level-asymmetry-allowed=1")&&s.config.includes("packetization-mode=1")&&s.config.includes("profile-level-id=42e0")){n=s.payload;break}}}catch(e){i={error:e}}finally{try{a&&!a.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}for(var c=0;c<e.rtp.length;c++){var u=e.rtp[c];if("H264"===t){if(u.payload===n){e.rtp.unshift(e.rtp.splice(c,1)[0]);break}}else if(u.codec===t){e.rtp.unshift(e.rtp.splice(c,1)[0]);break}}var d=[];e.rtp.forEach((function(e){return d.push(e.payload)})),e.payloads=d.join(" ")}},IH=A,TH=nc,AH=Mm.exports.getWeakData,RH=Mt,CH=H,OH=hc,wH=Xc,kH=Ve,NH=wi.set,PH=wi.getterFor,DH=Ia.find,MH=Ia.findIndex,LH=IH([].splice),UH=0,xH=function(e){return e.frozen||(e.frozen=new VH)},VH=function(){this.entries=[]},FH=function(e,t){return DH(e.entries,(function(e){return e[0]===t}))};VH.prototype={get:function(e){var t=FH(this,e);if(t)return t[1]},has:function(e){return!!FH(this,e)},set:function(e,t){var i=FH(this,e);i?i[1]=t:this.entries.push([e,t])},delete:function(e){var t=MH(this.entries,(function(t){return t[0]===e}));return~t&&LH(this.entries,t,1),!!~t}};var BH,jH={getConstructor:function(e,t,i,r){var n=e((function(e,n){OH(e,o),NH(e,{type:t,id:UH++,frozen:void 0}),null!=n&&wH(n,e[r],{that:e,AS_ENTRIES:i})})),o=n.prototype,a=PH(t),s=function(e,t,i){var r=a(e),n=AH(RH(t),!0);return!0===n?xH(r).set(t,i):n[r.id]=i,e};return TH(o,{delete:function(e){var t=a(this);if(!CH(e))return!1;var i=AH(e);return!0===i?xH(t).delete(e):i&&kH(i,t.id)&&delete i[t.id]},has:function(e){var t=a(this);if(!CH(e))return!1;var i=AH(e);return!0===i?xH(t).has(e):i&&kH(i,t.id)}}),TH(o,i?{get:function(e){var t=a(this);if(CH(e)){var i=AH(e);return!0===i?xH(t).get(e):i?i[t.id]:void 0}},set:function(e,t){return s(this,e,t)}}:{add:function(e){return s(this,e,!0)}}),n}},GH=o,HH=A,zH=nc,KH=Mm.exports,WH=by,XH=jH,qH=H,YH=jm,JH=wi.enforce,QH=ai,ZH=!GH.ActiveXObject&&"ActiveXObject"in GH,$H=function(e){return function(){return e(this,arguments.length?arguments[0]:void 0)}},ez=WH("WeakMap",$H,XH);if(QH&&ZH){BH=XH.getConstructor($H,"WeakMap",!0),KH.enable();var tz=ez.prototype,iz=HH(tz.delete),rz=HH(tz.has),nz=HH(tz.get),oz=HH(tz.set);zH(tz,{delete:function(e){if(qH(e)&&!YH(e)){var t=JH(this);return t.frozen||(t.frozen=new BH),iz(this,e)||t.frozen.delete(e)}return iz(this,e)},has:function(e){if(qH(e)&&!YH(e)){var t=JH(this);return t.frozen||(t.frozen=new BH),rz(this,e)||t.frozen.has(e)}return rz(this,e)},get:function(e){if(qH(e)&&!YH(e)){var t=JH(this);return t.frozen||(t.frozen=new BH),rz(this,e)?nz(this,e):t.frozen.get(e)}return nz(this,e)},set:function(e,t){if(qH(e)&&!YH(e)){var i=JH(this);i.frozen||(i.frozen=new BH),rz(this,e)?oz(this,e,t):i.frozen.set(e,t)}else oz(this,e,t);return this}})}var az=function(e){function t(){var t,i,r=e.call(this)||this;return r.inited=!1,r.deviceMap={audioinput:new Map,audiooutput:new Map,videoinput:new Map},r.checkDeviceChangeTimer=null,r.isSupportedPermissionsQuery=!1,r.isGrantedMicrophonePermission=!1,r.isGrantedCameraPermission=!1,r.isSupportedPermissionsQuery=!mU()&&!!(null===(i=null===(t=navigator)||void 0===t?void 0:t.permissions)||void 0===i?void 0:i.query),r._handleDeviceChange=r._handleDeviceChange.bind(r),!mU()&&r.refreshDevices(),r}return C_(t,e),t.prototype.refreshDevices=function(){return tf(this,void 0,void 0,(function(){var e,t,i=this;return rf(this,(function(r){switch(r.label){case 0:if(!navigator.mediaDevices)return[2];if(e=void 0,!gU)return[3,4];r.label=1;case 1:return r.trys.push([1,3,,4]),[4,navigator.mediaDevices.getUserMedia({audio:!0})];case 2:return e=r.sent(),[3,4];case 3:return r.sent(),[3,4];case 4:return[4,navigator.mediaDevices.enumerateDevices()];case 5:return t=r.sent(),e&&e.getTracks().forEach((function(e){return e.stop()})),t.forEach((function(e){var t;e.deviceId&&(null===(t=i.deviceMap[e.kind])||void 0===t||t.set(e.deviceId,e))})),this.inited||this.initListener(),this.inited=!0,[2]}}))}))},t.prototype.initListener=function(){var e,t;return tf(this,void 0,void 0,(function(){var i,r,n=this;return rf(this,(function(o){switch(o.label){case 0:if(void 0!==(null===(e=navigator.mediaDevices)||void 0===e?void 0:e.ondevicechange)&&"function"==typeof(null===(t=navigator.mediaDevices)||void 0===t?void 0:t.addEventListener)?navigator.mediaDevices.addEventListener("devicechange",(function(){n._handleDeviceChange(),setTimeout((function(){n._handleDeviceChange()}),300)})):this.checkDeviceChangeTimer=window.setInterval((function(){n._handleDeviceChange()}),3e3),!this.isSupportedPermissionsQuery)return[3,7];o.label=1;case 1:return o.trys.push([1,3,,4]),[4,navigator.permissions.query({name:"microphone"})];case 2:return i=o.sent(),this.isGrantedMicrophonePermission="granted"===i.state,i.addEventListener("change",(function(){n.isGrantedMicrophonePermission="granted"===i.state})),[3,4];case 3:return o.sent(),[3,4];case 4:return o.trys.push([4,6,,7]),[4,navigator.permissions.query({name:"camera"})];case 5:return r=o.sent(),this.isGrantedCameraPermission="granted"===r.state,r.addEventListener("change",(function(){n.isGrantedCameraPermission="granted"===r.state})),[3,7];case 6:return o.sent(),[3,7];case 7:return[2]}}))}))},t.prototype._handleDeviceChange=function(){return tf(this,void 0,void 0,(function(){var e,t,i,r=this;return rf(this,(function(n){switch(n.label){case 0:return e=void 0,gU?[4,navigator.mediaDevices.getUserMedia({audio:!0})]:[3,2];case 1:e=n.sent(),n.label=2;case 2:return[4,navigator.mediaDevices.enumerateDevices()];case 3:return t=(t=n.sent()).filter((function(e){return!!e.deviceId})),e&&e.getTracks().forEach((function(e){return e.stop()})),i=Array.from(af(af(af([],of(this.deviceMap.audioinput.values()),!1),of(this.deviceMap.videoinput.values()),!1),of(this.deviceMap.audiooutput.values()),!1)),t.forEach((function(e){var t=r.deviceMap[e.kind].get(e.deviceId);r.deviceMap[e.kind].set(e.deviceId,e),t||(e.kind.includes("video")?r.emit(hf.onVideoDeviceStateChanged,{mediaDeviceInfo:e,deviceState:"active"}):e.kind.includes("audio")&&r.emit(hf.onAudioDeviceStateChanged,{mediaDeviceInfo:e,deviceState:"active"}))})),i.forEach((function(e){t.find((function(t){return t.deviceId===e.deviceId&&t.kind===e.kind}))||(r.deviceMap[e.kind].delete(e.deviceId),e.kind.includes("video")?r.emit(hf.onVideoDeviceStateChanged,{mediaDeviceInfo:e,deviceState:"inactive"}):e.kind.includes("audio")&&r.emit(hf.onAudioDeviceStateChanged,{mediaDeviceInfo:e,deviceState:"inactive"}))})),[2]}}))}))},t.prototype.getUserMedia=function(e){return tf(this,void 0,void 0,(function(){var t;return rf(this,(function(i){switch(i.label){case 0:return[4,navigator.mediaDevices.getUserMedia(e)];case 1:return t=i.sent(),(null==e?void 0:e.audio)&&(this.isGrantedMicrophonePermission=!0),(null==e?void 0:e.video)&&(this.isGrantedCameraPermission=!0),this.refreshDevices(),[2,t]}}))}))},t.prototype.checkPermissionsByDevices=function(){return tf(this,void 0,void 0,(function(){var e,t;return rf(this,(function(i){switch(i.label){case 0:return e={audio:!1,video:!1},navigator.mediaDevices?[4,navigator.mediaDevices.enumerateDevices()]:[2,e];case 1:return t=i.sent(),e.audio=t.filter((function(e){return"audioinput"===e.kind&&e.label&&e.deviceId})).length>0,e.video=t.filter((function(e){return"videoinput"===e.kind&&e.label&&e.deviceId})).length>0,[2,e]}}))}))},t.prototype.getPermissions=function(e){var t;return void 0===e&&(e={}),tf(this,void 0,void 0,(function(){var i,r,n,o,a,s=this;return rf(this,(function(c){switch(c.label){case 0:if(i=e.audio,r=e.video,n=e.force,i||r||(i=!0,r=!0),o={audio:!1,video:!1},n)return[3,3];if(!this.isSupportedPermissionsQuery)return[3,1];if(i&&r){if(this.isGrantedMicrophonePermission&&this.isGrantedCameraPermission)return o.audio=!0,o.video=!0,[2,o]}else if(i&&this.isGrantedMicrophonePermission||r&&this.isGrantedCameraPermission)return o.audio=this.isGrantedMicrophonePermission,o.video=this.isGrantedCameraPermission,[2,o];return[3,3];case 1:return[4,this.checkPermissionsByDevices()];case 2:if(a=c.sent(),i&&r){if(a.audio&&a.video)return[2,a]}else if(i&&a.audio||r&&a.video)return[2,a];c.label=3;case 3:return(null===(t=navigator.mediaDevices)||void 0===t?void 0:t.getUserMedia)?[4,navigator.mediaDevices.getUserMedia({audio:i,video:r}).then((function(e){e&&(e.getTracks().forEach((function(e){return e.stop()})),i&&(o.audio=!0,s.isGrantedMicrophonePermission=!0),r&&(o.video=!0,s.isGrantedCameraPermission=!0))})).catch((function(){}))]:[3,5];case 4:c.sent(),c.label=5;case 5:return[4,this.refreshDevices()];case 6:return c.sent(),[2,o]}}))}))},t.prototype.enumerateDevices=function(){return tf(this,void 0,void 0,(function(){return rf(this,(function(e){switch(e.label){case 0:return[4,this.getPermissions()];case 1:return e.sent(),[4,this.refreshDevices()];case 2:return e.sent(),[2,Array.from(af(af(af([],of(this.deviceMap.audioinput.values()),!1),of(this.deviceMap.videoinput.values()),!1),of(this.deviceMap.audiooutput.values()),!1))]}}))}))},t.prototype.enumerateAudioCaptureDevices=function(){return tf(this,void 0,void 0,(function(){return rf(this,(function(e){switch(e.label){case 0:return[4,this.getPermissions({audio:!0})];case 1:return e.sent(),[4,this.refreshDevices()];case 2:return e.sent(),[2,Array.from(this.deviceMap.audioinput.values())]}}))}))},t.prototype.enumerateVideoCaptureDevices=function(){return tf(this,void 0,void 0,(function(){return rf(this,(function(e){switch(e.label){case 0:return[4,this.getPermissions({video:!0})];case 1:return e.sent(),[4,this.refreshDevices()];case 2:return e.sent(),[2,Array.from(this.deviceMap.videoinput.values())]}}))}))},t.prototype.enumerateAudioPlaybackDevices=function(){return tf(this,void 0,void 0,(function(){return rf(this,(function(e){switch(e.label){case 0:return[4,this.getPermissions({audio:!0})];case 1:return e.sent(),[4,this.refreshDevices()];case 2:return e.sent(),[2,Array.from(this.deviceMap.audiooutput.values())]}}))}))},t.prototype.getDeviceById=function(e){return tf(this,void 0,void 0,(function(){return rf(this,(function(t){switch(t.label){case 0:return[4,this.enumerateDevices()];case 1:return[2,t.sent().find((function(t){return t.deviceId===e}))]}}))}))},t}(VB),sz=new az;!mU()&&(window.__rtc_dd__=sz);var cz=new LB("VERTC",0),uz=new WeakMap,dz=function(e){return uz.get(e)},lz=function(e){function t(t,i){var r=e.call(this)||this;return r._trackId=t,r.mediaType=i,r}return C_(t,e),t.prototype.getId=function(){return this._trackId},t}(VB),hz=function(e){function t(t,i,r){var n=e.call(this,i,r)||this;return n._mediaTrack=t,n._initListeners(),n}return C_(t,e),t.prototype.getTrack=function(){return this._mediaTrack},t.prototype.setTrack=function(e){this._mediaTrack=e},t.prototype.close=function(){var e;return this._mediaTrack.onended=null,this._mediaTrack.onmute=null,this._mediaTrack.onunmute=null,null===(e=this._mediaTrack)||void 0===e?void 0:e.stop()},t.prototype._initListeners=function(){var e=this;this._mediaTrack instanceof MediaStreamTrack&&this._mediaTrack.addEventListener("ended",(function(){jB.rtcError("track-ended mediaType: ".concat(e._mediaTrack.kind),-1001),e.emit("track-ended",e)}))},t}(lz),pz=function(e){function t(t,i,r){var n=e.call(this,i,r)||this;return n._mediaTrack=t,n}return C_(t,e),t.prototype.getTrack=function(){return this._mediaTrack},t}(lz),_z=function(e){function t(t,i){var r=e.call(this,t,i,"video")||this;return r.dummy=!1,r.resolution={width:0,height:0},r._time=setInterval((function(){t.muted!==r._prevMuted&&cz.print("LocalVideoTrack.mutedChange: ",t.muted),r._prevMuted=t.muted}),100),r}return C_(t,e),t.prototype.updateVideoCaptureConfig=function(){return tf(this,void 0,void 0,(function(){var e;return rf(this,(function(t){switch(t.label){case 0:return this.videoCaptureConfig&&this.getTrack()?(cz.print("updateVideoEncoderConfig","update localVideoTrack: ",this.videoCaptureConfig),delete $_({},this.videoCaptureConfig).contentHint,[4,this.getTrack().applyConstraints(this.videoCaptureConfig)]):[2];case 1:return t.sent(),((e=this.getTrack().getSettings()).width&&e.width!==this.resolution.width||e.height&&e.height!==this.resolution.height)&&(this.resolution={width:e.width,height:e.height},this.emit("resolution-change",this.resolution)),[2]}}))}))},t.prototype.replaceTrack=function(e){this.setTrack(e)},t.prototype.close=function(){e.prototype.close.call(this),cz.print("LocalVideoTrack.close"),clearInterval(this._time)},t.prototype.setContentHint=function(e){this._mediaTrack&&"contentHint"in this._mediaTrack&&["text","motion","detail"].includes(e)&&(this._mediaTrack.contentHint=e)},t}(hz),fz=function(e){function t(t,i){var r=e.call(this,t,i,"audio")||this;return r.mixType=uf.PLAYOUT_AND_PUBLISH,r}return C_(t,e),t.prototype.getAudioLevel=function(){return this._audioLevelFetcher||(this._audioLevelFetcher=new iU(this.getTrack())),this._audioLevelFetcher.getAudioLevel()},t.prototype.checkHasInput=function(){return this._audioLevelFetcher||(this._audioLevelFetcher=new iU(this.getTrack())),this._audioLevelFetcher.checkHasInput()},t.prototype.resetAudioLevelFetcher=function(){var e;null===(e=this._audioLevelFetcher)||void 0===e||e.reset()},t.prototype.updateAudioCaptureConfig=function(){var e;return tf(this,void 0,void 0,(function(){return rf(this,(function(t){switch(t.label){case 0:return this.audioCaptureConfig?(cz.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}(hz),vz=function(e){function t(t,i){return e.call(this,t,i,"video")||this}return C_(t,e),t}(pz),mz=function(e){function t(t,i){return e.call(this,t,i,"audio")||this}return C_(t,e),t.prototype.getAudioLevel=function(){return this._audioLevelFetcher||(this._audioLevelFetcher=new iU(this.getTrack())),this._audioLevelFetcher.getAudioLevel()},t.prototype.resetAudioLevelFetcher=function(){var e;null===(e=this._audioLevelFetcher)||void 0===e||e.reset()},t}(pz),yz=function(e){function t(t,i){return e.call(this,t,i)||this}return C_(t,e),t}(fz),Sz=function(e){function t(t,i){return e.call(this,t,i)||this}return C_(t,e),t}(_z),gz=function(e){function t(t,i){return e.call(this,t,i)||this}return C_(t,e),t}(_z),Ez=function(e){function t(t,i){return e.call(this,t,i)||this}return C_(t,e),t}(fz),bz=function(e){function t(t,i){return e.call(this,t,i)||this}return C_(t,e),t}(_z),Iz=function(e){function t(t,i){return e.call(this,t,i)||this}return C_(t,e),t}(fz),Tz=function(e){function t(t,i){var r=this,n=document.createElement("video"),o=document.createElement("canvas");n.setAttribute("style","display:none"),o.setAttribute("style","display:none"),n.setAttribute("muted",""),n.muted=!0,n.setAttribute("autoplay",""),n.autoplay=!0,n.setAttribute("playsinline","");var a=t.getSettings(),s=a.width,c=a.height,u=a.frameRate;o.width=s,o.height=c,document.body.append(n),document.body.append(o),n.srcObject=new MediaStream([t]),n.play();var d=o.getContext("2d");if(!d)throw new Vj(Nj.UNEXPECTED_ERROR,"can not get canvas context");var l=o.captureStream(u).getVideoTracks()[0];return(r=e.call(this,l,i)||this)._originTrack=t,r._video=n,r._ctx=d,r._canvas=o,r._track=l,r._cancelLoop=function(e,t){var i=1/t,r=rU.getAudioContextInstance(),n=r.createGain();n.gain.value=0,n.connect(r.destination);var o=!1;return function t(){if(o)n=null;else{var a=r.createOscillator();a.onended=t,a.connect(n),a.start(0),a.stop(r.currentTime+i),e(r.currentTime)}}(),function(){o=!0}}((function(){return r.draw()}),u),r.__initListeners(),r}return C_(t,e),t.prototype.draw=function(){this._video.paused&&this._video.play(),this._video.videoWidth===this._canvas.width&&this._video.videoHeight===this._canvas.height||(this._canvas.width=this._video.videoWidth,this._canvas.height=this._video.videoHeight),this._ctx.drawImage(this._video,0,0,this._canvas.width,this._canvas.height),this._track.requestFrame&&this._track.requestFrame()},t.prototype.close=function(){var e,t;this._video.remove(),this._canvas.width=0,this._canvas.remove(),this._canvas=null,this._video=null,this._cancelLoop(),null===(e=this._originTrack)||void 0===e||e.stop(),this._originTrack=null,null===(t=this._track)||void 0===t||t.stop(),this._track=null},t.prototype.__initListeners=function(){var e=this;this._originTrack instanceof MediaStreamTrack&&this._originTrack.addEventListener("ended",(function(){var t;jB.rtcError("track-ended mediaType: ".concat(null===(t=e._originTrack)||void 0===t?void 0:t.kind),-1001),e.emit("track-ended",e)}))},t}(_z);function Az(e,t,i){var r,n;return tf(this,void 0,void 0,(function(){var o,a,s,c,u,d,l,h,p,_,f,v,m,y;return rf(this,(function(S){switch(S.label){case 0:cz.print("createCameraAndMicrophoneTrack","videoConstraints:",e,"audioConstraints:",t,"audioProfileManager:",i),null===(r=null==t?void 0:t.deviceId)||void 0===r||r.exact,a=(null===(n=null==e?void 0:e.deviceId)||void 0===n?void 0:n.exact)||"default",c=(s=i||{}).sampleRate,u=s.channel,d=s.agc,l=s.ans,h=s.aec,void 0===t.sampleRate&&(t.sampleRate=c),void 0===t.channelCount&&(t.channelCount=u),void 0===t.autoGainControl&&(t.autoGainControl=d),void 0===t.noiseSuppression&&(t.noiseSuppression=l),void 0===t.echoCancellation&&(t.echoCancellation=h),S.label=1;case 1:return S.trys.push([1,3,,4]),jB.rtcVideoCaptureEvent({event_type:TB.START,media_device_id:a}),p=fU(),[4,sz.getUserMedia({video:e,audio:t})];case 2:return o=S.sent(),jB.rtcVideoCaptureEvent({event_type:TB.START_CAPTURE_RESULT,media_device_id:a,reason:RB.SUCCESS,elapse:fU()-p}),[3,4];case 3:throw _=S.sent(),jB.rtcVideoCaptureEvent({event_type:TB.RUNNING_FAILED,media_device_id:a,error_code:_.code,reason:_.name+_.message}),new Vj(Nj.GET_VIDEO_TRACK_FAILED,"throw error from getUserMedia",_);case 4:return f=o.getVideoTracks()[0],uz.set(f,o),(v=new Sz(f,_U())).videoCaptureConfig=e,m=o.getAudioTracks()[0],uz.set(m,o),y=new yz(m,_U()),[2,{videoTrack:v,audioTrack:y}]}}))}))}function Rz(e){var t;return tf(this,void 0,void 0,(function(){var i,r,n,o,a,s;return rf(this,(function(c){switch(c.label){case 0:r=(null===(t=null==e?void 0:e.deviceId)||void 0===t?void 0:t.exact)||"default",c.label=1;case 1:return c.trys.push([1,3,,4]),cz.print("createCameraVideoTrack","constraints:",e),jB.rtcVideoCaptureEvent({event_type:TB.START,media_device_id:r}),n=fU(),[4,sz.getUserMedia({video:e})];case 2:return i=c.sent(),jB.rtcVideoCaptureEvent({event_type:TB.START_CAPTURE_RESULT,media_device_id:r,reason:RB.SUCCESS,elapse:fU()-n}),[3,4];case 3:throw o=c.sent(),jB.rtcVideoCaptureEvent({event_type:TB.RUNNING_FAILED,media_device_id:r,error_code:o.code,reason:o.name+o.message}),new Vj(Nj.GET_VIDEO_TRACK_FAILED,"throw error from getUserMedia",o);case 4:return a=i.getVideoTracks()[0],uz.set(a,i),(s=new Sz(a,_U())).videoCaptureConfig=e,[2,s]}}))}))}function Cz(e,t){var i;return tf(this,void 0,void 0,(function(){var r,n,o,a,s,c,u,d,l,h,p;return rf(this,(function(_){switch(_.label){case 0:cz.print("createCameraVideoTrack","constraints:",e),n=(null===(i=null==e?void 0:e.deviceId)||void 0===i?void 0:i.exact)||"default",a=(o=t||{}).sampleRate,s=o.channel,c=o.agc,u=o.ans,d=o.aec,void 0===e.sampleRate&&(e.sampleRate=a),void 0===e.channelCount&&(e.channelCount=s),void 0===e.autoGainControl&&(e.autoGainControl=c),void 0===e.noiseSuppression&&(e.noiseSuppression=u),void 0===e.echoCancellation&&(e.echoCancellation=d),_.label=1;case 1:return _.trys.push([1,3,,4]),jB.rtcVideoCaptureEvent({event_type:TB.START,media_device_id:n}),l=fU(),[4,sz.getUserMedia({audio:e})];case 2:return r=_.sent(),jB.rtcVideoCaptureEvent({event_type:TB.START_CAPTURE_RESULT,media_device_id:n,reason:RB.SUCCESS,elapse:fU()-l}),[3,4];case 3:throw h=_.sent(),jB.rtcVideoCaptureEvent({event_type:TB.RUNNING_FAILED,media_device_id:n,error_code:h.code,reason:h.name+h.message}),new Vj(Nj.GET_AUDIO_TRACK_FAILED,"throw error from getUserMedia",h);case 4:return p=r.getAudioTracks()[0],uz.set(p,r),[2,new yz(p,_U())]}}))}))}function Oz(e,t){return void 0===e&&(e=!1),tf(this,void 0,void 0,(function(){var i,r,n;return rf(this,(function(o){switch(o.label){case 0:cz.print("createScreenTracks","withAudio: %o, constraints: %o",e,t),o.label=1;case 1:return o.trys.push([1,3,,4]),jB.rtcVideoCaptureEvent({event_type:TB.START,media_device_id:"screen"}),r=fU(),[4,navigator.mediaDevices.getDisplayMedia({video:!(t&&(!EU||16!==TU))||t,audio:e})];case 2:return i=o.sent(),jB.rtcVideoCaptureEvent({event_type:TB.START_CAPTURE_RESULT,media_device_id:"screen",reason:RB.SUCCESS,elapse:fU()-r}),[3,4];case 3:throw n=o.sent(),jB.rtcVideoCaptureEvent({event_type:TB.RUNNING_FAILED,media_device_id:"screen",error_code:n.code,reason:n.name+n.message}),new Vj(Nj.GET_SCREEN_TRACK_FAILED,"throw error from getDisplayMedia",n);case 4:return[2,i]}}))}))}var wz,kz=fz;!function(e){e[e.NONE=0]="NONE"}(wz||(wz={}));var Nz,Pz,Dz=function(){function e(){}return e.getNalunits=function(t){if(t.length-t.position<4)return[];var i=t.position;return 1===t.getInt32(i)||0===t.getInt16(i)&&1===t.getInt8(i+2)?e.getAnnexbNals(t):e.getAvccNals(t)},e.getAnnexbNals=function(t){for(var i=[],r=e.getHeaderPositionAnnexB(t),n=r.pos,o=n;n<t.length-4;){var a=new Uint8Array(t.buffer.slice(n,n+r.headerLength));r.pos===t.position&&t.skip(r.headerLength),o=(r=e.getHeaderPositionAnnexB(t)).pos;var s={header:a,body:new Uint8Array(t.buffer.slice(n+a.byteLength,o)),type:-1};e.analyseNal(s),s.type<=9&&0!==s.type&&i.push(s),t.skip(o-t.position),n=o}return i},e.getAvccNals=function(t){for(var i=[];t.position<t.length-4;){var r=t.getInt32(t.position);if(!(t.length-t.position>=r))break;var n=new Uint8Array(t.buffer.slice(t.position,t.position+4));t.skip(4);var o=new Uint8Array(t.buffer.slice(t.position,t.position+r));t.skip(r);var a={header:n,body:o,type:-1};e.analyseNal(a),a.type<=9&&0!==a.type&&i.push(a)}return i},e.analyseNal=function(e){var t=31&e.body[0];switch(e.type=t,t){case 1:e.ndr=!0;break;case 5:e.idr=!0;break;case 6:e.sei=!0;break;case 7:e.sps=!0;break;case 8:e.pps=!0}},e.getHeaderPositionAnnexB=function(e){for(var t=e.position,i=0,r=e.length;3!==i&&4!==i&&t<r-4;)0===e.getInt16(t)?1===e.getInt16(t+2)?i=4:1===e.getInt8(t+2)?i=3:t++:t++;return t===r-4&&(0===e.getInt16(t)?1===e.getInt16(t+2)?i=4:t=r:(t++,0===e.getInt16(t)&&1===e.getInt8(t)?i=3:t=r)),{pos:t,headerLength:i}},e.getAvcc=function(e,t){var i=new Uint8Array(e.byteLength+t.byteLength+11);i[0]=1,i[1]=e[1],i[2]=e[2],i[3]=e[3],i[4]=255,i[5]=225;var r=6;return i.set(new Uint8Array([e.byteLength>>>8&255,255&e.byteLength]),r),r+=2,i.set(e,r),i[r+=e.byteLength]=1,r++,i.set(new Uint8Array([t.byteLength>>>8&255,255&t.byteLength]),r),r+=2,i.set(t,r),i},e}(),Mz=function(){function e(e){this._position=0,this._dataview=new DataView(e)}return Object.defineProperty(e.prototype,"length",{get:function(){return this.buffer.byteLength},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"buffer",{get:function(){return this._dataview.buffer},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"position",{get:function(){return this._position},set:function(e){this._position=e},enumerable:!1,configurable:!0}),e.prototype.back=function(e){this.position-=e},e.prototype.getUint8=function(e){return this._dataview.getUint8(e)},e.prototype.getInt8=function(e){return this._dataview.getInt8(e)},e.prototype.getInt16=function(e){return this._dataview.getInt16(e)},e.prototype.getUint16=function(e){return this._dataview.getUint16(e)},e.prototype.getUint32=function(e){return this._dataview.getUint32(e)},e.prototype.getInt32=function(e){return this._dataview.getInt32(e)},e.prototype.skip=function(t){for(var i=Math.floor(t/4),r=t%4,n=0;n<i;n++)e.readByte(this,4);r>0&&e.readByte(this,r)},e.readByte=function(e,t,i){var r;switch(t){case 1:r=i?e.getInt8(e.position):e.getUint8(e.position);break;case 2:r=i?e.getInt16(e.position):e.getUint16(e.position);break;case 3:if(i)throw new Error("not supported for readByte 3");r=e.getUint8(e.position)<<16,r|=e.getUint8(e.position+1)<<8,r|=e.getUint8(e.position+2);break;case 4:r=i?e.getInt32(e.position):e.getUint32(e.position);break;case 8:if(i)throw new Error("not supported for readBody 8");r=e.getUint32(e.position)<<32,r|=e.getUint32(e.position+4);break;default:r=""}return e.position+=t,r},e.prototype.readUint8=function(){return e.readByte(this,1)},e.prototype.readUint16=function(){return e.readByte(this,2)},e.prototype.readUint24=function(){return e.readByte(this,3)},e.prototype.readUint32=function(){return e.readByte(this,4)},e.prototype.readUint64=function(){return e.readByte(this,8)},e.prototype.readInt8=function(){return e.readByte(this,1,!0)},e.prototype.readInt16=function(){return e.readByte(this,2,!0)},e.prototype.readInt32=function(){return e.readByte(this,4,!0)},e.prototype.writeUint32=function(e){return new Uint8Array([e>>>24&255,e>>>16&255,e>>>8&255,255&e])},e}();!function(e){e[e.internal=0]="internal",e[e.external=1]="external",e[e.bypass=2]="bypass"}(Nz||(Nz={})),function(e){e[e.invalid=0]="invalid",e[e.cfgResolution=1]="cfgResolution",e[e.bitstreamHash=2]="bitstreamHash",e[e.screenCodec=3]="screenCodec"}(Pz||(Pz={}));var Lz=new Uint8Array([109,167,53,190,103,90,72,1,170,89,63,164,194,199,19,85]),Uz=new Uint8Array([109,167,53,190,103,90,72,1,170,89,63,164,194,199,19,84]);function xz(e){for(var t=[];e>=255;)e-=255,t.push(255);return t.push(e),new Uint8Array(t)}function Vz(e,t){void 0===t&&(t=0);for(var i=0;255===e[t]&&t<e.byteLength;)t++,i+=255;return t<e.byteLength&&(i+=e[t++]),[i,t]}var Fz=function(){function e(){}return e.generateSEI=function(e,t){void 0===t&&(t=!1);var i=new Uint8Array([0,0,0,1]),r=new Uint8Array([6]),n=new Uint8Array([5]),o=t?Lz:Uz,a=xz(e.byteLength+o.byteLength),s=function(e){for(var t=[],i=0;i<e.length;i++)e[i]<=3&&0===e[i-1]&&0===e[i-2]&&t.push(3),t.push(e[i]);return new Uint8Array(t)}(e);return new Uint8Array(af(af(af(af(af(af(af([],of(i),!1),of(r),!1),of(n),!1),of(a),!1),of(o),!1),of(s),!1),[128],!1))},e.decodeSeiBody=function(e){var t=function(e){for(var t=[],i=0;i<e.length;i++)e[i]<=3&&0===e[i-1]&&0===e[i-2]||t.push(e[i]);return new Uint8Array(t)}(e=e.slice(0,e.length-1));if(!(t.byteLength<2)){var i=0;if(5===t[1]||100===t[1]){var r=of(Vz(t,i+=2),2),n=r[0];i=r[1];var o=Nz.bypass,a=i+n;return t.byteLength>=Uz.byteLength&&n>=Uz.byteLength&&t.slice(i,i+Uz.byteLength).toString()===Uz.toString()?(i+=Uz.byteLength,o=Nz.external):t.byteLength>=Uz.byteLength&&n>=Uz.byteLength&&t.slice(i,i+Lz.byteLength).toString()===Lz.toString()&&(i+=Lz.byteLength,o=Nz.internal),{type:o,payload:t.slice(i,a)}}}},e.parseInternalSEI=function(e){var t=new Map,i=0;if(e.type===Nz.internal){for(;e.payload.byteLength-i>=2;){var r=of(Vz(e.payload,i),2),n=r[0];i=r[1];var o=of(Vz(e.payload,i),2),a=o[0];if(i=o[1],t.get(n)||!(a<e.payload.byteLength-i))break;t.set(n,e.payload.slice(i,i+a))}return t}},e.makeInternalSei=function(e){var t,i,r=[];try{for(var n=nf(e),o=n.next();!o.done;o=n.next()){var a=of(o.value,2),s=a[0],c=a[1],u=xz(s),d=xz(c.byteLength);r.push(u,d,c)}}catch(e){t={error:e}}finally{try{o&&!o.done&&(i=n.return)&&i.call(n)}finally{if(t)throw t.error}}var l=r.reduce((function(e,t){return e+t.byteLength}),0),h=new Uint8Array(l);return r.reduce((function(e,t){return h.set(t,e),e+t.byteLength}),0),h},e}();Xr({target:"Number",stat:!0},{isNaN:function(e){return e!=e}}),new LB("Stats",2);var Bz,jz,Gz,Hz,zz,Kz,Wz=function(){function e(e){this._stream=e}return e.prototype.setVar=function(e,t,i){this.client=e,this.handler=t,this.monitor=i},e.prototype.delStatsEvtInterval=function(){clearTimeout(this._timer),this._timer=void 0},e.prototype.destroy=function(){this.delStatsEvtInterval()},e}(),Xz=function(e){function t(t){var i=e.call(this,t)||this;return i._stream=t,i}return C_(t,e),t.prototype.setLocalStreamStatsEvtInterval=function(e,t,i){var r,n,o=this;if(!this._timer){this.setVar(e,t,i),e.once(yG.ABNORMAL_DISCONNECTION,(function(){o.destroy()}));var a={audio:{},video:{}},s=this._stream,c=null===(r=s.audioTrack)||void 0===r?void 0:r.getTrack(),u=null===(n=s.videoTrack)||void 0===n?void 0:n.getTrack();this.getAudioStats(c,a),this.getVideoStats(u,a),this.delStatsEvtInterval();this._timer&&clearTimeout(this._timer),this._timer=setTimeout((function e(){return tf(o,void 0,void 0,(function(){var t,i;return rf(this,(function(r){switch(r.label){case 0:return[4,tf(o,void 0,void 0,(function(){var e,t,i,r,n,o;return rf(this,(function(c){switch(c.label){case 0:return e=null===(n=s.audioTrack)||void 0===n?void 0:n.getTrack(),t=null===(o=s.videoTrack)||void 0===o?void 0:o.getTrack(),[4,this.getAudioStats(e,a)];case 1:return i=c.sent(),[4,this.getVideoStats(t,a)];case 2:return r=c.sent(),[2,{audioStats:i,videoStats:r,isScreen:s.isScreen}]}}))}))];case 1:return t=r.sent(),null===(i=this.client)||void 0===i||i.emit("onLocalStreamStats",t),this._timer&&clearTimeout(this._timer),this._timer=setTimeout(e,2e3),[2]}}))}))}),2e3)}},t.prototype.unpublish=function(){this.delStatsEvtInterval()},t.prototype.getAudioStats=function(e,t){return tf(this,void 0,void 0,(function(){var i,r,n,o,a,s,c,u,d,l;return rf(this,(function(h){switch(h.label){case 0:return i={},r={timestamp:Date.now()},n=this._stream,o=n.streamId,a=n.audioMid,s=n.isScreen,c=n.pubAttributes,u={media_type:"audio",is_screen:!!s,direction:"up",stream_id:o,vid:a,connection_status:navigator.onLine,track_enabled:null==e?void 0:e.enabled,capture_state:c.localaudio?"capture_state_on":"capture_state_off"},e&&this.handler?[4,this.handler.getStats(e)]:[2,i];case 1:return(d=h.sent()).length?(d.forEach((function(e){var t=e.type,n=e.packetsSent,o=e.packetsLost,a=e.bytesSent,s=e.clockRate,c=e.roundTripTime,d=e.channels,l=e.audioLevel,h=e.googRtt,p=e.mimeType,_=e.availableIncomingBitrate,f=e.availableOutgoingBitrate,v=e.bytesReceived,m=e.nominated,y=e.id,S=e.currentRoundTripTime,g=e.state,E=e.writable,b=e.requestsReceived,I=e.responsesReceived,T=e.requestsSent,A=e.consentRequestsSent,R=e.responsesSent,C=e.jitter,O=e.candidateType,w=e.ip,k=e.address,N=e.networkType,P=e.port,D=e.protocol,M=e.nackCount,L=e.retransmittedBytesSent,U=e.retransmittedPacketsSent,x=e.roundTripTimeMeasurements,V=e.audioInputLevel,F=e.ssrc,B=e.totalAudioEnergy,j=e.totalSamplesDuration,G=e.mediaType,H=e.fractionLost;"outbound-rtp"===t?(r.packetsSent=n,r.bytesSent=a,u.bytes=a,u.packetsSent=n,u.nackCount=M,u.ssrc=F,u.retransmitted_bytes_sent=L,u.retransmitted_packets_sent=U,r.retransmittedPacketsSent=U):"remote-inbound-rtp"===t?(r.packetsLost=o,u.packetsLost=o,u.jitter=1e3*C,i.rtt=1e3*c,u.rtt=i.rtt,u.round_trip_time_measurements=x,i._fractionLost=H||0):"codec"===t?(i.recordSampleRate=s,i.numChannels=d,u.codecName=p):"media-source"===t?(u.audio_level=l?-10*Math.log10(Math.pow(l,2)):l,u.volume=255*l,u.total_audio_energy=B,u.total_samples_duration=j):"ssrc"===t&&"audio"===G?(u.audio_network_elapse=h,u.send_level=V):"candidate-pair"===t?(u.ice_available_incoming_bitrate=_,u.ice_available_outgoing_bitrate=f,u.ice_bytes_received=v,u.ice_bytes_sent=a,u.ice_nominated=+m,u.ice_pair_id=y,u.ice_pair_rtt=S,u.ice_pair_state=g,u.ice_pair_writable=E,u.recv_ping_requests=b,u.recv_ping_responses=I,u.sent_ping_requests_before_first_response=T,u.sent_ping_requests_total=T+(A||0),u.sent_ping_responses=R):"local-candidate"===t?(u.local_candidate_type=O,u.local_ip=w||k,u.local_network_type=N,u.local_port=P,u.protocol=D):"remote-candidate"===t&&(u.remote_candidate_type=O,u.remote_ip=w||k,u.remote_port=P),HU||"media-source"===t&&(u.send_level=l)})),(l=t.audio).timestamp?(void 0!==r.packetsLost&&(i.audioLossRate=(r.packetsLost-l.packetsLost)/(r.packetsSent-l.packetsSent),i.audioLossRate=Number.isNaN(i.audioLossRate)?0:i.audioLossRate,u.fraction_lost=i.audioLossRate),i.statsInterval=r.timestamp-l.timestamp,u.stats_interval=i.statsInterval,i.sendKBitrate=(r.bytesSent-l.bytesSent||0)/i.statsInterval*8,u.bitrate=Math.round(1e3*i.sendKBitrate),u.bandwidth=Math.round(u.bitrate/1024),t.audio=r,u.total_audio_play_energy=this._stream.getRecordAudioEnergy(),this.monitor.rtcMediaStatistics(u,{}),i._retransmittedRate=(r.retransmittedPacketsSent-l.retransmittedPacketsSent)/(r.packetsSent-l.packetsSent),i._fractionLost=Math.max(i._fractionLost,i.audioLossRate),[2,i]):(t.audio=r,[2,i])):[2,i]}}))}))},t.prototype.getVideoStats=function(e,t){return tf(this,void 0,void 0,(function(){var i,r,n,o,a,s,c,u,d,l,h,p,_,f,v;return rf(this,(function(m){switch(m.label){case 0:return i={},r={timestamp:Date.now(),simulcast:{}},n=this._stream,o=n.streamId,a=n.videoMid,s=n.isScreen,c=n.pubAttributes,u=n.enableSimulcast,l=[{media_type:"video",is_screen:!!s,direction:"up",stream_id:o,vid:a,connection_status:navigator.onLine,track_enabled:null==e?void 0:e.enabled,capture_state:c.localvideo?"capture_state_on":"capture_state_off"}],[4,this._stream.requestVideoFrameCallback()];case 1:return d=$_.apply(void 0,l.concat([m.sent()])),e&&this.handler?(i.isScreen=s,[4,this.handler.getStats(e)]):[2,i];case 2:return(h=m.sent()).length?(p=0,h.forEach((function(n){var o=n.type,a=n.framesEncoded,s=n.packetsLost,c=n.bytesSent,l=n.framesSent,h=n.roundTripTime,_=n.mimeType,f=n.frameWidth,v=n.frameHeight,m=n.packetsSent,y=n.googActualEncBitrate,S=n.googAvailableReceiveBandwidth,g=n.googAvailableSendBandwidth,E=n.googAvgEncodeMs,b=n.googBucketDelay,I=n.googEncodeUsagePercent,T=n.googFrameRateInput,A=n.availableIncomingBitrate,R=n.availableOutgoingBitrate,C=n.bytesReceived,O=n.nominated,w=n.id,k=n.currentRoundTripTime,N=n.state,P=n.writable,D=n.candidateType,M=n.ip,L=n.address,U=n.networkType,x=n.port,V=n.nackCount,F=n.pliCount,B=n.protocol,j=n.qpSum,G=n.requestsReceived,H=n.responsesReceived,z=n.googRetransmitBitrate,K=n.requestsSent,W=n.consentRequestsSent,X=n.responsesSent,q=n.ssrc,Y=n.googTargetEncBitrate,J=n.googTransmitBitrate,Q=n.googRtt,Z=n.retransmittedPacketsSent,$=n.encoderImplementation,ee=n.jitter,te=n.rid,ie=n.fractionLost,re=n.keyFramesEncoded,ne=n.retransmittedBytesSent,oe=n.totalPacketSendDelay,ae=n.totalEncodeTime;n.getsetting,n.framesPerSecond;var se=n.firCount,ce=n.qualityLimitationReason,ue=n.targetBitrate;if("outbound-rtp"===o?(u&&(te?r.simulcast[te]=n:r.simulcast[p]=n,p++),r.framesEncoded=a||r.framesEncoded,d.key_frames_encoded=re||0,r.bytesSent=c||r.bytesSent,r.framesSent=l||r.framesSent,d.bytes=c||d.bytes,r.packetsSent=m||r.packetsSent,r.retransmittedBytesSent=ne,d.packetsSent=m||d.packetsSent,d.nackCount=V||d.nackCount,d.pli_count=F||d.pli_count,d.qp_sum=j||d.qp_sum,d.ssrc=q||d.ssrc,d.retransmitted_packets_sent=Z,r.retransmittedPacketsSent=Z,d.encoder_implementation=$):"track"===o?(i.encodedFrameWidth=f,i.encodedFrameHeight=v,d.frame_size_height=v,d.frame_size_width=f):"remote-inbound-rtp"===o?(r.packetsLost=s,i.rtt=1e3*h,d.rtt=i.rtt,d.jitter=ee,d.packetsLost=s,i._fractionLost=ie||0):"codec"===o?(i.codecType=_,d.codecName=_):"candidate-pair"===o?(d.ice_available_incoming_bitrate=A,d.ice_available_outgoing_bitrate=R,d.ice_bytes_received=C,d.ice_bytes_sent=c,d.ice_nominated=+O,d.ice_pair_id=w,d.ice_pair_rtt=k,d.ice_pair_state=N,d.ice_pair_writable=P,d.recv_ping_requests=G,d.recv_ping_responses=H,d.sent_ping_requests_before_first_response=K,d.sent_ping_requests_total=K+W,d.sent_ping_responses=X):"local-candidate"===o?(d.local_candidate_type=D,d.local_ip=M||L,d.local_network_type=U,d.local_port=x,d.protocol=B):"remote-candidate"===o?(d.remote_candidate_type=D,d.remote_ip=M||L,d.remote_port=x):"VideoBwe"===o?(d.encBitratebps=y,d.available_receive_bandwidth=S,d.available_send_bandwidth=g,d.bucket_delay=b,d.retransmitBitratebps=z,d.targetEncBitratebps=Y,d.transmit_bitrate=J,i._sendBandWidth=+g):"ssrc"===o&&(d.video_network_elapse=Q,d.avg_encode_ms=E,d.encodeUsage=I,d.frame_rate_input=T,d.orignal_input_Framerate=+T),!HU){var de=t.video,le=r.timestamp-de.timestamp;if("outbound-rtp"===o){var he=c-de.bytesSent,pe=ne-de.retransmittedBytesSent;d.encBitratebps=Math.round(8e3*(he-pe)/le),d.bucket_delay=oe/m,d.retransmitBitratebps=Math.round(8e3*pe/le),d.targetEncBitratebps=ue,d.transmit_bitrate=Math.round(1e3*(c-de.bytesSent)*8/le),d.avg_encode_ms=1e3*ae/a,d.firsReceived=se+F,d.qualityLimitationReason="bandwidth"===ce,d.qualityLimitationDurations="cpu"===ce}else"candidate-pair"===o&&(d.available_send_bandwidth=R,i._sendBandWidth=R);if(e){var _e=null==e?void 0:e.getSettings().frameRate;d.orignal_input_Framerate=_e,d.frameRateSent=e.getSettings().frameRate}}})),(_=t.video).timestamp?(i.statsInterval=r.timestamp-_.timestamp,d.stats_interval=i.statsInterval,f=Object.keys(r.simulcast),u?(d.sim_enc_width=[],d.sim_enc_height=[],d.sim_enc_bps=[],d.sim_enc_framerate=[],d.sim_enc_key_frames=[],d.sim_rids=[],d.sim_enc_bandwidth=[],d.sim_sent_framerate=[],d.sim_fraction_lost=[],v=!1,f.sort((function(e,t){return+e-+t})).forEach((function(e){var t=r.simulcast[e],n=t.frameWidth,o=t.frameHeight,a=t.bytesSent,s=t.framesEncoded,c=t.framesSent,u=t.packetsLost,l=t.packetsSent,h=t.qualityLimitationReason,p=t.qualityLimitationDurations,f=t.qualityLimitationResolutionChanges,m=t.retransmittedPacketsSent,y=t.keyFramesEncoded;void 0!==h&&(d.sim_qualityLimitationReason||(d.sim_qualityLimitationReason=[],d.sim_qualityLimitationDurations=[],d.sim_qualityLimitationResolutionChanges=[]),d.sim_qualityLimitationReason.push(h),d.sim_qualityLimitationDurations.push(p),d.sim_qualityLimitationResolutionChanges.push(f));var S=_.simulcast[e];if(d.sim_enc_width.push(n||0),d.sim_enc_height.push(o||0),d.sim_enc_key_frames.push(y||0),S){var g=(a-S.bytesSent||0)/i.statsInterval;d.sim_enc_bps.push(Math.round(8e3*g)),d.sim_enc_bandwidth.push(Math.round(8e3*g/1024));var E=1e3*(s-S.framesEncoded)/i.statsInterval;d.sim_enc_framerate.push(Math.round(E)),d.sim_rids.push(e);var b=void 0!==c?c-S.framesSent:s-S.framesEncoded,I=1e3*b/i.statsInterval;d.sim_sent_framerate.push(Math.round(I));var T=(u-S.packetsLost)/(l-S.packetsSent);i._retransmittedRate=(m-S.retransmittedPacketsSent)/(l-S.packetsSent),T=Number.isNaN(T)?0:T,d.sim_fraction_lost.push(T),n>0&&!v&&(i.sentKBitrate=8*g,i.encoderOutputFrameRate=E,i.encodedFrameCount=b,i.sentFrameRate=I,i.videoLossRate=T,v=!0)}})),this.monitor.rtcMediaStatistics(d,{})):(i.encodedFrameCount=void 0!==r.framesSent?r.framesSent-_.framesSent:r.framesEncoded-_.framesEncoded,i.sentKBitrate=(r.bytesSent-_.bytesSent||0)/i.statsInterval*8,d.bitrate=Math.round(1e3*i.sentKBitrate),d.bandwidth=Math.round(d.bitrate/1024),i.encoderOutputFrameRate=1e3*(r.framesEncoded-_.framesEncoded)/i.statsInterval,d.frame_rate_encoded=Math.round(i.encoderOutputFrameRate),i.sentFrameRate=1e3*i.encodedFrameCount/i.statsInterval,d.frame_rate_sent=Math.round(i.sentFrameRate),i.videoLossRate=(r.packetsLost-_.packetsLost)/(r.packetsSent-_.packetsSent),i.videoLossRate=Number.isNaN(i.videoLossRate)?0:i.videoLossRate,d.fraction_lost=i.videoLossRate,i._retransmittedRate=(r.retransmittedPacketsSent-_.retransmittedPacketsSent)/(r.packetsSent-_.packetsSent),this.monitor.rtcMediaStatistics(d,{})),t.video=r,i._fractionLost=Math.max(i._fractionLost,i.videoLossRate),[2,i]):(t.video=r,[2,i])):[2,i]}}))}))},t}(Wz),qz=function(e){function t(t){var i=e.call(this,t)||this;return i._videoInWaiting=!1,i}return C_(t,e),Object.defineProperty(t,"audioStallConfig",{set:function(e){t.audioStallInterval=((null==e?void 0:e.audio_stall_interval)||200)/2,t.audioStallRatio=null==e?void 0:e.audio_stall_ratio},enumerable:!1,configurable:!0}),t.prototype.setRemoteStreamStatsEvtInterval=function(e,i,r){var n,o;return tf(this,void 0,void 0,(function(){var a,s,c,u,d,l,h,p,_,f,v,m=this;return rf(this,(function(y){switch(y.label){case 0:return this._timer?[2]:(this.setVar(e,i,r),e.once(yG.ABNORMAL_DISCONNECTION,(function(){m.destroy()})),this._audioStallInterval=-100,this._audioStallRatio=t.audioStallRatio||.6,a={audio:{},video:{}},s=this._stream,c=null===(n=s.audioTrack)||void 0===n?void 0:n.getTrack(),u=null===(o=s.videoTrack)||void 0===o?void 0:o.getTrack(),this.getRemoteVideoStats(u,a),[4,this.getRemoteAudioStats(c,a)]);case 1:return y.sent(),this.delStatsEvtInterval(),d=0,l=0,p=[],_=0,this._setAudioStallCount=function(){if(m._audioStallInterval>0&&void 0!==a.audio.concealedSamples){var e=a.audio.concealedSamples,t=a.audio.totalSamplesReceived,i=fU(),r={isStall:!1,counted:!1,diff:0},n=.5*m._audioStallInterval;m._audioStallCount=function(){return tf(m,void 0,void 0,(function(){var o,a,c,u,h,f,v,m,y,S,g,E,b,I,T;return rf(this,(function(A){switch(A.label){case 0:return o=s.hasAudio,a=s.subAudio,o&&a?(c=null===(T=s.audioTrack)||void 0===T?void 0:T.getTrack(),u=Date.now(),[4,this.handler.getStats(c,!0)]):(r.isStall=!1,r.counted=!1,p.push({reason:"hasAudio: ".concat(o,", subAudio: ").concat(a)}),[2,{stall_count:d,stall_duration:l,stall_list:p,stats_count:_}]);case 1:return h=A.sent(),f=Date.now(),v=fU(),(m=v-i)<n?(p.push({diff:m,start:i,end:v,get_stats_cost:f-u,get_stats_start:u,get_stats_end:f,reason:"diff(".concat(m,") < minInterval(").concat(n,")")}),[2,{stall_count:d,stall_duration:l,stall_list:p,stats_count:_}]):(y=h.length,S=h.find((function(e){return"inbound-rtp"===e.type})),S?(g=S.concealedSamples,E=S.totalSamplesReceived,I=E-t,(b=g-e)>=0&&I>=0&&b>=this._audioStallRatio*I?(p.push({concealed:b,received:I,diff:m,start:i,end:v,get_stats_cost:f-u,get_stats_start:u,get_stats_end:f,is_stall:!0}),r.isStall?(r.counted?l+=m:(l=l+r.diff+m,d++),r.counted=!0):m>=200?(l+=m,d++,r.counted=!0):(r.counted=!1,r.diff=m),r.isStall=!0):(p.push({concealed:b,received:I,diff:m,start:i,end:v,get_stats_cost:f-u,get_stats_start:u,get_stats_end:f}),r.isStall=!1,r.counted=!1),e=g,t=E,i=v,_++,[2,{stall_count:d,stall_duration:l,stall_list:p,stats_count:_}]):(p.push({diff:m,start:i,end:v,get_stats_cost:f-u,get_stats_start:u,get_stats_end:f,reason:y?"no inbound-rtp":"no report"}),[2,{stall_count:d,stall_duration:l,stall_list:p,stats_count:_}]))}}))}))},h=function(){return tf(m,void 0,void 0,(function(){return rf(this,(function(e){switch(e.label){case 0:return console.log("=================== stallLoop"),!this._audioStallCount&&this._setAudioStallCount&&this._setAudioStallCount(),this._audioStallCount?[4,this._audioStallCount()]:[3,2];case 1:e.sent(),this._audioStallTimer&&clearTimeout(this._audioStallTimer),this._audioStallTimer=setTimeout(h,this._audioStallInterval),e.label=2;case 2:return[2]}}))}))},m._audioStallTimer&&clearTimeout(m._audioStallTimer),m._audioStallTimer=setTimeout(h,m._audioStallInterval)}},this._setAudioStallCount(),f=function(){return tf(m,void 0,void 0,(function(){var e,t,i,r,n,o;return rf(this,(function(c){switch(c.label){case 0:return e=null===(n=s.audioTrack)||void 0===n?void 0:n.getTrack(),t=null===(o=s.videoTrack)||void 0===o?void 0:o.getTrack(),[4,this.getRemoteAudioStats(e,a)];case 1:return i=c.sent(),d=0,l=0,p=[],_=0,[4,this.getRemoteVideoStats(t,a)];case 2:return r=c.sent(),[2,{audioStats:i,videoStats:r,isScreen:s.isScreen,userId:s.userId}]}}))}))},v=function(){return tf(m,void 0,void 0,(function(){var e,t;return rf(this,(function(i){switch(i.label){case 0:return[4,f()];case 1:return e=i.sent(),null===(t=this.client)||void 0===t||t.emit("onRemoteStreamStats",e),h&&(this._audioStallTimer&&clearTimeout(this._audioStallTimer),this._audioStallTimer=setTimeout(h,this._audioStallInterval)),this._timer&&clearTimeout(this._timer),this._timer=setTimeout(v,2e3),[2]}}))}))},this._timer&&clearTimeout(this._timer),this._timer=setTimeout(v,2e3),[2]}}))}))},t.prototype.delStatsEvtInterval=function(){e.prototype.delStatsEvtInterval.call(this),clearTimeout(this._audioStallTimer),this._audioStallCount=void 0,this._setAudioStallCount=void 0},t.prototype.unsubscribe=function(){this.delStatsEvtInterval(),this._videoInWaiting=!1},t.prototype.getRemoteAudioStats=function(e,t){return tf(this,void 0,void 0,(function(){var i,r,n,o,a,s,c,u,d,l,h,p,_,f,v,m,y,S;return rf(this,(function(g){switch(g.label){case 0:return i={},r={},n=this._stream,o=n.streamId,a=n.userId,s=n.isScreen,c=n.audioMid,u=n.subMediaType,d=n._attributes,l={media_type:"audio",is_screen:!!s,direction:"down",stream_id:o,stream_user_id:a,vid:c,track_enabled:null==e?void 0:e.enabled,connection_status:navigator.onLine,mute_state:VU(u)?"mute_state_off":"mute_state_on",remote_user_capture_state:d.localaudio?"capture_state_on":"capture_state_off",remote_user_mute_state:d.localaudio&&d.audiostream?"mute_state_off":"mute_state_on"},e&&this.handler?[4,this.handler.getStats(e)]:[2,i];case 1:return(h=g.sent()).length?(h.forEach((function(e){var t=e.type,n=e.packetsLost,o=e.packetsReceived,a=e.bytesReceived,s=e.jitterBufferDelay,c=e.jitterBufferEmittedCount,u=e.clockRate,d=e.channels,h=e.totalSamplesReceived,p=e.concealedSamples,_=e.silentConcealedSamples,f=e.concealmentEvents,v=e.totalRoundTripTime,m=e.state,y=e.currentRoundTripTime,S=e.audioLevel,g=e.totalAudioEnergy,E=e.totalSamplesDuration,b=e.mimeType,I=e.googDecodingNormal,T=e.googDecodingMuted,A=e.fecPacketsReceived,R=e.availableIncomingBitrate,C=e.availableOutgoingBitrate,O=e.bytesSent,w=e.nominated,k=e.id,N=e.writable,P=e.jitter,D=e.candidateType,M=e.ip,L=e.address,U=e.networkType,x=e.port,V=e.protocol,F=e.audioOutputLevel,B=e.requestsReceived,j=e.responsesReceived,G=e.requestsSent,H=e.consentRequestsSent,z=e.responsesSent,K=e.ssrc,W=e.kind;"inbound-rtp"===t?(r.packetsLost=n,r.packetsReceived=o,l.packetsReceived=o,r.bytesReceived=a,l.bytes=a,void 0!==s&&(i.jitterBufferDelay=s/c*1e3,l.average_jitter_buffer_delay_ms=i.jitterBufferDelay),void 0!==h&&(r.totalSamplesReceived=h,i.concealedSamples=p,r.concealedSamples=p,r.silentConcealedSamples=_,l.concealedSamples=p,i.concealmentEvents=f,l.totalSamplesReceived=h),void 0!==A&&(l.fec_packets_received=A),l.jitter=1e3*P,l.ssrc=K,void 0!==S&&(l.audio_level=S?-10*Math.log10(Math.pow(S,2)):S),void 0!==S&&(l.volume=255*S),void 0!==g&&(l.total_audio_energy=g),void 0!==E&&(l.totalAudioDuration=E)):"codec"===t?(i.recordSampleRate=u,d&&(i.numChannels=d),l.codecName=b):"candidate-pair"===t?(l.ice_available_incoming_bitrate=R,l.ice_available_outgoing_bitrate=C,l.ice_bytes_received=a,l.ice_bytes_sent=O,l.ice_nominated=+w,l.ice_pair_id=k,l.ice_pair_rtt=y,l.rtt=1e3*y,l.ice_pair_state=m,l.ice_pair_writable=N,l.recv_ping_requests=B,l.recv_ping_responses=j,l.sent_ping_requests_before_first_response=G,l.sent_ping_requests_total=G+(H||0),l.sent_ping_responses=z,"succeeded"===m&&(i.rtt=1e3*y,i.total_rtt=1e3*v)):"track"===t&&"audio"===W?(l.audio_level=S?-10*Math.log10(Math.pow(S,2)):S,l.volume=255*S,l.total_audio_energy=g,l.totalAudioDuration=E):"ssrc"===t?(l.decodingNormal=I,l.recvAudioLevel=F,l.decodingMuted=T):"local-candidate"===t?(l.local_candidate_type=D,l.local_ip=M||L,l.local_network_type=U,l.local_port=x,l.protocol=V):"remote-candidate"===t&&(l.remote_candidate_type=D,l.remote_ip=M||L,l.remote_port=x)})),(p=t.audio).timestamp?(_={},void 0!==r.concealedSamples&&(l.interval_concealed_samples=r.concealedSamples-p.concealedSamples,l.interval_samples_received=r.totalSamplesReceived-p.totalSamplesReceived,l.interval_silent_concealed_samples=r.silentConcealedSamples-p.silentConcealedSamples),this._audioStallInterval>0&&void 0!==p.concealedSamples?(!this._audioStallCount&&this._setAudioStallCount&&this._setAudioStallCount(),clearTimeout(this._audioStallTimer),this._audioStallCount?[4,this._audioStallCount()]:[3,3]):[3,3]):(r.timestamp=Date.now(),t.audio=r,[2,i])):[2,i];case 2:f=g.sent(),v=f.stall_count,m=f.stall_duration,y=f.stall_list,S=f.stats_count,_.stall_list=y,_.stats_count=S,l.concealedSamples===l.interval_concealed_samples&&l.totalSamplesReceived===l.interval_samples_received?(l.stall_count=0,l.stall_duration=0):(l.stall_count=v,l.stall_duration=m),i.stallCount=l.stall_count,i.stallDuration=l.stall_duration,g.label=3;case 3:return r.timestamp=Date.now(),i.audioLossRate=(r.packetsLost-p.packetsLost)/(r.packetsReceived-p.packetsReceived+(r.packetsLost-p.packetsLost)),i.audioLossRate=Number.isNaN(i.audioLossRate)?0:i.audioLossRate,l.packetsLost=Math.round(r.packetsLost-p.packetsLost),l.fraction_lost=i.audioLossRate,l.packets_lost_rate=i.audioLossRate,i.statsInterval=r.timestamp-p.timestamp,l.stats_interval=i.statsInterval,i.receivedKBitrate=(r.bytesReceived-p.bytesReceived||0)/i.statsInterval*8,l.bitrate=Math.round(1e3*i.receivedKBitrate),l.bandwidth=Math.round(l.bitrate/1024),void 0!==r.concealedSamples&&(i.receivedSampleRate=1e3*l.interval_samples_received/i.statsInterval),t.audio=r,l.total_audio_play_energy=this._stream.getRecordAudioEnergy(),this.monitor.rtcMediaStatistics(l,{},_),[2,i]}}))}))},t.prototype.getRemoteVideoStats=function(e,t){return tf(this,void 0,void 0,(function(){var i,r,n,o,a,s,c,u,d,l,h,p;return rf(this,(function(_){switch(_.label){case 0:return i={},r={timestamp:Date.now()},n=this._stream,o=n.streamId,a=n.userId,s=n.isScreen,c=n.subMediaType,u=n._attributes,l=[{media_type:"video",is_screen:!!s,direction:"down",stream_id:o,stream_user_id:a,vid:this._stream.videoMid,connection_status:navigator.onLine,track_enabled:null==e?void 0:e.enabled,mute_state:FU(c)?"mute_state_off":"mute_state_on",remote_user_capture_state:u.localvideo?"capture_state_on":"capture_state_off",remote_user_mute_state:u.localvideo&&u.videostream?"mute_state_off":"mute_state_on"}],[4,this._stream.requestVideoFrameCallback()];case 1:return d=$_.apply(void 0,l.concat([_.sent()])),e&&this.handler?(i.isScreen=s,[4,this.handler.getStats(e)]):[2,i];case 2:return(h=_.sent()).length?(h.forEach((function(e){var t=e.type,n=e.frameHeight,o=e.frameWidth,a=e.packetsLost,s=e.packetsReceived,c=e.bytesReceived,u=e.framesDecoded,l=e.jitterBufferDelay,h=e.jitterBufferEmittedCount,p=e.mimeType,_=e.firCount,f=e.availableIncomingBitrate,v=e.availableOutgoingBitrate,m=e.bytesSent,y=e.nominated,S=e.id,g=e.currentRoundTripTime,E=e.state,b=e.writable,I=e.candidateType,T=e.ip,A=e.address,R=e.networkType,C=e.port,O=e.nackCount,w=e.pliCount,k=e.protocol,N=e.requestsReceived,P=e.responsesReceived,D=e.requestsSent,M=e.consentRequestsSent,L=e.responsesSent,U=e.ssrc;e.kind;var x=e.jitter,V=e.framesReceived,F=e.keyFramesDecoded,B=e.totalDecodeTime,j=e.decoderImplementation,G=e.lastPacketReceivedTimestamp;"inbound-rtp"===t?(r.packetsLost=a,d.packetsLost=a,r.packetsReceived=s,d.packetsReceived=s,r.bytesReceived=c,d.bytes=c,r.framesDecoded=u,void 0!==l&&(r.jitterBufferDelay=l/h*1e3,d.average_jitter_buffer_delay_ms=r.jitterBufferDelay),d.fir_count=_,d.nackCount=O,r.nackCount=O,d.pli_count=w,r.pliCount=w,d.ssrc=U,d.jitter=x,d.framesReceived=V,r.framesReceived=V,d.framesDecoded=u,d.key_frames_decoded=F,d.total_decode_time=B,d.decoder_name=j,d.last_packet_received_timestamp=G):"track"===t&&void 0!==o?(i.width=o,d.frame_size_width=o,i.height=n,d.frame_size_height=n,void 0!==V&&(d.framesReceived=V,r.framesReceived=V)):"codec"===t?d.codecName=p:"candidate-pair"===t?(d.ice_available_incoming_bitrate=f,d.ice_available_outgoing_bitrate=v,d.ice_bytes_received=c,d.ice_bytes_sent=m,d.ice_nominated=+y,d.ice_pair_id=S,d.ice_pair_rtt=g,d.rtt=1e3*g,i.rtt=d.rtt,d.ice_pair_state=E,d.ice_pair_writable=b,d.recv_ping_requests=N,d.recv_ping_responses=P,d.sent_ping_requests_before_first_response=D,d.sent_ping_requests_total=D+(M||0),d.sent_ping_responses=L):"local-candidate"===t?(d.local_candidate_type=I,d.local_ip=T||A,d.local_network_type=R,d.local_port=C,d.protocol=k):"remote-candidate"===t&&(d.remote_candidate_type=I,d.remote_ip=T||A,d.remote_port=C)})),(p=t.video).timestamp?(i.videoLossRate=(r.packetsLost-p.packetsLost)/(r.packetsReceived-p.packetsReceived+(r.packetsLost-p.packetsLost)),i._retransmittedRate=(r.nackCount-p.nackCount)/(r.packetsReceived-p.packetsReceived+(r.packetsLost-p.packetsLost)),i.videoLossRate=Number.isNaN(i.videoLossRate)?0:i.videoLossRate,d.fraction_lost=i.videoLossRate,d.packets_lost_rate=i.videoLossRate,i.statsInterval=r.timestamp-p.timestamp,d.stats_interval=i.statsInterval,i.receivedKBitrate=(r.bytesReceived-p.bytesReceived||0)/i.statsInterval*8,d.bitrate=Math.round(1e3*i.receivedKBitrate),d.bandwidth=Math.round(d.bitrate/1024),i.decoderOutputFrameRate=1e3*(r.framesDecoded-p.framesDecoded)/i.statsInterval,i.receivedFrameRate=1e3*(r.framesReceived-p.framesReceived)/i.statsInterval,(0===p.framesDecoded&&r.framesReceived>100||r.pliCount>15)&&(i.needResub=!0),d.frame_rate_decoded=Math.round(i.decoderOutputFrameRate),d.frame_rate_received=Math.round(i.receivedFrameRate),t.video=r,this.processStall(this._stream,d,i,s),this.monitor.rtcMediaStatistics(d,{}),[2,i]):(t.video=r,[2,i])):[2,i]}}))}))},t.prototype.processStall=function(e,t,i,r){var n=0,o=0,a=0;if(e.recordedVideoFrames){e.recordedVideoFrames.forEach((function(e){e.isStall&&(n+=e.stallCount,o+=e.stallDuration),a=e.playTime})),e.recordedVideoFrames.length||(o=2e3,n=this._videoInWaiting?0:1,this._videoInWaiting=!0);var s=e.recordedVideoFrames.pop();s&&(s.isStall?this._videoInWaiting=!0:this._videoInWaiting=!1),e.recordedVideoFrames=[]}t.stall_count=n,r?(t.stuck_length=o,t.stall_duration=void 0):(t.stall_duration=o,t.stuck_length=void 0),t.play_time=a,i.stallCount=n,i.stallDuration=o},t.prototype.destroy=function(){e.prototype.destroy.call(this),this.delStatsEvtInterval(),this._videoInWaiting=!1},t}(Wz);!function(e){e[e.CHANNEL_PROFILE_COMMUNICATION=0]="CHANNEL_PROFILE_COMMUNICATION",e[e.CHANNEL_PROFILE_LIVE_BROADCASTING=1]="CHANNEL_PROFILE_LIVE_BROADCASTING"}(Bz||(Bz={})),function(e){e.RESUBSCRIBE="resubscribe",e.STREAM_FAILED="stream_failed",e.SUBSCRIBE_PUSH_TRACK="subscribe_push_track",e.REMOVE_PUSH_TRACK="remove_push_track",e.VIDEO_FIRST_FRAME="video_first_frame",e.ON_USER_PUBLISH_STATE_CHANGE="on_user_publish_state_change",e.ON_USER_START_AUDIO_CAPTURE="on_user_start_audio_capture",e.ON_USER_STOP_AUDIO_CAPTURE="on_user_stop_audio_capture",e.ON_USER_START_VIDEO_CAPTURE="on_user_start_video_capture",e.ON_USER_STOP_VIDEO_CAPTURE="on_user_stop_video_capture",e.ON_SEI_MESSAGED_RECEIVED="on_sei_messaged_received",e.ON_PUBLISH_RESULT="on_publish_result",e.ON_UPDATE_TOKEN_SUCCESS="on_update_token_success",e.ON_REMOTE_STREAM_STATS="ON_REMOTE_STREAM_STATS",e.ON_LOCAL_STREAM_STATS="ON_LOCAL_STREAM_STATS",e.ON_USER_LEAVE="on_user_leave",e.ON_ROOM_ERROR="on_room_error",e.ON_NETWORK_QUALITY="on_network_quality",e.ON_SIMULCAST_SUBSCRIBE_FALLBACK="on_simulcast_subscribe_fallback",e.ON_REMOTE_VIDEO_SIZE_CHANGED="on_remote_video_size_changed",e.RECONNECT_FAILED="reconnect_failed"}(jz||(jz={})),function(e){e.TranscodeStateChanged="TranscodeStateChanged",e.TranscodeStarted="TranscodeStarted",e.TranscodeUpdated="TranscodeUpdated",e.TranscodeStoped="TranscodeStoped"}(Gz||(Gz={})),function(e){e[e.START=1]="START",e[e.START_SUCCESS=2]="START_SUCCESS",e[e.START_FAILED=3]="START_FAILED",e[e.UPDATE=4]="UPDATE",e[e.UPDATE_SUCCESS=5]="UPDATE_SUCCESS",e[e.UPDATE_FAILED=6]="UPDATE_FAILED",e[e.STOP=7]="STOP",e[e.STOP_SUCCESS=8]="STOP_SUCCESS",e[e.STOP_FAILED=9]="STOP_FAILED"}(Hz||(Hz={})),function(e){e[e.PUB=0]="PUB",e[e.UNPUB=1]="UNPUB"}(zz||(zz={})),function(e){e[e.SUB=0]="SUB",e[e.UNSUB=1]="UNSUB"}(Kz||(Kz={}));var Yz,Jz=new LB("Stream",0),Qz=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return C_(t,e),t.prototype.stopRecordAudioEnergy=function(){delete this._audioPlaybackEnergy},t.prototype.recordAudioEnergy=function(e){"number"!=typeof this._audioPlaybackEnergy&&(this._audioPlaybackEnergy=0),this._audioPlaybackEnergy+=e},t.prototype.getRecordAudioEnergy=function(){if("number"==typeof this._audioPlaybackEnergy){var e=this._audioPlaybackEnergy;return this._audioPlaybackEnergy=0,e}},t.prototype.requestVideoFrameCallback=function(){var e=this;return new Promise((function(t){var i,r=null===(i=e.videoDom)||void 0===i?void 0:i.requestVideoFrameCallback;if("function"==typeof r){var n=function(e,i){var r={};Object.keys(i).forEach((function(e){var t=e.replace(/[a-z]{1}[A-Z]{1}/g,(function(e){return"".concat(e[0],"_").concat(e[1].toLowerCase())}));r["video_".concat(t)]=i[e]})),clearInterval(o),t(r)};r.call(e.videoDom,n);var o=setTimeout((function(){var i;null===(i=e.videoDom)||void 0===i||i.cancelVideoFrameCallback(n),t({})}),500)}else t({})}))},t}(VB);!function(e){e[e.INIT=0]="INIT",e[e.SUB_ING=1]="SUB_ING",e[e.SUB_ED=2]="SUB_ED"}(Yz||(Yz={}));var Zz,$z,eK,tK,iK=function(e){function t(){var t=e.call(this)||this;return t.isScreen=!1,t.seiList=[],t.videoEncodeConfig=[LF],t.subVideoDescriptions=[],t.enableSimulcast=!1,t.prevScaleResolutionDownBy=1,t.pubAudio=!1,t.pubVideo=!1,t.stream=new MediaStream,t.videoInputConfig={width:640,height:360,frameRate:30},t.pubAttributes={localaudio:!1,localvideo:!1,videostream:!1,audiostream:!1,extvideo:!1,extaudio:!1},t.statsReport=new Xz(t),t}return C_(t,e),Object.defineProperty(t.prototype,"hasPublished",{get:function(){return this.audioMid&&this.videoMid},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isEmptyStream",{get:function(){return!this.audioTrack&&!this.videoTrack},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"initStreamId",{get:function(){return this.stream.id},enumerable:!1,configurable:!0}),t.prototype.initVideoEncodedTransform=function(){var e=this;if(this.videoTransceiver&&this.videoTransceiver.sender){var t=this.videoTransceiver.sender;if(ZG()){var i=t.createEncodedStreams(),r=i.readable,n=i.writable,o=new TransformStream({transform:function(t,i){var r=e.seiList[0];if(r){var n=Fz.generateSEI(r.content),o=new Uint8Array(n.byteLength+t.data.byteLength);0===r.repeatCount&&e.seiList.splice(0,1),r.repeatCount--,o.set(new Uint8Array(t.data)),o.set(n,t.data.byteLength),t.data=o.buffer,i.enqueue(t)}else i.enqueue(t)}});r.pipeThrough(o).pipeTo(n)}}else Jz.print("no sender found when trying to bind encodedTransform")},t.prototype.initAudioEncodedTransform=function(){if(this.audioTransceiver&&this.audioTransceiver.sender){var e=this.audioTransceiver.sender.createEncodedStreams(),t=e.readable,i=e.writable;t.pipeThrough(new TransformStream({transform:function(e,t){t.enqueue(e)}})).pipeTo(i)}else Jz.print("no sender found when trying to bind encodedTransform")},t.prototype.clean=function(){var e;this.audioMid=void 0,this.videoMid=void 0,this.videoTransceiver=void 0,this.audioTransceiver=void 0,null===(e=this.observer)||void 0===e||e.reset(),this.statsReport.destroy(),this.prevScaleResolutionDownBy=1,this.subVideoDescriptions=[]},t.prototype.switchTrackEnableState=function(e,t){var i;"audio"===e?i=this.audioTrack:"video"===e&&(i=this.videoTrack);var r=null==i?void 0:i.getTrack();return!(!r||(null==r?void 0:r.enabled)===t)&&(r.enabled=t,!0)},t}(Qz),rK=function(e){function t(t,i,r,n,o,a){void 0===a&&(a=X_.LOW);var s=e.call(this)||this;return s.userPriority=a,s.originalStreamIndex=0,s._vStats="-V",s._aStats="-A",s.userId=t,s.isScreen=r,s.isPublic=n,s.streamId=i,s.hasAudio=o.audiostream&&o.localaudio,s.hasVideo=o.videostream&&o.localvideo,s._attributes=o,s.subVideo=!1,s.subAudio=!1,s._sequenceId=0,s.subMediaType=wz.NONE,s.subLayer={spatialLayer:0,spatialSubLayer:-1},s.streamState=Yz.INIT,s.statsReport=new qz(s),s}return C_(t,e),Object.defineProperty(t.prototype,"sequenceId",{get:function(){return this._sequenceId||-1},set:function(e){"number"==typeof e&&(this._sequenceId=e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"attributes",{get:function(){return this._attributes},set:function(e){this.hasVideo=e.localvideo&&e.videostream,this.hasAudio=e.localaudio&&e.audiostream,this._attributes=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"hasSubscribed",{get:function(){return this.streamState===Yz.SUB_ED},enumerable:!1,configurable:!0}),t.prototype.initVideoEncodedTransform=function(){var e=this;if(this.videoTransceiver&&this.videoTransceiver.receiver){var t=this.videoTransceiver.receiver.createEncodedStreams(),i=t.readable,r=t.writable;i.pipeThrough(new TransformStream({transform:function(t,i){try{e.safeEmit("onTransformData",e.userId,t)}catch(e){}var r=Dz.getNalunits(new Mz(t.data)).find((function(e){return e.sei}));if(r){var n=Fz.decodeSeiBody(r.body);n&&n.type!==Nz.internal&&e.safeEmit("onSEIMessage",n.payload)}i.enqueue(t)}})).pipeTo(r)}else Jz.print("no receiver found when trying to bind encodedTransform")},t.prototype.initAudioEncodedTransform=function(){if(this.audioTransceiver&&this.audioTransceiver.receiver){var e=this.audioTransceiver.receiver.createEncodedStreams(),t=e.readable,i=e.writable;t.pipeThrough(new TransformStream({transform:function(e,t){t.enqueue(e)}})).pipeTo(i)}else Jz.print("no receiver found when trying to bind encodedTransform")},t.prototype.ontrack=function(e){var t,i,r,n,o,a;try{jB.rtcInvokeStatus(JSON.stringify({uid:this.userId,streamId:this.streamId,streams:e.streams.reduce((function(e,t){return e+(null==(i=t)?"undefined | null":"string"==typeof i?i:JSON.stringify({id:i.id,active:i.active}));var i}),""),transceiver:(n=e.transceiver,null==n?"undefined | null":"string"==typeof n?n:JSON.stringify({currentDirection:n.currentDirection,direction:n.direction,mid:n.mid,stopped:n.stopped,receiver:(a=n.receiver,null==a?"undefined | null":"string"==typeof a?a:JSON.stringify({track:jU(a.track)})),sender:(o=n.sender,null==o?"undefined | null":"string"==typeof o?o:JSON.stringify({track:jU(o.track)}))})),track:jU(e.track)}),0,"Stream.ontrack","",0)}catch(e){}if((null===(i=null===(t=e.streams)||void 0===t?void 0:t[0])||void 0===i?void 0:i.id)===this.streamId){var s=e.track;"video"===(null==s?void 0:s.kind)?this._setVideoTrack(s):"audio"===(null===(r=e.track)||void 0===r?void 0:r.kind)&&this._setAudioTrack(s),this._setStream(e.streams[0])}this.safeEmit("ontrack",e)},t.prototype.clean=function(){var e;Jz.print("clean","exec stream.clean ".concat(this.streamId," ").concat(this.userId)),this.subAudio=!1,this.subVideo=!1,this.audioMid=void 0,this.videoMid=void 0,this.sequenceId=0,this.videoTrack=void 0,this.audioTrack=void 0,this.stream=void 0,this.videoTransceiver=void 0,this.audioTransceiver=void 0,this.recordedVideoFrames=void 0,this.paused=!1,this._workaround_1_=!1,null===(e=this.observer)||void 0===e||e.reset(),this.statsReport.destroy()},t.prototype.resetHasSubscribed=function(){this.streamState=Yz.INIT},t.prototype.setRemoteUserPriority=function(e){this.userPriority=e},t.prototype.getStreamPriority=function(){var e=this.isScreen?20:this.hasAudio||this.hasVideo?this.attributes.videoDescriptions.length>1?10-this.subLayer.spatialLayer:9:0;return 1e4*this.userPriority+100*e},t.prototype.getSubscribeFallbackParams=function(e){if(e!==W_.DISABLE&&this.subVideo){if(this.attributes.videoDescriptions.length-1>this.subLayer.spatialLayer)return[this.originalMediaType,Kz.SUB,this._getSubLayerBySpatialLayer(this.subLayer.spatialLayer+1)];if(e===W_.AUDIO_ONLY)return[V_.VIDEO,Kz.UNSUB]}return null},t.prototype.getSubscribeRecoverParams=function(){if(this.originalMediaType&&FU(this.originalMediaType)){if(!1===this.subVideo)return[this.originalMediaType,Kz.SUB,this.subLayer];if("number"==typeof this.originalStreamIndex&&this.subLayer.spatialLayer>this.originalStreamIndex)return[this.originalMediaType,Kz.SUB,this._getSubLayerBySpatialLayer(this.subLayer.spatialLayer-1)]}return null},t.prototype._setStream=function(e){var t=this;this.stream=e,e.onaddtrack=function(e){"video"===e.track.kind?t._setVideoTrack(e.track):"audio"===e.track.kind&&t._setAudioTrack(e.track)}},t.prototype._setAudioTrack=function(e){var t,i;(null===(i=null===(t=this.audioTrack)||void 0===t?void 0:t.getTrack())||void 0===i?void 0:i.id)!==(null==e?void 0:e.id)&&(this.audioTrack=new mz(e,_U()),this.emit("ontrack",this.audioTrack))},t.prototype._setVideoTrack=function(e){var t,i;(null===(i=null===(t=this.videoTrack)||void 0===t?void 0:t.getTrack())||void 0===i?void 0:i.id)!==(null==e?void 0:e.id)&&(this.videoTrack=new vz(e,_U()),this.emit("ontrack",this.videoTrack))},t.prototype._getSubLayerBySpatialLayer=function(e){var t=this._attributes,i=t.videoDescriptions,r=t.subVideoDescriptions,n=void 0===r?[]:r,o=i[e],a=o.width,s=o.height,c=n.find((function(e){return e.width===a&&e.height===s}));return{spatialLayer:e,spatialSubLayer:(null==c?void 0:c.sub_index)||-1}},t}(Qz),nK=new LB("queue",4);!function(e){e[e.ADD=0]="ADD",e[e.CLOSE=1]="CLOSE"}(eK||(eK={})),function(e){e.publish="publish",e.unpublish="unpublish",e.subscribe="subscribe",e.unsubscribe="unsubscribe",e.pushtrack="pushtrack",e.removetrack="removetrack"}(tK||(tK={}));var oK,aK,sK,cK=((Zz={})[tK.publish]="unpublish",Zz[tK.subscribe]="unsubscribe",Zz[tK.pushtrack]="removetrack",Zz),uK=(($z={})[tK.publish]=eK.ADD,$z[tK.subscribe]=eK.ADD,$z[tK.pushtrack]=eK.ADD,$z[tK.unpublish]=eK.CLOSE,$z[tK.unsubscribe]=eK.CLOSE,$z[tK.removetrack]=eK.CLOSE,$z),dK=function(e){function t(){var t=e.call(this)||this;return t._queue=[],t}return C_(t,e),Object.defineProperty(t.prototype,"queue",{get:function(){return this._queue},enumerable:!1,configurable:!0}),t.prototype.enqueue=function(e){var t=this._queue.length,i="";return this._queue=this._queue.filter((function(t){return t.streamId!==e.streamId||e.action!==cK[t.action]||(i=t.streamId,nK.print("offsetStreamId",i),!1)})),this._queue.length===t&&this._queue.push(e),this.emit("start"),i},t.prototype.dequeue=function(){if(!this._queue.length)return null;var e=this._queue.length;wU&&(e=Math.min(this._queue.length,5));for(var t=uK[this._queue[0].action],i=1;i<e;i++)if(uK[this._queue[i].action]!==t)return{sdpStrategy:t,items:this._queue.splice(0,i)};return{sdpStrategy:t,items:this._queue.splice(0,e)}},t}(NB),lK=new LB("ChromeHandler",3),hK=ZG(),pK=function(e){function t(t,i){var r=e.call(this,t,i)||this;return r.name="chrome",r._queueBusy=!1,r._mid=0,r._offerMlines=[],r._answerMlines=[],r._inactiveMlineIndex=[],r._msidIndexMap={},r._mlinesCache={},r._sdpQueue=new dK,r._sdpQueue.on("start",(function(){lK.print("receive dequeue start","queueBusy: %o: , ss: %o: ",r._queueBusy,r._peerConnection.signalingState),r._queueBusy||"stable"!==r._peerConnection.signalingState||(lK.print("dequeue start"),r.dequeue())})),r}return C_(t,e),t.prototype.connect=function(e){var t,i;return tf(this,void 0,void 0,(function(){var r,n,o,a,s,c,u=this;return rf(this,(function(d){switch(d.label){case 0:return lK.print("connect","invoke connect"),this._offerIce={iceUfrag:null===(t=e.iceParams)||void 0===t?void 0:t.clientIceUfrag,icePwd:null===(i=e.iceParams)||void 0===i?void 0:i.clientIcePwd,iceOptions:"renomination"},r=this,[4,gH(e)];case 1:return r._answerIce=d.sent(),this._peerConnection.addTransceiver("audio",{direction:"recvonly"}),this._peerConnection.addTransceiver("video",{direction:"recvonly"}),this._peerConnection.addTransceiver("audio",{direction:"recvonly"}),this._peerConnection.addTransceiver("video",{direction:"recvonly"}),[4,this._peerConnection.createOffer()];case 2:return n=d.sent(),[4,(o=new RTCPeerConnection(eH)).setRemoteDescription(n)];case 3:return d.sent(),[4,o.createAnswer()];case 4:return a=d.sent(),[4,o.setLocalDescription(a)];case 5:return d.sent(),o.close(),s=rH.parse(n.sdp),c=rH.parse(a.sdp),Array.isArray(c.media)&&(c.media=c.media.map((function(e){return"video"===(null==e?void 0:e.type)&&bH(e,"H264"),AU&&"inactive"===(null==e?void 0:e.direction)&&(e.direction="sendonly"),e}))),this._offerSession=$_({},s),this._answerSession=$_({},c),s.media.forEach((function(e,t){var i=u._mid++;e=$_($_($_({},e),u._offerIce),{mid:"".concat(i)}),u._offerMlines.push(e);var r=$_($_($_({},c.media[t]),u._answerIce),{mid:"".concat(i)});"application"===r.type&&(r.sctpmap={sctpmapNumber:5e3,app:"webrtc-datachannel",maxMessageSize:262144}),u._answerMlines.push(r)})),this.setDescription(),[4,new Promise((function(e,t){u._dataChannel.onopen=function(){lK.print("connect","dataChannel open"),JB("es.dc.open",""),e("")},u._dataChannel.onerror=function(e){jB.rtcSignalingMsgError(e.error.sdpLineNumber,e.error.errorDetail,QF.INVALID_DATA),JB("es.dc.error",""),t(e)},u._dataChannel.onclose=function(e){JB("es.dc.close",""),t(e)},u._peerConnection.addEventListener("connectionstatechange",(function(e){"failed"!==u._peerConnection.iceConnectionState&&"closed"!==u._peerConnection.iceConnectionState&&"failed"!==u._peerConnection.connectionState||t(e)}))}))];case 6:return d.sent(),lK.print("connect","dataChannel establish success"),[2,this._dataChannel]}}))}))},t.prototype.disconnect=function(){this._peerConnection.close(),this._dataChannel.close(),this._peerConnection.ontrack=null},t.prototype.destroy=function(){e.prototype.destroy.call(this),this._mlinesCache={}},t.prototype.publish=function(t,i){return tf(this,void 0,void 0,(function(){var r,n,o,a,s,c,u,d,l,h,p,_,f,v,m,y,S,g,E;return rf(this,(function(b){return r=t.stream,n=t.enableSimulcast,o=e.prototype.internalPublish.call(this,t,i),a=o.videoDescriptions,s=o.subVideoDescriptions,c=o.transceiverInit,u="".concat(this._mid++),d="".concat(this._mid++),l=$_($_($_({},this._aSendonlyOfferTpl),this._offerIce),{mid:u,msid:"".concat(r.id," ").concat(r.id,"-audio"),ssrcs:mH(r,"audio")}),h=$_($_($_({},this._vSendonlyOfferTpl),this._offerIce),{mid:d,msid:"".concat(r.id," ").concat(r.id,"-video")}),n?(lK.print("subVideoDesc","desc: %o ",s),delete h.ssrcGroups,delete h.ssrcs,p=[],h.rids=a.map((function(e){var t=e.rid;return p.unshift(t),{id:t,direction:"send"}})),h.simulcast={dir1:"send",list1:p.join(";")}):(_=function(e,t){var i=vH(),r=vH();return{ssrcs:[i,r].reduce((function(i,r){return i.concat(mH(e,t,r))}),[]),ssrcGroups:[{semantics:"FID",ssrcs:"".concat(i," ").concat(r)}]}}(r,"video"),f=_.ssrcs,v=_.ssrcGroups,h.ssrcs=f,h.ssrcGroups=v),(EU||AU)&&Array.isArray(h.ext)&&(h.ext=h.ext.filter((function(e){var t;return!(null===(t=null==e?void 0:e.uri)||void 0===t?void 0:t.includes("video-orientation"))}))),(null==i?void 0:i.audioRed)&&Array.isArray(l.rtp)&&-1!==(m=l.rtp.findIndex((function(e){return"red"===e.codec})))&&(y=of(l.rtp.splice(m,1),1),S=y[0],l.rtp.unshift(S)),location.search.includes("__rtc_vp8__")?bH(h,"VP8"):location.search.includes("__rtc_h264__")&&bH(h,"H264"),(g=null==l?void 0:l.rtp.find((function(e){return"opus"===e.codec})))&&l.fmtp&&(E=l.fmtp.find((function(e){return e.payload===g.payload})))&&this._context&&(E.config+=this._context.audioProfileManager.getOpusConfigStr()),n||EU||this.addBitrateLimit(h,t.videoEncodeConfig[0].maxKbps),this._mlinesCache[t.stream.id]=[l,h],[2,{partialSdp:SH(this._offerSession,l,h),audioMid:u,videoMid:d,type:"incroffer",semantics:"unified-plan",videoDescriptions:a,subVideoDescriptions:s,transceiverInit:c}]}))}))},t.prototype.subscribe=function(e,t){return tf(this,void 0,void 0,(function(){var i,r,n,o,a,s,c,u,d,l,h,p,_;return rf(this,(function(f){switch(f.label){case 0:return lK.print("subscribe","mids: ",t),i="incroffer",r="unified-plan",this._aRecvonlyOfferTpl&&this._vRecvonlyOfferTpl?[3,3]:[4,LU(!0)];case 1:if(!(n=f.sent()))throw new Vj(Nj.NOT_SUPPORTED,"Get offer Error");return[4,this.createAVMlineOfferTpl(n)];case 2:f.sent(),f.label=3;case 3:return this._mlinesCache[e.streamId]?(o=of(this._mlinesCache[e.streamId],2),a=o[0],s=o[1],a.mid=e.audioMid,s.mid=e.videoMid,[2,{partialSdp:SH(this._offerSession,a,s),audioMid:a.mid,videoMid:s.mid,type:i,semantics:r}]):(c="".concat(this._mid++),u="".concat(this._mid++),d=$_($_($_({},this._aRecvonlyOfferTpl),this._offerIce),{mid:c}),l=$_($_($_({},this._vRecvonlyOfferTpl),this._offerIce),{mid:u}),this._mlinesCache[e.streamId]=[d,l],e.isPublic&&((null==(h=null==l?void 0:l.rtp.filter((function(e){return"H264"===e.codec})))?void 0:h.length)&&(null==l?void 0:l.fmtp)&&(null==l||l.fmtp.forEach((function(e){h.find((function(t){return t.payload===e.payload}))&&(e.config+=";sps-pps-idr-in-keyframe=1")}))),(null==l?void 0:l.rtcpFb)&&(p=new Map,_=[],l.rtcpFb.forEach((function(e,t){p.set(e.payload,t)})),p.forEach((function(e,t){_.push({payload:t,idx:e})})),_.sort((function(e,t){return e.idx-t.idx})).forEach((function(e,t){var i;null===(i=null==l?void 0:l.rtcpFb)||void 0===i||i.splice(e.idx+t+1,0,{payload:e.payload,type:"rrtr"})})))),[2,{partialSdp:SH(this._offerSession,d,l),audioMid:c,videoMid:u,type:i,semantics:r,transceiverInit:{aTrack:"audio",vTrack:"video",audioTransceiverInit:{direction:"recvonly"},videoTransceiverInit:{direction:"recvonly"}}}])}}))}))},t.prototype.handleAck=function(e){return tf(this,void 0,void 0,(function(){return rf(this,(function(t){return lK.print("handleAck()","item: %o",e),[2,this._sdpQueue.enqueue(e)]}))}))},t.prototype.dequeue=function(){var e,t,i,r,n;return tf(this,void 0,void 0,(function(){var o,a,s,c,u,d,l,h,p,_,f,v,m,y,S,g,E,b,I,T,A,R,C,O,w,k,N,P,D,M,L,U=this;return rf(this,(function(x){switch(x.label){case 0:if(this._queueBusy=!0,o=this._sdpQueue.dequeue(),lK.print("dequeue()","ret: %o",o),!o)return this._queueBusy=!1,[2];x.label=1;case 1:if(x.trys.push([1,22,23,24]),a=o.items,s=o.sdpStrategy,c=[],u=[],d=[],s!==eK.ADD)return[3,19];delete(l=$_({},this._answerIce)).candidates,x.label=2;case 2:x.trys.push([2,12,13,18]),h=sf(a),x.label=3;case 3:return[4,h.next()];case 4:return(p=x.sent()).done?[3,11]:(_=p.value,f=_.action,v=_.transceiverInit,m=_.signalingAck,y=_.stream,S=y instanceof rK,_.onSuccess&&d.push(_.onSuccess),S&&(null==m?void 0:m.sequenceId)<y.sequenceId?[3,11]:(g={},E={},b=rH.parse(m.sdp),Array.isArray(b.media)&&(I="",b.media.sort((function(e,t){var i;return null===(i=null==e?void 0:e.type)||void 0===i?void 0:i.localeCompare(null==t?void 0:t.type)})).forEach((function(e){"audio"===(e=$_($_({},e),l)).type?(g=e,lK.print("audioMsid",e.msid),e.msid&&(I=e.msid.replace("audio","video"))):(E=e,lK.print("videoMsid",I),I&&(E.msid=I,I=""))}))),T=y.streamId,f===tK.publish&&(T=null===(i=y.stream)||void 0===i?void 0:i.id),this._mlinesCache[T]?(A=of(this._mlinesCache[T],2),R=A[0],C=A[1],v?(f===tK.publish&&OU&&(null===(r=null==v?void 0:v.videoTransceiverInit)||void 0===r||delete r.sendEncodings),y.audioTransceiver=this._peerConnection.addTransceiver(v.aTrack,v.audioTransceiverInit),y.videoTransceiver=this._peerConnection.addTransceiver(v.vTrack,v.videoTransceiverInit),this.monitor.rtcInvokeStatus(JSON.stringify({audioStreamTrack:jU(v.aTrack),videoStreamTrack:jU(v.vTrack)}),0,"chromeHandler.addTrack","",0),(O=this._inactiveMlineIndex.shift())||(O=this._offerMlines.length),this._offerMlines[O]=$_($_({},R),{mid:g.mid}),this._answerMlines[O]=g,(w=this._inactiveMlineIndex.shift())||(w=this._offerMlines.length),this._offerMlines[w]=$_($_({},C),{mid:E.mid}),this._answerMlines[w]=E,this._msidIndexMap[y.streamId]=[O,w],hK&&(y.initAudioEncodedTransform(),y.initVideoEncodedTransform()),c.push(y.streamId||""),u.push(S?y.userId:"local"),[3,9]):[3,5]):[3,11]));case 5:return S?(k=of(this._msidIndexMap[y.streamId]||[],2),N=k[0],P=k[1],N&&P?(null===(n=this._offerMlines[N])||void 0===n?void 0:n.mid)===g.mid?[3,7]:(this._offerMlines[N]=yH(this._offerMlines[N]),this._offerMlines[P]=yH(this._offerMlines[P]),this._answerMlines[N]=yH(this._answerMlines[N]),this._answerMlines[P]=yH(this._answerMlines[P]),[4,this.setDescription()]):[3,8]):[3,9];case 6:x.sent(),this._offerMlines[N]=$_($_({},this._aRecvonlyOfferTpl),{mid:g.mid}),this._offerMlines[P]=$_($_({},this._vRecvonlyOfferTpl),{mid:E.mid}),lK.print("enqueue","hack: %o",y.streamId),x.label=7;case 7:return this._answerMlines[N]=g,this._answerMlines[P]=E,[3,9];case 8:lK.print("dequeue","pushtrack before subscribe: %o",y.userId),x.label=9;case 9:S&&(y.sequenceId=null==m?void 0:m.sequenceId),x.label=10;case 10:return[3,3];case 11:return[3,18];case 12:return D=x.sent(),e={error:D},[3,18];case 13:return x.trys.push([13,,16,17]),p&&!p.done&&(t=h.return)?[4,t.call(h)]:[3,15];case 14:x.sent(),x.label=15;case 15:return[3,17];case 16:if(e)throw e.error;return[7];case 17:return[7];case 18:return[3,20];case 19:M={},a.forEach((function(e){var t,i=e.audioMid,r=e.videoMid;M[i]=i,M[r]=r,delete U._msidIndexMap[null===(t=e.stream)||void 0===t?void 0:t.streamId]})),this._offerMlines=this._offerMlines.map((function(e,t){return M[e.mid]&&(e=yH(e),U._inactiveMlineIndex.push(t)),e})),this._inactiveMlineIndex.sort((function(e,t){return e-t})),this._answerMlines=this._answerMlines.map((function(e){return M[e.mid]&&(e=yH(e)),e})),x.label=20;case 20:return[4,this.setDescription(c.length?{streamId:c.join(","),streamUserId:u.join(",")}:void 0)];case 21:x.sent();try{d.forEach((function(e){return e()}))}catch(e){}return lK.print("dequeue","loop"),[3,24];case 22:return L=x.sent(),lK.print("dequeue","unknown error: %o",L),[3,24];case 23:return this.dequeue(),[7];case 24:return[2]}}))}))},t.prototype.setDescription=function(e){return tf(this,void 0,void 0,(function(){var t,i;return rf(this,(function(r){switch(r.label){case 0:return lK.print("setDescription","_offerMlines: %o, _answerMlines: %o",this._offerMlines,this._answerMlines),this._offerSession.media=this._offerMlines,this._answerSession.media=this._answerMlines,t=[],this._offerMlines.forEach((function(e){"inactive"!==e.direction&&t.push(e.mid)})),this._offerSession.groups&&this._answerSession.groups&&(this._offerSession.groups[0].mids=t.join(" "),this._answerSession.groups[0].mids=t.join(" ")),i=fU(),e&&jB.rtcBeginCreateOffer("local"===e.streamUserId?eB.UP:eB.DOWN,e.streamId,e.streamUserId),[4,this._peerConnection.createOffer()];case 1:return r.sent(),e&&jB.rtcCreateOffer(0,"local"===e.streamUserId?tB.UP:tB.DOWN,e.streamId,e.streamUserId,fU()-i),[4,this.setLocalDescription(rH.write(this._offerSession),e)];case 2:return r.sent(),[4,this.setRemoteDescription(rH.write(this._answerSession),e)];case 3:return r.sent(),[2]}}))}))},t.prototype.getDefaultSdp=function(){return tf(this,void 0,void 0,(function(){var e,t,i;return rf(this,(function(r){switch(r.label){case 0:return[4,LU(!0)];case 1:if(!(e=r.sent()))throw new Vj(Nj.NOT_SUPPORTED,"Get offer Error");return this.createAVMlineOfferTpl(e),t=rH.parse(e),i=[],t.media=t.media.filter((function(e){return"recvonly"===e.direction&&(i.push(e.mid+""),!0)})),t.groups=[{mids:i.join(" "),type:"BUNDLE"}],[2,{sdp:rH.write(t),semantics:"unified-plan",type:"offer"}]}}))}))},t.prototype.rollback=function(e){return tf(this,void 0,void 0,(function(){return rf(this,(function(t){return delete this._mlinesCache[e],[2]}))}))},t.prototype.createAVMlineOfferTpl=function(e){var t=this;rH.parse(e).media.forEach((function(e){"audio"===e.type?"sendonly"===e.direction?t._aSendonlyOfferTpl=e:t._aRecvonlyOfferTpl=e:"video"===e.type&&("sendonly"===e.direction?t._vSendonlyOfferTpl=e:t._vRecvonlyOfferTpl=e)}))},t}(iH),_K=new LB("FirefoxHandler",3),fK=function(e){function t(t,i){var r=e.call(this,t,i)||this;return r.name="firefox",r}return C_(t,e),t.prototype.connect=function(e){var t,i;return tf(this,void 0,void 0,(function(){var r,n,o,a,s,c,u=this;return rf(this,(function(d){switch(d.label){case 0:return _K.print("connect","invoke connect"),this._offerIce={iceUfrag:null===(t=e.iceParams)||void 0===t?void 0:t.clientIceUfrag,icePwd:null===(i=e.iceParams)||void 0===i?void 0:i.clientIcePwd,iceOptions:"renomination"},r=this,[4,gH(e)];case 1:return r._answerIce=d.sent(),[4,this._peerConnection.createOffer()];case 2:return n=d.sent(),o=rH.parse(n.sdp),a=of(o.media,1),s=a[0],this._offerIce.fingerprint=o.fingerprint||s.fingerprint,o.media=o.media.map((function(e){return $_($_({},e),u._offerIce)})),(c=$_({},o)).fingerprint=this._answerIce.fingerprint,c.media=c.media.map((function(e){return $_($_($_({},e),u._answerIce),{sctpmap:{sctpmapNumber:5e3,app:"webrtc-datachannel",maxMessageSize:262144}})})),[4,this.setLocalDescription(rH.write(o))];case 3:return d.sent(),[4,this.setRemoteDescription(rH.write(c))];case 4:return d.sent(),[4,new Promise((function(e,t){u._dataChannel.onopen=function(){_K.print("connect","dataChannel open"),JB("es.dc.open",""),e("")},u._dataChannel.onerror=function(e){jB.rtcSignalingMsgError(e.error.sdpLineNumber,e.error.errorDetail,QF.INVALID_DATA),JB("es.dc.error",""),t(e)},u._dataChannel.onclose=function(e){JB("es.dc.close",""),t(e)},u._peerConnection.addEventListener("connectionstatechange",(function(e){"failed"!==u._peerConnection.iceConnectionState&&"closed"!==u._peerConnection.iceConnectionState&&"failed"!==u._peerConnection.connectionState||t(e)}))}))];case 5:return d.sent(),_K.print("connect","dataChannel establish success"),[2,this._dataChannel]}}))}))},t.prototype.publish=function(t,i){var r,n;return tf(this,void 0,void 0,(function(){var o,a,s,c,u,d,l,h,p,_,f,v=this;return rf(this,(function(m){switch(m.label){case 0:return o=e.prototype.internalPublish.call(this,t,i),a=o.videoDescriptions,s=o.subVideoDescriptions,c=o.transceiverInit,t.audioTransceiver=this._peerConnection.addTransceiver(c.aTrack,c.audioTransceiverInit),t.videoTransceiver=this._peerConnection.addTransceiver(c.vTrack,c.videoTransceiverInit),u=fU(),jB.rtcBeginCreateOffer(eB.UP,"",""),[4,this._peerConnection.createOffer()];case 1:return d=m.sent(),jB.rtcCreateOffer(0,tB.UP,"","",fU()-u),(l=rH.parse(d.sdp)).media=null===(r=l.media)||void 0===r?void 0:r.map((function(e){return $_($_({},e),v._offerIce)})),[4,this.setLocalDescription(rH.write(l))];case 2:return m.sent(),h=t.audioTransceiver.mid,p=t.videoTransceiver.mid,_=null,f=null,l.media=null===(n=l.media)||void 0===n?void 0:n.map((function(e){if("".concat(e.mid)===h){var t=null==(_=e)?void 0:_.rtp.find((function(e){return"opus"===e.codec}));if(t&&_.fmtp){var i=_.fmtp.find((function(e){return e.payload===t.payload}));i&&v._context&&(i.config+=v._context.audioProfileManager.getOpusConfigStr())}}else"".concat(e.mid)===p&&(f=e);return e})),this.addBitrateLimit(f,t.videoEncodeConfig[0].maxKbps),[4,this.setLocalDescription(rH.write(l))];case 3:return m.sent(),[2,{partialSdp:SH(l,_,f),audioMid:h,videoMid:p,type:"incroffer",semantics:"unified-plan",videoDescriptions:a,subVideoDescriptions:s,transceiverInit:c}]}}))}))},t.prototype.subscribe=function(e){var t,i;return tf(this,void 0,void 0,(function(){var r,n,o,a,s,c,u,d=this;return rf(this,(function(l){switch(l.label){case 0:return _K.print("subscribe()"),e.audioTransceiver=this._peerConnection.addTransceiver("audio",{direction:"recvonly"}),e.videoTransceiver=this._peerConnection.addTransceiver("video",{direction:"recvonly"}),r=fU(),jB.rtcBeginCreateOffer(eB.UP,e.streamId,e.userId),[4,this._peerConnection.createOffer()];case 1:return n=l.sent(),jB.rtcCreateOffer(0,tB.UP,e.streamId,e.userId,fU()-r),(o=rH.parse(n.sdp)).media=null===(t=o.media)||void 0===t?void 0:t.map((function(e){return $_($_({},e),d._offerIce)})),[4,this.setLocalDescription(rH.write(o),{streamId:e.streamId||"",streamUserId:e.userId})];case 2:return l.sent(),a=e.audioTransceiver.mid,s=e.videoTransceiver.mid,c=null,u=null,null===(i=o.media)||void 0===i||i.forEach((function(e){"".concat(e.mid)===a?c=e:"".concat(e.mid)===s&&(u=e)})),[2,{partialSdp:SH(o,c,u),audioMid:a,videoMid:s,type:"incroffer",semantics:"unified-plan"}]}}))}))},t.prototype.handleAck=function(e){var t,i;return tf(this,void 0,void 0,(function(){var r,n,o,a,s,c=this;return rf(this,(function(u){return e.action===tK.unpublish||e.action===tK.unsubscribe||(r=e.signalingAck,n={},(o=rH.parse(null===(t=this._peerConnection.remoteDescription)||void 0===t?void 0:t.sdp)).media.forEach((function(e){n[e.mid]=e})),rH.parse(null==r?void 0:r.sdp).media.forEach((function(e){n[e.mid]=$_($_({},e),c._answerIce)})),a=[],(s=rH.parse(null===(i=this._peerConnection.localDescription)||void 0===i?void 0:i.sdp)).media.forEach((function(e){a.push(n[e.mid])})),o.groups=s.groups,o.media=a,this.setRemoteDescription(rH.write(o))),[2,""]}))}))},t.prototype.getDefaultSdp=function(){return tf(this,void 0,void 0,(function(){return rf(this,(function(e){return[2,{semantics:"unified-plan",sdp:"",type:"offer"}]}))}))},t.prototype.rollback=function(e,t){var i,r;return tf(this,void 0,void 0,(function(){var e,n,o;return rf(this,(function(a){switch(a.label){case 0:return _K.print("rollback()"),t.audioTransceiver&&t.videoTransceiver?(t.audioTransceiver.stop(),t.videoTransceiver.stop(),e=[],(n=rH.parse(null===(i=this._peerConnection.localDescription)||void 0===i?void 0:i.sdp)).media=n.media.map((function(i){return"".concat(i.mid)!==t.audioMid&&"".concat(i.mid)!==t.videoMid||(i=yH(i)),"inactive"!==i.direction&&e.push(i.mid),i})),(o=rH.parse(null===(r=this._peerConnection.remoteDescription)||void 0===r?void 0:r.sdp)).media=o.media.map((function(e){return"".concat(e.mid)!==t.audioMid&&"".concat(e.mid)!==t.videoMid||(e=yH(e)),e})),n.groups&&o.groups&&(n.groups[0].mids=e.join(" "),o.groups[0].mids=e.join(" ")),[4,this._peerConnection.createOffer()]):[3,4];case 1:return a.sent(),[4,this.setLocalDescription(rH.write(n))];case 2:return a.sent(),[4,this.setRemoteDescription(rH.write(o))];case 3:a.sent(),a.label=4;case 4:return[2]}}))}))},t.prototype.setCurrentDescription=function(){return tf(this,void 0,void 0,(function(){return rf(this,(function(e){switch(e.label){case 0:return[4,this._peerConnection.createOffer()];case 1:return e.sent(),this._peerConnection.localDescription&&this._peerConnection.remoteDescription?[4,this._peerConnection.setLocalDescription(this._peerConnection.localDescription)]:[3,4];case 2:return e.sent(),[4,this._peerConnection.setRemoteDescription(this._peerConnection.remoteDescription)];case 3:e.sent(),e.label=4;case 4:return[2]}}))}))},t}(iH),vK=function(e,t){return gU?new fK(e,t):new pK(e,t)},mK=new LB("Locker",2),yK=1,SK=function(){function e(e){this.lockingPromise=Promise.resolve(),this.locks=0,this.name="",this.lockId=yK++,e&&(this.name=e),mK.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,mK.print("[lock-".concat(this.name,"-").concat(this.lockId,"] locked, current queue ").concat(this.locks,"."));var i=new Promise((function(i){e=function(){t.locks-=1,mK.print("[lock-".concat(t.name,"-").concat(t.lockId,"] unlocked, current queue ").concat(t.locks,".")),i()}})),r=this.lockingPromise.then((function(){return e}));return this.lockingPromise=this.lockingPromise.then((function(){return i})),r},e}();!function(e){e[e.communication=0]="communication",e[e.live_broadcasting=1]="live_broadcasting",e[e.game=2]="game",e[e.cloud_game=3]="cloud_game",e[e.low_latency=4]="low_latency",e[e.chat=5]="chat",e[e.chat_room=6]="chat_room",e[e.lw_together=7]="lw_together",e[e.game_hd=8]="game_hd",e[e.co_host=9]="co_host",e[e.interactive_podcast=10]="interactive_podcast",e[e.ktv=11]="ktv",e[e.chorus=12]="chorus",e[e.vr_chat=13]="vr_chat",e[e.game_streaming=14]="game_streaming",e[e.lan_live_streaming=15]="lan_live_streaming",e[e.meeting=16]="meeting",e[e.meeting_room=17]="meeting_room",e[e.classroom=18]="classroom"}(aK||(aK={})),function(e){e.IES_living="IES_living",e.FeedShare="FeedShare",e.fluent="fluent",e.IES_chatroom="IES_chatroom",e.standard="standard",e.IES_PK="IES_PK",e.IES_KTV="IES_KTV"}(sK||(sK={}));var gK,EK=((oK={})[J_.communication]=[aK.communication],oK[J_.chat]=[aK.communication],oK[J_.chatRoom]=[aK.live_broadcasting,sK.IES_chatroom],oK[J_.coHost]=[aK.live_broadcasting,sK.IES_PK],oK[J_.meeting]=[aK.meeting],oK[J_.classRoom]=[aK.communication],oK),bK=new LB("MediaServerClient",2),IK=6e4;!function(e){e.DISCONNECTED="disconnected",e.DISCONNECTING="disconnecting",e.CONNECTED="connected",e.CONNECTING="connecting"}(gK||(gK={}));var TK,AK=function(e,t){bK.print(e,"userId: %o, subAudio: %o, subVideo: %o, paused: %o, audioMid: %o, videoMid: %o, workaround_1_: %o, sequenceId: %o",t.userId,t.subAudio,t.subVideo,t.paused,t.audioMid,t.videoMid,t._workaround_1_,t.sequenceId)},RK=function(e){function t(t,i){void 0===i&&(i=jB);var r=e.call(this)||this;return r._ontrackCallbackMap=new Map,r._subResolves={},r.supportConcurrent=!1,r._pubConfig={},r._subConfig={},r._roomProfile=J_.communication,r._subStreamQueue={},r.monitor=i,r._pubSubLock=new SK("pubSubLock"),r._joinLeaveLock=new SK("joinLeaveLock"),r._state=gK.DISCONNECTED,r._roomAttributes={multiChatMode:!1,bigRoomMode:!1},r._context=t,r.on("SUB_END",(function(e){return r._handleSubStreamQueue(e)})),r}return C_(t,e),t.prototype._addHandlerEvents=function(){var e,t=this;null===(e=this._handler)||void 0===e||e.once("disconnect",(function(){bK.print("emit ABNORMAL_DISCONNECTION ice"),t.safeEmit(yG.ABNORMAL_DISCONNECTION)}))},t.prototype._addSignalEventHandler=function(){var e,t=this;[vG.ON_ADD_STREAM,vG.ON_REMOVE_STREAM,vG.USER_CONNECTION,vG.USER_DISCONNECTION,vG.ON_UPDATE_STREAM_ATTRIBUTES,vG.ON_UPDATE_ROOM_ATTRIBUTES,vG.ON_PUSH_TRACK,vG.ON_REMOVE_TRACK,vG.NODE_CHANGE,vG.ON_CUSTOM_MESSAGE,vG.USER_MESSAGE_RECEIVED,vG.USER_BINARY_MESSAGE_RECEIVED,vG.POST_PROCESSING_MESSAGE,vG.ON_USER_TOKEN_WILL_EXPIRE,vG.STREAM_CONTROL_MESSAGE,vG.ON_SCENE_CONFIG,vG.ON_STREAM_FAILED,mG.RSCP].forEach((function(e){var i;null===(i=t._dataChannelSignal)||void 0===i||i.on(e,(function(i){t.safeEmit(e,i)}))})),null===(e=this._dataChannelSignal)||void 0===e||e.once("close",(function(){bK.print("emit ABNORMAL_DISCONNECTION datachannel"),t.safeEmit(yG.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(yG.ON_CONNECTION_STATE_CHANGE,{prev:this._state,next:e}),this._state=e)},enumerable:!1,configurable:!0}),t.prototype.connect=function(e,t,i,r){var n;return void 0===t&&(t=""),void 0===i&&(i=""),void 0===r&&(r={}),tf(this,void 0,void 0,(function(){var o,a,s,c,u,d=this;return rf(this,(function(l){switch(l.label){case 0:return this.connectionState=gK.CONNECTING,this._appId=e,this._handler&&(this._removeSignalEventHandler(),this._handler.destroy()),r.node?(o=[r.node],JB("es.join.nodeChange",r),[3,3]):[3,1];case 1:return Promise.resolve().then((function(){return d.emit("onGetIceConfigHook")})),this._iceConfigRequestManager=new DG,[4,null===(n=this._iceConfigRequestManager)||void 0===n?void 0:n.getAccessNode(e,t,i,IF.getDeviceId(),null==r?void 0:r.reason,null==r?void 0:r.feedbackNode,this._useCloudProxy)];case 2:if(!(o=l.sent()))throw JB("es.join.getNodeFailed",""),new Vj(Nj.ICE_SERVER_WRONG,"get ICE config failed");JB("es.join.getNodeSuccess",o),l.label=3;case 3:this._addHandlerEvents(),Promise.resolve().then((function(){return d.emit("onEstablishConnectionHook")})),l.label=4;case 4:return l.trys.push([4,6,,7]),s=!1,c=o.map((function(e){var t=vK(d.monitor,d._context);return t.connect(e).then((function(i){s?t.destroy():(s=!0,a=i,d.safeEmit("prevIceNode",e),d._handler=t,d.supportConcurrent="chrome"===t.name,d._addHandlerEvents())})).catch((function(){t.destroy()}))})),[4,UU(c)];case 5:return l.sent(),bK.print("join","establish peerConnection success"),[3,7];case 6:throw u=l.sent(),this.connectionState=gK.DISCONNECTED,new Vj(Nj.ESTABLISH_DATACHANNEL_FAILED,"establish dataChannel failed",u);case 7:if(!a)throw this.connectionState=gK.DISCONNECTED,new Vj(Nj.ESTABLISH_DATACHANNEL_FAILED,"establish dataChannel failed");return this._dataChannelSignal=new kG(a),this._addSignalEventHandler(),this._dataChannelSignal.sendPingSignaling(),[2]}}))}))},t.prototype.join=function(e,t,i,r){var n,o,a,s,c,u,d,l,h,p;return void 0===t&&(t={}),void 0===i&&(i=!1),tf(this,void 0,void 0,(function(){var _,f,v,m,y,S,g,E=this;return rf(this,(function(b){switch(b.label){case 0:return bK.print("join()","info: %o, params: %o, reconnect: %o, controlMessage: %o",e,t,i,r),this._appId=e.appId,this._token=e.token,this._roomId=e.roomId,this._clientId=e.userInfo.userId,this._businessId=e.userInfo.businessId,this._userInfo=e.userInfo,this._useCloudProxy=e.useCloudProxy,this._roomProfile=e.roomProfile,this._sessionId=t.sessionId,[4,this.connect(this._appId,this._roomId,this._clientId,t)];case 1:return b.sent(),S={Authorization:yU.token2auth(this._appId,this._roomId,this._clientId,this._token),sessionId:this._sessionId||"",timestamp:Date.now(),controlMessage:r,userAttributes:{extra_info:this._userInfo.extraInfo,role:this._userInfo.role}},g={},[4,QG()];case 2:return S.params=(g.supportedCodecs=b.sent(),g.deviceType="web",g.userAgent=window.navigator.userAgent,g.sdkVersion=OF.VERSION,g.deviceId=IF.getDeviceId(),g.appId=this._appId,g.roomId=this._roomId,g.userId=this._clientId,g.businessId=this._businessId,g.enableCloudProxy=this._useCloudProxy,g.channelProfile=EK[this._roomProfile]?EK[this._roomProfile][0]+"":"0",g),S.options={supportTokenExpireCallBack:!0,enableSceneConfigV2:!0},_=S,gU?[3,4]:(f=_,[4,null===(n=this._handler)||void 0===n?void 0:n.getDefaultSdp()]);case 3:f.sdpInfo=b.sent(),_.options.enableUnBundleMode=!0,b.label=4;case 4:Promise.resolve().then((function(){return E.emit("onSendingJoinMessageHook")})),b.label=5;case 5:return b.trys.push([5,7,,8]),v=i?"reconnected":"joinRoom",[4,this._dataChannelSignal.sendSignaling(v,_)];case 6:return m=b.sent(),bK.print("join","send join message success"),this._authorization=_.Authorization,this.connectionState=gK.CONNECTED,qz.audioStallConfig=null===(o=m.config)||void 0===o?void 0:o.engine_WEB,this._pubConfig.audioRed=!!(null===(s=null===(a=m.config)||void 0===a?void 0:a.engine_WEB)||void 0===s?void 0:s.pub_audio_red),this._subConfig.muteReplaceUnsub=!!(null===(c=m.config)||void 0===c?void 0:c.mute_replace_unsub),this._pubConfig.simulcastOnDemand=!(!1===(null===(l=null===(d=null===(u=m.config)||void 0===u?void 0:u.engine_VPM)||void 0===d?void 0:d.ondemand)||void 0===l?void 0:l.enable)),null===(h=this._context)||void 0===h||h.audioProfileManager.updateEngineBAC(null===(p=m.config)||void 0===p?void 0:p.engine_BAC),[2,m];case 7:if(y=b.sent(),this.connectionState=gK.DISCONNECTED,(null==y?void 0:y.code)>=700&&(null==y?void 0:y.code)<800)throw new Vj(Nj.INVALID_TOKEN,(null==y?void 0:y.message)||"Invalid token");if(200!==(null==y?void 0:y.code))throw new Vj(Nj.JOIN_ROOM_FAILED,(null==y?void 0:y.message)||"Join room failed");return[3,8];case 8:return[2]}}))}))},t.prototype.publish=function(e){var t,i,r,n,o,a,s;return tf(this,void 0,void 0,(function(){var c,u,d,l,h,p,_,f,v,m,y=this;return rf(this,(function(S){switch(S.label){case 0:bK.print("publish()","localStream: %o",e),c=e.videoTrack,u=e.audioTrack,d=fU(),l="",h="",S.label=1;case 1:return S.trys.push([1,6,,8]),[4,null===(t=this._handler)||void 0===t?void 0:t.publish(e,this._pubConfig)];case 2:if(!(p=S.sent()))throw new Vj(Nj.ADD_TRANSCEIVER_FAILED,"add transceiver failed");return l=p.audioMid,h=p.videoMid,e.pubAttributes={localaudio:!!u,localvideo:!!c,videostream:e.pubVideo,audiostream:e.pubAudio,extvideo:!!(c instanceof bz),extaudio:!!(u instanceof Iz)},_={attributes:$_({videoDescriptions:p.videoDescriptions},e.pubAttributes),audio:!0,video:!0,screen:e.isScreen,audioMid:l,videoMid:h,sdpInfo:{msid:e.stream.id,type:p.type,sdp:p.partialSdp,semantics:p.semantics}},e.enableSimulcast&&this._pubConfig.simulcastOnDemand&&(null===(i=p.subVideoDescriptions)||void 0===i?void 0:i.length)&&(_.attributes.subVideoDescriptions=p.subVideoDescriptions),[4,null===(r=this._dataChannelSignal)||void 0===r?void 0:r.sendSignaling("publish",_)];case 3:if(200!==(null==(f=S.sent())?void 0:f.code))throw new Vj(Nj.PUBLISH_FAILED,(null==f?void 0:f.message)||"publish failed");return jB.rtcRecvAnswer(0,nB.INCRANSWER,(null===(n=null==f?void 0:f.relayMessage)||void 0===n?void 0:n.sequenceId)||0,null===(o=null==f?void 0:f.relayMessage)||void 0===o?void 0:o.sdp,oB.UP,"",""),v=new Promise((function(t,i){var r,n,o,a,s;null===(r=y._handler)||void 0===r||r.handleAck({action:tK.publish,streamId:f.streamId,audioMid:l,videoMid:h,transceiverInit:p.transceiverInit,signalingAck:{audioMid:null===(n=null==f?void 0:f.relayMessage)||void 0===n?void 0:n.audioMid,videoMid:null===(o=null==f?void 0:f.relayMessage)||void 0===o?void 0:o.videoMid,sdp:null===(a=null==f?void 0:f.relayMessage)||void 0===a?void 0:a.sdp,sequenceId:null===(s=null==f?void 0:f.relayMessage)||void 0===s?void 0:s.sequenceId},stream:e,onSuccess:function(){bK.print("publish()","publish success"),t(0)}})})),!gU?[4,v]:[3,5];case 4:S.sent(),S.label=5;case 5:return OU||null===(a=this._handler)||void 0===a||a.updateDegradationPreference(e),e.streamId=f.streamId,e.videoMid=h,e.audioMid=l,e.subVideoDescriptions=p.subVideoDescriptions,this.monitor.rtcPublishStat(aB.SUCCESS,sB.W_0,d,cB.UNKNOWN),e.statsReport.setLocalStreamStatsEvtInterval(this,this._handler,this.monitor),[2];case 6:return(m=S.sent())instanceof Error&&this.monitor.rtcPublishStat(aB.FAIL,sB.W_0,d,m.message),[4,null===(s=this._handler)||void 0===s?void 0:s.rollback(e.stream.id,e)];case 7:throw S.sent(),m;case 8:return[2]}}))}))},t.prototype.updatePubTrack=function(e){var t,i,r,n,o,a,s,c;return tf(this,void 0,void 0,(function(){var u,d,l,h,p,_,f,v,m,y,S,g,E,b,I,T,A,R,C,O,w,k,N,P,D,M,L;return rf(this,(function(U){switch(U.label){case 0:return bK.print("updatePubTrack()","localStream: %o",e),u=e.videoTrack,d=e.audioTrack,l=e.pubAudio,h=e.pubVideo,p=null==d?void 0:d.getTrack(),_=null==u?void 0:u.getTrack(),h&&_?null===(t=e.videoTransceiver)||void 0===t||t.sender.replaceTrack(_):null===(i=e.videoTransceiver)||void 0===i||i.sender.replaceTrack(null),OU?[3,2]:[4,null===(r=this._handler)||void 0===r?void 0:r.updateDegradationPreference(e)];case 1:U.sent(),U.label=2;case 2:null===(n=this._handler)||void 0===n||n.updateMaxBitrate(e),l&&p?(v=(f=d).mixType,(m=f.mixedAudioTrack)&&v!==uf.PLAYOUT&&!0===p.enabled&&(p=m),null===(o=e.audioTransceiver)||void 0===o||o.sender.replaceTrack(p)):(null===(a=e.audioTransceiver)||void 0===a||a.sender.replaceTrack(null),this.monitor.rtcInvokeStatus("null",0,"MediaClient.updatePubTrack(audio)","",0));try{this.monitor.rtcInvokeStatus(JSON.stringify({audioStreamTrack:jU(p),videoStreamTrack:jU(_)}),0,"MediaClient.updatePubTrack","",0)}catch(e){}y={localaudio:!!d,localvideo:!!u,videostream:h,audiostream:l,extvideo:!!(u instanceof bz),extaudio:!!(d instanceof Iz)},S={};try{for(g=nf(Object.entries(y)),E=g.next();!E.done;E=g.next())b=of(E.value,2),I=b[0],(T=b[1])!==Reflect.get(e.pubAttributes,I)&&Reflect.set(S,I,T)}catch(e){M={error:e}}finally{try{E&&!E.done&&(L=g.return)&&L.call(g)}finally{if(M)throw M.error}}return Object.keys(S).length?(e.observer&&(A=e.observer,R=S.audiostream,C=S.videostream,O=S.localaudio,k=S.extaudio,N=S.extvideo,void 0!==(w=S.localvideo)?void 0!==N?A.setPushVideo(N):A.setEnableVideo(w):void 0!==C&&A.setUnmuteVideo(C),void 0!==O?void 0!==k?A.setPushAudio(k):A.setEnableAudio(O):void 0!==R&&A.setUnmuteAudio(R)),e.pubAttributes=y,P={roomId:this._roomId,streamId:e.streamId,attributes:S},[4,null===(s=this._dataChannelSignal)||void 0===s?void 0:s.sendSignaling("updateStreamAttributes",P)]):[2];case 3:if(200!==(null==(D=U.sent())?void 0:D.code))throw new Vj(Nj.UPDATE_TRACK_FAILED,(null==D?void 0:D.message)||"update track failed");return gU?[4,null===(c=this._handler)||void 0===c?void 0:c.setCurrentDescription()]:[3,5];case 4:U.sent(),U.label=5;case 5:return[2]}}))}))},t.prototype.updateToken=function(e){var t,i,r;return tf(this,void 0,void 0,(function(){var n,o;return rf(this,(function(a){switch(a.label){case 0:if(bK.print("updateToken()","newToken: %o",e),this._token=e,!this._appId||!(null===(t=this._userInfo)||void 0===t?void 0:t.userId)||!this._roomId)return[2];n={roomId:this._roomId,userId:null===(i=this._userInfo)||void 0===i?void 0:i.userId,appId:this._appId,token:"Bearer ".concat(e)},a.label=1;case 1:return a.trys.push([1,3,,4]),[4,null===(r=this._dataChannelSignal)||void 0===r?void 0:r.sendSignaling("updateToken",n)];case 2:if(200!==(null==(o=a.sent())?void 0:o.code))throw new Vj(Nj.UPDATE_TOKEN_WITH_INVALID_TOKEN,"invoke updateToken with an invalid token");return[3,4];case 3:throw a.sent(),new Vj(Nj.UPDATE_TOKEN_WITH_INVALID_TOKEN,"invoke updateToken with an invalid token");case 4:return[2]}}))}))},t.prototype.unpublish=function(e){var t,i,r;return tf(this,void 0,void 0,(function(){var n;return rf(this,(function(o){switch(o.label){case 0:return bK.print("unpublish()","localStream: %o",e),n={roomId:this._roomId,initStreamId:e.initStreamId,streamId:e.streamId},null===(t=this._dataChannelSignal)||void 0===t||t.sendSignaling("unpublish",n),[4,null===(i=this._handler)||void 0===i?void 0:i.handleAck({action:tK.unpublish,audioMid:e.audioMid,videoMid:e.videoMid,stream:e,streamId:e.streamId})];case 1:return o.sent(),e.statsReport.unpublish(),[4,null===(r=this._handler)||void 0===r?void 0:r.rollback(e.stream.id,e)];case 2:return o.sent(),[2]}}))}))},t.prototype.subscribe=function(e,t,i){return tf(this,void 0,void 0,(function(){var r=this;return rf(this,(function(n){return[2,new Promise((function(n,o){return tf(r,void 0,void 0,(function(){var r,a,s,c,u,d,l,h,p,_,f,v,m,y,S,g,E,b,I,T,A,R,C,O,w,k,N,P,D,M,L,U,x,V=this;return rf(this,(function(F){switch(F.label){case 0:if(e.streamState===Yz.SUB_ED)return[2,this._updateSubTrack(e,t,Kz.SUB).then(n,o)];if(e.streamState===Yz.SUB_ING)return this._subStreamQueue[e.streamId]||(this._subStreamQueue[e.streamId]=[]),bK.print("_subStreamQueue","streamId: %o, enqueue",e.streamId),this._subStreamQueue[e.streamId].push({fn:this.subscribe,args:[e,t,i],resolve:n,reject:o}),[2];if(bK.print("subscribe()","mediaType: %o",t),AK("subscribe()",e),e.streamState=Yz.SUB_ING,r=!1,a=!1,VU(t)&&(a=!0),FU(t)&&(r=!0),!r&&this._multiChatMode())return e.streamState=Yz.INIT,this.emit("SUB_END",e.streamId),[2,n(null)];s=fU(),c=e.audioMid,u=e.videoMid,l=e.paused,h=e.subVideo,F.label=1;case 1:return F.trys.push([1,9,,11]),c&&u?[4,null===(R=this._handler)||void 0===R?void 0:R.subscribe(e,{audioMid:c,videoMid:u})]:[3,3];case 2:return d=F.sent(),[3,5];case 3:return[4,null===(C=this._handler)||void 0===C?void 0:C.subscribe(e)];case 4:if(!(d=F.sent()))throw new Vj(Nj.ADD_TRANSCEIVER_FAILED,"add transceiver failed");c=d.audioMid,u=d.videoMid,F.label=5;case 5:return e.paused=!r,e.subVideo=r,p={spatialLayer:(null==i?void 0:i.spatialLayer)||0,temporalLayer:0,spatialSubLayer:(null==i?void 0:i.spatialSubLayer)||-1},_={audio:!this._multiChatMode(),video:!0,data:!0,screen:e.isScreen,browser:"chrome-stable",videoMid:u,audioMid:c,sdpInfo:{sdp:null==d?void 0:d.partialSdp,semantics:null==d?void 0:d.semantics,type:null==d?void 0:d.type},streamUserId:e.userId,streamId:e.streamId,config:{enableMediaType:{audio:!!this._multiChatMode()||a,video:r},qualityLayer:p}},[4,null===(O=this._dataChannelSignal)||void 0===O?void 0:O.sendSignaling("subscribe",_)];case 6:if(200!==(null==(f=F.sent())?void 0:f.code))throw new Vj(Nj.SUBSCRIBE_FAILED,(null==f?void 0:f.message)||"subscribe failed");return v=[],m=!this._multiChatMode(),y=!e.videoTrack,this._subResolves[e.streamId]||(this._subResolves[e.streamId]=[]),y&&v.push(new Promise((function(t,i){V._subResolves[e.streamId].push(t);var r=setTimeout((function(){return i(new Vj(Nj.TIME_OUT,"wait video timeout for userId: ".concat(e.userId)))}),IK);e.on("ontrack",(function i(n){"video"===n.mediaType&&(bK.print("remoteStream ".concat(e.userId," received video track")),e.off("ontrack",i),clearTimeout(r),t(0))}))}))),m&&v.push(new Promise((function(t,i){V._subResolves[e.streamId].push(t);var r=setTimeout((function(){return i(new Vj(Nj.TIME_OUT,"wait audio timeout for userId: ".concat(e.userId)))}),IK);e.on("ontrack",(function i(n){"audio"===n.mediaType&&(bK.print("remoteStream ".concat(e.userId," received audio track")),e.off("ontrack",i),clearTimeout(r),t(0))}))}))),S=function(t){e.ontrack(t)},null===(w=this._handler)||void 0===w||w.on("ontrack",S),this._ontrackCallbackMap.set(e,S),g=null==f?void 0:f.relayMessage,E=g.audioMid,b=g.videoMid,(A={})[c]=E,A[u]=b,I=A,bK.print("sub midmap",e.userId,I),e.videoMid=b,e.audioMid=E,e._workaround_1_=!1,e.subMediaType=t,e.streamState=Yz.SUB_ED,e.subLayer=p,jB.rtcRecvAnswer(0,nB.INCRANSWER,(null===(k=null==f?void 0:f.relayMessage)||void 0===k?void 0:k.sequenceId)||0,null===(N=null==f?void 0:f.relayMessage)||void 0===N?void 0:N.sdp,oB.DOWN,e.streamId,e.userId),[4,null===(P=this._handler)||void 0===P?void 0:P.handleAck({action:tK.subscribe,streamId:e.streamId,audioMid:c,videoMid:u,transceiverInit:null==d?void 0:d.transceiverInit,signalingAck:{audioMid:null===(D=null==f?void 0:f.relayMessage)||void 0===D?void 0:D.audioMid,videoMid:null===(M=null==f?void 0:f.relayMessage)||void 0===M?void 0:M.videoMid,sdp:null===(L=null==f?void 0:f.relayMessage)||void 0===L?void 0:L.sdp,sequenceId:null===(U=null==f?void 0:f.relayMessage)||void 0===U?void 0:U.sequenceId},stream:e})];case 7:return F.sent(),[4,Promise.all(v)];case 8:return F.sent(),this._multiChatMode()||(e.subAudio=a),this.monitor.rtcSubscribeStat(uB.SUCCESS,s,dB.UNKNOWN,e.userId),e.statsReport.setRemoteStreamStatsEvtInterval(this,this._handler,this.monitor),n(null),this.emit("SUB_END",e.streamId),[3,11];case 9:return(T=F.sent())instanceof Error&&this.monitor.rtcSubscribeStat(uB.FAIL,s,T.message,e.userId),e.paused=l,e.subVideo=h,e.streamState=Yz.INIT,[4,null===(x=this._handler)||void 0===x?void 0:x.rollback(e.streamId,e)];case 10:return F.sent(),o(T),this.emit("SUB_END",e.streamId),[3,11];case 11:return[2]}}))}))}))]}))}))},t.prototype._handleSubStreamQueue=function(e){var t,i=this;if(null===(t=this._subStreamQueue[e])||void 0===t?void 0:t.length){bK.print("_subStreamQueue","streamId: %o, exec",e);var r=this._subStreamQueue[e].shift(),n=r.fn,o=r.args,a=r.resolve,s=r.reject;n.apply(this,o).then(a,s).finally((function(){return i._handleSubStreamQueue(e)}))}else bK.print("_subStreamQueue","streamId: %o, END",e)},t.prototype.controlMessage=function(e){var t;return tf(this,void 0,void 0,(function(){var i;return rf(this,(function(r){switch(r.label){case 0:return bK.print("controlMessage()","params: %o",e),i=e,"transcode"===e.type&&(i.roomId=this._roomId),[4,null===(t=this._dataChannelSignal)||void 0===t?void 0:t.sendSignaling("controlMessage",i)];case 1:return r.sent(),[2]}}))}))},t.prototype.updateUserAttributes=function(e){var t;return tf(this,void 0,void 0,(function(){return rf(this,(function(i){switch(i.label){case 0:return bK.print("updateUserAttributes()","attributes: %o",e),[4,null===(t=this._dataChannelSignal)||void 0===t?void 0:t.sendSignaling("updateUserAttributes",{roomId:this._roomId,sessionId:this._sessionId,attributes:e})];case 1:return i.sent(),[2]}}))}))},t.prototype.updateSubTrack=function(e,t,i,r){return tf(this,void 0,void 0,(function(){return rf(this,(function(r){return[2,this._updateSubTrack(e,t,i)]}))}))},t.prototype.updateSubTrackLayer=function(e,t){var i;return tf(this,void 0,void 0,(function(){var r,n,o;return rf(this,(function(a){switch(a.label){case 0:return bK.print("updateSubTrack()","subLayer: %o",t),r=t||e.subLayer,n={roomId:this._roomId,streamList:[e.streamId],config:{qualityLayer:r}},[4,null===(i=this._dataChannelSignal)||void 0===i?void 0:i.sendSignaling("updateSubscribe",n)];case 1:if(200!==(null==(o=a.sent())?void 0:o.code))throw new Vj(Nj.UPDATE_TRACK_FAILED,(null==o?void 0:o.message)||"update track failed");return e.subLayer=r,[2,e]}}))}))},t.prototype._updateSubTrack=function(e,t,i){var r,n,o;return tf(this,void 0,void 0,(function(){var a,s,c,u,d;return rf(this,(function(l){switch(l.label){case 0:return bK.print("updateSubTrack()","mediaType: %o",t),AK("updateSubTrack()",e),a=0,a=i===Kz.SUB?e.subMediaType|t:e.subMediaType-(e.subMediaType&t),bK.print("updateSubTrack","prev: %o, direction: %o, mediaType: %o, newMediaType: %o",e.subMediaType,i,t,a),e.subMediaType===a&&bK.print("updateSubTrack","mediaType no change"),s=!1,c=!1,VU(a)&&(c=!0),FU(a)&&(s=!0),u={roomId:this._roomId,streamList:[e.streamId],config:{enableMediaType:{video:s,audio:!!this._multiChatMode()||c}}},[4,null===(r=this._dataChannelSignal)||void 0===r?void 0:r.sendSignaling("updateSubscribe",u)];case 1:if(200!==(null==(d=l.sent())?void 0:d.code))throw new Vj(Nj.UPDATE_TRACK_FAILED,(null==d?void 0:d.message)||"update track failed");return e.paused=!s,this._multiChatMode()||(null===(n=e.observer)||void 0===n||n.setUnmuteAudio(c),e.subAudio=c),null===(o=e.observer)||void 0===o||o.setUnmuteVideo(s),e.subVideo=s,e.subMediaType=a,[2,e]}}))}))},t.prototype.subscribe4pushTrack=function(e,t){var i,r,n,o,a;return tf(this,void 0,void 0,(function(){var s,c,u,d,l,h,p,_,f,v,m,y=this;return rf(this,(function(S){switch(S.label){case 0:if(bK.print("subscribe4pushTrack()","streamInfo: %o",t),AK("subscribe4pushTrack()",e),s=null==t?void 0:t.message,c=s.audioMid,u=s.videoMid,d=s.sequenceId,e.subAudio=!0,d<e.sequenceId)return bK.print("subscribe4pushTrack","sequenceId return",d,e.sequenceId),[2];l=e.audioMid,h=e.videoMid,null===(i=e.observer)||void 0===i||i.setPushTrack(!0),S.label=1;case 1:return S.trys.push([1,8,,9]),l&&h?[4,null===(r=this._handler)||void 0===r?void 0:r.subscribe(e,{audioMid:l,videoMid:h})]:[3,3];case 2:return p=S.sent(),[3,5];case 3:return[4,null===(n=this._handler)||void 0===n?void 0:n.subscribe(e)];case 4:if(!(p=S.sent()))throw new Vj(Nj.ADD_TRANSCEIVER_FAILED,"add transceiver failed");l=p.audioMid,h=p.videoMid,S.label=5;case 5:return(m={})[l]=c,m[h]=u,_=m,bK.print("onpushtrack midmap",e.userId,_),e.audioMid=c,e.videoMid=u,e.sequenceId=d,this._subResolves[e.streamId]||(this._subResolves[e.streamId]=[]),f=[],e.audioTrack||f.push(new Promise((function(t,i){y._subResolves[e.streamId].push(t);var r=setTimeout((function(){return i(new Vj(Nj.TIME_OUT,"wait audio timeout for userId: ".concat(e.userId)))}),IK);e.on("ontrack",(function i(n){"audio"===n.mediaType&&(bK.print("remoteStream ".concat(e.userId," received audio track")),e.off("ontrack",i),clearTimeout(r),t(0))}))}))),v=function(t){e.ontrack(t)},null===(o=this._handler)||void 0===o||o.on("ontrack",v),this._ontrackCallbackMap.set(e,v),[4,null===(a=this._handler)||void 0===a?void 0:a.handleAck({action:tK.pushtrack,streamId:e.streamId,audioMid:l,videoMid:h,stream:e,transceiverInit:null==p?void 0:p.transceiverInit,signalingAck:null==t?void 0:t.message})];case 6:return S.sent(),[4,Promise.all(f)];case 7:return S.sent(),e.statsReport.setRemoteStreamStatsEvtInterval(this,this._handler,this.monitor),[2];case 8:throw S.sent();case 9:return[2]}}))}))},t.prototype.unsubscribe4removeTrack=function(e,t){var i,r,n;return tf(this,void 0,void 0,(function(){return rf(this,(function(o){switch(o.label){case 0:return AK("unsubscribe4removeTrack()",e),bK.print("unsubscribe4removeTrack()","sequenceId: ",t.sequenceId),t.sequenceId<e.sequenceId?(bK.print("unsubscribe4removeTrack()","sequenceId return"),[2]):(e.subAudio=!1,e.subVideo||e.paused?(e.sequenceId=t.sequenceId,[2]):(null===(i=e.observer)||void 0===i||i.setPushTrack(!1),[4,null===(r=this._handler)||void 0===r?void 0:r.handleAck({action:tK.removetrack,streamId:e.streamId,audioMid:e.audioMid,videoMid:e.videoMid,stream:e})]));case 1:return o.sent(),[4,null===(n=this._handler)||void 0===n?void 0:n.rollback(e.streamId,e)];case 2:return o.sent(),this._subResolves[e.streamId]&&this._subResolves[e.streamId].forEach((function(e){return e(0)})),bK.print("clean unsubscribe4removeTrack"),e.clean(),e.resetHasSubscribed(),e.statsReport.unsubscribe(),[2]}}))}))},t.prototype.unsubscribe=function(e,t,i){var r,n,o,a,s;return void 0===i&&(i=!1),tf(this,void 0,void 0,(function(){var c,u,d;return rf(this,(function(l){switch(l.label){case 0:return AK("unsubscribe()",e),c=e.subMediaType-(e.subMediaType&t),i||!this._subConfig.muteReplaceUnsub&&c===wz.NONE?(u={roomId:this._roomId,streamId:e.streamId,userId:e.userId},null===(r=this._dataChannelSignal)||void 0===r||r.sendSignaling("unsubscribe",u).catch((function(){})),e.streamState=Yz.INIT,this._subStreamQueue[e.streamId]&&(this._subStreamQueue[e.streamId].forEach((function(e){return(0,e.resolve)(null)})),delete this._subStreamQueue[e.streamId]),e.subVideo=!1,e.paused=!1,e._workaround_1_||(e.subAudio=!1),null===(n=e.observer)||void 0===n||n.setSubscribeVideo(!1),e.subAudio?[3,3]:(null===(o=e.observer)||void 0===o||o.setSubscribeAudio(!1),[4,null===(a=this._handler)||void 0===a?void 0:a.handleAck({action:tK.unsubscribe,streamId:e.streamId,audioMid:e.audioMid,videoMid:e.videoMid,stream:e})])):[2,this._updateSubTrack(e,t,Kz.UNSUB)];case 1:return d=l.sent(),[4,null===(s=this._handler)||void 0===s?void 0:s.rollback(e.streamId,e)];case 2:l.sent(),this._subResolves[d]&&this._subResolves[d].forEach((function(e){return e(0)})),bK.print("unsubscribe","clean unsub ".concat(e.userId)),e.clean(),this.removeOnTrackListener(e),e.statsReport.unsubscribe(),l.label=3;case 3:return[2]}}))}))},t.prototype.removeOnTrackListener=function(e){var t,i=this._ontrackCallbackMap.get(e);i&&(null===(t=this._handler)||void 0===t||t.off("ontrack",i),this._ontrackCallbackMap.delete(e))},t.prototype.handleRemoveStream=function(e,t){return tf(this,void 0,void 0,(function(){return rf(this,(function(i){return AK("handleRemoveStream()",e),e.subVideo=!1,t.message&&t.message!==_G.videoMuted?e._workaround_1_=!1:e._workaround_1_=!0,this._multiChatMode()&&e._workaround_1_?(this.unsubscribe(e,V_.AUDIO_AND_VIDEO,!0),[2]):[2]}))}))},t.prototype.leave=function(){var e;return tf(this,void 0,void 0,(function(){var t,i,r;return rf(this,(function(n){switch(n.label){case 0:return bK.print("leave()"),this.connectionState!==gK.CONNECTED?[3,7]:(this.connectionState=gK.DISCONNECTING,t={Authorization:this._authorization,roomId:this._roomId,sessionId:this._sessionId},[4,this._joinLeaveLock.lock()]);case 1:i=n.sent(),n.label=2;case 2:return n.trys.push([2,4,5,6]),[4,null===(e=this._dataChannelSignal)||void 0===e?void 0:e.sendSignaling("leaveRoom",t)];case 3:return n.sent(),this.connectionState=gK.DISCONNECTED,[3,6];case 4:throw r=n.sent(),this.connectionState=gK.CONNECTED,r;case 5:return i(),[7];case 6:return[3,8];case 7:return[2,Promise.reject(new Vj(Nj.NOT_CONNECTED_YET,"server not connected"))];case 8:return[2]}}))}))},t.prototype.subscribePublicStream=function(e){var t,i,r,n;return tf(this,void 0,void 0,(function(){var o,a,s,c,u,d,l,h,p,_,f,v,m,y,S,g=this;return rf(this,(function(E){switch(E.label){case 0:return[4,null===(t=this._handler)||void 0===t?void 0:t.subscribe(e)];case 1:if(!(o=E.sent()))throw new Vj(Nj.ADD_TRANSCEIVER_FAILED,"add transceiver failed");return a=fU(),s=o.audioMid,c=o.videoMid,y={appId:this._appId,streamId:e.streamId,audio:!0,video:!0,data:!0,audioMid:s,videoMid:c,sdpInfo:{sdp:null==o?void 0:o.partialSdp,semantics:null==o?void 0:o.semantics,type:null==o?void 0:o.type}},S={},[4,QG()];case 2:return y.params=(S.supportedCodecs=E.sent(),S.deviceType="web",S.userAgent=window.navigator.userAgent,S.sdkVersion=OF.VERSION,S.deviceId=IF.getDeviceId(),S.appId=this._appId,S.businessId=this._businessId,S.enableCloudProxy=this._useCloudProxy,S),y.config={enableMediaType:{audio:!0,video:!0},qualityLayer:{spatialLayer:0,temporalLayer:0}},u=y,[4,null===(i=this._dataChannelSignal)||void 0===i?void 0:i.sendSignaling("startPullStream",u)];case 3:return d=E.sent(),l=[],this._subResolves[e.streamId]=[],l.push(new Promise((function(t,i){g._subResolves[e.streamId].push(t);var r=setTimeout((function(){return i(new Vj(Nj.TIME_OUT,"wait video timeout for streamId: ".concat(e.streamId)))}),IK);e.on("ontrack",(function i(n){"video"===n.mediaType&&(bK.print("remoteStream ".concat(e.userId," received video track")),e.off("ontrack",i),clearTimeout(r),t(0))}))}))),l.push(new Promise((function(t,i){g._subResolves[e.streamId].push(t);var r=setTimeout((function(){return i(new Vj(Nj.TIME_OUT,"wait audio timeout for streamId: ".concat(e.streamId)))}),IK);e.on("ontrack",(function i(n){"audio"===n.mediaType&&(bK.print("remoteStream ".concat(e.userId," received audio track")),e.off("ontrack",i),clearTimeout(r),t(0))}))}))),h=function(t){e.ontrack(t)},null===(r=this._handler)||void 0===r||r.on("ontrack",h),this._ontrackCallbackMap.set(e,h),p=null==d?void 0:d.relayMessage,_=p.audioMid,f=p.videoMid,v=p.sequenceId,m=p.sdp,e.videoMid=f,e.audioMid=_,e.sequenceId=v,e._workaround_1_=!1,e.paused=!1,e.streamState=Yz.SUB_ED,e.subAudio=!0,e.subVideo=!0,[4,null===(n=this._handler)||void 0===n?void 0:n.handleAck({action:tK.subscribe,streamId:e.streamId,audioMid:s,videoMid:c,transceiverInit:null==o?void 0:o.transceiverInit,signalingAck:{audioMid:_,videoMid:f,sdp:m,sequenceId:v},stream:e})];case 4:return E.sent(),[4,Promise.all(l)];case 5:return E.sent(),this.monitor.rtcSubscribeStat(uB.SUCCESS,a,dB.UNKNOWN,e.userId),e.statsReport.setRemoteStreamStatsEvtInterval(this,this._handler,this.monitor),[2]}}))}))},t.prototype.unsubscribePublicStream=function(e){var t,i,r;return tf(this,void 0,void 0,(function(){var n;return rf(this,(function(o){switch(o.label){case 0:AK("unsubscribePublicStream()",e),n={appId:this._appId,streamId:e.streamId},o.label=1;case 1:return o.trys.push([1,3,,4]),[4,null===(t=this._dataChannelSignal)||void 0===t?void 0:t.sendSignaling("stopPullStream",n)];case 2:case 3:return o.sent(),[3,4];case 4:return e.streamState=Yz.INIT,e.subVideo=!1,e.subAudio=!1,[4,null===(i=this._handler)||void 0===i?void 0:i.handleAck({action:tK.unsubscribe,streamId:e.streamId,audioMid:e.audioMid,videoMid:e.videoMid,stream:e})];case 5:return o.sent(),[4,null===(r=this._handler)||void 0===r?void 0:r.rollback(e.streamId,e)];case 6:return o.sent(),e.clean(),this.removeOnTrackListener(e),e.statsReport.unsubscribe(),[2]}}))}))},t.prototype.destroy=function(){var e,t,i;bK.print("destroy()"),this._token=void 0,this._appId=void 0,this._roomId=void 0,this._clientId=void 0,this._authorization=void 0,this._sessionId=void 0,this._context=void 0,null===(e=this._handler)||void 0===e||e.destroy(),null===(t=this._dataChannelSignal)||void 0===t||t.destroy(),null===(i=this._iceConfigRequestManager)||void 0===i||i.abort(),this._handler=void 0,this._dataChannelSignal=void 0,this._iceConfigRequestManager=void 0,this._removeSignalEventHandler(),this.connectionState=gK.DISCONNECTED,this.emit("INTERRUPT")},t.prototype.sendUserMessage=function(e,t){var i;return null===(i=this._dataChannelSignal)||void 0===i?void 0:i.sendP2PMessage({to:e,from:this._userInfo.userId,room:this._roomId,app:this._appId,msg:t})},t.prototype.sendRoomMessage=function(e){var t;return null===(t=this._dataChannelSignal)||void 0===t?void 0:t.sendSignaling("customMessage",e)},t.prototype._multiChatMode=function(){var e;return null===(e=this._roomAttributes)||void 0===e?void 0:e.multiChatMode},Object.defineProperty(t.prototype,"handler",{get:function(){return this._handler},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"roomAttributes",{get:function(){return this._roomAttributes},set:function(e){this._roomAttributes=e},enumerable:!1,configurable:!0}),ef([wK],t.prototype,"join",null),ef([OK,CK],t.prototype,"publish",null),ef([OK,CK],t.prototype,"updatePubTrack",null),ef([OK,CK],t.prototype,"unpublish",null),ef([OK,CK],t.prototype,"subscribe",null),ef([CK],t.prototype,"controlMessage",null),ef([CK],t.prototype,"updateUserAttributes",null),ef([CK],t.prototype,"updateSubTrack",null),ef([CK],t.prototype,"updateSubTrackLayer",null),ef([CK],t.prototype,"subscribe4pushTrack",null),ef([CK],t.prototype,"unsubscribe4removeTrack",null),ef([OK,CK],t.prototype,"unsubscribe",null),ef([CK],t.prototype,"handleRemoveStream",null),ef([OK],t.prototype,"subscribePublicStream",null),ef([OK],t.prototype,"unsubscribePublicStream",null),t}(VB);function CK(e,t,i){var r=i.value;return i.value=function(){for(var e=[],i=0;i<arguments.length;i++)e[i]=arguments[i];return tf(this,void 0,void 0,(function(){return rf(this,(function(i){switch(i.label){case 0:return this._handler&&this._state===gK.CONNECTED?[4,r.apply(this,e)]:[3,2];case 1:return i.sent(),[3,3];case 2:throw new Vj(Nj.NOT_CONNECTED_YET,"error in ".concat(t,": try again after joined"));case 3:return[2]}}))}))},i}function OK(e,t,i){var r=i.value;return i.value=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return tf(this,void 0,void 0,(function(){var t;return rf(this,(function(i){switch(i.label){case 0:return[4,this._pubSubLock.lock()];case 1:t=i.sent(),this.supportConcurrent&&t(),i.label=2;case 2:return i.trys.push([2,,4,5]),[4,r.apply(this,e)];case 3:return[2,i.sent()];case 4:return this.supportConcurrent||t(),[7];case 5:return[2]}}))}))},i}function wK(e,t,i){var r=i.value;return i.value=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return tf(this,void 0,void 0,(function(){var t,i=this;return rf(this,(function(n){return t=!1,[2,new Promise((function(n,o){return tf(i,void 0,void 0,(function(){var i,a;return rf(this,(function(s){switch(s.label){case 0:this.on("INTERRUPT",(function(){t=!0,o(new Vj(Nj.OPERATION_CANCEL,"operation not finish when leave"))})),s.label=1;case 1:return s.trys.push([1,3,,4]),[4,r.apply(this,e)];case 2:return i=s.sent(),n(i),[3,4];case 3:return a=s.sent(),t||o(a),[3,4];case 4:return[2]}}))}))}))]}))}))},i}!function(e){e[e.INITIAL=0]="INITIAL",e[e.BEGIN=1]="BEGIN",e[e.STOPPED=2]="STOPPED",e[e.RECEIVED=3]="RECEIVED"}(TK||(TK={}));var kK,NK=function(){function e(e,t){this._audioEventSessionId=PU(),this._videoEventSessionId=PU(),this._isScreen=!1,this._audioFirstFrameState=TK.INITIAL,this._videoFirstFrameState=TK.INITIAL,this._timeout=1e4,this._currentAudioRecv={startTime:0,eventSessionId:0,type:_B.LOGIN},this._currentVideoRecv={startTime:0,eventSessionId:0,type:_B.LOGIN},this._login=!1,this._unMuteAudio=!1,this._enableAudio=!1,this._unMuteVideo=!1,this._enableVideo=!1,this._remoteUnmuteAudio=!1,this._remoteUnmuteVideo=!1,this._audioExternal=!1,this._pushAudio=!1,this._videoExternal=!1,this._pushVideo=!1,this._autoSubscribeVideo=!1,this._autoSubscribeAudio=!1,this._autoSubscribe=!1,this._publishVideo=!1,this._publishAudio=!1,this._subscribeAudio=!1,this._subscribeVideo=!1,this._subscribe=!1,this._pushTrack=!1,this._multiChatMode=!1,this._stream=e,this._handler=t,this.getTransportDelay()}return e.prototype.beginRecvFrame=function(e,t){var i,r,n,o,a;return tf(this,void 0,void 0,(function(){var s,c,u,d,l,h,p,_=this;return rf(this,(function(f){switch(f.label){case 0:return[4,this.getTransportDelay()];case 1:return f.sent(),s=this._transportDelay,c=!0,u=_B.LOGIN,d=_B.UNMUTE,l=_B.SUBSCRIBE,h=_B.PUSH_TRACK,[u,d,l,h].indexOf(t)>=0&&(s=0,c=!1),e===pB.AUDIO?(c||this._audioEventSessionId++,this._currentAudioRecv={startTime:Date.now(),eventSessionId:this._audioEventSessionId,type:t},p={media_type:e,event_type:hB.BEGIN_RECV,type:t,start:null===(i=this._currentAudioRecv)||void 0===i?void 0:i.startTime,event_session_id:this._audioEventSessionId,stream_user_id:null===(r=this._stream)||void 0===r?void 0:r.userId,transport_delay:s},this._firstAudioFrameTimer&&window.clearTimeout(this._firstAudioFrameTimer),this._firstAudioFrameTimer=window.setTimeout((function(){_.stopRecvFrame(pB.AUDIO,fB.TIMEOUT),_._firstAudioFrameInterval&&window.clearInterval(_._firstAudioFrameInterval)}),this._timeout),jB.rtcFirstFrame(p),this._watchForFirstAudioFrameRecv(),this._audioFirstFrameState=TK.BEGIN,this._login=!0,this._unMuteAudio=!0,this._enableAudio=!0,this._remoteUnmuteAudio=!0):e===pB.VIDEO&&(c||this._videoEventSessionId++,this._currentVideoRecv={startTime:Date.now(),eventSessionId:this._videoEventSessionId,type:t},p={media_type:(null===(n=this._stream)||void 0===n?void 0:n.isScreen)?pB.SCREEN_VIDEO:e,event_type:hB.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(){_.stopRecvFrame(pB.VIDEO,fB.TIMEOUT),_._firstVideoFrameInterval&&window.clearInterval(_._firstVideoFrameInterval)}),this._timeout),this._watchForFirstVideoFrameRecv(),jB.rtcFirstFrame(p),this._videoFirstFrameState=TK.BEGIN,this._login=!0,this._unMuteVideo=!0,this._enableVideo=!0,this._remoteUnmuteVideo=!0),[2]}}))}))},e.prototype.stopRecvFrame=function(e,t){var i,r,n,o,a,s,c;if(e===pB.AUDIO){if(this._audioFirstFrameState!==TK.BEGIN)return;var u={event_type:hB.RECV_END,media_type:e,start:null===(i=this._currentAudioRecv)||void 0===i?void 0:i.startTime,reason:t,result:!1,stream_user_id:null===(r=this._stream)||void 0===r?void 0:r.userId,event_session_id:this._audioEventSessionId,type:null===(n=this._currentAudioRecv)||void 0===n?void 0:n.type};this._firstAudioFrameTimer&&window.clearTimeout(this._firstAudioFrameTimer),delete this._currentAudioRecv,jB.rtcFirstFrame(u),this._audioFirstFrameState=TK.STOPPED}else if(e===pB.VIDEO){if(this._videoFirstFrameState!==TK.BEGIN)return;u={event_type:hB.RECV_END,media_type:(null===(o=this._stream)||void 0===o?void 0:o.isScreen)?pB.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,jB.rtcFirstFrame(u),this._videoFirstFrameState=TK.STOPPED}},e.prototype.recvFrameFinish=function(e){var t,i,r;return tf(this,void 0,void 0,(function(){var n,o,a,s,c,u,d,l,h,p;return rf(this,(function(_){switch(_.label){case 0:return[4,this.getTransportDelay()];case 1:if(_.sent(),n=this._transportDelay,o=_B.LOGIN,a=_B.UNMUTE,s=_B.SUBSCRIBE,c=_B.PUSH_TRACK,e===pB.AUDIO){if(this._audioFirstFrameState!==TK.BEGIN)return[2];if(!this._currentAudioRecv)return[2];u=this._currentAudioRecv,l=u.type,h=u.startTime,[o,a,s,c].indexOf(l)>=0&&(n=0),p={event_type:hB.RECV_END,media_type:e,start:h,result:!0,stream_user_id:null===(t=this._stream)||void 0===t?void 0:t.userId,event_session_id:this._audioEventSessionId,type:l,transport_delay:n},delete this._currentAudioRecv,this._firstAudioFrameTimer&&window.clearTimeout(this._firstAudioFrameTimer),jB.rtcFirstFrame(p),this._audioFirstFrameState=TK.RECEIVED}else if(e===pB.VIDEO){if(this._videoFirstFrameState!==TK.BEGIN)return[2];if(!this._currentVideoRecv)return[2];d=this._currentVideoRecv,l=d.type,h=d.startTime,[o,a,s,c].indexOf(l)>=0&&(n=0),p={event_type:hB.RECV_END,media_type:(null===(i=this._stream)||void 0===i?void 0:i.isScreen)?pB.SCREEN_VIDEO:e,start:h,result:!0,stream_user_id:null===(r=this._stream)||void 0===r?void 0:r.userId,event_session_id:this._videoEventSessionId,type:l,transport_delay:n},delete this._currentVideoRecv,this._firstVideoFrameTimer&&window.clearTimeout(this._firstVideoFrameTimer),jB.rtcFirstFrame(p),this._videoFirstFrameState=TK.RECEIVED}return[2]}}))}))},e.prototype.setLogin=function(e,t){var i,r,n,o;void 0===t&&(t={audio:!0,video:!0}),this._login!==e&&(this._login=e,e&&(null===(i=this._stream)||void 0===i?void 0:i.hasAudio)&&t.audio&&this.beginRecvFrame(pB.AUDIO,_B.LOGIN),e&&(null===(r=this._stream)||void 0===r?void 0:r.hasVideo)&&t.video&&this.beginRecvFrame(pB.VIDEO,_B.LOGIN),!e&&(null===(n=this._stream)||void 0===n?void 0:n.hasAudio)&&this.stopRecvFrame(pB.AUDIO,fB.LEAVE_ROOM),!e&&(null===(o=this._stream)||void 0===o?void 0:o.hasVideo)&&this.stopRecvFrame(pB.VIDEO,fB.LEAVE_ROOM))},e.prototype.setUnmuteAudio=function(e){var t;this._unMuteAudio!==e&&(this._unMuteAudio=e,this._unMuteAudio?this.beginRecvFrame(pB.AUDIO,_B.UNMUTE):(null===(t=this._stream)||void 0===t?void 0:t.hasAudio)&&this.stopRecvFrame(pB.AUDIO,fB.MUTE))},e.prototype.setRemoteUnmuteAudio=function(e){var t;this._remoteUnmuteAudio!==e&&(this._remoteUnmuteAudio=e,this._remoteUnmuteAudio?this.beginRecvFrame(pB.AUDIO,_B.REMOTE_UNMUTE):(null===(t=this._stream)||void 0===t?void 0:t.hasAudio)&&this.stopRecvFrame(pB.AUDIO,fB.REMOTE_MUTE))},e.prototype.setEnableAudio=function(e){var t;this._enableAudio!==e&&(this._enableAudio=e,this._enableAudio?this.beginRecvFrame(pB.AUDIO,_B.ENABLE):(null===(t=this._stream)||void 0===t?void 0:t.hasAudio)&&this.stopRecvFrame(pB.AUDIO,fB.DISABLE))},e.prototype.setUnmuteVideo=function(e){var t;this._unMuteVideo!==e&&(this._unMuteVideo=e,this._unMuteVideo?this.beginRecvFrame(pB.VIDEO,_B.UNMUTE):(null===(t=this._stream)||void 0===t?void 0:t.hasVideo)&&this.stopRecvFrame(pB.VIDEO,fB.MUTE))},e.prototype.setRemoteUnmuteVideo=function(e){var t;this._remoteUnmuteVideo!==e&&(this._remoteUnmuteVideo=e,this._remoteUnmuteVideo?this.beginRecvFrame(pB.VIDEO,_B.REMOTE_UNMUTE):(null===(t=this._stream)||void 0===t?void 0:t.hasAudio)&&this.stopRecvFrame(pB.VIDEO,fB.REMOTE_MUTE))},e.prototype.setEnableVideo=function(e){this._enableVideo!==e&&(this._enableVideo=e,this._enableVideo?this.beginRecvFrame(pB.VIDEO,_B.ENABLE):this.stopRecvFrame(pB.VIDEO,fB.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(pB.AUDIO,_B.PUSH),!e&&(null===(t=this._stream)||void 0===t?void 0:t.hasAudio)&&this.beginRecvFrame(pB.AUDIO,_B.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(pB.VIDEO,_B.PUSH),!e&&(null===(t=this._stream)||void 0===t?void 0:t.hasVideo)&&this.beginRecvFrame(pB.VIDEO,_B.PUSH)},e.prototype.setPublishVideo=function(e){var t;this._publishVideo!==e&&(this._publishVideo=e),this._publishVideo&&this.beginRecvFrame(pB.VIDEO,_B.PUBLISH),!e&&(null===(t=this._stream)||void 0===t?void 0:t.hasVideo)&&this.stopRecvFrame(pB.VIDEO,fB.UNPUBLISH)},e.prototype.setPublishAudio=function(e){var t;this._publishAudio!==e&&(this._publishAudio=e),this._publishAudio&&this.beginRecvFrame(pB.AUDIO,_B.PUBLISH),!e&&(null===(t=this._stream)||void 0===t?void 0:t.hasAudio)&&this.stopRecvFrame(pB.AUDIO,fB.UNPUBLISH)},e.prototype.setAutoSubscribe=function(e){this._autoSubscribe=e},e.prototype.setAutoSubscribeVideo=function(e){this._autoSubscribeVideo=e},e.prototype.setAutoSubscribeAudio=function(e){this._autoSubscribeAudio=e},e.prototype.setSubscribeAudio=function(e){var t,i;this._autoSubscribeAudio||this._subscribeAudio===e||(this._subscribe=e,e&&(null===(t=this._stream)||void 0===t?void 0:t.hasAudio)&&this.beginRecvFrame(pB.AUDIO,_B.SUBSCRIBE)),!e&&(null===(i=this._stream)||void 0===i?void 0:i.hasAudio)&&this.stopRecvFrame(pB.AUDIO,fB.UNSUBSCRIBE)},e.prototype.setSubscribeVideo=function(e){var t,i;this._autoSubscribeVideo||this._subscribeVideo===e||(this._subscribeVideo=e,e&&(null===(t=this._stream)||void 0===t?void 0:t.hasVideo)&&this.beginRecvFrame(pB.VIDEO,_B.SUBSCRIBE)),!e&&(null===(i=this._stream)||void 0===i?void 0:i.hasVideo)&&this.stopRecvFrame(pB.VIDEO,fB.UNSUBSCRIBE)},e.prototype.setPushTrack=function(e){var t;this._pushTrack!==e&&(e&&!this._isScreen&&this.beginRecvFrame(pB.AUDIO,_B.PUSH_TRACK),!e&&(null===(t=this._stream)||void 0===t?void 0:t.hasAudio)&&this.stopRecvFrame(pB.AUDIO,fB.REMOVE_TRACK))},e.prototype.setMultiChatMode=function(e){this._multiChatMode=e},e.prototype.setTimeout=function(e){this._timeout=e},e.prototype._watchForFirstVideoFrameRecv=function(){var e=this,t=-1;this._firstVideoFrameInterval&&window.clearInterval(this._firstVideoFrameInterval),this._firstVideoFrameInterval=window.setInterval((function(){return tf(e,void 0,void 0,(function(){var e,i,r,n,o,a,s,c;return rf(this,(function(u){switch(u.label){case 0:return(null===(r=this._handler)||void 0===r?void 0:r.pc)&&(null===(o=null===(n=this._stream)||void 0===n?void 0:n.videoTrack)||void 0===o?void 0:o.getTrack())?[4,qG(null===(a=this._handler)||void 0===a?void 0:a.pc,null===(c=null===(s=this._stream)||void 0===s?void 0:s.videoTrack)||void 0===c?void 0:c.getTrack())]:[3,2];case 1:if(e=u.sent(),(i=e.find((function(e){return"inbound-rtp"===e.type})))&&i.framesReceived>t){if(-1===t)return t=i.framesReceived,[2];this.recvFrameFinish(pB.VIDEO),window.clearInterval(this._firstVideoFrameInterval)}u.label=2;case 2:return[2]}}))}))}),200)},e.prototype._watchForFirstAudioFrameRecv=function(){var e=this,t=-1;this._firstAudioFrameInterval&&window.clearInterval(this._firstAudioFrameInterval),this._firstAudioFrameInterval=window.setInterval((function(){return tf(e,void 0,void 0,(function(){var e,i,r,n,o,a,s,c;return rf(this,(function(u){switch(u.label){case 0:return(null===(r=this._handler)||void 0===r?void 0:r.pc)&&(null===(o=null===(n=this._stream)||void 0===n?void 0:n.audioTrack)||void 0===o?void 0:o.getTrack())?[4,qG(null===(a=this._handler)||void 0===a?void 0:a.pc,null===(c=null===(s=this._stream)||void 0===s?void 0:s.audioTrack)||void 0===c?void 0:c.getTrack())]:[3,2];case 1:if(e=u.sent(),(i=e.find((function(e){return"inbound-rtp"===e.type})))&&i.totalSamplesReceived>t){if(-1===t)return t=i.totalSamplesReceived,[2];this.recvFrameFinish(pB.AUDIO),window.clearInterval(this._firstAudioFrameInterval)}u.label=2;case 2:return[2]}}))}))}),200)},e.prototype.getTransportDelay=function(){return tf(this,void 0,void 0,(function(){var e=this;return rf(this,(function(t){switch(t.label){case 0:return[4,this.getTransportDelayIntl()];case 1:return t.sent(),window.clearInterval(this._transportDelayInterval),this._transportDelayInterval=window.setInterval((function(){return tf(e,void 0,void 0,(function(){return rf(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 tf(this,void 0,void 0,(function(){var i,r,n;return rf(this,(function(o){switch(o.label){case 0:return(null===(e=this._handler)||void 0===e?void 0:e.pc)?[4,qG(null===(t=this._handler)||void 0===t?void 0:t.pc)]:[3,2];case 1:i=o.sent(),r=i.find((function(e){return"transport"===e.type&&"connected"===e.dtlsState})),(n=i.find((function(e){return"candidate-pair"===e.type&&"succeeded"===e.state&&e.id===(null==r?void 0:r.selectedCandidatePairId)})))&&(this._transportDelay=Math.round(1e3*n.currentRoundTripTime/2)),o.label=2;case 2:return[2]}}))}))},e.prototype.reset=function(){this._currentAudioRecv={startTime:0,eventSessionId:0,type:_B.LOGIN},this._currentVideoRecv={startTime:0,eventSessionId:0,type:_B.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"}(kK||(kK={}));var PK,DK,MK,LK,UK=function(){function e(e,t){this._audioEventSessionId=PU(),this._videoEventSessionId=PU(),this._currentAudioSend={startTime:0,eventSessionId:0,type:_B.LOGIN},this._currentVideoSend={startTime:0,eventSessionId:0,type:_B.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=kK.INITIAL,this._videoFirstFrameState=kK.INITIAL,this._stream=e,this._handler=t}return e.prototype.beginSendFrame=function(e,t){var i,r,n,o=this;if(e===pB.AUDIO){this._audioEventSessionId++,this._currentAudioSend={startTime:Date.now(),eventSessionId:this._audioEventSessionId,type:t};var a={media_type:e,event_type:hB.BEGIN_SEND,type:t,start:null===(i=this._currentAudioSend)||void 0===i?void 0:i.startTime,event_session_id:this._audioEventSessionId};this._firstAudioFrameTimer&&window.clearTimeout(this._firstAudioFrameTimer),this._firstAudioFrameTimer=window.setTimeout((function(){o.stopSendFrame(pB.AUDIO,fB.TIMEOUT),o._firstAudioFrameInterval&&window.clearInterval(o._firstAudioFrameInterval)}),this._timeout),jB.rtcFirstFrame(a),this._watchForFirstAudioFrameSend(),this._audioFirstFrameState=kK.BEGIN,this._login=!0,this._publisher=!0,this._publish=!0,this._unMuteAudio=!0,this._pushAudio||(this._enableAudio=!0)}else if(e===pB.VIDEO){this._videoEventSessionId++,this._currentVideoSend={startTime:Date.now(),eventSessionId:this._videoEventSessionId,type:t};a={media_type:(null===(r=this._stream)||void 0===r?void 0:r.isScreen)?pB.SCREEN_VIDEO:e,event_type:hB.BEGIN_SEND,type:t,start:null===(n=this._currentVideoSend)||void 0===n?void 0:n.startTime,event_session_id:this._videoEventSessionId};this._firstVideoFrameTimer&&window.clearTimeout(this._firstVideoFrameTimer),this._firstVideoFrameTimer=window.setTimeout((function(){o.stopSendFrame(pB.VIDEO,fB.TIMEOUT),o._firstVideoFrameInterval&&window.clearInterval(o._firstVideoFrameInterval)}),this._timeout),this._watchForFirstVideoFrameSend(),jB.rtcFirstFrame(a),this._videoFirstFrameState=kK.BEGIN,this._login=!0,this._publisher=!0,this._publish=!0,this._unMuteVideo=!0,this._pushVideo||(this._enableVideo=!0)}},e.prototype.stopSendFrame=function(e,t){var i,r,n,o,a;if(e===pB.AUDIO){if(this._audioFirstFrameState!==kK.BEGIN)return;var s={event_type:hB.SENT_END,media_type:e,start:null===(i=this._currentAudioSend)||void 0===i?void 0:i.startTime,reason:t,result:!1,event_session_id:this._audioEventSessionId,type:null===(r=this._currentAudioSend)||void 0===r?void 0:r.type};this._firstAudioFrameTimer&&window.clearTimeout(this._firstAudioFrameTimer),delete this._currentAudioSend,jB.rtcFirstFrame(s),this._audioFirstFrameState=kK.STOPPED}else if(e===pB.VIDEO){if(this._videoFirstFrameState!==kK.BEGIN)return;s={event_type:hB.SENT_END,media_type:(null===(n=this._stream)||void 0===n?void 0:n.isScreen)?pB.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,jB.rtcFirstFrame(s),this._videoFirstFrameState=kK.STOPPED}},e.prototype.sendFrameFinish=function(e){var t;if(e===pB.AUDIO){if(this._audioFirstFrameState!==kK.BEGIN)return;if(!this._currentAudioSend)return;var i=this._currentAudioSend,r=i.type,n=i.startTime,o={event_type:hB.SENT_END,media_type:e,start:n,result:!0,event_session_id:this._audioEventSessionId,type:r};delete this._currentAudioSend,this._firstAudioFrameTimer&&window.clearTimeout(this._firstAudioFrameTimer),jB.rtcFirstFrame(o),this._audioFirstFrameState=kK.SENT}else if(e===pB.VIDEO){if(this._videoFirstFrameState!==kK.BEGIN)return;if(!this._currentVideoSend)return;var a=this._currentVideoSend;r=a.type,n=a.startTime,o={event_type:hB.SENT_END,media_type:(null===(t=this._stream)||void 0===t?void 0:t.isScreen)?pB.SCREEN_VIDEO:e,start:n,result:!0,event_session_id:this._videoEventSessionId,type:r};delete this._currentVideoSend,this._firstVideoFrameTimer&&window.clearTimeout(this._firstVideoFrameTimer),jB.rtcFirstFrame(o),this._videoFirstFrameState=kK.SENT}},e.prototype.setLogin=function(e){var t,i;this._login!==e&&(this._login=e,e&&((null===(t=this._stream)||void 0===t?void 0:t.videoTrack)&&this.beginSendFrame(pB.VIDEO,_B.LOGIN),(null===(i=this._stream)||void 0===i?void 0:i.audioTrack)&&this.beginSendFrame(pB.AUDIO,_B.LOGIN)),!e&&this._audioSending&&this.stopSendFrame(pB.AUDIO,fB.LEAVE_ROOM),!e&&this._videoSending&&this.stopSendFrame(pB.VIDEO,fB.LEAVE_ROOM))},e.prototype.setPublish=function(e){var t,i;this._publish!==e&&(this._publish=e,e&&((null===(t=this._stream)||void 0===t?void 0:t.videoTrack)&&this.beginSendFrame(pB.VIDEO,_B.PUBLISH),(null===(i=this._stream)||void 0===i?void 0:i.audioTrack)&&this.beginSendFrame(pB.AUDIO,_B.PUBLISH)),!e&&this._audioSending&&this.stopSendFrame(pB.AUDIO,fB.UNPUBLISH),!e&&this._videoSending&&this.stopSendFrame(pB.VIDEO,fB.UNPUBLISH))},e.prototype.setUnmuteAudio=function(e){this._unMuteAudio!==e&&(this._unMuteAudio=e,e&&this.beginSendFrame(pB.AUDIO,_B.UNMUTE),!e&&this._audioSending&&this.stopSendFrame(pB.AUDIO,fB.MUTE))},e.prototype.setEnableAudio=function(e){this._enableAudio!==e&&(this._enableAudio=e,e&&this.beginSendFrame(pB.AUDIO,_B.ENABLE),!e&&this._audioSending&&this.stopSendFrame(pB.AUDIO,fB.DISABLE))},e.prototype.setUnmuteVideo=function(e){this._unMuteVideo!==e&&(this._unMuteVideo=e,e&&this.beginSendFrame(pB.VIDEO,_B.UNMUTE),!e&&this._videoSending&&this.stopSendFrame(pB.VIDEO,fB.MUTE))},e.prototype.setEnableVideo=function(e){this._enableVideo!==e&&(this._enableVideo=e,e&&this.beginSendFrame(pB.VIDEO,_B.ENABLE),!e&&this._videoSending&&this.stopSendFrame(pB.VIDEO,fB.DISABLE))},e.prototype.setExternalAudioSource=function(e){this._audioExternal!==e&&(this._audioExternal=e,e&&(this._audioSending&&this.stopSendFrame(pB.AUDIO,fB.DISABLE),this._enableAudio=!1),e||(this._audioSending&&this.stopSendFrame(pB.AUDIO,fB.STOP_PUSH),this._pushAudio=!1))},e.prototype.setPushAudio=function(e){this._pushAudio!==e&&(this._pushAudio=e,e&&this.beginSendFrame(pB.AUDIO,_B.PUSH),!e&&this._audioSending&&this.stopSendFrame(pB.AUDIO,fB.STOP_PUSH))},e.prototype.setExternalVideoSource=function(e){this._videoExternal!==e&&(this._videoExternal=e,e&&(this._videoSending&&this.stopSendFrame(pB.VIDEO,fB.DISABLE),this._enableVideo=!1),e||(this._videoSending&&this.stopSendFrame(pB.VIDEO,fB.STOP_PUSH),this._pushVideo=!1))},e.prototype.setPushVideo=function(e){this._pushVideo!==e&&(this._pushVideo=e,e&&this.beginSendFrame(pB.VIDEO,_B.PUSH),!e&&this._videoSending&&this.stopSendFrame(pB.VIDEO,fB.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(pB.AUDIO,fB.AUDIENCE),!e&&this._videoSending&&this.stopSendFrame(pB.VIDEO,fB.AUDIENCE))},e.prototype.setTimeout=function(e){this._timeout=e},e.prototype.setPCSessionId=function(e){this._pcSessionId=e},e.prototype.setHandler=function(e){this._handler=e},e.prototype._getFirstVideoFrameStats=function(){var e,t,i,r,n,o;return tf(this,void 0,void 0,(function(){var a;return rf(this,(function(s){switch(s.label){case 0:return(null===(e=this._handler)||void 0===e?void 0:e.pc)&&(null===(i=null===(t=this._stream)||void 0===t?void 0:t.videoTrack)||void 0===i?void 0:i.getTrack())?[4,qG(null===(r=this._handler)||void 0===r?void 0:r.pc,null===(o=null===(n=this._stream)||void 0===n?void 0:n.videoTrack)||void 0===o?void 0:o.getTrack())]:[3,2];case 1:return a=s.sent(),[2,a.find((function(e){return"outbound-rtp"===e.type}))];case 2:return[2]}}))}))},e.prototype._getFirstAudioFrameStats=function(){var e,t,i,r,n,o;return tf(this,void 0,void 0,(function(){var a;return rf(this,(function(s){switch(s.label){case 0:return(null===(e=this._handler)||void 0===e?void 0:e.pc)&&(null===(i=null===(t=this._stream)||void 0===t?void 0:t.audioTrack)||void 0===i?void 0:i.getTrack())?[4,qG(null===(r=this._handler)||void 0===r?void 0:r.pc,null===(o=null===(n=this._stream)||void 0===n?void 0:n.audioTrack)||void 0===o?void 0:o.getTrack())]:[3,2];case 1:return a=s.sent(),[2,a.find((function(e){return"outbound-rtp"===e.type}))];case 2:return[2]}}))}))},e.prototype._watchForFirstVideoFrameSend=function(){var e=this,t=-1;this._firstVideoFrameInterval&&window.clearInterval(this._firstVideoFrameInterval),this._firstVideoFrameInterval=window.setInterval((function(){return tf(e,void 0,void 0,(function(){var e;return rf(this,(function(i){switch(i.label){case 0:return[4,this._getFirstVideoFrameStats()];case 1:if((e=i.sent())&&e.framesSent>t){if(-1===t)return t=e.framesSent,[2];this.sendFrameFinish(pB.VIDEO),window.clearInterval(this._firstVideoFrameInterval)}return[2]}}))}))}),100)},e.prototype._watchForFirstAudioFrameSend=function(){var e=this,t=-1;this._firstAudioFrameInterval&&window.clearInterval(this._firstAudioFrameInterval),this._firstAudioFrameInterval=window.setInterval((function(){return tf(e,void 0,void 0,(function(){var e;return rf(this,(function(i){switch(i.label){case 0:return[4,this._getFirstAudioFrameStats()];case 1:if((e=i.sent())&&e.packetsSent>t){if(-1===t)return t=e.packetsSent,[2];this.sendFrameFinish(pB.AUDIO),window.clearInterval(this._firstAudioFrameInterval)}return[2]}}))}))}),100)},e.prototype.reset=function(){this._login=!1,this._publisher=!1,this._unMuteAudio=!1,this._enableAudio=!1,this._unMuteVideo=!1,this._enableVideo=!1,this._audioExternal=!1,this._pushAudio=!1,this._videoExternal=!1,this._pushVideo=!1,this._autoPublish=!1,this._publish=!1,this._audioFirstFrameState=kK.INITIAL,this._videoFirstFrameState=kK.INITIAL,this._currentAudioSend={startTime:0,eventSessionId:0,type:_B.LOGIN},this._currentVideoSend={startTime:0,eventSessionId:0,type:_B.LOGIN},window.clearTimeout(this._firstAudioFrameTimer),window.clearTimeout(this._firstVideoFrameTimer),window.clearInterval(this._firstAudioFrameInterval),window.clearInterval(this._firstVideoFrameInterval)},e.prototype.destroy=function(){this.reset(),delete this._stream,delete this._handler},Object.defineProperty(e.prototype,"_audioSending",{get:function(){return this._audioFirstFrameState===kK.BEGIN},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"_videoSending",{get:function(){return this._videoFirstFrameState===kK.BEGIN},enumerable:!1,configurable:!0}),e}();!function(e){e[e.UNKOWN=0]="UNKOWN",e[e.EXCELLENT=1]="EXCELLENT",e[e.GOOD=2]="GOOD",e[e.POOR=3]="POOR",e[e.BAD=4]="BAD",e[e.VBAD=5]="VBAD"}(DK||(DK={})),function(e){e[e.INVALID=0]="INVALID",e[e.GOOD=1]="GOOD",e[e.MEDIUM=2]="MEDIUM",e[e.POOR=3]="POOR"}(MK||(MK={})),function(e){e.AUDIO="audio",e.VIDEO="video",e.SCREEN_VIDEO="screen_video",e.SCREEN_AUDIO="screen_audio"}(LK||(LK={}));var xK=((PK={})[LK.AUDIO]={delay:1200,stallRadio:.3},PK[LK.VIDEO]={delay:1200,stallRadio:.6},PK[LK.SCREEN_AUDIO]={delay:1600,stallRadio:.8},PK[LK.SCREEN_VIDEO]={delay:1600,stallRadio:.8},PK),VK=function(){function e(){this._preUplinkStats=new Map,this._preDownlinkStats=new Map,this._connectionState=gK.CONNECTED}return e.prototype.updateUplinkStats=function(e){var t=e.audioStats,i=e.videoStats,r=e.isScreen;if(t.sendKBitrate>0&&t.rtt){var n=r?LK.SCREEN_AUDIO:LK.AUDIO,o=t.rtt,a=t._fractionLost,s=t._retransmittedRate,c=this._getQosLevel(o,a||0,s||0),u=this._preUplinkStats.get(n)||[c];this._preUplinkStats.set(n,af(af([],of(u),!1),[c],!1).slice(-2))}if(i.sentKBitrate>0&&i.rtt){n=r?LK.SCREEN_VIDEO:LK.VIDEO,o=i.rtt,a=i._fractionLost;i.videoLossRate;var d=i._sendBandWidth;s=i._retransmittedRate;0===d&&(a=Math.max(.65,a));c=this._getQosLevel(o,a||0,s||0),u=this._preUplinkStats.get(n)||[c];this._preUplinkStats.set(n,af(af([],of(u),!1),[c],!1).slice(-2))}this._startNetworkQualityReport()},e.prototype.updateDownlinkStats=function(e,t){if(t){var i,r,n=this._getStreamActiveState(t),o=n.audioActive,a=n.videoActive,s=e.audioStats,c=e.videoStats,u=e.isScreen,d=e.userId,l=!0,h=!0;if(o&&s.rtt)if(0===s.receivedKBitrate)l=!1;else{var p=s.rtt,_=s.audioLossRate,f=s.stallDuration,v=s.statsInterval,m=s.e2eDelay,y=f/v,S=u?LK.SCREEN_AUDIO:LK.AUDIO,g=this._getQosLevel(p,_||0,c._retransmittedRate||0),E=this._getDownlinkQoE(S,y,m);i=this._getNetworkQuality(g,E)}if(a)if(0===c.receivedKBitrate||0===c.rtt)h=!1;else{p=c.rtt;var b=c.videoLossRate,I=(f=c.stallDuration,v=c.statsInterval,m=c.e2eDelay,c._retransmittedRate);y=f/v,S=u?LK.SCREEN_VIDEO:LK.VIDEO,g=this._getQosLevel(p,b||0,I||0),E=this._getDownlinkQoE(S,y,m);r=this._getNetworkQuality(g,E)}var T="".concat(d).concat(u?"_screen":"");if(l||h){var A=i&&r?Math.ceil((i+r)/2):i||r;if(A){var R=this._preDownlinkStats.get(T)||[A];this._preDownlinkStats.set(T,af(af([],of(R),!1),[A],!1).slice(-2)),this._startNetworkQualityReport()}}else this._preDownlinkStats.delete(T)}},e.prototype.setConnectionState=function(e){this._connectionState=e},e.prototype.destroy=function(){this._timer&&(window.clearInterval(this._timer),delete this._timer),this._delayTimer&&(window.clearTimeout(this._delayTimer),delete this._delayTimer),this._preUplinkStats.clear(),this._preDownlinkStats.clear()},e.prototype._startNetworkQualityReport=function(){var e=this;this._delayTimer||this._timer||(this._preUplinkStats.size>0||this._preDownlinkStats.size>0)&&(this._delayTimer=window.setTimeout((function(){delete e._delayTimer,e._reportNetworkQuality(),e._timer=window.setInterval((function(){e._reportNetworkQuality()}),2e3)}),300))},e.prototype._reportNetworkQuality=function(){var e,t,i=this;if(this._connectionState!==gK.CONNECTED)e=t=q_.VBAD;else{var r=this._getBetterQualityAndRemoveOldest(LK.AUDIO,"up"),n=this._getBetterQualityAndRemoveOldest(LK.VIDEO,"up");e=r&&n?Math.ceil((r+n)/2):r||n||this._getBetterQualityAndRemoveOldest(LK.SCREEN_VIDEO,"up")||this._getBetterQualityAndRemoveOldest(LK.SCREEN_AUDIO,"up")||q_.EXCELLENT;var o=Array.from(this._preDownlinkStats.keys()).map((function(e){return i._getBetterQualityAndRemoveOldest(e,"down")})).filter((function(e){return e}));t=Math.ceil(o.reduce((function(e,t){return t+e}),0)/o.length)||q_.UNKNOWN}this.reportor&&this.reportor(e,t)},e.prototype._getNetworkQuality=function(e,t){return t===MK.GOOD?Math.max(e-2,1):t===MK.MEDIUM?e:Math.min(e+1,5)},e.prototype._getQosLevel=function(e,t,i){var r;return r=e<=250&&t<=.15?DK.EXCELLENT:e<=500&&t<=.3?DK.GOOD:e<=750&&t<=.45?DK.POOR:e<=1e3&&t<=.6?DK.BAD:DK.VBAD,i>.5?r=Math.max(r,DK.BAD):i>.35?r=Math.max(r,DK.POOR):i>.15&&(r=Math.max(r,DK.GOOD)),r},e.prototype._getUplinkQoE=function(e,t){var i=MK.INVALID;switch(e){case LK.AUDIO:case LK.VIDEO:i=t<.05?MK.GOOD:t<.1?MK.MEDIUM:MK.POOR;break;case LK.SCREEN_VIDEO:case LK.SCREEN_AUDIO:i=t<.04?MK.GOOD:t<.08?MK.MEDIUM:MK.POOR}return i},e.prototype._getDownlinkQoE=function(e,t,i){var r=xK[e];return t>r.stallRadio||i>r.delay||t>r.stallRadio/2&&i>r.delay/2?MK.POOR:(t>r.stallRadio/2||r.delay,MK.MEDIUM)},e.prototype._getBetterQualityAndRemoveOldest=function(e,t){var i=q_.UNKNOWN,r="up"===t?this._preUplinkStats:this._preDownlinkStats,n=r.get(e);if(n){var o=n.filter((function(e){return e}));o.length>0&&(i=Math.min.apply(Math,af([],of(o),!1))),n.shift(),0===n.length&&r.delete(e)}return i},e.prototype._getStreamActiveState=function(e){var t=e.subMediaType,i=e._attributes,r=e.subVideo;return{audioActive:e.subAudio&&VU(t)&&i.localaudio&&i.audiostream,videoActive:r&&FU(t)&&i.localvideo&&i.videostream}},e}(),FK=function(){function e(e){this._room=e,this._remoteVideoSizeCache={},this._remoteScreenSizeCache={},this._start()}return e.prototype.destroy=function(){this._timer&&(window.clearInterval(this._timer),delete this._timer),this._remoteVideoSizeCache={},this._remoteScreenSizeCache={}},e.prototype._start=function(){var e=this;this._timer||(this._timer=window.setInterval((function(){var t={},i={};e._room.remoteStreams.forEach((function(r,n){r.forEach((function(r){var o,a=null===(o=r.videoTrack)||void 0===o?void 0:o.getTrack();if(a){var s=r.isScreen?e._remoteScreenSizeCache:e._remoteVideoSizeCache,c=s[n]||{},u=c.width,d=void 0===u?0:u,l=c.height,h=void 0===l?0:l,p=a.getSettings(),_=p.width,f=void 0===_?0:_,v=p.height,m=void 0===v?0:v;h===m&&d===f||e.onchange&&e.onchange(n,r.isScreen,f,m),delete s[n],(r.isScreen?i:t)[n]={width:f,height:m}}}))})),Object.keys(e._remoteVideoSizeCache).forEach((function(t){e.onchange&&e.onchange(t,!1,0,0)})),Object.keys(e._remoteScreenSizeCache).forEach((function(t){e.onchange&&e.onchange(t,!0,0,0)})),e._remoteVideoSizeCache=t,e._remoteScreenSizeCache=i}),1e3))},e}(),BK=Ia.every;Xr({target:"Array",proto:!0,forced:!Gn("every")},{every:function(e){return BK(this,e,arguments.length>1?arguments[1]:void 0)}});var jK=new LB("SubscribeFallbackManager",2),GK=1e4,HK=function(){function e(e){this._room=e,this._preDownlinkNetworkQuality=[],this._isSubscribeFallbackOrRecover=!1,this._inSubscribeRecoverChecking=!1,this._forbidSubRecover=!1,this._forbidSubRecoverDuration=GK}return e.prototype.updateNetworkQuality=function(e,t){this._preDownlinkNetworkQuality.push(t),this._preDownlinkNetworkQuality=this._preDownlinkNetworkQuality.slice(-10),this._inSubscribeRecoverChecking&&this._preDownlinkNetworkQuality.find((function(e){return e===q_.BAD||e===q_.VBAD}))&&this._startForbidSubRecover(),this._preDownlinkNetworkQuality.slice(-3).reduce((function(e,t){return e+t}),0)>3*q_.POOR&&this._subscribeFallbackOrRecover("fallback"),!this._forbidSubRecover&&10===this._preDownlinkNetworkQuality.length&&this._preDownlinkNetworkQuality.every((function(e){return e===q_.EXCELLENT}))&&this._subscribeFallbackOrRecover("recover")},e.prototype.destroy=function(){this._stopSubscribeRecoverCheck(),this._stopForbidSubRecover(),delete this.onSubscribeFallback},e.prototype._subscribeFallbackOrRecover=function(e){return tf(this,void 0,void 0,(function(){var t,i,r,n,o,a,s,c,u,d=this;return rf(this,(function(l){switch(l.label){case 0:if(this._isSubscribeFallbackOrRecover||this._room.connectionState!==gK.CONNECTED)return[2];if(this._room.subscribeFallbackOption!==W_.AUDIO_ONLY&&this._room.subscribeFallbackOption!==W_.VIDEO_STREAM_LOW)return[3,5];if(t=new Map,this._room.remoteStreams.forEach((function(i){i.forEach((function(i){if(i.hasSubscribed){var r="fallback"===e?i.getSubscribeFallbackParams(d._room.subscribeFallbackOption):i.getSubscribeRecoverParams();if(r){var n=i.getStreamPriority(),o=t.get(n)||[];o.push({stream:i,fallbackOrRecoverOption:r}),t.set(n,o)}}}))})),!(t.size>0))return[3,5];if(jK.print("_subscribeFallbackOrRecover()","start subscribe ".concat(e,".")),i=Array.from(t.keys()).sort((function(e,t){return e-t}))["fallback"===e?0:t.size-1],r=of(t.get(i)||[],1),!(n=r[0]))return[3,5];o=n.stream,a=n.fallbackOrRecoverOption,this._isSubscribeFallbackOrRecover=!0,s=o.subLayer.spatialLayer,c=o.subVideo,jK.print("_subscribeFallbackOrRecover()","".concat(o.userId,"'s stream will be ").concat(e," to: MediaType=").concat(a[0]," subState=").concat(a[1]," subLayer=").concat(a[2])),l.label=1;case 1:return l.trys.push([1,3,,4]),[4,UU([(u=this._room).updateSubTrack.apply(u,af([o],of(a),!1)).then((function(){"recover"===e?d._startSubscribeRecoverCheck():jK.print("_subscribeFallbackOrRecover()","fallback success."),d.onSubscribeFallback&&d.onSubscribeFallback({userId:o.userId,isScreen:o.isScreen,beforeEnable:c,beforeVideoIndex:s,afterEnable:o.subVideo,afterVideoIndex:o.subLayer.spatialLayer,reason:"fallback"===e?Y_.SubscribeFallbackByBandwidth:Y_.SubscribeRecoverByBandwidth})})),(h=2e3,new Promise((function(e){window.setTimeout(e,h)})))])];case 2:case 3:return l.sent(),[3,4];case 4:this._preDownlinkNetworkQuality=[],this._isSubscribeFallbackOrRecover=!1,l.label=5;case 5:return[2]}var h}))}))},e.prototype._startSubscribeRecoverCheck=function(){var e=this;this._stopSubscribeRecoverCheck(),this._inSubscribeRecoverChecking=!0,this._subRecoverCheckTimer=window.setTimeout((function(){e._inSubscribeRecoverChecking=!1,e._forbidSubRecoverDuration=GK,delete e._subRecoverCheckTimer,jK.print("_subscribeFallbackOrRecover()","recover success.")}),2e4)},e.prototype._stopSubscribeRecoverCheck=function(){this._subRecoverCheckTimer&&(window.clearTimeout(this._subRecoverCheckTimer),delete this._subRecoverCheckTimer),this._inSubscribeRecoverChecking=!1},e.prototype._startForbidSubRecover=function(){var e=this;this._stopSubscribeRecoverCheck(),this._stopForbidSubRecover(),this._forbidSubRecoverDuration=Math.min(this._forbidSubRecoverDuration+2e4,12e4),jK.print("_subscribeFallbackOrRecover()","subscribe-recover failed, and subscribe-recover not allowed within ".concat(this._forbidSubRecoverDuration/1e3,"s")),this._forbidSubRecover=!0,this._forbidSubRecoverTimer=window.setTimeout((function(){e._forbidSubRecover=!1,delete e._forbidSubRecoverTimer}),this._forbidSubRecoverDuration)},e.prototype._stopForbidSubRecover=function(){this._forbidSubRecoverTimer&&(window.clearTimeout(this._forbidSubRecoverTimer),delete this._forbidSubRecoverTimer)},e}(),zK=new LB("Room",1),KK=function(e){function t(t,i){var r=e.call(this)||this;return r._remoteUsers=new Map,r._remoteStreams=new Map,r._remoteStreamStreamIdUserIdMap={},r._waitForNewToken=!1,r._userDuplicateLoginTimerMap=new Map,r._hasPublished=!1,r._publishOnDemandBusy=!1,r._roomConfig=t,r._mediaServerClient=new RK(i),r._reconnectRecord=new WK,r._addHandlerEventHandler(),r._isReconnecting=!1,r._networkQualityManager=new VK,r._networkQualityManager.reportor=r._reportNetworkQuality.bind(r),r._videoSizeObserver=new FK(r),r._videoSizeObserver.onchange=r._emitVideoSizeChange.bind(r),r._subFallbackManager=new HK(r),r._subFallbackManager.onSubscribeFallback=r._emitSubscribeFallback.bind(r),r._context=i,r}return C_(t,e),Object.defineProperty(t.prototype,"hasScreenPublished",{get:function(){var e;return null===(e=this._localScreenStream)||void 0===e?void 0:e.hasPublished},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"hasPublished",{get:function(){var e;return null===(e=this._localStream)||void 0===e?void 0:e.hasPublished},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"connectionState",{get:function(){return this._mediaServerClient.connectionState},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"remoteUsers",{get:function(){return this._remoteUsers},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"remoteStreams",{get:function(){return this._remoteStreams},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"localStream",{get:function(){return this._localStream},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"localScreenStream",{get:function(){return this._localScreenStream},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"roomInfo",{get:function(){return this._roomInfo},enumerable:!1,configurable:!0}),t.prototype._addHandlerEventHandler=function(){var e,t,i,r,n,o,a,s,c,u,d,l,h,p,_,f,v,m,y,S,g,E,b,I,T=this;null===(e=this._mediaServerClient)||void 0===e||e.on(vG.ON_ADD_STREAM,this._onAddStream.bind(this)),null===(t=this._mediaServerClient)||void 0===t||t.on(vG.ON_REMOVE_STREAM,this._onRemoveStream.bind(this)),null===(i=this._mediaServerClient)||void 0===i||i.on(vG.USER_CONNECTION,this._onUserConnection.bind(this)),null===(r=this._mediaServerClient)||void 0===r||r.on(vG.USER_DISCONNECTION,this._onUserDisconnection.bind(this)),null===(n=this._mediaServerClient)||void 0===n||n.on(vG.ON_UPDATE_ROOM_ATTRIBUTES,this._onUpdateRoomAttributes.bind(this)),null===(o=this._mediaServerClient)||void 0===o||o.on(vG.ON_UPDATE_STREAM_ATTRIBUTES,this._onUpdateStreamAttributes.bind(this)),null===(a=this._mediaServerClient)||void 0===a||a.on(vG.ON_PUSH_TRACK,this._onPushTrack.bind(this)),null===(s=this._mediaServerClient)||void 0===s||s.on(vG.ON_REMOVE_TRACK,this._onRemoveTrack.bind(this)),null===(c=this._mediaServerClient)||void 0===c||c.on(vG.NODE_CHANGE,this._nodeChange.bind(this)),null===(u=this._mediaServerClient)||void 0===u||u.on(vG.ON_CUSTOM_MESSAGE,this._onCustomMessage.bind(this)),null===(d=this._mediaServerClient)||void 0===d||d.on(vG.USER_MESSAGE_RECEIVED,this._onUserMessageReceived.bind(this)),null===(l=this._mediaServerClient)||void 0===l||l.on(vG.USER_BINARY_MESSAGE_RECEIVED,this._onUserBinaryMessageReceived.bind(this)),null===(h=this._mediaServerClient)||void 0===h||h.on(vG.POST_PROCESSING_MESSAGE,this._onPostProcessingMessage.bind(this)),null===(p=this._mediaServerClient)||void 0===p||p.on(vG.ON_USER_TOKEN_WILL_EXPIRE,this._onUserTokenWillExpire.bind(this)),null===(_=this._mediaServerClient)||void 0===_||_.on(vG.STREAM_CONTROL_MESSAGE,this._onStreamControlMessage.bind(this)),null===(f=this._mediaServerClient)||void 0===f||f.on(vG.ON_SCENE_CONFIG,this._onSceneConfig.bind(this)),null===(v=this._mediaServerClient)||void 0===v||v.on(vG.ON_STREAM_FAILED,this._onStreamFailed.bind(this)),null===(m=this._mediaServerClient)||void 0===m||m.on(mG.RSCP,(function(e){T._publishOnDemandItem=e,T._onPublishOnDemand()})),null===(y=this._mediaServerClient)||void 0===y||y.on(yG.ON_CONNECTION_STATE_CHANGE,this._onConnectionStateChange.bind(this)),null===(S=this._mediaServerClient)||void 0===S||S.on(yG.ABNORMAL_DISCONNECTION,this._handleAbnormalDisconnection.bind(this)),null===(g=this._mediaServerClient)||void 0===g||g.on("onRemoteStreamStats",(function(e){T._networkQualityManager.updateDownlinkStats(e,T._findRemoteStreamByScreen(e.userId,e.isScreen)),T.emit(jz.ON_REMOTE_STREAM_STATS,BU(e))})),null===(E=this._mediaServerClient)||void 0===E||E.on("onLocalStreamStats",(function(e){T._networkQualityManager.updateUplinkStats(e),T.emit(jz.ON_LOCAL_STREAM_STATS,BU(e))})),null===(b=this._mediaServerClient)||void 0===b||b.on("prevIceNode",(function(e){T._getAccessFeedbackIceNode=e})),null===(I=this._mediaServerClient)||void 0===I||I.on("prevIceNode",(function(e){T._getAccessFeedbackIceNode=e}))},t.prototype._removeHandlerEventHandler=function(){var e;null===(e=this._mediaServerClient)||void 0===e||e.removeAllListeners()},t.prototype.join=function(e,t,i,r,n,o){return tf(this,void 0,void 0,(function(){var a=this;return rf(this,(function(s){return zB.setStats({rtc_app_id:e,room_id:t,user_id:r.userId}),zK.print("join()"),[2,new Promise((function(s,c){return tf(a,void 0,void 0,(function(){var a,u,d=this;return rf(this,(function(l){return this._joinResolveCallback=function(e){var t;jB.joinRoom(yB.END,a,!0,"",{enable_cloud_proxy:null===(t=d._roomInfo)||void 0===t?void 0:t.useCloudProxy}),s(e)},this._joinRejectCallback=function(e){var t;jB.joinRoom(yB.END,a,!1,e.message,{enable_cloud_proxy:null===(t=d._roomInfo)||void 0===t?void 0:t.useCloudProxy}),c(e)},this._liveControlMessage=n,this._roomInfo={appId:e,roomId:t,token:i,userInfo:r,useCloudProxy:o,roomProfile:this._roomConfig.roomProfileType},a=fU(),this.setSessionId(),jB.joinRoom(yB.BEGIN,a,!1,"",{enable_cloud_proxy:null===(u=this._roomInfo)||void 0===u?void 0:u.useCloudProxy}),this._join(this._joinResolveCallback,this._joinRejectCallback,!1),[2]}))}))}))]}))}))},t.prototype._join=function(e,t,i){return void 0===i&&(i=!1),tf(this,void 0,void 0,(function(){var r,n,o;return rf(this,(function(a){switch(a.label){case 0:r=fU(),zK.print("_join()"),a.label=1;case 1:return a.trys.push([1,3,,4]),[4,this._mediaServerClient.join(this._roomInfo,{node:this._getAccessNode,reason:this._getAccessFeedback,sessionId:this._sessionId,feedbackNode:this._getAccessFeedbackIceNode},i,this._liveControlMessage)];case 2:return n=a.sent(),this._mediaServerClient.roomAttributes=n.roomAttributes,this._reconnectRecord.clear(),this._joinResolveCallback=void 0,this._joinRejectCallback=void 0,this._getAccessFeedback=void 0,this._getAccessNode=void 0,"function"==typeof e&&e({users:n.clients,streams:n.streams}),this._isReconnecting=!1,jB.rtcJoinRoom(0,"web","web",fU()-r),this._onJoinSucc(n,i),[3,4];case 3:return(o=a.sent()).code!==Nj.OPERATION_CANCEL&&"function"==typeof t?[2,t(o)]:[3,4];case 4:return[2]}}))}))},t.prototype.publishScreen=function(e,t,i,r,n){var o,a,s,c,u,d;return tf(this,void 0,void 0,(function(){var l,h,p,_;return rf(this,(function(f){switch(f.label){case 0:return zK.print("publishScreen()"),this._localScreenStream||(this._localScreenStream=new iK,this._localScreenStream.isScreen=!0,this._mediaServerClient.handler&&(this._localScreenStream.observer=new UK(this._localScreenStream,this._mediaServerClient.handler))),l=!1,h=!1,p=!1,_=!1,!this._localScreenStream.videoTrack&&t?(t instanceof bz&&(h=!0),l=!0):this._localScreenStream.videoTrack&&!t&&(l=!1),!this._localScreenStream.audioTrack&&i?(i instanceof Iz&&(_=!0),p=!0):this._localScreenStream.audioTrack&&!i&&(p=!1),this._localScreenStream.videoTrack=t,this._localScreenStream.audioTrack=i,this._localScreenStream.videoEncodeConfig=e,r&&(VU(r)&&(this._localScreenStream.pubAudio=n===zz.PUB),FU(r)&&(this._localScreenStream.pubVideo=n===zz.PUB),zK.print("publishScreen mediaType","pubAudio: %o, pubVideo: %o",this._localScreenStream.pubAudio,this._localScreenStream.pubVideo)),this._localScreenStream.pubAudio||this._localScreenStream.pubVideo?this._localScreenStream.hasPublished?[3,2]:(null===(a=this._localScreenStream.observer)||void 0===a||a.setPublish(!0),[4,this._mediaServerClient.publish(this._localScreenStream)]):(null===(o=this._localScreenStream)||void 0===o?void 0:o.hasPublished)?[2,this.unpublishScreen()]:[2];case 1:return f.sent(),[3,4];case 2:return h?null===(s=this._localScreenStream.observer)||void 0===s||s.setPushVideo(l):null===(c=this._localScreenStream.observer)||void 0===c||c.setEnableVideo(l),_?null===(u=this._localScreenStream.observer)||void 0===u||u.setPushAudio(p):null===(d=this._localScreenStream.observer)||void 0===d||d.setEnableAudio(p),[4,this.updatePubScreenTrack()];case 3:f.sent(),f.label=4;case 4:return[2]}}))}))},t.prototype.updatePubScreenTrack=function(){return tf(this,void 0,void 0,(function(){return rf(this,(function(e){switch(e.label){case 0:return zK.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 tf(this,void 0,void 0,(function(){return rf(this,(function(t){switch(t.label){case 0:return zK.print("unpublish","Invoke unpublishScreen"),this._localScreenStream?(null===(e=this._localScreenStream.observer)||void 0===e||e.setPublish(!1),[4,this._mediaServerClient.unpublish(this._localScreenStream)]):[3,2];case 1:t.sent(),this._localScreenStream.clean(),this._localScreenStream=void 0,t.label=2;case 2:return[2]}}))}))},t.prototype.liveControlMessage=function(e){var t;return tf(this,void 0,void 0,(function(){var i=this;return rf(this,(function(r){switch(r.label){case 0:return zK.print("controlMessage","Invoke controlMessage"),null===(t=e.transcodeMeta)||void 0===t||t.layout.regions.forEach((function(e){i.roomInfo&&(e.roomID=i.roomInfo.roomId)})),this._liveControlMessage=e,[4,this._mediaServerClient.controlMessage(e)];case 1:return r.sent(),"stopped"===e.action&&delete this._liveControlMessage,[2]}}))}))},t.prototype.publicStreamControlMessage=function(e){return tf(this,void 0,void 0,(function(){return rf(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 tf(this,void 0,void 0,(function(){return rf(this,(function(t){switch(t.label){case 0:return zK.print("updateUserAttributes","Invoke updateUserAttributes"),e.role&&this._roomInfo&&(this._roomInfo.userInfo.role=e.role),[4,this._mediaServerClient.updateUserAttributes(e)];case 1:return t.sent(),[2]}}))}))},t.prototype.publish=function(e,t,i,r,n,o,a){var s,c,u,d,l,h;return void 0===a&&(a=!1),tf(this,void 0,void 0,(function(){var p,_,f,v,m,y;return rf(this,(function(S){switch(S.label){case 0:if(zK.print("publish","Invoke publish"),p=!1,this._localStream||(this._localStream=new iK,this._mediaServerClient.handler&&(this._localStream.observer=new UK(this._localStream,this._mediaServerClient.handler)),p=!0),this._localStream.videoTrack=i,this._localStream.audioTrack=r,this._localStream.videoEncodeConfig=e,this._localStream.enableSimulcast=t,n&&(VU(n)&&(this._localStream.pubAudio=o===zz.PUB),FU(n)&&(this._localStream.pubVideo=o===zz.PUB),zK.print("publish mediaType","pubAudio: %o, pubVideo: %o",this._localStream.pubAudio,this._localStream.pubVideo)),this._localStream.hasPublished)return[3,5];if(!this._localStream.pubAudio&&!this._localStream.pubVideo)return[2];S.label=1;case 1:return S.trys.push([1,3,,4]),a?null===(s=this._localStream.observer)||void 0===s||s.setLogin(!0):p&&(_=!!this._localStream.videoTrack,f=!!this._localStream.audioTrack,v=this._localStream.videoTrack instanceof bz,m=this._localStream.audioTrack instanceof Iz,this._roomConfig.isAutoPublish&&!this._hasPublished?(_&&(v?null===(c=this._localStream.observer)||void 0===c||c.setPushVideo(!0):null===(u=this._localStream.observer)||void 0===u||u.setEnableVideo(!0)),f&&(m?null===(d=this._localStream.observer)||void 0===d||d.setPushAudio(!0):null===(l=this._localStream.observer)||void 0===l||l.setEnableAudio(!0))):null===(h=this._localStream.observer)||void 0===h||h.setPublish(!0)),[4,this._mediaServerClient.publish(this._localStream)];case 2:return S.sent(),this._hasPublished=!0,this.emit(jz.ON_PUBLISH_RESULT,{isScreen:!1,state:M_.PUBLISH_SUCC}),[3,4];case 3:throw y=S.sent(),this.emit(jz.ON_PUBLISH_RESULT,{isScreen:!1,state:M_.PUBLISH_FAIL}),y;case 4:return[3,7];case 5:return[4,this.updatePubTrack()];case 6:S.sent(),S.label=7;case 7:return[2]}}))}))},t.prototype.updatePubTrack=function(){return tf(this,void 0,void 0,(function(){return rf(this,(function(e){switch(e.label){case 0:return zK.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 tf(this,void 0,void 0,(function(){return rf(this,(function(e){switch(e.label){case 0:return zK.print("unpublish","Invoke unpublish"),this._localStream?[4,this._mediaServerClient.unpublish(this._localStream)]:[3,2];case 1:e.sent(),this._localStream.clean(),this._localStream=void 0,e.label=2;case 2:return[2]}}))}))},t.prototype.subscribe=function(e,t,i){return tf(this,void 0,void 0,(function(){var r;return rf(this,(function(n){switch(n.label){case 0:return zK.print("subscribe","remoteStream %o",e),r=void 0,i&&(r=this._getSubLayer(i,e)),[4,this._mediaServerClient.subscribe(e,t,r)];case 1:return n.sent(),[2]}}))}))},t.prototype.updateSubTrack=function(e,t,i,r){var n;return tf(this,void 0,void 0,(function(){return rf(this,(function(o){return zK.print("updateSubTrack","Invoke updateSubTrack"),[2,null===(n=this._mediaServerClient)||void 0===n?void 0:n.updateSubTrack(e,t,i,r)]}))}))},t.prototype.updateSubVideoConfig=function(e,t){var i,r,n;return tf(this,void 0,void 0,(function(){var o,a;return rf(this,(function(s){return!(o=this._findRemoteStreamByScreen(e,!1))||!o.hasSubscribed||(null===(r=null===(i=null==o?void 0:o.attributes)||void 0===i?void 0:i.videoDescriptions)||void 0===r?void 0:r.length)<=1?[2]:(a=this._getSubLayer(t,o),o.originalStreamIndex=a.spatialLayer,[2,null===(n=this._mediaServerClient)||void 0===n?void 0:n.updateSubTrackLayer(o,a)])}))}))},t.prototype._getSubLayer=function(e,t){for(var i,r,n,o,a,s=null==t?void 0:t.attributes,c=s.videoDescriptions,u=s.subVideoDescriptions,d=Array.isArray(u)?u:c,l=-1,h=e.width*e.height,p=0;p<(null==d?void 0:d.length);p++)if(h>=(null===(i=d[p])||void 0===i?void 0:i.width)*(null===(r=d[p])||void 0===r?void 0:r.height)){l=p;break}var _=d[0];if(-1===l)_=d[l=d.length-1];else if(0!==l){var f=d[l-1].width*d[l-1].height,v=(f-h)/(f-d[l].width*d[l].height);_=v<.1?d[l-1]:d[l],l=v<.1?l-1:l}return a=null!==(n=null==_?void 0:_.sub_index)&&void 0!==n?n:-1,{spatialLayer:null!==(o=null==_?void 0:_.video_index)&&void 0!==o?o:l,spatialSubLayer:a}},t.prototype.unsubscribe=function(e,t){return tf(this,void 0,void 0,(function(){return rf(this,(function(i){switch(i.label){case 0:return zK.print("unsubscribe","Invoke unsubscribe"),[4,this._mediaServerClient.unsubscribe(e,t)];case 1:return i.sent(),[2]}}))}))},t.prototype.leave=function(e){var t;return void 0===e&&(e=!1),tf(this,void 0,void 0,(function(){var i,r,n,o,a,s,c;return rf(this,(function(u){switch(u.label){case 0:zK.print("leave","Invoke leave"),i=fU(),u.label=1;case 1:u.trys.push([1,3,,4]),clearTimeout(this._reconnectTimer);try{for(r=nf(this._remoteStreams.values()),n=r.next();!n.done;n=r.next())o=n.value,Array.isArray(o)&&o.forEach((function(e){var t;null===(t=e.observer)||void 0===t||t.setLogin(!1)}))}catch(e){s={error:e}}finally{try{n&&!n.done&&(c=r.return)&&c.call(r)}finally{if(s)throw s.error}}return this._localStream&&(null===(t=this._localStream.observer)||void 0===t||t.setLogin(!1)),[4,this._mediaServerClient.leave()];case 2:return u.sent(),this.destroy(),jB.rtcLeaveRoom(0,"",fU()-i),[3,4];case 3:if(a=u.sent(),e)throw a;return this.destroy(),a instanceof Error&&jB.rtcLeaveRoom(-1,a.message,fU()-i),[3,4];case 4:return[2]}}))}))},t.prototype.setRemoteUserPriority=function(e,t){var i,r;null===(i=this.remoteStreams.get(e))||void 0===i||i.forEach((function(e){return e.setRemoteUserPriority(t)})),null===(r=this.userPriorityMap)||void 0===r||r.set(e,t)},t.prototype.destroy=function(){var e,t,i,r;zK.print("destroy","Invoke destroy"),this._destroyAndInitMediaServerClient(),this._roomInfo=void 0,this._remoteUsers=new Map;try{for(var n=nf(this._remoteStreams),o=n.next();!o.done;o=n.next()){var a=of(o.value,2)[1];Array.isArray(a)&&a.forEach((function(e){e&&e.clean()}))}}catch(t){e={error:t}}finally{try{o&&!o.done&&(t=n.return)&&t.call(n)}finally{if(e)throw e.error}}this._remoteStreams=new Map,this._localStream&&(null===(i=this._localStream)||void 0===i||i.clean(),this._localStream=void 0),this._localScreenStream&&(null===(r=this._localScreenStream)||void 0===r||r.clean(),this._localScreenStream=void 0),this._context=void 0,this._reconnectRecord=new WK,this._removeHandlerEventHandler(),clearTimeout(this._connectionLostTimer),this._userDuplicateLoginTimerMap.forEach((function(e){clearTimeout(e)})),this._userDuplicateLoginTimerMap.clear(),this._networkQualityManager.destroy(),this._videoSizeObserver.destroy(),this._subFallbackManager.destroy(),this._remoteStreamStreamIdUserIdMap={}},t.prototype.updateToken=function(e){return tf(this,void 0,void 0,(function(){return rf(this,(function(t){switch(t.label){case 0:return zK.print("updateToken","Invoke updateToken"),this._roomInfo&&(this._roomInfo.token=e),[4,this._mediaServerClient.updateToken(e)];case 1:return t.sent(),[2]}}))}))},t.prototype.pauseAllSubscribedStream=function(e){return tf(this,void 0,void 0,(function(){var t,i,r,n,o,a,s=this;return rf(this,(function(c){t=[];try{for(i=nf(this._remoteStreams.values()),r=i.next();!r.done;r=i.next())n=r.value,Array.isArray(n)&&n.forEach((function(i){if(i.hasSubscribed){var r=s.updateSubTrack(i,e,Kz.UNSUB);r&&t.push(r)}}))}catch(e){o={error:e}}finally{try{r&&!r.done&&(a=i.return)&&a.call(i)}finally{if(o)throw o.error}}return[2,Promise.all(t)]}))}))},t.prototype.resumeAllSubscribedStream=function(e){return tf(this,void 0,void 0,(function(){var t,i,r,n,o,a,s=this;return rf(this,(function(c){t=[];try{for(i=nf(this._remoteStreams.values()),r=i.next();!r.done;r=i.next())n=r.value,Array.isArray(n)&&n.forEach((function(i){if(i.hasSubscribed&&i.hasSubscribed){var r=s.updateSubTrack(i,e,Kz.SUB);r&&t.push(r)}}))}catch(e){o={error:e}}finally{try{r&&!r.done&&(a=i.return)&&a.call(i)}finally{if(o)throw o.error}}return[2,Promise.all(t)]}))}))},t.prototype.sendUserMessage=function(e,t){var i;return null===(i=this._mediaServerClient)||void 0===i?void 0:i.sendUserMessage(e,t)},t.prototype.setSessionId=function(){this._sessionId=lU(),zB.setStats({rtc_session_id:this._sessionId})},t.prototype.sendRoomMessage=function(e,t){var i,r;return void 0===t&&(t=!1),tf(this,void 0,void 0,(function(){var n,o;return rf(this,(function(a){switch(a.label){case 0:return n={clientId:null===(i=this._roomInfo)||void 0===i?void 0:i.userInfo.userId,binary:t,message:""},t?(o=n,[4,yU.ab2b64str(e)]):[3,2];case 1:return o.message=a.sent(),[3,3];case 2:n.message=e,a.label=3;case 3:return[2,null===(r=this._mediaServerClient)||void 0===r?void 0:r.sendRoomMessage(n)]}}))}))},t.prototype._destroyAndInitMediaServerClient=function(){zK.print("_destroyAndInitMediaServerClient()"),this._mediaServerClient&&(this._mediaServerClient.destroy(),this._removeHandlerEventHandler()),this._mediaServerClient=new RK(this._context),this._addHandlerEventHandler()},t.prototype._onJoinSucc=function(e,t){var i,r,n,o,a,s=this;zK.print("JoinSuccess()"),this._serverConfig=e.config;var c=[],u=[],d=[],l=[],h=[];null===(a=e.clientsDetail)||void 0===a||a.forEach((function(t){if(t.clientId!==e.clientId){var i=s._remoteUsers.get(t.clientId);i?i._stillExist=!0:c.push(t)}}));try{for(var p=nf(this._remoteUsers.values()),_=p.next();!_.done;_=p.next()){var f=_.value;f._stillExist||u.push({clientId:f.userId}),delete f._stillExist}}catch(e){i={error:e}}finally{try{_&&!_.done&&(r=p.return)&&r.call(p)}finally{if(i)throw i.error}}e.streams.forEach((function(e){var t=s._findRemoteStreamByScreen(e.clientId,e.screen);t?(t.stillExist=!0,t.streamId=e.streamId,h.push(e)):l.push(e)}));try{for(var v=nf(this._remoteStreams.values()),m=v.next();!m.done;m=v.next()){var y=m.value;Array.isArray(y)&&y.forEach((function(e){e.stillExist?delete e.stillExist:d.push({clientId:e.userId,streamId:e.streamId,message:_G.clientDisconnected})}))}}catch(e){n={error:e}}finally{try{m&&!m.done&&(o=v.return)&&o.call(v)}finally{if(n)throw n.error}}setTimeout((function(){u.forEach((function(e){return s._onUserDisconnection(e)})),c.forEach((function(e){return s._onUserConnection(e)})),d.forEach((function(e){return s._onRemoveStream(e)})),l.forEach((function(e){return s._onAddStream(e,!0,!1)})),h.forEach((function(e){return s._onUpdateStreamAttributes(e)})),t&&s._handleSendOrRecvStreamAfterReconnect()}))},t.prototype._handleSendOrRecvStreamAfterReconnect=function(){var e,t,i=this;this._localStream&&(this._localStream.clean(),this._mediaServerClient.publish(this._localStream).catch((function(e){}))),this._localScreenStream&&(this._localScreenStream.clean(),this._mediaServerClient.publish(this._localScreenStream).catch((function(e){})));try{for(var r=nf(this._remoteStreams.values()),n=r.next();!n.done;n=r.next()){var o=n.value;Array.isArray(o)&&o.forEach((function(e){return tf(i,void 0,void 0,(function(){var t;return rf(this,(function(i){switch(i.label){case 0:if(!e.hasSubscribed)return[3,4];e.resetHasSubscribed(),i.label=1;case 1:return i.trys.push([1,3,,4]),zK.print("start resubscribe ".concat(e.userId," with ").concat(e.subMediaType)),[4,this._mediaServerClient.subscribe(e,e.subMediaType)];case 2:return i.sent(),zK.print("success resubscribe ".concat(e.userId," with ").concat(e.subMediaType)),this.safeEmit(jz.RESUBSCRIBE,{stream:e}),[3,4];case 3:return t=i.sent(),zK.print("failed resubscribe ".concat(e.userId," with ").concat(e.subMediaType,", error:").concat(t)),e.clean(),null==e||e.resetHasSubscribed(),[3,4];case 4:return[2]}}))}))}))}}catch(t){e={error:t}}finally{try{n&&!n.done&&(t=r.return)&&t.call(r)}finally{if(e)throw e.error}}},t.prototype._findRemoteStream=function(e,t){var i=this._remoteStreams.get(e);return Array.isArray(i)?i.find((function(e){return e.streamId===t})):null},t.prototype._findRemoteStreamByScreen=function(e,t){var i=this._remoteStreams.get(e);return Array.isArray(i)?i.find((function(e){return e.isScreen===t})):null},t.prototype._onAddStream=function(e,t,i){var r,n,o,a,s,c,u,d,l,h,p;if(void 0===t&&(t=!0),void 0===i&&(i=!0),e.clientId!==(null===(r=this._roomInfo)||void 0===r?void 0:r.userInfo.userId)){var _=this._findRemoteStream(e.clientId,e.streamId);if(this._remoteStreamStreamIdUserIdMap[e.streamId]=e.clientId,!_){_=new rK(e.clientId,e.streamId,e.screen,!1,e.attributes,null===(n=this.userPriorityMap)||void 0===n?void 0:n.get(e.clientId)),this._initStreamListeners(_);var f=this._remoteStreams.get(e.clientId);f?f.push(_):this._remoteStreams.set(e.clientId,[_])}if(this._mediaServerClient.handler&&(_.observer=new NK(_,this._mediaServerClient.handler)),!_.isScreen&&(i&&_.hasVideo&&(_.attributes.extvideo?(null===(o=_.observer)||void 0===o||o.setExternalVideoSource(!0),null===(a=_.observer)||void 0===a||a.setPushVideo(!0)):(null===(s=_.observer)||void 0===s||s.setExternalVideoSource(!1),null===(c=_.observer)||void 0===c||c.setPublishVideo(!0))),i&&_.hasAudio&&!this._mediaServerClient.roomAttributes.multiChatMode&&(_.attributes.extaudio?(null===(u=_.observer)||void 0===u||u.setExternalAudioSource(!0),null===(d=_.observer)||void 0===d||d.setPushAudio(!0)):(null===(l=_.observer)||void 0===l||l.setExternalAudioSource(!1),null===(h=_.observer)||void 0===h||h.setPublishAudio(!0))),!0===t&&!1===i)){var v=this._roomConfig,m=v.isAutoSubscribeAudio,y=v.isAutoSubscribeVideo;null===(p=_.observer)||void 0===p||p.setLogin(!0,{audio:!!m,video:!!y})}return t&&this.safeEmit(vG.ON_ADD_STREAM,{stream:_}),_}},t.prototype._onUserConnection=function(e){var t;if(e.clientId!==(null===(t=this._roomInfo)||void 0===t?void 0:t.userInfo.userId)){var i=this._userDuplicateLoginTimerMap.get(e.clientId);if("number"==typeof i)return this._userDuplicateLoginTimerMap.delete(e.clientId),void self.clearTimeout(i);var r={userId:e.clientId,extraInfo:e.attributes.extra_info};this._remoteUsers.set(e.clientId,$_({},r)),this.safeEmit(vG.USER_CONNECTION,{userInfo:r})}},t.prototype._onUserDisconnection=function(e){var t,i=this,r=e.clientId,n=e.tag,o=e.code;if(r)if(r===(null===(t=this.roomInfo)||void 0===t?void 0:t.userInfo.userId)){var a=null;n===SG.kickedByAdmin?a=Nj.KICKED_OUT:n===SG.onUserTokenDidExpire?a=Nj.TOKEN_EXPIRED:n===SG.userDuplicateLogin&&(a=Nj.DUPLICATE_LOGIN),o===gG.roomDismissByAdmin&&(a=Nj.ROOM_DISMISS),a&&this.safeEmit(jz.ON_ROOM_ERROR,{errorCode:a})}else{var s=k_.DROPPED;n===SG.userLeave?s=k_.QUIT:n===SG.kickedByAdmin?s=k_.KICKED_BY_ADMIN:n===SG.roleChanged&&(s=k_.SWITCH_TO_INVISIBLE);var c=function(){var e;i._remoteUsers.delete(r),null===(e=i._remoteStreams.get(r))||void 0===e||e.forEach((function(e){i._onRemoveStream({clientId:e.userId,streamId:e.streamId,message:"client disconnected"})})),i.safeEmit(jz.ON_USER_LEAVE,{userInfo:{userId:r},reason:s})};if(n===SG.userDuplicateLogin){this._userDuplicateLoginTimerMap.has(r)&&(self.clearTimeout(this._userDuplicateLoginTimerMap.get(r)),this._userDuplicateLoginTimerMap.delete(r));var u=self.setTimeout(c,5e3);this._userDuplicateLoginTimerMap.set(r,u)}else c()}},t.prototype._onRemoveStream=function(e){var t,i,r,n,o=this;if(e.clientId!==(null===(t=this._roomInfo)||void 0===t?void 0:t.userInfo.userId)){var a=this._remoteStreams.get(e.clientId);if(a){var s=a.find((function(t){return t.streamId==e.streamId}));s&&(null===(i=this._mediaServerClient)||void 0===i||i.handleRemoveStream(s,e).then((function(){if(!(null==s?void 0:s._workaround_1_)){var t=o._remoteStreams.get(e.clientId);if(!t)return;t=t.filter((function(t){return t.streamId!==e.streamId||(t.clean(),!1)})),o._remoteStreams.set(e.clientId,t)}})).finally((function(){o.safeEmit(vG.ON_REMOVE_STREAM,{stream:s,reason:e.message})})),s.hasVideo&&(null===(r=s.observer)||void 0===r||r.setPublishVideo(!1)),s.hasAudio&&!this._mediaServerClient.roomAttributes.multiChatMode&&(null===(n=s.observer)||void 0===n||n.setPublishAudio(!1)))}}},t.prototype._onUpdateRoomAttributes=function(e){e.roomAttributes&&(this._mediaServerClient.roomAttributes=e.roomAttributes)},t.prototype._onUpdateStreamAttributes=function(e){var t,i,r,n,o,a,s,c,u,d,l,h,p,_,f,v,m,y,S=e.clientId,g=e.streamId,E=e.attributes,b=this._findRemoteStream(S,g);if(b){var I=b.attributes,T=$_($_({},I),E),A=!1,R=T.localaudio!==I.localaudio,C=!1,O=!1,w=T.localvideo!==I.localvideo,k=!1,N=wz.NONE,P=wz.NONE;T.audiostream!==I.audiostream&&(A=T.localaudio,C=!!T.audiostream,T.audiostream?N|=V_.AUDIO:P|=V_.AUDIO),T.videostream!==I.videostream&&(O=T.localvideo,k=!!T.videostream,T.videostream?N|=V_.VIDEO:P|=V_.VIDEO),N&&this.safeEmit(jz.ON_USER_PUBLISH_STATE_CHANGE,{userId:S,mediaType:N,isScreen:b.isScreen,pubState:zz.PUB,remoteStream:b}),P&&this.safeEmit(jz.ON_USER_PUBLISH_STATE_CHANGE,{userId:S,mediaType:P,isScreen:b.isScreen,pubState:zz.UNPUB,remoteStream:b}),T.localaudio!==I.localaudio&&(T.localaudio?(T.extaudio?(null===(t=b.observer)||void 0===t||t.setExternalAudioSource(!0),null===(i=b.observer)||void 0===i||i.setPushAudio(!0)):(null===(r=b.observer)||void 0===r||r.setExternalAudioSource(!1),null===(n=b.observer)||void 0===n||n.setEnableAudio(!0)),this.safeEmit(jz.ON_USER_START_AUDIO_CAPTURE,{userId:S})):(T.extaudio?(null===(o=b.observer)||void 0===o||o.setExternalAudioSource(!0),null===(a=b.observer)||void 0===a||a.setPushAudio(!1)):(null===(s=b.observer)||void 0===s||s.setExternalAudioSource(!1),null===(c=b.observer)||void 0===c||c.setEnableAudio(!1)),!b.isScreen&&this.safeEmit(jz.ON_USER_STOP_AUDIO_CAPTURE,{userId:S}))),T.localvideo!==I.localvideo&&(T.localvideo?(T.extvideo?(null===(u=b.observer)||void 0===u||u.setExternalVideoSource(!0),null===(d=b.observer)||void 0===d||d.setPushVideo(!0)):(null===(l=b.observer)||void 0===l||l.setExternalVideoSource(!1),null===(h=b.observer)||void 0===h||h.setEnableVideo(!0)),this.safeEmit(jz.ON_USER_START_VIDEO_CAPTURE,{userId:S})):(T.extvideo?(null===(p=b.observer)||void 0===p||p.setExternalVideoSource(!0),null===(_=b.observer)||void 0===_||_.setPushVideo(!1)):(null===(f=b.observer)||void 0===f||f.setExternalVideoSource(!1),null===(v=b.observer)||void 0===v||v.setEnableVideo(!1)),!b.isScreen&&this.safeEmit(jz.ON_USER_STOP_VIDEO_CAPTURE,{userId:S}))),A&&!R&&(null===(m=b.observer)||void 0===m||m.setRemoteUnmuteAudio(C)),O&&!w&&(null===(y=b.observer)||void 0===y||y.setRemoteUnmuteVideo(k)),b.attributes=T}},t.prototype._onPushTrack=function(e){var t=this,i=e.clientId,r=e.streamId,n=this._findRemoteStream(i,r);n||(n=this._onAddStream(e,!1,!1)),this._mediaServerClient.subscribe4pushTrack(n,e).then((function(){return t.safeEmit(jz.SUBSCRIBE_PUSH_TRACK,{stream:n})})).catch((function(e){zK.print("subscribe push track failed: ".concat(e))}))},t.prototype._onRemoveTrack=function(e){var t=this,i=e.clientId,r=e.streamId,n=e.message,o=this._findRemoteStream(i,r);o&&this._mediaServerClient.unsubscribe4removeTrack(o,n).then((function(){var e;if(o._workaround_1_){var n=null===(e=t._remoteStreams.get(i))||void 0===e?void 0:e.filter((function(e){return e.streamId!==r}));t._remoteStreams.set(i,n||[])}t.safeEmit(jz.REMOVE_PUSH_TRACK,{stream:o})})).catch((function(e){zK.print("remove push track failed: ".concat(e))}))},t.prototype._nodeChange=function(e){var t,i=e.nodes,r=e.reason;IF.clearAccessNode(null===(t=this._roomInfo)||void 0===t?void 0:t.appId),this._destroyAndInitMediaServerClient(),Array.isArray(i)&&i.length?this._getAccessNode=i[0]:this._getAccessFeedback=r,jB.rtcNodeChange(0,JSON.stringify(e),JSON.stringify(r)),this._joinResolveCallback&&this._joinRejectCallback?this._join(this._joinResolveCallback,this._joinRejectCallback):this._reconnect()},t.prototype._reconnect=function(){var e,t,i=this;this._isReconnecting=!0;try{for(var r=nf(this._remoteStreams.values()),n=r.next();!n.done;n=r.next()){var o=n.value;Array.isArray(o)&&o.forEach((function(e){return e.clean()}))}}catch(t){e={error:t}}finally{try{n&&!n.done&&(t=r.return)&&t.call(r)}finally{if(e)throw e.error}}jB.rtcReconnect(1002,KF.PEERCONNECTION_RECONNECTING,this._roomInfo.userInfo.userId,WF.PEERCONNECTION),this._join((function(){jB.rtcReconnected(XF.PEERCONNECTION_RECONNECTED,qF.PEERCONNECTION)}),(function(e){i._reconnectRecord.record(e),i._reconnectRecord.shouldReconnect?(zK.print("Reconnecting error, will reconnect after 3s",e),i._reconnectTimer=window.setTimeout(i._reconnect.bind(i),3e3)):(i.safeEmit(jz.RECONNECT_FAILED),i.destroy())}),!0)},t.prototype._handleAbnormalDisconnection=function(){zK.print("on ABNORMAL_DISCONNECTION"),this._destroyAndInitMediaServerClient(),navigator.onLine?this._reconnect():this._reconnectTimer=window.setTimeout(this._reconnect.bind(this),3e3)},t.prototype._onConnectionStateChange=function(e){var t,i=this;if(e.next===gK.DISCONNECTED)t=B_.CONNECTION_STATE_DISCONNECTED;else if(e.next===gK.CONNECTED)clearTimeout(this._connectionLostTimer),t=this._isReconnecting?B_.CONNECTION_STATE_RECONNECTED:B_.CONNECTION_STATE_CONNECTED;else{if(e.next!==gK.CONNECTING)return;t=this._isReconnecting?B_.CONNECTION_STATE_RECONNECTING:B_.CONNECTION_STATE_CONNECTING}e.prev===gK.CONNECTED&&e.next===gK.DISCONNECTED&&(this._connectionLostTimer=window.setTimeout((function(){i.safeEmit(yG.ON_CONNECTION_STATE_CHANGE,{state:B_.CONNECTION_STATE_LOST})}),1e4)),this._networkQualityManager.setConnectionState(e.next),this.safeEmit(yG.ON_CONNECTION_STATE_CHANGE,{state:t})},t.prototype._initStreamListeners=function(e){var t=this;e.on("ontrack",(function(e){e.track})),e.on("onSEIMessage",(function(i){var r;t.emit(jz.ON_SEI_MESSAGED_RECEIVED,{sei:i,remoteStreamKey:{userId:e.userId,roomId:null===(r=t._roomInfo)||void 0===r?void 0:r.roomId,streamIndex:e.isScreen?x_.STREAM_INDEX_SCREEN:x_.STREAM_INDEX_MAIN}})}))},t.prototype._onCustomMessage=function(e){this.safeEmit(vG.ON_CUSTOM_MESSAGE,e)},t.prototype._onUserMessageReceived=function(e){this.safeEmit(vG.USER_MESSAGE_RECEIVED,{userId:e.from,message:e.msg})},t.prototype._onUserBinaryMessageReceived=function(e){this.safeEmit(vG.USER_BINARY_MESSAGE_RECEIVED,{userId:e.from,message:e.msg})},t.prototype._onPostProcessingMessage=function(e){if(e.body){var t=e.body,i=t.error||0,r=Hz.START,n=["success","parameter error","subscription timeout","ffmpeg error","cdn error","publish error"];if("2.0"===t.protocol){switch(t.eventType){case"TranscodeStarted":0!==t.error&&(r=Hz.START_FAILED);break;case"TranscodeStateChanged":r=0!==t.error?Hz.START_FAILED:Hz.START_SUCCESS;break;case"TranscodeStopped":r=0!==t.error?Hz.STOP_FAILED:Hz.STOP_SUCCESS;break;case"TranscodeUpdated":r=0!==t.error?Hz.UPDATE_FAILED:Hz.UPDATE_SUCCESS}this.safeEmit(vG.POST_PROCESSING_MESSAGE,{code:i,protocol:t.protocol,error:t.error,eventType:r,message:n[i]})}this.safeEmit(vG.POST_PROCESSING_MESSAGE,{code:i,message:n[i],type:e.type})}},t.prototype._onUserTokenWillExpire=function(){this.safeEmit(vG.ON_USER_TOKEN_WILL_EXPIRE,null)},t.prototype._onSceneConfig=function(e){},t.prototype._onStreamFailed=function(e){var t,i,r,n,o,a;return tf(this,void 0,void 0,(function(){var s,c,u;return rf(this,(function(d){switch(d.label){case 0:return"publish"!==e.type?[3,2]:(s=void 0,(null===(t=this.localStream)||void 0===t?void 0:t.streamId)===e.streamId?s=this.localStream:(null===(i=this.localScreenStream)||void 0===i?void 0:i.streamId)===e.streamId&&(s=this.localScreenStream),s?(null==s||s.clean(),[4,null===(r=this._mediaServerClient)||void 0===r?void 0:r.unpublish(s).catch((function(){}))]):[2]);case 1:return d.sent(),null===(n=this._mediaServerClient)||void 0===n||n.publish(s).catch((function(){})),[3,5];case 2:return"subscribe"!==e.type?[3,5]:(c=this._remoteStreamStreamIdUserIdMap[e.streamId],(u=this._findRemoteStream(c,e.streamId))?[4,null===(o=this._mediaServerClient)||void 0===o?void 0:o.unsubscribe(u,V_.AUDIO_AND_VIDEO)]:[3,5]);case 3:return d.sent(),[4,null===(a=this._mediaServerClient)||void 0===a?void 0:a.subscribe(u,u.subMediaType,u.subLayer)];case 4:d.sent(),this.safeEmit(jz.RESUBSCRIBE,{stream:u}),d.label=5;case 5:return[2]}}))}))},t.prototype._onStreamControlMessage=function(e){var t,i;e.type===fG.PushLimitWarn&&((null===(t=this._localStream)||void 0===t?void 0:t.pubAudio)||(null===(i=this._localStream)||void 0===i?void 0:i.pubVideo)||this.unpublish())},t.prototype._onPublishOnDemand=function(){var e,t,i,r,n,o,a,s,c,u,d;return tf(this,void 0,void 0,(function(){var l,h,p,_,f,v,m,y,S;return rf(this,(function(g){switch(g.label){case 0:return this._publishOnDemandBusy||!1===(null===(i=null===(t=null===(e=this._serverConfig)||void 0===e?void 0:e.engine_VPM)||void 0===t?void 0:t.ondemand)||void 0===i?void 0:i.enable)?[2]:(l=this._publishOnDemandItem,this._publishOnDemandItem=void 0,l?(null===(r=this._localStream)||void 0===r?void 0:r.enableSimulcast)&&(null===(n=this._localStream)||void 0===n?void 0:n.videoTransceiver)?(this._publishOnDemandBusy=!0,h=null===(o=this._localStream)||void 0===o?void 0:o.stream.id,p=null===(a=this._localStream)||void 0===a?void 0:a.videoTransceiver.sender,(_=p.getParameters())&&Array.isArray(_.encodings)&&Array.isArray(l)&&(f={},zK.print("_onPublishOnDemand exec","usedDescriptions: %o",l),l.forEach((function(e){var t;if(null===(t=null==e?void 0:e.StreamIds)||void 0===t?void 0:t.includes(h)){var i=null==e?void 0:e.Metadata.SubvideoIndex;f[i]=i}})),v={},null===(c=null===(s=this._localStream)||void 0===s?void 0:s.subVideoDescriptions)||void 0===c||c.forEach((function(e){void 0!==f[e.sub_index]&&(v[e.video_index]=e)})),m=(null===(d=null===(u=p.track)||void 0===u?void 0:u.getSettings())||void 0===d?void 0:d.height)||720,y=[],S=0,_.encodings=_.encodings.map((function(e){return e.rid&&(v[e.rid]?(e.active=!0,e.scaleResolutionDownBy=Math.max(m/v[e.rid].height,1),y.push({type:1,rid:e.rid,downBy:e.scaleResolutionDownBy,bitrate:e.maxBitrate})):(S++,y.push({type:0,rid:e.rid}),e.active=!1)),e})),S===_.encodings.length&&(_.encodings[0].active=!0,jB.rtcInvokeStatus(JSON.stringify(y),0,"rscp_error",h,0)),jB.rtcInvokeStatus(JSON.stringify(y),0,"rscp",h,0)),[4,p.setParameters(_)]):[3,2]:[2]);case 1:g.sent(),this._publishOnDemandBusy=!1,g.label=2;case 2:return this._onPublishOnDemand(),[2]}}))}))},t.prototype._reportNetworkQuality=function(e,t){this._subFallbackManager.updateNetworkQuality(e,t),this.emit(jz.ON_NETWORK_QUALITY,e,t)},t.prototype._emitVideoSizeChange=function(e,t,i,r){var n;this.emit(jz.ON_REMOTE_VIDEO_SIZE_CHANGED,{roomId:null===(n=this.roomInfo)||void 0===n?void 0:n.roomId,userId:e,streamIndex:t?x_.STREAM_INDEX_SCREEN:x_.STREAM_INDEX_MAIN},{width:i,height:r})},t.prototype._emitSubscribeFallback=function(e){this.emit(jz.ON_SIMULCAST_SUBSCRIBE_FALLBACK,e)},t}(VB),WK=function(){function e(){this._all_201_count=0,this._has_4xx=!1}return Object.defineProperty(e.prototype,"shouldReconnect",{get:function(){return!(this._all_201_count>=3||this._has_4xx)},enumerable:!1,configurable:!0}),e.prototype.record=function(e){var t=!1,i=!1;if(Array.isArray(e)){var r=0;e.map((function(e){var t,n,o;400<=(null===(t=e.error)||void 0===t?void 0:t.code)&&(null===(n=e.error)||void 0===n?void 0:n.code)<500&&(i=!0),201===(null===(o=e.error)||void 0===o?void 0:o.code)&&r++})),r===e.length&&(t=!0),t&&this._all_201_count++,i&&(this._has_4xx=!0)}},e.prototype.clear=function(){this._all_201_count=0,this._has_4xx=!1},e}(),XK=function(e,t){void 0===t&&(t={});var i=document.createElement(e);return t.id&&(i.id=t.id),t.classList&&t.classList.forEach((function(e){i.classList.add(e)})),t.style&&Object.assign(i.style,t.style),t.attributes&&Object.entries(t.attributes).forEach((function(e){var t=of(e,2),r=t[0],n=t[1];"muted"===r?i.muted=!0:i.setAttribute(r,n)})),i},qK=new LB("Player",0),YK=new(function(e){function t(){var t=e.call(this)||this;return t._audioPlayMap=new Map,document.body?t._listenPageClick():window.addEventListener("load",(function(){t._listenPageClick()})),t}return C_(t,e),Object.defineProperty(t.prototype,"players",{get:function(){return this._audioPlayMap},enumerable:!1,configurable:!0}),t.prototype._listenPageClick=function(){document.body.addEventListener("touchstart",this.resumeAudioPlayer.bind(this),!0),document.body.addEventListener("mousedown",this.resumeAudioPlayer.bind(this),!0)},t.prototype.resumeAudioPlayer=function(){this._audioPlayMap.forEach((function(e){e._hasManuallyPause||e.manuallyPlay().then((function(e){})).catch((function(e){qK.print("Replay audio player failed!",e)}))}))},t.prototype.addRequestClickPlayer=function(e){this._audioPlayMap.get(e.userId)||(qK.print("Put ".concat(e.userId," player into waiting array")),this._audioPlayMap.set(e.userId,e))},t.prototype.removeRequestClickPlayer=function(e){qK.print("Remove ".concat(e.userId," player from waiting array")),this._audioPlayMap.delete(e.userId)},t}(NB)),JK=new LB("Player",0),QK=["play","playing","pause","ended","error","seeking","seeked","waiting","canplay","canplaythrough","durationchange","volumechange","loadedmetadata","loadeddata","loadstart","timeupdate"],ZK={playsinline:"","webkit-playsinline":""},$K={playsinline:"","webkit-playsinline":"","x5-playsinline":"","x5-video-player-type":"h5","x-webkit-airplay":"allow",preload:"",muted:""},eW=function(e){function t(t){var i=e.call(this)||this;i.mirrorType=j_.MIRROR_TYPE_NONE,i.played=!1,i._emitPlayFailed=!1,i._hasManuallyPause=!1,i.emitVideoEvent=function(e){var t,r,n={type:"video",rawEvent:e,readyState:(null===(t=i._videoDom)||void 0===t?void 0:t.readyState)||0,userId:i.userId,eventName:e.type,currentTime:(null===(r=i._videoDom)||void 0===r?void 0:r.currentTime)||0,isScreen:i.isScreen};switch(i.emit("playback_event",n),e.type){case"canplay":case"loadeddata":i._internalPlay();break;case"playing":JK.print("VideoPlayerPlaying","[userId-".concat(i.userId,"] video element playing"))}},i._internalPlay=function(){var e,t;if(JB("_internalPlay video",{paused:null===(e=i._videoDom)||void 0===e?void 0:e.paused,manuallyPause:i._hasManuallyPause}),!i._hasManuallyPause&&(null===(t=i._videoDom)||void 0===t?void 0:t.paused)){var r=i._videoDom.play();(null==r?void 0:r.then)&&r.catch((function(e){var t,r,n,o;if(!i._emitPlayFailed){if("AbortError"===e.name)return jB.rtcError("video play failed, userId: ".concat(i.userId,", ").concat(e.name," ").concat(e.message),-1e3),void i.emit("playback_event",{type:"video",rawEvent:e,readyState:(null===(t=i._videoDom)||void 0===t?void 0:t.readyState)||0,userId:i.userId,eventName:"play-error",currentTime:(null===(r=i._videoDom)||void 0===r?void 0:r.currentTime)||0,isScreen:i.isScreen});i._emitPlayFailed=!0,jB.rtcError("video autoplay failed, userId: ".concat(i.userId,", ").concat(e.name," ").concat(e.message),-1e3),i.emit("playback_event",{type:"video",rawEvent:e,readyState:(null===(n=i._videoDom)||void 0===n?void 0:n.readyState)||0,userId:i.userId,eventName:"autoplay-error",currentTime:(null===(o=i._videoDom)||void 0===o?void 0:o.currentTime)||0,isScreen:i.isScreen})}}))}};var r=t.renderDom,n=t.userId;i.renderMode=void 0!==t.renderMode?t.renderMode:U_.RENDER_MODE_FIT;var o="string"==typeof r?document.getElementById(r):r;if(!o)throw new Vj(Nj.CANT_FIND_DOM,"can't find video dom ",r);return i._videoContainer=document.createElement("div"),i._videoContainer.style.width="100%",i._videoContainer.style.height="100%",i._videoContainer.style.position="relative",i._videoContainer.style.overflow="hidden",i._containerDom=o,i.userId=n,i.isScreen=!!t.isScreen,i._initVideo(),i._pausedTimer=setInterval((function(){i._videoDom&&(i._prevPaused!==i._videoDom.paused&&JK.print("VideoPlayer.videoDom.pausedChange",i._videoDom.paused),i._prevPaused=i._videoDom.paused)}),500),EU&&15===TU&&(i._safari15VideoTimer=window.setInterval((function(){try{i._videoContainer.style.display="block",setTimeout((function(){i._videoContainer.style.display="flex"}),500)}catch(e){}}),5e3)),i}return C_(t,e),t.prototype._initVideo=function(){this._videoDom||(this._videoDom=XK("video",{style:{width:"100%",height:"100%"},attributes:$K}),this._videoDom.id="".concat(this.userId,"_").concat(_U()),this.renderMode===U_.RENDER_MODE_FIT?this._videoDom.style.objectFit="contain":this._videoDom.style.objectFit="cover",this.mirror(this.mirrorType===j_.MIRROR_TYPE_RENDER)),this._videoContainer.appendChild(this._videoDom),this._containerDom.appendChild(this._videoContainer),this._initListeners()},t.prototype._initListeners=function(){var e=this;this._videoDom&&QK.forEach((function(t){var i;null===(i=e._videoDom)||void 0===i||i.addEventListener(t,e.emitVideoEvent)}))},t.prototype._removeListeners=function(){var e,t,i=this;this._videoDom&&(QK.forEach((function(e){var t;null===(t=i._videoDom)||void 0===t||t.removeEventListener(e,i.emitVideoEvent)})),null===(e=this._videoDom)||void 0===e||e.removeEventListener("canplay",this._internalPlay),null===(t=this._videoDom)||void 0===t||t.removeEventListener("loadeddata",this._internalPlay))},t.prototype._recordFrame=function(e){var t=this;this.on("playback_event",(function(i){var r;if("timeupdate"===i.eventName){var n=e.isScreen?1.5:.5;if(0===(null===(r=t._videoDom)||void 0===r?void 0:r.currentTime))return;if(void 0===t.__cumulativeTime)return void(t.__cumulativeTime=t._videoDom.currentTime);if(e.recordedVideoFrames||(e.recordedVideoFrames=[]),t._videoDom.currentTime>t.__cumulativeTime){var o=Math.floor(1e3*(t._videoDom.currentTime-t.__cumulativeTime)),a=t._videoDom.currentTime-t.__cumulativeTime>n;e.recordedVideoFrames.push({playTime:t._videoDom.currentTime,isStall:a,stallCount:a?1:0,stallDuration:o%2e3})}t.__cumulativeTime=t._videoDom.currentTime}}))},t.prototype.playVideo=function(e,t){var i;return tf(this,void 0,void 0,(function(){var t,r,n=this;return rf(this,(function(o){if(t=this._videoDom,JK.print("playVideo","play video track: ".concat(this.userId)),t&&t.srcObject instanceof MediaStream&&t.srcObject.getTrackById(null===(i=e.getTrack())||void 0===i?void 0:i.id)){try{jB.rtcInvokeStatus("play video repeatedly",0,"playVideo",this.userId,0)}catch(e){}return[2]}return t||(this._initVideo(),t=this._videoDom),JK.print("playVideo","play video by dom: ".concat(null==t?void 0:t.id)),(r=new MediaStream).addTrack(e.getTrack()),t.srcObject=r,t&&!this._containerDom.contains(this._videoContainer)&&this._containerDom.appendChild(this._videoContainer),t&&!this._videoContainer.contains(t)&&this._videoContainer.appendChild(t),setTimeout((function(){return n._internalPlay()})),this.played=!0,[2]}))}))},t.prototype.updateSrcObject=function(e){var t=e.getTrack();if(t&&this._videoDom){var i=new MediaStream;i.addTrack(t),this._videoDom.srcObject=i}},t.prototype.manuallyPause=function(){if(JK.print("Invoke VideoPlayer.manuallyPause",this.userId,this.isScreen),this.played){if(this._hasManuallyPause=!0,!this._videoDom)throw new Vj(Nj.INVALID_PARAMS,"Player not found");return this._videoDom.pause()}},t.prototype.manuallyPlay=function(){if(JK.print("Invoke VideoPlayer.manuallyPlay",this.userId,this.isScreen),this._emitPlayFailed=!1,this._hasManuallyPause=!1,!this._videoDom)throw new Vj(Nj.INVALID_PARAMS,"Player not found");return 0!==this._videoDom.readyState||RU?this._videoDom.play():Promise.resolve()},t.prototype.mirror=function(e){JK.print("mirror","".concat(this.userId," set mirror: ").concat(e)),this.mirrorType=e?j_.MIRROR_TYPE_RENDER:j_.MIRROR_TYPE_NONE,this._videoDom&&(this._videoDom.style.transform=e?"rotateY(180deg)":"")},t.prototype.stop=function(){var e,t=this._containerDom;JK.print("stop","stop video track: ".concat(this.userId)),this._videoDom&&(this._videoDom.srcObject=null,(null==t?void 0:t.contains(this._videoContainer))&&t.removeChild(this._videoContainer),(null===(e=this._videoContainer)||void 0===e?void 0:e.contains(this._videoDom))&&this._videoContainer.removeChild(this._videoDom),clearInterval(this._pausedTimer)),this.__cumulativeTime=void 0,this.played=!1},t.prototype.destroy=function(){JK.print("destroy","video player: ".concat(this.userId)),this.stop(),e.prototype.removeAllListeners.call(this),this._removeListeners(),this._videoDom&&(this._videoDom.srcObject=null,delete this._videoDom),this._safari15VideoTimer&&(window.clearInterval(this._safari15VideoTimer),this._safari15VideoTimer=void 0)},Object.defineProperty(t.prototype,"domElement",{get:function(){return this._videoDom},enumerable:!1,configurable:!0}),t}(xF.exports.EventEmitter),tW=new(function(){function e(){this._context=rU.getAudioContextInstance()}return e.prototype.getDestinationNode=function(){return this._context.destination},e.prototype.createMediaElementSource=function(e){return this._context.createMediaElementSource(e)},e}()),iW=null,rW=function(e){function t(t,i){var r=void 0===i?{divId:void 0,muted:!1,isScreen:!1,useWebAudio:!1}:i,n=r.divId,o=r.muted,a=r.isScreen,s=r.useWebAudio,c=e.call(this)||this;if(c._stallCount=0,c.muted=!1,c._emitPlayFailed=!1,c._hasManuallyPause=!1,c.played=!1,c._useWebAudio=!1,c.emitAudioEvent=function(e){var t,i,r={type:"audio",rawEvent:e,readyState:(null===(t=c._audioDom)||void 0===t?void 0:t.readyState)||0,userId:c.userId,eventName:e.type,currentTime:(null===(i=c._audioDom)||void 0===i?void 0:i.currentTime)||0,isScreen:c.isScreen};"playing"===e.type&&(JK.print("AudioPlayerPlaying","[userId-".concat(c.userId,"] audio element playing")),AU&&(iW||(iW=window.setTimeout((function(){JK.print("AudioPlayerPlaying","[userId-".concat(c.userId,"] audio playing workaround"));var e=new AudioContext;e.close(),e=null,iW=null}),2500)))),"pause"===e.type&&JK.print("AudioPlayerPause","[userId-".concat(c.userId,"] audio element pause")),CU&&RU&&("canplay"===e.type?(clearTimeout(c._wechatTimer),c._wechatTimer=window.setTimeout((function(){c._autoPlayError("wechat")}),500)):"playing"===e.type&&clearTimeout(c._wechatTimer)),c.emit("playback_event",r)},c._internalPlay=function(){var e,t;if(JB("_internalPlay audio",{paused:null===(e=c._audioDom)||void 0===e?void 0:e.paused,manuallyPause:c._hasManuallyPause}),!c._hasManuallyPause&&(null===(t=c._audioDom)||void 0===t?void 0:t.paused)){try{var i=c._audioDom.play();c._audioDom.volume=1,(null==i?void 0:i.then)&&i.catch((function(e){c._autoPlayError(e),jB.rtcError("audio autoplay failed, userId: ".concat(c.userId,": ").concat(e.message," ").concat(e.name),-1e3)})).then((function(){JB("_internalPlay successfully",{userId:c.userId})}))}catch(e){c._autoPlayError(e),jB.rtcError("audio autoplay failed, userId: ".concat(c.userId,": ").concat(e.message," ").concat(e.name),-1e3)}CU&&YK.addRequestClickPlayer(c)}},n){var u=document.getElementById(n);if(!u)throw new Vj(Nj.CANT_FIND_DOM,"can't find audio dom ".concat(n));c._containerDom=u}else c._containerDom=document.body;return c.userId=t,c.muted=o,c.isScreen=a,c._useWebAudio=!!s,c._initAudio(),c}return C_(t,e),t.prototype._initAudio=function(){this._audioDom||(this._audioDom=XK("audio",{style:{display:"none"},attributes:ZK}),this._audioDom.volume=this.muted?0:1,this._audioDom.muted=this.muted,this._audioDom.id="".concat(this.userId,"_").concat(_U()),this._containerDom.appendChild(this._audioDom),this._useWebAudio&&(this._sourceNode=tW.createMediaElementSource(this._audioDom),this._sourceNode.connect(tW.getDestinationNode()),JK.print("AudioPlayer","[userId-".concat(this.userId,"] use web audio output")))),this._initListeners()},t.prototype._initListeners=function(){var e=this;this._audioDom&&QK.forEach((function(t){var i;null===(i=e._audioDom)||void 0===i||i.addEventListener(t,e.emitAudioEvent)}))},t.prototype._removeListeners=function(){var e=this;this._audioDom&&(QK.forEach((function(t){var i;null===(i=e._audioDom)||void 0===i||i.removeEventListener(t,e.emitAudioEvent)})),this._audioDom.removeEventListener("canplay",this._internalPlay),this._audioDom.removeEventListener("loadeddata",this._internalPlay))},t.prototype.playAudio=function(e){var t;return tf(this,void 0,void 0,(function(){var i,r,n=this;return rf(this,(function(o){return JK.print("playAudio","play audio track: ".concat(this.userId)),this._track=e,(i=this._audioDom)&&i.srcObject instanceof MediaStream&&i.srcObject.getTrackById(null===(t=e.getTrack())||void 0===t?void 0:t.id)?(i.paused&&this._internalPlay(),[2]):(i||(this._initAudio(),i=this._audioDom),(r=new MediaStream).addTrack(e.getTrack()),i.srcObject=r,null==i||i.addEventListener("canplay",this._internalPlay),null==i||i.addEventListener("loadeddata",this._internalPlay),setTimeout((function(){return n._internalPlay()})),this.played=!0,[2])}))}))},t.prototype._autoPlayError=function(e){var t,i;this._emitPlayFailed||(this._emitPlayFailed=!0,jB.rtcError("audio autoplay failed, userId: ".concat(this.userId,": ").concat(e.message),-1e3),this.emit("playback_event",{type:"audio",rawEvent:e,readyState:(null===(t=this._audioDom)||void 0===t?void 0:t.readyState)||0,userId:this.userId,eventName:"autoplay-error",currentTime:(null===(i=this._audioDom)||void 0===i?void 0:i.currentTime)||0,isScreen:this.isScreen}))},t.prototype.manuallyPause=function(){if(JK.print("Invoke AudioPlayer.manuallyPause",this.userId,this.isScreen),this.played){if(this._hasManuallyPause=!0,!this._audioDom)throw new Vj(Nj.INVALID_PARAMS,"Player not found");return this._audioDom.pause()}},t.prototype.manuallyPlay=function(){var e;if(this._emitPlayFailed=!1,this._hasManuallyPause=!1,!this._audioDom)throw new Vj(Nj.INVALID_PARAMS,"Player not found");rU.resume(),this._audioDom.volume=1,this._audioDom.muted=!1,null===(e=this._fakeAudioDom)||void 0===e||e.play();var t=this._audioDom.play();return(null==t?void 0:t.then)?t:Promise.resolve(t)},t.prototype.setPlaybackDevice=function(e){return tf(this,void 0,void 0,(function(){var t;return rf(this,(function(i){switch(i.label){case 0:return JK.print("setPlaybackDevice","setPlaybackDevice: ".concat(e)),[4,sz.enumerateAudioPlaybackDevices()];case 1:return t=i.sent(),t.map((function(e){return e.deviceId})).includes(e)&&this._audioDom&&this._audioDom.setSinkId?[4,this._audioDom.setSinkId(e)]:[2];case 2:return i.sent(),[2]}}))}))},t.prototype.stop=function(){var e,t=this._containerDom;JK.print("stopAudio","stop audio track: ".concat(this.userId)),this._useWebAudio&&(null===(e=this._sourceNode)||void 0===e||e.disconnect()),this._audioDom&&(this._audioDom.srcObject=null,t&&t.contains(this._audioDom)&&t.removeChild(this._audioDom)),this._fakeAudioDom&&(this._fakeAudioDom.srcObject=null,this._fakeAudioDom=void 0)},Object.defineProperty(t.prototype,"domElement",{get:function(){return this._audioDom},enumerable:!1,configurable:!0}),t.prototype.destroy=function(){JK.print("destroy","audio player: ".concat(this.userId)),this.stop(),e.prototype.removeAllListeners.call(this),this._removeListeners(),delete this._track,this._audioDom&&(this._audioDom.srcObject=null,delete this._audioDom),this._useWebAudio&&delete this._sourceNode,CU&&YK.removeRequestClickPlayer(this)},t}(xF.exports.EventEmitter);function nW(e,t,i,r){var n=this,o=function(e,t){return tf(n,void 0,void 0,(function(){var n;return rf(this,(function(o){switch(o.label){case 0:return n=null==r?void 0:r.get(t),Array.isArray(n)&&(n=null==n?void 0:n.find((function(e){return e.isScreen===i}))),e?e.played?[4,e.manuallyPlay()]:[3,2]:[3,3];case 1:return o.sent(),[3,3];case 2:n&&(e instanceof eW&&n.videoTrack&&e.playVideo(n.videoTrack,n),e instanceof rW&&n.audioTrack&&e.playAudio(n.audioTrack)),o.label=3;case 3:return[2]}}))}))};if(t)return o(e.get(t),t);var a=[];return e.forEach((function(e,t){return a.push(o(e,t))})),Promise.all(a)}var oW=function(){function e(){this.userMessage={},this.roomMessage={},this._setTimer()}return e.prototype._setTimer=function(){var e=this;!function t(){e._reportAndgReset(),clearTimeout(e._timer),e._timer=setTimeout(t,1e4)}()},e.prototype._reportAndgReset=function(){this._report(),this._reset()},e.prototype._report=function(){var e=this;jB.rtcMessageStatistics(Object.keys(this.userMessage).map((function(t){return e.userMessage[t]})),Object.keys(this.roomMessage).map((function(t){return e.roomMessage[t]})),"")},e.prototype._reset=function(){this.userMessage={},this.roomMessage={}},e.prototype._checkInitUserMessage=function(e,t){this.userMessage["".concat(t,"-").concat(e)]||(this.userMessage["".concat(t,"-").concat(e)]={dc_peer_user_id:e,dc_send_total:0,dc_recv_total:0,dc_send_ack:0,dc_send_fail:0,dc_cost_time:0,dc_cost_e2s:0,dc_cost_s2s:0,dc_least_time:1/0,dc_most_time:0,dc_cost_peer_s2e:0,dc_send_ack_100:0,dc_send_ack_200:0,dc_send_ack_400:0,dc_send_ack_1s:0,dc_message_type:t,dc_send_binary:0})},e.prototype._sendUserMessage=function(e,t,i){this._checkInitUserMessage(e,t),this.userMessage["".concat(t,"-").concat(e)].dc_send_total++,i&&this.userMessage["".concat(t,"-").concat(e)].dc_send_binary++},e.prototype._recvUserMessage=function(e,t){this._checkInitUserMessage(e,t),this.userMessage["".concat(t,"-").concat(e)].dc_recv_total++},e.prototype._sendUserFail=function(e,t){var i=this.userMessage["".concat(t,"-").concat(e)];i&&i.dc_send_fail++},e.prototype._sendUserAck=function(e,t,i,r,n){var o=this.userMessage["".concat(t,"-").concat(e)];o&&(o.dc_send_ack++,o.dc_cost_time+=i,o.dc_cost_s2s+=r||0,o.dc_cost_peer_s2e+=n,o.dc_cost_e2s+=i-(r||0)-n,i<=100?(o.dc_send_ack_100++,o.dc_send_ack_200++,o.dc_send_ack_400++,o.dc_send_ack_1s++):i<=200?(o.dc_send_ack_200++,o.dc_send_ack_400++,o.dc_send_ack_1s++):i<=400?(o.dc_send_ack_400++,o.dc_send_ack_1s++):i<=1e3&&o.dc_send_ack_1s++,i<o.dc_least_time&&(o.dc_least_time=i),i>o.dc_most_time&&(o.dc_most_time=i))},e.prototype.sendRoomMessage=function(e,t){this.roomMessage[e]||(this.roomMessage[e]={dc_room_id:e,dc_send_total:0,dc_send_ack:0,dc_cost_time:0,dc_least_time:1/0,dc_most_time:0,dc_send_fail:0,dc_send_ack_100:0,dc_send_ack_200:0,dc_send_ack_400:0,dc_send_ack_1s:0,dc_send_binary:0}),this.roomMessage[e].dc_send_total++,t&&this.roomMessage[e].dc_send_binary++},e.prototype.sendRoomFail=function(e){var t=this.roomMessage[e];t&&t.dc_send_fail++},e.prototype.sendRoomAck=function(e,t){var i=this.roomMessage[e];i&&(i.dc_send_ack++,i.dc_cost_time+=t,t<i.dc_least_time&&(i.dc_least_time=t),t>i.dc_most_time&&(i.dc_most_time=t),t<=100?(i.dc_send_ack_100++,i.dc_send_ack_200++,i.dc_send_ack_400++,i.dc_send_ack_1s++):t<=200?(i.dc_send_ack_200++,i.dc_send_ack_400++,i.dc_send_ack_1s++):t<=400?(i.dc_send_ack_400++,i.dc_send_ack_1s++):t<=1e3&&i.dc_send_ack_1s++)},e.prototype.sendP2PMessage=function(e,t){this._sendUserMessage(e,IB.P2P,t)},e.prototype.recvP2PMessage=function(e){this._recvUserMessage(e,IB.P2P)},e.prototype.sendP2PFail=function(e){this._sendUserFail(e,IB.P2P)},e.prototype.sendP2PAck=function(e,t,i,r){this._sendUserAck(e,IB.P2P,t,i,r)},e.prototype.sendP2POutRoomMessage=function(e,t){this._sendUserMessage(e,IB.P2P_OUTSIDE_ROOM,t)},e.prototype.recvP2POutRoomMessage=function(e){this._recvUserMessage(e,IB.P2P_OUTSIDE_ROOM)},e.prototype.sendP2POutRoomFail=function(e){this._sendUserFail(e,IB.P2P_OUTSIDE_ROOM)},e.prototype.sendP2POutRoomAck=function(e,t,i,r){this._sendUserAck(e,IB.P2P_OUTSIDE_ROOM,t,i,r)},e.prototype.sendP2serverMessage=function(e){this._sendUserMessage("",IB.P2SERVER,e)},e.prototype.sendP2serverFail=function(){this._sendUserFail("",IB.P2SERVER)},e.prototype.sendP2serveAck=function(e){this._sendUserAck("",IB.P2SERVER,e,0,0)},e.prototype.countP2PMessage=function(e,t,i,r,n){this.sendP2PMessage(t,i),e?this.sendP2PAck(t,Date.now()-r,n.s2s_time,n.s2e_time):this.sendP2PFail(t)},e.prototype.countRoomMessage=function(e,t,i,r){this.sendRoomMessage(t,i),e?this.sendRoomAck(t,Date.now()-r):this.sendRoomFail(t)},e.prototype.countUserMessageOutsideRoom=function(e,t,i,r,n){this.sendP2POutRoomMessage(t,i),e?this.sendP2POutRoomAck(t,Date.now()-r,n.s2s_time,n.s2e_time):this.sendP2POutRoomFail(t)},e.prototype.countServerMessage=function(e,t,i){this.sendP2serverMessage(t),e?this.sendP2serveAck(Date.now()-i):this.sendP2serverFail()},e.prototype.destroy=function(){this._reset(),clearTimeout(this._timer)},e}(),aW="object"==("undefined"==typeof global?"undefined":t(global))&&global&&global.Object===Object&&global,sW="object"==("undefined"==typeof self?"undefined":t(self))&&self&&self.Object===Object&&self,cW=aW||sW||Function("return this")(),uW=cW.Symbol,dW=Object.prototype,lW=dW.hasOwnProperty,hW=dW.toString,pW=uW?uW.toStringTag:void 0;var _W=Object.prototype.toString;var fW=uW?uW.toStringTag:void 0;function vW(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":fW&&fW in Object(e)?function(e){var t=lW.call(e,pW),i=e[pW];try{e[pW]=void 0;var r=!0}catch(e){}var n=hW.call(e);return r&&(t?e[pW]=i:delete e[pW]),n}(e):function(e){return _W.call(e)}(e)}function mW(e){return null!=e&&"object"==t(e)}var yW=Array.isArray;function SW(e){var i=t(e);return null!=e&&("object"==i||"function"==i)}function gW(e){return e}function EW(e){if(!SW(e))return!1;var t=vW(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t}var bW=cW["__core-js_shared__"],IW=function(){var e=/[^.]+$/.exec(bW&&bW.keys&&bW.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}();var TW=Function.prototype.toString;var AW=/^\[object .+?Constructor\]$/,RW=Function.prototype,CW=Object.prototype,OW=RW.toString,wW=CW.hasOwnProperty,kW=RegExp("^"+OW.call(wW).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function NW(e){return!(!SW(e)||(t=e,IW&&IW in t))&&(EW(e)?kW:AW).test(function(e){if(null!=e){try{return TW.call(e)}catch(e){}try{return e+""}catch(e){}}return""}(e));var t}function PW(e,t,i){switch(i.length){case 0:return e.call(t);case 1:return e.call(t,i[0]);case 2:return e.call(t,i[0],i[1]);case 3:return e.call(t,i[0],i[1],i[2])}return e.apply(t,i)}var DW=Date.now;var MW,LW,UW,xW=function(){try{var e=function(e,t){var i=function(e,t){return null==e?void 0:e[t]}(e,t);return NW(i)?i:void 0}(Object,"defineProperty");return e({},"",{}),e}catch(e){}}(),VW=xW,FW=VW?function(e,t){return VW(e,"toString",{configurable:!0,enumerable:!1,value:(i=t,function(){return i}),writable:!0});var i}:gW,BW=(MW=FW,LW=0,UW=0,function(){var e=DW(),t=16-(e-UW);if(UW=e,t>0){if(++LW>=800)return arguments[0]}else LW=0;return MW.apply(void 0,arguments)}),jW=BW,GW=/^(?:0|[1-9]\d*)$/;function HW(e,i){var r=t(e);return!!(i=null==i?9007199254740991:i)&&("number"==r||"symbol"!=r&&GW.test(e))&&e>-1&&e%1==0&&e<i}function zW(e,t,i){"__proto__"==t&&VW?VW(e,t,{configurable:!0,enumerable:!0,value:i,writable:!0}):e[t]=i}function KW(e,t){return e===t||e!=e&&t!=t}var WW=Object.prototype.hasOwnProperty;function XW(e,t,i){var r=e[t];WW.call(e,t)&&KW(r,i)&&(void 0!==i||t in e)||zW(e,t,i)}var qW=Math.max;function YW(e,t){return jW(function(e,t,i){return t=qW(void 0===t?e.length-1:t,0),function(){for(var r=arguments,n=-1,o=qW(r.length-t,0),a=Array(o);++n<o;)a[n]=r[t+n];n=-1;for(var s=Array(t+1);++n<t;)s[n]=r[n];return s[t]=i(a),PW(e,this,s)}}(e,t,gW),e+"")}function JW(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=9007199254740991}function QW(e){return null!=e&&JW(e.length)&&!EW(e)}var ZW=Object.prototype;function $W(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||ZW)}function eX(e){return mW(e)&&"[object Arguments]"==vW(e)}var tX=Object.prototype,iX=tX.hasOwnProperty,rX=tX.propertyIsEnumerable,nX=eX(function(){return arguments}())?eX:function(e){return mW(e)&&iX.call(e,"callee")&&!rX.call(e,"callee")},oX=nX;var aX="object"==("undefined"==typeof exports?"undefined":t(exports))&&exports&&!exports.nodeType&&exports,sX=aX&&"object"==("undefined"==typeof module?"undefined":t(module))&&module&&!module.nodeType&&module,cX=sX&&sX.exports===aX?cW.Buffer:void 0,uX=(cX?cX.isBuffer:void 0)||function(){return!1},dX={};dX["[object Float32Array]"]=dX["[object Float64Array]"]=dX["[object Int8Array]"]=dX["[object Int16Array]"]=dX["[object Int32Array]"]=dX["[object Uint8Array]"]=dX["[object Uint8ClampedArray]"]=dX["[object Uint16Array]"]=dX["[object Uint32Array]"]=!0,dX["[object Arguments]"]=dX["[object Array]"]=dX["[object ArrayBuffer]"]=dX["[object Boolean]"]=dX["[object DataView]"]=dX["[object Date]"]=dX["[object Error]"]=dX["[object Function]"]=dX["[object Map]"]=dX["[object Number]"]=dX["[object Object]"]=dX["[object RegExp]"]=dX["[object Set]"]=dX["[object String]"]=dX["[object WeakMap]"]=!1;var lX="object"==("undefined"==typeof exports?"undefined":t(exports))&&exports&&!exports.nodeType&&exports,hX=lX&&"object"==("undefined"==typeof module?"undefined":t(module))&&module&&!module.nodeType&&module,pX=hX&&hX.exports===lX&&aW.process,_X=function(){try{var e=hX&&hX.require&&hX.require("util").types;return e||pX&&pX.binding&&pX.binding("util")}catch(e){}}(),fX=_X&&_X.isTypedArray,vX=fX?function(e){return function(t){return e(t)}}(fX):function(e){return mW(e)&&JW(e.length)&&!!dX[vW(e)]},mX=vX,yX=Object.prototype.hasOwnProperty;function SX(e,t){var i=yW(e),r=!i&&oX(e),n=!i&&!r&&uX(e),o=!i&&!r&&!n&&mX(e),a=i||r||n||o,s=a?function(e,t){for(var i=-1,r=Array(e);++i<e;)r[i]=t(i);return r}(e.length,String):[],c=s.length;for(var u in e)!t&&!yX.call(e,u)||a&&("length"==u||n&&("offset"==u||"parent"==u)||o&&("buffer"==u||"byteLength"==u||"byteOffset"==u)||HW(u,c))||s.push(u);return s}var gX=function(e,t){return function(i){return e(t(i))}}(Object.keys,Object),EX=gX,bX=Object.prototype.hasOwnProperty;function IX(e){return QW(e)?SX(e):function(e){if(!$W(e))return EX(e);var t=[];for(var i in Object(e))bX.call(e,i)&&"constructor"!=i&&t.push(i);return t}(e)}var TX=Object.prototype.hasOwnProperty;function AX(e){if(!SW(e))return function(e){var t=[];if(null!=e)for(var i in Object(e))t.push(i);return t}(e);var t=$W(e),i=[];for(var r in e)("constructor"!=r||!t&&TX.call(e,r))&&i.push(r);return i}var RX,CX=(RX=function(e,t){!function(e,t,i,r){var n=!i;i||(i={});for(var o=-1,a=t.length;++o<a;){var s=t[o],c=r?r(i[s],e[s],s,i,e):void 0;void 0===c&&(c=e[s]),n?zW(i,s,c):XW(i,s,c)}}(t,function(e){return QW(e)?SX(e,!0):AX(e)}(t),e)},YW((function(e,i){var r=-1,n=i.length,o=n>1?i[n-1]:void 0,a=n>2?i[2]:void 0;for(o=RX.length>3&&"function"==typeof o?(n--,o):void 0,a&&function(e,i,r){if(!SW(r))return!1;var n=t(i);return!!("number"==n?QW(r)&&HW(i,r.length):"string"==n&&i in r)&&KW(r[i],e)}(i[0],i[1],a)&&(o=n<3?void 0:o,n=1),e=Object(e);++r<n;){var s=i[r];s&&RX(e,s,r,o)}return e}))),OX=CX;function wX(e,t){return function(e,t){for(var i=-1,r=null==e?0:e.length,n=Array(r);++i<r;)n[i]=t(e[i],i,e);return n}(t,(function(t){return e[t]}))}function kX(e){return null==e?[]:wX(e,IX(e))}var NX,PX=function(e,t){return tf(void 0,void 0,void 0,(function(){var i;return rf(this,(function(r){switch(r.label){case 0:i=new Audio(URL.createObjectURL(new Blob([e],t))),r.label=1;case 1:return r.trys.push([1,3,,4]),i.muted=!0,[4,i.play()];case 2:return r.sent(),i.pause(),[2,!0];case 3:return r.sent(),[2,!1];case 4:return[2]}}))}))},DX=function(){function e(e){this._sharedAudioContext=new AudioContext,this._audioDestination=this._sharedAudioContext.createMediaStreamDestination(),this._localGainNode=this._sharedAudioContext.createGain(),this._bufferGainNode=this._sharedAudioContext.createGain(),this._failedAudioList=[],this.mixingMap=new Map,this.resourcesCache=new Map,this.volumeConfig=new Map,this.cachedBuffer=[],this.id="AudioMixingManager",this._context=e,this._localGainNode.gain.value=1}return e.prototype.mixMediaStream=function(e){this._localSource&&this._localSource.disconnect(this._localGainNode),this._localSource=this._sharedAudioContext.createMediaStreamSource(e),this._localSource.connect(this._localGainNode).connect(this._audioDestination)},e.prototype.startAudioMixing=function(e,t,i){return tf(this,void 0,void 0,(function(){var r,n,o,a,s,c,u,d,l,h,p,_,f,v,m=this;return rf(this,(function(y){switch(y.label){case 0:if(r=i.playCount,Gj(n=i.type,"mixingType",kX(uf)),!(o=this._context.getLocalAudioTrack()))return[2];if((a=dz(o.getTrack()))&&this.mixMediaStream(a),(s=this.mixingMap.get(e))&&s.audioNode){s.audioNode.pause(),this._context.emitMessage({mixId:e,state:df.AUDIO_MIXING_STATE_STOPPED,error:Pj.AUDIO_MIXING_ERROR_OK});try{s.gainNode.disconnect(this._audioDestination),s.audioSource.disconnect(s.gainNode)}catch(e){}}return(u=this.resourcesCache.get(e))&&u.filePath===t?(c=u.getAudioNode(),[3,4]):[3,1];case 1:return[4,fetch(t,{mode:"cors",credentials:"include"}).then((function(t){if(t.ok)return t.arrayBuffer();throw m._context.emitMessage({mixId:e,state:df.AUDIO_MIXING_STATE_FAILED,error:Pj.AUDIO_MIXING_ERROR_START_FAILED}),new Vj(Nj.LOAD_RESOURCES_FAILED,t.statusText)}))];case 2:return d=y.sent(),l=void 0,t.endsWith("mp3")?l={type:"audio/mpeg"}:t.endsWith("aac")&&(l={type:"audio/aac"}),[4,PX(d,l)];case 3:if(!y.sent())throw this._context.emitMessage({mixId:e,state:df.AUDIO_MIXING_STATE_FAILED,error:Pj.AUDIO_MIXING_ERROR_START_FAILED}),new Vj(Nj.LOAD_RESOURCES_FAILED,"invalid audio resource");(c=new Audio).crossOrigin="anonymous",c.src=URL.createObjectURL(new Blob([d],l)),y.label=4;case 4:r<=0?c.loop=!0:r>0&&(h=r,c.onended=function(){--h>0?c.play():(m.mixingMap.delete(e),m._context.emitMessage({mixId:e,state:df.AUDIO_MIXING_STATE_FINISHED,error:Pj.AUDIO_MIXING_ERROR_OK}))}),y.label=5;case 5:return y.trys.push([5,7,,8]),[4,c.play()];case 6:return y.sent(),[3,8];case 7:return p=y.sent(),console.error(p),this._failedAudioList.push(c),this._context.onAutoPlayFailed({userId:this.id,kind:"audio",streamIndex:x_.STREAM_INDEX_MAIN,mediaType:V_.AUDIO}),[3,8];case 8:if(_=this._sharedAudioContext.createMediaElementSource(c),f=this._sharedAudioContext.createGain(),v=this.volumeConfig.get(e),f.gain.value=v?v/100:1,_.connect(f).connect(this._audioDestination),this.mixingMap.set(e,{audioSource:_,audioNode:c,gainNode:f,type:"file"}),n===uf.PUBLISH)try{f.disconnect(this._sharedAudioContext.destination)}catch(e){}else f.connect(this._sharedAudioContext.destination);return this._context.updateLocalAudioTrack(this._audioDestination.stream.getAudioTracks()[0],i.type),this._context.emitMessage({mixId:e,state:df.AUDIO_MIXING_STATE_PLAYING,error:Pj.AUDIO_MIXING_ERROR_OK}),[2]}}))}))},e.prototype.stopAudioMixing=function(e){var t=this.mixingMap.get(e);t&&"file"===t.type&&(this.mixingMap.delete(e),t.audioNode.pause(),t.audioSource.disconnect(t.gainNode),t.gainNode.disconnect(this._audioDestination),this._context.emitMessage({mixId:e,state:df.AUDIO_MIXING_STATE_STOPPED,error:Pj.AUDIO_MIXING_ERROR_OK}))},e.prototype.pauseAudioMixing=function(e){var t=this.mixingMap.get(e);t&&(this._context.emitMessage({mixId:e,state:df.AUDIO_MIXING_STATE_PAUSED,error:Pj.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:df.AUDIO_MIXING_STATE_PLAYING,error:Pj.AUDIO_MIXING_ERROR_OK}),t.audioNode.play())},e.prototype.preloadAudioMixing=function(e,t){return tf(this,void 0,void 0,(function(){var i,r=this;return rf(this,(function(n){switch(n.label){case 0:return this.stopAudioMixing(e),[4,fetch(t,{mode:"cors",credentials:"include"}).then((function(t){if(t.ok)return t.arrayBuffer();throw r._context.emitMessage({mixId:e,state:df.AUDIO_MIXING_STATE_FAILED,error:Pj.AUDIO_MIXING_ERROR_PRELOAD_FAILED}),new Vj(Nj.LOAD_RESOURCES_FAILED,t.statusText)})).catch((function(t){throw r._context.emitMessage({mixId:e,state:df.AUDIO_MIXING_STATE_FAILED,error:Pj.AUDIO_MIXING_ERROR_PRELOAD_FAILED}),new Vj(Nj.LOAD_RESOURCES_FAILED,"Load resources failed",t)}))];case 1:return i=n.sent(),[4,PX(i)];case 2:if(!n.sent())throw this._context.emitMessage({mixId:e,state:df.AUDIO_MIXING_STATE_FAILED,error:Pj.AUDIO_MIXING_ERROR_PRELOAD_FAILED}),new Vj(Nj.LOAD_RESOURCES_FAILED,"Load resources failed");return this._context.emitMessage({mixId:e,state:df.AUDIO_MIXING_STATE_PRELOADED,error:Pj.AUDIO_MIXING_ERROR_OK}),this.resourcesCache.set(e,{getAudioNode:function(){return new Audio(URL.createObjectURL(new Blob([i])))},filePath:t}),[2]}}))}))},e.prototype.unloadAudioMixing=function(e){this.resourcesCache.has(e)&&this.resourcesCache.delete(e)},e.prototype.getAudioMixingVolume=function(e){var t=this.mixingMap.get(e);return t?100*t.gainNode.gain.value:0},e.prototype.setAudioMixingVolume=function(e,t){t<0?t=0:t>400&&(t=400),this.volumeConfig.set(e,t);var i=this.mixingMap.get(e);i&&(i.gainNode.gain.value=Number(t)/100)},e.prototype.getAudioMixingDuration=function(e){var t=this.mixingMap.get(e),i=this.mixingMap.get(e);return t||i?t?1e3*t.audioNode.duration:i?1e3*i.audioNode.duration:0:0},e.prototype.getAudioMixingCurrentPosition=function(e){var t=this.mixingMap.get(e);return t?1e3*t.audioNode.currentTime:0},e.prototype.setAudioMixingPosition=function(e,t){var i=this.mixingMap.get(e);i&&(i.audioNode.currentTime=t/1e3,i.audioNode.play())},e.prototype.enableAudioMixingBuffer=function(e){Gj(e,"type",kX(uf));var t=this._context.getLocalAudioTrack();if(t){var i=dz(t.getTrack());if(i&&this.mixMediaStream(i),e===uf.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:df.AUDIO_MIXING_STATE_PCM_ENABLED,error:Pj.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:df.AUDIO_MIXING_STATE_PCM_DISABLED,error:Pj.AUDIO_MIXING_ERROR_OK})}},e.prototype.pushAudioMixingBuffer=function(e){var t=this;if(!(this._audioBufferSource&&(this.cachedBuffer.push(e),this.cachedBuffer.length>0))){this._audioBufferSource=this._sharedAudioContext.createBufferSource(),this._audioBufferSource.buffer=e,this._audioBufferSource.connect(this._bufferGainNode);try{this._audioBufferSource.start()}catch(e){this._failedAudioList.push(this._audioBufferSource)}this._audioBufferSource.onended=function(){var e;if(null===(e=t._audioBufferSource)||void 0===e||e.disconnect(t._bufferGainNode),t._audioBufferSource=void 0,t.cachedBuffer.length){var i=t.cachedBuffer.shift();i&&t.pushAudioMixingBuffer(i)}}}},e.prototype.stopAll=function(){var e=this;if(this._localSource)try{this._localSource.disconnect(this._localGainNode),delete this._localSource}catch(e){}this.mixingMap.forEach((function(t,i){e.stopAudioMixing(i)}))},Object.defineProperty(e.prototype,"mixTrack",{get:function(){return this._audioDestination.stream.getAudioTracks()[0]},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"sharedAudioContext",{get:function(){return this._sharedAudioContext},enumerable:!1,configurable:!0}),e.prototype.resumeLocalPlay=function(){return tf(this,void 0,void 0,(function(){var e,t,i,r,n,o,a,s;return rf(this,(function(c){switch(c.label){case 0:e=[],c.label=1;case 1:c.trys.push([1,10,11,12]),t=nf(this._failedAudioList),i=t.next(),c.label=2;case 2:if(i.done)return[3,9];r=i.value,c.label=3;case 3:return c.trys.push([3,7,,8]),r instanceof HTMLAudioElement?(r.muted=!1,[4,r.play()]):[3,5];case 4:return c.sent(),[3,6];case 5:r.start(),c.label=6;case 6:return[3,8];case 7:return n=c.sent(),e.push(r),console.error(n),this._context.onAutoPlayFailed({userId:this.id,kind:"audio",streamIndex:x_.STREAM_INDEX_MAIN,mediaType:V_.AUDIO}),[3,9];case 8:return i=t.next(),[3,2];case 9:return[3,12];case 10:return o=c.sent(),a={error:o},[3,12];case 11:try{i&&!i.done&&(s=t.return)&&s.call(t)}finally{if(a)throw a.error}return[7];case 12:return this._failedAudioList=e,[2]}}))}))},e.prototype.destroy=function(){var e=this._sharedAudioContext;"closed"!==e.state&&"function"==typeof e.close&&e.close(),this.cachedBuffer=[],this.mixingMap.clear(),this.resourcesCache.clear(),this.volumeConfig.clear()},ef([qB("default","id","filePath","options")],e.prototype,"startAudioMixing",null),ef([qB("default","id")],e.prototype,"stopAudioMixing",null),ef([qB("default","id")],e.prototype,"pauseAudioMixing",null),ef([qB("default","id")],e.prototype,"resumeAudioMixing",null),ef([qB("default","id")],e.prototype,"preloadAudioMixing",null),ef([qB("default","id")],e.prototype,"unloadAudioMixing",null),ef([qB("default","id")],e.prototype,"getAudioMixingVolume",null),ef([qB("default","id","volume")],e.prototype,"setAudioMixingVolume",null),ef([qB("default","id")],e.prototype,"getAudioMixingDuration",null),ef([qB("default","id")],e.prototype,"getAudioMixingCurrentPosition",null),ef([qB("default","id","position")],e.prototype,"setAudioMixingPosition",null),ef([qB("default","type")],e.prototype,"enableAudioMixingBuffer",null),ef([qB()],e.prototype,"disableAudioMixingBuffer",null),ef([qB("default","buffer")],e.prototype,"pushAudioMixingBuffer",null),e}();!function(e){e.NORMAL_USER="normalUser",e.SILENT_USER="silentUser"}(NX||(NX={}));var MX=new LB("RTMClient",1),LX=function(e){function t(t){var i=e.call(this)||this;return i._appId=t,i._dataChannelSignal=null,i._handler=null,i._dataChannelSignalState=gK.DISCONNECTED,i._loginSessionId=null,i._userId=null,i._token=null,i._isReconnecting=!1,i._reconnectTimer=null,i._loginResolveCallback=null,i._loginRejectCallback=null,i._iceConfigNode=null,i._wait_login_token=!1,i}return C_(t,e),t.prototype.login=function(e,t){var i=this;return new Promise((function(r,n){if(MX.print("login","invoke login, token: %o, userId: %o",e,t),i._loginSessionId)throw new Vj(Nj.ALREADY_LOGIN,"Already logined");if(i._loginResolveCallback)throw new Vj(Nj.LOGIN_FAILED,"Is logging in, please try again later.");i._userId=t,i._token=e,KB.setStats({rtc_app_id:i._appId,user_id:t}),i._loginResolveCallback=r,i._loginRejectCallback=n,i._dataChannelSignal?i._login():(MX.print("login","init dataChannelSingling"),i._dataChannelSignalState=gK.CONNECTING,i._createDataChannelSignaling(t).then((function(e){i._dataChannelSignal=e,i._login()})).catch((function(){i._onDisconnect()})))}))},t.prototype.logout=function(){var e;return tf(this,void 0,void 0,(function(){return rf(this,(function(t){switch(t.label){case 0:if(!this._loginSessionId||!this._userId)throw new Vj(Nj.NOT_LOGIN,"login first");return[4,null===(e=this._dataChannelSignal)||void 0===e?void 0:e.sendSignaling("logout",{loginSessionId:this._loginSessionId,userId:this._userId,appId:this._appId},{functionType:CG.C2RTM}).catch((function(){}))];case 1:return t.sent(),this._closeDataChannelSignaling(),this._clearState(),[2]}}))}))},t.prototype.updateLoginToken=function(e){return tf(this,void 0,void 0,(function(){var t=this;return rf(this,(function(i){return this._token=e,[2,new Promise((function(e,i){t._wait_login_token?(t._loginResolveCallback=e,t._loginRejectCallback=i,t._login()):e()}))]}))}))},t.prototype.getPeerOnlineStatus=function(e){return tf(this,void 0,void 0,(function(){var t;return rf(this,(function(i){switch(i.label){case 0:if(!this._loginSessionId||!this._userId)throw new Vj(Nj.NOT_LOGIN,"login first");return this._checkDataChannelSignal(),[4,this._dataChannelSignal.sendSignaling("getPeerOnlineStatus",{loginSessionId:this._loginSessionId,userId:this._userId,appId:this._appId,peerUserId:e},{functionType:CG.C2RTM})];case 1:return[2,null==(t=i.sent())?void 0:t.status]}}))}))},t.prototype.sendUserMessageOutsideRoom=function(e,t){return tf(this,void 0,void 0,(function(){return rf(this,(function(i){if(!this._loginSessionId||!this._userId)throw new Vj(Nj.NOT_LOGIN,"login first");return this._checkDataChannelSignal(),[2,this._dataChannelSignal.sendP2PMessage({from:this._userId,app:this._appId,to:e,room:"",msg:t})]}))}))},t.prototype.setServerParams=function(e,t){return tf(this,void 0,void 0,(function(){return rf(this,(function(i){switch(i.label){case 0:if(!this._loginSessionId||!this._userId)throw new Vj(Nj.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:CG.C2RTM})];case 1:return i.sent(),[2]}}))}))},t.prototype.sendServerMessage=function(e){return tf(this,void 0,void 0,(function(){return rf(this,(function(t){if(!this._loginSessionId||!this._userId)throw new Vj(Nj.NOT_LOGIN,"login first");return this._checkDataChannelSignal(),[2,this._dataChannelSignal.sendP2PMessage({from:this._userId,app:this._appId,to:"",room:"",type:IG.BUSINESS_SERVER,msg:e})]}))}))},t.prototype.destroy=function(){this._clearState(),this._closeDataChannelSignaling(),e.prototype.removeAllListeners.call(this)},t.prototype._login=function(){var e=this;if(this._userId){var t=_U();this._checkDataChannelSignal(),this._dataChannelSignal.sendSignaling("login",{Token:yU.token2auth(this._appId,null,this._userId,this._token),timestamp:Date.now(),loginSessionId:t,params:{deviceType:"web",userAgent:window.navigator.userAgent,sdkVersion:OF.VERSION,deviceId:IF.getDeviceId(),appId:this._appId,userId:this._userId}},{functionType:CG.C2RTM}).then((function(){e._loginResolveCallback&&e._loginResolveCallback(),e._loginSessionId=t,e._wait_login_token=!1})).catch((function(t){var i,r,n=t||{},o=n.code,a=n.message;e._wait_login_token=!1,o>=700&&o<800?708===o?(i=Nj.INVALID_PARAMS,r="Invalid userId"):(i=Nj.INVALID_TOKEN,r="Invalid token",e._wait_login_token=!0,e._loginRejectCallback||e.emit("onRTMTokenError")):(i=Nj.LOGIN_FAILED,r="login failed"),e._loginRejectCallback&&e._loginRejectCallback(new Vj(i,a||r))})).finally((function(){e._loginResolveCallback=null,e._loginRejectCallback=null}))}},t.prototype._createDataChannelSignaling=function(e){var t,i;return tf(this,void 0,void 0,(function(){var r,n,o,a,s,c,u=this;return rf(this,(function(d){switch(d.label){case 0:if(r=new DG,n=this._iceConfigNode)return[3,4];d.label=1;case 1:return d.trys.push([1,3,,4]),[4,null==r?void 0:r.getAccessNode(this._appId,"",e,IF.getDeviceId(),"")];case 2:if(o=d.sent(),!(n=o[0]))throw new Error;return[3,4];case 3:throw d.sent(),JB("rtm.login.getNodeFailed","",0,!0),new Vj(Nj.ICE_SERVER_WRONG,"get ICE config failed");case 4:JB("rtm.login.getNodeSuccess",n,0,!0),MX.print("_createDataChannelSignaling()","get node success",n),this._handler=vK(GB),null===(t=this._handler)||void 0===t||t.once("disconnect",(function(){MX.print("_createDataChannelSignaling()","recv BasicHandler event: disconnect"),u._onDisconnect()})),d.label=5;case 5:return d.trys.push([5,7,,8]),[4,null===(i=this._handler)||void 0===i?void 0:i.connect(n)];case 6:return a=d.sent(),MX.print("_createDataChannelSignaling()","establish peerConnection success"),this._dataChannelSignalState=gK.CONNECTED,[3,8];case 7:throw s=d.sent(),this._iceConfigNode=null,this._dataChannelSignalState=gK.DISCONNECTED,new Vj(Nj.ESTABLISH_DATACHANNEL_FAILED,"establish dataChannel failed",s);case 8:return c=new kG(a),MX.print("_createDataChannelSignaling()","send ping"),c.sendPingSignaling(),c.once("close",(function(){MX.print("_createDataChannelSignaling()","recv DataChannelSignaling event: close"),u._onDisconnect()})),c.on(vG.USER_MESSAGE_RECEIVED_OUTSIDE_ROOM,(function(e){u.emit("onUserMessageReceivedOutsideRoom",{userId:e.from,message:e.msg})})),c.on(vG.USER_BINARY_MESSAGE_RECEIVED_OUTSIDE_ROOM,(function(e){u.emit("onUserBinaryMessageReceivedOutsideRoom",{userId:e.from,message:e.msg})})),c.on(vG.USER_DISCONNECTION,(function(){u.emit("onUserDisconnection"),u._clearState()})),c.on(vG.NODE_CHANGE,(function(e){JB("rtm.nodeChange",JSON.stringify(e),0,!0),Array.isArray(e.nodes)&&e.nodes.length&&(u._iceConfigNode=e.nodes[0]),u._loginResolveCallback&&u._loginRejectCallback?u._login():u._reconnect()})),[2,c]}}))}))},t.prototype._closeDataChannelSignaling=function(){var e,t;null===(e=this._dataChannelSignal)||void 0===e||e.destroy(),this._dataChannelSignal=null,null===(t=this._handler)||void 0===t||t.destroy(),this._handler=null},t.prototype._checkDataChannelSignal=function(){if(!this._dataChannelSignal||this._dataChannelSignalState!==gK.CONNECTED)throw new Vj(Nj.NOT_CONNECTED_YET,"datachannel not connect")},t.prototype._onDisconnect=function(){this._dataChannelSignalState=gK.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&&(MX.print("_reconnect()","start reconnect..."),this._isReconnecting=!0,this._createDataChannelSignaling(this._userId).then((function(t){MX.print("_reconnect()","reconnect success!"),e._dataChannelSignal=t,e._login(),e._reconnectTimer=null})).catch((function(t){MX.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}(xF.exports.EventEmitter),UX=function(e){function t(t){var i=e.call(this)||this;return i._appId=t,i.remoteStreams=new Map,i.remoteStreamsStats=new Map,i}return C_(t,e),t.prototype.connect=function(){return tf(this,void 0,void 0,(function(){return rf(this,(function(e){switch(e.label){case 0:return this._mediaServerClient=new RK,this._bindEvents(),[4,this._mediaServerClient.connect(this._appId)];case 1:return e.sent(),[2]}}))}))},t.prototype.startPlayPublicStream=function(e){return tf(this,void 0,void 0,(function(){var t,i=this;return rf(this,(function(r){switch(r.label){case 0:if(this.remoteStreams.get(e))throw new Vj(Nj.REPEAT_PLAY,"repeat play public media stream");return(t=new rK(e,e,!1,!0,{audiostream:!0,localaudio:!0,videostream:!0,localvideo:!0,extaudio:!1,extvideo:!1,videoDescriptions:[]})).on("onSEIMessage",(function(e){if(e instanceof Uint8Array)for(var r=function(e){var t=new DataView(e.buffer);if(t.byteLength<=4||65535!==t.getUint16(0))return{seiCount:1,seis:[e]};for(var i={seiCount:0,seis:[]},r=!1,n=2;n<t.byteLength;){var o=t.getUint16(n);if(n+=2,t.byteLength-n<o){r=!0;break}var a=new Uint8Array(e.buffer,n,o);if(n+=o,t.byteLength-n>0&&t.byteLength-n<=2){r=!0;break}i.seiCount++,i.seis.push(a)}return r&&(i.seiCount=1,i.seis=[e]),i}(e),n=0;n<r.seiCount;n++)i.emit(jz.ON_SEI_MESSAGED_RECEIVED,{sei:r.seis[n],publicStreamId:t.streamId})})),[4,this._mediaServerClient.subscribePublicStream(t)];case 1:return r.sent(),this.remoteStreams.set(e,t),this.remoteStreamsStats.set(e,{decodeFailedCount:0}),[2,t]}}))}))},t.prototype.stopPlayPublicStream=function(e){var t=this.remoteStreams.get(e);if(t)return this.remoteStreams.delete(e),this._mediaServerClient.unsubscribePublicStream(t)},t.prototype.destroy=function(){this.remoteStreams=new Map,this._mediaServerClient&&this._mediaServerClient.destroy()},t.prototype._handleReconnected=function(){return tf(this,void 0,void 0,(function(){var e,t,i,r,n,o,a,s,c=this;return rf(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(jz.RESUBSCRIBE,{stream:t})}))},t=this;try{for(i=nf(this.remoteStreams),r=i.next();!r.done;r=i.next())n=of(r.value,1),o=n[0],e(o)}catch(e){a={error:e}}finally{try{r&&!r.done&&(s=i.return)&&s.call(i)}finally{if(a)throw a.error}}return[2]}))}))},t.prototype._reconnect=function(){var e=this;this._mediaServerClient.removeAllListeners(),this._mediaServerClient.destroy(),navigator.onLine?this.connect().then(this._handleReconnected.bind(this)):this._reconnectTimer=setTimeout((function(){return e.connect().then(e._handleReconnected.bind(e))}),3e3)},t.prototype._bindEvents=function(){var e,t,i=this;null===(e=this._mediaServerClient)||void 0===e||e.on(yG.ABNORMAL_DISCONNECTION,this._reconnect.bind(this)),null===(t=this._mediaServerClient)||void 0===t||t.on("onRemoteStreamStats",(function(e){if(i.emit("onRemoteStreamStats",e),e.videoStats&&e.receivedKBitrate&&e.receivedFrameRate&&!e.decoderOutputFrameRate){var t=i.remoteStreamsStats.get(e.publicStreamId);t&&(t.decodeFailedCount+=1,3===t.decodeFailedCount&&i.emit("streamDecodeFailed",{publicStreamId:e.publicStreamId}))}}))},t}(VB),xX=new LB("AudioDeviceManager",1),VX=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t._isAudioPlaybackDeviceTesting=!1,t._isAudioDeviceRecordTesting=!1,t}return C_(t,e),t.prototype.startAudioPlaybackDeviceTest=function(e,t){return tf(this,void 0,void 0,(function(){var i;return rf(this,(function(r){switch(r.label){case 0:if(this._isAudioPlaybackDeviceTesting||this._isAudioDeviceRecordTesting)throw new Vj(Nj.REPEAT_DEVICE_TEST,"device test cannot be called repeatedly at the same time.");this._isAudioPlaybackDeviceTesting=!0,xX.print("startAudioPlaybackDeviceTest()","Invoke"),r.label=1;case 1:return r.trys.push([1,3,,4]),[4,this._playAudioFile(e,{loop:!0})];case 2:return r.sent(),[3,4];case 3:throw i=r.sent(),this.stopAudioPlaybackDeviceTest(),i;case 4:return this._startEmitAudioPlaybackDeviceTestVolume(t),[2]}}))}))},t.prototype.stopAudioPlaybackDeviceTest=function(){this._isAudioPlaybackDeviceTesting&&(xX.print("stopAudioPlaybackDeviceTest()","Invoke"),this._isAudioPlaybackDeviceTesting=!1,this._stopEmitAudioPlaybackDeviceTestVolume(),this._destroyAudioElement())},t.prototype.startAudioDeviceRecordTest=function(e){return tf(this,void 0,void 0,(function(){var t=this;return rf(this,(function(i){switch(i.label){case 0:if(!window.MediaRecorder)throw new Vj(Nj.NOT_SUPPORTED,"Your browser does not support MediaRecorder.");if(this._isAudioDeviceRecordTesting)throw new Vj(Nj.REPEAT_DEVICE_TEST,"device test cannot be called repeatedly at the same time.");return this._isAudioDeviceRecordTesting=!0,xX.print("startAudioDeviceRecordTest()","Invoke"),this._recoderTimer=window.setTimeout((function(){xX.print("startAudioDeviceRecordTest()","".concat(3e4,'ms automatic call method "stopAudioDeviceRecordAndPlayTest"')),t._stopAudioCaptureAndRecoder()}),3e4),[4,this._startAudioCaptureAndRecoder(e)];case 1:return i.sent(),delete this._audioCaptureAndRecoderResolve,[2]}}))}))},t.prototype.stopAudioDeviceRecordAndPlayTest=function(){xX.print("stopAudioDeviceRecordAndPlayTest()","Invoke"),void 0!==this._recoderTimer&&(clearTimeout(this._recoderTimer),delete this._recoderTimer),this._stopAudioCaptureAndRecoder()},t.prototype.stopAudioDevicePlayTest=function(){this._isAudioDeviceRecordTesting&&(xX.print("stopAudioDevicePlayTest()","Invoke"),this._isAudioDeviceRecordTesting=!1,this.stopAudioDeviceRecordAndPlayTest(),this._stopEmitAudioPlaybackDeviceTestVolume(),this._destroyAudioElement())},t.prototype.getRecordTrack=function(){return this._audioTrack},t.prototype.destroy=function(){xX.print("destroy()","Invoke"),e.prototype.removeAllListeners.call(this),this.stopAudioPlaybackDeviceTest(),this.stopAudioDevicePlayTest()},t.prototype._playAudioFile=function(e,t){var i=this;return new Promise((function(r,n){i._audioElement=XK("audio",{attributes:{src:e,crossOrigin:"",autoplay:"true"}}),i._audioElement.loop=t.loop,xX.print("_playAudioFile()","url=".concat(e,";loop=").concat(t.loop)),i._audioElement.oncanplay=function(){xX.print("_playAudioFile()","oncanplay"),r()},i._audioElement.onerror=function(e){var t,r;n(new Vj(Nj.LOAD_RESOURCES_FAILED,"audio error: ".concat(e.message||(null===(r=null===(t=i._audioElement)||void 0===t?void 0:t.error)||void 0===r?void 0:r.message))))}}))},t.prototype._destroyAudioElement=function(){this._audioElement&&(xX.print("_destroyAudioElement()","Invoke"),this._audioElement.src="",delete this._audioElement,this._audioCaptureAndRecoderResolve&&this._audioCaptureAndRecoderResolve())},t.prototype._startEmitAudioPlaybackDeviceTestVolume=function(e){var t=this;e=Math.max(e,100),this._audioElement&&(xX.print("_startEmitAudioPlaybackDeviceTestVolume()","start timer(".concat(e,"ms)")),this._audioLevelFetcher=new iU(this._audioElement),this._playbackDeviceTestTimer=self.setInterval((function(){t._audioLevelFetcher&&t.emit("onAudioPlaybackDeviceTestVolume",t._audioLevelFetcher.getAudioLevel())}),e))},t.prototype._stopEmitAudioPlaybackDeviceTestVolume=function(){var e;void 0!==this._playbackDeviceTestTimer&&(xX.print("_stopEmitAudioPlaybackDeviceTestVolume()","stop timer"),self.clearInterval(this._playbackDeviceTestTimer),delete this._playbackDeviceTestTimer),null===(e=this._audioLevelFetcher)||void 0===e||e.destroy(),delete this._audioLevelFetcher},t.prototype._startAudioCaptureAndRecoder=function(e){return tf(this,void 0,void 0,(function(){var t,i,r=this;return rf(this,(function(n){switch(n.label){case 0:return t=this,[4,Cz({})];case 1:return t._audioTrack=n.sent(),i=dz(this._audioTrack.getTrack()),xX.print("startAudioDeviceRecordTest()","create microphone track success!"),[2,new Promise((function(t,n){r._mediaRecorder=new MediaRecorder(i),r._mediaRecorder.ondataavailable=function(i){return tf(r,void 0,void 0,(function(){var r,o,a,s=this;return rf(this,(function(c){switch(c.label){case 0:if(!this._isAudioDeviceRecordTesting)return[3,5];xX.print("startAudioDeviceRecordTest()","get recorded file."),r=new Blob([i.data]),c.label=1;case 1:return c.trys.push([1,3,,4]),[4,this._playAudioFile(URL.createObjectURL(r),{loop:!1})];case 2:return c.sent(),[3,4];case 3:return o=c.sent(),[2,n(o)];case 4:return this._startEmitAudioPlaybackDeviceTestVolume(e),null===(a=this._audioElement)||void 0===a||a.addEventListener("ended",(function(){s.stopAudioDevicePlayTest(),t()})),this._audioCaptureAndRecoderResolve=t,[3,6];case 5:t(),c.label=6;case 6:return[2]}}))}))},r._mediaRecorder.onerror=function(e){n(new Vj(Nj.AUDIO_DEVICE_TEST_FAILED,e.message||"mediaRecorder error"))},r._mediaRecorder.start()}))]}}))}))},t.prototype._stopAudioCaptureAndRecoder=function(){var e;this._mediaRecorder&&("recording"===this._mediaRecorder.state&&this._mediaRecorder.stop(),delete this._mediaRecorder),null===(e=this._audioTrack)||void 0===e||e.close(),delete this._audioTrack},t}(xF.exports.EventEmitter),FX=function(){function e(){this.engineBAC={},this.engineANM={},this._init()}return e.prototype._init=function(){return tf(this,void 0,void 0,(function(){var e,t;return rf(this,(function(i){switch(i.label){case 0:return e=new MG,t=this,[4,e.getAudioProfile()];case 1:return t.engineBAC=i.sent(),[2]}}))}))},e.prototype.updateEngineBAC=function(e){e&&(this.engineBAC={codec:this.engineBAC.codec,play:$_($_({},this.engineBAC.play),e.play),record:$_($_({},this.engineBAC.record),e.record)},this.setAEC(!!e.aec),this.setAGC(!!e.agc))},e.prototype.updateEngineANM=function(e){e&&(this.engineANM={bitrate:e.enc_param.bitrate,channel:e.enc_param.chn})},e.prototype.setAudioProfile=function(e){var t,i,r;switch(e){case Q_.fluent:i=16e3,t=24e3;break;case Q_.standard:i=48e3,t=48e3;break;case Q_.hd:i=48e3,t=128e3,r=2;break;case Q_.standardStereo:i=48e3,t=8e4,r=2;break;case Q_.hdMono:i=48e3,t=128e3}t&&(this.bitrate=t),r&&(this.channel=r),i&&(this.sampleRate=i)},e.prototype.setBitrate=function(e){e>128e3&&(e=128e3),this.bitrate=e},e.prototype.setAEC=function(e){this.aec=e},e.prototype.setAGC=function(e){this.agc=e},e.prototype.setANS=function(e){this.ans=e},e.prototype.getOpusConfigStr=function(){var e,t,i=";";return this.bitrate&&(i+="maxaveragebitrate=".concat(this.bitrate,";")),(this.sampleRate||(null===(e=this.engineBAC.record)||void 0===e?void 0:e.sr))&&(i+="maxplaybackrate=".concat(this.sampleRate||this.engineBAC.record.sr,";sprop-maxcapturerate=").concat(this.sampleRate||this.engineBAC.record.sr,";")),((this.channel||1)>1||(null===(t=this.engineBAC.record)||void 0===t?void 0:t.chn)>1)&&(i+="stereo=1;sprop-stereo=1;"),i.slice(0,-1)},Object.defineProperty(e.prototype,"config",{get:function(){var e,t,i;return{bitrate:this.bitrate||this.engineANM.bitrate,channel:this.channel||(null===(e=this.engineBAC.record)||void 0===e?void 0:e.chn)||(null===(t=this.engineANM)||void 0===t?void 0:t.chn)||1,aec:!!this.aec,agc:!!this.agc,ans:!!this.ans,sampleRate:this.sampleRate||(null===(i=this.engineBAC.record)||void 0===i?void 0:i.sr)}},enumerable:!1,configurable:!0}),e}(),BX=new WeakMap,jX=function(e,t,i){if(requestAnimationFrame){var r=BX.get(e);(null==r?void 0:r[t])?GX(e,t):r||(r={},BX.set(e,r));var n=e[t];!function o(){var a=requestAnimationFrame(o);r[t]=a;var s=e[t];n!==s&&(n=s,i(s))}()}},GX=function(e,t){var i=BX.get(e);t&&i[t]?cancelAnimationFrame(i[t]):Object.keys(i).length&&Object.keys(i).forEach((function(e){cancelAnimationFrame(i[e])}))},HX=new LB("Engine",0),zX=function(e){function t(t,i){var r=e.call(this)||this;return r._visibility=!0,r._remoteVideoPlayer=new Map,r._remoteScreenPlayer=new Map,r._remoteAudioPlayer=new Map,r._remoteScreenAudioPlayer=new Map,r._publicStreamAudioPlayer=new Map,r._publicStreamVideoPlayer=new Map,r._publicStreamIds=new Map,r._videoStreamConstraints={},r._audioStreamConstraints={},r._enableSimulcast=!1,r._videoStreamEncodeConfig=[LF],r._screenStreamEncodeConfig=[UF],r._tipDomList=[],r._pauseAllSubscribeState={audio:void 0,video:void 0},r._audioPropertiesReportTimer=null,r._localAudioNoInputCount=0,r._mirrorType=j_.MIRROR_TYPE_RENDER,r._audioDeviceManager=new VX,r._audioProfileManager=new FX,r._remoteVideoConfig=new Map,r._userPriorityMap=new Map,r._subscribeFallbackOption=W_.DISABLE,r._singleStreamRender=!0,r._prevLocalVideoSize={height:0,width:0},r.resubedUserId=new Set,r._videoCaptureStallCount=0,r._vStats="-V",r._aStats="-A",r.audioPlayerUseWebAudio=!1,r._updateMixAudioTrack=function(e,t){return void 0===t&&(t=uf.PLAYOUT_AND_PUBLISH),tf(r,void 0,void 0,(function(){var i;return rf(this,(function(r){switch(r.label){case 0:return HX.print("_updateMixAudioTrack()"),this._localAudioTrack?(e?(this._localAudioTrack.mixType=t,this._localAudioTrack.mixedAudioTrack=e):(delete this._localAudioTrack.mixType,delete this._localAudioTrack.mixedAudioTrack),(null===(i=this._room)||void 0===i?void 0:i.hasPublished)?[4,this._updatePublish()]:[3,2]):(e&&(this._tempMixingAudioTrack={track:e,type:t}),[2]);case 1:r.sent(),r.label=2;case 2:return[2]}}))}))},r._onAudioMixingMessage=function(e){r.safeEmit(hf.onAudioMixingStateChanged,e)},r._onAudioMixingAutoplayFailed=function(e){r.safeEmit(hf.onAutoplayFailed,e)},r._appId=t,r._pubLock=new SK("pubLock"),r._addDeviceEventHandler(),r._audioMixingManager=new DX({getLocalAudioTrack:function(){return r._localAudioTrack},updateLocalAudioTrack:r._updateMixAudioTrack,emitMessage:r._onAudioMixingMessage,onAutoPlayFailed:r._onAudioMixingAutoplayFailed}),window.__rtc_engine__=r,r._engine_number=Math.floor(100*Math.random()+1),window["__rtc_engine__".concat(r._engine_number)]=r,r._trackSourceType={video:O_.VIDEO_SOURCE_TYPE_INTERNAL,screenVideo:O_.VIDEO_SOURCE_TYPE_INTERNAL,audio:w_.AUDIO_SOURCE_TYPE_INTERNAL,screenAudio:w_.AUDIO_SOURCE_TYPE_INTERNAL},r._config=i,r._rtmClient=new LX(t),r._handleRTMClient(r._rtmClient),r._useCloudProxy=!1,r._handleAudioDeviceManager(),r._messageStatisticsObserver=new oW,location.search.includes("_use_web_audio_")&&(r.audioPlayerUseWebAudio=!0),r}return C_(t,e),Object.defineProperty(t.prototype,"appId",{get:function(){return this._appId},enumerable:!1,configurable:!0}),t.prototype.updateToken=function(e){var t,i,r;return tf(this,void 0,void 0,(function(){var n,o,a,s;return rf(this,(function(c){switch(c.label){case 0:return HX.print("updateToken()","token: %s",e),jj(e,"token"),this.waitForNewToken&&(null===(t=this._room)||void 0===t?void 0:t._roomInfo)&&this._tempRoomConfig?(n=null===(i=this._room)||void 0===i?void 0:i._roomInfo,o=n.roomId,a=n.userInfo,s=this._tempRoomConfig,delete this._tempRoomConfig,[4,this.joinRoom(e,o,a,s)]):[3,2];case 1:return[2,c.sent()];case 2:if(!this._room)throw new Vj(Nj.UPDATE_TOKEN_BEFORE_JOIN,"update token before join room");return[4,null===(r=this._room)||void 0===r?void 0:r.updateToken(e)];case 3:return c.sent(),[2]}}))}))},t.prototype.setVideoCaptureDevice=function(e){var t,i;return tf(this,void 0,void 0,(function(){var r,n,o;return rf(this,(function(a){switch(a.label){case 0:return HX.print("setVideoCaptureDevice()","deviceId: %s",e),jj(e,"deviceId"),this._localVideoTrack?RU&&CU&&(r=null===(i=null===(t=this._localVideoTrack)||void 0===t?void 0:t.getTrack())||void 0===i?void 0:i.getSettings())&&r.deviceId===e?[2,Promise.resolve()]:(n=this._videoStreamConstraints,"user"===e||"environment"===e||"left"===e||"right"===e?(delete n.deviceId,n.facingMode=e):!kU||AU?n.deviceId={exact:e}:delete n.deviceId,this._videoStreamConstraints=n,[4,Rz(n)]):(this._localVideoDeviceId=e,[2,Promise.resolve()]);case 1:return o=a.sent(),this._initLocalTrackEvents(o),this._localVideoTrack.close(),this._localVideoTrack=o,this._videoPlayer&&this._videoPlayer.played&&(this._videoPlayer.stop(),this._videoPlayer.playVideo(o),this._videoPlayer.mirror(!!this._mirrorType)),this._room?this._room.hasPublished?[4,this._updatePublish()]:[3,3]:[2];case 2:a.sent(),a.label=3;case 3:return[2]}}))}))},t.prototype.setAudioCaptureDevice=function(e){return tf(this,void 0,void 0,(function(){var t,i;return rf(this,(function(r){switch(r.label){case 0:return HX.print("setAudioCaptureDevice()","deviceId: %s",e),jj(e,"deviceId"),this._localAudioTrack?((t=this._audioStreamConstraints).deviceId={exact:e},this._audioStreamConstraints=t,this._localAudioTrack.close(),[4,Cz(t,this._audioProfileManager)]):(this._localAudioDeviceId=e,[2,Promise.resolve()]);case 1:return i=r.sent(),this._initLocalTrackEvents(i),this._localAudioTrack=i,this._room?this._room.hasPublished?[4,this._updatePublish()]:[3,3]:[2];case 2:r.sent(),r.label=3;case 3:return[2]}}))}))},t.prototype._addDeviceEventHandler=function(){sz.on(hf.onVideoDeviceStateChanged,this._onVideoDeviceStateChange.bind(this)),sz.on(hf.onAudioDeviceStateChanged,this._onAudioDeviceStateChange.bind(this))},t.prototype._addHandlerEventHandler=function(){var e,t,i,r,n,o,a,s,c,u,d,l,h,p,_,f,v,m,y,S,g,E,b,I,T,A,R,C,O=this;null===(e=this._room)||void 0===e||e.on(vG.ON_ADD_STREAM,this._onAddStream.bind(this)),null===(t=this._room)||void 0===t||t.on(vG.ON_REMOVE_STREAM,this._onRemoveStream.bind(this)),null===(i=this._room)||void 0===i||i.on(vG.USER_CONNECTION,this._onUserConnection.bind(this)),null===(r=this._room)||void 0===r||r.on(jz.ON_USER_LEAVE,this._onUserLeave.bind(this)),null===(n=this._room)||void 0===n||n.on(jz.ON_ROOM_ERROR,this._onRoomError.bind(this)),null===(o=this._room)||void 0===o||o.on(jz.ON_NETWORK_QUALITY,this._onNetworkQuality.bind(this)),null===(a=this._room)||void 0===a||a.on(vG.ON_CUSTOM_MESSAGE,this._onCustomMessage.bind(this)),null===(s=this._room)||void 0===s||s.on(vG.USER_MESSAGE_RECEIVED,this._onUserMessageReceived.bind(this)),null===(c=this._room)||void 0===c||c.on(vG.USER_BINARY_MESSAGE_RECEIVED,this._onUserBinaryMessageReceived.bind(this)),null===(u=this._room)||void 0===u||u.on(vG.ON_USER_TOKEN_WILL_EXPIRE,this._onUserTokenWillExpire.bind(this)),null===(d=this._room)||void 0===d||d.on(vG.POST_PROCESSING_MESSAGE,(function(e){!function(e){return"2.0"===e.protocol}(e)?"publicStreamCallback"===e.type?O._onPushPublicStreamResult(e):"transcodeStatusCallback"===e.type&&O._onLiveTranscodingResult(e):O._onStreamMixingEvent({error:e.error,event:e.eventType,message:e.message})})),null===(l=this._room)||void 0===l||l.on(yG.ON_CONNECTION_STATE_CHANGE,this._onConnectionStateChange.bind(this)),null===(h=this._room)||void 0===h||h.on(jz.RESUBSCRIBE,this._onResubscribe.bind(this)),null===(p=this._room)||void 0===p||p.on(jz.SUBSCRIBE_PUSH_TRACK,this._onSubscribePushTrack.bind(this)),null===(_=this._room)||void 0===_||_.on(jz.REMOVE_PUSH_TRACK,this._onRemovePushTrack.bind(this)),null===(f=this._room)||void 0===f||f.on(jz.VIDEO_FIRST_FRAME,this._onVideoFirstFrameDecoded.bind(this)),null===(v=this._room)||void 0===v||v.on(jz.ON_PUBLISH_RESULT,(function(e){var t;(null===(t=O._room)||void 0===t?void 0:t._roomConfig.isAutoPublish)&&O.safeEmit(hf.onAutoPublishResult,e)})),null===(m=this._room)||void 0===m||m.on(jz.ON_REMOTE_STREAM_STATS,(function(e){O._checkRemoteStats(e),O.safeEmit(hf.onRemoteStreamStats,e)})),null===(y=this._room)||void 0===y||y.on(jz.ON_LOCAL_STREAM_STATS,(function(e){O.safeEmit(hf.onLocalStreamStats,e)})),null===(S=this._room)||void 0===S||S.on(jz.ON_USER_PUBLISH_STATE_CHANGE,this._onUserPublishStateChange.bind(this)),null===(g=this._room)||void 0===g||g.on(jz.ON_USER_START_AUDIO_CAPTURE,(function(e){var t=e.userId;O.safeEmit(hf.onUserStartAudioCapture,{userId:t})})),null===(E=this._room)||void 0===E||E.on(jz.ON_USER_STOP_AUDIO_CAPTURE,(function(e){var t=e.userId;O.safeEmit(hf.onUserStopAudioCapture,{userId:t})})),null===(b=this._room)||void 0===b||b.on(jz.ON_USER_START_VIDEO_CAPTURE,(function(e){var t=e.userId;O.safeEmit(hf.onUserStartVideoCapture,{userId:t})})),null===(I=this._room)||void 0===I||I.on(jz.ON_USER_STOP_VIDEO_CAPTURE,(function(e){var t=e.userId;O.safeEmit(hf.onUserStopVideoCapture,{userId:t})})),null===(T=this._room)||void 0===T||T.on(jz.ON_SEI_MESSAGED_RECEIVED,(function(e){O.safeEmit(hf.onSEIMessageReceived,e)})),null===(A=this._room)||void 0===A||A.on(jz.ON_REMOTE_VIDEO_SIZE_CHANGED,(function(e,t){O.safeEmit(hf.onRemoteVideoSizeChanged,e,t)})),null===(R=this._room)||void 0===R||R.on(jz.ON_SIMULCAST_SUBSCRIBE_FALLBACK,(function(e){return O.safeEmit(hf.onSimulcastSubscribeFallback,e)})),null===(C=this._room)||void 0===C||C.on(jz.RECONNECT_FAILED,(function(){O.safeEmit(hf.onError,{errorCode:Nj.RECONNECT_FAILED})}))},t.prototype.safeEmit=function(t){for(var i=[],r=1;r<arguments.length;r++)i[r-1]=arguments[r];return Jj(t)&&YB(t,MU(i)),e.prototype.safeEmit.apply(this,af([t],of(i),!1))},t.prototype._removeHandlerEventHandler=function(){var e;null===(e=this._room)||void 0===e||e.removeAllListeners()},t.prototype.joinRoom=function(e,t,i,r){return tf(this,void 0,void 0,(function(){var n,o,a,s,c,u,d,l,h;return rf(this,(function(p){switch(p.label){case 0:if(location.search.includes("__rtc_debug_2__")){try{for(n=nf(Object.keys(localStorage)),o=n.next();!o.done;o=n.next())(a=o.value).startsWith("RTC_ACCESS")&&localStorage.removeItem(a)}catch(e){l={error:e}}finally{try{o&&!o.done&&(h=n.return)&&h.call(n)}finally{if(l)throw l.error}}e=null}if(HX.print("joinRoom()","token: %o roomId: %o, userInfo: %o, roomConfig: %o",e,t,i,r),Kj(e)||jj(e,"token"),function(e){if("string"!=typeof e||!/^[a-zA-Z0-9@._\-]{1,128}$/.test(e))throw new Vj(Nj.INVALID_PARAMS,"The RoomId must be within 128 bytes. The supported characters: a-z,A-Z,0-9,@,-,_,.")}(t),function(e){Hj(e,"userInfo"),Wj(e.userId),Kj(e.extraInfo)||jj(e.extraInfo,"userInfo.extraInfo",1,200)}(i),s={isAutoPublish:!0,isAutoSubscribeAudio:!0,isAutoSubscribeVideo:!0,roomProfileType:J_.communication},OX(s,r),function(e){Hj(e,"roomConfig"),Fj(e.isAutoPublish,"roomConfig.isAutoPublish"),Fj(e.isAutoSubscribeAudio,"roomConfig.isAutoSubscribeAudio"),Fj(e.isAutoSubscribeVideo,"roomConfig.isAutoSubscribeVideo")}(s),!this._room||this._room.connectionState===gK.DISCONNECTED)return[3,1];throw new Vj(Nj.REPEAT_JOIN,"Already joined");case 1:this._room=new KK(r,{audioProfileManager:this._audioProfileManager}),this._room.userPriorityMap=this._userPriorityMap,this._room.subscribeFallbackOption=this._subscribeFallbackOption,this._addHandlerEventHandler(),c=this._liveTranscodeConfig&&NF("started",this._liveTranscodeConfig),p.label=2;case 2:return p.trys.push([2,4,,5]),this._useCloudProxy&&(this._startCloudProxyTimestamp=Date.now()),[4,this._room.join(this._appId,t,e,$_($_({},i),{businessId:this._businessId,role:this._visibility?NX.NORMAL_USER:NX.SILENT_USER}),c,this._useCloudProxy)];case 3:return u=p.sent(),this._roomConfig=r,this._tempRoomConfig&&delete this._tempRoomConfig,(null==r?void 0:r.isAutoPublish)&&(this._visibility?this._updatePublish({invokeByJoinRoom:!0,mediaType:V_.AUDIO_AND_VIDEO}):this.safeEmit(hf.onAutoPublishResult,{isScreen:!1,state:M_.PUBLISH_FAIL})),[2,u];case 4:throw(d=p.sent()).code===Nj.INVALID_TOKEN&&(this._tempRoomConfig=r),d;case 5:return[2]}}))}))},t.prototype.leaveRoom=function(e){var t,i;return void 0===e&&(e=!1),tf(this,void 0,void 0,(function(){return rf(this,(function(r){switch(r.label){case 0:return HX.print("leaveRoom()"),e?[4,null===(t=this._room)||void 0===t?void 0:t.leave(e)]:[3,2];case 1:return r.sent(),[3,3];case 2:null===(i=this._room)||void 0===i||i.leave(e).catch(),r.label=3;case 3:return this._removeHandlerEventHandler(),this._liveTranscodeConfig&&this.stopLiveTranscoding(),this._room=void 0,this._remoteAudioPlayer.forEach((function(e){return e.destroy()})),this._remoteAudioPlayer=new Map,this._remoteScreenAudioPlayer.forEach((function(e){return e.destroy()})),this._remoteScreenAudioPlayer=new Map,this._remoteScreenPlayer.forEach((function(e){return e.destroy()})),this._remoteScreenPlayer=new Map,this._remoteVideoPlayer.forEach((function(e){return e.destroy()})),this._remoteVideoPlayer=new Map,this._roomConfig=void 0,this._publicStreamIds=new Map,[2]}}))}))},t.prototype.destroy=function(){var e,t,i;HX.print("destroy()"),this.removeAllListeners(),this._removeHandlerEventHandler(),null===(e=this._room)||void 0===e||e.destroy(),this._room=void 0,null===(t=this._videoPlayer)||void 0===t||t.destroy(),this._videoPlayer=void 0,this._screenPlayer=void 0,this._videoStreamConstraints={},this._audioStreamConstraints={},this._videoStreamEncodeConfig=[LF],this._screenStreamEncodeConfig=[UF],this._pauseAllSubscribeState={audio:void 0,video:void 0},this._messageStatisticsObserver.destroy(),clearInterval(this._audioVolumeIndicationTimer),clearInterval(this._dummyTimer),this._audioVolumeIndicationTimer=void 0,this._stopAudioPropertiesReport(),this._localAudioTrack&&(this._localAudioTrack.close(),this._localAudioTrack=void 0),this._localVideoTrack&&(this._localVideoTrack.close(),this._localVideoTrack=void 0),this._localScreenAudioTrack&&(this._localScreenAudioTrack.close(),this._localScreenAudioTrack=void 0),this._localScreenVideoTrack&&(this._localScreenVideoTrack.close(),this._localScreenVideoTrack=void 0),this._localImgVideoTrack&&(this._localImgVideoTrack.stop(),this._localImgVideoTrack=void 0),this._localImgScreenTrack&&(this._localImgScreenTrack.stop(),this._localImgScreenTrack=void 0),this._remoteAudioPlayer.forEach((function(e){return e.destroy()})),this._remoteAudioPlayer=new Map,this._remoteScreenAudioPlayer.forEach((function(e){return e.destroy()})),this._remoteScreenAudioPlayer=new Map,this._remoteScreenPlayer.forEach((function(e){return e.destroy()})),this._remoteScreenPlayer=new Map,this._remoteVideoPlayer.forEach((function(e){return e.destroy()})),this._remoteVideoPlayer=new Map,this._publicStreamAudioPlayer.forEach((function(e){return e.destroy()})),this._publicStreamAudioPlayer=new Map,this._publicStreamVideoPlayer.forEach((function(e){return e.destroy()})),this._publicStreamVideoPlayer=new Map,this._roomConfig=void 0,this._audioMixingManager.destroy(),this._rtmClient.destroy(),null===(i=this._outsideRoom)||void 0===i||i.destroy(),this._publicStreamIds=new Map,this._audioDeviceManager.destroy(),this._remoteVideoConfig=new Map,this._userPriorityMap.clear(),delete window["__rtc_engine__".concat(this._engine_number)]},t.prototype.publishStream=function(e){return tf(this,void 0,void 0,(function(){var t,i;return rf(this,(function(r){switch(r.label){case 0:try{t=e!==V_.AUDIO,i=e!==V_.VIDEO,this._vStats=t?"+V":this._vStats,this._aStats=i?"+A":this._aStats}catch(e){}return HX.print("publishStream()","mediaType: %o",e),this._checkMediaType(e),this._assertNotInRoom(),FU(e)&&!this._localVideoTrack&&this._localImgVideoTrack&&(this._localVideoTrack=(n=this._localImgVideoTrack,new Sz(n,_U())),this._localVideoTrack.dummy=!0),[4,this._updatePublish({mediaType:e})];case 1:return r.sent(),[2]}var n}))}))},t.prototype.unpublishStream=function(e){return tf(this,void 0,void 0,(function(){var t,i;return rf(this,(function(r){switch(r.label){case 0:try{t=e!==V_.AUDIO,i=e!==V_.VIDEO,this._vStats=t?"-V":this._vStats,this._aStats=i?"-A":this._aStats}catch(e){}return HX.print("unpublishStream()","mediaType: %o",e),this._checkMediaType(e),this._assertNotInRoom(),[4,this._updatePublish({mediaType:e,pubState:zz.UNPUB})];case 1:return r.sent(),[2]}}))}))},t.prototype.publishScreen=function(e){return tf(this,void 0,void 0,(function(){var t;return rf(this,(function(i){switch(i.label){case 0:HX.print("publishScreen()","mediaType: %o",e),this._checkMediaType(e),this._assertNotInRoom(),i.label=1;case 1:return i.trys.push([1,3,,4]),FU(e)&&!this._localScreenVideoTrack&&this._localImgScreenTrack&&(this._localScreenVideoTrack=(r=this._localImgScreenTrack,new gz(r,_U())),this._localScreenVideoTrack.dummy=!0),[4,this._updateScreenPublish({mediaType:e,pubState:zz.PUB})];case 2:return i.sent(),[3,4];case 3:throw(t=i.sent())instanceof Vj?t:new Vj(Nj.UNEXPECTED_ERROR,"unexpected error",t);case 4:return[2]}var r}))}))},t.prototype.unpublishScreen=function(e){return tf(this,void 0,void 0,(function(){return rf(this,(function(t){switch(t.label){case 0:return HX.print("unpublishScreen()","mediaType: %o",e),this._checkMediaType(e),this._assertNotInRoom(),[4,this._updateScreenPublish({mediaType:e,pubState:zz.UNPUB})];case 1:return t.sent(),[2]}}))}))},t.prototype.subscribeStream=function(e,t){return tf(this,void 0,void 0,(function(){return rf(this,(function(i){return HX.print("subscribeStream()","userId: %o, mediaType: %o",e,t),[2,this._subscribe(!1,e,t)]}))}))},t.prototype._subscribe=function(e,t,i){var r,n,o,a,s;return tf(this,void 0,void 0,(function(){var c,u,d,l,h,p,_,f,v;return rf(this,(function(m){switch(m.label){case 0:if(this._checkMediaType(i),this._assertNotInRoom(),c=this._room.remoteStreams.get(t),!(u=null==c?void 0:c.find((function(t){return t.isScreen===e}))))throw new Vj(Nj.STREAM_NOT_EXIST,"stream not exist");return d=this._pauseAllSubscribeState.audio,l=this._pauseAllSubscribeState.video,this._pauseAllSubscribeState.audio&&(i-=i&V_.AUDIO),this._pauseAllSubscribeState.video&&(i-=i&V_.VIDEO),HX.print("subscribeStream()","due to pauseAll mediaType: %o",i),h=u.hasSubscribed,p=this._remoteVideoConfig.get(t)||(null===(r=this._roomConfig)||void 0===r?void 0:r.remoteVideoConfig),u.originalMediaType=i,[4,this._room.subscribe(u,i,p)];case 1:return m.sent(),VU(i)&&this._updateAudioPlayerState(u),FU(i)&&this._updateVideoPlayerState(u),_=0,f=0,d!==this._pauseAllSubscribeState.audio&&(this._pauseAllSubscribeState.audio?_|=V_.AUDIO:f|=V_.AUDIO),l!==this._pauseAllSubscribeState.video&&(this._pauseAllSubscribeState.video?_|=V_.VIDEO:f|=V_.VIDEO),_&&this.pauseAllSubscribedStream(_),f&&this.resumeAllSubscribedStream(f),e||!(null===(n=this._roomConfig)||void 0===n?void 0:n.isAutoSubscribeAudio)&&!(null===(o=this._roomConfig)||void 0===o?void 0:o.isAutoSubscribeVideo)||(u.audioTrack||u.videoTrack)&&(v={userId:t,isScreen:!1,state:D_.SUBSCRIBE_SUCC},this.safeEmit(hf.onAutoSubscribeResult,v)),!h&&VU(i)&&(null===(a=u.observer)||void 0===a||a.setSubscribeAudio(!0)),!h&&FU(i)&&(null===(s=u.observer)||void 0===s||s.setSubscribeVideo(!0)),[2]}}))}))},t.prototype.unsubscribeStream=function(e,t){return tf(this,void 0,void 0,(function(){var i,r;return rf(this,(function(n){if(HX.print("unsubscribeStream()","userId: %o, mediaType: %o",e,t),this._checkMediaType(t),this._assertNotInRoom(),i=this._room.remoteStreams.get(e),!(null==(r=null==i?void 0:i.find((function(e){return!e.isScreen})))?void 0:r.hasSubscribed))throw new Vj(Nj.STREAM_NOT_EXIST,"stream not exist");return this._room.unsubscribe(r,t),[2]}))}))},t.prototype.subscribeScreen=function(e,t){return tf(this,void 0,void 0,(function(){return rf(this,(function(i){return HX.print("subscribeScreen() userId: %o, mediaType: %o",e,t),[2,this._subscribe(!0,e,t)]}))}))},t.prototype.unsubscribeScreen=function(e,t){return tf(this,void 0,void 0,(function(){var i,r;return rf(this,(function(n){if(HX.print("unsubscribeScreen() userId: %o, mediaType: %o",e,t),this._checkMediaType(t),this._assertNotInRoom(),i=this._room.remoteStreams.get(e),!(null==(r=null==i?void 0:i.find((function(e){return e.isScreen})))?void 0:r.hasSubscribed))throw new Vj(Nj.STREAM_NOT_EXIST,"stream not exist");return this._room.unsubscribe(r,t),[2]}))}))},t.prototype.setRemoteVideoConfig=function(e,t){var i;return tf(this,void 0,void 0,(function(){return rf(this,(function(r){return HX.print("setRemoteVideoConfig() userId: %o, remoteVideoConfig: %o",e,t),Wj(e),function(e){if("number"!=typeof(null==e?void 0:e.width)||"number"!=typeof(null==e?void 0:e.height))throw new Vj(Nj.INVALID_PARAMS,"remoteVideoConfig must contain width, height, frameRate")}(t),this._remoteVideoConfig.set(e,t),[2,null===(i=this._room)||void 0===i?void 0:i.updateSubVideoConfig(e,t).then((function(){}))]}))}))},t.prototype.startVideoAndAudioCapture=function(e,t){var i,r,n,o,a,s,c;return tf(this,void 0,void 0,(function(){var u,d,l,h,p,_,f,v,m,y=this;return rf(this,(function(S){switch(S.label){case 0:if(HX.print("startVideoCapture()","deviceId: %s",e),HX.print("startAudioCapture()","deviceId: %s",t),Kj(e)||jj(e,"videoDeviceId"),Kj(t)||jj(t,"audioDeviceId"),e=e||this._localVideoDeviceId,t=t||this._localAudioDeviceId,this._localVideoTrack&&!this._localVideoTrack.dummy)throw new Vj(Nj.REPEAT_CAPTURE,"Has already capture");if(this._localAudioTrack)throw new Vj(Nj.REPEAT_CAPTURE,"Has already capture");return u=this._videoStreamConstraints,e&&("user"===e||"environment"===e||"left"===e||"right"===e?(delete u.deviceId,u.facingMode=e):!kU||AU?u.deviceId={exact:e}:delete u.deviceId,this._videoStreamConstraints=u),d=this._audioStreamConstraints,t&&(kU&&!AU||(d.deviceId={exact:t}),this._audioStreamConstraints=d),jB.rtcInvokeStatus("createCameraAndMicrophoneTrack start",0,"startVideoAndAudioCapture","",0),[4,Az(u,d,this._audioProfileManager)];case 1:return l=S.sent(),h=l.videoTrack,p=l.audioTrack,jB.rtcInvokeStatus("createCameraAndMicrophoneTrack finish",0,"startVideoAndAudioCapture","",0),(null===(i=this._videoStreamEncodeConfig[0])||void 0===i?void 0:i.contentHint)&&h.setContentHint(null===(r=this._videoStreamEncodeConfig[0])||void 0===r?void 0:r.contentHint),this._initLocalTrackEvents(h),this._localVideoTrack=h,null===(n=this._videoPlayer)||void 0===n||n.playVideo(h),(_=null==h?void 0:h.getTrack())&&(f=_.getSettings(),v={width:f.width,height:f.height},this._localVideoTrack.resolution=v,this.autoResetVideoEncoderConfig(f),setTimeout((function(){return y.safeEmit(hf.onLocalVideoSizeChanged,{streamIndex:x_.STREAM_INDEX_MAIN,info:v})}))),this._initLocalTrackEvents(p),this._localAudioTrack=p,this._tempMixingAudioTrack&&(this._localAudioTrack.mixType=this._tempMixingAudioTrack.type,this._localAudioTrack.mixedAudioTrack=this._tempMixingAudioTrack.track,delete this._tempMixingAudioTrack),this._room?(m=this._room._roomConfig.isAutoPublish,(this._room.hasPublished||m)&&(this._visibility?this._updatePublish():this.safeEmit(hf.onAutoPublishResult,{isScreen:!1,state:M_.PUBLISH_FAIL})),null===(a=null===(o=this._room.localStream)||void 0===o?void 0:o.observer)||void 0===a||a.setEnableVideo(!0),null===(c=null===(s=this._room.localStream)||void 0===s?void 0:s.observer)||void 0===c||c.setEnableAudio(!0),[2]):[2]}}))}))},t.prototype.startVideoCapture=function(e){var t,i,r,n,o;return tf(this,void 0,void 0,(function(){var a,s,c,u,d,l,h=this;return rf(this,(function(p){switch(p.label){case 0:if(HX.print("startVideoCapture()","deviceId: %s",e),Kj(e)||jj(e,"deviceId"),e=e||this._localVideoDeviceId,this._localVideoTrack&&!this._localVideoTrack.dummy)throw new Vj(Nj.REPEAT_CAPTURE,"Has already capture");return a=this._videoStreamConstraints,e&&("user"===e||"environment"===e||"left"===e||"right"===e?(delete a.deviceId,a.facingMode=e):!kU||AU?a.deviceId={exact:e}:delete a.deviceId,this._videoStreamConstraints=a),[4,Rz(a)];case 1:return s=p.sent(),window.location.search.includes("_pub_canvas_")&&(HX.print("startVideoCapture()","use canvas track in iOS"),s=new Tz(s.getTrack(),_U())),(null===(t=this._videoStreamEncodeConfig[0])||void 0===t?void 0:t.contentHint)&&s.setContentHint(null===(i=this._videoStreamEncodeConfig[0])||void 0===i?void 0:i.contentHint),this._initLocalTrackEvents(s),this._localVideoTrack=s,null===(r=this._videoPlayer)||void 0===r||r.playVideo(s),c={},(u=null==s?void 0:s.getTrack())&&(c=u.getSettings(),d={width:c.width,height:c.height},this._localVideoTrack.resolution=d,this.autoResetVideoEncoderConfig(c),setTimeout((function(){return h.safeEmit(hf.onLocalVideoSizeChanged,{streamIndex:x_.STREAM_INDEX_MAIN,info:d})}))),this._room?(l=this._room._roomConfig.isAutoPublish,(this._room.hasPublished||l)&&(this._visibility?this._updatePublish():this.safeEmit(hf.onAutoPublishResult,{isScreen:!1,state:M_.PUBLISH_FAIL})),null===(o=null===(n=this._room.localStream)||void 0===n?void 0:n.observer)||void 0===o||o.setEnableVideo(!0),[2,c]):[2,c]}}))}))},t.prototype.stopVideoCapture=function(){var e,t,i,r,n;return tf(this,void 0,void 0,(function(){return rf(this,(function(o){switch(o.label){case 0:if(HX.print("stopVideoCapture()"),this._trackSourceType.video===O_.VIDEO_SOURCE_TYPE_EXTERNAL)throw new Vj(Nj.STREAM_TYPE_NOT_MATCH,"setVideoSourceType as internal first");return null===(e=this._videoPlayer)||void 0===e||e.stop(),null===(t=this._localVideoTrack)||void 0===t||t.close(),this._localImgVideoTrack&&this._localVideoTrack?(null===(i=this._localVideoTrack)||void 0===i||i.setTrack(this._localImgVideoTrack),this._localVideoTrack.dummy=!0):this._localVideoTrack=void 0,this._room?this._room.hasPublished?[4,this._updatePublish()]:[3,2]:[2];case 1:o.sent(),o.label=2;case 2:return null===(n=null===(r=this._room.localStream)||void 0===r?void 0:r.observer)||void 0===n||n.setEnableVideo(!1),[2]}}))}))},t.prototype.startAudioCapture=function(e){var t,i;return tf(this,void 0,void 0,(function(){var r,n,o;return rf(this,(function(a){switch(a.label){case 0:if(HX.print("startAudioCapture()","deviceId: $o",e),Kj(e)||jj(e,"deviceId"),e=e||this._localAudioDeviceId,this._localAudioTrack)throw new Vj(Nj.REPEAT_CAPTURE,"Has already capture");return r=this._audioStreamConstraints,e&&(r.deviceId={exact:e},this._audioStreamConstraints=r),[4,Cz(r,this._audioProfileManager)];case 1:return n=a.sent(),this._initLocalTrackEvents(n),this._localAudioTrack=n,this._tempMixingAudioTrack&&(this._localAudioTrack.mixType=this._tempMixingAudioTrack.type,this._localAudioTrack.mixedAudioTrack=this._tempMixingAudioTrack.track,delete this._tempMixingAudioTrack),this._room?(o=this._room._roomConfig.isAutoPublish,(this._room.hasPublished||o)&&(this._visibility?this._updatePublish():this.safeEmit(hf.onAutoPublishResult,{isScreen:!1,state:M_.PUBLISH_FAIL})),null===(i=null===(t=this._room.localStream)||void 0===t?void 0:t.observer)||void 0===i||i.setEnableAudio(!0),[2]):[2]}}))}))},t.prototype.stopAudioCapture=function(){var e,t,i;return tf(this,void 0,void 0,(function(){return rf(this,(function(r){switch(r.label){case 0:if(HX.print("stopAudioCapture()"),null===(e=this._localAudioTrack)||void 0===e||e.close(),this._localAudioTrack=void 0,this._audioMixingManager.stopAll(),this._trackSourceType.audio===w_.AUDIO_SOURCE_TYPE_EXTERNAL)throw new Vj(Nj.STREAM_TYPE_NOT_MATCH,"setAudioSourceType as internal first");return this._room?this._room.hasPublished?[4,this._updatePublish()]:[3,2]:[2];case 1:r.sent(),r.label=2;case 2:return null===(i=null===(t=this._room.localStream)||void 0===t?void 0:t.observer)||void 0===i||i.setEnableAudio(!1),[2]}}))}))},t.prototype.getAudioMixingManager=function(){return HX.print("getAudioMixingManager()"),this._audioMixingManager},t.prototype.startScreenCapture=function(e){var t,i,r,n,o,a,s;return void 0===e&&(e={}),tf(this,void 0,void 0,(function(){var c,u,d,l,h,p,_,f=this;return rf(this,(function(v){switch(v.label){case 0:if(HX.print("startScreenCapture()","config: %o",e),(null===(t=this._localScreenVideoTrack)||void 0===t?void 0:t.dummy)||null===(i=this._localScreenVideoTrack)||void 0===i||i.close(),this._localScreenVideoTrack=void 0,c=e.enableAudio,u=void 0!==c&&c,this._trackSourceType.screenVideo===O_.VIDEO_SOURCE_TYPE_EXTERNAL)throw new Vj(Nj.STREAM_TYPE_NOT_MATCH,"setVideoSourceType as internal first");if(this._trackSourceType.screenAudio===w_.AUDIO_SOURCE_TYPE_EXTERNAL)throw new Vj(Nj.STREAM_TYPE_NOT_MATCH,"setAudioSourceType as internal first");return[4,Oz(u,this._screenStreamEncodeConfig[0])];case 1:return d=v.sent(),this._localScreenVideoTrack=new gz(d.getVideoTracks()[0],_U()),(null===(r=this._screenStreamEncodeConfig[0])||void 0===r?void 0:r.contentHint)&&this._localScreenVideoTrack.setContentHint(null===(n=this._screenStreamEncodeConfig[0])||void 0===n?void 0:n.contentHint),(l=null===(o=this._localScreenVideoTrack)||void 0===o?void 0:o.getTrack())&&(h=l.getSettings(),p={width:h.width,height:h.height},this._localScreenVideoTrack.resolution=p,setTimeout((function(){return f.safeEmit(hf.onLocalVideoSizeChanged,{streamIndex:x_.STREAM_INDEX_SCREEN,info:{width:h.width,height:h.height}})}))),(_=d.getAudioTracks()).length&&(this._localScreenAudioTrack=new Ez(_[0],_U()),this._initLocalTrackEvents(this._localScreenAudioTrack)),null===(a=this._screenPlayer)||void 0===a||a.playVideo(this._localScreenVideoTrack),this._initLocalTrackEvents(this._localScreenVideoTrack),(null===(s=this._room)||void 0===s?void 0:s.hasScreenPublished)?[4,this._updateScreenPublish()]:[3,3];case 2:v.sent(),v.label=3;case 3:return[2]}}))}))},t.prototype.stopScreenCapture=function(){var e,t,i,r;return tf(this,void 0,void 0,(function(){return rf(this,(function(n){switch(n.label){case 0:return HX.print("stopScreenCapture()"),null===(e=this._screenPlayer)||void 0===e||e.stop(),null===(t=this._localScreenVideoTrack)||void 0===t||t.close(),this._localImgScreenTrack&&this._localScreenVideoTrack?(this._localScreenVideoTrack.setTrack(this._localImgScreenTrack),this._localScreenVideoTrack.dummy=!0):this._localScreenVideoTrack=void 0,null===(i=this._localScreenAudioTrack)||void 0===i||i.close(),this._localScreenAudioTrack=void 0,(null===(r=this._room)||void 0===r?void 0:r.hasScreenPublished)?[4,this._updateScreenPublish()]:[3,2];case 1:n.sent(),n.label=2;case 2:return[2]}}))}))},t.prototype.setLocalVideoPlayer=function(e,t){var i,r,n,o,a,s;if(HX.print("setLocalVideoPlayer()","streamIndex: %o, videoPlayerOption: %o",e,t),Gj(e,"streamIndex",[x_.STREAM_INDEX_MAIN,x_.STREAM_INDEX_SCREEN]),t&&t.renderDom){var c=$_({userId:this._getUserId()},t);return qj(c),e!==x_.STREAM_INDEX_MAIN||this._videoPlayer?e!=x_.STREAM_INDEX_SCREEN||this._screenPlayer?void 0:(this._screenPlayer=new eW($_($_({},c),{isScreen:!0})),this._initPlayerEvents(this._screenPlayer),this._localScreenVideoTrack&&!this._localScreenVideoTrack.dummy&&(null===(a=this._config)||void 0===a?void 0:a.autoPlayPolicy)!==Z_.PLAY_MANUALLY&&this._screenPlayer.playVideo(this._localScreenVideoTrack),(null===(s=this._room)||void 0===s?void 0:s.localScreenStream)&&(this._room.localScreenStream.videoDom=this._screenPlayer.domElement),this._screenPlayer.domElement):(this._videoPlayer=new eW(c),this._initPlayerEvents(this._videoPlayer),this._videoPlayer.mirror(!!this._mirrorType),this._localVideoTrack&&!this._localVideoTrack.dummy&&(null===(n=this._config)||void 0===n?void 0:n.autoPlayPolicy)!==Z_.PLAY_MANUALLY&&this._videoPlayer.playVideo(this._localVideoTrack),(null===(o=this._room)||void 0===o?void 0:o.localStream)&&(this._room.localStream.videoDom=this._videoPlayer.domElement),this._videoPlayer.domElement)}e==x_.STREAM_INDEX_MAIN?(null===(i=this._videoPlayer)||void 0===i||i.destroy(),delete this._videoPlayer):(null===(r=this._screenPlayer)||void 0===r||r.destroy(),delete this._screenPlayer)},t.prototype.startLiveTranscoding=function(e){var t;return tf(this,void 0,void 0,(function(){var i;return rf(this,(function(r){switch(r.label){case 0:HX.print("startLiveTranscoding()","transcode: %o",e),jj(e.url,"liveTranscode.url"),this._liveTranscodeConfig=e,r.label=1;case 1:return r.trys.push([1,3,,4]),this.safeEmit(hf.onStreamMixingEvent,{event:Hz.START,error:0,message:""}),[4,null===(t=this._room)||void 0===t?void 0:t.liveControlMessage(NF("started",this._liveTranscodeConfig))];case 2:return r.sent(),[3,4];case 3:throw(i=r.sent())instanceof Vj?i:new Vj(Nj.UNEXPECTED_ERROR,"unexpected error",i);case 4:return[2]}}))}))},t.prototype.updateLiveTranscoding=function(e){var t;return tf(this,void 0,void 0,(function(){var i;return rf(this,(function(r){switch(r.label){case 0:if(HX.print("updateLiveTranscoding()","transcode: %o",e),!this._liveTranscodeConfig)return[2];this._liveTranscodeConfig=OX(this._liveTranscodeConfig,e),r.label=1;case 1:return r.trys.push([1,3,,4]),this.safeEmit(hf.onStreamMixingEvent,{event:Hz.UPDATE,error:0,message:""}),[4,null===(t=this._room)||void 0===t?void 0:t.liveControlMessage(NF("layoutChanged",this._liveTranscodeConfig))];case 2:return r.sent(),[3,4];case 3:throw(i=r.sent())instanceof Vj?i:new Vj(Nj.UNEXPECTED_ERROR,"unexpected error",i);case 4:return[2]}}))}))},t.prototype.stopLiveTranscoding=function(){var e;return tf(this,void 0,void 0,(function(){var t;return rf(this,(function(i){switch(i.label){case 0:if(HX.print("stopLiveTranscoding()"),!this._liveTranscodeConfig)return[2];delete this._liveTranscodeConfig,i.label=1;case 1:return i.trys.push([1,3,,4]),this.safeEmit(hf.onStreamMixingEvent,{event:Hz.STOP,error:0,message:""}),[4,null===(e=this._room)||void 0===e?void 0:e.liveControlMessage({action:"stopped",type:"transcode"})];case 2:return i.sent(),[3,4];case 3:throw(t=i.sent())instanceof Vj?t:new Vj(Nj.UNEXPECTED_ERROR,"unexpected error",t);case 4:return[2]}}))}))},t.prototype.setBusinessId=function(e){return HX.print("setBusinessId()","businessId: %s",e),!function(e){return"string"!=typeof e}(e)&&!this._room&&(zB.setStats({rtc_business_id:e}),this._businessId=e,!0)},t.prototype.setUserVisibility=function(e){var t,i;return tf(this,void 0,void 0,(function(){return rf(this,(function(r){switch(r.label){case 0:if(HX.print("setUserVisibility()","enable: %o",e),e=!!e,this._visibility===e)return[2];if(!this._room)return this._visibility=e,[2];if(this._room.connectionState!==gK.CONNECTED)throw new Vj(Nj.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?NX.NORMAL_USER:NX.SILENT_USER})];case 3:return r.sent(),this._visibility=e,e&&(null===(i=this._roomConfig)||void 0===i?void 0:i.isAutoPublish)&&this._updatePublish({mediaType:V_.AUDIO_AND_VIDEO}),[2]}}))}))},t.prototype._initPlayerEvents=function(e,t){var i=this;void 0===t&&(t=!1),e.on("playback_event",(function(r){var n,o,a,s;switch(null===(o=null===(n=i._room)||void 0===n?void 0:n.remoteStreams.get(r.userId||""))||void 0===o||o.find((function(e){return!e.isScreen})),r.eventName){case"timeupdate":return;case"loadeddata":if("audio"===r.type)t?i.safeEmit(hf.onFirstPublicStreamAudioFrameDecoded,{publicStreamId:e.userId}):i.safeEmit(hf.onAudioFirstFrameDecoded,{userId:e.userId}),jB.firstRemoteAudioRender("",r.userId||"");else{var c={userId:e.userId,height:(null===(a=e.domElement)||void 0===a?void 0:a.videoHeight)||0,width:(null===(s=e.domElement)||void 0===s?void 0:s.videoWidth)||0};t?(c.publicStreamId=c.userId,delete c.userId,i.safeEmit(hf.onFirstPublicStreamVideoFrameDecoded,c),i.safeEmit(hf.onFirstPublicStreamVideoFrameRendered,c)):(i.safeEmit(hf.onVideoFirstFrameDecoded,c),i.safeEmit(hf.onVideoFirstFrameRendered,c)),jB.firstRemoteVideoRender("",r.userId||"")}break;case"autoplay-error":return t&&(r.publicStreamId=r.userId),HX.print("autoplay-error","userId: ".concat(r.userId,", kind: ").concat(e instanceof eW,", rawEvent: "),r.rawEvent),void i.safeEmit(hf.onAutoplayFailed,{userId:r.userId,kind:e instanceof eW?"video":"audio",mediaType:e instanceof eW?V_.VIDEO:V_.AUDIO,streamIndex:e.isScreen?x_.STREAM_INDEX_SCREEN:x_.STREAM_INDEX_MAIN})}i.safeEmit(hf.onPlayerEvent,r)}))},t.prototype._initLocalTrackEvents=function(e,t){var i=this;void 0===t&&(t=!1),e.on("track-ended",(function(e){var t=!1;e!==i._localScreenAudioTrack&&e!==i._localScreenVideoTrack||(t=!0),i.safeEmit(hf.onTrackEnded,{kind:e.getTrack().kind,isScreen:t})})),e.on("resolution-change",(function(e){i.safeEmit(hf.onLocalVideoSizeChanged,{streamIndex:t?x_.STREAM_INDEX_SCREEN:x_.STREAM_INDEX_MAIN,info:e})}))},t.prototype.setRemoteVideoPlayer=function(e,t){var i,r,n,o,a,s;HX.print("setRemoteVideoPlayer()","streamIndex: %o, videoPlayerOption: %o",e,t),Gj(e,"streamIndex",[x_.STREAM_INDEX_MAIN,x_.STREAM_INDEX_SCREEN]),qj(t);var c=t.userId;if(e==x_.STREAM_INDEX_MAIN){if(null===(i=this._remoteVideoPlayer.get(c))||void 0===i||i.destroy(),!t.renderDom)return;var u=new eW(t);return this._initPlayerEvents(u),this._remoteVideoPlayer.set(c,u),(d=null===(n=null===(r=this._room)||void 0===r?void 0:r.remoteStreams.get(c))||void 0===n?void 0:n.find((function(e){return!e.isScreen})))&&(this._updateVideoPlayerState(d),d.videoDom=u.domElement),u.domElement}if(null===(o=this._remoteScreenPlayer.get(c))||void 0===o||o.destroy(),t.renderDom){var d;u=new eW($_($_({},t),{isScreen:!0}));return this._remoteScreenPlayer.set(c,u),this._initPlayerEvents(u),(d=null===(s=null===(a=this._room)||void 0===a?void 0:a.remoteStreams.get(c))||void 0===s?void 0:s.find((function(e){return e.isScreen})))&&(this._updateVideoPlayerState(d),d.videoDom=u.domElement),u.domElement}},t.prototype.setLocalVideoMirrorType=function(e){HX.print("setLocalVideoMirrorType()","mirrorType: %o",e),Gj(e,"mirrorType",[j_.MIRROR_TYPE_NONE,j_.MIRROR_TYPE_RENDER]),this._mirrorType=e,this._videoPlayer&&this._videoPlayer.mirror(!!e)},t.prototype.setAudioPlaybackDevice=function(e){return tf(this,void 0,void 0,(function(){var t;return rf(this,(function(i){switch(i.label){case 0:return HX.print("setAudioPlaybackDevice()","deviceId: %s",e),jj(e,"deviceId"),void 0===HTMLAudioElement.prototype.setSinkId?(HX.print("setAudioPlaybackDevice failed","setSinkId not supported by current browser"),[2]):[4,sz.getDeviceById(e)];case 1:if(!(t=i.sent()))throw new Vj(Nj.INVALID_DEVICE_ID,"audio playback device id ".concat(e," is invalid"));return this._remoteAudioPlayer.forEach((function(t){t.setPlaybackDevice(e)})),this._remoteScreenAudioPlayer.forEach((function(t){t.setPlaybackDevice(e)})),this._audioPlaybackDeviceId=e,t&&this.safeEmit(hf.onAudioPlaybackDeviceChanged,t),jB.rtcAudioDevice(lB.PLAYOUT_DEVICE_SWITCH,e,0),[2]}}))}))},t.prototype.play=function(e,t,i){var r,n,o,a,s,c;return void 0===t&&(t=V_.AUDIO_AND_VIDEO),tf(this,void 0,void 0,(function(){var u,d,l,h,p,_,f,v;return rf(this,(function(m){return HX.print("play()","userId: %s, mediaType: %s, streamIndex: %s",e,t,i),u=!e||e===this._getUserId()||"local_user",d=void 0===i||i===x_.STREAM_INDEX_MAIN,l=void 0===i||i===x_.STREAM_INDEX_SCREEN,h=t!==V_.VIDEO,p=t!==V_.AUDIO,_=[],u&&p&&(d&&this._localVideoTrack&&(null===(r=this._videoPlayer)||void 0===r||r.mirror(!!this._mirrorType),_.push(null===(n=this._videoPlayer)||void 0===n?void 0:n.playVideo(this._localVideoTrack))),l&&this._localScreenVideoTrack&&_.push(null===(o=this._screenPlayer)||void 0===o?void 0:o.playVideo(this._localScreenVideoTrack))),e===(null===(a=this._audioMixingManager)||void 0===a?void 0:a.id)&&_.push(this._audioMixingManager.resumeLocalPlay()),f=null===(s=this._room)||void 0===s?void 0:s.remoteStreams,p&&d&&_.push(nW(this._remoteVideoPlayer,e,!1,f)),p&&l&&_.push(nW(this._remoteScreenPlayer,e,!0,f)),h&&d&&_.push(nW(this._remoteAudioPlayer,e,!1,f)),p&&l&&_.push(nW(this._remoteScreenAudioPlayer,e,!0,f)),v=null===(c=this._outsideRoom)||void 0===c?void 0:c.remoteStreams,h&&_.push(nW(this._publicStreamVideoPlayer,e,!1,v)),p&&_.push(nW(this._publicStreamAudioPlayer,e,!1,v)),[2,Promise.all(_).then((function(){}))]}))}))},t.prototype.pauseAllSubscribedStream=function(e){return tf(this,void 0,void 0,(function(){var t,i=this;return rf(this,(function(r){return HX.print("pauseAllSubscribedStream()","mediaType: %o",e),this._checkMediaType(e),t=function(){VU(e)&&(i._pauseAllSubscribeState.audio=!0),FU(e)&&(i._pauseAllSubscribeState.video=!0)},this._room?[2,this._room.pauseAllSubscribedStream(e).then((function(){t()}))]:(t(),[2,Promise.resolve()])}))}))},t.prototype.resumeAllSubscribedStream=function(e){return tf(this,void 0,void 0,(function(){var t,i=this;return rf(this,(function(r){return HX.print("resumeAllSubscribedStream()","mediaType: %o",e),this._checkMediaType(e),t=function(){VU(e)&&(i._pauseAllSubscribeState.audio=!1),FU(e)&&(i._pauseAllSubscribeState.video=!1)},this._room?[2,this._room.resumeAllSubscribedStream(e).then((function(){var e,r;t(),null===(r=null===(e=i._room)||void 0===e?void 0:e.remoteStreams)||void 0===r||r.forEach((function(e){Array.isArray(e)&&e.forEach((function(e){i._updateAudioPlayerState(e),i._updateVideoPlayerState(e)}))}))}))]:(t(),[2,Promise.resolve()])}))}))},t.prototype.sendUserMessage=function(e,t){var i;return tf(this,void 0,void 0,(function(){var r,n=this;return rf(this,(function(o){if(Wj(e),Yj(t),!this._room||this._room.connectionState!==gK.CONNECTED)throw new Vj(Nj.IM_BEFORE_JOIN,"join first");return r=Date.now(),[2,null===(i=this._room.sendUserMessage(e,t))||void 0===i?void 0:i.then((function(t){return n._messageStatisticsObserver.countP2PMessage(!0,e,!1,r,t),t.id})).catch((function(t){throw n._messageStatisticsObserver.countP2PMessage(!1,e,!1,r),t}))]}))}))},t.prototype.sendUserBinaryMessage=function(e,t){var i;return tf(this,void 0,void 0,(function(){var r,n=this;return rf(this,(function(o){if(Wj(e),zj(t,"message"),Yj(t),!this._room||this._room.connectionState!==gK.CONNECTED)throw new Vj(Nj.IM_BEFORE_JOIN,"join first");return r=Date.now(),[2,null===(i=this._room.sendUserMessage(e,t))||void 0===i?void 0:i.then((function(t){return n._messageStatisticsObserver.countP2PMessage(!0,e,!0,r,t),t.id})).catch((function(t){throw n._messageStatisticsObserver.countP2PMessage(!1,e,!0,r),t}))]}))}))},t.prototype.sendRoomMessage=function(e){return tf(this,void 0,void 0,(function(){var t,i=this;return rf(this,(function(r){if(Yj(e),!this._room||this._room.connectionState!==gK.CONNECTED)throw new Vj(Nj.IM_BEFORE_JOIN,"join first");return t=Date.now(),[2,this._room.sendRoomMessage(e).then((function(e){var r,n;return i._messageStatisticsObserver.countRoomMessage(!0,null===(n=null===(r=i._room)||void 0===r?void 0:r.roomInfo)||void 0===n?void 0:n.roomId,!1,t),e})).catch((function(e){var r,n;throw i._messageStatisticsObserver.countRoomMessage(!1,null===(n=null===(r=i._room)||void 0===r?void 0:r.roomInfo)||void 0===n?void 0:n.roomId,!1,t),e}))]}))}))},t.prototype.sendRoomBinaryMessage=function(e){return tf(this,void 0,void 0,(function(){var t,i=this;return rf(this,(function(r){if(Yj(e),!this._room||this._room.connectionState!==gK.CONNECTED)throw new Vj(Nj.IM_BEFORE_JOIN,"join first");return t=Date.now(),[2,this._room.sendRoomMessage(e,!0).then((function(e){var r,n;return i._messageStatisticsObserver.countRoomMessage(!0,null===(n=null===(r=i._room)||void 0===r?void 0:r.roomInfo)||void 0===n?void 0:n.roomId,!0,t),e})).catch((function(e){var r,n;throw i._messageStatisticsObserver.countRoomMessage(!1,null===(n=null===(r=i._room)||void 0===r?void 0:r.roomInfo)||void 0===n?void 0:n.roomId,!0,t),e}))]}))}))},t.prototype.setAudioCaptureConfig=function(e){var t;return void 0===e&&(e={}),tf(this,void 0,void 0,(function(){var i;return rf(this,(function(r){switch(r.label){case 0:return HX.print("setAudioCaptureConfig()","config: %o",e),delete e.deviceId,function(e){var t,i;try{var r=navigator.mediaDevices.getSupportedConstraints();try{for(var n=nf(Object.keys(e)),o=n.next();!o.done;o=n.next()){var a=o.value;r[a]||delete e[a]}}catch(e){t={error:e}}finally{try{o&&!o.done&&(i=n.return)&&i.call(n)}finally{if(t)throw t.error}}}catch(e){}}(e),i=this._audioStreamConstraints.deviceId,this._audioStreamConstraints=e,i&&(this._audioStreamConstraints.deviceId=i),this._localAudioTrack?(this._localAudioTrack.audioCaptureConfig=this._audioStreamConstraints,[4,null===(t=this._localAudioTrack)||void 0===t?void 0:t.updateAudioCaptureConfig()]):[3,2];case 1:r.sent(),r.label=2;case 2:return[2]}}))}))},t.prototype.setVideoCaptureConfig=function(e){var t;return void 0===e&&(e={}),tf(this,void 0,void 0,(function(){var i;return rf(this,(function(r){switch(r.label){case 0:return HX.print("setVideoCaptureConfig()","config: %o",e),delete e.deviceId,i=this._videoStreamConstraints.deviceId,"number"==typeof e.width&&(e.width={ideal:e.width,max:e.width}),"number"==typeof e.height&&(e.height={ideal:e.height,max:e.height}),this._videoStreamConstraints=e,i&&(this._videoStreamConstraints.deviceId=i),this._localVideoTrack?(this._localVideoTrack.videoCaptureConfig=this._videoStreamConstraints,[4,null===(t=this._localVideoTrack)||void 0===t?void 0:t.updateVideoCaptureConfig()]):[3,2];case 1:r.sent(),this._updatePublish(),r.label=2;case 2:return[2]}}))}))},t.prototype.enableSimulcastMode=function(e){return HX.print("enableSimulcastMode()","enabled: %o",e),this._enableSimulcast=e,!0},t.prototype.setVideoEncoderConfig=function(e){var t,i,r;return tf(this,void 0,void 0,(function(){return rf(this,(function(n){return HX.print("setVideoEncoderConfig()"," descriptions: %o",e),Array.isArray(e)||(e=[e]),(e=e.filter((function(e){return e}))).length>3&&(e=e.slice(0,3)),e.sort((function(e,t){return t.maxKbps-e.maxKbps})),this._localVideoTrack&&(null===(t=e[0])||void 0===t?void 0:t.contentHint)&&this._localVideoTrack.setContentHint(null===(i=e[0])||void 0===i?void 0:i.contentHint),this._videoStreamEncodeConfig=e,(null===(r=this._room)||void 0===r?void 0:r.hasPublished)&&this._updatePublish(),[2]}))}))},t.prototype.autoResetVideoEncoderConfig=function(e){var t;if(e){(null===(t=this._videoStreamEncodeConfig)||void 0===t?void 0:t.length)||(this._videoStreamEncodeConfig=[LF]);var i=e.width*e.height,r=this._videoStreamEncodeConfig[0];if(!(GU(r.width)*GU(r.height)<=i)){var n,o,a=MF,s=a[0];a.forEach((function(e,t){var r=GU(e.width)*GU(e.height);n||(i<r?n=e:s=e)})),o=n&&GU(n.width)*GU(n.height)-i<i-GU(s.width)*GU(s.height)?Object.assign({},n):Object.assign({},s),this._videoStreamEncodeConfig=this._videoStreamEncodeConfig.filter((function(e){return!(o&&GU(e.width)*GU(e.height)>=i)||(o.maxKbps=Math.min(e.maxKbps,o.maxKbps),!1)})),this._videoStreamEncodeConfig.unshift({width:e.width,height:e.height,frameRate:e.frameRate?Math.round(e.frameRate):this._videoStreamEncodeConfig[0].frameRate,maxKbps:o.maxKbps}),HX.print("autoResetVideoEncoderConfig() result",JSON.stringify(this._videoStreamEncodeConfig)),jB.rtcInvokeStatus(JSON.stringify(this._videoStreamEncodeConfig),0,"autoResetVideoEncoderConfig","",0)}}},t.prototype.setScreenEncoderConfig=function(e){var t;return tf(this,void 0,void 0,(function(){return rf(this,(function(i){return HX.print("setScreenEncoderConfig()","description: %o",e),this._screenStreamEncodeConfig=[e],this._localScreenVideoTrack&&(this._localScreenVideoTrack.videoCaptureConfig=e,this._localScreenVideoTrack.updateVideoCaptureConfig(),e.contentHint&&this._localScreenVideoTrack.setContentHint(e.contentHint)),(null===(t=this._room)||void 0===t?void 0:t.hasScreenPublished)&&this._updateScreenPublish(),[2]}))}))},t.prototype.sendSEIMessage=function(e,t,i){var r,n,o,a,s,c;HX.print("sendSEIMessage()","streamIdex: %o, message: %o, repeatCount: %o",e,t,i),Gj(e,"streamIndex",[x_.STREAM_INDEX_MAIN,x_.STREAM_INDEX_SCREEN]),Bj(i,"repeatCount",0,30);var u="string"==typeof t?new Uint8Array(yU.str2ab(t)):t;if(t.length){var d;if(e===x_.STREAM_INDEX_MAIN){if(!(null===(n=null===(r=this._room)||void 0===r?void 0:r.localStream)||void 0===n?void 0:n.hasPublished))return;d=null===(o=this._room)||void 0===o?void 0:o.localStream}else{if(!(null===(s=null===(a=this._room)||void 0===a?void 0:a.localScreenStream)||void 0===s?void 0:s.hasPublished))return;d=null===(c=this._room)||void 0===c?void 0:c.localScreenStream}if(u.byteLength>4096)HX.print("sei size must not bigger than 4KB");else{var l=_U();d.seiList.push({content:u,uuid:l,repeatCount:i}),setTimeout((function(){if(d){var e=d.seiList.findIndex((function(e){return e.uuid===l}));e&&d.seiList.splice(e,1)}}),2e3)}}else HX.print("sei message must not be empty")},t.prototype.setAudioVolumeIndicationInterval=function(e){var t=this;HX.print("setAudioVolumeIndicationInterval()","interval %o: ",e),("number"!=typeof e||e<200)&&(e=200);var i=[];this._audioVolumeIndicationTimer&&clearInterval(this._audioVolumeIndicationTimer),this._audioVolumeIndicationTimer=setInterval((function(){var e,r;i=[],null===(e=t._room)||void 0===e||e.remoteStreams.forEach((function(e,t){var r;if(0!==e.length){var n=e.find((function(e){return!1===e.isScreen})),o=null===(r=null==n?void 0:n.audioTrack)||void 0===r?void 0:r.getAudioLevel();i.push({userId:t,volume:o||0})}}));var n=null===(r=t._localAudioTrack)||void 0===r?void 0:r.getAudioLevel();i.push({userId:t._getUserId(),volume:n||0}),t.safeEmit(hf.onAudioVolumeIndication,{speakers:i})}),e)},t.prototype.enableAudioPropertiesReport=function(e){var t,i,r,n,o,a=this;void 0===e&&(e={}),HX.print("enableAudioPropertiesReport()","config %o: ",e);var s=e.interval,c=void 0===s?100:s,u=e.enableInBackground,d=void 0===u||u;if(this._stopAudioPropertiesReport(),c<=0)return null===(t=this._room)||void 0===t||t.remoteStreams.forEach((function(e){e.forEach((function(e){return e.stopRecordAudioEnergy()}))})),null===(r=null===(i=this._room)||void 0===i?void 0:i.localStream)||void 0===r||r.stopRecordAudioEnergy(),void(null===(o=null===(n=this._room)||void 0===n?void 0:n.localScreenStream)||void 0===o||o.stopRecordAudioEnergy());c=Math.max(100,c),this._audioPropertiesReportTimer=self.setInterval((function(){var e,t,i,r;if(d||"hidden"!==document.visibilityState){var n=[],o=a._audioDeviceManager.getRecordTrack()||a._localAudioTrack;if(o){var s=o.getAudioLevel();null===(t=null===(e=a._room)||void 0===e?void 0:e.localStream)||void 0===t||t.recordAudioEnergy(s),n.push({streamIndex:x_.STREAM_INDEX_MAIN,audioPropertiesInfo:{linearVolume:s,nonlinearVolume:xU(s)}})}if(a._localScreenAudioTrack){s=a._localScreenAudioTrack.getAudioLevel();null===(r=null===(i=a._room)||void 0===i?void 0:i.localScreenStream)||void 0===r||r.recordAudioEnergy(s),n.push({streamIndex:x_.STREAM_INDEX_SCREEN,audioPropertiesInfo:{linearVolume:s,nonlinearVolume:xU(s)}})}if(a.safeEmit(hf.onLocalAudioPropertiesReport,n),a._room){var c=[];a._room.remoteStreams.forEach((function(e,t){e.forEach((function(e){var i,r;if(e.audioTrack){var n=e.audioTrack.getAudioLevel();e.recordAudioEnergy(n),c.push({streamKey:{userId:t,streamIndex:e.isScreen?x_.STREAM_INDEX_SCREEN:x_.STREAM_INDEX_MAIN,roomId:null===(r=null===(i=a._room)||void 0===i?void 0:i.roomInfo)||void 0===r?void 0:r.roomId},audioPropertiesInfo:{linearVolume:n,nonlinearVolume:xU(n)}})}}))})),a.safeEmit(hf.onRemoteAudioPropertiesReport,c)}}}),c),AU&&(this._localAudioInputTimer=self.setInterval((function(){var e,t;a._localAudioTrack&&(a._localAudioTrack.checkHasInput()?a._localAudioNoInputCount=0:(a._localAudioNoInputCount++,5===a._localAudioNoInputCount&&(null===(e=a.localAudioTrack)||void 0===e||e.resetAudioLevelFetcher(),null===(t=a._room)||void 0===t||t.remoteStreams.forEach((function(e){Array.isArray(e)&&e.filter((function(e){return!e.isScreen})).forEach((function(e){var t;null===(t=null==e?void 0:e.audioTrack)||void 0===t||t.resetAudioLevelFetcher()}))})),HX.print("Reset audio level fetcher",""),jB.rtcInvokeStatus("Reset audio level fetcher",0,"_localAudioInputTimer","",0))))}),400))},t.prototype.setVideoSourceType=function(e,t){var i,r,n,o,a,s,c,u,d,l,h,p,_,f,v,m,y;return tf(this,void 0,void 0,(function(){var S,g,E;return rf(this,(function(b){switch(b.label){case 0:return HX.print("setVideoSourceType()","index: %o, videoSourceType: %o",e,t),Gj(e,"streamIndex",[x_.STREAM_INDEX_MAIN,x_.STREAM_INDEX_SCREEN]),Gj(t,"VideoSourceType",[O_.VIDEO_SOURCE_TYPE_EXTERNAL,O_.VIDEO_SOURCE_TYPE_INTERNAL]),S=e===x_.STREAM_INDEX_MAIN?"video":"screenVideo",this._trackSourceType[S]===t?[3,4]:(this._trackSourceType[S]=t,HX.print("setVideoSourceType","set ".concat(S," source type to ").concat(t)),this._localVideoTrack&&e===x_.STREAM_INDEX_MAIN?(E=!1,t===O_.VIDEO_SOURCE_TYPE_EXTERNAL&&(E=!0,this._localVideoTrack.close()),null===(i=this._videoPlayer)||void 0===i||i.stop(),this._localVideoTrack=void 0,g=null===(r=this._room)||void 0===r?void 0:r._roomConfig.isAutoPublish,E?null===(a=null===(o=null===(n=this._room)||void 0===n?void 0:n.localStream)||void 0===o?void 0:o.observer)||void 0===a||a.setEnableVideo(!1):null===(u=null===(c=null===(s=this._room)||void 0===s?void 0:s.localStream)||void 0===c?void 0:c.observer)||void 0===u||u.setPushVideo(!1),(null===(d=this._room)||void 0===d?void 0:d.hasPublished)||g?[4,this._updatePublish()]:[3,2]):[3,2]);case 1:b.sent(),b.label=2;case 2:return this._localScreenVideoTrack&&e===x_.STREAM_INDEX_SCREEN?(E=!1,t===O_.VIDEO_SOURCE_TYPE_EXTERNAL&&(E=!0,this._localScreenVideoTrack.close()),null===(l=this._screenPlayer)||void 0===l||l.stop(),this._localScreenVideoTrack=void 0,E?null===(_=null===(p=null===(h=this._room)||void 0===h?void 0:h.localScreenStream)||void 0===p?void 0:p.observer)||void 0===_||_.setEnableVideo(!1):null===(m=null===(v=null===(f=this._room)||void 0===f?void 0:f.localScreenStream)||void 0===v?void 0:v.observer)||void 0===m||m.setPushVideo(!1),(null===(y=this._room)||void 0===y?void 0:y.hasScreenPublished)?[4,this._updateScreenPublish()]:[3,4]):[3,4];case 3:b.sent(),b.label=4;case 4:return[2]}}))}))},t.prototype.setExternalVideoTrack=function(e,t){var i,r,n,o,a,s,c,u;return tf(this,void 0,void 0,(function(){var d;return rf(this,(function(l){switch(l.label){case 0:if(HX.print("setExternalVideoTrack()","index: %o, track: %o",e,t),Gj(e,"streamIndex",[x_.STREAM_INDEX_MAIN,x_.STREAM_INDEX_SCREEN]),e!==x_.STREAM_INDEX_MAIN)return[3,2];if(this._trackSourceType.video!==O_.VIDEO_SOURCE_TYPE_EXTERNAL)throw new Vj(Nj.STREAM_TYPE_NOT_MATCH,"setVideoSourceType as external first");return this._localVideoTrack=new bz(t,_U()),this._initLocalTrackEvents(this._localVideoTrack),null===(i=this._videoPlayer)||void 0===i||i.playVideo(this._localVideoTrack),d=null===(r=this._room)||void 0===r?void 0:r._roomConfig.isAutoPublish,(null===(n=this._room)||void 0===n?void 0:n.hasPublished)||d?[4,this._updatePublish()]:[3,2];case 1:l.sent(),l.label=2;case 2:if(e!==x_.STREAM_INDEX_SCREEN)return[3,4];if(this._trackSourceType.screenVideo!==O_.VIDEO_SOURCE_TYPE_EXTERNAL)throw new Vj(Nj.STREAM_TYPE_NOT_MATCH,"setVideoSourceType as external first");return this._localScreenVideoTrack=new bz(t,_U()),this._initLocalTrackEvents(this._localScreenVideoTrack),null===(o=this._screenPlayer)||void 0===o||o.playVideo(this._localScreenVideoTrack),null===(c=null===(s=null===(a=this._room)||void 0===a?void 0:a.localScreenStream)||void 0===s?void 0:s.observer)||void 0===c||c.setPushVideo(!0),(null===(u=this._room)||void 0===u?void 0:u.hasScreenPublished)?[4,this._updateScreenPublish()]:[3,4];case 3:l.sent(),l.label=4;case 4:return[2]}}))}))},t.prototype.setAudioSourceType=function(e,t){var i,r,n,o,a,s,c,u,d,l,h,p,_,f,v;return tf(this,void 0,void 0,(function(){var m,y,S;return rf(this,(function(g){switch(g.label){case 0:return HX.print("setAudioSourceType()","index: %o, audioSourceType: %o",e,t),Gj(e,"streamIndex",[x_.STREAM_INDEX_MAIN,x_.STREAM_INDEX_SCREEN]),Gj(t,"audioSourceType",[w_.AUDIO_SOURCE_TYPE_EXTERNAL,w_.AUDIO_SOURCE_TYPE_INTERNAL]),m=e===x_.STREAM_INDEX_MAIN?"audio":"screenAudio",this._trackSourceType[m]===t?[3,4]:(this._trackSourceType[m]=t,HX.print("setVideoSourceType","set ".concat(m," source type to ").concat(t)),this._localAudioTrack&&e===x_.STREAM_INDEX_MAIN?(S=!1,this._trackSourceType.audio===w_.AUDIO_SOURCE_TYPE_EXTERNAL&&(S=!0,this._localAudioTrack.close()),this._localAudioTrack=void 0,y=null===(i=this._room)||void 0===i?void 0:i._roomConfig.isAutoPublish,S?null===(o=null===(n=null===(r=this._room)||void 0===r?void 0:r.localStream)||void 0===n?void 0:n.observer)||void 0===o||o.setEnableAudio(!1):null===(c=null===(s=null===(a=this._room)||void 0===a?void 0:a.localStream)||void 0===s?void 0:s.observer)||void 0===c||c.setPushAudio(!1),(null===(u=this._room)||void 0===u?void 0:u.hasPublished)||y?[4,this._updatePublish()]:[3,2]):[3,2]);case 1:g.sent(),g.label=2;case 2:return this._localScreenAudioTrack&&e===x_.STREAM_INDEX_SCREEN?(S=!1,this._trackSourceType.audio===w_.AUDIO_SOURCE_TYPE_EXTERNAL&&(S=!0,this._localScreenAudioTrack.close()),this._localScreenAudioTrack=void 0,S?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===(f=null===(_=null===(p=this._room)||void 0===p?void 0:p.localScreenStream)||void 0===_?void 0:_.observer)||void 0===f||f.setPushAudio(!1),(null===(v=this._room)||void 0===v?void 0:v.hasScreenPublished)?[4,this._updateScreenPublish()]:[3,4]):[3,4];case 3:g.sent(),g.label=4;case 4:return[2]}}))}))},t.prototype.setExternalAudioTrack=function(e,t){var i,r,n,o,a,s,c,u,d;return tf(this,void 0,void 0,(function(){var l;return rf(this,(function(h){switch(h.label){case 0:if(HX.print("setExternalAudioTrack()","index: %o, track: %o",e,t),Gj(e,"streamIndex",[x_.STREAM_INDEX_MAIN,x_.STREAM_INDEX_SCREEN]),e!==x_.STREAM_INDEX_MAIN)return[3,2];if(this._trackSourceType.audio!==w_.AUDIO_SOURCE_TYPE_EXTERNAL)throw new Vj(Nj.STREAM_TYPE_NOT_MATCH,"setAudioSourceType as external first");return this._localAudioTrack=new Iz(t,_U()),this._initLocalTrackEvents(this._localAudioTrack),l=null===(i=this._room)||void 0===i?void 0:i._roomConfig.isAutoPublish,null===(o=null===(n=null===(r=this._room)||void 0===r?void 0:r.localStream)||void 0===n?void 0:n.observer)||void 0===o||o.setPushAudio(!0),(null===(a=this._room)||void 0===a?void 0:a.hasPublished)||l?[4,this._updatePublish()]:[3,2];case 1:h.sent(),h.label=2;case 2:if(e!==x_.STREAM_INDEX_SCREEN)return[3,4];if(this._trackSourceType.screenAudio!==w_.AUDIO_SOURCE_TYPE_EXTERNAL)throw new Vj(Nj.STREAM_TYPE_NOT_MATCH,"setAudioSourceType as external first");return this._localScreenAudioTrack=new Iz(t,_U()),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 tf(this,void 0,void 0,(function(){return rf(this,(function(i){return HX.print("login()","token: %o, userInfo: %o",e,t),Kj(e)||jj(e,"token"),Wj(t),[2,this._rtmClient.login(e,t)]}))}))},t.prototype.logout=function(){return tf(this,void 0,void 0,(function(){return rf(this,(function(e){return HX.print("logout()"),[2,this._rtmClient.logout()]}))}))},t.prototype.updateLoginToken=function(e){return tf(this,void 0,void 0,(function(){return rf(this,(function(t){return HX.print("updateLoginToken()","token: %o",e),Kj(e)||jj(e,"token"),[2,this._rtmClient.updateLoginToken(e)]}))}))},t.prototype.getPeerOnlineStatus=function(e){return tf(this,void 0,void 0,(function(){return rf(this,(function(t){return HX.print("getPeerOnlineStatus()","userId: %o",e),Wj(e),[2,this._rtmClient.getPeerOnlineStatus(e)]}))}))},t.prototype.sendUserMessageOutsideRoom=function(e,t){return tf(this,void 0,void 0,(function(){var i,r=this;return rf(this,(function(n){Wj(e),Yj(t),i=Date.now();try{return[2,this._rtmClient.sendUserMessageOutsideRoom(e,t).then((function(t){return r._messageStatisticsObserver.countUserMessageOutsideRoom(!0,e,!1,i,t),t.id})).catch((function(t){throw r._messageStatisticsObserver.countUserMessageOutsideRoom(!1,e,!1,i),t}))]}catch(t){throw this._messageStatisticsObserver.countUserMessageOutsideRoom(!1,e,!1,i),t}return[2]}))}))},t.prototype.sendUserBinaryMessageOutsideRoom=function(e,t){return tf(this,void 0,void 0,(function(){var i,r=this;return rf(this,(function(n){Wj(e),zj(t,"message"),Yj(t),i=Date.now();try{return[2,this._rtmClient.sendUserMessageOutsideRoom(e,t).then((function(t){return r._messageStatisticsObserver.countUserMessageOutsideRoom(!0,e,!0,i,t),t.id})).catch((function(t){throw r._messageStatisticsObserver.countUserMessageOutsideRoom(!1,e,!0,i),t}))]}catch(t){throw this._messageStatisticsObserver.countUserMessageOutsideRoom(!1,e,!0,i),t}return[2]}))}))},t.prototype.setServerParams=function(e,t){return tf(this,void 0,void 0,(function(){return rf(this,(function(i){return HX.print("setServerParams()","signature: %o, url: %0",e,t),jj(e,"signature"),jj(t,"url"),[2,this._rtmClient.setServerParams(e,t)]}))}))},t.prototype.sendServerMessage=function(e){return tf(this,void 0,void 0,(function(){var t,i=this;return rf(this,(function(r){jj(e,"message"),Yj(e),t=Date.now();try{return[2,this._rtmClient.sendServerMessage(e).then((function(){i._messageStatisticsObserver.countServerMessage(!0,!1,t)})).catch((function(e){throw i._messageStatisticsObserver.countServerMessage(!1,!1,t),e}))]}catch(e){throw this._messageStatisticsObserver.countServerMessage(!1,!1,t),e}return[2]}))}))},t.prototype.sendServerBinaryMessage=function(e){return tf(this,void 0,void 0,(function(){var t,i=this;return rf(this,(function(r){zj(e,"message"),Yj(e),t=Date.now();try{return[2,this._rtmClient.sendServerMessage(e).then((function(){i._messageStatisticsObserver.countServerMessage(!0,!0,t)})).catch((function(e){throw i._messageStatisticsObserver.countServerMessage(!1,!0,t),e}))]}catch(e){throw this._messageStatisticsObserver.countServerMessage(!1,!0,t),e}return[2]}))}))},t.prototype.startCloudProxy=function(e){if(this._room)throw new Vj(Nj.START_CLOUD_PROXY_AFTER_JOIN,"[startCloudProxy] should be invoke before join room ");var t;HX.print("startCloudProxy()",e),jj(e.logProxy,"logProxy"),jj(e.accessProxy,"accessProxy"),jj(e.configProxy,"configProxy"),this._originIceConfigRequestUrls=kF("ICE_CONFIG_REQUEST_URLS"),this._originLogServerUrl=kF("LOG_SERVER_URL"),this._originConfigServerUrls=kF("CONFIG_REQUEST_DOMAINS"),wF("ICE_CONFIG_REQUEST_URLS",e.accessProxy),wF("LOG_SERVER_URL",(void 0===(t=e.logProxy)&&(t=""),"https://".concat(t,"/video/v1/webrtc_log/"))),wF("CONFIG_REQUEST_DOMAINS",[e.configProxy]),this._useCloudProxy=!0},t.prototype.stopCloudProxy=function(){if(this._room)throw new Vj(Nj.STOP_CLOUD_PROXY_BEFORE_LEAVE,"[stopCloudProxy] should be invoke after leave room ");HX.print("stopCloudProxy()"),wF("ICE_CONFIG_REQUEST_URLS",[]),wF("LOG_SERVER_URL",this._originLogServerUrl),wF("CONFIG_REQUEST_DOMAINS",this._originConfigServerUrls),this._useCloudProxy=!1,this._startCloudProxyTimestamp=void 0},t.prototype.startPushPublicStream=function(e,t){return tf(this,void 0,void 0,(function(){var i,r=this;return rf(this,(function(n){if(HX.print("startPushPublicStream()","publicStreamId: %o, publicStreamParam: %o",e,t),Xj(e),!this._room||this._room.connectionState!==gK.CONNECTED)throw new Vj(Nj.START_PUBLIC_STREAM_BEFORE_JOIN,"join first");if(this._publicStreamIds.get(e))throw new Vj(Nj.REPEAT_PUSH,"repeat push public media stream");return i=PF(e,"started",t),[2,this._room.publicStreamControlMessage(i).then((function(){r._publicStreamIds.set(e,e)}))]}))}))},t.prototype.updatePublicStreamParam=function(e,t){return tf(this,void 0,void 0,(function(){var i;return rf(this,(function(r){if(HX.print("startPushPublicStream()","publicStreamId: %o, publicStreamParam: %o",e,t),Xj(e),!this._room||this._room.connectionState!==gK.CONNECTED)throw new Vj(Nj.START_PUBLIC_STREAM_BEFORE_JOIN,"join first");return i=PF(e,"layoutChanged",t),[2,this._room.publicStreamControlMessage(i)]}))}))},t.prototype.stopPushPublicStream=function(e){return tf(this,void 0,void 0,(function(){var t=this;return rf(this,(function(i){if(HX.print("startPushPublicStream()","publicStreamId: %o",e),Xj(e),!this._room||this._room.connectionState!==gK.CONNECTED)throw new Vj(Nj.START_PUBLIC_STREAM_BEFORE_JOIN,"join first");return[2,this._room.publicStreamControlMessage({type:"publicstream",action:"stopped",publicStreamID:e}).then((function(){t._publicStreamIds.delete(e)}))]}))}))},t.prototype.startPlayPublicStream=function(e){var t,i,r,n;return tf(this,void 0,void 0,(function(){var o,a,s,c=this;return rf(this,(function(u){switch(u.label){case 0:return Xj(e),this._outsideRoom?[3,2]:(this._outsideRoom=new UX(this._appId),this._outsideRoom.on(jz.RESUBSCRIBE,(function(e){var t,i,r=e.stream;if(r){var n=c._publicStreamAudioPlayer.get(r.streamId);n&&r.audioTrack&&(n.stop(),n.playAudio(null===(t=e.stream)||void 0===t?void 0:t.audioTrack));var o=c._publicStreamVideoPlayer.get(r.streamId);o&&r.videoTrack&&o.playVideo(null===(i=e.stream)||void 0===i?void 0:i.videoTrack)}})),null===(t=this._outsideRoom)||void 0===t||t.on("onRemoteStreamStats",(function(e){e.publicStreamId=e.userId,delete e.userId,delete e.isScreen,c.safeEmit(hf.onPublicStreamStats,e)})),null===(i=this._outsideRoom)||void 0===i||i.on("streamDecodeFailed",(function(e){c.safeEmit(hf.onError,{errorCode:Nj.PUBLIC_STREAM_DECODE_FAILED,publicStreamId:e.publicStreamId})})),null===(r=this._outsideRoom)||void 0===r||r.on(jz.ON_SEI_MESSAGED_RECEIVED,(function(e){c.safeEmit(hf.onPublicStreamSEIMessageReceived,e)})),[4,this._outsideRoom.connect()]);case 1:u.sent(),u.label=2;case 2:return[4,this._outsideRoom.startPlayPublicStream(e)];case 3:return o=u.sent(),(a=this._publicStreamVideoPlayer.get(e))&&(null==o?void 0:o.videoTrack)&&a.playVideo(o.videoTrack,o),!(s=this._publicStreamAudioPlayer.get(e))&&(null==o?void 0:o.audioTrack)&&(s=new rW(e,{muted:(null===(n=this._config)||void 0===n?void 0:n.autoPlayPolicy)===Z_.VIDEO_ONLY,isScreen:!1,useWebAudio:this.audioPlayerUseWebAudio}),this._initPlayerEvents(s,!0),s.playAudio(o.audioTrack),this._publicStreamAudioPlayer.set(e,s)),[2]}}))}))},t.prototype.stopPlayPublicStream=function(e){return tf(this,void 0,void 0,(function(){var t;return rf(this,(function(i){return this._outsideRoom?(this._outsideRoom.stopPlayPublicStream(e),(t=this._publicStreamAudioPlayer.get(e))&&(t.destroy(),this._publicStreamAudioPlayer.delete(e)),this._outsideRoom.destroy(),this._outsideRoom=void 0,[2]):[2]}))}))},t.prototype.setAudioProfile=function(e){return tf(this,void 0,void 0,(function(){return rf(this,(function(t){return this._audioProfileManager.setAudioProfile(e),[2]}))}))},t.prototype.setPublicStreamVideoPlayer=function(e,t){var i,r,n;HX.print("setPublicStreamVideoPlayer()","publicStreamId: %o, videoPlayerOption: %o",e,t);var o=this._publicStreamVideoPlayer.get(e);if(!(null==t?void 0:t.renderDom)&&o)return o.destroy(),void this._publicStreamVideoPlayer.delete(e);if(!o){o=new eW($_($_({},t),{userId:e})),this._initPlayerEvents(o,!0),this._publicStreamVideoPlayer.set(e,o);var a=null===(r=null===(i=this._outsideRoom)||void 0===i?void 0:i.remoteStreams)||void 0===r?void 0:r.get(e);(null==a?void 0:a.videoTrack)&&(null===(n=this._config)||void 0===n?void 0:n.autoPlayPolicy)!==Z_.PLAY_MANUALLY&&o.playVideo(a.videoTrack,a)}},t.prototype.setDummyCaptureImagePath=function(e,t){return tf(this,void 0,void 0,(function(){var i=this;return rf(this,(function(r){return[2,new Promise((function(r,n){jj(t,"filePath");var o=new Image;o.crossOrigin="anonymous",o.src=t,o.onload=function(){try{var t=document.createElement("canvas"),a=t.getContext("2d");if(!a)return n(new Vj(Nj.UNEXPECTED_ERROR,"Not support canvas"));t.width=o.width,t.height=o.height,a.drawImage(o,0,0,o.width,o.height),clearInterval(i._dummyTimer),i._dummyTimer=window.setInterval((function(){a.drawImage(o,0,0,o.width,o.height)}),200);var s=t.captureStream(5).getVideoTracks()[0];e===x_.STREAM_INDEX_MAIN?i._localImgVideoTrack=s:i._localImgScreenTrack=s,r()}catch(e){n(new Vj(Nj.UNEXPECTED_ERROR,e.message))}},o.onerror=function(){n(new Vj(Nj.UNEXPECTED_ERROR,"Load image error"))}}))]}))}))},t.prototype.defaultTranscoding=function(){return JSON.parse(JSON.stringify(DF))},t.prototype._updatePublish=function(e){return void 0===e&&(e={}),tf(this,void 0,void 0,(function(){var t,i,r;return rf(this,(function(n){switch(n.label){case 0:if(HX.print("_updatePublish()","config: %o",e),t={mediaType:void 0,invokeByJoinRoom:!1,pubState:zz.PUB},e=$_($_({},t),e),!this._visibility)throw new Vj(Nj.NO_PUBLISH_PERMISSION,"no publish permission");return[4,this._pubLock.lock()];case 1:if(i=n.sent(),!this._room||this._room.connectionState!==gK.CONNECTED)return i(),[2];n.label=2;case 2:return n.trys.push([2,4,5,6]),[4,this._room.publish(this._videoStreamEncodeConfig,this._enableSimulcast,this._localVideoTrack,this._localAudioTrack,e.mediaType,e.pubState,e.invokeByJoinRoom)];case 3:return n.sent(),this._videoPlayer&&this._room.localStream&&(this._room.localStream.videoDom=this._videoPlayer.domElement),[3,6];case 4:throw(r=n.sent())instanceof Vj?r:new Vj(Nj.UNEXPECTED_ERROR,"unexpected error",r);case 5:return i(),[7];case 6:return[2]}}))}))},t.prototype.startAudioPlaybackDeviceTest=function(e,t){return tf(this,void 0,void 0,(function(){return rf(this,(function(i){switch(i.label){case 0:return HX.print("startAudioPlaybackDeviceTest()","filePath: %o, indicationInterval: %o",e,t),jj(e,"filePath"),Bj(t,"indicationInterval"),[4,this._audioDeviceManager.startAudioPlaybackDeviceTest(e,t)];case 1:return[2,i.sent()]}}))}))},t.prototype.stopAudioPlaybackDeviceTest=function(){HX.print("stopAudioPlaybackDeviceTest()"),this._audioDeviceManager.stopAudioPlaybackDeviceTest()},t.prototype.startAudioDeviceRecordTest=function(e){return tf(this,void 0,void 0,(function(){return rf(this,(function(t){switch(t.label){case 0:return HX.print("startAudioDeviceRecordTest()","indicationInterval: %o",e),Bj(e,"indicationInterval"),[4,this._audioDeviceManager.startAudioDeviceRecordTest(e)];case 1:return t.sent(),[2]}}))}))},t.prototype.stopAudioDeviceRecordAndPlayTest=function(){HX.print("stopAudioDeviceRecordAndPlayTest()"),this._audioDeviceManager.stopAudioDeviceRecordAndPlayTest()},t.prototype.stopAudioDevicePlayTest=function(){HX.print("stopAudioDevicePlayTest()"),this._audioDeviceManager.stopAudioDevicePlayTest()},t.prototype.setRemoteUserPriority=function(e,t){var i;HX.print("setRemoteUserPriority()","userId: %o, priority: %o",e,t);try{Wj(e),Gj(t,"priority",[X_.HIGH,X_.MEDIUM,X_.LOW])}catch(e){return console.warn(e),!1}return this._userPriorityMap.set(e,t),null===(i=this._room)||void 0===i||i.setRemoteUserPriority(e,t),!0},t.prototype.setSubscribeFallbackOption=function(e){HX.print("setSubscribeFallbackOption()","option: %o",e);try{Gj(e,"option",[W_.DISABLE,W_.VIDEO_STREAM_LOW,W_.AUDIO_ONLY])}catch(e){return console.warn(e),!1}return!this._room&&(this._subscribeFallbackOption=e,!0)},t.prototype.getLocalStreamTrack=function(e,t){var i,r,n=this;if(HX.print("getLocalStreamTrack()","streamIndex: ".concat(e,", type: ").concat(t)),e===x_.STREAM_INDEX_MAIN?(i="video"===t?this.localVideoTrack:this.localAudioTrack,r=function(){var e;return null===(e=n._room)||void 0===e?void 0:e.localStream}):(i="video"===t?this.localScreenVideoTrack:this.localScreenAudioTrack,r=function(){var e;return null===(e=n._room)||void 0===e?void 0:e.localScreenStream}),i){var o=i instanceof kz&&i.mixedAudioTrack?i.mixedAudioTrack:i.getTrack();if(o){var a=r();return jX(o,"enabled",this._reportMsTrackEvent.bind(this,"enabled",(null==a?void 0:a.streamId)||"","getLocalStreamTrack",t)),jX(o,"readyState",(function(e){"ended"===e&&(GX(o,"enabled"),GX(o,"readyState")),n._reportMsTrackEvent("readyState",(null==a?void 0:a.streamId)||"","getLocalStreamTrack",t,e)})),o.addEventListener("ended",(function(){GX(o,"enabled"),GX(o,"readyState")})),o}}},t.prototype.getRemoteStreamTrack=function(e,t,i){var r,n,o=this;HX.print("getRemoteStreamTrack()","userId: ".concat(e,", streamIndex: ").concat(t,", type: ").concat(i));var a,s=(null===(r=this._room)||void 0===r?void 0:r.remoteStreams.get(e))||[];if(s&&s.length&&(t===x_.STREAM_INDEX_MAIN?(a=s.find((function(e){return!e.isScreen})),n="video"===i?null==a?void 0:a.videoTrack:null==a?void 0:a.audioTrack):(a=s.find((function(e){return e.isScreen})),n="video"===i?null==a?void 0:a.videoTrack:null==a?void 0:a.audioTrack),n)){var c=n.getTrack();if(c&&a){var u=a.streamId;return jX(c,"enabled",this._reportMsTrackEvent.bind(this,"enabled",u,"getRemoteStreamTrack",i)),jX(c,"readyState",(function(e){"ended"===e&&(GX(c,"enabled"),GX(c,"readyState")),o._reportMsTrackEvent("readyState",u,"getRemoteStreamTrack",i,e)})),c.addEventListener("ended",(function(){GX(c,"enabled"),GX(c,"readyState")})),c}}},t.prototype.getPublicStreamTrack=function(e,t){var i=this;if(HX.print("getPublicStreamTrack()","Id: ".concat(e,", type: ").concat(t)),this._outsideRoom&&this._outsideRoom.remoteStreams){var r=this._outsideRoom.remoteStreams.get(e);if(r){var n="video"===t?r.videoTrack:r.audioTrack;if(n){var o=n.getTrack();if(o){var a=r.streamId;return jX(o,"enabled",this._reportMsTrackEvent.bind(this,"enabled",a,"getPublicStreamTrack",t)),jX(o,"readyState",(function(e){"ended"===e&&(GX(o,"enabled"),GX(o,"readyState")),i._reportMsTrackEvent("readyState",a,"getPublicStreamTrack",t,e)})),o.addEventListener("ended",(function(){GX(o,"enabled"),GX(o,"readyState")})),o}}}}},t.prototype._reportMsTrackEvent=function(e,t,i,r,n){var o;switch(e){case"readyState":o="live"!==n?"".concat(r," stopped"):"unknown";break;case"enabled":o="".concat(r,!0===n?" unmuted":" muted");break;default:o="unknown"}jB.rtcInvokeStatus(o,0,i,t||"",0,{direction:"getLocalStreamTrack"===i?"up":"down"})},t.prototype._updateScreenPublish=function(e){return void 0===e&&(e={}),tf(this,void 0,void 0,(function(){var t,i,r;return rf(this,(function(n){switch(n.label){case 0:return HX.print("_updateScreenPublish()"),t={mediaType:void 0,pubState:zz.PUB},e=$_($_({},t),e),[4,this._pubLock.lock()];case 1:if(i=n.sent(),!this._room||this._room.connectionState!==gK.CONNECTED)return i(),[2];n.label=2;case 2:return n.trys.push([2,4,5,6]),[4,this._room.publishScreen(this._screenStreamEncodeConfig,this._localScreenVideoTrack,this._localScreenAudioTrack,e.mediaType,e.pubState)];case 3:return n.sent(),this._screenPlayer&&this._room.localScreenStream&&(this._room.localScreenStream.videoDom=this._screenPlayer.domElement),[3,6];case 4:throw(r=n.sent())instanceof Vj?r:new Vj(Nj.UNEXPECTED_ERROR,"unexpected error",r);case 5:return i(),[7];case 6:return[2]}}))}))},t.prototype._updateAudioPlayerState=function(e){var t,i;HX.print("_updateAudioPlayerState()");var r=e.userId,n=e.isScreen,o=n?this._remoteScreenAudioPlayer:this._remoteAudioPlayer,a=o.get(r);e.audioTrack?(a||(a=new rW(r,{muted:(null===(t=this._config)||void 0===t?void 0:t.autoPlayPolicy)===Z_.VIDEO_ONLY,isScreen:n,useWebAudio:this.audioPlayerUseWebAudio}),this._initPlayerEvents(a),o.set(r,a),this._audioPlaybackDeviceId&&a.setPlaybackDevice(this._audioPlaybackDeviceId)),(null===(i=this._config)||void 0===i?void 0:i.autoPlayPolicy)!==Z_.PLAY_MANUALLY&&a.playAudio(e.audioTrack)):null==a||a.stop()},t.prototype.resetRemoteAudioPlayer=function(e){},t.prototype._updateVideoPlayerState=function(e){var t;HX.print("_updateVideoPlayerState()");var i,r=e.userId;i=e.isScreen?this._remoteScreenPlayer.get(r):this._remoteVideoPlayer.get(r),e.videoTrack?i&&(null===(t=this._config)||void 0===t?void 0:t.autoPlayPolicy)!==Z_.PLAY_MANUALLY&&i.playVideo(e.videoTrack,e):(null==i?void 0:i.played)&&(null==i||i.stop())},t.prototype._checkLocalCameraStall=function(e){var t,i,r;return tf(this,void 0,void 0,(function(){var n,o;return rf(this,(function(a){switch(a.label){case 0:if("visible"!==document.visibilityState||!(e.videoStats.encoderOutputFrameRate<3&&e.videoStats.encoderOutputFrameRate>0||e.videoStats.sentKBitrate<2&&e.videoStats.sentKBitrate>0))return[3,6];if(this._videoCaptureStallCount++,!(this._videoCaptureStallCount>3))return[3,5];this._videoCaptureStallCount=0,a.label=1;case 1:return a.trys.push([1,4,,5]),[4,this.stopVideoCapture()];case 2:return a.sent(),[4,this.startVideoCapture()];case 3:return a.sent(),n=null===(r=null===(i=null===(t=this._room)||void 0===t?void 0:t._roomInfo)||void 0===i?void 0:i.userInfo)||void 0===r?void 0:r.userId,HX.print("onLocalCameraStalled",n),jB.rtcInvokeStatus(JSON.stringify({userId:n}),0,"Engine.onLocalCameraStalled","",0),[3,5];case 4:return o=a.sent(),console.log(o),[3,5];case 5:return[3,7];case 6:this._videoCaptureStallCount=0,a.label=7;case 7:return[2]}}))}))},t.prototype._checkRemoteStats=function(e){return tf(this,void 0,void 0,(function(){return rf(this,(function(t){switch(t.label){case 0:return!e.videoStats.needResub||this.resubedUserId.has(e.userId)?[3,3]:(jB.rtcInvokeStatus("[resub user] ".concat(e.userId),0,"resub_user","",0),HX.print("[resub user] ".concat(e.userId)),this.resubedUserId.add(e.userId),[4,this.unsubscribeStream(e.userId,V_.VIDEO)]);case 1:return t.sent(),[4,this.subscribeStream(e.userId,V_.VIDEO)];case 2:t.sent(),t.label=3;case 3:return[2]}}))}))},t.prototype._onAddStream=function(e){var t,i=e.stream;i.videoDom=null===(t=this._remoteVideoPlayer.get(i.userId))||void 0===t?void 0:t.domElement;var r=null==i?void 0:i.attributes,n=r.localaudio,o=r.audiostream,a=r.localvideo,s=r.videostream,c=wz.NONE;if(o&&(c|=V_.AUDIO),s&&(c|=V_.VIDEO),c){if(null==i?void 0:i.isScreen)this.safeEmit(hf.onUserPublishScreen,{userId:i.userId,mediaType:c});else{try{var u=c!==V_.AUDIO,d=c!==V_.VIDEO;i._aStats=d?"+oA":i._aStats,i._vStats=u?"+oV":i._vStats}catch(e){}this.safeEmit(hf.onUserPublishStream,{userId:i.userId,mediaType:c}),this._handleAutoSubscribe(i,!0)}(null==i?void 0:i.isScreen)||(n&&this.safeEmit(hf.onUserStartAudioCapture,{userId:i.userId}),a&&this.safeEmit(hf.onUserStartVideoCapture,{userId:i.userId}))}},t.prototype._handleAutoSubscribe=function(e,t){var i,r,n,o,a=wz.NONE;(null===(i=this._roomConfig)||void 0===i?void 0:i.isAutoSubscribeAudio)&&(a|=V_.AUDIO),(null===(r=this._roomConfig)||void 0===r?void 0:r.isAutoSubscribeVideo)&&(a|=V_.VIDEO),HX.print("_onAddStream","autoSubType: ".concat(a)),a&&(t&&VU(a)&&(null===(n=e.observer)||void 0===n||n.setAutoSubscribeAudio(!0)),t&&FU(a)&&(null===(o=e.observer)||void 0===o||o.setAutoSubscribeVideo(!0)),this._subscribe(!1,e.userId,a))},t.prototype._onRemoveStream=function(e){var t,i=this,r=e.stream,n=null!==(t=KX[e.reason])&&void 0!==t?t:F_.STREAM_REMOVE_REASON_OTHER,o=r.isScreen?hf.onUserUnpublishScreen:hf.onUserUnpublishStream,a=wz.NONE;r.attributes.audiostream&&(a|=V_.AUDIO),r.attributes.videostream&&(a|=V_.VIDEO),(null==r?void 0:r._workaround_1_)&&(a=V_.VIDEO),a!==wz.NONE&&this.safeEmit(o,{userId:r.userId,mediaType:a,reason:n}),this._getRemotePlayer(r.userId,r.isScreen).forEach((function(e){(null==r?void 0:r._workaround_1_)||(r.isScreen?(i._remoteScreenPlayer.delete(r.userId),i._remoteScreenAudioPlayer.delete(r.userId)):(i._remoteVideoPlayer.delete(r.userId),i._remoteAudioPlayer.delete(r.userId)),null==e||e.destroy())}))},t.prototype._onUserConnection=function(e){this.safeEmit(hf.onUserJoined,e)},t.prototype._onUserLeave=function(e){this.safeEmit(hf.onUserLeave,e)},t.prototype._onRoomError=function(e){var t;this.safeEmit(hf.onError,e),null===(t=this._room)||void 0===t||t.destroy(),this._room=void 0},t.prototype._onNetworkQuality=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.safeEmit.apply(this,af([hf.onNetworkQuality],of(e),!1))},t.prototype._onConnectionStateChange=function(e){void 0!==this._startCloudProxyTimestamp&&this._useCloudProxy&&e.state===B_.CONNECTION_STATE_CONNECTED&&this.safeEmit(hf.onCloudProxyConnected,{interval:Date.now()-this._startCloudProxyTimestamp}),this.safeEmit(hf.onConnectionStateChanged,e)},t.prototype._getRemotePlayer=function(e,t){return[(t?this._remoteScreenAudioPlayer:this._remoteAudioPlayer).get(e),(t?this._remoteScreenPlayer:this._remoteVideoPlayer).get(e)]},t.prototype._stopAudioPropertiesReport=function(){null!==this._audioPropertiesReportTimer&&(clearInterval(this._audioPropertiesReportTimer),this._audioPropertiesReportTimer=null),null!==this._localAudioInputTimer&&clearInterval(this._localAudioInputTimer)},t.prototype._onResubscribe=function(e){e.stream&&(this._getRemotePlayer(e.stream.userId,e.stream.isScreen).forEach((function(e){return null==e?void 0:e.stop()})),this._updateAudioPlayerState(e.stream),this._updateVideoPlayerState(e.stream))},t.prototype._onSubscribePushTrack=function(e){e.stream&&this._updateAudioPlayerState(e.stream)},t.prototype._onRemovePushTrack=function(e){e.stream&&this._updateAudioPlayerState(e.stream)},t.prototype._onVideoFirstFrameDecoded=function(e){this.safeEmit(hf.onVideoFirstFrameDecoded,e)},t.prototype._onVideoDeviceStateChange=function(e){this.safeEmit(hf.onVideoDeviceStateChanged,e)},t.prototype._onAudioDeviceStateChange=function(e){this.safeEmit(hf.onAudioDeviceStateChanged,e)},t.prototype._onUserPublishStateChange=function(e){var t=e.userId,i=e.isScreen,r=e.mediaType,n=e.pubState,o=e.remoteStream,a={userId:t,mediaType:r};if(i)n===zz.PUB?this.safeEmit(hf.onUserPublishScreen,a):this.safeEmit(hf.onUserUnpublishScreen,$_($_({},a),{reason:F_.STREAM_REMOVE_REASON_UNPUBLISH}));else if(n===zz.PUB){try{var s=r!==V_.AUDIO,c=r!==V_.VIDEO;o._aStats=c?"+oA":o._aStats,o._vStats=s?"+oV":o._vStats}catch(e){}this.safeEmit(hf.onUserPublishStream,a),this._handleAutoSubscribe(o,!0)}else{try{s=r!==V_.AUDIO,c=r!==V_.VIDEO;o._aStats=c?"-oA":o._aStats,o._vStats=s?"-oV":o._vStats}catch(e){}this.safeEmit(hf.onUserUnpublishStream,$_($_({},a),{reason:F_.STREAM_REMOVE_REASON_UNPUBLISH}))}},t.prototype._onCustomMessage=function(e){var t=e.message;e.binary?this.safeEmit(hf.onRoomBinaryMessageReceived,{userId:e.clientId,message:t}):this.safeEmit(hf.onRoomMessageReceived,{userId:e.clientId,message:t})},t.prototype._onUserMessageReceived=function(e){this._messageStatisticsObserver.recvP2PMessage(e.userId),this.safeEmit(hf.onUserMessageReceived,e)},t.prototype._onUserBinaryMessageReceived=function(e){this._messageStatisticsObserver.recvP2PMessage(e.userId),this.safeEmit(hf.onUserBinaryMessageReceived,e)},t.prototype._onLiveTranscodingResult=function(e){this.safeEmit(hf.onLiveTranscodingResult,e)},t.prototype._onStreamMixingEvent=function(e){this.safeEmit(hf.onStreamMixingEvent,e)},t.prototype._onUserTokenWillExpire=function(){this.safeEmit(hf.onTokenWillExpire)},t.prototype._onPushPublicStreamResult=function(e){this.safeEmit(hf.onPushPublicStreamResult,e)},t.prototype._handleRTMClient=function(e){var t=this;e.on("onUserMessageReceivedOutsideRoom",(function(e){t._messageStatisticsObserver.recvP2POutRoomMessage(e.userId),t.safeEmit(hf.onUserMessageReceivedOutsideRoom,e)})),e.on("onUserBinaryMessageReceivedOutsideRoom",(function(e){t._messageStatisticsObserver.recvP2POutRoomMessage(e.userId),t.safeEmit(hf.onUserBinaryMessageReceivedOutsideRoom,e)})),e.on("onUserDisconnection",(function(){t.safeEmit(hf.onError,{errorCode:Nj.RTM_DUPLICATE_LOGIN})})),e.on("onRTMTokenError",(function(){t.safeEmit(hf.onError,{errorCode:Nj.RTM_TOKEN_ERROR})}))},Object.defineProperty(t.prototype,"waitForNewToken",{get:function(){return!!this._tempRoomConfig},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"localAudioTrack",{get:function(){return this._localAudioTrack},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"localVideoTrack",{get:function(){return this._localVideoTrack},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"localScreenAudioTrack",{get:function(){return this._localScreenAudioTrack},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"localScreenVideoTrack",{get:function(){return this._localScreenVideoTrack},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"remoteStreams",{get:function(){var e,t,i=[];return(null===(e=this._room)||void 0===e?void 0:e.remoteStreams)&&(null===(t=this._room)||void 0===t||t.remoteStreams.forEach((function(e){Array.isArray(e)&&e.forEach((function(e){i.push({userId:e.userId,isScreen:e.isScreen,hasVideo:e.hasVideo,hasAudio:e.hasAudio,videoStreamDescriptions:e.attributes.videoDescriptions})}))}))),i},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"remoteUsers",{get:function(){var e,t,i=[];return(null===(e=this._room)||void 0===e?void 0:e.remoteUsers)&&(null===(t=this._room)||void 0===t||t.remoteUsers.forEach((function(e){i.push({userId:e.userId})}))),i},enumerable:!1,configurable:!0}),t.prototype._handleAudioDeviceManager=function(){var e=this;this._audioDeviceManager.on("onAudioPlaybackDeviceTestVolume",(function(t){e.safeEmit(hf.onAudioPlaybackDeviceTestVolume,t)}))},t.prototype._assertNotInRoom=function(){if(!this._room||this._room.connectionState!==gK.CONNECTED)throw new Vj(Nj.INVOKED_BEFORE_JOIN_ROOM,"join first")},t.prototype._checkMediaType=function(e){Gj(e,"mediaType",[V_.AUDIO,V_.VIDEO,V_.AUDIO_AND_VIDEO])},t.prototype._getUserId=function(){var e,t;return(null===(t=null===(e=this._room)||void 0===e?void 0:e.roomInfo)||void 0===t?void 0:t.userInfo.userId)||"local_user"},ef([qB()],t.prototype,"updateToken",null),ef([qB()],t.prototype,"setVideoCaptureDevice",null),ef([qB()],t.prototype,"setAudioCaptureDevice",null),ef([qB()],t.prototype,"joinRoom",null),ef([qB()],t.prototype,"leaveRoom",null),ef([qB()],t.prototype,"destroy",null),ef([qB()],t.prototype,"publishStream",null),ef([qB()],t.prototype,"unpublishStream",null),ef([qB()],t.prototype,"publishScreen",null),ef([qB()],t.prototype,"unpublishScreen",null),ef([qB()],t.prototype,"subscribeStream",null),ef([qB()],t.prototype,"unsubscribeStream",null),ef([qB()],t.prototype,"subscribeScreen",null),ef([qB()],t.prototype,"unsubscribeScreen",null),ef([qB()],t.prototype,"setRemoteVideoConfig",null),ef([qB()],t.prototype,"startVideoAndAudioCapture",null),ef([qB()],t.prototype,"startVideoCapture",null),ef([qB()],t.prototype,"stopVideoCapture",null),ef([qB()],t.prototype,"startAudioCapture",null),ef([qB()],t.prototype,"stopAudioCapture",null),ef([qB()],t.prototype,"getAudioMixingManager",null),ef([qB()],t.prototype,"startScreenCapture",null),ef([qB()],t.prototype,"stopScreenCapture",null),ef([qB()],t.prototype,"setLocalVideoPlayer",null),ef([qB()],t.prototype,"startLiveTranscoding",null),ef([qB()],t.prototype,"updateLiveTranscoding",null),ef([qB()],t.prototype,"stopLiveTranscoding",null),ef([qB()],t.prototype,"setBusinessId",null),ef([qB()],t.prototype,"setUserVisibility",null),ef([qB()],t.prototype,"setRemoteVideoPlayer",null),ef([qB()],t.prototype,"setLocalVideoMirrorType",null),ef([qB()],t.prototype,"setAudioPlaybackDevice",null),ef([qB()],t.prototype,"play",null),ef([qB()],t.prototype,"pauseAllSubscribedStream",null),ef([qB()],t.prototype,"resumeAllSubscribedStream",null),ef([qB()],t.prototype,"sendUserMessage",null),ef([qB()],t.prototype,"sendUserBinaryMessage",null),ef([qB()],t.prototype,"sendRoomMessage",null),ef([qB()],t.prototype,"sendRoomBinaryMessage",null),ef([qB()],t.prototype,"setAudioCaptureConfig",null),ef([qB()],t.prototype,"setVideoCaptureConfig",null),ef([qB()],t.prototype,"enableSimulcastMode",null),ef([qB()],t.prototype,"setVideoEncoderConfig",null),ef([qB()],t.prototype,"setScreenEncoderConfig",null),ef([qB()],t.prototype,"sendSEIMessage",null),ef([qB()],t.prototype,"setAudioVolumeIndicationInterval",null),ef([qB()],t.prototype,"enableAudioPropertiesReport",null),ef([qB()],t.prototype,"setVideoSourceType",null),ef([qB()],t.prototype,"setExternalVideoTrack",null),ef([qB()],t.prototype,"setAudioSourceType",null),ef([qB()],t.prototype,"setExternalAudioTrack",null),ef([qB("rtm")],t.prototype,"login",null),ef([qB("rtm")],t.prototype,"logout",null),ef([qB("rtm")],t.prototype,"updateLoginToken",null),ef([qB("rtm")],t.prototype,"getPeerOnlineStatus",null),ef([qB("rtm")],t.prototype,"sendUserMessageOutsideRoom",null),ef([qB("rtm")],t.prototype,"sendUserBinaryMessageOutsideRoom",null),ef([qB("rtm")],t.prototype,"setServerParams",null),ef([qB("rtm")],t.prototype,"sendServerMessage",null),ef([qB("rtm")],t.prototype,"sendServerBinaryMessage",null),ef([qB()],t.prototype,"startCloudProxy",null),ef([qB()],t.prototype,"stopCloudProxy",null),ef([qB()],t.prototype,"startPushPublicStream",null),ef([qB()],t.prototype,"updatePublicStreamParam",null),ef([qB()],t.prototype,"stopPushPublicStream",null),ef([qB("outsideRoom","streamId")],t.prototype,"startPlayPublicStream",null),ef([qB("outsideRoom","streamId")],t.prototype,"stopPlayPublicStream",null),ef([qB()],t.prototype,"setAudioProfile",null),ef([qB("outsideRoom")],t.prototype,"setPublicStreamVideoPlayer",null),ef([qB()],t.prototype,"setDummyCaptureImagePath",null),ef([qB()],t.prototype,"startAudioPlaybackDeviceTest",null),ef([qB()],t.prototype,"stopAudioPlaybackDeviceTest",null),ef([qB()],t.prototype,"startAudioDeviceRecordTest",null),ef([qB()],t.prototype,"stopAudioDeviceRecordAndPlayTest",null),ef([qB()],t.prototype,"stopAudioDevicePlayTest",null),ef([qB()],t.prototype,"setRemoteUserPriority",null),ef([qB()],t.prototype,"setSubscribeFallbackOption",null),ef([qB()],t.prototype,"getLocalStreamTrack",null),ef([qB()],t.prototype,"getRemoteStreamTrack",null),ef([qB()],t.prototype,"getPublicStreamTrack",null),ef([qB()],t.prototype,"resetRemoteAudioPlayer",null),t}(VB),KX={"client unpublished":F_.STREAM_REMOVE_REASON_UNPUBLISH,"publish failed":F_.STREAM_REMOVE_REASON_PUBLISH_FAILED,"stream removed":F_.STREAM_REMOVE_REASON_KEEP_LIVE_FAILED,"client disconnected":F_.STREAM_REMOVE_REASON_CLIENT_DISCONNECTED,"client republish":F_.STREAM_REMOVE_REASON_REPUBLISH},WX=new LB("BLWEngine",0),XX=function(e){function t(t,i){var r=e.call(this,t,i)||this;return r.singleStreamRenderMode=!1,MF=[{width:192,height:108,frameRate:15,maxKbps:100},{width:320,height:180,frameRate:15,maxKbps:140},{width:640,height:360,frameRate:15,maxKbps:400},{width:1280,height:720,frameRate:15,maxKbps:1e3},{width:1920,height:1080,frameRate:15,maxKbps:2e3}],r._handleEvent(),r}return C_(t,e),t.prototype.subscribeStream=function(t,i){return tf(this,void 0,void 0,(function(){return rf(this,(function(r){return WX.print("subscribeStream()","userId: %o, mediaType: %o",t,i),this.singleStreamRenderMode&&FU(i)&&e.prototype.subscribeScreen.call(this,t,V_.VIDEO).catch((function(){})),[2,e.prototype.subscribeStream.call(this,t,i)]}))}))},t.prototype.unsubscribeStream=function(t,i){return tf(this,void 0,void 0,(function(){return rf(this,(function(r){return WX.print("unsubscribeStream()","userId: %o, mediaType: %o",t,i),this.singleStreamRenderMode&&FU(i)&&e.prototype.unsubscribeScreen.call(this,t,V_.VIDEO).catch((function(){})),[2,e.prototype.unsubscribeStream.call(this,t,i)]}))}))},t.prototype.setRemoteScreenVideoStreamIndex=function(e){var t;return WX.print("setRemoteScreenVideoStreamIndex()","streamIndex: %o",e),(null===(t=this._room)||void 0===t?void 0:t.connectionState)!==gK.CONNECTED&&(this.singleStreamRenderMode=e===x_.STREAM_INDEX_MAIN,!0)},t.prototype.setRemoteVideoPlayer=function(t,i){if(WX.print("setRemoteVideoPlayer()","streamIndex: %o, videoPlayerOption: %o",t,i),!this.singleStreamRenderMode||t!==x_.STREAM_INDEX_SCREEN)return e.prototype.setRemoteVideoPlayer.call(this,t,i)},t.prototype.destroy=function(){this.singleStreamRenderMode=!1,e.prototype.destroy.call(this)},t.prototype._updateVideoPlayerState=function(t){var i,r;if(!this.singleStreamRenderMode)return e.prototype._updateVideoPlayerState.call(this,t);var n,o=t.userId,a=null===(i=this._room)||void 0===i?void 0:i.remoteStreams.get(o);Array.isArray(a)&&a.forEach((function(e){e.isScreen&&(n=e)}));var s=this._remoteVideoPlayer.get(o);s&&(t.isScreen||!(null==n?void 0:n.videoTrack)?t.videoTrack?s&&(null===(r=this._config)||void 0===r?void 0:r.autoPlayPolicy)!==Z_.PLAY_MANUALLY&&s.playVideo(t.videoTrack,t):(null==s?void 0:s.played)&&(null==s||s.stop()):WX.print("_updateVideoPlayerState","prevent play main stream"))},t.prototype._handleEvent=function(){var e=this;this.on(hf.onUserPublishScreen,(function(t){e.singleStreamRenderMode&&FU(t.mediaType)&&e.subscribeScreen(t.userId,V_.VIDEO)})),this.on(hf.onUserUnpublishScreen,(function(t){if(e.singleStreamRenderMode&&FU(t.mediaType)){var i=e._remoteVideoPlayer.get(t.userId),r=e._room.remoteStreams.get(t.userId),n=null==r?void 0:r.find((function(e){return!e.isScreen}));if(!(null==n?void 0:n.videoTrack)||!i)return;i.playVideo(n.videoTrack)}}))},ef([qB()],t.prototype,"subscribeStream",null),ef([qB()],t.prototype,"unsubscribeStream",null),ef([qB()],t.prototype,"setRemoteScreenVideoStreamIndex",null),ef([qB()],t.prototype,"setRemoteVideoPlayer",null),ef([qB()],t.prototype,"destroy",null),t}(zX),qX=new LB("VERTC",0);[zB,KB,WB].forEach((function(e){return e.setStats({rtc_sdk_version:OF.VERSION,product_line:FF.RTC,report_version:BF.W_5,os:jF.WEB,device_id:IF.getDeviceId(),user_agent:mU()?"":null===navigator||void 0===navigator?void 0:navigator.userAgent})}));var YX=function(e,t){if(location.search.includes("__rtc_debug_2__"))for(var i in e="5a7451222679214f668e7085",wF("ICE_CONFIG_REQUEST_URLS",["rtc-test.bytedance.com","rtc-access-test-hl.bytedance.com"]),localStorage)i.indexOf("RTC_ACCESS")>-1&&localStorage.removeItem(i);return qX.print("createEngine","Invoke VERTC.createEngine"),jj(e,"appId"),[zB,KB,WB].forEach((function(i){return i.setStats({rtc_app_id:e,auto_play_policy:null==t?void 0:t.autoPlayPolicy})})),jB.sdkInitEngine(Date.now(),mB.BEGIN),new XX(e,t)},JX=function(e){if(qX.print("destroyEngine","Invoke VERTC.destroyEngine"),!(e instanceof XX))throw new Vj(Nj.INVALID_ENGINE,"Invalid engine object");e.destroy(),jB.sdkInitEngine(Date.now(),mB.END)},QX=function(){return tf(void 0,void 0,void 0,(function(){return rf(this,(function(e){return[2,sz.enumerateDevices()]}))}))},ZX=function(e){return void 0===e&&(e={video:!0,audio:!0}),tf(void 0,void 0,void 0,(function(){var t,i,r,n;return rf(this,(function(o){switch(o.label){case 0:if(t=e.video,i=e.audio,r={video:!1,audio:!1},!t)return[3,4];o.label=1;case 1:return o.trys.push([1,3,,4]),[4,sz.getPermissions({video:!0,force:!0})];case 2:return n=o.sent(),r.video=n.video,[3,4];case 3:return o.sent(),[3,4];case 4:if(!i)return[3,8];o.label=5;case 5:return o.trys.push([5,7,,8]),[4,sz.getPermissions({audio:!0,force:!0})];case 6:return n=o.sent(),r.audio=n.audio,[3,8];case 7:return o.sent(),[3,8];case 8:return[2,r]}}))}))},$X=function(){return tf(void 0,void 0,void 0,(function(){return rf(this,(function(e){return[2,sz.enumerateAudioCaptureDevices()]}))}))},eq=function(){return tf(void 0,void 0,void 0,(function(){return rf(this,(function(e){return[2,sz.enumerateVideoCaptureDevices()]}))}))},tq=function(){return tf(void 0,void 0,void 0,(function(){return rf(this,(function(e){return[2,sz.enumerateAudioPlaybackDevices()]}))}))},iq=function(){return OF.VERSION},rq=function(){return jB.rtcSdkApiCall("isSupported",0,""),tf(void 0,void 0,void 0,(function(){var e;return rf(this,(function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),!mU()&&window.RTCPeerConnection&&window.RTCPeerConnection.prototype.addTransceiver&&window.RTCPeerConnection.prototype.createDataChannel?[4,QG()]:[2,!1];case 1:return[2,(null==(e=t.sent())?void 0:e.includes("H264"))||(null==e?void 0:e.includes("vp8"))];case 2:return t.sent(),[2,!1];case 3:return[2]}}))}))},nq=function(){return jB.rtcSdkApiCall("getSupportedCodecs",0,""),tf(void 0,void 0,void 0,(function(){return rf(this,(function(e){switch(e.label){case 0:return[4,QG()];case 1:return[2,e.sent().map((function(e){return e.toUpperCase()}))]}}))}))};!mU()&&location.search.includes("_rtc_autotest_");var oq=new function(){this.getSdkVersion=iq,this.createEngine=YX,this.destroyEngine=JX,this.enumerateDevices=QX,this.enableDevices=ZX,this.enumerateAudioCaptureDevices=$X,this.enumerateVideoCaptureDevices=eq,this.enumerateAudioPlaybackDevices=tq,this.getParameter=kF,this.setParameter=wF,this.isSupported=rq,this.getSupportedCodecs=nq,this.events=hf,this.ErrorCode=Nj,this.platform="BytePlus",this._monitor=jB};return $_($_($_($_({},oq),lf),_f),{events:hf})}));
6
+ !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).BytePlusRTC=t()}(this,(function(){"use strict";function e(e,t){return t.forEach((function(t){t&&"string"!=typeof t&&!Array.isArray(t)&&Object.keys(t).forEach((function(r){if("default"!==r&&!(r in e)){var i=Object.getOwnPropertyDescriptor(t,r);Object.defineProperty(e,r,i.get?i:{enumerable:!0,get:function(){return t[r]}})}}))})),Object.freeze(e)}function t(e){return t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},t(e)}var r="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function i(e){if(e.__esModule)return e;var t=Object.defineProperty({},"__esModule",{value:!0});return Object.keys(e).forEach((function(r){var i=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,i.get?i:{enumerable:!0,get:function(){return e[r]}})})),t}var n=function(e){return e&&e.Math==Math&&e},o=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")(),a={},s=function(e){try{return!!e()}catch(e){return!0}},c=!s((function(){return 7!=Object.defineProperty({},1,{get:function(){return 7}})[1]})),u=!s((function(){var e=function(){}.bind();return"function"!=typeof e||e.hasOwnProperty("prototype")})),d=u,l=Function.prototype.call,h=d?l.bind(l):function(){return l.apply(l,arguments)},p={},f={}.propertyIsEnumerable,_=Object.getOwnPropertyDescriptor,v=_&&!f.call({1:2},1);p.f=v?function(e){var t=_(this,e);return!!t&&t.enumerable}:f;var m,y,g=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}},S=u,E=Function.prototype,b=E.bind,I=E.call,T=S&&b.bind(I,I),A=S?function(e){return e&&T(e)}:function(e){return e&&function(){return I.apply(e,arguments)}},R=A,C=R({}.toString),O=R("".slice),w=function(e){return O(C(e),8,-1)},k=A,N=s,P=w,D=o.Object,M=k("".split),L=N((function(){return!D("z").propertyIsEnumerable(0)}))?function(e){return"String"==P(e)?M(e,""):D(e)}:D,U=o.TypeError,x=function(e){if(null==e)throw U("Can't call method on "+e);return e},V=L,F=x,B=function(e){return V(F(e))},j=function(e){return"function"==typeof e},G=j,H=function(e){return"object"==typeof e?null!==e:G(e)},z=o,K=j,W=function(e){return K(e)?e:void 0},X=function(e,t){return arguments.length<2?W(z[e]):z[e]&&z[e][t]},q=A({}.isPrototypeOf),Y=X("navigator","userAgent")||"",J=o,Q=Y,Z=J.process,$=J.Deno,ee=Z&&Z.versions||$&&$.version,te=ee&&ee.v8;te&&(y=(m=te.split("."))[0]>0&&m[0]<4?1:+(m[0]+m[1])),!y&&Q&&(!(m=Q.match(/Edge\/(\d+)/))||m[1]>=74)&&(m=Q.match(/Chrome\/(\d+)/))&&(y=+m[1]);var re=y,ie=re,ne=s,oe=!!Object.getOwnPropertySymbols&&!ne((function(){var e=Symbol();return!String(e)||!(Object(e)instanceof Symbol)||!Symbol.sham&&ie&&ie<41})),ae=oe&&!Symbol.sham&&"symbol"==typeof Symbol.iterator,se=X,ce=j,ue=q,de=ae,le=o.Object,he=de?function(e){return"symbol"==typeof e}:function(e){var t=se("Symbol");return ce(t)&&ue(t.prototype,le(e))},pe=o.String,fe=function(e){try{return pe(e)}catch(e){return"Object"}},_e=j,ve=fe,me=o.TypeError,ye=function(e){if(_e(e))return e;throw me(ve(e)+" is not a function")},ge=ye,Se=function(e,t){var r=e[t];return null==r?void 0:ge(r)},Ee=h,be=j,Ie=H,Te=o.TypeError,Ae={exports:{}},Re=o,Ce=Object.defineProperty,Oe=function(e,t){try{Ce(Re,e,{value:t,configurable:!0,writable:!0})}catch(r){Re[e]=t}return t},we=Oe,ke="__core-js_shared__",Ne=o[ke]||we(ke,{}),Pe=Ne;(Ae.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=x,Me=o.Object,Le=function(e){return Me(De(e))},Ue=Le,xe=A({}.hasOwnProperty),Ve=Object.hasOwn||function(e,t){return xe(Ue(e),t)},Fe=A,Be=0,je=Math.random(),Ge=Fe(1..toString),He=function(e){return"Symbol("+(void 0===e?"":e)+")_"+Ge(++Be+je,36)},ze=o,Ke=Ae.exports,We=Ve,Xe=He,qe=oe,Ye=ae,Je=Ke("wks"),Qe=ze.Symbol,Ze=Qe&&Qe.for,$e=Ye?Qe:Qe&&Qe.withoutSetter||Xe,et=function(e){if(!We(Je,e)||!qe&&"string"!=typeof Je[e]){var t="Symbol."+e;qe&&We(Qe,e)?Je[e]=Qe[e]:Je[e]=Ye&&Ze?Ze(t):$e(t)}return Je[e]},tt=h,rt=H,it=he,nt=Se,ot=function(e,t){var r,i;if("string"===t&&be(r=e.toString)&&!Ie(i=Ee(r,e)))return i;if(be(r=e.valueOf)&&!Ie(i=Ee(r,e)))return i;if("string"!==t&&be(r=e.toString)&&!Ie(i=Ee(r,e)))return i;throw Te("Can't convert object to primitive value")},at=et,st=o.TypeError,ct=at("toPrimitive"),ut=function(e,t){if(!rt(e)||it(e))return e;var r,i=nt(e,ct);if(i){if(void 0===t&&(t="default"),r=tt(i,e,t),!rt(r)||it(r))return r;throw st("Can't convert object to primitive value")}return void 0===t&&(t="number"),ot(e,t)},dt=ut,lt=he,ht=function(e){var t=dt(e,"string");return lt(t)?t:t+""},pt=H,ft=o.document,_t=pt(ft)&&pt(ft.createElement),vt=function(e){return _t?ft.createElement(e):{}},mt=vt,yt=!c&&!s((function(){return 7!=Object.defineProperty(mt("div"),"a",{get:function(){return 7}}).a})),gt=c,St=h,Et=p,bt=g,It=B,Tt=ht,At=Ve,Rt=yt,Ct=Object.getOwnPropertyDescriptor;a.f=gt?Ct:function(e,t){if(e=It(e),t=Tt(t),Rt)try{return Ct(e,t)}catch(e){}if(At(e,t))return bt(!St(Et.f,e,t),e[t])};var Ot={},wt=c&&s((function(){return 42!=Object.defineProperty((function(){}),"prototype",{value:42,writable:!1}).prototype})),kt=o,Nt=H,Pt=kt.String,Dt=kt.TypeError,Mt=function(e){if(Nt(e))return e;throw Dt(Pt(e)+" is not an object")},Lt=c,Ut=yt,xt=wt,Vt=Mt,Ft=ht,Bt=o.TypeError,jt=Object.defineProperty,Gt=Object.getOwnPropertyDescriptor,Ht="enumerable",zt="configurable",Kt="writable";Ot.f=Lt?xt?function(e,t,r){if(Vt(e),t=Ft(t),Vt(r),"function"==typeof e&&"prototype"===t&&"value"in r&&Kt in r&&!r.writable){var i=Gt(e,t);i&&i.writable&&(e[t]=r.value,r={configurable:zt in r?r.configurable:i.configurable,enumerable:Ht in r?r.enumerable:i.enumerable,writable:!1})}return jt(e,t,r)}:jt:function(e,t,r){if(Vt(e),t=Ft(t),Vt(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 Wt=Ot,Xt=g,qt=c?function(e,t,r){return Wt.f(e,t,Xt(1,r))}:function(e,t,r){return e[t]=r,e},Yt={exports:{}},Jt=j,Qt=Ne,Zt=A(Function.toString);Jt(Qt.inspectSource)||(Qt.inspectSource=function(e){return Zt(e)});var $t,er,tr,rr=Qt.inspectSource,ir=j,nr=rr,or=o.WeakMap,ar=ir(or)&&/native code/.test(nr(or)),sr=Ae.exports,cr=He,ur=sr("keys"),dr=function(e){return ur[e]||(ur[e]=cr(e))},lr={},hr=ar,pr=o,fr=A,_r=H,vr=qt,mr=Ve,yr=Ne,gr=dr,Sr=lr,Er="Object already initialized",br=pr.TypeError,Ir=pr.WeakMap;if(hr||yr.state){var Tr=yr.state||(yr.state=new Ir),Ar=fr(Tr.get),Rr=fr(Tr.has),Cr=fr(Tr.set);$t=function(e,t){if(Rr(Tr,e))throw new br(Er);return t.facade=e,Cr(Tr,e,t),t},er=function(e){return Ar(Tr,e)||{}},tr=function(e){return Rr(Tr,e)}}else{var Or=gr("state");Sr[Or]=!0,$t=function(e,t){if(mr(e,Or))throw new br(Er);return t.facade=e,vr(e,Or,t),t},er=function(e){return mr(e,Or)?e[Or]:{}},tr=function(e){return mr(e,Or)}}var wr={set:$t,get:er,has:tr,enforce:function(e){return tr(e)?er(e):$t(e,{})},getterFor:function(e){return function(t){var r;if(!_r(t)||(r=er(t)).type!==e)throw br("Incompatible receiver, "+e+" required");return r}}},kr=c,Nr=Ve,Pr=Function.prototype,Dr=kr&&Object.getOwnPropertyDescriptor,Mr=Nr(Pr,"name"),Lr={EXISTS:Mr,PROPER:Mr&&"something"===function(){}.name,CONFIGURABLE:Mr&&(!kr||kr&&Dr(Pr,"name").configurable)},Ur=o,xr=j,Vr=Ve,Fr=qt,Br=Oe,jr=rr,Gr=Lr.CONFIGURABLE,Hr=wr.get,zr=wr.enforce,Kr=String(String).split("String");(Yt.exports=function(e,t,r,i){var n,o=!!i&&!!i.unsafe,a=!!i&&!!i.enumerable,s=!!i&&!!i.noTargetGet,c=i&&void 0!==i.name?i.name:t;xr(r)&&("Symbol("===String(c).slice(0,7)&&(c="["+String(c).replace(/^Symbol\(([^)]*)\)/,"$1")+"]"),(!Vr(r,"name")||Gr&&r.name!==c)&&Fr(r,"name",c),(n=zr(r)).source||(n.source=Kr.join("string"==typeof c?c:""))),e!==Ur?(o?!s&&e[t]&&(a=!0):delete e[t],a?e[t]=r:Fr(e,t,r)):a?e[t]=r:Br(t,r)})(Function.prototype,"toString",(function(){return xr(this)&&Hr(this).source||jr(this)}));var Wr={},Xr=Math.ceil,qr=Math.floor,Yr=function(e){var t=+e;return t!=t||0===t?0:(t>0?qr:Xr)(t)},Jr=Yr,Qr=Math.max,Zr=Math.min,$r=function(e,t){var r=Jr(e);return r<0?Qr(r+t,0):Zr(r,t)},ei=Yr,ti=Math.min,ri=function(e){return e>0?ti(ei(e),9007199254740991):0},ii=ri,ni=function(e){return ii(e.length)},oi=B,ai=$r,si=ni,ci=function(e){return function(t,r,i){var n,o=oi(t),a=si(o),s=ai(i,a);if(e&&r!=r){for(;a>s;)if((n=o[s++])!=n)return!0}else for(;a>s;s++)if((e||s in o)&&o[s]===r)return e||s||0;return!e&&-1}},ui={includes:ci(!0),indexOf:ci(!1)},di=Ve,li=B,hi=ui.indexOf,pi=lr,fi=A([].push),_i=function(e,t){var r,i=li(e),n=0,o=[];for(r in i)!di(pi,r)&&di(i,r)&&fi(o,r);for(;t.length>n;)di(i,r=t[n++])&&(~hi(o,r)||fi(o,r));return o},vi=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],mi=_i,yi=vi.concat("length","prototype");Wr.f=Object.getOwnPropertyNames||function(e){return mi(e,yi)};var gi={};gi.f=Object.getOwnPropertySymbols;var Si=X,Ei=Wr,bi=gi,Ii=Mt,Ti=A([].concat),Ai=Si("Reflect","ownKeys")||function(e){var t=Ei.f(Ii(e)),r=bi.f;return r?Ti(t,r(e)):t},Ri=Ve,Ci=Ai,Oi=a,wi=Ot,ki=function(e,t,r){for(var i=Ci(t),n=wi.f,o=Oi.f,a=0;a<i.length;a++){var s=i[a];Ri(e,s)||r&&Ri(r,s)||n(e,s,o(t,s))}},Ni=s,Pi=j,Di=/#|\.prototype\./,Mi=function(e,t){var r=Ui[Li(e)];return r==Vi||r!=xi&&(Pi(t)?Ni(t):!!t)},Li=Mi.normalize=function(e){return String(e).replace(Di,".").toLowerCase()},Ui=Mi.data={},xi=Mi.NATIVE="N",Vi=Mi.POLYFILL="P",Fi=Mi,Bi=o,ji=a.f,Gi=qt,Hi=Yt.exports,zi=Oe,Ki=ki,Wi=Fi,Xi=function(e,t){var r,i,n,o,a,s=e.target,c=e.global,u=e.stat;if(r=c?Bi:u?Bi[s]||zi(s,{}):(Bi[s]||{}).prototype)for(i in t){if(o=t[i],n=e.noTargetGet?(a=ji(r,i))&&a.value:r[i],!Wi(c?i:s+(u?".":"#")+i,e.forced)&&void 0!==n){if(typeof o==typeof n)continue;Ki(o,n)}(e.sham||n&&n.sham)&&Gi(o,"sham",!0),Hi(r,i,o,e)}},qi=o,Yi=j,Ji=qi.String,Qi=qi.TypeError,Zi=A,$i=Mt,en=function(e){if("object"==typeof e||Yi(e))return e;throw Qi("Can't set "+Ji(e)+" as a prototype")},tn=Object.setPrototypeOf||("__proto__"in{}?function(){var e,t=!1,r={};try{(e=Zi(Object.getOwnPropertyDescriptor(Object.prototype,"__proto__").set))(r,[]),t=r instanceof Array}catch(e){}return function(r,i){return $i(r),en(i),t?e(r,i):r.__proto__=i,r}}():void 0);Xi({target:"Object",stat:!0},{setPrototypeOf:tn});var rn={},nn=_i,on=vi,an=Object.keys||function(e){return nn(e,on)},sn=c,cn=wt,un=Ot,dn=Mt,ln=B,hn=an;rn.f=sn&&!cn?Object.defineProperties:function(e,t){dn(e);for(var r,i=ln(t),n=hn(t),o=n.length,a=0;o>a;)un.f(e,r=n[a++],i[r]);return e};var pn,fn=X("document","documentElement"),_n=Mt,vn=rn,mn=vi,yn=lr,gn=fn,Sn=vt,En=dr("IE_PROTO"),bn=function(){},In=function(e){return"<script>"+e+"</"+"script>"},Tn=function(e){e.write(In("")),e.close();var t=e.parentWindow.Object;return e=null,t},An=function(){try{pn=new ActiveXObject("htmlfile")}catch(e){}var e,t;An="undefined"!=typeof document?document.domain&&pn?Tn(pn):((t=Sn("iframe")).style.display="none",gn.appendChild(t),t.src=String("javascript:"),(e=t.contentWindow.document).open(),e.write(In("document.F=Object")),e.close(),e.F):Tn(pn);for(var r=mn.length;r--;)delete An.prototype[mn[r]];return An()};yn[En]=!0;var Rn=Object.create||function(e,t){var r;return null!==e?(bn.prototype=_n(e),r=new bn,bn.prototype=null,r[En]=e):r=An(),void 0===t?r:vn.f(r,t)};Xi({target:"Object",stat:!0,sham:!c},{create:Rn});var Cn=c,On=A,wn=h,kn=s,Nn=an,Pn=gi,Dn=p,Mn=Le,Ln=L,Un=Object.assign,xn=Object.defineProperty,Vn=On([].concat),Fn=!Un||kn((function(){if(Cn&&1!==Un({b:1},Un(xn({},"a",{enumerable:!0,get:function(){xn(this,"b",{value:3,enumerable:!1})}}),{b:2})).b)return!0;var e={},t={},r=Symbol(),i="abcdefghijklmnopqrst";return e[r]=7,i.split("").forEach((function(e){t[e]=e})),7!=Un({},e)[r]||Nn(Un({},t)).join("")!=i}))?function(e,t){for(var r=Mn(e),i=arguments.length,n=1,o=Pn.f,a=Dn.f;i>n;)for(var s,c=Ln(arguments[n++]),u=o?Vn(Nn(c),o(c)):Nn(c),d=u.length,l=0;d>l;)s=u[l++],Cn&&!wn(a,c,s)||(r[s]=c[s]);return r}:Un,Bn=Fn;Xi({target:"Object",stat:!0,forced:Object.assign!==Bn},{assign:Bn});var jn=s,Gn=function(e,t){var r=[][e];return!!r&&jn((function(){r.call(null,t||function(){throw 1},1)}))},Hn=Xi,zn=ui.indexOf,Kn=Gn,Wn=A([].indexOf),Xn=!!Wn&&1/Wn([1],1,-0)<0,qn=Kn("indexOf");Hn({target:"Array",proto:!0,forced:Xn||!qn},{indexOf:function(e){var t=arguments.length>1?arguments[1]:void 0;return Xn?Wn(this,e,t)||0:zn(this,e,t)}});var Yn=u,Jn=Function.prototype,Qn=Jn.apply,Zn=Jn.call,$n="object"==typeof Reflect&&Reflect.apply||(Yn?Zn.bind(Qn):function(){return Zn.apply(Qn,arguments)}),eo=w,to=Array.isArray||function(e){return"Array"==eo(e)},ro={};ro[et("toStringTag")]="z";var io="[object z]"===String(ro),no=o,oo=io,ao=j,so=w,co=et("toStringTag"),uo=no.Object,lo="Arguments"==so(function(){return arguments}()),ho=oo?so:function(e){var t,r,i;return void 0===e?"Undefined":null===e?"Null":"string"==typeof(r=function(e,t){try{return e[t]}catch(e){}}(t=uo(e),co))?r:lo?so(t):"Object"==(i=so(t))&&ao(t.callee)?"Arguments":i},po=ho,fo=o.String,_o=function(e){if("Symbol"===po(e))throw TypeError("Cannot convert a Symbol value to a string");return fo(e)},vo={},mo=ht,yo=Ot,go=g,So=function(e,t,r){var i=mo(t);i in e?yo.f(e,i,go(0,r)):e[i]=r},Eo=$r,bo=ni,Io=So,To=o.Array,Ao=Math.max,Ro=function(e,t,r){for(var i=bo(e),n=Eo(t,i),o=Eo(void 0===r?i:r,i),a=To(Ao(o-n,0)),s=0;n<o;n++,s++)Io(a,s,e[n]);return a.length=s,a},Co=w,Oo=B,wo=Wr.f,ko=Ro,No="object"==typeof window&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[];vo.f=function(e){return No&&"Window"==Co(e)?function(e){try{return wo(e)}catch(e){return ko(No)}}(e):wo(Oo(e))};var Po=A([].slice),Do={},Mo=et;Do.f=Mo;var Lo=o,Uo=Ve,xo=Do,Vo=Ot.f,Fo=function(e){var t=Lo.Symbol||(Lo.Symbol={});Uo(t,e)||Vo(t,e,{value:xo.f(e)})},Bo=Ot.f,jo=Ve,Go=et("toStringTag"),Ho=function(e,t,r){e&&!r&&(e=e.prototype),e&&!jo(e,Go)&&Bo(e,Go,{configurable:!0,value:t})},zo=ye,Ko=u,Wo=A(A.bind),Xo=function(e,t){return zo(e),void 0===t?e:Ko?Wo(e,t):function(){return e.apply(t,arguments)}},qo=A,Yo=s,Jo=j,Qo=ho,Zo=rr,$o=function(){},ea=[],ta=X("Reflect","construct"),ra=/^\s*(?:class|function)\b/,ia=qo(ra.exec),na=!ra.exec($o),oa=function(e){if(!Jo(e))return!1;try{return ta($o,ea,e),!0}catch(e){return!1}},aa=function(e){if(!Jo(e))return!1;switch(Qo(e)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return na||!!ia(ra,Zo(e))}catch(e){return!0}};aa.sham=!0;var sa=!ta||Yo((function(){var e;return oa(oa.call)||!oa(Object)||!oa((function(){e=!0}))||e}))?aa:oa,ca=o,ua=to,da=sa,la=H,ha=et("species"),pa=ca.Array,fa=function(e){var t;return ua(e)&&(t=e.constructor,(da(t)&&(t===pa||ua(t.prototype))||la(t)&&null===(t=t[ha]))&&(t=void 0)),void 0===t?pa:t},_a=function(e,t){return new(fa(e))(0===t?0:t)},va=Xo,ma=L,ya=Le,ga=ni,Sa=_a,Ea=A([].push),ba=function(e){var t=1==e,r=2==e,i=3==e,n=4==e,o=6==e,a=7==e,s=5==e||o;return function(c,u,d,l){for(var h,p,f=ya(c),_=ma(f),v=va(u,d),m=ga(_),y=0,g=l||Sa,S=t?g(c,m):r||a?g(c,0):void 0;m>y;y++)if((s||y in _)&&(p=v(h=_[y],y,f),e))if(t)S[y]=p;else if(p)switch(e){case 3:return!0;case 5:return h;case 6:return y;case 2:Ea(S,h)}else switch(e){case 4:return!1;case 7:Ea(S,h)}return o?-1:i||n?n:S}},Ia={forEach:ba(0),map:ba(1),filter:ba(2),some:ba(3),every:ba(4),find:ba(5),findIndex:ba(6),filterReject:ba(7)},Ta=Xi,Aa=o,Ra=X,Ca=$n,Oa=h,wa=A,ka=c,Na=oe,Pa=s,Da=Ve,Ma=to,La=j,Ua=H,xa=q,Va=he,Fa=Mt,Ba=Le,ja=B,Ga=ht,Ha=_o,za=g,Ka=Rn,Wa=an,Xa=Wr,qa=vo,Ya=gi,Ja=a,Qa=Ot,Za=rn,$a=p,es=Po,ts=Yt.exports,rs=Ae.exports,is=lr,ns=He,os=et,as=Do,ss=Fo,cs=Ho,us=wr,ds=Ia.forEach,ls=dr("hidden"),hs="Symbol",ps=os("toPrimitive"),fs=us.set,_s=us.getterFor(hs),vs=Object.prototype,ms=Aa.Symbol,ys=ms&&ms.prototype,gs=Aa.TypeError,Ss=Aa.QObject,Es=Ra("JSON","stringify"),bs=Ja.f,Is=Qa.f,Ts=qa.f,As=$a.f,Rs=wa([].push),Cs=rs("symbols"),Os=rs("op-symbols"),ws=rs("string-to-symbol-registry"),ks=rs("symbol-to-string-registry"),Ns=rs("wks"),Ps=!Ss||!Ss.prototype||!Ss.prototype.findChild,Ds=ka&&Pa((function(){return 7!=Ka(Is({},"a",{get:function(){return Is(this,"a",{value:7}).a}})).a}))?function(e,t,r){var i=bs(vs,t);i&&delete vs[t],Is(e,t,r),i&&e!==vs&&Is(vs,t,i)}:Is,Ms=function(e,t){var r=Cs[e]=Ka(ys);return fs(r,{type:hs,tag:e,description:t}),ka||(r.description=t),r},Ls=function(e,t,r){e===vs&&Ls(Os,t,r),Fa(e);var i=Ga(t);return Fa(r),Da(Cs,i)?(r.enumerable?(Da(e,ls)&&e[ls][i]&&(e[ls][i]=!1),r=Ka(r,{enumerable:za(0,!1)})):(Da(e,ls)||Is(e,ls,za(1,{})),e[ls][i]=!0),Ds(e,i,r)):Is(e,i,r)},Us=function(e,t){Fa(e);var r=ja(t),i=Wa(r).concat(Bs(r));return ds(i,(function(t){ka&&!Oa(xs,r,t)||Ls(e,t,r[t])})),e},xs=function(e){var t=Ga(e),r=Oa(As,this,t);return!(this===vs&&Da(Cs,t)&&!Da(Os,t))&&(!(r||!Da(this,t)||!Da(Cs,t)||Da(this,ls)&&this[ls][t])||r)},Vs=function(e,t){var r=ja(e),i=Ga(t);if(r!==vs||!Da(Cs,i)||Da(Os,i)){var n=bs(r,i);return!n||!Da(Cs,i)||Da(r,ls)&&r[ls][i]||(n.enumerable=!0),n}},Fs=function(e){var t=Ts(ja(e)),r=[];return ds(t,(function(e){Da(Cs,e)||Da(is,e)||Rs(r,e)})),r},Bs=function(e){var t=e===vs,r=Ts(t?Os:ja(e)),i=[];return ds(r,(function(e){!Da(Cs,e)||t&&!Da(vs,e)||Rs(i,Cs[e])})),i};(Na||(ms=function(){if(xa(ys,this))throw gs("Symbol is not a constructor");var e=arguments.length&&void 0!==arguments[0]?Ha(arguments[0]):void 0,t=ns(e),r=function(e){this===vs&&Oa(r,Os,e),Da(this,ls)&&Da(this[ls],t)&&(this[ls][t]=!1),Ds(this,t,za(1,e))};return ka&&Ps&&Ds(vs,t,{configurable:!0,set:r}),Ms(t,e)},ts(ys=ms.prototype,"toString",(function(){return _s(this).tag})),ts(ms,"withoutSetter",(function(e){return Ms(ns(e),e)})),$a.f=xs,Qa.f=Ls,Za.f=Us,Ja.f=Vs,Xa.f=qa.f=Fs,Ya.f=Bs,as.f=function(e){return Ms(os(e),e)},ka&&(Is(ys,"description",{configurable:!0,get:function(){return _s(this).description}}),ts(vs,"propertyIsEnumerable",xs,{unsafe:!0}))),Ta({global:!0,wrap:!0,forced:!Na,sham:!Na},{Symbol:ms}),ds(Wa(Ns),(function(e){ss(e)})),Ta({target:hs,stat:!0,forced:!Na},{for:function(e){var t=Ha(e);if(Da(ws,t))return ws[t];var r=ms(t);return ws[t]=r,ks[r]=t,r},keyFor:function(e){if(!Va(e))throw gs(e+" is not a symbol");if(Da(ks,e))return ks[e]},useSetter:function(){Ps=!0},useSimple:function(){Ps=!1}}),Ta({target:"Object",stat:!0,forced:!Na,sham:!ka},{create:function(e,t){return void 0===t?Ka(e):Us(Ka(e),t)},defineProperty:Ls,defineProperties:Us,getOwnPropertyDescriptor:Vs}),Ta({target:"Object",stat:!0,forced:!Na},{getOwnPropertyNames:Fs,getOwnPropertySymbols:Bs}),Ta({target:"Object",stat:!0,forced:Pa((function(){Ya.f(1)}))},{getOwnPropertySymbols:function(e){return Ya.f(Ba(e))}}),Es)&&Ta({target:"JSON",stat:!0,forced:!Na||Pa((function(){var e=ms();return"[null]"!=Es([e])||"{}"!=Es({a:e})||"{}"!=Es(Object(e))}))},{stringify:function(e,t,r){var i=es(arguments),n=t;if((Ua(t)||void 0!==e)&&!Va(e))return Ma(t)||(t=function(e,t){if(La(n)&&(t=Oa(n,this,e,t)),!Va(t))return t}),i[1]=t,Ca(Es,null,i)}});if(!ys[ps]){var js=ys.valueOf;ts(ys,ps,(function(e){return Oa(js,this)}))}cs(ms,hs),is[ls]=!0;var Gs=Xi,Hs=s,zs=B,Ks=a.f,Ws=c,Xs=Hs((function(){Ks(1)}));Gs({target:"Object",stat:!0,forced:!Ws||Xs,sham:!Ws},{getOwnPropertyDescriptor:function(e,t){return Ks(zs(e),t)}});var qs=ho,Ys=io?{}.toString:function(){return"[object "+qs(this)+"]"},Js=io,Qs=Yt.exports,Zs=Ys;Js||Qs(Object.prototype,"toString",Zs,{unsafe:!0});var $s=Xi,ec=c,tc=Ot.f;$s({target:"Object",stat:!0,forced:Object.defineProperty!==tc,sham:!ec},{defineProperty:tc});var rc=o.Promise,ic=Yt.exports,nc=function(e,t,r){for(var i in t)ic(e,i,t[i],r);return e},oc=X,ac=Ot,sc=c,cc=et("species"),uc=function(e){var t=oc(e),r=ac.f;sc&&t&&!t[cc]&&r(t,cc,{configurable:!0,get:function(){return this}})},dc=q,lc=o.TypeError,hc=function(e,t){if(dc(t,e))return e;throw lc("Incorrect invocation")},pc={},fc=pc,_c=et("iterator"),vc=Array.prototype,mc=function(e){return void 0!==e&&(fc.Array===e||vc[_c]===e)},yc=ho,gc=Se,Sc=pc,Ec=et("iterator"),bc=function(e){if(null!=e)return gc(e,Ec)||gc(e,"@@iterator")||Sc[yc(e)]},Ic=h,Tc=ye,Ac=Mt,Rc=fe,Cc=bc,Oc=o.TypeError,wc=function(e,t){var r=arguments.length<2?Cc(e):t;if(Tc(r))return Ac(Ic(r,e));throw Oc(Rc(e)+" is not iterable")},kc=h,Nc=Mt,Pc=Se,Dc=function(e,t,r){var i,n;Nc(e);try{if(!(i=Pc(e,"return"))){if("throw"===t)throw r;return r}i=kc(i,e)}catch(e){n=!0,i=e}if("throw"===t)throw r;if(n)throw i;return Nc(i),r},Mc=Xo,Lc=h,Uc=Mt,xc=fe,Vc=mc,Fc=ni,Bc=q,jc=wc,Gc=bc,Hc=Dc,zc=o.TypeError,Kc=function(e,t){this.stopped=e,this.result=t},Wc=Kc.prototype,Xc=function(e,t,r){var i,n,o,a,s,c,u,d=r&&r.that,l=!(!r||!r.AS_ENTRIES),h=!(!r||!r.IS_ITERATOR),p=!(!r||!r.INTERRUPTED),f=Mc(t,d),_=function(e){return i&&Hc(i,"normal",e),new Kc(!0,e)},v=function(e){return l?(Uc(e),p?f(e[0],e[1],_):f(e[0],e[1])):p?f(e,_):f(e)};if(h)i=e;else{if(!(n=Gc(e)))throw zc(xc(e)+" is not iterable");if(Vc(n)){for(o=0,a=Fc(e);a>o;o++)if((s=v(e[o]))&&Bc(Wc,s))return s;return new Kc(!1)}i=jc(e,n)}for(c=i.next;!(u=Lc(c,i)).done;){try{s=v(u.value)}catch(e){Hc(i,"throw",e)}if("object"==typeof s&&s&&Bc(Wc,s))return s}return new Kc(!1)},qc=et("iterator"),Yc=!1;try{var Jc=0,Qc={next:function(){return{done:!!Jc++}},return:function(){Yc=!0}};Qc[qc]=function(){return this},Array.from(Qc,(function(){throw 2}))}catch(e){}var Zc,$c,eu,tu,ru=function(e,t){if(!t&&!Yc)return!1;var r=!1;try{var i={};i[qc]=function(){return{next:function(){return{done:r=!0}}}},e(i)}catch(e){}return r},iu=sa,nu=fe,ou=o.TypeError,au=function(e){if(iu(e))return e;throw ou(nu(e)+" is not a constructor")},su=Mt,cu=au,uu=et("species"),du=function(e,t){var r,i=su(e).constructor;return void 0===i||null==(r=su(i)[uu])?t:cu(r)},lu=o.TypeError,hu=function(e,t){if(e<t)throw lu("Not enough arguments");return e},pu=/(?:ipad|iphone|ipod).*applewebkit/i.test(Y),fu="process"==w(o.process),_u=o,vu=$n,mu=Xo,yu=j,gu=Ve,Su=s,Eu=fn,bu=Po,Iu=vt,Tu=hu,Au=pu,Ru=fu,Cu=_u.setImmediate,Ou=_u.clearImmediate,wu=_u.process,ku=_u.Dispatch,Nu=_u.Function,Pu=_u.MessageChannel,Du=_u.String,Mu=0,Lu={},Uu="onreadystatechange";try{Zc=_u.location}catch(e){}var xu=function(e){if(gu(Lu,e)){var t=Lu[e];delete Lu[e],t()}},Vu=function(e){return function(){xu(e)}},Fu=function(e){xu(e.data)},Bu=function(e){_u.postMessage(Du(e),Zc.protocol+"//"+Zc.host)};Cu&&Ou||(Cu=function(e){Tu(arguments.length,1);var t=yu(e)?e:Nu(e),r=bu(arguments,1);return Lu[++Mu]=function(){vu(t,void 0,r)},$c(Mu),Mu},Ou=function(e){delete Lu[e]},Ru?$c=function(e){wu.nextTick(Vu(e))}:ku&&ku.now?$c=function(e){ku.now(Vu(e))}:Pu&&!Au?(tu=(eu=new Pu).port2,eu.port1.onmessage=Fu,$c=mu(tu.postMessage,tu)):_u.addEventListener&&yu(_u.postMessage)&&!_u.importScripts&&Zc&&"file:"!==Zc.protocol&&!Su(Bu)?($c=Bu,_u.addEventListener("message",Fu,!1)):$c=Uu in Iu("script")?function(e){Eu.appendChild(Iu("script")).onreadystatechange=function(){Eu.removeChild(this),xu(e)}}:function(e){setTimeout(Vu(e),0)});var ju,Gu,Hu,zu,Ku,Wu,Xu,qu,Yu={set:Cu,clear:Ou},Ju=o,Qu=/ipad|iphone|ipod/i.test(Y)&&void 0!==Ju.Pebble,Zu=/web0s(?!.*chrome)/i.test(Y),$u=o,ed=Xo,td=a.f,rd=Yu.set,id=pu,nd=Qu,od=Zu,ad=fu,sd=$u.MutationObserver||$u.WebKitMutationObserver,cd=$u.document,ud=$u.process,dd=$u.Promise,ld=td($u,"queueMicrotask"),hd=ld&&ld.value;hd||(ju=function(){var e,t;for(ad&&(e=ud.domain)&&e.exit();Gu;){t=Gu.fn,Gu=Gu.next;try{t()}catch(e){throw Gu?zu():Hu=void 0,e}}Hu=void 0,e&&e.enter()},id||ad||od||!sd||!cd?!nd&&dd&&dd.resolve?((Xu=dd.resolve(void 0)).constructor=dd,qu=ed(Xu.then,Xu),zu=function(){qu(ju)}):ad?zu=function(){ud.nextTick(ju)}:(rd=ed(rd,$u),zu=function(){rd(ju)}):(Ku=!0,Wu=cd.createTextNode(""),new sd(ju).observe(Wu,{characterData:!0}),zu=function(){Wu.data=Ku=!Ku}));var pd=hd||function(e){var t={fn:e,next:void 0};Hu&&(Hu.next=t),Gu||(Gu=t,zu()),Hu=t},fd={},_d=ye,vd=function(e){var t,r;this.promise=new e((function(e,i){if(void 0!==t||void 0!==r)throw TypeError("Bad Promise constructor");t=e,r=i})),this.resolve=_d(t),this.reject=_d(r)};fd.f=function(e){return new vd(e)};var md=Mt,yd=H,gd=fd,Sd=function(e,t){if(md(e),yd(t)&&t.constructor===e)return t;var r=gd.f(e);return(0,r.resolve)(t),r.promise},Ed=o,bd=function(){this.head=null,this.tail=null};bd.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 Id,Td,Ad,Rd,Cd=bd,Od="object"==typeof window,wd=Xi,kd=o,Nd=X,Pd=h,Dd=rc,Md=Yt.exports,Ld=nc,Ud=tn,xd=Ho,Vd=uc,Fd=ye,Bd=j,jd=H,Gd=hc,Hd=rr,zd=Xc,Kd=ru,Wd=du,Xd=Yu.set,qd=pd,Yd=Sd,Jd=function(e,t){var r=Ed.console;r&&r.error&&(1==arguments.length?r.error(e):r.error(e,t))},Qd=fd,Zd=function(e){try{return{error:!1,value:e()}}catch(e){return{error:!0,value:e}}},$d=Cd,el=wr,tl=Fi,rl=Od,il=fu,nl=re,ol=et("species"),al="Promise",sl=el.getterFor(al),cl=el.set,ul=el.getterFor(al),dl=Dd&&Dd.prototype,ll=Dd,hl=dl,pl=kd.TypeError,fl=kd.document,_l=kd.process,vl=Qd.f,ml=vl,yl=!!(fl&&fl.createEvent&&kd.dispatchEvent),gl=Bd(kd.PromiseRejectionEvent),Sl="unhandledrejection",El=!1,bl=tl(al,(function(){var e=Hd(ll),t=e!==String(ll);if(!t&&66===nl)return!0;if(nl>=51&&/native code/.test(e))return!1;var r=new ll((function(e){e(1)})),i=function(e){e((function(){}),(function(){}))};return(r.constructor={})[ol]=i,!(El=r.then((function(){}))instanceof i)||!t&&rl&&!gl})),Il=bl||!Kd((function(e){ll.all(e).catch((function(){}))})),Tl=function(e){var t;return!(!jd(e)||!Bd(t=e.then))&&t},Al=function(e,t){var r,i,n,o=t.value,a=1==t.state,s=a?e.ok:e.fail,c=e.resolve,u=e.reject,d=e.domain;try{s?(a||(2===t.rejection&&kl(t),t.rejection=1),!0===s?r=o:(d&&d.enter(),r=s(o),d&&(d.exit(),n=!0)),r===e.promise?u(pl("Promise-chain cycle")):(i=Tl(r))?Pd(i,r,c,u):c(r)):u(o)}catch(e){d&&!n&&d.exit(),u(e)}},Rl=function(e,t){e.notified||(e.notified=!0,qd((function(){for(var r,i=e.reactions;r=i.get();)Al(r,e);e.notified=!1,t&&!e.rejection&&Ol(e)})))},Cl=function(e,t,r){var i,n;yl?((i=fl.createEvent("Event")).promise=t,i.reason=r,i.initEvent(e,!1,!0),kd.dispatchEvent(i)):i={promise:t,reason:r},!gl&&(n=kd["on"+e])?n(i):e===Sl&&Jd("Unhandled promise rejection",r)},Ol=function(e){Pd(Xd,kd,(function(){var t,r=e.facade,i=e.value;if(wl(e)&&(t=Zd((function(){il?_l.emit("unhandledRejection",i,r):Cl(Sl,r,i)})),e.rejection=il||wl(e)?2:1,t.error))throw t.value}))},wl=function(e){return 1!==e.rejection&&!e.parent},kl=function(e){Pd(Xd,kd,(function(){var t=e.facade;il?_l.emit("rejectionHandled",t):Cl("rejectionhandled",t,e.value)}))},Nl=function(e,t,r){return function(i){e(t,i,r)}},Pl=function(e,t,r){e.done||(e.done=!0,r&&(e=r),e.value=t,e.state=2,Rl(e,!0))},Dl=function(e,t,r){if(!e.done){e.done=!0,r&&(e=r);try{if(e.facade===t)throw pl("Promise can't be resolved itself");var i=Tl(t);i?qd((function(){var r={done:!1};try{Pd(i,t,Nl(Dl,r,e),Nl(Pl,r,e))}catch(t){Pl(r,t,e)}})):(e.value=t,e.state=1,Rl(e,!1))}catch(t){Pl({done:!1},t,e)}}};if(bl&&(hl=(ll=function(e){Gd(this,hl),Fd(e),Pd(Id,this);var t=sl(this);try{e(Nl(Dl,t),Nl(Pl,t))}catch(e){Pl(t,e)}}).prototype,(Id=function(e){cl(this,{type:al,done:!1,notified:!1,parent:!1,reactions:new $d,rejection:!1,state:0,value:void 0})}).prototype=Ld(hl,{then:function(e,t){var r=ul(this),i=vl(Wd(this,ll));return r.parent=!0,i.ok=!Bd(e)||e,i.fail=Bd(t)&&t,i.domain=il?_l.domain:void 0,0==r.state?r.reactions.add(i):qd((function(){Al(i,r)})),i.promise},catch:function(e){return this.then(void 0,e)}}),Td=function(){var e=new Id,t=sl(e);this.promise=e,this.resolve=Nl(Dl,t),this.reject=Nl(Pl,t)},Qd.f=vl=function(e){return e===ll||e===Ad?new Td(e):ml(e)},Bd(Dd)&&dl!==Object.prototype)){Rd=dl.then,El||(Md(dl,"then",(function(e,t){var r=this;return new ll((function(e,t){Pd(Rd,r,e,t)})).then(e,t)}),{unsafe:!0}),Md(dl,"catch",hl.catch,{unsafe:!0}));try{delete dl.constructor}catch(e){}Ud&&Ud(dl,hl)}wd({global:!0,wrap:!0,forced:bl},{Promise:ll}),xd(ll,al,!1),Vd(al),Ad=Nd(al),wd({target:al,stat:!0,forced:bl},{reject:function(e){var t=vl(this);return Pd(t.reject,void 0,e),t.promise}}),wd({target:al,stat:!0,forced:bl},{resolve:function(e){return Yd(this,e)}}),wd({target:al,stat:!0,forced:Il},{all:function(e){var t=this,r=vl(t),i=r.resolve,n=r.reject,o=Zd((function(){var r=Fd(t.resolve),o=[],a=0,s=1;zd(e,(function(e){var c=a++,u=!1;s++,Pd(r,t,e).then((function(e){u||(u=!0,o[c]=e,--s||i(o))}),n)})),--s||i(o)}));return o.error&&n(o.value),r.promise},race:function(e){var t=this,r=vl(t),i=r.reject,n=Zd((function(){var n=Fd(t.resolve);zd(e,(function(e){Pd(n,t,e).then(r.resolve,i)}))}));return n.error&&i(n.value),r.promise}});var Ml=Xi,Ll=c,Ul=o,xl=A,Vl=Ve,Fl=j,Bl=q,jl=_o,Gl=Ot.f,Hl=ki,zl=Ul.Symbol,Kl=zl&&zl.prototype;if(Ll&&Fl(zl)&&(!("description"in Kl)||void 0!==zl().description)){var Wl={},Xl=function(){var e=arguments.length<1||void 0===arguments[0]?void 0:jl(arguments[0]),t=Bl(Kl,this)?new zl(e):void 0===e?zl():zl(e);return""===e&&(Wl[t]=!0),t};Hl(Xl,zl),Xl.prototype=Kl,Kl.constructor=Xl;var ql="Symbol(test)"==String(zl("test")),Yl=xl(Kl.toString),Jl=xl(Kl.valueOf),Ql=/^Symbol\((.*)\)[^)]+$/,Zl=xl("".replace),$l=xl("".slice);Gl(Kl,"description",{configurable:!0,get:function(){var e=Jl(this),t=Yl(e);if(Vl(Wl,e))return"";var r=ql?$l(t,7,-1):Zl(t,Ql,"$1");return""===r?void 0:r}}),Ml({global:!0,forced:!0},{Symbol:Xl})}Fo("iterator");var eh=Rn,th=Ot,rh=et("unscopables"),ih=Array.prototype;null==ih[rh]&&th.f(ih,rh,{configurable:!0,value:eh(null)});var nh,oh,ah,sh=function(e){ih[rh][e]=!0},ch=!s((function(){function e(){}return e.prototype.constructor=null,Object.getPrototypeOf(new e)!==e.prototype})),uh=o,dh=Ve,lh=j,hh=Le,ph=ch,fh=dr("IE_PROTO"),_h=uh.Object,vh=_h.prototype,mh=ph?_h.getPrototypeOf:function(e){var t=hh(e);if(dh(t,fh))return t[fh];var r=t.constructor;return lh(r)&&t instanceof r?r.prototype:t instanceof _h?vh:null},yh=s,gh=j,Sh=mh,Eh=Yt.exports,bh=et("iterator"),Ih=!1;[].keys&&("next"in(ah=[].keys())?(oh=Sh(Sh(ah)))!==Object.prototype&&(nh=oh):Ih=!0);var Th=null==nh||yh((function(){var e={};return nh[bh].call(e)!==e}));Th&&(nh={}),gh(nh[bh])||Eh(nh,bh,(function(){return this}));var Ah={IteratorPrototype:nh,BUGGY_SAFARI_ITERATORS:Ih},Rh=Ah.IteratorPrototype,Ch=Rn,Oh=g,wh=Ho,kh=pc,Nh=function(){return this},Ph=function(e,t,r,i){var n=t+" Iterator";return e.prototype=Ch(Rh,{next:Oh(+!i,r)}),wh(e,n,!1),kh[n]=Nh,e},Dh=Xi,Mh=h,Lh=Lr,Uh=j,xh=Ph,Vh=mh,Fh=tn,Bh=Ho,jh=qt,Gh=Yt.exports,Hh=pc,zh=Lh.PROPER,Kh=Lh.CONFIGURABLE,Wh=Ah.IteratorPrototype,Xh=Ah.BUGGY_SAFARI_ITERATORS,qh=et("iterator"),Yh="keys",Jh="values",Qh="entries",Zh=function(){return this},$h=function(e,t,r,i,n,o,a){xh(r,t,i);var s,c,u,d=function(e){if(e===n&&_)return _;if(!Xh&&e in p)return p[e];switch(e){case Yh: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[qh]||p["@@iterator"]||n&&p[n],_=!Xh&&f||d(n),v="Array"==t&&p.entries||f;if(v&&(s=Vh(v.call(new e)))!==Object.prototype&&s.next&&(Vh(s)!==Wh&&(Fh?Fh(s,Wh):Uh(s[qh])||Gh(s,qh,Zh)),Bh(s,l,!0)),zh&&n==Jh&&f&&f.name!==Jh&&(Kh?jh(p,"name",Jh):(h=!0,_=function(){return Mh(f,this)})),n)if(c={values:d(Jh),keys:o?_:d(Yh),entries:d(Qh)},a)for(u in c)(Xh||h||!(u in p))&&Gh(p,u,c[u]);else Dh({target:t,proto:!0,forced:Xh||h},c);return p[qh]!==_&&Gh(p,qh,_,{name:n}),Hh[t]=_,c},ep=B,tp=sh,rp=pc,ip=wr,np=Ot.f,op=$h,ap=c,sp="Array Iterator",cp=ip.set,up=ip.getterFor(sp),dp=op(Array,"Array",(function(e,t){cp(this,{type:sp,target:ep(e),index:0,kind:t})}),(function(){var e=up(this),t=e.target,r=e.kind,i=e.index++;return!t||i>=t.length?(e.target=void 0,{value:void 0,done:!0}):"keys"==r?{value:i,done:!1}:"values"==r?{value:t[i],done:!1}:{value:[i,t[i]],done:!1}}),"values"),lp=rp.Arguments=rp.Array;if(tp("keys"),tp("values"),tp("entries"),ap&&"values"!==lp.name)try{np(lp,"name",{value:"values"})}catch(e){}var hp=A,pp=Yr,fp=_o,_p=x,vp=hp("".charAt),mp=hp("".charCodeAt),yp=hp("".slice),gp=function(e){return function(t,r){var i,n,o=fp(_p(t)),a=pp(r),s=o.length;return a<0||a>=s?e?"":void 0:(i=mp(o,a))<55296||i>56319||a+1===s||(n=mp(o,a+1))<56320||n>57343?e?vp(o,a):i:e?yp(o,a,a+2):n-56320+(i-55296<<10)+65536}},Sp={codeAt:gp(!1),charAt:gp(!0)},Ep=Sp.charAt,bp=_o,Ip=wr,Tp=$h,Ap="String Iterator",Rp=Ip.set,Cp=Ip.getterFor(Ap);Tp(String,"String",(function(e){Rp(this,{type:Ap,string:bp(e),index:0})}),(function(){var e,t=Cp(this),r=t.string,i=t.index;return i>=r.length?{value:void 0,done:!0}:(e=Ep(r,i),t.index+=e.length,{value:e,done:!1})}));var Op={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},wp=vt("span").classList,kp=wp&&wp.constructor&&wp.constructor.prototype,Np=kp===Object.prototype?void 0:kp,Pp=o,Dp=Op,Mp=Np,Lp=dp,Up=qt,xp=et,Vp=xp("iterator"),Fp=xp("toStringTag"),Bp=Lp.values,jp=function(e,t){if(e){if(e[Vp]!==Bp)try{Up(e,Vp,Bp)}catch(t){e[Vp]=Bp}if(e[Fp]||Up(e,Fp,t),Dp[t])for(var r in Lp)if(e[r]!==Lp[r])try{Up(e,r,Lp[r])}catch(t){e[r]=Lp[r]}}};for(var Gp in Dp)jp(Pp[Gp]&&Pp[Gp].prototype,Gp);jp(Mp,"DOMTokenList");var Hp=s,zp=re,Kp=et("species"),Wp=function(e){return zp>=51||!Hp((function(){var t=[];return(t.constructor={})[Kp]=function(){return{foo:1}},1!==t[e](Boolean).foo}))},Xp=Xi,qp=o,Yp=s,Jp=to,Qp=H,Zp=Le,$p=ni,ef=So,tf=_a,rf=Wp,nf=re,of=et("isConcatSpreadable"),af=9007199254740991,sf="Maximum allowed index exceeded",cf=qp.TypeError,uf=nf>=51||!Yp((function(){var e=[];return e[of]=!1,e.concat()[0]!==e})),df=rf("concat"),lf=function(e){if(!Qp(e))return!1;var t=e[of];return void 0!==t?!!t:Jp(e)};Xp({target:"Array",proto:!0,forced:!uf||!df},{concat:function(e){var t,r,i,n,o,a=Zp(this),s=tf(a,0),c=0;for(t=-1,i=arguments.length;t<i;t++)if(lf(o=-1===t?a:arguments[t])){if(c+(n=$p(o))>af)throw cf(sf);for(r=0;r<n;r++,c++)r in o&&ef(s,c,o[r])}else{if(c>=af)throw cf(sf);ef(s,c++,o)}return s.length=c,s}});var hf=Xi,pf=o,ff=to,_f=sa,vf=H,mf=$r,yf=ni,gf=B,Sf=So,Ef=et,bf=Po,If=Wp("slice"),Tf=Ef("species"),Af=pf.Array,Rf=Math.max;hf({target:"Array",proto:!0,forced:!If},{slice:function(e,t){var r,i,n,o=gf(this),a=yf(o),s=mf(e,a),c=mf(void 0===t?a:t,a);if(ff(o)&&(r=o.constructor,(_f(r)&&(r===Af||ff(r.prototype))||vf(r)&&null===(r=r[Tf]))&&(r=void 0),r===Af||void 0===r))return bf(o,s,c);for(i=new(void 0===r?Af:r)(Rf(c-s,0)),n=0;s<c;s++,n++)s in o&&Sf(i,n,o[s]);return i.length=n,i}}),Fo("asyncIterator");var Cf=function(e,t){return Cf=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])},Cf(e,t)};function Of(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}Cf(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}var wf,kf,Nf,Pf,Df,Mf,Lf,Uf,xf,Vf,Ff,Bf,jf,Gf,Hf,zf,Kf,Wf,Xf,qf,Yf,Jf,Qf,Zf,$f,e_=function(){return e_=Object.assign||function(e){for(var t,r=1,i=arguments.length;r<i;r++)for(var n in t=arguments[r])Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e},e_.apply(this,arguments)};function t_(e,r,i,n){var o,a=arguments.length,s=a<3?r:null===n?n=Object.getOwnPropertyDescriptor(r,i):n;if("object"===("undefined"==typeof Reflect?"undefined":t(Reflect))&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,r,i,n);else for(var c=e.length-1;c>=0;c--)(o=e[c])&&(s=(a<3?o(s):a>3?o(r,i,s):o(r,i))||s);return a>3&&s&&Object.defineProperty(r,i,s),s}function r_(e,t,r,i){return new(r||(r=Promise))((function(n,o){function a(e){try{c(i.next(e))}catch(e){o(e)}}function s(e){try{c(i.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,s)}c((i=i.apply(e,t||[])).next())}))}function i_(e,t){var r,i,n,o,a={label:0,sent:function(){if(1&n[0])throw n[1];return n[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(r)throw new TypeError("Generator is already executing.");for(;a;)try{if(r=1,i&&(n=2&o[0]?i.return:o[0]?i.throw||((n=i.return)&&n.call(i),0):i.next)&&!(n=n.call(i,o[1])).done)return n;switch(i=0,n&&(o=[2&o[0],n.value]),o[0]){case 0:case 1:n=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,i=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(n=a.trys,(n=n.length>0&&n[n.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!n||o[1]>n[0]&&o[1]<n[3])){a.label=o[1];break}if(6===o[0]&&a.label<n[1]){a.label=n[1],n=o;break}if(n&&a.label<n[2]){a.label=n[2],a.ops.push(o);break}n[2]&&a.ops.pop(),a.trys.pop();continue}o=t.call(e,a)}catch(e){o=[6,e],i=0}finally{r=n=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}}function n_(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],i=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&i>=e.length&&(e=void 0),{value:e&&e[i++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function o_(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var i,n,o=r.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(i=o.next()).done;)a.push(i.value)}catch(e){n={error:e}}finally{try{i&&!i.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}return a}function a_(e,t,r){if(r||2===arguments.length)for(var i,n=0,o=t.length;n<o;n++)!i&&n in t||(i||(i=Array.prototype.slice.call(t,0,n)),i[n]=t[n]);return e.concat(i||Array.prototype.slice.call(t))}function s_(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t,r=e[Symbol.asyncIterator];return r?r.call(e):(e=n_(e),t={},i("next"),i("throw"),i("return"),t[Symbol.asyncIterator]=function(){return this},t);function i(r){t[r]=e[r]&&function(t){return new Promise((function(i,n){(function(e,t,r,i){Promise.resolve(i).then((function(t){e({value:t,done:r})}),t)})(i,n,(t=e[r](t)).done,t.value)}))}}}!function(e){e[e.VIDEO_SOURCE_TYPE_EXTERNAL=0]="VIDEO_SOURCE_TYPE_EXTERNAL",e[e.VIDEO_SOURCE_TYPE_INTERNAL=1]="VIDEO_SOURCE_TYPE_INTERNAL"}(wf||(wf={})),function(e){e[e.AUDIO_SOURCE_TYPE_EXTERNAL=0]="AUDIO_SOURCE_TYPE_EXTERNAL",e[e.AUDIO_SOURCE_TYPE_INTERNAL=1]="AUDIO_SOURCE_TYPE_INTERNAL"}(kf||(kf={})),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"}(Nf||(Nf={})),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.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"}(Lf||(Lf={})),function(e){e[e.MIRROR_MODE_OFF=0]="MIRROR_MODE_OFF",e[e.MIRROR_MODE_ON=1]="MIRROR_MODE_ON"}(Uf||(Uf={})),function(e){e[e.RENDER_MODE_HIDDEN=0]="RENDER_MODE_HIDDEN",e[e.RENDER_MODE_FIT=1]="RENDER_MODE_FIT"}(xf||(xf={})),function(e){e[e.STREAM_INDEX_MAIN=0]="STREAM_INDEX_MAIN",e[e.STREAM_INDEX_SCREEN=1]="STREAM_INDEX_SCREEN"}(Vf||(Vf={})),function(e){e[e.AUDIO=1]="AUDIO",e[e.VIDEO=2]="VIDEO",e[e.AUDIO_AND_VIDEO=3]="AUDIO_AND_VIDEO"}(Ff||(Ff={})),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"}(Bf||(Bf={})),function(e){e[e.CONNECTION_START=0]="CONNECTION_START",e[e.CONNECTION_STATE_DISCONNECTED=1]="CONNECTION_STATE_DISCONNECTED",e[e.CONNECTION_STATE_CONNECTING=2]="CONNECTION_STATE_CONNECTING",e[e.CONNECTION_STATE_CONNECTED=3]="CONNECTION_STATE_CONNECTED",e[e.CONNECTION_STATE_RECONNECTING=4]="CONNECTION_STATE_RECONNECTING",e[e.CONNECTION_STATE_RECONNECTED=5]="CONNECTION_STATE_RECONNECTED",e[e.CONNECTION_STATE_LOST=6]="CONNECTION_STATE_LOST"}(jf||(jf={})),function(e){e[e.MIRROR_TYPE_NONE=0]="MIRROR_TYPE_NONE",e[e.MIRROR_TYPE_RENDER=1]="MIRROR_TYPE_RENDER"}(Gf||(Gf={})),function(e){e[e.domestic=0]="domestic",e[e.overseas=1]="overseas"}(Hf||(Hf={})),function(e){e[e.OFFLINE=0]="OFFLINE",e[e.ONLINE=1]="ONLINE",e[e.UNREACHABLE=2]="UNREACHABLE"}(zf||(zf={})),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"}(Kf||(Kf={})),function(e){e[e.PREV_FRAME=0]="PREV_FRAME",e[e.OTHER_FRAME=1]="OTHER_FRAME"}(Wf||(Wf={})),function(e){e[e.DISABLE=0]="DISABLE",e[e.VIDEO_STREAM_LOW=1]="VIDEO_STREAM_LOW",e[e.AUDIO_ONLY=2]="AUDIO_ONLY"}(Xf||(Xf={})),function(e){e[e.LOW=0]="LOW",e[e.MEDIUM=100]="MEDIUM",e[e.HIGH=200]="HIGH"}(qf||(qf={})),function(e){e[e.UNKNOWN=0]="UNKNOWN",e[e.EXCELLENT=1]="EXCELLENT",e[e.GOOD=2]="GOOD",e[e.POOR=3]="POOR",e[e.BAD=4]="BAD",e[e.VBAD=5]="VBAD"}(Yf||(Yf={})),function(e){e[e.Unknown=-1]="Unknown",e[e.SubscribeFallbackByBandwidth=0]="SubscribeFallbackByBandwidth",e[e.SubscribeRecoverByBandwidth=2]="SubscribeRecoverByBandwidth"}(Jf||(Jf={})),function(e){e[e.communication=0]="communication",e[e.chat=5]="chat",e[e.chatRoom=6]="chatRoom",e[e.coHost=9]="coHost",e[e.meeting=16]="meeting",e[e.classRoom=18]="classRoom"}(Qf||(Qf={})),function(e){e[e.default=0]="default",e[e.fluent=1]="fluent",e[e.standard=2]="standard",e[e.hd=3]="hd",e[e.standardStereo=4]="standardStereo",e[e.hdMono=5]="hdMono"}(Zf||(Zf={})),function(e){e[e.AUTO_PLAY=0]="AUTO_PLAY",e[e.VIDEO_ONLY=1]="VIDEO_ONLY",e[e.PLAY_MANUALLY=2]="PLAY_MANUALLY"}($f||($f={}));var c_,u_,d_,l_=Object.freeze({__proto__:null,get VideoSourceType(){return wf},get AudioSourceType(){return kf},get UserOfflineReason(){return Nf},get ChannelProfile(){return Pf},get SubscribeMode(){return Df},get SubscribeState(){return Mf},get PublishState(){return Lf},get MirrorMode(){return Uf},get VideoRenderMode(){return xf},get StreamIndex(){return Vf},get MediaType(){return Ff},get StreamRemoveReason(){return Bf},get ConnectionState(){return jf},get MirrorType(){return Gf},get LogChannel(){return Hf},get USER_ONLINE_STATUS(){return zf},get PublicStreamType(){return Kf},get PublicInterpolationMode(){return Wf},get SubscribeFallbackOption(){return Xf},get RemoteUserPriority(){return qf},get NetworkQuality(){return Yf},get FallbackOrRecoverReason(){return Jf},get RoomProfileType(){return Qf},get AudioProfileType(){return Zf},get RTCAutoPlayPolicy(){return $f}});!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"}(c_||(c_={})),function(e){e[e.PLAYOUT=0]="PLAYOUT",e[e.PUBLISH=1]="PUBLISH",e[e.PLAYOUT_AND_PUBLISH=2]="PLAYOUT_AND_PUBLISH"}(u_||(u_={})),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"}(d_||(d_={}));var h_,p_,f_=Object.freeze({__proto__:null,get AudioMixingDualMonoMode(){return c_},get AudioMixingType(){return u_},get AudioMixingState(){return d_}});!function(e){e.onTrackEnded="onTrackEnded",e.onPlayerEvent="onPlayerEvent",e.onAutoplayFailed="onAutoplayFailed",e.onUserJoined="onUserJoined",e.onUserLeave="onUserLeave",e.onConnectionStateChanged="onConnectionStateChanged",e.onUserPublishStream="onUserPublishStream",e.onUserUnpublishStream="onUserUnpublishStream",e.onUserPublishScreen="onUserPublishScreen",e.onUserUnpublishScreen="onUserUnpublishScreen",e.onRoomMessageReceived="onRoomMessageReceived",e.onRoomBinaryMessageReceived="onRoomBinaryMessageReceived",e.onUserMessageReceived="onUserMessageReceived",e.onUserBinaryMessageReceived="onUserBinaryMessageReceived",e.onVideoFirstFrameRendered="onVideoFirstFrameRendered",e.onVideoFirstFrameDecoded="onVideoFirstFrameDecoded",e.onAudioFirstFrameDecoded="onAudioFirstFrameDecoded",e.onFirstPublicStreamVideoFrameRendered="onFirstPublicStreamVideoFrameRendered",e.onFirstPublicStreamVideoFrameDecoded="onFirstPublicStreamVideoFrameDecoded",e.onFirstPublicStreamAudioFrameDecoded="onFirstPublicStreamAudioFrameDecoded",e.onVideoDeviceStateChanged="onVideoDeviceStateChanged",e.onAudioDeviceStateChanged="onAudioDeviceStateChanged",e.onRemoteStreamStats="onRemoteStreamStats",e.onPublicStreamStats="onPublicStreamStats",e.onLocalStreamStats="onLocalStreamStats",e.onAudioVolumeIndication="onAudioVolumeIndication",e.onLocalAudioPropertiesReport="onLocalAudioPropertiesReport",e.onRemoteAudioPropertiesReport="onRemoteAudioPropertiesReport",e.onAudioPlaybackDeviceChanged="onAudioPlaybackDeviceChanged",e.onUserStartVideoCapture="onUserStartVideoCapture",e.onUserStopVideoCapture="onUserStopVideoCapture",e.onUserStartAudioCapture="onUserStartAudioCapture",e.onUserStopAudioCapture="onUserStopAudioCapture",e.onAutoPublishResult="onAutoPublishResult",e.onAutoSubscribeResult="onAutoSubscribeResult",e.onLiveTranscodingResult="onLiveTranscodingResult",e.onStreamMixingEvent="onStreamMixingEvent",e.onAudioPlaybackDeviceTestVolume="onAudioPlaybackDeviceTestVolume",e.onSEIMessageReceived="onSEIMessageReceived",e.onError="onError",e.onAudioMixingStateChanged="onAudioMixingStateChanged",e.onUserMessageReceivedOutsideRoom="onUserMessageReceivedOutsideRoom",e.onUserBinaryMessageReceivedOutsideRoom="onUserBinaryMessageReceivedOutsideRoom",e.onTokenWillExpire="onTokenWillExpire",e.onCloudProxyConnected="onCloudProxyConnected",e.onPushPublicStreamResult="onPushPublicStreamResult",e.onPublicStreamSEIMessageReceived="onPublicStreamSEIMessageReceived",e.onNetworkQuality="onNetworkQuality",e.onSimulcastSubscribeFallback="onSimulcastSubscribeFallback",e.onRemoteVideoSizeChanged="onRemoteVideoSizeChanged",e.onLocalVideoSizeChanged="onLocalVideoSizeChanged",e.onLocalCameraStalled="onLocalCameraStalled"}(h_||(h_={})),function(e){e[e.ERR_OK=0]="ERR_OK",e[e.ERR_PARAM_INVALID=1]="ERR_PARAM_INVALID",e[e.ERR_FRAME_TIMEOUT=2]="ERR_FRAME_TIMEOUT",e[e.ERR_POSTPROCESS=3]="ERR_POSTPROCESS",e[e.ERR_PUSH_CDN=4]="ERR_PUSH_CDN",e[e.ERR_UNKNOWN=9999]="ERR_UNKNOWN"}(p_||(p_={}));var __=Ia.forEach,v_=Gn("forEach")?[].forEach:function(e){return __(this,e,arguments.length>1?arguments[1]:void 0)};Xi({target:"Array",proto:!0,forced:[].forEach!=v_},{forEach:v_});var m_=o,y_=Op,g_=Np,S_=v_,E_=qt,b_=function(e){if(e&&e.forEach!==S_)try{E_(e,"forEach",S_)}catch(t){e.forEach=S_}};for(var I_ in y_)y_[I_]&&b_(m_[I_]&&m_[I_].prototype);b_(g_);var T_=ui.includes,A_=sh;Xi({target:"Array",proto:!0},{includes:function(e){return T_(this,e,arguments.length>1?arguments[1]:void 0)}}),A_("includes");var R_=H,C_=w,O_=et("match"),w_=function(e){var t;return R_(e)&&(void 0!==(t=e[O_])?!!t:"RegExp"==C_(e))},k_=w_,N_=o.TypeError,P_=function(e){if(k_(e))throw N_("The method doesn't accept regular expressions");return e},D_=et("match"),M_=function(e){var t=/./;try{"/./"[e](t)}catch(r){try{return t[D_]=!1,"/./"[e](t)}catch(e){}}return!1},L_=Xi,U_=P_,x_=x,V_=_o,F_=M_,B_=A("".indexOf);L_({target:"String",proto:!0,forced:!F_("includes")},{includes:function(e){return!!~B_(V_(x_(this)),V_(U_(e)),arguments.length>1?arguments[1]:void 0)}});var j_=Mt,G_=function(){var e=j_(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},H_=s,z_=o.RegExp,K_=H_((function(){var e=z_("a","y");return e.lastIndex=2,null!=e.exec("abcd")})),W_=K_||H_((function(){return!z_("a","y").sticky})),X_={BROKEN_CARET:K_||H_((function(){var e=z_("^r","gy");return e.lastIndex=2,null!=e.exec("str")})),MISSED_STICKY:W_,UNSUPPORTED_Y:K_},q_=s,Y_=o.RegExp,J_=q_((function(){var e=Y_(".","s");return!(e.dotAll&&e.exec("\n")&&"s"===e.flags)})),Q_=s,Z_=o.RegExp,$_=Q_((function(){var e=Z_("(?<a>b)","g");return"b"!==e.exec("b").groups.a||"bc"!=="b".replace(e,"$<a>c")})),ev=h,tv=A,rv=_o,iv=G_,nv=X_,ov=Ae.exports,av=Rn,sv=wr.get,cv=J_,uv=$_,dv=ov("native-string-replace",String.prototype.replace),lv=RegExp.prototype.exec,hv=lv,pv=tv("".charAt),fv=tv("".indexOf),_v=tv("".replace),vv=tv("".slice),mv=function(){var e=/a/,t=/b*/g;return ev(lv,e,"a"),ev(lv,t,"a"),0!==e.lastIndex||0!==t.lastIndex}(),yv=nv.BROKEN_CARET,gv=void 0!==/()??/.exec("")[1];(mv||gv||yv||cv||uv)&&(hv=function(e){var t,r,i,n,o,a,s,c=this,u=sv(c),d=rv(e),l=u.raw;if(l)return l.lastIndex=c.lastIndex,t=ev(hv,l,d),c.lastIndex=l.lastIndex,t;var h=u.groups,p=yv&&c.sticky,f=ev(iv,c),_=c.source,v=0,m=d;if(p&&(f=_v(f,"y",""),-1===fv(f,"g")&&(f+="g"),m=vv(d,c.lastIndex),c.lastIndex>0&&(!c.multiline||c.multiline&&"\n"!==pv(d,c.lastIndex-1))&&(_="(?: "+_+")",m=" "+m,v++),r=new RegExp("^(?:"+_+")",f)),gv&&(r=new RegExp("^"+_+"$(?!\\s)",f)),mv&&(i=c.lastIndex),n=ev(lv,p?r:c,m),p?n?(n.input=vv(n.input,v),n[0]=vv(n[0],v),n.index=c.lastIndex,c.lastIndex+=n[0].length):c.lastIndex=0:mv&&n&&(c.lastIndex=c.global?n.index+n[0].length:i),gv&&n&&n.length>1&&ev(dv,n[0],r,(function(){for(o=1;o<arguments.length-2;o++)void 0===arguments[o]&&(n[o]=void 0)})),n&&h)for(n.groups=a=av(null),o=0;o<h.length;o++)a[(s=h[o])[0]]=n[s[1]];return n});var Sv=hv;Xi({target:"RegExp",proto:!0,forced:/./.exec!==Sv},{exec:Sv});var Ev=A,bv=Yt.exports,Iv=Sv,Tv=s,Av=et,Rv=qt,Cv=Av("species"),Ov=RegExp.prototype,wv=function(e,t,r,i){var n=Av(e),o=!Tv((function(){var t={};return t[n]=function(){return 7},7!=""[e](t)})),a=o&&!Tv((function(){var t=!1,r=/a/;return"split"===e&&((r={}).constructor={},r.constructor[Cv]=function(){return r},r.flags="",r[n]=/./[n]),r.exec=function(){return t=!0,null},r[n](""),!t}));if(!o||!a||r){var s=Ev(/./[n]),c=t(n,""[e],(function(e,t,r,i,n){var a=Ev(e),c=t.exec;return c===Iv||c===Ov.exec?o&&!n?{done:!0,value:s(t,r,i)}:{done:!0,value:a(r,t,i)}:{done:!1}}));bv(String.prototype,e,c[0]),bv(Ov,n,c[1])}i&&Rv(Ov[n],"sham",!0)},kv=Object.is||function(e,t){return e===t?0!==e||1/e==1/t:e!=e&&t!=t},Nv=h,Pv=Mt,Dv=j,Mv=w,Lv=Sv,Uv=o.TypeError,xv=function(e,t){var r=e.exec;if(Dv(r)){var i=Nv(r,e,t);return null!==i&&Pv(i),i}if("RegExp"===Mv(e))return Nv(Lv,e,t);throw Uv("RegExp#exec called on incompatible receiver")},Vv=h,Fv=Mt,Bv=x,jv=kv,Gv=_o,Hv=Se,zv=xv;wv("search",(function(e,t,r){return[function(t){var r=Bv(this),i=null==t?void 0:Hv(t,e);return i?Vv(i,t,r):new RegExp(t)[e](Gv(r))},function(e){var i=Fv(this),n=Gv(e),o=r(t,i,n);if(o.done)return o.value;var a=i.lastIndex;jv(a,0)||(i.lastIndex=0);var s=zv(i,n);return jv(i.lastIndex,a)||(i.lastIndex=a),null===s?-1:s.index}]}));var Kv=Xi,Wv=A,Xv=o.Date,qv=Wv(Xv.prototype.getTime);Kv({target:"Date",stat:!0},{now:function(){return qv(new Xv)}});var Yv=A,Jv=Yt.exports,Qv=Date.prototype,Zv="Invalid Date",$v="toString",em=Yv(Qv.toString),tm=Yv(Qv.getTime);function rm(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}String(new Date(NaN))!=Zv&&Jv(Qv,$v,(function(){var e=tm(this);return e==e?em(this):Zv}));var im=Sp.charAt,nm=function(e,t,r){return t+(r?im(e,t).length:1)},om=h,am=Mt,sm=ri,cm=_o,um=x,dm=Se,lm=nm,hm=xv;wv("match",(function(e,t,r){return[function(t){var r=um(this),i=null==t?void 0:dm(t,e);return i?om(i,t,r):new RegExp(t)[e](cm(r))},function(e){var i=am(this),n=cm(e),o=r(t,i,n);if(o.done)return o.value;if(!i.global)return hm(i,n);var a=i.unicode;i.lastIndex=0;for(var s,c=[],u=0;null!==(s=hm(i,n));){var d=cm(s[0]);c[u]=d,""===d&&(i.lastIndex=lm(n,sm(i.lastIndex),a)),u++}return 0===u?null:c}]}));var pm="\t\n\v\f\r                 \u2028\u2029\ufeff",fm=x,_m=_o,vm=A("".replace),mm="[\t\n\v\f\r                 \u2028\u2029\ufeff]",ym=RegExp("^"+mm+mm+"*"),gm=RegExp(mm+mm+"*$"),Sm=function(e){return function(t){var r=_m(fm(t));return 1&e&&(r=vm(r,ym,"")),2&e&&(r=vm(r,gm,"")),r}},Em={start:Sm(1),end:Sm(2),trim:Sm(3)},bm=o,Im=s,Tm=A,Am=_o,Rm=Em.trim,Cm=pm,Om=bm.parseInt,wm=bm.Symbol,km=wm&&wm.iterator,Nm=/^[+-]?0x/i,Pm=Tm(Nm.exec),Dm=8!==Om(Cm+"08")||22!==Om(Cm+"0x16")||km&&!Im((function(){Om(Object(km))}))?function(e,t){var r=Rm(Am(e));return Om(r,t>>>0||(Pm(Nm,r)?16:10))}:Om;Xi({global:!0,forced:parseInt!=Dm},{parseInt:Dm});var Mm={exports:{}},Lm=s((function(){if("function"==typeof ArrayBuffer){var e=new ArrayBuffer(8);Object.isExtensible(e)&&Object.defineProperty(e,"a",{value:8})}})),Um=s,xm=H,Vm=w,Fm=Lm,Bm=Object.isExtensible,jm=Um((function(){Bm(1)}))||Fm?function(e){return!!xm(e)&&((!Fm||"ArrayBuffer"!=Vm(e))&&(!Bm||Bm(e)))}:Bm,Gm=!s((function(){return Object.isExtensible(Object.preventExtensions({}))})),Hm=Xi,zm=A,Km=lr,Wm=H,Xm=Ve,qm=Ot.f,Ym=Wr,Jm=vo,Qm=jm,Zm=Gm,$m=!1,ey=He("meta"),ty=0,ry=function(e){qm(e,ey,{value:{objectID:"O"+ty++,weakData:{}}})},iy=Mm.exports={enable:function(){iy.enable=function(){},$m=!0;var e=Ym.f,t=zm([].splice),r={};r[ey]=1,e(r).length&&(Ym.f=function(r){for(var i=e(r),n=0,o=i.length;n<o;n++)if(i[n]===ey){t(i,n,1);break}return i},Hm({target:"Object",stat:!0,forced:!0},{getOwnPropertyNames:Jm.f}))},fastKey:function(e,t){if(!Wm(e))return"symbol"==typeof e?e:("string"==typeof e?"S":"P")+e;if(!Xm(e,ey)){if(!Qm(e))return"F";if(!t)return"E";ry(e)}return e[ey].objectID},getWeakData:function(e,t){if(!Xm(e,ey)){if(!Qm(e))return!0;if(!t)return!1;ry(e)}return e[ey].weakData},onFreeze:function(e){return Zm&&$m&&Qm(e)&&!Xm(e,ey)&&ry(e),e}};Km[ey]=!0;var ny=j,oy=H,ay=tn,sy=function(e,t,r){var i,n;return ay&&ny(i=t.constructor)&&i!==r&&oy(n=i.prototype)&&n!==r.prototype&&ay(e,n),e},cy=Xi,uy=o,dy=A,ly=Fi,hy=Yt.exports,py=Mm.exports,fy=Xc,_y=hc,vy=j,my=H,yy=s,gy=ru,Sy=Ho,Ey=sy,by=function(e,t,r){var i=-1!==e.indexOf("Map"),n=-1!==e.indexOf("Weak"),o=i?"set":"add",a=uy[e],s=a&&a.prototype,c=a,u={},d=function(e){var t=dy(s[e]);hy(s,e,"add"==e?function(e){return t(this,0===e?0:e),this}:"delete"==e?function(e){return!(n&&!my(e))&&t(this,0===e?0:e)}:"get"==e?function(e){return n&&!my(e)?void 0:t(this,0===e?0:e)}:"has"==e?function(e){return!(n&&!my(e))&&t(this,0===e?0:e)}:function(e,r){return t(this,0===e?0:e,r),this})};if(ly(e,!vy(a)||!(n||s.forEach&&!yy((function(){(new a).entries().next()})))))c=r.getConstructor(t,e,i,o),py.enable();else if(ly(e,!0)){var l=new c,h=l[o](n?{}:-0,1)!=l,p=yy((function(){l.has(1)})),f=gy((function(e){new a(e)})),_=!n&&yy((function(){for(var e=new a,t=5;t--;)e[o](t,t);return!e.has(-0)}));f||((c=t((function(e,t){_y(e,s);var r=Ey(new a,e,c);return null!=t&&fy(t,r[o],{that:r,AS_ENTRIES:i}),r}))).prototype=s,s.constructor=c),(p||_)&&(d("delete"),d("has"),i&&d("get")),(_||h)&&d(o),n&&s.clear&&delete s.clear}return u[e]=c,cy({global:!0,forced:c!=a},u),Sy(c,e),n||r.setStrong(c,e,i),c},Iy=Ot.f,Ty=Rn,Ay=nc,Ry=Xo,Cy=hc,Oy=Xc,wy=$h,ky=uc,Ny=c,Py=Mm.exports.fastKey,Dy=wr.set,My=wr.getterFor,Ly={getConstructor:function(e,t,r,i){var n=e((function(e,n){Cy(e,o),Dy(e,{type:t,index:Ty(null),first:void 0,last:void 0,size:0}),Ny||(e.size=0),null!=n&&Oy(n,e[i],{that:e,AS_ENTRIES:r})})),o=n.prototype,a=My(t),s=function(e,t,r){var i,n,o=a(e),s=c(e,t);return s?s.value=r:(o.last=s={index:n=Py(t,!0),key:t,value:r,previous:i=o.last,next:void 0,removed:!1},o.first||(o.first=s),i&&(i.next=s),Ny?o.size++:e.size++,"F"!==n&&(o.index[n]=s)),e},c=function(e,t){var r,i=a(e),n=Py(t);if("F"!==n)return i.index[n];for(r=i.first;r;r=r.next)if(r.key==t)return r};return Ay(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,Ny?e.size=0:this.size=0},delete:function(e){var t=this,r=a(t),i=c(t,e);if(i){var n=i.next,o=i.previous;delete r.index[i.index],i.removed=!0,o&&(o.next=n),n&&(n.previous=o),r.first==i&&(r.first=n),r.last==i&&(r.last=o),Ny?r.size--:t.size--}return!!i},forEach:function(e){for(var t,r=a(this),i=Ry(e,arguments.length>1?arguments[1]:void 0);t=t?t.next:r.first;)for(i(t.value,t.key,this);t&&t.removed;)t=t.previous},has:function(e){return!!c(this,e)}}),Ay(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)}}),Ny&&Iy(o,"size",{get:function(){return a(this).size}}),n},setStrong:function(e,t,r){var i=t+" Iterator",n=My(t),o=My(i);wy(e,t,(function(e,t){Dy(this,{type:i,target:e,state:n(e),kind:t,last:void 0})}),(function(){for(var e=o(this),t=e.kind,r=e.last;r&&r.removed;)r=r.previous;return e.target&&(e.last=r=r?r.next:e.state.first)?"keys"==t?{value:r.key,done:!1}:"values"==t?{value:r.value,done:!1}:{value:[r.key,r.value],done:!1}:(e.target=void 0,{value:void 0,done:!0})}),r?"entries":"values",!r,!0),ky(t)}};by("Map",(function(e){return function(){return e(this,arguments.length?arguments[0]:void 0)}}),Ly);var Uy=Le,xy=an;Xi({target:"Object",stat:!0,forced:s((function(){xy(1)}))},{keys:function(e){return xy(Uy(e))}});var Vy=ye,Fy=Le,By=L,jy=ni,Gy=o.TypeError,Hy=function(e){return function(t,r,i,n){Vy(r);var o=Fy(t),a=By(o),s=jy(o),c=e?s-1:0,u=e?-1:1;if(i<2)for(;;){if(c in a){n=a[c],c+=u;break}if(c+=u,e?c<0:s<=c)throw Gy("Reduce of empty array with no initial value")}for(;e?c>=0:s>c;c+=u)c in a&&(n=r(n,a[c],c,o));return n}},zy={left:Hy(!1),right:Hy(!0)},Ky=zy.left,Wy=re,Xy=fu;Xi({target:"Array",proto:!0,forced:!Gn("reduce")||!Xy&&Wy>79&&Wy<83},{reduce:function(e){var t=arguments.length;return Ky(this,e,t,t>1?arguments[1]:void 0)}});var qy,Yy=Xi,Jy=A,Qy=a.f,Zy=ri,$y=_o,eg=P_,tg=x,rg=M_,ig=Jy("".endsWith),ng=Jy("".slice),og=Math.min,ag=rg("endsWith");Yy({target:"String",proto:!0,forced:!!(ag||(qy=Qy(String.prototype,"endsWith"),!qy||qy.writable))&&!ag},{endsWith:function(e){var t=$y(tg(this));eg(e);var r=arguments.length>1?arguments[1]:void 0,i=t.length,n=void 0===r?i:og(Zy(r),i),o=$y(e);return ig?ig(t,o,n):ng(t,n-o.length,n)===o}});var sg=!0,cg=!0;function ug(e,t,r){var i=e.match(t);return i&&i.length>=r&&parseInt(i[r],10)}function dg(e,t,r){if(e.RTCPeerConnection){var i=e.RTCPeerConnection.prototype,n=i.addEventListener;i.addEventListener=function(e,i){if(e!==t)return n.apply(this,arguments);var o=function(e){var t=r(e);t&&(i.handleEvent?i.handleEvent(t):i(t))};return this._eventMap=this._eventMap||{},this._eventMap[t]||(this._eventMap[t]=new Map),this._eventMap[t].set(i,o),n.apply(this,[e,o])};var o=i.removeEventListener;i.removeEventListener=function(e,r){if(e!==t||!this._eventMap||!this._eventMap[t])return o.apply(this,arguments);if(!this._eventMap[t].has(r))return o.apply(this,arguments);var i=this._eventMap[t].get(r);return this._eventMap[t].delete(r),0===this._eventMap[t].size&&delete this._eventMap[t],0===Object.keys(this._eventMap).length&&delete this._eventMap,o.apply(this,[e,i])},Object.defineProperty(i,"on"+t,{get:function(){return this["_on"+t]},set:function(e){this["_on"+t]&&(this.removeEventListener(t,this["_on"+t]),delete this["_on"+t]),e&&this.addEventListener(t,this["_on"+t]=e)},enumerable:!0,configurable:!0})}}function lg(e){return"boolean"!=typeof e?new Error("Argument type: "+t(e)+". Please use a boolean."):(sg=e,e?"adapter.js logging disabled":"adapter.js logging enabled")}function hg(e){return"boolean"!=typeof e?new Error("Argument type: "+t(e)+". Please use a boolean."):(cg=!e,"adapter.js deprecation warnings "+(e?"disabled":"enabled"))}function pg(){if("object"===("undefined"==typeof window?"undefined":t(window))){if(sg)return;"undefined"!=typeof console&&"function"==typeof console.log&&console.log.apply(console,arguments)}}function fg(e,t){cg&&console.warn(e+" is deprecated, please use "+t+" instead.")}function _g(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=ug(r.userAgent,/Firefox\/(\d+)\./,1);else if(r.webkitGetUserMedia||!1===e.isSecureContext&&e.webkitRTCPeerConnection&&!e.RTCIceGatherer)t.browser="chrome",t.version=ug(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=ug(r.userAgent,/AppleWebKit\/(\d+)\./,1),t.supportsUnifiedPlan=e.RTCRtpTransceiver&&"currentDirection"in e.RTCRtpTransceiver.prototype}return t}function vg(e){return"[object Object]"===Object.prototype.toString.call(e)}function mg(e){return vg(e)?Object.keys(e).reduce((function(t,r){var i=vg(e[r]),n=i?mg(e[r]):e[r],o=i&&!Object.keys(n).length;return void 0===n||o?t:Object.assign(t,rm({},r,n))}),{}):e}function yg(e,t,r){t&&!r.has(t.id)&&(r.set(t.id,t),Object.keys(t).forEach((function(i){i.endsWith("Id")?yg(e,e.get(t[i]),r):i.endsWith("Ids")&&t[i].forEach((function(t){yg(e,e.get(t),r)}))})))}function gg(e,t,r){var i=r?"outbound-rtp":"inbound-rtp",n=new Map;if(null===t)return n;var o=[];return e.forEach((function(e){"track"===e.type&&e.trackIdentifier===t.id&&o.push(e)})),o.forEach((function(t){e.forEach((function(r){r.type===i&&r.trackId===t.id&&yg(e,r,n)}))})),n}var Sg=Xi,Eg=Ia.find,bg=sh,Ig="find",Tg=!0;Ig in[]&&Array(1).find((function(){Tg=!1})),Sg({target:"Array",proto:!0,forced:Tg},{find:function(e){return Eg(this,e,arguments.length>1?arguments[1]:void 0)}}),bg(Ig);var Ag=Xi,Rg=o,Cg=$r,Og=Yr,wg=ni,kg=Le,Ng=_a,Pg=So,Dg=Wp("splice"),Mg=Rg.TypeError,Lg=Math.max,Ug=Math.min,xg=9007199254740991,Vg="Maximum allowed length exceeded";Ag({target:"Array",proto:!0,forced:!Dg},{splice:function(e,t){var r,i,n,o,a,s,c=kg(this),u=wg(c),d=Cg(e,u),l=arguments.length;if(0===l?r=i=0:1===l?(r=0,i=u-d):(r=l-2,i=Ug(Lg(Og(t),0),u-d)),u+r-i>xg)throw Mg(Vg);for(n=Ng(c,i),o=0;o<i;o++)(a=d+o)in c&&Pg(n,o,c[a]);if(n.length=i,r<i){for(o=d;o<u-i;o++)s=o+r,(a=o+i)in c?c[s]=c[a]:delete c[s];for(o=u;o>u-i+r;o--)delete c[o-1]}else if(r>i)for(o=u-i;o>d;o--)s=o+r-1,(a=o+i-1)in c?c[s]=c[a]:delete c[s];for(o=0;o<r;o++)c[o+d]=arguments[o+2];return c.length=u-i+r,n}});var Fg=Ia.map;Xi({target:"Array",proto:!0,forced:!Wp("map")},{map:function(e){return Fg(this,e,arguments.length>1?arguments[1]:void 0)}});var Bg=Ia.filter;Xi({target:"Array",proto:!0,forced:!Wp("filter")},{filter:function(e){return Bg(this,e,arguments.length>1?arguments[1]:void 0)}});var jg=A,Gg=Le,Hg=Math.floor,zg=jg("".charAt),Kg=jg("".replace),Wg=jg("".slice),Xg=/\$([$&'`]|\d{1,2}|<[^>]*>)/g,qg=/\$([$&'`]|\d{1,2})/g,Yg=function(e,t,r,i,n,o){var a=r+e.length,s=i.length,c=qg;return void 0!==n&&(n=Gg(n),c=Xg),Kg(o,c,(function(o,c){var u;switch(zg(c,0)){case"$":return"$";case"&":return e;case"`":return Wg(t,0,r);case"'":return Wg(t,a);case"<":u=n[Wg(c,1,-1)];break;default:var d=+c;if(0===d)return o;if(d>s){var l=Hg(d/10);return 0===l?o:l<=s?void 0===i[l-1]?zg(c,1):i[l-1]+zg(c,1):o}u=i[d-1]}return void 0===u?"":u}))},Jg=$n,Qg=h,Zg=A,$g=wv,eS=s,tS=Mt,rS=j,iS=Yr,nS=ri,oS=_o,aS=x,sS=nm,cS=Se,uS=Yg,dS=xv,lS=et("replace"),hS=Math.max,pS=Math.min,fS=Zg([].concat),_S=Zg([].push),vS=Zg("".indexOf),mS=Zg("".slice),yS="$0"==="a".replace(/./,"$0"),gS=!!/./[lS]&&""===/./[lS]("a","$0");$g("replace",(function(e,t,r){var i=gS?"$":"$0";return[function(e,r){var i=aS(this),n=null==e?void 0:cS(e,lS);return n?Qg(n,e,i,r):Qg(t,oS(i),e,r)},function(e,n){var o=tS(this),a=oS(e);if("string"==typeof n&&-1===vS(n,i)&&-1===vS(n,"$<")){var s=r(t,o,a,n);if(s.done)return s.value}var c=rS(n);c||(n=oS(n));var u=o.global;if(u){var d=o.unicode;o.lastIndex=0}for(var l=[];;){var h=dS(o,a);if(null===h)break;if(_S(l,h),!u)break;""===oS(h[0])&&(o.lastIndex=sS(a,nS(o.lastIndex),d))}for(var p,f="",_=0,v=0;v<l.length;v++){for(var m=oS((h=l[v])[0]),y=hS(pS(iS(h.index),a.length),0),g=[],S=1;S<h.length;S++)_S(g,void 0===(p=h[S])?p:String(p));var E=h.groups;if(c){var b=fS([m],g,y,a);void 0!==E&&_S(b,E);var I=oS(Jg(n,void 0,b))}else I=uS(m,a,y,g,E,n);y>=_&&(f+=mS(a,_,y)+I,_=y+m.length)}return f+mS(a,_)}]}),!!eS((function(){var e=/./;return e.exec=function(){var e=[];return e.groups={a:"7"},e},"7"!=="".replace(e,"$<a>")}))||!yS||gS);var SS=c,ES=o,bS=A,IS=Fi,TS=sy,AS=qt,RS=Ot.f,CS=Wr.f,OS=q,wS=w_,kS=_o,NS=G_,PS=X_,DS=Yt.exports,MS=s,LS=Ve,US=wr.enforce,xS=uc,VS=J_,FS=$_,BS=et("match"),jS=ES.RegExp,GS=jS.prototype,HS=ES.SyntaxError,zS=bS(NS),KS=bS(GS.exec),WS=bS("".charAt),XS=bS("".replace),qS=bS("".indexOf),YS=bS("".slice),JS=/^\?<[^\s\d!#%&*+<=>@^][^\s!#%&*+<=>@^]*>/,QS=/a/g,ZS=/a/g,$S=new jS(QS)!==QS,eE=PS.MISSED_STICKY,tE=PS.UNSUPPORTED_Y,rE=SS&&(!$S||eE||VS||FS||MS((function(){return ZS[BS]=!1,jS(QS)!=QS||jS(ZS)==ZS||"/a/i"!=jS(QS,"i")})));if(IS("RegExp",rE)){for(var iE=function(e,t){var r,i,n,o,a,s,c=OS(GS,this),u=wS(e),d=void 0===t,l=[],h=e;if(!c&&u&&d&&e.constructor===iE)return e;if((u||OS(GS,e))&&(e=e.source,d&&(t="flags"in h?h.flags:zS(h))),e=void 0===e?"":kS(e),t=void 0===t?"":kS(t),h=e,VS&&"dotAll"in QS&&(i=!!t&&qS(t,"s")>-1)&&(t=XS(t,/s/g,"")),r=t,eE&&"sticky"in QS&&(n=!!t&&qS(t,"y")>-1)&&tE&&(t=XS(t,/y/g,"")),FS&&(o=function(e){for(var t,r=e.length,i=0,n="",o=[],a={},s=!1,c=!1,u=0,d="";i<=r;i++){if("\\"===(t=WS(e,i)))t+=WS(e,++i);else if("]"===t)s=!1;else if(!s)switch(!0){case"["===t:s=!0;break;case"("===t:KS(JS,YS(e,i+1))&&(i+=2,c=!0),n+=t,u++;continue;case">"===t&&c:if(""===d||LS(a,d))throw new HS("Invalid capture group name");a[d]=!0,o[o.length]=[d,u],c=!1,d="";continue}c?d+=t:n+=t}return[n,o]}(e),e=o[0],l=o[1]),a=TS(jS(e,t),c?this:GS,iE),(i||n||l.length)&&(s=US(a),i&&(s.dotAll=!0,s.raw=iE(function(e){for(var t,r=e.length,i=0,n="",o=!1;i<=r;i++)"\\"!==(t=WS(e,i))?o||"."!==t?("["===t?o=!0:"]"===t&&(o=!1),n+=t):n+="[\\s\\S]":n+=t+WS(e,++i);return n}(e),r)),n&&(s.sticky=!0),l.length&&(s.groups=l)),e!==h)try{AS(a,"source",""===h?"(?:)":h)}catch(e){}return a},nE=function(e){e in iE||RS(iE,e,{configurable:!0,get:function(){return jS[e]},set:function(t){jS[e]=t}})},oE=CS(jS),aE=0;oE.length>aE;)nE(oE[aE++]);GS.constructor=iE,iE.prototype=GS,DS(ES,"RegExp",iE)}xS("RegExp");var sE=A,cE=Lr.PROPER,uE=Yt.exports,dE=Mt,lE=q,hE=_o,pE=s,fE=G_,_E="toString",vE=RegExp.prototype,mE=vE.toString,yE=sE(fE),gE=pE((function(){return"/a/b"!=mE.call({source:"a",flags:"b"})})),SE=cE&&mE.name!=_E;(gE||SE)&&uE(RegExp.prototype,_E,(function(){var e=dE(this),t=hE(e.source),r=e.flags;return"/"+t+"/"+hE(void 0===r&&lE(vE,e)&&!("flags"in vE)?yE(e):r)}),{unsafe:!0});var EE=Ia.some;Xi({target:"Array",proto:!0,forced:!Gn("some")},{some:function(e){return EE(this,e,arguments.length>1?arguments[1]:void 0)}});var bE=c,IE=Lr.EXISTS,TE=A,AE=Ot.f,RE=Function.prototype,CE=TE(RE.toString),OE=/function\b(?:\s|\/\*[\S\s]*?\*\/|\/\/[^\n\r]*[\n\r]+)*([^\s(/]*)/,wE=TE(OE.exec);bE&&!IE&&AE(RE,"name",{configurable:!0,get:function(){try{return wE(OE,CE(this))[1]}catch(e){return""}}});var kE=A,NE=ye,PE=H,DE=Ve,ME=Po,LE=u,UE=o.Function,xE=kE([].concat),VE=kE([].join),FE={},BE=function(e,t,r){if(!DE(FE,t)){for(var i=[],n=0;n<t;n++)i[n]="a["+n+"]";FE[t]=UE("C,a","return new C("+VE(i,",")+")")}return FE[t](e,r)},jE=LE?UE.bind:function(e){var t=NE(this),r=t.prototype,i=ME(arguments,1),n=function(){var r=xE(i,ME(arguments));return this instanceof n?BE(t,r.length,r):t.apply(e,r)};return PE(r)&&(n.prototype=r),n},GE=jE;Xi({target:"Function",proto:!0,forced:Function.bind!==GE},{bind:GE});var HE=pg;function zE(e,r){var i=e&&e.navigator;if(i.mediaDevices){var n=function(e){if("object"!==t(e)||e.mandatory||e.optional)return e;var r={};return Object.keys(e).forEach((function(i){if("require"!==i&&"advanced"!==i&&"mediaSource"!==i){var n="object"===t(e[i])?e[i]:{ideal:e[i]};void 0!==n.exact&&"number"==typeof n.exact&&(n.min=n.max=n.exact);var o=function(e,t){return e?e+t.charAt(0).toUpperCase()+t.slice(1):"deviceId"===t?"sourceId":t};if(void 0!==n.ideal){r.optional=r.optional||[];var a={};"number"==typeof n.ideal?(a[o("min",i)]=n.ideal,r.optional.push(a),(a={})[o("max",i)]=n.ideal,r.optional.push(a)):(a[o("",i)]=n.ideal,r.optional.push(a))}void 0!==n.exact&&"number"!=typeof n.exact?(r.mandatory=r.mandatory||{},r.mandatory[o("",i)]=n.exact):["min","max"].forEach((function(e){void 0!==n[e]&&(r.mandatory=r.mandatory||{},r.mandatory[o(e,i)]=n[e])}))}})),e.advanced&&(r.optional=(r.optional||[]).concat(e.advanced)),r},o=function(e,o){if(r.version>=61)return o(e);if((e=JSON.parse(JSON.stringify(e)))&&"object"===t(e.audio)){var a=function(e,t,r){t in e&&!(r in e)&&(e[r]=e[t],delete e[t])};a((e=JSON.parse(JSON.stringify(e))).audio,"autoGainControl","googAutoGainControl"),a(e.audio,"noiseSuppression","googNoiseSuppression"),e.audio=n(e.audio)}if(e&&"object"===t(e.video)){var s=e.video.facingMode;s=s&&("object"===t(s)?s:{ideal:s});var c,u=r.version<66;if(s&&("user"===s.exact||"environment"===s.exact||"user"===s.ideal||"environment"===s.ideal)&&(!i.mediaDevices.getSupportedConstraints||!i.mediaDevices.getSupportedConstraints().facingMode||u))if(delete e.video.facingMode,"environment"===s.exact||"environment"===s.ideal?c=["back","rear"]:"user"!==s.exact&&"user"!==s.ideal||(c=["front"]),c)return i.mediaDevices.enumerateDevices().then((function(t){var r=(t=t.filter((function(e){return"videoinput"===e.kind}))).find((function(e){return c.some((function(t){return e.label.toLowerCase().includes(t)}))}));return!r&&t.length&&c.includes("back")&&(r=t[t.length-1]),r&&(e.video.deviceId=s.exact?{exact:r.deviceId}:{ideal:r.deviceId}),e.video=n(e.video),HE("chrome: "+JSON.stringify(e)),o(e)}));e.video=n(e.video)}return HE("chrome: "+JSON.stringify(e)),o(e)},a=function(e){return r.version>=64?e:{name:{PermissionDeniedError:"NotAllowedError",PermissionDismissedError:"NotAllowedError",InvalidStateError:"NotAllowedError",DevicesNotFoundError:"NotFoundError",ConstraintNotSatisfiedError:"OverconstrainedError",TrackStartError:"NotReadableError",MediaDeviceFailedDueToShutdown:"NotAllowedError",MediaDeviceKillSwitchOn:"NotAllowedError",TabCaptureError:"AbortError",ScreenCaptureError:"AbortError",DeviceCaptureError:"AbortError"}[e.name]||e.name,message:e.message,constraint:e.constraint||e.constraintName,toString:function(){return this.name+(this.message&&": ")+this.message}}};if(i.getUserMedia=function(e,t,r){o(e,(function(e){i.webkitGetUserMedia(e,t,(function(e){r&&r(a(e))}))}))}.bind(i),i.mediaDevices.getUserMedia){var s=i.mediaDevices.getUserMedia.bind(i.mediaDevices);i.mediaDevices.getUserMedia=function(e){return o(e,(function(e){return s(e).then((function(t){if(e.audio&&!t.getAudioTracks().length||e.video&&!t.getVideoTracks().length)throw t.getTracks().forEach((function(e){e.stop()})),new DOMException("","NotFoundError");return t}),(function(e){return Promise.reject(a(e))}))}))}}}}function KE(e){e.MediaStream=e.MediaStream||e.webkitMediaStream}function WE(e){if("object"===t(e)&&e.RTCPeerConnection&&!("ontrack"in e.RTCPeerConnection.prototype)){Object.defineProperty(e.RTCPeerConnection.prototype,"ontrack",{get:function(){return this._ontrack},set:function(e){this._ontrack&&this.removeEventListener("track",this._ontrack),this.addEventListener("track",this._ontrack=e)},enumerable:!0,configurable:!0});var r=e.RTCPeerConnection.prototype.setRemoteDescription;e.RTCPeerConnection.prototype.setRemoteDescription=function(){var t=this;return this._ontrackpoly||(this._ontrackpoly=function(r){r.stream.addEventListener("addtrack",(function(i){var n;n=e.RTCPeerConnection.prototype.getReceivers?t.getReceivers().find((function(e){return e.track&&e.track.id===i.track.id})):{track:i.track};var o=new Event("track");o.track=i.track,o.receiver=n,o.transceiver={receiver:n},o.streams=[r.stream],t.dispatchEvent(o)})),r.stream.getTracks().forEach((function(i){var n;n=e.RTCPeerConnection.prototype.getReceivers?t.getReceivers().find((function(e){return e.track&&e.track.id===i.id})):{track:i};var o=new Event("track");o.track=i,o.receiver=n,o.transceiver={receiver:n},o.streams=[r.stream],t.dispatchEvent(o)}))},this.addEventListener("addstream",this._ontrackpoly)),r.apply(this,arguments)}}else dg(e,"track",(function(e){return e.transceiver||Object.defineProperty(e,"transceiver",{value:{receiver:e.receiver}}),e}))}function XE(e){if("object"===t(e)&&e.RTCPeerConnection&&!("getSenders"in e.RTCPeerConnection.prototype)&&"createDTMFSender"in e.RTCPeerConnection.prototype){var r=function(e,t){return{track:t,get dtmf(){return void 0===this._dtmf&&("audio"===t.kind?this._dtmf=e.createDTMFSender(t):this._dtmf=null),this._dtmf},_pc:e}};if(!e.RTCPeerConnection.prototype.getSenders){e.RTCPeerConnection.prototype.getSenders=function(){return this._senders=this._senders||[],this._senders.slice()};var i=e.RTCPeerConnection.prototype.addTrack;e.RTCPeerConnection.prototype.addTrack=function(e,t){var n=i.apply(this,arguments);return n||(n=r(this,e),this._senders.push(n)),n};var n=e.RTCPeerConnection.prototype.removeTrack;e.RTCPeerConnection.prototype.removeTrack=function(e){n.apply(this,arguments);var t=this._senders.indexOf(e);-1!==t&&this._senders.splice(t,1)}}var o=e.RTCPeerConnection.prototype.addStream;e.RTCPeerConnection.prototype.addStream=function(e){var t=this;this._senders=this._senders||[],o.apply(this,[e]),e.getTracks().forEach((function(e){t._senders.push(r(t,e))}))};var a=e.RTCPeerConnection.prototype.removeStream;e.RTCPeerConnection.prototype.removeStream=function(e){var t=this;this._senders=this._senders||[],a.apply(this,[e]),e.getTracks().forEach((function(e){var r=t._senders.find((function(t){return t.track===e}));r&&t._senders.splice(t._senders.indexOf(r),1)}))}}else if("object"===t(e)&&e.RTCPeerConnection&&"getSenders"in e.RTCPeerConnection.prototype&&"createDTMFSender"in e.RTCPeerConnection.prototype&&e.RTCRtpSender&&!("dtmf"in e.RTCRtpSender.prototype)){var s=e.RTCPeerConnection.prototype.getSenders;e.RTCPeerConnection.prototype.getSenders=function(){var e=this,t=s.apply(this,[]);return t.forEach((function(t){return t._pc=e})),t},Object.defineProperty(e.RTCRtpSender.prototype,"dtmf",{get:function(){return void 0===this._dtmf&&("audio"===this.track.kind?this._dtmf=this._pc.createDTMFSender(this.track):this._dtmf=null),this._dtmf}})}}function qE(e){if(e.RTCPeerConnection){var t=e.RTCPeerConnection.prototype.getStats;e.RTCPeerConnection.prototype.getStats=function(){var e=this,r=Array.prototype.slice.call(arguments),i=r[0],n=r[1],o=r[2];if(arguments.length>0&&"function"==typeof i)return t.apply(this,arguments);if(0===t.length&&(0===arguments.length||"function"!=typeof i))return t.apply(this,[]);var a=function(e){var t={};return e.result().forEach((function(e){var r={id:e.id,timestamp:e.timestamp,type:{localcandidate:"local-candidate",remotecandidate:"remote-candidate"}[e.type]||e.type};e.names().forEach((function(t){r[t]=e.stat(t)})),t[r.id]=r})),t},s=function(e){return new Map(Object.keys(e).map((function(t){return[t,e[t]]})))};if(arguments.length>=2){var c=function(e){n(s(a(e)))};return t.apply(this,[c,i])}return new Promise((function(r,i){t.apply(e,[function(e){r(s(a(e)))},i])})).then(n,o)}}}function YE(e){if("object"===t(e)&&e.RTCPeerConnection&&e.RTCRtpSender&&e.RTCRtpReceiver){if(!("getStats"in e.RTCRtpSender.prototype)){var r=e.RTCPeerConnection.prototype.getSenders;r&&(e.RTCPeerConnection.prototype.getSenders=function(){var e=this,t=r.apply(this,[]);return t.forEach((function(t){return t._pc=e})),t});var i=e.RTCPeerConnection.prototype.addTrack;i&&(e.RTCPeerConnection.prototype.addTrack=function(){var e=i.apply(this,arguments);return e._pc=this,e}),e.RTCRtpSender.prototype.getStats=function(){var e=this;return this._pc.getStats().then((function(t){return gg(t,e.track,!0)}))}}if(!("getStats"in e.RTCRtpReceiver.prototype)){var n=e.RTCPeerConnection.prototype.getReceivers;n&&(e.RTCPeerConnection.prototype.getReceivers=function(){var e=this,t=n.apply(this,[]);return t.forEach((function(t){return t._pc=e})),t}),dg(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 gg(t,e.track,!1)}))}}if("getStats"in e.RTCRtpSender.prototype&&"getStats"in e.RTCRtpReceiver.prototype){var o=e.RTCPeerConnection.prototype.getStats;e.RTCPeerConnection.prototype.getStats=function(){if(arguments.length>0&&arguments[0]instanceof e.MediaStreamTrack){var t,r,i,n=arguments[0];return this.getSenders().forEach((function(e){e.track===n&&(t?i=!0:t=e)})),this.getReceivers().forEach((function(e){return e.track===n&&(r?i=!0:r=e),e.track===n})),i||t&&r?Promise.reject(new DOMException("There are more than one sender or receiver for the track.","InvalidAccessError")):t?t.getStats():r?r.getStats():Promise.reject(new DOMException("There is no sender or receiver for the track.","InvalidAccessError"))}return o.apply(this,arguments)}}}}function JE(e){e.RTCPeerConnection.prototype.getLocalStreams=function(){var e=this;return this._shimmedLocalStreams=this._shimmedLocalStreams||{},Object.keys(this._shimmedLocalStreams).map((function(t){return e._shimmedLocalStreams[t][0]}))};var t=e.RTCPeerConnection.prototype.addTrack;e.RTCPeerConnection.prototype.addTrack=function(e,r){if(!r)return t.apply(this,arguments);this._shimmedLocalStreams=this._shimmedLocalStreams||{};var i=t.apply(this,arguments);return this._shimmedLocalStreams[r.id]?-1===this._shimmedLocalStreams[r.id].indexOf(i)&&this._shimmedLocalStreams[r.id].push(i):this._shimmedLocalStreams[r.id]=[r,i],i};var r=e.RTCPeerConnection.prototype.addStream;e.RTCPeerConnection.prototype.addStream=function(e){var t=this;this._shimmedLocalStreams=this._shimmedLocalStreams||{},e.getTracks().forEach((function(e){if(t.getSenders().find((function(t){return t.track===e})))throw new DOMException("Track already exists.","InvalidAccessError")}));var i=this.getSenders();r.apply(this,arguments);var n=this.getSenders().filter((function(e){return-1===i.indexOf(e)}));this._shimmedLocalStreams[e.id]=[e].concat(n)};var i=e.RTCPeerConnection.prototype.removeStream;e.RTCPeerConnection.prototype.removeStream=function(e){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},delete this._shimmedLocalStreams[e.id],i.apply(this,arguments)};var n=e.RTCPeerConnection.prototype.removeTrack;e.RTCPeerConnection.prototype.removeTrack=function(e){var t=this;return this._shimmedLocalStreams=this._shimmedLocalStreams||{},e&&Object.keys(this._shimmedLocalStreams).forEach((function(r){var i=t._shimmedLocalStreams[r].indexOf(e);-1!==i&&t._shimmedLocalStreams[r].splice(i,1),1===t._shimmedLocalStreams[r].length&&delete t._shimmedLocalStreams[r]})),n.apply(this,arguments)}}function QE(e,t){if(e.RTCPeerConnection){if(e.RTCPeerConnection.prototype.addTrack&&t.version>=65)return JE(e);var r=e.RTCPeerConnection.prototype.getLocalStreams;e.RTCPeerConnection.prototype.getLocalStreams=function(){var e=this,t=r.apply(this);return this._reverseStreams=this._reverseStreams||{},t.map((function(t){return e._reverseStreams[t.id]}))};var i=e.RTCPeerConnection.prototype.addStream;e.RTCPeerConnection.prototype.addStream=function(t){var r=this;if(this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{},t.getTracks().forEach((function(e){if(r.getSenders().find((function(t){return t.track===e})))throw new DOMException("Track already exists.","InvalidAccessError")})),!this._reverseStreams[t.id]){var n=new e.MediaStream(t.getTracks());this._streams[t.id]=n,this._reverseStreams[n.id]=t,t=n}i.apply(this,[t])};var n=e.RTCPeerConnection.prototype.removeStream;e.RTCPeerConnection.prototype.removeStream=function(e){this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{},n.apply(this,[this._streams[e.id]||e]),delete this._reverseStreams[this._streams[e.id]?this._streams[e.id].id:e.id],delete this._streams[e.id]},e.RTCPeerConnection.prototype.addTrack=function(t,r){var i=this;if("closed"===this.signalingState)throw new DOMException("The RTCPeerConnection's signalingState is 'closed'.","InvalidStateError");var n=[].slice.call(arguments,1);if(1!==n.length||!n[0].getTracks().find((function(e){return e===t})))throw new DOMException("The adapter.js addTrack polyfill only supports a single stream which is associated with the specified track.","NotSupportedError");var o=this.getSenders().find((function(e){return e.track===t}));if(o)throw new DOMException("Track already exists.","InvalidAccessError");this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{};var a=this._streams[r.id];if(a)a.addTrack(t),Promise.resolve().then((function(){i.dispatchEvent(new Event("negotiationneeded"))}));else{var s=new e.MediaStream([t]);this._streams[r.id]=s,this._reverseStreams[s.id]=r,this.addStream(s)}return this.getSenders().find((function(e){return e.track===t}))},["createOffer","createAnswer"].forEach((function(t){var r=e.RTCPeerConnection.prototype[t],i=rm({},t,(function(){var e=this,t=arguments,i=arguments.length&&"function"==typeof arguments[0];return i?r.apply(this,[function(r){var i=s(e,r);t[0].apply(null,[i])},function(e){t[1]&&t[1].apply(null,e)},arguments[2]]):r.apply(this,arguments).then((function(t){return s(e,t)}))}));e.RTCPeerConnection.prototype[t]=i[t]}));var o=e.RTCPeerConnection.prototype.setLocalDescription;e.RTCPeerConnection.prototype.setLocalDescription=function(){return arguments.length&&arguments[0].type?(arguments[0]=c(this,arguments[0]),o.apply(this,arguments)):o.apply(this,arguments)};var a=Object.getOwnPropertyDescriptor(e.RTCPeerConnection.prototype,"localDescription");Object.defineProperty(e.RTCPeerConnection.prototype,"localDescription",{get:function(){var e=a.get.apply(this);return""===e.type?e:s(this,e)}}),e.RTCPeerConnection.prototype.removeTrack=function(e){var t,r=this;if("closed"===this.signalingState)throw new DOMException("The RTCPeerConnection's signalingState is 'closed'.","InvalidStateError");if(!e._pc)throw new DOMException("Argument 1 of RTCPeerConnection.removeTrack does not implement interface RTCRtpSender.","TypeError");if(!(e._pc===this))throw new DOMException("Sender was not created by this connection.","InvalidAccessError");this._streams=this._streams||{},Object.keys(this._streams).forEach((function(i){r._streams[i].getTracks().find((function(t){return e.track===t}))&&(t=r._streams[i])})),t&&(1===t.getTracks().length?this.removeStream(this._reverseStreams[t.id]):t.removeTrack(e.track),this.dispatchEvent(new Event("negotiationneeded")))}}function s(e,t){var r=t.sdp;return Object.keys(e._reverseStreams||[]).forEach((function(t){var i=e._reverseStreams[t],n=e._streams[i.id];r=r.replace(new RegExp(n.id,"g"),i.id)})),new RTCSessionDescription({type:t.type,sdp:r})}function c(e,t){var r=t.sdp;return Object.keys(e._reverseStreams||[]).forEach((function(t){var i=e._reverseStreams[t],n=e._streams[i.id];r=r.replace(new RegExp(i.id,"g"),n.id)})),new RTCSessionDescription({type:t.type,sdp:r})}}function ZE(e,t){!e.RTCPeerConnection&&e.webkitRTCPeerConnection&&(e.RTCPeerConnection=e.webkitRTCPeerConnection),e.RTCPeerConnection&&t.version<53&&["setLocalDescription","setRemoteDescription","addIceCandidate"].forEach((function(t){var r=e.RTCPeerConnection.prototype[t],i=rm({},t,(function(){return arguments[0]=new("addIceCandidate"===t?e.RTCIceCandidate:e.RTCSessionDescription)(arguments[0]),r.apply(this,arguments)}));e.RTCPeerConnection.prototype[t]=i[t]}))}function $E(e,t){dg(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 eb=Object.freeze({__proto__:null,shimMediaStream:KE,shimOnTrack:WE,shimGetSendersWithDtmf:XE,shimGetStats:qE,shimSenderReceiverGetStats:YE,shimAddTrackRemoveTrackWithNative:JE,shimAddTrackRemoveTrack:QE,shimPeerConnection:ZE,fixNegotiationNeeded:$E,shimGetUserMedia:zE,shimGetDisplayMedia:function(e,t){e.navigator.mediaDevices&&"getDisplayMedia"in e.navigator.mediaDevices||e.navigator.mediaDevices&&("function"==typeof t?e.navigator.mediaDevices.getDisplayMedia=function(r){return t(r).then((function(t){var i=r.video&&r.video.width,n=r.video&&r.video.height,o=r.video&&r.video.frameRate;return r.video={mandatory:{chromeMediaSource:"desktop",chromeMediaSourceId:t,maxFrameRate:o||3}},i&&(r.video.mandatory.maxWidth=i),n&&(r.video.mandatory.maxHeight=n),e.navigator.mediaDevices.getUserMedia(r)}))}:console.error("shimGetDisplayMedia: getSourceId argument is not a function"))}}),tb=o,rb=s,ib=_o,nb=Em.trim,ob=A("".charAt),ab=tb.parseFloat,sb=tb.Symbol,cb=sb&&sb.iterator,ub=1/ab("\t\n\v\f\r                 \u2028\u2029\ufeff-0")!=-1/0||cb&&!rb((function(){ab(Object(cb))}))?function(e){var t=nb(ib(e)),r=ab(t);return 0===r&&"-"==ob(t,0)?-0:r}:ab;Xi({global:!0,forced:parseFloat!=ub},{parseFloat:ub});var db=Xi,lb=rc,hb=s,pb=X,fb=j,_b=du,vb=Sd,mb=Yt.exports;if(db({target:"Promise",proto:!0,real:!0,forced:!!lb&&hb((function(){lb.prototype.finally.call({then:function(){}},(function(){}))}))},{finally:function(e){var t=_b(this,pb("Promise")),r=fb(e);return this.then(r?function(r){return vb(t,e()).then((function(){return r}))}:e,r?function(r){return vb(t,e()).then((function(){throw r}))}:e)}}),fb(lb)){var yb=pb("Promise").prototype.finally;lb.prototype.finally!==yb&&mb(lb.prototype,"finally",yb,{unsafe:!0})}function gb(e,r){var i=e&&e.navigator,n=e&&e.MediaStreamTrack;if(i.getUserMedia=function(e,t,r){fg("navigator.getUserMedia","navigator.mediaDevices.getUserMedia"),i.mediaDevices.getUserMedia(e).then(t,r)},!(r.version>55&&"autoGainControl"in i.mediaDevices.getSupportedConstraints())){var o=function(e,t,r){t in e&&!(r in e)&&(e[r]=e[t],delete e[t])},a=i.mediaDevices.getUserMedia.bind(i.mediaDevices);if(i.mediaDevices.getUserMedia=function(e){return"object"===t(e)&&"object"===t(e.audio)&&(e=JSON.parse(JSON.stringify(e)),o(e.audio,"autoGainControl","mozAutoGainControl"),o(e.audio,"noiseSuppression","mozNoiseSuppression")),a(e)},n&&n.prototype.getSettings){var s=n.prototype.getSettings;n.prototype.getSettings=function(){var e=s.apply(this,arguments);return o(e,"mozAutoGainControl","autoGainControl"),o(e,"mozNoiseSuppression","noiseSuppression"),e}}if(n&&n.prototype.applyConstraints){var c=n.prototype.applyConstraints;n.prototype.applyConstraints=function(e){return"audio"===this.kind&&"object"===t(e)&&(e=JSON.parse(JSON.stringify(e)),o(e,"autoGainControl","mozAutoGainControl"),o(e,"noiseSuppression","mozNoiseSuppression")),c.apply(this,[e])}}}}function Sb(e){"object"===t(e)&&e.RTCTrackEvent&&"receiver"in e.RTCTrackEvent.prototype&&!("transceiver"in e.RTCTrackEvent.prototype)&&Object.defineProperty(e.RTCTrackEvent.prototype,"transceiver",{get:function(){return{receiver:this.receiver}}})}function Eb(e,r){if("object"===t(e)&&(e.RTCPeerConnection||e.mozRTCPeerConnection)){!e.RTCPeerConnection&&e.mozRTCPeerConnection&&(e.RTCPeerConnection=e.mozRTCPeerConnection),r.version<53&&["setLocalDescription","setRemoteDescription","addIceCandidate"].forEach((function(t){var r=e.RTCPeerConnection.prototype[t],i=rm({},t,(function(){return arguments[0]=new("addIceCandidate"===t?e.RTCIceCandidate:e.RTCSessionDescription)(arguments[0]),r.apply(this,arguments)}));e.RTCPeerConnection.prototype[t]=i[t]}));var i={inboundrtp:"inbound-rtp",outboundrtp:"outbound-rtp",candidatepair:"candidate-pair",localcandidate:"local-candidate",remotecandidate:"remote-candidate"},n=e.RTCPeerConnection.prototype.getStats;e.RTCPeerConnection.prototype.getStats=function(){var e=Array.prototype.slice.call(arguments),t=e[0],o=e[1],a=e[2];return n.apply(this,[t||null]).then((function(e){if(r.version<53&&!o)try{e.forEach((function(e){e.type=i[e.type]||e.type}))}catch(t){if("TypeError"!==t.name)throw t;e.forEach((function(t,r){e.set(r,Object.assign({},t,{type:i[t.type]||t.type}))}))}return e})).then(o,a)}}}function bb(e){if("object"===t(e)&&e.RTCPeerConnection&&e.RTCRtpSender&&(!e.RTCRtpSender||!("getStats"in e.RTCRtpSender.prototype))){var r=e.RTCPeerConnection.prototype.getSenders;r&&(e.RTCPeerConnection.prototype.getSenders=function(){var e=this,t=r.apply(this,[]);return t.forEach((function(t){return t._pc=e})),t});var i=e.RTCPeerConnection.prototype.addTrack;i&&(e.RTCPeerConnection.prototype.addTrack=function(){var e=i.apply(this,arguments);return e._pc=this,e}),e.RTCRtpSender.prototype.getStats=function(){return this.track?this._pc.getStats(this.track):Promise.resolve(new Map)}}}function Ib(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}),dg(e,"track",(function(e){return e.receiver._pc=e.srcElement,e})),e.RTCRtpReceiver.prototype.getStats=function(){return this._pc.getStats(this.track)}}}function Tb(e){e.RTCPeerConnection&&!("removeStream"in e.RTCPeerConnection.prototype)&&(e.RTCPeerConnection.prototype.removeStream=function(e){var t=this;fg("removeStream","removeTrack"),this.getSenders().forEach((function(r){r.track&&e.getTracks().includes(r.track)&&t.removeTrack(r)}))})}function Ab(e){e.DataChannel&&!e.RTCDataChannel&&(e.RTCDataChannel=e.DataChannel)}function Rb(e){if("object"===t(e)&&e.RTCPeerConnection){var r=e.RTCPeerConnection.prototype.addTransceiver;r&&(e.RTCPeerConnection.prototype.addTransceiver=function(){this.setParametersPromises=[];var e=arguments[1],t=e&&"sendEncodings"in e;t&&e.sendEncodings.forEach((function(e){if("rid"in e){if(!/^[a-z0-9]{0,16}$/i.test(e.rid))throw new TypeError("Invalid RID value provided.")}if("scaleResolutionDownBy"in e&&!(parseFloat(e.scaleResolutionDownBy)>=1))throw new RangeError("scale_resolution_down_by must be >= 1.0");if("maxFramerate"in e&&!(parseFloat(e.maxFramerate)>=0))throw new RangeError("max_framerate must be >= 0.0")}));var i=r.apply(this,arguments);if(t){var n=i.sender,o=n.getParameters();(!("encodings"in o)||1===o.encodings.length&&0===Object.keys(o.encodings[0]).length)&&(o.encodings=e.sendEncodings,n.sendEncodings=e.sendEncodings,this.setParametersPromises.push(n.setParameters(o).then((function(){delete n.sendEncodings})).catch((function(){delete n.sendEncodings}))))}return i})}}function Cb(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 Ob(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 wb(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 kb=Object.freeze({__proto__:null,shimOnTrack:Sb,shimPeerConnection:Eb,shimSenderGetStats:bb,shimReceiverGetStats:Ib,shimRemoveStream:Tb,shimRTCDataChannel:Ab,shimAddTransceiver:Rb,shimGetParameters:Cb,shimCreateOffer:Ob,shimCreateAnswer:wb,shimGetUserMedia:gb,shimGetDisplayMedia:function(e,t){e.navigator.mediaDevices&&"getDisplayMedia"in e.navigator.mediaDevices||e.navigator.mediaDevices&&(e.navigator.mediaDevices.getDisplayMedia=function(r){if(!r||!r.video){var i=new DOMException("getDisplayMedia without video constraints is undefined");return i.name="NotFoundError",i.code=8,Promise.reject(i)}return!0===r.video?r.video={mediaSource:t}:r.video.mediaSource=t,e.navigator.mediaDevices.getUserMedia(r)})}});function Nb(e){if("object"===t(e)&&e.RTCPeerConnection){if("getLocalStreams"in e.RTCPeerConnection.prototype||(e.RTCPeerConnection.prototype.getLocalStreams=function(){return this._localStreams||(this._localStreams=[]),this._localStreams}),!("addStream"in e.RTCPeerConnection.prototype)){var r=e.RTCPeerConnection.prototype.addTrack;e.RTCPeerConnection.prototype.addStream=function(e){var t=this;this._localStreams||(this._localStreams=[]),this._localStreams.includes(e)||this._localStreams.push(e),e.getAudioTracks().forEach((function(i){return r.call(t,i,e)})),e.getVideoTracks().forEach((function(i){return r.call(t,i,e)}))},e.RTCPeerConnection.prototype.addTrack=function(e){for(var t=this,i=arguments.length,n=new Array(i>1?i-1:0),o=1;o<i;o++)n[o-1]=arguments[o];return n&&n.forEach((function(e){t._localStreams?t._localStreams.includes(e)||t._localStreams.push(e):t._localStreams=[e]})),r.apply(this,arguments)}}"removeStream"in e.RTCPeerConnection.prototype||(e.RTCPeerConnection.prototype.removeStream=function(e){var t=this;this._localStreams||(this._localStreams=[]);var r=this._localStreams.indexOf(e);if(-1!==r){this._localStreams.splice(r,1);var i=e.getTracks();this.getSenders().forEach((function(e){i.includes(e.track)&&t.removeTrack(e)}))}})}}function Pb(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 Db(e){if("object"===t(e)&&e.RTCPeerConnection){var r=e.RTCPeerConnection.prototype,i=r.createOffer,n=r.createAnswer,o=r.setLocalDescription,a=r.setRemoteDescription,s=r.addIceCandidate;r.createOffer=function(e,t){var r=arguments.length>=2?arguments[2]:arguments[0],n=i.apply(this,[r]);return t?(n.then(e,t),Promise.resolve()):n},r.createAnswer=function(e,t){var r=arguments.length>=2?arguments[2]:arguments[0],i=n.apply(this,[r]);return t?(i.then(e,t),Promise.resolve()):i};var c=function(e,t,r){var i=o.apply(this,[e]);return r?(i.then(t,r),Promise.resolve()):i};r.setLocalDescription=c,c=function(e,t,r){var i=a.apply(this,[e]);return r?(i.then(t,r),Promise.resolve()):i},r.setRemoteDescription=c,c=function(e,t,r){var i=s.apply(this,[e]);return r?(i.then(t,r),Promise.resolve()):i},r.addIceCandidate=c}}function Mb(e){var t=e&&e.navigator;if(t.mediaDevices&&t.mediaDevices.getUserMedia){var r=t.mediaDevices,i=r.getUserMedia.bind(r);t.mediaDevices.getUserMedia=function(e){return i(Lb(e))}}!t.getUserMedia&&t.mediaDevices&&t.mediaDevices.getUserMedia&&(t.getUserMedia=function(e,r,i){t.mediaDevices.getUserMedia(e).then(r,i)}.bind(t))}function Lb(e){return e&&void 0!==e.video?Object.assign({},e,{video:mg(e.video)}):e}function Ub(e){if(e.RTCPeerConnection){var t=e.RTCPeerConnection;e.RTCPeerConnection=function(e,r){if(e&&e.iceServers){for(var i=[],n=0;n<e.iceServers.length;n++){var o=e.iceServers[n];!o.hasOwnProperty("urls")&&o.hasOwnProperty("url")?(fg("RTCIceServer.url","RTCIceServer.urls"),(o=JSON.parse(JSON.stringify(o))).urls=o.url,delete o.url,i.push(o)):i.push(e.iceServers[n])}e.iceServers=i}return new t(e,r)},e.RTCPeerConnection.prototype=t.prototype,"generateCertificate"in t&&Object.defineProperty(e.RTCPeerConnection,"generateCertificate",{get:function(){return t.generateCertificate}})}}function xb(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 Vb(e){var t=e.RTCPeerConnection.prototype.createOffer;e.RTCPeerConnection.prototype.createOffer=function(e){if(e){void 0!==e.offerToReceiveAudio&&(e.offerToReceiveAudio=!!e.offerToReceiveAudio);var r=this.getTransceivers().find((function(e){return"audio"===e.receiver.track.kind}));!1===e.offerToReceiveAudio&&r?"sendrecv"===r.direction?r.setDirection?r.setDirection("sendonly"):r.direction="sendonly":"recvonly"===r.direction&&(r.setDirection?r.setDirection("inactive"):r.direction="inactive"):!0!==e.offerToReceiveAudio||r||this.addTransceiver("audio",{direction:"recvonly"}),void 0!==e.offerToReceiveVideo&&(e.offerToReceiveVideo=!!e.offerToReceiveVideo);var i=this.getTransceivers().find((function(e){return"video"===e.receiver.track.kind}));!1===e.offerToReceiveVideo&&i?"sendrecv"===i.direction?i.setDirection?i.setDirection("sendonly"):i.direction="sendonly":"recvonly"===i.direction&&(i.setDirection?i.setDirection("inactive"):i.direction="inactive"):!0!==e.offerToReceiveVideo||i||this.addTransceiver("video",{direction:"recvonly"})}return t.apply(this,arguments)}}function Fb(e){"object"!==t(e)||e.AudioContext||(e.AudioContext=e.webkitAudioContext)}var Bb=Object.freeze({__proto__:null,shimLocalStreamsAPI:Nb,shimRemoteStreamsAPI:Pb,shimCallbacksAPI:Db,shimGetUserMedia:Mb,shimConstraints:Lb,shimRTCIceServerUrls:Ub,shimTrackEventTransceiver:xb,shimCreateOfferLegacy:Vb,shimAudioContext:Fb}),jb=Le,Gb=ut;Xi({target:"Date",proto:!0,forced:s((function(){return null!==new Date(NaN).toJSON()||1!==Date.prototype.toJSON.call({toISOString:function(){return 1}})}))},{toJSON:function(e){var t=jb(this),r=Gb(t,"number");return"number"!=typeof r||isFinite(r)?t.toISOString():null}});var Hb=h;Xi({target:"URL",proto:!0,enumerable:!0},{toJSON:function(){return Hb(URL.prototype.toString,this)}});var zb=A(1..valueOf),Kb=c,Wb=o,Xb=A,qb=Fi,Yb=Yt.exports,Jb=Ve,Qb=sy,Zb=q,$b=he,eI=ut,tI=s,rI=Wr.f,iI=a.f,nI=Ot.f,oI=zb,aI=Em.trim,sI="Number",cI=Wb.Number,uI=cI.prototype,dI=Wb.TypeError,lI=Xb("".slice),hI=Xb("".charCodeAt),pI=function(e){var t=eI(e,"number");return"bigint"==typeof t?t:fI(t)},fI=function(e){var t,r,i,n,o,a,s,c,u=eI(e,"number");if($b(u))throw dI("Cannot convert a Symbol value to a number");if("string"==typeof u&&u.length>2)if(u=aI(u),43===(t=hI(u,0))||45===t){if(88===(r=hI(u,2))||120===r)return NaN}else if(48===t){switch(hI(u,1)){case 66:case 98:i=2,n=49;break;case 79:case 111:i=8,n=55;break;default:return+u}for(a=(o=lI(u,2)).length,s=0;s<a;s++)if((c=hI(o,s))<48||c>n)return NaN;return parseInt(o,i)}return+u};if(qb(sI,!cI(" 0o1")||!cI("0b1")||cI("+0x1"))){for(var _I,vI=function(e){var t=arguments.length<1?0:cI(pI(e)),r=this;return Zb(uI,r)&&tI((function(){oI(r)}))?Qb(Object(t),r,vI):t},mI=Kb?rI(cI):"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(","),yI=0;mI.length>yI;yI++)Jb(cI,_I=mI[yI])&&!Jb(vI,_I)&&nI(vI,_I,iI(cI,_I));vI.prototype=uI,uI.constructor=vI,Yb(Wb,sI,vI)}var gI=Xi,SI=L,EI=B,bI=Gn,II=A([].join),TI=SI!=Object,AI=bI("join",",");gI({target:"Array",proto:!0,forced:TI||!AI},{join:function(e){return II(EI(this),void 0===e?",":e)}});var RI=$n,CI=h,OI=A,wI=wv,kI=w_,NI=Mt,PI=x,DI=du,MI=nm,LI=ri,UI=_o,xI=Se,VI=Ro,FI=xv,BI=Sv,jI=s,GI=X_.UNSUPPORTED_Y,HI=4294967295,zI=Math.min,KI=[].push,WI=OI(/./.exec),XI=OI(KI),qI=OI("".slice),YI=!jI((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]}));wI("split",(function(e,t,r){var i;return i="c"=="abbc".split(/(b)*/)[1]||4!="test".split(/(?:)/,-1).length||2!="ab".split(/(?:ab)*/).length||4!=".".split(/(.?)(.?)/).length||".".split(/()()/).length>1||"".split(/.?/).length?function(e,r){var i=UI(PI(this)),n=void 0===r?HI:r>>>0;if(0===n)return[];if(void 0===e)return[i];if(!kI(e))return CI(t,i,e,n);for(var o,a,s,c=[],u=(e.ignoreCase?"i":"")+(e.multiline?"m":"")+(e.unicode?"u":"")+(e.sticky?"y":""),d=0,l=new RegExp(e.source,u+"g");(o=CI(BI,l,i))&&!((a=l.lastIndex)>d&&(XI(c,qI(i,d,o.index)),o.length>1&&o.index<i.length&&RI(KI,c,VI(o,1)),s=o[0].length,d=a,c.length>=n));)l.lastIndex===o.index&&l.lastIndex++;return d===i.length?!s&&WI(l,"")||XI(c,""):XI(c,qI(i,d)),c.length>n?VI(c,0,n):c}:"0".split(void 0,0).length?function(e,r){return void 0===e&&0===r?[]:CI(t,this,e,r)}:t,[function(t,r){var n=PI(this),o=null==t?void 0:xI(t,e);return o?CI(o,t,n,r):CI(i,UI(n),t,r)},function(e,n){var o=NI(this),a=UI(e),s=r(i,o,a,n,i!==t);if(s.done)return s.value;var c=DI(o,RegExp),u=o.unicode,d=(o.ignoreCase?"i":"")+(o.multiline?"m":"")+(o.unicode?"u":"")+(GI?"g":"y"),l=new c(GI?"^(?:"+o.source+")":o,d),h=void 0===n?HI:n>>>0;if(0===h)return[];if(0===a.length)return null===FI(l,a)?[a]:[];for(var p=0,f=0,_=[];f<a.length;){l.lastIndex=GI?0:f;var v,m=FI(l,GI?qI(a,f):a);if(null===m||(v=zI(LI(l.lastIndex+(GI?f:0)),a.length))===p)f=MI(a,f,u);else{if(XI(_,qI(a,p,f)),_.length===h)return _;for(var y=1;y<=m.length-1;y++)if(XI(_,m[y]),_.length===h)return _;f=p=v}}return XI(_,qI(a,p)),_}]}),!YI,GI);var JI=Lr.PROPER,QI=s,ZI=pm,$I=Em.trim;Xi({target:"String",proto:!0,forced:function(e){return QI((function(){return!!ZI[e]()||"​…᠎"!=="​…᠎"[e]()||JI&&ZI[e].name!==e}))}("trim")},{trim:function(){return $I(this)}});var eT={exports:{}};!function(e){var r={generateIdentifier:function(){return Math.random().toString(36).substr(2,10)}};r.localCName=r.generateIdentifier(),r.splitLines=function(e){return e.trim().split("\n").map((function(e){return e.trim()}))},r.splitSections=function(e){return e.split("\nm=").map((function(e,t){return(t>0?"m="+e:e).trim()+"\r\n"}))},r.getDescription=function(e){var t=r.splitSections(e);return t&&t[0]},r.getMediaSections=function(e){var t=r.splitSections(e);return t.shift(),t},r.matchPrefix=function(e,t){return r.splitLines(e).filter((function(e){return 0===e.indexOf(t)}))},r.parseCandidate=function(e){for(var t,r={foundation:(t=0===e.indexOf("a=candidate:")?e.substring(12).split(" "):e.substring(10).split(" "))[0],component:{1:"rtp",2:"rtcp"}[t[1]]||t[1],protocol:t[2].toLowerCase(),priority:parseInt(t[3],10),ip:t[4],address:t[4],port:parseInt(t[5],10),type:t[7]},i=8;i<t.length;i+=2)switch(t[i]){case"raddr":r.relatedAddress=t[i+1];break;case"rport":r.relatedPort=parseInt(t[i+1],10);break;case"tcptype":r.tcpType=t[i+1];break;case"ufrag":r.ufrag=t[i+1],r.usernameFragment=t[i+1];break;default:void 0===r[t[i]]&&(r[t[i]]=t[i+1])}return r},r.writeCandidate=function(e){var t=[];t.push(e.foundation);var r=e.component;"rtp"===r?t.push(1):"rtcp"===r?t.push(2):t.push(r),t.push(e.protocol.toUpperCase()),t.push(e.priority),t.push(e.address||e.ip),t.push(e.port);var i=e.type;return t.push("typ"),t.push(i),"host"!==i&&e.relatedAddress&&e.relatedPort&&(t.push("raddr"),t.push(e.relatedAddress),t.push("rport"),t.push(e.relatedPort)),e.tcpType&&"tcp"===e.protocol.toLowerCase()&&(t.push("tcptype"),t.push(e.tcpType)),(e.usernameFragment||e.ufrag)&&(t.push("ufrag"),t.push(e.usernameFragment||e.ufrag)),"candidate:"+t.join(" ")},r.parseIceOptions=function(e){return e.substr(14).split(" ")},r.parseRtpMap=function(e){var t=e.substr(9).split(" "),r={payloadType:parseInt(t.shift(),10)};return t=t[0].split("/"),r.name=t[0],r.clockRate=parseInt(t[1],10),r.channels=3===t.length?parseInt(t[2],10):1,r.numChannels=r.channels,r},r.writeRtpMap=function(e){var t=e.payloadType;void 0!==e.preferredPayloadType&&(t=e.preferredPayloadType);var r=e.channels||e.numChannels||1;return"a=rtpmap:"+t+" "+e.name+"/"+e.clockRate+(1!==r?"/"+r:"")+"\r\n"},r.parseExtmap=function(e){var t=e.substr(9).split(" ");return{id:parseInt(t[0],10),direction:t[0].indexOf("/")>0?t[0].split("/")[1]:"sendrecv",uri:t[1]}},r.writeExtmap=function(e){return"a=extmap:"+(e.id||e.preferredId)+(e.direction&&"sendrecv"!==e.direction?"/"+e.direction:"")+" "+e.uri+"\r\n"},r.parseFmtp=function(e){for(var t,r={},i=e.substr(e.indexOf(" ")+1).split(";"),n=0;n<i.length;n++)r[(t=i[n].trim().split("="))[0].trim()]=t[1];return r},r.writeFmtp=function(e){var t="",r=e.payloadType;if(void 0!==e.preferredPayloadType&&(r=e.preferredPayloadType),e.parameters&&Object.keys(e.parameters).length){var i=[];Object.keys(e.parameters).forEach((function(t){void 0!==e.parameters[t]?i.push(t+"="+e.parameters[t]):i.push(t)})),t+="a=fmtp:"+r+" "+i.join(";")+"\r\n"}return t},r.parseRtcpFb=function(e){var t=e.substr(e.indexOf(" ")+1).split(" ");return{type:t.shift(),parameter:t.join(" ")}},r.writeRtcpFb=function(e){var t="",r=e.payloadType;return void 0!==e.preferredPayloadType&&(r=e.preferredPayloadType),e.rtcpFeedback&&e.rtcpFeedback.length&&e.rtcpFeedback.forEach((function(e){t+="a=rtcp-fb:"+r+" "+e.type+(e.parameter&&e.parameter.length?" "+e.parameter:"")+"\r\n"})),t},r.parseSsrcMedia=function(e){var t=e.indexOf(" "),r={ssrc:parseInt(e.substr(7,t-7),10)},i=e.indexOf(":",t);return i>-1?(r.attribute=e.substr(t+1,i-t-1),r.value=e.substr(i+1)):r.attribute=e.substr(t+1),r},r.parseSsrcGroup=function(e){var t=e.substr(13).split(" ");return{semantics:t.shift(),ssrcs:t.map((function(e){return parseInt(e,10)}))}},r.getMid=function(e){var t=r.matchPrefix(e,"a=mid:")[0];if(t)return t.substr(6)},r.parseFingerprint=function(e){var t=e.substr(14).split(" ");return{algorithm:t[0].toLowerCase(),value:t[1].toUpperCase()}},r.getDtlsParameters=function(e,t){return{role:"auto",fingerprints:r.matchPrefix(e+t,"a=fingerprint:").map(r.parseFingerprint)}},r.writeDtlsParameters=function(e,t){var r="a=setup:"+t+"\r\n";return e.fingerprints.forEach((function(e){r+="a=fingerprint:"+e.algorithm+" "+e.value+"\r\n"})),r},r.parseCryptoLine=function(e){var t=e.substr(9).split(" ");return{tag:parseInt(t[0],10),cryptoSuite:t[1],keyParams:t[2],sessionParams:t.slice(3)}},r.writeCryptoLine=function(e){return"a=crypto:"+e.tag+" "+e.cryptoSuite+" "+("object"===t(e.keyParams)?r.writeCryptoKeyParams(e.keyParams):e.keyParams)+(e.sessionParams?" "+e.sessionParams.join(" "):"")+"\r\n"},r.parseCryptoKeyParams=function(e){if(0!==e.indexOf("inline:"))return null;var t=e.substr(7).split("|");return{keyMethod:"inline",keySalt:t[0],lifeTime:t[1],mkiValue:t[2]?t[2].split(":")[0]:void 0,mkiLength:t[2]?t[2].split(":")[1]:void 0}},r.writeCryptoKeyParams=function(e){return e.keyMethod+":"+e.keySalt+(e.lifeTime?"|"+e.lifeTime:"")+(e.mkiValue&&e.mkiLength?"|"+e.mkiValue+":"+e.mkiLength:"")},r.getCryptoParameters=function(e,t){return r.matchPrefix(e+t,"a=crypto:").map(r.parseCryptoLine)},r.getIceParameters=function(e,t){var i=r.matchPrefix(e+t,"a=ice-ufrag:")[0],n=r.matchPrefix(e+t,"a=ice-pwd:")[0];return i&&n?{usernameFragment:i.substr(12),password:n.substr(10)}:null},r.writeIceParameters=function(e){var t="a=ice-ufrag:"+e.usernameFragment+"\r\na=ice-pwd:"+e.password+"\r\n";return e.iceLite&&(t+="a=ice-lite\r\n"),t},r.parseRtpParameters=function(e){for(var t={codecs:[],headerExtensions:[],fecMechanisms:[],rtcp:[]},i=r.splitLines(e)[0].split(" "),n=3;n<i.length;n++){var o=i[n],a=r.matchPrefix(e,"a=rtpmap:"+o+" ")[0];if(a){var s=r.parseRtpMap(a),c=r.matchPrefix(e,"a=fmtp:"+o+" ");switch(s.parameters=c.length?r.parseFmtp(c[0]):{},s.rtcpFeedback=r.matchPrefix(e,"a=rtcp-fb:"+o+" ").map(r.parseRtcpFb),t.codecs.push(s),s.name.toUpperCase()){case"RED":case"ULPFEC":t.fecMechanisms.push(s.name.toUpperCase())}}}return r.matchPrefix(e,"a=extmap:").forEach((function(e){t.headerExtensions.push(r.parseExtmap(e))})),t},r.writeRtpDescription=function(e,t){var i="";i+="m="+e+" ",i+=t.codecs.length>0?"9":"0",i+=" UDP/TLS/RTP/SAVPF ",i+=t.codecs.map((function(e){return void 0!==e.preferredPayloadType?e.preferredPayloadType:e.payloadType})).join(" ")+"\r\n",i+="c=IN IP4 0.0.0.0\r\n",i+="a=rtcp:9 IN IP4 0.0.0.0\r\n",t.codecs.forEach((function(e){i+=r.writeRtpMap(e),i+=r.writeFmtp(e),i+=r.writeRtcpFb(e)}));var n=0;return t.codecs.forEach((function(e){e.maxptime>n&&(n=e.maxptime)})),n>0&&(i+="a=maxptime:"+n+"\r\n"),t.headerExtensions&&t.headerExtensions.forEach((function(e){i+=r.writeExtmap(e)})),i},r.parseRtpEncodingParameters=function(e){var t,i=[],n=r.parseRtpParameters(e),o=-1!==n.fecMechanisms.indexOf("RED"),a=-1!==n.fecMechanisms.indexOf("ULPFEC"),s=r.matchPrefix(e,"a=ssrc:").map((function(e){return r.parseSsrcMedia(e)})).filter((function(e){return"cname"===e.attribute})),c=s.length>0&&s[0].ssrc,u=r.matchPrefix(e,"a=ssrc-group:FID").map((function(e){return e.substr(17).split(" ").map((function(e){return parseInt(e,10)}))}));u.length>0&&u[0].length>1&&u[0][0]===c&&(t=u[0][1]),n.codecs.forEach((function(e){if("RTX"===e.name.toUpperCase()&&e.parameters.apt){var r={ssrc:c,codecPayloadType:parseInt(e.parameters.apt,10)};c&&t&&(r.rtx={ssrc:t}),i.push(r),o&&((r=JSON.parse(JSON.stringify(r))).fec={ssrc:c,mechanism:a?"red+ulpfec":"red"},i.push(r))}})),0===i.length&&c&&i.push({ssrc:c});var d=r.matchPrefix(e,"b=");return d.length&&(d=0===d[0].indexOf("b=TIAS:")?parseInt(d[0].substr(7),10):0===d[0].indexOf("b=AS:")?1e3*parseInt(d[0].substr(5),10)*.95-16e3:void 0,i.forEach((function(e){e.maxBitrate=d}))),i},r.parseRtcpParameters=function(e){var t={},i=r.matchPrefix(e,"a=ssrc:").map((function(e){return r.parseSsrcMedia(e)})).filter((function(e){return"cname"===e.attribute}))[0];i&&(t.cname=i.value,t.ssrc=i.ssrc);var n=r.matchPrefix(e,"a=rtcp-rsize");t.reducedSize=n.length>0,t.compound=0===n.length;var o=r.matchPrefix(e,"a=rtcp-mux");return t.mux=o.length>0,t},r.writeRtcpParameters=function(e){var t="";return e.reducedSize&&(t+="a=rtcp-rsize\r\n"),e.mux&&(t+="a=rtcp-mux\r\n"),void 0!==e.ssrc&&e.cname&&(t+="a=ssrc:"+e.ssrc+" cname:"+e.cname+"\r\n"),t},r.parseMsid=function(e){var t,i=r.matchPrefix(e,"a=msid:");if(1===i.length)return{stream:(t=i[0].substr(7).split(" "))[0],track:t[1]};var n=r.matchPrefix(e,"a=ssrc:").map((function(e){return r.parseSsrcMedia(e)})).filter((function(e){return"msid"===e.attribute}));return n.length>0?{stream:(t=n[0].value.split(" "))[0],track:t[1]}:void 0},r.parseSctpDescription=function(e){var t,i=r.parseMLine(e),n=r.matchPrefix(e,"a=max-message-size:");n.length>0&&(t=parseInt(n[0].substr(19),10)),isNaN(t)&&(t=65536);var o=r.matchPrefix(e,"a=sctp-port:");if(o.length>0)return{port:parseInt(o[0].substr(12),10),protocol:i.fmt,maxMessageSize:t};var a=r.matchPrefix(e,"a=sctpmap:");if(a.length>0){var s=a[0].substr(10).split(" ");return{port:parseInt(s[0],10),protocol:s[1],maxMessageSize:t}}},r.writeSctpDescription=function(e,t){var r=[];return r="DTLS/SCTP"!==e.protocol?["m="+e.kind+" 9 "+e.protocol+" "+t.protocol+"\r\n","c=IN IP4 0.0.0.0\r\n","a=sctp-port:"+t.port+"\r\n"]:["m="+e.kind+" 9 "+e.protocol+" "+t.port+"\r\n","c=IN IP4 0.0.0.0\r\n","a=sctpmap:"+t.port+" "+t.protocol+" 65535\r\n"],void 0!==t.maxMessageSize&&r.push("a=max-message-size:"+t.maxMessageSize+"\r\n"),r.join("")},r.generateSessionId=function(){return Math.random().toString().substr(2,21)},r.writeSessionBoilerplate=function(e,t,i){var n=void 0!==t?t:2;return"v=0\r\no="+(i||"thisisadapterortc")+" "+(e||r.generateSessionId())+" "+n+" IN IP4 127.0.0.1\r\ns=-\r\nt=0 0\r\n"},r.getDirection=function(e,t){for(var i=r.splitLines(e),n=0;n<i.length;n++)switch(i[n]){case"a=sendrecv":case"a=sendonly":case"a=recvonly":case"a=inactive":return i[n].substr(2)}return t?r.getDirection(t):"sendrecv"},r.getKind=function(e){return r.splitLines(e)[0].split(" ")[0].substr(2)},r.isRejected=function(e){return"0"===e.split(" ",2)[1]},r.parseMLine=function(e){var t=r.splitLines(e)[0].substr(2).split(" ");return{kind:t[0],port:parseInt(t[1],10),protocol:t[2],fmt:t.slice(3).join(" ")}},r.parseOLine=function(e){var t=r.matchPrefix(e,"o=")[0].substr(2).split(" ");return{username:t[0],sessionId:t[1],sessionVersion:parseInt(t[2],10),netType:t[3],addressType:t[4],address:t[5]}},r.isValidSDP=function(e){if("string"!=typeof e||0===e.length)return!1;for(var t=r.splitLines(e),i=0;i<t.length;i++)if(t[i].length<2||"="!==t[i].charAt(1))return!1;return!0},e.exports=r}(eT);var tT=eT.exports,rT=Object.freeze(e({__proto__:null,default:tT},[eT.exports]));function iT(e){if(!(!e.RTCIceCandidate||e.RTCIceCandidate&&"foundation"in e.RTCIceCandidate.prototype)){var r=e.RTCIceCandidate;e.RTCIceCandidate=function(e){if("object"===t(e)&&e.candidate&&0===e.candidate.indexOf("a=")&&((e=JSON.parse(JSON.stringify(e))).candidate=e.candidate.substr(2)),e.candidate&&e.candidate.length){var i=new r(e),n=tT.parseCandidate(e.candidate),o=Object.assign(i,n);return o.toJSON=function(){return{candidate:o.candidate,sdpMid:o.sdpMid,sdpMLineIndex:o.sdpMLineIndex,usernameFragment:o.usernameFragment}},o}return new r(e)},e.RTCIceCandidate.prototype=r.prototype,dg(e,"icecandidate",(function(t){return t.candidate&&Object.defineProperty(t,"candidate",{value:new e.RTCIceCandidate(t.candidate),writable:"false"}),t}))}}function nT(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=tT.splitSections(e.sdp);return t.shift(),t.some((function(e){var t=tT.parseMLine(e);return t&&"application"===t.kind&&-1!==t.protocol.indexOf("SCTP")}))},i=function(e){var t=e.sdp.match(/mozilla...THIS_IS_SDPARTA-(\d+)/);if(null===t||t.length<2)return-1;var r=parseInt(t[1],10);return r!=r?-1:r},n=function(e){var r=65536;return"firefox"===t.browser&&(r=t.version<57?-1===e?16384:2147483637:t.version<60?57===t.version?65535:65536:2147483637),r},o=function(e,r){var i=65536;"firefox"===t.browser&&57===t.version&&(i=65535);var n=tT.matchPrefix(e.sdp,"a=max-message-size:");return n.length>0?i=parseInt(n[0].substr(19),10):"firefox"===t.browser&&-1!==r&&(i=2147483637),i},a=e.RTCPeerConnection.prototype.setRemoteDescription;e.RTCPeerConnection.prototype.setRemoteDescription=function(){if(this._sctp=null,"chrome"===t.browser&&t.version>=76){var e=this.getConfiguration(),s=e.sdpSemantics;"plan-b"===s&&Object.defineProperty(this,"sctp",{get:function(){return void 0===this._sctp?null:this._sctp},enumerable:!0,configurable:!0})}if(r(arguments[0])){var c,u=i(arguments[0]),d=n(u),l=o(arguments[0],u);c=0===d&&0===l?Number.POSITIVE_INFINITY:0===d||0===l?Math.max(d,l):Math.min(d,l);var h={};Object.defineProperty(h,"maxMessageSize",{get:function(){return c}}),this._sctp=h}return a.apply(this,arguments)}}}function oT(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},dg(e,"datachannel",(function(e){return r(e.channel,e.target),e}))}function r(e,t){var r=e.send;e.send=function(){var i=arguments[0],n=i.length||i.size||i.byteLength;if("open"===e.readyState&&t.sctp&&n>t.sctp.maxMessageSize)throw new TypeError("Message too large (can send a maximum of "+t.sctp.maxMessageSize+" bytes)");return r.apply(e,arguments)}}}function aT(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 sT(e,t){if(e.RTCPeerConnection&&!("chrome"===t.browser&&t.version>=71||"safari"===t.browser&&t.version>=605)){var r=e.RTCPeerConnection.prototype.setRemoteDescription;e.RTCPeerConnection.prototype.setRemoteDescription=function(t){if(t&&t.sdp&&-1!==t.sdp.indexOf("\na=extmap-allow-mixed")){var i=t.sdp.split("\n").filter((function(e){return"a=extmap-allow-mixed"!==e.trim()})).join("\n");e.RTCSessionDescription&&t instanceof e.RTCSessionDescription?arguments[0]=new e.RTCSessionDescription({type:t.type,sdp:i}):t.sdp=i}return r.apply(this,arguments)}}}function cT(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 uT(e,r){if(e.RTCPeerConnection&&e.RTCPeerConnection.prototype){var i=e.RTCPeerConnection.prototype.setLocalDescription;i&&0!==i.length&&(e.RTCPeerConnection.prototype.setLocalDescription=function(){var e=this,r=arguments[0]||{};if("object"!==t(r)||r.type&&r.sdp)return i.apply(this,arguments);if(!(r={type:r.type,sdp:r.sdp}).type)switch(this.signalingState){case"stable":case"have-local-offer":case"have-remote-pranswer":r.type="offer";break;default:r.type="answer"}if(r.sdp||"offer"!==r.type&&"answer"!==r.type)return i.apply(this,[r]);var n="offer"===r.type?this.createOffer:this.createAnswer;return n.apply(this).then((function(t){return i.apply(e,[t])}))})}}var dT=Object.freeze({__proto__:null,shimRTCIceCandidate:iT,shimMaxMessageSize:nT,shimSendThrowTypeError:oT,shimConnectionState:aT,removeExtmapAllowMixed:sT,shimAddIceCandidateNullOrEmpty:cT,shimParameterlessSetLocalDescription:uT});function lT(e,t,r,i,n,o,a){try{var s=e[o](a),c=s.value}catch(e){return void r(e)}s.done?t(c):Promise.resolve(c).then(i,n)}function hT(e){return function(){var t=this,r=arguments;return new Promise((function(i,n){var o=e.apply(t,r);function a(e){lT(o,i,n,a,s,"next",e)}function s(e){lT(o,i,n,a,s,"throw",e)}a(void 0)}))}}!function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.window,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{shimChrome:!0,shimFirefox:!0,shimSafari:!0},i=pg,n=_g(t),o={browserDetails:n,commonShim:dT,extractVersion:ug,disableLog:lg,disableWarnings:hg,sdp:rT};switch(n.browser){case"chrome":if(!eb||!ZE||!r.shimChrome)return i("Chrome shim is not included in this adapter release."),o;if(null===n.version)return i("Chrome shim can not determine version, not shimming."),o;i("adapter.js shimming chrome."),o.browserShim=eb,cT(t,n),uT(t),zE(t,n),KE(t),ZE(t,n),WE(t),QE(t,n),XE(t),qE(t),YE(t),$E(t,n),iT(t),aT(t),nT(t,n),oT(t),sT(t,n);break;case"firefox":if(!kb||!Eb||!r.shimFirefox)return i("Firefox shim is not included in this adapter release."),o;i("adapter.js shimming firefox."),o.browserShim=kb,cT(t,n),uT(t),gb(t,n),Eb(t,n),Sb(t),Tb(t),bb(t),Ib(t),Ab(t),Rb(t),Cb(t),Ob(t),wb(t),iT(t),aT(t),nT(t,n),oT(t);break;case"safari":if(!Bb||!r.shimSafari)return i("Safari shim is not included in this adapter release."),o;i("adapter.js shimming safari."),o.browserShim=Bb,cT(t,n),uT(t),Ub(t),Vb(t),Db(t),Nb(t),Pb(t),xb(t),Mb(t),Fb(t),iT(t),nT(t,n),oT(t),sT(t,n);break;default:i("Unsupported browser!")}}({window:"undefined"==typeof window?void 0:window}),Fo("toStringTag"),Ho(o.JSON,"JSON",!0),Ho(Math,"Math",!0);var pT=Le,fT=mh,_T=ch;Xi({target:"Object",stat:!0,forced:s((function(){fT(1)})),sham:!_T},{getPrototypeOf:function(e){return fT(pT(e))}});var vT=Xi,mT=to,yT=A([].reverse),gT=[1,2];vT({target:"Array",proto:!0,forced:String(gT)===String(gT.reverse())},{reverse:function(){return mT(this)&&(this.length=this.length),yT(this)}}),Xi({global:!0},{globalThis:o});var ST={exports:{}};!function(e){var r=function(e){var r,i=Object.prototype,n=i.hasOwnProperty,o="function"==typeof Symbol?Symbol:{},a=o.iterator||"@@iterator",s=o.asyncIterator||"@@asyncIterator",c=o.toStringTag||"@@toStringTag";function u(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{u({},"")}catch(e){u=function(e,t,r){return e[t]=r}}function d(e,t,r,i){var n=t&&t.prototype instanceof m?t:m,o=Object.create(n.prototype),a=new w(i||[]);return o._invoke=function(e,t,r){var i=h;return function(n,o){if(i===f)throw new Error("Generator is already running");if(i===_){if("throw"===n)throw o;return N()}for(r.method=n,r.arg=o;;){var a=r.delegate;if(a){var s=R(a,r);if(s){if(s===v)continue;return s}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(i===h)throw i=_,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);i=f;var c=l(e,t,r);if("normal"===c.type){if(i=r.done?_:p,c.arg===v)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(i=_,r.method="throw",r.arg=c.arg)}}}(e,r,a),o}function l(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}e.wrap=d;var h="suspendedStart",p="suspendedYield",f="executing",_="completed",v={};function m(){}function y(){}function g(){}var S={};u(S,a,(function(){return this}));var E=Object.getPrototypeOf,b=E&&E(E(k([])));b&&b!==i&&n.call(b,a)&&(S=b);var I=g.prototype=m.prototype=Object.create(S);function T(e){["next","throw","return"].forEach((function(t){u(e,t,(function(e){return this._invoke(t,e)}))}))}function A(e,r){function i(o,a,s,c){var u=l(e[o],e,a);if("throw"!==u.type){var d=u.arg,h=d.value;return h&&"object"===t(h)&&n.call(h,"__await")?r.resolve(h.__await).then((function(e){i("next",e,s,c)}),(function(e){i("throw",e,s,c)})):r.resolve(h).then((function(e){d.value=e,s(d)}),(function(e){return i("throw",e,s,c)}))}c(u.arg)}var o;this._invoke=function(e,t){function n(){return new r((function(r,n){i(e,t,r,n)}))}return o=o?o.then(n,n):n()}}function R(e,t){var i=e.iterator[t.method];if(i===r){if(t.delegate=null,"throw"===t.method){if(e.iterator.return&&(t.method="return",t.arg=r,R(e,t),"throw"===t.method))return v;t.method="throw",t.arg=new TypeError("The iterator does not provide a 'throw' method")}return v}var n=l(i,e.iterator,t.arg);if("throw"===n.type)return t.method="throw",t.arg=n.arg,t.delegate=null,v;var o=n.arg;return o?o.done?(t[e.resultName]=o.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=r),t.delegate=null,v):o:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,v)}function C(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function O(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function w(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(C,this),this.reset(!0)}function k(e){if(e){var t=e[a];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var i=-1,o=function t(){for(;++i<e.length;)if(n.call(e,i))return t.value=e[i],t.done=!1,t;return t.value=r,t.done=!0,t};return o.next=o}}return{next:N}}function N(){return{value:r,done:!0}}return y.prototype=g,u(I,"constructor",g),u(g,"constructor",y),y.displayName=u(g,c,"GeneratorFunction"),e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===y||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,g):(e.__proto__=g,u(e,c,"GeneratorFunction")),e.prototype=Object.create(I),e},e.awrap=function(e){return{__await:e}},T(A.prototype),u(A.prototype,s,(function(){return this})),e.AsyncIterator=A,e.async=function(t,r,i,n,o){void 0===o&&(o=Promise);var a=new A(d(t,r,i,n),o);return e.isGeneratorFunction(r)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},T(I),u(I,c,"Generator"),u(I,a,(function(){return this})),u(I,"toString",(function(){return"[object Generator]"})),e.keys=function(e){var t=[];for(var r in e)t.push(r);return t.reverse(),function r(){for(;t.length;){var i=t.pop();if(i in e)return r.value=i,r.done=!1,r}return r.done=!0,r}},e.values=k,w.prototype={constructor:w,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=r,this.done=!1,this.delegate=null,this.method="next",this.arg=r,this.tryEntries.forEach(O),!e)for(var t in this)"t"===t.charAt(0)&&n.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=r)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function i(i,n){return s.type="throw",s.arg=e,t.next=i,n&&(t.method="next",t.arg=r),!!n}for(var o=this.tryEntries.length-1;o>=0;--o){var a=this.tryEntries[o],s=a.completion;if("root"===a.tryLoc)return i("end");if(a.tryLoc<=this.prev){var c=n.call(a,"catchLoc"),u=n.call(a,"finallyLoc");if(c&&u){if(this.prev<a.catchLoc)return i(a.catchLoc,!0);if(this.prev<a.finallyLoc)return i(a.finallyLoc)}else if(c){if(this.prev<a.catchLoc)return i(a.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return i(a.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;r>=0;--r){var i=this.tryEntries[r];if(i.tryLoc<=this.prev&&n.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var o=i;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var a=o?o.completion:{};return a.type=e,a.arg=t,o?(this.method="next",this.next=o.finallyLoc,v):this.complete(a)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),v},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),O(r),v}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var i=r.completion;if("throw"===i.type){var n=i.arg;O(r)}return n}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,i){return this.delegate={iterator:k(e),resultName:t,nextLoc:i},"next"===this.method&&(this.arg=r),v}},e}(e.exports);try{regeneratorRuntime=r}catch(e){"object"===("undefined"==typeof globalThis?"undefined":t(globalThis))?globalThis.regeneratorRuntime=r:Function("r","regeneratorRuntime = r")(r)}}(ST);var ET=ST.exports,bT=Xi,IT=o,TT=$n,AT=j,RT=Po,CT=hu,OT=/MSIE .\./.test(Y),wT=IT.Function,kT=function(e){return function(t,r){var i=CT(arguments.length,1)>2,n=AT(t)?t:wT(t),o=i?RT(arguments,2):void 0;return e(i?function(){TT(n,this,o)}:n,r)}};bT({global:!0,bind:!0,forced:OT},{setTimeout:kT(IT.setTimeout),setInterval:kT(IT.setInterval)});var NT=Mt,PT=Dc,DT=Xo,MT=h,LT=Le,UT=function(e,t,r,i){try{return i?t(NT(r)[0],r[1]):t(r)}catch(t){PT(e,"throw",t)}},xT=mc,VT=sa,FT=ni,BT=So,jT=wc,GT=bc,HT=o.Array,zT=function(e){var t=LT(e),r=VT(this),i=arguments.length,n=i>1?arguments[1]:void 0,o=void 0!==n;o&&(n=DT(n,i>2?arguments[2]:void 0));var a,s,c,u,d,l,h=GT(t),p=0;if(!h||this==HT&&xT(h))for(a=FT(t),s=r?new this(a):HT(a);a>p;p++)l=o?n(t[p],p):t[p],BT(s,p,l);else for(d=(u=jT(t,h)).next,s=r?new this:[];!(c=MT(d,u)).done;p++)l=o?UT(u,n,[c.value,p],!0):c.value,BT(s,p,l);return s.length=p,s},KT=zT;Xi({target:"Array",stat:!0,forced:!ru((function(e){Array.from(e)}))},{from:KT});var WT=s,XT=et("iterator"),qT=!WT((function(){var e=new URL("b?a=1&b=2&c=3","http://a"),t=e.searchParams,r="";return e.pathname="c%20d",t.forEach((function(e,i){t.delete("b"),r+=i+e})),!t.sort||"http://a/c%20d?a=1&c=3"!==e.href||"3"!==t.get("c")||"a=1"!==String(new URLSearchParams("?a=1"))||!t[XT]||"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})),YT=A,JT=2147483647,QT=/[^\0-\u007E]/,ZT=/[.\u3002\uFF0E\uFF61]/g,$T="Overflow: input needs wider integers to process",eA=o.RangeError,tA=YT(ZT.exec),rA=Math.floor,iA=String.fromCharCode,nA=YT("".charCodeAt),oA=YT([].join),aA=YT([].push),sA=YT("".replace),cA=YT("".split),uA=YT("".toLowerCase),dA=function(e){return e+22+75*(e<26)},lA=function(e,t,r){var i=0;for(e=r?rA(e/700):e>>1,e+=rA(e/t);e>455;)e=rA(e/35),i+=36;return rA(i+36*e/(e+38))},hA=function(e){var t=[];e=function(e){for(var t=[],r=0,i=e.length;r<i;){var n=nA(e,r++);if(n>=55296&&n<=56319&&r<i){var o=nA(e,r++);56320==(64512&o)?aA(t,((1023&n)<<10)+(1023&o)+65536):(aA(t,n),r--)}else aA(t,n)}return t}(e);var r,i,n=e.length,o=128,a=0,s=72;for(r=0;r<e.length;r++)(i=e[r])<128&&aA(t,iA(i));var c=t.length,u=c;for(c&&aA(t,"-");u<n;){var d=JT;for(r=0;r<e.length;r++)(i=e[r])>=o&&i<d&&(d=i);var l=u+1;if(d-o>rA((JT-a)/l))throw eA($T);for(a+=(d-o)*l,o=d,r=0;r<e.length;r++){if((i=e[r])<o&&++a>JT)throw eA($T);if(i==o){for(var h=a,p=36;;){var f=p<=s?1:p>=s+26?26:p-s;if(h<f)break;var _=h-f,v=36-f;aA(t,iA(dA(f+_%v))),h=rA(_/v),p+=36}aA(t,iA(dA(h))),s=lA(a,l,u==c),a=0,u++}}a++,o++}return oA(t,"")},pA=Ro,fA=Math.floor,_A=function(e,t){var r=e.length,i=fA(r/2);return r<8?vA(e,t):mA(e,_A(pA(e,0,i),t),_A(pA(e,i),t),t)},vA=function(e,t){for(var r,i,n=e.length,o=1;o<n;){for(i=o,r=e[o];i&&t(e[i-1],r)>0;)e[i]=e[--i];i!==o++&&(e[i]=r)}return e},mA=function(e,t,r,i){for(var n=t.length,o=r.length,a=0,s=0;a<n||s<o;)e[a+s]=a<n&&s<o?i(t[a],r[s])<=0?t[a++]:r[s++]:a<n?t[a++]:r[s++];return e},yA=_A,gA=Xi,SA=o,EA=X,bA=h,IA=A,TA=qT,AA=Yt.exports,RA=nc,CA=Ho,OA=Ph,wA=wr,kA=hc,NA=j,PA=Ve,DA=Xo,MA=ho,LA=Mt,UA=H,xA=_o,VA=Rn,FA=g,BA=wc,jA=bc,GA=hu,HA=yA,zA=et("iterator"),KA="URLSearchParams",WA="URLSearchParamsIterator",XA=wA.set,qA=wA.getterFor(KA),YA=wA.getterFor(WA),JA=EA("fetch"),QA=EA("Request"),ZA=EA("Headers"),$A=QA&&QA.prototype,eR=ZA&&ZA.prototype,tR=SA.RegExp,rR=SA.TypeError,iR=SA.decodeURIComponent,nR=SA.encodeURIComponent,oR=IA("".charAt),aR=IA([].join),sR=IA([].push),cR=IA("".replace),uR=IA([].shift),dR=IA([].splice),lR=IA("".split),hR=IA("".slice),pR=/\+/g,fR=Array(4),_R=function(e){return fR[e-1]||(fR[e-1]=tR("((?:%[\\da-f]{2}){"+e+"})","gi"))},vR=function(e){try{return iR(e)}catch(t){return e}},mR=function(e){var t=cR(e,pR," "),r=4;try{return iR(t)}catch(e){for(;r;)t=cR(t,_R(r--),vR);return t}},yR=/[!'()~]|%20/g,gR={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+"},SR=function(e){return gR[e]},ER=function(e){return cR(nR(e),yR,SR)},bR=OA((function(e,t){XA(this,{type:WA,iterator:BA(qA(e).entries),kind:t})}),"Iterator",(function(){var e=YA(this),t=e.kind,r=e.iterator.next(),i=r.value;return r.done||(r.value="keys"===t?i.key:"values"===t?i.value:[i.key,i.value]),r}),!0),IR=function(e){this.entries=[],this.url=null,void 0!==e&&(UA(e)?this.parseObject(e):this.parseQuery("string"==typeof e?"?"===oR(e,0)?hR(e,1):e:xA(e)))};IR.prototype={type:KA,bindURL:function(e){this.url=e,this.update()},parseObject:function(e){var t,r,i,n,o,a,s,c=jA(e);if(c)for(r=(t=BA(e,c)).next;!(i=bA(r,t)).done;){if(o=(n=BA(LA(i.value))).next,(a=bA(o,n)).done||(s=bA(o,n)).done||!bA(o,n).done)throw rR("Expected sequence with length 2");sR(this.entries,{key:xA(a.value),value:xA(s.value)})}else for(var u in e)PA(e,u)&&sR(this.entries,{key:u,value:xA(e[u])})},parseQuery:function(e){if(e)for(var t,r,i=lR(e,"&"),n=0;n<i.length;)(t=i[n++]).length&&(r=lR(t,"="),sR(this.entries,{key:mR(uR(r)),value:mR(aR(r,"="))}))},serialize:function(){for(var e,t=this.entries,r=[],i=0;i<t.length;)e=t[i++],sR(r,ER(e.key)+"="+ER(e.value));return aR(r,"&")},update:function(){this.entries.length=0,this.parseQuery(this.url.query)},updateURL:function(){this.url&&this.url.update()}};var TR=function(){kA(this,AR);var e=arguments.length>0?arguments[0]:void 0;XA(this,new IR(e))},AR=TR.prototype;if(RA(AR,{append:function(e,t){GA(arguments.length,2);var r=qA(this);sR(r.entries,{key:xA(e),value:xA(t)}),r.updateURL()},delete:function(e){GA(arguments.length,1);for(var t=qA(this),r=t.entries,i=xA(e),n=0;n<r.length;)r[n].key===i?dR(r,n,1):n++;t.updateURL()},get:function(e){GA(arguments.length,1);for(var t=qA(this).entries,r=xA(e),i=0;i<t.length;i++)if(t[i].key===r)return t[i].value;return null},getAll:function(e){GA(arguments.length,1);for(var t=qA(this).entries,r=xA(e),i=[],n=0;n<t.length;n++)t[n].key===r&&sR(i,t[n].value);return i},has:function(e){GA(arguments.length,1);for(var t=qA(this).entries,r=xA(e),i=0;i<t.length;)if(t[i++].key===r)return!0;return!1},set:function(e,t){GA(arguments.length,1);for(var r,i=qA(this),n=i.entries,o=!1,a=xA(e),s=xA(t),c=0;c<n.length;c++)(r=n[c]).key===a&&(o?dR(n,c--,1):(o=!0,r.value=s));o||sR(n,{key:a,value:s}),i.updateURL()},sort:function(){var e=qA(this);HA(e.entries,(function(e,t){return e.key>t.key?1:-1})),e.updateURL()},forEach:function(e){for(var t,r=qA(this).entries,i=DA(e,arguments.length>1?arguments[1]:void 0),n=0;n<r.length;)i((t=r[n++]).value,t.key,this)},keys:function(){return new bR(this,"keys")},values:function(){return new bR(this,"values")},entries:function(){return new bR(this,"entries")}},{enumerable:!0}),AA(AR,zA,AR.entries,{name:"entries"}),AA(AR,"toString",(function(){return qA(this).serialize()}),{enumerable:!0}),CA(TR,KA),gA({global:!0,forced:!TA},{URLSearchParams:TR}),!TA&&NA(ZA)){var RR=IA(eR.has),CR=IA(eR.set),OR=function(e){if(UA(e)){var t,r=e.body;if(MA(r)===KA)return t=e.headers?new ZA(e.headers):new ZA,RR(t,"content-type")||CR(t,"content-type","application/x-www-form-urlencoded;charset=UTF-8"),VA(e,{body:FA(0,xA(r)),headers:FA(0,t)})}return e};if(NA(JA)&&gA({global:!0,enumerable:!0,forced:!0},{fetch:function(e){return JA(e,arguments.length>1?OR(arguments[1]):{})}}),NA(QA)){var wR=function(e){return kA(this,$A),new QA(e,arguments.length>1?OR(arguments[1]):{})};$A.constructor=wR,wR.prototype=$A,gA({global:!0,forced:!0},{Request:wR})}}var kR,NR={URLSearchParams:TR,getState:qA},PR=Xi,DR=c,MR=qT,LR=o,UR=Xo,xR=A,VR=rn.f,FR=Yt.exports,BR=hc,jR=Ve,GR=Fn,HR=zT,zR=Ro,KR=Sp.codeAt,WR=function(e){var t,r,i=[],n=cA(sA(uA(e),ZT,"."),".");for(t=0;t<n.length;t++)r=n[t],aA(i,tA(QT,r)?"xn--"+hA(r):r);return oA(i,".")},XR=_o,qR=Ho,YR=hu,JR=NR,QR=wr,ZR=QR.set,$R=QR.getterFor("URL"),eC=JR.URLSearchParams,tC=JR.getState,rC=LR.URL,iC=LR.TypeError,nC=LR.parseInt,oC=Math.floor,aC=Math.pow,sC=xR("".charAt),cC=xR(/./.exec),uC=xR([].join),dC=xR(1..toString),lC=xR([].pop),hC=xR([].push),pC=xR("".replace),fC=xR([].shift),_C=xR("".split),vC=xR("".slice),mC=xR("".toLowerCase),yC=xR([].unshift),gC="Invalid scheme",SC="Invalid host",EC="Invalid port",bC=/[a-z]/i,IC=/[\d+-.a-z]/i,TC=/\d/,AC=/^0x/i,RC=/^[0-7]+$/,CC=/^\d+$/,OC=/^[\da-f]+$/i,wC=/[\0\t\n\r #%/:<>?@[\\\]^|]/,kC=/[\0\t\n\r #/:<>?@[\\\]^|]/,NC=/^[\u0000-\u0020]+|[\u0000-\u0020]+$/g,PC=/[\t\n\r]/g,DC=function(e){var t,r,i,n;if("number"==typeof e){for(t=[],r=0;r<4;r++)yC(t,e%256),e=oC(e/256);return uC(t,".")}if("object"==typeof e){for(t="",i=function(e){for(var t=null,r=1,i=null,n=0,o=0;o<8;o++)0!==e[o]?(n>r&&(t=i,r=n),i=null,n=0):(null===i&&(i=o),++n);return n>r&&(t=i,r=n),t}(e),r=0;r<8;r++)n&&0===e[r]||(n&&(n=!1),i===r?(t+=r?":":"::",n=!0):(t+=dC(e[r],16),r<7&&(t+=":")));return"["+t+"]"}return e},MC={},LC=GR({},MC,{" ":1,'"':1,"<":1,">":1,"`":1}),UC=GR({},LC,{"#":1,"?":1,"{":1,"}":1}),xC=GR({},UC,{"/":1,":":1,";":1,"=":1,"@":1,"[":1,"\\":1,"]":1,"^":1,"|":1}),VC=function(e,t){var r=KR(e,0);return r>32&&r<127&&!jR(t,e)?e:encodeURIComponent(e)},FC={ftp:21,file:null,http:80,https:443,ws:80,wss:443},BC=function(e,t){var r;return 2==e.length&&cC(bC,sC(e,0))&&(":"==(r=sC(e,1))||!t&&"|"==r)},jC=function(e){var t;return e.length>1&&BC(vC(e,0,2))&&(2==e.length||"/"===(t=sC(e,2))||"\\"===t||"?"===t||"#"===t)},GC=function(e){return"."===e||"%2e"===mC(e)},HC={},zC={},KC={},WC={},XC={},qC={},YC={},JC={},QC={},ZC={},$C={},eO={},tO={},rO={},iO={},nO={},oO={},aO={},sO={},cO={},uO={},dO=function(e,t,r){var i,n,o,a=XR(e);if(t){if(n=this.parse(a))throw iC(n);this.searchParams=null}else{if(void 0!==r&&(i=new dO(r,!0)),n=this.parse(a,null,i))throw iC(n);(o=tC(new eC)).bindURL(this),this.searchParams=o}};dO.prototype={type:"URL",parse:function(e,t,r){var i,n,o,a,s,c=this,u=t||HC,d=0,l="",h=!1,p=!1,f=!1;for(e=XR(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=pC(e,NC,"")),e=pC(e,PC,""),i=HR(e);d<=i.length;){switch(n=i[d],u){case HC:if(!n||!cC(bC,n)){if(t)return gC;u=KC;continue}l+=mC(n),u=zC;break;case zC:if(n&&(cC(IC,n)||"+"==n||"-"==n||"."==n))l+=mC(n);else{if(":"!=n){if(t)return gC;l="",u=KC,d=0;continue}if(t&&(c.isSpecial()!=jR(FC,l)||"file"==l&&(c.includesCredentials()||null!==c.port)||"file"==c.scheme&&!c.host))return;if(c.scheme=l,t)return void(c.isSpecial()&&FC[c.scheme]==c.port&&(c.port=null));l="","file"==c.scheme?u=rO:c.isSpecial()&&r&&r.scheme==c.scheme?u=WC:c.isSpecial()?u=JC:"/"==i[d+1]?(u=XC,d++):(c.cannotBeABaseURL=!0,hC(c.path,""),u=sO)}break;case KC:if(!r||r.cannotBeABaseURL&&"#"!=n)return gC;if(r.cannotBeABaseURL&&"#"==n){c.scheme=r.scheme,c.path=zR(r.path),c.query=r.query,c.fragment="",c.cannotBeABaseURL=!0,u=uO;break}u="file"==r.scheme?rO:qC;continue;case WC:if("/"!=n||"/"!=i[d+1]){u=qC;continue}u=QC,d++;break;case XC:if("/"==n){u=ZC;break}u=aO;continue;case qC:if(c.scheme=r.scheme,n==kR)c.username=r.username,c.password=r.password,c.host=r.host,c.port=r.port,c.path=zR(r.path),c.query=r.query;else if("/"==n||"\\"==n&&c.isSpecial())u=YC;else if("?"==n)c.username=r.username,c.password=r.password,c.host=r.host,c.port=r.port,c.path=zR(r.path),c.query="",u=cO;else{if("#"!=n){c.username=r.username,c.password=r.password,c.host=r.host,c.port=r.port,c.path=zR(r.path),c.path.length--,u=aO;continue}c.username=r.username,c.password=r.password,c.host=r.host,c.port=r.port,c.path=zR(r.path),c.query=r.query,c.fragment="",u=uO}break;case YC:if(!c.isSpecial()||"/"!=n&&"\\"!=n){if("/"!=n){c.username=r.username,c.password=r.password,c.host=r.host,c.port=r.port,u=aO;continue}u=ZC}else u=QC;break;case JC:if(u=QC,"/"!=n||"/"!=sC(l,d+1))continue;d++;break;case QC:if("/"!=n&&"\\"!=n){u=ZC;continue}break;case ZC:if("@"==n){h&&(l="%40"+l),h=!0,o=HR(l);for(var _=0;_<o.length;_++){var v=o[_];if(":"!=v||f){var m=VC(v,xC);f?c.password+=m:c.username+=m}else f=!0}l=""}else if(n==kR||"/"==n||"?"==n||"#"==n||"\\"==n&&c.isSpecial()){if(h&&""==l)return"Invalid authority";d-=HR(l).length+1,l="",u=$C}else l+=n;break;case $C:case eO:if(t&&"file"==c.scheme){u=nO;continue}if(":"!=n||p){if(n==kR||"/"==n||"?"==n||"#"==n||"\\"==n&&c.isSpecial()){if(c.isSpecial()&&""==l)return SC;if(t&&""==l&&(c.includesCredentials()||null!==c.port))return;if(a=c.parseHost(l))return a;if(l="",u=oO,t)return;continue}"["==n?p=!0:"]"==n&&(p=!1),l+=n}else{if(""==l)return SC;if(a=c.parseHost(l))return a;if(l="",u=tO,t==eO)return}break;case tO:if(!cC(TC,n)){if(n==kR||"/"==n||"?"==n||"#"==n||"\\"==n&&c.isSpecial()||t){if(""!=l){var y=nC(l,10);if(y>65535)return EC;c.port=c.isSpecial()&&y===FC[c.scheme]?null:y,l=""}if(t)return;u=oO;continue}return EC}l+=n;break;case rO:if(c.scheme="file","/"==n||"\\"==n)u=iO;else{if(!r||"file"!=r.scheme){u=aO;continue}if(n==kR)c.host=r.host,c.path=zR(r.path),c.query=r.query;else if("?"==n)c.host=r.host,c.path=zR(r.path),c.query="",u=cO;else{if("#"!=n){jC(uC(zR(i,d),""))||(c.host=r.host,c.path=zR(r.path),c.shortenPath()),u=aO;continue}c.host=r.host,c.path=zR(r.path),c.query=r.query,c.fragment="",u=uO}}break;case iO:if("/"==n||"\\"==n){u=nO;break}r&&"file"==r.scheme&&!jC(uC(zR(i,d),""))&&(BC(r.path[0],!0)?hC(c.path,r.path[0]):c.host=r.host),u=aO;continue;case nO:if(n==kR||"/"==n||"\\"==n||"?"==n||"#"==n){if(!t&&BC(l))u=aO;else if(""==l){if(c.host="",t)return;u=oO}else{if(a=c.parseHost(l))return a;if("localhost"==c.host&&(c.host=""),t)return;l="",u=oO}continue}l+=n;break;case oO:if(c.isSpecial()){if(u=aO,"/"!=n&&"\\"!=n)continue}else if(t||"?"!=n)if(t||"#"!=n){if(n!=kR&&(u=aO,"/"!=n))continue}else c.fragment="",u=uO;else c.query="",u=cO;break;case aO:if(n==kR||"/"==n||"\\"==n&&c.isSpecial()||!t&&("?"==n||"#"==n)){if(".."===(s=mC(s=l))||"%2e."===s||".%2e"===s||"%2e%2e"===s?(c.shortenPath(),"/"==n||"\\"==n&&c.isSpecial()||hC(c.path,"")):GC(l)?"/"==n||"\\"==n&&c.isSpecial()||hC(c.path,""):("file"==c.scheme&&!c.path.length&&BC(l)&&(c.host&&(c.host=""),l=sC(l,0)+":"),hC(c.path,l)),l="","file"==c.scheme&&(n==kR||"?"==n||"#"==n))for(;c.path.length>1&&""===c.path[0];)fC(c.path);"?"==n?(c.query="",u=cO):"#"==n&&(c.fragment="",u=uO)}else l+=VC(n,UC);break;case sO:"?"==n?(c.query="",u=cO):"#"==n?(c.fragment="",u=uO):n!=kR&&(c.path[0]+=VC(n,MC));break;case cO:t||"#"!=n?n!=kR&&("'"==n&&c.isSpecial()?c.query+="%27":c.query+="#"==n?"%23":VC(n,MC)):(c.fragment="",u=uO);break;case uO:n!=kR&&(c.fragment+=VC(n,LC))}d++}},parseHost:function(e){var t,r,i;if("["==sC(e,0)){if("]"!=sC(e,e.length-1))return SC;if(t=function(e){var t,r,i,n,o,a,s,c=[0,0,0,0,0,0,0,0],u=0,d=null,l=0,h=function(){return sC(e,l)};if(":"==h()){if(":"!=sC(e,1))return;l+=2,d=++u}for(;h();){if(8==u)return;if(":"!=h()){for(t=r=0;r<4&&cC(OC,h());)t=16*t+nC(h(),16),l++,r++;if("."==h()){if(0==r)return;if(l-=r,u>6)return;for(i=0;h();){if(n=null,i>0){if(!("."==h()&&i<4))return;l++}if(!cC(TC,h()))return;for(;cC(TC,h());){if(o=nC(h(),10),null===n)n=o;else{if(0==n)return;n=10*n+o}if(n>255)return;l++}c[u]=256*c[u]+n,2!=++i&&4!=i||u++}if(4!=i)return;break}if(":"==h()){if(l++,!h())return}else if(h())return;c[u++]=t}else{if(null!==d)return;l++,d=++u}}if(null!==d)for(a=u-d,u=7;0!=u&&a>0;)s=c[u],c[u--]=c[d+a-1],c[d+--a]=s;else if(8!=u)return;return c}(vC(e,1,-1)),!t)return SC;this.host=t}else if(this.isSpecial()){if(e=WR(e),cC(wC,e))return SC;if(t=function(e){var t,r,i,n,o,a,s,c=_C(e,".");if(c.length&&""==c[c.length-1]&&c.length--,(t=c.length)>4)return e;for(r=[],i=0;i<t;i++){if(""==(n=c[i]))return e;if(o=10,n.length>1&&"0"==sC(n,0)&&(o=cC(AC,n)?16:8,n=vC(n,8==o?1:2)),""===n)a=0;else{if(!cC(10==o?CC:8==o?RC:OC,n))return e;a=nC(n,o)}hC(r,a)}for(i=0;i<t;i++)if(a=r[i],i==t-1){if(a>=aC(256,5-t))return null}else if(a>255)return null;for(s=lC(r),i=0;i<r.length;i++)s+=r[i]*aC(256,3-i);return s}(e),null===t)return SC;this.host=t}else{if(cC(kC,e))return SC;for(t="",r=HR(e),i=0;i<r.length;i++)t+=VC(r[i],MC);this.host=t}},cannotHaveUsernamePasswordPort:function(){return!this.host||this.cannotBeABaseURL||"file"==this.scheme},includesCredentials:function(){return""!=this.username||""!=this.password},isSpecial:function(){return jR(FC,this.scheme)},shortenPath:function(){var e=this.path,t=e.length;!t||"file"==this.scheme&&1==t&&BC(e[0],!0)||e.length--},serialize:function(){var e=this,t=e.scheme,r=e.username,i=e.password,n=e.host,o=e.port,a=e.path,s=e.query,c=e.fragment,u=t+":";return null!==n?(u+="//",e.includesCredentials()&&(u+=r+(i?":"+i:"")+"@"),u+=DC(n),null!==o&&(u+=":"+o)):"file"==t&&(u+="//"),u+=e.cannotBeABaseURL?a[0]:a.length?"/"+uC(a,"/"):"",null!==s&&(u+="?"+s),null!==c&&(u+="#"+c),u},setHref:function(e){var t=this.parse(e);if(t)throw iC(t);this.searchParams.update()},getOrigin:function(){var e=this.scheme,t=this.port;if("blob"==e)try{return new lO(e.path[0]).origin}catch(e){return"null"}return"file"!=e&&this.isSpecial()?e+"://"+DC(this.host)+(null!==t?":"+t:""):"null"},getProtocol:function(){return this.scheme+":"},setProtocol:function(e){this.parse(XR(e)+":",HC)},getUsername:function(){return this.username},setUsername:function(e){var t=HR(XR(e));if(!this.cannotHaveUsernamePasswordPort()){this.username="";for(var r=0;r<t.length;r++)this.username+=VC(t[r],xC)}},getPassword:function(){return this.password},setPassword:function(e){var t=HR(XR(e));if(!this.cannotHaveUsernamePasswordPort()){this.password="";for(var r=0;r<t.length;r++)this.password+=VC(t[r],xC)}},getHost:function(){var e=this.host,t=this.port;return null===e?"":null===t?DC(e):DC(e)+":"+t},setHost:function(e){this.cannotBeABaseURL||this.parse(e,$C)},getHostname:function(){var e=this.host;return null===e?"":DC(e)},setHostname:function(e){this.cannotBeABaseURL||this.parse(e,eO)},getPort:function(){var e=this.port;return null===e?"":XR(e)},setPort:function(e){this.cannotHaveUsernamePasswordPort()||(""==(e=XR(e))?this.port=null:this.parse(e,tO))},getPathname:function(){var e=this.path;return this.cannotBeABaseURL?e[0]:e.length?"/"+uC(e,"/"):""},setPathname:function(e){this.cannotBeABaseURL||(this.path=[],this.parse(e,oO))},getSearch:function(){var e=this.query;return e?"?"+e:""},setSearch:function(e){""==(e=XR(e))?this.query=null:("?"==sC(e,0)&&(e=vC(e,1)),this.query="",this.parse(e,cO)),this.searchParams.update()},getSearchParams:function(){return this.searchParams.facade},getHash:function(){var e=this.fragment;return e?"#"+e:""},setHash:function(e){""!=(e=XR(e))?("#"==sC(e,0)&&(e=vC(e,1)),this.fragment="",this.parse(e,uO)):this.fragment=null},update:function(){this.query=this.searchParams.serialize()||null}};var lO=function(e){var t=BR(this,hO),r=YR(arguments.length,1)>1?arguments[1]:void 0,i=ZR(t,new dO(e,!1,r));DR||(t.href=i.serialize(),t.origin=i.getOrigin(),t.protocol=i.getProtocol(),t.username=i.getUsername(),t.password=i.getPassword(),t.host=i.getHost(),t.hostname=i.getHostname(),t.port=i.getPort(),t.pathname=i.getPathname(),t.search=i.getSearch(),t.searchParams=i.getSearchParams(),t.hash=i.getHash())},hO=lO.prototype,pO=function(e,t){return{get:function(){return $R(this)[e]()},set:t&&function(e){return $R(this)[t](e)},configurable:!0,enumerable:!0}};if(DR&&VR(hO,{href:pO("serialize","setHref"),origin:pO("getOrigin"),protocol:pO("getProtocol","setProtocol"),username:pO("getUsername","setUsername"),password:pO("getPassword","setPassword"),host:pO("getHost","setHost"),hostname:pO("getHostname","setHostname"),port:pO("getPort","setPort"),pathname:pO("getPathname","setPathname"),search:pO("getSearch","setSearch"),searchParams:pO("getSearchParams"),hash:pO("getHash","setHash")}),FR(hO,"toJSON",(function(){return $R(this).serialize()}),{enumerable:!0}),FR(hO,"toString",(function(){return $R(this).serialize()}),{enumerable:!0}),rC){var fO=rC.createObjectURL,_O=rC.revokeObjectURL;fO&&FR(lO,"createObjectURL",UR(fO,rC)),_O&&FR(lO,"revokeObjectURL",UR(_O,rC))}qR(lO,"URL"),PR({global:!0,forced:!MR,sham:!DR},{URL:lO});var vO=Xi,mO=o,yO=h,gO=A,SO=x,EO=j,bO=w_,IO=_o,TO=Se,AO=G_,RO=Yg,CO=et("replace"),OO=RegExp.prototype,wO=mO.TypeError,kO=gO(AO),NO=gO("".indexOf);gO("".replace);var PO=gO("".slice),DO=Math.max,MO=function(e,t,r){return r>e.length?-1:""===t?r:NO(e,t,r)};vO({target:"String",proto:!0},{replaceAll:function(e,t){var r,i,n,o,a,s,c,u,d=SO(this),l=0,h=0,p="";if(null!=e){if(bO(e)&&(r=IO(SO("flags"in OO?e.flags:kO(e))),!~NO(r,"g")))throw wO("`.replaceAll` does not allow non-global regexes");if(i=TO(e,CO))return yO(i,e,d,t)}for(n=IO(d),o=IO(e),(a=EO(t))||(t=IO(t)),s=o.length,c=DO(1,s),l=MO(n,o,0);-1!==l;)u=a?IO(t(o,l,n)):RO(o,n,l,[],void 0,t),p+=PO(n,h,l)+u,h=l+s,l=MO(n,o,l+c);return h<n.length&&(p+=PO(n,h)),p}});var LO="undefined"!=typeof ArrayBuffer&&"undefined"!=typeof DataView,UO=Yr,xO=ri,VO=o.RangeError,FO=function(e){if(void 0===e)return 0;var t=UO(e),r=xO(t);if(t!==r)throw VO("Wrong length or index");return r},BO=o.Array,jO=Math.abs,GO=Math.pow,HO=Math.floor,zO=Math.log,KO=Math.LN2,WO={pack:function(e,t,r){var i,n,o,a=BO(r),s=8*r-t-1,c=(1<<s)-1,u=c>>1,d=23===t?GO(2,-24)-GO(2,-77):0,l=e<0||0===e&&1/e<0?1:0,h=0;for((e=jO(e))!=e||e===1/0?(n=e!=e?1:0,i=c):(i=HO(zO(e)/KO),e*(o=GO(2,-i))<1&&(i--,o*=2),(e+=i+u>=1?d/o:d*GO(2,1-u))*o>=2&&(i++,o/=2),i+u>=c?(n=0,i=c):i+u>=1?(n=(e*o-1)*GO(2,t),i+=u):(n=e*GO(2,u-1)*GO(2,t),i=0));t>=8;)a[h++]=255&n,n/=256,t-=8;for(i=i<<t|n,s+=t;s>0;)a[h++]=255&i,i/=256,s-=8;return a[--h]|=128*l,a},unpack:function(e,t){var r,i=e.length,n=8*i-t-1,o=(1<<n)-1,a=o>>1,s=n-7,c=i-1,u=e[c--],d=127&u;for(u>>=7;s>0;)d=256*d+e[c--],s-=8;for(r=d&(1<<-s)-1,d>>=-s,s+=t;s>0;)r=256*r+e[c--],s-=8;if(0===d)d=1-a;else{if(d===o)return r?NaN:u?-1/0:1/0;r+=GO(2,t),d-=a}return(u?-1:1)*r*GO(2,d-t)}},XO=Le,qO=$r,YO=ni,JO=function(e){for(var t=XO(this),r=YO(t),i=arguments.length,n=qO(i>1?arguments[1]:void 0,r),o=i>2?arguments[2]:void 0,a=void 0===o?r:qO(o,r);a>n;)t[n++]=e;return t},QO=o,ZO=A,$O=c,ew=LO,tw=Lr,rw=qt,iw=nc,nw=s,ow=hc,aw=Yr,sw=ri,cw=FO,uw=WO,dw=mh,lw=tn,hw=Wr.f,pw=Ot.f,fw=JO,_w=Ro,vw=Ho,mw=tw.PROPER,yw=tw.CONFIGURABLE,gw=wr.get,Sw=wr.set,Ew="ArrayBuffer",bw="DataView",Iw="Wrong index",Tw=QO.ArrayBuffer,Aw=Tw,Rw=Aw&&Aw.prototype,Cw=QO.DataView,Ow=Cw&&Cw.prototype,ww=Object.prototype,kw=QO.Array,Nw=QO.RangeError,Pw=ZO(fw),Dw=ZO([].reverse),Mw=uw.pack,Lw=uw.unpack,Uw=function(e){return[255&e]},xw=function(e){return[255&e,e>>8&255]},Vw=function(e){return[255&e,e>>8&255,e>>16&255,e>>24&255]},Fw=function(e){return e[3]<<24|e[2]<<16|e[1]<<8|e[0]},Bw=function(e){return Mw(e,23,4)},jw=function(e){return Mw(e,52,8)},Gw=function(e,t){pw(e.prototype,t,{get:function(){return gw(this)[t]}})},Hw=function(e,t,r,i){var n=cw(r),o=gw(e);if(n+t>o.byteLength)throw Nw(Iw);var a=gw(o.buffer).bytes,s=n+o.byteOffset,c=_w(a,s,s+t);return i?c:Dw(c)},zw=function(e,t,r,i,n,o){var a=cw(r),s=gw(e);if(a+t>s.byteLength)throw Nw(Iw);for(var c=gw(s.buffer).bytes,u=a+s.byteOffset,d=i(+n),l=0;l<t;l++)c[u+l]=d[o?l:t-l-1]};if(ew){var Kw=mw&&Tw.name!==Ew;if(nw((function(){Tw(1)}))&&nw((function(){new Tw(-1)}))&&!nw((function(){return new Tw,new Tw(1.5),new Tw(NaN),Kw&&!yw})))Kw&&yw&&rw(Tw,"name",Ew);else{(Aw=function(e){return ow(this,Rw),new Tw(cw(e))}).prototype=Rw;for(var Ww,Xw=hw(Tw),qw=0;Xw.length>qw;)(Ww=Xw[qw++])in Aw||rw(Aw,Ww,Tw[Ww]);Rw.constructor=Aw}lw&&dw(Ow)!==ww&&lw(Ow,ww);var Yw=new Cw(new Aw(2)),Jw=ZO(Ow.setInt8);Yw.setInt8(0,2147483648),Yw.setInt8(1,2147483649),!Yw.getInt8(0)&&Yw.getInt8(1)||iw(Ow,{setInt8:function(e,t){Jw(this,e,t<<24>>24)},setUint8:function(e,t){Jw(this,e,t<<24>>24)}},{unsafe:!0})}else Rw=(Aw=function(e){ow(this,Rw);var t=cw(e);Sw(this,{bytes:Pw(kw(t),0),byteLength:t}),$O||(this.byteLength=t)}).prototype,Ow=(Cw=function(e,t,r){ow(this,Ow),ow(e,Rw);var i=gw(e).byteLength,n=aw(t);if(n<0||n>i)throw Nw("Wrong offset");if(n+(r=void 0===r?i-n:sw(r))>i)throw Nw("Wrong length");Sw(this,{buffer:e,byteLength:r,byteOffset:n}),$O||(this.buffer=e,this.byteLength=r,this.byteOffset=n)}).prototype,$O&&(Gw(Aw,"byteLength"),Gw(Cw,"buffer"),Gw(Cw,"byteLength"),Gw(Cw,"byteOffset")),iw(Ow,{getInt8:function(e){return Hw(this,1,e)[0]<<24>>24},getUint8:function(e){return Hw(this,1,e)[0]},getInt16:function(e){var t=Hw(this,2,e,arguments.length>1?arguments[1]:void 0);return(t[1]<<8|t[0])<<16>>16},getUint16:function(e){var t=Hw(this,2,e,arguments.length>1?arguments[1]:void 0);return t[1]<<8|t[0]},getInt32:function(e){return Fw(Hw(this,4,e,arguments.length>1?arguments[1]:void 0))},getUint32:function(e){return Fw(Hw(this,4,e,arguments.length>1?arguments[1]:void 0))>>>0},getFloat32:function(e){return Lw(Hw(this,4,e,arguments.length>1?arguments[1]:void 0),23)},getFloat64:function(e){return Lw(Hw(this,8,e,arguments.length>1?arguments[1]:void 0),52)},setInt8:function(e,t){zw(this,1,e,Uw,t)},setUint8:function(e,t){zw(this,1,e,Uw,t)},setInt16:function(e,t){zw(this,2,e,xw,t,arguments.length>2?arguments[2]:void 0)},setUint16:function(e,t){zw(this,2,e,xw,t,arguments.length>2?arguments[2]:void 0)},setInt32:function(e,t){zw(this,4,e,Vw,t,arguments.length>2?arguments[2]:void 0)},setUint32:function(e,t){zw(this,4,e,Vw,t,arguments.length>2?arguments[2]:void 0)},setFloat32:function(e,t){zw(this,4,e,Bw,t,arguments.length>2?arguments[2]:void 0)},setFloat64:function(e,t){zw(this,8,e,jw,t,arguments.length>2?arguments[2]:void 0)}});vw(Aw,Ew),vw(Cw,bw);var Qw={ArrayBuffer:Aw,DataView:Cw},Zw=Xi,$w=A,ek=s,tk=Mt,rk=$r,ik=ri,nk=du,ok=Qw.ArrayBuffer,ak=Qw.DataView,sk=ak.prototype,ck=$w(ok.prototype.slice),uk=$w(sk.getUint8),dk=$w(sk.setUint8);Zw({target:"ArrayBuffer",proto:!0,unsafe:!0,forced:ek((function(){return!new ok(2).slice(1,void 0).byteLength}))},{slice:function(e,t){if(ck&&void 0===t)return ck(tk(this),e);for(var r=tk(this).byteLength,i=rk(e,r),n=rk(void 0===t?r:t,r),o=new(nk(this,ok))(ik(n-i)),a=new ak(this),s=new ak(o),c=0;i<n;)dk(s,c++,uk(a,i++));return o}});var lk,hk,pk,fk={exports:{}},_k=LO,vk=c,mk=o,yk=j,gk=H,Sk=Ve,Ek=ho,bk=fe,Ik=qt,Tk=Yt.exports,Ak=Ot.f,Rk=q,Ck=mh,Ok=tn,wk=et,kk=He,Nk=mk.Int8Array,Pk=Nk&&Nk.prototype,Dk=mk.Uint8ClampedArray,Mk=Dk&&Dk.prototype,Lk=Nk&&Ck(Nk),Uk=Pk&&Ck(Pk),xk=Object.prototype,Vk=mk.TypeError,Fk=wk("toStringTag"),Bk=kk("TYPED_ARRAY_TAG"),jk=kk("TYPED_ARRAY_CONSTRUCTOR"),Gk=_k&&!!Ok&&"Opera"!==Ek(mk.opera),Hk=!1,zk={Int8Array:1,Uint8Array:1,Uint8ClampedArray:1,Int16Array:2,Uint16Array:2,Int32Array:4,Uint32Array:4,Float32Array:4,Float64Array:8},Kk={BigInt64Array:8,BigUint64Array:8},Wk=function(e){if(!gk(e))return!1;var t=Ek(e);return Sk(zk,t)||Sk(Kk,t)};for(lk in zk)(pk=(hk=mk[lk])&&hk.prototype)?Ik(pk,jk,hk):Gk=!1;for(lk in Kk)(pk=(hk=mk[lk])&&hk.prototype)&&Ik(pk,jk,hk);if((!Gk||!yk(Lk)||Lk===Function.prototype)&&(Lk=function(){throw Vk("Incorrect invocation")},Gk))for(lk in zk)mk[lk]&&Ok(mk[lk],Lk);if((!Gk||!Uk||Uk===xk)&&(Uk=Lk.prototype,Gk))for(lk in zk)mk[lk]&&Ok(mk[lk].prototype,Uk);if(Gk&&Ck(Mk)!==Uk&&Ok(Mk,Uk),vk&&!Sk(Uk,Fk))for(lk in Hk=!0,Ak(Uk,Fk,{get:function(){return gk(this)?this[Bk]:void 0}}),zk)mk[lk]&&Ik(mk[lk],Bk,lk);var Xk={NATIVE_ARRAY_BUFFER_VIEWS:Gk,TYPED_ARRAY_CONSTRUCTOR:jk,TYPED_ARRAY_TAG:Hk&&Bk,aTypedArray:function(e){if(Wk(e))return e;throw Vk("Target is not a typed array")},aTypedArrayConstructor:function(e){if(yk(e)&&(!Ok||Rk(Lk,e)))return e;throw Vk(bk(e)+" is not a typed array constructor")},exportTypedArrayMethod:function(e,t,r,i){if(vk){if(r)for(var n in zk){var o=mk[n];if(o&&Sk(o.prototype,e))try{delete o.prototype[e]}catch(r){try{o.prototype[e]=t}catch(e){}}}Uk[e]&&!r||Tk(Uk,e,r?t:Gk&&Pk[e]||t,i)}},exportTypedArrayStaticMethod:function(e,t,r){var i,n;if(vk){if(Ok){if(r)for(i in zk)if((n=mk[i])&&Sk(n,e))try{delete n[e]}catch(e){}if(Lk[e]&&!r)return;try{return Tk(Lk,e,r?t:Gk&&Lk[e]||t)}catch(e){}}for(i in zk)!(n=mk[i])||n[e]&&!r||Tk(n,e,t)}},isView:function(e){if(!gk(e))return!1;var t=Ek(e);return"DataView"===t||Sk(zk,t)||Sk(Kk,t)},isTypedArray:Wk,TypedArray:Lk,TypedArrayPrototype:Uk},qk=o,Yk=s,Jk=ru,Qk=Xk.NATIVE_ARRAY_BUFFER_VIEWS,Zk=qk.ArrayBuffer,$k=qk.Int8Array,eN=!Qk||!Yk((function(){$k(1)}))||!Yk((function(){new $k(-1)}))||!Jk((function(e){new $k,new $k(null),new $k(1.5),new $k(e)}),!0)||Yk((function(){return 1!==new $k(new Zk(2),1,void 0).length})),tN=H,rN=Math.floor,iN=Number.isInteger||function(e){return!tN(e)&&isFinite(e)&&rN(e)===e},nN=Yr,oN=o.RangeError,aN=function(e){var t=nN(e);if(t<0)throw oN("The argument can't be less than 0");return t},sN=o.RangeError,cN=function(e,t){var r=aN(e);if(r%t)throw sN("Wrong offset");return r},uN=Xo,dN=h,lN=au,hN=Le,pN=ni,fN=wc,_N=bc,vN=mc,mN=Xk.aTypedArrayConstructor,yN=Xi,gN=o,SN=h,EN=c,bN=eN,IN=Xk,TN=Qw,AN=hc,RN=g,CN=qt,ON=iN,wN=ri,kN=FO,NN=cN,PN=ht,DN=Ve,MN=ho,LN=H,UN=he,xN=Rn,VN=q,FN=tn,BN=Wr.f,jN=function(e){var t,r,i,n,o,a,s=lN(this),c=hN(e),u=arguments.length,d=u>1?arguments[1]:void 0,l=void 0!==d,h=_N(c);if(h&&!vN(h))for(a=(o=fN(c,h)).next,c=[];!(n=dN(a,o)).done;)c.push(n.value);for(l&&u>2&&(d=uN(d,arguments[2])),r=pN(c),i=new(mN(s))(r),t=0;r>t;t++)i[t]=l?d(c[t],t):c[t];return i},GN=Ia.forEach,HN=uc,zN=Ot,KN=a,WN=sy,XN=wr.get,qN=wr.set,YN=zN.f,JN=KN.f,QN=Math.round,ZN=gN.RangeError,$N=TN.ArrayBuffer,eP=$N.prototype,tP=TN.DataView,rP=IN.NATIVE_ARRAY_BUFFER_VIEWS,iP=IN.TYPED_ARRAY_CONSTRUCTOR,nP=IN.TYPED_ARRAY_TAG,oP=IN.TypedArray,aP=IN.TypedArrayPrototype,sP=IN.aTypedArrayConstructor,cP=IN.isTypedArray,uP="BYTES_PER_ELEMENT",dP="Wrong length",lP=function(e,t){sP(e);for(var r=0,i=t.length,n=new e(i);i>r;)n[r]=t[r++];return n},hP=function(e,t){YN(e,t,{get:function(){return XN(this)[t]}})},pP=function(e){var t;return VN(eP,e)||"ArrayBuffer"==(t=MN(e))||"SharedArrayBuffer"==t},fP=function(e,t){return cP(e)&&!UN(t)&&t in e&&ON(+t)&&t>=0},_P=function(e,t){return t=PN(t),fP(e,t)?RN(2,e[t]):JN(e,t)},vP=function(e,t,r){return t=PN(t),!(fP(e,t)&&LN(r)&&DN(r,"value"))||DN(r,"get")||DN(r,"set")||r.configurable||DN(r,"writable")&&!r.writable||DN(r,"enumerable")&&!r.enumerable?YN(e,t,r):(e[t]=r.value,e)};EN?(rP||(KN.f=_P,zN.f=vP,hP(aP,"buffer"),hP(aP,"byteOffset"),hP(aP,"byteLength"),hP(aP,"length")),yN({target:"Object",stat:!0,forced:!rP},{getOwnPropertyDescriptor:_P,defineProperty:vP}),fk.exports=function(e,t,r){var i=e.match(/\d+$/)[0]/8,n=e+(r?"Clamped":"")+"Array",o="get"+e,a="set"+e,s=gN[n],c=s,u=c&&c.prototype,d={},l=function(e,t){YN(e,t,{get:function(){return function(e,t){var r=XN(e);return r.view[o](t*i+r.byteOffset,!0)}(this,t)},set:function(e){return function(e,t,n){var o=XN(e);r&&(n=(n=QN(n))<0?0:n>255?255:255&n),o.view[a](t*i+o.byteOffset,n,!0)}(this,t,e)},enumerable:!0})};rP?bN&&(c=t((function(e,t,r,n){return AN(e,u),WN(LN(t)?pP(t)?void 0!==n?new s(t,NN(r,i),n):void 0!==r?new s(t,NN(r,i)):new s(t):cP(t)?lP(c,t):SN(jN,c,t):new s(kN(t)),e,c)})),FN&&FN(c,oP),GN(BN(s),(function(e){e in c||CN(c,e,s[e])})),c.prototype=u):(c=t((function(e,t,r,n){AN(e,u);var o,a,s,d=0,h=0;if(LN(t)){if(!pP(t))return cP(t)?lP(c,t):SN(jN,c,t);o=t,h=NN(r,i);var p=t.byteLength;if(void 0===n){if(p%i)throw ZN(dP);if((a=p-h)<0)throw ZN(dP)}else if((a=wN(n)*i)+h>p)throw ZN(dP);s=a/i}else s=kN(t),o=new $N(a=s*i);for(qN(e,{buffer:o,byteOffset:h,byteLength:a,length:s,view:new tP(o)});d<s;)l(e,d++)})),FN&&FN(c,oP),u=c.prototype=xN(aP)),u.constructor!==c&&CN(u,"constructor",c),CN(u,iP,c),nP&&CN(u,nP,n),d[n]=c,yN({global:!0,forced:c!=s,sham:!rP},d),uP in c||CN(c,uP,i),uP in u||CN(u,uP,i),HN(n)}):fk.exports=function(){},(0,fk.exports)("Uint8",(function(e){return function(t,r,i){return e(this,t,r,i)}}));var mP=Le,yP=$r,gP=ni,SP=Math.min,EP=[].copyWithin||function(e,t){var r=mP(this),i=gP(r),n=yP(e,i),o=yP(t,i),a=arguments.length>2?arguments[2]:void 0,s=SP((void 0===a?i:yP(a,i))-o,i-n),c=1;for(o<n&&n<o+s&&(c=-1,o+=s-1,n+=s-1);s-- >0;)o in r?r[n]=r[o]:delete r[n],n+=c,o+=c;return r},bP=Xk,IP=A(EP),TP=bP.aTypedArray;(0,bP.exportTypedArrayMethod)("copyWithin",(function(e,t){return IP(TP(this),e,t,arguments.length>2?arguments[2]:void 0)}));var AP=Ia.every,RP=Xk.aTypedArray;(0,Xk.exportTypedArrayMethod)("every",(function(e){return AP(RP(this),e,arguments.length>1?arguments[1]:void 0)}));var CP=h,OP=JO,wP=Xk.aTypedArray;(0,Xk.exportTypedArrayMethod)("fill",(function(e){var t=arguments.length;return CP(OP,wP(this),e,t>1?arguments[1]:void 0,t>2?arguments[2]:void 0)}));var kP=ni,NP=du,PP=Xk.TYPED_ARRAY_CONSTRUCTOR,DP=Xk.aTypedArrayConstructor,MP=function(e){return DP(NP(e,e[PP]))},LP=function(e,t){for(var r=0,i=kP(t),n=new e(i);i>r;)n[r]=t[r++];return n},UP=MP,xP=Ia.filter,VP=function(e,t){return LP(UP(e),t)},FP=Xk.aTypedArray;(0,Xk.exportTypedArrayMethod)("filter",(function(e){var t=xP(FP(this),e,arguments.length>1?arguments[1]:void 0);return VP(this,t)}));var BP=Ia.find,jP=Xk.aTypedArray;(0,Xk.exportTypedArrayMethod)("find",(function(e){return BP(jP(this),e,arguments.length>1?arguments[1]:void 0)}));var GP=Ia.findIndex,HP=Xk.aTypedArray;(0,Xk.exportTypedArrayMethod)("findIndex",(function(e){return GP(HP(this),e,arguments.length>1?arguments[1]:void 0)}));var zP=Ia.forEach,KP=Xk.aTypedArray;(0,Xk.exportTypedArrayMethod)("forEach",(function(e){zP(KP(this),e,arguments.length>1?arguments[1]:void 0)}));var WP=ui.includes,XP=Xk.aTypedArray;(0,Xk.exportTypedArrayMethod)("includes",(function(e){return WP(XP(this),e,arguments.length>1?arguments[1]:void 0)}));var qP=ui.indexOf,YP=Xk.aTypedArray;(0,Xk.exportTypedArrayMethod)("indexOf",(function(e){return qP(YP(this),e,arguments.length>1?arguments[1]:void 0)}));var JP=o,QP=s,ZP=A,$P=Xk,eD=dp,tD=et("iterator"),rD=JP.Uint8Array,iD=ZP(eD.values),nD=ZP(eD.keys),oD=ZP(eD.entries),aD=$P.aTypedArray,sD=$P.exportTypedArrayMethod,cD=rD&&rD.prototype,uD=!QP((function(){cD[tD].call([1])})),dD=!!cD&&cD.values&&cD[tD]===cD.values&&"values"===cD.values.name,lD=function(){return iD(aD(this))};sD("entries",(function(){return oD(aD(this))}),uD),sD("keys",(function(){return nD(aD(this))}),uD),sD("values",lD,uD||!dD,{name:"values"}),sD(tD,lD,uD||!dD,{name:"values"});var hD=Xk.aTypedArray,pD=Xk.exportTypedArrayMethod,fD=A([].join);pD("join",(function(e){return fD(hD(this),e)}));var _D=$n,vD=B,mD=Yr,yD=ni,gD=Gn,SD=Math.min,ED=[].lastIndexOf,bD=!!ED&&1/[1].lastIndexOf(1,-0)<0,ID=gD("lastIndexOf"),TD=bD||!ID?function(e){if(bD)return _D(ED,this,arguments)||0;var t=vD(this),r=yD(t),i=r-1;for(arguments.length>1&&(i=SD(i,mD(arguments[1]))),i<0&&(i=r+i);i>=0;i--)if(i in t&&t[i]===e)return i||0;return-1}:ED,AD=$n,RD=TD,CD=Xk.aTypedArray;(0,Xk.exportTypedArrayMethod)("lastIndexOf",(function(e){var t=arguments.length;return AD(RD,CD(this),t>1?[e,arguments[1]]:[e])}));var OD=Ia.map,wD=MP,kD=Xk.aTypedArray;(0,Xk.exportTypedArrayMethod)("map",(function(e){return OD(kD(this),e,arguments.length>1?arguments[1]:void 0,(function(e,t){return new(wD(e))(t)}))}));var ND=zy.left,PD=Xk.aTypedArray;(0,Xk.exportTypedArrayMethod)("reduce",(function(e){var t=arguments.length;return ND(PD(this),e,t,t>1?arguments[1]:void 0)}));var DD=zy.right,MD=Xk.aTypedArray;(0,Xk.exportTypedArrayMethod)("reduceRight",(function(e){var t=arguments.length;return DD(MD(this),e,t,t>1?arguments[1]:void 0)}));var LD=Xk.aTypedArray,UD=Xk.exportTypedArrayMethod,xD=Math.floor;UD("reverse",(function(){for(var e,t=this,r=LD(t).length,i=xD(r/2),n=0;n<i;)e=t[n],t[n++]=t[--r],t[r]=e;return t}));var VD=o,FD=h,BD=Xk,jD=ni,GD=cN,HD=Le,zD=s,KD=VD.RangeError,WD=VD.Int8Array,XD=WD&&WD.prototype,qD=XD&&XD.set,YD=BD.aTypedArray,JD=BD.exportTypedArrayMethod,QD=!zD((function(){var e=new Uint8ClampedArray(2);return FD(qD,e,{length:1,0:3},1),3!==e[1]})),ZD=QD&&BD.NATIVE_ARRAY_BUFFER_VIEWS&&zD((function(){var e=new WD(2);return e.set(1),e.set("2",1),0!==e[0]||2!==e[1]}));JD("set",(function(e){YD(this);var t=GD(arguments.length>1?arguments[1]:void 0,1),r=HD(e);if(QD)return FD(qD,this,r,t);var i=this.length,n=jD(r),o=0;if(n+t>i)throw KD("Wrong length");for(;o<n;)this[t+o]=r[o++]}),!QD||ZD);var $D=MP,eM=Po,tM=Xk.aTypedArray;(0,Xk.exportTypedArrayMethod)("slice",(function(e,t){for(var r=eM(tM(this),e,t),i=$D(this),n=0,o=r.length,a=new i(o);o>n;)a[n]=r[n++];return a}),s((function(){new Int8Array(1).slice()})));var rM=Ia.some,iM=Xk.aTypedArray;(0,Xk.exportTypedArrayMethod)("some",(function(e){return rM(iM(this),e,arguments.length>1?arguments[1]:void 0)}));var nM=Y.match(/firefox\/(\d+)/i),oM=!!nM&&+nM[1],aM=/MSIE|Trident/.test(Y),sM=Y.match(/AppleWebKit\/(\d+)\./),cM=!!sM&&+sM[1],uM=o,dM=A,lM=s,hM=ye,pM=yA,fM=Xk,_M=oM,vM=aM,mM=re,yM=cM,gM=uM.Array,SM=fM.aTypedArray,EM=fM.exportTypedArrayMethod,bM=uM.Uint16Array,IM=bM&&dM(bM.prototype.sort),TM=!(!IM||lM((function(){IM(new bM(2),null)}))&&lM((function(){IM(new bM(2),{})}))),AM=!!IM&&!lM((function(){if(mM)return mM<74;if(_M)return _M<67;if(vM)return!0;if(yM)return yM<602;var e,t,r=new bM(516),i=gM(516);for(e=0;e<516;e++)t=e%4,r[e]=515-e,i[e]=e-2*t+3;for(IM(r,(function(e,t){return(e/4|0)-(t/4|0)})),e=0;e<516;e++)if(r[e]!==i[e])return!0}));EM("sort",(function(e){return void 0!==e&&hM(e),AM?IM(this,e):pM(SM(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))}),!AM||TM);var RM=ri,CM=$r,OM=MP,wM=Xk.aTypedArray;(0,Xk.exportTypedArrayMethod)("subarray",(function(e,t){var r=wM(this),i=r.length,n=CM(e,i);return new(OM(r))(r.buffer,r.byteOffset+n*r.BYTES_PER_ELEMENT,RM((void 0===t?i:CM(t,i))-n))}));var kM=$n,NM=Xk,PM=s,DM=Po,MM=o.Int8Array,LM=NM.aTypedArray,UM=NM.exportTypedArrayMethod,xM=[].toLocaleString,VM=!!MM&&PM((function(){xM.call(new MM(1))}));UM("toLocaleString",(function(){return kM(xM,VM?DM(LM(this)):LM(this),DM(arguments))}),PM((function(){return[1,2].toLocaleString()!=new MM([1,2]).toLocaleString()}))||!PM((function(){MM.prototype.toLocaleString.call([1,2])})));var FM=Xk.exportTypedArrayMethod,BM=s,jM=A,GM=o.Uint8Array,HM=GM&&GM.prototype||{},zM=[].toString,KM=jM([].join);BM((function(){zM.call({})}))&&(zM=function(){return KM(this)});var WM=HM.toString!=zM;FM("toString",zM,WM),Xi({target:"Array",stat:!0},{isArray:to});var XM=c,qM=A,YM=an,JM=B,QM=qM(p.f),ZM=qM([].push),$M=function(e){return function(t){for(var r,i=JM(t),n=YM(i),o=n.length,a=0,s=[];o>a;)r=n[a++],XM&&!QM(i,r)||ZM(s,e?[r,i[r]]:i[r]);return s}},eL={entries:$M(!0),values:$M(!1)}.entries;Xi({target:"Object",stat:!0},{entries:function(e){return eL(e)}});var tL=Yr,rL=_o,iL=x,nL=o.RangeError,oL=function(e){var t=rL(iL(this)),r="",i=tL(e);if(i<0||i==1/0)throw nL("Wrong number of repetitions");for(;i>0;(i>>>=1)&&(t+=t))1&i&&(r+=t);return r},aL=A,sL=ri,cL=_o,uL=x,dL=aL(oL),lL=aL("".slice),hL=Math.ceil,pL=function(e){return function(t,r,i){var n,o,a=cL(uL(t)),s=sL(r),c=a.length,u=void 0===i?" ":cL(i);return s<=c||""==u?a:((o=dL(u,hL((n=s-c)/u.length))).length>n&&(o=lL(o,0,n)),e?a+o:o+a)}},fL={start:pL(!1),end:pL(!0)},_L=/Version\/10(?:\.\d+){1,2}(?: [\w./]+)?(?: Mobile\/\w+)? Safari\//.test(Y),vL=fL.end;Xi({target:"String",proto:!0,forced:_L},{padEnd:function(e){return vL(this,e,arguments.length>1?arguments[1]:void 0)}});var mL=Dm;Xi({target:"Number",stat:!0,forced:Number.parseInt!=mL},{parseInt:mL});var yL=uc,gL="ArrayBuffer",SL=Qw.ArrayBuffer;Xi({global:!0,forced:o.ArrayBuffer!==SL},{ArrayBuffer:SL}),yL(gL);Xi({target:"ArrayBuffer",stat:!0,forced:!Xk.NATIVE_ARRAY_BUFFER_VIEWS},{isView:Xk.isView}),Xi({global:!0,forced:!LO},{DataView:Qw.DataView});var EL=Xi,bL=o,IL=A,TL=Yr,AL=zb,RL=oL,CL=s,OL=bL.RangeError,wL=bL.String,kL=Math.floor,NL=IL(RL),PL=IL("".slice),DL=IL(1..toFixed),ML=function(e,t,r){return 0===t?r:t%2==1?ML(e,t-1,r*e):ML(e*e,t/2,r)},LL=function(e,t,r){for(var i=-1,n=r;++i<6;)n+=t*e[i],e[i]=n%1e7,n=kL(n/1e7)},UL=function(e,t){for(var r=6,i=0;--r>=0;)i+=e[r],e[r]=kL(i/t),i=i%t*1e7},xL=function(e){for(var t=6,r="";--t>=0;)if(""!==r||0===t||0!==e[t]){var i=wL(e[t]);r=""===r?i:r+NL("0",7-i.length)+i}return r};EL({target:"Number",proto:!0,forced:CL((function(){return"0.000"!==DL(8e-5,3)||"1"!==DL(.9,0)||"1.25"!==DL(1.255,2)||"1000000000000000128"!==DL(0xde0b6b3a7640080,0)}))||!CL((function(){DL({})}))},{toFixed:function(e){var t,r,i,n,o=AL(this),a=TL(e),s=[0,0,0,0,0,0],c="",u="0";if(a<0||a>20)throw OL("Incorrect fraction digits");if(o!=o)return"NaN";if(o<=-1e21||o>=1e21)return wL(o);if(o<0&&(c="-",o=-o),o>1e-21)if(r=(t=function(e){for(var t=0,r=e;r>=4096;)t+=12,r/=4096;for(;r>=2;)t+=1,r/=2;return t}(o*ML(2,69,1))-69)<0?o*ML(2,-t,1):o/ML(2,t,1),r*=4503599627370496,(t=52-t)>0){for(LL(s,0,r),i=a;i>=7;)LL(s,1e7,0),i-=7;for(LL(s,ML(10,i,1),0),i=t-1;i>=23;)UL(s,1<<23),i-=23;UL(s,1<<i),LL(s,1,1),UL(s,2),u=xL(s)}else LL(s,0,r),LL(s,1<<-t,0),u=xL(s)+NL("0",a);return u=a>0?c+((n=u.length)<=a?"0."+NL("0",a-n)+u:PL(u,0,n-a)+"."+PL(u,n-a)):c+u}});var VL=Math.log,FL=Math.LOG10E;Xi({target:"Math",stat:!0},{log10:Math.log10||function(e){return VL(e)*FL}});var BL=Xi,jL=A,GL=a.f,HL=ri,zL=_o,KL=P_,WL=x,XL=M_,qL=jL("".startsWith),YL=jL("".slice),JL=Math.min,QL=XL("startsWith"),ZL=!QL&&!!function(){var e=GL(String.prototype,"startsWith");return e&&!e.writable}();BL({target:"String",proto:!0,forced:!ZL&&!QL},{startsWith:function(e){var t=zL(WL(this));KL(e);var r=HL(JL(arguments.length>1?arguments[1]:void 0,t.length)),i=zL(e);return qL?qL(t,i,r):YL(t,r,r+i.length)===i}});var $L,eU=["click","contextmenu","mousedown","mouseup","pointerup","touchend","keydown","keyup"],tU=function(){function e(){var e=this;this._contextStuckAt=0,this._haslistener=!1,this._hasIOSListener=!1;var t=0;setInterval((function(){if(e._audioContextInstance){var r=e._audioContextInstance.currentTime;e._contextStuckAt?e._contextStuckAt!==r&&(e._contextStuckAt=0):t===r&&(e._contextStuckAt=r),t=r}}),5e3)}return e.prototype.resume=function(){var e,t,r=this;"running"!==(null===(e=this._audioContextInstance)||void 0===e?void 0:e.state)&&(null===(t=this._audioContextInstance)||void 0===t||t.resume().then((function(){var e;"running"!==(null===(e=r._audioContextInstance)||void 0===e?void 0:e.state)&&r.addInteractionListener()})).catch((function(){r.addInteractionListener()})))},e.prototype.getAudioContextInstance=function(){var e=this;if(!this._audioContextInstance){var t=window.AudioContext||window.webkitAudioContext;this._audioContextInstance=new t,this._audioContextInstance.onstatechange=function(){var t,r,i;"suspended"!==(null===(t=e._audioContextInstance)||void 0===t?void 0:t.state)&&"interrupted"!==(null===(r=e._audioContextInstance)||void 0===r?void 0:r.state)||(null===(i=e._audioContextInstance)||void 0===i||i.resume(),e.addInteractionListener())},this.addInteractionListener()}return this._audioContextInstance},e.prototype.addInteractionListener=function(){var e=this;this._haslistener||(this._resumeContext||(this._resumeContext=function(){var t,r;"running"===(null===(t=e._audioContextInstance)||void 0===t?void 0:t.state)?(eU.forEach((function(t){window.removeEventListener(t,e._resumeContext)})),e._haslistener=!1):null===(r=e._audioContextInstance)||void 0===r||r.resume()}),eU.forEach((function(t){window.addEventListener(t,e._resumeContext)})),this._haslistener=!0),jU&&!this._hasIOSListener&&(this._playSoundInIOS||(this._playSoundInIOS=function(){window.removeEventListener("touchend",e._playSoundInIOS),e._hasIOSListener=!1;var t=e._audioContextInstance;if(t){var r=t.createBuffer(1,1,44100),i=t.createBufferSource();i.buffer=r,i.connect(t.destination),i.start(0),i.disconnect()}}),window.addEventListener("touchend",this._playSoundInIOS),this._hasIOSListener=!0)},e}(),rU=function(){function e(e){this._buffer=[];var t=iU.getAudioContextInstance();if(e instanceof MediaStreamTrack){var r=new MediaStream;r.addTrack(e),this._stream=r,this._audioSource=t.createMediaStreamSource(r)}else this._audioSource=t.createMediaElementSource(e),this._audioSource.connect(t.destination);var i=t.createAnalyser();this._audioSource.connect(i),this._analyserNode=i,this._ctx=t}return e.prototype.getAudioLevel=function(){var e;"suspended"===(null===(e=this._ctx)||void 0===e?void 0:e.state)&&this._ctx.resume();var t=new Uint8Array(2048);this._analyserNode.getByteTimeDomainData(t);var r=0;return t.forEach((function(e){return r=Math.max(r,Math.abs(e-128))})),r/128*255},e.prototype.checkHasInput=function(){var e=new Uint8Array(2048);this._analyserNode.getByteTimeDomainData(e);var t=!1;return e.forEach((function(e){0!==e&&(t=!0)})),t},e.prototype.reset=function(){if(this._stream){this._audioSource.disconnect(),this._analyserNode.disconnect();var e=iU.getAudioContextInstance(),t=e.createAnalyser();this._audioSource=e.createMediaStreamSource(this._stream),this._audioSource.connect(t),this._analyserNode=t,this._ctx=e}},e.prototype.destroy=function(){this._audioSource.disconnect(),this._analyserNode.disconnect(),delete this._stream},e}(),iU=new tU,nU=new Uint8Array(16);function oU(){if(!$L&&!($L="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 $L(nU)}var aU=/^(?:[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 sU(e){return"string"==typeof e&&aU.test(e)}for(var cU=[],uU=0;uU<256;++uU)cU.push((uU+256).toString(16).substr(1));function dU(e,t,r){var i=(e=e||{}).random||(e.rng||oU)();if(i[6]=15&i[6]|64,i[8]=63&i[8]|128,t){r=r||0;for(var n=0;n<16;++n)t[r+n]=i[n];return t}return function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=(cU[e[t+0]]+cU[e[t+1]]+cU[e[t+2]]+cU[e[t+3]]+"-"+cU[e[t+4]]+cU[e[t+5]]+"-"+cU[e[t+6]]+cU[e[t+7]]+"-"+cU[e[t+8]]+cU[e[t+9]]+"-"+cU[e[t+10]]+cU[e[t+11]]+cU[e[t+12]]+cU[e[t+13]]+cU[e[t+14]]+cU[e[t+15]]).toLowerCase();if(!sU(r))throw TypeError("Stringified UUID is invalid");return r}(i)}(0,fk.exports)("Uint32",(function(e){return function(t,r,i){return e(this,t,r,i)}})),(0,fk.exports)("Int8",(function(e){return function(t,r,i){return e(this,t,r,i)}})),(0,fk.exports)("Uint8",(function(e){return function(t,r,i){return e(this,t,r,i)}}),!0),(0,fk.exports)("Int16",(function(e){return function(t,r,i){return e(this,t,r,i)}})),(0,fk.exports)("Uint16",(function(e){return function(t,r,i){return e(this,t,r,i)}})),(0,fk.exports)("Int32",(function(e){return function(t,r,i){return e(this,t,r,i)}})),(0,fk.exports)("Float32",(function(e){return function(t,r,i){return e(this,t,r,i)}})),(0,fk.exports)("Float64",(function(e){return function(t,r,i){return e(this,t,r,i)}}));var lU={exports:{}},hU={exports:{}};!function(e,t){var i;e.exports=(i=i||function(e,t){var i;if("undefined"!=typeof window&&window.crypto&&(i=window.crypto),"undefined"!=typeof self&&self.crypto&&(i=self.crypto),"undefined"!=typeof globalThis&&globalThis.crypto&&(i=globalThis.crypto),!i&&"undefined"!=typeof window&&window.msCrypto&&(i=window.msCrypto),!i&&void 0!==r&&r.crypto&&(i=r.crypto),!i)try{i=require("crypto")}catch(e){}var n=function(){if(i){if("function"==typeof i.getRandomValues)try{return i.getRandomValues(new Uint32Array(1))[0]}catch(e){}if("function"==typeof i.randomBytes)try{return i.randomBytes(4).readInt32LE()}catch(e){}}throw new Error("Native crypto module could not be used to get secure random number.")},o=Object.create||function(){function e(){}return function(t){var r;return e.prototype=t,r=new e,e.prototype=null,r}}(),a={},s=a.lib={},c=s.Base={extend:function(e){var t=o(this);return e&&t.mixIn(e),t.hasOwnProperty("init")&&this.init!==t.init||(t.init=function(){t.$super.init.apply(this,arguments)}),t.init.prototype=t,t.$super=this,t},create:function(){var e=this.extend();return e.init.apply(e,arguments),e},init:function(){},mixIn:function(e){for(var t in e)e.hasOwnProperty(t)&&(this[t]=e[t]);e.hasOwnProperty("toString")&&(this.toString=e.toString)},clone:function(){return this.init.prototype.extend(this)}},u=s.WordArray=c.extend({init:function(e,r){e=this.words=e||[],this.sigBytes=r!=t?r:4*e.length},toString:function(e){return(e||l).stringify(this)},concat:function(e){var t=this.words,r=e.words,i=this.sigBytes,n=e.sigBytes;if(this.clamp(),i%4)for(var o=0;o<n;o++){var a=r[o>>>2]>>>24-o%4*8&255;t[i+o>>>2]|=a<<24-(i+o)%4*8}else for(var s=0;s<n;s+=4)t[i+s>>>2]=r[s>>>2];return this.sigBytes+=n,this},clamp:function(){var t=this.words,r=this.sigBytes;t[r>>>2]&=4294967295<<32-r%4*8,t.length=e.ceil(r/4)},clone:function(){var e=c.clone.call(this);return e.words=this.words.slice(0),e},random:function(e){for(var t=[],r=0;r<e;r+=4)t.push(n());return new u.init(t,e)}}),d=a.enc={},l=d.Hex={stringify:function(e){for(var t=e.words,r=e.sigBytes,i=[],n=0;n<r;n++){var o=t[n>>>2]>>>24-n%4*8&255;i.push((o>>>4).toString(16)),i.push((15&o).toString(16))}return i.join("")},parse:function(e){for(var t=e.length,r=[],i=0;i<t;i+=2)r[i>>>3]|=parseInt(e.substr(i,2),16)<<24-i%8*4;return new u.init(r,t/2)}},h=d.Latin1={stringify:function(e){for(var t=e.words,r=e.sigBytes,i=[],n=0;n<r;n++){var o=t[n>>>2]>>>24-n%4*8&255;i.push(String.fromCharCode(o))}return i.join("")},parse:function(e){for(var t=e.length,r=[],i=0;i<t;i++)r[i>>>2]|=(255&e.charCodeAt(i))<<24-i%4*8;return new u.init(r,t)}},p=d.Utf8={stringify:function(e){try{return decodeURIComponent(escape(h.stringify(e)))}catch(e){throw new Error("Malformed UTF-8 data")}},parse:function(e){return h.parse(unescape(encodeURIComponent(e)))}},f=s.BufferedBlockAlgorithm=c.extend({reset:function(){this._data=new u.init,this._nDataBytes=0},_append:function(e){"string"==typeof e&&(e=p.parse(e)),this._data.concat(e),this._nDataBytes+=e.sigBytes},_process:function(t){var r,i=this._data,n=i.words,o=i.sigBytes,a=this.blockSize,s=o/(4*a),c=(s=t?e.ceil(s):e.max((0|s)-this._minBufferSize,0))*a,d=e.min(4*c,o);if(c){for(var l=0;l<c;l+=a)this._doProcessBlock(n,l);r=n.splice(0,c),i.sigBytes-=d}return new u.init(r,d)},clone:function(){var e=c.clone.call(this);return e._data=this._data.clone(),e},_minBufferSize:0});s.Hasher=f.extend({cfg:c.extend(),init:function(e){this.cfg=this.cfg.extend(e),this.reset()},reset:function(){f.reset.call(this),this._doReset()},update:function(e){return this._append(e),this._process(),this},finalize:function(e){return e&&this._append(e),this._doFinalize()},blockSize:16,_createHelper:function(e){return function(t,r){return new e.init(r).finalize(t)}},_createHmacHelper:function(e){return function(t,r){return new _.HMAC.init(e,r).finalize(t)}}});var _=a.algo={};return a}(Math),i)}(hU),function(e,t){var r;e.exports=(r=hU.exports,function(){if("function"==typeof ArrayBuffer){var e=r.lib.WordArray,t=e.init,i=e.init=function(e){if(e instanceof ArrayBuffer&&(e=new Uint8Array(e)),(e instanceof Int8Array||"undefined"!=typeof Uint8ClampedArray&&e instanceof Uint8ClampedArray||e instanceof Int16Array||e instanceof Uint16Array||e instanceof Int32Array||e instanceof Uint32Array||e instanceof Float32Array||e instanceof Float64Array)&&(e=new Uint8Array(e.buffer,e.byteOffset,e.byteLength)),e instanceof Uint8Array){for(var r=e.byteLength,i=[],n=0;n<r;n++)i[n>>>2]|=e[n]<<24-n%4*8;t.call(this,i,r)}else t.apply(this,arguments)};i.prototype=e}}(),r.lib.WordArray)}(lU);var pU=lU.exports,fU={exports:{}},_U={exports:{}};!function(e,t){var r;e.exports=(r=hU.exports,function(){var e=r,t=e.lib.WordArray;function i(e,r,i){for(var n=[],o=0,a=0;a<r;a++)if(a%4){var s=i[e.charCodeAt(a-1)]<<a%4*2|i[e.charCodeAt(a)]>>>6-a%4*2;n[o>>>2]|=s<<24-o%4*8,o++}return t.create(n,o)}e.enc.Base64={stringify:function(e){var t=e.words,r=e.sigBytes,i=this._map;e.clamp();for(var n=[],o=0;o<r;o+=3)for(var a=(t[o>>>2]>>>24-o%4*8&255)<<16|(t[o+1>>>2]>>>24-(o+1)%4*8&255)<<8|t[o+2>>>2]>>>24-(o+2)%4*8&255,s=0;s<4&&o+.75*s<r;s++)n.push(i.charAt(a>>>6*(3-s)&63));var c=i.charAt(64);if(c)for(;n.length%4;)n.push(c);return n.join("")},parse:function(e){var t=e.length,r=this._map,n=this._reverseMap;if(!n){n=this._reverseMap=[];for(var o=0;o<r.length;o++)n[r.charCodeAt(o)]=o}var a=r.charAt(64);if(a){var s=e.indexOf(a);-1!==s&&(t=s)}return i(e,t,n)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="}}(),r.enc.Base64)}(_U);var vU={exports:{}};!function(e,t){var r;e.exports=(r=hU.exports,function(e){var t=r,i=t.lib,n=i.WordArray,o=i.Hasher,a=t.algo,s=[];!function(){for(var t=0;t<64;t++)s[t]=4294967296*e.abs(e.sin(t+1))|0}();var c=a.MD5=o.extend({_doReset:function(){this._hash=new n.init([1732584193,4023233417,2562383102,271733878])},_doProcessBlock:function(e,t){for(var r=0;r<16;r++){var i=t+r,n=e[i];e[i]=16711935&(n<<8|n>>>24)|4278255360&(n<<24|n>>>8)}var o=this._hash.words,a=e[t+0],c=e[t+1],p=e[t+2],f=e[t+3],_=e[t+4],v=e[t+5],m=e[t+6],y=e[t+7],g=e[t+8],S=e[t+9],E=e[t+10],b=e[t+11],I=e[t+12],T=e[t+13],A=e[t+14],R=e[t+15],C=o[0],O=o[1],w=o[2],k=o[3];C=u(C,O,w,k,a,7,s[0]),k=u(k,C,O,w,c,12,s[1]),w=u(w,k,C,O,p,17,s[2]),O=u(O,w,k,C,f,22,s[3]),C=u(C,O,w,k,_,7,s[4]),k=u(k,C,O,w,v,12,s[5]),w=u(w,k,C,O,m,17,s[6]),O=u(O,w,k,C,y,22,s[7]),C=u(C,O,w,k,g,7,s[8]),k=u(k,C,O,w,S,12,s[9]),w=u(w,k,C,O,E,17,s[10]),O=u(O,w,k,C,b,22,s[11]),C=u(C,O,w,k,I,7,s[12]),k=u(k,C,O,w,T,12,s[13]),w=u(w,k,C,O,A,17,s[14]),C=d(C,O=u(O,w,k,C,R,22,s[15]),w,k,c,5,s[16]),k=d(k,C,O,w,m,9,s[17]),w=d(w,k,C,O,b,14,s[18]),O=d(O,w,k,C,a,20,s[19]),C=d(C,O,w,k,v,5,s[20]),k=d(k,C,O,w,E,9,s[21]),w=d(w,k,C,O,R,14,s[22]),O=d(O,w,k,C,_,20,s[23]),C=d(C,O,w,k,S,5,s[24]),k=d(k,C,O,w,A,9,s[25]),w=d(w,k,C,O,f,14,s[26]),O=d(O,w,k,C,g,20,s[27]),C=d(C,O,w,k,T,5,s[28]),k=d(k,C,O,w,p,9,s[29]),w=d(w,k,C,O,y,14,s[30]),C=l(C,O=d(O,w,k,C,I,20,s[31]),w,k,v,4,s[32]),k=l(k,C,O,w,g,11,s[33]),w=l(w,k,C,O,b,16,s[34]),O=l(O,w,k,C,A,23,s[35]),C=l(C,O,w,k,c,4,s[36]),k=l(k,C,O,w,_,11,s[37]),w=l(w,k,C,O,y,16,s[38]),O=l(O,w,k,C,E,23,s[39]),C=l(C,O,w,k,T,4,s[40]),k=l(k,C,O,w,a,11,s[41]),w=l(w,k,C,O,f,16,s[42]),O=l(O,w,k,C,m,23,s[43]),C=l(C,O,w,k,S,4,s[44]),k=l(k,C,O,w,I,11,s[45]),w=l(w,k,C,O,R,16,s[46]),C=h(C,O=l(O,w,k,C,p,23,s[47]),w,k,a,6,s[48]),k=h(k,C,O,w,y,10,s[49]),w=h(w,k,C,O,A,15,s[50]),O=h(O,w,k,C,v,21,s[51]),C=h(C,O,w,k,I,6,s[52]),k=h(k,C,O,w,f,10,s[53]),w=h(w,k,C,O,E,15,s[54]),O=h(O,w,k,C,c,21,s[55]),C=h(C,O,w,k,g,6,s[56]),k=h(k,C,O,w,R,10,s[57]),w=h(w,k,C,O,m,15,s[58]),O=h(O,w,k,C,T,21,s[59]),C=h(C,O,w,k,_,6,s[60]),k=h(k,C,O,w,b,10,s[61]),w=h(w,k,C,O,p,15,s[62]),O=h(O,w,k,C,S,21,s[63]),o[0]=o[0]+C|0,o[1]=o[1]+O|0,o[2]=o[2]+w|0,o[3]=o[3]+k|0},_doFinalize:function(){var t=this._data,r=t.words,i=8*this._nDataBytes,n=8*t.sigBytes;r[n>>>5]|=128<<24-n%32;var o=e.floor(i/4294967296),a=i;r[15+(n+64>>>9<<4)]=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8),r[14+(n+64>>>9<<4)]=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8),t.sigBytes=4*(r.length+1),this._process();for(var s=this._hash,c=s.words,u=0;u<4;u++){var d=c[u];c[u]=16711935&(d<<8|d>>>24)|4278255360&(d<<24|d>>>8)}return s},clone:function(){var e=o.clone.call(this);return e._hash=this._hash.clone(),e}});function u(e,t,r,i,n,o,a){var s=e+(t&r|~t&i)+n+a;return(s<<o|s>>>32-o)+t}function d(e,t,r,i,n,o,a){var s=e+(t&i|r&~i)+n+a;return(s<<o|s>>>32-o)+t}function l(e,t,r,i,n,o,a){var s=e+(t^r^i)+n+a;return(s<<o|s>>>32-o)+t}function h(e,t,r,i,n,o,a){var s=e+(r^(t|~i))+n+a;return(s<<o|s>>>32-o)+t}t.MD5=o._createHelper(c),t.HmacMD5=o._createHmacHelper(c)}(Math),r.MD5)}(vU);var mU={exports:{}},yU={exports:{}};!function(e,t){var r;e.exports=(r=hU.exports,function(){var e=r,t=e.lib,i=t.WordArray,n=t.Hasher,o=e.algo,a=[],s=o.SHA1=n.extend({_doReset:function(){this._hash=new i.init([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(e,t){for(var r=this._hash.words,i=r[0],n=r[1],o=r[2],s=r[3],c=r[4],u=0;u<80;u++){if(u<16)a[u]=0|e[t+u];else{var d=a[u-3]^a[u-8]^a[u-14]^a[u-16];a[u]=d<<1|d>>>31}var l=(i<<5|i>>>27)+c+a[u];l+=u<20?1518500249+(n&o|~n&s):u<40?1859775393+(n^o^s):u<60?(n&o|n&s|o&s)-1894007588:(n^o^s)-899497514,c=s,s=o,o=n<<30|n>>>2,n=i,i=l}r[0]=r[0]+i|0,r[1]=r[1]+n|0,r[2]=r[2]+o|0,r[3]=r[3]+s|0,r[4]=r[4]+c|0},_doFinalize:function(){var e=this._data,t=e.words,r=8*this._nDataBytes,i=8*e.sigBytes;return t[i>>>5]|=128<<24-i%32,t[14+(i+64>>>9<<4)]=Math.floor(r/4294967296),t[15+(i+64>>>9<<4)]=r,e.sigBytes=4*t.length,this._process(),this._hash},clone:function(){var e=n.clone.call(this);return e._hash=this._hash.clone(),e}});e.SHA1=n._createHelper(s),e.HmacSHA1=n._createHmacHelper(s)}(),r.SHA1)}(yU);var gU={exports:{}};!function(e,t){var r,i,n;e.exports=(i=(r=hU.exports).lib.Base,n=r.enc.Utf8,void(r.algo.HMAC=i.extend({init:function(e,t){e=this._hasher=new e.init,"string"==typeof t&&(t=n.parse(t));var r=e.blockSize,i=4*r;t.sigBytes>i&&(t=e.finalize(t)),t.clamp();for(var o=this._oKey=t.clone(),a=this._iKey=t.clone(),s=o.words,c=a.words,u=0;u<r;u++)s[u]^=1549556828,c[u]^=909522486;o.sigBytes=a.sigBytes=i,this.reset()},reset:function(){var e=this._hasher;e.reset(),e.update(this._iKey)},update:function(e){return this._hasher.update(e),this},finalize:function(e){var t=this._hasher,r=t.finalize(e);return t.reset(),t.finalize(this._oKey.clone().concat(r))}})))}(gU),function(e,t){var r;e.exports=(r=hU.exports,function(){var e=r,t=e.lib,i=t.Base,n=t.WordArray,o=e.algo,a=o.MD5,s=o.EvpKDF=i.extend({cfg:i.extend({keySize:4,hasher:a,iterations:1}),init:function(e){this.cfg=this.cfg.extend(e)},compute:function(e,t){for(var r,i=this.cfg,o=i.hasher.create(),a=n.create(),s=a.words,c=i.keySize,u=i.iterations;s.length<c;){r&&o.update(r),r=o.update(e).finalize(t),o.reset();for(var d=1;d<u;d++)r=o.finalize(r),o.reset();a.concat(r)}return a.sigBytes=4*c,a}});e.EvpKDF=function(e,t,r){return s.create(r).compute(e,t)}}(),r.EvpKDF)}(mU);var SU={exports:{}};!function(e,t){var r;e.exports=void((r=hU.exports).lib.Cipher||function(e){var t=r,i=t.lib,n=i.Base,o=i.WordArray,a=i.BufferedBlockAlgorithm,s=t.enc;s.Utf8;var c=s.Base64,u=t.algo.EvpKDF,d=i.Cipher=a.extend({cfg:n.extend(),createEncryptor:function(e,t){return this.create(this._ENC_XFORM_MODE,e,t)},createDecryptor:function(e,t){return this.create(this._DEC_XFORM_MODE,e,t)},init:function(e,t,r){this.cfg=this.cfg.extend(r),this._xformMode=e,this._key=t,this.reset()},reset:function(){a.reset.call(this),this._doReset()},process:function(e){return this._append(e),this._process()},finalize:function(e){return e&&this._append(e),this._doFinalize()},keySize:4,ivSize:4,_ENC_XFORM_MODE:1,_DEC_XFORM_MODE:2,_createHelper:function(){function e(e){return"string"==typeof e?g:m}return function(t){return{encrypt:function(r,i,n){return e(i).encrypt(t,r,i,n)},decrypt:function(r,i,n){return e(i).decrypt(t,r,i,n)}}}}()});i.StreamCipher=d.extend({_doFinalize:function(){return this._process(!0)},blockSize:1});var l=t.mode={},h=i.BlockCipherMode=n.extend({createEncryptor:function(e,t){return this.Encryptor.create(e,t)},createDecryptor:function(e,t){return this.Decryptor.create(e,t)},init:function(e,t){this._cipher=e,this._iv=t}}),p=l.CBC=function(){var t=h.extend();function r(t,r,i){var n,o=this._iv;o?(n=o,this._iv=e):n=this._prevBlock;for(var a=0;a<i;a++)t[r+a]^=n[a]}return t.Encryptor=t.extend({processBlock:function(e,t){var i=this._cipher,n=i.blockSize;r.call(this,e,t,n),i.encryptBlock(e,t),this._prevBlock=e.slice(t,t+n)}}),t.Decryptor=t.extend({processBlock:function(e,t){var i=this._cipher,n=i.blockSize,o=e.slice(t,t+n);i.decryptBlock(e,t),r.call(this,e,t,n),this._prevBlock=o}}),t}(),f=(t.pad={}).Pkcs7={pad:function(e,t){for(var r=4*t,i=r-e.sigBytes%r,n=i<<24|i<<16|i<<8|i,a=[],s=0;s<i;s+=4)a.push(n);var c=o.create(a,i);e.concat(c)},unpad:function(e){var t=255&e.words[e.sigBytes-1>>>2];e.sigBytes-=t}};i.BlockCipher=d.extend({cfg:d.cfg.extend({mode:p,padding:f}),reset:function(){var e;d.reset.call(this);var t=this.cfg,r=t.iv,i=t.mode;this._xformMode==this._ENC_XFORM_MODE?e=i.createEncryptor:(e=i.createDecryptor,this._minBufferSize=1),this._mode&&this._mode.__creator==e?this._mode.init(this,r&&r.words):(this._mode=e.call(i,this,r&&r.words),this._mode.__creator=e)},_doProcessBlock:function(e,t){this._mode.processBlock(e,t)},_doFinalize:function(){var e,t=this.cfg.padding;return this._xformMode==this._ENC_XFORM_MODE?(t.pad(this._data,this.blockSize),e=this._process(!0)):(e=this._process(!0),t.unpad(e)),e},blockSize:4});var _=i.CipherParams=n.extend({init:function(e){this.mixIn(e)},toString:function(e){return(e||this.formatter).stringify(this)}}),v=(t.format={}).OpenSSL={stringify:function(e){var t=e.ciphertext,r=e.salt;return(r?o.create([1398893684,1701076831]).concat(r).concat(t):t).toString(c)},parse:function(e){var t,r=c.parse(e),i=r.words;return 1398893684==i[0]&&1701076831==i[1]&&(t=o.create(i.slice(2,4)),i.splice(0,4),r.sigBytes-=16),_.create({ciphertext:r,salt:t})}},m=i.SerializableCipher=n.extend({cfg:n.extend({format:v}),encrypt:function(e,t,r,i){i=this.cfg.extend(i);var n=e.createEncryptor(r,i),o=n.finalize(t),a=n.cfg;return _.create({ciphertext:o,key:r,iv:a.iv,algorithm:e,mode:a.mode,padding:a.padding,blockSize:e.blockSize,formatter:i.format})},decrypt:function(e,t,r,i){return i=this.cfg.extend(i),t=this._parse(t,i.format),e.createDecryptor(r,i).finalize(t.ciphertext)},_parse:function(e,t){return"string"==typeof e?t.parse(e,this):e}}),y=(t.kdf={}).OpenSSL={execute:function(e,t,r,i,n){if(i||(i=o.random(8)),n)a=u.create({keySize:t+r,hasher:n}).compute(e,i);else var a=u.create({keySize:t+r}).compute(e,i);var s=o.create(a.words.slice(t),4*r);return a.sigBytes=4*t,_.create({key:a,iv:s,salt:i})}},g=i.PasswordBasedCipher=m.extend({cfg:m.cfg.extend({kdf:y}),encrypt:function(e,t,r,i){var n=(i=this.cfg.extend(i)).kdf.execute(r,e.keySize,e.ivSize,i.salt,i.hasher);i.iv=n.iv;var o=m.encrypt.call(this,e,t,n.key,i);return o.mixIn(n),o},decrypt:function(e,t,r,i){i=this.cfg.extend(i),t=this._parse(t,i.format);var n=i.kdf.execute(r,e.keySize,e.ivSize,t.salt,i.hasher);return i.iv=n.iv,m.decrypt.call(this,e,t,n.key,i)}})}())}(SU),function(e,t){var r;e.exports=(r=hU.exports,function(){var e=r,t=e.lib.BlockCipher,i=e.algo,n=[],o=[],a=[],s=[],c=[],u=[],d=[],l=[],h=[],p=[];!function(){for(var e=[],t=0;t<256;t++)e[t]=t<128?t<<1:t<<1^283;var r=0,i=0;for(t=0;t<256;t++){var f=i^i<<1^i<<2^i<<3^i<<4;f=f>>>8^255&f^99,n[r]=f,o[f]=r;var _=e[r],v=e[_],m=e[v],y=257*e[f]^16843008*f;a[r]=y<<24|y>>>8,s[r]=y<<16|y>>>16,c[r]=y<<8|y>>>24,u[r]=y,y=16843009*m^65537*v^257*_^16843008*r,d[f]=y<<24|y>>>8,l[f]=y<<16|y>>>16,h[f]=y<<8|y>>>24,p[f]=y,r?(r=_^e[e[e[m^_]]],i^=e[e[i]]):r=i=1}}();var f=[0,1,2,4,8,16,32,64,128,27,54],_=i.AES=t.extend({_doReset:function(){if(!this._nRounds||this._keyPriorReset!==this._key){for(var e=this._keyPriorReset=this._key,t=e.words,r=e.sigBytes/4,i=4*((this._nRounds=r+6)+1),o=this._keySchedule=[],a=0;a<i;a++)a<r?o[a]=t[a]:(u=o[a-1],a%r?r>6&&a%r==4&&(u=n[u>>>24]<<24|n[u>>>16&255]<<16|n[u>>>8&255]<<8|n[255&u]):(u=n[(u=u<<8|u>>>24)>>>24]<<24|n[u>>>16&255]<<16|n[u>>>8&255]<<8|n[255&u],u^=f[a/r|0]<<24),o[a]=o[a-r]^u);for(var s=this._invKeySchedule=[],c=0;c<i;c++){if(a=i-c,c%4)var u=o[a];else u=o[a-4];s[c]=c<4||a<=4?u:d[n[u>>>24]]^l[n[u>>>16&255]]^h[n[u>>>8&255]]^p[n[255&u]]}}},encryptBlock:function(e,t){this._doCryptBlock(e,t,this._keySchedule,a,s,c,u,n)},decryptBlock:function(e,t){var r=e[t+1];e[t+1]=e[t+3],e[t+3]=r,this._doCryptBlock(e,t,this._invKeySchedule,d,l,h,p,o),r=e[t+1],e[t+1]=e[t+3],e[t+3]=r},_doCryptBlock:function(e,t,r,i,n,o,a,s){for(var c=this._nRounds,u=e[t]^r[0],d=e[t+1]^r[1],l=e[t+2]^r[2],h=e[t+3]^r[3],p=4,f=1;f<c;f++){var _=i[u>>>24]^n[d>>>16&255]^o[l>>>8&255]^a[255&h]^r[p++],v=i[d>>>24]^n[l>>>16&255]^o[h>>>8&255]^a[255&u]^r[p++],m=i[l>>>24]^n[h>>>16&255]^o[u>>>8&255]^a[255&d]^r[p++],y=i[h>>>24]^n[u>>>16&255]^o[d>>>8&255]^a[255&l]^r[p++];u=_,d=v,l=m,h=y}_=(s[u>>>24]<<24|s[d>>>16&255]<<16|s[l>>>8&255]<<8|s[255&h])^r[p++],v=(s[d>>>24]<<24|s[l>>>16&255]<<16|s[h>>>8&255]<<8|s[255&u])^r[p++],m=(s[l>>>24]<<24|s[h>>>16&255]<<16|s[u>>>8&255]<<8|s[255&d])^r[p++],y=(s[h>>>24]<<24|s[u>>>16&255]<<16|s[d>>>8&255]<<8|s[255&l])^r[p++],e[t]=_,e[t+1]=v,e[t+2]=m,e[t+3]=y},keySize:8});e.AES=t._createHelper(_)}(),r.AES)}(fU);var EU={exports:{}};!function(e,t){e.exports=hU.exports.enc.Hex}(EU);var bU=EU.exports,IU={exports:{}};!function(e,t){var r,i,n;e.exports=((n=hU.exports).mode.CTR=(r=n.lib.BlockCipherMode.extend(),i=r.Encryptor=r.extend({processBlock:function(e,t){var r=this._cipher,i=r.blockSize,n=this._iv,o=this._counter;n&&(o=this._counter=n.slice(0),this._iv=void 0);var a=o.slice(0);r.encryptBlock(a,0),o[i-1]=o[i-1]+1|0;for(var s=0;s<i;s++)e[t+s]^=a[s]}}),r.Decryptor=i,r),n.mode.CTR)}(IU);var TU=IU.exports,AU={exports:{}};!function(e,t){var r;e.exports=((r=hU.exports).pad.NoPadding={pad:function(){},unpad:function(){}},r.pad.NoPadding)}(AU);var RU,CU=AU.exports,OU=new TextDecoder,wU=new TextEncoder,kU=function(){return dU()},NU=function(){return Date.now()};function PU(e){for(var t,r,i,n,o=[],a=1;a<arguments.length;a++)o[a-1]=arguments[a];var s=0;try{for(var c=n_(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=n_(o),p=h.next();!p.done;p=h.next()){var f=p.value;d.set(f,l),l+=f.length}}catch(e){i={error:e}}finally{try{p&&!p.done&&(n=h.return)&&n.call(h)}finally{if(i)throw i.error}}return d}var DU=function(){return"undefined"==typeof window},MU=function(){function e(){}return e.token2auth=function(t,r,i,n){return n?"Bearer ".concat(n):"Basic ".concat(e.createUnsafeToken(t,r,i))},e.createUnsafeToken=function(e,t,r){return window.btoa([e,t,r].filter((function(e){return null!==e})).join(":"))},e.merge=function(r,i){var n,o;void 0===r&&(r={}),void 0===i&&(i={});try{for(var a=n_(Object.entries(r)),s=a.next();!s.done;s=a.next()){var c=o_(s.value,2),u=c[0],d=c[1];null!==d&&"object"===t(d)?e.merge(r[u],i[u]):void 0!==i[u]&&(r[u]=i[u])}}catch(e){n={error:e}}finally{try{s&&!s.done&&(o=a.return)&&o.call(a)}finally{if(n)throw n.error}}},e.ab2str=function(e){return OU.decode(e)},e.ab2obj=function(t){try{var r=e.ab2str(t);return JSON.parse(r)}catch(e){return{}}},e.str2ab=function(e){return wU.encode(e).buffer},e.ab2b64str=function(e){return r_(this,void 0,void 0,(function(){return i_(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 r_(this,void 0,void 0,(function(){return i_(this,(function(t){return[2,fetch("data:application/octet;base64,"+e).then((function(e){return e.arrayBuffer()}))]}))}))},e}();function LU(){var e="none";return DU()||(null!==window.navigator.userAgent.match("Firefox")?e="mozilla":null!==window.navigator.userAgent.match("Chrome")?(e="chrome-stable",null!==window.navigator.userAgent.match("Electron")&&(e="electron")):(null!==window.navigator.userAgent.match("Safari")||null!==window.navigator.userAgent.match("AppleWebKit"))&&(e="safari")),e}var UU="mozilla"===LU(),xU="safari"===LU(),VU=0,FU=null===(RU=navigator.userAgent.match(/version\/(\d+)/i))||void 0===RU?void 0:RU[1];xU&&FU&&(VU=+FU);var BU=VU,jU=!DU()&&!!/(iPhone|iPad|iPod)/i.exec(navigator.userAgent);!DU()&&/(iPhone|iPod)/i.exec(navigator.userAgent),!DU()&&(/(iPad)/i.exec(navigator.userAgent)||/Macintosh/i.test(navigator.userAgent)&&document);var GU=!DU()&&/MicroMessenger/i.test(navigator.userAgent),HU=!DU()&&/Android/i.test(navigator.userAgent),zU=!DU()&&navigator.userAgent.toLowerCase().includes("mobile"),KU=!DU()&&/chrome\/(86)|(87)|(88)|(89)|(90)|(91)|(92)/i.test(navigator.userAgent),WU=!DU()&&/DingTalk/i.test(navigator.userAgent);function XU(){for(var e=(+"".concat(Math.random()).slice(-7).padEnd(7,"0")).toString(2).padEnd(28,"1").split(""),t=[];e.length;)t.push(e.splice(0,7));return t.map((function(e,r){var i=r===t.length-1?"0":"1";return Number.parseInt(i+e.join(""),2)}))}var qU=function(){return Math.floor(65535*Math.random())};function YU(e){return"string"==typeof e&&e.indexOf("__web__rtc__rtt__")>-1}function JU(e){return e.map((function e(t){if(t instanceof HTMLElement)return t.toString();if(t instanceof ArrayBuffer||ArrayBuffer.isView(t)){var r=ArrayBuffer.isView(t)?t.buffer:t,i=r.byteLength,n=[];if(i>10){var o=new DataView(r),a=Array.from({length:5}).map((function(e,t){return o.getUint8(t)})),s=Array.from({length:5}).map((function(e,t){return i-1-t})).reverse().map((function(e){return o.getUint8(e)}));n=a_(a_(a_([],o_(a),!1),["..."],!1),o_(s),!1)}else n=Array.from(new Uint8Array(r));return"".concat(t.constructor.name,"(").concat(i,") [").concat(n.join(", "),"]")}if(Array.isArray(t))return t.map(e);if("[object Object]"===Object.prototype.toString.call(t)){var c={};for(var u in t)c[u]=e(t[u]);return c}return t}))}var QU=function(e){return void 0===e&&(e=!1),r_(void 0,void 0,void 0,(function(){var t,r;return i_(this,(function(i){switch(i.label){case 0:return i.trys.push([0,2,,3]),(t=new RTCPeerConnection({iceServers:[],iceTransportPolicy:"all",bundlePolicy:"max-bundle",rtcpMuxPolicy:"require",sdpSemantics:"unified-plan"})).createDataChannel("default"),t.addTransceiver("audio",{direction:"recvonly"}),t.addTransceiver("video",{direction:"recvonly"}),e&&(t.addTransceiver("audio",{direction:"sendonly"}),t.addTransceiver("video",{direction:"sendonly"})),[4,t.createOffer()];case 1:return r=i.sent(),t.close(),[2,r.sdp];case 2:return i.sent(),[3,3];case 3:return[2]}}))}))},ZU=function(e){return new Promise((function(t,r){var i=(e=Array.isArray(e)?e:[]).length,n=[];0===i?r([]):e.forEach((function(e){e.then((function(e){t(e)}),(function(e){i--,n.push(e),0===i&&r(n)}))}))}))};function $U(e){return+Math.max(-127,10*Math.log10(Math.pow(e/255,2))).toFixed(2)}function ex(e){return(e&Ff.AUDIO)===Ff.AUDIO}function tx(e){return(e&Ff.VIDEO)===Ff.VIDEO}function rx(e){var r={};return Object.keys(e).forEach((function(i){"object"===t(e[i])?r[i]=rx(e[i]):i.startsWith("_")||(r[i]=e[i])})),r}function ix(e){return null==e?"undefined | null":"string"==typeof e?e:JSON.stringify({contentHint:e.contentHint,enabled:e.enabled,id:e.id,kind:e.kind,label:e.label,muted:e.muted,readyState:e.readyState})}function nx(e){return"number"==typeof e?e:"number"==typeof(null==e?void 0:e.exact)?e.exact:"number"==typeof(null==e?void 0:e.ideal)?e.ideal:"number"==typeof(null==e?void 0:e.max)?e.max:"number"==typeof(null==e?void 0:e.min)?e.min:1}var ox=function(){if("chrome-stable"===LU()){var e=window.navigator.userAgent.match(/Chrome\/([\d.]+)/);if(e&&e.length>1)if(Number(e[1].split(".")[0])<117)return!0}return!1}();function ax(e){for(var t=atob(e),r=t.length,i=new Uint8Array(r),n=0;n<r;n++)i[n]=t.charCodeAt(n);return i}function sx(e){for(var t="",r=e.byteLength,i=0;i<r;i++)t+=String.fromCharCode(e[i]);return btoa(t)}function cx(e,t,r){var i=ux(e),n=ux(t),o=ux(r);return function(e){for(var t=e.toString(bU),r=new Uint8Array(t.length/2),i=0;i<t.length;i+=2)r[i/2]=parseInt(t.substr(i,2),16);return r}(fU.exports.encrypt(i,n,{iv:o,mode:TU,padding:CU}).ciphertext)}function ux(e){for(var t=[],r=0;r<e.length;r+=4)t.push(e[r]<<24|(e[r+1]||0)<<16|(e[r+2]||0)<<8|(e[r+3]||0));return pU.create(t,e.length)}var dx={};!function(e){var r="undefined"!=typeof Uint8Array&&"undefined"!=typeof Uint16Array&&"undefined"!=typeof Int32Array;function i(e,t){return Object.prototype.hasOwnProperty.call(e,t)}e.assign=function(e){for(var r=Array.prototype.slice.call(arguments,1);r.length;){var n=r.shift();if(n){if("object"!==t(n))throw new TypeError(n+"must be non-object");for(var o in n)i(n,o)&&(e[o]=n[o])}}return e},e.shrinkBuf=function(e,t){return e.length===t?e:e.subarray?e.subarray(0,t):(e.length=t,e)};var n={arraySet:function(e,t,r,i,n){if(t.subarray&&e.subarray)e.set(t.subarray(r,r+i),n);else for(var o=0;o<i;o++)e[n+o]=t[r+o]},flattenChunks:function(e){var t,r,i,n,o,a;for(i=0,t=0,r=e.length;t<r;t++)i+=e[t].length;for(a=new Uint8Array(i),n=0,t=0,r=e.length;t<r;t++)o=e[t],a.set(o,n),n+=o.length;return a}},o={arraySet:function(e,t,r,i,n){for(var o=0;o<i;o++)e[n+o]=t[r+o]},flattenChunks:function(e){return[].concat.apply([],e)}};e.setTyped=function(t){t?(e.Buf8=Uint8Array,e.Buf16=Uint16Array,e.Buf32=Int32Array,e.assign(e,n)):(e.Buf8=Array,e.Buf16=Array,e.Buf32=Array,e.assign(e,o))},e.setTyped(r)}(dx);var lx={},hx={},px={},fx=dx;function _x(e){for(var t=e.length;--t>=0;)e[t]=0}var vx=256,mx=286,yx=30,gx=15,Sx=[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],Ex=[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],bx=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],Ix=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],Tx=new Array(576);_x(Tx);var Ax=new Array(60);_x(Ax);var Rx=new Array(512);_x(Rx);var Cx=new Array(256);_x(Cx);var Ox=new Array(29);_x(Ox);var wx,kx,Nx,Px=new Array(yx);function Dx(e,t,r,i,n){this.static_tree=e,this.extra_bits=t,this.extra_base=r,this.elems=i,this.max_length=n,this.has_stree=e&&e.length}function Mx(e,t){this.dyn_tree=e,this.max_code=0,this.stat_desc=t}function Lx(e){return e<256?Rx[e]:Rx[256+(e>>>7)]}function Ux(e,t){e.pending_buf[e.pending++]=255&t,e.pending_buf[e.pending++]=t>>>8&255}function xx(e,t,r){e.bi_valid>16-r?(e.bi_buf|=t<<e.bi_valid&65535,Ux(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 Vx(e,t,r){xx(e,r[2*t],r[2*t+1])}function Fx(e,t){var r=0;do{r|=1&e,e>>>=1,r<<=1}while(--t>0);return r>>>1}function Bx(e,t,r){var i,n,o=new Array(16),a=0;for(i=1;i<=gx;i++)o[i]=a=a+r[i-1]<<1;for(n=0;n<=t;n++){var s=e[2*n+1];0!==s&&(e[2*n]=Fx(o[s]++,s))}}function jx(e){var t;for(t=0;t<mx;t++)e.dyn_ltree[2*t]=0;for(t=0;t<yx;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 Gx(e){e.bi_valid>8?Ux(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 Hx(e,t,r,i){var n=2*t,o=2*r;return e[n]<e[o]||e[n]===e[o]&&i[t]<=i[r]}function zx(e,t,r){for(var i=e.heap[r],n=r<<1;n<=e.heap_len&&(n<e.heap_len&&Hx(t,e.heap[n+1],e.heap[n],e.depth)&&n++,!Hx(t,i,e.heap[n],e.depth));)e.heap[r]=e.heap[n],r=n,n<<=1;e.heap[r]=i}function Kx(e,t,r){var i,n,o,a,s=0;if(0!==e.last_lit)do{i=e.pending_buf[e.d_buf+2*s]<<8|e.pending_buf[e.d_buf+2*s+1],n=e.pending_buf[e.l_buf+s],s++,0===i?Vx(e,n,t):(Vx(e,(o=Cx[n])+vx+1,t),0!==(a=Sx[o])&&xx(e,n-=Ox[o],a),Vx(e,o=Lx(--i),r),0!==(a=Ex[o])&&xx(e,i-=Px[o],a))}while(s<e.last_lit);Vx(e,256,t)}function Wx(e,t){var r,i,n,o=t.dyn_tree,a=t.stat_desc.static_tree,s=t.stat_desc.has_stree,c=t.stat_desc.elems,u=-1;for(e.heap_len=0,e.heap_max=573,r=0;r<c;r++)0!==o[2*r]?(e.heap[++e.heap_len]=u=r,e.depth[r]=0):o[2*r+1]=0;for(;e.heap_len<2;)o[2*(n=e.heap[++e.heap_len]=u<2?++u:0)]=1,e.depth[n]=0,e.opt_len--,s&&(e.static_len-=a[2*n+1]);for(t.max_code=u,r=e.heap_len>>1;r>=1;r--)zx(e,o,r);n=c;do{r=e.heap[1],e.heap[1]=e.heap[e.heap_len--],zx(e,o,1),i=e.heap[1],e.heap[--e.heap_max]=r,e.heap[--e.heap_max]=i,o[2*n]=o[2*r]+o[2*i],e.depth[n]=(e.depth[r]>=e.depth[i]?e.depth[r]:e.depth[i])+1,o[2*r+1]=o[2*i+1]=n,e.heap[1]=n++,zx(e,o,1)}while(e.heap_len>=2);e.heap[--e.heap_max]=e.heap[1],function(e,t){var r,i,n,o,a,s,c=t.dyn_tree,u=t.max_code,d=t.stat_desc.static_tree,l=t.stat_desc.has_stree,h=t.stat_desc.extra_bits,p=t.stat_desc.extra_base,f=t.stat_desc.max_length,_=0;for(o=0;o<=gx;o++)e.bl_count[o]=0;for(c[2*e.heap[e.heap_max]+1]=0,r=e.heap_max+1;r<573;r++)(o=c[2*c[2*(i=e.heap[r])+1]+1]+1)>f&&(o=f,_++),c[2*i+1]=o,i>u||(e.bl_count[o]++,a=0,i>=p&&(a=h[i-p]),s=c[2*i],e.opt_len+=s*(o+a),l&&(e.static_len+=s*(d[2*i+1]+a)));if(0!==_){do{for(o=f-1;0===e.bl_count[o];)o--;e.bl_count[o]--,e.bl_count[o+1]+=2,e.bl_count[f]--,_-=2}while(_>0);for(o=f;0!==o;o--)for(i=e.bl_count[o];0!==i;)(n=e.heap[--r])>u||(c[2*n+1]!==o&&(e.opt_len+=(o-c[2*n+1])*c[2*n],c[2*n+1]=o),i--)}}(e,t),Bx(o,u,e.bl_count)}function Xx(e,t,r){var i,n,o=-1,a=t[1],s=0,c=7,u=4;for(0===a&&(c=138,u=3),t[2*(r+1)+1]=65535,i=0;i<=r;i++)n=a,a=t[2*(i+1)+1],++s<c&&n===a||(s<u?e.bl_tree[2*n]+=s:0!==n?(n!==o&&e.bl_tree[2*n]++,e.bl_tree[32]++):s<=10?e.bl_tree[34]++:e.bl_tree[36]++,s=0,o=n,0===a?(c=138,u=3):n===a?(c=6,u=3):(c=7,u=4))}function qx(e,t,r){var i,n,o=-1,a=t[1],s=0,c=7,u=4;for(0===a&&(c=138,u=3),i=0;i<=r;i++)if(n=a,a=t[2*(i+1)+1],!(++s<c&&n===a)){if(s<u)do{Vx(e,n,e.bl_tree)}while(0!=--s);else 0!==n?(n!==o&&(Vx(e,n,e.bl_tree),s--),Vx(e,16,e.bl_tree),xx(e,s-3,2)):s<=10?(Vx(e,17,e.bl_tree),xx(e,s-3,3)):(Vx(e,18,e.bl_tree),xx(e,s-11,7));s=0,o=n,0===a?(c=138,u=3):n===a?(c=6,u=3):(c=7,u=4)}}_x(Px);var Yx=!1;function Jx(e,t,r,i){xx(e,0+(i?1:0),3),function(e,t,r,i){Gx(e),i&&(Ux(e,r),Ux(e,~r)),fx.arraySet(e.pending_buf,e.window,t,r,e.pending),e.pending+=r}(e,t,r,!0)}px._tr_init=function(e){Yx||(!function(){var e,t,r,i,n,o=new Array(16);for(r=0,i=0;i<28;i++)for(Ox[i]=r,e=0;e<1<<Sx[i];e++)Cx[r++]=i;for(Cx[r-1]=i,n=0,i=0;i<16;i++)for(Px[i]=n,e=0;e<1<<Ex[i];e++)Rx[n++]=i;for(n>>=7;i<yx;i++)for(Px[i]=n<<7,e=0;e<1<<Ex[i]-7;e++)Rx[256+n++]=i;for(t=0;t<=gx;t++)o[t]=0;for(e=0;e<=143;)Tx[2*e+1]=8,e++,o[8]++;for(;e<=255;)Tx[2*e+1]=9,e++,o[9]++;for(;e<=279;)Tx[2*e+1]=7,e++,o[7]++;for(;e<=287;)Tx[2*e+1]=8,e++,o[8]++;for(Bx(Tx,287,o),e=0;e<yx;e++)Ax[2*e+1]=5,Ax[2*e]=Fx(e,5);wx=new Dx(Tx,Sx,257,mx,gx),kx=new Dx(Ax,Ex,0,yx,gx),Nx=new Dx(new Array(0),bx,0,19,7)}(),Yx=!0),e.l_desc=new Mx(e.dyn_ltree,wx),e.d_desc=new Mx(e.dyn_dtree,kx),e.bl_desc=new Mx(e.bl_tree,Nx),e.bi_buf=0,e.bi_valid=0,jx(e)},px._tr_stored_block=Jx,px._tr_flush_block=function(e,t,r,i){var n,o,a=0;e.level>0?(2===e.strm.data_type&&(e.strm.data_type=function(e){var t,r=4093624447;for(t=0;t<=31;t++,r>>>=1)if(1&r&&0!==e.dyn_ltree[2*t])return 0;if(0!==e.dyn_ltree[18]||0!==e.dyn_ltree[20]||0!==e.dyn_ltree[26])return 1;for(t=32;t<vx;t++)if(0!==e.dyn_ltree[2*t])return 1;return 0}(e)),Wx(e,e.l_desc),Wx(e,e.d_desc),a=function(e){var t;for(Xx(e,e.dyn_ltree,e.l_desc.max_code),Xx(e,e.dyn_dtree,e.d_desc.max_code),Wx(e,e.bl_desc),t=18;t>=3&&0===e.bl_tree[2*Ix[t]+1];t--);return e.opt_len+=3*(t+1)+5+5+4,t}(e),n=e.opt_len+3+7>>>3,(o=e.static_len+3+7>>>3)<=n&&(n=o)):n=o=r+5,r+4<=n&&-1!==t?Jx(e,t,r,i):4===e.strategy||o===n?(xx(e,2+(i?1:0),3),Kx(e,Tx,Ax)):(xx(e,4+(i?1:0),3),function(e,t,r,i){var n;for(xx(e,t-257,5),xx(e,r-1,5),xx(e,i-4,4),n=0;n<i;n++)xx(e,e.bl_tree[2*Ix[n]+1],3);qx(e,e.dyn_ltree,t-1),qx(e,e.dyn_dtree,r-1)}(e,e.l_desc.max_code+1,e.d_desc.max_code+1,a+1),Kx(e,e.dyn_ltree,e.dyn_dtree)),jx(e),i&&Gx(e)},px._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*(Cx[r]+vx+1)]++,e.dyn_dtree[2*Lx(t)]++),e.last_lit===e.lit_bufsize-1},px._tr_align=function(e){xx(e,2,3),Vx(e,256,Tx),function(e){16===e.bi_valid?(Ux(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 Qx=function(e,t,r,i){for(var n=65535&e|0,o=e>>>16&65535|0,a=0;0!==r;){r-=a=r>2e3?2e3:r;do{o=o+(n=n+t[i++]|0)|0}while(--a);n%=65521,o%=65521}return n|o<<16|0};var Zx=function(){for(var e,t=[],r=0;r<256;r++){e=r;for(var i=0;i<8;i++)e=1&e?3988292384^e>>>1:e>>>1;t[r]=e}return t}();var $x,eV=function(e,t,r,i){var n=Zx,o=i+r;e^=-1;for(var a=i;a<o;a++)e=e>>>8^n[255&(e^t[a])];return-1^e},tV={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"},rV=dx,iV=px,nV=Qx,oV=eV,aV=tV,sV=-2,cV=258,uV=262,dV=103,lV=113,hV=666;function pV(e,t){return e.msg=aV[t],t}function fV(e){return(e<<1)-(e>4?9:0)}function _V(e){for(var t=e.length;--t>=0;)e[t]=0}function vV(e){var t=e.state,r=t.pending;r>e.avail_out&&(r=e.avail_out),0!==r&&(rV.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 mV(e,t){iV._tr_flush_block(e,e.block_start>=0?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,vV(e.strm)}function yV(e,t){e.pending_buf[e.pending++]=t}function gV(e,t){e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=255&t}function SV(e,t){var r,i,n=e.max_chain_length,o=e.strstart,a=e.prev_length,s=e.nice_match,c=e.strstart>e.w_size-uV?e.strstart-(e.w_size-uV):0,u=e.window,d=e.w_mask,l=e.prev,h=e.strstart+cV,p=u[o+a-1],f=u[o+a];e.prev_length>=e.good_match&&(n>>=2),s>e.lookahead&&(s=e.lookahead);do{if(u[(r=t)+a]===f&&u[r+a-1]===p&&u[r]===u[o]&&u[++r]===u[o+1]){o+=2,r++;do{}while(u[++o]===u[++r]&&u[++o]===u[++r]&&u[++o]===u[++r]&&u[++o]===u[++r]&&u[++o]===u[++r]&&u[++o]===u[++r]&&u[++o]===u[++r]&&u[++o]===u[++r]&&o<h);if(i=cV-(h-o),o=h-cV,i>a){if(e.match_start=t,a=i,i>=s)break;p=u[o+a-1],f=u[o+a]}}}while((t=l[t&d])>c&&0!=--n);return a<=e.lookahead?a:e.lookahead}function EV(e){var t,r,i,n,o,a,s,c,u,d,l=e.w_size;do{if(n=e.window_size-e.lookahead-e.strstart,e.strstart>=l+(l-uV)){rV.arraySet(e.window,e.window,l,l,0),e.match_start-=l,e.strstart-=l,e.block_start-=l,t=r=e.hash_size;do{i=e.head[--t],e.head[t]=i>=l?i-l:0}while(--r);t=r=l;do{i=e.prev[--t],e.prev[t]=i>=l?i-l:0}while(--r);n+=l}if(0===e.strm.avail_in)break;if(a=e.strm,s=e.window,c=e.strstart+e.lookahead,u=n,d=void 0,(d=a.avail_in)>u&&(d=u),r=0===d?0:(a.avail_in-=d,rV.arraySet(s,a.input,a.next_in,d,c),1===a.state.wrap?a.adler=nV(a.adler,s,d,c):2===a.state.wrap&&(a.adler=oV(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<uV&&0!==e.strm.avail_in)}function bV(e,t){for(var r,i;;){if(e.lookahead<uV){if(EV(e),e.lookahead<uV&&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-uV&&(e.match_length=SV(e,r)),e.match_length>=3)if(i=iV._tr_tally(e,e.strstart-e.match_start,e.match_length-3),e.lookahead-=e.match_length,e.match_length<=e.max_lazy_match&&e.lookahead>=3){e.match_length--;do{e.strstart++,e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+3-1])&e.hash_mask,r=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart}while(0!=--e.match_length);e.strstart++}else e.strstart+=e.match_length,e.match_length=0,e.ins_h=e.window[e.strstart],e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+1])&e.hash_mask;else i=iV._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++;if(i&&(mV(e,!1),0===e.strm.avail_out))return 1}return e.insert=e.strstart<2?e.strstart:2,4===t?(mV(e,!0),0===e.strm.avail_out?3:4):e.last_lit&&(mV(e,!1),0===e.strm.avail_out)?1:2}function IV(e,t){for(var r,i,n;;){if(e.lookahead<uV){if(EV(e),e.lookahead<uV&&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-uV&&(e.match_length=SV(e,r),e.match_length<=5&&(1===e.strategy||3===e.match_length&&e.strstart-e.match_start>4096)&&(e.match_length=2)),e.prev_length>=3&&e.match_length<=e.prev_length){n=e.strstart+e.lookahead-3,i=iV._tr_tally(e,e.strstart-1-e.prev_match,e.prev_length-3),e.lookahead-=e.prev_length-1,e.prev_length-=2;do{++e.strstart<=n&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+3-1])&e.hash_mask,r=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart)}while(0!=--e.prev_length);if(e.match_available=0,e.match_length=2,e.strstart++,i&&(mV(e,!1),0===e.strm.avail_out))return 1}else if(e.match_available){if((i=iV._tr_tally(e,0,e.window[e.strstart-1]))&&mV(e,!1),e.strstart++,e.lookahead--,0===e.strm.avail_out)return 1}else e.match_available=1,e.strstart++,e.lookahead--}return e.match_available&&(i=iV._tr_tally(e,0,e.window[e.strstart-1]),e.match_available=0),e.insert=e.strstart<2?e.strstart:2,4===t?(mV(e,!0),0===e.strm.avail_out?3:4):e.last_lit&&(mV(e,!1),0===e.strm.avail_out)?1:2}function TV(e,t,r,i,n){this.good_length=e,this.max_lazy=t,this.nice_length=r,this.max_chain=i,this.func=n}function AV(){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 rV.Buf16(1146),this.dyn_dtree=new rV.Buf16(122),this.bl_tree=new rV.Buf16(78),_V(this.dyn_ltree),_V(this.dyn_dtree),_V(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new rV.Buf16(16),this.heap=new rV.Buf16(573),_V(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new rV.Buf16(573),_V(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 RV(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:lV,e.adler=2===t.wrap?0:1,t.last_flush=0,iV._tr_init(t),0):pV(e,sV)}function CV(e){var t,r=RV(e);return 0===r&&((t=e.state).window_size=2*t.w_size,_V(t.head),t.max_lazy_match=$x[t.level].max_lazy,t.good_match=$x[t.level].good_length,t.nice_match=$x[t.level].nice_length,t.max_chain_length=$x[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 OV(e,t,r,i,n,o){if(!e)return sV;var a=1;if(-1===t&&(t=6),i<0?(a=0,i=-i):i>15&&(a=2,i-=16),n<1||n>9||8!==r||i<8||i>15||t<0||t>9||o<0||o>4)return pV(e,sV);8===i&&(i=9);var s=new AV;return e.state=s,s.strm=e,s.wrap=a,s.gzhead=null,s.w_bits=i,s.w_size=1<<s.w_bits,s.w_mask=s.w_size-1,s.hash_bits=n+7,s.hash_size=1<<s.hash_bits,s.hash_mask=s.hash_size-1,s.hash_shift=~~((s.hash_bits+3-1)/3),s.window=new rV.Buf8(2*s.w_size),s.head=new rV.Buf16(s.hash_size),s.prev=new rV.Buf16(s.w_size),s.lit_bufsize=1<<n+6,s.pending_buf_size=4*s.lit_bufsize,s.pending_buf=new rV.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,CV(e)}$x=[new TV(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(EV(e),0===e.lookahead&&0===t)return 1;if(0===e.lookahead)break}e.strstart+=e.lookahead,e.lookahead=0;var i=e.block_start+r;if((0===e.strstart||e.strstart>=i)&&(e.lookahead=e.strstart-i,e.strstart=i,mV(e,!1),0===e.strm.avail_out))return 1;if(e.strstart-e.block_start>=e.w_size-uV&&(mV(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,4===t?(mV(e,!0),0===e.strm.avail_out?3:4):(e.strstart>e.block_start&&(mV(e,!1),e.strm.avail_out),1)})),new TV(4,4,8,4,bV),new TV(4,5,16,8,bV),new TV(4,6,32,32,bV),new TV(4,4,16,16,IV),new TV(8,16,32,32,IV),new TV(8,16,128,128,IV),new TV(8,32,128,256,IV),new TV(32,128,258,1024,IV),new TV(32,258,258,4096,IV)],hx.deflateInit=function(e,t){return OV(e,t,8,15,8,0)},hx.deflateInit2=OV,hx.deflateReset=CV,hx.deflateResetKeep=RV,hx.deflateSetHeader=function(e,t){return e&&e.state?2!==e.state.wrap?sV:(e.state.gzhead=t,0):sV},hx.deflate=function(e,t){var r,i,n,o;if(!e||!e.state||t>5||t<0)return e?pV(e,sV):sV;if(i=e.state,!e.output||!e.input&&0!==e.avail_in||i.status===hV&&4!==t)return pV(e,0===e.avail_out?-5:sV);if(i.strm=e,r=i.last_flush,i.last_flush=t,42===i.status)if(2===i.wrap)e.adler=0,yV(i,31),yV(i,139),yV(i,8),i.gzhead?(yV(i,(i.gzhead.text?1:0)+(i.gzhead.hcrc?2:0)+(i.gzhead.extra?4:0)+(i.gzhead.name?8:0)+(i.gzhead.comment?16:0)),yV(i,255&i.gzhead.time),yV(i,i.gzhead.time>>8&255),yV(i,i.gzhead.time>>16&255),yV(i,i.gzhead.time>>24&255),yV(i,9===i.level?2:i.strategy>=2||i.level<2?4:0),yV(i,255&i.gzhead.os),i.gzhead.extra&&i.gzhead.extra.length&&(yV(i,255&i.gzhead.extra.length),yV(i,i.gzhead.extra.length>>8&255)),i.gzhead.hcrc&&(e.adler=oV(e.adler,i.pending_buf,i.pending,0)),i.gzindex=0,i.status=69):(yV(i,0),yV(i,0),yV(i,0),yV(i,0),yV(i,0),yV(i,9===i.level?2:i.strategy>=2||i.level<2?4:0),yV(i,3),i.status=lV);else{var a=8+(i.w_bits-8<<4)<<8;a|=(i.strategy>=2||i.level<2?0:i.level<6?1:6===i.level?2:3)<<6,0!==i.strstart&&(a|=32),a+=31-a%31,i.status=lV,gV(i,a),0!==i.strstart&&(gV(i,e.adler>>>16),gV(i,65535&e.adler)),e.adler=1}if(69===i.status)if(i.gzhead.extra){for(n=i.pending;i.gzindex<(65535&i.gzhead.extra.length)&&(i.pending!==i.pending_buf_size||(i.gzhead.hcrc&&i.pending>n&&(e.adler=oV(e.adler,i.pending_buf,i.pending-n,n)),vV(e),n=i.pending,i.pending!==i.pending_buf_size));)yV(i,255&i.gzhead.extra[i.gzindex]),i.gzindex++;i.gzhead.hcrc&&i.pending>n&&(e.adler=oV(e.adler,i.pending_buf,i.pending-n,n)),i.gzindex===i.gzhead.extra.length&&(i.gzindex=0,i.status=73)}else i.status=73;if(73===i.status)if(i.gzhead.name){n=i.pending;do{if(i.pending===i.pending_buf_size&&(i.gzhead.hcrc&&i.pending>n&&(e.adler=oV(e.adler,i.pending_buf,i.pending-n,n)),vV(e),n=i.pending,i.pending===i.pending_buf_size)){o=1;break}o=i.gzindex<i.gzhead.name.length?255&i.gzhead.name.charCodeAt(i.gzindex++):0,yV(i,o)}while(0!==o);i.gzhead.hcrc&&i.pending>n&&(e.adler=oV(e.adler,i.pending_buf,i.pending-n,n)),0===o&&(i.gzindex=0,i.status=91)}else i.status=91;if(91===i.status)if(i.gzhead.comment){n=i.pending;do{if(i.pending===i.pending_buf_size&&(i.gzhead.hcrc&&i.pending>n&&(e.adler=oV(e.adler,i.pending_buf,i.pending-n,n)),vV(e),n=i.pending,i.pending===i.pending_buf_size)){o=1;break}o=i.gzindex<i.gzhead.comment.length?255&i.gzhead.comment.charCodeAt(i.gzindex++):0,yV(i,o)}while(0!==o);i.gzhead.hcrc&&i.pending>n&&(e.adler=oV(e.adler,i.pending_buf,i.pending-n,n)),0===o&&(i.status=dV)}else i.status=dV;if(i.status===dV&&(i.gzhead.hcrc?(i.pending+2>i.pending_buf_size&&vV(e),i.pending+2<=i.pending_buf_size&&(yV(i,255&e.adler),yV(i,e.adler>>8&255),e.adler=0,i.status=lV)):i.status=lV),0!==i.pending){if(vV(e),0===e.avail_out)return i.last_flush=-1,0}else if(0===e.avail_in&&fV(t)<=fV(r)&&4!==t)return pV(e,-5);if(i.status===hV&&0!==e.avail_in)return pV(e,-5);if(0!==e.avail_in||0!==i.lookahead||0!==t&&i.status!==hV){var s=2===i.strategy?function(e,t){for(var r;;){if(0===e.lookahead&&(EV(e),0===e.lookahead)){if(0===t)return 1;break}if(e.match_length=0,r=iV._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,r&&(mV(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,4===t?(mV(e,!0),0===e.strm.avail_out?3:4):e.last_lit&&(mV(e,!1),0===e.strm.avail_out)?1:2}(i,t):3===i.strategy?function(e,t){for(var r,i,n,o,a=e.window;;){if(e.lookahead<=cV){if(EV(e),e.lookahead<=cV&&0===t)return 1;if(0===e.lookahead)break}if(e.match_length=0,e.lookahead>=3&&e.strstart>0&&(i=a[n=e.strstart-1])===a[++n]&&i===a[++n]&&i===a[++n]){o=e.strstart+cV;do{}while(i===a[++n]&&i===a[++n]&&i===a[++n]&&i===a[++n]&&i===a[++n]&&i===a[++n]&&i===a[++n]&&i===a[++n]&&n<o);e.match_length=cV-(o-n),e.match_length>e.lookahead&&(e.match_length=e.lookahead)}if(e.match_length>=3?(r=iV._tr_tally(e,1,e.match_length-3),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(r=iV._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),r&&(mV(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,4===t?(mV(e,!0),0===e.strm.avail_out?3:4):e.last_lit&&(mV(e,!1),0===e.strm.avail_out)?1:2}(i,t):$x[i.level].func(i,t);if(3!==s&&4!==s||(i.status=hV),1===s||3===s)return 0===e.avail_out&&(i.last_flush=-1),0;if(2===s&&(1===t?iV._tr_align(i):5!==t&&(iV._tr_stored_block(i,0,0,!1),3===t&&(_V(i.head),0===i.lookahead&&(i.strstart=0,i.block_start=0,i.insert=0))),vV(e),0===e.avail_out))return i.last_flush=-1,0}return 4!==t?0:i.wrap<=0?1:(2===i.wrap?(yV(i,255&e.adler),yV(i,e.adler>>8&255),yV(i,e.adler>>16&255),yV(i,e.adler>>24&255),yV(i,255&e.total_in),yV(i,e.total_in>>8&255),yV(i,e.total_in>>16&255),yV(i,e.total_in>>24&255)):(gV(i,e.adler>>>16),gV(i,65535&e.adler)),vV(e),i.wrap>0&&(i.wrap=-i.wrap),0!==i.pending?0:1)},hx.deflateEnd=function(e){var t;return e&&e.state?42!==(t=e.state.status)&&69!==t&&73!==t&&91!==t&&t!==dV&&t!==lV&&t!==hV?pV(e,sV):(e.state=null,t===lV?pV(e,-3):0):sV},hx.deflateSetDictionary=function(e,t){var r,i,n,o,a,s,c,u,d=t.length;if(!e||!e.state)return sV;if(2===(o=(r=e.state).wrap)||1===o&&42!==r.status||r.lookahead)return sV;for(1===o&&(e.adler=nV(e.adler,t,d,0)),r.wrap=0,d>=r.w_size&&(0===o&&(_V(r.head),r.strstart=0,r.block_start=0,r.insert=0),u=new rV.Buf8(r.w_size),rV.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,EV(r);r.lookahead>=3;){i=r.strstart,n=r.lookahead-2;do{r.ins_h=(r.ins_h<<r.hash_shift^r.window[i+3-1])&r.hash_mask,r.prev[i&r.w_mask]=r.head[r.ins_h],r.head[r.ins_h]=i,i++}while(--n);r.strstart=i,r.lookahead=2,EV(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},hx.deflateInfo="pako deflate (from Nodeca project)";var wV={},kV=dx,NV=!0,PV=!0;try{String.fromCharCode.apply(null,[0])}catch(e){NV=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(e){PV=!1}for(var DV=new kV.Buf8(256),MV=0;MV<256;MV++)DV[MV]=MV>=252?6:MV>=248?5:MV>=240?4:MV>=224?3:MV>=192?2:1;function LV(e,t){if(t<65534&&(e.subarray&&PV||!e.subarray&&NV))return String.fromCharCode.apply(null,kV.shrinkBuf(e,t));for(var r="",i=0;i<t;i++)r+=String.fromCharCode(e[i]);return r}DV[254]=DV[254]=1,wV.string2buf=function(e){var t,r,i,n,o,a=e.length,s=0;for(n=0;n<a;n++)55296==(64512&(r=e.charCodeAt(n)))&&n+1<a&&56320==(64512&(i=e.charCodeAt(n+1)))&&(r=65536+(r-55296<<10)+(i-56320),n++),s+=r<128?1:r<2048?2:r<65536?3:4;for(t=new kV.Buf8(s),o=0,n=0;o<s;n++)55296==(64512&(r=e.charCodeAt(n)))&&n+1<a&&56320==(64512&(i=e.charCodeAt(n+1)))&&(r=65536+(r-55296<<10)+(i-56320),n++),r<128?t[o++]=r:r<2048?(t[o++]=192|r>>>6,t[o++]=128|63&r):r<65536?(t[o++]=224|r>>>12,t[o++]=128|r>>>6&63,t[o++]=128|63&r):(t[o++]=240|r>>>18,t[o++]=128|r>>>12&63,t[o++]=128|r>>>6&63,t[o++]=128|63&r);return t},wV.buf2binstring=function(e){return LV(e,e.length)},wV.binstring2buf=function(e){for(var t=new kV.Buf8(e.length),r=0,i=t.length;r<i;r++)t[r]=e.charCodeAt(r);return t},wV.buf2string=function(e,t){var r,i,n,o,a=t||e.length,s=new Array(2*a);for(i=0,r=0;r<a;)if((n=e[r++])<128)s[i++]=n;else if((o=DV[n])>4)s[i++]=65533,r+=o-1;else{for(n&=2===o?31:3===o?15:7;o>1&&r<a;)n=n<<6|63&e[r++],o--;o>1?s[i++]=65533:n<65536?s[i++]=n:(n-=65536,s[i++]=55296|n>>10&1023,s[i++]=56320|1023&n)}return LV(s,i)},wV.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+DV[e[r]]>t?r:t};var UV=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},xV=hx,VV=dx,FV=wV,BV=tV,jV=UV,GV=Object.prototype.toString;function HV(e){if(!(this instanceof HV))return new HV(e);this.options=VV.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 jV,this.strm.avail_out=0;var r=xV.deflateInit2(this.strm,t.level,t.method,t.windowBits,t.memLevel,t.strategy);if(0!==r)throw new Error(BV[r]);if(t.header&&xV.deflateSetHeader(this.strm,t.header),t.dictionary){var i;if(i="string"==typeof t.dictionary?FV.string2buf(t.dictionary):"[object ArrayBuffer]"===GV.call(t.dictionary)?new Uint8Array(t.dictionary):t.dictionary,0!==(r=xV.deflateSetDictionary(this.strm,i)))throw new Error(BV[r]);this._dict_set=!0}}function zV(e,t){var r=new HV(t);if(r.push(e,!0),r.err)throw r.msg||BV[r.err];return r.result}HV.prototype.push=function(e,t){var r,i,n=this.strm,o=this.options.chunkSize;if(this.ended)return!1;i=t===~~t?t:!0===t?4:0,"string"==typeof e?n.input=FV.string2buf(e):"[object ArrayBuffer]"===GV.call(e)?n.input=new Uint8Array(e):n.input=e,n.next_in=0,n.avail_in=n.input.length;do{if(0===n.avail_out&&(n.output=new VV.Buf8(o),n.next_out=0,n.avail_out=o),1!==(r=xV.deflate(n,i))&&0!==r)return this.onEnd(r),this.ended=!0,!1;0!==n.avail_out&&(0!==n.avail_in||4!==i&&2!==i)||("string"===this.options.to?this.onData(FV.buf2binstring(VV.shrinkBuf(n.output,n.next_out))):this.onData(VV.shrinkBuf(n.output,n.next_out)))}while((n.avail_in>0||0===n.avail_out)&&1!==r);return 4===i?(r=xV.deflateEnd(this.strm),this.onEnd(r),this.ended=!0,0===r):2!==i||(this.onEnd(0),n.avail_out=0,!0)},HV.prototype.onData=function(e){this.chunks.push(e)},HV.prototype.onEnd=function(e){0===e&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=VV.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg},lx.Deflate=HV,lx.deflate=zV,lx.deflateRaw=function(e,t){return(t=t||{}).raw=!0,zV(e,t)},lx.gzip=function(e,t){return(t=t||{}).gzip=!0,zV(e,t)};var KV={},WV=c,XV=Ot,qV=G_,YV=s,JV=RegExp.prototype;WV&&YV((function(){return"sy"!==Object.getOwnPropertyDescriptor(JV,"flags").get.call({dotAll:!0,sticky:!0})}))&&XV.f(JV,"flags",{configurable:!0,get:qV});var QV={},ZV=dx,$V=15,eF=[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],tF=[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],rF=[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],iF=[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],nF=dx,oF=Qx,aF=eV,sF=function(e,t){var r,i,n,o,a,s,c,u,d,l,h,p,f,_,v,m,y,g,S,E,b,I,T,A,R;r=e.state,i=e.next_in,A=e.input,n=i+(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,y=(1<<r.distbits)-1;e:do{f<15&&(p+=A[i++]<<f,f+=8,p+=A[i++]<<f,f+=8),g=_[p&m];t:for(;;){if(p>>>=S=g>>>24,f-=S,0===(S=g>>>16&255))R[o++]=65535&g;else{if(!(16&S)){if(0==(64&S)){g=_[(65535&g)+(p&(1<<S)-1)];continue t}if(32&S){r.mode=12;break e}e.msg="invalid literal/length code",r.mode=30;break e}E=65535&g,(S&=15)&&(f<S&&(p+=A[i++]<<f,f+=8),E+=p&(1<<S)-1,p>>>=S,f-=S),f<15&&(p+=A[i++]<<f,f+=8,p+=A[i++]<<f,f+=8),g=v[p&y];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+=A[i++]<<f,(f+=8)<S&&(p+=A[i++]<<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(I=0,T=h,0===l){if(I+=u-S,S<E){E-=S;do{R[o++]=h[I++]}while(--S);I=o-b,T=R}}else if(l<S){if(I+=u+l-S,(S-=l)<E){E-=S;do{R[o++]=h[I++]}while(--S);if(I=0,l<E){E-=S=l;do{R[o++]=h[I++]}while(--S);I=o-b,T=R}}}else if(I+=l-S,S<E){E-=S;do{R[o++]=h[I++]}while(--S);I=o-b,T=R}for(;E>2;)R[o++]=T[I++],R[o++]=T[I++],R[o++]=T[I++],E-=3;E&&(R[o++]=T[I++],E>1&&(R[o++]=T[I++]))}else{I=o-b;do{R[o++]=R[I++],R[o++]=R[I++],R[o++]=R[I++],E-=3}while(E>2);E&&(R[o++]=R[I++],E>1&&(R[o++]=R[I++]))}break}}break}}while(i<n&&o<s);i-=E=f>>3,p&=(1<<(f-=E<<3))-1,e.next_in=i,e.next_out=o,e.avail_in=i<n?n-i+5:5-(i-n),e.avail_out=o<s?s-o+257:257-(o-s),r.hold=p,r.bits=f},cF=function(e,t,r,i,n,o,a,s){var c,u,d,l,h,p,f,_,v,m=s.bits,y=0,g=0,S=0,E=0,b=0,I=0,T=0,A=0,R=0,C=0,O=null,w=0,k=new ZV.Buf16(16),N=new ZV.Buf16(16),P=null,D=0;for(y=0;y<=$V;y++)k[y]=0;for(g=0;g<i;g++)k[t[r+g]]++;for(b=m,E=$V;E>=1&&0===k[E];E--);if(b>E&&(b=E),0===E)return n[o++]=20971520,n[o++]=20971520,s.bits=1,0;for(S=1;S<E&&0===k[S];S++);for(b<S&&(b=S),A=1,y=1;y<=$V;y++)if(A<<=1,(A-=k[y])<0)return-1;if(A>0&&(0===e||1!==E))return-1;for(N[1]=0,y=1;y<$V;y++)N[y+1]=N[y]+k[y];for(g=0;g<i;g++)0!==t[r+g]&&(a[N[t[r+g]]++]=g);if(0===e?(O=P=a,p=19):1===e?(O=eF,w-=257,P=tF,D-=257,p=256):(O=rF,P=iF,p=-1),C=0,g=0,y=S,h=o,I=b,T=0,d=-1,l=(R=1<<b)-1,1===e&&R>852||2===e&&R>592)return 1;for(;;){f=y-T,a[g]<p?(_=0,v=a[g]):a[g]>p?(_=P[D+a[g]],v=O[w+a[g]]):(_=96,v=0),c=1<<y-T,S=u=1<<I;do{n[h+(C>>T)+(u-=c)]=f<<24|_<<16|v|0}while(0!==u);for(c=1<<y-1;C&c;)c>>=1;if(0!==c?(C&=c-1,C+=c):C=0,g++,0==--k[y]){if(y===E)break;y=t[r+a[g]]}if(y>b&&(C&l)!==d){for(0===T&&(T=b),h+=S,A=1<<(I=y-T);I+T<E&&!((A-=k[I+T])<=0);)I++,A<<=1;if(R+=1<<I,1===e&&R>852||2===e&&R>592)return 1;n[d=C&l]=b<<24|I<<16|h-o|0}}return 0!==C&&(n[h+C]=y-T<<24|64<<16|0),s.bits=b,0},uF=-2,dF=12,lF=30;function hF(e){return(e>>>24&255)+(e>>>8&65280)+((65280&e)<<8)+((255&e)<<24)}function pF(){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 nF.Buf16(320),this.work=new nF.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function fF(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 nF.Buf32(852),t.distcode=t.distdyn=new nF.Buf32(592),t.sane=1,t.back=-1,0):uF}function _F(e){var t;return e&&e.state?((t=e.state).wsize=0,t.whave=0,t.wnext=0,fF(e)):uF}function vF(e,t){var r,i;return e&&e.state?(i=e.state,t<0?(r=0,t=-t):(r=1+(t>>4),t<48&&(t&=15)),t&&(t<8||t>15)?uF:(null!==i.window&&i.wbits!==t&&(i.window=null),i.wrap=r,i.wbits=t,_F(e))):uF}function mF(e,t){var r,i;return e?(i=new pF,e.state=i,i.window=null,0!==(r=vF(e,t))&&(e.state=null),r):uF}var yF,gF,SF=!0;function EF(e){if(SF){var t;for(yF=new nF.Buf32(512),gF=new nF.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(cF(1,e.lens,0,288,yF,0,e.work,{bits:9}),t=0;t<32;)e.lens[t++]=5;cF(2,e.lens,0,32,gF,0,e.work,{bits:5}),SF=!1}e.lencode=yF,e.lenbits=9,e.distcode=gF,e.distbits=5}function bF(e,t,r,i){var n,o=e.state;return null===o.window&&(o.wsize=1<<o.wbits,o.wnext=0,o.whave=0,o.window=new nF.Buf8(o.wsize)),i>=o.wsize?(nF.arraySet(o.window,t,r-o.wsize,o.wsize,0),o.wnext=0,o.whave=o.wsize):((n=o.wsize-o.wnext)>i&&(n=i),nF.arraySet(o.window,t,r-i,n,o.wnext),(i-=n)?(nF.arraySet(o.window,t,r-i,i,0),o.wnext=i,o.whave=o.wsize):(o.wnext+=n,o.wnext===o.wsize&&(o.wnext=0),o.whave<o.wsize&&(o.whave+=n))),0}QV.inflateReset=_F,QV.inflateReset2=vF,QV.inflateResetKeep=fF,QV.inflateInit=function(e){return mF(e,15)},QV.inflateInit2=mF,QV.inflate=function(e,t){var r,i,n,o,a,s,c,u,d,l,h,p,f,_,v,m,y,g,S,E,b,I,T,A,R=0,C=new nF.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 uF;(r=e.state).mode===dF&&(r.mode=13),a=e.next_out,n=e.output,c=e.avail_out,o=e.next_in,i=e.input,s=e.avail_in,u=r.hold,d=r.bits,l=s,h=c,I=0;e:for(;;)switch(r.mode){case 1:if(0===r.wrap){r.mode=13;break}for(;d<16;){if(0===s)break e;s--,u+=i[o++]<<d,d+=8}if(2&r.wrap&&35615===u){r.check=0,C[0]=255&u,C[1]=u>>>8&255,r.check=aF(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=lF;break}if(8!=(15&u)){e.msg="unknown compression method",r.mode=lF;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=lF;break}r.dmax=1<<b,e.adler=r.check=1,r.mode=512&u?10:dF,u=0,d=0;break;case 2:for(;d<16;){if(0===s)break e;s--,u+=i[o++]<<d,d+=8}if(r.flags=u,8!=(255&r.flags)){e.msg="unknown compression method",r.mode=lF;break}if(57344&r.flags){e.msg="unknown header flags set",r.mode=lF;break}r.head&&(r.head.text=u>>8&1),512&r.flags&&(C[0]=255&u,C[1]=u>>>8&255,r.check=aF(r.check,C,2,0)),u=0,d=0,r.mode=3;case 3:for(;d<32;){if(0===s)break e;s--,u+=i[o++]<<d,d+=8}r.head&&(r.head.time=u),512&r.flags&&(C[0]=255&u,C[1]=u>>>8&255,C[2]=u>>>16&255,C[3]=u>>>24&255,r.check=aF(r.check,C,4,0)),u=0,d=0,r.mode=4;case 4:for(;d<16;){if(0===s)break e;s--,u+=i[o++]<<d,d+=8}r.head&&(r.head.xflags=255&u,r.head.os=u>>8),512&r.flags&&(C[0]=255&u,C[1]=u>>>8&255,r.check=aF(r.check,C,2,0)),u=0,d=0,r.mode=5;case 5:if(1024&r.flags){for(;d<16;){if(0===s)break e;s--,u+=i[o++]<<d,d+=8}r.length=u,r.head&&(r.head.extra_len=u),512&r.flags&&(C[0]=255&u,C[1]=u>>>8&255,r.check=aF(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)),nF.arraySet(r.head.extra,i,o,p,b)),512&r.flags&&(r.check=aF(r.check,i,p,o)),s-=p,o+=p,r.length-=p),r.length))break e;r.length=0,r.mode=7;case 7:if(2048&r.flags){if(0===s)break e;p=0;do{b=i[o+p++],r.head&&b&&r.length<65536&&(r.head.name+=String.fromCharCode(b))}while(b&&p<s);if(512&r.flags&&(r.check=aF(r.check,i,p,o)),s-=p,o+=p,b)break e}else r.head&&(r.head.name=null);r.length=0,r.mode=8;case 8:if(4096&r.flags){if(0===s)break e;p=0;do{b=i[o+p++],r.head&&b&&r.length<65536&&(r.head.comment+=String.fromCharCode(b))}while(b&&p<s);if(512&r.flags&&(r.check=aF(r.check,i,p,o)),s-=p,o+=p,b)break e}else r.head&&(r.head.comment=null);r.mode=9;case 9:if(512&r.flags){for(;d<16;){if(0===s)break e;s--,u+=i[o++]<<d,d+=8}if(u!==(65535&r.check)){e.msg="header crc mismatch",r.mode=lF;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=dF;break;case 10:for(;d<32;){if(0===s)break e;s--,u+=i[o++]<<d,d+=8}e.adler=r.check=hF(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=dF;case dF:if(5===t||6===t)break e;case 13:if(r.last){u>>>=7&d,d-=7&d,r.mode=27;break}for(;d<3;){if(0===s)break e;s--,u+=i[o++]<<d,d+=8}switch(r.last=1&u,d-=1,3&(u>>>=1)){case 0:r.mode=14;break;case 1:if(EF(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=lF}u>>>=2,d-=2;break;case 14:for(u>>>=7&d,d-=7&d;d<32;){if(0===s)break e;s--,u+=i[o++]<<d,d+=8}if((65535&u)!=(u>>>16^65535)){e.msg="invalid stored block lengths",r.mode=lF;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;nF.arraySet(n,i,o,p,a),s-=p,o+=p,c-=p,a+=p,r.length-=p;break}r.mode=dF;break;case 17:for(;d<14;){if(0===s)break e;s--,u+=i[o++]<<d,d+=8}if(r.nlen=257+(31&u),u>>>=5,d-=5,r.ndist=1+(31&u),u>>>=5,d-=5,r.ncode=4+(15&u),u>>>=4,d-=4,r.nlen>286||r.ndist>30){e.msg="too many length or distance symbols",r.mode=lF;break}r.have=0,r.mode=18;case 18:for(;r.have<r.ncode;){for(;d<3;){if(0===s)break e;s--,u+=i[o++]<<d,d+=8}r.lens[O[r.have++]]=7&u,u>>>=3,d-=3}for(;r.have<19;)r.lens[O[r.have++]]=0;if(r.lencode=r.lendyn,r.lenbits=7,T={bits:r.lenbits},I=cF(0,r.lens,0,19,r.lencode,0,r.work,T),r.lenbits=T.bits,I){e.msg="invalid code lengths set",r.mode=lF;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,y=65535&R,!((v=R>>>24)<=d);){if(0===s)break e;s--,u+=i[o++]<<d,d+=8}if(y<16)u>>>=v,d-=v,r.lens[r.have++]=y;else{if(16===y){for(A=v+2;d<A;){if(0===s)break e;s--,u+=i[o++]<<d,d+=8}if(u>>>=v,d-=v,0===r.have){e.msg="invalid bit length repeat",r.mode=lF;break}b=r.lens[r.have-1],p=3+(3&u),u>>>=2,d-=2}else if(17===y){for(A=v+3;d<A;){if(0===s)break e;s--,u+=i[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+=i[o++]<<d,d+=8}d-=v,b=0,p=11+(127&(u>>>=v)),u>>>=7,d-=7}if(r.have+p>r.nlen+r.ndist){e.msg="invalid bit length repeat",r.mode=lF;break}for(;p--;)r.lens[r.have++]=b}}if(r.mode===lF)break;if(0===r.lens[256]){e.msg="invalid code -- missing end-of-block",r.mode=lF;break}if(r.lenbits=9,T={bits:r.lenbits},I=cF(1,r.lens,0,r.nlen,r.lencode,0,r.work,T),r.lenbits=T.bits,I){e.msg="invalid literal/lengths set",r.mode=lF;break}if(r.distbits=6,r.distcode=r.distdyn,T={bits:r.distbits},I=cF(2,r.lens,r.nlen,r.ndist,r.distcode,0,r.work,T),r.distbits=T.bits,I){e.msg="invalid distances set",r.mode=lF;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,sF(e,h),a=e.next_out,n=e.output,c=e.avail_out,o=e.next_in,i=e.input,s=e.avail_in,u=r.hold,d=r.bits,r.mode===dF&&(r.back=-1);break}for(r.back=0;m=(R=r.lencode[u&(1<<r.lenbits)-1])>>>16&255,y=65535&R,!((v=R>>>24)<=d);){if(0===s)break e;s--,u+=i[o++]<<d,d+=8}if(m&&0==(240&m)){for(g=v,S=m,E=y;m=(R=r.lencode[E+((u&(1<<g+S)-1)>>g)])>>>16&255,y=65535&R,!(g+(v=R>>>24)<=d);){if(0===s)break e;s--,u+=i[o++]<<d,d+=8}u>>>=g,d-=g,r.back+=g}if(u>>>=v,d-=v,r.back+=v,r.length=y,0===m){r.mode=26;break}if(32&m){r.back=-1,r.mode=dF;break}if(64&m){e.msg="invalid literal/length code",r.mode=lF;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+=i[o++]<<d,d+=8}r.length+=u&(1<<r.extra)-1,u>>>=r.extra,d-=r.extra,r.back+=r.extra}r.was=r.length,r.mode=23;case 23:for(;m=(R=r.distcode[u&(1<<r.distbits)-1])>>>16&255,y=65535&R,!((v=R>>>24)<=d);){if(0===s)break e;s--,u+=i[o++]<<d,d+=8}if(0==(240&m)){for(g=v,S=m,E=y;m=(R=r.distcode[E+((u&(1<<g+S)-1)>>g)])>>>16&255,y=65535&R,!(g+(v=R>>>24)<=d);){if(0===s)break e;s--,u+=i[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=lF;break}r.offset=y,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+=i[o++]<<d,d+=8}r.offset+=u&(1<<r.extra)-1,u>>>=r.extra,d-=r.extra,r.back+=r.extra}if(r.offset>r.dmax){e.msg="invalid distance too far back",r.mode=lF;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=lF;break}p>r.wnext?(p-=r.wnext,f=r.wsize-p):f=r.wnext-p,p>r.length&&(p=r.length),_=r.window}else _=n,f=a-r.offset,p=r.length;p>c&&(p=c),c-=p,r.length-=p;do{n[a++]=_[f++]}while(--p);0===r.length&&(r.mode=21);break;case 26:if(0===c)break e;n[a++]=r.length,c--,r.mode=21;break;case 27:if(r.wrap){for(;d<32;){if(0===s)break e;s--,u|=i[o++]<<d,d+=8}if(h-=c,e.total_out+=h,r.total+=h,h&&(e.adler=r.check=r.flags?aF(r.check,n,h,a-h):oF(r.check,n,h,a-h)),h=c,(r.flags?u:hF(u))!==r.check){e.msg="incorrect data check",r.mode=lF;break}u=0,d=0}r.mode=28;case 28:if(r.wrap&&r.flags){for(;d<32;){if(0===s)break e;s--,u+=i[o++]<<d,d+=8}if(u!==(4294967295&r.total)){e.msg="incorrect length check",r.mode=lF;break}u=0,d=0}r.mode=29;case 29:I=1;break e;case lF:I=-3;break e;case 31:return-4;default:return uF}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<lF&&(r.mode<27||4!==t))&&bF(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?aF(r.check,n,h,e.next_out-h):oF(r.check,n,h,e.next_out-h)),e.data_type=r.bits+(r.last?64:0)+(r.mode===dF?128:0)+(20===r.mode||15===r.mode?256:0),(0===l&&0===h||4===t)&&0===I&&(I=-5),I},QV.inflateEnd=function(e){if(!e||!e.state)return uF;var t=e.state;return t.window&&(t.window=null),e.state=null,0},QV.inflateGetHeader=function(e,t){var r;return e&&e.state?0==(2&(r=e.state).wrap)?uF:(r.head=t,t.done=!1,0):uF},QV.inflateSetDictionary=function(e,t){var r,i=t.length;return e&&e.state?0!==(r=e.state).wrap&&11!==r.mode?uF:11===r.mode&&oF(1,t,i,0)!==r.check?-3:bF(e,t,i,i)?(r.mode=31,-4):(r.havedict=1,0):uF},QV.inflateInfo="pako inflate (from Nodeca project)";var IF={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 TF=QV,AF=dx,RF=wV,CF=IF,OF=tV,wF=UV,kF=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},NF=Object.prototype.toString;function PF(e){if(!(this instanceof PF))return new PF(e);this.options=AF.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 wF,this.strm.avail_out=0;var r=TF.inflateInit2(this.strm,t.windowBits);if(r!==CF.Z_OK)throw new Error(OF[r]);if(this.header=new kF,TF.inflateGetHeader(this.strm,this.header),t.dictionary&&("string"==typeof t.dictionary?t.dictionary=RF.string2buf(t.dictionary):"[object ArrayBuffer]"===NF.call(t.dictionary)&&(t.dictionary=new Uint8Array(t.dictionary)),t.raw&&(r=TF.inflateSetDictionary(this.strm,t.dictionary))!==CF.Z_OK))throw new Error(OF[r])}function DF(e,t){var r=new PF(t);if(r.push(e,!0),r.err)throw r.msg||OF[r.err];return r.result}PF.prototype.push=function(e,t){var r,i,n,o,a,s=this.strm,c=this.options.chunkSize,u=this.options.dictionary,d=!1;if(this.ended)return!1;i=t===~~t?t:!0===t?CF.Z_FINISH:CF.Z_NO_FLUSH,"string"==typeof e?s.input=RF.binstring2buf(e):"[object ArrayBuffer]"===NF.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 AF.Buf8(c),s.next_out=0,s.avail_out=c),(r=TF.inflate(s,CF.Z_NO_FLUSH))===CF.Z_NEED_DICT&&u&&(r=TF.inflateSetDictionary(this.strm,u)),r===CF.Z_BUF_ERROR&&!0===d&&(r=CF.Z_OK,d=!1),r!==CF.Z_STREAM_END&&r!==CF.Z_OK)return this.onEnd(r),this.ended=!0,!1;s.next_out&&(0!==s.avail_out&&r!==CF.Z_STREAM_END&&(0!==s.avail_in||i!==CF.Z_FINISH&&i!==CF.Z_SYNC_FLUSH)||("string"===this.options.to?(n=RF.utf8border(s.output,s.next_out),o=s.next_out-n,a=RF.buf2string(s.output,n),s.next_out=o,s.avail_out=c-o,o&&AF.arraySet(s.output,s.output,n,o,0),this.onData(a)):this.onData(AF.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!==CF.Z_STREAM_END);return r===CF.Z_STREAM_END&&(i=CF.Z_FINISH),i===CF.Z_FINISH?(r=TF.inflateEnd(this.strm),this.onEnd(r),this.ended=!0,r===CF.Z_OK):i!==CF.Z_SYNC_FLUSH||(this.onEnd(CF.Z_OK),s.avail_out=0,!0)},PF.prototype.onData=function(e){this.chunks.push(e)},PF.prototype.onEnd=function(e){e===CF.Z_OK&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=AF.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg},KV.Inflate=PF,KV.inflate=DF,KV.inflateRaw=function(e,t){return(t=t||{}).raw=!0,DF(e,t)},KV.ungzip=DF;var MF={};(0,dx.assign)(MF,lx,KV,IF);var LF=MF,UF="RTC_DEVICE_ID",xF="RTC_ACCESS_NODE",VF="RTC_ACCESS_URLS",FF="RTC_H264_BLACK_LIST",BF="engine_BAC",jF="SERVER_CONFIG",GF=function(){function e(){}return e.prototype.get=function(e){var t=localStorage.getItem(e);if(!t)return null;try{var r=JSON.parse(t);return r.ttl>0&&Date.now()-r.saveTime>r.ttl?(this.delete(e),null):r.message}catch(e){return null}},e.prototype.set=function(e,t,r){void 0===r&&(r=-1);var i={ttl:r,saveTime:Date.now(),message:t};try{return localStorage.setItem(e,JSON.stringify(i)),!0}catch(e){return!1}},e.prototype.delete=function(e){try{return localStorage.removeItem(e),!0}catch(e){return!1}},e}(),HF=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t._accessVersion="v2",t}return Of(t,e),t.prototype.getDeviceId=function(){if(DU())return"";var e=this.get(UF);return e||(e=dU()),this.set(UF,e),e},t.prototype.setDeviceId=function(e){return[lj,hj,pj].forEach((function(t){return t.setStats({device_id:e})})),this.set(UF,e),e},t.prototype.getAccessNode=function(e){return this.get("".concat(xF,"_").concat(e,"-BytePlus-").concat(this._accessVersion))},t.prototype.setAccessNode=function(e,t,r){},t.prototype.clearAccessNode=function(e){this.delete("".concat(xF,"_").concat(e,"-BytePlus"))},t.prototype.getAccessUrls=function(){return this.get("".concat(VF,"-BytePlus"))},t.prototype.setAccessUrls=function(e){},t.prototype.clearAccessUrls=function(){this.delete("".concat(VF,"-BytePlus"))},t.prototype.getH264BlackList=function(){return this.get(FF)},t.prototype.setH264BlackList=function(e){return this.set(FF,e)},t.prototype.getAudioProfile=function(){return this.get(BF)},t.prototype.setAudioProfile=function(e){return this.set(BF,e)},t.prototype.getServerConfig=function(e){var t,r="".concat(e),i=this.get(jF);return(null===(t=null==i?void 0:i.find((function(e){return e.key===r})))||void 0===t?void 0:t.config)||{}},t.prototype.setServerConfig=function(e,t){if(t){var r="".concat(e),i=this.get(jF)||[];return i=i.filter((function(e){return e.key!==r})),i.push({key:r,config:t}),this.set(jF,i.slice(-5))}},t}(GF),zF=new HF,KF="rtc-access.rtcplus.com,rtc-access-sg.rtcplus.com,rtc-access-va.rtcplus.com,rtc-access-fr.rtcplus.com".split(",");function WF(e){return void 0===e&&(e=""),"https://".concat(e,"/dispatch/v1/AccessInfo?Action=GetAccessInfo")}var XF="https://web-log-report.rtcplus.com/video/v1/webrtc_log/",qF="rtc.rtcplus.com".split(","),YF={VERSION:"4.45.0-blw.13",ICE_CONFIG_REQUEST_URLS_INTERNAL:KF.map(WF),ICE_CONFIG_REQUEST_URLS:[],EXPECTED_ADDR:"",LOG_SERVER_URL:XF,CONFIG_REQUEST_DOMAINS:qF,DEVICE_ID:"",OVERSEA:!1,ENABLE_FALLBACK_HANDLER:!1};function JF(e,t){if("VERSION"!==e)return"ICE_CONFIG_REQUEST_URLS"===e?("string"==typeof t&&(t=[t]),void(YF.ICE_CONFIG_REQUEST_URLS=t.map(WF))):void("LOG_SERVER_URL"!==e||t!==Hf.overseas?"LOG_SERVER_URL"!==e||t!==Hf.domestic?"LOG_SERVER_URL"!==e||"string"!=typeof t?"OVERSEA"!==e?"ENABLE_FALLBACK_HANDLER"!==e?("DEVICE_ID"===e&&zF.setDeviceId(t),YF[e]=t):YF.ENABLE_FALLBACK_HANDLER=t:YF.OVERSEA=t:YF.LOG_SERVER_URL=t:YF.LOG_SERVER_URL=XF:YF.LOG_SERVER_URL="https://web-log-report.rtcplus.com/video/v1/webrtc_log/")}function QF(e){return"DEVICE_ID"===e?zF.getDeviceId():YF[e]}function ZF(e,t){var r,i,n,o,a,s,c,u,d,l,h,p,f,_,v,m,y;return{type:"transcode",action:e,transcodeMeta:{transcode:{url:t.url},control:{protocol:"2.0"},audio:{codec:(null===(r=t.audio)||void 0===r?void 0:r.codec)||eB.audio.codec,bitRate:1e3*((null===(i=t.audio)||void 0===i?void 0:i.kBitRate)||eB.audio.kBitRate),sampleRate:1e3*((null===(n=t.audio)||void 0===n?void 0:n.sampleRate)||eB.audio.sampleRate),channels:(null===(o=t.audio)||void 0===o?void 0:o.channels)||eB.audio.channels,profile:(null===(a=t.audio)||void 0===a?void 0:a.AACProfile)||eB.audio.AACProfile},video:{codec:(null===(s=t.video)||void 0===s?void 0:s.codec)||eB.video.codec,fps:(null===(c=t.video)||void 0===c?void 0:c.fps)||eB.video.fps,gop:(null===(u=t.video)||void 0===u?void 0:u.gop)||eB.video.gop,lowLatency:null!==(l=null===(d=t.video)||void 0===d?void 0:d.lowLatency)&&void 0!==l?l:eB.video.lowLatency,bitRate:1e3*((null===(h=t.video)||void 0===h?void 0:h.kBitRate)||eB.video.kBitRate),width:(null===(p=t.video)||void 0===p?void 0:p.width)||eB.video.width,height:(null===(f=t.video)||void 0===f?void 0:f.height)||eB.video.height},layout:{canvas:{bgnd:(null===(_=t.layout)||void 0===_?void 0:_.backgroundColor)||eB.layout.backgroundColor},regions:(null===(m=null===(v=t.layout)||void 0===v?void 0:v.regions)||void 0===m?void 0:m.map((function(e){return{alpha:Math.min(Math.max(+e.alpha,0),1),uid:e.userId,zorder:e.zorder,x:Math.min(Math.max(+e.x,0),1),y:Math.min(Math.max(+e.y,0),1),w:Math.min(Math.max(+e.w,0),1),h:Math.min(Math.max(+e.h,0),1),renderMode:e.renderMode||1,contentControl:e.contentControl||0,screen:e.isScreenStream,local_user:e.isLocalUser}})))||[],app_data:(null===(y=t.layout)||void 0===y?void 0:y.appData)||eB.layout.appData}}}}function $F(e,t,r){var i,n,o,a,s,c,u,d,l;return{type:"publicstream",action:t,publicStreamID:e,publicStreamMeta:{audio:{},video:{fps:(null===(i=r.video)||void 0===i?void 0:i.fps)||15,bitrate:1e3*((null===(n=r.video)||void 0===n?void 0:n.kBitRate)||40),width:(null===(o=r.video)||void 0===o?void 0:o.width)||640,height:(null===(a=r.video)||void 0===a?void 0:a.height)||360},layout:{layoutMode:2,interpolationMode:(null===(s=r.layout)||void 0===s?void 0:s.interpolationMode)||Wf.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 eB={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"}},tB=[{width:320,height:180,frameRate:15,maxKbps:200},{width:640,height:360,frameRate:15,maxKbps:500},{width:640,height:480,frameRate:15,maxKbps:600},{width:960,height:540,frameRate:15,maxKbps:900},{width:1280,height:720,frameRate:15,maxKbps:2e3},{width:1920,height:1080,frameRate:15,maxKbps:3500}];var rB={width:640,height:360,frameRate:30,maxKbps:600},iB={width:1920,height:1080,frameRate:15,maxKbps:3e3},nB={exports:{}};!function(e){var t=Object.prototype.hasOwnProperty,r="~";function i(){}function n(e,t,r){this.fn=e,this.context=t,this.once=r||!1}function o(e,t,i,o,a){if("function"!=typeof i)throw new TypeError("The listener must be a function");var s=new n(i,o||e,a),c=r?r+t:t;return e._events[c]?e._events[c].fn?e._events[c]=[e._events[c],s]:e._events[c].push(s):(e._events[c]=s,e._eventsCount++),e}function a(e,t){0==--e._eventsCount?e._events=new i:delete e._events[t]}function s(){this._events=new i,this._eventsCount=0}Object.create&&(i.prototype=Object.create(null),(new i).__proto__||(r=!1)),s.prototype.eventNames=function(){var e,i,n=[];if(0===this._eventsCount)return n;for(i in e=this._events)t.call(e,i)&&n.push(r?i.slice(1):i);return Object.getOwnPropertySymbols?n.concat(Object.getOwnPropertySymbols(e)):n},s.prototype.listeners=function(e){var t=r?r+e:e,i=this._events[t];if(!i)return[];if(i.fn)return[i.fn];for(var n=0,o=i.length,a=new Array(o);n<o;n++)a[n]=i[n].fn;return a},s.prototype.listenerCount=function(e){var t=r?r+e:e,i=this._events[t];return i?i.fn?1:i.length:0},s.prototype.emit=function(e,t,i,n,o,a){var s=r?r+e:e;if(!this._events[s])return!1;var c,u,d=this._events[s],l=arguments.length;if(d.fn){switch(d.once&&this.removeListener(e,d.fn,void 0,!0),l){case 1:return d.fn.call(d.context),!0;case 2:return d.fn.call(d.context,t),!0;case 3:return d.fn.call(d.context,t,i),!0;case 4:return d.fn.call(d.context,t,i,n),!0;case 5:return d.fn.call(d.context,t,i,n,o),!0;case 6:return d.fn.call(d.context,t,i,n,o,a),!0}for(u=1,c=new Array(l-1);u<l;u++)c[u-1]=arguments[u];d.fn.apply(d.context,c)}else{var h,p=d.length;for(u=0;u<p;u++)switch(d[u].once&&this.removeListener(e,d[u].fn,void 0,!0),l){case 1:d[u].fn.call(d[u].context);break;case 2:d[u].fn.call(d[u].context,t);break;case 3:d[u].fn.call(d[u].context,t,i);break;case 4:d[u].fn.call(d[u].context,t,i,n);break;default:if(!c)for(h=1,c=new Array(l-1);h<l;h++)c[h-1]=arguments[h];d[u].fn.apply(d[u].context,c)}}return!0},s.prototype.on=function(e,t,r){return o(this,e,t,r,!1)},s.prototype.once=function(e,t,r){return o(this,e,t,r,!0)},s.prototype.removeListener=function(e,t,i,n){var o=r?r+e:e;if(!this._events[o])return this;if(!t)return a(this,o),this;var s=this._events[o];if(s.fn)s.fn!==t||n&&!s.once||i&&s.context!==i||a(this,o);else{for(var c=0,u=[],d=s.length;c<d;c++)(s[c].fn!==t||n&&!s[c].once||i&&s[c].context!==i)&&u.push(s[c]);u.length?this._events[o]=1===u.length?u[0]:u:a(this,o)}return this},s.prototype.removeAllListeners=function(e){var t;return e?(t=r?r+e:e,this._events[t]&&a(this,t)):(this._events=new i,this._eventsCount=0),this},s.prototype.off=s.prototype.removeListener,s.prototype.addListener=s.prototype.on,s.prefixed=r,s.EventEmitter=s,e.exports=s}(nB);var oB,aB,sB,cB,uB,dB,lB,hB,pB,fB,_B,vB,mB,yB,gB,SB,EB,bB,IB,TB,AB,RB,CB,OB,wB,kB,NB,PB,DB,MB,LB,UB,xB,VB,FB,BB,jB,GB,HB,zB,KB,WB,XB,qB,YB,JB,QB,ZB=nB.exports,$B="[VERTC]",ej=["#0050b3","#0050b3","#0050b3","#0050b3","#0050b3"],tj=!DU()&&window.location.search.includes("_rtc_debug_"),rj=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(window._ve_sdk_cb&&window._ve_sdk_cb.apply(window,a_(["".concat($B,"[").concat(this._module,".").concat(e,"] ").concat(t.shift())],o_(t),!1)),tj){for(var i="",n=0;n<this._indent;n++)i+=" ";console.log.apply(console,a_(["%c".concat(ij(),"-").concat($B).concat(i,"[").concat(this._module,".").concat(e,"] ").concat(t.shift()),"color:".concat(ej[this._indent],";")],o_(t),!1))}},e}(),ij=function(){var e=new Date;return e.toTimeString().split(" ")[0]+":"+e.getMilliseconds()},nj=new rj("VERTC",0),oj=function(e){function t(){return e.call(this)||this}return Of(t,e),t.prototype.safeEmit=function(t){for(var r=[],i=1;i<arguments.length;i++)r[i-1]=arguments[i];var n=this.listenerCount(t);try{return e.prototype.emit.apply(this,a_([t],o_(r),!1))}catch(e){return nj.print("safaEmit","safeEmit() | event listener threw an error [event:%s]:%o",t,e),Boolean(n)}},t.prototype.safeEmitAsPromise=function(e){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];return r_(this,void 0,void 0,(function(){var r=this;return i_(this,(function(i){return[2,new Promise((function(i,n){try{r.emit.apply(r,a_(a_([e],o_(t),!1),[i,n],!1))}catch(t){nj.print("safeEmitAsPromise","safeEmitAsPromise() | event listener threw an error [event:%s]:%o",e,t),n(t)}}))]}))}))},t}(nB.exports.EventEmitter);!function(e){e.RTC_SDK_API_CALL="rtc_sdk_api_call",e.RTC_SDK_CALLBACK="rtc_sdk_callback",e.RTC_GET_CONFIG="rtc_get_config",e.RTC_RECONNECT="rtc_reconnect",e.RTC_RECONNECTED="rtc_reconnected",e.RTC_GET_ACCESS="rtc_get_access",e.RTC_PRE_ICE_STATE="rtc_pre_ice_state",e.RTC_NODE_CHANGE="rtc_node_change",e.RTC_SIGNALING_MSG_ERROR="rtc_signaling_msg_error",e.RTC_SIGNALING="rtc_signaling",e.RTC_JOIN_ROOM="rtc_join_room",e.RTC_LEAVE_ROOM="rtc_leave_room",e.RTC_BEGIN_CREATE_OFFER="rtc_begin_create_offer",e.RTC_CREATE_OFFER="rtc_create_offer",e.RTC_SET_DESCRIPTION="rtc_set_description",e.RTC_RECV_ANSWER="rtc_recv_answer",e.FIRST_REMOTE_AUDIO_RENDER="first_remote_audio_render",e.FIRST_REMOTE_VIDEO_RENDER="first_remote_video_render",e.RTC_PUBLISH_STAT="rtc_publish_stat",e.RTC_SUBSCRIBE_STAT="rtc_subscribe_stat",e.RTC_AUDIO_DEVICE="rtc_audio_device",e.RTC_MEDIA_STATISTICS="rtc_media_statistics",e.RTC_MESSAGE_STATISTICS="rtc_message_statistics",e.RTC_ERROR="rtc_error",e.RTC_INVOKE_STATUS="rtc_invoke_status",e.RTC_FIRST_FRAME="rtc_first_frame",e.RTC_MUTE_REMOTE="rtc_mute_remote",e.SDK_INIT_ENGINE="sdk_init_engine",e.JOIN_ROOM="join_room",e.P2P_CONNECTION_STATUS="p2p_connection_status",e.P2P_CONNECT_CLOSED="p2p_connect_closed",e.RTC_DEVICE_ERROR="rtc_device_error",e.RTC_VIDEO_DEVICE="rtc_video_device",e.RTC_VIDEO_CAPTURE_EVENT="rtc_video_capture_event",e.RTC_ENCODE_FIRST_FRAME="rtc_encode_first_frame",e.RTC_FIRST_FRAME_ENCODED="rtc_first_frame_encoded",e.RTC_SEND_FIRST_PACKET="rtc_send_first_packet",e.RTC_RECV_FIRST_PACKET="rtc_recv_first_packet",e.RTC_RECV_FIRST_FRAME="rtc_recv_first_frame",e.RTC_DECODE_FIRST_FRAME="rtc_decode_first_frame"}(oB||(oB={})),function(e){e.RTC="rtc"}(aB||(aB={})),function(e){e.W_5="5"}(sB||(sB={})),function(e){e.IOS="ios",e.ANDROID="android",e.WEB="web",e.WINDOWS="windows",e.MAC="mac",e.LINUX="linux"}(cB||(cB={})),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"}(uB||(uB={})),function(e){e.UNKNOWN="unknown",e.BROADCASTER="broadcaster",e.AUDIENCE="audience",e.SILENTAUDIENCE="silentAudience"}(dB||(dB={})),function(e){e.REQUEST="request",e.RESPONSE="response"}(lB||(lB={})),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"}(hB||(hB={})),function(e){e.WEBSOCKET="websocket",e.NETWORKCHANGED="networkChanged",e.PEERCONNECTION="peerconnection"}(pB||(pB={})),function(e){e.WEBSOCKET_RECONNECTED="websocket reconnected",e.PEERCONNECTION_RECONNECTED="peerconnection reconnected"}(fB||(fB={})),function(e){e.WEBSOCKET="websocket",e.NETWORKCHANGED="networkChanged",e.PEERCONNECTION="peerconnection"}(_B||(_B={})),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"}(vB||(vB={})),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"}(mB||(mB={})),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"}(yB||(yB={})),function(e){e.CALL_JOINROOM="call-joinRoom",e.JOINROOM="joinRoom",e.CALL_RECONNECTED="call-reconnected",e.RECONNECTED="reconnected",e.CALL_PUBLISH="call-publish",e.PUBLISH="publish",e.CALL_UPDATESTREAMATTRIBUTES="call-updateStreamAttributes",e.UPDATESTREAMATTRIBUTES="updateStreamAttributes",e.CALL_UNPUBLISH="call-unpublish",e.UNPUBLISH="unpublish",e.CALL_SUBSCRIBE="call-subscribe",e.SUBSCRIBE="subscribe",e.CALL_UPDATESUBSCRIBE="call-updateSubscribe",e.UPDATESUBSCRIBE="updateSubscribe",e.CALL_UNSUBSCRIBE="call-unsubscribe",e.UNSUBSCRIBE="unsubscribe",e.CALL_UPDATEUSERATTRIBUTES="call-updateUserAttributes",e.UPDATEUSERATTRIBUTES="updateUserAttributes",e.CALL_LEAVEROOM="call-leaveRoom",e.LEAVEROOM="leaveRoom",e.ON_USERCONNECTION="on-userConnection",e.ON_USERDISCONNECTION="on-userDisconnection",e.ON_ONADDSTREAM="on-onAddStream",e.ON_ONPUSHSTREAM="on-onPushStream",e.ON_ONREMOVESTREAM="on-onRemoveStream",e.ON_ONPUSHTRACK="on-onPushTrack",e.ON_ONREMOVETRACK="on-onRemoveTrack",e.ON_ONUPDATEUSERATTRIBUTES="on-onUpdateUserAttributes",e.ON_ONUPDATEROOMATTRIBUTES="on-onUpdateRoomAttributes",e.ON_ONUPDATESTREAMATTRIBUTES="on-onUpdateStreamAttributes",e.ON_STREAMFAILED="on-streamFailed",e.ON_POSTPROCESSINGMESSAGE="on-postProcessingMessage",e.ON_ENGINECONTROLMESSAGE="on-engineControlMessage",e.ON_WEBSOCKETENGINECUSTOMMESSAGE="on-websocketEngineCustomMessage",e.UNKNOWN="unknown",e.CALL_UPDATEPUBLISHSTREAMCHANNEL="call-updatePublishStreamChannel",e.UPDATEPUBLISHSTREAMCHANNEL="updatePublishStreamChannel",e.CALL_UPDATESUBSCRIBESTREAMCHANNEL="call-updateSubscribeStreamChannel",e.UPDATESUBSCRIBESTREAMCHANNEL="updateSubscribeStreamChannel",e.ON_ONSTREAMCHANNELCHANGE="on-onStreamChannelChange",e.P2PDIRECT="p2pdirect",e.INTERNAL_CUSTOM="internal_custom",e.REPORT="report",e.CONNECTION_CONTROL="connection_control",e.ON_INTERNAL_CUSTOM="on_internal_custom",e.CONTROLMESSAGE="controlMessage",e.CALL_LOGIN="call-login",e.LOGIN="login",e.CALL_RECONNECTLOGIN="call-reconnectLogin",e.RECONNECTLOGIN="reconnectLogin",e.CALL_LOGOUT="call-logout",e.LOGOUT="logout",e.CALL_UPDATELOGINTOKEN="call-updateLoginToken",e.UPDATELOGINTOKEN="updateLoginToken",e.CALL_SETSERVERPARAMS="call-setServerParams",e.SETSERVERPARAMS="setServerParams",e.CALL_GETPEERONLINESTATUS="call-getPeerOnlineStatus",e.GETPEERONLINESTATUS="getPeerOnlineStatus",e.ON_ONSCENECONFIG="on-onSceneConfig",e.ON_STREAMCONTROLMESSAGE="on-streamControlMessage",e.CALL_STARTPUSHSTREAM="call-startPushStream",e.STARTPUSHSTREAM="startPushStream",e.CALL_STOPPUSHSTREAM="call-stopPushStream",e.STOPPUSHSTREAM="stopPushStream",e.CALL_STARTPULLSTREAM="call-startPullStream",e.STARTPULLSTREAM="startPullStream",e.CALL_STOPPULLSTREAM="call-stopPullStream",e.STOPPULLSTREAM="stopPullStream",e.CALL_UPDATEPULLSTREAM="call-updatePullStream",e.UPDATEPULLSTREAM="updatePullStream",e.ON_ONSTREAMPUSHEDBYOTHER="on-onStreamPushedByOther",e.CALL_UPDATETOKEN="call-updateToken",e.UPDATETOKEN="updateToken",e.ON_ONTOKENWILLEXPIRE="on-onTokenWillExpire",e.ON_ONPUSHCLIENTCONFIG="on-onPushClientConfig",e.CALL_GETCLIENTCONFIG="call-getClientConfig",e.GETCLIENTCONFIG="getClientConfig"}(gB||(gB={})),function(e){e.UP="up",e.DOWN="down",e.DIRECT="direct"}(SB||(SB={})),function(e){e.UP="up",e.DOWN="down",e.PRE="pre"}(EB||(EB={})),function(e){e.UP="up",e.DOWN="down",e.PRE="pre"}(bB||(bB={})),function(e){e.W_0="0",e.W_1="1"}(IB||(IB={})),function(e){e.UP="up",e.DOWN="down"}(TB||(TB={})),function(e){e.ANSWER="answer",e.INCRANSWER="incranswer"}(AB||(AB={})),function(e){e.UP="up",e.DOWN="down"}(RB||(RB={})),function(e){e.SUCCESS="success",e.FAIL="fail"}(CB||(CB={})),function(e){e.W_0="0",e.W_1="1"}(OB||(OB={})),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"}(wB||(wB={})),function(e){e.SUCCESS="success",e.FAIL="fail",e.IGNORE="ignore"}(kB||(kB={})),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"}(NB||(NB={})),function(e){e.PLAYOUT_DEVICE_SWITCH="playout_device_switch",e.RECORD_DEVICE_SWITCH="record_device_switch",e.UNKNOWN="unknown"}(PB||(PB={})),function(e){e.BEGIN_SEND="begin_send",e.SENT_END="sent_end",e.BEGIN_RECV="begin_recv",e.RECV_END="recv_end"}(DB||(DB={})),function(e){e.AUDIO="audio",e.VIDEO="video",e.SCREEN_VIDEO="screen_video",e.SCREEN_AUDIO="screen_audio"}(MB||(MB={})),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"}(LB||(LB={})),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"}(UB||(UB={})),function(e){e.AUDIO="audio",e.VIDEO="video"}(xB||(xB={})),function(e){e.BEGIN="begin",e.END="end"}(VB||(VB={})),function(e){e.BEGIN="begin",e.END="end"}(FB||(FB={})),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"}(BB||(BB={})),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"}(jB||(jB={})),function(e){e.NOMINAL="Nominal",e.FAIR="Fair",e.SERIOUS="Serious",e.CRITICAL="Critical",e.UNKNWON="Unknwon"}(GB||(GB={})),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"}(HB||(HB={})),function(e){e.P2P="p2p",e.P2P_OUTSIDE_ROOM="p2p_outside_room",e.P2SERVER="p2server"}(zB||(zB={})),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"}(KB||(KB={})),function(e){e.DSHOW="dshow",e.MF="mf",e.AVCAPTURESESSION="avcapturesession",e.CAMERA1="camera1",e.CAMERA2="camera2",e.VECAMERA="vecamera"}(WB||(WB={})),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"}(XB||(XB={})),function(e){e.UNKNOWN="unknown",e.MUSIC="music",e.HIGHQUALITY_COMMUNICATION="highquality_communication",e.COMMUNICATION="communication",e.MEDIA="media",e.GAME_STREAMING="game_streaming"}(qB||(qB={})),function(e){e.UNKNOWN="unknown",e.MEDIA="media",e.COMMUNICATION="communication"}(YB||(YB={})),function(e){e.UNKNOWN="unknown",e.SLEEP="Sleep",e.AWAKE="Awake"}(JB||(JB={})),function(e){e.UNKNOWN="unknown",e.PRODUCT="product",e.BOE="boe",e.TEST="test"}(QB||(QB={}));var aj=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}),Object.defineProperty(e.prototype,"auto_play_policy",{get:function(){return this._auto_play_policy},enumerable:!1,configurable:!0}),e}(),sj=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 aj(t),DU()||window.addEventListener("beforeunload",(function(){clearTimeout(t.errSendTimer),clearTimeout(t.sucSendTimer),t.send(null,!0)})),t}return Of(t,e),t.prototype.push=function(e,t){t?this.send(e):(this.dataBuffer.push(e),!this.posting&&!this.errSendTimer&&Date.now()-this.preSucTime>2e3&&(clearTimeout(this.sucSendTimer),this.send()))},t.prototype.unshift=function(e){this.dataBuffer=e.concat(this.dataBuffer)},t.prototype.send=function(e,t){var r=this;if(e||this.dataBuffer.length){var i={data:e||this.dataBuffer.splice(0,4e3),header:this.report_common,from:"web",os:"web",version:"1"},n=new XMLHttpRequest;n.timeout=1e4,n.onreadystatechange=function(){if(4===n.readyState){e||(r.posting=!1);var o=void 0;if(200===n.status||304===n.status)try{o=JSON.parse(n.responseText)}catch(e){}o&&0===o.StatusCode?e||t||r.sucSend():e?r.send(e):(r.unshift(i.data),t?r.send():r.errSend())}};var o=YF.LOG_SERVER_URL;if(n.open("POST",o,!0),e||(this.posting=!0),!DU()&&location.search.includes("_rtc_autotest_"))this.safeEmit("report_event",i),0!==this.dataBuffer.length?this.sucSend():this.posting=!1;else if(!DU()&&location.search.includes("_rtc_debug_"))n.send(JSON.stringify(i));else{var a=LF.gzip(JSON.stringify(i));n.setRequestHeader("Content-Encoding","gzip"),n.setRequestHeader("Content-Type","application/x-www-form-urlencoded; charset=UTF-8"),n.send(a)}}},t.prototype.sucSend=function(){this.errSendDelay=100,this.preSucTime=Date.now(),this.sucSendTimer=setTimeout(this.send.bind(this),2e3)},t.prototype.errSend=function(){var e=this;this.errSendTimer=setTimeout((function(){e.send(),e.errSendTimer=null}),this.errSendDelay),this.errSendDelay*=2},t.prototype.StartUp=function(){var e=this.report_common,t=this.commonStats,r=t.event_key,i=t.device_id,n=t.rtc_app_id,o=t.product_line,a=t.report_version,s=t.os,c=t.rtc_sdk_version,u=t.rtc_timestamp,d=t.rtc_sdk_git_commit,l=t.report_id,h=t.rtc_sid,p=t.engine_session_id,f=t.rtc_business_id,_=t.project_key,v=t.network_type,m=t.app_version,y=t.aid,g=t.device_model,S=t.device_brand,E=t.common_extra_info,b=t.had_selected_p2p,I=t.rtc_env_type,T=t.user_agent,A=t.auto_play_policy;Object.assign(e,{event_key:r,device_id:i,rtc_app_id:n,product_line:o,report_version:a,os:s,rtc_sdk_version:c,rtc_timestamp:u,rtc_sdk_git_commit:d,report_id:l,rtc_sid:h,engine_session_id:p,rtc_business_id:f,project_key:_,network_type:v,app_version:m,aid:y,device_model:g,device_brand:S,common_extra_info:E,had_selected_p2p:b,rtc_env_type:I,user_agent:T,auto_play_policy:A}),this.commonStats.room_id&&(this.modify_ids.room_id=this.commonStats.room_id),this.commonStats.user_id&&(this.modify_ids.user_id=this.commonStats.user_id),this.commonStats.rtc_session_id&&(this.modify_ids.rtc_session_id=this.commonStats.rtc_session_id),this.commonStats.connection_id&&(this.modify_ids.connection_id=this.commonStats.connection_id)},t.prototype.rtcSdkApiCall=function(e,t,r,i){void 0===i&&(i={});var n=e_(e_({event_key:"rtc_sdk_api_call",report_id:this.report_id++,rtc_timestamp:Date.now(),sdk_api_name:e,error_code:t,message:r},this.modify_ids),{common_extra_info:JSON.stringify(i)});i.streamId&&(n.stream_id=i.streamId),this.push(n)},t.prototype.rtcSdkCallback=function(e,t,r,i){void 0===i&&(i={});var n=e_(e_({event_key:"rtc_sdk_callback",report_id:this.report_id++,rtc_timestamp:Date.now(),sdk_callback_name:e,error_code:t,message:r},this.modify_ids),{common_extra_info:JSON.stringify(i)});this.push(n)},t.prototype.rtcGetConfig=function(e,t,r,i,n,o,a,s){void 0===s&&(s={});var c=e_(e_({event_key:"rtc_get_config",report_id:this.report_id++,rtc_timestamp:Date.now(),error_code:e,message:t,elapse:r,host:i,type:n,config_id:o,enable_cloud_proxy:a},this.modify_ids),{common_extra_info:JSON.stringify(s)});this.push(c)},t.prototype.rtcReconnect=function(e,t,r,i,n){void 0===n&&(n={});var o=e_(e_({event_key:"rtc_reconnect",report_id:this.report_id++,rtc_timestamp:Date.now(),error_code:e,message:t,reconnect_id:r,reconnect_type:i},this.modify_ids),{common_extra_info:JSON.stringify(n)});this.push(o)},t.prototype.rtcReconnected=function(e,t,r){void 0===r&&(r={});var i=e_(e_({event_key:"rtc_reconnected",report_id:this.report_id++,rtc_timestamp:Date.now(),message:e,reconnect_type:t},this.modify_ids),{common_extra_info:JSON.stringify(r)});this.push(i)},t.prototype.rtcGetAccess=function(e,t,r,i,n,o,a){void 0===a&&(a={});var s=e_(e_({event_key:"rtc_get_access",report_id:this.report_id++,rtc_timestamp:Date.now(),error_code:e,message:t,elapse:r,type:i,host:n,connect_session_id:o},this.modify_ids),{common_extra_info:JSON.stringify(a)});this.push(s)},t.prototype.rtcPreIceState=function(e,t,r){void 0===r&&(r={});var i=e_(e_({event_key:"rtc_pre_ice_state",report_id:this.report_id++,rtc_timestamp:Date.now(),message:e,ice_state:t},this.modify_ids),{common_extra_info:JSON.stringify(r)});this.push(i)},t.prototype.rtcNodeChange=function(e,t,r,i){void 0===i&&(i={});var n=e_(e_({event_key:"rtc_node_change",report_id:this.report_id++,rtc_timestamp:Date.now(),error_code:e,message:t,reason:r},this.modify_ids),{common_extra_info:JSON.stringify(i)});this.push(n)},t.prototype.rtcSignalingMsgError=function(e,t,r,i){void 0===i&&(i={});var n=e_(e_({event_key:"rtc_signaling_msg_error",report_id:this.report_id++,rtc_timestamp:Date.now(),error_code:e,message:t,reason:r},this.modify_ids),{common_extra_info:JSON.stringify(i)});this.push(n)},t.prototype.rtcSignaling=function(e,t,r,i,n,o){void 0===o&&(o={});var a=e_(e_({event_key:"rtc_signaling",report_id:this.report_id++,rtc_timestamp:Date.now(),error_code:e,message:t,signaling_event:r,signaling_type:i,direction:n},this.modify_ids),{common_extra_info:JSON.stringify(o)});this.push(a)},t.prototype.rtcJoinRoom=function(e,t,r,i,n){void 0===n&&(n={});var o=e_(e_({event_key:"rtc_join_room",report_id:this.report_id++,rtc_timestamp:Date.now(),error_code:e,deviceModel:t,deviceManufacturer:r,elapse:i},this.modify_ids),{common_extra_info:JSON.stringify(n)});this.push(o)},t.prototype.rtcLeaveRoom=function(e,t,r,i){void 0===i&&(i={});var n=e_(e_({event_key:"rtc_leave_room",report_id:this.report_id++,rtc_timestamp:Date.now(),error_code:e,message:t,elapse:r},this.modify_ids),{common_extra_info:JSON.stringify(i)});this.push(n)},t.prototype.rtcBeginCreateOffer=function(e,t,r,i){void 0===i&&(i={});var n=e_(e_({event_key:"rtc_begin_create_offer",report_id:this.report_id++,rtc_timestamp:Date.now(),direction:e,stream_id:t,stream_user_id:r},this.modify_ids),{common_extra_info:JSON.stringify(i)});this.push(n)},t.prototype.rtcCreateOffer=function(e,t,r,i,n,o){void 0===o&&(o={});var a=e_(e_({event_key:"rtc_create_offer",report_id:this.report_id++,rtc_timestamp:Date.now(),error_code:e,direction:t,stream_id:r,stream_user_id:i,elapse:n},this.modify_ids),{common_extra_info:JSON.stringify(o)});this.push(a)},t.prototype.rtcSetDescription=function(e,t,r,i,n,o,a,s){void 0===s&&(s={});var c=e_(e_({event_key:"rtc_set_description",report_id:this.report_id++,rtc_timestamp:Date.now(),error_code:e,message:t,is_local:r,direction:i,stream_id:n,stream_user_id:o,elapse:a},this.modify_ids),{common_extra_info:JSON.stringify(s)});this.push(c)},t.prototype.rtcRecvAnswer=function(e,t,r,i,n,o,a,s){void 0===s&&(s={});var c=e_(e_({event_key:"rtc_recv_answer",report_id:this.report_id++,rtc_timestamp:Date.now(),error_code:e,answer_type:t,sequence_id:r,message:i,direction:n,stream_id:o,stream_user_id:a},this.modify_ids),{common_extra_info:JSON.stringify(s)});this.push(c)},t.prototype.firstRemoteAudioRender=function(e,t,r){void 0===r&&(r={});var i=e_(e_({event_key:"first_remote_audio_render",report_id:this.report_id++,rtc_timestamp:Date.now(),stream_id:e,stream_user_id:t},this.modify_ids),{common_extra_info:JSON.stringify(r)});this.push(i)},t.prototype.firstRemoteVideoRender=function(e,t,r){void 0===r&&(r={});var i=e_(e_({event_key:"first_remote_video_render",report_id:this.report_id++,rtc_timestamp:Date.now(),stream_id:e,stream_user_id:t},this.modify_ids),{common_extra_info:JSON.stringify(r)});this.push(i)},t.prototype.rtcPublishStat=function(e,t,r,i,n){void 0===n&&(n={});var o=e_(e_({event_key:"rtc_publish_stat",report_id:this.report_id++,rtc_timestamp:Date.now(),result:e,is_screen:t,start:r,message:i},this.modify_ids),{common_extra_info:JSON.stringify(n)});this.push(o)},t.prototype.rtcSubscribeStat=function(e,t,r,i,n){void 0===n&&(n={});var o=e_(e_({event_key:"rtc_subscribe_stat",report_id:this.report_id++,rtc_timestamp:Date.now(),result:e,start:t,message:r,stream_user_id:i},this.modify_ids),{common_extra_info:JSON.stringify(n)});this.push(o)},t.prototype.rtcAudioDevice=function(e,t,r,i){void 0===i&&(i={});var n=e_(e_({event_key:"rtc_audio_device",report_id:this.report_id++,rtc_timestamp:Date.now(),audio_event:e,message:t,error_code:r},this.modify_ids),{common_extra_info:JSON.stringify(i)});this.push(n)},t.prototype.rtcMediaStatistics=function(e,t,r){void 0===r&&(r={});var i=e_(e_(e_(e_({event_key:"rtc_media_statistics",report_id:this.report_id++,rtc_timestamp:Date.now()},e),t),this.modify_ids),{common_extra_info:JSON.stringify(r)});this.push(i)},t.prototype.rtcMessageStatistics=function(e,t,r,i){void 0===i&&(i={});var n=e_(e_({event_key:"rtc_message_statistics",report_id:this.report_id++,rtc_timestamp:Date.now(),dc_user_message:e,dc_room_message:t,media_server_ip:r},this.modify_ids),{common_extra_info:JSON.stringify(i)});this.push(n)},t.prototype.rtcError=function(e,t,r){void 0===r&&(r={});var i=e_(e_({event_key:"rtc_error",report_id:this.report_id++,rtc_timestamp:Date.now(),message:e,error_code:t},this.modify_ids),{common_extra_info:JSON.stringify(r)});this.push(i)},t.prototype.rtcInvokeStatus=function(e,t,r,i,n,o){void 0===o&&(o={});var a=e_(e_({event_key:"rtc_invoke_status",report_id:this.report_id++,rtc_timestamp:Date.now(),message:e,error_code:t,sdk_api_name:r,stream_id:i,elapse:n},this.modify_ids),{common_extra_info:JSON.stringify(o)});this.push(a)},t.prototype.rtcFirstFrame=function(e,t){void 0===t&&(t={});var r=e_(e_(e_({event_key:"rtc_first_frame",report_id:this.report_id++,rtc_timestamp:Date.now()},e),this.modify_ids),{common_extra_info:JSON.stringify(t)});this.push(r)},t.prototype.rtcMuteRemote=function(e,t,r){void 0===r&&(r={});var i=e_(e_({event_key:"rtc_mute_remote",report_id:this.report_id++,rtc_timestamp:Date.now(),mute_info:e,media_type:t},this.modify_ids),{common_extra_info:JSON.stringify(r)});this.push(i)},t.prototype.sdkInitEngine=function(e,t,r){void 0===r&&(r={});var i=e_(e_({event_key:"sdk_init_engine",report_id:this.report_id++,rtc_timestamp:Date.now(),start:e,type:t},this.modify_ids),{common_extra_info:JSON.stringify(r)});this.push(i)},t.prototype.joinRoom=function(e,t,r,i,n){void 0===n&&(n={});var o=e_(e_({event_key:"join_room",report_id:this.report_id++,rtc_timestamp:Date.now(),type:e,start:t,result:r,reason:i},this.modify_ids),{common_extra_info:JSON.stringify(n)});this.push(o)},t.prototype.p2pConnectionStatus=function(e,t,r,i,n,o){void 0===o&&(o={});var a=e_(e_({event_key:"p2p_connection_status",report_id:this.report_id++,rtc_timestamp:Date.now(),room_id:e,user_id:t,peer_user_id:r,status:i,elapse:n},this.modify_ids),{common_extra_info:JSON.stringify(o)});this.push(a)},t.prototype.p2pConnectClosed=function(e,t){void 0===t&&(t={});var r=e_(e_({event_key:"p2p_connect_closed",report_id:this.report_id++,rtc_timestamp:Date.now(),p2p_selected:e},this.modify_ids),{common_extra_info:JSON.stringify(t)});this.push(r)},t.prototype.rtcDeviceError=function(e,t,r,i,n,o,a,s,c,u,d,l,h,p,f,_,v){void 0===v&&(v={});var m=e_(e_({event_key:"rtc_device_error",report_id:this.report_id++,rtc_timestamp:Date.now(),device_type:e,device_stage:t,error_code:r,system_error_code:i,system_api:n,call_parameters:o,location:a,message:s,media_device_id:c,media_device_name:u,elapse:d,scenario:l,event_session_id:h,device_pid:p,device_vid:f,media_mode:_},this.modify_ids),{common_extra_info:JSON.stringify(v)});this.push(m)},t.prototype.rtcVideoDevice=function(e,t,r){void 0===r&&(r={});var i=e_(e_({event_key:"rtc_video_device",report_id:this.report_id++,rtc_timestamp:Date.now(),media_device_id:e,media_device_name:t},this.modify_ids),{common_extra_info:JSON.stringify(r)});this.push(i)},t.prototype.rtcVideoCaptureEvent=function(e,t){void 0===t&&(t={});var r=e_(e_(e_({event_key:"rtc_video_capture_event",report_id:this.report_id++,rtc_timestamp:Date.now()},e),this.modify_ids),{common_extra_info:JSON.stringify(t)});this.push(r)},t.prototype.rtcEncodeFirstFrame=function(e,t,r){void 0===r&&(r={});var i=e_(e_(e_(e_({event_key:"rtc_encode_first_frame",report_id:this.report_id++,rtc_timestamp:Date.now()},e),t),this.modify_ids),{common_extra_info:JSON.stringify(r)});this.push(i)},t.prototype.rtcFirstFrameEncoded=function(e,t,r){void 0===r&&(r={});var i=e_(e_(e_(e_({event_key:"rtc_first_frame_encoded",report_id:this.report_id++,rtc_timestamp:Date.now()},e),t),this.modify_ids),{common_extra_info:JSON.stringify(r)});this.push(i)},t.prototype.rtcSendFirstPacket=function(e,t,r){void 0===r&&(r={});var i=e_(e_(e_(e_({event_key:"rtc_send_first_packet",report_id:this.report_id++,rtc_timestamp:Date.now()},e),t),this.modify_ids),{common_extra_info:JSON.stringify(r)});this.push(i)},t.prototype.rtcRecvFirstPacket=function(e,t,r){void 0===r&&(r={});var i=e_(e_(e_(e_({event_key:"rtc_recv_first_packet",report_id:this.report_id++,rtc_timestamp:Date.now()},e),t),this.modify_ids),{common_extra_info:JSON.stringify(r)});this.push(i)},t.prototype.rtcRecvFirstFrame=function(e,t,r){void 0===r&&(r={});var i=e_(e_(e_(e_({event_key:"rtc_recv_first_frame",report_id:this.report_id++,rtc_timestamp:Date.now()},e),t),this.modify_ids),{common_extra_info:JSON.stringify(r)});this.push(i)},t.prototype.rtcDecodeFirstFrame=function(e,t,r){void 0===r&&(r={});var i=e_(e_(e_(e_({event_key:"rtc_decode_first_frame",report_id:this.report_id++,rtc_timestamp:Date.now()},e),t),this.modify_ids),{common_extra_info:JSON.stringify(r)});this.push(i)},t}(oj),cj=new sj,uj=new sj,dj=new sj,lj=cj.commonStats,hj=uj.commonStats,pj=dj.commonStats,fj={default:cj,rtm:uj,outsideRoom:dj};function _j(e){void 0===e&&(e="default");for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];return function(r,i,n){if("function"==typeof n.value){var o=n.value;n.value=function(){for(var r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];var a={};t.forEach((function(e,t){a[e]=r[t]})),"joinRoom"===i&&lj.setStats({room_id:r[1]}),fj[e].rtcSdkApiCall(i,0,JSON.stringify(JU(r)),a);var s=o.apply(this,r);return"function"==typeof(null==s?void 0:s.then)?s.then((function(t){return fj[e].rtcSdkCallback(i,0,JSON.stringify(JU([t||{}]))),t})).catch((function(t){throw fj[e].rtcSdkCallback(i,t.code,JSON.stringify(t.message)),t})):(fj[e].rtcSdkCallback(i,0,JSON.stringify(JU([s||{}]))),s)}}}}function vj(e,t,r){var i,n;void 0===r&&(r=0);var o=e===h_.onUserMessageReceivedOutsideRoom||e===h_.onUserBinaryMessageReceivedOutsideRoom;Array.isArray(t)&&(null===(i=t[0])||void 0===i?void 0:i.userId)&&(e="".concat(e,"_").concat(null===(n=t[0])||void 0===n?void 0:n.userId)),(o?uj:cj).rtcSdkCallback(e,r,JSON.stringify(t))}function mj(e,t,r,i){void 0===r&&(r=0),void 0===i&&(i=!1),(i?uj:cj).rtcInvokeStatus(JSON.stringify(t),r,e,"",0)}var yj=i(Object.freeze({__proto__:null,Monitor:sj,monitor:cj,reportRtcSdkApiCall:_j,reportRtcSdkCallback:vj,reportRtcInvokeStatus:mj,get CommonEventKey(){return oB},get CommonProductLine(){return aB},get CommonReportVersion(){return sB},get CommonOs(){return cB},get CommonNetworkType(){return uB},get RoominfoChannelRole(){return dB},get RtcgetconfigType(){return lB},get RtcreconnectMessage(){return hB},get RtcreconnectReconnectType(){return pB},get RtcreconnectedMessage(){return fB},get RtcreconnectedReconnectType(){return _B},get RtcgetaccessType(){return vB},get RtcpreicestateIceState(){return mB},get RtcsignalingmsgerrorReason(){return yB},get RtcsignalingSignalingEvent(){return gB},get RtcsignalingDirection(){return SB},get RtcbegincreateofferDirection(){return EB},get RtccreateofferDirection(){return bB},get RtcsetdescriptionIsLocal(){return IB},get RtcsetdescriptionDirection(){return TB},get RtcrecvanswerAnswerType(){return AB},get RtcrecvanswerDirection(){return RB},get RtcpublishstatResult(){return CB},get RtcpublishstatIsScreen(){return OB},get RtcpublishstatMessage(){return wB},get RtcsubscribestatResult(){return kB},get RtcsubscribestatMessage(){return NB},get RtcaudiodeviceAudioEvent(){return PB},get FirstframeinfoEventType(){return DB},get FirstframeinfoMediaType(){return MB},get FirstframeinfoType(){return LB},get FirstframeinfoReason(){return UB},get RtcmuteremoteMediaType(){return xB},get SdkinitengineType(){return VB},get JoinroomType(){return FB},get JoinroomReason(){return BB},get P2pconnectionstatusStatus(){return jB},get PerformanceinfoThermalState(){return GB},get RtcdeviceerrorDeviceType(){return HB},get DcusermessageDcMessageType(){return zB},get CaptureeventinfoEventType(){return KB},get CaptureeventinfoType(){return WB},get CaptureeventinfoReason(){return XB},get RtcdeviceerrorScenario(){return qB},get RtcdeviceerrorMediaMode(){return YB},get PerformanceinfoDeviceStatus(){return JB},get CommonRtcEnvType(){return QB},commonStats:lj,rtmCommonStats:hj,rtmMonitor:uj,outsideRoomMonitor:dj,outsideRoomCommonStats:pj})).monitor,gj=!1,Sj=[];function Ej(){var e;if(gj){var t=[].slice.call(arguments);Sj.push(t)}(e=console).log.apply(e,arguments)}function bj(){var e=window.__rtc_engine__,t=e._localVideoTrack,r=e._localAudioTrack;function i(e){if(e){var t=e.getTrack(),r=t.kind,i=t.id.slice(-6);Ej(r+"track("+i+").getSettings(): ",t.getSettings()),Ej(r+"track("+i+").readyState: ",t.readyState),Ej(r+"track("+i+").muted: ",t.muted),Ej(r+"track("+i+").enabled: ",t.enabled)}}Ej("engine._localVideoTrack: ",e._localVideoTrack),Ej("engine._localAudioTrack: ",e._localAudioTrack),i(t),i(r)}function Ij(){var e=setInterval((function(){__rtc_engine__._room._mediaServerClient._handler.pc.getStats().then((function(e){var t={};e.forEach((function(r){if("track"===r.type){var i=r.trackIdentifier;__rtc_engine__._room._remoteStreams.forEach((function(n){n.forEach((function(n,o){var a,s;n&&n.videoTrack&&n.videoTrack._mediaTrack&&(n.videoTrack.getTrack().id===i&&(e.forEach((function(e){"inbound-rtp"===e.type&&r.id===e.trackId&&(a=e)})),t[n.userId+"(video-".concat(o,")")]={userId:n.userId+"(video-".concat(o,")"),track:r,inboundRTP:a}));n&&n.audioTrack&&n.audioTrack._mediaTrack&&(n.audioTrack.getTrack().id===i&&(e.forEach((function(e){"inbound-rtp"===e.type&&r.id===e.trackId&&(s=e)})),t[n.userId+"(audio-".concat(o,")")]={userId:n.userId+"(audio-".concat(o,")"),track:r,inboundRTP:s}))}))}));try{if(!__rtc_engine__._room._localStream.videoTrack)return;if(__rtc_engine__._room._localStream.videoTrack.getTrack().id===i){var n;e.forEach((function(e){"outbound-rtp"===e.type&&r.id===e.trackId&&(n=e)}));var o=__rtc_engine__._room._roomInfo.userInfo.userId+" (localVideo)";t[o]={userId:o,track:r,outboundRTP:n}}}catch(e){Ej(e)}try{if(!__rtc_engine__._room._localStream.audioTrack)return;if(__rtc_engine__._room._localStream.audioTrack.getTrack().id===i){var a;e.forEach((function(e){"outbound-rtp"===e.type&&r.id===e.trackId&&(a=e)}));var s=__rtc_engine__._room._roomInfo.userInfo.userId+" (localAudio)";t[s]={userId:s,track:r,outboundRTP:a}}}catch(e){Ej(e)}}})),Ej(t)}))}),1e3);setTimeout((function(){clearInterval(e)}),2e3)}function Tj(){return(Tj=hT(ET.mark((function e(){var t;return ET.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=window.__rtc_engine__,e.next=3,t.stopVideoCapture();case 3:return e.next=5,t.startVideoCapture();case 5:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Aj(){return(Aj=hT(ET.mark((function e(){var t;return ET.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=window.__rtc_engine__,e.next=3,t.stopAudioCapture();case 3:return e.next=5,t.startAudioCapture();case 5:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Rj(){return(Rj=hT(ET.mark((function e(t){var r;return ET.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=window.__rtc_engine__,e.next=3,r.unsubscribeStream(t,3);case 3:return e.next=5,r.subscribeStream(t,3);case 5:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Cj(){for(var e=window.__rtc_engine__,t=0;t<5;t++)setTimeout((function(){e._room._remoteStreams.forEach((function(e){e.forEach((function(e,t){e&&e.audioTrack&&Ej(e.userId+" volume:"+e.audioTrack.getAudioLevel())}))})),Ej("local volume: ",e._localAudioTrack.getAudioLevel())}),200*t)}function Oj(){var e=window.__rtc_engine__._remoteVideoPlayer;Ej("videoplayers: ",e.size,Array.from(e.keys())),e&&e.size>=1&&e.forEach((function(e,t){var r=e._videoDom;Ej("videoplayer("+t+(e.isScreen?"_screen":"")+").readyState: ",r.readyState),Ej("videoplayer("+t+(e.isScreen?"_screen":"")+").currentTime: ",10*Math.floor(r.currentTime/10)),Ej("videoplayer("+t+(e.isScreen?"_screen":"")+").paused: ",r.paused),Ej("videoplayer("+t+(e.isScreen?"_screen":"")+").srcObject.id: ",r.srcObject.id),Ej("videoplayer("+t+(e.isScreen?"_screen":"")+").srcObject.active: ",r.srcObject.active)}))}function wj(){var e=window.__rtc_engine__._remoteAudioPlayer;e&&e.size>=1&&e.forEach((function(e,t){var r=e._audioDom;Ej("audioplayer("+t+").readyState: ",r.readyState),Ej("audioplayer("+t+").currentTime: ",r.currentTime),Ej("audioplayer("+t+").paused: ",r.paused),Ej("audioplayer("+t+").srcObject.id: ",r.srcObject.id),Ej("audioplayer("+t+").srcObject.active: ",r.srcObject.active)}))}function kj(e){if(!e)return!1;var t=document.createElement("div");t.style.width="100%",t.style.height="100%",t.style.position="absolute",t.style.backgroundColor="rgba(0, 0, 0, 0.2)",t.style.color="wheat",t.style.zIndex="9999999",t.style.pointerEvents="none",document.body.insertBefore(t,document.body.firstChild),window.counter=0,window.panel=t;try{var r=localStorage.getItem("ve_crash_log"),i=URL.createObjectURL(new Blob([r])),n=document.createElement("a");n.download="ve_crash_log.log",n.href=i,n.click(),localStorage.removeItem("ve_crash_log")}catch(e){}function o(e){var t=localStorage.getItem("ve_crash_log");localStorage.setItem("ve_crash_log",t+"\r\n"+e)}window._ve_sdk_cb=function(){var e,t=Array.prototype.slice.call(arguments);try{e=JSON.stringify(t)}catch(t){e="JSON.stringify failed"}e.length>1e3&&(e=e.slice(0,1e3)+"... <too large to show>"),e="seq".concat(window.counter++," - ").concat(e);var r=document.createElement("div");r.style.whiteSpace="nowrap",r.innerHTML=e,panel.childNodes.length>20&&panel.removeChild(panel.childNodes[0]),window.panel.append(r);try{o(e)}catch(e){}}}window.location.search.includes("adp")?kj(!0):kj(!1);var Nj=function(){var e=new Date;return e.toDateString().replaceAll(" ","_")+"-"+e.toTimeString().split(" ")[0]+":"+e.getMilliseconds()};window.rvc=function(){return Tj.apply(this,arguments)},window.rac=function(){return Aj.apply(this,arguments)},window.rs=function(e){return Rj.apply(this,arguments)},window.wrv=Oj,window.wra=wj,window.wlt=bj,window.ws=function(){var e=window.__rtc_engine__;if(e._room){var t=[];try{t=e._room._mediaServerClient.handler.pc.getSenders()}catch(e){t=[]}Ej("senders: ",t.length,";empty senders: ",t.filter((function(e){return!!e.track})).length),t.forEach((function(e,t){var r=e.track,i=Object.assign({},e.getParameters());(i.transactionId&&delete i.transactionId,r)?Ej(r.kind+"sender("+r.id.slice(-6)+").getParameters(): ",i):Ej("emptysender("+t+").getParameters(): ",i)}))}},window.ss5=Ij,window.gv5=Cj,window.ap=kj,window.dv=function(e,t,r,i){var n=[],o=null,a=!1,s=__rtc_engine__._room.roomInfo.userInfo.userId,c=function(i,s){if(e===i){if("key"===s.type&&(a=!0,o||(Ej(" ============ start dump ============="),o=setTimeout(u,1e3*(t||7)))),r&&!a)return;Ej("dump video: ",s),n.push(new Uint8Array(s.data))}},u=function(){__rtc_engine__._room._remoteStreams.get(e)[0].off("onTransformData",c);var t=n.reduce((function(e,t){return e+t.byteLength}),0);Ej("byteLength: ",t);var r=n.reduce((function(e,t){return e.data.set(t,e.offset),e.offset+=t.byteLength,e}),{data:new Uint8Array(t),offset:0}),o=r.data.reduce((function(e,t){return e+String.fromCharCode(t)}),""),a=window.btoa(o);console.log("base64str:",a),yj.rtcInvokeStatus(a,0,"dumpVideo_".concat(s,"_sub_").concat(e,"_").concat(Nj()),"",0);var u=URL.createObjectURL(new Blob([r.data])),d=document.createElement("a");d.download="dumpVideo_".concat(s,"_sub_").concat(e,"_").concat(Nj(),".").concat(i||"h264"),d.href=u,d.click()};__rtc_engine__._room._remoteStreams.get(e)[0].on("onTransformData",c),r||(o=setTimeout(u,1e3*(t||7)))},window.cs=function(){gj=!0,setTimeout((function(){console.log(Sj);var e=[],r=JSON.stringify(Sj,(function(r,i){if("object"===t(i)&&null!==i){if(-1!==e.indexOf(i))return;e.push(i)}return i}));e=null,console.log(r.length),yj.rtcInvokeStatus(r,0,"console.monitor","",0),Sj=[]}),1e4);try{Oj()}catch(e){}try{wj()}catch(e){}try{bj()}catch(e){}try{Ij()}catch(e){}try{Cj()}catch(e){}},by("Set",(function(e){return function(){return e(this,arguments.length?arguments[0]:void 0)}}),Ly);var Pj=Xi,Dj=A,Mj=ye,Lj=Le,Uj=ni,xj=_o,Vj=s,Fj=yA,Bj=Gn,jj=oM,Gj=aM,Hj=re,zj=cM,Kj=[],Wj=Dj(Kj.sort),Xj=Dj(Kj.push),qj=Vj((function(){Kj.sort(void 0)})),Yj=Vj((function(){Kj.sort(null)})),Jj=Bj("sort"),Qj=!Vj((function(){if(Hj)return Hj<70;if(!(jj&&jj>3)){if(Gj)return!0;if(zj)return zj<603;var e,t,r,i,n="";for(e=65;e<76;e++){switch(t=String.fromCharCode(e),e){case 66:case 69:case 70:case 72:r=3;break;case 68:case 71:r=4;break;default:r=2}for(i=0;i<47;i++)Kj.push({k:t+i,v:r})}for(Kj.sort((function(e,t){return t.v-e.v})),i=0;i<Kj.length;i++)t=Kj[i].k.charAt(0),n.charAt(n.length-1)!==t&&(n+=t);return"DGBEFHACIJK"!==n}}));Pj({target:"Array",proto:!0,forced:qj||!Yj||!Jj||!Qj},{sort:function(e){void 0!==e&&Mj(e);var t=Lj(this);if(Qj)return void 0===e?Wj(t):Wj(t,e);var r,i,n=[],o=Uj(t);for(i=0;i<o;i++)i in t&&Xj(n,t[i]);for(Fj(n,function(e){return function(t,r){return void 0===r?-1:void 0===t?1:void 0!==e?+e(t,r)||0:xj(t)>xj(r)?1:-1}}(e)),r=n.length,i=0;i<r;)t[i]=n[i++];for(;i<o;)delete t[i++];return t}});var Zj,$j,eG=Xi,tG=Ia.findIndex,rG=sh,iG="findIndex",nG=!0;iG in[]&&Array(1).findIndex((function(){nG=!1})),eG({target:"Array",proto:!0,forced:nG},{findIndex:function(e){return tG(this,e,arguments.length>1?arguments[1]:void 0)}}),rG(iG),function(e){e.INVALID_ENGINE="INVALID_ENGINE",e.INVALID_PARAMS="INVALID_PARAMS",e.INVOKED_BEFORE_JOIN_ROOM="INVOKED_BEFORE_JOIN_ROOM",e.INVALID_TOKEN="INVALID_TOKEN",e.EXPIRED_TOKEN="EXPIRED_TOKEN",e.JOIN_ROOM_FAILED="JOIN_ROOM_FAILED",e.UPDATE_TOKEN_WITH_INVALID_TOKEN="UPDATE_TOKEN_WITH_INVALID_TOKEN",e.UPDATE_TOKEN_BEFORE_JOIN="UPDATE_TOKEN_BEFORE_JOIN",e.REPEAT_JOIN="REPEAT_JOIN",e.REPEAT_PUBLISH="REPEAT_PUBLISH",e.REPEAT_PUSH="REPEAT_PUSH",e.REPEAT_PLAY="REPEAT_PLAY",e.PUBLISH_BEFORE_JOIN="PUBLISH_BEFORE_JOIN",e.UNPUBLISH_BEFORE_JOIN="UNPUBLISH_BEFORE_JOIN",e.SUBSCRIBE_BEFORE_JOIN="SUBSCRIBE_BEFORE_JOIN",e.UNSUBSCRIBE_BEFORE_JOIN="UNSUBSCRIBE_BEFORE_JOIN",e.NO_PUBLISH_PERMISSION="NO_PUBLISH_PERMISSION",e.STREAM_NOT_EXIST="STREAM_NOT_EXIST",e.EMPTY_STREAM="EMPTY_STREAM",e.NOT_CONNECTED_YET="NOT_CONNECTED_YET",e.IM_BEFORE_JOIN="IM_BEFORE_JOIN",e.USER_NOT_EXIST="USER_NOT_EXIST",e.ALREADY_IN_ROOM="ALREADY_IN_ROOM",e.KICKED_OUT="KICKED_OUT",e.ROOM_DISMISS="ROOM_DISMISS",e.TOKEN_EXPIRED="TOKEN_EXPIRED",e.DUPLICATE_LOGIN="DUPLICATE_LOGIN",e.REPEAT_CAPTURE="REPEAT_CAPTURE",e.GET_VIDEO_TRACK_FAILED="GET_VIDEO_TRACK_FAILED",e.GET_AUDIO_TRACK_FAILED="GET_AUDIO_TRACK_FAILED",e.GET_SCREEN_TRACK_FAILED="GET_SCREEN_TRACK_FAILED",e.STREAM_TYPE_NOT_MATCH="STREAM_TYPE_NOT_MATCH",e.CANT_FIND_DOM="CANT_FIND_DOM",e.INVALID_DEVICE_ID="INVALID_DEVICE_ID",e.NO_PERMISSION="NO_PERMISSION",e.NOT_SUPPORTED="NOT_SUPPORTED",e.ICE_SERVER_WRONG="ICE_SERVER_WRONG",e.ESTABLISH_DATACHANNEL_FAILED="ESTABLISH_DATACHANNEL_FAILED",e.LOAD_RESOURCES_FAILED="LOAD_RESOURCES_FAILED",e.SIGNALING_CHANNEL_NOT_OPEN="SIGNALING_CHANNEL_NOT_OPEN",e.TIME_OUT="TIME_OUT",e.REFUSE_OPERATION_IN_DISCONNECT="REFUSE_OPERATION_IN_DISCONNECT",e.ADD_TRANSCEIVER_FAILED="ADD_TRANSCEIVER_FAILED",e.UPDATE_TRACK_FAILED="UPDATE_TRACK_FAILED",e.PUBLISH_FAILED="PUBLISH_FAILED",e.UNPUBLISH_FAILED="UNPUBLISH_FAILED",e.SUBSCRIBE_FAILED="SUBSCRIBE_FAILED",e.UNSUBSCRIBE_FAILED="UNSUBSCRIBE_FAILED",e.OPERATION_CANCEL="OPERATION_CANCEL",e.START_CLOUD_PROXY_AFTER_JOIN="START_CLOUD_PROXY_AFTER_JOIN",e.STOP_CLOUD_PROXY_BEFORE_LEAVE="STOP_CLOUD_PROXY_BEFORE_LEAVE",e.UNEXPECTED_ERROR="UNEXPECTED_ERROR",e.REPEAT_DEVICE_TEST="REPEAT_DEVICE_TEST",e.AUDIO_DEVICE_TEST_FAILED="AUDIO_DEVICE_RECORD_FAILED",e.ALREADY_LOGIN="ALREADY_LOGIN",e.LOGIN_FAILED="LOGIN_FAILED",e.NOT_LOGIN="NOT_LOGIN",e.RTM_DUPLICATE_LOGIN="RTM_DUPLICATE_LOGIN",e.RTM_TOKEN_ERROR="RTM_TOKEN_ERROR",e.USER_MESSAGE_TIMEOUT="USER_MESSAGE_TIMEOUT",e.USER_MESSAGE_BROKEN="USER_MESSAGE_BROKEN",e.USER_MESSAGE_NO_RECEIVER="USER_MESSAGE_NO_RECEIVER",e.USER_MESSAGE_NO_RELAYPATH="USER_MESSAGE_NO_RELAYPATH",e.USER_MESSAGE_SEND_TO_SERVER_ERROR="USER_MESSAGE_SEND_TO_SERVER_ERROR",e.USER_MESSAGE_SERVER_RESPONSE_ERROR="USER_MESSAGE_SERVER_RESPONSE_ERROR",e.USER_MESSAGE_NOT_JOIN="USER_MESSAGE_NOT_JOIN",e.USER_MESSAGE_INIT="USER_MESSAGE_INIT",e.USER_MESSAGE_NO_CONNECTION="USER_MESSAGE_NO_CONNECTION",e.USER_MESSAGE_EXCEED_MAX_LENGTH="USER_MESSAGE_EXCEED_MAX_LENGTH",e.USER_MESSAGE_EMPTY_USER="USER_MESSAGE_EMPTY_USER",e.USER_MESSAGE_NOT_LOGIN="USER_MESSAGE_NOT_LOGIN",e.USER_MESSAGE_SERVER_PARAMS_NOTSET="USER_MESSAGE_SERVER_PARAMS_NOTSET",e.USER_MESSAGE_UNKNOWN="USER_MESSAGE_UNKNOWN",e.START_PUBLIC_STREAM_BEFORE_JOIN="START_PUBLIC_STREAM_BEFORE_JOIN",e.RECONNECT_FAILED="RECONNECT_FAILED",e.PUBLIC_STREAM_DECODE_FAILED="PUBLIC_STREAM_DECODE_FAILED"}(Zj||(Zj={})),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"}($j||($j={}));var oG=function(e,t,r){this.code=e,this.message=t,this.error=r};function aG(e,t){if("boolean"!=typeof e)throw new oG(Zj.INVALID_PARAMS,"Invalid ".concat(t,": The value should be boolean type."))}function sG(e,t,r,i){if(void 0===r&&(r=1),void 0===i&&(i=Number.POSITIVE_INFINITY),e<r||e>i||"number"!=typeof e)throw new oG(Zj.INVALID_PARAMS,"Invalid ".concat(t,": the value range is [").concat(r,", ").concat(i,"]. integer only"))}function cG(e,t,r,i){if(void 0===r&&(r=1),void 0===i&&(i=Number.POSITIVE_INFINITY),null==e)throw new oG(Zj.INVALID_PARAMS,"".concat(t," cannot be empty"));if(!function(e,t,r){void 0===t&&(t=1);void 0===r&&(r=Number.POSITIVE_INFINITY);return"string"==typeof e&&e.length<=r&&e.length>=t}(e,r,i))throw new oG(Zj.INVALID_PARAMS,"Invalid ".concat(t,": The value should be string type. Length of the string: [").concat(r,",").concat(i,"]"))}function uG(e,t,r){if(!r.includes(e))throw new oG(Zj.INVALID_PARAMS,"Invalid ".concat(t,": The value can only be set as ").concat(JSON.stringify(r)))}function dG(e,t){if(hG(e))throw new oG(Zj.INVALID_PARAMS,"Invalid ".concat(t,", should not be empty"))}function lG(e,t){if(!(e instanceof ArrayBuffer))throw new oG(Zj.INVALID_PARAMS,"Invalid ".concat(t,", should be ArrayBuffer"))}function hG(e){return null==e}function pG(e){if("string"!=typeof e||!/^[a-zA-Z0-9@._\-]{1,128}$/.test(e))throw new oG(Zj.INVALID_PARAMS,"The userId must be within 128 bytes. The supported characters: a-z,A-Z,0-9,@,-,_,.")}function fG(e){if("string"!=typeof e||!/^[a-zA-Z0-9@._\-]{1,128}$/.test(e))throw new oG(Zj.INVALID_PARAMS,"The publicStreamId must be within 128 bytes. The supported characters: a-z,A-Z,0-9,@,-,_,.")}function _G(e){dG(e,"videoPlayerOption")}function vG(e,t){var r,i;if(void 0===t&&(t=64),!e||0===(null===(r=e)||void 0===r?void 0:r.byteLength))throw new oG(Zj.INVALID_PARAMS,"The message cannot be empty");if((null==(i=e instanceof ArrayBuffer?e:MU.str2ab(JSON.stringify(e)))?void 0:i.byteLength)>1e3*t)throw new oG(Zj.INVALID_PARAMS,"The message length must be less than ".concat(t,"K"))}function mG(e){return![h_.onRemoteStreamStats,h_.onLocalStreamStats,h_.onAudioVolumeIndication,h_.onLocalAudioPropertiesReport,h_.onRemoteAudioPropertiesReport].includes(e)}var yG=Ve,gG=function(e){return void 0!==e&&(yG(e,"value")||yG(e,"writable"))},SG=h,EG=H,bG=Mt,IG=gG,TG=a,AG=mh;Xi({target:"Reflect",stat:!0},{get:function e(t,r){var i,n,o=arguments.length<3?t:arguments[2];return bG(t)===o?t[r]:(i=TG.f(t,r))?IG(i)?i.value:void 0===i.get?void 0:SG(i.get,o):EG(n=AG(t))?e(n,r,o):void 0}});var RG=Xi,CG=h,OG=Mt,wG=H,kG=gG,NG=Ot,PG=a,DG=mh,MG=g;var LG,UG,xG,VG,FG,BG,jG,GG,HG,zG,KG,WG=s((function(){var e=function(){},t=NG.f(new e,"a",{configurable:!0});return!1!==Reflect.set(e.prototype,"a",1,t)}));RG({target:"Reflect",stat:!0,forced:WG},{set:function e(t,r,i){var n,o,a,s=arguments.length<4?t:arguments[3],c=PG.f(OG(t),r);if(!c){if(wG(o=DG(t)))return e(o,r,i,s);c=MG(0)}if(kG(c)){if(!1===c.writable||!wG(s))return!1;if(n=PG.f(s,r)){if(n.get||n.set||!1===n.writable)return!1;n.value=i,NG.f(s,r,n)}else NG.f(s,r,MG(0,i))}else{if(void 0===(a=c.set))return!1;CG(a,s,i)}return!0}}),function(e){e.streamRemovedBySchedule308="stream removed",e.clientRePublish="client republish",e.publishStreamFaied="publish failed",e.clientUnPublish="client unpublished",e.clientDisconnected="client disconnected",e.videoMuted="video muted"}(LG||(LG={})),function(e){e.PushLimitWarn="PushLimitWarn"}(UG||(UG={})),function(e){e.ON_ADD_STREAM="onAddStream",e.ON_REMOVE_STREAM="onRemoveStream",e.USER_DISCONNECTION="userDisconnection",e.USER_CONNECTION="userConnection",e.ON_UPDATE_STREAM_ATTRIBUTES="onUpdateStreamAttributes",e.ON_UPDATE_ROOM_ATTRIBUTES="onUpdateRoomAttributes",e.ON_PUSH_TRACK="onPushTrack",e.ON_REMOVE_TRACK="onRemoveTrack",e.ON_CUSTOM_MESSAGE="onCustomMessage",e.NODE_CHANGE="nodeChange",e.USER_MESSAGE_RECEIVED="userMessageReceived",e.USER_BINARY_MESSAGE_RECEIVED="userBinaryMessageReceived",e.USER_MESSAGE_RECEIVED_OUTSIDE_ROOM="userMessageReceivedOutsideRoom",e.USER_BINARY_MESSAGE_RECEIVED_OUTSIDE_ROOM="userBinaryMessageReceivedOutsideRoom",e.POST_PROCESSING_MESSAGE="postProcessingMessage",e.ON_USER_TOKEN_WILL_EXPIRE="onUserTokenWillExpire",e.STREAM_CONTROL_MESSAGE="streamControlMessage",e.ON_SCENE_CONFIG="onSceneConfig",e.ON_STREAM_FAILED="streamFailed"}(xG||(xG={})),function(e){e.RSCP="RSCP"}(VG||(VG={})),function(e){e.ON_CONNECTION_STATE_CHANGE="onConnectionStateChange",e.ABNORMAL_DISCONNECTION="normalConnection"}(FG||(FG={})),function(e){e.userLeave="userLeave",e.connectionLost="connectionLost",e.userDuplicateLogin="userDuplicateLogin",e.kickedByAdmin="kickedByAdmin",e.roleChanged="roleChanged",e.onUserTokenDidExpire="onUserTokenDidExpire"}(BG||(BG={})),function(e){e[e.roomDismissByAdmin=2]="roomDismissByAdmin"}(jG||(jG={})),function(e){e[e.SEND=0]="SEND",e[e.FEEDBACK=1]="FEEDBACK"}(HG||(HG={})),function(e){e[e.P2P=0]="P2P",e[e.SIGNAL=1]="SIGNAL",e[e.BROADCAST=2]="BROADCAST",e[e.BUSINESS_SERVER=3]="BUSINESS_SERVER"}(zG||(zG={})),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"}(KG||(KG={}));var XG,qG,YG=((GG={})[KG.SUCCESS]=[0,"success"],GG[KG.TIMEOUT]=[Zj.USER_MESSAGE_TIMEOUT,"timeout, failed to send."],GG[KG.BROKEN]=[Zj.USER_MESSAGE_BROKEN,"dataChannel broken, failed to send."],GG[KG.NO_RECEIVER]=[Zj.USER_MESSAGE_NO_RECEIVER,"cannot find the receiver."],GG[KG.NO_RELAYPATH]=[Zj.USER_MESSAGE_NO_RELAYPATH,"cannot find relay path."],GG[KG.SEND_TO_SERVER_ERROR]=[Zj.USER_MESSAGE_SEND_TO_SERVER_ERROR,"failed to send to business server."],GG[KG.SERVER_RESPONSE_ERROR]=[Zj.USER_MESSAGE_SERVER_RESPONSE_ERROR,"business server response error."],GG[KG.NOT_JOIN]=[Zj.USER_MESSAGE_NOT_JOIN,"not join room"],GG[KG.INIT]=[Zj.USER_MESSAGE_INIT,"not init."],GG[KG.NO_CONNECTION]=[Zj.USER_MESSAGE_NO_CONNECTION,"no connection."],GG[KG.EXCEED_MAX_LENGTH]=[Zj.USER_MESSAGE_EXCEED_MAX_LENGTH,"message exceeds max length."],GG[KG.EMPTY_USER]=[Zj.USER_MESSAGE_EMPTY_USER,"user id is empty."],GG[KG.NOT_LOGIN]=[Zj.USER_MESSAGE_NOT_LOGIN,"not login."],GG[KG.SERVER_PARAMS_NOTSET]=[Zj.USER_MESSAGE_SERVER_PARAMS_NOTSET,"server param is not set."],GG[KG.UNKNOWN]=[Zj.USER_MESSAGE_UNKNOWN,"unknown."],GG),JG=new rj("DataChannelSignaling",3);!function(e){e[e.SEND=0]="SEND",e[e.ACK=1]="ACK"}(XG||(XG={})),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"}(qG||(qG={}));var QG=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 Of(t,e),t.prototype.destroy=function(){this._dataChannel&&(this._clearDataChannelListener(),this._dataChannel.close()),this._singlingCache.clear(),this._p2pCache.clear(),this._p2pMessageId=0,this._rttIds={}},t.prototype.sendSignaling=function(e,t,r){var i=this;return cj.rtcSignaling(0,JSON.stringify(t),"call-".concat(e),"Send",SB.UP),new Promise((function(n,o){var a=i._genHeader(r);a.id=XU();var s=a.id.join("-"),c=setTimeout((function(){i._singlingCache.delete(s),o(new oG(Zj.TIME_OUT,"".concat(e," message time out")))}),6e4);i._singlingCache.set(s,{signalingType:e,success:function(e){clearTimeout(c),n(e)},error:function(e){clearTimeout(c),o(e)}}),JG.print("Signal",">>>>>> [".concat(e,"][").concat(s,"]"),t),i._sendMessage(e,a,t)}))},t.prototype.sendPingSignaling=function(){return this.sendSignaling("CheckConnectivity",{ts:Date.now()},{functionType:qG.C2GW})},t.prototype.sendP2PMessage=function(e,t){var r=e.msg,i=function(e,t){var r={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i)<0&&(r[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(i=Object.getOwnPropertySymbols(e);n<i.length;n++)t.indexOf(i[n])<0&&Object.prototype.propertyIsEnumerable.call(e,i[n])&&(r[i[n]]=e[i[n]])}return r}(e,["msg"]);return r_(this,void 0,void 0,(function(){var e,n,o,a,s;return i_(this,(function(c){switch(c.label){case 0:return e=r instanceof ArrayBuffer,n=this._sendP2PMessage,o=[e_({ver:1,id:this._p2pMessageId++,time:Date.now(),dir:HG.SEND,type:zG.P2P,err:KG.SUCCESS},i)],s={binary:e},e?[4,MU.ab2b64str(r)]:[3,2];case 1:return a=c.sent(),[3,3];case 2:a=r,c.label=3;case 3:return[2,n.apply(this,[e_.apply(void 0,o.concat([(s.msg=a,s)])),t])]}}))}))},t.prototype._sendP2PMessage=function(e,t){var r=this;return void 0===t&&(t={}),YU(e.msg)?this._rttIds[e.id]=e.id:e.dir===HG.SEND&&JG.print("_sendP2PMessage [DC Signaling p2p >>]",JSON.stringify(e)),new Promise((function(i,n){var o=r._genHeader(e_(e_({needAck:!0,functionType:qG.C2C},t),{id:XU()}));if(e.dir===HG.SEND){var a=setTimeout((function(){r._p2pCache.delete(e.id),n(new oG(Zj.TIME_OUT,"P2P message timeout"))}),6e4);r._p2pCache.set(e.id,{success:function(e,t){clearTimeout(a),i(t)},error:function(e){clearTimeout(a);var t=o_(YG[e.err]||[Zj.USER_MESSAGE_UNKNOWN,"err: ".concat(e.err,", msg: ").concat(e.msg)],2),r=t[0],i=t[1];n({code:r,message:e.msg||i})}})}r._sendMessage("p2p",o,e)}))},t.prototype._sendMessage=function(e,t,r){if(!this._dataChannel||"open"!==this._dataChannel.readyState)throw new oG(Zj.SIGNALING_CHANNEL_NOT_OPEN,"DataChannel not open");var i=t.version+(+t.zip<<5)+(+t.encrypt<<6),n=+t.needAck+(+t.direction<<1)+(+t.functionType<<2)+(+t.binary<<6),o=MU.str2ab(JSON.stringify([e,r])),a=PU(Uint8Array,a_([i,n],o_(t.id||[]),!1),new Uint8Array(o));this._dataChannel.send(a.buffer)},t.prototype._dispartData=function(e){var t=new Uint8Array(e),r=0,i=t[r++],n=t[r++],o={version:15&i,zip:16==(16&i),encrypt:32==(32&i),needAck:1==(1&n),direction:(2&n)>>1,functionType:(60&n)>>2,binary:64==(64&n)};if(o.needAck||o.direction===XG.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:XG.ACK,id:e.split("-").map((function(e){return+e}))});JG.print("Signal",">>>>>> [".concat(t,"-res][").concat(e,"]")),this._sendMessage("".concat(t,"-res"),r,"")},t.prototype._handleMessage=function(e){var t,r;return r_(this,void 0,void 0,(function(){var i,n,o,a,s,c,u,d,l,h,p,f,_,v,m,y,g,S,E,b,I,T,A,R,C,O,w,k,N,P,D,M,L,U,x;return i_(this,(function(V){switch(V.label){case 0:i=this._dispartData(e),n=i.header,o=i.data,n.zip&&((a=new LF.Inflate).push(o,!0),o=a.result),s=MU.ab2str(o),c=[];try{c=JSON.parse(s)}catch(e){return e instanceof Error&&cj.rtcSignalingMsgError(-1,e.message,yB.MESSAGE_PARSE_FAILED),[2]}switch(n.functionType){case qG.C2S:return[3,1];case qG.C2C:return[3,6];case qG.C2GW:return[3,18]}return[3,19];case 1:return u=(null===(t=n.id)||void 0===t?void 0:t.join("-"))||"",n.direction!==XG.ACK?[3,2]:(this._handleAckMessage(u,c[0]||{},s),[3,5]);case 2:return Array.isArray(c)?(d=c[0],c=c[1],JG.print("Signal","<<<<<< ".concat(d),c,u),this._feedbackSignaling(u,d),c.binary&&"string"==typeof c.message?(l=c,[4,MU.b64str2ab(c.message)]):[3,4]):[3,5];case 3:l.message=V.sent(),V.label=4;case 4:this.emit(d,e_({},c)),cj.rtcSignaling(0,s,"on-".concat(d),"Recv",SB.DOWN),V.label=5;case 5:return[3,19];case 6:switch(Array.isArray(c)&&(c=c[1]),h=null==c?void 0:c.id,this._rttIds[h]||(null==c?void 0:c.dir)===HG.FEEDBACK||YU(null==c?void 0:c.msg)?delete this._rttIds[h]:JG.print("Signal","<<<<<< p2p response",c),c.dir){case HG.SEND:return[3,7];case HG.FEEDBACK:return[3,16]}return[3,17];case 7:return YU(null==c?void 0:c.msg)?[3,15]:(f=(p=c).binary,_=p.msg,v=p.room,m=p.to,y=p.from,g=""===v?f?xG.USER_BINARY_MESSAGE_RECEIVED_OUTSIDE_ROOM:xG.USER_MESSAGE_RECEIVED_OUTSIDE_ROOM:f?xG.USER_BINARY_MESSAGE_RECEIVED:xG.USER_MESSAGE_RECEIVED,m?[3,11]:(S=this.emit,E=[xG.ON_CUSTOM_MESSAGE],U={clientId:y,binary:f},f?[4,MU.b64str2ab(_)]:[3,9]));case 8:return b=V.sent(),[3,10];case 9:b=_,V.label=10;case 10:return S.apply(this,E.concat([(U.message=b,U)])),[3,15];case 11:return I=this.emit,T=[g],A=[e_({},c)],x={},f?[4,MU.b64str2ab(_)]:[3,13];case 12:return R=V.sent(),[3,14];case 13:R=_,V.label=14;case 14:I.apply(this,T.concat([e_.apply(void 0,A.concat([(x.msg=R,x)]))])),V.label=15;case 15:return this._sendP2PMessage(e_(e_({},c),{dir:HG.FEEDBACK,msg:""})),[3,17];case 16:return(C=this._p2pCache.get(c.id))&&(this._p2pCache.delete(c.id),c.err===KG.SUCCESS?C.success(c.id,c):C.error(c)),[3,17];case 17:return[3,19];case 18:if(n.direction===XG.ACK)O=(null===(r=n.id)||void 0===r?void 0:r.join("-"))||"",this._handleAckMessage(O,c[0]||{},s);else if(w=o_(c,2),k=w[0],N=w[1],P=void 0===N?{}:N,"RXMediaMsg"===k&&(D=P.type,M=P.data,cj.rtcSignaling(0,s,"on-".concat(D),"Recv",SB.DOWN),"RSCP"===D))try{L=JSON.parse(M),Array.isArray(L)&&this.emit(D,L)}catch(e){}V.label=19;case 19:return[2]}}))}))},t.prototype._handleHandler=function(){var e=this,t=function(t){JG.print("_handleHandler","dataChannel close",t),e.emit("close",t)},r=function(t){JG.print("_handleHandler","dataChannel error",t),e.emit("close",t)},i=function(t){e._handleMessage(t.data)};return this._dataChannel.addEventListener("close",t),this._dataChannel.addEventListener("error",r),this._dataChannel.addEventListener("message",i),function(){e._dataChannel.removeEventListener("close",t),e._dataChannel.removeEventListener("error",r),e._dataChannel.removeEventListener("message",i)}},t.prototype._genHeader=function(e){return void 0===e&&(e={}),e_({version:2,zip:!1,encrypt:!1,needAck:!0,direction:XG.SEND,functionType:qG.C2S,binary:!1},e)},t.prototype._handleAckMessage=function(e,t,r){var i=this._singlingCache.get(e);i&&(this._singlingCache.delete(e),200===t.code?i.success(t):i.error(t),JG.print("Signal","<<<<<< [".concat(i.signalingType,"-ack]"),t)),cj.rtcSignaling(0,r,null==i?void 0:i.signalingType,"Ack",SB.DOWN)},t}(nB.exports.EventEmitter),ZG=function(){function e(){this.isSending=!1}return e.prototype.ajax=function(e){var t=this,r=e.method,i=e.url,n=e.body,o=void 0===n?{}:n,a=e.headers,s=void 0===a?{}:a,c=e.stringify,u=void 0===c||c;return new Promise((function(e,n){var a,c;t.isSending=!0;var d=new XMLHttpRequest;d.open(r,i,!0);try{for(var l=n_(Object.entries(s)),h=l.next();!h.done;h=l.next()){var p=o_(h.value,2),f=p[0],_=p[1];d.setRequestHeader(f,_)}}catch(e){a={error:e}}finally{try{h&&!h.done&&(c=l.return)&&c.call(l)}finally{if(a)throw a.error}}d.onreadystatechange=function(){4===d.readyState&&(t.isSending=!1,200===d.status?e(JSON.parse(d.responseText)):n({message:d.statusText,code:d.status})),0===d.status&&n({code:0,message:"Request abort"})},d.onerror=function(e){t.isSending=!1,n({code:-1,message:d.responseText||"unknown"})},t.timeout&&(d.timeout=t.timeout),u&&(o=JSON.stringify(o)),d.send(o),t.xhr=d}))},e.prototype.get=function(e,t){return this.ajax({method:"GET",url:e,headers:t})},e.prototype.post=function(e,t,r,i){return this.ajax({method:"POST",url:e,body:t,headers:r,stringify:i})},e.prototype.abort=function(){var e;null===(e=this.xhr)||void 0===e||e.abort()},e}(),$G=new rj("ICE Request",3),eH=function(){function e(){this._request=new ZG}return e.prototype.getAccessNode=function(e,t,r,i,n,o,a){return r_(this,void 0,void 0,(function(){var s;return i_(this,(function(c){return(s=zF.getAccessNode(e))?(this.getAccessNodeFromServer(e,t,r,i,n,o,a),mj("es.R.node.cache",s),Array.isArray(s)?[2,Promise.resolve(s)]:[2,Promise.resolve([s])]):[2,this.getAccessNodeFromServer(e,t,r,i,n,o,a)]}))}))},e.prototype.getAccessNodeFromServer=function(e,t,r,i,n,o,a){return r_(this,void 0,void 0,(function(){var s,c,u=this;return i_(this,(function(d){return s=zF.getAccessUrls(),c=!0,mj("es.R.req.cache.urls",s),(null==s?void 0:s.length)>0||(s=YF.ICE_CONFIG_REQUEST_URLS,c=!1,mj("es.R.req.external.urls",s)),(null==s?void 0:s.length)>0||(s=YF.ICE_CONFIG_REQUEST_URLS_INTERNAL,c=!1,mj("es.R.req.internal.urls",s)),[2,this.getICEConfigFromServer(s,e,t,r,i,n,o,a).then((function(t){var r=t.nodes;return zF.setAccessNode(e,r,t.ttl||11200),t.dispatchDomains&&zF.setAccessUrls(t.dispatchDomains),r})).catch((function(s){if(c)return mj("es.R.req.fallback",""),zF.clearAccessUrls(),u.getAccessNodeFromServer(e,t,r,i,n,o,a);throw s}))]}))}))},e.prototype.getICEConfigFromServer=function(e,t,r,i,n,o,a,s){var c;return r_(this,void 0,void 0,(function(){var r,u,d,l=this;return i_(this,(function(h){return r={appID:t,userID:i,deviceID:n,connectSessionID:kU(),os:"web",sdkVersion:YF.VERSION,isOversea:YF.OVERSEA,expectedAddr:QF("EXPECTED_ADDR"),productPlatform:"BytePlus",enableCloudProxy:s,accessParams:JSON.stringify({requireICEUfragV2:!0})},o&&a&&(r.feedbackInfo=[{feedbackIP:null===(c=a.publicIPs[0])||void 0===c?void 0:c.ip,feedbackReason:{type:"NODE_CHANGED",reason:o}}],delete r.expectedAddr),u=Date.now(),cj.rtcGetAccess(0,JSON.stringify(r),0,vB.REQUEST,e.join(","),r.connectSessionID),d=e.map((function(e,t){return r_(l,void 0,void 0,(function(){var i,n,o;return i_(this,(function(a){switch(a.label){case 0:return a.trys.push([0,2,,3]),[4,this._request.post(e,r)];case 1:return i=a.sent(),[3,3];case 2:throw n=a.sent(),new oG(Zj.ICE_SERVER_WRONG,"get ICE config failed",n);case 3:if(200!==i.code)throw new oG(Zj.ICE_SERVER_WRONG,"get ICE config failed",{server_code:i.code,message:JSON.stringify(i)});if(!(o=i.nodes[0]))throw new oG(Zj.ICE_SERVER_WRONG,"ICE config server return empty nodes",{code:i.code,message:JSON.stringify(i)});return[2,{result:i,firstNode:o,index:t}]}}))}))})),[2,ZU(d).then((function(t){var i=t.result;t.firstNode;var n=t.index;return cj.rtcGetAccess(200,JSON.stringify(i),Date.now()-u,vB.RESPONSE,e[n],r.connectSessionID),i})).catch((function(t){var i,n,o=null===(i=t[0])||void 0===i?void 0:i.error;throw cj.rtcGetAccess(+((null==o?void 0:o.code)||(null==o?void 0:o.server_code)),null===(n=t[0])||void 0===n?void 0:n.message,Date.now()-u,vB.RESPONSE,e.join(","),r.connectSessionID,{error:JSON.stringify(o)}),t}))]}))}))},e.prototype.abort=function(){this._request.isSending&&($G.print("abort","HTTP Request of [getICEConfigFromServer] abort"),this._request.abort())},e}(),tH=function(){function e(){this._request=new ZG}return e.prototype.getH264BlackList=function(){var e=this,t={keys:["web_h264_black_list"],labelSelector:"",sdkVersion:"4.45.0-blw.13",deviceType:"web"};this._request.timeout=800;var r=YF.CONFIG_REQUEST_DOMAINS.map((function(e){return"https://".concat(e,"/decision/v1/multi")}));cj.rtcGetConfig(0,JSON.stringify(t),0,r.join(","),lB.REQUEST,"",!1);var i=r.map((function(r,i){return r_(e,void 0,void 0,(function(){var e;return i_(this,(function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),[4,this._request.post(r,t)];case 1:return e=n.sent(),[3,3];case 2:throw n.sent(),new oG(Zj.ICE_SERVER_WRONG,"get config failed");case 3:if(!Array.isArray(null==e?void 0:e.web_h264_black_list))throw new oG(Zj.ICE_SERVER_WRONG,"get config failed");return[2,{result:e,index:i}]}}))}))}));return new Promise((function(e){ZU(i).then((function(t){var i=t.result,n=t.index;zF.setH264BlackList(i.web_h264_black_list),cj.rtcGetConfig(200,JSON.stringify(i),0,r[n],lB.RESPONSE,"",!1),e(i.web_h264_black_list)})).catch((function(t){cj.rtcGetConfig(500,t.message,0,"",lB.RESPONSE,"",!1),e(zF.getH264BlackList()||[])}))}))},e.prototype.getAudioProfile=function(){var e=this,t={keys:["engine_BAC"],labelSelector:"",sdkVersion:"4.45.0-blw.13",deviceType:"web"},r=YF.CONFIG_REQUEST_DOMAINS.map((function(e){return"https://".concat(e,"/decision/v1/multi")}));cj.rtcGetConfig(0,JSON.stringify(t),0,r.join(","),lB.REQUEST,"",!1);var i=r.map((function(r,i){return r_(e,void 0,void 0,(function(){var e;return i_(this,(function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),[4,this._request.post(r,t)];case 1:return e=n.sent(),[3,3];case 2:throw n.sent(),new oG(Zj.ICE_SERVER_WRONG,"get config failed");case 3:if(!Array.isArray(null==e?void 0:e.engine_BAC))throw new oG(Zj.ICE_SERVER_WRONG,"get config failed");return[2,{result:e,index:i}]}}))}))}));return new Promise((function(e){ZU(i).then((function(t){var i=t.result,n=t.index;zF.setAudioProfile(i.engine_BAC),cj.rtcGetConfig(200,JSON.stringify(i),0,r[n],lB.RESPONSE,"",!1),e(i.engine_BAC)})).catch((function(t){cj.rtcGetConfig(500,t.message,0,"",lB.RESPONSE,"",!1),e(zF.getAudioProfile()||[])}))}))},e.prototype.getWebRtcConfig=function(e){var t=this,r=e.appId,i=e.deviceId,n={keys:["web_rtc_config"],labelSelector:"",sdkVersion:"4.45.0-blw.13",deviceType:"web",appId:r,deviceId:i,userAgent:"undefined"!=typeof navigator?navigator.userAgent:void 0},o=YF.CONFIG_REQUEST_DOMAINS.map((function(e){return"https://".concat(e,"/decision/v1/multi")}));cj.rtcGetConfig(0,JSON.stringify(n),0,o.join(","),lB.REQUEST,"",!1);var a=o.map((function(e,r){return r_(t,void 0,void 0,(function(){var t;return i_(this,(function(i){switch(i.label){case 0:return i.trys.push([0,2,,3]),[4,this._request.post(e,n)];case 1:return t=i.sent(),[3,3];case 2:throw i.sent(),new oG(Zj.ICE_SERVER_WRONG,"get config failed");case 3:return[2,{result:t,index:r}]}}))}))}));return new Promise((function(e){ZU(a).then((function(t){var i=t.result,n=t.index;zF.setServerConfig(r,i),cj.rtcGetConfig(200,JSON.stringify(i),0,o[n],lB.RESPONSE,"",!1),e(i.web_rtc_config)})).catch((function(t){cj.rtcGetConfig(500,t.message,0,"",lB.RESPONSE,"",!1),e(zF.getServerConfig(r).web_rtc_config||{})}))}))},e}();function rH(e,t){var r=1,i=e;(e.width>t.width||e.height>t.height)&&(r=e.width/e.height>t.width/t.height?e.width/t.width:e.height/t.height,i={width:Math.floor(e.width/r),height:Math.floor(e.height/r)});return e_(e_({},i),{scaleResolutionDownBy:r})}var iH=[{sub_index:0,video_index:0,framerate:30,height:1080,maxkbps:3e3,width:1920},{sub_index:1,video_index:0,framerate:30,height:720,maxkbps:1200,width:1280},{sub_index:2,video_index:0,framerate:30,height:630,maxkbps:1100,width:1120},{sub_index:3,video_index:0,framerate:30,height:540,maxkbps:1e3,width:960},{sub_index:4,video_index:1,framerate:30,height:450,maxkbps:800,width:800},{sub_index:5,video_index:1,framerate:30,height:360,maxkbps:600,width:640},{sub_index:6,video_index:1,framerate:30,height:270,maxkbps:400,width:480},{sub_index:7,video_index:2,framerate:15,height:180,maxkbps:300,width:320},{sub_index:8,video_index:2,framerate:15,height:144,maxkbps:200,width:256},{sub_index:9,video_index:3,framerate:15,height:90,maxkbps:100,width:160}],nH=[{width:1920,height:1080,maxLayers:3,totalPixels:2073600},{width:1280,height:720,maxLayers:3,totalPixels:921600},{width:960,height:540,maxLayers:3,totalPixels:518400},{width:640,height:360,maxLayers:2,totalPixels:230400},{width:480,height:270,maxLayers:2,totalPixels:129600},{width:320,height:180,maxLayers:1,totalPixels:57600},{width:0,height:0,maxLayers:1,totalPixels:0}];var oH={width:160,height:90,frameRate:15,maxkbps:100},aH={width:480,height:270,frameRate:15,maxkbps:400};function sH(e){if(!e.length)return[];var t=e.shift(),r=t.width/t.height,i=0,n=0,o=e_(e_({},t),{video_index:n,sub_index:i++});delete o.rid;for(var a=[o],s=0,c=0;c<iH.length;c++)if(iH[c].height<t.height){s=c;break}var u=e.shift();for(c=s;c<iH.length;c++){var d=iH[c];if(u&&d.height<=(null==u?void 0:u.height)){var l=d.height===(null==u?void 0:u.height),h=e_(e_({},u),{video_index:++n,sub_index:i++});if(delete h.rid,a.push(h),u=e.shift(),l)continue}a.push(e_(e_({},d),{width:Math.floor(d.height*r),video_index:n,sub_index:i++}))}return a}var cH,uH,dH,lH,hH=new Map,pH=function(e){return r_(void 0,void 0,void 0,(function(){return i_(this,(function(t){return[2,new Promise((function(t,r){if("chrome-stable"===LU()&&void 0===window.InstallTrigger)try{e.getStats((function(e){var r=[];e.result().forEach((function(e){if(!mH.includes(e.type)){var t={};e.names().forEach((function(r){t[r]=e.stat(r)})),r.push(e_(e_({},t),{id:e.id,type:e.type,timestamp:e.timestamp}))}})),t({all:r,getTrackStats:function(e){return r.filter((function(t){return"ssrc"!==t.type||t.googTrackId===e}))}})}))}catch(e){r(e)}else t({all:[],getTrackStats:function(){return[]}})}))]}))}))},fH=function(e){return r_(void 0,void 0,void 0,(function(){var t,r,i,n,o,a;return i_(this,(function(s){switch(s.label){case 0:return[4,e.getStats()];case 1:return t=s.sent(),r={all:[]},i=new Map,t.forEach((function(e){var t=i.get(e.type)||new Map;t.set(e.id,e),i.set(e.type,t),r.all.push(e)})),n=function(e,t){e.forEach((function(e){var r,n,o,a,s,c,u,d,l,h,p=e.codecId,f=e.transportId,_=e.trackId,v=e.playoutId;if(null===(r=i.get(cH.codec))||void 0===r||r.forEach((function(e){e.id===p&&t.add(e)})),null===(n=i.get(cH.transport))||void 0===n||n.forEach((function(e){e.id===f&&(l=e,t.add(e))})),null===(o=i.get(cH.track))||void 0===o||o.forEach((function(e){e.id===_&&t.add(e)})),null===(a=i.get(cH.mediaPlayout))||void 0===a||a.forEach((function(e){e.id===v&&t.add(e)})),l){var m=l.localCertificateId,y=l.remoteCertificateId,g=l.selectedCandidatePairId;null===(s=i.get(cH.certificate))||void 0===s||s.forEach((function(e){(e.id===m||e.id===y)&&t.add(e)})),null===(c=i.get(cH.candidatePair))||void 0===c||c.forEach((function(e){e.id===g&&(h=e,t.add(e))}))}if(h){var S=h.localCandidateId,E=h.remoteCandidateId;null===(u=i.get(cH.localCandidate))||void 0===u||u.forEach((function(e){e.id===S&&t.add(e)})),null===(d=i.get(cH.remoteCandidate))||void 0===d||d.forEach((function(e){e.id===E&&t.add(e)}))}}))},null===(o=i.get(cH.mediaSource))||void 0===o||o.forEach((function(e){var t,o=new Set;o.add(e);var a=[];null===(t=i.get(cH.outboundRtp))||void 0===t||t.forEach((function(t){var r;t.mediaSourceId===e.id&&(o.add(t),a.push(t),null===(r=i.get(cH.remoteInboundRtp))||void 0===r||r.forEach((function(e){e.localId===t.id&&o.add(e)})))})),n(a,o),r[e.trackIdentifier]=Array.from(o)})),null===(a=i.get(cH.inboundRtp))||void 0===a||a.forEach((function(e){var t,o,a=new Set;a.add(e),null===(t=i.get(cH.remoteOutboundRtp))||void 0===t||t.forEach((function(t){t.localId===e.id&&a.add(t)})),n([e],a);var s=e.trackIdentifier;s||null===(o=i.get(cH.track))||void 0===o||o.forEach((function(t){t.id===e.trackId&&(s=t.trackIdentifier)})),r[s]=Array.from(a)})),[2,r]}}))}))},_H=function(e,t,r){return r_(void 0,void 0,void 0,(function(){var i,n,o,a,s;return i_(this,(function(c){switch(c.label){case 0:return i=null==t?void 0:t.id,e instanceof RTCPeerConnection?((!(n=hH.get(e))||Date.now()-n.timestamp>100)&&(n={timestamp:Date.now(),statsPromise:fH(e),extraStatsPromise:ox?pH(e):Promise.resolve(void 0)},hH.set(e,n)),[4,n.statsPromise]):[2,[]];case 1:return o=c.sent(),a=(i?o[i]:o.all)||[],r||!ox?[3,3]:[4,n.extraStatsPromise];case 2:(s=c.sent())&&(a=a.concat((i?s.getTrackStats(i):s.all)||[])),c.label=3;case 3:return[2,a]}}))}))};LU(),function(e){e.codec="codec",e.inboundRtp="inbound-rtp",e.outboundRtp="outbound-rtp",e.remoteInboundRtp="remote-inbound-rtp",e.remoteOutboundRtp="remote-outbound-rtp",e.mediaSource="media-source",e.csrc="csrc",e.peerConnection="peer-connection",e.dataChannel="data-channel",e.stream="stream",e.track="track",e.transceiver="transceiver",e.sender="sender",e.receiver="receiver",e.transport="transport",e.sctpTransport="sctp-transport",e.candidatePair="candidate-pair",e.localCandidate="local-candidate",e.remoteCandidate="remote-candidate",e.certificate="certificate",e.iceServer="ice-server",e.mediaPlayout="media-playout"}(cH||(cH={})),function(e){e[e.encode=0]="encode",e[e.decode=1]="decode"}(uH||(uH={})),function(e){e[e.none=0]="none",e[e.cpu=1]="cpu",e[e.bandwidth=2]="bandwidth",e[e.other=3]="other"}(dH||(dH={})),function(e){e[e.unknown=0]="unknown",e[e.controlling=1]="controlling",e[e.controlled=2]="controlled"}(lH||(lH={}));var vH,mH=["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"],yH=function(){return r_(void 0,void 0,void 0,(function(){var e,t,r,i,n,o,a,s,c,u,d,l,h,p;return i_(this,(function(f){switch(f.label){case 0:if(vH)return[2,vH];e=[],f.label=1;case 1:return f.trys.push([1,5,,6]),[4,QU()];case 2:if(!(t=f.sent()))return[2,e];r=t.split("\n"),i=!1;try{for(n=n_(r),o=n.next();!o.done;o=n.next())if((a=o.value).includes("level-asymmetry-allowed=1")&&a.includes("packetization-mode=1")&&a.includes("profile-level-id=42e0")){i=!0;break}}catch(e){h={error:e}}finally{try{o&&!o.done&&(p=n.return)&&p.call(n)}finally{if(h)throw h.error}}return i?(s=navigator.userAgent.toLowerCase(),c=!1,u=["mqqbrowser","miuibrowser"],[4,(new tH).getH264BlackList()]):[3,4];case 3:for(d=f.sent(),u.push.apply(u,a_([],o_(d),!1)),l=0;l<u.length;l++)s.includes(u[l])&&(c=!0);!c&&e.push("H264"),f.label=4;case 4:return(null==t?void 0:t.includes("VP8"))&&e.push("vp8"),vH=e,[2,e];case 5:return f.sent(),[2,e];case 6:return[2]}}))}))},gH=function(){return"undefined"!=typeof TransformStream&&"undefined"!=typeof RTCRtpSender&&"undefined"!=typeof RTCRtpReceiver&&void 0!==RTCRtpSender.prototype.createEncodedStreams&&void 0!==RTCRtpReceiver.prototype.createEncodedStreams},SH=new rj("BasicHandler",3),EH={iceServers:[],iceTransportPolicy:"all",bundlePolicy:"max-bundle",rtcpMuxPolicy:"require",sdpSemantics:"unified-plan",encodedInsertableStreams:!!gH()||void 0};function bH(e){return Math.ceil(e)}var IH=function(e){function t(t,r){var i=e.call(this)||this;return i._offerIce={},i._answerIce={},i._initSctpEvents=!1,i.monitor=t,i._peerConnection=new RTCPeerConnection(EH),i._dataChannel=i._peerConnection.createDataChannel("signaling",{negotiated:!0,id:100}),i._context=r,i._dataChannel.binaryType="arraybuffer",i._peerConnection.ontrack=function(e){var t,r;SH.print("constructor","pc.ontrack ".concat(e.track.kind," ").concat(e.track.id," ").concat(null===(r=null===(t=e.streams)||void 0===t?void 0:t[0])||void 0===r?void 0:r.id)),i.emit("ontrack",e)},i._peerConnection.onconnectionstatechange=function(e){SH.print("constructor","onconnectionstatechange ".concat(i._peerConnection.iceConnectionState," -> ").concat(i._peerConnection.connectionState)),"failed"!==i._peerConnection.iceConnectionState&&"closed"!==i._peerConnection.iceConnectionState&&"failed"!==i._peerConnection.connectionState||i.emit("disconnect")},i._peerConnection.oniceconnectionstatechange=function(){var e=i._peerConnection.iceConnectionState;t.rtcPreIceState(e,mB["".concat(e.toUpperCase())])},i}return Of(t,e),t.prototype.disconnect=function(){this._peerConnection.close(),this._dataChannel.close(),this._peerConnection.ontrack=null},t.prototype.destroy=function(){SH.print("destroy"),this.disconnect(),this._context=void 0},t.prototype._simulcast=function(e,t,r,i,n){var o=[];1===e.videoEncodeConfig.length?(o=function(e,t){var r=[];if(t<=1)return r;var i=1,n=1;return e.width/e.height>16/9?(i=e.width/oH.width,n=e.width/aH.width):(i=e.height/oH.height,n=e.height/aH.height),r.push({maxkbps:oH.maxkbps,scaleResolutionDownBy:i,frameRate:oH.frameRate,width:Math.floor(e.width/i),height:Math.floor(e.height/i)}),t<=2||i>2&&r.unshift({maxkbps:aH.maxkbps,scaleResolutionDownBy:n,frameRate:aH.frameRate,width:Math.floor(e.width/n),height:Math.floor(e.height/n)}),r}(t,n),SH.print("simulcast() ","simulcastLayers: %o",o)):(o=e.videoEncodeConfig.slice(1).slice(1-n).map((function(e){return e_({frameRate:e.frameRate||15,maxkbps:e.maxKbps||600},rH(t,e))})),SH.print("simulcast() ","simulcastLayers2: %o",o)),o.forEach((function(e,t){var n={maxBitrate:1e3*e.maxkbps,scaleResolutionDownBy:bH(e.scaleResolutionDownBy),rid:"".concat(t+1),maxFramerate:e.frameRate};r.sendEncodings&&r.sendEncodings.unshift(n),i.push({width:e.width,height:e.height,framerate:e.frameRate,maxkbps:e.maxkbps,rid:"".concat(t+1)})}))},t.prototype.internalPublish=function(e,t){var r=e.stream,i=e.videoTrack,n=e.audioTrack,o=e.enableSimulcast,a=e.pubAudio,s=e.pubVideo,c={direction:"sendonly",streams:[r]},u={direction:"sendonly",streams:[r]},d=[],l=[];if(Array.isArray(null==e?void 0:e.videoEncodeConfig)&&e.videoEncodeConfig.length){var h=null==i?void 0:i.getTrack(),p={width:640,height:360,frameRate:30};if(h){var f=null==h?void 0:h.getSettings();p={width:Math.floor(f.width),height:Math.floor(f.height),frameRate:Math.floor(f.frameRate)}}var _=null==e?void 0:e.videoEncodeConfig[0],v=rH(p,_);e.prevScaleResolutionDownBy=v.scaleResolutionDownBy,e.videoInputConfig=p;var m={maxBitrate:1e3*_.maxKbps,scaleResolutionDownBy:bH(v.scaleResolutionDownBy),rid:"0",maxFramerate:_.frameRate||15};if(u.sendEncodings=[m],d.push({width:v.width,height:v.height,framerate:_.frameRate,maxkbps:_.maxKbps,rid:"0"}),o){var y=function(e){for(var t=0,r=e.width*e.height,i=0;i<nH.length;i++)if(r>=nH[i].totalPixels){t=i;break}if(0===t)return nH[t].maxLayers;var n=nH[t-1].totalPixels;return(n-r)/(n-nH[t].totalPixels)<.1?nH[t-1].maxLayers:nH[t].maxLayers}(v);SH.print("simulcast() ","maxLayers: %o",y),y>1&&(this._simulcast(e,p,u,d,y),(null==t?void 0:t.simulcastOnDemand)&&(l=sH(a_([],o_(d),!1))),SH.print("subVideoDesc","desc: %o ",l))}}SH.print("publish videoTransceiverInit videoDescriptions","",u,d);var g=null==n?void 0:n.getTrack();(null==n?void 0:n.mixType)!==u_.PLAYOUT&&(null==n?void 0:n.mixedAudioTrack)&&(g=null==n?void 0:n.mixedAudioTrack),g=a&&g?g:"audio";var S=null==i?void 0:i.getTrack();S=s&&S?S:"video";try{this.monitor.rtcInvokeStatus(JSON.stringify({aTrack:ix(g),vTrack:ix(S),audioTransceiverInit:c,videoTransceiverInit:u}),0,"Handler.internalPublish","",0)}catch(e){}return{semantics:"unified-plan",videoDescriptions:d,subVideoDescriptions:l,transceiverInit:{aTrack:g,vTrack:S,audioTransceiverInit:c,videoTransceiverInit:u}}},t.prototype.updateDegradationPreference=function(e){var t,r;return r_(this,void 0,void 0,(function(){var i,n,o;return i_(this,(function(a){switch(a.label){case 0:return SH.print("updateDegradationPreference()"),i=null===(t=e.videoTrack)||void 0===t?void 0:t.getTrack(),n=e.videoTransceiver,i&&e.pubVideo&&n?(o=null===(r=n.sender)||void 0===r?void 0:r.getParameters())?(i.contentHint?o.degradationPreference=i.degradationPreference?i.degradationPreference:"motion"===(s=i.contentHint)?"maintain-framerate":"detail"===s||"text"===s?"maintain-resolution":void 0:delete o.degradationPreference,[4,null==n?void 0:n.sender.setParameters(o)]):[3,2]:(SH.print("updateDegradationPreference()","no pub"),[2]);case 1:a.sent();try{this.monitor.rtcInvokeStatus(JSON.stringify(o),0,"Handler.updateDegradationPreference","",0)}catch(e){}a.label=2;case 2:return[2]}var s}))}))},t.prototype.updateMaxBitrate=function(e){var t,r,i;SH.print("updateMaxBitrate()");var n=null===(t=e.videoTrack)||void 0===t?void 0:t.getTrack(),o=e.videoTransceiver;if(n&&e.pubVideo&&o){var a=null===(r=o.sender)||void 0===r?void 0:r.getParameters();if(a){a.encodings=null===(i=null==a?void 0:a.encodings)||void 0===i?void 0:i.map((function(t){var r,i=+t.rid||0,n=null===(r=e.videoEncodeConfig[i])||void 0===r?void 0:r.maxKbps;return"number"==typeof n&&(t.maxBitrate=1e3*n),t})),null==o||o.sender.setParameters(a);try{this.monitor.rtcInvokeStatus(JSON.stringify(a.encodings),0,"Handler.updateScaleResolutionDownBy","",0)}catch(e){}}}else SH.print("updateMaxBitrate()","no pub")},t.prototype.updateScaleResolutionDownBy=function(e){var t,r,i;return r_(this,void 0,void 0,(function(){var n,o,a,s,c,u,d;return i_(this,(function(l){if(SH.print("updateScaleResolutionDownBy()"),n=null===(t=e.videoTrack)||void 0===t?void 0:t.getTrack(),o=e.videoTransceiver,!n||!e.pubVideo||!o)return SH.print("updateScaleResolutionDownBy()","no pub"),[2];if(a=null==n?void 0:n.getSettings(),s={width:Math.floor(a.width),height:Math.floor(a.height),frameRate:Math.floor(a.frameRate)},(c=rH(s,e.videoEncodeConfig[0])).scaleResolutionDownBy===e.prevScaleResolutionDownBy&&SH.print("updateScaleResolutionDownBy()","no change %o",e.prevScaleResolutionDownBy),u=null===(r=o.sender)||void 0===r?void 0:r.getParameters()){d=c.scaleResolutionDownBy/e.prevScaleResolutionDownBy,u.encodings=null===(i=null==u?void 0:u.encodings)||void 0===i?void 0:i.map((function(t){var r;Math.max(t.scaleResolutionDownBy=(t.scaleResolutionDownBy||1)*d,1);var i=+t.rid||0;return t.maxFramerate=(null===(r=e.videoEncodeConfig[i])||void 0===r?void 0:r.frameRate)||t.maxFramerate,t})),e.prevScaleResolutionDownBy=c.scaleResolutionDownBy,e.videoInputConfig=s,null==o||o.sender.setParameters(u);try{this.monitor.rtcInvokeStatus(JSON.stringify(u.encodings),0,"Handler.updateScaleResolutionDownBy","",0)}catch(e){}}return[2]}))}))},t.prototype.getStats=function(e,t){return _H(this._peerConnection,e,t)},t.prototype.setLocalDescription=function(e,t){var r;return r_(this,void 0,void 0,(function(){var i,n,o,a=this;return i_(this,(function(s){switch(s.label){case 0:i=NU(),s.label=1;case 1:return s.trys.push([1,3,,4]),[4,this._peerConnection.setLocalDescription(new RTCSessionDescription({type:"offer",sdp:e}))];case 2:return s.sent(),this.monitor.rtcSetDescription(0,e,IB.W_1,"local"===(null==t?void 0:t.streamUserId)?TB.UP:TB.DOWN,(null==t?void 0:t.streamId)||"",(null==t?void 0:t.streamUserId)||"",NU()-i,{type:"offer"}),this._initSctpEvents||(this._initSctpEvents=!0,(n=null===(r=this._peerConnection)||void 0===r?void 0:r.sctp)&&(n.onstatechange=function(){a.monitor.rtcInvokeStatus("sctp state change TO: ".concat(n.state),0,"sctp","",0)},n.transport&&(n.transport.onstatechange=function(){var e;a.monitor.rtcInvokeStatus("dtls state change TO: ".concat(null===(e=null==n?void 0:n.transport)||void 0===e?void 0:e.state),0,"dtls","",0)}))),[3,4];case 3:return o=s.sent(),this.monitor.rtcSetDescription(-1,o.message+e,IB.W_1,"local"===(null==t?void 0:t.streamUserId)?TB.UP:TB.DOWN,"","",NU()-i,{type:"offer"}),[3,4];case 4:return[2]}}))}))},t.prototype.setRemoteDescription=function(e,t){return r_(this,void 0,void 0,(function(){var r,i;return i_(this,(function(n){switch(n.label){case 0:r=NU(),n.label=1;case 1:return n.trys.push([1,3,,4]),[4,this._peerConnection.setRemoteDescription(new RTCSessionDescription({type:"answer",sdp:e}))];case 2:return n.sent(),this.monitor.rtcSetDescription(0,e,IB.W_0,"local"===(null==t?void 0:t.streamUserId)?TB.UP:TB.DOWN,(null==t?void 0:t.streamId)||"",(null==t?void 0:t.streamUserId)||"",NU()-r,{type:"answer"}),[3,4];case 3:return i=n.sent(),this.monitor.rtcSetDescription(-1,i.message+e,IB.W_1,"local"===(null==t?void 0:t.streamUserId)?TB.UP:TB.DOWN,(null==t?void 0:t.streamId)||"",(null==t?void 0:t.streamUserId)||"",NU()-r,{type:"answer"}),[3,4];case 4:return[2]}}))}))},t.prototype.setCurrentDescription=function(){return r_(this,void 0,void 0,(function(){return i_(this,(function(e){return[2]}))}))},Object.defineProperty(t.prototype,"pc",{get:function(){return this._peerConnection},enumerable:!1,configurable:!0}),t.prototype.addBitrateLimit=function(e,t){null==e||e.rtp.forEach((function(r){var i=r.codec,n=r.payload;if(["vp8","h264"].includes(i.toLocaleLowerCase())){var o=e.fmtp.find((function(e){return e.payload===n}));o?o.config=a_(a_([],o_(o.config.split(";")),!1),["x-google-min-bitrate=100","x-google-start-bitrate=".concat(t)],!1).join(";"):e.fmtp.push({payload:n,config:"x-google-min-bitrate=100;x-google-start-bitrate=".concat(t)})}}))},t}(nB.exports.EventEmitter),TH=sh;Xi({target:"Array",proto:!0},{fill:JO}),TH("fill");var AH={},RH={},CH={exports:{}},OH=CH.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(OH).forEach((function(e){OH[e].forEach((function(e){e.reg||(e.reg=/(.*)/),e.format||(e.format="%s")}))})),function(e){var t=function(e){return String(Number(e))===e?Number(e):e},r=function(e,r,i){var n=e.name&&e.names;e.push&&!r[e.push]?r[e.push]=[]:n&&!r[e.name]&&(r[e.name]={});var o=e.push?{}:n?r[e.name]:r;!function(e,r,i,n){if(n&&!i)r[n]=t(e[1]);else for(var o=0;o<i.length;o+=1)null!=e[o+1]&&(r[i[o]]=t(e[o+1]))}(i.match(e.reg),o,e.names,e.name),e.push&&r[e.push].push(o)},i=CH.exports,n=RegExp.prototype.test.bind(/^([a-z])=(.*)/);e.parse=function(e){var t={},o=[],a=t;return e.split(/(\r\n|\r|\n)/).filter(n).forEach((function(e){var t=e[0],n=e.slice(2);"m"===t&&(o.push({rtp:[],fmtp:[]}),a=o[o.length-1]);for(var s=0;s<(i[t]||[]).length;s+=1){var c=i[t][s];if(c.reg.test(n))return r(c,a,n)}})),t.media=o,t};var o=function(e,r){var i=r.split(/=(.+)/,2);return 2===i.length?e[i[0]]=t(i[1]):1===i.length&&r.length>1&&(e[i[0]]=void 0),e};e.parseParams=function(e){return e.split(/;\s?/).reduce(o,{})},e.parseFmtpConfig=e.parseParams,e.parsePayloads=function(e){return e.toString().split(" ").map(Number)},e.parseRemoteCandidates=function(e){for(var r=[],i=e.split(" ").map(t),n=0;n<i.length;n+=3)r.push({component:i[n],ip:i[n+1],port:i[n+2]});return r},e.parseImageAttributes=function(e){return e.split(" ").map((function(e){return e.substring(1,e.length-1).split(",").reduce(o,{})}))},e.parseSimulcastStreamList=function(e){return e.split(";").map((function(e){return e.split(",").map((function(e){var r,i=!1;return"~"!==e[0]?r=t(e):(r=t(e.substring(1,e.length)),i=!0),{scid:r,paused:i}}))}))}}(RH);var wH=CH.exports,kH=/%[sdv%]/g,NH=function(e){var t=1,r=arguments,i=r.length;return e.replace(kH,(function(e){if(t>=i)return e;var n=r[t];switch(t+=1,e){case"%%":return"%";case"%s":return String(n);case"%d":return Number(n);case"%v":return""}}))},PH=function(e,t,r){var i=[e+"="+(t.format instanceof Function?t.format(t.push?r:r[t.name]):t.format)];if(t.names)for(var n=0;n<t.names.length;n+=1){var o=t.names[n];t.name?i.push(r[t.name][o]):i.push(r[t.names[n]])}else i.push(r[t.name]);return NH.apply(null,i)},DH=["v","o","s","i","u","e","p","c","b","t","r","z","a"],MH=["i","c","b","a"],LH=RH,UH=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||DH,i=t.innerOrder||MH,n=[];return r.forEach((function(t){wH[t].forEach((function(r){r.name in e&&null!=e[r.name]?n.push(PH(t,r,e)):r.push in e&&null!=e[r.push]&&e[r.push].forEach((function(e){n.push(PH(t,r,e))}))}))})),e.media.forEach((function(e){n.push(PH("m",wH.m[0],e)),i.forEach((function(t){wH[t].forEach((function(r){r.name in e&&null!=e[r.name]?n.push(PH(t,r,e)):r.push in e&&null!=e[r.push]&&e[r.push].forEach((function(e){n.push(PH(t,r,e))}))}))}))})),n.join("\r\n")+"\r\n"};AH.write=UH,AH.parse=LH.parse,AH.parseParams=LH.parseParams,AH.parseFmtpConfig=LH.parseFmtpConfig,AH.parsePayloads=LH.parsePayloads,AH.parseRemoteCandidates=LH.parseRemoteCandidates,AH.parseImageAttributes=LH.parseImageAttributes,AH.parseSimulcastStreamList=LH.parseSimulcastStreamList;var xH=Math.pow(2,32),VH=function(){return Math.floor(Math.random()*xH+1e3)},FH=function(e,t,r){return r||(r=VH()),[{id:r,attribute:"cname",value:"kp34Za0H+aVf862l"},{id:r,attribute:"msid",value:"".concat(e.id," ").concat(e.id,"-").concat(t)},{id:r,attribute:"mslabel",value:"".concat(e.id)},{id:r,attribute:"label",value:"".concat(e.id,"-").concat(t)}]};function BH(e){return e.direction="inactive",e.port=0,delete e.ext,delete e.ssrcs,delete e.ssrcGroups,delete e.simulcast,delete e.simulcast_03,delete e.rids,delete e.extmapAllowMixed,delete e.bundleOnly,e}var jH=function(e,t,r){var i=e_(e_({},e),{invalid:[{value:"realx-exts:rscp"}],media:[t,r]});return delete i.groups,delete i.msidSemantic,AH.write(i)};function GH(e){return r_(this,void 0,void 0,(function(){var t,r,i,n,o;return i_(this,(function(a){switch(a.label){case 0:return t={},r=e.publicIPs,i=e.certFingerprint,n=e.iceParams,t.fingerprint={type:"sha-256",hash:i},t.icePwd=n.serverIcePwd,o=t,[4,zH(n.serverIceUfrag)];case 1:return o.iceUfrag=a.sent(),lj.setStats({connection_id:t.iceUfrag}),t.candidates=function(e){if(!Array.isArray(e))return[];var t=0,r=2130706431,i=[];return e.forEach((function(e){var n={component:1,ip:e.ip,type:"host",generation:e.generation};e.udpPorts&&e.udpPorts.forEach((function(e){i.push(e_(e_({},n),{foundation:t++,transport:"udp",port:e,priority:r}))})),e.tcpPorts&&e.tcpPorts.forEach((function(e){i.push(e_(e_({},n),{foundation:t++,transport:"tcp",port:e,tcptype:"passive",priority:r-1e3}))}))})),i}(r),t.setup="active",t.iceOptions="renomination",[2,t]}}))}))}var HH,zH=function(e){return r_(void 0,void 0,void 0,(function(){var t,r,i,n,o,a,s;return i_(this,(function(c){switch(c.label){case 0:return t=new TextEncoder,r=t.encode("PREC"),n=Uint8Array.bind,[4,MU.b64str2ab(e)];case 1:return i=new(n.apply(Uint8Array,[void 0,c.sent()])),o=t.encode(Date.now().toString()).slice(-4),(a=new Uint8Array(2))[0]=0,a[1]=1,s=PU(Uint8Array,r,i,o,a),[4,MU.ab2b64str(s.buffer)];case 2:return[2,c.sent()]}}))}))};function KH(e){var t=e.random,r=e.serverUfrag,i=e.serverPwd,n=e.clientPwd,o=e.options,a=(new TextEncoder).encode("WPRE");t||(t=new Uint8Array(4),crypto.getRandomValues(t));var s=ax(r);s.byteLength;var c=cx(ax(n),ax(i).subarray(0,16),ax(r).subarray(0,16));c.byteLength;var u=new Uint8Array(Object.keys(o).reduce((function(e,t){var r=Number(t);return e.push(r),e.push(o[r]?1:0),e}),[]));u.byteLength;var d=PU(Uint8Array,a,t,[s.byteLength],s,[c.byteLength],c,u);return d.byteLength%3!=0&&(d=PU(Uint8Array,d,new Uint8Array(3-d.byteLength%3).fill(255))),[sx(d),sx(PU(Uint8Array,t,s.subarray(0,20)))]}!function(e){e[e.kICEConfigTypeSrtpDtlsType=0]="kICEConfigTypeSrtpDtlsType",e[e.kICEConfigTypeRenominationType=1]="kICEConfigTypeRenominationType",e[e.kICEConfigTypeTcpType=2]="kICEConfigTypeTcpType",e[e.kICEConfigTypeMultiSendType=3]="kICEConfigTypeMultiSendType",e[e.kICEConfigTypeKcpType=4]="kICEConfigTypeKcpType",e[e.kICEConfigTypeSrtpSdesType=5]="kICEConfigTypeSrtpSdesType"}(HH||(HH={}));var WH=function(e,t){var r,i,n=0;if(Array.isArray(e.fmtp)&&Array.isArray(e.rtp)){try{for(var o=n_(e.fmtp),a=o.next();!a.done;a=o.next()){var s=a.value;if(s.config.includes("level-asymmetry-allowed=1")&&s.config.includes("packetization-mode=1")&&s.config.includes("profile-level-id=42e0")){n=s.payload;break}}}catch(e){r={error:e}}finally{try{a&&!a.done&&(i=o.return)&&i.call(o)}finally{if(r)throw r.error}}for(var c=0;c<e.rtp.length;c++){var u=e.rtp[c];if("H264"===t){if(u.payload===n){e.rtp.unshift(e.rtp.splice(c,1)[0]);break}}else if(u.codec===t){e.rtp.unshift(e.rtp.splice(c,1)[0]);break}}var d=[];e.rtp.forEach((function(e){return d.push(e.payload)})),e.payloads=d.join(" ")}},XH=A,qH=nc,YH=Mm.exports.getWeakData,JH=Mt,QH=H,ZH=hc,$H=Xc,ez=Ve,tz=wr.set,rz=wr.getterFor,iz=Ia.find,nz=Ia.findIndex,oz=XH([].splice),az=0,sz=function(e){return e.frozen||(e.frozen=new cz)},cz=function(){this.entries=[]},uz=function(e,t){return iz(e.entries,(function(e){return e[0]===t}))};cz.prototype={get:function(e){var t=uz(this,e);if(t)return t[1]},has:function(e){return!!uz(this,e)},set:function(e,t){var r=uz(this,e);r?r[1]=t:this.entries.push([e,t])},delete:function(e){var t=nz(this.entries,(function(t){return t[0]===e}));return~t&&oz(this.entries,t,1),!!~t}};var dz,lz={getConstructor:function(e,t,r,i){var n=e((function(e,n){ZH(e,o),tz(e,{type:t,id:az++,frozen:void 0}),null!=n&&$H(n,e[i],{that:e,AS_ENTRIES:r})})),o=n.prototype,a=rz(t),s=function(e,t,r){var i=a(e),n=YH(JH(t),!0);return!0===n?sz(i).set(t,r):n[i.id]=r,e};return qH(o,{delete:function(e){var t=a(this);if(!QH(e))return!1;var r=YH(e);return!0===r?sz(t).delete(e):r&&ez(r,t.id)&&delete r[t.id]},has:function(e){var t=a(this);if(!QH(e))return!1;var r=YH(e);return!0===r?sz(t).has(e):r&&ez(r,t.id)}}),qH(o,r?{get:function(e){var t=a(this);if(QH(e)){var r=YH(e);return!0===r?sz(t).get(e):r?r[t.id]:void 0}},set:function(e,t){return s(this,e,t)}}:{add:function(e){return s(this,e,!0)}}),n}},hz=o,pz=A,fz=nc,_z=Mm.exports,vz=by,mz=lz,yz=H,gz=jm,Sz=wr.enforce,Ez=ar,bz=!hz.ActiveXObject&&"ActiveXObject"in hz,Iz=function(e){return function(){return e(this,arguments.length?arguments[0]:void 0)}},Tz=vz("WeakMap",Iz,mz);if(Ez&&bz){dz=mz.getConstructor(Iz,"WeakMap",!0),_z.enable();var Az=Tz.prototype,Rz=pz(Az.delete),Cz=pz(Az.has),Oz=pz(Az.get),wz=pz(Az.set);fz(Az,{delete:function(e){if(yz(e)&&!gz(e)){var t=Sz(this);return t.frozen||(t.frozen=new dz),Rz(this,e)||t.frozen.delete(e)}return Rz(this,e)},has:function(e){if(yz(e)&&!gz(e)){var t=Sz(this);return t.frozen||(t.frozen=new dz),Cz(this,e)||t.frozen.has(e)}return Cz(this,e)},get:function(e){if(yz(e)&&!gz(e)){var t=Sz(this);return t.frozen||(t.frozen=new dz),Cz(this,e)?Oz(this,e):t.frozen.get(e)}return Oz(this,e)},set:function(e,t){if(yz(e)&&!gz(e)){var r=Sz(this);r.frozen||(r.frozen=new dz),Cz(this,e)?wz(this,e,t):r.frozen.set(e,t)}else wz(this,e,t);return this}})}var kz=function(e){function t(){var t,r,i=e.call(this)||this;return i.inited=!1,i.deviceMap={audioinput:new Map,audiooutput:new Map,videoinput:new Map},i.checkDeviceChangeTimer=null,i.isSupportedPermissionsQuery=!1,i.isGrantedMicrophonePermission=!1,i.isGrantedCameraPermission=!1,i.isSupportedPermissionsQuery=!DU()&&!!(null===(r=null===(t=navigator)||void 0===t?void 0:t.permissions)||void 0===r?void 0:r.query),i._handleDeviceChange=i._handleDeviceChange.bind(i),!DU()&&i.refreshDevices(),i}return Of(t,e),t.prototype.refreshDevices=function(){return r_(this,void 0,void 0,(function(){var e,t,r=this;return i_(this,(function(i){switch(i.label){case 0:if(!navigator.mediaDevices)return[2];if(e=void 0,!UU)return[3,4];i.label=1;case 1:return i.trys.push([1,3,,4]),[4,navigator.mediaDevices.getUserMedia({audio:!0})];case 2:return e=i.sent(),[3,4];case 3:return i.sent(),[3,4];case 4:return[4,navigator.mediaDevices.enumerateDevices()];case 5:return t=i.sent(),e&&e.getTracks().forEach((function(e){return e.stop()})),t.forEach((function(e){var t;e.deviceId&&(null===(t=r.deviceMap[e.kind])||void 0===t||t.set(e.deviceId,e))})),this.inited||this.initListener(),this.inited=!0,[2]}}))}))},t.prototype.initListener=function(){var e,t;return r_(this,void 0,void 0,(function(){var r,i,n=this;return i_(this,(function(o){switch(o.label){case 0:if(void 0!==(null===(e=navigator.mediaDevices)||void 0===e?void 0:e.ondevicechange)&&"function"==typeof(null===(t=navigator.mediaDevices)||void 0===t?void 0:t.addEventListener)?navigator.mediaDevices.addEventListener("devicechange",(function(){n._handleDeviceChange(),setTimeout((function(){n._handleDeviceChange()}),300)})):this.checkDeviceChangeTimer=window.setInterval((function(){n._handleDeviceChange()}),3e3),!this.isSupportedPermissionsQuery)return[3,7];o.label=1;case 1:return o.trys.push([1,3,,4]),[4,navigator.permissions.query({name:"microphone"})];case 2:return r=o.sent(),this.isGrantedMicrophonePermission="granted"===r.state,r.addEventListener("change",(function(){n.isGrantedMicrophonePermission="granted"===r.state})),[3,4];case 3:return o.sent(),[3,4];case 4:return o.trys.push([4,6,,7]),[4,navigator.permissions.query({name:"camera"})];case 5:return i=o.sent(),this.isGrantedCameraPermission="granted"===i.state,i.addEventListener("change",(function(){n.isGrantedCameraPermission="granted"===i.state})),[3,7];case 6:return o.sent(),[3,7];case 7:return[2]}}))}))},t.prototype._handleDeviceChange=function(){return r_(this,void 0,void 0,(function(){var e,t,r,i=this;return i_(this,(function(n){switch(n.label){case 0:return e=void 0,UU?[4,navigator.mediaDevices.getUserMedia({audio:!0})]:[3,2];case 1:e=n.sent(),n.label=2;case 2:return[4,navigator.mediaDevices.enumerateDevices()];case 3:return t=(t=n.sent()).filter((function(e){return!!e.deviceId})),e&&e.getTracks().forEach((function(e){return e.stop()})),r=Array.from(a_(a_(a_([],o_(this.deviceMap.audioinput.values()),!1),o_(this.deviceMap.videoinput.values()),!1),o_(this.deviceMap.audiooutput.values()),!1)),t.forEach((function(e){var t=i.deviceMap[e.kind].get(e.deviceId);i.deviceMap[e.kind].set(e.deviceId,e),t||(e.kind.includes("video")?i.emit(h_.onVideoDeviceStateChanged,{mediaDeviceInfo:e,deviceState:"active"}):e.kind.includes("audio")&&i.emit(h_.onAudioDeviceStateChanged,{mediaDeviceInfo:e,deviceState:"active"}))})),r.forEach((function(e){t.find((function(t){return t.deviceId===e.deviceId&&t.kind===e.kind}))||(i.deviceMap[e.kind].delete(e.deviceId),e.kind.includes("video")?i.emit(h_.onVideoDeviceStateChanged,{mediaDeviceInfo:e,deviceState:"inactive"}):e.kind.includes("audio")&&i.emit(h_.onAudioDeviceStateChanged,{mediaDeviceInfo:e,deviceState:"inactive"}))})),[2]}}))}))},t.prototype.getUserMedia=function(e){return r_(this,void 0,void 0,(function(){var t;return i_(this,(function(r){switch(r.label){case 0:return[4,navigator.mediaDevices.getUserMedia(e)];case 1:return t=r.sent(),(null==e?void 0:e.audio)&&(this.isGrantedMicrophonePermission=!0),(null==e?void 0:e.video)&&(this.isGrantedCameraPermission=!0),this.refreshDevices(),[2,t]}}))}))},t.prototype.checkPermissionsByDevices=function(){return r_(this,void 0,void 0,(function(){var e,t;return i_(this,(function(r){switch(r.label){case 0:return e={audio:!1,video:!1},navigator.mediaDevices?[4,navigator.mediaDevices.enumerateDevices()]:[2,e];case 1:return t=r.sent(),e.audio=t.filter((function(e){return"audioinput"===e.kind&&e.label&&e.deviceId})).length>0,e.video=t.filter((function(e){return"videoinput"===e.kind&&e.label&&e.deviceId})).length>0,[2,e]}}))}))},t.prototype.getPermissions=function(e){var t;return void 0===e&&(e={}),r_(this,void 0,void 0,(function(){var r,i,n,o,a,s=this;return i_(this,(function(c){switch(c.label){case 0:if(r=e.audio,i=e.video,n=e.force,r||i||(r=!0,i=!0),o={audio:!1,video:!1},n)return[3,3];if(!this.isSupportedPermissionsQuery)return[3,1];if(r&&i){if(this.isGrantedMicrophonePermission&&this.isGrantedCameraPermission)return o.audio=!0,o.video=!0,[2,o]}else if(r&&this.isGrantedMicrophonePermission||i&&this.isGrantedCameraPermission)return o.audio=this.isGrantedMicrophonePermission,o.video=this.isGrantedCameraPermission,[2,o];return[3,3];case 1:return[4,this.checkPermissionsByDevices()];case 2:if(a=c.sent(),r&&i){if(a.audio&&a.video)return[2,a]}else if(r&&a.audio||i&&a.video)return[2,a];c.label=3;case 3:return(null===(t=navigator.mediaDevices)||void 0===t?void 0:t.getUserMedia)?[4,navigator.mediaDevices.getUserMedia({audio:r,video:i}).then((function(e){e&&(e.getTracks().forEach((function(e){return e.stop()})),r&&(o.audio=!0,s.isGrantedMicrophonePermission=!0),i&&(o.video=!0,s.isGrantedCameraPermission=!0))})).catch((function(){}))]:[3,5];case 4:c.sent(),c.label=5;case 5:return[4,this.refreshDevices()];case 6:return c.sent(),[2,o]}}))}))},t.prototype.enumerateDevices=function(){return r_(this,void 0,void 0,(function(){return i_(this,(function(e){switch(e.label){case 0:return[4,this.getPermissions()];case 1:return e.sent(),[4,this.refreshDevices()];case 2:return e.sent(),[2,Array.from(a_(a_(a_([],o_(this.deviceMap.audioinput.values()),!1),o_(this.deviceMap.videoinput.values()),!1),o_(this.deviceMap.audiooutput.values()),!1))]}}))}))},t.prototype.enumerateAudioCaptureDevices=function(){return r_(this,void 0,void 0,(function(){return i_(this,(function(e){switch(e.label){case 0:return[4,this.getPermissions({audio:!0})];case 1:return e.sent(),[4,this.refreshDevices()];case 2:return e.sent(),[2,Array.from(this.deviceMap.audioinput.values())]}}))}))},t.prototype.enumerateVideoCaptureDevices=function(){return r_(this,void 0,void 0,(function(){return i_(this,(function(e){switch(e.label){case 0:return[4,this.getPermissions({video:!0})];case 1:return e.sent(),[4,this.refreshDevices()];case 2:return e.sent(),[2,Array.from(this.deviceMap.videoinput.values())]}}))}))},t.prototype.enumerateAudioPlaybackDevices=function(){return r_(this,void 0,void 0,(function(){return i_(this,(function(e){switch(e.label){case 0:return[4,this.getPermissions({audio:!0})];case 1:return e.sent(),[4,this.refreshDevices()];case 2:return e.sent(),[2,Array.from(this.deviceMap.audiooutput.values())]}}))}))},t.prototype.getDeviceById=function(e){return r_(this,void 0,void 0,(function(){return i_(this,(function(t){switch(t.label){case 0:return[4,this.enumerateDevices()];case 1:return[2,t.sent().find((function(t){return t.deviceId===e}))]}}))}))},t}(oj),Nz=new kz;!DU()&&(window.__rtc_dd__=Nz);var Pz=new rj("VERTC",0),Dz=new WeakMap,Mz=function(e){return Dz.get(e)},Lz=function(e){function t(t,r){var i=e.call(this)||this;return i._trackId=t,i.mediaType=r,i}return Of(t,e),t.prototype.getId=function(){return this._trackId},t}(oj),Uz=function(e){function t(t,r,i){var n=e.call(this,r,i)||this;return n._mediaTrack=t,n._initListeners(),n}return Of(t,e),t.prototype.getTrack=function(){return this._mediaTrack},t.prototype.setTrack=function(e){this._mediaTrack=e},t.prototype.close=function(){var e;return this._mediaTrack.onended=null,this._mediaTrack.onmute=null,this._mediaTrack.onunmute=null,null===(e=this._mediaTrack)||void 0===e?void 0:e.stop()},t.prototype._initListeners=function(){var e=this;this._mediaTrack instanceof MediaStreamTrack&&this._mediaTrack.addEventListener("ended",(function(){cj.rtcError("track-ended mediaType: ".concat(e._mediaTrack.kind),-1001),e.emit("track-ended",e)}))},t}(Lz),xz=function(e){function t(t,r,i){var n=e.call(this,r,i)||this;return n._mediaTrack=t,n}return Of(t,e),t.prototype.getTrack=function(){return this._mediaTrack},t}(Lz),Vz=function(e){function t(t,r){var i=e.call(this,t,r,"video")||this;return i.dummy=!1,i.resolution={width:0,height:0},i._time=setInterval((function(){t.muted!==i._prevMuted&&Pz.print("LocalVideoTrack.mutedChange: ",t.muted),i._prevMuted=t.muted}),100),i}return Of(t,e),t.prototype.updateVideoCaptureConfig=function(){return r_(this,void 0,void 0,(function(){var e;return i_(this,(function(t){switch(t.label){case 0:return this.videoCaptureConfig&&this.getTrack()?(Pz.print("updateVideoEncoderConfig","update localVideoTrack: ",this.videoCaptureConfig),delete e_({},this.videoCaptureConfig).contentHint,[4,this.getTrack().applyConstraints(this.videoCaptureConfig)]):[2];case 1:return t.sent(),((e=this.getTrack().getSettings()).width&&e.width!==this.resolution.width||e.height&&e.height!==this.resolution.height)&&(this.resolution={width:e.width,height:e.height},this.emit("resolution-change",this.resolution)),[2]}}))}))},t.prototype.replaceTrack=function(e){this.setTrack(e)},t.prototype.close=function(){e.prototype.close.call(this),Pz.print("LocalVideoTrack.close"),clearInterval(this._time)},t.prototype.setContentHint=function(e){this._mediaTrack&&"contentHint"in this._mediaTrack&&["text","motion","detail"].includes(e)&&(this._mediaTrack.contentHint=e)},t}(Uz),Fz=function(e){function t(t,r){var i=e.call(this,t,r,"audio")||this;return i.mixType=u_.PLAYOUT_AND_PUBLISH,i}return Of(t,e),t.prototype.getAudioLevel=function(){return this._audioLevelFetcher||(this._audioLevelFetcher=new rU(this.getTrack())),this._audioLevelFetcher.getAudioLevel()},t.prototype.checkHasInput=function(){return this._audioLevelFetcher||(this._audioLevelFetcher=new rU(this.getTrack())),this._audioLevelFetcher.checkHasInput()},t.prototype.resetAudioLevelFetcher=function(){var e;null===(e=this._audioLevelFetcher)||void 0===e||e.reset()},t.prototype.updateAudioCaptureConfig=function(){var e;return r_(this,void 0,void 0,(function(){return i_(this,(function(t){switch(t.label){case 0:return this.audioCaptureConfig?(Pz.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}(Uz),Bz=function(e){function t(t,r){return e.call(this,t,r,"video")||this}return Of(t,e),t}(xz),jz=function(e){function t(t,r){return e.call(this,t,r,"audio")||this}return Of(t,e),t.prototype.getAudioLevel=function(){return this._audioLevelFetcher||(this._audioLevelFetcher=new rU(this.getTrack())),this._audioLevelFetcher.getAudioLevel()},t.prototype.resetAudioLevelFetcher=function(){var e;null===(e=this._audioLevelFetcher)||void 0===e||e.reset()},t}(xz),Gz=function(e){function t(t,r){return e.call(this,t,r)||this}return Of(t,e),t}(Fz),Hz=function(e){function t(t,r){return e.call(this,t,r)||this}return Of(t,e),t}(Vz),zz=function(e){function t(t,r){return e.call(this,t,r)||this}return Of(t,e),t}(Vz),Kz=function(e){function t(t,r){return e.call(this,t,r)||this}return Of(t,e),t}(Fz),Wz=function(e){function t(t,r){return e.call(this,t,r)||this}return Of(t,e),t}(Vz),Xz=function(e){function t(t,r){return e.call(this,t,r)||this}return Of(t,e),t}(Fz),qz=function(e){function t(t,r){var i=this,n=document.createElement("video"),o=document.createElement("canvas");n.setAttribute("style","display:none"),o.setAttribute("style","display:none"),n.setAttribute("muted",""),n.muted=!0,n.setAttribute("autoplay",""),n.autoplay=!0,n.setAttribute("playsinline","");var a=t.getSettings(),s=a.width,c=a.height,u=a.frameRate;o.width=s,o.height=c,document.body.append(n),document.body.append(o),n.srcObject=new MediaStream([t]),n.play();var d=o.getContext("2d");if(!d)throw new oG(Zj.UNEXPECTED_ERROR,"can not get canvas context");var l=o.captureStream(u).getVideoTracks()[0];return(i=e.call(this,l,r)||this)._originTrack=t,i._video=n,i._ctx=d,i._canvas=o,i._track=l,i._cancelLoop=function(e,t){var r=1/t,i=iU.getAudioContextInstance(),n=i.createGain();n.gain.value=0,n.connect(i.destination);var o=!1;return function t(){if(o)n=null;else{var a=i.createOscillator();a.onended=t,a.connect(n),a.start(0),a.stop(i.currentTime+r),e(i.currentTime)}}(),function(){o=!0}}((function(){return i.draw()}),u),i.__initListeners(),i}return Of(t,e),t.prototype.draw=function(){this._video.paused&&this._video.play(),this._video.videoWidth===this._canvas.width&&this._video.videoHeight===this._canvas.height||(this._canvas.width=this._video.videoWidth,this._canvas.height=this._video.videoHeight),this._ctx.drawImage(this._video,0,0,this._canvas.width,this._canvas.height),this._track.requestFrame&&this._track.requestFrame()},t.prototype.close=function(){var e,t;this._video.remove(),this._canvas.width=0,this._canvas.remove(),this._canvas=null,this._video=null,this._cancelLoop(),null===(e=this._originTrack)||void 0===e||e.stop(),this._originTrack=null,null===(t=this._track)||void 0===t||t.stop(),this._track=null},t.prototype.__initListeners=function(){var e=this;this._originTrack instanceof MediaStreamTrack&&this._originTrack.addEventListener("ended",(function(){var t;cj.rtcError("track-ended mediaType: ".concat(null===(t=e._originTrack)||void 0===t?void 0:t.kind),-1001),e.emit("track-ended",e)}))},t}(Vz);function Yz(e,t,r){var i,n;return r_(this,void 0,void 0,(function(){var o,a,s,c,u,d,l,h,p,f,_,v,m,y;return i_(this,(function(g){switch(g.label){case 0:Pz.print("createCameraAndMicrophoneTrack","videoConstraints:",e,"audioConstraints:",t,"audioProfileManager:",r),null===(i=null==t?void 0:t.deviceId)||void 0===i||i.exact,a=(null===(n=null==e?void 0:e.deviceId)||void 0===n?void 0:n.exact)||"default",c=(s=r||{}).sampleRate,u=s.channel,d=s.agc,l=s.ans,h=s.aec,void 0===t.sampleRate&&(t.sampleRate=c),void 0===t.channelCount&&(t.channelCount=u),void 0===t.autoGainControl&&(t.autoGainControl=d),void 0===t.noiseSuppression&&(t.noiseSuppression=l),void 0===t.echoCancellation&&(t.echoCancellation=h),g.label=1;case 1:return g.trys.push([1,3,,4]),cj.rtcVideoCaptureEvent({event_type:KB.START,media_device_id:a}),p=NU(),[4,Nz.getUserMedia({video:e,audio:t})];case 2:return o=g.sent(),cj.rtcVideoCaptureEvent({event_type:KB.START_CAPTURE_RESULT,media_device_id:a,reason:XB.SUCCESS,elapse:NU()-p}),[3,4];case 3:throw f=g.sent(),cj.rtcVideoCaptureEvent({event_type:KB.RUNNING_FAILED,media_device_id:a,error_code:f.code,reason:f.name+f.message}),new oG(Zj.GET_VIDEO_TRACK_FAILED,"throw error from getUserMedia",f);case 4:return _=o.getVideoTracks()[0],Dz.set(_,o),(v=new Hz(_,kU())).videoCaptureConfig=e,m=o.getAudioTracks()[0],Dz.set(m,o),y=new Gz(m,kU()),[2,{videoTrack:v,audioTrack:y}]}}))}))}function Jz(e){var t;return r_(this,void 0,void 0,(function(){var r,i,n,o,a,s;return i_(this,(function(c){switch(c.label){case 0:i=(null===(t=null==e?void 0:e.deviceId)||void 0===t?void 0:t.exact)||"default",c.label=1;case 1:return c.trys.push([1,3,,4]),Pz.print("createCameraVideoTrack","constraints:",e),cj.rtcVideoCaptureEvent({event_type:KB.START,media_device_id:i}),n=NU(),[4,Nz.getUserMedia({video:e})];case 2:return r=c.sent(),cj.rtcVideoCaptureEvent({event_type:KB.START_CAPTURE_RESULT,media_device_id:i,reason:XB.SUCCESS,elapse:NU()-n}),[3,4];case 3:throw o=c.sent(),cj.rtcVideoCaptureEvent({event_type:KB.RUNNING_FAILED,media_device_id:i,error_code:o.code,reason:o.name+o.message}),new oG(Zj.GET_VIDEO_TRACK_FAILED,"throw error from getUserMedia",o);case 4:return a=r.getVideoTracks()[0],Dz.set(a,r),(s=new Hz(a,kU())).videoCaptureConfig=e,[2,s]}}))}))}function Qz(e,t){var r;return r_(this,void 0,void 0,(function(){var i,n,o,a,s,c,u,d,l,h,p;return i_(this,(function(f){switch(f.label){case 0:Pz.print("createCameraVideoTrack","constraints:",e),n=(null===(r=null==e?void 0:e.deviceId)||void 0===r?void 0:r.exact)||"default",a=(o=t||{}).sampleRate,s=o.channel,c=o.agc,u=o.ans,d=o.aec,void 0===e.sampleRate&&(e.sampleRate=a),void 0===e.channelCount&&(e.channelCount=s),void 0===e.autoGainControl&&(e.autoGainControl=c),void 0===e.noiseSuppression&&(e.noiseSuppression=u),void 0===e.echoCancellation&&(e.echoCancellation=d),f.label=1;case 1:return f.trys.push([1,3,,4]),cj.rtcVideoCaptureEvent({event_type:KB.START,media_device_id:n}),l=NU(),[4,Nz.getUserMedia({audio:e})];case 2:return i=f.sent(),cj.rtcVideoCaptureEvent({event_type:KB.START_CAPTURE_RESULT,media_device_id:n,reason:XB.SUCCESS,elapse:NU()-l}),[3,4];case 3:throw h=f.sent(),cj.rtcVideoCaptureEvent({event_type:KB.RUNNING_FAILED,media_device_id:n,error_code:h.code,reason:h.name+h.message}),new oG(Zj.GET_AUDIO_TRACK_FAILED,"throw error from getUserMedia",h);case 4:return p=i.getAudioTracks()[0],Dz.set(p,i),[2,new Gz(p,kU())]}}))}))}function Zz(e,t){return void 0===e&&(e=!1),r_(this,void 0,void 0,(function(){var r,i,n;return i_(this,(function(o){switch(o.label){case 0:Pz.print("createScreenTracks","withAudio: %o, constraints: %o",e,t),o.label=1;case 1:return o.trys.push([1,3,,4]),cj.rtcVideoCaptureEvent({event_type:KB.START,media_device_id:"screen"}),i=NU(),[4,navigator.mediaDevices.getDisplayMedia({video:!(t&&(!xU||16!==BU))||t,audio:e})];case 2:return r=o.sent(),cj.rtcVideoCaptureEvent({event_type:KB.START_CAPTURE_RESULT,media_device_id:"screen",reason:XB.SUCCESS,elapse:NU()-i}),[3,4];case 3:throw n=o.sent(),cj.rtcVideoCaptureEvent({event_type:KB.RUNNING_FAILED,media_device_id:"screen",error_code:n.code,reason:n.name+n.message}),new oG(Zj.GET_SCREEN_TRACK_FAILED,"throw error from getDisplayMedia",n);case 4:return[2,r]}}))}))}var $z,eK=Fz;!function(e){e[e.NONE=0]="NONE"}($z||($z={}));var tK,rK,iK=function(){function e(){}return e.getNalunits=function(t){if(t.length-t.position<4)return[];var r=t.position;return 1===t.getInt32(r)||0===t.getInt16(r)&&1===t.getInt8(r+2)?e.getAnnexbNals(t):e.getAvccNals(t)},e.getAnnexbNals=function(t){for(var r=[],i=e.getHeaderPositionAnnexB(t),n=i.pos,o=n;n<t.length-4;){var a=new Uint8Array(t.buffer.slice(n,n+i.headerLength));i.pos===t.position&&t.skip(i.headerLength),o=(i=e.getHeaderPositionAnnexB(t)).pos;var s={header:a,body:new Uint8Array(t.buffer.slice(n+a.byteLength,o)),type:-1};e.analyseNal(s),s.type<=9&&0!==s.type&&r.push(s),t.skip(o-t.position),n=o}return r},e.getAvccNals=function(t){for(var r=[];t.position<t.length-4;){var i=t.getInt32(t.position);if(!(t.length-t.position>=i))break;var n=new Uint8Array(t.buffer.slice(t.position,t.position+4));t.skip(4);var o=new Uint8Array(t.buffer.slice(t.position,t.position+i));t.skip(i);var a={header:n,body:o,type:-1};e.analyseNal(a),a.type<=9&&0!==a.type&&r.push(a)}return r},e.analyseNal=function(e){var t=31&e.body[0];switch(e.type=t,t){case 1:e.ndr=!0;break;case 5:e.idr=!0;break;case 6:e.sei=!0;break;case 7:e.sps=!0;break;case 8:e.pps=!0}},e.getHeaderPositionAnnexB=function(e){for(var t=e.position,r=0,i=e.length;3!==r&&4!==r&&t<i-4;)0===e.getInt16(t)?1===e.getInt16(t+2)?r=4:1===e.getInt8(t+2)?r=3:t++:t++;return t===i-4&&(0===e.getInt16(t)?1===e.getInt16(t+2)?r=4:t=i:(t++,0===e.getInt16(t)&&1===e.getInt8(t)?r=3:t=i)),{pos:t,headerLength:r}},e.getAvcc=function(e,t){var r=new Uint8Array(e.byteLength+t.byteLength+11);r[0]=1,r[1]=e[1],r[2]=e[2],r[3]=e[3],r[4]=255,r[5]=225;var i=6;return r.set(new Uint8Array([e.byteLength>>>8&255,255&e.byteLength]),i),i+=2,r.set(e,i),r[i+=e.byteLength]=1,i++,r.set(new Uint8Array([t.byteLength>>>8&255,255&t.byteLength]),i),i+=2,r.set(t,i),r},e}(),nK=function(){function e(e){this._position=0,this._dataview=new DataView(e)}return Object.defineProperty(e.prototype,"length",{get:function(){return this.buffer.byteLength},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"buffer",{get:function(){return this._dataview.buffer},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"position",{get:function(){return this._position},set:function(e){this._position=e},enumerable:!1,configurable:!0}),e.prototype.back=function(e){this.position-=e},e.prototype.getUint8=function(e){return this._dataview.getUint8(e)},e.prototype.getInt8=function(e){return this._dataview.getInt8(e)},e.prototype.getInt16=function(e){return this._dataview.getInt16(e)},e.prototype.getUint16=function(e){return this._dataview.getUint16(e)},e.prototype.getUint32=function(e){return this._dataview.getUint32(e)},e.prototype.getInt32=function(e){return this._dataview.getInt32(e)},e.prototype.skip=function(t){for(var r=Math.floor(t/4),i=t%4,n=0;n<r;n++)e.readByte(this,4);i>0&&e.readByte(this,i)},e.readByte=function(e,t,r){var i;switch(t){case 1:i=r?e.getInt8(e.position):e.getUint8(e.position);break;case 2:i=r?e.getInt16(e.position):e.getUint16(e.position);break;case 3:if(r)throw new Error("not supported for readByte 3");i=e.getUint8(e.position)<<16,i|=e.getUint8(e.position+1)<<8,i|=e.getUint8(e.position+2);break;case 4:i=r?e.getInt32(e.position):e.getUint32(e.position);break;case 8:if(r)throw new Error("not supported for readBody 8");i=e.getUint32(e.position)<<32,i|=e.getUint32(e.position+4);break;default:i=""}return e.position+=t,i},e.prototype.readUint8=function(){return e.readByte(this,1)},e.prototype.readUint16=function(){return e.readByte(this,2)},e.prototype.readUint24=function(){return e.readByte(this,3)},e.prototype.readUint32=function(){return e.readByte(this,4)},e.prototype.readUint64=function(){return e.readByte(this,8)},e.prototype.readInt8=function(){return e.readByte(this,1,!0)},e.prototype.readInt16=function(){return e.readByte(this,2,!0)},e.prototype.readInt32=function(){return e.readByte(this,4,!0)},e.prototype.writeUint32=function(e){return new Uint8Array([e>>>24&255,e>>>16&255,e>>>8&255,255&e])},e}();!function(e){e[e.internal=0]="internal",e[e.external=1]="external",e[e.bypass=2]="bypass"}(tK||(tK={})),function(e){e[e.invalid=0]="invalid",e[e.cfgResolution=1]="cfgResolution",e[e.bitstreamHash=2]="bitstreamHash",e[e.screenCodec=3]="screenCodec"}(rK||(rK={}));var oK=new Uint8Array([109,167,53,190,103,90,72,1,170,89,63,164,194,199,19,85]),aK=new Uint8Array([109,167,53,190,103,90,72,1,170,89,63,164,194,199,19,84]);function sK(e){for(var t=[];e>=255;)e-=255,t.push(255);return t.push(e),new Uint8Array(t)}function cK(e,t){void 0===t&&(t=0);for(var r=0;255===e[t]&&t<e.byteLength;)t++,r+=255;return t<e.byteLength&&(r+=e[t++]),[r,t]}var uK=function(){function e(){}return e.generateSEI=function(e,t){void 0===t&&(t=!1);var r=new Uint8Array([0,0,0,1]),i=new Uint8Array([6]),n=new Uint8Array([5]),o=t?oK:aK,a=sK(e.byteLength+o.byteLength),s=function(e){for(var t=[],r=0;r<e.length;r++)e[r]<=3&&0===e[r-1]&&0===e[r-2]&&t.push(3),t.push(e[r]);return new Uint8Array(t)}(e);return new Uint8Array(a_(a_(a_(a_(a_(a_(a_([],o_(r),!1),o_(i),!1),o_(n),!1),o_(a),!1),o_(o),!1),o_(s),!1),[128],!1))},e.decodeSeiBody=function(e){var t=function(e){for(var t=[],r=0;r<e.length;r++)e[r]<=3&&0===e[r-1]&&0===e[r-2]||t.push(e[r]);return new Uint8Array(t)}(e=e.slice(0,e.length-1));if(!(t.byteLength<2)){var r=0;if(5===t[1]||100===t[1]){var i=o_(cK(t,r+=2),2),n=i[0];r=i[1];var o=tK.bypass,a=r+n;return t.byteLength>=aK.byteLength&&n>=aK.byteLength&&t.slice(r,r+aK.byteLength).toString()===aK.toString()?(r+=aK.byteLength,o=tK.external):t.byteLength>=aK.byteLength&&n>=aK.byteLength&&t.slice(r,r+oK.byteLength).toString()===oK.toString()&&(r+=oK.byteLength,o=tK.internal),{type:o,payload:t.slice(r,a)}}}},e.parseInternalSEI=function(e){var t=new Map,r=0;if(e.type===tK.internal){for(;e.payload.byteLength-r>=2;){var i=o_(cK(e.payload,r),2),n=i[0];r=i[1];var o=o_(cK(e.payload,r),2),a=o[0];if(r=o[1],t.get(n)||!(a<e.payload.byteLength-r))break;t.set(n,e.payload.slice(r,r+a))}return t}},e.makeInternalSei=function(e){var t,r,i=[];try{for(var n=n_(e),o=n.next();!o.done;o=n.next()){var a=o_(o.value,2),s=a[0],c=a[1],u=sK(s),d=sK(c.byteLength);i.push(u,d,c)}}catch(e){t={error:e}}finally{try{o&&!o.done&&(r=n.return)&&r.call(n)}finally{if(t)throw t.error}}var l=i.reduce((function(e,t){return e+t.byteLength}),0),h=new Uint8Array(l);return i.reduce((function(e,t){return h.set(t,e),e+t.byteLength}),0),h},e}();Xi({target:"Number",stat:!0},{isNaN:function(e){return e!=e}}),new rj("Stats",2);var dK,lK,hK,pK,fK,_K,vK=function(){function e(e){this._stream=e}return e.prototype.setVar=function(e,t,r){this.client=e,this.handler=t,this.monitor=r},e.prototype.delStatsEvtInterval=function(){clearTimeout(this._timer),this._timer=void 0},e.prototype.destroy=function(){this.delStatsEvtInterval()},e}(),mK=function(e){function t(t){var r=e.call(this,t)||this;return r._stream=t,r}return Of(t,e),t.prototype.setLocalStreamStatsEvtInterval=function(e,t,r){var i,n,o=this;if(!this._timer){this.setVar(e,t,r),e.once(FG.ABNORMAL_DISCONNECTION,(function(){o.destroy()}));var a={audio:{},video:{}},s=this._stream,c=null===(i=s.audioTrack)||void 0===i?void 0:i.getTrack(),u=null===(n=s.videoTrack)||void 0===n?void 0:n.getTrack();this.getAudioStats(c,a),this.getVideoStats(u,a),this.delStatsEvtInterval();this._timer&&clearTimeout(this._timer),this._timer=setTimeout((function e(){return r_(o,void 0,void 0,(function(){var t,r;return i_(this,(function(i){switch(i.label){case 0:return[4,r_(o,void 0,void 0,(function(){var e,t,r,i,n,o;return i_(this,(function(c){switch(c.label){case 0:return e=null===(n=s.audioTrack)||void 0===n?void 0:n.getTrack(),t=null===(o=s.videoTrack)||void 0===o?void 0:o.getTrack(),[4,this.getAudioStats(e,a)];case 1:return r=c.sent(),[4,this.getVideoStats(t,a)];case 2:return i=c.sent(),[2,{audioStats:r,videoStats:i,isScreen:s.isScreen}]}}))}))];case 1:return t=i.sent(),null===(r=this.client)||void 0===r||r.emit("onLocalStreamStats",t),this._timer&&clearTimeout(this._timer),this._timer=setTimeout(e,2e3),[2]}}))}))}),2e3)}},t.prototype.unpublish=function(){this.delStatsEvtInterval()},t.prototype.getAudioStats=function(e,t){return r_(this,void 0,void 0,(function(){var r,i,n,o,a,s,c,u,d,l;return i_(this,(function(h){switch(h.label){case 0:return r={},i={timestamp:Date.now()},n=this._stream,o=n.streamId,a=n.audioMid,s=n.isScreen,c=n.pubAttributes,u={media_type:"audio",is_screen:!!s,direction:"up",stream_id:o,vid:a,connection_status:navigator.onLine,track_enabled:null==e?void 0:e.enabled,capture_state:c.localaudio?"capture_state_on":"capture_state_off"},e&&this.handler?[4,this.handler.getStats(e)]:[2,r];case 1:return(d=h.sent()).length?(d.forEach((function(e){var t=e.type,n=e.packetsSent,o=e.packetsLost,a=e.bytesSent,s=e.clockRate,c=e.roundTripTime,d=e.channels,l=e.audioLevel,h=e.googRtt,p=e.mimeType,f=e.availableIncomingBitrate,_=e.availableOutgoingBitrate,v=e.bytesReceived,m=e.nominated,y=e.id,g=e.currentRoundTripTime,S=e.state,E=e.writable,b=e.requestsReceived,I=e.responsesReceived,T=e.requestsSent,A=e.consentRequestsSent,R=e.responsesSent,C=e.jitter,O=e.candidateType,w=e.ip,k=e.address,N=e.networkType,P=e.port,D=e.protocol,M=e.nackCount,L=e.retransmittedBytesSent,U=e.retransmittedPacketsSent,x=e.roundTripTimeMeasurements,V=e.audioInputLevel,F=e.ssrc,B=e.totalAudioEnergy,j=e.totalSamplesDuration,G=e.mediaType,H=e.fractionLost;"outbound-rtp"===t?(i.packetsSent=n,i.bytesSent=a,u.bytes=a,u.packetsSent=n,u.nackCount=M,u.ssrc=F,u.retransmitted_bytes_sent=L,u.retransmitted_packets_sent=U,i.retransmittedPacketsSent=U):"remote-inbound-rtp"===t?(i.packetsLost=o,u.packetsLost=o,u.jitter=1e3*C,r.rtt=1e3*c,u.rtt=r.rtt,u.round_trip_time_measurements=x,r._fractionLost=H||0):"codec"===t?(r.recordSampleRate=s,r.numChannels=d,u.codecName=p):"media-source"===t?(u.audio_level=l?-10*Math.log10(Math.pow(l,2)):l,u.volume=255*l,u.total_audio_energy=B,u.total_samples_duration=j):"ssrc"===t&&"audio"===G?(u.audio_network_elapse=h,u.send_level=V):"candidate-pair"===t?(u.ice_available_incoming_bitrate=f,u.ice_available_outgoing_bitrate=_,u.ice_bytes_received=v,u.ice_bytes_sent=a,u.ice_nominated=+m,u.ice_pair_id=y,u.ice_pair_rtt=g,u.ice_pair_state=S,u.ice_pair_writable=E,u.recv_ping_requests=b,u.recv_ping_responses=I,u.sent_ping_requests_before_first_response=T,u.sent_ping_requests_total=T+(A||0),u.sent_ping_responses=R):"local-candidate"===t?(u.local_candidate_type=O,u.local_ip=w||k,u.local_network_type=N,u.local_port=P,u.protocol=D):"remote-candidate"===t&&(u.remote_candidate_type=O,u.remote_ip=w||k,u.remote_port=P),ox||"media-source"===t&&(u.send_level=l)})),(l=t.audio).timestamp?(void 0!==i.packetsLost&&(r.audioLossRate=(i.packetsLost-l.packetsLost)/(i.packetsSent-l.packetsSent),r.audioLossRate=Number.isNaN(r.audioLossRate)?0:r.audioLossRate,u.fraction_lost=r.audioLossRate),r.statsInterval=i.timestamp-l.timestamp,u.stats_interval=r.statsInterval,r.sendKBitrate=(i.bytesSent-l.bytesSent||0)/r.statsInterval*8,u.bitrate=Math.round(1e3*r.sendKBitrate),u.bandwidth=Math.round(u.bitrate/1024),t.audio=i,u.total_audio_play_energy=this._stream.getRecordAudioEnergy(),this.monitor.rtcMediaStatistics(u,{}),r._retransmittedRate=(i.retransmittedPacketsSent-l.retransmittedPacketsSent)/(i.packetsSent-l.packetsSent),r._fractionLost=Math.max(r._fractionLost,r.audioLossRate),[2,r]):(t.audio=i,[2,r])):[2,r]}}))}))},t.prototype.getVideoStats=function(e,t){return r_(this,void 0,void 0,(function(){var r,i,n,o,a,s,c,u,d,l,h,p,f,_,v;return i_(this,(function(m){switch(m.label){case 0:return r={},i={timestamp:Date.now(),simulcast:{}},n=this._stream,o=n.streamId,a=n.videoMid,s=n.isScreen,c=n.pubAttributes,u=n.enableSimulcast,l=[{media_type:"video",is_screen:!!s,direction:"up",stream_id:o,vid:a,connection_status:navigator.onLine,track_enabled:null==e?void 0:e.enabled,capture_state:c.localvideo?"capture_state_on":"capture_state_off"}],[4,this._stream.requestVideoFrameCallback()];case 1:return d=e_.apply(void 0,l.concat([m.sent()])),e&&this.handler?(r.isScreen=s,[4,this.handler.getStats(e)]):[2,r];case 2:return(h=m.sent()).length?(p=0,h.forEach((function(n){var o=n.type,a=n.framesEncoded,s=n.packetsLost,c=n.bytesSent,l=n.framesSent,h=n.roundTripTime,f=n.mimeType,_=n.frameWidth,v=n.frameHeight,m=n.packetsSent,y=n.googActualEncBitrate,g=n.googAvailableReceiveBandwidth,S=n.googAvailableSendBandwidth,E=n.googAvgEncodeMs,b=n.googBucketDelay,I=n.googEncodeUsagePercent,T=n.googFrameRateInput,A=n.availableIncomingBitrate,R=n.availableOutgoingBitrate,C=n.bytesReceived,O=n.nominated,w=n.id,k=n.currentRoundTripTime,N=n.state,P=n.writable,D=n.candidateType,M=n.ip,L=n.address,U=n.networkType,x=n.port,V=n.nackCount,F=n.pliCount,B=n.protocol,j=n.qpSum,G=n.requestsReceived,H=n.responsesReceived,z=n.googRetransmitBitrate,K=n.requestsSent,W=n.consentRequestsSent,X=n.responsesSent,q=n.ssrc,Y=n.googTargetEncBitrate,J=n.googTransmitBitrate,Q=n.googRtt,Z=n.retransmittedPacketsSent,$=n.encoderImplementation,ee=n.jitter,te=n.rid,re=n.fractionLost,ie=n.keyFramesEncoded,ne=n.retransmittedBytesSent,oe=n.totalPacketSendDelay,ae=n.totalEncodeTime;n.getsetting,n.framesPerSecond;var se=n.firCount,ce=n.qualityLimitationReason,ue=n.targetBitrate;if("outbound-rtp"===o?(u&&(te?i.simulcast[te]=n:i.simulcast[p]=n,p++),i.framesEncoded=a||i.framesEncoded,d.key_frames_encoded=ie||0,i.bytesSent=c||i.bytesSent,i.framesSent=l||i.framesSent,d.bytes=c||d.bytes,i.packetsSent=m||i.packetsSent,i.retransmittedBytesSent=ne,d.packetsSent=m||d.packetsSent,d.nackCount=V||d.nackCount,d.pli_count=F||d.pli_count,d.qp_sum=j||d.qp_sum,d.ssrc=q||d.ssrc,d.retransmitted_packets_sent=Z,i.retransmittedPacketsSent=Z,d.encoder_implementation=$):"track"===o?(r.encodedFrameWidth=_,r.encodedFrameHeight=v,d.frame_size_height=v,d.frame_size_width=_):"remote-inbound-rtp"===o?(i.packetsLost=s,r.rtt=1e3*h,d.rtt=r.rtt,d.jitter=ee,d.packetsLost=s,r._fractionLost=re||0):"codec"===o?(r.codecType=f,d.codecName=f):"candidate-pair"===o?(d.ice_available_incoming_bitrate=A,d.ice_available_outgoing_bitrate=R,d.ice_bytes_received=C,d.ice_bytes_sent=c,d.ice_nominated=+O,d.ice_pair_id=w,d.ice_pair_rtt=k,d.ice_pair_state=N,d.ice_pair_writable=P,d.recv_ping_requests=G,d.recv_ping_responses=H,d.sent_ping_requests_before_first_response=K,d.sent_ping_requests_total=K+W,d.sent_ping_responses=X):"local-candidate"===o?(d.local_candidate_type=D,d.local_ip=M||L,d.local_network_type=U,d.local_port=x,d.protocol=B):"remote-candidate"===o?(d.remote_candidate_type=D,d.remote_ip=M||L,d.remote_port=x):"VideoBwe"===o?(d.encBitratebps=y,d.available_receive_bandwidth=g,d.available_send_bandwidth=S,d.bucket_delay=b,d.retransmitBitratebps=z,d.targetEncBitratebps=Y,d.transmit_bitrate=J,r._sendBandWidth=+S):"ssrc"===o&&(d.video_network_elapse=Q,d.avg_encode_ms=E,d.encodeUsage=I,d.frame_rate_input=T,d.orignal_input_Framerate=+T),!ox){var de=t.video,le=i.timestamp-de.timestamp;if("outbound-rtp"===o){var he=c-de.bytesSent,pe=ne-de.retransmittedBytesSent;d.encBitratebps=Math.round(8e3*(he-pe)/le),d.bucket_delay=oe/m,d.retransmitBitratebps=Math.round(8e3*pe/le),d.targetEncBitratebps=ue,d.transmit_bitrate=Math.round(1e3*(c-de.bytesSent)*8/le),d.avg_encode_ms=1e3*ae/a,d.firsReceived=se+F,d.qualityLimitationReason="bandwidth"===ce,d.qualityLimitationDurations="cpu"===ce}else"candidate-pair"===o&&(d.available_send_bandwidth=R,r._sendBandWidth=R);if(e){var fe=null==e?void 0:e.getSettings().frameRate;d.orignal_input_Framerate=fe,d.frameRateSent=e.getSettings().frameRate}}})),(f=t.video).timestamp?(r.statsInterval=i.timestamp-f.timestamp,d.stats_interval=r.statsInterval,_=Object.keys(i.simulcast),u?(d.sim_enc_width=[],d.sim_enc_height=[],d.sim_enc_bps=[],d.sim_enc_framerate=[],d.sim_enc_key_frames=[],d.sim_rids=[],d.sim_enc_bandwidth=[],d.sim_sent_framerate=[],d.sim_fraction_lost=[],v=!1,_.sort((function(e,t){return+e-+t})).forEach((function(e){var t=i.simulcast[e],n=t.frameWidth,o=t.frameHeight,a=t.bytesSent,s=t.framesEncoded,c=t.framesSent,u=t.packetsLost,l=t.packetsSent,h=t.qualityLimitationReason,p=t.qualityLimitationDurations,_=t.qualityLimitationResolutionChanges,m=t.retransmittedPacketsSent,y=t.keyFramesEncoded;void 0!==h&&(d.sim_qualityLimitationReason||(d.sim_qualityLimitationReason=[],d.sim_qualityLimitationDurations=[],d.sim_qualityLimitationResolutionChanges=[]),d.sim_qualityLimitationReason.push(h),d.sim_qualityLimitationDurations.push(p),d.sim_qualityLimitationResolutionChanges.push(_));var g=f.simulcast[e];if(d.sim_enc_width.push(n||0),d.sim_enc_height.push(o||0),d.sim_enc_key_frames.push(y||0),g){var S=(a-g.bytesSent||0)/r.statsInterval;d.sim_enc_bps.push(Math.round(8e3*S)),d.sim_enc_bandwidth.push(Math.round(8e3*S/1024));var E=1e3*(s-g.framesEncoded)/r.statsInterval;d.sim_enc_framerate.push(Math.round(E)),d.sim_rids.push(e);var b=void 0!==c?c-g.framesSent:s-g.framesEncoded,I=1e3*b/r.statsInterval;d.sim_sent_framerate.push(Math.round(I));var T=(u-g.packetsLost)/(l-g.packetsSent);r._retransmittedRate=(m-g.retransmittedPacketsSent)/(l-g.packetsSent),T=Number.isNaN(T)?0:T,d.sim_fraction_lost.push(T),n>0&&!v&&(r.sentKBitrate=8*S,r.encoderOutputFrameRate=E,r.encodedFrameCount=b,r.sentFrameRate=I,r.videoLossRate=T,v=!0)}})),this.monitor.rtcMediaStatistics(d,{})):(r.encodedFrameCount=void 0!==i.framesSent?i.framesSent-f.framesSent:i.framesEncoded-f.framesEncoded,r.sentKBitrate=(i.bytesSent-f.bytesSent||0)/r.statsInterval*8,d.bitrate=Math.round(1e3*r.sentKBitrate),d.bandwidth=Math.round(d.bitrate/1024),r.encoderOutputFrameRate=1e3*(i.framesEncoded-f.framesEncoded)/r.statsInterval,d.frame_rate_encoded=Math.round(r.encoderOutputFrameRate),r.sentFrameRate=1e3*r.encodedFrameCount/r.statsInterval,d.frame_rate_sent=Math.round(r.sentFrameRate),r.videoLossRate=(i.packetsLost-f.packetsLost)/(i.packetsSent-f.packetsSent),r.videoLossRate=Number.isNaN(r.videoLossRate)?0:r.videoLossRate,d.fraction_lost=r.videoLossRate,r._retransmittedRate=(i.retransmittedPacketsSent-f.retransmittedPacketsSent)/(i.packetsSent-f.packetsSent),this.monitor.rtcMediaStatistics(d,{})),t.video=i,r._fractionLost=Math.max(r._fractionLost,r.videoLossRate),[2,r]):(t.video=i,[2,r])):[2,r]}}))}))},t}(vK),yK=function(e){function t(t){var r=e.call(this,t)||this;return r._videoInWaiting=!1,r}return Of(t,e),Object.defineProperty(t,"audioStallConfig",{set:function(e){t.audioStallInterval=((null==e?void 0:e.audio_stall_interval)||200)/2,t.audioStallRatio=null==e?void 0:e.audio_stall_ratio},enumerable:!1,configurable:!0}),t.prototype.setRemoteStreamStatsEvtInterval=function(e,r,i){var n,o;return r_(this,void 0,void 0,(function(){var a,s,c,u,d,l,h,p,f,_,v,m=this;return i_(this,(function(y){switch(y.label){case 0:return this._timer?[2]:(this.setVar(e,r,i),e.once(FG.ABNORMAL_DISCONNECTION,(function(){m.destroy()})),this._audioStallInterval=-100,this._audioStallRatio=t.audioStallRatio||.6,a={audio:{},video:{}},s=this._stream,c=null===(n=s.audioTrack)||void 0===n?void 0:n.getTrack(),u=null===(o=s.videoTrack)||void 0===o?void 0:o.getTrack(),this.getRemoteVideoStats(u,a),[4,this.getRemoteAudioStats(c,a)]);case 1:return y.sent(),this.delStatsEvtInterval(),d=0,l=0,p=[],f=0,this._setAudioStallCount=function(){if(m._audioStallInterval>0&&void 0!==a.audio.concealedSamples){var e=a.audio.concealedSamples,t=a.audio.totalSamplesReceived,r=NU(),i={isStall:!1,counted:!1,diff:0},n=.5*m._audioStallInterval;m._audioStallCount=function(){return r_(m,void 0,void 0,(function(){var o,a,c,u,h,_,v,m,y,g,S,E,b,I,T;return i_(this,(function(A){switch(A.label){case 0:return o=s.hasAudio,a=s.subAudio,o&&a?(c=null===(T=s.audioTrack)||void 0===T?void 0:T.getTrack(),u=Date.now(),[4,this.handler.getStats(c,!0)]):(i.isStall=!1,i.counted=!1,p.push({reason:"hasAudio: ".concat(o,", subAudio: ").concat(a)}),[2,{stall_count:d,stall_duration:l,stall_list:p,stats_count:f}]);case 1:return h=A.sent(),_=Date.now(),v=NU(),(m=v-r)<n?(p.push({diff:m,start:r,end:v,get_stats_cost:_-u,get_stats_start:u,get_stats_end:_,reason:"diff(".concat(m,") < minInterval(").concat(n,")")}),[2,{stall_count:d,stall_duration:l,stall_list:p,stats_count:f}]):(y=h.length,g=h.find((function(e){return"inbound-rtp"===e.type})),g?(S=g.concealedSamples,E=g.totalSamplesReceived,I=E-t,(b=S-e)>=0&&I>=0&&b>=this._audioStallRatio*I?(p.push({concealed:b,received:I,diff:m,start:r,end:v,get_stats_cost:_-u,get_stats_start:u,get_stats_end:_,is_stall:!0}),i.isStall?(i.counted?l+=m:(l=l+i.diff+m,d++),i.counted=!0):m>=200?(l+=m,d++,i.counted=!0):(i.counted=!1,i.diff=m),i.isStall=!0):(p.push({concealed:b,received:I,diff:m,start:r,end:v,get_stats_cost:_-u,get_stats_start:u,get_stats_end:_}),i.isStall=!1,i.counted=!1),e=S,t=E,r=v,f++,[2,{stall_count:d,stall_duration:l,stall_list:p,stats_count:f}]):(p.push({diff:m,start:r,end:v,get_stats_cost:_-u,get_stats_start:u,get_stats_end:_,reason:y?"no inbound-rtp":"no report"}),[2,{stall_count:d,stall_duration:l,stall_list:p,stats_count:f}]))}}))}))},h=function(){return r_(m,void 0,void 0,(function(){return i_(this,(function(e){switch(e.label){case 0:return console.log("=================== stallLoop"),!this._audioStallCount&&this._setAudioStallCount&&this._setAudioStallCount(),this._audioStallCount?[4,this._audioStallCount()]:[3,2];case 1:e.sent(),this._audioStallTimer&&clearTimeout(this._audioStallTimer),this._audioStallTimer=setTimeout(h,this._audioStallInterval),e.label=2;case 2:return[2]}}))}))},m._audioStallTimer&&clearTimeout(m._audioStallTimer),m._audioStallTimer=setTimeout(h,m._audioStallInterval)}},this._setAudioStallCount(),_=function(){return r_(m,void 0,void 0,(function(){var e,t,r,i,n,o;return i_(this,(function(c){switch(c.label){case 0:return e=null===(n=s.audioTrack)||void 0===n?void 0:n.getTrack(),t=null===(o=s.videoTrack)||void 0===o?void 0:o.getTrack(),[4,this.getRemoteAudioStats(e,a)];case 1:return r=c.sent(),d=0,l=0,p=[],f=0,[4,this.getRemoteVideoStats(t,a)];case 2:return i=c.sent(),[2,{audioStats:r,videoStats:i,isScreen:s.isScreen,userId:s.userId}]}}))}))},v=function(){return r_(m,void 0,void 0,(function(){var e,t;return i_(this,(function(r){switch(r.label){case 0:return[4,_()];case 1:return e=r.sent(),null===(t=this.client)||void 0===t||t.emit("onRemoteStreamStats",e),h&&(this._audioStallTimer&&clearTimeout(this._audioStallTimer),this._audioStallTimer=setTimeout(h,this._audioStallInterval)),this._timer&&clearTimeout(this._timer),this._timer=setTimeout(v,2e3),[2]}}))}))},this._timer&&clearTimeout(this._timer),this._timer=setTimeout(v,2e3),[2]}}))}))},t.prototype.delStatsEvtInterval=function(){e.prototype.delStatsEvtInterval.call(this),clearTimeout(this._audioStallTimer),this._audioStallCount=void 0,this._setAudioStallCount=void 0},t.prototype.unsubscribe=function(){this.delStatsEvtInterval(),this._videoInWaiting=!1},t.prototype.getRemoteAudioStats=function(e,t){return r_(this,void 0,void 0,(function(){var r,i,n,o,a,s,c,u,d,l,h,p,f,_,v,m,y,g;return i_(this,(function(S){switch(S.label){case 0:return r={},i={},n=this._stream,o=n.streamId,a=n.userId,s=n.isScreen,c=n.audioMid,u=n.subMediaType,d=n._attributes,l={media_type:"audio",is_screen:!!s,direction:"down",stream_id:o,stream_user_id:a,vid:c,track_enabled:null==e?void 0:e.enabled,connection_status:navigator.onLine,mute_state:ex(u)?"mute_state_off":"mute_state_on",remote_user_capture_state:d.localaudio?"capture_state_on":"capture_state_off",remote_user_mute_state:d.localaudio&&d.audiostream?"mute_state_off":"mute_state_on"},e&&this.handler?[4,this.handler.getStats(e)]:[2,r];case 1:return(h=S.sent()).length?(h.forEach((function(e){var t=e.type,n=e.packetsLost,o=e.packetsReceived,a=e.bytesReceived,s=e.jitterBufferDelay,c=e.jitterBufferEmittedCount,u=e.clockRate,d=e.channels,h=e.totalSamplesReceived,p=e.concealedSamples,f=e.silentConcealedSamples,_=e.concealmentEvents,v=e.totalRoundTripTime,m=e.state,y=e.currentRoundTripTime,g=e.audioLevel,S=e.totalAudioEnergy,E=e.totalSamplesDuration,b=e.mimeType,I=e.googDecodingNormal,T=e.googDecodingMuted,A=e.fecPacketsReceived,R=e.availableIncomingBitrate,C=e.availableOutgoingBitrate,O=e.bytesSent,w=e.nominated,k=e.id,N=e.writable,P=e.jitter,D=e.candidateType,M=e.ip,L=e.address,U=e.networkType,x=e.port,V=e.protocol,F=e.audioOutputLevel,B=e.requestsReceived,j=e.responsesReceived,G=e.requestsSent,H=e.consentRequestsSent,z=e.responsesSent,K=e.ssrc,W=e.kind;"inbound-rtp"===t?(i.packetsLost=n,i.packetsReceived=o,l.packetsReceived=o,i.bytesReceived=a,l.bytes=a,void 0!==s&&(r.jitterBufferDelay=s/c*1e3,l.average_jitter_buffer_delay_ms=r.jitterBufferDelay),void 0!==h&&(i.totalSamplesReceived=h,r.concealedSamples=p,i.concealedSamples=p,i.silentConcealedSamples=f,l.concealedSamples=p,r.concealmentEvents=_,l.totalSamplesReceived=h),void 0!==A&&(l.fec_packets_received=A),l.jitter=1e3*P,l.ssrc=K,void 0!==g&&(l.audio_level=g?-10*Math.log10(Math.pow(g,2)):g),void 0!==g&&(l.volume=255*g),void 0!==S&&(l.total_audio_energy=S),void 0!==E&&(l.totalAudioDuration=E)):"codec"===t?(r.recordSampleRate=u,d&&(r.numChannels=d),l.codecName=b):"candidate-pair"===t?(l.ice_available_incoming_bitrate=R,l.ice_available_outgoing_bitrate=C,l.ice_bytes_received=a,l.ice_bytes_sent=O,l.ice_nominated=+w,l.ice_pair_id=k,l.ice_pair_rtt=y,l.rtt=1e3*y,l.ice_pair_state=m,l.ice_pair_writable=N,l.recv_ping_requests=B,l.recv_ping_responses=j,l.sent_ping_requests_before_first_response=G,l.sent_ping_requests_total=G+(H||0),l.sent_ping_responses=z,"succeeded"===m&&(r.rtt=1e3*y,r.total_rtt=1e3*v)):"track"===t&&"audio"===W?(l.audio_level=g?-10*Math.log10(Math.pow(g,2)):g,l.volume=255*g,l.total_audio_energy=S,l.totalAudioDuration=E):"ssrc"===t?(l.decodingNormal=I,l.recvAudioLevel=F,l.decodingMuted=T):"local-candidate"===t?(l.local_candidate_type=D,l.local_ip=M||L,l.local_network_type=U,l.local_port=x,l.protocol=V):"remote-candidate"===t&&(l.remote_candidate_type=D,l.remote_ip=M||L,l.remote_port=x)})),(p=t.audio).timestamp?(f={},void 0!==i.concealedSamples&&(l.interval_concealed_samples=i.concealedSamples-p.concealedSamples,l.interval_samples_received=i.totalSamplesReceived-p.totalSamplesReceived,l.interval_silent_concealed_samples=i.silentConcealedSamples-p.silentConcealedSamples),this._audioStallInterval>0&&void 0!==p.concealedSamples?(!this._audioStallCount&&this._setAudioStallCount&&this._setAudioStallCount(),clearTimeout(this._audioStallTimer),this._audioStallCount?[4,this._audioStallCount()]:[3,3]):[3,3]):(i.timestamp=Date.now(),t.audio=i,[2,r])):[2,r];case 2:_=S.sent(),v=_.stall_count,m=_.stall_duration,y=_.stall_list,g=_.stats_count,f.stall_list=y,f.stats_count=g,l.concealedSamples===l.interval_concealed_samples&&l.totalSamplesReceived===l.interval_samples_received?(l.stall_count=0,l.stall_duration=0):(l.stall_count=v,l.stall_duration=m),r.stallCount=l.stall_count,r.stallDuration=l.stall_duration,S.label=3;case 3:return i.timestamp=Date.now(),r.audioLossRate=(i.packetsLost-p.packetsLost)/(i.packetsReceived-p.packetsReceived+(i.packetsLost-p.packetsLost)),r.audioLossRate=Number.isNaN(r.audioLossRate)?0:r.audioLossRate,l.packetsLost=Math.round(i.packetsLost-p.packetsLost),l.fraction_lost=r.audioLossRate,l.packets_lost_rate=r.audioLossRate,r.statsInterval=i.timestamp-p.timestamp,l.stats_interval=r.statsInterval,r.receivedKBitrate=(i.bytesReceived-p.bytesReceived||0)/r.statsInterval*8,l.bitrate=Math.round(1e3*r.receivedKBitrate),l.bandwidth=Math.round(l.bitrate/1024),void 0!==i.concealedSamples&&(r.receivedSampleRate=1e3*l.interval_samples_received/r.statsInterval),t.audio=i,l.total_audio_play_energy=this._stream.getRecordAudioEnergy(),this.monitor.rtcMediaStatistics(l,{},f),[2,r]}}))}))},t.prototype.getRemoteVideoStats=function(e,t){return r_(this,void 0,void 0,(function(){var r,i,n,o,a,s,c,u,d,l,h,p;return i_(this,(function(f){switch(f.label){case 0:return r={},i={timestamp:Date.now()},n=this._stream,o=n.streamId,a=n.userId,s=n.isScreen,c=n.subMediaType,u=n._attributes,l=[{media_type:"video",is_screen:!!s,direction:"down",stream_id:o,stream_user_id:a,vid:this._stream.videoMid,connection_status:navigator.onLine,track_enabled:null==e?void 0:e.enabled,mute_state:tx(c)?"mute_state_off":"mute_state_on",remote_user_capture_state:u.localvideo?"capture_state_on":"capture_state_off",remote_user_mute_state:u.localvideo&&u.videostream?"mute_state_off":"mute_state_on"}],[4,this._stream.requestVideoFrameCallback()];case 1:return d=e_.apply(void 0,l.concat([f.sent()])),e&&this.handler?(r.isScreen=s,[4,this.handler.getStats(e)]):[2,r];case 2:return(h=f.sent()).length?(h.forEach((function(e){var t=e.type,n=e.frameHeight,o=e.frameWidth,a=e.packetsLost,s=e.packetsReceived,c=e.bytesReceived,u=e.framesDecoded,l=e.jitterBufferDelay,h=e.jitterBufferEmittedCount,p=e.mimeType,f=e.firCount,_=e.availableIncomingBitrate,v=e.availableOutgoingBitrate,m=e.bytesSent,y=e.nominated,g=e.id,S=e.currentRoundTripTime,E=e.state,b=e.writable,I=e.candidateType,T=e.ip,A=e.address,R=e.networkType,C=e.port,O=e.nackCount,w=e.pliCount,k=e.protocol,N=e.requestsReceived,P=e.responsesReceived,D=e.requestsSent,M=e.consentRequestsSent,L=e.responsesSent,U=e.ssrc;e.kind;var x=e.jitter,V=e.framesReceived,F=e.keyFramesDecoded,B=e.totalDecodeTime,j=e.decoderImplementation,G=e.lastPacketReceivedTimestamp;"inbound-rtp"===t?(i.packetsLost=a,d.packetsLost=a,i.packetsReceived=s,d.packetsReceived=s,i.bytesReceived=c,d.bytes=c,i.framesDecoded=u,void 0!==l&&(i.jitterBufferDelay=l/h*1e3,d.average_jitter_buffer_delay_ms=i.jitterBufferDelay),d.fir_count=f,d.nackCount=O,i.nackCount=O,d.pli_count=w,i.pliCount=w,d.ssrc=U,d.jitter=x,d.framesReceived=V,i.framesReceived=V,d.framesDecoded=u,d.key_frames_decoded=F,d.total_decode_time=B,d.decoder_name=j,d.last_packet_received_timestamp=G):"track"===t&&void 0!==o?(r.width=o,d.frame_size_width=o,r.height=n,d.frame_size_height=n,void 0!==V&&(d.framesReceived=V,i.framesReceived=V)):"codec"===t?d.codecName=p:"candidate-pair"===t?(d.ice_available_incoming_bitrate=_,d.ice_available_outgoing_bitrate=v,d.ice_bytes_received=c,d.ice_bytes_sent=m,d.ice_nominated=+y,d.ice_pair_id=g,d.ice_pair_rtt=S,d.rtt=1e3*S,r.rtt=d.rtt,d.ice_pair_state=E,d.ice_pair_writable=b,d.recv_ping_requests=N,d.recv_ping_responses=P,d.sent_ping_requests_before_first_response=D,d.sent_ping_requests_total=D+(M||0),d.sent_ping_responses=L):"local-candidate"===t?(d.local_candidate_type=I,d.local_ip=T||A,d.local_network_type=R,d.local_port=C,d.protocol=k):"remote-candidate"===t&&(d.remote_candidate_type=I,d.remote_ip=T||A,d.remote_port=C)})),(p=t.video).timestamp?(r.videoLossRate=(i.packetsLost-p.packetsLost)/(i.packetsReceived-p.packetsReceived+(i.packetsLost-p.packetsLost)),r._retransmittedRate=(i.nackCount-p.nackCount)/(i.packetsReceived-p.packetsReceived+(i.packetsLost-p.packetsLost)),r.videoLossRate=Number.isNaN(r.videoLossRate)?0:r.videoLossRate,d.fraction_lost=r.videoLossRate,d.packets_lost_rate=r.videoLossRate,r.statsInterval=i.timestamp-p.timestamp,d.stats_interval=r.statsInterval,r.receivedKBitrate=(i.bytesReceived-p.bytesReceived||0)/r.statsInterval*8,d.bitrate=Math.round(1e3*r.receivedKBitrate),d.bandwidth=Math.round(d.bitrate/1024),r.decoderOutputFrameRate=1e3*(i.framesDecoded-p.framesDecoded)/r.statsInterval,r.receivedFrameRate=1e3*(i.framesReceived-p.framesReceived)/r.statsInterval,(0===p.framesDecoded&&i.framesReceived>100||i.pliCount>15)&&(r.needResub=!0),d.frame_rate_decoded=Math.round(r.decoderOutputFrameRate),d.frame_rate_received=Math.round(r.receivedFrameRate),t.video=i,this.processStall(this._stream,d,r,s),this.monitor.rtcMediaStatistics(d,{}),[2,r]):(t.video=i,[2,r])):[2,r]}}))}))},t.prototype.processStall=function(e,t,r,i){var n=0,o=0,a=0;if(e.recordedVideoFrames){e.recordedVideoFrames.forEach((function(e){e.isStall&&(n+=e.stallCount,o+=e.stallDuration),a=e.playTime})),e.recordedVideoFrames.length||(o=2e3,n=this._videoInWaiting?0:1,this._videoInWaiting=!0);var s=e.recordedVideoFrames.pop();s&&(s.isStall?this._videoInWaiting=!0:this._videoInWaiting=!1),e.recordedVideoFrames=[]}t.stall_count=n,i?(t.stuck_length=o,t.stall_duration=void 0):(t.stall_duration=o,t.stuck_length=void 0),t.play_time=a,r.stallCount=n,r.stallDuration=o},t.prototype.destroy=function(){e.prototype.destroy.call(this),this.delStatsEvtInterval(),this._videoInWaiting=!1},t}(vK);!function(e){e[e.CHANNEL_PROFILE_COMMUNICATION=0]="CHANNEL_PROFILE_COMMUNICATION",e[e.CHANNEL_PROFILE_LIVE_BROADCASTING=1]="CHANNEL_PROFILE_LIVE_BROADCASTING"}(dK||(dK={})),function(e){e.RESUBSCRIBE="resubscribe",e.STREAM_FAILED="stream_failed",e.SUBSCRIBE_PUSH_TRACK="subscribe_push_track",e.REMOVE_PUSH_TRACK="remove_push_track",e.VIDEO_FIRST_FRAME="video_first_frame",e.ON_USER_PUBLISH_STATE_CHANGE="on_user_publish_state_change",e.ON_USER_START_AUDIO_CAPTURE="on_user_start_audio_capture",e.ON_USER_STOP_AUDIO_CAPTURE="on_user_stop_audio_capture",e.ON_USER_START_VIDEO_CAPTURE="on_user_start_video_capture",e.ON_USER_STOP_VIDEO_CAPTURE="on_user_stop_video_capture",e.ON_SEI_MESSAGED_RECEIVED="on_sei_messaged_received",e.ON_PUBLISH_RESULT="on_publish_result",e.ON_UPDATE_TOKEN_SUCCESS="on_update_token_success",e.ON_REMOTE_STREAM_STATS="ON_REMOTE_STREAM_STATS",e.ON_LOCAL_STREAM_STATS="ON_LOCAL_STREAM_STATS",e.ON_USER_LEAVE="on_user_leave",e.ON_ROOM_ERROR="on_room_error",e.ON_NETWORK_QUALITY="on_network_quality",e.ON_SIMULCAST_SUBSCRIBE_FALLBACK="on_simulcast_subscribe_fallback",e.ON_REMOTE_VIDEO_SIZE_CHANGED="on_remote_video_size_changed",e.RECONNECT_FAILED="reconnect_failed"}(lK||(lK={})),function(e){e.TranscodeStateChanged="TranscodeStateChanged",e.TranscodeStarted="TranscodeStarted",e.TranscodeUpdated="TranscodeUpdated",e.TranscodeStoped="TranscodeStoped"}(hK||(hK={})),function(e){e[e.START=1]="START",e[e.START_SUCCESS=2]="START_SUCCESS",e[e.START_FAILED=3]="START_FAILED",e[e.UPDATE=4]="UPDATE",e[e.UPDATE_SUCCESS=5]="UPDATE_SUCCESS",e[e.UPDATE_FAILED=6]="UPDATE_FAILED",e[e.STOP=7]="STOP",e[e.STOP_SUCCESS=8]="STOP_SUCCESS",e[e.STOP_FAILED=9]="STOP_FAILED"}(pK||(pK={})),function(e){e[e.PUB=0]="PUB",e[e.UNPUB=1]="UNPUB"}(fK||(fK={})),function(e){e[e.SUB=0]="SUB",e[e.UNSUB=1]="UNSUB"}(_K||(_K={}));var gK,SK=new rj("Stream",0),EK=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return Of(t,e),t.prototype.stopRecordAudioEnergy=function(){delete this._audioPlaybackEnergy},t.prototype.recordAudioEnergy=function(e){"number"!=typeof this._audioPlaybackEnergy&&(this._audioPlaybackEnergy=0),this._audioPlaybackEnergy+=e},t.prototype.getRecordAudioEnergy=function(){if("number"==typeof this._audioPlaybackEnergy){var e=this._audioPlaybackEnergy;return this._audioPlaybackEnergy=0,e}},t.prototype.requestVideoFrameCallback=function(){var e=this;return new Promise((function(t){var r,i=null===(r=e.videoDom)||void 0===r?void 0:r.requestVideoFrameCallback;if("function"==typeof i){var n=function(e,r){var i={};Object.keys(r).forEach((function(e){var t=e.replace(/[a-z]{1}[A-Z]{1}/g,(function(e){return"".concat(e[0],"_").concat(e[1].toLowerCase())}));i["video_".concat(t)]=r[e]})),clearInterval(o),t(i)};i.call(e.videoDom,n);var o=setTimeout((function(){var r;null===(r=e.videoDom)||void 0===r||r.cancelVideoFrameCallback(n),t({})}),500)}else t({})}))},t}(oj);!function(e){e[e.INIT=0]="INIT",e[e.SUB_ING=1]="SUB_ING",e[e.SUB_ED=2]="SUB_ED"}(gK||(gK={}));var bK,IK,TK,AK,RK=function(e){function t(){var t=e.call(this)||this;return t.isScreen=!1,t.seiList=[],t.videoEncodeConfig=[rB],t.subVideoDescriptions=[],t.enableSimulcast=!1,t.prevScaleResolutionDownBy=1,t.pubAudio=!1,t.pubVideo=!1,t.stream=new MediaStream,t.videoInputConfig={width:640,height:360,frameRate:30},t.pubAttributes={localaudio:!1,localvideo:!1,videostream:!1,audiostream:!1,extvideo:!1,extaudio:!1},t.statsReport=new mK(t),t}return Of(t,e),Object.defineProperty(t.prototype,"hasPublished",{get:function(){return this.audioMid&&this.videoMid},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isEmptyStream",{get:function(){return!this.audioTrack&&!this.videoTrack},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"initStreamId",{get:function(){return this.stream.id},enumerable:!1,configurable:!0}),t.prototype.initVideoEncodedTransform=function(){var e=this;if(this.videoTransceiver&&this.videoTransceiver.sender){var t=this.videoTransceiver.sender;if(gH()){var r=t.createEncodedStreams(),i=r.readable,n=r.writable,o=new TransformStream({transform:function(t,r){var i=e.seiList[0];if(i){var n=uK.generateSEI(i.content),o=new Uint8Array(n.byteLength+t.data.byteLength);0===i.repeatCount&&e.seiList.splice(0,1),i.repeatCount--,o.set(new Uint8Array(t.data)),o.set(n,t.data.byteLength),t.data=o.buffer,r.enqueue(t)}else r.enqueue(t)}});i.pipeThrough(o).pipeTo(n)}}else SK.print("no sender found when trying to bind encodedTransform")},t.prototype.initAudioEncodedTransform=function(){if(this.audioTransceiver&&this.audioTransceiver.sender){var e=this.audioTransceiver.sender.createEncodedStreams(),t=e.readable,r=e.writable;t.pipeThrough(new TransformStream({transform:function(e,t){t.enqueue(e)}})).pipeTo(r)}else SK.print("no sender found when trying to bind encodedTransform")},t.prototype.clean=function(){var e;this.audioMid=void 0,this.videoMid=void 0,this.videoTransceiver=void 0,this.audioTransceiver=void 0,null===(e=this.observer)||void 0===e||e.reset(),this.statsReport.destroy(),this.prevScaleResolutionDownBy=1,this.subVideoDescriptions=[]},t.prototype.switchTrackEnableState=function(e,t){var r;"audio"===e?r=this.audioTrack:"video"===e&&(r=this.videoTrack);var i=null==r?void 0:r.getTrack();return!(!i||(null==i?void 0:i.enabled)===t)&&(i.enabled=t,!0)},t}(EK),CK=function(e){function t(t,r,i,n,o,a){void 0===a&&(a=qf.LOW);var s=e.call(this)||this;return s.userPriority=a,s.originalStreamIndex=0,s._vStats="-V",s._aStats="-A",s.userId=t,s.isScreen=i,s.isPublic=n,s.streamId=r,s.hasAudio=o.audiostream&&o.localaudio,s.hasVideo=o.videostream&&o.localvideo,s._attributes=o,s.subVideo=!1,s.subAudio=!1,s._sequenceId=0,s.subMediaType=$z.NONE,s.subLayer={spatialLayer:0,spatialSubLayer:-1},s.streamState=gK.INIT,s.statsReport=new yK(s),s}return Of(t,e),Object.defineProperty(t.prototype,"sequenceId",{get:function(){return this._sequenceId||-1},set:function(e){"number"==typeof e&&(this._sequenceId=e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"attributes",{get:function(){return this._attributes},set:function(e){this.hasVideo=e.localvideo&&e.videostream,this.hasAudio=e.localaudio&&e.audiostream,this._attributes=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"hasSubscribed",{get:function(){return this.streamState===gK.SUB_ED},enumerable:!1,configurable:!0}),t.prototype.initVideoEncodedTransform=function(){var e=this;if(this.videoTransceiver&&this.videoTransceiver.receiver){var t=this.videoTransceiver.receiver.createEncodedStreams(),r=t.readable,i=t.writable;r.pipeThrough(new TransformStream({transform:function(t,r){try{e.safeEmit("onTransformData",e.userId,t)}catch(e){}var i=iK.getNalunits(new nK(t.data)).find((function(e){return e.sei}));if(i){var n=uK.decodeSeiBody(i.body);n&&n.type!==tK.internal&&e.safeEmit("onSEIMessage",n.payload)}r.enqueue(t)}})).pipeTo(i)}else SK.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 SK.print("no receiver found when trying to bind encodedTransform")},t.prototype.ontrack=function(e){var t,r,i,n,o,a;try{cj.rtcInvokeStatus(JSON.stringify({uid:this.userId,streamId:this.streamId,streams:e.streams.reduce((function(e,t){return e+(null==(r=t)?"undefined | null":"string"==typeof r?r:JSON.stringify({id:r.id,active:r.active}));var r}),""),transceiver:(n=e.transceiver,null==n?"undefined | null":"string"==typeof n?n:JSON.stringify({currentDirection:n.currentDirection,direction:n.direction,mid:n.mid,stopped:n.stopped,receiver:(a=n.receiver,null==a?"undefined | null":"string"==typeof a?a:JSON.stringify({track:ix(a.track)})),sender:(o=n.sender,null==o?"undefined | null":"string"==typeof o?o:JSON.stringify({track:ix(o.track)}))})),track:ix(e.track)}),0,"Stream.ontrack","",0)}catch(e){}if((null===(r=null===(t=e.streams)||void 0===t?void 0:t[0])||void 0===r?void 0:r.id)===this.streamId){var s=e.track;"video"===(null==s?void 0:s.kind)?this._setVideoTrack(s):"audio"===(null===(i=e.track)||void 0===i?void 0:i.kind)&&this._setAudioTrack(s),this._setStream(e.streams[0])}this.safeEmit("ontrack",e)},t.prototype.clean=function(){var e;SK.print("clean","exec stream.clean ".concat(this.streamId," ").concat(this.userId)),this.subAudio=!1,this.subVideo=!1,this.audioMid=void 0,this.videoMid=void 0,this.sequenceId=0,this.videoTrack=void 0,this.audioTrack=void 0,this.stream=void 0,this.videoTransceiver=void 0,this.audioTransceiver=void 0,this.recordedVideoFrames=void 0,this.paused=!1,this._workaround_1_=!1,null===(e=this.observer)||void 0===e||e.reset(),this.statsReport.destroy()},t.prototype.resetHasSubscribed=function(){this.streamState=gK.INIT},t.prototype.setRemoteUserPriority=function(e){this.userPriority=e},t.prototype.getStreamPriority=function(){var e=this.isScreen?20:this.hasAudio||this.hasVideo?this.attributes.videoDescriptions.length>1?10-this.subLayer.spatialLayer:9:0;return 1e4*this.userPriority+100*e},t.prototype.getSubscribeFallbackParams=function(e){if(e!==Xf.DISABLE&&this.subVideo){if(this.attributes.videoDescriptions.length-1>this.subLayer.spatialLayer)return[this.originalMediaType,_K.SUB,this._getSubLayerBySpatialLayer(this.subLayer.spatialLayer+1)];if(e===Xf.AUDIO_ONLY)return[Ff.VIDEO,_K.UNSUB]}return null},t.prototype.getSubscribeRecoverParams=function(){if(this.originalMediaType&&tx(this.originalMediaType)){if(!1===this.subVideo)return[this.originalMediaType,_K.SUB,this.subLayer];if("number"==typeof this.originalStreamIndex&&this.subLayer.spatialLayer>this.originalStreamIndex)return[this.originalMediaType,_K.SUB,this._getSubLayerBySpatialLayer(this.subLayer.spatialLayer-1)]}return null},t.prototype._setStream=function(e){var t=this;this.stream=e,e.onaddtrack=function(e){"video"===e.track.kind?t._setVideoTrack(e.track):"audio"===e.track.kind&&t._setAudioTrack(e.track)}},t.prototype._setAudioTrack=function(e){var t,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 jz(e,kU()),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 Bz(e,kU()),this.emit("ontrack",this.videoTrack))},t.prototype._getSubLayerBySpatialLayer=function(e){var t=this._attributes,r=t.videoDescriptions,i=t.subVideoDescriptions,n=void 0===i?[]:i,o=r[e],a=o.width,s=o.height,c=n.find((function(e){return e.width===a&&e.height===s}));return{spatialLayer:e,spatialSubLayer:(null==c?void 0:c.sub_index)||-1}},t}(EK),OK=new rj("queue",4);!function(e){e[e.ADD=0]="ADD",e[e.CLOSE=1]="CLOSE"}(TK||(TK={})),function(e){e.publish="publish",e.unpublish="unpublish",e.subscribe="subscribe",e.unsubscribe="unsubscribe",e.pushtrack="pushtrack",e.removetrack="removetrack"}(AK||(AK={}));var wK,kK,NK,PK=((bK={})[AK.publish]="unpublish",bK[AK.subscribe]="unsubscribe",bK[AK.pushtrack]="removetrack",bK),DK=((IK={})[AK.publish]=TK.ADD,IK[AK.subscribe]=TK.ADD,IK[AK.pushtrack]=TK.ADD,IK[AK.unpublish]=TK.CLOSE,IK[AK.unsubscribe]=TK.CLOSE,IK[AK.removetrack]=TK.CLOSE,IK),MK=function(e){function t(){var t=e.call(this)||this;return t._queue=[],t}return Of(t,e),Object.defineProperty(t.prototype,"queue",{get:function(){return this._queue},enumerable:!1,configurable:!0}),t.prototype.enqueue=function(e){var t=this._queue.length,r="";return this._queue=this._queue.filter((function(t){return t.streamId!==e.streamId||e.action!==PK[t.action]||(r=t.streamId,OK.print("offsetStreamId",r),!1)})),this._queue.length===t&&this._queue.push(e),this.emit("start"),r},t.prototype.dequeue=function(){if(!this._queue.length)return null;var e=this._queue.length;KU&&(e=Math.min(this._queue.length,5));for(var t=DK[this._queue[0].action],r=1;r<e;r++)if(DK[this._queue[r].action]!==t)return{sdpStrategy:t,items:this._queue.splice(0,r)};return{sdpStrategy:t,items:this._queue.splice(0,e)}},t}(ZB),LK=new rj("ChromeHandler",3),UK=gH(),xK=function(e){function t(t,r){var i=e.call(this,t,r)||this;return i.name="chrome",i._queueBusy=!1,i._mid=0,i._offerMlines=[],i._answerMlines=[],i._inactiveMlineIndex=[],i._msidIndexMap={},i._mlinesCache={},i._sdpQueue=new MK,i._sdpQueue.on("start",(function(){LK.print("receive dequeue start","queueBusy: %o: , ss: %o: ",i._queueBusy,i._peerConnection.signalingState),i._queueBusy||"stable"!==i._peerConnection.signalingState||(LK.print("dequeue start"),i.dequeue())})),i}return Of(t,e),t.prototype.connect=function(e){var t,r,i,n;return r_(this,void 0,void 0,(function(){var o,a,s,c,u,d,l,h,p,f,_,v,m,y=this;return i_(this,(function(g){switch(g.label){case 0:return LK.print("connect","invoke connect"),this._offerIce={iceUfrag:null===(t=e.iceParams)||void 0===t?void 0:t.clientIceUfrag,icePwd:null===(r=e.iceParams)||void 0===r?void 0:r.clientIcePwd,iceOptions:"renomination"},o=this,[4,GH(e)];case 1:return o._answerIce=g.sent(),[4,this._peerConnection.createOffer()];case 2:return a=g.sent(),s=AH.parse(a.sdp),!this._offerIce.iceUfrag&&!this._offerIce.icePwd&&((c="renomination"===(null===(i=s.media[0])||void 0===i?void 0:i.iceOptions))||(delete this._offerIce.iceOptions,delete this._answerIce.iceOptions),delete this._offerIce.iceUfrag,delete this._offerIce.icePwd,u=o_(KH({serverUfrag:e.iceParams.serverIceUfrag,serverPwd:e.iceParams.serverIcePwd,clientPwd:null===(n=s.media[0])||void 0===n?void 0:n.icePwd,options:(m={},m[HH.kICEConfigTypeSrtpDtlsType]=!0,m[HH.kICEConfigTypeRenominationType]=c,m)}),1),d=u[0],this._answerIce.iceUfrag=d,LK.print("use serverUfrag v2",JSON.stringify({dtls:!0,renomination:c}))),l=o_(s.media,1),h=l[0],this._offerIce.fingerprint=s.fingerprint||h.fingerprint,this._peerConnection.addTransceiver("audio",{direction:"recvonly"}),this._peerConnection.addTransceiver("video",{direction:"recvonly"}),this._peerConnection.addTransceiver("audio",{direction:"recvonly"}),this._peerConnection.addTransceiver("video",{direction:"recvonly"}),[4,this._peerConnection.createOffer()];case 3:return a=g.sent(),[4,(p=new RTCPeerConnection(EH)).setRemoteDescription(a)];case 4:return g.sent(),[4,p.createAnswer()];case 5:return f=g.sent(),[4,p.setLocalDescription(f)];case 6:return g.sent(),p.close(),_=AH.parse(a.sdp),v=AH.parse(f.sdp),Array.isArray(v.media)&&(v.media=v.media.map((function(e){return"video"===(null==e?void 0:e.type)&&WH(e,"H264"),jU&&"inactive"===(null==e?void 0:e.direction)&&(e.direction="sendonly"),e}))),this._offerSession=e_({},_),this._answerSession=e_({},v),_.media.forEach((function(e,t){var r=y._mid++;e=e_(e_(e_({},e),y._offerIce),{mid:"".concat(r)}),y._offerMlines.push(e);var i=e_(e_(e_({},v.media[t]),y._answerIce),{mid:"".concat(r)});"application"===i.type&&(i.sctpmap={sctpmapNumber:5e3,app:"webrtc-datachannel",maxMessageSize:262144}),y._answerMlines.push(i)})),this.setDescription(),[4,new Promise((function(e,t){y._dataChannel.onopen=function(){LK.print("connect","dataChannel open"),mj("es.dc.open",""),e("")},y._dataChannel.onerror=function(e){cj.rtcSignalingMsgError(e.error.sdpLineNumber,e.error.errorDetail,yB.INVALID_DATA),mj("es.dc.error",""),t(e)},y._dataChannel.onclose=function(e){mj("es.dc.close",""),t(e)},y._peerConnection.addEventListener("connectionstatechange",(function(e){"failed"!==y._peerConnection.iceConnectionState&&"closed"!==y._peerConnection.iceConnectionState&&"failed"!==y._peerConnection.connectionState||t(e)}))}))];case 7:return g.sent(),LK.print("connect","dataChannel establish success"),[2,this._dataChannel]}}))}))},t.prototype.disconnect=function(){this._peerConnection.close(),this._dataChannel.close(),this._peerConnection.ontrack=null},t.prototype.destroy=function(){e.prototype.destroy.call(this),this._mlinesCache={}},t.prototype.publish=function(t,r){return r_(this,void 0,void 0,(function(){var i,n,o,a,s,c,u,d,l,h,p,f,_,v,m,y,g,S,E;return i_(this,(function(b){return i=t.stream,n=t.enableSimulcast,o=e.prototype.internalPublish.call(this,t,r),a=o.videoDescriptions,s=o.subVideoDescriptions,c=o.transceiverInit,u="".concat(this._mid++),d="".concat(this._mid++),l=e_(e_(e_({},this._aSendonlyOfferTpl),this._offerIce),{mid:u,msid:"".concat(i.id," ").concat(i.id,"-audio"),ssrcs:FH(i,"audio")}),h=e_(e_(e_({},this._vSendonlyOfferTpl),this._offerIce),{mid:d,msid:"".concat(i.id," ").concat(i.id,"-video")}),n?(LK.print("subVideoDesc","desc: %o ",s),delete h.ssrcGroups,delete h.ssrcs,p=[],h.rids=a.map((function(e){var t=e.rid;return p.unshift(t),{id:t,direction:"send"}})),h.simulcast={dir1:"send",list1:p.join(";")}):(f=function(e,t){var r=VH(),i=VH();return{ssrcs:[r,i].reduce((function(r,i){return r.concat(FH(e,t,i))}),[]),ssrcGroups:[{semantics:"FID",ssrcs:"".concat(r," ").concat(i)}]}}(i,"video"),_=f.ssrcs,v=f.ssrcGroups,h.ssrcs=_,h.ssrcGroups=v),(xU||jU)&&Array.isArray(h.ext)&&(h.ext=h.ext.filter((function(e){var t;return!(null===(t=null==e?void 0:e.uri)||void 0===t?void 0:t.includes("video-orientation"))}))),(null==r?void 0:r.audioRed)&&Array.isArray(l.rtp)&&-1!==(m=l.rtp.findIndex((function(e){return"red"===e.codec})))&&(y=o_(l.rtp.splice(m,1),1),g=y[0],l.rtp.unshift(g)),location.search.includes("__rtc_vp8__")?WH(h,"VP8"):location.search.includes("__rtc_h264__")&&WH(h,"H264"),(S=null==l?void 0:l.rtp.find((function(e){return"opus"===e.codec})))&&l.fmtp&&(E=l.fmtp.find((function(e){return e.payload===S.payload})))&&this._context&&(E.config+=this._context.audioProfileManager.getOpusConfigStr()),n||xU||this.addBitrateLimit(h,t.videoEncodeConfig[0].maxKbps),this._mlinesCache[t.stream.id]=[l,h],[2,{partialSdp:jH(this._offerSession,l,h),audioMid:u,videoMid:d,type:"incroffer",semantics:"unified-plan",videoDescriptions:a,subVideoDescriptions:s,transceiverInit:c}]}))}))},t.prototype.subscribe=function(e,t){return r_(this,void 0,void 0,(function(){var r,i,n,o,a,s,c,u,d,l,h,p,f;return i_(this,(function(_){switch(_.label){case 0:return LK.print("subscribe","mids: ",t),r="incroffer",i="unified-plan",this._aRecvonlyOfferTpl&&this._vRecvonlyOfferTpl?[3,3]:[4,QU(!0)];case 1:if(!(n=_.sent()))throw new oG(Zj.NOT_SUPPORTED,"Get offer Error");return[4,this.createAVMlineOfferTpl(n)];case 2:_.sent(),_.label=3;case 3:return this._mlinesCache[e.streamId]?(o=o_(this._mlinesCache[e.streamId],2),a=o[0],s=o[1],a.mid=e.audioMid,s.mid=e.videoMid,[2,{partialSdp:jH(this._offerSession,a,s),audioMid:a.mid,videoMid:s.mid,type:r,semantics:i}]):(c="".concat(this._mid++),u="".concat(this._mid++),d=e_(e_(e_({},this._aRecvonlyOfferTpl),this._offerIce),{mid:c}),l=e_(e_(e_({},this._vRecvonlyOfferTpl),this._offerIce),{mid:u}),this._mlinesCache[e.streamId]=[d,l],e.isPublic&&((null==(h=null==l?void 0:l.rtp.filter((function(e){return"H264"===e.codec})))?void 0:h.length)&&(null==l?void 0:l.fmtp)&&(null==l||l.fmtp.forEach((function(e){h.find((function(t){return t.payload===e.payload}))&&(e.config+=";sps-pps-idr-in-keyframe=1")}))),(null==l?void 0:l.rtcpFb)&&(p=new Map,f=[],l.rtcpFb.forEach((function(e,t){p.set(e.payload,t)})),p.forEach((function(e,t){f.push({payload:t,idx:e})})),f.sort((function(e,t){return e.idx-t.idx})).forEach((function(e,t){var r;null===(r=null==l?void 0:l.rtcpFb)||void 0===r||r.splice(e.idx+t+1,0,{payload:e.payload,type:"rrtr"})})))),[2,{partialSdp:jH(this._offerSession,d,l),audioMid:c,videoMid:u,type:r,semantics:i,transceiverInit:{aTrack:"audio",vTrack:"video",audioTransceiverInit:{direction:"recvonly"},videoTransceiverInit:{direction:"recvonly"}}}])}}))}))},t.prototype.handleAck=function(e){return r_(this,void 0,void 0,(function(){return i_(this,(function(t){return LK.print("handleAck()","item: %o",e),[2,this._sdpQueue.enqueue(e)]}))}))},t.prototype.dequeue=function(){var e,t,r,i,n;return r_(this,void 0,void 0,(function(){var o,a,s,c,u,d,l,h,p,f,_,v,m,y,g,S,E,b,I,T,A,R,C,O,w,k,N,P,D,M,L,U=this;return i_(this,(function(x){switch(x.label){case 0:if(this._queueBusy=!0,o=this._sdpQueue.dequeue(),LK.print("dequeue()","ret: %o",o),!o)return this._queueBusy=!1,[2];x.label=1;case 1:if(x.trys.push([1,22,23,24]),a=o.items,s=o.sdpStrategy,c=[],u=[],d=[],s!==TK.ADD)return[3,19];delete(l=e_({},this._answerIce)).candidates,x.label=2;case 2:x.trys.push([2,12,13,18]),h=s_(a),x.label=3;case 3:return[4,h.next()];case 4:return(p=x.sent()).done?[3,11]:(f=p.value,_=f.action,v=f.transceiverInit,m=f.signalingAck,y=f.stream,g=y instanceof CK,f.onSuccess&&d.push(f.onSuccess),g&&(null==m?void 0:m.sequenceId)<y.sequenceId?[3,11]:(S={},E={},b=AH.parse(m.sdp),Array.isArray(b.media)&&(I="",b.media.sort((function(e,t){var r;return null===(r=null==e?void 0:e.type)||void 0===r?void 0:r.localeCompare(null==t?void 0:t.type)})).forEach((function(e){"audio"===(e=e_(e_({},e),l)).type?(S=e,LK.print("audioMsid",e.msid),e.msid&&(I=e.msid.replace("audio","video"))):(E=e,LK.print("videoMsid",I),I&&(E.msid=I,I=""))}))),T=y.streamId,_===AK.publish&&(T=null===(r=y.stream)||void 0===r?void 0:r.id),this._mlinesCache[T]?(A=o_(this._mlinesCache[T],2),R=A[0],C=A[1],v?(_===AK.publish&&zU&&(null===(i=null==v?void 0:v.videoTransceiverInit)||void 0===i||delete i.sendEncodings),y.audioTransceiver=this._peerConnection.addTransceiver(v.aTrack,v.audioTransceiverInit),y.videoTransceiver=this._peerConnection.addTransceiver(v.vTrack,v.videoTransceiverInit),this.monitor.rtcInvokeStatus(JSON.stringify({audioStreamTrack:ix(v.aTrack),videoStreamTrack:ix(v.vTrack)}),0,"chromeHandler.addTrack","",0),(O=this._inactiveMlineIndex.shift())||(O=this._offerMlines.length),this._offerMlines[O]=e_(e_({},R),{mid:S.mid}),this._answerMlines[O]=S,(w=this._inactiveMlineIndex.shift())||(w=this._offerMlines.length),this._offerMlines[w]=e_(e_({},C),{mid:E.mid}),this._answerMlines[w]=E,this._msidIndexMap[y.streamId]=[O,w],UK&&(y.initAudioEncodedTransform(),y.initVideoEncodedTransform()),c.push(y.streamId||""),u.push(g?y.userId:"local"),[3,9]):[3,5]):[3,11]));case 5:return g?(k=o_(this._msidIndexMap[y.streamId]||[],2),N=k[0],P=k[1],N&&P?(null===(n=this._offerMlines[N])||void 0===n?void 0:n.mid)===S.mid?[3,7]:(this._offerMlines[N]=BH(this._offerMlines[N]),this._offerMlines[P]=BH(this._offerMlines[P]),this._answerMlines[N]=BH(this._answerMlines[N]),this._answerMlines[P]=BH(this._answerMlines[P]),[4,this.setDescription()]):[3,8]):[3,9];case 6:x.sent(),this._offerMlines[N]=e_(e_({},this._aRecvonlyOfferTpl),{mid:S.mid}),this._offerMlines[P]=e_(e_({},this._vRecvonlyOfferTpl),{mid:E.mid}),LK.print("enqueue","hack: %o",y.streamId),x.label=7;case 7:return this._answerMlines[N]=S,this._answerMlines[P]=E,[3,9];case 8:LK.print("dequeue","pushtrack before subscribe: %o",y.userId),x.label=9;case 9:g&&(y.sequenceId=null==m?void 0:m.sequenceId),x.label=10;case 10:return[3,3];case 11:return[3,18];case 12:return D=x.sent(),e={error:D},[3,18];case 13:return x.trys.push([13,,16,17]),p&&!p.done&&(t=h.return)?[4,t.call(h)]:[3,15];case 14:x.sent(),x.label=15;case 15:return[3,17];case 16:if(e)throw e.error;return[7];case 17:return[7];case 18:return[3,20];case 19:M={},a.forEach((function(e){var t,r=e.audioMid,i=e.videoMid;M[r]=r,M[i]=i,delete U._msidIndexMap[null===(t=e.stream)||void 0===t?void 0:t.streamId]})),this._offerMlines=this._offerMlines.map((function(e,t){return M[e.mid]&&(e=BH(e),U._inactiveMlineIndex.push(t)),e})),this._inactiveMlineIndex.sort((function(e,t){return e-t})),this._answerMlines=this._answerMlines.map((function(e){return M[e.mid]&&(e=BH(e)),e})),x.label=20;case 20:return[4,this.setDescription(c.length?{streamId:c.join(","),streamUserId:u.join(",")}:void 0)];case 21:x.sent();try{d.forEach((function(e){return e()}))}catch(e){}return LK.print("dequeue","loop"),[3,24];case 22:return L=x.sent(),LK.print("dequeue","unknown error: %o",L),[3,24];case 23:return this.dequeue(),[7];case 24:return[2]}}))}))},t.prototype.setDescription=function(e){return r_(this,void 0,void 0,(function(){var t,r;return i_(this,(function(i){switch(i.label){case 0:return LK.print("setDescription","_offerMlines: %o, _answerMlines: %o",this._offerMlines,this._answerMlines),this._offerSession.media=this._offerMlines,this._answerSession.media=this._answerMlines,t=[],this._offerMlines.forEach((function(e){"inactive"!==e.direction&&t.push(e.mid)})),this._offerSession.groups&&this._answerSession.groups&&(this._offerSession.groups[0].mids=t.join(" "),this._answerSession.groups[0].mids=t.join(" ")),r=NU(),e&&cj.rtcBeginCreateOffer("local"===e.streamUserId?EB.UP:EB.DOWN,e.streamId,e.streamUserId),[4,this._peerConnection.createOffer()];case 1:return i.sent(),e&&cj.rtcCreateOffer(0,"local"===e.streamUserId?bB.UP:bB.DOWN,e.streamId,e.streamUserId,NU()-r),[4,this.setLocalDescription(AH.write(this._offerSession),e)];case 2:return i.sent(),[4,this.setRemoteDescription(AH.write(this._answerSession),e)];case 3:return i.sent(),[2]}}))}))},t.prototype.getDefaultSdp=function(){return r_(this,void 0,void 0,(function(){var e,t,r;return i_(this,(function(i){switch(i.label){case 0:return[4,QU(!0)];case 1:if(!(e=i.sent()))throw new oG(Zj.NOT_SUPPORTED,"Get offer Error");return this.createAVMlineOfferTpl(e),t=AH.parse(e),r=[],t.media=t.media.filter((function(e){return"recvonly"===e.direction&&(r.push(e.mid+""),!0)})),t.groups=[{mids:r.join(" "),type:"BUNDLE"}],[2,{sdp:AH.write(t),semantics:"unified-plan",type:"offer"}]}}))}))},t.prototype.rollback=function(e){return r_(this,void 0,void 0,(function(){return i_(this,(function(t){return delete this._mlinesCache[e],[2]}))}))},t.prototype.createAVMlineOfferTpl=function(e){var t=this;AH.parse(e).media.forEach((function(e){"audio"===e.type?"sendonly"===e.direction?t._aSendonlyOfferTpl=e:t._aRecvonlyOfferTpl=e:"video"===e.type&&("sendonly"===e.direction?t._vSendonlyOfferTpl=e:t._vRecvonlyOfferTpl=e)}))},t}(IH),VK=new rj("FirefoxHandler",3),FK=function(e){function t(t,r){var i=e.call(this,t,r)||this;return i.name="firefox",i}return Of(t,e),t.prototype.connect=function(e){var t,r,i,n;return r_(this,void 0,void 0,(function(){var o,a,s,c,u,d,l,h,p,f,_=this;return i_(this,(function(v){switch(v.label){case 0:return VK.print("connect","invoke connect"),this._offerIce={iceUfrag:null===(t=e.iceParams)||void 0===t?void 0:t.clientIceUfrag,icePwd:null===(r=e.iceParams)||void 0===r?void 0:r.clientIcePwd,iceOptions:"renomination"},o=this,[4,GH(e)];case 1:return o._answerIce=v.sent(),[4,this._peerConnection.createOffer()];case 2:return a=v.sent(),s=AH.parse(a.sdp),!this._offerIce.iceUfrag&&!this._offerIce.icePwd&&((c="renomination"===(null===(i=s.media[0])||void 0===i?void 0:i.iceOptions))||(delete this._offerIce.iceOptions,delete this._answerIce.iceOptions),delete this._offerIce.iceUfrag,delete this._offerIce.icePwd,u=o_(KH({serverUfrag:e.iceParams.serverIceUfrag,serverPwd:e.iceParams.serverIcePwd,clientPwd:null===(n=s.media[0])||void 0===n?void 0:n.icePwd,options:(f={},f[HH.kICEConfigTypeSrtpDtlsType]=!0,f[HH.kICEConfigTypeRenominationType]=c,f)}),1),d=u[0],this._answerIce.iceUfrag=d,VK.print("use serverUfrag v2",JSON.stringify({dtls:!0,renomination:c}))),l=o_(s.media,1),h=l[0],this._offerIce.fingerprint=s.fingerprint||h.fingerprint,s.media=s.media.map((function(e){return e_(e_({},e),_._offerIce)})),(p=e_({},s)).fingerprint=this._answerIce.fingerprint,p.media=p.media.map((function(e){return e_(e_(e_({},e),_._answerIce),{sctpmap:{sctpmapNumber:5e3,app:"webrtc-datachannel",maxMessageSize:262144}})})),[4,this.setLocalDescription(AH.write(s))];case 3:return v.sent(),[4,this.setRemoteDescription(AH.write(p))];case 4:return v.sent(),[4,new Promise((function(e,t){_._dataChannel.onopen=function(){VK.print("connect","dataChannel open"),mj("es.dc.open",""),e("")},_._dataChannel.onerror=function(e){cj.rtcSignalingMsgError(e.error.sdpLineNumber,e.error.errorDetail,yB.INVALID_DATA),mj("es.dc.error",""),t(e)},_._dataChannel.onclose=function(e){mj("es.dc.close",""),t(e)},_._peerConnection.addEventListener("connectionstatechange",(function(e){"failed"!==_._peerConnection.iceConnectionState&&"closed"!==_._peerConnection.iceConnectionState&&"failed"!==_._peerConnection.connectionState||t(e)}))}))];case 5:return v.sent(),VK.print("connect","dataChannel establish success"),[2,this._dataChannel]}}))}))},t.prototype.publish=function(t,r){var i,n;return r_(this,void 0,void 0,(function(){var o,a,s,c,u,d,l,h,p,f,_,v=this;return i_(this,(function(m){switch(m.label){case 0:return o=e.prototype.internalPublish.call(this,t,r),a=o.videoDescriptions,s=o.subVideoDescriptions,c=o.transceiverInit,t.audioTransceiver=this._peerConnection.addTransceiver(c.aTrack,c.audioTransceiverInit),t.videoTransceiver=this._peerConnection.addTransceiver(c.vTrack,c.videoTransceiverInit),u=NU(),cj.rtcBeginCreateOffer(EB.UP,"",""),[4,this._peerConnection.createOffer()];case 1:return d=m.sent(),cj.rtcCreateOffer(0,bB.UP,"","",NU()-u),(l=AH.parse(d.sdp)).media=null===(i=l.media)||void 0===i?void 0:i.map((function(e){return e_(e_({},e),v._offerIce)})),[4,this.setLocalDescription(AH.write(l))];case 2:return m.sent(),h=t.audioTransceiver.mid,p=t.videoTransceiver.mid,f=null,_=null,l.media=null===(n=l.media)||void 0===n?void 0:n.map((function(e){if("".concat(e.mid)===h){var t=null==(f=e)?void 0:f.rtp.find((function(e){return"opus"===e.codec}));if(t&&f.fmtp){var r=f.fmtp.find((function(e){return e.payload===t.payload}));r&&v._context&&(r.config+=v._context.audioProfileManager.getOpusConfigStr())}}else"".concat(e.mid)===p&&(_=e);return e})),this.addBitrateLimit(_,t.videoEncodeConfig[0].maxKbps),[4,this.setLocalDescription(AH.write(l))];case 3:return m.sent(),[2,{partialSdp:jH(l,f,_),audioMid:h,videoMid:p,type:"incroffer",semantics:"unified-plan",videoDescriptions:a,subVideoDescriptions:s,transceiverInit:c}]}}))}))},t.prototype.subscribe=function(e){var t,r;return r_(this,void 0,void 0,(function(){var i,n,o,a,s,c,u,d=this;return i_(this,(function(l){switch(l.label){case 0:return VK.print("subscribe()"),e.audioTransceiver=this._peerConnection.addTransceiver("audio",{direction:"recvonly"}),e.videoTransceiver=this._peerConnection.addTransceiver("video",{direction:"recvonly"}),i=NU(),cj.rtcBeginCreateOffer(EB.UP,e.streamId,e.userId),[4,this._peerConnection.createOffer()];case 1:return n=l.sent(),cj.rtcCreateOffer(0,bB.UP,e.streamId,e.userId,NU()-i),(o=AH.parse(n.sdp)).media=null===(t=o.media)||void 0===t?void 0:t.map((function(e){return e_(e_({},e),d._offerIce)})),[4,this.setLocalDescription(AH.write(o),{streamId:e.streamId||"",streamUserId:e.userId})];case 2:return l.sent(),a=e.audioTransceiver.mid,s=e.videoTransceiver.mid,c=null,u=null,null===(r=o.media)||void 0===r||r.forEach((function(e){"".concat(e.mid)===a?c=e:"".concat(e.mid)===s&&(u=e)})),[2,{partialSdp:jH(o,c,u),audioMid:a,videoMid:s,type:"incroffer",semantics:"unified-plan"}]}}))}))},t.prototype.handleAck=function(e){var t,r;return r_(this,void 0,void 0,(function(){var i,n,o,a,s,c=this;return i_(this,(function(u){return e.action===AK.unpublish||e.action===AK.unsubscribe||(i=e.signalingAck,n={},(o=AH.parse(null===(t=this._peerConnection.remoteDescription)||void 0===t?void 0:t.sdp)).media.forEach((function(e){n[e.mid]=e})),AH.parse(null==i?void 0:i.sdp).media.forEach((function(e){n[e.mid]=e_(e_({},e),c._answerIce)})),a=[],(s=AH.parse(null===(r=this._peerConnection.localDescription)||void 0===r?void 0:r.sdp)).media.forEach((function(e){a.push(n[e.mid])})),o.groups=s.groups,o.media=a,this.setRemoteDescription(AH.write(o))),[2,""]}))}))},t.prototype.getDefaultSdp=function(){return r_(this,void 0,void 0,(function(){return i_(this,(function(e){return[2,{semantics:"unified-plan",sdp:"",type:"offer"}]}))}))},t.prototype.rollback=function(e,t){var r,i;return r_(this,void 0,void 0,(function(){var e,n,o;return i_(this,(function(a){switch(a.label){case 0:return VK.print("rollback()"),t.audioTransceiver&&t.videoTransceiver?(t.audioTransceiver.stop(),t.videoTransceiver.stop(),e=[],(n=AH.parse(null===(r=this._peerConnection.localDescription)||void 0===r?void 0:r.sdp)).media=n.media.map((function(r){return"".concat(r.mid)!==t.audioMid&&"".concat(r.mid)!==t.videoMid||(r=BH(r)),"inactive"!==r.direction&&e.push(r.mid),r})),(o=AH.parse(null===(i=this._peerConnection.remoteDescription)||void 0===i?void 0:i.sdp)).media=o.media.map((function(e){return"".concat(e.mid)!==t.audioMid&&"".concat(e.mid)!==t.videoMid||(e=BH(e)),e})),n.groups&&o.groups&&(n.groups[0].mids=e.join(" "),o.groups[0].mids=e.join(" ")),[4,this._peerConnection.createOffer()]):[3,4];case 1:return a.sent(),[4,this.setLocalDescription(AH.write(n))];case 2:return a.sent(),[4,this.setRemoteDescription(AH.write(o))];case 3:a.sent(),a.label=4;case 4:return[2]}}))}))},t.prototype.setCurrentDescription=function(){return r_(this,void 0,void 0,(function(){return i_(this,(function(e){switch(e.label){case 0:return[4,this._peerConnection.createOffer()];case 1:return e.sent(),this._peerConnection.localDescription&&this._peerConnection.remoteDescription?[4,this._peerConnection.setLocalDescription(this._peerConnection.localDescription)]:[3,4];case 2:return e.sent(),[4,this._peerConnection.setRemoteDescription(this._peerConnection.remoteDescription)];case 3:e.sent(),e.label=4;case 4:return[2]}}))}))},t}(IH),BK=new rj("FallbackHandler",3),jK=function(e){function t(t,r){var i=e.call(this,t,r)||this;return i.name="fallback",BK.print("ctor","using fallback handler"),t.rtcError("using fallback handler",-1),i}return Of(t,e),t.prototype.connect=function(e){var t,r,i,n;return r_(this,void 0,void 0,(function(){var o,a,s,c,u,d,l,h,p,f,_=this;return i_(this,(function(v){switch(v.label){case 0:return BK.print("connect","invoke connect"),this._offerIce={iceUfrag:null===(t=e.iceParams)||void 0===t?void 0:t.clientIceUfrag,icePwd:null===(r=e.iceParams)||void 0===r?void 0:r.clientIcePwd,iceOptions:"renomination"},o=this,[4,GH(e)];case 1:return o._answerIce=v.sent(),[4,this._peerConnection.createOffer()];case 2:return a=v.sent(),s=AH.parse(a.sdp),!this._offerIce.iceUfrag&&!this._offerIce.icePwd&&((c="renomination"===(null===(i=s.media[0])||void 0===i?void 0:i.iceOptions))||(delete this._offerIce.iceOptions,delete this._answerIce.iceOptions),delete this._offerIce.iceUfrag,delete this._offerIce.icePwd,u=o_(KH({serverUfrag:e.iceParams.serverIceUfrag,serverPwd:e.iceParams.serverIcePwd,clientPwd:null===(n=s.media[0])||void 0===n?void 0:n.icePwd,options:(f={},f[HH.kICEConfigTypeSrtpDtlsType]=!0,f[HH.kICEConfigTypeRenominationType]=c,f)}),1),d=u[0],this._answerIce.iceUfrag=d,BK.print("use serverUfrag v2",JSON.stringify({dtls:!0,renomination:c}))),l=o_(s.media,1),h=l[0],this._offerIce.fingerprint=s.fingerprint||h.fingerprint,s.media=s.media.map((function(e){return e_(e_({},e),_._offerIce)})),(p=e_({},s)).fingerprint=this._answerIce.fingerprint,p.media=p.media.map((function(e){return e_(e_(e_({},e),_._answerIce),{sctpmap:{sctpmapNumber:5e3,app:"webrtc-datachannel",maxMessageSize:262144}})})),[4,this.setLocalDescription(a.sdp)];case 3:return v.sent(),[4,this.setRemoteDescription(AH.write(p))];case 4:return v.sent(),[4,new Promise((function(e,t){_._dataChannel.onopen=function(){BK.print("connect","dataChannel open"),mj("es.dc.open",""),e("")},_._dataChannel.onerror=function(e){cj.rtcSignalingMsgError(e.error.sdpLineNumber,e.error.errorDetail,yB.INVALID_DATA),mj("es.dc.error",""),t(e)},_._dataChannel.onclose=function(e){mj("es.dc.close",""),t(e)},_._peerConnection.addEventListener("connectionstatechange",(function(e){"failed"!==_._peerConnection.iceConnectionState&&"closed"!==_._peerConnection.iceConnectionState&&"failed"!==_._peerConnection.connectionState||t(e)}))}))];case 5:return v.sent(),BK.print("connect","dataChannel establish success"),[2,this._dataChannel]}}))}))},t.prototype.publish=function(t,r){var i;return r_(this,void 0,void 0,(function(){var n,o,a,s,c,u,d,l,h,p,f;return i_(this,(function(_){switch(_.label){case 0:return n=e.prototype.internalPublish.call(this,t,r),o=n.videoDescriptions,a=n.subVideoDescriptions,s=n.transceiverInit,t.audioTransceiver=this._peerConnection.addTransceiver(s.aTrack,s.audioTransceiverInit),t.videoTransceiver=this._peerConnection.addTransceiver(s.vTrack,s.videoTransceiverInit),c=NU(),cj.rtcBeginCreateOffer(EB.UP,"",""),[4,this._peerConnection.createOffer()];case 1:return u=_.sent(),cj.rtcCreateOffer(0,bB.UP,"","",NU()-c),d=AH.parse(u.sdp),[4,this.setLocalDescription(u.sdp)];case 2:return _.sent(),l=t.audioTransceiver.mid,h=t.videoTransceiver.mid,p=null,f=null,d.media=null===(i=d.media)||void 0===i?void 0:i.map((function(e){return"".concat(e.mid)===l?p=e:"".concat(e.mid)===h&&(f=e),e})),gH()&&(t.initVideoEncodedTransform(),t.initAudioEncodedTransform()),[2,{partialSdp:jH(d,p,f),audioMid:l,videoMid:h,type:"incroffer",semantics:"unified-plan",videoDescriptions:o,subVideoDescriptions:a,transceiverInit:s}]}}))}))},t.prototype.subscribe=function(e){var t;return r_(this,void 0,void 0,(function(){var r,i,n,o,a,s,c;return i_(this,(function(u){switch(u.label){case 0:return BK.print("subscribe()"),e.audioTransceiver=this._peerConnection.addTransceiver("audio",{direction:"recvonly"}),e.videoTransceiver=this._peerConnection.addTransceiver("video",{direction:"recvonly"}),r=NU(),cj.rtcBeginCreateOffer(EB.UP,e.streamId,e.userId),[4,this._peerConnection.createOffer()];case 1:return i=u.sent(),cj.rtcCreateOffer(0,bB.UP,e.streamId,e.userId,NU()-r),n=AH.parse(i.sdp),[4,this.setLocalDescription(i.sdp,{streamId:e.streamId||"",streamUserId:e.userId})];case 2:return u.sent(),o=e.audioTransceiver.mid,a=e.videoTransceiver.mid,s=null,c=null,null===(t=n.media)||void 0===t||t.forEach((function(e){"".concat(e.mid)===o?s=e:"".concat(e.mid)===a&&(c=e)})),gH()&&(e.initVideoEncodedTransform(),e.initAudioEncodedTransform()),[2,{partialSdp:jH(n,s,c),audioMid:o,videoMid:a,type:"incroffer",semantics:"unified-plan"}]}}))}))},t.prototype.handleAck=function(e){var t,r;return r_(this,void 0,void 0,(function(){var i,n,o,a,s,c=this;return i_(this,(function(u){return e.action===AK.unpublish||e.action===AK.unsubscribe||(i=e.signalingAck,n={},(o=AH.parse(null===(t=this._peerConnection.remoteDescription)||void 0===t?void 0:t.sdp)).media.forEach((function(e){n[e.mid]=e})),AH.parse(null==i?void 0:i.sdp).media.forEach((function(e){n[e.mid]=e_(e_({},e),c._answerIce)})),a=[],(s=AH.parse(null===(r=this._peerConnection.localDescription)||void 0===r?void 0:r.sdp)).media.forEach((function(e){a.push(n[e.mid])})),o.groups=s.groups,o.media=a,this.setRemoteDescription(AH.write(o))),[2,""]}))}))},t.prototype.getDefaultSdp=function(){return r_(this,void 0,void 0,(function(){return i_(this,(function(e){return[2,{semantics:"unified-plan",sdp:"",type:"offer"}]}))}))},t.prototype.rollback=function(e,t){var r,i;return r_(this,void 0,void 0,(function(){var e,n,o,a;return i_(this,(function(s){switch(s.label){case 0:return BK.print("rollback()"),t.audioTransceiver&&t.videoTransceiver?(t.audioTransceiver.stop(),t.videoTransceiver.stop(),e=[],(n=AH.parse(null===(r=this._peerConnection.localDescription)||void 0===r?void 0:r.sdp)).media=n.media.map((function(r){return"".concat(r.mid)!==t.audioMid&&"".concat(r.mid)!==t.videoMid||(r=BH(r)),"inactive"!==r.direction&&e.push(r.mid),r})),(o=AH.parse(null===(i=this._peerConnection.remoteDescription)||void 0===i?void 0:i.sdp)).media=o.media.map((function(e){return"".concat(e.mid)!==t.audioMid&&"".concat(e.mid)!==t.videoMid||(e=BH(e)),e})),n.groups&&o.groups&&(n.groups[0].mids=e.join(" "),o.groups[0].mids=e.join(" ")),[4,this._peerConnection.createOffer()]):[3,4];case 1:return a=s.sent(),[4,this.setLocalDescription(a.sdp)];case 2:return s.sent(),[4,this.setRemoteDescription(AH.write(o))];case 3:s.sent(),s.label=4;case 4:return[2]}}))}))},t.prototype.setCurrentDescription=function(){return r_(this,void 0,void 0,(function(){return i_(this,(function(e){switch(e.label){case 0:return[4,this._peerConnection.createOffer()];case 1:return e.sent(),this._peerConnection.localDescription&&this._peerConnection.remoteDescription?[4,this._peerConnection.setLocalDescription(this._peerConnection.localDescription)]:[3,4];case 2:return e.sent(),[4,this._peerConnection.setRemoteDescription(this._peerConnection.remoteDescription)];case 3:e.sent(),e.label=4;case 4:return[2]}}))}))},t}(IH),GK=function(e,t){return(null==t?void 0:t.enableFallbackHandler)?new jK(e,t):UU?new FK(e,t):new xK(e,t)},HK=new rj("Locker",2),zK=1,KK=function(){function e(e){this.lockingPromise=Promise.resolve(),this.locks=0,this.name="",this.lockId=zK++,e&&(this.name=e),HK.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,HK.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,HK.print("[lock-".concat(t.name,"-").concat(t.lockId,"] unlocked, current queue ").concat(t.locks,".")),r()}})),i=this.lockingPromise.then((function(){return e}));return this.lockingPromise=this.lockingPromise.then((function(){return r})),i},e}();!function(e){e[e.communication=0]="communication",e[e.live_broadcasting=1]="live_broadcasting",e[e.game=2]="game",e[e.cloud_game=3]="cloud_game",e[e.low_latency=4]="low_latency",e[e.chat=5]="chat",e[e.chat_room=6]="chat_room",e[e.lw_together=7]="lw_together",e[e.game_hd=8]="game_hd",e[e.co_host=9]="co_host",e[e.interactive_podcast=10]="interactive_podcast",e[e.ktv=11]="ktv",e[e.chorus=12]="chorus",e[e.vr_chat=13]="vr_chat",e[e.game_streaming=14]="game_streaming",e[e.lan_live_streaming=15]="lan_live_streaming",e[e.meeting=16]="meeting",e[e.meeting_room=17]="meeting_room",e[e.classroom=18]="classroom"}(kK||(kK={})),function(e){e.IES_living="IES_living",e.FeedShare="FeedShare",e.fluent="fluent",e.IES_chatroom="IES_chatroom",e.standard="standard",e.IES_PK="IES_PK",e.IES_KTV="IES_KTV"}(NK||(NK={}));var WK,XK=((wK={})[Qf.communication]=[kK.communication],wK[Qf.chat]=[kK.communication],wK[Qf.chatRoom]=[kK.live_broadcasting,NK.IES_chatroom],wK[Qf.coHost]=[kK.live_broadcasting,NK.IES_PK],wK[Qf.meeting]=[kK.meeting],wK[Qf.classRoom]=[kK.communication],wK),qK=new rj("MediaServerClient",2),YK=6e4;!function(e){e.DISCONNECTED="disconnected",e.DISCONNECTING="disconnecting",e.CONNECTED="connected",e.CONNECTING="connecting"}(WK||(WK={}));var JK,QK=function(e,t){qK.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)},ZK=function(e){function t(t,r){void 0===r&&(r=cj);var i=e.call(this)||this;return i._ontrackCallbackMap=new Map,i._subResolves={},i.supportConcurrent=!1,i._pubConfig={},i._subConfig={},i._roomProfile=Qf.communication,i._subStreamQueue={},i.monitor=r,i._pubSubLock=new KK("pubSubLock"),i._joinLeaveLock=new KK("joinLeaveLock"),i._state=WK.DISCONNECTED,i._roomAttributes={multiChatMode:!1,bigRoomMode:!1},i._context=t,i.on("SUB_END",(function(e){return i._handleSubStreamQueue(e)})),i}return Of(t,e),t.prototype._addHandlerEvents=function(){var e,t=this;null===(e=this._handler)||void 0===e||e.once("disconnect",(function(){qK.print("emit ABNORMAL_DISCONNECTION ice"),t.safeEmit(FG.ABNORMAL_DISCONNECTION)}))},t.prototype._addSignalEventHandler=function(){var e,t=this;[xG.ON_ADD_STREAM,xG.ON_REMOVE_STREAM,xG.USER_CONNECTION,xG.USER_DISCONNECTION,xG.ON_UPDATE_STREAM_ATTRIBUTES,xG.ON_UPDATE_ROOM_ATTRIBUTES,xG.ON_PUSH_TRACK,xG.ON_REMOVE_TRACK,xG.NODE_CHANGE,xG.ON_CUSTOM_MESSAGE,xG.USER_MESSAGE_RECEIVED,xG.USER_BINARY_MESSAGE_RECEIVED,xG.POST_PROCESSING_MESSAGE,xG.ON_USER_TOKEN_WILL_EXPIRE,xG.STREAM_CONTROL_MESSAGE,xG.ON_SCENE_CONFIG,xG.ON_STREAM_FAILED,VG.RSCP].forEach((function(e){var r;null===(r=t._dataChannelSignal)||void 0===r||r.on(e,(function(r){t.safeEmit(e,r)}))})),null===(e=this._dataChannelSignal)||void 0===e||e.once("close",(function(){qK.print("emit ABNORMAL_DISCONNECTION datachannel"),t.safeEmit(FG.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(FG.ON_CONNECTION_STATE_CHANGE,{prev:this._state,next:e}),this._state=e)},enumerable:!1,configurable:!0}),t.prototype.connect=function(e,t,r,i){var n;return void 0===t&&(t=""),void 0===r&&(r=""),void 0===i&&(i={}),r_(this,void 0,void 0,(function(){var o,a,s,c,u,d=this;return i_(this,(function(l){switch(l.label){case 0:return this.connectionState=WK.CONNECTING,this._appId=e,this._handler&&(this._removeSignalEventHandler(),this._handler.destroy()),i.node?(o=[i.node],mj("es.join.nodeChange",i),[3,3]):[3,1];case 1:return Promise.resolve().then((function(){return d.emit("onGetIceConfigHook")})),this._iceConfigRequestManager=new eH,[4,null===(n=this._iceConfigRequestManager)||void 0===n?void 0:n.getAccessNode(e,t,r,zF.getDeviceId(),null==i?void 0:i.reason,null==i?void 0:i.feedbackNode,this._useCloudProxy)];case 2:if(!(o=l.sent()))throw mj("es.join.getNodeFailed",""),new oG(Zj.ICE_SERVER_WRONG,"get ICE config failed");mj("es.join.getNodeSuccess",o),l.label=3;case 3:this._addHandlerEvents(),Promise.resolve().then((function(){return d.emit("onEstablishConnectionHook")})),l.label=4;case 4:return l.trys.push([4,6,,7]),s=!1,c=o.map((function(e){var t=GK(d.monitor,d._context);return t.connect(e).then((function(r){s?t.destroy():(s=!0,a=r,d.safeEmit("prevIceNode",e),d._handler=t,d.supportConcurrent="chrome"===t.name,d._addHandlerEvents())})).catch((function(){t.destroy()}))})),[4,ZU(c)];case 5:return l.sent(),qK.print("join","establish peerConnection success"),[3,7];case 6:throw u=l.sent(),this.connectionState=WK.DISCONNECTED,new oG(Zj.ESTABLISH_DATACHANNEL_FAILED,"establish dataChannel failed",u);case 7:if(!a)throw this.connectionState=WK.DISCONNECTED,new oG(Zj.ESTABLISH_DATACHANNEL_FAILED,"establish dataChannel failed");return this._dataChannelSignal=new QG(a),this._addSignalEventHandler(),this._dataChannelSignal.sendPingSignaling(),[2]}}))}))},t.prototype.join=function(e,t,r,i){var n,o,a,s,c,u,d,l,h,p,f;return void 0===t&&(t={}),void 0===r&&(r=!1),r_(this,void 0,void 0,(function(){var _,v,m,y,g,S,E,b=this;return i_(this,(function(I){switch(I.label){case 0:return qK.print("join()","info: %o, params: %o, reconnect: %o, controlMessage: %o",e,t,r,i),this._appId=e.appId,this._token=e.token,this._roomId=e.roomId,this._clientId=e.userInfo.userId,this._businessId=e.userInfo.businessId,this._userInfo=e.userInfo,this._useCloudProxy=e.useCloudProxy,this._roomProfile=e.roomProfile,this._sessionId=t.sessionId,[4,this.connect(this._appId,this._roomId,this._clientId,t)];case 1:return I.sent(),S={Authorization:MU.token2auth(this._appId,this._roomId,this._clientId,this._token),sessionId:this._sessionId||"",timestamp:Date.now(),controlMessage:i,userAttributes:{extra_info:this._userInfo.extraInfo,role:this._userInfo.role}},E={},[4,yH()];case 2:return S.params=(E.supportedCodecs=I.sent(),E.deviceType="web",E.userAgent=window.navigator.userAgent,E.sdkVersion=YF.VERSION,E.deviceId=zF.getDeviceId(),E.appId=this._appId,E.roomId=this._roomId,E.userId=this._clientId,E.businessId=this._businessId,E.enableCloudProxy=this._useCloudProxy,E.channelProfile=XK[this._roomProfile]?XK[this._roomProfile][0]+"":"0",E),S.options={supportTokenExpireCallBack:!0,enableSceneConfigV2:!0},S.accessParams=JSON.stringify({requireICEUfragV2:!0}),_=S,"chrome"!==(null===(n=this.handler)||void 0===n?void 0:n.name)?[3,4]:(v=_,[4,null===(o=this._handler)||void 0===o?void 0:o.getDefaultSdp()]);case 3:v.sdpInfo=I.sent(),_.options.enableUnBundleMode=!0,I.label=4;case 4:Promise.resolve().then((function(){return b.emit("onSendingJoinMessageHook")})),I.label=5;case 5:return I.trys.push([5,7,,8]),m=r?"reconnected":"joinRoom",[4,this._dataChannelSignal.sendSignaling(m,_)];case 6:return y=I.sent(),qK.print("join","send join message success"),this._authorization=_.Authorization,this.connectionState=WK.CONNECTED,yK.audioStallConfig=null===(a=y.config)||void 0===a?void 0:a.engine_WEB,this._pubConfig.audioRed=!!(null===(c=null===(s=y.config)||void 0===s?void 0:s.engine_WEB)||void 0===c?void 0:c.pub_audio_red),this._subConfig.muteReplaceUnsub=!!(null===(u=y.config)||void 0===u?void 0:u.mute_replace_unsub),this._pubConfig.simulcastOnDemand=!(!1===(null===(h=null===(l=null===(d=y.config)||void 0===d?void 0:d.engine_VPM)||void 0===l?void 0:l.ondemand)||void 0===h?void 0:h.enable)),null===(p=this._context)||void 0===p||p.audioProfileManager.updateEngineBAC(null===(f=y.config)||void 0===f?void 0:f.engine_BAC),[2,y];case 7:if(g=I.sent(),this.connectionState=WK.DISCONNECTED,(null==g?void 0:g.code)>=700&&(null==g?void 0:g.code)<800)throw new oG(Zj.INVALID_TOKEN,(null==g?void 0:g.message)||"Invalid token");if(200!==(null==g?void 0:g.code))throw new oG(Zj.JOIN_ROOM_FAILED,(null==g?void 0:g.message)||"Join room failed");return[3,8];case 8:return[2]}}))}))},t.prototype.publish=function(e){var t,r,i,n,o,a,s,c;return r_(this,void 0,void 0,(function(){var u,d,l,h,p,f,_,v,m,y,g=this;return i_(this,(function(S){switch(S.label){case 0:qK.print("publish()","localStream: %o",e),u=e.videoTrack,d=e.audioTrack,l=NU(),h="",p="",S.label=1;case 1:return S.trys.push([1,6,,8]),[4,null===(t=this._handler)||void 0===t?void 0:t.publish(e,this._pubConfig)];case 2:if(!(f=S.sent()))throw new oG(Zj.ADD_TRANSCEIVER_FAILED,"add transceiver failed");return h=f.audioMid,p=f.videoMid,e.pubAttributes={localaudio:!!d,localvideo:!!u,videostream:e.pubVideo,audiostream:e.pubAudio,extvideo:!!(u instanceof Wz),extaudio:!!(d instanceof Xz)},_={attributes:e_({videoDescriptions:f.videoDescriptions},e.pubAttributes),audio:!0,video:!0,screen:e.isScreen,audioMid:h,videoMid:p,sdpInfo:{msid:e.stream.id,type:f.type,sdp:f.partialSdp,semantics:f.semantics}},e.enableSimulcast&&this._pubConfig.simulcastOnDemand&&(null===(r=f.subVideoDescriptions)||void 0===r?void 0:r.length)&&(_.attributes.subVideoDescriptions=f.subVideoDescriptions),[4,null===(i=this._dataChannelSignal)||void 0===i?void 0:i.sendSignaling("publish",_)];case 3:if(200!==(null==(v=S.sent())?void 0:v.code))throw new oG(Zj.PUBLISH_FAILED,(null==v?void 0:v.message)||"publish failed");return cj.rtcRecvAnswer(0,AB.INCRANSWER,(null===(n=null==v?void 0:v.relayMessage)||void 0===n?void 0:n.sequenceId)||0,null===(o=null==v?void 0:v.relayMessage)||void 0===o?void 0:o.sdp,RB.UP,"",""),m=new Promise((function(t,r){var i,n,o,a,s;null===(i=g._handler)||void 0===i||i.handleAck({action:AK.publish,streamId:v.streamId,audioMid:h,videoMid:p,transceiverInit:f.transceiverInit,signalingAck:{audioMid:null===(n=null==v?void 0:v.relayMessage)||void 0===n?void 0:n.audioMid,videoMid:null===(o=null==v?void 0:v.relayMessage)||void 0===o?void 0:o.videoMid,sdp:null===(a=null==v?void 0:v.relayMessage)||void 0===a?void 0:a.sdp,sequenceId:null===(s=null==v?void 0:v.relayMessage)||void 0===s?void 0:s.sequenceId},stream:e,onSuccess:function(){qK.print("publish()","publish success"),t(0)}})})),"chrome"!==(null===(a=this.handler)||void 0===a?void 0:a.name)?[3,5]:[4,m];case 4:S.sent(),S.label=5;case 5:return zU||null===(s=this._handler)||void 0===s||s.updateDegradationPreference(e),e.streamId=v.streamId,e.videoMid=p,e.audioMid=h,e.subVideoDescriptions=f.subVideoDescriptions,this.monitor.rtcPublishStat(CB.SUCCESS,OB.W_0,l,wB.UNKNOWN),e.statsReport.setLocalStreamStatsEvtInterval(this,this._handler,this.monitor),[2];case 6:return(y=S.sent())instanceof Error&&this.monitor.rtcPublishStat(CB.FAIL,OB.W_0,l,y.message),[4,null===(c=this._handler)||void 0===c?void 0:c.rollback(e.stream.id,e)];case 7:throw S.sent(),y;case 8:return[2]}}))}))},t.prototype.updatePubTrack=function(e){var t,r,i,n,o,a,s,c,u;return r_(this,void 0,void 0,(function(){var d,l,h,p,f,_,v,m,y,g,S,E,b,I,T,A,R,C,O,w,k,N,P,D,M,L,U;return i_(this,(function(x){switch(x.label){case 0:return qK.print("updatePubTrack()","localStream: %o",e),d=e.videoTrack,l=e.audioTrack,h=e.pubAudio,p=e.pubVideo,f=null==l?void 0:l.getTrack(),_=null==d?void 0:d.getTrack(),p&&_?null===(t=e.videoTransceiver)||void 0===t||t.sender.replaceTrack(_):null===(r=e.videoTransceiver)||void 0===r||r.sender.replaceTrack(null),zU?[3,2]:[4,null===(i=this._handler)||void 0===i?void 0:i.updateDegradationPreference(e)];case 1:x.sent(),x.label=2;case 2:null===(n=this._handler)||void 0===n||n.updateMaxBitrate(e),h&&f?(m=(v=l).mixType,(y=v.mixedAudioTrack)&&m!==u_.PLAYOUT&&!0===f.enabled&&(f=y),null===(o=e.audioTransceiver)||void 0===o||o.sender.replaceTrack(f)):(null===(a=e.audioTransceiver)||void 0===a||a.sender.replaceTrack(null),this.monitor.rtcInvokeStatus("null",0,"MediaClient.updatePubTrack(audio)","",0));try{this.monitor.rtcInvokeStatus(JSON.stringify({audioStreamTrack:ix(f),videoStreamTrack:ix(_)}),0,"MediaClient.updatePubTrack","",0)}catch(e){}g={localaudio:!!l,localvideo:!!d,videostream:p,audiostream:h,extvideo:!!(d instanceof Wz),extaudio:!!(l instanceof Xz)},S={};try{for(E=n_(Object.entries(g)),b=E.next();!b.done;b=E.next())I=o_(b.value,2),T=I[0],(A=I[1])!==Reflect.get(e.pubAttributes,T)&&Reflect.set(S,T,A)}catch(e){L={error:e}}finally{try{b&&!b.done&&(U=E.return)&&U.call(E)}finally{if(L)throw L.error}}return Object.keys(S).length?(e.observer&&(R=e.observer,C=S.audiostream,O=S.videostream,w=S.localaudio,N=S.extaudio,P=S.extvideo,void 0!==(k=S.localvideo)?void 0!==P?R.setPushVideo(P):R.setEnableVideo(k):void 0!==O&&R.setUnmuteVideo(O),void 0!==w?void 0!==N?R.setPushAudio(N):R.setEnableAudio(w):void 0!==C&&R.setUnmuteAudio(C)),e.pubAttributes=g,D={roomId:this._roomId,streamId:e.streamId,attributes:S},[4,null===(s=this._dataChannelSignal)||void 0===s?void 0:s.sendSignaling("updateStreamAttributes",D)]):[2];case 3:if(200!==(null==(M=x.sent())?void 0:M.code))throw new oG(Zj.UPDATE_TRACK_FAILED,(null==M?void 0:M.message)||"update track failed");return"chrome"===(null===(c=this.handler)||void 0===c?void 0:c.name)?[3,5]:[4,null===(u=this._handler)||void 0===u?void 0:u.setCurrentDescription()];case 4:x.sent(),x.label=5;case 5:return[2]}}))}))},t.prototype.updateToken=function(e){var t,r,i;return r_(this,void 0,void 0,(function(){var n,o;return i_(this,(function(a){switch(a.label){case 0:if(qK.print("updateToken()","newToken: %o",e),this._token=e,!this._appId||!(null===(t=this._userInfo)||void 0===t?void 0:t.userId)||!this._roomId)return[2];n={roomId:this._roomId,userId:null===(r=this._userInfo)||void 0===r?void 0:r.userId,appId:this._appId,token:"Bearer ".concat(e)},a.label=1;case 1:return a.trys.push([1,3,,4]),[4,null===(i=this._dataChannelSignal)||void 0===i?void 0:i.sendSignaling("updateToken",n)];case 2:if(200!==(null==(o=a.sent())?void 0:o.code))throw new oG(Zj.UPDATE_TOKEN_WITH_INVALID_TOKEN,"invoke updateToken with an invalid token");return[3,4];case 3:throw a.sent(),new oG(Zj.UPDATE_TOKEN_WITH_INVALID_TOKEN,"invoke updateToken with an invalid token");case 4:return[2]}}))}))},t.prototype.unpublish=function(e){var t,r,i;return r_(this,void 0,void 0,(function(){var n;return i_(this,(function(o){switch(o.label){case 0:return qK.print("unpublish()","localStream: %o",e),n={roomId:this._roomId,initStreamId:e.initStreamId,streamId:e.streamId},null===(t=this._dataChannelSignal)||void 0===t||t.sendSignaling("unpublish",n),[4,null===(r=this._handler)||void 0===r?void 0:r.handleAck({action:AK.unpublish,audioMid:e.audioMid,videoMid:e.videoMid,stream:e,streamId:e.streamId})];case 1:return o.sent(),e.statsReport.unpublish(),[4,null===(i=this._handler)||void 0===i?void 0:i.rollback(e.stream.id,e)];case 2:return o.sent(),[2]}}))}))},t.prototype.subscribe=function(e,t,r){return r_(this,void 0,void 0,(function(){var i=this;return i_(this,(function(n){return[2,new Promise((function(n,o){return r_(i,void 0,void 0,(function(){var i,a,s,c,u,d,l,h,p,f,_,v,m,y,g,S,E,b,I,T,A,R,C,O,w,k,N,P,D,M,L,U,x,V=this;return i_(this,(function(F){switch(F.label){case 0:if(e.streamState===gK.SUB_ED)return[2,this._updateSubTrack(e,t,_K.SUB).then(n,o)];if(e.streamState===gK.SUB_ING)return this._subStreamQueue[e.streamId]||(this._subStreamQueue[e.streamId]=[]),qK.print("_subStreamQueue","streamId: %o, enqueue",e.streamId),this._subStreamQueue[e.streamId].push({fn:this.subscribe,args:[e,t,r],resolve:n,reject:o}),[2];if(qK.print("subscribe()","mediaType: %o",t),QK("subscribe()",e),e.streamState=gK.SUB_ING,i=!1,a=!1,ex(t)&&(a=!0),tx(t)&&(i=!0),!i&&this._multiChatMode())return e.streamState=gK.INIT,this.emit("SUB_END",e.streamId),[2,n(null)];s=NU(),c=e.audioMid,u=e.videoMid,l=e.paused,h=e.subVideo,F.label=1;case 1:return F.trys.push([1,9,,11]),c&&u?[4,null===(R=this._handler)||void 0===R?void 0:R.subscribe(e,{audioMid:c,videoMid:u})]:[3,3];case 2:return d=F.sent(),[3,5];case 3:return[4,null===(C=this._handler)||void 0===C?void 0:C.subscribe(e)];case 4:if(!(d=F.sent()))throw new oG(Zj.ADD_TRANSCEIVER_FAILED,"add transceiver failed");c=d.audioMid,u=d.videoMid,F.label=5;case 5:return e.paused=!i,e.subVideo=i,p={spatialLayer:(null==r?void 0:r.spatialLayer)||0,temporalLayer:0,spatialSubLayer:(null==r?void 0:r.spatialSubLayer)||-1},f={audio:!this._multiChatMode(),video:!0,data:!0,screen:e.isScreen,browser:"chrome-stable",videoMid:u,audioMid:c,sdpInfo:{sdp:null==d?void 0:d.partialSdp,semantics:null==d?void 0:d.semantics,type:null==d?void 0:d.type},streamUserId:e.userId,streamId:e.streamId,config:{enableMediaType:{audio:!!this._multiChatMode()||a,video:i},qualityLayer:p}},[4,null===(O=this._dataChannelSignal)||void 0===O?void 0:O.sendSignaling("subscribe",f)];case 6:if(200!==(null==(_=F.sent())?void 0:_.code))throw new oG(Zj.SUBSCRIBE_FAILED,(null==_?void 0:_.message)||"subscribe failed");return v=[],m=!this._multiChatMode(),y=!e.videoTrack,this._subResolves[e.streamId]||(this._subResolves[e.streamId]=[]),y&&v.push(new Promise((function(t,r){V._subResolves[e.streamId].push(t);var i=setTimeout((function(){return r(new oG(Zj.TIME_OUT,"wait video timeout for userId: ".concat(e.userId)))}),YK);e.on("ontrack",(function r(n){"video"===n.mediaType&&(qK.print("remoteStream ".concat(e.userId," received video track")),e.off("ontrack",r),clearTimeout(i),t(0))}))}))),m&&v.push(new Promise((function(t,r){V._subResolves[e.streamId].push(t);var i=setTimeout((function(){return r(new oG(Zj.TIME_OUT,"wait audio timeout for userId: ".concat(e.userId)))}),YK);e.on("ontrack",(function r(n){"audio"===n.mediaType&&(qK.print("remoteStream ".concat(e.userId," received audio track")),e.off("ontrack",r),clearTimeout(i),t(0))}))}))),g=function(t){e.ontrack(t)},null===(w=this._handler)||void 0===w||w.on("ontrack",g),this._ontrackCallbackMap.set(e,g),S=null==_?void 0:_.relayMessage,E=S.audioMid,b=S.videoMid,(A={})[c]=E,A[u]=b,I=A,qK.print("sub midmap",e.userId,I),e.videoMid=b,e.audioMid=E,e._workaround_1_=!1,e.subMediaType=t,e.streamState=gK.SUB_ED,e.subLayer=p,cj.rtcRecvAnswer(0,AB.INCRANSWER,(null===(k=null==_?void 0:_.relayMessage)||void 0===k?void 0:k.sequenceId)||0,null===(N=null==_?void 0:_.relayMessage)||void 0===N?void 0:N.sdp,RB.DOWN,e.streamId,e.userId),[4,null===(P=this._handler)||void 0===P?void 0:P.handleAck({action:AK.subscribe,streamId:e.streamId,audioMid:c,videoMid:u,transceiverInit:null==d?void 0:d.transceiverInit,signalingAck:{audioMid:null===(D=null==_?void 0:_.relayMessage)||void 0===D?void 0:D.audioMid,videoMid:null===(M=null==_?void 0:_.relayMessage)||void 0===M?void 0:M.videoMid,sdp:null===(L=null==_?void 0:_.relayMessage)||void 0===L?void 0:L.sdp,sequenceId:null===(U=null==_?void 0:_.relayMessage)||void 0===U?void 0:U.sequenceId},stream:e})];case 7:return F.sent(),[4,Promise.all(v)];case 8:return F.sent(),this._multiChatMode()||(e.subAudio=a),this.monitor.rtcSubscribeStat(kB.SUCCESS,s,NB.UNKNOWN,e.userId),e.statsReport.setRemoteStreamStatsEvtInterval(this,this._handler,this.monitor),n(null),this.emit("SUB_END",e.streamId),[3,11];case 9:return(T=F.sent())instanceof Error&&this.monitor.rtcSubscribeStat(kB.FAIL,s,T.message,e.userId),e.paused=l,e.subVideo=h,e.streamState=gK.INIT,[4,null===(x=this._handler)||void 0===x?void 0:x.rollback(e.streamId,e)];case 10:return F.sent(),o(T),this.emit("SUB_END",e.streamId),[3,11];case 11:return[2]}}))}))}))]}))}))},t.prototype._handleSubStreamQueue=function(e){var t,r=this;if(null===(t=this._subStreamQueue[e])||void 0===t?void 0:t.length){qK.print("_subStreamQueue","streamId: %o, exec",e);var i=this._subStreamQueue[e].shift(),n=i.fn,o=i.args,a=i.resolve,s=i.reject;n.apply(this,o).then(a,s).finally((function(){return r._handleSubStreamQueue(e)}))}else qK.print("_subStreamQueue","streamId: %o, END",e)},t.prototype.controlMessage=function(e){var t;return r_(this,void 0,void 0,(function(){var r;return i_(this,(function(i){switch(i.label){case 0:return qK.print("controlMessage()","params: %o",e),r=e,"transcode"===e.type&&(r.roomId=this._roomId),[4,null===(t=this._dataChannelSignal)||void 0===t?void 0:t.sendSignaling("controlMessage",r)];case 1:return i.sent(),[2]}}))}))},t.prototype.updateUserAttributes=function(e){var t;return r_(this,void 0,void 0,(function(){return i_(this,(function(r){switch(r.label){case 0:return qK.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,i){return r_(this,void 0,void 0,(function(){return i_(this,(function(i){return[2,this._updateSubTrack(e,t,r)]}))}))},t.prototype.updateSubTrackLayer=function(e,t){var r;return r_(this,void 0,void 0,(function(){var i,n,o;return i_(this,(function(a){switch(a.label){case 0:return qK.print("updateSubTrack()","subLayer: %o",t),i=t||e.subLayer,n={roomId:this._roomId,streamList:[e.streamId],config:{qualityLayer:i}},[4,null===(r=this._dataChannelSignal)||void 0===r?void 0:r.sendSignaling("updateSubscribe",n)];case 1:if(200!==(null==(o=a.sent())?void 0:o.code))throw new oG(Zj.UPDATE_TRACK_FAILED,(null==o?void 0:o.message)||"update track failed");return e.subLayer=i,[2,e]}}))}))},t.prototype._updateSubTrack=function(e,t,r){var i,n,o;return r_(this,void 0,void 0,(function(){var a,s,c,u,d;return i_(this,(function(l){switch(l.label){case 0:return qK.print("updateSubTrack()","mediaType: %o",t),QK("updateSubTrack()",e),a=0,a=r===_K.SUB?e.subMediaType|t:e.subMediaType-(e.subMediaType&t),qK.print("updateSubTrack","prev: %o, direction: %o, mediaType: %o, newMediaType: %o",e.subMediaType,r,t,a),e.subMediaType===a&&qK.print("updateSubTrack","mediaType no change"),s=!1,c=!1,ex(a)&&(c=!0),tx(a)&&(s=!0),u={roomId:this._roomId,streamList:[e.streamId],config:{enableMediaType:{video:s,audio:!!this._multiChatMode()||c}}},[4,null===(i=this._dataChannelSignal)||void 0===i?void 0:i.sendSignaling("updateSubscribe",u)];case 1:if(200!==(null==(d=l.sent())?void 0:d.code))throw new oG(Zj.UPDATE_TRACK_FAILED,(null==d?void 0:d.message)||"update track failed");return e.paused=!s,this._multiChatMode()||(null===(n=e.observer)||void 0===n||n.setUnmuteAudio(c),e.subAudio=c),null===(o=e.observer)||void 0===o||o.setUnmuteVideo(s),e.subVideo=s,e.subMediaType=a,[2,e]}}))}))},t.prototype.subscribe4pushTrack=function(e,t){var r,i,n,o,a;return r_(this,void 0,void 0,(function(){var s,c,u,d,l,h,p,f,_,v,m,y=this;return i_(this,(function(g){switch(g.label){case 0:if(qK.print("subscribe4pushTrack()","streamInfo: %o",t),QK("subscribe4pushTrack()",e),s=null==t?void 0:t.message,c=s.audioMid,u=s.videoMid,d=s.sequenceId,e.subAudio=!0,d<e.sequenceId)return qK.print("subscribe4pushTrack","sequenceId return",d,e.sequenceId),[2];l=e.audioMid,h=e.videoMid,null===(r=e.observer)||void 0===r||r.setPushTrack(!0),g.label=1;case 1:return g.trys.push([1,8,,9]),l&&h?[4,null===(i=this._handler)||void 0===i?void 0:i.subscribe(e,{audioMid:l,videoMid:h})]:[3,3];case 2:return p=g.sent(),[3,5];case 3:return[4,null===(n=this._handler)||void 0===n?void 0:n.subscribe(e)];case 4:if(!(p=g.sent()))throw new oG(Zj.ADD_TRANSCEIVER_FAILED,"add transceiver failed");l=p.audioMid,h=p.videoMid,g.label=5;case 5:return(m={})[l]=c,m[h]=u,f=m,qK.print("onpushtrack midmap",e.userId,f),e.audioMid=c,e.videoMid=u,e.sequenceId=d,this._subResolves[e.streamId]||(this._subResolves[e.streamId]=[]),_=[],e.audioTrack||_.push(new Promise((function(t,r){y._subResolves[e.streamId].push(t);var i=setTimeout((function(){return r(new oG(Zj.TIME_OUT,"wait audio timeout for userId: ".concat(e.userId)))}),YK);e.on("ontrack",(function r(n){"audio"===n.mediaType&&(qK.print("remoteStream ".concat(e.userId," received audio track")),e.off("ontrack",r),clearTimeout(i),t(0))}))}))),v=function(t){e.ontrack(t)},null===(o=this._handler)||void 0===o||o.on("ontrack",v),this._ontrackCallbackMap.set(e,v),[4,null===(a=this._handler)||void 0===a?void 0:a.handleAck({action:AK.pushtrack,streamId:e.streamId,audioMid:l,videoMid:h,stream:e,transceiverInit:null==p?void 0:p.transceiverInit,signalingAck:null==t?void 0:t.message})];case 6:return g.sent(),[4,Promise.all(_)];case 7:return g.sent(),e.statsReport.setRemoteStreamStatsEvtInterval(this,this._handler,this.monitor),[2];case 8:throw g.sent();case 9:return[2]}}))}))},t.prototype.unsubscribe4removeTrack=function(e,t){var r,i,n;return r_(this,void 0,void 0,(function(){return i_(this,(function(o){switch(o.label){case 0:return QK("unsubscribe4removeTrack()",e),qK.print("unsubscribe4removeTrack()","sequenceId: ",t.sequenceId),t.sequenceId<e.sequenceId?(qK.print("unsubscribe4removeTrack()","sequenceId return"),[2]):(e.subAudio=!1,e.subVideo||e.paused?(e.sequenceId=t.sequenceId,[2]):(null===(r=e.observer)||void 0===r||r.setPushTrack(!1),[4,null===(i=this._handler)||void 0===i?void 0:i.handleAck({action:AK.removetrack,streamId:e.streamId,audioMid:e.audioMid,videoMid:e.videoMid,stream:e})]));case 1:return o.sent(),[4,null===(n=this._handler)||void 0===n?void 0:n.rollback(e.streamId,e)];case 2:return o.sent(),this._subResolves[e.streamId]&&this._subResolves[e.streamId].forEach((function(e){return e(0)})),qK.print("clean unsubscribe4removeTrack"),e.clean(),e.resetHasSubscribed(),e.statsReport.unsubscribe(),[2]}}))}))},t.prototype.unsubscribe=function(e,t,r){var i,n,o,a,s;return void 0===r&&(r=!1),r_(this,void 0,void 0,(function(){var c,u,d;return i_(this,(function(l){switch(l.label){case 0:return QK("unsubscribe()",e),c=e.subMediaType-(e.subMediaType&t),r||!this._subConfig.muteReplaceUnsub&&c===$z.NONE?(u={roomId:this._roomId,streamId:e.streamId,userId:e.userId},null===(i=this._dataChannelSignal)||void 0===i||i.sendSignaling("unsubscribe",u).catch((function(){})),e.streamState=gK.INIT,this._subStreamQueue[e.streamId]&&(this._subStreamQueue[e.streamId].forEach((function(e){return(0,e.resolve)(null)})),delete this._subStreamQueue[e.streamId]),e.subVideo=!1,e.paused=!1,e._workaround_1_||(e.subAudio=!1),null===(n=e.observer)||void 0===n||n.setSubscribeVideo(!1),e.subAudio?[3,3]:(null===(o=e.observer)||void 0===o||o.setSubscribeAudio(!1),[4,null===(a=this._handler)||void 0===a?void 0:a.handleAck({action:AK.unsubscribe,streamId:e.streamId,audioMid:e.audioMid,videoMid:e.videoMid,stream:e})])):[2,this._updateSubTrack(e,t,_K.UNSUB)];case 1:return d=l.sent(),[4,null===(s=this._handler)||void 0===s?void 0:s.rollback(e.streamId,e)];case 2:l.sent(),this._subResolves[d]&&this._subResolves[d].forEach((function(e){return e(0)})),qK.print("unsubscribe","clean unsub ".concat(e.userId)),e.clean(),this.removeOnTrackListener(e),e.statsReport.unsubscribe(),l.label=3;case 3:return[2]}}))}))},t.prototype.removeOnTrackListener=function(e){var t,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 r_(this,void 0,void 0,(function(){return i_(this,(function(r){return QK("handleRemoveStream()",e),e.subVideo=!1,t.message&&t.message!==LG.videoMuted?e._workaround_1_=!1:e._workaround_1_=!0,this._multiChatMode()&&e._workaround_1_?(this.unsubscribe(e,Ff.AUDIO_AND_VIDEO,!0),[2]):[2]}))}))},t.prototype.leave=function(){var e;return r_(this,void 0,void 0,(function(){var t,r,i;return i_(this,(function(n){switch(n.label){case 0:return qK.print("leave()"),this.connectionState!==WK.CONNECTED?[3,7]:(this.connectionState=WK.DISCONNECTING,t={Authorization:this._authorization,roomId:this._roomId,sessionId:this._sessionId},[4,this._joinLeaveLock.lock()]);case 1:r=n.sent(),n.label=2;case 2:return n.trys.push([2,4,5,6]),[4,null===(e=this._dataChannelSignal)||void 0===e?void 0:e.sendSignaling("leaveRoom",t)];case 3:return n.sent(),this.connectionState=WK.DISCONNECTED,[3,6];case 4:throw i=n.sent(),this.connectionState=WK.CONNECTED,i;case 5:return r(),[7];case 6:return[3,8];case 7:return[2,Promise.reject(new oG(Zj.NOT_CONNECTED_YET,"server not connected"))];case 8:return[2]}}))}))},t.prototype.subscribePublicStream=function(e){var t,r,i,n;return r_(this,void 0,void 0,(function(){var o,a,s,c,u,d,l,h,p,f,_,v,m,y,g,S=this;return i_(this,(function(E){switch(E.label){case 0:return[4,null===(t=this._handler)||void 0===t?void 0:t.subscribe(e)];case 1:if(!(o=E.sent()))throw new oG(Zj.ADD_TRANSCEIVER_FAILED,"add transceiver failed");return a=NU(),s=o.audioMid,c=o.videoMid,y={appId:this._appId,streamId:e.streamId,audio:!0,video:!0,data:!0,audioMid:s,videoMid:c,sdpInfo:{sdp:null==o?void 0:o.partialSdp,semantics:null==o?void 0:o.semantics,type:null==o?void 0:o.type}},g={},[4,yH()];case 2:return y.params=(g.supportedCodecs=E.sent(),g.deviceType="web",g.userAgent=window.navigator.userAgent,g.sdkVersion=YF.VERSION,g.deviceId=zF.getDeviceId(),g.appId=this._appId,g.businessId=this._businessId,g.enableCloudProxy=this._useCloudProxy,g),y.config={enableMediaType:{audio:!0,video:!0},qualityLayer:{spatialLayer:0,temporalLayer:0}},u=y,[4,null===(r=this._dataChannelSignal)||void 0===r?void 0:r.sendSignaling("startPullStream",u)];case 3:return d=E.sent(),l=[],this._subResolves[e.streamId]=[],l.push(new Promise((function(t,r){S._subResolves[e.streamId].push(t);var i=setTimeout((function(){return r(new oG(Zj.TIME_OUT,"wait video timeout for streamId: ".concat(e.streamId)))}),YK);e.on("ontrack",(function r(n){"video"===n.mediaType&&(qK.print("remoteStream ".concat(e.userId," received video track")),e.off("ontrack",r),clearTimeout(i),t(0))}))}))),l.push(new Promise((function(t,r){S._subResolves[e.streamId].push(t);var i=setTimeout((function(){return r(new oG(Zj.TIME_OUT,"wait audio timeout for streamId: ".concat(e.streamId)))}),YK);e.on("ontrack",(function r(n){"audio"===n.mediaType&&(qK.print("remoteStream ".concat(e.userId," received audio track")),e.off("ontrack",r),clearTimeout(i),t(0))}))}))),h=function(t){e.ontrack(t)},null===(i=this._handler)||void 0===i||i.on("ontrack",h),this._ontrackCallbackMap.set(e,h),p=null==d?void 0:d.relayMessage,f=p.audioMid,_=p.videoMid,v=p.sequenceId,m=p.sdp,e.videoMid=_,e.audioMid=f,e.sequenceId=v,e._workaround_1_=!1,e.paused=!1,e.streamState=gK.SUB_ED,e.subAudio=!0,e.subVideo=!0,[4,null===(n=this._handler)||void 0===n?void 0:n.handleAck({action:AK.subscribe,streamId:e.streamId,audioMid:s,videoMid:c,transceiverInit:null==o?void 0:o.transceiverInit,signalingAck:{audioMid:f,videoMid:_,sdp:m,sequenceId:v},stream:e})];case 4:return E.sent(),[4,Promise.all(l)];case 5:return E.sent(),this.monitor.rtcSubscribeStat(kB.SUCCESS,a,NB.UNKNOWN,e.userId),e.statsReport.setRemoteStreamStatsEvtInterval(this,this._handler,this.monitor),[2]}}))}))},t.prototype.unsubscribePublicStream=function(e){var t,r,i;return r_(this,void 0,void 0,(function(){var n;return i_(this,(function(o){switch(o.label){case 0:QK("unsubscribePublicStream()",e),n={appId:this._appId,streamId:e.streamId},o.label=1;case 1:return o.trys.push([1,3,,4]),[4,null===(t=this._dataChannelSignal)||void 0===t?void 0:t.sendSignaling("stopPullStream",n)];case 2:case 3:return o.sent(),[3,4];case 4:return e.streamState=gK.INIT,e.subVideo=!1,e.subAudio=!1,[4,null===(r=this._handler)||void 0===r?void 0:r.handleAck({action:AK.unsubscribe,streamId:e.streamId,audioMid:e.audioMid,videoMid:e.videoMid,stream:e})];case 5:return o.sent(),[4,null===(i=this._handler)||void 0===i?void 0:i.rollback(e.streamId,e)];case 6:return o.sent(),e.clean(),this.removeOnTrackListener(e),e.statsReport.unsubscribe(),[2]}}))}))},t.prototype.destroy=function(){var e,t,r;qK.print("destroy()"),this._token=void 0,this._appId=void 0,this._roomId=void 0,this._clientId=void 0,this._authorization=void 0,this._sessionId=void 0,this._context=void 0,null===(e=this._handler)||void 0===e||e.destroy(),null===(t=this._dataChannelSignal)||void 0===t||t.destroy(),null===(r=this._iceConfigRequestManager)||void 0===r||r.abort(),this._handler=void 0,this._dataChannelSignal=void 0,this._iceConfigRequestManager=void 0,this._removeSignalEventHandler(),this.connectionState=WK.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}),t_([tW],t.prototype,"join",null),t_([eW,$K],t.prototype,"publish",null),t_([eW,$K],t.prototype,"updatePubTrack",null),t_([eW,$K],t.prototype,"unpublish",null),t_([eW,$K],t.prototype,"subscribe",null),t_([$K],t.prototype,"controlMessage",null),t_([$K],t.prototype,"updateUserAttributes",null),t_([$K],t.prototype,"updateSubTrack",null),t_([$K],t.prototype,"updateSubTrackLayer",null),t_([$K],t.prototype,"subscribe4pushTrack",null),t_([$K],t.prototype,"unsubscribe4removeTrack",null),t_([eW,$K],t.prototype,"unsubscribe",null),t_([$K],t.prototype,"handleRemoveStream",null),t_([eW],t.prototype,"subscribePublicStream",null),t_([eW],t.prototype,"unsubscribePublicStream",null),t}(oj);function $K(e,t,r){var i=r.value;return r.value=function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];return r_(this,void 0,void 0,(function(){return i_(this,(function(r){switch(r.label){case 0:return this._handler&&this._state===WK.CONNECTED?[4,i.apply(this,e)]:[3,2];case 1:return r.sent(),[3,3];case 2:throw new oG(Zj.NOT_CONNECTED_YET,"error in ".concat(t,": try again after joined"));case 3:return[2]}}))}))},r}function eW(e,t,r){var i=r.value;return r.value=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return r_(this,void 0,void 0,(function(){var t;return i_(this,(function(r){switch(r.label){case 0:return[4,this._pubSubLock.lock()];case 1:t=r.sent(),this.supportConcurrent&&t(),r.label=2;case 2:return r.trys.push([2,,4,5]),[4,i.apply(this,e)];case 3:return[2,r.sent()];case 4:return this.supportConcurrent||t(),[7];case 5:return[2]}}))}))},r}function tW(e,t,r){var i=r.value;return r.value=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return r_(this,void 0,void 0,(function(){var t,r=this;return i_(this,(function(n){return t=!1,[2,new Promise((function(n,o){return r_(r,void 0,void 0,(function(){var r,a;return i_(this,(function(s){switch(s.label){case 0:this.on("INTERRUPT",(function(){t=!0,o(new oG(Zj.OPERATION_CANCEL,"operation not finish when leave"))})),s.label=1;case 1:return s.trys.push([1,3,,4]),[4,i.apply(this,e)];case 2:return r=s.sent(),n(r),[3,4];case 3:return a=s.sent(),t||o(a),[3,4];case 4:return[2]}}))}))}))]}))}))},r}!function(e){e[e.INITIAL=0]="INITIAL",e[e.BEGIN=1]="BEGIN",e[e.STOPPED=2]="STOPPED",e[e.RECEIVED=3]="RECEIVED"}(JK||(JK={}));var rW,iW=function(){function e(e,t){this._audioEventSessionId=qU(),this._videoEventSessionId=qU(),this._isScreen=!1,this._audioFirstFrameState=JK.INITIAL,this._videoFirstFrameState=JK.INITIAL,this._timeout=1e4,this._currentAudioRecv={startTime:0,eventSessionId:0,type:LB.LOGIN},this._currentVideoRecv={startTime:0,eventSessionId:0,type:LB.LOGIN},this._login=!1,this._unMuteAudio=!1,this._enableAudio=!1,this._unMuteVideo=!1,this._enableVideo=!1,this._remoteUnmuteAudio=!1,this._remoteUnmuteVideo=!1,this._audioExternal=!1,this._pushAudio=!1,this._videoExternal=!1,this._pushVideo=!1,this._autoSubscribeVideo=!1,this._autoSubscribeAudio=!1,this._autoSubscribe=!1,this._publishVideo=!1,this._publishAudio=!1,this._subscribeAudio=!1,this._subscribeVideo=!1,this._subscribe=!1,this._pushTrack=!1,this._multiChatMode=!1,this._stream=e,this._handler=t,this.getTransportDelay()}return e.prototype.beginRecvFrame=function(e,t){var r,i,n,o,a;return r_(this,void 0,void 0,(function(){var s,c,u,d,l,h,p,f=this;return i_(this,(function(_){switch(_.label){case 0:return[4,this.getTransportDelay()];case 1:return _.sent(),s=this._transportDelay,c=!0,u=LB.LOGIN,d=LB.UNMUTE,l=LB.SUBSCRIBE,h=LB.PUSH_TRACK,[u,d,l,h].indexOf(t)>=0&&(s=0,c=!1),e===MB.AUDIO?(c||this._audioEventSessionId++,this._currentAudioRecv={startTime:Date.now(),eventSessionId:this._audioEventSessionId,type:t},p={media_type:e,event_type:DB.BEGIN_RECV,type:t,start:null===(r=this._currentAudioRecv)||void 0===r?void 0:r.startTime,event_session_id:this._audioEventSessionId,stream_user_id:null===(i=this._stream)||void 0===i?void 0:i.userId,transport_delay:s},this._firstAudioFrameTimer&&window.clearTimeout(this._firstAudioFrameTimer),this._firstAudioFrameTimer=window.setTimeout((function(){f.stopRecvFrame(MB.AUDIO,UB.TIMEOUT),f._firstAudioFrameInterval&&window.clearInterval(f._firstAudioFrameInterval)}),this._timeout),cj.rtcFirstFrame(p),this._watchForFirstAudioFrameRecv(),this._audioFirstFrameState=JK.BEGIN,this._login=!0,this._unMuteAudio=!0,this._enableAudio=!0,this._remoteUnmuteAudio=!0):e===MB.VIDEO&&(c||this._videoEventSessionId++,this._currentVideoRecv={startTime:Date.now(),eventSessionId:this._videoEventSessionId,type:t},p={media_type:(null===(n=this._stream)||void 0===n?void 0:n.isScreen)?MB.SCREEN_VIDEO:e,event_type:DB.BEGIN_RECV,type:t,start:null===(o=this._currentVideoRecv)||void 0===o?void 0:o.startTime,event_session_id:this._videoEventSessionId,stream_user_id:null===(a=this._stream)||void 0===a?void 0:a.userId,transport_delay:s},this._firstVideoFrameTimer&&window.clearTimeout(this._firstVideoFrameTimer),this._firstVideoFrameTimer=window.setTimeout((function(){f.stopRecvFrame(MB.VIDEO,UB.TIMEOUT),f._firstVideoFrameInterval&&window.clearInterval(f._firstVideoFrameInterval)}),this._timeout),this._watchForFirstVideoFrameRecv(),cj.rtcFirstFrame(p),this._videoFirstFrameState=JK.BEGIN,this._login=!0,this._unMuteVideo=!0,this._enableVideo=!0,this._remoteUnmuteVideo=!0),[2]}}))}))},e.prototype.stopRecvFrame=function(e,t){var r,i,n,o,a,s,c;if(e===MB.AUDIO){if(this._audioFirstFrameState!==JK.BEGIN)return;var u={event_type:DB.RECV_END,media_type:e,start:null===(r=this._currentAudioRecv)||void 0===r?void 0:r.startTime,reason:t,result:!1,stream_user_id:null===(i=this._stream)||void 0===i?void 0:i.userId,event_session_id:this._audioEventSessionId,type:null===(n=this._currentAudioRecv)||void 0===n?void 0:n.type};this._firstAudioFrameTimer&&window.clearTimeout(this._firstAudioFrameTimer),delete this._currentAudioRecv,cj.rtcFirstFrame(u),this._audioFirstFrameState=JK.STOPPED}else if(e===MB.VIDEO){if(this._videoFirstFrameState!==JK.BEGIN)return;u={event_type:DB.RECV_END,media_type:(null===(o=this._stream)||void 0===o?void 0:o.isScreen)?MB.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,cj.rtcFirstFrame(u),this._videoFirstFrameState=JK.STOPPED}},e.prototype.recvFrameFinish=function(e){var t,r,i;return r_(this,void 0,void 0,(function(){var n,o,a,s,c,u,d,l,h,p;return i_(this,(function(f){switch(f.label){case 0:return[4,this.getTransportDelay()];case 1:if(f.sent(),n=this._transportDelay,o=LB.LOGIN,a=LB.UNMUTE,s=LB.SUBSCRIBE,c=LB.PUSH_TRACK,e===MB.AUDIO){if(this._audioFirstFrameState!==JK.BEGIN)return[2];if(!this._currentAudioRecv)return[2];u=this._currentAudioRecv,l=u.type,h=u.startTime,[o,a,s,c].indexOf(l)>=0&&(n=0),p={event_type:DB.RECV_END,media_type:e,start:h,result:!0,stream_user_id:null===(t=this._stream)||void 0===t?void 0:t.userId,event_session_id:this._audioEventSessionId,type:l,transport_delay:n},delete this._currentAudioRecv,this._firstAudioFrameTimer&&window.clearTimeout(this._firstAudioFrameTimer),cj.rtcFirstFrame(p),this._audioFirstFrameState=JK.RECEIVED}else if(e===MB.VIDEO){if(this._videoFirstFrameState!==JK.BEGIN)return[2];if(!this._currentVideoRecv)return[2];d=this._currentVideoRecv,l=d.type,h=d.startTime,[o,a,s,c].indexOf(l)>=0&&(n=0),p={event_type:DB.RECV_END,media_type:(null===(r=this._stream)||void 0===r?void 0:r.isScreen)?MB.SCREEN_VIDEO:e,start:h,result:!0,stream_user_id:null===(i=this._stream)||void 0===i?void 0:i.userId,event_session_id:this._videoEventSessionId,type:l,transport_delay:n},delete this._currentVideoRecv,this._firstVideoFrameTimer&&window.clearTimeout(this._firstVideoFrameTimer),cj.rtcFirstFrame(p),this._videoFirstFrameState=JK.RECEIVED}return[2]}}))}))},e.prototype.setLogin=function(e,t){var r,i,n,o;void 0===t&&(t={audio:!0,video:!0}),this._login!==e&&(this._login=e,e&&(null===(r=this._stream)||void 0===r?void 0:r.hasAudio)&&t.audio&&this.beginRecvFrame(MB.AUDIO,LB.LOGIN),e&&(null===(i=this._stream)||void 0===i?void 0:i.hasVideo)&&t.video&&this.beginRecvFrame(MB.VIDEO,LB.LOGIN),!e&&(null===(n=this._stream)||void 0===n?void 0:n.hasAudio)&&this.stopRecvFrame(MB.AUDIO,UB.LEAVE_ROOM),!e&&(null===(o=this._stream)||void 0===o?void 0:o.hasVideo)&&this.stopRecvFrame(MB.VIDEO,UB.LEAVE_ROOM))},e.prototype.setUnmuteAudio=function(e){var t;this._unMuteAudio!==e&&(this._unMuteAudio=e,this._unMuteAudio?this.beginRecvFrame(MB.AUDIO,LB.UNMUTE):(null===(t=this._stream)||void 0===t?void 0:t.hasAudio)&&this.stopRecvFrame(MB.AUDIO,UB.MUTE))},e.prototype.setRemoteUnmuteAudio=function(e){var t;this._remoteUnmuteAudio!==e&&(this._remoteUnmuteAudio=e,this._remoteUnmuteAudio?this.beginRecvFrame(MB.AUDIO,LB.REMOTE_UNMUTE):(null===(t=this._stream)||void 0===t?void 0:t.hasAudio)&&this.stopRecvFrame(MB.AUDIO,UB.REMOTE_MUTE))},e.prototype.setEnableAudio=function(e){var t;this._enableAudio!==e&&(this._enableAudio=e,this._enableAudio?this.beginRecvFrame(MB.AUDIO,LB.ENABLE):(null===(t=this._stream)||void 0===t?void 0:t.hasAudio)&&this.stopRecvFrame(MB.AUDIO,UB.DISABLE))},e.prototype.setUnmuteVideo=function(e){var t;this._unMuteVideo!==e&&(this._unMuteVideo=e,this._unMuteVideo?this.beginRecvFrame(MB.VIDEO,LB.UNMUTE):(null===(t=this._stream)||void 0===t?void 0:t.hasVideo)&&this.stopRecvFrame(MB.VIDEO,UB.MUTE))},e.prototype.setRemoteUnmuteVideo=function(e){var t;this._remoteUnmuteVideo!==e&&(this._remoteUnmuteVideo=e,this._remoteUnmuteVideo?this.beginRecvFrame(MB.VIDEO,LB.REMOTE_UNMUTE):(null===(t=this._stream)||void 0===t?void 0:t.hasAudio)&&this.stopRecvFrame(MB.VIDEO,UB.REMOTE_MUTE))},e.prototype.setEnableVideo=function(e){this._enableVideo!==e&&(this._enableVideo=e,this._enableVideo?this.beginRecvFrame(MB.VIDEO,LB.ENABLE):this.stopRecvFrame(MB.VIDEO,UB.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(MB.AUDIO,LB.PUSH),!e&&(null===(t=this._stream)||void 0===t?void 0:t.hasAudio)&&this.beginRecvFrame(MB.AUDIO,LB.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(MB.VIDEO,LB.PUSH),!e&&(null===(t=this._stream)||void 0===t?void 0:t.hasVideo)&&this.beginRecvFrame(MB.VIDEO,LB.PUSH)},e.prototype.setPublishVideo=function(e){var t;this._publishVideo!==e&&(this._publishVideo=e),this._publishVideo&&this.beginRecvFrame(MB.VIDEO,LB.PUBLISH),!e&&(null===(t=this._stream)||void 0===t?void 0:t.hasVideo)&&this.stopRecvFrame(MB.VIDEO,UB.UNPUBLISH)},e.prototype.setPublishAudio=function(e){var t;this._publishAudio!==e&&(this._publishAudio=e),this._publishAudio&&this.beginRecvFrame(MB.AUDIO,LB.PUBLISH),!e&&(null===(t=this._stream)||void 0===t?void 0:t.hasAudio)&&this.stopRecvFrame(MB.AUDIO,UB.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(MB.AUDIO,LB.SUBSCRIBE)),!e&&(null===(r=this._stream)||void 0===r?void 0:r.hasAudio)&&this.stopRecvFrame(MB.AUDIO,UB.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(MB.VIDEO,LB.SUBSCRIBE)),!e&&(null===(r=this._stream)||void 0===r?void 0:r.hasVideo)&&this.stopRecvFrame(MB.VIDEO,UB.UNSUBSCRIBE)},e.prototype.setPushTrack=function(e){var t;this._pushTrack!==e&&(e&&!this._isScreen&&this.beginRecvFrame(MB.AUDIO,LB.PUSH_TRACK),!e&&(null===(t=this._stream)||void 0===t?void 0:t.hasAudio)&&this.stopRecvFrame(MB.AUDIO,UB.REMOVE_TRACK))},e.prototype.setMultiChatMode=function(e){this._multiChatMode=e},e.prototype.setTimeout=function(e){this._timeout=e},e.prototype._watchForFirstVideoFrameRecv=function(){var e=this,t=-1;this._firstVideoFrameInterval&&window.clearInterval(this._firstVideoFrameInterval),this._firstVideoFrameInterval=window.setInterval((function(){return r_(e,void 0,void 0,(function(){var e,r,i,n,o,a,s,c;return i_(this,(function(u){switch(u.label){case 0:return(null===(i=this._handler)||void 0===i?void 0:i.pc)&&(null===(o=null===(n=this._stream)||void 0===n?void 0:n.videoTrack)||void 0===o?void 0:o.getTrack())?[4,_H(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(MB.VIDEO),window.clearInterval(this._firstVideoFrameInterval)}u.label=2;case 2:return[2]}}))}))}),200)},e.prototype._watchForFirstAudioFrameRecv=function(){var e=this,t=-1;this._firstAudioFrameInterval&&window.clearInterval(this._firstAudioFrameInterval),this._firstAudioFrameInterval=window.setInterval((function(){return r_(e,void 0,void 0,(function(){var e,r,i,n,o,a,s,c;return i_(this,(function(u){switch(u.label){case 0:return(null===(i=this._handler)||void 0===i?void 0:i.pc)&&(null===(o=null===(n=this._stream)||void 0===n?void 0:n.audioTrack)||void 0===o?void 0:o.getTrack())?[4,_H(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(MB.AUDIO),window.clearInterval(this._firstAudioFrameInterval)}u.label=2;case 2:return[2]}}))}))}),200)},e.prototype.getTransportDelay=function(){return r_(this,void 0,void 0,(function(){var e=this;return i_(this,(function(t){switch(t.label){case 0:return[4,this.getTransportDelayIntl()];case 1:return t.sent(),window.clearInterval(this._transportDelayInterval),this._transportDelayInterval=window.setInterval((function(){return r_(e,void 0,void 0,(function(){return i_(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 r_(this,void 0,void 0,(function(){var r,i,n;return i_(this,(function(o){switch(o.label){case 0:return(null===(e=this._handler)||void 0===e?void 0:e.pc)?[4,_H(null===(t=this._handler)||void 0===t?void 0:t.pc)]:[3,2];case 1:r=o.sent(),i=r.find((function(e){return"transport"===e.type&&"connected"===e.dtlsState})),(n=r.find((function(e){return"candidate-pair"===e.type&&"succeeded"===e.state&&e.id===(null==i?void 0:i.selectedCandidatePairId)})))&&(this._transportDelay=Math.round(1e3*n.currentRoundTripTime/2)),o.label=2;case 2:return[2]}}))}))},e.prototype.reset=function(){this._currentAudioRecv={startTime:0,eventSessionId:0,type:LB.LOGIN},this._currentVideoRecv={startTime:0,eventSessionId:0,type:LB.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"}(rW||(rW={}));var nW,oW,aW,sW,cW=function(){function e(e,t){this._audioEventSessionId=qU(),this._videoEventSessionId=qU(),this._currentAudioSend={startTime:0,eventSessionId:0,type:LB.LOGIN},this._currentVideoSend={startTime:0,eventSessionId:0,type:LB.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=rW.INITIAL,this._videoFirstFrameState=rW.INITIAL,this._stream=e,this._handler=t}return e.prototype.beginSendFrame=function(e,t){var r,i,n,o=this;if(e===MB.AUDIO){this._audioEventSessionId++,this._currentAudioSend={startTime:Date.now(),eventSessionId:this._audioEventSessionId,type:t};var a={media_type:e,event_type:DB.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(MB.AUDIO,UB.TIMEOUT),o._firstAudioFrameInterval&&window.clearInterval(o._firstAudioFrameInterval)}),this._timeout),cj.rtcFirstFrame(a),this._watchForFirstAudioFrameSend(),this._audioFirstFrameState=rW.BEGIN,this._login=!0,this._publisher=!0,this._publish=!0,this._unMuteAudio=!0,this._pushAudio||(this._enableAudio=!0)}else if(e===MB.VIDEO){this._videoEventSessionId++,this._currentVideoSend={startTime:Date.now(),eventSessionId:this._videoEventSessionId,type:t};a={media_type:(null===(i=this._stream)||void 0===i?void 0:i.isScreen)?MB.SCREEN_VIDEO:e,event_type:DB.BEGIN_SEND,type:t,start:null===(n=this._currentVideoSend)||void 0===n?void 0:n.startTime,event_session_id:this._videoEventSessionId};this._firstVideoFrameTimer&&window.clearTimeout(this._firstVideoFrameTimer),this._firstVideoFrameTimer=window.setTimeout((function(){o.stopSendFrame(MB.VIDEO,UB.TIMEOUT),o._firstVideoFrameInterval&&window.clearInterval(o._firstVideoFrameInterval)}),this._timeout),this._watchForFirstVideoFrameSend(),cj.rtcFirstFrame(a),this._videoFirstFrameState=rW.BEGIN,this._login=!0,this._publisher=!0,this._publish=!0,this._unMuteVideo=!0,this._pushVideo||(this._enableVideo=!0)}},e.prototype.stopSendFrame=function(e,t){var r,i,n,o,a;if(e===MB.AUDIO){if(this._audioFirstFrameState!==rW.BEGIN)return;var s={event_type:DB.SENT_END,media_type:e,start:null===(r=this._currentAudioSend)||void 0===r?void 0:r.startTime,reason:t,result:!1,event_session_id:this._audioEventSessionId,type:null===(i=this._currentAudioSend)||void 0===i?void 0:i.type};this._firstAudioFrameTimer&&window.clearTimeout(this._firstAudioFrameTimer),delete this._currentAudioSend,cj.rtcFirstFrame(s),this._audioFirstFrameState=rW.STOPPED}else if(e===MB.VIDEO){if(this._videoFirstFrameState!==rW.BEGIN)return;s={event_type:DB.SENT_END,media_type:(null===(n=this._stream)||void 0===n?void 0:n.isScreen)?MB.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,cj.rtcFirstFrame(s),this._videoFirstFrameState=rW.STOPPED}},e.prototype.sendFrameFinish=function(e){var t;if(e===MB.AUDIO){if(this._audioFirstFrameState!==rW.BEGIN)return;if(!this._currentAudioSend)return;var r=this._currentAudioSend,i=r.type,n=r.startTime,o={event_type:DB.SENT_END,media_type:e,start:n,result:!0,event_session_id:this._audioEventSessionId,type:i};delete this._currentAudioSend,this._firstAudioFrameTimer&&window.clearTimeout(this._firstAudioFrameTimer),cj.rtcFirstFrame(o),this._audioFirstFrameState=rW.SENT}else if(e===MB.VIDEO){if(this._videoFirstFrameState!==rW.BEGIN)return;if(!this._currentVideoSend)return;var a=this._currentVideoSend;i=a.type,n=a.startTime,o={event_type:DB.SENT_END,media_type:(null===(t=this._stream)||void 0===t?void 0:t.isScreen)?MB.SCREEN_VIDEO:e,start:n,result:!0,event_session_id:this._videoEventSessionId,type:i};delete this._currentVideoSend,this._firstVideoFrameTimer&&window.clearTimeout(this._firstVideoFrameTimer),cj.rtcFirstFrame(o),this._videoFirstFrameState=rW.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(MB.VIDEO,LB.LOGIN),(null===(r=this._stream)||void 0===r?void 0:r.audioTrack)&&this.beginSendFrame(MB.AUDIO,LB.LOGIN)),!e&&this._audioSending&&this.stopSendFrame(MB.AUDIO,UB.LEAVE_ROOM),!e&&this._videoSending&&this.stopSendFrame(MB.VIDEO,UB.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(MB.VIDEO,LB.PUBLISH),(null===(r=this._stream)||void 0===r?void 0:r.audioTrack)&&this.beginSendFrame(MB.AUDIO,LB.PUBLISH)),!e&&this._audioSending&&this.stopSendFrame(MB.AUDIO,UB.UNPUBLISH),!e&&this._videoSending&&this.stopSendFrame(MB.VIDEO,UB.UNPUBLISH))},e.prototype.setUnmuteAudio=function(e){this._unMuteAudio!==e&&(this._unMuteAudio=e,e&&this.beginSendFrame(MB.AUDIO,LB.UNMUTE),!e&&this._audioSending&&this.stopSendFrame(MB.AUDIO,UB.MUTE))},e.prototype.setEnableAudio=function(e){this._enableAudio!==e&&(this._enableAudio=e,e&&this.beginSendFrame(MB.AUDIO,LB.ENABLE),!e&&this._audioSending&&this.stopSendFrame(MB.AUDIO,UB.DISABLE))},e.prototype.setUnmuteVideo=function(e){this._unMuteVideo!==e&&(this._unMuteVideo=e,e&&this.beginSendFrame(MB.VIDEO,LB.UNMUTE),!e&&this._videoSending&&this.stopSendFrame(MB.VIDEO,UB.MUTE))},e.prototype.setEnableVideo=function(e){this._enableVideo!==e&&(this._enableVideo=e,e&&this.beginSendFrame(MB.VIDEO,LB.ENABLE),!e&&this._videoSending&&this.stopSendFrame(MB.VIDEO,UB.DISABLE))},e.prototype.setExternalAudioSource=function(e){this._audioExternal!==e&&(this._audioExternal=e,e&&(this._audioSending&&this.stopSendFrame(MB.AUDIO,UB.DISABLE),this._enableAudio=!1),e||(this._audioSending&&this.stopSendFrame(MB.AUDIO,UB.STOP_PUSH),this._pushAudio=!1))},e.prototype.setPushAudio=function(e){this._pushAudio!==e&&(this._pushAudio=e,e&&this.beginSendFrame(MB.AUDIO,LB.PUSH),!e&&this._audioSending&&this.stopSendFrame(MB.AUDIO,UB.STOP_PUSH))},e.prototype.setExternalVideoSource=function(e){this._videoExternal!==e&&(this._videoExternal=e,e&&(this._videoSending&&this.stopSendFrame(MB.VIDEO,UB.DISABLE),this._enableVideo=!1),e||(this._videoSending&&this.stopSendFrame(MB.VIDEO,UB.STOP_PUSH),this._pushVideo=!1))},e.prototype.setPushVideo=function(e){this._pushVideo!==e&&(this._pushVideo=e,e&&this.beginSendFrame(MB.VIDEO,LB.PUSH),!e&&this._videoSending&&this.stopSendFrame(MB.VIDEO,UB.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(MB.AUDIO,UB.AUDIENCE),!e&&this._videoSending&&this.stopSendFrame(MB.VIDEO,UB.AUDIENCE))},e.prototype.setTimeout=function(e){this._timeout=e},e.prototype.setPCSessionId=function(e){this._pcSessionId=e},e.prototype.setHandler=function(e){this._handler=e},e.prototype._getFirstVideoFrameStats=function(){var e,t,r,i,n,o;return r_(this,void 0,void 0,(function(){var a;return i_(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,_H(null===(i=this._handler)||void 0===i?void 0:i.pc,null===(o=null===(n=this._stream)||void 0===n?void 0:n.videoTrack)||void 0===o?void 0:o.getTrack())]:[3,2];case 1:return a=s.sent(),[2,a.find((function(e){return"outbound-rtp"===e.type}))];case 2:return[2]}}))}))},e.prototype._getFirstAudioFrameStats=function(){var e,t,r,i,n,o;return r_(this,void 0,void 0,(function(){var a;return i_(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,_H(null===(i=this._handler)||void 0===i?void 0:i.pc,null===(o=null===(n=this._stream)||void 0===n?void 0:n.audioTrack)||void 0===o?void 0:o.getTrack())]:[3,2];case 1:return a=s.sent(),[2,a.find((function(e){return"outbound-rtp"===e.type}))];case 2:return[2]}}))}))},e.prototype._watchForFirstVideoFrameSend=function(){var e=this,t=-1;this._firstVideoFrameInterval&&window.clearInterval(this._firstVideoFrameInterval),this._firstVideoFrameInterval=window.setInterval((function(){return r_(e,void 0,void 0,(function(){var e;return i_(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(MB.VIDEO),window.clearInterval(this._firstVideoFrameInterval)}return[2]}}))}))}),100)},e.prototype._watchForFirstAudioFrameSend=function(){var e=this,t=-1;this._firstAudioFrameInterval&&window.clearInterval(this._firstAudioFrameInterval),this._firstAudioFrameInterval=window.setInterval((function(){return r_(e,void 0,void 0,(function(){var e;return i_(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(MB.AUDIO),window.clearInterval(this._firstAudioFrameInterval)}return[2]}}))}))}),100)},e.prototype.reset=function(){this._login=!1,this._publisher=!1,this._unMuteAudio=!1,this._enableAudio=!1,this._unMuteVideo=!1,this._enableVideo=!1,this._audioExternal=!1,this._pushAudio=!1,this._videoExternal=!1,this._pushVideo=!1,this._autoPublish=!1,this._publish=!1,this._audioFirstFrameState=rW.INITIAL,this._videoFirstFrameState=rW.INITIAL,this._currentAudioSend={startTime:0,eventSessionId:0,type:LB.LOGIN},this._currentVideoSend={startTime:0,eventSessionId:0,type:LB.LOGIN},window.clearTimeout(this._firstAudioFrameTimer),window.clearTimeout(this._firstVideoFrameTimer),window.clearInterval(this._firstAudioFrameInterval),window.clearInterval(this._firstVideoFrameInterval)},e.prototype.destroy=function(){this.reset(),delete this._stream,delete this._handler},Object.defineProperty(e.prototype,"_audioSending",{get:function(){return this._audioFirstFrameState===rW.BEGIN},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"_videoSending",{get:function(){return this._videoFirstFrameState===rW.BEGIN},enumerable:!1,configurable:!0}),e}();!function(e){e[e.UNKOWN=0]="UNKOWN",e[e.EXCELLENT=1]="EXCELLENT",e[e.GOOD=2]="GOOD",e[e.POOR=3]="POOR",e[e.BAD=4]="BAD",e[e.VBAD=5]="VBAD"}(oW||(oW={})),function(e){e[e.INVALID=0]="INVALID",e[e.GOOD=1]="GOOD",e[e.MEDIUM=2]="MEDIUM",e[e.POOR=3]="POOR"}(aW||(aW={})),function(e){e.AUDIO="audio",e.VIDEO="video",e.SCREEN_VIDEO="screen_video",e.SCREEN_AUDIO="screen_audio"}(sW||(sW={}));var uW=((nW={})[sW.AUDIO]={delay:1200,stallRadio:.3},nW[sW.VIDEO]={delay:1200,stallRadio:.6},nW[sW.SCREEN_AUDIO]={delay:1600,stallRadio:.8},nW[sW.SCREEN_VIDEO]={delay:1600,stallRadio:.8},nW),dW=function(){function e(){this._preUplinkStats=new Map,this._preDownlinkStats=new Map,this._connectionState=WK.CONNECTED}return e.prototype.updateUplinkStats=function(e){var t=e.audioStats,r=e.videoStats,i=e.isScreen;if(t.sendKBitrate>0&&t.rtt){var n=i?sW.SCREEN_AUDIO:sW.AUDIO,o=t.rtt,a=t._fractionLost,s=t._retransmittedRate,c=this._getQosLevel(o,a||0,s||0),u=this._preUplinkStats.get(n)||[c];this._preUplinkStats.set(n,a_(a_([],o_(u),!1),[c],!1).slice(-2))}if(r.sentKBitrate>0&&r.rtt){n=i?sW.SCREEN_VIDEO:sW.VIDEO,o=r.rtt,a=r._fractionLost;r.videoLossRate;var d=r._sendBandWidth;s=r._retransmittedRate;0===d&&(a=Math.max(.65,a));c=this._getQosLevel(o,a||0,s||0),u=this._preUplinkStats.get(n)||[c];this._preUplinkStats.set(n,a_(a_([],o_(u),!1),[c],!1).slice(-2))}this._startNetworkQualityReport()},e.prototype.updateDownlinkStats=function(e,t){if(t){var r,i,n=this._getStreamActiveState(t),o=n.audioActive,a=n.videoActive,s=e.audioStats,c=e.videoStats,u=e.isScreen,d=e.userId,l=!0,h=!0;if(o&&s.rtt)if(0===s.receivedKBitrate)l=!1;else{var p=s.rtt,f=s.audioLossRate,_=s.stallDuration,v=s.statsInterval,m=s.e2eDelay,y=_/v,g=u?sW.SCREEN_AUDIO:sW.AUDIO,S=this._getQosLevel(p,f||0,c._retransmittedRate||0),E=this._getDownlinkQoE(g,y,m);r=this._getNetworkQuality(S,E)}if(a)if(0===c.receivedKBitrate||0===c.rtt)h=!1;else{p=c.rtt;var b=c.videoLossRate,I=(_=c.stallDuration,v=c.statsInterval,m=c.e2eDelay,c._retransmittedRate);y=_/v,g=u?sW.SCREEN_VIDEO:sW.VIDEO,S=this._getQosLevel(p,b||0,I||0),E=this._getDownlinkQoE(g,y,m);i=this._getNetworkQuality(S,E)}var T="".concat(d).concat(u?"_screen":"");if(l||h){var A=r&&i?Math.ceil((r+i)/2):r||i;if(A){var R=this._preDownlinkStats.get(T)||[A];this._preDownlinkStats.set(T,a_(a_([],o_(R),!1),[A],!1).slice(-2)),this._startNetworkQualityReport()}}else this._preDownlinkStats.delete(T)}},e.prototype.setConnectionState=function(e){this._connectionState=e},e.prototype.destroy=function(){this._timer&&(window.clearInterval(this._timer),delete this._timer),this._delayTimer&&(window.clearTimeout(this._delayTimer),delete this._delayTimer),this._preUplinkStats.clear(),this._preDownlinkStats.clear()},e.prototype._startNetworkQualityReport=function(){var e=this;this._delayTimer||this._timer||(this._preUplinkStats.size>0||this._preDownlinkStats.size>0)&&(this._delayTimer=window.setTimeout((function(){delete e._delayTimer,e._reportNetworkQuality(),e._timer=window.setInterval((function(){e._reportNetworkQuality()}),2e3)}),300))},e.prototype._reportNetworkQuality=function(){var e,t,r=this;if(this._connectionState!==WK.CONNECTED)e=t=Yf.VBAD;else{var i=this._getBetterQualityAndRemoveOldest(sW.AUDIO,"up"),n=this._getBetterQualityAndRemoveOldest(sW.VIDEO,"up");e=i&&n?Math.ceil((i+n)/2):i||n||this._getBetterQualityAndRemoveOldest(sW.SCREEN_VIDEO,"up")||this._getBetterQualityAndRemoveOldest(sW.SCREEN_AUDIO,"up")||Yf.EXCELLENT;var o=Array.from(this._preDownlinkStats.keys()).map((function(e){return r._getBetterQualityAndRemoveOldest(e,"down")})).filter((function(e){return e}));t=Math.ceil(o.reduce((function(e,t){return t+e}),0)/o.length)||Yf.UNKNOWN}this.reportor&&this.reportor(e,t)},e.prototype._getNetworkQuality=function(e,t){return t===aW.GOOD?Math.max(e-2,1):t===aW.MEDIUM?e:Math.min(e+1,5)},e.prototype._getQosLevel=function(e,t,r){var i;return i=e<=250&&t<=.15?oW.EXCELLENT:e<=500&&t<=.3?oW.GOOD:e<=750&&t<=.45?oW.POOR:e<=1e3&&t<=.6?oW.BAD:oW.VBAD,r>.5?i=Math.max(i,oW.BAD):r>.35?i=Math.max(i,oW.POOR):r>.15&&(i=Math.max(i,oW.GOOD)),i},e.prototype._getUplinkQoE=function(e,t){var r=aW.INVALID;switch(e){case sW.AUDIO:case sW.VIDEO:r=t<.05?aW.GOOD:t<.1?aW.MEDIUM:aW.POOR;break;case sW.SCREEN_VIDEO:case sW.SCREEN_AUDIO:r=t<.04?aW.GOOD:t<.08?aW.MEDIUM:aW.POOR}return r},e.prototype._getDownlinkQoE=function(e,t,r){var i=uW[e];return t>i.stallRadio||r>i.delay||t>i.stallRadio/2&&r>i.delay/2?aW.POOR:(t>i.stallRadio/2||i.delay,aW.MEDIUM)},e.prototype._getBetterQualityAndRemoveOldest=function(e,t){var r=Yf.UNKNOWN,i="up"===t?this._preUplinkStats:this._preDownlinkStats,n=i.get(e);if(n){var o=n.filter((function(e){return e}));o.length>0&&(r=Math.min.apply(Math,a_([],o_(o),!1))),n.shift(),0===n.length&&i.delete(e)}return r},e.prototype._getStreamActiveState=function(e){var t=e.subMediaType,r=e._attributes,i=e.subVideo;return{audioActive:e.subAudio&&ex(t)&&r.localaudio&&r.audiostream,videoActive:i&&tx(t)&&r.localvideo&&r.videostream}},e}(),lW=function(){function e(e){this._room=e,this._remoteVideoSizeCache={},this._remoteScreenSizeCache={},this._start()}return e.prototype.destroy=function(){this._timer&&(window.clearInterval(this._timer),delete this._timer),this._remoteVideoSizeCache={},this._remoteScreenSizeCache={}},e.prototype._start=function(){var e=this;this._timer||(this._timer=window.setInterval((function(){var t={},r={};e._room.remoteStreams.forEach((function(i,n){i.forEach((function(i){var o,a=null===(o=i.videoTrack)||void 0===o?void 0:o.getTrack();if(a){var s=i.isScreen?e._remoteScreenSizeCache:e._remoteVideoSizeCache,c=s[n]||{},u=c.width,d=void 0===u?0:u,l=c.height,h=void 0===l?0:l,p=a.getSettings(),f=p.width,_=void 0===f?0:f,v=p.height,m=void 0===v?0:v;h===m&&d===_||e.onchange&&e.onchange(n,i.isScreen,_,m),delete s[n],(i.isScreen?r:t)[n]={width:_,height:m}}}))})),Object.keys(e._remoteVideoSizeCache).forEach((function(t){e.onchange&&e.onchange(t,!1,0,0)})),Object.keys(e._remoteScreenSizeCache).forEach((function(t){e.onchange&&e.onchange(t,!0,0,0)})),e._remoteVideoSizeCache=t,e._remoteScreenSizeCache=r}),1e3))},e}(),hW=Ia.every;Xi({target:"Array",proto:!0,forced:!Gn("every")},{every:function(e){return hW(this,e,arguments.length>1?arguments[1]:void 0)}});var pW=new rj("SubscribeFallbackManager",2),fW=1e4,_W=function(){function e(e){this._room=e,this._preDownlinkNetworkQuality=[],this._isSubscribeFallbackOrRecover=!1,this._inSubscribeRecoverChecking=!1,this._forbidSubRecover=!1,this._forbidSubRecoverDuration=fW}return e.prototype.updateNetworkQuality=function(e,t){this._preDownlinkNetworkQuality.push(t),this._preDownlinkNetworkQuality=this._preDownlinkNetworkQuality.slice(-10),this._inSubscribeRecoverChecking&&this._preDownlinkNetworkQuality.find((function(e){return e===Yf.BAD||e===Yf.VBAD}))&&this._startForbidSubRecover(),this._preDownlinkNetworkQuality.slice(-3).reduce((function(e,t){return e+t}),0)>3*Yf.POOR&&this._subscribeFallbackOrRecover("fallback"),!this._forbidSubRecover&&10===this._preDownlinkNetworkQuality.length&&this._preDownlinkNetworkQuality.every((function(e){return e===Yf.EXCELLENT}))&&this._subscribeFallbackOrRecover("recover")},e.prototype.destroy=function(){this._stopSubscribeRecoverCheck(),this._stopForbidSubRecover(),delete this.onSubscribeFallback},e.prototype._subscribeFallbackOrRecover=function(e){return r_(this,void 0,void 0,(function(){var t,r,i,n,o,a,s,c,u,d=this;return i_(this,(function(l){switch(l.label){case 0:if(this._isSubscribeFallbackOrRecover||this._room.connectionState!==WK.CONNECTED)return[2];if(this._room.subscribeFallbackOption!==Xf.AUDIO_ONLY&&this._room.subscribeFallbackOption!==Xf.VIDEO_STREAM_LOW)return[3,5];if(t=new Map,this._room.remoteStreams.forEach((function(r){r.forEach((function(r){if(r.hasSubscribed){var i="fallback"===e?r.getSubscribeFallbackParams(d._room.subscribeFallbackOption):r.getSubscribeRecoverParams();if(i){var n=r.getStreamPriority(),o=t.get(n)||[];o.push({stream:r,fallbackOrRecoverOption:i}),t.set(n,o)}}}))})),!(t.size>0))return[3,5];if(pW.print("_subscribeFallbackOrRecover()","start subscribe ".concat(e,".")),r=Array.from(t.keys()).sort((function(e,t){return e-t}))["fallback"===e?0:t.size-1],i=o_(t.get(r)||[],1),!(n=i[0]))return[3,5];o=n.stream,a=n.fallbackOrRecoverOption,this._isSubscribeFallbackOrRecover=!0,s=o.subLayer.spatialLayer,c=o.subVideo,pW.print("_subscribeFallbackOrRecover()","".concat(o.userId,"'s stream will be ").concat(e," to: MediaType=").concat(a[0]," subState=").concat(a[1]," subLayer=").concat(a[2])),l.label=1;case 1:return l.trys.push([1,3,,4]),[4,ZU([(u=this._room).updateSubTrack.apply(u,a_([o],o_(a),!1)).then((function(){"recover"===e?d._startSubscribeRecoverCheck():pW.print("_subscribeFallbackOrRecover()","fallback success."),d.onSubscribeFallback&&d.onSubscribeFallback({userId:o.userId,isScreen:o.isScreen,beforeEnable:c,beforeVideoIndex:s,afterEnable:o.subVideo,afterVideoIndex:o.subLayer.spatialLayer,reason:"fallback"===e?Jf.SubscribeFallbackByBandwidth:Jf.SubscribeRecoverByBandwidth})})),(h=2e3,new Promise((function(e){window.setTimeout(e,h)})))])];case 2:case 3:return l.sent(),[3,4];case 4:this._preDownlinkNetworkQuality=[],this._isSubscribeFallbackOrRecover=!1,l.label=5;case 5:return[2]}var h}))}))},e.prototype._startSubscribeRecoverCheck=function(){var e=this;this._stopSubscribeRecoverCheck(),this._inSubscribeRecoverChecking=!0,this._subRecoverCheckTimer=window.setTimeout((function(){e._inSubscribeRecoverChecking=!1,e._forbidSubRecoverDuration=fW,delete e._subRecoverCheckTimer,pW.print("_subscribeFallbackOrRecover()","recover success.")}),2e4)},e.prototype._stopSubscribeRecoverCheck=function(){this._subRecoverCheckTimer&&(window.clearTimeout(this._subRecoverCheckTimer),delete this._subRecoverCheckTimer),this._inSubscribeRecoverChecking=!1},e.prototype._startForbidSubRecover=function(){var e=this;this._stopSubscribeRecoverCheck(),this._stopForbidSubRecover(),this._forbidSubRecoverDuration=Math.min(this._forbidSubRecoverDuration+2e4,12e4),pW.print("_subscribeFallbackOrRecover()","subscribe-recover failed, and subscribe-recover not allowed within ".concat(this._forbidSubRecoverDuration/1e3,"s")),this._forbidSubRecover=!0,this._forbidSubRecoverTimer=window.setTimeout((function(){e._forbidSubRecover=!1,delete e._forbidSubRecoverTimer}),this._forbidSubRecoverDuration)},e.prototype._stopForbidSubRecover=function(){this._forbidSubRecoverTimer&&(window.clearTimeout(this._forbidSubRecoverTimer),delete this._forbidSubRecoverTimer)},e}(),vW=new rj("Room",1),mW=function(e){function t(t,r){var i=e.call(this)||this;return i._remoteUsers=new Map,i._remoteStreams=new Map,i._remoteStreamStreamIdUserIdMap={},i._waitForNewToken=!1,i._userDuplicateLoginTimerMap=new Map,i._hasPublished=!1,i._publishOnDemandBusy=!1,i._roomConfig=t,i._mediaServerClient=new ZK(r),i._reconnectRecord=new yW,i._addHandlerEventHandler(),i._isReconnecting=!1,i._networkQualityManager=new dW,i._networkQualityManager.reportor=i._reportNetworkQuality.bind(i),i._videoSizeObserver=new lW(i),i._videoSizeObserver.onchange=i._emitVideoSizeChange.bind(i),i._subFallbackManager=new _W(i),i._subFallbackManager.onSubscribeFallback=i._emitSubscribeFallback.bind(i),i._context=r,i}return Of(t,e),Object.defineProperty(t.prototype,"hasScreenPublished",{get:function(){var e;return null===(e=this._localScreenStream)||void 0===e?void 0:e.hasPublished},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"hasPublished",{get:function(){var e;return null===(e=this._localStream)||void 0===e?void 0:e.hasPublished},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"connectionState",{get:function(){return this._mediaServerClient.connectionState},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"remoteUsers",{get:function(){return this._remoteUsers},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"remoteStreams",{get:function(){return this._remoteStreams},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"localStream",{get:function(){return this._localStream},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"localScreenStream",{get:function(){return this._localScreenStream},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"roomInfo",{get:function(){return this._roomInfo},enumerable:!1,configurable:!0}),t.prototype._addHandlerEventHandler=function(){var e,t,r,i,n,o,a,s,c,u,d,l,h,p,f,_,v,m,y,g,S,E,b,I,T=this;null===(e=this._mediaServerClient)||void 0===e||e.on(xG.ON_ADD_STREAM,this._onAddStream.bind(this)),null===(t=this._mediaServerClient)||void 0===t||t.on(xG.ON_REMOVE_STREAM,this._onRemoveStream.bind(this)),null===(r=this._mediaServerClient)||void 0===r||r.on(xG.USER_CONNECTION,this._onUserConnection.bind(this)),null===(i=this._mediaServerClient)||void 0===i||i.on(xG.USER_DISCONNECTION,this._onUserDisconnection.bind(this)),null===(n=this._mediaServerClient)||void 0===n||n.on(xG.ON_UPDATE_ROOM_ATTRIBUTES,this._onUpdateRoomAttributes.bind(this)),null===(o=this._mediaServerClient)||void 0===o||o.on(xG.ON_UPDATE_STREAM_ATTRIBUTES,this._onUpdateStreamAttributes.bind(this)),null===(a=this._mediaServerClient)||void 0===a||a.on(xG.ON_PUSH_TRACK,this._onPushTrack.bind(this)),null===(s=this._mediaServerClient)||void 0===s||s.on(xG.ON_REMOVE_TRACK,this._onRemoveTrack.bind(this)),null===(c=this._mediaServerClient)||void 0===c||c.on(xG.NODE_CHANGE,this._nodeChange.bind(this)),null===(u=this._mediaServerClient)||void 0===u||u.on(xG.ON_CUSTOM_MESSAGE,this._onCustomMessage.bind(this)),null===(d=this._mediaServerClient)||void 0===d||d.on(xG.USER_MESSAGE_RECEIVED,this._onUserMessageReceived.bind(this)),null===(l=this._mediaServerClient)||void 0===l||l.on(xG.USER_BINARY_MESSAGE_RECEIVED,this._onUserBinaryMessageReceived.bind(this)),null===(h=this._mediaServerClient)||void 0===h||h.on(xG.POST_PROCESSING_MESSAGE,this._onPostProcessingMessage.bind(this)),null===(p=this._mediaServerClient)||void 0===p||p.on(xG.ON_USER_TOKEN_WILL_EXPIRE,this._onUserTokenWillExpire.bind(this)),null===(f=this._mediaServerClient)||void 0===f||f.on(xG.STREAM_CONTROL_MESSAGE,this._onStreamControlMessage.bind(this)),null===(_=this._mediaServerClient)||void 0===_||_.on(xG.ON_SCENE_CONFIG,this._onSceneConfig.bind(this)),null===(v=this._mediaServerClient)||void 0===v||v.on(xG.ON_STREAM_FAILED,this._onStreamFailed.bind(this)),null===(m=this._mediaServerClient)||void 0===m||m.on(VG.RSCP,(function(e){T._publishOnDemandItem=e,T._onPublishOnDemand()})),null===(y=this._mediaServerClient)||void 0===y||y.on(FG.ON_CONNECTION_STATE_CHANGE,this._onConnectionStateChange.bind(this)),null===(g=this._mediaServerClient)||void 0===g||g.on(FG.ABNORMAL_DISCONNECTION,this._handleAbnormalDisconnection.bind(this)),null===(S=this._mediaServerClient)||void 0===S||S.on("onRemoteStreamStats",(function(e){T._networkQualityManager.updateDownlinkStats(e,T._findRemoteStreamByScreen(e.userId,e.isScreen)),T.emit(lK.ON_REMOTE_STREAM_STATS,rx(e))})),null===(E=this._mediaServerClient)||void 0===E||E.on("onLocalStreamStats",(function(e){T._networkQualityManager.updateUplinkStats(e),T.emit(lK.ON_LOCAL_STREAM_STATS,rx(e))})),null===(b=this._mediaServerClient)||void 0===b||b.on("prevIceNode",(function(e){T._getAccessFeedbackIceNode=e})),null===(I=this._mediaServerClient)||void 0===I||I.on("prevIceNode",(function(e){T._getAccessFeedbackIceNode=e}))},t.prototype._removeHandlerEventHandler=function(){var e;null===(e=this._mediaServerClient)||void 0===e||e.removeAllListeners()},t.prototype.join=function(e,t,r,i,n,o){return r_(this,void 0,void 0,(function(){var a=this;return i_(this,(function(s){return lj.setStats({rtc_app_id:e,room_id:t,user_id:i.userId}),vW.print("join()"),[2,new Promise((function(s,c){return r_(a,void 0,void 0,(function(){var a,u,d=this;return i_(this,(function(l){return this._joinResolveCallback=function(e){var t;cj.joinRoom(FB.END,a,!0,"",{enable_cloud_proxy:null===(t=d._roomInfo)||void 0===t?void 0:t.useCloudProxy}),s(e)},this._joinRejectCallback=function(e){var t;cj.joinRoom(FB.END,a,!1,e.message,{enable_cloud_proxy:null===(t=d._roomInfo)||void 0===t?void 0:t.useCloudProxy}),c(e)},this._liveControlMessage=n,this._roomInfo={appId:e,roomId:t,token:r,userInfo:i,useCloudProxy:o,roomProfile:this._roomConfig.roomProfileType},a=NU(),this.setSessionId(),cj.joinRoom(FB.BEGIN,a,!1,"",{enable_cloud_proxy:null===(u=this._roomInfo)||void 0===u?void 0:u.useCloudProxy}),this._join(this._joinResolveCallback,this._joinRejectCallback,!1),[2]}))}))}))]}))}))},t.prototype._join=function(e,t,r){return void 0===r&&(r=!1),r_(this,void 0,void 0,(function(){var i,n,o;return i_(this,(function(a){switch(a.label){case 0:i=NU(),vW.print("_join()"),a.label=1;case 1:return a.trys.push([1,3,,4]),[4,this._mediaServerClient.join(this._roomInfo,{node:this._getAccessNode,reason:this._getAccessFeedback,sessionId:this._sessionId,feedbackNode:this._getAccessFeedbackIceNode},r,this._liveControlMessage)];case 2:return n=a.sent(),this._mediaServerClient.roomAttributes=n.roomAttributes,this._reconnectRecord.clear(),this._joinResolveCallback=void 0,this._joinRejectCallback=void 0,this._getAccessFeedback=void 0,this._getAccessNode=void 0,"function"==typeof e&&e({users:n.clients,streams:n.streams}),this._isReconnecting=!1,cj.rtcJoinRoom(0,"web","web",NU()-i),this._onJoinSucc(n,r),[3,4];case 3:return(o=a.sent()).code!==Zj.OPERATION_CANCEL&&"function"==typeof t?[2,t(o)]:[3,4];case 4:return[2]}}))}))},t.prototype.publishScreen=function(e,t,r,i,n){var o,a,s,c,u,d;return r_(this,void 0,void 0,(function(){var l,h,p,f;return i_(this,(function(_){switch(_.label){case 0:return vW.print("publishScreen()"),this._localScreenStream||(this._localScreenStream=new RK,this._localScreenStream.isScreen=!0,this._mediaServerClient.handler&&(this._localScreenStream.observer=new cW(this._localScreenStream,this._mediaServerClient.handler))),l=!1,h=!1,p=!1,f=!1,!this._localScreenStream.videoTrack&&t?(t instanceof Wz&&(h=!0),l=!0):this._localScreenStream.videoTrack&&!t&&(l=!1),!this._localScreenStream.audioTrack&&r?(r instanceof Xz&&(f=!0),p=!0):this._localScreenStream.audioTrack&&!r&&(p=!1),this._localScreenStream.videoTrack=t,this._localScreenStream.audioTrack=r,this._localScreenStream.videoEncodeConfig=e,i&&(ex(i)&&(this._localScreenStream.pubAudio=n===fK.PUB),tx(i)&&(this._localScreenStream.pubVideo=n===fK.PUB),vW.print("publishScreen mediaType","pubAudio: %o, pubVideo: %o",this._localScreenStream.pubAudio,this._localScreenStream.pubVideo)),this._localScreenStream.pubAudio||this._localScreenStream.pubVideo?this._localScreenStream.hasPublished?[3,2]:(null===(a=this._localScreenStream.observer)||void 0===a||a.setPublish(!0),[4,this._mediaServerClient.publish(this._localScreenStream)]):(null===(o=this._localScreenStream)||void 0===o?void 0:o.hasPublished)?[2,this.unpublishScreen()]:[2];case 1:return _.sent(),[3,4];case 2:return h?null===(s=this._localScreenStream.observer)||void 0===s||s.setPushVideo(l):null===(c=this._localScreenStream.observer)||void 0===c||c.setEnableVideo(l),f?null===(u=this._localScreenStream.observer)||void 0===u||u.setPushAudio(p):null===(d=this._localScreenStream.observer)||void 0===d||d.setEnableAudio(p),[4,this.updatePubScreenTrack()];case 3:_.sent(),_.label=4;case 4:return[2]}}))}))},t.prototype.updatePubScreenTrack=function(){return r_(this,void 0,void 0,(function(){return i_(this,(function(e){switch(e.label){case 0:return vW.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 r_(this,void 0,void 0,(function(){return i_(this,(function(t){switch(t.label){case 0:return vW.print("unpublish","Invoke unpublishScreen"),this._localScreenStream?(null===(e=this._localScreenStream.observer)||void 0===e||e.setPublish(!1),[4,this._mediaServerClient.unpublish(this._localScreenStream)]):[3,2];case 1:t.sent(),this._localScreenStream.clean(),this._localScreenStream=void 0,t.label=2;case 2:return[2]}}))}))},t.prototype.liveControlMessage=function(e){var t;return r_(this,void 0,void 0,(function(){var r=this;return i_(this,(function(i){switch(i.label){case 0:return vW.print("controlMessage","Invoke controlMessage"),null===(t=e.transcodeMeta)||void 0===t||t.layout.regions.forEach((function(e){r.roomInfo&&(e.roomID=r.roomInfo.roomId)})),this._liveControlMessage=e,[4,this._mediaServerClient.controlMessage(e)];case 1:return i.sent(),"stopped"===e.action&&delete this._liveControlMessage,[2]}}))}))},t.prototype.publicStreamControlMessage=function(e){return r_(this,void 0,void 0,(function(){return i_(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 r_(this,void 0,void 0,(function(){return i_(this,(function(t){switch(t.label){case 0:return vW.print("updateUserAttributes","Invoke updateUserAttributes"),e.role&&this._roomInfo&&(this._roomInfo.userInfo.role=e.role),[4,this._mediaServerClient.updateUserAttributes(e)];case 1:return t.sent(),[2]}}))}))},t.prototype.publish=function(e,t,r,i,n,o,a){var s,c,u,d,l,h;return void 0===a&&(a=!1),r_(this,void 0,void 0,(function(){var p,f,_,v,m,y;return i_(this,(function(g){switch(g.label){case 0:if(vW.print("publish","Invoke publish"),p=!1,this._localStream||(this._localStream=new RK,this._mediaServerClient.handler&&(this._localStream.observer=new cW(this._localStream,this._mediaServerClient.handler)),p=!0),this._localStream.videoTrack=r,this._localStream.audioTrack=i,this._localStream.videoEncodeConfig=e,this._localStream.enableSimulcast=t,n&&(ex(n)&&(this._localStream.pubAudio=o===fK.PUB),tx(n)&&(this._localStream.pubVideo=o===fK.PUB),vW.print("publish mediaType","pubAudio: %o, pubVideo: %o",this._localStream.pubAudio,this._localStream.pubVideo)),this._localStream.hasPublished)return[3,5];if(!this._localStream.pubAudio&&!this._localStream.pubVideo)return[2];g.label=1;case 1:return g.trys.push([1,3,,4]),a?null===(s=this._localStream.observer)||void 0===s||s.setLogin(!0):p&&(f=!!this._localStream.videoTrack,_=!!this._localStream.audioTrack,v=this._localStream.videoTrack instanceof Wz,m=this._localStream.audioTrack instanceof Xz,this._roomConfig.isAutoPublish&&!this._hasPublished?(f&&(v?null===(c=this._localStream.observer)||void 0===c||c.setPushVideo(!0):null===(u=this._localStream.observer)||void 0===u||u.setEnableVideo(!0)),_&&(m?null===(d=this._localStream.observer)||void 0===d||d.setPushAudio(!0):null===(l=this._localStream.observer)||void 0===l||l.setEnableAudio(!0))):null===(h=this._localStream.observer)||void 0===h||h.setPublish(!0)),[4,this._mediaServerClient.publish(this._localStream)];case 2:return g.sent(),this._hasPublished=!0,this.emit(lK.ON_PUBLISH_RESULT,{isScreen:!1,state:Lf.PUBLISH_SUCC}),[3,4];case 3:throw y=g.sent(),this.emit(lK.ON_PUBLISH_RESULT,{isScreen:!1,state:Lf.PUBLISH_FAIL}),y;case 4:return[3,7];case 5:return[4,this.updatePubTrack()];case 6:g.sent(),g.label=7;case 7:return[2]}}))}))},t.prototype.updatePubTrack=function(){return r_(this,void 0,void 0,(function(){return i_(this,(function(e){switch(e.label){case 0:return vW.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 r_(this,void 0,void 0,(function(){return i_(this,(function(e){switch(e.label){case 0:return vW.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 r_(this,void 0,void 0,(function(){var i;return i_(this,(function(n){switch(n.label){case 0:return vW.print("subscribe","remoteStream %o",e),i=void 0,r&&(i=this._getSubLayer(r,e)),[4,this._mediaServerClient.subscribe(e,t,i)];case 1:return n.sent(),[2]}}))}))},t.prototype.updateSubTrack=function(e,t,r,i){var n;return r_(this,void 0,void 0,(function(){return i_(this,(function(o){return vW.print("updateSubTrack","Invoke updateSubTrack"),[2,null===(n=this._mediaServerClient)||void 0===n?void 0:n.updateSubTrack(e,t,r,i)]}))}))},t.prototype.updateSubVideoConfig=function(e,t){var r,i,n;return r_(this,void 0,void 0,(function(){var o,a;return i_(this,(function(s){return!(o=this._findRemoteStreamByScreen(e,!1))||!o.hasSubscribed||(null===(i=null===(r=null==o?void 0:o.attributes)||void 0===r?void 0:r.videoDescriptions)||void 0===i?void 0:i.length)<=1?[2]:(a=this._getSubLayer(t,o),o.originalStreamIndex=a.spatialLayer,[2,null===(n=this._mediaServerClient)||void 0===n?void 0:n.updateSubTrackLayer(o,a)])}))}))},t.prototype._getSubLayer=function(e,t){for(var r,i,n,o,a,s=null==t?void 0:t.attributes,c=s.videoDescriptions,u=s.subVideoDescriptions,d=Array.isArray(u)?u:c,l=-1,h=e.width*e.height,p=0;p<(null==d?void 0:d.length);p++)if(h>=(null===(r=d[p])||void 0===r?void 0:r.width)*(null===(i=d[p])||void 0===i?void 0:i.height)){l=p;break}var f=d[0];if(-1===l)f=d[l=d.length-1];else if(0!==l){var _=d[l-1].width*d[l-1].height,v=(_-h)/(_-d[l].width*d[l].height);f=v<.1?d[l-1]:d[l],l=v<.1?l-1:l}return a=null!==(n=null==f?void 0:f.sub_index)&&void 0!==n?n:-1,{spatialLayer:null!==(o=null==f?void 0:f.video_index)&&void 0!==o?o:l,spatialSubLayer:a}},t.prototype.unsubscribe=function(e,t){return r_(this,void 0,void 0,(function(){return i_(this,(function(r){switch(r.label){case 0:return vW.print("unsubscribe","Invoke unsubscribe"),[4,this._mediaServerClient.unsubscribe(e,t)];case 1:return r.sent(),[2]}}))}))},t.prototype.leave=function(e){var t;return void 0===e&&(e=!1),r_(this,void 0,void 0,(function(){var r,i,n,o,a,s,c;return i_(this,(function(u){switch(u.label){case 0:vW.print("leave","Invoke leave"),r=NU(),u.label=1;case 1:u.trys.push([1,3,,4]),clearTimeout(this._reconnectTimer);try{for(i=n_(this._remoteStreams.values()),n=i.next();!n.done;n=i.next())o=n.value,Array.isArray(o)&&o.forEach((function(e){var t;null===(t=e.observer)||void 0===t||t.setLogin(!1)}))}catch(e){s={error:e}}finally{try{n&&!n.done&&(c=i.return)&&c.call(i)}finally{if(s)throw s.error}}return this._localStream&&(null===(t=this._localStream.observer)||void 0===t||t.setLogin(!1)),[4,this._mediaServerClient.leave()];case 2:return u.sent(),this.destroy(),cj.rtcLeaveRoom(0,"",NU()-r),[3,4];case 3:if(a=u.sent(),e)throw a;return this.destroy(),a instanceof Error&&cj.rtcLeaveRoom(-1,a.message,NU()-r),[3,4];case 4:return[2]}}))}))},t.prototype.setRemoteUserPriority=function(e,t){var r,i;null===(r=this.remoteStreams.get(e))||void 0===r||r.forEach((function(e){return e.setRemoteUserPriority(t)})),null===(i=this.userPriorityMap)||void 0===i||i.set(e,t)},t.prototype.destroy=function(){var e,t,r,i;vW.print("destroy","Invoke destroy"),this._destroyAndInitMediaServerClient(),this._roomInfo=void 0,this._remoteUsers=new Map;try{for(var n=n_(this._remoteStreams),o=n.next();!o.done;o=n.next()){var a=o_(o.value,2)[1];Array.isArray(a)&&a.forEach((function(e){e&&e.clean()}))}}catch(t){e={error:t}}finally{try{o&&!o.done&&(t=n.return)&&t.call(n)}finally{if(e)throw e.error}}this._remoteStreams=new Map,this._localStream&&(null===(r=this._localStream)||void 0===r||r.clean(),this._localStream=void 0),this._localScreenStream&&(null===(i=this._localScreenStream)||void 0===i||i.clean(),this._localScreenStream=void 0),this._context=void 0,this._reconnectRecord=new yW,this._removeHandlerEventHandler(),clearTimeout(this._connectionLostTimer),this._userDuplicateLoginTimerMap.forEach((function(e){clearTimeout(e)})),this._userDuplicateLoginTimerMap.clear(),this._networkQualityManager.destroy(),this._videoSizeObserver.destroy(),this._subFallbackManager.destroy(),this._remoteStreamStreamIdUserIdMap={}},t.prototype.updateToken=function(e){return r_(this,void 0,void 0,(function(){return i_(this,(function(t){switch(t.label){case 0:return vW.print("updateToken","Invoke updateToken"),this._roomInfo&&(this._roomInfo.token=e),[4,this._mediaServerClient.updateToken(e)];case 1:return t.sent(),[2]}}))}))},t.prototype.pauseAllSubscribedStream=function(e){return r_(this,void 0,void 0,(function(){var t,r,i,n,o,a,s=this;return i_(this,(function(c){t=[];try{for(r=n_(this._remoteStreams.values()),i=r.next();!i.done;i=r.next())n=i.value,Array.isArray(n)&&n.forEach((function(r){if(r.hasSubscribed){var i=s.updateSubTrack(r,e,_K.UNSUB);i&&t.push(i)}}))}catch(e){o={error:e}}finally{try{i&&!i.done&&(a=r.return)&&a.call(r)}finally{if(o)throw o.error}}return[2,Promise.all(t)]}))}))},t.prototype.resumeAllSubscribedStream=function(e){return r_(this,void 0,void 0,(function(){var t,r,i,n,o,a,s=this;return i_(this,(function(c){t=[];try{for(r=n_(this._remoteStreams.values()),i=r.next();!i.done;i=r.next())n=i.value,Array.isArray(n)&&n.forEach((function(r){if(r.hasSubscribed&&r.hasSubscribed){var i=s.updateSubTrack(r,e,_K.SUB);i&&t.push(i)}}))}catch(e){o={error:e}}finally{try{i&&!i.done&&(a=r.return)&&a.call(r)}finally{if(o)throw o.error}}return[2,Promise.all(t)]}))}))},t.prototype.sendUserMessage=function(e,t){var r;return null===(r=this._mediaServerClient)||void 0===r?void 0:r.sendUserMessage(e,t)},t.prototype.setSessionId=function(){this._sessionId=dU(),lj.setStats({rtc_session_id:this._sessionId})},t.prototype.sendRoomMessage=function(e,t){var r,i;return void 0===t&&(t=!1),r_(this,void 0,void 0,(function(){var n,o;return i_(this,(function(a){switch(a.label){case 0:return n={clientId:null===(r=this._roomInfo)||void 0===r?void 0:r.userInfo.userId,binary:t,message:""},t?(o=n,[4,MU.ab2b64str(e)]):[3,2];case 1:return o.message=a.sent(),[3,3];case 2:n.message=e,a.label=3;case 3:return[2,null===(i=this._mediaServerClient)||void 0===i?void 0:i.sendRoomMessage(n)]}}))}))},t.prototype._destroyAndInitMediaServerClient=function(){vW.print("_destroyAndInitMediaServerClient()"),this._mediaServerClient&&(this._mediaServerClient.destroy(),this._removeHandlerEventHandler()),this._mediaServerClient=new ZK(this._context),this._addHandlerEventHandler()},t.prototype._onJoinSucc=function(e,t){var r,i,n,o,a,s=this;vW.print("JoinSuccess()"),this._serverConfig=e.config;var c=[],u=[],d=[],l=[],h=[];null===(a=e.clientsDetail)||void 0===a||a.forEach((function(t){if(t.clientId!==e.clientId){var r=s._remoteUsers.get(t.clientId);r?r._stillExist=!0:c.push(t)}}));try{for(var p=n_(this._remoteUsers.values()),f=p.next();!f.done;f=p.next()){var _=f.value;_._stillExist||u.push({clientId:_.userId}),delete _._stillExist}}catch(e){r={error:e}}finally{try{f&&!f.done&&(i=p.return)&&i.call(p)}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,h.push(e)):l.push(e)}));try{for(var v=n_(this._remoteStreams.values()),m=v.next();!m.done;m=v.next()){var y=m.value;Array.isArray(y)&&y.forEach((function(e){e.stillExist?delete e.stillExist:d.push({clientId:e.userId,streamId:e.streamId,message:LG.clientDisconnected})}))}}catch(e){n={error:e}}finally{try{m&&!m.done&&(o=v.return)&&o.call(v)}finally{if(n)throw n.error}}setTimeout((function(){u.forEach((function(e){return s._onUserDisconnection(e)})),c.forEach((function(e){return s._onUserConnection(e)})),d.forEach((function(e){return s._onRemoveStream(e)})),l.forEach((function(e){return s._onAddStream(e,!0,!1)})),h.forEach((function(e){return s._onUpdateStreamAttributes(e)})),t&&s._handleSendOrRecvStreamAfterReconnect()}))},t.prototype._handleSendOrRecvStreamAfterReconnect=function(){var e,t,r=this;this._localStream&&(this._localStream.clean(),this._mediaServerClient.publish(this._localStream).catch((function(e){}))),this._localScreenStream&&(this._localScreenStream.clean(),this._mediaServerClient.publish(this._localScreenStream).catch((function(e){})));try{for(var i=n_(this._remoteStreams.values()),n=i.next();!n.done;n=i.next()){var o=n.value;Array.isArray(o)&&o.forEach((function(e){return r_(r,void 0,void 0,(function(){var t;return i_(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]),vW.print("start resubscribe ".concat(e.userId," with ").concat(e.subMediaType)),[4,this._mediaServerClient.subscribe(e,e.subMediaType)];case 2:return r.sent(),vW.print("success resubscribe ".concat(e.userId," with ").concat(e.subMediaType)),this.safeEmit(lK.RESUBSCRIBE,{stream:e}),[3,4];case 3:return t=r.sent(),vW.print("failed resubscribe ".concat(e.userId," with ").concat(e.subMediaType,", error:").concat(t)),e.clean(),null==e||e.resetHasSubscribed(),[3,4];case 4:return[2]}}))}))}))}}catch(t){e={error:t}}finally{try{n&&!n.done&&(t=i.return)&&t.call(i)}finally{if(e)throw e.error}}},t.prototype._findRemoteStream=function(e,t){var r=this._remoteStreams.get(e);return Array.isArray(r)?r.find((function(e){return e.streamId===t})):null},t.prototype._findRemoteStreamByScreen=function(e,t){var r=this._remoteStreams.get(e);return Array.isArray(r)?r.find((function(e){return e.isScreen===t})):null},t.prototype._onAddStream=function(e,t,r){var i,n,o,a,s,c,u,d,l,h,p;if(void 0===t&&(t=!0),void 0===r&&(r=!0),e.clientId!==(null===(i=this._roomInfo)||void 0===i?void 0:i.userInfo.userId)){var f=this._findRemoteStream(e.clientId,e.streamId);if(this._remoteStreamStreamIdUserIdMap[e.streamId]=e.clientId,!f){f=new CK(e.clientId,e.streamId,e.screen,!1,e.attributes,null===(n=this.userPriorityMap)||void 0===n?void 0:n.get(e.clientId)),this._initStreamListeners(f);var _=this._remoteStreams.get(e.clientId);_?_.push(f):this._remoteStreams.set(e.clientId,[f])}if(this._mediaServerClient.handler&&(f.observer=new iW(f,this._mediaServerClient.handler)),!f.isScreen&&(r&&f.hasVideo&&(f.attributes.extvideo?(null===(o=f.observer)||void 0===o||o.setExternalVideoSource(!0),null===(a=f.observer)||void 0===a||a.setPushVideo(!0)):(null===(s=f.observer)||void 0===s||s.setExternalVideoSource(!1),null===(c=f.observer)||void 0===c||c.setPublishVideo(!0))),r&&f.hasAudio&&!this._mediaServerClient.roomAttributes.multiChatMode&&(f.attributes.extaudio?(null===(u=f.observer)||void 0===u||u.setExternalAudioSource(!0),null===(d=f.observer)||void 0===d||d.setPushAudio(!0)):(null===(l=f.observer)||void 0===l||l.setExternalAudioSource(!1),null===(h=f.observer)||void 0===h||h.setPublishAudio(!0))),!0===t&&!1===r)){var v=this._roomConfig,m=v.isAutoSubscribeAudio,y=v.isAutoSubscribeVideo;null===(p=f.observer)||void 0===p||p.setLogin(!0,{audio:!!m,video:!!y})}return t&&this.safeEmit(xG.ON_ADD_STREAM,{stream:f}),f}},t.prototype._onUserConnection=function(e){var t;if(e.clientId!==(null===(t=this._roomInfo)||void 0===t?void 0:t.userInfo.userId)){var r=this._userDuplicateLoginTimerMap.get(e.clientId);if("number"==typeof r)return this._userDuplicateLoginTimerMap.delete(e.clientId),void self.clearTimeout(r);var i={userId:e.clientId,extraInfo:e.attributes.extra_info};this._remoteUsers.set(e.clientId,e_({},i)),this.safeEmit(xG.USER_CONNECTION,{userInfo:i})}},t.prototype._onUserDisconnection=function(e){var t,r=this,i=e.clientId,n=e.tag,o=e.code;if(i)if(i===(null===(t=this.roomInfo)||void 0===t?void 0:t.userInfo.userId)){var a=null;n===BG.kickedByAdmin?a=Zj.KICKED_OUT:n===BG.onUserTokenDidExpire?a=Zj.TOKEN_EXPIRED:n===BG.userDuplicateLogin&&(a=Zj.DUPLICATE_LOGIN),o===jG.roomDismissByAdmin&&(a=Zj.ROOM_DISMISS),a&&this.safeEmit(lK.ON_ROOM_ERROR,{errorCode:a})}else{var s=Nf.DROPPED;n===BG.userLeave?s=Nf.QUIT:n===BG.kickedByAdmin?s=Nf.KICKED_BY_ADMIN:n===BG.roleChanged&&(s=Nf.SWITCH_TO_INVISIBLE);var c=function(){var e;r._remoteUsers.delete(i),null===(e=r._remoteStreams.get(i))||void 0===e||e.forEach((function(e){r._onRemoveStream({clientId:e.userId,streamId:e.streamId,message:"client disconnected"})})),r.safeEmit(lK.ON_USER_LEAVE,{userInfo:{userId:i},reason:s})};if(n===BG.userDuplicateLogin){this._userDuplicateLoginTimerMap.has(i)&&(self.clearTimeout(this._userDuplicateLoginTimerMap.get(i)),this._userDuplicateLoginTimerMap.delete(i));var u=self.setTimeout(c,5e3);this._userDuplicateLoginTimerMap.set(i,u)}else c()}},t.prototype._onRemoveStream=function(e){var t,r,i,n,o=this;if(e.clientId!==(null===(t=this._roomInfo)||void 0===t?void 0:t.userInfo.userId)){var a=this._remoteStreams.get(e.clientId);if(a){var s=a.find((function(t){return t.streamId==e.streamId}));s&&(null===(r=this._mediaServerClient)||void 0===r||r.handleRemoveStream(s,e).then((function(){if(!(null==s?void 0:s._workaround_1_)){var t=o._remoteStreams.get(e.clientId);if(!t)return;t=t.filter((function(t){return t.streamId!==e.streamId||(t.clean(),!1)})),o._remoteStreams.set(e.clientId,t)}})).finally((function(){o.safeEmit(xG.ON_REMOVE_STREAM,{stream:s,reason:e.message})})),s.hasVideo&&(null===(i=s.observer)||void 0===i||i.setPublishVideo(!1)),s.hasAudio&&!this._mediaServerClient.roomAttributes.multiChatMode&&(null===(n=s.observer)||void 0===n||n.setPublishAudio(!1)))}}},t.prototype._onUpdateRoomAttributes=function(e){e.roomAttributes&&(this._mediaServerClient.roomAttributes=e.roomAttributes)},t.prototype._onUpdateStreamAttributes=function(e){var t,r,i,n,o,a,s,c,u,d,l,h,p,f,_,v,m,y,g=e.clientId,S=e.streamId,E=e.attributes,b=this._findRemoteStream(g,S);if(b){var I=b.attributes,T=e_(e_({},I),E),A=!1,R=T.localaudio!==I.localaudio,C=!1,O=!1,w=T.localvideo!==I.localvideo,k=!1,N=$z.NONE,P=$z.NONE;T.audiostream!==I.audiostream&&(A=T.localaudio,C=!!T.audiostream,T.audiostream?N|=Ff.AUDIO:P|=Ff.AUDIO),T.videostream!==I.videostream&&(O=T.localvideo,k=!!T.videostream,T.videostream?N|=Ff.VIDEO:P|=Ff.VIDEO),N&&this.safeEmit(lK.ON_USER_PUBLISH_STATE_CHANGE,{userId:g,mediaType:N,isScreen:b.isScreen,pubState:fK.PUB,remoteStream:b}),P&&this.safeEmit(lK.ON_USER_PUBLISH_STATE_CHANGE,{userId:g,mediaType:P,isScreen:b.isScreen,pubState:fK.UNPUB,remoteStream:b}),T.localaudio!==I.localaudio&&(T.localaudio?(T.extaudio?(null===(t=b.observer)||void 0===t||t.setExternalAudioSource(!0),null===(r=b.observer)||void 0===r||r.setPushAudio(!0)):(null===(i=b.observer)||void 0===i||i.setExternalAudioSource(!1),null===(n=b.observer)||void 0===n||n.setEnableAudio(!0)),this.safeEmit(lK.ON_USER_START_AUDIO_CAPTURE,{userId:g})):(T.extaudio?(null===(o=b.observer)||void 0===o||o.setExternalAudioSource(!0),null===(a=b.observer)||void 0===a||a.setPushAudio(!1)):(null===(s=b.observer)||void 0===s||s.setExternalAudioSource(!1),null===(c=b.observer)||void 0===c||c.setEnableAudio(!1)),!b.isScreen&&this.safeEmit(lK.ON_USER_STOP_AUDIO_CAPTURE,{userId:g}))),T.localvideo!==I.localvideo&&(T.localvideo?(T.extvideo?(null===(u=b.observer)||void 0===u||u.setExternalVideoSource(!0),null===(d=b.observer)||void 0===d||d.setPushVideo(!0)):(null===(l=b.observer)||void 0===l||l.setExternalVideoSource(!1),null===(h=b.observer)||void 0===h||h.setEnableVideo(!0)),this.safeEmit(lK.ON_USER_START_VIDEO_CAPTURE,{userId:g})):(T.extvideo?(null===(p=b.observer)||void 0===p||p.setExternalVideoSource(!0),null===(f=b.observer)||void 0===f||f.setPushVideo(!1)):(null===(_=b.observer)||void 0===_||_.setExternalVideoSource(!1),null===(v=b.observer)||void 0===v||v.setEnableVideo(!1)),!b.isScreen&&this.safeEmit(lK.ON_USER_STOP_VIDEO_CAPTURE,{userId:g}))),A&&!R&&(null===(m=b.observer)||void 0===m||m.setRemoteUnmuteAudio(C)),O&&!w&&(null===(y=b.observer)||void 0===y||y.setRemoteUnmuteVideo(k)),b.attributes=T}},t.prototype._onPushTrack=function(e){var t=this,r=e.clientId,i=e.streamId,n=this._findRemoteStream(r,i);n||(n=this._onAddStream(e,!1,!1)),this._mediaServerClient.subscribe4pushTrack(n,e).then((function(){return t.safeEmit(lK.SUBSCRIBE_PUSH_TRACK,{stream:n})})).catch((function(e){vW.print("subscribe push track failed: ".concat(e))}))},t.prototype._onRemoveTrack=function(e){var t=this,r=e.clientId,i=e.streamId,n=e.message,o=this._findRemoteStream(r,i);o&&this._mediaServerClient.unsubscribe4removeTrack(o,n).then((function(){var e;if(o._workaround_1_){var n=null===(e=t._remoteStreams.get(r))||void 0===e?void 0:e.filter((function(e){return e.streamId!==i}));t._remoteStreams.set(r,n||[])}t.safeEmit(lK.REMOVE_PUSH_TRACK,{stream:o})})).catch((function(e){vW.print("remove push track failed: ".concat(e))}))},t.prototype._nodeChange=function(e){var t,r=e.nodes,i=e.reason;zF.clearAccessNode(null===(t=this._roomInfo)||void 0===t?void 0:t.appId),this._destroyAndInitMediaServerClient(),Array.isArray(r)&&r.length?this._getAccessNode=r[0]:this._getAccessFeedback=i,cj.rtcNodeChange(0,JSON.stringify(e),JSON.stringify(i)),this._joinResolveCallback&&this._joinRejectCallback?this._join(this._joinResolveCallback,this._joinRejectCallback):this._reconnect()},t.prototype._reconnect=function(){var e,t,r=this;this._isReconnecting=!0;try{for(var i=n_(this._remoteStreams.values()),n=i.next();!n.done;n=i.next()){var o=n.value;Array.isArray(o)&&o.forEach((function(e){return e.clean()}))}}catch(t){e={error:t}}finally{try{n&&!n.done&&(t=i.return)&&t.call(i)}finally{if(e)throw e.error}}cj.rtcReconnect(1002,hB.PEERCONNECTION_RECONNECTING,this._roomInfo.userInfo.userId,pB.PEERCONNECTION),this._join((function(){cj.rtcReconnected(fB.PEERCONNECTION_RECONNECTED,_B.PEERCONNECTION)}),(function(e){r._reconnectRecord.record(e),r._reconnectRecord.shouldReconnect?(vW.print("Reconnecting error, will reconnect after 3s",e),r._reconnectTimer=window.setTimeout(r._reconnect.bind(r),3e3)):(r.safeEmit(lK.RECONNECT_FAILED),r.destroy())}),!0)},t.prototype._handleAbnormalDisconnection=function(){vW.print("on ABNORMAL_DISCONNECTION"),this._destroyAndInitMediaServerClient(),navigator.onLine?this._reconnect():this._reconnectTimer=window.setTimeout(this._reconnect.bind(this),3e3)},t.prototype._onConnectionStateChange=function(e){var t,r=this;if(e.next===WK.DISCONNECTED)t=jf.CONNECTION_STATE_DISCONNECTED;else if(e.next===WK.CONNECTED)clearTimeout(this._connectionLostTimer),t=this._isReconnecting?jf.CONNECTION_STATE_RECONNECTED:jf.CONNECTION_STATE_CONNECTED;else{if(e.next!==WK.CONNECTING)return;t=this._isReconnecting?jf.CONNECTION_STATE_RECONNECTING:jf.CONNECTION_STATE_CONNECTING}e.prev===WK.CONNECTED&&e.next===WK.DISCONNECTED&&(this._connectionLostTimer=window.setTimeout((function(){r.safeEmit(FG.ON_CONNECTION_STATE_CHANGE,{state:jf.CONNECTION_STATE_LOST})}),1e4)),this._networkQualityManager.setConnectionState(e.next),this.safeEmit(FG.ON_CONNECTION_STATE_CHANGE,{state:t})},t.prototype._initStreamListeners=function(e){var t=this;e.on("ontrack",(function(e){e.track})),e.on("onSEIMessage",(function(r){var i;t.emit(lK.ON_SEI_MESSAGED_RECEIVED,{sei:r,remoteStreamKey:{userId:e.userId,roomId:null===(i=t._roomInfo)||void 0===i?void 0:i.roomId,streamIndex:e.isScreen?Vf.STREAM_INDEX_SCREEN:Vf.STREAM_INDEX_MAIN}})}))},t.prototype._onCustomMessage=function(e){this.safeEmit(xG.ON_CUSTOM_MESSAGE,e)},t.prototype._onUserMessageReceived=function(e){this.safeEmit(xG.USER_MESSAGE_RECEIVED,{userId:e.from,message:e.msg})},t.prototype._onUserBinaryMessageReceived=function(e){this.safeEmit(xG.USER_BINARY_MESSAGE_RECEIVED,{userId:e.from,message:e.msg})},t.prototype._onPostProcessingMessage=function(e){if(e.body){var t=e.body,r=t.error||0,i=pK.START,n=["success","parameter error","subscription timeout","ffmpeg error","cdn error","publish error"];if("2.0"===t.protocol){switch(t.eventType){case"TranscodeStarted":0!==t.error&&(i=pK.START_FAILED);break;case"TranscodeStateChanged":i=0!==t.error?pK.START_FAILED:pK.START_SUCCESS;break;case"TranscodeStopped":i=0!==t.error?pK.STOP_FAILED:pK.STOP_SUCCESS;break;case"TranscodeUpdated":i=0!==t.error?pK.UPDATE_FAILED:pK.UPDATE_SUCCESS}this.safeEmit(xG.POST_PROCESSING_MESSAGE,{code:r,protocol:t.protocol,error:t.error,eventType:i,message:n[r]})}this.safeEmit(xG.POST_PROCESSING_MESSAGE,{code:r,message:n[r],type:e.type})}},t.prototype._onUserTokenWillExpire=function(){this.safeEmit(xG.ON_USER_TOKEN_WILL_EXPIRE,null)},t.prototype._onSceneConfig=function(e){},t.prototype._onStreamFailed=function(e){var t,r,i,n,o,a;return r_(this,void 0,void 0,(function(){var s,c,u;return i_(this,(function(d){switch(d.label){case 0:return"publish"!==e.type?[3,2]:(s=void 0,(null===(t=this.localStream)||void 0===t?void 0:t.streamId)===e.streamId?s=this.localStream:(null===(r=this.localScreenStream)||void 0===r?void 0:r.streamId)===e.streamId&&(s=this.localScreenStream),s?(null==s||s.clean(),[4,null===(i=this._mediaServerClient)||void 0===i?void 0:i.unpublish(s).catch((function(){}))]):[2]);case 1:return d.sent(),null===(n=this._mediaServerClient)||void 0===n||n.publish(s).catch((function(){})),[3,5];case 2:return"subscribe"!==e.type?[3,5]:(c=this._remoteStreamStreamIdUserIdMap[e.streamId],(u=this._findRemoteStream(c,e.streamId))?[4,null===(o=this._mediaServerClient)||void 0===o?void 0:o.unsubscribe(u,Ff.AUDIO_AND_VIDEO)]:[3,5]);case 3:return d.sent(),[4,null===(a=this._mediaServerClient)||void 0===a?void 0:a.subscribe(u,u.subMediaType,u.subLayer)];case 4:d.sent(),this.safeEmit(lK.RESUBSCRIBE,{stream:u}),d.label=5;case 5:return[2]}}))}))},t.prototype._onStreamControlMessage=function(e){var t,r;e.type===UG.PushLimitWarn&&((null===(t=this._localStream)||void 0===t?void 0:t.pubAudio)||(null===(r=this._localStream)||void 0===r?void 0:r.pubVideo)||this.unpublish())},t.prototype._onPublishOnDemand=function(){var e,t,r,i,n,o,a,s,c,u,d;return r_(this,void 0,void 0,(function(){var l,h,p,f,_,v,m,y,g;return i_(this,(function(S){switch(S.label){case 0:return this._publishOnDemandBusy||!1===(null===(r=null===(t=null===(e=this._serverConfig)||void 0===e?void 0:e.engine_VPM)||void 0===t?void 0:t.ondemand)||void 0===r?void 0:r.enable)?[2]:(l=this._publishOnDemandItem,this._publishOnDemandItem=void 0,l?(null===(i=this._localStream)||void 0===i?void 0:i.enableSimulcast)&&(null===(n=this._localStream)||void 0===n?void 0:n.videoTransceiver)?(this._publishOnDemandBusy=!0,h=null===(o=this._localStream)||void 0===o?void 0:o.stream.id,p=null===(a=this._localStream)||void 0===a?void 0:a.videoTransceiver.sender,(f=p.getParameters())&&Array.isArray(f.encodings)&&Array.isArray(l)&&(_={},vW.print("_onPublishOnDemand exec","usedDescriptions: %o",l),l.forEach((function(e){var t;if(null===(t=null==e?void 0:e.StreamIds)||void 0===t?void 0:t.includes(h)){var r=null==e?void 0:e.Metadata.SubvideoIndex;_[r]=r}})),v={},null===(c=null===(s=this._localStream)||void 0===s?void 0:s.subVideoDescriptions)||void 0===c||c.forEach((function(e){void 0!==_[e.sub_index]&&(v[e.video_index]=e)})),m=(null===(d=null===(u=p.track)||void 0===u?void 0:u.getSettings())||void 0===d?void 0:d.height)||720,y=[],g=0,f.encodings=f.encodings.map((function(e){return e.rid&&(v[e.rid]?(e.active=!0,e.scaleResolutionDownBy=Math.max(m/v[e.rid].height,1),y.push({type:1,rid:e.rid,downBy:e.scaleResolutionDownBy,bitrate:e.maxBitrate})):(g++,y.push({type:0,rid:e.rid}),e.active=!1)),e})),g===f.encodings.length&&(f.encodings[0].active=!0,cj.rtcInvokeStatus(JSON.stringify(y),0,"rscp_error",h,0)),cj.rtcInvokeStatus(JSON.stringify(y),0,"rscp",h,0)),[4,p.setParameters(f)]):[3,2]:[2]);case 1:S.sent(),this._publishOnDemandBusy=!1,S.label=2;case 2:return this._onPublishOnDemand(),[2]}}))}))},t.prototype._reportNetworkQuality=function(e,t){this._subFallbackManager.updateNetworkQuality(e,t),this.emit(lK.ON_NETWORK_QUALITY,e,t)},t.prototype._emitVideoSizeChange=function(e,t,r,i){var n;this.emit(lK.ON_REMOTE_VIDEO_SIZE_CHANGED,{roomId:null===(n=this.roomInfo)||void 0===n?void 0:n.roomId,userId:e,streamIndex:t?Vf.STREAM_INDEX_SCREEN:Vf.STREAM_INDEX_MAIN},{width:r,height:i})},t.prototype._emitSubscribeFallback=function(e){this.emit(lK.ON_SIMULCAST_SUBSCRIBE_FALLBACK,e)},t}(oj),yW=function(){function e(){this._all_201_count=0,this._has_4xx=!1}return Object.defineProperty(e.prototype,"shouldReconnect",{get:function(){return!(this._all_201_count>=3||this._has_4xx)},enumerable:!1,configurable:!0}),e.prototype.record=function(e){var t=!1,r=!1;if(Array.isArray(e)){var i=0;e.map((function(e){var t,n,o;400<=(null===(t=e.error)||void 0===t?void 0:t.code)&&(null===(n=e.error)||void 0===n?void 0:n.code)<500&&(r=!0),201===(null===(o=e.error)||void 0===o?void 0:o.code)&&i++})),i===e.length&&(t=!0),t&&this._all_201_count++,r&&(this._has_4xx=!0)}},e.prototype.clear=function(){this._all_201_count=0,this._has_4xx=!1},e}(),gW=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=o_(e,2),i=t[0],n=t[1];"muted"===i?r.muted=!0:r.setAttribute(i,n)})),r},SW=new rj("Player",0),EW=new(function(e){function t(){var t=e.call(this)||this;return t._audioPlayMap=new Map,document.body?t._listenPageClick():window.addEventListener("load",(function(){t._listenPageClick()})),t}return Of(t,e),Object.defineProperty(t.prototype,"players",{get:function(){return this._audioPlayMap},enumerable:!1,configurable:!0}),t.prototype._listenPageClick=function(){document.body.addEventListener("touchstart",this.resumeAudioPlayer.bind(this),!0),document.body.addEventListener("mousedown",this.resumeAudioPlayer.bind(this),!0)},t.prototype.resumeAudioPlayer=function(){this._audioPlayMap.forEach((function(e){e._hasManuallyPause||e.manuallyPlay().then((function(e){})).catch((function(e){SW.print("Replay audio player failed!",e)}))}))},t.prototype.addRequestClickPlayer=function(e){this._audioPlayMap.get(e.userId)||(SW.print("Put ".concat(e.userId," player into waiting array")),this._audioPlayMap.set(e.userId,e))},t.prototype.removeRequestClickPlayer=function(e){SW.print("Remove ".concat(e.userId," player from waiting array")),this._audioPlayMap.delete(e.userId)},t}(ZB)),bW=new rj("Player",0),IW=["play","playing","pause","ended","error","seeking","seeked","waiting","canplay","canplaythrough","durationchange","volumechange","loadedmetadata","loadeddata","loadstart","timeupdate"],TW={playsinline:"","webkit-playsinline":""},AW={playsinline:"","webkit-playsinline":"","x5-playsinline":"","x5-video-player-type":"h5","x-webkit-airplay":"allow",preload:"",muted:""},RW=function(e){function t(t){var r=e.call(this)||this;r.mirrorType=Gf.MIRROR_TYPE_NONE,r.played=!1,r._emitPlayFailed=!1,r._hasManuallyPause=!1,r.emitVideoEvent=function(e){var t,i,n={type:"video",rawEvent:e,readyState:(null===(t=r._videoDom)||void 0===t?void 0:t.readyState)||0,userId:r.userId,eventName:e.type,currentTime:(null===(i=r._videoDom)||void 0===i?void 0:i.currentTime)||0,isScreen:r.isScreen};switch(r.emit("playback_event",n),e.type){case"canplay":case"loadeddata":r._internalPlay();break;case"playing":bW.print("VideoPlayerPlaying","[userId-".concat(r.userId,"] video element playing"))}},r._internalPlay=function(){var e,t;if(mj("_internalPlay video",{paused:null===(e=r._videoDom)||void 0===e?void 0:e.paused,manuallyPause:r._hasManuallyPause}),!r._hasManuallyPause&&(null===(t=r._videoDom)||void 0===t?void 0:t.paused)){var i=r._videoDom.play();(null==i?void 0:i.then)&&i.catch((function(e){var t,i,n,o;if(!r._emitPlayFailed){if("AbortError"===e.name)return cj.rtcError("video play failed, userId: ".concat(r.userId,", ").concat(e.name," ").concat(e.message),-1e3),void 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:"play-error",currentTime:(null===(i=r._videoDom)||void 0===i?void 0:i.currentTime)||0,isScreen:r.isScreen});r._emitPlayFailed=!0,cj.rtcError("video autoplay failed, userId: ".concat(r.userId,", ").concat(e.name," ").concat(e.message),-1e3),r.emit("playback_event",{type:"video",rawEvent:e,readyState:(null===(n=r._videoDom)||void 0===n?void 0:n.readyState)||0,userId:r.userId,eventName:"autoplay-error",currentTime:(null===(o=r._videoDom)||void 0===o?void 0:o.currentTime)||0,isScreen:r.isScreen})}}))}};var i=t.renderDom,n=t.userId;r.renderMode=void 0!==t.renderMode?t.renderMode:xf.RENDER_MODE_FIT;var o="string"==typeof i?document.getElementById(i):i;if(!o)throw new oG(Zj.CANT_FIND_DOM,"can't find video dom ",i);return r._videoContainer=document.createElement("div"),r._videoContainer.style.width="100%",r._videoContainer.style.height="100%",r._videoContainer.style.position="relative",r._videoContainer.style.overflow="hidden",r._containerDom=o,r.userId=n,r.isScreen=!!t.isScreen,r._initVideo(),r._pausedTimer=setInterval((function(){r._videoDom&&(r._prevPaused!==r._videoDom.paused&&bW.print("VideoPlayer.videoDom.pausedChange",r._videoDom.paused),r._prevPaused=r._videoDom.paused)}),500),xU&&15===BU&&(r._safari15VideoTimer=window.setInterval((function(){try{r._videoContainer.style.display="block",setTimeout((function(){r._videoContainer.style.display="flex"}),500)}catch(e){}}),5e3)),r}return Of(t,e),t.prototype._initVideo=function(){this._videoDom||(this._videoDom=gW("video",{style:{width:"100%",height:"100%"},attributes:AW}),this._videoDom.id="".concat(this.userId,"_").concat(kU()),this.renderMode===xf.RENDER_MODE_FIT?this._videoDom.style.objectFit="contain":this._videoDom.style.objectFit="cover",this.mirror(this.mirrorType===Gf.MIRROR_TYPE_RENDER)),this._videoContainer.appendChild(this._videoDom),this._containerDom.appendChild(this._videoContainer),this._initListeners()},t.prototype._initListeners=function(){var e=this;this._videoDom&&IW.forEach((function(t){var r;null===(r=e._videoDom)||void 0===r||r.addEventListener(t,e.emitVideoEvent)}))},t.prototype._removeListeners=function(){var e,t,r=this;this._videoDom&&(IW.forEach((function(e){var t;null===(t=r._videoDom)||void 0===t||t.removeEventListener(e,r.emitVideoEvent)})),null===(e=this._videoDom)||void 0===e||e.removeEventListener("canplay",this._internalPlay),null===(t=this._videoDom)||void 0===t||t.removeEventListener("loadeddata",this._internalPlay))},t.prototype._recordFrame=function(e){var t=this;this.on("playback_event",(function(r){var i;if("timeupdate"===r.eventName){var n=e.isScreen?1.5:.5;if(0===(null===(i=t._videoDom)||void 0===i?void 0:i.currentTime))return;if(void 0===t.__cumulativeTime)return void(t.__cumulativeTime=t._videoDom.currentTime);if(e.recordedVideoFrames||(e.recordedVideoFrames=[]),t._videoDom.currentTime>t.__cumulativeTime){var o=Math.floor(1e3*(t._videoDom.currentTime-t.__cumulativeTime)),a=t._videoDom.currentTime-t.__cumulativeTime>n;e.recordedVideoFrames.push({playTime:t._videoDom.currentTime,isStall:a,stallCount:a?1:0,stallDuration:o%2e3})}t.__cumulativeTime=t._videoDom.currentTime}}))},t.prototype.playVideo=function(e,t){var r;return r_(this,void 0,void 0,(function(){var t,i,n=this;return i_(this,(function(o){if(t=this._videoDom,bW.print("playVideo","play video track: ".concat(this.userId)),t&&t.srcObject instanceof MediaStream&&t.srcObject.getTrackById(null===(r=e.getTrack())||void 0===r?void 0:r.id)){try{cj.rtcInvokeStatus("play video repeatedly",0,"playVideo",this.userId,0)}catch(e){}return[2]}return t||(this._initVideo(),t=this._videoDom),bW.print("playVideo","play video by dom: ".concat(null==t?void 0:t.id)),(i=new MediaStream).addTrack(e.getTrack()),t.srcObject=i,t&&!this._containerDom.contains(this._videoContainer)&&this._containerDom.appendChild(this._videoContainer),t&&!this._videoContainer.contains(t)&&this._videoContainer.appendChild(t),setTimeout((function(){return n._internalPlay()})),this.played=!0,[2]}))}))},t.prototype.updateSrcObject=function(e){var t=e.getTrack();if(t&&this._videoDom){var r=new MediaStream;r.addTrack(t),this._videoDom.srcObject=r}},t.prototype.manuallyPause=function(){if(bW.print("Invoke VideoPlayer.manuallyPause",this.userId,this.isScreen),this.played){if(this._hasManuallyPause=!0,!this._videoDom)throw new oG(Zj.INVALID_PARAMS,"Player not found");return this._videoDom.pause()}},t.prototype.manuallyPlay=function(){if(bW.print("Invoke VideoPlayer.manuallyPlay",this.userId,this.isScreen),this._emitPlayFailed=!1,this._hasManuallyPause=!1,!this._videoDom)throw new oG(Zj.INVALID_PARAMS,"Player not found");return 0!==this._videoDom.readyState||GU?this._videoDom.play():Promise.resolve()},t.prototype.mirror=function(e){bW.print("mirror","".concat(this.userId," set mirror: ").concat(e)),this.mirrorType=e?Gf.MIRROR_TYPE_RENDER:Gf.MIRROR_TYPE_NONE,this._videoDom&&(this._videoDom.style.transform=e?"rotateY(180deg)":"")},t.prototype.stop=function(){var e,t=this._containerDom;bW.print("stop","stop video track: ".concat(this.userId)),this._videoDom&&(this._videoDom.srcObject=null,(null==t?void 0:t.contains(this._videoContainer))&&t.removeChild(this._videoContainer),(null===(e=this._videoContainer)||void 0===e?void 0:e.contains(this._videoDom))&&this._videoContainer.removeChild(this._videoDom),clearInterval(this._pausedTimer)),this.__cumulativeTime=void 0,this.played=!1},t.prototype.destroy=function(){bW.print("destroy","video player: ".concat(this.userId)),this.stop(),e.prototype.removeAllListeners.call(this),this._removeListeners(),this._videoDom&&(this._videoDom.srcObject=null,delete this._videoDom),this._safari15VideoTimer&&(window.clearInterval(this._safari15VideoTimer),this._safari15VideoTimer=void 0)},Object.defineProperty(t.prototype,"domElement",{get:function(){return this._videoDom},enumerable:!1,configurable:!0}),t}(nB.exports.EventEmitter),CW=new(function(){function e(){this._context=iU.getAudioContextInstance()}return e.prototype.getDestinationNode=function(){return this._context.destination},e.prototype.createMediaElementSource=function(e){return this._context.createMediaElementSource(e)},e}()),OW=null,wW=function(e){function t(t,r){var i=void 0===r?{divId:void 0,muted:!1,isScreen:!1,useWebAudio:!1}:r,n=i.divId,o=i.muted,a=i.isScreen,s=i.useWebAudio,c=e.call(this)||this;if(c._stallCount=0,c.muted=!1,c._emitPlayFailed=!1,c._hasManuallyPause=!1,c.played=!1,c._useWebAudio=!1,c.emitAudioEvent=function(e){var t,r,i={type:"audio",rawEvent:e,readyState:(null===(t=c._audioDom)||void 0===t?void 0:t.readyState)||0,userId:c.userId,eventName:e.type,currentTime:(null===(r=c._audioDom)||void 0===r?void 0:r.currentTime)||0,isScreen:c.isScreen};"playing"===e.type&&(bW.print("AudioPlayerPlaying","[userId-".concat(c.userId,"] audio element playing")),jU&&(OW||(OW=window.setTimeout((function(){bW.print("AudioPlayerPlaying","[userId-".concat(c.userId,"] audio playing workaround"));var e=new AudioContext;e.close(),e=null,OW=null}),2500)))),"pause"===e.type&&bW.print("AudioPlayerPause","[userId-".concat(c.userId,"] audio element pause")),HU&&GU&&("canplay"===e.type?(clearTimeout(c._wechatTimer),c._wechatTimer=window.setTimeout((function(){c._autoPlayError("wechat")}),500)):"playing"===e.type&&clearTimeout(c._wechatTimer)),c.emit("playback_event",i)},c._internalPlay=function(){var e,t;if(mj("_internalPlay audio",{paused:null===(e=c._audioDom)||void 0===e?void 0:e.paused,manuallyPause:c._hasManuallyPause}),!c._hasManuallyPause&&(null===(t=c._audioDom)||void 0===t?void 0:t.paused)){try{var r=c._audioDom.play();c._audioDom.volume=1,(null==r?void 0:r.then)&&r.catch((function(e){c._autoPlayError(e),cj.rtcError("audio autoplay failed, userId: ".concat(c.userId,": ").concat(e.message," ").concat(e.name),-1e3)})).then((function(){mj("_internalPlay successfully",{userId:c.userId})}))}catch(e){c._autoPlayError(e),cj.rtcError("audio autoplay failed, userId: ".concat(c.userId,": ").concat(e.message," ").concat(e.name),-1e3)}HU&&EW.addRequestClickPlayer(c)}},n){var u=document.getElementById(n);if(!u)throw new oG(Zj.CANT_FIND_DOM,"can't find audio dom ".concat(n));c._containerDom=u}else c._containerDom=document.body;return c.userId=t,c.muted=o,c.isScreen=a,c._useWebAudio=!!s,c._initAudio(),c}return Of(t,e),t.prototype._initAudio=function(){this._audioDom||(this._audioDom=gW("audio",{style:{display:"none"},attributes:TW}),this._audioDom.volume=this.muted?0:1,this._audioDom.muted=this.muted,this._audioDom.id="".concat(this.userId,"_").concat(kU()),this._containerDom.appendChild(this._audioDom),this._useWebAudio&&(this._sourceNode=CW.createMediaElementSource(this._audioDom),this._sourceNode.connect(CW.getDestinationNode()),bW.print("AudioPlayer","[userId-".concat(this.userId,"] use web audio output")))),this._initListeners()},t.prototype._initListeners=function(){var e=this;this._audioDom&&IW.forEach((function(t){var r;null===(r=e._audioDom)||void 0===r||r.addEventListener(t,e.emitAudioEvent)}))},t.prototype._removeListeners=function(){var e=this;this._audioDom&&(IW.forEach((function(t){var r;null===(r=e._audioDom)||void 0===r||r.removeEventListener(t,e.emitAudioEvent)})),this._audioDom.removeEventListener("canplay",this._internalPlay),this._audioDom.removeEventListener("loadeddata",this._internalPlay))},t.prototype.playAudio=function(e){var t;return r_(this,void 0,void 0,(function(){var r,i,n=this;return i_(this,(function(o){return bW.print("playAudio","play audio track: ".concat(this.userId)),this._track=e,(r=this._audioDom)&&r.srcObject instanceof MediaStream&&r.srcObject.getTrackById(null===(t=e.getTrack())||void 0===t?void 0:t.id)?(r.paused&&this._internalPlay(),[2]):(r||(this._initAudio(),r=this._audioDom),(i=new MediaStream).addTrack(e.getTrack()),r.srcObject=i,null==r||r.addEventListener("canplay",this._internalPlay),null==r||r.addEventListener("loadeddata",this._internalPlay),setTimeout((function(){return n._internalPlay()})),this.played=!0,[2])}))}))},t.prototype._autoPlayError=function(e){var t,r;this._emitPlayFailed||(this._emitPlayFailed=!0,cj.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,isScreen:this.isScreen}))},t.prototype.manuallyPause=function(){if(bW.print("Invoke AudioPlayer.manuallyPause",this.userId,this.isScreen),this.played){if(this._hasManuallyPause=!0,!this._audioDom)throw new oG(Zj.INVALID_PARAMS,"Player not found");return this._audioDom.pause()}},t.prototype.manuallyPlay=function(){var e;if(this._emitPlayFailed=!1,this._hasManuallyPause=!1,!this._audioDom)throw new oG(Zj.INVALID_PARAMS,"Player not found");iU.resume(),this._audioDom.volume=1,this._audioDom.muted=!1,null===(e=this._fakeAudioDom)||void 0===e||e.play();var t=this._audioDom.play();return(null==t?void 0:t.then)?t:Promise.resolve(t)},t.prototype.setPlaybackDevice=function(e){return r_(this,void 0,void 0,(function(){var t;return i_(this,(function(r){switch(r.label){case 0:return bW.print("setPlaybackDevice","setPlaybackDevice: ".concat(e)),[4,Nz.enumerateAudioPlaybackDevices()];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,t=this._containerDom;bW.print("stopAudio","stop audio track: ".concat(this.userId)),this._useWebAudio&&(null===(e=this._sourceNode)||void 0===e||e.disconnect()),this._audioDom&&(this._audioDom.srcObject=null,t&&t.contains(this._audioDom)&&t.removeChild(this._audioDom)),this._fakeAudioDom&&(this._fakeAudioDom.srcObject=null,this._fakeAudioDom=void 0)},Object.defineProperty(t.prototype,"domElement",{get:function(){return this._audioDom},enumerable:!1,configurable:!0}),t.prototype.destroy=function(){bW.print("destroy","audio player: ".concat(this.userId)),this.stop(),e.prototype.removeAllListeners.call(this),this._removeListeners(),delete this._track,this._audioDom&&(this._audioDom.srcObject=null,delete this._audioDom),this._useWebAudio&&delete this._sourceNode,HU&&EW.removeRequestClickPlayer(this)},t}(nB.exports.EventEmitter);function kW(e,t,r,i){var n=this,o=function(e,t){return r_(n,void 0,void 0,(function(){var n;return i_(this,(function(o){switch(o.label){case 0:return n=null==i?void 0:i.get(t),Array.isArray(n)&&(n=null==n?void 0:n.find((function(e){return e.isScreen===r}))),e?e.played?[4,e.manuallyPlay()]:[3,2]:[3,3];case 1:return o.sent(),[3,3];case 2:n&&(e instanceof RW&&n.videoTrack&&e.playVideo(n.videoTrack,n),e instanceof wW&&n.audioTrack&&e.playAudio(n.audioTrack)),o.label=3;case 3:return[2]}}))}))};if(t)return o(e.get(t),t);var a=[];return e.forEach((function(e,t){return a.push(o(e,t))})),Promise.all(a)}var NW=function(){function e(){this.userMessage={},this.roomMessage={},this._setTimer()}return e.prototype._setTimer=function(){var e=this;!function t(){e._reportAndgReset(),clearTimeout(e._timer),e._timer=setTimeout(t,1e4)}()},e.prototype._reportAndgReset=function(){this._report(),this._reset()},e.prototype._report=function(){var e=this;cj.rtcMessageStatistics(Object.keys(this.userMessage).map((function(t){return e.userMessage[t]})),Object.keys(this.roomMessage).map((function(t){return e.roomMessage[t]})),"")},e.prototype._reset=function(){this.userMessage={},this.roomMessage={}},e.prototype._checkInitUserMessage=function(e,t){this.userMessage["".concat(t,"-").concat(e)]||(this.userMessage["".concat(t,"-").concat(e)]={dc_peer_user_id:e,dc_send_total:0,dc_recv_total:0,dc_send_ack:0,dc_send_fail:0,dc_cost_time:0,dc_cost_e2s:0,dc_cost_s2s:0,dc_least_time:1/0,dc_most_time:0,dc_cost_peer_s2e:0,dc_send_ack_100:0,dc_send_ack_200:0,dc_send_ack_400:0,dc_send_ack_1s:0,dc_message_type:t,dc_send_binary:0})},e.prototype._sendUserMessage=function(e,t,r){this._checkInitUserMessage(e,t),this.userMessage["".concat(t,"-").concat(e)].dc_send_total++,r&&this.userMessage["".concat(t,"-").concat(e)].dc_send_binary++},e.prototype._recvUserMessage=function(e,t){this._checkInitUserMessage(e,t),this.userMessage["".concat(t,"-").concat(e)].dc_recv_total++},e.prototype._sendUserFail=function(e,t){var r=this.userMessage["".concat(t,"-").concat(e)];r&&r.dc_send_fail++},e.prototype._sendUserAck=function(e,t,r,i,n){var o=this.userMessage["".concat(t,"-").concat(e)];o&&(o.dc_send_ack++,o.dc_cost_time+=r,o.dc_cost_s2s+=i||0,o.dc_cost_peer_s2e+=n,o.dc_cost_e2s+=r-(i||0)-n,r<=100?(o.dc_send_ack_100++,o.dc_send_ack_200++,o.dc_send_ack_400++,o.dc_send_ack_1s++):r<=200?(o.dc_send_ack_200++,o.dc_send_ack_400++,o.dc_send_ack_1s++):r<=400?(o.dc_send_ack_400++,o.dc_send_ack_1s++):r<=1e3&&o.dc_send_ack_1s++,r<o.dc_least_time&&(o.dc_least_time=r),r>o.dc_most_time&&(o.dc_most_time=r))},e.prototype.sendRoomMessage=function(e,t){this.roomMessage[e]||(this.roomMessage[e]={dc_room_id:e,dc_send_total:0,dc_send_ack:0,dc_cost_time:0,dc_least_time:1/0,dc_most_time:0,dc_send_fail:0,dc_send_ack_100:0,dc_send_ack_200:0,dc_send_ack_400:0,dc_send_ack_1s:0,dc_send_binary:0}),this.roomMessage[e].dc_send_total++,t&&this.roomMessage[e].dc_send_binary++},e.prototype.sendRoomFail=function(e){var t=this.roomMessage[e];t&&t.dc_send_fail++},e.prototype.sendRoomAck=function(e,t){var r=this.roomMessage[e];r&&(r.dc_send_ack++,r.dc_cost_time+=t,t<r.dc_least_time&&(r.dc_least_time=t),t>r.dc_most_time&&(r.dc_most_time=t),t<=100?(r.dc_send_ack_100++,r.dc_send_ack_200++,r.dc_send_ack_400++,r.dc_send_ack_1s++):t<=200?(r.dc_send_ack_200++,r.dc_send_ack_400++,r.dc_send_ack_1s++):t<=400?(r.dc_send_ack_400++,r.dc_send_ack_1s++):t<=1e3&&r.dc_send_ack_1s++)},e.prototype.sendP2PMessage=function(e,t){this._sendUserMessage(e,zB.P2P,t)},e.prototype.recvP2PMessage=function(e){this._recvUserMessage(e,zB.P2P)},e.prototype.sendP2PFail=function(e){this._sendUserFail(e,zB.P2P)},e.prototype.sendP2PAck=function(e,t,r,i){this._sendUserAck(e,zB.P2P,t,r,i)},e.prototype.sendP2POutRoomMessage=function(e,t){this._sendUserMessage(e,zB.P2P_OUTSIDE_ROOM,t)},e.prototype.recvP2POutRoomMessage=function(e){this._recvUserMessage(e,zB.P2P_OUTSIDE_ROOM)},e.prototype.sendP2POutRoomFail=function(e){this._sendUserFail(e,zB.P2P_OUTSIDE_ROOM)},e.prototype.sendP2POutRoomAck=function(e,t,r,i){this._sendUserAck(e,zB.P2P_OUTSIDE_ROOM,t,r,i)},e.prototype.sendP2serverMessage=function(e){this._sendUserMessage("",zB.P2SERVER,e)},e.prototype.sendP2serverFail=function(){this._sendUserFail("",zB.P2SERVER)},e.prototype.sendP2serveAck=function(e){this._sendUserAck("",zB.P2SERVER,e,0,0)},e.prototype.countP2PMessage=function(e,t,r,i,n){this.sendP2PMessage(t,r),e?this.sendP2PAck(t,Date.now()-i,n.s2s_time,n.s2e_time):this.sendP2PFail(t)},e.prototype.countRoomMessage=function(e,t,r,i){this.sendRoomMessage(t,r),e?this.sendRoomAck(t,Date.now()-i):this.sendRoomFail(t)},e.prototype.countUserMessageOutsideRoom=function(e,t,r,i,n){this.sendP2POutRoomMessage(t,r),e?this.sendP2POutRoomAck(t,Date.now()-i,n.s2s_time,n.s2e_time):this.sendP2POutRoomFail(t)},e.prototype.countServerMessage=function(e,t,r){this.sendP2serverMessage(t),e?this.sendP2serveAck(Date.now()-r):this.sendP2serverFail()},e.prototype.destroy=function(){this._reset(),clearTimeout(this._timer)},e}(),PW="object"==("undefined"==typeof global?"undefined":t(global))&&global&&global.Object===Object&&global,DW="object"==("undefined"==typeof self?"undefined":t(self))&&self&&self.Object===Object&&self,MW=PW||DW||Function("return this")(),LW=MW.Symbol,UW=Object.prototype,xW=UW.hasOwnProperty,VW=UW.toString,FW=LW?LW.toStringTag:void 0;var BW=Object.prototype.toString;var jW=LW?LW.toStringTag:void 0;function GW(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":jW&&jW in Object(e)?function(e){var t=xW.call(e,FW),r=e[FW];try{e[FW]=void 0;var i=!0}catch(e){}var n=VW.call(e);return i&&(t?e[FW]=r:delete e[FW]),n}(e):function(e){return BW.call(e)}(e)}function HW(e){return null!=e&&"object"==t(e)}var zW=Array.isArray;function KW(e){var r=t(e);return null!=e&&("object"==r||"function"==r)}function WW(e){return e}function XW(e){if(!KW(e))return!1;var t=GW(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t}var qW=MW["__core-js_shared__"],YW=function(){var e=/[^.]+$/.exec(qW&&qW.keys&&qW.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}();var JW=Function.prototype.toString;var QW=/^\[object .+?Constructor\]$/,ZW=Function.prototype,$W=Object.prototype,eX=ZW.toString,tX=$W.hasOwnProperty,rX=RegExp("^"+eX.call(tX).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function iX(e){return!(!KW(e)||(t=e,YW&&YW in t))&&(XW(e)?rX:QW).test(function(e){if(null!=e){try{return JW.call(e)}catch(e){}try{return e+""}catch(e){}}return""}(e));var t}function nX(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 oX=Date.now;var aX,sX,cX,uX=function(){try{var e=function(e,t){var r=function(e,t){return null==e?void 0:e[t]}(e,t);return iX(r)?r:void 0}(Object,"defineProperty");return e({},"",{}),e}catch(e){}}(),dX=uX,lX=dX?function(e,t){return dX(e,"toString",{configurable:!0,enumerable:!1,value:(r=t,function(){return r}),writable:!0});var r}:WW,hX=(aX=lX,sX=0,cX=0,function(){var e=oX(),t=16-(e-cX);if(cX=e,t>0){if(++sX>=800)return arguments[0]}else sX=0;return aX.apply(void 0,arguments)}),pX=hX,fX=/^(?:0|[1-9]\d*)$/;function _X(e,r){var i=t(e);return!!(r=null==r?9007199254740991:r)&&("number"==i||"symbol"!=i&&fX.test(e))&&e>-1&&e%1==0&&e<r}function vX(e,t,r){"__proto__"==t&&dX?dX(e,t,{configurable:!0,enumerable:!0,value:r,writable:!0}):e[t]=r}function mX(e,t){return e===t||e!=e&&t!=t}var yX=Object.prototype.hasOwnProperty;function gX(e,t,r){var i=e[t];yX.call(e,t)&&mX(i,r)&&(void 0!==r||t in e)||vX(e,t,r)}var SX=Math.max;function EX(e,t){return pX(function(e,t,r){return t=SX(void 0===t?e.length-1:t,0),function(){for(var i=arguments,n=-1,o=SX(i.length-t,0),a=Array(o);++n<o;)a[n]=i[t+n];n=-1;for(var s=Array(t+1);++n<t;)s[n]=i[n];return s[t]=r(a),nX(e,this,s)}}(e,t,WW),e+"")}function bX(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=9007199254740991}function IX(e){return null!=e&&bX(e.length)&&!XW(e)}var TX=Object.prototype;function AX(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||TX)}function RX(e){return HW(e)&&"[object Arguments]"==GW(e)}var CX=Object.prototype,OX=CX.hasOwnProperty,wX=CX.propertyIsEnumerable,kX=RX(function(){return arguments}())?RX:function(e){return HW(e)&&OX.call(e,"callee")&&!wX.call(e,"callee")},NX=kX;var PX="object"==("undefined"==typeof exports?"undefined":t(exports))&&exports&&!exports.nodeType&&exports,DX=PX&&"object"==("undefined"==typeof module?"undefined":t(module))&&module&&!module.nodeType&&module,MX=DX&&DX.exports===PX?MW.Buffer:void 0,LX=(MX?MX.isBuffer:void 0)||function(){return!1},UX={};UX["[object Float32Array]"]=UX["[object Float64Array]"]=UX["[object Int8Array]"]=UX["[object Int16Array]"]=UX["[object Int32Array]"]=UX["[object Uint8Array]"]=UX["[object Uint8ClampedArray]"]=UX["[object Uint16Array]"]=UX["[object Uint32Array]"]=!0,UX["[object Arguments]"]=UX["[object Array]"]=UX["[object ArrayBuffer]"]=UX["[object Boolean]"]=UX["[object DataView]"]=UX["[object Date]"]=UX["[object Error]"]=UX["[object Function]"]=UX["[object Map]"]=UX["[object Number]"]=UX["[object Object]"]=UX["[object RegExp]"]=UX["[object Set]"]=UX["[object String]"]=UX["[object WeakMap]"]=!1;var xX="object"==("undefined"==typeof exports?"undefined":t(exports))&&exports&&!exports.nodeType&&exports,VX=xX&&"object"==("undefined"==typeof module?"undefined":t(module))&&module&&!module.nodeType&&module,FX=VX&&VX.exports===xX&&PW.process,BX=function(){try{var e=VX&&VX.require&&VX.require("util").types;return e||FX&&FX.binding&&FX.binding("util")}catch(e){}}(),jX=BX&&BX.isTypedArray,GX=jX?function(e){return function(t){return e(t)}}(jX):function(e){return HW(e)&&bX(e.length)&&!!UX[GW(e)]},HX=GX,zX=Object.prototype.hasOwnProperty;function KX(e,t){var r=zW(e),i=!r&&NX(e),n=!r&&!i&&LX(e),o=!r&&!i&&!n&&HX(e),a=r||i||n||o,s=a?function(e,t){for(var r=-1,i=Array(e);++r<e;)i[r]=t(r);return i}(e.length,String):[],c=s.length;for(var u in e)!t&&!zX.call(e,u)||a&&("length"==u||n&&("offset"==u||"parent"==u)||o&&("buffer"==u||"byteLength"==u||"byteOffset"==u)||_X(u,c))||s.push(u);return s}var WX=function(e,t){return function(r){return e(t(r))}}(Object.keys,Object),XX=WX,qX=Object.prototype.hasOwnProperty;function YX(e){return IX(e)?KX(e):function(e){if(!AX(e))return XX(e);var t=[];for(var r in Object(e))qX.call(e,r)&&"constructor"!=r&&t.push(r);return t}(e)}var JX=Object.prototype.hasOwnProperty;function QX(e){if(!KW(e))return function(e){var t=[];if(null!=e)for(var r in Object(e))t.push(r);return t}(e);var t=AX(e),r=[];for(var i in e)("constructor"!=i||!t&&JX.call(e,i))&&r.push(i);return r}var ZX,$X=(ZX=function(e,t){!function(e,t,r,i){var n=!r;r||(r={});for(var o=-1,a=t.length;++o<a;){var s=t[o],c=i?i(r[s],e[s],s,r,e):void 0;void 0===c&&(c=e[s]),n?vX(r,s,c):gX(r,s,c)}}(t,function(e){return IX(e)?KX(e,!0):QX(e)}(t),e)},EX((function(e,r){var i=-1,n=r.length,o=n>1?r[n-1]:void 0,a=n>2?r[2]:void 0;for(o=ZX.length>3&&"function"==typeof o?(n--,o):void 0,a&&function(e,r,i){if(!KW(i))return!1;var n=t(r);return!!("number"==n?IX(i)&&_X(r,i.length):"string"==n&&r in i)&&mX(i[r],e)}(r[0],r[1],a)&&(o=n<3?void 0:o,n=1),e=Object(e);++i<n;){var s=r[i];s&&ZX(e,s,i,o)}return e}))),eq=$X;function tq(e,t){return function(e,t){for(var r=-1,i=null==e?0:e.length,n=Array(i);++r<i;)n[r]=t(e[r],r,e);return n}(t,(function(t){return e[t]}))}function rq(e){return null==e?[]:tq(e,YX(e))}var iq,nq=function(e,t){return r_(void 0,void 0,void 0,(function(){var r;return i_(this,(function(i){switch(i.label){case 0:r=new Audio(URL.createObjectURL(new Blob([e],t))),i.label=1;case 1:return i.trys.push([1,3,,4]),r.muted=!0,[4,r.play()];case 2:return i.sent(),r.pause(),[2,!0];case 3:return i.sent(),[2,!1];case 4:return[2]}}))}))},oq=function(){function e(e){this._sharedAudioContext=new AudioContext,this._audioDestination=this._sharedAudioContext.createMediaStreamDestination(),this._localGainNode=this._sharedAudioContext.createGain(),this._bufferGainNode=this._sharedAudioContext.createGain(),this._failedAudioList=[],this.mixingMap=new Map,this.resourcesCache=new Map,this.volumeConfig=new Map,this.cachedBuffer=[],this.id="AudioMixingManager",this._context=e,this._localGainNode.gain.value=1}return e.prototype.mixMediaStream=function(e){this._localSource&&this._localSource.disconnect(this._localGainNode),this._localSource=this._sharedAudioContext.createMediaStreamSource(e),this._localSource.connect(this._localGainNode).connect(this._audioDestination)},e.prototype.startAudioMixing=function(e,t,r){return r_(this,void 0,void 0,(function(){var i,n,o,a,s,c,u,d,l,h,p,f,_,v,m=this;return i_(this,(function(y){switch(y.label){case 0:if(i=r.playCount,uG(n=r.type,"mixingType",rq(u_)),!(o=this._context.getLocalAudioTrack()))return[2];if((a=Mz(o.getTrack()))&&this.mixMediaStream(a),(s=this.mixingMap.get(e))&&s.audioNode){s.audioNode.pause(),this._context.emitMessage({mixId:e,state:d_.AUDIO_MIXING_STATE_STOPPED,error:$j.AUDIO_MIXING_ERROR_OK});try{s.gainNode.disconnect(this._audioDestination),s.audioSource.disconnect(s.gainNode)}catch(e){}}return(u=this.resourcesCache.get(e))&&u.filePath===t?(c=u.getAudioNode(),[3,4]):[3,1];case 1:return[4,fetch(t,{mode:"cors",credentials:"include"}).then((function(t){if(t.ok)return t.arrayBuffer();throw m._context.emitMessage({mixId:e,state:d_.AUDIO_MIXING_STATE_FAILED,error:$j.AUDIO_MIXING_ERROR_START_FAILED}),new oG(Zj.LOAD_RESOURCES_FAILED,t.statusText)}))];case 2:return d=y.sent(),l=void 0,t.endsWith("mp3")?l={type:"audio/mpeg"}:t.endsWith("aac")&&(l={type:"audio/aac"}),[4,nq(d,l)];case 3:if(!y.sent())throw this._context.emitMessage({mixId:e,state:d_.AUDIO_MIXING_STATE_FAILED,error:$j.AUDIO_MIXING_ERROR_START_FAILED}),new oG(Zj.LOAD_RESOURCES_FAILED,"invalid audio resource");(c=new Audio).crossOrigin="anonymous",c.src=URL.createObjectURL(new Blob([d],l)),y.label=4;case 4:i<=0?c.loop=!0:i>0&&(h=i,c.onended=function(){--h>0?c.play():(m.mixingMap.delete(e),m._context.emitMessage({mixId:e,state:d_.AUDIO_MIXING_STATE_FINISHED,error:$j.AUDIO_MIXING_ERROR_OK}))}),y.label=5;case 5:return y.trys.push([5,7,,8]),[4,c.play()];case 6:return y.sent(),[3,8];case 7:return p=y.sent(),console.error(p),this._failedAudioList.push(c),this._context.onAutoPlayFailed({userId:this.id,kind:"audio",streamIndex:Vf.STREAM_INDEX_MAIN,mediaType:Ff.AUDIO}),[3,8];case 8:if(f=this._sharedAudioContext.createMediaElementSource(c),_=this._sharedAudioContext.createGain(),v=this.volumeConfig.get(e),_.gain.value=v?v/100:1,f.connect(_).connect(this._audioDestination),this.mixingMap.set(e,{audioSource:f,audioNode:c,gainNode:_,type:"file"}),n===u_.PUBLISH)try{_.disconnect(this._sharedAudioContext.destination)}catch(e){}else _.connect(this._sharedAudioContext.destination);return this._context.updateLocalAudioTrack(this._audioDestination.stream.getAudioTracks()[0],r.type),this._context.emitMessage({mixId:e,state:d_.AUDIO_MIXING_STATE_PLAYING,error:$j.AUDIO_MIXING_ERROR_OK}),[2]}}))}))},e.prototype.stopAudioMixing=function(e){var t=this.mixingMap.get(e);t&&"file"===t.type&&(this.mixingMap.delete(e),t.audioNode.pause(),t.audioSource.disconnect(t.gainNode),t.gainNode.disconnect(this._audioDestination),this._context.emitMessage({mixId:e,state:d_.AUDIO_MIXING_STATE_STOPPED,error:$j.AUDIO_MIXING_ERROR_OK}))},e.prototype.pauseAudioMixing=function(e){var t=this.mixingMap.get(e);t&&(this._context.emitMessage({mixId:e,state:d_.AUDIO_MIXING_STATE_PAUSED,error:$j.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:d_.AUDIO_MIXING_STATE_PLAYING,error:$j.AUDIO_MIXING_ERROR_OK}),t.audioNode.play())},e.prototype.preloadAudioMixing=function(e,t){return r_(this,void 0,void 0,(function(){var r,i=this;return i_(this,(function(n){switch(n.label){case 0:return this.stopAudioMixing(e),[4,fetch(t,{mode:"cors",credentials:"include"}).then((function(t){if(t.ok)return t.arrayBuffer();throw i._context.emitMessage({mixId:e,state:d_.AUDIO_MIXING_STATE_FAILED,error:$j.AUDIO_MIXING_ERROR_PRELOAD_FAILED}),new oG(Zj.LOAD_RESOURCES_FAILED,t.statusText)})).catch((function(t){throw i._context.emitMessage({mixId:e,state:d_.AUDIO_MIXING_STATE_FAILED,error:$j.AUDIO_MIXING_ERROR_PRELOAD_FAILED}),new oG(Zj.LOAD_RESOURCES_FAILED,"Load resources failed",t)}))];case 1:return r=n.sent(),[4,nq(r)];case 2:if(!n.sent())throw this._context.emitMessage({mixId:e,state:d_.AUDIO_MIXING_STATE_FAILED,error:$j.AUDIO_MIXING_ERROR_PRELOAD_FAILED}),new oG(Zj.LOAD_RESOURCES_FAILED,"Load resources failed");return this._context.emitMessage({mixId:e,state:d_.AUDIO_MIXING_STATE_PRELOADED,error:$j.AUDIO_MIXING_ERROR_OK}),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){uG(e,"type",rq(u_));var t=this._context.getLocalAudioTrack();if(t){var r=Mz(t.getTrack());if(r&&this.mixMediaStream(r),e===u_.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:d_.AUDIO_MIXING_STATE_PCM_ENABLED,error:$j.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:d_.AUDIO_MIXING_STATE_PCM_DISABLED,error:$j.AUDIO_MIXING_ERROR_OK})}},e.prototype.pushAudioMixingBuffer=function(e){var t=this;if(!(this._audioBufferSource&&(this.cachedBuffer.push(e),this.cachedBuffer.length>0))){this._audioBufferSource=this._sharedAudioContext.createBufferSource(),this._audioBufferSource.buffer=e,this._audioBufferSource.connect(this._bufferGainNode);try{this._audioBufferSource.start()}catch(e){this._failedAudioList.push(this._audioBufferSource)}this._audioBufferSource.onended=function(){var e;if(null===(e=t._audioBufferSource)||void 0===e||e.disconnect(t._bufferGainNode),t._audioBufferSource=void 0,t.cachedBuffer.length){var 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.resumeLocalPlay=function(){return r_(this,void 0,void 0,(function(){var e,t,r,i,n,o,a,s;return i_(this,(function(c){switch(c.label){case 0:e=[],c.label=1;case 1:c.trys.push([1,10,11,12]),t=n_(this._failedAudioList),r=t.next(),c.label=2;case 2:if(r.done)return[3,9];i=r.value,c.label=3;case 3:return c.trys.push([3,7,,8]),i instanceof HTMLAudioElement?(i.muted=!1,[4,i.play()]):[3,5];case 4:return c.sent(),[3,6];case 5:i.start(),c.label=6;case 6:return[3,8];case 7:return n=c.sent(),e.push(i),console.error(n),this._context.onAutoPlayFailed({userId:this.id,kind:"audio",streamIndex:Vf.STREAM_INDEX_MAIN,mediaType:Ff.AUDIO}),[3,9];case 8:return r=t.next(),[3,2];case 9:return[3,12];case 10:return o=c.sent(),a={error:o},[3,12];case 11:try{r&&!r.done&&(s=t.return)&&s.call(t)}finally{if(a)throw a.error}return[7];case 12:return this._failedAudioList=e,[2]}}))}))},e.prototype.destroy=function(){var e=this._sharedAudioContext;"closed"!==e.state&&"function"==typeof e.close&&e.close(),this.cachedBuffer=[],this.mixingMap.clear(),this.resourcesCache.clear(),this.volumeConfig.clear()},t_([_j("default","id","filePath","options")],e.prototype,"startAudioMixing",null),t_([_j("default","id")],e.prototype,"stopAudioMixing",null),t_([_j("default","id")],e.prototype,"pauseAudioMixing",null),t_([_j("default","id")],e.prototype,"resumeAudioMixing",null),t_([_j("default","id")],e.prototype,"preloadAudioMixing",null),t_([_j("default","id")],e.prototype,"unloadAudioMixing",null),t_([_j("default","id")],e.prototype,"getAudioMixingVolume",null),t_([_j("default","id","volume")],e.prototype,"setAudioMixingVolume",null),t_([_j("default","id")],e.prototype,"getAudioMixingDuration",null),t_([_j("default","id")],e.prototype,"getAudioMixingCurrentPosition",null),t_([_j("default","id","position")],e.prototype,"setAudioMixingPosition",null),t_([_j("default","type")],e.prototype,"enableAudioMixingBuffer",null),t_([_j()],e.prototype,"disableAudioMixingBuffer",null),t_([_j("default","buffer")],e.prototype,"pushAudioMixingBuffer",null),e}();!function(e){e.NORMAL_USER="normalUser",e.SILENT_USER="silentUser"}(iq||(iq={}));var aq=new rj("RTMClient",1),sq=function(e){function t(t){var r=e.call(this)||this;return r._appId=t,r._dataChannelSignal=null,r._handler=null,r._dataChannelSignalState=WK.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 Of(t,e),t.prototype.login=function(e,t){var r=this;return new Promise((function(i,n){if(aq.print("login","invoke login, token: %o, userId: %o",e,t),r._loginSessionId)throw new oG(Zj.ALREADY_LOGIN,"Already logined");if(r._loginResolveCallback)throw new oG(Zj.LOGIN_FAILED,"Is logging in, please try again later.");r._userId=t,r._token=e,hj.setStats({rtc_app_id:r._appId,user_id:t}),r._loginResolveCallback=i,r._loginRejectCallback=n,r._dataChannelSignal?r._login():(aq.print("login","init dataChannelSingling"),r._dataChannelSignalState=WK.CONNECTING,r._createDataChannelSignaling(t).then((function(e){r._dataChannelSignal=e,r._login()})).catch((function(){r._onDisconnect()})))}))},t.prototype.logout=function(){var e;return r_(this,void 0,void 0,(function(){return i_(this,(function(t){switch(t.label){case 0:if(!this._loginSessionId||!this._userId)throw new oG(Zj.NOT_LOGIN,"login first");return[4,null===(e=this._dataChannelSignal)||void 0===e?void 0:e.sendSignaling("logout",{loginSessionId:this._loginSessionId,userId:this._userId,appId:this._appId},{functionType:qG.C2RTM}).catch((function(){}))];case 1:return t.sent(),this._closeDataChannelSignaling(),this._clearState(),[2]}}))}))},t.prototype.updateLoginToken=function(e){return r_(this,void 0,void 0,(function(){var t=this;return i_(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 r_(this,void 0,void 0,(function(){var t;return i_(this,(function(r){switch(r.label){case 0:if(!this._loginSessionId||!this._userId)throw new oG(Zj.NOT_LOGIN,"login first");return this._checkDataChannelSignal(),[4,this._dataChannelSignal.sendSignaling("getPeerOnlineStatus",{loginSessionId:this._loginSessionId,userId:this._userId,appId:this._appId,peerUserId:e},{functionType:qG.C2RTM})];case 1:return[2,null==(t=r.sent())?void 0:t.status]}}))}))},t.prototype.sendUserMessageOutsideRoom=function(e,t){return r_(this,void 0,void 0,(function(){return i_(this,(function(r){if(!this._loginSessionId||!this._userId)throw new oG(Zj.NOT_LOGIN,"login first");return this._checkDataChannelSignal(),[2,this._dataChannelSignal.sendP2PMessage({from:this._userId,app:this._appId,to:e,room:"",msg:t})]}))}))},t.prototype.setServerParams=function(e,t){return r_(this,void 0,void 0,(function(){return i_(this,(function(r){switch(r.label){case 0:if(!this._loginSessionId||!this._userId)throw new oG(Zj.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:qG.C2RTM})];case 1:return r.sent(),[2]}}))}))},t.prototype.sendServerMessage=function(e){return r_(this,void 0,void 0,(function(){return i_(this,(function(t){if(!this._loginSessionId||!this._userId)throw new oG(Zj.NOT_LOGIN,"login first");return this._checkDataChannelSignal(),[2,this._dataChannelSignal.sendP2PMessage({from:this._userId,app:this._appId,to:"",room:"",type:zG.BUSINESS_SERVER,msg:e})]}))}))},t.prototype.destroy=function(){this._clearState(),this._closeDataChannelSignaling(),e.prototype.removeAllListeners.call(this)},t.prototype._login=function(){var e=this;if(this._userId){var t=kU();this._checkDataChannelSignal(),this._dataChannelSignal.sendSignaling("login",{Token:MU.token2auth(this._appId,null,this._userId,this._token),timestamp:Date.now(),loginSessionId:t,params:{deviceType:"web",userAgent:window.navigator.userAgent,sdkVersion:YF.VERSION,deviceId:zF.getDeviceId(),appId:this._appId,userId:this._userId},accessParams:JSON.stringify({requireICEUfragV2:!0})},{functionType:qG.C2RTM}).then((function(){e._loginResolveCallback&&e._loginResolveCallback(),e._loginSessionId=t,e._wait_login_token=!1})).catch((function(t){var r,i,n=t||{},o=n.code,a=n.message;e._wait_login_token=!1,o>=700&&o<800?708===o?(r=Zj.INVALID_PARAMS,i="Invalid userId"):(r=Zj.INVALID_TOKEN,i="Invalid token",e._wait_login_token=!0,e._loginRejectCallback||e.emit("onRTMTokenError")):(r=Zj.LOGIN_FAILED,i="login failed"),e._loginRejectCallback&&e._loginRejectCallback(new oG(r,a||i))})).finally((function(){e._loginResolveCallback=null,e._loginRejectCallback=null}))}},t.prototype._createDataChannelSignaling=function(e){var t,r;return r_(this,void 0,void 0,(function(){var i,n,o,a,s,c,u=this;return i_(this,(function(d){switch(d.label){case 0:if(i=new eH,n=this._iceConfigNode)return[3,4];d.label=1;case 1:return d.trys.push([1,3,,4]),[4,null==i?void 0:i.getAccessNode(this._appId,"",e,zF.getDeviceId(),"")];case 2:if(o=d.sent(),!(n=o[0]))throw new Error;return[3,4];case 3:throw d.sent(),mj("rtm.login.getNodeFailed","",0,!0),new oG(Zj.ICE_SERVER_WRONG,"get ICE config failed");case 4:mj("rtm.login.getNodeSuccess",n,0,!0),aq.print("_createDataChannelSignaling()","get node success",n),this._handler=GK(uj),null===(t=this._handler)||void 0===t||t.once("disconnect",(function(){aq.print("_createDataChannelSignaling()","recv BasicHandler event: disconnect"),u._onDisconnect()})),d.label=5;case 5:return d.trys.push([5,7,,8]),[4,null===(r=this._handler)||void 0===r?void 0:r.connect(n)];case 6:return a=d.sent(),aq.print("_createDataChannelSignaling()","establish peerConnection success"),this._dataChannelSignalState=WK.CONNECTED,[3,8];case 7:throw s=d.sent(),this._iceConfigNode=null,this._dataChannelSignalState=WK.DISCONNECTED,new oG(Zj.ESTABLISH_DATACHANNEL_FAILED,"establish dataChannel failed",s);case 8:return c=new QG(a),aq.print("_createDataChannelSignaling()","send ping"),c.sendPingSignaling(),c.once("close",(function(){aq.print("_createDataChannelSignaling()","recv DataChannelSignaling event: close"),u._onDisconnect()})),c.on(xG.USER_MESSAGE_RECEIVED_OUTSIDE_ROOM,(function(e){u.emit("onUserMessageReceivedOutsideRoom",{userId:e.from,message:e.msg})})),c.on(xG.USER_BINARY_MESSAGE_RECEIVED_OUTSIDE_ROOM,(function(e){u.emit("onUserBinaryMessageReceivedOutsideRoom",{userId:e.from,message:e.msg})})),c.on(xG.USER_DISCONNECTION,(function(){u.emit("onUserDisconnection"),u._clearState()})),c.on(xG.NODE_CHANGE,(function(e){mj("rtm.nodeChange",JSON.stringify(e),0,!0),Array.isArray(e.nodes)&&e.nodes.length&&(u._iceConfigNode=e.nodes[0]),u._loginResolveCallback&&u._loginRejectCallback?u._login():u._reconnect()})),[2,c]}}))}))},t.prototype._closeDataChannelSignaling=function(){var e,t;null===(e=this._dataChannelSignal)||void 0===e||e.destroy(),this._dataChannelSignal=null,null===(t=this._handler)||void 0===t||t.destroy(),this._handler=null},t.prototype._checkDataChannelSignal=function(){if(!this._dataChannelSignal||this._dataChannelSignalState!==WK.CONNECTED)throw new oG(Zj.NOT_CONNECTED_YET,"datachannel not connect")},t.prototype._onDisconnect=function(){this._dataChannelSignalState=WK.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&&(aq.print("_reconnect()","start reconnect..."),this._isReconnecting=!0,this._createDataChannelSignaling(this._userId).then((function(t){aq.print("_reconnect()","reconnect success!"),e._dataChannelSignal=t,e._login(),e._reconnectTimer=null})).catch((function(t){aq.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}(nB.exports.EventEmitter),cq=function(e){function t(t,r){var i=e.call(this)||this;return i._appId=t,i.remoteStreams=new Map,i.remoteStreamsStats=new Map,i._context=r,i}return Of(t,e),t.prototype.connect=function(){return r_(this,void 0,void 0,(function(){return i_(this,(function(e){switch(e.label){case 0:return this._mediaServerClient=new ZK(this._context),this._bindEvents(),[4,this._mediaServerClient.connect(this._appId)];case 1:return e.sent(),[2]}}))}))},t.prototype.startPlayPublicStream=function(e){return r_(this,void 0,void 0,(function(){var t,r=this;return i_(this,(function(i){switch(i.label){case 0:if(this.remoteStreams.get(e))throw new oG(Zj.REPEAT_PLAY,"repeat play public media stream");return(t=new CK(e,e,!1,!0,{audiostream:!0,localaudio:!0,videostream:!0,localvideo:!0,extaudio:!1,extvideo:!1,videoDescriptions:[]})).on("onSEIMessage",(function(e){if(e instanceof Uint8Array)for(var i=function(e){var t=new DataView(e.buffer);if(t.byteLength<=4||65535!==t.getUint16(0))return{seiCount:1,seis:[e]};for(var r={seiCount:0,seis:[]},i=!1,n=2;n<t.byteLength;){var o=t.getUint16(n);if(n+=2,t.byteLength-n<o){i=!0;break}var a=new Uint8Array(e.buffer,n,o);if(n+=o,t.byteLength-n>0&&t.byteLength-n<=2){i=!0;break}r.seiCount++,r.seis.push(a)}return i&&(r.seiCount=1,r.seis=[e]),r}(e),n=0;n<i.seiCount;n++)r.emit(lK.ON_SEI_MESSAGED_RECEIVED,{sei:i.seis[n],publicStreamId:t.streamId})})),[4,this._mediaServerClient.subscribePublicStream(t)];case 1:return i.sent(),this.remoteStreams.set(e,t),this.remoteStreamsStats.set(e,{decodeFailedCount:0}),[2,t]}}))}))},t.prototype.stopPlayPublicStream=function(e){var t=this.remoteStreams.get(e);if(t)return this.remoteStreams.delete(e),this._mediaServerClient.unsubscribePublicStream(t)},t.prototype.destroy=function(){this.remoteStreams=new Map,this._mediaServerClient&&this._mediaServerClient.destroy()},t.prototype._handleReconnected=function(){return r_(this,void 0,void 0,(function(){var e,t,r,i,n,o,a,s,c=this;return i_(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(lK.RESUBSCRIBE,{stream:t})}))},t=this;try{for(r=n_(this.remoteStreams),i=r.next();!i.done;i=r.next())n=o_(i.value,1),o=n[0],e(o)}catch(e){a={error:e}}finally{try{i&&!i.done&&(s=r.return)&&s.call(r)}finally{if(a)throw a.error}}return[2]}))}))},t.prototype._reconnect=function(){var e=this;this._mediaServerClient.removeAllListeners(),this._mediaServerClient.destroy(),navigator.onLine?this.connect().then(this._handleReconnected.bind(this)):this._reconnectTimer=setTimeout((function(){return e.connect().then(e._handleReconnected.bind(e))}),3e3)},t.prototype._bindEvents=function(){var e,t,r=this;null===(e=this._mediaServerClient)||void 0===e||e.on(FG.ABNORMAL_DISCONNECTION,this._reconnect.bind(this)),null===(t=this._mediaServerClient)||void 0===t||t.on("onRemoteStreamStats",(function(e){if(r.emit("onRemoteStreamStats",e),e.videoStats&&e.receivedKBitrate&&e.receivedFrameRate&&!e.decoderOutputFrameRate){var t=r.remoteStreamsStats.get(e.publicStreamId);t&&(t.decodeFailedCount+=1,3===t.decodeFailedCount&&r.emit("streamDecodeFailed",{publicStreamId:e.publicStreamId}))}}))},t}(oj),uq=new rj("AudioDeviceManager",1),dq=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t._isAudioPlaybackDeviceTesting=!1,t._isAudioDeviceRecordTesting=!1,t}return Of(t,e),t.prototype.startAudioPlaybackDeviceTest=function(e,t){return r_(this,void 0,void 0,(function(){var r;return i_(this,(function(i){switch(i.label){case 0:if(this._isAudioPlaybackDeviceTesting||this._isAudioDeviceRecordTesting)throw new oG(Zj.REPEAT_DEVICE_TEST,"device test cannot be called repeatedly at the same time.");this._isAudioPlaybackDeviceTesting=!0,uq.print("startAudioPlaybackDeviceTest()","Invoke"),i.label=1;case 1:return i.trys.push([1,3,,4]),[4,this._playAudioFile(e,{loop:!0})];case 2:return i.sent(),[3,4];case 3:throw r=i.sent(),this.stopAudioPlaybackDeviceTest(),r;case 4:return this._startEmitAudioPlaybackDeviceTestVolume(t),[2]}}))}))},t.prototype.stopAudioPlaybackDeviceTest=function(){this._isAudioPlaybackDeviceTesting&&(uq.print("stopAudioPlaybackDeviceTest()","Invoke"),this._isAudioPlaybackDeviceTesting=!1,this._stopEmitAudioPlaybackDeviceTestVolume(),this._destroyAudioElement())},t.prototype.startAudioDeviceRecordTest=function(e){return r_(this,void 0,void 0,(function(){var t=this;return i_(this,(function(r){switch(r.label){case 0:if(!window.MediaRecorder)throw new oG(Zj.NOT_SUPPORTED,"Your browser does not support MediaRecorder.");if(this._isAudioDeviceRecordTesting)throw new oG(Zj.REPEAT_DEVICE_TEST,"device test cannot be called repeatedly at the same time.");return this._isAudioDeviceRecordTesting=!0,uq.print("startAudioDeviceRecordTest()","Invoke"),this._recoderTimer=window.setTimeout((function(){uq.print("startAudioDeviceRecordTest()","".concat(3e4,'ms automatic call method "stopAudioDeviceRecordAndPlayTest"')),t._stopAudioCaptureAndRecoder()}),3e4),[4,this._startAudioCaptureAndRecoder(e)];case 1:return r.sent(),delete this._audioCaptureAndRecoderResolve,[2]}}))}))},t.prototype.stopAudioDeviceRecordAndPlayTest=function(){uq.print("stopAudioDeviceRecordAndPlayTest()","Invoke"),void 0!==this._recoderTimer&&(clearTimeout(this._recoderTimer),delete this._recoderTimer),this._stopAudioCaptureAndRecoder()},t.prototype.stopAudioDevicePlayTest=function(){this._isAudioDeviceRecordTesting&&(uq.print("stopAudioDevicePlayTest()","Invoke"),this._isAudioDeviceRecordTesting=!1,this.stopAudioDeviceRecordAndPlayTest(),this._stopEmitAudioPlaybackDeviceTestVolume(),this._destroyAudioElement())},t.prototype.getRecordTrack=function(){return this._audioTrack},t.prototype.destroy=function(){uq.print("destroy()","Invoke"),e.prototype.removeAllListeners.call(this),this.stopAudioPlaybackDeviceTest(),this.stopAudioDevicePlayTest()},t.prototype._playAudioFile=function(e,t){var r=this;return new Promise((function(i,n){r._audioElement=gW("audio",{attributes:{src:e,crossOrigin:"",autoplay:"true"}}),r._audioElement.loop=t.loop,uq.print("_playAudioFile()","url=".concat(e,";loop=").concat(t.loop)),r._audioElement.oncanplay=function(){uq.print("_playAudioFile()","oncanplay"),i()},r._audioElement.onerror=function(e){var t,i;n(new oG(Zj.LOAD_RESOURCES_FAILED,"audio error: ".concat(e.message||(null===(i=null===(t=r._audioElement)||void 0===t?void 0:t.error)||void 0===i?void 0:i.message))))}}))},t.prototype._destroyAudioElement=function(){this._audioElement&&(uq.print("_destroyAudioElement()","Invoke"),this._audioElement.src="",delete this._audioElement,this._audioCaptureAndRecoderResolve&&this._audioCaptureAndRecoderResolve())},t.prototype._startEmitAudioPlaybackDeviceTestVolume=function(e){var t=this;e=Math.max(e,100),this._audioElement&&(uq.print("_startEmitAudioPlaybackDeviceTestVolume()","start timer(".concat(e,"ms)")),this._audioLevelFetcher=new rU(this._audioElement),this._playbackDeviceTestTimer=self.setInterval((function(){t._audioLevelFetcher&&t.emit("onAudioPlaybackDeviceTestVolume",t._audioLevelFetcher.getAudioLevel())}),e))},t.prototype._stopEmitAudioPlaybackDeviceTestVolume=function(){var e;void 0!==this._playbackDeviceTestTimer&&(uq.print("_stopEmitAudioPlaybackDeviceTestVolume()","stop timer"),self.clearInterval(this._playbackDeviceTestTimer),delete this._playbackDeviceTestTimer),null===(e=this._audioLevelFetcher)||void 0===e||e.destroy(),delete this._audioLevelFetcher},t.prototype._startAudioCaptureAndRecoder=function(e){return r_(this,void 0,void 0,(function(){var t,r,i=this;return i_(this,(function(n){switch(n.label){case 0:return t=this,[4,Qz({})];case 1:return t._audioTrack=n.sent(),r=Mz(this._audioTrack.getTrack()),uq.print("startAudioDeviceRecordTest()","create microphone track success!"),[2,new Promise((function(t,n){i._mediaRecorder=new MediaRecorder(r),i._mediaRecorder.ondataavailable=function(r){return r_(i,void 0,void 0,(function(){var i,o,a,s=this;return i_(this,(function(c){switch(c.label){case 0:if(!this._isAudioDeviceRecordTesting)return[3,5];uq.print("startAudioDeviceRecordTest()","get recorded file."),i=new Blob([r.data]),c.label=1;case 1:return c.trys.push([1,3,,4]),[4,this._playAudioFile(URL.createObjectURL(i),{loop:!1})];case 2:return c.sent(),[3,4];case 3:return o=c.sent(),[2,n(o)];case 4:return this._startEmitAudioPlaybackDeviceTestVolume(e),null===(a=this._audioElement)||void 0===a||a.addEventListener("ended",(function(){s.stopAudioDevicePlayTest(),t()})),this._audioCaptureAndRecoderResolve=t,[3,6];case 5:t(),c.label=6;case 6:return[2]}}))}))},i._mediaRecorder.onerror=function(e){n(new oG(Zj.AUDIO_DEVICE_TEST_FAILED,e.message||"mediaRecorder error"))},i._mediaRecorder.start()}))]}}))}))},t.prototype._stopAudioCaptureAndRecoder=function(){var e;this._mediaRecorder&&("recording"===this._mediaRecorder.state&&this._mediaRecorder.stop(),delete this._mediaRecorder),null===(e=this._audioTrack)||void 0===e||e.close(),delete this._audioTrack},t}(nB.exports.EventEmitter),lq=function(){function e(){this.engineBAC={},this.engineANM={},this._init()}return e.prototype._init=function(){return r_(this,void 0,void 0,(function(){var e,t;return i_(this,(function(r){switch(r.label){case 0:return e=new tH,t=this,[4,e.getAudioProfile()];case 1:return t.engineBAC=r.sent(),[2]}}))}))},e.prototype.updateEngineBAC=function(e){e&&(this.engineBAC={codec:this.engineBAC.codec,play:e_(e_({},this.engineBAC.play),e.play),record:e_(e_({},this.engineBAC.record),e.record)},this.setAEC(!!e.aec),this.setAGC(!!e.agc))},e.prototype.updateEngineANM=function(e){e&&(this.engineANM={bitrate:e.enc_param.bitrate,channel:e.enc_param.chn})},e.prototype.setAudioProfile=function(e){var t,r,i;switch(e){case Zf.fluent:r=16e3,t=24e3;break;case Zf.standard:r=48e3,t=48e3;break;case Zf.hd:r=48e3,t=128e3,i=2;break;case Zf.standardStereo:r=48e3,t=8e4,i=2;break;case Zf.hdMono:r=48e3,t=128e3}t&&(this.bitrate=t),i&&(this.channel=i),r&&(this.sampleRate=r)},e.prototype.setBitrate=function(e){e>128e3&&(e=128e3),this.bitrate=e},e.prototype.setAEC=function(e){this.aec=e},e.prototype.setAGC=function(e){this.agc=e},e.prototype.setANS=function(e){this.ans=e},e.prototype.getOpusConfigStr=function(){var e,t,r=";";return this.bitrate&&(r+="maxaveragebitrate=".concat(this.bitrate,";")),(this.sampleRate||(null===(e=this.engineBAC.record)||void 0===e?void 0:e.sr))&&(r+="maxplaybackrate=".concat(this.sampleRate||this.engineBAC.record.sr,";sprop-maxcapturerate=").concat(this.sampleRate||this.engineBAC.record.sr,";")),((this.channel||1)>1||(null===(t=this.engineBAC.record)||void 0===t?void 0:t.chn)>1)&&(r+="stereo=1;sprop-stereo=1;"),r.slice(0,-1)},Object.defineProperty(e.prototype,"config",{get:function(){var e,t,r;return{bitrate:this.bitrate||this.engineANM.bitrate,channel:this.channel||(null===(e=this.engineBAC.record)||void 0===e?void 0:e.chn)||(null===(t=this.engineANM)||void 0===t?void 0:t.chn)||1,aec:!!this.aec,agc:!!this.agc,ans:!!this.ans,sampleRate:this.sampleRate||(null===(r=this.engineBAC.record)||void 0===r?void 0:r.sr)}},enumerable:!1,configurable:!0}),e}(),hq=new WeakMap,pq=function(e,t,r){if(requestAnimationFrame){var i=hq.get(e);(null==i?void 0:i[t])?fq(e,t):i||(i={},hq.set(e,i));var n=e[t];!function o(){var a=requestAnimationFrame(o);i[t]=a;var s=e[t];n!==s&&(n=s,r(s))}()}},fq=function(e,t){var r=hq.get(e);t&&r[t]?cancelAnimationFrame(r[t]):Object.keys(r).length&&Object.keys(r).forEach((function(e){cancelAnimationFrame(r[e])}))},_q=new rj("Engine",0),vq=function(e){function t(t,r){var i=e.call(this)||this;return i._visibility=!0,i._remoteVideoPlayer=new Map,i._remoteScreenPlayer=new Map,i._remoteAudioPlayer=new Map,i._remoteScreenAudioPlayer=new Map,i._publicStreamAudioPlayer=new Map,i._publicStreamVideoPlayer=new Map,i._publicStreamIds=new Map,i._videoStreamConstraints={},i._audioStreamConstraints={},i._enableSimulcast=!1,i._videoStreamEncodeConfig=[rB],i._screenStreamEncodeConfig=[iB],i._tipDomList=[],i._pauseAllSubscribeState={audio:void 0,video:void 0},i._audioPropertiesReportTimer=null,i._localAudioNoInputCount=0,i._mirrorType=Gf.MIRROR_TYPE_RENDER,i._audioDeviceManager=new dq,i._audioProfileManager=new lq,i._remoteVideoConfig=new Map,i._userPriorityMap=new Map,i._subscribeFallbackOption=Xf.DISABLE,i._singleStreamRender=!0,i._prevLocalVideoSize={height:0,width:0},i.resubedUserId=new Set,i._videoCaptureStallCount=0,i._vStats="-V",i._aStats="-A",i.audioPlayerUseWebAudio=!1,i._updateMixAudioTrack=function(e,t){return void 0===t&&(t=u_.PLAYOUT_AND_PUBLISH),r_(i,void 0,void 0,(function(){var r;return i_(this,(function(i){switch(i.label){case 0:return _q.print("_updateMixAudioTrack()"),this._localAudioTrack?(e?(this._localAudioTrack.mixType=t,this._localAudioTrack.mixedAudioTrack=e):(delete this._localAudioTrack.mixType,delete this._localAudioTrack.mixedAudioTrack),(null===(r=this._room)||void 0===r?void 0:r.hasPublished)?[4,this._updatePublish()]:[3,2]):(e&&(this._tempMixingAudioTrack={track:e,type:t}),[2]);case 1:i.sent(),i.label=2;case 2:return[2]}}))}))},i._onAudioMixingMessage=function(e){i.safeEmit(h_.onAudioMixingStateChanged,e)},i._onAudioMixingAutoplayFailed=function(e){i.safeEmit(h_.onAutoplayFailed,e)},i._appId=t,i._pubLock=new KK("pubLock"),i._addDeviceEventHandler(),i._audioMixingManager=new oq({getLocalAudioTrack:function(){return i._localAudioTrack},updateLocalAudioTrack:i._updateMixAudioTrack,emitMessage:i._onAudioMixingMessage,onAutoPlayFailed:i._onAudioMixingAutoplayFailed}),window.__rtc_engine__=i,i._engine_number=Math.floor(100*Math.random()+1),window["__rtc_engine__".concat(i._engine_number)]=i,i._trackSourceType={video:wf.VIDEO_SOURCE_TYPE_INTERNAL,screenVideo:wf.VIDEO_SOURCE_TYPE_INTERNAL,audio:kf.AUDIO_SOURCE_TYPE_INTERNAL,screenAudio:kf.AUDIO_SOURCE_TYPE_INTERNAL},i._config=r,i._rtmClient=new sq(t),i._handleRTMClient(i._rtmClient),i._useCloudProxy=!1,i._handleAudioDeviceManager(),i._messageStatisticsObserver=new NW,location.search.includes("_use_web_audio_")&&(i.audioPlayerUseWebAudio=!0),(new tH).getWebRtcConfig({appId:i.appId,deviceId:zF.getDeviceId()}),i}return Of(t,e),Object.defineProperty(t.prototype,"appId",{get:function(){return this._appId},enumerable:!1,configurable:!0}),t.prototype.updateToken=function(e){var t,r,i;return r_(this,void 0,void 0,(function(){var n,o,a,s;return i_(this,(function(c){switch(c.label){case 0:return _q.print("updateToken()","token: %s",e),cG(e,"token"),this.waitForNewToken&&(null===(t=this._room)||void 0===t?void 0:t._roomInfo)&&this._tempRoomConfig?(n=null===(r=this._room)||void 0===r?void 0:r._roomInfo,o=n.roomId,a=n.userInfo,s=this._tempRoomConfig,delete this._tempRoomConfig,[4,this.joinRoom(e,o,a,s)]):[3,2];case 1:return[2,c.sent()];case 2:if(!this._room)throw new oG(Zj.UPDATE_TOKEN_BEFORE_JOIN,"update token before join room");return[4,null===(i=this._room)||void 0===i?void 0:i.updateToken(e)];case 3:return c.sent(),[2]}}))}))},t.prototype.setVideoCaptureDevice=function(e){var t,r;return r_(this,void 0,void 0,(function(){var i,n,o;return i_(this,(function(a){switch(a.label){case 0:return _q.print("setVideoCaptureDevice()","deviceId: %s",e),cG(e,"deviceId"),this._localVideoTrack?GU&&HU&&(i=null===(r=null===(t=this._localVideoTrack)||void 0===t?void 0:t.getTrack())||void 0===r?void 0:r.getSettings())&&i.deviceId===e?[2,Promise.resolve()]:(n=this._videoStreamConstraints,"user"===e||"environment"===e||"left"===e||"right"===e?(delete n.deviceId,n.facingMode=e):!WU||jU?n.deviceId={exact:e}:delete n.deviceId,this._videoStreamConstraints=n,[4,Jz(n)]):(this._localVideoDeviceId=e,[2,Promise.resolve()]);case 1:return o=a.sent(),this._initLocalTrackEvents(o),this._localVideoTrack.close(),this._localVideoTrack=o,this._videoPlayer&&this._videoPlayer.played&&(this._videoPlayer.stop(),this._videoPlayer.playVideo(o),this._videoPlayer.mirror(!!this._mirrorType)),this._room?this._room.hasPublished?[4,this._updatePublish()]:[3,3]:[2];case 2:a.sent(),a.label=3;case 3:return[2]}}))}))},t.prototype.setAudioCaptureDevice=function(e){return r_(this,void 0,void 0,(function(){var t,r;return i_(this,(function(i){switch(i.label){case 0:return _q.print("setAudioCaptureDevice()","deviceId: %s",e),cG(e,"deviceId"),this._localAudioTrack?((t=this._audioStreamConstraints).deviceId={exact:e},this._audioStreamConstraints=t,this._localAudioTrack.close(),[4,Qz(t,this._audioProfileManager)]):(this._localAudioDeviceId=e,[2,Promise.resolve()]);case 1:return r=i.sent(),this._initLocalTrackEvents(r),this._localAudioTrack=r,this._room?this._room.hasPublished?[4,this._updatePublish()]:[3,3]:[2];case 2:i.sent(),i.label=3;case 3:return[2]}}))}))},t.prototype._addDeviceEventHandler=function(){Nz.on(h_.onVideoDeviceStateChanged,this._onVideoDeviceStateChange.bind(this)),Nz.on(h_.onAudioDeviceStateChanged,this._onAudioDeviceStateChange.bind(this))},t.prototype._addHandlerEventHandler=function(){var e,t,r,i,n,o,a,s,c,u,d,l,h,p,f,_,v,m,y,g,S,E,b,I,T,A,R,C,O=this;null===(e=this._room)||void 0===e||e.on(xG.ON_ADD_STREAM,this._onAddStream.bind(this)),null===(t=this._room)||void 0===t||t.on(xG.ON_REMOVE_STREAM,this._onRemoveStream.bind(this)),null===(r=this._room)||void 0===r||r.on(xG.USER_CONNECTION,this._onUserConnection.bind(this)),null===(i=this._room)||void 0===i||i.on(lK.ON_USER_LEAVE,this._onUserLeave.bind(this)),null===(n=this._room)||void 0===n||n.on(lK.ON_ROOM_ERROR,this._onRoomError.bind(this)),null===(o=this._room)||void 0===o||o.on(lK.ON_NETWORK_QUALITY,this._onNetworkQuality.bind(this)),null===(a=this._room)||void 0===a||a.on(xG.ON_CUSTOM_MESSAGE,this._onCustomMessage.bind(this)),null===(s=this._room)||void 0===s||s.on(xG.USER_MESSAGE_RECEIVED,this._onUserMessageReceived.bind(this)),null===(c=this._room)||void 0===c||c.on(xG.USER_BINARY_MESSAGE_RECEIVED,this._onUserBinaryMessageReceived.bind(this)),null===(u=this._room)||void 0===u||u.on(xG.ON_USER_TOKEN_WILL_EXPIRE,this._onUserTokenWillExpire.bind(this)),null===(d=this._room)||void 0===d||d.on(xG.POST_PROCESSING_MESSAGE,(function(e){!function(e){return"2.0"===e.protocol}(e)?"publicStreamCallback"===e.type?O._onPushPublicStreamResult(e):"transcodeStatusCallback"===e.type&&O._onLiveTranscodingResult(e):O._onStreamMixingEvent({error:e.error,event:e.eventType,message:e.message})})),null===(l=this._room)||void 0===l||l.on(FG.ON_CONNECTION_STATE_CHANGE,this._onConnectionStateChange.bind(this)),null===(h=this._room)||void 0===h||h.on(lK.RESUBSCRIBE,this._onResubscribe.bind(this)),null===(p=this._room)||void 0===p||p.on(lK.SUBSCRIBE_PUSH_TRACK,this._onSubscribePushTrack.bind(this)),null===(f=this._room)||void 0===f||f.on(lK.REMOVE_PUSH_TRACK,this._onRemovePushTrack.bind(this)),null===(_=this._room)||void 0===_||_.on(lK.VIDEO_FIRST_FRAME,this._onVideoFirstFrameDecoded.bind(this)),null===(v=this._room)||void 0===v||v.on(lK.ON_PUBLISH_RESULT,(function(e){var t;(null===(t=O._room)||void 0===t?void 0:t._roomConfig.isAutoPublish)&&O.safeEmit(h_.onAutoPublishResult,e)})),null===(m=this._room)||void 0===m||m.on(lK.ON_REMOTE_STREAM_STATS,(function(e){O._checkRemoteStats(e),O.safeEmit(h_.onRemoteStreamStats,e)})),null===(y=this._room)||void 0===y||y.on(lK.ON_LOCAL_STREAM_STATS,(function(e){O.safeEmit(h_.onLocalStreamStats,e)})),null===(g=this._room)||void 0===g||g.on(lK.ON_USER_PUBLISH_STATE_CHANGE,this._onUserPublishStateChange.bind(this)),null===(S=this._room)||void 0===S||S.on(lK.ON_USER_START_AUDIO_CAPTURE,(function(e){var t=e.userId;O.safeEmit(h_.onUserStartAudioCapture,{userId:t})})),null===(E=this._room)||void 0===E||E.on(lK.ON_USER_STOP_AUDIO_CAPTURE,(function(e){var t=e.userId;O.safeEmit(h_.onUserStopAudioCapture,{userId:t})})),null===(b=this._room)||void 0===b||b.on(lK.ON_USER_START_VIDEO_CAPTURE,(function(e){var t=e.userId;O.safeEmit(h_.onUserStartVideoCapture,{userId:t})})),null===(I=this._room)||void 0===I||I.on(lK.ON_USER_STOP_VIDEO_CAPTURE,(function(e){var t=e.userId;O.safeEmit(h_.onUserStopVideoCapture,{userId:t})})),null===(T=this._room)||void 0===T||T.on(lK.ON_SEI_MESSAGED_RECEIVED,(function(e){O.safeEmit(h_.onSEIMessageReceived,e)})),null===(A=this._room)||void 0===A||A.on(lK.ON_REMOTE_VIDEO_SIZE_CHANGED,(function(e,t){O.safeEmit(h_.onRemoteVideoSizeChanged,e,t)})),null===(R=this._room)||void 0===R||R.on(lK.ON_SIMULCAST_SUBSCRIBE_FALLBACK,(function(e){return O.safeEmit(h_.onSimulcastSubscribeFallback,e)})),null===(C=this._room)||void 0===C||C.on(lK.RECONNECT_FAILED,(function(){O.safeEmit(h_.onError,{errorCode:Zj.RECONNECT_FAILED})}))},t.prototype.safeEmit=function(t){for(var r=[],i=1;i<arguments.length;i++)r[i-1]=arguments[i];return mG(t)&&vj(t,JU(r)),e.prototype.safeEmit.apply(this,a_([t],o_(r),!1))},t.prototype._removeHandlerEventHandler=function(){var e;null===(e=this._room)||void 0===e||e.removeAllListeners()},t.prototype.joinRoom=function(e,t,r,i){return r_(this,void 0,void 0,(function(){var n,o,a,s,c,u,d,l,h;return i_(this,(function(p){switch(p.label){case 0:if(location.search.includes("__rtc_debug_2__")){try{for(n=n_(Object.keys(localStorage)),o=n.next();!o.done;o=n.next())(a=o.value).startsWith("RTC_ACCESS")&&localStorage.removeItem(a)}catch(e){l={error:e}}finally{try{o&&!o.done&&(h=n.return)&&h.call(n)}finally{if(l)throw l.error}}e=null}if(_q.print("joinRoom()","token: %o roomId: %o, userInfo: %o, roomConfig: %o",e,t,r,i),hG(e)||cG(e,"token"),function(e){if("string"!=typeof e||!/^[a-zA-Z0-9@._\-]{1,128}$/.test(e))throw new oG(Zj.INVALID_PARAMS,"The RoomId must be within 128 bytes. The supported characters: a-z,A-Z,0-9,@,-,_,.")}(t),function(e){dG(e,"userInfo"),pG(e.userId),hG(e.extraInfo)||cG(e.extraInfo,"userInfo.extraInfo",1,200)}(r),s={isAutoPublish:!0,isAutoSubscribeAudio:!0,isAutoSubscribeVideo:!0,roomProfileType:Qf.communication},eq(s,i),function(e){dG(e,"roomConfig"),aG(e.isAutoPublish,"roomConfig.isAutoPublish"),aG(e.isAutoSubscribeAudio,"roomConfig.isAutoSubscribeAudio"),aG(e.isAutoSubscribeVideo,"roomConfig.isAutoSubscribeVideo")}(s),!this._room||this._room.connectionState===WK.DISCONNECTED)return[3,1];throw new oG(Zj.REPEAT_JOIN,"Already joined");case 1:this._room=new mW(i,{audioProfileManager:this._audioProfileManager,enableFallbackHandler:yq(this.appId)}),this._room.userPriorityMap=this._userPriorityMap,this._room.subscribeFallbackOption=this._subscribeFallbackOption,this._addHandlerEventHandler(),c=this._liveTranscodeConfig&&ZF("started",this._liveTranscodeConfig),p.label=2;case 2:return p.trys.push([2,4,,5]),this._useCloudProxy&&(this._startCloudProxyTimestamp=Date.now()),[4,this._room.join(this._appId,t,e,e_(e_({},r),{businessId:this._businessId,role:this._visibility?iq.NORMAL_USER:iq.SILENT_USER}),c,this._useCloudProxy)];case 3:return u=p.sent(),this._roomConfig=i,this._tempRoomConfig&&delete this._tempRoomConfig,(null==i?void 0:i.isAutoPublish)&&(this._visibility?this._updatePublish({invokeByJoinRoom:!0,mediaType:Ff.AUDIO_AND_VIDEO}):this.safeEmit(h_.onAutoPublishResult,{isScreen:!1,state:Lf.PUBLISH_FAIL})),[2,u];case 4:throw(d=p.sent()).code===Zj.INVALID_TOKEN&&(this._tempRoomConfig=i),d;case 5:return[2]}}))}))},t.prototype.leaveRoom=function(e){var t,r;return void 0===e&&(e=!1),r_(this,void 0,void 0,(function(){return i_(this,(function(i){switch(i.label){case 0:return _q.print("leaveRoom()"),e?[4,null===(t=this._room)||void 0===t?void 0:t.leave(e)]:[3,2];case 1:return i.sent(),[3,3];case 2:null===(r=this._room)||void 0===r||r.leave(e).catch(),i.label=3;case 3:return this._removeHandlerEventHandler(),this._liveTranscodeConfig&&this.stopLiveTranscoding(),this._room=void 0,this._remoteAudioPlayer.forEach((function(e){return e.destroy()})),this._remoteAudioPlayer=new Map,this._remoteScreenAudioPlayer.forEach((function(e){return e.destroy()})),this._remoteScreenAudioPlayer=new Map,this._remoteScreenPlayer.forEach((function(e){return e.destroy()})),this._remoteScreenPlayer=new Map,this._remoteVideoPlayer.forEach((function(e){return e.destroy()})),this._remoteVideoPlayer=new Map,this._roomConfig=void 0,this._publicStreamIds=new Map,[2]}}))}))},t.prototype.destroy=function(){var e,t,r;_q.print("destroy()"),this.removeAllListeners(),this._removeHandlerEventHandler(),null===(e=this._room)||void 0===e||e.destroy(),this._room=void 0,null===(t=this._videoPlayer)||void 0===t||t.destroy(),this._videoPlayer=void 0,this._screenPlayer=void 0,this._videoStreamConstraints={},this._audioStreamConstraints={},this._videoStreamEncodeConfig=[rB],this._screenStreamEncodeConfig=[iB],this._pauseAllSubscribeState={audio:void 0,video:void 0},this._messageStatisticsObserver.destroy(),clearInterval(this._audioVolumeIndicationTimer),clearInterval(this._dummyTimer),this._audioVolumeIndicationTimer=void 0,this._stopAudioPropertiesReport(),this._localAudioTrack&&(this._localAudioTrack.close(),this._localAudioTrack=void 0),this._localVideoTrack&&(this._localVideoTrack.close(),this._localVideoTrack=void 0),this._localScreenAudioTrack&&(this._localScreenAudioTrack.close(),this._localScreenAudioTrack=void 0),this._localScreenVideoTrack&&(this._localScreenVideoTrack.close(),this._localScreenVideoTrack=void 0),this._localImgVideoTrack&&(this._localImgVideoTrack.stop(),this._localImgVideoTrack=void 0),this._localImgScreenTrack&&(this._localImgScreenTrack.stop(),this._localImgScreenTrack=void 0),this._remoteAudioPlayer.forEach((function(e){return e.destroy()})),this._remoteAudioPlayer=new Map,this._remoteScreenAudioPlayer.forEach((function(e){return e.destroy()})),this._remoteScreenAudioPlayer=new Map,this._remoteScreenPlayer.forEach((function(e){return e.destroy()})),this._remoteScreenPlayer=new Map,this._remoteVideoPlayer.forEach((function(e){return e.destroy()})),this._remoteVideoPlayer=new Map,this._publicStreamAudioPlayer.forEach((function(e){return e.destroy()})),this._publicStreamAudioPlayer=new Map,this._publicStreamVideoPlayer.forEach((function(e){return e.destroy()})),this._publicStreamVideoPlayer=new Map,this._roomConfig=void 0,this._audioMixingManager.destroy(),this._rtmClient.destroy(),null===(r=this._outsideRoom)||void 0===r||r.destroy(),this._publicStreamIds=new Map,this._audioDeviceManager.destroy(),this._remoteVideoConfig=new Map,this._userPriorityMap.clear(),delete window["__rtc_engine__".concat(this._engine_number)]},t.prototype.publishStream=function(e){return r_(this,void 0,void 0,(function(){var t,r;return i_(this,(function(i){switch(i.label){case 0:try{t=e!==Ff.AUDIO,r=e!==Ff.VIDEO,this._vStats=t?"+V":this._vStats,this._aStats=r?"+A":this._aStats}catch(e){}return _q.print("publishStream()","mediaType: %o",e),this._checkMediaType(e),this._assertNotInRoom(),tx(e)&&!this._localVideoTrack&&this._localImgVideoTrack&&(this._localVideoTrack=(n=this._localImgVideoTrack,new Hz(n,kU())),this._localVideoTrack.dummy=!0),[4,this._updatePublish({mediaType:e})];case 1:return i.sent(),[2]}var n}))}))},t.prototype.unpublishStream=function(e){return r_(this,void 0,void 0,(function(){var t,r;return i_(this,(function(i){switch(i.label){case 0:try{t=e!==Ff.AUDIO,r=e!==Ff.VIDEO,this._vStats=t?"-V":this._vStats,this._aStats=r?"-A":this._aStats}catch(e){}return _q.print("unpublishStream()","mediaType: %o",e),this._checkMediaType(e),this._assertNotInRoom(),[4,this._updatePublish({mediaType:e,pubState:fK.UNPUB})];case 1:return i.sent(),[2]}}))}))},t.prototype.publishScreen=function(e){return r_(this,void 0,void 0,(function(){var t;return i_(this,(function(r){switch(r.label){case 0:_q.print("publishScreen()","mediaType: %o",e),this._checkMediaType(e),this._assertNotInRoom(),r.label=1;case 1:return r.trys.push([1,3,,4]),tx(e)&&!this._localScreenVideoTrack&&this._localImgScreenTrack&&(this._localScreenVideoTrack=(i=this._localImgScreenTrack,new zz(i,kU())),this._localScreenVideoTrack.dummy=!0),[4,this._updateScreenPublish({mediaType:e,pubState:fK.PUB})];case 2:return r.sent(),[3,4];case 3:throw(t=r.sent())instanceof oG?t:new oG(Zj.UNEXPECTED_ERROR,"unexpected error",t);case 4:return[2]}var i}))}))},t.prototype.unpublishScreen=function(e){return r_(this,void 0,void 0,(function(){return i_(this,(function(t){switch(t.label){case 0:return _q.print("unpublishScreen()","mediaType: %o",e),this._checkMediaType(e),this._assertNotInRoom(),[4,this._updateScreenPublish({mediaType:e,pubState:fK.UNPUB})];case 1:return t.sent(),[2]}}))}))},t.prototype.subscribeStream=function(e,t){return r_(this,void 0,void 0,(function(){return i_(this,(function(r){return _q.print("subscribeStream()","userId: %o, mediaType: %o",e,t),[2,this._subscribe(!1,e,t)]}))}))},t.prototype._subscribe=function(e,t,r){var i,n,o,a,s;return r_(this,void 0,void 0,(function(){var c,u,d,l,h,p,f,_,v;return i_(this,(function(m){switch(m.label){case 0:if(this._checkMediaType(r),this._assertNotInRoom(),c=this._room.remoteStreams.get(t),!(u=null==c?void 0:c.find((function(t){return t.isScreen===e}))))throw new oG(Zj.STREAM_NOT_EXIST,"stream not exist");return d=this._pauseAllSubscribeState.audio,l=this._pauseAllSubscribeState.video,this._pauseAllSubscribeState.audio&&(r-=r&Ff.AUDIO),this._pauseAllSubscribeState.video&&(r-=r&Ff.VIDEO),_q.print("subscribeStream()","due to pauseAll mediaType: %o",r),h=u.hasSubscribed,p=this._remoteVideoConfig.get(t)||(null===(i=this._roomConfig)||void 0===i?void 0:i.remoteVideoConfig),u.originalMediaType=r,[4,this._room.subscribe(u,r,p)];case 1:return m.sent(),ex(r)&&this._updateAudioPlayerState(u),tx(r)&&this._updateVideoPlayerState(u),f=0,_=0,d!==this._pauseAllSubscribeState.audio&&(this._pauseAllSubscribeState.audio?f|=Ff.AUDIO:_|=Ff.AUDIO),l!==this._pauseAllSubscribeState.video&&(this._pauseAllSubscribeState.video?f|=Ff.VIDEO:_|=Ff.VIDEO),f&&this.pauseAllSubscribedStream(f),_&&this.resumeAllSubscribedStream(_),e||!(null===(n=this._roomConfig)||void 0===n?void 0:n.isAutoSubscribeAudio)&&!(null===(o=this._roomConfig)||void 0===o?void 0:o.isAutoSubscribeVideo)||(u.audioTrack||u.videoTrack)&&(v={userId:t,isScreen:!1,state:Mf.SUBSCRIBE_SUCC},this.safeEmit(h_.onAutoSubscribeResult,v)),!h&&ex(r)&&(null===(a=u.observer)||void 0===a||a.setSubscribeAudio(!0)),!h&&tx(r)&&(null===(s=u.observer)||void 0===s||s.setSubscribeVideo(!0)),[2]}}))}))},t.prototype.unsubscribeStream=function(e,t){return r_(this,void 0,void 0,(function(){var r,i;return i_(this,(function(n){if(_q.print("unsubscribeStream()","userId: %o, mediaType: %o",e,t),this._checkMediaType(t),this._assertNotInRoom(),r=this._room.remoteStreams.get(e),!(null==(i=null==r?void 0:r.find((function(e){return!e.isScreen})))?void 0:i.hasSubscribed))throw new oG(Zj.STREAM_NOT_EXIST,"stream not exist");return this._room.unsubscribe(i,t),[2]}))}))},t.prototype.subscribeScreen=function(e,t){return r_(this,void 0,void 0,(function(){return i_(this,(function(r){return _q.print("subscribeScreen() userId: %o, mediaType: %o",e,t),[2,this._subscribe(!0,e,t)]}))}))},t.prototype.unsubscribeScreen=function(e,t){return r_(this,void 0,void 0,(function(){var r,i;return i_(this,(function(n){if(_q.print("unsubscribeScreen() userId: %o, mediaType: %o",e,t),this._checkMediaType(t),this._assertNotInRoom(),r=this._room.remoteStreams.get(e),!(null==(i=null==r?void 0:r.find((function(e){return e.isScreen})))?void 0:i.hasSubscribed))throw new oG(Zj.STREAM_NOT_EXIST,"stream not exist");return this._room.unsubscribe(i,t),[2]}))}))},t.prototype.setRemoteVideoConfig=function(e,t){var r;return r_(this,void 0,void 0,(function(){return i_(this,(function(i){return _q.print("setRemoteVideoConfig() userId: %o, remoteVideoConfig: %o",e,t),pG(e),function(e){if("number"!=typeof(null==e?void 0:e.width)||"number"!=typeof(null==e?void 0:e.height))throw new oG(Zj.INVALID_PARAMS,"remoteVideoConfig must contain width, height, frameRate")}(t),this._remoteVideoConfig.set(e,t),[2,null===(r=this._room)||void 0===r?void 0:r.updateSubVideoConfig(e,t).then((function(){}))]}))}))},t.prototype.startVideoAndAudioCapture=function(e,t){var r,i,n,o,a,s,c;return r_(this,void 0,void 0,(function(){var u,d,l,h,p,f,_,v,m,y=this;return i_(this,(function(g){switch(g.label){case 0:if(_q.print("startVideoCapture()","deviceId: %s",e),_q.print("startAudioCapture()","deviceId: %s",t),hG(e)||cG(e,"videoDeviceId"),hG(t)||cG(t,"audioDeviceId"),e=e||this._localVideoDeviceId,t=t||this._localAudioDeviceId,this._localVideoTrack&&!this._localVideoTrack.dummy)throw new oG(Zj.REPEAT_CAPTURE,"Has already capture");if(this._localAudioTrack)throw new oG(Zj.REPEAT_CAPTURE,"Has already capture");return u=this._videoStreamConstraints,e&&("user"===e||"environment"===e||"left"===e||"right"===e?(delete u.deviceId,u.facingMode=e):!WU||jU?u.deviceId={exact:e}:delete u.deviceId,this._videoStreamConstraints=u),d=this._audioStreamConstraints,t&&(WU&&!jU||(d.deviceId={exact:t}),this._audioStreamConstraints=d),cj.rtcInvokeStatus("createCameraAndMicrophoneTrack start",0,"startVideoAndAudioCapture","",0),[4,Yz(u,d,this._audioProfileManager)];case 1:return l=g.sent(),h=l.videoTrack,p=l.audioTrack,cj.rtcInvokeStatus("createCameraAndMicrophoneTrack finish",0,"startVideoAndAudioCapture","",0),(null===(r=this._videoStreamEncodeConfig[0])||void 0===r?void 0:r.contentHint)&&h.setContentHint(null===(i=this._videoStreamEncodeConfig[0])||void 0===i?void 0:i.contentHint),this._initLocalTrackEvents(h),this._localVideoTrack=h,null===(n=this._videoPlayer)||void 0===n||n.playVideo(h),(f=null==h?void 0:h.getTrack())&&(_=f.getSettings(),v={width:_.width,height:_.height},this._localVideoTrack.resolution=v,this.autoResetVideoEncoderConfig(_),setTimeout((function(){return y.safeEmit(h_.onLocalVideoSizeChanged,{streamIndex:Vf.STREAM_INDEX_MAIN,info:v})}))),this._initLocalTrackEvents(p),this._localAudioTrack=p,this._tempMixingAudioTrack&&(this._localAudioTrack.mixType=this._tempMixingAudioTrack.type,this._localAudioTrack.mixedAudioTrack=this._tempMixingAudioTrack.track,delete this._tempMixingAudioTrack),this._room?(m=this._room._roomConfig.isAutoPublish,(this._room.hasPublished||m)&&(this._visibility?this._updatePublish():this.safeEmit(h_.onAutoPublishResult,{isScreen:!1,state:Lf.PUBLISH_FAIL})),null===(a=null===(o=this._room.localStream)||void 0===o?void 0:o.observer)||void 0===a||a.setEnableVideo(!0),null===(c=null===(s=this._room.localStream)||void 0===s?void 0:s.observer)||void 0===c||c.setEnableAudio(!0),[2]):[2]}}))}))},t.prototype.startVideoCapture=function(e){var t,r,i,n,o;return r_(this,void 0,void 0,(function(){var a,s,c,u,d,l,h=this;return i_(this,(function(p){switch(p.label){case 0:if(_q.print("startVideoCapture()","deviceId: %s",e),hG(e)||cG(e,"deviceId"),e=e||this._localVideoDeviceId,this._localVideoTrack&&!this._localVideoTrack.dummy)throw new oG(Zj.REPEAT_CAPTURE,"Has already capture");return a=this._videoStreamConstraints,e&&("user"===e||"environment"===e||"left"===e||"right"===e?(delete a.deviceId,a.facingMode=e):!WU||jU?a.deviceId={exact:e}:delete a.deviceId,this._videoStreamConstraints=a),[4,Jz(a)];case 1:return s=p.sent(),window.location.search.includes("_pub_canvas_")&&(_q.print("startVideoCapture()","use canvas track in iOS"),s=new qz(s.getTrack(),kU())),(null===(t=this._videoStreamEncodeConfig[0])||void 0===t?void 0:t.contentHint)&&s.setContentHint(null===(r=this._videoStreamEncodeConfig[0])||void 0===r?void 0:r.contentHint),this._initLocalTrackEvents(s),this._localVideoTrack=s,null===(i=this._videoPlayer)||void 0===i||i.playVideo(s),c={},(u=null==s?void 0:s.getTrack())&&(c=u.getSettings(),d={width:c.width,height:c.height},this._localVideoTrack.resolution=d,this.autoResetVideoEncoderConfig(c),setTimeout((function(){return h.safeEmit(h_.onLocalVideoSizeChanged,{streamIndex:Vf.STREAM_INDEX_MAIN,info:d})}))),this._room?(l=this._room._roomConfig.isAutoPublish,(this._room.hasPublished||l)&&(this._visibility?this._updatePublish():this.safeEmit(h_.onAutoPublishResult,{isScreen:!1,state:Lf.PUBLISH_FAIL})),null===(o=null===(n=this._room.localStream)||void 0===n?void 0:n.observer)||void 0===o||o.setEnableVideo(!0),[2,c]):[2,c]}}))}))},t.prototype.stopVideoCapture=function(){var e,t,r,i,n;return r_(this,void 0,void 0,(function(){return i_(this,(function(o){switch(o.label){case 0:if(_q.print("stopVideoCapture()"),this._trackSourceType.video===wf.VIDEO_SOURCE_TYPE_EXTERNAL)throw new oG(Zj.STREAM_TYPE_NOT_MATCH,"setVideoSourceType as internal first");return null===(e=this._videoPlayer)||void 0===e||e.stop(),null===(t=this._localVideoTrack)||void 0===t||t.close(),this._localImgVideoTrack&&this._localVideoTrack?(null===(r=this._localVideoTrack)||void 0===r||r.setTrack(this._localImgVideoTrack),this._localVideoTrack.dummy=!0):this._localVideoTrack=void 0,this._room?this._room.hasPublished?[4,this._updatePublish()]:[3,2]:[2];case 1:o.sent(),o.label=2;case 2:return null===(n=null===(i=this._room.localStream)||void 0===i?void 0:i.observer)||void 0===n||n.setEnableVideo(!1),[2]}}))}))},t.prototype.startAudioCapture=function(e){var t,r;return r_(this,void 0,void 0,(function(){var i,n,o;return i_(this,(function(a){switch(a.label){case 0:if(_q.print("startAudioCapture()","deviceId: $o",e),hG(e)||cG(e,"deviceId"),e=e||this._localAudioDeviceId,this._localAudioTrack)throw new oG(Zj.REPEAT_CAPTURE,"Has already capture");return i=this._audioStreamConstraints,e&&(i.deviceId={exact:e},this._audioStreamConstraints=i),[4,Qz(i,this._audioProfileManager)];case 1:return n=a.sent(),this._initLocalTrackEvents(n),this._localAudioTrack=n,this._tempMixingAudioTrack&&(this._localAudioTrack.mixType=this._tempMixingAudioTrack.type,this._localAudioTrack.mixedAudioTrack=this._tempMixingAudioTrack.track,delete this._tempMixingAudioTrack),this._room?(o=this._room._roomConfig.isAutoPublish,(this._room.hasPublished||o)&&(this._visibility?this._updatePublish():this.safeEmit(h_.onAutoPublishResult,{isScreen:!1,state:Lf.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 r_(this,void 0,void 0,(function(){return i_(this,(function(i){switch(i.label){case 0:if(_q.print("stopAudioCapture()"),null===(e=this._localAudioTrack)||void 0===e||e.close(),this._localAudioTrack=void 0,this._audioMixingManager.stopAll(),this._trackSourceType.audio===kf.AUDIO_SOURCE_TYPE_EXTERNAL)throw new oG(Zj.STREAM_TYPE_NOT_MATCH,"setAudioSourceType as internal first");return this._room?this._room.hasPublished?[4,this._updatePublish()]:[3,2]:[2];case 1:i.sent(),i.label=2;case 2:return null===(r=null===(t=this._room.localStream)||void 0===t?void 0:t.observer)||void 0===r||r.setEnableAudio(!1),[2]}}))}))},t.prototype.getAudioMixingManager=function(){return _q.print("getAudioMixingManager()"),this._audioMixingManager},t.prototype.startScreenCapture=function(e){var t,r,i,n,o,a,s;return void 0===e&&(e={}),r_(this,void 0,void 0,(function(){var c,u,d,l,h,p,f,_=this;return i_(this,(function(v){switch(v.label){case 0:if(_q.print("startScreenCapture()","config: %o",e),(null===(t=this._localScreenVideoTrack)||void 0===t?void 0:t.dummy)||null===(r=this._localScreenVideoTrack)||void 0===r||r.close(),this._localScreenVideoTrack=void 0,c=e.enableAudio,u=void 0!==c&&c,this._trackSourceType.screenVideo===wf.VIDEO_SOURCE_TYPE_EXTERNAL)throw new oG(Zj.STREAM_TYPE_NOT_MATCH,"setVideoSourceType as internal first");if(this._trackSourceType.screenAudio===kf.AUDIO_SOURCE_TYPE_EXTERNAL)throw new oG(Zj.STREAM_TYPE_NOT_MATCH,"setAudioSourceType as internal first");return[4,Zz(u,this._screenStreamEncodeConfig[0])];case 1:return d=v.sent(),this._localScreenVideoTrack=new zz(d.getVideoTracks()[0],kU()),(null===(i=this._screenStreamEncodeConfig[0])||void 0===i?void 0:i.contentHint)&&this._localScreenVideoTrack.setContentHint(null===(n=this._screenStreamEncodeConfig[0])||void 0===n?void 0:n.contentHint),(l=null===(o=this._localScreenVideoTrack)||void 0===o?void 0:o.getTrack())&&(h=l.getSettings(),p={width:h.width,height:h.height},this._localScreenVideoTrack.resolution=p,setTimeout((function(){return _.safeEmit(h_.onLocalVideoSizeChanged,{streamIndex:Vf.STREAM_INDEX_SCREEN,info:{width:h.width,height:h.height}})}))),(f=d.getAudioTracks()).length&&(this._localScreenAudioTrack=new Kz(f[0],kU()),this._initLocalTrackEvents(this._localScreenAudioTrack)),null===(a=this._screenPlayer)||void 0===a||a.playVideo(this._localScreenVideoTrack),this._initLocalTrackEvents(this._localScreenVideoTrack),(null===(s=this._room)||void 0===s?void 0:s.hasScreenPublished)?[4,this._updateScreenPublish()]:[3,3];case 2:v.sent(),v.label=3;case 3:return[2]}}))}))},t.prototype.stopScreenCapture=function(){var e,t,r,i;return r_(this,void 0,void 0,(function(){return i_(this,(function(n){switch(n.label){case 0:return _q.print("stopScreenCapture()"),null===(e=this._screenPlayer)||void 0===e||e.stop(),null===(t=this._localScreenVideoTrack)||void 0===t||t.close(),this._localImgScreenTrack&&this._localScreenVideoTrack?(this._localScreenVideoTrack.setTrack(this._localImgScreenTrack),this._localScreenVideoTrack.dummy=!0):this._localScreenVideoTrack=void 0,null===(r=this._localScreenAudioTrack)||void 0===r||r.close(),this._localScreenAudioTrack=void 0,(null===(i=this._room)||void 0===i?void 0:i.hasScreenPublished)?[4,this._updateScreenPublish()]:[3,2];case 1:n.sent(),n.label=2;case 2:return[2]}}))}))},t.prototype.setLocalVideoPlayer=function(e,t){var r,i,n,o,a,s;if(_q.print("setLocalVideoPlayer()","streamIndex: %o, videoPlayerOption: %o",e,t),uG(e,"streamIndex",[Vf.STREAM_INDEX_MAIN,Vf.STREAM_INDEX_SCREEN]),t&&t.renderDom){var c=e_({userId:this._getUserId()},t);return _G(c),e!==Vf.STREAM_INDEX_MAIN||this._videoPlayer?e!=Vf.STREAM_INDEX_SCREEN||this._screenPlayer?void 0:(this._screenPlayer=new RW(e_(e_({},c),{isScreen:!0})),this._initPlayerEvents(this._screenPlayer),this._localScreenVideoTrack&&!this._localScreenVideoTrack.dummy&&(null===(a=this._config)||void 0===a?void 0:a.autoPlayPolicy)!==$f.PLAY_MANUALLY&&this._screenPlayer.playVideo(this._localScreenVideoTrack),(null===(s=this._room)||void 0===s?void 0:s.localScreenStream)&&(this._room.localScreenStream.videoDom=this._screenPlayer.domElement),this._screenPlayer.domElement):(this._videoPlayer=new RW(c),this._initPlayerEvents(this._videoPlayer),this._videoPlayer.mirror(!!this._mirrorType),this._localVideoTrack&&!this._localVideoTrack.dummy&&(null===(n=this._config)||void 0===n?void 0:n.autoPlayPolicy)!==$f.PLAY_MANUALLY&&this._videoPlayer.playVideo(this._localVideoTrack),(null===(o=this._room)||void 0===o?void 0:o.localStream)&&(this._room.localStream.videoDom=this._videoPlayer.domElement),this._videoPlayer.domElement)}e==Vf.STREAM_INDEX_MAIN?(null===(r=this._videoPlayer)||void 0===r||r.destroy(),delete this._videoPlayer):(null===(i=this._screenPlayer)||void 0===i||i.destroy(),delete this._screenPlayer)},t.prototype.startLiveTranscoding=function(e){var t;return r_(this,void 0,void 0,(function(){var r;return i_(this,(function(i){switch(i.label){case 0:_q.print("startLiveTranscoding()","transcode: %o",e),cG(e.url,"liveTranscode.url"),this._liveTranscodeConfig=e,i.label=1;case 1:return i.trys.push([1,3,,4]),this.safeEmit(h_.onStreamMixingEvent,{event:pK.START,error:0,message:""}),[4,null===(t=this._room)||void 0===t?void 0:t.liveControlMessage(ZF("started",this._liveTranscodeConfig))];case 2:return i.sent(),[3,4];case 3:throw(r=i.sent())instanceof oG?r:new oG(Zj.UNEXPECTED_ERROR,"unexpected error",r);case 4:return[2]}}))}))},t.prototype.updateLiveTranscoding=function(e){var t;return r_(this,void 0,void 0,(function(){var r;return i_(this,(function(i){switch(i.label){case 0:if(_q.print("updateLiveTranscoding()","transcode: %o",e),!this._liveTranscodeConfig)return[2];this._liveTranscodeConfig=eq(this._liveTranscodeConfig,e),i.label=1;case 1:return i.trys.push([1,3,,4]),this.safeEmit(h_.onStreamMixingEvent,{event:pK.UPDATE,error:0,message:""}),[4,null===(t=this._room)||void 0===t?void 0:t.liveControlMessage(ZF("layoutChanged",this._liveTranscodeConfig))];case 2:return i.sent(),[3,4];case 3:throw(r=i.sent())instanceof oG?r:new oG(Zj.UNEXPECTED_ERROR,"unexpected error",r);case 4:return[2]}}))}))},t.prototype.stopLiveTranscoding=function(){var e;return r_(this,void 0,void 0,(function(){var t;return i_(this,(function(r){switch(r.label){case 0:if(_q.print("stopLiveTranscoding()"),!this._liveTranscodeConfig)return[2];delete this._liveTranscodeConfig,r.label=1;case 1:return r.trys.push([1,3,,4]),this.safeEmit(h_.onStreamMixingEvent,{event:pK.STOP,error:0,message:""}),[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 oG?t:new oG(Zj.UNEXPECTED_ERROR,"unexpected error",t);case 4:return[2]}}))}))},t.prototype.setBusinessId=function(e){return _q.print("setBusinessId()","businessId: %s",e),!function(e){return"string"!=typeof e}(e)&&!this._room&&(lj.setStats({rtc_business_id:e}),this._businessId=e,!0)},t.prototype.setUserVisibility=function(e){var t,r;return r_(this,void 0,void 0,(function(){return i_(this,(function(i){switch(i.label){case 0:if(_q.print("setUserVisibility()","enable: %o",e),e=!!e,this._visibility===e)return[2];if(!this._room)return this._visibility=e,[2];if(this._room.connectionState!==WK.CONNECTED)throw new oG(Zj.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:i.sent(),i.label=2;case 2:return[4,this._room.updateUserAttributes({role:e?iq.NORMAL_USER:iq.SILENT_USER})];case 3:return i.sent(),this._visibility=e,e&&(null===(r=this._roomConfig)||void 0===r?void 0:r.isAutoPublish)&&this._updatePublish({mediaType:Ff.AUDIO_AND_VIDEO}),[2]}}))}))},t.prototype._initPlayerEvents=function(e,t){var r=this;void 0===t&&(t=!1),e.on("playback_event",(function(i){var n,o,a,s;switch(null===(o=null===(n=r._room)||void 0===n?void 0:n.remoteStreams.get(i.userId||""))||void 0===o||o.find((function(e){return!e.isScreen})),i.eventName){case"timeupdate":return;case"loadeddata":if("audio"===i.type)t?r.safeEmit(h_.onFirstPublicStreamAudioFrameDecoded,{publicStreamId:e.userId}):r.safeEmit(h_.onAudioFirstFrameDecoded,{userId:e.userId}),cj.firstRemoteAudioRender("",i.userId||"");else{var c={userId:e.userId,height:(null===(a=e.domElement)||void 0===a?void 0:a.videoHeight)||0,width:(null===(s=e.domElement)||void 0===s?void 0:s.videoWidth)||0};t?(c.publicStreamId=c.userId,delete c.userId,r.safeEmit(h_.onFirstPublicStreamVideoFrameDecoded,c),r.safeEmit(h_.onFirstPublicStreamVideoFrameRendered,c)):(r.safeEmit(h_.onVideoFirstFrameDecoded,c),r.safeEmit(h_.onVideoFirstFrameRendered,c)),cj.firstRemoteVideoRender("",i.userId||"")}break;case"autoplay-error":return t&&(i.publicStreamId=i.userId),_q.print("autoplay-error","userId: ".concat(i.userId,", kind: ").concat(e instanceof RW,", rawEvent: "),i.rawEvent),void r.safeEmit(h_.onAutoplayFailed,{userId:i.userId,kind:e instanceof RW?"video":"audio",mediaType:e instanceof RW?Ff.VIDEO:Ff.AUDIO,streamIndex:e.isScreen?Vf.STREAM_INDEX_SCREEN:Vf.STREAM_INDEX_MAIN})}r.safeEmit(h_.onPlayerEvent,i)}))},t.prototype._initLocalTrackEvents=function(e,t){var r=this;void 0===t&&(t=!1),e.on("track-ended",(function(e){var t=!1;e!==r._localScreenAudioTrack&&e!==r._localScreenVideoTrack||(t=!0),r.safeEmit(h_.onTrackEnded,{kind:e.getTrack().kind,isScreen:t})})),e.on("resolution-change",(function(e){r.safeEmit(h_.onLocalVideoSizeChanged,{streamIndex:t?Vf.STREAM_INDEX_SCREEN:Vf.STREAM_INDEX_MAIN,info:e})}))},t.prototype.setRemoteVideoPlayer=function(e,t){var r,i,n,o,a,s;_q.print("setRemoteVideoPlayer()","streamIndex: %o, videoPlayerOption: %o",e,t),uG(e,"streamIndex",[Vf.STREAM_INDEX_MAIN,Vf.STREAM_INDEX_SCREEN]),_G(t);var c=t.userId;if(e==Vf.STREAM_INDEX_MAIN){if(null===(r=this._remoteVideoPlayer.get(c))||void 0===r||r.destroy(),!t.renderDom)return;var u=new RW(t);return this._initPlayerEvents(u),this._remoteVideoPlayer.set(c,u),(d=null===(n=null===(i=this._room)||void 0===i?void 0:i.remoteStreams.get(c))||void 0===n?void 0:n.find((function(e){return!e.isScreen})))&&(this._updateVideoPlayerState(d),d.videoDom=u.domElement),u.domElement}if(null===(o=this._remoteScreenPlayer.get(c))||void 0===o||o.destroy(),t.renderDom){var d;u=new RW(e_(e_({},t),{isScreen:!0}));return this._remoteScreenPlayer.set(c,u),this._initPlayerEvents(u),(d=null===(s=null===(a=this._room)||void 0===a?void 0:a.remoteStreams.get(c))||void 0===s?void 0:s.find((function(e){return e.isScreen})))&&(this._updateVideoPlayerState(d),d.videoDom=u.domElement),u.domElement}},t.prototype.setLocalVideoMirrorType=function(e){_q.print("setLocalVideoMirrorType()","mirrorType: %o",e),uG(e,"mirrorType",[Gf.MIRROR_TYPE_NONE,Gf.MIRROR_TYPE_RENDER]),this._mirrorType=e,this._videoPlayer&&this._videoPlayer.mirror(!!e)},t.prototype.setAudioPlaybackDevice=function(e){return r_(this,void 0,void 0,(function(){var t;return i_(this,(function(r){switch(r.label){case 0:return _q.print("setAudioPlaybackDevice()","deviceId: %s",e),cG(e,"deviceId"),void 0===HTMLAudioElement.prototype.setSinkId?(_q.print("setAudioPlaybackDevice failed","setSinkId not supported by current browser"),[2]):[4,Nz.getDeviceById(e)];case 1:if(!(t=r.sent()))throw new oG(Zj.INVALID_DEVICE_ID,"audio playback device id ".concat(e," is invalid"));return this._remoteAudioPlayer.forEach((function(t){t.setPlaybackDevice(e)})),this._remoteScreenAudioPlayer.forEach((function(t){t.setPlaybackDevice(e)})),this._audioPlaybackDeviceId=e,t&&this.safeEmit(h_.onAudioPlaybackDeviceChanged,t),cj.rtcAudioDevice(PB.PLAYOUT_DEVICE_SWITCH,e,0),[2]}}))}))},t.prototype.play=function(e,t,r){var i,n,o,a,s,c;return void 0===t&&(t=Ff.AUDIO_AND_VIDEO),r_(this,void 0,void 0,(function(){var u,d,l,h,p,f,_,v;return i_(this,(function(m){return _q.print("play()","userId: %s, mediaType: %s, streamIndex: %s",e,t,r),u=!e||e===this._getUserId()||"local_user",d=void 0===r||r===Vf.STREAM_INDEX_MAIN,l=void 0===r||r===Vf.STREAM_INDEX_SCREEN,h=t!==Ff.VIDEO,p=t!==Ff.AUDIO,f=[],u&&p&&(d&&this._localVideoTrack&&(null===(i=this._videoPlayer)||void 0===i||i.mirror(!!this._mirrorType),f.push(null===(n=this._videoPlayer)||void 0===n?void 0:n.playVideo(this._localVideoTrack))),l&&this._localScreenVideoTrack&&f.push(null===(o=this._screenPlayer)||void 0===o?void 0:o.playVideo(this._localScreenVideoTrack))),e===(null===(a=this._audioMixingManager)||void 0===a?void 0:a.id)&&f.push(this._audioMixingManager.resumeLocalPlay()),_=null===(s=this._room)||void 0===s?void 0:s.remoteStreams,p&&d&&f.push(kW(this._remoteVideoPlayer,e,!1,_)),p&&l&&f.push(kW(this._remoteScreenPlayer,e,!0,_)),h&&d&&f.push(kW(this._remoteAudioPlayer,e,!1,_)),p&&l&&f.push(kW(this._remoteScreenAudioPlayer,e,!0,_)),v=null===(c=this._outsideRoom)||void 0===c?void 0:c.remoteStreams,h&&f.push(kW(this._publicStreamVideoPlayer,e,!1,v)),p&&f.push(kW(this._publicStreamAudioPlayer,e,!1,v)),[2,Promise.all(f).then((function(){}))]}))}))},t.prototype.pauseAllSubscribedStream=function(e){return r_(this,void 0,void 0,(function(){var t,r=this;return i_(this,(function(i){return _q.print("pauseAllSubscribedStream()","mediaType: %o",e),this._checkMediaType(e),t=function(){ex(e)&&(r._pauseAllSubscribeState.audio=!0),tx(e)&&(r._pauseAllSubscribeState.video=!0)},this._room?[2,this._room.pauseAllSubscribedStream(e).then((function(){t()}))]:(t(),[2,Promise.resolve()])}))}))},t.prototype.resumeAllSubscribedStream=function(e){return r_(this,void 0,void 0,(function(){var t,r=this;return i_(this,(function(i){return _q.print("resumeAllSubscribedStream()","mediaType: %o",e),this._checkMediaType(e),t=function(){ex(e)&&(r._pauseAllSubscribeState.audio=!1),tx(e)&&(r._pauseAllSubscribeState.video=!1)},this._room?[2,this._room.resumeAllSubscribedStream(e).then((function(){var e,i;t(),null===(i=null===(e=r._room)||void 0===e?void 0:e.remoteStreams)||void 0===i||i.forEach((function(e){Array.isArray(e)&&e.forEach((function(e){r._updateAudioPlayerState(e),r._updateVideoPlayerState(e)}))}))}))]:(t(),[2,Promise.resolve()])}))}))},t.prototype.sendUserMessage=function(e,t){var r;return r_(this,void 0,void 0,(function(){var i,n=this;return i_(this,(function(o){if(pG(e),vG(t),!this._room||this._room.connectionState!==WK.CONNECTED)throw new oG(Zj.IM_BEFORE_JOIN,"join first");return i=Date.now(),[2,null===(r=this._room.sendUserMessage(e,t))||void 0===r?void 0:r.then((function(t){return n._messageStatisticsObserver.countP2PMessage(!0,e,!1,i,t),t.id})).catch((function(t){throw n._messageStatisticsObserver.countP2PMessage(!1,e,!1,i),t}))]}))}))},t.prototype.sendUserBinaryMessage=function(e,t){var r;return r_(this,void 0,void 0,(function(){var i,n=this;return i_(this,(function(o){if(pG(e),lG(t,"message"),vG(t),!this._room||this._room.connectionState!==WK.CONNECTED)throw new oG(Zj.IM_BEFORE_JOIN,"join first");return i=Date.now(),[2,null===(r=this._room.sendUserMessage(e,t))||void 0===r?void 0:r.then((function(t){return n._messageStatisticsObserver.countP2PMessage(!0,e,!0,i,t),t.id})).catch((function(t){throw n._messageStatisticsObserver.countP2PMessage(!1,e,!0,i),t}))]}))}))},t.prototype.sendRoomMessage=function(e){return r_(this,void 0,void 0,(function(){var t,r=this;return i_(this,(function(i){if(vG(e),!this._room||this._room.connectionState!==WK.CONNECTED)throw new oG(Zj.IM_BEFORE_JOIN,"join first");return t=Date.now(),[2,this._room.sendRoomMessage(e).then((function(e){var i,n;return r._messageStatisticsObserver.countRoomMessage(!0,null===(n=null===(i=r._room)||void 0===i?void 0:i.roomInfo)||void 0===n?void 0:n.roomId,!1,t),e})).catch((function(e){var i,n;throw r._messageStatisticsObserver.countRoomMessage(!1,null===(n=null===(i=r._room)||void 0===i?void 0:i.roomInfo)||void 0===n?void 0:n.roomId,!1,t),e}))]}))}))},t.prototype.sendRoomBinaryMessage=function(e){return r_(this,void 0,void 0,(function(){var t,r=this;return i_(this,(function(i){if(vG(e),!this._room||this._room.connectionState!==WK.CONNECTED)throw new oG(Zj.IM_BEFORE_JOIN,"join first");return t=Date.now(),[2,this._room.sendRoomMessage(e,!0).then((function(e){var i,n;return r._messageStatisticsObserver.countRoomMessage(!0,null===(n=null===(i=r._room)||void 0===i?void 0:i.roomInfo)||void 0===n?void 0:n.roomId,!0,t),e})).catch((function(e){var i,n;throw r._messageStatisticsObserver.countRoomMessage(!1,null===(n=null===(i=r._room)||void 0===i?void 0:i.roomInfo)||void 0===n?void 0:n.roomId,!0,t),e}))]}))}))},t.prototype.setAudioCaptureConfig=function(e){var t;return void 0===e&&(e={}),r_(this,void 0,void 0,(function(){var r;return i_(this,(function(i){switch(i.label){case 0:return _q.print("setAudioCaptureConfig()","config: %o",e),delete e.deviceId,function(e){var t,r;try{var i=navigator.mediaDevices.getSupportedConstraints();try{for(var n=n_(Object.keys(e)),o=n.next();!o.done;o=n.next()){var a=o.value;i[a]||delete e[a]}}catch(e){t={error:e}}finally{try{o&&!o.done&&(r=n.return)&&r.call(n)}finally{if(t)throw t.error}}}catch(e){}}(e),r=this._audioStreamConstraints.deviceId,this._audioStreamConstraints=e,r&&(this._audioStreamConstraints.deviceId=r),this._localAudioTrack?(this._localAudioTrack.audioCaptureConfig=this._audioStreamConstraints,[4,null===(t=this._localAudioTrack)||void 0===t?void 0:t.updateAudioCaptureConfig()]):[3,2];case 1:i.sent(),i.label=2;case 2:return[2]}}))}))},t.prototype.setVideoCaptureConfig=function(e){var t;return void 0===e&&(e={}),r_(this,void 0,void 0,(function(){var r;return i_(this,(function(i){switch(i.label){case 0:return _q.print("setVideoCaptureConfig()","config: %o",e),delete e.deviceId,r=this._videoStreamConstraints.deviceId,"number"==typeof e.width&&(e.width={ideal:e.width,max:e.width}),"number"==typeof e.height&&(e.height={ideal:e.height,max:e.height}),this._videoStreamConstraints=e,r&&(this._videoStreamConstraints.deviceId=r),this._localVideoTrack?(this._localVideoTrack.videoCaptureConfig=this._videoStreamConstraints,[4,null===(t=this._localVideoTrack)||void 0===t?void 0:t.updateVideoCaptureConfig()]):[3,2];case 1:i.sent(),this._updatePublish(),i.label=2;case 2:return[2]}}))}))},t.prototype.enableSimulcastMode=function(e){return _q.print("enableSimulcastMode()","enabled: %o",e),this._enableSimulcast=e,!0},t.prototype.setVideoEncoderConfig=function(e){var t,r,i;return r_(this,void 0,void 0,(function(){return i_(this,(function(n){return _q.print("setVideoEncoderConfig()"," descriptions: %o",e),Array.isArray(e)||(e=[e]),(e=e.filter((function(e){return e}))).length>3&&(e=e.slice(0,3)),e.sort((function(e,t){return t.maxKbps-e.maxKbps})),this._localVideoTrack&&(null===(t=e[0])||void 0===t?void 0:t.contentHint)&&this._localVideoTrack.setContentHint(null===(r=e[0])||void 0===r?void 0:r.contentHint),this._videoStreamEncodeConfig=e,(null===(i=this._room)||void 0===i?void 0:i.hasPublished)&&this._updatePublish(),[2]}))}))},t.prototype.autoResetVideoEncoderConfig=function(e){var t;if(e){(null===(t=this._videoStreamEncodeConfig)||void 0===t?void 0:t.length)||(this._videoStreamEncodeConfig=[rB]);var r=e.width*e.height,i=this._videoStreamEncodeConfig[0];if(!(nx(i.width)*nx(i.height)<=r)){var n,o,a=tB,s=a[0];a.forEach((function(e,t){var i=nx(e.width)*nx(e.height);n||(r<i?n=e:s=e)})),o=n&&nx(n.width)*nx(n.height)-r<r-nx(s.width)*nx(s.height)?Object.assign({},n):Object.assign({},s),this._videoStreamEncodeConfig=this._videoStreamEncodeConfig.filter((function(e){return!(o&&nx(e.width)*nx(e.height)>=r)||(o.maxKbps=Math.min(e.maxKbps,o.maxKbps),!1)})),this._videoStreamEncodeConfig.unshift({width:e.width,height:e.height,frameRate:e.frameRate?Math.round(e.frameRate):this._videoStreamEncodeConfig[0].frameRate,maxKbps:o.maxKbps}),_q.print("autoResetVideoEncoderConfig() result",JSON.stringify(this._videoStreamEncodeConfig)),cj.rtcInvokeStatus(JSON.stringify(this._videoStreamEncodeConfig),0,"autoResetVideoEncoderConfig","",0)}}},t.prototype.setScreenEncoderConfig=function(e){var t;return r_(this,void 0,void 0,(function(){return i_(this,(function(r){return _q.print("setScreenEncoderConfig()","description: %o",e),this._screenStreamEncodeConfig=[e],this._localScreenVideoTrack&&(this._localScreenVideoTrack.videoCaptureConfig=e,this._localScreenVideoTrack.updateVideoCaptureConfig(),e.contentHint&&this._localScreenVideoTrack.setContentHint(e.contentHint)),(null===(t=this._room)||void 0===t?void 0:t.hasScreenPublished)&&this._updateScreenPublish(),[2]}))}))},t.prototype.sendSEIMessage=function(e,t,r){var i,n,o,a,s,c;_q.print("sendSEIMessage()","streamIdex: %o, message: %o, repeatCount: %o",e,t,r),uG(e,"streamIndex",[Vf.STREAM_INDEX_MAIN,Vf.STREAM_INDEX_SCREEN]),sG(r,"repeatCount",0,30);var u="string"==typeof t?new Uint8Array(MU.str2ab(t)):t;if(t.length){var d;if(e===Vf.STREAM_INDEX_MAIN){if(!(null===(n=null===(i=this._room)||void 0===i?void 0:i.localStream)||void 0===n?void 0:n.hasPublished))return;d=null===(o=this._room)||void 0===o?void 0:o.localStream}else{if(!(null===(s=null===(a=this._room)||void 0===a?void 0:a.localScreenStream)||void 0===s?void 0:s.hasPublished))return;d=null===(c=this._room)||void 0===c?void 0:c.localScreenStream}if(u.byteLength>4096)_q.print("sei size must not bigger than 4KB");else{var l=kU();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 _q.print("sei message must not be empty")},t.prototype.setAudioVolumeIndicationInterval=function(e){var t=this;_q.print("setAudioVolumeIndicationInterval()","interval %o: ",e),("number"!=typeof e||e<200)&&(e=200);var r=[];this._audioVolumeIndicationTimer&&clearInterval(this._audioVolumeIndicationTimer),this._audioVolumeIndicationTimer=setInterval((function(){var e,i;r=[],null===(e=t._room)||void 0===e||e.remoteStreams.forEach((function(e,t){var i;if(0!==e.length){var n=e.find((function(e){return!1===e.isScreen})),o=null===(i=null==n?void 0:n.audioTrack)||void 0===i?void 0:i.getAudioLevel();r.push({userId:t,volume:o||0})}}));var n=null===(i=t._localAudioTrack)||void 0===i?void 0:i.getAudioLevel();r.push({userId:t._getUserId(),volume:n||0}),t.safeEmit(h_.onAudioVolumeIndication,{speakers:r})}),e)},t.prototype.enableAudioPropertiesReport=function(e){var t,r,i,n,o,a=this;void 0===e&&(e={}),_q.print("enableAudioPropertiesReport()","config %o: ",e);var s=e.interval,c=void 0===s?100:s,u=e.enableInBackground,d=void 0===u||u;if(this._stopAudioPropertiesReport(),c<=0)return null===(t=this._room)||void 0===t||t.remoteStreams.forEach((function(e){e.forEach((function(e){return e.stopRecordAudioEnergy()}))})),null===(i=null===(r=this._room)||void 0===r?void 0:r.localStream)||void 0===i||i.stopRecordAudioEnergy(),void(null===(o=null===(n=this._room)||void 0===n?void 0:n.localScreenStream)||void 0===o||o.stopRecordAudioEnergy());c=Math.max(100,c),this._audioPropertiesReportTimer=self.setInterval((function(){var e,t,r,i;if(d||"hidden"!==document.visibilityState){var n=[],o=a._audioDeviceManager.getRecordTrack()||a._localAudioTrack;if(o){var s=o.getAudioLevel();null===(t=null===(e=a._room)||void 0===e?void 0:e.localStream)||void 0===t||t.recordAudioEnergy(s),n.push({streamIndex:Vf.STREAM_INDEX_MAIN,audioPropertiesInfo:{linearVolume:s,nonlinearVolume:$U(s)}})}if(a._localScreenAudioTrack){s=a._localScreenAudioTrack.getAudioLevel();null===(i=null===(r=a._room)||void 0===r?void 0:r.localScreenStream)||void 0===i||i.recordAudioEnergy(s),n.push({streamIndex:Vf.STREAM_INDEX_SCREEN,audioPropertiesInfo:{linearVolume:s,nonlinearVolume:$U(s)}})}if(a.safeEmit(h_.onLocalAudioPropertiesReport,n),a._room){var c=[];a._room.remoteStreams.forEach((function(e,t){e.forEach((function(e){var r,i;if(e.audioTrack){var n=e.audioTrack.getAudioLevel();e.recordAudioEnergy(n),c.push({streamKey:{userId:t,streamIndex:e.isScreen?Vf.STREAM_INDEX_SCREEN:Vf.STREAM_INDEX_MAIN,roomId:null===(i=null===(r=a._room)||void 0===r?void 0:r.roomInfo)||void 0===i?void 0:i.roomId},audioPropertiesInfo:{linearVolume:n,nonlinearVolume:$U(n)}})}}))})),a.safeEmit(h_.onRemoteAudioPropertiesReport,c)}}}),c),jU&&(this._localAudioInputTimer=self.setInterval((function(){var e,t;a._localAudioTrack&&(a._localAudioTrack.checkHasInput()?a._localAudioNoInputCount=0:(a._localAudioNoInputCount++,5===a._localAudioNoInputCount&&(null===(e=a.localAudioTrack)||void 0===e||e.resetAudioLevelFetcher(),null===(t=a._room)||void 0===t||t.remoteStreams.forEach((function(e){Array.isArray(e)&&e.filter((function(e){return!e.isScreen})).forEach((function(e){var t;null===(t=null==e?void 0:e.audioTrack)||void 0===t||t.resetAudioLevelFetcher()}))})),_q.print("Reset audio level fetcher",""),cj.rtcInvokeStatus("Reset audio level fetcher",0,"_localAudioInputTimer","",0))))}),400))},t.prototype.setVideoSourceType=function(e,t){var r,i,n,o,a,s,c,u,d,l,h,p,f,_,v,m,y;return r_(this,void 0,void 0,(function(){var g,S,E;return i_(this,(function(b){switch(b.label){case 0:return _q.print("setVideoSourceType()","index: %o, videoSourceType: %o",e,t),uG(e,"streamIndex",[Vf.STREAM_INDEX_MAIN,Vf.STREAM_INDEX_SCREEN]),uG(t,"VideoSourceType",[wf.VIDEO_SOURCE_TYPE_EXTERNAL,wf.VIDEO_SOURCE_TYPE_INTERNAL]),g=e===Vf.STREAM_INDEX_MAIN?"video":"screenVideo",this._trackSourceType[g]===t?[3,4]:(this._trackSourceType[g]=t,_q.print("setVideoSourceType","set ".concat(g," source type to ").concat(t)),this._localVideoTrack&&e===Vf.STREAM_INDEX_MAIN?(E=!1,t===wf.VIDEO_SOURCE_TYPE_EXTERNAL&&(E=!0,this._localVideoTrack.close()),null===(r=this._videoPlayer)||void 0===r||r.stop(),this._localVideoTrack=void 0,S=null===(i=this._room)||void 0===i?void 0:i._roomConfig.isAutoPublish,E?null===(a=null===(o=null===(n=this._room)||void 0===n?void 0:n.localStream)||void 0===o?void 0:o.observer)||void 0===a||a.setEnableVideo(!1):null===(u=null===(c=null===(s=this._room)||void 0===s?void 0:s.localStream)||void 0===c?void 0:c.observer)||void 0===u||u.setPushVideo(!1),(null===(d=this._room)||void 0===d?void 0:d.hasPublished)||S?[4,this._updatePublish()]:[3,2]):[3,2]);case 1:b.sent(),b.label=2;case 2:return this._localScreenVideoTrack&&e===Vf.STREAM_INDEX_SCREEN?(E=!1,t===wf.VIDEO_SOURCE_TYPE_EXTERNAL&&(E=!0,this._localScreenVideoTrack.close()),null===(l=this._screenPlayer)||void 0===l||l.stop(),this._localScreenVideoTrack=void 0,E?null===(f=null===(p=null===(h=this._room)||void 0===h?void 0:h.localScreenStream)||void 0===p?void 0:p.observer)||void 0===f||f.setEnableVideo(!1):null===(m=null===(v=null===(_=this._room)||void 0===_?void 0:_.localScreenStream)||void 0===v?void 0:v.observer)||void 0===m||m.setPushVideo(!1),(null===(y=this._room)||void 0===y?void 0:y.hasScreenPublished)?[4,this._updateScreenPublish()]:[3,4]):[3,4];case 3:b.sent(),b.label=4;case 4:return[2]}}))}))},t.prototype.setExternalVideoTrack=function(e,t){var r,i,n,o,a,s,c,u;return r_(this,void 0,void 0,(function(){var d;return i_(this,(function(l){switch(l.label){case 0:if(_q.print("setExternalVideoTrack()","index: %o, track: %o",e,t),uG(e,"streamIndex",[Vf.STREAM_INDEX_MAIN,Vf.STREAM_INDEX_SCREEN]),e!==Vf.STREAM_INDEX_MAIN)return[3,2];if(this._trackSourceType.video!==wf.VIDEO_SOURCE_TYPE_EXTERNAL)throw new oG(Zj.STREAM_TYPE_NOT_MATCH,"setVideoSourceType as external first");return this._localVideoTrack=new Wz(t,kU()),this._initLocalTrackEvents(this._localVideoTrack),null===(r=this._videoPlayer)||void 0===r||r.playVideo(this._localVideoTrack),d=null===(i=this._room)||void 0===i?void 0:i._roomConfig.isAutoPublish,(null===(n=this._room)||void 0===n?void 0:n.hasPublished)||d?[4,this._updatePublish()]:[3,2];case 1:l.sent(),l.label=2;case 2:if(e!==Vf.STREAM_INDEX_SCREEN)return[3,4];if(this._trackSourceType.screenVideo!==wf.VIDEO_SOURCE_TYPE_EXTERNAL)throw new oG(Zj.STREAM_TYPE_NOT_MATCH,"setVideoSourceType as external first");return this._localScreenVideoTrack=new Wz(t,kU()),this._initLocalTrackEvents(this._localScreenVideoTrack),null===(o=this._screenPlayer)||void 0===o||o.playVideo(this._localScreenVideoTrack),null===(c=null===(s=null===(a=this._room)||void 0===a?void 0:a.localScreenStream)||void 0===s?void 0:s.observer)||void 0===c||c.setPushVideo(!0),(null===(u=this._room)||void 0===u?void 0:u.hasScreenPublished)?[4,this._updateScreenPublish()]:[3,4];case 3:l.sent(),l.label=4;case 4:return[2]}}))}))},t.prototype.setAudioSourceType=function(e,t){var r,i,n,o,a,s,c,u,d,l,h,p,f,_,v;return r_(this,void 0,void 0,(function(){var m,y,g;return i_(this,(function(S){switch(S.label){case 0:return _q.print("setAudioSourceType()","index: %o, audioSourceType: %o",e,t),uG(e,"streamIndex",[Vf.STREAM_INDEX_MAIN,Vf.STREAM_INDEX_SCREEN]),uG(t,"audioSourceType",[kf.AUDIO_SOURCE_TYPE_EXTERNAL,kf.AUDIO_SOURCE_TYPE_INTERNAL]),m=e===Vf.STREAM_INDEX_MAIN?"audio":"screenAudio",this._trackSourceType[m]===t?[3,4]:(this._trackSourceType[m]=t,_q.print("setVideoSourceType","set ".concat(m," source type to ").concat(t)),this._localAudioTrack&&e===Vf.STREAM_INDEX_MAIN?(g=!1,this._trackSourceType.audio===kf.AUDIO_SOURCE_TYPE_EXTERNAL&&(g=!0,this._localAudioTrack.close()),this._localAudioTrack=void 0,y=null===(r=this._room)||void 0===r?void 0:r._roomConfig.isAutoPublish,g?null===(o=null===(n=null===(i=this._room)||void 0===i?void 0:i.localStream)||void 0===n?void 0:n.observer)||void 0===o||o.setEnableAudio(!1):null===(c=null===(s=null===(a=this._room)||void 0===a?void 0:a.localStream)||void 0===s?void 0:s.observer)||void 0===c||c.setPushAudio(!1),(null===(u=this._room)||void 0===u?void 0:u.hasPublished)||y?[4,this._updatePublish()]:[3,2]):[3,2]);case 1:S.sent(),S.label=2;case 2:return this._localScreenAudioTrack&&e===Vf.STREAM_INDEX_SCREEN?(g=!1,this._trackSourceType.audio===kf.AUDIO_SOURCE_TYPE_EXTERNAL&&(g=!0,this._localScreenAudioTrack.close()),this._localScreenAudioTrack=void 0,g?null===(h=null===(l=null===(d=this._room)||void 0===d?void 0:d.localScreenStream)||void 0===l?void 0:l.observer)||void 0===h||h.setEnableAudio(!1):null===(_=null===(f=null===(p=this._room)||void 0===p?void 0:p.localScreenStream)||void 0===f?void 0:f.observer)||void 0===_||_.setPushAudio(!1),(null===(v=this._room)||void 0===v?void 0:v.hasScreenPublished)?[4,this._updateScreenPublish()]:[3,4]):[3,4];case 3:S.sent(),S.label=4;case 4:return[2]}}))}))},t.prototype.setExternalAudioTrack=function(e,t){var r,i,n,o,a,s,c,u,d;return r_(this,void 0,void 0,(function(){var l;return i_(this,(function(h){switch(h.label){case 0:if(_q.print("setExternalAudioTrack()","index: %o, track: %o",e,t),uG(e,"streamIndex",[Vf.STREAM_INDEX_MAIN,Vf.STREAM_INDEX_SCREEN]),e!==Vf.STREAM_INDEX_MAIN)return[3,2];if(this._trackSourceType.audio!==kf.AUDIO_SOURCE_TYPE_EXTERNAL)throw new oG(Zj.STREAM_TYPE_NOT_MATCH,"setAudioSourceType as external first");return this._localAudioTrack=new Xz(t,kU()),this._initLocalTrackEvents(this._localAudioTrack),l=null===(r=this._room)||void 0===r?void 0:r._roomConfig.isAutoPublish,null===(o=null===(n=null===(i=this._room)||void 0===i?void 0:i.localStream)||void 0===n?void 0:n.observer)||void 0===o||o.setPushAudio(!0),(null===(a=this._room)||void 0===a?void 0:a.hasPublished)||l?[4,this._updatePublish()]:[3,2];case 1:h.sent(),h.label=2;case 2:if(e!==Vf.STREAM_INDEX_SCREEN)return[3,4];if(this._trackSourceType.screenAudio!==kf.AUDIO_SOURCE_TYPE_EXTERNAL)throw new oG(Zj.STREAM_TYPE_NOT_MATCH,"setAudioSourceType as external first");return this._localScreenAudioTrack=new Xz(t,kU()),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 r_(this,void 0,void 0,(function(){return i_(this,(function(r){return _q.print("login()","token: %o, userInfo: %o",e,t),hG(e)||cG(e,"token"),pG(t),[2,this._rtmClient.login(e,t)]}))}))},t.prototype.logout=function(){return r_(this,void 0,void 0,(function(){return i_(this,(function(e){return _q.print("logout()"),[2,this._rtmClient.logout()]}))}))},t.prototype.updateLoginToken=function(e){return r_(this,void 0,void 0,(function(){return i_(this,(function(t){return _q.print("updateLoginToken()","token: %o",e),hG(e)||cG(e,"token"),[2,this._rtmClient.updateLoginToken(e)]}))}))},t.prototype.getPeerOnlineStatus=function(e){return r_(this,void 0,void 0,(function(){return i_(this,(function(t){return _q.print("getPeerOnlineStatus()","userId: %o",e),pG(e),[2,this._rtmClient.getPeerOnlineStatus(e)]}))}))},t.prototype.sendUserMessageOutsideRoom=function(e,t){return r_(this,void 0,void 0,(function(){var r,i=this;return i_(this,(function(n){pG(e),vG(t),r=Date.now();try{return[2,this._rtmClient.sendUserMessageOutsideRoom(e,t).then((function(t){return i._messageStatisticsObserver.countUserMessageOutsideRoom(!0,e,!1,r,t),t.id})).catch((function(t){throw i._messageStatisticsObserver.countUserMessageOutsideRoom(!1,e,!1,r),t}))]}catch(t){throw this._messageStatisticsObserver.countUserMessageOutsideRoom(!1,e,!1,r),t}return[2]}))}))},t.prototype.sendUserBinaryMessageOutsideRoom=function(e,t){return r_(this,void 0,void 0,(function(){var r,i=this;return i_(this,(function(n){pG(e),lG(t,"message"),vG(t),r=Date.now();try{return[2,this._rtmClient.sendUserMessageOutsideRoom(e,t).then((function(t){return i._messageStatisticsObserver.countUserMessageOutsideRoom(!0,e,!0,r,t),t.id})).catch((function(t){throw i._messageStatisticsObserver.countUserMessageOutsideRoom(!1,e,!0,r),t}))]}catch(t){throw this._messageStatisticsObserver.countUserMessageOutsideRoom(!1,e,!0,r),t}return[2]}))}))},t.prototype.setServerParams=function(e,t){return r_(this,void 0,void 0,(function(){return i_(this,(function(r){return _q.print("setServerParams()","signature: %o, url: %0",e,t),cG(e,"signature"),cG(t,"url"),[2,this._rtmClient.setServerParams(e,t)]}))}))},t.prototype.sendServerMessage=function(e){return r_(this,void 0,void 0,(function(){var t,r=this;return i_(this,(function(i){cG(e,"message"),vG(e),t=Date.now();try{return[2,this._rtmClient.sendServerMessage(e).then((function(){r._messageStatisticsObserver.countServerMessage(!0,!1,t)})).catch((function(e){throw r._messageStatisticsObserver.countServerMessage(!1,!1,t),e}))]}catch(e){throw this._messageStatisticsObserver.countServerMessage(!1,!1,t),e}return[2]}))}))},t.prototype.sendServerBinaryMessage=function(e){return r_(this,void 0,void 0,(function(){var t,r=this;return i_(this,(function(i){lG(e,"message"),vG(e),t=Date.now();try{return[2,this._rtmClient.sendServerMessage(e).then((function(){r._messageStatisticsObserver.countServerMessage(!0,!0,t)})).catch((function(e){throw r._messageStatisticsObserver.countServerMessage(!1,!0,t),e}))]}catch(e){throw this._messageStatisticsObserver.countServerMessage(!1,!0,t),e}return[2]}))}))},t.prototype.startCloudProxy=function(e){if(this._room)throw new oG(Zj.START_CLOUD_PROXY_AFTER_JOIN,"[startCloudProxy] should be invoke before join room ");var t;_q.print("startCloudProxy()",e),cG(e.logProxy,"logProxy"),cG(e.accessProxy,"accessProxy"),cG(e.configProxy,"configProxy"),this._originIceConfigRequestUrls=QF("ICE_CONFIG_REQUEST_URLS"),this._originLogServerUrl=QF("LOG_SERVER_URL"),this._originConfigServerUrls=QF("CONFIG_REQUEST_DOMAINS"),JF("ICE_CONFIG_REQUEST_URLS",e.accessProxy),JF("LOG_SERVER_URL",(void 0===(t=e.logProxy)&&(t=""),"https://".concat(t,"/video/v1/webrtc_log/"))),JF("CONFIG_REQUEST_DOMAINS",[e.configProxy]),this._useCloudProxy=!0},t.prototype.stopCloudProxy=function(){if(this._room)throw new oG(Zj.STOP_CLOUD_PROXY_BEFORE_LEAVE,"[stopCloudProxy] should be invoke after leave room ");_q.print("stopCloudProxy()"),JF("ICE_CONFIG_REQUEST_URLS",[]),JF("LOG_SERVER_URL",this._originLogServerUrl),JF("CONFIG_REQUEST_DOMAINS",this._originConfigServerUrls),this._useCloudProxy=!1,this._startCloudProxyTimestamp=void 0},t.prototype.startPushPublicStream=function(e,t){return r_(this,void 0,void 0,(function(){var r,i=this;return i_(this,(function(n){if(_q.print("startPushPublicStream()","publicStreamId: %o, publicStreamParam: %o",e,t),fG(e),!this._room||this._room.connectionState!==WK.CONNECTED)throw new oG(Zj.START_PUBLIC_STREAM_BEFORE_JOIN,"join first");if(this._publicStreamIds.get(e))throw new oG(Zj.REPEAT_PUSH,"repeat push public media stream");return r=$F(e,"started",t),[2,this._room.publicStreamControlMessage(r).then((function(){i._publicStreamIds.set(e,e)}))]}))}))},t.prototype.updatePublicStreamParam=function(e,t){return r_(this,void 0,void 0,(function(){var r;return i_(this,(function(i){if(_q.print("startPushPublicStream()","publicStreamId: %o, publicStreamParam: %o",e,t),fG(e),!this._room||this._room.connectionState!==WK.CONNECTED)throw new oG(Zj.START_PUBLIC_STREAM_BEFORE_JOIN,"join first");return r=$F(e,"layoutChanged",t),[2,this._room.publicStreamControlMessage(r)]}))}))},t.prototype.stopPushPublicStream=function(e){return r_(this,void 0,void 0,(function(){var t=this;return i_(this,(function(r){if(_q.print("startPushPublicStream()","publicStreamId: %o",e),fG(e),!this._room||this._room.connectionState!==WK.CONNECTED)throw new oG(Zj.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,r,i,n;return r_(this,void 0,void 0,(function(){var o,a,s,c=this;return i_(this,(function(u){switch(u.label){case 0:return fG(e),this._outsideRoom?[3,2]:(this._outsideRoom=new cq(this._appId,{audioProfileManager:this._audioProfileManager,enableFallbackHandler:yq(this._appId)}),this._outsideRoom.on(lK.RESUBSCRIBE,(function(e){var t,r,i=e.stream;if(i){var n=c._publicStreamAudioPlayer.get(i.streamId);n&&i.audioTrack&&(n.stop(),n.playAudio(null===(t=e.stream)||void 0===t?void 0:t.audioTrack));var o=c._publicStreamVideoPlayer.get(i.streamId);o&&i.videoTrack&&o.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,c.safeEmit(h_.onPublicStreamStats,e)})),null===(r=this._outsideRoom)||void 0===r||r.on("streamDecodeFailed",(function(e){c.safeEmit(h_.onError,{errorCode:Zj.PUBLIC_STREAM_DECODE_FAILED,publicStreamId:e.publicStreamId})})),null===(i=this._outsideRoom)||void 0===i||i.on(lK.ON_SEI_MESSAGED_RECEIVED,(function(e){c.safeEmit(h_.onPublicStreamSEIMessageReceived,e)})),[4,this._outsideRoom.connect()]);case 1:u.sent(),u.label=2;case 2:return[4,this._outsideRoom.startPlayPublicStream(e)];case 3:return o=u.sent(),(a=this._publicStreamVideoPlayer.get(e))&&(null==o?void 0:o.videoTrack)&&a.playVideo(o.videoTrack,o),!(s=this._publicStreamAudioPlayer.get(e))&&(null==o?void 0:o.audioTrack)&&(s=new wW(e,{muted:(null===(n=this._config)||void 0===n?void 0:n.autoPlayPolicy)===$f.VIDEO_ONLY,isScreen:!1,useWebAudio:this.audioPlayerUseWebAudio}),this._initPlayerEvents(s,!0),s.playAudio(o.audioTrack),this._publicStreamAudioPlayer.set(e,s)),[2]}}))}))},t.prototype.stopPlayPublicStream=function(e){return r_(this,void 0,void 0,(function(){var t;return i_(this,(function(r){return this._outsideRoom?(this._outsideRoom.stopPlayPublicStream(e),(t=this._publicStreamAudioPlayer.get(e))&&(t.destroy(),this._publicStreamAudioPlayer.delete(e)),this._outsideRoom.destroy(),this._outsideRoom=void 0,[2]):[2]}))}))},t.prototype.setAudioProfile=function(e){return r_(this,void 0,void 0,(function(){return i_(this,(function(t){return this._audioProfileManager.setAudioProfile(e),[2]}))}))},t.prototype.setPublicStreamVideoPlayer=function(e,t){var r,i,n;_q.print("setPublicStreamVideoPlayer()","publicStreamId: %o, videoPlayerOption: %o",e,t);var o=this._publicStreamVideoPlayer.get(e);if(!(null==t?void 0:t.renderDom)&&o)return o.destroy(),void this._publicStreamVideoPlayer.delete(e);if(!o){o=new RW(e_(e_({},t),{userId:e})),this._initPlayerEvents(o,!0),this._publicStreamVideoPlayer.set(e,o);var a=null===(i=null===(r=this._outsideRoom)||void 0===r?void 0:r.remoteStreams)||void 0===i?void 0:i.get(e);(null==a?void 0:a.videoTrack)&&(null===(n=this._config)||void 0===n?void 0:n.autoPlayPolicy)!==$f.PLAY_MANUALLY&&o.playVideo(a.videoTrack,a)}},t.prototype.setDummyCaptureImagePath=function(e,t){return r_(this,void 0,void 0,(function(){var r=this;return i_(this,(function(i){return[2,new Promise((function(i,n){cG(t,"filePath");var o=new Image;o.crossOrigin="anonymous",o.src=t,o.onload=function(){try{var t=document.createElement("canvas"),a=t.getContext("2d");if(!a)return n(new oG(Zj.UNEXPECTED_ERROR,"Not support canvas"));t.width=o.width,t.height=o.height,a.drawImage(o,0,0,o.width,o.height),clearInterval(r._dummyTimer),r._dummyTimer=window.setInterval((function(){a.drawImage(o,0,0,o.width,o.height)}),200);var s=t.captureStream(5).getVideoTracks()[0];e===Vf.STREAM_INDEX_MAIN?r._localImgVideoTrack=s:r._localImgScreenTrack=s,i()}catch(e){n(new oG(Zj.UNEXPECTED_ERROR,e.message))}},o.onerror=function(){n(new oG(Zj.UNEXPECTED_ERROR,"Load image error"))}}))]}))}))},t.prototype.defaultTranscoding=function(){return JSON.parse(JSON.stringify(eB))},t.prototype._updatePublish=function(e){return void 0===e&&(e={}),r_(this,void 0,void 0,(function(){var t,r,i;return i_(this,(function(n){switch(n.label){case 0:if(_q.print("_updatePublish()","config: %o",e),t={mediaType:void 0,invokeByJoinRoom:!1,pubState:fK.PUB},e=e_(e_({},t),e),!this._visibility)throw new oG(Zj.NO_PUBLISH_PERMISSION,"no publish permission");return[4,this._pubLock.lock()];case 1:if(r=n.sent(),!this._room||this._room.connectionState!==WK.CONNECTED)return r(),[2];n.label=2;case 2:return n.trys.push([2,4,5,6]),[4,this._room.publish(this._videoStreamEncodeConfig,this._enableSimulcast,this._localVideoTrack,this._localAudioTrack,e.mediaType,e.pubState,e.invokeByJoinRoom)];case 3:return n.sent(),this._videoPlayer&&this._room.localStream&&(this._room.localStream.videoDom=this._videoPlayer.domElement),[3,6];case 4:throw(i=n.sent())instanceof oG?i:new oG(Zj.UNEXPECTED_ERROR,"unexpected error",i);case 5:return r(),[7];case 6:return[2]}}))}))},t.prototype.startAudioPlaybackDeviceTest=function(e,t){return r_(this,void 0,void 0,(function(){return i_(this,(function(r){switch(r.label){case 0:return _q.print("startAudioPlaybackDeviceTest()","filePath: %o, indicationInterval: %o",e,t),cG(e,"filePath"),sG(t,"indicationInterval"),[4,this._audioDeviceManager.startAudioPlaybackDeviceTest(e,t)];case 1:return[2,r.sent()]}}))}))},t.prototype.stopAudioPlaybackDeviceTest=function(){_q.print("stopAudioPlaybackDeviceTest()"),this._audioDeviceManager.stopAudioPlaybackDeviceTest()},t.prototype.startAudioDeviceRecordTest=function(e){return r_(this,void 0,void 0,(function(){return i_(this,(function(t){switch(t.label){case 0:return _q.print("startAudioDeviceRecordTest()","indicationInterval: %o",e),sG(e,"indicationInterval"),[4,this._audioDeviceManager.startAudioDeviceRecordTest(e)];case 1:return t.sent(),[2]}}))}))},t.prototype.stopAudioDeviceRecordAndPlayTest=function(){_q.print("stopAudioDeviceRecordAndPlayTest()"),this._audioDeviceManager.stopAudioDeviceRecordAndPlayTest()},t.prototype.stopAudioDevicePlayTest=function(){_q.print("stopAudioDevicePlayTest()"),this._audioDeviceManager.stopAudioDevicePlayTest()},t.prototype.setRemoteUserPriority=function(e,t){var r;_q.print("setRemoteUserPriority()","userId: %o, priority: %o",e,t);try{pG(e),uG(t,"priority",[qf.HIGH,qf.MEDIUM,qf.LOW])}catch(e){return console.warn(e),!1}return this._userPriorityMap.set(e,t),null===(r=this._room)||void 0===r||r.setRemoteUserPriority(e,t),!0},t.prototype.setSubscribeFallbackOption=function(e){_q.print("setSubscribeFallbackOption()","option: %o",e);try{uG(e,"option",[Xf.DISABLE,Xf.VIDEO_STREAM_LOW,Xf.AUDIO_ONLY])}catch(e){return console.warn(e),!1}return!this._room&&(this._subscribeFallbackOption=e,!0)},t.prototype.getLocalStreamTrack=function(e,t){var r,i,n=this;if(_q.print("getLocalStreamTrack()","streamIndex: ".concat(e,", type: ").concat(t)),e===Vf.STREAM_INDEX_MAIN?(r="video"===t?this.localVideoTrack:this.localAudioTrack,i=function(){var e;return null===(e=n._room)||void 0===e?void 0:e.localStream}):(r="video"===t?this.localScreenVideoTrack:this.localScreenAudioTrack,i=function(){var e;return null===(e=n._room)||void 0===e?void 0:e.localScreenStream}),r){var o=r instanceof eK&&r.mixedAudioTrack?r.mixedAudioTrack:r.getTrack();if(o){var a=i();return pq(o,"enabled",this._reportMsTrackEvent.bind(this,"enabled",(null==a?void 0:a.streamId)||"","getLocalStreamTrack",t)),pq(o,"readyState",(function(e){"ended"===e&&(fq(o,"enabled"),fq(o,"readyState")),n._reportMsTrackEvent("readyState",(null==a?void 0:a.streamId)||"","getLocalStreamTrack",t,e)})),o.addEventListener("ended",(function(){fq(o,"enabled"),fq(o,"readyState")})),o}}},t.prototype.getRemoteStreamTrack=function(e,t,r){var i,n,o=this;_q.print("getRemoteStreamTrack()","userId: ".concat(e,", streamIndex: ").concat(t,", type: ").concat(r));var a,s=(null===(i=this._room)||void 0===i?void 0:i.remoteStreams.get(e))||[];if(s&&s.length&&(t===Vf.STREAM_INDEX_MAIN?(a=s.find((function(e){return!e.isScreen})),n="video"===r?null==a?void 0:a.videoTrack:null==a?void 0:a.audioTrack):(a=s.find((function(e){return e.isScreen})),n="video"===r?null==a?void 0:a.videoTrack:null==a?void 0:a.audioTrack),n)){var c=n.getTrack();if(c&&a){var u=a.streamId;return pq(c,"enabled",this._reportMsTrackEvent.bind(this,"enabled",u,"getRemoteStreamTrack",r)),pq(c,"readyState",(function(e){"ended"===e&&(fq(c,"enabled"),fq(c,"readyState")),o._reportMsTrackEvent("readyState",u,"getRemoteStreamTrack",r,e)})),c.addEventListener("ended",(function(){fq(c,"enabled"),fq(c,"readyState")})),c}}},t.prototype.getPublicStreamTrack=function(e,t){var r=this;if(_q.print("getPublicStreamTrack()","Id: ".concat(e,", type: ").concat(t)),this._outsideRoom&&this._outsideRoom.remoteStreams){var i=this._outsideRoom.remoteStreams.get(e);if(i){var n="video"===t?i.videoTrack:i.audioTrack;if(n){var o=n.getTrack();if(o){var a=i.streamId;return pq(o,"enabled",this._reportMsTrackEvent.bind(this,"enabled",a,"getPublicStreamTrack",t)),pq(o,"readyState",(function(e){"ended"===e&&(fq(o,"enabled"),fq(o,"readyState")),r._reportMsTrackEvent("readyState",a,"getPublicStreamTrack",t,e)})),o.addEventListener("ended",(function(){fq(o,"enabled"),fq(o,"readyState")})),o}}}}},t.prototype._reportMsTrackEvent=function(e,t,r,i,n){var o;switch(e){case"readyState":o="live"!==n?"".concat(i," stopped"):"unknown";break;case"enabled":o="".concat(i,!0===n?" unmuted":" muted");break;default:o="unknown"}cj.rtcInvokeStatus(o,0,r,t||"",0,{direction:"getLocalStreamTrack"===r?"up":"down"})},t.prototype._updateScreenPublish=function(e){return void 0===e&&(e={}),r_(this,void 0,void 0,(function(){var t,r,i;return i_(this,(function(n){switch(n.label){case 0:return _q.print("_updateScreenPublish()"),t={mediaType:void 0,pubState:fK.PUB},e=e_(e_({},t),e),[4,this._pubLock.lock()];case 1:if(r=n.sent(),!this._room||this._room.connectionState!==WK.CONNECTED)return r(),[2];n.label=2;case 2:return n.trys.push([2,4,5,6]),[4,this._room.publishScreen(this._screenStreamEncodeConfig,this._localScreenVideoTrack,this._localScreenAudioTrack,e.mediaType,e.pubState)];case 3:return n.sent(),this._screenPlayer&&this._room.localScreenStream&&(this._room.localScreenStream.videoDom=this._screenPlayer.domElement),[3,6];case 4:throw(i=n.sent())instanceof oG?i:new oG(Zj.UNEXPECTED_ERROR,"unexpected error",i);case 5:return r(),[7];case 6:return[2]}}))}))},t.prototype._updateAudioPlayerState=function(e){var t,r;_q.print("_updateAudioPlayerState()");var i=e.userId,n=e.isScreen,o=n?this._remoteScreenAudioPlayer:this._remoteAudioPlayer,a=o.get(i);e.audioTrack?(a||(a=new wW(i,{muted:(null===(t=this._config)||void 0===t?void 0:t.autoPlayPolicy)===$f.VIDEO_ONLY,isScreen:n,useWebAudio:this.audioPlayerUseWebAudio}),this._initPlayerEvents(a),o.set(i,a),this._audioPlaybackDeviceId&&a.setPlaybackDevice(this._audioPlaybackDeviceId)),(null===(r=this._config)||void 0===r?void 0:r.autoPlayPolicy)!==$f.PLAY_MANUALLY&&a.playAudio(e.audioTrack)):null==a||a.stop()},t.prototype.resetRemoteAudioPlayer=function(e){},t.prototype._updateVideoPlayerState=function(e){var t;_q.print("_updateVideoPlayerState()");var r,i=e.userId;r=e.isScreen?this._remoteScreenPlayer.get(i):this._remoteVideoPlayer.get(i),e.videoTrack?r&&(null===(t=this._config)||void 0===t?void 0:t.autoPlayPolicy)!==$f.PLAY_MANUALLY&&r.playVideo(e.videoTrack,e):(null==r?void 0:r.played)&&(null==r||r.stop())},t.prototype._checkLocalCameraStall=function(e){var t,r,i;return r_(this,void 0,void 0,(function(){var n,o;return i_(this,(function(a){switch(a.label){case 0:if("visible"!==document.visibilityState||!(e.videoStats.encoderOutputFrameRate<3&&e.videoStats.encoderOutputFrameRate>0||e.videoStats.sentKBitrate<2&&e.videoStats.sentKBitrate>0))return[3,6];if(this._videoCaptureStallCount++,!(this._videoCaptureStallCount>3))return[3,5];this._videoCaptureStallCount=0,a.label=1;case 1:return a.trys.push([1,4,,5]),[4,this.stopVideoCapture()];case 2:return a.sent(),[4,this.startVideoCapture()];case 3:return a.sent(),n=null===(i=null===(r=null===(t=this._room)||void 0===t?void 0:t._roomInfo)||void 0===r?void 0:r.userInfo)||void 0===i?void 0:i.userId,_q.print("onLocalCameraStalled",n),cj.rtcInvokeStatus(JSON.stringify({userId:n}),0,"Engine.onLocalCameraStalled","",0),[3,5];case 4:return o=a.sent(),console.log(o),[3,5];case 5:return[3,7];case 6:this._videoCaptureStallCount=0,a.label=7;case 7:return[2]}}))}))},t.prototype._checkRemoteStats=function(e){return r_(this,void 0,void 0,(function(){return i_(this,(function(t){switch(t.label){case 0:return!e.videoStats.needResub||this.resubedUserId.has(e.userId)?[3,3]:(cj.rtcInvokeStatus("[resub user] ".concat(e.userId),0,"resub_user","",0),_q.print("[resub user] ".concat(e.userId)),this.resubedUserId.add(e.userId),[4,this.unsubscribeStream(e.userId,Ff.VIDEO)]);case 1:return t.sent(),[4,this.subscribeStream(e.userId,Ff.VIDEO)];case 2:t.sent(),t.label=3;case 3:return[2]}}))}))},t.prototype._onAddStream=function(e){var t,r=e.stream;r.videoDom=null===(t=this._remoteVideoPlayer.get(r.userId))||void 0===t?void 0:t.domElement;var i=null==r?void 0:r.attributes,n=i.localaudio,o=i.audiostream,a=i.localvideo,s=i.videostream,c=$z.NONE;if(o&&(c|=Ff.AUDIO),s&&(c|=Ff.VIDEO),c){if(null==r?void 0:r.isScreen)this.safeEmit(h_.onUserPublishScreen,{userId:r.userId,mediaType:c});else{try{var u=c!==Ff.AUDIO,d=c!==Ff.VIDEO;r._aStats=d?"+oA":r._aStats,r._vStats=u?"+oV":r._vStats}catch(e){}this.safeEmit(h_.onUserPublishStream,{userId:r.userId,mediaType:c}),this._handleAutoSubscribe(r,!0)}(null==r?void 0:r.isScreen)||(n&&this.safeEmit(h_.onUserStartAudioCapture,{userId:r.userId}),a&&this.safeEmit(h_.onUserStartVideoCapture,{userId:r.userId}))}},t.prototype._handleAutoSubscribe=function(e,t){var r,i,n,o,a=$z.NONE;(null===(r=this._roomConfig)||void 0===r?void 0:r.isAutoSubscribeAudio)&&(a|=Ff.AUDIO),(null===(i=this._roomConfig)||void 0===i?void 0:i.isAutoSubscribeVideo)&&(a|=Ff.VIDEO),_q.print("_onAddStream","autoSubType: ".concat(a)),a&&(t&&ex(a)&&(null===(n=e.observer)||void 0===n||n.setAutoSubscribeAudio(!0)),t&&tx(a)&&(null===(o=e.observer)||void 0===o||o.setAutoSubscribeVideo(!0)),this._subscribe(!1,e.userId,a))},t.prototype._onRemoveStream=function(e){var t,r=this,i=e.stream,n=null!==(t=mq[e.reason])&&void 0!==t?t:Bf.STREAM_REMOVE_REASON_OTHER,o=i.isScreen?h_.onUserUnpublishScreen:h_.onUserUnpublishStream,a=$z.NONE;i.attributes.audiostream&&(a|=Ff.AUDIO),i.attributes.videostream&&(a|=Ff.VIDEO),(null==i?void 0:i._workaround_1_)&&(a=Ff.VIDEO),a!==$z.NONE&&this.safeEmit(o,{userId:i.userId,mediaType:a,reason:n}),this._getRemotePlayer(i.userId,i.isScreen).forEach((function(e){(null==i?void 0:i._workaround_1_)||(i.isScreen?(r._remoteScreenPlayer.delete(i.userId),r._remoteScreenAudioPlayer.delete(i.userId)):(r._remoteVideoPlayer.delete(i.userId),r._remoteAudioPlayer.delete(i.userId)),null==e||e.destroy())}))},t.prototype._onUserConnection=function(e){this.safeEmit(h_.onUserJoined,e)},t.prototype._onUserLeave=function(e){this.safeEmit(h_.onUserLeave,e)},t.prototype._onRoomError=function(e){var t;this.safeEmit(h_.onError,e),null===(t=this._room)||void 0===t||t.destroy(),this._room=void 0},t.prototype._onNetworkQuality=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.safeEmit.apply(this,a_([h_.onNetworkQuality],o_(e),!1))},t.prototype._onConnectionStateChange=function(e){void 0!==this._startCloudProxyTimestamp&&this._useCloudProxy&&e.state===jf.CONNECTION_STATE_CONNECTED&&this.safeEmit(h_.onCloudProxyConnected,{interval:Date.now()-this._startCloudProxyTimestamp}),this.safeEmit(h_.onConnectionStateChanged,e)},t.prototype._getRemotePlayer=function(e,t){return[(t?this._remoteScreenAudioPlayer:this._remoteAudioPlayer).get(e),(t?this._remoteScreenPlayer:this._remoteVideoPlayer).get(e)]},t.prototype._stopAudioPropertiesReport=function(){null!==this._audioPropertiesReportTimer&&(clearInterval(this._audioPropertiesReportTimer),this._audioPropertiesReportTimer=null),null!==this._localAudioInputTimer&&clearInterval(this._localAudioInputTimer)},t.prototype._onResubscribe=function(e){e.stream&&(this._getRemotePlayer(e.stream.userId,e.stream.isScreen).forEach((function(e){return null==e?void 0:e.stop()})),this._updateAudioPlayerState(e.stream),this._updateVideoPlayerState(e.stream))},t.prototype._onSubscribePushTrack=function(e){e.stream&&this._updateAudioPlayerState(e.stream)},t.prototype._onRemovePushTrack=function(e){e.stream&&this._updateAudioPlayerState(e.stream)},t.prototype._onVideoFirstFrameDecoded=function(e){this.safeEmit(h_.onVideoFirstFrameDecoded,e)},t.prototype._onVideoDeviceStateChange=function(e){this.safeEmit(h_.onVideoDeviceStateChanged,e)},t.prototype._onAudioDeviceStateChange=function(e){this.safeEmit(h_.onAudioDeviceStateChanged,e)},t.prototype._onUserPublishStateChange=function(e){var t=e.userId,r=e.isScreen,i=e.mediaType,n=e.pubState,o=e.remoteStream,a={userId:t,mediaType:i};if(r)n===fK.PUB?this.safeEmit(h_.onUserPublishScreen,a):this.safeEmit(h_.onUserUnpublishScreen,e_(e_({},a),{reason:Bf.STREAM_REMOVE_REASON_UNPUBLISH}));else if(n===fK.PUB){try{var s=i!==Ff.AUDIO,c=i!==Ff.VIDEO;o._aStats=c?"+oA":o._aStats,o._vStats=s?"+oV":o._vStats}catch(e){}this.safeEmit(h_.onUserPublishStream,a),this._handleAutoSubscribe(o,!0)}else{try{s=i!==Ff.AUDIO,c=i!==Ff.VIDEO;o._aStats=c?"-oA":o._aStats,o._vStats=s?"-oV":o._vStats}catch(e){}this.safeEmit(h_.onUserUnpublishStream,e_(e_({},a),{reason:Bf.STREAM_REMOVE_REASON_UNPUBLISH}))}},t.prototype._onCustomMessage=function(e){var t=e.message;e.binary?this.safeEmit(h_.onRoomBinaryMessageReceived,{userId:e.clientId,message:t}):this.safeEmit(h_.onRoomMessageReceived,{userId:e.clientId,message:t})},t.prototype._onUserMessageReceived=function(e){this._messageStatisticsObserver.recvP2PMessage(e.userId),this.safeEmit(h_.onUserMessageReceived,e)},t.prototype._onUserBinaryMessageReceived=function(e){this._messageStatisticsObserver.recvP2PMessage(e.userId),this.safeEmit(h_.onUserBinaryMessageReceived,e)},t.prototype._onLiveTranscodingResult=function(e){this.safeEmit(h_.onLiveTranscodingResult,e)},t.prototype._onStreamMixingEvent=function(e){this.safeEmit(h_.onStreamMixingEvent,e)},t.prototype._onUserTokenWillExpire=function(){this.safeEmit(h_.onTokenWillExpire)},t.prototype._onPushPublicStreamResult=function(e){this.safeEmit(h_.onPushPublicStreamResult,e)},t.prototype._handleRTMClient=function(e){var t=this;e.on("onUserMessageReceivedOutsideRoom",(function(e){t._messageStatisticsObserver.recvP2POutRoomMessage(e.userId),t.safeEmit(h_.onUserMessageReceivedOutsideRoom,e)})),e.on("onUserBinaryMessageReceivedOutsideRoom",(function(e){t._messageStatisticsObserver.recvP2POutRoomMessage(e.userId),t.safeEmit(h_.onUserBinaryMessageReceivedOutsideRoom,e)})),e.on("onUserDisconnection",(function(){t.safeEmit(h_.onError,{errorCode:Zj.RTM_DUPLICATE_LOGIN})})),e.on("onRTMTokenError",(function(){t.safeEmit(h_.onError,{errorCode:Zj.RTM_TOKEN_ERROR})}))},Object.defineProperty(t.prototype,"waitForNewToken",{get:function(){return!!this._tempRoomConfig},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"localAudioTrack",{get:function(){return this._localAudioTrack},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"localVideoTrack",{get:function(){return this._localVideoTrack},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"localScreenAudioTrack",{get:function(){return this._localScreenAudioTrack},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"localScreenVideoTrack",{get:function(){return this._localScreenVideoTrack},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"remoteStreams",{get:function(){var e,t,r=[];return(null===(e=this._room)||void 0===e?void 0:e.remoteStreams)&&(null===(t=this._room)||void 0===t||t.remoteStreams.forEach((function(e){Array.isArray(e)&&e.forEach((function(e){r.push({userId:e.userId,isScreen:e.isScreen,hasVideo:e.hasVideo,hasAudio:e.hasAudio,videoStreamDescriptions:e.attributes.videoDescriptions})}))}))),r},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"remoteUsers",{get:function(){var e,t,r=[];return(null===(e=this._room)||void 0===e?void 0:e.remoteUsers)&&(null===(t=this._room)||void 0===t||t.remoteUsers.forEach((function(e){r.push({userId:e.userId})}))),r},enumerable:!1,configurable:!0}),t.prototype._handleAudioDeviceManager=function(){var e=this;this._audioDeviceManager.on("onAudioPlaybackDeviceTestVolume",(function(t){e.safeEmit(h_.onAudioPlaybackDeviceTestVolume,t)}))},t.prototype._assertNotInRoom=function(){if(!this._room||this._room.connectionState!==WK.CONNECTED)throw new oG(Zj.INVOKED_BEFORE_JOIN_ROOM,"join first")},t.prototype._checkMediaType=function(e){uG(e,"mediaType",[Ff.AUDIO,Ff.VIDEO,Ff.AUDIO_AND_VIDEO])},t.prototype._getUserId=function(){var e,t;return(null===(t=null===(e=this._room)||void 0===e?void 0:e.roomInfo)||void 0===t?void 0:t.userInfo.userId)||"local_user"},t_([_j()],t.prototype,"updateToken",null),t_([_j()],t.prototype,"setVideoCaptureDevice",null),t_([_j()],t.prototype,"setAudioCaptureDevice",null),t_([_j()],t.prototype,"joinRoom",null),t_([_j()],t.prototype,"leaveRoom",null),t_([_j()],t.prototype,"destroy",null),t_([_j()],t.prototype,"publishStream",null),t_([_j()],t.prototype,"unpublishStream",null),t_([_j()],t.prototype,"publishScreen",null),t_([_j()],t.prototype,"unpublishScreen",null),t_([_j()],t.prototype,"subscribeStream",null),t_([_j()],t.prototype,"unsubscribeStream",null),t_([_j()],t.prototype,"subscribeScreen",null),t_([_j()],t.prototype,"unsubscribeScreen",null),t_([_j()],t.prototype,"setRemoteVideoConfig",null),t_([_j()],t.prototype,"startVideoAndAudioCapture",null),t_([_j()],t.prototype,"startVideoCapture",null),t_([_j()],t.prototype,"stopVideoCapture",null),t_([_j()],t.prototype,"startAudioCapture",null),t_([_j()],t.prototype,"stopAudioCapture",null),t_([_j()],t.prototype,"getAudioMixingManager",null),t_([_j()],t.prototype,"startScreenCapture",null),t_([_j()],t.prototype,"stopScreenCapture",null),t_([_j()],t.prototype,"setLocalVideoPlayer",null),t_([_j()],t.prototype,"startLiveTranscoding",null),t_([_j()],t.prototype,"updateLiveTranscoding",null),t_([_j()],t.prototype,"stopLiveTranscoding",null),t_([_j()],t.prototype,"setBusinessId",null),t_([_j()],t.prototype,"setUserVisibility",null),t_([_j()],t.prototype,"setRemoteVideoPlayer",null),t_([_j()],t.prototype,"setLocalVideoMirrorType",null),t_([_j()],t.prototype,"setAudioPlaybackDevice",null),t_([_j()],t.prototype,"play",null),t_([_j()],t.prototype,"pauseAllSubscribedStream",null),t_([_j()],t.prototype,"resumeAllSubscribedStream",null),t_([_j()],t.prototype,"sendUserMessage",null),t_([_j()],t.prototype,"sendUserBinaryMessage",null),t_([_j()],t.prototype,"sendRoomMessage",null),t_([_j()],t.prototype,"sendRoomBinaryMessage",null),t_([_j()],t.prototype,"setAudioCaptureConfig",null),t_([_j()],t.prototype,"setVideoCaptureConfig",null),t_([_j()],t.prototype,"enableSimulcastMode",null),t_([_j()],t.prototype,"setVideoEncoderConfig",null),t_([_j()],t.prototype,"setScreenEncoderConfig",null),t_([_j()],t.prototype,"sendSEIMessage",null),t_([_j()],t.prototype,"setAudioVolumeIndicationInterval",null),t_([_j()],t.prototype,"enableAudioPropertiesReport",null),t_([_j()],t.prototype,"setVideoSourceType",null),t_([_j()],t.prototype,"setExternalVideoTrack",null),t_([_j()],t.prototype,"setAudioSourceType",null),t_([_j()],t.prototype,"setExternalAudioTrack",null),t_([_j("rtm")],t.prototype,"login",null),t_([_j("rtm")],t.prototype,"logout",null),t_([_j("rtm")],t.prototype,"updateLoginToken",null),t_([_j("rtm")],t.prototype,"getPeerOnlineStatus",null),t_([_j("rtm")],t.prototype,"sendUserMessageOutsideRoom",null),t_([_j("rtm")],t.prototype,"sendUserBinaryMessageOutsideRoom",null),t_([_j("rtm")],t.prototype,"setServerParams",null),t_([_j("rtm")],t.prototype,"sendServerMessage",null),t_([_j("rtm")],t.prototype,"sendServerBinaryMessage",null),t_([_j()],t.prototype,"startCloudProxy",null),t_([_j()],t.prototype,"stopCloudProxy",null),t_([_j()],t.prototype,"startPushPublicStream",null),t_([_j()],t.prototype,"updatePublicStreamParam",null),t_([_j()],t.prototype,"stopPushPublicStream",null),t_([_j("outsideRoom","streamId")],t.prototype,"startPlayPublicStream",null),t_([_j("outsideRoom","streamId")],t.prototype,"stopPlayPublicStream",null),t_([_j()],t.prototype,"setAudioProfile",null),t_([_j("outsideRoom")],t.prototype,"setPublicStreamVideoPlayer",null),t_([_j()],t.prototype,"setDummyCaptureImagePath",null),t_([_j()],t.prototype,"startAudioPlaybackDeviceTest",null),t_([_j()],t.prototype,"stopAudioPlaybackDeviceTest",null),t_([_j()],t.prototype,"startAudioDeviceRecordTest",null),t_([_j()],t.prototype,"stopAudioDeviceRecordAndPlayTest",null),t_([_j()],t.prototype,"stopAudioDevicePlayTest",null),t_([_j()],t.prototype,"setRemoteUserPriority",null),t_([_j()],t.prototype,"setSubscribeFallbackOption",null),t_([_j()],t.prototype,"getLocalStreamTrack",null),t_([_j()],t.prototype,"getRemoteStreamTrack",null),t_([_j()],t.prototype,"getPublicStreamTrack",null),t_([_j()],t.prototype,"resetRemoteAudioPlayer",null),t}(oj),mq={"client unpublished":Bf.STREAM_REMOVE_REASON_UNPUBLISH,"publish failed":Bf.STREAM_REMOVE_REASON_PUBLISH_FAILED,"stream removed":Bf.STREAM_REMOVE_REASON_KEEP_LIVE_FAILED,"client disconnected":Bf.STREAM_REMOVE_REASON_CLIENT_DISCONNECTED,"client republish":Bf.STREAM_REMOVE_REASON_REPUBLISH};function yq(e){var t=zF.getServerConfig(e).web_rtc_config;return!!(null==t?void 0:t.fallback)||!!QF("ENABLE_FALLBACK_HANDLER")}var gq=new rj("BLWEngine",0),Sq=function(e){function t(t,r){var i=e.call(this,t,r)||this;return i.singleStreamRenderMode=!1,tB=[{width:192,height:108,frameRate:15,maxKbps:100},{width:320,height:180,frameRate:15,maxKbps:140},{width:640,height:360,frameRate:15,maxKbps:400},{width:1280,height:720,frameRate:15,maxKbps:1e3},{width:1920,height:1080,frameRate:15,maxKbps:2e3}],i._handleEvent(),i}return Of(t,e),t.prototype.subscribeStream=function(t,r){return r_(this,void 0,void 0,(function(){return i_(this,(function(i){return gq.print("subscribeStream()","userId: %o, mediaType: %o",t,r),this.singleStreamRenderMode&&tx(r)&&e.prototype.subscribeScreen.call(this,t,Ff.VIDEO).catch((function(){})),[2,e.prototype.subscribeStream.call(this,t,r)]}))}))},t.prototype.unsubscribeStream=function(t,r){return r_(this,void 0,void 0,(function(){return i_(this,(function(i){return gq.print("unsubscribeStream()","userId: %o, mediaType: %o",t,r),this.singleStreamRenderMode&&tx(r)&&e.prototype.unsubscribeScreen.call(this,t,Ff.VIDEO).catch((function(){})),[2,e.prototype.unsubscribeStream.call(this,t,r)]}))}))},t.prototype.setRemoteScreenVideoStreamIndex=function(e){var t;return gq.print("setRemoteScreenVideoStreamIndex()","streamIndex: %o",e),(null===(t=this._room)||void 0===t?void 0:t.connectionState)!==WK.CONNECTED&&(this.singleStreamRenderMode=e===Vf.STREAM_INDEX_MAIN,!0)},t.prototype.setRemoteVideoPlayer=function(t,r){if(gq.print("setRemoteVideoPlayer()","streamIndex: %o, videoPlayerOption: %o",t,r),!this.singleStreamRenderMode||t!==Vf.STREAM_INDEX_SCREEN)return e.prototype.setRemoteVideoPlayer.call(this,t,r)},t.prototype.destroy=function(){this.singleStreamRenderMode=!1,e.prototype.destroy.call(this)},t.prototype._updateVideoPlayerState=function(t){var r,i;if(!this.singleStreamRenderMode)return e.prototype._updateVideoPlayerState.call(this,t);var n,o=t.userId,a=null===(r=this._room)||void 0===r?void 0:r.remoteStreams.get(o);Array.isArray(a)&&a.forEach((function(e){e.isScreen&&(n=e)}));var s=this._remoteVideoPlayer.get(o);s&&(t.isScreen||!(null==n?void 0:n.videoTrack)?t.videoTrack?s&&(null===(i=this._config)||void 0===i?void 0:i.autoPlayPolicy)!==$f.PLAY_MANUALLY&&s.playVideo(t.videoTrack,t):(null==s?void 0:s.played)&&(null==s||s.stop()):gq.print("_updateVideoPlayerState","prevent play main stream"))},t.prototype._handleEvent=function(){var e=this;this.on(h_.onUserPublishScreen,(function(t){e.singleStreamRenderMode&&tx(t.mediaType)&&e.subscribeScreen(t.userId,Ff.VIDEO)})),this.on(h_.onUserUnpublishScreen,(function(t){if(e.singleStreamRenderMode&&tx(t.mediaType)){var r=e._remoteVideoPlayer.get(t.userId),i=e._room.remoteStreams.get(t.userId),n=null==i?void 0:i.find((function(e){return!e.isScreen}));if(!(null==n?void 0:n.videoTrack)||!r)return;r.playVideo(n.videoTrack)}}))},t_([_j()],t.prototype,"subscribeStream",null),t_([_j()],t.prototype,"unsubscribeStream",null),t_([_j()],t.prototype,"setRemoteScreenVideoStreamIndex",null),t_([_j()],t.prototype,"setRemoteVideoPlayer",null),t_([_j()],t.prototype,"destroy",null),t}(vq),Eq=new rj("VERTC",0);[lj,hj,pj].forEach((function(e){return e.setStats({rtc_sdk_version:YF.VERSION,product_line:aB.RTC,report_version:sB.W_5,os:cB.WEB,device_id:zF.getDeviceId(),user_agent:DU()?"":null===navigator||void 0===navigator?void 0:navigator.userAgent})}));var bq=function(e,t){if(location.search.includes("__rtc_debug_2__"))for(var r in e="5a7451222679214f668e7085",JF("ICE_CONFIG_REQUEST_URLS",["rtc-test.bytedance.com","rtc-access-test-hl.bytedance.com"]),localStorage)r.indexOf("RTC_ACCESS")>-1&&localStorage.removeItem(r);return Eq.print("createEngine","Invoke VERTC.createEngine"),cG(e,"appId"),[lj,hj,pj].forEach((function(r){return r.setStats({rtc_app_id:e,auto_play_policy:null==t?void 0:t.autoPlayPolicy})})),cj.sdkInitEngine(Date.now(),VB.BEGIN),new Sq(e,t)},Iq=function(e){if(Eq.print("destroyEngine","Invoke VERTC.destroyEngine"),!(e instanceof Sq))throw new oG(Zj.INVALID_ENGINE,"Invalid engine object");e.destroy(),cj.sdkInitEngine(Date.now(),VB.END)},Tq=function(){return r_(void 0,void 0,void 0,(function(){return i_(this,(function(e){return[2,Nz.enumerateDevices()]}))}))},Aq=function(e){return void 0===e&&(e={video:!0,audio:!0}),r_(void 0,void 0,void 0,(function(){var t,r,i,n;return i_(this,(function(o){switch(o.label){case 0:if(t=e.video,r=e.audio,i={video:!1,audio:!1},!t)return[3,4];o.label=1;case 1:return o.trys.push([1,3,,4]),[4,Nz.getPermissions({video:!0,force:!0})];case 2:return n=o.sent(),i.video=n.video,[3,4];case 3:return o.sent(),[3,4];case 4:if(!r)return[3,8];o.label=5;case 5:return o.trys.push([5,7,,8]),[4,Nz.getPermissions({audio:!0,force:!0})];case 6:return n=o.sent(),i.audio=n.audio,[3,8];case 7:return o.sent(),[3,8];case 8:return[2,i]}}))}))},Rq=function(){return r_(void 0,void 0,void 0,(function(){return i_(this,(function(e){return[2,Nz.enumerateAudioCaptureDevices()]}))}))},Cq=function(){return r_(void 0,void 0,void 0,(function(){return i_(this,(function(e){return[2,Nz.enumerateVideoCaptureDevices()]}))}))},Oq=function(){return r_(void 0,void 0,void 0,(function(){return i_(this,(function(e){return[2,Nz.enumerateAudioPlaybackDevices()]}))}))},wq=function(){return YF.VERSION},kq=function(){return cj.rtcSdkApiCall("isSupported",0,""),r_(void 0,void 0,void 0,(function(){var e;return i_(this,(function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),!DU()&&window.RTCPeerConnection&&window.RTCPeerConnection.prototype.addTransceiver&&window.RTCPeerConnection.prototype.createDataChannel?[4,yH()]:[2,!1];case 1:return[2,(null==(e=t.sent())?void 0:e.includes("H264"))||(null==e?void 0:e.includes("vp8"))];case 2:return t.sent(),[2,!1];case 3:return[2]}}))}))},Nq=function(){return cj.rtcSdkApiCall("getSupportedCodecs",0,""),r_(void 0,void 0,void 0,(function(){return i_(this,(function(e){switch(e.label){case 0:return[4,yH()];case 1:return[2,e.sent().map((function(e){return e.toUpperCase()}))]}}))}))};!DU()&&location.search.includes("_rtc_autotest_");var Pq=new function(){this.getSdkVersion=wq,this.createEngine=bq,this.destroyEngine=Iq,this.enumerateDevices=Tq,this.enableDevices=Aq,this.enumerateAudioCaptureDevices=Rq,this.enumerateVideoCaptureDevices=Cq,this.enumerateAudioPlaybackDevices=Oq,this.getParameter=QF,this.setParameter=JF,this.isSupported=kq,this.getSupportedCodecs=Nq,this.events=h_,this.ErrorCode=Zj,this.platform="BytePlus",this._monitor=cj};return e_(e_(e_(e_({},Pq),l_),f_),{events:h_})}));