@byteplus/rtc 4.45.1 → 4.46.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.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.1
4
+ * version: 4.46.0
5
5
  */
6
- !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).BytePlusRTC=t()}(this,(function(){"use strict";function e(e,t){return t.forEach((function(t){t&&"string"!=typeof t&&!Array.isArray(t)&&Object.keys(t).forEach((function(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:{},r=function(e){return e&&e.Math==Math&&e},n=r("object"==typeof globalThis&&globalThis)||r("object"==typeof window&&window)||r("object"==typeof self&&self)||r("object"==typeof i&&i)||function(){return this}()||Function("return this")(),o={},a=function(e){try{return!!e()}catch(e){return!0}},s=!a((function(){return 7!=Object.defineProperty({},1,{get:function(){return 7}})[1]})),c=!a((function(){var e=function(){}.bind();return"function"!=typeof e||e.hasOwnProperty("prototype")})),u=c,d=Function.prototype.call,l=u?d.bind(d):function(){return d.apply(d,arguments)},h={},p={}.propertyIsEnumerable,_=Object.getOwnPropertyDescriptor,f=_&&!p.call({1:2},1);h.f=f?function(e){var t=_(this,e);return!!t&&t.enumerable}:p;var v,m,S=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}},y=c,g=Function.prototype,E=g.bind,b=g.call,T=y&&E.bind(b,b),I=y?function(e){return e&&T(e)}:function(e){return e&&function(){return b.apply(e,arguments)}},R=I,A=R({}.toString),C=R("".slice),O=function(e){return C(A(e),8,-1)},w=I,N=a,P=O,D=n.Object,k=w("".split),M=N((function(){return!D("z").propertyIsEnumerable(0)}))?function(e){return"String"==P(e)?k(e,""):D(e)}:D,U=n.TypeError,L=function(e){if(null==e)throw U("Can't call method on "+e);return e},x=M,V=L,F=function(e){return x(V(e))},B=function(e){return"function"==typeof e},j=B,G=function(e){return"object"==typeof e?null!==e:j(e)},H=n,z=B,K=function(e){return z(e)?e:void 0},W=function(e,t){return arguments.length<2?K(H[e]):H[e]&&H[e][t]},X=I({}.isPrototypeOf),Y=W("navigator","userAgent")||"",q=n,J=Y,Q=q.process,Z=q.Deno,$=Q&&Q.versions||Z&&Z.version,ee=$&&$.v8;ee&&(m=(v=ee.split("."))[0]>0&&v[0]<4?1:+(v[0]+v[1])),!m&&J&&(!(v=J.match(/Edge\/(\d+)/))||v[1]>=74)&&(v=J.match(/Chrome\/(\d+)/))&&(m=+v[1]);var te=m,ie=te,re=a,ne=!!Object.getOwnPropertySymbols&&!re((function(){var e=Symbol();return!String(e)||!(Object(e)instanceof Symbol)||!Symbol.sham&&ie&&ie<41})),oe=ne&&!Symbol.sham&&"symbol"==typeof Symbol.iterator,ae=W,se=B,ce=X,ue=oe,de=n.Object,le=ue?function(e){return"symbol"==typeof e}:function(e){var t=ae("Symbol");return se(t)&&ce(t.prototype,de(e))},he=n.String,pe=function(e){try{return he(e)}catch(e){return"Object"}},_e=B,fe=pe,ve=n.TypeError,me=function(e){if(_e(e))return e;throw ve(fe(e)+" is not a function")},Se=me,ye=function(e,t){var i=e[t];return null==i?void 0:Se(i)},ge=l,Ee=B,be=G,Te=n.TypeError,Ie={exports:{}},Re=n,Ae=Object.defineProperty,Ce=function(e,t){try{Ae(Re,e,{value:t,configurable:!0,writable:!0})}catch(i){Re[e]=t}return t},Oe=Ce,we="__core-js_shared__",Ne=n[we]||Oe(we,{}),Pe=Ne;(Ie.exports=function(e,t){return Pe[e]||(Pe[e]=void 0!==t?t:{})})("versions",[]).push({version:"3.21.0",mode:"global",copyright:"© 2014-2022 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.21.0/LICENSE",source:"https://github.com/zloirock/core-js"});var De=L,ke=n.Object,Me=function(e){return ke(De(e))},Ue=Me,Le=I({}.hasOwnProperty),xe=Object.hasOwn||function(e,t){return Le(Ue(e),t)},Ve=I,Fe=0,Be=Math.random(),je=Ve(1..toString),Ge=function(e){return"Symbol("+(void 0===e?"":e)+")_"+je(++Fe+Be,36)},He=n,ze=Ie.exports,Ke=xe,We=Ge,Xe=ne,Ye=oe,qe=ze("wks"),Je=He.Symbol,Qe=Je&&Je.for,Ze=Ye?Je:Je&&Je.withoutSetter||We,$e=function(e){if(!Ke(qe,e)||!Xe&&"string"!=typeof qe[e]){var t="Symbol."+e;Xe&&Ke(Je,e)?qe[e]=Je[e]:qe[e]=Ye&&Qe?Qe(t):Ze(t)}return qe[e]},et=l,tt=G,it=le,rt=ye,nt=function(e,t){var i,r;if("string"===t&&Ee(i=e.toString)&&!be(r=ge(i,e)))return r;if(Ee(i=e.valueOf)&&!be(r=ge(i,e)))return r;if("string"!==t&&Ee(i=e.toString)&&!be(r=ge(i,e)))return r;throw Te("Can't convert object to primitive value")},ot=$e,at=n.TypeError,st=ot("toPrimitive"),ct=function(e,t){if(!tt(e)||it(e))return e;var i,r=rt(e,st);if(r){if(void 0===t&&(t="default"),i=et(r,e,t),!tt(i)||it(i))return i;throw at("Can't convert object to primitive value")}return void 0===t&&(t="number"),nt(e,t)},ut=ct,dt=le,lt=function(e){var t=ut(e,"string");return dt(t)?t:t+""},ht=G,pt=n.document,_t=ht(pt)&&ht(pt.createElement),ft=function(e){return _t?pt.createElement(e):{}},vt=ft,mt=!s&&!a((function(){return 7!=Object.defineProperty(vt("div"),"a",{get:function(){return 7}}).a})),St=s,yt=l,gt=h,Et=S,bt=F,Tt=lt,It=xe,Rt=mt,At=Object.getOwnPropertyDescriptor;o.f=St?At:function(e,t){if(e=bt(e),t=Tt(t),Rt)try{return At(e,t)}catch(e){}if(It(e,t))return Et(!yt(gt.f,e,t),e[t])};var Ct={},Ot=s&&a((function(){return 42!=Object.defineProperty((function(){}),"prototype",{value:42,writable:!1}).prototype})),wt=n,Nt=G,Pt=wt.String,Dt=wt.TypeError,kt=function(e){if(Nt(e))return e;throw Dt(Pt(e)+" is not an object")},Mt=s,Ut=mt,Lt=Ot,xt=kt,Vt=lt,Ft=n.TypeError,Bt=Object.defineProperty,jt=Object.getOwnPropertyDescriptor,Gt="enumerable",Ht="configurable",zt="writable";Ct.f=Mt?Lt?function(e,t,i){if(xt(e),t=Vt(t),xt(i),"function"==typeof e&&"prototype"===t&&"value"in i&&zt in i&&!i.writable){var r=jt(e,t);r&&r.writable&&(e[t]=i.value,i={configurable:Ht in i?i.configurable:r.configurable,enumerable:Gt in i?i.enumerable:r.enumerable,writable:!1})}return Bt(e,t,i)}:Bt:function(e,t,i){if(xt(e),t=Vt(t),xt(i),Ut)try{return Bt(e,t,i)}catch(e){}if("get"in i||"set"in i)throw Ft("Accessors not supported");return"value"in i&&(e[t]=i.value),e};var Kt=Ct,Wt=S,Xt=s?function(e,t,i){return Kt.f(e,t,Wt(1,i))}:function(e,t,i){return e[t]=i,e},Yt={exports:{}},qt=B,Jt=Ne,Qt=I(Function.toString);qt(Jt.inspectSource)||(Jt.inspectSource=function(e){return Qt(e)});var Zt,$t,ei,ti=Jt.inspectSource,ii=B,ri=ti,ni=n.WeakMap,oi=ii(ni)&&/native code/.test(ri(ni)),ai=Ie.exports,si=Ge,ci=ai("keys"),ui=function(e){return ci[e]||(ci[e]=si(e))},di={},li=oi,hi=n,pi=I,_i=G,fi=Xt,vi=xe,mi=Ne,Si=ui,yi=di,gi="Object already initialized",Ei=hi.TypeError,bi=hi.WeakMap;if(li||mi.state){var Ti=mi.state||(mi.state=new bi),Ii=pi(Ti.get),Ri=pi(Ti.has),Ai=pi(Ti.set);Zt=function(e,t){if(Ri(Ti,e))throw new Ei(gi);return t.facade=e,Ai(Ti,e,t),t},$t=function(e){return Ii(Ti,e)||{}},ei=function(e){return Ri(Ti,e)}}else{var Ci=Si("state");yi[Ci]=!0,Zt=function(e,t){if(vi(e,Ci))throw new Ei(gi);return t.facade=e,fi(e,Ci,t),t},$t=function(e){return vi(e,Ci)?e[Ci]:{}},ei=function(e){return vi(e,Ci)}}var Oi={set:Zt,get:$t,has:ei,enforce:function(e){return ei(e)?$t(e):Zt(e,{})},getterFor:function(e){return function(t){var i;if(!_i(t)||(i=$t(t)).type!==e)throw Ei("Incompatible receiver, "+e+" required");return i}}},wi=s,Ni=xe,Pi=Function.prototype,Di=wi&&Object.getOwnPropertyDescriptor,ki=Ni(Pi,"name"),Mi={EXISTS:ki,PROPER:ki&&"something"===function(){}.name,CONFIGURABLE:ki&&(!wi||wi&&Di(Pi,"name").configurable)},Ui=n,Li=B,xi=xe,Vi=Xt,Fi=Ce,Bi=ti,ji=Mi.CONFIGURABLE,Gi=Oi.get,Hi=Oi.enforce,zi=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;Li(i)&&("Symbol("===String(c).slice(0,7)&&(c="["+String(c).replace(/^Symbol\(([^)]*)\)/,"$1")+"]"),(!xi(i,"name")||ji&&i.name!==c)&&Vi(i,"name",c),(n=Hi(i)).source||(n.source=zi.join("string"==typeof c?c:""))),e!==Ui?(o?!s&&e[t]&&(a=!0):delete e[t],a?e[t]=i:Vi(e,t,i)):a?e[t]=i:Fi(t,i)})(Function.prototype,"toString",(function(){return Li(this)&&Gi(this).source||Bi(this)}));var Ki={},Wi=Math.ceil,Xi=Math.floor,Yi=function(e){var t=+e;return t!=t||0===t?0:(t>0?Xi:Wi)(t)},qi=Yi,Ji=Math.max,Qi=Math.min,Zi=function(e,t){var i=qi(e);return i<0?Ji(i+t,0):Qi(i,t)},$i=Yi,er=Math.min,tr=function(e){return e>0?er($i(e),9007199254740991):0},ir=tr,rr=function(e){return ir(e.length)},nr=F,or=Zi,ar=rr,sr=function(e){return function(t,i,r){var n,o=nr(t),a=ar(o),s=or(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}},cr={includes:sr(!0),indexOf:sr(!1)},ur=xe,dr=F,lr=cr.indexOf,hr=di,pr=I([].push),_r=function(e,t){var i,r=dr(e),n=0,o=[];for(i in r)!ur(hr,i)&&ur(r,i)&&pr(o,i);for(;t.length>n;)ur(r,i=t[n++])&&(~lr(o,i)||pr(o,i));return o},fr=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],vr=_r,mr=fr.concat("length","prototype");Ki.f=Object.getOwnPropertyNames||function(e){return vr(e,mr)};var Sr={};Sr.f=Object.getOwnPropertySymbols;var yr=W,gr=Ki,Er=Sr,br=kt,Tr=I([].concat),Ir=yr("Reflect","ownKeys")||function(e){var t=gr.f(br(e)),i=Er.f;return i?Tr(t,i(e)):t},Rr=xe,Ar=Ir,Cr=o,Or=Ct,wr=function(e,t,i){for(var r=Ar(t),n=Or.f,o=Cr.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=a,Pr=B,Dr=/#|\.prototype\./,kr=function(e,t){var i=Ur[Mr(e)];return i==xr||i!=Lr&&(Pr(t)?Nr(t):!!t)},Mr=kr.normalize=function(e){return String(e).replace(Dr,".").toLowerCase()},Ur=kr.data={},Lr=kr.NATIVE="N",xr=kr.POLYFILL="P",Vr=kr,Fr=n,Br=o.f,jr=Xt,Gr=Yt.exports,Hr=Ce,zr=wr,Kr=Vr,Wr=function(e,t){var i,r,n,o,a,s=e.target,c=e.global,u=e.stat;if(i=c?Fr:u?Fr[s]||Hr(s,{}):(Fr[s]||{}).prototype)for(r in t){if(o=t[r],n=e.noTargetGet?(a=Br(i,r))&&a.value:i[r],!Kr(c?r:s+(u?".":"#")+r,e.forced)&&void 0!==n){if(typeof o==typeof n)continue;zr(o,n)}(e.sham||n&&n.sham)&&jr(o,"sham",!0),Gr(i,r,o,e)}},Xr=n,Yr=B,qr=Xr.String,Jr=Xr.TypeError,Qr=I,Zr=kt,$r=function(e){if("object"==typeof e||Yr(e))return e;throw Jr("Can't set "+qr(e)+" as a prototype")},en=Object.setPrototypeOf||("__proto__"in{}?function(){var e,t=!1,i={};try{(e=Qr(Object.getOwnPropertyDescriptor(Object.prototype,"__proto__").set))(i,[]),t=i instanceof Array}catch(e){}return function(i,r){return Zr(i),$r(r),t?e(i,r):i.__proto__=r,i}}():void 0);Wr({target:"Object",stat:!0},{setPrototypeOf:en});var tn={},rn=_r,nn=fr,on=Object.keys||function(e){return rn(e,nn)},an=s,sn=Ot,cn=Ct,un=kt,dn=F,ln=on;tn.f=an&&!sn?Object.defineProperties:function(e,t){un(e);for(var i,r=dn(t),n=ln(t),o=n.length,a=0;o>a;)cn.f(e,i=n[a++],r[i]);return e};var hn,pn=W("document","documentElement"),_n=kt,fn=tn,vn=fr,mn=di,Sn=pn,yn=ft,gn=ui("IE_PROTO"),En=function(){},bn=function(e){return"<script>"+e+"</"+"script>"},Tn=function(e){e.write(bn("")),e.close();var t=e.parentWindow.Object;return e=null,t},In=function(){try{hn=new ActiveXObject("htmlfile")}catch(e){}var e,t;In="undefined"!=typeof document?document.domain&&hn?Tn(hn):((t=yn("iframe")).style.display="none",Sn.appendChild(t),t.src=String("javascript:"),(e=t.contentWindow.document).open(),e.write(bn("document.F=Object")),e.close(),e.F):Tn(hn);for(var i=vn.length;i--;)delete In.prototype[vn[i]];return In()};mn[gn]=!0;var Rn=Object.create||function(e,t){var i;return null!==e?(En.prototype=_n(e),i=new En,En.prototype=null,i[gn]=e):i=In(),void 0===t?i:fn.f(i,t)};Wr({target:"Object",stat:!0,sham:!s},{create:Rn});var An=s,Cn=I,On=l,wn=a,Nn=on,Pn=Sr,Dn=h,kn=Me,Mn=M,Un=Object.assign,Ln=Object.defineProperty,xn=Cn([].concat),Vn=!Un||wn((function(){if(An&&1!==Un({b:1},Un(Ln({},"a",{enumerable:!0,get:function(){Ln(this,"b",{value:3,enumerable:!1})}}),{b:2})).b)return!0;var e={},t={},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=kn(e),r=arguments.length,n=1,o=Pn.f,a=Dn.f;r>n;)for(var s,c=Mn(arguments[n++]),u=o?xn(Nn(c),o(c)):Nn(c),d=u.length,l=0;d>l;)s=u[l++],An&&!On(a,c,s)||(i[s]=c[s]);return i}:Un,Fn=Vn;Wr({target:"Object",stat:!0,forced:Object.assign!==Fn},{assign:Fn});var Bn=a,jn=function(e,t){var i=[][e];return!!i&&Bn((function(){i.call(null,t||function(){throw 1},1)}))},Gn=Wr,Hn=cr.indexOf,zn=jn,Kn=I([].indexOf),Wn=!!Kn&&1/Kn([1],1,-0)<0,Xn=zn("indexOf");Gn({target:"Array",proto:!0,forced:Wn||!Xn},{indexOf:function(e){var t=arguments.length>1?arguments[1]:void 0;return Wn?Kn(this,e,t)||0:Hn(this,e,t)}});var Yn=c,qn=Function.prototype,Jn=qn.apply,Qn=qn.call,Zn="object"==typeof Reflect&&Reflect.apply||(Yn?Qn.bind(Jn):function(){return Qn.apply(Jn,arguments)}),$n=O,eo=Array.isArray||function(e){return"Array"==$n(e)},to={};to[$e("toStringTag")]="z";var io="[object z]"===String(to),ro=n,no=io,oo=B,ao=O,so=$e("toStringTag"),co=ro.Object,uo="Arguments"==ao(function(){return arguments}()),lo=no?ao: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=co(e),so))?i:uo?ao(t):"Object"==(r=ao(t))&&oo(t.callee)?"Arguments":r},ho=lo,po=n.String,_o=function(e){if("Symbol"===ho(e))throw TypeError("Cannot convert a Symbol value to a string");return po(e)},fo={},vo=lt,mo=Ct,So=S,yo=function(e,t,i){var r=vo(t);r in e?mo.f(e,r,So(0,i)):e[r]=i},go=Zi,Eo=rr,bo=yo,To=n.Array,Io=Math.max,Ro=function(e,t,i){for(var r=Eo(e),n=go(t,r),o=go(void 0===i?r:i,r),a=To(Io(o-n,0)),s=0;n<o;n++,s++)bo(a,s,e[n]);return a.length=s,a},Ao=O,Co=F,Oo=Ki.f,wo=Ro,No="object"==typeof window&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[];fo.f=function(e){return No&&"Window"==Ao(e)?function(e){try{return Oo(e)}catch(e){return wo(No)}}(e):Oo(Co(e))};var Po=I([].slice),Do={},ko=$e;Do.f=ko;var Mo=n,Uo=xe,Lo=Do,xo=Ct.f,Vo=function(e){var t=Mo.Symbol||(Mo.Symbol={});Uo(t,e)||xo(t,e,{value:Lo.f(e)})},Fo=Ct.f,Bo=xe,jo=$e("toStringTag"),Go=function(e,t,i){e&&!i&&(e=e.prototype),e&&!Bo(e,jo)&&Fo(e,jo,{configurable:!0,value:t})},Ho=me,zo=c,Ko=I(I.bind),Wo=function(e,t){return Ho(e),void 0===t?e:zo?Ko(e,t):function(){return e.apply(t,arguments)}},Xo=I,Yo=a,qo=B,Jo=lo,Qo=ti,Zo=function(){},$o=[],ea=W("Reflect","construct"),ta=/^\s*(?:class|function)\b/,ia=Xo(ta.exec),ra=!ta.exec(Zo),na=function(e){if(!qo(e))return!1;try{return ea(Zo,$o,e),!0}catch(e){return!1}},oa=function(e){if(!qo(e))return!1;switch(Jo(e)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return ra||!!ia(ta,Qo(e))}catch(e){return!0}};oa.sham=!0;var aa=!ea||Yo((function(){var e;return na(na.call)||!na(Object)||!na((function(){e=!0}))||e}))?oa:na,sa=n,ca=eo,ua=aa,da=G,la=$e("species"),ha=sa.Array,pa=function(e){var t;return ca(e)&&(t=e.constructor,(ua(t)&&(t===ha||ca(t.prototype))||da(t)&&null===(t=t[la]))&&(t=void 0)),void 0===t?ha:t},_a=function(e,t){return new(pa(e))(0===t?0:t)},fa=Wo,va=M,ma=Me,Sa=rr,ya=_a,ga=I([].push),Ea=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,_=ma(c),f=va(_),v=fa(u,d),m=Sa(f),S=0,y=l||ya,g=t?y(c,m):i||a?y(c,0):void 0;m>S;S++)if((s||S in f)&&(p=v(h=f[S],S,_),e))if(t)g[S]=p;else if(p)switch(e){case 3:return!0;case 5:return h;case 6:return S;case 2:ga(g,h)}else switch(e){case 4:return!1;case 7:ga(g,h)}return o?-1:r||n?n:g}},ba={forEach:Ea(0),map:Ea(1),filter:Ea(2),some:Ea(3),every:Ea(4),find:Ea(5),findIndex:Ea(6),filterReject:Ea(7)},Ta=Wr,Ia=n,Ra=W,Aa=Zn,Ca=l,Oa=I,wa=s,Na=ne,Pa=a,Da=xe,ka=eo,Ma=B,Ua=G,La=X,xa=le,Va=kt,Fa=Me,Ba=F,ja=lt,Ga=_o,Ha=S,za=Rn,Ka=on,Wa=Ki,Xa=fo,Ya=Sr,qa=o,Ja=Ct,Qa=tn,Za=h,$a=Po,es=Yt.exports,ts=Ie.exports,is=di,rs=Ge,ns=$e,os=Do,as=Vo,ss=Go,cs=Oi,us=ba.forEach,ds=ui("hidden"),ls="Symbol",hs=ns("toPrimitive"),ps=cs.set,_s=cs.getterFor(ls),fs=Object.prototype,vs=Ia.Symbol,ms=vs&&vs.prototype,Ss=Ia.TypeError,ys=Ia.QObject,gs=Ra("JSON","stringify"),Es=qa.f,bs=Ja.f,Ts=Xa.f,Is=Za.f,Rs=Oa([].push),As=ts("symbols"),Cs=ts("op-symbols"),Os=ts("string-to-symbol-registry"),ws=ts("symbol-to-string-registry"),Ns=ts("wks"),Ps=!ys||!ys.prototype||!ys.prototype.findChild,Ds=wa&&Pa((function(){return 7!=za(bs({},"a",{get:function(){return bs(this,"a",{value:7}).a}})).a}))?function(e,t,i){var r=Es(fs,t);r&&delete fs[t],bs(e,t,i),r&&e!==fs&&bs(fs,t,r)}:bs,ks=function(e,t){var i=As[e]=za(ms);return ps(i,{type:ls,tag:e,description:t}),wa||(i.description=t),i},Ms=function(e,t,i){e===fs&&Ms(Cs,t,i),Va(e);var r=ja(t);return Va(i),Da(As,r)?(i.enumerable?(Da(e,ds)&&e[ds][r]&&(e[ds][r]=!1),i=za(i,{enumerable:Ha(0,!1)})):(Da(e,ds)||bs(e,ds,Ha(1,{})),e[ds][r]=!0),Ds(e,r,i)):bs(e,r,i)},Us=function(e,t){Va(e);var i=Ba(t),r=Ka(i).concat(Fs(i));return us(r,(function(t){wa&&!Ca(Ls,i,t)||Ms(e,t,i[t])})),e},Ls=function(e){var t=ja(e),i=Ca(Is,this,t);return!(this===fs&&Da(As,t)&&!Da(Cs,t))&&(!(i||!Da(this,t)||!Da(As,t)||Da(this,ds)&&this[ds][t])||i)},xs=function(e,t){var i=Ba(e),r=ja(t);if(i!==fs||!Da(As,r)||Da(Cs,r)){var n=Es(i,r);return!n||!Da(As,r)||Da(i,ds)&&i[ds][r]||(n.enumerable=!0),n}},Vs=function(e){var t=Ts(Ba(e)),i=[];return us(t,(function(e){Da(As,e)||Da(is,e)||Rs(i,e)})),i},Fs=function(e){var t=e===fs,i=Ts(t?Cs:Ba(e)),r=[];return us(i,(function(e){!Da(As,e)||t&&!Da(fs,e)||Rs(r,As[e])})),r};(Na||(vs=function(){if(La(ms,this))throw Ss("Symbol is not a constructor");var e=arguments.length&&void 0!==arguments[0]?Ga(arguments[0]):void 0,t=rs(e),i=function(e){this===fs&&Ca(i,Cs,e),Da(this,ds)&&Da(this[ds],t)&&(this[ds][t]=!1),Ds(this,t,Ha(1,e))};return wa&&Ps&&Ds(fs,t,{configurable:!0,set:i}),ks(t,e)},es(ms=vs.prototype,"toString",(function(){return _s(this).tag})),es(vs,"withoutSetter",(function(e){return ks(rs(e),e)})),Za.f=Ls,Ja.f=Ms,Qa.f=Us,qa.f=xs,Wa.f=Xa.f=Vs,Ya.f=Fs,os.f=function(e){return ks(ns(e),e)},wa&&(bs(ms,"description",{configurable:!0,get:function(){return _s(this).description}}),es(fs,"propertyIsEnumerable",Ls,{unsafe:!0}))),Ta({global:!0,wrap:!0,forced:!Na,sham:!Na},{Symbol:vs}),us(Ka(Ns),(function(e){as(e)})),Ta({target:ls,stat:!0,forced:!Na},{for:function(e){var t=Ga(e);if(Da(Os,t))return Os[t];var i=vs(t);return Os[t]=i,ws[i]=t,i},keyFor:function(e){if(!xa(e))throw Ss(e+" is not a symbol");if(Da(ws,e))return ws[e]},useSetter:function(){Ps=!0},useSimple:function(){Ps=!1}}),Ta({target:"Object",stat:!0,forced:!Na,sham:!wa},{create:function(e,t){return void 0===t?za(e):Us(za(e),t)},defineProperty:Ms,defineProperties:Us,getOwnPropertyDescriptor:xs}),Ta({target:"Object",stat:!0,forced:!Na},{getOwnPropertyNames:Vs,getOwnPropertySymbols:Fs}),Ta({target:"Object",stat:!0,forced:Pa((function(){Ya.f(1)}))},{getOwnPropertySymbols:function(e){return Ya.f(Fa(e))}}),gs)&&Ta({target:"JSON",stat:!0,forced:!Na||Pa((function(){var e=vs();return"[null]"!=gs([e])||"{}"!=gs({a:e})||"{}"!=gs(Object(e))}))},{stringify:function(e,t,i){var r=$a(arguments),n=t;if((Ua(t)||void 0!==e)&&!xa(e))return ka(t)||(t=function(e,t){if(Ma(n)&&(t=Ca(n,this,e,t)),!xa(t))return t}),r[1]=t,Aa(gs,null,r)}});if(!ms[hs]){var Bs=ms.valueOf;es(ms,hs,(function(e){return Ca(Bs,this)}))}ss(vs,ls),is[ds]=!0;var js=Wr,Gs=a,Hs=F,zs=o.f,Ks=s,Ws=Gs((function(){zs(1)}));js({target:"Object",stat:!0,forced:!Ks||Ws,sham:!Ks},{getOwnPropertyDescriptor:function(e,t){return zs(Hs(e),t)}});var Xs=lo,Ys=io?{}.toString:function(){return"[object "+Xs(this)+"]"},qs=io,Js=Yt.exports,Qs=Ys;qs||Js(Object.prototype,"toString",Qs,{unsafe:!0});var Zs=Wr,$s=s,ec=Ct.f;Zs({target:"Object",stat:!0,forced:Object.defineProperty!==ec,sham:!$s},{defineProperty:ec});var tc=n.Promise,ic=Yt.exports,rc=function(e,t,i){for(var r in t)ic(e,r,t[r],i);return e},nc=W,oc=Ct,ac=s,sc=$e("species"),cc=function(e){var t=nc(e),i=oc.f;ac&&t&&!t[sc]&&i(t,sc,{configurable:!0,get:function(){return this}})},uc=X,dc=n.TypeError,lc=function(e,t){if(uc(t,e))return e;throw dc("Incorrect invocation")},hc={},pc=hc,_c=$e("iterator"),fc=Array.prototype,vc=function(e){return void 0!==e&&(pc.Array===e||fc[_c]===e)},mc=lo,Sc=ye,yc=hc,gc=$e("iterator"),Ec=function(e){if(null!=e)return Sc(e,gc)||Sc(e,"@@iterator")||yc[mc(e)]},bc=l,Tc=me,Ic=kt,Rc=pe,Ac=Ec,Cc=n.TypeError,Oc=function(e,t){var i=arguments.length<2?Ac(e):t;if(Tc(i))return Ic(bc(i,e));throw Cc(Rc(e)+" is not iterable")},wc=l,Nc=kt,Pc=ye,Dc=function(e,t,i){var r,n;Nc(e);try{if(!(r=Pc(e,"return"))){if("throw"===t)throw i;return i}r=wc(r,e)}catch(e){n=!0,r=e}if("throw"===t)throw i;if(n)throw r;return Nc(r),i},kc=Wo,Mc=l,Uc=kt,Lc=pe,xc=vc,Vc=rr,Fc=X,Bc=Oc,jc=Ec,Gc=Dc,Hc=n.TypeError,zc=function(e,t){this.stopped=e,this.result=t},Kc=zc.prototype,Wc=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),_=kc(t,d),f=function(e){return r&&Gc(r,"normal",e),new zc(!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=jc(e)))throw Hc(Lc(e)+" is not iterable");if(xc(n)){for(o=0,a=Vc(e);a>o;o++)if((s=v(e[o]))&&Fc(Kc,s))return s;return new zc(!1)}r=Bc(e,n)}for(c=r.next;!(u=Mc(c,r)).done;){try{s=v(u.value)}catch(e){Gc(r,"throw",e)}if("object"==typeof s&&s&&Fc(Kc,s))return s}return new zc(!1)},Xc=$e("iterator"),Yc=!1;try{var qc=0,Jc={next:function(){return{done:!!qc++}},return:function(){Yc=!0}};Jc[Xc]=function(){return this},Array.from(Jc,(function(){throw 2}))}catch(e){}var Qc,Zc,$c,eu,tu=function(e,t){if(!t&&!Yc)return!1;var i=!1;try{var r={};r[Xc]=function(){return{next:function(){return{done:i=!0}}}},e(r)}catch(e){}return i},iu=aa,ru=pe,nu=n.TypeError,ou=function(e){if(iu(e))return e;throw nu(ru(e)+" is not a constructor")},au=kt,su=ou,cu=$e("species"),uu=function(e,t){var i,r=au(e).constructor;return void 0===r||null==(i=au(r)[cu])?t:su(i)},du=n.TypeError,lu=function(e,t){if(e<t)throw du("Not enough arguments");return e},hu=/(?:ipad|iphone|ipod).*applewebkit/i.test(Y),pu="process"==O(n.process),_u=n,fu=Zn,vu=Wo,mu=B,Su=xe,yu=a,gu=pn,Eu=Po,bu=ft,Tu=lu,Iu=hu,Ru=pu,Au=_u.setImmediate,Cu=_u.clearImmediate,Ou=_u.process,wu=_u.Dispatch,Nu=_u.Function,Pu=_u.MessageChannel,Du=_u.String,ku=0,Mu={},Uu="onreadystatechange";try{Qc=_u.location}catch(e){}var Lu=function(e){if(Su(Mu,e)){var t=Mu[e];delete Mu[e],t()}},xu=function(e){return function(){Lu(e)}},Vu=function(e){Lu(e.data)},Fu=function(e){_u.postMessage(Du(e),Qc.protocol+"//"+Qc.host)};Au&&Cu||(Au=function(e){Tu(arguments.length,1);var t=mu(e)?e:Nu(e),i=Eu(arguments,1);return Mu[++ku]=function(){fu(t,void 0,i)},Zc(ku),ku},Cu=function(e){delete Mu[e]},Ru?Zc=function(e){Ou.nextTick(xu(e))}:wu&&wu.now?Zc=function(e){wu.now(xu(e))}:Pu&&!Iu?(eu=($c=new Pu).port2,$c.port1.onmessage=Vu,Zc=vu(eu.postMessage,eu)):_u.addEventListener&&mu(_u.postMessage)&&!_u.importScripts&&Qc&&"file:"!==Qc.protocol&&!yu(Fu)?(Zc=Fu,_u.addEventListener("message",Vu,!1)):Zc=Uu in bu("script")?function(e){gu.appendChild(bu("script")).onreadystatechange=function(){gu.removeChild(this),Lu(e)}}:function(e){setTimeout(xu(e),0)});var Bu,ju,Gu,Hu,zu,Ku,Wu,Xu,Yu={set:Au,clear:Cu},qu=n,Ju=/ipad|iphone|ipod/i.test(Y)&&void 0!==qu.Pebble,Qu=/web0s(?!.*chrome)/i.test(Y),Zu=n,$u=Wo,ed=o.f,td=Yu.set,id=hu,rd=Ju,nd=Qu,od=pu,ad=Zu.MutationObserver||Zu.WebKitMutationObserver,sd=Zu.document,cd=Zu.process,ud=Zu.Promise,dd=ed(Zu,"queueMicrotask"),ld=dd&&dd.value;ld||(Bu=function(){var e,t;for(od&&(e=cd.domain)&&e.exit();ju;){t=ju.fn,ju=ju.next;try{t()}catch(e){throw ju?Hu():Gu=void 0,e}}Gu=void 0,e&&e.enter()},id||od||nd||!ad||!sd?!rd&&ud&&ud.resolve?((Wu=ud.resolve(void 0)).constructor=ud,Xu=$u(Wu.then,Wu),Hu=function(){Xu(Bu)}):od?Hu=function(){cd.nextTick(Bu)}:(td=$u(td,Zu),Hu=function(){td(Bu)}):(zu=!0,Ku=sd.createTextNode(""),new ad(Bu).observe(Ku,{characterData:!0}),Hu=function(){Ku.data=zu=!zu}));var hd=ld||function(e){var t={fn:e,next:void 0};Gu&&(Gu.next=t),ju||(ju=t,Hu()),Gu=t},pd={},_d=me,fd=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=_d(t),this.reject=_d(i)};pd.f=function(e){return new fd(e)};var vd=kt,md=G,Sd=pd,yd=function(e,t){if(vd(e),md(t)&&t.constructor===e)return t;var i=Sd.f(e);return(0,i.resolve)(t),i.promise},gd=n,Ed=function(){this.head=null,this.tail=null};Ed.prototype={add:function(e){var t={item:e,next:null};this.head?this.tail.next=t:this.head=t,this.tail=t},get:function(){var e=this.head;if(e)return this.head=e.next,this.tail===e&&(this.tail=null),e.item}};var bd,Td,Id,Rd,Ad=Ed,Cd="object"==typeof window,Od=Wr,wd=n,Nd=W,Pd=l,Dd=tc,kd=Yt.exports,Md=rc,Ud=en,Ld=Go,xd=cc,Vd=me,Fd=B,Bd=G,jd=lc,Gd=ti,Hd=Wc,zd=tu,Kd=uu,Wd=Yu.set,Xd=hd,Yd=yd,qd=function(e,t){var i=gd.console;i&&i.error&&(1==arguments.length?i.error(e):i.error(e,t))},Jd=pd,Qd=function(e){try{return{error:!1,value:e()}}catch(e){return{error:!0,value:e}}},Zd=Ad,$d=Oi,el=Vr,tl=Cd,il=pu,rl=te,nl=$e("species"),ol="Promise",al=$d.getterFor(ol),sl=$d.set,cl=$d.getterFor(ol),ul=Dd&&Dd.prototype,dl=Dd,ll=ul,hl=wd.TypeError,pl=wd.document,_l=wd.process,fl=Jd.f,vl=fl,ml=!!(pl&&pl.createEvent&&wd.dispatchEvent),Sl=Fd(wd.PromiseRejectionEvent),yl="unhandledrejection",gl=!1,El=el(ol,(function(){var e=Gd(dl),t=e!==String(dl);if(!t&&66===rl)return!0;if(rl>=51&&/native code/.test(e))return!1;var i=new dl((function(e){e(1)})),r=function(e){e((function(){}),(function(){}))};return(i.constructor={})[nl]=r,!(gl=i.then((function(){}))instanceof r)||!t&&tl&&!Sl})),bl=El||!zd((function(e){dl.all(e).catch((function(){}))})),Tl=function(e){var t;return!(!Bd(e)||!Fd(t=e.then))&&t},Il=function(e,t){var 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&&wl(t),t.rejection=1),!0===s?i=o:(d&&d.enter(),i=s(o),d&&(d.exit(),n=!0)),i===e.promise?u(hl("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,Xd((function(){for(var i,r=e.reactions;i=r.get();)Il(i,e);e.notified=!1,t&&!e.rejection&&Cl(e)})))},Al=function(e,t,i){var r,n;ml?((r=pl.createEvent("Event")).promise=t,r.reason=i,r.initEvent(e,!1,!0),wd.dispatchEvent(r)):r={promise:t,reason:i},!Sl&&(n=wd["on"+e])?n(r):e===yl&&qd("Unhandled promise rejection",i)},Cl=function(e){Pd(Wd,wd,(function(){var t,i=e.facade,r=e.value;if(Ol(e)&&(t=Qd((function(){il?_l.emit("unhandledRejection",r,i):Al(yl,i,r)})),e.rejection=il||Ol(e)?2:1,t.error))throw t.value}))},Ol=function(e){return 1!==e.rejection&&!e.parent},wl=function(e){Pd(Wd,wd,(function(){var t=e.facade;il?_l.emit("rejectionHandled",t):Al("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 hl("Promise can't be resolved itself");var r=Tl(t);r?Xd((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(El&&(ll=(dl=function(e){jd(this,ll),Vd(e),Pd(bd,this);var t=al(this);try{e(Nl(Dl,t),Nl(Pl,t))}catch(e){Pl(t,e)}}).prototype,(bd=function(e){sl(this,{type:ol,done:!1,notified:!1,parent:!1,reactions:new Zd,rejection:!1,state:0,value:void 0})}).prototype=Md(ll,{then:function(e,t){var i=cl(this),r=fl(Kd(this,dl));return i.parent=!0,r.ok=!Fd(e)||e,r.fail=Fd(t)&&t,r.domain=il?_l.domain:void 0,0==i.state?i.reactions.add(r):Xd((function(){Il(r,i)})),r.promise},catch:function(e){return this.then(void 0,e)}}),Td=function(){var e=new bd,t=al(e);this.promise=e,this.resolve=Nl(Dl,t),this.reject=Nl(Pl,t)},Jd.f=fl=function(e){return e===dl||e===Id?new Td(e):vl(e)},Fd(Dd)&&ul!==Object.prototype)){Rd=ul.then,gl||(kd(ul,"then",(function(e,t){var i=this;return new dl((function(e,t){Pd(Rd,i,e,t)})).then(e,t)}),{unsafe:!0}),kd(ul,"catch",ll.catch,{unsafe:!0}));try{delete ul.constructor}catch(e){}Ud&&Ud(ul,ll)}Od({global:!0,wrap:!0,forced:El},{Promise:dl}),Ld(dl,ol,!1),xd(ol),Id=Nd(ol),Od({target:ol,stat:!0,forced:El},{reject:function(e){var t=fl(this);return Pd(t.reject,void 0,e),t.promise}}),Od({target:ol,stat:!0,forced:El},{resolve:function(e){return Yd(this,e)}}),Od({target:ol,stat:!0,forced:bl},{all:function(e){var t=this,i=fl(t),r=i.resolve,n=i.reject,o=Qd((function(){var i=Vd(t.resolve),o=[],a=0,s=1;Hd(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=fl(t),r=i.reject,n=Qd((function(){var n=Vd(t.resolve);Hd(e,(function(e){Pd(n,t,e).then(i.resolve,r)}))}));return n.error&&r(n.value),i.promise}});var kl=Wr,Ml=s,Ul=n,Ll=I,xl=xe,Vl=B,Fl=X,Bl=_o,jl=Ct.f,Gl=wr,Hl=Ul.Symbol,zl=Hl&&Hl.prototype;if(Ml&&Vl(Hl)&&(!("description"in zl)||void 0!==Hl().description)){var Kl={},Wl=function(){var e=arguments.length<1||void 0===arguments[0]?void 0:Bl(arguments[0]),t=Fl(zl,this)?new Hl(e):void 0===e?Hl():Hl(e);return""===e&&(Kl[t]=!0),t};Gl(Wl,Hl),Wl.prototype=zl,zl.constructor=Wl;var Xl="Symbol(test)"==String(Hl("test")),Yl=Ll(zl.toString),ql=Ll(zl.valueOf),Jl=/^Symbol\((.*)\)[^)]+$/,Ql=Ll("".replace),Zl=Ll("".slice);jl(zl,"description",{configurable:!0,get:function(){var e=ql(this),t=Yl(e);if(xl(Kl,e))return"";var i=Xl?Zl(t,7,-1):Ql(t,Jl,"$1");return""===i?void 0:i}}),kl({global:!0,forced:!0},{Symbol:Wl})}Vo("iterator");var $l=Rn,eh=Ct,th=$e("unscopables"),ih=Array.prototype;null==ih[th]&&eh.f(ih,th,{configurable:!0,value:$l(null)});var rh,nh,oh,ah=function(e){ih[th][e]=!0},sh=!a((function(){function e(){}return e.prototype.constructor=null,Object.getPrototypeOf(new e)!==e.prototype})),ch=n,uh=xe,dh=B,lh=Me,hh=sh,ph=ui("IE_PROTO"),_h=ch.Object,fh=_h.prototype,vh=hh?_h.getPrototypeOf:function(e){var t=lh(e);if(uh(t,ph))return t[ph];var i=t.constructor;return dh(i)&&t instanceof i?i.prototype:t instanceof _h?fh:null},mh=a,Sh=B,yh=vh,gh=Yt.exports,Eh=$e("iterator"),bh=!1;[].keys&&("next"in(oh=[].keys())?(nh=yh(yh(oh)))!==Object.prototype&&(rh=nh):bh=!0);var Th=null==rh||mh((function(){var e={};return rh[Eh].call(e)!==e}));Th&&(rh={}),Sh(rh[Eh])||gh(rh,Eh,(function(){return this}));var Ih={IteratorPrototype:rh,BUGGY_SAFARI_ITERATORS:bh},Rh=Ih.IteratorPrototype,Ah=Rn,Ch=S,Oh=Go,wh=hc,Nh=function(){return this},Ph=function(e,t,i,r){var n=t+" Iterator";return e.prototype=Ah(Rh,{next:Ch(+!r,i)}),Oh(e,n,!1),wh[n]=Nh,e},Dh=Wr,kh=l,Mh=Mi,Uh=B,Lh=Ph,xh=vh,Vh=en,Fh=Go,Bh=Xt,jh=Yt.exports,Gh=hc,Hh=Mh.PROPER,zh=Mh.CONFIGURABLE,Kh=Ih.IteratorPrototype,Wh=Ih.BUGGY_SAFARI_ITERATORS,Xh=$e("iterator"),Yh="keys",qh="values",Jh="entries",Qh=function(){return this},Zh=function(e,t,i,r,n,o,a){Lh(i,t,r);var s,c,u,d=function(e){if(e===n&&f)return f;if(!Wh&&e in p)return p[e];switch(e){case Yh:case qh:case Jh:return function(){return new i(this,e)}}return function(){return new i(this)}},l=t+" Iterator",h=!1,p=e.prototype,_=p[Xh]||p["@@iterator"]||n&&p[n],f=!Wh&&_||d(n),v="Array"==t&&p.entries||_;if(v&&(s=xh(v.call(new e)))!==Object.prototype&&s.next&&(xh(s)!==Kh&&(Vh?Vh(s,Kh):Uh(s[Xh])||jh(s,Xh,Qh)),Fh(s,l,!0)),Hh&&n==qh&&_&&_.name!==qh&&(zh?Bh(p,"name",qh):(h=!0,f=function(){return kh(_,this)})),n)if(c={values:d(qh),keys:o?f:d(Yh),entries:d(Jh)},a)for(u in c)(Wh||h||!(u in p))&&jh(p,u,c[u]);else Dh({target:t,proto:!0,forced:Wh||h},c);return p[Xh]!==f&&jh(p,Xh,f,{name:n}),Gh[t]=f,c},$h=F,ep=ah,tp=hc,ip=Oi,rp=Ct.f,np=Zh,op=s,ap="Array Iterator",sp=ip.set,cp=ip.getterFor(ap),up=np(Array,"Array",(function(e,t){sp(this,{type:ap,target:$h(e),index:0,kind:t})}),(function(){var e=cp(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"),dp=tp.Arguments=tp.Array;if(ep("keys"),ep("values"),ep("entries"),op&&"values"!==dp.name)try{rp(dp,"name",{value:"values"})}catch(e){}var lp=I,hp=Yi,pp=_o,_p=L,fp=lp("".charAt),vp=lp("".charCodeAt),mp=lp("".slice),Sp=function(e){return function(t,i){var r,n,o=pp(_p(t)),a=hp(i),s=o.length;return a<0||a>=s?e?"":void 0:(r=vp(o,a))<55296||r>56319||a+1===s||(n=vp(o,a+1))<56320||n>57343?e?fp(o,a):r:e?mp(o,a,a+2):n-56320+(r-55296<<10)+65536}},yp={codeAt:Sp(!1),charAt:Sp(!0)},gp=yp.charAt,Ep=_o,bp=Oi,Tp=Zh,Ip="String Iterator",Rp=bp.set,Ap=bp.getterFor(Ip);Tp(String,"String",(function(e){Rp(this,{type:Ip,string:Ep(e),index:0})}),(function(){var e,t=Ap(this),i=t.string,r=t.index;return r>=i.length?{value:void 0,done:!0}:(e=gp(i,r),t.index+=e.length,{value:e,done:!1})}));var Cp={CSSRuleList:0,CSSStyleDeclaration:0,CSSValueList:0,ClientRectList:0,DOMRectList:0,DOMStringList:0,DOMTokenList:1,DataTransferItemList:0,FileList:0,HTMLAllCollection:0,HTMLCollection:0,HTMLFormElement:0,HTMLSelectElement:0,MediaList:0,MimeTypeArray:0,NamedNodeMap:0,NodeList:1,PaintRequestList:0,Plugin:0,PluginArray:0,SVGLengthList:0,SVGNumberList:0,SVGPathSegList:0,SVGPointList:0,SVGStringList:0,SVGTransformList:0,SourceBufferList:0,StyleSheetList:0,TextTrackCueList:0,TextTrackList:0,TouchList:0},Op=ft("span").classList,wp=Op&&Op.constructor&&Op.constructor.prototype,Np=wp===Object.prototype?void 0:wp,Pp=n,Dp=Cp,kp=Np,Mp=up,Up=Xt,Lp=$e,xp=Lp("iterator"),Vp=Lp("toStringTag"),Fp=Mp.values,Bp=function(e,t){if(e){if(e[xp]!==Fp)try{Up(e,xp,Fp)}catch(t){e[xp]=Fp}if(e[Vp]||Up(e,Vp,t),Dp[t])for(var i in Mp)if(e[i]!==Mp[i])try{Up(e,i,Mp[i])}catch(t){e[i]=Mp[i]}}};for(var jp in Dp)Bp(Pp[jp]&&Pp[jp].prototype,jp);Bp(kp,"DOMTokenList");var Gp=a,Hp=te,zp=$e("species"),Kp=function(e){return Hp>=51||!Gp((function(){var t=[];return(t.constructor={})[zp]=function(){return{foo:1}},1!==t[e](Boolean).foo}))},Wp=Wr,Xp=n,Yp=a,qp=eo,Jp=G,Qp=Me,Zp=rr,$p=yo,e_=_a,t_=Kp,i_=te,r_=$e("isConcatSpreadable"),n_=9007199254740991,o_="Maximum allowed index exceeded",a_=Xp.TypeError,s_=i_>=51||!Yp((function(){var e=[];return e[r_]=!1,e.concat()[0]!==e})),c_=t_("concat"),u_=function(e){if(!Jp(e))return!1;var t=e[r_];return void 0!==t?!!t:qp(e)};Wp({target:"Array",proto:!0,forced:!s_||!c_},{concat:function(e){var t,i,r,n,o,a=Qp(this),s=e_(a,0),c=0;for(t=-1,r=arguments.length;t<r;t++)if(u_(o=-1===t?a:arguments[t])){if(c+(n=Zp(o))>n_)throw a_(o_);for(i=0;i<n;i++,c++)i in o&&$p(s,c,o[i])}else{if(c>=n_)throw a_(o_);$p(s,c++,o)}return s.length=c,s}});var d_=Wr,l_=n,h_=eo,p_=aa,__=G,f_=Zi,v_=rr,m_=F,S_=yo,y_=$e,g_=Po,E_=Kp("slice"),b_=y_("species"),T_=l_.Array,I_=Math.max;d_({target:"Array",proto:!0,forced:!E_},{slice:function(e,t){var i,r,n,o=m_(this),a=v_(o),s=f_(e,a),c=f_(void 0===t?a:t,a);if(h_(o)&&(i=o.constructor,(p_(i)&&(i===T_||h_(i.prototype))||__(i)&&null===(i=i[b_]))&&(i=void 0),i===T_||void 0===i))return g_(o,s,c);for(r=new(void 0===i?T_:i)(I_(c-s,0)),n=0;s<c;s++,n++)s in o&&S_(r,n,o[s]);return r.length=n,r}}),Vo("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 A_(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 C_,O_,w_,N_,P_,D_,k_,M_,U_,L_,x_,V_,F_,B_,j_,G_,H_,z_,K_,W_,X_,Y_,q_,J_,Q_,Z_=function(){return Z_=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},Z_.apply(this,arguments)};function $_(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 ef(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 tf(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 rf(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 nf(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 of(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(e){e[e.VIDEO_SOURCE_TYPE_EXTERNAL=0]="VIDEO_SOURCE_TYPE_EXTERNAL",e[e.VIDEO_SOURCE_TYPE_INTERNAL=1]="VIDEO_SOURCE_TYPE_INTERNAL"}(C_||(C_={})),function(e){e[e.AUDIO_SOURCE_TYPE_EXTERNAL=0]="AUDIO_SOURCE_TYPE_EXTERNAL",e[e.AUDIO_SOURCE_TYPE_INTERNAL=1]="AUDIO_SOURCE_TYPE_INTERNAL"}(O_||(O_={})),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"}(w_||(w_={})),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"}(k_||(k_={})),function(e){e[e.MIRROR_MODE_OFF=0]="MIRROR_MODE_OFF",e[e.MIRROR_MODE_ON=1]="MIRROR_MODE_ON"}(M_||(M_={})),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"}(L_||(L_={})),function(e){e[e.AUDIO=1]="AUDIO",e[e.VIDEO=2]="VIDEO",e[e.AUDIO_AND_VIDEO=3]="AUDIO_AND_VIDEO"}(x_||(x_={})),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"}(V_||(V_={})),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"}(F_||(F_={})),function(e){e[e.MIRROR_TYPE_NONE=0]="MIRROR_TYPE_NONE",e[e.MIRROR_TYPE_RENDER=1]="MIRROR_TYPE_RENDER"}(B_||(B_={})),function(e){e[e.domestic=0]="domestic",e[e.overseas=1]="overseas"}(j_||(j_={})),function(e){e[e.OFFLINE=0]="OFFLINE",e[e.ONLINE=1]="ONLINE",e[e.UNREACHABLE=2]="UNREACHABLE"}(G_||(G_={})),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"}(H_||(H_={})),function(e){e[e.PREV_FRAME=0]="PREV_FRAME",e[e.OTHER_FRAME=1]="OTHER_FRAME"}(z_||(z_={})),function(e){e[e.DISABLE=0]="DISABLE",e[e.VIDEO_STREAM_LOW=1]="VIDEO_STREAM_LOW",e[e.AUDIO_ONLY=2]="AUDIO_ONLY"}(K_||(K_={})),function(e){e[e.LOW=0]="LOW",e[e.MEDIUM=100]="MEDIUM",e[e.HIGH=200]="HIGH"}(W_||(W_={})),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"}(X_||(X_={})),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"}(q_||(q_={})),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"}(J_||(J_={})),function(e){e[e.AUTO_PLAY=0]="AUTO_PLAY",e[e.VIDEO_ONLY=1]="VIDEO_ONLY",e[e.PLAY_MANUALLY=2]="PLAY_MANUALLY"}(Q_||(Q_={}));var af,sf,cf,uf=Object.freeze({__proto__:null,get VideoSourceType(){return C_},get AudioSourceType(){return O_},get UserOfflineReason(){return w_},get ChannelProfile(){return N_},get SubscribeMode(){return P_},get SubscribeState(){return D_},get PublishState(){return k_},get MirrorMode(){return M_},get VideoRenderMode(){return U_},get StreamIndex(){return L_},get MediaType(){return x_},get StreamRemoveReason(){return V_},get ConnectionState(){return F_},get MirrorType(){return B_},get LogChannel(){return j_},get USER_ONLINE_STATUS(){return G_},get PublicStreamType(){return H_},get PublicInterpolationMode(){return z_},get SubscribeFallbackOption(){return K_},get RemoteUserPriority(){return W_},get NetworkQuality(){return X_},get FallbackOrRecoverReason(){return Y_},get RoomProfileType(){return q_},get AudioProfileType(){return J_},get RTCAutoPlayPolicy(){return Q_}});!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"}(af||(af={})),function(e){e[e.PLAYOUT=0]="PLAYOUT",e[e.PUBLISH=1]="PUBLISH",e[e.PLAYOUT_AND_PUBLISH=2]="PLAYOUT_AND_PUBLISH"}(sf||(sf={})),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"}(cf||(cf={}));var df,lf,hf=Object.freeze({__proto__:null,get AudioMixingDualMonoMode(){return af},get AudioMixingType(){return sf},get AudioMixingState(){return cf}});!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"}(df||(df={})),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"}(lf||(lf={}));var pf=ba.forEach,_f=jn("forEach")?[].forEach:function(e){return pf(this,e,arguments.length>1?arguments[1]:void 0)};Wr({target:"Array",proto:!0,forced:[].forEach!=_f},{forEach:_f});var ff=n,vf=Cp,mf=Np,Sf=_f,yf=Xt,gf=function(e){if(e&&e.forEach!==Sf)try{yf(e,"forEach",Sf)}catch(t){e.forEach=Sf}};for(var Ef in vf)vf[Ef]&&gf(ff[Ef]&&ff[Ef].prototype);gf(mf);var bf=Wr,Tf=I,If=n.Date,Rf=Tf(If.prototype.getTime);bf({target:"Date",stat:!0},{now:function(){return Rf(new If)}});var Af=I,Cf=Yt.exports,Of=Date.prototype,wf="Invalid Date",Nf="toString",Pf=Af(Of.toString),Df=Af(Of.getTime);String(new Date(NaN))!=wf&&Cf(Of,Nf,(function(){var e=Df(this);return e==e?Pf(this):wf}));var kf=cr.includes,Mf=ah;Wr({target:"Array",proto:!0},{includes:function(e){return kf(this,e,arguments.length>1?arguments[1]:void 0)}}),Mf("includes");var Uf=G,Lf=O,xf=$e("match"),Vf=function(e){var t;return Uf(e)&&(void 0!==(t=e[xf])?!!t:"RegExp"==Lf(e))},Ff=Vf,Bf=n.TypeError,jf=function(e){if(Ff(e))throw Bf("The method doesn't accept regular expressions");return e},Gf=$e("match"),Hf=function(e){var t=/./;try{"/./"[e](t)}catch(i){try{return t[Gf]=!1,"/./"[e](t)}catch(e){}}return!1},zf=Wr,Kf=jf,Wf=L,Xf=_o,Yf=Hf,qf=I("".indexOf);zf({target:"String",proto:!0,forced:!Yf("includes")},{includes:function(e){return!!~qf(Xf(Wf(this)),Xf(Kf(e)),arguments.length>1?arguments[1]:void 0)}});var Jf=kt,Qf=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},Zf=a,$f=n.RegExp,ev=Zf((function(){var e=$f("a","y");return e.lastIndex=2,null!=e.exec("abcd")})),tv=ev||Zf((function(){return!$f("a","y").sticky})),iv={BROKEN_CARET:ev||Zf((function(){var e=$f("^r","gy");return e.lastIndex=2,null!=e.exec("str")})),MISSED_STICKY:tv,UNSUPPORTED_Y:ev},rv=a,nv=n.RegExp,ov=rv((function(){var e=nv(".","s");return!(e.dotAll&&e.exec("\n")&&"s"===e.flags)})),av=a,sv=n.RegExp,cv=av((function(){var e=sv("(?<a>b)","g");return"b"!==e.exec("b").groups.a||"bc"!=="b".replace(e,"$<a>c")})),uv=l,dv=I,lv=_o,hv=Qf,pv=iv,_v=Ie.exports,fv=Rn,vv=Oi.get,mv=ov,Sv=cv,yv=_v("native-string-replace",String.prototype.replace),gv=RegExp.prototype.exec,Ev=gv,bv=dv("".charAt),Tv=dv("".indexOf),Iv=dv("".replace),Rv=dv("".slice),Av=function(){var e=/a/,t=/b*/g;return uv(gv,e,"a"),uv(gv,t,"a"),0!==e.lastIndex||0!==t.lastIndex}(),Cv=pv.BROKEN_CARET,Ov=void 0!==/()??/.exec("")[1];(Av||Ov||Cv||mv||Sv)&&(Ev=function(e){var t,i,r,n,o,a,s,c=this,u=vv(c),d=lv(e),l=u.raw;if(l)return l.lastIndex=c.lastIndex,t=uv(Ev,l,d),c.lastIndex=l.lastIndex,t;var h=u.groups,p=Cv&&c.sticky,_=uv(hv,c),f=c.source,v=0,m=d;if(p&&(_=Iv(_,"y",""),-1===Tv(_,"g")&&(_+="g"),m=Rv(d,c.lastIndex),c.lastIndex>0&&(!c.multiline||c.multiline&&"\n"!==bv(d,c.lastIndex-1))&&(f="(?: "+f+")",m=" "+m,v++),i=new RegExp("^(?:"+f+")",_)),Ov&&(i=new RegExp("^"+f+"$(?!\\s)",_)),Av&&(r=c.lastIndex),n=uv(gv,p?i:c,m),p?n?(n.input=Rv(n.input,v),n[0]=Rv(n[0],v),n.index=c.lastIndex,c.lastIndex+=n[0].length):c.lastIndex=0:Av&&n&&(c.lastIndex=c.global?n.index+n[0].length:r),Ov&&n&&n.length>1&&uv(yv,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=fv(null),o=0;o<h.length;o++)a[(s=h[o])[0]]=n[s[1]];return n});var wv=Ev;Wr({target:"RegExp",proto:!0,forced:/./.exec!==wv},{exec:wv});var Nv=I,Pv=Yt.exports,Dv=wv,kv=a,Mv=$e,Uv=Xt,Lv=Mv("species"),xv=RegExp.prototype,Vv=function(e,t,i,r){var n=Mv(e),o=!kv((function(){var t={};return t[n]=function(){return 7},7!=""[e](t)})),a=o&&!kv((function(){var t=!1,i=/a/;return"split"===e&&((i={}).constructor={},i.constructor[Lv]=function(){return i},i.flags="",i[n]=/./[n]),i.exec=function(){return t=!0,null},i[n](""),!t}));if(!o||!a||i){var s=Nv(/./[n]),c=t(n,""[e],(function(e,t,i,r,n){var a=Nv(e),c=t.exec;return c===Dv||c===xv.exec?o&&!n?{done:!0,value:s(t,i,r)}:{done:!0,value:a(i,t,r)}:{done:!1}}));Pv(String.prototype,e,c[0]),Pv(xv,n,c[1])}r&&Uv(xv[n],"sham",!0)},Fv=Object.is||function(e,t){return e===t?0!==e||1/e==1/t:e!=e&&t!=t},Bv=l,jv=kt,Gv=B,Hv=O,zv=wv,Kv=n.TypeError,Wv=function(e,t){var i=e.exec;if(Gv(i)){var r=Bv(i,e,t);return null!==r&&jv(r),r}if("RegExp"===Hv(e))return Bv(zv,e,t);throw Kv("RegExp#exec called on incompatible receiver")},Xv=l,Yv=kt,qv=L,Jv=Fv,Qv=_o,Zv=ye,$v=Wv;function em(e,t,i){return t in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}Vv("search",(function(e,t,i){return[function(t){var i=qv(this),r=null==t?void 0:Zv(t,e);return r?Xv(r,t,i):new RegExp(t)[e](Qv(i))},function(e){var r=Yv(this),n=Qv(e),o=i(t,r,n);if(o.done)return o.value;var a=r.lastIndex;Jv(a,0)||(r.lastIndex=0);var s=$v(r,n);return Jv(r.lastIndex,a)||(r.lastIndex=a),null===s?-1:s.index}]}));var tm=yp.charAt,im=function(e,t,i){return t+(i?tm(e,t).length:1)},rm=l,nm=kt,om=tr,am=_o,sm=L,cm=ye,um=im,dm=Wv;Vv("match",(function(e,t,i){return[function(t){var i=sm(this),r=null==t?void 0:cm(t,e);return r?rm(r,t,i):new RegExp(t)[e](am(i))},function(e){var r=nm(this),n=am(e),o=i(t,r,n);if(o.done)return o.value;if(!r.global)return dm(r,n);var a=r.unicode;r.lastIndex=0;for(var s,c=[],u=0;null!==(s=dm(r,n));){var d=am(s[0]);c[u]=d,""===d&&(r.lastIndex=um(n,om(r.lastIndex),a)),u++}return 0===u?null:c}]}));var lm="\t\n\v\f\r                 \u2028\u2029\ufeff",hm=L,pm=_o,_m=I("".replace),fm="[\t\n\v\f\r                 \u2028\u2029\ufeff]",vm=RegExp("^"+fm+fm+"*"),mm=RegExp(fm+fm+"*$"),Sm=function(e){return function(t){var i=pm(hm(t));return 1&e&&(i=_m(i,vm,"")),2&e&&(i=_m(i,mm,"")),i}},ym={start:Sm(1),end:Sm(2),trim:Sm(3)},gm=n,Em=a,bm=I,Tm=_o,Im=ym.trim,Rm=lm,Am=gm.parseInt,Cm=gm.Symbol,Om=Cm&&Cm.iterator,wm=/^[+-]?0x/i,Nm=bm(wm.exec),Pm=8!==Am(Rm+"08")||22!==Am(Rm+"0x16")||Om&&!Em((function(){Am(Object(Om))}))?function(e,t){var i=Im(Tm(e));return Am(i,t>>>0||(Nm(wm,i)?16:10))}:Am;Wr({global:!0,forced:parseInt!=Pm},{parseInt:Pm});var Dm={exports:{}},km=a((function(){if("function"==typeof ArrayBuffer){var e=new ArrayBuffer(8);Object.isExtensible(e)&&Object.defineProperty(e,"a",{value:8})}})),Mm=a,Um=G,Lm=O,xm=km,Vm=Object.isExtensible,Fm=Mm((function(){Vm(1)}))||xm?function(e){return!!Um(e)&&((!xm||"ArrayBuffer"!=Lm(e))&&(!Vm||Vm(e)))}:Vm,Bm=!a((function(){return Object.isExtensible(Object.preventExtensions({}))})),jm=Wr,Gm=I,Hm=di,zm=G,Km=xe,Wm=Ct.f,Xm=Ki,Ym=fo,qm=Fm,Jm=Bm,Qm=!1,Zm=Ge("meta"),$m=0,eS=function(e){Wm(e,Zm,{value:{objectID:"O"+$m++,weakData:{}}})},tS=Dm.exports={enable:function(){tS.enable=function(){},Qm=!0;var e=Xm.f,t=Gm([].splice),i={};i[Zm]=1,e(i).length&&(Xm.f=function(i){for(var r=e(i),n=0,o=r.length;n<o;n++)if(r[n]===Zm){t(r,n,1);break}return r},jm({target:"Object",stat:!0,forced:!0},{getOwnPropertyNames:Ym.f}))},fastKey:function(e,t){if(!zm(e))return"symbol"==typeof e?e:("string"==typeof e?"S":"P")+e;if(!Km(e,Zm)){if(!qm(e))return"F";if(!t)return"E";eS(e)}return e[Zm].objectID},getWeakData:function(e,t){if(!Km(e,Zm)){if(!qm(e))return!0;if(!t)return!1;eS(e)}return e[Zm].weakData},onFreeze:function(e){return Jm&&Qm&&qm(e)&&!Km(e,Zm)&&eS(e),e}};Hm[Zm]=!0;var iS=B,rS=G,nS=en,oS=function(e,t,i){var r,n;return nS&&iS(r=t.constructor)&&r!==i&&rS(n=r.prototype)&&n!==i.prototype&&nS(e,n),e},aS=Wr,sS=n,cS=I,uS=Vr,dS=Yt.exports,lS=Dm.exports,hS=Wc,pS=lc,_S=B,fS=G,vS=a,mS=tu,SS=Go,yS=oS,gS=function(e,t,i){var r=-1!==e.indexOf("Map"),n=-1!==e.indexOf("Weak"),o=r?"set":"add",a=sS[e],s=a&&a.prototype,c=a,u={},d=function(e){var t=cS(s[e]);dS(s,e,"add"==e?function(e){return t(this,0===e?0:e),this}:"delete"==e?function(e){return!(n&&!fS(e))&&t(this,0===e?0:e)}:"get"==e?function(e){return n&&!fS(e)?void 0:t(this,0===e?0:e)}:"has"==e?function(e){return!(n&&!fS(e))&&t(this,0===e?0:e)}:function(e,i){return t(this,0===e?0:e,i),this})};if(uS(e,!_S(a)||!(n||s.forEach&&!vS((function(){(new a).entries().next()})))))c=i.getConstructor(t,e,r,o),lS.enable();else if(uS(e,!0)){var l=new c,h=l[o](n?{}:-0,1)!=l,p=vS((function(){l.has(1)})),_=mS((function(e){new a(e)})),f=!n&&vS((function(){for(var e=new a,t=5;t--;)e[o](t,t);return!e.has(-0)}));_||((c=t((function(e,t){pS(e,s);var i=yS(new a,e,c);return null!=t&&hS(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,aS({global:!0,forced:c!=a},u),SS(c,e),n||i.setStrong(c,e,r),c},ES=Ct.f,bS=Rn,TS=rc,IS=Wo,RS=lc,AS=Wc,CS=Zh,OS=cc,wS=s,NS=Dm.exports.fastKey,PS=Oi.set,DS=Oi.getterFor,kS={getConstructor:function(e,t,i,r){var n=e((function(e,n){RS(e,o),PS(e,{type:t,index:bS(null),first:void 0,last:void 0,size:0}),wS||(e.size=0),null!=n&&AS(n,e[r],{that:e,AS_ENTRIES:i})})),o=n.prototype,a=DS(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=NS(t,!0),key:t,value:i,previous:r=o.last,next:void 0,removed:!1},o.first||(o.first=s),r&&(r.next=s),wS?o.size++:e.size++,"F"!==n&&(o.index[n]=s)),e},c=function(e,t){var i,r=a(e),n=NS(t);if("F"!==n)return r.index[n];for(i=r.first;i;i=i.next)if(i.key==t)return i};return TS(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,wS?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),wS?i.size--:t.size--}return!!r},forEach:function(e){for(var t,i=a(this),r=IS(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)}}),TS(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)}}),wS&&ES(o,"size",{get:function(){return a(this).size}}),n},setStrong:function(e,t,i){var r=t+" Iterator",n=DS(t),o=DS(r);CS(e,t,(function(e,t){PS(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),OS(t)}};gS("Map",(function(e){return function(){return e(this,arguments.length?arguments[0]:void 0)}}),kS);var MS=Me,US=on;Wr({target:"Object",stat:!0,forced:a((function(){US(1)}))},{keys:function(e){return US(MS(e))}});var LS=me,xS=Me,VS=M,FS=rr,BS=n.TypeError,jS=function(e){return function(t,i,r,n){LS(i);var o=xS(t),a=VS(o),s=FS(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 BS("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}},GS={left:jS(!1),right:jS(!0)},HS=GS.left,zS=te,KS=pu;Wr({target:"Array",proto:!0,forced:!jn("reduce")||!KS&&zS>79&&zS<83},{reduce:function(e){var t=arguments.length;return HS(this,e,t,t>1?arguments[1]:void 0)}});var WS,XS=Wr,YS=I,qS=o.f,JS=tr,QS=_o,ZS=jf,$S=L,ey=Hf,ty=YS("".endsWith),iy=YS("".slice),ry=Math.min,ny=ey("endsWith");XS({target:"String",proto:!0,forced:!!(ny||(WS=qS(String.prototype,"endsWith"),!WS||WS.writable))&&!ny},{endsWith:function(e){var t=QS($S(this));ZS(e);var i=arguments.length>1?arguments[1]:void 0,r=t.length,n=void 0===i?r:ry(JS(i),r),o=QS(e);return ty?ty(t,o,n):iy(t,n-o.length,n)===o}});var oy=!0,ay=!0;function sy(e,t,i){var r=e.match(t);return r&&r.length>=i&&parseInt(r[i],10)}function cy(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 uy(e){return"boolean"!=typeof e?new Error("Argument type: "+t(e)+". Please use a boolean."):(oy=e,e?"adapter.js logging disabled":"adapter.js logging enabled")}function dy(e){return"boolean"!=typeof e?new Error("Argument type: "+t(e)+". Please use a boolean."):(ay=!e,"adapter.js deprecation warnings "+(e?"disabled":"enabled"))}function ly(){if("object"===("undefined"==typeof window?"undefined":t(window))){if(oy)return;"undefined"!=typeof console&&"function"==typeof console.log&&console.log.apply(console,arguments)}}function hy(e,t){ay&&console.warn(e+" is deprecated, please use "+t+" instead.")}function py(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=sy(i.userAgent,/Firefox\/(\d+)\./,1);else if(i.webkitGetUserMedia||!1===e.isSecureContext&&e.webkitRTCPeerConnection&&!e.RTCIceGatherer)t.browser="chrome",t.version=sy(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=sy(i.userAgent,/AppleWebKit\/(\d+)\./,1),t.supportsUnifiedPlan=e.RTCRtpTransceiver&&"currentDirection"in e.RTCRtpTransceiver.prototype}return t}function _y(e){return"[object Object]"===Object.prototype.toString.call(e)}function fy(e){return _y(e)?Object.keys(e).reduce((function(t,i){var r=_y(e[i]),n=r?fy(e[i]):e[i],o=r&&!Object.keys(n).length;return void 0===n||o?t:Object.assign(t,em({},i,n))}),{}):e}function vy(e,t,i){t&&!i.has(t.id)&&(i.set(t.id,t),Object.keys(t).forEach((function(r){r.endsWith("Id")?vy(e,e.get(t[r]),i):r.endsWith("Ids")&&t[r].forEach((function(t){vy(e,e.get(t),i)}))})))}function my(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&&vy(e,i,n)}))})),n}var Sy=Wr,yy=ba.find,gy=ah,Ey="find",by=!0;Ey in[]&&Array(1).find((function(){by=!1})),Sy({target:"Array",proto:!0,forced:by},{find:function(e){return yy(this,e,arguments.length>1?arguments[1]:void 0)}}),gy(Ey);var Ty=Wr,Iy=n,Ry=Zi,Ay=Yi,Cy=rr,Oy=Me,wy=_a,Ny=yo,Py=Kp("splice"),Dy=Iy.TypeError,ky=Math.max,My=Math.min,Uy=9007199254740991,Ly="Maximum allowed length exceeded";Ty({target:"Array",proto:!0,forced:!Py},{splice:function(e,t){var i,r,n,o,a,s,c=Oy(this),u=Cy(c),d=Ry(e,u),l=arguments.length;if(0===l?i=r=0:1===l?(i=0,r=u-d):(i=l-2,r=My(ky(Ay(t),0),u-d)),u+i-r>Uy)throw Dy(Ly);for(n=wy(c,r),o=0;o<r;o++)(a=d+o)in c&&Ny(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 xy=ba.map;Wr({target:"Array",proto:!0,forced:!Kp("map")},{map:function(e){return xy(this,e,arguments.length>1?arguments[1]:void 0)}});var Vy=ba.filter;Wr({target:"Array",proto:!0,forced:!Kp("filter")},{filter:function(e){return Vy(this,e,arguments.length>1?arguments[1]:void 0)}});var Fy=I,By=Me,jy=Math.floor,Gy=Fy("".charAt),Hy=Fy("".replace),zy=Fy("".slice),Ky=/\$([$&'`]|\d{1,2}|<[^>]*>)/g,Wy=/\$([$&'`]|\d{1,2})/g,Xy=Zn,Yy=l,qy=I,Jy=Vv,Qy=a,Zy=kt,$y=B,eg=Yi,tg=tr,ig=_o,rg=L,ng=im,og=ye,ag=function(e,t,i,r,n,o){var a=i+e.length,s=r.length,c=Wy;return void 0!==n&&(n=By(n),c=Ky),Hy(o,c,(function(o,c){var u;switch(Gy(c,0)){case"$":return"$";case"&":return e;case"`":return zy(t,0,i);case"'":return zy(t,a);case"<":u=n[zy(c,1,-1)];break;default:var d=+c;if(0===d)return o;if(d>s){var l=jy(d/10);return 0===l?o:l<=s?void 0===r[l-1]?Gy(c,1):r[l-1]+Gy(c,1):o}u=r[d-1]}return void 0===u?"":u}))},sg=Wv,cg=$e("replace"),ug=Math.max,dg=Math.min,lg=qy([].concat),hg=qy([].push),pg=qy("".indexOf),_g=qy("".slice),fg="$0"==="a".replace(/./,"$0"),vg=!!/./[cg]&&""===/./[cg]("a","$0");Jy("replace",(function(e,t,i){var r=vg?"$":"$0";return[function(e,i){var r=rg(this),n=null==e?void 0:og(e,cg);return n?Yy(n,e,r,i):Yy(t,ig(r),e,i)},function(e,n){var o=Zy(this),a=ig(e);if("string"==typeof n&&-1===pg(n,r)&&-1===pg(n,"$<")){var s=i(t,o,a,n);if(s.done)return s.value}var c=$y(n);c||(n=ig(n));var u=o.global;if(u){var d=o.unicode;o.lastIndex=0}for(var l=[];;){var h=sg(o,a);if(null===h)break;if(hg(l,h),!u)break;""===ig(h[0])&&(o.lastIndex=ng(a,tg(o.lastIndex),d))}for(var p,_="",f=0,v=0;v<l.length;v++){for(var m=ig((h=l[v])[0]),S=ug(dg(eg(h.index),a.length),0),y=[],g=1;g<h.length;g++)hg(y,void 0===(p=h[g])?p:String(p));var E=h.groups;if(c){var b=lg([m],y,S,a);void 0!==E&&hg(b,E);var T=ig(Xy(n,void 0,b))}else T=ag(m,a,S,y,E,n);S>=f&&(_+=_g(a,f,S)+T,f=S+m.length)}return _+_g(a,f)}]}),!!Qy((function(){var e=/./;return e.exec=function(){var e=[];return e.groups={a:"7"},e},"7"!=="".replace(e,"$<a>")}))||!fg||vg);var mg=s,Sg=n,yg=I,gg=Vr,Eg=oS,bg=Xt,Tg=Ct.f,Ig=Ki.f,Rg=X,Ag=Vf,Cg=_o,Og=Qf,wg=iv,Ng=Yt.exports,Pg=a,Dg=xe,kg=Oi.enforce,Mg=cc,Ug=ov,Lg=cv,xg=$e("match"),Vg=Sg.RegExp,Fg=Vg.prototype,Bg=Sg.SyntaxError,jg=yg(Og),Gg=yg(Fg.exec),Hg=yg("".charAt),zg=yg("".replace),Kg=yg("".indexOf),Wg=yg("".slice),Xg=/^\?<[^\s\d!#%&*+<=>@^][^\s!#%&*+<=>@^]*>/,Yg=/a/g,qg=/a/g,Jg=new Vg(Yg)!==Yg,Qg=wg.MISSED_STICKY,Zg=wg.UNSUPPORTED_Y,$g=mg&&(!Jg||Qg||Ug||Lg||Pg((function(){return qg[xg]=!1,Vg(Yg)!=Yg||Vg(qg)==qg||"/a/i"!=Vg(Yg,"i")})));if(gg("RegExp",$g)){for(var eE=function(e,t){var i,r,n,o,a,s,c=Rg(Fg,this),u=Ag(e),d=void 0===t,l=[],h=e;if(!c&&u&&d&&e.constructor===eE)return e;if((u||Rg(Fg,e))&&(e=e.source,d&&(t="flags"in h?h.flags:jg(h))),e=void 0===e?"":Cg(e),t=void 0===t?"":Cg(t),h=e,Ug&&"dotAll"in Yg&&(r=!!t&&Kg(t,"s")>-1)&&(t=zg(t,/s/g,"")),i=t,Qg&&"sticky"in Yg&&(n=!!t&&Kg(t,"y")>-1)&&Zg&&(t=zg(t,/y/g,"")),Lg&&(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=Hg(e,r)))t+=Hg(e,++r);else if("]"===t)s=!1;else if(!s)switch(!0){case"["===t:s=!0;break;case"("===t:Gg(Xg,Wg(e,r+1))&&(r+=2,c=!0),n+=t,u++;continue;case">"===t&&c:if(""===d||Dg(a,d))throw new Bg("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=Eg(Vg(e,t),c?this:Fg,eE),(r||n||l.length)&&(s=kg(a),r&&(s.dotAll=!0,s.raw=eE(function(e){for(var t,i=e.length,r=0,n="",o=!1;r<=i;r++)"\\"!==(t=Hg(e,r))?o||"."!==t?("["===t?o=!0:"]"===t&&(o=!1),n+=t):n+="[\\s\\S]":n+=t+Hg(e,++r);return n}(e),i)),n&&(s.sticky=!0),l.length&&(s.groups=l)),e!==h)try{bg(a,"source",""===h?"(?:)":h)}catch(e){}return a},tE=function(e){e in eE||Tg(eE,e,{configurable:!0,get:function(){return Vg[e]},set:function(t){Vg[e]=t}})},iE=Ig(Vg),rE=0;iE.length>rE;)tE(iE[rE++]);Fg.constructor=eE,eE.prototype=Fg,Ng(Sg,"RegExp",eE)}Mg("RegExp");var nE=I,oE=Mi.PROPER,aE=Yt.exports,sE=kt,cE=X,uE=_o,dE=a,lE=Qf,hE="toString",pE=RegExp.prototype,_E=pE.toString,fE=nE(lE),vE=dE((function(){return"/a/b"!=_E.call({source:"a",flags:"b"})})),mE=oE&&_E.name!=hE;(vE||mE)&&aE(RegExp.prototype,hE,(function(){var e=sE(this),t=uE(e.source),i=e.flags;return"/"+t+"/"+uE(void 0===i&&cE(pE,e)&&!("flags"in pE)?fE(e):i)}),{unsafe:!0});var SE=ba.some;Wr({target:"Array",proto:!0,forced:!jn("some")},{some:function(e){return SE(this,e,arguments.length>1?arguments[1]:void 0)}});var yE=s,gE=Mi.EXISTS,EE=I,bE=Ct.f,TE=Function.prototype,IE=EE(TE.toString),RE=/function\b(?:\s|\/\*[\S\s]*?\*\/|\/\/[^\n\r]*[\n\r]+)*([^\s(/]*)/,AE=EE(RE.exec);yE&&!gE&&bE(TE,"name",{configurable:!0,get:function(){try{return AE(RE,IE(this))[1]}catch(e){return""}}});var CE=I,OE=me,wE=G,NE=xe,PE=Po,DE=c,kE=n.Function,ME=CE([].concat),UE=CE([].join),LE={},xE=function(e,t,i){if(!NE(LE,t)){for(var r=[],n=0;n<t;n++)r[n]="a["+n+"]";LE[t]=kE("C,a","return new C("+UE(r,",")+")")}return LE[t](e,i)},VE=DE?kE.bind:function(e){var t=OE(this),i=t.prototype,r=PE(arguments,1),n=function(){var i=ME(r,PE(arguments));return this instanceof n?xE(t,i.length,i):t.apply(e,i)};return wE(i)&&(n.prototype=i),n},FE=VE;Wr({target:"Function",proto:!0,forced:Function.bind!==FE},{bind:FE});var BE=ly;function jE(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),BE("chrome: "+JSON.stringify(e)),o(e)}));e.video=n(e.video)}return BE("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 GE(e){e.MediaStream=e.MediaStream||e.webkitMediaStream}function HE(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 cy(e,"track",(function(e){return e.transceiver||Object.defineProperty(e,"transceiver",{value:{receiver:e.receiver}}),e}))}function zE(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 KE(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 WE(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 my(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}),cy(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 my(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 XE(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 YE(e,t){if(e.RTCPeerConnection){if(e.RTCPeerConnection.prototype.addTrack&&t.version>=65)return XE(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=em({},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 qE(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=em({},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 JE(e,t){cy(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 QE=Object.freeze({__proto__:null,shimMediaStream:GE,shimOnTrack:HE,shimGetSendersWithDtmf:zE,shimGetStats:KE,shimSenderReceiverGetStats:WE,shimAddTrackRemoveTrackWithNative:XE,shimAddTrackRemoveTrack:YE,shimPeerConnection:qE,fixNegotiationNeeded:JE,shimGetUserMedia:jE,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"))}}),ZE=n,$E=a,eb=_o,tb=ym.trim,ib=I("".charAt),rb=ZE.parseFloat,nb=ZE.Symbol,ob=nb&&nb.iterator,ab=1/rb("\t\n\v\f\r                 \u2028\u2029\ufeff-0")!=-1/0||ob&&!$E((function(){rb(Object(ob))}))?function(e){var t=tb(eb(e)),i=rb(t);return 0===i&&"-"==ib(t,0)?-0:i}:rb;Wr({global:!0,forced:parseFloat!=ab},{parseFloat:ab});var sb=Wr,cb=tc,ub=a,db=W,lb=B,hb=uu,pb=yd,_b=Yt.exports;if(sb({target:"Promise",proto:!0,real:!0,forced:!!cb&&ub((function(){cb.prototype.finally.call({then:function(){}},(function(){}))}))},{finally:function(e){var t=hb(this,db("Promise")),i=lb(e);return this.then(i?function(i){return pb(t,e()).then((function(){return i}))}:e,i?function(i){return pb(t,e()).then((function(){throw i}))}:e)}}),lb(cb)){var fb=db("Promise").prototype.finally;cb.prototype.finally!==fb&&_b(cb.prototype,"finally",fb,{unsafe:!0})}function vb(e,i){var r=e&&e.navigator,n=e&&e.MediaStreamTrack;if(r.getUserMedia=function(e,t,i){hy("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 mb(e){"object"===t(e)&&e.RTCTrackEvent&&"receiver"in e.RTCTrackEvent.prototype&&!("transceiver"in e.RTCTrackEvent.prototype)&&Object.defineProperty(e.RTCTrackEvent.prototype,"transceiver",{get:function(){return{receiver:this.receiver}}})}function Sb(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=em({},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 yb(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 gb(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}),cy(e,"track",(function(e){return e.receiver._pc=e.srcElement,e})),e.RTCRtpReceiver.prototype.getStats=function(){return this._pc.getStats(this.track)}}}function Eb(e){e.RTCPeerConnection&&!("removeStream"in e.RTCPeerConnection.prototype)&&(e.RTCPeerConnection.prototype.removeStream=function(e){var t=this;hy("removeStream","removeTrack"),this.getSenders().forEach((function(i){i.track&&e.getTracks().includes(i.track)&&t.removeTrack(i)}))})}function bb(e){e.DataChannel&&!e.RTCDataChannel&&(e.RTCDataChannel=e.DataChannel)}function Tb(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 Ib(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 Rb(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 Ab(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 Cb=Object.freeze({__proto__:null,shimOnTrack:mb,shimPeerConnection:Sb,shimSenderGetStats:yb,shimReceiverGetStats:gb,shimRemoveStream:Eb,shimRTCDataChannel:bb,shimAddTransceiver:Tb,shimGetParameters:Ib,shimCreateOffer:Rb,shimCreateAnswer:Ab,shimGetUserMedia:vb,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 Ob(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 wb(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 Nb(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 Pb(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(Db(e))}}!t.getUserMedia&&t.mediaDevices&&t.mediaDevices.getUserMedia&&(t.getUserMedia=function(e,i,r){t.mediaDevices.getUserMedia(e).then(i,r)}.bind(t))}function Db(e){return e&&void 0!==e.video?Object.assign({},e,{video:fy(e.video)}):e}function kb(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")?(hy("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 Mb(e){"object"===t(e)&&e.RTCTrackEvent&&"receiver"in e.RTCTrackEvent.prototype&&!("transceiver"in e.RTCTrackEvent.prototype)&&Object.defineProperty(e.RTCTrackEvent.prototype,"transceiver",{get:function(){return{receiver:this.receiver}}})}function Ub(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 Lb(e){"object"!==t(e)||e.AudioContext||(e.AudioContext=e.webkitAudioContext)}var xb=Object.freeze({__proto__:null,shimLocalStreamsAPI:Ob,shimRemoteStreamsAPI:wb,shimCallbacksAPI:Nb,shimGetUserMedia:Pb,shimConstraints:Db,shimRTCIceServerUrls:kb,shimTrackEventTransceiver:Mb,shimCreateOfferLegacy:Ub,shimAudioContext:Lb}),Vb=Me,Fb=ct;Wr({target:"Date",proto:!0,forced:a((function(){return null!==new Date(NaN).toJSON()||1!==Date.prototype.toJSON.call({toISOString:function(){return 1}})}))},{toJSON:function(e){var t=Vb(this),i=Fb(t,"number");return"number"!=typeof i||isFinite(i)?t.toISOString():null}});var Bb=l;Wr({target:"URL",proto:!0,enumerable:!0},{toJSON:function(){return Bb(URL.prototype.toString,this)}});var jb=I(1..valueOf),Gb=s,Hb=n,zb=I,Kb=Vr,Wb=Yt.exports,Xb=xe,Yb=oS,qb=X,Jb=le,Qb=ct,Zb=a,$b=Ki.f,eT=o.f,tT=Ct.f,iT=jb,rT=ym.trim,nT="Number",oT=Hb.Number,aT=oT.prototype,sT=Hb.TypeError,cT=zb("".slice),uT=zb("".charCodeAt),dT=function(e){var t=Qb(e,"number");return"bigint"==typeof t?t:lT(t)},lT=function(e){var t,i,r,n,o,a,s,c,u=Qb(e,"number");if(Jb(u))throw sT("Cannot convert a Symbol value to a number");if("string"==typeof u&&u.length>2)if(u=rT(u),43===(t=uT(u,0))||45===t){if(88===(i=uT(u,2))||120===i)return NaN}else if(48===t){switch(uT(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=cT(u,2)).length,s=0;s<a;s++)if((c=uT(o,s))<48||c>n)return NaN;return parseInt(o,r)}return+u};if(Kb(nT,!oT(" 0o1")||!oT("0b1")||oT("+0x1"))){for(var hT,pT=function(e){var t=arguments.length<1?0:oT(dT(e)),i=this;return qb(aT,i)&&Zb((function(){iT(i)}))?Yb(Object(t),i,pT):t},_T=Gb?$b(oT):"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(","),fT=0;_T.length>fT;fT++)Xb(oT,hT=_T[fT])&&!Xb(pT,hT)&&tT(pT,hT,eT(oT,hT));pT.prototype=aT,aT.constructor=pT,Wb(Hb,nT,pT)}var vT=Wr,mT=M,ST=F,yT=jn,gT=I([].join),ET=mT!=Object,bT=yT("join",",");vT({target:"Array",proto:!0,forced:ET||!bT},{join:function(e){return gT(ST(this),void 0===e?",":e)}});var TT=Zn,IT=l,RT=I,AT=Vv,CT=Vf,OT=kt,wT=L,NT=uu,PT=im,DT=tr,kT=_o,MT=ye,UT=Ro,LT=Wv,xT=wv,VT=a,FT=iv.UNSUPPORTED_Y,BT=4294967295,jT=Math.min,GT=[].push,HT=RT(/./.exec),zT=RT(GT),KT=RT("".slice),WT=!VT((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]}));AT("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=kT(wT(this)),n=void 0===i?BT:i>>>0;if(0===n)return[];if(void 0===e)return[r];if(!CT(e))return IT(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=IT(xT,l,r))&&!((a=l.lastIndex)>d&&(zT(c,KT(r,d,o.index)),o.length>1&&o.index<r.length&&TT(GT,c,UT(o,1)),s=o[0].length,d=a,c.length>=n));)l.lastIndex===o.index&&l.lastIndex++;return d===r.length?!s&&HT(l,"")||zT(c,""):zT(c,KT(r,d)),c.length>n?UT(c,0,n):c}:"0".split(void 0,0).length?function(e,i){return void 0===e&&0===i?[]:IT(t,this,e,i)}:t,[function(t,i){var n=wT(this),o=null==t?void 0:MT(t,e);return o?IT(o,t,n,i):IT(r,kT(n),t,i)},function(e,n){var o=OT(this),a=kT(e),s=i(r,o,a,n,r!==t);if(s.done)return s.value;var c=NT(o,RegExp),u=o.unicode,d=(o.ignoreCase?"i":"")+(o.multiline?"m":"")+(o.unicode?"u":"")+(FT?"g":"y"),l=new c(FT?"^(?:"+o.source+")":o,d),h=void 0===n?BT:n>>>0;if(0===h)return[];if(0===a.length)return null===LT(l,a)?[a]:[];for(var p=0,_=0,f=[];_<a.length;){l.lastIndex=FT?0:_;var v,m=LT(l,FT?KT(a,_):a);if(null===m||(v=jT(DT(l.lastIndex+(FT?_:0)),a.length))===p)_=PT(a,_,u);else{if(zT(f,KT(a,p,_)),f.length===h)return f;for(var S=1;S<=m.length-1;S++)if(zT(f,m[S]),f.length===h)return f;_=p=v}}return zT(f,KT(a,p)),f}]}),!WT,FT);var XT=Mi.PROPER,YT=a,qT=lm,JT=ym.trim;Wr({target:"String",proto:!0,forced:function(e){return YT((function(){return!!qT[e]()||"​…᠎"!=="​…᠎"[e]()||XT&&qT[e].name!==e}))}("trim")},{trim:function(){return JT(this)}});var QT={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}(QT);var ZT=QT.exports,$T=Object.freeze(e({__proto__:null,default:ZT},[QT.exports]));function eI(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=ZT.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,cy(e,"icecandidate",(function(t){return t.candidate&&Object.defineProperty(t,"candidate",{value:new e.RTCIceCandidate(t.candidate),writable:"false"}),t}))}}function tI(e,t){if(e.RTCPeerConnection){"sctp"in e.RTCPeerConnection.prototype||Object.defineProperty(e.RTCPeerConnection.prototype,"sctp",{get:function(){return void 0===this._sctp?null:this._sctp}});var i=function(e){if(!e||!e.sdp)return!1;var t=ZT.splitSections(e.sdp);return t.shift(),t.some((function(e){var t=ZT.parseMLine(e);return t&&"application"===t.kind&&-1!==t.protocol.indexOf("SCTP")}))},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=ZT.matchPrefix(e.sdp,"a=max-message-size:");return n.length>0?r=parseInt(n[0].substr(19),10):"firefox"===t.browser&&-1!==i&&(r=2147483637),r},a=e.RTCPeerConnection.prototype.setRemoteDescription;e.RTCPeerConnection.prototype.setRemoteDescription=function(){if(this._sctp=null,"chrome"===t.browser&&t.version>=76){var e=this.getConfiguration(),s=e.sdpSemantics;"plan-b"===s&&Object.defineProperty(this,"sctp",{get:function(){return void 0===this._sctp?null:this._sctp},enumerable:!0,configurable:!0})}if(i(arguments[0])){var c,u=r(arguments[0]),d=n(u),l=o(arguments[0],u);c=0===d&&0===l?Number.POSITIVE_INFINITY:0===d||0===l?Math.max(d,l):Math.min(d,l);var h={};Object.defineProperty(h,"maxMessageSize",{get:function(){return c}}),this._sctp=h}return a.apply(this,arguments)}}}function iI(e){if(e.RTCPeerConnection&&"createDataChannel"in e.RTCPeerConnection.prototype){var t=e.RTCPeerConnection.prototype.createDataChannel;e.RTCPeerConnection.prototype.createDataChannel=function(){var e=t.apply(this,arguments);return i(e,this),e},cy(e,"datachannel",(function(e){return i(e.channel,e.target),e}))}function i(e,t){var i=e.send;e.send=function(){var r=arguments[0],n=r.length||r.size||r.byteLength;if("open"===e.readyState&&t.sctp&&n>t.sctp.maxMessageSize)throw new TypeError("Message too large (can send a maximum of "+t.sctp.maxMessageSize+" bytes)");return i.apply(e,arguments)}}}function rI(e){if(e.RTCPeerConnection&&!("connectionState"in e.RTCPeerConnection.prototype)){var t=e.RTCPeerConnection.prototype;Object.defineProperty(t,"connectionState",{get:function(){return{completed:"connected",checking:"connecting"}[this.iceConnectionState]||this.iceConnectionState},enumerable:!0,configurable:!0}),Object.defineProperty(t,"onconnectionstatechange",{get:function(){return this._onconnectionstatechange||null},set:function(e){this._onconnectionstatechange&&(this.removeEventListener("connectionstatechange",this._onconnectionstatechange),delete this._onconnectionstatechange),e&&this.addEventListener("connectionstatechange",this._onconnectionstatechange=e)},enumerable:!0,configurable:!0}),["setLocalDescription","setRemoteDescription"].forEach((function(e){var i=t[e];t[e]=function(){return this._connectionstatechangepoly||(this._connectionstatechangepoly=function(e){var t=e.target;if(t._lastConnectionState!==t.connectionState){t._lastConnectionState=t.connectionState;var i=new Event("connectionstatechange",e);t.dispatchEvent(i)}return e},this.addEventListener("iceconnectionstatechange",this._connectionstatechangepoly)),i.apply(this,arguments)}}))}}function nI(e,t){if(e.RTCPeerConnection&&!("chrome"===t.browser&&t.version>=71||"safari"===t.browser&&t.version>=605)){var i=e.RTCPeerConnection.prototype.setRemoteDescription;e.RTCPeerConnection.prototype.setRemoteDescription=function(t){if(t&&t.sdp&&-1!==t.sdp.indexOf("\na=extmap-allow-mixed")){var r=t.sdp.split("\n").filter((function(e){return"a=extmap-allow-mixed"!==e.trim()})).join("\n");e.RTCSessionDescription&&t instanceof e.RTCSessionDescription?arguments[0]=new e.RTCSessionDescription({type:t.type,sdp:r}):t.sdp=r}return i.apply(this,arguments)}}}function oI(e,t){if(e.RTCPeerConnection&&e.RTCPeerConnection.prototype){var i=e.RTCPeerConnection.prototype.addIceCandidate;i&&0!==i.length&&(e.RTCPeerConnection.prototype.addIceCandidate=function(){return arguments[0]?("chrome"===t.browser&&t.version<78||"firefox"===t.browser&&t.version<68||"safari"===t.browser)&&arguments[0]&&""===arguments[0].candidate?Promise.resolve():i.apply(this,arguments):(arguments[1]&&arguments[1].apply(null),Promise.resolve())})}}function aI(e,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 sI=Object.freeze({__proto__:null,shimRTCIceCandidate:eI,shimMaxMessageSize:tI,shimSendThrowTypeError:iI,shimConnectionState:rI,removeExtmapAllowMixed:nI,shimAddIceCandidateNullOrEmpty:oI,shimParameterlessSetLocalDescription:aI});!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=ly,n=py(t),o={browserDetails:n,commonShim:sI,extractVersion:sy,disableLog:uy,disableWarnings:dy,sdp:$T};switch(n.browser){case"chrome":if(!QE||!qE||!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=QE,oI(t,n),aI(t),jE(t,n),GE(t),qE(t,n),HE(t),YE(t,n),zE(t),KE(t),WE(t),JE(t,n),eI(t),rI(t),tI(t,n),iI(t),nI(t,n);break;case"firefox":if(!Cb||!Sb||!i.shimFirefox)return r("Firefox shim is not included in this adapter release."),o;r("adapter.js shimming firefox."),o.browserShim=Cb,oI(t,n),aI(t),vb(t,n),Sb(t,n),mb(t),Eb(t),yb(t),gb(t),bb(t),Tb(t),Ib(t),Rb(t),Ab(t),eI(t),rI(t),tI(t,n),iI(t);break;case"safari":if(!xb||!i.shimSafari)return r("Safari shim is not included in this adapter release."),o;r("adapter.js shimming safari."),o.browserShim=xb,oI(t,n),aI(t),kb(t),Ub(t),Nb(t),Ob(t),wb(t),Mb(t),Pb(t),Lb(t),eI(t),tI(t,n),iI(t),nI(t,n);break;default:r("Unsupported browser!")}}({window:"undefined"==typeof window?void 0:window});var cI=Wr,uI=n,dI=Zn,lI=B,hI=Po,pI=lu,_I=/MSIE .\./.test(Y),fI=uI.Function,vI=function(e){return function(t,i){var r=pI(arguments.length,1)>2,n=lI(t)?t:fI(t),o=r?hI(arguments,2):void 0;return e(r?function(){dI(n,this,o)}:n,i)}};cI({global:!0,bind:!0,forced:_I},{setTimeout:vI(uI.setTimeout),setInterval:vI(uI.setInterval)}),Wr({target:"Array",stat:!0},{isArray:eo});var mI=Ro,SI=Math.floor,yI=function(e,t){var i=e.length,r=SI(i/2);return i<8?gI(e,t):EI(e,yI(mI(e,0,r),t),yI(mI(e,r),t),t)},gI=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},EI=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},bI=yI,TI=Y.match(/firefox\/(\d+)/i),II=!!TI&&+TI[1],RI=/MSIE|Trident/.test(Y),AI=Y.match(/AppleWebKit\/(\d+)\./),CI=!!AI&&+AI[1],OI=Wr,wI=I,NI=me,PI=Me,DI=rr,kI=_o,MI=a,UI=bI,LI=jn,xI=II,VI=RI,FI=te,BI=CI,jI=[],GI=wI(jI.sort),HI=wI(jI.push),zI=MI((function(){jI.sort(void 0)})),KI=MI((function(){jI.sort(null)})),WI=LI("sort"),XI=!MI((function(){if(FI)return FI<70;if(!(xI&&xI>3)){if(VI)return!0;if(BI)return BI<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++)jI.push({k:t+r,v:i})}for(jI.sort((function(e,t){return t.v-e.v})),r=0;r<jI.length;r++)t=jI[r].k.charAt(0),n.charAt(n.length-1)!==t&&(n+=t);return"DGBEFHACIJK"!==n}}));OI({target:"Array",proto:!0,forced:zI||!KI||!WI||!XI},{sort:function(e){void 0!==e&&NI(e);var t=PI(this);if(XI)return void 0===e?GI(t):GI(t,e);var i,r,n=[],o=DI(t);for(r=0;r<o;r++)r in t&&HI(n,t[r]);for(UI(n,function(e){return function(t,i){return void 0===i?-1:void 0===t?1:void 0!==e?+e(t,i)||0:kI(t)>kI(i)?1:-1}}(e)),i=n.length,r=0;r<i;)t[r]=n[r++];for(;r<o;)delete t[r++];return t}});var YI="undefined"!=typeof ArrayBuffer&&"undefined"!=typeof DataView,qI=Yi,JI=tr,QI=n.RangeError,ZI=function(e){if(void 0===e)return 0;var t=qI(e),i=JI(t);if(t!==i)throw QI("Wrong length or index");return i},$I=n.Array,eR=Math.abs,tR=Math.pow,iR=Math.floor,rR=Math.log,nR=Math.LN2,oR={pack:function(e,t,i){var r,n,o,a=$I(i),s=8*i-t-1,c=(1<<s)-1,u=c>>1,d=23===t?tR(2,-24)-tR(2,-77):0,l=e<0||0===e&&1/e<0?1:0,h=0;for((e=eR(e))!=e||e===1/0?(n=e!=e?1:0,r=c):(r=iR(rR(e)/nR),e*(o=tR(2,-r))<1&&(r--,o*=2),(e+=r+u>=1?d/o:d*tR(2,1-u))*o>=2&&(r++,o/=2),r+u>=c?(n=0,r=c):r+u>=1?(n=(e*o-1)*tR(2,t),r+=u):(n=e*tR(2,u-1)*tR(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+=tR(2,t),d-=a}return(u?-1:1)*i*tR(2,d-t)}},aR=Me,sR=Zi,cR=rr,uR=function(e){for(var t=aR(this),i=cR(t),r=arguments.length,n=sR(r>1?arguments[1]:void 0,i),o=r>2?arguments[2]:void 0,a=void 0===o?i:sR(o,i);a>n;)t[n++]=e;return t},dR=n,lR=I,hR=s,pR=YI,_R=Mi,fR=Xt,vR=rc,mR=a,SR=lc,yR=Yi,gR=tr,ER=ZI,bR=oR,TR=vh,IR=en,RR=Ki.f,AR=Ct.f,CR=uR,OR=Ro,wR=Go,NR=_R.PROPER,PR=_R.CONFIGURABLE,DR=Oi.get,kR=Oi.set,MR="ArrayBuffer",UR="DataView",LR="Wrong index",xR=dR.ArrayBuffer,VR=xR,FR=VR&&VR.prototype,BR=dR.DataView,jR=BR&&BR.prototype,GR=Object.prototype,HR=dR.Array,zR=dR.RangeError,KR=lR(CR),WR=lR([].reverse),XR=bR.pack,YR=bR.unpack,qR=function(e){return[255&e]},JR=function(e){return[255&e,e>>8&255]},QR=function(e){return[255&e,e>>8&255,e>>16&255,e>>24&255]},ZR=function(e){return e[3]<<24|e[2]<<16|e[1]<<8|e[0]},$R=function(e){return XR(e,23,4)},eA=function(e){return XR(e,52,8)},tA=function(e,t){AR(e.prototype,t,{get:function(){return DR(this)[t]}})},iA=function(e,t,i,r){var n=ER(i),o=DR(e);if(n+t>o.byteLength)throw zR(LR);var a=DR(o.buffer).bytes,s=n+o.byteOffset,c=OR(a,s,s+t);return r?c:WR(c)},rA=function(e,t,i,r,n,o){var a=ER(i),s=DR(e);if(a+t>s.byteLength)throw zR(LR);for(var c=DR(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(pR){var nA=NR&&xR.name!==MR;if(mR((function(){xR(1)}))&&mR((function(){new xR(-1)}))&&!mR((function(){return new xR,new xR(1.5),new xR(NaN),nA&&!PR})))nA&&PR&&fR(xR,"name",MR);else{(VR=function(e){return SR(this,FR),new xR(ER(e))}).prototype=FR;for(var oA,aA=RR(xR),sA=0;aA.length>sA;)(oA=aA[sA++])in VR||fR(VR,oA,xR[oA]);FR.constructor=VR}IR&&TR(jR)!==GR&&IR(jR,GR);var cA=new BR(new VR(2)),uA=lR(jR.setInt8);cA.setInt8(0,2147483648),cA.setInt8(1,2147483649),!cA.getInt8(0)&&cA.getInt8(1)||vR(jR,{setInt8:function(e,t){uA(this,e,t<<24>>24)},setUint8:function(e,t){uA(this,e,t<<24>>24)}},{unsafe:!0})}else FR=(VR=function(e){SR(this,FR);var t=ER(e);kR(this,{bytes:KR(HR(t),0),byteLength:t}),hR||(this.byteLength=t)}).prototype,jR=(BR=function(e,t,i){SR(this,jR),SR(e,FR);var r=DR(e).byteLength,n=yR(t);if(n<0||n>r)throw zR("Wrong offset");if(n+(i=void 0===i?r-n:gR(i))>r)throw zR("Wrong length");kR(this,{buffer:e,byteLength:i,byteOffset:n}),hR||(this.buffer=e,this.byteLength=i,this.byteOffset=n)}).prototype,hR&&(tA(VR,"byteLength"),tA(BR,"buffer"),tA(BR,"byteLength"),tA(BR,"byteOffset")),vR(jR,{getInt8:function(e){return iA(this,1,e)[0]<<24>>24},getUint8:function(e){return iA(this,1,e)[0]},getInt16:function(e){var t=iA(this,2,e,arguments.length>1?arguments[1]:void 0);return(t[1]<<8|t[0])<<16>>16},getUint16:function(e){var t=iA(this,2,e,arguments.length>1?arguments[1]:void 0);return t[1]<<8|t[0]},getInt32:function(e){return ZR(iA(this,4,e,arguments.length>1?arguments[1]:void 0))},getUint32:function(e){return ZR(iA(this,4,e,arguments.length>1?arguments[1]:void 0))>>>0},getFloat32:function(e){return YR(iA(this,4,e,arguments.length>1?arguments[1]:void 0),23)},getFloat64:function(e){return YR(iA(this,8,e,arguments.length>1?arguments[1]:void 0),52)},setInt8:function(e,t){rA(this,1,e,qR,t)},setUint8:function(e,t){rA(this,1,e,qR,t)},setInt16:function(e,t){rA(this,2,e,JR,t,arguments.length>2?arguments[2]:void 0)},setUint16:function(e,t){rA(this,2,e,JR,t,arguments.length>2?arguments[2]:void 0)},setInt32:function(e,t){rA(this,4,e,QR,t,arguments.length>2?arguments[2]:void 0)},setUint32:function(e,t){rA(this,4,e,QR,t,arguments.length>2?arguments[2]:void 0)},setFloat32:function(e,t){rA(this,4,e,$R,t,arguments.length>2?arguments[2]:void 0)},setFloat64:function(e,t){rA(this,8,e,eA,t,arguments.length>2?arguments[2]:void 0)}});wR(VR,MR),wR(BR,UR);var dA={ArrayBuffer:VR,DataView:BR},lA=Wr,hA=I,pA=a,_A=kt,fA=Zi,vA=tr,mA=uu,SA=dA.ArrayBuffer,yA=dA.DataView,gA=yA.prototype,EA=hA(SA.prototype.slice),bA=hA(gA.getUint8),TA=hA(gA.setUint8);lA({target:"ArrayBuffer",proto:!0,unsafe:!0,forced:pA((function(){return!new SA(2).slice(1,void 0).byteLength}))},{slice:function(e,t){if(EA&&void 0===t)return EA(_A(this),e);for(var i=_A(this).byteLength,r=fA(e,i),n=fA(void 0===t?i:t,i),o=new(mA(this,SA))(vA(n-r)),a=new yA(this),s=new yA(o),c=0;r<n;)TA(s,c++,bA(a,r++));return o}});var IA,RA,AA,CA={exports:{}},OA=YI,wA=s,NA=n,PA=B,DA=G,kA=xe,MA=lo,UA=pe,LA=Xt,xA=Yt.exports,VA=Ct.f,FA=X,BA=vh,jA=en,GA=$e,HA=Ge,zA=NA.Int8Array,KA=zA&&zA.prototype,WA=NA.Uint8ClampedArray,XA=WA&&WA.prototype,YA=zA&&BA(zA),qA=KA&&BA(KA),JA=Object.prototype,QA=NA.TypeError,ZA=GA("toStringTag"),$A=HA("TYPED_ARRAY_TAG"),eC=HA("TYPED_ARRAY_CONSTRUCTOR"),tC=OA&&!!jA&&"Opera"!==MA(NA.opera),iC=!1,rC={Int8Array:1,Uint8Array:1,Uint8ClampedArray:1,Int16Array:2,Uint16Array:2,Int32Array:4,Uint32Array:4,Float32Array:4,Float64Array:8},nC={BigInt64Array:8,BigUint64Array:8},oC=function(e){if(!DA(e))return!1;var t=MA(e);return kA(rC,t)||kA(nC,t)};for(IA in rC)(AA=(RA=NA[IA])&&RA.prototype)?LA(AA,eC,RA):tC=!1;for(IA in nC)(AA=(RA=NA[IA])&&RA.prototype)&&LA(AA,eC,RA);if((!tC||!PA(YA)||YA===Function.prototype)&&(YA=function(){throw QA("Incorrect invocation")},tC))for(IA in rC)NA[IA]&&jA(NA[IA],YA);if((!tC||!qA||qA===JA)&&(qA=YA.prototype,tC))for(IA in rC)NA[IA]&&jA(NA[IA].prototype,qA);if(tC&&BA(XA)!==qA&&jA(XA,qA),wA&&!kA(qA,ZA))for(IA in iC=!0,VA(qA,ZA,{get:function(){return DA(this)?this[$A]:void 0}}),rC)NA[IA]&&LA(NA[IA],$A,IA);var aC={NATIVE_ARRAY_BUFFER_VIEWS:tC,TYPED_ARRAY_CONSTRUCTOR:eC,TYPED_ARRAY_TAG:iC&&$A,aTypedArray:function(e){if(oC(e))return e;throw QA("Target is not a typed array")},aTypedArrayConstructor:function(e){if(PA(e)&&(!jA||FA(YA,e)))return e;throw QA(UA(e)+" is not a typed array constructor")},exportTypedArrayMethod:function(e,t,i,r){if(wA){if(i)for(var n in rC){var o=NA[n];if(o&&kA(o.prototype,e))try{delete o.prototype[e]}catch(i){try{o.prototype[e]=t}catch(e){}}}qA[e]&&!i||xA(qA,e,i?t:tC&&KA[e]||t,r)}},exportTypedArrayStaticMethod:function(e,t,i){var r,n;if(wA){if(jA){if(i)for(r in rC)if((n=NA[r])&&kA(n,e))try{delete n[e]}catch(e){}if(YA[e]&&!i)return;try{return xA(YA,e,i?t:tC&&YA[e]||t)}catch(e){}}for(r in rC)!(n=NA[r])||n[e]&&!i||xA(n,e,t)}},isView:function(e){if(!DA(e))return!1;var t=MA(e);return"DataView"===t||kA(rC,t)||kA(nC,t)},isTypedArray:oC,TypedArray:YA,TypedArrayPrototype:qA},sC=n,cC=a,uC=tu,dC=aC.NATIVE_ARRAY_BUFFER_VIEWS,lC=sC.ArrayBuffer,hC=sC.Int8Array,pC=!dC||!cC((function(){hC(1)}))||!cC((function(){new hC(-1)}))||!uC((function(e){new hC,new hC(null),new hC(1.5),new hC(e)}),!0)||cC((function(){return 1!==new hC(new lC(2),1,void 0).length})),_C=G,fC=Math.floor,vC=Number.isInteger||function(e){return!_C(e)&&isFinite(e)&&fC(e)===e},mC=Yi,SC=n.RangeError,yC=function(e){var t=mC(e);if(t<0)throw SC("The argument can't be less than 0");return t},gC=n.RangeError,EC=function(e,t){var i=yC(e);if(i%t)throw gC("Wrong offset");return i},bC=Wo,TC=l,IC=ou,RC=Me,AC=rr,CC=Oc,OC=Ec,wC=vc,NC=aC.aTypedArrayConstructor,PC=Wr,DC=n,kC=l,MC=s,UC=pC,LC=aC,xC=dA,VC=lc,FC=S,BC=Xt,jC=vC,GC=tr,HC=ZI,zC=EC,KC=lt,WC=xe,XC=lo,YC=G,qC=le,JC=Rn,QC=X,ZC=en,$C=Ki.f,eO=function(e){var t,i,r,n,o,a,s=IC(this),c=RC(e),u=arguments.length,d=u>1?arguments[1]:void 0,l=void 0!==d,h=OC(c);if(h&&!wC(h))for(a=(o=CC(c,h)).next,c=[];!(n=TC(a,o)).done;)c.push(n.value);for(l&&u>2&&(d=bC(d,arguments[2])),i=AC(c),r=new(NC(s))(i),t=0;i>t;t++)r[t]=l?d(c[t],t):c[t];return r},tO=ba.forEach,iO=cc,rO=Ct,nO=o,oO=oS,aO=Oi.get,sO=Oi.set,cO=rO.f,uO=nO.f,dO=Math.round,lO=DC.RangeError,hO=xC.ArrayBuffer,pO=hO.prototype,_O=xC.DataView,fO=LC.NATIVE_ARRAY_BUFFER_VIEWS,vO=LC.TYPED_ARRAY_CONSTRUCTOR,mO=LC.TYPED_ARRAY_TAG,SO=LC.TypedArray,yO=LC.TypedArrayPrototype,gO=LC.aTypedArrayConstructor,EO=LC.isTypedArray,bO="BYTES_PER_ELEMENT",TO="Wrong length",IO=function(e,t){gO(e);for(var i=0,r=t.length,n=new e(r);r>i;)n[i]=t[i++];return n},RO=function(e,t){cO(e,t,{get:function(){return aO(this)[t]}})},AO=function(e){var t;return QC(pO,e)||"ArrayBuffer"==(t=XC(e))||"SharedArrayBuffer"==t},CO=function(e,t){return EO(e)&&!qC(t)&&t in e&&jC(+t)&&t>=0},OO=function(e,t){return t=KC(t),CO(e,t)?FC(2,e[t]):uO(e,t)},wO=function(e,t,i){return t=KC(t),!(CO(e,t)&&YC(i)&&WC(i,"value"))||WC(i,"get")||WC(i,"set")||i.configurable||WC(i,"writable")&&!i.writable||WC(i,"enumerable")&&!i.enumerable?cO(e,t,i):(e[t]=i.value,e)};MC?(fO||(nO.f=OO,rO.f=wO,RO(yO,"buffer"),RO(yO,"byteOffset"),RO(yO,"byteLength"),RO(yO,"length")),PC({target:"Object",stat:!0,forced:!fO},{getOwnPropertyDescriptor:OO,defineProperty:wO}),CA.exports=function(e,t,i){var r=e.match(/\d+$/)[0]/8,n=e+(i?"Clamped":"")+"Array",o="get"+e,a="set"+e,s=DC[n],c=s,u=c&&c.prototype,d={},l=function(e,t){cO(e,t,{get:function(){return function(e,t){var i=aO(e);return i.view[o](t*r+i.byteOffset,!0)}(this,t)},set:function(e){return function(e,t,n){var o=aO(e);i&&(n=(n=dO(n))<0?0:n>255?255:255&n),o.view[a](t*r+o.byteOffset,n,!0)}(this,t,e)},enumerable:!0})};fO?UC&&(c=t((function(e,t,i,n){return VC(e,u),oO(YC(t)?AO(t)?void 0!==n?new s(t,zC(i,r),n):void 0!==i?new s(t,zC(i,r)):new s(t):EO(t)?IO(c,t):kC(eO,c,t):new s(HC(t)),e,c)})),ZC&&ZC(c,SO),tO($C(s),(function(e){e in c||BC(c,e,s[e])})),c.prototype=u):(c=t((function(e,t,i,n){VC(e,u);var o,a,s,d=0,h=0;if(YC(t)){if(!AO(t))return EO(t)?IO(c,t):kC(eO,c,t);o=t,h=zC(i,r);var p=t.byteLength;if(void 0===n){if(p%r)throw lO(TO);if((a=p-h)<0)throw lO(TO)}else if((a=GC(n)*r)+h>p)throw lO(TO);s=a/r}else s=HC(t),o=new hO(a=s*r);for(sO(e,{buffer:o,byteOffset:h,byteLength:a,length:s,view:new _O(o)});d<s;)l(e,d++)})),ZC&&ZC(c,SO),u=c.prototype=JC(yO)),u.constructor!==c&&BC(u,"constructor",c),BC(u,vO,c),mO&&BC(u,mO,n),d[n]=c,PC({global:!0,forced:c!=s,sham:!fO},d),bO in c||BC(c,bO,r),bO in u||BC(u,bO,r),iO(n)}):CA.exports=function(){},(0,CA.exports)("Uint8",(function(e){return function(t,i,r){return e(this,t,i,r)}}));var NO=Me,PO=Zi,DO=rr,kO=Math.min,MO=[].copyWithin||function(e,t){var i=NO(this),r=DO(i),n=PO(e,r),o=PO(t,r),a=arguments.length>2?arguments[2]:void 0,s=kO((void 0===a?r:PO(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},UO=aC,LO=I(MO),xO=UO.aTypedArray;(0,UO.exportTypedArrayMethod)("copyWithin",(function(e,t){return LO(xO(this),e,t,arguments.length>2?arguments[2]:void 0)}));var VO=ba.every,FO=aC.aTypedArray;(0,aC.exportTypedArrayMethod)("every",(function(e){return VO(FO(this),e,arguments.length>1?arguments[1]:void 0)}));var BO=l,jO=uR,GO=aC.aTypedArray;(0,aC.exportTypedArrayMethod)("fill",(function(e){var t=arguments.length;return BO(jO,GO(this),e,t>1?arguments[1]:void 0,t>2?arguments[2]:void 0)}));var HO=rr,zO=uu,KO=aC.TYPED_ARRAY_CONSTRUCTOR,WO=aC.aTypedArrayConstructor,XO=function(e){return WO(zO(e,e[KO]))},YO=function(e,t){for(var i=0,r=HO(t),n=new e(r);r>i;)n[i]=t[i++];return n},qO=XO,JO=ba.filter,QO=function(e,t){return YO(qO(e),t)},ZO=aC.aTypedArray;(0,aC.exportTypedArrayMethod)("filter",(function(e){var t=JO(ZO(this),e,arguments.length>1?arguments[1]:void 0);return QO(this,t)}));var $O=ba.find,ew=aC.aTypedArray;(0,aC.exportTypedArrayMethod)("find",(function(e){return $O(ew(this),e,arguments.length>1?arguments[1]:void 0)}));var tw=ba.findIndex,iw=aC.aTypedArray;(0,aC.exportTypedArrayMethod)("findIndex",(function(e){return tw(iw(this),e,arguments.length>1?arguments[1]:void 0)}));var rw=ba.forEach,nw=aC.aTypedArray;(0,aC.exportTypedArrayMethod)("forEach",(function(e){rw(nw(this),e,arguments.length>1?arguments[1]:void 0)}));var ow=cr.includes,aw=aC.aTypedArray;(0,aC.exportTypedArrayMethod)("includes",(function(e){return ow(aw(this),e,arguments.length>1?arguments[1]:void 0)}));var sw=cr.indexOf,cw=aC.aTypedArray;(0,aC.exportTypedArrayMethod)("indexOf",(function(e){return sw(cw(this),e,arguments.length>1?arguments[1]:void 0)}));var uw=n,dw=a,lw=I,hw=aC,pw=up,_w=$e("iterator"),fw=uw.Uint8Array,vw=lw(pw.values),mw=lw(pw.keys),Sw=lw(pw.entries),yw=hw.aTypedArray,gw=hw.exportTypedArrayMethod,Ew=fw&&fw.prototype,bw=!dw((function(){Ew[_w].call([1])})),Tw=!!Ew&&Ew.values&&Ew[_w]===Ew.values&&"values"===Ew.values.name,Iw=function(){return vw(yw(this))};gw("entries",(function(){return Sw(yw(this))}),bw),gw("keys",(function(){return mw(yw(this))}),bw),gw("values",Iw,bw||!Tw,{name:"values"}),gw(_w,Iw,bw||!Tw,{name:"values"});var Rw=aC.aTypedArray,Aw=aC.exportTypedArrayMethod,Cw=I([].join);Aw("join",(function(e){return Cw(Rw(this),e)}));var Ow=Zn,ww=F,Nw=Yi,Pw=rr,Dw=jn,kw=Math.min,Mw=[].lastIndexOf,Uw=!!Mw&&1/[1].lastIndexOf(1,-0)<0,Lw=Dw("lastIndexOf"),xw=Uw||!Lw?function(e){if(Uw)return Ow(Mw,this,arguments)||0;var t=ww(this),i=Pw(t),r=i-1;for(arguments.length>1&&(r=kw(r,Nw(arguments[1]))),r<0&&(r=i+r);r>=0;r--)if(r in t&&t[r]===e)return r||0;return-1}:Mw,Vw=Zn,Fw=xw,Bw=aC.aTypedArray;(0,aC.exportTypedArrayMethod)("lastIndexOf",(function(e){var t=arguments.length;return Vw(Fw,Bw(this),t>1?[e,arguments[1]]:[e])}));var jw=ba.map,Gw=XO,Hw=aC.aTypedArray;(0,aC.exportTypedArrayMethod)("map",(function(e){return jw(Hw(this),e,arguments.length>1?arguments[1]:void 0,(function(e,t){return new(Gw(e))(t)}))}));var zw=GS.left,Kw=aC.aTypedArray;(0,aC.exportTypedArrayMethod)("reduce",(function(e){var t=arguments.length;return zw(Kw(this),e,t,t>1?arguments[1]:void 0)}));var Ww=GS.right,Xw=aC.aTypedArray;(0,aC.exportTypedArrayMethod)("reduceRight",(function(e){var t=arguments.length;return Ww(Xw(this),e,t,t>1?arguments[1]:void 0)}));var Yw=aC.aTypedArray,qw=aC.exportTypedArrayMethod,Jw=Math.floor;qw("reverse",(function(){for(var e,t=this,i=Yw(t).length,r=Jw(i/2),n=0;n<r;)e=t[n],t[n++]=t[--i],t[i]=e;return t}));var Qw=n,Zw=l,$w=aC,eN=rr,tN=EC,iN=Me,rN=a,nN=Qw.RangeError,oN=Qw.Int8Array,aN=oN&&oN.prototype,sN=aN&&aN.set,cN=$w.aTypedArray,uN=$w.exportTypedArrayMethod,dN=!rN((function(){var e=new Uint8ClampedArray(2);return Zw(sN,e,{length:1,0:3},1),3!==e[1]})),lN=dN&&$w.NATIVE_ARRAY_BUFFER_VIEWS&&rN((function(){var e=new oN(2);return e.set(1),e.set("2",1),0!==e[0]||2!==e[1]}));uN("set",(function(e){cN(this);var t=tN(arguments.length>1?arguments[1]:void 0,1),i=iN(e);if(dN)return Zw(sN,this,i,t);var r=this.length,n=eN(i),o=0;if(n+t>r)throw nN("Wrong length");for(;o<n;)this[t+o]=i[o++]}),!dN||lN);var hN=XO,pN=Po,_N=aC.aTypedArray;(0,aC.exportTypedArrayMethod)("slice",(function(e,t){for(var i=pN(_N(this),e,t),r=hN(this),n=0,o=i.length,a=new r(o);o>n;)a[n]=i[n++];return a}),a((function(){new Int8Array(1).slice()})));var fN=ba.some,vN=aC.aTypedArray;(0,aC.exportTypedArrayMethod)("some",(function(e){return fN(vN(this),e,arguments.length>1?arguments[1]:void 0)}));var mN=n,SN=I,yN=a,gN=me,EN=bI,bN=aC,TN=II,IN=RI,RN=te,AN=CI,CN=mN.Array,ON=bN.aTypedArray,wN=bN.exportTypedArrayMethod,NN=mN.Uint16Array,PN=NN&&SN(NN.prototype.sort),DN=!(!PN||yN((function(){PN(new NN(2),null)}))&&yN((function(){PN(new NN(2),{})}))),kN=!!PN&&!yN((function(){if(RN)return RN<74;if(TN)return TN<67;if(IN)return!0;if(AN)return AN<602;var e,t,i=new NN(516),r=CN(516);for(e=0;e<516;e++)t=e%4,i[e]=515-e,r[e]=e-2*t+3;for(PN(i,(function(e,t){return(e/4|0)-(t/4|0)})),e=0;e<516;e++)if(i[e]!==r[e])return!0}));wN("sort",(function(e){return void 0!==e&&gN(e),kN?PN(this,e):EN(ON(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))}),!kN||DN);var MN=tr,UN=Zi,LN=XO,xN=aC.aTypedArray;(0,aC.exportTypedArrayMethod)("subarray",(function(e,t){var i=xN(this),r=i.length,n=UN(e,r);return new(LN(i))(i.buffer,i.byteOffset+n*i.BYTES_PER_ELEMENT,MN((void 0===t?r:UN(t,r))-n))}));var VN=Zn,FN=aC,BN=a,jN=Po,GN=n.Int8Array,HN=FN.aTypedArray,zN=FN.exportTypedArrayMethod,KN=[].toLocaleString,WN=!!GN&&BN((function(){KN.call(new GN(1))}));zN("toLocaleString",(function(){return VN(KN,WN?jN(HN(this)):HN(this),jN(arguments))}),BN((function(){return[1,2].toLocaleString()!=new GN([1,2]).toLocaleString()}))||!BN((function(){GN.prototype.toLocaleString.call([1,2])})));var XN=aC.exportTypedArrayMethod,YN=a,qN=I,JN=n.Uint8Array,QN=JN&&JN.prototype||{},ZN=[].toString,$N=qN([].join);YN((function(){ZN.call({})}))&&(ZN=function(){return $N(this)});var eP=QN.toString!=ZN;XN("toString",ZN,eP);var tP=Wr,iP=ba.findIndex,rP=ah,nP="findIndex",oP=!0;nP in[]&&Array(1).findIndex((function(){oP=!1})),tP({target:"Array",proto:!0,forced:oP},{findIndex:function(e){return iP(this,e,arguments.length>1?arguments[1]:void 0)}}),rP(nP);var aP,sP,cP=cc,uP="ArrayBuffer",dP=dA.ArrayBuffer;Wr({global:!0,forced:n.ArrayBuffer!==dP},{ArrayBuffer:dP}),cP(uP),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"}(aP||(aP={})),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"}(sP||(sP={}));var lP=function(e,t,i){this.code=e,this.message=t,this.error=i},hP=s,pP=I,_P=on,fP=F,vP=pP(h.f),mP=pP([].push),SP=function(e){return function(t){for(var i,r=fP(t),n=_P(r),o=n.length,a=0,s=[];o>a;)i=n[a++],hP&&!vP(r,i)||mP(s,e?[i,r[i]]:r[i]);return s}},yP={entries:SP(!0),values:SP(!1)}.entries;Wr({target:"Object",stat:!0},{entries:function(e){return yP(e)}});var gP=Yi,EP=_o,bP=L,TP=n.RangeError,IP=function(e){var t=EP(bP(this)),i="",r=gP(e);if(r<0||r==1/0)throw TP("Wrong number of repetitions");for(;r>0;(r>>>=1)&&(t+=t))1&r&&(i+=t);return i},RP=I,AP=tr,CP=_o,OP=L,wP=RP(IP),NP=RP("".slice),PP=Math.ceil,DP=function(e){return function(t,i,r){var n,o,a=CP(OP(t)),s=AP(i),c=a.length,u=void 0===r?" ":CP(r);return s<=c||""==u?a:((o=wP(u,PP((n=s-c)/u.length))).length>n&&(o=NP(o,0,n)),e?a+o:o+a)}},kP={start:DP(!1),end:DP(!0)},MP=/Version\/10(?:\.\d+){1,2}(?: [\w./]+)?(?: Mobile\/\w+)? Safari\//.test(Y),UP=kP.end;Wr({target:"String",proto:!0,forced:MP},{padEnd:function(e){return UP(this,e,arguments.length>1?arguments[1]:void 0)}});var LP=Pm;Wr({target:"Number",stat:!0,forced:Number.parseInt!=LP},{parseInt:LP});Wr({target:"ArrayBuffer",stat:!0,forced:!aC.NATIVE_ARRAY_BUFFER_VIEWS},{isView:aC.isView}),Wr({global:!0,forced:!YI},{DataView:dA.DataView});var xP=kt,VP=Dc,FP=Wo,BP=l,jP=Me,GP=function(e,t,i,r){try{return r?t(xP(i)[0],i[1]):t(i)}catch(t){VP(e,"throw",t)}},HP=vc,zP=aa,KP=rr,WP=yo,XP=Oc,YP=Ec,qP=n.Array,JP=function(e){var t=jP(e),i=zP(this),r=arguments.length,n=r>1?arguments[1]:void 0,o=void 0!==n;o&&(n=FP(n,r>2?arguments[2]:void 0));var a,s,c,u,d,l,h=YP(t),p=0;if(!h||this==qP&&HP(h))for(a=KP(t),s=i?new this(a):qP(a);a>p;p++)l=o?n(t[p],p):t[p],WP(s,p,l);else for(d=(u=XP(t,h)).next,s=i?new this:[];!(c=BP(d,u)).done;p++)l=o?GP(u,n,[c.value,p],!0):c.value,WP(s,p,l);return s.length=p,s},QP=JP;Wr({target:"Array",stat:!0,forced:!tu((function(e){Array.from(e)}))},{from:QP});var ZP=Wr,$P=eo,eD=I([].reverse),tD=[1,2];ZP({target:"Array",proto:!0,forced:String(tD)===String(tD.reverse())},{reverse:function(){return $P(this)&&(this.length=this.length),eD(this)}});var iD=Wr,rD=n,nD=I,oD=Yi,aD=jb,sD=IP,cD=a,uD=rD.RangeError,dD=rD.String,lD=Math.floor,hD=nD(sD),pD=nD("".slice),_D=nD(1..toFixed),fD=function(e,t,i){return 0===t?i:t%2==1?fD(e,t-1,i*e):fD(e*e,t/2,i)},vD=function(e,t,i){for(var r=-1,n=i;++r<6;)n+=t*e[r],e[r]=n%1e7,n=lD(n/1e7)},mD=function(e,t){for(var i=6,r=0;--i>=0;)r+=e[i],e[i]=lD(r/t),r=r%t*1e7},SD=function(e){for(var t=6,i="";--t>=0;)if(""!==i||0===t||0!==e[t]){var r=dD(e[t]);i=""===i?r:i+hD("0",7-r.length)+r}return i};iD({target:"Number",proto:!0,forced:cD((function(){return"0.000"!==_D(8e-5,3)||"1"!==_D(.9,0)||"1.25"!==_D(1.255,2)||"1000000000000000128"!==_D(0xde0b6b3a7640080,0)}))||!cD((function(){_D({})}))},{toFixed:function(e){var t,i,r,n,o=aD(this),a=oD(e),s=[0,0,0,0,0,0],c="",u="0";if(a<0||a>20)throw uD("Incorrect fraction digits");if(o!=o)return"NaN";if(o<=-1e21||o>=1e21)return dD(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*fD(2,69,1))-69)<0?o*fD(2,-t,1):o/fD(2,t,1),i*=4503599627370496,(t=52-t)>0){for(vD(s,0,i),r=a;r>=7;)vD(s,1e7,0),r-=7;for(vD(s,fD(10,r,1),0),r=t-1;r>=23;)mD(s,1<<23),r-=23;mD(s,1<<r),vD(s,1,1),mD(s,2),u=SD(s)}else vD(s,0,i),vD(s,1<<-t,0),u=SD(s)+hD("0",a);return u=a>0?c+((n=u.length)<=a?"0."+hD("0",a-n)+u:pD(u,0,n-a)+"."+pD(u,n-a)):c+u}});var yD=Math.log,gD=Math.LOG10E;Wr({target:"Math",stat:!0},{log10:Math.log10||function(e){return yD(e)*gD}});var ED,bD=Wr,TD=I,ID=o.f,RD=tr,AD=_o,CD=jf,OD=L,wD=Hf,ND=TD("".startsWith),PD=TD("".slice),DD=Math.min,kD=wD("startsWith"),MD=!kD&&!!function(){var e=ID(String.prototype,"startsWith");return e&&!e.writable}();bD({target:"String",proto:!0,forced:!MD&&!kD},{startsWith:function(e){var t=AD(OD(this));CD(e);var i=RD(DD(arguments.length>1?arguments[1]:void 0,t.length)),r=AD(e);return ND?ND(t,r,i):PD(t,i,i+r.length)===r}});var UD=new Uint8Array(16);function LD(){if(!ED&&!(ED="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 ED(UD)}var xD=/^(?:[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 VD(e){return"string"==typeof e&&xD.test(e)}for(var FD=[],BD=0;BD<256;++BD)FD.push((BD+256).toString(16).substr(1));function jD(e,t,i){var r=(e=e||{}).random||(e.rng||LD)();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=(FD[e[t+0]]+FD[e[t+1]]+FD[e[t+2]]+FD[e[t+3]]+"-"+FD[e[t+4]]+FD[e[t+5]]+"-"+FD[e[t+6]]+FD[e[t+7]]+"-"+FD[e[t+8]]+FD[e[t+9]]+"-"+FD[e[t+10]]+FD[e[t+11]]+FD[e[t+12]]+FD[e[t+13]]+FD[e[t+14]]+FD[e[t+15]]).toLowerCase();if(!VD(i))throw TypeError("Stringified UUID is invalid");return i}(r)}var GD=new TextDecoder,HD=new TextEncoder,zD=function(){return jD()},KD=function(){return Date.now()};function WD(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=rf(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=rf(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 XD=function(){return"undefined"==typeof window},YD=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=rf(Object.entries(i)),s=a.next();!s.done;s=a.next()){var c=nf(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 GD.decode(e)},e.ab2obj=function(t){try{var i=e.ab2str(t);return JSON.parse(i)}catch(e){return{}}},e.str2ab=function(e){return HD.encode(e).buffer},e.ab2b64str=function(e){return ef(this,void 0,void 0,(function(){return tf(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 ef(this,void 0,void 0,(function(){return tf(this,(function(t){return[2,fetch("data:application/octet;base64,"+e).then((function(e){return e.arrayBuffer()}))]}))}))},e}();function qD(){var e="none";return XD()||(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}function JD(){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 QD=function(){return Math.floor(65535*Math.random())};function ZD(e){return"string"==typeof e&&e.indexOf("__web__rtc__rtt__")>-1}function $D(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=of(of(of([],nf(a),!1),["..."],!1),nf(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 ek=function(e){return void 0===e&&(e=!1),ef(void 0,void 0,void 0,(function(){var t,i;return tf(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]}}))}))},tk=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 ik(e){return+Math.max(-127,10*Math.log10(Math.pow(e/255,2))).toFixed(2)}function rk(e){return(e&x_.AUDIO)===x_.AUDIO}function nk(e){return(e&x_.VIDEO)===x_.VIDEO}function ok(e){var i={};return Object.keys(e).forEach((function(r){"object"===t(e[r])?i[r]=ok(e[r]):r.startsWith("_")||(i[r]=e[r])})),i}function ak(e,t){if("boolean"!=typeof e)throw new lP(aP.INVALID_PARAMS,"Invalid ".concat(t,": The value should be boolean type."))}function sk(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 lP(aP.INVALID_PARAMS,"Invalid ".concat(t,": the value range is [").concat(i,", ").concat(r,"]. integer only"))}function ck(e,t,i,r){if(void 0===i&&(i=1),void 0===r&&(r=Number.POSITIVE_INFINITY),null==e)throw new lP(aP.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 lP(aP.INVALID_PARAMS,"Invalid ".concat(t,": The value should be string type. Length of the string: [").concat(i,",").concat(r,"]"))}function uk(e,t,i){if(!i.includes(e))throw new lP(aP.INVALID_PARAMS,"Invalid ".concat(t,": The value can only be set as ").concat(JSON.stringify(i)))}function dk(e,t){if(pk(e))throw new lP(aP.INVALID_PARAMS,"Invalid ".concat(t,", should not be empty"))}function lk(e,t){if(!(e instanceof ArrayBuffer))throw new lP(aP.INVALID_PARAMS,"Invalid ".concat(t,", should be ArrayBuffer"))}function hk(e){var t,i;try{var r=navigator.mediaDevices.getSupportedConstraints();try{for(var n=rf(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){}}function pk(e){return null==e}function _k(e){if("string"!=typeof e||!/^[a-zA-Z0-9@._\-]{1,128}$/.test(e))throw new lP(aP.INVALID_PARAMS,"The userId must be within 128 bytes. The supported characters: a-z,A-Z,0-9,@,-,_,.")}function fk(e){if("string"!=typeof e||!/^[a-zA-Z0-9@._\-]{1,128}$/.test(e))throw new lP(aP.INVALID_PARAMS,"The publicStreamId must be within 128 bytes. The supported characters: a-z,A-Z,0-9,@,-,_,.")}function vk(e){dk(e,"videoPlayerOption")}function mk(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 lP(aP.INVALID_PARAMS,"The message cannot be empty");if((null==(r=e instanceof ArrayBuffer?e:YD.str2ab(JSON.stringify(e)))?void 0:r.byteLength)>1e3*t)throw new lP(aP.INVALID_PARAMS,"The message length must be less than ".concat(t,"K"))}function Sk(e){return![df.onRemoteStreamStats,df.onLocalStreamStats,df.onAudioVolumeIndication,df.onLocalAudioPropertiesReport,df.onRemoteAudioPropertiesReport].includes(e)}var yk={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}(yk);var gk=yk.exports,Ek="[VERTC]",bk=["#0050b3","#0050b3","#0050b3","#0050b3","#0050b3"],Tk=!XD()&&window.location.search.includes("_rtc_debug_"),Ik=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(Tk){for(var r="",n=0;n<this._indent;n++)r+=" ";console.log.apply(console,of(["%c".concat(Ek).concat(r,"[").concat(this._module,".").concat(e,"] ").concat(t.shift()),"color:".concat(bk[this._indent],";")],nf(t),!1))}},e}(),Rk=new Ik("VERTC",0),Ak=function(e){function t(){return e.call(this)||this}return A_(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,of([t],nf(i),!1))}catch(e){return Rk.print("safaEmit","safeEmit() | event listener threw an error [event:%s]:%o",t,e),Boolean(n)}},t.prototype.safeEmitAsPromise=function(e){for(var t=[],i=1;i<arguments.length;i++)t[i-1]=arguments[i];return ef(this,void 0,void 0,(function(){var i=this;return tf(this,(function(r){return[2,new Promise((function(r,n){try{i.emit.apply(i,of(of([e],nf(t),!1),[r,n],!1))}catch(t){Rk.print("safeEmitAsPromise","safeEmitAsPromise() | event listener threw an error [event:%s]:%o",e,t),n(t)}}))]}))}))},t}(yk.exports.EventEmitter),Ck=xe,Ok=function(e){return void 0!==e&&(Ck(e,"value")||Ck(e,"writable"))},wk=l,Nk=G,Pk=kt,Dk=Ok,kk=o,Mk=vh;Wr({target:"Reflect",stat:!0},{get:function e(t,i){var r,n,o=arguments.length<3?t:arguments[2];return Pk(t)===o?t[i]:(r=kk.f(t,i))?Dk(r)?r.value:void 0===r.get?void 0:wk(r.get,o):Nk(n=Mk(t))?e(n,i,o):void 0}});var Uk=Wr,Lk=l,xk=kt,Vk=G,Fk=Ok,Bk=Ct,jk=o,Gk=vh,Hk=S;var zk=a((function(){var e=function(){},t=Bk.f(new e,"a",{configurable:!0});return!1!==Reflect.set(e.prototype,"a",1,t)}));Uk({target:"Reflect",stat:!0,forced:zk},{set:function e(t,i,r){var n,o,a,s=arguments.length<4?t:arguments[3],c=jk.f(xk(t),i);if(!c){if(Vk(o=Gk(t)))return e(o,i,r,s);c=Hk(0)}if(Fk(c)){if(!1===c.writable||!Vk(s))return!1;if(n=jk.f(s,i)){if(n.get||n.set||!1===n.writable)return!1;n.value=r,Bk.f(s,i,n)}else Bk.f(s,i,Hk(0,r))}else{if(void 0===(a=c.set))return!1;Lk(a,s,r)}return!0}}),(0,CA.exports)("Uint16",(function(e){return function(t,i,r){return e(this,t,i,r)}})),(0,CA.exports)("Int32",(function(e){return function(t,i,r){return e(this,t,i,r)}}));var Kk={};!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)}(Kk);var Wk={},Xk={},Yk={},qk=Kk;function Jk(e){for(var t=e.length;--t>=0;)e[t]=0}var Qk=256,Zk=286,$k=30,eM=15,tM=[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],iM=[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],rM=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],nM=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],oM=new Array(576);Jk(oM);var aM=new Array(60);Jk(aM);var sM=new Array(512);Jk(sM);var cM=new Array(256);Jk(cM);var uM=new Array(29);Jk(uM);var dM,lM,hM,pM=new Array($k);function _M(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 fM(e,t){this.dyn_tree=e,this.max_code=0,this.stat_desc=t}function vM(e){return e<256?sM[e]:sM[256+(e>>>7)]}function mM(e,t){e.pending_buf[e.pending++]=255&t,e.pending_buf[e.pending++]=t>>>8&255}function SM(e,t,i){e.bi_valid>16-i?(e.bi_buf|=t<<e.bi_valid&65535,mM(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 yM(e,t,i){SM(e,i[2*t],i[2*t+1])}function gM(e,t){var i=0;do{i|=1&e,e>>>=1,i<<=1}while(--t>0);return i>>>1}function EM(e,t,i){var r,n,o=new Array(16),a=0;for(r=1;r<=eM;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]=gM(o[s]++,s))}}function bM(e){var t;for(t=0;t<Zk;t++)e.dyn_ltree[2*t]=0;for(t=0;t<$k;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 TM(e){e.bi_valid>8?mM(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 IM(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 RM(e,t,i){for(var r=e.heap[i],n=i<<1;n<=e.heap_len&&(n<e.heap_len&&IM(t,e.heap[n+1],e.heap[n],e.depth)&&n++,!IM(t,r,e.heap[n],e.depth));)e.heap[i]=e.heap[n],i=n,n<<=1;e.heap[i]=r}function AM(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?yM(e,n,t):(yM(e,(o=cM[n])+Qk+1,t),0!==(a=tM[o])&&SM(e,n-=uM[o],a),yM(e,o=vM(--r),i),0!==(a=iM[o])&&SM(e,r-=pM[o],a))}while(s<e.last_lit);yM(e,256,t)}function CM(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--)RM(e,o,i);n=c;do{i=e.heap[1],e.heap[1]=e.heap[e.heap_len--],RM(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++,RM(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<=eM;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),EM(o,u,e.bl_count)}function OM(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 wM(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{yM(e,n,e.bl_tree)}while(0!=--s);else 0!==n?(n!==o&&(yM(e,n,e.bl_tree),s--),yM(e,16,e.bl_tree),SM(e,s-3,2)):s<=10?(yM(e,17,e.bl_tree),SM(e,s-3,3)):(yM(e,18,e.bl_tree),SM(e,s-11,7));s=0,o=n,0===a?(c=138,u=3):n===a?(c=6,u=3):(c=7,u=4)}}Jk(pM);var NM=!1;function PM(e,t,i,r){SM(e,0+(r?1:0),3),function(e,t,i,r){TM(e),r&&(mM(e,i),mM(e,~i)),qk.arraySet(e.pending_buf,e.window,t,i,e.pending),e.pending+=i}(e,t,i,!0)}Yk._tr_init=function(e){NM||(!function(){var e,t,i,r,n,o=new Array(16);for(i=0,r=0;r<28;r++)for(uM[r]=i,e=0;e<1<<tM[r];e++)cM[i++]=r;for(cM[i-1]=r,n=0,r=0;r<16;r++)for(pM[r]=n,e=0;e<1<<iM[r];e++)sM[n++]=r;for(n>>=7;r<$k;r++)for(pM[r]=n<<7,e=0;e<1<<iM[r]-7;e++)sM[256+n++]=r;for(t=0;t<=eM;t++)o[t]=0;for(e=0;e<=143;)oM[2*e+1]=8,e++,o[8]++;for(;e<=255;)oM[2*e+1]=9,e++,o[9]++;for(;e<=279;)oM[2*e+1]=7,e++,o[7]++;for(;e<=287;)oM[2*e+1]=8,e++,o[8]++;for(EM(oM,287,o),e=0;e<$k;e++)aM[2*e+1]=5,aM[2*e]=gM(e,5);dM=new _M(oM,tM,257,Zk,eM),lM=new _M(aM,iM,0,$k,eM),hM=new _M(new Array(0),rM,0,19,7)}(),NM=!0),e.l_desc=new fM(e.dyn_ltree,dM),e.d_desc=new fM(e.dyn_dtree,lM),e.bl_desc=new fM(e.bl_tree,hM),e.bi_buf=0,e.bi_valid=0,bM(e)},Yk._tr_stored_block=PM,Yk._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<Qk;t++)if(0!==e.dyn_ltree[2*t])return 1;return 0}(e)),CM(e,e.l_desc),CM(e,e.d_desc),a=function(e){var t;for(OM(e,e.dyn_ltree,e.l_desc.max_code),OM(e,e.dyn_dtree,e.d_desc.max_code),CM(e,e.bl_desc),t=18;t>=3&&0===e.bl_tree[2*nM[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?PM(e,t,i,r):4===e.strategy||o===n?(SM(e,2+(r?1:0),3),AM(e,oM,aM)):(SM(e,4+(r?1:0),3),function(e,t,i,r){var n;for(SM(e,t-257,5),SM(e,i-1,5),SM(e,r-4,4),n=0;n<r;n++)SM(e,e.bl_tree[2*nM[n]+1],3);wM(e,e.dyn_ltree,t-1),wM(e,e.dyn_dtree,i-1)}(e,e.l_desc.max_code+1,e.d_desc.max_code+1,a+1),AM(e,e.dyn_ltree,e.dyn_dtree)),bM(e),r&&TM(e)},Yk._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*(cM[i]+Qk+1)]++,e.dyn_dtree[2*vM(t)]++),e.last_lit===e.lit_bufsize-1},Yk._tr_align=function(e){SM(e,2,3),yM(e,256,oM),function(e){16===e.bi_valid?(mM(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 DM=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 kM=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 MM,UM=function(e,t,i,r){var n=kM,o=r+i;e^=-1;for(var a=r;a<o;a++)e=e>>>8^n[255&(e^t[a])];return-1^e},LM={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"},xM=Kk,VM=Yk,FM=DM,BM=UM,jM=LM,GM=-2,HM=258,zM=262,KM=103,WM=113,XM=666;function YM(e,t){return e.msg=jM[t],t}function qM(e){return(e<<1)-(e>4?9:0)}function JM(e){for(var t=e.length;--t>=0;)e[t]=0}function QM(e){var t=e.state,i=t.pending;i>e.avail_out&&(i=e.avail_out),0!==i&&(xM.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 ZM(e,t){VM._tr_flush_block(e,e.block_start>=0?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,QM(e.strm)}function $M(e,t){e.pending_buf[e.pending++]=t}function eU(e,t){e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=255&t}function tU(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-zM?e.strstart-(e.w_size-zM):0,u=e.window,d=e.w_mask,l=e.prev,h=e.strstart+HM,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=HM-(h-o),o=h-HM,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 iU(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-zM)){xM.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,xM.arraySet(s,a.input,a.next_in,d,c),1===a.state.wrap?a.adler=FM(a.adler,s,d,c):2===a.state.wrap&&(a.adler=BM(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<zM&&0!==e.strm.avail_in)}function rU(e,t){for(var i,r;;){if(e.lookahead<zM){if(iU(e),e.lookahead<zM&&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-zM&&(e.match_length=tU(e,i)),e.match_length>=3)if(r=VM._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=VM._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++;if(r&&(ZM(e,!1),0===e.strm.avail_out))return 1}return e.insert=e.strstart<2?e.strstart:2,4===t?(ZM(e,!0),0===e.strm.avail_out?3:4):e.last_lit&&(ZM(e,!1),0===e.strm.avail_out)?1:2}function nU(e,t){for(var i,r,n;;){if(e.lookahead<zM){if(iU(e),e.lookahead<zM&&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-zM&&(e.match_length=tU(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=VM._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&&(ZM(e,!1),0===e.strm.avail_out))return 1}else if(e.match_available){if((r=VM._tr_tally(e,0,e.window[e.strstart-1]))&&ZM(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=VM._tr_tally(e,0,e.window[e.strstart-1]),e.match_available=0),e.insert=e.strstart<2?e.strstart:2,4===t?(ZM(e,!0),0===e.strm.avail_out?3:4):e.last_lit&&(ZM(e,!1),0===e.strm.avail_out)?1:2}function oU(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 aU(){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 xM.Buf16(1146),this.dyn_dtree=new xM.Buf16(122),this.bl_tree=new xM.Buf16(78),JM(this.dyn_ltree),JM(this.dyn_dtree),JM(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new xM.Buf16(16),this.heap=new xM.Buf16(573),JM(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new xM.Buf16(573),JM(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 sU(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:WM,e.adler=2===t.wrap?0:1,t.last_flush=0,VM._tr_init(t),0):YM(e,GM)}function cU(e){var t,i=sU(e);return 0===i&&((t=e.state).window_size=2*t.w_size,JM(t.head),t.max_lazy_match=MM[t.level].max_lazy,t.good_match=MM[t.level].good_length,t.nice_match=MM[t.level].nice_length,t.max_chain_length=MM[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 uU(e,t,i,r,n,o){if(!e)return GM;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 YM(e,GM);8===r&&(r=9);var s=new aU;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 xM.Buf8(2*s.w_size),s.head=new xM.Buf16(s.hash_size),s.prev=new xM.Buf16(s.w_size),s.lit_bufsize=1<<n+6,s.pending_buf_size=4*s.lit_bufsize,s.pending_buf=new xM.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,cU(e)}MM=[new oU(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(iU(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,ZM(e,!1),0===e.strm.avail_out))return 1;if(e.strstart-e.block_start>=e.w_size-zM&&(ZM(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,4===t?(ZM(e,!0),0===e.strm.avail_out?3:4):(e.strstart>e.block_start&&(ZM(e,!1),e.strm.avail_out),1)})),new oU(4,4,8,4,rU),new oU(4,5,16,8,rU),new oU(4,6,32,32,rU),new oU(4,4,16,16,nU),new oU(8,16,32,32,nU),new oU(8,16,128,128,nU),new oU(8,32,128,256,nU),new oU(32,128,258,1024,nU),new oU(32,258,258,4096,nU)],Xk.deflateInit=function(e,t){return uU(e,t,8,15,8,0)},Xk.deflateInit2=uU,Xk.deflateReset=cU,Xk.deflateResetKeep=sU,Xk.deflateSetHeader=function(e,t){return e&&e.state?2!==e.state.wrap?GM:(e.state.gzhead=t,0):GM},Xk.deflate=function(e,t){var i,r,n,o;if(!e||!e.state||t>5||t<0)return e?YM(e,GM):GM;if(r=e.state,!e.output||!e.input&&0!==e.avail_in||r.status===XM&&4!==t)return YM(e,0===e.avail_out?-5:GM);if(r.strm=e,i=r.last_flush,r.last_flush=t,42===r.status)if(2===r.wrap)e.adler=0,$M(r,31),$M(r,139),$M(r,8),r.gzhead?($M(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)),$M(r,255&r.gzhead.time),$M(r,r.gzhead.time>>8&255),$M(r,r.gzhead.time>>16&255),$M(r,r.gzhead.time>>24&255),$M(r,9===r.level?2:r.strategy>=2||r.level<2?4:0),$M(r,255&r.gzhead.os),r.gzhead.extra&&r.gzhead.extra.length&&($M(r,255&r.gzhead.extra.length),$M(r,r.gzhead.extra.length>>8&255)),r.gzhead.hcrc&&(e.adler=BM(e.adler,r.pending_buf,r.pending,0)),r.gzindex=0,r.status=69):($M(r,0),$M(r,0),$M(r,0),$M(r,0),$M(r,0),$M(r,9===r.level?2:r.strategy>=2||r.level<2?4:0),$M(r,3),r.status=WM);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=WM,eU(r,a),0!==r.strstart&&(eU(r,e.adler>>>16),eU(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=BM(e.adler,r.pending_buf,r.pending-n,n)),QM(e),n=r.pending,r.pending!==r.pending_buf_size));)$M(r,255&r.gzhead.extra[r.gzindex]),r.gzindex++;r.gzhead.hcrc&&r.pending>n&&(e.adler=BM(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=BM(e.adler,r.pending_buf,r.pending-n,n)),QM(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,$M(r,o)}while(0!==o);r.gzhead.hcrc&&r.pending>n&&(e.adler=BM(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=BM(e.adler,r.pending_buf,r.pending-n,n)),QM(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,$M(r,o)}while(0!==o);r.gzhead.hcrc&&r.pending>n&&(e.adler=BM(e.adler,r.pending_buf,r.pending-n,n)),0===o&&(r.status=KM)}else r.status=KM;if(r.status===KM&&(r.gzhead.hcrc?(r.pending+2>r.pending_buf_size&&QM(e),r.pending+2<=r.pending_buf_size&&($M(r,255&e.adler),$M(r,e.adler>>8&255),e.adler=0,r.status=WM)):r.status=WM),0!==r.pending){if(QM(e),0===e.avail_out)return r.last_flush=-1,0}else if(0===e.avail_in&&qM(t)<=qM(i)&&4!==t)return YM(e,-5);if(r.status===XM&&0!==e.avail_in)return YM(e,-5);if(0!==e.avail_in||0!==r.lookahead||0!==t&&r.status!==XM){var s=2===r.strategy?function(e,t){for(var i;;){if(0===e.lookahead&&(iU(e),0===e.lookahead)){if(0===t)return 1;break}if(e.match_length=0,i=VM._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,i&&(ZM(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,4===t?(ZM(e,!0),0===e.strm.avail_out?3:4):e.last_lit&&(ZM(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<=HM){if(iU(e),e.lookahead<=HM&&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+HM;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=HM-(o-n),e.match_length>e.lookahead&&(e.match_length=e.lookahead)}if(e.match_length>=3?(i=VM._tr_tally(e,1,e.match_length-3),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(i=VM._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),i&&(ZM(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,4===t?(ZM(e,!0),0===e.strm.avail_out?3:4):e.last_lit&&(ZM(e,!1),0===e.strm.avail_out)?1:2}(r,t):MM[r.level].func(r,t);if(3!==s&&4!==s||(r.status=XM),1===s||3===s)return 0===e.avail_out&&(r.last_flush=-1),0;if(2===s&&(1===t?VM._tr_align(r):5!==t&&(VM._tr_stored_block(r,0,0,!1),3===t&&(JM(r.head),0===r.lookahead&&(r.strstart=0,r.block_start=0,r.insert=0))),QM(e),0===e.avail_out))return r.last_flush=-1,0}return 4!==t?0:r.wrap<=0?1:(2===r.wrap?($M(r,255&e.adler),$M(r,e.adler>>8&255),$M(r,e.adler>>16&255),$M(r,e.adler>>24&255),$M(r,255&e.total_in),$M(r,e.total_in>>8&255),$M(r,e.total_in>>16&255),$M(r,e.total_in>>24&255)):(eU(r,e.adler>>>16),eU(r,65535&e.adler)),QM(e),r.wrap>0&&(r.wrap=-r.wrap),0!==r.pending?0:1)},Xk.deflateEnd=function(e){var t;return e&&e.state?42!==(t=e.state.status)&&69!==t&&73!==t&&91!==t&&t!==KM&&t!==WM&&t!==XM?YM(e,GM):(e.state=null,t===WM?YM(e,-3):0):GM},Xk.deflateSetDictionary=function(e,t){var i,r,n,o,a,s,c,u,d=t.length;if(!e||!e.state)return GM;if(2===(o=(i=e.state).wrap)||1===o&&42!==i.status||i.lookahead)return GM;for(1===o&&(e.adler=FM(e.adler,t,d,0)),i.wrap=0,d>=i.w_size&&(0===o&&(JM(i.head),i.strstart=0,i.block_start=0,i.insert=0),u=new xM.Buf8(i.w_size),xM.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,iU(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,iU(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},Xk.deflateInfo="pako deflate (from Nodeca project)";var dU={},lU=Kk,hU=!0,pU=!0;try{String.fromCharCode.apply(null,[0])}catch(e){hU=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(e){pU=!1}for(var _U=new lU.Buf8(256),fU=0;fU<256;fU++)_U[fU]=fU>=252?6:fU>=248?5:fU>=240?4:fU>=224?3:fU>=192?2:1;function vU(e,t){if(t<65534&&(e.subarray&&pU||!e.subarray&&hU))return String.fromCharCode.apply(null,lU.shrinkBuf(e,t));for(var i="",r=0;r<t;r++)i+=String.fromCharCode(e[r]);return i}_U[254]=_U[254]=1,dU.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 lU.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},dU.buf2binstring=function(e){return vU(e,e.length)},dU.binstring2buf=function(e){for(var t=new lU.Buf8(e.length),i=0,r=t.length;i<r;i++)t[i]=e.charCodeAt(i);return t},dU.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=_U[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 vU(s,r)},dU.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+_U[e[i]]>t?i:t};var mU=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0},SU=Xk,yU=Kk,gU=dU,EU=LM,bU=mU,TU=Object.prototype.toString;function IU(e){if(!(this instanceof IU))return new IU(e);this.options=yU.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 bU,this.strm.avail_out=0;var i=SU.deflateInit2(this.strm,t.level,t.method,t.windowBits,t.memLevel,t.strategy);if(0!==i)throw new Error(EU[i]);if(t.header&&SU.deflateSetHeader(this.strm,t.header),t.dictionary){var r;if(r="string"==typeof t.dictionary?gU.string2buf(t.dictionary):"[object ArrayBuffer]"===TU.call(t.dictionary)?new Uint8Array(t.dictionary):t.dictionary,0!==(i=SU.deflateSetDictionary(this.strm,r)))throw new Error(EU[i]);this._dict_set=!0}}function RU(e,t){var i=new IU(t);if(i.push(e,!0),i.err)throw i.msg||EU[i.err];return i.result}IU.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=gU.string2buf(e):"[object ArrayBuffer]"===TU.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 yU.Buf8(o),n.next_out=0,n.avail_out=o),1!==(i=SU.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(gU.buf2binstring(yU.shrinkBuf(n.output,n.next_out))):this.onData(yU.shrinkBuf(n.output,n.next_out)))}while((n.avail_in>0||0===n.avail_out)&&1!==i);return 4===r?(i=SU.deflateEnd(this.strm),this.onEnd(i),this.ended=!0,0===i):2!==r||(this.onEnd(0),n.avail_out=0,!0)},IU.prototype.onData=function(e){this.chunks.push(e)},IU.prototype.onEnd=function(e){0===e&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=yU.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg},Wk.Deflate=IU,Wk.deflate=RU,Wk.deflateRaw=function(e,t){return(t=t||{}).raw=!0,RU(e,t)},Wk.gzip=function(e,t){return(t=t||{}).gzip=!0,RU(e,t)};var AU={},CU=s,OU=Ct,wU=Qf,NU=a,PU=RegExp.prototype;CU&&NU((function(){return"sy"!==Object.getOwnPropertyDescriptor(PU,"flags").get.call({dotAll:!0,sticky:!0})}))&&OU.f(PU,"flags",{configurable:!0,get:wU});var DU={},kU=Kk,MU=15,UU=[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],LU=[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],xU=[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],VU=[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],FU=Kk,BU=DM,jU=UM,GU=function(e,t){var i,r,n,o,a,s,c,u,d,l,h,p,_,f,v,m,S,y,g,E,b,T,I,R,A;i=e.state,r=e.next_in,R=e.input,n=r+(e.avail_in-5),o=e.next_out,A=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,S=(1<<i.distbits)-1;e:do{_<15&&(p+=R[r++]<<_,_+=8,p+=R[r++]<<_,_+=8),y=f[p&m];t:for(;;){if(p>>>=g=y>>>24,_-=g,0===(g=y>>>16&255))A[o++]=65535&y;else{if(!(16&g)){if(0==(64&g)){y=f[(65535&y)+(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&y,(g&=15)&&(_<g&&(p+=R[r++]<<_,_+=8),E+=p&(1<<g)-1,p>>>=g,_-=g),_<15&&(p+=R[r++]<<_,_+=8,p+=R[r++]<<_,_+=8),y=v[p&S];i:for(;;){if(p>>>=g=y>>>24,_-=g,!(16&(g=y>>>16&255))){if(0==(64&g)){y=v[(65535&y)+(p&(1<<g)-1)];continue i}e.msg="invalid distance code",i.mode=30;break e}if(b=65535&y,_<(g&=15)&&(p+=R[r++]<<_,(_+=8)<g&&(p+=R[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(T=0,I=h,0===l){if(T+=u-g,g<E){E-=g;do{A[o++]=h[T++]}while(--g);T=o-b,I=A}}else if(l<g){if(T+=u+l-g,(g-=l)<E){E-=g;do{A[o++]=h[T++]}while(--g);if(T=0,l<E){E-=g=l;do{A[o++]=h[T++]}while(--g);T=o-b,I=A}}}else if(T+=l-g,g<E){E-=g;do{A[o++]=h[T++]}while(--g);T=o-b,I=A}for(;E>2;)A[o++]=I[T++],A[o++]=I[T++],A[o++]=I[T++],E-=3;E&&(A[o++]=I[T++],E>1&&(A[o++]=I[T++]))}else{T=o-b;do{A[o++]=A[T++],A[o++]=A[T++],A[o++]=A[T++],E-=3}while(E>2);E&&(A[o++]=A[T++],E>1&&(A[o++]=A[T++]))}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=_},HU=function(e,t,i,r,n,o,a,s){var c,u,d,l,h,p,_,f,v,m=s.bits,S=0,y=0,g=0,E=0,b=0,T=0,I=0,R=0,A=0,C=0,O=null,w=0,N=new kU.Buf16(16),P=new kU.Buf16(16),D=null,k=0;for(S=0;S<=MU;S++)N[S]=0;for(y=0;y<r;y++)N[t[i+y]]++;for(b=m,E=MU;E>=1&&0===N[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===N[g];g++);for(b<g&&(b=g),R=1,S=1;S<=MU;S++)if(R<<=1,(R-=N[S])<0)return-1;if(R>0&&(0===e||1!==E))return-1;for(P[1]=0,S=1;S<MU;S++)P[S+1]=P[S]+N[S];for(y=0;y<r;y++)0!==t[i+y]&&(a[P[t[i+y]]++]=y);if(0===e?(O=D=a,p=19):1===e?(O=UU,w-=257,D=LU,k-=257,p=256):(O=xU,D=VU,p=-1),C=0,y=0,S=g,h=o,T=b,I=0,d=-1,l=(A=1<<b)-1,1===e&&A>852||2===e&&A>592)return 1;for(;;){_=S-I,a[y]<p?(f=0,v=a[y]):a[y]>p?(f=D[k+a[y]],v=O[w+a[y]]):(f=96,v=0),c=1<<S-I,g=u=1<<T;do{n[h+(C>>I)+(u-=c)]=_<<24|f<<16|v|0}while(0!==u);for(c=1<<S-1;C&c;)c>>=1;if(0!==c?(C&=c-1,C+=c):C=0,y++,0==--N[S]){if(S===E)break;S=t[i+a[y]]}if(S>b&&(C&l)!==d){for(0===I&&(I=b),h+=g,R=1<<(T=S-I);T+I<E&&!((R-=N[T+I])<=0);)T++,R<<=1;if(A+=1<<T,1===e&&A>852||2===e&&A>592)return 1;n[d=C&l]=b<<24|T<<16|h-o|0}}return 0!==C&&(n[h+C]=S-I<<24|64<<16|0),s.bits=b,0},zU=-2,KU=12,WU=30;function XU(e){return(e>>>24&255)+(e>>>8&65280)+((65280&e)<<8)+((255&e)<<24)}function YU(){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 FU.Buf16(320),this.work=new FU.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function qU(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 FU.Buf32(852),t.distcode=t.distdyn=new FU.Buf32(592),t.sane=1,t.back=-1,0):zU}function JU(e){var t;return e&&e.state?((t=e.state).wsize=0,t.whave=0,t.wnext=0,qU(e)):zU}function QU(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)?zU:(null!==r.window&&r.wbits!==t&&(r.window=null),r.wrap=i,r.wbits=t,JU(e))):zU}function ZU(e,t){var i,r;return e?(r=new YU,e.state=r,r.window=null,0!==(i=QU(e,t))&&(e.state=null),i):zU}var $U,eL,tL=!0;function iL(e){if(tL){var t;for($U=new FU.Buf32(512),eL=new FU.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(HU(1,e.lens,0,288,$U,0,e.work,{bits:9}),t=0;t<32;)e.lens[t++]=5;HU(2,e.lens,0,32,eL,0,e.work,{bits:5}),tL=!1}e.lencode=$U,e.lenbits=9,e.distcode=eL,e.distbits=5}function rL(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 FU.Buf8(o.wsize)),r>=o.wsize?(FU.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),FU.arraySet(o.window,t,i-r,n,o.wnext),(r-=n)?(FU.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}DU.inflateReset=JU,DU.inflateReset2=QU,DU.inflateResetKeep=qU,DU.inflateInit=function(e){return ZU(e,15)},DU.inflateInit2=ZU,DU.inflate=function(e,t){var i,r,n,o,a,s,c,u,d,l,h,p,_,f,v,m,S,y,g,E,b,T,I,R,A=0,C=new FU.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 zU;(i=e.state).mode===KU&&(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,T=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=jU(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=WU;break}if(8!=(15&u)){e.msg="unknown compression method",i.mode=WU;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=WU;break}i.dmax=1<<b,e.adler=i.check=1,i.mode=512&u?10:KU,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=WU;break}if(57344&i.flags){e.msg="unknown header flags set",i.mode=WU;break}i.head&&(i.head.text=u>>8&1),512&i.flags&&(C[0]=255&u,C[1]=u>>>8&255,i.check=jU(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=jU(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=jU(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=jU(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)),FU.arraySet(i.head.extra,r,o,p,b)),512&i.flags&&(i.check=jU(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=jU(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=jU(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=WU;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=KU;break;case 10:for(;d<32;){if(0===s)break e;s--,u+=r[o++]<<d,d+=8}e.adler=i.check=XU(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=KU;case KU: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(iL(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=WU}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=WU;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;FU.arraySet(n,r,o,p,a),s-=p,o+=p,c-=p,a+=p,i.length-=p;break}i.mode=KU;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=WU;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,I={bits:i.lenbits},T=HU(0,i.lens,0,19,i.lencode,0,i.work,I),i.lenbits=I.bits,T){e.msg="invalid code lengths set",i.mode=WU;break}i.have=0,i.mode=19;case 19:for(;i.have<i.nlen+i.ndist;){for(;m=(A=i.lencode[u&(1<<i.lenbits)-1])>>>16&255,S=65535&A,!((v=A>>>24)<=d);){if(0===s)break e;s--,u+=r[o++]<<d,d+=8}if(S<16)u>>>=v,d-=v,i.lens[i.have++]=S;else{if(16===S){for(R=v+2;d<R;){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=WU;break}b=i.lens[i.have-1],p=3+(3&u),u>>>=2,d-=2}else if(17===S){for(R=v+3;d<R;){if(0===s)break e;s--,u+=r[o++]<<d,d+=8}d-=v,b=0,p=3+(7&(u>>>=v)),u>>>=3,d-=3}else{for(R=v+7;d<R;){if(0===s)break e;s--,u+=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=WU;break}for(;p--;)i.lens[i.have++]=b}}if(i.mode===WU)break;if(0===i.lens[256]){e.msg="invalid code -- missing end-of-block",i.mode=WU;break}if(i.lenbits=9,I={bits:i.lenbits},T=HU(1,i.lens,0,i.nlen,i.lencode,0,i.work,I),i.lenbits=I.bits,T){e.msg="invalid literal/lengths set",i.mode=WU;break}if(i.distbits=6,i.distcode=i.distdyn,I={bits:i.distbits},T=HU(2,i.lens,i.nlen,i.ndist,i.distcode,0,i.work,I),i.distbits=I.bits,T){e.msg="invalid distances set",i.mode=WU;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,GU(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===KU&&(i.back=-1);break}for(i.back=0;m=(A=i.lencode[u&(1<<i.lenbits)-1])>>>16&255,S=65535&A,!((v=A>>>24)<=d);){if(0===s)break e;s--,u+=r[o++]<<d,d+=8}if(m&&0==(240&m)){for(y=v,g=m,E=S;m=(A=i.lencode[E+((u&(1<<y+g)-1)>>y)])>>>16&255,S=65535&A,!(y+(v=A>>>24)<=d);){if(0===s)break e;s--,u+=r[o++]<<d,d+=8}u>>>=y,d-=y,i.back+=y}if(u>>>=v,d-=v,i.back+=v,i.length=S,0===m){i.mode=26;break}if(32&m){i.back=-1,i.mode=KU;break}if(64&m){e.msg="invalid literal/length code",i.mode=WU;break}i.extra=15&m,i.mode=22;case 22:if(i.extra){for(R=i.extra;d<R;){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=(A=i.distcode[u&(1<<i.distbits)-1])>>>16&255,S=65535&A,!((v=A>>>24)<=d);){if(0===s)break e;s--,u+=r[o++]<<d,d+=8}if(0==(240&m)){for(y=v,g=m,E=S;m=(A=i.distcode[E+((u&(1<<y+g)-1)>>y)])>>>16&255,S=65535&A,!(y+(v=A>>>24)<=d);){if(0===s)break e;s--,u+=r[o++]<<d,d+=8}u>>>=y,d-=y,i.back+=y}if(u>>>=v,d-=v,i.back+=v,64&m){e.msg="invalid distance code",i.mode=WU;break}i.offset=S,i.extra=15&m,i.mode=24;case 24:if(i.extra){for(R=i.extra;d<R;){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=WU;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=WU;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?jU(i.check,n,h,a-h):BU(i.check,n,h,a-h)),h=c,(i.flags?u:XU(u))!==i.check){e.msg="incorrect data check",i.mode=WU;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=WU;break}u=0,d=0}i.mode=29;case 29:T=1;break e;case WU:T=-3;break e;case 31:return-4;default:return zU}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<WU&&(i.mode<27||4!==t))&&rL(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?jU(i.check,n,h,e.next_out-h):BU(i.check,n,h,e.next_out-h)),e.data_type=i.bits+(i.last?64:0)+(i.mode===KU?128:0)+(20===i.mode||15===i.mode?256:0),(0===l&&0===h||4===t)&&0===T&&(T=-5),T},DU.inflateEnd=function(e){if(!e||!e.state)return zU;var t=e.state;return t.window&&(t.window=null),e.state=null,0},DU.inflateGetHeader=function(e,t){var i;return e&&e.state?0==(2&(i=e.state).wrap)?zU:(i.head=t,t.done=!1,0):zU},DU.inflateSetDictionary=function(e,t){var i,r=t.length;return e&&e.state?0!==(i=e.state).wrap&&11!==i.mode?zU:11===i.mode&&BU(1,t,r,0)!==i.check?-3:rL(e,t,r,r)?(i.mode=31,-4):(i.havedict=1,0):zU},DU.inflateInfo="pako inflate (from Nodeca project)";var nL={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 oL=DU,aL=Kk,sL=dU,cL=nL,uL=LM,dL=mU,lL=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},hL=Object.prototype.toString;function pL(e){if(!(this instanceof pL))return new pL(e);this.options=aL.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 dL,this.strm.avail_out=0;var i=oL.inflateInit2(this.strm,t.windowBits);if(i!==cL.Z_OK)throw new Error(uL[i]);if(this.header=new lL,oL.inflateGetHeader(this.strm,this.header),t.dictionary&&("string"==typeof t.dictionary?t.dictionary=sL.string2buf(t.dictionary):"[object ArrayBuffer]"===hL.call(t.dictionary)&&(t.dictionary=new Uint8Array(t.dictionary)),t.raw&&(i=oL.inflateSetDictionary(this.strm,t.dictionary))!==cL.Z_OK))throw new Error(uL[i])}function _L(e,t){var i=new pL(t);if(i.push(e,!0),i.err)throw i.msg||uL[i.err];return i.result}pL.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?cL.Z_FINISH:cL.Z_NO_FLUSH,"string"==typeof e?s.input=sL.binstring2buf(e):"[object ArrayBuffer]"===hL.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 aL.Buf8(c),s.next_out=0,s.avail_out=c),(i=oL.inflate(s,cL.Z_NO_FLUSH))===cL.Z_NEED_DICT&&u&&(i=oL.inflateSetDictionary(this.strm,u)),i===cL.Z_BUF_ERROR&&!0===d&&(i=cL.Z_OK,d=!1),i!==cL.Z_STREAM_END&&i!==cL.Z_OK)return this.onEnd(i),this.ended=!0,!1;s.next_out&&(0!==s.avail_out&&i!==cL.Z_STREAM_END&&(0!==s.avail_in||r!==cL.Z_FINISH&&r!==cL.Z_SYNC_FLUSH)||("string"===this.options.to?(n=sL.utf8border(s.output,s.next_out),o=s.next_out-n,a=sL.buf2string(s.output,n),s.next_out=o,s.avail_out=c-o,o&&aL.arraySet(s.output,s.output,n,o,0),this.onData(a)):this.onData(aL.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!==cL.Z_STREAM_END);return i===cL.Z_STREAM_END&&(r=cL.Z_FINISH),r===cL.Z_FINISH?(i=oL.inflateEnd(this.strm),this.onEnd(i),this.ended=!0,i===cL.Z_OK):r!==cL.Z_SYNC_FLUSH||(this.onEnd(cL.Z_OK),s.avail_out=0,!0)},pL.prototype.onData=function(e){this.chunks.push(e)},pL.prototype.onEnd=function(e){e===cL.Z_OK&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=aL.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg},AU.Inflate=pL,AU.inflate=_L,AU.inflateRaw=function(e,t){return(t=t||{}).raw=!0,_L(e,t)},AU.ungzip=_L;var fL={};(0,Kk.assign)(fL,Wk,AU,nL);var vL,mL,SL,yL,gL,EL,bL,TL,IL,RL,AL,CL,OL,wL,NL,PL,DL,kL,ML,UL,LL,xL,VL,FL,BL,jL,GL,HL,zL,KL,WL,XL,YL,qL,JL,QL,ZL,$L,ex,tx,ix,rx,nx,ox,ax,sx,cx,ux=fL;!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"}(vL||(vL={})),function(e){e.RTC="rtc"}(mL||(mL={})),function(e){e.W_5="5"}(SL||(SL={})),function(e){e.IOS="ios",e.ANDROID="android",e.WEB="web",e.WINDOWS="windows",e.MAC="mac",e.LINUX="linux"}(yL||(yL={})),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"}(gL||(gL={})),function(e){e.UNKNOWN="unknown",e.BROADCASTER="broadcaster",e.AUDIENCE="audience",e.SILENTAUDIENCE="silentAudience"}(EL||(EL={})),function(e){e.REQUEST="request",e.RESPONSE="response"}(bL||(bL={})),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"}(TL||(TL={})),function(e){e.WEBSOCKET="websocket",e.NETWORKCHANGED="networkChanged",e.PEERCONNECTION="peerconnection"}(IL||(IL={})),function(e){e.WEBSOCKET_RECONNECTED="websocket reconnected",e.PEERCONNECTION_RECONNECTED="peerconnection reconnected"}(RL||(RL={})),function(e){e.WEBSOCKET="websocket",e.NETWORKCHANGED="networkChanged",e.PEERCONNECTION="peerconnection"}(AL||(AL={})),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"}(CL||(CL={})),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"}(OL||(OL={})),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"}(wL||(wL={})),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"}(NL||(NL={})),function(e){e.UP="up",e.DOWN="down",e.DIRECT="direct"}(PL||(PL={})),function(e){e.UP="up",e.DOWN="down",e.PRE="pre"}(DL||(DL={})),function(e){e.UP="up",e.DOWN="down",e.PRE="pre"}(kL||(kL={})),function(e){e.W_0="0",e.W_1="1"}(ML||(ML={})),function(e){e.UP="up",e.DOWN="down"}(UL||(UL={})),function(e){e.ANSWER="answer",e.INCRANSWER="incranswer"}(LL||(LL={})),function(e){e.UP="up",e.DOWN="down"}(xL||(xL={})),function(e){e.SUCCESS="success",e.FAIL="fail"}(VL||(VL={})),function(e){e.W_0="0",e.W_1="1"}(FL||(FL={})),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"}(BL||(BL={})),function(e){e.SUCCESS="success",e.FAIL="fail",e.IGNORE="ignore"}(jL||(jL={})),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"}(GL||(GL={})),function(e){e.PLAYOUT_DEVICE_SWITCH="playout_device_switch",e.RECORD_DEVICE_SWITCH="record_device_switch",e.UNKNOWN="unknown"}(HL||(HL={})),function(e){e.BEGIN_SEND="begin_send",e.SENT_END="sent_end",e.BEGIN_RECV="begin_recv",e.RECV_END="recv_end"}(zL||(zL={})),function(e){e.AUDIO="audio",e.VIDEO="video",e.SCREEN_VIDEO="screen_video",e.SCREEN_AUDIO="screen_audio"}(KL||(KL={})),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"}(WL||(WL={})),function(e){e.TIMEOUT="timeout",e.AUDIENCE="audience",e.MUTE="mute",e.DISABLE="disable",e.STOP_PUSH="stop_push",e.UNPUBLISH="unpublish",e.NO_DEMAND="no_demand",e.LEAVE_ROOM="leave_room",e.UNSUBSCRIBE="unsubscribe",e.REMOVE_TRACK="remove_track",e.REMOTE_MUTE="remote_mute",e.USER_LEAVE="user_leave"}(XL||(XL={})),function(e){e.AUDIO="audio",e.VIDEO="video"}(YL||(YL={})),function(e){e.BEGIN="begin",e.END="end"}(qL||(qL={})),function(e){e.BEGIN="begin",e.END="end"}(JL||(JL={})),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"}(QL||(QL={})),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"}(ZL||(ZL={})),function(e){e.NOMINAL="Nominal",e.FAIR="Fair",e.SERIOUS="Serious",e.CRITICAL="Critical",e.UNKNWON="Unknwon"}($L||($L={})),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"}(ex||(ex={})),function(e){e.P2P="p2p",e.P2P_OUTSIDE_ROOM="p2p_outside_room",e.P2SERVER="p2server"}(tx||(tx={})),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"}(ix||(ix={})),function(e){e.DSHOW="dshow",e.MF="mf",e.AVCAPTURESESSION="avcapturesession",e.CAMERA1="camera1",e.CAMERA2="camera2",e.VECAMERA="vecamera"}(rx||(rx={})),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"}(nx||(nx={})),function(e){e.UNKNOWN="unknown",e.MUSIC="music",e.HIGHQUALITY_COMMUNICATION="highquality_communication",e.COMMUNICATION="communication",e.MEDIA="media",e.GAME_STREAMING="game_streaming"}(ox||(ox={})),function(e){e.UNKNOWN="unknown",e.MEDIA="media",e.COMMUNICATION="communication"}(ax||(ax={})),function(e){e.UNKNOWN="unknown",e.SLEEP="Sleep",e.AWAKE="Awake"}(sx||(sx={})),function(e){e.UNKNOWN="unknown",e.PRODUCT="product",e.BOE="boe",e.TEST="test"}(cx||(cx={}));var dx=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}(),lx=function(e){function t(){var t=e.call(this)||this;return t.report_id=0,t.dataBuffer=[],t.posting=!1,t.report_common={},t.modify_ids={},t.preSucTime=0,t.errSendDelay=100,t.commonStats=new dx(t),XD()||window.addEventListener("beforeunload",(function(){clearTimeout(t.errSendTimer),clearTimeout(t.sucSendTimer),t.send(null,!0)})),t}return A_(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=$x.LOG_SERVER_URL;if(n.open("POST",o,!0),e||(this.posting=!0),!XD()&&location.search.includes("_rtc_autotest_"))this.safeEmit("report_event",r),0!==this.dataBuffer.length?this.sucSend():this.posting=!1;else if(!XD()&&location.search.includes("_rtc_debug_"))n.send(JSON.stringify(r));else{var a=ux.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,S=t.aid,y=t.device_model,g=t.device_brand,E=t.common_extra_info,b=t.had_selected_p2p,T=t.rtc_env_type,I=t.user_agent,R=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:S,device_model:y,device_brand:g,common_extra_info:E,had_selected_p2p:b,rtc_env_type:T,user_agent:I,auto_play_policy:R}),this.commonStats.room_id&&(this.modify_ids.room_id=this.commonStats.room_id),this.commonStats.user_id&&(this.modify_ids.user_id=this.commonStats.user_id),this.commonStats.rtc_session_id&&(this.modify_ids.rtc_session_id=this.commonStats.rtc_session_id),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=Z_(Z_({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)});this.push(n)},t.prototype.rtcSdkCallback=function(e,t,i,r){void 0===r&&(r={});var n=Z_(Z_({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=Z_(Z_({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=Z_(Z_({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=Z_(Z_({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=Z_(Z_({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=Z_(Z_({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=Z_(Z_({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=Z_(Z_({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=Z_(Z_({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=Z_(Z_({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=Z_(Z_({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=Z_(Z_({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=Z_(Z_({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=Z_(Z_({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=Z_(Z_({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=Z_(Z_({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=Z_(Z_({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=Z_(Z_({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=Z_(Z_({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=Z_(Z_({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=Z_(Z_(Z_(Z_({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=Z_(Z_({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=Z_(Z_({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=Z_(Z_({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=Z_(Z_(Z_({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=Z_(Z_({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=Z_(Z_({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=Z_(Z_({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=Z_(Z_({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=Z_(Z_({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=Z_(Z_({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=Z_(Z_({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=Z_(Z_(Z_({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=Z_(Z_(Z_(Z_({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=Z_(Z_(Z_(Z_({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=Z_(Z_(Z_(Z_({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=Z_(Z_(Z_(Z_({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=Z_(Z_(Z_(Z_({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=Z_(Z_(Z_(Z_({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}(Ak),hx=new lx,px=new lx,_x=new lx,fx=hx.commonStats,vx=px.commonStats,mx=_x.commonStats,Sx={default:hx,rtm:px,outsideRoom:_x};function yx(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&&fx.setStats({room_id:i[1]}),Sx[e].rtcSdkApiCall(r,0,JSON.stringify($D(i)),a);var s=o.apply(this,i);return"function"==typeof(null==s?void 0:s.then)?s.then((function(t){return Sx[e].rtcSdkCallback(r,0,JSON.stringify($D([t||{}]))),t})).catch((function(t){throw Sx[e].rtcSdkCallback(r,t.code,JSON.stringify(t.message)),t})):(Sx[e].rtcSdkCallback(r,0,JSON.stringify($D([s||{}]))),s)}}}}function gx(e,t,i){void 0===i&&(i=0),(e===df.onUserMessageReceivedOutsideRoom||e===df.onUserBinaryMessageReceivedOutsideRoom?px:hx).rtcSdkCallback(e,i,JSON.stringify(t))}function Ex(e,t,i,r){void 0===i&&(i=0),void 0===r&&(r=!1),(r?px:hx).rtcInvokeStatus(JSON.stringify(t),i,e,"",0)}var bx="RTC_DEVICE_ID",Tx="RTC_ACCESS_NODE",Ix="RTC_ACCESS_URLS",Rx="RTC_H264_BLACK_LIST",Ax="engine_BAC",Cx=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}(),Ox=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return A_(t,e),t.prototype.getDeviceId=function(){if(XD())return"";var e=this.get(bx);return e||(e=jD()),this.set(bx,e),e},t.prototype.setDeviceId=function(e){return[fx,vx,mx].forEach((function(t){return t.setStats({device_id:e})})),this.set(bx,e),e},t.prototype.getAccessNode=function(e){return this.get("".concat(Tx,"_").concat(e,"-BytePlus"))},t.prototype.setAccessNode=function(e,t,i){return this.set("".concat(Tx,"_").concat(e,"-BytePlus"),t,1e3*i)},t.prototype.clearAccessNode=function(e){this.delete("".concat(Tx,"_").concat(e,"-BytePlus"))},t.prototype.getAccessUrls=function(){return this.get("".concat(Ix,"-BytePlus"))},t.prototype.setAccessUrls=function(e){var t=e.map((function(e){var t=e.host,i=e.path;return"https://".concat(t).concat(i)}));return this.set("".concat(Ix,"-BytePlus"),t)},t.prototype.clearAccessUrls=function(){this.delete("".concat(Ix,"-BytePlus"))},t.prototype.getH264BlackList=function(){return this.get(Rx)},t.prototype.setH264BlackList=function(e){return this.set(Rx,e)},t.prototype.getAudioProfile=function(){return this.get(Ax)},t.prototype.setAudioProfile=function(e){return this.set(Ax,e)},t}(Cx),wx=new Ox,Nx="rtc-access.rtcplus.com,rtc-access-sg.rtcplus.com,rtc-access-va.rtcplus.com,rtc-access-fr.rtcplus.com".split(",");function Px(e){return void 0===e&&(e=""),"https://".concat(e,"/dispatch/v1/AccessInfo?Action=GetAccessInfo")}var Dx="https://web-log-report.rtcplus.com/video/v1/webrtc_log/",kx="rtc.rtcplus.com".split(","),Mx={VERSION:"4.45.1",ICE_CONFIG_REQUEST_URLS_INTERNAL:Nx.map(Px),ICE_CONFIG_REQUEST_URLS:[],EXPECTED_ADDR:"",LOG_SERVER_URL:Dx,CONFIG_REQUEST_DOMAINS:kx,DEVICE_ID:"",OVERSEA:!1};function Ux(e,t){if("VERSION"!==e)return"ICE_CONFIG_REQUEST_URLS"===e?("string"==typeof t&&(t=[t]),void(Mx.ICE_CONFIG_REQUEST_URLS=t.map(Px))):void("LOG_SERVER_URL"!==e||t!==j_.overseas?"LOG_SERVER_URL"!==e||t!==j_.domestic?"LOG_SERVER_URL"!==e||"string"!=typeof t?"OVERSEA"!==e?("DEVICE_ID"===e&&wx.setDeviceId(t),Mx[e]=t):Mx.OVERSEA=t:Mx.LOG_SERVER_URL=t:Mx.LOG_SERVER_URL=Dx:Mx.LOG_SERVER_URL="https://web-log-report.rtcplus.com/video/v1/webrtc_log/")}function Lx(e){return"DEVICE_ID"===e?wx.getDeviceId():Mx[e]}function xx(e,t){var i,r,n,o,a,s,c,u,d,l,h,p,_,f,v,m,S;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)||Jx.audio.codec,bitRate:1e3*((null===(r=t.audio)||void 0===r?void 0:r.kBitRate)||Jx.audio.kBitRate),sampleRate:1e3*((null===(n=t.audio)||void 0===n?void 0:n.sampleRate)||Jx.audio.sampleRate),channels:(null===(o=t.audio)||void 0===o?void 0:o.channels)||Jx.audio.channels,profile:(null===(a=t.audio)||void 0===a?void 0:a.AACProfile)||Jx.audio.AACProfile},video:{codec:(null===(s=t.video)||void 0===s?void 0:s.codec)||Jx.video.codec,fps:(null===(c=t.video)||void 0===c?void 0:c.fps)||Jx.video.fps,gop:(null===(u=t.video)||void 0===u?void 0:u.gop)||Jx.video.gop,lowLatency:null!==(l=null===(d=t.video)||void 0===d?void 0:d.lowLatency)&&void 0!==l?l:Jx.video.lowLatency,bitRate:1e3*((null===(h=t.video)||void 0===h?void 0:h.kBitRate)||Jx.video.kBitRate),width:(null===(p=t.video)||void 0===p?void 0:p.width)||Jx.video.width,height:(null===(_=t.video)||void 0===_?void 0:_.height)||Jx.video.height},layout:{canvas:{bgnd:(null===(f=t.layout)||void 0===f?void 0:f.backgroundColor)||Jx.layout.backgroundColor},regions:(null===(m=null===(v=t.layout)||void 0===v?void 0:v.regions)||void 0===m?void 0:m.map((function(e){return{alpha:Math.min(Math.max(+e.alpha,0),1),uid:e.userId,zorder:e.zorder,x:Math.min(Math.max(+e.x,0),1),y:Math.min(Math.max(+e.y,0),1),w:Math.min(Math.max(+e.w,0),1),h:Math.min(Math.max(+e.h,0),1),renderMode:e.renderMode||1,contentControl:e.contentControl||0,screen:e.isScreenStream,local_user:e.isLocalUser}})))||[],app_data:(null===(S=t.layout)||void 0===S?void 0:S.appData)||Jx.layout.appData}}}}function Vx(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)||z_.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 Fx,Bx,jx,Gx,Hx,zx,Kx,Wx,Xx,Yx,qx,Jx={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"}},Qx={width:640,height:360,frameRate:30,maxKbps:600},Zx={width:1920,height:1080,frameRate:15,maxKbps:3e3},$x=Mx;!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"}(Fx||(Fx={})),function(e){e.PushLimitWarn="PushLimitWarn"}(Bx||(Bx={})),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"}(jx||(jx={})),function(e){e.RSCP="RSCP"}(Gx||(Gx={})),function(e){e.ON_CONNECTION_STATE_CHANGE="onConnectionStateChange",e.ABNORMAL_DISCONNECTION="normalConnection"}(Hx||(Hx={})),function(e){e.userLeave="userLeave",e.connectionLost="connectionLost",e.userDuplicateLogin="userDuplicateLogin",e.kickedByAdmin="kickedByAdmin",e.roleChanged="roleChanged",e.onUserTokenDidExpire="onUserTokenDidExpire"}(zx||(zx={})),function(e){e[e.roomDismissByAdmin=2]="roomDismissByAdmin"}(Kx||(Kx={})),function(e){e[e.SEND=0]="SEND",e[e.FEEDBACK=1]="FEEDBACK"}(Xx||(Xx={})),function(e){e[e.P2P=0]="P2P",e[e.SIGNAL=1]="SIGNAL",e[e.BROADCAST=2]="BROADCAST",e[e.BUSINESS_SERVER=3]="BUSINESS_SERVER"}(Yx||(Yx={})),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"}(qx||(qx={}));var eV,tV,iV=((Wx={})[qx.SUCCESS]=[0,"success"],Wx[qx.TIMEOUT]=[aP.USER_MESSAGE_TIMEOUT,"timeout, failed to send."],Wx[qx.BROKEN]=[aP.USER_MESSAGE_BROKEN,"dataChannel broken, failed to send."],Wx[qx.NO_RECEIVER]=[aP.USER_MESSAGE_NO_RECEIVER,"cannot find the receiver."],Wx[qx.NO_RELAYPATH]=[aP.USER_MESSAGE_NO_RELAYPATH,"cannot find relay path."],Wx[qx.SEND_TO_SERVER_ERROR]=[aP.USER_MESSAGE_SEND_TO_SERVER_ERROR,"failed to send to business server."],Wx[qx.SERVER_RESPONSE_ERROR]=[aP.USER_MESSAGE_SERVER_RESPONSE_ERROR,"business server response error."],Wx[qx.NOT_JOIN]=[aP.USER_MESSAGE_NOT_JOIN,"not join room"],Wx[qx.INIT]=[aP.USER_MESSAGE_INIT,"not init."],Wx[qx.NO_CONNECTION]=[aP.USER_MESSAGE_NO_CONNECTION,"no connection."],Wx[qx.EXCEED_MAX_LENGTH]=[aP.USER_MESSAGE_EXCEED_MAX_LENGTH,"message exceeds max length."],Wx[qx.EMPTY_USER]=[aP.USER_MESSAGE_EMPTY_USER,"user id is empty."],Wx[qx.NOT_LOGIN]=[aP.USER_MESSAGE_NOT_LOGIN,"not login."],Wx[qx.SERVER_PARAMS_NOTSET]=[aP.USER_MESSAGE_SERVER_PARAMS_NOTSET,"server param is not set."],Wx[qx.UNKNOWN]=[aP.USER_MESSAGE_UNKNOWN,"unknown."],Wx),rV=new Ik("DataChannelSignaling",3);!function(e){e[e.SEND=0]="SEND",e[e.ACK=1]="ACK"}(eV||(eV={})),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"}(tV||(tV={}));var nV=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 A_(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 hx.rtcSignaling(0,JSON.stringify(t),"call-".concat(e),"Send",PL.UP),new Promise((function(n,o){var a=r._genHeader(i);a.id=JD();var s=a.id.join("-"),c=setTimeout((function(){r._singlingCache.delete(s),o(new lP(aP.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)}}),rV.print("Signal",">>>>>> [".concat(e,"][").concat(s,"]"),t),r._sendMessage(e,a,t)}))},t.prototype.sendPingSignaling=function(){return this.sendSignaling("CheckConnectivity",{ts:Date.now()},{functionType:tV.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 ef(this,void 0,void 0,(function(){var e,n,o,a,s;return tf(this,(function(c){switch(c.label){case 0:return e=i instanceof ArrayBuffer,n=this._sendP2PMessage,o=[Z_({ver:1,id:this._p2pMessageId++,time:Date.now(),dir:Xx.SEND,type:Yx.P2P,err:qx.SUCCESS},r)],s={binary:e},e?[4,YD.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,[Z_.apply(void 0,o.concat([(s.msg=a,s)])),t])]}}))}))},t.prototype._sendP2PMessage=function(e,t){var i=this;return void 0===t&&(t={}),ZD(e.msg)?this._rttIds[e.id]=e.id:e.dir===Xx.SEND&&rV.print("_sendP2PMessage [DC Signaling p2p >>]",JSON.stringify(e)),new Promise((function(r,n){var o=i._genHeader(Z_(Z_({needAck:!0,functionType:tV.C2C},t),{id:JD()}));if(e.dir===Xx.SEND){var a=setTimeout((function(){i._p2pCache.delete(e.id),n(new lP(aP.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=nf(iV[e.err]||[aP.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 lP(aP.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=YD.str2ab(JSON.stringify([e,i])),a=WD(Uint8Array,of([r,n],nf(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===eV.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:eV.ACK,id:e.split("-").map((function(e){return+e}))});rV.print("Signal",">>>>>> [".concat(t,"-res][").concat(e,"]")),this._sendMessage("".concat(t,"-res"),i,"")},t.prototype._handleMessage=function(e){var t,i;return ef(this,void 0,void 0,(function(){var r,n,o,a,s,c,u,d,l,h,p,_,f,v,m,S,y,g,E,b,T,I,R,A,C,O,w,N,P,D,k,M,U,L,x;return tf(this,(function(V){switch(V.label){case 0:r=this._dispartData(e),n=r.header,o=r.data,n.zip&&((a=new ux.Inflate).push(o,!0),o=a.result),s=YD.ab2str(o),c=[];try{c=JSON.parse(s)}catch(e){return e instanceof Error&&hx.rtcSignalingMsgError(-1,e.message,wL.MESSAGE_PARSE_FAILED),[2]}switch(n.functionType){case tV.C2S:return[3,1];case tV.C2C:return[3,6];case tV.C2GW:return[3,18]}return[3,19];case 1:return u=(null===(t=n.id)||void 0===t?void 0:t.join("-"))||"",n.direction!==eV.ACK?[3,2]:(this._handleAckMessage(u,c[0]||{},s),[3,5]);case 2:return Array.isArray(c)?(d=c[0],c=c[1],rV.print("Signal","<<<<<< ".concat(d),c,u),this._feedbackSignaling(u,d),c.binary&&"string"==typeof c.message?(l=c,[4,YD.b64str2ab(c.message)]):[3,4]):[3,5];case 3:l.message=V.sent(),V.label=4;case 4:this.emit(d,Z_({},c)),hx.rtcSignaling(0,s,"on-".concat(d),"Recv",PL.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)===Xx.FEEDBACK||ZD(null==c?void 0:c.msg)?delete this._rttIds[h]:rV.print("Signal","<<<<<< p2p response",c),c.dir){case Xx.SEND:return[3,7];case Xx.FEEDBACK:return[3,16]}return[3,17];case 7:return ZD(null==c?void 0:c.msg)?[3,15]:(_=(p=c).binary,f=p.msg,v=p.room,m=p.to,S=p.from,y=""===v?_?jx.USER_BINARY_MESSAGE_RECEIVED_OUTSIDE_ROOM:jx.USER_MESSAGE_RECEIVED_OUTSIDE_ROOM:_?jx.USER_BINARY_MESSAGE_RECEIVED:jx.USER_MESSAGE_RECEIVED,m?[3,11]:(g=this.emit,E=[jx.ON_CUSTOM_MESSAGE],L={clientId:S,binary:_},_?[4,YD.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([(L.message=b,L)])),[3,15];case 11:return T=this.emit,I=[y],R=[Z_({},c)],x={},_?[4,YD.b64str2ab(f)]:[3,13];case 12:return A=V.sent(),[3,14];case 13:A=f,V.label=14;case 14:T.apply(this,I.concat([Z_.apply(void 0,R.concat([(x.msg=A,x)]))])),V.label=15;case 15:return this._sendP2PMessage(Z_(Z_({},c),{dir:Xx.FEEDBACK,msg:""})),[3,17];case 16:return(C=this._p2pCache.get(c.id))&&(this._p2pCache.delete(c.id),c.err===qx.SUCCESS?C.success(c.id,c):C.error(c)),[3,17];case 17:return[3,19];case 18:if(n.direction===eV.ACK)O=(null===(i=n.id)||void 0===i?void 0:i.join("-"))||"",this._handleAckMessage(O,c[0]||{},s);else if(w=nf(c,2),N=w[0],P=w[1],D=void 0===P?{}:P,"RXMediaMsg"===N&&(k=D.type,M=D.data,hx.rtcSignaling(0,s,"on-".concat(k),"Recv",PL.DOWN),"RSCP"===k))try{U=JSON.parse(M),Array.isArray(U)&&this.emit(k,U)}catch(e){}V.label=19;case 19:return[2]}}))}))},t.prototype._handleHandler=function(){var e=this,t=function(t){rV.print("_handleHandler","dataChannel close",t),e.emit("close",t)},i=function(t){rV.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={}),Z_({version:2,zip:!1,encrypt:!1,needAck:!0,direction:eV.SEND,functionType:tV.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),rV.print("Signal","<<<<<< [".concat(r.signalingType,"-ack]"),t)),hx.rtcSignaling(0,i,null==r?void 0:r.signalingType,"Ack",PL.DOWN)},t}(yk.exports.EventEmitter),oV=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=rf(Object.entries(s)),h=l.next();!h.done;h=l.next()){var p=nf(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}(),aV=new Ik("ICE Request",3),sV=function(){function e(){this._request=new oV}return e.prototype.getAccessNode=function(e,t,i,r,n,o,a){return ef(this,void 0,void 0,(function(){var s;return tf(this,(function(c){return(s=wx.getAccessNode(e))?(this.getAccessNodeFromServer(e,t,i,r,n,o,a),Ex("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 ef(this,void 0,void 0,(function(){var s,c,u=this;return tf(this,(function(d){return s=wx.getAccessUrls(),c=!0,Ex("es.R.req.cache.urls",s),(null==s?void 0:s.length)>0||(s=$x.ICE_CONFIG_REQUEST_URLS,c=!1,Ex("es.R.req.external.urls",s)),(null==s?void 0:s.length)>0||(s=$x.ICE_CONFIG_REQUEST_URLS_INTERNAL,c=!1,Ex("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 wx.setAccessNode(e,i,t.ttl||11200),t.dispatchDomains&&wx.setAccessUrls(t.dispatchDomains),i})).catch((function(s){if(c)return Ex("es.R.req.fallback",""),wx.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 ef(this,void 0,void 0,(function(){var i,u,d,l=this;return tf(this,(function(h){return i={appID:t,userID:r,deviceID:n,connectSessionID:zD(),os:"web",sdkVersion:$x.VERSION,isOversea:$x.OVERSEA,expectedAddr:Lx("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(),hx.rtcGetAccess(0,JSON.stringify(i),0,CL.REQUEST,e.join(","),i.connectSessionID),d=e.map((function(e,t){return ef(l,void 0,void 0,(function(){var r,n,o;return tf(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 lP(aP.ICE_SERVER_WRONG,"get ICE config failed",n);case 3:if(200!==r.code)throw new lP(aP.ICE_SERVER_WRONG,"get ICE config failed",{server_code:r.code,message:JSON.stringify(r)});if(!(o=r.nodes[0]))throw new lP(aP.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,tk(d).then((function(t){var r=t.result;t.firstNode;var n=t.index;return hx.rtcGetAccess(200,JSON.stringify(r),Date.now()-u,CL.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 hx.rtcGetAccess(+((null==o?void 0:o.code)||(null==o?void 0:o.server_code)),null===(n=t[0])||void 0===n?void 0:n.message,Date.now()-u,CL.RESPONSE,e.join(","),i.connectSessionID,{error:JSON.stringify(o)}),t}))]}))}))},e.prototype.abort=function(){this._request.isSending&&(aV.print("abort","HTTP Request of [getICEConfigFromServer] abort"),this._request.abort())},e}(),cV=function(){function e(){this._request=new oV}return e.prototype.getH264BlackList=function(){var e=this,t={keys:["web_h264_black_list"],labelSelector:"",sdkVersion:"4.45.1",deviceType:"web"};this._request.timeout=800;var i=$x.CONFIG_REQUEST_DOMAINS.map((function(e){return"https://".concat(e,"/decision/v1/multi")}));hx.rtcGetConfig(0,JSON.stringify(t),0,i.join(","),bL.REQUEST,"",!1);var r=i.map((function(i,r){return ef(e,void 0,void 0,(function(){var e;return tf(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 lP(aP.ICE_SERVER_WRONG,"get config failed");case 3:if(!Array.isArray(null==e?void 0:e.web_h264_black_list))throw new lP(aP.ICE_SERVER_WRONG,"get config failed");return[2,{result:e,index:r}]}}))}))}));return new Promise((function(e){tk(r).then((function(t){var r=t.result,n=t.index;wx.setH264BlackList(r.web_h264_black_list),hx.rtcGetConfig(200,JSON.stringify(r),0,i[n],bL.RESPONSE,"",!1),e(r.web_h264_black_list)})).catch((function(t){hx.rtcGetConfig(500,t.message,0,"",bL.RESPONSE,"",!1),e(wx.getH264BlackList()||[])}))}))},e.prototype.getAudioProfile=function(){var e=this,t={keys:["engine_BAC"],labelSelector:"",sdkVersion:"4.45.1",deviceType:"web"},i=$x.CONFIG_REQUEST_DOMAINS.map((function(e){return"https://".concat(e,"/decision/v1/multi")}));hx.rtcGetConfig(0,JSON.stringify(t),0,i.join(","),bL.REQUEST,"",!1);var r=i.map((function(i,r){return ef(e,void 0,void 0,(function(){var e;return tf(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 lP(aP.ICE_SERVER_WRONG,"get config failed");case 3:if(!Array.isArray(null==e?void 0:e.engine_BAC))throw new lP(aP.ICE_SERVER_WRONG,"get config failed");return[2,{result:e,index:r}]}}))}))}));return new Promise((function(e){tk(r).then((function(t){var r=t.result,n=t.index;wx.setAudioProfile(r.engine_BAC),hx.rtcGetConfig(200,JSON.stringify(r),0,i[n],bL.RESPONSE,"",!1),e(r.engine_BAC)})).catch((function(t){hx.rtcGetConfig(500,t.message,0,"",bL.RESPONSE,"",!1),e(wx.getAudioProfile()||[])}))}))},e}();function uV(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 Z_(Z_({},r),{scaleResolutionDownBy:i})}var dV=[{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}],lV=[{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 hV={width:160,height:90,frameRate:15,maxkbps:100},pV={width:480,height:270,frameRate:15,maxkbps:400};function _V(e){if(!e.length)return[];var t=e.shift(),i=t.width/t.height,r=0,n=0,o=Z_(Z_({},t),{video_index:n,sub_index:r++});delete o.rid;for(var a=[o],s=0,c=0;c<dV.length;c++)if(dV[c].height<t.height){s=c;break}var u=e.shift();for(c=s;c<dV.length;c++){var d=dV[c];if(u&&d.height<=(null==u?void 0:u.height)){var l=d.height===(null==u?void 0:u.height),h=Z_(Z_({},u),{video_index:++n,sub_index:r++});if(delete h.rid,a.push(h),u=e.shift(),l)continue}a.push(Z_(Z_({},d),{width:Math.floor(d.height*i),video_index:n,sub_index:r++}))}return a}var fV,vV,mV,SV,yV="chrome-stable"===qD();!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"}(fV||(fV={})),function(e){e[e.encode=0]="encode",e[e.decode=1]="decode"}(vV||(vV={})),function(e){e[e.none=0]="none",e[e.cpu=1]="cpu",e[e.bandwidth=2]="bandwidth",e[e.other=3]="other"}(mV||(mV={})),function(e){e[e.unknown=0]="unknown",e[e.controlling=1]="controlling",e[e.controlled=2]="controlled"}(SV||(SV={}));var gV,EV=function(){function e(e){this.peer=e,this.stats=[]}return e.prototype.handleCodec=function(e){return e},e.prototype.handleInboundRtp=function(e){return e},e.prototype.handleOutboundRtp=function(e){var t=e.ssrc;return t&&(e.rtxSsrc=t),e},e.prototype.handleRemoteInboundRtp=function(e){return e},e.prototype.handleRemoteOutboundRtp=function(e){return e},e.prototype.handleMediaSource=function(e){return e},e.prototype.handleCsrc=function(e){return e},e.prototype.handlePeerConnection=function(e){return e},e.prototype.handleDataChannel=function(e){return e},e.prototype.handleStream=function(e){return e},e.prototype.handleTrack=function(e){return e},e.prototype.handleTransceiver=function(e){return e},e.prototype.handleSender=function(e){return e},e.prototype.handleReceiver=function(e){return e},e.prototype.handleTransport=function(e){return e},e.prototype.handleSctpTransport=function(e){return e},e.prototype.handleCandidatePair=function(e){return e},e.prototype.handleLocalCandidate=function(e){return e},e.prototype.handleRemoteCandidate=function(e){return e},e.prototype.handleCertificate=function(e){return e},e.prototype.handleIceServer=function(e){return e},e.prototype.processStats=function(e){var t=this;e.forEach((function(e){var i;switch(e.type){case fV.candidatePair:i=t.handleCandidatePair;break;case fV.certificate:i=t.handleCertificate;break;case fV.remoteCandidate:i=t.handleRemoteCandidate;break;case fV.remoteInboundRtp:i=t.handleInboundRtp;break;case fV.remoteOutboundRtp:i=t.handleOutboundRtp;break;case fV.sctpTransport:i=t.handleSctpTransport;break;case fV.sender:i=t.handleSender;break;case fV.stream:i=t.handleStream;break;case fV.track:i=t.handleTrack;break;case fV.transceiver:i=t.handleTransceiver;break;case fV.transport:i=t.handleTransport;break;case fV.codec:i=t.handleCodec;break;case fV.csrc:i=t.handleCsrc;break;case fV.dataChannel:i=t.handleDataChannel;break;case fV.iceServer:i=t.handleIceServer;break;case fV.mediaSource:i=t.handleMediaSource;break;case fV.outboundRtp:i=t.handleOutboundRtp;break;case fV.inboundRtp:i=t.handleInboundRtp;break;case fV.peerConnection:i=t.handlePeerConnection;break;case fV.receiver:i=t.handleReceiver;break;case fV.localCandidate:i=t.handleLocalCandidate;break;default:i=function(e){return e}}i=i.bind(t),t.stats.push(i(e))}))},e.prototype.getExtraStats=function(e){return ef(this,void 0,void 0,(function(){var t=this;return tf(this,(function(i){return[2,new Promise((function(i,r){if(!yV||void 0!==window.InstallTrigger)return i(t.stats);try{t.peer.getStats((function(r){r.result().forEach((function(i){if(!bV.includes(i.type)){var r={};i.names().forEach((function(e){r[e]=i.stat(e)})),r.id=i.id,r.type=i.type,r.timestamp=i.timestamp,"ssrc"===r.type&&e&&e.id?e.id===r.googTrackId&&t.stats.push(r):t.stats.push(r)}})),i(t.stats)}))}catch(e){r(e)}}))]}))}))},e.prototype.getStats=function(e,t){return ef(this,void 0,void 0,(function(){var i;return tf(this,(function(r){switch(r.label){case 0:return r.trys.push([0,7,,8]),[4,this.peer.getStats(e)];case 1:i=r.sent(),this.processStats(i),r.label=2;case 2:return r.trys.push([2,5,,6]),t?[3,4]:[4,this.getExtraStats(e)];case 3:r.sent(),r.label=4;case 4:return[3,6];case 5:return r.sent(),[3,6];case 6:return[3,8];case 7:return r.sent(),[3,8];case 8:return[2,this.stats]}}))}))},e}(),bV=["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"],TV=function(e,t,i){return ef(void 0,void 0,void 0,(function(){var r;return tf(this,(function(n){switch(n.label){case 0:return r=[],e instanceof RTCPeerConnection?[4,new EV(e).getStats(t,i)]:[2,r];case 1:return[2,r=n.sent()]}}))}))},IV=function(){return ef(void 0,void 0,void 0,(function(){var e,t,i,r,n,o,a;return tf(this,(function(s){switch(s.label){case 0:if(gV)return[2,gV];e=[],s.label=1;case 1:return s.trys.push([1,5,,6]),[4,ek()];case 2:return(t=s.sent())?(null==t?void 0:t.includes("level-asymmetry-allowed=1;packetization-mode=1;profile-level-id=42e01f"))||(null==t?void 0:t.includes("profile-level-id=42e01f;level-asymmetry-allowed=1;packetization-mode=1"))||(null==t?void 0:t.includes("packetization-mode=1;profile-level-id=42e01f;level-asymmetry-allowed=1"))?(i=navigator.userAgent.toLowerCase(),r=!1,n=["heytapbrowser","mqqbrowser","miuibrowser"],[4,(new cV).getH264BlackList()]):[3,4]:[2,e];case 3:for(o=s.sent(),n.push.apply(n,of([],nf(o),!1)),a=0;a<n.length;a++)i.includes(n[a])&&(r=!0);!r&&e.push("H264"),s.label=4;case 4:return(null==t?void 0:t.includes("VP8"))&&e.push("vp8"),gV=e,[2,e];case 5:return s.sent(),[2,e];case 6:return[2]}}))}))},RV=function(){return"undefined"!=typeof TransformStream&&"undefined"!=typeof RTCRtpSender&&"undefined"!=typeof RTCRtpReceiver&&void 0!==RTCRtpSender.prototype.createEncodedStreams&&void 0!==RTCRtpReceiver.prototype.createEncodedStreams},AV=new Ik("BasicHandler",3),CV={iceServers:[],iceTransportPolicy:"all",bundlePolicy:"max-bundle",rtcpMuxPolicy:"require",sdpSemantics:"unified-plan",encodedInsertableStreams:!!RV()||void 0},OV=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(CV),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;AV.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){AV.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,OL["".concat(e.toUpperCase())])},r}return A_(t,e),t.prototype.disconnect=function(){this._peerConnection.close(),this._dataChannel.close(),this._peerConnection.ontrack=null},t.prototype.destroy=function(){AV.print("destroy"),this.disconnect(),this._context=void 0},t.prototype._simulcast=function(e,t,i,r,n){var o=[],a=function(e){for(var t=0,i=e.width*e.height,r=0;r<lV.length;r++)if(i>=lV[r].totalPixels){t=r;break}if(0===t)return lV[t].maxLayers;var n=lV[t-1].totalPixels;return(n-i)/(n-lV[t].totalPixels)<.1?lV[t-1].maxLayers:lV[t].maxLayers}(t);AV.print("simulcast() ","maxLayers: %o",a),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/hV.width,n=e.width/pV.width):(r=e.height/hV.height,n=e.height/pV.height),i.push({maxkbps:hV.maxkbps,scaleResolutionDownBy:r,frameRate:hV.frameRate,width:Math.floor(e.width/r),height:Math.floor(e.height/r)}),t<=2||r>2&&i.unshift({maxkbps:pV.maxkbps,scaleResolutionDownBy:n,frameRate:pV.frameRate,width:Math.floor(e.width/n),height:Math.floor(e.height/n)}),i}(i,a),AV.print("simulcast() ","simulcastLayers: %o",o)):(o=e.videoEncodeConfig.slice(1).slice(1-a).map((function(e){return Z_({frameRate:e.frameRate||15,maxkbps:e.maxKbps||600},uV(i,e))})),AV.print("simulcast() ","simulcastLayers2: %o",o)),o.forEach((function(e,t){var i={maxBitrate:1e3*e.maxkbps,scaleResolutionDownBy:e.scaleResolutionDownBy,rid:"".concat(t+1),maxFramerate:e.frameRate};r.sendEncodings&&r.sendEncodings.unshift(i),n.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=uV(p,f);e.prevScaleResolutionDownBy=v.scaleResolutionDownBy,e.videoInputConfig=p;var m={maxBitrate:1e3*f.maxKbps,scaleResolutionDownBy:v.scaleResolutionDownBy,rid:"0",maxFramerate:f.frameRate||15};u.sendEncodings=[m],d.push({width:v.width,height:v.height,framerate:f.frameRate,maxkbps:f.maxKbps,rid:"0"}),o&&(this._simulcast(e,v,p,u,d),(null==t?void 0:t.simulcastOnDemand)&&(l=_V(of([],nf(d),!1))),AV.print("subVideoDesc","desc: %o ",l))}AV.print("publish videoTransceiverInit videoDescriptions","",u,d);var S=null==n?void 0:n.getTrack();(null==n?void 0:n.mixType)!==sf.PLAYOUT&&(null==n?void 0:n.mixedAudioTrack)&&(S=null==n?void 0:n.mixedAudioTrack),S=a&&S?S:"audio";var y=null==r?void 0:r.getTrack();return{semantics:"unified-plan",videoDescriptions:d,subVideoDescriptions:l,transceiverInit:{aTrack:S,vTrack:y=s&&y?y:"video",audioTransceiverInit:c,videoTransceiverInit:u}}},t.prototype.updateScaleResolutionDownBy=function(e){var t,i,r;return ef(this,void 0,void 0,(function(){var n,o,a,s,c,u,d;return tf(this,(function(l){return AV.print("updateScaleResolutionDownBy()"),n=null===(t=e.videoTrack)||void 0===t?void 0:t.getTrack(),o=e.videoTransceiver,n&&e.pubVideo&&o?(a=null==n?void 0:n.getSettings(),s={width:Math.floor(a.width),height:Math.floor(a.height),frameRate:Math.floor(a.frameRate)},(c=uV(s,e.videoEncodeConfig[0])).scaleResolutionDownBy===e.prevScaleResolutionDownBy&&AV.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)),[2]):(AV.print("updateScaleResolutionDownBy()","no pub"),[2])}))}))},t.prototype.getStats=function(e,t){return TV(this._peerConnection,e,t)},t.prototype.setLocalDescription=function(e,t){var i;return ef(this,void 0,void 0,(function(){var r,n,o,a=this;return tf(this,(function(s){switch(s.label){case 0:r=KD(),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,ML.W_1,"local"===(null==t?void 0:t.streamUserId)?UL.UP:UL.DOWN,(null==t?void 0:t.streamId)||"",(null==t?void 0:t.streamUserId)||"",KD()-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,ML.W_1,"local"===(null==t?void 0:t.streamUserId)?UL.UP:UL.DOWN,"","",KD()-r,{type:"offer"}),[3,4];case 4:return[2]}}))}))},t.prototype.setRemoteDescription=function(e,t){return ef(this,void 0,void 0,(function(){var i,r;return tf(this,(function(n){switch(n.label){case 0:i=KD(),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,ML.W_0,"local"===(null==t?void 0:t.streamUserId)?UL.UP:UL.DOWN,(null==t?void 0:t.streamId)||"",(null==t?void 0:t.streamUserId)||"",KD()-i,{type:"answer"}),[3,4];case 3:return r=n.sent(),this.monitor.rtcSetDescription(-1,r.message,ML.W_1,"local"===(null==t?void 0:t.streamUserId)?UL.UP:UL.DOWN,(null==t?void 0:t.streamId)||"",(null==t?void 0:t.streamUserId)||"",KD()-i,{type:"answer"}),[3,4];case 4:return[2]}}))}))},t.prototype.setCurrentDescription=function(){return ef(this,void 0,void 0,(function(){return tf(this,(function(e){return[2]}))}))},Object.defineProperty(t.prototype,"pc",{get:function(){return this._peerConnection},enumerable:!1,configurable:!0}),t}(yk.exports.EventEmitter),wV={},NV={},PV={exports:{}},DV=PV.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(DV).forEach((function(e){DV[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=PV.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}}))}))}}(NV);var kV=PV.exports,MV=/%[sdv%]/g,UV=function(e){var t=1,i=arguments,r=i.length;return e.replace(MV,(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""}}))},LV=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 UV.apply(null,r)},xV=["v","o","s","i","u","e","p","c","b","t","r","z","a"],VV=["i","c","b","a"],FV=NV,BV=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||xV,r=t.innerOrder||VV,n=[];return i.forEach((function(t){kV[t].forEach((function(i){i.name in e&&null!=e[i.name]?n.push(LV(t,i,e)):i.push in e&&null!=e[i.push]&&e[i.push].forEach((function(e){n.push(LV(t,i,e))}))}))})),e.media.forEach((function(e){n.push(LV("m",kV.m[0],e)),r.forEach((function(t){kV[t].forEach((function(i){i.name in e&&null!=e[i.name]?n.push(LV(t,i,e)):i.push in e&&null!=e[i.push]&&e[i.push].forEach((function(e){n.push(LV(t,i,e))}))}))}))})),n.join("\r\n")+"\r\n"};wV.write=BV,wV.parse=FV.parse,wV.parseParams=FV.parseParams,wV.parseFmtpConfig=FV.parseFmtpConfig,wV.parsePayloads=FV.parsePayloads,wV.parseRemoteCandidates=FV.parseRemoteCandidates,wV.parseImageAttributes=FV.parseImageAttributes,wV.parseSimulcastStreamList=FV.parseSimulcastStreamList;var jV=Math.pow(2,32),GV=function(){return Math.floor(Math.random()*jV+1e3)},HV=function(e,t,i){return i||(i=GV()),[{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 zV(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 KV=function(e,t,i){var r=Z_(Z_({},e),{invalid:[{value:"realx-exts:rscp"}],media:[t,i]});return delete r.groups,delete r.msidSemantic,wV.write(r)};function WV(e){return ef(this,void 0,void 0,(function(){var t,i,r,n,o;return tf(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,XV(n.serverIceUfrag)];case 1:return o.iceUfrag=a.sent(),fx.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(Z_(Z_({},n),{foundation:t++,transport:"udp",port:e,priority:i}))})),e.tcpPorts&&e.tcpPorts.forEach((function(e){r.push(Z_(Z_({},n),{foundation:t++,transport:"tcp",port:e,tcptype:"passive",priority:i-1e3}))}))})),r}(i),t.setup="active",t.iceOptions="renomination",[2,t]}}))}))}var XV=function(e){return ef(void 0,void 0,void 0,(function(){var t,i,r,n,o,a,s;return tf(this,(function(c){switch(c.label){case 0:return t=new TextEncoder,i=t.encode("PREC"),n=Uint8Array.bind,[4,YD.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=WD(Uint8Array,i,r,o,a),[4,YD.ab2b64str(s.buffer)];case 2:return[2,c.sent()]}}))}))},YV=I,qV=rc,JV=Dm.exports.getWeakData,QV=kt,ZV=G,$V=lc,eF=Wc,tF=xe,iF=Oi.set,rF=Oi.getterFor,nF=ba.find,oF=ba.findIndex,aF=YV([].splice),sF=0,cF=function(e){return e.frozen||(e.frozen=new uF)},uF=function(){this.entries=[]},dF=function(e,t){return nF(e.entries,(function(e){return e[0]===t}))};uF.prototype={get:function(e){var t=dF(this,e);if(t)return t[1]},has:function(e){return!!dF(this,e)},set:function(e,t){var i=dF(this,e);i?i[1]=t:this.entries.push([e,t])},delete:function(e){var t=oF(this.entries,(function(t){return t[0]===e}));return~t&&aF(this.entries,t,1),!!~t}};var lF,hF={getConstructor:function(e,t,i,r){var n=e((function(e,n){$V(e,o),iF(e,{type:t,id:sF++,frozen:void 0}),null!=n&&eF(n,e[r],{that:e,AS_ENTRIES:i})})),o=n.prototype,a=rF(t),s=function(e,t,i){var r=a(e),n=JV(QV(t),!0);return!0===n?cF(r).set(t,i):n[r.id]=i,e};return qV(o,{delete:function(e){var t=a(this);if(!ZV(e))return!1;var i=JV(e);return!0===i?cF(t).delete(e):i&&tF(i,t.id)&&delete i[t.id]},has:function(e){var t=a(this);if(!ZV(e))return!1;var i=JV(e);return!0===i?cF(t).has(e):i&&tF(i,t.id)}}),qV(o,i?{get:function(e){var t=a(this);if(ZV(e)){var i=JV(e);return!0===i?cF(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}},pF=n,_F=I,fF=rc,vF=Dm.exports,mF=gS,SF=hF,yF=G,gF=Fm,EF=Oi.enforce,bF=oi,TF=!pF.ActiveXObject&&"ActiveXObject"in pF,IF=function(e){return function(){return e(this,arguments.length?arguments[0]:void 0)}},RF=mF("WeakMap",IF,SF);if(bF&&TF){lF=SF.getConstructor(IF,"WeakMap",!0),vF.enable();var AF=RF.prototype,CF=_F(AF.delete),OF=_F(AF.has),wF=_F(AF.get),NF=_F(AF.set);fF(AF,{delete:function(e){if(yF(e)&&!gF(e)){var t=EF(this);return t.frozen||(t.frozen=new lF),CF(this,e)||t.frozen.delete(e)}return CF(this,e)},has:function(e){if(yF(e)&&!gF(e)){var t=EF(this);return t.frozen||(t.frozen=new lF),OF(this,e)||t.frozen.has(e)}return OF(this,e)},get:function(e){if(yF(e)&&!gF(e)){var t=EF(this);return t.frozen||(t.frozen=new lF),OF(this,e)?wF(this,e):t.frozen.get(e)}return wF(this,e)},set:function(e,t){if(yF(e)&&!gF(e)){var i=EF(this);i.frozen||(i.frozen=new lF),OF(this,e)?NF(this,e,t):i.frozen.set(e,t)}else NF(this,e,t);return this}})}var PF,DF=function(e){function t(){var t=e.call(this)||this;return t._hasVideoPermission=!1,t._hasAudioPermission=!1,t.inited=!1,t.deviceMap={audioinput:new Map,audiooutput:new Map,videoinput:new Map},t._handleDeviceChange=t._handleDeviceChange.bind(t),!XD()&&t.refreshDevices(),t}return A_(t,e),t.prototype.refreshDevices=function(){return ef(this,void 0,void 0,(function(){var e=this;return tf(this,(function(t){switch(t.label){case 0:return navigator.mediaDevices?[4,navigator.mediaDevices.enumerateDevices()]:[2];case 1:return t.sent().forEach((function(t){var i;null===(i=e.deviceMap[t.kind])||void 0===i||i.set(t.deviceId,t)})),this.inited||this.initListener(),this.inited=!0,[2]}}))}))},t.prototype.initListener=function(){var e;return ef(this,void 0,void 0,(function(){return tf(this,(function(t){return"function"==typeof(null===(e=navigator.mediaDevices)||void 0===e?void 0:e.addEventListener)&&navigator.mediaDevices.addEventListener("devicechange",this._handleDeviceChange),[2]}))}))},t.prototype._handleDeviceChange=function(){return ef(this,void 0,void 0,(function(){var e,t,i=this;return tf(this,(function(r){switch(r.label){case 0:return[4,navigator.mediaDevices.enumerateDevices()];case 1:return e=r.sent(),t=Array.from(of(of(of([],nf(this.deviceMap.audioinput.values()),!1),nf(this.deviceMap.videoinput.values()),!1),nf(this.deviceMap.audiooutput.values()),!1)),e.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(df.onVideoDeviceStateChanged,{mediaDeviceInfo:e,deviceState:"active"}):e.kind.includes("audio")&&i.emit(df.onAudioDeviceStateChanged,{mediaDeviceInfo:e,deviceState:"active"}))})),t.forEach((function(t){e.find((function(e){return e.deviceId===t.deviceId&&e.kind===t.kind}))||(i.deviceMap[t.kind].delete(t.deviceId),t.kind.includes("video")?i.emit(df.onVideoDeviceStateChanged,{mediaDeviceInfo:t,deviceState:"inactive"}):t.kind.includes("audio")&&i.emit(df.onAudioDeviceStateChanged,{mediaDeviceInfo:t,deviceState:"inactive"}))})),[2]}}))}))},t.prototype.getVideoPermission=function(){return ef(this,void 0,void 0,(function(){var e=this;return tf(this,(function(t){switch(t.label){case 0:if(!navigator.mediaDevices||!navigator.mediaDevices.getUserMedia)throw new lP(aP.NOT_SUPPORTED,"GetUserMedia not supported");if(this.hasVideoPermission)return[2,!0];t.label=1;case 1:return t.trys.push([1,3,,4]),[4,navigator.mediaDevices.getUserMedia({audio:!1,video:!0}).then((function(t){t&&(t.getTracks().forEach((function(e){return e.stop()})),e.hasVideoPermission=!0,e.inited||e.refreshDevices())}))];case 2:case 3:return t.sent(),[3,4];case 4:return[2,this.hasVideoPermission]}}))}))},t.prototype.getAudioPermission=function(){return ef(this,void 0,void 0,(function(){var e=this;return tf(this,(function(t){switch(t.label){case 0:if(!navigator.mediaDevices||!navigator.mediaDevices.getUserMedia)throw new lP(aP.NOT_SUPPORTED,"GetUserMedia not supported");if(this.hasAudioPermission)return[2,!0];t.label=1;case 1:return t.trys.push([1,3,,4]),[4,navigator.mediaDevices.getUserMedia({audio:!0,video:!1}).then((function(t){t&&(t.getTracks().forEach((function(e){return e.stop()})),e.hasAudioPermission=!0,e.inited||e.refreshDevices())}))];case 2:case 3:return t.sent(),[3,4];case 4:return[2,this.hasAudioPermission]}}))}))},t.prototype.enumerateDevices=function(){return ef(this,void 0,void 0,(function(){return tf(this,(function(e){switch(e.label){case 0:return e.trys.push([0,2,,3]),[4,this.getAudioPermission()];case 1:case 2:return e.sent(),[3,3];case 3:return e.trys.push([3,5,,6]),[4,this.getVideoPermission()];case 4:case 5:return e.sent(),[3,6];case 6:return[4,this.refreshDevices()];case 7:return e.sent(),[2,Array.from(of(of(of([],nf(this.deviceMap.audioinput.values()),!1),nf(this.deviceMap.videoinput.values()),!1),nf(this.deviceMap.audiooutput.values()),!1))]}}))}))},t.prototype.enumerateAudioCaptureDevices=function(){return ef(this,void 0,void 0,(function(){return tf(this,(function(e){switch(e.label){case 0:return[4,this.refreshDevices()];case 1:return e.sent(),[2,Array.from(this.deviceMap.audioinput.values())]}}))}))},t.prototype.enumerateVideoCaptureDevices=function(){return ef(this,void 0,void 0,(function(){return tf(this,(function(e){switch(e.label){case 0:return[4,this.refreshDevices()];case 1:return e.sent(),[2,Array.from(this.deviceMap.videoinput.values())]}}))}))},t.prototype.enumerateAudioPlaybackDevices=function(){return ef(this,void 0,void 0,(function(){return tf(this,(function(e){switch(e.label){case 0:return[4,this.refreshDevices()];case 1:return e.sent(),[2,Array.from(this.deviceMap.audiooutput.values())]}}))}))},t.prototype.getDeviceById=function(e){return ef(this,void 0,void 0,(function(){return tf(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}))]}}))}))},Object.defineProperty(t.prototype,"hasAudioPermission",{get:function(){return this._hasAudioPermission},set:function(e){if(!e)throw new lP(aP.NO_PERMISSION,"Cannot revoke audio permission");this.refreshDevices(),this._hasAudioPermission=!0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"hasVideoPermission",{get:function(){return this._hasVideoPermission},set:function(e){if(!e)throw new lP(aP.NO_PERMISSION,"Cannot revoke Video permission");this.inited||this.refreshDevices(),this._hasVideoPermission=!0},enumerable:!1,configurable:!0}),t}(Ak),kF=new DF,MF=function(){function e(){}return e.prototype.getAudioContextInstance=function(){if(!this._audioContextInstance){var e=window.AudioContext||window.webkitAudioContext;this._audioContextInstance=new e}return this._audioContextInstance},e}(),UF=function(){function e(e){var t=LF.getAudioContextInstance();if(e instanceof MediaStreamTrack){var i=new MediaStream;i.addTrack(e),this._audioSource=t.createMediaStreamSource(i)}else e instanceof AudioNode?this._audioSource=e:(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.destroy=function(){this._audioSource.disconnect(),this._analyserNode.disconnect()},e}(),LF=new MF,xF=new Ik("VERTC",0),VF=new WeakMap,FF=function(e){return VF.get(e)},BF=function(e){function t(t,i){var r=e.call(this)||this;return r._trackId=t,r.mediaType=i,r}return A_(t,e),t.prototype.getId=function(){return this._trackId},t}(Ak),jF=function(e){function t(t,i,r){var n=e.call(this,i,r)||this;return n._mediaTrack=t,n._initListeners(),n}return A_(t,e),t.prototype.getTrack=function(){return this._mediaTrack},t.prototype.setTrack=function(e){this._mediaTrack=e},t.prototype.close=function(){var e;return null===(e=this._mediaTrack)||void 0===e?void 0:e.stop()},t.prototype._initListeners=function(){var e=this;this._mediaTrack instanceof MediaStreamTrack&&this._mediaTrack.addEventListener("ended",(function(){hx.rtcError("track-ended mediaType: ".concat(e._mediaTrack.kind),-1001),e.emit("track-ended",e)}))},t}(BF),GF=function(e){function t(t,i,r){var n=e.call(this,i,r)||this;return n._mediaTrack=t,n}return A_(t,e),t.prototype.getTrack=function(){return this._mediaTrack},t}(BF),HF=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}return A_(t,e),t.prototype.updateVideoCaptureConfig=function(){return ef(this,void 0,void 0,(function(){var e;return tf(this,(function(t){switch(t.label){case 0:return this.videoCaptureConfig&&this.getTrack()?(xF.print("updateVideoEncoderConfig","update localVideoTrack: ",this.videoCaptureConfig),[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}(jF),zF=function(e){function t(t,i){var r=e.call(this,t,i,"audio")||this;return r.mixType=sf.PLAYOUT_AND_PUBLISH,r}return A_(t,e),t.prototype.getAudioLevel=function(){return this._audioLevelFetcher||(this._audioLevelFetcher=new UF(this.getTrack())),this._audioLevelFetcher.getAudioLevel()},t.prototype.updateAudioCaptureConfig=function(){var e;return ef(this,void 0,void 0,(function(){return tf(this,(function(t){switch(t.label){case 0:return this.audioCaptureConfig?(xF.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}(jF),KF=function(e){function t(t,i){return e.call(this,t,i,"video")||this}return A_(t,e),t}(GF),WF=function(e){function t(t,i){return e.call(this,t,i,"audio")||this}return A_(t,e),t.prototype.getAudioLevel=function(){return this._audioLevelFetcher||(this._audioLevelFetcher=new UF(this.getTrack())),this._audioLevelFetcher.getAudioLevel()},t}(GF),XF=function(e){function t(t,i){return e.call(this,t,i)||this}return A_(t,e),t}(zF),YF=function(e){function t(t,i){return e.call(this,t,i)||this}return A_(t,e),t}(HF),qF=function(e){function t(t,i){return e.call(this,t,i)||this}return A_(t,e),t}(HF),JF=function(e){function t(t,i){return e.call(this,t,i)||this}return A_(t,e),t}(zF),QF=function(e){function t(t,i){return e.call(this,t,i)||this}return A_(t,e),t}(HF),ZF=function(e){function t(t,i){return e.call(this,t,i)||this}return A_(t,e),t}(zF);function $F(e){var t;return ef(this,void 0,void 0,(function(){var i,r,n,o,a,s;return tf(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]),xF.print("createCameraVideoTrack","constraints:",e),hx.rtcVideoCaptureEvent({event_type:ix.START,media_device_id:r}),n=KD(),[4,navigator.mediaDevices.getUserMedia({video:e})];case 2:return i=c.sent(),hx.rtcVideoCaptureEvent({event_type:ix.START_CAPTURE_RESULT,media_device_id:r,reason:nx.SUCCESS,elapse:KD()-n}),kF.hasVideoPermission=!0,[3,4];case 3:throw o=c.sent(),hx.rtcVideoCaptureEvent({event_type:ix.RUNNING_FAILED,media_device_id:r,error_code:o.code,reason:o.name+o.message}),new lP(aP.GET_VIDEO_TRACK_FAILED,"throw error from getUserMedia",o);case 4:return a=i.getVideoTracks()[0],VF.set(a,i),(s=new YF(a,zD())).videoCaptureConfig=e,[2,s]}}))}))}function eB(e,t){var i;return ef(this,void 0,void 0,(function(){var r,n,o,a,s,c,u,d,l,h,p;return tf(this,(function(_){switch(_.label){case 0:xF.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]),hx.rtcVideoCaptureEvent({event_type:ix.START,media_device_id:n}),l=KD(),[4,navigator.mediaDevices.getUserMedia({audio:e})];case 2:return r=_.sent(),hx.rtcVideoCaptureEvent({event_type:ix.START_CAPTURE_RESULT,media_device_id:n,reason:nx.SUCCESS,elapse:KD()-l}),kF.hasAudioPermission=!0,[3,4];case 3:throw h=_.sent(),hx.rtcVideoCaptureEvent({event_type:ix.RUNNING_FAILED,media_device_id:n,error_code:h.code,reason:h.name+h.message}),new lP(aP.GET_AUDIO_TRACK_FAILED,"throw error from getUserMedia",h);case 4:return p=r.getAudioTracks()[0],VF.set(p,r),[2,new XF(p,zD())]}}))}))}function tB(e,t){return void 0===e&&(e=!1),ef(this,void 0,void 0,(function(){var i,r,n;return tf(this,(function(o){switch(o.label){case 0:xF.print("createScreenStream","withAudio:",e),o.label=1;case 1:return o.trys.push([1,3,,4]),hx.rtcVideoCaptureEvent({event_type:ix.START,media_device_id:"screen"}),r=KD(),[4,navigator.mediaDevices.getDisplayMedia({video:t||!0,audio:e})];case 2:return i=o.sent(),hx.rtcVideoCaptureEvent({event_type:ix.START_CAPTURE_RESULT,media_device_id:"screen",reason:nx.SUCCESS,elapse:KD()-r}),[3,4];case 3:throw n=o.sent(),hx.rtcVideoCaptureEvent({event_type:ix.RUNNING_FAILED,media_device_id:"screen",error_code:n.code,reason:n.name+n.message}),new lP(aP.GET_SCREEN_TRACK_FAILED,"throw error from getDisplayMedia",n);case 4:return[2,i]}}))}))}!function(e){e[e.NONE=0]="NONE"}(PF||(PF={}));var iB,rB,nB=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}(),oB=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"}(iB||(iB={})),function(e){e[e.invalid=0]="invalid",e[e.cfgResolution=1]="cfgResolution",e[e.bitstreamHash=2]="bitstreamHash",e[e.screenCodec=3]="screenCodec"}(rB||(rB={}));var aB=new Uint8Array([109,167,53,190,103,90,72,1,170,89,63,164,194,199,19,85]),sB=new Uint8Array([109,167,53,190,103,90,72,1,170,89,63,164,194,199,19,84]);function cB(e){for(var t=[];e>=255;)e-=255,t.push(255);return t.push(e),new Uint8Array(t)}function uB(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 dB=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?aB:sB,a=cB(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(of(of(of(of(of(of(of([],nf(i),!1),nf(r),!1),nf(n),!1),nf(a),!1),nf(o),!1),nf(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=nf(uB(t,i+=2),2),n=r[0];i=r[1];var o=iB.bypass,a=i+n;return t.byteLength>=sB.byteLength&&n>=sB.byteLength&&t.slice(i,i+sB.byteLength).toString()===sB.toString()?(i+=sB.byteLength,o=iB.external):t.byteLength>=sB.byteLength&&n>=sB.byteLength&&t.slice(i,i+aB.byteLength).toString()===aB.toString()&&(i+=aB.byteLength,o=iB.internal),{type:o,payload:t.slice(i,a)}}}},e.parseInternalSEI=function(e){var t=new Map,i=0;if(e.type===iB.internal){for(;e.payload.byteLength-i>=2;){var r=nf(uB(e.payload,i),2),n=r[0];i=r[1];var o=nf(uB(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=rf(e),o=n.next();!o.done;o=n.next()){var a=nf(o.value,2),s=a[0],c=a[1],u=cB(s),d=cB(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}();Wr({target:"Number",stat:!0},{isNaN:function(e){return e!=e}}),new Ik("Stats",2);var lB,hB,pB,_B,fB,vB,mB=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}(),SB=function(e){function t(t){var i=e.call(this,t)||this;return i._stream=t,i}return A_(t,e),t.prototype.setLocalStreamStatsEvtInterval=function(e,t,i){var r,n,o=this;if(!this._timer){this.setVar(e,t,i),e.once(Hx.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=setTimeout((function e(){return ef(o,void 0,void 0,(function(){var t,i;return tf(this,(function(r){switch(r.label){case 0:return[4,ef(o,void 0,void 0,(function(){var e,t,i,r,n,o;return tf(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=setTimeout(e,2e3),[2]}}))}))}),2e3)}},t.prototype.unpublish=function(){this.delStatsEvtInterval()},t.prototype.getAudioStats=function(e,t){return ef(this,void 0,void 0,(function(){var i,r,n,o,a,s,c,u,d,l;return tf(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,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,S=e.id,y=e.currentRoundTripTime,g=e.state,E=e.writable,b=e.requestsReceived,T=e.responsesReceived,I=e.requestsSent,R=e.consentRequestsSent,A=e.responsesSent,C=e.jitter,O=e.candidateType,w=e.ip,N=e.address,P=e.networkType,D=e.port,k=e.protocol,M=e.nackCount,U=e.retransmittedBytesSent,L=e.retransmittedPacketsSent,x=e.roundTripTimeMeasurements,V=e.audioInputLevel,F=e.ssrc,B=e.totalAudioEnergy,j=e.totalSamplesDuration,G=e.mediaType,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=U,u.retransmitted_packets_sent=L,r.retransmittedPacketsSent=L):"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=S,u.ice_pair_rtt=y,u.ice_pair_state=g,u.ice_pair_writable=E,u.recv_ping_requests=b,u.recv_ping_responses=T,u.sent_ping_requests_before_first_response=I,u.sent_ping_requests_total=I+(R||0),u.sent_ping_responses=A):"local-candidate"===t?(u.local_candidate_type=O,u.local_ip=w||N,u.local_network_type=P,u.local_port=D,u.protocol=k):"remote-candidate"===t&&(u.remote_candidate_type=O,u.remote_ip=w||N,u.remote_port=D)})),(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,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 ef(this,void 0,void 0,(function(){var i,r,n,o,a,s,c,u,d,l,h,p,_,f;return tf(this,(function(v){switch(v.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,d={media_type:"video",is_screen:!!s,direction:"up",stream_id:o,vid:a,connection_status:navigator.onLine,capture_state:c.localvideo?"capture_state_on":"capture_state_off"},e&&this.handler?(i.isScreen=s,[4,this.handler.getStats(e)]):[2,i];case 1:return(l=v.sent()).length?(h=0,l.forEach((function(e){var t=e.type,n=e.framesEncoded,o=e.packetsLost,a=e.bytesSent,s=e.framesSent,c=e.roundTripTime,l=e.mimeType,p=e.frameWidth,_=e.frameHeight,f=e.packetsSent,v=e.googActualEncBitrate,m=e.googAvailableReceiveBandwidth,S=e.googAvailableSendBandwidth,y=e.googAvgEncodeMs,g=e.googBucketDelay,E=e.googEncodeUsagePercent,b=e.googFrameRateInput,T=e.availableIncomingBitrate,I=e.availableOutgoingBitrate,R=e.bytesReceived,A=e.nominated,C=e.id,O=e.currentRoundTripTime,w=e.state,N=e.writable,P=e.candidateType,D=e.ip,k=e.address,M=e.networkType,U=e.port,L=e.nackCount,x=e.pliCount,V=e.protocol,F=e.qpSum,B=e.requestsReceived,j=e.responsesReceived,G=e.googRetransmitBitrate,H=e.requestsSent,z=e.consentRequestsSent,K=e.responsesSent,W=e.ssrc,X=e.googTargetEncBitrate,Y=e.googTransmitBitrate,q=e.googRtt,J=e.retransmittedPacketsSent,Q=e.encoderImplementation,Z=e.jitter,$=e.rid,ee=e.fractionLost;"outbound-rtp"===t?(u&&($?r.simulcast[$]=e:r.simulcast[h]=e,h++),r.framesEncoded=n,r.bytesSent=a,r.framesSent=s,d.bytes=a,r.packetsSent=f,d.packetsSent=f,d.nackCount=L,d.pli_count=x,d.qp_sum=F,d.ssrc=W,d.retransmitted_packets_sent=J,r.retransmittedPacketsSent=J,d.encoder_implementation=Q):"track"===t?(i.encodedFrameWidth=p,i.encodedFrameHeight=_,d.frame_size_height=_,d.frame_size_width=p):"remote-inbound-rtp"===t?(r.packetsLost=o,i.rtt=1e3*c,d.rtt=i.rtt,d.jitter=Z,d.packetsLost=o,i._fractionLost=ee||0):"codec"===t?(i.codecType=l,d.codecName=l):"candidate-pair"===t?(d.ice_available_incoming_bitrate=T,d.ice_available_outgoing_bitrate=I,d.ice_bytes_received=R,d.ice_bytes_sent=a,d.ice_nominated=+A,d.ice_pair_id=C,d.ice_pair_rtt=O,d.ice_pair_state=w,d.ice_pair_writable=N,d.recv_ping_requests=B,d.recv_ping_responses=j,d.sent_ping_requests_before_first_response=H,d.sent_ping_requests_total=H+z,d.sent_ping_responses=K):"local-candidate"===t?(d.local_candidate_type=P,d.local_ip=D||k,d.local_network_type=M,d.local_port=U,d.protocol=V):"remote-candidate"===t?(d.remote_candidate_type=P,d.remote_ip=D||k,d.remote_port=U):"VideoBwe"===t?(d.encBitratebps=v,d.available_receive_bandwidth=m,d.available_send_bandwidth=S,d.bucket_delay=g,d.retransmitBitratebps=G,d.targetEncBitratebps=X,d.transmit_bitrate=Y,i._sendBandWidth=+S):"ssrc"===t&&(d.video_network_elapse=q,d.avg_encode_ms=y,d.encodeUsage=E,d.frame_rate_input=b,d.orignal_input_Framerate=+b)})),(p=t.video).timestamp?(i.statsInterval=r.timestamp-p.timestamp,d.stats_interval=i.statsInterval,_=Object.keys(r.simulcast),u?(d.sim_enc_width=[],d.sim_enc_height=[],d.sim_enc_bps=[],d.sim_enc_framerate=[],d.sim_rids=[],d.sim_enc_bandwidth=[],d.sim_sent_framerate=[],d.sim_fraction_lost=[],f=!1,_.sort((function(e,t){return+e-+t})).forEach((function(e){var t=r.simulcast[e],n=t.frameWidth,o=t.frameHeight,a=t.bytesSent,s=t.framesEncoded,c=t.framesSent,u=t.packetsLost,l=t.packetsSent,h=t.qualityLimitationReason,_=t.qualityLimitationDurations,v=t.qualityLimitationResolutionChanges,m=t.retransmittedPacketsSent;void 0!==h&&(d.sim_qualityLimitationReason||(d.sim_qualityLimitationReason=[],d.sim_qualityLimitationDurations=[],d.sim_qualityLimitationResolutionChanges=[]),d.sim_qualityLimitationReason.push(h),d.sim_qualityLimitationDurations.push(_),d.sim_qualityLimitationResolutionChanges.push(v));var S=p.simulcast[e];if(d.sim_enc_width.push(n||0),d.sim_enc_height.push(o||0),S){var y=(a-S.bytesSent||0)/i.statsInterval;d.sim_enc_bps.push(Math.round(8e3*y)),d.sim_enc_bandwidth.push(Math.round(8e3*y/1024));var g=1e3*(s-S.framesEncoded)/i.statsInterval;d.sim_enc_framerate.push(Math.round(g)),d.sim_rids.push(e);var E=void 0!==c?c-S.framesSent:s-S.framesEncoded,b=1e3*E/i.statsInterval;d.sim_sent_framerate.push(Math.round(b));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&&!f&&(i.sentKBitrate=8*y,i.encoderOutputFrameRate=g,i.encodedFrameCount=E,i.sentFrameRate=b,i.videoLossRate=T,f=!0)}})),this.monitor.rtcMediaStatistics(d,{})):(i.encodedFrameCount=void 0!==r.framesSent?r.framesSent-p.framesSent:r.framesEncoded-p.framesEncoded,i.sentKBitrate=(r.bytesSent-p.bytesSent||0)/i.statsInterval*8,d.bitrate=Math.round(1e3*i.sentKBitrate),d.bandwidth=Math.round(d.bitrate/1024),i.encoderOutputFrameRate=1e3*(r.framesEncoded-p.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-p.packetsLost)/(r.packetsSent-p.packetsSent),i.videoLossRate=Number.isNaN(i.videoLossRate)?0:i.videoLossRate,d.fraction_lost=i.videoLossRate,i._retransmittedRate=(r.retransmittedPacketsSent-p.retransmittedPacketsSent)/(r.packetsSent-p.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}(mB),yB=function(e){function t(t){var i=e.call(this,t)||this;return i._videoInWaiting=!1,i}return A_(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 ef(this,void 0,void 0,(function(){var a,s,c,u,d,l,h,p,_,f,v,m=this;return tf(this,(function(S){switch(S.label){case 0:return this._timer?[2]:(this.setVar(e,i,r),e.once(Hx.ABNORMAL_DISCONNECTION,(function(){m.destroy()})),this._audioStallInterval=t.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 S.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=KD(),r={isStall:!1,counted:!1,diff:0},n=.5*m._audioStallInterval;m._audioStallCount=function(){return ef(m,void 0,void 0,(function(){var o,a,c,u,h,f,v,m,S,y,g,E,b,T,I;return tf(this,(function(R){switch(R.label){case 0:return o=s.hasAudio,a=s.subAudio,o&&a?(c=null===(I=s.audioTrack)||void 0===I?void 0:I.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=R.sent(),f=Date.now(),v=KD(),(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:_}]):(S=h.length,y=h.find((function(e){return"inbound-rtp"===e.type})),y?(g=y.concealedSamples,E=y.totalSamplesReceived,T=E-t,(b=g-e)>=0&&T>=0&&b>=this._audioStallRatio*T?(p.push({concealed:b,received:T,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:T,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:S?"no inbound-rtp":"no report"}),[2,{stall_count:d,stall_duration:l,stall_list:p,stats_count:_}]))}}))}))},h=function(){return ef(m,void 0,void 0,(function(){return tf(this,(function(e){switch(e.label){case 0:return!this._audioStallCount&&this._setAudioStallCount&&this._setAudioStallCount(),this._audioStallCount?[4,this._audioStallCount()]:[3,2];case 1:e.sent(),this._audioStallTimer=setTimeout(h,this._audioStallInterval),e.label=2;case 2:return[2]}}))}))},m._audioStallTimer=setTimeout(h,m._audioStallInterval)}},this._setAudioStallCount(),f=function(){return ef(m,void 0,void 0,(function(){var e,t,i,r,n,o;return tf(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 ef(m,void 0,void 0,(function(){var e,t;return tf(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=setTimeout(h,this._audioStallInterval)),this._timer=setTimeout(v,2e3),[2]}}))}))},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 ef(this,void 0,void 0,(function(){var i,r,n,o,a,s,c,u,d,l,h,p,_,f,v,m,S,y;return tf(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,connection_status:navigator.onLine,mute_state:rk(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,S=e.currentRoundTripTime,y=e.audioLevel,g=e.totalAudioEnergy,E=e.totalSamplesDuration,b=e.mimeType,T=e.googDecodingNormal,I=e.fecPacketsReceived,R=e.availableIncomingBitrate,A=e.availableOutgoingBitrate,C=e.bytesSent,O=e.nominated,w=e.id,N=e.writable,P=e.jitter,D=e.candidateType,k=e.ip,M=e.address,U=e.networkType,L=e.port,x=e.protocol,V=e.audioOutputLevel,F=e.requestsReceived,B=e.responsesReceived,j=e.requestsSent,G=e.consentRequestsSent,H=e.responsesSent,z=e.ssrc,K=e.kind;"inbound-rtp"===t?(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!==I&&(l.fec_packets_received=I),l.jitter=1e3*P,l.ssrc=z):"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=A,l.ice_bytes_received=a,l.ice_bytes_sent=C,l.ice_nominated=+O,l.ice_pair_id=w,l.ice_pair_rtt=S,l.rtt=1e3*S,l.ice_pair_state=m,l.ice_pair_writable=N,l.recv_ping_requests=F,l.recv_ping_responses=B,l.sent_ping_requests_before_first_response=j,l.sent_ping_requests_total=j+(G||0),l.sent_ping_responses=H,"succeeded"===m&&(i.rtt=1e3*S,i.total_rtt=1e3*v)):"track"===t&&"audio"===K?(l.audio_level=y?-10*Math.log10(Math.pow(y,2)):y,l.volume=255*y,l.total_audio_energy=g,l.totalAudioDuration=E):"ssrc"===t?(l.decodingNormal=T,l.recvAudioLevel=V):"local-candidate"===t?(l.local_candidate_type=D,l.local_ip=k||M,l.local_network_type=U,l.local_port=L,l.protocol=x):"remote-candidate"===t&&(l.remote_candidate_type=D,l.remote_ip=k||M,l.remote_port=L)})),(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,S=f.stall_list,y=f.stats_count,_.stall_list=S,_.stats_count=y,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,this.monitor.rtcMediaStatistics(l,{},_),[2,i]}}))}))},t.prototype.getRemoteVideoStats=function(e,t){return ef(this,void 0,void 0,(function(){var i,r,n,o,a,s,c,u,d,l,h;return tf(this,(function(p){switch(p.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,d={media_type:"video",is_screen:!!s,direction:"down",stream_id:o,stream_user_id:a,vid:this._stream.videoMid,connection_status:navigator.onLine,mute_state:nk(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"},e&&this.handler?(i.isScreen=s,[4,this.handler.getStats(e)]):[2,i];case 1:return(l=p.sent()).length?(l.forEach((function(e){var t=e.type,n=e.frameHeight,o=e.frameWidth,a=e.packetsLost,s=e.packetsReceived,c=e.bytesReceived,u=e.framesDecoded,l=e.jitterBufferDelay,h=e.jitterBufferEmittedCount,p=e.mimeType,_=e.firCount,f=e.availableIncomingBitrate,v=e.availableOutgoingBitrate,m=e.bytesSent,S=e.nominated,y=e.id,g=e.currentRoundTripTime,E=e.state,b=e.writable,T=e.candidateType,I=e.ip,R=e.address,A=e.networkType,C=e.port,O=e.nackCount,w=e.pliCount,N=e.protocol,P=e.requestsReceived,D=e.responsesReceived,k=e.requestsSent,M=e.consentRequestsSent,U=e.responsesSent,L=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,d.ssrc=L,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=+S,d.ice_pair_id=y,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=P,d.recv_ping_responses=D,d.sent_ping_requests_before_first_response=k,d.sent_ping_requests_total=k+(M||0),d.sent_ping_responses=U):"local-candidate"===t?(d.local_candidate_type=T,d.local_ip=I||R,d.local_network_type=A,d.local_port=C,d.protocol=N):"remote-candidate"===t&&(d.remote_candidate_type=T,d.remote_ip=I||R,d.remote_port=C)})),(h=t.video).timestamp?(i.videoLossRate=(r.packetsLost-h.packetsLost)/(r.packetsReceived-h.packetsReceived+(r.packetsLost-h.packetsLost)),i._retransmittedRate=(r.nackCount-h.nackCount)/(r.packetsReceived-h.packetsReceived+(r.packetsLost-h.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-h.timestamp,d.stats_interval=i.statsInterval,i.receivedKBitrate=(r.bytesReceived-h.bytesReceived||0)/i.statsInterval*8,d.bitrate=Math.round(1e3*i.receivedKBitrate),d.bandwidth=Math.round(d.bitrate/1024),i.decoderOutputFrameRate=1e3*(r.framesDecoded-h.framesDecoded)/i.statsInterval,i.receivedFrameRate=1e3*(r.framesReceived-h.framesReceived)/i.statsInterval,d.frame_rate_decoded=Math.round(i.decoderOutputFrameRate),d.frame_rate_received=d.frame_rate_decoded,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}(mB);!function(e){e[e.CHANNEL_PROFILE_COMMUNICATION=0]="CHANNEL_PROFILE_COMMUNICATION",e[e.CHANNEL_PROFILE_LIVE_BROADCASTING=1]="CHANNEL_PROFILE_LIVE_BROADCASTING"}(lB||(lB={})),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"}(hB||(hB={})),function(e){e.TranscodeStateChanged="TranscodeStateChanged",e.TranscodeStarted="TranscodeStarted",e.TranscodeUpdated="TranscodeUpdated",e.TranscodeStoped="TranscodeStoped"}(pB||(pB={})),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"}(_B||(_B={})),function(e){e[e.PUB=0]="PUB",e[e.UNPUB=1]="UNPUB"}(fB||(fB={})),function(e){e[e.SUB=0]="SUB",e[e.UNSUB=1]="UNSUB"}(vB||(vB={}));var gB,EB=new Ik("Stream",0);!function(e){e[e.INIT=0]="INIT",e[e.SUB_ING=1]="SUB_ING",e[e.SUB_ED=2]="SUB_ED"}(gB||(gB={}));var bB,TB,IB,RB,AB=function(){function e(){this.isScreen=!1,this.seiList=[],this.videoEncodeConfig=[Qx],this.subVideoDescriptions=[],this.enableSimulcast=!1,this.prevScaleResolutionDownBy=1,this.pubAudio=!1,this.pubVideo=!1,this.stream=new MediaStream,this.videoInputConfig={width:640,height:360,frameRate:30},this.pubAttributes={localaudio:!1,localvideo:!1,videostream:!1,audiostream:!1,extvideo:!1,extaudio:!1},this.statsReport=new SB(this)}return Object.defineProperty(e.prototype,"hasPublished",{get:function(){return this.videoTransceiver&&this.audioTransceiver},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isEmptyStream",{get:function(){return!this.audioTrack&&!this.videoTrack},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"initStreamId",{get:function(){return this.stream.id},enumerable:!1,configurable:!0}),e.prototype.initVideoEncodedTransform=function(){var e=this;if(this.videoTransceiver&&this.videoTransceiver.sender){var t=this.videoTransceiver.sender;if(RV()){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=dB.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 EB.print("no sender found when trying to bind encodedTransform")},e.prototype.initAudioEncodedTransform=function(){if(this.audioTransceiver&&this.audioTransceiver.sender){var e=this.audioTransceiver.sender.createEncodedStreams(),t=e.readable,i=e.writable;t.pipeThrough(new TransformStream({transform:function(e,t){t.enqueue(e)}})).pipeTo(i)}else EB.print("no sender found when trying to bind encodedTransform")},e.prototype.clean=function(){var e;this.audioMid=void 0,this.videoMid=void 0,this.videoTransceiver=void 0,this.audioTransceiver=void 0,null===(e=this.observer)||void 0===e||e.reset(),this.statsReport.destroy(),this.prevScaleResolutionDownBy=1,this.subVideoDescriptions=[]},e.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)},e}(),CB=function(e){function t(t,i,r,n,o){void 0===o&&(o=W_.LOW);var a=e.call(this)||this;return a.userPriority=o,a.originalStreamIndex=0,a.userId=t,a.isScreen=r,a.streamId=i,a.hasAudio=n.audiostream&&n.localaudio,a.hasVideo=n.videostream&&n.localvideo,a._attributes=n,a.subVideo=!1,a.subAudio=!1,a._sequenceId=0,a.subMediaType=PF.NONE,a.subLayer={spatialLayer:0,spatialSubLayer:-1},a.streamState=gB.INIT,a.statsReport=new yB(a),a}return A_(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===gB.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){var r=nB.getNalunits(new oB(t.data)).find((function(e){return e.sei}));if(r){var n=dB.decodeSeiBody(r.body);n&&n.type!==iB.internal&&e.safeEmit("onSEIMessage",n.payload)}i.enqueue(t)}})).pipeTo(r)}else EB.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 EB.print("no receiver found when trying to bind encodedTransform")},t.prototype.ontrack=function(e){var t,i,r;if((null===(i=null===(t=e.streams)||void 0===t?void 0:t[0])||void 0===i?void 0:i.id)===this.streamId){var n=e.track;"video"===(null==n?void 0:n.kind)?this._setVideoTrack(n):"audio"===(null===(r=e.track)||void 0===r?void 0:r.kind)&&this._setAudioTrack(n),this._setStream(e.streams[0])}this.safeEmit("ontrack",e)},t.prototype.clean=function(){var e;EB.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=gB.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!==K_.DISABLE&&this.subVideo){if(this.attributes.videoDescriptions.length-1>this.subLayer.spatialLayer)return[this.originalMediaType,vB.SUB,this._getSubLayerBySpatialLayer(this.subLayer.spatialLayer+1)];if(e===K_.AUDIO_ONLY)return[x_.VIDEO,vB.UNSUB]}return null},t.prototype.getSubscribeRecoverParams=function(){if(this.originalMediaType&&nk(this.originalMediaType)){if(!1===this.subVideo)return[this.originalMediaType,vB.SUB,this.subLayer];if("number"==typeof this.originalStreamIndex&&this.subLayer.spatialLayer>this.originalStreamIndex)return[this.originalMediaType,vB.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 WF(e,zD()),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 KF(e,zD()),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}(Ak),OB=new Ik("queue",4);!function(e){e[e.ADD=0]="ADD",e[e.CLOSE=1]="CLOSE"}(IB||(IB={})),function(e){e.publish="publish",e.unpublish="unpublish",e.subscribe="subscribe",e.unsubscribe="unsubscribe",e.pushtrack="pushtrack",e.removetrack="removetrack"}(RB||(RB={}));var wB,NB,PB,DB=((bB={})[RB.publish]="unpublish",bB[RB.unpublish]="publish",bB[RB.subscribe]="unsubscribe",bB[RB.unsubscribe]="subscribe",bB[RB.pushtrack]="removetrack",bB[RB.removetrack]="pushtrack",bB),kB=((TB={})[RB.publish]=IB.ADD,TB[RB.subscribe]=IB.ADD,TB[RB.pushtrack]=IB.ADD,TB[RB.unpublish]=IB.CLOSE,TB[RB.unsubscribe]=IB.CLOSE,TB[RB.removetrack]=IB.CLOSE,TB),MB=function(e){function t(){var t=e.call(this)||this;return t._queue=[],t}return A_(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!==DB[t.action]||(i=t.streamId,OB.print("offsetStreamId",i),!1)})),this._queue.length===t&&this._queue.push(e),1===this._queue.length&&this.emit("start"),i},t.prototype.dequeue=function(){if(!this._queue.length)return null;for(var e=kB[this._queue[0].action],t=1;t<this._queue.length;t++)if(kB[this._queue[t].action]!==e)return{sdpStrategy:e,items:this._queue.splice(0,t)};return{sdpStrategy:e,items:this._queue.splice(0,this._queue.length)}},t}(gk),UB=new Ik("ChromeHandler",3),LB=RV(),xB=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 MB,r._sdpQueue.on("start",(function(){r._queueBusy||"stable"!==r._peerConnection.signalingState||(UB.print("dequeue start"),r.dequeue())})),r}return A_(t,e),t.prototype.connect=function(e){var t,i;return ef(this,void 0,void 0,(function(){var r,n,o,a,s,c,u=this;return tf(this,(function(d){switch(d.label){case 0:return UB.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,WV(e)];case 1:return r._answerIce=d.sent(),[4,this._peerConnection.createOffer()];case 2:return n=d.sent(),o=wV.parse(n.sdp),a=nf(o.media,1),s=a[0],this._offerIce.fingerprint=o.fingerprint||s.fingerprint,delete o.media,this._offerSession=Z_({},o),this._answerSession=Z_({},o),this._answerSession.fingerprint&&(this._answerSession.fingerprint=this._answerIce.fingerprint),c=this._mid++,this._offerMlines=[Z_(Z_(Z_({},s),this._offerIce),{mid:"".concat(c)})],this._answerMlines=[Z_(Z_(Z_({},s),this._answerIce),{sctpmap:{sctpmapNumber:5e3,app:"webrtc-datachannel",maxMessageSize:262144},mid:"".concat(c)})],this.setDescription(),[4,new Promise((function(e,t){u._dataChannel.onopen=function(){UB.print("connect","dataChannel open"),Ex("es.dc.open",""),e("")},u._dataChannel.onerror=function(e){hx.rtcSignalingMsgError(e.error.sdpLineNumber,e.error.errorDetail,wL.INVALID_DATA),Ex("es.dc.error",""),t(e)},u._dataChannel.onclose=function(e){Ex("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 3:return d.sent(),UB.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 ef(this,void 0,void 0,(function(){var r,n,o,a,s,c,u,d,l,h,p,_,f,v,m,S,y,g,E;return tf(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=Z_(Z_(Z_({},this._aSendonlyOfferTpl),this._offerIce),{mid:u,msid:"".concat(r.id," ").concat(r.id,"-audio"),ssrcs:HV(r,"audio")}),h=Z_(Z_(Z_({},this._vSendonlyOfferTpl),this._offerIce),{mid:d,msid:"".concat(r.id," ").concat(r.id,"-video")}),n?(UB.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=GV(),r=GV();return{ssrcs:[i,r].reduce((function(i,r){return i.concat(HV(e,t,r))}),[]),ssrcGroups:[{semantics:"FID",ssrcs:"".concat(i," ").concat(r)}]}}(r,"video"),f=_.ssrcs,v=_.ssrcGroups,h.ssrcs=f,h.ssrcGroups=v),(null==i?void 0:i.audioRed)&&Array.isArray(l.rtp)&&-1!==(m=l.rtp.findIndex((function(e){return"red"===e.codec})))&&(S=nf(l.rtp.splice(m,1),1),y=S[0],l.rtp.unshift(y)),(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()),this._mlinesCache[t.stream.id]=[l,h],[2,{partialSdp:KV(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 ef(this,void 0,void 0,(function(){var i,r,n,o,a,s,c,u,d,l;return tf(this,(function(h){switch(h.label){case 0:return UB.print("subscribe","mids: ",t),i="incroffer",r="unified-plan",this._aRecvonlyOfferTpl&&this._vRecvonlyOfferTpl?[3,3]:[4,ek(!0)];case 1:if(!(n=h.sent()))throw new lP(aP.NOT_SUPPORTED,"Get offer Error");return[4,this.createAVMlineOfferTpl(n)];case 2:h.sent(),h.label=3;case 3:return this._mlinesCache[e.streamId]?(o=nf(this._mlinesCache[e.streamId],2),a=o[0],s=o[1],[2,{partialSdp:KV(this._offerSession,a,s),audioMid:a.mid,videoMid:s.mid,type:i,semantics:r}]):(c="".concat(this._mid++),u="".concat(this._mid++),d=Z_(Z_(Z_({},this._aRecvonlyOfferTpl),this._offerIce),{mid:c}),l=Z_(Z_(Z_({},this._vRecvonlyOfferTpl),this._offerIce),{mid:u}),this._mlinesCache[e.streamId]=[d,l],[2,{partialSdp:KV(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 ef(this,void 0,void 0,(function(){return tf(this,(function(t){return UB.print("handleAck()","item: %o",e),[2,this._sdpQueue.enqueue(e)]}))}))},t.prototype.dequeue=function(){return ef(this,void 0,void 0,(function(){var e,t,i,r,n,o,a,s=this;return tf(this,(function(c){switch(c.label){case 0:return this._queueBusy=!0,e=this._sdpQueue.dequeue(),UB.print("dequeue()","ret: %o",e),e?(t=e.items,i=e.sdpStrategy,r=[],n=[],i===IB.ADD?(delete(o=Z_({},this._answerIce)).candidates,t.forEach((function(e){return ef(s,void 0,void 0,(function(){var t,i,a,s,c,u,d,l,h,p,_,f,v,m,S,y,g,E,b,T;return tf(this,(function(I){switch(I.label){case 0:return t=e.action,i=e.transceiverInit,a=e.signalingAck,s=e.stream,(c=s instanceof CB)&&(null==a?void 0:a.sequenceId)<s.sequenceId?[2]:(u={},d={},l=wV.parse(a.sdp),Array.isArray(l.media)&&(h="",l.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=Z_(Z_({},e),o)).type?(u=e,UB.print("audioMsid",e.msid),e.msid&&(h=e.msid.replace("audio","video"))):(d=e,UB.print("videoMsid",h),h&&(d.msid=h,h=""))}))),p=s.streamId,t===RB.publish&&(p=null===(b=s.stream)||void 0===b?void 0:b.id),_=nf(this._mlinesCache[p],2),f=_[0],v=_[1],i?(s.audioTransceiver=this._peerConnection.addTransceiver(i.aTrack,i.audioTransceiverInit),s.videoTransceiver=this._peerConnection.addTransceiver(i.vTrack,i.videoTransceiverInit),(m=this._inactiveMlineIndex.shift())||(m=this._offerMlines.length),this._offerMlines[m]=Z_(Z_({},f),{mid:u.mid}),this._answerMlines[m]=u,(S=this._inactiveMlineIndex.shift())||(S=this._offerMlines.length),this._offerMlines[S]=Z_(Z_({},v),{mid:d.mid}),this._answerMlines[S]=d,this._msidIndexMap[s.streamId]=[m,S],LB&&(s.initAudioEncodedTransform(),s.initVideoEncodedTransform()),r.push(s.streamId||""),n.push(c?s.userId:"local"),[3,5]):[3,1]);case 1:return c?(y=nf(this._msidIndexMap[s.streamId]||[],2),g=y[0],E=y[1],g&&E?(null===(T=this._offerMlines[g])||void 0===T?void 0:T.mid)===u.mid?[3,3]:(this._offerMlines[g]=zV(this._offerMlines[g]),this._offerMlines[E]=zV(this._offerMlines[E]),this._answerMlines[g]=zV(this._answerMlines[g]),this._answerMlines[E]=zV(this._answerMlines[E]),[4,this.setDescription()]):[3,4]):[3,5];case 2:I.sent(),this._offerMlines[g]=Z_(Z_({},this._aRecvonlyOfferTpl),{mid:u.mid}),this._offerMlines[E]=Z_(Z_({},this._vRecvonlyOfferTpl),{mid:d.mid}),UB.print("enqueue","hack: %o",s.streamId),I.label=3;case 3:return this._answerMlines[g]=u,this._answerMlines[E]=d,[3,5];case 4:UB.print("dequeue","pushtrack before subscribe: %o",s.userId),I.label=5;case 5:return c&&(s.sequenceId=null==a?void 0:a.sequenceId),[2]}}))}))}))):(a={},t.forEach((function(e){var t,i=e.audioMid,r=e.videoMid;a[i]=i,a[r]=r,delete s._msidIndexMap[null===(t=e.stream)||void 0===t?void 0:t.streamId]})),this._offerMlines=this._offerMlines.map((function(e,t){return a[e.mid]&&(e=zV(e),s._inactiveMlineIndex.push(t)),e})),this._inactiveMlineIndex.sort((function(e,t){return e-t})),this._answerMlines=this._answerMlines.map((function(e){return a[e.mid]&&(e=zV(e)),e}))),[4,this.setDescription(r.length?{streamId:r.join(","),streamUserId:n.join(",")}:void 0)]):(this._queueBusy=!1,[2]);case 1:return c.sent(),UB.print("dequeue","loop"),this.dequeue(),[2]}}))}))},t.prototype.setDescription=function(e){return ef(this,void 0,void 0,(function(){var t,i;return tf(this,(function(r){switch(r.label){case 0:return UB.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=KD(),e&&hx.rtcBeginCreateOffer("local"===e.streamUserId?DL.UP:DL.DOWN,e.streamId,e.streamUserId),[4,this._peerConnection.createOffer()];case 1:return r.sent(),e&&hx.rtcCreateOffer(0,"local"===e.streamUserId?kL.UP:kL.DOWN,e.streamId,e.streamUserId,KD()-i),[4,this.setLocalDescription(wV.write(this._offerSession),e)];case 2:return r.sent(),[4,this.setRemoteDescription(wV.write(this._answerSession),e)];case 3:return r.sent(),[2]}}))}))},t.prototype.getDefaultSdp=function(){return ef(this,void 0,void 0,(function(){var e,t,i;return tf(this,(function(r){switch(r.label){case 0:return[4,ek(!0)];case 1:if(!(e=r.sent()))throw new lP(aP.NOT_SUPPORTED,"Get offer Error");return this.createAVMlineOfferTpl(e),t=wV.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:wV.write(t),semantics:"unified-plan",type:"offer"}]}}))}))},t.prototype.rollback=function(e){return ef(this,void 0,void 0,(function(){return tf(this,(function(t){return delete this._mlinesCache[e],[2]}))}))},t.prototype.createAVMlineOfferTpl=function(e){var t=this;wV.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}(OV),VB=new Ik("FirefoxHandler",3),FB=function(e){function t(t,i){var r=e.call(this,t,i)||this;return r.name="firefox",r}return A_(t,e),t.prototype.connect=function(e){var t,i;return ef(this,void 0,void 0,(function(){var r,n,o,a,s,c,u=this;return tf(this,(function(d){switch(d.label){case 0:return VB.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,WV(e)];case 1:return r._answerIce=d.sent(),[4,this._peerConnection.createOffer()];case 2:return n=d.sent(),o=wV.parse(n.sdp),a=nf(o.media,1),s=a[0],this._offerIce.fingerprint=o.fingerprint||s.fingerprint,o.media=o.media.map((function(e){return Z_(Z_({},e),u._offerIce)})),(c=Z_({},o)).fingerprint=this._answerIce.fingerprint,c.media=c.media.map((function(e){return Z_(Z_(Z_({},e),u._answerIce),{sctpmap:{sctpmapNumber:5e3,app:"webrtc-datachannel",maxMessageSize:262144}})})),[4,this.setLocalDescription(wV.write(o))];case 3:return d.sent(),[4,this.setRemoteDescription(wV.write(c))];case 4:return d.sent(),[4,new Promise((function(e,t){u._dataChannel.onopen=function(){VB.print("connect","dataChannel open"),Ex("es.dc.open",""),e("")},u._dataChannel.onerror=function(e){hx.rtcSignalingMsgError(e.error.sdpLineNumber,e.error.errorDetail,wL.INVALID_DATA),Ex("es.dc.error",""),t(e)},u._dataChannel.onclose=function(e){Ex("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(),VB.print("connect","dataChannel establish success"),[2,this._dataChannel]}}))}))},t.prototype.publish=function(t,i){var r,n;return ef(this,void 0,void 0,(function(){var o,a,s,c,u,d,l,h,p,_,f,v=this;return tf(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=KD(),hx.rtcBeginCreateOffer(DL.UP,"",""),[4,this._peerConnection.createOffer()];case 1:return d=m.sent(),hx.rtcCreateOffer(0,kL.UP,"","",KD()-u),(l=wV.parse(d.sdp)).media=null===(r=l.media)||void 0===r?void 0:r.map((function(e){return Z_(Z_({},e),v._offerIce)})),[4,this.setLocalDescription(wV.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})),[4,this.setLocalDescription(wV.write(l))];case 3:return m.sent(),[2,{partialSdp:KV(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 ef(this,void 0,void 0,(function(){var r,n,o,a,s,c,u,d=this;return tf(this,(function(l){switch(l.label){case 0:return VB.print("subscribe()"),e.audioTransceiver=this._peerConnection.addTransceiver("audio",{direction:"recvonly"}),e.videoTransceiver=this._peerConnection.addTransceiver("video",{direction:"recvonly"}),r=KD(),hx.rtcBeginCreateOffer(DL.UP,e.streamId,e.userId),[4,this._peerConnection.createOffer()];case 1:return n=l.sent(),hx.rtcCreateOffer(0,kL.UP,e.streamId,e.userId,KD()-r),(o=wV.parse(n.sdp)).media=null===(t=o.media)||void 0===t?void 0:t.map((function(e){return Z_(Z_({},e),d._offerIce)})),[4,this.setLocalDescription(wV.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:KV(o,c,u),audioMid:a,videoMid:s,type:"incroffer",semantics:"unified-plan"}]}}))}))},t.prototype.handleAck=function(e){var t,i;return ef(this,void 0,void 0,(function(){var r,n,o,a,s,c=this;return tf(this,(function(u){return e.action===RB.unpublish||e.action===RB.unsubscribe||(r=e.signalingAck,n={},(o=wV.parse(null===(t=this._peerConnection.remoteDescription)||void 0===t?void 0:t.sdp)).media.forEach((function(e){n[e.mid]=e})),wV.parse(null==r?void 0:r.sdp).media.forEach((function(e){n[e.mid]=Z_(Z_({},e),c._answerIce)})),a=[],(s=wV.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(wV.write(o))),[2,""]}))}))},t.prototype.getDefaultSdp=function(){return ef(this,void 0,void 0,(function(){return tf(this,(function(e){return[2,{semantics:"unified-plan",sdp:"",type:"offer"}]}))}))},t.prototype.rollback=function(e,t){var i,r;return ef(this,void 0,void 0,(function(){var e,n,o;return tf(this,(function(a){switch(a.label){case 0:return VB.print("subscribe()"),t.audioTransceiver&&t.videoTransceiver?(t.audioTransceiver.stop(),t.videoTransceiver.stop(),e=[],(n=wV.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=zV(i)),"inactive"!==i.direction&&e.push(i.mid),i})),(o=wV.parse(null===(r=this._peerConnection.remoteDescription)||void 0===r?void 0:r.sdp)).media=n.media.map((function(e){return"".concat(e.mid)!==t.audioMid&&"".concat(e.mid)!==t.videoMid||(e=zV(e)),e})),n.groups&&o.groups&&(n.groups[0].mids=e.join(" "),o.groups[0].mids=e.join(" ")),[4,this.setLocalDescription(wV.write(n))]):[3,3];case 1:return a.sent(),[4,this.setRemoteDescription(wV.write(o))];case 2:a.sent(),a.label=3;case 3:return[2]}}))}))},t.prototype.setCurrentDescription=function(){return ef(this,void 0,void 0,(function(){return tf(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}(OV),BB="mozilla"===qD(),jB=function(e,t){return BB?new FB(e,t):new xB(e,t)},GB=new Ik("Locker",2),HB=1,zB=function(){function e(e){this.lockingPromise=Promise.resolve(),this.locks=0,this.name="",this.lockId=HB++,e&&(this.name=e),GB.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,GB.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,GB.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"}(NB||(NB={})),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"}(PB||(PB={}));var KB,WB=((wB={})[q_.communication]=[NB.communication],wB[q_.chat]=[NB.communication],wB[q_.chatRoom]=[NB.live_broadcasting,PB.IES_chatroom],wB[q_.coHost]=[NB.live_broadcasting,PB.IES_PK],wB[q_.meeting]=[NB.meeting],wB[q_.classRoom]=[NB.communication],wB),XB=new Ik("MediaServerClient",2),YB=5e3;!function(e){e.DISCONNECTED="disconnected",e.DISCONNECTING="disconnecting",e.CONNECTED="connected",e.CONNECTING="connecting"}(KB||(KB={}));var qB,JB=function(e,t){XB.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)},QB=function(e){function t(t,i){void 0===i&&(i=hx);var r=e.call(this)||this;return r._ontrackCallbackMap=new Map,r._subResolves={},r.supportConcurrent=!1,r._pubConfig={},r._subConfig={},r._roomProfile=q_.communication,r._subStreamQueue={},r.monitor=i,r._pubSubLock=new zB("pubSubLock"),r._joinLeaveLock=new zB("joinLeaveLock"),r._state=KB.DISCONNECTED,r._roomAttributes={multiChatMode:!1,bigRoomMode:!1},r._context=t,r.on("SUB_END",(function(e){return r._handleSubStreamQueue(e)})),r}return A_(t,e),t.prototype._addHandlerEvents=function(){var e,t=this;null===(e=this._handler)||void 0===e||e.once("disconnect",(function(){XB.print("emit ABNORMAL_DISCONNECTION ice"),t.safeEmit(Hx.ABNORMAL_DISCONNECTION)}))},t.prototype._addSignalEventHandler=function(){var e,t=this;[jx.ON_ADD_STREAM,jx.ON_REMOVE_STREAM,jx.USER_CONNECTION,jx.USER_DISCONNECTION,jx.ON_UPDATE_STREAM_ATTRIBUTES,jx.ON_UPDATE_ROOM_ATTRIBUTES,jx.ON_PUSH_TRACK,jx.ON_REMOVE_TRACK,jx.NODE_CHANGE,jx.ON_CUSTOM_MESSAGE,jx.USER_MESSAGE_RECEIVED,jx.USER_BINARY_MESSAGE_RECEIVED,jx.POST_PROCESSING_MESSAGE,jx.ON_USER_TOKEN_WILL_EXPIRE,jx.STREAM_CONTROL_MESSAGE,jx.ON_SCENE_CONFIG,Gx.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(){XB.print("emit ABNORMAL_DISCONNECTION datachannel"),t.safeEmit(Hx.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(Hx.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={}),ef(this,void 0,void 0,(function(){var o,a,s,c,u,d=this;return tf(this,(function(l){switch(l.label){case 0:return this.connectionState=KB.CONNECTING,this._appId=e,this._handler&&(this._removeSignalEventHandler(),this._handler.destroy()),r.node?(o=[r.node],Ex("es.join.nodeChange",r),[3,3]):[3,1];case 1:return Promise.resolve().then((function(){return d.emit("onGetIceConfigHook")})),this._iceConfigRequestManager=new sV,[4,null===(n=this._iceConfigRequestManager)||void 0===n?void 0:n.getAccessNode(e,t,i,wx.getDeviceId(),null==r?void 0:r.reason,null==r?void 0:r.feedbackNode,this._useCloudProxy)];case 2:if(!(o=l.sent()))throw Ex("es.join.getNodeFailed",""),new lP(aP.ICE_SERVER_WRONG,"get ICE config failed");Ex("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=jB(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,tk(c)];case 5:return l.sent(),XB.print("join","establish peerConnection success"),[3,7];case 6:throw u=l.sent(),this.connectionState=KB.DISCONNECTED,new lP(aP.ESTABLISH_DATACHANNEL_FAILED,"establish dataChannel failed",u);case 7:if(!a)throw this.connectionState=KB.DISCONNECTED,new lP(aP.ESTABLISH_DATACHANNEL_FAILED,"establish dataChannel failed");return this._dataChannelSignal=new nV(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),ef(this,void 0,void 0,(function(){var _,f,v,m,S,y,g,E=this;return tf(this,(function(b){switch(b.label){case 0:return XB.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(),y={Authorization:YD.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,IV()];case 2:return y.params=(g.supportedCodecs=b.sent(),g.deviceType="web",g.userAgent=window.navigator.userAgent,g.sdkVersion=$x.VERSION,g.deviceId=wx.getDeviceId(),g.appId=this._appId,g.roomId=this._roomId,g.userId=this._clientId,g.businessId=this._businessId,g.enable_cloud_proxy=this._useCloudProxy,g.channelProfile=WB[this._roomProfile]?WB[this._roomProfile][0]+"":"0",g),y.options={supportTokenExpireCallBack:!0,enableSceneConfigV2:!0},_=y,"chrome-stable"!==qD()&&"safari"!==qD()?[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(),XB.print("join","send join message success"),this._authorization=_.Authorization,this.connectionState=KB.CONNECTED,yB.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(S=b.sent(),this.connectionState=KB.DISCONNECTED,(null==S?void 0:S.code)>=700&&(null==S?void 0:S.code)<800)throw new lP(aP.INVALID_TOKEN,(null==S?void 0:S.message)||"Invalid token");if(200!==(null==S?void 0:S.code))throw new lP(aP.JOIN_ROOM_FAILED,(null==S?void 0:S.message)||"Join room failed");return[3,8];case 8:return[2]}}))}))},t.prototype.publish=function(e){var t,i,r,n,o,a,s,c,u,d;return ef(this,void 0,void 0,(function(){var l,h,p,_,f,v,m,S,y;return tf(this,(function(g){switch(g.label){case 0:XB.print("publish()","localStream: %o",e),l=e.videoTrack,h=e.audioTrack,p=KD(),_="",f="",g.label=1;case 1:return g.trys.push([1,4,,5]),[4,null===(t=this._handler)||void 0===t?void 0:t.publish(e,this._pubConfig)];case 2:if(!(v=g.sent()))throw new lP(aP.ADD_TRANSCEIVER_FAILED,"add transceiver failed");return _=v.audioMid,f=v.videoMid,e.pubAttributes={localaudio:!!h,localvideo:!!l,videostream:e.pubVideo,audiostream:e.pubAudio,extvideo:!!(l instanceof QF),extaudio:!!(h instanceof ZF)},m={attributes:Z_({videoDescriptions:v.videoDescriptions},e.pubAttributes),audio:!0,video:!0,screen:e.isScreen,audioMid:_,videoMid:f,sdpInfo:{msid:e.stream.id,type:v.type,sdp:v.partialSdp,semantics:v.semantics}},e.enableSimulcast&&this._pubConfig.simulcastOnDemand&&(m.attributes.subVideoDescriptions=v.subVideoDescriptions),[4,null===(i=this._dataChannelSignal)||void 0===i?void 0:i.sendSignaling("publish",m)];case 3:if(200!==(null==(S=g.sent())?void 0:S.code))throw new lP(aP.PUBLISH_FAILED,(null==S?void 0:S.message)||"publish failed");return hx.rtcRecvAnswer(0,LL.INCRANSWER,(null===(r=null==S?void 0:S.relayMessage)||void 0===r?void 0:r.sequenceId)||0,null===(n=null==S?void 0:S.relayMessage)||void 0===n?void 0:n.sdp,xL.UP,"",""),null===(o=this._handler)||void 0===o||o.handleAck({action:RB.publish,streamId:S.streamId,audioMid:_,videoMid:f,transceiverInit:v.transceiverInit,signalingAck:{audioMid:null===(a=null==S?void 0:S.relayMessage)||void 0===a?void 0:a.audioMid,videoMid:null===(s=null==S?void 0:S.relayMessage)||void 0===s?void 0:s.videoMid,sdp:null===(c=null==S?void 0:S.relayMessage)||void 0===c?void 0:c.sdp,sequenceId:null===(u=null==S?void 0:S.relayMessage)||void 0===u?void 0:u.sequenceId},stream:e}),e.streamId=S.streamId,e.videoMid=f,e.audioMid=_,e.subVideoDescriptions=v.subVideoDescriptions,this.monitor.rtcPublishStat(VL.SUCCESS,FL.W_0,p,BL.UNKNOWN),e.statsReport.setLocalStreamStatsEvtInterval(this,this._handler,this.monitor),[2];case 4:throw(y=g.sent())instanceof Error&&this.monitor.rtcPublishStat(VL.FAIL,FL.W_0,p,y.message),null===(d=this._handler)||void 0===d||d.rollback(e.stream.id,e),y;case 5:return[2]}}))}))},t.prototype.updatePubTrack=function(e){var t,i,r,n,o,a,s;return ef(this,void 0,void 0,(function(){var c,u,d,l,h,p,_,f,v,m,S,y,g,E,b,T,I,R,A,C,O,w,N,P,D,k,M;return tf(this,(function(U){switch(U.label){case 0:XB.print("updatePubTrack()","localStream: %o",e),c=e.videoTrack,u=e.audioTrack,d=e.pubAudio,l=e.pubVideo,h=null==u?void 0:u.getTrack(),p=null==c?void 0:c.getTrack(),l&&p?null===(t=e.videoTransceiver)||void 0===t||t.sender.replaceTrack(p):null===(i=e.videoTransceiver)||void 0===i||i.sender.replaceTrack(null),null===(r=this._handler)||void 0===r||r.updateScaleResolutionDownBy(e),d&&h?(f=(_=u).mixType,(v=_.mixedAudioTrack)&&f!==sf.PLAYOUT&&!0===h.enabled&&(h=v),null===(n=e.audioTransceiver)||void 0===n||n.sender.replaceTrack(h)):null===(o=e.audioTransceiver)||void 0===o||o.sender.replaceTrack(null),m={localaudio:!!u,localvideo:!!c,videostream:l,audiostream:d,extvideo:!!(c instanceof QF),extaudio:!!(u instanceof ZF)},S={};try{for(y=rf(Object.entries(m)),g=y.next();!g.done;g=y.next())E=nf(g.value,2),b=E[0],(T=E[1])!==Reflect.get(e.pubAttributes,b)&&Reflect.set(S,b,T)}catch(e){k={error:e}}finally{try{g&&!g.done&&(M=y.return)&&M.call(y)}finally{if(k)throw k.error}}return Object.keys(S).length?(e.observer&&(I=e.observer,R=S.audiostream,A=S.videostream,C=S.localaudio,w=S.extaudio,N=S.extvideo,void 0!==(O=S.localvideo)?void 0!==N?I.setPushVideo(N):I.setEnableVideo(O):void 0!==A&&I.setUnmuteVideo(A),void 0!==C?void 0!==w?I.setPushAudio(w):I.setEnableAudio(C):void 0!==R&&I.setUnmuteAudio(R)),e.pubAttributes=m,P={roomId:this._roomId,streamId:e.streamId,attributes:S},[4,null===(a=this._dataChannelSignal)||void 0===a?void 0:a.sendSignaling("updateStreamAttributes",P)]):[2];case 1:if(200!==(null==(D=U.sent())?void 0:D.code))throw new lP(aP.UPDATE_TRACK_FAILED,(null==D?void 0:D.message)||"update track failed");return"mozilla"!==qD()?[3,3]:[4,null===(s=this._handler)||void 0===s?void 0:s.setCurrentDescription()];case 2:U.sent(),U.label=3;case 3:return[2]}}))}))},t.prototype.updateToken=function(e){var t,i,r;return ef(this,void 0,void 0,(function(){var n,o;return tf(this,(function(a){switch(a.label){case 0:if(XB.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 lP(aP.UPDATE_TOKEN_WITH_INVALID_TOKEN,"invoke updateToken with an invalid token");return[3,4];case 3:throw a.sent(),new lP(aP.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 ef(this,void 0,void 0,(function(){var n;return tf(this,(function(o){return XB.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),null===(i=this._handler)||void 0===i||i.handleAck({action:RB.unpublish,audioMid:e.audioMid,videoMid:e.videoMid,stream:e,streamId:e.streamId}),e.statsReport.unpublish(),null===(r=this._handler)||void 0===r||r.rollback(e.stream.id,e),[2]}))}))},t.prototype.subscribe=function(e,t,i){return ef(this,void 0,void 0,(function(){var r=this;return tf(this,(function(n){return[2,new Promise((function(n,o){return ef(r,void 0,void 0,(function(){var r,a,s,c,u,d,l,h,p,_,f,v,m,S,y,g,E,b,T,I,R,A,C,O,w,N,P,D,k,M,U,L,x=this;return tf(this,(function(V){switch(V.label){case 0:if(e.streamState===gB.SUB_ED)return[2,this._updateSubTrack(e,t,vB.SUB).then(n,o)];if(e.streamState===gB.SUB_ING)return this._subStreamQueue[e.streamId]||(this._subStreamQueue[e.streamId]=[]),XB.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(XB.print("subscribe()","mediaType: %o",t),JB("subscribe()",e),e.streamState=gB.SUB_ING,r=!1,a=!1,rk(t)&&(a=!0),nk(t)&&(r=!0),!r&&this._multiChatMode())return[2,n(null)];s=KD(),c=e.audioMid,u=e.videoMid,l=e.paused,h=e.subVideo,V.label=1;case 1:return V.trys.push([1,8,,9]),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=V.sent(),[3,5];case 3:return[4,null===(A=this._handler)||void 0===A?void 0:A.subscribe(e)];case 4:if(!(d=V.sent()))throw new lP(aP.ADD_TRANSCEIVER_FAILED,"add transceiver failed");c=d.audioMid,u=d.videoMid,V.label=5;case 5:return e.paused=!r,e.subVideo=r,p={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:{spatialLayer:(null==i?void 0:i.spatialLayer)||0,temporalLayer:0,spatialSubLayer:(null==i?void 0:i.spatialSubLayer)||-1}}},[4,null===(C=this._dataChannelSignal)||void 0===C?void 0:C.sendSignaling("subscribe",p)];case 6:if(200!==(null==(_=V.sent())?void 0:_.code))throw new lP(aP.SUBSCRIBE_FAILED,(null==_?void 0:_.message)||"subscribe failed");return f=[],v=!this._multiChatMode(),m=!e.videoTrack,this._subResolves[e.streamId]||(this._subResolves[e.streamId]=[]),m&&f.push(new Promise((function(t,i){x._subResolves[e.streamId].push(t);var r=setTimeout((function(){return i(new lP(aP.TIME_OUT,"wait video timeout for userId: ".concat(e.userId)))}),YB);e.on("ontrack",(function i(n){"video"===n.mediaType&&(XB.print("remoteStream ".concat(e.userId," received video track")),e.off("ontrack",i),clearTimeout(r),t(0))}))}))),v&&f.push(new Promise((function(t,i){x._subResolves[e.streamId].push(t);var r=setTimeout((function(){return i(new lP(aP.TIME_OUT,"wait audio timeout for userId: ".concat(e.userId)))}),YB);e.on("ontrack",(function i(n){"audio"===n.mediaType&&(XB.print("remoteStream ".concat(e.userId," received audio track")),e.off("ontrack",i),clearTimeout(r),t(0))}))}))),S=function(t){e.ontrack(t)},null===(O=this._handler)||void 0===O||O.on("ontrack",S),this._ontrackCallbackMap.set(e,S),y=null==_?void 0:_.relayMessage,g=y.audioMid,E=y.videoMid,(I={})[c]=g,I[u]=E,b=I,XB.print("sub midmap",e.userId,b),e.videoMid=E,e.audioMid=g,e._workaround_1_=!1,e.subMediaType=t,e.streamState=gB.SUB_ED,hx.rtcRecvAnswer(0,LL.INCRANSWER,(null===(w=null==_?void 0:_.relayMessage)||void 0===w?void 0:w.sequenceId)||0,null===(N=null==_?void 0:_.relayMessage)||void 0===N?void 0:N.sdp,xL.DOWN,e.streamId,e.userId),null===(P=this._handler)||void 0===P||P.handleAck({action:RB.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===(k=null==_?void 0:_.relayMessage)||void 0===k?void 0:k.videoMid,sdp:null===(M=null==_?void 0:_.relayMessage)||void 0===M?void 0:M.sdp,sequenceId:null===(U=null==_?void 0:_.relayMessage)||void 0===U?void 0:U.sequenceId},stream:e}),[4,Promise.all(f)];case 7:return V.sent(),this._multiChatMode()||(e.subAudio=a),this.monitor.rtcSubscribeStat(jL.SUCCESS,s,GL.UNKNOWN,e.userId),e.statsReport.setRemoteStreamStatsEvtInterval(this,this._handler,this.monitor),n(null),this.emit("SUB_END",e.streamId),[3,9];case 8:return(T=V.sent())instanceof Error&&this.monitor.rtcSubscribeStat(jL.FAIL,s,T.message,e.userId),e.paused=l,e.subVideo=h,e.streamState=gB.INIT,null===(L=this._handler)||void 0===L||L.rollback(e.streamId,e),o(T),this.emit("SUB_END",e.streamId),[3,9];case 9:return[2]}}))}))}))]}))}))},t.prototype._handleSubStreamQueue=function(e){var t,i=this;if(null===(t=this._subStreamQueue[e])||void 0===t?void 0:t.length){XB.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 XB.print("_subStreamQueue","streamId: %o, END",e)},t.prototype.controlMessage=function(e){var t;return ef(this,void 0,void 0,(function(){var i;return tf(this,(function(r){switch(r.label){case 0:return XB.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 ef(this,void 0,void 0,(function(){return tf(this,(function(i){switch(i.label){case 0:return XB.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 ef(this,void 0,void 0,(function(){return tf(this,(function(n){return[2,this._updateSubTrack(e,t,i,r||e.subLayer)]}))}))},t.prototype._updateSubTrack=function(e,t,i,r){var n,o,a,s,c;return void 0===r&&(r={spatialLayer:0,spatialSubLayer:-1}),ef(this,void 0,void 0,(function(){var u,d,l,h,p;return tf(this,(function(_){switch(_.label){case 0:return XB.print("updateSubTrack()","mediaType: %o, subLayer: %o",t,r),JB("updateSubTrack()",e),u=0,u=i===vB.SUB?e.subMediaType|t:e.subMediaType-(e.subMediaType&t),XB.print("updateSubTrack","prev: %o, direction: %o, mediaType: %o, newMediaType: %o",e.subMediaType,i,t,u),e.subMediaType===u&&XB.print("updateSubTrack","mediaType no change"),d=!1,l=!1,rk(u)&&(l=!0),nk(u)&&(d=!0),h={roomId:this._roomId,streamList:[e.streamId],config:{enableMediaType:{video:d,audio:!!this._multiChatMode()||l},qualityLayer:{spatialLayer:null!==(n=r.spatialLayer)&&void 0!==n?n:0,temporalLayer:0,spatialSubLayer:null!==(o=r.spatialSubLayer)&&void 0!==o?o:-1}}},[4,null===(a=this._dataChannelSignal)||void 0===a?void 0:a.sendSignaling("updateSubscribe",h)];case 1:if(200!==(null==(p=_.sent())?void 0:p.code))throw new lP(aP.UPDATE_TRACK_FAILED,(null==p?void 0:p.message)||"update track failed");return e.paused=!d,this._multiChatMode()||(null===(s=e.observer)||void 0===s||s.setUnmuteAudio(l),e.subAudio=l),null===(c=e.observer)||void 0===c||c.setUnmuteVideo(d),e.subVideo=d,e.subMediaType=u,e.subLayer=r,[2,e]}}))}))},t.prototype.subscribe4pushTrack=function(e,t){var i,r,n,o,a;return ef(this,void 0,void 0,(function(){var s,c,u,d,l,h,p,_,f,v,m,S=this;return tf(this,(function(y){switch(y.label){case 0:if(XB.print("subscribe4pushTrack()","streamInfo: %o",t),JB("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 XB.print("subscribe4pushTrack","sequenceId return",d,e.sequenceId),[2];l=e.audioMid,h=e.videoMid,null===(i=e.observer)||void 0===i||i.setPushTrack(!0),y.label=1;case 1:return y.trys.push([1,7,,8]),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=y.sent(),[3,5];case 3:return[4,null===(n=this._handler)||void 0===n?void 0:n.subscribe(e)];case 4:if(!(p=y.sent()))throw new lP(aP.ADD_TRANSCEIVER_FAILED,"add transceiver failed");l=p.audioMid,h=p.videoMid,y.label=5;case 5:return(m={})[l]=c,m[h]=u,_=m,XB.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){S._subResolves[e.streamId].push(t);var r=setTimeout((function(){return i(new lP(aP.TIME_OUT,"wait audio timeout for userId: ".concat(e.userId)))}),YB);e.on("ontrack",(function i(n){"audio"===n.mediaType&&(XB.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),null===(a=this._handler)||void 0===a||a.handleAck({action:RB.pushtrack,streamId:e.streamId,audioMid:l,videoMid:h,stream:e,transceiverInit:null==p?void 0:p.transceiverInit,signalingAck:null==t?void 0:t.message}),[4,Promise.all(f)];case 6:return y.sent(),e.statsReport.setRemoteStreamStatsEvtInterval(this,this._handler,this.monitor),[2];case 7:throw y.sent();case 8:return[2]}}))}))},t.prototype.unsubscribe4removeTrack=function(e,t){var i,r,n;return ef(this,void 0,void 0,(function(){return tf(this,(function(o){return JB("unsubscribe4removeTrack()",e),XB.print("unsubscribe4removeTrack()","sequenceId: ",t.sequenceId),t.sequenceId<e.sequenceId?(XB.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),null===(r=this._handler)||void 0===r||r.handleAck({action:RB.removetrack,streamId:e.streamId,audioMid:e.audioMid,videoMid:e.videoMid,stream:e}),null===(n=this._handler)||void 0===n||n.rollback(e.streamId,e),this._subResolves[e.streamId]&&this._subResolves[e.streamId].forEach((function(e){return e(0)})),XB.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),ef(this,void 0,void 0,(function(){var c,u,d;return tf(this,(function(l){switch(l.label){case 0:return JB("unsubscribe()",e),c=e.subMediaType-(e.subMediaType&t),i||!this._subConfig.muteReplaceUnsub&&c===PF.NONE?(u={roomId:this._roomId,streamId:e.streamId,userId:e.userId},null===(r=this._dataChannelSignal)||void 0===r||r.sendSignaling("unsubscribe",u),e.streamState=gB.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,2]:(null===(o=e.observer)||void 0===o||o.setSubscribeAudio(!1),[4,null===(a=this._handler)||void 0===a?void 0:a.handleAck({action:RB.unsubscribe,streamId:e.streamId,audioMid:e.audioMid,videoMid:e.videoMid,stream:e})])):[2,this._updateSubTrack(e,t,vB.UNSUB)];case 1:d=l.sent(),null===(s=this._handler)||void 0===s||s.rollback(e.streamId,e),this._subResolves[d]&&this._subResolves[d].forEach((function(e){return e(0)})),XB.print("unsubscribe","clean unsub ".concat(e.userId)),e.clean(),this.removeOnTrackListener(e),e.statsReport.unsubscribe(),l.label=2;case 2: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 ef(this,void 0,void 0,(function(){return tf(this,(function(i){return JB("handleRemoveStream()",e),e.subVideo=!1,t.message&&t.message!==Fx.videoMuted?e._workaround_1_=!1:e._workaround_1_=!0,e.hasSubscribed?(this.unsubscribe(e,x_.AUDIO_AND_VIDEO,!0),[2]):[2]}))}))},t.prototype.leave=function(){var e;return ef(this,void 0,void 0,(function(){var t,i,r;return tf(this,(function(n){switch(n.label){case 0:return XB.print("leave()"),this.connectionState!==KB.CONNECTED?[3,7]:(this.connectionState=KB.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=KB.DISCONNECTED,[3,6];case 4:throw r=n.sent(),this.connectionState=KB.CONNECTED,r;case 5:return i(),[7];case 6:return[3,8];case 7:return[2,Promise.reject(new lP(aP.NOT_CONNECTED_YET,"server not connected"))];case 8:return[2]}}))}))},t.prototype.subscribePublicStream=function(e){var t,i,r,n;return ef(this,void 0,void 0,(function(){var o,a,s,c,u,d,l,h,p,_,f,v,m,S=this;return tf(this,(function(y){switch(y.label){case 0:return[4,null===(t=this._handler)||void 0===t?void 0:t.subscribe(e)];case 1:if(!(o=y.sent()))throw new lP(aP.ADD_TRANSCEIVER_FAILED,"add transceiver failed");return a=KD(),s=o.audioMid,c=o.videoMid,u={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},config:{enableMediaType:{audio:!0,video:!0},qualityLayer:{spatialLayer:0,temporalLayer:0}}},[4,null===(i=this._dataChannelSignal)||void 0===i?void 0:i.sendSignaling("startPullStream",u)];case 2:return d=y.sent(),l=[],this._subResolves[e.streamId]=[],l.push(new Promise((function(t,i){S._subResolves[e.streamId].push(t);var r=setTimeout((function(){return i(new lP(aP.TIME_OUT,"wait video timeout for streamId: ".concat(e.streamId)))}),YB);e.on("ontrack",(function i(n){"video"===n.mediaType&&(XB.print("remoteStream ".concat(e.userId," received video track")),e.off("ontrack",i),clearTimeout(r),t(0))}))}))),l.push(new Promise((function(t,i){S._subResolves[e.streamId].push(t);var r=setTimeout((function(){return i(new lP(aP.TIME_OUT,"wait audio timeout for streamId: ".concat(e.streamId)))}),YB);e.on("ontrack",(function i(n){"audio"===n.mediaType&&(XB.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=gB.SUB_ED,e.subAudio=!0,e.subVideo=!0,null===(n=this._handler)||void 0===n||n.handleAck({action:RB.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}),[4,Promise.all(l)];case 3:return y.sent(),this.monitor.rtcSubscribeStat(jL.SUCCESS,a,GL.UNKNOWN,e.userId),e.statsReport.setRemoteStreamStatsEvtInterval(this,this._handler,this.monitor),[2]}}))}))},t.prototype.unsubscribePublicStream=function(e){var t,i,r;return ef(this,void 0,void 0,(function(){var n;return tf(this,(function(o){switch(o.label){case 0:JB("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=gB.INIT,e.subVideo=!1,e.subAudio=!1,null===(i=this._handler)||void 0===i||i.handleAck({action:RB.unsubscribe,streamId:e.streamId,audioMid:e.audioMid,videoMid:e.videoMid,stream:e}),null===(r=this._handler)||void 0===r||r.rollback(e.streamId,e),e.clean(),this.removeOnTrackListener(e),e.statsReport.unsubscribe(),[2]}}))}))},t.prototype.destroy=function(){var e,t,i;XB.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=KB.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}),$_([ej],t.prototype,"join",null),$_([$B,ZB],t.prototype,"publish",null),$_([$B,ZB],t.prototype,"updatePubTrack",null),$_([$B,ZB],t.prototype,"unpublish",null),$_([$B,ZB],t.prototype,"subscribe",null),$_([ZB],t.prototype,"controlMessage",null),$_([ZB],t.prototype,"updateUserAttributes",null),$_([ZB],t.prototype,"updateSubTrack",null),$_([ZB],t.prototype,"subscribe4pushTrack",null),$_([ZB],t.prototype,"unsubscribe4removeTrack",null),$_([$B,ZB],t.prototype,"unsubscribe",null),$_([ZB],t.prototype,"handleRemoveStream",null),$_([$B],t.prototype,"subscribePublicStream",null),$_([$B],t.prototype,"unsubscribePublicStream",null),t}(Ak);function ZB(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 ef(this,void 0,void 0,(function(){return tf(this,(function(i){switch(i.label){case 0:return this._handler&&this._state===KB.CONNECTED?[4,r.apply(this,e)]:[3,2];case 1:return i.sent(),[3,3];case 2:throw new lP(aP.NOT_CONNECTED_YET,"error in ".concat(t,": try again after joined"));case 3:return[2]}}))}))},i}function $B(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 ef(this,void 0,void 0,(function(){var t;return tf(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 ej(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 ef(this,void 0,void 0,(function(){var t,i=this;return tf(this,(function(n){return t=!1,[2,new Promise((function(n,o){return ef(i,void 0,void 0,(function(){var i,a;return tf(this,(function(s){switch(s.label){case 0:this.on("INTERRUPT",(function(){t=!0,o(new lP(aP.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"}(qB||(qB={}));var tj,ij=function(){function e(e,t){this._audioEventSessionId=QD(),this._videoEventSessionId=QD(),this._isScreen=!1,this._audioFirstFrameState=qB.INITIAL,this._videoFirstFrameState=qB.INITIAL,this._timeout=1e4,this._currentAudioRecv={startTime:0,eventSessionId:0,type:WL.LOGIN},this._currentVideoRecv={startTime:0,eventSessionId:0,type:WL.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 ef(this,void 0,void 0,(function(){var s,c,u,d,l,h,p,_=this;return tf(this,(function(f){switch(f.label){case 0:return[4,this.getTransportDelay()];case 1:return f.sent(),s=this._transportDelay,c=!0,u=WL.LOGIN,d=WL.UNMUTE,l=WL.SUBSCRIBE,h=WL.PUSH_TRACK,[u,d,l,h].indexOf(t)>=0&&(s=0,c=!1),e===KL.AUDIO?(c||this._audioEventSessionId++,this._currentAudioRecv={startTime:Date.now(),eventSessionId:this._audioEventSessionId,type:t},p={media_type:e,event_type:zL.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(KL.AUDIO,XL.TIMEOUT),_._firstAudioFrameInterval&&window.clearInterval(_._firstAudioFrameInterval)}),this._timeout),hx.rtcFirstFrame(p),this._watchForFirstAudioFrameRecv(),this._audioFirstFrameState=qB.BEGIN,this._login=!0,this._unMuteAudio=!0,this._enableAudio=!0,this._remoteUnmuteAudio=!0):e===KL.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)?KL.SCREEN_VIDEO:e,event_type:zL.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(KL.VIDEO,XL.TIMEOUT),_._firstVideoFrameInterval&&window.clearInterval(_._firstVideoFrameInterval)}),this._timeout),this._watchForFirstVideoFrameRecv(),hx.rtcFirstFrame(p),this._videoFirstFrameState=qB.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===KL.AUDIO){if(this._audioFirstFrameState!==qB.BEGIN)return;var u={event_type:zL.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,hx.rtcFirstFrame(u),this._audioFirstFrameState=qB.STOPPED}else if(e===KL.VIDEO){if(this._videoFirstFrameState!==qB.BEGIN)return;u={event_type:zL.RECV_END,media_type:(null===(o=this._stream)||void 0===o?void 0:o.isScreen)?KL.SCREEN_VIDEO:e,start:null===(a=this._currentVideoRecv)||void 0===a?void 0:a.startTime,reason:t,result:!1,stream_user_id:null===(s=this._stream)||void 0===s?void 0:s.userId,event_session_id:this._videoEventSessionId,type:null===(c=this._currentVideoRecv)||void 0===c?void 0:c.type};this._firstVideoFrameTimer&&window.clearTimeout(this._firstVideoFrameTimer),delete this._currentVideoRecv,hx.rtcFirstFrame(u),this._videoFirstFrameState=qB.STOPPED}},e.prototype.recvFrameFinish=function(e){var t,i,r;return ef(this,void 0,void 0,(function(){var n,o,a,s,c,u,d,l,h,p;return tf(this,(function(_){switch(_.label){case 0:return[4,this.getTransportDelay()];case 1:if(_.sent(),n=this._transportDelay,o=WL.LOGIN,a=WL.UNMUTE,s=WL.SUBSCRIBE,c=WL.PUSH_TRACK,e===KL.AUDIO){if(this._audioFirstFrameState!==qB.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:zL.RECV_END,media_type:e,start:h,result:!0,stream_user_id:null===(t=this._stream)||void 0===t?void 0:t.userId,event_session_id:this._audioEventSessionId,type:l,transport_delay:n},delete this._currentAudioRecv,this._firstAudioFrameTimer&&window.clearTimeout(this._firstAudioFrameTimer),hx.rtcFirstFrame(p),this._audioFirstFrameState=qB.RECEIVED}else if(e===KL.VIDEO){if(this._videoFirstFrameState!==qB.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:zL.RECV_END,media_type:(null===(i=this._stream)||void 0===i?void 0:i.isScreen)?KL.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),hx.rtcFirstFrame(p),this._videoFirstFrameState=qB.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(KL.AUDIO,WL.LOGIN),e&&(null===(r=this._stream)||void 0===r?void 0:r.hasVideo)&&t.video&&this.beginRecvFrame(KL.VIDEO,WL.LOGIN),!e&&(null===(n=this._stream)||void 0===n?void 0:n.hasAudio)&&this.stopRecvFrame(KL.AUDIO,XL.LEAVE_ROOM),!e&&(null===(o=this._stream)||void 0===o?void 0:o.hasVideo)&&this.stopRecvFrame(KL.VIDEO,XL.LEAVE_ROOM))},e.prototype.setUnmuteAudio=function(e){var t;this._unMuteAudio!==e&&(this._unMuteAudio=e,this._unMuteAudio?this.beginRecvFrame(KL.AUDIO,WL.UNMUTE):(null===(t=this._stream)||void 0===t?void 0:t.hasAudio)&&this.stopRecvFrame(KL.AUDIO,XL.MUTE))},e.prototype.setRemoteUnmuteAudio=function(e){var t;this._remoteUnmuteAudio!==e&&(this._remoteUnmuteAudio=e,this._remoteUnmuteAudio?this.beginRecvFrame(KL.AUDIO,WL.REMOTE_UNMUTE):(null===(t=this._stream)||void 0===t?void 0:t.hasAudio)&&this.stopRecvFrame(KL.AUDIO,XL.REMOTE_MUTE))},e.prototype.setEnableAudio=function(e){var t;this._enableAudio!==e&&(this._enableAudio=e,this._enableAudio?this.beginRecvFrame(KL.AUDIO,WL.ENABLE):(null===(t=this._stream)||void 0===t?void 0:t.hasAudio)&&this.stopRecvFrame(KL.AUDIO,XL.DISABLE))},e.prototype.setUnmuteVideo=function(e){var t;this._unMuteVideo!==e&&(this._unMuteVideo=e,this._unMuteVideo?this.beginRecvFrame(KL.VIDEO,WL.UNMUTE):(null===(t=this._stream)||void 0===t?void 0:t.hasVideo)&&this.stopRecvFrame(KL.VIDEO,XL.MUTE))},e.prototype.setRemoteUnmuteVideo=function(e){var t;this._remoteUnmuteVideo!==e&&(this._remoteUnmuteVideo=e,this._remoteUnmuteVideo?this.beginRecvFrame(KL.VIDEO,WL.REMOTE_UNMUTE):(null===(t=this._stream)||void 0===t?void 0:t.hasAudio)&&this.stopRecvFrame(KL.VIDEO,XL.REMOTE_MUTE))},e.prototype.setEnableVideo=function(e){this._enableVideo!==e&&(this._enableVideo=e,this._enableVideo?this.beginRecvFrame(KL.VIDEO,WL.ENABLE):this.stopRecvFrame(KL.VIDEO,XL.DISABLE))},e.prototype.setExternalAudioSource=function(e){this._audioExternal=e},e.prototype.setPushAudio=function(e){var t;this._audioExternal&&this._pushAudio!==e&&(this._pushAudio=e),this._pushAudio&&this.beginRecvFrame(KL.AUDIO,WL.PUSH),!e&&(null===(t=this._stream)||void 0===t?void 0:t.hasAudio)&&this.beginRecvFrame(KL.AUDIO,WL.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(KL.VIDEO,WL.PUSH),!e&&(null===(t=this._stream)||void 0===t?void 0:t.hasVideo)&&this.beginRecvFrame(KL.VIDEO,WL.PUSH)},e.prototype.setPublishVideo=function(e){var t;this._publishVideo!==e&&(this._publishVideo=e),this._publishVideo&&this.beginRecvFrame(KL.VIDEO,WL.PUBLISH),!e&&(null===(t=this._stream)||void 0===t?void 0:t.hasVideo)&&this.stopRecvFrame(KL.VIDEO,XL.UNPUBLISH)},e.prototype.setPublishAudio=function(e){var t;this._publishAudio!==e&&(this._publishAudio=e),this._publishAudio&&this.beginRecvFrame(KL.AUDIO,WL.PUBLISH),!e&&(null===(t=this._stream)||void 0===t?void 0:t.hasAudio)&&this.stopRecvFrame(KL.AUDIO,XL.UNPUBLISH)},e.prototype.setAutoSubscribe=function(e){this._autoSubscribe=e},e.prototype.setAutoSubscribeVideo=function(e){this._autoSubscribeVideo=e},e.prototype.setAutoSubscribeAudio=function(e){this._autoSubscribeAudio=e},e.prototype.setSubscribeAudio=function(e){var t,i;this._autoSubscribeAudio||this._subscribeAudio===e||(this._subscribe=e,e&&(null===(t=this._stream)||void 0===t?void 0:t.hasAudio)&&this.beginRecvFrame(KL.AUDIO,WL.SUBSCRIBE)),!e&&(null===(i=this._stream)||void 0===i?void 0:i.hasAudio)&&this.stopRecvFrame(KL.AUDIO,XL.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(KL.VIDEO,WL.SUBSCRIBE)),!e&&(null===(i=this._stream)||void 0===i?void 0:i.hasVideo)&&this.stopRecvFrame(KL.VIDEO,XL.UNSUBSCRIBE)},e.prototype.setPushTrack=function(e){var t;this._pushTrack!==e&&(e&&!this._isScreen&&this.beginRecvFrame(KL.AUDIO,WL.PUSH_TRACK),!e&&(null===(t=this._stream)||void 0===t?void 0:t.hasAudio)&&this.stopRecvFrame(KL.AUDIO,XL.REMOVE_TRACK))},e.prototype.setMultiChatMode=function(e){this._multiChatMode=e},e.prototype.setTimeout=function(e){this._timeout=e},e.prototype._watchForFirstVideoFrameRecv=function(){var e=this,t=-1;this._firstVideoFrameInterval=window.setInterval((function(){return ef(e,void 0,void 0,(function(){var e,i,r,n,o,a,s,c;return tf(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,TV(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(KL.VIDEO),window.clearInterval(this._firstVideoFrameInterval)}u.label=2;case 2:return[2]}}))}))}),200)},e.prototype._watchForFirstAudioFrameRecv=function(){var e=this,t=-1;this._firstAudioFrameInterval=window.setInterval((function(){return ef(e,void 0,void 0,(function(){var e,i,r,n,o,a,s,c;return tf(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,TV(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(KL.AUDIO),window.clearInterval(this._firstAudioFrameInterval)}u.label=2;case 2:return[2]}}))}))}),200)},e.prototype.getTransportDelay=function(){return ef(this,void 0,void 0,(function(){var e=this;return tf(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 ef(e,void 0,void 0,(function(){return tf(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 ef(this,void 0,void 0,(function(){var i,r,n;return tf(this,(function(o){switch(o.label){case 0:return(null===(e=this._handler)||void 0===e?void 0:e.pc)?[4,TV(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:WL.LOGIN},this._currentVideoRecv={startTime:0,eventSessionId:0,type:WL.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"}(tj||(tj={}));var rj,nj,oj,aj,sj=function(){function e(e,t){this._audioEventSessionId=QD(),this._videoEventSessionId=QD(),this._currentAudioSend={startTime:0,eventSessionId:0,type:WL.LOGIN},this._currentVideoSend={startTime:0,eventSessionId:0,type:WL.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=tj.INITIAL,this._videoFirstFrameState=tj.INITIAL,this._stream=e,this._handler=t}return e.prototype.beginSendFrame=function(e,t){var i,r,n,o=this;if(e===KL.AUDIO){this._audioEventSessionId++,this._currentAudioSend={startTime:Date.now(),eventSessionId:this._audioEventSessionId,type:t};var a={media_type:e,event_type:zL.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(KL.AUDIO,XL.TIMEOUT),o._firstAudioFrameInterval&&window.clearInterval(o._firstAudioFrameInterval)}),this._timeout),hx.rtcFirstFrame(a),this._watchForFirstAudioFrameSend(),this._audioFirstFrameState=tj.BEGIN,this._login=!0,this._publisher=!0,this._publish=!0,this._unMuteAudio=!0,this._pushAudio||(this._enableAudio=!0)}else if(e===KL.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)?KL.SCREEN_VIDEO:e,event_type:zL.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(KL.VIDEO,XL.TIMEOUT),o._firstVideoFrameInterval&&window.clearInterval(o._firstVideoFrameInterval)}),this._timeout),this._watchForFirstVideoFrameSend(),hx.rtcFirstFrame(a),this._videoFirstFrameState=tj.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===KL.AUDIO){if(this._audioFirstFrameState!==tj.BEGIN)return;var s={event_type:zL.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,hx.rtcFirstFrame(s),this._audioFirstFrameState=tj.STOPPED}else if(e===KL.VIDEO){if(this._videoFirstFrameState!==tj.BEGIN)return;s={event_type:zL.SENT_END,media_type:(null===(n=this._stream)||void 0===n?void 0:n.isScreen)?KL.SCREEN_VIDEO:e,start:null===(o=this._currentVideoSend)||void 0===o?void 0:o.startTime,reason:t,result:!1,event_session_id:this._videoEventSessionId,type:null===(a=this._currentVideoSend)||void 0===a?void 0:a.type};this._firstVideoFrameTimer&&window.clearTimeout(this._firstVideoFrameTimer),delete this._currentVideoSend,hx.rtcFirstFrame(s),this._videoFirstFrameState=tj.STOPPED}},e.prototype.sendFrameFinish=function(e){var t;if(e===KL.AUDIO){if(this._audioFirstFrameState!==tj.BEGIN)return;if(!this._currentAudioSend)return;var i=this._currentAudioSend,r=i.type,n=i.startTime,o={event_type:zL.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),hx.rtcFirstFrame(o),this._audioFirstFrameState=tj.SENT}else if(e===KL.VIDEO){if(this._videoFirstFrameState!==tj.BEGIN)return;if(!this._currentVideoSend)return;var a=this._currentVideoSend;r=a.type,n=a.startTime,o={event_type:zL.SENT_END,media_type:(null===(t=this._stream)||void 0===t?void 0:t.isScreen)?KL.SCREEN_VIDEO:e,start:n,result:!0,event_session_id:this._videoEventSessionId,type:r};delete this._currentVideoSend,this._firstVideoFrameTimer&&window.clearTimeout(this._firstVideoFrameTimer),hx.rtcFirstFrame(o),this._videoFirstFrameState=tj.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(KL.VIDEO,WL.LOGIN),(null===(i=this._stream)||void 0===i?void 0:i.audioTrack)&&this.beginSendFrame(KL.AUDIO,WL.LOGIN)),!e&&this._audioSending&&this.stopSendFrame(KL.AUDIO,XL.LEAVE_ROOM),!e&&this._videoSending&&this.stopSendFrame(KL.VIDEO,XL.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(KL.VIDEO,WL.PUBLISH),(null===(i=this._stream)||void 0===i?void 0:i.audioTrack)&&this.beginSendFrame(KL.AUDIO,WL.PUBLISH)),!e&&this._audioSending&&this.stopSendFrame(KL.AUDIO,XL.UNPUBLISH),!e&&this._videoSending&&this.stopSendFrame(KL.VIDEO,XL.UNPUBLISH))},e.prototype.setUnmuteAudio=function(e){this._unMuteAudio!==e&&(this._unMuteAudio=e,e&&this.beginSendFrame(KL.AUDIO,WL.UNMUTE),!e&&this._audioSending&&this.stopSendFrame(KL.AUDIO,XL.MUTE))},e.prototype.setEnableAudio=function(e){this._enableAudio!==e&&(this._enableAudio=e,e&&this.beginSendFrame(KL.AUDIO,WL.ENABLE),!e&&this._audioSending&&this.stopSendFrame(KL.AUDIO,XL.DISABLE))},e.prototype.setUnmuteVideo=function(e){this._unMuteVideo!==e&&(this._unMuteVideo=e,e&&this.beginSendFrame(KL.VIDEO,WL.UNMUTE),!e&&this._videoSending&&this.stopSendFrame(KL.VIDEO,XL.MUTE))},e.prototype.setEnableVideo=function(e){this._enableVideo!==e&&(this._enableVideo=e,e&&this.beginSendFrame(KL.VIDEO,WL.ENABLE),!e&&this._videoSending&&this.stopSendFrame(KL.VIDEO,XL.DISABLE))},e.prototype.setExternalAudioSource=function(e){this._audioExternal!==e&&(this._audioExternal=e,e&&(this._audioSending&&this.stopSendFrame(KL.AUDIO,XL.DISABLE),this._enableAudio=!1),e||(this._audioSending&&this.stopSendFrame(KL.AUDIO,XL.STOP_PUSH),this._pushAudio=!1))},e.prototype.setPushAudio=function(e){this._pushAudio!==e&&(this._pushAudio=e,e&&this.beginSendFrame(KL.AUDIO,WL.PUSH),!e&&this._audioSending&&this.stopSendFrame(KL.AUDIO,XL.STOP_PUSH))},e.prototype.setExternalVideoSource=function(e){this._videoExternal!==e&&(this._videoExternal=e,e&&(this._videoSending&&this.stopSendFrame(KL.VIDEO,XL.DISABLE),this._enableVideo=!1),e||(this._videoSending&&this.stopSendFrame(KL.VIDEO,XL.STOP_PUSH),this._pushVideo=!1))},e.prototype.setPushVideo=function(e){this._pushVideo!==e&&(this._pushVideo=e,e&&this.beginSendFrame(KL.VIDEO,WL.PUSH),!e&&this._videoSending&&this.stopSendFrame(KL.VIDEO,XL.STOP_PUSH))},e.prototype.setAutoPublish=function(e){this._autoPublish=e},e.prototype.setPublisher=function(e){this._publisher!==e&&(this._publisher=e,!e&&this._audioSending&&this.stopSendFrame(KL.AUDIO,XL.AUDIENCE),!e&&this._videoSending&&this.stopSendFrame(KL.VIDEO,XL.AUDIENCE))},e.prototype.setTimeout=function(e){this._timeout=e},e.prototype.setPCSessionId=function(e){this._pcSessionId=e},e.prototype.setHandler=function(e){this._handler=e},e.prototype._getFirstVideoFrameStats=function(){var e,t,i,r,n,o;return ef(this,void 0,void 0,(function(){var a;return tf(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,TV(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 ef(this,void 0,void 0,(function(){var a;return tf(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,TV(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.setInterval((function(){return ef(e,void 0,void 0,(function(){var e;return tf(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(KL.VIDEO),window.clearInterval(this._firstVideoFrameInterval)}return[2]}}))}))}),100)},e.prototype._watchForFirstAudioFrameSend=function(){var e=this,t=-1;this._firstAudioFrameInterval=window.setInterval((function(){return ef(e,void 0,void 0,(function(){var e;return tf(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(KL.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=tj.INITIAL,this._videoFirstFrameState=tj.INITIAL,this._currentAudioSend={startTime:0,eventSessionId:0,type:WL.LOGIN},this._currentVideoSend={startTime:0,eventSessionId:0,type:WL.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===tj.BEGIN},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"_videoSending",{get:function(){return this._videoFirstFrameState===tj.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"}(nj||(nj={})),function(e){e[e.INVALID=0]="INVALID",e[e.GOOD=1]="GOOD",e[e.MEDIUM=2]="MEDIUM",e[e.POOR=3]="POOR"}(oj||(oj={})),function(e){e.AUDIO="audio",e.VIDEO="video",e.SCREEN_VIDEO="screen_video",e.SCREEN_AUDIO="screen_audio"}(aj||(aj={}));var cj=((rj={})[aj.AUDIO]={delay:1200,stallRadio:.3},rj[aj.VIDEO]={delay:1200,stallRadio:.6},rj[aj.SCREEN_AUDIO]={delay:1600,stallRadio:.8},rj[aj.SCREEN_VIDEO]={delay:1600,stallRadio:.8},rj),uj=function(){function e(){this._preUplinkStats=new Map,this._preDownlinkStats=new Map,this._connectionState=KB.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?aj.SCREEN_AUDIO:aj.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,of(of([],nf(u),!1),[c],!1).slice(-2))}if(i.sentKBitrate>0&&i.rtt){n=r?aj.SCREEN_VIDEO:aj.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,of(of([],nf(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;if(o&&s.rtt)if(0===s.receivedKBitrate)i=X_.VBAD;else{var l=s.rtt,h=s.audioLossRate,p=s.stallDuration,_=s.statsInterval,f=s.e2eDelay,v=p/_,m=u?aj.SCREEN_AUDIO:aj.AUDIO,S=this._getQosLevel(l,h||0,c._retransmittedRate||0),y=this._getDownlinkQoE(m,v,f);i=this._getNetworkQuality(S,y)}if(a)if(0===c.receivedKBitrate||0===c.rtt)r=X_.VBAD;else{l=c.rtt;var g=c.videoLossRate,E=(p=c.stallDuration,_=c.statsInterval,f=c.e2eDelay,c._retransmittedRate);v=p/_,m=u?aj.SCREEN_VIDEO:aj.VIDEO,S=this._getQosLevel(l,g||0,E||0),y=this._getDownlinkQoE(m,v,f);r=this._getNetworkQuality(S,y)}var b=i&&r?Math.ceil((i+r)/2):i||r;if(b){var T="".concat(d).concat(u?"_screen":""),I=this._preDownlinkStats.get(T)||[b];this._preDownlinkStats.set(T,of(of([],nf(I),!1),[b],!1).slice(-2)),this._startNetworkQualityReport()}}},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!==KB.CONNECTED)e=t=X_.VBAD;else{var r=this._getBetterQualityAndRemoveOldest(aj.AUDIO,"up"),n=this._getBetterQualityAndRemoveOldest(aj.VIDEO,"up");e=r&&n?Math.ceil((r+n)/2):r||n||this._getBetterQualityAndRemoveOldest(aj.SCREEN_VIDEO,"up")||this._getBetterQualityAndRemoveOldest(aj.SCREEN_AUDIO,"up")||X_.UNKNOWN;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)||X_.UNKNOWN}this.reportor&&this.reportor(e,t)},e.prototype._getNetworkQuality=function(e,t){return t===oj.GOOD?Math.max(e-2,1):t===oj.MEDIUM?e:Math.min(e+1,5)},e.prototype._getQosLevel=function(e,t,i){var r;return r=e<=250&&t<=.15?nj.EXCELLENT:e<=500&&t<=.3?nj.GOOD:e<=750&&t<=.45?nj.POOR:e<=1e3&&t<=.6?nj.BAD:nj.VBAD,i>.5?r=Math.max(r,nj.BAD):i>.35?r=Math.max(r,nj.POOR):i>.15&&(r=Math.max(r,nj.GOOD)),r},e.prototype._getUplinkQoE=function(e,t){var i=oj.INVALID;switch(e){case aj.AUDIO:case aj.VIDEO:i=t<.05?oj.GOOD:t<.1?oj.MEDIUM:oj.POOR;break;case aj.SCREEN_VIDEO:case aj.SCREEN_AUDIO:i=t<.04?oj.GOOD:t<.08?oj.MEDIUM:oj.POOR}return i},e.prototype._getDownlinkQoE=function(e,t,i){var r=cj[e];return t>r.stallRadio||i>r.delay||t>r.stallRadio/2&&i>r.delay/2?oj.POOR:(t>r.stallRadio/2||r.delay,oj.MEDIUM)},e.prototype._getBetterQualityAndRemoveOldest=function(e,t){var i=X_.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,of([],nf(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&&rk(t)&&i.localaudio&&i.audiostream,videoActive:r&&nk(t)&&i.localvideo&&i.videostream}},e}(),dj=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}(),lj=ba.every;Wr({target:"Array",proto:!0,forced:!jn("every")},{every:function(e){return lj(this,e,arguments.length>1?arguments[1]:void 0)}});var hj=new Ik("SubscribeFallbackManager",2),pj=1e4,_j=function(){function e(e){this._room=e,this._preDownlinkNetworkQuality=[],this._isSubscribeFallbackOrRecover=!1,this._inSubscribeRecoverChecking=!1,this._forbidSubRecover=!1,this._forbidSubRecoverDuration=pj}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===X_.BAD||e===X_.VBAD}))&&this._startForbidSubRecover(),this._preDownlinkNetworkQuality.slice(-3).reduce((function(e,t){return e+t}),0)>3*X_.POOR&&this._subscribeFallbackOrRecover("fallback"),!this._forbidSubRecover&&10===this._preDownlinkNetworkQuality.length&&this._preDownlinkNetworkQuality.every((function(e){return e===X_.EXCELLENT}))&&this._subscribeFallbackOrRecover("recover")},e.prototype.destroy=function(){this._stopSubscribeRecoverCheck(),this._stopForbidSubRecover(),delete this.onSubscribeFallback},e.prototype._subscribeFallbackOrRecover=function(e){return ef(this,void 0,void 0,(function(){var t,i,r,n,o,a,s,c,u,d=this;return tf(this,(function(l){switch(l.label){case 0:if(this._isSubscribeFallbackOrRecover||this._room.connectionState!==KB.CONNECTED)return[2];if(this._room.subscribeFallbackOption!==K_.AUDIO_ONLY&&this._room.subscribeFallbackOption!==K_.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(hj.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=nf(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,hj.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,tk([(u=this._room).updateSubTrack.apply(u,of([o],nf(a),!1)).then((function(){"recover"===e?d._startSubscribeRecoverCheck():hj.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=pj,delete e._subRecoverCheckTimer,hj.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),hj.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}(),fj=new Ik("Room",1),vj=function(e){function t(t,i){var r=e.call(this)||this;return r._remoteUsers=new Map,r._remoteStreams=new Map,r._waitForNewToken=!1,r._userDuplicateLoginTimerMap=new Map,r._hasPublished=!1,r._roomConfig=t,r._mediaServerClient=new QB(i),r._reconnectRecord=new mj,r._addHandlerEventHandler(),r._isReconnecting=!1,r._networkQualityManager=new uj,r._networkQualityManager.reportor=r._reportNetworkQuality.bind(r),r._videoSizeObserver=new dj(r),r._videoSizeObserver.onchange=r._emitVideoSizeChange.bind(r),r._subFallbackManager=new _j(r),r._subFallbackManager.onSubscribeFallback=r._emitSubscribeFallback.bind(r),r._context=i,r}return A_(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,S,y,g,E,b,T=this;null===(e=this._mediaServerClient)||void 0===e||e.on(jx.ON_ADD_STREAM,this._onAddStream.bind(this)),null===(t=this._mediaServerClient)||void 0===t||t.on(jx.ON_REMOVE_STREAM,this._onRemoveStream.bind(this)),null===(i=this._mediaServerClient)||void 0===i||i.on(jx.USER_CONNECTION,this._onUserConnection.bind(this)),null===(r=this._mediaServerClient)||void 0===r||r.on(jx.USER_DISCONNECTION,this._onUserDisconnection.bind(this)),null===(n=this._mediaServerClient)||void 0===n||n.on(jx.ON_UPDATE_ROOM_ATTRIBUTES,this._onUpdateRoomAttributes.bind(this)),null===(o=this._mediaServerClient)||void 0===o||o.on(jx.ON_UPDATE_STREAM_ATTRIBUTES,this._onUpdateStreamAttributes.bind(this)),null===(a=this._mediaServerClient)||void 0===a||a.on(jx.ON_PUSH_TRACK,this._onPushTrack.bind(this)),null===(s=this._mediaServerClient)||void 0===s||s.on(jx.ON_REMOVE_TRACK,this._onRemoveTrack.bind(this)),null===(c=this._mediaServerClient)||void 0===c||c.on(jx.NODE_CHANGE,this._nodeChange.bind(this)),null===(u=this._mediaServerClient)||void 0===u||u.on(jx.ON_CUSTOM_MESSAGE,this._onCustomMessage.bind(this)),null===(d=this._mediaServerClient)||void 0===d||d.on(jx.USER_MESSAGE_RECEIVED,this._onUserMessageReceived.bind(this)),null===(l=this._mediaServerClient)||void 0===l||l.on(jx.USER_BINARY_MESSAGE_RECEIVED,this._onUserBinaryMessageReceived.bind(this)),null===(h=this._mediaServerClient)||void 0===h||h.on(jx.POST_PROCESSING_MESSAGE,this._onPostProcessingMessage.bind(this)),null===(p=this._mediaServerClient)||void 0===p||p.on(jx.ON_USER_TOKEN_WILL_EXPIRE,this._onUserTokenWillExpire.bind(this)),null===(_=this._mediaServerClient)||void 0===_||_.on(jx.STREAM_CONTROL_MESSAGE,this._onStreamControlMessage.bind(this)),null===(f=this._mediaServerClient)||void 0===f||f.on(jx.ON_SCENE_CONFIG,this._onSceneConfig.bind(this)),null===(v=this._mediaServerClient)||void 0===v||v.on(Gx.RSCP,this._onPublishOnDemand.bind(this)),null===(m=this._mediaServerClient)||void 0===m||m.on(Hx.ON_CONNECTION_STATE_CHANGE,this._onConnectionStateChange.bind(this)),null===(S=this._mediaServerClient)||void 0===S||S.on(Hx.ABNORMAL_DISCONNECTION,this._handleAbnormalDisconnection.bind(this)),null===(y=this._mediaServerClient)||void 0===y||y.on("onRemoteStreamStats",(function(e){T._networkQualityManager.updateDownlinkStats(e,T._findRemoteStreamByScreen(e.userId,e.isScreen)),T.emit(hB.ON_REMOTE_STREAM_STATS,ok(e))})),null===(g=this._mediaServerClient)||void 0===g||g.on("onLocalStreamStats",(function(e){T._networkQualityManager.updateUplinkStats(e),T.emit(hB.ON_LOCAL_STREAM_STATS,ok(e))})),null===(E=this._mediaServerClient)||void 0===E||E.on("prevIceNode",(function(e){T._getAccessFeedbackIceNode=e})),null===(b=this._mediaServerClient)||void 0===b||b.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 ef(this,void 0,void 0,(function(){var a=this;return tf(this,(function(s){return fx.setStats({rtc_app_id:e,room_id:t,user_id:r.userId}),fj.print("join()"),[2,new Promise((function(s,c){return ef(a,void 0,void 0,(function(){var a,u,d=this;return tf(this,(function(l){return this._joinResolveCallback=function(e){var t;hx.joinRoom(JL.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;hx.joinRoom(JL.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=KD(),this.setSessionId(),hx.joinRoom(JL.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),ef(this,void 0,void 0,(function(){var r,n,o;return tf(this,(function(a){switch(a.label){case 0:r=KD(),fj.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,hx.rtcJoinRoom(0,"web","web",KD()-r),this._onJoinSucc(n,i),[3,4];case 3:return(o=a.sent()).code!==aP.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 ef(this,void 0,void 0,(function(){var l,h,p,_;return tf(this,(function(f){switch(f.label){case 0:return fj.print("publishScreen()"),this._localScreenStream||(this._localScreenStream=new AB,this._localScreenStream.isScreen=!0,this._mediaServerClient.handler&&(this._localScreenStream.observer=new sj(this._localScreenStream,this._mediaServerClient.handler))),l=!1,h=!1,p=!1,_=!1,!this._localScreenStream.videoTrack&&t?(t instanceof QF&&(h=!0),l=!0):this._localScreenStream.videoTrack&&!t&&(l=!1),!this._localScreenStream.audioTrack&&i?(i instanceof ZF&&(_=!0),p=!0):this._localScreenStream.audioTrack&&!i&&(p=!1),this._localScreenStream.videoTrack=t,this._localScreenStream.audioTrack=i,this._localScreenStream.videoEncodeConfig=e,r&&(rk(r)&&(this._localScreenStream.pubAudio=n===fB.PUB),nk(r)&&(this._localScreenStream.pubVideo=n===fB.PUB),fj.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 ef(this,void 0,void 0,(function(){return tf(this,(function(e){switch(e.label){case 0:return fj.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 ef(this,void 0,void 0,(function(){return tf(this,(function(t){switch(t.label){case 0:return fj.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 ef(this,void 0,void 0,(function(){var i=this;return tf(this,(function(r){switch(r.label){case 0:return fj.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 ef(this,void 0,void 0,(function(){return tf(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 ef(this,void 0,void 0,(function(){return tf(this,(function(t){switch(t.label){case 0:return fj.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),ef(this,void 0,void 0,(function(){var p,_,f,v,m,S;return tf(this,(function(y){switch(y.label){case 0:if(fj.print("publish","Invoke publish"),p=!1,this._localStream||(this._localStream=new AB,this._mediaServerClient.handler&&(this._localStream.observer=new sj(this._localStream,this._mediaServerClient.handler)),p=!0),this._localStream.videoTrack=i,this._localStream.audioTrack=r,this._localStream.videoEncodeConfig=e,this._localStream.enableSimulcast=t,n&&(rk(n)&&(this._localStream.pubAudio=o===fB.PUB),nk(n)&&(this._localStream.pubVideo=o===fB.PUB),fj.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];y.label=1;case 1:return y.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 QF,m=this._localStream.audioTrack instanceof ZF,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 y.sent(),this._hasPublished=!0,this.emit(hB.ON_PUBLISH_RESULT,{isScreen:!1,state:k_.PUBLISH_SUCC}),[3,4];case 3:throw S=y.sent(),this.emit(hB.ON_PUBLISH_RESULT,{isScreen:!1,state:k_.PUBLISH_FAIL}),S;case 4:return[3,7];case 5:return[4,this.updatePubTrack()];case 6:y.sent(),y.label=7;case 7:return[2]}}))}))},t.prototype.updatePubTrack=function(){return ef(this,void 0,void 0,(function(){return tf(this,(function(e){switch(e.label){case 0:return fj.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 ef(this,void 0,void 0,(function(){return tf(this,(function(e){switch(e.label){case 0:return fj.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 ef(this,void 0,void 0,(function(){var r;return tf(this,(function(n){switch(n.label){case 0:return fj.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 ef(this,void 0,void 0,(function(){return tf(this,(function(o){return fj.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 ef(this,void 0,void 0,(function(){var o,a;return tf(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.updateSubTrack(o,o.subMediaType,vB.SUB,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 ef(this,void 0,void 0,(function(){return tf(this,(function(i){switch(i.label){case 0:return fj.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),ef(this,void 0,void 0,(function(){var i,r,n,o,a,s,c;return tf(this,(function(u){switch(u.label){case 0:fj.print("leave","Invoke leave"),i=KD(),u.label=1;case 1:u.trys.push([1,3,,4]),clearTimeout(this._reconnectTimer);try{for(r=rf(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(),hx.rtcLeaveRoom(0,"",KD()-i),[3,4];case 3:if(a=u.sent(),e)throw a;return this.destroy(),a instanceof Error&&hx.rtcLeaveRoom(-1,a.message,KD()-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;fj.print("destroy","Invoke destroy"),this._destroyAndInitMediaServerClient(),this._roomInfo=void 0,this._remoteUsers=new Map;try{for(var n=rf(this._remoteStreams),o=n.next();!o.done;o=n.next()){var a=nf(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 mj,this._removeHandlerEventHandler(),clearTimeout(this._connectionLostTimer),this._userDuplicateLoginTimerMap.forEach((function(e){clearTimeout(e)})),this._userDuplicateLoginTimerMap.clear(),this._networkQualityManager.destroy(),this._videoSizeObserver.destroy(),this._subFallbackManager.destroy()},t.prototype.updateToken=function(e){return ef(this,void 0,void 0,(function(){return tf(this,(function(t){switch(t.label){case 0:return fj.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 ef(this,void 0,void 0,(function(){var t,i,r,n,o,a,s=this;return tf(this,(function(c){t=[];try{for(i=rf(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,vB.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 ef(this,void 0,void 0,(function(){var t,i,r,n,o,a,s=this;return tf(this,(function(c){t=[];try{for(i=rf(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,vB.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=jD(),fx.setStats({rtc_session_id:this._sessionId})},t.prototype.sendRoomMessage=function(e,t){var i,r;return void 0===t&&(t=!1),ef(this,void 0,void 0,(function(){var n,o;return tf(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,YD.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(){fj.print("_destroyAndInitMediaServerClient()"),this._mediaServerClient&&(this._mediaServerClient.destroy(),this._removeHandlerEventHandler()),this._mediaServerClient=new QB(this._context),this._addHandlerEventHandler()},t.prototype._onJoinSucc=function(e,t){var i,r,n,o,a,s=this;fj.print("JoinSuccess()"),this._serverConfig=e.config;var c=[],u=[],d=[],l=[];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 h=rf(this._remoteUsers.values()),p=h.next();!p.done;p=h.next()){var _=p.value;_._stillExist||u.push({clientId:_.userId}),delete _._stillExist}}catch(e){i={error:e}}finally{try{p&&!p.done&&(r=h.return)&&r.call(h)}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):l.push(e)}));try{for(var f=rf(this._remoteStreams.values()),v=f.next();!v.done;v=f.next()){var m=v.value;Array.isArray(m)&&m.forEach((function(e){e.stillExist?delete e.stillExist:d.push({clientId:e.userId,streamId:e.streamId,message:Fx.clientDisconnected})}))}}catch(e){n={error:e}}finally{try{v&&!v.done&&(o=f.return)&&o.call(f)}finally{if(n)throw n.error}}setTimeout((function(){u.forEach((function(e){return s._onUserDisconnection(e)})),c.forEach((function(e){return s._onUserConnection(e)})),d.forEach((function(e){return s._onRemoveStream(e)})),l.forEach((function(e){return s._onAddStream(e,!0,!1)})),t&&s._handleSendOrRecvStreamAfterReconnect()}))},t.prototype._handleSendOrRecvStreamAfterReconnect=function(){var e,t,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=rf(this._remoteStreams.values()),n=r.next();!n.done;n=r.next()){var o=n.value;Array.isArray(o)&&o.forEach((function(e){return ef(i,void 0,void 0,(function(){var t;return tf(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]),fj.print("start resubscribe ".concat(e.userId," with ").concat(e.subMediaType)),[4,this._mediaServerClient.subscribe(e,e.subMediaType)];case 2:return i.sent(),fj.print("success resubscribe ".concat(e.userId," with ").concat(e.subMediaType)),this.safeEmit(hB.RESUBSCRIBE,{stream:e}),[3,4];case 3:return t=i.sent(),fj.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(!_){_=new CB(e.clientId,e.streamId,e.screen,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 ij(_,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,S=v.isAutoSubscribeVideo;null===(p=_.observer)||void 0===p||p.setLogin(!0,{audio:!!m,video:!!S})}return t&&this.safeEmit(jx.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,Z_({},r)),this.safeEmit(jx.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===zx.kickedByAdmin?a=aP.KICKED_OUT:n===zx.onUserTokenDidExpire?a=aP.TOKEN_EXPIRED:n===zx.userDuplicateLogin&&(a=aP.DUPLICATE_LOGIN),o===Kx.roomDismissByAdmin&&(a=aP.ROOM_DISMISS),a&&this.safeEmit(hB.ON_ROOM_ERROR,{errorCode:a})}else{var s=w_.DROPPED;n===zx.userLeave?s=w_.QUIT:n===zx.kickedByAdmin?s=w_.KICKED_BY_ADMIN:n===zx.roleChanged&&(s=w_.SWITCH_TO_INVISIBLE);var c=function(){i._remoteUsers.delete(r),i.safeEmit(hB.ON_USER_LEAVE,{userInfo:{userId:r},reason:s})};if(n===zx.userDuplicateLogin){var u=this._userDuplicateLoginTimerMap.get(r);null!=u||self.clearTimeout(u);var d=self.setTimeout(c,5e3);this._userDuplicateLoginTimerMap.set(r,d)}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})),o._remoteStreams.set(e.clientId,t)}})).finally((function(){o.safeEmit(jx.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,S,y=e.clientId,g=e.streamId,E=e.attributes,b=this._findRemoteStream(y,g);if(b){var T=b.attributes,I=Z_(Z_({},T),E),R=!1,A=I.localaudio!==T.localaudio,C=!1,O=!1,w=I.localvideo!==T.localvideo,N=!1,P=PF.NONE,D=PF.NONE;I.audiostream!==T.audiostream&&(R=I.localaudio,C=!!I.audiostream,I.audiostream?P|=x_.AUDIO:D|=x_.AUDIO),I.videostream!==T.videostream&&(O=I.localvideo,N=!!I.videostream,I.videostream?P|=x_.VIDEO:D|=x_.VIDEO),P&&this.safeEmit(hB.ON_USER_PUBLISH_STATE_CHANGE,{userId:y,mediaType:P,isScreen:b.isScreen,pubState:fB.PUB,remoteStream:b}),D&&this.safeEmit(hB.ON_USER_PUBLISH_STATE_CHANGE,{userId:y,mediaType:D,isScreen:b.isScreen,pubState:fB.UNPUB,remoteStream:b}),I.localaudio!==T.localaudio&&(I.localaudio?(I.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(hB.ON_USER_START_AUDIO_CAPTURE,{userId:y})):(I.extaudio?(null===(o=b.observer)||void 0===o||o.setExternalAudioSource(!0),null===(a=b.observer)||void 0===a||a.setPushAudio(!1)):(null===(s=b.observer)||void 0===s||s.setExternalAudioSource(!1),null===(c=b.observer)||void 0===c||c.setEnableAudio(!1)),!b.isScreen&&this.safeEmit(hB.ON_USER_STOP_AUDIO_CAPTURE,{userId:y}))),I.localvideo!==T.localvideo&&(I.localvideo?(I.extvideo?(null===(u=b.observer)||void 0===u||u.setExternalVideoSource(!0),null===(d=b.observer)||void 0===d||d.setPushVideo(!0)):(null===(l=b.observer)||void 0===l||l.setExternalVideoSource(!1),null===(h=b.observer)||void 0===h||h.setEnableVideo(!0)),this.safeEmit(hB.ON_USER_START_VIDEO_CAPTURE,{userId:y})):(I.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(hB.ON_USER_STOP_VIDEO_CAPTURE,{userId:y}))),R&&!A&&(null===(m=b.observer)||void 0===m||m.setRemoteUnmuteAudio(C)),O&&!w&&(null===(S=b.observer)||void 0===S||S.setRemoteUnmuteVideo(N)),b.attributes=I}},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(hB.SUBSCRIBE_PUSH_TRACK,{stream:n})})).catch((function(e){fj.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(hB.REMOVE_PUSH_TRACK,{stream:o})})).catch((function(e){fj.print("remove push track failed: ".concat(e))}))},t.prototype._nodeChange=function(e){var t,i=e.nodes,r=e.reason;wx.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,hx.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=rf(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}}hx.rtcReconnect(1002,TL.PEERCONNECTION_RECONNECTING,this._roomInfo.userInfo.userId,IL.PEERCONNECTION),this._join((function(){hx.rtcReconnected(RL.PEERCONNECTION_RECONNECTED,AL.PEERCONNECTION)}),(function(e){i._reconnectRecord.record(e),i._reconnectRecord.shouldReconnect?(fj.print("Reconnecting error, will reconnect after 3s",e),i._reconnectTimer=window.setTimeout(i._reconnect.bind(i),3e3)):(i.safeEmit(hB.RECONNECT_FAILED),i.destroy())}),!0)},t.prototype._handleAbnormalDisconnection=function(){fj.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===KB.DISCONNECTED)t=F_.CONNECTION_STATE_DISCONNECTED;else if(e.next===KB.CONNECTED)clearTimeout(this._connectionLostTimer),t=this._isReconnecting?F_.CONNECTION_STATE_RECONNECTED:F_.CONNECTION_STATE_CONNECTED;else{if(e.next!==KB.CONNECTING)return;t=this._isReconnecting?F_.CONNECTION_STATE_RECONNECTING:F_.CONNECTION_STATE_CONNECTING}e.prev===KB.CONNECTED&&e.next===KB.DISCONNECTED&&(this._connectionLostTimer=window.setTimeout((function(){i.safeEmit(Hx.ON_CONNECTION_STATE_CHANGE,{state:F_.CONNECTION_STATE_LOST})}),1e4)),this._networkQualityManager.setConnectionState(e.next),this.safeEmit(Hx.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(hB.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?L_.STREAM_INDEX_SCREEN:L_.STREAM_INDEX_MAIN}})}))},t.prototype._onCustomMessage=function(e){this.safeEmit(jx.ON_CUSTOM_MESSAGE,e)},t.prototype._onUserMessageReceived=function(e){this.safeEmit(jx.USER_MESSAGE_RECEIVED,{userId:e.from,message:e.msg})},t.prototype._onUserBinaryMessageReceived=function(e){this.safeEmit(jx.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=_B.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=_B.START_FAILED);break;case"TranscodeStateChanged":r=0!==t.error?_B.START_FAILED:_B.START_SUCCESS;break;case"TranscodeStopped":r=0!==t.error?_B.STOP_FAILED:_B.STOP_SUCCESS;break;case"TranscodeUpdated":r=0!==t.error?_B.UPDATE_FAILED:_B.UPDATE_SUCCESS}this.safeEmit(jx.POST_PROCESSING_MESSAGE,{code:i,protocol:t.protocol,error:t.error,eventType:r,message:n[i]})}this.safeEmit(jx.POST_PROCESSING_MESSAGE,{code:i,message:n[i],type:e.type})}},t.prototype._onUserTokenWillExpire=function(){this.safeEmit(jx.ON_USER_TOKEN_WILL_EXPIRE,null)},t.prototype._onSceneConfig=function(e){var t,i,r=e.multiSceneConfig,n=WB[this._roomConfig.roomProfileType][1];if(r){var o=r[n];o&&o.engine_BAC&&(null===(t=this._context)||void 0===t||t.audioProfileManager.updateEngineBAC(o.engine_BAC)),o&&o.engine_ANM&&(null===(i=this._context)||void 0===i||i.audioProfileManager.updateEngineANM(o.engine_ANM))}},t.prototype._onStreamControlMessage=function(e){var t,i;e.type===Bx.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(e){var t,i,r,n,o,a,s,c,u,d,l;if(!1!==(null===(r=null===(i=null===(t=this._serverConfig)||void 0===t?void 0:t.engine_VPM)||void 0===i?void 0:i.ondemand)||void 0===r?void 0:r.enable)&&(null===(n=this._localStream)||void 0===n?void 0:n.enableSimulcast)&&(null===(o=this._localStream)||void 0===o?void 0:o.videoTransceiver)){var h=null===(a=this._localStream)||void 0===a?void 0:a.stream.id,p=null===(s=this._localStream)||void 0===s?void 0:s.videoTransceiver.sender,_=p.getParameters();if(Array.isArray(_.encodings)&&Array.isArray(e)){var f={};fj.print("_onPublishOnDemand","usedDescriptions: %o",e),e.forEach((function(e){var t;if(null===(t=null==e?void 0:e.StreamIds)||void 0===t?void 0:t.includes(h)){var i=null==e?void 0:e.Metadata.SubvideoIndex;f[i]=i}}));var v={};null===(u=null===(c=this._localStream)||void 0===c?void 0:c.subVideoDescriptions)||void 0===u||u.forEach((function(e){void 0!==f[e.sub_index]&&(v[e.video_index]=e)}));var m=(null===(l=null===(d=p.track)||void 0===d?void 0:d.getSettings())||void 0===l?void 0:l.height)||720,S=[];_.encodings=_.encodings.map((function(e){return e.rid&&(v[e.rid]?(e.active=!0,e.scaleResolutionDownBy=Math.max(m/v[e.rid].height,1),S.push({type:1,rid:e.rid,downBy:e.scaleResolutionDownBy})):(S.push({type:0,rid:e.rid}),e.active=!1)),e})),hx.rtcInvokeStatus(JSON.stringify(S),0,"rscp",h,0)}p.setParameters(_)}},t.prototype._reportNetworkQuality=function(e,t){this._subFallbackManager.updateNetworkQuality(e,t),this.emit(hB.ON_NETWORK_QUALITY,e,t)},t.prototype._emitVideoSizeChange=function(e,t,i,r){var n;this.emit(hB.ON_REMOTE_VIDEO_SIZE_CHANGED,{roomId:null===(n=this.roomInfo)||void 0===n?void 0:n.roomId,userId:e,streamIndex:t?L_.STREAM_INDEX_SCREEN:L_.STREAM_INDEX_MAIN},{width:i,height:r})},t.prototype._emitSubscribeFallback=function(e){this.emit(hB.ON_SIMULCAST_SUBSCRIBE_FALLBACK,e)},t}(Ak),mj=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}(),Sj=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=nf(e,2),r=t[0],n=t[1];"muted"===r?i.muted=!0:i.setAttribute(r,n)})),i},yj=function(e,t){return void 0===t&&(t={}),t.id&&(e.id=t.id),t.classList&&t.classList.forEach((function(t){e.classList.add(t)})),t.style&&Object.assign(e.style,t.style),t.attributes&&Object.entries(t.attributes).forEach((function(t){var i=nf(t,2),r=i[0],n=i[1];e.setAttribute(r,n)})),e},gj=new Ik("Player",0),Ej=["play","playing","pause","ended","error","seeking","seeked","waiting","canplay","canplaythrough","durationchange","volumechange","loadedmetadata","loadeddata","loadstart","timeupdate"],bj={playsinline:"","webkit-playsinline":""},Tj={playsinline:"","webkit-playsinline":"","x5-playsinline":"","x5-video-player-type":"h5","x-webkit-airplay":"allow",preload:"",muted:""},Ij=new(function(){function e(){this.videoCache=[],this.audioCache=[]}return e.prototype.getOrCreate=function(e,t){var i="audio"===e?bj:Tj;if("video"===e&&this.videoCache.length>0){if(r=this.videoCache.pop())return yj(r,{style:t,attributes:i}),r}else if("audio"===e&&this.audioCache.length>0){var r;if(r=this.audioCache.pop())return yj(r,{style:t,attributes:i}),r}return Sj(e,{style:t,attributes:i})},e.prototype.recycle=function(e){for(;e.attributes.length>0;)e.removeAttribute(e.attributes[0].name);e instanceof HTMLVideoElement?this.videoCache.push(e):this.audioCache.push(e)},e}()),Rj=function(e){function t(t){var i=e.call(this)||this;i.mirrorType=B_.MIRROR_TYPE_NONE,i.played=!1,i._emitPlayFailed=!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};i.emit("playback_event",n)},i._internalPlay=function(){var e;if(null===(e=i._videoDom)||void 0===e?void 0:e.paused){var t=i._videoDom.play();(null==t?void 0:t.then)&&t.catch((function(e){var t,r;i._emitPlayFailed||(i._emitPlayFailed=!0,hx.rtcError("video autoplay failed, userId: ".concat(i.userId),-1e3),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:"autoplay-error",currentTime:(null===(r=i._videoDom)||void 0===r?void 0:r.currentTime)||0}))}))}};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 lP(aP.CANT_FIND_DOM,"can't find dom");return i._containerDom=o,i.userId=n,i.isScreen=!!t.isScreen,i._initVideo(),i}return A_(t,e),t.prototype._initVideo=function(){this._videoDom||(this._videoDom=Ij.getOrCreate("video",{width:"100%",height:"100%"}),this._videoDom.id="".concat(this.userId,"_").concat(zD()),this.renderMode===U_.RENDER_MODE_FIT?this._videoDom.style.objectFit="contain":this._videoDom.style.objectFit="cover",this.mirror(this.mirrorType===B_.MIRROR_TYPE_RENDER)),this._containerDom.appendChild(this._videoDom),this._initListeners()},t.prototype._initListeners=function(){var e=this;this._videoDom&&Ej.forEach((function(t){var i;null===(i=e._videoDom)||void 0===i||i.addEventListener(t,e.emitVideoEvent)}))},t.prototype._removeListeners=function(){var e=this;this._videoDom&&(Ej.forEach((function(t){var i;null===(i=e._videoDom)||void 0===i||i.removeEventListener(t,e.emitVideoEvent)})),this._videoDom.addEventListener("canplay",this._internalPlay),this._videoDom.addEventListener("loadeddata",this._internalPlay))},t.prototype._recordFrame=function(e){var t=this;this.on("playback_event",(function(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 ef(this,void 0,void 0,(function(){var r,n,o=this;return tf(this,(function(a){return r=this._videoDom,gj.print("playVideo","play video track: ".concat(this.userId)),r&&r.srcObject instanceof MediaStream&&r.srcObject.getTrackById(null===(i=e.getTrack())||void 0===i?void 0:i.id)||(r||(this._initVideo(),r=this._videoDom),gj.print("playVideo","play video by dom: ".concat(null==r?void 0:r.id)),(n=new MediaStream).addTrack(e.getTrack()),r.srcObject=n,r&&!this._containerDom.contains(r)&&this._containerDom.appendChild(r),r.addEventListener("canplay",this._internalPlay),r.addEventListener("loadeddata",this._internalPlay),setTimeout((function(){return o._internalPlay()})),t&&this._recordFrame(t),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.manuallyPlay=function(){if(gj.print("Invoke VideoPlayer.manuallyPlay"),this._emitPlayFailed=!1,!this._videoDom)throw new lP(aP.INVALID_PARAMS,"Player not found");return this._videoDom.play()},t.prototype.mirror=function(e){gj.print("mirror","".concat(this.userId," set mirror: ").concat(e)),this.mirrorType=e?B_.MIRROR_TYPE_RENDER:B_.MIRROR_TYPE_NONE,this._videoDom&&(this._videoDom.style.transform=e?"rotateY(180deg)":"")},t.prototype.stop=function(){var e=this._containerDom;gj.print("stop","stop video track: ".concat(this.userId)),this._videoDom&&(this._videoDom.srcObject=null,e&&e.contains(this._videoDom)&&e.removeChild(this._videoDom)),this.__cumulativeTime=void 0,this.played=!1},t.prototype.destroy=function(){gj.print("destroy","video player: ".concat(this.userId)),this.stop(),e.prototype.removeAllListeners.call(this),this._removeListeners(),this._videoDom&&(Ij.recycle(this._videoDom),delete this._videoDom)},Object.defineProperty(t.prototype,"domElement",{get:function(){return this._videoDom},enumerable:!1,configurable:!0}),t}(yk.exports.EventEmitter),Aj=function(e){function t(t,i){var r=void 0===i?{divId:void 0,muted:!1}:i,n=r.divId,o=r.muted,a=e.call(this)||this;if(a.muted=!1,a._emitPlayFailed=!1,a.played=!1,a.emitAudioEvent=function(e){var t,i,r={type:"audio",rawEvent:e,readyState:(null===(t=a._audioDom)||void 0===t?void 0:t.readyState)||0,userId:a.userId,eventName:e.type,currentTime:(null===(i=a._audioDom)||void 0===i?void 0:i.currentTime)||0};a.emit("playback_event",r)},a._internalPlay=function(){var e,t;if(Ex("_internalPlay",{paused:null===(e=a._audioDom)||void 0===e?void 0:e.paused}),null===(t=a._audioDom)||void 0===t?void 0:t.paused)try{var i=a._audioDom.play();(null==i?void 0:i.then)&&i.catch((function(e){a._autoPlayError(e)})).then((function(){Ex("_internalPlay successfully",{userId:a.userId})}))}catch(e){a._autoPlayError(e)}},n){var s=document.getElementById(n);if(!s)throw new lP(aP.CANT_FIND_DOM,"can't find dom");a._containerDom=s}else a._containerDom=document.body;return a.userId=t,a.muted=o,a._initAudio(),a}return A_(t,e),t.prototype._initAudio=function(){this._audioDom||(this._audioDom=Ij.getOrCreate("audio",{display:"none"}),this._audioDom.volume=this.muted?0:1,this._audioDom.id="".concat(this.userId,"_").concat(zD()),this._containerDom.appendChild(this._audioDom)),this._initListeners()},t.prototype._initListeners=function(){var e=this;this._audioDom&&Ej.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&&(Ej.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 ef(this,void 0,void 0,(function(){var i,r,n=this;return tf(this,(function(o){return gj.print("playAudio","play audio track: ".concat(this.userId)),(i=this._audioDom)&&i.srcObject instanceof MediaStream&&i.srcObject.getTrackById(null===(t=e.getTrack())||void 0===t?void 0:t.id)||(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,hx.rtcError("audio autoplay failed, userId: ".concat(this.userId,": ").concat(e.message),-1e3),this.emit("playback_event",{type:"audio",rawEvent:e,readyState:(null===(t=this._audioDom)||void 0===t?void 0:t.readyState)||0,userId:this.userId,eventName:"autoplay-error",currentTime:(null===(i=this._audioDom)||void 0===i?void 0:i.currentTime)||0}))},t.prototype.manuallyPlay=function(){var e;if(gj.print("Invoke AudioPlayer.manuallyPlay"),this._emitPlayFailed=!1,!this._audioDom)throw new lP(aP.INVALID_PARAMS,"Player not found");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 ef(this,void 0,void 0,(function(){var t;return tf(this,(function(i){switch(i.label){case 0:return gj.print("setPlaybackDevice","setPlaybackDevice: ".concat(e)),[4,kF.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=this._containerDom;gj.print("stopAudio","stop audio track: ".concat(this.userId)),this._audioDom&&(this._audioDom.srcObject=null,e&&e.contains(this._audioDom)&&e.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(){gj.print("destroy","audio player: ".concat(this.userId)),this.stop(),e.prototype.removeAllListeners.call(this),this._removeListeners(),this._audioDom&&(Ij.recycle(this._audioDom),delete this._audioDom)},t}(yk.exports.EventEmitter),Cj=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;hx.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,tx.P2P,t)},e.prototype.recvP2PMessage=function(e){this._recvUserMessage(e,tx.P2P)},e.prototype.sendP2PFail=function(e){this._sendUserFail(e,tx.P2P)},e.prototype.sendP2PAck=function(e,t,i,r){this._sendUserAck(e,tx.P2P,t,i,r)},e.prototype.sendP2POutRoomMessage=function(e,t){this._sendUserMessage(e,tx.P2P_OUTSIDE_ROOM,t)},e.prototype.recvP2POutRoomMessage=function(e){this._recvUserMessage(e,tx.P2P_OUTSIDE_ROOM)},e.prototype.sendP2POutRoomFail=function(e){this._sendUserFail(e,tx.P2P_OUTSIDE_ROOM)},e.prototype.sendP2POutRoomAck=function(e,t,i,r){this._sendUserAck(e,tx.P2P_OUTSIDE_ROOM,t,i,r)},e.prototype.sendP2serverMessage=function(e){this._sendUserMessage("",tx.P2SERVER,e)},e.prototype.sendP2serverFail=function(){this._sendUserFail("",tx.P2SERVER)},e.prototype.sendP2serveAck=function(e){this._sendUserAck("",tx.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}(),Oj="object"==("undefined"==typeof global?"undefined":t(global))&&global&&global.Object===Object&&global,wj="object"==("undefined"==typeof self?"undefined":t(self))&&self&&self.Object===Object&&self,Nj=Oj||wj||Function("return this")(),Pj=Nj.Symbol,Dj=Object.prototype,kj=Dj.hasOwnProperty,Mj=Dj.toString,Uj=Pj?Pj.toStringTag:void 0;var Lj=Object.prototype.toString;var xj=Pj?Pj.toStringTag:void 0;function Vj(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":xj&&xj in Object(e)?function(e){var t=kj.call(e,Uj),i=e[Uj];try{e[Uj]=void 0;var r=!0}catch(e){}var n=Mj.call(e);return r&&(t?e[Uj]=i:delete e[Uj]),n}(e):function(e){return Lj.call(e)}(e)}function Fj(e){return null!=e&&"object"==t(e)}var Bj=Array.isArray;function jj(e){var i=t(e);return null!=e&&("object"==i||"function"==i)}function Gj(e){return e}function Hj(e){if(!jj(e))return!1;var t=Vj(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t}var zj=Nj["__core-js_shared__"],Kj=function(){var e=/[^.]+$/.exec(zj&&zj.keys&&zj.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}();var Wj=Function.prototype.toString;var Xj=/^\[object .+?Constructor\]$/,Yj=Function.prototype,qj=Object.prototype,Jj=Yj.toString,Qj=qj.hasOwnProperty,Zj=RegExp("^"+Jj.call(Qj).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function $j(e){return!(!jj(e)||(t=e,Kj&&Kj in t))&&(Hj(e)?Zj:Xj).test(function(e){if(null!=e){try{return Wj.call(e)}catch(e){}try{return e+""}catch(e){}}return""}(e));var t}function eG(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 tG=Date.now;var iG,rG,nG,oG=function(){try{var e=function(e,t){var i=function(e,t){return null==e?void 0:e[t]}(e,t);return $j(i)?i:void 0}(Object,"defineProperty");return e({},"",{}),e}catch(e){}}(),aG=oG,sG=aG?function(e,t){return aG(e,"toString",{configurable:!0,enumerable:!1,value:(i=t,function(){return i}),writable:!0});var i}:Gj,cG=(iG=sG,rG=0,nG=0,function(){var e=tG(),t=16-(e-nG);if(nG=e,t>0){if(++rG>=800)return arguments[0]}else rG=0;return iG.apply(void 0,arguments)}),uG=cG,dG=/^(?:0|[1-9]\d*)$/;function lG(e,i){var r=t(e);return!!(i=null==i?9007199254740991:i)&&("number"==r||"symbol"!=r&&dG.test(e))&&e>-1&&e%1==0&&e<i}function hG(e,t,i){"__proto__"==t&&aG?aG(e,t,{configurable:!0,enumerable:!0,value:i,writable:!0}):e[t]=i}function pG(e,t){return e===t||e!=e&&t!=t}var _G=Object.prototype.hasOwnProperty;function fG(e,t,i){var r=e[t];_G.call(e,t)&&pG(r,i)&&(void 0!==i||t in e)||hG(e,t,i)}var vG=Math.max;function mG(e,t){return uG(function(e,t,i){return t=vG(void 0===t?e.length-1:t,0),function(){for(var r=arguments,n=-1,o=vG(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),eG(e,this,s)}}(e,t,Gj),e+"")}function SG(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=9007199254740991}function yG(e){return null!=e&&SG(e.length)&&!Hj(e)}var gG=Object.prototype;function EG(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||gG)}function bG(e){return Fj(e)&&"[object Arguments]"==Vj(e)}var TG=Object.prototype,IG=TG.hasOwnProperty,RG=TG.propertyIsEnumerable,AG=bG(function(){return arguments}())?bG:function(e){return Fj(e)&&IG.call(e,"callee")&&!RG.call(e,"callee")},CG=AG;var OG="object"==("undefined"==typeof exports?"undefined":t(exports))&&exports&&!exports.nodeType&&exports,wG=OG&&"object"==("undefined"==typeof module?"undefined":t(module))&&module&&!module.nodeType&&module,NG=wG&&wG.exports===OG?Nj.Buffer:void 0,PG=(NG?NG.isBuffer:void 0)||function(){return!1},DG={};DG["[object Float32Array]"]=DG["[object Float64Array]"]=DG["[object Int8Array]"]=DG["[object Int16Array]"]=DG["[object Int32Array]"]=DG["[object Uint8Array]"]=DG["[object Uint8ClampedArray]"]=DG["[object Uint16Array]"]=DG["[object Uint32Array]"]=!0,DG["[object Arguments]"]=DG["[object Array]"]=DG["[object ArrayBuffer]"]=DG["[object Boolean]"]=DG["[object DataView]"]=DG["[object Date]"]=DG["[object Error]"]=DG["[object Function]"]=DG["[object Map]"]=DG["[object Number]"]=DG["[object Object]"]=DG["[object RegExp]"]=DG["[object Set]"]=DG["[object String]"]=DG["[object WeakMap]"]=!1;var kG="object"==("undefined"==typeof exports?"undefined":t(exports))&&exports&&!exports.nodeType&&exports,MG=kG&&"object"==("undefined"==typeof module?"undefined":t(module))&&module&&!module.nodeType&&module,UG=MG&&MG.exports===kG&&Oj.process,LG=function(){try{var e=MG&&MG.require&&MG.require("util").types;return e||UG&&UG.binding&&UG.binding("util")}catch(e){}}(),xG=LG&&LG.isTypedArray,VG=xG?function(e){return function(t){return e(t)}}(xG):function(e){return Fj(e)&&SG(e.length)&&!!DG[Vj(e)]},FG=VG,BG=Object.prototype.hasOwnProperty;function jG(e,t){var i=Bj(e),r=!i&&CG(e),n=!i&&!r&&PG(e),o=!i&&!r&&!n&&FG(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&&!BG.call(e,u)||a&&("length"==u||n&&("offset"==u||"parent"==u)||o&&("buffer"==u||"byteLength"==u||"byteOffset"==u)||lG(u,c))||s.push(u);return s}var GG=function(e,t){return function(i){return e(t(i))}}(Object.keys,Object),HG=GG,zG=Object.prototype.hasOwnProperty;function KG(e){return yG(e)?jG(e):function(e){if(!EG(e))return HG(e);var t=[];for(var i in Object(e))zG.call(e,i)&&"constructor"!=i&&t.push(i);return t}(e)}var WG=Object.prototype.hasOwnProperty;function XG(e){if(!jj(e))return function(e){var t=[];if(null!=e)for(var i in Object(e))t.push(i);return t}(e);var t=EG(e),i=[];for(var r in e)("constructor"!=r||!t&&WG.call(e,r))&&i.push(r);return i}var YG,qG=(YG=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?hG(i,s,c):fG(i,s,c)}}(t,function(e){return yG(e)?jG(e,!0):XG(e)}(t),e)},mG((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=YG.length>3&&"function"==typeof o?(n--,o):void 0,a&&function(e,i,r){if(!jj(r))return!1;var n=t(i);return!!("number"==n?yG(r)&&lG(i,r.length):"string"==n&&i in r)&&pG(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&&YG(e,s,r,o)}return e}))),JG=qG;function QG(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 ZG(e){return null==e?[]:QG(e,KG(e))}var $G=a,eH=$e("iterator"),tH=!$G((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[eH]||"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})),iH=I,rH=2147483647,nH=/[^\0-\u007E]/,oH=/[.\u3002\uFF0E\uFF61]/g,aH="Overflow: input needs wider integers to process",sH=n.RangeError,cH=iH(oH.exec),uH=Math.floor,dH=String.fromCharCode,lH=iH("".charCodeAt),hH=iH([].join),pH=iH([].push),_H=iH("".replace),fH=iH("".split),vH=iH("".toLowerCase),mH=function(e){return e+22+75*(e<26)},SH=function(e,t,i){var r=0;for(e=i?uH(e/700):e>>1,e+=uH(e/t);e>455;)e=uH(e/35),r+=36;return uH(r+36*e/(e+38))},yH=function(e){var t=[];e=function(e){for(var t=[],i=0,r=e.length;i<r;){var n=lH(e,i++);if(n>=55296&&n<=56319&&i<r){var o=lH(e,i++);56320==(64512&o)?pH(t,((1023&n)<<10)+(1023&o)+65536):(pH(t,n),i--)}else pH(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&&pH(t,dH(r));var c=t.length,u=c;for(c&&pH(t,"-");u<n;){var d=rH;for(i=0;i<e.length;i++)(r=e[i])>=o&&r<d&&(d=r);var l=u+1;if(d-o>uH((rH-a)/l))throw sH(aH);for(a+=(d-o)*l,o=d,i=0;i<e.length;i++){if((r=e[i])<o&&++a>rH)throw sH(aH);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-_;pH(t,dH(mH(_+f%v))),h=uH(f/v),p+=36}pH(t,dH(mH(h))),s=SH(a,l,u==c),a=0,u++}}a++,o++}return hH(t,"")},gH=Wr,EH=n,bH=W,TH=l,IH=I,RH=tH,AH=Yt.exports,CH=rc,OH=Go,wH=Ph,NH=Oi,PH=lc,DH=B,kH=xe,MH=Wo,UH=lo,LH=kt,xH=G,VH=_o,FH=Rn,BH=S,jH=Oc,GH=Ec,HH=lu,zH=bI,KH=$e("iterator"),WH="URLSearchParams",XH="URLSearchParamsIterator",YH=NH.set,qH=NH.getterFor(WH),JH=NH.getterFor(XH),QH=bH("fetch"),ZH=bH("Request"),$H=bH("Headers"),ez=ZH&&ZH.prototype,tz=$H&&$H.prototype,iz=EH.RegExp,rz=EH.TypeError,nz=EH.decodeURIComponent,oz=EH.encodeURIComponent,az=IH("".charAt),sz=IH([].join),cz=IH([].push),uz=IH("".replace),dz=IH([].shift),lz=IH([].splice),hz=IH("".split),pz=IH("".slice),_z=/\+/g,fz=Array(4),vz=function(e){return fz[e-1]||(fz[e-1]=iz("((?:%[\\da-f]{2}){"+e+"})","gi"))},mz=function(e){try{return nz(e)}catch(t){return e}},Sz=function(e){var t=uz(e,_z," "),i=4;try{return nz(t)}catch(e){for(;i;)t=uz(t,vz(i--),mz);return t}},yz=/[!'()~]|%20/g,gz={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+"},Ez=function(e){return gz[e]},bz=function(e){return uz(oz(e),yz,Ez)},Tz=wH((function(e,t){YH(this,{type:XH,iterator:jH(qH(e).entries),kind:t})}),"Iterator",(function(){var e=JH(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),Iz=function(e){this.entries=[],this.url=null,void 0!==e&&(xH(e)?this.parseObject(e):this.parseQuery("string"==typeof e?"?"===az(e,0)?pz(e,1):e:VH(e)))};Iz.prototype={type:WH,bindURL:function(e){this.url=e,this.update()},parseObject:function(e){var t,i,r,n,o,a,s,c=GH(e);if(c)for(i=(t=jH(e,c)).next;!(r=TH(i,t)).done;){if(o=(n=jH(LH(r.value))).next,(a=TH(o,n)).done||(s=TH(o,n)).done||!TH(o,n).done)throw rz("Expected sequence with length 2");cz(this.entries,{key:VH(a.value),value:VH(s.value)})}else for(var u in e)kH(e,u)&&cz(this.entries,{key:u,value:VH(e[u])})},parseQuery:function(e){if(e)for(var t,i,r=hz(e,"&"),n=0;n<r.length;)(t=r[n++]).length&&(i=hz(t,"="),cz(this.entries,{key:Sz(dz(i)),value:Sz(sz(i,"="))}))},serialize:function(){for(var e,t=this.entries,i=[],r=0;r<t.length;)e=t[r++],cz(i,bz(e.key)+"="+bz(e.value));return sz(i,"&")},update:function(){this.entries.length=0,this.parseQuery(this.url.query)},updateURL:function(){this.url&&this.url.update()}};var Rz=function(){PH(this,Az);var e=arguments.length>0?arguments[0]:void 0;YH(this,new Iz(e))},Az=Rz.prototype;if(CH(Az,{append:function(e,t){HH(arguments.length,2);var i=qH(this);cz(i.entries,{key:VH(e),value:VH(t)}),i.updateURL()},delete:function(e){HH(arguments.length,1);for(var t=qH(this),i=t.entries,r=VH(e),n=0;n<i.length;)i[n].key===r?lz(i,n,1):n++;t.updateURL()},get:function(e){HH(arguments.length,1);for(var t=qH(this).entries,i=VH(e),r=0;r<t.length;r++)if(t[r].key===i)return t[r].value;return null},getAll:function(e){HH(arguments.length,1);for(var t=qH(this).entries,i=VH(e),r=[],n=0;n<t.length;n++)t[n].key===i&&cz(r,t[n].value);return r},has:function(e){HH(arguments.length,1);for(var t=qH(this).entries,i=VH(e),r=0;r<t.length;)if(t[r++].key===i)return!0;return!1},set:function(e,t){HH(arguments.length,1);for(var i,r=qH(this),n=r.entries,o=!1,a=VH(e),s=VH(t),c=0;c<n.length;c++)(i=n[c]).key===a&&(o?lz(n,c--,1):(o=!0,i.value=s));o||cz(n,{key:a,value:s}),r.updateURL()},sort:function(){var e=qH(this);zH(e.entries,(function(e,t){return e.key>t.key?1:-1})),e.updateURL()},forEach:function(e){for(var t,i=qH(this).entries,r=MH(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 Tz(this,"keys")},values:function(){return new Tz(this,"values")},entries:function(){return new Tz(this,"entries")}},{enumerable:!0}),AH(Az,KH,Az.entries,{name:"entries"}),AH(Az,"toString",(function(){return qH(this).serialize()}),{enumerable:!0}),OH(Rz,WH),gH({global:!0,forced:!RH},{URLSearchParams:Rz}),!RH&&DH($H)){var Cz=IH(tz.has),Oz=IH(tz.set),wz=function(e){if(xH(e)){var t,i=e.body;if(UH(i)===WH)return t=e.headers?new $H(e.headers):new $H,Cz(t,"content-type")||Oz(t,"content-type","application/x-www-form-urlencoded;charset=UTF-8"),FH(e,{body:BH(0,VH(i)),headers:BH(0,t)})}return e};if(DH(QH)&&gH({global:!0,enumerable:!0,forced:!0},{fetch:function(e){return QH(e,arguments.length>1?wz(arguments[1]):{})}}),DH(ZH)){var Nz=function(e){return PH(this,ez),new ZH(e,arguments.length>1?wz(arguments[1]):{})};ez.constructor=Nz,Nz.prototype=ez,gH({global:!0,forced:!0},{Request:Nz})}}var Pz,Dz={URLSearchParams:Rz,getState:qH},kz=Wr,Mz=s,Uz=tH,Lz=n,xz=Wo,Vz=I,Fz=tn.f,Bz=Yt.exports,jz=lc,Gz=xe,Hz=Vn,zz=JP,Kz=Ro,Wz=yp.codeAt,Xz=function(e){var t,i,r=[],n=fH(_H(vH(e),oH,"."),".");for(t=0;t<n.length;t++)i=n[t],pH(r,cH(nH,i)?"xn--"+yH(i):i);return hH(r,".")},Yz=_o,qz=Go,Jz=lu,Qz=Dz,Zz=Oi,$z=Zz.set,eK=Zz.getterFor("URL"),tK=Qz.URLSearchParams,iK=Qz.getState,rK=Lz.URL,nK=Lz.TypeError,oK=Lz.parseInt,aK=Math.floor,sK=Math.pow,cK=Vz("".charAt),uK=Vz(/./.exec),dK=Vz([].join),lK=Vz(1..toString),hK=Vz([].pop),pK=Vz([].push),_K=Vz("".replace),fK=Vz([].shift),vK=Vz("".split),mK=Vz("".slice),SK=Vz("".toLowerCase),yK=Vz([].unshift),gK="Invalid scheme",EK="Invalid host",bK="Invalid port",TK=/[a-z]/i,IK=/[\d+-.a-z]/i,RK=/\d/,AK=/^0x/i,CK=/^[0-7]+$/,OK=/^\d+$/,wK=/^[\da-f]+$/i,NK=/[\0\t\n\r #%/:<>?@[\\\]^|]/,PK=/[\0\t\n\r #/:<>?@[\\\]^|]/,DK=/^[\u0000-\u0020]+|[\u0000-\u0020]+$/g,kK=/[\t\n\r]/g,MK=function(e){var t,i,r,n;if("number"==typeof e){for(t=[],i=0;i<4;i++)yK(t,e%256),e=aK(e/256);return dK(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+=lK(e[i],16),i<7&&(t+=":")));return"["+t+"]"}return e},UK={},LK=Hz({},UK,{" ":1,'"':1,"<":1,">":1,"`":1}),xK=Hz({},LK,{"#":1,"?":1,"{":1,"}":1}),VK=Hz({},xK,{"/":1,":":1,";":1,"=":1,"@":1,"[":1,"\\":1,"]":1,"^":1,"|":1}),FK=function(e,t){var i=Wz(e,0);return i>32&&i<127&&!Gz(t,e)?e:encodeURIComponent(e)},BK={ftp:21,file:null,http:80,https:443,ws:80,wss:443},jK=function(e,t){var i;return 2==e.length&&uK(TK,cK(e,0))&&(":"==(i=cK(e,1))||!t&&"|"==i)},GK=function(e){var t;return e.length>1&&jK(mK(e,0,2))&&(2==e.length||"/"===(t=cK(e,2))||"\\"===t||"?"===t||"#"===t)},HK=function(e){return"."===e||"%2e"===SK(e)},zK={},KK={},WK={},XK={},YK={},qK={},JK={},QK={},ZK={},$K={},eW={},tW={},iW={},rW={},nW={},oW={},aW={},sW={},cW={},uW={},dW={},lW=function(e,t,i){var r,n,o,a=Yz(e);if(t){if(n=this.parse(a))throw nK(n);this.searchParams=null}else{if(void 0!==i&&(r=new lW(i,!0)),n=this.parse(a,null,r))throw nK(n);(o=iK(new tK)).bindURL(this),this.searchParams=o}};lW.prototype={type:"URL",parse:function(e,t,i){var r,n,o,a,s,c=this,u=t||zK,d=0,l="",h=!1,p=!1,_=!1;for(e=Yz(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=_K(e,DK,"")),e=_K(e,kK,""),r=zz(e);d<=r.length;){switch(n=r[d],u){case zK:if(!n||!uK(TK,n)){if(t)return gK;u=WK;continue}l+=SK(n),u=KK;break;case KK:if(n&&(uK(IK,n)||"+"==n||"-"==n||"."==n))l+=SK(n);else{if(":"!=n){if(t)return gK;l="",u=WK,d=0;continue}if(t&&(c.isSpecial()!=Gz(BK,l)||"file"==l&&(c.includesCredentials()||null!==c.port)||"file"==c.scheme&&!c.host))return;if(c.scheme=l,t)return void(c.isSpecial()&&BK[c.scheme]==c.port&&(c.port=null));l="","file"==c.scheme?u=rW:c.isSpecial()&&i&&i.scheme==c.scheme?u=XK:c.isSpecial()?u=QK:"/"==r[d+1]?(u=YK,d++):(c.cannotBeABaseURL=!0,pK(c.path,""),u=cW)}break;case WK:if(!i||i.cannotBeABaseURL&&"#"!=n)return gK;if(i.cannotBeABaseURL&&"#"==n){c.scheme=i.scheme,c.path=Kz(i.path),c.query=i.query,c.fragment="",c.cannotBeABaseURL=!0,u=dW;break}u="file"==i.scheme?rW:qK;continue;case XK:if("/"!=n||"/"!=r[d+1]){u=qK;continue}u=ZK,d++;break;case YK:if("/"==n){u=$K;break}u=sW;continue;case qK:if(c.scheme=i.scheme,n==Pz)c.username=i.username,c.password=i.password,c.host=i.host,c.port=i.port,c.path=Kz(i.path),c.query=i.query;else if("/"==n||"\\"==n&&c.isSpecial())u=JK;else if("?"==n)c.username=i.username,c.password=i.password,c.host=i.host,c.port=i.port,c.path=Kz(i.path),c.query="",u=uW;else{if("#"!=n){c.username=i.username,c.password=i.password,c.host=i.host,c.port=i.port,c.path=Kz(i.path),c.path.length--,u=sW;continue}c.username=i.username,c.password=i.password,c.host=i.host,c.port=i.port,c.path=Kz(i.path),c.query=i.query,c.fragment="",u=dW}break;case JK:if(!c.isSpecial()||"/"!=n&&"\\"!=n){if("/"!=n){c.username=i.username,c.password=i.password,c.host=i.host,c.port=i.port,u=sW;continue}u=$K}else u=ZK;break;case QK:if(u=ZK,"/"!=n||"/"!=cK(l,d+1))continue;d++;break;case ZK:if("/"!=n&&"\\"!=n){u=$K;continue}break;case $K:if("@"==n){h&&(l="%40"+l),h=!0,o=zz(l);for(var f=0;f<o.length;f++){var v=o[f];if(":"!=v||_){var m=FK(v,VK);_?c.password+=m:c.username+=m}else _=!0}l=""}else if(n==Pz||"/"==n||"?"==n||"#"==n||"\\"==n&&c.isSpecial()){if(h&&""==l)return"Invalid authority";d-=zz(l).length+1,l="",u=eW}else l+=n;break;case eW:case tW:if(t&&"file"==c.scheme){u=oW;continue}if(":"!=n||p){if(n==Pz||"/"==n||"?"==n||"#"==n||"\\"==n&&c.isSpecial()){if(c.isSpecial()&&""==l)return EK;if(t&&""==l&&(c.includesCredentials()||null!==c.port))return;if(a=c.parseHost(l))return a;if(l="",u=aW,t)return;continue}"["==n?p=!0:"]"==n&&(p=!1),l+=n}else{if(""==l)return EK;if(a=c.parseHost(l))return a;if(l="",u=iW,t==tW)return}break;case iW:if(!uK(RK,n)){if(n==Pz||"/"==n||"?"==n||"#"==n||"\\"==n&&c.isSpecial()||t){if(""!=l){var S=oK(l,10);if(S>65535)return bK;c.port=c.isSpecial()&&S===BK[c.scheme]?null:S,l=""}if(t)return;u=aW;continue}return bK}l+=n;break;case rW:if(c.scheme="file","/"==n||"\\"==n)u=nW;else{if(!i||"file"!=i.scheme){u=sW;continue}if(n==Pz)c.host=i.host,c.path=Kz(i.path),c.query=i.query;else if("?"==n)c.host=i.host,c.path=Kz(i.path),c.query="",u=uW;else{if("#"!=n){GK(dK(Kz(r,d),""))||(c.host=i.host,c.path=Kz(i.path),c.shortenPath()),u=sW;continue}c.host=i.host,c.path=Kz(i.path),c.query=i.query,c.fragment="",u=dW}}break;case nW:if("/"==n||"\\"==n){u=oW;break}i&&"file"==i.scheme&&!GK(dK(Kz(r,d),""))&&(jK(i.path[0],!0)?pK(c.path,i.path[0]):c.host=i.host),u=sW;continue;case oW:if(n==Pz||"/"==n||"\\"==n||"?"==n||"#"==n){if(!t&&jK(l))u=sW;else if(""==l){if(c.host="",t)return;u=aW}else{if(a=c.parseHost(l))return a;if("localhost"==c.host&&(c.host=""),t)return;l="",u=aW}continue}l+=n;break;case aW:if(c.isSpecial()){if(u=sW,"/"!=n&&"\\"!=n)continue}else if(t||"?"!=n)if(t||"#"!=n){if(n!=Pz&&(u=sW,"/"!=n))continue}else c.fragment="",u=dW;else c.query="",u=uW;break;case sW:if(n==Pz||"/"==n||"\\"==n&&c.isSpecial()||!t&&("?"==n||"#"==n)){if(".."===(s=SK(s=l))||"%2e."===s||".%2e"===s||"%2e%2e"===s?(c.shortenPath(),"/"==n||"\\"==n&&c.isSpecial()||pK(c.path,"")):HK(l)?"/"==n||"\\"==n&&c.isSpecial()||pK(c.path,""):("file"==c.scheme&&!c.path.length&&jK(l)&&(c.host&&(c.host=""),l=cK(l,0)+":"),pK(c.path,l)),l="","file"==c.scheme&&(n==Pz||"?"==n||"#"==n))for(;c.path.length>1&&""===c.path[0];)fK(c.path);"?"==n?(c.query="",u=uW):"#"==n&&(c.fragment="",u=dW)}else l+=FK(n,xK);break;case cW:"?"==n?(c.query="",u=uW):"#"==n?(c.fragment="",u=dW):n!=Pz&&(c.path[0]+=FK(n,UK));break;case uW:t||"#"!=n?n!=Pz&&("'"==n&&c.isSpecial()?c.query+="%27":c.query+="#"==n?"%23":FK(n,UK)):(c.fragment="",u=dW);break;case dW:n!=Pz&&(c.fragment+=FK(n,LK))}d++}},parseHost:function(e){var t,i,r;if("["==cK(e,0)){if("]"!=cK(e,e.length-1))return EK;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 cK(e,l)};if(":"==h()){if(":"!=cK(e,1))return;l+=2,d=++u}for(;h();){if(8==u)return;if(":"!=h()){for(t=i=0;i<4&&uK(wK,h());)t=16*t+oK(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(!uK(RK,h()))return;for(;uK(RK,h());){if(o=oK(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}(mK(e,1,-1)),!t)return EK;this.host=t}else if(this.isSpecial()){if(e=Xz(e),uK(NK,e))return EK;if(t=function(e){var t,i,r,n,o,a,s,c=vK(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"==cK(n,0)&&(o=uK(AK,n)?16:8,n=mK(n,8==o?1:2)),""===n)a=0;else{if(!uK(10==o?OK:8==o?CK:wK,n))return e;a=oK(n,o)}pK(i,a)}for(r=0;r<t;r++)if(a=i[r],r==t-1){if(a>=sK(256,5-t))return null}else if(a>255)return null;for(s=hK(i),r=0;r<i.length;r++)s+=i[r]*sK(256,3-r);return s}(e),null===t)return EK;this.host=t}else{if(uK(PK,e))return EK;for(t="",i=zz(e),r=0;r<i.length;r++)t+=FK(i[r],UK);this.host=t}},cannotHaveUsernamePasswordPort:function(){return!this.host||this.cannotBeABaseURL||"file"==this.scheme},includesCredentials:function(){return""!=this.username||""!=this.password},isSpecial:function(){return Gz(BK,this.scheme)},shortenPath:function(){var e=this.path,t=e.length;!t||"file"==this.scheme&&1==t&&jK(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+=MK(n),null!==o&&(u+=":"+o)):"file"==t&&(u+="//"),u+=e.cannotBeABaseURL?a[0]:a.length?"/"+dK(a,"/"):"",null!==s&&(u+="?"+s),null!==c&&(u+="#"+c),u},setHref:function(e){var t=this.parse(e);if(t)throw nK(t);this.searchParams.update()},getOrigin:function(){var e=this.scheme,t=this.port;if("blob"==e)try{return new hW(e.path[0]).origin}catch(e){return"null"}return"file"!=e&&this.isSpecial()?e+"://"+MK(this.host)+(null!==t?":"+t:""):"null"},getProtocol:function(){return this.scheme+":"},setProtocol:function(e){this.parse(Yz(e)+":",zK)},getUsername:function(){return this.username},setUsername:function(e){var t=zz(Yz(e));if(!this.cannotHaveUsernamePasswordPort()){this.username="";for(var i=0;i<t.length;i++)this.username+=FK(t[i],VK)}},getPassword:function(){return this.password},setPassword:function(e){var t=zz(Yz(e));if(!this.cannotHaveUsernamePasswordPort()){this.password="";for(var i=0;i<t.length;i++)this.password+=FK(t[i],VK)}},getHost:function(){var e=this.host,t=this.port;return null===e?"":null===t?MK(e):MK(e)+":"+t},setHost:function(e){this.cannotBeABaseURL||this.parse(e,eW)},getHostname:function(){var e=this.host;return null===e?"":MK(e)},setHostname:function(e){this.cannotBeABaseURL||this.parse(e,tW)},getPort:function(){var e=this.port;return null===e?"":Yz(e)},setPort:function(e){this.cannotHaveUsernamePasswordPort()||(""==(e=Yz(e))?this.port=null:this.parse(e,iW))},getPathname:function(){var e=this.path;return this.cannotBeABaseURL?e[0]:e.length?"/"+dK(e,"/"):""},setPathname:function(e){this.cannotBeABaseURL||(this.path=[],this.parse(e,aW))},getSearch:function(){var e=this.query;return e?"?"+e:""},setSearch:function(e){""==(e=Yz(e))?this.query=null:("?"==cK(e,0)&&(e=mK(e,1)),this.query="",this.parse(e,uW)),this.searchParams.update()},getSearchParams:function(){return this.searchParams.facade},getHash:function(){var e=this.fragment;return e?"#"+e:""},setHash:function(e){""!=(e=Yz(e))?("#"==cK(e,0)&&(e=mK(e,1)),this.fragment="",this.parse(e,dW)):this.fragment=null},update:function(){this.query=this.searchParams.serialize()||null}};var hW=function(e){var t=jz(this,pW),i=Jz(arguments.length,1)>1?arguments[1]:void 0,r=$z(t,new lW(e,!1,i));Mz||(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())},pW=hW.prototype,_W=function(e,t){return{get:function(){return eK(this)[e]()},set:t&&function(e){return eK(this)[t](e)},configurable:!0,enumerable:!0}};if(Mz&&Fz(pW,{href:_W("serialize","setHref"),origin:_W("getOrigin"),protocol:_W("getProtocol","setProtocol"),username:_W("getUsername","setUsername"),password:_W("getPassword","setPassword"),host:_W("getHost","setHost"),hostname:_W("getHostname","setHostname"),port:_W("getPort","setPort"),pathname:_W("getPathname","setPathname"),search:_W("getSearch","setSearch"),searchParams:_W("getSearchParams"),hash:_W("getHash","setHash")}),Bz(pW,"toJSON",(function(){return eK(this).serialize()}),{enumerable:!0}),Bz(pW,"toString",(function(){return eK(this).serialize()}),{enumerable:!0}),rK){var fW=rK.createObjectURL,vW=rK.revokeObjectURL;fW&&Bz(hW,"createObjectURL",xz(fW,rK)),vW&&Bz(hW,"revokeObjectURL",xz(vW,rK))}qz(hW,"URL"),kz({global:!0,forced:!Uz,sham:!Mz},{URL:hW});var mW,SW=function(e,t){return ef(void 0,void 0,void 0,(function(){var i;return tf(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]}}))}))},yW=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._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 ef(this,void 0,void 0,(function(){var r,n,o,a,s,c,u,d,l,h,p,_,f,v,m=this;return tf(this,(function(S){switch(S.label){case 0:if(r=i.playCount,uk(n=i.type,"mixingType",ZG(sf)),!(o=this._context.getLocalAudioTrack()))return[2];if((a=FF(o.getTrack()))&&this.mixMediaStream(a),(s=this.mixingMap.get(e))&&s.audioNode){s.audioNode.pause(),this._context.emitMessage({mixId:e,state:cf.AUDIO_MIXING_STATE_STOPPED,error:sP.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:cf.AUDIO_MIXING_STATE_FAILED,error:sP.AUDIO_MIXING_ERROR_START_FAILED}),new lP(aP.LOAD_RESOURCES_FAILED,t.statusText)}))];case 2:return d=S.sent(),l=void 0,t.endsWith("mp3")?l={type:"audio/mpeg"}:t.endsWith("aac")&&(l={type:"audio/aac"}),[4,SW(d,l)];case 3:if(!S.sent())throw this._context.emitMessage({mixId:e,state:cf.AUDIO_MIXING_STATE_FAILED,error:sP.AUDIO_MIXING_ERROR_START_FAILED}),new lP(aP.LOAD_RESOURCES_FAILED,"invalid audio resource");(c=new Audio).crossOrigin="anonymous",c.src=URL.createObjectURL(new Blob([d],l)),S.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:cf.AUDIO_MIXING_STATE_FINISHED,error:sP.AUDIO_MIXING_ERROR_OK}))}),S.label=5;case 5:return S.trys.push([5,7,,8]),[4,c.play()];case 6:return S.sent(),[3,8];case 7:return p=S.sent(),console.error(p),this._failedAudioList.push(c),this._context.onAutoPlayFailed(),[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===sf.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:cf.AUDIO_MIXING_STATE_PLAYING,error:sP.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:cf.AUDIO_MIXING_STATE_STOPPED,error:sP.AUDIO_MIXING_ERROR_OK}))},e.prototype.pauseAudioMixing=function(e){var t=this.mixingMap.get(e);t&&(this._context.emitMessage({mixId:e,state:cf.AUDIO_MIXING_STATE_PAUSED,error:sP.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:cf.AUDIO_MIXING_STATE_PLAYING,error:sP.AUDIO_MIXING_ERROR_OK}),t.audioNode.play())},e.prototype.preloadAudioMixing=function(e,t){return ef(this,void 0,void 0,(function(){var i,r=this;return tf(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:cf.AUDIO_MIXING_STATE_FAILED,error:sP.AUDIO_MIXING_ERROR_PRELOAD_FAILED}),new lP(aP.LOAD_RESOURCES_FAILED,t.statusText)})).catch((function(t){throw r._context.emitMessage({mixId:e,state:cf.AUDIO_MIXING_STATE_FAILED,error:sP.AUDIO_MIXING_ERROR_PRELOAD_FAILED}),new lP(aP.LOAD_RESOURCES_FAILED,"Load resources failed",t)}))];case 1:return i=n.sent(),[4,SW(i)];case 2:if(!n.sent())throw this._context.emitMessage({mixId:e,state:cf.AUDIO_MIXING_STATE_FAILED,error:sP.AUDIO_MIXING_ERROR_PRELOAD_FAILED}),new lP(aP.LOAD_RESOURCES_FAILED,"Load resources failed");return this._context.emitMessage({mixId:e,state:cf.AUDIO_MIXING_STATE_PRELOADED,error:sP.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){uk(e,"type",ZG(sf));var t=this._context.getLocalAudioTrack();if(t){var i=FF(t.getTrack());if(i&&this.mixMediaStream(i),e===sf.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:cf.AUDIO_MIXING_STATE_PCM_ENABLED,error:sP.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:cf.AUDIO_MIXING_STATE_PCM_DISABLED,error:sP.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 ef(this,void 0,void 0,(function(){var e,t,i,r,n,o,a,s;return tf(this,(function(c){switch(c.label){case 0:e=[],c.label=1;case 1:c.trys.push([1,10,11,12]),t=rf(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(),[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()},$_([yx("default","id","filePath","options")],e.prototype,"startAudioMixing",null),$_([yx("default","id")],e.prototype,"stopAudioMixing",null),$_([yx("default","id")],e.prototype,"pauseAudioMixing",null),$_([yx("default","id")],e.prototype,"resumeAudioMixing",null),$_([yx("default","id")],e.prototype,"preloadAudioMixing",null),$_([yx("default","id")],e.prototype,"unloadAudioMixing",null),$_([yx("default","id")],e.prototype,"getAudioMixingVolume",null),$_([yx("default","id","volume")],e.prototype,"setAudioMixingVolume",null),$_([yx("default","id")],e.prototype,"getAudioMixingDuration",null),$_([yx("default","id")],e.prototype,"getAudioMixingCurrentPosition",null),$_([yx("default","id","position")],e.prototype,"setAudioMixingPosition",null),$_([yx("default","type")],e.prototype,"enableAudioMixingBuffer",null),$_([yx()],e.prototype,"disableAudioMixingBuffer",null),$_([yx("default","buffer")],e.prototype,"pushAudioMixingBuffer",null),e}();!function(e){e.NORMAL_USER="normalUser",e.SILENT_USER="silentUser"}(mW||(mW={}));var gW=new Ik("RTMClient",1),EW=function(e){function t(t){var i=e.call(this)||this;return i._appId=t,i._dataChannelSignal=null,i._handler=null,i._dataChannelSignalState=KB.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 A_(t,e),t.prototype.login=function(e,t){var i=this;return new Promise((function(r,n){if(gW.print("login","invoke login, token: %o, userId: %o",e,t),i._loginSessionId)throw new lP(aP.ALREADY_LOGIN,"Already logined");if(i._loginResolveCallback)throw new lP(aP.LOGIN_FAILED,"Is logging in, please try again later.");i._userId=t,i._token=e,vx.setStats({rtc_app_id:i._appId,user_id:t}),i._loginResolveCallback=r,i._loginRejectCallback=n,i._dataChannelSignal?i._login():(gW.print("login","init dataChannelSingling"),i._dataChannelSignalState=KB.CONNECTING,i._createDataChannelSignaling(t).then((function(e){i._dataChannelSignal=e,i._login()})).catch((function(){i._onDisconnect()})))}))},t.prototype.logout=function(){var e;return ef(this,void 0,void 0,(function(){return tf(this,(function(t){switch(t.label){case 0:if(!this._loginSessionId||!this._userId)throw new lP(aP.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:tV.C2RTM}).catch((function(){}))];case 1:return t.sent(),this._closeDataChannelSignaling(),this._clearState(),[2]}}))}))},t.prototype.updateLoginToken=function(e){return ef(this,void 0,void 0,(function(){var t=this;return tf(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 ef(this,void 0,void 0,(function(){var t;return tf(this,(function(i){switch(i.label){case 0:if(!this._loginSessionId||!this._userId)throw new lP(aP.NOT_LOGIN,"login first");return this._checkDataChannelSignal(),[4,this._dataChannelSignal.sendSignaling("getPeerOnlineStatus",{loginSessionId:this._loginSessionId,userId:this._userId,appId:this._appId,peerUserId:e},{functionType:tV.C2RTM})];case 1:return[2,null==(t=i.sent())?void 0:t.status]}}))}))},t.prototype.sendUserMessageOutsideRoom=function(e,t){return ef(this,void 0,void 0,(function(){return tf(this,(function(i){if(!this._loginSessionId||!this._userId)throw new lP(aP.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 ef(this,void 0,void 0,(function(){return tf(this,(function(i){switch(i.label){case 0:if(!this._loginSessionId||!this._userId)throw new lP(aP.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:tV.C2RTM})];case 1:return i.sent(),[2]}}))}))},t.prototype.sendServerMessage=function(e){return ef(this,void 0,void 0,(function(){return tf(this,(function(t){if(!this._loginSessionId||!this._userId)throw new lP(aP.NOT_LOGIN,"login first");return this._checkDataChannelSignal(),[2,this._dataChannelSignal.sendP2PMessage({from:this._userId,app:this._appId,to:"",room:"",type:Yx.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=zD();this._checkDataChannelSignal(),this._dataChannelSignal.sendSignaling("login",{Token:YD.token2auth(this._appId,null,this._userId,this._token),timestamp:Date.now(),loginSessionId:t,params:{deviceType:"web",userAgent:window.navigator.userAgent,sdkVersion:$x.VERSION,deviceId:wx.getDeviceId(),appId:this._appId,userId:this._userId}},{functionType:tV.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=aP.INVALID_PARAMS,r="Invalid userId"):(i=aP.INVALID_TOKEN,r="Invalid token",e._wait_login_token=!0,e._loginRejectCallback||e.emit("onRTMTokenError")):(i=aP.LOGIN_FAILED,r="login failed"),e._loginRejectCallback&&e._loginRejectCallback(new lP(i,a||r))})).finally((function(){e._loginResolveCallback=null,e._loginRejectCallback=null}))}},t.prototype._createDataChannelSignaling=function(e){var t,i;return ef(this,void 0,void 0,(function(){var r,n,o,a,s,c,u=this;return tf(this,(function(d){switch(d.label){case 0:if(r=new sV,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,wx.getDeviceId(),"")];case 2:if(o=d.sent(),!(n=o[0]))throw new Error;return[3,4];case 3:throw d.sent(),Ex("rtm.login.getNodeFailed","",0,!0),new lP(aP.ICE_SERVER_WRONG,"get ICE config failed");case 4:Ex("rtm.login.getNodeSuccess",n,0,!0),gW.print("_createDataChannelSignaling()","get node success",n),this._handler=jB(px),null===(t=this._handler)||void 0===t||t.once("disconnect",(function(){gW.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(),gW.print("_createDataChannelSignaling()","establish peerConnection success"),this._dataChannelSignalState=KB.CONNECTED,[3,8];case 7:throw s=d.sent(),this._iceConfigNode=null,this._dataChannelSignalState=KB.DISCONNECTED,new lP(aP.ESTABLISH_DATACHANNEL_FAILED,"establish dataChannel failed",s);case 8:return c=new nV(a),gW.print("_createDataChannelSignaling()","send ping"),c.sendPingSignaling(),c.once("close",(function(){gW.print("_createDataChannelSignaling()","recv DataChannelSignaling event: close"),u._onDisconnect()})),c.on(jx.USER_MESSAGE_RECEIVED_OUTSIDE_ROOM,(function(e){u.emit("onUserMessageReceivedOutsideRoom",{userId:e.from,message:e.msg})})),c.on(jx.USER_BINARY_MESSAGE_RECEIVED_OUTSIDE_ROOM,(function(e){u.emit("onUserBinaryMessageReceivedOutsideRoom",{userId:e.from,message:e.msg})})),c.on(jx.USER_DISCONNECTION,(function(){u.emit("onUserDisconnection"),u._clearState()})),c.on(jx.NODE_CHANGE,(function(e){Ex("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!==KB.CONNECTED)throw new lP(aP.NOT_CONNECTED_YET,"datachannel not connect")},t.prototype._onDisconnect=function(){this._dataChannelSignalState=KB.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&&(gW.print("_reconnect()","start reconnect..."),this._isReconnecting=!0,this._createDataChannelSignaling(this._userId).then((function(t){gW.print("_reconnect()","reconnect success!"),e._dataChannelSignal=t,e._login(),e._reconnectTimer=null})).catch((function(t){gW.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}(yk.exports.EventEmitter),bW=function(e){function t(t){var i=e.call(this)||this;return i._appId=t,i.remoteStreams=new Map,i}return A_(t,e),t.prototype.connect=function(){return ef(this,void 0,void 0,(function(){return tf(this,(function(e){switch(e.label){case 0:return this._mediaServerClient=new QB,this._bindEvents(),[4,this._mediaServerClient.connect(this._appId)];case 1:return e.sent(),[2]}}))}))},t.prototype.startPlayPublicStream=function(e){return ef(this,void 0,void 0,(function(){var t,i=this;return tf(this,(function(r){switch(r.label){case 0:if(this.remoteStreams.get(e))throw new lP(aP.REPEAT_PLAY,"repeat play public media stream");return(t=new CB(e,e,!1,{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(hB.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),[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 ef(this,void 0,void 0,(function(){var e,t,i,r,n,o,a,s,c=this;return tf(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(hB.RESUBSCRIBE,{stream:t})}))},t=this;try{for(i=rf(this.remoteStreams),r=i.next();!r.done;r=i.next())n=nf(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(Hx.ABNORMAL_DISCONNECTION,this._reconnect.bind(this)),null===(t=this._mediaServerClient)||void 0===t||t.on("onRemoteStreamStats",(function(e){i.emit("onRemoteStreamStats",e)}))},t}(Ak),TW=new Ik("AudioDeviceManager",1),IW=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t._isAudioPlaybackDeviceTesting=!1,t._isAudioDeviceRecordTesting=!1,t}return A_(t,e),t.prototype.startAudioPlaybackDeviceTest=function(e,t){return ef(this,void 0,void 0,(function(){var i;return tf(this,(function(r){switch(r.label){case 0:if(this._isAudioPlaybackDeviceTesting||this._isAudioDeviceRecordTesting)throw new lP(aP.REPEAT_DEVICE_TEST,"device test cannot be called repeatedly at the same time.");this._isAudioPlaybackDeviceTesting=!0,TW.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&&(TW.print("stopAudioPlaybackDeviceTest()","Invoke"),this._isAudioPlaybackDeviceTesting=!1,this._stopEmitAudioPlaybackDeviceTestVolume(),this._destroyAudioElement())},t.prototype.startAudioDeviceRecordTest=function(e){return ef(this,void 0,void 0,(function(){var t=this;return tf(this,(function(i){switch(i.label){case 0:if(this._isAudioDeviceRecordTesting)throw new lP(aP.REPEAT_DEVICE_TEST,"device test cannot be called repeatedly at the same time.");return this._isAudioDeviceRecordTesting=!0,TW.print("startAudioDeviceRecordTest()","Invoke"),this._recoderTimer=window.setTimeout((function(){TW.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(){TW.print("stopAudioDeviceRecordAndPlayTest()","Invoke"),void 0!==this._recoderTimer&&(clearTimeout(this._recoderTimer),delete this._recoderTimer),this._stopAudioCaptureAndRecoder()},t.prototype.stopAudioDevicePlayTest=function(){this._isAudioDeviceRecordTesting&&(TW.print("stopAudioDevicePlayTest()","Invoke"),this._isAudioDeviceRecordTesting=!1,this.stopAudioDeviceRecordAndPlayTest(),this._stopEmitAudioPlaybackDeviceTestVolume(),this._destroyAudioElement())},t.prototype.getRecordTrack=function(){return this._audioTrack},t.prototype.destroy=function(){TW.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=Sj("audio",{attributes:{src:e,crossOrigin:"",autoplay:"true"}}),i._audioElement.loop=t.loop,TW.print("_playAudioFile()","url=".concat(e,";loop=").concat(t.loop)),i._audioElement.oncanplay=function(){TW.print("_playAudioFile()","oncanplay"),r()},i._audioElement.onerror=function(e){var t,r;n(new lP(aP.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&&(TW.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&&(TW.print("_startEmitAudioPlaybackDeviceTestVolume()","start timer(".concat(e,"ms)")),this._audioLevelFetcher=new UF(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&&(TW.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 ef(this,void 0,void 0,(function(){var t,i,r=this;return tf(this,(function(n){switch(n.label){case 0:return t=this,[4,eB({})];case 1:return t._audioTrack=n.sent(),i=FF(this._audioTrack.getTrack()),TW.print("startAudioDeviceRecordTest()","create microphone track success!"),[2,new Promise((function(t,n){r._mediaRecorder=new MediaRecorder(i),r._mediaRecorder.ondataavailable=function(i){return ef(r,void 0,void 0,(function(){var r,o,a,s=this;return tf(this,(function(c){switch(c.label){case 0:if(!this._isAudioDeviceRecordTesting)return[3,5];TW.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 lP(aP.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}(yk.exports.EventEmitter),RW=function(){function e(){this.engineBAC={},this.engineANM={},this._init()}return e.prototype._init=function(){return ef(this,void 0,void 0,(function(){var e,t;return tf(this,(function(i){switch(i.label){case 0:return e=new cV,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:Z_(Z_({},this.engineBAC.play),e.play),record:Z_(Z_({},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 J_.fluent:i=16e3,t=24e3;break;case J_.standard:i=48e3,t=48e3;break;case J_.hd:i=48e3,t=128e3,r=2;break;case J_.standardStereo:i=48e3,t=8e4,r=2;break;case J_.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}(),AW=new Ik("Engine",0),CW=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._publicStreamAudioPlayer=new Map,r._publicStreamVideoPlayer=new Map,r._publicStreamIds=new Map,r._videoStreamConstraints={},r._audioStreamConstraints={},r._enableSimulcast=!1,r._videoStreamEncodeConfig=[Qx],r._screenStreamEncodeConfig=[Zx],r._pauseAllSubscribeState={audio:!1,video:!1},r._audioPropertiesReportTimer=null,r._mirrorType=B_.MIRROR_TYPE_RENDER,r._audioDeviceManager=new IW,r._audioProfileManager=new RW,r._remoteVideoConfig=new Map,r._userPriorityMap=new Map,r._subscribeFallbackOption=K_.DISABLE,r._updateMixAudioTrack=function(e,t){return void 0===t&&(t=sf.PLAYOUT_AND_PUBLISH),ef(r,void 0,void 0,(function(){var i;return tf(this,(function(r){switch(r.label){case 0:return AW.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(df.onAudioMixingStateChanged,e)},r._onAudioMixingAutoplayFailed=function(){r.safeEmit(df.onAutoplayFailed,{})},r._appId=t,r._pubLock=new zB("pubLock"),r._addDeviceEventHandler(),r._audioMixingManager=new yW({getLocalAudioTrack:function(){return r._localAudioTrack},updateLocalAudioTrack:r._updateMixAudioTrack,emitMessage:r._onAudioMixingMessage,onAutoPlayFailed:r._onAudioMixingAutoplayFailed}),window.__rtc_engine__=r,window["__rtc_engine__".concat(Math.floor(100*Math.random()+1))]=r,r._trackSourceType={video:C_.VIDEO_SOURCE_TYPE_INTERNAL,screenVideo:C_.VIDEO_SOURCE_TYPE_INTERNAL,audio:O_.AUDIO_SOURCE_TYPE_INTERNAL,screenAudio:O_.AUDIO_SOURCE_TYPE_INTERNAL},r._config=i,r._rtmClient=new EW(t),r._handleRTMClient(r._rtmClient),r._useCloudProxy=!1,r._handleAudioDeviceManager(),r._messageStatisticsObserver=new Cj,r}return A_(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 ef(this,void 0,void 0,(function(){var n,o,a,s;return tf(this,(function(c){switch(c.label){case 0:return AW.print("updateToken()","token: %s",e),ck(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 lP(aP.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){return ef(this,void 0,void 0,(function(){var t,i;return tf(this,(function(r){switch(r.label){case 0:return AW.print("setVideoCaptureDevice()","deviceId: %s",e),ck(e,"deviceId"),this._localVideoTrack?(t=this._videoStreamConstraints,"user"===e||"environment"===e||"left"===e||"right"===e?(delete t.deviceId,t.facingMode=e):t.deviceId={exact:e},this._videoStreamConstraints=t,[4,$F(t)]):(this._localVideoDeviceId=e,[2,Promise.resolve()]);case 1:return i=r.sent(),this._initLocalTrackEvents(i),this._localVideoTrack.close(),this._localVideoTrack=i,this._videoPlayer&&this._videoPlayer.played&&(this._videoPlayer.stop(),this._videoPlayer.playVideo(i),this._videoPlayer.mirror(!!this._mirrorType)),this._room?this._room.hasPublished?[4,this._updatePublish()]:[3,3]:[2];case 2:r.sent(),r.label=3;case 3:return[2]}}))}))},t.prototype.setAudioCaptureDevice=function(e){return ef(this,void 0,void 0,(function(){var t,i;return tf(this,(function(r){switch(r.label){case 0:return AW.print("setAudioCaptureDevice()","deviceId: %s",e),ck(e,"deviceId"),this._localAudioTrack?((t=this._audioStreamConstraints).deviceId={exact:e},this._audioStreamConstraints=t,[4,eB(t,this._audioProfileManager)]):(this._localAudioDeviceId=e,[2,Promise.resolve()]);case 1:return i=r.sent(),this._initLocalTrackEvents(i),this._localAudioTrack.close(),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(){kF.on(df.onVideoDeviceStateChanged,this._onVideoDeviceStateChange.bind(this)),kF.on(df.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,S,y,g,E,b,T,I,R,A,C,O=this;null===(e=this._room)||void 0===e||e.on(jx.ON_ADD_STREAM,this._onAddStream.bind(this)),null===(t=this._room)||void 0===t||t.on(jx.ON_REMOVE_STREAM,this._onRemoveStream.bind(this)),null===(i=this._room)||void 0===i||i.on(jx.USER_CONNECTION,this._onUserConnection.bind(this)),null===(r=this._room)||void 0===r||r.on(hB.ON_USER_LEAVE,this._onUserLeave.bind(this)),null===(n=this._room)||void 0===n||n.on(hB.ON_ROOM_ERROR,this._onRoomError.bind(this)),null===(o=this._room)||void 0===o||o.on(hB.ON_NETWORK_QUALITY,this._onNetworkQuality.bind(this)),null===(a=this._room)||void 0===a||a.on(jx.ON_CUSTOM_MESSAGE,this._onCustomMessage.bind(this)),null===(s=this._room)||void 0===s||s.on(jx.USER_MESSAGE_RECEIVED,this._onUserMessageReceived.bind(this)),null===(c=this._room)||void 0===c||c.on(jx.USER_BINARY_MESSAGE_RECEIVED,this._onUserBinaryMessageReceived.bind(this)),null===(u=this._room)||void 0===u||u.on(jx.ON_USER_TOKEN_WILL_EXPIRE,this._onUserTokenWillExpire.bind(this)),null===(d=this._room)||void 0===d||d.on(jx.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(Hx.ON_CONNECTION_STATE_CHANGE,this._onConnectionStateChange.bind(this)),null===(h=this._room)||void 0===h||h.on(hB.RESUBSCRIBE,this._onResubscribe.bind(this)),null===(p=this._room)||void 0===p||p.on(hB.SUBSCRIBE_PUSH_TRACK,this._onSubscribePushTrack.bind(this)),null===(_=this._room)||void 0===_||_.on(hB.REMOVE_PUSH_TRACK,this._onRemovePushTrack.bind(this)),null===(f=this._room)||void 0===f||f.on(hB.VIDEO_FIRST_FRAME,this._onVideoFirstFrameDecoded.bind(this)),null===(v=this._room)||void 0===v||v.on(hB.ON_PUBLISH_RESULT,(function(e){var t;(null===(t=O._room)||void 0===t?void 0:t._roomConfig.isAutoPublish)&&O.safeEmit(df.onAutoPublishResult,e)})),null===(m=this._room)||void 0===m||m.on(hB.ON_REMOTE_STREAM_STATS,(function(e){O.safeEmit(df.onRemoteStreamStats,e)})),null===(S=this._room)||void 0===S||S.on(hB.ON_LOCAL_STREAM_STATS,(function(e){O.safeEmit(df.onLocalStreamStats,e)})),null===(y=this._room)||void 0===y||y.on(hB.ON_USER_PUBLISH_STATE_CHANGE,this._onUserPublishStateChange.bind(this)),null===(g=this._room)||void 0===g||g.on(hB.ON_USER_START_AUDIO_CAPTURE,(function(e){var t=e.userId;O.safeEmit(df.onUserStartAudioCapture,{userId:t})})),null===(E=this._room)||void 0===E||E.on(hB.ON_USER_STOP_AUDIO_CAPTURE,(function(e){var t=e.userId;O.safeEmit(df.onUserStopAudioCapture,{userId:t})})),null===(b=this._room)||void 0===b||b.on(hB.ON_USER_START_VIDEO_CAPTURE,(function(e){var t=e.userId;O.safeEmit(df.onUserStartVideoCapture,{userId:t})})),null===(T=this._room)||void 0===T||T.on(hB.ON_USER_STOP_VIDEO_CAPTURE,(function(e){var t=e.userId;O.safeEmit(df.onUserStopVideoCapture,{userId:t})})),null===(I=this._room)||void 0===I||I.on(hB.ON_SEI_MESSAGED_RECEIVED,(function(e){O.safeEmit(df.onSEIMessageReceived,e)})),null===(R=this._room)||void 0===R||R.on(hB.ON_REMOTE_VIDEO_SIZE_CHANGED,(function(e,t){O.safeEmit(df.onRemoteVideoSizeChanged,e,t)})),null===(A=this._room)||void 0===A||A.on(hB.ON_SIMULCAST_SUBSCRIBE_FALLBACK,(function(e){return O.safeEmit(df.onSimulcastSubscribeFallback,e)})),null===(C=this._room)||void 0===C||C.on(hB.RECONNECT_FAILED,(function(){O.safeEmit(df.onError,{errorCode:aP.RECONNECT_FAILED})}))},t.prototype.safeEmit=function(t){for(var i=[],r=1;r<arguments.length;r++)i[r-1]=arguments[r];return Sk(t)&&gx(t,$D(i)),e.prototype.safeEmit.apply(this,of([t],nf(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 ef(this,void 0,void 0,(function(){var n,o,a,s;return tf(this,(function(c){switch(c.label){case 0:if(AW.print("joinRoom()","token: %o roomId: %o, userInfo: %o, roomConfig: %o",e,t,i,r),pk(e)||ck(e,"token"),function(e){if("string"!=typeof e||!/^[a-zA-Z0-9@._\-]{1,128}$/.test(e))throw new lP(aP.INVALID_PARAMS,"The RoomId must be within 128 bytes. The supported characters: a-z,A-Z,0-9,@,-,_,.")}(t),function(e){dk(e,"userInfo"),_k(e.userId),pk(e.extraInfo)||ck(e.extraInfo,"userInfo.extraInfo",1,200)}(i),n={isAutoPublish:!0,isAutoSubscribeAudio:!0,isAutoSubscribeVideo:!0,roomProfileType:q_.communication},JG(n,r),function(e){dk(e,"roomConfig"),ak(e.isAutoPublish,"roomConfig.isAutoPublish"),ak(e.isAutoSubscribeAudio,"roomConfig.isAutoSubscribeAudio"),ak(e.isAutoSubscribeVideo,"roomConfig.isAutoSubscribeVideo")}(n),!this._room||this._room.connectionState===KB.DISCONNECTED)return[3,1];throw new lP(aP.REPEAT_JOIN,"Already joined");case 1:this._room=new vj(r,{audioProfileManager:this._audioProfileManager}),this._room.userPriorityMap=this._userPriorityMap,this._room.subscribeFallbackOption=this._subscribeFallbackOption,this._addHandlerEventHandler(),o=this._liveTranscodeConfig&&xx("started",this._liveTranscodeConfig),c.label=2;case 2:return c.trys.push([2,4,,5]),this._useCloudProxy&&(this._startCloudProxyTimestamp=Date.now()),[4,this._room.join(this._appId,t,e,Z_(Z_({},i),{businessId:this._businessId,role:this._visibility?mW.NORMAL_USER:mW.SILENT_USER}),o,this._useCloudProxy)];case 3:return a=c.sent(),this._roomConfig=r,this._tempRoomConfig&&delete this._tempRoomConfig,(null==r?void 0:r.isAutoPublish)&&(this._visibility?this._updatePublish({invokeByJoinRoom:!0,mediaType:x_.AUDIO_AND_VIDEO}):this.safeEmit(df.onAutoPublishResult,{isScreen:!1,state:k_.PUBLISH_FAIL})),[2,a];case 4:throw(s=c.sent()).code===aP.INVALID_TOKEN&&(this._tempRoomConfig=r),s;case 5:return[2]}}))}))},t.prototype.leaveRoom=function(e){var t,i;return void 0===e&&(e=!1),ef(this,void 0,void 0,(function(){return tf(this,(function(r){switch(r.label){case 0:return AW.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._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;AW.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=[Qx],this._screenStreamEncodeConfig=[Zx],this._pauseAllSubscribeState={audio:!1,video:!1},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._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()},t.prototype.publishStream=function(e){return ef(this,void 0,void 0,(function(){return tf(this,(function(t){switch(t.label){case 0:return AW.print("publishStream()","mediaType: %o",e),this._checkMediaType(e),this._assertNotInRoom(),nk(e)&&!this._localVideoTrack&&this._localImgVideoTrack&&(this._localVideoTrack=(i=this._localImgVideoTrack,new YF(i,zD())),this._localVideoTrack.dummy=!0),[4,this._updatePublish({mediaType:e})];case 1:return t.sent(),[2]}var i}))}))},t.prototype.unpublishStream=function(e){return ef(this,void 0,void 0,(function(){return tf(this,(function(t){switch(t.label){case 0:return AW.print("unpublishStream()","mediaType: %o",e),this._checkMediaType(e),this._assertNotInRoom(),[4,this._updatePublish({mediaType:e,pubState:fB.UNPUB})];case 1:return t.sent(),[2]}}))}))},t.prototype.publishScreen=function(e){return ef(this,void 0,void 0,(function(){var t;return tf(this,(function(i){switch(i.label){case 0:AW.print("publishScreen()","mediaType: %o",e),this._checkMediaType(e),this._assertNotInRoom(),i.label=1;case 1:return i.trys.push([1,3,,4]),nk(e)&&!this._localScreenVideoTrack&&this._localImgScreenTrack&&(this._localScreenVideoTrack=(r=this._localImgScreenTrack,new qF(r,zD())),this._localScreenVideoTrack.dummy=!0),[4,this._updateScreenPublish({mediaType:e,pubState:fB.PUB})];case 2:return i.sent(),[3,4];case 3:throw(t=i.sent())instanceof lP?t:new lP(aP.UNEXPECTED_ERROR,"unexpected error",t);case 4:return[2]}var r}))}))},t.prototype.unpublishScreen=function(e){return ef(this,void 0,void 0,(function(){return tf(this,(function(t){switch(t.label){case 0:return AW.print("unpublishScreen()","mediaType: %o",e),this._checkMediaType(e),this._assertNotInRoom(),[4,this._updateScreenPublish({mediaType:e,pubState:fB.UNPUB})];case 1:return t.sent(),[2]}}))}))},t.prototype.subscribeStream=function(e,t){return ef(this,void 0,void 0,(function(){return tf(this,(function(i){return AW.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 ef(this,void 0,void 0,(function(){var c,u,d,l,h;return tf(this,(function(p){switch(p.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 lP(aP.STREAM_NOT_EXIST,"stream not exist");return this._pauseAllSubscribeState.audio&&(i-=i&x_.AUDIO),this._pauseAllSubscribeState.video&&(i-=i&x_.VIDEO),AW.print("subscribeStream()","due to pauseAll mediaType: %o",i),d=u.hasSubscribed,l=this._remoteVideoConfig.get(t)||(null===(r=this._roomConfig)||void 0===r?void 0:r.remoteVideoConfig),u.originalMediaType=i,[4,this._room.subscribe(u,i,l)];case 1:return p.sent(),rk(i)&&this._updateAudioPlayerState(u),nk(i)&&this._updateVideoPlayerState(u),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)&&(h={userId:t,isScreen:!1,state:D_.SUBSCRIBE_SUCC},this.safeEmit(df.onAutoSubscribeResult,h)),!d&&rk(i)&&(null===(a=u.observer)||void 0===a||a.setSubscribeAudio(!0)),!d&&nk(i)&&(null===(s=u.observer)||void 0===s||s.setSubscribeVideo(!0)),[2]}}))}))},t.prototype.unsubscribeStream=function(e,t){return ef(this,void 0,void 0,(function(){var i,r;return tf(this,(function(n){if(AW.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 lP(aP.STREAM_NOT_EXIST,"stream not exist");return this._room.unsubscribe(r,t),[2]}))}))},t.prototype.subscribeScreen=function(e,t){return ef(this,void 0,void 0,(function(){return tf(this,(function(i){return AW.print("subscribeScreen() userId: %o, mediaType: %o",e,t),[2,this._subscribe(!0,e,t)]}))}))},t.prototype.unsubscribeScreen=function(e,t){return ef(this,void 0,void 0,(function(){var i,r;return tf(this,(function(n){if(AW.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 lP(aP.STREAM_NOT_EXIST,"stream not exist");return this._room.unsubscribe(r,t),[2]}))}))},t.prototype.setRemoteVideoConfig=function(e,t){var i;return ef(this,void 0,void 0,(function(){return tf(this,(function(r){return AW.print("setRemoteVideoConfig() userId: %o, remoteVideoConfig: %o",e,t),_k(e),function(e){if("number"!=typeof(null==e?void 0:e.width)||"number"!=typeof(null==e?void 0:e.height))throw new lP(aP.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.startVideoCapture=function(e){var t,i,r;return ef(this,void 0,void 0,(function(){var n,o,a,s,c,u,d=this;return tf(this,(function(l){switch(l.label){case 0:if(AW.print("startVideoCapture()","deviceId: %s",e),pk(e)||ck(e,"deviceId"),e=e||this._localVideoDeviceId,this._localVideoTrack&&!this._localVideoTrack.dummy)throw new lP(aP.REPEAT_CAPTURE,"Has already capture");return n=this._videoStreamConstraints,e&&("user"===e||"environment"===e||"left"===e||"right"===e?n.facingMode=e:n.deviceId={exact:e},this._videoStreamConstraints=n),[4,$F(n)];case 1:return o=l.sent(),this._initLocalTrackEvents(o),this._localVideoTrack=o,null===(t=this._videoPlayer)||void 0===t||t.playVideo(o),a={},(s=null==o?void 0:o.getTrack())&&(a=s.getSettings(),c={width:a.width,height:a.height},this._localVideoTrack.resolution=c,setTimeout((function(){return d.safeEmit(df.onLocalVideoSizeChanged,{streamIndex:L_.STREAM_INDEX_MAIN,info:c})}))),this._room?(u=this._room._roomConfig.isAutoPublish,(this._room.hasPublished||u)&&(this._visibility?this._updatePublish():this.safeEmit(df.onAutoPublishResult,{isScreen:!1,state:k_.PUBLISH_FAIL})),null===(r=null===(i=this._room.localStream)||void 0===i?void 0:i.observer)||void 0===r||r.setEnableVideo(!0),[2,a]):[2,a]}}))}))},t.prototype.stopVideoCapture=function(){var e,t,i,r,n;return ef(this,void 0,void 0,(function(){return tf(this,(function(o){switch(o.label){case 0:if(AW.print("stopVideoCapture()"),this._trackSourceType.video===C_.VIDEO_SOURCE_TYPE_EXTERNAL)throw new lP(aP.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 ef(this,void 0,void 0,(function(){var r,n,o;return tf(this,(function(a){switch(a.label){case 0:if(AW.print("startAudioCapture()","deviceId: $o",e),pk(e)||ck(e,"deviceId"),e=e||this._localAudioDeviceId,this._localAudioTrack)throw new lP(aP.REPEAT_CAPTURE,"Has already capture");return r=this._audioStreamConstraints,e&&(r.deviceId={exact:e},this._audioStreamConstraints=r),[4,eB(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(df.onAutoPublishResult,{isScreen:!1,state:k_.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 ef(this,void 0,void 0,(function(){return tf(this,(function(r){switch(r.label){case 0:if(AW.print("stopAudioCapture()"),null===(e=this._localAudioTrack)||void 0===e||e.close(),this._localAudioTrack=void 0,this._audioMixingManager.stopAll(),this._trackSourceType.audio===O_.AUDIO_SOURCE_TYPE_EXTERNAL)throw new lP(aP.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 AW.print("getAudioMixingManager()"),this._audioMixingManager},t.prototype.startScreenCapture=function(e){var t,i,r,n,o;return void 0===e&&(e={}),ef(this,void 0,void 0,(function(){var a,s,c,u,d,l,h,p=this;return tf(this,(function(_){switch(_.label){case 0:if(AW.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,a=e.enableAudio,s=void 0!==a&&a,this._trackSourceType.screenVideo===C_.VIDEO_SOURCE_TYPE_EXTERNAL)throw new lP(aP.STREAM_TYPE_NOT_MATCH,"setVideoSourceType as internal first");if(this._trackSourceType.screenAudio===O_.AUDIO_SOURCE_TYPE_EXTERNAL)throw new lP(aP.STREAM_TYPE_NOT_MATCH,"setAudioSourceType as internal first");return[4,tB(s,this._screenStreamEncodeConfig[0])];case 1:return c=_.sent(),this._localScreenVideoTrack=new qF(c.getVideoTracks()[0],zD()),(u=null===(r=this._localScreenVideoTrack)||void 0===r?void 0:r.getTrack())&&(d=u.getSettings(),l={width:d.width,height:d.height},this._localScreenVideoTrack.resolution=l,setTimeout((function(){return p.safeEmit(df.onLocalVideoSizeChanged,{streamIndex:L_.STREAM_INDEX_SCREEN,info:{width:d.width,height:d.height}})}))),(h=c.getAudioTracks()).length&&(this._localScreenAudioTrack=new JF(h[0],zD()),this._initLocalTrackEvents(this._localScreenAudioTrack)),null===(n=this._screenPlayer)||void 0===n||n.playVideo(this._localScreenVideoTrack),this._initLocalTrackEvents(this._localScreenVideoTrack),(null===(o=this._room)||void 0===o?void 0:o.hasScreenPublished)?[4,this._updateScreenPublish()]:[3,3];case 2:_.sent(),_.label=3;case 3:return[2]}}))}))},t.prototype.stopScreenCapture=function(){var e,t,i,r;return ef(this,void 0,void 0,(function(){return tf(this,(function(n){switch(n.label){case 0:return AW.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;if(AW.print("setLocalVideoPlayer()","streamIndex: %o, videoPlayerOption: %o",e,t),uk(e,"streamIndex",[L_.STREAM_INDEX_MAIN,L_.STREAM_INDEX_SCREEN]),t&&t.renderDom){var a=Z_({userId:this._getUserId()},t);return vk(a),e!=L_.STREAM_INDEX_MAIN||this._videoPlayer?e!=L_.STREAM_INDEX_SCREEN||this._screenPlayer?void 0:(this._screenPlayer=new Rj(Z_(Z_({},a),{isScreen:!0})),this._initPlayerEvents(this._screenPlayer),this._localScreenVideoTrack&&!this._localScreenVideoTrack.dummy&&(null===(o=this._config)||void 0===o?void 0:o.autoPlayPolicy)!==Q_.PLAY_MANUALLY&&this._screenPlayer.playVideo(this._localScreenVideoTrack),this._screenPlayer.domElement):(this._videoPlayer=new Rj(a),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)!==Q_.PLAY_MANUALLY&&this._videoPlayer.playVideo(this._localVideoTrack),this._videoPlayer.domElement)}e==L_.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 ef(this,void 0,void 0,(function(){var i;return tf(this,(function(r){switch(r.label){case 0:AW.print("startLiveTranscoding()","transcode: %o",e),ck(e.url,"liveTranscode.url"),this._liveTranscodeConfig=e,r.label=1;case 1:return r.trys.push([1,3,,4]),this.safeEmit(df.onStreamMixingEvent,{event:_B.START,error:0,message:""}),[4,null===(t=this._room)||void 0===t?void 0:t.liveControlMessage(xx("started",this._liveTranscodeConfig))];case 2:return r.sent(),[3,4];case 3:throw(i=r.sent())instanceof lP?i:new lP(aP.UNEXPECTED_ERROR,"unexpected error",i);case 4:return[2]}}))}))},t.prototype.updateLiveTranscoding=function(e){var t;return ef(this,void 0,void 0,(function(){var i;return tf(this,(function(r){switch(r.label){case 0:if(AW.print("updateLiveTranscoding()","transcode: %o",e),!this._liveTranscodeConfig)return[2];this._liveTranscodeConfig=JG(this._liveTranscodeConfig,e),r.label=1;case 1:return r.trys.push([1,3,,4]),this.safeEmit(df.onStreamMixingEvent,{event:_B.UPDATE,error:0,message:""}),[4,null===(t=this._room)||void 0===t?void 0:t.liveControlMessage(xx("layoutChanged",this._liveTranscodeConfig))];case 2:return r.sent(),[3,4];case 3:throw(i=r.sent())instanceof lP?i:new lP(aP.UNEXPECTED_ERROR,"unexpected error",i);case 4:return[2]}}))}))},t.prototype.stopLiveTranscoding=function(){var e;return ef(this,void 0,void 0,(function(){var t;return tf(this,(function(i){switch(i.label){case 0:if(AW.print("stopLiveTranscoding()"),!this._liveTranscodeConfig)return[2];delete this._liveTranscodeConfig,i.label=1;case 1:return i.trys.push([1,3,,4]),this.safeEmit(df.onStreamMixingEvent,{event:_B.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 lP?t:new lP(aP.UNEXPECTED_ERROR,"unexpected error",t);case 4:return[2]}}))}))},t.prototype.setBusinessId=function(e){return AW.print("setBusinessId()","businessId: %s",e),!function(e){return"string"!=typeof e}(e)&&!this._room&&(fx.setStats({rtc_business_id:e}),this._businessId=e,!0)},t.prototype.setUserVisibility=function(e){var t,i;return ef(this,void 0,void 0,(function(){return tf(this,(function(r){switch(r.label){case 0:if(AW.print("setUserVisibility()","enable: %o",e),e=!!e,this._visibility===e)return[2];if(!this._room)return this._visibility=e,[2];if(this._room.connectionState!==KB.CONNECTED)throw new lP(aP.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?mW.NORMAL_USER:mW.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:x_.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(df.onFirstPublicStreamAudioFrameDecoded,{publicStreamId:e.userId}):i.safeEmit(df.onAudioFirstFrameDecoded,{userId:e.userId}),hx.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(df.onFirstPublicStreamVideoFrameDecoded,c),i.safeEmit(df.onFirstPublicStreamVideoFrameRendered,c)):(i.safeEmit(df.onVideoFirstFrameDecoded,c),i.safeEmit(df.onVideoFirstFrameRendered,c)),hx.firstRemoteVideoRender("",r.userId||"")}break;case"autoplay-error":return t&&(r.publicStreamId=r.userId),void i.safeEmit(df.onAutoplayFailed,{userId:r.userId||r.publicStreamId,kind:e instanceof Rj?"video":"audio"})}i.safeEmit(df.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(df.onTrackEnded,{kind:e.getTrack().kind,isScreen:t})})),e.on("resolution-change",(function(e){i.safeEmit(df.onLocalVideoSizeChanged,{streamIndex:t?L_.STREAM_INDEX_SCREEN:L_.STREAM_INDEX_MAIN,info:e})}))},t.prototype.setRemoteVideoPlayer=function(e,t){var i,r,n,o,a,s;AW.print("setRemoteVideoPlayer()","streamIndex: %o, videoPlayerOption: %o",e,t),uk(e,"streamIndex",[L_.STREAM_INDEX_MAIN,L_.STREAM_INDEX_SCREEN]),vk(t);var c=t.userId;if(e==L_.STREAM_INDEX_MAIN){if(null===(i=this._remoteVideoPlayer.get(c))||void 0===i||i.destroy(),!t.renderDom)return;var u=new Rj(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),u.domElement}if(null===(o=this._remoteScreenPlayer.get(c))||void 0===o||o.destroy(),t.renderDom){var d;u=new Rj(Z_(Z_({},t),{isScreen:!0}));return this._remoteScreenPlayer.set(c,u),this._initPlayerEvents(u),(d=null===(s=null===(a=this._room)||void 0===a?void 0:a.remoteStreams.get(c))||void 0===s?void 0:s.find((function(e){return e.isScreen})))&&this._updateVideoPlayerState(d),u.domElement}},t.prototype.setLocalVideoMirrorType=function(e){AW.print("setLocalVideoMirrorType()","mirrorType: %o",e),uk(e,"mirrorType",[B_.MIRROR_TYPE_NONE,B_.MIRROR_TYPE_RENDER]),this._mirrorType=e,this._videoPlayer&&this._videoPlayer.mirror(!!e)},t.prototype.setAudioPlaybackDevice=function(e){return ef(this,void 0,void 0,(function(){var t;return tf(this,(function(i){switch(i.label){case 0:return AW.print("setAudioPlaybackDevice()","deviceId: %s",e),ck(e,"deviceId"),void 0===HTMLAudioElement.prototype.setSinkId?(AW.print("setAudioPlaybackDevice failed","setSinkId not supported by current browser"),[2]):[4,kF.getDeviceById(e)];case 1:if(!(t=i.sent()))throw new lP(aP.INVALID_DEVICE_ID,"audio playback device id ".concat(e," is invalid"));return this._remoteAudioPlayer.forEach((function(t){t.setPlaybackDevice(e)})),this._audioPlaybackDeviceId=e,t&&this.safeEmit(df.onAudioPlaybackDeviceChanged,t),hx.rtcAudioDevice(HL.PLAYOUT_DEVICE_SWITCH,e,0),[2]}}))}))},t.prototype.play=function(e){var t,i;return ef(this,void 0,void 0,(function(){var r,n,o;return tf(this,(function(a){switch(a.label){case 0:return AW.print("play()","userId | publicStreamId: %s",e),o=null===(i=null===(t=this._room)||void 0===t?void 0:t.remoteStreams.get(e||""))||void 0===i?void 0:i.find((function(e){return!e.isScreen})),r=this._remoteAudioPlayer.get(e||""),n=this._remoteVideoPlayer.get(e||""),r||(r=this._publicStreamAudioPlayer.get(e||"")),n||(n=this._publicStreamVideoPlayer.get(e||"")),e||!this._audioMixingManager?[3,2]:[4,this._audioMixingManager.resumeLocalPlay()];case 1:a.sent(),a.label=2;case 2:return!e&&this._videoPlayer&&(n=this._videoPlayer),n?n.played?[4,n.manuallyPlay()]:[3,4]:[3,5];case 3:return a.sent(),[3,5];case 4:o&&o.videoTrack?n.playVideo(o.videoTrack,o):!e&&this._localVideoTrack&&(n.mirror(!!this._mirrorType),n.playVideo(this._localVideoTrack)),a.label=5;case 5:return r?r.played?[4,r.manuallyPlay()]:[3,7]:[3,8];case 6:return a.sent(),[3,8];case 7:o&&o.audioTrack&&r.playAudio(o.audioTrack),a.label=8;case 8:return[2]}}))}))},t.prototype.pauseAllSubscribedStream=function(e){return ef(this,void 0,void 0,(function(){var t,i=this;return tf(this,(function(r){return AW.print("pauseAllSubscribedStream()","mediaType: %o",e),this._checkMediaType(e),this._pauseAllSubscribeState.audio&&this._pauseAllSubscribeState.video?[2,Promise.resolve()]:(t=function(){rk(e)&&(i._pauseAllSubscribeState.audio=!0),nk(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 ef(this,void 0,void 0,(function(){var t,i=this;return tf(this,(function(r){return AW.print("resumeAllSubscribedStream()","mediaType: %o",e),this._checkMediaType(e),this._pauseAllSubscribeState.audio||this._pauseAllSubscribeState.video?(t=function(){rk(e)&&(i._pauseAllSubscribeState.audio=!1),nk(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()])):[2,Promise.resolve()]}))}))},t.prototype.sendUserMessage=function(e,t){var i;return ef(this,void 0,void 0,(function(){var r,n=this;return tf(this,(function(o){if(_k(e),mk(t),!this._room||this._room.connectionState!==KB.CONNECTED)throw new lP(aP.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 ef(this,void 0,void 0,(function(){var r,n=this;return tf(this,(function(o){if(_k(e),lk(t,"message"),mk(t),!this._room||this._room.connectionState!==KB.CONNECTED)throw new lP(aP.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 ef(this,void 0,void 0,(function(){var t,i=this;return tf(this,(function(r){if(mk(e),!this._room||this._room.connectionState!==KB.CONNECTED)throw new lP(aP.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 ef(this,void 0,void 0,(function(){var t,i=this;return tf(this,(function(r){if(mk(e),!this._room||this._room.connectionState!==KB.CONNECTED)throw new lP(aP.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={}),ef(this,void 0,void 0,(function(){var i;return tf(this,(function(r){switch(r.label){case 0:return AW.print("setAudioCaptureConfig()","config: %o",e),delete e.deviceId,hk(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={}),ef(this,void 0,void 0,(function(){var i;return tf(this,(function(r){switch(r.label){case 0:return AW.print("setVideoCaptureConfig()","config: %o",e),delete e.deviceId,hk(e),i=this._videoStreamConstraints.deviceId,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 AW.print("enableSimulcastMode()","enabled: %o",e),this._enableSimulcast=e,!0},t.prototype.setVideoEncoderConfig=function(e){var t;return ef(this,void 0,void 0,(function(){return tf(this,(function(i){return AW.print("setVideoEncoderConfig()"," descriptions: %o",e),Array.isArray(e)||(e=[e]),e.length>3&&(e=e.slice(0,3)),e.sort((function(e,t){return t.maxKbps-e.maxKbps})),this._videoStreamEncodeConfig=e,(null===(t=this._room)||void 0===t?void 0:t.hasPublished)&&this._updatePublish(),[2]}))}))},t.prototype.setScreenEncoderConfig=function(e){var t;return ef(this,void 0,void 0,(function(){return tf(this,(function(i){return AW.print("setScreenEncoderConfig()","description: %o",e),this._screenStreamEncodeConfig=[e],this._localScreenVideoTrack&&(this._localScreenVideoTrack.videoCaptureConfig=e,this._localScreenVideoTrack.updateVideoCaptureConfig()),(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;AW.print("sendSEIMessage()","streamIdex: %o, message: %o, repeatCount: %o",e,t,i),uk(e,"streamIndex",[L_.STREAM_INDEX_MAIN,L_.STREAM_INDEX_SCREEN]),sk(i,"repeatCount",0,30);var u="string"==typeof t?new Uint8Array(YD.str2ab(t)):t;if(t.length){var d;if(e===L_.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)AW.print("sei size must not bigger than 4KB");else{var l=zD();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 AW.print("sei message must not be empty")},t.prototype.setAudioVolumeIndicationInterval=function(e){var t=this;AW.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(df.onAudioVolumeIndication,{speakers:i})}),e)},t.prototype.enableAudioPropertiesReport=function(e){var t=this;void 0===e&&(e={}),AW.print("enableAudioPropertiesReport()","config %o: ",e);var i=e.interval,r=void 0===i?100:i,n=e.enableInBackground,o=void 0===n||n;this._stopAudioPropertiesReport(),r<=0||(r=Math.max(100,r),this._audioPropertiesReportTimer=self.setInterval((function(){if(o||"hidden"!==document.visibilityState){var e=[],i=t._audioDeviceManager.getRecordTrack()||t._localAudioTrack;if(i){var r=i.getAudioLevel();e.push({streamIndex:L_.STREAM_INDEX_MAIN,audioPropertiesInfo:{linearVolume:r,nonlinearVolume:ik(r)}})}if(t._localScreenAudioTrack){r=t._localScreenAudioTrack.getAudioLevel();e.push({streamIndex:L_.STREAM_INDEX_SCREEN,audioPropertiesInfo:{linearVolume:r,nonlinearVolume:ik(r)}})}if(t.safeEmit(df.onLocalAudioPropertiesReport,e),t._room){var n=[];t._room.remoteStreams.forEach((function(e,i){e.forEach((function(e){var r,o;if(e.audioTrack){var a=e.audioTrack.getAudioLevel();n.push({streamKey:{userId:i,streamIndex:e.isScreen?L_.STREAM_INDEX_SCREEN:L_.STREAM_INDEX_MAIN,roomId:null===(o=null===(r=t._room)||void 0===r?void 0:r.roomInfo)||void 0===o?void 0:o.roomId},audioPropertiesInfo:{linearVolume:a,nonlinearVolume:ik(a)}})}}))})),t.safeEmit(df.onRemoteAudioPropertiesReport,n)}}}),r))},t.prototype.setVideoSourceType=function(e,t){var i,r,n,o,a,s,c,u,d,l,h,p,_,f,v,m,S;return ef(this,void 0,void 0,(function(){var y,g,E;return tf(this,(function(b){switch(b.label){case 0:return AW.print("setVideoSourceType()","index: %o, videoSourceType: %o",e,t),uk(e,"streamIndex",[L_.STREAM_INDEX_MAIN,L_.STREAM_INDEX_SCREEN]),uk(t,"VideoSourceType",[C_.VIDEO_SOURCE_TYPE_EXTERNAL,C_.VIDEO_SOURCE_TYPE_INTERNAL]),y=e===L_.STREAM_INDEX_MAIN?"video":"screenVideo",this._trackSourceType[y]===t?[3,4]:(this._trackSourceType[y]=t,AW.print("setVideoSourceType","set ".concat(y," source type to ").concat(t)),this._localVideoTrack&&e===L_.STREAM_INDEX_MAIN?(E=!1,t===C_.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===L_.STREAM_INDEX_SCREEN?(E=!1,t===C_.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===(S=this._room)||void 0===S?void 0:S.hasScreenPublished)?[4,this._updateScreenPublish()]:[3,4]):[3,4];case 3:b.sent(),b.label=4;case 4:return[2]}}))}))},t.prototype.setExternalVideoTrack=function(e,t){var i,r,n,o,a,s,c,u;return ef(this,void 0,void 0,(function(){var d;return tf(this,(function(l){switch(l.label){case 0:if(AW.print("setExternalVideoTrack()","index: %o, track: %o",e,t),uk(e,"streamIndex",[L_.STREAM_INDEX_MAIN,L_.STREAM_INDEX_SCREEN]),e!==L_.STREAM_INDEX_MAIN)return[3,2];if(this._trackSourceType.video!==C_.VIDEO_SOURCE_TYPE_EXTERNAL)throw new lP(aP.STREAM_TYPE_NOT_MATCH,"setVideoSourceType as external first");return this._localVideoTrack=new QF(t,zD()),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!==L_.STREAM_INDEX_SCREEN)return[3,4];if(this._trackSourceType.screenVideo!==C_.VIDEO_SOURCE_TYPE_EXTERNAL)throw new lP(aP.STREAM_TYPE_NOT_MATCH,"setVideoSourceType as external first");return this._localScreenVideoTrack=new QF(t,zD()),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 ef(this,void 0,void 0,(function(){var m,S,y;return tf(this,(function(g){switch(g.label){case 0:return AW.print("setAudioSourceType()","index: %o, audioSourceType: %o",e,t),uk(e,"streamIndex",[L_.STREAM_INDEX_MAIN,L_.STREAM_INDEX_SCREEN]),uk(t,"audioSourceType",[O_.AUDIO_SOURCE_TYPE_EXTERNAL,O_.AUDIO_SOURCE_TYPE_INTERNAL]),m=e===L_.STREAM_INDEX_MAIN?"audio":"screenAudio",this._trackSourceType[m]===t?[3,4]:(this._trackSourceType[m]=t,AW.print("setVideoSourceType","set ".concat(m," source type to ").concat(t)),this._localAudioTrack&&e===L_.STREAM_INDEX_MAIN?(y=!1,this._trackSourceType.audio===O_.AUDIO_SOURCE_TYPE_EXTERNAL&&(y=!0,this._localAudioTrack.close()),this._localAudioTrack=void 0,S=null===(i=this._room)||void 0===i?void 0:i._roomConfig.isAutoPublish,y?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)||S?[4,this._updatePublish()]:[3,2]):[3,2]);case 1:g.sent(),g.label=2;case 2:return this._localScreenAudioTrack&&e===L_.STREAM_INDEX_SCREEN?(y=!1,this._trackSourceType.audio===O_.AUDIO_SOURCE_TYPE_EXTERNAL&&(y=!0,this._localScreenAudioTrack.close()),this._localScreenAudioTrack=void 0,y?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 ef(this,void 0,void 0,(function(){var l;return tf(this,(function(h){switch(h.label){case 0:if(AW.print("setExternalAudioTrack()","index: %o, track: %o",e,t),uk(e,"streamIndex",[L_.STREAM_INDEX_MAIN,L_.STREAM_INDEX_SCREEN]),e!==L_.STREAM_INDEX_MAIN)return[3,2];if(this._trackSourceType.audio!==O_.AUDIO_SOURCE_TYPE_EXTERNAL)throw new lP(aP.STREAM_TYPE_NOT_MATCH,"setAudioSourceType as external first");return this._localAudioTrack=new ZF(t,zD()),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!==L_.STREAM_INDEX_SCREEN)return[3,4];if(this._trackSourceType.screenAudio!==O_.AUDIO_SOURCE_TYPE_EXTERNAL)throw new lP(aP.STREAM_TYPE_NOT_MATCH,"setAudioSourceType as external first");return this._localScreenAudioTrack=new ZF(t,zD()),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 ef(this,void 0,void 0,(function(){return tf(this,(function(i){return AW.print("login()","token: %o, userInfo: %o",e,t),pk(e)||ck(e,"token"),_k(t),[2,this._rtmClient.login(e,t)]}))}))},t.prototype.logout=function(){return ef(this,void 0,void 0,(function(){return tf(this,(function(e){return AW.print("logout()"),[2,this._rtmClient.logout()]}))}))},t.prototype.updateLoginToken=function(e){return ef(this,void 0,void 0,(function(){return tf(this,(function(t){return AW.print("updateLoginToken()","token: %o",e),pk(e)||ck(e,"token"),[2,this._rtmClient.updateLoginToken(e)]}))}))},t.prototype.getPeerOnlineStatus=function(e){return ef(this,void 0,void 0,(function(){return tf(this,(function(t){return AW.print("getPeerOnlineStatus()","userId: %o",e),_k(e),[2,this._rtmClient.getPeerOnlineStatus(e)]}))}))},t.prototype.sendUserMessageOutsideRoom=function(e,t){return ef(this,void 0,void 0,(function(){var i,r=this;return tf(this,(function(n){_k(e),mk(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 ef(this,void 0,void 0,(function(){var i,r=this;return tf(this,(function(n){_k(e),lk(t,"message"),mk(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 ef(this,void 0,void 0,(function(){return tf(this,(function(i){return AW.print("setServerParams()","signature: %o, url: %0",e,t),ck(e,"signature"),ck(t,"url"),[2,this._rtmClient.setServerParams(e,t)]}))}))},t.prototype.sendServerMessage=function(e){return ef(this,void 0,void 0,(function(){var t,i=this;return tf(this,(function(r){ck(e,"message"),mk(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 ef(this,void 0,void 0,(function(){var t,i=this;return tf(this,(function(r){lk(e,"message"),mk(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 lP(aP.START_CLOUD_PROXY_AFTER_JOIN,"[startCloudProxy] should be invoke before join room ");var t;AW.print("startCloudProxy()",e),ck(e.logProxy,"logProxy"),ck(e.accessProxy,"accessProxy"),ck(e.configProxy,"configProxy"),this._originIceConfigRequestUrls=Lx("ICE_CONFIG_REQUEST_URLS"),this._originLogServerUrl=Lx("LOG_SERVER_URL"),this._originConfigServerUrls=Lx("CONFIG_REQUEST_DOMAINS"),Ux("ICE_CONFIG_REQUEST_URLS",e.accessProxy),Ux("LOG_SERVER_URL",(void 0===(t=e.logProxy)&&(t=""),"https://".concat(t,"/video/v1/webrtc_log/"))),Ux("CONFIG_REQUEST_DOMAINS",[e.configProxy]),this._useCloudProxy=!0},t.prototype.stopCloudProxy=function(){if(this._room)throw new lP(aP.STOP_CLOUD_PROXY_BEFORE_LEAVE,"[stopCloudProxy] should be invoke after leave room ");AW.print("stopCloudProxy()"),Ux("ICE_CONFIG_REQUEST_URLS",[]),Ux("LOG_SERVER_URL",this._originLogServerUrl),Ux("CONFIG_REQUEST_DOMAINS",this._originConfigServerUrls),this._useCloudProxy=!1,this._startCloudProxyTimestamp=void 0},t.prototype.startPushPublicStream=function(e,t){return ef(this,void 0,void 0,(function(){var i,r=this;return tf(this,(function(n){if(AW.print("startPushPublicStream()","publicStreamId: %o, publicStreamParam: %o",e,t),fk(e),!this._room||this._room.connectionState!==KB.CONNECTED)throw new lP(aP.START_PUBLIC_STREAM_BEFORE_JOIN,"join first");if(this._publicStreamIds.get(e))throw new lP(aP.REPEAT_PUSH,"repeat push public media stream");return i=Vx(e,"started",t),[2,this._room.publicStreamControlMessage(i).then((function(){r._publicStreamIds.set(e,e)}))]}))}))},t.prototype.updatePublicStreamParam=function(e,t){return ef(this,void 0,void 0,(function(){var i;return tf(this,(function(r){if(AW.print("startPushPublicStream()","publicStreamId: %o, publicStreamParam: %o",e,t),fk(e),!this._room||this._room.connectionState!==KB.CONNECTED)throw new lP(aP.START_PUBLIC_STREAM_BEFORE_JOIN,"join first");return i=Vx(e,"layoutChanged",t),[2,this._room.publicStreamControlMessage(i)]}))}))},t.prototype.stopPushPublicStream=function(e){return ef(this,void 0,void 0,(function(){var t=this;return tf(this,(function(i){if(AW.print("startPushPublicStream()","publicStreamId: %o",e),fk(e),!this._room||this._room.connectionState!==KB.CONNECTED)throw new lP(aP.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;return ef(this,void 0,void 0,(function(){var n,o,a,s=this;return tf(this,(function(c){switch(c.label){case 0:return fk(e),this._outsideRoom?[3,2]:(this._outsideRoom=new bW(this._appId),this._outsideRoom.on(hB.RESUBSCRIBE,(function(e){var t,i,r=e.stream;if(r){var n=s._publicStreamAudioPlayer.get(r.streamId);n&&r.audioTrack&&(n.stop(),n.playAudio(null===(t=e.stream)||void 0===t?void 0:t.audioTrack));var o=s._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,s.safeEmit(df.onPublicStreamStats,e)})),null===(i=this._outsideRoom)||void 0===i||i.on(hB.ON_SEI_MESSAGED_RECEIVED,(function(e){s.safeEmit(df.onPublicStreamSEIMessageReceived,e)})),[4,this._outsideRoom.connect()]);case 1:c.sent(),c.label=2;case 2:return[4,this._outsideRoom.startPlayPublicStream(e)];case 3:return n=c.sent(),(o=this._publicStreamVideoPlayer.get(e))&&(null==n?void 0:n.videoTrack)&&o.playVideo(n.videoTrack,n),!(a=this._publicStreamAudioPlayer.get(e))&&(null==n?void 0:n.audioTrack)&&(a=new Aj(e,{muted:(null===(r=this._config)||void 0===r?void 0:r.autoPlayPolicy)===Q_.VIDEO_ONLY}),this._initPlayerEvents(a,!0),a.playAudio(n.audioTrack),this._publicStreamAudioPlayer.set(e,a)),[2]}}))}))},t.prototype.stopPlayPublicStream=function(e){return ef(this,void 0,void 0,(function(){var t;return tf(this,(function(i){return this._outsideRoom?(this._outsideRoom.stopPlayPublicStream(e),(t=this._publicStreamAudioPlayer.get(e))&&(t.destroy(),this._publicStreamAudioPlayer.delete(e)),[2]):[2]}))}))},t.prototype.setAudioProfile=function(e){return ef(this,void 0,void 0,(function(){return tf(this,(function(t){return this._audioProfileManager.setAudioProfile(e),[2]}))}))},t.prototype.setPublicStreamVideoPlayer=function(e,t){var i,r,n;AW.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 Rj(Z_(Z_({},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)!==Q_.PLAY_MANUALLY&&o.playVideo(a.videoTrack,a)}},t.prototype.setDummyCaptureImagePath=function(e,t){return ef(this,void 0,void 0,(function(){var i=this;return tf(this,(function(r){return[2,new Promise((function(r,n){ck(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 lP(aP.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===L_.STREAM_INDEX_MAIN?i._localImgVideoTrack=s:i._localImgScreenTrack=s,r()}catch(e){n(new lP(aP.UNEXPECTED_ERROR,e.message))}},o.onerror=function(){n(new lP(aP.UNEXPECTED_ERROR,"Load image error"))}}))]}))}))},t.prototype.defaultTranscoding=function(){return JSON.parse(JSON.stringify(Jx))},t.prototype._updatePublish=function(e){return void 0===e&&(e={}),ef(this,void 0,void 0,(function(){var t,i,r;return tf(this,(function(n){switch(n.label){case 0:if(AW.print("_updatePublish()","config: %o",e),t={mediaType:void 0,invokeByJoinRoom:!1,pubState:fB.PUB},e=Z_(Z_({},t),e),!this._visibility)throw new lP(aP.NO_PUBLISH_PERMISSION,"no publish permission");return[4,this._pubLock.lock()];case 1:if(i=n.sent(),!this._room||this._room.connectionState!==KB.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(),[3,6];case 4:throw(r=n.sent())instanceof lP?r:new lP(aP.UNEXPECTED_ERROR,"unexpected error",r);case 5:return i(),[7];case 6:return[2]}}))}))},t.prototype.startAudioPlaybackDeviceTest=function(e,t){return ef(this,void 0,void 0,(function(){return tf(this,(function(i){switch(i.label){case 0:return AW.print("startAudioPlaybackDeviceTest()","filePath: %o, indicationInterval: %o",e,t),ck(e,"filePath"),sk(t,"indicationInterval"),[4,this._audioDeviceManager.startAudioPlaybackDeviceTest(e,t)];case 1:return[2,i.sent()]}}))}))},t.prototype.stopAudioPlaybackDeviceTest=function(){AW.print("stopAudioPlaybackDeviceTest()"),this._audioDeviceManager.stopAudioPlaybackDeviceTest()},t.prototype.startAudioDeviceRecordTest=function(e){return ef(this,void 0,void 0,(function(){return tf(this,(function(t){switch(t.label){case 0:return AW.print("startAudioDeviceRecordTest()","indicationInterval: %o",e),sk(e,"indicationInterval"),[4,this._audioDeviceManager.startAudioDeviceRecordTest(e)];case 1:return t.sent(),[2]}}))}))},t.prototype.stopAudioDeviceRecordAndPlayTest=function(){AW.print("stopAudioDeviceRecordAndPlayTest()"),this._audioDeviceManager.stopAudioDeviceRecordAndPlayTest()},t.prototype.stopAudioDevicePlayTest=function(){AW.print("stopAudioDevicePlayTest()"),this._audioDeviceManager.stopAudioDevicePlayTest()},t.prototype.setRemoteUserPriority=function(e,t){var i;AW.print("setRemoteUserPriority()","userId: %o, priority: %o",e,t);try{_k(e),uk(t,"priority",[W_.HIGH,W_.MEDIUM,W_.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){AW.print("setSubscribeFallbackOption()","option: %o",e);try{uk(e,"option",[K_.DISABLE,K_.VIDEO_STREAM_LOW,K_.AUDIO_ONLY])}catch(e){return console.warn(e),!1}return!this._room&&(this._subscribeFallbackOption=e,!0)},t.prototype._updateScreenPublish=function(e){return void 0===e&&(e={}),ef(this,void 0,void 0,(function(){var t,i,r;return tf(this,(function(n){switch(n.label){case 0:return AW.print("_updateScreenPublish()"),t={mediaType:void 0,pubState:fB.PUB},e=Z_(Z_({},t),e),[4,this._pubLock.lock()];case 1:if(i=n.sent(),!this._room||this._room.connectionState!==KB.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(),[3,6];case 4:throw(r=n.sent())instanceof lP?r:new lP(aP.UNEXPECTED_ERROR,"unexpected error",r);case 5:return i(),[7];case 6:return[2]}}))}))},t.prototype._updateAudioPlayerState=function(e){var t,i;AW.print("_updateAudioPlayerState()");var r,n=e.userId,o=e.isScreen;if(r=o?this._remoteAudioPlayer.get("".concat(n,"_screen")):this._remoteAudioPlayer.get(n),e.audioTrack){if(!r){var a=o?"".concat(n,"_screen"):n;r=new Aj(a,{muted:(null===(t=this._config)||void 0===t?void 0:t.autoPlayPolicy)===Q_.VIDEO_ONLY}),this._initPlayerEvents(r),this._remoteAudioPlayer.set(a,r),this._audioPlaybackDeviceId&&r.setPlaybackDevice(this._audioPlaybackDeviceId)}(null===(i=this._config)||void 0===i?void 0:i.autoPlayPolicy)!==Q_.PLAY_MANUALLY&&r.playAudio(e.audioTrack)}else null==r||r.stop()},t.prototype._updateVideoPlayerState=function(e){var t;AW.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)!==Q_.PLAY_MANUALLY&&i.playVideo(e.videoTrack,e):(null==i?void 0:i.played)&&(null==i||i.stop())},t.prototype._onAddStream=function(e){var t=e.stream,i=null==t?void 0:t.attributes,r=i.localaudio,n=i.audiostream,o=i.localvideo,a=i.videostream,s=PF.NONE;n&&(s|=x_.AUDIO),a&&(s|=x_.VIDEO),s&&((null==t?void 0:t.isScreen)?this.safeEmit(df.onUserPublishScreen,{userId:t.userId,mediaType:s}):(this.safeEmit(df.onUserPublishStream,{userId:t.userId,mediaType:s}),this._handleAutoSubscribe(t,!0)),(null==t?void 0:t.isScreen)||(r&&this.safeEmit(df.onUserStartAudioCapture,{userId:t.userId}),o&&this.safeEmit(df.onUserStartVideoCapture,{userId:t.userId})))},t.prototype._handleAutoSubscribe=function(e,t){var i,r,n,o,a=PF.NONE;(null===(i=this._roomConfig)||void 0===i?void 0:i.isAutoSubscribeAudio)&&(a|=x_.AUDIO),(null===(r=this._roomConfig)||void 0===r?void 0:r.isAutoSubscribeVideo)&&(a|=x_.VIDEO),AW.print("_onAddStream","autoSubType: ".concat(a)),a&&(t&&rk(a)&&(null===(n=e.observer)||void 0===n||n.setAutoSubscribeAudio(!0)),t&&nk(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=OW[e.reason])&&void 0!==t?t:V_.STREAM_REMOVE_REASON_OTHER,o=r.isScreen?df.onUserUnpublishScreen:df.onUserUnpublishStream,a=x_.AUDIO_AND_VIDEO;(null==r?void 0:r._workaround_1_)&&(a=x_.VIDEO),this.safeEmit(o,{userId:r.userId,mediaType:a,reason:n}),this._getRemotePlayer(r.userId,r.isScreen).forEach((function(e){if(!(null==r?void 0:r._workaround_1_)){var t=r.isScreen?"".concat(r.userId,"_screen"):r.userId;i._remoteAudioPlayer.delete(t),r.isScreen?i._remoteScreenPlayer.delete(r.userId):i._remoteVideoPlayer.delete(r.userId),null==e||e.destroy()}}))},t.prototype._onUserConnection=function(e){this.safeEmit(df.onUserJoined,e)},t.prototype._onUserLeave=function(e){this.safeEmit(df.onUserLeave,e)},t.prototype._onRoomError=function(e){var t;this.safeEmit(df.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,of([df.onNetworkQuality],nf(e),!1))},t.prototype._onConnectionStateChange=function(e){void 0!==this._startCloudProxyTimestamp&&this._useCloudProxy&&e.state===F_.CONNECTION_STATE_CONNECTED&&this.safeEmit(df.onCloudProxyConnected,{interval:Date.now()-this._startCloudProxyTimestamp}),this.safeEmit(df.onConnectionStateChanged,e)},t.prototype._getRemotePlayer=function(e,t){return[this._remoteAudioPlayer.get(t?"".concat(e,"_screen"):e),(t?this._remoteScreenPlayer:this._remoteVideoPlayer).get(e)]},t.prototype._stopAudioPropertiesReport=function(){null!==this._audioPropertiesReportTimer&&(clearInterval(this._audioPropertiesReportTimer),this._audioPropertiesReportTimer=null)},t.prototype._onResubscribe=function(e){e.stream&&(this._getRemotePlayer(e.stream.userId,e.stream.isScreen).forEach((function(e){return null==e?void 0:e.stop()})),this._updateAudioPlayerState(e.stream),this._updateVideoPlayerState(e.stream))},t.prototype._onSubscribePushTrack=function(e){e.stream&&this._updateAudioPlayerState(e.stream)},t.prototype._onRemovePushTrack=function(e){e.stream&&this._updateAudioPlayerState(e.stream)},t.prototype._onVideoFirstFrameDecoded=function(e){this.safeEmit(df.onVideoFirstFrameDecoded,e)},t.prototype._onVideoDeviceStateChange=function(e){this.safeEmit(df.onVideoDeviceStateChanged,e)},t.prototype._onAudioDeviceStateChange=function(e){this.safeEmit(df.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};i?n===fB.PUB?this.safeEmit(df.onUserPublishScreen,a):this.safeEmit(df.onUserUnpublishScreen,Z_(Z_({},a),{reason:V_.STREAM_REMOVE_REASON_UNPUBLISH})):n===fB.PUB?(this.safeEmit(df.onUserPublishStream,a),this._handleAutoSubscribe(o,!0)):this.safeEmit(df.onUserUnpublishStream,Z_(Z_({},a),{reason:V_.STREAM_REMOVE_REASON_UNPUBLISH}))},t.prototype._onCustomMessage=function(e){var t=e.message;e.binary?this.safeEmit(df.onRoomBinaryMessageReceived,{userId:e.clientId,message:t}):this.safeEmit(df.onRoomMessageReceived,{userId:e.clientId,message:t})},t.prototype._onUserMessageReceived=function(e){this._messageStatisticsObserver.recvP2PMessage(e.userId),this.safeEmit(df.onUserMessageReceived,e)},t.prototype._onUserBinaryMessageReceived=function(e){this._messageStatisticsObserver.recvP2PMessage(e.userId),this.safeEmit(df.onUserBinaryMessageReceived,e)},t.prototype._onLiveTranscodingResult=function(e){this.safeEmit(df.onLiveTranscodingResult,e)},t.prototype._onStreamMixingEvent=function(e){this.safeEmit(df.onStreamMixingEvent,e)},t.prototype._onUserTokenWillExpire=function(){this.safeEmit(df.onTokenWillExpire)},t.prototype._onPushPublicStreamResult=function(e){this.safeEmit(df.onPushPublicStreamResult,e)},t.prototype._handleRTMClient=function(e){var t=this;e.on("onUserMessageReceivedOutsideRoom",(function(e){t._messageStatisticsObserver.recvP2POutRoomMessage(e.userId),t.safeEmit(df.onUserMessageReceivedOutsideRoom,e)})),e.on("onUserBinaryMessageReceivedOutsideRoom",(function(e){t._messageStatisticsObserver.recvP2POutRoomMessage(e.userId),t.safeEmit(df.onUserBinaryMessageReceivedOutsideRoom,e)})),e.on("onUserDisconnection",(function(){t.safeEmit(df.onError,{errorCode:aP.RTM_DUPLICATE_LOGIN})})),e.on("onRTMTokenError",(function(){t.safeEmit(df.onError,{errorCode:aP.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(df.onAudioPlaybackDeviceTestVolume,t)}))},t.prototype._assertNotInRoom=function(){if(!this._room||this._room.connectionState!==KB.CONNECTED)throw new lP(aP.INVOKED_BEFORE_JOIN_ROOM,"join first")},t.prototype._checkMediaType=function(e){uk(e,"mediaType",[x_.AUDIO,x_.VIDEO,x_.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"},$_([yx()],t.prototype,"updateToken",null),$_([yx()],t.prototype,"setVideoCaptureDevice",null),$_([yx()],t.prototype,"setAudioCaptureDevice",null),$_([yx()],t.prototype,"joinRoom",null),$_([yx()],t.prototype,"leaveRoom",null),$_([yx()],t.prototype,"destroy",null),$_([yx()],t.prototype,"publishStream",null),$_([yx()],t.prototype,"unpublishStream",null),$_([yx()],t.prototype,"publishScreen",null),$_([yx()],t.prototype,"unpublishScreen",null),$_([yx()],t.prototype,"subscribeStream",null),$_([yx()],t.prototype,"unsubscribeStream",null),$_([yx()],t.prototype,"subscribeScreen",null),$_([yx()],t.prototype,"unsubscribeScreen",null),$_([yx()],t.prototype,"setRemoteVideoConfig",null),$_([yx()],t.prototype,"startVideoCapture",null),$_([yx()],t.prototype,"stopVideoCapture",null),$_([yx()],t.prototype,"startAudioCapture",null),$_([yx()],t.prototype,"stopAudioCapture",null),$_([yx()],t.prototype,"getAudioMixingManager",null),$_([yx()],t.prototype,"startScreenCapture",null),$_([yx()],t.prototype,"stopScreenCapture",null),$_([yx()],t.prototype,"setLocalVideoPlayer",null),$_([yx()],t.prototype,"startLiveTranscoding",null),$_([yx()],t.prototype,"updateLiveTranscoding",null),$_([yx()],t.prototype,"stopLiveTranscoding",null),$_([yx()],t.prototype,"setBusinessId",null),$_([yx()],t.prototype,"setUserVisibility",null),$_([yx()],t.prototype,"setRemoteVideoPlayer",null),$_([yx()],t.prototype,"setLocalVideoMirrorType",null),$_([yx()],t.prototype,"setAudioPlaybackDevice",null),$_([yx()],t.prototype,"play",null),$_([yx()],t.prototype,"pauseAllSubscribedStream",null),$_([yx()],t.prototype,"resumeAllSubscribedStream",null),$_([yx()],t.prototype,"sendUserMessage",null),$_([yx()],t.prototype,"sendUserBinaryMessage",null),$_([yx()],t.prototype,"sendRoomMessage",null),$_([yx()],t.prototype,"sendRoomBinaryMessage",null),$_([yx()],t.prototype,"setAudioCaptureConfig",null),$_([yx()],t.prototype,"setVideoCaptureConfig",null),$_([yx()],t.prototype,"enableSimulcastMode",null),$_([yx()],t.prototype,"setVideoEncoderConfig",null),$_([yx()],t.prototype,"setScreenEncoderConfig",null),$_([yx()],t.prototype,"sendSEIMessage",null),$_([yx()],t.prototype,"setAudioVolumeIndicationInterval",null),$_([yx()],t.prototype,"enableAudioPropertiesReport",null),$_([yx()],t.prototype,"setVideoSourceType",null),$_([yx()],t.prototype,"setExternalVideoTrack",null),$_([yx()],t.prototype,"setAudioSourceType",null),$_([yx()],t.prototype,"setExternalAudioTrack",null),$_([yx("rtm")],t.prototype,"login",null),$_([yx("rtm")],t.prototype,"logout",null),$_([yx("rtm")],t.prototype,"updateLoginToken",null),$_([yx("rtm")],t.prototype,"getPeerOnlineStatus",null),$_([yx("rtm")],t.prototype,"sendUserMessageOutsideRoom",null),$_([yx("rtm")],t.prototype,"sendUserBinaryMessageOutsideRoom",null),$_([yx("rtm")],t.prototype,"setServerParams",null),$_([yx("rtm")],t.prototype,"sendServerMessage",null),$_([yx("rtm")],t.prototype,"sendServerBinaryMessage",null),$_([yx()],t.prototype,"startCloudProxy",null),$_([yx()],t.prototype,"stopCloudProxy",null),$_([yx()],t.prototype,"startPushPublicStream",null),$_([yx()],t.prototype,"updatePublicStreamParam",null),$_([yx()],t.prototype,"stopPushPublicStream",null),$_([yx("outsideRoom")],t.prototype,"startPlayPublicStream",null),$_([yx("outsideRoom")],t.prototype,"stopPlayPublicStream",null),$_([yx()],t.prototype,"setAudioProfile",null),$_([yx("outsideRoom")],t.prototype,"setPublicStreamVideoPlayer",null),$_([yx()],t.prototype,"setDummyCaptureImagePath",null),$_([yx()],t.prototype,"startAudioPlaybackDeviceTest",null),$_([yx()],t.prototype,"stopAudioPlaybackDeviceTest",null),$_([yx()],t.prototype,"startAudioDeviceRecordTest",null),$_([yx()],t.prototype,"stopAudioDeviceRecordAndPlayTest",null),$_([yx()],t.prototype,"stopAudioDevicePlayTest",null),$_([yx()],t.prototype,"setRemoteUserPriority",null),$_([yx()],t.prototype,"setSubscribeFallbackOption",null),t}(Ak),OW={"client unpublished":V_.STREAM_REMOVE_REASON_UNPUBLISH,"publish failed":V_.STREAM_REMOVE_REASON_PUBLISH_FAILED,"stream removed":V_.STREAM_REMOVE_REASON_KEEP_LIVE_FAILED,"client disconnected":V_.STREAM_REMOVE_REASON_CLIENT_DISCONNECTED,"client republish":V_.STREAM_REMOVE_REASON_REPUBLISH},wW=new Ik("VERTC",0);[fx,vx,mx].forEach((function(e){return e.setStats({rtc_sdk_version:$x.VERSION,product_line:mL.RTC,report_version:SL.W_5,os:yL.WEB,device_id:wx.getDeviceId(),user_agent:XD()?"":null===navigator||void 0===navigator?void 0:navigator.userAgent})}));var NW=function(e,t){return wW.print("createEngine","Invoke VERTC.createEngine"),ck(e,"appId"),[fx,vx,mx].forEach((function(i){return i.setStats({rtc_app_id:e,auto_play_policy:null==t?void 0:t.autoPlayPolicy})})),hx.sdkInitEngine(Date.now(),qL.BEGIN),new CW(e,t)},PW=function(e){if(wW.print("destroyEngine","Invoke VERTC.destroyEngine"),!(e instanceof CW))throw new lP(aP.INVALID_ENGINE,"Invalid engine object");e.destroy(),hx.sdkInitEngine(Date.now(),qL.END)},DW=function(){return ef(void 0,void 0,void 0,(function(){return tf(this,(function(e){return[2,kF.enumerateDevices()]}))}))},kW=function(e){return void 0===e&&(e={video:!0,audio:!0}),ef(void 0,void 0,void 0,(function(){var t,i,r,n,o;return tf(this,(function(a){switch(a.label){case 0:if(t=e.video,i=e.audio,r={video:!1,audio:!1},!t)return[3,4];a.label=1;case 1:return a.trys.push([1,3,,4]),n=r,[4,kF.getVideoPermission()];case 2:return n.video=a.sent(),[3,4];case 3:return a.sent(),[3,4];case 4:if(!i)return[3,8];a.label=5;case 5:return a.trys.push([5,7,,8]),o=r,[4,kF.getAudioPermission()];case 6:return o.audio=a.sent(),[3,8];case 7:return a.sent(),[3,8];case 8:return[2,r]}}))}))},MW=function(){return ef(void 0,void 0,void 0,(function(){return tf(this,(function(e){return[2,kF.enumerateAudioCaptureDevices()]}))}))},UW=function(){return ef(void 0,void 0,void 0,(function(){return tf(this,(function(e){return[2,kF.enumerateVideoCaptureDevices()]}))}))},LW=function(){return ef(void 0,void 0,void 0,(function(){return tf(this,(function(e){return[2,kF.enumerateAudioPlaybackDevices()]}))}))},xW=function(){return $x.VERSION},VW=function(){return hx.rtcSdkApiCall("isSupported",0,""),ef(void 0,void 0,void 0,(function(){var e;return tf(this,(function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),!XD()&&window.RTCPeerConnection&&window.RTCPeerConnection.prototype.addTransceiver&&window.RTCPeerConnection.prototype.createDataChannel?[4,IV()]:[2,!1];case 1:return[2,null==(e=t.sent())?void 0:e.includes("H264")];case 2:return t.sent(),[2,!1];case 3:return[2]}}))}))},FW=function(){return hx.rtcSdkApiCall("getSupportedCodecs",0,""),ef(void 0,void 0,void 0,(function(){return tf(this,(function(e){switch(e.label){case 0:return[4,IV()];case 1:return[2,e.sent().map((function(e){return e.toUpperCase()}))]}}))}))};!XD()&&location.search.includes("_rtc_autotest_");var BW=new function(){this.getSdkVersion=xW,this.createEngine=NW,this.destroyEngine=PW,this.enumerateDevices=DW,this.enableDevices=kW,this.enumerateAudioCaptureDevices=MW,this.enumerateVideoCaptureDevices=UW,this.enumerateAudioPlaybackDevices=LW,this.getParameter=Lx,this.setParameter=Ux,this.isSupported=VW,this.getSupportedCodecs=FW,this.events=df,this.ErrorCode=aP,this.platform="BytePlus",this._monitor=hx};return Z_(Z_(Z_(Z_({},BW),uf),hf),{events:df})}));
6
+ !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).BytePlusRTC=t()}(this,(function(){"use strict";function e(e,t){return t.forEach((function(t){t&&"string"!=typeof t&&!Array.isArray(t)&&Object.keys(t).forEach((function(r){if("default"!==r&&!(r in e)){var n=Object.getOwnPropertyDescriptor(t,r);Object.defineProperty(e,r,n.get?n:{enumerable:!0,get:function(){return t[r]}})}}))})),Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}function t(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function r(e){for(var r=1;r<arguments.length;r++){var n=null!=arguments[r]?arguments[r]:{};r%2?t(Object(n),!0).forEach((function(t){c(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):t(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function n(e){return n="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},n(e)}function i(e,t,r,n,i,o,a){try{var s=e[o](a),u=s.value}catch(c){return void r(c)}s.done?t(u):Promise.resolve(u).then(n,i)}function o(e){return function(){var t=this,r=arguments;return new Promise((function(n,o){var a=e.apply(t,r);function s(e){i(a,n,o,s,u,"next",e)}function u(e){i(a,n,o,s,u,"throw",e)}s(void 0)}))}}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function s(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function u(e,t,r){return t&&s(e.prototype,t),r&&s(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function c(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function d(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&h(e,t)}function l(e){return l=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},l(e)}function h(e,t){return h=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},h(e,t)}function f(e,t){if(null==e)return{};var r,n,i=function(e,t){if(null==e)return{};var r,n,i={},o=Object.keys(e);for(n=0;n<o.length;n++)r=o[n],t.indexOf(r)>=0||(i[r]=e[r]);return i}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n<o.length;n++)r=o[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(i[r]=e[r])}return i}function p(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function _(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return p(e)}function v(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=l(e);if(t){var i=l(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return _(this,r)}}function m(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=l(e)););return e}function g(){return g="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,r){var n=m(e,t);if(n){var i=Object.getOwnPropertyDescriptor(n,t);return i.get?i.get.call(arguments.length<3?e:r):i.value}},g.apply(this,arguments)}function y(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==r)return;var n,i,o=[],a=!0,s=!1;try{for(r=r.call(e);!(a=(n=r.next()).done)&&(o.push(n.value),!t||o.length!==t);a=!0);}catch(PU){s=!0,i=PU}finally{try{a||null==r.return||r.return()}finally{if(s)throw i}}return o}(e,t)||b(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function S(e){return function(e){if(Array.isArray(e))return E(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||b(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function b(e,t){if(e){if("string"==typeof e)return E(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?E(e,t):void 0}}function E(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function k(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=b(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,i=function(){};return{s:i,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,s=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return a=e.done,e},e:function(e){s=!0,o=e},f:function(){try{a||null==r.return||r.return()}finally{if(s)throw o}}}}var R=function(e){return e[e.VIDEO_SOURCE_TYPE_EXTERNAL=0]="VIDEO_SOURCE_TYPE_EXTERNAL",e[e.VIDEO_SOURCE_TYPE_INTERNAL=1]="VIDEO_SOURCE_TYPE_INTERNAL",e}(R||{}),T=function(e){return e[e.AUDIO_SOURCE_TYPE_EXTERNAL=0]="AUDIO_SOURCE_TYPE_EXTERNAL",e[e.AUDIO_SOURCE_TYPE_INTERNAL=1]="AUDIO_SOURCE_TYPE_INTERNAL",e}(T||{}),I=function(e){return 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",e}(I||{}),A=function(e){return e[e.CHANNEL_PROFILE_COMMUNICATION=0]="CHANNEL_PROFILE_COMMUNICATION",e[e.CHANNEL_PROFILE_LIVE_BROADCASTING=1]="CHANNEL_PROFILE_LIVE_BROADCASTING",e}(A||{}),w=function(e){return e[e.AUTO_SUBSCRIBE_MODE=0]="AUTO_SUBSCRIBE_MODE",e[e.MANUAL_SUBSCRIBE_MODE=1]="MANUAL_SUBSCRIBE_MODE",e}(w||{}),C=function(e){return e[e.SUBSCRIBE_SUCC=0]="SUBSCRIBE_SUCC",e[e.SUBSCRIBE_FAIL=1]="SUBSCRIBE_FAIL",e}(C||{}),O=function(e){return e[e.PUBLISH_SUCC=0]="PUBLISH_SUCC",e[e.PUBLISH_FAIL=1]="PUBLISH_FAIL",e}(O||{}),N=function(e){return e[e.MIRROR_MODE_OFF=0]="MIRROR_MODE_OFF",e[e.MIRROR_MODE_ON=1]="MIRROR_MODE_ON",e}(N||{}),x=function(e){return e[e.RENDER_MODE_HIDDEN=0]="RENDER_MODE_HIDDEN",e[e.RENDER_MODE_FIT=1]="RENDER_MODE_FIT",e}(x||{}),D=function(e){return e[e.STREAM_INDEX_MAIN=0]="STREAM_INDEX_MAIN",e[e.STREAM_INDEX_SCREEN=1]="STREAM_INDEX_SCREEN",e}(D||{}),P=function(e){return e[e.AUDIO=1]="AUDIO",e[e.VIDEO=2]="VIDEO",e[e.AUDIO_AND_VIDEO=3]="AUDIO_AND_VIDEO",e}(P||{}),M=function(e){return 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",e}(M||{}),U=function(e){return 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",e}(U||{}),L=function(e){return e[e.MIRROR_TYPE_NONE=0]="MIRROR_TYPE_NONE",e[e.MIRROR_TYPE_RENDER=1]="MIRROR_TYPE_RENDER",e}(L||{}),V=function(e){return e[e.domestic=0]="domestic",e[e.overseas=1]="overseas",e}(V||{}),F=function(e){return e[e.OFFLINE=0]="OFFLINE",e[e.ONLINE=1]="ONLINE",e[e.UNREACHABLE=2]="UNREACHABLE",e}(F||{}),B=function(e){return e[e.AUDIO_AND_VIDEO=0]="AUDIO_AND_VIDEO",e[e.AUDIO_ONLY=1]="AUDIO_ONLY",e[e.VIDEO_ONLY=2]="VIDEO_ONLY",e}(B||{}),j=function(e){return e[e.PREV_FRAME=0]="PREV_FRAME",e[e.OTHER_FRAME=1]="OTHER_FRAME",e}(j||{}),G=function(e){return e[e.DISABLE=0]="DISABLE",e[e.VIDEO_STREAM_LOW=1]="VIDEO_STREAM_LOW",e[e.AUDIO_ONLY=2]="AUDIO_ONLY",e}(G||{}),H=function(e){return e[e.LOW=0]="LOW",e[e.MEDIUM=100]="MEDIUM",e[e.HIGH=200]="HIGH",e}(H||{}),z=function(e){return 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",e}(z||{}),K=function(e){return e[e.Unknown=-1]="Unknown",e[e.SubscribeFallbackByBandwidth=0]="SubscribeFallbackByBandwidth",e[e.SubscribeRecoverByBandwidth=2]="SubscribeRecoverByBandwidth",e}(K||{}),W=function(e){return 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",e}(W||{}),X=function(e){return 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",e}(X||{}),q=function(e){return e[e.AUTO_PLAY=0]="AUTO_PLAY",e[e.VIDEO_ONLY=1]="VIDEO_ONLY",e[e.PLAY_MANUALLY=2]="PLAY_MANUALLY",e}(q||{}),Y=Object.freeze(Object.defineProperty({__proto__:null,VideoSourceType:R,AudioSourceType:T,UserOfflineReason:I,ChannelProfile:A,SubscribeMode:w,SubscribeState:C,PublishState:O,MirrorMode:N,VideoRenderMode:x,StreamIndex:D,MediaType:P,StreamRemoveReason:M,ConnectionState:U,MirrorType:L,LogChannel:V,USER_ONLINE_STATUS:F,PublicStreamType:B,PublicInterpolationMode:j,SubscribeFallbackOption:G,RemoteUserPriority:H,NetworkQuality:z,FallbackOrRecoverReason:K,RoomProfileType:W,AudioProfileType:X,RTCAutoPlayPolicy:q},Symbol.toStringTag,{value:"Module"})),J=function(e){return 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",e}(J||{}),Q=function(e){return e[e.PLAYOUT=0]="PLAYOUT",e[e.PUBLISH=1]="PUBLISH",e[e.PLAYOUT_AND_PUBLISH=2]="PLAYOUT_AND_PUBLISH",e}(Q||{}),Z=function(e){return e[e.AUDIO_MIXING_STATE_PRELOADED=0]="AUDIO_MIXING_STATE_PRELOADED",e[e.AUDIO_MIXING_STATE_PLAYING=1]="AUDIO_MIXING_STATE_PLAYING",e[e.AUDIO_MIXING_STATE_PAUSED=2]="AUDIO_MIXING_STATE_PAUSED",e[e.AUDIO_MIXING_STATE_STOPPED=3]="AUDIO_MIXING_STATE_STOPPED",e[e.AUDIO_MIXING_STATE_FAILED=4]="AUDIO_MIXING_STATE_FAILED",e[e.AUDIO_MIXING_STATE_FINISHED=5]="AUDIO_MIXING_STATE_FINISHED",e[e.AUDIO_MIXING_STATE_PCM_ENABLED=6]="AUDIO_MIXING_STATE_PCM_ENABLED",e[e.AUDIO_MIXING_STATE_PCM_DISABLED=7]="AUDIO_MIXING_STATE_PCM_DISABLED",e}(Z||{}),$=Object.freeze(Object.defineProperty({__proto__:null,AudioMixingDualMonoMode:J,AudioMixingType:Q,AudioMixingState:Z},Symbol.toStringTag,{value:"Module"})),ee=function(e){return 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.onActiveSpeaker="onActiveSpeaker",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.onVideoStreamBanned="onVideoStreamBanned",e.onAudioStreamBanned="onAudioStreamBanned",e.onLocalVideoSizeChanged="onLocalVideoSizeChanged",e}(ee||{}),te="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},re=function(e){return e&&e.Math==Math&&e},ne=re("object"==typeof globalThis&&globalThis)||re("object"==typeof window&&window)||re("object"==typeof self&&self)||re("object"==typeof te&&te)||function(){return this}()||Function("return this")(),ie={},oe=function(e){try{return!!e()}catch(t){return!0}},ae=!oe((function(){return 7!=Object.defineProperty({},1,{get:function(){return 7}})[1]})),se=!oe((function(){var e=function(){}.bind();return"function"!=typeof e||e.hasOwnProperty("prototype")})),ue=se,ce=Function.prototype.call,de=ue?ce.bind(ce):function(){return ce.apply(ce,arguments)},le={},he={}.propertyIsEnumerable,fe=Object.getOwnPropertyDescriptor,pe=fe&&!he.call({1:2},1);le.f=pe?function(e){var t=fe(this,e);return!!t&&t.enumerable}:he;var _e,ve,me=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}},ge=se,ye=Function.prototype,Se=ye.bind,be=ye.call,Ee=ge&&Se.bind(be,be),ke=ge?function(e){return e&&Ee(e)}:function(e){return e&&function(){return be.apply(e,arguments)}},Re=ke,Te=Re({}.toString),Ie=Re("".slice),Ae=function(e){return Ie(Te(e),8,-1)},we=ke,Ce=oe,Oe=Ae,Ne=ne.Object,xe=we("".split),De=Ce((function(){return!Ne("z").propertyIsEnumerable(0)}))?function(e){return"String"==Oe(e)?xe(e,""):Ne(e)}:Ne,Pe=ne.TypeError,Me=function(e){if(null==e)throw Pe("Can't call method on "+e);return e},Ue=De,Le=Me,Ve=function(e){return Ue(Le(e))},Fe=function(e){return"function"==typeof e},Be=Fe,je=function(e){return"object"==typeof e?null!==e:Be(e)},Ge=ne,He=Fe,ze=function(e){return He(e)?e:void 0},Ke=function(e,t){return arguments.length<2?ze(Ge[e]):Ge[e]&&Ge[e][t]},We=ke({}.isPrototypeOf),Xe=Ke("navigator","userAgent")||"",qe=ne,Ye=Xe,Je=qe.process,Qe=qe.Deno,Ze=Je&&Je.versions||Qe&&Qe.version,$e=Ze&&Ze.v8;$e&&(ve=(_e=$e.split("."))[0]>0&&_e[0]<4?1:+(_e[0]+_e[1])),!ve&&Ye&&(!(_e=Ye.match(/Edge\/(\d+)/))||_e[1]>=74)&&(_e=Ye.match(/Chrome\/(\d+)/))&&(ve=+_e[1]);var et=ve,tt=et,rt=oe,nt=!!Object.getOwnPropertySymbols&&!rt((function(){var e=Symbol();return!String(e)||!(Object(e)instanceof Symbol)||!Symbol.sham&&tt&&tt<41})),it=nt&&!Symbol.sham&&"symbol"==typeof Symbol.iterator,ot=Ke,at=Fe,st=We,ut=it,ct=ne.Object,dt=ut?function(e){return"symbol"==typeof e}:function(e){var t=ot("Symbol");return at(t)&&st(t.prototype,ct(e))},lt=ne.String,ht=function(e){try{return lt(e)}catch(t){return"Object"}},ft=Fe,pt=ht,_t=ne.TypeError,vt=function(e){if(ft(e))return e;throw _t(pt(e)+" is not a function")},mt=vt,gt=function(e,t){var r=e[t];return null==r?void 0:mt(r)},yt=de,St=Fe,bt=je,Et=ne.TypeError,kt={exports:{}},Rt=ne,Tt=Object.defineProperty,It=function(e,t){try{Tt(Rt,e,{value:t,configurable:!0,writable:!0})}catch(r){Rt[e]=t}return t},At=It,wt="__core-js_shared__",Ct=ne[wt]||At(wt,{}),Ot=Ct;(kt.exports=function(e,t){return Ot[e]||(Ot[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 Nt=Me,xt=ne.Object,Dt=function(e){return xt(Nt(e))},Pt=Dt,Mt=ke({}.hasOwnProperty),Ut=Object.hasOwn||function(e,t){return Mt(Pt(e),t)},Lt=ke,Vt=0,Ft=Math.random(),Bt=Lt(1..toString),jt=function(e){return"Symbol("+(void 0===e?"":e)+")_"+Bt(++Vt+Ft,36)},Gt=ne,Ht=kt.exports,zt=Ut,Kt=jt,Wt=nt,Xt=it,qt=Ht("wks"),Yt=Gt.Symbol,Jt=Yt&&Yt.for,Qt=Xt?Yt:Yt&&Yt.withoutSetter||Kt,Zt=function(e){if(!zt(qt,e)||!Wt&&"string"!=typeof qt[e]){var t="Symbol."+e;Wt&&zt(Yt,e)?qt[e]=Yt[e]:qt[e]=Xt&&Jt?Jt(t):Qt(t)}return qt[e]},$t=de,er=je,tr=dt,rr=gt,nr=function(e,t){var r,n;if("string"===t&&St(r=e.toString)&&!bt(n=yt(r,e)))return n;if(St(r=e.valueOf)&&!bt(n=yt(r,e)))return n;if("string"!==t&&St(r=e.toString)&&!bt(n=yt(r,e)))return n;throw Et("Can't convert object to primitive value")},ir=Zt,or=ne.TypeError,ar=ir("toPrimitive"),sr=function(e,t){if(!er(e)||tr(e))return e;var r,n=rr(e,ar);if(n){if(void 0===t&&(t="default"),r=$t(n,e,t),!er(r)||tr(r))return r;throw or("Can't convert object to primitive value")}return void 0===t&&(t="number"),nr(e,t)},ur=sr,cr=dt,dr=function(e){var t=ur(e,"string");return cr(t)?t:t+""},lr=je,hr=ne.document,fr=lr(hr)&&lr(hr.createElement),pr=function(e){return fr?hr.createElement(e):{}},_r=pr,vr=!ae&&!oe((function(){return 7!=Object.defineProperty(_r("div"),"a",{get:function(){return 7}}).a})),mr=ae,gr=de,yr=le,Sr=me,br=Ve,Er=dr,kr=Ut,Rr=vr,Tr=Object.getOwnPropertyDescriptor;ie.f=mr?Tr:function(e,t){if(e=br(e),t=Er(t),Rr)try{return Tr(e,t)}catch(r){}if(kr(e,t))return Sr(!gr(yr.f,e,t),e[t])};var Ir={},Ar=ae&&oe((function(){return 42!=Object.defineProperty((function(){}),"prototype",{value:42,writable:!1}).prototype})),wr=ne,Cr=je,Or=wr.String,Nr=wr.TypeError,xr=function(e){if(Cr(e))return e;throw Nr(Or(e)+" is not an object")},Dr=ae,Pr=vr,Mr=Ar,Ur=xr,Lr=dr,Vr=ne.TypeError,Fr=Object.defineProperty,Br=Object.getOwnPropertyDescriptor,jr="enumerable",Gr="configurable",Hr="writable";Ir.f=Dr?Mr?function(e,t,r){if(Ur(e),t=Lr(t),Ur(r),"function"==typeof e&&"prototype"===t&&"value"in r&&Hr in r&&!r.writable){var n=Br(e,t);n&&n.writable&&(e[t]=r.value,r={configurable:Gr in r?r.configurable:n.configurable,enumerable:jr in r?r.enumerable:n.enumerable,writable:!1})}return Fr(e,t,r)}:Fr:function(e,t,r){if(Ur(e),t=Lr(t),Ur(r),Pr)try{return Fr(e,t,r)}catch(n){}if("get"in r||"set"in r)throw Vr("Accessors not supported");return"value"in r&&(e[t]=r.value),e};var zr=Ir,Kr=me,Wr=ae?function(e,t,r){return zr.f(e,t,Kr(1,r))}:function(e,t,r){return e[t]=r,e},Xr={exports:{}},qr=Fe,Yr=Ct,Jr=ke(Function.toString);qr(Yr.inspectSource)||(Yr.inspectSource=function(e){return Jr(e)});var Qr,Zr,$r,en=Yr.inspectSource,tn=Fe,rn=en,nn=ne.WeakMap,on=tn(nn)&&/native code/.test(rn(nn)),an=kt.exports,sn=jt,un=an("keys"),cn=function(e){return un[e]||(un[e]=sn(e))},dn={},ln=on,hn=ne,fn=ke,pn=je,_n=Wr,vn=Ut,mn=Ct,gn=cn,yn=dn,Sn="Object already initialized",bn=hn.TypeError,En=hn.WeakMap;if(ln||mn.state){var kn=mn.state||(mn.state=new En),Rn=fn(kn.get),Tn=fn(kn.has),In=fn(kn.set);Qr=function(e,t){if(Tn(kn,e))throw new bn(Sn);return t.facade=e,In(kn,e,t),t},Zr=function(e){return Rn(kn,e)||{}},$r=function(e){return Tn(kn,e)}}else{var An=gn("state");yn[An]=!0,Qr=function(e,t){if(vn(e,An))throw new bn(Sn);return t.facade=e,_n(e,An,t),t},Zr=function(e){return vn(e,An)?e[An]:{}},$r=function(e){return vn(e,An)}}var wn={set:Qr,get:Zr,has:$r,enforce:function(e){return $r(e)?Zr(e):Qr(e,{})},getterFor:function(e){return function(t){var r;if(!pn(t)||(r=Zr(t)).type!==e)throw bn("Incompatible receiver, "+e+" required");return r}}},Cn=ae,On=Ut,Nn=Function.prototype,xn=Cn&&Object.getOwnPropertyDescriptor,Dn=On(Nn,"name"),Pn={EXISTS:Dn,PROPER:Dn&&"something"===function(){}.name,CONFIGURABLE:Dn&&(!Cn||Cn&&xn(Nn,"name").configurable)},Mn=ne,Un=Fe,Ln=Ut,Vn=Wr,Fn=It,Bn=en,jn=Pn.CONFIGURABLE,Gn=wn.get,Hn=wn.enforce,zn=String(String).split("String");(Xr.exports=function(e,t,r,n){var i,o=!!n&&!!n.unsafe,a=!!n&&!!n.enumerable,s=!!n&&!!n.noTargetGet,u=n&&void 0!==n.name?n.name:t;Un(r)&&("Symbol("===String(u).slice(0,7)&&(u="["+String(u).replace(/^Symbol\(([^)]*)\)/,"$1")+"]"),(!Ln(r,"name")||jn&&r.name!==u)&&Vn(r,"name",u),(i=Hn(r)).source||(i.source=zn.join("string"==typeof u?u:""))),e!==Mn?(o?!s&&e[t]&&(a=!0):delete e[t],a?e[t]=r:Vn(e,t,r)):a?e[t]=r:Fn(t,r)})(Function.prototype,"toString",(function(){return Un(this)&&Gn(this).source||Bn(this)}));var Kn={},Wn=Math.ceil,Xn=Math.floor,qn=function(e){var t=+e;return t!=t||0===t?0:(t>0?Xn:Wn)(t)},Yn=qn,Jn=Math.max,Qn=Math.min,Zn=function(e,t){var r=Yn(e);return r<0?Jn(r+t,0):Qn(r,t)},$n=qn,ei=Math.min,ti=function(e){return e>0?ei($n(e),9007199254740991):0},ri=ti,ni=function(e){return ri(e.length)},ii=Ve,oi=Zn,ai=ni,si=function(e){return function(t,r,n){var i,o=ii(t),a=ai(o),s=oi(n,a);if(e&&r!=r){for(;a>s;)if((i=o[s++])!=i)return!0}else for(;a>s;s++)if((e||s in o)&&o[s]===r)return e||s||0;return!e&&-1}},ui={includes:si(!0),indexOf:si(!1)},ci=Ut,di=Ve,li=ui.indexOf,hi=dn,fi=ke([].push),pi=function(e,t){var r,n=di(e),i=0,o=[];for(r in n)!ci(hi,r)&&ci(n,r)&&fi(o,r);for(;t.length>i;)ci(n,r=t[i++])&&(~li(o,r)||fi(o,r));return o},_i=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],vi=pi,mi=_i.concat("length","prototype");Kn.f=Object.getOwnPropertyNames||function(e){return vi(e,mi)};var gi={};gi.f=Object.getOwnPropertySymbols;var yi=Ke,Si=Kn,bi=gi,Ei=xr,ki=ke([].concat),Ri=yi("Reflect","ownKeys")||function(e){var t=Si.f(Ei(e)),r=bi.f;return r?ki(t,r(e)):t},Ti=Ut,Ii=Ri,Ai=ie,wi=Ir,Ci=function(e,t,r){for(var n=Ii(t),i=wi.f,o=Ai.f,a=0;a<n.length;a++){var s=n[a];Ti(e,s)||r&&Ti(r,s)||i(e,s,o(t,s))}},Oi=oe,Ni=Fe,xi=/#|\.prototype\./,Di=function(e,t){var r=Mi[Pi(e)];return r==Li||r!=Ui&&(Ni(t)?Oi(t):!!t)},Pi=Di.normalize=function(e){return String(e).replace(xi,".").toLowerCase()},Mi=Di.data={},Ui=Di.NATIVE="N",Li=Di.POLYFILL="P",Vi=Di,Fi=ne,Bi=ie.f,ji=Wr,Gi=Xr.exports,Hi=It,zi=Ci,Ki=Vi,Wi=function(e,t){var r,n,i,o,a,s=e.target,u=e.global,c=e.stat;if(r=u?Fi:c?Fi[s]||Hi(s,{}):(Fi[s]||{}).prototype)for(n in t){if(o=t[n],i=e.noTargetGet?(a=Bi(r,n))&&a.value:r[n],!Ki(u?n:s+(c?".":"#")+n,e.forced)&&void 0!==i){if(typeof o==typeof i)continue;zi(o,i)}(e.sham||i&&i.sham)&&ji(o,"sham",!0),Gi(r,n,o,e)}},Xi=se,qi=Function.prototype,Yi=qi.apply,Ji=qi.call,Qi="object"==typeof Reflect&&Reflect.apply||(Xi?Ji.bind(Yi):function(){return Ji.apply(Yi,arguments)}),Zi=Ae,$i=Array.isArray||function(e){return"Array"==Zi(e)},eo={};eo[Zt("toStringTag")]="z";var to="[object z]"===String(eo),ro=ne,no=to,io=Fe,oo=Ae,ao=Zt("toStringTag"),so=ro.Object,uo="Arguments"==oo(function(){return arguments}()),co=no?oo:function(e){var t,r,n;return void 0===e?"Undefined":null===e?"Null":"string"==typeof(r=function(e,t){try{return e[t]}catch(r){}}(t=so(e),ao))?r:uo?oo(t):"Object"==(n=oo(t))&&io(t.callee)?"Arguments":n},lo=co,ho=ne.String,fo=function(e){if("Symbol"===lo(e))throw TypeError("Cannot convert a Symbol value to a string");return ho(e)},po={},_o=pi,vo=_i,mo=Object.keys||function(e){return _o(e,vo)},go=ae,yo=Ar,So=Ir,bo=xr,Eo=Ve,ko=mo;po.f=go&&!yo?Object.defineProperties:function(e,t){bo(e);for(var r,n=Eo(t),i=ko(t),o=i.length,a=0;o>a;)So.f(e,r=i[a++],n[r]);return e};var Ro,To=Ke("document","documentElement"),Io=xr,Ao=po,wo=_i,Co=dn,Oo=To,No=pr,xo=cn("IE_PROTO"),Do=function(){},Po=function(e){return"<script>"+e+"</"+"script>"},Mo=function(e){e.write(Po("")),e.close();var t=e.parentWindow.Object;return e=null,t},Uo=function(){try{Ro=new ActiveXObject("htmlfile")}catch(n){}var e,t;Uo="undefined"!=typeof document?document.domain&&Ro?Mo(Ro):((t=No("iframe")).style.display="none",Oo.appendChild(t),t.src=String("javascript:"),(e=t.contentWindow.document).open(),e.write(Po("document.F=Object")),e.close(),e.F):Mo(Ro);for(var r=wo.length;r--;)delete Uo.prototype[wo[r]];return Uo()};Co[xo]=!0;var Lo=Object.create||function(e,t){var r;return null!==e?(Do.prototype=Io(e),r=new Do,Do.prototype=null,r[xo]=e):r=Uo(),void 0===t?r:Ao.f(r,t)},Vo={},Fo=dr,Bo=Ir,jo=me,Go=function(e,t,r){var n=Fo(t);n in e?Bo.f(e,n,jo(0,r)):e[n]=r},Ho=Zn,zo=ni,Ko=Go,Wo=ne.Array,Xo=Math.max,qo=function(e,t,r){for(var n=zo(e),i=Ho(t,n),o=Ho(void 0===r?n:r,n),a=Wo(Xo(o-i,0)),s=0;i<o;i++,s++)Ko(a,s,e[i]);return a.length=s,a},Yo=Ae,Jo=Ve,Qo=Kn.f,Zo=qo,$o="object"==typeof window&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[];Vo.f=function(e){return $o&&"Window"==Yo(e)?function(e){try{return Qo(e)}catch(t){return Zo($o)}}(e):Qo(Jo(e))};var ea=ke([].slice),ta={},ra=Zt;ta.f=ra;var na=ne,ia=Ut,oa=ta,aa=Ir.f,sa=function(e){var t=na.Symbol||(na.Symbol={});ia(t,e)||aa(t,e,{value:oa.f(e)})},ua=Ir.f,ca=Ut,da=Zt("toStringTag"),la=function(e,t,r){e&&!r&&(e=e.prototype),e&&!ca(e,da)&&ua(e,da,{configurable:!0,value:t})},ha=vt,fa=se,pa=ke(ke.bind),_a=function(e,t){return ha(e),void 0===t?e:fa?pa(e,t):function(){return e.apply(t,arguments)}},va=ke,ma=oe,ga=Fe,ya=co,Sa=en,ba=function(){},Ea=[],ka=Ke("Reflect","construct"),Ra=/^\s*(?:class|function)\b/,Ta=va(Ra.exec),Ia=!Ra.exec(ba),Aa=function(e){if(!ga(e))return!1;try{return ka(ba,Ea,e),!0}catch(t){return!1}},wa=function(e){if(!ga(e))return!1;switch(ya(e)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return Ia||!!Ta(Ra,Sa(e))}catch(t){return!0}};wa.sham=!0;var Ca=!ka||ma((function(){var e;return Aa(Aa.call)||!Aa(Object)||!Aa((function(){e=!0}))||e}))?wa:Aa,Oa=ne,Na=$i,xa=Ca,Da=je,Pa=Zt("species"),Ma=Oa.Array,Ua=function(e){var t;return Na(e)&&(t=e.constructor,(xa(t)&&(t===Ma||Na(t.prototype))||Da(t)&&null===(t=t[Pa]))&&(t=void 0)),void 0===t?Ma:t},La=function(e,t){return new(Ua(e))(0===t?0:t)},Va=_a,Fa=De,Ba=Dt,ja=ni,Ga=La,Ha=ke([].push),za=function(e){var t=1==e,r=2==e,n=3==e,i=4==e,o=6==e,a=7==e,s=5==e||o;return function(u,c,d,l){for(var h,f,p=Ba(u),_=Fa(p),v=Va(c,d),m=ja(_),g=0,y=l||Ga,S=t?y(u,m):r||a?y(u,0):void 0;m>g;g++)if((s||g in _)&&(f=v(h=_[g],g,p),e))if(t)S[g]=f;else if(f)switch(e){case 3:return!0;case 5:return h;case 6:return g;case 2:Ha(S,h)}else switch(e){case 4:return!1;case 7:Ha(S,h)}return o?-1:n||i?i:S}},Ka={forEach:za(0),map:za(1),filter:za(2),some:za(3),every:za(4),find:za(5),findIndex:za(6),filterReject:za(7)},Wa=Wi,Xa=ne,qa=Ke,Ya=Qi,Ja=de,Qa=ke,Za=ae,$a=nt,es=oe,ts=Ut,rs=$i,ns=Fe,is=je,os=We,as=dt,ss=xr,us=Dt,cs=Ve,ds=dr,ls=fo,hs=me,fs=Lo,ps=mo,_s=Kn,vs=Vo,ms=gi,gs=ie,ys=Ir,Ss=po,bs=le,Es=ea,ks=Xr.exports,Rs=kt.exports,Ts=dn,Is=jt,As=Zt,ws=ta,Cs=sa,Os=la,Ns=wn,xs=Ka.forEach,Ds=cn("hidden"),Ps="Symbol",Ms=As("toPrimitive"),Us=Ns.set,Ls=Ns.getterFor(Ps),Vs=Object.prototype,Fs=Xa.Symbol,Bs=Fs&&Fs.prototype,js=Xa.TypeError,Gs=Xa.QObject,Hs=qa("JSON","stringify"),zs=gs.f,Ks=ys.f,Ws=vs.f,Xs=bs.f,qs=Qa([].push),Ys=Rs("symbols"),Js=Rs("op-symbols"),Qs=Rs("string-to-symbol-registry"),Zs=Rs("symbol-to-string-registry"),$s=Rs("wks"),eu=!Gs||!Gs.prototype||!Gs.prototype.findChild,tu=Za&&es((function(){return 7!=fs(Ks({},"a",{get:function(){return Ks(this,"a",{value:7}).a}})).a}))?function(e,t,r){var n=zs(Vs,t);n&&delete Vs[t],Ks(e,t,r),n&&e!==Vs&&Ks(Vs,t,n)}:Ks,ru=function(e,t){var r=Ys[e]=fs(Bs);return Us(r,{type:Ps,tag:e,description:t}),Za||(r.description=t),r},nu=function(e,t,r){e===Vs&&nu(Js,t,r),ss(e);var n=ds(t);return ss(r),ts(Ys,n)?(r.enumerable?(ts(e,Ds)&&e[Ds][n]&&(e[Ds][n]=!1),r=fs(r,{enumerable:hs(0,!1)})):(ts(e,Ds)||Ks(e,Ds,hs(1,{})),e[Ds][n]=!0),tu(e,n,r)):Ks(e,n,r)},iu=function(e,t){ss(e);var r=cs(t),n=ps(r).concat(uu(r));return xs(n,(function(t){Za&&!Ja(ou,r,t)||nu(e,t,r[t])})),e},ou=function(e){var t=ds(e),r=Ja(Xs,this,t);return!(this===Vs&&ts(Ys,t)&&!ts(Js,t))&&(!(r||!ts(this,t)||!ts(Ys,t)||ts(this,Ds)&&this[Ds][t])||r)},au=function(e,t){var r=cs(e),n=ds(t);if(r!==Vs||!ts(Ys,n)||ts(Js,n)){var i=zs(r,n);return!i||!ts(Ys,n)||ts(r,Ds)&&r[Ds][n]||(i.enumerable=!0),i}},su=function(e){var t=Ws(cs(e)),r=[];return xs(t,(function(e){ts(Ys,e)||ts(Ts,e)||qs(r,e)})),r},uu=function(e){var t=e===Vs,r=Ws(t?Js:cs(e)),n=[];return xs(r,(function(e){!ts(Ys,e)||t&&!ts(Vs,e)||qs(n,Ys[e])})),n};($a||(Fs=function(){if(os(Bs,this))throw js("Symbol is not a constructor");var e=arguments.length&&void 0!==arguments[0]?ls(arguments[0]):void 0,t=Is(e),r=function(e){this===Vs&&Ja(r,Js,e),ts(this,Ds)&&ts(this[Ds],t)&&(this[Ds][t]=!1),tu(this,t,hs(1,e))};return Za&&eu&&tu(Vs,t,{configurable:!0,set:r}),ru(t,e)},ks(Bs=Fs.prototype,"toString",(function(){return Ls(this).tag})),ks(Fs,"withoutSetter",(function(e){return ru(Is(e),e)})),bs.f=ou,ys.f=nu,Ss.f=iu,gs.f=au,_s.f=vs.f=su,ms.f=uu,ws.f=function(e){return ru(As(e),e)},Za&&(Ks(Bs,"description",{configurable:!0,get:function(){return Ls(this).description}}),ks(Vs,"propertyIsEnumerable",ou,{unsafe:!0}))),Wa({global:!0,wrap:!0,forced:!$a,sham:!$a},{Symbol:Fs}),xs(ps($s),(function(e){Cs(e)})),Wa({target:Ps,stat:!0,forced:!$a},{for:function(e){var t=ls(e);if(ts(Qs,t))return Qs[t];var r=Fs(t);return Qs[t]=r,Zs[r]=t,r},keyFor:function(e){if(!as(e))throw js(e+" is not a symbol");if(ts(Zs,e))return Zs[e]},useSetter:function(){eu=!0},useSimple:function(){eu=!1}}),Wa({target:"Object",stat:!0,forced:!$a,sham:!Za},{create:function(e,t){return void 0===t?fs(e):iu(fs(e),t)},defineProperty:nu,defineProperties:iu,getOwnPropertyDescriptor:au}),Wa({target:"Object",stat:!0,forced:!$a},{getOwnPropertyNames:su,getOwnPropertySymbols:uu}),Wa({target:"Object",stat:!0,forced:es((function(){ms.f(1)}))},{getOwnPropertySymbols:function(e){return ms.f(us(e))}}),Hs)&&Wa({target:"JSON",stat:!0,forced:!$a||es((function(){var e=Fs();return"[null]"!=Hs([e])||"{}"!=Hs({a:e})||"{}"!=Hs(Object(e))}))},{stringify:function(e,t,r){var n=Es(arguments),i=t;if((is(t)||void 0!==e)&&!as(e))return rs(t)||(t=function(e,t){if(ns(i)&&(t=Ja(i,this,e,t)),!as(t))return t}),n[1]=t,Ya(Hs,null,n)}});if(!Bs[Ms]){var cu=Bs.valueOf;ks(Bs,Ms,(function(e){return Ja(cu,this)}))}Os(Fs,Ps),Ts[Ds]=!0;var du=Wi,lu=ae,hu=ne,fu=ke,pu=Ut,_u=Fe,vu=We,mu=fo,gu=Ir.f,yu=Ci,Su=hu.Symbol,bu=Su&&Su.prototype;if(lu&&_u(Su)&&(!("description"in bu)||void 0!==Su().description)){var Eu={},ku=function(){var e=arguments.length<1||void 0===arguments[0]?void 0:mu(arguments[0]),t=vu(bu,this)?new Su(e):void 0===e?Su():Su(e);return""===e&&(Eu[t]=!0),t};yu(ku,Su),ku.prototype=bu,bu.constructor=ku;var Ru="Symbol(test)"==String(Su("test")),Tu=fu(bu.toString),Iu=fu(bu.valueOf),Au=/^Symbol\((.*)\)[^)]+$/,wu=fu("".replace),Cu=fu("".slice);gu(bu,"description",{configurable:!0,get:function(){var e=Iu(this),t=Tu(e);if(pu(Eu,e))return"";var r=Ru?Cu(t,7,-1):wu(t,Au,"$1");return""===r?void 0:r}}),du({global:!0,forced:!0},{Symbol:ku})}var Ou=co,Nu=to?{}.toString:function(){return"[object "+Ou(this)+"]"},xu=to,Du=Xr.exports,Pu=Nu;xu||Du(Object.prototype,"toString",Pu,{unsafe:!0}),sa("iterator");var Mu=Lo,Uu=Ir,Lu=Zt("unscopables"),Vu=Array.prototype;null==Vu[Lu]&&Uu.f(Vu,Lu,{configurable:!0,value:Mu(null)});var Fu,Bu,ju,Gu=function(e){Vu[Lu][e]=!0},Hu={},zu=!oe((function(){function e(){}return e.prototype.constructor=null,Object.getPrototypeOf(new e)!==e.prototype})),Ku=ne,Wu=Ut,Xu=Fe,qu=Dt,Yu=zu,Ju=cn("IE_PROTO"),Qu=Ku.Object,Zu=Qu.prototype,$u=Yu?Qu.getPrototypeOf:function(e){var t=qu(e);if(Wu(t,Ju))return t[Ju];var r=t.constructor;return Xu(r)&&t instanceof r?r.prototype:t instanceof Qu?Zu:null},ec=oe,tc=Fe,rc=$u,nc=Xr.exports,ic=Zt("iterator"),oc=!1;[].keys&&("next"in(ju=[].keys())?(Bu=rc(rc(ju)))!==Object.prototype&&(Fu=Bu):oc=!0);var ac=null==Fu||ec((function(){var e={};return Fu[ic].call(e)!==e}));ac&&(Fu={}),tc(Fu[ic])||nc(Fu,ic,(function(){return this}));var sc={IteratorPrototype:Fu,BUGGY_SAFARI_ITERATORS:oc},uc=sc.IteratorPrototype,cc=Lo,dc=me,lc=la,hc=Hu,fc=function(){return this},pc=function(e,t,r,n){var i=t+" Iterator";return e.prototype=cc(uc,{next:dc(+!n,r)}),lc(e,i,!1),hc[i]=fc,e},_c=ne,vc=Fe,mc=_c.String,gc=_c.TypeError,yc=ke,Sc=xr,bc=function(e){if("object"==typeof e||vc(e))return e;throw gc("Can't set "+mc(e)+" as a prototype")},Ec=Object.setPrototypeOf||("__proto__"in{}?function(){var e,t=!1,r={};try{(e=yc(Object.getOwnPropertyDescriptor(Object.prototype,"__proto__").set))(r,[]),t=r instanceof Array}catch(n){}return function(r,n){return Sc(r),bc(n),t?e(r,n):r.__proto__=n,r}}():void 0),kc=Wi,Rc=de,Tc=Pn,Ic=Fe,Ac=pc,wc=$u,Cc=Ec,Oc=la,Nc=Wr,xc=Xr.exports,Dc=Hu,Pc=Tc.PROPER,Mc=Tc.CONFIGURABLE,Uc=sc.IteratorPrototype,Lc=sc.BUGGY_SAFARI_ITERATORS,Vc=Zt("iterator"),Fc="keys",Bc="values",jc="entries",Gc=function(){return this},Hc=function(e,t,r,n,i,o,a){Ac(r,t,n);var s,u,c,d=function(e){if(e===i&&_)return _;if(!Lc&&e in f)return f[e];switch(e){case Fc:case Bc:case jc:return function(){return new r(this,e)}}return function(){return new r(this)}},l=t+" Iterator",h=!1,f=e.prototype,p=f[Vc]||f["@@iterator"]||i&&f[i],_=!Lc&&p||d(i),v="Array"==t&&f.entries||p;if(v&&(s=wc(v.call(new e)))!==Object.prototype&&s.next&&(wc(s)!==Uc&&(Cc?Cc(s,Uc):Ic(s[Vc])||xc(s,Vc,Gc)),Oc(s,l,!0)),Pc&&i==Bc&&p&&p.name!==Bc&&(Mc?Nc(f,"name",Bc):(h=!0,_=function(){return Rc(p,this)})),i)if(u={values:d(Bc),keys:o?_:d(Fc),entries:d(jc)},a)for(c in u)(Lc||h||!(c in f))&&xc(f,c,u[c]);else kc({target:t,proto:!0,forced:Lc||h},u);return f[Vc]!==_&&xc(f,Vc,_,{name:i}),Dc[t]=_,u},zc=Ve,Kc=Gu,Wc=Hu,Xc=wn,qc=Ir.f,Yc=Hc,Jc=ae,Qc="Array Iterator",Zc=Xc.set,$c=Xc.getterFor(Qc),ed=Yc(Array,"Array",(function(e,t){Zc(this,{type:Qc,target:zc(e),index:0,kind:t})}),(function(){var e=$c(this),t=e.target,r=e.kind,n=e.index++;return!t||n>=t.length?(e.target=void 0,{value:void 0,done:!0}):"keys"==r?{value:n,done:!1}:"values"==r?{value:t[n],done:!1}:{value:[n,t[n]],done:!1}}),"values"),td=Wc.Arguments=Wc.Array;if(Kc("keys"),Kc("values"),Kc("entries"),Jc&&"values"!==td.name)try{qc(td,"name",{value:"values"})}catch(Sq){}var rd=ke,nd=qn,id=fo,od=Me,ad=rd("".charAt),sd=rd("".charCodeAt),ud=rd("".slice),cd=function(e){return function(t,r){var n,i,o=id(od(t)),a=nd(r),s=o.length;return a<0||a>=s?e?"":void 0:(n=sd(o,a))<55296||n>56319||a+1===s||(i=sd(o,a+1))<56320||i>57343?e?ad(o,a):n:e?ud(o,a,a+2):i-56320+(n-55296<<10)+65536}},dd={codeAt:cd(!1),charAt:cd(!0)},ld=dd.charAt,hd=fo,fd=wn,pd=Hc,_d="String Iterator",vd=fd.set,md=fd.getterFor(_d);pd(String,"String",(function(e){vd(this,{type:_d,string:hd(e),index:0})}),(function(){var e,t=md(this),r=t.string,n=t.index;return n>=r.length?{value:void 0,done:!0}:(e=ld(r,n),t.index+=e.length,{value:e,done:!1})}));var gd={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},yd=pr("span").classList,Sd=yd&&yd.constructor&&yd.constructor.prototype,bd=Sd===Object.prototype?void 0:Sd,Ed=ne,kd=gd,Rd=bd,Td=ed,Id=Wr,Ad=Zt,wd=Ad("iterator"),Cd=Ad("toStringTag"),Od=Td.values,Nd=function(e,t){if(e){if(e[wd]!==Od)try{Id(e,wd,Od)}catch(Sq){e[wd]=Od}if(e[Cd]||Id(e,Cd,t),kd[t])for(var r in Td)if(e[r]!==Td[r])try{Id(e,r,Td[r])}catch(Sq){e[r]=Td[r]}}};for(var xd in kd)Nd(Ed[xd]&&Ed[xd].prototype,xd);Nd(Rd,"DOMTokenList"),sa("asyncIterator"),sa("toStringTag"),la(ne.JSON,"JSON",!0),la(Math,"Math",!0);var Dd=Wi,Pd=ae,Md=Ir.f;Dd({target:"Object",stat:!0,forced:Object.defineProperty!==Md,sham:!Pd},{defineProperty:Md});var Ud=Dt,Ld=$u,Vd=zu;Wi({target:"Object",stat:!0,forced:oe((function(){Ld(1)})),sham:!Vd},{getPrototypeOf:function(e){return Ld(Ud(e))}}),Wi({target:"Object",stat:!0},{setPrototypeOf:Ec});var Fd=ne.Promise,Bd=Xr.exports,jd=function(e,t,r){for(var n in t)Bd(e,n,t[n],r);return e},Gd=Ke,Hd=Ir,zd=ae,Kd=Zt("species"),Wd=function(e){var t=Gd(e),r=Hd.f;zd&&t&&!t[Kd]&&r(t,Kd,{configurable:!0,get:function(){return this}})},Xd=We,qd=ne.TypeError,Yd=function(e,t){if(Xd(t,e))return e;throw qd("Incorrect invocation")},Jd=Hu,Qd=Zt("iterator"),Zd=Array.prototype,$d=function(e){return void 0!==e&&(Jd.Array===e||Zd[Qd]===e)},el=co,tl=gt,rl=Hu,nl=Zt("iterator"),il=function(e){if(null!=e)return tl(e,nl)||tl(e,"@@iterator")||rl[el(e)]},ol=de,al=vt,sl=xr,ul=ht,cl=il,dl=ne.TypeError,ll=function(e,t){var r=arguments.length<2?cl(e):t;if(al(r))return sl(ol(r,e));throw dl(ul(e)+" is not iterable")},hl=de,fl=xr,pl=gt,_l=function(e,t,r){var n,i;fl(e);try{if(!(n=pl(e,"return"))){if("throw"===t)throw r;return r}n=hl(n,e)}catch(Sq){i=!0,n=Sq}if("throw"===t)throw r;if(i)throw n;return fl(n),r},vl=_a,ml=de,gl=xr,yl=ht,Sl=$d,bl=ni,El=We,kl=ll,Rl=il,Tl=_l,Il=ne.TypeError,Al=function(e,t){this.stopped=e,this.result=t},wl=Al.prototype,Cl=function(e,t,r){var n,i,o,a,s,u,c,d=r&&r.that,l=!(!r||!r.AS_ENTRIES),h=!(!r||!r.IS_ITERATOR),f=!(!r||!r.INTERRUPTED),p=vl(t,d),_=function(e){return n&&Tl(n,"normal",e),new Al(!0,e)},v=function(e){return l?(gl(e),f?p(e[0],e[1],_):p(e[0],e[1])):f?p(e,_):p(e)};if(h)n=e;else{if(!(i=Rl(e)))throw Il(yl(e)+" is not iterable");if(Sl(i)){for(o=0,a=bl(e);a>o;o++)if((s=v(e[o]))&&El(wl,s))return s;return new Al(!1)}n=kl(e,i)}for(u=n.next;!(c=ml(u,n)).done;){try{s=v(c.value)}catch(Sq){Tl(n,"throw",Sq)}if("object"==typeof s&&s&&El(wl,s))return s}return new Al(!1)},Ol=Zt("iterator"),Nl=!1;try{var xl=0,Dl={next:function(){return{done:!!xl++}},return:function(){Nl=!0}};Dl[Ol]=function(){return this},Array.from(Dl,(function(){throw 2}))}catch(Sq){}var Pl,Ml,Ul,Ll,Vl=function(e,t){if(!t&&!Nl)return!1;var r=!1;try{var n={};n[Ol]=function(){return{next:function(){return{done:r=!0}}}},e(n)}catch(Sq){}return r},Fl=Ca,Bl=ht,jl=ne.TypeError,Gl=function(e){if(Fl(e))return e;throw jl(Bl(e)+" is not a constructor")},Hl=xr,zl=Gl,Kl=Zt("species"),Wl=function(e,t){var r,n=Hl(e).constructor;return void 0===n||null==(r=Hl(n)[Kl])?t:zl(r)},Xl=ne.TypeError,ql=function(e,t){if(e<t)throw Xl("Not enough arguments");return e},Yl=/(?:ipad|iphone|ipod).*applewebkit/i.test(Xe),Jl="process"==Ae(ne.process),Ql=ne,Zl=Qi,$l=_a,eh=Fe,th=Ut,rh=oe,nh=To,ih=ea,oh=pr,ah=ql,sh=Yl,uh=Jl,ch=Ql.setImmediate,dh=Ql.clearImmediate,lh=Ql.process,hh=Ql.Dispatch,fh=Ql.Function,ph=Ql.MessageChannel,_h=Ql.String,vh=0,mh={},gh="onreadystatechange";try{Pl=Ql.location}catch(Sq){}var yh=function(e){if(th(mh,e)){var t=mh[e];delete mh[e],t()}},Sh=function(e){return function(){yh(e)}},bh=function(e){yh(e.data)},Eh=function(e){Ql.postMessage(_h(e),Pl.protocol+"//"+Pl.host)};ch&&dh||(ch=function(e){ah(arguments.length,1);var t=eh(e)?e:fh(e),r=ih(arguments,1);return mh[++vh]=function(){Zl(t,void 0,r)},Ml(vh),vh},dh=function(e){delete mh[e]},uh?Ml=function(e){lh.nextTick(Sh(e))}:hh&&hh.now?Ml=function(e){hh.now(Sh(e))}:ph&&!sh?(Ll=(Ul=new ph).port2,Ul.port1.onmessage=bh,Ml=$l(Ll.postMessage,Ll)):Ql.addEventListener&&eh(Ql.postMessage)&&!Ql.importScripts&&Pl&&"file:"!==Pl.protocol&&!rh(Eh)?(Ml=Eh,Ql.addEventListener("message",bh,!1)):Ml=gh in oh("script")?function(e){nh.appendChild(oh("script")).onreadystatechange=function(){nh.removeChild(this),yh(e)}}:function(e){setTimeout(Sh(e),0)});var kh,Rh,Th,Ih,Ah,wh,Ch,Oh,Nh={set:ch,clear:dh},xh=ne,Dh=/ipad|iphone|ipod/i.test(Xe)&&void 0!==xh.Pebble,Ph=/web0s(?!.*chrome)/i.test(Xe),Mh=ne,Uh=_a,Lh=ie.f,Vh=Nh.set,Fh=Yl,Bh=Dh,jh=Ph,Gh=Jl,Hh=Mh.MutationObserver||Mh.WebKitMutationObserver,zh=Mh.document,Kh=Mh.process,Wh=Mh.Promise,Xh=Lh(Mh,"queueMicrotask"),qh=Xh&&Xh.value;qh||(kh=function(){var e,t;for(Gh&&(e=Kh.domain)&&e.exit();Rh;){t=Rh.fn,Rh=Rh.next;try{t()}catch(Sq){throw Rh?Ih():Th=void 0,Sq}}Th=void 0,e&&e.enter()},Fh||Gh||jh||!Hh||!zh?!Bh&&Wh&&Wh.resolve?((Ch=Wh.resolve(void 0)).constructor=Wh,Oh=Uh(Ch.then,Ch),Ih=function(){Oh(kh)}):Gh?Ih=function(){Kh.nextTick(kh)}:(Vh=Uh(Vh,Mh),Ih=function(){Vh(kh)}):(Ah=!0,wh=zh.createTextNode(""),new Hh(kh).observe(wh,{characterData:!0}),Ih=function(){wh.data=Ah=!Ah}));var Yh=qh||function(e){var t={fn:e,next:void 0};Th&&(Th.next=t),Rh||(Rh=t,Ih()),Th=t},Jh={},Qh=vt,Zh=function(e){var t,r;this.promise=new e((function(e,n){if(void 0!==t||void 0!==r)throw TypeError("Bad Promise constructor");t=e,r=n})),this.resolve=Qh(t),this.reject=Qh(r)};Jh.f=function(e){return new Zh(e)};var $h=xr,ef=je,tf=Jh,rf=function(e,t){if($h(e),ef(t)&&t.constructor===e)return t;var r=tf.f(e);return(0,r.resolve)(t),r.promise},nf=ne,of=function(){this.head=null,this.tail=null};of.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 af,sf,uf,cf,df=of,lf="object"==typeof window,hf=Wi,ff=ne,pf=Ke,_f=de,vf=Fd,mf=Xr.exports,gf=jd,yf=Ec,Sf=la,bf=Wd,Ef=vt,kf=Fe,Rf=je,Tf=Yd,If=en,Af=Cl,wf=Vl,Cf=Wl,Of=Nh.set,Nf=Yh,xf=rf,Df=function(e,t){var r=nf.console;r&&r.error&&(1==arguments.length?r.error(e):r.error(e,t))},Pf=Jh,Mf=function(e){try{return{error:!1,value:e()}}catch(Sq){return{error:!0,value:Sq}}},Uf=df,Lf=wn,Vf=Vi,Ff=lf,Bf=Jl,jf=et,Gf=Zt("species"),Hf="Promise",zf=Lf.getterFor(Hf),Kf=Lf.set,Wf=Lf.getterFor(Hf),Xf=vf&&vf.prototype,qf=vf,Yf=Xf,Jf=ff.TypeError,Qf=ff.document,Zf=ff.process,$f=Pf.f,ep=$f,tp=!!(Qf&&Qf.createEvent&&ff.dispatchEvent),rp=kf(ff.PromiseRejectionEvent),np="unhandledrejection",ip=!1,op=Vf(Hf,(function(){var e=If(qf),t=e!==String(qf);if(!t&&66===jf)return!0;if(jf>=51&&/native code/.test(e))return!1;var r=new qf((function(e){e(1)})),n=function(e){e((function(){}),(function(){}))};return(r.constructor={})[Gf]=n,!(ip=r.then((function(){}))instanceof n)||!t&&Ff&&!rp})),ap=op||!wf((function(e){qf.all(e).catch((function(){}))})),sp=function(e){var t;return!(!Rf(e)||!kf(t=e.then))&&t},up=function(e,t){var r,n,i,o=t.value,a=1==t.state,s=a?e.ok:e.fail,u=e.resolve,c=e.reject,d=e.domain;try{s?(a||(2===t.rejection&&fp(t),t.rejection=1),!0===s?r=o:(d&&d.enter(),r=s(o),d&&(d.exit(),i=!0)),r===e.promise?c(Jf("Promise-chain cycle")):(n=sp(r))?_f(n,r,u,c):u(r)):c(o)}catch(Sq){d&&!i&&d.exit(),c(Sq)}},cp=function(e,t){e.notified||(e.notified=!0,Nf((function(){for(var r,n=e.reactions;r=n.get();)up(r,e);e.notified=!1,t&&!e.rejection&&lp(e)})))},dp=function(e,t,r){var n,i;tp?((n=Qf.createEvent("Event")).promise=t,n.reason=r,n.initEvent(e,!1,!0),ff.dispatchEvent(n)):n={promise:t,reason:r},!rp&&(i=ff["on"+e])?i(n):e===np&&Df("Unhandled promise rejection",r)},lp=function(e){_f(Of,ff,(function(){var t,r=e.facade,n=e.value;if(hp(e)&&(t=Mf((function(){Bf?Zf.emit("unhandledRejection",n,r):dp(np,r,n)})),e.rejection=Bf||hp(e)?2:1,t.error))throw t.value}))},hp=function(e){return 1!==e.rejection&&!e.parent},fp=function(e){_f(Of,ff,(function(){var t=e.facade;Bf?Zf.emit("rejectionHandled",t):dp("rejectionhandled",t,e.value)}))},pp=function(e,t,r){return function(n){e(t,n,r)}},_p=function(e,t,r){e.done||(e.done=!0,r&&(e=r),e.value=t,e.state=2,cp(e,!0))},vp=function(e,t,r){if(!e.done){e.done=!0,r&&(e=r);try{if(e.facade===t)throw Jf("Promise can't be resolved itself");var n=sp(t);n?Nf((function(){var r={done:!1};try{_f(n,t,pp(vp,r,e),pp(_p,r,e))}catch(Sq){_p(r,Sq,e)}})):(e.value=t,e.state=1,cp(e,!1))}catch(Sq){_p({done:!1},Sq,e)}}};if(op&&(Yf=(qf=function(e){Tf(this,Yf),Ef(e),_f(af,this);var t=zf(this);try{e(pp(vp,t),pp(_p,t))}catch(Sq){_p(t,Sq)}}).prototype,(af=function(e){Kf(this,{type:Hf,done:!1,notified:!1,parent:!1,reactions:new Uf,rejection:!1,state:0,value:void 0})}).prototype=gf(Yf,{then:function(e,t){var r=Wf(this),n=$f(Cf(this,qf));return r.parent=!0,n.ok=!kf(e)||e,n.fail=kf(t)&&t,n.domain=Bf?Zf.domain:void 0,0==r.state?r.reactions.add(n):Nf((function(){up(n,r)})),n.promise},catch:function(e){return this.then(void 0,e)}}),sf=function(){var e=new af,t=zf(e);this.promise=e,this.resolve=pp(vp,t),this.reject=pp(_p,t)},Pf.f=$f=function(e){return e===qf||e===uf?new sf(e):ep(e)},kf(vf)&&Xf!==Object.prototype)){cf=Xf.then,ip||(mf(Xf,"then",(function(e,t){var r=this;return new qf((function(e,t){_f(cf,r,e,t)})).then(e,t)}),{unsafe:!0}),mf(Xf,"catch",Yf.catch,{unsafe:!0}));try{delete Xf.constructor}catch(Sq){}yf&&yf(Xf,Yf)}hf({global:!0,wrap:!0,forced:op},{Promise:qf}),Sf(qf,Hf,!1),bf(Hf),uf=pf(Hf),hf({target:Hf,stat:!0,forced:op},{reject:function(e){var t=$f(this);return _f(t.reject,void 0,e),t.promise}}),hf({target:Hf,stat:!0,forced:op},{resolve:function(e){return xf(this,e)}}),hf({target:Hf,stat:!0,forced:ap},{all:function(e){var t=this,r=$f(t),n=r.resolve,i=r.reject,o=Mf((function(){var r=Ef(t.resolve),o=[],a=0,s=1;Af(e,(function(e){var u=a++,c=!1;s++,_f(r,t,e).then((function(e){c||(c=!0,o[u]=e,--s||n(o))}),i)})),--s||n(o)}));return o.error&&i(o.value),r.promise},race:function(e){var t=this,r=$f(t),n=r.reject,i=Mf((function(){var i=Ef(t.resolve);Af(e,(function(e){_f(i,t,e).then(r.resolve,n)}))}));return i.error&&n(i.value),r.promise}});var mp=Fe,gp=je,yp=Ec,Sp=function(e,t,r){var n,i;return yp&&mp(n=t.constructor)&&n!==r&&gp(i=n.prototype)&&i!==r.prototype&&yp(e,i),e},bp=fo,Ep=function(e,t){return void 0===e?arguments.length<2?"":t:bp(e)},kp=je,Rp=Wr,Tp=ke("".replace),Ip=String(Error("zxcasd").stack),Ap=/\n\s*at [^:]*:[^\n]*/,wp=Ap.test(Ip),Cp=function(e,t){if(wp&&"string"==typeof e)for(;t--;)e=Tp(e,Ap,"");return e},Op=me,Np=!oe((function(){var e=Error("a");return!("stack"in e)||(Object.defineProperty(e,"stack",Op(1,7)),7!==e.stack)})),xp=Ke,Dp=Ut,Pp=Wr,Mp=We,Up=Ec,Lp=Ci,Vp=Sp,Fp=Ep,Bp=function(e,t){kp(t)&&"cause"in t&&Rp(e,"cause",t.cause)},jp=Cp,Gp=Np,Hp=Wi,zp=Qi,Kp=function(e,t,r,n){var i=n?2:1,o=e.split("."),a=o[o.length-1],s=xp.apply(null,o);if(s){var u=s.prototype;if(Dp(u,"cause")&&delete u.cause,!r)return s;var c=xp("Error"),d=t((function(e,t){var r=Fp(n?t:e,void 0),o=n?new s(e):new s;return void 0!==r&&Pp(o,"message",r),Gp&&Pp(o,"stack",jp(o.stack,2)),this&&Mp(u,this)&&Vp(o,this,d),arguments.length>i&&Bp(o,arguments[i]),o}));d.prototype=u,"Error"!==a&&(Up?Up(d,c):Lp(d,c,{name:!0})),Lp(d,s);try{u.name!==a&&Pp(u,"name",a),u.constructor=d}catch(Sq){}return d}},Wp="WebAssembly",Xp=ne.WebAssembly,qp=7!==Error("e",{cause:7}).cause,Yp=function(e,t){var r={};r[e]=Kp(e,t,qp),Hp({global:!0,forced:qp},r)},Jp=function(e,t){if(Xp&&Xp[e]){var r={};r[e]=Kp("WebAssembly."+e,t,qp),Hp({target:Wp,stat:!0,forced:qp},r)}};Yp("Error",(function(e){return function(t){return zp(e,this,arguments)}})),Yp("EvalError",(function(e){return function(t){return zp(e,this,arguments)}})),Yp("RangeError",(function(e){return function(t){return zp(e,this,arguments)}})),Yp("ReferenceError",(function(e){return function(t){return zp(e,this,arguments)}})),Yp("SyntaxError",(function(e){return function(t){return zp(e,this,arguments)}})),Yp("TypeError",(function(e){return function(t){return zp(e,this,arguments)}})),Yp("URIError",(function(e){return function(t){return zp(e,this,arguments)}})),Jp("CompileError",(function(e){return function(t){return zp(e,this,arguments)}})),Jp("LinkError",(function(e){return function(t){return zp(e,this,arguments)}})),Jp("RuntimeError",(function(e){return function(t){return zp(e,this,arguments)}}));var Qp=oe,Zp=function(e,t){var r=[][e];return!!r&&Qp((function(){r.call(null,t||function(){throw 1},1)}))},$p=Ka.forEach,e_=Zp("forEach")?[].forEach:function(e){return $p(this,e,arguments.length>1?arguments[1]:void 0)},t_=ne,r_=gd,n_=bd,i_=e_,o_=Wr,a_=function(e){if(e&&e.forEach!==i_)try{o_(e,"forEach",i_)}catch(Sq){e.forEach=i_}};for(var s_ in r_)r_[s_]&&a_(t_[s_]&&t_[s_].prototype);a_(n_);var u_=oe,c_=et,d_=Zt("species"),l_=function(e){return c_>=51||!u_((function(){var t=[];return(t.constructor={})[d_]=function(){return{foo:1}},1!==t[e](Boolean).foo}))},h_=Wi,f_=ne,p_=$i,__=Ca,v_=je,m_=Zn,g_=ni,y_=Ve,S_=Go,b_=Zt,E_=ea,k_=l_("slice"),R_=b_("species"),T_=f_.Array,I_=Math.max;h_({target:"Array",proto:!0,forced:!k_},{slice:function(e,t){var r,n,i,o=y_(this),a=g_(o),s=m_(e,a),u=m_(void 0===t?a:t,a);if(p_(o)&&(r=o.constructor,(__(r)&&(r===T_||p_(r.prototype))||v_(r)&&null===(r=r[R_]))&&(r=void 0),r===T_||void 0===r))return E_(o,s,u);for(n=new(void 0===r?T_:r)(I_(u-s,0)),i=0;s<u;s++,i++)s in o&&S_(n,i,o[s]);return n.length=i,n}}),Wi({global:!0},{globalThis:ne});!function(e){var t=function(e){var t,r=Object.prototype,i=r.hasOwnProperty,o="function"==typeof Symbol?Symbol:{},a=o.iterator||"@@iterator",s=o.asyncIterator||"@@asyncIterator",u=o.toStringTag||"@@toStringTag";function c(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{c({},"")}catch(PU){c=function(e,t,r){return e[t]=r}}function d(e,t,r,n){var i=t&&t.prototype instanceof m?t:m,o=Object.create(i.prototype),a=new C(n||[]);return o._invoke=function(e,t,r){var n=h;return function(i,o){if(n===p)throw new Error("Generator is already running");if(n===_){if("throw"===i)throw o;return N()}for(r.method=i,r.arg=o;;){var a=r.delegate;if(a){var s=I(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(n===h)throw n=_,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n=p;var u=l(e,t,r);if("normal"===u.type){if(n=r.done?_:f,u.arg===v)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(n=_,r.method="throw",r.arg=u.arg)}}}(e,r,a),o}function l(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(PU){return{type:"throw",arg:PU}}}e.wrap=d;var h="suspendedStart",f="suspendedYield",p="executing",_="completed",v={};function m(){}function g(){}function y(){}var S={};c(S,a,(function(){return this}));var b=Object.getPrototypeOf,E=b&&b(b(O([])));E&&E!==r&&i.call(E,a)&&(S=E);var k=y.prototype=m.prototype=Object.create(S);function R(e){["next","throw","return"].forEach((function(t){c(e,t,(function(e){return this._invoke(t,e)}))}))}function T(e,t){function r(o,a,s,u){var c=l(e[o],e,a);if("throw"!==c.type){var d=c.arg,h=d.value;return h&&"object"===n(h)&&i.call(h,"__await")?t.resolve(h.__await).then((function(e){r("next",e,s,u)}),(function(e){r("throw",e,s,u)})):t.resolve(h).then((function(e){d.value=e,s(d)}),(function(e){return r("throw",e,s,u)}))}u(c.arg)}var o;this._invoke=function(e,n){function i(){return new t((function(t,i){r(e,n,t,i)}))}return o=o?o.then(i,i):i()}}function I(e,r){var n=e.iterator[r.method];if(n===t){if(r.delegate=null,"throw"===r.method){if(e.iterator.return&&(r.method="return",r.arg=t,I(e,r),"throw"===r.method))return v;r.method="throw",r.arg=new TypeError("The iterator does not provide a 'throw' method")}return v}var i=l(n,e.iterator,r.arg);if("throw"===i.type)return r.method="throw",r.arg=i.arg,r.delegate=null,v;var o=i.arg;return o?o.done?(r[e.resultName]=o.value,r.next=e.nextLoc,"return"!==r.method&&(r.method="next",r.arg=t),r.delegate=null,v):o:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,v)}function A(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 w(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function C(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(A,this),this.reset(!0)}function O(e){if(e){var r=e[a];if(r)return r.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var n=-1,o=function r(){for(;++n<e.length;)if(i.call(e,n))return r.value=e[n],r.done=!1,r;return r.value=t,r.done=!0,r};return o.next=o}}return{next:N}}function N(){return{value:t,done:!0}}return g.prototype=y,c(k,"constructor",y),c(y,"constructor",g),g.displayName=c(y,u,"GeneratorFunction"),e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===g||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,y):(e.__proto__=y,c(e,u,"GeneratorFunction")),e.prototype=Object.create(k),e},e.awrap=function(e){return{__await:e}},R(T.prototype),c(T.prototype,s,(function(){return this})),e.AsyncIterator=T,e.async=function(t,r,n,i,o){void 0===o&&(o=Promise);var a=new T(d(t,r,n,i),o);return e.isGeneratorFunction(r)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},R(k),c(k,u,"Generator"),c(k,a,(function(){return this})),c(k,"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 n=t.pop();if(n in e)return r.value=n,r.done=!1,r}return r.done=!0,r}},e.values=O,C.prototype={constructor:C,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(w),!e)for(var r in this)"t"===r.charAt(0)&&i.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=t)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var r=this;function n(n,i){return s.type="throw",s.arg=e,r.next=n,i&&(r.method="next",r.arg=t),!!i}for(var o=this.tryEntries.length-1;o>=0;--o){var a=this.tryEntries[o],s=a.completion;if("root"===a.tryLoc)return n("end");if(a.tryLoc<=this.prev){var u=i.call(a,"catchLoc"),c=i.call(a,"finallyLoc");if(u&&c){if(this.prev<a.catchLoc)return n(a.catchLoc,!0);if(this.prev<a.finallyLoc)return n(a.finallyLoc)}else if(u){if(this.prev<a.catchLoc)return n(a.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return n(a.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;r>=0;--r){var n=this.tryEntries[r];if(n.tryLoc<=this.prev&&i.call(n,"finallyLoc")&&this.prev<n.finallyLoc){var o=n;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var a=o?o.completion:{};return a.type=e,a.arg=t,o?(this.method="next",this.next=o.finallyLoc,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),w(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 n=r.completion;if("throw"===n.type){var i=n.arg;w(r)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(e,r,n){return this.delegate={iterator:O(e),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=t),v}},e}(e.exports);try{regeneratorRuntime=t}catch(r){"object"===("undefined"==typeof globalThis?"undefined":n(globalThis))?globalThis.regeneratorRuntime=t:Function("r","regeneratorRuntime = r")(t)}}({exports:{}});var A_=ui.includes,w_=Gu;Wi({target:"Array",proto:!0},{includes:function(e){return A_(this,e,arguments.length>1?arguments[1]:void 0)}}),w_("includes");var C_=je,O_=Ae,N_=Zt("match"),x_=function(e){var t;return C_(e)&&(void 0!==(t=e[N_])?!!t:"RegExp"==O_(e))},D_=x_,P_=ne.TypeError,M_=function(e){if(D_(e))throw P_("The method doesn't accept regular expressions");return e},U_=Zt("match"),L_=function(e){var t=/./;try{"/./"[e](t)}catch(r){try{return t[U_]=!1,"/./"[e](t)}catch(n){}}return!1},V_=Wi,F_=M_,B_=Me,j_=fo,G_=L_,H_=ke("".indexOf);V_({target:"String",proto:!0,forced:!G_("includes")},{includes:function(e){return!!~H_(j_(B_(this)),j_(F_(e)),arguments.length>1?arguments[1]:void 0)}});var z_=xr,K_=function(){var e=z_(this),t="";return e.global&&(t+="g"),e.ignoreCase&&(t+="i"),e.multiline&&(t+="m"),e.dotAll&&(t+="s"),e.unicode&&(t+="u"),e.sticky&&(t+="y"),t},W_=oe,X_=ne.RegExp,q_=W_((function(){var e=X_("a","y");return e.lastIndex=2,null!=e.exec("abcd")})),Y_=q_||W_((function(){return!X_("a","y").sticky})),J_=q_||W_((function(){var e=X_("^r","gy");return e.lastIndex=2,null!=e.exec("str")})),Q_={BROKEN_CARET:J_,MISSED_STICKY:Y_,UNSUPPORTED_Y:q_},Z_=oe,$_=ne.RegExp,ev=Z_((function(){var e=$_(".","s");return!(e.dotAll&&e.exec("\n")&&"s"===e.flags)})),tv=oe,rv=ne.RegExp,nv=tv((function(){var e=rv("(?<a>b)","g");return"b"!==e.exec("b").groups.a||"bc"!=="b".replace(e,"$<a>c")})),iv=de,ov=ke,av=fo,sv=K_,uv=Q_,cv=kt.exports,dv=Lo,lv=wn.get,hv=ev,fv=nv,pv=cv("native-string-replace",String.prototype.replace),_v=RegExp.prototype.exec,vv=_v,mv=ov("".charAt),gv=ov("".indexOf),yv=ov("".replace),Sv=ov("".slice),bv=function(){var e=/a/,t=/b*/g;return iv(_v,e,"a"),iv(_v,t,"a"),0!==e.lastIndex||0!==t.lastIndex}(),Ev=uv.BROKEN_CARET,kv=void 0!==/()??/.exec("")[1];(bv||kv||Ev||hv||fv)&&(vv=function(e){var t,r,n,i,o,a,s,u=this,c=lv(u),d=av(e),l=c.raw;if(l)return l.lastIndex=u.lastIndex,t=iv(vv,l,d),u.lastIndex=l.lastIndex,t;var h=c.groups,f=Ev&&u.sticky,p=iv(sv,u),_=u.source,v=0,m=d;if(f&&(p=yv(p,"y",""),-1===gv(p,"g")&&(p+="g"),m=Sv(d,u.lastIndex),u.lastIndex>0&&(!u.multiline||u.multiline&&"\n"!==mv(d,u.lastIndex-1))&&(_="(?: "+_+")",m=" "+m,v++),r=new RegExp("^(?:"+_+")",p)),kv&&(r=new RegExp("^"+_+"$(?!\\s)",p)),bv&&(n=u.lastIndex),i=iv(_v,f?r:u,m),f?i?(i.input=Sv(i.input,v),i[0]=Sv(i[0],v),i.index=u.lastIndex,u.lastIndex+=i[0].length):u.lastIndex=0:bv&&i&&(u.lastIndex=u.global?i.index+i[0].length:n),kv&&i&&i.length>1&&iv(pv,i[0],r,(function(){for(o=1;o<arguments.length-2;o++)void 0===arguments[o]&&(i[o]=void 0)})),i&&h)for(i.groups=a=dv(null),o=0;o<h.length;o++)a[(s=h[o])[0]]=i[s[1]];return i});var Rv=vv;Wi({target:"RegExp",proto:!0,forced:/./.exec!==Rv},{exec:Rv});var Tv=ke,Iv=Xr.exports,Av=Rv,wv=oe,Cv=Zt,Ov=Wr,Nv=Cv("species"),xv=RegExp.prototype,Dv=function(e,t,r,n){var i=Cv(e),o=!wv((function(){var t={};return t[i]=function(){return 7},7!=""[e](t)})),a=o&&!wv((function(){var t=!1,r=/a/;return"split"===e&&((r={}).constructor={},r.constructor[Nv]=function(){return r},r.flags="",r[i]=/./[i]),r.exec=function(){return t=!0,null},r[i](""),!t}));if(!o||!a||r){var s=Tv(/./[i]),u=t(i,""[e],(function(e,t,r,n,i){var a=Tv(e),u=t.exec;return u===Av||u===xv.exec?o&&!i?{done:!0,value:s(t,r,n)}:{done:!0,value:a(r,t,n)}:{done:!1}}));Iv(String.prototype,e,u[0]),Iv(xv,i,u[1])}n&&Ov(xv[i],"sham",!0)},Pv=Object.is||function(e,t){return e===t?0!==e||1/e==1/t:e!=e&&t!=t},Mv=de,Uv=xr,Lv=Fe,Vv=Ae,Fv=Rv,Bv=ne.TypeError,jv=function(e,t){var r=e.exec;if(Lv(r)){var n=Mv(r,e,t);return null!==n&&Uv(n),n}if("RegExp"===Vv(e))return Mv(Fv,e,t);throw Bv("RegExp#exec called on incompatible receiver")},Gv=de,Hv=xr,zv=Me,Kv=Pv,Wv=fo,Xv=gt,qv=jv;Dv("search",(function(e,t,r){return[function(t){var r=zv(this),n=null==t?void 0:Xv(t,e);return n?Gv(n,t,r):new RegExp(t)[e](Wv(r))},function(e){var n=Hv(this),i=Wv(e),o=r(t,n,i);if(o.done)return o.value;var a=n.lastIndex;Kv(a,0)||(n.lastIndex=0);var s=qv(n,i);return Kv(n.lastIndex,a)||(n.lastIndex=a),null===s?-1:s.index}]}));var Yv=dd.charAt,Jv=function(e,t,r){return t+(r?Yv(e,t).length:1)},Qv=de,Zv=xr,$v=ti,em=fo,tm=Me,rm=gt,nm=Jv,im=jv;Dv("match",(function(e,t,r){return[function(t){var r=tm(this),n=null==t?void 0:rm(t,e);return n?Qv(n,t,r):new RegExp(t)[e](em(r))},function(e){var n=Zv(this),i=em(e),o=r(t,n,i);if(o.done)return o.value;if(!n.global)return im(n,i);var a=n.unicode;n.lastIndex=0;for(var s,u=[],c=0;null!==(s=im(n,i));){var d=em(s[0]);u[c]=d,""===d&&(n.lastIndex=nm(i,$v(n.lastIndex),a)),c++}return 0===c?null:u}]}));var om="\t\n\v\f\r                 \u2028\u2029\ufeff",am=Me,sm=fo,um=ke("".replace),cm="[\t\n\v\f\r                 \u2028\u2029\ufeff]",dm=RegExp("^"+cm+cm+"*"),lm=RegExp(cm+cm+"*$"),hm=function(e){return function(t){var r=sm(am(t));return 1&e&&(r=um(r,dm,"")),2&e&&(r=um(r,lm,"")),r}},fm={start:hm(1),end:hm(2),trim:hm(3)},pm=ne,_m=oe,vm=ke,mm=fo,gm=fm.trim,ym=om,Sm=pm.parseInt,bm=pm.Symbol,Em=bm&&bm.iterator,km=/^[+-]?0x/i,Rm=vm(km.exec),Tm=8!==Sm(ym+"08")||22!==Sm(ym+"0x16")||Em&&!_m((function(){Sm(Object(Em))}))?function(e,t){var r=gm(mm(e));return Sm(r,t>>>0||(Rm(km,r)?16:10))}:Sm;Wi({global:!0,forced:parseInt!=Tm},{parseInt:Tm});var Im={exports:{}},Am=oe((function(){if("function"==typeof ArrayBuffer){var e=new ArrayBuffer(8);Object.isExtensible(e)&&Object.defineProperty(e,"a",{value:8})}})),wm=oe,Cm=je,Om=Ae,Nm=Am,xm=Object.isExtensible,Dm=wm((function(){xm(1)}))||Nm?function(e){return!!Cm(e)&&((!Nm||"ArrayBuffer"!=Om(e))&&(!xm||xm(e)))}:xm,Pm=!oe((function(){return Object.isExtensible(Object.preventExtensions({}))})),Mm=Wi,Um=ke,Lm=dn,Vm=je,Fm=Ut,Bm=Ir.f,jm=Kn,Gm=Vo,Hm=Dm,zm=Pm,Km=!1,Wm=jt("meta"),Xm=0,qm=function(e){Bm(e,Wm,{value:{objectID:"O"+Xm++,weakData:{}}})},Ym=Im.exports={enable:function(){Ym.enable=function(){},Km=!0;var e=jm.f,t=Um([].splice),r={};r[Wm]=1,e(r).length&&(jm.f=function(r){for(var n=e(r),i=0,o=n.length;i<o;i++)if(n[i]===Wm){t(n,i,1);break}return n},Mm({target:"Object",stat:!0,forced:!0},{getOwnPropertyNames:Gm.f}))},fastKey:function(e,t){if(!Vm(e))return"symbol"==typeof e?e:("string"==typeof e?"S":"P")+e;if(!Fm(e,Wm)){if(!Hm(e))return"F";if(!t)return"E";qm(e)}return e[Wm].objectID},getWeakData:function(e,t){if(!Fm(e,Wm)){if(!Hm(e))return!0;if(!t)return!1;qm(e)}return e[Wm].weakData},onFreeze:function(e){return zm&&Km&&Hm(e)&&!Fm(e,Wm)&&qm(e),e}};Lm[Wm]=!0;var Jm=Wi,Qm=ne,Zm=ke,$m=Vi,eg=Xr.exports,tg=Im.exports,rg=Cl,ng=Yd,ig=Fe,og=je,ag=oe,sg=Vl,ug=la,cg=Sp,dg=function(e,t,r){var n=-1!==e.indexOf("Map"),i=-1!==e.indexOf("Weak"),o=n?"set":"add",a=Qm[e],s=a&&a.prototype,u=a,c={},d=function(e){var t=Zm(s[e]);eg(s,e,"add"==e?function(e){return t(this,0===e?0:e),this}:"delete"==e?function(e){return!(i&&!og(e))&&t(this,0===e?0:e)}:"get"==e?function(e){return i&&!og(e)?void 0:t(this,0===e?0:e)}:"has"==e?function(e){return!(i&&!og(e))&&t(this,0===e?0:e)}:function(e,r){return t(this,0===e?0:e,r),this})};if($m(e,!ig(a)||!(i||s.forEach&&!ag((function(){(new a).entries().next()})))))u=r.getConstructor(t,e,n,o),tg.enable();else if($m(e,!0)){var l=new u,h=l[o](i?{}:-0,1)!=l,f=ag((function(){l.has(1)})),p=sg((function(e){new a(e)})),_=!i&&ag((function(){for(var e=new a,t=5;t--;)e[o](t,t);return!e.has(-0)}));p||((u=t((function(e,t){ng(e,s);var r=cg(new a,e,u);return null!=t&&rg(t,r[o],{that:r,AS_ENTRIES:n}),r}))).prototype=s,s.constructor=u),(f||_)&&(d("delete"),d("has"),n&&d("get")),(_||h)&&d(o),i&&s.clear&&delete s.clear}return c[e]=u,Jm({global:!0,forced:u!=a},c),ug(u,e),i||r.setStrong(u,e,n),u},lg=Ir.f,hg=Lo,fg=jd,pg=_a,_g=Yd,vg=Cl,mg=Hc,gg=Wd,yg=ae,Sg=Im.exports.fastKey,bg=wn.set,Eg=wn.getterFor,kg={getConstructor:function(e,t,r,n){var i=e((function(e,i){_g(e,o),bg(e,{type:t,index:hg(null),first:void 0,last:void 0,size:0}),yg||(e.size=0),null!=i&&vg(i,e[n],{that:e,AS_ENTRIES:r})})),o=i.prototype,a=Eg(t),s=function(e,t,r){var n,i,o=a(e),s=u(e,t);return s?s.value=r:(o.last=s={index:i=Sg(t,!0),key:t,value:r,previous:n=o.last,next:void 0,removed:!1},o.first||(o.first=s),n&&(n.next=s),yg?o.size++:e.size++,"F"!==i&&(o.index[i]=s)),e},u=function(e,t){var r,n=a(e),i=Sg(t);if("F"!==i)return n.index[i];for(r=n.first;r;r=r.next)if(r.key==t)return r};return fg(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,yg?e.size=0:this.size=0},delete:function(e){var t=this,r=a(t),n=u(t,e);if(n){var i=n.next,o=n.previous;delete r.index[n.index],n.removed=!0,o&&(o.next=i),i&&(i.previous=o),r.first==n&&(r.first=i),r.last==n&&(r.last=o),yg?r.size--:t.size--}return!!n},forEach:function(e){for(var t,r=a(this),n=pg(e,arguments.length>1?arguments[1]:void 0);t=t?t.next:r.first;)for(n(t.value,t.key,this);t&&t.removed;)t=t.previous},has:function(e){return!!u(this,e)}}),fg(o,r?{get:function(e){var t=u(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)}}),yg&&lg(o,"size",{get:function(){return a(this).size}}),i},setStrong:function(e,t,r){var n=t+" Iterator",i=Eg(t),o=Eg(n);mg(e,t,(function(e,t){bg(this,{type:n,target:e,state:i(e),kind:t,last:void 0})}),(function(){for(var e=o(this),t=e.kind,r=e.last;r&&r.removed;)r=r.previous;return e.target&&(e.last=r=r?r.next:e.state.first)?"keys"==t?{value:r.key,done:!1}:"values"==t?{value:r.value,done:!1}:{value:[r.key,r.value],done:!1}:(e.target=void 0,{value:void 0,done:!0})}),r?"entries":"values",!r,!0),gg(t)}};dg("Map",(function(e){return function(){return e(this,arguments.length?arguments[0]:void 0)}}),kg);var Rg=Dt,Tg=mo;Wi({target:"Object",stat:!0,forced:oe((function(){Tg(1)}))},{keys:function(e){return Tg(Rg(e))}});var Ig=vt,Ag=Dt,wg=De,Cg=ni,Og=ne.TypeError,Ng=function(e){return function(t,r,n,i){Ig(r);var o=Ag(t),a=wg(o),s=Cg(o),u=e?s-1:0,c=e?-1:1;if(n<2)for(;;){if(u in a){i=a[u],u+=c;break}if(u+=c,e?u<0:s<=u)throw Og("Reduce of empty array with no initial value")}for(;e?u>=0:s>u;u+=c)u in a&&(i=r(i,a[u],u,o));return i}},xg={left:Ng(!1),right:Ng(!0)},Dg=xg.left,Pg=et,Mg=Jl;Wi({target:"Array",proto:!0,forced:!Zp("reduce")||!Mg&&Pg>79&&Pg<83},{reduce:function(e){var t=arguments.length;return Dg(this,e,t,t>1?arguments[1]:void 0)}});var Ug=ae,Lg=ke,Vg=de,Fg=oe,Bg=mo,jg=gi,Gg=le,Hg=Dt,zg=De,Kg=Object.assign,Wg=Object.defineProperty,Xg=Lg([].concat),qg=!Kg||Fg((function(){if(Ug&&1!==Kg({b:1},Kg(Wg({},"a",{enumerable:!0,get:function(){Wg(this,"b",{value:3,enumerable:!1})}}),{b:2})).b)return!0;var e={},t={},r=Symbol(),n="abcdefghijklmnopqrst";return e[r]=7,n.split("").forEach((function(e){t[e]=e})),7!=Kg({},e)[r]||Bg(Kg({},t)).join("")!=n}))?function(e,t){for(var r=Hg(e),n=arguments.length,i=1,o=jg.f,a=Gg.f;n>i;)for(var s,u=zg(arguments[i++]),c=o?Xg(Bg(u),o(u)):Bg(u),d=c.length,l=0;d>l;)s=c[l++],Ug&&!Vg(a,u,s)||(r[s]=u[s]);return r}:Kg,Yg=qg;Wi({target:"Object",stat:!0,forced:Object.assign!==Yg},{assign:Yg});var Jg=Wi,Qg=ke,Zg=ie.f,$g=ti,ey=fo,ty=M_,ry=Me,ny=L_,iy=Qg("".endsWith),oy=Qg("".slice),ay=Math.min,sy=ny("endsWith"),uy=!sy&&!!function(){var e=Zg(String.prototype,"endsWith");return e&&!e.writable}();Jg({target:"String",proto:!0,forced:!uy&&!sy},{endsWith:function(e){var t=ey(ry(this));ty(e);var r=arguments.length>1?arguments[1]:void 0,n=t.length,i=void 0===r?n:ay($g(r),n),o=ey(e);return iy?iy(t,o,i):oy(t,i-o.length,i)===o}});var cy=!0,dy=!0;function ly(e,t,r){var n=e.match(t);return n&&n.length>=r&&parseInt(n[r],10)}function hy(e,t,r){if(e.RTCPeerConnection){var n=e.RTCPeerConnection.prototype,i=n.addEventListener;n.addEventListener=function(e,n){if(e!==t)return i.apply(this,arguments);var o=function(e){var t=r(e);t&&(n.handleEvent?n.handleEvent(t):n(t))};return this._eventMap=this._eventMap||{},this._eventMap[t]||(this._eventMap[t]=new Map),this._eventMap[t].set(n,o),i.apply(this,[e,o])};var o=n.removeEventListener;n.removeEventListener=function(e,r){if(e!==t||!this._eventMap||!this._eventMap[t])return o.apply(this,arguments);if(!this._eventMap[t].has(r))return o.apply(this,arguments);var n=this._eventMap[t].get(r);return this._eventMap[t].delete(r),0===this._eventMap[t].size&&delete this._eventMap[t],0===Object.keys(this._eventMap).length&&delete this._eventMap,o.apply(this,[e,n])},Object.defineProperty(n,"on"+t,{get:function(){return this["_on"+t]},set:function(e){this["_on"+t]&&(this.removeEventListener(t,this["_on"+t]),delete this["_on"+t]),e&&this.addEventListener(t,this["_on"+t]=e)},enumerable:!0,configurable:!0})}}function fy(e){return"boolean"!=typeof e?new Error("Argument type: "+n(e)+". Please use a boolean."):(cy=e,e?"adapter.js logging disabled":"adapter.js logging enabled")}function py(e){return"boolean"!=typeof e?new Error("Argument type: "+n(e)+". Please use a boolean."):(dy=!e,"adapter.js deprecation warnings "+(e?"disabled":"enabled"))}function _y(){if("object"===("undefined"==typeof window?"undefined":n(window))){if(cy)return;"undefined"!=typeof console&&"function"==typeof console.log&&console.log.apply(console,arguments)}}function vy(e,t){dy&&console.warn(e+" is deprecated, please use "+t+" instead.")}function my(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=ly(r.userAgent,/Firefox\/(\d+)\./,1);else if(r.webkitGetUserMedia||!1===e.isSecureContext&&e.webkitRTCPeerConnection&&!e.RTCIceGatherer)t.browser="chrome",t.version=ly(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=ly(r.userAgent,/AppleWebKit\/(\d+)\./,1),t.supportsUnifiedPlan=e.RTCRtpTransceiver&&"currentDirection"in e.RTCRtpTransceiver.prototype}return t}function gy(e){return"[object Object]"===Object.prototype.toString.call(e)}function yy(e){return gy(e)?Object.keys(e).reduce((function(t,r){var n=gy(e[r]),i=n?yy(e[r]):e[r],o=n&&!Object.keys(i).length;return void 0===i||o?t:Object.assign(t,c({},r,i))}),{}):e}function Sy(e,t,r){t&&!r.has(t.id)&&(r.set(t.id,t),Object.keys(t).forEach((function(n){n.endsWith("Id")?Sy(e,e.get(t[n]),r):n.endsWith("Ids")&&t[n].forEach((function(t){Sy(e,e.get(t),r)}))})))}function by(e,t,r){var n=r?"outbound-rtp":"inbound-rtp",i=new Map;if(null===t)return i;var o=[];return e.forEach((function(e){"track"===e.type&&e.trackIdentifier===t.id&&o.push(e)})),o.forEach((function(t){e.forEach((function(r){r.type===n&&r.trackId===t.id&&Sy(e,r,i)}))})),i}var Ey=Wi,ky=Ka.find,Ry=Gu,Ty="find",Iy=!0;Ty in[]&&Array(1).find((function(){Iy=!1})),Ey({target:"Array",proto:!0,forced:Iy},{find:function(e){return ky(this,e,arguments.length>1?arguments[1]:void 0)}}),Ry(Ty);var Ay=Wi,wy=ui.indexOf,Cy=Zp,Oy=ke([].indexOf),Ny=!!Oy&&1/Oy([1],1,-0)<0,xy=Cy("indexOf");Ay({target:"Array",proto:!0,forced:Ny||!xy},{indexOf:function(e){var t=arguments.length>1?arguments[1]:void 0;return Ny?Oy(this,e,t)||0:wy(this,e,t)}});var Dy=Wi,Py=ne,My=Zn,Uy=qn,Ly=ni,Vy=Dt,Fy=La,By=Go,jy=l_("splice"),Gy=Py.TypeError,Hy=Math.max,zy=Math.min,Ky=9007199254740991,Wy="Maximum allowed length exceeded";Dy({target:"Array",proto:!0,forced:!jy},{splice:function(e,t){var r,n,i,o,a,s,u=Vy(this),c=Ly(u),d=My(e,c),l=arguments.length;if(0===l?r=n=0:1===l?(r=0,n=c-d):(r=l-2,n=zy(Hy(Uy(t),0),c-d)),c+r-n>Ky)throw Gy(Wy);for(i=Fy(u,n),o=0;o<n;o++)(a=d+o)in u&&By(i,o,u[a]);if(i.length=n,r<n){for(o=d;o<c-n;o++)s=o+r,(a=o+n)in u?u[s]=u[a]:delete u[s];for(o=c;o>c-n+r;o--)delete u[o-1]}else if(r>n)for(o=c-n;o>d;o--)s=o+r-1,(a=o+n-1)in u?u[s]=u[a]:delete u[s];for(o=0;o<r;o++)u[o+d]=arguments[o+2];return u.length=c-n+r,i}});var Xy=Ka.map;Wi({target:"Array",proto:!0,forced:!l_("map")},{map:function(e){return Xy(this,e,arguments.length>1?arguments[1]:void 0)}});var qy=Jl,Yy=ae,Jy=oe,Qy=xr,Zy=Lo,$y=Ep,eS=Error.prototype.toString,tS=Jy((function(){if(Yy){var e=Zy(Object.defineProperty({},"name",{get:function(){return this===e}}));if("true"!==eS.call(e))return!0}return"2: 1"!==eS.call({message:1,name:2})||"Error"!==eS.call({})}))?function(){var e=Qy(this),t=$y(e.name,"Error"),r=$y(e.message);return t?r?t+": "+r:t:r}:eS,rS={IndexSizeError:{s:"INDEX_SIZE_ERR",c:1,m:1},DOMStringSizeError:{s:"DOMSTRING_SIZE_ERR",c:2,m:0},HierarchyRequestError:{s:"HIERARCHY_REQUEST_ERR",c:3,m:1},WrongDocumentError:{s:"WRONG_DOCUMENT_ERR",c:4,m:1},InvalidCharacterError:{s:"INVALID_CHARACTER_ERR",c:5,m:1},NoDataAllowedError:{s:"NO_DATA_ALLOWED_ERR",c:6,m:0},NoModificationAllowedError:{s:"NO_MODIFICATION_ALLOWED_ERR",c:7,m:1},NotFoundError:{s:"NOT_FOUND_ERR",c:8,m:1},NotSupportedError:{s:"NOT_SUPPORTED_ERR",c:9,m:1},InUseAttributeError:{s:"INUSE_ATTRIBUTE_ERR",c:10,m:1},InvalidStateError:{s:"INVALID_STATE_ERR",c:11,m:1},SyntaxError:{s:"SYNTAX_ERR",c:12,m:1},InvalidModificationError:{s:"INVALID_MODIFICATION_ERR",c:13,m:1},NamespaceError:{s:"NAMESPACE_ERR",c:14,m:1},InvalidAccessError:{s:"INVALID_ACCESS_ERR",c:15,m:1},ValidationError:{s:"VALIDATION_ERR",c:16,m:0},TypeMismatchError:{s:"TYPE_MISMATCH_ERR",c:17,m:1},SecurityError:{s:"SECURITY_ERR",c:18,m:1},NetworkError:{s:"NETWORK_ERR",c:19,m:1},AbortError:{s:"ABORT_ERR",c:20,m:1},URLMismatchError:{s:"URL_MISMATCH_ERR",c:21,m:1},QuotaExceededError:{s:"QUOTA_EXCEEDED_ERR",c:22,m:1},TimeoutError:{s:"TIMEOUT_ERR",c:23,m:1},InvalidNodeTypeError:{s:"INVALID_NODE_TYPE_ERR",c:24,m:1},DataCloneError:{s:"DATA_CLONE_ERR",c:25,m:1}},nS=Wi,iS=function(e){try{if(qy)return Function('return require("'+e+'")')()}catch(Sq){}},oS=Ke,aS=oe,sS=Lo,uS=me,cS=Ir.f,dS=po.f,lS=Xr.exports,hS=Ut,fS=Yd,pS=xr,_S=tS,vS=Ep,mS=rS,gS=Cp,yS=wn,SS=ae,bS="DOMException",ES="DATA_CLONE_ERR",kS=oS("Error"),RS=oS(bS)||function(){try{(new(oS("MessageChannel")||iS("worker_threads").MessageChannel)).port1.postMessage(new WeakMap)}catch(Sq){if(Sq.name==ES&&25==Sq.code)return Sq.constructor}}(),TS=RS&&RS.prototype,IS=kS.prototype,AS=yS.set,wS=yS.getterFor(bS),CS="stack"in kS(bS),OS=function(e){return hS(mS,e)&&mS[e].m?mS[e].c:0},NS=function(){fS(this,xS);var e=arguments.length,t=vS(e<1?void 0:arguments[0]),r=vS(e<2?void 0:arguments[1],"Error"),n=OS(r);if(AS(this,{type:bS,name:r,message:t,code:n}),SS||(this.name=r,this.message=t,this.code=n),CS){var i=kS(t);i.name=bS,cS(this,"stack",uS(1,gS(i.stack,1)))}},xS=NS.prototype=sS(IS),DS=function(e){return{enumerable:!0,configurable:!0,get:e}},PS=function(e){return DS((function(){return wS(this)[e]}))};SS&&dS(xS,{name:PS("name"),message:PS("message"),code:PS("code")}),cS(xS,"constructor",uS(1,NS));var MS=aS((function(){return!(new RS instanceof kS)})),US=MS||aS((function(){return IS.toString!==_S||"2: 1"!==String(new RS(1,2))})),LS=MS||aS((function(){return 25!==new RS(1,"DataCloneError").code}));MS||25!==RS.DATA_CLONE_ERR||TS.DATA_CLONE_ERR;nS({global:!0,forced:MS},{DOMException:MS?NS:RS});var VS=oS(bS),FS=VS.prototype;for(var BS in US&&RS===VS&&lS(FS,"toString",_S),LS&&SS&&RS===VS&&cS(FS,"code",DS((function(){return OS(pS(this).name)}))),mS)if(hS(mS,BS)){var jS=mS[BS],GS=jS.s,HS=uS(6,jS.c);hS(VS,GS)||cS(VS,GS,HS),hS(FS,GS)||cS(FS,GS,HS)}var zS=Wi,KS=Ke,WS=me,XS=Ir.f,qS=Ut,YS=Yd,JS=Sp,QS=Ep,ZS=rS,$S=Cp,eb="DOMException",tb=KS("Error"),rb=KS(eb),nb=function(){YS(this,ib);var e=arguments.length,t=QS(e<1?void 0:arguments[0]),r=QS(e<2?void 0:arguments[1],"Error"),n=new rb(t,r),i=tb(t);return i.name=eb,XS(n,"stack",WS(1,$S(i.stack,1))),JS(n,this,nb),n},ib=nb.prototype=rb.prototype,ob="stack"in tb(eb),ab="stack"in new rb(1,2),sb=ob&&!ab;zS({global:!0,forced:sb},{DOMException:sb?nb:rb});var ub=KS(eb),cb=ub.prototype;if(cb.constructor!==ub)for(var db in XS(cb,"constructor",WS(1,ub)),ZS)if(qS(ZS,db)){var lb=ZS[db],hb=lb.s;qS(ub,hb)||XS(ub,hb,WS(6,lb.c))}var fb="DOMException";la(Ke(fb),fb);var pb=Ka.filter;Wi({target:"Array",proto:!0,forced:!l_("filter")},{filter:function(e){return pb(this,e,arguments.length>1?arguments[1]:void 0)}});var _b=Wi,vb=ne,mb=oe,gb=$i,yb=je,Sb=Dt,bb=ni,Eb=Go,kb=La,Rb=l_,Tb=et,Ib=Zt("isConcatSpreadable"),Ab=9007199254740991,wb="Maximum allowed index exceeded",Cb=vb.TypeError,Ob=Tb>=51||!mb((function(){var e=[];return e[Ib]=!1,e.concat()[0]!==e})),Nb=Rb("concat"),xb=function(e){if(!yb(e))return!1;var t=e[Ib];return void 0!==t?!!t:gb(e)};_b({target:"Array",proto:!0,forced:!Ob||!Nb},{concat:function(e){var t,r,n,i,o,a=Sb(this),s=kb(a,0),u=0;for(t=-1,n=arguments.length;t<n;t++)if(xb(o=-1===t?a:arguments[t])){if(u+(i=bb(o))>Ab)throw Cb(wb);for(r=0;r<i;r++,u++)r in o&&Eb(s,u,o[r])}else{if(u>=Ab)throw Cb(wb);Eb(s,u++,o)}return s.length=u,s}});var Db=ke,Pb=Dt,Mb=Math.floor,Ub=Db("".charAt),Lb=Db("".replace),Vb=Db("".slice),Fb=/\$([$&'`]|\d{1,2}|<[^>]*>)/g,Bb=/\$([$&'`]|\d{1,2})/g,jb=Qi,Gb=de,Hb=ke,zb=Dv,Kb=oe,Wb=xr,Xb=Fe,qb=qn,Yb=ti,Jb=fo,Qb=Me,Zb=Jv,$b=gt,eE=function(e,t,r,n,i,o){var a=r+e.length,s=n.length,u=Bb;return void 0!==i&&(i=Pb(i),u=Fb),Lb(o,u,(function(o,u){var c;switch(Ub(u,0)){case"$":return"$";case"&":return e;case"`":return Vb(t,0,r);case"'":return Vb(t,a);case"<":c=i[Vb(u,1,-1)];break;default:var d=+u;if(0===d)return o;if(d>s){var l=Mb(d/10);return 0===l?o:l<=s?void 0===n[l-1]?Ub(u,1):n[l-1]+Ub(u,1):o}c=n[d-1]}return void 0===c?"":c}))},tE=jv,rE=Zt("replace"),nE=Math.max,iE=Math.min,oE=Hb([].concat),aE=Hb([].push),sE=Hb("".indexOf),uE=Hb("".slice),cE="$0"==="a".replace(/./,"$0"),dE=!!/./[rE]&&""===/./[rE]("a","$0"),lE=!Kb((function(){var e=/./;return e.exec=function(){var e=[];return e.groups={a:"7"},e},"7"!=="".replace(e,"$<a>")}));zb("replace",(function(e,t,r){var n=dE?"$":"$0";return[function(e,r){var n=Qb(this),i=null==e?void 0:$b(e,rE);return i?Gb(i,e,n,r):Gb(t,Jb(n),e,r)},function(e,i){var o=Wb(this),a=Jb(e);if("string"==typeof i&&-1===sE(i,n)&&-1===sE(i,"$<")){var s=r(t,o,a,i);if(s.done)return s.value}var u=Xb(i);u||(i=Jb(i));var c=o.global;if(c){var d=o.unicode;o.lastIndex=0}for(var l=[];;){var h=tE(o,a);if(null===h)break;if(aE(l,h),!c)break;""===Jb(h[0])&&(o.lastIndex=Zb(a,Yb(o.lastIndex),d))}for(var f,p="",_=0,v=0;v<l.length;v++){for(var m=Jb((h=l[v])[0]),g=nE(iE(qb(h.index),a.length),0),y=[],S=1;S<h.length;S++)aE(y,void 0===(f=h[S])?f:String(f));var b=h.groups;if(u){var E=oE([m],y,g,a);void 0!==b&&aE(E,b);var k=Jb(jb(i,void 0,E))}else k=eE(m,a,g,y,b,i);g>=_&&(p+=uE(a,_,g)+k,_=g+m.length)}return p+uE(a,_)}]}),!lE||!cE||dE);var hE=ae,fE=ne,pE=ke,_E=Vi,vE=Sp,mE=Wr,gE=Ir.f,yE=Kn.f,SE=We,bE=x_,EE=fo,kE=K_,RE=Q_,TE=Xr.exports,IE=oe,AE=Ut,wE=wn.enforce,CE=Wd,OE=ev,NE=nv,xE=Zt("match"),DE=fE.RegExp,PE=DE.prototype,ME=fE.SyntaxError,UE=pE(kE),LE=pE(PE.exec),VE=pE("".charAt),FE=pE("".replace),BE=pE("".indexOf),jE=pE("".slice),GE=/^\?<[^\s\d!#%&*+<=>@^][^\s!#%&*+<=>@^]*>/,HE=/a/g,zE=/a/g,KE=new DE(HE)!==HE,WE=RE.MISSED_STICKY,XE=RE.UNSUPPORTED_Y,qE=hE&&(!KE||WE||OE||NE||IE((function(){return zE[xE]=!1,DE(HE)!=HE||DE(zE)==zE||"/a/i"!=DE(HE,"i")})));if(_E("RegExp",qE)){for(var YE=function(e,t){var r,n,i,o,a,s,u=SE(PE,this),c=bE(e),d=void 0===t,l=[],h=e;if(!u&&c&&d&&e.constructor===YE)return e;if((c||SE(PE,e))&&(e=e.source,d&&(t="flags"in h?h.flags:UE(h))),e=void 0===e?"":EE(e),t=void 0===t?"":EE(t),h=e,OE&&"dotAll"in HE&&(n=!!t&&BE(t,"s")>-1)&&(t=FE(t,/s/g,"")),r=t,WE&&"sticky"in HE&&(i=!!t&&BE(t,"y")>-1)&&XE&&(t=FE(t,/y/g,"")),NE&&(o=function(e){for(var t,r=e.length,n=0,i="",o=[],a={},s=!1,u=!1,c=0,d="";n<=r;n++){if("\\"===(t=VE(e,n)))t+=VE(e,++n);else if("]"===t)s=!1;else if(!s)switch(!0){case"["===t:s=!0;break;case"("===t:LE(GE,jE(e,n+1))&&(n+=2,u=!0),i+=t,c++;continue;case">"===t&&u:if(""===d||AE(a,d))throw new ME("Invalid capture group name");a[d]=!0,o[o.length]=[d,c],u=!1,d="";continue}u?d+=t:i+=t}return[i,o]}(e),e=o[0],l=o[1]),a=vE(DE(e,t),u?this:PE,YE),(n||i||l.length)&&(s=wE(a),n&&(s.dotAll=!0,s.raw=YE(function(e){for(var t,r=e.length,n=0,i="",o=!1;n<=r;n++)"\\"!==(t=VE(e,n))?o||"."!==t?("["===t?o=!0:"]"===t&&(o=!1),i+=t):i+="[\\s\\S]":i+=t+VE(e,++n);return i}(e),r)),i&&(s.sticky=!0),l.length&&(s.groups=l)),e!==h)try{mE(a,"source",""===h?"(?:)":h)}catch(Sq){}return a},JE=function(e){e in YE||gE(YE,e,{configurable:!0,get:function(){return DE[e]},set:function(t){DE[e]=t}})},QE=yE(DE),ZE=0;QE.length>ZE;)JE(QE[ZE++]);PE.constructor=YE,YE.prototype=PE,TE(fE,"RegExp",YE)}CE("RegExp");var $E=ne,ek=ae,tk=ev,rk=Ae,nk=Ir.f,ik=wn.get,ok=RegExp.prototype,ak=$E.TypeError;ek&&tk&&nk(ok,"dotAll",{configurable:!0,get:function(){if(this!==ok){if("RegExp"===rk(this))return!!ik(this).dotAll;throw ak("Incompatible receiver, RegExp required")}}});var sk=ne,uk=ae,ck=Q_.MISSED_STICKY,dk=Ae,lk=Ir.f,hk=wn.get,fk=RegExp.prototype,pk=sk.TypeError;uk&&ck&&lk(fk,"sticky",{configurable:!0,get:function(){if(this!==fk){if("RegExp"===dk(this))return!!hk(this).sticky;throw pk("Incompatible receiver, RegExp required")}}});var _k=ke,vk=Pn.PROPER,mk=Xr.exports,gk=xr,yk=We,Sk=fo,bk=oe,Ek=K_,kk="toString",Rk=RegExp.prototype,Tk=Rk.toString,Ik=_k(Ek),Ak=bk((function(){return"/a/b"!=Tk.call({source:"a",flags:"b"})})),wk=vk&&Tk.name!=kk;(Ak||wk)&&mk(RegExp.prototype,kk,(function(){var e=gk(this),t=Sk(e.source),r=e.flags;return"/"+t+"/"+Sk(void 0===r&&yk(Rk,e)&&!("flags"in Rk)?Ik(e):r)}),{unsafe:!0});var Ck=Wi,Ok=oe,Nk=Ve,xk=ie.f,Dk=ae,Pk=Ok((function(){xk(1)}));Ck({target:"Object",stat:!0,forced:!Dk||Pk,sham:!Dk},{getOwnPropertyDescriptor:function(e,t){return xk(Nk(e),t)}});var Mk=Wi,Uk=Ke,Lk=Qi,Vk=ke,Fk=oe,Bk=ne.Array,jk=Uk("JSON","stringify"),Gk=Vk(/./.exec),Hk=Vk("".charAt),zk=Vk("".charCodeAt),Kk=Vk("".replace),Wk=Vk(1..toString),Xk=/[\uD800-\uDFFF]/g,qk=/^[\uD800-\uDBFF]$/,Yk=/^[\uDC00-\uDFFF]$/,Jk=function(e,t,r){var n=Hk(r,t-1),i=Hk(r,t+1);return Gk(qk,e)&&!Gk(Yk,i)||Gk(Yk,e)&&!Gk(qk,n)?"\\u"+Wk(zk(e,0),16):e},Qk=Fk((function(){return'"\\udf06\\ud834"'!==jk("\udf06\ud834")||'"\\udead"'!==jk("\udead")}));jk&&Mk({target:"JSON",stat:!0,forced:Qk},{stringify:function(e,t,r){for(var n=0,i=arguments.length,o=Bk(i);n<i;n++)o[n]=arguments[n];var a=Lk(jk,null,o);return"string"==typeof a?Kk(a,Xk,Jk):a}});var Zk=_y;function $k(e,t){var r=e&&e.navigator;if(r.mediaDevices){var i=function(e){if("object"!==n(e)||e.mandatory||e.optional)return e;var t={};return Object.keys(e).forEach((function(r){if("require"!==r&&"advanced"!==r&&"mediaSource"!==r){var i="object"===n(e[r])?e[r]:{ideal:e[r]};void 0!==i.exact&&"number"==typeof i.exact&&(i.min=i.max=i.exact);var o=function(e,t){return e?e+t.charAt(0).toUpperCase()+t.slice(1):"deviceId"===t?"sourceId":t};if(void 0!==i.ideal){t.optional=t.optional||[];var a={};"number"==typeof i.ideal?(a[o("min",r)]=i.ideal,t.optional.push(a),(a={})[o("max",r)]=i.ideal,t.optional.push(a)):(a[o("",r)]=i.ideal,t.optional.push(a))}void 0!==i.exact&&"number"!=typeof i.exact?(t.mandatory=t.mandatory||{},t.mandatory[o("",r)]=i.exact):["min","max"].forEach((function(e){void 0!==i[e]&&(t.mandatory=t.mandatory||{},t.mandatory[o(e,r)]=i[e])}))}})),e.advanced&&(t.optional=(t.optional||[]).concat(e.advanced)),t},o=function(e,o){if(t.version>=61)return o(e);if((e=JSON.parse(JSON.stringify(e)))&&"object"===n(e.audio)){var a=function(e,t,r){t in e&&!(r in e)&&(e[r]=e[t],delete e[t])};a((e=JSON.parse(JSON.stringify(e))).audio,"autoGainControl","googAutoGainControl"),a(e.audio,"noiseSuppression","googNoiseSuppression"),e.audio=i(e.audio)}if(e&&"object"===n(e.video)){var s=e.video.facingMode;s=s&&("object"===n(s)?s:{ideal:s});var u,c=t.version<66;if(s&&("user"===s.exact||"environment"===s.exact||"user"===s.ideal||"environment"===s.ideal)&&(!r.mediaDevices.getSupportedConstraints||!r.mediaDevices.getSupportedConstraints().facingMode||c))if(delete e.video.facingMode,"environment"===s.exact||"environment"===s.ideal?u=["back","rear"]:"user"!==s.exact&&"user"!==s.ideal||(u=["front"]),u)return r.mediaDevices.enumerateDevices().then((function(t){var r=(t=t.filter((function(e){return"videoinput"===e.kind}))).find((function(e){return u.some((function(t){return e.label.toLowerCase().includes(t)}))}));return!r&&t.length&&u.includes("back")&&(r=t[t.length-1]),r&&(e.video.deviceId=s.exact?{exact:r.deviceId}:{ideal:r.deviceId}),e.video=i(e.video),Zk("chrome: "+JSON.stringify(e)),o(e)}));e.video=i(e.video)}return Zk("chrome: "+JSON.stringify(e)),o(e)},a=function(e){return t.version>=64?e:{name:{PermissionDeniedError:"NotAllowedError",PermissionDismissedError:"NotAllowedError",InvalidStateError:"NotAllowedError",DevicesNotFoundError:"NotFoundError",ConstraintNotSatisfiedError:"OverconstrainedError",TrackStartError:"NotReadableError",MediaDeviceFailedDueToShutdown:"NotAllowedError",MediaDeviceKillSwitchOn:"NotAllowedError",TabCaptureError:"AbortError",ScreenCaptureError:"AbortError",DeviceCaptureError:"AbortError"}[e.name]||e.name,message:e.message,constraint:e.constraint||e.constraintName,toString:function(){return this.name+(this.message&&": ")+this.message}}};if(r.getUserMedia=function(e,t,n){o(e,(function(e){r.webkitGetUserMedia(e,t,(function(e){n&&n(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 eR(e){e.MediaStream=e.MediaStream||e.webkitMediaStream}function tR(e){if("object"===n(e)&&e.RTCPeerConnection&&!("ontrack"in e.RTCPeerConnection.prototype)){Object.defineProperty(e.RTCPeerConnection.prototype,"ontrack",{get:function(){return this._ontrack},set:function(e){this._ontrack&&this.removeEventListener("track",this._ontrack),this.addEventListener("track",this._ontrack=e)},enumerable:!0,configurable:!0});var t=e.RTCPeerConnection.prototype.setRemoteDescription;e.RTCPeerConnection.prototype.setRemoteDescription=function(){var r=this;return this._ontrackpoly||(this._ontrackpoly=function(t){t.stream.addEventListener("addtrack",(function(n){var i;i=e.RTCPeerConnection.prototype.getReceivers?r.getReceivers().find((function(e){return e.track&&e.track.id===n.track.id})):{track:n.track};var o=new Event("track");o.track=n.track,o.receiver=i,o.transceiver={receiver:i},o.streams=[t.stream],r.dispatchEvent(o)})),t.stream.getTracks().forEach((function(n){var i;i=e.RTCPeerConnection.prototype.getReceivers?r.getReceivers().find((function(e){return e.track&&e.track.id===n.id})):{track:n};var o=new Event("track");o.track=n,o.receiver=i,o.transceiver={receiver:i},o.streams=[t.stream],r.dispatchEvent(o)}))},this.addEventListener("addstream",this._ontrackpoly)),t.apply(this,arguments)}}else hy(e,"track",(function(e){return e.transceiver||Object.defineProperty(e,"transceiver",{value:{receiver:e.receiver}}),e}))}function rR(e){if("object"===n(e)&&e.RTCPeerConnection&&!("getSenders"in e.RTCPeerConnection.prototype)&&"createDTMFSender"in e.RTCPeerConnection.prototype){var t=function(e,t){return{track:t,get dtmf(){return void 0===this._dtmf&&("audio"===t.kind?this._dtmf=e.createDTMFSender(t):this._dtmf=null),this._dtmf},_pc:e}};if(!e.RTCPeerConnection.prototype.getSenders){e.RTCPeerConnection.prototype.getSenders=function(){return this._senders=this._senders||[],this._senders.slice()};var r=e.RTCPeerConnection.prototype.addTrack;e.RTCPeerConnection.prototype.addTrack=function(e,n){var i=r.apply(this,arguments);return i||(i=t(this,e),this._senders.push(i)),i};var i=e.RTCPeerConnection.prototype.removeTrack;e.RTCPeerConnection.prototype.removeTrack=function(e){i.apply(this,arguments);var t=this._senders.indexOf(e);-1!==t&&this._senders.splice(t,1)}}var o=e.RTCPeerConnection.prototype.addStream;e.RTCPeerConnection.prototype.addStream=function(e){var r=this;this._senders=this._senders||[],o.apply(this,[e]),e.getTracks().forEach((function(e){r._senders.push(t(r,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"===n(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 nR(e){if(e.RTCPeerConnection){var t=e.RTCPeerConnection.prototype.getStats;e.RTCPeerConnection.prototype.getStats=function(){var e=this,r=Array.prototype.slice.call(arguments),n=r[0],i=r[1],o=r[2];if(arguments.length>0&&"function"==typeof n)return t.apply(this,arguments);if(0===t.length&&(0===arguments.length||"function"!=typeof n))return t.apply(this,[]);var a=function(e){var t={};return e.result().forEach((function(e){var r={id:e.id,timestamp:e.timestamp,type:{localcandidate:"local-candidate",remotecandidate:"remote-candidate"}[e.type]||e.type};e.names().forEach((function(t){r[t]=e.stat(t)})),t[r.id]=r})),t},s=function(e){return new Map(Object.keys(e).map((function(t){return[t,e[t]]})))};if(arguments.length>=2){var u=function(e){i(s(a(e)))};return t.apply(this,[u,n])}return new Promise((function(r,n){t.apply(e,[function(e){r(s(a(e)))},n])})).then(i,o)}}}function iR(e){if("object"===n(e)&&e.RTCPeerConnection&&e.RTCRtpSender&&e.RTCRtpReceiver){if(!("getStats"in e.RTCRtpSender.prototype)){var t=e.RTCPeerConnection.prototype.getSenders;t&&(e.RTCPeerConnection.prototype.getSenders=function(){var e=this,r=t.apply(this,[]);return r.forEach((function(t){return t._pc=e})),r});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 by(t,e.track,!0)}))}}if(!("getStats"in e.RTCRtpReceiver.prototype)){var i=e.RTCPeerConnection.prototype.getReceivers;i&&(e.RTCPeerConnection.prototype.getReceivers=function(){var e=this,t=i.apply(this,[]);return t.forEach((function(t){return t._pc=e})),t}),hy(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 by(t,e.track,!1)}))}}if("getStats"in e.RTCRtpSender.prototype&&"getStats"in e.RTCRtpReceiver.prototype){var o=e.RTCPeerConnection.prototype.getStats;e.RTCPeerConnection.prototype.getStats=function(){if(arguments.length>0&&arguments[0]instanceof e.MediaStreamTrack){var t,r,n,i=arguments[0];return this.getSenders().forEach((function(e){e.track===i&&(t?n=!0:t=e)})),this.getReceivers().forEach((function(e){return e.track===i&&(r?n=!0:r=e),e.track===i})),n||t&&r?Promise.reject(new DOMException("There are more than one sender or receiver for the track.","InvalidAccessError")):t?t.getStats():r?r.getStats():Promise.reject(new DOMException("There is no sender or receiver for the track.","InvalidAccessError"))}return o.apply(this,arguments)}}}}function oR(e){e.RTCPeerConnection.prototype.getLocalStreams=function(){var e=this;return this._shimmedLocalStreams=this._shimmedLocalStreams||{},Object.keys(this._shimmedLocalStreams).map((function(t){return e._shimmedLocalStreams[t][0]}))};var t=e.RTCPeerConnection.prototype.addTrack;e.RTCPeerConnection.prototype.addTrack=function(e,r){if(!r)return t.apply(this,arguments);this._shimmedLocalStreams=this._shimmedLocalStreams||{};var n=t.apply(this,arguments);return this._shimmedLocalStreams[r.id]?-1===this._shimmedLocalStreams[r.id].indexOf(n)&&this._shimmedLocalStreams[r.id].push(n):this._shimmedLocalStreams[r.id]=[r,n],n};var r=e.RTCPeerConnection.prototype.addStream;e.RTCPeerConnection.prototype.addStream=function(e){var t=this;this._shimmedLocalStreams=this._shimmedLocalStreams||{},e.getTracks().forEach((function(e){if(t.getSenders().find((function(t){return t.track===e})))throw new DOMException("Track already exists.","InvalidAccessError")}));var n=this.getSenders();r.apply(this,arguments);var i=this.getSenders().filter((function(e){return-1===n.indexOf(e)}));this._shimmedLocalStreams[e.id]=[e].concat(i)};var n=e.RTCPeerConnection.prototype.removeStream;e.RTCPeerConnection.prototype.removeStream=function(e){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},delete this._shimmedLocalStreams[e.id],n.apply(this,arguments)};var i=e.RTCPeerConnection.prototype.removeTrack;e.RTCPeerConnection.prototype.removeTrack=function(e){var t=this;return this._shimmedLocalStreams=this._shimmedLocalStreams||{},e&&Object.keys(this._shimmedLocalStreams).forEach((function(r){var n=t._shimmedLocalStreams[r].indexOf(e);-1!==n&&t._shimmedLocalStreams[r].splice(n,1),1===t._shimmedLocalStreams[r].length&&delete t._shimmedLocalStreams[r]})),i.apply(this,arguments)}}function aR(e,t){if(e.RTCPeerConnection){if(e.RTCPeerConnection.prototype.addTrack&&t.version>=65)return oR(e);var r=e.RTCPeerConnection.prototype.getLocalStreams;e.RTCPeerConnection.prototype.getLocalStreams=function(){var e=this,t=r.apply(this);return this._reverseStreams=this._reverseStreams||{},t.map((function(t){return e._reverseStreams[t.id]}))};var n=e.RTCPeerConnection.prototype.addStream;e.RTCPeerConnection.prototype.addStream=function(t){var r=this;if(this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{},t.getTracks().forEach((function(e){if(r.getSenders().find((function(t){return t.track===e})))throw new DOMException("Track already exists.","InvalidAccessError")})),!this._reverseStreams[t.id]){var i=new e.MediaStream(t.getTracks());this._streams[t.id]=i,this._reverseStreams[i.id]=t,t=i}n.apply(this,[t])};var i=e.RTCPeerConnection.prototype.removeStream;e.RTCPeerConnection.prototype.removeStream=function(e){this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{},i.apply(this,[this._streams[e.id]||e]),delete this._reverseStreams[this._streams[e.id]?this._streams[e.id].id:e.id],delete this._streams[e.id]},e.RTCPeerConnection.prototype.addTrack=function(t,r){var n=this;if("closed"===this.signalingState)throw new DOMException("The RTCPeerConnection's signalingState is 'closed'.","InvalidStateError");var i=[].slice.call(arguments,1);if(1!==i.length||!i[0].getTracks().find((function(e){return e===t})))throw new DOMException("The adapter.js addTrack polyfill only supports a single stream which is associated with the specified track.","NotSupportedError");var o=this.getSenders().find((function(e){return e.track===t}));if(o)throw new DOMException("Track already exists.","InvalidAccessError");this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{};var a=this._streams[r.id];if(a)a.addTrack(t),Promise.resolve().then((function(){n.dispatchEvent(new Event("negotiationneeded"))}));else{var s=new e.MediaStream([t]);this._streams[r.id]=s,this._reverseStreams[s.id]=r,this.addStream(s)}return this.getSenders().find((function(e){return e.track===t}))},["createOffer","createAnswer"].forEach((function(t){var r=e.RTCPeerConnection.prototype[t],n=c({},t,(function(){var e=this,t=arguments,n=arguments.length&&"function"==typeof arguments[0];return n?r.apply(this,[function(r){var n=s(e,r);t[0].apply(null,[n])},function(e){t[1]&&t[1].apply(null,e)},arguments[2]]):r.apply(this,arguments).then((function(t){return s(e,t)}))}));e.RTCPeerConnection.prototype[t]=n[t]}));var o=e.RTCPeerConnection.prototype.setLocalDescription;e.RTCPeerConnection.prototype.setLocalDescription=function(){return arguments.length&&arguments[0].type?(arguments[0]=u(this,arguments[0]),o.apply(this,arguments)):o.apply(this,arguments)};var a=Object.getOwnPropertyDescriptor(e.RTCPeerConnection.prototype,"localDescription");Object.defineProperty(e.RTCPeerConnection.prototype,"localDescription",{get:function(){var e=a.get.apply(this);return""===e.type?e:s(this,e)}}),e.RTCPeerConnection.prototype.removeTrack=function(e){var t,r=this;if("closed"===this.signalingState)throw new DOMException("The RTCPeerConnection's signalingState is 'closed'.","InvalidStateError");if(!e._pc)throw new DOMException("Argument 1 of RTCPeerConnection.removeTrack does not implement interface RTCRtpSender.","TypeError");if(!(e._pc===this))throw new DOMException("Sender was not created by this connection.","InvalidAccessError");this._streams=this._streams||{},Object.keys(this._streams).forEach((function(n){r._streams[n].getTracks().find((function(t){return e.track===t}))&&(t=r._streams[n])})),t&&(1===t.getTracks().length?this.removeStream(this._reverseStreams[t.id]):t.removeTrack(e.track),this.dispatchEvent(new Event("negotiationneeded")))}}function s(e,t){var r=t.sdp;return Object.keys(e._reverseStreams||[]).forEach((function(t){var n=e._reverseStreams[t],i=e._streams[n.id];r=r.replace(new RegExp(i.id,"g"),n.id)})),new RTCSessionDescription({type:t.type,sdp:r})}function u(e,t){var r=t.sdp;return Object.keys(e._reverseStreams||[]).forEach((function(t){var n=e._reverseStreams[t],i=e._streams[n.id];r=r.replace(new RegExp(n.id,"g"),i.id)})),new RTCSessionDescription({type:t.type,sdp:r})}}function sR(e,t){!e.RTCPeerConnection&&e.webkitRTCPeerConnection&&(e.RTCPeerConnection=e.webkitRTCPeerConnection),e.RTCPeerConnection&&t.version<53&&["setLocalDescription","setRemoteDescription","addIceCandidate"].forEach((function(t){var r=e.RTCPeerConnection.prototype[t],n=c({},t,(function(){return arguments[0]=new("addIceCandidate"===t?e.RTCIceCandidate:e.RTCSessionDescription)(arguments[0]),r.apply(this,arguments)}));e.RTCPeerConnection.prototype[t]=n[t]}))}function uR(e,t){hy(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 cR,dR,lR=Object.freeze(Object.defineProperty({__proto__:null,shimMediaStream:eR,shimOnTrack:tR,shimGetSendersWithDtmf:rR,shimGetStats:nR,shimSenderReceiverGetStats:iR,shimAddTrackRemoveTrackWithNative:oR,shimAddTrackRemoveTrack:aR,shimPeerConnection:sR,fixNegotiationNeeded:uR,shimGetUserMedia:$k,shimGetDisplayMedia:function(e,t){e.navigator.mediaDevices&&"getDisplayMedia"in e.navigator.mediaDevices||e.navigator.mediaDevices&&("function"==typeof t?e.navigator.mediaDevices.getDisplayMedia=function(r){return t(r).then((function(t){var n=r.video&&r.video.width,i=r.video&&r.video.height,o=r.video&&r.video.frameRate;return r.video={mandatory:{chromeMediaSource:"desktop",chromeMediaSourceId:t,maxFrameRate:o||3}},n&&(r.video.mandatory.maxWidth=n),i&&(r.video.mandatory.maxHeight=i),e.navigator.mediaDevices.getUserMedia(r)}))}:console.error("shimGetDisplayMedia: getSourceId argument is not a function"))}},Symbol.toStringTag,{value:"Module"})),hR=Wi,fR=ne,pR=de,_R=ke,vR=Fe,mR=je,gR=(cR=!1,(dR=/[ac]/).exec=function(){return cR=!0,/./.exec.apply(this,arguments)},!0===dR.test("abc")&&cR),yR=fR.Error,SR=_R(/./.test);hR({target:"RegExp",proto:!0,forced:!gR},{test:function(e){var t=this.exec;if(!vR(t))return SR(this,e);var r=pR(t,this,e);if(null!==r&&!mR(r))throw new yR("RegExp exec method returned something other than an Object or null");return!!r}});var bR=ne,ER=oe,kR=fo,RR=fm.trim,TR=ke("".charAt),IR=bR.parseFloat,AR=bR.Symbol,wR=AR&&AR.iterator,CR=1/IR("\t\n\v\f\r                 \u2028\u2029\ufeff-0")!=-1/0||wR&&!ER((function(){IR(Object(wR))}))?function(e){var t=RR(kR(e)),r=IR(t);return 0===r&&"-"==TR(t,0)?-0:r}:IR;Wi({global:!0,forced:parseFloat!=CR},{parseFloat:CR});var OR=Wi,NR=Fd,xR=oe,DR=Ke,PR=Fe,MR=Wl,UR=rf,LR=Xr.exports;if(OR({target:"Promise",proto:!0,real:!0,forced:!!NR&&xR((function(){NR.prototype.finally.call({then:function(){}},(function(){}))}))},{finally:function(e){var t=MR(this,DR("Promise")),r=PR(e);return this.then(r?function(r){return UR(t,e()).then((function(){return r}))}:e,r?function(r){return UR(t,e()).then((function(){throw r}))}:e)}}),PR(NR)){var VR=DR("Promise").prototype.finally;NR.prototype.finally!==VR&&LR(NR.prototype,"finally",VR,{unsafe:!0})}function FR(e,t){var r=e&&e.navigator,i=e&&e.MediaStreamTrack;if(r.getUserMedia=function(e,t,n){vy("navigator.getUserMedia","navigator.mediaDevices.getUserMedia"),r.mediaDevices.getUserMedia(e).then(t,n)},!(t.version>55&&"autoGainControl"in r.mediaDevices.getSupportedConstraints())){var o=function(e,t,r){t in e&&!(r in e)&&(e[r]=e[t],delete e[t])},a=r.mediaDevices.getUserMedia.bind(r.mediaDevices);if(r.mediaDevices.getUserMedia=function(e){return"object"===n(e)&&"object"===n(e.audio)&&(e=JSON.parse(JSON.stringify(e)),o(e.audio,"autoGainControl","mozAutoGainControl"),o(e.audio,"noiseSuppression","mozNoiseSuppression")),a(e)},i&&i.prototype.getSettings){var s=i.prototype.getSettings;i.prototype.getSettings=function(){var e=s.apply(this,arguments);return o(e,"mozAutoGainControl","autoGainControl"),o(e,"mozNoiseSuppression","noiseSuppression"),e}}if(i&&i.prototype.applyConstraints){var u=i.prototype.applyConstraints;i.prototype.applyConstraints=function(e){return"audio"===this.kind&&"object"===n(e)&&(e=JSON.parse(JSON.stringify(e)),o(e,"autoGainControl","mozAutoGainControl"),o(e,"noiseSuppression","mozNoiseSuppression")),u.apply(this,[e])}}}}function BR(e){"object"===n(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 jR(e,t){if("object"===n(e)&&(e.RTCPeerConnection||e.mozRTCPeerConnection)){!e.RTCPeerConnection&&e.mozRTCPeerConnection&&(e.RTCPeerConnection=e.mozRTCPeerConnection),t.version<53&&["setLocalDescription","setRemoteDescription","addIceCandidate"].forEach((function(t){var r=e.RTCPeerConnection.prototype[t],n=c({},t,(function(){return arguments[0]=new("addIceCandidate"===t?e.RTCIceCandidate:e.RTCSessionDescription)(arguments[0]),r.apply(this,arguments)}));e.RTCPeerConnection.prototype[t]=n[t]}));var r={inboundrtp:"inbound-rtp",outboundrtp:"outbound-rtp",candidatepair:"candidate-pair",localcandidate:"local-candidate",remotecandidate:"remote-candidate"},i=e.RTCPeerConnection.prototype.getStats;e.RTCPeerConnection.prototype.getStats=function(){var e=Array.prototype.slice.call(arguments),n=e[0],o=e[1],a=e[2];return i.apply(this,[n||null]).then((function(e){if(t.version<53&&!o)try{e.forEach((function(e){e.type=r[e.type]||e.type}))}catch(n){if("TypeError"!==n.name)throw n;e.forEach((function(t,n){e.set(n,Object.assign({},t,{type:r[t.type]||t.type}))}))}return e})).then(o,a)}}}function GR(e){if("object"===n(e)&&e.RTCPeerConnection&&e.RTCRtpSender&&(!e.RTCRtpSender||!("getStats"in e.RTCRtpSender.prototype))){var t=e.RTCPeerConnection.prototype.getSenders;t&&(e.RTCPeerConnection.prototype.getSenders=function(){var e=this,r=t.apply(this,[]);return r.forEach((function(t){return t._pc=e})),r});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 HR(e){if("object"===n(e)&&e.RTCPeerConnection&&e.RTCRtpSender&&(!e.RTCRtpSender||!("getStats"in e.RTCRtpReceiver.prototype))){var t=e.RTCPeerConnection.prototype.getReceivers;t&&(e.RTCPeerConnection.prototype.getReceivers=function(){var e=this,r=t.apply(this,[]);return r.forEach((function(t){return t._pc=e})),r}),hy(e,"track",(function(e){return e.receiver._pc=e.srcElement,e})),e.RTCRtpReceiver.prototype.getStats=function(){return this._pc.getStats(this.track)}}}function zR(e){e.RTCPeerConnection&&!("removeStream"in e.RTCPeerConnection.prototype)&&(e.RTCPeerConnection.prototype.removeStream=function(e){var t=this;vy("removeStream","removeTrack"),this.getSenders().forEach((function(r){r.track&&e.getTracks().includes(r.track)&&t.removeTrack(r)}))})}function KR(e){e.DataChannel&&!e.RTCDataChannel&&(e.RTCDataChannel=e.DataChannel)}function WR(e){if("object"===n(e)&&e.RTCPeerConnection){var t=e.RTCPeerConnection.prototype.addTransceiver;t&&(e.RTCPeerConnection.prototype.addTransceiver=function(){this.setParametersPromises=[];var e=arguments[1],r=e&&"sendEncodings"in e;r&&e.sendEncodings.forEach((function(e){if("rid"in e){if(!/^[a-z0-9]{0,16}$/i.test(e.rid))throw new TypeError("Invalid RID value provided.")}if("scaleResolutionDownBy"in e&&!(parseFloat(e.scaleResolutionDownBy)>=1))throw new RangeError("scale_resolution_down_by must be >= 1.0");if("maxFramerate"in e&&!(parseFloat(e.maxFramerate)>=0))throw new RangeError("max_framerate must be >= 0.0")}));var n=t.apply(this,arguments);if(r){var i=n.sender,o=i.getParameters();(!("encodings"in o)||1===o.encodings.length&&0===Object.keys(o.encodings[0]).length)&&(o.encodings=e.sendEncodings,i.sendEncodings=e.sendEncodings,this.setParametersPromises.push(i.setParameters(o).then((function(){delete i.sendEncodings})).catch((function(){delete i.sendEncodings}))))}return n})}}function XR(e){if("object"===n(e)&&e.RTCRtpSender){var t=e.RTCRtpSender.prototype.getParameters;t&&(e.RTCRtpSender.prototype.getParameters=function(){var e=t.apply(this,arguments);return"encodings"in e||(e.encodings=[].concat(this.sendEncodings||[{}])),e})}}function qR(e){if("object"===n(e)&&e.RTCPeerConnection){var t=e.RTCPeerConnection.prototype.createOffer;e.RTCPeerConnection.prototype.createOffer=function(){var e=arguments,r=this;return this.setParametersPromises&&this.setParametersPromises.length?Promise.all(this.setParametersPromises).then((function(){return t.apply(r,e)})).finally((function(){r.setParametersPromises=[]})):t.apply(this,arguments)}}}function YR(e){if("object"===n(e)&&e.RTCPeerConnection){var t=e.RTCPeerConnection.prototype.createAnswer;e.RTCPeerConnection.prototype.createAnswer=function(){var e=arguments,r=this;return this.setParametersPromises&&this.setParametersPromises.length?Promise.all(this.setParametersPromises).then((function(){return t.apply(r,e)})).finally((function(){r.setParametersPromises=[]})):t.apply(this,arguments)}}}var JR=Object.freeze(Object.defineProperty({__proto__:null,shimOnTrack:BR,shimPeerConnection:jR,shimSenderGetStats:GR,shimReceiverGetStats:HR,shimRemoveStream:zR,shimRTCDataChannel:KR,shimAddTransceiver:WR,shimGetParameters:XR,shimCreateOffer:qR,shimCreateAnswer:YR,shimGetUserMedia:FR,shimGetDisplayMedia:function(e,t){e.navigator.mediaDevices&&"getDisplayMedia"in e.navigator.mediaDevices||e.navigator.mediaDevices&&(e.navigator.mediaDevices.getDisplayMedia=function(r){if(!r||!r.video){var n=new DOMException("getDisplayMedia without video constraints is undefined");return n.name="NotFoundError",n.code=8,Promise.reject(n)}return!0===r.video?r.video={mediaSource:t}:r.video.mediaSource=t,e.navigator.mediaDevices.getUserMedia(r)})}},Symbol.toStringTag,{value:"Module"}));function QR(e){if("object"===n(e)&&e.RTCPeerConnection){if("getLocalStreams"in e.RTCPeerConnection.prototype||(e.RTCPeerConnection.prototype.getLocalStreams=function(){return this._localStreams||(this._localStreams=[]),this._localStreams}),!("addStream"in e.RTCPeerConnection.prototype)){var t=e.RTCPeerConnection.prototype.addTrack;e.RTCPeerConnection.prototype.addStream=function(e){var r=this;this._localStreams||(this._localStreams=[]),this._localStreams.includes(e)||this._localStreams.push(e),e.getAudioTracks().forEach((function(n){return t.call(r,n,e)})),e.getVideoTracks().forEach((function(n){return t.call(r,n,e)}))},e.RTCPeerConnection.prototype.addTrack=function(e){for(var r=this,n=arguments.length,i=new Array(n>1?n-1:0),o=1;o<n;o++)i[o-1]=arguments[o];return i&&i.forEach((function(e){r._localStreams?r._localStreams.includes(e)||r._localStreams.push(e):r._localStreams=[e]})),t.apply(this,arguments)}}"removeStream"in e.RTCPeerConnection.prototype||(e.RTCPeerConnection.prototype.removeStream=function(e){var t=this;this._localStreams||(this._localStreams=[]);var r=this._localStreams.indexOf(e);if(-1!==r){this._localStreams.splice(r,1);var n=e.getTracks();this.getSenders().forEach((function(e){n.includes(e.track)&&t.removeTrack(e)}))}})}}function ZR(e){if("object"===n(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 t=e.RTCPeerConnection.prototype.setRemoteDescription;e.RTCPeerConnection.prototype.setRemoteDescription=function(){var e=this;return this._onaddstreampoly||this.addEventListener("track",this._onaddstreampoly=function(t){t.streams.forEach((function(t){if(e._remoteStreams||(e._remoteStreams=[]),!(e._remoteStreams.indexOf(t)>=0)){e._remoteStreams.push(t);var r=new Event("addstream");r.stream=t,e.dispatchEvent(r)}}))}),t.apply(e,arguments)}}}function $R(e){if("object"===n(e)&&e.RTCPeerConnection){var t=e.RTCPeerConnection.prototype,r=t.createOffer,i=t.createAnswer,o=t.setLocalDescription,a=t.setRemoteDescription,s=t.addIceCandidate;t.createOffer=function(e,t){var n=arguments.length>=2?arguments[2]:arguments[0],i=r.apply(this,[n]);return t?(i.then(e,t),Promise.resolve()):i},t.createAnswer=function(e,t){var r=arguments.length>=2?arguments[2]:arguments[0],n=i.apply(this,[r]);return t?(n.then(e,t),Promise.resolve()):n};var u=function(e,t,r){var n=o.apply(this,[e]);return r?(n.then(t,r),Promise.resolve()):n};t.setLocalDescription=u,u=function(e,t,r){var n=a.apply(this,[e]);return r?(n.then(t,r),Promise.resolve()):n},t.setRemoteDescription=u,u=function(e,t,r){var n=s.apply(this,[e]);return r?(n.then(t,r),Promise.resolve()):n},t.addIceCandidate=u}}function eT(e){var t=e&&e.navigator;if(t.mediaDevices&&t.mediaDevices.getUserMedia){var r=t.mediaDevices,n=r.getUserMedia.bind(r);t.mediaDevices.getUserMedia=function(e){return n(tT(e))}}!t.getUserMedia&&t.mediaDevices&&t.mediaDevices.getUserMedia&&(t.getUserMedia=function(e,r,n){t.mediaDevices.getUserMedia(e).then(r,n)}.bind(t))}function tT(e){return e&&void 0!==e.video?Object.assign({},e,{video:yy(e.video)}):e}function rT(e){if(e.RTCPeerConnection){var t=e.RTCPeerConnection;e.RTCPeerConnection=function(e,r){if(e&&e.iceServers){for(var n=[],i=0;i<e.iceServers.length;i++){var o=e.iceServers[i];!o.hasOwnProperty("urls")&&o.hasOwnProperty("url")?(vy("RTCIceServer.url","RTCIceServer.urls"),(o=JSON.parse(JSON.stringify(o))).urls=o.url,delete o.url,n.push(o)):n.push(e.iceServers[i])}e.iceServers=n}return new t(e,r)},e.RTCPeerConnection.prototype=t.prototype,"generateCertificate"in t&&Object.defineProperty(e.RTCPeerConnection,"generateCertificate",{get:function(){return t.generateCertificate}})}}function nT(e){"object"===n(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 iT(e){var t=e.RTCPeerConnection.prototype.createOffer;e.RTCPeerConnection.prototype.createOffer=function(e){if(e){void 0!==e.offerToReceiveAudio&&(e.offerToReceiveAudio=!!e.offerToReceiveAudio);var r=this.getTransceivers().find((function(e){return"audio"===e.receiver.track.kind}));!1===e.offerToReceiveAudio&&r?"sendrecv"===r.direction?r.setDirection?r.setDirection("sendonly"):r.direction="sendonly":"recvonly"===r.direction&&(r.setDirection?r.setDirection("inactive"):r.direction="inactive"):!0!==e.offerToReceiveAudio||r||this.addTransceiver("audio",{direction:"recvonly"}),void 0!==e.offerToReceiveVideo&&(e.offerToReceiveVideo=!!e.offerToReceiveVideo);var n=this.getTransceivers().find((function(e){return"video"===e.receiver.track.kind}));!1===e.offerToReceiveVideo&&n?"sendrecv"===n.direction?n.setDirection?n.setDirection("sendonly"):n.direction="sendonly":"recvonly"===n.direction&&(n.setDirection?n.setDirection("inactive"):n.direction="inactive"):!0!==e.offerToReceiveVideo||n||this.addTransceiver("video",{direction:"recvonly"})}return t.apply(this,arguments)}}function oT(e){"object"!==n(e)||e.AudioContext||(e.AudioContext=e.webkitAudioContext)}var aT=Object.freeze(Object.defineProperty({__proto__:null,shimLocalStreamsAPI:QR,shimRemoteStreamsAPI:ZR,shimCallbacksAPI:$R,shimGetUserMedia:eT,shimConstraints:tT,shimRTCIceServerUrls:rT,shimTrackEventTransceiver:nT,shimCreateOfferLegacy:iT,shimAudioContext:oT},Symbol.toStringTag,{value:"Module"})),sT=de;Wi({target:"URL",proto:!0,enumerable:!0},{toJSON:function(){return sT(URL.prototype.toString,this)}});var uT=ke(1..valueOf),cT=ae,dT=ne,lT=ke,hT=Vi,fT=Xr.exports,pT=Ut,_T=Sp,vT=We,mT=dt,gT=sr,yT=oe,ST=Kn.f,bT=ie.f,ET=Ir.f,kT=uT,RT=fm.trim,TT="Number",IT=dT.Number,AT=IT.prototype,wT=dT.TypeError,CT=lT("".slice),OT=lT("".charCodeAt),NT=function(e){var t=gT(e,"number");return"bigint"==typeof t?t:xT(t)},xT=function(e){var t,r,n,i,o,a,s,u,c=gT(e,"number");if(mT(c))throw wT("Cannot convert a Symbol value to a number");if("string"==typeof c&&c.length>2)if(c=RT(c),43===(t=OT(c,0))||45===t){if(88===(r=OT(c,2))||120===r)return NaN}else if(48===t){switch(OT(c,1)){case 66:case 98:n=2,i=49;break;case 79:case 111:n=8,i=55;break;default:return+c}for(a=(o=CT(c,2)).length,s=0;s<a;s++)if((u=OT(o,s))<48||u>i)return NaN;return parseInt(o,n)}return+c};if(hT(TT,!IT(" 0o1")||!IT("0b1")||IT("+0x1"))){for(var DT,PT=function(e){var t=arguments.length<1?0:IT(NT(e)),r=this;return vT(AT,r)&&yT((function(){kT(r)}))?_T(Object(t),r,PT):t},MT=cT?ST(IT):"MAX_VALUE,MIN_VALUE,NaN,NEGATIVE_INFINITY,POSITIVE_INFINITY,EPSILON,MAX_SAFE_INTEGER,MIN_SAFE_INTEGER,isFinite,isInteger,isNaN,isSafeInteger,parseFloat,parseInt,fromString,range".split(","),UT=0;MT.length>UT;UT++)pT(IT,DT=MT[UT])&&!pT(PT,DT)&&ET(PT,DT,bT(IT,DT));PT.prototype=AT,AT.constructor=PT,fT(dT,TT,PT)}var LT=Qi,VT=de,FT=ke,BT=Dv,jT=x_,GT=xr,HT=Me,zT=Wl,KT=Jv,WT=ti,XT=fo,qT=gt,YT=qo,JT=jv,QT=Rv,ZT=oe,$T=Q_.UNSUPPORTED_Y,eI=4294967295,tI=Math.min,rI=[].push,nI=FT(/./.exec),iI=FT(rI),oI=FT("".slice),aI=!ZT((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]}));BT("split",(function(e,t,r){var n;return n="c"=="abbc".split(/(b)*/)[1]||4!="test".split(/(?:)/,-1).length||2!="ab".split(/(?:ab)*/).length||4!=".".split(/(.?)(.?)/).length||".".split(/()()/).length>1||"".split(/.?/).length?function(e,r){var n=XT(HT(this)),i=void 0===r?eI:r>>>0;if(0===i)return[];if(void 0===e)return[n];if(!jT(e))return VT(t,n,e,i);for(var o,a,s,u=[],c=(e.ignoreCase?"i":"")+(e.multiline?"m":"")+(e.unicode?"u":"")+(e.sticky?"y":""),d=0,l=new RegExp(e.source,c+"g");(o=VT(QT,l,n))&&!((a=l.lastIndex)>d&&(iI(u,oI(n,d,o.index)),o.length>1&&o.index<n.length&&LT(rI,u,YT(o,1)),s=o[0].length,d=a,u.length>=i));)l.lastIndex===o.index&&l.lastIndex++;return d===n.length?!s&&nI(l,"")||iI(u,""):iI(u,oI(n,d)),u.length>i?YT(u,0,i):u}:"0".split(void 0,0).length?function(e,r){return void 0===e&&0===r?[]:VT(t,this,e,r)}:t,[function(t,r){var i=HT(this),o=null==t?void 0:qT(t,e);return o?VT(o,t,i,r):VT(n,XT(i),t,r)},function(e,i){var o=GT(this),a=XT(e),s=r(n,o,a,i,n!==t);if(s.done)return s.value;var u=zT(o,RegExp),c=o.unicode,d=(o.ignoreCase?"i":"")+(o.multiline?"m":"")+(o.unicode?"u":"")+($T?"g":"y"),l=new u($T?"^(?:"+o.source+")":o,d),h=void 0===i?eI:i>>>0;if(0===h)return[];if(0===a.length)return null===JT(l,a)?[a]:[];for(var f=0,p=0,_=[];p<a.length;){l.lastIndex=$T?0:p;var v,m=JT(l,$T?oI(a,p):a);if(null===m||(v=tI(WT(l.lastIndex+($T?p:0)),a.length))===f)p=KT(a,p,c);else{if(iI(_,oI(a,f,p)),_.length===h)return _;for(var g=1;g<=m.length-1;g++)if(iI(_,m[g]),_.length===h)return _;p=f=v}}return iI(_,oI(a,f)),_}]}),!aI,$T);var sI=Pn.PROPER,uI=oe,cI=om,dI=fm.trim;Wi({target:"String",proto:!0,forced:function(e){return uI((function(){return!!cI[e]()||"​…᠎"!=="​…᠎"[e]()||sI&&cI[e].name!==e}))}("trim")},{trim:function(){return dI(this)}});var lI={exports:{}};!function(e){var t={generateIdentifier:function(){return Math.random().toString(36).substr(2,10)}};t.localCName=t.generateIdentifier(),t.splitLines=function(e){return e.trim().split("\n").map((function(e){return e.trim()}))},t.splitSections=function(e){return e.split("\nm=").map((function(e,t){return(t>0?"m="+e:e).trim()+"\r\n"}))},t.getDescription=function(e){var r=t.splitSections(e);return r&&r[0]},t.getMediaSections=function(e){var r=t.splitSections(e);return r.shift(),r},t.matchPrefix=function(e,r){return t.splitLines(e).filter((function(e){return 0===e.indexOf(r)}))},t.parseCandidate=function(e){for(var t,r={foundation:(t=0===e.indexOf("a=candidate:")?e.substring(12).split(" "):e.substring(10).split(" "))[0],component:{1:"rtp",2:"rtcp"}[t[1]]||t[1],protocol:t[2].toLowerCase(),priority:parseInt(t[3],10),ip:t[4],address:t[4],port:parseInt(t[5],10),type:t[7]},n=8;n<t.length;n+=2)switch(t[n]){case"raddr":r.relatedAddress=t[n+1];break;case"rport":r.relatedPort=parseInt(t[n+1],10);break;case"tcptype":r.tcpType=t[n+1];break;case"ufrag":r.ufrag=t[n+1],r.usernameFragment=t[n+1];break;default:void 0===r[t[n]]&&(r[t[n]]=t[n+1])}return r},t.writeCandidate=function(e){var t=[];t.push(e.foundation);var r=e.component;"rtp"===r?t.push(1):"rtcp"===r?t.push(2):t.push(r),t.push(e.protocol.toUpperCase()),t.push(e.priority),t.push(e.address||e.ip),t.push(e.port);var n=e.type;return t.push("typ"),t.push(n),"host"!==n&&e.relatedAddress&&e.relatedPort&&(t.push("raddr"),t.push(e.relatedAddress),t.push("rport"),t.push(e.relatedPort)),e.tcpType&&"tcp"===e.protocol.toLowerCase()&&(t.push("tcptype"),t.push(e.tcpType)),(e.usernameFragment||e.ufrag)&&(t.push("ufrag"),t.push(e.usernameFragment||e.ufrag)),"candidate:"+t.join(" ")},t.parseIceOptions=function(e){return e.substr(14).split(" ")},t.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},t.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"},t.parseExtmap=function(e){var t=e.substr(9).split(" ");return{id:parseInt(t[0],10),direction:t[0].indexOf("/")>0?t[0].split("/")[1]:"sendrecv",uri:t[1]}},t.writeExtmap=function(e){return"a=extmap:"+(e.id||e.preferredId)+(e.direction&&"sendrecv"!==e.direction?"/"+e.direction:"")+" "+e.uri+"\r\n"},t.parseFmtp=function(e){for(var t,r={},n=e.substr(e.indexOf(" ")+1).split(";"),i=0;i<n.length;i++)r[(t=n[i].trim().split("="))[0].trim()]=t[1];return r},t.writeFmtp=function(e){var t="",r=e.payloadType;if(void 0!==e.preferredPayloadType&&(r=e.preferredPayloadType),e.parameters&&Object.keys(e.parameters).length){var n=[];Object.keys(e.parameters).forEach((function(t){void 0!==e.parameters[t]?n.push(t+"="+e.parameters[t]):n.push(t)})),t+="a=fmtp:"+r+" "+n.join(";")+"\r\n"}return t},t.parseRtcpFb=function(e){var t=e.substr(e.indexOf(" ")+1).split(" ");return{type:t.shift(),parameter:t.join(" ")}},t.writeRtcpFb=function(e){var t="",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},t.parseSsrcMedia=function(e){var t=e.indexOf(" "),r={ssrc:parseInt(e.substr(7,t-7),10)},n=e.indexOf(":",t);return n>-1?(r.attribute=e.substr(t+1,n-t-1),r.value=e.substr(n+1)):r.attribute=e.substr(t+1),r},t.parseSsrcGroup=function(e){var t=e.substr(13).split(" ");return{semantics:t.shift(),ssrcs:t.map((function(e){return parseInt(e,10)}))}},t.getMid=function(e){var r=t.matchPrefix(e,"a=mid:")[0];if(r)return r.substr(6)},t.parseFingerprint=function(e){var t=e.substr(14).split(" ");return{algorithm:t[0].toLowerCase(),value:t[1].toUpperCase()}},t.getDtlsParameters=function(e,r){return{role:"auto",fingerprints:t.matchPrefix(e+r,"a=fingerprint:").map(t.parseFingerprint)}},t.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},t.parseCryptoLine=function(e){var t=e.substr(9).split(" ");return{tag:parseInt(t[0],10),cryptoSuite:t[1],keyParams:t[2],sessionParams:t.slice(3)}},t.writeCryptoLine=function(e){return"a=crypto:"+e.tag+" "+e.cryptoSuite+" "+("object"===n(e.keyParams)?t.writeCryptoKeyParams(e.keyParams):e.keyParams)+(e.sessionParams?" "+e.sessionParams.join(" "):"")+"\r\n"},t.parseCryptoKeyParams=function(e){if(0!==e.indexOf("inline:"))return null;var t=e.substr(7).split("|");return{keyMethod:"inline",keySalt:t[0],lifeTime:t[1],mkiValue:t[2]?t[2].split(":")[0]:void 0,mkiLength:t[2]?t[2].split(":")[1]:void 0}},t.writeCryptoKeyParams=function(e){return e.keyMethod+":"+e.keySalt+(e.lifeTime?"|"+e.lifeTime:"")+(e.mkiValue&&e.mkiLength?"|"+e.mkiValue+":"+e.mkiLength:"")},t.getCryptoParameters=function(e,r){return t.matchPrefix(e+r,"a=crypto:").map(t.parseCryptoLine)},t.getIceParameters=function(e,r){var n=t.matchPrefix(e+r,"a=ice-ufrag:")[0],i=t.matchPrefix(e+r,"a=ice-pwd:")[0];return n&&i?{usernameFragment:n.substr(12),password:i.substr(10)}:null},t.writeIceParameters=function(e){var t="a=ice-ufrag:"+e.usernameFragment+"\r\na=ice-pwd:"+e.password+"\r\n";return e.iceLite&&(t+="a=ice-lite\r\n"),t},t.parseRtpParameters=function(e){for(var r={codecs:[],headerExtensions:[],fecMechanisms:[],rtcp:[]},n=t.splitLines(e)[0].split(" "),i=3;i<n.length;i++){var o=n[i],a=t.matchPrefix(e,"a=rtpmap:"+o+" ")[0];if(a){var s=t.parseRtpMap(a),u=t.matchPrefix(e,"a=fmtp:"+o+" ");switch(s.parameters=u.length?t.parseFmtp(u[0]):{},s.rtcpFeedback=t.matchPrefix(e,"a=rtcp-fb:"+o+" ").map(t.parseRtcpFb),r.codecs.push(s),s.name.toUpperCase()){case"RED":case"ULPFEC":r.fecMechanisms.push(s.name.toUpperCase())}}}return t.matchPrefix(e,"a=extmap:").forEach((function(e){r.headerExtensions.push(t.parseExtmap(e))})),r},t.writeRtpDescription=function(e,r){var n="";n+="m="+e+" ",n+=r.codecs.length>0?"9":"0",n+=" UDP/TLS/RTP/SAVPF ",n+=r.codecs.map((function(e){return void 0!==e.preferredPayloadType?e.preferredPayloadType:e.payloadType})).join(" ")+"\r\n",n+="c=IN IP4 0.0.0.0\r\n",n+="a=rtcp:9 IN IP4 0.0.0.0\r\n",r.codecs.forEach((function(e){n+=t.writeRtpMap(e),n+=t.writeFmtp(e),n+=t.writeRtcpFb(e)}));var i=0;return r.codecs.forEach((function(e){e.maxptime>i&&(i=e.maxptime)})),i>0&&(n+="a=maxptime:"+i+"\r\n"),r.headerExtensions&&r.headerExtensions.forEach((function(e){n+=t.writeExtmap(e)})),n},t.parseRtpEncodingParameters=function(e){var r,n=[],i=t.parseRtpParameters(e),o=-1!==i.fecMechanisms.indexOf("RED"),a=-1!==i.fecMechanisms.indexOf("ULPFEC"),s=t.matchPrefix(e,"a=ssrc:").map((function(e){return t.parseSsrcMedia(e)})).filter((function(e){return"cname"===e.attribute})),u=s.length>0&&s[0].ssrc,c=t.matchPrefix(e,"a=ssrc-group:FID").map((function(e){return e.substr(17).split(" ").map((function(e){return parseInt(e,10)}))}));c.length>0&&c[0].length>1&&c[0][0]===u&&(r=c[0][1]),i.codecs.forEach((function(e){if("RTX"===e.name.toUpperCase()&&e.parameters.apt){var t={ssrc:u,codecPayloadType:parseInt(e.parameters.apt,10)};u&&r&&(t.rtx={ssrc:r}),n.push(t),o&&((t=JSON.parse(JSON.stringify(t))).fec={ssrc:u,mechanism:a?"red+ulpfec":"red"},n.push(t))}})),0===n.length&&u&&n.push({ssrc:u});var d=t.matchPrefix(e,"b=");return d.length&&(d=0===d[0].indexOf("b=TIAS:")?parseInt(d[0].substr(7),10):0===d[0].indexOf("b=AS:")?1e3*parseInt(d[0].substr(5),10)*.95-16e3:void 0,n.forEach((function(e){e.maxBitrate=d}))),n},t.parseRtcpParameters=function(e){var r={},n=t.matchPrefix(e,"a=ssrc:").map((function(e){return t.parseSsrcMedia(e)})).filter((function(e){return"cname"===e.attribute}))[0];n&&(r.cname=n.value,r.ssrc=n.ssrc);var i=t.matchPrefix(e,"a=rtcp-rsize");r.reducedSize=i.length>0,r.compound=0===i.length;var o=t.matchPrefix(e,"a=rtcp-mux");return r.mux=o.length>0,r},t.writeRtcpParameters=function(e){var t="";return e.reducedSize&&(t+="a=rtcp-rsize\r\n"),e.mux&&(t+="a=rtcp-mux\r\n"),void 0!==e.ssrc&&e.cname&&(t+="a=ssrc:"+e.ssrc+" cname:"+e.cname+"\r\n"),t},t.parseMsid=function(e){var r,n=t.matchPrefix(e,"a=msid:");if(1===n.length)return{stream:(r=n[0].substr(7).split(" "))[0],track:r[1]};var i=t.matchPrefix(e,"a=ssrc:").map((function(e){return t.parseSsrcMedia(e)})).filter((function(e){return"msid"===e.attribute}));return i.length>0?{stream:(r=i[0].value.split(" "))[0],track:r[1]}:void 0},t.parseSctpDescription=function(e){var r,n=t.parseMLine(e),i=t.matchPrefix(e,"a=max-message-size:");i.length>0&&(r=parseInt(i[0].substr(19),10)),isNaN(r)&&(r=65536);var o=t.matchPrefix(e,"a=sctp-port:");if(o.length>0)return{port:parseInt(o[0].substr(12),10),protocol:n.fmt,maxMessageSize:r};var a=t.matchPrefix(e,"a=sctpmap:");if(a.length>0){var s=a[0].substr(10).split(" ");return{port:parseInt(s[0],10),protocol:s[1],maxMessageSize:r}}},t.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("")},t.generateSessionId=function(){return Math.random().toString().substr(2,21)},t.writeSessionBoilerplate=function(e,r,n){var i=void 0!==r?r:2;return"v=0\r\no="+(n||"thisisadapterortc")+" "+(e||t.generateSessionId())+" "+i+" IN IP4 127.0.0.1\r\ns=-\r\nt=0 0\r\n"},t.getDirection=function(e,r){for(var n=t.splitLines(e),i=0;i<n.length;i++)switch(n[i]){case"a=sendrecv":case"a=sendonly":case"a=recvonly":case"a=inactive":return n[i].substr(2)}return r?t.getDirection(r):"sendrecv"},t.getKind=function(e){return t.splitLines(e)[0].split(" ")[0].substr(2)},t.isRejected=function(e){return"0"===e.split(" ",2)[1]},t.parseMLine=function(e){var r=t.splitLines(e)[0].substr(2).split(" ");return{kind:r[0],port:parseInt(r[1],10),protocol:r[2],fmt:r.slice(3).join(" ")}},t.parseOLine=function(e){var r=t.matchPrefix(e,"o=")[0].substr(2).split(" ");return{username:r[0],sessionId:r[1],sessionVersion:parseInt(r[2],10),netType:r[3],addressType:r[4],address:r[5]}},t.isValidSDP=function(e){if("string"!=typeof e||0===e.length)return!1;for(var r=t.splitLines(e),n=0;n<r.length;n++)if(r[n].length<2||"="!==r[n].charAt(1))return!1;return!0},e.exports=t}(lI);var hI=lI.exports,fI=e({__proto__:null,default:hI},[lI.exports]);function pI(e){if(!(!e.RTCIceCandidate||e.RTCIceCandidate&&"foundation"in e.RTCIceCandidate.prototype)){var t=e.RTCIceCandidate;e.RTCIceCandidate=function(e){if("object"===n(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 t(e),i=hI.parseCandidate(e.candidate),o=Object.assign(r,i);return o.toJSON=function(){return{candidate:o.candidate,sdpMid:o.sdpMid,sdpMLineIndex:o.sdpMLineIndex,usernameFragment:o.usernameFragment}},o}return new t(e)},e.RTCIceCandidate.prototype=t.prototype,hy(e,"icecandidate",(function(t){return t.candidate&&Object.defineProperty(t,"candidate",{value:new e.RTCIceCandidate(t.candidate),writable:"false"}),t}))}}function _I(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=hI.splitSections(e.sdp);return t.shift(),t.some((function(e){var t=hI.parseMLine(e);return t&&"application"===t.kind&&-1!==t.protocol.indexOf("SCTP")}))},n=function(e){var t=e.sdp.match(/mozilla...THIS_IS_SDPARTA-(\d+)/);if(null===t||t.length<2)return-1;var r=parseInt(t[1],10);return r!=r?-1:r},i=function(e){var r=65536;return"firefox"===t.browser&&(r=t.version<57?-1===e?16384:2147483637:t.version<60?57===t.version?65535:65536:2147483637),r},o=function(e,r){var n=65536;"firefox"===t.browser&&57===t.version&&(n=65535);var i=hI.matchPrefix(e.sdp,"a=max-message-size:");return i.length>0?n=parseInt(i[0].substr(19),10):"firefox"===t.browser&&-1!==r&&(n=2147483637),n},a=e.RTCPeerConnection.prototype.setRemoteDescription;e.RTCPeerConnection.prototype.setRemoteDescription=function(){if(this._sctp=null,"chrome"===t.browser&&t.version>=76){var e=this.getConfiguration(),s=e.sdpSemantics;"plan-b"===s&&Object.defineProperty(this,"sctp",{get:function(){return void 0===this._sctp?null:this._sctp},enumerable:!0,configurable:!0})}if(r(arguments[0])){var u,c=n(arguments[0]),d=i(c),l=o(arguments[0],c);u=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 u}}),this._sctp=h}return a.apply(this,arguments)}}}function vI(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},hy(e,"datachannel",(function(e){return r(e.channel,e.target),e}))}function r(e,t){var r=e.send;e.send=function(){var n=arguments[0],i=n.length||n.size||n.byteLength;if("open"===e.readyState&&t.sctp&&i>t.sctp.maxMessageSize)throw new TypeError("Message too large (can send a maximum of "+t.sctp.maxMessageSize+" bytes)");return r.apply(e,arguments)}}}function mI(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 gI(e,t){if(e.RTCPeerConnection&&!("chrome"===t.browser&&t.version>=71||"safari"===t.browser&&t.version>=605)){var r=e.RTCPeerConnection.prototype.setRemoteDescription;e.RTCPeerConnection.prototype.setRemoteDescription=function(t){if(t&&t.sdp&&-1!==t.sdp.indexOf("\na=extmap-allow-mixed")){var n=t.sdp.split("\n").filter((function(e){return"a=extmap-allow-mixed"!==e.trim()})).join("\n");e.RTCSessionDescription&&t instanceof e.RTCSessionDescription?arguments[0]=new e.RTCSessionDescription({type:t.type,sdp:n}):t.sdp=n}return r.apply(this,arguments)}}}function yI(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 SI(e,t){if(e.RTCPeerConnection&&e.RTCPeerConnection.prototype){var r=e.RTCPeerConnection.prototype.setLocalDescription;r&&0!==r.length&&(e.RTCPeerConnection.prototype.setLocalDescription=function(){var e=this,t=arguments[0]||{};if("object"!==n(t)||t.type&&t.sdp)return r.apply(this,arguments);if(!(t={type:t.type,sdp:t.sdp}).type)switch(this.signalingState){case"stable":case"have-local-offer":case"have-remote-pranswer":t.type="offer";break;default:t.type="answer"}if(t.sdp||"offer"!==t.type&&"answer"!==t.type)return r.apply(this,[t]);var i="offer"===t.type?this.createOffer:this.createAnswer;return i.apply(this).then((function(t){return r.apply(e,[t])}))})}}var bI=Object.freeze(Object.defineProperty({__proto__:null,shimRTCIceCandidate:pI,shimMaxMessageSize:_I,shimSendThrowTypeError:vI,shimConnectionState:mI,removeExtmapAllowMixed:gI,shimAddIceCandidateNullOrEmpty:yI,shimParameterlessSetLocalDescription:SI},Symbol.toStringTag,{value:"Module"}));!function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.window,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{shimChrome:!0,shimFirefox:!0,shimSafari:!0},n=_y,i=my(t),o={browserDetails:i,commonShim:bI,extractVersion:ly,disableLog:fy,disableWarnings:py,sdp:fI};switch(i.browser){case"chrome":if(!lR||!sR||!r.shimChrome)return n("Chrome shim is not included in this adapter release."),o;if(null===i.version)return n("Chrome shim can not determine version, not shimming."),o;n("adapter.js shimming chrome."),o.browserShim=lR,yI(t,i),SI(t),$k(t,i),eR(t),sR(t,i),tR(t),aR(t,i),rR(t),nR(t),iR(t),uR(t,i),pI(t),mI(t),_I(t,i),vI(t),gI(t,i);break;case"firefox":if(!JR||!jR||!r.shimFirefox)return n("Firefox shim is not included in this adapter release."),o;n("adapter.js shimming firefox."),o.browserShim=JR,yI(t,i),SI(t),FR(t,i),jR(t,i),BR(t),zR(t),GR(t),HR(t),KR(t),WR(t),XR(t),qR(t),YR(t),pI(t),mI(t),_I(t,i),vI(t);break;case"safari":if(!aT||!r.shimSafari)return n("Safari shim is not included in this adapter release."),o;n("adapter.js shimming safari."),o.browserShim=aT,yI(t,i),SI(t),rT(t),iT(t),$R(t),QR(t),ZR(t),nT(t),eT(t),oT(t),pI(t),_I(t,i),vI(t),gI(t,i);break;default:n("Unsupported browser!")}}({window:"undefined"==typeof window?void 0:window});var EI=qo,kI=Math.floor,RI=function(e,t){var r=e.length,n=kI(r/2);return r<8?TI(e,t):II(e,RI(EI(e,0,n),t),RI(EI(e,n),t),t)},TI=function(e,t){for(var r,n,i=e.length,o=1;o<i;){for(n=o,r=e[o];n&&t(e[n-1],r)>0;)e[n]=e[--n];n!==o++&&(e[n]=r)}return e},II=function(e,t,r,n){for(var i=t.length,o=r.length,a=0,s=0;a<i||s<o;)e[a+s]=a<i&&s<o?n(t[a],r[s])<=0?t[a++]:r[s++]:a<i?t[a++]:r[s++];return e},AI=RI,wI=Xe.match(/firefox\/(\d+)/i),CI=!!wI&&+wI[1],OI=/MSIE|Trident/.test(Xe),NI=Xe.match(/AppleWebKit\/(\d+)\./),xI=!!NI&&+NI[1],DI=Wi,PI=ke,MI=vt,UI=Dt,LI=ni,VI=fo,FI=oe,BI=AI,jI=Zp,GI=CI,HI=OI,zI=et,KI=xI,WI=[],XI=PI(WI.sort),qI=PI(WI.push),YI=FI((function(){WI.sort(void 0)})),JI=FI((function(){WI.sort(null)})),QI=jI("sort"),ZI=!FI((function(){if(zI)return zI<70;if(!(GI&&GI>3)){if(HI)return!0;if(KI)return KI<603;var e,t,r,n,i="";for(e=65;e<76;e++){switch(t=String.fromCharCode(e),e){case 66:case 69:case 70:case 72:r=3;break;case 68:case 71:r=4;break;default:r=2}for(n=0;n<47;n++)WI.push({k:t+n,v:r})}for(WI.sort((function(e,t){return t.v-e.v})),n=0;n<WI.length;n++)t=WI[n].k.charAt(0),i.charAt(i.length-1)!==t&&(i+=t);return"DGBEFHACIJK"!==i}}));DI({target:"Array",proto:!0,forced:YI||!JI||!QI||!ZI},{sort:function(e){void 0!==e&&MI(e);var t=UI(this);if(ZI)return void 0===e?XI(t):XI(t,e);var r,n,i=[],o=LI(t);for(n=0;n<o;n++)n in t&&qI(i,t[n]);for(BI(i,function(e){return function(t,r){return void 0===r?-1:void 0===t?1:void 0!==e?+e(t,r)||0:VI(t)>VI(r)?1:-1}}(e)),r=i.length,n=0;n<r;)t[n]=i[n++];for(;n<o;)delete t[n++];return t}});var $I,eA,tA,rA={exports:{}},nA="undefined"!=typeof ArrayBuffer&&"undefined"!=typeof DataView,iA=nA,oA=ae,aA=ne,sA=Fe,uA=je,cA=Ut,dA=co,lA=ht,hA=Wr,fA=Xr.exports,pA=Ir.f,_A=We,vA=$u,mA=Ec,gA=Zt,yA=jt,SA=aA.Int8Array,bA=SA&&SA.prototype,EA=aA.Uint8ClampedArray,kA=EA&&EA.prototype,RA=SA&&vA(SA),TA=bA&&vA(bA),IA=Object.prototype,AA=aA.TypeError,wA=gA("toStringTag"),CA=yA("TYPED_ARRAY_TAG"),OA=yA("TYPED_ARRAY_CONSTRUCTOR"),NA=iA&&!!mA&&"Opera"!==dA(aA.opera),xA=!1,DA={Int8Array:1,Uint8Array:1,Uint8ClampedArray:1,Int16Array:2,Uint16Array:2,Int32Array:4,Uint32Array:4,Float32Array:4,Float64Array:8},PA={BigInt64Array:8,BigUint64Array:8},MA=function(e){if(!uA(e))return!1;var t=dA(e);return cA(DA,t)||cA(PA,t)};for($I in DA)(tA=(eA=aA[$I])&&eA.prototype)?hA(tA,OA,eA):NA=!1;for($I in PA)(tA=(eA=aA[$I])&&eA.prototype)&&hA(tA,OA,eA);if((!NA||!sA(RA)||RA===Function.prototype)&&(RA=function(){throw AA("Incorrect invocation")},NA))for($I in DA)aA[$I]&&mA(aA[$I],RA);if((!NA||!TA||TA===IA)&&(TA=RA.prototype,NA))for($I in DA)aA[$I]&&mA(aA[$I].prototype,TA);if(NA&&vA(kA)!==TA&&mA(kA,TA),oA&&!cA(TA,wA))for($I in xA=!0,pA(TA,wA,{get:function(){return uA(this)?this[CA]:void 0}}),DA)aA[$I]&&hA(aA[$I],CA,$I);var UA={NATIVE_ARRAY_BUFFER_VIEWS:NA,TYPED_ARRAY_CONSTRUCTOR:OA,TYPED_ARRAY_TAG:xA&&CA,aTypedArray:function(e){if(MA(e))return e;throw AA("Target is not a typed array")},aTypedArrayConstructor:function(e){if(sA(e)&&(!mA||_A(RA,e)))return e;throw AA(lA(e)+" is not a typed array constructor")},exportTypedArrayMethod:function(e,t,r,n){if(oA){if(r)for(var i in DA){var o=aA[i];if(o&&cA(o.prototype,e))try{delete o.prototype[e]}catch(Sq){try{o.prototype[e]=t}catch(a){}}}TA[e]&&!r||fA(TA,e,r?t:NA&&bA[e]||t,n)}},exportTypedArrayStaticMethod:function(e,t,r){var n,i;if(oA){if(mA){if(r)for(n in DA)if((i=aA[n])&&cA(i,e))try{delete i[e]}catch(Sq){}if(RA[e]&&!r)return;try{return fA(RA,e,r?t:NA&&RA[e]||t)}catch(Sq){}}for(n in DA)!(i=aA[n])||i[e]&&!r||fA(i,e,t)}},isView:function(e){if(!uA(e))return!1;var t=dA(e);return"DataView"===t||cA(DA,t)||cA(PA,t)},isTypedArray:MA,TypedArray:RA,TypedArrayPrototype:TA},LA=ne,VA=oe,FA=Vl,BA=UA.NATIVE_ARRAY_BUFFER_VIEWS,jA=LA.ArrayBuffer,GA=LA.Int8Array,HA=!BA||!VA((function(){GA(1)}))||!VA((function(){new GA(-1)}))||!FA((function(e){new GA,new GA(null),new GA(1.5),new GA(e)}),!0)||VA((function(){return 1!==new GA(new jA(2),1,void 0).length})),zA=qn,KA=ti,WA=ne.RangeError,XA=function(e){if(void 0===e)return 0;var t=zA(e),r=KA(t);if(t!==r)throw WA("Wrong length or index");return r},qA=ne.Array,YA=Math.abs,JA=Math.pow,QA=Math.floor,ZA=Math.log,$A=Math.LN2,ew={pack:function(e,t,r){var n,i,o,a=qA(r),s=8*r-t-1,u=(1<<s)-1,c=u>>1,d=23===t?JA(2,-24)-JA(2,-77):0,l=e<0||0===e&&1/e<0?1:0,h=0;for((e=YA(e))!=e||e===1/0?(i=e!=e?1:0,n=u):(n=QA(ZA(e)/$A),e*(o=JA(2,-n))<1&&(n--,o*=2),(e+=n+c>=1?d/o:d*JA(2,1-c))*o>=2&&(n++,o/=2),n+c>=u?(i=0,n=u):n+c>=1?(i=(e*o-1)*JA(2,t),n+=c):(i=e*JA(2,c-1)*JA(2,t),n=0));t>=8;)a[h++]=255&i,i/=256,t-=8;for(n=n<<t|i,s+=t;s>0;)a[h++]=255&n,n/=256,s-=8;return a[--h]|=128*l,a},unpack:function(e,t){var r,n=e.length,i=8*n-t-1,o=(1<<i)-1,a=o>>1,s=i-7,u=n-1,c=e[u--],d=127&c;for(c>>=7;s>0;)d=256*d+e[u--],s-=8;for(r=d&(1<<-s)-1,d>>=-s,s+=t;s>0;)r=256*r+e[u--],s-=8;if(0===d)d=1-a;else{if(d===o)return r?NaN:c?-1/0:1/0;r+=JA(2,t),d-=a}return(c?-1:1)*r*JA(2,d-t)}},tw=Dt,rw=Zn,nw=ni,iw=function(e){for(var t=tw(this),r=nw(t),n=arguments.length,i=rw(n>1?arguments[1]:void 0,r),o=n>2?arguments[2]:void 0,a=void 0===o?r:rw(o,r);a>i;)t[i++]=e;return t},ow=ne,aw=ke,sw=ae,uw=nA,cw=Pn,dw=Wr,lw=jd,hw=oe,fw=Yd,pw=qn,_w=ti,vw=XA,mw=ew,gw=$u,yw=Ec,Sw=Kn.f,bw=Ir.f,Ew=iw,kw=qo,Rw=la,Tw=cw.PROPER,Iw=cw.CONFIGURABLE,Aw=wn.get,ww=wn.set,Cw="ArrayBuffer",Ow="DataView",Nw="Wrong index",xw=ow.ArrayBuffer,Dw=xw,Pw=Dw&&Dw.prototype,Mw=ow.DataView,Uw=Mw&&Mw.prototype,Lw=Object.prototype,Vw=ow.Array,Fw=ow.RangeError,Bw=aw(Ew),jw=aw([].reverse),Gw=mw.pack,Hw=mw.unpack,zw=function(e){return[255&e]},Kw=function(e){return[255&e,e>>8&255]},Ww=function(e){return[255&e,e>>8&255,e>>16&255,e>>24&255]},Xw=function(e){return e[3]<<24|e[2]<<16|e[1]<<8|e[0]},qw=function(e){return Gw(e,23,4)},Yw=function(e){return Gw(e,52,8)},Jw=function(e,t){bw(e.prototype,t,{get:function(){return Aw(this)[t]}})},Qw=function(e,t,r,n){var i=vw(r),o=Aw(e);if(i+t>o.byteLength)throw Fw(Nw);var a=Aw(o.buffer).bytes,s=i+o.byteOffset,u=kw(a,s,s+t);return n?u:jw(u)},Zw=function(e,t,r,n,i,o){var a=vw(r),s=Aw(e);if(a+t>s.byteLength)throw Fw(Nw);for(var u=Aw(s.buffer).bytes,c=a+s.byteOffset,d=n(+i),l=0;l<t;l++)u[c+l]=d[o?l:t-l-1]};if(uw){var $w=Tw&&xw.name!==Cw;if(hw((function(){xw(1)}))&&hw((function(){new xw(-1)}))&&!hw((function(){return new xw,new xw(1.5),new xw(NaN),$w&&!Iw})))$w&&Iw&&dw(xw,"name",Cw);else{(Dw=function(e){return fw(this,Pw),new xw(vw(e))}).prototype=Pw;for(var eC,tC=Sw(xw),rC=0;tC.length>rC;)(eC=tC[rC++])in Dw||dw(Dw,eC,xw[eC]);Pw.constructor=Dw}yw&&gw(Uw)!==Lw&&yw(Uw,Lw);var nC=new Mw(new Dw(2)),iC=aw(Uw.setInt8);nC.setInt8(0,2147483648),nC.setInt8(1,2147483649),!nC.getInt8(0)&&nC.getInt8(1)||lw(Uw,{setInt8:function(e,t){iC(this,e,t<<24>>24)},setUint8:function(e,t){iC(this,e,t<<24>>24)}},{unsafe:!0})}else Pw=(Dw=function(e){fw(this,Pw);var t=vw(e);ww(this,{bytes:Bw(Vw(t),0),byteLength:t}),sw||(this.byteLength=t)}).prototype,Uw=(Mw=function(e,t,r){fw(this,Uw),fw(e,Pw);var n=Aw(e).byteLength,i=pw(t);if(i<0||i>n)throw Fw("Wrong offset");if(i+(r=void 0===r?n-i:_w(r))>n)throw Fw("Wrong length");ww(this,{buffer:e,byteLength:r,byteOffset:i}),sw||(this.buffer=e,this.byteLength=r,this.byteOffset=i)}).prototype,sw&&(Jw(Dw,"byteLength"),Jw(Mw,"buffer"),Jw(Mw,"byteLength"),Jw(Mw,"byteOffset")),lw(Uw,{getInt8:function(e){return Qw(this,1,e)[0]<<24>>24},getUint8:function(e){return Qw(this,1,e)[0]},getInt16:function(e){var t=Qw(this,2,e,arguments.length>1?arguments[1]:void 0);return(t[1]<<8|t[0])<<16>>16},getUint16:function(e){var t=Qw(this,2,e,arguments.length>1?arguments[1]:void 0);return t[1]<<8|t[0]},getInt32:function(e){return Xw(Qw(this,4,e,arguments.length>1?arguments[1]:void 0))},getUint32:function(e){return Xw(Qw(this,4,e,arguments.length>1?arguments[1]:void 0))>>>0},getFloat32:function(e){return Hw(Qw(this,4,e,arguments.length>1?arguments[1]:void 0),23)},getFloat64:function(e){return Hw(Qw(this,8,e,arguments.length>1?arguments[1]:void 0),52)},setInt8:function(e,t){Zw(this,1,e,zw,t)},setUint8:function(e,t){Zw(this,1,e,zw,t)},setInt16:function(e,t){Zw(this,2,e,Kw,t,arguments.length>2?arguments[2]:void 0)},setUint16:function(e,t){Zw(this,2,e,Kw,t,arguments.length>2?arguments[2]:void 0)},setInt32:function(e,t){Zw(this,4,e,Ww,t,arguments.length>2?arguments[2]:void 0)},setUint32:function(e,t){Zw(this,4,e,Ww,t,arguments.length>2?arguments[2]:void 0)},setFloat32:function(e,t){Zw(this,4,e,qw,t,arguments.length>2?arguments[2]:void 0)},setFloat64:function(e,t){Zw(this,8,e,Yw,t,arguments.length>2?arguments[2]:void 0)}});Rw(Dw,Cw),Rw(Mw,Ow);var oC={ArrayBuffer:Dw,DataView:Mw},aC=je,sC=Math.floor,uC=Number.isInteger||function(e){return!aC(e)&&isFinite(e)&&sC(e)===e},cC=qn,dC=ne.RangeError,lC=function(e){var t=cC(e);if(t<0)throw dC("The argument can't be less than 0");return t},hC=ne.RangeError,fC=function(e,t){var r=lC(e);if(r%t)throw hC("Wrong offset");return r},pC=_a,_C=de,vC=Gl,mC=Dt,gC=ni,yC=ll,SC=il,bC=$d,EC=UA.aTypedArrayConstructor,kC=Wi,RC=ne,TC=de,IC=ae,AC=HA,wC=UA,CC=oC,OC=Yd,NC=me,xC=Wr,DC=uC,PC=ti,MC=XA,UC=fC,LC=dr,VC=Ut,FC=co,BC=je,jC=dt,GC=Lo,HC=We,zC=Ec,KC=Kn.f,WC=function(e){var t,r,n,i,o,a,s=vC(this),u=mC(e),c=arguments.length,d=c>1?arguments[1]:void 0,l=void 0!==d,h=SC(u);if(h&&!bC(h))for(a=(o=yC(u,h)).next,u=[];!(i=_C(a,o)).done;)u.push(i.value);for(l&&c>2&&(d=pC(d,arguments[2])),r=gC(u),n=new(EC(s))(r),t=0;r>t;t++)n[t]=l?d(u[t],t):u[t];return n},XC=Ka.forEach,qC=Wd,YC=Ir,JC=ie,QC=Sp,ZC=wn.get,$C=wn.set,eO=YC.f,tO=JC.f,rO=Math.round,nO=RC.RangeError,iO=CC.ArrayBuffer,oO=iO.prototype,aO=CC.DataView,sO=wC.NATIVE_ARRAY_BUFFER_VIEWS,uO=wC.TYPED_ARRAY_CONSTRUCTOR,cO=wC.TYPED_ARRAY_TAG,dO=wC.TypedArray,lO=wC.TypedArrayPrototype,hO=wC.aTypedArrayConstructor,fO=wC.isTypedArray,pO="BYTES_PER_ELEMENT",_O="Wrong length",vO=function(e,t){hO(e);for(var r=0,n=t.length,i=new e(n);n>r;)i[r]=t[r++];return i},mO=function(e,t){eO(e,t,{get:function(){return ZC(this)[t]}})},gO=function(e){var t;return HC(oO,e)||"ArrayBuffer"==(t=FC(e))||"SharedArrayBuffer"==t},yO=function(e,t){return fO(e)&&!jC(t)&&t in e&&DC(+t)&&t>=0},SO=function(e,t){return t=LC(t),yO(e,t)?NC(2,e[t]):tO(e,t)},bO=function(e,t,r){return t=LC(t),!(yO(e,t)&&BC(r)&&VC(r,"value"))||VC(r,"get")||VC(r,"set")||r.configurable||VC(r,"writable")&&!r.writable||VC(r,"enumerable")&&!r.enumerable?eO(e,t,r):(e[t]=r.value,e)};IC?(sO||(JC.f=SO,YC.f=bO,mO(lO,"buffer"),mO(lO,"byteOffset"),mO(lO,"byteLength"),mO(lO,"length")),kC({target:"Object",stat:!0,forced:!sO},{getOwnPropertyDescriptor:SO,defineProperty:bO}),rA.exports=function(e,t,r){var n=e.match(/\d+$/)[0]/8,i=e+(r?"Clamped":"")+"Array",o="get"+e,a="set"+e,s=RC[i],u=s,c=u&&u.prototype,d={},l=function(e,t){eO(e,t,{get:function(){return function(e,t){var r=ZC(e);return r.view[o](t*n+r.byteOffset,!0)}(this,t)},set:function(e){return function(e,t,i){var o=ZC(e);r&&(i=(i=rO(i))<0?0:i>255?255:255&i),o.view[a](t*n+o.byteOffset,i,!0)}(this,t,e)},enumerable:!0})};sO?AC&&(u=t((function(e,t,r,i){return OC(e,c),QC(BC(t)?gO(t)?void 0!==i?new s(t,UC(r,n),i):void 0!==r?new s(t,UC(r,n)):new s(t):fO(t)?vO(u,t):TC(WC,u,t):new s(MC(t)),e,u)})),zC&&zC(u,dO),XC(KC(s),(function(e){e in u||xC(u,e,s[e])})),u.prototype=c):(u=t((function(e,t,r,i){OC(e,c);var o,a,s,d=0,h=0;if(BC(t)){if(!gO(t))return fO(t)?vO(u,t):TC(WC,u,t);o=t,h=UC(r,n);var f=t.byteLength;if(void 0===i){if(f%n)throw nO(_O);if((a=f-h)<0)throw nO(_O)}else if((a=PC(i)*n)+h>f)throw nO(_O);s=a/n}else s=MC(t),o=new iO(a=s*n);for($C(e,{buffer:o,byteOffset:h,byteLength:a,length:s,view:new aO(o)});d<s;)l(e,d++)})),zC&&zC(u,dO),c=u.prototype=GC(lO)),c.constructor!==u&&xC(c,"constructor",u),xC(c,uO,u),cO&&xC(c,cO,i),d[i]=u,kC({global:!0,forced:u!=s,sham:!sO},d),pO in u||xC(u,pO,n),pO in c||xC(c,pO,n),qC(i)}):rA.exports=function(){},(0,rA.exports)("Uint8",(function(e){return function(t,r,n){return e(this,t,r,n)}}));var EO=ni,kO=qn,RO=UA.aTypedArray;(0,UA.exportTypedArrayMethod)("at",(function(e){var t=RO(this),r=EO(t),n=kO(e),i=n>=0?n:r+n;return i<0||i>=r?void 0:t[i]}));var TO=Dt,IO=Zn,AO=ni,wO=Math.min,CO=[].copyWithin||function(e,t){var r=TO(this),n=AO(r),i=IO(e,n),o=IO(t,n),a=arguments.length>2?arguments[2]:void 0,s=wO((void 0===a?n:IO(a,n))-o,n-i),u=1;for(o<i&&i<o+s&&(u=-1,o+=s-1,i+=s-1);s-- >0;)o in r?r[i]=r[o]:delete r[i],i+=u,o+=u;return r},OO=UA,NO=ke(CO),xO=OO.aTypedArray;(0,OO.exportTypedArrayMethod)("copyWithin",(function(e,t){return NO(xO(this),e,t,arguments.length>2?arguments[2]:void 0)}));var DO=Ka.every,PO=UA.aTypedArray;(0,UA.exportTypedArrayMethod)("every",(function(e){return DO(PO(this),e,arguments.length>1?arguments[1]:void 0)}));var MO=de,UO=iw,LO=UA.aTypedArray;(0,UA.exportTypedArrayMethod)("fill",(function(e){var t=arguments.length;return MO(UO,LO(this),e,t>1?arguments[1]:void 0,t>2?arguments[2]:void 0)}));var VO=ni,FO=Wl,BO=UA.TYPED_ARRAY_CONSTRUCTOR,jO=UA.aTypedArrayConstructor,GO=function(e){return jO(FO(e,e[BO]))},HO=function(e,t){for(var r=0,n=VO(t),i=new e(n);n>r;)i[r]=t[r++];return i},zO=GO,KO=Ka.filter,WO=function(e,t){return HO(zO(e),t)},XO=UA.aTypedArray;(0,UA.exportTypedArrayMethod)("filter",(function(e){var t=KO(XO(this),e,arguments.length>1?arguments[1]:void 0);return WO(this,t)}));var qO=Ka.find,YO=UA.aTypedArray;(0,UA.exportTypedArrayMethod)("find",(function(e){return qO(YO(this),e,arguments.length>1?arguments[1]:void 0)}));var JO=Ka.findIndex,QO=UA.aTypedArray;(0,UA.exportTypedArrayMethod)("findIndex",(function(e){return JO(QO(this),e,arguments.length>1?arguments[1]:void 0)}));var ZO=Ka.forEach,$O=UA.aTypedArray;(0,UA.exportTypedArrayMethod)("forEach",(function(e){ZO($O(this),e,arguments.length>1?arguments[1]:void 0)}));var eN=ui.includes,tN=UA.aTypedArray;(0,UA.exportTypedArrayMethod)("includes",(function(e){return eN(tN(this),e,arguments.length>1?arguments[1]:void 0)}));var rN=ui.indexOf,nN=UA.aTypedArray;(0,UA.exportTypedArrayMethod)("indexOf",(function(e){return rN(nN(this),e,arguments.length>1?arguments[1]:void 0)}));var iN=ne,oN=oe,aN=ke,sN=UA,uN=ed,cN=Zt("iterator"),dN=iN.Uint8Array,lN=aN(uN.values),hN=aN(uN.keys),fN=aN(uN.entries),pN=sN.aTypedArray,_N=sN.exportTypedArrayMethod,vN=dN&&dN.prototype,mN=!oN((function(){vN[cN].call([1])})),gN=!!vN&&vN.values&&vN[cN]===vN.values&&"values"===vN.values.name,yN=function(){return lN(pN(this))};_N("entries",(function(){return fN(pN(this))}),mN),_N("keys",(function(){return hN(pN(this))}),mN),_N("values",yN,mN||!gN,{name:"values"}),_N(cN,yN,mN||!gN,{name:"values"});var SN=UA.aTypedArray,bN=UA.exportTypedArrayMethod,EN=ke([].join);bN("join",(function(e){return EN(SN(this),e)}));var kN=Qi,RN=Ve,TN=qn,IN=ni,AN=Zp,wN=Math.min,CN=[].lastIndexOf,ON=!!CN&&1/[1].lastIndexOf(1,-0)<0,NN=AN("lastIndexOf"),xN=ON||!NN?function(e){if(ON)return kN(CN,this,arguments)||0;var t=RN(this),r=IN(t),n=r-1;for(arguments.length>1&&(n=wN(n,TN(arguments[1]))),n<0&&(n=r+n);n>=0;n--)if(n in t&&t[n]===e)return n||0;return-1}:CN,DN=Qi,PN=xN,MN=UA.aTypedArray;(0,UA.exportTypedArrayMethod)("lastIndexOf",(function(e){var t=arguments.length;return DN(PN,MN(this),t>1?[e,arguments[1]]:[e])}));var UN=Ka.map,LN=GO,VN=UA.aTypedArray;(0,UA.exportTypedArrayMethod)("map",(function(e){return UN(VN(this),e,arguments.length>1?arguments[1]:void 0,(function(e,t){return new(LN(e))(t)}))}));var FN=xg.left,BN=UA.aTypedArray;(0,UA.exportTypedArrayMethod)("reduce",(function(e){var t=arguments.length;return FN(BN(this),e,t,t>1?arguments[1]:void 0)}));var jN=xg.right,GN=UA.aTypedArray;(0,UA.exportTypedArrayMethod)("reduceRight",(function(e){var t=arguments.length;return jN(GN(this),e,t,t>1?arguments[1]:void 0)}));var HN=UA.aTypedArray,zN=UA.exportTypedArrayMethod,KN=Math.floor;zN("reverse",(function(){for(var e,t=this,r=HN(t).length,n=KN(r/2),i=0;i<n;)e=t[i],t[i++]=t[--r],t[r]=e;return t}));var WN=ne,XN=de,qN=UA,YN=ni,JN=fC,QN=Dt,ZN=oe,$N=WN.RangeError,ex=WN.Int8Array,tx=ex&&ex.prototype,rx=tx&&tx.set,nx=qN.aTypedArray,ix=qN.exportTypedArrayMethod,ox=!ZN((function(){var e=new Uint8ClampedArray(2);return XN(rx,e,{length:1,0:3},1),3!==e[1]})),ax=ox&&qN.NATIVE_ARRAY_BUFFER_VIEWS&&ZN((function(){var e=new ex(2);return e.set(1),e.set("2",1),0!==e[0]||2!==e[1]}));ix("set",(function(e){nx(this);var t=JN(arguments.length>1?arguments[1]:void 0,1),r=QN(e);if(ox)return XN(rx,this,r,t);var n=this.length,i=YN(r),o=0;if(i+t>n)throw $N("Wrong length");for(;o<i;)this[t+o]=r[o++]}),!ox||ax);var sx=GO,ux=ea,cx=UA.aTypedArray;(0,UA.exportTypedArrayMethod)("slice",(function(e,t){for(var r=ux(cx(this),e,t),n=sx(this),i=0,o=r.length,a=new n(o);o>i;)a[i]=r[i++];return a}),oe((function(){new Int8Array(1).slice()})));var dx=Ka.some,lx=UA.aTypedArray;(0,UA.exportTypedArrayMethod)("some",(function(e){return dx(lx(this),e,arguments.length>1?arguments[1]:void 0)}));var hx=ne,fx=ke,px=oe,_x=vt,vx=AI,mx=UA,gx=CI,yx=OI,Sx=et,bx=xI,Ex=hx.Array,kx=mx.aTypedArray,Rx=mx.exportTypedArrayMethod,Tx=hx.Uint16Array,Ix=Tx&&fx(Tx.prototype.sort),Ax=!(!Ix||px((function(){Ix(new Tx(2),null)}))&&px((function(){Ix(new Tx(2),{})}))),wx=!!Ix&&!px((function(){if(Sx)return Sx<74;if(gx)return gx<67;if(yx)return!0;if(bx)return bx<602;var e,t,r=new Tx(516),n=Ex(516);for(e=0;e<516;e++)t=e%4,r[e]=515-e,n[e]=e-2*t+3;for(Ix(r,(function(e,t){return(e/4|0)-(t/4|0)})),e=0;e<516;e++)if(r[e]!==n[e])return!0}));Rx("sort",(function(e){return void 0!==e&&_x(e),wx?Ix(this,e):vx(kx(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))}),!wx||Ax);var Cx=Qi,Ox=UA,Nx=oe,xx=ea,Dx=ne.Int8Array,Px=Ox.aTypedArray,Mx=Ox.exportTypedArrayMethod,Ux=[].toLocaleString,Lx=!!Dx&&Nx((function(){Ux.call(new Dx(1))}));Mx("toLocaleString",(function(){return Cx(Ux,Lx?xx(Px(this)):Px(this),xx(arguments))}),Nx((function(){return[1,2].toLocaleString()!=new Dx([1,2]).toLocaleString()}))||!Nx((function(){Dx.prototype.toLocaleString.call([1,2])})));var Vx=UA.exportTypedArrayMethod,Fx=oe,Bx=ke,jx=ne.Uint8Array,Gx=jx&&jx.prototype||{},Hx=[].toString,zx=Bx([].join);Fx((function(){Hx.call({})}))&&(Hx=function(){return zx(this)});var Kx=Gx.toString!=Hx;Vx("toString",Hx,Kx);var Wx=_a,Xx=De,qx=Dt,Yx=ni,Jx=function(e){var t=1==e;return function(r,n,i){for(var o,a=qx(r),s=Xx(a),u=Wx(n,i),c=Yx(s);c-- >0;)if(u(o=s[c],c,a))switch(e){case 0:return o;case 1:return c}return t?-1:void 0}},Qx={findLast:Jx(0),findLastIndex:Jx(1)},Zx=Qx.findLast,$x=UA.aTypedArray;(0,UA.exportTypedArrayMethod)("findLast",(function(e){return Zx($x(this),e,arguments.length>1?arguments[1]:void 0)}));var eD=Qx.findLastIndex,tD=UA.aTypedArray;(0,UA.exportTypedArrayMethod)("findLastIndex",(function(e){return eD(tD(this),e,arguments.length>1?arguments[1]:void 0)}));var rD=Wi,nD=Ka.findIndex,iD=Gu,oD="findIndex",aD=!0;oD in[]&&Array(1).findIndex((function(){aD=!1})),rD({target:"Array",proto:!0,forced:aD},{findIndex:function(e){return nD(this,e,arguments.length>1?arguments[1]:void 0)}}),iD(oD);var sD=function(e){return 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.INVOKED_BEFORE_CAPTURE="INVOKED_BEFORE_CAPTURE",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_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}(sD||{}),uD=function(e){return 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",e}(uD||{}),cD=u((function e(t,r,n){a(this,e),c(this,"code",void 0),c(this,"message",void 0),c(this,"error",void 0),this.code=t,this.message=r,this.error=n})),dD=ae,lD=ke,hD=mo,fD=Ve,pD=lD(le.f),_D=lD([].push),vD=function(e){return function(t){for(var r,n=fD(t),i=hD(n),o=i.length,a=0,s=[];o>a;)r=i[a++],dD&&!pD(n,r)||_D(s,e?[r,n[r]]:n[r]);return s}},mD={entries:vD(!0),values:vD(!1)}.entries;Wi({target:"Object",stat:!0},{entries:function(e){return mD(e)}});var gD=qn,yD=fo,SD=Me,bD=ne.RangeError,ED=ke,kD=ti,RD=fo,TD=function(e){var t=yD(SD(this)),r="",n=gD(e);if(n<0||n==1/0)throw bD("Wrong number of repetitions");for(;n>0;(n>>>=1)&&(t+=t))1&n&&(r+=t);return r},ID=Me,AD=ED(TD),wD=ED("".slice),CD=Math.ceil,OD=function(e){return function(t,r,n){var i,o,a=RD(ID(t)),s=kD(r),u=a.length,c=void 0===n?" ":RD(n);return s<=u||""==c?a:((o=AD(c,CD((i=s-u)/c.length))).length>i&&(o=wD(o,0,i)),e?a+o:o+a)}},ND={start:OD(!1),end:OD(!0)},xD=/Version\/10(?:\.\d+){1,2}(?: [\w./]+)?(?: Mobile\/\w+)? Safari\//.test(Xe),DD=ND.end;Wi({target:"String",proto:!0,forced:xD},{padEnd:function(e){return DD(this,e,arguments.length>1?arguments[1]:void 0)}});var PD=Tm;Wi({target:"Number",stat:!0,forced:Number.parseInt!=PD},{parseInt:PD});var MD=xr,UD=_l,LD=_a,VD=de,FD=Dt,BD=function(e,t,r,n){try{return n?t(MD(r)[0],r[1]):t(r)}catch(Sq){UD(e,"throw",Sq)}},jD=$d,GD=Ca,HD=ni,zD=Go,KD=ll,WD=il,XD=ne.Array,qD=function(e){var t=FD(e),r=GD(this),n=arguments.length,i=n>1?arguments[1]:void 0,o=void 0!==i;o&&(i=LD(i,n>2?arguments[2]:void 0));var a,s,u,c,d,l,h=WD(t),f=0;if(!h||this==XD&&jD(h))for(a=HD(t),s=r?new this(a):XD(a);a>f;f++)l=o?i(t[f],f):t[f],zD(s,f,l);else for(d=(c=KD(t,h)).next,s=r?new this:[];!(u=VD(d,c)).done;f++)l=o?BD(c,i,[u.value,f],!0):u.value,zD(s,f,l);return s.length=f,s},YD=qD;Wi({target:"Array",stat:!0,forced:!Vl((function(e){Array.from(e)}))},{from:YD});var JD=Math.log,QD=Math.LOG10E;Wi({target:"Math",stat:!0},{log10:Math.log10||function(e){return JD(e)*QD}});var ZD,$D=Wi,eP=ke,tP=ie.f,rP=ti,nP=fo,iP=M_,oP=Me,aP=L_,sP=eP("".startsWith),uP=eP("".slice),cP=Math.min,dP=aP("startsWith"),lP=!dP&&!!function(){var e=tP(String.prototype,"startsWith");return e&&!e.writable}();$D({target:"String",proto:!0,forced:!lP&&!dP},{startsWith:function(e){var t=nP(oP(this));iP(e);var r=rP(cP(arguments.length>1?arguments[1]:void 0,t.length)),n=nP(e);return sP?sP(t,n,r):uP(t,r,r+n.length)===n}});var hP=new Uint8Array(16);function fP(){if(!ZD&&!(ZD="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto)))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return ZD(hP)}var pP=/^(?:[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 _P(e){return"string"==typeof e&&pP.test(e)}for(var vP=[],mP=0;mP<256;++mP)vP.push((mP+256).toString(16).substr(1));function gP(e,t,r){var n=(e=e||{}).random||(e.rng||fP)();if(n[6]=15&n[6]|64,n[8]=63&n[8]|128,t){r=r||0;for(var i=0;i<16;++i)t[r+i]=n[i];return t}return function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=(vP[e[t+0]]+vP[e[t+1]]+vP[e[t+2]]+vP[e[t+3]]+"-"+vP[e[t+4]]+vP[e[t+5]]+"-"+vP[e[t+6]]+vP[e[t+7]]+"-"+vP[e[t+8]]+vP[e[t+9]]+"-"+vP[e[t+10]]+vP[e[t+11]]+vP[e[t+12]]+vP[e[t+13]]+vP[e[t+14]]+vP[e[t+15]]).toLowerCase();if(!_P(r))throw TypeError("Stringified UUID is invalid");return r}(n)}var yP=new TextDecoder,SP=new TextEncoder,bP=function(){return gP()},EP=function(){return Date.now()};function kP(e){for(var t=0,r=arguments.length,n=new Array(r>1?r-1:0),i=1;i<r;i++)n[i-1]=arguments[i];for(var o=0,a=n;o<a.length;o++){var s=a[o];t+=s.length}for(var u=new e(t),c=0,d=0,l=n;d<l.length;d++){var h=l[d];u.set(h,c),c+=h.length}return u}var RP=function(){return"undefined"==typeof window},TP=function(){function e(){a(this,e)}var t,r;return u(e,null,[{key:"token2auth",value:function(t,r,n,i){return i?"Bearer ".concat(i):"Basic ".concat(e.createUnsafeToken(t,r,n))}},{key:"createUnsafeToken",value:function(e,t,r){return window.btoa([e,t,r].filter((function(e){return null!==e})).join(":"))}},{key:"merge",value:function(){for(var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=0,o=Object.entries(t);i<o.length;i++){var a=y(o[i],2),s=a[0],u=a[1];null!==u&&"object"===n(u)?e.merge(t[s],r[s]):void 0!==r[s]&&(t[s]=r[s])}}},{key:"ab2str",value:function(e){return yP.decode(e)}},{key:"ab2obj",value:function(t){try{var r=e.ab2str(t);return JSON.parse(r)}catch(n){return{}}}},{key:"str2ab",value:function(e){return SP.encode(e).buffer}},{key:"ab2b64str",value:(r=o(regeneratorRuntime.mark((function e(t){var r;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,new Promise((function(e){var r=new FileReader;r.onload=function(){return e(r.result)},r.readAsDataURL(new Blob([t]))}));case 2:return r=e.sent,e.abrupt("return",r.split(",",2)[1]);case 4:case"end":return e.stop()}}),e)}))),function(e){return r.apply(this,arguments)})},{key:"b64str2ab",value:(t=o(regeneratorRuntime.mark((function e(t){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",fetch("data:application/octet;base64,"+t).then((function(e){return e.arrayBuffer()})));case 1:case"end":return e.stop()}}),e)}))),function(e){return t.apply(this,arguments)})}]),e}();function IP(e){return new Promise((function(t){window.setTimeout(t,e)}))}function AP(){var e="none";return RP()||(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}function wP(){for(var e=(+"".concat(Math.random()).slice(-7).padEnd(7,"0")).toString(2).padEnd(28,"1").split(""),t=[];e.length;)t.push(e.splice(0,7));return t.map((function(e,r){var n=r===t.length-1?"0":"1";return Number.parseInt(n+e.join(""),2)}))}var CP=function(){return Math.floor(65535*Math.random())};function OP(e){return"string"==typeof e&&e.indexOf("__web__rtc__rtt__")>-1}function NP(e){return e.map((function e(t){if(t instanceof HTMLElement)return t.toString();if(t instanceof ArrayBuffer||ArrayBuffer.isView(t)){var r=ArrayBuffer.isView(t)?t.buffer:t,n=r.byteLength,i=[];if(n>10){var o=new DataView(r),a=Array.from({length:5}).map((function(e,t){return o.getUint8(t)})),s=Array.from({length:5}).map((function(e,t){return n-1-t})).reverse().map((function(e){return o.getUint8(e)}));i=[].concat(S(a),["..."],S(s))}else i=Array.from(new Uint8Array(r));return"".concat(t.constructor.name,"(").concat(n,") [").concat(i.join(", "),"]")}if(t instanceof ImageData)return"ImageData";if(Array.isArray(t))return t.map(e);if("[object Object]"===Object.prototype.toString.call(t)){var u={};for(var c in t)u[c]=e(t[c]);return u}return t}))}var xP=function(){var e=o(regeneratorRuntime.mark((function e(){var t,r,n,i=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=i.length>0&&void 0!==i[0]&&i[0],e.prev=1,(r=new RTCPeerConnection({iceServers:[],iceTransportPolicy:"all",bundlePolicy:"max-bundle",rtcpMuxPolicy:"require",sdpSemantics:"unified-plan"})).createDataChannel("default"),r.addTransceiver("audio",{direction:"recvonly"}),r.addTransceiver("video",{direction:"recvonly"}),t&&(r.addTransceiver("audio",{direction:"sendonly"}),r.addTransceiver("video",{direction:"sendonly"})),e.next=9,r.createOffer();case 9:return n=e.sent,r.close(),e.abrupt("return",n.sdp);case 14:e.prev=14,e.t0=e.catch(1);case 16:case"end":return e.stop()}}),e,null,[[1,14]])})));return function(){return e.apply(this,arguments)}}(),DP=function(e){return new Promise((function(t,r){var n=(e=Array.isArray(e)?e:[]).length,i=[];0===n?r([]):e.forEach((function(e){e.then((function(e){t(e)}),(function(e){n--,i.push(e),0===n&&r(i)}))}))}))};function PP(e){return+Math.max(-127,10*Math.log10(Math.pow(e/255,2))).toFixed(2)}function MP(e){return(e&P.AUDIO)===P.AUDIO}function UP(e){return(e&P.VIDEO)===P.VIDEO}function LP(e){var t={};return Object.keys(e).forEach((function(r){"object"===n(e[r])?t[r]=LP(e[r]):r.startsWith("_")||(t[r]=e[r])})),t}function VP(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:[]},n=!1,i=2;i<t.byteLength;){var o=t.getUint16(i);if(i+=2,t.byteLength-i<o){n=!0;break}var a=new Uint8Array(e.buffer,i,o);if(i+=o,t.byteLength-i>0&&t.byteLength-i<=2){n=!0;break}r.seiCount++,r.seis.push(a)}return n&&(r.seiCount=1,r.seis=[e]),r}function FP(e,t){if("boolean"!=typeof e)throw new cD(sD.INVALID_PARAMS,"Invalid ".concat(t,": The value should be boolean type."))}function BP(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:Number.POSITIVE_INFINITY;if(e<r||e>n||"number"!=typeof e){var i=new cD(sD.INVALID_PARAMS,"Invalid ".concat(t,": the value range is [").concat(r,", ").concat(n,"]. integer only"));throw i}}function jP(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:Number.POSITIVE_INFINITY;if(null==e)throw new cD(sD.INVALID_PARAMS,"".concat(t," cannot be empty"));if(!WP(e,r,n))throw new cD(sD.INVALID_PARAMS,"Invalid ".concat(t,": The value should be string type. Length of the string: [").concat(r,",").concat(n,"]"))}function GP(e,t,r){if(!r.includes(e))throw new cD(sD.INVALID_PARAMS,"Invalid ".concat(t,": The value can only be set as ").concat(JSON.stringify(r)))}function HP(e,t){if(XP(e))throw new cD(sD.INVALID_PARAMS,"Invalid ".concat(t,", should not be empty"))}function zP(e,t){if(!(e instanceof ArrayBuffer))throw new cD(sD.INVALID_PARAMS,"Invalid ".concat(t,", should be ArrayBuffer"))}function KP(e){try{for(var t=navigator.mediaDevices.getSupportedConstraints(),r=0,n=Object.keys(e);r<n.length;r++){var i=n[r];t[i]||delete e[i]}}catch(o){}}function WP(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:Number.POSITIVE_INFINITY;return"string"==typeof e&&e.length<=r&&e.length>=t}function XP(e){return null==e}function qP(e){if("string"!=typeof e||!/^[a-zA-Z0-9@._\-]{1,128}$/.test(e))throw new cD(sD.INVALID_PARAMS,"The RoomId must be within 128 bytes. The supported characters: a-z,A-Z,0-9,@,-,_,.")}function YP(e){if("string"!=typeof e||!/^[a-zA-Z0-9@._\-]{1,128}$/.test(e))throw new cD(sD.INVALID_PARAMS,"The userId must be within 128 bytes. The supported characters: a-z,A-Z,0-9,@,-,_,.")}function JP(e){if("string"!=typeof e||!/^[a-zA-Z0-9@._\-]{1,128}$/.test(e))throw new cD(sD.INVALID_PARAMS,"The publicStreamId must be within 128 bytes. The supported characters: a-z,A-Z,0-9,@,-,_,.")}function QP(e){HP(e,"userInfo"),YP(e.userId),XP(e.extraInfo)||jP(e.extraInfo,"userInfo.extraInfo",1,200)}function ZP(e){HP(e,"roomConfig"),FP(e.isAutoPublish,"roomConfig.isAutoPublish"),FP(e.isAutoSubscribeAudio,"roomConfig.isAutoSubscribeAudio"),FP(e.isAutoSubscribeVideo,"roomConfig.isAutoSubscribeVideo")}function $P(e){HP(e,"videoPlayerOption")}function eM(e){var t,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:64;if(!e||0===(null==e?void 0:e.byteLength))throw new cD(sD.INVALID_PARAMS,"The message cannot be empty");if((null===(t=e instanceof ArrayBuffer?e:TP.str2ab(JSON.stringify(e)))||void 0===t?void 0:t.byteLength)>1e3*r)throw new cD(sD.INVALID_PARAMS,"The message length must be less than ".concat(r,"K"))}function tM(e){return![ee.onRemoteStreamStats,ee.onLocalStreamStats,ee.onAudioVolumeIndication,ee.onLocalAudioPropertiesReport,ee.onRemoteAudioPropertiesReport].includes(e)}function rM(e){if("number"!=typeof(null==e?void 0:e.width)||"number"!=typeof(null==e?void 0:e.height))throw new cD(sD.INVALID_PARAMS,"remoteVideoConfig must contain width, height, frameRate")}var nM={exports:{}};!function(e){var t=Object.prototype.hasOwnProperty,r="~";function n(){}function i(e,t,r){this.fn=e,this.context=t,this.once=r||!1}function o(e,t,n,o,a){if("function"!=typeof n)throw new TypeError("The listener must be a function");var s=new i(n,o||e,a),u=r?r+t:t;return e._events[u]?e._events[u].fn?e._events[u]=[e._events[u],s]:e._events[u].push(s):(e._events[u]=s,e._eventsCount++),e}function a(e,t){0==--e._eventsCount?e._events=new n:delete e._events[t]}function s(){this._events=new n,this._eventsCount=0}Object.create&&(n.prototype=Object.create(null),(new n).__proto__||(r=!1)),s.prototype.eventNames=function(){var e,n,i=[];if(0===this._eventsCount)return i;for(n in e=this._events)t.call(e,n)&&i.push(r?n.slice(1):n);return Object.getOwnPropertySymbols?i.concat(Object.getOwnPropertySymbols(e)):i},s.prototype.listeners=function(e){var t=r?r+e:e,n=this._events[t];if(!n)return[];if(n.fn)return[n.fn];for(var i=0,o=n.length,a=new Array(o);i<o;i++)a[i]=n[i].fn;return a},s.prototype.listenerCount=function(e){var t=r?r+e:e,n=this._events[t];return n?n.fn?1:n.length:0},s.prototype.emit=function(e,t,n,i,o,a){var s=r?r+e:e;if(!this._events[s])return!1;var u,c,d=this._events[s],l=arguments.length;if(d.fn){switch(d.once&&this.removeListener(e,d.fn,void 0,!0),l){case 1:return d.fn.call(d.context),!0;case 2:return d.fn.call(d.context,t),!0;case 3:return d.fn.call(d.context,t,n),!0;case 4:return d.fn.call(d.context,t,n,i),!0;case 5:return d.fn.call(d.context,t,n,i,o),!0;case 6:return d.fn.call(d.context,t,n,i,o,a),!0}for(c=1,u=new Array(l-1);c<l;c++)u[c-1]=arguments[c];d.fn.apply(d.context,u)}else{var h,f=d.length;for(c=0;c<f;c++)switch(d[c].once&&this.removeListener(e,d[c].fn,void 0,!0),l){case 1:d[c].fn.call(d[c].context);break;case 2:d[c].fn.call(d[c].context,t);break;case 3:d[c].fn.call(d[c].context,t,n);break;case 4:d[c].fn.call(d[c].context,t,n,i);break;default:if(!u)for(h=1,u=new Array(l-1);h<l;h++)u[h-1]=arguments[h];d[c].fn.apply(d[c].context,u)}}return!0},s.prototype.on=function(e,t,r){return o(this,e,t,r,!1)},s.prototype.once=function(e,t,r){return o(this,e,t,r,!0)},s.prototype.removeListener=function(e,t,n,i){var o=r?r+e:e;if(!this._events[o])return this;if(!t)return a(this,o),this;var s=this._events[o];if(s.fn)s.fn!==t||i&&!s.once||n&&s.context!==n||a(this,o);else{for(var u=0,c=[],d=s.length;u<d;u++)(s[u].fn!==t||i&&!s[u].once||n&&s[u].context!==n)&&c.push(s[u]);c.length?this._events[o]=1===c.length?c[0]:c:a(this,o)}return this},s.prototype.removeAllListeners=function(e){var t;return e?(t=r?r+e:e,this._events[t]&&a(this,t)):(this._events=new n,this._eventsCount=0),this},s.prototype.off=s.prototype.removeListener,s.prototype.addListener=s.prototype.on,s.prefixed=r,s.EventEmitter=s,e.exports=s}(nM);var iM=nM.exports,oM="[VERTC]",aM=["#0050b3","#0050b3","#0050b3","#0050b3","#0050b3"],sM=!RP()&&window.location.search.includes("_rtc_debug_"),uM=function(){function e(t,r,n){a(this,e),c(this,"_indent",void 0),c(this,"_module",void 0),c(this,"_id",void 0),this._module=t,this._indent=r}return u(e,[{key:"print",value:function(e){var t;if(sM){for(var r="",n=0;n<this._indent;n++)r+=" ";for(var i=arguments.length,o=new Array(i>1?i-1:0),a=1;a<i;a++)o[a-1]=arguments[a];(t=console).log.apply(t,["%c".concat(oM).concat(r,"[").concat(this._module,".").concat(e,"] ").concat(o.shift()),"color:".concat(aM[this._indent],";")].concat(o))}}}]),e}(),cM=new uM("VERTC",0),dM=function(e){d(n,e);var t,r=v(n);function n(){return a(this,n),r.apply(this,arguments)}return u(n,[{key:"safeEmit",value:function(e){var t=this.listenerCount(e);try{for(var r,i=arguments.length,o=new Array(i>1?i-1:0),a=1;a<i;a++)o[a-1]=arguments[a];return(r=g(l(n.prototype),"emit",this)).call.apply(r,[this,e].concat(o))}catch(Sq){return cM.print("safaEmit","safeEmit() | event listener threw an error [event:%s]:%o",e,Sq),Boolean(t)}}},{key:"safeEmitAsPromise",value:(t=o(regeneratorRuntime.mark((function e(t){var r,n,i,o=this,a=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:for(r=a.length,n=new Array(r>1?r-1:0),i=1;i<r;i++)n[i-1]=a[i];return e.abrupt("return",new Promise((function(e,r){try{o.emit.apply(o,[t].concat(n,[e,r]))}catch(Sq){cM.print("safeEmitAsPromise","safeEmitAsPromise() | event listener threw an error [event:%s]:%o",t,Sq),r(Sq)}})));case 2:case"end":return e.stop()}}),e)}))),function(e){return t.apply(this,arguments)})}]),n}(nM.exports.EventEmitter),lM=Ut,hM=function(e){return void 0!==e&&(lM(e,"value")||lM(e,"writable"))},fM=de,pM=je,_M=xr,vM=hM,mM=ie,gM=$u;Wi({target:"Reflect",stat:!0},{get:function e(t,r){var n,i,o=arguments.length<3?t:arguments[2];return _M(t)===o?t[r]:(n=mM.f(t,r))?vM(n)?n.value:void 0===n.get?void 0:fM(n.get,o):pM(i=gM(t))?e(i,r,o):void 0}});var yM=ne,SM=la;Wi({global:!0},{Reflect:{}}),SM(yM.Reflect,"Reflect",!0);var bM=Wi,EM=de,kM=xr,RM=je,TM=hM,IM=Ir,AM=ie,wM=$u,CM=me;var OM=oe((function(){var e=function(){},t=IM.f(new e,"a",{configurable:!0});return!1!==Reflect.set(e.prototype,"a",1,t)}));bM({target:"Reflect",stat:!0,forced:OM},{set:function e(t,r,n){var i,o,a,s=arguments.length<4?t:arguments[3],u=AM.f(kM(t),r);if(!u){if(RM(o=wM(t)))return e(o,r,n,s);u=CM(0)}if(TM(u)){if(!1===u.writable||!RM(s))return!1;if(i=AM.f(s,r)){if(i.get||i.set||!1===i.writable)return!1;i.value=n,IM.f(s,r,i)}else IM.f(s,r,CM(0,n))}else{if(void 0===(a=u.set))return!1;EM(a,s,n)}return!0}}),(0,rA.exports)("Uint16",(function(e){return function(t,r,n){return e(this,t,r,n)}})),(0,rA.exports)("Int32",(function(e){return function(t,r,n){return e(this,t,r,n)}}));var NM={};!function(e){var t="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 t=Array.prototype.slice.call(arguments,1);t.length;){var i=t.shift();if(i){if("object"!==n(i))throw new TypeError(i+"must be non-object");for(var o in i)r(i,o)&&(e[o]=i[o])}}return e},e.shrinkBuf=function(e,t){return e.length===t?e:e.subarray?e.subarray(0,t):(e.length=t,e)};var i={arraySet:function(e,t,r,n,i){if(t.subarray&&e.subarray)e.set(t.subarray(r,r+n),i);else for(var o=0;o<n;o++)e[i+o]=t[r+o]},flattenChunks:function(e){var t,r,n,i,o,a;for(n=0,t=0,r=e.length;t<r;t++)n+=e[t].length;for(a=new Uint8Array(n),i=0,t=0,r=e.length;t<r;t++)o=e[t],a.set(o,i),i+=o.length;return a}},o={arraySet:function(e,t,r,n,i){for(var o=0;o<n;o++)e[i+o]=t[r+o]},flattenChunks:function(e){return[].concat.apply([],e)}};e.setTyped=function(t){t?(e.Buf8=Uint8Array,e.Buf16=Uint16Array,e.Buf32=Int32Array,e.assign(e,i)):(e.Buf8=Array,e.Buf16=Array,e.Buf32=Array,e.assign(e,o))},e.setTyped(t)}(NM);var xM={},DM={},PM={},MM=NM;function UM(e){for(var t=e.length;--t>=0;)e[t]=0}var LM=256,VM=286,FM=30,BM=15,jM=[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],GM=[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],HM=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],zM=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],KM=new Array(576);UM(KM);var WM=new Array(60);UM(WM);var XM=new Array(512);UM(XM);var qM=new Array(256);UM(qM);var YM=new Array(29);UM(YM);var JM,QM,ZM,$M=new Array(FM);function eU(e,t,r,n,i){this.static_tree=e,this.extra_bits=t,this.extra_base=r,this.elems=n,this.max_length=i,this.has_stree=e&&e.length}function tU(e,t){this.dyn_tree=e,this.max_code=0,this.stat_desc=t}function rU(e){return e<256?XM[e]:XM[256+(e>>>7)]}function nU(e,t){e.pending_buf[e.pending++]=255&t,e.pending_buf[e.pending++]=t>>>8&255}function iU(e,t,r){e.bi_valid>16-r?(e.bi_buf|=t<<e.bi_valid&65535,nU(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 oU(e,t,r){iU(e,r[2*t],r[2*t+1])}function aU(e,t){var r=0;do{r|=1&e,e>>>=1,r<<=1}while(--t>0);return r>>>1}function sU(e,t,r){var n,i,o=new Array(16),a=0;for(n=1;n<=BM;n++)o[n]=a=a+r[n-1]<<1;for(i=0;i<=t;i++){var s=e[2*i+1];0!==s&&(e[2*i]=aU(o[s]++,s))}}function uU(e){var t;for(t=0;t<VM;t++)e.dyn_ltree[2*t]=0;for(t=0;t<FM;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 cU(e){e.bi_valid>8?nU(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 dU(e,t,r,n){var i=2*t,o=2*r;return e[i]<e[o]||e[i]===e[o]&&n[t]<=n[r]}function lU(e,t,r){for(var n=e.heap[r],i=r<<1;i<=e.heap_len&&(i<e.heap_len&&dU(t,e.heap[i+1],e.heap[i],e.depth)&&i++,!dU(t,n,e.heap[i],e.depth));)e.heap[r]=e.heap[i],r=i,i<<=1;e.heap[r]=n}function hU(e,t,r){var n,i,o,a,s=0;if(0!==e.last_lit)do{n=e.pending_buf[e.d_buf+2*s]<<8|e.pending_buf[e.d_buf+2*s+1],i=e.pending_buf[e.l_buf+s],s++,0===n?oU(e,i,t):(oU(e,(o=qM[i])+LM+1,t),0!==(a=jM[o])&&iU(e,i-=YM[o],a),oU(e,o=rU(--n),r),0!==(a=GM[o])&&iU(e,n-=$M[o],a))}while(s<e.last_lit);oU(e,256,t)}function fU(e,t){var r,n,i,o=t.dyn_tree,a=t.stat_desc.static_tree,s=t.stat_desc.has_stree,u=t.stat_desc.elems,c=-1;for(e.heap_len=0,e.heap_max=573,r=0;r<u;r++)0!==o[2*r]?(e.heap[++e.heap_len]=c=r,e.depth[r]=0):o[2*r+1]=0;for(;e.heap_len<2;)o[2*(i=e.heap[++e.heap_len]=c<2?++c:0)]=1,e.depth[i]=0,e.opt_len--,s&&(e.static_len-=a[2*i+1]);for(t.max_code=c,r=e.heap_len>>1;r>=1;r--)lU(e,o,r);i=u;do{r=e.heap[1],e.heap[1]=e.heap[e.heap_len--],lU(e,o,1),n=e.heap[1],e.heap[--e.heap_max]=r,e.heap[--e.heap_max]=n,o[2*i]=o[2*r]+o[2*n],e.depth[i]=(e.depth[r]>=e.depth[n]?e.depth[r]:e.depth[n])+1,o[2*r+1]=o[2*n+1]=i,e.heap[1]=i++,lU(e,o,1)}while(e.heap_len>=2);e.heap[--e.heap_max]=e.heap[1],function(e,t){var r,n,i,o,a,s,u=t.dyn_tree,c=t.max_code,d=t.stat_desc.static_tree,l=t.stat_desc.has_stree,h=t.stat_desc.extra_bits,f=t.stat_desc.extra_base,p=t.stat_desc.max_length,_=0;for(o=0;o<=BM;o++)e.bl_count[o]=0;for(u[2*e.heap[e.heap_max]+1]=0,r=e.heap_max+1;r<573;r++)(o=u[2*u[2*(n=e.heap[r])+1]+1]+1)>p&&(o=p,_++),u[2*n+1]=o,n>c||(e.bl_count[o]++,a=0,n>=f&&(a=h[n-f]),s=u[2*n],e.opt_len+=s*(o+a),l&&(e.static_len+=s*(d[2*n+1]+a)));if(0!==_){do{for(o=p-1;0===e.bl_count[o];)o--;e.bl_count[o]--,e.bl_count[o+1]+=2,e.bl_count[p]--,_-=2}while(_>0);for(o=p;0!==o;o--)for(n=e.bl_count[o];0!==n;)(i=e.heap[--r])>c||(u[2*i+1]!==o&&(e.opt_len+=(o-u[2*i+1])*u[2*i],u[2*i+1]=o),n--)}}(e,t),sU(o,c,e.bl_count)}function pU(e,t,r){var n,i,o=-1,a=t[1],s=0,u=7,c=4;for(0===a&&(u=138,c=3),t[2*(r+1)+1]=65535,n=0;n<=r;n++)i=a,a=t[2*(n+1)+1],++s<u&&i===a||(s<c?e.bl_tree[2*i]+=s:0!==i?(i!==o&&e.bl_tree[2*i]++,e.bl_tree[32]++):s<=10?e.bl_tree[34]++:e.bl_tree[36]++,s=0,o=i,0===a?(u=138,c=3):i===a?(u=6,c=3):(u=7,c=4))}function _U(e,t,r){var n,i,o=-1,a=t[1],s=0,u=7,c=4;for(0===a&&(u=138,c=3),n=0;n<=r;n++)if(i=a,a=t[2*(n+1)+1],!(++s<u&&i===a)){if(s<c)do{oU(e,i,e.bl_tree)}while(0!=--s);else 0!==i?(i!==o&&(oU(e,i,e.bl_tree),s--),oU(e,16,e.bl_tree),iU(e,s-3,2)):s<=10?(oU(e,17,e.bl_tree),iU(e,s-3,3)):(oU(e,18,e.bl_tree),iU(e,s-11,7));s=0,o=i,0===a?(u=138,c=3):i===a?(u=6,c=3):(u=7,c=4)}}UM($M);var vU=!1;function mU(e,t,r,n){iU(e,0+(n?1:0),3),function(e,t,r,n){cU(e),n&&(nU(e,r),nU(e,~r)),MM.arraySet(e.pending_buf,e.window,t,r,e.pending),e.pending+=r}(e,t,r,!0)}PM._tr_init=function(e){vU||(!function(){var e,t,r,n,i,o=new Array(16);for(r=0,n=0;n<28;n++)for(YM[n]=r,e=0;e<1<<jM[n];e++)qM[r++]=n;for(qM[r-1]=n,i=0,n=0;n<16;n++)for($M[n]=i,e=0;e<1<<GM[n];e++)XM[i++]=n;for(i>>=7;n<FM;n++)for($M[n]=i<<7,e=0;e<1<<GM[n]-7;e++)XM[256+i++]=n;for(t=0;t<=BM;t++)o[t]=0;for(e=0;e<=143;)KM[2*e+1]=8,e++,o[8]++;for(;e<=255;)KM[2*e+1]=9,e++,o[9]++;for(;e<=279;)KM[2*e+1]=7,e++,o[7]++;for(;e<=287;)KM[2*e+1]=8,e++,o[8]++;for(sU(KM,287,o),e=0;e<FM;e++)WM[2*e+1]=5,WM[2*e]=aU(e,5);JM=new eU(KM,jM,257,VM,BM),QM=new eU(WM,GM,0,FM,BM),ZM=new eU(new Array(0),HM,0,19,7)}(),vU=!0),e.l_desc=new tU(e.dyn_ltree,JM),e.d_desc=new tU(e.dyn_dtree,QM),e.bl_desc=new tU(e.bl_tree,ZM),e.bi_buf=0,e.bi_valid=0,uU(e)},PM._tr_stored_block=mU,PM._tr_flush_block=function(e,t,r,n){var i,o,a=0;e.level>0?(2===e.strm.data_type&&(e.strm.data_type=function(e){var t,r=4093624447;for(t=0;t<=31;t++,r>>>=1)if(1&r&&0!==e.dyn_ltree[2*t])return 0;if(0!==e.dyn_ltree[18]||0!==e.dyn_ltree[20]||0!==e.dyn_ltree[26])return 1;for(t=32;t<LM;t++)if(0!==e.dyn_ltree[2*t])return 1;return 0}(e)),fU(e,e.l_desc),fU(e,e.d_desc),a=function(e){var t;for(pU(e,e.dyn_ltree,e.l_desc.max_code),pU(e,e.dyn_dtree,e.d_desc.max_code),fU(e,e.bl_desc),t=18;t>=3&&0===e.bl_tree[2*zM[t]+1];t--);return e.opt_len+=3*(t+1)+5+5+4,t}(e),i=e.opt_len+3+7>>>3,(o=e.static_len+3+7>>>3)<=i&&(i=o)):i=o=r+5,r+4<=i&&-1!==t?mU(e,t,r,n):4===e.strategy||o===i?(iU(e,2+(n?1:0),3),hU(e,KM,WM)):(iU(e,4+(n?1:0),3),function(e,t,r,n){var i;for(iU(e,t-257,5),iU(e,r-1,5),iU(e,n-4,4),i=0;i<n;i++)iU(e,e.bl_tree[2*zM[i]+1],3);_U(e,e.dyn_ltree,t-1),_U(e,e.dyn_dtree,r-1)}(e,e.l_desc.max_code+1,e.d_desc.max_code+1,a+1),hU(e,e.dyn_ltree,e.dyn_dtree)),uU(e),n&&cU(e)},PM._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*(qM[r]+LM+1)]++,e.dyn_dtree[2*rU(t)]++),e.last_lit===e.lit_bufsize-1},PM._tr_align=function(e){iU(e,2,3),oU(e,256,KM),function(e){16===e.bi_valid?(nU(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 gU=function(e,t,r,n){for(var i=65535&e|0,o=e>>>16&65535|0,a=0;0!==r;){r-=a=r>2e3?2e3:r;do{o=o+(i=i+t[n++]|0)|0}while(--a);i%=65521,o%=65521}return i|o<<16|0};var yU=function(){for(var e,t=[],r=0;r<256;r++){e=r;for(var n=0;n<8;n++)e=1&e?3988292384^e>>>1:e>>>1;t[r]=e}return t}();var SU,bU=function(e,t,r,n){var i=yU,o=n+r;e^=-1;for(var a=n;a<o;a++)e=e>>>8^i[255&(e^t[a])];return-1^e},EU={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"},kU=NM,RU=PM,TU=gU,IU=bU,AU=EU,wU=-2,CU=258,OU=262,NU=103,xU=113,DU=666;function PU(e,t){return e.msg=AU[t],t}function MU(e){return(e<<1)-(e>4?9:0)}function UU(e){for(var t=e.length;--t>=0;)e[t]=0}function LU(e){var t=e.state,r=t.pending;r>e.avail_out&&(r=e.avail_out),0!==r&&(kU.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 VU(e,t){RU._tr_flush_block(e,e.block_start>=0?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,LU(e.strm)}function FU(e,t){e.pending_buf[e.pending++]=t}function BU(e,t){e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=255&t}function jU(e,t){var r,n,i=e.max_chain_length,o=e.strstart,a=e.prev_length,s=e.nice_match,u=e.strstart>e.w_size-OU?e.strstart-(e.w_size-OU):0,c=e.window,d=e.w_mask,l=e.prev,h=e.strstart+CU,f=c[o+a-1],p=c[o+a];e.prev_length>=e.good_match&&(i>>=2),s>e.lookahead&&(s=e.lookahead);do{if(c[(r=t)+a]===p&&c[r+a-1]===f&&c[r]===c[o]&&c[++r]===c[o+1]){o+=2,r++;do{}while(c[++o]===c[++r]&&c[++o]===c[++r]&&c[++o]===c[++r]&&c[++o]===c[++r]&&c[++o]===c[++r]&&c[++o]===c[++r]&&c[++o]===c[++r]&&c[++o]===c[++r]&&o<h);if(n=CU-(h-o),o=h-CU,n>a){if(e.match_start=t,a=n,n>=s)break;f=c[o+a-1],p=c[o+a]}}}while((t=l[t&d])>u&&0!=--i);return a<=e.lookahead?a:e.lookahead}function GU(e){var t,r,n,i,o,a,s,u,c,d,l=e.w_size;do{if(i=e.window_size-e.lookahead-e.strstart,e.strstart>=l+(l-OU)){kU.arraySet(e.window,e.window,l,l,0),e.match_start-=l,e.strstart-=l,e.block_start-=l,t=r=e.hash_size;do{n=e.head[--t],e.head[t]=n>=l?n-l:0}while(--r);t=r=l;do{n=e.prev[--t],e.prev[t]=n>=l?n-l:0}while(--r);i+=l}if(0===e.strm.avail_in)break;if(a=e.strm,s=e.window,u=e.strstart+e.lookahead,c=i,d=void 0,(d=a.avail_in)>c&&(d=c),r=0===d?0:(a.avail_in-=d,kU.arraySet(s,a.input,a.next_in,d,u),1===a.state.wrap?a.adler=TU(a.adler,s,d,u):2===a.state.wrap&&(a.adler=IU(a.adler,s,d,u)),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<OU&&0!==e.strm.avail_in)}function HU(e,t){for(var r,n;;){if(e.lookahead<OU){if(GU(e),e.lookahead<OU&&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-OU&&(e.match_length=jU(e,r)),e.match_length>=3)if(n=RU._tr_tally(e,e.strstart-e.match_start,e.match_length-3),e.lookahead-=e.match_length,e.match_length<=e.max_lazy_match&&e.lookahead>=3){e.match_length--;do{e.strstart++,e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+3-1])&e.hash_mask,r=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart}while(0!=--e.match_length);e.strstart++}else e.strstart+=e.match_length,e.match_length=0,e.ins_h=e.window[e.strstart],e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+1])&e.hash_mask;else n=RU._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++;if(n&&(VU(e,!1),0===e.strm.avail_out))return 1}return e.insert=e.strstart<2?e.strstart:2,4===t?(VU(e,!0),0===e.strm.avail_out?3:4):e.last_lit&&(VU(e,!1),0===e.strm.avail_out)?1:2}function zU(e,t){for(var r,n,i;;){if(e.lookahead<OU){if(GU(e),e.lookahead<OU&&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-OU&&(e.match_length=jU(e,r),e.match_length<=5&&(1===e.strategy||3===e.match_length&&e.strstart-e.match_start>4096)&&(e.match_length=2)),e.prev_length>=3&&e.match_length<=e.prev_length){i=e.strstart+e.lookahead-3,n=RU._tr_tally(e,e.strstart-1-e.prev_match,e.prev_length-3),e.lookahead-=e.prev_length-1,e.prev_length-=2;do{++e.strstart<=i&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+3-1])&e.hash_mask,r=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart)}while(0!=--e.prev_length);if(e.match_available=0,e.match_length=2,e.strstart++,n&&(VU(e,!1),0===e.strm.avail_out))return 1}else if(e.match_available){if((n=RU._tr_tally(e,0,e.window[e.strstart-1]))&&VU(e,!1),e.strstart++,e.lookahead--,0===e.strm.avail_out)return 1}else e.match_available=1,e.strstart++,e.lookahead--}return e.match_available&&(n=RU._tr_tally(e,0,e.window[e.strstart-1]),e.match_available=0),e.insert=e.strstart<2?e.strstart:2,4===t?(VU(e,!0),0===e.strm.avail_out?3:4):e.last_lit&&(VU(e,!1),0===e.strm.avail_out)?1:2}function KU(e,t,r,n,i){this.good_length=e,this.max_lazy=t,this.nice_length=r,this.max_chain=n,this.func=i}function WU(){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 kU.Buf16(1146),this.dyn_dtree=new kU.Buf16(122),this.bl_tree=new kU.Buf16(78),UU(this.dyn_ltree),UU(this.dyn_dtree),UU(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new kU.Buf16(16),this.heap=new kU.Buf16(573),UU(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new kU.Buf16(573),UU(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 XU(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:xU,e.adler=2===t.wrap?0:1,t.last_flush=0,RU._tr_init(t),0):PU(e,wU)}function qU(e){var t,r=XU(e);return 0===r&&((t=e.state).window_size=2*t.w_size,UU(t.head),t.max_lazy_match=SU[t.level].max_lazy,t.good_match=SU[t.level].good_length,t.nice_match=SU[t.level].nice_length,t.max_chain_length=SU[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 YU(e,t,r,n,i,o){if(!e)return wU;var a=1;if(-1===t&&(t=6),n<0?(a=0,n=-n):n>15&&(a=2,n-=16),i<1||i>9||8!==r||n<8||n>15||t<0||t>9||o<0||o>4)return PU(e,wU);8===n&&(n=9);var s=new WU;return e.state=s,s.strm=e,s.wrap=a,s.gzhead=null,s.w_bits=n,s.w_size=1<<s.w_bits,s.w_mask=s.w_size-1,s.hash_bits=i+7,s.hash_size=1<<s.hash_bits,s.hash_mask=s.hash_size-1,s.hash_shift=~~((s.hash_bits+3-1)/3),s.window=new kU.Buf8(2*s.w_size),s.head=new kU.Buf16(s.hash_size),s.prev=new kU.Buf16(s.w_size),s.lit_bufsize=1<<i+6,s.pending_buf_size=4*s.lit_bufsize,s.pending_buf=new kU.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,qU(e)}SU=[new KU(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(GU(e),0===e.lookahead&&0===t)return 1;if(0===e.lookahead)break}e.strstart+=e.lookahead,e.lookahead=0;var n=e.block_start+r;if((0===e.strstart||e.strstart>=n)&&(e.lookahead=e.strstart-n,e.strstart=n,VU(e,!1),0===e.strm.avail_out))return 1;if(e.strstart-e.block_start>=e.w_size-OU&&(VU(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,4===t?(VU(e,!0),0===e.strm.avail_out?3:4):(e.strstart>e.block_start&&(VU(e,!1),e.strm.avail_out),1)})),new KU(4,4,8,4,HU),new KU(4,5,16,8,HU),new KU(4,6,32,32,HU),new KU(4,4,16,16,zU),new KU(8,16,32,32,zU),new KU(8,16,128,128,zU),new KU(8,32,128,256,zU),new KU(32,128,258,1024,zU),new KU(32,258,258,4096,zU)],DM.deflateInit=function(e,t){return YU(e,t,8,15,8,0)},DM.deflateInit2=YU,DM.deflateReset=qU,DM.deflateResetKeep=XU,DM.deflateSetHeader=function(e,t){return e&&e.state?2!==e.state.wrap?wU:(e.state.gzhead=t,0):wU},DM.deflate=function(e,t){var r,n,i,o;if(!e||!e.state||t>5||t<0)return e?PU(e,wU):wU;if(n=e.state,!e.output||!e.input&&0!==e.avail_in||n.status===DU&&4!==t)return PU(e,0===e.avail_out?-5:wU);if(n.strm=e,r=n.last_flush,n.last_flush=t,42===n.status)if(2===n.wrap)e.adler=0,FU(n,31),FU(n,139),FU(n,8),n.gzhead?(FU(n,(n.gzhead.text?1:0)+(n.gzhead.hcrc?2:0)+(n.gzhead.extra?4:0)+(n.gzhead.name?8:0)+(n.gzhead.comment?16:0)),FU(n,255&n.gzhead.time),FU(n,n.gzhead.time>>8&255),FU(n,n.gzhead.time>>16&255),FU(n,n.gzhead.time>>24&255),FU(n,9===n.level?2:n.strategy>=2||n.level<2?4:0),FU(n,255&n.gzhead.os),n.gzhead.extra&&n.gzhead.extra.length&&(FU(n,255&n.gzhead.extra.length),FU(n,n.gzhead.extra.length>>8&255)),n.gzhead.hcrc&&(e.adler=IU(e.adler,n.pending_buf,n.pending,0)),n.gzindex=0,n.status=69):(FU(n,0),FU(n,0),FU(n,0),FU(n,0),FU(n,0),FU(n,9===n.level?2:n.strategy>=2||n.level<2?4:0),FU(n,3),n.status=xU);else{var a=8+(n.w_bits-8<<4)<<8;a|=(n.strategy>=2||n.level<2?0:n.level<6?1:6===n.level?2:3)<<6,0!==n.strstart&&(a|=32),a+=31-a%31,n.status=xU,BU(n,a),0!==n.strstart&&(BU(n,e.adler>>>16),BU(n,65535&e.adler)),e.adler=1}if(69===n.status)if(n.gzhead.extra){for(i=n.pending;n.gzindex<(65535&n.gzhead.extra.length)&&(n.pending!==n.pending_buf_size||(n.gzhead.hcrc&&n.pending>i&&(e.adler=IU(e.adler,n.pending_buf,n.pending-i,i)),LU(e),i=n.pending,n.pending!==n.pending_buf_size));)FU(n,255&n.gzhead.extra[n.gzindex]),n.gzindex++;n.gzhead.hcrc&&n.pending>i&&(e.adler=IU(e.adler,n.pending_buf,n.pending-i,i)),n.gzindex===n.gzhead.extra.length&&(n.gzindex=0,n.status=73)}else n.status=73;if(73===n.status)if(n.gzhead.name){i=n.pending;do{if(n.pending===n.pending_buf_size&&(n.gzhead.hcrc&&n.pending>i&&(e.adler=IU(e.adler,n.pending_buf,n.pending-i,i)),LU(e),i=n.pending,n.pending===n.pending_buf_size)){o=1;break}o=n.gzindex<n.gzhead.name.length?255&n.gzhead.name.charCodeAt(n.gzindex++):0,FU(n,o)}while(0!==o);n.gzhead.hcrc&&n.pending>i&&(e.adler=IU(e.adler,n.pending_buf,n.pending-i,i)),0===o&&(n.gzindex=0,n.status=91)}else n.status=91;if(91===n.status)if(n.gzhead.comment){i=n.pending;do{if(n.pending===n.pending_buf_size&&(n.gzhead.hcrc&&n.pending>i&&(e.adler=IU(e.adler,n.pending_buf,n.pending-i,i)),LU(e),i=n.pending,n.pending===n.pending_buf_size)){o=1;break}o=n.gzindex<n.gzhead.comment.length?255&n.gzhead.comment.charCodeAt(n.gzindex++):0,FU(n,o)}while(0!==o);n.gzhead.hcrc&&n.pending>i&&(e.adler=IU(e.adler,n.pending_buf,n.pending-i,i)),0===o&&(n.status=NU)}else n.status=NU;if(n.status===NU&&(n.gzhead.hcrc?(n.pending+2>n.pending_buf_size&&LU(e),n.pending+2<=n.pending_buf_size&&(FU(n,255&e.adler),FU(n,e.adler>>8&255),e.adler=0,n.status=xU)):n.status=xU),0!==n.pending){if(LU(e),0===e.avail_out)return n.last_flush=-1,0}else if(0===e.avail_in&&MU(t)<=MU(r)&&4!==t)return PU(e,-5);if(n.status===DU&&0!==e.avail_in)return PU(e,-5);if(0!==e.avail_in||0!==n.lookahead||0!==t&&n.status!==DU){var s=2===n.strategy?function(e,t){for(var r;;){if(0===e.lookahead&&(GU(e),0===e.lookahead)){if(0===t)return 1;break}if(e.match_length=0,r=RU._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,r&&(VU(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,4===t?(VU(e,!0),0===e.strm.avail_out?3:4):e.last_lit&&(VU(e,!1),0===e.strm.avail_out)?1:2}(n,t):3===n.strategy?function(e,t){for(var r,n,i,o,a=e.window;;){if(e.lookahead<=CU){if(GU(e),e.lookahead<=CU&&0===t)return 1;if(0===e.lookahead)break}if(e.match_length=0,e.lookahead>=3&&e.strstart>0&&(n=a[i=e.strstart-1])===a[++i]&&n===a[++i]&&n===a[++i]){o=e.strstart+CU;do{}while(n===a[++i]&&n===a[++i]&&n===a[++i]&&n===a[++i]&&n===a[++i]&&n===a[++i]&&n===a[++i]&&n===a[++i]&&i<o);e.match_length=CU-(o-i),e.match_length>e.lookahead&&(e.match_length=e.lookahead)}if(e.match_length>=3?(r=RU._tr_tally(e,1,e.match_length-3),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(r=RU._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),r&&(VU(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,4===t?(VU(e,!0),0===e.strm.avail_out?3:4):e.last_lit&&(VU(e,!1),0===e.strm.avail_out)?1:2}(n,t):SU[n.level].func(n,t);if(3!==s&&4!==s||(n.status=DU),1===s||3===s)return 0===e.avail_out&&(n.last_flush=-1),0;if(2===s&&(1===t?RU._tr_align(n):5!==t&&(RU._tr_stored_block(n,0,0,!1),3===t&&(UU(n.head),0===n.lookahead&&(n.strstart=0,n.block_start=0,n.insert=0))),LU(e),0===e.avail_out))return n.last_flush=-1,0}return 4!==t?0:n.wrap<=0?1:(2===n.wrap?(FU(n,255&e.adler),FU(n,e.adler>>8&255),FU(n,e.adler>>16&255),FU(n,e.adler>>24&255),FU(n,255&e.total_in),FU(n,e.total_in>>8&255),FU(n,e.total_in>>16&255),FU(n,e.total_in>>24&255)):(BU(n,e.adler>>>16),BU(n,65535&e.adler)),LU(e),n.wrap>0&&(n.wrap=-n.wrap),0!==n.pending?0:1)},DM.deflateEnd=function(e){var t;return e&&e.state?42!==(t=e.state.status)&&69!==t&&73!==t&&91!==t&&t!==NU&&t!==xU&&t!==DU?PU(e,wU):(e.state=null,t===xU?PU(e,-3):0):wU},DM.deflateSetDictionary=function(e,t){var r,n,i,o,a,s,u,c,d=t.length;if(!e||!e.state)return wU;if(2===(o=(r=e.state).wrap)||1===o&&42!==r.status||r.lookahead)return wU;for(1===o&&(e.adler=TU(e.adler,t,d,0)),r.wrap=0,d>=r.w_size&&(0===o&&(UU(r.head),r.strstart=0,r.block_start=0,r.insert=0),c=new kU.Buf8(r.w_size),kU.arraySet(c,t,d-r.w_size,r.w_size,0),t=c,d=r.w_size),a=e.avail_in,s=e.next_in,u=e.input,e.avail_in=d,e.next_in=0,e.input=t,GU(r);r.lookahead>=3;){n=r.strstart,i=r.lookahead-2;do{r.ins_h=(r.ins_h<<r.hash_shift^r.window[n+3-1])&r.hash_mask,r.prev[n&r.w_mask]=r.head[r.ins_h],r.head[r.ins_h]=n,n++}while(--i);r.strstart=n,r.lookahead=2,GU(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=u,e.avail_in=a,r.wrap=o,0},DM.deflateInfo="pako deflate (from Nodeca project)";var JU={},QU=NM,ZU=!0,$U=!0;try{String.fromCharCode.apply(null,[0])}catch(bq){ZU=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(bq){$U=!1}for(var eL=new QU.Buf8(256),tL=0;tL<256;tL++)eL[tL]=tL>=252?6:tL>=248?5:tL>=240?4:tL>=224?3:tL>=192?2:1;function rL(e,t){if(t<65534&&(e.subarray&&$U||!e.subarray&&ZU))return String.fromCharCode.apply(null,QU.shrinkBuf(e,t));for(var r="",n=0;n<t;n++)r+=String.fromCharCode(e[n]);return r}eL[254]=eL[254]=1,JU.string2buf=function(e){var t,r,n,i,o,a=e.length,s=0;for(i=0;i<a;i++)55296==(64512&(r=e.charCodeAt(i)))&&i+1<a&&56320==(64512&(n=e.charCodeAt(i+1)))&&(r=65536+(r-55296<<10)+(n-56320),i++),s+=r<128?1:r<2048?2:r<65536?3:4;for(t=new QU.Buf8(s),o=0,i=0;o<s;i++)55296==(64512&(r=e.charCodeAt(i)))&&i+1<a&&56320==(64512&(n=e.charCodeAt(i+1)))&&(r=65536+(r-55296<<10)+(n-56320),i++),r<128?t[o++]=r:r<2048?(t[o++]=192|r>>>6,t[o++]=128|63&r):r<65536?(t[o++]=224|r>>>12,t[o++]=128|r>>>6&63,t[o++]=128|63&r):(t[o++]=240|r>>>18,t[o++]=128|r>>>12&63,t[o++]=128|r>>>6&63,t[o++]=128|63&r);return t},JU.buf2binstring=function(e){return rL(e,e.length)},JU.binstring2buf=function(e){for(var t=new QU.Buf8(e.length),r=0,n=t.length;r<n;r++)t[r]=e.charCodeAt(r);return t},JU.buf2string=function(e,t){var r,n,i,o,a=t||e.length,s=new Array(2*a);for(n=0,r=0;r<a;)if((i=e[r++])<128)s[n++]=i;else if((o=eL[i])>4)s[n++]=65533,r+=o-1;else{for(i&=2===o?31:3===o?15:7;o>1&&r<a;)i=i<<6|63&e[r++],o--;o>1?s[n++]=65533:i<65536?s[n++]=i:(i-=65536,s[n++]=55296|i>>10&1023,s[n++]=56320|1023&i)}return rL(s,n)},JU.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+eL[e[r]]>t?r:t};var nL=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},iL=DM,oL=NM,aL=JU,sL=EU,uL=nL,cL=Object.prototype.toString;function dL(e){if(!(this instanceof dL))return new dL(e);this.options=oL.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 uL,this.strm.avail_out=0;var r=iL.deflateInit2(this.strm,t.level,t.method,t.windowBits,t.memLevel,t.strategy);if(0!==r)throw new Error(sL[r]);if(t.header&&iL.deflateSetHeader(this.strm,t.header),t.dictionary){var n;if(n="string"==typeof t.dictionary?aL.string2buf(t.dictionary):"[object ArrayBuffer]"===cL.call(t.dictionary)?new Uint8Array(t.dictionary):t.dictionary,0!==(r=iL.deflateSetDictionary(this.strm,n)))throw new Error(sL[r]);this._dict_set=!0}}function lL(e,t){var r=new dL(t);if(r.push(e,!0),r.err)throw r.msg||sL[r.err];return r.result}dL.prototype.push=function(e,t){var r,n,i=this.strm,o=this.options.chunkSize;if(this.ended)return!1;n=t===~~t?t:!0===t?4:0,"string"==typeof e?i.input=aL.string2buf(e):"[object ArrayBuffer]"===cL.call(e)?i.input=new Uint8Array(e):i.input=e,i.next_in=0,i.avail_in=i.input.length;do{if(0===i.avail_out&&(i.output=new oL.Buf8(o),i.next_out=0,i.avail_out=o),1!==(r=iL.deflate(i,n))&&0!==r)return this.onEnd(r),this.ended=!0,!1;0!==i.avail_out&&(0!==i.avail_in||4!==n&&2!==n)||("string"===this.options.to?this.onData(aL.buf2binstring(oL.shrinkBuf(i.output,i.next_out))):this.onData(oL.shrinkBuf(i.output,i.next_out)))}while((i.avail_in>0||0===i.avail_out)&&1!==r);return 4===n?(r=iL.deflateEnd(this.strm),this.onEnd(r),this.ended=!0,0===r):2!==n||(this.onEnd(0),i.avail_out=0,!0)},dL.prototype.onData=function(e){this.chunks.push(e)},dL.prototype.onEnd=function(e){0===e&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=oL.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg},xM.Deflate=dL,xM.deflate=lL,xM.deflateRaw=function(e,t){return(t=t||{}).raw=!0,lL(e,t)},xM.gzip=function(e,t){return(t=t||{}).gzip=!0,lL(e,t)};var hL={},fL=ae,pL=Ir,_L=K_,vL=oe,mL=RegExp.prototype;fL&&vL((function(){return"sy"!==Object.getOwnPropertyDescriptor(mL,"flags").get.call({dotAll:!0,sticky:!0})}))&&pL.f(mL,"flags",{configurable:!0,get:_L});var gL={},yL=NM,SL=15,bL=[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],EL=[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],kL=[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],RL=[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],TL=NM,IL=gU,AL=bU,wL=function(e,t){var r,n,i,o,a,s,u,c,d,l,h,f,p,_,v,m,g,y,S,b,E,k,R,T,I;r=e.state,n=e.next_in,T=e.input,i=n+(e.avail_in-5),o=e.next_out,I=e.output,a=o-(t-e.avail_out),s=o+(e.avail_out-257),u=r.dmax,c=r.wsize,d=r.whave,l=r.wnext,h=r.window,f=r.hold,p=r.bits,_=r.lencode,v=r.distcode,m=(1<<r.lenbits)-1,g=(1<<r.distbits)-1;e:do{p<15&&(f+=T[n++]<<p,p+=8,f+=T[n++]<<p,p+=8),y=_[f&m];t:for(;;){if(f>>>=S=y>>>24,p-=S,0===(S=y>>>16&255))I[o++]=65535&y;else{if(!(16&S)){if(0==(64&S)){y=_[(65535&y)+(f&(1<<S)-1)];continue t}if(32&S){r.mode=12;break e}e.msg="invalid literal/length code",r.mode=30;break e}b=65535&y,(S&=15)&&(p<S&&(f+=T[n++]<<p,p+=8),b+=f&(1<<S)-1,f>>>=S,p-=S),p<15&&(f+=T[n++]<<p,p+=8,f+=T[n++]<<p,p+=8),y=v[f&g];r:for(;;){if(f>>>=S=y>>>24,p-=S,!(16&(S=y>>>16&255))){if(0==(64&S)){y=v[(65535&y)+(f&(1<<S)-1)];continue r}e.msg="invalid distance code",r.mode=30;break e}if(E=65535&y,p<(S&=15)&&(f+=T[n++]<<p,(p+=8)<S&&(f+=T[n++]<<p,p+=8)),(E+=f&(1<<S)-1)>u){e.msg="invalid distance too far back",r.mode=30;break e}if(f>>>=S,p-=S,E>(S=o-a)){if((S=E-S)>d&&r.sane){e.msg="invalid distance too far back",r.mode=30;break e}if(k=0,R=h,0===l){if(k+=c-S,S<b){b-=S;do{I[o++]=h[k++]}while(--S);k=o-E,R=I}}else if(l<S){if(k+=c+l-S,(S-=l)<b){b-=S;do{I[o++]=h[k++]}while(--S);if(k=0,l<b){b-=S=l;do{I[o++]=h[k++]}while(--S);k=o-E,R=I}}}else if(k+=l-S,S<b){b-=S;do{I[o++]=h[k++]}while(--S);k=o-E,R=I}for(;b>2;)I[o++]=R[k++],I[o++]=R[k++],I[o++]=R[k++],b-=3;b&&(I[o++]=R[k++],b>1&&(I[o++]=R[k++]))}else{k=o-E;do{I[o++]=I[k++],I[o++]=I[k++],I[o++]=I[k++],b-=3}while(b>2);b&&(I[o++]=I[k++],b>1&&(I[o++]=I[k++]))}break}}break}}while(n<i&&o<s);n-=b=p>>3,f&=(1<<(p-=b<<3))-1,e.next_in=n,e.next_out=o,e.avail_in=n<i?i-n+5:5-(n-i),e.avail_out=o<s?s-o+257:257-(o-s),r.hold=f,r.bits=p},CL=function(e,t,r,n,i,o,a,s){var u,c,d,l,h,f,p,_,v,m=s.bits,g=0,y=0,S=0,b=0,E=0,k=0,R=0,T=0,I=0,A=0,w=null,C=0,O=new yL.Buf16(16),N=new yL.Buf16(16),x=null,D=0;for(g=0;g<=SL;g++)O[g]=0;for(y=0;y<n;y++)O[t[r+y]]++;for(E=m,b=SL;b>=1&&0===O[b];b--);if(E>b&&(E=b),0===b)return i[o++]=20971520,i[o++]=20971520,s.bits=1,0;for(S=1;S<b&&0===O[S];S++);for(E<S&&(E=S),T=1,g=1;g<=SL;g++)if(T<<=1,(T-=O[g])<0)return-1;if(T>0&&(0===e||1!==b))return-1;for(N[1]=0,g=1;g<SL;g++)N[g+1]=N[g]+O[g];for(y=0;y<n;y++)0!==t[r+y]&&(a[N[t[r+y]]++]=y);if(0===e?(w=x=a,f=19):1===e?(w=bL,C-=257,x=EL,D-=257,f=256):(w=kL,x=RL,f=-1),A=0,y=0,g=S,h=o,k=E,R=0,d=-1,l=(I=1<<E)-1,1===e&&I>852||2===e&&I>592)return 1;for(;;){p=g-R,a[y]<f?(_=0,v=a[y]):a[y]>f?(_=x[D+a[y]],v=w[C+a[y]]):(_=96,v=0),u=1<<g-R,S=c=1<<k;do{i[h+(A>>R)+(c-=u)]=p<<24|_<<16|v|0}while(0!==c);for(u=1<<g-1;A&u;)u>>=1;if(0!==u?(A&=u-1,A+=u):A=0,y++,0==--O[g]){if(g===b)break;g=t[r+a[y]]}if(g>E&&(A&l)!==d){for(0===R&&(R=E),h+=S,T=1<<(k=g-R);k+R<b&&!((T-=O[k+R])<=0);)k++,T<<=1;if(I+=1<<k,1===e&&I>852||2===e&&I>592)return 1;i[d=A&l]=E<<24|k<<16|h-o|0}}return 0!==A&&(i[h+A]=g-R<<24|64<<16|0),s.bits=E,0},OL=-2,NL=12,xL=30;function DL(e){return(e>>>24&255)+(e>>>8&65280)+((65280&e)<<8)+((255&e)<<24)}function PL(){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 TL.Buf16(320),this.work=new TL.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function ML(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 TL.Buf32(852),t.distcode=t.distdyn=new TL.Buf32(592),t.sane=1,t.back=-1,0):OL}function UL(e){var t;return e&&e.state?((t=e.state).wsize=0,t.whave=0,t.wnext=0,ML(e)):OL}function LL(e,t){var r,n;return e&&e.state?(n=e.state,t<0?(r=0,t=-t):(r=1+(t>>4),t<48&&(t&=15)),t&&(t<8||t>15)?OL:(null!==n.window&&n.wbits!==t&&(n.window=null),n.wrap=r,n.wbits=t,UL(e))):OL}function VL(e,t){var r,n;return e?(n=new PL,e.state=n,n.window=null,0!==(r=LL(e,t))&&(e.state=null),r):OL}var FL,BL,jL=!0;function GL(e){if(jL){var t;for(FL=new TL.Buf32(512),BL=new TL.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(CL(1,e.lens,0,288,FL,0,e.work,{bits:9}),t=0;t<32;)e.lens[t++]=5;CL(2,e.lens,0,32,BL,0,e.work,{bits:5}),jL=!1}e.lencode=FL,e.lenbits=9,e.distcode=BL,e.distbits=5}function HL(e,t,r,n){var i,o=e.state;return null===o.window&&(o.wsize=1<<o.wbits,o.wnext=0,o.whave=0,o.window=new TL.Buf8(o.wsize)),n>=o.wsize?(TL.arraySet(o.window,t,r-o.wsize,o.wsize,0),o.wnext=0,o.whave=o.wsize):((i=o.wsize-o.wnext)>n&&(i=n),TL.arraySet(o.window,t,r-n,i,o.wnext),(n-=i)?(TL.arraySet(o.window,t,r-n,n,0),o.wnext=n,o.whave=o.wsize):(o.wnext+=i,o.wnext===o.wsize&&(o.wnext=0),o.whave<o.wsize&&(o.whave+=i))),0}gL.inflateReset=UL,gL.inflateReset2=LL,gL.inflateResetKeep=ML,gL.inflateInit=function(e){return VL(e,15)},gL.inflateInit2=VL,gL.inflate=function(e,t){var r,n,i,o,a,s,u,c,d,l,h,f,p,_,v,m,g,y,S,b,E,k,R,T,I=0,A=new TL.Buf8(4),w=[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 OL;(r=e.state).mode===NL&&(r.mode=13),a=e.next_out,i=e.output,u=e.avail_out,o=e.next_in,n=e.input,s=e.avail_in,c=r.hold,d=r.bits,l=s,h=u,k=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--,c+=n[o++]<<d,d+=8}if(2&r.wrap&&35615===c){r.check=0,A[0]=255&c,A[1]=c>>>8&255,r.check=AL(r.check,A,2,0),c=0,d=0,r.mode=2;break}if(r.flags=0,r.head&&(r.head.done=!1),!(1&r.wrap)||(((255&c)<<8)+(c>>8))%31){e.msg="incorrect header check",r.mode=xL;break}if(8!=(15&c)){e.msg="unknown compression method",r.mode=xL;break}if(d-=4,E=8+(15&(c>>>=4)),0===r.wbits)r.wbits=E;else if(E>r.wbits){e.msg="invalid window size",r.mode=xL;break}r.dmax=1<<E,e.adler=r.check=1,r.mode=512&c?10:NL,c=0,d=0;break;case 2:for(;d<16;){if(0===s)break e;s--,c+=n[o++]<<d,d+=8}if(r.flags=c,8!=(255&r.flags)){e.msg="unknown compression method",r.mode=xL;break}if(57344&r.flags){e.msg="unknown header flags set",r.mode=xL;break}r.head&&(r.head.text=c>>8&1),512&r.flags&&(A[0]=255&c,A[1]=c>>>8&255,r.check=AL(r.check,A,2,0)),c=0,d=0,r.mode=3;case 3:for(;d<32;){if(0===s)break e;s--,c+=n[o++]<<d,d+=8}r.head&&(r.head.time=c),512&r.flags&&(A[0]=255&c,A[1]=c>>>8&255,A[2]=c>>>16&255,A[3]=c>>>24&255,r.check=AL(r.check,A,4,0)),c=0,d=0,r.mode=4;case 4:for(;d<16;){if(0===s)break e;s--,c+=n[o++]<<d,d+=8}r.head&&(r.head.xflags=255&c,r.head.os=c>>8),512&r.flags&&(A[0]=255&c,A[1]=c>>>8&255,r.check=AL(r.check,A,2,0)),c=0,d=0,r.mode=5;case 5:if(1024&r.flags){for(;d<16;){if(0===s)break e;s--,c+=n[o++]<<d,d+=8}r.length=c,r.head&&(r.head.extra_len=c),512&r.flags&&(A[0]=255&c,A[1]=c>>>8&255,r.check=AL(r.check,A,2,0)),c=0,d=0}else r.head&&(r.head.extra=null);r.mode=6;case 6:if(1024&r.flags&&((f=r.length)>s&&(f=s),f&&(r.head&&(E=r.head.extra_len-r.length,r.head.extra||(r.head.extra=new Array(r.head.extra_len)),TL.arraySet(r.head.extra,n,o,f,E)),512&r.flags&&(r.check=AL(r.check,n,f,o)),s-=f,o+=f,r.length-=f),r.length))break e;r.length=0,r.mode=7;case 7:if(2048&r.flags){if(0===s)break e;f=0;do{E=n[o+f++],r.head&&E&&r.length<65536&&(r.head.name+=String.fromCharCode(E))}while(E&&f<s);if(512&r.flags&&(r.check=AL(r.check,n,f,o)),s-=f,o+=f,E)break e}else r.head&&(r.head.name=null);r.length=0,r.mode=8;case 8:if(4096&r.flags){if(0===s)break e;f=0;do{E=n[o+f++],r.head&&E&&r.length<65536&&(r.head.comment+=String.fromCharCode(E))}while(E&&f<s);if(512&r.flags&&(r.check=AL(r.check,n,f,o)),s-=f,o+=f,E)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--,c+=n[o++]<<d,d+=8}if(c!==(65535&r.check)){e.msg="header crc mismatch",r.mode=xL;break}c=0,d=0}r.head&&(r.head.hcrc=r.flags>>9&1,r.head.done=!0),e.adler=r.check=0,r.mode=NL;break;case 10:for(;d<32;){if(0===s)break e;s--,c+=n[o++]<<d,d+=8}e.adler=r.check=DL(c),c=0,d=0,r.mode=11;case 11:if(0===r.havedict)return e.next_out=a,e.avail_out=u,e.next_in=o,e.avail_in=s,r.hold=c,r.bits=d,2;e.adler=r.check=1,r.mode=NL;case NL:if(5===t||6===t)break e;case 13:if(r.last){c>>>=7&d,d-=7&d,r.mode=27;break}for(;d<3;){if(0===s)break e;s--,c+=n[o++]<<d,d+=8}switch(r.last=1&c,d-=1,3&(c>>>=1)){case 0:r.mode=14;break;case 1:if(GL(r),r.mode=20,6===t){c>>>=2,d-=2;break e}break;case 2:r.mode=17;break;case 3:e.msg="invalid block type",r.mode=xL}c>>>=2,d-=2;break;case 14:for(c>>>=7&d,d-=7&d;d<32;){if(0===s)break e;s--,c+=n[o++]<<d,d+=8}if((65535&c)!=(c>>>16^65535)){e.msg="invalid stored block lengths",r.mode=xL;break}if(r.length=65535&c,c=0,d=0,r.mode=15,6===t)break e;case 15:r.mode=16;case 16:if(f=r.length){if(f>s&&(f=s),f>u&&(f=u),0===f)break e;TL.arraySet(i,n,o,f,a),s-=f,o+=f,u-=f,a+=f,r.length-=f;break}r.mode=NL;break;case 17:for(;d<14;){if(0===s)break e;s--,c+=n[o++]<<d,d+=8}if(r.nlen=257+(31&c),c>>>=5,d-=5,r.ndist=1+(31&c),c>>>=5,d-=5,r.ncode=4+(15&c),c>>>=4,d-=4,r.nlen>286||r.ndist>30){e.msg="too many length or distance symbols",r.mode=xL;break}r.have=0,r.mode=18;case 18:for(;r.have<r.ncode;){for(;d<3;){if(0===s)break e;s--,c+=n[o++]<<d,d+=8}r.lens[w[r.have++]]=7&c,c>>>=3,d-=3}for(;r.have<19;)r.lens[w[r.have++]]=0;if(r.lencode=r.lendyn,r.lenbits=7,R={bits:r.lenbits},k=CL(0,r.lens,0,19,r.lencode,0,r.work,R),r.lenbits=R.bits,k){e.msg="invalid code lengths set",r.mode=xL;break}r.have=0,r.mode=19;case 19:for(;r.have<r.nlen+r.ndist;){for(;m=(I=r.lencode[c&(1<<r.lenbits)-1])>>>16&255,g=65535&I,!((v=I>>>24)<=d);){if(0===s)break e;s--,c+=n[o++]<<d,d+=8}if(g<16)c>>>=v,d-=v,r.lens[r.have++]=g;else{if(16===g){for(T=v+2;d<T;){if(0===s)break e;s--,c+=n[o++]<<d,d+=8}if(c>>>=v,d-=v,0===r.have){e.msg="invalid bit length repeat",r.mode=xL;break}E=r.lens[r.have-1],f=3+(3&c),c>>>=2,d-=2}else if(17===g){for(T=v+3;d<T;){if(0===s)break e;s--,c+=n[o++]<<d,d+=8}d-=v,E=0,f=3+(7&(c>>>=v)),c>>>=3,d-=3}else{for(T=v+7;d<T;){if(0===s)break e;s--,c+=n[o++]<<d,d+=8}d-=v,E=0,f=11+(127&(c>>>=v)),c>>>=7,d-=7}if(r.have+f>r.nlen+r.ndist){e.msg="invalid bit length repeat",r.mode=xL;break}for(;f--;)r.lens[r.have++]=E}}if(r.mode===xL)break;if(0===r.lens[256]){e.msg="invalid code -- missing end-of-block",r.mode=xL;break}if(r.lenbits=9,R={bits:r.lenbits},k=CL(1,r.lens,0,r.nlen,r.lencode,0,r.work,R),r.lenbits=R.bits,k){e.msg="invalid literal/lengths set",r.mode=xL;break}if(r.distbits=6,r.distcode=r.distdyn,R={bits:r.distbits},k=CL(2,r.lens,r.nlen,r.ndist,r.distcode,0,r.work,R),r.distbits=R.bits,k){e.msg="invalid distances set",r.mode=xL;break}if(r.mode=20,6===t)break e;case 20:r.mode=21;case 21:if(s>=6&&u>=258){e.next_out=a,e.avail_out=u,e.next_in=o,e.avail_in=s,r.hold=c,r.bits=d,wL(e,h),a=e.next_out,i=e.output,u=e.avail_out,o=e.next_in,n=e.input,s=e.avail_in,c=r.hold,d=r.bits,r.mode===NL&&(r.back=-1);break}for(r.back=0;m=(I=r.lencode[c&(1<<r.lenbits)-1])>>>16&255,g=65535&I,!((v=I>>>24)<=d);){if(0===s)break e;s--,c+=n[o++]<<d,d+=8}if(m&&0==(240&m)){for(y=v,S=m,b=g;m=(I=r.lencode[b+((c&(1<<y+S)-1)>>y)])>>>16&255,g=65535&I,!(y+(v=I>>>24)<=d);){if(0===s)break e;s--,c+=n[o++]<<d,d+=8}c>>>=y,d-=y,r.back+=y}if(c>>>=v,d-=v,r.back+=v,r.length=g,0===m){r.mode=26;break}if(32&m){r.back=-1,r.mode=NL;break}if(64&m){e.msg="invalid literal/length code",r.mode=xL;break}r.extra=15&m,r.mode=22;case 22:if(r.extra){for(T=r.extra;d<T;){if(0===s)break e;s--,c+=n[o++]<<d,d+=8}r.length+=c&(1<<r.extra)-1,c>>>=r.extra,d-=r.extra,r.back+=r.extra}r.was=r.length,r.mode=23;case 23:for(;m=(I=r.distcode[c&(1<<r.distbits)-1])>>>16&255,g=65535&I,!((v=I>>>24)<=d);){if(0===s)break e;s--,c+=n[o++]<<d,d+=8}if(0==(240&m)){for(y=v,S=m,b=g;m=(I=r.distcode[b+((c&(1<<y+S)-1)>>y)])>>>16&255,g=65535&I,!(y+(v=I>>>24)<=d);){if(0===s)break e;s--,c+=n[o++]<<d,d+=8}c>>>=y,d-=y,r.back+=y}if(c>>>=v,d-=v,r.back+=v,64&m){e.msg="invalid distance code",r.mode=xL;break}r.offset=g,r.extra=15&m,r.mode=24;case 24:if(r.extra){for(T=r.extra;d<T;){if(0===s)break e;s--,c+=n[o++]<<d,d+=8}r.offset+=c&(1<<r.extra)-1,c>>>=r.extra,d-=r.extra,r.back+=r.extra}if(r.offset>r.dmax){e.msg="invalid distance too far back",r.mode=xL;break}r.mode=25;case 25:if(0===u)break e;if(f=h-u,r.offset>f){if((f=r.offset-f)>r.whave&&r.sane){e.msg="invalid distance too far back",r.mode=xL;break}f>r.wnext?(f-=r.wnext,p=r.wsize-f):p=r.wnext-f,f>r.length&&(f=r.length),_=r.window}else _=i,p=a-r.offset,f=r.length;f>u&&(f=u),u-=f,r.length-=f;do{i[a++]=_[p++]}while(--f);0===r.length&&(r.mode=21);break;case 26:if(0===u)break e;i[a++]=r.length,u--,r.mode=21;break;case 27:if(r.wrap){for(;d<32;){if(0===s)break e;s--,c|=n[o++]<<d,d+=8}if(h-=u,e.total_out+=h,r.total+=h,h&&(e.adler=r.check=r.flags?AL(r.check,i,h,a-h):IL(r.check,i,h,a-h)),h=u,(r.flags?c:DL(c))!==r.check){e.msg="incorrect data check",r.mode=xL;break}c=0,d=0}r.mode=28;case 28:if(r.wrap&&r.flags){for(;d<32;){if(0===s)break e;s--,c+=n[o++]<<d,d+=8}if(c!==(4294967295&r.total)){e.msg="incorrect length check",r.mode=xL;break}c=0,d=0}r.mode=29;case 29:k=1;break e;case xL:k=-3;break e;case 31:return-4;default:return OL}return e.next_out=a,e.avail_out=u,e.next_in=o,e.avail_in=s,r.hold=c,r.bits=d,(r.wsize||h!==e.avail_out&&r.mode<xL&&(r.mode<27||4!==t))&&HL(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?AL(r.check,i,h,e.next_out-h):IL(r.check,i,h,e.next_out-h)),e.data_type=r.bits+(r.last?64:0)+(r.mode===NL?128:0)+(20===r.mode||15===r.mode?256:0),(0===l&&0===h||4===t)&&0===k&&(k=-5),k},gL.inflateEnd=function(e){if(!e||!e.state)return OL;var t=e.state;return t.window&&(t.window=null),e.state=null,0},gL.inflateGetHeader=function(e,t){var r;return e&&e.state?0==(2&(r=e.state).wrap)?OL:(r.head=t,t.done=!1,0):OL},gL.inflateSetDictionary=function(e,t){var r,n=t.length;return e&&e.state?0!==(r=e.state).wrap&&11!==r.mode?OL:11===r.mode&&IL(1,t,n,0)!==r.check?-3:HL(e,t,n,n)?(r.mode=31,-4):(r.havedict=1,0):OL},gL.inflateInfo="pako inflate (from Nodeca project)";var zL={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 KL=gL,WL=NM,XL=JU,qL=zL,YL=EU,JL=nL,QL=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},ZL=Object.prototype.toString;function $L(e){if(!(this instanceof $L))return new $L(e);this.options=WL.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 JL,this.strm.avail_out=0;var r=KL.inflateInit2(this.strm,t.windowBits);if(r!==qL.Z_OK)throw new Error(YL[r]);if(this.header=new QL,KL.inflateGetHeader(this.strm,this.header),t.dictionary&&("string"==typeof t.dictionary?t.dictionary=XL.string2buf(t.dictionary):"[object ArrayBuffer]"===ZL.call(t.dictionary)&&(t.dictionary=new Uint8Array(t.dictionary)),t.raw&&(r=KL.inflateSetDictionary(this.strm,t.dictionary))!==qL.Z_OK))throw new Error(YL[r])}function eV(e,t){var r=new $L(t);if(r.push(e,!0),r.err)throw r.msg||YL[r.err];return r.result}$L.prototype.push=function(e,t){var r,n,i,o,a,s=this.strm,u=this.options.chunkSize,c=this.options.dictionary,d=!1;if(this.ended)return!1;n=t===~~t?t:!0===t?qL.Z_FINISH:qL.Z_NO_FLUSH,"string"==typeof e?s.input=XL.binstring2buf(e):"[object ArrayBuffer]"===ZL.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 WL.Buf8(u),s.next_out=0,s.avail_out=u),(r=KL.inflate(s,qL.Z_NO_FLUSH))===qL.Z_NEED_DICT&&c&&(r=KL.inflateSetDictionary(this.strm,c)),r===qL.Z_BUF_ERROR&&!0===d&&(r=qL.Z_OK,d=!1),r!==qL.Z_STREAM_END&&r!==qL.Z_OK)return this.onEnd(r),this.ended=!0,!1;s.next_out&&(0!==s.avail_out&&r!==qL.Z_STREAM_END&&(0!==s.avail_in||n!==qL.Z_FINISH&&n!==qL.Z_SYNC_FLUSH)||("string"===this.options.to?(i=XL.utf8border(s.output,s.next_out),o=s.next_out-i,a=XL.buf2string(s.output,i),s.next_out=o,s.avail_out=u-o,o&&WL.arraySet(s.output,s.output,i,o,0),this.onData(a)):this.onData(WL.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!==qL.Z_STREAM_END);return r===qL.Z_STREAM_END&&(n=qL.Z_FINISH),n===qL.Z_FINISH?(r=KL.inflateEnd(this.strm),this.onEnd(r),this.ended=!0,r===qL.Z_OK):n!==qL.Z_SYNC_FLUSH||(this.onEnd(qL.Z_OK),s.avail_out=0,!0)},$L.prototype.onData=function(e){this.chunks.push(e)},$L.prototype.onEnd=function(e){e===qL.Z_OK&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=WL.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg},hL.Inflate=$L,hL.inflate=eV,hL.inflateRaw=function(e,t){return(t=t||{}).raw=!0,eV(e,t)},hL.ungzip=eV;var tV={};(0,NM.assign)(tV,xM,hL,zL);var rV=tV,nV=function(e){return e.RTC="rtc",e}(nV||{}),iV=function(e){return e.W_5="5",e}(iV||{}),oV=function(e){return e.IOS="ios",e.ANDROID="android",e.WEB="web",e.WINDOWS="windows",e.MAC="mac",e.LINUX="linux",e}(oV||{}),aV=function(e){return e.REQUEST="request",e.RESPONSE="response",e}(aV||{}),sV=function(e){return 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",e}(sV||{}),uV=function(e){return e.WEBSOCKET="websocket",e.NETWORKCHANGED="networkChanged",e.PEERCONNECTION="peerconnection",e}(uV||{}),cV=function(e){return e.WEBSOCKET_RECONNECTED="websocket reconnected",e.PEERCONNECTION_RECONNECTED="peerconnection reconnected",e}(cV||{}),dV=function(e){return e.WEBSOCKET="websocket",e.NETWORKCHANGED="networkChanged",e.PEERCONNECTION="peerconnection",e}(dV||{}),lV=function(e){return 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",e}(lV||{}),hV=function(e){return 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",e}(hV||{}),fV=function(e){return 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",e}(fV||{}),pV=function(e){return e.UP="up",e.DOWN="down",e.DIRECT="direct",e}(pV||{}),_V=function(e){return e.UP="up",e.DOWN="down",e.PRE="pre",e}(_V||{}),vV=function(e){return e.UP="up",e.DOWN="down",e.PRE="pre",e}(vV||{}),mV=function(e){return e.W_0="0",e.W_1="1",e}(mV||{}),gV=function(e){return e.UP="up",e.DOWN="down",e}(gV||{}),yV=function(e){return e.ANSWER="answer",e.INCRANSWER="incranswer",e}(yV||{}),SV=function(e){return e.UP="up",e.DOWN="down",e}(SV||{}),bV=function(e){return e.SUCCESS="success",e.FAIL="fail",e}(bV||{}),EV=function(e){return e.W_0="0",e.W_1="1",e}(EV||{}),kV=function(e){return 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",e}(kV||{}),RV=function(e){return e.SUCCESS="success",e.FAIL="fail",e.IGNORE="ignore",e}(RV||{}),TV=function(e){return 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",e}(TV||{}),IV=function(e){return e.PLAYOUT_DEVICE_SWITCH="playout_device_switch",e.RECORD_DEVICE_SWITCH="record_device_switch",e.UNKNOWN="unknown",e}(IV||{}),AV=function(e){return e.BEGIN_SEND="begin_send",e.SENT_END="sent_end",e.BEGIN_RECV="begin_recv",e.RECV_END="recv_end",e}(AV||{}),wV=function(e){return e.AUDIO="audio",e.VIDEO="video",e.SCREEN_VIDEO="screen_video",e.SCREEN_AUDIO="screen_audio",e}(wV||{}),CV=function(e){return 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",e}(CV||{}),OV=function(e){return 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",e}(OV||{}),NV=function(e){return e.BEGIN="begin",e.END="end",e}(NV||{}),xV=function(e){return e.BEGIN="begin",e.END="end",e}(xV||{}),DV=function(e){return e.P2P="p2p",e.P2P_OUTSIDE_ROOM="p2p_outside_room",e.P2SERVER="p2server",e}(DV||{}),PV=function(e){return e.START="start",e.START_CAPTURE_RESULT="start_capture_result",e.STARTED="started",e.RUNNING_FAILED="running_failed",e.STOP="stop",e.STOPPED="stopped",e}(PV||{}),MV=function(e){return 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",e}(MV||{}),UV=function(){function e(t){a(this,e),c(this,"_event_key",void 0),c(this,"_device_id",void 0),c(this,"_rtc_app_id",void 0),c(this,"_product_line",void 0),c(this,"_report_version",void 0),c(this,"_os",void 0),c(this,"_rtc_sdk_version",void 0),c(this,"_rtc_timestamp",void 0),c(this,"_rtc_sdk_git_commit",void 0),c(this,"_report_id",void 0),c(this,"_connection_id",void 0),c(this,"_rtc_sid",void 0),c(this,"_engine_session_id",void 0),c(this,"_rtc_business_id",void 0),c(this,"_project_key",void 0),c(this,"_network_type",void 0),c(this,"_app_version",void 0),c(this,"_aid",void 0),c(this,"_device_model",void 0),c(this,"_device_brand",void 0),c(this,"_common_extra_info",void 0),c(this,"_had_selected_p2p",void 0),c(this,"_rtc_env_type",void 0),c(this,"_room_id",void 0),c(this,"_user_id",void 0),c(this,"_rtc_session_id",void 0),c(this,"_user_agent",void 0),c(this,"_auto_play_policy",void 0),this.monitor=t}return u(e,[{key:"setStats",value:function(e){var t=this;Object.keys(e).forEach((function(r){t["_"+r]=e[r]})),this.monitor.StartUp()}},{key:"event_key",get:function(){return this._event_key}},{key:"device_id",get:function(){return this._device_id}},{key:"rtc_app_id",get:function(){return this._rtc_app_id}},{key:"product_line",get:function(){return this._product_line}},{key:"report_version",get:function(){return this._report_version}},{key:"os",get:function(){return this._os}},{key:"rtc_sdk_version",get:function(){return this._rtc_sdk_version}},{key:"rtc_timestamp",get:function(){return this._rtc_timestamp}},{key:"rtc_sdk_git_commit",get:function(){return this._rtc_sdk_git_commit}},{key:"report_id",get:function(){return this._report_id}},{key:"connection_id",get:function(){return this._connection_id}},{key:"rtc_sid",get:function(){return this._rtc_sid}},{key:"engine_session_id",get:function(){return this._engine_session_id}},{key:"rtc_business_id",get:function(){return this._rtc_business_id}},{key:"project_key",get:function(){return this._project_key}},{key:"network_type",get:function(){return this._network_type}},{key:"app_version",get:function(){return this._app_version}},{key:"aid",get:function(){return this._aid}},{key:"device_model",get:function(){return this._device_model}},{key:"device_brand",get:function(){return this._device_brand}},{key:"common_extra_info",get:function(){return this._common_extra_info}},{key:"had_selected_p2p",get:function(){return this._had_selected_p2p}},{key:"rtc_env_type",get:function(){return this._rtc_env_type}},{key:"room_id",get:function(){return this._room_id}},{key:"user_id",get:function(){return this._user_id}},{key:"rtc_session_id",get:function(){return this._rtc_session_id}},{key:"user_agent",get:function(){return this._user_agent}},{key:"auto_play_policy",get:function(){return this._auto_play_policy}}]),e}(),LV=function(e){d(n,e);var t=v(n);function n(){var e;return a(this,n),c(p(e=t.call(this)),"report_id",void 0),c(p(e),"report_common",void 0),c(p(e),"modify_ids",void 0),c(p(e),"dataBuffer",void 0),c(p(e),"posting",void 0),c(p(e),"sucSendTimer",void 0),c(p(e),"preSucTime",void 0),c(p(e),"errSendTimer",void 0),c(p(e),"errSendDelay",void 0),c(p(e),"commonStats",void 0),e.report_id=0,e.dataBuffer=[],e.posting=!1,e.report_common={},e.modify_ids={},e.preSucTime=0,e.errSendDelay=100,e.commonStats=new UV(p(e)),RP()||window.addEventListener("beforeunload",(function(){clearTimeout(e.errSendTimer),clearTimeout(e.sucSendTimer),e.send(null,!0)})),e}return u(n,[{key:"push",value: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()))}},{key:"unshift",value:function(e){this.dataBuffer=e.concat(this.dataBuffer)}},{key:"send",value:function(e,t){var r=this;if(e||this.dataBuffer.length){var n={data:e||this.dataBuffer.splice(0,4e3),header:this.report_common,from:"web",os:"web",version:"1"},i=new XMLHttpRequest;i.timeout=1e4,i.onreadystatechange=function(){if(4===i.readyState){var o;if(e||(r.posting=!1),200===i.status||304===i.status)try{o=JSON.parse(i.responseText)}catch(Sq){}o&&0===o.StatusCode?e||t||r.sucSend():e?r.send(e):(r.unshift(n.data),t?r.send():r.errSend())}};var o=sF.LOG_SERVER_URL;if(i.open("POST",o,!0),e||(this.posting=!0),!RP()&&location.search.includes("_rtc_autotest_"))this.safeEmit("report_event",n),0!==this.dataBuffer.length?this.sucSend():this.posting=!1;else if(!RP()&&location.search.includes("_rtc_debug_"))i.send(JSON.stringify(n));else{var a=rV.gzip(JSON.stringify(n));i.setRequestHeader("Content-Encoding","gzip"),i.setRequestHeader("Content-Type","application/x-www-form-urlencoded; charset=UTF-8"),i.send(a)}}}},{key:"sucSend",value:function(){this.errSendDelay=100,this.preSucTime=Date.now(),this.sucSendTimer=setTimeout(this.send.bind(this),2e3)}},{key:"errSend",value:function(){var e=this;this.errSendTimer=setTimeout((function(){e.send(),e.errSendTimer=null}),this.errSendDelay),this.errSendDelay*=2}},{key:"StartUp",value:function(){var e=this.report_common,t=this.commonStats,r=t.event_key,n=t.device_id,i=t.rtc_app_id,o=t.product_line,a=t.report_version,s=t.os,u=t.rtc_sdk_version,c=t.rtc_timestamp,d=t.rtc_sdk_git_commit,l=t.report_id,h=t.rtc_sid,f=t.engine_session_id,p=t.rtc_business_id,_=t.project_key,v=t.network_type,m=t.app_version,g=t.aid,y=t.device_model,S=t.device_brand,b=t.common_extra_info,E=t.had_selected_p2p,k=t.rtc_env_type,R=t.user_agent,T=t.auto_play_policy;Object.assign(e,{event_key:r,device_id:n,rtc_app_id:i,product_line:o,report_version:a,os:s,rtc_sdk_version:u,rtc_timestamp:c,rtc_sdk_git_commit:d,report_id:l,rtc_sid:h,engine_session_id:f,rtc_business_id:p,project_key:_,network_type:v,app_version:m,aid:g,device_model:y,device_brand:S,common_extra_info:b,had_selected_p2p:E,rtc_env_type:k,user_agent:R,auto_play_policy:T}),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)}},{key:"rtcSdkApiCall",value:function(e,t,n){var i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},o=r(r({event_key:"rtc_sdk_api_call",report_id:this.report_id++,rtc_timestamp:Date.now(),sdk_api_name:e,error_code:t,message:n},this.modify_ids),{},{common_extra_info:JSON.stringify(i)});this.push(o)}},{key:"rtcSdkCallback",value:function(e,t,n){var i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},o=r(r({event_key:"rtc_sdk_callback",report_id:this.report_id++,rtc_timestamp:Date.now(),sdk_callback_name:e,error_code:t,message:n},this.modify_ids),{},{common_extra_info:JSON.stringify(i)});this.push(o)}},{key:"rtcGetConfig",value:function(e,t,n,i,o,a,s){var u=arguments.length>7&&void 0!==arguments[7]?arguments[7]:{},c=r(r({event_key:"rtc_get_config",report_id:this.report_id++,rtc_timestamp:Date.now(),error_code:e,message:t,elapse:n,host:i,type:o,config_id:a,enable_cloud_proxy:s},this.modify_ids),{},{common_extra_info:JSON.stringify(u)});this.push(c)}},{key:"rtcReconnect",value:function(e,t,n,i){var o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{},a=r(r({event_key:"rtc_reconnect",report_id:this.report_id++,rtc_timestamp:Date.now(),error_code:e,message:t,reconnect_id:n,reconnect_type:i},this.modify_ids),{},{common_extra_info:JSON.stringify(o)});this.push(a)}},{key:"rtcReconnected",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=r(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(n)});this.push(i)}},{key:"rtcGetAccess",value:function(e,t,n,i,o,a){var s=arguments.length>6&&void 0!==arguments[6]?arguments[6]:{},u=r(r({event_key:"rtc_get_access",report_id:this.report_id++,rtc_timestamp:Date.now(),error_code:e,message:t,elapse:n,type:i,host:o,connect_session_id:a},this.modify_ids),{},{common_extra_info:JSON.stringify(s)});this.push(u)}},{key:"rtcPreIceState",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=r(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(n)});this.push(i)}},{key:"rtcNodeChange",value:function(e,t,n){var i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},o=r(r({event_key:"rtc_node_change",report_id:this.report_id++,rtc_timestamp:Date.now(),error_code:e,message:t,reason:n},this.modify_ids),{},{common_extra_info:JSON.stringify(i)});this.push(o)}},{key:"rtcSignalingMsgError",value:function(e,t,n){var i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},o=r(r({event_key:"rtc_signaling_msg_error",report_id:this.report_id++,rtc_timestamp:Date.now(),error_code:e,message:t,reason:n},this.modify_ids),{},{common_extra_info:JSON.stringify(i)});this.push(o)}},{key:"rtcSignaling",value:function(e,t,n,i,o){var a=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{},s=r(r({event_key:"rtc_signaling",report_id:this.report_id++,rtc_timestamp:Date.now(),error_code:e,message:t,signaling_event:n,signaling_type:i,direction:o},this.modify_ids),{},{common_extra_info:JSON.stringify(a)});this.push(s)}},{key:"rtcJoinRoom",value:function(e,t,n,i){var o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{},a=r(r({event_key:"rtc_join_room",report_id:this.report_id++,rtc_timestamp:Date.now(),error_code:e,deviceModel:t,deviceManufacturer:n,elapse:i},this.modify_ids),{},{common_extra_info:JSON.stringify(o)});this.push(a)}},{key:"rtcLeaveRoom",value:function(e,t,n){var i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},o=r(r({event_key:"rtc_leave_room",report_id:this.report_id++,rtc_timestamp:Date.now(),error_code:e,message:t,elapse:n},this.modify_ids),{},{common_extra_info:JSON.stringify(i)});this.push(o)}},{key:"rtcBeginCreateOffer",value:function(e,t,n){var i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},o=r(r({event_key:"rtc_begin_create_offer",report_id:this.report_id++,rtc_timestamp:Date.now(),direction:e,stream_id:t,stream_user_id:n},this.modify_ids),{},{common_extra_info:JSON.stringify(i)});this.push(o)}},{key:"rtcCreateOffer",value:function(e,t,n,i,o){var a=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{},s=r(r({event_key:"rtc_create_offer",report_id:this.report_id++,rtc_timestamp:Date.now(),error_code:e,direction:t,stream_id:n,stream_user_id:i,elapse:o},this.modify_ids),{},{common_extra_info:JSON.stringify(a)});this.push(s)}},{key:"rtcSetDescription",value:function(e,t,n,i,o,a,s){var u=arguments.length>7&&void 0!==arguments[7]?arguments[7]:{},c=r(r({event_key:"rtc_set_description",report_id:this.report_id++,rtc_timestamp:Date.now(),error_code:e,message:t,is_local:n,direction:i,stream_id:o,stream_user_id:a,elapse:s},this.modify_ids),{},{common_extra_info:JSON.stringify(u)});this.push(c)}},{key:"rtcRecvAnswer",value:function(e,t,n,i,o,a,s){var u=arguments.length>7&&void 0!==arguments[7]?arguments[7]:{},c=r(r({event_key:"rtc_recv_answer",report_id:this.report_id++,rtc_timestamp:Date.now(),error_code:e,answer_type:t,sequence_id:n,message:i,direction:o,stream_id:a,stream_user_id:s},this.modify_ids),{},{common_extra_info:JSON.stringify(u)});this.push(c)}},{key:"firstRemoteAudioRender",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=r(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(n)});this.push(i)}},{key:"firstRemoteVideoRender",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=r(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(n)});this.push(i)}},{key:"rtcPublishStat",value:function(e,t,n,i){var o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{},a=r(r({event_key:"rtc_publish_stat",report_id:this.report_id++,rtc_timestamp:Date.now(),result:e,is_screen:t,start:n,message:i},this.modify_ids),{},{common_extra_info:JSON.stringify(o)});this.push(a)}},{key:"rtcSubscribeStat",value:function(e,t,n,i){var o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{},a=r(r({event_key:"rtc_subscribe_stat",report_id:this.report_id++,rtc_timestamp:Date.now(),result:e,start:t,message:n,stream_user_id:i},this.modify_ids),{},{common_extra_info:JSON.stringify(o)});this.push(a)}},{key:"rtcAudioDevice",value:function(e,t,n){var i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},o=r(r({event_key:"rtc_audio_device",report_id:this.report_id++,rtc_timestamp:Date.now(),audio_event:e,message:t,error_code:n},this.modify_ids),{},{common_extra_info:JSON.stringify(i)});this.push(o)}},{key:"rtcMediaStatistics",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=r(r(r(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(n)});this.push(i)}},{key:"rtcMessageStatistics",value:function(e,t,n){var i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},o=r(r({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:n},this.modify_ids),{},{common_extra_info:JSON.stringify(i)});this.push(o)}},{key:"rtcError",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=r(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(n)});this.push(i)}},{key:"rtcInvokeStatus",value:function(e,t,n,i,o){var a=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{},s=r(r({event_key:"rtc_invoke_status",report_id:this.report_id++,rtc_timestamp:Date.now(),message:e,error_code:t,sdk_api_name:n,stream_id:i,elapse:o},this.modify_ids),{},{common_extra_info:JSON.stringify(a)});this.push(s)}},{key:"rtcFirstFrame",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=r(r(r({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(n)}},{key:"rtcMuteRemote",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=r(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(n)});this.push(i)}},{key:"sdkInitEngine",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=r(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(n)});this.push(i)}},{key:"joinRoom",value:function(e,t,n,i){var o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{},a=r(r({event_key:"join_room",report_id:this.report_id++,rtc_timestamp:Date.now(),type:e,start:t,result:n,reason:i},this.modify_ids),{},{common_extra_info:JSON.stringify(o)});this.push(a)}},{key:"p2pConnectionStatus",value:function(e,t,n,i,o){var a=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{},s=r(r({event_key:"p2p_connection_status",report_id:this.report_id++,rtc_timestamp:Date.now(),room_id:e,user_id:t,peer_user_id:n,status:i,elapse:o},this.modify_ids),{},{common_extra_info:JSON.stringify(a)});this.push(s)}},{key:"p2pConnectClosed",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=r(r({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(n)}},{key:"rtcDeviceError",value:function(e,t,n,i,o,a,s,u,c,d,l,h,f,p,_,v){var m=arguments.length>16&&void 0!==arguments[16]?arguments[16]:{},g=r(r({event_key:"rtc_device_error",report_id:this.report_id++,rtc_timestamp:Date.now(),device_type:e,device_stage:t,error_code:n,system_error_code:i,system_api:o,call_parameters:a,location:s,message:u,media_device_id:c,media_device_name:d,elapse:l,scenario:h,event_session_id:f,device_pid:p,device_vid:_,media_mode:v},this.modify_ids),{},{common_extra_info:JSON.stringify(m)});this.push(g)}},{key:"rtcVideoDevice",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=r(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(n)});this.push(i)}},{key:"rtcVideoCaptureEvent",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=r(r(r({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(n)}},{key:"rtcEncodeFirstFrame",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=r(r(r(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(n)});this.push(i)}},{key:"rtcFirstFrameEncoded",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=r(r(r(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(n)});this.push(i)}},{key:"rtcSendFirstPacket",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=r(r(r(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(n)});this.push(i)}},{key:"rtcRecvFirstPacket",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=r(r(r(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(n)});this.push(i)}},{key:"rtcRecvFirstFrame",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=r(r(r(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(n)});this.push(i)}},{key:"rtcDecodeFirstFrame",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=r(r(r(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(n)});this.push(i)}}]),n}(dM),VV=new LV,FV=new LV,BV=new LV,jV=VV.commonStats,GV=FV.commonStats,HV=BV.commonStats,zV={default:VV,rtm:FV,outsideRoom:BV};function KV(){for(var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"default",t=arguments.length,r=new Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];return function(t,n,i){if("function"==typeof i.value){var o=i.value;i.value=function(){for(var t=arguments.length,i=new Array(t),a=0;a<t;a++)i[a]=arguments[a];var s={};r.forEach((function(e,t){s[e]=i[t]})),"joinRoom"===n&&jV.setStats({room_id:i[1]}),zV[e].rtcSdkApiCall(n,0,JSON.stringify(NP(i)),s);var u=o.apply(this,i);return"function"==typeof(null==u?void 0:u.then)?u.then((function(t){return zV[e].rtcSdkCallback(n,0,JSON.stringify(NP([t||{}]))),t})).catch((function(t){throw zV[e].rtcSdkCallback(n,t.code,JSON.stringify(t.message)),t})):(zV[e].rtcSdkCallback(n,0,JSON.stringify(NP([u||{}]))),u)}}}}function WV(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=e===ee.onUserMessageReceivedOutsideRoom||e===ee.onUserBinaryMessageReceivedOutsideRoom;(n?FV:VV).rtcSdkCallback(e,r,JSON.stringify(t))}function XV(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=arguments.length>3&&void 0!==arguments[3]&&arguments[3];(n?FV:VV).rtcInvokeStatus(JSON.stringify(t),r,e,"",0)}var qV="BytePlus",YV="RTC_DEVICE_ID",JV="RTC_ACCESS_NODE",QV="RTC_ACCESS_URLS",ZV="RTC_H264_BLACK_LIST",$V="engine_BAC",eF=function(){function e(){a(this,e)}return u(e,[{key:"get",value: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(n){return null}}},{key:"set",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:-1,n={ttl:r,saveTime:Date.now(),message:t};try{return localStorage.setItem(e,JSON.stringify(n)),!0}catch(i){return!1}}},{key:"delete",value:function(e){try{return localStorage.removeItem(e),!0}catch(t){return!1}}}]),e}(),tF=function(e){d(r,e);var t=v(r);function r(){return a(this,r),t.apply(this,arguments)}return u(r,[{key:"getDeviceId",value:function(){if(RP())return"";var e=this.get(YV);return e||(e=gP()),this.set(YV,e),e}},{key:"setDeviceId",value:function(e){return[jV,GV,HV].forEach((function(t){return t.setStats({device_id:e})})),this.set(YV,e),e}},{key:"getAccessNode",value:function(e){return this.get("".concat(JV,"_").concat(e,"-").concat(qV))}},{key:"setAccessNode",value:function(e,t,r){return this.set("".concat(JV,"_").concat(e,"-").concat(qV),t,1e3*r)}},{key:"clearAccessNode",value:function(e){this.delete("".concat(JV,"_").concat(e,"-").concat(qV))}},{key:"getAccessUrls",value:function(){return this.get("".concat(QV,"-").concat(qV))}},{key:"setAccessUrls",value:function(e){var t=e.map((function(e){var t=e.host,r=e.path;return"https://".concat(t).concat(r)}));return this.set("".concat(QV,"-").concat(qV),t)}},{key:"clearAccessUrls",value:function(){this.delete("".concat(QV,"-").concat(qV))}},{key:"getH264BlackList",value:function(){return this.get(ZV)}},{key:"setH264BlackList",value:function(e){return this.set(ZV,e)}},{key:"getAudioProfile",value:function(){return this.get($V)}},{key:"setAudioProfile",value:function(e){return this.set($V,e)}}]),r}(eF),rF=new tF,nF="rtc-access.rtcplus.com,rtc-access-sg.rtcplus.com,rtc-access-va.rtcplus.com,rtc-access-fr.rtcplus.com".split(",");function iF(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return"https://".concat(e,"/dispatch/v1/AccessInfo?Action=GetAccessInfo")}var oF="https://web-log-report.rtcplus.com/video/v1/webrtc_log/",aF="rtc.rtcplus.com".split(","),sF={VERSION:"4.46.0",ICE_CONFIG_REQUEST_URLS_INTERNAL:nF.map(iF),ICE_CONFIG_REQUEST_URLS:[],EXPECTED_ADDR:"",LOG_SERVER_URL:oF,CONFIG_REQUEST_DOMAINS:aF,DEVICE_ID:"",OVERSEA:!1};function uF(e,t){if("VERSION"!==e)return"ICE_CONFIG_REQUEST_URLS"===e?("string"==typeof t&&(t=[t]),void(sF.ICE_CONFIG_REQUEST_URLS=t.map(iF))):void("LOG_SERVER_URL"!==e||t!==V.overseas?"LOG_SERVER_URL"!==e||t!==V.domestic?"LOG_SERVER_URL"!==e||"string"!=typeof t?"OVERSEA"!==e?("DEVICE_ID"===e&&rF.setDeviceId(t),sF[e]=t):sF.OVERSEA=t:sF.LOG_SERVER_URL=t:sF.LOG_SERVER_URL=oF:sF.LOG_SERVER_URL="https://web-log-report.rtcplus.com/video/v1/webrtc_log/")}function cF(e){return"DEVICE_ID"===e?rF.getDeviceId():sF[e]}function dF(e,t){var r,n,i,o,a,s,u,c,d,l,h,f,p,_,v,m,g;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)||fF.audio.codec,bitRate:1e3*((null===(n=t.audio)||void 0===n?void 0:n.kBitRate)||fF.audio.kBitRate),sampleRate:1e3*((null===(i=t.audio)||void 0===i?void 0:i.sampleRate)||fF.audio.sampleRate),channels:(null===(o=t.audio)||void 0===o?void 0:o.channels)||fF.audio.channels,profile:(null===(a=t.audio)||void 0===a?void 0:a.AACProfile)||fF.audio.AACProfile},video:{codec:(null===(s=t.video)||void 0===s?void 0:s.codec)||fF.video.codec,fps:(null===(u=t.video)||void 0===u?void 0:u.fps)||fF.video.fps,gop:(null===(c=t.video)||void 0===c?void 0:c.gop)||fF.video.gop,lowLatency:null!==(d=null===(l=t.video)||void 0===l?void 0:l.lowLatency)&&void 0!==d?d:fF.video.lowLatency,bitRate:1e3*((null===(h=t.video)||void 0===h?void 0:h.kBitRate)||fF.video.kBitRate),width:(null===(f=t.video)||void 0===f?void 0:f.width)||fF.video.width,height:(null===(p=t.video)||void 0===p?void 0:p.height)||fF.video.height},layout:{canvas:{bgnd:(null===(_=t.layout)||void 0===_?void 0:_.backgroundColor)||fF.layout.backgroundColor},regions:(null===(v=t.layout)||void 0===v||null===(m=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===(g=t.layout)||void 0===g?void 0:g.appData)||fF.layout.appData}}}}function lF(e,t,r){var n,i,o,a,s,u,c,d,l;return{type:"publicstream",action:t,publicStreamID:e,publicStreamMeta:{audio:{},video:{fps:(null===(n=r.video)||void 0===n?void 0:n.fps)||15,bitrate:1e3*((null===(i=r.video)||void 0===i?void 0:i.kBitRate)||40),width:(null===(o=r.video)||void 0===o?void 0:o.width)||640,height:(null===(a=r.video)||void 0===a?void 0:a.height)||360},layout:{layoutMode:2,interpolationMode:(null===(s=r.layout)||void 0===s?void 0:s.interpolationMode)||j.PREV_FRAME,canvas:{bgColor:(null===(u=r.layout)||void 0===u?void 0:u.backgroundColor)||"#000000",bgImage:(null===(c=r.layout)||void 0===c?void 0:c.backgroundImage)||""},regions:(null===(d=r.layout)||void 0===d||null===(l=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 hF,fF={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"}},pF={width:640,height:360,frameRate:30,maxKbps:600},_F={width:1920,height:1080,frameRate:15,maxKbps:3e3},vF=function(e){return e.streamRemovedBySchedule308="stream removed",e.clientRePublish="client republish",e.publishStreamFaied="publish failed",e.clientUnPublish="client unpublished",e.clientDisconnected="client disconnected",e.videoMuted="video muted",e}(vF||{}),mF=function(e){return e.PushLimitWarn="PushLimitWarn",e}(mF||{}),gF=function(e){return 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_UPDATE_USER_ATTRIBUTES="onUpdateUserAttributes",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}(gF||{}),yF=function(e){return e.RSCP="RSCP",e}(yF||{}),SF=function(e){return e.ON_CONNECTION_STATE_CHANGE="onConnectionStateChange",e.ABNORMAL_DISCONNECTION="normalConnection",e}(SF||{}),bF=function(e){return e.userLeave="userLeave",e.connectionLost="connectionLost",e.userDuplicateLogin="userDuplicateLogin",e.kickedByAdmin="kickedByAdmin",e.roleChanged="roleChanged",e.onUserTokenDidExpire="onUserTokenDidExpire",e}(bF||{}),EF=function(e){return e[e.roomDismissByAdmin=2]="roomDismissByAdmin",e}(EF||{}),kF=function(e){return e[e.SEND=0]="SEND",e[e.FEEDBACK=1]="FEEDBACK",e}(kF||{}),RF=function(e){return e[e.P2P=0]="P2P",e[e.SIGNAL=1]="SIGNAL",e[e.BROADCAST=2]="BROADCAST",e[e.BUSINESS_SERVER=3]="BUSINESS_SERVER",e}(RF||{}),TF=function(e){return 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.NOT_LOGIN=105]="NOT_LOGIN",e[e.SERVER_PARAMS_NOTSET=106]="SERVER_PARAMS_NOTSET",e[e.UNKNOWN=1e3]="UNKNOWN",e}(TF||{}),IF=(c(hF={},0,[0,"success"]),c(hF,1,[sD.USER_MESSAGE_TIMEOUT,"timeout, failed to send."]),c(hF,2,[sD.USER_MESSAGE_BROKEN,"dataChannel broken, failed to send."]),c(hF,3,[sD.USER_MESSAGE_NO_RECEIVER,"cannot find the receiver."]),c(hF,4,[sD.USER_MESSAGE_NO_RELAYPATH,"cannot find relay path."]),c(hF,17,[sD.USER_MESSAGE_SEND_TO_SERVER_ERROR,"failed to send to business server."]),c(hF,18,[sD.USER_MESSAGE_SERVER_RESPONSE_ERROR,"business server response error."]),c(hF,100,[sD.USER_MESSAGE_NOT_JOIN,"not join room"]),c(hF,101,[sD.USER_MESSAGE_INIT,"not init."]),c(hF,102,[sD.USER_MESSAGE_NO_CONNECTION,"no connection."]),c(hF,105,[sD.USER_MESSAGE_NOT_LOGIN,"not login."]),c(hF,106,[sD.USER_MESSAGE_SERVER_PARAMS_NOTSET,"server param is not set."]),c(hF,1e3,[sD.USER_MESSAGE_UNKNOWN,"unknown."]),hF),AF=["msg"],wF=new uM("DataChannelSignaling",3),CF=function(e){return 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",e}(CF||{}),OF=6e4,NF=function(e){d(s,e);var t,n,i=v(s);function s(e){var t;return a(this,s),c(p(t=i.call(this)),"_singlingCache",new Map),c(p(t),"_p2pCache",new Map),c(p(t),"_rttIds",{}),c(p(t),"_p2pMessageId",0),c(p(t),"_clearDataChannelListener",void 0),t._dataChannel=e,t._clearDataChannelListener=t._handleHandler(),window.__rtc_mock_signaling__=t.emit.bind(p(t)),t}return u(s,[{key:"destroy",value:function(){this._dataChannel&&(this._clearDataChannelListener(),this._dataChannel.close()),this._singlingCache.clear(),this._p2pCache.clear(),this._p2pMessageId=0,this._rttIds={}}},{key:"sendSignaling",value:function(e,t,r){var n=this;return VV.rtcSignaling(0,JSON.stringify(t),"call-".concat(e),"Send",pV.UP),new Promise((function(i,o){var a=n._genHeader(r);a.id=wP();var s=a.id.join("-"),u=setTimeout((function(){n._singlingCache.delete(s),o(new cD(sD.TIME_OUT,"".concat(e," message time out")))}),OF);n._singlingCache.set(s,{signalingType:e,success:function(e){clearTimeout(u),i(e)},error:function(e){clearTimeout(u),o(e)}}),wF.print("Signal",">>>>>> [".concat(e,"][").concat(s,"]"),t),n._sendMessage(e,a,t)}))}},{key:"sendPingSignaling",value:function(){return this.sendSignaling("CheckConnectivity",{ts:Date.now()},{functionType:2})}},{key:"sendP2PMessage",value:(n=o(regeneratorRuntime.mark((function e(t,n){var i,o,a;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(i=t.msg,o=f(t,AF),a=i instanceof ArrayBuffer,e.t0=this,e.t1=r,e.t2=r({ver:1,id:this._p2pMessageId++,time:Date.now(),dir:kF.SEND,type:RF.P2P,err:TF.SUCCESS},o),e.t3={},e.t4=a,!a){e.next=13;break}return e.next=10,TP.ab2b64str(i);case 10:e.t5=e.sent,e.next=14;break;case 13:e.t5=i;case 14:return e.t6=e.t5,e.t7={binary:e.t4,msg:e.t6},e.t8=(0,e.t1)(e.t2,e.t3,e.t7),e.t9=n,e.abrupt("return",e.t0._sendP2PMessage.call(e.t0,e.t8,e.t9));case 19:case"end":return e.stop()}}),e,this)}))),function(e,t){return n.apply(this,arguments)})},{key:"_sendP2PMessage",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return OP(e.msg)?this._rttIds[e.id]=e.id:e.dir===kF.SEND&&wF.print("_sendP2PMessage [DC Signaling p2p >>]",JSON.stringify(e)),new Promise((function(i,o){var a=t._genHeader(r(r({needAck:!0,functionType:1},n),{},{id:wP()}));if(e.dir===kF.SEND){var s=setTimeout((function(){t._p2pCache.delete(e.id),o(new cD(sD.TIME_OUT,"P2P message timeout"))}),OF);t._p2pCache.set(e.id,{success:function(e,t){clearTimeout(s),i(t)},error:function(e){clearTimeout(s);var t=y(IF[e.err]||[sD.USER_MESSAGE_UNKNOWN,"err: ".concat(e.err,", msg: ").concat(e.msg)],2),r=t[0],n=t[1];o({code:r,message:e.msg||n})}})}t._sendMessage("p2p",a,e)}))}},{key:"_sendMessage",value:function(e,t,r){if(!this._dataChannel||"open"!==this._dataChannel.readyState)throw new cD(sD.SIGNALING_CHANNEL_NOT_OPEN,"DataChannel not open");var n=t.version+(+t.zip<<5)+(+t.encrypt<<6),i=+t.needAck+(+t.direction<<1)+(+t.functionType<<2)+(+t.binary<<6),o=TP.str2ab(JSON.stringify([e,r])),a=kP(Uint8Array,[n,i].concat(S(t.id||[])),new Uint8Array(o));this._dataChannel.send(a.buffer)}},{key:"_dispartData",value:function(e){var t=new Uint8Array(e),r=0,n=t[r++],i=t[r++],o={version:15&n,zip:16==(16&n),encrypt:32==(32&n),needAck:1==(1&i),direction:(2&i)>>1,functionType:(60&i)>>2,binary:64==(64&i)};if(o.needAck||1===o.direction){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)}}},{key:"_feedbackSignaling",value:function(e,t){var r=this._genHeader({needAck:!0,direction:1,id:e.split("-").map((function(e){return+e}))});wF.print("Signal",">>>>>> [".concat(t,"-res][").concat(e,"]")),this._sendMessage("".concat(t,"-res"),r,"")}},{key:"_handleMessage",value:(t=o(regeneratorRuntime.mark((function e(t){var n,i,o,a,s,u,c,d,l,h,f,p,_,v,m,g,S,b,E,k,R,T,I,A,w,C,O,N,x,D,P;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:u=this._dispartData(t),c=u.data,(d=u.header).zip&&((l=new rV.Inflate).push(c,!0),c=l.result),h=TP.ab2str(c),f=[],e.prev=6,f=JSON.parse(h),e.next=14;break;case 10:return e.prev=10,e.t0=e.catch(6),e.t0 instanceof Error&&VV.rtcSignalingMsgError(-1,e.t0.message,fV.MESSAGE_PARSE_FAILED),e.abrupt("return");case 14:e.t1=d.functionType,e.next=0===e.t1?17:1===e.t1?34:2===e.t1?83:99;break;case 17:if(p=(null===(n=d.id)||void 0===n?void 0:n.join("-"))||"",1!==d.direction){e.next=22;break}this._handleAckMessage(p,f[0]||{},h),e.next=33;break;case 22:if(!Array.isArray(f)){e.next=33;break}if(_=f[0],f=f[1],wF.print("Signal","<<<<<< ".concat(_),f,p),this._feedbackSignaling(p,_),!f.binary||"string"!=typeof f.message){e.next=31;break}return e.next=30,TP.b64str2ab(f.message);case 30:f.message=e.sent;case 31:this.emit(_,r({},f)),VV.rtcSignaling(0,h,"on-".concat(_),"Recv",pV.DOWN);case 33:return e.abrupt("break",100);case 34:Array.isArray(f)&&(f=f[1]),v=null===(i=f)||void 0===i?void 0:i.id,this._rttIds[v]||(null===(o=f)||void 0===o?void 0:o.dir)===kF.FEEDBACK||OP(null===(a=f)||void 0===a?void 0:a.msg)?delete this._rttIds[v]:wF.print("Signal","<<<<<< p2p response",f),e.t2=f.dir,e.next=e.t2===kF.SEND?40:e.t2===kF.FEEDBACK?78:81;break;case 40:if(OP(null===(s=f)||void 0===s?void 0:s.msg)){e.next=76;break}if(g=(m=f).binary,S=m.msg,b=m.room,E=m.to,k=m.from,R=""===b?g?gF.USER_BINARY_MESSAGE_RECEIVED_OUTSIDE_ROOM:gF.USER_MESSAGE_RECEIVED_OUTSIDE_ROOM:g?gF.USER_BINARY_MESSAGE_RECEIVED:gF.USER_MESSAGE_RECEIVED,E){e.next=60;break}if(e.t3=this,e.t4=gF.ON_CUSTOM_MESSAGE,e.t5=k,e.t6=g,!g){e.next=54;break}return e.next=51,TP.b64str2ab(S);case 51:e.t7=e.sent,e.next=55;break;case 54:e.t7=S;case 55:e.t8=e.t7,e.t9={clientId:e.t5,binary:e.t6,message:e.t8},e.t3.emit.call(e.t3,e.t4,e.t9),e.next=76;break;case 60:if(e.t10=this,e.t11=R,e.t12=r,e.t13=r({},f),e.t14={},!g){e.next=71;break}return e.next=68,TP.b64str2ab(S);case 68:e.t15=e.sent,e.next=72;break;case 71:e.t15=S;case 72:e.t16=e.t15,e.t17={msg:e.t16},e.t18=(0,e.t12)(e.t13,e.t14,e.t17),e.t10.emit.call(e.t10,e.t11,e.t18);case 76:return this._sendP2PMessage(r(r({},f),{},{dir:kF.FEEDBACK,msg:""})),e.abrupt("break",82);case 78:return(T=this._p2pCache.get(f.id))&&(this._p2pCache.delete(f.id),f.err===TF.SUCCESS?T.success(f.id,f):T.error(f)),e.abrupt("break",82);case 81:return e.abrupt("break",82);case 82:return e.abrupt("break",100);case 83:if(1!==d.direction){e.next=88;break}A=(null===(I=d.id)||void 0===I?void 0:I.join("-"))||"",this._handleAckMessage(A,f[0]||{},h),e.next=98;break;case 88:if(w=y(f,2),C=w[0],O=w[1],N=void 0===O?{}:O,"RXMediaMsg"!==C){e.next=98;break}x=N.type,D=N.data,VV.rtcSignaling(0,h,"on-".concat(x),"Recv",pV.DOWN),e.t19=x,e.next="RSCP"===e.t19?95:97;break;case 95:try{P=JSON.parse(D),Array.isArray(P)&&this.emit(x,P)}catch(M){}return e.abrupt("break",98);case 97:return e.abrupt("break",98);case 98:case 99:return e.abrupt("break",100);case 100:case"end":return e.stop()}}),e,this,[[6,10]])}))),function(e){return t.apply(this,arguments)})},{key:"_handleHandler",value:function(){var e=this,t=function(t){wF.print("_handleHandler","dataChannel close",t),e.emit("close",t)},r=function(t){wF.print("_handleHandler","dataChannel error",t),e.emit("close",t)},n=function(t){e._handleMessage(t.data)};return this._dataChannel.addEventListener("close",t),this._dataChannel.addEventListener("error",r),this._dataChannel.addEventListener("message",n),function(){e._dataChannel.removeEventListener("close",t),e._dataChannel.removeEventListener("error",r),e._dataChannel.removeEventListener("message",n)}}},{key:"_genHeader",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return r({version:2,zip:!1,encrypt:!1,needAck:!0,direction:0,functionType:0,binary:!1},e)}},{key:"_handleAckMessage",value:function(e,t,r){var n=this._singlingCache.get(e);n&&(this._singlingCache.delete(e),200===t.code?n.success(t):n.error(t),wF.print("Signal","<<<<<< [".concat(n.signalingType,"-ack]"),t)),VV.rtcSignaling(0,r,null==n?void 0:n.signalingType,"Ack",pV.DOWN)}}]),s}(nM.exports.EventEmitter),xF=function(){function e(){a(this,e),c(this,"xhr",void 0),c(this,"isSending",void 0),c(this,"timeout",void 0),this.isSending=!1}return u(e,[{key:"ajax",value:function(e){var t=this,r=e.method,n=e.url,i=e.body,o=void 0===i?{}:i,a=e.headers,s=void 0===a?{}:a,u=e.stringify,c=void 0===u||u;return new Promise((function(e,i){t.isSending=!0;var a=new XMLHttpRequest;a.open(r,n,!0);for(var u=0,d=Object.entries(s);u<d.length;u++){var l=y(d[u],2),h=l[0],f=l[1];a.setRequestHeader(h,f)}a.onreadystatechange=function(){4===a.readyState&&(t.isSending=!1,200===a.status?e(JSON.parse(a.responseText)):i({message:a.statusText,code:a.status})),0===a.status&&i({code:0,message:"Request abort"})},a.onerror=function(e){t.isSending=!1,i({code:-1,message:a.responseText||"unknown"})},t.timeout&&(a.timeout=t.timeout),c&&(o=JSON.stringify(o)),a.send(o),t.xhr=a}))}},{key:"get",value:function(e,t){return this.ajax({method:"GET",url:e,headers:t})}},{key:"post",value:function(e,t,r,n){return this.ajax({method:"POST",url:e,body:t,headers:r,stringify:n})}},{key:"abort",value:function(){var e;null===(e=this.xhr)||void 0===e||e.abort()}}]),e}(),DF=new uM("ICE Request",3),PF=function(){function e(){a(this,e),c(this,"_request",void 0),this._request=new xF}var t,r,n;return u(e,[{key:"getAccessNode",value:(n=o(regeneratorRuntime.mark((function e(t,r,n,i,o,a,s){var u;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!(u=rF.getAccessNode(t))){e.next=9;break}if(this.getAccessNodeFromServer(t,r,n,i,o,a,s),XV("es.R.node.cache",u),!Array.isArray(u)){e.next=8;break}return e.abrupt("return",Promise.resolve(u));case 8:return e.abrupt("return",Promise.resolve([u]));case 9:return e.abrupt("return",this.getAccessNodeFromServer(t,r,n,i,o,a,s));case 10:case"end":return e.stop()}}),e,this)}))),function(e,t,r,i,o,a,s){return n.apply(this,arguments)})},{key:"getAccessNodeFromServer",value:(r=o(regeneratorRuntime.mark((function e(t,r,n,i,o,a,s){var u,c,d,l,h=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return d=rF.getAccessUrls(),l=!0,XV("es.R.req.cache.urls",d),(null===(u=d)||void 0===u?void 0:u.length)>0||(d=sF.ICE_CONFIG_REQUEST_URLS,l=!1,XV("es.R.req.external.urls",d)),(null===(c=d)||void 0===c?void 0:c.length)>0||(d=sF.ICE_CONFIG_REQUEST_URLS_INTERNAL,l=!1,XV("es.R.req.internal.urls",d)),e.abrupt("return",this.getICEConfigFromServer(d,t,r,n,i,o,a,s).then((function(e){var r=e.nodes;return rF.setAccessNode(t,r,e.ttl||11200),e.dispatchDomains&&rF.setAccessUrls(e.dispatchDomains),r})).catch((function(e){if(l)return XV("es.R.req.fallback",""),rF.clearAccessUrls(),h.getAccessNodeFromServer(t,r,n,i,o,a,s);throw e})));case 6:case"end":return e.stop()}}),e,this)}))),function(e,t,n,i,o,a,s){return r.apply(this,arguments)})},{key:"getICEConfigFromServer",value:(t=o(regeneratorRuntime.mark((function e(t,r,n,i,a,s,u,c){var d,l,h,f,p=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return d={appID:r,userID:i,deviceID:a,connectSessionID:bP(),os:"web",sdkVersion:sF.VERSION,isOversea:sF.OVERSEA,expectedAddr:cF("EXPECTED_ADDR"),productPlatform:"BytePlus",enableCloudProxy:c},s&&u&&(d.feedbackInfo=[{feedbackIP:null===(l=u.publicIPs[0])||void 0===l?void 0:l.ip,feedbackReason:{type:"NODE_CHANGED",reason:s}}],delete d.expectedAddr),h=Date.now(),VV.rtcGetAccess(0,JSON.stringify(d),0,lV.REQUEST,t.join(","),d.connectSessionID),f=t.map(function(){var e=o(regeneratorRuntime.mark((function e(t,r){var n,i;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,p._request.post(t,d);case 3:n=e.sent,e.next=9;break;case 6:throw e.prev=6,e.t0=e.catch(0),new cD(sD.ICE_SERVER_WRONG,"get ICE config failed",e.t0);case 9:if(200===n.code){e.next=11;break}throw new cD(sD.ICE_SERVER_WRONG,"get ICE config failed",{server_code:n.code,message:JSON.stringify(n)});case 11:if(i=n.nodes[0]){e.next=14;break}throw new cD(sD.ICE_SERVER_WRONG,"ICE config server return empty nodes",{code:n.code,message:JSON.stringify(n)});case 14:return e.abrupt("return",{result:n,firstNode:i,index:r});case 15:case"end":return e.stop()}}),e,null,[[0,6]])})));return function(t,r){return e.apply(this,arguments)}}()),e.abrupt("return",DP(f).then((function(e){var r=e.result;e.firstNode;var n=e.index;return VV.rtcGetAccess(200,JSON.stringify(r),Date.now()-h,lV.RESPONSE,t[n],d.connectSessionID),r})).catch((function(e){var r,n,i=null===(r=e[0])||void 0===r?void 0:r.error;throw VV.rtcGetAccess(+((null==i?void 0:i.code)||(null==i?void 0:i.server_code)),null===(n=e[0])||void 0===n?void 0:n.message,Date.now()-h,lV.RESPONSE,t.join(","),d.connectSessionID,{error:JSON.stringify(i)}),e})));case 6:case"end":return e.stop()}}),e)}))),function(e,r,n,i,o,a,s,u){return t.apply(this,arguments)})},{key:"abort",value:function(){this._request.isSending&&(DF.print("abort","HTTP Request of [getICEConfigFromServer] abort"),this._request.abort())}}]),e}(),MF=function(){function e(){a(this,e),c(this,"_request",void 0),this._request=new xF}return u(e,[{key:"getH264BlackList",value:function(){var e=this,t={keys:["web_h264_black_list"],labelSelector:"",sdkVersion:"4.46.0",deviceType:"web"};this._request.timeout=800;var r=sF.CONFIG_REQUEST_DOMAINS.map((function(e){return"https://".concat(e,"/decision/v1/multi")}));VV.rtcGetConfig(0,JSON.stringify(t),0,r.join(","),aV.REQUEST,"",!1);var n=r.map(function(){var r=o(regeneratorRuntime.mark((function r(n,i){var o,a;return regeneratorRuntime.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return r.prev=0,r.next=3,e._request.post(n,t);case 3:a=r.sent,r.next=9;break;case 6:throw r.prev=6,r.t0=r.catch(0),new cD(sD.ICE_SERVER_WRONG,"get config failed");case 9:if(Array.isArray(null===(o=a)||void 0===o?void 0:o.web_h264_black_list)){r.next=11;break}throw new cD(sD.ICE_SERVER_WRONG,"get config failed");case 11:return r.abrupt("return",{result:a,index:i});case 12:case"end":return r.stop()}}),r,null,[[0,6]])})));return function(e,t){return r.apply(this,arguments)}}());return new Promise((function(e){DP(n).then((function(t){var n=t.result,i=t.index;rF.setH264BlackList(n.web_h264_black_list),VV.rtcGetConfig(200,JSON.stringify(n),0,r[i],aV.RESPONSE,"",!1),e(n.web_h264_black_list)})).catch((function(t){VV.rtcGetConfig(500,t.message,0,"",aV.RESPONSE,"",!1),e(rF.getH264BlackList()||[])}))}))}},{key:"getAudioProfile",value:function(){var e=this,t={keys:["engine_BAC"],labelSelector:"",sdkVersion:"4.46.0",deviceType:"web"},r=sF.CONFIG_REQUEST_DOMAINS.map((function(e){return"https://".concat(e,"/decision/v1/multi")}));VV.rtcGetConfig(0,JSON.stringify(t),0,r.join(","),aV.REQUEST,"",!1);var n=r.map(function(){var r=o(regeneratorRuntime.mark((function r(n,i){var o,a;return regeneratorRuntime.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return r.prev=0,r.next=3,e._request.post(n,t);case 3:a=r.sent,r.next=9;break;case 6:throw r.prev=6,r.t0=r.catch(0),new cD(sD.ICE_SERVER_WRONG,"get config failed");case 9:if(Array.isArray(null===(o=a)||void 0===o?void 0:o.engine_BAC)){r.next=11;break}throw new cD(sD.ICE_SERVER_WRONG,"get config failed");case 11:return r.abrupt("return",{result:a,index:i});case 12:case"end":return r.stop()}}),r,null,[[0,6]])})));return function(e,t){return r.apply(this,arguments)}}());return new Promise((function(e){DP(n).then((function(t){var n=t.result,i=t.index;rF.setAudioProfile(n.engine_BAC),VV.rtcGetConfig(200,JSON.stringify(n),0,r[i],aV.RESPONSE,"",!1),e(n.engine_BAC)})).catch((function(t){VV.rtcGetConfig(500,t.message,0,"",aV.RESPONSE,"",!1),e(rF.getAudioProfile()||[])}))}))}}]),e}();function UF(e,t){var n=1,i=e;(e.width>t.width||e.height>t.height)&&(n=e.width/e.height>t.width/t.height?e.width/t.width:e.height/t.height,i={width:Math.floor(e.width/n),height:Math.floor(e.height/n)});return r(r({},i),{},{scaleResolutionDownBy:n})}var LF=[{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}],VF=[{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 FF={width:160,height:90,frameRate:15,maxkbps:100},BF={width:480,height:270,frameRate:15,maxkbps:400};function jF(e){if(!e.length)return[];var t=e.shift(),n=t.width/t.height,i=0,o=0,a=r(r({},t),{},{video_index:o,sub_index:i++});delete a.rid;for(var s=[a],u=0,c=0;c<LF.length;c++)if(LF[c].height<t.height){u=c;break}for(var d=e.shift(),l=u;l<LF.length;l++){var h,f=LF[l];if(d&&f.height<=(null===(h=d)||void 0===h?void 0:h.height)){var p,_=f.height===(null===(p=d)||void 0===p?void 0:p.height),v=r(r({},d),{},{video_index:++o,sub_index:i++});if(delete v.rid,s.push(v),d=e.shift(),_)continue}s.push(r(r({},f),{},{width:Math.floor(f.height*n),video_index:o,sub_index:i++}))}return s}var GF,HF,zF="chrome-stable"===AP(),KF=function(){function e(t){a(this,e),c(this,"peer",void 0),c(this,"stats",void 0),this.peer=t,this.stats=[]}var t,r;return u(e,[{key:"handleCodec",value:function(e){return e}},{key:"handleInboundRtp",value:function(e){return e}},{key:"handleOutboundRtp",value:function(e){var t=e.ssrc;return t&&(e.rtxSsrc=t),e}},{key:"handleRemoteInboundRtp",value:function(e){return e}},{key:"handleRemoteOutboundRtp",value:function(e){return e}},{key:"handleMediaSource",value:function(e){return e}},{key:"handleCsrc",value:function(e){return e}},{key:"handlePeerConnection",value:function(e){return e}},{key:"handleDataChannel",value:function(e){return e}},{key:"handleStream",value:function(e){return e}},{key:"handleTrack",value:function(e){return e}},{key:"handleTransceiver",value:function(e){return e}},{key:"handleSender",value:function(e){return e}},{key:"handleReceiver",value:function(e){return e}},{key:"handleTransport",value:function(e){return e}},{key:"handleSctpTransport",value:function(e){return e}},{key:"handleCandidatePair",value:function(e){return e}},{key:"handleLocalCandidate",value:function(e){return e}},{key:"handleRemoteCandidate",value:function(e){return e}},{key:"handleCertificate",value:function(e){return e}},{key:"handleIceServer",value:function(e){return e}},{key:"processStats",value:function(e){var t=this;e.forEach((function(e){var r;switch(e.type){case"candidate-pair":r=t.handleCandidatePair;break;case"certificate":r=t.handleCertificate;break;case"remote-candidate":r=t.handleRemoteCandidate;break;case"remote-inbound-rtp":case"inbound-rtp":r=t.handleInboundRtp;break;case"remote-outbound-rtp":case"outbound-rtp":r=t.handleOutboundRtp;break;case"sctp-transport":r=t.handleSctpTransport;break;case"sender":r=t.handleSender;break;case"stream":r=t.handleStream;break;case"track":r=t.handleTrack;break;case"transceiver":r=t.handleTransceiver;break;case"transport":r=t.handleTransport;break;case"codec":r=t.handleCodec;break;case"csrc":r=t.handleCsrc;break;case"data-channel":r=t.handleDataChannel;break;case"ice-server":r=t.handleIceServer;break;case"media-source":r=t.handleMediaSource;break;case"peer-connection":r=t.handlePeerConnection;break;case"receiver":r=t.handleReceiver;break;case"local-candidate":r=t.handleLocalCandidate;break;default:r=function(e){return e}}r=r.bind(t),t.stats.push(r(e))}))}},{key:"getExtraStats",value:(r=o(regeneratorRuntime.mark((function e(t){var r=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",new Promise((function(e,n){if(!zF||void 0!==window.InstallTrigger)return e(r.stats);try{r.peer.getStats((function(n){n.result().forEach((function(e){if(!WF.includes(e.type)){var n={};e.names().forEach((function(t){n[t]=e.stat(t)})),n.id=e.id,n.type=e.type,n.timestamp=e.timestamp,"ssrc"===n.type&&t&&t.id?t.id===n.googTrackId&&r.stats.push(n):r.stats.push(n)}})),e(r.stats)}))}catch(Sq){n(Sq)}})));case 1:case"end":return e.stop()}}),e)}))),function(e){return r.apply(this,arguments)})},{key:"getStats",value:(t=o(regeneratorRuntime.mark((function e(t,r){var n;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,this.peer.getStats(t);case 3:if(n=e.sent,this.processStats(n),e.prev=5,r){e.next=9;break}return e.next=9,this.getExtraStats(t);case 9:e.next=13;break;case 11:e.prev=11,e.t0=e.catch(5);case 13:e.next=17;break;case 15:e.prev=15,e.t1=e.catch(0);case 17:return e.abrupt("return",this.stats);case 18:case"end":return e.stop()}}),e,this,[[0,15],[5,11]])}))),function(e,r){return t.apply(this,arguments)})}]),e}(),WF=["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"],XF=function(){var e=o(regeneratorRuntime.mark((function e(t,r,n){var i,o;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(i=[],t instanceof RTCPeerConnection){e.next=3;break}return e.abrupt("return",i);case 3:return o=new KF(t),e.next=6,o.getStats(r,n);case 6:return i=e.sent,e.abrupt("return",i);case 8:case"end":return e.stop()}}),e)})));return function(t,r,n){return e.apply(this,arguments)}}(),qF=function(){var e=o(regeneratorRuntime.mark((function e(){var t;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(e.prev=0,!RP()&&window.RTCPeerConnection&&window.RTCPeerConnection.prototype.addTransceiver&&window.RTCPeerConnection.prototype.createDataChannel){e.next=3;break}return e.abrupt("return",!1);case 3:return e.next=5,YF();case 5:return t=e.sent,e.abrupt("return",null==t?void 0:t.includes("H264"));case 9:return e.prev=9,e.t0=e.catch(0),e.abrupt("return",!1);case 12:case"end":return e.stop()}}),e,null,[[0,9]])})));return function(){return e.apply(this,arguments)}}(),YF=function(){var e=o(regeneratorRuntime.mark((function e(){var t,r,n,i,o,a,s,u;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!GF){e.next=2;break}return e.abrupt("return",GF);case 2:return t=[],e.prev=3,e.next=6,xP();case 6:if(r=e.sent){e.next=9;break}return e.abrupt("return",t);case 9:if(!(null!=r&&r.includes("level-asymmetry-allowed=1;packetization-mode=1;profile-level-id=42e01f")||null!=r&&r.includes("profile-level-id=42e01f;level-asymmetry-allowed=1;packetization-mode=1")||null!=r&&r.includes("packetization-mode=1;profile-level-id=42e01f;level-asymmetry-allowed=1"))){e.next=20;break}return n=navigator.userAgent.toLowerCase(),i=!1,o=["heytapbrowser","mqqbrowser","miuibrowser"],a=new MF,e.next=16,a.getH264BlackList();case 16:for(s=e.sent,o.push.apply(o,S(s)),u=0;u<o.length;u++)n.includes(o[u])&&(i=!0);!i&&t.push("H264");case 20:return null!=r&&r.includes("VP8")&&t.push("vp8"),GF=t,e.abrupt("return",t);case 25:return e.prev=25,e.t0=e.catch(3),e.abrupt("return",t);case 28:case"end":return e.stop()}}),e,null,[[3,25]])})));return function(){return e.apply(this,arguments)}}(),JF=function(){var e=o(regeneratorRuntime.mark((function e(){var t;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,YF();case 2:return t=e.sent,e.abrupt("return",t.map((function(e){return e.toUpperCase()})));case 4:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),QF=function(){return"undefined"!=typeof TransformStream&&"undefined"!=typeof RTCRtpSender&&"undefined"!=typeof RTCRtpReceiver&&void 0!==RTCRtpSender.prototype.createEncodedStreams&&void 0!==RTCRtpReceiver.prototype.createEncodedStreams},ZF=new uM("BasicHandler",3),$F={iceServers:[],iceTransportPolicy:"all",bundlePolicy:"max-bundle",rtcpMuxPolicy:"require",sdpSemantics:"unified-plan",encodedInsertableStreams:!!QF()||void 0};function eB(e){if(void 0===HF){var t=navigator.userAgent.toLowerCase();HF=t.includes("chrome")&&t.includes("mobile")}return HF?Math.ceil(e):e}var tB=function(e){d(h,e);var t,n,i,s,l=v(h);function h(e,t){var r;return a(this,h),c(p(r=l.call(this)),"_peerConnection",void 0),c(p(r),"_dataChannel",void 0),c(p(r),"_context",void 0),c(p(r),"monitor",void 0),c(p(r),"_offerIce",{}),c(p(r),"_answerIce",{}),c(p(r),"_initSctpEvents",!1),r.monitor=e,r._peerConnection=new RTCPeerConnection($F),r._dataChannel=r._peerConnection.createDataChannel("signaling",{negotiated:!0,id:100}),r._context=t,r._dataChannel.binaryType="arraybuffer",r._peerConnection.ontrack=function(e){var t,n;ZF.print("constructor","pc.ontrack ".concat(e.track.kind," ").concat(e.track.id," ").concat(null===(t=e.streams)||void 0===t||null===(n=t[0])||void 0===n?void 0:n.id)),r.emit("ontrack",e)},r._peerConnection.onconnectionstatechange=function(e){ZF.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 t=r._peerConnection.iceConnectionState;e.rtcPreIceState(t,hV["".concat(t.toUpperCase())])},r}return u(h,[{key:"disconnect",value:function(){this._peerConnection.close(),this._dataChannel.close(),this._peerConnection.ontrack=null}},{key:"destroy",value:function(){ZF.print("destroy"),this.disconnect(),this._context=void 0}},{key:"_simulcast",value:function(e,t,n,i,o){var a=[],s=function(e){for(var t=0,r=e.width*e.height,n=0;n<VF.length;n++)if(r>=VF[n].totalPixels){t=n;break}if(0===t)return VF[t].maxLayers;var i=VF[t-1].totalPixels;return(i-r)/(i-VF[t].totalPixels)<.1?VF[t-1].maxLayers:VF[t].maxLayers}(t);ZF.print("simulcast() ","maxLayers: %o",s),1===e.videoEncodeConfig.length?(a=function(e,t){var r=[];if(t<=1)return r;var n=1,i=1;return e.width/e.height>16/9?(n=e.width/FF.width,i=e.width/BF.width):(n=e.height/FF.height,i=e.height/BF.height),r.push({maxkbps:FF.maxkbps,scaleResolutionDownBy:n,frameRate:FF.frameRate,width:Math.floor(e.width/n),height:Math.floor(e.height/n)}),t<=2||n>2&&r.unshift({maxkbps:BF.maxkbps,scaleResolutionDownBy:i,frameRate:BF.frameRate,width:Math.floor(e.width/i),height:Math.floor(e.height/i)}),r}(n,s),ZF.print("simulcast() ","simulcastLayers: %o",a)):(a=e.videoEncodeConfig.slice(1).slice(1-s).map((function(e){return r({frameRate:e.frameRate||15,maxkbps:e.maxKbps||600},UF(n,e))})),ZF.print("simulcast() ","simulcastLayers2: %o",a)),a.forEach((function(e,t){var r={maxBitrate:1e3*e.maxkbps,scaleResolutionDownBy:eB(e.scaleResolutionDownBy),rid:"".concat(t+1),maxFramerate:e.frameRate};i.sendEncodings&&i.sendEncodings.unshift(r),o.push({width:e.width,height:e.height,framerate:e.frameRate,maxkbps:e.maxkbps,rid:"".concat(t+1)})}))}},{key:"internalPublish",value:function(e,t){var r=e.stream,n=e.videoTrack,i=e.audioTrack,o=e.enableSimulcast,a=e.pubAudio,s=e.pubVideo,u={direction:"sendonly",streams:[r]},c={direction:"sendonly",streams:[r]},d=[],l=[];if(Array.isArray(null==e?void 0:e.videoEncodeConfig)&&e.videoEncodeConfig.length){var h=null==n?void 0:n.getTrack(),f={width:640,height:360,frameRate:30};if(h){var p=null==h?void 0:h.getSettings();f={width:Math.floor(p.width),height:Math.floor(p.height),frameRate:Math.floor(p.frameRate)}}var _=null==e?void 0:e.videoEncodeConfig[0],v=UF(f,_);e.prevScaleResolutionDownBy=v.scaleResolutionDownBy,e.videoInputConfig=f;var m={maxBitrate:1e3*_.maxKbps,scaleResolutionDownBy:eB(v.scaleResolutionDownBy),rid:"0",maxFramerate:_.frameRate||15};c.sendEncodings=[m],d.push({width:v.width,height:v.height,framerate:_.frameRate,maxkbps:_.maxKbps,rid:"0"}),o&&(this._simulcast(e,v,f,c,d),null!=t&&t.simulcastOnDemand&&(l=jF([].concat(d))),ZF.print("subVideoDesc","desc: %o ",l))}ZF.print("publish videoTransceiverInit videoDescriptions","",c,d);var g=null==i?void 0:i.getTrack();(null==i?void 0:i.mixType)!==Q.PLAYOUT&&null!=i&&i.mixedAudioTrack&&(g=null==i?void 0:i.mixedAudioTrack),g=a&&g?g:"audio";var y=null==n?void 0:n.getTrack();return{semantics:"unified-plan",videoDescriptions:d,subVideoDescriptions:l,transceiverInit:{aTrack:g,vTrack:y=s&&y?y:"video",audioTransceiverInit:u,videoTransceiverInit:c}}}},{key:"updateScaleResolutionDownBy",value:(s=o(regeneratorRuntime.mark((function e(t){var r,n,i,o,a,s,u,c,d,l;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(ZF.print("updateScaleResolutionDownBy()"),i=null===(r=t.videoTrack)||void 0===r?void 0:r.getTrack(),o=t.videoTransceiver,i&&t.pubVideo&&o){e.next=6;break}return ZF.print("updateScaleResolutionDownBy()","no pub"),e.abrupt("return");case 6:a=null==i?void 0:i.getSettings(),s={width:Math.floor(a.width),height:Math.floor(a.height),frameRate:Math.floor(a.frameRate)},(u=UF(s,t.videoEncodeConfig[0])).scaleResolutionDownBy===t.prevScaleResolutionDownBy&&ZF.print("updateScaleResolutionDownBy()","no change %o",t.prevScaleResolutionDownBy),(c=null===(n=o.sender)||void 0===n?void 0:n.getParameters())&&(l=u.scaleResolutionDownBy/t.prevScaleResolutionDownBy,c.encodings=null==c||null===(d=c.encodings)||void 0===d?void 0:d.map((function(e){var r;Math.max(e.scaleResolutionDownBy=(e.scaleResolutionDownBy||1)*l,1);var n=+e.rid||0;return e.maxFramerate=(null===(r=t.videoEncodeConfig[n])||void 0===r?void 0:r.frameRate)||e.maxFramerate,e})),t.prevScaleResolutionDownBy=u.scaleResolutionDownBy,t.videoInputConfig=s,null==o||o.sender.setParameters(c));case 12:case"end":return e.stop()}}),e)}))),function(e){return s.apply(this,arguments)})},{key:"getStats",value:function(e,t){return XF(this._peerConnection,e,t)}},{key:"setLocalDescription",value:(i=o(regeneratorRuntime.mark((function e(t,r){var n,i,o,a=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=EP(),e.prev=1,e.next=4,this._peerConnection.setLocalDescription(new RTCSessionDescription({type:"offer",sdp:t}));case 4:this.monitor.rtcSetDescription(0,t,mV.W_1,"local"===(null==r?void 0:r.streamUserId)?gV.UP:gV.DOWN,(null==r?void 0:r.streamId)||"",(null==r?void 0:r.streamUserId)||"",EP()-n,{type:"offer"}),this._initSctpEvents||(this._initSctpEvents=!0,(o=null===(i=this._peerConnection)||void 0===i?void 0:i.sctp)&&(o.onstatechange=function(){a.monitor.rtcInvokeStatus("sctp state change TO: ".concat(o.state),0,"sctp","",0)},o.transport&&(o.transport.onstatechange=function(){var e;a.monitor.rtcInvokeStatus("dtls state change TO: ".concat(null==o||null===(e=o.transport)||void 0===e?void 0:e.state),0,"dtls","",0)}))),e.next=11;break;case 8:e.prev=8,e.t0=e.catch(1),this.monitor.rtcSetDescription(-1,e.t0.message,mV.W_1,"local"===(null==r?void 0:r.streamUserId)?gV.UP:gV.DOWN,"","",EP()-n,{type:"offer"});case 11:case"end":return e.stop()}}),e,this,[[1,8]])}))),function(e,t){return i.apply(this,arguments)})},{key:"setRemoteDescription",value:(n=o(regeneratorRuntime.mark((function e(t,r){var n;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=EP(),e.prev=1,e.next=4,this._peerConnection.setRemoteDescription(new RTCSessionDescription({type:"answer",sdp:t}));case 4:this.monitor.rtcSetDescription(0,t,mV.W_0,"local"===(null==r?void 0:r.streamUserId)?gV.UP:gV.DOWN,(null==r?void 0:r.streamId)||"",(null==r?void 0:r.streamUserId)||"",EP()-n,{type:"answer"}),e.next=10;break;case 7:e.prev=7,e.t0=e.catch(1),this.monitor.rtcSetDescription(-1,e.t0.message,mV.W_1,"local"===(null==r?void 0:r.streamUserId)?gV.UP:gV.DOWN,(null==r?void 0:r.streamId)||"",(null==r?void 0:r.streamUserId)||"",EP()-n,{type:"answer"});case 10:case"end":return e.stop()}}),e,this,[[1,7]])}))),function(e,t){return n.apply(this,arguments)})},{key:"setCurrentDescription",value:(t=o(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:case"end":return e.stop()}}),e)}))),function(){return t.apply(this,arguments)})},{key:"pc",get:function(){return this._peerConnection}}]),h}(nM.exports.EventEmitter),rB={},nB={},iB={exports:{}},oB=iB.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(oB).forEach((function(e){oB[e].forEach((function(e){e.reg||(e.reg=/(.*)/),e.format||(e.format="%s")}))})),function(e){var t=function(e){return String(Number(e))===e?Number(e):e},r=function(e,r,n){var i=e.name&&e.names;e.push&&!r[e.push]?r[e.push]=[]:i&&!r[e.name]&&(r[e.name]={});var o=e.push?{}:i?r[e.name]:r;!function(e,r,n,i){if(i&&!n)r[i]=t(e[1]);else for(var o=0;o<n.length;o+=1)null!=e[o+1]&&(r[n[o]]=t(e[o+1]))}(n.match(e.reg),o,e.names,e.name),e.push&&r[e.push].push(o)},n=iB.exports,i=RegExp.prototype.test.bind(/^([a-z])=(.*)/);e.parse=function(e){var t={},o=[],a=t;return e.split(/(\r\n|\r|\n)/).filter(i).forEach((function(e){var t=e[0],i=e.slice(2);"m"===t&&(o.push({rtp:[],fmtp:[]}),a=o[o.length-1]);for(var s=0;s<(n[t]||[]).length;s+=1){var u=n[t][s];if(u.reg.test(i))return r(u,a,i)}})),t.media=o,t};var o=function(e,r){var n=r.split(/=(.+)/,2);return 2===n.length?e[n[0]]=t(n[1]):1===n.length&&r.length>1&&(e[n[0]]=void 0),e};e.parseParams=function(e){return e.split(/;\s?/).reduce(o,{})},e.parseFmtpConfig=e.parseParams,e.parsePayloads=function(e){return e.toString().split(" ").map(Number)},e.parseRemoteCandidates=function(e){for(var r=[],n=e.split(" ").map(t),i=0;i<n.length;i+=3)r.push({component:n[i],ip:n[i+1],port:n[i+2]});return r},e.parseImageAttributes=function(e){return e.split(" ").map((function(e){return e.substring(1,e.length-1).split(",").reduce(o,{})}))},e.parseSimulcastStreamList=function(e){return e.split(";").map((function(e){return e.split(",").map((function(e){var r,n=!1;return"~"!==e[0]?r=t(e):(r=t(e.substring(1,e.length)),n=!0),{scid:r,paused:n}}))}))}}(nB);var aB=iB.exports,sB=/%[sdv%]/g,uB=function(e){var t=1,r=arguments,n=r.length;return e.replace(sB,(function(e){if(t>=n)return e;var i=r[t];switch(t+=1,e){case"%%":return"%";case"%s":return String(i);case"%d":return Number(i);case"%v":return""}}))},cB=function(e,t,r){var n=[e+"="+(t.format instanceof Function?t.format(t.push?r:r[t.name]):t.format)];if(t.names)for(var i=0;i<t.names.length;i+=1){var o=t.names[i];t.name?n.push(r[t.name][o]):n.push(r[t.names[i]])}else n.push(r[t.name]);return uB.apply(null,n)},dB=["v","o","s","i","u","e","p","c","b","t","r","z","a"],lB=["i","c","b","a"],hB=nB,fB=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||dB,n=t.innerOrder||lB,i=[];return r.forEach((function(t){aB[t].forEach((function(r){r.name in e&&null!=e[r.name]?i.push(cB(t,r,e)):r.push in e&&null!=e[r.push]&&e[r.push].forEach((function(e){i.push(cB(t,r,e))}))}))})),e.media.forEach((function(e){i.push(cB("m",aB.m[0],e)),n.forEach((function(t){aB[t].forEach((function(r){r.name in e&&null!=e[r.name]?i.push(cB(t,r,e)):r.push in e&&null!=e[r.push]&&e[r.push].forEach((function(e){i.push(cB(t,r,e))}))}))}))})),i.join("\r\n")+"\r\n"};rB.write=fB,rB.parse=hB.parse,rB.parseParams=hB.parseParams,rB.parseFmtpConfig=hB.parseFmtpConfig,rB.parsePayloads=hB.parsePayloads,rB.parseRemoteCandidates=hB.parseRemoteCandidates,rB.parseImageAttributes=hB.parseImageAttributes,rB.parseSimulcastStreamList=hB.parseSimulcastStreamList;var pB=Math.pow(2,32),_B=function(){return Math.floor(Math.random()*pB+1e3)},vB=function(e,t,r){return r||(r=_B()),[{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)}]},mB=function(e,t){var r=_B(),n=_B();return{ssrcs:[r,n].reduce((function(r,n){return r.concat(vB(e,t,n))}),[]),ssrcGroups:[{semantics:"FID",ssrcs:"".concat(r," ").concat(n)}]}};function gB(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 yB=function(e,t,n){var i=r(r({},e),{},{invalid:[{value:"realx-exts:rscp"}],media:[t,n]});return delete i.groups,delete i.msidSemantic,rB.write(i)};function SB(e){return bB.apply(this,arguments)}function bB(){return(bB=o(regeneratorRuntime.mark((function e(t){var r,n,i,o;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r={},n=t.publicIPs,i=t.certFingerprint,o=t.iceParams,r.fingerprint={type:"sha-256",hash:i},r.icePwd=o.serverIcePwd,e.next=6,kB(o.serverIceUfrag);case 6:return r.iceUfrag=e.sent,jV.setStats({connection_id:r.iceUfrag}),r.candidates=EB(n),r.setup="active",r.iceOptions="renomination",e.abrupt("return",r);case 12:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function EB(e){if(!Array.isArray(e))return[];var t=0,n=2130706431,i=[];return e.forEach((function(e){var o={component:1,ip:e.ip,type:"host",generation:e.generation};e.udpPorts&&e.udpPorts.forEach((function(e){i.push(r(r({},o),{},{foundation:t++,transport:"udp",port:e,priority:n}))})),e.tcpPorts&&e.tcpPorts.forEach((function(e){i.push(r(r({},o),{},{foundation:t++,transport:"tcp",port:e,tcptype:"passive",priority:2130705431}))}))})),i}var kB=function(){var e=o(regeneratorRuntime.mark((function e(t){var r,n,i,o,a,s,u;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=new TextEncoder,n=r.encode("PREC"),e.t0=Uint8Array,e.next=5,TP.b64str2ab(t);case 5:return e.t1=e.sent,i=new e.t0(e.t1),o=r.encode(Date.now().toString()).slice(-4),(a=new Uint8Array(2))[0]=0,a[1]=1,s=kP(Uint8Array,n,i,o,a),e.next=14,TP.ab2b64str(s.buffer);case 14:return u=e.sent,e.abrupt("return",u);case 16:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),RB=ke,TB=jd,IB=Im.exports.getWeakData,AB=xr,wB=je,CB=Yd,OB=Cl,NB=Ut,xB=wn.set,DB=wn.getterFor,PB=Ka.find,MB=Ka.findIndex,UB=RB([].splice),LB=0,VB=function(e){return e.frozen||(e.frozen=new FB)},FB=function(){this.entries=[]},BB=function(e,t){return PB(e.entries,(function(e){return e[0]===t}))};FB.prototype={get:function(e){var t=BB(this,e);if(t)return t[1]},has:function(e){return!!BB(this,e)},set:function(e,t){var r=BB(this,e);r?r[1]=t:this.entries.push([e,t])},delete:function(e){var t=MB(this.entries,(function(t){return t[0]===e}));return~t&&UB(this.entries,t,1),!!~t}};var jB,GB={getConstructor:function(e,t,r,n){var i=e((function(e,i){CB(e,o),xB(e,{type:t,id:LB++,frozen:void 0}),null!=i&&OB(i,e[n],{that:e,AS_ENTRIES:r})})),o=i.prototype,a=DB(t),s=function(e,t,r){var n=a(e),i=IB(AB(t),!0);return!0===i?VB(n).set(t,r):i[n.id]=r,e};return TB(o,{delete:function(e){var t=a(this);if(!wB(e))return!1;var r=IB(e);return!0===r?VB(t).delete(e):r&&NB(r,t.id)&&delete r[t.id]},has:function(e){var t=a(this);if(!wB(e))return!1;var r=IB(e);return!0===r?VB(t).has(e):r&&NB(r,t.id)}}),TB(o,r?{get:function(e){var t=a(this);if(wB(e)){var r=IB(e);return!0===r?VB(t).get(e):r?r[t.id]:void 0}},set:function(e,t){return s(this,e,t)}}:{add:function(e){return s(this,e,!0)}}),i}},HB=ne,zB=ke,KB=jd,WB=Im.exports,XB=dg,qB=GB,YB=je,JB=Dm,QB=wn.enforce,ZB=on,$B=!HB.ActiveXObject&&"ActiveXObject"in HB,ej=function(e){return function(){return e(this,arguments.length?arguments[0]:void 0)}},tj=XB("WeakMap",ej,qB);if(ZB&&$B){jB=qB.getConstructor(ej,"WeakMap",!0),WB.enable();var rj=tj.prototype,nj=zB(rj.delete),ij=zB(rj.has),oj=zB(rj.get),aj=zB(rj.set);KB(rj,{delete:function(e){if(YB(e)&&!JB(e)){var t=QB(this);return t.frozen||(t.frozen=new jB),nj(this,e)||t.frozen.delete(e)}return nj(this,e)},has:function(e){if(YB(e)&&!JB(e)){var t=QB(this);return t.frozen||(t.frozen=new jB),ij(this,e)||t.frozen.has(e)}return ij(this,e)},get:function(e){if(YB(e)&&!JB(e)){var t=QB(this);return t.frozen||(t.frozen=new jB),ij(this,e)?oj(this,e):t.frozen.get(e)}return oj(this,e)},set:function(e,t){if(YB(e)&&!JB(e)){var r=QB(this);r.frozen||(r.frozen=new jB),ij(this,e)?aj(this,e,t):r.frozen.set(e,t)}else aj(this,e,t);return this}})}var sj=function(e){d(y,e);var t,r,n,i,s,l,h,f,_,m,g=v(y);function y(){var e;return a(this,y),c(p(e=g.call(this)),"_hasVideoPermission",!1),c(p(e),"_hasAudioPermission",!1),c(p(e),"inited",!1),c(p(e),"deviceMap",{audioinput:new Map,audiooutput:new Map,videoinput:new Map}),e._handleDeviceChange=e._handleDeviceChange.bind(p(e)),!RP()&&e.refreshDevices(),e}return u(y,[{key:"refreshDevices",value:(m=o(regeneratorRuntime.mark((function e(){var t=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(navigator.mediaDevices){e.next=2;break}return e.abrupt("return");case 2:return e.next=4,navigator.mediaDevices.enumerateDevices();case 4:e.sent.forEach((function(e){var r;null===(r=t.deviceMap[e.kind])||void 0===r||r.set(e.deviceId,e)})),this.inited||this.initListener(),this.inited=!0;case 8:case"end":return e.stop()}}),e,this)}))),function(){return m.apply(this,arguments)})},{key:"initListener",value:(_=o(regeneratorRuntime.mark((function e(){var t;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:"function"==typeof(null===(t=navigator.mediaDevices)||void 0===t?void 0:t.addEventListener)&&navigator.mediaDevices.addEventListener("devicechange",this._handleDeviceChange);case 1:case"end":return e.stop()}}),e,this)}))),function(){return _.apply(this,arguments)})},{key:"_handleDeviceChange",value:(f=o(regeneratorRuntime.mark((function e(){var t,r,n=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,navigator.mediaDevices.enumerateDevices();case 2:t=e.sent,r=Array.from([].concat(S(this.deviceMap.audioinput.values()),S(this.deviceMap.videoinput.values()),S(this.deviceMap.audiooutput.values()))),t.forEach((function(e){var t=n.deviceMap[e.kind].get(e.deviceId);n.deviceMap[e.kind].set(e.deviceId,e),t||(e.kind.includes("video")?n.emit(ee.onVideoDeviceStateChanged,{mediaDeviceInfo:e,deviceState:"active"}):e.kind.includes("audio")&&n.emit(ee.onAudioDeviceStateChanged,{mediaDeviceInfo:e,deviceState:"active"}))})),r.forEach((function(e){t.find((function(t){return t.deviceId===e.deviceId&&t.kind===e.kind}))||(n.deviceMap[e.kind].delete(e.deviceId),e.kind.includes("video")?n.emit(ee.onVideoDeviceStateChanged,{mediaDeviceInfo:e,deviceState:"inactive"}):e.kind.includes("audio")&&n.emit(ee.onAudioDeviceStateChanged,{mediaDeviceInfo:e,deviceState:"inactive"}))}));case 6:case"end":return e.stop()}}),e,this)}))),function(){return f.apply(this,arguments)})},{key:"getVideoPermission",value:(h=o(regeneratorRuntime.mark((function e(){var t=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(navigator.mediaDevices&&navigator.mediaDevices.getUserMedia){e.next=4;break}throw new cD(sD.NOT_SUPPORTED,"GetUserMedia not supported");case 4:if(!this.hasVideoPermission){e.next=6;break}return e.abrupt("return",!0);case 6:return e.prev=6,e.next=9,navigator.mediaDevices.getUserMedia({audio:!1,video:!0}).then((function(e){e&&(e.getTracks().forEach((function(e){return e.stop()})),t.hasVideoPermission=!0,t.inited||t.refreshDevices())}));case 9:e.next=13;break;case 11:e.prev=11,e.t0=e.catch(6);case 13:return e.abrupt("return",this.hasVideoPermission);case 14:case"end":return e.stop()}}),e,this,[[6,11]])}))),function(){return h.apply(this,arguments)})},{key:"getAudioPermission",value:(l=o(regeneratorRuntime.mark((function e(){var t=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(navigator.mediaDevices&&navigator.mediaDevices.getUserMedia){e.next=4;break}throw new cD(sD.NOT_SUPPORTED,"GetUserMedia not supported");case 4:if(!this.hasAudioPermission){e.next=6;break}return e.abrupt("return",!0);case 6:return e.prev=6,e.next=9,navigator.mediaDevices.getUserMedia({audio:!0,video:!1}).then((function(e){e&&(e.getTracks().forEach((function(e){return e.stop()})),t.hasAudioPermission=!0,t.inited||t.refreshDevices())}));case 9:e.next=13;break;case 11:e.prev=11,e.t0=e.catch(6);case 13:return e.abrupt("return",this.hasAudioPermission);case 14:case"end":return e.stop()}}),e,this,[[6,11]])}))),function(){return l.apply(this,arguments)})},{key:"enumerateDevices",value:(s=o(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,this.getAudioPermission();case 3:e.next=7;break;case 5:e.prev=5,e.t0=e.catch(0);case 7:return e.prev=7,e.next=10,this.getVideoPermission();case 10:e.next=14;break;case 12:e.prev=12,e.t1=e.catch(7);case 14:return e.next=16,this.refreshDevices();case 16:return e.abrupt("return",Array.from([].concat(S(this.deviceMap.audioinput.values()),S(this.deviceMap.videoinput.values()),S(this.deviceMap.audiooutput.values()))));case 17:case"end":return e.stop()}}),e,this,[[0,5],[7,12]])}))),function(){return s.apply(this,arguments)})},{key:"enumerateAudioCaptureDevices",value:(i=o(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.refreshDevices();case 2:return e.abrupt("return",Array.from(this.deviceMap.audioinput.values()));case 3:case"end":return e.stop()}}),e,this)}))),function(){return i.apply(this,arguments)})},{key:"enumerateVideoCaptureDevices",value:(n=o(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.refreshDevices();case 2:return e.abrupt("return",Array.from(this.deviceMap.videoinput.values()));case 3:case"end":return e.stop()}}),e,this)}))),function(){return n.apply(this,arguments)})},{key:"enumerateAudioPlaybackDevices",value:(r=o(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.refreshDevices();case 2:return e.abrupt("return",Array.from(this.deviceMap.audiooutput.values()));case 3:case"end":return e.stop()}}),e,this)}))),function(){return r.apply(this,arguments)})},{key:"getDeviceById",value:(t=o(regeneratorRuntime.mark((function e(t){var r;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.enumerateDevices();case 2:return r=e.sent,e.abrupt("return",r.find((function(e){return e.deviceId===t})));case 4:case"end":return e.stop()}}),e,this)}))),function(e){return t.apply(this,arguments)})},{key:"hasAudioPermission",get:function(){return this._hasAudioPermission},set:function(e){if(!e)throw new cD(sD.NO_PERMISSION,"Cannot revoke audio permission");this.refreshDevices(),this._hasAudioPermission=!0}},{key:"hasVideoPermission",get:function(){return this._hasVideoPermission},set:function(e){if(!e)throw new cD(sD.NO_PERMISSION,"Cannot revoke Video permission");this.inited||this.refreshDevices(),this._hasVideoPermission=!0}}]),y}(dM),uj=new sj,cj=function(){function e(){a(this,e),c(this,"_audioContextInstance",void 0)}return u(e,[{key:"getAudioContextInstance",value:function(){if(!this._audioContextInstance){var e=window.AudioContext||window.webkitAudioContext;this._audioContextInstance=new e}return this._audioContextInstance}}]),e}(),dj=function(){function e(t){a(this,e),c(this,"_ctx",void 0),c(this,"_analyserNode",void 0),c(this,"_audioSource",void 0);var r=lj.getAudioContextInstance();if(t instanceof MediaStreamTrack){var n=new MediaStream;n.addTrack(t),this._audioSource=r.createMediaStreamSource(n)}else t instanceof AudioNode?this._audioSource=t:(this._audioSource=r.createMediaElementSource(t),this._audioSource.connect(r.destination));var i=r.createAnalyser();this._audioSource.connect(i),this._analyserNode=i,this._ctx=r}return u(e,[{key:"getAudioLevel",value: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}},{key:"destroy",value:function(){this._audioSource.disconnect(),this._analyserNode.disconnect()}}]),e}(),lj=new cj,hj=new uM("VERTC",0),fj=new WeakMap,pj=function(e){return fj.get(e)},_j=function(e){d(r,e);var t=v(r);function r(e,n){var i;return a(this,r),c(p(i=t.call(this)),"mediaType",void 0),c(p(i),"_trackId",void 0),i._trackId=e,i.mediaType=n,i}return u(r,[{key:"getId",value:function(){return this._trackId}}]),r}(dM),vj=function(e){d(r,e);var t=v(r);function r(e,n,i){var o;return a(this,r),c(p(o=t.call(this,n,i)),"_mediaTrack",void 0),o._mediaTrack=e,o._initListeners(),o}return u(r,[{key:"getTrack",value:function(){return this._mediaTrack}},{key:"setTrack",value:function(e){this._mediaTrack=e}},{key:"close",value:function(){var e;return null===(e=this._mediaTrack)||void 0===e?void 0:e.stop()}},{key:"_initListeners",value:function(){var e=this;this._mediaTrack instanceof MediaStreamTrack&&this._mediaTrack.addEventListener("ended",(function(){VV.rtcError("track-ended mediaType: ".concat(e._mediaTrack.kind),-1001),e.emit("track-ended",e)}))}}]),r}(_j),mj=function(e){d(r,e);var t=v(r);function r(e,n,i){var o;return a(this,r),c(p(o=t.call(this,n,i)),"_mediaTrack",void 0),o._mediaTrack=e,o}return u(r,[{key:"getTrack",value:function(){return this._mediaTrack}}]),r}(_j),gj=function(e){d(i,e);var t,n=v(i);function i(e,t){var r;return a(this,i),c(p(r=n.call(this,e,t,"video")),"resolution",void 0),c(p(r),"videoCaptureConfig",void 0),c(p(r),"dummy",!1),r.resolution={width:0,height:0},r}return u(i,[{key:"updateVideoCaptureConfig",value:(t=o(regeneratorRuntime.mark((function e(){var t;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.videoCaptureConfig&&this.getTrack()){e.next=2;break}return e.abrupt("return");case 2:return hj.print("updateVideoEncoderConfig","update localVideoTrack: ",this.videoCaptureConfig),delete r({},this.videoCaptureConfig).contentHint,e.next=7,this.getTrack().applyConstraints(this.videoCaptureConfig);case 7:((t=this.getTrack().getSettings()).width&&t.width!==this.resolution.width||t.height&&t.height!==this.resolution.height)&&(this.resolution={width:t.width,height:t.height},this.emit("resolution-change",this.resolution));case 9:case"end":return e.stop()}}),e,this)}))),function(){return t.apply(this,arguments)})},{key:"replaceTrack",value:function(e){this.setTrack(e)}},{key:"setContentHint",value:function(e){this._mediaTrack&&"contentHint"in this._mediaTrack&&["text","motion","detail"].includes(e)&&(this._mediaTrack.contentHint=e)}}]),i}(vj),yj=function(e){d(n,e);var t,r=v(n);function n(e,t){var i;return a(this,n),c(p(i=r.call(this,e,t,"audio")),"audioCaptureConfig",void 0),c(p(i),"_audioLevelFetcher",void 0),c(p(i),"mixedAudioTrack",void 0),c(p(i),"mixType",Q.PLAYOUT_AND_PUBLISH),i}return u(n,[{key:"getAudioLevel",value:function(){return this._audioLevelFetcher||(this._audioLevelFetcher=new dj(this.getTrack())),this._audioLevelFetcher.getAudioLevel()}},{key:"updateAudioCaptureConfig",value:(t=o(regeneratorRuntime.mark((function e(){var t;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.audioCaptureConfig){e.next=2;break}return e.abrupt("return");case 2:return hj.print("updateAudioCaptureConfig","update localAudioTrack: ",this.audioCaptureConfig),e.next=5,null===(t=this.getTrack())||void 0===t?void 0:t.applyConstraints(this.audioCaptureConfig);case 5:case"end":return e.stop()}}),e,this)}))),function(){return t.apply(this,arguments)})}]),n}(vj),Sj=function(e){d(r,e);var t=v(r);function r(e,n){return a(this,r),t.call(this,e,n,"video")}return u(r)}(mj),bj=function(e){d(r,e);var t=v(r);function r(e,n){var i;return a(this,r),c(p(i=t.call(this,e,n,"audio")),"_audioLevelFetcher",void 0),i}return u(r,[{key:"getAudioLevel",value:function(){return this._audioLevelFetcher||(this._audioLevelFetcher=new dj(this.getTrack())),this._audioLevelFetcher.getAudioLevel()}}]),r}(mj),Ej=function(e){d(r,e);var t=v(r);function r(){return a(this,r),t.apply(this,arguments)}return u(r)}(yj),kj=function(e){d(r,e);var t=v(r);function r(){return a(this,r),t.apply(this,arguments)}return u(r)}(gj),Rj=function(e){d(r,e);var t=v(r);function r(){return a(this,r),t.apply(this,arguments)}return u(r)}(gj),Tj=function(e){d(r,e);var t=v(r);function r(){return a(this,r),t.apply(this,arguments)}return u(r)}(yj),Ij=function(e){d(r,e);var t=v(r);function r(){return a(this,r),t.apply(this,arguments)}return u(r)}(gj),Aj=function(e){d(r,e);var t=v(r);function r(){return a(this,r),t.apply(this,arguments)}return u(r)}(yj);function wj(e){return Cj.apply(this,arguments)}function Cj(){return(Cj=o(regeneratorRuntime.mark((function e(t){var r,n,i,o,a,s;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=(null==t||null===(r=t.deviceId)||void 0===r?void 0:r.exact)||"default",e.prev=1,hj.print("createCameraVideoTrack","constraints:",t),VV.rtcVideoCaptureEvent({event_type:PV.START,media_device_id:i}),o=EP(),e.next=7,navigator.mediaDevices.getUserMedia({video:t});case 7:n=e.sent,VV.rtcVideoCaptureEvent({event_type:PV.START_CAPTURE_RESULT,media_device_id:i,reason:MV.SUCCESS,elapse:EP()-o}),uj.hasVideoPermission=!0,e.next=16;break;case 12:throw e.prev=12,e.t0=e.catch(1),VV.rtcVideoCaptureEvent({event_type:PV.RUNNING_FAILED,media_device_id:i,error_code:e.t0.code,reason:e.t0.name+e.t0.message}),new cD(sD.GET_VIDEO_TRACK_FAILED,"throw error from getUserMedia",e.t0);case 16:return a=n.getVideoTracks()[0],fj.set(a,n),(s=new kj(a,bP())).videoCaptureConfig=t,e.abrupt("return",s);case 21:case"end":return e.stop()}}),e,null,[[1,12]])})))).apply(this,arguments)}function Oj(e,t){return Nj.apply(this,arguments)}function Nj(){return Nj=o(regeneratorRuntime.mark((function e(t,r){var n,i,o,a,s,u,c,d,l,h,f;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return hj.print("createCameraVideoTrack","constraints:",t),o=(null==t||null===(n=t.deviceId)||void 0===n?void 0:n.exact)||"default",s=(a=r||{}).sampleRate,u=a.channel,c=a.agc,d=a.ans,l=a.aec,void 0===t.sampleRate&&(t.sampleRate=s),void 0===t.channelCount&&(t.channelCount=u),void 0===t.autoGainControl&&(t.autoGainControl=c),void 0===t.noiseSuppression&&(t.noiseSuppression=d),void 0===t.echoCancellation&&(t.echoCancellation=l),e.prev=8,VV.rtcVideoCaptureEvent({event_type:PV.START,media_device_id:o}),h=EP(),e.next=13,navigator.mediaDevices.getUserMedia({audio:t});case 13:i=e.sent,VV.rtcVideoCaptureEvent({event_type:PV.START_CAPTURE_RESULT,media_device_id:o,reason:MV.SUCCESS,elapse:EP()-h}),uj.hasAudioPermission=!0,e.next=22;break;case 18:throw e.prev=18,e.t0=e.catch(8),VV.rtcVideoCaptureEvent({event_type:PV.RUNNING_FAILED,media_device_id:o,error_code:e.t0.code,reason:e.t0.name+e.t0.message}),new cD(sD.GET_AUDIO_TRACK_FAILED,"throw error from getUserMedia",e.t0);case 22:return f=i.getAudioTracks()[0],fj.set(f,i),e.abrupt("return",new Ej(f,bP()));case 25:case"end":return e.stop()}}),e,null,[[8,18]])}))),Nj.apply(this,arguments)}function xj(){return Dj.apply(this,arguments)}function Dj(){return Dj=o(regeneratorRuntime.mark((function e(){var t,r,n,i,o=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=o.length>0&&void 0!==o[0]&&o[0],r=o.length>1?o[1]:void 0,hj.print("createScreenStream","withAudio:",t),e.prev=3,VV.rtcVideoCaptureEvent({event_type:PV.START,media_device_id:"screen"}),i=EP(),e.next=8,navigator.mediaDevices.getDisplayMedia({video:r||!0,audio:t});case 8:n=e.sent,VV.rtcVideoCaptureEvent({event_type:PV.START_CAPTURE_RESULT,media_device_id:"screen",reason:MV.SUCCESS,elapse:EP()-i}),e.next=16;break;case 12:throw e.prev=12,e.t0=e.catch(3),VV.rtcVideoCaptureEvent({event_type:PV.RUNNING_FAILED,media_device_id:"screen",error_code:e.t0.code,reason:e.t0.name+e.t0.message}),new cD(sD.GET_SCREEN_TRACK_FAILED,"throw error from getDisplayMedia",e.t0);case 16:return e.abrupt("return",n);case 17:case"end":return e.stop()}}),e,null,[[3,12]])}))),Dj.apply(this,arguments)}var Pj=function(e){return e[e.NONE=0]="NONE",e}(Pj||{}),Mj=function(){function e(){a(this,e)}return u(e,null,[{key:"getNalunits",value: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)}},{key:"getAnnexbNals",value:function(t){for(var r=[],n=e.getHeaderPositionAnnexB(t),i=n.pos,o=i;i<t.length-4;){var a=new Uint8Array(t.buffer.slice(i,i+n.headerLength));n.pos===t.position&&t.skip(n.headerLength),o=(n=e.getHeaderPositionAnnexB(t)).pos;var s={header:a,body:new Uint8Array(t.buffer.slice(i+a.byteLength,o)),type:-1};e.analyseNal(s),s.type<=9&&0!==s.type&&r.push(s),t.skip(o-t.position),i=o}return r}},{key:"getAvccNals",value:function(t){for(var r=[];t.position<t.length-4;){var n=t.getInt32(t.position);if(!(t.length-t.position>=n))break;var i=new Uint8Array(t.buffer.slice(t.position,t.position+4));t.skip(4);var o=new Uint8Array(t.buffer.slice(t.position,t.position+n));t.skip(n);var a={header:i,body:o,type:-1};e.analyseNal(a),a.type<=9&&0!==a.type&&r.push(a)}return r}},{key:"analyseNal",value: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}}},{key:"getHeaderPositionAnnexB",value:function(e){for(var t=e.position,r=0,n=e.length;3!==r&&4!==r&&t<n-4;)0===e.getInt16(t)?1===e.getInt16(t+2)?r=4:1===e.getInt8(t+2)?r=3:t++:t++;return t===n-4&&(0===e.getInt16(t)?1===e.getInt16(t+2)?r=4:t=n:(t++,0===e.getInt16(t)&&1===e.getInt8(t)?r=3:t=n)),{pos:t,headerLength:r}}},{key:"getAvcc",value:function(e,t){var r=new Uint8Array(e.byteLength+t.byteLength+11);r[0]=1,r[1]=e[1],r[2]=e[2],r[3]=e[3],r[4]=255,r[5]=225;var n=6;return r.set(new Uint8Array([e.byteLength>>>8&255,255&e.byteLength]),n),n+=2,r.set(e,n),r[n+=e.byteLength]=1,n++,r.set(new Uint8Array([t.byteLength>>>8&255,255&t.byteLength]),n),n+=2,r.set(t,n),r}}]),e}(),Uj=function(){function e(t){a(this,e),c(this,"_position",0),c(this,"_dataview",void 0),this._dataview=new DataView(t)}return u(e,[{key:"length",get:function(){return this.buffer.byteLength}},{key:"buffer",get:function(){return this._dataview.buffer}},{key:"position",get:function(){return this._position},set:function(e){this._position=e}},{key:"back",value:function(e){this.position-=e}},{key:"getUint8",value:function(e){return this._dataview.getUint8(e)}},{key:"getInt8",value:function(e){return this._dataview.getInt8(e)}},{key:"getInt16",value:function(e){return this._dataview.getInt16(e)}},{key:"getUint16",value:function(e){return this._dataview.getUint16(e)}},{key:"getUint32",value:function(e){return this._dataview.getUint32(e)}},{key:"getInt32",value:function(e){return this._dataview.getInt32(e)}},{key:"skip",value:function(t){for(var r=Math.floor(t/4),n=t%4,i=0;i<r;i++)e.readByte(this,4);n>0&&e.readByte(this,n)}},{key:"readUint8",value:function(){return e.readByte(this,1)}},{key:"readUint16",value:function(){return e.readByte(this,2)}},{key:"readUint24",value:function(){return e.readByte(this,3)}},{key:"readUint32",value:function(){return e.readByte(this,4)}},{key:"readUint64",value:function(){return e.readByte(this,8)}},{key:"readInt8",value:function(){return e.readByte(this,1,!0)}},{key:"readInt16",value:function(){return e.readByte(this,2,!0)}},{key:"readInt32",value:function(){return e.readByte(this,4,!0)}},{key:"writeUint32",value:function(e){return new Uint8Array([e>>>24&255,e>>>16&255,e>>>8&255,255&e])}}],[{key:"readByte",value:function(e,t,r){var n;switch(t){case 1:n=r?e.getInt8(e.position):e.getUint8(e.position);break;case 2:n=r?e.getInt16(e.position):e.getUint16(e.position);break;case 3:if(r)throw new Error("not supported for readByte 3");n=e.getUint8(e.position)<<16,n|=e.getUint8(e.position+1)<<8,n|=e.getUint8(e.position+2);break;case 4:n=r?e.getInt32(e.position):e.getUint32(e.position);break;case 8:if(r)throw new Error("not supported for readBody 8");n=e.getUint32(e.position)<<32,n|=e.getUint32(e.position+4);break;default:n=""}return e.position+=t,n}}]),e}(),Lj=function(e){return e[e.internal=0]="internal",e[e.external=1]="external",e[e.bypass=2]="bypass",e}(Lj||{}),Vj=new Uint8Array([109,167,53,190,103,90,72,1,170,89,63,164,194,199,19,85]),Fj=new Uint8Array([109,167,53,190,103,90,72,1,170,89,63,164,194,199,19,84]),Bj=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)};function jj(e){for(var t=[];e>=255;)e-=255,t.push(255);return t.push(e),new Uint8Array(t)}function Gj(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=0;255===e[t]&&t<e.byteLength;)t++,r+=255;return t<e.byteLength&&(r+=e[t++]),[r,t]}var Hj=function(){function e(){a(this,e)}return u(e,null,[{key:"generateSEI",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r=new Uint8Array([0,0,0,1]),n=new Uint8Array([6]),i=new Uint8Array([5]),o=t?Vj:Fj,a=jj(e.byteLength+o.byteLength),s=Bj(e);return new Uint8Array([].concat(S(r),S(n),S(i),S(a),S(o),S(s),[128]))}},{key:"decodeSeiBody",value: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 n=y(Gj(t,r+=2),2),i=n[0],o=2,a=(r=n[1])+i;return t.byteLength>=Fj.byteLength&&i>=Fj.byteLength&&t.slice(r,r+Fj.byteLength).toString()===Fj.toString()?(r+=Fj.byteLength,o=1):t.byteLength>=Fj.byteLength&&i>=Fj.byteLength&&t.slice(r,r+Vj.byteLength).toString()===Vj.toString()&&(r+=Vj.byteLength,o=0),{type:o,payload:t.slice(r,a)}}}}},{key:"parseInternalSEI",value:function(e){var t=new Map,r=0;if(0===e.type){for(;e.payload.byteLength-r>=2;){var n=y(Gj(e.payload,r),2),i=n[0];r=n[1];var o=y(Gj(e.payload,r),2),a=o[0];if(r=o[1],t.get(i)||!(a<e.payload.byteLength-r))break;t.set(i,e.payload.slice(r,r+a))}return t}}},{key:"makeInternalSei",value:function(e){var t,r=[],n=k(e);try{for(n.s();!(t=n.n()).done;){var i=y(t.value,2),o=i[0],a=i[1],s=jj(o),u=jj(a.byteLength);r.push(s,u,a)}}catch(PU){n.e(PU)}finally{n.f()}var c=r.reduce((function(e,t){return e+t.byteLength}),0),d=new Uint8Array(c);return r.reduce((function(e,t){return d.set(t,e),e+t.byteLength}),0),d}}]),e}(),zj=function(){function e(t){a(this,e),c(this,"_stream",void 0),c(this,"_timer",void 0),c(this,"client",void 0),c(this,"handler",void 0),c(this,"monitor",void 0),this._stream=t}return u(e,[{key:"setVar",value:function(e,t,r){this.client=e,this.handler=t,this.monitor=r}},{key:"delStatsEvtInterval",value:function(){clearTimeout(this._timer),this._timer=void 0}},{key:"destroy",value:function(){this.delStatsEvtInterval()}}]),e}(),Kj=function(e){d(i,e);var t,r,n=v(i);function i(e){var t;return a(this,i),(t=n.call(this,e))._stream=e,t}return u(i,[{key:"setLocalStreamStatsEvtInterval",value:function(e,t,r){var n,i,a=this;if(!this._timer){this.setVar(e,t,r),e.once(SF.ABNORMAL_DISCONNECTION,(function(){a.destroy()}));var s={audio:{},video:{}},u=this._stream,c=null===(n=u.audioTrack)||void 0===n?void 0:n.getTrack(),d=null===(i=u.videoTrack)||void 0===i?void 0:i.getTrack();this.getAudioStats(c,s),this.getVideoStats(d,s),this.delStatsEvtInterval();var l=function(){var e=o(regeneratorRuntime.mark((function e(){var t,r,n,i,o,c;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=null===(t=u.audioTrack)||void 0===t?void 0:t.getTrack(),i=null===(r=u.videoTrack)||void 0===r?void 0:r.getTrack(),e.next=4,a.getAudioStats(n,s);case 4:return o=e.sent,e.next=7,a.getVideoStats(i,s);case 7:return c=e.sent,e.abrupt("return",{audioStats:o,videoStats:c,isScreen:u.isScreen});case 9:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),h=function(){var e=o(regeneratorRuntime.mark((function e(){var t,r;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,l();case 2:r=e.sent,null===(t=a.client)||void 0===t||t.emit("onLocalStreamStats",r),a._timer=setTimeout(h,2e3);case 5:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}();this._timer=setTimeout(h,2e3)}}},{key:"unpublish",value:function(){this.delStatsEvtInterval()}},{key:"getAudioStats",value:(r=o(regeneratorRuntime.mark((function e(t,r){var n,i,o,a,s,u,c,d,l,h;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n={},i={timestamp:Date.now()},o=this._stream,a=o.streamId,s=o.audioMid,u=o.isScreen,c=o.pubAttributes,d={media_type:"audio",is_screen:!!u,direction:"up",stream_id:a,vid:s,connection_status:navigator.onLine,capture_state:c.localaudio?"capture_state_on":"capture_state_off"},t&&this.handler){e.next=6;break}return e.abrupt("return",n);case 6:return e.next=8,this.handler.getStats(t);case 8:if((l=e.sent).length){e.next=11;break}return e.abrupt("return",n);case 11:if(l.forEach((function(e){var t=e.type,r=e.packetsSent,o=e.packetsLost,a=e.bytesSent,s=e.clockRate,u=e.roundTripTime,c=e.channels,l=e.audioLevel,h=e.googRtt,f=e.mimeType,p=e.availableIncomingBitrate,_=e.availableOutgoingBitrate,v=e.bytesReceived,m=e.nominated,g=e.id,y=e.currentRoundTripTime,S=e.state,b=e.writable,E=e.requestsReceived,k=e.responsesReceived,R=e.requestsSent,T=e.consentRequestsSent,I=e.responsesSent,A=e.jitter,w=e.candidateType,C=e.ip,O=e.address,N=e.networkType,x=e.port,D=e.protocol,P=e.nackCount,M=e.retransmittedBytesSent,U=e.retransmittedPacketsSent,L=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=r,i.bytesSent=a,d.bytes=a,d.packetsSent=r,d.nackCount=P,d.ssrc=F,d.retransmitted_bytes_sent=M,d.retransmitted_packets_sent=U,i.retransmittedPacketsSent=U):"remote-inbound-rtp"===t?(i.packetsLost=o,d.packetsLost=o,d.jitter=1e3*A,n.rtt=1e3*u,d.rtt=n.rtt,d.round_trip_time_measurements=L,n._fractionLost=H||0):"codec"===t?(n.recordSampleRate=s,n.numChannels=c,d.codecName=f):"media-source"===t?(d.audio_level=l?-10*Math.log10(Math.pow(l,2)):l,d.volume=255*l,d.total_audio_energy=B,d.total_samples_duration=j):"ssrc"===t&&"audio"===G?(d.audio_network_elapse=h,d.send_level=V):"candidate-pair"===t?(d.ice_available_incoming_bitrate=p,d.ice_available_outgoing_bitrate=_,d.ice_bytes_received=v,d.ice_bytes_sent=a,d.ice_nominated=+m,d.ice_pair_id=g,d.ice_pair_rtt=y,d.ice_pair_state=S,d.ice_pair_writable=b,d.recv_ping_requests=E,d.recv_ping_responses=k,d.sent_ping_requests_before_first_response=R,d.sent_ping_requests_total=R+(T||0),d.sent_ping_responses=I):"local-candidate"===t?(d.local_candidate_type=w,d.local_ip=C||O,d.local_network_type=N,d.local_port=x,d.protocol=D):"remote-candidate"===t&&(d.remote_candidate_type=w,d.remote_ip=C||O,d.remote_port=x)})),(h=r.audio).timestamp){e.next=16;break}return r.audio=i,e.abrupt("return",n);case 16:return void 0!==i.packetsLost&&(n.audioLossRate=(i.packetsLost-h.packetsLost)/(i.packetsSent-h.packetsSent),n.audioLossRate=Number.isNaN(n.audioLossRate)?0:n.audioLossRate,d.fraction_lost=n.audioLossRate),n.statsInterval=i.timestamp-h.timestamp,d.stats_interval=n.statsInterval,n.sendKBitrate=(i.bytesSent-h.bytesSent||0)/n.statsInterval*8,d.bitrate=Math.round(1e3*n.sendKBitrate),d.bandwidth=Math.round(d.bitrate/1024),r.audio=i,this.monitor.rtcMediaStatistics(d,{}),n._retransmittedRate=(i.retransmittedPacketsSent-h.retransmittedPacketsSent)/(i.packetsSent-h.packetsSent),n._fractionLost=Math.max(n._fractionLost,n.audioLossRate),e.abrupt("return",n);case 27:case"end":return e.stop()}}),e,this)}))),function(e,t){return r.apply(this,arguments)})},{key:"getVideoStats",value:(t=o(regeneratorRuntime.mark((function e(t,r){var n,i,o,a,s,u,c,d,l,h,f,p,_,v;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n={},i={timestamp:Date.now(),simulcast:{}},o=this._stream,a=o.streamId,s=o.videoMid,u=o.isScreen,c=o.pubAttributes,d=o.enableSimulcast,l={media_type:"video",is_screen:!!u,direction:"up",stream_id:a,vid:s,connection_status:navigator.onLine,capture_state:c.localvideo?"capture_state_on":"capture_state_off"},t&&this.handler){e.next=6;break}return e.abrupt("return",n);case 6:return n.isScreen=u,e.next=9,this.handler.getStats(t);case 9:if((h=e.sent).length){e.next=12;break}return e.abrupt("return",n);case 12:if(f=0,h.forEach((function(e){var t=e.type,r=e.framesEncoded,o=e.packetsLost,a=e.bytesSent,s=e.framesSent,u=e.roundTripTime,c=e.mimeType,h=e.frameWidth,p=e.frameHeight,_=e.packetsSent,v=e.googActualEncBitrate,m=e.googAvailableReceiveBandwidth,g=e.googAvailableSendBandwidth,y=e.googAvgEncodeMs,S=e.googBucketDelay,b=e.googEncodeUsagePercent,E=e.googFrameRateInput,k=e.availableIncomingBitrate,R=e.availableOutgoingBitrate,T=e.bytesReceived,I=e.nominated,A=e.id,w=e.currentRoundTripTime,C=e.state,O=e.writable,N=e.candidateType,x=e.ip,D=e.address,P=e.networkType,M=e.port,U=e.nackCount,L=e.pliCount,V=e.protocol,F=e.qpSum,B=e.requestsReceived,j=e.responsesReceived,G=e.googRetransmitBitrate,H=e.requestsSent,z=e.consentRequestsSent,K=e.responsesSent,W=e.ssrc,X=e.googTargetEncBitrate,q=e.googTransmitBitrate,Y=e.googRtt,J=e.retransmittedPacketsSent,Q=e.encoderImplementation,Z=e.jitter,$=e.rid,ee=e.fractionLost;"outbound-rtp"===t?(d&&($?i.simulcast[$]=e:i.simulcast[f]=e,f++),i.framesEncoded=r,i.bytesSent=a,i.framesSent=s,l.bytes=a,i.packetsSent=_,l.packetsSent=_,l.nackCount=U,l.pli_count=L,l.qp_sum=F,l.ssrc=W,l.retransmitted_packets_sent=J,i.retransmittedPacketsSent=J,l.encoder_implementation=Q):"track"===t?(n.encodedFrameWidth=h,n.encodedFrameHeight=p,l.frame_size_height=p,l.frame_size_width=h):"remote-inbound-rtp"===t?(i.packetsLost=o,n.rtt=1e3*u,l.rtt=n.rtt,l.jitter=Z,l.packetsLost=o,n._fractionLost=ee||0):"codec"===t?(n.codecType=c,l.codecName=c):"candidate-pair"===t?(l.ice_available_incoming_bitrate=k,l.ice_available_outgoing_bitrate=R,l.ice_bytes_received=T,l.ice_bytes_sent=a,l.ice_nominated=+I,l.ice_pair_id=A,l.ice_pair_rtt=w,l.ice_pair_state=C,l.ice_pair_writable=O,l.recv_ping_requests=B,l.recv_ping_responses=j,l.sent_ping_requests_before_first_response=H,l.sent_ping_requests_total=H+z,l.sent_ping_responses=K):"local-candidate"===t?(l.local_candidate_type=N,l.local_ip=x||D,l.local_network_type=P,l.local_port=M,l.protocol=V):"remote-candidate"===t?(l.remote_candidate_type=N,l.remote_ip=x||D,l.remote_port=M):"VideoBwe"===t?(l.encBitratebps=v,l.available_receive_bandwidth=m,l.available_send_bandwidth=g,l.bucket_delay=S,l.retransmitBitratebps=G,l.targetEncBitratebps=X,l.transmit_bitrate=q,n._sendBandWidth=+g):"ssrc"===t&&(l.video_network_elapse=Y,l.avg_encode_ms=y,l.encodeUsage=b,l.frame_rate_input=E,l.orignal_input_Framerate=+E)})),(p=r.video).timestamp){e.next=18;break}return r.video=i,e.abrupt("return",n);case 18:return n.statsInterval=i.timestamp-p.timestamp,l.stats_interval=n.statsInterval,_=Object.keys(i.simulcast),d?(l.sim_enc_width=[],l.sim_enc_height=[],l.sim_enc_bps=[],l.sim_enc_framerate=[],l.sim_rids=[],l.sim_enc_bandwidth=[],l.sim_sent_framerate=[],l.sim_fraction_lost=[],v=!1,_.sort((function(e,t){return+e-+t})).forEach((function(e){var t=i.simulcast[e],r=t.frameWidth,o=t.frameHeight,a=t.bytesSent,s=t.framesEncoded,u=t.framesSent,c=t.packetsLost,d=t.packetsSent,h=t.qualityLimitationReason,f=t.qualityLimitationDurations,_=t.qualityLimitationResolutionChanges,m=t.retransmittedPacketsSent;void 0!==h&&(l.sim_qualityLimitationReason||(l.sim_qualityLimitationReason=[],l.sim_qualityLimitationDurations=[],l.sim_qualityLimitationResolutionChanges=[]),l.sim_qualityLimitationReason.push(h),l.sim_qualityLimitationDurations.push(f),l.sim_qualityLimitationResolutionChanges.push(_));var g=p.simulcast[e];if(l.sim_enc_width.push(r||0),l.sim_enc_height.push(o||0),g){var y=(a-g.bytesSent||0)/n.statsInterval;l.sim_enc_bps.push(Math.round(8e3*y)),l.sim_enc_bandwidth.push(Math.round(8e3*y/1024));var S=1e3*(s-g.framesEncoded)/n.statsInterval;l.sim_enc_framerate.push(Math.round(S)),l.sim_rids.push(e);var b=void 0!==u?u-g.framesSent:s-g.framesEncoded,E=1e3*b/n.statsInterval;l.sim_sent_framerate.push(Math.round(E));var k=(c-g.packetsLost)/(d-g.packetsSent);n._retransmittedRate=(m-g.retransmittedPacketsSent)/(d-g.packetsSent),k=Number.isNaN(k)?0:k,l.sim_fraction_lost.push(k),r>0&&!v&&(n.sentKBitrate=8*y,n.encoderOutputFrameRate=S,n.encodedFrameCount=b,n.sentFrameRate=E,n.videoLossRate=k,v=!0)}})),this.monitor.rtcMediaStatistics(l,{})):(n.encodedFrameCount=void 0!==i.framesSent?i.framesSent-p.framesSent:i.framesEncoded-p.framesEncoded,n.sentKBitrate=(i.bytesSent-p.bytesSent||0)/n.statsInterval*8,l.bitrate=Math.round(1e3*n.sentKBitrate),l.bandwidth=Math.round(l.bitrate/1024),n.encoderOutputFrameRate=1e3*(i.framesEncoded-p.framesEncoded)/n.statsInterval,l.frame_rate_encoded=Math.round(n.encoderOutputFrameRate),n.sentFrameRate=1e3*n.encodedFrameCount/n.statsInterval,l.frame_rate_sent=Math.round(n.sentFrameRate),n.videoLossRate=(i.packetsLost-p.packetsLost)/(i.packetsSent-p.packetsSent),n.videoLossRate=Number.isNaN(n.videoLossRate)?0:n.videoLossRate,l.fraction_lost=n.videoLossRate,n._retransmittedRate=(i.retransmittedPacketsSent-p.retransmittedPacketsSent)/(i.packetsSent-p.packetsSent),this.monitor.rtcMediaStatistics(l,{})),r.video=i,n._fractionLost=Math.max(n._fractionLost,n.videoLossRate),e.abrupt("return",n);case 25:case"end":return e.stop()}}),e,this)}))),function(e,r){return t.apply(this,arguments)})}]),i}(zj),Wj=function(e){d(s,e);var t,r,n,i=v(s);function s(e){var t;return a(this,s),c(p(t=i.call(this,e)),"_audioStallCount",void 0),c(p(t),"_setAudioStallCount",void 0),c(p(t),"_audioStallTimer",void 0),c(p(t),"_audioStallInterval",void 0),c(p(t),"_audioStallRatio",void 0),c(p(t),"_videoInWaiting",void 0),t._videoInWaiting=!1,t}return u(s,[{key:"setRemoteStreamStatsEvtInterval",value:(n=o(regeneratorRuntime.mark((function e(t,r,n){var i,a,u,c,d,l,h,f,p,_,v,m,g,y=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this._timer){e.next=2;break}return e.abrupt("return");case 2:return this.setVar(t,r,n),t.once(SF.ABNORMAL_DISCONNECTION,(function(){y.destroy()})),this._audioStallInterval=s.audioStallInterval||100,this._audioStallRatio=s.audioStallRatio||.6,u={audio:{},video:{}},c=this._stream,d=null===(i=c.audioTrack)||void 0===i?void 0:i.getTrack(),l=null===(a=c.videoTrack)||void 0===a?void 0:a.getTrack(),this.getRemoteVideoStats(l,u),e.next=13,this.getRemoteAudioStats(d,u);case 13:this.delStatsEvtInterval(),h=0,f=0,_=[],v=0,this._setAudioStallCount=function(){if(y._audioStallInterval>0&&void 0!==u.audio.concealedSamples){var e=u.audio.concealedSamples,t=u.audio.totalSamplesReceived,r=EP(),n={isStall:!1,counted:!1,diff:0},i=.5*y._audioStallInterval;y._audioStallCount=o(regeneratorRuntime.mark((function o(){var a,s,u,d,l,p,m,g,S,b,E,k,R,T,I;return regeneratorRuntime.wrap((function(o){for(;;)switch(o.prev=o.next){case 0:if(s=c.hasAudio,u=c.subAudio,s&&u){o.next=6;break}return n.isStall=!1,n.counted=!1,_.push({reason:"hasAudio: ".concat(s,", subAudio: ").concat(u)}),o.abrupt("return",{stall_count:h,stall_duration:f,stall_list:_,stats_count:v});case 6:return d=null===(a=c.audioTrack)||void 0===a?void 0:a.getTrack(),l=Date.now(),o.next=10,y.handler.getStats(d,!0);case 10:if(p=o.sent,m=Date.now(),g=EP(),!((S=g-r)<i)){o.next=17;break}return _.push({diff:S,start:r,end:g,get_stats_cost:m-l,get_stats_start:l,get_stats_end:m,reason:"diff(".concat(S,") < minInterval(").concat(i,")")}),o.abrupt("return",{stall_count:h,stall_duration:f,stall_list:_,stats_count:v});case 17:if(b=p.length,E=p.find((function(e){return"inbound-rtp"===e.type}))){o.next=22;break}return _.push({diff:S,start:r,end:g,get_stats_cost:m-l,get_stats_start:l,get_stats_end:m,reason:b?"no inbound-rtp":"no report"}),o.abrupt("return",{stall_count:h,stall_duration:f,stall_list:_,stats_count:v});case 22:return k=E.concealedSamples,R=E.totalSamplesReceived,I=R-t,(T=k-e)>=0&&I>=0&&T>=y._audioStallRatio*I?(_.push({concealed:T,received:I,diff:S,start:r,end:g,get_stats_cost:m-l,get_stats_start:l,get_stats_end:m,is_stall:!0}),n.isStall?(n.counted?f+=S:(f=f+n.diff+S,h++),n.counted=!0):S>=200?(f+=S,h++,n.counted=!0):(n.counted=!1,n.diff=S),n.isStall=!0):(_.push({concealed:T,received:I,diff:S,start:r,end:g,get_stats_cost:m-l,get_stats_start:l,get_stats_end:m}),n.isStall=!1,n.counted=!1),e=k,t=R,r=g,v++,o.abrupt("return",{stall_count:h,stall_duration:f,stall_list:_,stats_count:v});case 31:case"end":return o.stop()}}),o)}))),p=function(){var e=o(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!y._audioStallCount&&y._setAudioStallCount&&y._setAudioStallCount(),!y._audioStallCount){e.next=5;break}return e.next=4,y._audioStallCount();case 4:y._audioStallTimer=setTimeout(p,y._audioStallInterval);case 5:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),y._audioStallTimer=setTimeout(p,y._audioStallInterval)}},this._setAudioStallCount(),m=function(){var e=o(regeneratorRuntime.mark((function e(){var t,r,n,i,o,a;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=null===(t=c.audioTrack)||void 0===t?void 0:t.getTrack(),i=null===(r=c.videoTrack)||void 0===r?void 0:r.getTrack(),e.next=4,y.getRemoteAudioStats(n,u);case 4:return o=e.sent,h=0,f=0,_=[],v=0,e.next=11,y.getRemoteVideoStats(i,u);case 11:return a=e.sent,e.abrupt("return",{audioStats:o,videoStats:a,isScreen:c.isScreen,userId:c.userId});case 13:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),g=function(){var e=o(regeneratorRuntime.mark((function e(){var t,r;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,m();case 2:r=e.sent,null===(t=y.client)||void 0===t||t.emit("onRemoteStreamStats",r),p&&(y._audioStallTimer=setTimeout(p,y._audioStallInterval)),y._timer=setTimeout(g,2e3);case 6:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),this._timer=setTimeout(g,2e3);case 23:case"end":return e.stop()}}),e,this)}))),function(e,t,r){return n.apply(this,arguments)})},{key:"delStatsEvtInterval",value:function(){g(l(s.prototype),"delStatsEvtInterval",this).call(this),clearTimeout(this._audioStallTimer),this._audioStallCount=void 0,this._setAudioStallCount=void 0}},{key:"unsubscribe",value:function(){this.delStatsEvtInterval(),this._videoInWaiting=!1}},{key:"getRemoteAudioStats",value:(r=o(regeneratorRuntime.mark((function e(t,r){var n,i,o,a,s,u,c,d,l,h,f,p,_,v,m,g,y,S;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n={},i={},o=this._stream,a=o.streamId,s=o.userId,u=o.isScreen,c=o.audioMid,d=o.subMediaType,l=o._attributes,h={media_type:"audio",is_screen:!!u,direction:"down",stream_id:a,stream_user_id:s,vid:c,connection_status:navigator.onLine,mute_state:MP(d)?"mute_state_off":"mute_state_on",remote_user_capture_state:l.localaudio?"capture_state_on":"capture_state_off",remote_user_mute_state:l.localaudio&&l.audiostream?"mute_state_off":"mute_state_on"},t&&this.handler){e.next=6;break}return e.abrupt("return",n);case 6:return e.next=8,this.handler.getStats(t);case 8:if((f=e.sent).length){e.next=11;break}return e.abrupt("return",n);case 11:if(f.forEach((function(e){var t=e.type,r=e.packetsLost,o=e.packetsReceived,a=e.bytesReceived,s=e.jitterBufferDelay,u=e.jitterBufferEmittedCount,c=e.clockRate,d=e.channels,l=e.totalSamplesReceived,f=e.concealedSamples,p=e.silentConcealedSamples,_=e.concealmentEvents,v=e.totalRoundTripTime,m=e.state,g=e.currentRoundTripTime,y=e.audioLevel,S=e.totalAudioEnergy,b=e.totalSamplesDuration,E=e.mimeType,k=e.googDecodingNormal,R=e.fecPacketsReceived,T=e.availableIncomingBitrate,I=e.availableOutgoingBitrate,A=e.bytesSent,w=e.nominated,C=e.id,O=e.writable,N=e.jitter,x=e.candidateType,D=e.ip,P=e.address,M=e.networkType,U=e.port,L=e.protocol,V=e.audioOutputLevel,F=e.requestsReceived,B=e.responsesReceived,j=e.requestsSent,G=e.consentRequestsSent,H=e.responsesSent,z=e.ssrc,K=e.kind;"inbound-rtp"===t?(i.packetsLost=r,i.packetsReceived=o,h.packetsReceived=o,i.bytesReceived=a,h.bytes=a,void 0!==s&&(n.jitterBufferDelay=s/u*1e3,h.average_jitter_buffer_delay_ms=n.jitterBufferDelay),void 0!==l&&(i.totalSamplesReceived=l,n.concealedSamples=f,i.concealedSamples=f,i.silentConcealedSamples=p,h.concealedSamples=f,n.concealmentEvents=_,h.totalSamplesReceived=l),void 0!==R&&(h.fec_packets_received=R),h.jitter=1e3*N,h.ssrc=z):"codec"===t?(n.recordSampleRate=c,d&&(n.numChannels=d),h.codecName=E):"candidate-pair"===t?(h.ice_available_incoming_bitrate=T,h.ice_available_outgoing_bitrate=I,h.ice_bytes_received=a,h.ice_bytes_sent=A,h.ice_nominated=+w,h.ice_pair_id=C,h.ice_pair_rtt=g,h.rtt=1e3*g,h.ice_pair_state=m,h.ice_pair_writable=O,h.recv_ping_requests=F,h.recv_ping_responses=B,h.sent_ping_requests_before_first_response=j,h.sent_ping_requests_total=j+(G||0),h.sent_ping_responses=H,"succeeded"===m&&(n.rtt=1e3*g,n.total_rtt=1e3*v)):"track"===t&&"audio"===K?(h.audio_level=y?-10*Math.log10(Math.pow(y,2)):y,h.volume=255*y,h.total_audio_energy=S,h.totalAudioDuration=b):"ssrc"===t?(h.decodingNormal=k,h.recvAudioLevel=V):"local-candidate"===t?(h.local_candidate_type=x,h.local_ip=D||P,h.local_network_type=M,h.local_port=U,h.protocol=L):"remote-candidate"===t&&(h.remote_candidate_type=x,h.remote_ip=D||P,h.remote_port=U)})),(p=r.audio).timestamp){e.next=17;break}return i.timestamp=Date.now(),r.audio=i,e.abrupt("return",n);case 17:if(_={},void 0!==i.concealedSamples&&(h.interval_concealed_samples=i.concealedSamples-p.concealedSamples,h.interval_samples_received=i.totalSamplesReceived-p.totalSamplesReceived,h.interval_silent_concealed_samples=i.silentConcealedSamples-p.silentConcealedSamples),!(this._audioStallInterval>0&&void 0!==p.concealedSamples)){e.next=35;break}if(!this._audioStallCount&&this._setAudioStallCount&&this._setAudioStallCount(),clearTimeout(this._audioStallTimer),!this._audioStallCount){e.next=35;break}return e.next=25,this._audioStallCount();case 25:v=e.sent,m=v.stall_count,g=v.stall_duration,y=v.stall_list,S=v.stats_count,_.stall_list=y,_.stats_count=S,h.concealedSamples===h.interval_concealed_samples&&h.totalSamplesReceived===h.interval_samples_received?(h.stall_count=0,h.stall_duration=0):(h.stall_count=m,h.stall_duration=g),n.stallCount=h.stall_count,n.stallDuration=h.stall_duration;case 35:return i.timestamp=Date.now(),n.audioLossRate=(i.packetsLost-p.packetsLost)/(i.packetsReceived-p.packetsReceived+(i.packetsLost-p.packetsLost)),n.audioLossRate=Number.isNaN(n.audioLossRate)?0:n.audioLossRate,h.packetsLost=Math.round(i.packetsLost-p.packetsLost),h.fraction_lost=n.audioLossRate,h.packets_lost_rate=n.audioLossRate,n.statsInterval=i.timestamp-p.timestamp,h.stats_interval=n.statsInterval,n.receivedKBitrate=(i.bytesReceived-p.bytesReceived||0)/n.statsInterval*8,h.bitrate=Math.round(1e3*n.receivedKBitrate),h.bandwidth=Math.round(h.bitrate/1024),void 0!==i.concealedSamples&&(n.receivedSampleRate=1e3*h.interval_samples_received/n.statsInterval),r.audio=i,this.monitor.rtcMediaStatistics(h,{},_),e.abrupt("return",n);case 50:case"end":return e.stop()}}),e,this)}))),function(e,t){return r.apply(this,arguments)})},{key:"getRemoteVideoStats",value:(t=o(regeneratorRuntime.mark((function e(t,r){var n,i,o,a,s,u,c,d,l,h,f;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n={},i={timestamp:Date.now()},o=this._stream,a=o.streamId,s=o.userId,u=o.isScreen,c=o.subMediaType,d=o._attributes,l={media_type:"video",is_screen:!!u,direction:"down",stream_id:a,stream_user_id:s,vid:this._stream.videoMid,connection_status:navigator.onLine,mute_state:UP(c)?"mute_state_off":"mute_state_on",remote_user_capture_state:d.localvideo?"capture_state_on":"capture_state_off",remote_user_mute_state:d.localvideo&&d.videostream?"mute_state_off":"mute_state_on"},t&&this.handler){e.next=6;break}return e.abrupt("return",n);case 6:return n.isScreen=u,e.next=9,this.handler.getStats(t);case 9:if((h=e.sent).length){e.next=12;break}return e.abrupt("return",n);case 12:if(h.forEach((function(e){var t=e.type,r=e.frameHeight,o=e.frameWidth,a=e.packetsLost,s=e.packetsReceived,u=e.bytesReceived,c=e.framesDecoded,d=e.jitterBufferDelay,h=e.jitterBufferEmittedCount,f=e.mimeType,p=e.firCount,_=e.availableIncomingBitrate,v=e.availableOutgoingBitrate,m=e.bytesSent,g=e.nominated,y=e.id,S=e.currentRoundTripTime,b=e.state,E=e.writable,k=e.candidateType,R=e.ip,T=e.address,I=e.networkType,A=e.port,w=e.nackCount,C=e.pliCount,O=e.protocol,N=e.requestsReceived,x=e.responsesReceived,D=e.requestsSent,P=e.consentRequestsSent,M=e.responsesSent,U=e.ssrc;e.kind;var L=e.jitter,V=e.framesReceived,F=e.keyFramesDecoded,B=e.totalDecodeTime,j=e.decoderImplementation,G=e.lastPacketReceivedTimestamp;"inbound-rtp"===t?(i.packetsLost=a,l.packetsLost=a,i.packetsReceived=s,l.packetsReceived=s,i.bytesReceived=u,l.bytes=u,i.framesDecoded=c,void 0!==d&&(i.jitterBufferDelay=d/h*1e3,l.average_jitter_buffer_delay_ms=i.jitterBufferDelay),l.fir_count=p,l.nackCount=w,i.nackCount=w,l.pli_count=C,l.ssrc=U,l.jitter=L,l.framesReceived=V,i.framesReceived=V,l.framesDecoded=c,l.key_frames_decoded=F,l.total_decode_time=B,l.decoder_name=j,l.last_packet_received_timestamp=G):"track"===t&&void 0!==o?(n.width=o,l.frame_size_width=o,n.height=r,l.frame_size_height=r,void 0!==V&&(l.framesReceived=V,i.framesReceived=V)):"codec"===t?l.codecName=f:"candidate-pair"===t?(l.ice_available_incoming_bitrate=_,l.ice_available_outgoing_bitrate=v,l.ice_bytes_received=u,l.ice_bytes_sent=m,l.ice_nominated=+g,l.ice_pair_id=y,l.ice_pair_rtt=S,l.rtt=1e3*S,n.rtt=l.rtt,l.ice_pair_state=b,l.ice_pair_writable=E,l.recv_ping_requests=N,l.recv_ping_responses=x,l.sent_ping_requests_before_first_response=D,l.sent_ping_requests_total=D+(P||0),l.sent_ping_responses=M):"local-candidate"===t?(l.local_candidate_type=k,l.local_ip=R||T,l.local_network_type=I,l.local_port=A,l.protocol=O):"remote-candidate"===t&&(l.remote_candidate_type=k,l.remote_ip=R||T,l.remote_port=A)})),(f=r.video).timestamp){e.next=17;break}return r.video=i,e.abrupt("return",n);case 17:return n.videoLossRate=(i.packetsLost-f.packetsLost)/(i.packetsReceived-f.packetsReceived+(i.packetsLost-f.packetsLost)),n._retransmittedRate=(i.nackCount-f.nackCount)/(i.packetsReceived-f.packetsReceived+(i.packetsLost-f.packetsLost)),n.videoLossRate=Number.isNaN(n.videoLossRate)?0:n.videoLossRate,l.fraction_lost=n.videoLossRate,l.packets_lost_rate=n.videoLossRate,n.statsInterval=i.timestamp-f.timestamp,l.stats_interval=n.statsInterval,n.receivedKBitrate=(i.bytesReceived-f.bytesReceived||0)/n.statsInterval*8,l.bitrate=Math.round(1e3*n.receivedKBitrate),l.bandwidth=Math.round(l.bitrate/1024),n.decoderOutputFrameRate=1e3*(i.framesDecoded-f.framesDecoded)/n.statsInterval,n.receivedFrameRate=1e3*(i.framesReceived-f.framesReceived)/n.statsInterval,l.frame_rate_decoded=Math.round(n.decoderOutputFrameRate),l.frame_rate_received=l.frame_rate_decoded,r.video=i,this.processStall(this._stream,l,n,u),this.monitor.rtcMediaStatistics(l,{}),e.abrupt("return",n);case 35:case"end":return e.stop()}}),e,this)}))),function(e,r){return t.apply(this,arguments)})},{key:"processStall",value:function(e,t,r,n){var i=0,o=0,a=0;if(e.recordedVideoFrames){e.recordedVideoFrames.forEach((function(e){e.isStall&&(i+=e.stallCount,o+=e.stallDuration),a=e.playTime})),e.recordedVideoFrames.length||(o=2e3,i=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=i,n?(t.stuck_length=o,t.stall_duration=void 0):(t.stall_duration=o,t.stuck_length=void 0),t.play_time=a,r.stallCount=i,r.stallDuration=o}},{key:"destroy",value:function(){g(l(s.prototype),"destroy",this).call(this),this.delStatsEvtInterval(),this._videoInWaiting=!1}}],[{key:"audioStallConfig",set:function(e){s.audioStallInterval=((null==e?void 0:e.audio_stall_interval)||200)/2,s.audioStallRatio=null==e?void 0:e.audio_stall_ratio}}]),s}(zj);c(Wj,"audioStallInterval",void 0),c(Wj,"audioStallRatio",void 0);var Xj,qj,Yj,Jj=function(e){return 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",e.ON_VIDEO_STREAM_BANNED="ON_VIDEO_STREAM_BANNED",e.ON_AUDIO_STREAM_BANNED="ON_AUDIO_STREAM_BANNED",e}(Jj||{}),Qj=function(e){return 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",e}(Qj||{}),Zj=function(e){return e[e.PUB=0]="PUB",e[e.UNPUB=1]="UNPUB",e}(Zj||{}),$j=function(e){return e[e.SUB=0]="SUB",e[e.UNSUB=1]="UNSUB",e}($j||{}),eG=new uM("Stream",0),tG=function(e){return e[e.INIT=0]="INIT",e[e.SUB_ING=1]="SUB_ING",e[e.SUB_ED=2]="SUB_ED",e}(tG||{}),rG=function(){function e(){a(this,e),c(this,"isScreen",!1),c(this,"stream",void 0),c(this,"streamId",void 0),c(this,"audioMid",void 0),c(this,"videoMid",void 0),c(this,"seiList",[]),c(this,"videoTrack",void 0),c(this,"audioTrack",void 0),c(this,"videoTransceiver",void 0),c(this,"audioTransceiver",void 0),c(this,"videoInputConfig",void 0),c(this,"videoEncodeConfig",[pF]),c(this,"subVideoDescriptions",[]),c(this,"enableSimulcast",!1),c(this,"observer",void 0),c(this,"statsReport",void 0),c(this,"prevScaleResolutionDownBy",1),c(this,"pubAudio",!1),c(this,"pubVideo",!1),c(this,"pubAttributes",void 0),this.stream=new MediaStream,this.videoInputConfig={width:640,height:360,frameRate:30},this.pubAttributes={localaudio:!1,localvideo:!1,videostream:!1,audiostream:!1,extvideo:!1,extaudio:!1},this.statsReport=new Kj(this)}return u(e,[{key:"hasPublished",get:function(){return this.videoTransceiver&&this.audioTransceiver}},{key:"isEmptyStream",get:function(){return!this.audioTrack&&!this.videoTrack}},{key:"initStreamId",get:function(){return this.stream.id}},{key:"initVideoEncodedTransform",value:function(){var e=this;if(this.videoTransceiver&&this.videoTransceiver.sender){var t=this.videoTransceiver.sender;if(QF()){var r=t.createEncodedStreams(),n=r.readable,i=r.writable,o=new TransformStream({transform:function(t,r){var n=e.seiList[0];if(n){var i=Hj.generateSEI(n.content),o=new Uint8Array(i.byteLength+t.data.byteLength);0===n.repeatCount&&e.seiList.splice(0,1),n.repeatCount--,o.set(new Uint8Array(t.data)),o.set(i,t.data.byteLength),t.data=o.buffer,r.enqueue(t)}else r.enqueue(t)}});n.pipeThrough(o).pipeTo(i)}}else eG.print("no sender found when trying to bind encodedTransform")}},{key:"initAudioEncodedTransform",value: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 eG.print("no sender found when trying to bind encodedTransform")}},{key:"clean",value: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=[]}},{key:"switchTrackEnableState",value:function(e,t){var r,n;"audio"===e?n=this.audioTrack:"video"===e&&(n=this.videoTrack);var i=null===(r=n)||void 0===r?void 0:r.getTrack();return!(!i||(null==i?void 0:i.enabled)===t)&&(i.enabled=t,!0)}}]),e}(),nG=function(e){d(r,e);var t=v(r);function r(e,n,i,o){var s,u=arguments.length>4&&void 0!==arguments[4]?arguments[4]:H.LOW;return a(this,r),c(p(s=t.call(this)),"streamId",void 0),c(p(s),"userId",void 0),c(p(s),"isScreen",void 0),c(p(s),"hasVideo",void 0),c(p(s),"hasAudio",void 0),c(p(s),"_attributes",void 0),c(p(s),"streamState",void 0),c(p(s),"observer",void 0),c(p(s),"statsReport",void 0),c(p(s),"subVideo",void 0),c(p(s),"subAudio",void 0),c(p(s),"subMediaType",void 0),c(p(s),"subLayer",void 0),c(p(s),"audioMid",void 0),c(p(s),"videoMid",void 0),c(p(s),"_sequenceId",void 0),c(p(s),"stream",void 0),c(p(s),"videoTrack",void 0),c(p(s),"audioTrack",void 0),c(p(s),"videoTransceiver",void 0),c(p(s),"audioTransceiver",void 0),c(p(s),"recordedVideoFrames",void 0),c(p(s),"stillExist",void 0),c(p(s),"_workaround_1_",void 0),c(p(s),"paused",void 0),c(p(s),"originalMediaType",void 0),c(p(s),"originalStreamIndex",0),s.userPriority=u,s.userId=e,s.isScreen=i,s.streamId=n,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=Pj.NONE,s.subLayer={spatialLayer:0,spatialSubLayer:-1},s.streamState=0,s.statsReport=new Wj(p(s)),s}return u(r,[{key:"sequenceId",get:function(){return this._sequenceId||-1},set:function(e){"number"==typeof e&&(this._sequenceId=e)}},{key:"hasSubscribed",get:function(){return 2===this.streamState}},{key:"attributes",get:function(){return this._attributes},set:function(e){this.hasVideo=e.localvideo&&e.videostream,this.hasAudio=e.localaudio&&e.audiostream,this._attributes=e}},{key:"initVideoEncodedTransform",value:function(){var e=this;if(this.videoTransceiver&&this.videoTransceiver.receiver){var t=this.videoTransceiver.receiver.createEncodedStreams(),r=t.readable,n=t.writable;r.pipeThrough(new TransformStream({transform:function(t,r){var n=Mj.getNalunits(new Uj(t.data)).find((function(e){return e.sei}));if(n){var i=Hj.decodeSeiBody(n.body);i&&i.type!==Lj.internal&&e.safeEmit("onSEIMessage",i.payload)}r.enqueue(t)}})).pipeTo(n)}else eG.print("no receiver found when trying to bind encodedTransform")}},{key:"initAudioEncodedTransform",value: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 eG.print("no receiver found when trying to bind encodedTransform")}},{key:"ontrack",value:function(e){var t,r;if((null===(t=e.streams)||void 0===t||null===(r=t[0])||void 0===r?void 0:r.id)===this.streamId){var n,i=e.track;"video"===(null==i?void 0:i.kind)?this._setVideoTrack(i):"audio"===(null===(n=e.track)||void 0===n?void 0:n.kind)&&this._setAudioTrack(i),this._setStream(e.streams[0])}this.safeEmit("ontrack",e)}},{key:"clean",value:function(){var e;eG.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()}},{key:"resetHasSubscribed",value:function(){this.streamState=0}},{key:"setRemoteUserPriority",value:function(e){this.userPriority=e}},{key:"getStreamPriority",value: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}},{key:"getSubscribeFallbackParams",value:function(e){if(e!==G.DISABLE&&this.subVideo){if(this.attributes.videoDescriptions.length-1>this.subLayer.spatialLayer)return[this.originalMediaType,$j.SUB,this._getSubLayerBySpatialLayer(this.subLayer.spatialLayer+1)];if(e===G.AUDIO_ONLY)return[P.VIDEO,$j.UNSUB]}return null}},{key:"getSubscribeRecoverParams",value:function(){if(this.originalMediaType&&UP(this.originalMediaType)){if(!1===this.subVideo)return[this.originalMediaType,$j.SUB,this.subLayer];if("number"==typeof this.originalStreamIndex&&this.subLayer.spatialLayer>this.originalStreamIndex)return[this.originalMediaType,$j.SUB,this._getSubLayerBySpatialLayer(this.subLayer.spatialLayer-1)]}return null}},{key:"_setStream",value: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)}}},{key:"_setAudioTrack",value:function(e){var t,r;(null===(t=this.audioTrack)||void 0===t||null===(r=t.getTrack())||void 0===r?void 0:r.id)!==(null==e?void 0:e.id)&&(this.audioTrack=new bj(e,bP()),this.emit("ontrack",this.audioTrack))}},{key:"_setVideoTrack",value:function(e){var t,r;(null===(t=this.videoTrack)||void 0===t||null===(r=t.getTrack())||void 0===r?void 0:r.id)!==(null==e?void 0:e.id)&&(this.videoTrack=new Sj(e,bP()),this.emit("ontrack",this.videoTrack))}},{key:"_getSubLayerBySpatialLayer",value:function(e){var t=this._attributes,r=t.videoDescriptions,n=t.subVideoDescriptions,i=void 0===n?[]:n,o=r[e],a=o.width,s=o.height,u=i.find((function(e){return e.width===a&&e.height===s}));return{spatialLayer:e,spatialSubLayer:(null==u?void 0:u.sub_index)||-1}}}]),r}(dM),iG=new uM("queue",4),oG=function(e){return e[e.ADD=0]="ADD",e[e.CLOSE=1]="CLOSE",e}(oG||{}),aG=function(e){return e.publish="publish",e.unpublish="unpublish",e.subscribe="subscribe",e.unsubscribe="unsubscribe",e.pushtrack="pushtrack",e.removetrack="removetrack",e}(aG||{}),sG=(c(Xj={},"publish","unpublish"),c(Xj,"unpublish","publish"),c(Xj,"subscribe","unsubscribe"),c(Xj,"unsubscribe","subscribe"),c(Xj,"pushtrack","removetrack"),c(Xj,"removetrack","pushtrack"),Xj),uG=(c(qj={},"publish",0),c(qj,"subscribe",0),c(qj,"pushtrack",0),c(qj,"unpublish",1),c(qj,"unsubscribe",1),c(qj,"removetrack",1),qj),cG=function(e){d(r,e);var t=v(r);function r(){var e;return a(this,r),c(p(e=t.call(this)),"_queue",void 0),e._queue=[],e}return u(r,[{key:"queue",get:function(){return this._queue}},{key:"enqueue",value:function(e){var t=this._queue.length,r="";return this._queue=this._queue.filter((function(t){return t.streamId!==e.streamId||e.action!==sG[t.action]||(r=t.streamId,iG.print("offsetStreamId",r),!1)})),this._queue.length===t&&this._queue.push(e),1===this._queue.length&&this.emit("start"),r}},{key:"dequeue",value:function(){if(!this._queue.length)return null;for(var e=uG[this._queue[0].action],t=1;t<this._queue.length;t++)if(uG[this._queue[t].action]!==e)return{sdpStrategy:e,items:this._queue.splice(0,t)};return{sdpStrategy:e,items:this._queue.splice(0,this._queue.length)}}}]),r}(iM),dG=new uM("ChromeHandler",3),lG=QF(),hG=function(e){d(b,e);var t,n,i,s,h,f,_,m,S=v(b);function b(e,t){var r;return a(this,b),c(p(r=S.call(this,e,t)),"name","chrome"),c(p(r),"_queueBusy",!1),c(p(r),"_sdpQueue",void 0),c(p(r),"_aSendonlyOfferTpl",void 0),c(p(r),"_vSendonlyOfferTpl",void 0),c(p(r),"_aRecvonlyOfferTpl",void 0),c(p(r),"_vRecvonlyOfferTpl",void 0),c(p(r),"_mid",0),c(p(r),"_offerSession",void 0),c(p(r),"_answerSession",void 0),c(p(r),"_offerMlines",[]),c(p(r),"_answerMlines",[]),c(p(r),"_inactiveMlineIndex",[]),c(p(r),"_msidIndexMap",{}),c(p(r),"_mlinesCache",{}),r._sdpQueue=new cG,r._sdpQueue.on("start",(function(){r._queueBusy||"stable"!==r._peerConnection.signalingState||(dG.print("dequeue start"),r.dequeue())})),r}return u(b,[{key:"connect",value:(m=o(regeneratorRuntime.mark((function e(t){var n,i,o,a,s,u,c,d=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return dG.print("connect","invoke connect"),this._offerIce={iceUfrag:null===(n=t.iceParams)||void 0===n?void 0:n.clientIceUfrag,icePwd:null===(i=t.iceParams)||void 0===i?void 0:i.clientIcePwd,iceOptions:"renomination"},e.next=4,SB(t);case 4:return this._answerIce=e.sent,e.next=7,this._peerConnection.createOffer();case 7:return o=e.sent,a=rB.parse(o.sdp),s=y(a.media,1),u=s[0],this._offerIce.fingerprint=a.fingerprint||u.fingerprint,delete a.media,this._offerSession=r({},a),this._answerSession=r({},a),this._answerSession.fingerprint&&(this._answerSession.fingerprint=this._answerIce.fingerprint),c=this._mid++,this._offerMlines=[r(r(r({},u),this._offerIce),{},{mid:"".concat(c)})],this._answerMlines=[r(r(r({},u),this._answerIce),{},{sctpmap:{sctpmapNumber:5e3,app:"webrtc-datachannel",maxMessageSize:262144},mid:"".concat(c)})],this.setDescription(),e.next=21,new Promise((function(e,t){d._dataChannel.onopen=function(){dG.print("connect","dataChannel open"),XV("es.dc.open",""),e("")},d._dataChannel.onerror=function(e){VV.rtcSignalingMsgError(e.error.sdpLineNumber,e.error.errorDetail,fV.INVALID_DATA),XV("es.dc.error",""),t(e)},d._dataChannel.onclose=function(e){XV("es.dc.close",""),t(e)},d._peerConnection.addEventListener("connectionstatechange",(function(e){"failed"!==d._peerConnection.iceConnectionState&&"closed"!==d._peerConnection.iceConnectionState&&"failed"!==d._peerConnection.connectionState||t(e)}))}));case 21:return dG.print("connect","dataChannel establish success"),e.abrupt("return",this._dataChannel);case 23:case"end":return e.stop()}}),e,this)}))),function(e){return m.apply(this,arguments)})},{key:"disconnect",value:function(){this._peerConnection.close(),this._dataChannel.close(),this._peerConnection.ontrack=null}},{key:"destroy",value:function(){g(l(b.prototype),"destroy",this).call(this),this._mlinesCache={}}},{key:"publish",value:(_=o(regeneratorRuntime.mark((function e(t,n){var i,o,a,s,u,c,d,h,f,p,_,v,m,S,E,k,R,T,I,A;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=t.stream,o=t.enableSimulcast,a=g(l(b.prototype),"internalPublish",this).call(this,t,n),s=a.videoDescriptions,u=a.subVideoDescriptions,c=a.transceiverInit,d="".concat(this._mid++),h="".concat(this._mid++),f=r(r(r({},this._aSendonlyOfferTpl),this._offerIce),{},{mid:d,msid:"".concat(i.id," ").concat(i.id,"-audio"),ssrcs:vB(i,"audio")}),p=r(r(r({},this._vSendonlyOfferTpl),this._offerIce),{},{mid:h,msid:"".concat(i.id," ").concat(i.id,"-video")}),o?(dG.print("subVideoDesc","desc: %o ",u),delete p.ssrcGroups,delete p.ssrcs,_=[],p.rids=s.map((function(e){var t=e.rid;return _.unshift(t),{id:t,direction:"send"}})),p.simulcast={dir1:"send",list1:_.join(";")}):(v=mB(i,"video"),m=v.ssrcs,S=v.ssrcGroups,p.ssrcs=m,p.ssrcGroups=S),null!=n&&n.audioRed&&Array.isArray(f.rtp)&&-1!==(E=f.rtp.findIndex((function(e){return"red"===e.codec})))&&(k=f.rtp.splice(E,1),R=y(k,1),T=R[0],f.rtp.unshift(T)),(I=null==f?void 0:f.rtp.find((function(e){return"opus"===e.codec})))&&f.fmtp&&(A=f.fmtp.find((function(e){return e.payload===I.payload})))&&this._context&&(A.config+=this._context.audioProfileManager.getOpusConfigStr()),this._mlinesCache[t.stream.id]=[f,p],e.abrupt("return",{partialSdp:yB(this._offerSession,f,p),audioMid:d,videoMid:h,type:"incroffer",semantics:"unified-plan",videoDescriptions:s,subVideoDescriptions:u,transceiverInit:c});case 12:case"end":return e.stop()}}),e,this)}))),function(e,t){return _.apply(this,arguments)})},{key:"subscribe",value:(f=o(regeneratorRuntime.mark((function e(t,n){var i,o,a,s,u,c,d,l,h,f;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(dG.print("subscribe","mids: ",n),i="incroffer",o="unified-plan",this._aRecvonlyOfferTpl&&this._vRecvonlyOfferTpl){e.next=11;break}return e.next=6,xP(!0);case 6:if(a=e.sent){e.next=9;break}throw new cD(sD.NOT_SUPPORTED,"Get offer Error");case 9:return e.next=11,this.createAVMlineOfferTpl(a);case 11:if(!this._mlinesCache[t.streamId]){e.next=14;break}return s=y(this._mlinesCache[t.streamId],2),u=s[0],c=s[1],e.abrupt("return",{partialSdp:yB(this._offerSession,u,c),audioMid:u.mid,videoMid:c.mid,type:i,semantics:o});case 14:return d="".concat(this._mid++),l="".concat(this._mid++),h=r(r(r({},this._aRecvonlyOfferTpl),this._offerIce),{},{mid:d}),f=r(r(r({},this._vRecvonlyOfferTpl),this._offerIce),{},{mid:l}),this._mlinesCache[t.streamId]=[h,f],e.abrupt("return",{partialSdp:yB(this._offerSession,h,f),audioMid:d,videoMid:l,type:i,semantics:o,transceiverInit:{aTrack:"audio",vTrack:"video",audioTransceiverInit:{direction:"recvonly"},videoTransceiverInit:{direction:"recvonly"}}});case 20:case"end":return e.stop()}}),e,this)}))),function(e,t){return f.apply(this,arguments)})},{key:"handleAck",value:(h=o(regeneratorRuntime.mark((function e(t){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return dG.print("handleAck()","item: %o",t),e.abrupt("return",this._sdpQueue.enqueue(t));case 2:case"end":return e.stop()}}),e,this)}))),function(e){return h.apply(this,arguments)})},{key:"dequeue",value:(s=o(regeneratorRuntime.mark((function e(){var t,n,i,a,s,u,c,d=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._queueBusy=!0,t=this._sdpQueue.dequeue(),dG.print("dequeue()","ret: %o",t),t){e.next=6;break}return this._queueBusy=!1,e.abrupt("return");case 6:return n=t.items,i=t.sdpStrategy,a=[],s=[],i===oG.ADD?(delete(u=r({},this._answerIce)).candidates,n.forEach(function(){var e=o(regeneratorRuntime.mark((function e(t){var n,i,o,c,l,h,f,p,_,v,m,g,S,b,E,k,R,T,I,A,w;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=t.action,i=t.transceiverInit,o=t.signalingAck,c=t.stream,!((l=c instanceof nG)&&(null==o?void 0:o.sequenceId)<c.sequenceId)){e.next=4;break}return e.abrupt("return");case 4:if(h={},f={},p=rB.parse(o.sdp),Array.isArray(p.media)&&(_="",p.media.sort((function(e,t){var r;return null==e||null===(r=e.type)||void 0===r?void 0:r.localeCompare(null==t?void 0:t.type)})).forEach((function(e){"audio"===(e=r(r({},e),u)).type?(h=e,dG.print("audioMsid",e.msid),e.msid&&(_=e.msid.replace("audio","video"))):(f=e,dG.print("videoMsid",_),_&&(f.msid=_,_=""))}))),v=c.streamId,n===aG.publish&&(v=null===(m=c.stream)||void 0===m?void 0:m.id),g=y(d._mlinesCache[v],2),S=g[0],b=g[1],!i){e.next=28;break}c.audioTransceiver=d._peerConnection.addTransceiver(i.aTrack,i.audioTransceiverInit),c.videoTransceiver=d._peerConnection.addTransceiver(i.vTrack,i.videoTransceiverInit),(E=d._inactiveMlineIndex.shift())||(E=d._offerMlines.length),d._offerMlines[E]=r(r({},S),{},{mid:h.mid}),d._answerMlines[E]=h,(k=d._inactiveMlineIndex.shift())||(k=d._offerMlines.length),d._offerMlines[k]=r(r({},b),{},{mid:f.mid}),d._answerMlines[k]=f,d._msidIndexMap[c.streamId]=[E,k],lG&&(c.initAudioEncodedTransform(),c.initVideoEncodedTransform()),a.push(c.streamId||""),s.push(l?c.userId:"local"),e.next=46;break;case 28:if(!l){e.next=46;break}if(R=d._msidIndexMap[c.streamId]||[],T=y(R,2),I=T[0],A=T[1],!I||!A){e.next=45;break}if((null===(w=d._offerMlines[I])||void 0===w?void 0:w.mid)===h.mid){e.next=41;break}return d._offerMlines[I]=gB(d._offerMlines[I]),d._offerMlines[A]=gB(d._offerMlines[A]),d._answerMlines[I]=gB(d._answerMlines[I]),d._answerMlines[A]=gB(d._answerMlines[A]),e.next=38,d.setDescription();case 38:d._offerMlines[I]=r(r({},d._aRecvonlyOfferTpl),{},{mid:h.mid}),d._offerMlines[A]=r(r({},d._vRecvonlyOfferTpl),{},{mid:f.mid}),dG.print("enqueue","hack: %o",c.streamId);case 41:d._answerMlines[I]=h,d._answerMlines[A]=f,e.next=46;break;case 45:dG.print("dequeue","pushtrack before subscribe: %o",c.userId);case 46:l&&(c.sequenceId=null==o?void 0:o.sequenceId);case 47:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}())):(c={},n.forEach((function(e){var t,r=e.audioMid,n=e.videoMid;c[r]=r,c[n]=n,delete d._msidIndexMap[null===(t=e.stream)||void 0===t?void 0:t.streamId]})),this._offerMlines=this._offerMlines.map((function(e,t){return c[e.mid]&&(e=gB(e),d._inactiveMlineIndex.push(t)),e})),this._inactiveMlineIndex.sort((function(e,t){return e-t})),this._answerMlines=this._answerMlines.map((function(e){return c[e.mid]&&(e=gB(e)),e}))),e.next=12,this.setDescription(a.length?{streamId:a.join(","),streamUserId:s.join(",")}:void 0);case 12:dG.print("dequeue","loop"),this.dequeue();case 14:case"end":return e.stop()}}),e,this)}))),function(){return s.apply(this,arguments)})},{key:"setDescription",value:(i=o(regeneratorRuntime.mark((function e(t){var r,n;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return dG.print("setDescription","_offerMlines: %o, _answerMlines: %o",this._offerMlines,this._answerMlines),this._offerSession.media=this._offerMlines,this._answerSession.media=this._answerMlines,r=[],this._offerMlines.forEach((function(e){"inactive"!==e.direction&&r.push(e.mid)})),this._offerSession.groups&&this._answerSession.groups&&(this._offerSession.groups[0].mids=r.join(" "),this._answerSession.groups[0].mids=r.join(" ")),n=EP(),t&&VV.rtcBeginCreateOffer("local"===t.streamUserId?_V.UP:_V.DOWN,t.streamId,t.streamUserId),e.next=10,this._peerConnection.createOffer();case 10:return t&&VV.rtcCreateOffer(0,"local"===t.streamUserId?vV.UP:vV.DOWN,t.streamId,t.streamUserId,EP()-n),e.next=13,this.setLocalDescription(rB.write(this._offerSession),t);case 13:return e.next=15,this.setRemoteDescription(rB.write(this._answerSession),t);case 15:case"end":return e.stop()}}),e,this)}))),function(e){return i.apply(this,arguments)})},{key:"getDefaultSdp",value:(n=o(regeneratorRuntime.mark((function e(){var t,r,n;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,xP(!0);case 2:if(t=e.sent){e.next=5;break}throw new cD(sD.NOT_SUPPORTED,"Get offer Error");case 5:return this.createAVMlineOfferTpl(t),r=rB.parse(t),n=[],r.media=r.media.filter((function(e){return"recvonly"===e.direction&&(n.push(e.mid+""),!0)})),r.groups=[{mids:n.join(" "),type:"BUNDLE"}],e.abrupt("return",{sdp:rB.write(r),semantics:"unified-plan",type:"offer"});case 11:case"end":return e.stop()}}),e,this)}))),function(){return n.apply(this,arguments)})},{key:"rollback",value:(t=o(regeneratorRuntime.mark((function e(t){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:delete this._mlinesCache[t];case 1:case"end":return e.stop()}}),e,this)}))),function(e){return t.apply(this,arguments)})},{key:"createAVMlineOfferTpl",value:function(e){var t=this;rB.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)}))}}]),b}(tB),fG=new uM("FirefoxHandler",3),pG=function(e){d(S,e);var t,n,i,s,h,f,_,m=v(S);function S(){var e;a(this,S);for(var t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];return c(p(e=m.call.apply(m,[this].concat(r))),"name","firefox"),e}return u(S,[{key:"connect",value:(_=o(regeneratorRuntime.mark((function e(t){var n,i,o,a,s,u,c,d=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return fG.print("connect","invoke connect"),this._offerIce={iceUfrag:null===(n=t.iceParams)||void 0===n?void 0:n.clientIceUfrag,icePwd:null===(i=t.iceParams)||void 0===i?void 0:i.clientIcePwd,iceOptions:"renomination"},e.next=4,SB(t);case 4:return this._answerIce=e.sent,e.next=7,this._peerConnection.createOffer();case 7:return o=e.sent,a=rB.parse(o.sdp),s=y(a.media,1),u=s[0],this._offerIce.fingerprint=a.fingerprint||u.fingerprint,a.media=a.media.map((function(e){return r(r({},e),d._offerIce)})),(c=r({},a)).fingerprint=this._answerIce.fingerprint,c.media=c.media.map((function(e){return r(r(r({},e),d._answerIce),{},{sctpmap:{sctpmapNumber:5e3,app:"webrtc-datachannel",maxMessageSize:262144}})})),e.next=17,this.setLocalDescription(rB.write(a));case 17:return e.next=19,this.setRemoteDescription(rB.write(c));case 19:return e.next=21,new Promise((function(e,t){d._dataChannel.onopen=function(){fG.print("connect","dataChannel open"),XV("es.dc.open",""),e("")},d._dataChannel.onerror=function(e){VV.rtcSignalingMsgError(e.error.sdpLineNumber,e.error.errorDetail,fV.INVALID_DATA),XV("es.dc.error",""),t(e)},d._dataChannel.onclose=function(e){XV("es.dc.close",""),t(e)},d._peerConnection.addEventListener("connectionstatechange",(function(e){"failed"!==d._peerConnection.iceConnectionState&&"closed"!==d._peerConnection.iceConnectionState&&"failed"!==d._peerConnection.connectionState||t(e)}))}));case 21:return fG.print("connect","dataChannel establish success"),e.abrupt("return",this._dataChannel);case 23:case"end":return e.stop()}}),e,this)}))),function(e){return _.apply(this,arguments)})},{key:"publish",value:(f=o(regeneratorRuntime.mark((function e(t,n){var i,o,a,s,u,c,d,h,f,p,_,v,m,y=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return a=g(l(S.prototype),"internalPublish",this).call(this,t,n),s=a.videoDescriptions,u=a.subVideoDescriptions,c=a.transceiverInit,t.audioTransceiver=this._peerConnection.addTransceiver(c.aTrack,c.audioTransceiverInit),t.videoTransceiver=this._peerConnection.addTransceiver(c.vTrack,c.videoTransceiverInit),d=EP(),VV.rtcBeginCreateOffer(_V.UP,"",""),e.next=7,this._peerConnection.createOffer();case 7:return h=e.sent,VV.rtcCreateOffer(0,vV.UP,"","",EP()-d),(f=rB.parse(h.sdp)).media=null===(i=f.media)||void 0===i?void 0:i.map((function(e){return r(r({},e),y._offerIce)})),e.next=13,this.setLocalDescription(rB.write(f));case 13:return p=t.audioTransceiver.mid,_=t.videoTransceiver.mid,v=null,m=null,f.media=null===(o=f.media)||void 0===o?void 0:o.map((function(e){if("".concat(e.mid)===p){var t,r=null===(t=v=e)||void 0===t?void 0:t.rtp.find((function(e){return"opus"===e.codec}));if(r&&v.fmtp){var n=v.fmtp.find((function(e){return e.payload===r.payload}));n&&y._context&&(n.config+=y._context.audioProfileManager.getOpusConfigStr())}}else"".concat(e.mid)===_&&(m=e);return e})),e.next=20,this.setLocalDescription(rB.write(f));case 20:return e.abrupt("return",{partialSdp:yB(f,v,m),audioMid:p,videoMid:_,type:"incroffer",semantics:"unified-plan",videoDescriptions:s,subVideoDescriptions:u,transceiverInit:c});case 21:case"end":return e.stop()}}),e,this)}))),function(e,t){return f.apply(this,arguments)})},{key:"subscribe",value:(h=o(regeneratorRuntime.mark((function e(t){var n,i,o,a,s,u,c,d,l,h=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return fG.print("subscribe()"),t.audioTransceiver=this._peerConnection.addTransceiver("audio",{direction:"recvonly"}),t.videoTransceiver=this._peerConnection.addTransceiver("video",{direction:"recvonly"}),o=EP(),VV.rtcBeginCreateOffer(_V.UP,t.streamId,t.userId),e.next=7,this._peerConnection.createOffer();case 7:return a=e.sent,VV.rtcCreateOffer(0,vV.UP,t.streamId,t.userId,EP()-o),(s=rB.parse(a.sdp)).media=null===(n=s.media)||void 0===n?void 0:n.map((function(e){return r(r({},e),h._offerIce)})),e.next=13,this.setLocalDescription(rB.write(s),{streamId:t.streamId||"",streamUserId:t.userId});case 13:return u=t.audioTransceiver.mid,c=t.videoTransceiver.mid,d=null,l=null,null===(i=s.media)||void 0===i||i.forEach((function(e){"".concat(e.mid)===u?d=e:"".concat(e.mid)===c&&(l=e)})),e.abrupt("return",{partialSdp:yB(s,d,l),audioMid:u,videoMid:c,type:"incroffer",semantics:"unified-plan"});case 19:case"end":return e.stop()}}),e,this)}))),function(e){return h.apply(this,arguments)})},{key:"handleAck",value:(s=o(regeneratorRuntime.mark((function e(t){var n,i,o,a,s,u,c,d=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t.action!==aG.unpublish&&t.action!==aG.unsubscribe){e.next=2;break}return e.abrupt("return","");case 2:return o=t.signalingAck,a={},(s=rB.parse(null===(n=this._peerConnection.remoteDescription)||void 0===n?void 0:n.sdp)).media.forEach((function(e){a[e.mid]=e})),rB.parse(null==o?void 0:o.sdp).media.forEach((function(e){a[e.mid]=r(r({},e),d._answerIce)})),u=[],(c=rB.parse(null===(i=this._peerConnection.localDescription)||void 0===i?void 0:i.sdp)).media.forEach((function(e){u.push(a[e.mid])})),s.groups=c.groups,s.media=u,this.setRemoteDescription(rB.write(s)),e.abrupt("return","");case 15:case"end":return e.stop()}}),e,this)}))),function(e){return s.apply(this,arguments)})},{key:"getDefaultSdp",value:(i=o(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",{semantics:"unified-plan",sdp:"",type:"offer"});case 1:case"end":return e.stop()}}),e)}))),function(){return i.apply(this,arguments)})},{key:"rollback",value:(n=o(regeneratorRuntime.mark((function e(t,r){var n,i,o,a,s;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(fG.print("subscribe()"),!r.audioTransceiver||!r.videoTransceiver){e.next=14;break}return r.audioTransceiver.stop(),r.videoTransceiver.stop(),o=[],(a=rB.parse(null===(n=this._peerConnection.localDescription)||void 0===n?void 0:n.sdp)).media=a.media.map((function(e){return"".concat(e.mid)!==r.audioMid&&"".concat(e.mid)!==r.videoMid||(e=gB(e)),"inactive"!==e.direction&&o.push(e.mid),e})),(s=rB.parse(null===(i=this._peerConnection.remoteDescription)||void 0===i?void 0:i.sdp)).media=a.media.map((function(e){return"".concat(e.mid)!==r.audioMid&&"".concat(e.mid)!==r.videoMid||(e=gB(e)),e})),a.groups&&s.groups&&(a.groups[0].mids=o.join(" "),s.groups[0].mids=o.join(" ")),e.next=12,this.setLocalDescription(rB.write(a));case 12:return e.next=14,this.setRemoteDescription(rB.write(s));case 14:case"end":return e.stop()}}),e,this)}))),function(e,t){return n.apply(this,arguments)})},{key:"setCurrentDescription",value:(t=o(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._peerConnection.createOffer();case 2:if(!this._peerConnection.localDescription||!this._peerConnection.remoteDescription){e.next=7;break}return e.next=5,this._peerConnection.setLocalDescription(this._peerConnection.localDescription);case 5:return e.next=7,this._peerConnection.setRemoteDescription(this._peerConnection.remoteDescription);case 7:case"end":return e.stop()}}),e,this)}))),function(){return t.apply(this,arguments)})}]),S}(tB),_G="mozilla"===AP(),vG=function(e,t){return _G?new pG(e,t):new hG(e,t)},mG=new uM("Locker",2),gG=1,yG=function(){function e(t){a(this,e),c(this,"lockingPromise",Promise.resolve()),c(this,"locks",0),c(this,"name",""),c(this,"lockId",void 0),this.lockId=gG++,t&&(this.name=t),mG.print("[lock-".concat(this.name,"-").concat(this.lockId,"] is created."))}return u(e,[{key:"isLocked",get:function(){return this.locks>0}},{key:"lock",value:function(){var e,t=this;this.locks+=1,mG.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,mG.print("[lock-".concat(t.name,"-").concat(t.lockId,"] unlocked, current queue ").concat(t.locks,".")),r()}})),n=this.lockingPromise.then((function(){return e}));return this.lockingPromise=this.lockingPromise.then((function(){return r})),n}}]),e}(),SG=(c(Yj={},W.communication,[0]),c(Yj,W.chat,[0]),c(Yj,W.chatRoom,[1,"IES_chatroom"]),c(Yj,W.coHost,[1,"IES_PK"]),c(Yj,W.meeting,[16]),c(Yj,W.classRoom,[0]),Yj),bG=Object.defineProperty,EG=Object.getOwnPropertyDescriptor,kG=function(e,t,r,n){for(var i,o=n>1?void 0:n?EG(t,r):t,a=e.length-1;a>=0;a--)(i=e[a])&&(o=(n?i(t,r,o):i(o))||o);return n&&o&&bG(t,r,o),o},RG=new uM("MediaServerClient",2),TG=5e3,IG=function(e){return e.DISCONNECTED="disconnected",e.DISCONNECTING="disconnecting",e.CONNECTED="connected",e.CONNECTING="connecting",e}(IG||{}),AG=function(e,t){RG.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)},wG=function(e){d(C,e);var t,n,i,s,l,h,f,_,m,g,S,b,E,k,R,T,I,A,w=v(C);function C(e){var t,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:VV;return a(this,C),c(p(t=w.call(this)),"_token",void 0),c(p(t),"_appId",void 0),c(p(t),"_roomId",void 0),c(p(t),"_roomAttributes",void 0),c(p(t),"_clientId",void 0),c(p(t),"_businessId",void 0),c(p(t),"_userInfo",void 0),c(p(t),"_useCloudProxy",void 0),c(p(t),"_authorization",void 0),c(p(t),"_sessionId",void 0),c(p(t),"_iceConfigRequestManager",void 0),c(p(t),"_ontrackCallbackMap",new Map),c(p(t),"_subResolves",{}),c(p(t),"supportConcurrent",!1),c(p(t),"_handler",void 0),c(p(t),"_pubSubLock",void 0),c(p(t),"_joinLeaveLock",void 0),c(p(t),"_state",void 0),c(p(t),"_dataChannelSignal",void 0),c(p(t),"_pubConfig",{}),c(p(t),"_subConfig",{}),c(p(t),"monitor",void 0),c(p(t),"_roomProfile",W.communication),c(p(t),"_context",void 0),c(p(t),"_subStreamQueue",{}),t.monitor=r,t._pubSubLock=new yG("pubSubLock"),t._joinLeaveLock=new yG("joinLeaveLock"),t._state="disconnected",t._roomAttributes={multiChatMode:!1,bigRoomMode:!1},t._context=e,t.on("SUB_END",(function(e){return t._handleSubStreamQueue(e)})),t}return u(C,[{key:"_addHandlerEvents",value:function(){var e,t=this;null===(e=this._handler)||void 0===e||e.once("disconnect",(function(){RG.print("emit ABNORMAL_DISCONNECTION ice"),t.safeEmit(SF.ABNORMAL_DISCONNECTION)}))}},{key:"_addSignalEventHandler",value:function(){var e,t=this;[gF.ON_ADD_STREAM,gF.ON_REMOVE_STREAM,gF.USER_CONNECTION,gF.USER_DISCONNECTION,gF.ON_UPDATE_STREAM_ATTRIBUTES,gF.ON_UPDATE_ROOM_ATTRIBUTES,gF.ON_PUSH_TRACK,gF.ON_REMOVE_TRACK,gF.NODE_CHANGE,gF.ON_CUSTOM_MESSAGE,gF.USER_MESSAGE_RECEIVED,gF.USER_BINARY_MESSAGE_RECEIVED,gF.POST_PROCESSING_MESSAGE,gF.ON_USER_TOKEN_WILL_EXPIRE,gF.STREAM_CONTROL_MESSAGE,gF.ON_SCENE_CONFIG,gF.ON_UPDATE_USER_ATTRIBUTES,yF.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(){RG.print("emit ABNORMAL_DISCONNECTION datachannel"),t.safeEmit(SF.ABNORMAL_DISCONNECTION)}))}},{key:"_removeSignalEventHandler",value:function(){var e,t;null===(e=this._dataChannelSignal)||void 0===e||e.removeAllListeners(),null===(t=this._handler)||void 0===t||t.removeAllListeners()}},{key:"connectionState",get:function(){return this._state},set:function(e){this._state!==e&&(this.safeEmit(SF.ON_CONNECTION_STATE_CHANGE,{prev:this._state,next:e}),this._state=e)}},{key:"connect",value:(A=o(regeneratorRuntime.mark((function e(t){var r,n,i,o,a,s,u,c,d=this,l=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=l.length>1&&void 0!==l[1]?l[1]:"",n=l.length>2&&void 0!==l[2]?l[2]:"",i=l.length>3&&void 0!==l[3]?l[3]:{},this.connectionState="connecting",this._appId=t,this._handler&&(this._removeSignalEventHandler(),this._handler.destroy()),!i.node){e.next=11;break}o=[i.node],XV("es.join.nodeChange",i),e.next=20;break;case 11:return Promise.resolve().then((function(){return d.emit("onGetIceConfigHook")})),this._iceConfigRequestManager=new PF,e.next=15,null===(a=this._iceConfigRequestManager)||void 0===a?void 0:a.getAccessNode(t,r,n,rF.getDeviceId(),null==i?void 0:i.reason,null==i?void 0:i.feedbackNode,this._useCloudProxy);case 15:if(o=e.sent){e.next=19;break}throw XV("es.join.getNodeFailed",""),new cD(sD.ICE_SERVER_WRONG,"get ICE config failed");case 19:XV("es.join.getNodeSuccess",o);case 20:return this._addHandlerEvents(),Promise.resolve().then((function(){return d.emit("onEstablishConnectionHook")})),e.prev=22,u=!1,c=o.map((function(e){var t=vG(d.monitor,d._context);return t.connect(e).then((function(r){u?t.destroy():(u=!0,s=r,d.safeEmit("prevIceNode",e),d._handler=t,d.supportConcurrent="chrome"===t.name,d._addHandlerEvents())})).catch((function(){t.destroy()}))})),e.next=27,DP(c);case 27:RG.print("join","establish peerConnection success"),e.next=34;break;case 30:throw e.prev=30,e.t0=e.catch(22),this.connectionState="disconnected",new cD(sD.ESTABLISH_DATACHANNEL_FAILED,"establish dataChannel failed",e.t0);case 34:if(!s){e.next=40;break}this._dataChannelSignal=new NF(s),this._addSignalEventHandler(),this._dataChannelSignal.sendPingSignaling(),e.next=42;break;case 40:throw this.connectionState="disconnected",new cD(sD.ESTABLISH_DATACHANNEL_FAILED,"establish dataChannel failed");case 42:case"end":return e.stop()}}),e,this,[[22,30]])}))),function(e){return A.apply(this,arguments)})},{key:"join",value:(I=o(regeneratorRuntime.mark((function e(t){var r,n,i,o,a,s,u,c,d,l,h,f,p,_,v,m,g=this,y=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=y.length>1&&void 0!==y[1]?y[1]:{},n=y.length>2&&void 0!==y[2]&&y[2],i=y.length>3?y[3]:void 0,RG.print("join()","info: %o, params: %o, reconnect: %o, controlMessage: %o",t,r,n,i),this._appId=t.appId,this._token=t.token,this._roomId=t.roomId,this._clientId=t.userInfo.userId,this._businessId=t.userInfo.businessId,this._userInfo=t.userInfo,this._useCloudProxy=t.useCloudProxy,this._roomProfile=t.roomProfile,this._sessionId=r.sessionId,e.next=15,this.connect(this._appId,this._roomId,this._clientId,r);case 15:return e.t0=TP.token2auth(this._appId,this._roomId,this._clientId,this._token),e.t1=this._sessionId||"",e.t2=Date.now(),e.t3=i,e.t4={extra_info:this._userInfo.extraInfo,role:this._userInfo.role},e.next=22,YF();case 22:if(e.t5=e.sent,e.t6=window.navigator.userAgent,e.t7=sF.VERSION,e.t8=rF.getDeviceId(),e.t9=this._appId,e.t10=this._roomId,e.t11=this._clientId,e.t12=this._businessId,e.t13=this._useCloudProxy,e.t14=SG[this._roomProfile]?SG[this._roomProfile][0]+"":"0",e.t15={supportedCodecs:e.t5,deviceType:"web",userAgent:e.t6,sdkVersion:e.t7,deviceId:e.t8,appId:e.t9,roomId:e.t10,userId:e.t11,businessId:e.t12,enable_cloud_proxy:e.t13,channelProfile:e.t14},e.t16={supportTokenExpireCallBack:!0,enableSceneConfigV2:!0},o={Authorization:e.t0,sessionId:e.t1,timestamp:e.t2,controlMessage:e.t3,userAttributes:e.t4,params:e.t15,options:e.t16},"chrome-stable"!==AP()&&"safari"!==AP()){e.next=40;break}return e.next=38,null===(a=this._handler)||void 0===a?void 0:a.getDefaultSdp();case 38:o.sdpInfo=e.sent,o.options.enableUnBundleMode=!0;case 40:return Promise.resolve().then((function(){return g.emit("onSendingJoinMessageHook")})),e.prev=41,v=n?"reconnected":"joinRoom",e.next=45,this._dataChannelSignal.sendSignaling(v,o);case 45:return m=e.sent,RG.print("join","send join message success"),this._authorization=o.Authorization,this.connectionState="connected",Wj.audioStallConfig=null===(s=m.config)||void 0===s?void 0:s.engine_WEB,this._pubConfig.audioRed=!(null===(u=m.config)||void 0===u||null===(c=u.engine_WEB)||void 0===c||!c.pub_audio_red),this._subConfig.muteReplaceUnsub=!(null===(d=m.config)||void 0===d||!d.mute_replace_unsub),this._pubConfig.simulcastOnDemand=!(!1===(null===(l=m.config)||void 0===l||null===(h=l.engine_VPM)||void 0===h||null===(f=h.ondemand)||void 0===f?void 0:f.enable)),null===(p=this._context)||void 0===p||p.audioProfileManager.updateEngineBAC(null===(_=m.config)||void 0===_?void 0:_.engine_BAC),e.abrupt("return",m);case 57:if(e.prev=57,e.t17=e.catch(41),this.connectionState="disconnected",!((null===e.t17||void 0===e.t17?void 0:e.t17.code)>=700&&(null===e.t17||void 0===e.t17?void 0:e.t17.code)<800)){e.next=62;break}throw new cD(sD.INVALID_TOKEN,(null===e.t17||void 0===e.t17?void 0:e.t17.message)||"Invalid token");case 62:if(200===(null===e.t17||void 0===e.t17?void 0:e.t17.code)){e.next=64;break}throw new cD(sD.JOIN_ROOM_FAILED,(null===e.t17||void 0===e.t17?void 0:e.t17.message)||"Join room failed");case 64:case"end":return e.stop()}}),e,this,[[41,57]])}))),function(e){return I.apply(this,arguments)})},{key:"publish",value:(T=o(regeneratorRuntime.mark((function e(t){var n,i,o,a,s,u,c,d,l,h,f,p,_,v,m,g,y,S;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return RG.print("publish()","localStream: %o",t),n=t.videoTrack,i=t.audioTrack,o=EP(),a="",s="",e.prev=6,e.next=9,null===(u=this._handler)||void 0===u?void 0:u.publish(t,this._pubConfig);case 9:if(m=e.sent){e.next=12;break}throw new cD(sD.ADD_TRANSCEIVER_FAILED,"add transceiver failed");case 12:return a=m.audioMid,s=m.videoMid,t.pubAttributes={localaudio:!!i,localvideo:!!n,videostream:t.pubVideo,audiostream:t.pubAudio,extvideo:!!(n instanceof Ij),extaudio:!!(i instanceof Aj)},g={attributes:r({videoDescriptions:m.videoDescriptions},t.pubAttributes),audio:!0,video:!0,screen:t.isScreen,audioMid:a,videoMid:s,sdpInfo:{msid:t.stream.id,type:m.type,sdp:m.partialSdp,semantics:m.semantics}},t.enableSimulcast&&this._pubConfig.simulcastOnDemand&&(g.attributes.subVideoDescriptions=m.subVideoDescriptions),e.next=19,null===(c=this._dataChannelSignal)||void 0===c?void 0:c.sendSignaling("publish",g);case 19:if(200===(null==(y=e.sent)?void 0:y.code)){e.next=22;break}throw new cD(sD.PUBLISH_FAILED,(null==y?void 0:y.message)||"publish failed");case 22:return VV.rtcRecvAnswer(0,yV.INCRANSWER,(null==y||null===(d=y.relayMessage)||void 0===d?void 0:d.sequenceId)||0,null==y||null===(l=y.relayMessage)||void 0===l?void 0:l.sdp,SV.UP,"",""),null===(h=this._handler)||void 0===h||h.handleAck({action:aG.publish,streamId:y.streamId,audioMid:a,videoMid:s,transceiverInit:m.transceiverInit,signalingAck:{audioMid:null==y||null===(f=y.relayMessage)||void 0===f?void 0:f.audioMid,videoMid:null==y||null===(p=y.relayMessage)||void 0===p?void 0:p.videoMid,sdp:null==y||null===(_=y.relayMessage)||void 0===_?void 0:_.sdp,sequenceId:null==y||null===(v=y.relayMessage)||void 0===v?void 0:v.sequenceId},stream:t}),t.streamId=y.streamId,t.videoMid=s,t.audioMid=a,t.subVideoDescriptions=m.subVideoDescriptions,this.monitor.rtcPublishStat(bV.SUCCESS,EV.W_0,o,kV.UNKNOWN),t.statsReport.setLocalStreamStatsEvtInterval(this,this._handler,this.monitor),e.abrupt("return");case 33:throw e.prev=33,e.t0=e.catch(6),e.t0 instanceof Error&&this.monitor.rtcPublishStat(bV.FAIL,EV.W_0,o,e.t0.message),null===(S=this._handler)||void 0===S||S.rollback(t.stream.id,t),e.t0;case 38:case"end":return e.stop()}}),e,this,[[6,33]])}))),function(e){return T.apply(this,arguments)})},{key:"updatePubTrack",value:(R=o(regeneratorRuntime.mark((function e(t){var r,n,i,o,a,s,u,c,d,l,h,f,p,_,v,m,g,S,b,E,k,R,T,I,A,w,C,O,N,x,D;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:for(RG.print("updatePubTrack()","localStream: %o",t),i=t.videoTrack,o=t.audioTrack,a=t.pubAudio,s=t.pubVideo,u=null==o?void 0:o.getTrack(),c=null==i?void 0:i.getTrack(),s&&c?null===(d=t.videoTransceiver)||void 0===d||d.sender.replaceTrack(c):null===(l=t.videoTransceiver)||void 0===l||l.sender.replaceTrack(null),null===(r=this._handler)||void 0===r||r.updateScaleResolutionDownBy(t),a&&u?(f=o.mixType,(p=o.mixedAudioTrack)&&f!==Q.PLAYOUT&&!0===u.enabled&&(u=p),null===(h=t.audioTransceiver)||void 0===h||h.sender.replaceTrack(u)):null===(_=t.audioTransceiver)||void 0===_||_.sender.replaceTrack(null),v={localaudio:!!o,localvideo:!!i,videostream:s,audiostream:a,extvideo:!!(i instanceof Ij),extaudio:!!(o instanceof Aj)},m={},g=0,S=Object.entries(v);g<S.length;g++)b=y(S[g],2),E=b[0],(k=b[1])!==Reflect.get(t.pubAttributes,E)&&Reflect.set(m,E,k);if(Object.keys(m).length){e.next=12;break}return e.abrupt("return");case 12:return t.observer&&(R=t.observer,T=m.audiostream,I=m.videostream,A=m.localaudio,w=m.localvideo,C=m.extaudio,O=m.extvideo,void 0!==w?void 0!==O?R.setPushVideo(O):R.setEnableVideo(w):void 0!==I&&R.setUnmuteVideo(I),void 0!==A?void 0!==C?R.setPushAudio(C):R.setEnableAudio(A):void 0!==T&&R.setUnmuteAudio(T)),t.pubAttributes=v,N={roomId:this._roomId,streamId:t.streamId,attributes:m},e.next=17,null===(n=this._dataChannelSignal)||void 0===n?void 0:n.sendSignaling("updateStreamAttributes",N);case 17:if(200===(null==(x=e.sent)?void 0:x.code)){e.next=20;break}throw new cD(sD.UPDATE_TRACK_FAILED,(null==x?void 0:x.message)||"update track failed");case 20:if("mozilla"!==AP()){e.next=23;break}return e.next=23,null===(D=this._handler)||void 0===D?void 0:D.setCurrentDescription();case 23:case"end":return e.stop()}}),e,this)}))),function(e){return R.apply(this,arguments)})},{key:"updateToken",value:(k=o(regeneratorRuntime.mark((function e(t){var r,n,i,o,a;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(RG.print("updateToken()","newToken: %o",t),this._token=t,this._appId&&null!==(r=this._userInfo)&&void 0!==r&&r.userId&&this._roomId){e.next=4;break}return e.abrupt("return");case 4:return i={roomId:this._roomId,userId:null===(n=this._userInfo)||void 0===n?void 0:n.userId,appId:this._appId,token:"Bearer ".concat(t)},e.prev=5,e.next=8,null===(o=this._dataChannelSignal)||void 0===o?void 0:o.sendSignaling("updateToken",i);case 8:if(200===(null==(a=e.sent)?void 0:a.code)){e.next=11;break}throw new cD(sD.UPDATE_TOKEN_WITH_INVALID_TOKEN,"invoke updateToken with an invalid token");case 11:e.next=16;break;case 13:throw e.prev=13,e.t0=e.catch(5),new cD(sD.UPDATE_TOKEN_WITH_INVALID_TOKEN,"invoke updateToken with an invalid token");case 16:case"end":return e.stop()}}),e,this,[[5,13]])}))),function(e){return k.apply(this,arguments)})},{key:"unpublish",value:(E=o(regeneratorRuntime.mark((function e(t){var r,n,i,o;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:RG.print("unpublish()","localStream: %o",t),o={roomId:this._roomId,initStreamId:t.initStreamId,streamId:t.streamId},null===(r=this._dataChannelSignal)||void 0===r||r.sendSignaling("unpublish",o),null===(n=this._handler)||void 0===n||n.handleAck({action:aG.unpublish,audioMid:t.audioMid,videoMid:t.videoMid,stream:t,streamId:t.streamId}),t.statsReport.unpublish(),null===(i=this._handler)||void 0===i||i.rollback(t.stream.id,t);case 6:case"end":return e.stop()}}),e,this)}))),function(e){return E.apply(this,arguments)})},{key:"subscribe",value:(b=o(regeneratorRuntime.mark((function e(t,r,n){var i=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",new Promise(function(){var e=o(regeneratorRuntime.mark((function e(o,a){var s,u,d,l,h,f,p,_,v,m,g,y,S,b,E,k,R,T,I,A,w,C,O,N,x,D,P,M,U,L,V,F,B,j,G;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t.streamState!==tG.SUB_ED){e.next=2;break}return e.abrupt("return",i._updateSubTrack(t,r,$j.SUB).then(o,a));case 2:if(t.streamState!==tG.SUB_ING){e.next=7;break}return i._subStreamQueue[t.streamId]||(i._subStreamQueue[t.streamId]=[]),RG.print("_subStreamQueue","streamId: %o, enqueue",t.streamId),i._subStreamQueue[t.streamId].push({fn:i.subscribe,args:[t,r,n],resolve:o,reject:a}),e.abrupt("return");case 7:if(RG.print("subscribe()","mediaType: %o",r),AG("subscribe()",t),t.streamState=tG.SUB_ING,s=!1,u=!1,MP(r)&&(u=!0),UP(r)&&(s=!0),s||!i._multiChatMode()){e.next=17;break}return t.streamState=tG.INIT,i.emit("SUB_END",t.streamId),e.abrupt("return",o(null));case 17:if(d=EP(),l=t.audioMid,h=t.videoMid,p=t.paused,_=t.subVideo,e.prev=22,!l||!h){e.next=29;break}return e.next=26,null===(O=i._handler)||void 0===O?void 0:O.subscribe(t,{audioMid:l,videoMid:h});case 26:f=e.sent,e.next=36;break;case 29:return e.next=31,null===(N=i._handler)||void 0===N?void 0:N.subscribe(t);case 31:if(f=e.sent){e.next=34;break}throw new cD(sD.ADD_TRANSCEIVER_FAILED,"add transceiver failed");case 34:l=f.audioMid,h=f.videoMid;case 36:return t.paused=!s,t.subVideo=s,x={audio:!i._multiChatMode(),video:!0,data:!0,screen:t.isScreen,browser:"chrome-stable",videoMid:h,audioMid:l,sdpInfo:{sdp:null===(v=f)||void 0===v?void 0:v.partialSdp,semantics:null===(m=f)||void 0===m?void 0:m.semantics,type:null===(g=f)||void 0===g?void 0:g.type},streamUserId:t.userId,streamId:t.streamId,config:{enableMediaType:{audio:!!i._multiChatMode()||u,video:s},qualityLayer:{spatialLayer:(null==n?void 0:n.spatialLayer)||0,temporalLayer:0,spatialSubLayer:(null==n?void 0:n.spatialSubLayer)||-1}}},e.next=41,null===(y=i._dataChannelSignal)||void 0===y?void 0:y.sendSignaling("subscribe",x);case 41:if(200===(null==(D=e.sent)?void 0:D.code)){e.next=44;break}throw new cD(sD.SUBSCRIBE_FAILED,(null==D?void 0:D.message)||"subscribe failed");case 44:return P=[],M=!i._multiChatMode(),U=!t.videoTrack,i._subResolves[t.streamId]||(i._subResolves[t.streamId]=[]),U&&P.push(new Promise((function(e,r){i._subResolves[t.streamId].push(e);var n=setTimeout((function(){return r(new cD(sD.TIME_OUT,"wait video timeout for userId: ".concat(t.userId)))}),TG);t.on("ontrack",(function r(i){"video"===i.mediaType&&(RG.print("remoteStream ".concat(t.userId," received video track")),t.off("ontrack",r),clearTimeout(n),e(0))}))}))),M&&P.push(new Promise((function(e,r){i._subResolves[t.streamId].push(e);var n=setTimeout((function(){return r(new cD(sD.TIME_OUT,"wait audio timeout for userId: ".concat(t.userId)))}),TG);t.on("ontrack",(function r(i){"audio"===i.mediaType&&(RG.print("remoteStream ".concat(t.userId," received audio track")),t.off("ontrack",r),clearTimeout(n),e(0))}))}))),L=function(e){t.ontrack(e)},null===(S=i._handler)||void 0===S||S.on("ontrack",L),i._ontrackCallbackMap.set(t,L),V=null==D?void 0:D.relayMessage,F=V.audioMid,B=V.videoMid,V.sequenceId,c(b={},l,F),c(b,h,B),j=b,RG.print("sub midmap",t.userId,j),t.videoMid=B,t.audioMid=F,t._workaround_1_=!1,t.subMediaType=r,t.streamState=tG.SUB_ED,VV.rtcRecvAnswer(0,yV.INCRANSWER,(null==D||null===(E=D.relayMessage)||void 0===E?void 0:E.sequenceId)||0,null==D||null===(k=D.relayMessage)||void 0===k?void 0:k.sdp,SV.DOWN,t.streamId,t.userId),null===(R=i._handler)||void 0===R||R.handleAck({action:aG.subscribe,streamId:t.streamId,audioMid:l,videoMid:h,transceiverInit:null===(T=f)||void 0===T?void 0:T.transceiverInit,signalingAck:{audioMid:null==D||null===(I=D.relayMessage)||void 0===I?void 0:I.audioMid,videoMid:null==D||null===(A=D.relayMessage)||void 0===A?void 0:A.videoMid,sdp:null==D||null===(w=D.relayMessage)||void 0===w?void 0:w.sdp,sequenceId:null==D||null===(C=D.relayMessage)||void 0===C?void 0:C.sequenceId},stream:t}),e.next=65,Promise.all(P);case 65:i._multiChatMode()||(t.subAudio=u),i.monitor.rtcSubscribeStat(RV.SUCCESS,d,TV.UNKNOWN,t.userId),t.statsReport.setRemoteStreamStatsEvtInterval(i,i._handler,i.monitor),o(null),i.emit("SUB_END",t.streamId),e.next=81;break;case 72:e.prev=72,e.t0=e.catch(22),e.t0 instanceof Error&&i.monitor.rtcSubscribeStat(RV.FAIL,d,e.t0.message,t.userId),t.paused=p,t.subVideo=_,t.streamState=tG.INIT,null===(G=i._handler)||void 0===G||G.rollback(t.streamId,t),a(e.t0),i.emit("SUB_END",t.streamId);case 81:case"end":return e.stop()}}),e,null,[[22,72]])})));return function(t,r){return e.apply(this,arguments)}}()));case 1:case"end":return e.stop()}}),e)}))),function(e,t,r){return b.apply(this,arguments)})},{key:"_handleSubStreamQueue",value:function(e){var t,r=this;if(null!==(t=this._subStreamQueue[e])&&void 0!==t&&t.length){RG.print("_subStreamQueue","streamId: %o, exec",e);var n=this._subStreamQueue[e].shift(),i=n.fn,o=n.args,a=n.resolve,s=n.reject;i.apply(this,o).then(a,s).finally((function(){return r._handleSubStreamQueue(e)}))}else RG.print("_subStreamQueue","streamId: %o, END",e)}},{key:"controlMessage",value:(S=o(regeneratorRuntime.mark((function e(t){var r,n;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return RG.print("controlMessage()","params: %o",t),n=t,"transcode"===t.type&&(n.roomId=this._roomId),e.next=5,null===(r=this._dataChannelSignal)||void 0===r?void 0:r.sendSignaling("controlMessage",n);case 5:case"end":return e.stop()}}),e,this)}))),function(e){return S.apply(this,arguments)})},{key:"updateUserAttributes",value:(g=o(regeneratorRuntime.mark((function e(t){var r;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return RG.print("updateUserAttributes()","attributes: %o",t),e.next=3,null===(r=this._dataChannelSignal)||void 0===r?void 0:r.sendSignaling("updateUserAttributes",{roomId:this._roomId,sessionId:this._sessionId,attributes:t});case 3:case"end":return e.stop()}}),e,this)}))),function(e){return g.apply(this,arguments)})},{key:"updateSubTrack",value:(m=o(regeneratorRuntime.mark((function e(t,r,n,i){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this._updateSubTrack(t,r,n,i||t.subLayer));case 1:case"end":return e.stop()}}),e,this)}))),function(e,t,r,n){return m.apply(this,arguments)})},{key:"_updateSubTrack",value:(_=o(regeneratorRuntime.mark((function e(t,r,n){var i,o,a,s,u,c,d,l,h,f,p,_=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return u=_.length>3&&void 0!==_[3]?_[3]:{spatialLayer:0,spatialSubLayer:-1},RG.print("updateSubTrack()","mediaType: %o, subLayer: %o",r,u),AG("updateSubTrack()",t),c=0,c=n===$j.SUB?t.subMediaType|r:t.subMediaType-(t.subMediaType&r),RG.print("updateSubTrack","prev: %o, direction: %o, mediaType: %o, newMediaType: %o",t.subMediaType,n,r,c),t.subMediaType===c&&RG.print("updateSubTrack","mediaType no change"),d=!1,l=!1,MP(c)&&(l=!0),UP(c)&&(d=!0),h={roomId:this._roomId,streamList:[t.streamId],config:{enableMediaType:{video:d,audio:!!this._multiChatMode()||l},qualityLayer:{spatialLayer:null!==(i=u.spatialLayer)&&void 0!==i?i:0,temporalLayer:0,spatialSubLayer:null!==(o=u.spatialSubLayer)&&void 0!==o?o:-1}}},e.next=13,null===(a=this._dataChannelSignal)||void 0===a?void 0:a.sendSignaling("updateSubscribe",h);case 13:if(200===(null==(f=e.sent)?void 0:f.code)){e.next=16;break}throw new cD(sD.UPDATE_TRACK_FAILED,(null==f?void 0:f.message)||"update track failed");case 16:return t.paused=!d,this._multiChatMode()||(null===(p=t.observer)||void 0===p||p.setUnmuteAudio(l),t.subAudio=l),null===(s=t.observer)||void 0===s||s.setUnmuteVideo(d),t.subVideo=d,t.subMediaType=c,t.subLayer=u,e.abrupt("return",t);case 23:case"end":return e.stop()}}),e,this)}))),function(e,t,r){return _.apply(this,arguments)})},{key:"subscribe4pushTrack",value:(f=o(regeneratorRuntime.mark((function e(t,r){var n,i,o,a,s,u,d,l,h,f,p,_,v,m,g,y,S,b=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(RG.print("subscribe4pushTrack()","streamInfo: %o",r),AG("subscribe4pushTrack()",t),u=null==r?void 0:r.message,d=u.audioMid,l=u.videoMid,h=u.sequenceId,t.subAudio=!0,!(h<t.sequenceId)){e.next=7;break}return RG.print("subscribe4pushTrack","sequenceId return",h,t.sequenceId),e.abrupt("return");case 7:if(f=t.audioMid,p=t.videoMid,null===(n=t.observer)||void 0===n||n.setPushTrack(!0),!f||!p){e.next=16;break}return e.next=13,null===(v=this._handler)||void 0===v?void 0:v.subscribe(t,{audioMid:f,videoMid:p});case 13:_=e.sent,e.next=23;break;case 16:return e.next=18,null===(m=this._handler)||void 0===m?void 0:m.subscribe(t);case 18:if(_=e.sent){e.next=21;break}throw new cD(sD.ADD_TRANSCEIVER_FAILED,"add transceiver failed");case 21:f=_.audioMid,p=_.videoMid;case 23:return c(i={},f,d),c(i,p,l),g=i,RG.print("onpushtrack midmap",t.userId,g),t.audioMid=d,t.videoMid=l,t.sequenceId=h,this._subResolves[t.streamId]||(this._subResolves[t.streamId]=[]),y=[],t.audioTrack||y.push(new Promise((function(e,r){b._subResolves[t.streamId].push(e);var n=setTimeout((function(){return r(new cD(sD.TIME_OUT,"wait audio timeout for userId: ".concat(t.userId)))}),TG);t.on("ontrack",(function r(i){"audio"===i.mediaType&&(RG.print("remoteStream ".concat(t.userId," received audio track")),t.off("ontrack",r),clearTimeout(n),e(0))}))}))),S=function(e){t.ontrack(e)},null===(o=this._handler)||void 0===o||o.on("ontrack",S),this._ontrackCallbackMap.set(t,S),null===(a=this._handler)||void 0===a||a.handleAck({action:aG.pushtrack,streamId:t.streamId,audioMid:f,videoMid:p,stream:t,transceiverInit:null===(s=_)||void 0===s?void 0:s.transceiverInit,signalingAck:null==r?void 0:r.message}),e.next=37,Promise.all(y);case 37:t.statsReport.setRemoteStreamStatsEvtInterval(this,this._handler,this.monitor);case 38:case"end":return e.stop()}}),e,this)}))),function(e,t){return f.apply(this,arguments)})},{key:"unsubscribe4removeTrack",value:(h=o(regeneratorRuntime.mark((function e(t,r){var n,i,o;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(AG("unsubscribe4removeTrack()",t),RG.print("unsubscribe4removeTrack()","sequenceId: ",r.sequenceId),!(r.sequenceId<t.sequenceId)){e.next=5;break}return RG.print("unsubscribe4removeTrack()","sequenceId return"),e.abrupt("return");case 5:if(t.subAudio=!1,!t.subVideo&&!t.paused){e.next=9;break}return t.sequenceId=r.sequenceId,e.abrupt("return");case 9:null===(n=t.observer)||void 0===n||n.setPushTrack(!1),null===(i=this._handler)||void 0===i||i.handleAck({action:aG.removetrack,streamId:t.streamId,audioMid:t.audioMid,videoMid:t.videoMid,stream:t}),null===(o=this._handler)||void 0===o||o.rollback(t.streamId,t),this._subResolves[t.streamId]&&this._subResolves[t.streamId].forEach((function(e){return e(0)})),RG.print("clean unsubscribe4removeTrack"),t.clean(),t.resetHasSubscribed(),t.statsReport.unsubscribe();case 17:case"end":return e.stop()}}),e,this)}))),function(e,t){return h.apply(this,arguments)})},{key:"unsubscribe",value:(l=o(regeneratorRuntime.mark((function e(t,r){var n,i,o,a,s,u,c,d,l,h=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(o=h.length>2&&void 0!==h[2]&&h[2],AG("unsubscribe()",t),a=t.subMediaType-(t.subMediaType&r),o||!this._subConfig.muteReplaceUnsub&&a===Pj.NONE){e.next=5;break}return e.abrupt("return",this._updateSubTrack(t,r,$j.UNSUB));case 5:if(s={roomId:this._roomId,streamId:t.streamId,userId:t.userId},null===(n=this._dataChannelSignal)||void 0===n||n.sendSignaling("unsubscribe",s),t.streamState=tG.INIT,this._subStreamQueue[t.streamId]&&(this._subStreamQueue[t.streamId].forEach((function(e){return(0,e.resolve)(null)})),delete this._subStreamQueue[t.streamId]),t.subVideo=!1,t.paused=!1,t._workaround_1_||(t.subAudio=!1),null===(i=t.observer)||void 0===i||i.setSubscribeVideo(!1),t.subAudio){e.next=24;break}return null===(u=t.observer)||void 0===u||u.setSubscribeAudio(!1),e.next=17,null===(c=this._handler)||void 0===c?void 0:c.handleAck({action:aG.unsubscribe,streamId:t.streamId,audioMid:t.audioMid,videoMid:t.videoMid,stream:t});case 17:l=e.sent,null===(d=this._handler)||void 0===d||d.rollback(t.streamId,t),this._subResolves[l]&&this._subResolves[l].forEach((function(e){return e(0)})),RG.print("unsubscribe","clean unsub ".concat(t.userId)),t.clean(),this.removeOnTrackListener(t),t.statsReport.unsubscribe();case 24:case"end":return e.stop()}}),e,this)}))),function(e,t){return l.apply(this,arguments)})},{key:"removeOnTrackListener",value: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))}},{key:"handleRemoveStream",value:(s=o(regeneratorRuntime.mark((function e(t,r){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(AG("handleRemoveStream()",t),t.subVideo=!1,r.message&&r.message!==vF.videoMuted?t._workaround_1_=!1:t._workaround_1_=!0,t.hasSubscribed){e.next=5;break}return e.abrupt("return");case 5:this.unsubscribe(t,P.AUDIO_AND_VIDEO,!0);case 6:case"end":return e.stop()}}),e,this)}))),function(e,t){return s.apply(this,arguments)})},{key:"leave",value:(i=o(regeneratorRuntime.mark((function e(){var t,r,n;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(RG.print("leave()"),"connected"!==this.connectionState){e.next=22;break}return this.connectionState="disconnecting",t={Authorization:this._authorization,roomId:this._roomId,sessionId:this._sessionId},e.next=6,this._joinLeaveLock.lock();case 6:return r=e.sent,e.prev=7,e.next=10,null===(n=this._dataChannelSignal)||void 0===n?void 0:n.sendSignaling("leaveRoom",t);case 10:this.connectionState="disconnected",e.next=17;break;case 13:throw e.prev=13,e.t0=e.catch(7),this.connectionState="connected",e.t0;case 17:return e.prev=17,r(),e.finish(17);case 20:e.next=23;break;case 22:return e.abrupt("return",Promise.reject(new cD(sD.NOT_CONNECTED_YET,"server not connected")));case 23:case"end":return e.stop()}}),e,this,[[7,13,17,20]])}))),function(){return i.apply(this,arguments)})},{key:"subscribePublicStream",value:(n=o(regeneratorRuntime.mark((function e(t){var r,n,i,o,a,s,u,c,d,l,h,f,p,_,v,m,g,y=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,null===(r=this._handler)||void 0===r?void 0:r.subscribe(t);case 2:if(a=e.sent){e.next=5;break}throw new cD(sD.ADD_TRANSCEIVER_FAILED,"add transceiver failed");case 5:return s=EP(),u=a.audioMid,c=a.videoMid,d={appId:this._appId,streamId:t.streamId,audio:!0,video:!0,data:!0,audioMid:u,videoMid:c,sdpInfo:{sdp:null==a?void 0:a.partialSdp,semantics:null==a?void 0:a.semantics,type:null==a?void 0:a.type},config:{enableMediaType:{audio:!0,video:!0},qualityLayer:{spatialLayer:0,temporalLayer:0}}},e.next=11,null===(n=this._dataChannelSignal)||void 0===n?void 0:n.sendSignaling("startPullStream",d);case 11:return l=e.sent,h=[],this._subResolves[t.streamId]=[],h.push(new Promise((function(e,r){y._subResolves[t.streamId].push(e);var n=setTimeout((function(){return r(new cD(sD.TIME_OUT,"wait video timeout for streamId: ".concat(t.streamId)))}),TG);t.on("ontrack",(function r(i){"video"===i.mediaType&&(RG.print("remoteStream ".concat(t.userId," received video track")),t.off("ontrack",r),clearTimeout(n),e(0))}))}))),h.push(new Promise((function(e,r){y._subResolves[t.streamId].push(e);var n=setTimeout((function(){return r(new cD(sD.TIME_OUT,"wait audio timeout for streamId: ".concat(t.streamId)))}),TG);t.on("ontrack",(function r(i){"audio"===i.mediaType&&(RG.print("remoteStream ".concat(t.userId," received audio track")),t.off("ontrack",r),clearTimeout(n),e(0))}))}))),f=function(e){t.ontrack(e)},null===(i=this._handler)||void 0===i||i.on("ontrack",f),this._ontrackCallbackMap.set(t,f),p=null==l?void 0:l.relayMessage,_=p.audioMid,v=p.videoMid,m=p.sequenceId,g=p.sdp,t.videoMid=v,t.audioMid=_,t.sequenceId=m,t._workaround_1_=!1,t.paused=!1,t.streamState=tG.SUB_ED,t.subAudio=!0,t.subVideo=!0,null===(o=this._handler)||void 0===o||o.handleAck({action:aG.subscribe,streamId:t.streamId,audioMid:u,videoMid:c,transceiverInit:null==a?void 0:a.transceiverInit,signalingAck:{audioMid:_,videoMid:v,sdp:g,sequenceId:m},stream:t}),e.next=31,Promise.all(h);case 31:this.monitor.rtcSubscribeStat(RV.SUCCESS,s,TV.UNKNOWN,t.userId),t.statsReport.setRemoteStreamStatsEvtInterval(this,this._handler,this.monitor);case 33:case"end":return e.stop()}}),e,this)}))),function(e){return n.apply(this,arguments)})},{key:"unsubscribePublicStream",value:(t=o(regeneratorRuntime.mark((function e(t){var r,n,i,o;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return AG("unsubscribePublicStream()",t),i={appId:this._appId,streamId:t.streamId},e.prev=2,e.next=5,null===(o=this._dataChannelSignal)||void 0===o?void 0:o.sendSignaling("stopPullStream",i);case 5:e.next=9;break;case 7:e.prev=7,e.t0=e.catch(2);case 9:t.streamState=tG.INIT,t.subVideo=!1,t.subAudio=!1,null===(r=this._handler)||void 0===r||r.handleAck({action:aG.unsubscribe,streamId:t.streamId,audioMid:t.audioMid,videoMid:t.videoMid,stream:t}),null===(n=this._handler)||void 0===n||n.rollback(t.streamId,t),t.clean(),this.removeOnTrackListener(t),t.statsReport.unsubscribe();case 17:case"end":return e.stop()}}),e,this,[[2,7]])}))),function(e){return t.apply(this,arguments)})},{key:"destroy",value:function(){var e,t,r;RG.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="disconnected",this.emit("INTERRUPT")}},{key:"sendUserMessage",value: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})}},{key:"sendRoomMessage",value:function(e){var t;return null===(t=this._dataChannelSignal)||void 0===t?void 0:t.sendSignaling("customMessage",e)}},{key:"_multiChatMode",value:function(){var e;return null===(e=this._roomAttributes)||void 0===e?void 0:e.multiChatMode}},{key:"handler",get:function(){return this._handler}},{key:"roomAttributes",get:function(){return this._roomAttributes},set:function(e){this._roomAttributes=e}}]),C}(dM);function CG(e,t,r){var n=r.value;return r.value=o(regeneratorRuntime.mark((function e(){var r,i,o,a=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this._handler||"connected"!==this._state){e.next=6;break}for(r=a.length,i=new Array(r),o=0;o<r;o++)i[o]=a[o];return e.next=4,n.apply(this,i);case 4:e.next=7;break;case 6:throw new cD(sD.NOT_CONNECTED_YET,"error in ".concat(t,": try again after joined"));case 7:case"end":return e.stop()}}),e,this)}))),r}function OG(e,t,r){var n=r.value;return r.value=o(regeneratorRuntime.mark((function e(){var t,r,i,o,a=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._pubSubLock.lock();case 2:for(t=e.sent,this.supportConcurrent&&t(),e.prev=4,r=a.length,i=new Array(r),o=0;o<r;o++)i[o]=a[o];return e.next=8,n.apply(this,i);case 8:return e.abrupt("return",e.sent);case 9:return e.prev=9,this.supportConcurrent||t(),e.finish(9);case 12:case"end":return e.stop()}}),e,this,[[4,,9,12]])}))),r}kG([function(e,t,r){var n=r.value;return r.value=o(regeneratorRuntime.mark((function e(){var t,r,i,a,s=this,u=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:for(t=u.length,r=new Array(t),i=0;i<t;i++)r[i]=u[i];return a=!1,e.abrupt("return",new Promise(function(){var e=o(regeneratorRuntime.mark((function e(t,i){var o;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return s.on("INTERRUPT",(function(){a=!0,i(new cD(sD.OPERATION_CANCEL,"operation not finish when leave"))})),e.prev=1,e.next=4,n.apply(s,r);case 4:o=e.sent,t(o),e.next=11;break;case 8:e.prev=8,e.t0=e.catch(1),a||i(e.t0);case 11:case"end":return e.stop()}}),e,null,[[1,8]])})));return function(t,r){return e.apply(this,arguments)}}()));case 3:case"end":return e.stop()}}),e)}))),r}],wG.prototype,"join",1),kG([OG,CG],wG.prototype,"publish",1),kG([OG,CG],wG.prototype,"updatePubTrack",1),kG([OG,CG],wG.prototype,"unpublish",1),kG([OG,CG],wG.prototype,"subscribe",1),kG([CG],wG.prototype,"controlMessage",1),kG([CG],wG.prototype,"updateUserAttributes",1),kG([CG],wG.prototype,"updateSubTrack",1),kG([CG],wG.prototype,"subscribe4pushTrack",1),kG([CG],wG.prototype,"unsubscribe4removeTrack",1),kG([OG,CG],wG.prototype,"unsubscribe",1),kG([CG],wG.prototype,"handleRemoveStream",1),kG([OG],wG.prototype,"subscribePublicStream",1),kG([OG],wG.prototype,"unsubscribePublicStream",1);var NG,xG=function(){function e(t,r){a(this,e),c(this,"_audioEventSessionId",CP()),c(this,"_videoEventSessionId",CP()),c(this,"_handler",void 0),c(this,"_stream",void 0),c(this,"_firstAudioFrameTimer",void 0),c(this,"_firstVideoFrameTimer",void 0),c(this,"_transportDelayInterval",void 0),c(this,"_transportDelay",void 0),c(this,"_firstVideoFrameInterval",void 0),c(this,"_firstAudioFrameInterval",void 0),c(this,"_isScreen",!1),c(this,"_audioFirstFrameState",0),c(this,"_videoFirstFrameState",0),c(this,"_timeout",1e4),c(this,"_currentAudioRecv",{startTime:0,eventSessionId:0,type:CV.LOGIN}),c(this,"_currentVideoRecv",{startTime:0,eventSessionId:0,type:CV.LOGIN}),c(this,"_login",!1),c(this,"_unMuteAudio",!1),c(this,"_enableAudio",!1),c(this,"_unMuteVideo",!1),c(this,"_enableVideo",!1),c(this,"_remoteUnmuteAudio",!1),c(this,"_remoteUnmuteVideo",!1),c(this,"_audioExternal",!1),c(this,"_pushAudio",!1),c(this,"_videoExternal",!1),c(this,"_pushVideo",!1),c(this,"_autoSubscribeVideo",!1),c(this,"_autoSubscribeAudio",!1),c(this,"_autoSubscribe",!1),c(this,"_publishVideo",!1),c(this,"_publishAudio",!1),c(this,"_subscribeAudio",!1),c(this,"_subscribeVideo",!1),c(this,"_subscribe",!1),c(this,"_pushTrack",!1),c(this,"_multiChatMode",!1),this._stream=t,this._handler=r,this.getTransportDelay()}var t,r,n,i;return u(e,[{key:"beginRecvFrame",value:(i=o(regeneratorRuntime.mark((function e(t,r){var n,i,o,a,s,u,c,d,l,h,f,p,_,v=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.getTransportDelay();case 2:n=this._transportDelay,i=!0,o=CV.LOGIN,a=CV.UNMUTE,s=CV.SUBSCRIBE,u=CV.PUSH_TRACK,[o,a,s,u].indexOf(r)>=0&&(n=0,i=!1),t===wV.AUDIO?(i||this._audioEventSessionId++,this._currentAudioRecv={startTime:Date.now(),eventSessionId:this._audioEventSessionId,type:r},l={media_type:t,event_type:AV.BEGIN_RECV,type:r,start:null===(c=this._currentAudioRecv)||void 0===c?void 0:c.startTime,event_session_id:this._audioEventSessionId,stream_user_id:null===(d=this._stream)||void 0===d?void 0:d.userId,transport_delay:n},this._firstAudioFrameTimer&&window.clearTimeout(this._firstAudioFrameTimer),this._firstAudioFrameTimer=window.setTimeout((function(){v.stopRecvFrame(wV.AUDIO,OV.TIMEOUT),v._firstAudioFrameInterval&&window.clearInterval(v._firstAudioFrameInterval)}),this._timeout),VV.rtcFirstFrame(l),this._watchForFirstAudioFrameRecv(),this._audioFirstFrameState=1,this._login=!0,this._unMuteAudio=!0,this._enableAudio=!0,this._remoteUnmuteAudio=!0):t===wV.VIDEO&&(i||this._videoEventSessionId++,this._currentVideoRecv={startTime:Date.now(),eventSessionId:this._videoEventSessionId,type:r},_={media_type:null!==(h=this._stream)&&void 0!==h&&h.isScreen?wV.SCREEN_VIDEO:t,event_type:AV.BEGIN_RECV,type:r,start:null===(f=this._currentVideoRecv)||void 0===f?void 0:f.startTime,event_session_id:this._videoEventSessionId,stream_user_id:null===(p=this._stream)||void 0===p?void 0:p.userId,transport_delay:n},this._firstVideoFrameTimer&&window.clearTimeout(this._firstVideoFrameTimer),this._firstVideoFrameTimer=window.setTimeout((function(){v.stopRecvFrame(wV.VIDEO,OV.TIMEOUT),v._firstVideoFrameInterval&&window.clearInterval(v._firstVideoFrameInterval)}),this._timeout),this._watchForFirstVideoFrameRecv(),VV.rtcFirstFrame(_),this._videoFirstFrameState=1,this._login=!0,this._unMuteVideo=!0,this._enableVideo=!0,this._remoteUnmuteVideo=!0);case 7:case"end":return e.stop()}}),e,this)}))),function(e,t){return i.apply(this,arguments)})},{key:"stopRecvFrame",value:function(e,t){if(e===wV.AUDIO){var r,n,i;if(1!==this._audioFirstFrameState)return;var o={event_type:AV.RECV_END,media_type:e,start:null===(r=this._currentAudioRecv)||void 0===r?void 0:r.startTime,reason:t,result:!1,stream_user_id:null===(n=this._stream)||void 0===n?void 0:n.userId,event_session_id:this._audioEventSessionId,type:null===(i=this._currentAudioRecv)||void 0===i?void 0:i.type};this._firstAudioFrameTimer&&window.clearTimeout(this._firstAudioFrameTimer),delete this._currentAudioRecv,VV.rtcFirstFrame(o),this._audioFirstFrameState=2}else if(e===wV.VIDEO){var a,s,u,c;if(1!==this._videoFirstFrameState)return;var d={event_type:AV.RECV_END,media_type:null!==(a=this._stream)&&void 0!==a&&a.isScreen?wV.SCREEN_VIDEO:e,start:null===(s=this._currentVideoRecv)||void 0===s?void 0:s.startTime,reason:t,result:!1,stream_user_id:null===(u=this._stream)||void 0===u?void 0:u.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,VV.rtcFirstFrame(d),this._videoFirstFrameState=2}}},{key:"recvFrameFinish",value:(n=o(regeneratorRuntime.mark((function e(t){var r,n,i,o,a,s,u,c,d,l,h,f,p,_,v,m;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.getTransportDelay();case 2:if(r=this._transportDelay,n=CV.LOGIN,i=CV.UNMUTE,o=CV.SUBSCRIBE,a=CV.PUSH_TRACK,t!==wV.AUDIO){e.next=18;break}if(1===this._audioFirstFrameState){e.next=7;break}return e.abrupt("return");case 7:if(this._currentAudioRecv){e.next=9;break}return e.abrupt("return");case 9:u=this._currentAudioRecv,c=u.type,d=u.startTime,[n,i,o,a].indexOf(c)>=0&&(r=0),l={event_type:AV.RECV_END,media_type:t,start:d,result:!0,stream_user_id:null===(s=this._stream)||void 0===s?void 0:s.userId,event_session_id:this._audioEventSessionId,type:c,transport_delay:r},delete this._currentAudioRecv,this._firstAudioFrameTimer&&window.clearTimeout(this._firstAudioFrameTimer),VV.rtcFirstFrame(l),this._audioFirstFrameState=3,e.next=30;break;case 18:if(t!==wV.VIDEO){e.next=30;break}if(1===this._videoFirstFrameState){e.next=21;break}return e.abrupt("return");case 21:if(this._currentVideoRecv){e.next=23;break}return e.abrupt("return");case 23:p=this._currentVideoRecv,_=p.type,v=p.startTime,[n,i,o,a].indexOf(_)>=0&&(r=0),m={event_type:AV.RECV_END,media_type:null!==(h=this._stream)&&void 0!==h&&h.isScreen?wV.SCREEN_VIDEO:t,start:v,result:!0,stream_user_id:null===(f=this._stream)||void 0===f?void 0:f.userId,event_session_id:this._videoEventSessionId,type:_,transport_delay:r},delete this._currentVideoRecv,this._firstVideoFrameTimer&&window.clearTimeout(this._firstVideoFrameTimer),VV.rtcFirstFrame(m),this._videoFirstFrameState=3;case 30:case"end":return e.stop()}}),e,this)}))),function(e){return n.apply(this,arguments)})},{key:"setLogin",value:function(e){var t,r,n,i,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{audio:!0,video:!0};this._login!==e&&(this._login=e,e&&null!==(t=this._stream)&&void 0!==t&&t.hasAudio&&o.audio&&this.beginRecvFrame(wV.AUDIO,CV.LOGIN),e&&null!==(r=this._stream)&&void 0!==r&&r.hasVideo&&o.video&&this.beginRecvFrame(wV.VIDEO,CV.LOGIN),!e&&null!==(n=this._stream)&&void 0!==n&&n.hasAudio&&this.stopRecvFrame(wV.AUDIO,OV.LEAVE_ROOM),!e&&null!==(i=this._stream)&&void 0!==i&&i.hasVideo&&this.stopRecvFrame(wV.VIDEO,OV.LEAVE_ROOM))}},{key:"setUnmuteAudio",value:function(e){var t;this._unMuteAudio!==e&&(this._unMuteAudio=e,this._unMuteAudio?this.beginRecvFrame(wV.AUDIO,CV.UNMUTE):null!==(t=this._stream)&&void 0!==t&&t.hasAudio&&this.stopRecvFrame(wV.AUDIO,OV.MUTE))}},{key:"setRemoteUnmuteAudio",value:function(e){var t;this._remoteUnmuteAudio!==e&&(this._remoteUnmuteAudio=e,this._remoteUnmuteAudio?this.beginRecvFrame(wV.AUDIO,CV.REMOTE_UNMUTE):null!==(t=this._stream)&&void 0!==t&&t.hasAudio&&this.stopRecvFrame(wV.AUDIO,OV.REMOTE_MUTE))}},{key:"setEnableAudio",value:function(e){var t;this._enableAudio!==e&&(this._enableAudio=e,this._enableAudio?this.beginRecvFrame(wV.AUDIO,CV.ENABLE):null!==(t=this._stream)&&void 0!==t&&t.hasAudio&&this.stopRecvFrame(wV.AUDIO,OV.DISABLE))}},{key:"setUnmuteVideo",value:function(e){var t;this._unMuteVideo!==e&&(this._unMuteVideo=e,this._unMuteVideo?this.beginRecvFrame(wV.VIDEO,CV.UNMUTE):null!==(t=this._stream)&&void 0!==t&&t.hasVideo&&this.stopRecvFrame(wV.VIDEO,OV.MUTE))}},{key:"setRemoteUnmuteVideo",value:function(e){var t;this._remoteUnmuteVideo!==e&&(this._remoteUnmuteVideo=e,this._remoteUnmuteVideo?this.beginRecvFrame(wV.VIDEO,CV.REMOTE_UNMUTE):null!==(t=this._stream)&&void 0!==t&&t.hasAudio&&this.stopRecvFrame(wV.VIDEO,OV.REMOTE_MUTE))}},{key:"setEnableVideo",value:function(e){this._enableVideo!==e&&(this._enableVideo=e,this._enableVideo?this.beginRecvFrame(wV.VIDEO,CV.ENABLE):this.stopRecvFrame(wV.VIDEO,OV.DISABLE))}},{key:"setExternalAudioSource",value:function(e){this._audioExternal=e}},{key:"setPushAudio",value:function(e){var t;this._audioExternal&&this._pushAudio!==e&&(this._pushAudio=e),this._pushAudio&&this.beginRecvFrame(wV.AUDIO,CV.PUSH),!e&&null!==(t=this._stream)&&void 0!==t&&t.hasAudio&&this.beginRecvFrame(wV.AUDIO,CV.PUSH)}},{key:"setExternalVideoSource",value:function(e){this._videoExternal=e}},{key:"setPushVideo",value:function(e){var t;this._videoExternal&&this._pushVideo!==e&&(this._pushVideo=e),this._pushVideo&&this.beginRecvFrame(wV.VIDEO,CV.PUSH),!e&&null!==(t=this._stream)&&void 0!==t&&t.hasVideo&&this.beginRecvFrame(wV.VIDEO,CV.PUSH)}},{key:"setPublishVideo",value:function(e){var t;this._publishVideo!==e&&(this._publishVideo=e),this._publishVideo&&this.beginRecvFrame(wV.VIDEO,CV.PUBLISH),!e&&null!==(t=this._stream)&&void 0!==t&&t.hasVideo&&this.stopRecvFrame(wV.VIDEO,OV.UNPUBLISH)}},{key:"setPublishAudio",value:function(e){var t;this._publishAudio!==e&&(this._publishAudio=e),this._publishAudio&&this.beginRecvFrame(wV.AUDIO,CV.PUBLISH),!e&&null!==(t=this._stream)&&void 0!==t&&t.hasAudio&&this.stopRecvFrame(wV.AUDIO,OV.UNPUBLISH)}},{key:"setAutoSubscribe",value:function(e){this._autoSubscribe=e}},{key:"setAutoSubscribeVideo",value:function(e){this._autoSubscribeVideo=e}},{key:"setAutoSubscribeAudio",value:function(e){this._autoSubscribeAudio=e}},{key:"setSubscribeAudio",value:function(e){var t,r;this._autoSubscribeAudio||this._subscribeAudio===e||(this._subscribe=e,e&&null!==(r=this._stream)&&void 0!==r&&r.hasAudio&&this.beginRecvFrame(wV.AUDIO,CV.SUBSCRIBE));!e&&null!==(t=this._stream)&&void 0!==t&&t.hasAudio&&this.stopRecvFrame(wV.AUDIO,OV.UNSUBSCRIBE)}},{key:"setSubscribeVideo",value:function(e){var t,r;this._autoSubscribeVideo||this._subscribeVideo===e||(this._subscribeVideo=e,e&&null!==(r=this._stream)&&void 0!==r&&r.hasVideo&&this.beginRecvFrame(wV.VIDEO,CV.SUBSCRIBE));!e&&null!==(t=this._stream)&&void 0!==t&&t.hasVideo&&this.stopRecvFrame(wV.VIDEO,OV.UNSUBSCRIBE)}},{key:"setPushTrack",value:function(e){var t;this._pushTrack!==e&&(e&&!this._isScreen&&this.beginRecvFrame(wV.AUDIO,CV.PUSH_TRACK),!e&&null!==(t=this._stream)&&void 0!==t&&t.hasAudio&&this.stopRecvFrame(wV.AUDIO,OV.REMOVE_TRACK))}},{key:"setMultiChatMode",value:function(e){this._multiChatMode=e}},{key:"setTimeout",value:function(e){this._timeout=e}},{key:"_watchForFirstVideoFrameRecv",value:function(){var e=this,t=-1;this._firstVideoFrameInterval=window.setInterval(o(regeneratorRuntime.mark((function r(){var n,i,o,a,s,u,c,d;return regeneratorRuntime.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:if(null===(n=e._handler)||void 0===n||!n.pc||null===(i=e._stream)||void 0===i||null===(o=i.videoTrack)||void 0===o||!o.getTrack()){r.next=11;break}return r.next=3,XF(null===(a=e._handler)||void 0===a?void 0:a.pc,null===(s=e._stream)||void 0===s||null===(u=s.videoTrack)||void 0===u?void 0:u.getTrack());case 3:if(c=r.sent,!((d=c.find((function(e){return"inbound-rtp"===e.type})))&&d.framesReceived>t)){r.next=11;break}if(-1!==t){r.next=9;break}return t=d.framesReceived,r.abrupt("return");case 9:e.recvFrameFinish(wV.VIDEO),window.clearInterval(e._firstVideoFrameInterval);case 11:case"end":return r.stop()}}),r)}))),200)}},{key:"_watchForFirstAudioFrameRecv",value:function(){var e=this,t=-1;this._firstAudioFrameInterval=window.setInterval(o(regeneratorRuntime.mark((function r(){var n,i,o,a,s,u,c,d;return regeneratorRuntime.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:if(null===(n=e._handler)||void 0===n||!n.pc||null===(i=e._stream)||void 0===i||null===(o=i.audioTrack)||void 0===o||!o.getTrack()){r.next=11;break}return r.next=3,XF(null===(a=e._handler)||void 0===a?void 0:a.pc,null===(s=e._stream)||void 0===s||null===(u=s.audioTrack)||void 0===u?void 0:u.getTrack());case 3:if(c=r.sent,!((d=c.find((function(e){return"inbound-rtp"===e.type})))&&d.totalSamplesReceived>t)){r.next=11;break}if(-1!==t){r.next=9;break}return t=d.totalSamplesReceived,r.abrupt("return");case 9:e.recvFrameFinish(wV.AUDIO),window.clearInterval(e._firstAudioFrameInterval);case 11:case"end":return r.stop()}}),r)}))),200)}},{key:"getTransportDelay",value:(r=o(regeneratorRuntime.mark((function e(){var t=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.getTransportDelayIntl();case 2:window.clearInterval(this._transportDelayInterval),this._transportDelayInterval=window.setInterval(o(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,t.getTransportDelayIntl();case 2:case"end":return e.stop()}}),e)}))),2e3);case 4:case"end":return e.stop()}}),e,this)}))),function(){return r.apply(this,arguments)})},{key:"getTransportDelayIntl",value:(t=o(regeneratorRuntime.mark((function e(){var t,r,n,i,o;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(null===(t=this._handler)||void 0===t||!t.pc){e.next=7;break}return e.next=3,XF(null===(r=this._handler)||void 0===r?void 0:r.pc);case 3:n=e.sent,i=n.find((function(e){return"transport"===e.type&&"connected"===e.dtlsState})),(o=n.find((function(e){return"candidate-pair"===e.type&&"succeeded"===e.state&&e.id===(null==i?void 0:i.selectedCandidatePairId)})))&&(this._transportDelay=Math.round(1e3*o.currentRoundTripTime/2));case 7:case"end":return e.stop()}}),e,this)}))),function(){return t.apply(this,arguments)})},{key:"reset",value:function(){this._currentAudioRecv={startTime:0,eventSessionId:0,type:CV.LOGIN},this._currentVideoRecv={startTime:0,eventSessionId:0,type:CV.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}(),DG=function(){function e(t,r){a(this,e),c(this,"_audioEventSessionId",CP()),c(this,"_videoEventSessionId",CP()),c(this,"_pcSessionId",void 0),c(this,"_handler",void 0),c(this,"_firstAudioFrameTimer",void 0),c(this,"_firstVideoFrameTimer",void 0),c(this,"_stream",void 0),c(this,"_firstVideoFrameInterval",void 0),c(this,"_firstAudioFrameInterval",void 0),c(this,"_currentAudioSend",{startTime:0,eventSessionId:0,type:CV.LOGIN}),c(this,"_currentVideoSend",{startTime:0,eventSessionId:0,type:CV.LOGIN}),c(this,"_login",!1),c(this,"_publisher",!1),c(this,"_unMuteAudio",!1),c(this,"_enableAudio",!1),c(this,"_unMuteVideo",!1),c(this,"_enableVideo",!1),c(this,"_audioExternal",!1),c(this,"_pushAudio",!1),c(this,"_videoExternal",!1),c(this,"_pushVideo",!1),c(this,"_autoPublish",!1),c(this,"_publish",!1),c(this,"_timeout",1e4),c(this,"_audioFirstFrameState",0),c(this,"_videoFirstFrameState",0),this._stream=t,this._handler=r}var t,r;return u(e,[{key:"beginSendFrame",value:function(e,t){var r=this;if(e===wV.AUDIO){var n;this._audioEventSessionId++,this._currentAudioSend={startTime:Date.now(),eventSessionId:this._audioEventSessionId,type:t};var i={media_type:e,event_type:AV.BEGIN_SEND,type:t,start:null===(n=this._currentAudioSend)||void 0===n?void 0:n.startTime,event_session_id:this._audioEventSessionId};this._firstAudioFrameTimer&&window.clearTimeout(this._firstAudioFrameTimer),this._firstAudioFrameTimer=window.setTimeout((function(){r.stopSendFrame(wV.AUDIO,OV.TIMEOUT),r._firstAudioFrameInterval&&window.clearInterval(r._firstAudioFrameInterval)}),this._timeout),VV.rtcFirstFrame(i),this._watchForFirstAudioFrameSend(),this._audioFirstFrameState=1,this._login=!0,this._publisher=!0,this._publish=!0,this._unMuteAudio=!0,this._pushAudio||(this._enableAudio=!0)}else if(e===wV.VIDEO){var o,a;this._videoEventSessionId++,this._currentVideoSend={startTime:Date.now(),eventSessionId:this._videoEventSessionId,type:t};var s={media_type:null!==(o=this._stream)&&void 0!==o&&o.isScreen?wV.SCREEN_VIDEO:e,event_type:AV.BEGIN_SEND,type:t,start:null===(a=this._currentVideoSend)||void 0===a?void 0:a.startTime,event_session_id:this._videoEventSessionId};this._firstVideoFrameTimer&&window.clearTimeout(this._firstVideoFrameTimer),this._firstVideoFrameTimer=window.setTimeout((function(){r.stopSendFrame(wV.VIDEO,OV.TIMEOUT),r._firstVideoFrameInterval&&window.clearInterval(r._firstVideoFrameInterval)}),this._timeout),this._watchForFirstVideoFrameSend(),VV.rtcFirstFrame(s),this._videoFirstFrameState=1,this._login=!0,this._publisher=!0,this._publish=!0,this._unMuteVideo=!0,this._pushVideo||(this._enableVideo=!0)}}},{key:"stopSendFrame",value:function(e,t){if(e===wV.AUDIO){var r,n;if(1!==this._audioFirstFrameState)return;var i={event_type:AV.SENT_END,media_type:e,start:null===(r=this._currentAudioSend)||void 0===r?void 0:r.startTime,reason:t,result:!1,event_session_id:this._audioEventSessionId,type:null===(n=this._currentAudioSend)||void 0===n?void 0:n.type};this._firstAudioFrameTimer&&window.clearTimeout(this._firstAudioFrameTimer),delete this._currentAudioSend,VV.rtcFirstFrame(i),this._audioFirstFrameState=2}else if(e===wV.VIDEO){var o,a,s;if(1!==this._videoFirstFrameState)return;var u={event_type:AV.SENT_END,media_type:null!==(o=this._stream)&&void 0!==o&&o.isScreen?wV.SCREEN_VIDEO:e,start:null===(a=this._currentVideoSend)||void 0===a?void 0:a.startTime,reason:t,result:!1,event_session_id:this._videoEventSessionId,type:null===(s=this._currentVideoSend)||void 0===s?void 0:s.type};this._firstVideoFrameTimer&&window.clearTimeout(this._firstVideoFrameTimer),delete this._currentVideoSend,VV.rtcFirstFrame(u),this._videoFirstFrameState=2}}},{key:"sendFrameFinish",value:function(e){if(e===wV.AUDIO){if(1!==this._audioFirstFrameState)return;if(!this._currentAudioSend)return;var t=this._currentAudioSend,r=t.type,n=t.startTime,i={event_type:AV.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),VV.rtcFirstFrame(i),this._audioFirstFrameState=3}else if(e===wV.VIDEO){var o;if(1!==this._videoFirstFrameState)return;if(!this._currentVideoSend)return;var a=this._currentVideoSend,s=a.type,u=a.startTime,c={event_type:AV.SENT_END,media_type:null!==(o=this._stream)&&void 0!==o&&o.isScreen?wV.SCREEN_VIDEO:e,start:u,result:!0,event_session_id:this._videoEventSessionId,type:s};delete this._currentVideoSend,this._firstVideoFrameTimer&&window.clearTimeout(this._firstVideoFrameTimer),VV.rtcFirstFrame(c),this._videoFirstFrameState=3}}},{key:"setLogin",value:function(e){if(this._login!==e){var t,r;if(this._login=e,e)null!==(t=this._stream)&&void 0!==t&&t.videoTrack&&this.beginSendFrame(wV.VIDEO,CV.LOGIN),null!==(r=this._stream)&&void 0!==r&&r.audioTrack&&this.beginSendFrame(wV.AUDIO,CV.LOGIN);!e&&this._audioSending&&this.stopSendFrame(wV.AUDIO,OV.LEAVE_ROOM),!e&&this._videoSending&&this.stopSendFrame(wV.VIDEO,OV.LEAVE_ROOM)}}},{key:"setPublish",value:function(e){if(this._publish!==e){var t,r;if(this._publish=e,e)(null===(t=this._stream)||void 0===t?void 0:t.videoTrack)&&this.beginSendFrame(wV.VIDEO,CV.PUBLISH),(null===(r=this._stream)||void 0===r?void 0:r.audioTrack)&&this.beginSendFrame(wV.AUDIO,CV.PUBLISH);!e&&this._audioSending&&this.stopSendFrame(wV.AUDIO,OV.UNPUBLISH),!e&&this._videoSending&&this.stopSendFrame(wV.VIDEO,OV.UNPUBLISH)}}},{key:"setUnmuteAudio",value:function(e){this._unMuteAudio!==e&&(this._unMuteAudio=e,e&&this.beginSendFrame(wV.AUDIO,CV.UNMUTE),!e&&this._audioSending&&this.stopSendFrame(wV.AUDIO,OV.MUTE))}},{key:"setEnableAudio",value:function(e){this._enableAudio!==e&&(this._enableAudio=e,e&&this.beginSendFrame(wV.AUDIO,CV.ENABLE),!e&&this._audioSending&&this.stopSendFrame(wV.AUDIO,OV.DISABLE))}},{key:"setUnmuteVideo",value:function(e){this._unMuteVideo!==e&&(this._unMuteVideo=e,e&&this.beginSendFrame(wV.VIDEO,CV.UNMUTE),!e&&this._videoSending&&this.stopSendFrame(wV.VIDEO,OV.MUTE))}},{key:"setEnableVideo",value:function(e){this._enableVideo!==e&&(this._enableVideo=e,e&&this.beginSendFrame(wV.VIDEO,CV.ENABLE),!e&&this._videoSending&&this.stopSendFrame(wV.VIDEO,OV.DISABLE))}},{key:"setExternalAudioSource",value:function(e){this._audioExternal!==e&&(this._audioExternal=e,e&&(this._audioSending&&this.stopSendFrame(wV.AUDIO,OV.DISABLE),this._enableAudio=!1),e||(this._audioSending&&this.stopSendFrame(wV.AUDIO,OV.STOP_PUSH),this._pushAudio=!1))}},{key:"setPushAudio",value:function(e){this._pushAudio!==e&&(this._pushAudio=e,e&&this.beginSendFrame(wV.AUDIO,CV.PUSH),!e&&this._audioSending&&this.stopSendFrame(wV.AUDIO,OV.STOP_PUSH))}},{key:"setExternalVideoSource",value:function(e){this._videoExternal!==e&&(this._videoExternal=e,e&&(this._videoSending&&this.stopSendFrame(wV.VIDEO,OV.DISABLE),this._enableVideo=!1),e||(this._videoSending&&this.stopSendFrame(wV.VIDEO,OV.STOP_PUSH),this._pushVideo=!1))}},{key:"setPushVideo",value:function(e){this._pushVideo!==e&&(this._pushVideo=e,e&&this.beginSendFrame(wV.VIDEO,CV.PUSH),!e&&this._videoSending&&this.stopSendFrame(wV.VIDEO,OV.STOP_PUSH))}},{key:"setAutoPublish",value:function(e){this._autoPublish=e}},{key:"setPublisher",value:function(e){this._publisher!==e&&(this._publisher=e,!e&&this._audioSending&&this.stopSendFrame(wV.AUDIO,OV.AUDIENCE),!e&&this._videoSending&&this.stopSendFrame(wV.VIDEO,OV.AUDIENCE))}},{key:"setTimeout",value:function(e){this._timeout=e}},{key:"setPCSessionId",value:function(e){this._pcSessionId=e}},{key:"setHandler",value:function(e){this._handler=e}},{key:"_getFirstVideoFrameStats",value:(r=o(regeneratorRuntime.mark((function e(){var t,r,n,i,o,a,s,u;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(null===(t=this._handler)||void 0===t||!t.pc||null===(r=this._stream)||void 0===r||null===(n=r.videoTrack)||void 0===n||!n.getTrack()){e.next=6;break}return e.next=3,XF(null===(i=this._handler)||void 0===i?void 0:i.pc,null===(o=this._stream)||void 0===o||null===(a=o.videoTrack)||void 0===a?void 0:a.getTrack());case 3:return s=e.sent,u=s.find((function(e){return"outbound-rtp"===e.type})),e.abrupt("return",u);case 6:case"end":return e.stop()}}),e,this)}))),function(){return r.apply(this,arguments)})},{key:"_getFirstAudioFrameStats",value:(t=o(regeneratorRuntime.mark((function e(){var t,r,n,i,o,a,s,u;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(null===(t=this._handler)||void 0===t||!t.pc||null===(r=this._stream)||void 0===r||null===(n=r.audioTrack)||void 0===n||!n.getTrack()){e.next=6;break}return e.next=3,XF(null===(i=this._handler)||void 0===i?void 0:i.pc,null===(o=this._stream)||void 0===o||null===(a=o.audioTrack)||void 0===a?void 0:a.getTrack());case 3:return s=e.sent,u=s.find((function(e){return"outbound-rtp"===e.type})),e.abrupt("return",u);case 6:case"end":return e.stop()}}),e,this)}))),function(){return t.apply(this,arguments)})},{key:"_watchForFirstVideoFrameSend",value:function(){var e=this,t=-1;this._firstVideoFrameInterval=window.setInterval(o(regeneratorRuntime.mark((function r(){var n;return regeneratorRuntime.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return r.next=2,e._getFirstVideoFrameStats();case 2:if(!((n=r.sent)&&n.framesSent>t)){r.next=9;break}if(-1!==t){r.next=7;break}return t=n.framesSent,r.abrupt("return");case 7:e.sendFrameFinish(wV.VIDEO),window.clearInterval(e._firstVideoFrameInterval);case 9:case"end":return r.stop()}}),r)}))),100)}},{key:"_watchForFirstAudioFrameSend",value:function(){var e=this,t=-1;this._firstAudioFrameInterval=window.setInterval(o(regeneratorRuntime.mark((function r(){var n;return regeneratorRuntime.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return r.next=2,e._getFirstAudioFrameStats();case 2:if(!((n=r.sent)&&n.packetsSent>t)){r.next=9;break}if(-1!==t){r.next=7;break}return t=n.packetsSent,r.abrupt("return");case 7:e.sendFrameFinish(wV.AUDIO),window.clearInterval(e._firstAudioFrameInterval);case 9:case"end":return r.stop()}}),r)}))),100)}},{key:"reset",value: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=0,this._videoFirstFrameState=0,this._currentAudioSend={startTime:0,eventSessionId:0,type:CV.LOGIN},this._currentVideoSend={startTime:0,eventSessionId:0,type:CV.LOGIN},window.clearTimeout(this._firstAudioFrameTimer),window.clearTimeout(this._firstVideoFrameTimer),window.clearInterval(this._firstAudioFrameInterval),window.clearInterval(this._firstVideoFrameInterval)}},{key:"destroy",value:function(){this.reset(),delete this._stream,delete this._handler}},{key:"_audioSending",get:function(){return 1===this._audioFirstFrameState}},{key:"_videoSending",get:function(){return 1===this._videoFirstFrameState}}]),e}(),PG=(c(NG={},"audio",{delay:1200,stallRadio:.3}),c(NG,"video",{delay:1200,stallRadio:.6}),c(NG,"screen_audio",{delay:1600,stallRadio:.8}),c(NG,"screen_video",{delay:1600,stallRadio:.8}),NG),MG=function(){function e(){a(this,e),c(this,"_preUplinkStats",new Map),c(this,"_preDownlinkStats",new Map),c(this,"_timer",void 0),c(this,"_delayTimer",void 0),c(this,"_connectionState",IG.CONNECTED),c(this,"reportor",void 0)}return u(e,[{key:"updateUplinkStats",value:function(e){var t=e.audioStats,r=e.videoStats,n=e.isScreen;if(t.sendKBitrate>0&&t.rtt){var i=n?"screen_audio":"audio",o=t.rtt,a=t._fractionLost,s=t._retransmittedRate,u=this._getQosLevel(o,a||0,s||0),c=this._preUplinkStats.get(i)||[u];this._preUplinkStats.set(i,[].concat(S(c),[u]).slice(-2))}if(r.sentKBitrate>0&&r.rtt){var d=n?"screen_video":"video",l=r._fractionLost,h=r.rtt,f=r._sendBandWidth,p=r._retransmittedRate;0===f&&(l=Math.max(.65,l));var _=this._getQosLevel(h,l||0,p||0),v=this._preUplinkStats.get(d)||[_];this._preUplinkStats.set(d,[].concat(S(v),[_]).slice(-2))}this._startNetworkQualityReport()}},{key:"updateDownlinkStats",value:function(e,t){if(t){var r,n,i=this._getStreamActiveState(t),o=i.audioActive,a=i.videoActive,s=e.audioStats,u=e.videoStats,c=e.isScreen,d=e.userId;if(o&&s.rtt)if(0===s.receivedKBitrate)r=z.VBAD;else{var l=s.rtt,h=s.audioLossRate,f=s.stallDuration,p=s.statsInterval,_=s.e2eDelay,v=f/p,m=c?"screen_audio":"audio",g=this._getQosLevel(l,h||0,u._retransmittedRate||0),y=this._getDownlinkQoE(m,v,_);r=this._getNetworkQuality(g,y)}if(a)if(0===u.receivedKBitrate||0===u.rtt)n=z.VBAD;else{var b=u.rtt,E=u.videoLossRate,k=u.stallDuration,R=u.statsInterval,T=u.e2eDelay,I=u._retransmittedRate,A=k/R,w=c?"screen_video":"video",C=this._getQosLevel(b,E||0,I||0),O=this._getDownlinkQoE(w,A,T);n=this._getNetworkQuality(C,O)}var N=r&&n?Math.ceil((r+n)/2):r||n;if(N){var x="".concat(d).concat(c?"_screen":""),D=this._preDownlinkStats.get(x)||[N];this._preDownlinkStats.set(x,[].concat(S(D),[N]).slice(-2)),this._startNetworkQualityReport()}}}},{key:"setConnectionState",value:function(e){this._connectionState=e}},{key:"destroy",value: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()}},{key:"_startNetworkQualityReport",value: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))}},{key:"_reportNetworkQuality",value:function(){var e,t,r=this;if(this._connectionState!==IG.CONNECTED)e=t=z.VBAD;else{var n=this._getBetterQualityAndRemoveOldest("audio","up"),i=this._getBetterQualityAndRemoveOldest("video","up");e=n&&i?Math.ceil((n+i)/2):n||i||this._getBetterQualityAndRemoveOldest("screen_video","up")||this._getBetterQualityAndRemoveOldest("screen_audio","up")||z.UNKNOWN;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)||z.UNKNOWN}this.reportor&&this.reportor(e,t)}},{key:"_getNetworkQuality",value:function(e,t){return 1===t?Math.max(e-2,1):2===t?e:Math.min(e+1,5)}},{key:"_getQosLevel",value:function(e,t,r){var n;return n=e<=250&&t<=.15?1:e<=500&&t<=.3?2:e<=750&&t<=.45?3:e<=1e3&&t<=.6?4:5,r>.5?n=Math.max(n,4):r>.35?n=Math.max(n,3):r>.15&&(n=Math.max(n,2)),n}},{key:"_getUplinkQoE",value:function(e,t){var r=0;switch(e){case"audio":case"video":r=t<.05?1:t<.1?2:3;break;case"screen_video":case"screen_audio":r=t<.04?1:t<.08?2:3}return r}},{key:"_getDownlinkQoE",value:function(e,t,r){var n=PG[e];return t>n.stallRadio||r>n.delay||t>n.stallRadio/2&&r>n.delay/2?3:(t>n.stallRadio/2||n.delay,2)}},{key:"_getBetterQualityAndRemoveOldest",value:function(e,t){var r=z.UNKNOWN,n="up"===t?this._preUplinkStats:this._preDownlinkStats,i=n.get(e);if(i){var o=i.filter((function(e){return e}));o.length>0&&(r=Math.min.apply(Math,S(o))),i.shift(),0===i.length&&n.delete(e)}return r}},{key:"_getStreamActiveState",value:function(e){var t=e.subMediaType,r=e._attributes,n=e.subVideo;return{audioActive:e.subAudio&&MP(t)&&r.localaudio&&r.audiostream,videoActive:n&&UP(t)&&r.localvideo&&r.videostream}}}]),e}(),UG=function(){function e(t){a(this,e),c(this,"_timer",void 0),c(this,"_remoteVideoSizeCache",{}),c(this,"_remoteScreenSizeCache",{}),c(this,"onchange",void 0),this._room=t,this._start()}return u(e,[{key:"destroy",value:function(){this._timer&&(window.clearInterval(this._timer),delete this._timer),this._remoteVideoSizeCache={},this._remoteScreenSizeCache={}}},{key:"_start",value:function(){var e=this;this._timer||(this._timer=window.setInterval((function(){var t={},r={};e._room.remoteStreams.forEach((function(n,i){n.forEach((function(n){var o,a=null===(o=n.videoTrack)||void 0===o?void 0:o.getTrack();if(a){var s=n.isScreen?e._remoteScreenSizeCache:e._remoteVideoSizeCache,u=s[i]||{},c=u.width,d=void 0===c?0:c,l=u.height,h=void 0===l?0:l,f=a.getSettings(),p=f.width,_=void 0===p?0:p,v=f.height,m=void 0===v?0:v;h===m&&d===_||e.onchange&&e.onchange(i,n.isScreen,_,m),delete s[i],(n.isScreen?r:t)[i]={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}(),LG=new uM("SubscribeFallbackManager",2),VG=1e4,FG=function(){function e(t){a(this,e),c(this,"_preDownlinkNetworkQuality",[]),c(this,"_isSubscribeFallbackOrRecover",!1),c(this,"_inSubscribeRecoverChecking",!1),c(this,"_subRecoverCheckTimer",void 0),c(this,"_forbidSubRecover",!1),c(this,"_forbidSubRecoverTimer",void 0),c(this,"_forbidSubRecoverDuration",VG),c(this,"onSubscribeFallback",void 0),this._room=t}var t;return u(e,[{key:"updateNetworkQuality",value:function(e,t){this._preDownlinkNetworkQuality.push(t),this._preDownlinkNetworkQuality=this._preDownlinkNetworkQuality.slice(-10),this._inSubscribeRecoverChecking&&this._preDownlinkNetworkQuality.find((function(e){return e===z.BAD||e===z.VBAD}))&&this._startForbidSubRecover(),this._preDownlinkNetworkQuality.slice(-3).reduce((function(e,t){return e+t}),0)>3*z.POOR&&this._subscribeFallbackOrRecover("fallback"),!this._forbidSubRecover&&10===this._preDownlinkNetworkQuality.length&&this._preDownlinkNetworkQuality.every((function(e){return e===z.EXCELLENT}))&&this._subscribeFallbackOrRecover("recover")}},{key:"destroy",value:function(){this._stopSubscribeRecoverCheck(),this._stopForbidSubRecover(),delete this.onSubscribeFallback}},{key:"_subscribeFallbackOrRecover",value:(t=o(regeneratorRuntime.mark((function e(t){var r,n,i,o,a,s,u,c,d,l,h=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this._isSubscribeFallbackOrRecover&&this._room.connectionState===IG.CONNECTED){e.next=2;break}return e.abrupt("return");case 2:if(this._room.subscribeFallbackOption!==G.AUDIO_ONLY&&this._room.subscribeFallbackOption!==G.VIDEO_STREAM_LOW){e.next=24;break}if(r=new Map,this._room.remoteStreams.forEach((function(e){e.forEach((function(e){if(e.hasSubscribed){var n="fallback"===t?e.getSubscribeFallbackParams(h._room.subscribeFallbackOption):e.getSubscribeRecoverParams();if(n){var i=e.getStreamPriority(),o=r.get(i)||[];o.push({stream:e,fallbackOrRecoverOption:n}),r.set(i,o)}}}))})),!(r.size>0)){e.next=24;break}if(LG.print("_subscribeFallbackOrRecover()","start subscribe ".concat(t,".")),n=Array.from(r.keys()).sort((function(e,t){return e-t}))["fallback"===t?0:r.size-1],i=r.get(n)||[],o=y(i,1),!(a=o[0])){e.next=24;break}return s=a.stream,u=a.fallbackOrRecoverOption,this._isSubscribeFallbackOrRecover=!0,c=s.subLayer.spatialLayer,d=s.subVideo,LG.print("_subscribeFallbackOrRecover()","".concat(s.userId,"'s stream will be ").concat(t," to: MediaType=").concat(u[0]," subState=").concat(u[1]," subLayer=").concat(u[2])),e.prev=15,e.next=18,DP([(l=this._room).updateSubTrack.apply(l,[s].concat(S(u))).then((function(){"recover"===t?h._startSubscribeRecoverCheck():LG.print("_subscribeFallbackOrRecover()","fallback success."),h.onSubscribeFallback&&h.onSubscribeFallback({userId:s.userId,isScreen:s.isScreen,beforeEnable:d,beforeVideoIndex:c,afterEnable:s.subVideo,afterVideoIndex:s.subLayer.spatialLayer,reason:"fallback"===t?K.SubscribeFallbackByBandwidth:K.SubscribeRecoverByBandwidth})})),IP(2e3)]);case 18:e.next=22;break;case 20:e.prev=20,e.t0=e.catch(15);case 22:this._preDownlinkNetworkQuality=[],this._isSubscribeFallbackOrRecover=!1;case 24:case"end":return e.stop()}}),e,this,[[15,20]])}))),function(e){return t.apply(this,arguments)})},{key:"_startSubscribeRecoverCheck",value:function(){var e=this;this._stopSubscribeRecoverCheck(),this._inSubscribeRecoverChecking=!0,this._subRecoverCheckTimer=window.setTimeout((function(){e._inSubscribeRecoverChecking=!1,e._forbidSubRecoverDuration=VG,delete e._subRecoverCheckTimer,LG.print("_subscribeFallbackOrRecover()","recover success.")}),2e4)}},{key:"_stopSubscribeRecoverCheck",value:function(){this._subRecoverCheckTimer&&(window.clearTimeout(this._subRecoverCheckTimer),delete this._subRecoverCheckTimer),this._inSubscribeRecoverChecking=!1}},{key:"_startForbidSubRecover",value:function(){var e=this;this._stopSubscribeRecoverCheck(),this._stopForbidSubRecover(),this._forbidSubRecoverDuration=Math.min(this._forbidSubRecoverDuration+2e4,12e4),LG.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)}},{key:"_stopForbidSubRecover",value:function(){this._forbidSubRecoverTimer&&(window.clearTimeout(this._forbidSubRecoverTimer),delete this._forbidSubRecoverTimer)}}]),e}(),BG=new uM("Room",1),jG=function(e){d(L,e);var t,n,i,s,l,h,f,_,m,g,S,b,E,R,T,A,w,C,N,x,M=v(L);function L(e,t){var r;return a(this,L),c(p(r=M.call(this)),"_mediaServerClient",void 0),c(p(r),"_localStream",void 0),c(p(r),"_localScreenStream",void 0),c(p(r),"_remoteUsers",new Map),c(p(r),"_remoteStreams",new Map),c(p(r),"_joinResolveCallback",void 0),c(p(r),"_joinRejectCallback",void 0),c(p(r),"_getAccessNode",void 0),c(p(r),"_getAccessFeedback",void 0),c(p(r),"_getAccessFeedbackIceNode",void 0),c(p(r),"_reconnectTimer",void 0),c(p(r),"_isReconnecting",void 0),c(p(r),"_context",void 0),c(p(r),"_sessionId",void 0),c(p(r),"_reconnectRecord",void 0),c(p(r),"_connectionLostTimer",void 0),c(p(r),"_liveControlMessage",void 0),c(p(r),"_serverConfig",void 0),c(p(r),"_roomConfig",void 0),c(p(r),"_roomInfo",void 0),c(p(r),"_waitForNewToken",!1),c(p(r),"_userDuplicateLoginTimerMap",new Map),c(p(r),"_networkQualityManager",void 0),c(p(r),"userPriorityMap",void 0),c(p(r),"subscribeFallbackOption",void 0),c(p(r),"_videoSizeObserver",void 0),c(p(r),"_subFallbackManager",void 0),c(p(r),"_hasPublished",!1),r._roomConfig=e,r._mediaServerClient=new wG(t),r._reconnectRecord=new GG,r._addHandlerEventHandler(),r._isReconnecting=!1,r._networkQualityManager=new MG,r._networkQualityManager.reportor=r._reportNetworkQuality.bind(p(r)),r._videoSizeObserver=new UG(p(r)),r._videoSizeObserver.onchange=r._emitVideoSizeChange.bind(p(r)),r._subFallbackManager=new FG(p(r)),r._subFallbackManager.onSubscribeFallback=r._emitSubscribeFallback.bind(p(r)),r._context=t,r}return u(L,[{key:"hasScreenPublished",get:function(){var e;return null===(e=this._localScreenStream)||void 0===e?void 0:e.hasPublished}},{key:"hasPublished",get:function(){var e;return null===(e=this._localStream)||void 0===e?void 0:e.hasPublished}},{key:"connectionState",get:function(){return this._mediaServerClient.connectionState}},{key:"remoteUsers",get:function(){return this._remoteUsers}},{key:"remoteStreams",get:function(){return this._remoteStreams}},{key:"localStream",get:function(){return this._localStream}},{key:"localScreenStream",get:function(){return this._localScreenStream}},{key:"roomInfo",get:function(){return this._roomInfo}},{key:"_addHandlerEventHandler",value:function(){var e,t,r,n,i,o,a,s,u,c,d,l,h,f,p,_,v,m,g,y,S,b,E,k,R=this;null===(e=this._mediaServerClient)||void 0===e||e.on(gF.ON_ADD_STREAM,this._onAddStream.bind(this)),null===(t=this._mediaServerClient)||void 0===t||t.on(gF.ON_REMOVE_STREAM,this._onRemoveStream.bind(this)),null===(r=this._mediaServerClient)||void 0===r||r.on(gF.USER_CONNECTION,this._onUserConnection.bind(this)),null===(n=this._mediaServerClient)||void 0===n||n.on(gF.USER_DISCONNECTION,this._onUserDisconnection.bind(this)),null===(i=this._mediaServerClient)||void 0===i||i.on(gF.ON_UPDATE_ROOM_ATTRIBUTES,this._onUpdateRoomAttributes.bind(this)),null===(o=this._mediaServerClient)||void 0===o||o.on(gF.ON_UPDATE_USER_ATTRIBUTES,this._onUpdateUserAttributes.bind(this)),null===(a=this._mediaServerClient)||void 0===a||a.on(gF.ON_UPDATE_STREAM_ATTRIBUTES,this._onUpdateStreamAttributes.bind(this)),null===(s=this._mediaServerClient)||void 0===s||s.on(gF.ON_PUSH_TRACK,this._onPushTrack.bind(this)),null===(u=this._mediaServerClient)||void 0===u||u.on(gF.ON_REMOVE_TRACK,this._onRemoveTrack.bind(this)),null===(c=this._mediaServerClient)||void 0===c||c.on(gF.NODE_CHANGE,this._nodeChange.bind(this)),null===(d=this._mediaServerClient)||void 0===d||d.on(gF.ON_CUSTOM_MESSAGE,this._onCustomMessage.bind(this)),null===(l=this._mediaServerClient)||void 0===l||l.on(gF.USER_MESSAGE_RECEIVED,this._onUserMessageReceived.bind(this)),null===(h=this._mediaServerClient)||void 0===h||h.on(gF.USER_BINARY_MESSAGE_RECEIVED,this._onUserBinaryMessageReceived.bind(this)),null===(f=this._mediaServerClient)||void 0===f||f.on(gF.POST_PROCESSING_MESSAGE,this._onPostProcessingMessage.bind(this)),null===(p=this._mediaServerClient)||void 0===p||p.on(gF.ON_USER_TOKEN_WILL_EXPIRE,this._onUserTokenWillExpire.bind(this)),null===(_=this._mediaServerClient)||void 0===_||_.on(gF.STREAM_CONTROL_MESSAGE,this._onStreamControlMessage.bind(this)),null===(v=this._mediaServerClient)||void 0===v||v.on(gF.ON_SCENE_CONFIG,this._onSceneConfig.bind(this)),null===(m=this._mediaServerClient)||void 0===m||m.on(yF.RSCP,this._onPublishOnDemand.bind(this)),null===(g=this._mediaServerClient)||void 0===g||g.on(SF.ON_CONNECTION_STATE_CHANGE,this._onConnectionStateChange.bind(this)),null===(y=this._mediaServerClient)||void 0===y||y.on(SF.ABNORMAL_DISCONNECTION,this._handleAbnormalDisconnection.bind(this)),null===(S=this._mediaServerClient)||void 0===S||S.on("onRemoteStreamStats",(function(e){R._networkQualityManager.updateDownlinkStats(e,R._findRemoteStreamByScreen(e.userId,e.isScreen)),R.emit(Jj.ON_REMOTE_STREAM_STATS,LP(e))})),null===(b=this._mediaServerClient)||void 0===b||b.on("onLocalStreamStats",(function(e){R._networkQualityManager.updateUplinkStats(e),R.emit(Jj.ON_LOCAL_STREAM_STATS,LP(e))})),null===(E=this._mediaServerClient)||void 0===E||E.on("prevIceNode",(function(e){R._getAccessFeedbackIceNode=e})),null===(k=this._mediaServerClient)||void 0===k||k.on("prevIceNode",(function(e){R._getAccessFeedbackIceNode=e}))}},{key:"_removeHandlerEventHandler",value:function(){var e;null===(e=this._mediaServerClient)||void 0===e||e.removeAllListeners()}},{key:"join",value:(x=o(regeneratorRuntime.mark((function e(t,r,n,i,o,a){var s=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return jV.setStats({rtc_app_id:t,room_id:r,user_id:i.userId}),BG.print("join()"),e.abrupt("return",new Promise((function(e,u){var c;s._joinResolveCallback=function(t){var r;VV.joinRoom(xV.END,d,!0,"",{enable_cloud_proxy:null===(r=s._roomInfo)||void 0===r?void 0:r.useCloudProxy}),e(t)},s._joinRejectCallback=function(e){var t;VV.joinRoom(xV.END,d,!1,e.message,{enable_cloud_proxy:null===(t=s._roomInfo)||void 0===t?void 0:t.useCloudProxy}),u(e)},s._liveControlMessage=o,s._roomInfo={appId:t,roomId:r,token:n,userInfo:i,useCloudProxy:a,roomProfile:s._roomConfig.roomProfileType};var d=EP();s.setSessionId(),VV.joinRoom(xV.BEGIN,d,!1,"",{enable_cloud_proxy:null===(c=s._roomInfo)||void 0===c?void 0:c.useCloudProxy}),s._join(s._joinResolveCallback,s._joinRejectCallback,!1)})));case 3:case"end":return e.stop()}}),e)}))),function(e,t,r,n,i,o){return x.apply(this,arguments)})},{key:"_join",value:(N=o(regeneratorRuntime.mark((function e(t,r){var n,i,o,a=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=a.length>2&&void 0!==a[2]&&a[2],i=EP(),BG.print("_join()"),e.prev=3,e.next=6,this._mediaServerClient.join(this._roomInfo,{node:this._getAccessNode,reason:this._getAccessFeedback,sessionId:this._sessionId,feedbackNode:this._getAccessFeedbackIceNode},n,this._liveControlMessage);case 6:o=e.sent,this._mediaServerClient.roomAttributes=o.roomAttributes,this._reconnectRecord.clear(),this._joinResolveCallback=void 0,this._joinRejectCallback=void 0,this._getAccessFeedback=void 0,this._getAccessNode=void 0,"function"==typeof t&&t({users:o.clients,streams:o.streams}),this._isReconnecting=!1,VV.rtcJoinRoom(0,"web","web",EP()-i),this._onJoinSucc(o,n),e.next=23;break;case 19:if(e.prev=19,e.t0=e.catch(3),e.t0.code===sD.OPERATION_CANCEL||"function"!=typeof r){e.next=23;break}return e.abrupt("return",r(e.t0));case 23:case"end":return e.stop()}}),e,this,[[3,19]])}))),function(e,t){return N.apply(this,arguments)})},{key:"publishScreen",value:(C=o(regeneratorRuntime.mark((function e(t,r,n,i,o){var a,s,u,c,d,l,h,f,p,_;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(BG.print("publishScreen()"),this._localScreenStream||(this._localScreenStream=new rG,this._localScreenStream.isScreen=!0,this._mediaServerClient.handler&&(this._localScreenStream.observer=new DG(this._localScreenStream,this._mediaServerClient.handler))),a=!1,s=!1,u=!1,c=!1,!this._localScreenStream.videoTrack&&r?(r instanceof Ij&&(s=!0),a=!0):this._localScreenStream.videoTrack&&!r&&(a=!1),!this._localScreenStream.audioTrack&&n?(n instanceof Aj&&(c=!0),u=!0):this._localScreenStream.audioTrack&&!n&&(u=!1),this._localScreenStream.videoTrack=r,this._localScreenStream.audioTrack=n,this._localScreenStream.videoEncodeConfig=t,i&&(MP(i)&&(this._localScreenStream.pubAudio=o===Zj.PUB),UP(i)&&(this._localScreenStream.pubVideo=o===Zj.PUB),BG.print("publishScreen mediaType","pubAudio: %o, pubVideo: %o",this._localScreenStream.pubAudio,this._localScreenStream.pubVideo)),this._localScreenStream.pubAudio||this._localScreenStream.pubVideo){e.next=18;break}if(null===(d=this._localScreenStream)||void 0===d||!d.hasPublished){e.next=17;break}return e.abrupt("return",this.unpublishScreen());case 17:return e.abrupt("return");case 18:if(this._localScreenStream.hasPublished){e.next=24;break}return null===(l=this._localScreenStream.observer)||void 0===l||l.setPublish(!0),e.next=22,this._mediaServerClient.publish(this._localScreenStream);case 22:e.next=28;break;case 24:return s?null===(h=this._localScreenStream.observer)||void 0===h||h.setPushVideo(a):null===(f=this._localScreenStream.observer)||void 0===f||f.setEnableVideo(a),c?null===(p=this._localScreenStream.observer)||void 0===p||p.setPushAudio(u):null===(_=this._localScreenStream.observer)||void 0===_||_.setEnableAudio(u),e.next=28,this.updatePubScreenTrack();case 28:case"end":return e.stop()}}),e,this)}))),function(e,t,r,n,i){return C.apply(this,arguments)})},{key:"updatePubScreenTrack",value:(w=o(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(BG.print("updatePubScreenTrack","Invoke updatePubScreenTrack"),!this._localScreenStream){e.next=4;break}return e.next=4,this._mediaServerClient.updatePubTrack(this._localScreenStream);case 4:case"end":return e.stop()}}),e,this)}))),function(){return w.apply(this,arguments)})},{key:"unpublishScreen",value:(A=o(regeneratorRuntime.mark((function e(){var t;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(BG.print("unpublish","Invoke unpublishScreen"),!this._localScreenStream){e.next=7;break}return null===(t=this._localScreenStream.observer)||void 0===t||t.setPublish(!1),e.next=5,this._mediaServerClient.unpublish(this._localScreenStream);case 5:this._localScreenStream.clean(),this._localScreenStream=void 0;case 7:case"end":return e.stop()}}),e,this)}))),function(){return A.apply(this,arguments)})},{key:"liveControlMessage",value:(T=o(regeneratorRuntime.mark((function e(t){var r,n=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return BG.print("controlMessage","Invoke controlMessage"),null===(r=t.transcodeMeta)||void 0===r||r.layout.regions.forEach((function(e){n.roomInfo&&(e.roomID=n.roomInfo.roomId)})),this._liveControlMessage=t,e.next=5,this._mediaServerClient.controlMessage(t);case 5:"stopped"===t.action&&delete this._liveControlMessage;case 6:case"end":return e.stop()}}),e,this)}))),function(e){return T.apply(this,arguments)})},{key:"publicStreamControlMessage",value:(R=o(regeneratorRuntime.mark((function e(t){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return"stopped"===t.action&&delete t.publicStreamMeta,e.next=3,this._mediaServerClient.controlMessage(t);case 3:case"end":return e.stop()}}),e,this)}))),function(e){return R.apply(this,arguments)})},{key:"updateUserAttributes",value:(E=o(regeneratorRuntime.mark((function e(t){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return BG.print("updateUserAttributes","Invoke updateUserAttributes"),t.role&&this._roomInfo&&(this._roomInfo.userInfo.role=t.role),e.next=4,this._mediaServerClient.updateUserAttributes(t);case 4:case"end":return e.stop()}}),e,this)}))),function(e){return E.apply(this,arguments)})},{key:"publish",value:(b=o(regeneratorRuntime.mark((function e(t,r,n,i,o,a){var s,u,c,d,l,h,f,p,_,v,m,g,y=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(s=y.length>6&&void 0!==y[6]&&y[6],BG.print("publish","Invoke publish"),u=!1,this._localStream||(this._localStream=new rG,this._mediaServerClient.handler&&(this._localStream.observer=new DG(this._localStream,this._mediaServerClient.handler)),u=!0),this._localStream.videoTrack=n,this._localStream.audioTrack=i,this._localStream.videoEncodeConfig=t,this._localStream.enableSimulcast=r,o&&(MP(o)&&(this._localStream.pubAudio=a===Zj.PUB),UP(o)&&(this._localStream.pubVideo=a===Zj.PUB),BG.print("publish mediaType","pubAudio: %o, pubVideo: %o",this._localStream.pubAudio,this._localStream.pubVideo)),this._localStream.hasPublished){e.next=26;break}if(this._localStream.pubAudio||this._localStream.pubVideo){e.next=12;break}return e.abrupt("return");case 12:return e.prev=12,s?null===(c=this._localStream.observer)||void 0===c||c.setLogin(!0):u&&(d=!!this._localStream.videoTrack,l=!!this._localStream.audioTrack,h=this._localStream.videoTrack instanceof Ij,f=this._localStream.audioTrack instanceof Aj,this._roomConfig.isAutoPublish&&!this._hasPublished?(d&&(h?null===(p=this._localStream.observer)||void 0===p||p.setPushVideo(!0):null===(_=this._localStream.observer)||void 0===_||_.setEnableVideo(!0)),l&&(f?null===(v=this._localStream.observer)||void 0===v||v.setPushAudio(!0):null===(m=this._localStream.observer)||void 0===m||m.setEnableAudio(!0))):null===(g=this._localStream.observer)||void 0===g||g.setPublish(!0)),e.next=16,this._mediaServerClient.publish(this._localStream);case 16:this._hasPublished=!0,this.emit(Jj.ON_PUBLISH_RESULT,{isScreen:!1,state:O.PUBLISH_SUCC}),e.next=24;break;case 20:throw e.prev=20,e.t0=e.catch(12),this.emit(Jj.ON_PUBLISH_RESULT,{isScreen:!1,state:O.PUBLISH_FAIL}),e.t0;case 24:e.next=28;break;case 26:return e.next=28,this.updatePubTrack();case 28:case"end":return e.stop()}}),e,this,[[12,20]])}))),function(e,t,r,n,i,o){return b.apply(this,arguments)})},{key:"updatePubTrack",value:(S=o(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(BG.print("updatePubTrack","Invoke updatePubTrack"),!this._localStream){e.next=4;break}return e.next=4,this._mediaServerClient.updatePubTrack(this._localStream);case 4:case"end":return e.stop()}}),e,this)}))),function(){return S.apply(this,arguments)})},{key:"unpublish",value:(g=o(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(BG.print("unpublish","Invoke unpublish"),!this._localStream){e.next=6;break}return e.next=4,this._mediaServerClient.unpublish(this._localStream);case 4:this._localStream.clean(),this._localStream=void 0;case 6:case"end":return e.stop()}}),e,this)}))),function(){return g.apply(this,arguments)})},{key:"subscribe",value:(m=o(regeneratorRuntime.mark((function e(t,r,n){var i;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return BG.print("subscribe","remoteStream %o",t),i=void 0,n&&(i=this._getSubLayer(n,t)),e.next=5,this._mediaServerClient.subscribe(t,r,i);case 5:case"end":return e.stop()}}),e,this)}))),function(e,t,r){return m.apply(this,arguments)})},{key:"updateSubTrack",value:(_=o(regeneratorRuntime.mark((function e(t,r,n,i){var o;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return BG.print("updateSubTrack","Invoke updateSubTrack"),e.abrupt("return",null===(o=this._mediaServerClient)||void 0===o?void 0:o.updateSubTrack(t,r,n,i));case 2:case"end":return e.stop()}}),e,this)}))),function(e,t,r,n){return _.apply(this,arguments)})},{key:"updateSubVideoConfig",value:(f=o(regeneratorRuntime.mark((function e(t,r){var n,i,o,a,s;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if((a=this._findRemoteStreamByScreen(t,!1))&&a.hasSubscribed&&!((null==a||null===(n=a.attributes)||void 0===n||null===(i=n.videoDescriptions)||void 0===i?void 0:i.length)<=1)){e.next=3;break}return e.abrupt("return");case 3:return s=this._getSubLayer(r,a),a.originalStreamIndex=s.spatialLayer,e.abrupt("return",null===(o=this._mediaServerClient)||void 0===o?void 0:o.updateSubTrack(a,a.subMediaType,$j.SUB,s));case 6:case"end":return e.stop()}}),e,this)}))),function(e,t){return f.apply(this,arguments)})},{key:"_getSubLayer",value:function(e,t){for(var r,n,i,o,a,s=null==t?void 0:t.attributes,u=s.videoDescriptions,c=s.subVideoDescriptions,d=Array.isArray(c)?c:u,l=-1,h=e.width*e.height,f=0;f<(null==d?void 0:d.length);f++){var p,_;if(h>=(null===(p=d[f])||void 0===p?void 0:p.width)*(null===(_=d[f])||void 0===_?void 0:_.height)){l=f;break}}var v=d[0];if(-1===l)v=d[l=d.length-1];else if(0!==l){var m=d[l-1].width*d[l-1].height,g=(m-h)/(m-d[l].width*d[l].height);v=g<.1?d[l-1]:d[l],l=g<.1?l-1:l}return a=null!==(r=null===(n=v)||void 0===n?void 0:n.sub_index)&&void 0!==r?r:-1,{spatialLayer:null!==(i=null===(o=v)||void 0===o?void 0:o.video_index)&&void 0!==i?i:l,spatialSubLayer:a}}},{key:"unsubscribe",value:(h=o(regeneratorRuntime.mark((function e(t,r){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return BG.print("unsubscribe","Invoke unsubscribe"),e.next=3,this._mediaServerClient.unsubscribe(t,r);case 3:case"end":return e.stop()}}),e,this)}))),function(e,t){return h.apply(this,arguments)})},{key:"leave",value:(l=o(regeneratorRuntime.mark((function e(){var t,r,n,i,o,a,s=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:t=s.length>0&&void 0!==s[0]&&s[0],BG.print("leave","Invoke leave"),r=EP(),e.prev=3,clearTimeout(this._reconnectTimer),n=k(this._remoteStreams.values());try{for(n.s();!(i=n.n()).done;)o=i.value,Array.isArray(o)&&o.forEach((function(e){var t;null===(t=e.observer)||void 0===t||t.setLogin(!1)}))}catch(PU){n.e(PU)}finally{n.f()}return this._localStream&&(null===(a=this._localStream.observer)||void 0===a||a.setLogin(!1)),e.next=10,this._mediaServerClient.leave();case 10:this.destroy(),VV.rtcLeaveRoom(0,"",EP()-r),e.next=22;break;case 14:if(e.prev=14,e.t0=e.catch(3),!t){e.next=20;break}throw e.t0;case 20:this.destroy();case 21:e.t0 instanceof Error&&VV.rtcLeaveRoom(-1,e.t0.message,EP()-r);case 22:case"end":return e.stop()}}),e,this,[[3,14]])}))),function(){return l.apply(this,arguments)})},{key:"setRemoteUserPriority",value:function(e,t){var r,n;null===(r=this.remoteStreams.get(e))||void 0===r||r.forEach((function(e){return e.setRemoteUserPriority(t)})),null===(n=this.userPriorityMap)||void 0===n||n.set(e,t)}},{key:"destroy",value:function(){BG.print("destroy","Invoke destroy"),this._destroyAndInitMediaServerClient(),this._roomInfo=void 0,this._remoteUsers=new Map;var e,t,r,n=k(this._remoteStreams);try{for(n.s();!(e=n.n()).done;){var i=y(e.value,2)[1];Array.isArray(i)&&i.forEach((function(e){e&&e.clean()}))}}catch(PU){n.e(PU)}finally{n.f()}(this._remoteStreams=new Map,this._localStream)&&(null===(t=this._localStream)||void 0===t||t.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 GG,this._removeHandlerEventHandler(),clearTimeout(this._connectionLostTimer),this._userDuplicateLoginTimerMap.forEach((function(e){clearTimeout(e)})),this._userDuplicateLoginTimerMap.clear(),this._networkQualityManager.destroy(),this._videoSizeObserver.destroy(),this._subFallbackManager.destroy()}},{key:"updateToken",value:(s=o(regeneratorRuntime.mark((function e(t){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return BG.print("updateToken","Invoke updateToken"),this._roomInfo&&(this._roomInfo.token=t),e.next=4,this._mediaServerClient.updateToken(t);case 4:case"end":return e.stop()}}),e,this)}))),function(e){return s.apply(this,arguments)})},{key:"pauseAllSubscribedStream",value:(i=o(regeneratorRuntime.mark((function e(t){var r,n,i,o,a=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:r=[],n=k(this._remoteStreams.values());try{for(n.s();!(i=n.n()).done;)o=i.value,Array.isArray(o)&&o.forEach((function(e){if(e.hasSubscribed){var n=a.updateSubTrack(e,t,$j.UNSUB);n&&r.push(n)}}))}catch(PU){n.e(PU)}finally{n.f()}return e.abrupt("return",Promise.all(r));case 4:case"end":return e.stop()}}),e,this)}))),function(e){return i.apply(this,arguments)})},{key:"resumeAllSubscribedStream",value:(n=o(regeneratorRuntime.mark((function e(t){var r,n,i,o,a=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:r=[],n=k(this._remoteStreams.values());try{for(n.s();!(i=n.n()).done;)o=i.value,Array.isArray(o)&&o.forEach((function(e){if(e.hasSubscribed&&e.hasSubscribed){var n=a.updateSubTrack(e,t,$j.SUB);n&&r.push(n)}}))}catch(PU){n.e(PU)}finally{n.f()}return e.abrupt("return",Promise.all(r));case 4:case"end":return e.stop()}}),e,this)}))),function(e){return n.apply(this,arguments)})},{key:"sendUserMessage",value:function(e,t){var r;return null===(r=this._mediaServerClient)||void 0===r?void 0:r.sendUserMessage(e,t)}},{key:"setSessionId",value:function(){this._sessionId=gP(),jV.setStats({rtc_session_id:this._sessionId})}},{key:"sendRoomMessage",value:(t=o(regeneratorRuntime.mark((function e(t){var r,n,i,o,a=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(i=a.length>1&&void 0!==a[1]&&a[1],o={clientId:null===(r=this._roomInfo)||void 0===r?void 0:r.userInfo.userId,binary:i,message:""},!i){e.next=8;break}return e.next=5,TP.ab2b64str(t);case 5:o.message=e.sent,e.next=9;break;case 8:o.message=t;case 9:return e.abrupt("return",null===(n=this._mediaServerClient)||void 0===n?void 0:n.sendRoomMessage(o));case 10:case"end":return e.stop()}}),e,this)}))),function(e){return t.apply(this,arguments)})},{key:"_destroyAndInitMediaServerClient",value:function(){BG.print("_destroyAndInitMediaServerClient()"),this._mediaServerClient&&(this._mediaServerClient.destroy(),this._removeHandlerEventHandler()),this._mediaServerClient=new wG(this._context),this._addHandlerEventHandler()}},{key:"_onJoinSucc",value:function(e,t){var r,n=this;BG.print("JoinSuccess()"),this._serverConfig=e.config;var i=[],o=[],a=[],s=[];null===(r=e.clientsDetail)||void 0===r||r.forEach((function(t){if(t.attributes&&(t.attributes.serverMuteVideo&&n.safeEmit(Jj.ON_VIDEO_STREAM_BANNED,{uid:t.clientId,banned:1===t.attributes.serverMuteVideo}),t.attributes.serverMuteAudio&&n.safeEmit(Jj.ON_AUDIO_STREAM_BANNED,{uid:t.clientId,banned:1===t.attributes.serverMuteAudio})),t.clientId!==e.clientId){var r=n._remoteUsers.get(t.clientId);r?r._stillExist=!0:i.push(t)}}));var u,c=k(this._remoteUsers.values());try{for(c.s();!(u=c.n()).done;){var d=u.value;d._stillExist||o.push({clientId:d.userId}),delete d._stillExist}}catch(PU){c.e(PU)}finally{c.f()}e.streams.forEach((function(e){var t=n._findRemoteStreamByScreen(e.clientId,e.screen);t?(t.stillExist=!0,t.streamId=e.streamId):s.push(e)}));var l,h=k(this._remoteStreams.values());try{for(h.s();!(l=h.n()).done;){var f=l.value;Array.isArray(f)&&f.forEach((function(e){e.stillExist?delete e.stillExist:a.push({clientId:e.userId,streamId:e.streamId,message:vF.clientDisconnected})}))}}catch(PU){h.e(PU)}finally{h.f()}setTimeout((function(){o.forEach((function(e){return n._onUserDisconnection(e)})),i.forEach((function(e){return n._onUserConnection(e)})),a.forEach((function(e){return n._onRemoveStream(e)})),s.forEach((function(e){return n._onAddStream(e,!0,!1)})),t&&n._handleSendOrRecvStreamAfterReconnect()}))}},{key:"_handleSendOrRecvStreamAfterReconnect",value:function(){var e=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){})));var t,r=k(this._remoteStreams.values());try{for(r.s();!(t=r.n()).done;){var n=t.value;Array.isArray(n)&&n.forEach(function(){var t=o(regeneratorRuntime.mark((function t(r){return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!r.hasSubscribed){t.next=15;break}return r.resetHasSubscribed(),t.prev=2,BG.print("start resubscribe ".concat(r.userId," with ").concat(r.subMediaType)),t.next=6,e._mediaServerClient.subscribe(r,r.subMediaType);case 6:BG.print("success resubscribe ".concat(r.userId," with ").concat(r.subMediaType)),e.safeEmit(Jj.RESUBSCRIBE,{stream:r}),t.next=15;break;case 10:t.prev=10,t.t0=t.catch(2),BG.print("failed resubscribe ".concat(r.userId," with ").concat(r.subMediaType,", error:").concat(t.t0)),r.clean(),null==r||r.resetHasSubscribed();case 15:case"end":return t.stop()}}),t,null,[[2,10]])})));return function(e){return t.apply(this,arguments)}}())}}catch(PU){r.e(PU)}finally{r.f()}}},{key:"_findRemoteStream",value:function(e,t){var r=this._remoteStreams.get(e);return Array.isArray(r)?r.find((function(e){return e.streamId===t})):null}},{key:"_findRemoteStreamByScreen",value:function(e,t){var r=this._remoteStreams.get(e);return Array.isArray(r)?r.find((function(e){return e.isScreen===t})):null}},{key:"_onAddStream",value:function(e){var t,r=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];if(e.clientId!==(null===(t=this._roomInfo)||void 0===t?void 0:t.userInfo.userId)){var i=this._findRemoteStream(e.clientId,e.streamId);if(!i){var o;i=new nG(e.clientId,e.streamId,e.screen,e.attributes,null===(o=this.userPriorityMap)||void 0===o?void 0:o.get(e.clientId)),this._initStreamListeners(i);var a=this._remoteStreams.get(e.clientId);a?a.push(i):this._remoteStreams.set(e.clientId,[i])}if(this._mediaServerClient.handler&&(i.observer=new xG(i,this._mediaServerClient.handler)),!i.isScreen){var s,u,c,d,l,h,f,p;if(n&&i.hasVideo)if(i.attributes.extvideo)null===(s=i.observer)||void 0===s||s.setExternalVideoSource(!0),null===(u=i.observer)||void 0===u||u.setPushVideo(!0);else null===(c=i.observer)||void 0===c||c.setExternalVideoSource(!1),null===(d=i.observer)||void 0===d||d.setPublishVideo(!0);if(n&&i.hasAudio&&!this._mediaServerClient.roomAttributes.multiChatMode)if(i.attributes.extaudio)null===(l=i.observer)||void 0===l||l.setExternalAudioSource(!0),null===(h=i.observer)||void 0===h||h.setPushAudio(!0);else null===(f=i.observer)||void 0===f||f.setExternalAudioSource(!1),null===(p=i.observer)||void 0===p||p.setPublishAudio(!0);if(!0===r&&!1===n){var _,v=this._roomConfig,m=v.isAutoSubscribeAudio,g=v.isAutoSubscribeVideo;null===(_=i.observer)||void 0===_||_.setLogin(!0,{audio:!!m,video:!!g})}}return r&&this.safeEmit(gF.ON_ADD_STREAM,{stream:i}),i}}},{key:"_onUserConnection",value:function(e){var t;if(e.clientId!==(null===(t=this._roomInfo)||void 0===t?void 0:t.userInfo.userId)){var n=this._userDuplicateLoginTimerMap.get(e.clientId);if("number"==typeof n)return this._userDuplicateLoginTimerMap.delete(e.clientId),void self.clearTimeout(n);var i={userId:e.clientId,extraInfo:e.attributes.extra_info};this._remoteUsers.set(e.clientId,r({},i)),this.safeEmit(gF.USER_CONNECTION,{userInfo:i}),e.attributes&&(e.attributes.serverMuteVideo&&this.safeEmit(Jj.ON_VIDEO_STREAM_BANNED,{uid:e.clientId,banned:1===e.attributes.serverMuteVideo}),e.attributes.serverMuteAudio&&this.safeEmit(Jj.ON_AUDIO_STREAM_BANNED,{uid:e.clientId,banned:1===e.attributes.serverMuteAudio}))}}},{key:"_onUserDisconnection",value:function(e){var t,r=this,n=e.clientId,i=e.tag,o=e.code;if(n)if(n===(null===(t=this.roomInfo)||void 0===t?void 0:t.userInfo.userId)){var a=null;i===bF.kickedByAdmin?a=sD.KICKED_OUT:i===bF.onUserTokenDidExpire?a=sD.TOKEN_EXPIRED:i===bF.userDuplicateLogin&&(a=sD.DUPLICATE_LOGIN),o===EF.roomDismissByAdmin&&(a=sD.ROOM_DISMISS),a&&this.safeEmit(Jj.ON_ROOM_ERROR,{errorCode:a})}else{var s=I.DROPPED;i===bF.userLeave?s=I.QUIT:i===bF.kickedByAdmin?s=I.KICKED_BY_ADMIN:i===bF.roleChanged&&(s=I.SWITCH_TO_INVISIBLE);var u=function(){r._remoteUsers.delete(n),r.safeEmit(Jj.ON_USER_LEAVE,{userInfo:{userId:n},reason:s})};if(i===bF.userDuplicateLogin){var c=this._userDuplicateLoginTimerMap.get(n);null!=c||self.clearTimeout(c);var d=self.setTimeout(u,5e3);this._userDuplicateLoginTimerMap.set(n,d)}else u()}}},{key:"_onRemoveStream",value:function(e){var t,r=this;if(e.clientId!==(null===(t=this._roomInfo)||void 0===t?void 0:t.userInfo.userId)){var n=this._remoteStreams.get(e.clientId);if(n){var i=n.find((function(t){return t.streamId===e.streamId}));if(i){var o,a,s;if(null===(o=this._mediaServerClient)||void 0===o||o.handleRemoveStream(i,e).then((function(){if(null==i||!i._workaround_1_){var t=r._remoteStreams.get(e.clientId);if(!t)return;t=t.filter((function(t){return t.streamId!==e.streamId})),r._remoteStreams.set(e.clientId,t)}})).finally((function(){r.safeEmit(gF.ON_REMOVE_STREAM,{stream:i,reason:e.message})})),i.hasVideo)null===(a=i.observer)||void 0===a||a.setPublishVideo(!1);if(i.hasAudio&&!this._mediaServerClient.roomAttributes.multiChatMode)null===(s=i.observer)||void 0===s||s.setPublishAudio(!1)}}}}},{key:"_onUpdateUserAttributes",value:function(e){e.attributes&&(e.attributes.serverMuteVideo&&this.safeEmit(Jj.ON_VIDEO_STREAM_BANNED,{uid:e.clientId,banned:1===e.attributes.serverMuteVideo}),e.attributes.serverMuteAudio&&this.safeEmit(Jj.ON_AUDIO_STREAM_BANNED,{uid:e.clientId,banned:1===e.attributes.serverMuteAudio}))}},{key:"_onUpdateRoomAttributes",value:function(e){e.roomAttributes&&(this._mediaServerClient.roomAttributes=e.roomAttributes)}},{key:"_onUpdateStreamAttributes",value:function(e){var t=e.clientId,n=e.streamId,i=e.attributes,o=this._findRemoteStream(t,n);if(o){var a,s,u=o.attributes,c=r(r({},u),i),d=!1,l=c.localaudio!==u.localaudio,h=!1,f=!1,p=c.localvideo!==u.localvideo,_=!1,v=Pj.NONE,m=Pj.NONE;if(c.audiostream!==u.audiostream&&(d=c.localaudio,h=!!c.audiostream,c.audiostream?v|=P.AUDIO:m|=P.AUDIO),c.videostream!==u.videostream&&(f=c.localvideo,_=!!c.videostream,c.videostream?v|=P.VIDEO:m|=P.VIDEO),v&&this.safeEmit(Jj.ON_USER_PUBLISH_STATE_CHANGE,{userId:t,mediaType:v,isScreen:o.isScreen,pubState:Zj.PUB,remoteStream:o}),m&&this.safeEmit(Jj.ON_USER_PUBLISH_STATE_CHANGE,{userId:t,mediaType:m,isScreen:o.isScreen,pubState:Zj.UNPUB,remoteStream:o}),c.localaudio!==u.localaudio)if(c.localaudio){var g,y,S,b;if(c.extaudio)null===(g=o.observer)||void 0===g||g.setExternalAudioSource(!0),null===(y=o.observer)||void 0===y||y.setPushAudio(!0);else null===(S=o.observer)||void 0===S||S.setExternalAudioSource(!1),null===(b=o.observer)||void 0===b||b.setEnableAudio(!0);this.safeEmit(Jj.ON_USER_START_AUDIO_CAPTURE,{userId:t})}else{var E,k,R,T;if(c.extaudio)null===(E=o.observer)||void 0===E||E.setExternalAudioSource(!0),null===(k=o.observer)||void 0===k||k.setPushAudio(!1);else null===(R=o.observer)||void 0===R||R.setExternalAudioSource(!1),null===(T=o.observer)||void 0===T||T.setEnableAudio(!1);!o.isScreen&&this.safeEmit(Jj.ON_USER_STOP_AUDIO_CAPTURE,{userId:t})}if(c.localvideo!==u.localvideo)if(c.localvideo){var I,A,w,C;if(c.extvideo)null===(I=o.observer)||void 0===I||I.setExternalVideoSource(!0),null===(A=o.observer)||void 0===A||A.setPushVideo(!0);else null===(w=o.observer)||void 0===w||w.setExternalVideoSource(!1),null===(C=o.observer)||void 0===C||C.setEnableVideo(!0);this.safeEmit(Jj.ON_USER_START_VIDEO_CAPTURE,{userId:t})}else{var O,N,x,D;if(c.extvideo)null===(O=o.observer)||void 0===O||O.setExternalVideoSource(!0),null===(N=o.observer)||void 0===N||N.setPushVideo(!1);else null===(x=o.observer)||void 0===x||x.setExternalVideoSource(!1),null===(D=o.observer)||void 0===D||D.setEnableVideo(!1);!o.isScreen&&this.safeEmit(Jj.ON_USER_STOP_VIDEO_CAPTURE,{userId:t})}if(d&&!l)null===(a=o.observer)||void 0===a||a.setRemoteUnmuteAudio(h);if(f&&!p)null===(s=o.observer)||void 0===s||s.setRemoteUnmuteVideo(_);o.attributes=c}}},{key:"_onPushTrack",value:function(e){var t=this,r=e.clientId,n=e.streamId,i=this._findRemoteStream(r,n);i||(i=this._onAddStream(e,!1,!1)),this._mediaServerClient.subscribe4pushTrack(i,e).then((function(){return t.safeEmit(Jj.SUBSCRIBE_PUSH_TRACK,{stream:i})})).catch((function(e){BG.print("subscribe push track failed: ".concat(e))}))}},{key:"_onRemoveTrack",value:function(e){var t=this,r=e.clientId,n=e.streamId,i=e.message,o=this._findRemoteStream(r,n);o&&this._mediaServerClient.unsubscribe4removeTrack(o,i).then((function(){if(o._workaround_1_){var e,i=null===(e=t._remoteStreams.get(r))||void 0===e?void 0:e.filter((function(e){return e.streamId!==n}));t._remoteStreams.set(r,i||[])}t.safeEmit(Jj.REMOVE_PUSH_TRACK,{stream:o})})).catch((function(e){BG.print("remove push track failed: ".concat(e))}))}},{key:"_nodeChange",value:function(e){var t,r=e.nodes,n=e.reason;rF.clearAccessNode(null===(t=this._roomInfo)||void 0===t?void 0:t.appId),this._destroyAndInitMediaServerClient(),Array.isArray(r)&&r.length?this._getAccessNode=r[0]:this._getAccessFeedback=n,VV.rtcNodeChange(0,JSON.stringify(e),JSON.stringify(n)),this._joinResolveCallback&&this._joinRejectCallback?this._join(this._joinResolveCallback,this._joinRejectCallback):this._reconnect()}},{key:"_reconnect",value:function(){var e=this;this._isReconnecting=!0;var t,r=k(this._remoteStreams.values());try{for(r.s();!(t=r.n()).done;){var n=t.value;Array.isArray(n)&&n.forEach((function(e){return e.clean()}))}}catch(PU){r.e(PU)}finally{r.f()}VV.rtcReconnect(1002,sV.PEERCONNECTION_RECONNECTING,this._roomInfo.userInfo.userId,uV.PEERCONNECTION),this._join((function(){VV.rtcReconnected(cV.PEERCONNECTION_RECONNECTED,dV.PEERCONNECTION)}),(function(t){e._reconnectRecord.record(t),e._reconnectRecord.shouldReconnect?(BG.print("Reconnecting error, will reconnect after 3s",t),e._reconnectTimer=window.setTimeout(e._reconnect.bind(e),3e3)):(e.safeEmit(Jj.RECONNECT_FAILED),e.destroy())}),!0)}},{key:"_handleAbnormalDisconnection",value:function(){BG.print("on ABNORMAL_DISCONNECTION"),this._destroyAndInitMediaServerClient(),navigator.onLine?this._reconnect():this._reconnectTimer=window.setTimeout(this._reconnect.bind(this),3e3)}},{key:"_onConnectionStateChange",value:function(e){var t,r=this;if(e.next===IG.DISCONNECTED)t=U.CONNECTION_STATE_DISCONNECTED;else if(e.next===IG.CONNECTED)clearTimeout(this._connectionLostTimer),t=this._isReconnecting?U.CONNECTION_STATE_RECONNECTED:U.CONNECTION_STATE_CONNECTED;else{if(e.next!==IG.CONNECTING)return;t=this._isReconnecting?U.CONNECTION_STATE_RECONNECTING:U.CONNECTION_STATE_CONNECTING}e.prev===IG.CONNECTED&&e.next===IG.DISCONNECTED&&(this._connectionLostTimer=window.setTimeout((function(){r.safeEmit(SF.ON_CONNECTION_STATE_CHANGE,{state:U.CONNECTION_STATE_LOST})}),1e4)),this._networkQualityManager.setConnectionState(e.next),this.safeEmit(SF.ON_CONNECTION_STATE_CHANGE,{state:t})}},{key:"_initStreamListeners",value:function(e){var t=this;e.on("ontrack",(function(e){e.track})),e.on("onSEIMessage",(function(r){var n;t.emit(Jj.ON_SEI_MESSAGED_RECEIVED,{sei:r,remoteStreamKey:{userId:e.userId,roomId:null===(n=t._roomInfo)||void 0===n?void 0:n.roomId,streamIndex:e.isScreen?D.STREAM_INDEX_SCREEN:D.STREAM_INDEX_MAIN}})}))}},{key:"_onCustomMessage",value:function(e){this.safeEmit(gF.ON_CUSTOM_MESSAGE,e)}},{key:"_onUserMessageReceived",value:function(e){this.safeEmit(gF.USER_MESSAGE_RECEIVED,{userId:e.from,message:e.msg})}},{key:"_onUserBinaryMessageReceived",value:function(e){this.safeEmit(gF.USER_BINARY_MESSAGE_RECEIVED,{userId:e.from,message:e.msg})}},{key:"_onPostProcessingMessage",value:function(e){if(e.body){var t=e.body,r=t.error||0,n=Qj.START,i=["success","parameter error","subscription timeout","ffmpeg error","cdn error","publish error"];if("2.0"===t.protocol){switch(t.eventType){case"TranscodeStarted":0!==t.error&&(n=Qj.START_FAILED);break;case"TranscodeStateChanged":n=0!==t.error?Qj.START_FAILED:Qj.START_SUCCESS;break;case"TranscodeStopped":n=0!==t.error?Qj.STOP_FAILED:Qj.STOP_SUCCESS;break;case"TranscodeUpdated":n=0!==t.error?Qj.UPDATE_FAILED:Qj.UPDATE_SUCCESS}this.safeEmit(gF.POST_PROCESSING_MESSAGE,{code:r,protocol:t.protocol,error:t.error,eventType:n,message:i[r]})}this.safeEmit(gF.POST_PROCESSING_MESSAGE,{code:r,message:i[r],type:e.type})}}},{key:"_onUserTokenWillExpire",value:function(){this.safeEmit(gF.ON_USER_TOKEN_WILL_EXPIRE,null)}},{key:"_onSceneConfig",value:function(e){var t=e.multiSceneConfig,r=SG[this._roomConfig.roomProfileType][1];if(t){var n,i,o=t[r];if(o&&o.engine_BAC)null===(n=this._context)||void 0===n||n.audioProfileManager.updateEngineBAC(o.engine_BAC);if(o&&o.engine_ANM)null===(i=this._context)||void 0===i||i.audioProfileManager.updateEngineANM(o.engine_ANM)}}},{key:"_onStreamControlMessage",value:function(e){var t,r;e.type===mF.PushLimitWarn&&(null!==(t=this._localStream)&&void 0!==t&&t.pubAudio||null!==(r=this._localStream)&&void 0!==r&&r.pubVideo||this.unpublish())}},{key:"_onPublishOnDemand",value:function(e){var t,r,n,i,o;if(!1!==(null===(t=this._serverConfig)||void 0===t||null===(r=t.engine_VPM)||void 0===r||null===(n=r.ondemand)||void 0===n?void 0:n.enable)&&null!==(i=this._localStream)&&void 0!==i&&i.enableSimulcast&&null!==(o=this._localStream)&&void 0!==o&&o.videoTransceiver){var a,s,u=null===(a=this._localStream)||void 0===a?void 0:a.stream.id,c=null===(s=this._localStream)||void 0===s?void 0:s.videoTransceiver.sender,d=c.getParameters();if(Array.isArray(d.encodings)&&Array.isArray(e)){var l,h,f,p,_={};BG.print("_onPublishOnDemand","usedDescriptions: %o",e),e.forEach((function(e){var t;if(null!=e&&null!==(t=e.StreamIds)&&void 0!==t&&t.includes(u)){var r=null==e?void 0:e.Metadata.SubvideoIndex;_[r]=r}}));var v={};null===(l=this._localStream)||void 0===l||null===(h=l.subVideoDescriptions)||void 0===h||h.forEach((function(e){void 0!==_[e.sub_index]&&(v[e.video_index]=e)}));var m=(null===(f=c.track)||void 0===f||null===(p=f.getSettings())||void 0===p?void 0:p.height)||720,g=[];d.encodings=d.encodings.map((function(e){return e.rid&&(v[e.rid]?(e.active=!0,e.scaleResolutionDownBy=Math.max(m/v[e.rid].height,1),g.push({type:1,rid:e.rid,downBy:e.scaleResolutionDownBy})):(g.push({type:0,rid:e.rid}),e.active=!1)),e})),VV.rtcInvokeStatus(JSON.stringify(g),0,"rscp",u,0)}c.setParameters(d)}}},{key:"_reportNetworkQuality",value:function(e,t){this._subFallbackManager.updateNetworkQuality(e,t),this.emit(Jj.ON_NETWORK_QUALITY,e,t)}},{key:"_emitVideoSizeChange",value:function(e,t,r,n){var i;this.emit(Jj.ON_REMOTE_VIDEO_SIZE_CHANGED,{roomId:null===(i=this.roomInfo)||void 0===i?void 0:i.roomId,userId:e,streamIndex:t?D.STREAM_INDEX_SCREEN:D.STREAM_INDEX_MAIN},{width:r,height:n})}},{key:"_emitSubscribeFallback",value:function(e){this.emit(Jj.ON_SIMULCAST_SUBSCRIBE_FALLBACK,e)}}]),L}(dM),GG=function(){function e(){a(this,e),c(this,"_all_201_count",void 0),c(this,"_has_4xx",void 0),this._all_201_count=0,this._has_4xx=!1}return u(e,[{key:"shouldReconnect",get:function(){return!(this._all_201_count>=3||this._has_4xx)}},{key:"record",value:function(e){var t=!1,r=!1;if(Array.isArray(e)){var n=0;e.map((function(e){var t,i,o;400<=(null===(t=e.error)||void 0===t?void 0:t.code)&&(null===(i=e.error)||void 0===i?void 0:i.code)<500&&(r=!0),201===(null===(o=e.error)||void 0===o?void 0:o.code)&&n++})),n===e.length&&(t=!0),t&&this._all_201_count++,r&&(this._has_4xx=!0)}}},{key:"clear",value:function(){this._all_201_count=0,this._has_4xx=!1}}]),e}(),HG=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},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=y(e,2),n=t[0],i=t[1];"muted"===n?r.muted=!0:r.setAttribute(n,i)})),r},zG=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return t.id&&(e.id=t.id),t.classList&&t.classList.forEach((function(t){e.classList.add(t)})),t.style&&Object.assign(e.style,t.style),t.attributes&&Object.entries(t.attributes).forEach((function(t){var r=y(t,2),n=r[0],i=r[1];e.setAttribute(n,i)})),e},KG=new uM("Player",0),WG=["play","playing","pause","ended","error","seeking","seeked","waiting","canplay","canplaythrough","durationchange","volumechange","loadedmetadata","loadeddata","loadstart","timeupdate"],XG={playsinline:"","webkit-playsinline":""},qG={playsinline:"","webkit-playsinline":"","x5-playsinline":"","x5-video-player-type":"h5","x-webkit-airplay":"allow",preload:"",muted:""},YG=new(function(){function e(){a(this,e),c(this,"videoCache",[]),c(this,"audioCache",[])}return u(e,[{key:"getOrCreate",value:function(e,t){var r="audio"===e?XG:qG;if("video"===e&&this.videoCache.length>0){var n=this.videoCache.pop();if(n)return zG(n,{style:t,attributes:r}),n}else if("audio"===e&&this.audioCache.length>0){var i=this.audioCache.pop();if(i)return zG(i,{style:t,attributes:r}),i}return HG(e,{style:t,attributes:r})}},{key:"recycle",value:function(e){for(;e.attributes.length>0;)e.removeAttribute(e.attributes[0].name);e instanceof HTMLVideoElement?this.videoCache.push(e):this.audioCache.push(e)}}]),e}()),JG=function(e){d(n,e);var t,r=v(n);function n(e){var t;a(this,n),c(p(t=r.call(this)),"_containerDom",void 0),c(p(t),"_videoDom",void 0),c(p(t),"__cumulativeTime",void 0),c(p(t),"userId",void 0),c(p(t),"renderMode",void 0),c(p(t),"mirrorType",L.MIRROR_TYPE_NONE),c(p(t),"isScreen",void 0),c(p(t),"played",!1),c(p(t),"_emitPlayFailed",!1),c(p(t),"emitVideoEvent",(function(e){var r,n,i={type:"video",rawEvent:e,readyState:(null===(r=t._videoDom)||void 0===r?void 0:r.readyState)||0,userId:t.userId,eventName:e.type,currentTime:(null===(n=t._videoDom)||void 0===n?void 0:n.currentTime)||0,isScreen:t.isScreen};t.emit("playback_event",i)})),c(p(t),"_internalPlay",(function(){var e;if(null!==(e=t._videoDom)&&void 0!==e&&e.paused){var r=t._videoDom.play();null!=r&&r.then&&r.catch((function(e){var r,n;t._emitPlayFailed||(t._emitPlayFailed=!0,VV.rtcError("video autoplay failed, userId: ".concat(t.userId),-1e3),t.emit("playback_event",{type:"video",rawEvent:e,readyState:(null===(r=t._videoDom)||void 0===r?void 0:r.readyState)||0,userId:t.userId,eventName:"autoplay-error",currentTime:(null===(n=t._videoDom)||void 0===n?void 0:n.currentTime)||0}))}))}}));var i=e.renderDom,o=e.userId;t.renderMode=void 0!==e.renderMode?e.renderMode:x.RENDER_MODE_FIT;var s="string"==typeof i?document.getElementById(i):i;if(!s)throw new cD(sD.CANT_FIND_DOM,"can't find dom");return t._containerDom=s,t.userId=o,t.isScreen=!!e.isScreen,t._initVideo(),t}return u(n,[{key:"_initVideo",value:function(){this._videoDom||(this._videoDom=YG.getOrCreate("video",{width:"100%",height:"100%"}),this._videoDom.id="".concat(this.userId,"_").concat(bP()),this.renderMode===x.RENDER_MODE_FIT?this._videoDom.style.objectFit="contain":this._videoDom.style.objectFit="cover",this.mirror(this.mirrorType===L.MIRROR_TYPE_RENDER)),this._containerDom.appendChild(this._videoDom),this._initListeners()}},{key:"_initListeners",value:function(){var e=this;this._videoDom&&WG.forEach((function(t){var r;null===(r=e._videoDom)||void 0===r||r.addEventListener(t,e.emitVideoEvent)}))}},{key:"_removeListeners",value:function(){var e=this;this._videoDom&&(WG.forEach((function(t){var r;null===(r=e._videoDom)||void 0===r||r.removeEventListener(t,e.emitVideoEvent)})),this._videoDom.addEventListener("canplay",this._internalPlay),this._videoDom.addEventListener("loadeddata",this._internalPlay))}},{key:"_recordFrame",value:function(e){var t=this;this.on("playback_event",(function(r){var n,i=e.isScreen?1.5:.5;if("timeupdate"===r.eventName){if(e.isScreen,0===(null===(n=t._videoDom)||void 0===n?void 0:n.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>i;e.recordedVideoFrames.push({playTime:t._videoDom.currentTime,isStall:a,stallCount:a?1:0,stallDuration:o%2e3})}t.__cumulativeTime=t._videoDom.currentTime}}))}},{key:"playVideo",value:(t=o(regeneratorRuntime.mark((function e(t,r){var n,i,o,a,s=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(o=this._videoDom,KG.print("playVideo","play video track: ".concat(this.userId)),!(o&&o.srcObject instanceof MediaStream&&o.srcObject.getTrackById(null===(n=t.getTrack())||void 0===n?void 0:n.id))){e.next=4;break}return e.abrupt("return");case 4:o||(this._initVideo(),o=this._videoDom),KG.print("playVideo","play video by dom: ".concat(null===(i=o)||void 0===i?void 0:i.id)),(a=new MediaStream).addTrack(t.getTrack()),o.srcObject=a,o&&!this._containerDom.contains(o)&&this._containerDom.appendChild(o),o.addEventListener("canplay",this._internalPlay),o.addEventListener("loadeddata",this._internalPlay),setTimeout((function(){return s._internalPlay()})),r&&this._recordFrame(r),this.played=!0;case 15:case"end":return e.stop()}}),e,this)}))),function(e,r){return t.apply(this,arguments)})},{key:"updateSrcObject",value:function(e){var t=e.getTrack();if(t&&this._videoDom){var r=new MediaStream;r.addTrack(t),this._videoDom.srcObject=r}}},{key:"manuallyPlay",value:function(){if(KG.print("Invoke VideoPlayer.manuallyPlay"),this._emitPlayFailed=!1,!this._videoDom)throw new cD(sD.INVALID_PARAMS,"Player not found");return this._videoDom.play()}},{key:"mirror",value:function(e){KG.print("mirror","".concat(this.userId," set mirror: ").concat(e)),this.mirrorType=e?L.MIRROR_TYPE_RENDER:L.MIRROR_TYPE_NONE,this._videoDom&&(this._videoDom.style.transform=e?"rotateY(180deg)":"")}},{key:"stop",value:function(){var e=this._containerDom;KG.print("stop","stop video track: ".concat(this.userId)),this._videoDom&&(this._videoDom.srcObject=null,e&&e.contains(this._videoDom)&&e.removeChild(this._videoDom)),this.__cumulativeTime=void 0,this.played=!1}},{key:"destroy",value:function(){KG.print("destroy","video player: ".concat(this.userId)),this.stop(),g(l(n.prototype),"removeAllListeners",this).call(this),this._removeListeners(),this._videoDom&&(YG.recycle(this._videoDom),delete this._videoDom)}},{key:"domElement",get:function(){return this._videoDom}}]),n}(nM.exports.EventEmitter),QG=function(e){d(i,e);var t,r,n=v(i);function i(e){var t,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{divId:void 0,muted:!1},o=r.divId,s=r.muted;if(a(this,i),c(p(t=n.call(this)),"_containerDom",void 0),c(p(t),"_audioDom",void 0),c(p(t),"_fakeAudioDom",void 0),c(p(t),"userId",void 0),c(p(t),"muted",!1),c(p(t),"_emitPlayFailed",!1),c(p(t),"played",!1),c(p(t),"emitAudioEvent",(function(e){var r,n,i={type:"audio",rawEvent:e,readyState:(null===(r=t._audioDom)||void 0===r?void 0:r.readyState)||0,userId:t.userId,eventName:e.type,currentTime:(null===(n=t._audioDom)||void 0===n?void 0:n.currentTime)||0};t.emit("playback_event",i)})),c(p(t),"_internalPlay",(function(){var e,r;if(XV("_internalPlay",{paused:null===(e=t._audioDom)||void 0===e?void 0:e.paused}),null!==(r=t._audioDom)&&void 0!==r&&r.paused)try{var n=t._audioDom.play();null!=n&&n.then&&n.catch((function(e){t._autoPlayError(e)})).then((function(){XV("_internalPlay successfully",{userId:t.userId})}))}catch(i){t._autoPlayError(i)}})),o){var u=document.getElementById(o);if(!u)throw new cD(sD.CANT_FIND_DOM,"can't find dom");t._containerDom=u}else t._containerDom=document.body;return t.userId=e,t.muted=s,t._initAudio(),t}return u(i,[{key:"_initAudio",value:function(){this._audioDom||(this._audioDom=YG.getOrCreate("audio",{display:"none"}),this._audioDom.volume=this.muted?0:1,this._audioDom.id="".concat(this.userId,"_").concat(bP()),this._containerDom.appendChild(this._audioDom)),this._initListeners()}},{key:"_initListeners",value:function(){var e=this;this._audioDom&&WG.forEach((function(t){var r;null===(r=e._audioDom)||void 0===r||r.addEventListener(t,e.emitAudioEvent)}))}},{key:"_removeListeners",value:function(){var e=this;this._audioDom&&(WG.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))}},{key:"playAudio",value:(r=o(regeneratorRuntime.mark((function e(t){var r,n,i,o,a,s=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(KG.print("playAudio","play audio track: ".concat(this.userId)),!((o=this._audioDom)&&o.srcObject instanceof MediaStream&&o.srcObject.getTrackById(null===(r=t.getTrack())||void 0===r?void 0:r.id))){e.next=4;break}return e.abrupt("return");case 4:o||(this._initAudio(),o=this._audioDom),(a=new MediaStream).addTrack(t.getTrack()),o.srcObject=a,null===(n=o)||void 0===n||n.addEventListener("canplay",this._internalPlay),null===(i=o)||void 0===i||i.addEventListener("loadeddata",this._internalPlay),setTimeout((function(){return s._internalPlay()})),this.played=!0;case 12:case"end":return e.stop()}}),e,this)}))),function(e){return r.apply(this,arguments)})},{key:"_autoPlayError",value:function(e){var t,r;this._emitPlayFailed||(this._emitPlayFailed=!0,VV.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}))}},{key:"manuallyPlay",value:function(){var e;if(KG.print("Invoke AudioPlayer.manuallyPlay"),this._emitPlayFailed=!1,!this._audioDom)throw new cD(sD.INVALID_PARAMS,"Player not found");this._audioDom.volume=1,null===(e=this._fakeAudioDom)||void 0===e||e.play();var t=this._audioDom.play();return null!=t&&t.then?t:Promise.resolve(t)}},{key:"setPlaybackDevice",value:(t=o(regeneratorRuntime.mark((function e(t){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return KG.print("setPlaybackDevice","setPlaybackDevice: ".concat(t)),e.next=3,uj.enumerateAudioPlaybackDevices();case 3:if(e.sent.map((function(e){return e.deviceId})).includes(t)&&this._audioDom&&this._audioDom.setSinkId){e.next=7;break}return e.abrupt("return");case 7:return e.next=9,this._audioDom.setSinkId(t);case 9:case"end":return e.stop()}}),e,this)}))),function(e){return t.apply(this,arguments)})},{key:"stop",value:function(){var e=this._containerDom;KG.print("stopAudio","stop audio track: ".concat(this.userId)),this._audioDom&&(this._audioDom.srcObject=null,e&&e.contains(this._audioDom)&&e.removeChild(this._audioDom)),this._fakeAudioDom&&(this._fakeAudioDom.srcObject=null,this._fakeAudioDom=void 0)}},{key:"domElement",get:function(){return this._audioDom}},{key:"destroy",value:function(){KG.print("destroy","audio player: ".concat(this.userId)),this.stop(),g(l(i.prototype),"removeAllListeners",this).call(this),this._removeListeners(),this._audioDom&&(YG.recycle(this._audioDom),delete this._audioDom)}}]),i}(nM.exports.EventEmitter),ZG=function(){function e(){a(this,e),c(this,"_timer",void 0),c(this,"userMessage",void 0),c(this,"roomMessage",void 0),this.userMessage={},this.roomMessage={},this._setTimer()}return u(e,[{key:"_setTimer",value:function(){var e=this;!function t(){e._reportAndgReset(),clearTimeout(e._timer),e._timer=setTimeout(t,1e4)}()}},{key:"_reportAndgReset",value:function(){this._report(),this._reset()}},{key:"_report",value:function(){var e=this;VV.rtcMessageStatistics(Object.keys(this.userMessage).map((function(t){return e.userMessage[t]})),Object.keys(this.roomMessage).map((function(t){return e.roomMessage[t]})),"")}},{key:"_reset",value:function(){this.userMessage={},this.roomMessage={}}},{key:"_checkInitUserMessage",value: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})}},{key:"_sendUserMessage",value: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++}},{key:"_recvUserMessage",value:function(e,t){this._checkInitUserMessage(e,t),this.userMessage["".concat(t,"-").concat(e)].dc_recv_total++}},{key:"_sendUserFail",value:function(e,t){var r=this.userMessage["".concat(t,"-").concat(e)];r&&r.dc_send_fail++}},{key:"_sendUserAck",value:function(e,t,r,n,i){var o=this.userMessage["".concat(t,"-").concat(e)];o&&(o.dc_send_ack++,o.dc_cost_time+=r,o.dc_cost_s2s+=n||0,o.dc_cost_peer_s2e+=i,o.dc_cost_e2s+=r-(n||0)-i,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))}},{key:"sendRoomMessage",value: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++}},{key:"sendRoomFail",value:function(e){var t=this.roomMessage[e];t&&t.dc_send_fail++}},{key:"sendRoomAck",value: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++)}},{key:"sendP2PMessage",value:function(e,t){this._sendUserMessage(e,DV.P2P,t)}},{key:"recvP2PMessage",value:function(e){this._recvUserMessage(e,DV.P2P)}},{key:"sendP2PFail",value:function(e){this._sendUserFail(e,DV.P2P)}},{key:"sendP2PAck",value:function(e,t,r,n){this._sendUserAck(e,DV.P2P,t,r,n)}},{key:"sendP2POutRoomMessage",value:function(e,t){this._sendUserMessage(e,DV.P2P_OUTSIDE_ROOM,t)}},{key:"recvP2POutRoomMessage",value:function(e){this._recvUserMessage(e,DV.P2P_OUTSIDE_ROOM)}},{key:"sendP2POutRoomFail",value:function(e){this._sendUserFail(e,DV.P2P_OUTSIDE_ROOM)}},{key:"sendP2POutRoomAck",value:function(e,t,r,n){this._sendUserAck(e,DV.P2P_OUTSIDE_ROOM,t,r,n)}},{key:"sendP2serverMessage",value:function(e){this._sendUserMessage("",DV.P2SERVER,e)}},{key:"sendP2serverFail",value:function(){this._sendUserFail("",DV.P2SERVER)}},{key:"sendP2serveAck",value:function(e){this._sendUserAck("",DV.P2SERVER,e,0,0)}},{key:"countP2PMessage",value:function(e,t,r,n,i){this.sendP2PMessage(t,r),e?this.sendP2PAck(t,Date.now()-n,i.s2s_time,i.s2e_time):this.sendP2PFail(t)}},{key:"countRoomMessage",value:function(e,t,r,n){this.sendRoomMessage(t,r),e?this.sendRoomAck(t,Date.now()-n):this.sendRoomFail(t)}},{key:"countUserMessageOutsideRoom",value:function(e,t,r,n,i){this.sendP2POutRoomMessage(t,r),e?this.sendP2POutRoomAck(t,Date.now()-n,i.s2s_time,i.s2e_time):this.sendP2POutRoomFail(t)}},{key:"countServerMessage",value:function(e,t,r){this.sendP2serverMessage(t),e?this.sendP2serveAck(Date.now()-r):this.sendP2serverFail()}},{key:"destroy",value:function(){this._reset(),clearTimeout(this._timer)}}]),e}(),$G="object"==typeof global&&global&&global.Object===Object&&global,eH="object"==typeof self&&self&&self.Object===Object&&self,tH=$G||eH||Function("return this")(),rH=tH.Symbol,nH=Object.prototype,iH=nH.hasOwnProperty,oH=nH.toString,aH=rH?rH.toStringTag:void 0;var sH=Object.prototype.toString;var uH=rH?rH.toStringTag:void 0;function cH(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":uH&&uH in Object(e)?function(e){var t=iH.call(e,aH),r=e[aH];try{e[aH]=void 0;var n=!0}catch(o){}var i=oH.call(e);return n&&(t?e[aH]=r:delete e[aH]),i}(e):function(e){return sH.call(e)}(e)}function dH(e){return null!=e&&"object"==typeof e}var lH=Array.isArray;function hH(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function fH(e){return e}function pH(e){if(!hH(e))return!1;var t=cH(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t}var _H=tH["__core-js_shared__"],vH=function(){var e=/[^.]+$/.exec(_H&&_H.keys&&_H.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}();var mH=Function.prototype.toString;var gH=/^\[object .+?Constructor\]$/,yH=Function.prototype,SH=Object.prototype,bH=yH.toString,EH=SH.hasOwnProperty,kH=RegExp("^"+bH.call(EH).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function RH(e){return!(!hH(e)||(t=e,vH&&vH in t))&&(pH(e)?kH:gH).test(function(e){if(null!=e){try{return mH.call(e)}catch(t){}try{return e+""}catch(t){}}return""}(e));var t}function TH(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 IH=Date.now;var AH,wH,CH,OH=function(){try{var e=function(e,t){var r=function(e,t){return null==e?void 0:e[t]}(e,t);return RH(r)?r:void 0}(Object,"defineProperty");return e({},"",{}),e}catch(t){}}(),NH=OH,xH=NH?function(e,t){return NH(e,"toString",{configurable:!0,enumerable:!1,value:(r=t,function(){return r}),writable:!0});var r}:fH,DH=(AH=xH,wH=0,CH=0,function(){var e=IH(),t=16-(e-CH);if(CH=e,t>0){if(++wH>=800)return arguments[0]}else wH=0;return AH.apply(void 0,arguments)}),PH=DH,MH=/^(?:0|[1-9]\d*)$/;function UH(e,t){var r=typeof e;return!!(t=null==t?9007199254740991:t)&&("number"==r||"symbol"!=r&&MH.test(e))&&e>-1&&e%1==0&&e<t}function LH(e,t,r){"__proto__"==t&&NH?NH(e,t,{configurable:!0,enumerable:!0,value:r,writable:!0}):e[t]=r}function VH(e,t){return e===t||e!=e&&t!=t}var FH=Object.prototype.hasOwnProperty;function BH(e,t,r){var n=e[t];FH.call(e,t)&&VH(n,r)&&(void 0!==r||t in e)||LH(e,t,r)}var jH=Math.max;function GH(e,t){return PH(function(e,t,r){return t=jH(void 0===t?e.length-1:t,0),function(){for(var n=arguments,i=-1,o=jH(n.length-t,0),a=Array(o);++i<o;)a[i]=n[t+i];i=-1;for(var s=Array(t+1);++i<t;)s[i]=n[i];return s[t]=r(a),TH(e,this,s)}}(e,t,fH),e+"")}function HH(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=9007199254740991}function zH(e){return null!=e&&HH(e.length)&&!pH(e)}var KH=Object.prototype;function WH(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||KH)}function XH(e){return dH(e)&&"[object Arguments]"==cH(e)}var qH=Object.prototype,YH=qH.hasOwnProperty,JH=qH.propertyIsEnumerable,QH=XH(function(){return arguments}())?XH:function(e){return dH(e)&&YH.call(e,"callee")&&!JH.call(e,"callee")},ZH=QH;var $H="object"==typeof exports&&exports&&!exports.nodeType&&exports,ez=$H&&"object"==typeof module&&module&&!module.nodeType&&module,tz=ez&&ez.exports===$H?tH.Buffer:void 0,rz=(tz?tz.isBuffer:void 0)||function(){return!1},nz={};nz["[object Float32Array]"]=nz["[object Float64Array]"]=nz["[object Int8Array]"]=nz["[object Int16Array]"]=nz["[object Int32Array]"]=nz["[object Uint8Array]"]=nz["[object Uint8ClampedArray]"]=nz["[object Uint16Array]"]=nz["[object Uint32Array]"]=!0,nz["[object Arguments]"]=nz["[object Array]"]=nz["[object ArrayBuffer]"]=nz["[object Boolean]"]=nz["[object DataView]"]=nz["[object Date]"]=nz["[object Error]"]=nz["[object Function]"]=nz["[object Map]"]=nz["[object Number]"]=nz["[object Object]"]=nz["[object RegExp]"]=nz["[object Set]"]=nz["[object String]"]=nz["[object WeakMap]"]=!1;var iz="object"==typeof exports&&exports&&!exports.nodeType&&exports,oz=iz&&"object"==typeof module&&module&&!module.nodeType&&module,az=oz&&oz.exports===iz&&$G.process,sz=function(){try{var e=oz&&oz.require&&oz.require("util").types;return e||az&&az.binding&&az.binding("util")}catch(t){}}(),uz=sz&&sz.isTypedArray,cz=uz?function(e){return function(t){return e(t)}}(uz):function(e){return dH(e)&&HH(e.length)&&!!nz[cH(e)]},dz=cz,lz=Object.prototype.hasOwnProperty;function hz(e,t){var r=lH(e),n=!r&&ZH(e),i=!r&&!n&&rz(e),o=!r&&!n&&!i&&dz(e),a=r||n||i||o,s=a?function(e,t){for(var r=-1,n=Array(e);++r<e;)n[r]=t(r);return n}(e.length,String):[],u=s.length;for(var c in e)!t&&!lz.call(e,c)||a&&("length"==c||i&&("offset"==c||"parent"==c)||o&&("buffer"==c||"byteLength"==c||"byteOffset"==c)||UH(c,u))||s.push(c);return s}var fz=function(e,t){return function(r){return e(t(r))}}(Object.keys,Object),pz=fz,_z=Object.prototype.hasOwnProperty;function vz(e){return zH(e)?hz(e):function(e){if(!WH(e))return pz(e);var t=[];for(var r in Object(e))_z.call(e,r)&&"constructor"!=r&&t.push(r);return t}(e)}var mz=Object.prototype.hasOwnProperty;function gz(e){if(!hH(e))return function(e){var t=[];if(null!=e)for(var r in Object(e))t.push(r);return t}(e);var t=WH(e),r=[];for(var n in e)("constructor"!=n||!t&&mz.call(e,n))&&r.push(n);return r}var yz,Sz=(yz=function(e,t){!function(e,t,r,n){var i=!r;r||(r={});for(var o=-1,a=t.length;++o<a;){var s=t[o],u=n?n(r[s],e[s],s,r,e):void 0;void 0===u&&(u=e[s]),i?LH(r,s,u):BH(r,s,u)}}(t,function(e){return zH(e)?hz(e,!0):gz(e)}(t),e)},GH((function(e,t){var r=-1,n=t.length,i=n>1?t[n-1]:void 0,o=n>2?t[2]:void 0;for(i=yz.length>3&&"function"==typeof i?(n--,i):void 0,o&&function(e,t,r){if(!hH(r))return!1;var n=typeof t;return!!("number"==n?zH(r)&&UH(t,r.length):"string"==n&&t in r)&&VH(r[t],e)}(t[0],t[1],o)&&(i=n<3?void 0:i,n=1),e=Object(e);++r<n;){var a=t[r];a&&yz(e,a,r,i)}return e}))),bz=Sz;function Ez(e,t){return function(e,t){for(var r=-1,n=null==e?0:e.length,i=Array(n);++r<n;)i[r]=t(e[r],r,e);return i}(t,(function(t){return e[t]}))}function kz(e){return null==e?[]:Ez(e,vz(e))}var Rz=oe,Tz=Zt("iterator"),Iz=!Rz((function(){var e=new URL("b?a=1&b=2&c=3","http://a"),t=e.searchParams,r="";return e.pathname="c%20d",t.forEach((function(e,n){t.delete("b"),r+=n+e})),!t.sort||"http://a/c%20d?a=1&c=3"!==e.href||"3"!==t.get("c")||"a=1"!==String(new URLSearchParams("?a=1"))||!t[Tz]||"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})),Az=ke,wz=2147483647,Cz=/[^\0-\u007E]/,Oz=/[.\u3002\uFF0E\uFF61]/g,Nz="Overflow: input needs wider integers to process",xz=ne.RangeError,Dz=Az(Oz.exec),Pz=Math.floor,Mz=String.fromCharCode,Uz=Az("".charCodeAt),Lz=Az([].join),Vz=Az([].push),Fz=Az("".replace),Bz=Az("".split),jz=Az("".toLowerCase),Gz=function(e){return e+22+75*(e<26)},Hz=function(e,t,r){var n=0;for(e=r?Pz(e/700):e>>1,e+=Pz(e/t);e>455;)e=Pz(e/35),n+=36;return Pz(n+36*e/(e+38))},zz=function(e){var t=[];e=function(e){for(var t=[],r=0,n=e.length;r<n;){var i=Uz(e,r++);if(i>=55296&&i<=56319&&r<n){var o=Uz(e,r++);56320==(64512&o)?Vz(t,((1023&i)<<10)+(1023&o)+65536):(Vz(t,i),r--)}else Vz(t,i)}return t}(e);var r,n,i=e.length,o=128,a=0,s=72;for(r=0;r<e.length;r++)(n=e[r])<128&&Vz(t,Mz(n));var u=t.length,c=u;for(u&&Vz(t,"-");c<i;){var d=wz;for(r=0;r<e.length;r++)(n=e[r])>=o&&n<d&&(d=n);var l=c+1;if(d-o>Pz((wz-a)/l))throw xz(Nz);for(a+=(d-o)*l,o=d,r=0;r<e.length;r++){if((n=e[r])<o&&++a>wz)throw xz(Nz);if(n==o){for(var h=a,f=36;;){var p=f<=s?1:f>=s+26?26:f-s;if(h<p)break;var _=h-p,v=36-p;Vz(t,Mz(Gz(p+_%v))),h=Pz(_/v),f+=36}Vz(t,Mz(Gz(h))),s=Hz(a,l,c==u),a=0,c++}}a++,o++}return Lz(t,"")},Kz=Wi,Wz=ne,Xz=Ke,qz=de,Yz=ke,Jz=Iz,Qz=Xr.exports,Zz=jd,$z=la,eK=pc,tK=wn,rK=Yd,nK=Fe,iK=Ut,oK=_a,aK=co,sK=xr,uK=je,cK=fo,dK=Lo,lK=me,hK=ll,fK=il,pK=ql,_K=AI,vK=Zt("iterator"),mK="URLSearchParams",gK="URLSearchParamsIterator",yK=tK.set,SK=tK.getterFor(mK),bK=tK.getterFor(gK),EK=Xz("fetch"),kK=Xz("Request"),RK=Xz("Headers"),TK=kK&&kK.prototype,IK=RK&&RK.prototype,AK=Wz.RegExp,wK=Wz.TypeError,CK=Wz.decodeURIComponent,OK=Wz.encodeURIComponent,NK=Yz("".charAt),xK=Yz([].join),DK=Yz([].push),PK=Yz("".replace),MK=Yz([].shift),UK=Yz([].splice),LK=Yz("".split),VK=Yz("".slice),FK=/\+/g,BK=Array(4),jK=function(e){return BK[e-1]||(BK[e-1]=AK("((?:%[\\da-f]{2}){"+e+"})","gi"))},GK=function(e){try{return CK(e)}catch(Sq){return e}},HK=function(e){var t=PK(e,FK," "),r=4;try{return CK(t)}catch(Sq){for(;r;)t=PK(t,jK(r--),GK);return t}},zK=/[!'()~]|%20/g,KK={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+"},WK=function(e){return KK[e]},XK=function(e){return PK(OK(e),zK,WK)},qK=eK((function(e,t){yK(this,{type:gK,iterator:hK(SK(e).entries),kind:t})}),"Iterator",(function(){var e=bK(this),t=e.kind,r=e.iterator.next(),n=r.value;return r.done||(r.value="keys"===t?n.key:"values"===t?n.value:[n.key,n.value]),r}),!0),YK=function(e){this.entries=[],this.url=null,void 0!==e&&(uK(e)?this.parseObject(e):this.parseQuery("string"==typeof e?"?"===NK(e,0)?VK(e,1):e:cK(e)))};YK.prototype={type:mK,bindURL:function(e){this.url=e,this.update()},parseObject:function(e){var t,r,n,i,o,a,s,u=fK(e);if(u)for(r=(t=hK(e,u)).next;!(n=qz(r,t)).done;){if(o=(i=hK(sK(n.value))).next,(a=qz(o,i)).done||(s=qz(o,i)).done||!qz(o,i).done)throw wK("Expected sequence with length 2");DK(this.entries,{key:cK(a.value),value:cK(s.value)})}else for(var c in e)iK(e,c)&&DK(this.entries,{key:c,value:cK(e[c])})},parseQuery:function(e){if(e)for(var t,r,n=LK(e,"&"),i=0;i<n.length;)(t=n[i++]).length&&(r=LK(t,"="),DK(this.entries,{key:HK(MK(r)),value:HK(xK(r,"="))}))},serialize:function(){for(var e,t=this.entries,r=[],n=0;n<t.length;)e=t[n++],DK(r,XK(e.key)+"="+XK(e.value));return xK(r,"&")},update:function(){this.entries.length=0,this.parseQuery(this.url.query)},updateURL:function(){this.url&&this.url.update()}};var JK=function(){rK(this,QK);var e=arguments.length>0?arguments[0]:void 0;yK(this,new YK(e))},QK=JK.prototype;if(Zz(QK,{append:function(e,t){pK(arguments.length,2);var r=SK(this);DK(r.entries,{key:cK(e),value:cK(t)}),r.updateURL()},delete:function(e){pK(arguments.length,1);for(var t=SK(this),r=t.entries,n=cK(e),i=0;i<r.length;)r[i].key===n?UK(r,i,1):i++;t.updateURL()},get:function(e){pK(arguments.length,1);for(var t=SK(this).entries,r=cK(e),n=0;n<t.length;n++)if(t[n].key===r)return t[n].value;return null},getAll:function(e){pK(arguments.length,1);for(var t=SK(this).entries,r=cK(e),n=[],i=0;i<t.length;i++)t[i].key===r&&DK(n,t[i].value);return n},has:function(e){pK(arguments.length,1);for(var t=SK(this).entries,r=cK(e),n=0;n<t.length;)if(t[n++].key===r)return!0;return!1},set:function(e,t){pK(arguments.length,1);for(var r,n=SK(this),i=n.entries,o=!1,a=cK(e),s=cK(t),u=0;u<i.length;u++)(r=i[u]).key===a&&(o?UK(i,u--,1):(o=!0,r.value=s));o||DK(i,{key:a,value:s}),n.updateURL()},sort:function(){var e=SK(this);_K(e.entries,(function(e,t){return e.key>t.key?1:-1})),e.updateURL()},forEach:function(e){for(var t,r=SK(this).entries,n=oK(e,arguments.length>1?arguments[1]:void 0),i=0;i<r.length;)n((t=r[i++]).value,t.key,this)},keys:function(){return new qK(this,"keys")},values:function(){return new qK(this,"values")},entries:function(){return new qK(this,"entries")}},{enumerable:!0}),Qz(QK,vK,QK.entries,{name:"entries"}),Qz(QK,"toString",(function(){return SK(this).serialize()}),{enumerable:!0}),$z(JK,mK),Kz({global:!0,forced:!Jz},{URLSearchParams:JK}),!Jz&&nK(RK)){var ZK=Yz(IK.has),$K=Yz(IK.set),eW=function(e){if(uK(e)){var t,r=e.body;if(aK(r)===mK)return t=e.headers?new RK(e.headers):new RK,ZK(t,"content-type")||$K(t,"content-type","application/x-www-form-urlencoded;charset=UTF-8"),dK(e,{body:lK(0,cK(r)),headers:lK(0,t)})}return e};if(nK(EK)&&Kz({global:!0,enumerable:!0,forced:!0},{fetch:function(e){return EK(e,arguments.length>1?eW(arguments[1]):{})}}),nK(kK)){var tW=function(e){return rK(this,TK),new kK(e,arguments.length>1?eW(arguments[1]):{})};TK.constructor=tW,tW.prototype=TK,Kz({global:!0,forced:!0},{Request:tW})}}var rW,nW={URLSearchParams:JK,getState:SK},iW=Wi,oW=ae,aW=Iz,sW=ne,uW=_a,cW=ke,dW=po.f,lW=Xr.exports,hW=Yd,fW=Ut,pW=qg,_W=qD,vW=qo,mW=dd.codeAt,gW=function(e){var t,r,n=[],i=Bz(Fz(jz(e),Oz,"."),".");for(t=0;t<i.length;t++)r=i[t],Vz(n,Dz(Cz,r)?"xn--"+zz(r):r);return Lz(n,".")},yW=fo,SW=la,bW=ql,EW=nW,kW=wn,RW=kW.set,TW=kW.getterFor("URL"),IW=EW.URLSearchParams,AW=EW.getState,wW=sW.URL,CW=sW.TypeError,OW=sW.parseInt,NW=Math.floor,xW=Math.pow,DW=cW("".charAt),PW=cW(/./.exec),MW=cW([].join),UW=cW(1..toString),LW=cW([].pop),VW=cW([].push),FW=cW("".replace),BW=cW([].shift),jW=cW("".split),GW=cW("".slice),HW=cW("".toLowerCase),zW=cW([].unshift),KW="Invalid scheme",WW="Invalid host",XW="Invalid port",qW=/[a-z]/i,YW=/[\d+-.a-z]/i,JW=/\d/,QW=/^0x/i,ZW=/^[0-7]+$/,$W=/^\d+$/,eX=/^[\da-f]+$/i,tX=/[\0\t\n\r #%/:<>?@[\\\]^|]/,rX=/[\0\t\n\r #/:<>?@[\\\]^|]/,nX=/^[\u0000-\u0020]+|[\u0000-\u0020]+$/g,iX=/[\t\n\r]/g,oX=function(e){var t,r,n,i;if("number"==typeof e){for(t=[],r=0;r<4;r++)zW(t,e%256),e=NW(e/256);return MW(t,".")}if("object"==typeof e){for(t="",n=function(e){for(var t=null,r=1,n=null,i=0,o=0;o<8;o++)0!==e[o]?(i>r&&(t=n,r=i),n=null,i=0):(null===n&&(n=o),++i);return i>r&&(t=n,r=i),t}(e),r=0;r<8;r++)i&&0===e[r]||(i&&(i=!1),n===r?(t+=r?":":"::",i=!0):(t+=UW(e[r],16),r<7&&(t+=":")));return"["+t+"]"}return e},aX={},sX=pW({},aX,{" ":1,'"':1,"<":1,">":1,"`":1}),uX=pW({},sX,{"#":1,"?":1,"{":1,"}":1}),cX=pW({},uX,{"/":1,":":1,";":1,"=":1,"@":1,"[":1,"\\":1,"]":1,"^":1,"|":1}),dX=function(e,t){var r=mW(e,0);return r>32&&r<127&&!fW(t,e)?e:encodeURIComponent(e)},lX={ftp:21,file:null,http:80,https:443,ws:80,wss:443},hX=function(e,t){var r;return 2==e.length&&PW(qW,DW(e,0))&&(":"==(r=DW(e,1))||!t&&"|"==r)},fX=function(e){var t;return e.length>1&&hX(GW(e,0,2))&&(2==e.length||"/"===(t=DW(e,2))||"\\"===t||"?"===t||"#"===t)},pX=function(e){return"."===e||"%2e"===HW(e)},_X={},vX={},mX={},gX={},yX={},SX={},bX={},EX={},kX={},RX={},TX={},IX={},AX={},wX={},CX={},OX={},NX={},xX={},DX={},PX={},MX={},UX=function(e,t,r){var n,i,o,a=yW(e);if(t){if(i=this.parse(a))throw CW(i);this.searchParams=null}else{if(void 0!==r&&(n=new UX(r,!0)),i=this.parse(a,null,n))throw CW(i);(o=AW(new IW)).bindURL(this),this.searchParams=o}};UX.prototype={type:"URL",parse:function(e,t,r){var n,i,o,a,s,u=this,c=t||_X,d=0,l="",h=!1,f=!1,p=!1;for(e=yW(e),t||(u.scheme="",u.username="",u.password="",u.host=null,u.port=null,u.path=[],u.query=null,u.fragment=null,u.cannotBeABaseURL=!1,e=FW(e,nX,"")),e=FW(e,iX,""),n=_W(e);d<=n.length;){switch(i=n[d],c){case _X:if(!i||!PW(qW,i)){if(t)return KW;c=mX;continue}l+=HW(i),c=vX;break;case vX:if(i&&(PW(YW,i)||"+"==i||"-"==i||"."==i))l+=HW(i);else{if(":"!=i){if(t)return KW;l="",c=mX,d=0;continue}if(t&&(u.isSpecial()!=fW(lX,l)||"file"==l&&(u.includesCredentials()||null!==u.port)||"file"==u.scheme&&!u.host))return;if(u.scheme=l,t)return void(u.isSpecial()&&lX[u.scheme]==u.port&&(u.port=null));l="","file"==u.scheme?c=wX:u.isSpecial()&&r&&r.scheme==u.scheme?c=gX:u.isSpecial()?c=EX:"/"==n[d+1]?(c=yX,d++):(u.cannotBeABaseURL=!0,VW(u.path,""),c=DX)}break;case mX:if(!r||r.cannotBeABaseURL&&"#"!=i)return KW;if(r.cannotBeABaseURL&&"#"==i){u.scheme=r.scheme,u.path=vW(r.path),u.query=r.query,u.fragment="",u.cannotBeABaseURL=!0,c=MX;break}c="file"==r.scheme?wX:SX;continue;case gX:if("/"!=i||"/"!=n[d+1]){c=SX;continue}c=kX,d++;break;case yX:if("/"==i){c=RX;break}c=xX;continue;case SX:if(u.scheme=r.scheme,i==rW)u.username=r.username,u.password=r.password,u.host=r.host,u.port=r.port,u.path=vW(r.path),u.query=r.query;else if("/"==i||"\\"==i&&u.isSpecial())c=bX;else if("?"==i)u.username=r.username,u.password=r.password,u.host=r.host,u.port=r.port,u.path=vW(r.path),u.query="",c=PX;else{if("#"!=i){u.username=r.username,u.password=r.password,u.host=r.host,u.port=r.port,u.path=vW(r.path),u.path.length--,c=xX;continue}u.username=r.username,u.password=r.password,u.host=r.host,u.port=r.port,u.path=vW(r.path),u.query=r.query,u.fragment="",c=MX}break;case bX:if(!u.isSpecial()||"/"!=i&&"\\"!=i){if("/"!=i){u.username=r.username,u.password=r.password,u.host=r.host,u.port=r.port,c=xX;continue}c=RX}else c=kX;break;case EX:if(c=kX,"/"!=i||"/"!=DW(l,d+1))continue;d++;break;case kX:if("/"!=i&&"\\"!=i){c=RX;continue}break;case RX:if("@"==i){h&&(l="%40"+l),h=!0,o=_W(l);for(var _=0;_<o.length;_++){var v=o[_];if(":"!=v||p){var m=dX(v,cX);p?u.password+=m:u.username+=m}else p=!0}l=""}else if(i==rW||"/"==i||"?"==i||"#"==i||"\\"==i&&u.isSpecial()){if(h&&""==l)return"Invalid authority";d-=_W(l).length+1,l="",c=TX}else l+=i;break;case TX:case IX:if(t&&"file"==u.scheme){c=OX;continue}if(":"!=i||f){if(i==rW||"/"==i||"?"==i||"#"==i||"\\"==i&&u.isSpecial()){if(u.isSpecial()&&""==l)return WW;if(t&&""==l&&(u.includesCredentials()||null!==u.port))return;if(a=u.parseHost(l))return a;if(l="",c=NX,t)return;continue}"["==i?f=!0:"]"==i&&(f=!1),l+=i}else{if(""==l)return WW;if(a=u.parseHost(l))return a;if(l="",c=AX,t==IX)return}break;case AX:if(!PW(JW,i)){if(i==rW||"/"==i||"?"==i||"#"==i||"\\"==i&&u.isSpecial()||t){if(""!=l){var g=OW(l,10);if(g>65535)return XW;u.port=u.isSpecial()&&g===lX[u.scheme]?null:g,l=""}if(t)return;c=NX;continue}return XW}l+=i;break;case wX:if(u.scheme="file","/"==i||"\\"==i)c=CX;else{if(!r||"file"!=r.scheme){c=xX;continue}if(i==rW)u.host=r.host,u.path=vW(r.path),u.query=r.query;else if("?"==i)u.host=r.host,u.path=vW(r.path),u.query="",c=PX;else{if("#"!=i){fX(MW(vW(n,d),""))||(u.host=r.host,u.path=vW(r.path),u.shortenPath()),c=xX;continue}u.host=r.host,u.path=vW(r.path),u.query=r.query,u.fragment="",c=MX}}break;case CX:if("/"==i||"\\"==i){c=OX;break}r&&"file"==r.scheme&&!fX(MW(vW(n,d),""))&&(hX(r.path[0],!0)?VW(u.path,r.path[0]):u.host=r.host),c=xX;continue;case OX:if(i==rW||"/"==i||"\\"==i||"?"==i||"#"==i){if(!t&&hX(l))c=xX;else if(""==l){if(u.host="",t)return;c=NX}else{if(a=u.parseHost(l))return a;if("localhost"==u.host&&(u.host=""),t)return;l="",c=NX}continue}l+=i;break;case NX:if(u.isSpecial()){if(c=xX,"/"!=i&&"\\"!=i)continue}else if(t||"?"!=i)if(t||"#"!=i){if(i!=rW&&(c=xX,"/"!=i))continue}else u.fragment="",c=MX;else u.query="",c=PX;break;case xX:if(i==rW||"/"==i||"\\"==i&&u.isSpecial()||!t&&("?"==i||"#"==i)){if(".."===(s=HW(s=l))||"%2e."===s||".%2e"===s||"%2e%2e"===s?(u.shortenPath(),"/"==i||"\\"==i&&u.isSpecial()||VW(u.path,"")):pX(l)?"/"==i||"\\"==i&&u.isSpecial()||VW(u.path,""):("file"==u.scheme&&!u.path.length&&hX(l)&&(u.host&&(u.host=""),l=DW(l,0)+":"),VW(u.path,l)),l="","file"==u.scheme&&(i==rW||"?"==i||"#"==i))for(;u.path.length>1&&""===u.path[0];)BW(u.path);"?"==i?(u.query="",c=PX):"#"==i&&(u.fragment="",c=MX)}else l+=dX(i,uX);break;case DX:"?"==i?(u.query="",c=PX):"#"==i?(u.fragment="",c=MX):i!=rW&&(u.path[0]+=dX(i,aX));break;case PX:t||"#"!=i?i!=rW&&("'"==i&&u.isSpecial()?u.query+="%27":u.query+="#"==i?"%23":dX(i,aX)):(u.fragment="",c=MX);break;case MX:i!=rW&&(u.fragment+=dX(i,sX))}d++}},parseHost:function(e){var t,r,n;if("["==DW(e,0)){if("]"!=DW(e,e.length-1))return WW;if(t=function(e){var t,r,n,i,o,a,s,u=[0,0,0,0,0,0,0,0],c=0,d=null,l=0,h=function(){return DW(e,l)};if(":"==h()){if(":"!=DW(e,1))return;l+=2,d=++c}for(;h();){if(8==c)return;if(":"!=h()){for(t=r=0;r<4&&PW(eX,h());)t=16*t+OW(h(),16),l++,r++;if("."==h()){if(0==r)return;if(l-=r,c>6)return;for(n=0;h();){if(i=null,n>0){if(!("."==h()&&n<4))return;l++}if(!PW(JW,h()))return;for(;PW(JW,h());){if(o=OW(h(),10),null===i)i=o;else{if(0==i)return;i=10*i+o}if(i>255)return;l++}u[c]=256*u[c]+i,2!=++n&&4!=n||c++}if(4!=n)return;break}if(":"==h()){if(l++,!h())return}else if(h())return;u[c++]=t}else{if(null!==d)return;l++,d=++c}}if(null!==d)for(a=c-d,c=7;0!=c&&a>0;)s=u[c],u[c--]=u[d+a-1],u[d+--a]=s;else if(8!=c)return;return u}(GW(e,1,-1)),!t)return WW;this.host=t}else if(this.isSpecial()){if(e=gW(e),PW(tX,e))return WW;if(t=function(e){var t,r,n,i,o,a,s,u=jW(e,".");if(u.length&&""==u[u.length-1]&&u.length--,(t=u.length)>4)return e;for(r=[],n=0;n<t;n++){if(""==(i=u[n]))return e;if(o=10,i.length>1&&"0"==DW(i,0)&&(o=PW(QW,i)?16:8,i=GW(i,8==o?1:2)),""===i)a=0;else{if(!PW(10==o?$W:8==o?ZW:eX,i))return e;a=OW(i,o)}VW(r,a)}for(n=0;n<t;n++)if(a=r[n],n==t-1){if(a>=xW(256,5-t))return null}else if(a>255)return null;for(s=LW(r),n=0;n<r.length;n++)s+=r[n]*xW(256,3-n);return s}(e),null===t)return WW;this.host=t}else{if(PW(rX,e))return WW;for(t="",r=_W(e),n=0;n<r.length;n++)t+=dX(r[n],aX);this.host=t}},cannotHaveUsernamePasswordPort:function(){return!this.host||this.cannotBeABaseURL||"file"==this.scheme},includesCredentials:function(){return""!=this.username||""!=this.password},isSpecial:function(){return fW(lX,this.scheme)},shortenPath:function(){var e=this.path,t=e.length;!t||"file"==this.scheme&&1==t&&hX(e[0],!0)||e.length--},serialize:function(){var e=this,t=e.scheme,r=e.username,n=e.password,i=e.host,o=e.port,a=e.path,s=e.query,u=e.fragment,c=t+":";return null!==i?(c+="//",e.includesCredentials()&&(c+=r+(n?":"+n:"")+"@"),c+=oX(i),null!==o&&(c+=":"+o)):"file"==t&&(c+="//"),c+=e.cannotBeABaseURL?a[0]:a.length?"/"+MW(a,"/"):"",null!==s&&(c+="?"+s),null!==u&&(c+="#"+u),c},setHref:function(e){var t=this.parse(e);if(t)throw CW(t);this.searchParams.update()},getOrigin:function(){var e=this.scheme,t=this.port;if("blob"==e)try{return new LX(e.path[0]).origin}catch(Sq){return"null"}return"file"!=e&&this.isSpecial()?e+"://"+oX(this.host)+(null!==t?":"+t:""):"null"},getProtocol:function(){return this.scheme+":"},setProtocol:function(e){this.parse(yW(e)+":",_X)},getUsername:function(){return this.username},setUsername:function(e){var t=_W(yW(e));if(!this.cannotHaveUsernamePasswordPort()){this.username="";for(var r=0;r<t.length;r++)this.username+=dX(t[r],cX)}},getPassword:function(){return this.password},setPassword:function(e){var t=_W(yW(e));if(!this.cannotHaveUsernamePasswordPort()){this.password="";for(var r=0;r<t.length;r++)this.password+=dX(t[r],cX)}},getHost:function(){var e=this.host,t=this.port;return null===e?"":null===t?oX(e):oX(e)+":"+t},setHost:function(e){this.cannotBeABaseURL||this.parse(e,TX)},getHostname:function(){var e=this.host;return null===e?"":oX(e)},setHostname:function(e){this.cannotBeABaseURL||this.parse(e,IX)},getPort:function(){var e=this.port;return null===e?"":yW(e)},setPort:function(e){this.cannotHaveUsernamePasswordPort()||(""==(e=yW(e))?this.port=null:this.parse(e,AX))},getPathname:function(){var e=this.path;return this.cannotBeABaseURL?e[0]:e.length?"/"+MW(e,"/"):""},setPathname:function(e){this.cannotBeABaseURL||(this.path=[],this.parse(e,NX))},getSearch:function(){var e=this.query;return e?"?"+e:""},setSearch:function(e){""==(e=yW(e))?this.query=null:("?"==DW(e,0)&&(e=GW(e,1)),this.query="",this.parse(e,PX)),this.searchParams.update()},getSearchParams:function(){return this.searchParams.facade},getHash:function(){var e=this.fragment;return e?"#"+e:""},setHash:function(e){""!=(e=yW(e))?("#"==DW(e,0)&&(e=GW(e,1)),this.fragment="",this.parse(e,MX)):this.fragment=null},update:function(){this.query=this.searchParams.serialize()||null}};var LX=function(e){var t=hW(this,VX),r=bW(arguments.length,1)>1?arguments[1]:void 0,n=RW(t,new UX(e,!1,r));oW||(t.href=n.serialize(),t.origin=n.getOrigin(),t.protocol=n.getProtocol(),t.username=n.getUsername(),t.password=n.getPassword(),t.host=n.getHost(),t.hostname=n.getHostname(),t.port=n.getPort(),t.pathname=n.getPathname(),t.search=n.getSearch(),t.searchParams=n.getSearchParams(),t.hash=n.getHash())},VX=LX.prototype,FX=function(e,t){return{get:function(){return TW(this)[e]()},set:t&&function(e){return TW(this)[t](e)},configurable:!0,enumerable:!0}};if(oW&&dW(VX,{href:FX("serialize","setHref"),origin:FX("getOrigin"),protocol:FX("getProtocol","setProtocol"),username:FX("getUsername","setUsername"),password:FX("getPassword","setPassword"),host:FX("getHost","setHost"),hostname:FX("getHostname","setHostname"),port:FX("getPort","setPort"),pathname:FX("getPathname","setPathname"),search:FX("getSearch","setSearch"),searchParams:FX("getSearchParams"),hash:FX("getHash","setHash")}),lW(VX,"toJSON",(function(){return TW(this).serialize()}),{enumerable:!0}),lW(VX,"toString",(function(){return TW(this).serialize()}),{enumerable:!0}),wW){var BX=wW.createObjectURL,jX=wW.revokeObjectURL;BX&&lW(LX,"createObjectURL",uW(BX,wW)),jX&&lW(LX,"revokeObjectURL",uW(jX,wW))}SW(LX,"URL"),iW({global:!0,forced:!aW,sham:!oW},{URL:LX});var GX=function(){var e=o(regeneratorRuntime.mark((function e(t,r){var n;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=new Audio(URL.createObjectURL(new Blob([t],r))),e.prev=1,n.muted=!0,e.next=5,n.play();case 5:return n.pause(),e.abrupt("return",!0);case 9:return e.prev=9,e.t0=e.catch(1),e.abrupt("return",!1);case 12:case"end":return e.stop()}}),e,null,[[1,9]])})));return function(t,r){return e.apply(this,arguments)}}(),HX=Object.defineProperty,zX=Object.getOwnPropertyDescriptor,KX=function(e,t,r,n){for(var i,o=n>1?void 0:n?zX(t,r):t,a=e.length-1;a>=0;a--)(i=e[a])&&(o=(n?i(t,r,o):i(o))||o);return n&&o&&HX(t,r,o),o},WX=function(){function e(t){a(this,e),c(this,"_sharedAudioContext",new AudioContext),c(this,"_audioDestination",this._sharedAudioContext.createMediaStreamDestination()),c(this,"_localGainNode",this._sharedAudioContext.createGain()),c(this,"_bufferGainNode",this._sharedAudioContext.createGain()),c(this,"_audioBufferSource",void 0),c(this,"_localSource",void 0),c(this,"_context",void 0),c(this,"_failedAudioList",[]),c(this,"mixingMap",new Map),c(this,"resourcesCache",new Map),c(this,"volumeConfig",new Map),c(this,"cachedBuffer",[]),this._context=t,this._localGainNode.gain.value=1}var t,r,n;return u(e,[{key:"mixMediaStream",value:function(e){this._localSource&&this._localSource.disconnect(this._localGainNode),this._localSource=this._sharedAudioContext.createMediaStreamSource(e),this._localSource.connect(this._localGainNode).connect(this._audioDestination)}},{key:"startAudioMixing",value:(n=o(regeneratorRuntime.mark((function e(t,r,n){var i,o,a,s,u,c,d,l,h,f,p,_,v,m=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(i=n.playCount,GP(o=n.type,"mixingType",kz(Q)),a=this._context.getLocalAudioTrack()){e.next=5;break}return e.abrupt("return");case 5:if((s=pj(a.getTrack()))&&this.mixMediaStream(s),(u=this.mixingMap.get(t))&&u.audioNode){u.audioNode.pause(),this._context.emitMessage({mixId:t,state:Z.AUDIO_MIXING_STATE_STOPPED,error:uD.AUDIO_MIXING_ERROR_OK});try{u.gainNode.disconnect(this._audioDestination),u.audioSource.disconnect(u.gainNode)}catch(g){}}if(!(d=this.resourcesCache.get(t))||d.filePath!==r){e.next=14;break}c=d.getAudioNode(),e.next=28;break;case 14:return e.next=16,fetch(r,{mode:"cors",credentials:"include"}).then((function(e){if(e.ok)return e.arrayBuffer();throw m._context.emitMessage({mixId:t,state:Z.AUDIO_MIXING_STATE_FAILED,error:uD.AUDIO_MIXING_ERROR_START_FAILED}),new cD(sD.LOAD_RESOURCES_FAILED,e.statusText)}));case 16:return l=e.sent,r.endsWith("mp3")?h={type:"audio/mpeg"}:r.endsWith("aac")&&(h={type:"audio/aac"}),e.next=20,GX(l,h);case 20:if(e.sent){e.next=25;break}throw this._context.emitMessage({mixId:t,state:Z.AUDIO_MIXING_STATE_FAILED,error:uD.AUDIO_MIXING_ERROR_START_FAILED}),new cD(sD.LOAD_RESOURCES_FAILED,"invalid audio resource");case 25:(c=new Audio).crossOrigin="anonymous",c.src=URL.createObjectURL(new Blob([l],h));case 28:return i<=0?c.loop=!0:i>0&&(f=i,c.onended=function(){--f>0?c.play():(m.mixingMap.delete(t),m._context.emitMessage({mixId:t,state:Z.AUDIO_MIXING_STATE_FINISHED,error:uD.AUDIO_MIXING_ERROR_OK}))}),e.prev=29,e.next=32,c.play();case 32:e.next=39;break;case 34:e.prev=34,e.t0=e.catch(29),console.error(e.t0),this._failedAudioList.push(c),this._context.onAutoPlayFailed();case 39:if(p=this._sharedAudioContext.createMediaElementSource(c),_=this._sharedAudioContext.createGain(),v=this.volumeConfig.get(t),_.gain.value=v?v/100:1,p.connect(_).connect(this._audioDestination),this.mixingMap.set(t,{audioSource:p,audioNode:c,gainNode:_,type:"file"}),o===Q.PUBLISH)try{_.disconnect(this._sharedAudioContext.destination)}catch(g){}else _.connect(this._sharedAudioContext.destination);this._context.updateLocalAudioTrack(this._audioDestination.stream.getAudioTracks()[0],n.type),this._context.emitMessage({mixId:t,state:Z.AUDIO_MIXING_STATE_PLAYING,error:uD.AUDIO_MIXING_ERROR_OK});case 48:case"end":return e.stop()}}),e,this,[[29,34]])}))),function(e,t,r){return n.apply(this,arguments)})},{key:"stopAudioMixing",value: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:Z.AUDIO_MIXING_STATE_STOPPED,error:uD.AUDIO_MIXING_ERROR_OK}))}},{key:"pauseAudioMixing",value:function(e){var t=this.mixingMap.get(e);t&&(this._context.emitMessage({mixId:e,state:Z.AUDIO_MIXING_STATE_PAUSED,error:uD.AUDIO_MIXING_ERROR_OK}),t.audioNode.pause())}},{key:"resumeAudioMixing",value:function(e){var t=this.mixingMap.get(e);t&&(this._context.emitMessage({mixId:e,state:Z.AUDIO_MIXING_STATE_PLAYING,error:uD.AUDIO_MIXING_ERROR_OK}),t.audioNode.play())}},{key:"preloadAudioMixing",value:(r=o(regeneratorRuntime.mark((function e(t,r){var n,i=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this.stopAudioMixing(t),e.next=3,fetch(r,{mode:"cors",credentials:"include"}).then((function(e){if(e.ok)return e.arrayBuffer();throw i._context.emitMessage({mixId:t,state:Z.AUDIO_MIXING_STATE_FAILED,error:uD.AUDIO_MIXING_ERROR_PRELOAD_FAILED}),new cD(sD.LOAD_RESOURCES_FAILED,e.statusText)})).catch((function(e){throw i._context.emitMessage({mixId:t,state:Z.AUDIO_MIXING_STATE_FAILED,error:uD.AUDIO_MIXING_ERROR_PRELOAD_FAILED}),new cD(sD.LOAD_RESOURCES_FAILED,"Load resources failed",e)}));case 3:return n=e.sent,e.next=6,GX(n);case 6:if(e.sent){e.next=10;break}throw this._context.emitMessage({mixId:t,state:Z.AUDIO_MIXING_STATE_FAILED,error:uD.AUDIO_MIXING_ERROR_PRELOAD_FAILED}),new cD(sD.LOAD_RESOURCES_FAILED,"Load resources failed");case 10:this._context.emitMessage({mixId:t,state:Z.AUDIO_MIXING_STATE_PRELOADED,error:uD.AUDIO_MIXING_ERROR_OK}),this.resourcesCache.set(t,{getAudioNode:function(){return new Audio(URL.createObjectURL(new Blob([n])))},filePath:r});case 12:case"end":return e.stop()}}),e,this)}))),function(e,t){return r.apply(this,arguments)})},{key:"unloadAudioMixing",value:function(e){this.resourcesCache.has(e)&&this.resourcesCache.delete(e)}},{key:"getAudioMixingVolume",value:function(e){var t=this.mixingMap.get(e);return t?100*t.gainNode.gain.value:0}},{key:"setAudioMixingVolume",value: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)}},{key:"getAudioMixingDuration",value: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}},{key:"getAudioMixingCurrentPosition",value:function(e){var t=this.mixingMap.get(e);return t?1e3*t.audioNode.currentTime:0}},{key:"setAudioMixingPosition",value:function(e,t){var r=this.mixingMap.get(e);r&&(r.audioNode.currentTime=t/1e3,r.audioNode.play())}},{key:"enableAudioMixingBuffer",value:function(e){GP(e,"type",kz(Q));var t=this._context.getLocalAudioTrack();if(t){var r=pj(t.getTrack());if(r&&this.mixMediaStream(r),e===Q.PUBLISH)try{this._bufferGainNode.disconnect(this._sharedAudioContext.destination)}catch(n){}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:Z.AUDIO_MIXING_STATE_PCM_ENABLED,error:uD.AUDIO_MIXING_ERROR_OK})}}},{key:"disableAudioMixingBuffer",value: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:Z.AUDIO_MIXING_STATE_PCM_DISABLED,error:uD.AUDIO_MIXING_ERROR_OK})}}},{key:"pushAudioMixingBuffer",value: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(r){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)}}}}},{key:"stopAll",value:function(){var e=this;if(this._localSource)try{this._localSource.disconnect(this._localGainNode),delete this._localSource}catch(t){}this.mixingMap.forEach((function(t,r){e.stopAudioMixing(r)}))}},{key:"mixTrack",get:function(){return this._audioDestination.stream.getAudioTracks()[0]}},{key:"sharedAudioContext",get:function(){return this._sharedAudioContext}},{key:"resumeLocalPlay",value:(t=o(regeneratorRuntime.mark((function e(){var t,r,n,i;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:t=[],r=k(this._failedAudioList),e.prev=2,r.s();case 4:if((n=r.n()).done){e.next=24;break}if(i=n.value,e.prev=6,!(i instanceof HTMLAudioElement)){e.next=13;break}return i.muted=!1,e.next=11,i.play();case 11:e.next=14;break;case 13:i.start();case 14:e.next=22;break;case 16:return e.prev=16,e.t0=e.catch(6),t.push(i),console.error(e.t0),this._context.onAutoPlayFailed(),e.abrupt("break",24);case 22:e.next=4;break;case 24:e.next=29;break;case 26:e.prev=26,e.t1=e.catch(2),r.e(e.t1);case 29:return e.prev=29,r.f(),e.finish(29);case 32:this._failedAudioList=t;case 33:case"end":return e.stop()}}),e,this,[[2,26,29,32],[6,16]])}))),function(){return t.apply(this,arguments)})},{key:"destroy",value: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()}}]),e}();KX([KV("default","id","filePath","options")],WX.prototype,"startAudioMixing",1),KX([KV("default","id")],WX.prototype,"stopAudioMixing",1),KX([KV("default","id")],WX.prototype,"pauseAudioMixing",1),KX([KV("default","id")],WX.prototype,"resumeAudioMixing",1),KX([KV("default","id")],WX.prototype,"preloadAudioMixing",1),KX([KV("default","id")],WX.prototype,"unloadAudioMixing",1),KX([KV("default","id")],WX.prototype,"getAudioMixingVolume",1),KX([KV("default","id","volume")],WX.prototype,"setAudioMixingVolume",1),KX([KV("default","id")],WX.prototype,"getAudioMixingDuration",1),KX([KV("default","id")],WX.prototype,"getAudioMixingCurrentPosition",1),KX([KV("default","id","position")],WX.prototype,"setAudioMixingPosition",1),KX([KV("default","type")],WX.prototype,"enableAudioMixingBuffer",1),KX([KV()],WX.prototype,"disableAudioMixingBuffer",1),KX([KV("default","buffer")],WX.prototype,"pushAudioMixingBuffer",1);var XX=function(e){return e.NORMAL_USER="normalUser",e.SILENT_USER="silentUser",e}(XX||{}),qX=new uM("RTMClient",1),YX=function(e){d(m,e);var t,r,n,i,s,h,f,_=v(m);function m(e){var t;return a(this,m),c(p(t=_.call(this)),"_dataChannelSignal",null),c(p(t),"_handler",null),c(p(t),"_dataChannelSignalState",IG.DISCONNECTED),c(p(t),"_loginSessionId",null),c(p(t),"_userId",null),c(p(t),"_token",null),c(p(t),"_isReconnecting",!1),c(p(t),"_reconnectTimer",null),c(p(t),"_loginResolveCallback",null),c(p(t),"_loginRejectCallback",null),c(p(t),"_iceConfigNode",null),c(p(t),"_wait_login_token",!1),t._appId=e,t}return u(m,[{key:"login",value:function(e,t){var r=this;return new Promise((function(n,i){if(qX.print("login","invoke login, token: %o, userId: %o",e,t),r._loginSessionId)throw new cD(sD.ALREADY_LOGIN,"Already logined");if(r._loginResolveCallback)throw new cD(sD.LOGIN_FAILED,"Is logging in, please try again later.");r._userId=t,r._token=e,GV.setStats({rtc_app_id:r._appId,user_id:t}),r._loginResolveCallback=n,r._loginRejectCallback=i,r._dataChannelSignal?r._login():(qX.print("login","init dataChannelSingling"),r._dataChannelSignalState=IG.CONNECTING,r._createDataChannelSignaling(t).then((function(e){r._dataChannelSignal=e,r._login()})).catch((function(){r._onDisconnect()})))}))}},{key:"logout",value:(f=o(regeneratorRuntime.mark((function e(){var t;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._loginSessionId&&this._userId){e.next=2;break}throw new cD(sD.NOT_LOGIN,"login first");case 2:return e.next=4,null===(t=this._dataChannelSignal)||void 0===t?void 0:t.sendSignaling("logout",{loginSessionId:this._loginSessionId,userId:this._userId,appId:this._appId},{functionType:CF.C2RTM}).catch((function(){}));case 4:this._closeDataChannelSignaling(),this._clearState();case 6:case"end":return e.stop()}}),e,this)}))),function(){return f.apply(this,arguments)})},{key:"updateLoginToken",value:(h=o(regeneratorRuntime.mark((function e(t){var r=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this._token=t,e.abrupt("return",new Promise((function(e,t){r._wait_login_token?(r._loginResolveCallback=e,r._loginRejectCallback=t,r._login()):e()})));case 2:case"end":return e.stop()}}),e,this)}))),function(e){return h.apply(this,arguments)})},{key:"getPeerOnlineStatus",value:(s=o(regeneratorRuntime.mark((function e(t){var r;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._loginSessionId&&this._userId){e.next=2;break}throw new cD(sD.NOT_LOGIN,"login first");case 2:return this._checkDataChannelSignal(),e.next=5,this._dataChannelSignal.sendSignaling("getPeerOnlineStatus",{loginSessionId:this._loginSessionId,userId:this._userId,appId:this._appId,peerUserId:t},{functionType:CF.C2RTM});case 5:return r=e.sent,e.abrupt("return",null==r?void 0:r.status);case 7:case"end":return e.stop()}}),e,this)}))),function(e){return s.apply(this,arguments)})},{key:"sendUserMessageOutsideRoom",value:(i=o(regeneratorRuntime.mark((function e(t,r){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._loginSessionId&&this._userId){e.next=2;break}throw new cD(sD.NOT_LOGIN,"login first");case 2:return this._checkDataChannelSignal(),e.abrupt("return",this._dataChannelSignal.sendP2PMessage({from:this._userId,app:this._appId,to:t,room:"",msg:r}));case 4:case"end":return e.stop()}}),e,this)}))),function(e,t){return i.apply(this,arguments)})},{key:"setServerParams",value:(n=o(regeneratorRuntime.mark((function e(t,r){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._loginSessionId&&this._userId){e.next=2;break}throw new cD(sD.NOT_LOGIN,"login first");case 2:return this._checkDataChannelSignal(),e.next=5,this._dataChannelSignal.sendSignaling("setServerParams",{loginSessionId:this._loginSessionId,userId:this._userId,appId:this._appId,signature:t,url:r},{functionType:CF.C2RTM});case 5:case"end":return e.stop()}}),e,this)}))),function(e,t){return n.apply(this,arguments)})},{key:"sendServerMessage",value:(r=o(regeneratorRuntime.mark((function e(t){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._loginSessionId&&this._userId){e.next=2;break}throw new cD(sD.NOT_LOGIN,"login first");case 2:return this._checkDataChannelSignal(),e.abrupt("return",this._dataChannelSignal.sendP2PMessage({from:this._userId,app:this._appId,to:"",room:"",type:RF.BUSINESS_SERVER,msg:t}));case 4:case"end":return e.stop()}}),e,this)}))),function(e){return r.apply(this,arguments)})},{key:"destroy",value:function(){this._clearState(),this._closeDataChannelSignaling(),g(l(m.prototype),"removeAllListeners",this).call(this)}},{key:"_login",value:function(){var e=this;if(this._userId){var t=bP();this._checkDataChannelSignal(),this._dataChannelSignal.sendSignaling("login",{Token:TP.token2auth(this._appId,null,this._userId,this._token),timestamp:Date.now(),loginSessionId:t,params:{deviceType:"web",userAgent:window.navigator.userAgent,sdkVersion:sF.VERSION,deviceId:rF.getDeviceId(),appId:this._appId,userId:this._userId}},{functionType:CF.C2RTM}).then((function(){e._loginResolveCallback&&e._loginResolveCallback(),e._loginSessionId=t,e._wait_login_token=!1})).catch((function(t){var r,n,i=t||{},o=i.code,a=i.message;e._wait_login_token=!1,o>=700&&o<800?708===o?(r=sD.INVALID_PARAMS,n="Invalid userId"):(r=sD.INVALID_TOKEN,n="Invalid token",e._wait_login_token=!0,e._loginRejectCallback||e.emit("onRTMTokenError")):(r=sD.LOGIN_FAILED,n="login failed"),e._loginRejectCallback&&e._loginRejectCallback(new cD(r,a||n))})).finally((function(){e._loginResolveCallback=null,e._loginRejectCallback=null}))}}},{key:"_createDataChannelSignaling",value:(t=o(regeneratorRuntime.mark((function e(t){var r,n,i,o,a,s,u,c=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=new PF,i=this._iceConfigNode){e.next=16;break}return e.prev=3,e.next=6,null==n?void 0:n.getAccessNode(this._appId,"",t,rF.getDeviceId(),"");case 6:if(o=e.sent,i=o[0]){e.next=10;break}throw new Error;case 10:e.next=16;break;case 12:throw e.prev=12,e.t0=e.catch(3),XV("rtm.login.getNodeFailed","",0,!0),new cD(sD.ICE_SERVER_WRONG,"get ICE config failed");case 16:return XV("rtm.login.getNodeSuccess",i,0,!0),qX.print("_createDataChannelSignaling()","get node success",i),this._handler=vG(FV),null===(r=this._handler)||void 0===r||r.once("disconnect",(function(){qX.print("_createDataChannelSignaling()","recv BasicHandler event: disconnect"),c._onDisconnect()})),e.prev=20,e.next=23,null===(s=this._handler)||void 0===s?void 0:s.connect(i);case 23:a=e.sent,qX.print("_createDataChannelSignaling()","establish peerConnection success"),this._dataChannelSignalState=IG.CONNECTED,e.next=33;break;case 28:throw e.prev=28,e.t1=e.catch(20),this._iceConfigNode=null,this._dataChannelSignalState=IG.DISCONNECTED,new cD(sD.ESTABLISH_DATACHANNEL_FAILED,"establish dataChannel failed",e.t1);case 33:return u=new NF(a),qX.print("_createDataChannelSignaling()","send ping"),u.sendPingSignaling(),u.once("close",(function(){qX.print("_createDataChannelSignaling()","recv DataChannelSignaling event: close"),c._onDisconnect()})),u.on(gF.USER_MESSAGE_RECEIVED_OUTSIDE_ROOM,(function(e){c.emit("onUserMessageReceivedOutsideRoom",{userId:e.from,message:e.msg})})),u.on(gF.USER_BINARY_MESSAGE_RECEIVED_OUTSIDE_ROOM,(function(e){c.emit("onUserBinaryMessageReceivedOutsideRoom",{userId:e.from,message:e.msg})})),u.on(gF.USER_DISCONNECTION,(function(){c.emit("onUserDisconnection"),c._clearState()})),u.on(gF.NODE_CHANGE,(function(e){XV("rtm.nodeChange",JSON.stringify(e),0,!0),Array.isArray(e.nodes)&&e.nodes.length&&(c._iceConfigNode=e.nodes[0]),c._loginResolveCallback&&c._loginRejectCallback?c._login():c._reconnect()})),e.abrupt("return",u);case 42:case"end":return e.stop()}}),e,this,[[3,12],[20,28]])}))),function(e){return t.apply(this,arguments)})},{key:"_closeDataChannelSignaling",value: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}},{key:"_checkDataChannelSignal",value:function(){if(!this._dataChannelSignal||this._dataChannelSignalState!==IG.CONNECTED)throw new cD(sD.NOT_CONNECTED_YET,"datachannel not connect")}},{key:"_onDisconnect",value:function(){this._dataChannelSignalState=IG.DISCONNECTED,this._closeDataChannelSignaling(),navigator.onLine?this._reconnect():this._reconnectTimer=self.setTimeout(this._reconnect.bind(this),3e3)}},{key:"_reconnect",value:function(){var e=this;!this._isReconnecting&&this._userId&&(qX.print("_reconnect()","start reconnect..."),this._isReconnecting=!0,this._createDataChannelSignaling(this._userId).then((function(t){qX.print("_reconnect()","reconnect success!"),e._dataChannelSignal=t,e._login(),e._reconnectTimer=null})).catch((function(t){qX.print("_reconnect()","Reconnecting error, will reconnect after 3s",t),e._reconnectTimer=self.setTimeout(e._reconnect.bind(e),3e3)})).finally((function(){e._isReconnecting=!1})))}},{key:"_clearState",value:function(){this._userId=null,this._token=null,this._loginSessionId=null,null!==this._reconnectTimer&&(self.clearTimeout(this._reconnectTimer),this._reconnectTimer=null)}}]),m}(nM.exports.EventEmitter),JX=function(e){d(s,e);var t,r,n,i=v(s);function s(e){var t;return a(this,s),c(p(t=i.call(this)),"_mediaServerClient",void 0),c(p(t),"_appId",void 0),c(p(t),"_reconnectTimer",void 0),c(p(t),"remoteStreams",void 0),t._appId=e,t.remoteStreams=new Map,t}return u(s,[{key:"connect",value:(n=o(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this._mediaServerClient=new wG,this._bindEvents(),e.next=4,this._mediaServerClient.connect(this._appId);case 4:case"end":return e.stop()}}),e,this)}))),function(){return n.apply(this,arguments)})},{key:"startPlayPublicStream",value:(r=o(regeneratorRuntime.mark((function e(t){var r,n=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this.remoteStreams.get(t)){e.next=2;break}throw new cD(sD.REPEAT_PLAY,"repeat play public media stream");case 2:return(r=new nG(t,t,!1,{audiostream:!0,localaudio:!0,videostream:!0,localvideo:!0,extaudio:!1,extvideo:!1,videoDescriptions:[]})).on("onSEIMessage",(function(e){if(e instanceof Uint8Array)for(var t=VP(e),i=0;i<t.seiCount;i++)n.emit(Jj.ON_SEI_MESSAGED_RECEIVED,{sei:t.seis[i],publicStreamId:r.streamId})})),e.next=6,this._mediaServerClient.subscribePublicStream(r);case 6:return this.remoteStreams.set(t,r),e.abrupt("return",r);case 8:case"end":return e.stop()}}),e,this)}))),function(e){return r.apply(this,arguments)})},{key:"stopPlayPublicStream",value:function(e){var t=this.remoteStreams.get(e);if(t)return this.remoteStreams.delete(e),this._mediaServerClient.unsubscribePublicStream(t)}},{key:"destroy",value:function(){this.remoteStreams=new Map,this._mediaServerClient&&this._mediaServerClient.destroy()}},{key:"_handleReconnected",value:(t=o(regeneratorRuntime.mark((function e(){var t,r,n,i=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:clearTimeout(this._reconnectTimer),t=k(this.remoteStreams);try{for(n=function(){var e=y(r.value,1)[0];i.remoteStreams.delete(e),i.startPlayPublicStream(e).then((function(){var t=i.remoteStreams.get(e);i.safeEmit(Jj.RESUBSCRIBE,{stream:t})}))},t.s();!(r=t.n()).done;)n()}catch(PU){t.e(PU)}finally{t.f()}case 3:case"end":return e.stop()}}),e,this)}))),function(){return t.apply(this,arguments)})},{key:"_reconnect",value: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)}},{key:"_bindEvents",value:function(){var e,t,r=this;null===(e=this._mediaServerClient)||void 0===e||e.on(SF.ABNORMAL_DISCONNECTION,this._reconnect.bind(this)),null===(t=this._mediaServerClient)||void 0===t||t.on("onRemoteStreamStats",(function(e){r.emit("onRemoteStreamStats",e)}))}}]),s}(dM),QX=new uM("AudioDeviceManager",1),ZX=function(e){d(s,e);var t,r,n,i=v(s);function s(){var e;a(this,s);for(var t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];return c(p(e=i.call.apply(i,[this].concat(r))),"_audioLevelFetcher",void 0),c(p(e),"_playbackDeviceTestTimer",void 0),c(p(e),"_audioElement",void 0),c(p(e),"_audioTrack",void 0),c(p(e),"_mediaRecorder",void 0),c(p(e),"_recoderTimer",void 0),c(p(e),"_isAudioPlaybackDeviceTesting",!1),c(p(e),"_isAudioDeviceRecordTesting",!1),c(p(e),"_audioCaptureAndRecoderResolve",void 0),e}return u(s,[{key:"startAudioPlaybackDeviceTest",value:(n=o(regeneratorRuntime.mark((function e(t,r){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this._isAudioPlaybackDeviceTesting&&!this._isAudioDeviceRecordTesting){e.next=2;break}throw new cD(sD.REPEAT_DEVICE_TEST,"device test cannot be called repeatedly at the same time.");case 2:return this._isAudioPlaybackDeviceTesting=!0,QX.print("startAudioPlaybackDeviceTest()","Invoke"),e.prev=4,e.next=7,this._playAudioFile(t,{loop:!0});case 7:e.next=13;break;case 9:throw e.prev=9,e.t0=e.catch(4),this.stopAudioPlaybackDeviceTest(),e.t0;case 13:this._startEmitAudioPlaybackDeviceTestVolume(r);case 14:case"end":return e.stop()}}),e,this,[[4,9]])}))),function(e,t){return n.apply(this,arguments)})},{key:"stopAudioPlaybackDeviceTest",value:function(){this._isAudioPlaybackDeviceTesting&&(QX.print("stopAudioPlaybackDeviceTest()","Invoke"),this._isAudioPlaybackDeviceTesting=!1,this._stopEmitAudioPlaybackDeviceTestVolume(),this._destroyAudioElement())}},{key:"startAudioDeviceRecordTest",value:(r=o(regeneratorRuntime.mark((function e(t){var r=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this._isAudioDeviceRecordTesting){e.next=2;break}throw new cD(sD.REPEAT_DEVICE_TEST,"device test cannot be called repeatedly at the same time.");case 2:return this._isAudioDeviceRecordTesting=!0,QX.print("startAudioDeviceRecordTest()","Invoke"),this._recoderTimer=window.setTimeout((function(){QX.print("startAudioDeviceRecordTest()","".concat(3e4,'ms automatic call method "stopAudioDeviceRecordAndPlayTest"')),r._stopAudioCaptureAndRecoder()}),3e4),e.next=7,this._startAudioCaptureAndRecoder(t);case 7:delete this._audioCaptureAndRecoderResolve;case 8:case"end":return e.stop()}}),e,this)}))),function(e){return r.apply(this,arguments)})},{key:"stopAudioDeviceRecordAndPlayTest",value:function(){QX.print("stopAudioDeviceRecordAndPlayTest()","Invoke"),void 0!==this._recoderTimer&&(clearTimeout(this._recoderTimer),delete this._recoderTimer),this._stopAudioCaptureAndRecoder()}},{key:"stopAudioDevicePlayTest",value:function(){this._isAudioDeviceRecordTesting&&(QX.print("stopAudioDevicePlayTest()","Invoke"),this._isAudioDeviceRecordTesting=!1,this.stopAudioDeviceRecordAndPlayTest(),this._stopEmitAudioPlaybackDeviceTestVolume(),this._destroyAudioElement())}},{key:"getRecordTrack",value:function(){return this._audioTrack}},{key:"destroy",value:function(){QX.print("destroy()","Invoke"),g(l(s.prototype),"removeAllListeners",this).call(this),this.stopAudioPlaybackDeviceTest(),this.stopAudioDevicePlayTest()}},{key:"_playAudioFile",value:function(e,t){var r=this;return new Promise((function(n,i){r._audioElement=HG("audio",{attributes:{src:e,crossOrigin:"",autoplay:"true"}}),r._audioElement.loop=t.loop,QX.print("_playAudioFile()","url=".concat(e,";loop=").concat(t.loop)),r._audioElement.oncanplay=function(){QX.print("_playAudioFile()","oncanplay"),n()},r._audioElement.onerror=function(e){var t,n;i(new cD(sD.LOAD_RESOURCES_FAILED,"audio error: ".concat(e.message||(null===(t=r._audioElement)||void 0===t||null===(n=t.error)||void 0===n?void 0:n.message))))}}))}},{key:"_destroyAudioElement",value:function(){this._audioElement&&(QX.print("_destroyAudioElement()","Invoke"),this._audioElement.src="",delete this._audioElement,this._audioCaptureAndRecoderResolve&&this._audioCaptureAndRecoderResolve())}},{key:"_startEmitAudioPlaybackDeviceTestVolume",value:function(e){var t=this;e=Math.max(e,100),this._audioElement&&(QX.print("_startEmitAudioPlaybackDeviceTestVolume()","start timer(".concat(e,"ms)")),this._audioLevelFetcher=new dj(this._audioElement),this._playbackDeviceTestTimer=self.setInterval((function(){t._audioLevelFetcher&&t.emit("onAudioPlaybackDeviceTestVolume",t._audioLevelFetcher.getAudioLevel())}),e))}},{key:"_stopEmitAudioPlaybackDeviceTestVolume",value:function(){var e;void 0!==this._playbackDeviceTestTimer&&(QX.print("_stopEmitAudioPlaybackDeviceTestVolume()","stop timer"),self.clearInterval(this._playbackDeviceTestTimer),delete this._playbackDeviceTestTimer),null===(e=this._audioLevelFetcher)||void 0===e||e.destroy(),delete this._audioLevelFetcher}},{key:"_startAudioCaptureAndRecoder",value:(t=o(regeneratorRuntime.mark((function e(t){var r,n=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Oj({});case 2:return this._audioTrack=e.sent,r=pj(this._audioTrack.getTrack()),QX.print("startAudioDeviceRecordTest()","create microphone track success!"),e.abrupt("return",new Promise((function(e,i){n._mediaRecorder=new MediaRecorder(r),n._mediaRecorder.ondataavailable=function(){var r=o(regeneratorRuntime.mark((function r(o){var a,s;return regeneratorRuntime.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:if(!n._isAudioDeviceRecordTesting){r.next=16;break}return QX.print("startAudioDeviceRecordTest()","get recorded file."),s=new Blob([o.data]),r.prev=3,r.next=6,n._playAudioFile(URL.createObjectURL(s),{loop:!1});case 6:r.next=11;break;case 8:return r.prev=8,r.t0=r.catch(3),r.abrupt("return",i(r.t0));case 11:n._startEmitAudioPlaybackDeviceTestVolume(t),null===(a=n._audioElement)||void 0===a||a.addEventListener("ended",(function(){n.stopAudioDevicePlayTest(),e()})),n._audioCaptureAndRecoderResolve=e,r.next=17;break;case 16:e();case 17:case"end":return r.stop()}}),r,null,[[3,8]])})));return function(e){return r.apply(this,arguments)}}(),n._mediaRecorder.onerror=function(e){i(new cD(sD.AUDIO_DEVICE_TEST_FAILED,e.message||"mediaRecorder error"))},n._mediaRecorder.start()})));case 6:case"end":return e.stop()}}),e,this)}))),function(e){return t.apply(this,arguments)})},{key:"_stopAudioCaptureAndRecoder",value: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}}]),s}(nM.exports.EventEmitter),$X=function(){function e(){a(this,e),c(this,"engineBAC",{}),c(this,"engineANM",{}),c(this,"bitrate",void 0),c(this,"sampleRate",void 0),c(this,"channel",void 0),c(this,"aec",void 0),c(this,"agc",void 0),c(this,"ans",void 0),this._init()}var t;return u(e,[{key:"_init",value:(t=o(regeneratorRuntime.mark((function e(){var t;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=new MF,e.next=3,t.getAudioProfile();case 3:this.engineBAC=e.sent;case 4:case"end":return e.stop()}}),e,this)}))),function(){return t.apply(this,arguments)})},{key:"updateEngineBAC",value:function(e){e&&(this.engineBAC={codec:this.engineBAC.codec,play:r(r({},this.engineBAC.play),e.play),record:r(r({},this.engineBAC.record),e.record)},this.setAEC(!!e.aec),this.setAGC(!!e.agc))}},{key:"updateEngineANM",value:function(e){e&&(this.engineANM={bitrate:e.enc_param.bitrate,channel:e.enc_param.chn})}},{key:"setAudioProfile",value:function(e){var t,r,n;switch(e){case X.fluent:r=16e3,t=24e3;break;case X.standard:r=48e3,t=48e3;break;case X.hd:r=48e3,t=128e3,n=2;break;case X.standardStereo:r=48e3,t=8e4,n=2;break;case X.hdMono:r=48e3,t=128e3}t&&(this.bitrate=t),n&&(this.channel=n),r&&(this.sampleRate=r)}},{key:"setBitrate",value:function(e){e>128e3&&(e=128e3),this.bitrate=e}},{key:"setAEC",value:function(e){this.aec=e}},{key:"setAGC",value:function(e){this.agc=e}},{key:"setANS",value:function(e){this.ans=e}},{key:"getOpusConfigStr",value:function(){var e,t,r=";";return this.bitrate&&(r+="maxaveragebitrate=".concat(this.bitrate,";")),(this.sampleRate||null!==(e=this.engineBAC.record)&&void 0!==e&&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)}},{key:"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)}}}]),e}(),eq=new uM("VideoSnapshot",1),tq=function(e){var t=null==e?void 0:e.domElement;if(t&&!t.paused&&4===t.readyState)return t},rq=function(){var e=o(regeneratorRuntime.mark((function e(t,r,n){var i,o,a,s,u,c,d,l;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(i=document.createElement("canvas"),o=i.getContext("2d")){e.next=4;break}throw new Error("canvas.getContext error");case 4:if(a=function(e,t,n){return t=t||e.width,n=n||e.height,i.width=t,i.height=n,r?o.setTransform(-1,0,0,1,t,0):o.setTransform(1,0,0,1,0,0),o.drawImage(e,0,0,t,n),o.getImageData(0,0,t,n)},s=Date.now(),!(u=tq(n))){e.next=16;break}return eq.print("takeSnapshot","VideoPlayer already set."),e.next=11,a(u,u.videoWidth,u.videoHeight);case 11:return c=e.sent,eq.print("takeSnapshot","success, cost ".concat(Date.now()-s,"ms")),e.abrupt("return",c);case 16:if(!window.ImageCapture){e.next=29;break}if("live"!==(d=new window.ImageCapture(t)).track.readyState||!d.track.enabled||d.track.muted){e.next=29;break}return eq.print("takeSnapshot","use ImageCapture"),e.t0=a,e.next=23,d.grabFrame();case 23:return e.t1=e.sent,e.next=26,(0,e.t0)(e.t1);case 26:return l=e.sent,eq.print("takeSnapshot","success, cost ".concat(Date.now()-s,"ms")),e.abrupt("return",l);case 29:return eq.print("takeSnapshot","use temp video"),e.abrupt("return",new Promise((function(e,r){var n=new MediaStream([t]),i=document.createElement("video");i.setAttribute("playsinline",""),i.muted=!0,document.body.appendChild(i),i.onplaying=function(){var r=a(i,i.videoWidth,i.videoHeight);eq.print("takeSnapshot","success, cost ".concat(Date.now()-s,"ms")),e(r),n.removeTrack(t),i.srcObject=null,i.load()},i.onerror=r,i.srcObject=n,i.play()})));case 31:case"end":return e.stop()}}),e)})));return function(t,r,n){return e.apply(this,arguments)}}(),nq=Object.defineProperty,iq=Object.getOwnPropertyDescriptor,oq=function(e,t,r,n){for(var i,o=n>1?void 0:n?iq(t,r):t,a=e.length-1;a>=0;a--)(i=e[a])&&(o=(n?i(t,r,o):i(o))||o);return n&&o&&nq(t,r,o),o},aq=new uM("Engine",0),sq=function(e){d(Ue,e);var t,n,i,s,h,f,_,m,y,S,b,E,k,I,A,w,N,x,V,F,B,j,z,K,X,Y,J,Z,$,te,re,ne,ie,oe,ae,se,ue,ce,de,le,he,fe,pe,_e,ve,me,ge,ye,Se,be,Ee,ke,Re,Te,Ie,Ae,we,Ce,Oe,Ne,xe,De,Pe,Me=v(Ue);function Ue(e,t){var r;return a(this,Ue),c(p(r=Me.call(this)),"_room",void 0),c(p(r),"_outsideRoom",void 0),c(p(r),"_appId",void 0),c(p(r),"_businessId",void 0),c(p(r),"_visibility",!0),c(p(r),"_localVideoTrack",void 0),c(p(r),"_localAudioTrack",void 0),c(p(r),"_localImgVideoTrack",void 0),c(p(r),"_localImgScreenTrack",void 0),c(p(r),"_localScreenVideoTrack",void 0),c(p(r),"_localScreenAudioTrack",void 0),c(p(r),"_tempMixingAudioTrack",void 0),c(p(r),"_audioPlaybackDeviceId",void 0),c(p(r),"_videoPlayer",void 0),c(p(r),"_screenPlayer",void 0),c(p(r),"_remoteVideoPlayer",new Map),c(p(r),"_remoteScreenPlayer",new Map),c(p(r),"_remoteAudioPlayer",new Map),c(p(r),"_publicStreamAudioPlayer",new Map),c(p(r),"_publicStreamVideoPlayer",new Map),c(p(r),"_publicStreamIds",new Map),c(p(r),"_roomConfig",void 0),c(p(r),"_videoStreamConstraints",{}),c(p(r),"_audioStreamConstraints",{}),c(p(r),"_enableSimulcast",!1),c(p(r),"_videoStreamEncodeConfig",[pF]),c(p(r),"_screenStreamEncodeConfig",[_F]),c(p(r),"_trackSourceType",void 0),c(p(r),"_liveTranscodeConfig",void 0),c(p(r),"_useCloudProxy",void 0),c(p(r),"_startCloudProxyTimestamp",void 0),c(p(r),"_localVideoDeviceId",void 0),c(p(r),"_localAudioDeviceId",void 0),c(p(r),"_pauseAllSubscribeState",{audio:!1,video:!1}),c(p(r),"_audioVolumeIndicationTimer",void 0),c(p(r),"_dummyTimer",void 0),c(p(r),"_audioPropertiesReportTimer",null),c(p(r),"_mirrorType",L.MIRROR_TYPE_RENDER),c(p(r),"_audioMixingManager",void 0),c(p(r),"_pubLock",void 0),c(p(r),"_rtmClient",void 0),c(p(r),"_messageStatisticsObserver",void 0),c(p(r),"_tempRoomConfig",void 0),c(p(r),"_originIceConfigRequestUrls",void 0),c(p(r),"_originConfigServerUrls",void 0),c(p(r),"_originLogServerUrl",void 0),c(p(r),"_audioDeviceManager",new ZX),c(p(r),"_audioProfileManager",new $X),c(p(r),"_remoteVideoConfig",new Map),c(p(r),"_userPriorityMap",new Map),c(p(r),"_subscribeFallbackOption",G.DISABLE),c(p(r),"_config",void 0),c(p(r),"_updateMixAudioTrack",function(){var e=o(regeneratorRuntime.mark((function e(t){var n,i,o=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(i=o.length>1&&void 0!==o[1]?o[1]:Q.PLAYOUT_AND_PUBLISH,aq.print("_updateMixAudioTrack()"),r._localAudioTrack){e.next=5;break}return t&&(r._tempMixingAudioTrack={track:t,type:i}),e.abrupt("return");case 5:if(t?(r._localAudioTrack.mixType=i,r._localAudioTrack.mixedAudioTrack=t):(delete r._localAudioTrack.mixType,delete r._localAudioTrack.mixedAudioTrack),null===(n=r._room)||void 0===n||!n.hasPublished){e.next=9;break}return e.next=9,r._updatePublish();case 9:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()),c(p(r),"_onAudioMixingMessage",(function(e){r.safeEmit(ee.onAudioMixingStateChanged,e)})),c(p(r),"_onAudioMixingAutoplayFailed",(function(){r.safeEmit(ee.onAutoplayFailed,{})})),r._appId=e,r._pubLock=new yG("pubLock"),r._addDeviceEventHandler(),r._audioMixingManager=new WX({getLocalAudioTrack:function(){return r._localAudioTrack},updateLocalAudioTrack:r._updateMixAudioTrack,emitMessage:r._onAudioMixingMessage,onAutoPlayFailed:r._onAudioMixingAutoplayFailed}),window.__rtc_engine__=p(r),window["__rtc_engine__".concat(Math.floor(100*Math.random()+1))]=p(r),r._trackSourceType={video:R.VIDEO_SOURCE_TYPE_INTERNAL,screenVideo:R.VIDEO_SOURCE_TYPE_INTERNAL,audio:T.AUDIO_SOURCE_TYPE_INTERNAL,screenAudio:T.AUDIO_SOURCE_TYPE_INTERNAL},r._config=t,r._rtmClient=new YX(e),r._handleRTMClient(r._rtmClient),r._useCloudProxy=!1,r._handleAudioDeviceManager(),r._messageStatisticsObserver=new ZG,r}return u(Ue,[{key:"appId",get:function(){return this._appId}},{key:"updateToken",value:(Pe=o(regeneratorRuntime.mark((function e(t){var r,n,i,o,a,s,u;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(aq.print("updateToken()","token: %s",t),jP(t,"token"),!(this.waitForNewToken&&null!==(r=this._room)&&void 0!==r&&r._roomInfo&&this._tempRoomConfig)){e.next=9;break}return o=null===(i=this._room)||void 0===i?void 0:i._roomInfo,a=o.roomId,s=o.userInfo,u=this._tempRoomConfig,delete this._tempRoomConfig,e.next=8,this.joinRoom(t,a,s,u);case 8:return e.abrupt("return",e.sent);case 9:if(this._room){e.next=11;break}throw new cD(sD.UPDATE_TOKEN_BEFORE_JOIN,"update token before join room");case 11:return e.next=13,null===(n=this._room)||void 0===n?void 0:n.updateToken(t);case 13:case"end":return e.stop()}}),e,this)}))),function(e){return Pe.apply(this,arguments)})},{key:"setVideoCaptureDevice",value:(De=o(regeneratorRuntime.mark((function e(t){var r,n;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(aq.print("setVideoCaptureDevice()","deviceId: %s",t),jP(t,"deviceId"),this._localVideoDeviceId=t,this._localVideoTrack){e.next=5;break}return e.abrupt("return");case 5:return r=this._videoStreamConstraints,"user"===t||"environment"===t||"left"===t||"right"===t?(delete r.deviceId,r.facingMode=t):r.deviceId={exact:t},this._videoStreamConstraints=r,e.next=10,wj(r);case 10:if(n=e.sent,this._initLocalTrackEvents(n),this._localVideoTrack.close(),this._localVideoTrack=n,this._videoPlayer&&this._videoPlayer.played&&(this._videoPlayer.stop(),this._videoPlayer.playVideo(n),this._videoPlayer.mirror(!!this._mirrorType)),this._room){e.next=17;break}return e.abrupt("return");case 17:if(!this._room.hasPublished){e.next=20;break}return e.next=20,this._updatePublish();case 20:case"end":return e.stop()}}),e,this)}))),function(e){return De.apply(this,arguments)})},{key:"setAudioCaptureDevice",value:(xe=o(regeneratorRuntime.mark((function e(t){var r,n;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(aq.print("setAudioCaptureDevice()","deviceId: %s",t),jP(t,"deviceId"),this._localAudioDeviceId=t,this._localAudioTrack){e.next=5;break}return e.abrupt("return");case 5:return(r=this._audioStreamConstraints).deviceId={exact:t},this._audioStreamConstraints=r,e.next=10,Oj(r,this._audioProfileManager);case 10:if(n=e.sent,this._initLocalTrackEvents(n),this._localAudioTrack.close(),this._localAudioTrack=n,this._room){e.next=16;break}return e.abrupt("return");case 16:if(!this._room.hasPublished){e.next=19;break}return e.next=19,this._updatePublish();case 19:case"end":return e.stop()}}),e,this)}))),function(e){return xe.apply(this,arguments)})},{key:"_addDeviceEventHandler",value:function(){uj.on(ee.onVideoDeviceStateChanged,this._onVideoDeviceStateChange.bind(this)),uj.on(ee.onAudioDeviceStateChanged,this._onAudioDeviceStateChange.bind(this))}},{key:"_addHandlerEventHandler",value:function(){var e,t,r,n,i,o,a,s,u,c,d,l,h,f,p,_,v,m,g,y,S,b,E,k,R,T,I,A,w,C,O=this;null===(e=this._room)||void 0===e||e.on(gF.ON_ADD_STREAM,this._onAddStream.bind(this)),null===(t=this._room)||void 0===t||t.on(gF.ON_REMOVE_STREAM,this._onRemoveStream.bind(this)),null===(r=this._room)||void 0===r||r.on(gF.USER_CONNECTION,this._onUserConnection.bind(this)),null===(n=this._room)||void 0===n||n.on(Jj.ON_USER_LEAVE,this._onUserLeave.bind(this)),null===(i=this._room)||void 0===i||i.on(Jj.ON_ROOM_ERROR,this._onRoomError.bind(this)),null===(o=this._room)||void 0===o||o.on(Jj.ON_NETWORK_QUALITY,this._onNetworkQuality.bind(this)),null===(a=this._room)||void 0===a||a.on(gF.ON_CUSTOM_MESSAGE,this._onCustomMessage.bind(this)),null===(s=this._room)||void 0===s||s.on(gF.USER_MESSAGE_RECEIVED,this._onUserMessageReceived.bind(this)),null===(u=this._room)||void 0===u||u.on(gF.USER_BINARY_MESSAGE_RECEIVED,this._onUserBinaryMessageReceived.bind(this)),null===(c=this._room)||void 0===c||c.on(gF.ON_USER_TOKEN_WILL_EXPIRE,this._onUserTokenWillExpire.bind(this)),null===(d=this._room)||void 0===d||d.on(gF.POST_PROCESSING_MESSAGE,(function(e){"2.0"===e.protocol?O._onStreamMixingEvent({error:e.error,event:e.eventType,message:e.message}):"publicStreamCallback"===e.type?O._onPushPublicStreamResult(e):"transcodeStatusCallback"===e.type&&O._onLiveTranscodingResult(e)})),null===(l=this._room)||void 0===l||l.on(SF.ON_CONNECTION_STATE_CHANGE,this._onConnectionStateChange.bind(this)),null===(h=this._room)||void 0===h||h.on(Jj.RESUBSCRIBE,this._onResubscribe.bind(this)),null===(f=this._room)||void 0===f||f.on(Jj.SUBSCRIBE_PUSH_TRACK,this._onSubscribePushTrack.bind(this)),null===(p=this._room)||void 0===p||p.on(Jj.REMOVE_PUSH_TRACK,this._onRemovePushTrack.bind(this)),null===(_=this._room)||void 0===_||_.on(Jj.VIDEO_FIRST_FRAME,this._onVideoFirstFrameDecoded.bind(this)),null===(v=this._room)||void 0===v||v.on(Jj.ON_PUBLISH_RESULT,(function(e){var t;null!==(t=O._room)&&void 0!==t&&t._roomConfig.isAutoPublish&&O.safeEmit(ee.onAutoPublishResult,e)})),null===(m=this._room)||void 0===m||m.on(Jj.ON_REMOTE_STREAM_STATS,(function(e){O.safeEmit(ee.onRemoteStreamStats,e)})),null===(g=this._room)||void 0===g||g.on(Jj.ON_LOCAL_STREAM_STATS,(function(e){O.safeEmit(ee.onLocalStreamStats,e)})),null===(y=this._room)||void 0===y||y.on(Jj.ON_USER_PUBLISH_STATE_CHANGE,this._onUserPublishStateChange.bind(this)),null===(S=this._room)||void 0===S||S.on(Jj.ON_USER_START_AUDIO_CAPTURE,(function(e){var t=e.userId;O.safeEmit(ee.onUserStartAudioCapture,{userId:t})})),null===(b=this._room)||void 0===b||b.on(Jj.ON_USER_STOP_AUDIO_CAPTURE,(function(e){var t=e.userId;O.safeEmit(ee.onUserStopAudioCapture,{userId:t})})),null===(E=this._room)||void 0===E||E.on(Jj.ON_USER_START_VIDEO_CAPTURE,(function(e){var t=e.userId;O.safeEmit(ee.onUserStartVideoCapture,{userId:t})})),null===(k=this._room)||void 0===k||k.on(Jj.ON_USER_STOP_VIDEO_CAPTURE,(function(e){var t=e.userId;O.safeEmit(ee.onUserStopVideoCapture,{userId:t})})),null===(R=this._room)||void 0===R||R.on(Jj.ON_SEI_MESSAGED_RECEIVED,(function(e){O.safeEmit(ee.onSEIMessageReceived,e)})),null===(T=this._room)||void 0===T||T.on(Jj.ON_REMOTE_VIDEO_SIZE_CHANGED,(function(e,t){O.safeEmit(ee.onRemoteVideoSizeChanged,e,t)})),null===(I=this._room)||void 0===I||I.on(Jj.ON_SIMULCAST_SUBSCRIBE_FALLBACK,(function(e){return O.safeEmit(ee.onSimulcastSubscribeFallback,e)})),null===(A=this._room)||void 0===A||A.on(Jj.RECONNECT_FAILED,(function(){O.safeEmit(ee.onError,{errorCode:sD.RECONNECT_FAILED})})),null===(w=this._room)||void 0===w||w.on(Jj.ON_VIDEO_STREAM_BANNED,(function(e){O.safeEmit(ee.onVideoStreamBanned,{uid:e.uid,banned:e.banned})})),null===(C=this._room)||void 0===C||C.on(Jj.ON_AUDIO_STREAM_BANNED,(function(e){O.safeEmit(ee.onAudioStreamBanned,{uid:e.uid,banned:e.banned})}))}},{key:"safeEmit",value:function(e){for(var t,r=arguments.length,n=new Array(r>1?r-1:0),i=1;i<r;i++)n[i-1]=arguments[i];return tM(e)&&WV(e,NP(n)),(t=g(l(Ue.prototype),"safeEmit",this)).call.apply(t,[this,e].concat(n))}},{key:"_removeHandlerEventHandler",value:function(){var e;null===(e=this._room)||void 0===e||e.removeAllListeners()}},{key:"joinRoom",value:(Ne=o(regeneratorRuntime.mark((function e(t,n,i,o){var a,s,u;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(aq.print("joinRoom()","token: %o roomId: %o, userInfo: %o, roomConfig: %o",t,n,i,o),XP(t)||jP(t,"token"),qP(n),QP(i),a={isAutoPublish:!0,isAutoSubscribeAudio:!0,isAutoSubscribeVideo:!0,roomProfileType:W.communication},bz(a,o),ZP(a),!this._room||this._room.connectionState===IG.DISCONNECTED){e.next=11;break}throw new cD(sD.REPEAT_JOIN,"Already joined");case 11:return this._room=new jG(o,{audioProfileManager:this._audioProfileManager}),this._room.userPriorityMap=this._userPriorityMap,this._room.subscribeFallbackOption=this._subscribeFallbackOption,this._addHandlerEventHandler(),s=this._liveTranscodeConfig&&dF("started",this._liveTranscodeConfig),e.prev=16,this._useCloudProxy&&(this._startCloudProxyTimestamp=Date.now()),e.next=20,this._room.join(this._appId,n,t,r(r({},i),{},{businessId:this._businessId,role:this._visibility?XX.NORMAL_USER:XX.SILENT_USER}),s,this._useCloudProxy);case 20:return u=e.sent,this._roomConfig=o,this._tempRoomConfig&&delete this._tempRoomConfig,null!=o&&o.isAutoPublish&&(this._visibility?this._updatePublish({invokeByJoinRoom:!0,mediaType:P.AUDIO_AND_VIDEO}):this.safeEmit(ee.onAutoPublishResult,{isScreen:!1,state:O.PUBLISH_FAIL})),e.abrupt("return",u);case 27:throw e.prev=27,e.t0=e.catch(16),e.t0.code===sD.INVALID_TOKEN&&(this._tempRoomConfig=o),e.t0;case 31:case"end":return e.stop()}}),e,this,[[16,27]])}))),function(e,t,r,n){return Ne.apply(this,arguments)})},{key:"leaveRoom",value:(Oe=o(regeneratorRuntime.mark((function e(){var t,r,n,i=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=i.length>0&&void 0!==i[0]&&i[0],aq.print("leaveRoom()"),!t){e.next=7;break}return e.next=5,null===(r=this._room)||void 0===r?void 0:r.leave(t);case 5:e.next=8;break;case 7:null===(n=this._room)||void 0===n||n.leave(t).catch();case 8:this._removeHandlerEventHandler(),this._liveTranscodeConfig&&this.stopLiveTranscoding(),this._room=void 0,this._remoteAudioPlayer.forEach((function(e){return e.destroy()})),this._remoteAudioPlayer=new Map,this._remoteScreenPlayer.forEach((function(e){return e.destroy()})),this._remoteScreenPlayer=new Map,this._remoteVideoPlayer.forEach((function(e){return e.destroy()})),this._remoteVideoPlayer=new Map,this._roomConfig=void 0,this._publicStreamIds=new Map;case 19:case"end":return e.stop()}}),e,this)}))),function(){return Oe.apply(this,arguments)})},{key:"destroy",value:function(){var e,t,r;aq.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=[pF],this._screenStreamEncodeConfig=[_F],this._pauseAllSubscribeState={audio:!1,video:!1},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._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()}},{key:"publishStream",value:(Ce=o(regeneratorRuntime.mark((function e(t){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return aq.print("publishStream()","mediaType: %o",t),this._checkMediaType(t),this._assertNotInRoom(),UP(t)&&!this._localVideoTrack&&this._localImgVideoTrack&&(this._localVideoTrack=(r=this._localImgVideoTrack,new kj(r,bP())),this._localVideoTrack.dummy=!0),e.next=6,this._updatePublish({mediaType:t});case 6:case"end":return e.stop()}var r}),e,this)}))),function(e){return Ce.apply(this,arguments)})},{key:"unpublishStream",value:(we=o(regeneratorRuntime.mark((function e(t){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return aq.print("unpublishStream()","mediaType: %o",t),this._checkMediaType(t),this._assertNotInRoom(),e.next=5,this._updatePublish({mediaType:t,pubState:Zj.UNPUB});case 5:case"end":return e.stop()}}),e,this)}))),function(e){return we.apply(this,arguments)})},{key:"publishScreen",value:(Ae=o(regeneratorRuntime.mark((function e(t){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return aq.print("publishScreen()","mediaType: %o",t),this._checkMediaType(t),this._assertNotInRoom(),e.prev=3,UP(t)&&!this._localScreenVideoTrack&&this._localImgScreenTrack&&(this._localScreenVideoTrack=(r=this._localImgScreenTrack,new Rj(r,bP())),this._localScreenVideoTrack.dummy=!0),e.next=7,this._updateScreenPublish({mediaType:t,pubState:Zj.PUB});case 7:e.next=16;break;case 9:if(e.prev=9,e.t0=e.catch(3),!(e.t0 instanceof cD)){e.next=15;break}throw e.t0;case 15:throw new cD(sD.UNEXPECTED_ERROR,"unexpected error",e.t0);case 16:case"end":return e.stop()}var r}),e,this,[[3,9]])}))),function(e){return Ae.apply(this,arguments)})},{key:"unpublishScreen",value:(Ie=o(regeneratorRuntime.mark((function e(t){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return aq.print("unpublishScreen()","mediaType: %o",t),this._checkMediaType(t),this._assertNotInRoom(),e.next=5,this._updateScreenPublish({mediaType:t,pubState:Zj.UNPUB});case 5:case"end":return e.stop()}}),e,this)}))),function(e){return Ie.apply(this,arguments)})},{key:"subscribeStream",value:(Te=o(regeneratorRuntime.mark((function e(t,r){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return aq.print("subscribeStream()","userId: %o, mediaType: %o",t,r),e.abrupt("return",this._subscribe(!1,t,r));case 2:case"end":return e.stop()}}),e,this)}))),function(e,t){return Te.apply(this,arguments)})},{key:"_subscribe",value:(Re=o(regeneratorRuntime.mark((function e(t,r,n){var i,o,a,s,u,c,d,l,h,f;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._checkMediaType(n),this._assertNotInRoom(),s=this._room.remoteStreams.get(r),u=null==s?void 0:s.find((function(e){return e.isScreen===t}))){e.next=6;break}throw new cD(sD.STREAM_NOT_EXIST,"stream not exist");case 6:return this._pauseAllSubscribeState.audio&&(n-=n&P.AUDIO),this._pauseAllSubscribeState.video&&(n-=n&P.VIDEO),aq.print("subscribeStream()","due to pauseAll mediaType: %o",n),c=u.hasSubscribed,d=this._remoteVideoConfig.get(r)||(null===(i=this._roomConfig)||void 0===i?void 0:i.remoteVideoConfig),u.originalMediaType=n,e.next=14,this._room.subscribe(u,n,d);case 14:MP(n)&&this._updateAudioPlayerState(u),UP(n)&&this._updateVideoPlayerState(u),!t&&(null!==(o=this._roomConfig)&&void 0!==o&&o.isAutoSubscribeAudio||null!==(a=this._roomConfig)&&void 0!==a&&a.isAutoSubscribeVideo)&&(u.audioTrack||u.videoTrack)&&(l={userId:r,isScreen:!1,state:C.SUBSCRIBE_SUCC},this.safeEmit(ee.onAutoSubscribeResult,l)),!c&&MP(n)&&(null===(h=u.observer)||void 0===h||h.setSubscribeAudio(!0)),!c&&UP(n)&&(null===(f=u.observer)||void 0===f||f.setSubscribeVideo(!0));case 19:case"end":return e.stop()}}),e,this)}))),function(e,t,r){return Re.apply(this,arguments)})},{key:"unsubscribeStream",value:(ke=o(regeneratorRuntime.mark((function e(t,r){var n,i;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(aq.print("unsubscribeStream()","userId: %o, mediaType: %o",t,r),this._checkMediaType(r),this._assertNotInRoom(),n=this._room.remoteStreams.get(t),null!=(i=null==n?void 0:n.find((function(e){return!e.isScreen})))&&i.hasSubscribed){e.next=7;break}throw new cD(sD.STREAM_NOT_EXIST,"stream not exist");case 7:this._room.unsubscribe(i,r);case 8:case"end":return e.stop()}}),e,this)}))),function(e,t){return ke.apply(this,arguments)})},{key:"subscribeScreen",value:(Ee=o(regeneratorRuntime.mark((function e(t,r){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return aq.print("subscribeScreen() userId: %o, mediaType: %o",t,r),e.abrupt("return",this._subscribe(!0,t,r));case 2:case"end":return e.stop()}}),e,this)}))),function(e,t){return Ee.apply(this,arguments)})},{key:"unsubscribeScreen",value:(be=o(regeneratorRuntime.mark((function e(t,r){var n,i;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(aq.print("unsubscribeScreen() userId: %o, mediaType: %o",t,r),this._checkMediaType(r),this._assertNotInRoom(),n=this._room.remoteStreams.get(t),null!=(i=null==n?void 0:n.find((function(e){return e.isScreen})))&&i.hasSubscribed){e.next=7;break}throw new cD(sD.STREAM_NOT_EXIST,"stream not exist");case 7:this._room.unsubscribe(i,r);case 8:case"end":return e.stop()}}),e,this)}))),function(e,t){return be.apply(this,arguments)})},{key:"setRemoteVideoConfig",value:(Se=o(regeneratorRuntime.mark((function e(t,r){var n;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return aq.print("setRemoteVideoConfig() userId: %o, remoteVideoConfig: %o",t,r),YP(t),rM(r),this._remoteVideoConfig.set(t,r),e.abrupt("return",null===(n=this._room)||void 0===n?void 0:n.updateSubVideoConfig(t,r).then((function(){})));case 5:case"end":return e.stop()}}),e,this)}))),function(e,t){return Se.apply(this,arguments)})},{key:"startVideoCapture",value:(ye=o(regeneratorRuntime.mark((function e(t){var r,n,i,o,a,s,u,c,d,l=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(aq.print("startVideoCapture()","deviceId: %s",t),XP(t)||jP(t,"deviceId"),t=t||this._localVideoDeviceId,this._localVideoDeviceId=t,!this._localVideoTrack||this._localVideoTrack.dummy){e.next=6;break}throw new cD(sD.REPEAT_CAPTURE,"Has already capture");case 6:return o=this._videoStreamConstraints,t&&("user"===t||"environment"===t||"left"===t||"right"===t?o.facingMode=t:o.deviceId={exact:t},this._videoStreamConstraints=o),e.next=10,wj(o);case 10:if(a=e.sent,this._initLocalTrackEvents(a),this._localVideoTrack=a,null===(r=this._videoPlayer)||void 0===r||r.playVideo(a),s={},(u=null==a?void 0:a.getTrack())&&(s=u.getSettings(),c={width:s.width,height:s.height},this._localVideoTrack.resolution=c,setTimeout((function(){return l.safeEmit(ee.onLocalVideoSizeChanged,{streamIndex:D.STREAM_INDEX_MAIN,info:c})}))),this._room){e.next=19;break}return e.abrupt("return",s);case 19:return d=this._room._roomConfig.isAutoPublish,(this._room.hasPublished||d)&&(this._visibility?this._updatePublish():this.safeEmit(ee.onAutoPublishResult,{isScreen:!1,state:O.PUBLISH_FAIL})),null===(n=this._room.localStream)||void 0===n||null===(i=n.observer)||void 0===i||i.setEnableVideo(!0),e.abrupt("return",s);case 23:case"end":return e.stop()}}),e,this)}))),function(e){return ye.apply(this,arguments)})},{key:"stopVideoCapture",value:(ge=o(regeneratorRuntime.mark((function e(){var t,r,n,i,o;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(aq.print("stopVideoCapture()"),this._trackSourceType.video!==R.VIDEO_SOURCE_TYPE_EXTERNAL){e.next=3;break}throw new cD(sD.STREAM_TYPE_NOT_MATCH,"setVideoSourceType as internal first");case 3:if(null===(t=this._videoPlayer)||void 0===t||t.stop(),null===(r=this._localVideoTrack)||void 0===r||r.close(),this._localImgVideoTrack&&this._localVideoTrack?(null===(o=this._localVideoTrack)||void 0===o||o.setTrack(this._localImgVideoTrack),this._localVideoTrack.dummy=!0):this._localVideoTrack=void 0,this._room){e.next=8;break}return e.abrupt("return");case 8:if(!this._room.hasPublished){e.next=11;break}return e.next=11,this._updatePublish();case 11:null===(n=this._room.localStream)||void 0===n||null===(i=n.observer)||void 0===i||i.setEnableVideo(!1);case 12:case"end":return e.stop()}}),e,this)}))),function(){return ge.apply(this,arguments)})},{key:"startAudioCapture",value:(me=o(regeneratorRuntime.mark((function e(t){var r,n,i,o,a;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(aq.print("startAudioCapture()","deviceId: $o",t),XP(t)||jP(t,"deviceId"),t=t||this._localAudioDeviceId,this._localAudioDeviceId=t,!this._localAudioTrack){e.next=6;break}throw new cD(sD.REPEAT_CAPTURE,"Has already capture");case 6:return i=this._audioStreamConstraints,t&&(i.deviceId={exact:t},this._audioStreamConstraints=i),e.next=10,Oj(i,this._audioProfileManager);case 10:if(o=e.sent,this._initLocalTrackEvents(o),this._localAudioTrack=o,this._tempMixingAudioTrack&&(this._localAudioTrack.mixType=this._tempMixingAudioTrack.type,this._localAudioTrack.mixedAudioTrack=this._tempMixingAudioTrack.track,delete this._tempMixingAudioTrack),this._room){e.next=16;break}return e.abrupt("return");case 16:a=this._room._roomConfig.isAutoPublish,(this._room.hasPublished||a)&&(this._visibility?this._updatePublish():this.safeEmit(ee.onAutoPublishResult,{isScreen:!1,state:O.PUBLISH_FAIL})),null===(r=this._room.localStream)||void 0===r||null===(n=r.observer)||void 0===n||n.setEnableAudio(!0);case 19:case"end":return e.stop()}}),e,this)}))),function(e){return me.apply(this,arguments)})},{key:"stopAudioCapture",value:(ve=o(regeneratorRuntime.mark((function e(){var t,r,n;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(aq.print("stopAudioCapture()"),null===(t=this._localAudioTrack)||void 0===t||t.close(),this._localAudioTrack=void 0,this._audioMixingManager.stopAll(),this._trackSourceType.audio!==T.AUDIO_SOURCE_TYPE_EXTERNAL){e.next=6;break}throw new cD(sD.STREAM_TYPE_NOT_MATCH,"setAudioSourceType as internal first");case 6:if(this._room){e.next=8;break}return e.abrupt("return");case 8:if(!this._room.hasPublished){e.next=11;break}return e.next=11,this._updatePublish();case 11:null===(r=this._room.localStream)||void 0===r||null===(n=r.observer)||void 0===n||n.setEnableAudio(!1);case 12:case"end":return e.stop()}}),e,this)}))),function(){return ve.apply(this,arguments)})},{key:"getAudioMixingManager",value:function(){return aq.print("getAudioMixingManager()"),this._audioMixingManager}},{key:"startScreenCapture",value:(_e=o(regeneratorRuntime.mark((function e(){var t,r,n,i,o,a,s,u,c,d,l,h,f,p,_,v=this,m=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(a=m.length>0&&void 0!==m[0]?m[0]:{},aq.print("startScreenCapture()","config: %o",a),null!==(t=this._localScreenVideoTrack)&&void 0!==t&&t.dummy||null===(s=this._localScreenVideoTrack)||void 0===s||s.close(),this._localScreenVideoTrack=void 0,u=a.enableAudio,c=void 0!==u&&u,this._trackSourceType.screenVideo!==R.VIDEO_SOURCE_TYPE_EXTERNAL){e.next=7;break}throw new cD(sD.STREAM_TYPE_NOT_MATCH,"setVideoSourceType as internal first");case 7:if(this._trackSourceType.screenAudio!==T.AUDIO_SOURCE_TYPE_EXTERNAL){e.next=9;break}throw new cD(sD.STREAM_TYPE_NOT_MATCH,"setAudioSourceType as internal first");case 9:return e.next=11,xj(c,this._screenStreamEncodeConfig[0]);case 11:if(d=e.sent,this._localScreenVideoTrack=new Rj(d.getVideoTracks()[0],bP()),null!==(r=this._screenStreamEncodeConfig[0])&&void 0!==r&&r.contentHint&&this._localScreenVideoTrack.setContentHint(null===(l=this._screenStreamEncodeConfig[0])||void 0===l?void 0:l.contentHint),(h=null===(n=this._localScreenVideoTrack)||void 0===n?void 0:n.getTrack())&&(f=h.getSettings(),p={width:f.width,height:f.height},this._localScreenVideoTrack.resolution=p,setTimeout((function(){return v.safeEmit(ee.onLocalVideoSizeChanged,{streamIndex:D.STREAM_INDEX_SCREEN,info:{width:f.width,height:f.height}})}))),(_=d.getAudioTracks()).length&&(this._localScreenAudioTrack=new Tj(_[0],bP()),this._initLocalTrackEvents(this._localScreenAudioTrack)),null===(i=this._screenPlayer)||void 0===i||i.playVideo(this._localScreenVideoTrack),this._initLocalTrackEvents(this._localScreenVideoTrack,!0),null===(o=this._room)||void 0===o||!o.hasScreenPublished){e.next=23;break}return e.next=23,this._updateScreenPublish();case 23:case"end":return e.stop()}}),e,this)}))),function(){return _e.apply(this,arguments)})},{key:"stopScreenCapture",value:(pe=o(regeneratorRuntime.mark((function e(){var t,r,n,i;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(aq.print("stopScreenCapture()"),null===(t=this._screenPlayer)||void 0===t||t.stop(),null===(r=this._localScreenVideoTrack)||void 0===r||r.close(),this._localImgScreenTrack&&this._localScreenVideoTrack?(this._localScreenVideoTrack.setTrack(this._localImgScreenTrack),this._localScreenVideoTrack.dummy=!0):this._localScreenVideoTrack=void 0,null===(n=this._localScreenAudioTrack)||void 0===n||n.close(),this._localScreenAudioTrack=void 0,null===(i=this._room)||void 0===i||!i.hasScreenPublished){e.next=9;break}return e.next=9,this._updateScreenPublish();case 9:case"end":return e.stop()}}),e,this)}))),function(){return pe.apply(this,arguments)})},{key:"setLocalVideoPlayer",value:function(e,t){if(aq.print("setLocalVideoPlayer()","streamIndex: %o, videoPlayerOption: %o",e,t),GP(e,"streamIndex",[D.STREAM_INDEX_MAIN,D.STREAM_INDEX_SCREEN]),t&&t.renderDom){var n,i,o=r({userId:this._getUserId()},t);if($P(o),e==D.STREAM_INDEX_MAIN&&!this._videoPlayer)return this._videoPlayer=new JG(o),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)!==q.PLAY_MANUALLY&&this._videoPlayer.playVideo(this._localVideoTrack),this._videoPlayer.domElement;if(e===D.STREAM_INDEX_SCREEN&&!this._screenPlayer)return this._screenPlayer=new JG(r(r({},o),{},{isScreen:!0})),this._initPlayerEvents(this._screenPlayer),this._localScreenVideoTrack&&!this._localScreenVideoTrack.dummy&&(null===(i=this._config)||void 0===i?void 0:i.autoPlayPolicy)!==q.PLAY_MANUALLY&&this._screenPlayer.playVideo(this._localScreenVideoTrack),this._screenPlayer.domElement}else{var a,s;e===D.STREAM_INDEX_MAIN?(null===(a=this._videoPlayer)||void 0===a||a.destroy(),delete this._videoPlayer):(null===(s=this._screenPlayer)||void 0===s||s.destroy(),delete this._screenPlayer)}}},{key:"startLiveTranscoding",value:(fe=o(regeneratorRuntime.mark((function e(t){var r;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return aq.print("startLiveTranscoding()","transcode: %o",t),jP(t.url,"liveTranscode.url"),this._liveTranscodeConfig=t,e.prev=3,this.safeEmit(ee.onStreamMixingEvent,{event:Qj.START,error:0,message:""}),e.next=7,null===(r=this._room)||void 0===r?void 0:r.liveControlMessage(dF("started",this._liveTranscodeConfig));case 7:e.next=16;break;case 9:if(e.prev=9,e.t0=e.catch(3),!(e.t0 instanceof cD)){e.next=15;break}throw e.t0;case 15:throw new cD(sD.UNEXPECTED_ERROR,"unexpected error",e.t0);case 16:case"end":return e.stop()}}),e,this,[[3,9]])}))),function(e){return fe.apply(this,arguments)})},{key:"updateLiveTranscoding",value:(he=o(regeneratorRuntime.mark((function e(t){var r;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(aq.print("updateLiveTranscoding()","transcode: %o",t),this._liveTranscodeConfig){e.next=3;break}return e.abrupt("return");case 3:return this._liveTranscodeConfig=bz(this._liveTranscodeConfig,t),e.prev=4,this.safeEmit(ee.onStreamMixingEvent,{event:Qj.UPDATE,error:0,message:""}),e.next=8,null===(r=this._room)||void 0===r?void 0:r.liveControlMessage(dF("layoutChanged",this._liveTranscodeConfig));case 8:e.next=17;break;case 10:if(e.prev=10,e.t0=e.catch(4),!(e.t0 instanceof cD)){e.next=16;break}throw e.t0;case 16:throw new cD(sD.UNEXPECTED_ERROR,"unexpected error",e.t0);case 17:case"end":return e.stop()}}),e,this,[[4,10]])}))),function(e){return he.apply(this,arguments)})},{key:"stopLiveTranscoding",value:(le=o(regeneratorRuntime.mark((function e(){var t;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(aq.print("stopLiveTranscoding()"),this._liveTranscodeConfig){e.next=3;break}return e.abrupt("return");case 3:return delete this._liveTranscodeConfig,e.prev=4,this.safeEmit(ee.onStreamMixingEvent,{event:Qj.STOP,error:0,message:""}),e.next=8,null===(t=this._room)||void 0===t?void 0:t.liveControlMessage({action:"stopped",type:"transcode"});case 8:e.next=17;break;case 10:if(e.prev=10,e.t0=e.catch(4),!(e.t0 instanceof cD)){e.next=16;break}throw e.t0;case 16:throw new cD(sD.UNEXPECTED_ERROR,"unexpected error",e.t0);case 17:case"end":return e.stop()}}),e,this,[[4,10]])}))),function(){return le.apply(this,arguments)})},{key:"setBusinessId",value:function(e){return aq.print("setBusinessId()","businessId: %s",e),!function(e){return"string"!=typeof e}(e)&&!this._room&&(jV.setStats({rtc_business_id:e}),this._businessId=e,!0)}},{key:"setUserVisibility",value:(de=o(regeneratorRuntime.mark((function e(t){var r,n;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(aq.print("setUserVisibility()","enable: %o",t),t=!!t,this._visibility!==t){e.next=4;break}return e.abrupt("return");case 4:if(this._room){e.next=7;break}return this._visibility=t,e.abrupt("return");case 7:if(this._room.connectionState===IG.CONNECTED){e.next=9;break}throw new cD(sD.NOT_CONNECTED_YET,"server not connected");case 9:if(this._room.localStream&&(null===(n=this._room.localStream.observer)||void 0===n||n.setPublisher(t)),e.t0=!t,!e.t0){e.next=14;break}return e.next=14,this._room.unpublish();case 14:return e.next=16,this._room.updateUserAttributes({role:t?XX.NORMAL_USER:XX.SILENT_USER});case 16:this._visibility=t,t&&null!==(r=this._roomConfig)&&void 0!==r&&r.isAutoPublish&&this._updatePublish({mediaType:P.AUDIO_AND_VIDEO});case 18:case"end":return e.stop()}}),e,this)}))),function(e){return de.apply(this,arguments)})},{key:"_initPlayerEvents",value:function(e){var t=this,r=arguments.length>1&&void 0!==arguments[1]&&arguments[1];e.on("playback_event",(function(n){switch(n.eventName){case"timeupdate":return;case"loadeddata":if("audio"===n.type)r?t.safeEmit(ee.onFirstPublicStreamAudioFrameDecoded,{publicStreamId:e.userId}):t.safeEmit(ee.onAudioFirstFrameDecoded,{userId:e.userId}),VV.firstRemoteAudioRender("",n.userId||"");else{var i,o,a={userId:e.userId,height:(null===(i=e.domElement)||void 0===i?void 0:i.videoHeight)||0,width:(null===(o=e.domElement)||void 0===o?void 0:o.videoWidth)||0};r?(a.publicStreamId=a.userId,delete a.userId,t.safeEmit(ee.onFirstPublicStreamVideoFrameDecoded,a),t.safeEmit(ee.onFirstPublicStreamVideoFrameRendered,a)):(t.safeEmit(ee.onVideoFirstFrameDecoded,a),t.safeEmit(ee.onVideoFirstFrameRendered,a)),VV.firstRemoteVideoRender("",n.userId||"")}break;case"autoplay-error":return r&&(n.publicStreamId=n.userId),void t.safeEmit(ee.onAutoplayFailed,{userId:n.userId||n.publicStreamId,kind:e instanceof JG?"video":"audio"})}t.safeEmit(ee.onPlayerEvent,n)}))}},{key:"_initLocalTrackEvents",value:function(e){var t=this,r=arguments.length>1&&void 0!==arguments[1]&&arguments[1];e.on("track-ended",(function(e){var r=!1;e!==t._localScreenAudioTrack&&e!==t._localScreenVideoTrack||(r=!0),t.safeEmit(ee.onTrackEnded,{kind:e.getTrack().kind,isScreen:r})})),e.on("resolution-change",(function(e){t.safeEmit(ee.onLocalVideoSizeChanged,{streamIndex:r?D.STREAM_INDEX_SCREEN:D.STREAM_INDEX_MAIN,info:e})}))}},{key:"setRemoteVideoPlayer",value:function(e,t){aq.print("setRemoteVideoPlayer()","streamIndex: %o, videoPlayerOption: %o",e,t),GP(e,"streamIndex",[D.STREAM_INDEX_MAIN,D.STREAM_INDEX_SCREEN]),$P(t);var n,i,o,a=t.userId;if(e===D.STREAM_INDEX_MAIN){var s,u,c;if(null===(s=this._remoteVideoPlayer.get(a))||void 0===s||s.destroy(),!t.renderDom)return;var d=new JG(t);this._initPlayerEvents(d),this._remoteVideoPlayer.set(a,d);var l=null===(u=this._room)||void 0===u||null===(c=u.remoteStreams.get(a))||void 0===c?void 0:c.find((function(e){return!e.isScreen}));return l&&this._updateVideoPlayerState(l),d.domElement}if(null===(n=this._remoteScreenPlayer.get(a))||void 0===n||n.destroy(),t.renderDom){var h=new JG(r(r({},t),{},{isScreen:!0}));this._remoteScreenPlayer.set(a,h),this._initPlayerEvents(h);var f=null===(i=this._room)||void 0===i||null===(o=i.remoteStreams.get(a))||void 0===o?void 0:o.find((function(e){return e.isScreen}));return f&&this._updateVideoPlayerState(f),h.domElement}}},{key:"setLocalVideoMirrorType",value:function(e){aq.print("setLocalVideoMirrorType()","mirrorType: %o",e),GP(e,"mirrorType",[L.MIRROR_TYPE_NONE,L.MIRROR_TYPE_RENDER]),this._mirrorType=e,this._videoPlayer&&this._videoPlayer.mirror(!!e)}},{key:"setAudioPlaybackDevice",value:(ce=o(regeneratorRuntime.mark((function e(t){var r;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(aq.print("setAudioPlaybackDevice()","deviceId: %s",t),jP(t,"deviceId"),void 0!==HTMLAudioElement.prototype.setSinkId){e.next=5;break}return aq.print("setAudioPlaybackDevice failed","setSinkId not supported by current browser"),e.abrupt("return");case 5:return e.next=7,uj.getDeviceById(t);case 7:if(r=e.sent){e.next=10;break}throw new cD(sD.INVALID_DEVICE_ID,"audio playback device id ".concat(t," is invalid"));case 10:this._remoteAudioPlayer.forEach((function(e){e.setPlaybackDevice(t)})),this._audioPlaybackDeviceId=t,r&&this.safeEmit(ee.onAudioPlaybackDeviceChanged,r),VV.rtcAudioDevice(IV.PLAYOUT_DEVICE_SWITCH,t,0);case 14:case"end":return e.stop()}}),e,this)}))),function(e){return ce.apply(this,arguments)})},{key:"play",value:(ue=o(regeneratorRuntime.mark((function e(t){var r,n,i,o,a;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(aq.print("play()","userId | publicStreamId: %s",t),a=null===(r=this._room)||void 0===r||null===(n=r.remoteStreams.get(t||""))||void 0===n?void 0:n.find((function(e){return!e.isScreen})),i=this._remoteAudioPlayer.get(t||""),o=this._remoteVideoPlayer.get(t||""),i||(i=this._publicStreamAudioPlayer.get(t||"")),o||(o=this._publicStreamVideoPlayer.get(t||"")),t||!this._audioMixingManager){e.next=9;break}return e.next=9,this._audioMixingManager.resumeLocalPlay();case 9:!t&&this._videoPlayer&&(o=this._videoPlayer),o&&(o.played?o.manuallyPlay():a&&a.videoTrack?o.playVideo(a.videoTrack,a):!t&&this._localVideoTrack&&(o.mirror(!!this._mirrorType),o.playVideo(this._localVideoTrack))),i&&(i.played?i.manuallyPlay():a&&a.audioTrack&&i.playAudio(a.audioTrack));case 12:case"end":return e.stop()}}),e,this)}))),function(e){return ue.apply(this,arguments)})},{key:"pauseAllSubscribedStream",value:(se=o(regeneratorRuntime.mark((function e(t){var r,n=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(aq.print("pauseAllSubscribedStream()","mediaType: %o",t),this._checkMediaType(t),!this._pauseAllSubscribeState.audio||!this._pauseAllSubscribeState.video){e.next=4;break}return e.abrupt("return",Promise.resolve());case 4:if(r=function(){MP(t)&&(n._pauseAllSubscribeState.audio=!0),UP(t)&&(n._pauseAllSubscribeState.video=!0)},this._room){e.next=8;break}return r(),e.abrupt("return",Promise.resolve());case 8:return e.abrupt("return",this._room.pauseAllSubscribedStream(t).then((function(){r()})));case 9:case"end":return e.stop()}}),e,this)}))),function(e){return se.apply(this,arguments)})},{key:"resumeAllSubscribedStream",value:(ae=o(regeneratorRuntime.mark((function e(t){var r,n=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(aq.print("resumeAllSubscribedStream()","mediaType: %o",t),this._checkMediaType(t),this._pauseAllSubscribeState.audio||this._pauseAllSubscribeState.video){e.next=4;break}return e.abrupt("return",Promise.resolve());case 4:if(r=function(){MP(t)&&(n._pauseAllSubscribeState.audio=!1),UP(t)&&(n._pauseAllSubscribeState.video=!1)},this._room){e.next=8;break}return r(),e.abrupt("return",Promise.resolve());case 8:return e.abrupt("return",this._room.resumeAllSubscribedStream(t).then((function(){var e,t;r(),null===(e=n._room)||void 0===e||null===(t=e.remoteStreams)||void 0===t||t.forEach((function(e){Array.isArray(e)&&e.forEach((function(e){n._updateAudioPlayerState(e),n._updateVideoPlayerState(e)}))}))})));case 9:case"end":return e.stop()}}),e,this)}))),function(e){return ae.apply(this,arguments)})},{key:"sendUserMessage",value:(oe=o(regeneratorRuntime.mark((function e(t,r){var n,i,o=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(YP(t),eM(r),this._room&&this._room.connectionState===IG.CONNECTED){e.next=4;break}throw new cD(sD.IM_BEFORE_JOIN,"join first");case 4:return i=Date.now(),e.abrupt("return",null===(n=this._room.sendUserMessage(t,r))||void 0===n?void 0:n.then((function(e){return o._messageStatisticsObserver.countP2PMessage(!0,t,!1,i,e),e.id})).catch((function(e){throw o._messageStatisticsObserver.countP2PMessage(!1,t,!1,i),e})));case 6:case"end":return e.stop()}}),e,this)}))),function(e,t){return oe.apply(this,arguments)})},{key:"sendUserBinaryMessage",value:(ie=o(regeneratorRuntime.mark((function e(t,r){var n,i,o=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(YP(t),zP(r,"message"),eM(r),this._room&&this._room.connectionState===IG.CONNECTED){e.next=5;break}throw new cD(sD.IM_BEFORE_JOIN,"join first");case 5:return i=Date.now(),e.abrupt("return",null===(n=this._room.sendUserMessage(t,r))||void 0===n?void 0:n.then((function(e){return o._messageStatisticsObserver.countP2PMessage(!0,t,!0,i,e),e.id})).catch((function(e){throw o._messageStatisticsObserver.countP2PMessage(!1,t,!0,i),e})));case 7:case"end":return e.stop()}}),e,this)}))),function(e,t){return ie.apply(this,arguments)})},{key:"sendRoomMessage",value:(ne=o(regeneratorRuntime.mark((function e(t){var r,n=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(eM(t),this._room&&this._room.connectionState===IG.CONNECTED){e.next=3;break}throw new cD(sD.IM_BEFORE_JOIN,"join first");case 3:return r=Date.now(),e.abrupt("return",this._room.sendRoomMessage(t).then((function(e){var t,i;return n._messageStatisticsObserver.countRoomMessage(!0,null===(t=n._room)||void 0===t||null===(i=t.roomInfo)||void 0===i?void 0:i.roomId,!1,r),e})).catch((function(e){var t,i;throw n._messageStatisticsObserver.countRoomMessage(!1,null===(t=n._room)||void 0===t||null===(i=t.roomInfo)||void 0===i?void 0:i.roomId,!1,r),e})));case 5:case"end":return e.stop()}}),e,this)}))),function(e){return ne.apply(this,arguments)})},{key:"sendRoomBinaryMessage",value:(re=o(regeneratorRuntime.mark((function e(t){var r,n=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(eM(t),this._room&&this._room.connectionState===IG.CONNECTED){e.next=3;break}throw new cD(sD.IM_BEFORE_JOIN,"join first");case 3:return r=Date.now(),e.abrupt("return",this._room.sendRoomMessage(t,!0).then((function(e){var t,i;return n._messageStatisticsObserver.countRoomMessage(!0,null===(t=n._room)||void 0===t||null===(i=t.roomInfo)||void 0===i?void 0:i.roomId,!0,r),e})).catch((function(e){var t,i;throw n._messageStatisticsObserver.countRoomMessage(!1,null===(t=n._room)||void 0===t||null===(i=t.roomInfo)||void 0===i?void 0:i.roomId,!0,r),e})));case 5:case"end":return e.stop()}}),e,this)}))),function(e){return re.apply(this,arguments)})},{key:"setAudioCaptureConfig",value:(te=o(regeneratorRuntime.mark((function e(){var t,r,n,i=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=i.length>0&&void 0!==i[0]?i[0]:{},aq.print("setAudioCaptureConfig()","config: %o",t),delete t.deviceId,KP(t),r=this._audioStreamConstraints.deviceId,this._audioStreamConstraints=t,r&&(this._audioStreamConstraints.deviceId=r),!this._localAudioTrack){e.next=11;break}return this._localAudioTrack.audioCaptureConfig=this._audioStreamConstraints,e.next=11,null===(n=this._localAudioTrack)||void 0===n?void 0:n.updateAudioCaptureConfig();case 11:case"end":return e.stop()}}),e,this)}))),function(){return te.apply(this,arguments)})},{key:"setVideoCaptureConfig",value:($=o(regeneratorRuntime.mark((function e(){var t,r,n,i=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=i.length>0&&void 0!==i[0]?i[0]:{},aq.print("setVideoCaptureConfig()","config: %o",t),delete t.deviceId,KP(t),r=this._videoStreamConstraints.deviceId,this._videoStreamConstraints=t,r&&(this._videoStreamConstraints.deviceId=r),!this._localVideoTrack){e.next=12;break}return this._localVideoTrack.videoCaptureConfig=this._videoStreamConstraints,e.next=11,null===(n=this._localVideoTrack)||void 0===n?void 0:n.updateVideoCaptureConfig();case 11:this._updatePublish();case 12:case"end":return e.stop()}}),e,this)}))),function(){return $.apply(this,arguments)})},{key:"enableSimulcastMode",value:function(e){return aq.print("enableSimulcastMode()","enabled: %o",e),this._enableSimulcast=e,!0}},{key:"setVideoEncoderConfig",value:(Z=o(regeneratorRuntime.mark((function e(t){var r;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:aq.print("setVideoEncoderConfig()"," descriptions: %o",t),Array.isArray(t)||(t=[t]),t.length>3&&(t=t.slice(0,3)),t.sort((function(e,t){return t.maxKbps-e.maxKbps})),this._videoStreamEncodeConfig=t,null!==(r=this._room)&&void 0!==r&&r.hasPublished&&this._updatePublish();case 6:case"end":return e.stop()}}),e,this)}))),function(e){return Z.apply(this,arguments)})},{key:"setScreenEncoderConfig",value:(J=o(regeneratorRuntime.mark((function e(t){var r;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:aq.print("setScreenEncoderConfig()","description: %o",t),this._screenStreamEncodeConfig=[t],this._localScreenVideoTrack&&(this._localScreenVideoTrack.videoCaptureConfig=t,this._localScreenVideoTrack.updateVideoCaptureConfig(),t.contentHint&&this._localScreenVideoTrack.setContentHint(t.contentHint)),null!==(r=this._room)&&void 0!==r&&r.hasScreenPublished&&this._updateScreenPublish();case 4:case"end":return e.stop()}}),e,this)}))),function(e){return J.apply(this,arguments)})},{key:"sendSEIMessage",value:function(e,t,r){aq.print("sendSEIMessage()","streamIdex: %o, message: %o, repeatCount: %o",e,t,r),GP(e,"streamIndex",[D.STREAM_INDEX_MAIN,D.STREAM_INDEX_SCREEN]),BP(r,"repeatCount",0,30);var n="string"==typeof t?new Uint8Array(TP.str2ab(t)):t;if(t.length){var i;if(e===D.STREAM_INDEX_MAIN){var o,a,s;if(null===(o=this._room)||void 0===o||null===(a=o.localStream)||void 0===a||!a.hasPublished)return;i=null===(s=this._room)||void 0===s?void 0:s.localStream}else{var u,c,d;if(null===(u=this._room)||void 0===u||null===(c=u.localScreenStream)||void 0===c||!c.hasPublished)return;i=null===(d=this._room)||void 0===d?void 0:d.localScreenStream}if(n.byteLength>4096)aq.print("sei size must not bigger than 4KB");else{var l=bP();i.seiList.push({content:n,uuid:l,repeatCount:r}),setTimeout((function(){if(i){var e=i.seiList.findIndex((function(e){return e.uuid===l}));e&&i.seiList.splice(e,1)}}),2e3)}}else aq.print("sei message must not be empty")}},{key:"setAudioVolumeIndicationInterval",value:function(e){var t=this;aq.print("setAudioVolumeIndicationInterval()","interval %o: ",e),("number"!=typeof e||e<200)&&(e=200);var r=[];this._audioVolumeIndicationTimer&&clearInterval(this._audioVolumeIndicationTimer),this._audioVolumeIndicationTimer=setInterval((function(){var e,n;r=[],null===(e=t._room)||void 0===e||e.remoteStreams.forEach((function(e,t){var n;if(0!==e.length){var i=e.find((function(e){return!1===e.isScreen})),o=null==i||null===(n=i.audioTrack)||void 0===n?void 0:n.getAudioLevel();r.push({userId:t,volume:o||0})}}));var i=null===(n=t._localAudioTrack)||void 0===n?void 0:n.getAudioLevel();r.push({userId:t._getUserId(),volume:i||0}),t.safeEmit(ee.onAudioVolumeIndication,{speakers:r})}),e)}},{key:"_sendActiveSpeaker",value:function(e,t){if(this._room&&this._room.remoteUsers.size>=1){var r,n=e[0],i=t.reduce((function(e,t){return e&&e.audioPropertiesInfo.nonlinearVolume>t.audioPropertiesInfo.nonlinearVolume?e:t}),void 0);if((r=n?i?n.audioPropertiesInfo.nonlinearVolume>i.audioPropertiesInfo.nonlinearVolume?n:i:n:i)&&r.audioPropertiesInfo.nonlinearVolume>-60){var o,a;if(r.streamKey)o=this._room.remoteUsers.get(r.streamKey.userId);else o=null===(a=this._room._roomInfo)||void 0===a?void 0:a.userInfo;o&&this.safeEmit(ee.onActiveSpeaker,{userId:o.userId,extraInfo:o.extraInfo})}}}},{key:"enableAudioPropertiesReport",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};aq.print("enableAudioPropertiesReport()","config %o: ",t);var r=t.enableInBackground,n=void 0===r||r,i=t.interval,o=void 0===i?100:i;this._stopAudioPropertiesReport(),o<=0||(o=Math.max(100,o),this._audioPropertiesReportTimer=self.setInterval((function(){if(n||"hidden"!==document.visibilityState){var t=[],r=e._audioDeviceManager.getRecordTrack()||e._localAudioTrack;if(r){var i=r.getAudioLevel();t.push({streamIndex:D.STREAM_INDEX_MAIN,audioPropertiesInfo:{linearVolume:i,nonlinearVolume:PP(i)}})}if(e._localScreenAudioTrack){var o=e._localScreenAudioTrack.getAudioLevel();t.push({streamIndex:D.STREAM_INDEX_SCREEN,audioPropertiesInfo:{linearVolume:o,nonlinearVolume:PP(o)}})}if(e.safeEmit(ee.onLocalAudioPropertiesReport,t),e._room){var a=[];e._room.remoteStreams.forEach((function(t,r){t.forEach((function(t){if(t.audioTrack){var n,i,o=t.audioTrack.getAudioLevel();a.push({streamKey:{userId:r,streamIndex:t.isScreen?D.STREAM_INDEX_SCREEN:D.STREAM_INDEX_MAIN,roomId:null===(n=e._room)||void 0===n||null===(i=n.roomInfo)||void 0===i?void 0:i.roomId},audioPropertiesInfo:{linearVolume:o,nonlinearVolume:PP(o)}})}}))})),e._sendActiveSpeaker(t,a.filter((function(e){return e.streamKey.streamIndex!==D.STREAM_INDEX_SCREEN}))),e.safeEmit(ee.onRemoteAudioPropertiesReport,a)}}}),o))}},{key:"setVideoSourceType",value:(Y=o(regeneratorRuntime.mark((function e(t,r){var n,i,o,a,s,u,c,d,l,h,f,p,_,v,m,g,y,S,b,E,k;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(aq.print("setVideoSourceType()","index: %o, videoSourceType: %o",t,r),GP(t,"streamIndex",[D.STREAM_INDEX_MAIN,D.STREAM_INDEX_SCREEN]),GP(r,"VideoSourceType",[R.VIDEO_SOURCE_TYPE_EXTERNAL,R.VIDEO_SOURCE_TYPE_INTERNAL]),n=t===D.STREAM_INDEX_MAIN?"video":"screenVideo",this._trackSourceType[n]===r){e.next=26;break}if(this._trackSourceType[n]=r,aq.print("setVideoSourceType","set ".concat(n," source type to ").concat(r)),!this._localVideoTrack||t!==D.STREAM_INDEX_MAIN){e.next=17;break}if(s=!1,r===R.VIDEO_SOURCE_TYPE_EXTERNAL&&(s=!0,this._localVideoTrack.close()),null===(i=this._videoPlayer)||void 0===i||i.stop(),this._localVideoTrack=void 0,u=null===(o=this._room)||void 0===o?void 0:o._roomConfig.isAutoPublish,s?null===(c=this._room)||void 0===c||null===(d=c.localStream)||void 0===d||null===(l=d.observer)||void 0===l||l.setEnableVideo(!1):null===(h=this._room)||void 0===h||null===(f=h.localStream)||void 0===f||null===(p=f.observer)||void 0===p||p.setPushVideo(!1),!(null!==(a=this._room)&&void 0!==a&&a.hasPublished||u)){e.next=17;break}return e.next=17,this._updatePublish();case 17:if(!this._localScreenVideoTrack||t!==D.STREAM_INDEX_SCREEN){e.next=26;break}if(m=!1,r===R.VIDEO_SOURCE_TYPE_EXTERNAL&&(m=!0,this._localScreenVideoTrack.close()),null===(_=this._screenPlayer)||void 0===_||_.stop(),this._localScreenVideoTrack=void 0,m?null===(g=this._room)||void 0===g||null===(y=g.localScreenStream)||void 0===y||null===(S=y.observer)||void 0===S||S.setEnableVideo(!1):null===(b=this._room)||void 0===b||null===(E=b.localScreenStream)||void 0===E||null===(k=E.observer)||void 0===k||k.setPushVideo(!1),null===(v=this._room)||void 0===v||!v.hasScreenPublished){e.next=26;break}return e.next=26,this._updateScreenPublish();case 26:case"end":return e.stop()}}),e,this)}))),function(e,t){return Y.apply(this,arguments)})},{key:"setExternalVideoTrack",value:(X=o(regeneratorRuntime.mark((function e(t,r){var n,i,o,a,s,u,c,d,l;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(aq.print("setExternalVideoTrack()","index: %o, track: %o",t,r),GP(t,"streamIndex",[D.STREAM_INDEX_MAIN,D.STREAM_INDEX_SCREEN]),t!==D.STREAM_INDEX_MAIN){e.next=12;break}if(this._trackSourceType.video===R.VIDEO_SOURCE_TYPE_EXTERNAL){e.next=5;break}throw new cD(sD.STREAM_TYPE_NOT_MATCH,"setVideoSourceType as external first");case 5:if(this._localVideoTrack=new Ij(r,bP()),this._initLocalTrackEvents(this._localVideoTrack),null===(n=this._videoPlayer)||void 0===n||n.playVideo(this._localVideoTrack),a=null===(i=this._room)||void 0===i?void 0:i._roomConfig.isAutoPublish,!(null!==(o=this._room)&&void 0!==o&&o.hasPublished||a)){e.next=12;break}return e.next=12,this._updatePublish();case 12:if(t!==D.STREAM_INDEX_SCREEN){e.next=22;break}if(this._trackSourceType.screenVideo===R.VIDEO_SOURCE_TYPE_EXTERNAL){e.next=15;break}throw new cD(sD.STREAM_TYPE_NOT_MATCH,"setVideoSourceType as external first");case 15:if(this._localScreenVideoTrack=new Ij(r,bP()),this._initLocalTrackEvents(this._localScreenVideoTrack,!0),null===(s=this._screenPlayer)||void 0===s||s.playVideo(this._localScreenVideoTrack),null===(u=this._room)||void 0===u||null===(c=u.localScreenStream)||void 0===c||null===(d=c.observer)||void 0===d||d.setPushVideo(!0),null===(l=this._room)||void 0===l||!l.hasScreenPublished){e.next=22;break}return e.next=22,this._updateScreenPublish();case 22:case"end":return e.stop()}}),e,this)}))),function(e,t){return X.apply(this,arguments)})},{key:"setAudioSourceType",value:(K=o(regeneratorRuntime.mark((function e(t,r){var n,i,o,a,s,u,c,d,l,h,f,p,_,v,m,g,y,S,b;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(aq.print("setAudioSourceType()","index: %o, audioSourceType: %o",t,r),GP(t,"streamIndex",[D.STREAM_INDEX_MAIN,D.STREAM_INDEX_SCREEN]),GP(r,"audioSourceType",[T.AUDIO_SOURCE_TYPE_EXTERNAL,T.AUDIO_SOURCE_TYPE_INTERNAL]),n=t===D.STREAM_INDEX_MAIN?"audio":"screenAudio",this._trackSourceType[n]===r){e.next=24;break}if(this._trackSourceType[n]=r,aq.print("setVideoSourceType","set ".concat(n," source type to ").concat(r)),!this._localAudioTrack||t!==D.STREAM_INDEX_MAIN){e.next=16;break}if(a=!1,this._trackSourceType.audio===T.AUDIO_SOURCE_TYPE_EXTERNAL&&(a=!0,this._localAudioTrack.close()),this._localAudioTrack=void 0,s=null===(i=this._room)||void 0===i?void 0:i._roomConfig.isAutoPublish,a?null===(u=this._room)||void 0===u||null===(c=u.localStream)||void 0===c||null===(d=c.observer)||void 0===d||d.setEnableAudio(!1):null===(l=this._room)||void 0===l||null===(h=l.localStream)||void 0===h||null===(f=h.observer)||void 0===f||f.setPushAudio(!1),!(null!==(o=this._room)&&void 0!==o&&o.hasPublished||s)){e.next=16;break}return e.next=16,this._updatePublish();case 16:if(!this._localScreenAudioTrack||t!==D.STREAM_INDEX_SCREEN){e.next=24;break}if(_=!1,this._trackSourceType.audio===T.AUDIO_SOURCE_TYPE_EXTERNAL&&(_=!0,this._localScreenAudioTrack.close()),this._localScreenAudioTrack=void 0,_?null===(v=this._room)||void 0===v||null===(m=v.localScreenStream)||void 0===m||null===(g=m.observer)||void 0===g||g.setEnableAudio(!1):null===(y=this._room)||void 0===y||null===(S=y.localScreenStream)||void 0===S||null===(b=S.observer)||void 0===b||b.setPushAudio(!1),null===(p=this._room)||void 0===p||!p.hasScreenPublished){e.next=24;break}return e.next=24,this._updateScreenPublish();case 24:case"end":return e.stop()}}),e,this)}))),function(e,t){return K.apply(this,arguments)})},{key:"setExternalAudioTrack",value:(z=o(regeneratorRuntime.mark((function e(t,r){var n,i,o,a,s,u,c,d,l,h;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(aq.print("setExternalAudioTrack()","index: %o, track: %o",t,r),GP(t,"streamIndex",[D.STREAM_INDEX_MAIN,D.STREAM_INDEX_SCREEN]),t!==D.STREAM_INDEX_MAIN){e.next=12;break}if(this._trackSourceType.audio===T.AUDIO_SOURCE_TYPE_EXTERNAL){e.next=5;break}throw new cD(sD.STREAM_TYPE_NOT_MATCH,"setAudioSourceType as external first");case 5:if(this._localAudioTrack=new Aj(r,bP()),this._initLocalTrackEvents(this._localAudioTrack),u=null===(n=this._room)||void 0===n?void 0:n._roomConfig.isAutoPublish,null===(i=this._room)||void 0===i||null===(o=i.localStream)||void 0===o||null===(a=o.observer)||void 0===a||a.setPushAudio(!0),!(null!==(s=this._room)&&void 0!==s&&s.hasPublished||u)){e.next=12;break}return e.next=12,this._updatePublish();case 12:if(t!==D.STREAM_INDEX_SCREEN){e.next=21;break}if(this._trackSourceType.screenAudio===T.AUDIO_SOURCE_TYPE_EXTERNAL){e.next=15;break}throw new cD(sD.STREAM_TYPE_NOT_MATCH,"setAudioSourceType as external first");case 15:if(this._localScreenAudioTrack=new Aj(r,bP()),this._initLocalTrackEvents(this._localScreenAudioTrack),null===(c=this._room)||void 0===c||null===(d=c.localScreenStream)||void 0===d||null===(l=d.observer)||void 0===l||l.setPushAudio(!0),null===(h=this._room)||void 0===h||!h.hasScreenPublished){e.next=21;break}return e.next=21,this._updateScreenPublish();case 21:case"end":return e.stop()}}),e,this)}))),function(e,t){return z.apply(this,arguments)})},{key:"login",value:(j=o(regeneratorRuntime.mark((function e(t,r){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return aq.print("login()","token: %o, userInfo: %o",t,r),XP(t)||jP(t,"token"),YP(r),e.abrupt("return",this._rtmClient.login(t,r));case 4:case"end":return e.stop()}}),e,this)}))),function(e,t){return j.apply(this,arguments)})},{key:"logout",value:(B=o(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return aq.print("logout()"),e.abrupt("return",this._rtmClient.logout());case 2:case"end":return e.stop()}}),e,this)}))),function(){return B.apply(this,arguments)})},{key:"updateLoginToken",value:(F=o(regeneratorRuntime.mark((function e(t){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return aq.print("updateLoginToken()","token: %o",t),XP(t)||jP(t,"token"),e.abrupt("return",this._rtmClient.updateLoginToken(t));case 3:case"end":return e.stop()}}),e,this)}))),function(e){return F.apply(this,arguments)})},{key:"getPeerOnlineStatus",value:(V=o(regeneratorRuntime.mark((function e(t){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return aq.print("getPeerOnlineStatus()","userId: %o",t),YP(t),e.abrupt("return",this._rtmClient.getPeerOnlineStatus(t));case 3:case"end":return e.stop()}}),e,this)}))),function(e){return V.apply(this,arguments)})},{key:"sendUserMessageOutsideRoom",value:(x=o(regeneratorRuntime.mark((function e(t,r){var n,i=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return YP(t),eM(r),n=Date.now(),e.prev=3,e.abrupt("return",this._rtmClient.sendUserMessageOutsideRoom(t,r).then((function(e){return i._messageStatisticsObserver.countUserMessageOutsideRoom(!0,t,!1,n,e),e.id})).catch((function(e){throw i._messageStatisticsObserver.countUserMessageOutsideRoom(!1,t,!1,n),e})));case 7:throw e.prev=7,e.t0=e.catch(3),this._messageStatisticsObserver.countUserMessageOutsideRoom(!1,t,!1,n),e.t0;case 11:case"end":return e.stop()}}),e,this,[[3,7]])}))),function(e,t){return x.apply(this,arguments)})},{key:"sendUserBinaryMessageOutsideRoom",value:(N=o(regeneratorRuntime.mark((function e(t,r){var n,i=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return YP(t),zP(r,"message"),eM(r),n=Date.now(),e.prev=4,e.abrupt("return",this._rtmClient.sendUserMessageOutsideRoom(t,r).then((function(e){return i._messageStatisticsObserver.countUserMessageOutsideRoom(!0,t,!0,n,e),e.id})).catch((function(e){throw i._messageStatisticsObserver.countUserMessageOutsideRoom(!1,t,!0,n),e})));case 8:throw e.prev=8,e.t0=e.catch(4),this._messageStatisticsObserver.countUserMessageOutsideRoom(!1,t,!0,n),e.t0;case 12:case"end":return e.stop()}}),e,this,[[4,8]])}))),function(e,t){return N.apply(this,arguments)})},{key:"setServerParams",value:(w=o(regeneratorRuntime.mark((function e(t,r){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return aq.print("setServerParams()","signature: %o, url: %0",t,r),jP(t,"signature"),jP(r,"url"),e.abrupt("return",this._rtmClient.setServerParams(t,r));case 4:case"end":return e.stop()}}),e,this)}))),function(e,t){return w.apply(this,arguments)})},{key:"sendServerMessage",value:(A=o(regeneratorRuntime.mark((function e(t){var r,n=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return jP(t,"message"),eM(t),r=Date.now(),e.prev=3,e.abrupt("return",this._rtmClient.sendServerMessage(t).then((function(){n._messageStatisticsObserver.countServerMessage(!0,!1,r)})).catch((function(e){throw n._messageStatisticsObserver.countServerMessage(!1,!1,r),e})));case 7:throw e.prev=7,e.t0=e.catch(3),this._messageStatisticsObserver.countServerMessage(!1,!1,r),e.t0;case 11:case"end":return e.stop()}}),e,this,[[3,7]])}))),function(e){return A.apply(this,arguments)})},{key:"sendServerBinaryMessage",value:(I=o(regeneratorRuntime.mark((function e(t){var r,n=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return zP(t,"message"),eM(t),r=Date.now(),e.prev=3,e.abrupt("return",this._rtmClient.sendServerMessage(t).then((function(){n._messageStatisticsObserver.countServerMessage(!0,!0,r)})).catch((function(e){throw n._messageStatisticsObserver.countServerMessage(!1,!0,r),e})));case 7:throw e.prev=7,e.t0=e.catch(3),this._messageStatisticsObserver.countServerMessage(!1,!0,r),e.t0;case 11:case"end":return e.stop()}}),e,this,[[3,7]])}))),function(e){return I.apply(this,arguments)})},{key:"startCloudProxy",value:function(e){if(this._room)throw new cD(sD.START_CLOUD_PROXY_AFTER_JOIN,"[startCloudProxy] should be invoke before join room ");aq.print("startCloudProxy()",e),jP(e.logProxy,"logProxy"),jP(e.accessProxy,"accessProxy"),jP(e.configProxy,"configProxy"),this._originIceConfigRequestUrls=cF("ICE_CONFIG_REQUEST_URLS"),this._originLogServerUrl=cF("LOG_SERVER_URL"),this._originConfigServerUrls=cF("CONFIG_REQUEST_DOMAINS"),uF("ICE_CONFIG_REQUEST_URLS",e.accessProxy),uF("LOG_SERVER_URL",function(){return"https://".concat(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"","/video/v1/webrtc_log/")}(e.logProxy)),uF("CONFIG_REQUEST_DOMAINS",[e.configProxy]),this._useCloudProxy=!0}},{key:"stopCloudProxy",value:function(){if(this._room)throw new cD(sD.STOP_CLOUD_PROXY_BEFORE_LEAVE,"[stopCloudProxy] should be invoke after leave room ");aq.print("stopCloudProxy()"),uF("ICE_CONFIG_REQUEST_URLS",[]),uF("LOG_SERVER_URL",this._originLogServerUrl),uF("CONFIG_REQUEST_DOMAINS",this._originConfigServerUrls),this._useCloudProxy=!1,this._startCloudProxyTimestamp=void 0}},{key:"startPushPublicStream",value:(k=o(regeneratorRuntime.mark((function e(t,r){var n,i=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(aq.print("startPushPublicStream()","publicStreamId: %o, publicStreamParam: %o",t,r),JP(t),this._room&&this._room.connectionState===IG.CONNECTED){e.next=4;break}throw new cD(sD.START_PUBLIC_STREAM_BEFORE_JOIN,"join first");case 4:if(!this._publicStreamIds.get(t)){e.next=6;break}throw new cD(sD.REPEAT_PUSH,"repeat push public media stream");case 6:return n=lF(t,"started",r),e.abrupt("return",this._room.publicStreamControlMessage(n).then((function(){i._publicStreamIds.set(t,t)})));case 8:case"end":return e.stop()}}),e,this)}))),function(e,t){return k.apply(this,arguments)})},{key:"updatePublicStreamParam",value:(E=o(regeneratorRuntime.mark((function e(t,r){var n;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(aq.print("startPushPublicStream()","publicStreamId: %o, publicStreamParam: %o",t,r),JP(t),this._room&&this._room.connectionState===IG.CONNECTED){e.next=4;break}throw new cD(sD.START_PUBLIC_STREAM_BEFORE_JOIN,"join first");case 4:return n=lF(t,"layoutChanged",r),e.abrupt("return",this._room.publicStreamControlMessage(n));case 6:case"end":return e.stop()}}),e,this)}))),function(e,t){return E.apply(this,arguments)})},{key:"stopPushPublicStream",value:(b=o(regeneratorRuntime.mark((function e(t){var r=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(aq.print("startPushPublicStream()","publicStreamId: %o",t),JP(t),this._room&&this._room.connectionState===IG.CONNECTED){e.next=4;break}throw new cD(sD.START_PUBLIC_STREAM_BEFORE_JOIN,"join first");case 4:return e.abrupt("return",this._room.publicStreamControlMessage({type:"publicstream",action:"stopped",publicStreamID:t}).then((function(){r._publicStreamIds.delete(t)})));case 5:case"end":return e.stop()}}),e,this)}))),function(e){return b.apply(this,arguments)})},{key:"startPlayPublicStream",value:(S=o(regeneratorRuntime.mark((function e(t){var r,n,i,o,a,s,u=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(JP(t),this._outsideRoom){e.next=8;break}return this._outsideRoom=new JX(this._appId),this._outsideRoom.on(Jj.RESUBSCRIBE,(function(e){var t=e.stream;if(t){var r,n=u._publicStreamAudioPlayer.get(t.streamId);n&&t.audioTrack&&(n.stop(),n.playAudio(null===(r=e.stream)||void 0===r?void 0:r.audioTrack));var i,o=u._publicStreamVideoPlayer.get(t.streamId);o&&t.videoTrack&&o.playVideo(null===(i=e.stream)||void 0===i?void 0:i.videoTrack)}})),null===(r=this._outsideRoom)||void 0===r||r.on("onRemoteStreamStats",(function(e){e.publicStreamId=e.userId,delete e.userId,delete e.isScreen,u.safeEmit(ee.onPublicStreamStats,e)})),null===(n=this._outsideRoom)||void 0===n||n.on(Jj.ON_SEI_MESSAGED_RECEIVED,(function(e){u.safeEmit(ee.onPublicStreamSEIMessageReceived,e)})),e.next=8,this._outsideRoom.connect();case 8:return e.next=10,this._outsideRoom.startPlayPublicStream(t);case 10:i=e.sent,(o=this._publicStreamVideoPlayer.get(t))&&null!=i&&i.videoTrack&&o.playVideo(i.videoTrack,i),!(a=this._publicStreamAudioPlayer.get(t))&&null!=i&&i.audioTrack&&(a=new QG(t,{muted:(null===(s=this._config)||void 0===s?void 0:s.autoPlayPolicy)===q.VIDEO_ONLY}),this._initPlayerEvents(a,!0),a.playAudio(i.audioTrack),this._publicStreamAudioPlayer.set(t,a));case 15:case"end":return e.stop()}}),e,this)}))),function(e){return S.apply(this,arguments)})},{key:"stopPlayPublicStream",value:(y=o(regeneratorRuntime.mark((function e(t){var r;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._outsideRoom){e.next=2;break}return e.abrupt("return");case 2:this._outsideRoom.stopPlayPublicStream(t),(r=this._publicStreamAudioPlayer.get(t))&&(r.destroy(),this._publicStreamAudioPlayer.delete(t));case 5:case"end":return e.stop()}}),e,this)}))),function(e){return y.apply(this,arguments)})},{key:"setAudioProfile",value:(m=o(regeneratorRuntime.mark((function e(t){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:this._audioProfileManager.setAudioProfile(t);case 1:case"end":return e.stop()}}),e,this)}))),function(e){return m.apply(this,arguments)})},{key:"setPublicStreamVideoPlayer",value:function(e,t){var n,i,o,a;aq.print("setPublicStreamVideoPlayer()","publicStreamId: %o, videoPlayerOption: %o",e,t);var s=this._publicStreamVideoPlayer.get(e);if(null===(n=s)||void 0===n||n.destroy(),null!=t&&t.renderDom){s=new JG(r(r({},t),{},{userId:e})),this._initPlayerEvents(s,!0),this._publicStreamVideoPlayer.set(e,s);var u=null===(i=this._outsideRoom)||void 0===i||null===(o=i.remoteStreams)||void 0===o?void 0:o.get(e);null!=u&&u.videoTrack&&(null===(a=this._config)||void 0===a?void 0:a.autoPlayPolicy)!==q.PLAY_MANUALLY&&s.playVideo(u.videoTrack,u)}else this._publicStreamVideoPlayer.delete(e)}},{key:"setDummyCaptureImagePath",value:(_=o(regeneratorRuntime.mark((function e(t,r){var n=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",new Promise((function(e,i){jP(r,"filePath");var o=new Image;o.crossOrigin="anonymous",o.src=r,o.onload=function(){try{var r=document.createElement("canvas"),a=r.getContext("2d");if(!a)return i(new cD(sD.UNEXPECTED_ERROR,"Not support canvas"));r.width=o.width,r.height=o.height,a.drawImage(o,0,0,o.width,o.height),clearInterval(n._dummyTimer),n._dummyTimer=window.setInterval((function(){a.drawImage(o,0,0,o.width,o.height)}),200);var s=r.captureStream(5).getVideoTracks()[0];t===D.STREAM_INDEX_MAIN?n._localImgVideoTrack=s:n._localImgScreenTrack=s,e()}catch(u){i(new cD(sD.UNEXPECTED_ERROR,u.message))}},o.onerror=function(){i(new cD(sD.UNEXPECTED_ERROR,"Load image error"))}})));case 1:case"end":return e.stop()}}),e)}))),function(e,t){return _.apply(this,arguments)})},{key:"defaultTranscoding",value:function(){return JSON.parse(JSON.stringify(fF))}},{key:"_updatePublish",value:(f=o(regeneratorRuntime.mark((function e(){var t,n,i,o=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=o.length>0&&void 0!==o[0]?o[0]:{},aq.print("_updatePublish()","config: %o",t),n={mediaType:void 0,invokeByJoinRoom:!1,pubState:Zj.PUB},t=r(r({},n),t),this._visibility){e.next=6;break}throw new cD(sD.NO_PUBLISH_PERMISSION,"no publish permission");case 6:return e.next=8,this._pubLock.lock();case 8:if(i=e.sent,this._room&&this._room.connectionState===IG.CONNECTED){e.next=12;break}return i(),e.abrupt("return");case 12:return e.prev=12,e.next=15,this._room.publish(this._videoStreamEncodeConfig,this._enableSimulcast,this._localVideoTrack,this._localAudioTrack,t.mediaType,t.pubState,t.invokeByJoinRoom);case 15:e.next=24;break;case 17:if(e.prev=17,e.t0=e.catch(12),!(e.t0 instanceof cD)){e.next=23;break}throw e.t0;case 23:throw new cD(sD.UNEXPECTED_ERROR,"unexpected error",e.t0);case 24:return e.prev=24,i(),e.finish(24);case 27:case"end":return e.stop()}}),e,this,[[12,17,24,27]])}))),function(){return f.apply(this,arguments)})},{key:"startAudioPlaybackDeviceTest",value:(h=o(regeneratorRuntime.mark((function e(t,r){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return aq.print("startAudioPlaybackDeviceTest()","filePath: %o, indicationInterval: %o",t,r),jP(t,"filePath"),BP(r,"indicationInterval"),e.next=5,this._audioDeviceManager.startAudioPlaybackDeviceTest(t,r);case 5:return e.abrupt("return",e.sent);case 6:case"end":return e.stop()}}),e,this)}))),function(e,t){return h.apply(this,arguments)})},{key:"stopAudioPlaybackDeviceTest",value:function(){aq.print("stopAudioPlaybackDeviceTest()"),this._audioDeviceManager.stopAudioPlaybackDeviceTest()}},{key:"startAudioDeviceRecordTest",value:(s=o(regeneratorRuntime.mark((function e(t){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return aq.print("startAudioDeviceRecordTest()","indicationInterval: %o",t),BP(t,"indicationInterval"),e.next=4,this._audioDeviceManager.startAudioDeviceRecordTest(t);case 4:case"end":return e.stop()}}),e,this)}))),function(e){return s.apply(this,arguments)})},{key:"stopAudioDeviceRecordAndPlayTest",value:function(){aq.print("stopAudioDeviceRecordAndPlayTest()"),this._audioDeviceManager.stopAudioDeviceRecordAndPlayTest()}},{key:"stopAudioDevicePlayTest",value:function(){aq.print("stopAudioDevicePlayTest()"),this._audioDeviceManager.stopAudioDevicePlayTest()}},{key:"setRemoteUserPriority",value:function(e,t){var r;aq.print("setRemoteUserPriority()","userId: %o, priority: %o",e,t);try{YP(e),GP(t,"priority",[H.HIGH,H.MEDIUM,H.LOW])}catch(n){return console.warn(n),!1}return this._userPriorityMap.set(e,t),null===(r=this._room)||void 0===r||r.setRemoteUserPriority(e,t),!0}},{key:"takeLocalSnapshot",value:(i=o(regeneratorRuntime.mark((function e(t){var r,n;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(aq.print("takeLocalSnapshot()","streamIndex: %o",t),GP(t,"streamIndex",[D.STREAM_INDEX_MAIN,D.STREAM_INDEX_SCREEN]),r=t===D.STREAM_INDEX_MAIN?this.localVideoTrack:this.localScreenVideoTrack){e.next=5;break}throw new cD(sD.INVOKED_BEFORE_CAPTURE,"capture first");case 5:return n=t===D.STREAM_INDEX_MAIN?this._videoPlayer:this._screenPlayer,e.abrupt("return",rq(r.getTrack(),(null==n?void 0:n.mirrorType)===L.MIRROR_TYPE_RENDER,n));case 7:case"end":return e.stop()}}),e,this)}))),function(e){return i.apply(this,arguments)})},{key:"takeRemoteSnapshot",value:(n=o(regeneratorRuntime.mark((function e(t,r){var n,i,o,a,s,u;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(aq.print("takeRemoteSnapshot()","id: %o, streamIndex: %o",t,r),jP(t,"id"),GP(r,"streamIndex",[D.STREAM_INDEX_MAIN,D.STREAM_INDEX_SCREEN]),u=(null===(n=this._room)||void 0===n||null===(i=n.remoteStreams.get(t))||void 0===i||null===(o=i.find((function(e){return e.isScreen===(r===D.STREAM_INDEX_SCREEN)})))||void 0===o?void 0:o.videoTrack)||(null===(a=this._outsideRoom)||void 0===a||null===(s=a.remoteStreams.get(t))||void 0===s?void 0:s.videoTrack)){e.next=6;break}throw new cD(sD.STREAM_NOT_EXIST,"stream not exist");case 6:return e.abrupt("return",rq(u.getTrack(),!1,r===D.STREAM_INDEX_MAIN?this._remoteVideoPlayer.get(t):this._remoteScreenPlayer.get(t)));case 7:case"end":return e.stop()}}),e,this)}))),function(e,t){return n.apply(this,arguments)})},{key:"setSubscribeFallbackOption",value:function(e){aq.print("setSubscribeFallbackOption()","option: %o",e);try{GP(e,"option",[G.DISABLE,G.VIDEO_STREAM_LOW,G.AUDIO_ONLY])}catch(t){return console.warn(t),!1}return!this._room&&(this._subscribeFallbackOption=e,!0)}},{key:"_updateScreenPublish",value:(t=o(regeneratorRuntime.mark((function e(){var t,n,i,o=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=o.length>0&&void 0!==o[0]?o[0]:{},aq.print("_updateScreenPublish()"),n={mediaType:void 0,pubState:Zj.PUB},t=r(r({},n),t),e.next=6,this._pubLock.lock();case 6:if(i=e.sent,this._room&&this._room.connectionState===IG.CONNECTED){e.next=10;break}return i(),e.abrupt("return");case 10:return e.prev=10,e.next=13,this._room.publishScreen(this._screenStreamEncodeConfig,this._localScreenVideoTrack,this._localScreenAudioTrack,t.mediaType,t.pubState);case 13:e.next=22;break;case 15:if(e.prev=15,e.t0=e.catch(10),!(e.t0 instanceof cD)){e.next=21;break}throw e.t0;case 21:throw new cD(sD.UNEXPECTED_ERROR,"unexpected error",e.t0);case 22:return e.prev=22,i(),e.finish(22);case 25:case"end":return e.stop()}}),e,this,[[10,15,22,25]])}))),function(){return t.apply(this,arguments)})},{key:"_updateAudioPlayerState",value:function(e){aq.print("_updateAudioPlayerState()");var t,r=e.userId,n=e.isScreen;if(t=n?this._remoteAudioPlayer.get("".concat(r,"_screen")):this._remoteAudioPlayer.get(r),e.audioTrack){var i;if(!t){var o,a=n?"".concat(r,"_screen"):r;t=new QG(a,{muted:(null===(o=this._config)||void 0===o?void 0:o.autoPlayPolicy)===q.VIDEO_ONLY}),this._initPlayerEvents(t),this._remoteAudioPlayer.set(a,t),this._audioPlaybackDeviceId&&t.setPlaybackDevice(this._audioPlaybackDeviceId)}(null===(i=this._config)||void 0===i?void 0:i.autoPlayPolicy)!==q.PLAY_MANUALLY&&t.playAudio(e.audioTrack)}else{var s;null===(s=t)||void 0===s||s.stop()}}},{key:"_updateVideoPlayerState",value:function(e){var t;aq.print("_updateVideoPlayerState()");var r,n,i=e.userId;if(r=e.isScreen?this._remoteScreenPlayer.get(i):this._remoteVideoPlayer.get(i),e.videoTrack)r&&(null===(n=this._config)||void 0===n?void 0:n.autoPlayPolicy)!==q.PLAY_MANUALLY&&r.playVideo(e.videoTrack,e);else if(null!==(t=r)&&void 0!==t&&t.played){var o;null===(o=r)||void 0===o||o.stop()}}},{key:"_onAddStream",value:function(e){var t=e.stream,r=null==t?void 0:t.attributes,n=r.localaudio,i=r.audiostream,o=r.localvideo,a=r.videostream,s=Pj.NONE;i&&(s|=P.AUDIO),a&&(s|=P.VIDEO),s&&(null!=t&&t.isScreen?this.safeEmit(ee.onUserPublishScreen,{userId:t.userId,mediaType:s}):(this.safeEmit(ee.onUserPublishStream,{userId:t.userId,mediaType:s}),this._handleAutoSubscribe(t,!0)),null!=t&&t.isScreen||(n&&this.safeEmit(ee.onUserStartAudioCapture,{userId:t.userId}),o&&this.safeEmit(ee.onUserStartVideoCapture,{userId:t.userId})))}},{key:"_handleAutoSubscribe",value:function(e,t){var r,n,i=Pj.NONE;if(null!==(r=this._roomConfig)&&void 0!==r&&r.isAutoSubscribeAudio&&(i|=P.AUDIO),null!==(n=this._roomConfig)&&void 0!==n&&n.isAutoSubscribeVideo&&(i|=P.VIDEO),aq.print("_onAddStream","autoSubType: ".concat(i)),i){var o,a;if(t&&MP(i))null===(o=e.observer)||void 0===o||o.setAutoSubscribeAudio(!0);if(t&&UP(i))null===(a=e.observer)||void 0===a||a.setAutoSubscribeVideo(!0);this._subscribe(!1,e.userId,i)}}},{key:"_onRemoveStream",value:function(e){var t,r=this,n=e.stream,i=null!==(t=uq[e.reason])&&void 0!==t?t:M.STREAM_REMOVE_REASON_OTHER,o=n.isScreen?ee.onUserUnpublishScreen:ee.onUserUnpublishStream,a=Pj.NONE;n.attributes.audiostream&&(a|=P.AUDIO),n.attributes.videostream&&(a|=P.VIDEO),null!=n&&n._workaround_1_&&(a=P.VIDEO),a!==Pj.NONE&&this.safeEmit(o,{userId:n.userId,mediaType:a,reason:i}),this._getRemotePlayer(n.userId,n.isScreen).forEach((function(e){if(null==n||!n._workaround_1_){var t=n.isScreen?"".concat(n.userId,"_screen"):n.userId;r._remoteAudioPlayer.delete(t),n.isScreen?r._remoteScreenPlayer.delete(n.userId):r._remoteVideoPlayer.delete(n.userId),null==e||e.destroy()}}))}},{key:"_onUserConnection",value:function(e){this.safeEmit(ee.onUserJoined,e)}},{key:"_onUserLeave",value:function(e){this.safeEmit(ee.onUserLeave,e)}},{key:"_onRoomError",value:function(e){var t;this.safeEmit(ee.onError,e),null===(t=this._room)||void 0===t||t.destroy(),this._room=void 0}},{key:"_onNetworkQuality",value:function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];this.safeEmit.apply(this,[ee.onNetworkQuality].concat(t))}},{key:"_onConnectionStateChange",value:function(e){void 0!==this._startCloudProxyTimestamp&&this._useCloudProxy&&e.state===U.CONNECTION_STATE_CONNECTED&&this.safeEmit(ee.onCloudProxyConnected,{interval:Date.now()-this._startCloudProxyTimestamp}),this.safeEmit(ee.onConnectionStateChanged,e)}},{key:"_getRemotePlayer",value:function(e,t){return[this._remoteAudioPlayer.get(t?"".concat(e,"_screen"):e),(t?this._remoteScreenPlayer:this._remoteVideoPlayer).get(e)]}},{key:"_stopAudioPropertiesReport",value:function(){null!==this._audioPropertiesReportTimer&&(clearInterval(this._audioPropertiesReportTimer),this._audioPropertiesReportTimer=null)}},{key:"_onResubscribe",value: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))}},{key:"_onSubscribePushTrack",value:function(e){e.stream&&this._updateAudioPlayerState(e.stream)}},{key:"_onRemovePushTrack",value:function(e){e.stream&&this._updateAudioPlayerState(e.stream)}},{key:"_onVideoFirstFrameDecoded",value:function(e){this.safeEmit(ee.onVideoFirstFrameDecoded,e)}},{key:"_onVideoDeviceStateChange",value:function(e){this.safeEmit(ee.onVideoDeviceStateChanged,e)}},{key:"_onAudioDeviceStateChange",value:function(e){this.safeEmit(ee.onAudioDeviceStateChanged,e)}},{key:"_onUserPublishStateChange",value:function(e){var t=e.userId,n=e.isScreen,i=e.mediaType,o=e.pubState,a=e.remoteStream,s={userId:t,mediaType:i};n?o===Zj.PUB?this.safeEmit(ee.onUserPublishScreen,s):this.safeEmit(ee.onUserUnpublishScreen,r(r({},s),{},{reason:M.STREAM_REMOVE_REASON_UNPUBLISH})):o===Zj.PUB?(this.safeEmit(ee.onUserPublishStream,s),this._handleAutoSubscribe(a,!0)):this.safeEmit(ee.onUserUnpublishStream,r(r({},s),{},{reason:M.STREAM_REMOVE_REASON_UNPUBLISH}))}},{key:"_onCustomMessage",value:function(e){var t=e.message;e.binary?this.safeEmit(ee.onRoomBinaryMessageReceived,{userId:e.clientId,message:t}):this.safeEmit(ee.onRoomMessageReceived,{userId:e.clientId,message:t})}},{key:"_onUserMessageReceived",value:function(e){this._messageStatisticsObserver.recvP2PMessage(e.userId),this.safeEmit(ee.onUserMessageReceived,e)}},{key:"_onUserBinaryMessageReceived",value:function(e){this._messageStatisticsObserver.recvP2PMessage(e.userId),this.safeEmit(ee.onUserBinaryMessageReceived,e)}},{key:"_onLiveTranscodingResult",value:function(e){this.safeEmit(ee.onLiveTranscodingResult,e)}},{key:"_onStreamMixingEvent",value:function(e){this.safeEmit(ee.onStreamMixingEvent,e)}},{key:"_onUserTokenWillExpire",value:function(){this.safeEmit(ee.onTokenWillExpire)}},{key:"_onPushPublicStreamResult",value:function(e){this.safeEmit(ee.onPushPublicStreamResult,e)}},{key:"_handleRTMClient",value:function(e){var t=this;e.on("onUserMessageReceivedOutsideRoom",(function(e){t._messageStatisticsObserver.recvP2POutRoomMessage(e.userId),t.safeEmit(ee.onUserMessageReceivedOutsideRoom,e)})),e.on("onUserBinaryMessageReceivedOutsideRoom",(function(e){t._messageStatisticsObserver.recvP2POutRoomMessage(e.userId),t.safeEmit(ee.onUserBinaryMessageReceivedOutsideRoom,e)})),e.on("onUserDisconnection",(function(){t.safeEmit(ee.onError,{errorCode:sD.RTM_DUPLICATE_LOGIN})})),e.on("onRTMTokenError",(function(){t.safeEmit(ee.onError,{errorCode:sD.RTM_TOKEN_ERROR})}))}},{key:"waitForNewToken",get:function(){return!!this._tempRoomConfig}},{key:"localAudioTrack",get:function(){return this._localAudioTrack}},{key:"localVideoTrack",get:function(){return this._localVideoTrack}},{key:"localScreenAudioTrack",get:function(){return this._localScreenAudioTrack}},{key:"localScreenVideoTrack",get:function(){return this._localScreenVideoTrack}},{key:"remoteStreams",get:function(){var e,t,r=[];null!==(e=this._room)&&void 0!==e&&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})}))})));return r}},{key:"remoteUsers",get:function(){var e,t,r=[];null!==(e=this._room)&&void 0!==e&&e.remoteUsers&&(null===(t=this._room)||void 0===t||t.remoteUsers.forEach((function(e){r.push({userId:e.userId})})));return r}},{key:"_handleAudioDeviceManager",value:function(){var e=this;this._audioDeviceManager.on("onAudioPlaybackDeviceTestVolume",(function(t){e.safeEmit(ee.onAudioPlaybackDeviceTestVolume,t)}))}},{key:"_assertNotInRoom",value:function(){if(!this._room||this._room.connectionState!==IG.CONNECTED)throw new cD(sD.INVOKED_BEFORE_JOIN_ROOM,"join first")}},{key:"_checkMediaType",value:function(e){GP(e,"mediaType",[P.AUDIO,P.VIDEO,P.AUDIO_AND_VIDEO])}},{key:"_getUserId",value:function(){var e,t;return(null===(e=this._room)||void 0===e||null===(t=e.roomInfo)||void 0===t?void 0:t.userInfo.userId)||"local_user"}}]),Ue}(dM);oq([KV()],sq.prototype,"updateToken",1),oq([KV()],sq.prototype,"setVideoCaptureDevice",1),oq([KV()],sq.prototype,"setAudioCaptureDevice",1),oq([KV()],sq.prototype,"joinRoom",1),oq([KV()],sq.prototype,"leaveRoom",1),oq([KV()],sq.prototype,"destroy",1),oq([KV()],sq.prototype,"publishStream",1),oq([KV()],sq.prototype,"unpublishStream",1),oq([KV()],sq.prototype,"publishScreen",1),oq([KV()],sq.prototype,"unpublishScreen",1),oq([KV()],sq.prototype,"subscribeStream",1),oq([KV()],sq.prototype,"unsubscribeStream",1),oq([KV()],sq.prototype,"subscribeScreen",1),oq([KV()],sq.prototype,"unsubscribeScreen",1),oq([KV()],sq.prototype,"setRemoteVideoConfig",1),oq([KV()],sq.prototype,"startVideoCapture",1),oq([KV()],sq.prototype,"stopVideoCapture",1),oq([KV()],sq.prototype,"startAudioCapture",1),oq([KV()],sq.prototype,"stopAudioCapture",1),oq([KV()],sq.prototype,"getAudioMixingManager",1),oq([KV()],sq.prototype,"startScreenCapture",1),oq([KV()],sq.prototype,"stopScreenCapture",1),oq([KV()],sq.prototype,"setLocalVideoPlayer",1),oq([KV()],sq.prototype,"startLiveTranscoding",1),oq([KV()],sq.prototype,"updateLiveTranscoding",1),oq([KV()],sq.prototype,"stopLiveTranscoding",1),oq([KV()],sq.prototype,"setBusinessId",1),oq([KV()],sq.prototype,"setUserVisibility",1),oq([KV()],sq.prototype,"setRemoteVideoPlayer",1),oq([KV()],sq.prototype,"setLocalVideoMirrorType",1),oq([KV()],sq.prototype,"setAudioPlaybackDevice",1),oq([KV()],sq.prototype,"play",1),oq([KV()],sq.prototype,"pauseAllSubscribedStream",1),oq([KV()],sq.prototype,"resumeAllSubscribedStream",1),oq([KV()],sq.prototype,"sendUserMessage",1),oq([KV()],sq.prototype,"sendUserBinaryMessage",1),oq([KV()],sq.prototype,"sendRoomMessage",1),oq([KV()],sq.prototype,"sendRoomBinaryMessage",1),oq([KV()],sq.prototype,"setAudioCaptureConfig",1),oq([KV()],sq.prototype,"setVideoCaptureConfig",1),oq([KV()],sq.prototype,"enableSimulcastMode",1),oq([KV()],sq.prototype,"setVideoEncoderConfig",1),oq([KV()],sq.prototype,"setScreenEncoderConfig",1),oq([KV()],sq.prototype,"sendSEIMessage",1),oq([KV()],sq.prototype,"setAudioVolumeIndicationInterval",1),oq([KV()],sq.prototype,"enableAudioPropertiesReport",1),oq([KV()],sq.prototype,"setVideoSourceType",1),oq([KV()],sq.prototype,"setExternalVideoTrack",1),oq([KV()],sq.prototype,"setAudioSourceType",1),oq([KV()],sq.prototype,"setExternalAudioTrack",1),oq([KV("rtm")],sq.prototype,"login",1),oq([KV("rtm")],sq.prototype,"logout",1),oq([KV("rtm")],sq.prototype,"updateLoginToken",1),oq([KV("rtm")],sq.prototype,"getPeerOnlineStatus",1),oq([KV("rtm")],sq.prototype,"sendUserMessageOutsideRoom",1),oq([KV("rtm")],sq.prototype,"sendUserBinaryMessageOutsideRoom",1),oq([KV("rtm")],sq.prototype,"setServerParams",1),oq([KV("rtm")],sq.prototype,"sendServerMessage",1),oq([KV("rtm")],sq.prototype,"sendServerBinaryMessage",1),oq([KV()],sq.prototype,"startCloudProxy",1),oq([KV()],sq.prototype,"stopCloudProxy",1),oq([KV()],sq.prototype,"startPushPublicStream",1),oq([KV()],sq.prototype,"updatePublicStreamParam",1),oq([KV()],sq.prototype,"stopPushPublicStream",1),oq([KV("outsideRoom")],sq.prototype,"startPlayPublicStream",1),oq([KV("outsideRoom")],sq.prototype,"stopPlayPublicStream",1),oq([KV()],sq.prototype,"setAudioProfile",1),oq([KV("outsideRoom")],sq.prototype,"setPublicStreamVideoPlayer",1),oq([KV()],sq.prototype,"setDummyCaptureImagePath",1),oq([KV()],sq.prototype,"startAudioPlaybackDeviceTest",1),oq([KV()],sq.prototype,"stopAudioPlaybackDeviceTest",1),oq([KV()],sq.prototype,"startAudioDeviceRecordTest",1),oq([KV()],sq.prototype,"stopAudioDeviceRecordAndPlayTest",1),oq([KV()],sq.prototype,"stopAudioDevicePlayTest",1),oq([KV()],sq.prototype,"setRemoteUserPriority",1),oq([KV()],sq.prototype,"takeLocalSnapshot",1),oq([KV()],sq.prototype,"takeRemoteSnapshot",1),oq([KV()],sq.prototype,"setSubscribeFallbackOption",1);var uq={"client unpublished":M.STREAM_REMOVE_REASON_UNPUBLISH,"publish failed":M.STREAM_REMOVE_REASON_PUBLISH_FAILED,"stream removed":M.STREAM_REMOVE_REASON_KEEP_LIVE_FAILED,"client disconnected":M.STREAM_REMOVE_REASON_CLIENT_DISCONNECTED,"client republish":M.STREAM_REMOVE_REASON_REPUBLISH},cq=new uM("VERTC",0);[jV,GV,HV].forEach((function(e){var t;return e.setStats({rtc_sdk_version:sF.VERSION,product_line:nV.RTC,report_version:iV.W_5,os:oV.WEB,device_id:rF.getDeviceId(),user_agent:RP()?"":null===(t=navigator)||void 0===t?void 0:t.userAgent})}));var dq=function(e,t){return cq.print("createEngine","Invoke VERTC.createEngine"),jP(e,"appId"),[jV,GV,HV].forEach((function(r){return r.setStats({rtc_app_id:e,auto_play_policy:null==t?void 0:t.autoPlayPolicy})})),VV.sdkInitEngine(Date.now(),NV.BEGIN),new sq(e,t)},lq=function(e){if(cq.print("destroyEngine","Invoke VERTC.destroyEngine"),!(e instanceof sq))throw new cD(sD.INVALID_ENGINE,"Invalid engine object");e.destroy(),VV.sdkInitEngine(Date.now(),NV.END)},hq=function(){var e=o(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",uj.enumerateDevices());case 1:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),fq=function(){var e=o(regeneratorRuntime.mark((function e(){var t,r,n,i,o=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=o.length>0&&void 0!==o[0]?o[0]:{video:!0,audio:!0},r=t.video,n=t.audio,i={video:!1,audio:!1},!r){e.next=12;break}return e.prev=4,e.next=7,uj.getVideoPermission();case 7:i.video=e.sent,e.next=12;break;case 10:e.prev=10,e.t0=e.catch(4);case 12:if(!n){e.next=21;break}return e.prev=13,e.next=16,uj.getAudioPermission();case 16:i.audio=e.sent,e.next=21;break;case 19:e.prev=19,e.t1=e.catch(13);case 21:return e.abrupt("return",i);case 22:case"end":return e.stop()}}),e,null,[[4,10],[13,19]])})));return function(){return e.apply(this,arguments)}}(),pq=function(){var e=o(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",uj.enumerateAudioCaptureDevices());case 1:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),_q=function(){var e=o(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",uj.enumerateVideoCaptureDevices());case 1:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),vq=function(){var e=o(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",uj.enumerateAudioPlaybackDevices());case 1:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),mq=function(){return sF.VERSION},gq=function(){return VV.rtcSdkApiCall("isSupported",0,""),qF()},yq=function(){return VV.rtcSdkApiCall("getSupportedCodecs",0,""),JF()};return!RP()&&location.search.includes("_rtc_autotest_"),r(r(r(r({},new(u((function e(){a(this,e),c(this,"getSdkVersion",mq),c(this,"createEngine",dq),c(this,"destroyEngine",lq),c(this,"enumerateDevices",hq),c(this,"enableDevices",fq),c(this,"enumerateAudioCaptureDevices",pq),c(this,"enumerateVideoCaptureDevices",_q),c(this,"enumerateAudioPlaybackDevices",vq),c(this,"getParameter",cF),c(this,"setParameter",uF),c(this,"isSupported",gq),c(this,"getSupportedCodecs",yq),c(this,"events",ee),c(this,"ErrorCode",sD),c(this,"platform","".concat({}.PRODUCT_PLATFORM)),c(this,"_monitor",VV)})))),Y),$),{},{events:ee})}));