@byteplus/rtc 4.51.5 → 4.51.7

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.51.5
4
+ * version: 4.51.7
5
5
  */
6
- !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).BytePlusRTC=t()}(this,(function(){"use strict";function e(e,t){return t.forEach((function(t){t&&"string"!=typeof t&&!Array.isArray(t)&&Object.keys(t).forEach((function(r){if("default"!==r&&!(r in e)){var n=Object.getOwnPropertyDescriptor(t,r);Object.defineProperty(e,r,n.get?n:{enumerable:!0,get:function(){return t[r]}})}}))})),Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}var t="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 t&&t)||function(){return this}()||Function("return this")(),i=function(e){try{return!!e()}catch(t){return!0}},o=!i((function(){var e=function(){}.bind();return"function"!=typeof e||e.hasOwnProperty("prototype")})),a=o,s=Function.prototype,c=s.apply,u=s.call,d="object"==typeof Reflect&&Reflect.apply||(a?u.bind(c):function(){return u.apply(c,arguments)}),l=o,h=Function.prototype,f=h.call,p=l&&h.bind.bind(f,f),v=l?p:function(e){return function(){return f.apply(e,arguments)}},_=v,m=_({}.toString),g=_("".slice),y=function(e){return g(m(e),8,-1)},S=y,E=v,b=function(e){if("Function"===S(e))return E(e)},k="object"==typeof document&&document.all,T={all:k,IS_HTMLDDA:void 0===k&&void 0!==k},I=T.all,A=T.IS_HTMLDDA?function(e){return"function"==typeof e||e===I}:function(e){return"function"==typeof e},R={},w=!i((function(){return 7!=Object.defineProperty({},1,{get:function(){return 7}})[1]})),C=o,O=Function.prototype.call,x=C?O.bind(O):function(){return O.apply(O,arguments)},D={},P={}.propertyIsEnumerable,N=Object.getOwnPropertyDescriptor,M=N&&!P.call({1:2},1);D.f=M?function(e){var t=N(this,e);return!!t&&t.enumerable}:P;var L,U,V=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}},F=i,B=y,j=Object,G=b("".split),H=F((function(){return!j("z").propertyIsEnumerable(0)}))?function(e){return"String"==B(e)?G(e,""):j(e)}:j,z=function(e){return null==e},K=z,X=TypeError,q=function(e){if(K(e))throw X("Can't call method on "+e);return e},W=H,Y=q,Q=function(e){return W(Y(e))},J=A,Z=T.all,$=T.IS_HTMLDDA?function(e){return"object"==typeof e?null!==e:J(e)||e===Z}:function(e){return"object"==typeof e?null!==e:J(e)},ee={},te=ee,re=n,ne=A,ie=function(e){return ne(e)?e:void 0},oe=function(e,t){return arguments.length<2?ie(te[e])||ie(re[e]):te[e]&&te[e][t]||re[e]&&re[e][t]},ae=b({}.isPrototypeOf),se=oe("navigator","userAgent")||"",ce=n,ue=se,de=ce.process,le=ce.Deno,he=de&&de.versions||le&&le.version,fe=he&&he.v8;fe&&(U=(L=fe.split("."))[0]>0&&L[0]<4?1:+(L[0]+L[1])),!U&&ue&&(!(L=ue.match(/Edge\/(\d+)/))||L[1]>=74)&&(L=ue.match(/Chrome\/(\d+)/))&&(U=+L[1]);var pe=U,ve=pe,_e=i,me=!!Object.getOwnPropertySymbols&&!_e((function(){var e=Symbol();return!String(e)||!(Object(e)instanceof Symbol)||!Symbol.sham&&ve&&ve<41})),ge=me&&!Symbol.sham&&"symbol"==typeof Symbol.iterator,ye=oe,Se=A,Ee=ae,be=Object,ke=ge?function(e){return"symbol"==typeof e}:function(e){var t=ye("Symbol");return Se(t)&&Ee(t.prototype,be(e))},Te=String,Ie=function(e){try{return Te(e)}catch(t){return"Object"}},Ae=A,Re=Ie,we=TypeError,Ce=function(e){if(Ae(e))return e;throw we(Re(e)+" is not a function")},Oe=Ce,xe=z,De=function(e,t){var r=e[t];return xe(r)?void 0:Oe(r)},Pe=x,Ne=A,Me=$,Le=TypeError,Ue={exports:{}},Ve=n,Fe=Object.defineProperty,Be=function(e,t){try{Fe(Ve,e,{value:t,configurable:!0,writable:!0})}catch(r){Ve[e]=t}return t},je="__core-js_shared__",Ge=n[je]||Be(je,{}),He=Ge;(Ue.exports=function(e,t){return He[e]||(He[e]=void 0!==t?t:{})})("versions",[]).push({version:"3.26.0",mode:"pure",copyright:"© 2014-2022 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.26.0/LICENSE",source:"https://github.com/zloirock/core-js"});var ze=q,Ke=Object,Xe=function(e){return Ke(ze(e))},qe=Xe,We=b({}.hasOwnProperty),Ye=Object.hasOwn||function(e,t){return We(qe(e),t)},Qe=b,Je=0,Ze=Math.random(),$e=Qe(1..toString),et=function(e){return"Symbol("+(void 0===e?"":e)+")_"+$e(++Je+Ze,36)},tt=n,rt=Ue.exports,nt=Ye,it=et,ot=me,at=ge,st=rt("wks"),ct=tt.Symbol,ut=ct&&ct.for,dt=at?ct:ct&&ct.withoutSetter||it,lt=function(e){if(!nt(st,e)||!ot&&"string"!=typeof st[e]){var t="Symbol."+e;ot&&nt(ct,e)?st[e]=ct[e]:st[e]=at&&ut?ut(t):dt(t)}return st[e]},ht=x,ft=$,pt=ke,vt=De,_t=function(e,t){var r,n;if("string"===t&&Ne(r=e.toString)&&!Me(n=Pe(r,e)))return n;if(Ne(r=e.valueOf)&&!Me(n=Pe(r,e)))return n;if("string"!==t&&Ne(r=e.toString)&&!Me(n=Pe(r,e)))return n;throw Le("Can't convert object to primitive value")},mt=TypeError,gt=lt("toPrimitive"),yt=function(e,t){if(!ft(e)||pt(e))return e;var r,n=vt(e,gt);if(n){if(void 0===t&&(t="default"),r=ht(n,e,t),!ft(r)||pt(r))return r;throw mt("Can't convert object to primitive value")}return void 0===t&&(t="number"),_t(e,t)},St=ke,Et=function(e){var t=yt(e,"string");return St(t)?t:t+""},bt=$,kt=n.document,Tt=bt(kt)&&bt(kt.createElement),It=function(e){return Tt?kt.createElement(e):{}},At=It,Rt=!w&&!i((function(){return 7!=Object.defineProperty(At("div"),"a",{get:function(){return 7}}).a})),wt=w,Ct=x,Ot=D,xt=V,Dt=Q,Pt=Et,Nt=Ye,Mt=Rt,Lt=Object.getOwnPropertyDescriptor;R.f=wt?Lt:function(e,t){if(e=Dt(e),t=Pt(t),Mt)try{return Lt(e,t)}catch(r){}if(Nt(e,t))return xt(!Ct(Ot.f,e,t),e[t])};var Ut=i,Vt=A,Ft=/#|\.prototype\./,Bt=function(e,t){var r=Gt[jt(e)];return r==zt||r!=Ht&&(Vt(t)?Ut(t):!!t)},jt=Bt.normalize=function(e){return String(e).replace(Ft,".").toLowerCase()},Gt=Bt.data={},Ht=Bt.NATIVE="N",zt=Bt.POLYFILL="P",Kt=Bt,Xt=Ce,qt=o,Wt=b(b.bind),Yt=function(e,t){return Xt(e),void 0===t?e:qt?Wt(e,t):function(){return e.apply(t,arguments)}},Qt={},Jt=w&&i((function(){return 42!=Object.defineProperty((function(){}),"prototype",{value:42,writable:!1}).prototype})),Zt=$,$t=String,er=TypeError,tr=function(e){if(Zt(e))return e;throw er($t(e)+" is not an object")},rr=w,nr=Rt,ir=Jt,or=tr,ar=Et,sr=TypeError,cr=Object.defineProperty,ur=Object.getOwnPropertyDescriptor,dr="enumerable",lr="configurable",hr="writable";Qt.f=rr?ir?function(e,t,r){if(or(e),t=ar(t),or(r),"function"==typeof e&&"prototype"===t&&"value"in r&&hr in r&&!r.writable){var n=ur(e,t);n&&n.writable&&(e[t]=r.value,r={configurable:lr in r?r.configurable:n.configurable,enumerable:dr in r?r.enumerable:n.enumerable,writable:!1})}return cr(e,t,r)}:cr:function(e,t,r){if(or(e),t=ar(t),or(r),nr)try{return cr(e,t,r)}catch(n){}if("get"in r||"set"in r)throw sr("Accessors not supported");return"value"in r&&(e[t]=r.value),e};var fr=Qt,pr=V,vr=w?function(e,t,r){return fr.f(e,t,pr(1,r))}:function(e,t,r){return e[t]=r,e},_r=n,mr=d,gr=b,yr=A,Sr=R.f,Er=Kt,br=ee,kr=Yt,Tr=vr,Ir=Ye,Ar=function(e){var t=function(r,n,i){if(this instanceof t){switch(arguments.length){case 0:return new e;case 1:return new e(r);case 2:return new e(r,n)}return new e(r,n,i)}return mr(e,this,arguments)};return t.prototype=e.prototype,t},Rr=function(e,t){var r,n,i,o,a,s,c,u,d=e.target,l=e.global,h=e.stat,f=e.proto,p=l?_r:h?_r[d]:(_r[d]||{}).prototype,v=l?br:br[d]||Tr(br,d,{})[d],_=v.prototype;for(i in t)r=!Er(l?i:d+(h?".":"#")+i,e.forced)&&p&&Ir(p,i),a=v[i],r&&(s=e.dontCallGetSet?(u=Sr(p,i))&&u.value:p[i]),o=r&&s?s:t[i],r&&typeof a==typeof o||(c=e.bind&&r?kr(o,_r):e.wrap&&r?Ar(o):f&&yr(o)?gr(o):o,(e.sham||o&&o.sham||a&&a.sham)&&Tr(c,"sham",!0),Tr(v,i,c),f&&(Ir(br,n=d+"Prototype")||Tr(br,n,{}),Tr(br[n],i,o),e.real&&_&&!_[i]&&Tr(_,i,o)))},wr=Math.ceil,Cr=Math.floor,Or=Math.trunc||function(e){var t=+e;return(t>0?Cr:wr)(t)},xr=function(e){var t=+e;return t!=t||0===t?0:Or(t)},Dr=xr,Pr=Math.max,Nr=Math.min,Mr=function(e,t){var r=Dr(e);return r<0?Pr(r+t,0):Nr(r,t)},Lr=xr,Ur=Math.min,Vr=function(e){return e>0?Ur(Lr(e),9007199254740991):0},Fr=Vr,Br=function(e){return Fr(e.length)},jr=Q,Gr=Mr,Hr=Br,zr=function(e){return function(t,r,n){var i,o=jr(t),a=Hr(o),s=Gr(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}},Kr={includes:zr(!0),indexOf:zr(!1)},Xr={},qr=Ye,Wr=Q,Yr=Kr.indexOf,Qr=Xr,Jr=b([].push),Zr=function(e,t){var r,n=Wr(e),i=0,o=[];for(r in n)!qr(Qr,r)&&qr(n,r)&&Jr(o,r);for(;t.length>i;)qr(n,r=t[i++])&&(~Yr(o,r)||Jr(o,r));return o},$r=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],en=Zr,tn=$r,rn=Object.keys||function(e){return en(e,tn)},nn=Xe,on=rn;Rr({target:"Object",stat:!0,forced:i((function(){on(1)}))},{keys:function(e){return on(nn(e))}});var an=ee.Object.keys,sn={};sn[lt("toStringTag")]="z";var cn="[object z]"===String(sn),un=cn,dn=A,ln=y,hn=lt("toStringTag"),fn=Object,pn="Arguments"==ln(function(){return arguments}()),vn=un?ln: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=fn(e),hn))?r:pn?ln(t):"Object"==(n=ln(t))&&dn(t.callee)?"Arguments":n},_n=vn,mn=String,gn=function(e){if("Symbol"===_n(e))throw TypeError("Cannot convert a Symbol value to a string");return mn(e)},yn={},Sn=w,En=Jt,bn=Qt,kn=tr,Tn=Q,In=rn;yn.f=Sn&&!En?Object.defineProperties:function(e,t){kn(e);for(var r,n=Tn(t),i=In(t),o=i.length,a=0;o>a;)bn.f(e,r=i[a++],n[r]);return e};var An,Rn=oe("document","documentElement"),wn=Ue.exports,Cn=et,On=wn("keys"),xn=function(e){return On[e]||(On[e]=Cn(e))},Dn=tr,Pn=yn,Nn=$r,Mn=Xr,Ln=Rn,Un=It,Vn=xn("IE_PROTO"),Fn=function(){},Bn=function(e){return"<script>"+e+"</"+"script>"},jn=function(e){e.write(Bn("")),e.close();var t=e.parentWindow.Object;return e=null,t},Gn=function(){try{An=new ActiveXObject("htmlfile")}catch(n){}var e,t;Gn="undefined"!=typeof document?document.domain&&An?jn(An):((t=Un("iframe")).style.display="none",Ln.appendChild(t),t.src=String("javascript:"),(e=t.contentWindow.document).open(),e.write(Bn("document.F=Object")),e.close(),e.F):jn(An);for(var r=Nn.length;r--;)delete Gn.prototype[Nn[r]];return Gn()};Mn[Vn]=!0;var Hn=Object.create||function(e,t){var r;return null!==e?(Fn.prototype=Dn(e),r=new Fn,Fn.prototype=null,r[Vn]=e):r=Gn(),void 0===t?r:Pn.f(r,t)},zn={},Kn=Zr,Xn=$r.concat("length","prototype");zn.f=Object.getOwnPropertyNames||function(e){return Kn(e,Xn)};var qn={},Wn=Et,Yn=Qt,Qn=V,Jn=function(e,t,r){var n=Wn(t);n in e?Yn.f(e,n,Qn(0,r)):e[n]=r},Zn=Mr,$n=Br,ei=Jn,ti=Array,ri=Math.max,ni=function(e,t,r){for(var n=$n(e),i=Zn(t,n),o=Zn(void 0===r?n:r,n),a=ti(ri(o-i,0)),s=0;i<o;i++,s++)ei(a,s,e[i]);return a.length=s,a},ii=y,oi=Q,ai=zn.f,si=ni,ci="object"==typeof window&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[];qn.f=function(e){return ci&&"Window"==ii(e)?function(e){try{return ai(e)}catch(t){return si(ci)}}(e):ai(oi(e))};var ui={};ui.f=Object.getOwnPropertySymbols;var di=vr,li=function(e,t,r,n){return n&&n.enumerable?e[t]=r:di(e,t,r),e},hi={},fi=lt;hi.f=fi;var pi,vi,_i,mi=ee,gi=Ye,yi=hi,Si=Qt.f,Ei=function(e){var t=mi.Symbol||(mi.Symbol={});gi(t,e)||Si(t,e,{value:yi.f(e)})},bi=x,ki=oe,Ti=lt,Ii=li,Ai=function(){var e=ki("Symbol"),t=e&&e.prototype,r=t&&t.valueOf,n=Ti("toPrimitive");t&&!t[n]&&Ii(t,n,(function(e){return bi(r,this)}),{arity:1})},Ri=vn,wi=cn?{}.toString:function(){return"[object "+Ri(this)+"]"},Ci=cn,Oi=Qt.f,xi=vr,Di=Ye,Pi=wi,Ni=lt("toStringTag"),Mi=function(e,t,r,n){if(e){var i=r?e:e.prototype;Di(i,Ni)||Oi(i,Ni,{configurable:!0,value:t}),n&&!Ci&&xi(i,"toString",Pi)}},Li=A,Ui=n.WeakMap,Vi=Li(Ui)&&/native code/.test(String(Ui)),Fi=Vi,Bi=n,ji=$,Gi=vr,Hi=Ye,zi=Ge,Ki=xn,Xi=Xr,qi="Object already initialized",Wi=Bi.TypeError,Yi=Bi.WeakMap;if(Fi||zi.state){var Qi=zi.state||(zi.state=new Yi);Qi.get=Qi.get,Qi.has=Qi.has,Qi.set=Qi.set,pi=function(e,t){if(Qi.has(e))throw Wi(qi);return t.facade=e,Qi.set(e,t),t},vi=function(e){return Qi.get(e)||{}},_i=function(e){return Qi.has(e)}}else{var Ji=Ki("state");Xi[Ji]=!0,pi=function(e,t){if(Hi(e,Ji))throw Wi(qi);return t.facade=e,Gi(e,Ji,t),t},vi=function(e){return Hi(e,Ji)?e[Ji]:{}},_i=function(e){return Hi(e,Ji)}}var Zi={set:pi,get:vi,has:_i,enforce:function(e){return _i(e)?vi(e):pi(e,{})},getterFor:function(e){return function(t){var r;if(!ji(t)||(r=vi(t)).type!==e)throw Wi("Incompatible receiver, "+e+" required");return r}}},$i=y,eo=Array.isArray||function(e){return"Array"==$i(e)},to=A,ro=Ge,no=b(Function.toString);to(ro.inspectSource)||(ro.inspectSource=function(e){return no(e)});var io=ro.inspectSource,oo=b,ao=i,so=A,co=vn,uo=io,lo=function(){},ho=[],fo=oe("Reflect","construct"),po=/^\s*(?:class|function)\b/,vo=oo(po.exec),_o=!po.exec(lo),mo=function(e){if(!so(e))return!1;try{return fo(lo,ho,e),!0}catch(t){return!1}},go=function(e){if(!so(e))return!1;switch(co(e)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return _o||!!vo(po,uo(e))}catch(t){return!0}};go.sham=!0;var yo=!fo||ao((function(){var e;return mo(mo.call)||!mo(Object)||!mo((function(){e=!0}))||e}))?go:mo,So=eo,Eo=yo,bo=$,ko=lt("species"),To=Array,Io=function(e){var t;return So(e)&&(t=e.constructor,(Eo(t)&&(t===To||So(t.prototype))||bo(t)&&null===(t=t[ko]))&&(t=void 0)),void 0===t?To:t},Ao=function(e,t){return new(Io(e))(0===t?0:t)},Ro=Yt,wo=H,Co=Xe,Oo=Br,xo=Ao,Do=b([].push),Po=function(e){var t=1==e,r=2==e,n=3==e,i=4==e,o=6==e,a=7==e,s=5==e||o;return function(c,u,d,l){for(var h,f,p=Co(c),v=wo(p),_=Ro(u,d),m=Oo(v),g=0,y=l||xo,S=t?y(c,m):r||a?y(c,0):void 0;m>g;g++)if((s||g in v)&&(f=_(h=v[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:Do(S,h)}else switch(e){case 4:return!1;case 7:Do(S,h)}return o?-1:n||i?i:S}},No={forEach:Po(0),map:Po(1),filter:Po(2),some:Po(3),every:Po(4),find:Po(5),findIndex:Po(6),filterReject:Po(7)},Mo=Rr,Lo=n,Uo=x,Vo=b,Fo=w,Bo=me,jo=i,Go=Ye,Ho=ae,zo=tr,Ko=Q,Xo=Et,qo=gn,Wo=V,Yo=Hn,Qo=rn,Jo=zn,Zo=qn,$o=ui,ea=R,ta=Qt,ra=yn,na=D,ia=li,oa=Ue.exports,aa=Xr,sa=et,ca=lt,ua=hi,da=Ei,la=Ai,ha=Mi,fa=Zi,pa=No.forEach,va=xn("hidden"),_a="Symbol",ma=fa.set,ga=fa.getterFor(_a),ya=Object.prototype,Sa=Lo.Symbol,Ea=Sa&&Sa.prototype,ba=Lo.TypeError,ka=Lo.QObject,Ta=ea.f,Ia=ta.f,Aa=Zo.f,Ra=na.f,wa=Vo([].push),Ca=oa("symbols"),Oa=oa("op-symbols"),xa=oa("wks"),Da=!ka||!ka.prototype||!ka.prototype.findChild,Pa=Fo&&jo((function(){return 7!=Yo(Ia({},"a",{get:function(){return Ia(this,"a",{value:7}).a}})).a}))?function(e,t,r){var n=Ta(ya,t);n&&delete ya[t],Ia(e,t,r),n&&e!==ya&&Ia(ya,t,n)}:Ia,Na=function(e,t){var r=Ca[e]=Yo(Ea);return ma(r,{type:_a,tag:e,description:t}),Fo||(r.description=t),r},Ma=function(e,t,r){e===ya&&Ma(Oa,t,r),zo(e);var n=Xo(t);return zo(r),Go(Ca,n)?(r.enumerable?(Go(e,va)&&e[va][n]&&(e[va][n]=!1),r=Yo(r,{enumerable:Wo(0,!1)})):(Go(e,va)||Ia(e,va,Wo(1,{})),e[va][n]=!0),Pa(e,n,r)):Ia(e,n,r)},La=function(e,t){zo(e);var r=Ko(t),n=Qo(r).concat(Ba(r));return pa(n,(function(t){Fo&&!Uo(Ua,r,t)||Ma(e,t,r[t])})),e},Ua=function(e){var t=Xo(e),r=Uo(Ra,this,t);return!(this===ya&&Go(Ca,t)&&!Go(Oa,t))&&(!(r||!Go(this,t)||!Go(Ca,t)||Go(this,va)&&this[va][t])||r)},Va=function(e,t){var r=Ko(e),n=Xo(t);if(r!==ya||!Go(Ca,n)||Go(Oa,n)){var i=Ta(r,n);return!i||!Go(Ca,n)||Go(r,va)&&r[va][n]||(i.enumerable=!0),i}},Fa=function(e){var t=Aa(Ko(e)),r=[];return pa(t,(function(e){Go(Ca,e)||Go(aa,e)||wa(r,e)})),r},Ba=function(e){var t=e===ya,r=Aa(t?Oa:Ko(e)),n=[];return pa(r,(function(e){!Go(Ca,e)||t&&!Go(ya,e)||wa(n,Ca[e])})),n};Bo||(Sa=function(){if(Ho(Ea,this))throw ba("Symbol is not a constructor");var e=arguments.length&&void 0!==arguments[0]?qo(arguments[0]):void 0,t=sa(e),r=function(e){this===ya&&Uo(r,Oa,e),Go(this,va)&&Go(this[va],t)&&(this[va][t]=!1),Pa(this,t,Wo(1,e))};return Fo&&Da&&Pa(ya,t,{configurable:!0,set:r}),Na(t,e)},ia(Ea=Sa.prototype,"toString",(function(){return ga(this).tag})),ia(Sa,"withoutSetter",(function(e){return Na(sa(e),e)})),na.f=Ua,ta.f=Ma,ra.f=La,ea.f=Va,Jo.f=Zo.f=Fa,$o.f=Ba,ua.f=function(e){return Na(ca(e),e)},Fo&&Ia(Ea,"description",{configurable:!0,get:function(){return ga(this).description}})),Mo({global:!0,constructor:!0,wrap:!0,forced:!Bo,sham:!Bo},{Symbol:Sa}),pa(Qo(xa),(function(e){da(e)})),Mo({target:_a,stat:!0,forced:!Bo},{useSetter:function(){Da=!0},useSimple:function(){Da=!1}}),Mo({target:"Object",stat:!0,forced:!Bo,sham:!Fo},{create:function(e,t){return void 0===t?Yo(e):La(Yo(e),t)},defineProperty:Ma,defineProperties:La,getOwnPropertyDescriptor:Va}),Mo({target:"Object",stat:!0,forced:!Bo},{getOwnPropertyNames:Fa}),la(),ha(Sa,_a),aa[va]=!0;var ja=me&&!!Symbol.for&&!!Symbol.keyFor,Ga=Rr,Ha=oe,za=Ye,Ka=gn,Xa=Ue.exports,qa=ja,Wa=Xa("string-to-symbol-registry"),Ya=Xa("symbol-to-string-registry");Ga({target:"Symbol",stat:!0,forced:!qa},{for:function(e){var t=Ka(e);if(za(Wa,t))return Wa[t];var r=Ha("Symbol")(t);return Wa[t]=r,Ya[r]=t,r}});var Qa=Rr,Ja=Ye,Za=ke,$a=Ie,es=ja,ts=(0,Ue.exports)("symbol-to-string-registry");Qa({target:"Symbol",stat:!0,forced:!es},{keyFor:function(e){if(!Za(e))throw TypeError($a(e)+" is not a symbol");if(Ja(ts,e))return ts[e]}});var rs=b([].slice),ns=Rr,is=oe,os=d,as=x,ss=b,cs=i,us=eo,ds=A,ls=$,hs=ke,fs=rs,ps=me,vs=is("JSON","stringify"),_s=ss(/./.exec),ms=ss("".charAt),gs=ss("".charCodeAt),ys=ss("".replace),Ss=ss(1..toString),Es=/[\uD800-\uDFFF]/g,bs=/^[\uD800-\uDBFF]$/,ks=/^[\uDC00-\uDFFF]$/,Ts=!ps||cs((function(){var e=is("Symbol")();return"[null]"!=vs([e])||"{}"!=vs({a:e})||"{}"!=vs(Object(e))})),Is=cs((function(){return'"\\udf06\\ud834"'!==vs("\udf06\ud834")||'"\\udead"'!==vs("\udead")})),As=function(e,t){var r=fs(arguments),n=t;if((ls(t)||void 0!==e)&&!hs(e))return us(t)||(t=function(e,t){if(ds(n)&&(t=as(n,this,e,t)),!hs(t))return t}),r[1]=t,os(vs,null,r)},Rs=function(e,t,r){var n=ms(r,t-1),i=ms(r,t+1);return _s(bs,e)&&!_s(ks,i)||_s(ks,e)&&!_s(bs,n)?"\\u"+Ss(gs(e,0),16):e};vs&&ns({target:"JSON",stat:!0,arity:3,forced:Ts||Is},{stringify:function(e,t,r){var n=fs(arguments),i=os(Ts?As:vs,null,n);return Is&&"string"==typeof i?ys(i,Es,Rs):i}});var ws=ui,Cs=Xe;Rr({target:"Object",stat:!0,forced:!me||i((function(){ws.f(1)}))},{getOwnPropertySymbols:function(e){var t=ws.f;return t?t(Cs(e)):[]}});var Os=ee.Object.getOwnPropertySymbols,xs=i,Ds=pe,Ps=lt("species"),Ns=function(e){return Ds>=51||!xs((function(){var t=[];return(t.constructor={})[Ps]=function(){return{foo:1}},1!==t[e](Boolean).foo}))},Ms=No.filter;Rr({target:"Array",proto:!0,forced:!Ns("filter")},{filter:function(e){return Ms(this,e,arguments.length>1?arguments[1]:void 0)}});var Ls=ee,Us=function(e){return Ls[e+"Prototype"]},Vs=Us("Array").filter,Fs=ae,Bs=Vs,js=Array.prototype,Gs=function(e){var t=e.filter;return e===js||Fs(js,e)&&t===js.filter?Bs:t},Hs={exports:{}},zs=Rr,Ks=i,Xs=Q,qs=R.f,Ws=w,Ys=Ks((function(){qs(1)}));zs({target:"Object",stat:!0,forced:!Ws||Ys,sham:!Ws},{getOwnPropertyDescriptor:function(e,t){return qs(Xs(e),t)}});var Qs=ee.Object,Js=Hs.exports=function(e,t){return Qs.getOwnPropertyDescriptor(e,t)};Qs.getOwnPropertyDescriptor.sham&&(Js.sham=!0);var Zs,$s,ec,tc=Hs.exports,rc={},nc=w,ic=Ye,oc=Function.prototype,ac=nc&&Object.getOwnPropertyDescriptor,sc=ic(oc,"name"),cc={EXISTS:sc,PROPER:sc&&"something"===function(){}.name,CONFIGURABLE:sc&&(!nc||nc&&ac(oc,"name").configurable)},uc=!i((function(){function e(){}return e.prototype.constructor=null,Object.getPrototypeOf(new e)!==e.prototype})),dc=Ye,lc=A,hc=Xe,fc=uc,pc=xn("IE_PROTO"),vc=Object,_c=vc.prototype,mc=fc?vc.getPrototypeOf:function(e){var t=hc(e);if(dc(t,pc))return t[pc];var r=t.constructor;return lc(r)&&t instanceof r?r.prototype:t instanceof vc?_c:null},gc=i,yc=A,Sc=$,Ec=Hn,bc=mc,kc=li,Tc=lt("iterator"),Ic=!1;[].keys&&("next"in(ec=[].keys())?($s=bc(bc(ec)))!==Object.prototype&&(Zs=$s):Ic=!0);var Ac=!Sc(Zs)||gc((function(){var e={};return Zs[Tc].call(e)!==e}));yc((Zs=Ac?{}:Ec(Zs))[Tc])||kc(Zs,Tc,(function(){return this}));var Rc={IteratorPrototype:Zs,BUGGY_SAFARI_ITERATORS:Ic},wc=Rc.IteratorPrototype,Cc=Hn,Oc=V,xc=Mi,Dc=rc,Pc=function(){return this},Nc=function(e,t,r,n){var i=t+" Iterator";return e.prototype=Cc(wc,{next:Oc(+!n,r)}),xc(e,i,!1,!0),Dc[i]=Pc,e},Mc=A,Lc=String,Uc=TypeError,Vc=b,Fc=tr,Bc=function(e){if("object"==typeof e||Mc(e))return e;throw Uc("Can't set "+Lc(e)+" as a prototype")},jc=Object.setPrototypeOf||("__proto__"in{}?function(){var e,t=!1,r={};try{(e=Vc(Object.getOwnPropertyDescriptor(Object.prototype,"__proto__").set))(r,[]),t=r instanceof Array}catch(n){}return function(r,n){return Fc(r),Bc(n),t?e(r,n):r.__proto__=n,r}}():void 0),Gc=Rr,Hc=x,zc=cc,Kc=Nc,Xc=mc,qc=Mi,Wc=li,Yc=rc,Qc=Rc,Jc=zc.PROPER,Zc=Qc.BUGGY_SAFARI_ITERATORS,$c=lt("iterator"),eu="keys",tu="values",ru="entries",nu=function(){return this},iu=function(e,t,r,n,i,o,a){Kc(r,t,n);var s,c,u,d=function(e){if(e===i&&v)return v;if(!Zc&&e in f)return f[e];switch(e){case eu:case tu:case ru:return function(){return new r(this,e)}}return function(){return new r(this)}},l=t+" Iterator",h=!1,f=e.prototype,p=f[$c]||f["@@iterator"]||i&&f[i],v=!Zc&&p||d(i),_="Array"==t&&f.entries||p;if(_&&(s=Xc(_.call(new e)))!==Object.prototype&&s.next&&(qc(s,l,!0,!0),Yc[l]=nu),Jc&&i==tu&&p&&p.name!==tu&&(h=!0,v=function(){return Hc(p,this)}),i)if(c={values:d(tu),keys:o?v:d(eu),entries:d(ru)},a)for(u in c)(Zc||h||!(u in f))&&Wc(f,u,c[u]);else Gc({target:t,proto:!0,forced:Zc||h},c);return a&&f[$c]!==v&&Wc(f,$c,v,{name:i}),Yc[t]=v,c},ou=function(e,t){return{value:e,done:t}},au=Q,su=function(){},cu=rc,uu=Zi,du=(Qt.f,iu),lu=ou,hu="Array Iterator",fu=uu.set,pu=uu.getterFor(hu);du(Array,"Array",(function(e,t){fu(this,{type:hu,target:au(e),index:0,kind:t})}),(function(){var e=pu(this),t=e.target,r=e.kind,n=e.index++;return!t||n>=t.length?(e.target=void 0,lu(void 0,!0)):lu("keys"==r?n:"values"==r?t[n]:[n,t[n]],!1)}),"values");cu.Arguments=cu.Array;su(),su(),su();var vu={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},_u=n,mu=vn,gu=vr,yu=rc,Su=lt("toStringTag");for(var Eu in vu){var bu=_u[Eu],ku=bu&&bu.prototype;ku&&mu(ku)!==Su&&gu(ku,Su,Eu),yu[Eu]=yu.Array}var Tu=i,Iu=function(e,t){var r=[][e];return!!r&&Tu((function(){r.call(null,t||function(){return 1},1)}))},Au=No.forEach,Ru=Iu("forEach")?[].forEach:function(e){return Au(this,e,arguments.length>1?arguments[1]:void 0)};Rr({target:"Array",proto:!0,forced:[].forEach!=Ru},{forEach:Ru});var wu=Us("Array").forEach,Cu=vn,Ou=Ye,xu=ae,Du=wu,Pu=Array.prototype,Nu={DOMTokenList:!0,NodeList:!0},Mu=function(e){var t=e.forEach;return e===Pu||xu(Pu,e)&&t===Pu.forEach||Ou(Nu,Cu(e))?Du:t},Lu=oe,Uu=zn,Vu=ui,Fu=tr,Bu=b([].concat),ju=Lu("Reflect","ownKeys")||function(e){var t=Uu.f(Fu(e)),r=Vu.f;return r?Bu(t,r(e)):t},Gu=ju,Hu=Q,zu=R,Ku=Jn;Rr({target:"Object",stat:!0,sham:!w},{getOwnPropertyDescriptors:function(e){for(var t,r,n=Hu(e),i=zu.f,o=Gu(n),a={},s=0;o.length>s;)void 0!==(r=i(n,t=o[s++]))&&Ku(a,t,r);return a}});var Xu=ee.Object.getOwnPropertyDescriptors,qu={exports:{}},Wu=Rr,Yu=w,Qu=yn.f;Wu({target:"Object",stat:!0,forced:Object.defineProperties!==Qu,sham:!Yu},{defineProperties:Qu});var Ju=ee.Object,Zu=qu.exports=function(e,t){return Ju.defineProperties(e,t)};Ju.defineProperties.sham&&(Zu.sham=!0);var $u=qu.exports,ed={exports:{}},td=Rr,rd=w,nd=Qt.f;td({target:"Object",stat:!0,forced:Object.defineProperty!==nd,sham:!rd},{defineProperty:nd});var id=ee.Object,od=ed.exports=function(e,t,r){return id.defineProperty(e,t,r)};id.defineProperty.sham&&(od.sham=!0);var ad=ed.exports;function sd(e,t,r){return t in e?ad(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function cd(e,t){var r=an(e);if(Os){var n=Os(e);t&&(n=Gs(n).call(n,(function(t){return tc(e,t).enumerable}))),r.push.apply(r,n)}return r}function ud(e){for(var t=1;t<arguments.length;t++){var r,n,i=null!=arguments[t]?arguments[t]:{};t%2?Mu(r=cd(Object(i),!0)).call(r,(function(t){sd(e,t,i[t])})):Xu?$u(e,Xu(i)):Mu(n=cd(Object(i))).call(n,(function(t){ad(e,t,tc(i,t))}))}return e}var dd=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}(dd||{}),ld=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}(ld||{}),hd=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}(hd||{}),fd=function(e){return e[e.CHANNEL_PROFILE_COMMUNICATION=0]="CHANNEL_PROFILE_COMMUNICATION",e[e.CHANNEL_PROFILE_LIVE_BROADCASTING=1]="CHANNEL_PROFILE_LIVE_BROADCASTING",e}(fd||{}),pd=function(e){return e[e.AUTO_SUBSCRIBE_MODE=0]="AUTO_SUBSCRIBE_MODE",e[e.MANUAL_SUBSCRIBE_MODE=1]="MANUAL_SUBSCRIBE_MODE",e}(pd||{}),vd=function(e){return e[e.SUBSCRIBE_SUCC=0]="SUBSCRIBE_SUCC",e[e.SUBSCRIBE_FAIL=1]="SUBSCRIBE_FAIL",e}(vd||{}),_d=function(e){return e[e.PUBLISH_SUCC=0]="PUBLISH_SUCC",e[e.PUBLISH_FAIL=1]="PUBLISH_FAIL",e}(_d||{}),md=function(e){return e[e.MIRROR_MODE_OFF=0]="MIRROR_MODE_OFF",e[e.MIRROR_MODE_ON=1]="MIRROR_MODE_ON",e}(md||{}),gd=function(e){return e[e.RENDER_MODE_HIDDEN=0]="RENDER_MODE_HIDDEN",e[e.RENDER_MODE_FIT=1]="RENDER_MODE_FIT",e}(gd||{}),yd=function(e){return e[e.STREAM_INDEX_MAIN=0]="STREAM_INDEX_MAIN",e[e.STREAM_INDEX_SCREEN=1]="STREAM_INDEX_SCREEN",e}(yd||{}),Sd=function(e){return e[e.AUDIO=1]="AUDIO",e[e.VIDEO=2]="VIDEO",e[e.AUDIO_AND_VIDEO=3]="AUDIO_AND_VIDEO",e}(Sd||{}),Ed=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}(Ed||{}),bd=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}(bd||{}),kd=function(e){return e[e.MIRROR_TYPE_NONE=0]="MIRROR_TYPE_NONE",e[e.MIRROR_TYPE_RENDER=1]="MIRROR_TYPE_RENDER",e}(kd||{}),Td=function(e){return e[e.domestic=0]="domestic",e[e.overseas=1]="overseas",e}(Td||{}),Id=function(e){return e[e.OFFLINE=0]="OFFLINE",e[e.ONLINE=1]="ONLINE",e[e.UNREACHABLE=2]="UNREACHABLE",e}(Id||{}),Ad=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}(Ad||{}),Rd=function(e){return e[e.PREV_FRAME=0]="PREV_FRAME",e[e.OTHER_FRAME=1]="OTHER_FRAME",e}(Rd||{}),wd=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}(wd||{}),Cd=function(e){return e[e.LOW=0]="LOW",e[e.MEDIUM=100]="MEDIUM",e[e.HIGH=200]="HIGH",e}(Cd||{}),Od=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}(Od||{}),xd=function(e){return e[e.Unknown=-1]="Unknown",e[e.SubscribeFallbackByBandwidth=0]="SubscribeFallbackByBandwidth",e[e.SubscribeRecoverByBandwidth=2]="SubscribeRecoverByBandwidth",e}(xd||{}),Dd=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}(Dd||{}),Pd=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}(Pd||{}),Nd=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}(Nd||{}),Md=function(e){return e.LC="LC",e.HEv1="HEv1",e.HEv2="HEv2",e}(Md||{}),Ld=function(e){return e.H264="H264",e.H265="H265",e}(Ld||{}),Ud=function(e){return e[e.ASR_ONLY=0]="ASR_ONLY",e[e.ASR_AND_TRANSLATION=1]="ASR_AND_TRANSLATION",e}(Ud||{}),Vd=function(e){return e[e.STARTED=0]="STARTED",e[e.STOPPED=1]="STOPPED",e[e.ERROR=2]="ERROR",e}(Vd||{}),Fd=function(e){return e.AUTO="auto",e.FORCE_TCP="forceTCP",e.FORCE_UDP="forceUDP",e}(Fd||{}),Bd=Object.freeze(Object.defineProperty({__proto__:null,VideoSourceType:dd,AudioSourceType:ld,UserOfflineReason:hd,ChannelProfile:fd,SubscribeMode:pd,SubscribeState:vd,PublishState:_d,MirrorMode:md,VideoRenderMode:gd,StreamIndex:yd,MediaType:Sd,StreamRemoveReason:Ed,ConnectionState:bd,MirrorType:kd,LogChannel:Td,USER_ONLINE_STATUS:Id,PublicStreamType:Ad,PublicInterpolationMode:Rd,SubscribeFallbackOption:wd,RemoteUserPriority:Cd,NetworkQuality:Od,FallbackOrRecoverReason:xd,RoomProfileType:Dd,AudioProfileType:Pd,RTCAutoPlayPolicy:Nd,AAC_PROFILE:Md,TRANSCODING_VIDEO_CODEC:Ld,SUBTITLE_MODE:Ud,SubtitleEventType:Vd,ConnectionMode:Fd},Symbol.toStringTag,{value:"Module"})),jd=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}(jd||{}),Gd=function(e){return e[e.PLAYOUT=0]="PLAYOUT",e[e.PUBLISH=1]="PUBLISH",e[e.PLAYOUT_AND_PUBLISH=2]="PLAYOUT_AND_PUBLISH",e}(Gd||{}),Hd=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}(Hd||{}),zd=Object.freeze(Object.defineProperty({__proto__:null,AudioMixingDualMonoMode:jd,AudioMixingType:Gd,AudioMixingState:Hd},Symbol.toStringTag,{value:"Module"})),Kd=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.onRemoteVideoFirstFrame="onRemoteVideoFirstFrame",e.onAudioFirstFrameDecoded="onAudioFirstFrameDecoded",e.onRemoteAudioFirstFrame="onRemoteAudioFirstFrame",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.onSubtitleStateChanged="onSubtitleStateChanged",e.onSubtitleMessageReceived="onSubtitleMessageReceived",e.onServerParamsSetResult="onServerParamsSetResult",e}(Kd||{});function Xd(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),ad(e,n.key,n)}}function qd(e,t,r){return t&&Xd(e.prototype,t),r&&Xd(e,r),ad(e,"prototype",{writable:!1}),e}function Wd(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var Yd=TypeError,Qd=function(e){if(e>9007199254740991)throw Yd("Maximum allowed index exceeded");return e},Jd=Rr,Zd=i,$d=eo,el=$,tl=Xe,rl=Br,nl=Qd,il=Jn,ol=Ao,al=Ns,sl=pe,cl=lt("isConcatSpreadable"),ul=sl>=51||!Zd((function(){var e=[];return e[cl]=!1,e.concat()[0]!==e})),dl=al("concat"),ll=function(e){if(!el(e))return!1;var t=e[cl];return void 0!==t?!!t:$d(e)};Jd({target:"Array",proto:!0,arity:1,forced:!ul||!dl},{concat:function(e){var t,r,n,i,o,a=tl(this),s=ol(a,0),c=0;for(t=-1,n=arguments.length;t<n;t++)if(ll(o=-1===t?a:arguments[t]))for(i=rl(o),nl(c+i),r=0;r<i;r++,c++)r in o&&il(s,c,o[r]);else nl(c+1),il(s,c++,o);return s.length=c,s}}),Ei("asyncIterator"),Ei("hasInstance"),Ei("isConcatSpreadable"),Ei("iterator"),Ei("match"),Ei("matchAll"),Ei("replace"),Ei("search"),Ei("species"),Ei("split");var hl=Ai;Ei("toPrimitive"),hl();var fl=oe,pl=Mi;Ei("toStringTag"),pl(fl("Symbol"),"Symbol"),Ei("unscopables"),Mi(n.JSON,"JSON",!0);var vl=ee.Symbol;Ei("asyncDispose"),Ei("dispose"),Ei("matcher"),Ei("metadataKey"),Ei("observable"),Ei("metadata"),Ei("patternMatch"),Ei("replaceAll");var _l=vl,ml=b,gl=xr,yl=gn,Sl=q,El=ml("".charAt),bl=ml("".charCodeAt),kl=ml("".slice),Tl=function(e){return function(t,r){var n,i,o=yl(Sl(t)),a=gl(r),s=o.length;return a<0||a>=s?e?"":void 0:(n=bl(o,a))<55296||n>56319||a+1===s||(i=bl(o,a+1))<56320||i>57343?e?El(o,a):n:e?kl(o,a,a+2):i-56320+(n-55296<<10)+65536}},Il={codeAt:Tl(!1),charAt:Tl(!0)},Al=Il.charAt,Rl=gn,wl=Zi,Cl=iu,Ol=ou,xl="String Iterator",Dl=wl.set,Pl=wl.getterFor(xl);Cl(String,"String",(function(e){Dl(this,{type:xl,string:Rl(e),index:0})}),(function(){var e,t=Pl(this),r=t.string,n=t.index;return n>=r.length?Ol(void 0,!0):(e=Al(r,n),t.index+=e.length,Ol(e,!1))}));var Nl=hi.f("iterator");function Ml(e){return(Ml="function"==typeof _l&&"symbol"==typeof Nl?function(e){return typeof e}:function(e){return e&&"function"==typeof _l&&e.constructor===_l&&e!==_l.prototype?"symbol":typeof e})(e)}Rr({target:"Object",stat:!0,sham:!w},{create:Hn});var Ll=ee.Object,Ul=function(e,t){return Ll.create(e,t)},Vl=Xe,Fl=mc,Bl=uc;Rr({target:"Object",stat:!0,forced:i((function(){Fl(1)})),sham:!Bl},{getPrototypeOf:function(e){return Fl(Vl(e))}});var jl=ee.Object.getPrototypeOf;Rr({target:"Object",stat:!0},{setPrototypeOf:jc});var Gl=ee.Object.setPrototypeOf,Hl=Ye,zl=ju,Kl=R,Xl=Qt,ql=Error,Wl=b("".replace),Yl=String(ql("zxcasd").stack),Ql=/\n\s*at [^:]*:[^\n]*/,Jl=Ql.test(Yl),Zl=$,$l=vr,eh=rc,th=lt("iterator"),rh=Array.prototype,nh=function(e){return void 0!==e&&(eh.Array===e||rh[th]===e)},ih=vn,oh=De,ah=z,sh=rc,ch=lt("iterator"),uh=function(e){if(!ah(e))return oh(e,ch)||oh(e,"@@iterator")||sh[ih(e)]},dh=x,lh=Ce,hh=tr,fh=Ie,ph=uh,vh=TypeError,_h=function(e,t){var r=arguments.length<2?ph(e):t;if(lh(r))return hh(dh(r,e));throw vh(fh(e)+" is not iterable")},mh=x,gh=tr,yh=De,Sh=function(e,t,r){var n,i;gh(e);try{if(!(n=yh(e,"return"))){if("throw"===t)throw r;return r}n=mh(n,e)}catch(o){i=!0,n=o}if("throw"===t)throw r;if(i)throw n;return gh(n),r},Eh=Yt,bh=x,kh=tr,Th=Ie,Ih=nh,Ah=Br,Rh=ae,wh=_h,Ch=uh,Oh=Sh,xh=TypeError,Dh=function(e,t){this.stopped=e,this.result=t},Ph=Dh.prototype,Nh=function(e,t,r){var n,i,o,a,s,c,u,d=r&&r.that,l=!(!r||!r.AS_ENTRIES),h=!(!r||!r.IS_RECORD),f=!(!r||!r.IS_ITERATOR),p=!(!r||!r.INTERRUPTED),v=Eh(t,d),_=function(e){return n&&Oh(n,"normal",e),new Dh(!0,e)},m=function(e){return l?(kh(e),p?v(e[0],e[1],_):v(e[0],e[1])):p?v(e,_):v(e)};if(h)n=e.iterator;else if(f)n=e;else{if(!(i=Ch(e)))throw xh(Th(e)+" is not iterable");if(Ih(i)){for(o=0,a=Ah(e);a>o;o++)if((s=m(e[o]))&&Rh(Ph,s))return s;return new Dh(!1)}n=wh(e,i)}for(c=h?e.next:n.next;!(u=bh(c,n)).done;){try{s=m(u.value)}catch(g){Oh(n,"throw",g)}if("object"==typeof s&&s&&Rh(Ph,s))return s}return new Dh(!1)},Mh=gn,Lh=V,Uh=!i((function(){var e=Error("a");return!("stack"in e)||(Object.defineProperty(e,"stack",Lh(1,7)),7!==e.stack)})),Vh=Rr,Fh=ae,Bh=mc,jh=jc,Gh=function(e,t,r){for(var n=zl(t),i=Xl.f,o=Kl.f,a=0;a<n.length;a++){var s=n[a];Hl(e,s)||r&&Hl(r,s)||i(e,s,o(t,s))}},Hh=Hn,zh=vr,Kh=V,Xh=function(e,t){if(Jl&&"string"==typeof e&&!ql.prepareStackTrace)for(;t--;)e=Wl(e,Ql,"");return e},qh=function(e,t){Zl(t)&&"cause"in t&&$l(e,"cause",t.cause)},Wh=Nh,Yh=function(e,t){return void 0===e?arguments.length<2?"":t:Mh(e)},Qh=Uh,Jh=lt("toStringTag"),Zh=Error,$h=[].push,ef=function(e,t){var r,n=arguments.length>2?arguments[2]:void 0,i=Fh(tf,this);jh?r=jh(Zh(),i?Bh(this):tf):(r=i?this:Hh(tf),zh(r,Jh,"Error")),void 0!==t&&zh(r,"message",Yh(t)),Qh&&zh(r,"stack",Xh(r.stack,1)),qh(r,n);var o=[];return Wh(e,$h,{that:o}),zh(r,"errors",o),r};jh?jh(ef,Zh):Gh(ef,Zh,{name:!0});var tf=ef.prototype=Hh(Zh.prototype,{constructor:Kh(1,ef),message:Kh(1,""),name:Kh(1,"AggregateError")});Vh({global:!0,constructor:!0,arity:2},{AggregateError:ef});var rf,nf,of,af,sf="process"==y(n.process),cf=oe,uf=Qt,df=w,lf=lt("species"),hf=function(e){var t=cf(e),r=uf.f;df&&t&&!t[lf]&&r(t,lf,{configurable:!0,get:function(){return this}})},ff=ae,pf=TypeError,vf=function(e,t){if(ff(t,e))return e;throw pf("Incorrect invocation")},_f=yo,mf=Ie,gf=TypeError,yf=function(e){if(_f(e))return e;throw gf(mf(e)+" is not a constructor")},Sf=tr,Ef=yf,bf=z,kf=lt("species"),Tf=function(e,t){var r,n=Sf(e).constructor;return void 0===n||bf(r=Sf(n)[kf])?t:Ef(r)},If=TypeError,Af=function(e,t){if(e<t)throw If("Not enough arguments");return e},Rf=/(?:ipad|iphone|ipod).*applewebkit/i.test(se),wf=n,Cf=d,Of=Yt,xf=A,Df=Ye,Pf=i,Nf=Rn,Mf=rs,Lf=It,Uf=Af,Vf=Rf,Ff=sf,Bf=wf.setImmediate,jf=wf.clearImmediate,Gf=wf.process,Hf=wf.Dispatch,zf=wf.Function,Kf=wf.MessageChannel,Xf=wf.String,qf=0,Wf={},Yf="onreadystatechange";try{rf=wf.location}catch(mW){}var Qf=function(e){if(Df(Wf,e)){var t=Wf[e];delete Wf[e],t()}},Jf=function(e){return function(){Qf(e)}},Zf=function(e){Qf(e.data)},$f=function(e){wf.postMessage(Xf(e),rf.protocol+"//"+rf.host)};Bf&&jf||(Bf=function(e){Uf(arguments.length,1);var t=xf(e)?e:zf(e),r=Mf(arguments,1);return Wf[++qf]=function(){Cf(t,void 0,r)},nf(qf),qf},jf=function(e){delete Wf[e]},Ff?nf=function(e){Gf.nextTick(Jf(e))}:Hf&&Hf.now?nf=function(e){Hf.now(Jf(e))}:Kf&&!Vf?(af=(of=new Kf).port2,of.port1.onmessage=Zf,nf=Of(af.postMessage,af)):wf.addEventListener&&xf(wf.postMessage)&&!wf.importScripts&&rf&&"file:"!==rf.protocol&&!Pf($f)?(nf=$f,wf.addEventListener("message",Zf,!1)):nf=Yf in Lf("script")?function(e){Nf.appendChild(Lf("script")).onreadystatechange=function(){Nf.removeChild(this),Qf(e)}}:function(e){setTimeout(Jf(e),0)});var ep,tp,rp,np,ip,op,ap,sp,cp={set:Bf,clear:jf},up=n,dp=/ipad|iphone|ipod/i.test(se)&&void 0!==up.Pebble,lp=/web0s(?!.*chrome)/i.test(se),hp=n,fp=Yt,pp=R.f,vp=cp.set,_p=Rf,mp=dp,gp=lp,yp=sf,Sp=hp.MutationObserver||hp.WebKitMutationObserver,Ep=hp.document,bp=hp.process,kp=hp.Promise,Tp=pp(hp,"queueMicrotask"),Ip=Tp&&Tp.value;Ip||(ep=function(){var e,t;for(yp&&(e=bp.domain)&&e.exit();tp;){t=tp.fn,tp=tp.next;try{t()}catch(mW){throw tp?np():rp=void 0,mW}}rp=void 0,e&&e.enter()},_p||yp||gp||!Sp||!Ep?!mp&&kp&&kp.resolve?((ap=kp.resolve(void 0)).constructor=kp,sp=fp(ap.then,ap),np=function(){sp(ep)}):yp?np=function(){bp.nextTick(ep)}:(vp=fp(vp,hp),np=function(){vp(ep)}):(ip=!0,op=Ep.createTextNode(""),new Sp(ep).observe(op,{characterData:!0}),np=function(){op.data=ip=!ip}));var Ap=Ip||function(e){var t={fn:e,next:void 0};rp&&(rp.next=t),tp||(tp=t,np()),rp=t},Rp=n,wp=function(e){try{return{error:!1,value:e()}}catch(mW){return{error:!0,value:mW}}},Cp=function(){this.head=null,this.tail=null};Cp.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 Op=Cp,xp=n.Promise,Dp="object"==typeof Deno&&Deno&&"object"==typeof Deno.version,Pp=!Dp&&!sf&&"object"==typeof window&&"object"==typeof document,Np=n,Mp=xp,Lp=A,Up=Kt,Vp=io,Fp=lt,Bp=Pp,jp=Dp,Gp=pe,Hp=Mp&&Mp.prototype,zp=Fp("species"),Kp=!1,Xp=Lp(Np.PromiseRejectionEvent),qp={CONSTRUCTOR:Up("Promise",(function(){var e=Vp(Mp),t=e!==String(Mp);if(!t&&66===Gp)return!0;if(!Hp.catch||!Hp.finally)return!0;if(!Gp||Gp<51||!/native code/.test(e)){var r=new Mp((function(e){e(1)})),n=function(e){e((function(){}),(function(){}))};if((r.constructor={})[zp]=n,!(Kp=r.then((function(){}))instanceof n))return!0}return!t&&(Bp||jp)&&!Xp})),REJECTION_EVENT:Xp,SUBCLASSING:Kp},Wp={},Yp=Ce,Qp=TypeError,Jp=function(e){var t,r;this.promise=new e((function(e,n){if(void 0!==t||void 0!==r)throw Qp("Bad Promise constructor");t=e,r=n})),this.resolve=Yp(t),this.reject=Yp(r)};Wp.f=function(e){return new Jp(e)};var Zp,$p,ev=Rr,tv=sf,rv=n,nv=x,iv=li,ov=Mi,av=hf,sv=Ce,cv=A,uv=$,dv=vf,lv=Tf,hv=cp.set,fv=Ap,pv=function(e,t){var r=Rp.console;r&&r.error&&(1==arguments.length?r.error(e):r.error(e,t))},vv=wp,_v=Op,mv=Zi,gv=xp,yv=qp,Sv=Wp,Ev="Promise",bv=yv.CONSTRUCTOR,kv=yv.REJECTION_EVENT,Tv=mv.getterFor(Ev),Iv=mv.set,Av=gv&&gv.prototype,Rv=gv,wv=Av,Cv=rv.TypeError,Ov=rv.document,xv=rv.process,Dv=Sv.f,Pv=Dv,Nv=!!(Ov&&Ov.createEvent&&rv.dispatchEvent),Mv="unhandledrejection",Lv=function(e){var t;return!(!uv(e)||!cv(t=e.then))&&t},Uv=function(e,t){var r,n,i,o=t.value,a=1==t.state,s=a?e.ok:e.fail,c=e.resolve,u=e.reject,d=e.domain;try{s?(a||(2===t.rejection&&Gv(t),t.rejection=1),!0===s?r=o:(d&&d.enter(),r=s(o),d&&(d.exit(),i=!0)),r===e.promise?u(Cv("Promise-chain cycle")):(n=Lv(r))?nv(n,r,c,u):c(r)):u(o)}catch(mW){d&&!i&&d.exit(),u(mW)}},Vv=function(e,t){e.notified||(e.notified=!0,fv((function(){for(var r,n=e.reactions;r=n.get();)Uv(r,e);e.notified=!1,t&&!e.rejection&&Bv(e)})))},Fv=function(e,t,r){var n,i;Nv?((n=Ov.createEvent("Event")).promise=t,n.reason=r,n.initEvent(e,!1,!0),rv.dispatchEvent(n)):n={promise:t,reason:r},!kv&&(i=rv["on"+e])?i(n):e===Mv&&pv("Unhandled promise rejection",r)},Bv=function(e){nv(hv,rv,(function(){var t,r=e.facade,n=e.value;if(jv(e)&&(t=vv((function(){tv?xv.emit("unhandledRejection",n,r):Fv(Mv,r,n)})),e.rejection=tv||jv(e)?2:1,t.error))throw t.value}))},jv=function(e){return 1!==e.rejection&&!e.parent},Gv=function(e){nv(hv,rv,(function(){var t=e.facade;tv?xv.emit("rejectionHandled",t):Fv("rejectionhandled",t,e.value)}))},Hv=function(e,t,r){return function(n){e(t,n,r)}},zv=function(e,t,r){e.done||(e.done=!0,r&&(e=r),e.value=t,e.state=2,Vv(e,!0))},Kv=function(e,t,r){if(!e.done){e.done=!0,r&&(e=r);try{if(e.facade===t)throw Cv("Promise can't be resolved itself");var n=Lv(t);n?fv((function(){var r={done:!1};try{nv(n,t,Hv(Kv,r,e),Hv(zv,r,e))}catch(mW){zv(r,mW,e)}})):(e.value=t,e.state=1,Vv(e,!1))}catch(mW){zv({done:!1},mW,e)}}};bv&&(wv=(Rv=function(e){dv(this,wv),sv(e),nv(Zp,this);var t=Tv(this);try{e(Hv(Kv,t),Hv(zv,t))}catch(mW){zv(t,mW)}}).prototype,(Zp=function(e){Iv(this,{type:Ev,done:!1,notified:!1,parent:!1,reactions:new _v,rejection:!1,state:0,value:void 0})}).prototype=iv(wv,"then",(function(e,t){var r=Tv(this),n=Dv(lv(this,Rv));return r.parent=!0,n.ok=!cv(e)||e,n.fail=cv(t)&&t,n.domain=tv?xv.domain:void 0,0==r.state?r.reactions.add(n):fv((function(){Uv(n,r)})),n.promise})),$p=function(){var e=new Zp,t=Tv(e);this.promise=e,this.resolve=Hv(Kv,t),this.reject=Hv(zv,t)},Sv.f=Dv=function(e){return e===Rv||undefined===e?new $p(e):Pv(e)}),ev({global:!0,constructor:!0,wrap:!0,forced:bv},{Promise:Rv}),ov(Rv,Ev,!1,!0),av(Ev);var Xv=lt("iterator"),qv=!1;try{var Wv=0,Yv={next:function(){return{done:!!Wv++}},return:function(){qv=!0}};Yv[Xv]=function(){return this},Array.from(Yv,(function(){throw 2}))}catch(mW){}var Qv=function(e,t){if(!t&&!qv)return!1;var r=!1;try{var n={};n[Xv]=function(){return{next:function(){return{done:r=!0}}}},e(n)}catch(mW){}return r},Jv=xp,Zv=qp.CONSTRUCTOR||!Qv((function(e){Jv.all(e).then(void 0,(function(){}))})),$v=x,e_=Ce,t_=Wp,r_=wp,n_=Nh;Rr({target:"Promise",stat:!0,forced:Zv},{all:function(e){var t=this,r=t_.f(t),n=r.resolve,i=r.reject,o=r_((function(){var r=e_(t.resolve),o=[],a=0,s=1;n_(e,(function(e){var c=a++,u=!1;s++,$v(r,t,e).then((function(e){u||(u=!0,o[c]=e,--s||n(o))}),i)})),--s||n(o)}));return o.error&&i(o.value),r.promise}});var i_=Rr,o_=qp.CONSTRUCTOR;xp&&xp.prototype,i_({target:"Promise",proto:!0,forced:o_,real:!0},{catch:function(e){return this.then(void 0,e)}});var a_=x,s_=Ce,c_=Wp,u_=wp,d_=Nh;Rr({target:"Promise",stat:!0,forced:Zv},{race:function(e){var t=this,r=c_.f(t),n=r.reject,i=u_((function(){var i=s_(t.resolve);d_(e,(function(e){a_(i,t,e).then(r.resolve,n)}))}));return i.error&&n(i.value),r.promise}});var l_=x,h_=Wp;Rr({target:"Promise",stat:!0,forced:qp.CONSTRUCTOR},{reject:function(e){var t=h_.f(this);return l_(t.reject,void 0,e),t.promise}});var f_=tr,p_=$,v_=Wp,__=function(e,t){if(f_(e),p_(t)&&t.constructor===e)return t;var r=v_.f(e);return(0,r.resolve)(t),r.promise},m_=Rr,g_=xp,y_=qp.CONSTRUCTOR,S_=__,E_=oe("Promise"),b_=!y_;m_({target:"Promise",stat:!0,forced:true},{resolve:function(e){return S_(b_&&this===E_?g_:this,e)}});var k_=x,T_=Ce,I_=Wp,A_=wp,R_=Nh;Rr({target:"Promise",stat:!0},{allSettled:function(e){var t=this,r=I_.f(t),n=r.resolve,i=r.reject,o=A_((function(){var r=T_(t.resolve),i=[],o=0,a=1;R_(e,(function(e){var s=o++,c=!1;a++,k_(r,t,e).then((function(e){c||(c=!0,i[s]={status:"fulfilled",value:e},--a||n(i))}),(function(e){c||(c=!0,i[s]={status:"rejected",reason:e},--a||n(i))}))})),--a||n(i)}));return o.error&&i(o.value),r.promise}});var w_=x,C_=Ce,O_=oe,x_=Wp,D_=wp,P_=Nh,N_="No one promise resolved";Rr({target:"Promise",stat:!0},{any:function(e){var t=this,r=O_("AggregateError"),n=x_.f(t),i=n.resolve,o=n.reject,a=D_((function(){var n=C_(t.resolve),a=[],s=0,c=1,u=!1;P_(e,(function(e){var d=s++,l=!1;c++,w_(n,t,e).then((function(e){l||u||(u=!0,i(e))}),(function(e){l||u||(l=!0,a[d]=e,--c||o(new r(a,N_)))}))})),--c||o(new r(a,N_))}));return a.error&&o(a.value),n.promise}});var M_=Rr,L_=xp,U_=i,V_=oe,F_=A,B_=Tf,j_=__,G_=L_&&L_.prototype;M_({target:"Promise",proto:!0,real:!0,forced:!!L_&&U_((function(){G_.finally.call({then:function(){}},(function(){}))}))},{finally:function(e){var t=B_(this,V_("Promise")),r=F_(e);return this.then(r?function(r){return j_(t,e()).then((function(){return r}))}:e,r?function(r){return j_(t,e()).then((function(){throw r}))}:e)}});var H_=ee.Promise,z_=Wp,K_=wp;Rr({target:"Promise",stat:!0,forced:!0},{try:function(e){var t=z_.f(this),r=K_(e);return(r.error?t.reject:t.resolve)(r.value),t.promise}});var X_=H_,q_=Rr,W_=eo,Y_=b([].reverse),Q_=[1,2];q_({target:"Array",proto:!0,forced:String(Q_)===String(Q_.reverse())},{reverse:function(){return W_(this)&&(this.length=this.length),Y_(this)}});var J_=Us("Array").reverse,Z_=ae,$_=J_,em=Array.prototype,tm=function(e){var t=e.reverse;return e===em||Z_(em,e)&&t===em.reverse?$_:t},rm=Rr,nm=eo,im=yo,om=$,am=Mr,sm=Br,cm=Q,um=Jn,dm=lt,lm=rs,hm=Ns("slice"),fm=dm("species"),pm=Array,vm=Math.max;rm({target:"Array",proto:!0,forced:!hm},{slice:function(e,t){var r,n,i,o=cm(this),a=sm(o),s=am(e,a),c=am(void 0===t?a:t,a);if(nm(o)&&(r=o.constructor,(im(r)&&(r===pm||nm(r.prototype))||om(r)&&null===(r=r[fm]))&&(r=void 0),r===pm||void 0===r))return lm(o,s,c);for(n=new(void 0===r?pm:r)(vm(c-s,0)),i=0;s<c;s++,i++)s in o&&um(n,i,o[s]);return n.length=i,n}});var _m=Us("Array").slice,mm=ae,gm=_m,ym=Array.prototype,Sm=function(e){var t=e.slice;return e===ym||mm(ym,e)&&t===ym.slice?gm:t};function Em(){Em=function(){return e};var e={},t=Object.prototype,r=t.hasOwnProperty,n=ad||function(e,t,r){e[t]=r.value},i="function"==typeof _l?_l:{},o=i.iterator||"@@iterator",a=i.asyncIterator||"@@asyncIterator",s=i.toStringTag||"@@toStringTag";function c(e,t,r){return ad(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{c({},"")}catch(R){c=function(e,t,r){return e[t]=r}}function u(e,t,r,i){var o=t&&t.prototype instanceof h?t:h,a=Ul(o.prototype),s=new T(i||[]);return n(a,"_invoke",{value:S(e,r,s)}),a}function d(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(R){return{type:"throw",arg:R}}}e.wrap=u;var l={};function h(){}function f(){}function p(){}var v={};c(v,o,(function(){return this}));var _=jl&&jl(jl(I([])));_&&_!==t&&r.call(_,o)&&(v=_);var m=p.prototype=h.prototype=Ul(v);function g(e){var t;Mu(t=["next","throw","return"]).call(t,(function(t){c(e,t,(function(e){return this._invoke(t,e)}))}))}function y(e,t){function i(n,o,a,s){var c=d(e[n],e,o);if("throw"!==c.type){var u=c.arg,l=u.value;return l&&"object"==Ml(l)&&r.call(l,"__await")?t.resolve(l.__await).then((function(e){i("next",e,a,s)}),(function(e){i("throw",e,a,s)})):t.resolve(l).then((function(e){u.value=e,a(u)}),(function(e){return i("throw",e,a,s)}))}s(c.arg)}var o;n(this,"_invoke",{value:function(e,r){function n(){return new t((function(t,n){i(e,r,t,n)}))}return o=o?o.then(n,n):n()}})}function S(e,t,r){var n="suspendedStart";return function(i,o){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===i)throw o;return{value:void 0,done:!0}}for(r.method=i,r.arg=o;;){var a=r.delegate;if(a){var s=E(a,r);if(s){if(s===l)continue;return s}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var c=d(e,t,r);if("normal"===c.type){if(n=r.done?"completed":"suspendedYield",c.arg===l)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(n="completed",r.method="throw",r.arg=c.arg)}}}function E(e,t){var r=e.iterator[t.method];if(void 0===r){if(t.delegate=null,"throw"===t.method){if(e.iterator.return&&(t.method="return",t.arg=void 0,E(e,t),"throw"===t.method))return l;t.method="throw",t.arg=new TypeError("The iterator does not provide a 'throw' method")}return l}var n=d(r,e.iterator,t.arg);if("throw"===n.type)return t.method="throw",t.arg=n.arg,t.delegate=null,l;var i=n.arg;return i?i.done?(t[e.resultName]=i.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,l):i:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,l)}function b(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 k(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function T(e){this.tryEntries=[{tryLoc:"root"}],Mu(e).call(e,b,this),this.reset(!0)}function I(e){if(e){var t=e[o];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var n=-1,i=function t(){for(;++n<e.length;)if(r.call(e,n))return t.value=e[n],t.done=!1,t;return t.value=void 0,t.done=!0,t};return i.next=i}}return{next:A}}function A(){return{value:void 0,done:!0}}return f.prototype=p,n(m,"constructor",{value:p,configurable:!0}),n(p,"constructor",{value:f,configurable:!0}),f.displayName=c(p,s,"GeneratorFunction"),e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===f||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Gl?Gl(e,p):(e.__proto__=p,c(e,s,"GeneratorFunction")),e.prototype=Ul(m),e},e.awrap=function(e){return{__await:e}},g(y.prototype),c(y.prototype,a,(function(){return this})),e.AsyncIterator=y,e.async=function(t,r,n,i,o){void 0===o&&(o=X_);var a=new y(u(t,r,n,i),o);return e.isGeneratorFunction(r)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},g(m),c(m,s,"Generator"),c(m,o,(function(){return this})),c(m,"toString",(function(){return"[object Generator]"})),e.keys=function(e){var t=Object(e),r=[];for(var n in t)r.push(n);return tm(r).call(r),function e(){for(;r.length;){var n=r.pop();if(n in t)return e.value=n,e.done=!1,e}return e.done=!0,e}},e.values=I,T.prototype={constructor:T,reset:function(e){var t;if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,Mu(t=this.tryEntries).call(t,k),!e)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+Sm(n).call(n,1))&&(this[n]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function n(r,n){return a.type="throw",a.arg=e,t.next=r,n&&(t.method="next",t.arg=void 0),!!n}for(var i=this.tryEntries.length-1;i>=0;--i){var o=this.tryEntries[i],a=o.completion;if("root"===o.tryLoc)return n("end");if(o.tryLoc<=this.prev){var s=r.call(o,"catchLoc"),c=r.call(o,"finallyLoc");if(s&&c){if(this.prev<o.catchLoc)return n(o.catchLoc,!0);if(this.prev<o.finallyLoc)return n(o.finallyLoc)}else if(s){if(this.prev<o.catchLoc)return n(o.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return n(o.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&r.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var o=i;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var a=o?o.completion:{};return a.type=e,a.arg=t,o?(this.method="next",this.next=o.finallyLoc,l):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),l},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),k(r),l}},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;k(r)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,r){return this.delegate={iterator:I(e),resultName:t,nextLoc:r},"next"===this.method&&(this.arg=void 0),l}},e}function bm(e,t,r,n,i,o,a){try{var s=e[o](a),c=s.value}catch(mW){return void r(mW)}s.done?t(c):X_.resolve(c).then(n,i)}function km(e){return function(){var t=this,r=arguments;return new X_((function(n,i){var o=e.apply(t,r);function a(e){bm(o,n,i,a,s,"next",e)}function s(e){bm(o,n,i,a,s,"throw",e)}a(void 0)}))}}var Tm=Us("Array").concat,Im=ae,Am=Tm,Rm=Array.prototype,wm=function(e){var t=e.concat;return e===Rm||Im(Rm,e)&&t===Rm.concat?Am:t},Cm=Kr.includes;Rr({target:"Array",proto:!0,forced:i((function(){return!Array(1).includes()}))},{includes:function(e){return Cm(this,e,arguments.length>1?arguments[1]:void 0)}});var Om=Us("Array").includes,xm=$,Dm=y,Pm=lt("match"),Nm=function(e){var t;return xm(e)&&(void 0!==(t=e[Pm])?!!t:"RegExp"==Dm(e))},Mm=TypeError,Lm=function(e){if(Nm(e))throw Mm("The method doesn't accept regular expressions");return e},Um=lt("match"),Vm=function(e){var t=/./;try{"/./"[e](t)}catch(r){try{return t[Um]=!1,"/./"[e](t)}catch(mW){}}return!1},Fm=Rr,Bm=Lm,jm=q,Gm=gn,Hm=Vm,zm=b("".indexOf);Fm({target:"String",proto:!0,forced:!Hm("includes")},{includes:function(e){return!!~zm(Gm(jm(this)),Gm(Bm(e)),arguments.length>1?arguments[1]:void 0)}});var Km=Us("String").includes,Xm=ae,qm=Om,Wm=Km,Ym=Array.prototype,Qm=String.prototype,Jm=function(e){var t=e.includes;return e===Ym||Xm(Ym,e)&&t===Ym.includes?qm:"string"==typeof e||e===Qm||Xm(Qm,e)&&t===Qm.includes?Wm:t},Zm="\t\n\v\f\r                 \u2028\u2029\ufeff",$m=q,eg=gn,tg=b("".replace),rg="[\t\n\v\f\r                 \u2028\u2029\ufeff]",ng=RegExp("^"+rg+rg+"*"),ig=RegExp(rg+rg+"*$"),og=function(e){return function(t){var r=eg($m(t));return 1&e&&(r=tg(r,ng,"")),2&e&&(r=tg(r,ig,"")),r}},ag={start:og(1),end:og(2),trim:og(3)},sg=n,cg=i,ug=b,dg=gn,lg=ag.trim,hg=Zm,fg=sg.parseInt,pg=sg.Symbol,vg=pg&&pg.iterator,_g=/^[+-]?0x/i,mg=ug(_g.exec),gg=8!==fg(hg+"08")||22!==fg(hg+"0x16")||vg&&!cg((function(){fg(Object(vg))}))?function(e,t){var r=lg(dg(e));return fg(r,t>>>0||(mg(_g,r)?16:10))}:fg;Rr({global:!0,forced:parseInt!=gg},{parseInt:gg});var yg=ee.parseInt,Sg={exports:{}},Eg=i((function(){if("function"==typeof ArrayBuffer){var e=new ArrayBuffer(8);Object.isExtensible(e)&&Object.defineProperty(e,"a",{value:8})}})),bg=i,kg=$,Tg=y,Ig=Eg,Ag=Object.isExtensible,Rg=bg((function(){Ag(1)}))||Ig?function(e){return!!kg(e)&&((!Ig||"ArrayBuffer"!=Tg(e))&&(!Ag||Ag(e)))}:Ag,wg=!i((function(){return Object.isExtensible(Object.preventExtensions({}))})),Cg=Rr,Og=b,xg=Xr,Dg=$,Pg=Ye,Ng=Qt.f,Mg=zn,Lg=qn,Ug=Rg,Vg=wg,Fg=!1,Bg=et("meta"),jg=0,Gg=function(e){Ng(e,Bg,{value:{objectID:"O"+jg++,weakData:{}}})},Hg=Sg.exports={enable:function(){Hg.enable=function(){},Fg=!0;var e=Mg.f,t=Og([].splice),r={};r[Bg]=1,e(r).length&&(Mg.f=function(r){for(var n=e(r),i=0,o=n.length;i<o;i++)if(n[i]===Bg){t(n,i,1);break}return n},Cg({target:"Object",stat:!0,forced:!0},{getOwnPropertyNames:Lg.f}))},fastKey:function(e,t){if(!Dg(e))return"symbol"==typeof e?e:("string"==typeof e?"S":"P")+e;if(!Pg(e,Bg)){if(!Ug(e))return"F";if(!t)return"E";Gg(e)}return e[Bg].objectID},getWeakData:function(e,t){if(!Pg(e,Bg)){if(!Ug(e))return!0;if(!t)return!1;Gg(e)}return e[Bg].weakData},onFreeze:function(e){return Vg&&Fg&&Ug(e)&&!Pg(e,Bg)&&Gg(e),e}};xg[Bg]=!0;var zg=Rr,Kg=n,Xg=Sg.exports,qg=i,Wg=vr,Yg=Nh,Qg=vf,Jg=A,Zg=$,$g=Mi,ey=Qt.f,ty=No.forEach,ry=w,ny=Zi.set,iy=Zi.getterFor,oy=function(e,t,r){var n,i=-1!==e.indexOf("Map"),o=-1!==e.indexOf("Weak"),a=i?"set":"add",s=Kg[e],c=s&&s.prototype,u={};if(ry&&Jg(s)&&(o||c.forEach&&!qg((function(){(new s).entries().next()})))){var d=(n=t((function(t,r){ny(Qg(t,d),{type:e,collection:new s}),null!=r&&Yg(r,t[a],{that:t,AS_ENTRIES:i})}))).prototype,l=iy(e);ty(["add","clear","delete","forEach","get","has","set","keys","values","entries"],(function(e){var t="add"==e||"set"==e;!(e in c)||o&&"clear"==e||Wg(d,e,(function(r,n){var i=l(this).collection;if(!t&&o&&!Zg(r))return"get"==e&&void 0;var a=i[e](0===r?0:r,n);return t?this:a}))})),o||ey(d,"size",{configurable:!0,get:function(){return l(this).collection.size}})}else n=r.getConstructor(t,e,i,a),Xg.enable();return $g(n,e,!1,!0),u[e]=n,zg({global:!0,forced:!0},u),o||r.setStrong(n,e,i),n},ay=li,sy=function(e,t,r){for(var n in t)r&&r.unsafe&&e[n]?e[n]=t[n]:ay(e,n,t[n],r);return e},cy=Qt.f,uy=Hn,dy=sy,ly=Yt,hy=vf,fy=z,py=Nh,vy=iu,_y=ou,my=hf,gy=w,yy=Sg.exports.fastKey,Sy=Zi.set,Ey=Zi.getterFor,by={getConstructor:function(e,t,r,n){var i=e((function(e,i){hy(e,o),Sy(e,{type:t,index:uy(null),first:void 0,last:void 0,size:0}),gy||(e.size=0),fy(i)||py(i,e[n],{that:e,AS_ENTRIES:r})})),o=i.prototype,a=Ey(t),s=function(e,t,r){var n,i,o=a(e),s=c(e,t);return s?s.value=r:(o.last=s={index:i=yy(t,!0),key:t,value:r,previous:n=o.last,next:void 0,removed:!1},o.first||(o.first=s),n&&(n.next=s),gy?o.size++:e.size++,"F"!==i&&(o.index[i]=s)),e},c=function(e,t){var r,n=a(e),i=yy(t);if("F"!==i)return n.index[i];for(r=n.first;r;r=r.next)if(r.key==t)return r};return dy(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,gy?e.size=0:this.size=0},delete:function(e){var t=this,r=a(t),n=c(t,e);if(n){var i=n.next,o=n.previous;delete r.index[n.index],n.removed=!0,o&&(o.next=i),i&&(i.previous=o),r.first==n&&(r.first=i),r.last==n&&(r.last=o),gy?r.size--:t.size--}return!!n},forEach:function(e){for(var t,r=a(this),n=ly(e,arguments.length>1?arguments[1]:void 0);t=t?t.next:r.first;)for(n(t.value,t.key,this);t&&t.removed;)t=t.previous},has:function(e){return!!c(this,e)}}),dy(o,r?{get:function(e){var t=c(this,e);return t&&t.value},set:function(e,t){return s(this,0===e?0:e,t)}}:{add:function(e){return s(this,e=0===e?0:e,e)}}),gy&&cy(o,"size",{get:function(){return a(this).size}}),i},setStrong:function(e,t,r){var n=t+" Iterator",i=Ey(t),o=Ey(n);vy(e,t,(function(e,t){Sy(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)?_y("keys"==t?r.key:"values"==t?r.value:[r.key,r.value],!1):(e.target=void 0,_y(void 0,!0))}),r?"entries":"values",!r,!0),my(t)}};oy("Map",(function(e){return function(){return e(this,arguments.length?arguments[0]:void 0)}}),by);var ky=ee.Map,Ty=Yt,Iy=x,Ay=Ce,Ry=yf,wy=z,Cy=Nh,Oy=[].push,xy=function(e){var t,r,n,i,o=arguments.length,a=o>1?arguments[1]:void 0;return Ry(this),(t=void 0!==a)&&Ay(a),wy(e)?new this:(r=[],t?(n=0,i=Ty(a,o>2?arguments[2]:void 0),Cy(e,(function(e){Iy(Oy,r,i(e,n++))}))):Cy(e,Oy,{that:r}),new this(r))};Rr({target:"Map",stat:!0,forced:!0},{from:xy});var Dy=rs,Py=function(){return new this(Dy(arguments))};Rr({target:"Map",stat:!0,forced:!0},{of:Py});var Ny=x,My=Ce,Ly=tr,Uy=function(){for(var e,t=Ly(this),r=My(t.delete),n=!0,i=0,o=arguments.length;i<o;i++)e=Ny(r,t,arguments[i]),n=n&&e;return!!n};Rr({target:"Map",proto:!0,real:!0,forced:!0},{deleteAll:Uy});var Vy=x,Fy=Ce,By=tr,jy=function(e,t){var r,n,i=By(this),o=Fy(i.get),a=Fy(i.has),s=Fy(i.set);return Vy(a,i,e)?(r=Vy(o,i,e),"update"in t&&(r=t.update(r,e,i),Vy(s,i,e,r)),r):(n=t.insert(e,i),Vy(s,i,e,n),n)};Rr({target:"Map",proto:!0,real:!0,forced:!0},{emplace:jy});var Gy=_h,Hy=tr,zy=Yt,Ky=Gy,Xy=Nh;Rr({target:"Map",proto:!0,real:!0,forced:!0},{every:function(e){var t=Hy(this),r=Ky(t),n=zy(e,arguments.length>1?arguments[1]:void 0);return!Xy(r,(function(e,r,i){if(!n(r,e,t))return i()}),{AS_ENTRIES:!0,IS_ITERATOR:!0,INTERRUPTED:!0}).stopped}});var qy=oe,Wy=Yt,Yy=x,Qy=Ce,Jy=tr,Zy=Tf,$y=Gy,eS=Nh;Rr({target:"Map",proto:!0,real:!0,forced:!0},{filter:function(e){var t=Jy(this),r=$y(t),n=Wy(e,arguments.length>1?arguments[1]:void 0),i=new(Zy(t,qy("Map"))),o=Qy(i.set);return eS(r,(function(e,r){n(r,e,t)&&Yy(o,i,e,r)}),{AS_ENTRIES:!0,IS_ITERATOR:!0}),i}});var tS=tr,rS=Yt,nS=Gy,iS=Nh;Rr({target:"Map",proto:!0,real:!0,forced:!0},{find:function(e){var t=tS(this),r=nS(t),n=rS(e,arguments.length>1?arguments[1]:void 0);return iS(r,(function(e,r,i){if(n(r,e,t))return i(r)}),{AS_ENTRIES:!0,IS_ITERATOR:!0,INTERRUPTED:!0}).result}});var oS=tr,aS=Yt,sS=Gy,cS=Nh;Rr({target:"Map",proto:!0,real:!0,forced:!0},{findKey:function(e){var t=oS(this),r=sS(t),n=aS(e,arguments.length>1?arguments[1]:void 0);return cS(r,(function(e,r,i){if(n(r,e,t))return i(e)}),{AS_ENTRIES:!0,IS_ITERATOR:!0,INTERRUPTED:!0}).result}});var uS=Rr,dS=x,lS=Ce,hS=_h,fS=Nh,pS=b([].push);uS({target:"Map",stat:!0,forced:!0},{groupBy:function(e,t){lS(t);var r=hS(e),n=new this,i=lS(n.has),o=lS(n.get),a=lS(n.set);return fS(r,(function(e){var r=t(e);dS(i,n,r)?pS(dS(o,n,r),e):dS(a,n,r,[e])}),{IS_ITERATOR:!0}),n}});var vS=tr,_S=Gy,mS=function(e,t){return e===t||e!=e&&t!=t},gS=Nh;Rr({target:"Map",proto:!0,real:!0,forced:!0},{includes:function(e){return gS(_S(vS(this)),(function(t,r,n){if(mS(r,e))return n()}),{AS_ENTRIES:!0,IS_ITERATOR:!0,INTERRUPTED:!0}).stopped}});var yS=x,SS=Nh,ES=Ce;Rr({target:"Map",stat:!0,forced:!0},{keyBy:function(e,t){var r=new this;ES(t);var n=ES(r.set);return SS(e,(function(e){yS(n,r,t(e),e)})),r}});var bS=tr,kS=Gy,TS=Nh;Rr({target:"Map",proto:!0,real:!0,forced:!0},{keyOf:function(e){return TS(kS(bS(this)),(function(t,r,n){if(r===e)return n(t)}),{AS_ENTRIES:!0,IS_ITERATOR:!0,INTERRUPTED:!0}).result}});var IS=oe,AS=Yt,RS=x,wS=Ce,CS=tr,OS=Tf,xS=Gy,DS=Nh;Rr({target:"Map",proto:!0,real:!0,forced:!0},{mapKeys:function(e){var t=CS(this),r=xS(t),n=AS(e,arguments.length>1?arguments[1]:void 0),i=new(OS(t,IS("Map"))),o=wS(i.set);return DS(r,(function(e,r){RS(o,i,n(r,e,t),r)}),{AS_ENTRIES:!0,IS_ITERATOR:!0}),i}});var PS=oe,NS=Yt,MS=x,LS=Ce,US=tr,VS=Tf,FS=Gy,BS=Nh;Rr({target:"Map",proto:!0,real:!0,forced:!0},{mapValues:function(e){var t=US(this),r=FS(t),n=NS(e,arguments.length>1?arguments[1]:void 0),i=new(VS(t,PS("Map"))),o=LS(i.set);return BS(r,(function(e,r){MS(o,i,e,n(r,e,t))}),{AS_ENTRIES:!0,IS_ITERATOR:!0}),i}});var jS=Ce,GS=tr,HS=Nh;Rr({target:"Map",proto:!0,real:!0,arity:1,forced:!0},{merge:function(e){for(var t=GS(this),r=jS(t.set),n=arguments.length,i=0;i<n;)HS(arguments[i++],r,{that:t,AS_ENTRIES:!0});return t}});var zS=tr,KS=Ce,XS=Gy,qS=Nh,WS=TypeError;Rr({target:"Map",proto:!0,real:!0,forced:!0},{reduce:function(e){var t=zS(this),r=XS(t),n=arguments.length<2,i=n?void 0:arguments[1];if(KS(e),qS(r,(function(r,o){n?(n=!1,i=o):i=e(i,o,r,t)}),{AS_ENTRIES:!0,IS_ITERATOR:!0}),n)throw WS("Reduce of empty map with no initial value");return i}});var YS=tr,QS=Yt,JS=Gy,ZS=Nh;Rr({target:"Map",proto:!0,real:!0,forced:!0},{some:function(e){var t=YS(this),r=JS(t),n=QS(e,arguments.length>1?arguments[1]:void 0);return ZS(r,(function(e,r,i){if(n(r,e,t))return i()}),{AS_ENTRIES:!0,IS_ITERATOR:!0,INTERRUPTED:!0}).stopped}});var $S=x,eE=tr,tE=Ce,rE=TypeError;Rr({target:"Map",proto:!0,real:!0,forced:!0},{update:function(e,t){var r=eE(this),n=tE(r.get),i=tE(r.has),o=tE(r.set),a=arguments.length;tE(t);var s=$S(i,r,e);if(!s&&a<3)throw rE("Updating absent value");var c=s?$S(n,r,e):tE(a>2?arguments[2]:void 0)(e,r);return $S(o,r,e,t(c,e,r)),r}});var nE=x,iE=Ce,oE=A,aE=tr,sE=TypeError,cE=function(e,t){var r,n=aE(this),i=iE(n.get),o=iE(n.has),a=iE(n.set),s=arguments.length>2?arguments[2]:void 0;if(!oE(t)&&!oE(s))throw sE("At least one callback required");return nE(o,n,e)?(r=nE(i,n,e),oE(t)&&(r=t(r),nE(a,n,e,r))):oE(s)&&(r=s(),nE(a,n,e,r)),r};Rr({target:"Map",proto:!0,real:!0,forced:!0},{upsert:cE}),Rr({target:"Map",proto:!0,real:!0,name:"upsert",forced:!0},{updateOrInsert:cE});var uE=ky,dE=Ce,lE=Xe,hE=H,fE=Br,pE=TypeError,vE=function(e){return function(t,r,n,i){dE(r);var o=lE(t),a=hE(o),s=fE(o),c=e?s-1:0,u=e?-1:1;if(n<2)for(;;){if(c in a){i=a[c],c+=u;break}if(c+=u,e?c<0:s<=c)throw pE("Reduce of empty array with no initial value")}for(;e?c>=0:s>c;c+=u)c in a&&(i=r(i,a[c],c,o));return i}},_E={left:vE(!1),right:vE(!0)},mE=_E.left,gE=pe,yE=sf;Rr({target:"Array",proto:!0,forced:!Iu("reduce")||!yE&&gE>79&&gE<83},{reduce:function(e){var t=arguments.length;return mE(this,e,t,t>1?arguments[1]:void 0)}});var SE=Us("Array").reduce,EE=ae,bE=SE,kE=Array.prototype,TE=function(e){var t=e.reduce;return e===kE||EE(kE,e)&&t===kE.reduce?bE:t},IE=w,AE=b,RE=x,wE=i,CE=rn,OE=ui,xE=D,DE=Xe,PE=H,NE=Object.assign,ME=Object.defineProperty,LE=AE([].concat),UE=!NE||wE((function(){if(IE&&1!==NE({b:1},NE(ME({},"a",{enumerable:!0,get:function(){ME(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!=NE({},e)[r]||CE(NE({},t)).join("")!=n}))?function(e,t){for(var r=DE(e),n=arguments.length,i=1,o=OE.f,a=xE.f;n>i;)for(var s,c=PE(arguments[i++]),u=o?LE(CE(c),o(c)):CE(c),d=u.length,l=0;d>l;)s=u[l++],IE&&!RE(a,c,s)||(r[s]=c[s]);return r}:NE,VE=UE;Rr({target:"Object",stat:!0,arity:2,forced:Object.assign!==VE},{assign:VE});var FE=ee.Object.assign,BE=Rr,jE=b;R.f;var GE=Vr,HE=gn,zE=Lm,KE=q,XE=Vm,qE=jE("".endsWith),WE=jE("".slice),YE=Math.min;BE({target:"String",proto:!0,forced:!XE("endsWith")},{endsWith:function(e){var t=HE(KE(this));zE(e);var r=arguments.length>1?arguments[1]:void 0,n=t.length,i=void 0===r?n:YE(GE(r),n),o=HE(e);return qE?qE(t,o,i):WE(t,i-o.length,i)===o}});var QE=Us("String").endsWith,JE=ae,ZE=QE,$E=String.prototype,eb=function(e){var t=e.endsWith;return"string"==typeof e||e===$E||JE($E,e)&&t===$E.endsWith?ZE:t},tb=!0,rb=!0;function nb(e,t,r){var n=e.match(t);return n&&n.length>=r&&yg(n[r],10)}function ib(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 uE),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===an(this._eventMap).length&&delete this._eventMap,o.apply(this,[e,n])},ad(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 ob(e){return"boolean"!=typeof e?new Error("Argument type: "+Ml(e)+". Please use a boolean."):(tb=e,e?"adapter.js logging disabled":"adapter.js logging enabled")}function ab(e){return"boolean"!=typeof e?new Error("Argument type: "+Ml(e)+". Please use a boolean."):(rb=!e,"adapter.js deprecation warnings "+(e?"disabled":"enabled"))}function sb(){if("object"===("undefined"==typeof window?"undefined":Ml(window))){if(tb)return;"undefined"!=typeof console&&"function"==typeof console.log&&console.log.apply(console,arguments)}}function cb(e,t){rb&&console.warn(e+" is deprecated, please use "+t+" instead.")}function ub(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=nb(r.userAgent,/Firefox\/(\d+)\./,1);else if(r.webkitGetUserMedia||!1===e.isSecureContext&&e.webkitRTCPeerConnection)t.browser="chrome",t.version=nb(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=nb(r.userAgent,/AppleWebKit\/(\d+)\./,1),t.supportsUnifiedPlan=e.RTCRtpTransceiver&&"currentDirection"in e.RTCRtpTransceiver.prototype}return t}function db(e){return"[object Object]"===Object.prototype.toString.call(e)}function lb(e){var t;return db(e)?TE(t=an(e)).call(t,(function(t,r){var n=db(e[r]),i=n?lb(e[r]):e[r],o=n&&!an(i).length;return void 0===i||o?t:FE(t,sd({},r,i))}),{}):e}function hb(e,t,r){t&&!r.has(t.id)&&(r.set(t.id,t),an(t).forEach((function(n){eb(n).call(n,"Id")?hb(e,e.get(t[n]),r):eb(n).call(n,"Ids")&&t[n].forEach((function(t){hb(e,e.get(t),r)}))})))}function fb(e,t,r){var n=r?"outbound-rtp":"inbound-rtp",i=new uE;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&&hb(e,r,i)}))})),i}var pb=Rr,vb=No.find,_b="find",mb=!0;_b in[]&&Array(1).find((function(){mb=!1})),pb({target:"Array",proto:!0,forced:mb},{find:function(e){return vb(this,e,arguments.length>1?arguments[1]:void 0)}});var gb=Us("Array").find,yb=ae,Sb=gb,Eb=Array.prototype,bb=function(e){var t=e.find;return e===Eb||yb(Eb,e)&&t===Eb.find?Sb:t},kb=Rr,Tb=Kr.indexOf,Ib=Iu,Ab=b([].indexOf),Rb=!!Ab&&1/Ab([1],1,-0)<0,wb=Ib("indexOf");kb({target:"Array",proto:!0,forced:Rb||!wb},{indexOf:function(e){var t=arguments.length>1?arguments[1]:void 0;return Rb?Ab(this,e,t)||0:Tb(this,e,t)}});var Cb=Us("Array").indexOf,Ob=ae,xb=Cb,Db=Array.prototype,Pb=function(e){var t=e.indexOf;return e===Db||Ob(Db,e)&&t===Db.indexOf?xb:t},Nb=w,Mb=eo,Lb=TypeError,Ub=Object.getOwnPropertyDescriptor,Vb=Nb&&!function(){if(void 0!==this)return!0;try{Object.defineProperty([],"length",{writable:!1}).length=1}catch(mW){return mW instanceof TypeError}}(),Fb=Ie,Bb=TypeError,jb=function(e,t){if(!delete e[t])throw Bb("Cannot delete property "+Fb(t)+" of "+Fb(e))},Gb=Rr,Hb=Xe,zb=Mr,Kb=xr,Xb=Br,qb=Vb?function(e,t){if(Mb(e)&&!Ub(e,"length").writable)throw Lb("Cannot set read only .length");return e.length=t}:function(e,t){return e.length=t},Wb=Qd,Yb=Ao,Qb=Jn,Jb=jb,Zb=Ns("splice"),$b=Math.max,ek=Math.min;Gb({target:"Array",proto:!0,forced:!Zb},{splice:function(e,t){var r,n,i,o,a,s,c=Hb(this),u=Xb(c),d=zb(e,u),l=arguments.length;for(0===l?r=n=0:1===l?(r=0,n=u-d):(r=l-2,n=ek($b(Kb(t),0),u-d)),Wb(u+r-n),i=Yb(c,n),o=0;o<n;o++)(a=d+o)in c&&Qb(i,o,c[a]);if(i.length=n,r<n){for(o=d;o<u-n;o++)s=o+r,(a=o+n)in c?c[s]=c[a]:Jb(c,s);for(o=u;o>u-n+r;o--)Jb(c,o-1)}else if(r>n)for(o=u-n;o>d;o--)s=o+r-1,(a=o+n-1)in c?c[s]=c[a]:Jb(c,s);for(o=0;o<r;o++)c[o+d]=arguments[o+2];return qb(c,u-n+r),i}});var tk=Us("Array").splice,rk=ae,nk=tk,ik=Array.prototype,ok=function(e){var t=e.splice;return e===ik||rk(ik,e)&&t===ik.splice?nk:t},ak=No.map;Rr({target:"Array",proto:!0,forced:!Ns("map")},{map:function(e){return ak(this,e,arguments.length>1?arguments[1]:void 0)}});var sk=Us("Array").map,ck=ae,uk=sk,dk=Array.prototype,lk=function(e){var t=e.map;return e===dk||ck(dk,e)&&t===dk.map?uk:t},hk=ee,fk=d;hk.JSON||(hk.JSON={stringify:JSON.stringify});var pk=function(e,t,r){return fk(hk.JSON.stringify,null,arguments)},vk=pk,_k=sb;function mk(e,t){var r=e&&e.navigator;if(r.mediaDevices){var n=function(e){if("object"!==Ml(e)||e.mandatory||e.optional)return e;var t,r={};(an(e).forEach((function(t){if("require"!==t&&"advanced"!==t&&"mediaSource"!==t){var n="object"===Ml(e[t])?e[t]:{ideal:e[t]};void 0!==n.exact&&"number"==typeof n.exact&&(n.min=n.max=n.exact);var i=function(e,t){return e?e+t.charAt(0).toUpperCase()+Sm(t).call(t,1):"deviceId"===t?"sourceId":t};if(void 0!==n.ideal){r.optional=r.optional||[];var o={};"number"==typeof n.ideal?(o[i("min",t)]=n.ideal,r.optional.push(o),(o={})[i("max",t)]=n.ideal,r.optional.push(o)):(o[i("",t)]=n.ideal,r.optional.push(o))}void 0!==n.exact&&"number"!=typeof n.exact?(r.mandatory=r.mandatory||{},r.mandatory[i("",t)]=n.exact):["min","max"].forEach((function(e){void 0!==n[e]&&(r.mandatory=r.mandatory||{},r.mandatory[i(e,t)]=n[e])}))}})),e.advanced)&&(r.optional=wm(t=r.optional||[]).call(t,e.advanced));return r},i=function(e,i){if(t.version>=61)return i(e);if((e=JSON.parse(vk(e)))&&"object"===Ml(e.audio)){var o=function(e,t,r){t in e&&!(r in e)&&(e[r]=e[t],delete e[t])};o((e=JSON.parse(vk(e))).audio,"autoGainControl","googAutoGainControl"),o(e.audio,"noiseSuppression","googNoiseSuppression"),e.audio=n(e.audio)}if(e&&"object"===Ml(e.video)){var a=e.video.facingMode;a=a&&("object"===Ml(a)?a:{ideal:a});var s,c=t.version<66;if(a&&("user"===a.exact||"environment"===a.exact||"user"===a.ideal||"environment"===a.ideal)&&(!r.mediaDevices.getSupportedConstraints||!r.mediaDevices.getSupportedConstraints().facingMode||c))if(delete e.video.facingMode,"environment"===a.exact||"environment"===a.ideal?s=["back","rear"]:"user"!==a.exact&&"user"!==a.ideal||(s=["front"]),s)return r.mediaDevices.enumerateDevices().then((function(t){t=Gs(t).call(t,(function(e){return"videoinput"===e.kind}));var r=bb(t).call(t,(function(e){return s.some((function(t){var r;return Jm(r=e.label.toLowerCase()).call(r,t)}))}));return!r&&t.length&&Jm(s).call(s,"back")&&(r=t[t.length-1]),r&&(e.video.deviceId=a.exact?{exact:r.deviceId}:{ideal:r.deviceId}),e.video=n(e.video),_k("chrome: "+vk(e)),i(e)}));e.video=n(e.video)}return _k("chrome: "+vk(e)),i(e)},o=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){i(e,(function(e){r.webkitGetUserMedia(e,t,(function(e){n&&n(o(e))}))}))}.bind(r),r.mediaDevices.getUserMedia){var a=r.mediaDevices.getUserMedia.bind(r.mediaDevices);r.mediaDevices.getUserMedia=function(e){return i(e,(function(e){return a(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 X_.reject(o(e))}))}))}}}}function gk(e){e.MediaStream=e.MediaStream||e.webkitMediaStream}function yk(e){if("object"===Ml(e)&&e.RTCPeerConnection&&!("ontrack"in e.RTCPeerConnection.prototype)){ad(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,o;e.RTCPeerConnection.prototype.getReceivers?i=bb(o=r.getReceivers()).call(o,(function(e){return e.track&&e.track.id===n.track.id})):i={track:n.track};var a=new Event("track");a.track=n.track,a.receiver=i,a.transceiver={receiver:i},a.streams=[t.stream],r.dispatchEvent(a)})),t.stream.getTracks().forEach((function(n){var i,o;e.RTCPeerConnection.prototype.getReceivers?i=bb(o=r.getReceivers()).call(o,(function(e){return e.track&&e.track.id===n.id})):i={track:n};var a=new Event("track");a.track=n,a.receiver=i,a.transceiver={receiver:i},a.streams=[t.stream],r.dispatchEvent(a)}))},this.addEventListener("addstream",this._ontrackpoly)),t.apply(this,arguments)}}else ib(e,"track",(function(e){return e.transceiver||ad(e,"transceiver",{value:{receiver:e.receiver}}),e}))}function Sk(e){if("object"===Ml(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(){var e;return this._senders=this._senders||[],Sm(e=this._senders).call(e)};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 n=e.RTCPeerConnection.prototype.removeTrack;e.RTCPeerConnection.prototype.removeTrack=function(e){var t;n.apply(this,arguments);var r,i=Pb(t=this._senders).call(t,e);-1!==i&&ok(r=this._senders).call(r,i,1)}}var i=e.RTCPeerConnection.prototype.addStream;e.RTCPeerConnection.prototype.addStream=function(e){var r=this;this._senders=this._senders||[],i.apply(this,[e]),e.getTracks().forEach((function(e){r._senders.push(t(r,e))}))};var o=e.RTCPeerConnection.prototype.removeStream;e.RTCPeerConnection.prototype.removeStream=function(e){var t=this;this._senders=this._senders||[],o.apply(this,[e]),e.getTracks().forEach((function(e){var r,n,i,o=bb(r=t._senders).call(r,(function(t){return t.track===e}));o&&ok(n=t._senders).call(n,Pb(i=t._senders).call(i,o),1)}))}}else if("object"===Ml(e)&&e.RTCPeerConnection&&"getSenders"in e.RTCPeerConnection.prototype&&"createDTMFSender"in e.RTCPeerConnection.prototype&&e.RTCRtpSender&&!("dtmf"in e.RTCRtpSender.prototype)){var a=e.RTCPeerConnection.prototype.getSenders;e.RTCPeerConnection.prototype.getSenders=function(){var e=this,t=a.apply(this,[]);return t.forEach((function(t){return t._pc=e})),t},ad(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 Ek(e){if(e.RTCPeerConnection){var t=e.RTCPeerConnection.prototype.getStats;e.RTCPeerConnection.prototype.getStats=function(){var e=this,r=Sm(Array.prototype).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){var t;return new uE(lk(t=an(e)).call(t,(function(t){return[t,e[t]]})))};if(arguments.length>=2){var c=function(e){i(s(a(e)))};return t.apply(this,[c,n])}return new X_((function(r,n){t.apply(e,[function(e){r(s(a(e)))},n])})).then(i,o)}}}function bk(e){if("object"===Ml(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 fb(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}),ib(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 fb(t,e.track,!1)}))}}if("getStats"in e.RTCRtpSender.prototype&&"getStats"in e.RTCRtpReceiver.prototype){var i=e.RTCPeerConnection.prototype.getStats;e.RTCPeerConnection.prototype.getStats=function(){if(arguments.length>0&&arguments[0]instanceof e.MediaStreamTrack){var t,r,n,o=arguments[0];return this.getSenders().forEach((function(e){e.track===o&&(t?n=!0:t=e)})),this.getReceivers().forEach((function(e){return e.track===o&&(r?n=!0:r=e),e.track===o})),n||t&&r?X_.reject(new DOMException("There are more than one sender or receiver for the track.","InvalidAccessError")):t?t.getStats():r?r.getStats():X_.reject(new DOMException("There is no sender or receiver for the track.","InvalidAccessError"))}return i.apply(this,arguments)}}}}function kk(e){e.RTCPeerConnection.prototype.getLocalStreams=function(){var e,t=this;return this._shimmedLocalStreams=this._shimmedLocalStreams||{},lk(e=an(this._shimmedLocalStreams)).call(e,(function(e){return t._shimmedLocalStreams[e][0]}))};var t=e.RTCPeerConnection.prototype.addTrack;e.RTCPeerConnection.prototype.addTrack=function(e,r){var n;if(!r)return t.apply(this,arguments);this._shimmedLocalStreams=this._shimmedLocalStreams||{};var i=t.apply(this,arguments);return this._shimmedLocalStreams[r.id]?-1===Pb(n=this._shimmedLocalStreams[r.id]).call(n,i)&&this._shimmedLocalStreams[r.id].push(i):this._shimmedLocalStreams[r.id]=[r,i],i};var r=e.RTCPeerConnection.prototype.addStream;e.RTCPeerConnection.prototype.addStream=function(e){var t,n,i=this;this._shimmedLocalStreams=this._shimmedLocalStreams||{},e.getTracks().forEach((function(e){var t;if(bb(t=i.getSenders()).call(t,(function(t){return t.track===e})))throw new DOMException("Track already exists.","InvalidAccessError")}));var o=this.getSenders();r.apply(this,arguments);var a=Gs(t=this.getSenders()).call(t,(function(e){return-1===Pb(o).call(o,e)}));this._shimmedLocalStreams[e.id]=wm(n=[e]).call(n,a)};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&&an(this._shimmedLocalStreams).forEach((function(r){var n,i,o=Pb(n=t._shimmedLocalStreams[r]).call(n,e);-1!==o&&ok(i=t._shimmedLocalStreams[r]).call(i,o,1);1===t._shimmedLocalStreams[r].length&&delete t._shimmedLocalStreams[r]})),i.apply(this,arguments)}}function Tk(e,t){if(e.RTCPeerConnection){if(e.RTCPeerConnection.prototype.addTrack&&t.version>=65)return kk(e);var r=e.RTCPeerConnection.prototype.getLocalStreams;e.RTCPeerConnection.prototype.getLocalStreams=function(){var e=this,t=r.apply(this);return this._reverseStreams=this._reverseStreams||{},lk(t).call(t,(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){var t;if(bb(t=r.getSenders()).call(t,(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,i,o,a=this;if("closed"===this.signalingState)throw new DOMException("The RTCPeerConnection's signalingState is 'closed'.","InvalidStateError");var s=Sm([]).call(arguments,1);if(1!==s.length||!bb(n=s[0].getTracks()).call(n,(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 c=bb(i=this.getSenders()).call(i,(function(e){return e.track===t}));if(c)throw new DOMException("Track already exists.","InvalidAccessError");this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{};var u=this._streams[r.id];if(u)u.addTrack(t),X_.resolve().then((function(){a.dispatchEvent(new Event("negotiationneeded"))}));else{var d=new e.MediaStream([t]);this._streams[r.id]=d,this._reverseStreams[d.id]=r,this.addStream(d)}return bb(o=this.getSenders()).call(o,(function(e){return e.track===t}))},["createOffer","createAnswer"].forEach((function(t){var r=e.RTCPeerConnection.prototype[t],n=sd({},t,(function(){var e=this,t=arguments,n=arguments.length&&"function"==typeof arguments[0];return n?r.apply(this,[function(r){var n=s(e,r);t[0].apply(null,[n])},function(e){t[1]&&t[1].apply(null,e)},arguments[2]]):r.apply(this,arguments).then((function(t){return s(e,t)}))}));e.RTCPeerConnection.prototype[t]=n[t]}));var o=e.RTCPeerConnection.prototype.setLocalDescription;e.RTCPeerConnection.prototype.setLocalDescription=function(){return arguments.length&&arguments[0].type?(arguments[0]=c(this,arguments[0]),o.apply(this,arguments)):o.apply(this,arguments)};var a=tc(e.RTCPeerConnection.prototype,"localDescription");ad(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||{},an(this._streams).forEach((function(n){var i;bb(i=r._streams[n].getTracks()).call(i,(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 an(e._reverseStreams||[]).forEach((function(t){var n=e._reverseStreams[t],i=e._streams[n.id];r=r.replace(new RegExp(i.id,"g"),n.id)})),new RTCSessionDescription({type:t.type,sdp:r})}function c(e,t){var r=t.sdp;return an(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 Ik(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=sd({},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 Ak(e,t){ib(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 Rk=Object.freeze(Object.defineProperty({__proto__:null,shimMediaStream:gk,shimOnTrack:yk,shimGetSendersWithDtmf:Sk,shimGetStats:Ek,shimSenderReceiverGetStats:bk,shimAddTrackRemoveTrackWithNative:kk,shimAddTrackRemoveTrack:Tk,shimPeerConnection:Ik,fixNegotiationNeeded:Ak,shimGetUserMedia:mk,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"}));Rr({target:"Array",stat:!0},{isArray:eo});var wk=ee.Array.isArray;function Ck(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}var Ok=uh,xk=tr,Dk=Sh,Pk=Yt,Nk=x,Mk=Xe,Lk=function(e,t,r,n){try{return n?t(xk(r)[0],r[1]):t(r)}catch(mW){Dk(e,"throw",mW)}},Uk=nh,Vk=yo,Fk=Br,Bk=Jn,jk=_h,Gk=uh,Hk=Array,zk=function(e){var t=Mk(e),r=Vk(this),n=arguments.length,i=n>1?arguments[1]:void 0,o=void 0!==i;o&&(i=Pk(i,n>2?arguments[2]:void 0));var a,s,c,u,d,l,h=Gk(t),f=0;if(!h||this===Hk&&Uk(h))for(a=Fk(t),s=r?new this(a):Hk(a);a>f;f++)l=o?i(t[f],f):t[f],Bk(s,f,l);else for(d=(u=jk(t,h)).next,s=r?new this:[];!(c=Nk(d,u)).done;f++)l=o?Lk(u,i,[c.value,f],!0):c.value,Bk(s,f,l);return s.length=f,s},Kk=zk;Rr({target:"Array",stat:!0,forced:!Qv((function(e){Array.from(e)}))},{from:Kk});var Xk=ee.Array.from;function qk(e,t){var r;if(e){if("string"==typeof e)return Ck(e,t);var n=Sm(r=Object.prototype.toString.call(e)).call(r,8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Xk(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Ck(e,t):void 0}}function Wk(e){return function(e){if(wk(e))return Ck(e)}(e)||function(e){if(void 0!==_l&&null!=Ok(e)||null!=e["@@iterator"])return Xk(e)}(e)||qk(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.")}()}var Yk=n,Qk=i,Jk=gn,Zk=ag.trim,$k=b("".charAt),eT=Yk.parseFloat,tT=Yk.Symbol,rT=tT&&tT.iterator,nT=1/eT("\t\n\v\f\r                 \u2028\u2029\ufeff-0")!=-1/0||rT&&!Qk((function(){eT(Object(rT))}))?function(e){var t=Zk(Jk(e)),r=eT(t);return 0===r&&"-"==$k(t,0)?-0:r}:eT;Rr({global:!0,forced:parseFloat!=nT},{parseFloat:nT});var iT=ee.parseFloat;function oT(e,t){var r=e&&e.navigator,n=e&&e.MediaStreamTrack;if(r.getUserMedia=function(e,t,n){cb("navigator.getUserMedia","navigator.mediaDevices.getUserMedia"),r.mediaDevices.getUserMedia(e).then(t,n)},!(t.version>55&&"autoGainControl"in r.mediaDevices.getSupportedConstraints())){var i=function(e,t,r){t in e&&!(r in e)&&(e[r]=e[t],delete e[t])},o=r.mediaDevices.getUserMedia.bind(r.mediaDevices);if(r.mediaDevices.getUserMedia=function(e){return"object"===Ml(e)&&"object"===Ml(e.audio)&&(e=JSON.parse(vk(e)),i(e.audio,"autoGainControl","mozAutoGainControl"),i(e.audio,"noiseSuppression","mozNoiseSuppression")),o(e)},n&&n.prototype.getSettings){var a=n.prototype.getSettings;n.prototype.getSettings=function(){var e=a.apply(this,arguments);return i(e,"mozAutoGainControl","autoGainControl"),i(e,"mozNoiseSuppression","noiseSuppression"),e}}if(n&&n.prototype.applyConstraints){var s=n.prototype.applyConstraints;n.prototype.applyConstraints=function(e){return"audio"===this.kind&&"object"===Ml(e)&&(e=JSON.parse(vk(e)),i(e,"autoGainControl","mozAutoGainControl"),i(e,"noiseSuppression","mozNoiseSuppression")),s.apply(this,[e])}}}}function aT(e){"object"===Ml(e)&&e.RTCTrackEvent&&"receiver"in e.RTCTrackEvent.prototype&&!("transceiver"in e.RTCTrackEvent.prototype)&&ad(e.RTCTrackEvent.prototype,"transceiver",{get:function(){return{receiver:this.receiver}}})}function sT(e,t){if("object"===Ml(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=sd({},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"},n=e.RTCPeerConnection.prototype.getStats;e.RTCPeerConnection.prototype.getStats=function(){var e=Sm(Array.prototype).call(arguments),i=e[0],o=e[1],a=e[2];return n.apply(this,[i||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,FE({},t,{type:r[t.type]||t.type}))}))}return e})).then(o,a)}}}function cT(e){if("object"===Ml(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):X_.resolve(new uE)}}}function uT(e){if("object"===Ml(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}),ib(e,"track",(function(e){return e.receiver._pc=e.srcElement,e})),e.RTCRtpReceiver.prototype.getStats=function(){return this._pc.getStats(this.track)}}}function dT(e){e.RTCPeerConnection&&!("removeStream"in e.RTCPeerConnection.prototype)&&(e.RTCPeerConnection.prototype.removeStream=function(e){var t=this;cb("removeStream","removeTrack"),this.getSenders().forEach((function(r){var n;r.track&&Jm(n=e.getTracks()).call(n,r.track)&&t.removeTrack(r)}))})}function lT(e){e.DataChannel&&!e.RTCDataChannel&&(e.RTCDataChannel=e.DataChannel)}function hT(e){if("object"===Ml(e)&&e.RTCPeerConnection){var t=e.RTCPeerConnection.prototype.addTransceiver;t&&(e.RTCPeerConnection.prototype.addTransceiver=function(){this.setParametersPromises=[];var e=arguments[1]&&arguments[1].sendEncodings;void 0===e&&(e=[]);var r=(e=Wk(e)).length>0;r&&e.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&&!(iT(e.scaleResolutionDownBy)>=1))throw new RangeError("scale_resolution_down_by must be >= 1.0");if("maxFramerate"in e&&!(iT(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===an(o.encodings[0]).length)&&(o.encodings=e,i.sendEncodings=e,this.setParametersPromises.push(i.setParameters(o).then((function(){delete i.sendEncodings})).catch((function(){delete i.sendEncodings}))))}return n})}}function fT(e){if("object"===Ml(e)&&e.RTCRtpSender){var t=e.RTCRtpSender.prototype.getParameters;t&&(e.RTCRtpSender.prototype.getParameters=function(){var e,r=t.apply(this,arguments);"encodings"in r||(r.encodings=wm(e=[]).call(e,this.sendEncodings||[{}]));return r})}}function pT(e){if("object"===Ml(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?X_.all(this.setParametersPromises).then((function(){return t.apply(r,e)})).finally((function(){r.setParametersPromises=[]})):t.apply(this,arguments)}}}function vT(e){if("object"===Ml(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?X_.all(this.setParametersPromises).then((function(){return t.apply(r,e)})).finally((function(){r.setParametersPromises=[]})):t.apply(this,arguments)}}}var _T=Object.freeze(Object.defineProperty({__proto__:null,shimOnTrack:aT,shimPeerConnection:sT,shimSenderGetStats:cT,shimReceiverGetStats:uT,shimRemoveStream:dT,shimRTCDataChannel:lT,shimAddTransceiver:hT,shimGetParameters:fT,shimCreateOffer:pT,shimCreateAnswer:vT,shimGetUserMedia:oT,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,X_.reject(n)}return!0===r.video?r.video={mediaSource:t}:r.video.mediaSource=t,e.navigator.mediaDevices.getUserMedia(r)})}},Symbol.toStringTag,{value:"Module"}));function mT(e){if("object"===Ml(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,n=this;this._localStreams||(this._localStreams=[]),Jm(r=this._localStreams).call(r,e)||this._localStreams.push(e),e.getAudioTracks().forEach((function(r){return t.call(n,r,e)})),e.getVideoTracks().forEach((function(r){return t.call(n,r,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){var t;r._localStreams?Jm(t=r._localStreams).call(t,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,r,n=this;this._localStreams||(this._localStreams=[]);var i=Pb(t=this._localStreams).call(t,e);if(-1!==i){ok(r=this._localStreams).call(r,i,1);var o=e.getTracks();this.getSenders().forEach((function(e){Jm(o).call(o,e.track)&&n.removeTrack(e)}))}})}}function gT(e){if("object"===Ml(e)&&e.RTCPeerConnection&&("getRemoteStreams"in e.RTCPeerConnection.prototype||(e.RTCPeerConnection.prototype.getRemoteStreams=function(){return this._remoteStreams?this._remoteStreams:[]}),!("onaddstream"in e.RTCPeerConnection.prototype))){ad(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){var r;if(t._remoteStreams||(t._remoteStreams=[]),!Jm(r=t._remoteStreams).call(r,e)){t._remoteStreams.push(e);var n=new Event("addstream");n.stream=e,t.dispatchEvent(n)}}))})}});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){var r;if(e._remoteStreams||(e._remoteStreams=[]),!(Pb(r=e._remoteStreams).call(r,t)>=0)){e._remoteStreams.push(t);var n=new Event("addstream");n.stream=t,e.dispatchEvent(n)}}))}),t.apply(e,arguments)}}}function yT(e){if("object"===Ml(e)&&e.RTCPeerConnection){var t=e.RTCPeerConnection.prototype,r=t.createOffer,n=t.createAnswer,i=t.setLocalDescription,o=t.setRemoteDescription,a=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),X_.resolve()):i},t.createAnswer=function(e,t){var r=arguments.length>=2?arguments[2]:arguments[0],i=n.apply(this,[r]);return t?(i.then(e,t),X_.resolve()):i};var s=function(e,t,r){var n=i.apply(this,[e]);return r?(n.then(t,r),X_.resolve()):n};t.setLocalDescription=s,s=function(e,t,r){var n=o.apply(this,[e]);return r?(n.then(t,r),X_.resolve()):n},t.setRemoteDescription=s,s=function(e,t,r){var n=a.apply(this,[e]);return r?(n.then(t,r),X_.resolve()):n},t.addIceCandidate=s}}function ST(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(ET(e))}}!t.getUserMedia&&t.mediaDevices&&t.mediaDevices.getUserMedia&&(t.getUserMedia=function(e,r,n){t.mediaDevices.getUserMedia(e).then(r,n)}.bind(t))}function ET(e){return e&&void 0!==e.video?FE({},e,{video:lb(e.video)}):e}function bT(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")?(cb("RTCIceServer.url","RTCIceServer.urls"),(o=JSON.parse(vk(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&&ad(e.RTCPeerConnection,"generateCertificate",{get:function(){return t.generateCertificate}})}}function kT(e){"object"===Ml(e)&&e.RTCTrackEvent&&"receiver"in e.RTCTrackEvent.prototype&&!("transceiver"in e.RTCTrackEvent.prototype)&&ad(e.RTCTrackEvent.prototype,"transceiver",{get:function(){return{receiver:this.receiver}}})}function TT(e){var t=e.RTCPeerConnection.prototype.createOffer;e.RTCPeerConnection.prototype.createOffer=function(e){if(e){var r,n;void 0!==e.offerToReceiveAudio&&(e.offerToReceiveAudio=!!e.offerToReceiveAudio);var i=bb(r=this.getTransceivers()).call(r,(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 o=bb(n=this.getTransceivers()).call(n,(function(e){return"video"===e.receiver.track.kind}));!1===e.offerToReceiveVideo&&o?"sendrecv"===o.direction?o.setDirection?o.setDirection("sendonly"):o.direction="sendonly":"recvonly"===o.direction&&(o.setDirection?o.setDirection("inactive"):o.direction="inactive"):!0!==e.offerToReceiveVideo||o||this.addTransceiver("video",{direction:"recvonly"})}return t.apply(this,arguments)}}function IT(e){"object"!==Ml(e)||e.AudioContext||(e.AudioContext=e.webkitAudioContext)}var AT=Object.freeze(Object.defineProperty({__proto__:null,shimLocalStreamsAPI:mT,shimRemoteStreamsAPI:gT,shimCallbacksAPI:yT,shimGetUserMedia:ST,shimConstraints:ET,shimRTCIceServerUrls:bT,shimTrackEventTransceiver:kT,shimCreateOfferLegacy:TT,shimAudioContext:IT},Symbol.toStringTag,{value:"Module"})),RT=cc.PROPER,wT=i,CT=Zm,OT=ag.trim;Rr({target:"String",proto:!0,forced:function(e){return wT((function(){return!!CT[e]()||"​…᠎"!=="​…᠎"[e]()||RT&&CT[e].name!==e}))}("trim")},{trim:function(){return OT(this)}});var xT,DT,PT=Us("String").trim,NT=ae,MT=PT,LT=String.prototype,UT=function(e){var t=e.trim;return"string"==typeof e||e===LT||NT(LT,e)&&t===LT.trim?MT:t},VT={exports:{}};xT=VT,(DT={generateIdentifier:function(){return Math.random().toString(36).substr(2,10)}}).localCName=DT.generateIdentifier(),DT.splitLines=function(e){var t;return lk(t=UT(e).call(e).split("\n")).call(t,(function(e){return UT(e).call(e)}))},DT.splitSections=function(e){var t=e.split("\nm=");return lk(t).call(t,(function(e,t){var r;return UT(r=t>0?"m="+e:e).call(r)+"\r\n"}))},DT.getDescription=function(e){var t=DT.splitSections(e);return t&&t[0]},DT.getMediaSections=function(e){var t=DT.splitSections(e);return t.shift(),t},DT.matchPrefix=function(e,t){var r;return Gs(r=DT.splitLines(e)).call(r,(function(e){return 0===Pb(e).call(e,t)}))},DT.parseCandidate=function(e){for(var t,r={foundation:(t=0===Pb(e).call(e,"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:yg(t[3],10),ip:t[4],address:t[4],port:yg(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=yg(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},DT.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(" ")},DT.parseIceOptions=function(e){return e.substr(14).split(" ")},DT.parseRtpMap=function(e){var t=e.substr(9).split(" "),r={payloadType:yg(t.shift(),10)};return t=t[0].split("/"),r.name=t[0],r.clockRate=yg(t[1],10),r.channels=3===t.length?yg(t[2],10):1,r.numChannels=r.channels,r},DT.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"},DT.parseExtmap=function(e){var t,r=e.substr(9).split(" ");return{id:yg(r[0],10),direction:Pb(t=r[0]).call(t,"/")>0?r[0].split("/")[1]:"sendrecv",uri:r[1]}},DT.writeExtmap=function(e){return"a=extmap:"+(e.id||e.preferredId)+(e.direction&&"sendrecv"!==e.direction?"/"+e.direction:"")+" "+e.uri+"\r\n"},DT.parseFmtp=function(e){for(var t,r={},n=e.substr(Pb(e).call(e," ")+1).split(";"),i=0;i<n.length;i++){var o,a;t=UT(o=n[i]).call(o).split("="),r[UT(a=t[0]).call(a)]=t[1]}return r},DT.writeFmtp=function(e){var t="",r=e.payloadType;if(void 0!==e.preferredPayloadType&&(r=e.preferredPayloadType),e.parameters&&an(e.parameters).length){var n=[];an(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},DT.parseRtcpFb=function(e){var t=e.substr(Pb(e).call(e," ")+1).split(" ");return{type:t.shift(),parameter:t.join(" ")}},DT.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},DT.parseSsrcMedia=function(e){var t=Pb(e).call(e," "),r={ssrc:yg(e.substr(7,t-7),10)},n=Pb(e).call(e,":",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},DT.parseSsrcGroup=function(e){var t=e.substr(13).split(" ");return{semantics:t.shift(),ssrcs:lk(t).call(t,(function(e){return yg(e,10)}))}},DT.getMid=function(e){var t=DT.matchPrefix(e,"a=mid:")[0];if(t)return t.substr(6)},DT.parseFingerprint=function(e){var t=e.substr(14).split(" ");return{algorithm:t[0].toLowerCase(),value:t[1].toUpperCase()}},DT.getDtlsParameters=function(e,t){var r=DT.matchPrefix(e+t,"a=fingerprint:");return{role:"auto",fingerprints:lk(r).call(r,DT.parseFingerprint)}},DT.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},DT.parseCryptoLine=function(e){var t=e.substr(9).split(" ");return{tag:yg(t[0],10),cryptoSuite:t[1],keyParams:t[2],sessionParams:Sm(t).call(t,3)}},DT.writeCryptoLine=function(e){return"a=crypto:"+e.tag+" "+e.cryptoSuite+" "+("object"===Ml(e.keyParams)?DT.writeCryptoKeyParams(e.keyParams):e.keyParams)+(e.sessionParams?" "+e.sessionParams.join(" "):"")+"\r\n"},DT.parseCryptoKeyParams=function(e){if(0!==Pb(e).call(e,"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}},DT.writeCryptoKeyParams=function(e){return e.keyMethod+":"+e.keySalt+(e.lifeTime?"|"+e.lifeTime:"")+(e.mkiValue&&e.mkiLength?"|"+e.mkiValue+":"+e.mkiLength:"")},DT.getCryptoParameters=function(e,t){var r=DT.matchPrefix(e+t,"a=crypto:");return lk(r).call(r,DT.parseCryptoLine)},DT.getIceParameters=function(e,t){var r=DT.matchPrefix(e+t,"a=ice-ufrag:")[0],n=DT.matchPrefix(e+t,"a=ice-pwd:")[0];return r&&n?{usernameFragment:r.substr(12),password:n.substr(10)}:null},DT.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},DT.parseRtpParameters=function(e){for(var t={codecs:[],headerExtensions:[],fecMechanisms:[],rtcp:[]},r=DT.splitLines(e)[0].split(" "),n=3;n<r.length;n++){var i=r[n],o=DT.matchPrefix(e,"a=rtpmap:"+i+" ")[0];if(o){var a,s=DT.parseRtpMap(o),c=DT.matchPrefix(e,"a=fmtp:"+i+" ");switch(s.parameters=c.length?DT.parseFmtp(c[0]):{},s.rtcpFeedback=lk(a=DT.matchPrefix(e,"a=rtcp-fb:"+i+" ")).call(a,DT.parseRtcpFb),t.codecs.push(s),s.name.toUpperCase()){case"RED":case"ULPFEC":t.fecMechanisms.push(s.name.toUpperCase())}}}return DT.matchPrefix(e,"a=extmap:").forEach((function(e){t.headerExtensions.push(DT.parseExtmap(e))})),t},DT.writeRtpDescription=function(e,t){var r,n="";n+="m="+e+" ",n+=t.codecs.length>0?"9":"0",n+=" UDP/TLS/RTP/SAVPF ",n+=lk(r=t.codecs).call(r,(function(e){return void 0!==e.preferredPayloadType?e.preferredPayloadType:e.payloadType})).join(" ")+"\r\n",n+="c=IN IP4 0.0.0.0\r\n",n+="a=rtcp:9 IN IP4 0.0.0.0\r\n",t.codecs.forEach((function(e){n+=DT.writeRtpMap(e),n+=DT.writeFmtp(e),n+=DT.writeRtcpFb(e)}));var i=0;return t.codecs.forEach((function(e){e.maxptime>i&&(i=e.maxptime)})),i>0&&(n+="a=maxptime:"+i+"\r\n"),t.headerExtensions&&t.headerExtensions.forEach((function(e){n+=DT.writeExtmap(e)})),n},DT.parseRtpEncodingParameters=function(e){var t,r,n,i,o,a,s=[],c=DT.parseRtpParameters(e),u=-1!==Pb(t=c.fecMechanisms).call(t,"RED"),d=-1!==Pb(r=c.fecMechanisms).call(r,"ULPFEC"),l=Gs(n=lk(i=DT.matchPrefix(e,"a=ssrc:")).call(i,(function(e){return DT.parseSsrcMedia(e)}))).call(n,(function(e){return"cname"===e.attribute})),h=l.length>0&&l[0].ssrc,f=lk(o=DT.matchPrefix(e,"a=ssrc-group:FID")).call(o,(function(e){var t=e.substr(17).split(" ");return lk(t).call(t,(function(e){return yg(e,10)}))}));f.length>0&&f[0].length>1&&f[0][0]===h&&(a=f[0][1]),c.codecs.forEach((function(e){if("RTX"===e.name.toUpperCase()&&e.parameters.apt){var t={ssrc:h,codecPayloadType:yg(e.parameters.apt,10)};h&&a&&(t.rtx={ssrc:a}),s.push(t),u&&((t=JSON.parse(vk(t))).fec={ssrc:h,mechanism:d?"red+ulpfec":"red"},s.push(t))}})),0===s.length&&h&&s.push({ssrc:h});var p,v,_=DT.matchPrefix(e,"b=");return _.length&&(_=0===Pb(p=_[0]).call(p,"b=TIAS:")?yg(_[0].substr(7),10):0===Pb(v=_[0]).call(v,"b=AS:")?1e3*yg(_[0].substr(5),10)*.95-16e3:void 0,s.forEach((function(e){e.maxBitrate=_}))),s},DT.parseRtcpParameters=function(e){var t,r,n={},i=Gs(t=lk(r=DT.matchPrefix(e,"a=ssrc:")).call(r,(function(e){return DT.parseSsrcMedia(e)}))).call(t,(function(e){return"cname"===e.attribute}))[0];i&&(n.cname=i.value,n.ssrc=i.ssrc);var o=DT.matchPrefix(e,"a=rtcp-rsize");n.reducedSize=o.length>0,n.compound=0===o.length;var a=DT.matchPrefix(e,"a=rtcp-mux");return n.mux=a.length>0,n},DT.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},DT.parseMsid=function(e){var t,r,n,i=DT.matchPrefix(e,"a=msid:");if(1===i.length)return{stream:(n=i[0].substr(7).split(" "))[0],track:n[1]};var o=Gs(t=lk(r=DT.matchPrefix(e,"a=ssrc:")).call(r,(function(e){return DT.parseSsrcMedia(e)}))).call(t,(function(e){return"msid"===e.attribute}));return o.length>0?{stream:(n=o[0].value.split(" "))[0],track:n[1]}:void 0},DT.parseSctpDescription=function(e){var t,r=DT.parseMLine(e),n=DT.matchPrefix(e,"a=max-message-size:");n.length>0&&(t=yg(n[0].substr(19),10)),isNaN(t)&&(t=65536);var i=DT.matchPrefix(e,"a=sctp-port:");if(i.length>0)return{port:yg(i[0].substr(12),10),protocol:r.fmt,maxMessageSize:t};var o=DT.matchPrefix(e,"a=sctpmap:");if(o.length>0){var a=o[0].substr(10).split(" ");return{port:yg(a[0],10),protocol:a[1],maxMessageSize:t}}},DT.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("")},DT.generateSessionId=function(){return Math.random().toString().substr(2,21)},DT.writeSessionBoilerplate=function(e,t,r){var n=void 0!==t?t:2;return"v=0\r\no="+(r||"thisisadapterortc")+" "+(e||DT.generateSessionId())+" "+n+" IN IP4 127.0.0.1\r\ns=-\r\nt=0 0\r\n"},DT.getDirection=function(e,t){for(var r=DT.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?DT.getDirection(t):"sendrecv"},DT.getKind=function(e){return DT.splitLines(e)[0].split(" ")[0].substr(2)},DT.isRejected=function(e){return"0"===e.split(" ",2)[1]},DT.parseMLine=function(e){var t=DT.splitLines(e)[0].substr(2).split(" ");return{kind:t[0],port:yg(t[1],10),protocol:t[2],fmt:Sm(t).call(t,3).join(" ")}},DT.parseOLine=function(e){var t=DT.matchPrefix(e,"o=")[0].substr(2).split(" ");return{username:t[0],sessionId:t[1],sessionVersion:yg(t[2],10),netType:t[3],addressType:t[4],address:t[5]}},DT.isValidSDP=function(e){if("string"!=typeof e||0===e.length)return!1;for(var t=DT.splitLines(e),r=0;r<t.length;r++)if(t[r].length<2||"="!==t[r].charAt(1))return!1;return!0},xT.exports=DT;var FT=VT.exports,BT=e({__proto__:null,default:FT},[VT.exports]);function jT(e){if(!(!e.RTCIceCandidate||e.RTCIceCandidate&&"foundation"in e.RTCIceCandidate.prototype)){var t=e.RTCIceCandidate;e.RTCIceCandidate=function(e){var r;if("object"===Ml(e)&&e.candidate&&0===Pb(r=e.candidate).call(r,"a=")&&((e=JSON.parse(vk(e))).candidate=e.candidate.substr(2)),e.candidate&&e.candidate.length){var n=new t(e),i=FT.parseCandidate(e.candidate),o=FE(n,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,ib(e,"icecandidate",(function(t){return t.candidate&&ad(t,"candidate",{value:new e.RTCIceCandidate(t.candidate),writable:"false"}),t}))}}function GT(e){!e.RTCIceCandidate||e.RTCIceCandidate&&"relayProtocol"in e.RTCIceCandidate.prototype||ib(e,"icecandidate",(function(e){if(e.candidate){var t=FT.parseCandidate(e.candidate.candidate);"relay"===t.type&&(e.candidate.relayProtocol={0:"tls",1:"tcp",2:"udp"}[t.priority>>24])}return e}))}function HT(e,t){if(e.RTCPeerConnection){"sctp"in e.RTCPeerConnection.prototype||ad(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=FT.splitSections(e.sdp);return t.shift(),t.some((function(e){var t,r=FT.parseMLine(e);return r&&"application"===r.kind&&-1!==Pb(t=r.protocol).call(t,"SCTP")}))},n=function(e){var t=e.sdp.match(/mozilla...THIS_IS_SDPARTA-(\d+)/);if(null===t||t.length<2)return-1;var r=yg(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=FT.matchPrefix(e.sdp,"a=max-message-size:");return i.length>0?n=yg(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&&ad(this,"sctp",{get:function(){return void 0===this._sctp?null:this._sctp},enumerable:!0,configurable:!0})}if(r(arguments[0])){var c,u=n(arguments[0]),d=i(u),l=o(arguments[0],u);c=0===d&&0===l?Number.POSITIVE_INFINITY:0===d||0===l?Math.max(d,l):Math.min(d,l);var h={};ad(h,"maxMessageSize",{get:function(){return c}}),this._sctp=h}return a.apply(this,arguments)}}}function zT(e){if(e.RTCPeerConnection&&"createDataChannel"in e.RTCPeerConnection.prototype){var t=e.RTCPeerConnection.prototype.createDataChannel;e.RTCPeerConnection.prototype.createDataChannel=function(){var e=t.apply(this,arguments);return r(e,this),e},ib(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 KT(e){if(e.RTCPeerConnection&&!("connectionState"in e.RTCPeerConnection.prototype)){var t=e.RTCPeerConnection.prototype;ad(t,"connectionState",{get:function(){return{completed:"connected",checking:"connecting"}[this.iceConnectionState]||this.iceConnectionState},enumerable:!0,configurable:!0}),ad(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 XT(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){var n;if(t&&t.sdp&&-1!==Pb(n=t.sdp).call(n,"\na=extmap-allow-mixed")){var i,o=Gs(i=t.sdp.split("\n")).call(i,(function(e){return"a=extmap-allow-mixed"!==UT(e).call(e)})).join("\n");e.RTCSessionDescription&&t instanceof e.RTCSessionDescription?arguments[0]=new e.RTCSessionDescription({type:t.type,sdp:o}):t.sdp=o}return r.apply(this,arguments)}}}function qT(e,t){if(e.RTCPeerConnection&&e.RTCPeerConnection.prototype){var r=e.RTCPeerConnection.prototype.addIceCandidate;r&&0!==r.length&&(e.RTCPeerConnection.prototype.addIceCandidate=function(){return arguments[0]?("chrome"===t.browser&&t.version<78||"firefox"===t.browser&&t.version<68||"safari"===t.browser)&&arguments[0]&&""===arguments[0].candidate?X_.resolve():r.apply(this,arguments):(arguments[1]&&arguments[1].apply(null),X_.resolve())})}}function WT(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"!==Ml(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 n="offer"===t.type?this.createOffer:this.createAnswer;return n.apply(this).then((function(t){return r.apply(e,[t])}))})}}var YT=Object.freeze(Object.defineProperty({__proto__:null,shimRTCIceCandidate:jT,shimRTCIceCandidateRelayProtocol:GT,shimMaxMessageSize:HT,shimSendThrowTypeError:zT,shimConnectionState:KT,removeExtmapAllowMixed:XT,shimAddIceCandidateNullOrEmpty:qT,shimParameterlessSetLocalDescription:WT},Symbol.toStringTag,{value:"Module"}));function QT(e,t){var r=void 0!==_l&&Ok(e)||e["@@iterator"];if(!r){if(wk(e)||(r=qk(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}}}}function JT(e,t){return function(e){if(wk(e))return e}(e)||function(e,t){var r=null==e?null:void 0!==_l&&Ok(e)||e["@@iterator"];if(null!=r){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(c){s=!0,i=c}finally{try{a||null==r.return||r.return()}finally{if(s)throw i}}return o}}(e,t)||qk(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 ZT(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}!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=sb,i=ub(t),o={browserDetails:i,commonShim:YT,extractVersion:nb,disableLog:ob,disableWarnings:ab,sdp:BT};switch(i.browser){case"chrome":if(!Rk||!Ik||!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=Rk,qT(t,i),WT(t),mk(t,i),gk(t),Ik(t,i),yk(t),Tk(t,i),Sk(t),Ek(t),bk(t),Ak(t,i),jT(t),GT(t),KT(t),HT(t,i),zT(t),XT(t,i);break;case"firefox":if(!_T||!sT||!r.shimFirefox)return n("Firefox shim is not included in this adapter release."),o;n("adapter.js shimming firefox."),o.browserShim=_T,qT(t,i),WT(t),oT(t,i),sT(t,i),aT(t),dT(t),cT(t),uT(t),lT(t),hT(t),fT(t),pT(t),vT(t),jT(t),KT(t),HT(t,i),zT(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,qT(t,i),WT(t),bT(t),TT(t),yT(t),mT(t),gT(t),kT(t),ST(t),IT(t),jT(t),GT(t),HT(t,i),zT(t),XT(t,i);break;default:n("Unsupported browser!")}}({window:"undefined"==typeof window?void 0:window});var $T=Ye,eI=function(e){return void 0!==e&&($T(e,"value")||$T(e,"writable"))},tI=x,rI=$,nI=tr,iI=eI,oI=R,aI=mc;Rr({target:"Reflect",stat:!0},{get:function e(t,r){var n,i,o=arguments.length<3?t:arguments[2];return nI(t)===o?t[r]:(n=oI.f(t,r))?iI(n)?n.value:void 0===n.get?void 0:tI(n.get,o):rI(i=aI(t))?e(i,r,o):void 0}});var sI=ee.Reflect.get,cI=b,uI=Ce,dI=$,lI=Ye,hI=rs,fI=o,pI=Function,vI=cI([].concat),_I=cI([].join),mI={},gI=function(e,t,r){if(!lI(mI,t)){for(var n=[],i=0;i<t;i++)n[i]="a["+i+"]";mI[t]=pI("C,a","return new C("+_I(n,",")+")")}return mI[t](e,r)},yI=fI?pI.bind:function(e){var t=uI(this),r=t.prototype,n=hI(arguments,1),i=function(){var r=vI(n,hI(arguments));return this instanceof i?gI(t,r.length,r):t.apply(e,r)};return dI(r)&&(i.prototype=r),i},SI=yI;Rr({target:"Function",proto:!0,forced:Function.bind!==SI},{bind:SI});var EI=Us("Function").bind,bI=ae,kI=EI,TI=Function.prototype,II=function(e){var t=e.bind;return e===TI||bI(TI,e)&&t===TI.bind?kI:t};function AI(e){var t;return(AI=Gl?II(t=jl).call(t):function(e){return e.__proto__||jl(e)})(e)}function RI(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=AI(e)););return e}function wI(){var e;"undefined"!=typeof Reflect&&sI?wI=II(e=sI).call(e):wI=function(e,t,r){var n=RI(e,t);if(n){var i=tc(n,t);return i.get?i.get.call(arguments.length<3?e:r):i.value}};return wI.apply(this,arguments)}function CI(e,t){var r;return(CI=Gl?II(r=Gl).call(r):function(e,t){return e.__proto__=t,e})(e,t)}function OI(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Ul(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),ad(e,"prototype",{writable:!1}),t&&CI(e,t)}var xI=Rr,DI=d,PI=yI,NI=yf,MI=tr,LI=$,UI=Hn,VI=i,FI=oe("Reflect","construct"),BI=Object.prototype,jI=[].push,GI=VI((function(){function e(){}return!(FI((function(){}),[],e)instanceof e)})),HI=!VI((function(){FI((function(){}))})),zI=GI||HI;xI({target:"Reflect",stat:!0,forced:zI,sham:zI},{construct:function(e,t){NI(e),MI(t);var r=arguments.length<3?e:NI(arguments[2]);if(HI&&!GI)return FI(e,t,r);if(e==r){switch(t.length){case 0:return new e;case 1:return new e(t[0]);case 2:return new e(t[0],t[1]);case 3:return new e(t[0],t[1],t[2]);case 4:return new e(t[0],t[1],t[2],t[3])}var n=[null];return DI(jI,n,t),new(DI(PI,e,n))}var i=r.prototype,o=UI(LI(i)?i:BI),a=DI(e,o,t);return LI(a)?a:o}});var KI=ee.Reflect.construct;function XI(e,t){if(t&&("object"===Ml(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return ZT(e)}function qI(e){var t=function(){if("undefined"==typeof Reflect||!KI)return!1;if(KI.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(KI(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=AI(e);if(t){var i=AI(this).constructor;r=KI(n,arguments,i)}else r=n.apply(this,arguments);return XI(this,r)}}var WI=Us("Array").values,YI=vn,QI=Ye,JI=ae,ZI=WI,$I=Array.prototype,eA={DOMTokenList:!0,NodeList:!0},tA=function(e){var t=e.values;return e===$I||JI($I,e)&&t===$I.values||QI(eA,YI(e))?ZI:t},rA=ni,nA=Math.floor,iA=function(e,t){var r=e.length,n=nA(r/2);return r<8?oA(e,t):aA(e,iA(rA(e,0,n),t),iA(rA(e,n),t),t)},oA=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},aA=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},sA=iA,cA=se.match(/firefox\/(\d+)/i),uA=!!cA&&+cA[1],dA=/MSIE|Trident/.test(se),lA=se.match(/AppleWebKit\/(\d+)\./),hA=!!lA&&+lA[1],fA=Rr,pA=b,vA=Ce,_A=Xe,mA=Br,gA=jb,yA=gn,SA=i,EA=sA,bA=Iu,kA=uA,TA=dA,IA=pe,AA=hA,RA=[],wA=pA(RA.sort),CA=pA(RA.push),OA=SA((function(){RA.sort(void 0)})),xA=SA((function(){RA.sort(null)})),DA=bA("sort"),PA=!SA((function(){if(IA)return IA<70;if(!(kA&&kA>3)){if(TA)return!0;if(AA)return AA<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++)RA.push({k:t+n,v:r})}for(RA.sort((function(e,t){return t.v-e.v})),n=0;n<RA.length;n++)t=RA[n].k.charAt(0),i.charAt(i.length-1)!==t&&(i+=t);return"DGBEFHACIJK"!==i}}));fA({target:"Array",proto:!0,forced:OA||!xA||!DA||!PA},{sort:function(e){void 0!==e&&vA(e);var t=_A(this);if(PA)return void 0===e?wA(t):wA(t,e);var r,n,i=[],o=mA(t);for(n=0;n<o;n++)n in t&&CA(i,t[n]);for(EA(i,function(e){return function(t,r){return void 0===r?-1:void 0===t?1:void 0!==e?+e(t,r)||0:yA(t)>yA(r)?1:-1}}(e)),r=mA(i),n=0;n<r;)t[n]=i[n++];for(;n<o;)gA(t,n++);return t}});var NA=Us("Array").sort,MA=ae,LA=NA,UA=Array.prototype,VA=function(e){var t=e.sort;return e===UA||MA(UA,e)&&t===UA.sort?LA:t},FA=Rr,BA=No.findIndex,jA="findIndex",GA=!0;jA in[]&&Array(1).findIndex((function(){GA=!1})),FA({target:"Array",proto:!0,forced:GA},{findIndex:function(e){return BA(this,e,arguments.length>1?arguments[1]:void 0)}});var HA=Us("Array").findIndex,zA=ae,KA=HA,XA=Array.prototype,qA=function(e){var t=e.findIndex;return e===XA||zA(XA,e)&&t===XA.findIndex?KA:t},WA=Rr,YA=b;R.f;var QA=Vr,JA=gn,ZA=Lm,$A=q,eR=Vm,tR=YA("".startsWith),rR=YA("".slice),nR=Math.min;WA({target:"String",proto:!0,forced:!eR("startsWith")},{startsWith:function(e){var t=JA($A(this));ZA(e);var r=QA(nR(arguments.length>1?arguments[1]:void 0,t.length)),n=JA(e);return tR?tR(t,n,r):rR(t,r,r+n.length)===n}});var iR=Us("String").startsWith,oR=ae,aR=iR,sR=String.prototype,cR=function(e){var t=e.startsWith;return"string"==typeof e||e===sR||oR(sR,e)&&t===sR.startsWith?aR:t},uR=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.INTERRUPT="INTERRUPT",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_EXCEED_QPS="USER_MESSAGE_EXCEED_QPS",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.SUBTITLE_ALREADY_ON="SUBTITLE_ALREADY_ON",e.SUBTITLE_NOT_TURNED_ON="SUBTITLE_NOT_TURNED_ON",e.SUBTITLE_ERR_POSTPROCESS="SUBTITLE_ERR_POSTPROCESS",e.SUBTITLE_ERR_CONNECTION_ERROR="SUBTITLE_ERR_CONNECTION_ERROR",e.SUBTITLE_ERR_PROCESS_ERROR="SUBTITLE_ERR_PROCESS_ERROR",e.SUBTITLE_ERR_UNKNOWN="SUBTITLE_ERR_UNKNOWN",e}(uR||{}),dR=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}(dR||{}),lR=qd((function e(t,r,n){Wd(this,e),sd(this,"code",void 0),sd(this,"message",void 0),sd(this,"error",void 0),this.code=t,this.message=r,this.error=n})),hR=w,fR=b,pR=rn,vR=Q,_R=fR(D.f),mR=fR([].push),gR=function(e){return function(t){for(var r,n=vR(t),i=pR(n),o=i.length,a=0,s=[];o>a;)r=i[a++],hR&&!_R(n,r)||mR(s,e?[r,n[r]]:n[r]);return s}},yR={entries:gR(!0),values:gR(!1)}.entries;Rr({target:"Object",stat:!0},{entries:function(e){return yR(e)}});var SR=ee.Object.entries,ER=xr,bR=gn,kR=q,TR=RangeError,IR=b,AR=Vr,RR=gn,wR=function(e){var t=bR(kR(this)),r="",n=ER(e);if(n<0||n==1/0)throw TR("Wrong number of repetitions");for(;n>0;(n>>>=1)&&(t+=t))1&n&&(r+=t);return r},CR=q,OR=IR(wR),xR=IR("".slice),DR=Math.ceil,PR=function(e){return function(t,r,n){var i,o,a=RR(CR(t)),s=AR(r),c=a.length,u=void 0===n?" ":RR(n);return s<=c||""==u?a:((o=OR(u,DR((i=s-c)/u.length))).length>i&&(o=xR(o,0,i)),e?a+o:o+a)}},NR={start:PR(!1),end:PR(!0)},MR=/Version\/10(?:\.\d+){1,2}(?: [\w./]+)?(?: Mobile\/\w+)? Safari\//.test(se),LR=NR.end;Rr({target:"String",proto:!0,forced:MR},{padEnd:function(e){return LR(this,e,arguments.length>1?arguments[1]:void 0)}});var UR=Us("String").padEnd,VR=ae,FR=UR,BR=String.prototype,jR=function(e){var t=e.padEnd;return"string"==typeof e||e===BR||VR(BR,e)&&t===BR.padEnd?FR:t},GR=gg;Rr({target:"Number",stat:!0,forced:Number.parseInt!=GR},{parseInt:GR});var HR=ee.Number.parseInt,zR=Math.log,KR=Math.LOG10E;Rr({target:"Math",stat:!0},{log10:Math.log10||function(e){return zR(e)*KR}});var XR,qR=ee.Math.log10,WR=new Uint8Array(16);function YR(){if(!XR&&!(XR="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 XR(WR)}var QR=/^(?:[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 JR(e){return"string"==typeof e&&QR.test(e)}for(var ZR,$R,ew,tw=[],rw=0;rw<256;++rw)tw.push((rw+256).toString(16).substr(1));function nw(e,t,r){var n=(e=e||{}).random||(e.rng||YR)();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=(tw[e[t+0]]+tw[e[t+1]]+tw[e[t+2]]+tw[e[t+3]]+"-"+tw[e[t+4]]+tw[e[t+5]]+"-"+tw[e[t+6]]+tw[e[t+7]]+"-"+tw[e[t+8]]+tw[e[t+9]]+"-"+tw[e[t+10]]+tw[e[t+11]]+tw[e[t+12]]+tw[e[t+13]]+tw[e[t+14]]+tw[e[t+15]]).toLowerCase();if(!JR(r))throw TypeError("Stringified UUID is invalid");return r}(n)}var iw=new TextDecoder,ow=new TextEncoder,aw=function(){return nw()},sw=function(){return Date.now()};function cw(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 c=new e(t),u=0,d=0,l=n;d<l.length;d++){var h=l[d];c.set(h,u),u+=h.length}return c}var uw=function(){return"undefined"==typeof window},dw=function(){function e(){Wd(this,e)}var t,r;return qd(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){var n;return window.btoa(Gs(n=[e,t,r]).call(n,(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]:{},n=0,i=SR(t);n<i.length;n++){var o=JT(i[n],2),a=o[0],s=o[1];null!==s&&"object"===Ml(s)?e.merge(t[a],r[a]):void 0!==r[a]&&(t[a]=r[a])}}},{key:"ab2str",value:function(e){return iw.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 ow.encode(e).buffer}},{key:"ab2b64str",value:(r=km(Em().mark((function e(t){var r;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,new X_((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=km(Em().mark((function e(t){return Em().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 lw(){var e="none";return uw()||(null!==window.navigator.userAgent.match("Firefox")?e="mozilla":null!==window.navigator.userAgent.match("Chrome")?(e="chrome-stable",null!==window.navigator.userAgent.match("Electron")&&(e="electron")):(null!==window.navigator.userAgent.match("Safari")||null!==window.navigator.userAgent.match("AppleWebKit"))&&(e="safari")),e}var hw=function(){if("chrome-stable"===lw()){var e=window.navigator.userAgent.match(/Chrome\/([\d.]+)/);if(e&&e.length>1)if(Number(e[1].split(".")[0])<114)return!0}return!1}(),fw="mozilla"===lw(),pw="safari"===lw(),vw=0,_w=!uw()&&(null===(ZR=navigator.userAgent.match(/version\/(\d+)/i))||void 0===ZR?void 0:ZR[1]);pw&&_w&&(vw=+_w);var mw=!uw()&&(null===($R=navigator.userAgent.match(/Firefox\/(\d+)/i))||void 0===$R?void 0:$R[1]);fw&&mw&&(vw=+mw);var gw=vw,yw=vw,Sw=!uw()&&!!/(iPhone|iPad|iPod)/i.exec(navigator.userAgent);!uw()&&/(iPhone|iPod)/i.exec(navigator.userAgent);var Ew=!uw()&&(!!/(iPad)/i.exec(navigator.userAgent)||/Macintosh/i.test(navigator.userAgent)&&"ontouchend"in document),bw=!uw()&&/MicroMessenger/i.test(navigator.userAgent),kw=!uw()&&/Android/i.test(navigator.userAgent);!uw()&&Jm(ew=navigator.userAgent.toLowerCase()).call(ew,"mobile");var Tw=!uw()&&/chrome\/(86)|(87)|(88)|(89)|(90)|(91)|(92)/i.test(navigator.userAgent);function Iw(){for(var e,t,r=(+jR(e=Sm(t="".concat(Math.random())).call(t,-7)).call(e,7,"0")).toString(2),n=jR(r).call(r,28,"1").split(""),i=[];n.length;)i.push(ok(n).call(n,0,7));return lk(i).call(i,(function(e,t){var r=t===i.length-1?"0":"1";return HR(r+e.join(""),2)}))}var Aw=function(){return Math.floor(65535*Math.random())};function Rw(e){return"string"==typeof e&&Pb(e).call(e,"__web__rtc__rtt__")>-1}function ww(e){return lk(e).call(e,(function e(t){var r;if(null!=t&&t._reportName)return t._reportName;if(t instanceof HTMLElement)return t.toString();if(t instanceof ArrayBuffer||ArrayBuffer.isView(t)){var n,i,o=ArrayBuffer.isView(t)?t.buffer:t,a=o.byteLength,s=[];if(a>10){var c,u,d,l,h=new DataView(o),f=lk(c=Xk({length:5})).call(c,(function(e,t){return h.getUint8(t)})),p=lk(u=lk(d=Xk({length:5})).call(d,(function(e,t){return a-1-t})).reverse()).call(u,(function(e){return h.getUint8(e)}));s=wm(l=[]).call(l,Wk(f),["..."],Wk(p))}else s=Xk(new Uint8Array(o));return wm(n=wm(i="".concat(t.constructor.name,"(")).call(i,a,") [")).call(n,s.join(", "),"]")}if(t instanceof ImageData)return"ImageData";if(Array.isArray(t))return lk(t).call(t,e);if(Jm(r=["[object Object]","[object MediaStreamTrack]"]).call(r,Object.prototype.toString.call(t))){var v={};for(var _ in t)v[_]=e(t[_]);return v}return t}))}var Cw=function(){var e=km(Em().mark((function e(){var t,r,n,i=arguments;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=i.length>0&&void 0!==i[0]&&i[0],(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=8,r.createOffer();case 8:return n=e.sent,r.close(),e.abrupt("return",n.sdp);case 11:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),Ow=function(e){return new X_((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 xw(e){return+Math.max(-127,10*qR(Math.pow(e/255,2))).toFixed(2)}function Dw(e){return(e&Sd.AUDIO)===Sd.AUDIO}function Pw(e){return(e&Sd.VIDEO)===Sd.VIDEO}function Nw(e){var t={};return an(e).forEach((function(r){"object"===Ml(e[r])?t[r]=Nw(e[r]):cR(r).call(r,"_")||(t[r]=e[r])})),t}function Mw(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 Lw(e){return null==e?"undefined | null":"string"==typeof e?e:vk({contentHint:e.contentHint,enabled:e.enabled,id:e.id,kind:e.kind,label:e.label,muted:e.muted,readyState:e.readyState})}function Uw(e){return void 0===e}function Vw(e){return function(t,r,n){var i=n.value;n.value=function(){var t;console.warn(wm(t="[RTC WebSDK]: Api: ".concat(r," has been abandoned from version ")).call(t,e));for(var n=arguments.length,o=new Array(n),a=0;a<n;a++)o[a]=arguments[a];return i.apply(this,o)}}}function Fw(e){console.warn("[RTC WebSDK]: "+e)}function Bw(e){return"number"==typeof e?e:"number"==typeof(null==e?void 0:e.exact)?e.exact:"number"==typeof(null==e?void 0:e.ideal)?e.ideal:"number"==typeof(null==e?void 0:e.max)?e.max:"number"==typeof(null==e?void 0:e.min)?e.min:1}var jw=function(){function e(){Wd(this,e),sd(this,"_running",!1),sd(this,"_queue",[])}return qd(e,[{key:"add",value:function(e,t){this._queue.push([e,t]),this._running||(this._running=!0,this._process())}},{key:"_process",value:function(){var e=this,t=JT(this._queue.shift()||[],2),r=t[0],n=t[1];r&&n?r.then((function(t){n(t),e._process()})).catch((function(){e._process()})):this._running=!1}}]),e}();function Gw(e,t){if("boolean"!=typeof e)throw new lR(uR.INVALID_PARAMS,"Invalid ".concat(t,": The value should be boolean type."))}function Hw(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,o,a=new lR(uR.INVALID_PARAMS,wm(i=wm(o="Invalid ".concat(t,": the value range is [")).call(o,r,", ")).call(i,n,"]. integer only"));throw a}}function zw(e,t){var r,n,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:Number.POSITIVE_INFINITY;if(null==e)throw new lR(uR.INVALID_PARAMS,"".concat(t," cannot be empty"));if(!Qw(e,i,o))throw new lR(uR.INVALID_PARAMS,wm(r=wm(n="Invalid ".concat(t,": The value should be string type. Length of the string: [")).call(n,i,",")).call(r,o,"]"))}function Kw(e,t,r){var n;if(!Jm(r).call(r,e))throw new lR(uR.INVALID_PARAMS,wm(n="Invalid ".concat(t,": The value can only be set as ")).call(n,vk(r)))}function Xw(e){if(!(e instanceof MediaStreamTrack))throw new lR(uR.INVALID_PARAMS,"Invalid track, The value should be MediaStreamTrack type.")}function qw(e,t){if(Jw(e))throw new lR(uR.INVALID_PARAMS,"Invalid ".concat(t,", should not be empty"))}function Ww(e,t){if(!(e instanceof ArrayBuffer))throw new lR(uR.INVALID_PARAMS,"Invalid ".concat(t,", should be ArrayBuffer"))}function Yw(e){try{for(var t=navigator.mediaDevices.getSupportedConstraints(),r=0,n=an(e);r<n.length;r++){var i=n[r];t[i]||delete e[i]}}catch(o){}}function Qw(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 Jw(e){return null==e}function Zw(e){if("string"!=typeof e||!/^[a-zA-Z0-9@._\-]{1,128}$/.test(e))throw new lR(uR.INVALID_PARAMS,"The RoomId must be within 128 bytes. The supported characters: a-z,A-Z,0-9,@,-,_,.")}function $w(e){if("string"!=typeof e||!/^[a-zA-Z0-9@._\-]{1,128}$/.test(e))throw new lR(uR.INVALID_PARAMS,"The userId must be within 128 bytes. The supported characters: a-z,A-Z,0-9,@,-,_,.")}function eC(e){if("string"!=typeof e||!/^[a-zA-Z0-9@._\-]{1,128}$/.test(e))throw new lR(uR.INVALID_PARAMS,"The publicStreamId must be within 128 bytes. The supported characters: a-z,A-Z,0-9,@,-,_,.")}function tC(e){qw(e,"userInfo"),$w(e.userId),Jw(e.extraInfo)||zw(e.extraInfo,"userInfo.extraInfo",1,200)}function rC(e){qw(e,"roomConfig"),Gw(e.isAutoPublish,"roomConfig.isAutoPublish"),Gw(e.isAutoSubscribeAudio,"roomConfig.isAutoSubscribeAudio"),Gw(e.isAutoSubscribeVideo,"roomConfig.isAutoSubscribeVideo"),Jw(e.roomProfileType)||Kw(e.roomProfileType,"roomConfig",[Dd.communication,Dd.chat,Dd.chatRoom,Dd.coHost,Dd.meeting,Dd.classRoom])}function nC(e){qw(e,"videoPlayerOption")}function iC(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 lR(uR.INVALID_PARAMS,"The message cannot be empty");if((null===(t=e instanceof ArrayBuffer?e:dw.str2ab(vk(e)))||void 0===t?void 0:t.byteLength)>1e3*r)throw new lR(uR.INVALID_PARAMS,"The message length must be less than ".concat(r,"K"))}function oC(e){var t;return!Jm(t=[Kd.onRemoteStreamStats,Kd.onLocalStreamStats,Kd.onAudioVolumeIndication,Kd.onLocalAudioPropertiesReport,Kd.onRemoteAudioPropertiesReport]).call(t,e)}function aC(e){if("number"!=typeof(null==e?void 0:e.width)||"number"!=typeof(null==e?void 0:e.height))throw new lR(uR.INVALID_PARAMS,"remoteVideoConfig must contain width, height, frameRate")}function sC(e,t){if("number"!=typeof e||Number.isNaN(e)||!(e>=1)){var r=e;if(!(null!=r&&r.min||null!=r&&r.max||null!=r&&r.exact||null!=r&&r.ideal))throw new lR(uR.INVALID_PARAMS,"".concat(t," is not a valid ConstrainULong"))}}function cC(e){var t,r=QT(e);try{for(r.s();!(t=r.n()).done;){var n=t.value;Hw(null==n?void 0:n.maxKbps,"maxKbps"),sC(null==n?void 0:n.width,"width"),sC(null==n?void 0:n.height,"height"),sC(null==n?void 0:n.frameRate,"frameRate")}}catch(i){r.e(i)}finally{r.f()}}var uC={exports:{}};!function(e){var t=Object.prototype.hasOwnProperty,r="~";function n(){}function i(e,t,r){this.fn=e,this.context=t,this.once=r||!1}function o(e,t,n,o,a){if("function"!=typeof n)throw new TypeError("The listener must be a function");var s=new i(n,o||e,a),c=r?r+t:t;return e._events[c]?e._events[c].fn?e._events[c]=[e._events[c],s]:e._events[c].push(s):(e._events[c]=s,e._eventsCount++),e}function a(e,t){0==--e._eventsCount?e._events=new n:delete e._events[t]}function s(){this._events=new n,this._eventsCount=0}Object.create&&(n.prototype=Object.create(null),(new n).__proto__||(r=!1)),s.prototype.eventNames=function(){var e,n,i=[];if(0===this._eventsCount)return i;for(n in e=this._events)t.call(e,n)&&i.push(r?Sm(n).call(n,1):n);return Os?wm(i).call(i,Os(e)):i},s.prototype.listeners=function(e){var t=r?r+e:e,n=this._events[t];if(!n)return[];if(n.fn)return[n.fn];for(var i=0,o=n.length,a=new Array(o);i<o;i++)a[i]=n[i].fn;return a},s.prototype.listenerCount=function(e){var t=r?r+e:e,n=this._events[t];return n?n.fn?1:n.length:0},s.prototype.emit=function(e,t,n,i,o,a){var s=r?r+e:e;if(!this._events[s])return!1;var c,u,d=this._events[s],l=arguments.length;if(d.fn){switch(d.once&&this.removeListener(e,d.fn,void 0,!0),l){case 1:return d.fn.call(d.context),!0;case 2:return d.fn.call(d.context,t),!0;case 3:return d.fn.call(d.context,t,n),!0;case 4:return d.fn.call(d.context,t,n,i),!0;case 5:return d.fn.call(d.context,t,n,i,o),!0;case 6:return d.fn.call(d.context,t,n,i,o,a),!0}for(u=1,c=new Array(l-1);u<l;u++)c[u-1]=arguments[u];d.fn.apply(d.context,c)}else{var h,f=d.length;for(u=0;u<f;u++)switch(d[u].once&&this.removeListener(e,d[u].fn,void 0,!0),l){case 1:d[u].fn.call(d[u].context);break;case 2:d[u].fn.call(d[u].context,t);break;case 3:d[u].fn.call(d[u].context,t,n);break;case 4:d[u].fn.call(d[u].context,t,n,i);break;default:if(!c)for(h=1,c=new Array(l-1);h<l;h++)c[h-1]=arguments[h];d[u].fn.apply(d[u].context,c)}}return!0},s.prototype.on=function(e,t,r){return o(this,e,t,r,!1)},s.prototype.once=function(e,t,r){return o(this,e,t,r,!0)},s.prototype.removeListener=function(e,t,n,i){var o=r?r+e:e;if(!this._events[o])return this;if(!t)return a(this,o),this;var s=this._events[o];if(s.fn)s.fn!==t||i&&!s.once||n&&s.context!==n||a(this,o);else{for(var c=0,u=[],d=s.length;c<d;c++)(s[c].fn!==t||i&&!s[c].once||n&&s[c].context!==n)&&u.push(s[c]);u.length?this._events[o]=1===u.length?u[0]:u:a(this,o)}return this},s.prototype.removeAllListeners=function(e){var t;return e?(t=r?r+e:e,this._events[t]&&a(this,t)):(this._events=new n,this._eventsCount=0),this},s.prototype.off=s.prototype.removeListener,s.prototype.addListener=s.prototype.on,s.prefixed=r,s.EventEmitter=s,e.exports=s}(uC);var dC,lC=uC.exports,hC=Us("Array").keys,fC=vn,pC=Ye,vC=ae,_C=hC,mC=Array.prototype,gC={DOMTokenList:!0,NodeList:!0},yC=function(e){var t=e.keys;return e===mC||vC(mC,e)&&t===mC.keys||pC(gC,fC(e))?_C:t},SC="@byted/ve-rtc",EC="@byted/ve-rtc-cache-size",bC=function(){function e(){Wd(this,e),sd(this,"storeKey",void 0),sd(this,"logLevel",void 0),sd(this,"LogfileSize",void 0),sd(this,"db",void 0),sd(this,"logId",void 0),sd(this,"cacheLog",void 0),sd(this,"cachedSize",void 0),sd(this,"preCacheTime",void 0),sd(this,"timer",void 0),sd(this,"_getSize",(function(e){return new Blob(e).size/1048576})),this.storeKey="",this.logId=1,this.cacheLog="",this.logLevel="none",this.LogfileSize=100,this._createStore()}return qd(e,[{key:"_createStore",value:function(){var e=this;if(!uw()&&window.indexedDB){var t=indexedDB.open("@byted/ve-rtc");t.onupgradeneeded=function(){t.result.createObjectStore(SC);try{localStorage.removeItem(EC)}catch(mW){}},t.onerror=function(e){},t.onsuccess=function(){e.db=t.result,e._getCachedSize()}}}},{key:"_getCachedSize",value:function(){var e=this;try{var t=localStorage.getItem(EC);if(t)this.cachedSize=+t;else tA(this).call(this).then((function(t){e.cachedSize=e._getSize(t),e._setCachedSize()}))}catch(mW){}}},{key:"_setCachedSize",value:function(){try{localStorage.setItem(EC,"".concat(this.cachedSize))}catch(mW){}}},{key:"_getStore",value:function(e){if(this.db)return this.db.transaction(SC,e).objectStore(SC)}},{key:"set",value:function(e){var t=this;return new X_((function(r,n){if("none"===t.logLevel)return r();var i;if(e&&t.preCacheTime&&t.preCacheTime-Date.now()<1e3)return t.cacheLog+=wm(i="\n\n".concat(t.logId,": ")).call(i,e),t.logId++,t.timer||(t.timer=setTimeout((function(){t.set("")}),1e3-(t.preCacheTime-Date.now()))),r();clearTimeout(t.timer),t.timer=null;var o=t._getStore("readwrite");if(!o)return n("get store fail");t.cachedSize&&t.cachedSize>t.LogfileSize&&t.keyEarliest().then((function(e){t.get(e).then((function(r){t.del(e).then((function(){t.cachedSize=t.cachedSize-t._getSize(["".concat(r)]),t._setCachedSize()}))}))}));var a=o.get(t.storeKey);a.onsuccess=function(){try{var i,s,c,u,d,l=wm(i="".concat(a.result||"")).call(i,t.cacheLog),h=e?wm(s=wm(c="".concat(l?"\n\n":"")).call(c,t.logId,": ")).call(s,e):"";o.put(wm(u="".concat(l)).call(u,h),t.storeKey),e&&t.logId++,t.cacheLog="",t.cachedSize=(t.cachedSize||0)+t._getSize([wm(d="".concat(t.cacheLog)).call(d,h)]),t._setCachedSize(),t.preCacheTime=Date.now(),r()}catch(p){var f;if(!e)return n(p);t.cacheLog+=wm(f="\n\n".concat(t.logId,": ")).call(f,e),t.logId++,n(p)}},a.onerror=function(r){var i;if(!e)return n(r);t.cacheLog+=wm(i="\n\n".concat(t.logId,": ")).call(i,e),t.logId++,n(r)}}))}},{key:"get",value:function(e){var t=this;return new X_((function(r,n){var i=t._getStore("readonly");if(!i)return n();var o=i.get(e);o.onsuccess=function(){r(o.result)},o.onerror=function(e){n(e)}}))}},{key:"del",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.storeKey;return new X_((function(r,n){var i=e._getStore("readwrite");if(!i)return n();var o=i.delete(t);o.onsuccess=function(){return r(o.result)},o.onerror=function(e){return n(e)}}))}},{key:"keyEarliest",value:function(){return yC(this).call(this).then((function(e){var t,r=Date.now();return e.forEach((function(e){if(e&&e.length){var n=e.split("-")[0];Number(n)<r&&(r=Number(n),t=e)}})),t}))}},{key:"keys",value:function(){var e=this;return new X_((function(t,r){var n=e._getStore("readonly");if(!n)return r();if(n.getAllKeys){var i=n.getAllKeys();return i.onsuccess=function(){t(i.result)},void(i.onerror=function(){r()})}var o=[];n.openCursor().onsuccess=function(){this.result&&(o.push(this.result.key),this.result.continue())},n.transaction.oncomplete=function(){return t(o)}}))}},{key:"values",value:function(){var e=this;return new X_((function(t,r){var n=e._getStore("readonly");if(!n)return r();if(n.getAll){var i=n.getAll();return i.onsuccess=function(){t(i.result)},void(i.onerror=function(){r()})}var o=[];n.openCursor().onsuccess=function(){this.result&&(o.push(this.result.value),this.result.continue())},n.transaction.oncomplete=function(){return t(o)}}))}},{key:"download",value:function(e){e=e||this.storeKey,this.get(e).then((function(t){var r=document.createElement("a");r.download="".concat(e,".txt"),r.href="data:text/paint;utf-8,"+(t||""),r.click()}))}}]),e}(),kC=new bC,TC="[VERTC]",IC=["#0050b3","#0050b3","#0050b3","#0050b3","#0050b3"],AC=!uw()&&Jm(dC=window.location.search).call(dC,"_rtc_debug_"),RC=function(){function e(t,r,n){Wd(this,e),sd(this,"_indent",void 0),sd(this,"_module",void 0),sd(this,"_id",void 0),this._module=t,this._indent=r}return qd(e,[{key:"print",value:function(e){for(var t,r,n,i,o,a,s,c=arguments.length,u=new Array(c>1?c-1:0),d=1;d<c;d++)u[d-1]=arguments[d];var l=u.shift();try{var h,f,p,v,_=wm(h=[]).call(h,u),m="".concat(l).replace(/\%o/gi,(function(){var e=_.shift();return vk(e)}));kC.set(wm(f=wm(p=wm(v="".concat(TC,"[").concat(this._module,".")).call(v,e,"] ")).call(p,m," ")).call(f,lk(_).call(_,(function(e){return vk(e)})).join(", ")))}catch(mW){}if(AC){for(var g="",y=0;y<this._indent;y++)g+=" ";(t=console).log.apply(t,wm(r=[wm(n=wm(i=wm(o=wm(a=wm(s="%c".concat(wC(),"-")).call(s,TC)).call(a,g,"[")).call(o,this._module,".")).call(i,e,"] ")).call(n,l),"color:".concat(IC[this._indent],";")]).call(r,u))}}}]),e}(),wC=function(){var e=new Date;return e.toTimeString().split(" ")[0]+":"+e.getMilliseconds()},CC=new RC("VERTC",0),OC=function(e){OI(r,e);var t=qI(r);function r(){return Wd(this,r),t.apply(this,arguments)}return qd(r,[{key:"safeEmit",value:function(e){var t=this.listenerCount(e);try{for(var n,i,o=arguments.length,a=new Array(o>1?o-1:0),s=1;s<o;s++)a[s-1]=arguments[s];return(n=wI(AI(r.prototype),"emit",this)).call.apply(n,wm(i=[this,e]).call(i,a))}catch(mW){return CC.print("safeEmit","safeEmit() | event listener threw an error [event:%s]:%o",e,mW),console.error(mW),Boolean(t)}}}]),r}(uC.exports.EventEmitter),xC=x,DC=tr,PC=$,NC=eI,MC=Qt,LC=R,UC=mc,VC=V;Rr({target:"Reflect",stat:!0,forced:i((function(){var e=function(){},t=MC.f(new e,"a",{configurable:!0});return!1!==Reflect.set(e.prototype,"a",1,t)}))},{set:function e(t,r,n){var i,o,a,s=arguments.length<4?t:arguments[3],c=LC.f(DC(t),r);if(!c){if(PC(o=UC(t)))return e(o,r,n,s);c=VC(0)}if(NC(c)){if(!1===c.writable||!PC(s))return!1;if(i=LC.f(s,r)){if(i.get||i.set||!1===i.writable)return!1;i.value=n,MC.f(s,r,i)}else MC.f(s,r,VC(0,n))}else{if(void 0===(a=c.set))return!1;xC(a,s,n)}return!0}});var FC=ee.Reflect.set,BC={};!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=Sm(Array.prototype).call(arguments,1);t.length;){var n=t.shift();if(n){if("object"!==Ml(n))throw new TypeError(n+"must be non-object");for(var i in n)r(n,i)&&(e[i]=n[i])}}return e},e.shrinkBuf=function(e,t){return e.length===t?e:e.subarray?e.subarray(0,t):(e.length=t,e)};var n={arraySet:function(e,t,r,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}},i={arraySet:function(e,t,r,n,i){for(var o=0;o<n;o++)e[i+o]=t[r+o]},flattenChunks:function(e){return wm([]).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,i))},e.setTyped(t)}(BC);var jC={},GC={},HC={},zC=BC;function KC(e){for(var t=e.length;--t>=0;)e[t]=0}var XC=256,qC=286,WC=30,YC=15,QC=[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],JC=[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],ZC=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],$C=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],eO=new Array(576);KC(eO);var tO=new Array(60);KC(tO);var rO=new Array(512);KC(rO);var nO=new Array(256);KC(nO);var iO=new Array(29);KC(iO);var oO,aO,sO,cO=new Array(WC);function uO(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 dO(e,t){this.dyn_tree=e,this.max_code=0,this.stat_desc=t}function lO(e){return e<256?rO[e]:rO[256+(e>>>7)]}function hO(e,t){e.pending_buf[e.pending++]=255&t,e.pending_buf[e.pending++]=t>>>8&255}function fO(e,t,r){e.bi_valid>16-r?(e.bi_buf|=t<<e.bi_valid&65535,hO(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 pO(e,t,r){fO(e,r[2*t],r[2*t+1])}function vO(e,t){var r=0;do{r|=1&e,e>>>=1,r<<=1}while(--t>0);return r>>>1}function _O(e,t,r){var n,i,o=new Array(16),a=0;for(n=1;n<=YC;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]=vO(o[s]++,s))}}function mO(e){var t;for(t=0;t<qC;t++)e.dyn_ltree[2*t]=0;for(t=0;t<WC;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 gO(e){e.bi_valid>8?hO(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 yO(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 SO(e,t,r){for(var n=e.heap[r],i=r<<1;i<=e.heap_len&&(i<e.heap_len&&yO(t,e.heap[i+1],e.heap[i],e.depth)&&i++,!yO(t,n,e.heap[i],e.depth));)e.heap[r]=e.heap[i],r=i,i<<=1;e.heap[r]=n}function EO(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?pO(e,i,t):(pO(e,(o=nO[i])+XC+1,t),0!==(a=QC[o])&&fO(e,i-=iO[o],a),pO(e,o=lO(--n),r),0!==(a=JC[o])&&fO(e,n-=cO[o],a))}while(s<e.last_lit);pO(e,256,t)}function bO(e,t){var r,n,i,o=t.dyn_tree,a=t.stat_desc.static_tree,s=t.stat_desc.has_stree,c=t.stat_desc.elems,u=-1;for(e.heap_len=0,e.heap_max=573,r=0;r<c;r++)0!==o[2*r]?(e.heap[++e.heap_len]=u=r,e.depth[r]=0):o[2*r+1]=0;for(;e.heap_len<2;)o[2*(i=e.heap[++e.heap_len]=u<2?++u:0)]=1,e.depth[i]=0,e.opt_len--,s&&(e.static_len-=a[2*i+1]);for(t.max_code=u,r=e.heap_len>>1;r>=1;r--)SO(e,o,r);i=c;do{r=e.heap[1],e.heap[1]=e.heap[e.heap_len--],SO(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++,SO(e,o,1)}while(e.heap_len>=2);e.heap[--e.heap_max]=e.heap[1],function(e,t){var r,n,i,o,a,s,c=t.dyn_tree,u=t.max_code,d=t.stat_desc.static_tree,l=t.stat_desc.has_stree,h=t.stat_desc.extra_bits,f=t.stat_desc.extra_base,p=t.stat_desc.max_length,v=0;for(o=0;o<=YC;o++)e.bl_count[o]=0;for(c[2*e.heap[e.heap_max]+1]=0,r=e.heap_max+1;r<573;r++)(o=c[2*c[2*(n=e.heap[r])+1]+1]+1)>p&&(o=p,v++),c[2*n+1]=o,n>u||(e.bl_count[o]++,a=0,n>=f&&(a=h[n-f]),s=c[2*n],e.opt_len+=s*(o+a),l&&(e.static_len+=s*(d[2*n+1]+a)));if(0!==v){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]--,v-=2}while(v>0);for(o=p;0!==o;o--)for(n=e.bl_count[o];0!==n;)(i=e.heap[--r])>u||(c[2*i+1]!==o&&(e.opt_len+=(o-c[2*i+1])*c[2*i],c[2*i+1]=o),n--)}}(e,t),_O(o,u,e.bl_count)}function kO(e,t,r){var n,i,o=-1,a=t[1],s=0,c=7,u=4;for(0===a&&(c=138,u=3),t[2*(r+1)+1]=65535,n=0;n<=r;n++)i=a,a=t[2*(n+1)+1],++s<c&&i===a||(s<u?e.bl_tree[2*i]+=s:0!==i?(i!==o&&e.bl_tree[2*i]++,e.bl_tree[32]++):s<=10?e.bl_tree[34]++:e.bl_tree[36]++,s=0,o=i,0===a?(c=138,u=3):i===a?(c=6,u=3):(c=7,u=4))}function TO(e,t,r){var n,i,o=-1,a=t[1],s=0,c=7,u=4;for(0===a&&(c=138,u=3),n=0;n<=r;n++)if(i=a,a=t[2*(n+1)+1],!(++s<c&&i===a)){if(s<u)do{pO(e,i,e.bl_tree)}while(0!=--s);else 0!==i?(i!==o&&(pO(e,i,e.bl_tree),s--),pO(e,16,e.bl_tree),fO(e,s-3,2)):s<=10?(pO(e,17,e.bl_tree),fO(e,s-3,3)):(pO(e,18,e.bl_tree),fO(e,s-11,7));s=0,o=i,0===a?(c=138,u=3):i===a?(c=6,u=3):(c=7,u=4)}}KC(cO);var IO=!1;function AO(e,t,r,n){fO(e,0+(n?1:0),3),function(e,t,r,n){gO(e),n&&(hO(e,r),hO(e,~r)),zC.arraySet(e.pending_buf,e.window,t,r,e.pending),e.pending+=r}(e,t,r,!0)}HC._tr_init=function(e){IO||(!function(){var e,t,r,n,i,o=new Array(16);for(r=0,n=0;n<28;n++)for(iO[n]=r,e=0;e<1<<QC[n];e++)nO[r++]=n;for(nO[r-1]=n,i=0,n=0;n<16;n++)for(cO[n]=i,e=0;e<1<<JC[n];e++)rO[i++]=n;for(i>>=7;n<WC;n++)for(cO[n]=i<<7,e=0;e<1<<JC[n]-7;e++)rO[256+i++]=n;for(t=0;t<=YC;t++)o[t]=0;for(e=0;e<=143;)eO[2*e+1]=8,e++,o[8]++;for(;e<=255;)eO[2*e+1]=9,e++,o[9]++;for(;e<=279;)eO[2*e+1]=7,e++,o[7]++;for(;e<=287;)eO[2*e+1]=8,e++,o[8]++;for(_O(eO,287,o),e=0;e<WC;e++)tO[2*e+1]=5,tO[2*e]=vO(e,5);oO=new uO(eO,QC,257,qC,YC),aO=new uO(tO,JC,0,WC,YC),sO=new uO(new Array(0),ZC,0,19,7)}(),IO=!0),e.l_desc=new dO(e.dyn_ltree,oO),e.d_desc=new dO(e.dyn_dtree,aO),e.bl_desc=new dO(e.bl_tree,sO),e.bi_buf=0,e.bi_valid=0,mO(e)},HC._tr_stored_block=AO,HC._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<XC;t++)if(0!==e.dyn_ltree[2*t])return 1;return 0}(e)),bO(e,e.l_desc),bO(e,e.d_desc),a=function(e){var t;for(kO(e,e.dyn_ltree,e.l_desc.max_code),kO(e,e.dyn_dtree,e.d_desc.max_code),bO(e,e.bl_desc),t=18;t>=3&&0===e.bl_tree[2*$C[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?AO(e,t,r,n):4===e.strategy||o===i?(fO(e,2+(n?1:0),3),EO(e,eO,tO)):(fO(e,4+(n?1:0),3),function(e,t,r,n){var i;for(fO(e,t-257,5),fO(e,r-1,5),fO(e,n-4,4),i=0;i<n;i++)fO(e,e.bl_tree[2*$C[i]+1],3);TO(e,e.dyn_ltree,t-1),TO(e,e.dyn_dtree,r-1)}(e,e.l_desc.max_code+1,e.d_desc.max_code+1,a+1),EO(e,e.dyn_ltree,e.dyn_dtree)),mO(e),n&&gO(e)},HC._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*(nO[r]+XC+1)]++,e.dyn_dtree[2*lO(t)]++),e.last_lit===e.lit_bufsize-1},HC._tr_align=function(e){fO(e,2,3),pO(e,256,eO),function(e){16===e.bi_valid?(hO(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 RO=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 wO=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 CO,OO=function(e,t,r,n){var i=wO,o=n+r;e^=-1;for(var a=n;a<o;a++)e=e>>>8^i[255&(e^t[a])];return-1^e},xO={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"},DO=BC,PO=HC,NO=RO,MO=OO,LO=xO,UO=-2,VO=258,FO=262,BO=103,jO=113,GO=666;function HO(e,t){return e.msg=LO[t],t}function zO(e){return(e<<1)-(e>4?9:0)}function KO(e){for(var t=e.length;--t>=0;)e[t]=0}function XO(e){var t=e.state,r=t.pending;r>e.avail_out&&(r=e.avail_out),0!==r&&(DO.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 qO(e,t){PO._tr_flush_block(e,e.block_start>=0?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,XO(e.strm)}function WO(e,t){e.pending_buf[e.pending++]=t}function YO(e,t){e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=255&t}function QO(e,t){var r,n,i=e.max_chain_length,o=e.strstart,a=e.prev_length,s=e.nice_match,c=e.strstart>e.w_size-FO?e.strstart-(e.w_size-FO):0,u=e.window,d=e.w_mask,l=e.prev,h=e.strstart+VO,f=u[o+a-1],p=u[o+a];e.prev_length>=e.good_match&&(i>>=2),s>e.lookahead&&(s=e.lookahead);do{if(u[(r=t)+a]===p&&u[r+a-1]===f&&u[r]===u[o]&&u[++r]===u[o+1]){o+=2,r++;do{}while(u[++o]===u[++r]&&u[++o]===u[++r]&&u[++o]===u[++r]&&u[++o]===u[++r]&&u[++o]===u[++r]&&u[++o]===u[++r]&&u[++o]===u[++r]&&u[++o]===u[++r]&&o<h);if(n=VO-(h-o),o=h-VO,n>a){if(e.match_start=t,a=n,n>=s)break;f=u[o+a-1],p=u[o+a]}}}while((t=l[t&d])>c&&0!=--i);return a<=e.lookahead?a:e.lookahead}function JO(e){var t,r,n,i,o,a,s,c,u,d,l=e.w_size;do{if(i=e.window_size-e.lookahead-e.strstart,e.strstart>=l+(l-FO)){DO.arraySet(e.window,e.window,l,l,0),e.match_start-=l,e.strstart-=l,e.block_start-=l,t=r=e.hash_size;do{n=e.head[--t],e.head[t]=n>=l?n-l:0}while(--r);t=r=l;do{n=e.prev[--t],e.prev[t]=n>=l?n-l:0}while(--r);i+=l}if(0===e.strm.avail_in)break;if(a=e.strm,s=e.window,c=e.strstart+e.lookahead,u=i,d=void 0,(d=a.avail_in)>u&&(d=u),r=0===d?0:(a.avail_in-=d,DO.arraySet(s,a.input,a.next_in,d,c),1===a.state.wrap?a.adler=NO(a.adler,s,d,c):2===a.state.wrap&&(a.adler=MO(a.adler,s,d,c)),a.next_in+=d,a.total_in+=d,d),e.lookahead+=r,e.lookahead+e.insert>=3)for(o=e.strstart-e.insert,e.ins_h=e.window[o],e.ins_h=(e.ins_h<<e.hash_shift^e.window[o+1])&e.hash_mask;e.insert&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[o+3-1])&e.hash_mask,e.prev[o&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=o,o++,e.insert--,!(e.lookahead+e.insert<3)););}while(e.lookahead<FO&&0!==e.strm.avail_in)}function ZO(e,t){for(var r,n;;){if(e.lookahead<FO){if(JO(e),e.lookahead<FO&&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-FO&&(e.match_length=QO(e,r)),e.match_length>=3)if(n=PO._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=PO._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++;if(n&&(qO(e,!1),0===e.strm.avail_out))return 1}return e.insert=e.strstart<2?e.strstart:2,4===t?(qO(e,!0),0===e.strm.avail_out?3:4):e.last_lit&&(qO(e,!1),0===e.strm.avail_out)?1:2}function $O(e,t){for(var r,n,i;;){if(e.lookahead<FO){if(JO(e),e.lookahead<FO&&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-FO&&(e.match_length=QO(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=PO._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&&(qO(e,!1),0===e.strm.avail_out))return 1}else if(e.match_available){if((n=PO._tr_tally(e,0,e.window[e.strstart-1]))&&qO(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=PO._tr_tally(e,0,e.window[e.strstart-1]),e.match_available=0),e.insert=e.strstart<2?e.strstart:2,4===t?(qO(e,!0),0===e.strm.avail_out?3:4):e.last_lit&&(qO(e,!1),0===e.strm.avail_out)?1:2}function ex(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 tx(){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 DO.Buf16(1146),this.dyn_dtree=new DO.Buf16(122),this.bl_tree=new DO.Buf16(78),KO(this.dyn_ltree),KO(this.dyn_dtree),KO(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new DO.Buf16(16),this.heap=new DO.Buf16(573),KO(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new DO.Buf16(573),KO(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 rx(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:jO,e.adler=2===t.wrap?0:1,t.last_flush=0,PO._tr_init(t),0):HO(e,UO)}function nx(e){var t,r=rx(e);return 0===r&&((t=e.state).window_size=2*t.w_size,KO(t.head),t.max_lazy_match=CO[t.level].max_lazy,t.good_match=CO[t.level].good_length,t.nice_match=CO[t.level].nice_length,t.max_chain_length=CO[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 ix(e,t,r,n,i,o){if(!e)return UO;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 HO(e,UO);8===n&&(n=9);var s=new tx;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 DO.Buf8(2*s.w_size),s.head=new DO.Buf16(s.hash_size),s.prev=new DO.Buf16(s.w_size),s.lit_bufsize=1<<i+6,s.pending_buf_size=4*s.lit_bufsize,s.pending_buf=new DO.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,nx(e)}CO=[new ex(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(JO(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,qO(e,!1),0===e.strm.avail_out))return 1;if(e.strstart-e.block_start>=e.w_size-FO&&(qO(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,4===t?(qO(e,!0),0===e.strm.avail_out?3:4):(e.strstart>e.block_start&&(qO(e,!1),e.strm.avail_out),1)})),new ex(4,4,8,4,ZO),new ex(4,5,16,8,ZO),new ex(4,6,32,32,ZO),new ex(4,4,16,16,$O),new ex(8,16,32,32,$O),new ex(8,16,128,128,$O),new ex(8,32,128,256,$O),new ex(32,128,258,1024,$O),new ex(32,258,258,4096,$O)],GC.deflateInit=function(e,t){return ix(e,t,8,15,8,0)},GC.deflateInit2=ix,GC.deflateReset=nx,GC.deflateResetKeep=rx,GC.deflateSetHeader=function(e,t){return e&&e.state?2!==e.state.wrap?UO:(e.state.gzhead=t,0):UO},GC.deflate=function(e,t){var r,n,i,o;if(!e||!e.state||t>5||t<0)return e?HO(e,UO):UO;if(n=e.state,!e.output||!e.input&&0!==e.avail_in||n.status===GO&&4!==t)return HO(e,0===e.avail_out?-5:UO);if(n.strm=e,r=n.last_flush,n.last_flush=t,42===n.status)if(2===n.wrap)e.adler=0,WO(n,31),WO(n,139),WO(n,8),n.gzhead?(WO(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)),WO(n,255&n.gzhead.time),WO(n,n.gzhead.time>>8&255),WO(n,n.gzhead.time>>16&255),WO(n,n.gzhead.time>>24&255),WO(n,9===n.level?2:n.strategy>=2||n.level<2?4:0),WO(n,255&n.gzhead.os),n.gzhead.extra&&n.gzhead.extra.length&&(WO(n,255&n.gzhead.extra.length),WO(n,n.gzhead.extra.length>>8&255)),n.gzhead.hcrc&&(e.adler=MO(e.adler,n.pending_buf,n.pending,0)),n.gzindex=0,n.status=69):(WO(n,0),WO(n,0),WO(n,0),WO(n,0),WO(n,0),WO(n,9===n.level?2:n.strategy>=2||n.level<2?4:0),WO(n,3),n.status=jO);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=jO,YO(n,a),0!==n.strstart&&(YO(n,e.adler>>>16),YO(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=MO(e.adler,n.pending_buf,n.pending-i,i)),XO(e),i=n.pending,n.pending!==n.pending_buf_size));)WO(n,255&n.gzhead.extra[n.gzindex]),n.gzindex++;n.gzhead.hcrc&&n.pending>i&&(e.adler=MO(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=MO(e.adler,n.pending_buf,n.pending-i,i)),XO(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,WO(n,o)}while(0!==o);n.gzhead.hcrc&&n.pending>i&&(e.adler=MO(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=MO(e.adler,n.pending_buf,n.pending-i,i)),XO(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,WO(n,o)}while(0!==o);n.gzhead.hcrc&&n.pending>i&&(e.adler=MO(e.adler,n.pending_buf,n.pending-i,i)),0===o&&(n.status=BO)}else n.status=BO;if(n.status===BO&&(n.gzhead.hcrc?(n.pending+2>n.pending_buf_size&&XO(e),n.pending+2<=n.pending_buf_size&&(WO(n,255&e.adler),WO(n,e.adler>>8&255),e.adler=0,n.status=jO)):n.status=jO),0!==n.pending){if(XO(e),0===e.avail_out)return n.last_flush=-1,0}else if(0===e.avail_in&&zO(t)<=zO(r)&&4!==t)return HO(e,-5);if(n.status===GO&&0!==e.avail_in)return HO(e,-5);if(0!==e.avail_in||0!==n.lookahead||0!==t&&n.status!==GO){var s=2===n.strategy?function(e,t){for(var r;;){if(0===e.lookahead&&(JO(e),0===e.lookahead)){if(0===t)return 1;break}if(e.match_length=0,r=PO._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,r&&(qO(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,4===t?(qO(e,!0),0===e.strm.avail_out?3:4):e.last_lit&&(qO(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<=VO){if(JO(e),e.lookahead<=VO&&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+VO;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=VO-(o-i),e.match_length>e.lookahead&&(e.match_length=e.lookahead)}if(e.match_length>=3?(r=PO._tr_tally(e,1,e.match_length-3),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(r=PO._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),r&&(qO(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,4===t?(qO(e,!0),0===e.strm.avail_out?3:4):e.last_lit&&(qO(e,!1),0===e.strm.avail_out)?1:2}(n,t):CO[n.level].func(n,t);if(3!==s&&4!==s||(n.status=GO),1===s||3===s)return 0===e.avail_out&&(n.last_flush=-1),0;if(2===s&&(1===t?PO._tr_align(n):5!==t&&(PO._tr_stored_block(n,0,0,!1),3===t&&(KO(n.head),0===n.lookahead&&(n.strstart=0,n.block_start=0,n.insert=0))),XO(e),0===e.avail_out))return n.last_flush=-1,0}return 4!==t?0:n.wrap<=0?1:(2===n.wrap?(WO(n,255&e.adler),WO(n,e.adler>>8&255),WO(n,e.adler>>16&255),WO(n,e.adler>>24&255),WO(n,255&e.total_in),WO(n,e.total_in>>8&255),WO(n,e.total_in>>16&255),WO(n,e.total_in>>24&255)):(YO(n,e.adler>>>16),YO(n,65535&e.adler)),XO(e),n.wrap>0&&(n.wrap=-n.wrap),0!==n.pending?0:1)},GC.deflateEnd=function(e){var t;return e&&e.state?42!==(t=e.state.status)&&69!==t&&73!==t&&91!==t&&t!==BO&&t!==jO&&t!==GO?HO(e,UO):(e.state=null,t===jO?HO(e,-3):0):UO},GC.deflateSetDictionary=function(e,t){var r,n,i,o,a,s,c,u,d=t.length;if(!e||!e.state)return UO;if(2===(o=(r=e.state).wrap)||1===o&&42!==r.status||r.lookahead)return UO;for(1===o&&(e.adler=NO(e.adler,t,d,0)),r.wrap=0,d>=r.w_size&&(0===o&&(KO(r.head),r.strstart=0,r.block_start=0,r.insert=0),u=new DO.Buf8(r.w_size),DO.arraySet(u,t,d-r.w_size,r.w_size,0),t=u,d=r.w_size),a=e.avail_in,s=e.next_in,c=e.input,e.avail_in=d,e.next_in=0,e.input=t,JO(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,JO(r)}return r.strstart+=r.lookahead,r.block_start=r.strstart,r.insert=r.lookahead,r.lookahead=0,r.match_length=r.prev_length=2,r.match_available=0,e.next_in=s,e.input=c,e.avail_in=a,r.wrap=o,0},GC.deflateInfo="pako deflate (from Nodeca project)";var ox={},ax=BC,sx=!0,cx=!0;try{String.fromCharCode.apply(null,[0])}catch(gW){sx=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(gW){cx=!1}for(var ux=new ax.Buf8(256),dx=0;dx<256;dx++)ux[dx]=dx>=252?6:dx>=248?5:dx>=240?4:dx>=224?3:dx>=192?2:1;function lx(e,t){if(t<65534&&(e.subarray&&cx||!e.subarray&&sx))return String.fromCharCode.apply(null,ax.shrinkBuf(e,t));for(var r="",n=0;n<t;n++)r+=String.fromCharCode(e[n]);return r}ux[254]=ux[254]=1,ox.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 ax.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},ox.buf2binstring=function(e){return lx(e,e.length)},ox.binstring2buf=function(e){for(var t=new ax.Buf8(e.length),r=0,n=t.length;r<n;r++)t[r]=e.charCodeAt(r);return t},ox.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=ux[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 lx(s,n)},ox.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+ux[e[r]]>t?r:t};var hx=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},fx=GC,px=BC,vx=ox,_x=xO,mx=hx,gx=Object.prototype.toString;function yx(e){if(!(this instanceof yx))return new yx(e);this.options=px.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 mx,this.strm.avail_out=0;var r=fx.deflateInit2(this.strm,t.level,t.method,t.windowBits,t.memLevel,t.strategy);if(0!==r)throw new Error(_x[r]);if(t.header&&fx.deflateSetHeader(this.strm,t.header),t.dictionary){var n;if(n="string"==typeof t.dictionary?vx.string2buf(t.dictionary):"[object ArrayBuffer]"===gx.call(t.dictionary)?new Uint8Array(t.dictionary):t.dictionary,0!==(r=fx.deflateSetDictionary(this.strm,n)))throw new Error(_x[r]);this._dict_set=!0}}function Sx(e,t){var r=new yx(t);if(r.push(e,!0),r.err)throw r.msg||_x[r.err];return r.result}yx.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=vx.string2buf(e):"[object ArrayBuffer]"===gx.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 px.Buf8(o),i.next_out=0,i.avail_out=o),1!==(r=fx.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(vx.buf2binstring(px.shrinkBuf(i.output,i.next_out))):this.onData(px.shrinkBuf(i.output,i.next_out)))}while((i.avail_in>0||0===i.avail_out)&&1!==r);return 4===n?(r=fx.deflateEnd(this.strm),this.onEnd(r),this.ended=!0,0===r):2!==n||(this.onEnd(0),i.avail_out=0,!0)},yx.prototype.onData=function(e){this.chunks.push(e)},yx.prototype.onEnd=function(e){0===e&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=px.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg},jC.Deflate=yx,jC.deflate=Sx,jC.deflateRaw=function(e,t){return(t=t||{}).raw=!0,Sx(e,t)},jC.gzip=function(e,t){return(t=t||{}).gzip=!0,Sx(e,t)};var Ex={},bx=tr,kx=x,Tx=Ye,Ix=ae,Ax=function(){var e=bx(this),t="";return e.hasIndices&&(t+="d"),e.global&&(t+="g"),e.ignoreCase&&(t+="i"),e.multiline&&(t+="m"),e.dotAll&&(t+="s"),e.unicode&&(t+="u"),e.unicodeSets&&(t+="v"),e.sticky&&(t+="y"),t},Rx=RegExp.prototype,wx=ae,Cx=function(e){var t=e.flags;return void 0!==t||"flags"in Rx||Tx(e,"flags")||!Ix(Rx,e)?t:kx(Ax,e)},Ox=RegExp.prototype,xx=function(e){return e===Ox||wx(Ox,e)?Cx(e):e.flags},Dx={},Px=BC,Nx=15,Mx=[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],Lx=[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],Ux=[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],Vx=[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],Fx=BC,Bx=RO,jx=OO,Gx=function(e,t){var r,n,i,o,a,s,c,u,d,l,h,f,p,v,_,m,g,y,S,E,b,k,T,I,A;r=e.state,n=e.next_in,I=e.input,i=n+(e.avail_in-5),o=e.next_out,A=e.output,a=o-(t-e.avail_out),s=o+(e.avail_out-257),c=r.dmax,u=r.wsize,d=r.whave,l=r.wnext,h=r.window,f=r.hold,p=r.bits,v=r.lencode,_=r.distcode,m=(1<<r.lenbits)-1,g=(1<<r.distbits)-1;e:do{p<15&&(f+=I[n++]<<p,p+=8,f+=I[n++]<<p,p+=8),y=v[f&m];t:for(;;){if(f>>>=S=y>>>24,p-=S,0===(S=y>>>16&255))A[o++]=65535&y;else{if(!(16&S)){if(0==(64&S)){y=v[(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}E=65535&y,(S&=15)&&(p<S&&(f+=I[n++]<<p,p+=8),E+=f&(1<<S)-1,f>>>=S,p-=S),p<15&&(f+=I[n++]<<p,p+=8,f+=I[n++]<<p,p+=8),y=_[f&g];r:for(;;){if(f>>>=S=y>>>24,p-=S,!(16&(S=y>>>16&255))){if(0==(64&S)){y=_[(65535&y)+(f&(1<<S)-1)];continue r}e.msg="invalid distance code",r.mode=30;break e}if(b=65535&y,p<(S&=15)&&(f+=I[n++]<<p,(p+=8)<S&&(f+=I[n++]<<p,p+=8)),(b+=f&(1<<S)-1)>c){e.msg="invalid distance too far back",r.mode=30;break e}if(f>>>=S,p-=S,b>(S=o-a)){if((S=b-S)>d&&r.sane){e.msg="invalid distance too far back",r.mode=30;break e}if(k=0,T=h,0===l){if(k+=u-S,S<E){E-=S;do{A[o++]=h[k++]}while(--S);k=o-b,T=A}}else if(l<S){if(k+=u+l-S,(S-=l)<E){E-=S;do{A[o++]=h[k++]}while(--S);if(k=0,l<E){E-=S=l;do{A[o++]=h[k++]}while(--S);k=o-b,T=A}}}else if(k+=l-S,S<E){E-=S;do{A[o++]=h[k++]}while(--S);k=o-b,T=A}for(;E>2;)A[o++]=T[k++],A[o++]=T[k++],A[o++]=T[k++],E-=3;E&&(A[o++]=T[k++],E>1&&(A[o++]=T[k++]))}else{k=o-b;do{A[o++]=A[k++],A[o++]=A[k++],A[o++]=A[k++],E-=3}while(E>2);E&&(A[o++]=A[k++],E>1&&(A[o++]=A[k++]))}break}}break}}while(n<i&&o<s);n-=E=p>>3,f&=(1<<(p-=E<<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},Hx=function(e,t,r,n,i,o,a,s){var c,u,d,l,h,f,p,v,_,m=s.bits,g=0,y=0,S=0,E=0,b=0,k=0,T=0,I=0,A=0,R=0,w=null,C=0,O=new Px.Buf16(16),x=new Px.Buf16(16),D=null,P=0;for(g=0;g<=Nx;g++)O[g]=0;for(y=0;y<n;y++)O[t[r+y]]++;for(b=m,E=Nx;E>=1&&0===O[E];E--);if(b>E&&(b=E),0===E)return i[o++]=20971520,i[o++]=20971520,s.bits=1,0;for(S=1;S<E&&0===O[S];S++);for(b<S&&(b=S),I=1,g=1;g<=Nx;g++)if(I<<=1,(I-=O[g])<0)return-1;if(I>0&&(0===e||1!==E))return-1;for(x[1]=0,g=1;g<Nx;g++)x[g+1]=x[g]+O[g];for(y=0;y<n;y++)0!==t[r+y]&&(a[x[t[r+y]]++]=y);if(0===e?(w=D=a,f=19):1===e?(w=Mx,C-=257,D=Lx,P-=257,f=256):(w=Ux,D=Vx,f=-1),R=0,y=0,g=S,h=o,k=b,T=0,d=-1,l=(A=1<<b)-1,1===e&&A>852||2===e&&A>592)return 1;for(;;){p=g-T,a[y]<f?(v=0,_=a[y]):a[y]>f?(v=D[P+a[y]],_=w[C+a[y]]):(v=96,_=0),c=1<<g-T,S=u=1<<k;do{i[h+(R>>T)+(u-=c)]=p<<24|v<<16|_|0}while(0!==u);for(c=1<<g-1;R&c;)c>>=1;if(0!==c?(R&=c-1,R+=c):R=0,y++,0==--O[g]){if(g===E)break;g=t[r+a[y]]}if(g>b&&(R&l)!==d){for(0===T&&(T=b),h+=S,I=1<<(k=g-T);k+T<E&&!((I-=O[k+T])<=0);)k++,I<<=1;if(A+=1<<k,1===e&&A>852||2===e&&A>592)return 1;i[d=R&l]=b<<24|k<<16|h-o|0}}return 0!==R&&(i[h+R]=g-T<<24|64<<16|0),s.bits=b,0},zx=-2,Kx=12,Xx=30;function qx(e){return(e>>>24&255)+(e>>>8&65280)+((65280&e)<<8)+((255&e)<<24)}function Wx(){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 Fx.Buf16(320),this.work=new Fx.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function Yx(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 Fx.Buf32(852),t.distcode=t.distdyn=new Fx.Buf32(592),t.sane=1,t.back=-1,0):zx}function Qx(e){var t;return e&&e.state?((t=e.state).wsize=0,t.whave=0,t.wnext=0,Yx(e)):zx}function Jx(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)?zx:(null!==n.window&&n.wbits!==t&&(n.window=null),n.wrap=r,n.wbits=t,Qx(e))):zx}function Zx(e,t){var r,n;return e?(n=new Wx,e.state=n,n.window=null,0!==(r=Jx(e,t))&&(e.state=null),r):zx}var $x,eD,tD=!0;function rD(e){if(tD){var t;for($x=new Fx.Buf32(512),eD=new Fx.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(Hx(1,e.lens,0,288,$x,0,e.work,{bits:9}),t=0;t<32;)e.lens[t++]=5;Hx(2,e.lens,0,32,eD,0,e.work,{bits:5}),tD=!1}e.lencode=$x,e.lenbits=9,e.distcode=eD,e.distbits=5}function nD(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 Fx.Buf8(o.wsize)),n>=o.wsize?(Fx.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),Fx.arraySet(o.window,t,r-n,i,o.wnext),(n-=i)?(Fx.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}Dx.inflateReset=Qx,Dx.inflateReset2=Jx,Dx.inflateResetKeep=Yx,Dx.inflateInit=function(e){return Zx(e,15)},Dx.inflateInit2=Zx,Dx.inflate=function(e,t){var r,n,i,o,a,s,c,u,d,l,h,f,p,v,_,m,g,y,S,E,b,k,T,I,A=0,R=new Fx.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 zx;(r=e.state).mode===Kx&&(r.mode=13),a=e.next_out,i=e.output,c=e.avail_out,o=e.next_in,n=e.input,s=e.avail_in,u=r.hold,d=r.bits,l=s,h=c,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--,u+=n[o++]<<d,d+=8}if(2&r.wrap&&35615===u){r.check=0,R[0]=255&u,R[1]=u>>>8&255,r.check=jx(r.check,R,2,0),u=0,d=0,r.mode=2;break}if(r.flags=0,r.head&&(r.head.done=!1),!(1&r.wrap)||(((255&u)<<8)+(u>>8))%31){e.msg="incorrect header check",r.mode=Xx;break}if(8!=(15&u)){e.msg="unknown compression method",r.mode=Xx;break}if(d-=4,b=8+(15&(u>>>=4)),0===r.wbits)r.wbits=b;else if(b>r.wbits){e.msg="invalid window size",r.mode=Xx;break}r.dmax=1<<b,e.adler=r.check=1,r.mode=512&u?10:Kx,u=0,d=0;break;case 2:for(;d<16;){if(0===s)break e;s--,u+=n[o++]<<d,d+=8}if(r.flags=u,8!=(255&xx(r))){e.msg="unknown compression method",r.mode=Xx;break}if(57344&xx(r)){e.msg="unknown header flags set",r.mode=Xx;break}r.head&&(r.head.text=u>>8&1),512&xx(r)&&(R[0]=255&u,R[1]=u>>>8&255,r.check=jx(r.check,R,2,0)),u=0,d=0,r.mode=3;case 3:for(;d<32;){if(0===s)break e;s--,u+=n[o++]<<d,d+=8}r.head&&(r.head.time=u),512&xx(r)&&(R[0]=255&u,R[1]=u>>>8&255,R[2]=u>>>16&255,R[3]=u>>>24&255,r.check=jx(r.check,R,4,0)),u=0,d=0,r.mode=4;case 4:for(;d<16;){if(0===s)break e;s--,u+=n[o++]<<d,d+=8}r.head&&(r.head.xflags=255&u,r.head.os=u>>8),512&xx(r)&&(R[0]=255&u,R[1]=u>>>8&255,r.check=jx(r.check,R,2,0)),u=0,d=0,r.mode=5;case 5:if(1024&xx(r)){for(;d<16;){if(0===s)break e;s--,u+=n[o++]<<d,d+=8}r.length=u,r.head&&(r.head.extra_len=u),512&xx(r)&&(R[0]=255&u,R[1]=u>>>8&255,r.check=jx(r.check,R,2,0)),u=0,d=0}else r.head&&(r.head.extra=null);r.mode=6;case 6:if(1024&xx(r)&&((f=r.length)>s&&(f=s),f&&(r.head&&(b=r.head.extra_len-r.length,r.head.extra||(r.head.extra=new Array(r.head.extra_len)),Fx.arraySet(r.head.extra,n,o,f,b)),512&xx(r)&&(r.check=jx(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&xx(r)){if(0===s)break e;f=0;do{b=n[o+f++],r.head&&b&&r.length<65536&&(r.head.name+=String.fromCharCode(b))}while(b&&f<s);if(512&xx(r)&&(r.check=jx(r.check,n,f,o)),s-=f,o+=f,b)break e}else r.head&&(r.head.name=null);r.length=0,r.mode=8;case 8:if(4096&xx(r)){if(0===s)break e;f=0;do{b=n[o+f++],r.head&&b&&r.length<65536&&(r.head.comment+=String.fromCharCode(b))}while(b&&f<s);if(512&xx(r)&&(r.check=jx(r.check,n,f,o)),s-=f,o+=f,b)break e}else r.head&&(r.head.comment=null);r.mode=9;case 9:if(512&xx(r)){for(;d<16;){if(0===s)break e;s--,u+=n[o++]<<d,d+=8}if(u!==(65535&r.check)){e.msg="header crc mismatch",r.mode=Xx;break}u=0,d=0}r.head&&(r.head.hcrc=xx(r)>>9&1,r.head.done=!0),e.adler=r.check=0,r.mode=Kx;break;case 10:for(;d<32;){if(0===s)break e;s--,u+=n[o++]<<d,d+=8}e.adler=r.check=qx(u),u=0,d=0,r.mode=11;case 11:if(0===r.havedict)return e.next_out=a,e.avail_out=c,e.next_in=o,e.avail_in=s,r.hold=u,r.bits=d,2;e.adler=r.check=1,r.mode=Kx;case Kx:if(5===t||6===t)break e;case 13:if(r.last){u>>>=7&d,d-=7&d,r.mode=27;break}for(;d<3;){if(0===s)break e;s--,u+=n[o++]<<d,d+=8}switch(r.last=1&u,d-=1,3&(u>>>=1)){case 0:r.mode=14;break;case 1:if(rD(r),r.mode=20,6===t){u>>>=2,d-=2;break e}break;case 2:r.mode=17;break;case 3:e.msg="invalid block type",r.mode=Xx}u>>>=2,d-=2;break;case 14:for(u>>>=7&d,d-=7&d;d<32;){if(0===s)break e;s--,u+=n[o++]<<d,d+=8}if((65535&u)!=(u>>>16^65535)){e.msg="invalid stored block lengths",r.mode=Xx;break}if(r.length=65535&u,u=0,d=0,r.mode=15,6===t)break e;case 15:r.mode=16;case 16:if(f=r.length){if(f>s&&(f=s),f>c&&(f=c),0===f)break e;Fx.arraySet(i,n,o,f,a),s-=f,o+=f,c-=f,a+=f,r.length-=f;break}r.mode=Kx;break;case 17:for(;d<14;){if(0===s)break e;s--,u+=n[o++]<<d,d+=8}if(r.nlen=257+(31&u),u>>>=5,d-=5,r.ndist=1+(31&u),u>>>=5,d-=5,r.ncode=4+(15&u),u>>>=4,d-=4,r.nlen>286||r.ndist>30){e.msg="too many length or distance symbols",r.mode=Xx;break}r.have=0,r.mode=18;case 18:for(;r.have<r.ncode;){for(;d<3;){if(0===s)break e;s--,u+=n[o++]<<d,d+=8}r.lens[w[r.have++]]=7&u,u>>>=3,d-=3}for(;r.have<19;)r.lens[w[r.have++]]=0;if(r.lencode=r.lendyn,r.lenbits=7,T={bits:r.lenbits},k=Hx(0,r.lens,0,19,r.lencode,0,r.work,T),r.lenbits=T.bits,k){e.msg="invalid code lengths set",r.mode=Xx;break}r.have=0,r.mode=19;case 19:for(;r.have<r.nlen+r.ndist;){for(;m=(A=r.lencode[u&(1<<r.lenbits)-1])>>>16&255,g=65535&A,!((_=A>>>24)<=d);){if(0===s)break e;s--,u+=n[o++]<<d,d+=8}if(g<16)u>>>=_,d-=_,r.lens[r.have++]=g;else{if(16===g){for(I=_+2;d<I;){if(0===s)break e;s--,u+=n[o++]<<d,d+=8}if(u>>>=_,d-=_,0===r.have){e.msg="invalid bit length repeat",r.mode=Xx;break}b=r.lens[r.have-1],f=3+(3&u),u>>>=2,d-=2}else if(17===g){for(I=_+3;d<I;){if(0===s)break e;s--,u+=n[o++]<<d,d+=8}d-=_,b=0,f=3+(7&(u>>>=_)),u>>>=3,d-=3}else{for(I=_+7;d<I;){if(0===s)break e;s--,u+=n[o++]<<d,d+=8}d-=_,b=0,f=11+(127&(u>>>=_)),u>>>=7,d-=7}if(r.have+f>r.nlen+r.ndist){e.msg="invalid bit length repeat",r.mode=Xx;break}for(;f--;)r.lens[r.have++]=b}}if(r.mode===Xx)break;if(0===r.lens[256]){e.msg="invalid code -- missing end-of-block",r.mode=Xx;break}if(r.lenbits=9,T={bits:r.lenbits},k=Hx(1,r.lens,0,r.nlen,r.lencode,0,r.work,T),r.lenbits=T.bits,k){e.msg="invalid literal/lengths set",r.mode=Xx;break}if(r.distbits=6,r.distcode=r.distdyn,T={bits:r.distbits},k=Hx(2,r.lens,r.nlen,r.ndist,r.distcode,0,r.work,T),r.distbits=T.bits,k){e.msg="invalid distances set",r.mode=Xx;break}if(r.mode=20,6===t)break e;case 20:r.mode=21;case 21:if(s>=6&&c>=258){e.next_out=a,e.avail_out=c,e.next_in=o,e.avail_in=s,r.hold=u,r.bits=d,Gx(e,h),a=e.next_out,i=e.output,c=e.avail_out,o=e.next_in,n=e.input,s=e.avail_in,u=r.hold,d=r.bits,r.mode===Kx&&(r.back=-1);break}for(r.back=0;m=(A=r.lencode[u&(1<<r.lenbits)-1])>>>16&255,g=65535&A,!((_=A>>>24)<=d);){if(0===s)break e;s--,u+=n[o++]<<d,d+=8}if(m&&0==(240&m)){for(y=_,S=m,E=g;m=(A=r.lencode[E+((u&(1<<y+S)-1)>>y)])>>>16&255,g=65535&A,!(y+(_=A>>>24)<=d);){if(0===s)break e;s--,u+=n[o++]<<d,d+=8}u>>>=y,d-=y,r.back+=y}if(u>>>=_,d-=_,r.back+=_,r.length=g,0===m){r.mode=26;break}if(32&m){r.back=-1,r.mode=Kx;break}if(64&m){e.msg="invalid literal/length code",r.mode=Xx;break}r.extra=15&m,r.mode=22;case 22:if(r.extra){for(I=r.extra;d<I;){if(0===s)break e;s--,u+=n[o++]<<d,d+=8}r.length+=u&(1<<r.extra)-1,u>>>=r.extra,d-=r.extra,r.back+=r.extra}r.was=r.length,r.mode=23;case 23:for(;m=(A=r.distcode[u&(1<<r.distbits)-1])>>>16&255,g=65535&A,!((_=A>>>24)<=d);){if(0===s)break e;s--,u+=n[o++]<<d,d+=8}if(0==(240&m)){for(y=_,S=m,E=g;m=(A=r.distcode[E+((u&(1<<y+S)-1)>>y)])>>>16&255,g=65535&A,!(y+(_=A>>>24)<=d);){if(0===s)break e;s--,u+=n[o++]<<d,d+=8}u>>>=y,d-=y,r.back+=y}if(u>>>=_,d-=_,r.back+=_,64&m){e.msg="invalid distance code",r.mode=Xx;break}r.offset=g,r.extra=15&m,r.mode=24;case 24:if(r.extra){for(I=r.extra;d<I;){if(0===s)break e;s--,u+=n[o++]<<d,d+=8}r.offset+=u&(1<<r.extra)-1,u>>>=r.extra,d-=r.extra,r.back+=r.extra}if(r.offset>r.dmax){e.msg="invalid distance too far back",r.mode=Xx;break}r.mode=25;case 25:if(0===c)break e;if(f=h-c,r.offset>f){if((f=r.offset-f)>r.whave&&r.sane){e.msg="invalid distance too far back",r.mode=Xx;break}f>r.wnext?(f-=r.wnext,p=r.wsize-f):p=r.wnext-f,f>r.length&&(f=r.length),v=r.window}else v=i,p=a-r.offset,f=r.length;f>c&&(f=c),c-=f,r.length-=f;do{i[a++]=v[p++]}while(--f);0===r.length&&(r.mode=21);break;case 26:if(0===c)break e;i[a++]=r.length,c--,r.mode=21;break;case 27:if(r.wrap){for(;d<32;){if(0===s)break e;s--,u|=n[o++]<<d,d+=8}if(h-=c,e.total_out+=h,r.total+=h,h&&(e.adler=r.check=xx(r)?jx(r.check,i,h,a-h):Bx(r.check,i,h,a-h)),h=c,(xx(r)?u:qx(u))!==r.check){e.msg="incorrect data check",r.mode=Xx;break}u=0,d=0}r.mode=28;case 28:if(r.wrap&&xx(r)){for(;d<32;){if(0===s)break e;s--,u+=n[o++]<<d,d+=8}if(u!==(4294967295&r.total)){e.msg="incorrect length check",r.mode=Xx;break}u=0,d=0}r.mode=29;case 29:k=1;break e;case Xx:k=-3;break e;case 31:return-4;default:return zx}return e.next_out=a,e.avail_out=c,e.next_in=o,e.avail_in=s,r.hold=u,r.bits=d,(r.wsize||h!==e.avail_out&&r.mode<Xx&&(r.mode<27||4!==t))&&nD(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=xx(r)?jx(r.check,i,h,e.next_out-h):Bx(r.check,i,h,e.next_out-h)),e.data_type=r.bits+(r.last?64:0)+(r.mode===Kx?128:0)+(20===r.mode||15===r.mode?256:0),(0===l&&0===h||4===t)&&0===k&&(k=-5),k},Dx.inflateEnd=function(e){if(!e||!e.state)return zx;var t=e.state;return t.window&&(t.window=null),e.state=null,0},Dx.inflateGetHeader=function(e,t){var r;return e&&e.state?0==(2&(r=e.state).wrap)?zx:(r.head=t,t.done=!1,0):zx},Dx.inflateSetDictionary=function(e,t){var r,n=t.length;return e&&e.state?0!==(r=e.state).wrap&&11!==r.mode?zx:11===r.mode&&Bx(1,t,n,0)!==r.check?-3:nD(e,t,n,n)?(r.mode=31,-4):(r.havedict=1,0):zx},Dx.inflateInfo="pako inflate (from Nodeca project)";var iD={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 oD=Dx,aD=BC,sD=ox,cD=iD,uD=xO,dD=hx,lD=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},hD=Object.prototype.toString;function fD(e){if(!(this instanceof fD))return new fD(e);this.options=aD.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 dD,this.strm.avail_out=0;var r=oD.inflateInit2(this.strm,t.windowBits);if(r!==cD.Z_OK)throw new Error(uD[r]);if(this.header=new lD,oD.inflateGetHeader(this.strm,this.header),t.dictionary&&("string"==typeof t.dictionary?t.dictionary=sD.string2buf(t.dictionary):"[object ArrayBuffer]"===hD.call(t.dictionary)&&(t.dictionary=new Uint8Array(t.dictionary)),t.raw&&(r=oD.inflateSetDictionary(this.strm,t.dictionary))!==cD.Z_OK))throw new Error(uD[r])}function pD(e,t){var r=new fD(t);if(r.push(e,!0),r.err)throw r.msg||uD[r.err];return r.result}fD.prototype.push=function(e,t){var r,n,i,o,a,s=this.strm,c=this.options.chunkSize,u=this.options.dictionary,d=!1;if(this.ended)return!1;n=t===~~t?t:!0===t?cD.Z_FINISH:cD.Z_NO_FLUSH,"string"==typeof e?s.input=sD.binstring2buf(e):"[object ArrayBuffer]"===hD.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 aD.Buf8(c),s.next_out=0,s.avail_out=c),(r=oD.inflate(s,cD.Z_NO_FLUSH))===cD.Z_NEED_DICT&&u&&(r=oD.inflateSetDictionary(this.strm,u)),r===cD.Z_BUF_ERROR&&!0===d&&(r=cD.Z_OK,d=!1),r!==cD.Z_STREAM_END&&r!==cD.Z_OK)return this.onEnd(r),this.ended=!0,!1;s.next_out&&(0!==s.avail_out&&r!==cD.Z_STREAM_END&&(0!==s.avail_in||n!==cD.Z_FINISH&&n!==cD.Z_SYNC_FLUSH)||("string"===this.options.to?(i=sD.utf8border(s.output,s.next_out),o=s.next_out-i,a=sD.buf2string(s.output,i),s.next_out=o,s.avail_out=c-o,o&&aD.arraySet(s.output,s.output,i,o,0),this.onData(a)):this.onData(aD.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!==cD.Z_STREAM_END);return r===cD.Z_STREAM_END&&(n=cD.Z_FINISH),n===cD.Z_FINISH?(r=oD.inflateEnd(this.strm),this.onEnd(r),this.ended=!0,r===cD.Z_OK):n!==cD.Z_SYNC_FLUSH||(this.onEnd(cD.Z_OK),s.avail_out=0,!0)},fD.prototype.onData=function(e){this.chunks.push(e)},fD.prototype.onEnd=function(e){e===cD.Z_OK&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=aD.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg},Ex.Inflate=fD,Ex.inflate=pD,Ex.inflateRaw=function(e,t){return(t=t||{}).raw=!0,pD(e,t)},Ex.ungzip=pD;var vD={};(0,BC.assign)(vD,jC,Ex,iD);var _D=vD,mD="BytePlusRTC",gD=function(){return window.indexedDB||window.mozIndexedDB||window.webkitIndexedDB||window.msIndexedDB},yD=function(){function e(t){Wd(this,e),sd(this,"storeName",void 0),sd(this,"pendingList",[]),this.storeName=t,!uw()&&gD()&&this._checkAndCreateStore(t)}var t,r;return qd(e,[{key:"_checkAndCreateStore",value:function(t,r){var n=this;e.db&&e.db.close();var i=r?gD().open(mD,r):gD().open(mD);i.onupgradeneeded=function(){i.result.createObjectStore(t)},i.onerror=function(e){console.error("IndexedDBInterface error",i.error)},i.onsuccess=function(){var r=i.result;e.db=r;try{e.db.transaction(n.storeName,"readonly"),n.pendingList.forEach(function(){var e=km(Em().mark((function e(t){var r,i,o,a;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=t.txMode,i=t.resolve,o=t.reject,e.prev=1,e.next=4,n._getStore(r);case 4:a=e.sent,i(a),e.next=11;break;case 8:e.prev=8,e.t0=e.catch(1),o();case 11:case"end":return e.stop()}}),e,null,[[1,8]])})));return function(t){return e.apply(this,arguments)}}())}catch(o){n._checkAndCreateStore(t,r.version+1)}}}},{key:"_getStore",value:function(t){var r=this;return new X_((function(n,i){e.db?n(e.db.transaction(r.storeName,t).objectStore(r.storeName)):r.pendingList.push({txMode:t,resolve:n,reject:i})}))}},{key:"put",value:(r=km(Em().mark((function e(t,r){var n;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._getStore("readwrite");case 2:return n=e.sent,e.abrupt("return",new X_((function(e,i){var o=n.put(t,r);o.onsuccess=function(){e()},o.onerror=function(e){i(e)}})));case 4:case"end":return e.stop()}}),e,this)}))),function(e,t){return r.apply(this,arguments)})},{key:"get",value:(t=km(Em().mark((function e(t){var r;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._getStore("readonly");case 2:return r=e.sent,e.abrupt("return",new X_((function(e,n){var i=r.get(t);i.onsuccess=function(){e(i.result)},i.onerror=function(e){n(e)}})));case 4:case"end":return e.stop()}}),e,this)}))),function(e){return t.apply(this,arguments)})}]),e}();sd(yD,"db",void 0),sd(yD,"state","init");var SD=function(e){return e.RTC="rtc",e}(SD||{}),ED=function(e){return e.W_5="5",e}(ED||{}),bD=function(e){return e.IOS="ios",e.ANDROID="android",e.WEB="web",e.WINDOWS="windows",e.MAC="mac",e.LINUX="linux",e}(bD||{}),kD=function(e){return e.REQUEST="request",e.RESPONSE="response",e}(kD||{}),TD=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}(TD||{}),ID=function(e){return e.WEBSOCKET="websocket",e.NETWORKCHANGED="networkChanged",e.PEERCONNECTION="peerconnection",e}(ID||{}),AD=function(e){return e.WEBSOCKET_RECONNECTED="websocket reconnected",e.PEERCONNECTION_RECONNECTED="peerconnection reconnected",e}(AD||{}),RD=function(e){return e.WEBSOCKET="websocket",e.NETWORKCHANGED="networkChanged",e.PEERCONNECTION="peerconnection",e}(RD||{}),wD=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}(wD||{}),CD=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}(CD||{}),OD=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}(OD||{}),xD=function(e){return e.UP="up",e.DOWN="down",e.DIRECT="direct",e}(xD||{}),DD=function(e){return e.UP="up",e.DOWN="down",e.PRE="pre",e}(DD||{}),PD=function(e){return e.UP="up",e.DOWN="down",e.PRE="pre",e}(PD||{}),ND=function(e){return e.W_0="0",e.W_1="1",e}(ND||{}),MD=function(e){return e.UP="up",e.DOWN="down",e}(MD||{}),LD=function(e){return e.ANSWER="answer",e.INCRANSWER="incranswer",e}(LD||{}),UD=function(e){return e.UP="up",e.DOWN="down",e}(UD||{}),VD=function(e){return e.SUCCESS="success",e.FAIL="fail",e}(VD||{}),FD=function(e){return e.W_0="0",e.W_1="1",e}(FD||{}),BD=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}(BD||{}),jD=function(e){return e.SUCCESS="success",e.FAIL="fail",e.IGNORE="ignore",e}(jD||{}),GD=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}(GD||{}),HD=function(e){return e.PLAYOUT_DEVICE_SWITCH="playout_device_switch",e.RECORD_DEVICE_SWITCH="record_device_switch",e.UNKNOWN="unknown",e}(HD||{}),zD=function(e){return e.BEGIN_SEND="begin_send",e.SENT_END="sent_end",e.BEGIN_RECV="begin_recv",e.RECV_END="recv_end",e}(zD||{}),KD=function(e){return e.AUDIO="audio",e.VIDEO="video",e.SCREEN_VIDEO="screen_video",e.SCREEN_AUDIO="screen_audio",e}(KD||{}),XD=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}(XD||{}),qD=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}(qD||{}),WD=function(e){return e.BEGIN="begin",e.END="end",e}(WD||{}),YD=function(e){return e.BEGIN="begin",e.END="end",e}(YD||{}),QD=function(e){return 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",e}(QD||{}),JD=function(e){return e.P2P="p2p",e.P2P_OUTSIDE_ROOM="p2p_outside_room",e.P2SERVER="p2server",e}(JD||{}),ZD=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}(ZD||{}),$D=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}($D||{}),eP=function(){function e(t){Wd(this,e),sd(this,"_event_key",void 0),sd(this,"_device_id",void 0),sd(this,"_rtc_app_id",void 0),sd(this,"_product_line",void 0),sd(this,"_report_version",void 0),sd(this,"_os",void 0),sd(this,"_rtc_sdk_version",void 0),sd(this,"_rtc_timestamp",void 0),sd(this,"_rtc_sdk_git_commit",void 0),sd(this,"_report_id",void 0),sd(this,"_connection_id",void 0),sd(this,"_rtc_sid",void 0),sd(this,"_engine_session_id",void 0),sd(this,"_rtc_business_id",void 0),sd(this,"_app_state",void 0),sd(this,"_project_key",void 0),sd(this,"_network_type",void 0),sd(this,"_app_version",void 0),sd(this,"_aid",void 0),sd(this,"_device_model",void 0),sd(this,"_device_brand",void 0),sd(this,"_common_extra_info",void 0),sd(this,"_had_selected_p2p",void 0),sd(this,"_rtc_env_type",void 0),sd(this,"_room_id",void 0),sd(this,"_user_id",void 0),sd(this,"_rtc_session_id",void 0),sd(this,"_user_agent",void 0),sd(this,"_auto_play_policy",void 0),sd(this,"_platform",void 0),sd(this,"_product",void 0),sd(this,"_log_cache_key",void 0),sd(this,"_overSea","0"),this.monitor=t}return qd(e,[{key:"setStats",value:function(e){var t=this;an(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:"app_state",get:function(){return this._app_state}},{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}},{key:"platform",get:function(){return this._platform||"web"}},{key:"product",get:function(){return this._product||"webrtc"}},{key:"log_cache_key",get:function(){return this._log_cache_key}},{key:"overSea",get:function(){return this._overSea}}]),e}(),tP="ReportErrorBuffer",rP=function(){function e(){Wd(this,e),sd(this,"_buffer",new yD(tP))}var t,r;return qd(e,[{key:"set",value:(r=km(Em().mark((function e(t){return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._buffer.put(t,tP);case 2:case"end":return e.stop()}}),e,this)}))),function(e){return r.apply(this,arguments)})},{key:"get",value:(t=km(Em().mark((function e(){var t;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=[],e.prev=1,e.next=4,this._buffer.get(tP);case 4:t=e.sent,e.next=9;break;case 7:e.prev=7,e.t0=e.catch(1);case 9:return e.abrupt("return",t);case 10:case"end":return e.stop()}}),e,this,[[1,7]])}))),function(){return t.apply(this,arguments)})}]),e}(),nP=function(e){OI(n,e);var t,r=qI(n);function n(){var e;return Wd(this,n),sd(ZT(e=r.call(this)),"report_id",void 0),sd(ZT(e),"report_common",void 0),sd(ZT(e),"modify_ids",void 0),sd(ZT(e),"dataBuffer",void 0),sd(ZT(e),"posting",void 0),sd(ZT(e),"sucSendTimer",void 0),sd(ZT(e),"preSucTime",void 0),sd(ZT(e),"errSendTimer",void 0),sd(ZT(e),"errSendDelay",void 0),sd(ZT(e),"errSendBuffer",void 0),sd(ZT(e),"commonStats",void 0),sd(ZT(e),"_retryCount",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 eP(ZT(e)),uw()||window.addEventListener("beforeunload",(function(){clearTimeout(e.errSendTimer),clearTimeout(e.sucSendTimer),e.send(null,!0)})),e}return qd(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:"enableErrorBuffer",value:function(){this.errSendBuffer=new rP,this.loadErrorBuffer()}},{key:"unshift",value:function(e){this.dataBuffer=wm(e).call(e,this.dataBuffer)}},{key:"send",value:function(e,t){var r,n,i=this;if(e||this.dataBuffer.length){var o={data:e||ok(r=this.dataBuffer).call(r,0,4e3),header:ud(ud({},this.report_common),{},{http_retry_count:this._retryCount}),from:"web",os:"web",version:"1"},a=new XMLHttpRequest;a.timeout=1e4,a.onreadystatechange=function(){if(4===a.readyState){var r,n,s,c,u;if(e||(i.posting=!1),200===a.status||304===a.status)try{r=JSON.parse(a.responseText)}catch(mW){n=mW}if(r&&0===r.StatusCode){if(!e&&!t)!uw()&&Jm(s=location.search).call(s,"_rtc_autotest_")&&i.safeEmit("report_event",o),null===(c=i.errSendBuffer)||void 0===c||c.set([]),i.sucSend()}else if(setTimeout((function(){var e,t;i.rtcError(wm(e="reportor error, res:".concat(null===(t=r)||void 0===t?void 0:t.toString()," err:")).call(e,n),a.status,n)}),0),e)i.send(e);else i.unshift(o.data),null===(u=i.errSendBuffer)||void 0===u||u.set(Wk(i.dataBuffer)),t?i.send():i.errSend()}};var s=RP.LOG_SERVER_URL;if(a.open("POST",s,!0),e||(this.posting=!0),!uw()&&Jm(n=location.search).call(n,"_rtc_debug_"))a.send(vk(o));else{var c=_D.gzip(vk(o));a.setRequestHeader("Content-Encoding","gzip"),a.setRequestHeader("Content-Type","application/x-www-form-urlencoded; charset=UTF-8"),a.send(c)}}}},{key:"sucSend",value:function(){this.errSendDelay=100,this._retryCount=0,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,this._retryCount++}},{key:"loadErrorBuffer",value:(t=km(Em().mark((function e(){var t,r,n=this;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,null===(r=this.errSendBuffer)||void 0===r?void 0:r.get();case 2:if(e.t1=t=e.sent,e.t0=null!==e.t1,!e.t0){e.next=6;break}e.t0=void 0!==t;case 6:if(!e.t0){e.next=10;break}e.t2=t,e.next=11;break;case 10:e.t2=[];case 11:e.t2.forEach((function(e){n.push(e)}));case 13:case"end":return e.stop()}}),e,this)}))),function(){return t.apply(this,arguments)})},{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,c=t.rtc_sdk_version,u=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,v=t.project_key,_=t.network_type,m=t.app_version,g=t.aid,y=t.device_model,S=t.device_brand,E=t.common_extra_info,b=t.had_selected_p2p,k=t.rtc_env_type,T=t.user_agent,I=t.auto_play_policy,A=t.platform,R=t.product,w=t.log_cache_key,C=t.overSea;FE(e,{event_key:r,device_id:n,rtc_app_id:i,product_line:o,report_version:a,os:s,rtc_sdk_version:c,rtc_timestamp:u,rtc_sdk_git_commit:d,report_id:l,rtc_sid:h,engine_session_id:f,rtc_business_id:p,project_key:v,network_type:_,app_version:m,aid:g,device_model:y,device_brand:S,common_extra_info:E,had_selected_p2p:b,rtc_env_type:k,user_agent:T,auto_play_policy:I,platform:A,product:R,log_cache_key:w,extra_is_oversea:C}),this.modify_ids.room_id=this.commonStats.room_id,this.modify_ids.user_id=this.commonStats.user_id,this.modify_ids.rtc_session_id=this.commonStats.rtc_session_id,this.modify_ids.connection_id=this.commonStats.connection_id,this.modify_ids.app_state=this.commonStats.app_state}},{key:"rtcSdkApiCall",value:function(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},i=ud(ud({event_key:"rtc_sdk_api_call",report_id:this.report_id++,rtc_timestamp:Date.now(),sdk_api_name:e,error_code:t,message:r},this.modify_ids),{},{common_extra_info:vk(n)});n.streamId&&(i.stream_id=n.streamId),this.push(i)}},{key:"rtcSdkCallback",value:function(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},i=ud(ud({event_key:"rtc_sdk_callback",report_id:this.report_id++,rtc_timestamp:Date.now(),sdk_callback_name:e,error_code:t,message:r},this.modify_ids),{},{common_extra_info:vk(n)});this.push(i)}},{key:"rtcGetConfig",value:function(e,t,r,n,i,o,a){var s=arguments.length>7&&void 0!==arguments[7]?arguments[7]:{},c=ud(ud({event_key:"rtc_get_config",report_id:this.report_id++,rtc_timestamp:Date.now(),error_code:e,message:t,elapse:r,host:n,type:i,config_id:o,enable_cloud_proxy:a},this.modify_ids),{},{common_extra_info:vk(s)});this.push(c)}},{key:"rtcReconnect",value:function(e,t,r,n){var i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{},o=ud(ud({event_key:"rtc_reconnect",report_id:this.report_id++,rtc_timestamp:Date.now(),error_code:e,message:t,reconnect_id:r,reconnect_type:n},this.modify_ids),{},{common_extra_info:vk(i)});this.push(o)}},{key:"rtcReconnected",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=ud(ud({event_key:"rtc_reconnected",report_id:this.report_id++,rtc_timestamp:Date.now(),message:e,reconnect_type:t},this.modify_ids),{},{common_extra_info:vk(r)});this.push(n)}},{key:"rtcGetAccess",value:function(e,t,r,n,i,o){var a=arguments.length>6&&void 0!==arguments[6]?arguments[6]:{},s=ud(ud({event_key:"rtc_get_access",report_id:this.report_id++,rtc_timestamp:Date.now(),error_code:e,message:t,elapse:r,type:n,host:i,connect_session_id:o},this.modify_ids),{},{common_extra_info:vk(a)});this.push(s)}},{key:"rtcPreIceState",value:function(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},i=ud(ud({event_key:"rtc_pre_ice_state",report_id:this.report_id++,rtc_timestamp:Date.now(),message:e,ice_state:t},this.modify_ids),{},{connection_id:r,common_extra_info:vk(n)});this.push(i)}},{key:"rtcNodeChange",value:function(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},i=ud(ud({event_key:"rtc_node_change",report_id:this.report_id++,rtc_timestamp:Date.now(),error_code:e,message:t,reason:r},this.modify_ids),{},{common_extra_info:vk(n)});this.push(i)}},{key:"rtcSignalingMsgError",value:function(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},i=ud(ud({event_key:"rtc_signaling_msg_error",report_id:this.report_id++,rtc_timestamp:Date.now(),error_code:e,message:t,reason:r},this.modify_ids),{},{common_extra_info:vk(n)});this.push(i)}},{key:"rtcSignaling",value:function(e,t,r,n,i,o,a){var s=arguments.length>7&&void 0!==arguments[7]?arguments[7]:{},c=ud(ud({event_key:"rtc_signaling",report_id:this.report_id++,rtc_timestamp:Date.now(),error_code:e,message:t,signaling_event:r,signaling_type:n,stream_id:i,stream_user_id:o,direction:a},this.modify_ids),{},{common_extra_info:vk(s)});this.push(c)}},{key:"rtcJoinRoom",value:function(e,t,r,n){var i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{},o=ud(ud({event_key:"rtc_join_room",report_id:this.report_id++,rtc_timestamp:Date.now(),error_code:e,deviceModel:t,deviceManufacturer:r,elapse:n},this.modify_ids),{},{common_extra_info:vk(i)});this.push(o)}},{key:"rtcLeaveRoom",value:function(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},i=ud(ud({event_key:"rtc_leave_room",report_id:this.report_id++,rtc_timestamp:Date.now(),error_code:e,message:t,elapse:r},this.modify_ids),{},{common_extra_info:vk(n)});this.push(i)}},{key:"rtcBeginCreateOffer",value:function(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},i=ud(ud({event_key:"rtc_begin_create_offer",report_id:this.report_id++,rtc_timestamp:Date.now(),direction:e,stream_id:t,stream_user_id:r},this.modify_ids),{},{common_extra_info:vk(n)});this.push(i)}},{key:"rtcCreateOffer",value:function(e,t,r,n,i){var o=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{},a=ud(ud({event_key:"rtc_create_offer",report_id:this.report_id++,rtc_timestamp:Date.now(),error_code:e,direction:t,stream_id:r,stream_user_id:n,elapse:i},this.modify_ids),{},{common_extra_info:vk(o)});this.push(a)}},{key:"rtcSetDescription",value:function(e,t,r,n,i,o,a,s){var c=arguments.length>8&&void 0!==arguments[8]?arguments[8]:{},u=ud(ud({event_key:"rtc_set_description",report_id:this.report_id++,rtc_timestamp:Date.now(),error_code:e,message:t,is_local:r,direction:n,stream_id:i,stream_user_id:o,elapse:a},this.modify_ids),{},{connection_id:s,common_extra_info:vk(c)});this.push(u)}},{key:"rtcRecvAnswer",value:function(e,t,r,n,i,o,a){var s=arguments.length>7&&void 0!==arguments[7]?arguments[7]:{},c=ud(ud({event_key:"rtc_recv_answer",report_id:this.report_id++,rtc_timestamp:Date.now(),error_code:e,answer_type:t,sequence_id:r,message:n,direction:i,stream_id:o,stream_user_id:a},this.modify_ids),{},{common_extra_info:vk(s)});this.push(c)}},{key:"firstRemoteAudioRender",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=ud(ud({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:vk(r)});this.push(n)}},{key:"firstRemoteVideoRender",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=ud(ud({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:vk(r)});this.push(n)}},{key:"rtcPublishStat",value:function(e,t,r,n){var i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{},o=ud(ud({event_key:"rtc_publish_stat",report_id:this.report_id++,rtc_timestamp:Date.now(),result:e,is_screen:t,start:r,message:n},this.modify_ids),{},{common_extra_info:vk(i)});this.push(o)}},{key:"rtcSubscribeStat",value:function(e,t,r,n){var i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{},o=ud(ud({event_key:"rtc_subscribe_stat",report_id:this.report_id++,rtc_timestamp:Date.now(),result:e,start:t,message:r,stream_user_id:n},this.modify_ids),{},{common_extra_info:vk(i)});this.push(o)}},{key:"rtcAudioDevice",value:function(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},i=ud(ud({event_key:"rtc_audio_device",report_id:this.report_id++,rtc_timestamp:Date.now(),audio_event:e,message:t,error_code:r},this.modify_ids),{},{common_extra_info:vk(n)});this.push(i)}},{key:"rtcMediaStatistics",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=ud(ud(ud(ud({event_key:"rtc_media_statistics",report_id:this.report_id++,rtc_timestamp:Date.now()},e),t),this.modify_ids),{},{common_extra_info:vk(r)});this.push(n)}},{key:"rtcMessageStatistics",value:function(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},i=ud(ud({event_key:"rtc_message_statistics",report_id:this.report_id++,rtc_timestamp:Date.now(),dc_user_message:e,dc_room_message:t,media_server_ip:r},this.modify_ids),{},{common_extra_info:vk(n)});this.push(i)}},{key:"rtsMessageReport",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=ud(ud(ud({event_key:"rts_message",report_id:this.report_id++,rtc_timestamp:Date.now()},e),this.modify_ids),{},{common_extra_info:vk(t)});this.push(r)}},{key:"rtcError",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=ud(ud({event_key:"rtc_error",report_id:this.report_id++,rtc_timestamp:Date.now(),message:e,error_code:t},this.modify_ids),{},{common_extra_info:vk(r)});this.push(n)}},{key:"rtcInvokeStatus",value:function(e,t,r,n,i){var o=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{},a=arguments.length>6&&void 0!==arguments[6]?arguments[6]:"",s=ud(ud({event_key:"rtc_invoke_status",report_id:this.report_id++,rtc_timestamp:Date.now(),message:e,error_code:t,sdk_api_name:r,stream_id:n,elapse:i},this.modify_ids),{},{connection_id:a,common_extra_info:vk(o),direction:o.direction});this.push(s)}},{key:"rtcFirstFrame",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=ud(ud(ud({event_key:"rtc_first_frame",report_id:this.report_id++,rtc_timestamp:Date.now()},e),this.modify_ids),{},{common_extra_info:vk(t)});this.push(r)}},{key:"rtcMuteRemote",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=ud(ud({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:vk(r)});this.push(n)}},{key:"sdkInitEngine",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=ud(ud({event_key:"sdk_init_engine",report_id:this.report_id++,rtc_timestamp:Date.now(),start:e,type:t},this.modify_ids),{},{common_extra_info:vk(r)});this.push(n)}},{key:"joinRoom",value:function(e,t,r,n){var i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{},o=ud(ud({event_key:"join_room",report_id:this.report_id++,rtc_timestamp:Date.now(),type:e,start:t,result:r,reason:n},this.modify_ids),{},{common_extra_info:vk(i)});this.push(o)}},{key:"p2pConnectionStatus",value:function(e,t,r,n,i){var o=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{},a=ud(ud({event_key:"p2p_connection_status",report_id:this.report_id++,rtc_timestamp:Date.now(),room_id:e,user_id:t,peer_user_id:r,status:n,elapse:i},this.modify_ids),{},{common_extra_info:vk(o)});this.push(a)}},{key:"p2pConnectClosed",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=ud(ud({event_key:"p2p_connect_closed",report_id:this.report_id++,rtc_timestamp:Date.now(),p2p_selected:e},this.modify_ids),{},{common_extra_info:vk(t)});this.push(r)}},{key:"rtcDeviceError",value:function(e,t,r,n,i,o,a,s,c,u,d,l,h,f,p,v){var _=arguments.length>16&&void 0!==arguments[16]?arguments[16]:{},m=ud(ud({event_key:"rtc_device_error",report_id:this.report_id++,rtc_timestamp:Date.now(),device_type:e,device_stage:t,error_code:r,system_error_code:n,system_api:i,call_parameters:o,location:a,message:s,media_device_id:c,media_device_name:u,elapse:d,scenario:l,event_session_id:h,device_pid:f,device_vid:p,media_mode:v},this.modify_ids),{},{common_extra_info:vk(_)});this.push(m)}},{key:"rtcVideoDevice",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=ud(ud({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:vk(r)});this.push(n)}},{key:"rtcVideoCaptureEvent",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=ud(ud(ud({event_key:"rtc_video_capture_event",report_id:this.report_id++,rtc_timestamp:Date.now()},e),this.modify_ids),{},{common_extra_info:vk(t)});this.push(r)}},{key:"rtcEncodeFirstFrame",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=ud(ud(ud(ud({event_key:"rtc_encode_first_frame",report_id:this.report_id++,rtc_timestamp:Date.now()},e),t),this.modify_ids),{},{common_extra_info:vk(r)});this.push(n)}},{key:"rtcFirstFrameEncoded",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=ud(ud(ud(ud({event_key:"rtc_first_frame_encoded",report_id:this.report_id++,rtc_timestamp:Date.now()},e),t),this.modify_ids),{},{common_extra_info:vk(r)});this.push(n)}},{key:"rtcSendFirstPacket",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=ud(ud(ud(ud({event_key:"rtc_send_first_packet",report_id:this.report_id++,rtc_timestamp:Date.now()},e),t),this.modify_ids),{},{common_extra_info:vk(r)});this.push(n)}},{key:"rtcRecvFirstPacket",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=ud(ud(ud(ud({event_key:"rtc_recv_first_packet",report_id:this.report_id++,rtc_timestamp:Date.now()},e),t),this.modify_ids),{},{common_extra_info:vk(r)});this.push(n)}},{key:"rtcRecvFirstFrame",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=ud(ud(ud(ud({event_key:"rtc_recv_first_frame",report_id:this.report_id++,rtc_timestamp:Date.now()},e),t),this.modify_ids),{},{common_extra_info:vk(r)});this.push(n)}},{key:"rtcDecodeFirstFrame",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=ud(ud(ud(ud({event_key:"rtc_decode_first_frame",report_id:this.report_id++,rtc_timestamp:Date.now()},e),t),this.modify_ids),{},{common_extra_info:vk(r)});this.push(n)}}]),n}(OC),iP=new nP,oP=new nP,aP=new nP,sP=iP.commonStats,cP=oP.commonStats,uP=aP.commonStats;function dP(e){sP.setStats({app_state:e}),cP.setStats({app_state:e}),uP.setStats({app_state:e})}!uw()&&(dP("active"),document.addEventListener("visibilitychange",(function(){"visible"===document.visibilityState?dP("active"):"hidden"===document.visibilityState&&dP("background")})));var lP={default:iP,rtm:oP,outsideRoom:aP};function hP(){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&&sP.setStats({room_id:i[1]}),lP[e].rtcSdkApiCall(n,0,vk(ww(i)),s);var c=o.apply(this,i);return"function"==typeof(null==c?void 0:c.then)?c.then((function(t){return lP[e].rtcSdkCallback(n,0,vk(ww([t||{}]))),t})).catch((function(t){throw lP[e].rtcSdkCallback(n,t.code,vk(t.message)),t})):(lP[e].rtcSdkCallback(n,0,vk(ww([c||{}]))),c)}}}}function fP(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=e===Kd.onUserMessageReceivedOutsideRoom||e===Kd.onUserBinaryMessageReceivedOutsideRoom;(n?oP:iP).rtcSdkCallback(e,r,vk(t))}function pP(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=arguments.length>3&&void 0!==arguments[3]&&arguments[3],i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:"",o=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{};(n?oP:iP).rtcInvokeStatus(vk(t),r,e,"",0,o,i)}var vP="BytePlus",_P="RTC_DEVICE_ID",mP="RTC_ACCESS_NODE",gP="RTC_ACCESS_URLS",yP="ENGINE_WEB_CONFIG",SP=function(){function e(){Wd(this,e)}return qd(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,vk(n)),!0}catch(i){return!1}}},{key:"delete",value:function(e){try{return localStorage.removeItem(e),!0}catch(t){return!1}}}]),e}(),EP=function(e){OI(r,e);var t=qI(r);function r(){return Wd(this,r),t.apply(this,arguments)}return qd(r,[{key:"getDeviceId",value:function(){if(uw())return"";var e=this.get(_P);return e&&!/^[0-9a-f]{8}(-[0-9a-f]{4}){3}-[0-9a-f]{12}$/.test(e)||(e=function(e){for(var t="",r=0;r<e;r++)t+=Math.floor(10*Math.random());return t}(30)),this.setDeviceId(e),e}},{key:"setDeviceId",value:function(e){return[sP,cP,uP].forEach((function(t){return t.setStats({device_id:e})})),this.set(_P,e),e}},{key:"getAccessNode",value:function(e){var t;return this.get(wm(t="".concat(mP,"_").concat(e,"-")).call(t,vP))}},{key:"setAccessNode",value:function(e,t,r){var n;return this.set(wm(n="".concat(mP,"_").concat(e,"-")).call(n,vP),t,1e3*r)}},{key:"clearAccessNode",value:function(e){var t;this.delete(wm(t="".concat(mP,"_").concat(e,"-")).call(t,vP))}},{key:"getAccessUrls",value:function(){return this.get("".concat(gP,"-").concat(vP))}},{key:"setAccessUrls",value:function(e){var t=lk(e).call(e,(function(e){var t,r=e.host,n=e.path;return wm(t="https://".concat(r)).call(t,n)}));return this.set("".concat(gP,"-").concat(vP),t)}},{key:"clearAccessUrls",value:function(){this.delete("".concat(gP,"-").concat(vP))}},{key:"getEngineWebConfig",value:function(e,t){var r,n,i,o=wm(r=wm(n="".concat(e,"_")).call(n,t,"_")).call(r,this.getDeviceId()),a=this.get(yP);return(null==a||null===(i=bb(a).call(a,(function(e){return e.key===o})))||void 0===i?void 0:i.config)||{}}},{key:"setEngineWebConfig",value:function(e,t,r){var n,i;if(r){var o=wm(n=wm(i="".concat(e,"_")).call(i,t,"_")).call(n,this.getDeviceId()),a=this.get(yP)||[];return(a=Gs(a).call(a,(function(e){return e.key!==o}))).push({key:o,config:r}),this.set(yP,Sm(a).call(a,-5))}}}]),r}(SP),bP=new EP,kP="rtc-access.rtcplus.com,rtc-access-sg.rtcplus.com,rtc-access-va.rtcplus.com,rtc-access-fr.rtcplus.com".split(",");function TP(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return/^https?:\/\/.+/.test(e)||(e="https://"+e),"".concat(e,"/dispatch/v1/AccessInfo?Action=GetAccessInfo")}var IP="https://web-log-report.rtcplus.com/video/v1/webrtc_log/",AP="rtc.rtcplus.com".split(","),RP={VERSION:"4.51.5",ICE_CONFIG_REQUEST_URLS_INTERNAL:lk(kP).call(kP,TP),ICE_CONFIG_REQUEST_URLS:[],EXPECTED_ADDR:"",LOG_SERVER_URL:IP,CONFIG_REQUEST_DOMAINS:AP,DEVICE_ID:"",OVERSEA:!1,PLATFORM:"",PRODUCT:"",CONNECTION_MODE:Fd.AUTO,AUDIO_STALL:!0,VIDEO_STALL:!0,STATS_SCALLBACK_SUPPORT:!0,ENABLE_REPORT_ERROR_BUFFER:!1};function wP(e,t){var r;if(iP.rtcSdkApiCall("setParameter",0,wm(r="key: ".concat(e,", value: ")).call(r,t)),"VERSION"!==e){if("ICE_CONFIG_REQUEST_URLS"===e)return"string"==typeof t&&(t=[t]),void(RP.ICE_CONFIG_REQUEST_URLS=lk(t).call(t,TP));if("PLATFORM"!==e||"string"!=typeof t)if("PRODUCT"!==e||"string"!=typeof t)if("LOG_SERVER_URL"!==e||t!==Td.overseas)if("LOG_SERVER_URL"!==e||t!==Td.domestic)if("LOG_SERVER_URL"!==e||"string"!=typeof t){if("OVERSEA"===e)return sP.setStats({overSea:t?"1":"0"}),void(RP.OVERSEA=t);"DEVICE_ID"===e&&bP.setDeviceId(t),"ENABLE_REPORT_ERROR_BUFFER"===e&&t&&iP.enableErrorBuffer(),RP[e]=t}else RP.LOG_SERVER_URL=t;else RP.LOG_SERVER_URL=IP;else RP.LOG_SERVER_URL="https://web-log-report.rtcplus.com/video/v1/webrtc_log/";else sP.setStats({product:t});else sP.setStats({platform:t})}}function CP(e){return"DEVICE_ID"===e?bP.getDeviceId():RP[e]}function OP(e,t,r){var n,i,o,a,s,c,u,d,l;return{type:"publicstream",action:t,publicStreamID:e,publicStreamMeta:{audio:{},video:{fps:(null===(n=r.video)||void 0===n?void 0:n.fps)||15,bitrate:1e3*((null===(i=r.video)||void 0===i?void 0:i.kBitRate)||40),width:(null===(o=r.video)||void 0===o?void 0:o.width)||640,height:(null===(a=r.video)||void 0===a?void 0:a.height)||360},layout:{layoutMode:2,interpolationMode:(null===(s=r.layout)||void 0===s?void 0:s.interpolationMode)||Rd.PREV_FRAME,canvas:{bgColor:(null===(c=r.layout)||void 0===c?void 0:c.backgroundColor)||"#000000",bgImage:(null===(u=r.layout)||void 0===u?void 0:u.backgroundImage)||""},regions:(null===(d=r.layout)||void 0===d||null===(l=d.regions)||void 0===l?void 0:lk(l).call(l,(function(e){return{roomId:e.roomId,userId:e.userId,alterImage:e.alertImage||"",alpha:!e.alpha||+e.alpha>1||+e.alpha<=0?1:+e.alpha,x:!e.x||+e.x>=1||+e.x<0?0:+e.x,y:!e.y||+e.y>=1||+e.y<0?0:+e.y,w:!e.w||+e.w>1||+e.w<=0?1:+e.w,h:!e.h||+e.h>1||+e.h<=0?1:+e.h,zorder:!e.zorder||+e.zorder<0||+e.zorder>100?0:+e.zorder,renderMode:void 0===e.renderMode?1:e.renderMode,streamType:e.isScreenStream?1:0,mediaType:e.mediaType||0,sourceCrop:e.sourceCrop}})))||[]}}}}var xP={width:640,height:480,frameRate:15,maxKbps:600},DP={width:1920,height:1080,frameRate:15,maxKbps:3e3};function PP(e,t){if(null==e)return{};var r,n,i=function(e,t){if(null==e)return{};var r,n,i={},o=an(e);for(n=0;n<o.length;n++)r=o[n],Pb(t).call(t,r)>=0||(i[r]=e[r]);return i}(e,t);if(Os){var o=Os(e);for(n=0;n<o.length;n++)r=o[n],Pb(t).call(t,r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(i[r]=e[r])}return i}var NP,MP=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}(MP||{}),LP=function(e){return e.PushLimitWarn="PushLimitWarn",e}(LP||{}),UP=function(e){return e.ON_ADD_STREAM="onAddStream",e.ON_ADD_STREAM_LIST="onAddStreamList",e.ON_REMOVE_STREAM="onRemoveStream",e.ON_REMOVE_STREAM_LIST="onRemoveStreamList",e.USER_DISCONNECTION="userDisconnection",e.USER_DISCONNECTION_LIST="userDisconnectionList",e.USER_CONNECTION="userConnection",e.USER_CONNECTION_LIST="userConnectionList",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_SPEAKER_CHANGE="onSpeakerChange",e.ON_STREAM_FAILED="streamFailed",e}(UP||{}),VP=function(e){return e.RSCP="RSCP",e.RTT="RTT",e}(VP||{}),FP=function(e){return e.ON_CONNECTION_STATE_CHANGE="onConnectionStateChange",e.ABNORMAL_DISCONNECTION="normalConnection",e}(FP||{}),BP=function(e){return e.userLeave="userLeave",e.connectionLost="connectionLost",e.userDuplicateLogin="userDuplicateLogin",e.kickedByAdmin="kickedByAdmin",e.roleChanged="roleChanged",e.onUserTokenDidExpire="onUserTokenDidExpire",e}(BP||{}),jP=function(e){return e[e.roomDismissByAdmin=2]="roomDismissByAdmin",e}(jP||{}),GP=function(e){return e[e.SEND=0]="SEND",e[e.FEEDBACK=1]="FEEDBACK",e}(GP||{}),HP=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}(HP||{}),zP=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.EXCEED_QPS=5]="EXCEED_QPS",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.NOT_LOGIN=105]="NOT_LOGIN",e[e.SERVER_PARAMS_NOTSET=106]="SERVER_PARAMS_NOTSET",e[e.UNKNOWN=1e3]="UNKNOWN",e}(zP||{}),KP=(sd(NP={},0,[0,"success"]),sd(NP,1,[uR.USER_MESSAGE_TIMEOUT,"timeout, failed to send."]),sd(NP,2,[uR.USER_MESSAGE_BROKEN,"dataChannel broken, failed to send."]),sd(NP,3,[uR.USER_MESSAGE_NO_RECEIVER,"cannot find the receiver."]),sd(NP,4,[uR.USER_MESSAGE_NO_RECEIVER,"cannot find relay path."]),sd(NP,5,[uR.USER_MESSAGE_EXCEED_QPS,"cannot find relay path."]),sd(NP,17,[uR.USER_MESSAGE_SEND_TO_SERVER_ERROR,"failed to send to business server."]),sd(NP,18,[uR.USER_MESSAGE_SERVER_RESPONSE_ERROR,"business server response error."]),sd(NP,100,[uR.USER_MESSAGE_NOT_JOIN,"not join room"]),sd(NP,105,[uR.USER_MESSAGE_NOT_LOGIN,"not login."]),sd(NP,106,[uR.USER_MESSAGE_SERVER_PARAMS_NOTSET,"server param is not set."]),sd(NP,1e3,[uR.USER_MESSAGE_UNKNOWN,"unknown."]),NP),XP=new RC("RTSMsgReportor",1),qP=function(){function e(t){Wd(this,e),sd(this,"_preTime",Date.now()),sd(this,"_one2oneNum",0),sd(this,"_one2manyNum",0),sd(this,"_one2oneMsgCache",new uE),sd(this,"_one2manyMsgCache",new uE),sd(this,"roomInfo",void 0),sd(this,"rtsSessionId",""),this.id=t}return qd(e,[{key:"needReport",value:function(t){return!!e.config&&(Date.now()-this._preTime>=36e5&&(this._preTime=Date.now(),this._one2oneNum=0,this._one2manyNum=0),"one2one"===t&&this._one2oneNum<e.config.max_one2one_fpt_per_hour&&Math.random()<=e.config.one2one_fpt_ratio/100||"one2many"===t&&this._one2manyNum<e.config.max_one2many_fpt_per_hour&&Math.random()<=e.config.one2many_fpt_ratio/100)}},{key:"cacheP2PMsg",value:function(t){var r;this._one2oneMsgCache.set(t.msg_id,ud({config_version:(null===(r=e.config)||void 0===r?void 0:r.version)||""},t))}},{key:"updateP2PMsg",value:function(e,t){var r=this._one2oneMsgCache.get(e);r&&this._one2oneMsgCache.set(e,ud(ud({},r),t))}},{key:"cacheCustomMsg",value:function(t){var r;this._one2manyMsgCache.set(t.msg_id,ud({config_version:(null===(r=e.config)||void 0===r?void 0:r.version)||""},t))}},{key:"updateOne2ManyMsg",value:function(e,t){var r=this._one2manyMsgCache.get(e);r&&this._one2manyMsgCache.set(e,ud(ud({},r),t))}},{key:"reportP2PMsg",value:function(e){var t=this._one2oneMsgCache.get(e);t&&(XP.print("reportP2PMsg",t.msg_type,vk(t)),iP.rtsMessageReport(t))}},{key:"reportOne2ManyMsg",value:function(e){var t=this._one2manyMsgCache.get(e);t&&(XP.print("reportOne2ManyMsg",t.msg_type,vk(t)),iP.rtsMessageReport(t))}},{key:"reportMsgRecv",value:function(t){var r;t.config_version=(null===(r=e.config)||void 0===r?void 0:r.version)||"",XP.print("reportMsgRecv",t.msg_type,vk(t)),iP.rtsMessageReport(t)}},{key:"destroy",value:function(){this._one2manyNum=0,this._one2oneNum=0,this._one2manyMsgCache.clear(),this._one2oneMsgCache.clear(),this._preTime=Date.now(),delete this.roomInfo,this.rtsSessionId=""}}]),e}();sd(qP,"config",void 0);var WP=new uE,YP=function(e){XP.print("setConfig","get config: "+vk(e)),qP.config=e},QP=function(e){var t=WP.get(e)||new qP(e);return WP.set(e,t),t},JP=function(e){var t=WP.get(e);t&&(t.destroy(),WP.delete(e))},ZP=function(e,t){var r=WP.get(e);r&&(r.roomInfo=t)},$P=function(e,t){var r=WP.get(e);r&&(r.rtsSessionId=t)},eN=function(e,t,r){var n,i;t.enable_report&&t.report_msg_id&&(null===(n=WP.get(e))||void 0===n||n.updateP2PMsg(wm(i="".concat(t.from)).call(i,t.report_msg_id),{send_ts:Date.now(),msg_size:r}))},tN=function(e,t,r){if(t.enable_report&&t.report_msg_id){var n,i,o=WP.get(e);null==o||o.updateP2PMsg(wm(n="".concat(t.from)).call(n,t.report_msg_id),{ack_ts:Date.now(),error_code:r}),null==o||o.reportP2PMsg(wm(i="".concat(t.from)).call(i,t.report_msg_id))}},rN=function(e,t,r){var n,i,o,a=WP.get(e);null!=a&&a.needReport("one2many")&&(r.enable_report=!0,r.report_msg_id=t,a.cacheCustomMsg({rts_session_id:a.rtsSessionId,msg_id:wm(n="".concat(r.clientId)).call(n,t),node_role:"src_sdk",from:r.clientId,to:(null===(i=a.roomInfo)||void 0===i?void 0:i.roomId)||"",msg_type:"one2many",rts_room_id:(null===(o=a.roomInfo)||void 0===o?void 0:o.roomId)||"",req_ts:Date.now(),send_ts:Date.now(),ack_ts:Date.now(),msg_size:0}));return r},nN=function(e,t,r){if(t.enable_report&&t.report_msg_id){var n,i=WP.get(e);if(i)i.updateOne2ManyMsg(wm(n="".concat(t.clientId)).call(n,t.report_msg_id),{send_ts:Date.now(),msg_size:r})}},iN=function(e,t,r){if(t.enable_report&&t.report_msg_id){var n,i,o=WP.get(e);if(o)null==o||o.updateOne2ManyMsg(wm(n="".concat(t.clientId)).call(n,t.report_msg_id),{ack_ts:Date.now(),error_code:r}),null==o||o.reportOne2ManyMsg(wm(i="".concat(t.clientId)).call(i,t.report_msg_id))}},oN=function(e,t,r){if(t.enable_report&&t.report_msg_id){var n,i,o=WP.get(e);null==o||o.reportMsgRecv({rts_session_id:o.rtsSessionId,msg_id:wm(n="".concat(t.from)).call(n,t.report_msg_id),msg_size:r.msg_size,node_role:"dst_sdk",msg_type:t.to?"one2one":"one2many",rts_room_id:t.room,from:t.from,to:t.to||t.room,error_code:0,recv_msg_ts:r.recv_msg_ts,fwd_msg_ts:r.fwd_msg_ts,reply_ack_ts:Date.now(),cur_dst_uid:t.to?"":null===(i=o.roomInfo)||void 0===i?void 0:i.userInfo.userId})}},aN=function(e,t,r){if(t.enable_report&&t.report_msg_id){var n,i,o=WP.get(e);null==o||o.reportMsgRecv({rts_session_id:o.rtsSessionId,msg_id:wm(n="".concat(t.clientId)).call(n,t.report_msg_id),msg_size:r.msg_size,node_role:"dst_sdk",msg_type:"one2many",rts_room_id:t.roomId,from:t.clientId,to:t.roomId,error_code:0,recv_msg_ts:r.recv_msg_ts,fwd_msg_ts:r.fwd_msg_ts,reply_ack_ts:Date.now(),cur_dst_uid:null===(i=o.roomInfo)||void 0===i?void 0:i.userInfo.userId})}},sN=Object.freeze(Object.defineProperty({__proto__:null,_cache:WP,setConfig:YP,setRtsSessionId:$P,createRTSMsgReportor:QP,destroyRTSMsgReportor:JP,setRoomInfo:ZP,samplingP2PMsg:function(e,t){var r=WP.get(e);if(null!=r&&r.needReport("one2one")){var n,i=wm(n="".concat(t.from)).call(n,t.id);t.enable_report=!0,t.report_msg_id=t.id,r.cacheP2PMsg({rts_session_id:r.rtsSessionId,msg_id:i,node_role:"src_sdk",from:t.from,to:t.to||"server",msg_type:t.to?"one2one":"one2server",rts_room_id:t.room,req_ts:Date.now(),send_ts:Date.now(),ack_ts:Date.now(),msg_size:0})}return t},updateP2PMsgReq:eN,updateP2PMsgAck:tN,samplingOne2ManyMsg:rN,reportP2PMsgRecv:oN,updateOne2ManyMsgAck:iN,updateOne2ManyMsgReq:nN,reportOne2ManyMsgRecv:aN},Symbol.toStringTag,{value:"Module"})),cN=["msg"],uN=new RC("DataChannelSignaling",3),dN=["onSpeakerChange"],lN=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}(lN||{}),hN=function(e){OI(i,e);var t,r,n=qI(i);function i(e,t){var r;return Wd(this,i),sd(ZT(r=n.call(this)),"_singlingCache",new uE),sd(ZT(r),"_p2pCache",new uE),sd(ZT(r),"_rttIds",{}),sd(ZT(r),"_p2pMessageId",0),sd(ZT(r),"_clearDataChannelListener",void 0),sd(ZT(r),"_asyncQueue",new jw),r.id=e,r._dataChannel=t,r._clearDataChannelListener=r._handleHandler(),window.__rtc_mock_signaling__=r.emit.bind(ZT(r)),r}return qd(i,[{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 iP.rtcSignaling(0,vk(t),"call-".concat(e),"Send",t.streamId,t.streamUserId,xD.UP),new X_((function(i,o){var a,s=n._genHeader(r);s.id=Iw();var c=s.id.join("-"),u="customMessage"===e;u&&rN(n.id,+s.id.join(""),t);var d=setTimeout((function(){n._singlingCache.delete(c),o(new lR(uR.TIME_OUT,"".concat(e," message time out"))),u&&iN(n.id,t,999)}),6e4);n._singlingCache.set(c,{signalingType:e,success:function(e){clearTimeout(d),i(e),u&&iN(n.id,t,0)},error:function(e){clearTimeout(d),o(e),u&&iN(n.id,t,e.code)}}),uN.print("Signal",wm(a=">>>>>> [".concat(e,"][")).call(a,c,"]"),t),n._sendMessage(e,s,t)}))}},{key:"sendPingSignaling",value:function(){return this.sendSignaling("CheckConnectivity",{ts:Date.now()},{functionType:2})}},{key:"sendP2PMessage",value:(r=km(Em().mark((function e(t,r){var n,i,o;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=t.msg,i=PP(t,cN),o=n instanceof ArrayBuffer,e.t0=this,e.t1=sN,e.t2=this.id,e.t3=ud,e.t4=ud({ver:1,id:this._p2pMessageId++,time:Date.now(),dir:GP.SEND,type:HP.P2P,err:zP.SUCCESS},i),e.t5={},e.t6=o,!o){e.next=15;break}return e.next=12,dw.ab2b64str(n);case 12:e.t7=e.sent,e.next=16;break;case 15:e.t7=n;case 16:return e.t8=e.t7,e.t9={binary:e.t6,msg:e.t8},e.t10=(0,e.t3)(e.t4,e.t5,e.t9),e.t11=e.t1.samplingP2PMsg.call(e.t1,e.t2,e.t10),e.t12=r,e.abrupt("return",e.t0._sendP2PMessage.call(e.t0,e.t11,e.t12));case 22:case"end":return e.stop()}}),e,this)}))),function(e,t){return r.apply(this,arguments)})},{key:"_sendP2PMessage",value:function(e){var t=this,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return Rw(e.msg)?this._rttIds[e.id]=e.id:e.dir===GP.SEND&&uN.print("_sendP2PMessage [DC Signaling p2p >>]",vk(e)),new X_((function(n,i){var o=t._genHeader(ud(ud({needAck:!0,functionType:1},r),{},{id:Iw()}));if(e.dir===GP.SEND){var a=setTimeout((function(){t._p2pCache.delete(e.id),i(new lR(uR.USER_MESSAGE_TIMEOUT,"P2P message timeout")),tN(t.id,e,999)}),12e3);t._p2pCache.set(e.id,{success:function(r,i){clearTimeout(a),n(i),tN(t.id,e,0)},error:function(r){var n;clearTimeout(a),tN(t.id,e,r.err);var o=JT(KP[r.err]||[uR.USER_MESSAGE_UNKNOWN,wm(n="err: ".concat(r.err,", msg: ")).call(n,r.msg)],2),s=o[0],c=o[1];i({err:r.err,code:s,message:r.msg||c})}})}try{t._sendMessage("p2p",o,e)}catch(s){throw s.code===uR.SIGNALING_CHANNEL_NOT_OPEN&&(s.code=uR.USER_MESSAGE_BROKEN),s}}))}},{key:"_sendMessage",value:function(e,t,r){var n;if(!this._dataChannel||"open"!==this._dataChannel.readyState)throw new lR(uR.SIGNALING_CHANNEL_NOT_OPEN,"DataChannel not open");var i=t.version+(+t.zip<<5)+(+t.encrypt<<6),o=+t.needAck+(+t.direction<<1)+(+t.functionType<<2)+(+t.binary<<6),a=dw.str2ab(vk([e,r])),s=cw(Uint8Array,wm(n=[i,o]).call(n,Wk(t.id||[])),new Uint8Array(a));this._dataChannel.send(s.buffer),"p2p"===e?eN(this.id,r,s.buffer.byteLength):"customMessage"===e&&nN(this.id,r,s.buffer.byteLength)}},{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=Xk(Sm(t).call(t,2,r))}return{header:o,data:Sm(t).call(t,r)}}},{key:"_feedbackSignaling",value:function(e,t,r){var n,i,o=this._genHeader({needAck:!0,direction:1,id:lk(n=e.split("-")).call(n,(function(e){return+e}))});Jm(dN).call(dN,t)||uN.print("Signal",wm(i=">>>>>> [".concat(t,"-res][")).call(i,e,"]"));this._sendMessage("".concat(t,"-res"),o,r)}},{key:"_handleMessage",value:(t=km(Em().mark((function e(t){var r,n,i,o,a,s,c,u,d,l,h,f,p,v,_,m,g,y,S,E,b,k,T,I,A,R,w,C,O,x,D,P,N,M,L,U=this;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:s=Date.now(),c=t.byteLength,u=this._dispartData(t),d=u.data,(l=u.header).zip&&((h=new _D.Inflate).push(d,!0),d=h.result),f=dw.ab2str(d),p=[],e.prev=8,p=JSON.parse(f),e.next=16;break;case 12:return e.prev=12,e.t0=e.catch(8),e.t0 instanceof Error&&iP.rtcSignalingMsgError(-1,e.t0.message,OD.MESSAGE_PARSE_FAILED),e.abrupt("return");case 16:e.t1=l.functionType,e.next=0===e.t1?19:1===e.t1?38:2===e.t1?73:91;break;case 19:if(v=(null===(r=l.id)||void 0===r?void 0:r.join("-"))||"",1!==l.direction){e.next=24;break}this._handleAckMessage(v,p[0]||{},f),e.next=37;break;case 24:if(!Array.isArray(p)){e.next=37;break}if(_=p[0],p=p[1],Jm(dN).call(dN,_)||uN.print("Signal","<<<<<< ".concat(_),p,v),this._feedbackSignaling(v,_,_===UP.ON_CUSTOM_MESSAGE?ud(ud({},p),{},{message:""}):""),!p.binary||"string"!=typeof p.message){e.next=33;break}return e.next=32,dw.b64str2ab(p.message);case 32:p.message=e.sent;case 33:m=Date.now(),this.emit(_,ud({},p)),_===UP.ON_CUSTOM_MESSAGE&&aN(this.id,p,{msg_size:c,recv_msg_ts:s,fwd_msg_ts:m}),iP.rtcSignaling(0,f,"on-".concat(_),"Recv",p.streamId,p.clientId,xD.DOWN);case 37:return e.abrupt("break",92);case 38:Array.isArray(p)&&(p=p[1]),g=null===(n=p)||void 0===n?void 0:n.id,this._rttIds[g]||(null===(i=p)||void 0===i?void 0:i.dir)===GP.FEEDBACK||Rw(null===(o=p)||void 0===o?void 0:o.msg)?delete this._rttIds[g]:uN.print("Signal","<<<<<< p2p response",p),e.t2=p.dir,e.next=e.t2===GP.SEND?44:e.t2===GP.FEEDBACK?69:71;break;case 44:if(y=Date.now(),Rw(null===(a=p)||void 0===a?void 0:a.msg)){e.next=66;break}if(E=(S=p).binary,b=S.msg,k=S.room,T=S.to,I=S.from,A=""===k?E?UP.USER_BINARY_MESSAGE_RECEIVED_OUTSIDE_ROOM:UP.USER_MESSAGE_RECEIVED_OUTSIDE_ROOM:E?UP.USER_BINARY_MESSAGE_RECEIVED:UP.USER_MESSAGE_RECEIVED,T){e.next=65;break}if(e.t3=this,e.t4=UP.ON_CUSTOM_MESSAGE,e.t5=I,e.t6=E,!E){e.next=59;break}return e.next=56,dw.b64str2ab(b);case 56:e.t7=e.sent,e.next=60;break;case 59:e.t7=b;case 60: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=66;break;case 65:E?this._asyncQueue.add(dw.b64str2ab(b),(function(e){return U.emit(A,ud(ud({},p),{},{msg:e}))})):this.emit(A,ud(ud({},p),{},{msg:b}));case 66:return this._sendP2PMessage(ud(ud({},p),{},{dir:GP.FEEDBACK,msg:""})),oN(this.id,p,{msg_size:c,recv_msg_ts:s,fwd_msg_ts:y}),e.abrupt("break",72);case 69:return this._handleP2PMsgFeedback(p),e.abrupt("break",72);case 71:return e.abrupt("break",72);case 72:return e.abrupt("break",92);case 73:if(1!==l.direction){e.next=78;break}w=(null===(R=l.id)||void 0===R?void 0:R.join("-"))||"",this._handleAckMessage(w,p[0]||{},f),e.next=90;break;case 78:if(C=JT(p,2),O=C[0],x=C[1],D=void 0===x?{}:x,"RXMediaMsg"!==O){e.next=90;break}P=D.type,N=D.data,iP.rtcSignaling(0,f,"on-".concat(P),"Recv","","",xD.DOWN),e.t10=P,e.next="RSCP"===e.t10?85:"RTT"===e.t10?87:89;break;case 85:try{M=JSON.parse(N),Array.isArray(M)&&this.emit(P,M)}catch(V){}return e.abrupt("break",90);case 87:try{(L=JSON.parse(N)).length&&this.emit(P,L[0])}catch(V){}return e.abrupt("break",90);case 89:return e.abrupt("break",90);case 90:case 91:return e.abrupt("break",92);case 92:case"end":return e.stop()}}),e,this,[[8,12]])}))),function(e){return t.apply(this,arguments)})},{key:"_handleHandler",value:function(){var e=this,t=function(t){uN.print("_handleHandler","dataChannel close",t),e.emit("close",t)},r=function(t){uN.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 ud({version:2,zip:!1,encrypt:!1,needAck:!0,direction:0,functionType:0,binary:!1},e)}},{key:"_handleAckMessage",value:function(e,t,r){var n,i=this._singlingCache.get(e);i&&(this._singlingCache.delete(e),200===t.code?i.success(t):i.error(t),uN.print("Signal",wm(n="<<<<<< [".concat(i.signalingType,"-ack] ")).call(n,e),t));iP.rtcSignaling(0,r,null==i?void 0:i.signalingType,"Ack","","",xD.DOWN)}},{key:"_handleP2PMsgFeedback",value:function(e){var t=this._p2pCache.get(e.id);t&&(this._p2pCache.delete(e.id),e.err===zP.SUCCESS?t.success(e.id,e):t.error(e))}}]),i}(uC.exports.EventEmitter),fN=function(){function e(){Wd(this,e),sd(this,"xhr",void 0),sd(this,"isSending",void 0),sd(this,"timeout",void 0),this.isSending=!1}return qd(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,c=e.stringify,u=void 0===c||c;return new X_((function(e,i){t.isSending=!0;var a=new XMLHttpRequest;a.open(r,n,!0);for(var c=0,d=SR(s);c<d.length;c++){var l=JT(d[c],2),h=l[0],f=l[1];a.setRequestHeader(h,f)}a.onreadystatechange=function(){if(4===a.readyState)if(t.isSending=!1,200===a.status)e(JSON.parse(a.responseText));else{var r=a.statusText,n=a.status;if(a.responseText)try{var o=JSON.parse(a.responseText);o.errMessage&&(r=o.errMessage),o.code&&(n=o.code)}catch(s){}i({message:r,code:n})}},a.onabort=function(){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),u&&(o=vk(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}(),pN=new RC("ICE Request",3),vN=function(){function e(){Wd(this,e),sd(this,"_request",void 0),this._request=new fN}var t,r,n;return qd(e,[{key:"getAccessNode",value:(n=km(Em().mark((function e(t,r,n,i,o,a,s,c){var u;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!(u=bP.getAccessNode(t))){e.next=9;break}if(this.getAccessNodeFromServer(t,r,n,i,o,a,s,c),pP("es.R.node.cache",u),!Array.isArray(u)){e.next=8;break}return e.abrupt("return",X_.resolve(u));case 8:return e.abrupt("return",X_.resolve([u]));case 9:return e.abrupt("return",this.getAccessNodeFromServer(t,r,n,i,o,a,s,c));case 10:case"end":return e.stop()}}),e,this)}))),function(e,t,r,i,o,a,s,c){return n.apply(this,arguments)})},{key:"getAccessNodeFromServer",value:(r=km(Em().mark((function e(t,r,n,i,o,a,s,c){var u,d,l,h,f=this;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return l=bP.getAccessUrls(),h=!0,pP("es.R.req.cache.urls",l),(null===(u=l)||void 0===u?void 0:u.length)>0||(l=RP.ICE_CONFIG_REQUEST_URLS,h=!1,pP("es.R.req.external.urls",l)),(null===(d=l)||void 0===d?void 0:d.length)>0||(l=RP.ICE_CONFIG_REQUEST_URLS_INTERNAL,h=!1,pP("es.R.req.internal.urls",l)),e.abrupt("return",this.getICEConfigFromServer(l,t,r,n,i,o,a,s,c).then((function(e){var r=e.nodes;return bP.setAccessNode(t,r,e.ttl||11200),e.dispatchDomains&&bP.setAccessUrls(e.dispatchDomains),r})).catch((function(e){if(h)return pP("es.R.req.fallback",""),bP.clearAccessUrls(),f.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,c){return r.apply(this,arguments)})},{key:"getICEConfigFromServer",value:(t=km(Em().mark((function e(t,r,n,i,o,a,s,c,u){var d,l,h,f,p=this;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return d={appID:r,userID:i,deviceID:o,connectSessionID:aw(),os:"web",sdkVersion:RP.VERSION,isOversea:RP.OVERSEA,expectedAddr:CP("EXPECTED_ADDR"),productPlatform:"BytePlus",enableCloudProxy:c,expectedIDC:u},a&&s&&(d.feedbackInfo=[{feedbackIP:null===(l=s.publicIPs[0])||void 0===l?void 0:l.ip,feedbackReason:{type:"NODE_CHANGED",reason:a}}],delete d.expectedAddr),h=Date.now(),iP.rtcGetAccess(0,vk(d),0,wD.REQUEST,t.join(","),d.connectSessionID),f=lk(t).call(t,function(){var e=km(Em().mark((function e(t,r){var n,i;return Em().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 lR(uR.ICE_SERVER_WRONG,"get ICE config failed",e.t0);case 9:if(200===n.code){e.next=11;break}throw new lR(uR.ICE_SERVER_WRONG,"get ICE config failed",{server_code:n.code,message:vk(n)});case 11:if(i=n.nodes[0]){e.next=14;break}throw new lR(uR.ICE_SERVER_WRONG,"ICE config server return empty nodes",{code:n.code,message:vk(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",Ow(f).then((function(e){var r=e.result;e.firstNode;var n=e.index;return iP.rtcGetAccess(200,vk(r),Date.now()-h,wD.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 iP.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,wD.RESPONSE,t.join(","),d.connectSessionID,{error:vk(i)}),e})));case 6:case"end":return e.stop()}}),e)}))),function(e,r,n,i,o,a,s,c,u){return t.apply(this,arguments)})},{key:"abort",value:function(){this._request.isSending&&(pN.print("abort","HTTP Request of [getICEConfigFromServer] abort"),this._request.abort())}}]),e}(),_N=function(){function e(){Wd(this,e),sd(this,"_request",void 0),this._request=new fN}return qd(e,[{key:"getConfig",value:function(e){var t,r=this,n={keys:["rts_report"],labelSelector:"",sdkVersion:"4.51.5",deviceType:"web",appId:e},i=lk(t=RP.CONFIG_REQUEST_DOMAINS).call(t,(function(e){return"https://".concat(e,"/decision/v1/multi")}));iP.rtcGetConfig(0,vk(n),0,i.join(","),kD.REQUEST,"",!1);var o=lk(i).call(i,function(){var e=km(Em().mark((function e(t,i){var o;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,r._request.post(t,n);case 3:o=e.sent,e.next=9;break;case 6:throw e.prev=6,e.t0=e.catch(0),new lR(uR.ICE_SERVER_WRONG,"get config failed");case 9:return e.abrupt("return",{result:o,index:i});case 10:case"end":return e.stop()}}),e,null,[[0,6]])})));return function(t,r){return e.apply(this,arguments)}}());return new X_((function(e){Ow(o).then((function(t){var r=t.result,n=t.index;iP.rtcGetConfig(200,vk(r),0,i[n],kD.RESPONSE,"",!1),e(r)})).catch((function(e){iP.rtcGetConfig(500,e.message,0,"",kD.RESPONSE,"",!1)}))}))}}]),e}(),mN=hi.f("asyncIterator");function gN(e){var t,r,n,i=2;for(void 0!==_l&&(r=mN,n=Nl);i--;){if(r&&null!=(t=e[r]))return t.call(e);if(n&&null!=(t=e[n]))return new yN(t.call(e));r="@@asyncIterator",n="@@iterator"}throw new TypeError("Object is not async iterable")}function yN(e){function t(e){if(Object(e)!==e)return X_.reject(new TypeError(e+" is not an object."));var t=e.done;return X_.resolve(e.value).then((function(e){return{value:e,done:t}}))}return(yN=function(e){this.s=e,this.n=e.next}).prototype={s:null,n:null,next:function(){return t(this.n.apply(this.s,arguments))},return:function(e){var r=this.s.return;return void 0===r?X_.resolve({value:e,done:!0}):t(r.apply(this.s,arguments))},throw:function(e){var r=this.s.return;return void 0===r?X_.reject(e):t(r.apply(this.s,arguments))}},new yN(e)}var SN=[{maxLayers:3,totalPixels:2073600},{maxLayers:3,totalPixels:921600},{maxLayers:3,totalPixels:518400},{maxLayers:2,totalPixels:230400},{maxLayers:2,totalPixels:129600},{maxLayers:1,totalPixels:57600},{maxLayers:1,totalPixels:0}];oy("Set",(function(e){return function(){return e(this,arguments.length?arguments[0]:void 0)}}),by);var EN=ee.Set;Rr({target:"Set",stat:!0,forced:!0},{from:xy}),Rr({target:"Set",stat:!0,forced:!0},{of:Py});var bN=x,kN=Ce,TN=tr,IN=function(){for(var e=TN(this),t=kN(e.add),r=0,n=arguments.length;r<n;r++)bN(t,e,arguments[r]);return e};Rr({target:"Set",proto:!0,real:!0,forced:!0},{addAll:IN}),Rr({target:"Set",proto:!0,real:!0,forced:!0},{deleteAll:Uy});var AN=_h,RN=tr,wN=Yt,CN=AN,ON=Nh;Rr({target:"Set",proto:!0,real:!0,forced:!0},{every:function(e){var t=RN(this),r=CN(t),n=wN(e,arguments.length>1?arguments[1]:void 0);return!ON(r,(function(e,r){if(!n(e,e,t))return r()}),{IS_ITERATOR:!0,INTERRUPTED:!0}).stopped}});var xN=oe,DN=x,PN=Ce,NN=tr,MN=Tf,LN=Nh;Rr({target:"Set",proto:!0,real:!0,forced:!0},{difference:function(e){var t=NN(this),r=new(MN(t,xN("Set")))(t),n=PN(r.delete);return LN(e,(function(e){DN(n,r,e)})),r}});var UN=oe,VN=x,FN=Ce,BN=tr,jN=Yt,GN=Tf,HN=AN,zN=Nh;Rr({target:"Set",proto:!0,real:!0,forced:!0},{filter:function(e){var t=BN(this),r=HN(t),n=jN(e,arguments.length>1?arguments[1]:void 0),i=new(GN(t,UN("Set"))),o=FN(i.add);return zN(r,(function(e){n(e,e,t)&&VN(o,i,e)}),{IS_ITERATOR:!0}),i}});var KN=tr,XN=Yt,qN=AN,WN=Nh;Rr({target:"Set",proto:!0,real:!0,forced:!0},{find:function(e){var t=KN(this),r=qN(t),n=XN(e,arguments.length>1?arguments[1]:void 0);return WN(r,(function(e,r){if(n(e,e,t))return r(e)}),{IS_ITERATOR:!0,INTERRUPTED:!0}).result}});var YN=oe,QN=x,JN=Ce,ZN=tr,$N=Tf,eM=Nh;Rr({target:"Set",proto:!0,real:!0,forced:!0},{intersection:function(e){var t=ZN(this),r=new($N(t,YN("Set"))),n=JN(t.has),i=JN(r.add);return eM(e,(function(e){QN(n,t,e)&&QN(i,r,e)})),r}});var tM=x,rM=Ce,nM=tr,iM=Nh;Rr({target:"Set",proto:!0,real:!0,forced:!0},{isDisjointFrom:function(e){var t=nM(this),r=rM(t.has);return!iM(e,(function(e,n){if(!0===tM(r,t,e))return n()}),{INTERRUPTED:!0}).stopped}});var oM=oe,aM=x,sM=Ce,cM=A,uM=tr,dM=_h,lM=Nh;Rr({target:"Set",proto:!0,real:!0,forced:!0},{isSubsetOf:function(e){var t=dM(this),r=uM(e),n=r.has;return cM(n)||(r=new(oM("Set"))(e),n=sM(r.has)),!lM(t,(function(e,t){if(!1===aM(n,r,e))return t()}),{IS_ITERATOR:!0,INTERRUPTED:!0}).stopped}});var hM=x,fM=Ce,pM=tr,vM=Nh;Rr({target:"Set",proto:!0,real:!0,forced:!0},{isSupersetOf:function(e){var t=pM(this),r=fM(t.has);return!vM(e,(function(e,n){if(!1===hM(r,t,e))return n()}),{INTERRUPTED:!0}).stopped}});var _M=Rr,mM=tr,gM=gn,yM=AN,SM=Nh,EM=b([].join),bM=[].push;_M({target:"Set",proto:!0,real:!0,forced:!0},{join:function(e){var t=mM(this),r=yM(t),n=void 0===e?",":gM(e),i=[];return SM(r,bM,{that:i,IS_ITERATOR:!0}),EM(i,n)}});var kM=oe,TM=Yt,IM=x,AM=Ce,RM=tr,wM=Tf,CM=AN,OM=Nh;Rr({target:"Set",proto:!0,real:!0,forced:!0},{map:function(e){var t=RM(this),r=CM(t),n=TM(e,arguments.length>1?arguments[1]:void 0),i=new(wM(t,kM("Set"))),o=AM(i.add);return OM(r,(function(e){IM(o,i,n(e,e,t))}),{IS_ITERATOR:!0}),i}});var xM=Ce,DM=tr,PM=AN,NM=Nh,MM=TypeError;Rr({target:"Set",proto:!0,real:!0,forced:!0},{reduce:function(e){var t=DM(this),r=PM(t),n=arguments.length<2,i=n?void 0:arguments[1];if(xM(e),NM(r,(function(r){n?(n=!1,i=r):i=e(i,r,r,t)}),{IS_ITERATOR:!0}),n)throw MM("Reduce of empty set with no initial value");return i}});var LM=tr,UM=Yt,VM=AN,FM=Nh;Rr({target:"Set",proto:!0,real:!0,forced:!0},{some:function(e){var t=LM(this),r=VM(t),n=UM(e,arguments.length>1?arguments[1]:void 0);return FM(r,(function(e,r){if(n(e,e,t))return r()}),{IS_ITERATOR:!0,INTERRUPTED:!0}).stopped}});var BM=oe,jM=x,GM=Ce,HM=tr,zM=Tf,KM=Nh;Rr({target:"Set",proto:!0,real:!0,forced:!0},{symmetricDifference:function(e){var t=HM(this),r=new(zM(t,BM("Set")))(t),n=GM(r.delete),i=GM(r.add);return KM(e,(function(e){jM(n,r,e)||jM(i,r,e)})),r}});var XM=oe,qM=Ce,WM=tr,YM=Tf,QM=Nh;Rr({target:"Set",proto:!0,real:!0,forced:!0},{union:function(e){var t=WM(this),r=new(YM(t,XM("Set")))(t);return QM(e,qM(r.add),{that:r}),r}});var JM=EN,ZM=new uE,$M=function(){var e=km(Em().mark((function e(t){return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",new X_((function(e,r){var n=CP("STATS_SCALLBACK_SUPPORT");if("chrome-stable"===lw()&&void 0===window.InstallTrigger&&hw&&n)try{t.getStats((function(t){var r=[];t.result().forEach((function(e){if(!Jm(nL).call(nL,e.type)){var t={};e.names().forEach((function(r){t[r]=e.stat(r)})),r.push(ud(ud({},t),{},{id:e.id,type:e.type,timestamp:e.timestamp}))}})),e({all:r,getTrackStats:function(e){return Gs(r).call(r,(function(t){return"ssrc"!==t.type||t.googTrackId===e}))}})}))}catch(mW){r(mW)}else e({all:[],getTrackStats:function(){return[]}})})));case 1:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),eL=function(){var e=km(Em().mark((function e(t){var r,n,i,o,a,s;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,t.getStats();case 2:return i=e.sent,o={all:[]},a=new uE,i.forEach((function(e){var t=a.get(e.type)||new uE;t.set(e.id,e),a.set(e.type,t),o.all.push(e)})),s=function(e,t){e.forEach((function(e){var r,n,i,o,s,c,u=e.codecId,d=e.transportId,l=e.trackId,h=e.playoutId;if(null===(r=a.get(rL.codec))||void 0===r||r.forEach((function(e){e.id===u&&t.add(e)})),null===(n=a.get(rL.transport))||void 0===n||n.forEach((function(e){e.id===d&&(s=e,t.add(e))})),null===(i=a.get(rL.track))||void 0===i||i.forEach((function(e){e.id===l&&t.add(e)})),null===(o=a.get(rL.mediaPlayout))||void 0===o||o.forEach((function(e){e.id===h&&t.add(e)})),s){var f,p,v=s,_=v.localCertificateId,m=v.remoteCertificateId,g=v.selectedCandidatePairId;null===(f=a.get(rL.certificate))||void 0===f||f.forEach((function(e){(e.id===_||e.id===m)&&t.add(e)})),null===(p=a.get(rL.candidatePair))||void 0===p||p.forEach((function(e){e.id===g&&(c=e,t.add(e))}))}if(c){var y,S,E=c,b=E.localCandidateId,k=E.remoteCandidateId;null===(y=a.get(rL.localCandidate))||void 0===y||y.forEach((function(e){e.id===b&&t.add(e)})),null===(S=a.get(rL.remoteCandidate))||void 0===S||S.forEach((function(e){e.id===k&&t.add(e)}))}}))},null===(r=a.get(rL.mediaSource))||void 0===r||r.forEach((function(e){var t,r=new JM;r.add(e);var n=[];null===(t=a.get(rL.outboundRtp))||void 0===t||t.forEach((function(t){var i;t.mediaSourceId===e.id&&(r.add(t),n.push(t),null===(i=a.get(rL.remoteInboundRtp))||void 0===i||i.forEach((function(e){e.localId===t.id&&r.add(e)})))})),s(n,r),o[e.trackIdentifier]=Xk(r)})),null===(n=a.get(rL.inboundRtp))||void 0===n||n.forEach((function(e){var t,r=new JM;r.add(e),null===(t=a.get(rL.remoteOutboundRtp))||void 0===t||t.forEach((function(t){t.localId===e.id&&r.add(t)})),s([e],r);var n,i=e.trackIdentifier;i||(null===(n=a.get(rL.track))||void 0===n||n.forEach((function(t){t.id===e.trackId&&(i=t.trackIdentifier)})));o[i]=Xk(r)})),e.abrupt("return",o);case 10:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),tL=function(){var e=km(Em().mark((function e(t,r,n){var i,o,a,s,c,u;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(i=null==r?void 0:r.id,t instanceof RTCPeerConnection){e.next=3;break}return e.abrupt("return",[]);case 3:if(!fw&&!pw){e.next=10;break}return o=[],e.next=7,t.getStats(r);case 7:return e.sent.forEach((function(e){o.push(e)})),e.abrupt("return",o);case 10:return(!(a=ZM.get(t))||Date.now()-a.timestamp>150)&&(a={timestamp:Date.now(),statsPromise:eL(t),extraStatsPromise:$M(t)},ZM.set(t,a)),e.next=14,a.statsPromise;case 14:if(s=e.sent,c=(i?s[i]:s.all)||[],n){e.next=21;break}return e.next=19,a.extraStatsPromise;case 19:u=e.sent,c=wm(c).call(c,(i?u.getTrackStats(i):u.all)||[]);case 21:return e.abrupt("return",c);case 22:case"end":return e.stop()}}),e)})));return function(t,r,n){return e.apply(this,arguments)}}();lw();var rL=function(e){return e.codec="codec",e.inboundRtp="inbound-rtp",e.outboundRtp="outbound-rtp",e.remoteInboundRtp="remote-inbound-rtp",e.remoteOutboundRtp="remote-outbound-rtp",e.mediaSource="media-source",e.csrc="csrc",e.peerConnection="peer-connection",e.dataChannel="data-channel",e.stream="stream",e.track="track",e.transceiver="transceiver",e.sender="sender",e.receiver="receiver",e.transport="transport",e.sctpTransport="sctp-transport",e.candidatePair="candidate-pair",e.localCandidate="local-candidate",e.remoteCandidate="remote-candidate",e.certificate="certificate",e.iceServer="ice-server",e.mediaPlayout="media-playout",e}(rL||{}),nL=["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"],iL=function(){var e=km(Em().mark((function e(){return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(e.prev=0,!uw()&&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,fL();case 5:if(e.t0=e.sent,!e.t0){e.next=10;break}return e.next=9,hL();case 9:e.t0=e.sent;case 10:return e.abrupt("return",e.t0);case 13:return e.prev=13,e.t1=e.catch(0),e.abrupt("return",!1);case 16:case"end":return e.stop()}}),e,null,[[0,13]])})));return function(){return e.apply(this,arguments)}}(),oL=function(){var e=km(Em().mark((function e(){var t;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=[],e.next=3,fL();case 3:if(e.t0=e.sent,!e.t0){e.next=8;break}return e.next=7,hL();case 7:e.t0=e.sent;case 8:if(!e.t0){e.next=10;break}t.push("H264");case 10:return e.next=12,vL();case 12:if(e.t1=e.sent,!e.t1){e.next=17;break}return e.next=16,pL();case 16:e.t1=e.sent;case 17:if(!e.t1){e.next=19;break}t.push("vp8");case 19:return e.abrupt("return",t);case 20:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),aL=function(){var e=km(Em().mark((function e(){var t;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,oL();case 2:return t=e.sent,e.abrupt("return",lk(t).call(t,(function(e){return e.toUpperCase()})));case 4:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),sL={};function cL(e){var t;if(bb(t=["level-asymmetry-allowed=1;packetization-mode=1;profile-level-id=42e01f","profile-level-id=42e01f;level-asymmetry-allowed=1;packetization-mode=1","packetization-mode=1;profile-level-id=42e01f;level-asymmetry-allowed=1"]).call(t,(function(t){return null==e?void 0:Jm(e).call(e,t)}))){for(var r=navigator.userAgent.toLowerCase(),n=!1,i=0,o=["miuibrowser"];i<o.length;i++){var a=o[i];Jm(r).call(r,a)&&(n=!0)}return!n}return!1}var uL=function(){var e=km(Em().mark((function e(t){var r,n;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return(r=new RTCPeerConnection).addTransceiver("audio",{direction:t}),r.addTransceiver("video",{direction:t}),e.next=5,r.createOffer();case 5:return n=e.sent,r.close(),e.abrupt("return",n.sdp);case 8:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),dL=function(){var e=km(Em().mark((function e(){var t,r;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,uL("sendonly");case 2:if(r=e.sent,!Jm(t=navigator.userAgent).call(t,"VivoBrowser")){e.next=7;break}return e.next=6,uL("sendonly");case 6:r=e.sent;case 7:return sL.h264encode=cL(r),sL.vp8encode=Pb(r).call(r,"VP8")>-1,e.abrupt("return",sL);case 10:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),lL=function(){var e=km(Em().mark((function e(){var t,r;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,uL("recvonly");case 2:if(r=e.sent,!Jm(t=navigator.userAgent).call(t,"VivoBrowser")){e.next=7;break}return e.next=6,uL("recvonly");case 6:r=e.sent;case 7:return sL.h264decode=cL(r),sL.vp8decode=Pb(r).call(r,"VP8")>-1,e.abrupt("return",sL);case 10:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),hL=function(){var e=km(Em().mark((function e(){return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(void 0!==sL.h264encode){e.next=9;break}return e.prev=1,e.next=4,dL();case 4:e.next=9;break;case 6:return e.prev=6,e.t0=e.catch(1),e.abrupt("return",!1);case 9:return e.abrupt("return",sL.h264encode||!1);case 10:case"end":return e.stop()}}),e,null,[[1,6]])})));return function(){return e.apply(this,arguments)}}(),fL=function(){var e=km(Em().mark((function e(){return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(void 0!==sL.h264decode){e.next=9;break}return e.prev=1,e.next=4,lL();case 4:e.next=9;break;case 6:return e.prev=6,e.t0=e.catch(1),e.abrupt("return",!1);case 9:return e.abrupt("return",sL.h264decode||!1);case 10:case"end":return e.stop()}}),e,null,[[1,6]])})));return function(){return e.apply(this,arguments)}}(),pL=function(){var e=km(Em().mark((function e(){return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(void 0!==sL.vp8encode){e.next=9;break}return e.prev=1,e.next=4,dL();case 4:e.next=9;break;case 6:return e.prev=6,e.t0=e.catch(1),e.abrupt("return",!1);case 9:return e.abrupt("return",sL.vp8encode||!1);case 10:case"end":return e.stop()}}),e,null,[[1,6]])})));return function(){return e.apply(this,arguments)}}(),vL=function(){var e=km(Em().mark((function e(){return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(void 0!==sL.vp8decode){e.next=9;break}return e.prev=1,e.next=4,lL();case 4:e.next=9;break;case 6:return e.prev=6,e.t0=e.catch(1),e.abrupt("return",!1);case 9:return e.abrupt("return",sL.vp8decode||!1);case 10:case"end":return e.stop()}}),e,null,[[1,6]])})));return function(){return e.apply(this,arguments)}}(),_L=function(){return"undefined"!=typeof TransformStream&&"undefined"!=typeof RTCRtpSender&&"undefined"!=typeof RTCRtpReceiver&&void 0!==RTCRtpSender.prototype.createEncodedStreams&&void 0!==RTCRtpReceiver.prototype.createEncodedStreams},mL={},gL={},yL={exports:{}},SL=yL.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"]}]};an(SL).forEach((function(e){SL[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=yL.exports,i=RegExp.prototype.test.bind(/^([a-z])=(.*)/);e.parse=function(e){var t,o={},a=[],s=o;return Gs(t=e.split(/(\r\n|\r|\n)/)).call(t,i).forEach((function(e){var t=e[0],i=Sm(e).call(e,2);"m"===t&&(a.push({rtp:[],fmtp:[]}),s=a[a.length-1]);for(var o=0;o<(n[t]||[]).length;o+=1){var c=n[t][o];if(c.reg.test(i))return r(c,s,i)}})),o.media=a,o};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){var t;return TE(t=e.split(/;\s?/)).call(t,o,{})},e.parseFmtpConfig=e.parseParams,e.parsePayloads=function(e){var t;return lk(t=e.toString().split(" ")).call(t,Number)},e.parseRemoteCandidates=function(e){for(var r,n=[],i=lk(r=e.split(" ")).call(r,t),o=0;o<i.length;o+=3)n.push({component:i[o],ip:i[o+1],port:i[o+2]});return n},e.parseImageAttributes=function(e){var t;return lk(t=e.split(" ")).call(t,(function(e){var t;return TE(t=e.substring(1,e.length-1).split(",")).call(t,o,{})}))},e.parseSimulcastStreamList=function(e){var r;return lk(r=e.split(";")).call(r,(function(e){var r;return lk(r=e.split(",")).call(r,(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}}))}))}}(gL);var EL=yL.exports,bL=/%[sdv%]/g,kL=function(e){var t=1,r=arguments,n=r.length;return e.replace(bL,(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""}}))},TL=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 kL.apply(null,n)},IL=["v","o","s","i","u","e","p","c","b","t","r","z","a"],AL=["i","c","b","a"],RL=gL,wL=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||IL,n=t.innerOrder||AL,i=[];return r.forEach((function(t){EL[t].forEach((function(r){r.name in e&&null!=e[r.name]?i.push(TL(t,r,e)):r.push in e&&null!=e[r.push]&&e[r.push].forEach((function(e){i.push(TL(t,r,e))}))}))})),e.media.forEach((function(e){i.push(TL("m",EL.m[0],e)),n.forEach((function(t){EL[t].forEach((function(r){r.name in e&&null!=e[r.name]?i.push(TL(t,r,e)):r.push in e&&null!=e[r.push]&&e[r.push].forEach((function(e){i.push(TL(t,r,e))}))}))}))})),i.join("\r\n")+"\r\n"};mL.write=wL,mL.parse=RL.parse,mL.parseParams=RL.parseParams,mL.parseFmtpConfig=RL.parseFmtpConfig,mL.parsePayloads=RL.parsePayloads,mL.parseRemoteCandidates=RL.parseRemoteCandidates,mL.parseImageAttributes=RL.parseImageAttributes,mL.parseSimulcastStreamList=RL.parseSimulcastStreamList;var CL=new RC("FirefoxHandler",3),OL=Math.pow(2,32),xL="kp34Za0H+aVf862l",DL="o/i14u9pJrxRKAsu";function PL(e){return e>OL-18?(CL.print("generateAllSsrc","reset start id",e),PL(e=e-OL+1e4+18)):{audio:e,audioFec:e+1,audioRtx:e+2,video:e+3,videoFec:e+4,videoRtx:e+5,next:e+18}}var NL=function(e,t,r){var n,i,o,a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:DL;return[{id:r,attribute:"cname",value:a},{id:r,attribute:"msid",value:wm(n=wm(i="".concat(e," ")).call(i,e,"-")).call(n,t)},{id:r,attribute:"mslabel",value:"".concat(e)},{id:r,attribute:"label",value:wm(o="".concat(e,"-")).call(o,t)}]},ML=function(e,t){var r,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=t.video,o=t.videoRtx,a=t.videoFec,s=[i,o],c=n.cname,u=n.flexfec;u&&s.push(a);var d,l=TE(s).call(s,(function(t,r){return wm(t).call(t,NL(e,"video",r,c))}),[]),h=[{semantics:"FID",ssrcs:wm(r="".concat(i," ")).call(r,o)}];u&&h.push({semantics:"FEC-FR",ssrcs:wm(d="".concat(i," ")).call(d,a)});return{ssrcs:l,ssrcGroups:h}};function LL(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 UL=function(e,t,r){var n=!(arguments.length>3&&void 0!==arguments[3])||arguments[3],i=ud(ud({},e),{},{media:[]});return n&&(i.invalid=[{value:"realx-exts:rscp"}]),t&&i.media.push(t),r&&i.media.push(r),delete i.groups,delete i.msidSemantic,mL.write(i)};function VL(e){return FL.apply(this,arguments)}function FL(){return(FL=km(Em().mark((function e(t){var r,n,i,o,a;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r={},n=t.publicIPs,i=t.certFingerprint,o=t.iceParams,a=t.iceConfig,r.fingerprint={type:"sha-256",hash:i},r.icePwd=o.serverIcePwd,e.next=6,jL(o.serverIceUfrag);case 6:return r.iceUfrag=e.sent,r.candidates=BL(n,a),r.setup="active",r.iceOptions="renomination",e.abrupt("return",r);case 11:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function BL(e,t){if(!Array.isArray(e))return[];var r=0,n=2130706431,i=[],o=CP("CONNECTION_MODE");return e.forEach((function(e){var a={component:1,ip:e.ip,type:"host",generation:e.generation};e.udpPorts&&!t.tcpOnly&&o!==Fd.FORCE_TCP&&e.udpPorts.forEach((function(e){i.push(ud(ud({},a),{},{foundation:r++,transport:"udp",port:e,priority:n}))})),e.tcpPorts&&o!==Fd.FORCE_UDP&&e.tcpPorts.forEach((function(e){i.push(ud(ud({},a),{},{foundation:r++,transport:"tcp",port:e,tcptype:"passive",priority:2130705431}))}))})),i}var jL=function(){var e=km(Em().mark((function e(t){var r,n,i,o,a,s,c;return Em().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,dw.b64str2ab(t);case 5:return e.t1=e.sent,i=new e.t0(e.t1),o=new Uint8Array(4),crypto.getRandomValues(o),(a=new Uint8Array(2))[0]=0,a[1]=1,s=cw(Uint8Array,n,i,o,a),e.next=15,dw.ab2b64str(s.buffer);case 15:return c=e.sent,e.abrupt("return",c);case 17:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),GL=function(e,t){var r=0;if(Array.isArray(e.fmtp)&&Array.isArray(e.rtp)){var n,i=QT(e.fmtp);try{for(i.s();!(n=i.n()).done;){var o,a,s,c=n.value;if(Jm(o=c.config).call(o,"level-asymmetry-allowed=1")&&Jm(a=c.config).call(a,"packetization-mode=1")&&Jm(s=c.config).call(s,"profile-level-id=42e01f")){r=c.payload;break}}}catch(p){i.e(p)}finally{i.f()}for(var u=0;u<e.rtp.length;u++){var d=e.rtp[u];if("H264"===t){if(d.payload===r){var l;e.rtp.unshift(ok(l=e.rtp).call(l,u,1)[0]);break}}else if(d.codec===t){var h;e.rtp.unshift(ok(h=e.rtp).call(h,u,1)[0]);break}}var f=[];e.rtp.forEach((function(e){return f.push(e.payload)})),e.payloads=f.join(" ")}},HL=new RC("BasicHandler",3),zL={iceServers:[],iceTransportPolicy:"all",bundlePolicy:"max-bundle",rtcpMuxPolicy:"require",sdpSemantics:"unified-plan",encodedInsertableStreams:!!_L()||void 0},KL=function(e){OI(o,e);var t,r,n,i=qI(o);function o(e,t){var r;return Wd(this,o),sd(ZT(r=i.call(this)),"_peerConnection",void 0),sd(ZT(r),"_dataChannel",void 0),sd(ZT(r),"_context",void 0),sd(ZT(r),"monitor",void 0),sd(ZT(r),"_offerIce",{}),sd(ZT(r),"_answerIce",{}),sd(ZT(r),"_initSctpEvents",!1),sd(ZT(r),"_nextSsrc",Math.floor(Math.random()*OL+1e4)),sd(ZT(r),"_aSendonlyAnswerTpl",void 0),sd(ZT(r),"_vSendonlyAnswerTpl",void 0),sd(ZT(r),"_enableSubFlexfec",!1),sd(ZT(r),"audioTrack4ff",void 0),sd(ZT(r),"connection_id",""),sd(ZT(r),"ms_addr",""),r.monitor=e,r._peerConnection=new RTCPeerConnection(zL),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,i,o,a=null===(t=e.streams)||void 0===t||null===(n=t[0])||void 0===n?void 0:n.id;HL.print("constructor",wm(i=wm(o="pc.ontrack ".concat(e.track.kind," ")).call(o,e.track.id," ")).call(i,a)),"ff-stream"===a&&(r.audioTrack4ff=e.track),r.emit("ontrack",e)},r._peerConnection.onconnectionstatechange=function(e){var t;HL.print("constructor",wm(t="onconnectionstatechange ".concat(r._peerConnection.iceConnectionState," -> ")).call(t,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,CD["".concat(t.toUpperCase())],r.connection_id,{ms_addr:r.ms_addr})},r}return qd(o,[{key:"disconnect",value:function(){this._peerConnection.close(),this._dataChannel.close(),this._peerConnection.ontrack=null}},{key:"destroy",value:function(){HL.print("destroy"),this.disconnect(),this._context=void 0}},{key:"getTransceivers",value:function(){return this._peerConnection.getTransceivers()}},{key:"_simulcast",value:function(e,t,r,n,i){var o,a,s,c=[];1===e.videoEncodeConfig.length?(c=function(e,t){var r=[];if(t<=1)return r;var n=Math.min(e.width,e.height)/90;return r.push({scaleResolutionDownBy:n,width:Math.floor(e.width/n),height:Math.floor(e.height/n),maxkbps:100,frameRate:10}),t<=2||r.unshift({scaleResolutionDownBy:2,width:Math.floor(e.width/2),height:Math.floor(e.height/2),maxkbps:Math.floor(e.maxKbps/2),frameRate:e.frameRate>=30?Math.floor(e.frameRate/2):e.frameRate}),r}(t,i),HL.print("simulcast() ","simulcastLayers: %o",c)):(c=lk(o=Sm(a=Sm(s=e.videoEncodeConfig).call(s,1)).call(a,1-i)).call(o,(function(e){var r=Bw(e.width),n=t.width/r;return{width:r,height:Math.floor(t.height/n),scaleResolutionDownBy:n,frameRate:Bw(e.frameRate)||15,maxkbps:e.maxKbps||600}})),HL.print("simulcast() ","simulcastLayers2: %o",c));var u=[!0];c.forEach((function(e,t){var i,o={maxBitrate:1e3*e.maxkbps,scaleResolutionDownBy:e.scaleResolutionDownBy,rid:"".concat(t+1),maxFramerate:e.frameRate};null===(i=r.sendEncodings)||void 0===i||i.unshift(o),n.push({width:e.width,height:e.height,framerate:e.frameRate,maxkbps:e.maxkbps,rid:"".concat(t+1)}),u.push(!0)})),this._context&&(this._context.activeSimStreams=u)}},{key:"internalPublish",value:function(e){var t=e.stream,r=e.videoTrack,n=e.audioTrack,i=e.enableSimulcast,o=e.pubAudio,a=e.pubVideo,s={direction:"sendonly",streams:[t]},c={direction:"sendonly",streams:[t]},u=[],d=[];if(Array.isArray(null==e?void 0:e.videoEncodeConfig)&&e.videoEncodeConfig.length){var l=null==r?void 0:r.getTrack(),h=ud({},xP);if(l){var f=null==l?void 0:l.getSettings();h={width:Math.floor(f.width),height:Math.floor(f.height),frameRate:Math.floor(f.frameRate)}}"number"!=typeof h.frameRate&&(h.frameRate=30);var p=null==e?void 0:e.videoEncodeConfig[0],v={maxBitrate:1e3*p.maxKbps,rid:"0"};if(e.prevBitrate=p.maxKbps,c.sendEncodings=[v],u.push({width:h.width,height:h.height,framerate:h.frameRate,maxkbps:p.maxKbps,rid:"0"}),!fw&&i){var _,m,g=function(e){for(var t=0,r=e.width*e.height,n=0;n<SN.length;n++)if(r>=SN[n].totalPixels){t=n;break}if(0===t)return SN[t].maxLayers;var i=SN[t-1].totalPixels;return(i-r)/(i-SN[t].totalPixels)<.1?SN[t-1].maxLayers:SN[t].maxLayers}(h);if(HL.print("simulcast() ","maxLayers: %o",g),g>1)this._simulcast(e,ud(ud({},h),{},{maxKbps:p.maxKbps}),c,u,g),null!==(_=this._context)&&void 0!==_&&null!==(m=_.serverConfig)&&void 0!==m&&m.simulcastOnDemand&&(d=lk(u).call(u,(function(e,t){return ud(ud({},e),{},{video_index:t,sub_index:t})})))}}HL.print("publish videoTransceiverInit videoDescriptions","",c,u);var y=null==n?void 0:n.getTrack("preprocessing");(null==n?void 0:n.mixType)!==Gd.PLAYOUT&&null!=n&&n.mixedAudioTrack&&(y=null==n?void 0:n.mixedAudioTrack),y=o&&y?y:"audio";var S=null==r?void 0:r.getTrack("preprocessing");S=a&&S?S:"video";try{this.monitor.rtcInvokeStatus(vk({aTrack:Lw(y),vTrack:Lw(S),audioTransceiverInit:s,videoTransceiverInit:c}),0,"Handler.internalPublish","",0)}catch(mW){}return{semantics:"unified-plan",videoDescriptions:u,subVideoDescriptions:d,audioTransceiverInit:{track:y,init:s},videoTransceiverInit:{track:S,init:c}}}},{key:"updateMaxBitrate",value:function(e){var t,r,n,i;HL.print("updateMaxBitrate()");var o=null===(t=e.videoTrack)||void 0===t?void 0:t.getTrack(),a=e.videoTransceiver;if(o&&e.pubVideo&&a){var s=null===(r=e.videoEncodeConfig)||void 0===r||null===(n=r[0])||void 0===n?void 0:n.maxKbps;if(s){if(s===e.prevBitrate)return void HL.print("updateMaxBitrate()","no change");e.prevBitrate=s}var c=null===(i=a.sender)||void 0===i?void 0:i.getParameters();if(c){var u;c.encodings=null==c||null===(u=c.encodings)||void 0===u?void 0:lk(u).call(u,(function(t){var r,n=+t.rid||0,i=null===(r=e.videoEncodeConfig[n])||void 0===r?void 0:r.maxKbps;return"number"==typeof i&&(t.maxBitrate=1e3*i),t})),null==a||a.sender.setParameters(c);try{this.monitor.rtcInvokeStatus(vk(c.encodings),0,"Handler.updateScaleResolutionDownBy","",0)}catch(mW){}}}else HL.print("updateMaxBitrate()","no pub")}},{key:"getStats",value:function(e,t){return tL(this._peerConnection,e,t)}},{key:"setLocalDescription",value:(n=km(Em().mark((function e(t,r){var n,i,o,a=this;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=sw(),e.prev=1,e.next=4,this._peerConnection.setLocalDescription(new RTCSessionDescription({type:"offer",sdp:t}));case 4:this.monitor.rtcSetDescription(0,t,ND.W_1,"local"===(null==r?void 0:r.streamUserId)?MD.UP:MD.DOWN,(null==r?void 0:r.streamId)||"",(null==r?void 0:r.streamUserId)||"",sw()-n,this.connection_id,{type:"offer",ms_addr:this.ms_addr}),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,{ms_addr:a.ms_addr},a.connection_id)},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,{ms_addr:a.ms_addr},a.connection_id)}))),e.next=12;break;case 8:e.prev=8,e.t0=e.catch(1),console.error("setLocal",e.t0),this.monitor.rtcSetDescription(-1,e.t0.message+t,ND.W_1,"local"===(null==r?void 0:r.streamUserId)?MD.UP:MD.DOWN,"","",sw()-n,this.connection_id,{type:"offer",ms_addr:this.ms_addr});case 12:case"end":return e.stop()}}),e,this,[[1,8]])}))),function(e,t){return n.apply(this,arguments)})},{key:"setRemoteDescription",value:(r=km(Em().mark((function e(t,r){var n;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=sw(),e.prev=1,e.next=4,this._peerConnection.setRemoteDescription(new RTCSessionDescription({type:"answer",sdp:t}));case 4:this.monitor.rtcSetDescription(0,t,ND.W_0,"local"===(null==r?void 0:r.streamUserId)?MD.UP:MD.DOWN,(null==r?void 0:r.streamId)||"",(null==r?void 0:r.streamUserId)||"",sw()-n,this.connection_id,{type:"answer",ms_addr:this.ms_addr}),e.next=11;break;case 7:e.prev=7,e.t0=e.catch(1),console.error("setRemote",e.t0),this.monitor.rtcSetDescription(-1,e.t0.message+t,ND.W_1,"local"===(null==r?void 0:r.streamUserId)?MD.UP:MD.DOWN,(null==r?void 0:r.streamId)||"",(null==r?void 0:r.streamUserId)||"",sw()-n,this.connection_id,{type:"answer",ms_addr:this.ms_addr});case 11:case"end":return e.stop()}}),e,this,[[1,7]])}))),function(e,t){return r.apply(this,arguments)})},{key:"setCurrentDescription",value:(t=km(Em().mark((function e(){return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:case"end":return e.stop()}}),e)}))),function(){return t.apply(this,arguments)})},{key:"createAVMlineAnswerTpl",value:function(e){var t=this;mL.parse(e).media.forEach((function(e){if("audio"===e.type){if("sendonly"===e.direction){var r,n=null==e?void 0:bb(r=e.rtp).call(r,(function(e){return"opus"===e.codec}));if(n&&null!=e&&e.fmtp){var i,o=null==e?void 0:bb(i=e.fmtp).call(i,(function(e){return e.payload===n.payload}));o&&t._context&&(o.config+=";stereo=1;sprop-stereo=1")}t._aSendonlyAnswerTpl=e}}else"video"===e.type&&("sendonly"===e.direction&&(t._vSendonlyAnswerTpl=e),Array.isArray(e.rtp)&&e.rtp.forEach((function(e){var r;null!==(r=e.codec)&&void 0!==r&&Jm(r).call(r,"flexfec")&&(t._enableSubFlexfec=!0)})))}))}},{key:"pc",get:function(){return this._peerConnection}},{key:"addBitrateLimit",value:function(e,t){null==e||e.rtp.forEach((function(r){var n,i=r.codec,o=r.payload;if(Jm(n=["vp8","h264"]).call(n,i.toLocaleLowerCase())){var a,s,c=bb(a=e.fmtp).call(a,(function(e){return e.payload===o}));if(c)c.config=wm(s=[]).call(s,Wk(c.config.split(";")),["x-google-min-bitrate=100","x-google-start-bitrate=".concat(t)]).join(";");else e.fmtp.push({payload:o,config:"x-google-min-bitrate=100;x-google-start-bitrate=".concat(t)})}}))}}]),o}(uC.exports.EventEmitter),XL=b,qL=sy,WL=Sg.exports.getWeakData,YL=vf,QL=tr,JL=z,ZL=$,$L=Nh,eU=Ye,tU=Zi.set,rU=Zi.getterFor,nU=No.find,iU=No.findIndex,oU=XL([].splice),aU=0,sU=function(e){return e.frozen||(e.frozen=new cU)},cU=function(){this.entries=[]},uU=function(e,t){return nU(e.entries,(function(e){return e[0]===t}))};cU.prototype={get:function(e){var t=uU(this,e);if(t)return t[1]},has:function(e){return!!uU(this,e)},set:function(e,t){var r=uU(this,e);r?r[1]=t:this.entries.push([e,t])},delete:function(e){var t=iU(this.entries,(function(t){return t[0]===e}));return~t&&oU(this.entries,t,1),!!~t}};var dU,lU={getConstructor:function(e,t,r,n){var i=e((function(e,i){YL(e,o),tU(e,{type:t,id:aU++,frozen:void 0}),JL(i)||$L(i,e[n],{that:e,AS_ENTRIES:r})})),o=i.prototype,a=rU(t),s=function(e,t,r){var n=a(e),i=WL(QL(t),!0);return!0===i?sU(n).set(t,r):i[n.id]=r,e};return qL(o,{delete:function(e){var t=a(this);if(!ZL(e))return!1;var r=WL(e);return!0===r?sU(t).delete(e):r&&eU(r,t.id)&&delete r[t.id]},has:function(e){var t=a(this);if(!ZL(e))return!1;var r=WL(e);return!0===r?sU(t).has(e):r&&eU(r,t.id)}}),qL(o,r?{get:function(e){var t=a(this);if(ZL(e)){var r=WL(e);return!0===r?sU(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}},hU=n,fU=b,pU=sy,vU=Sg.exports,_U=oy,mU=lU,gU=$,yU=Rg,SU=Zi.enforce,EU=Vi,bU=!hU.ActiveXObject&&"ActiveXObject"in hU,kU=function(e){return function(){return e(this,arguments.length?arguments[0]:void 0)}},TU=_U("WeakMap",kU,mU);if(EU&&bU){dU=mU.getConstructor(kU,"WeakMap",!0),vU.enable();var IU=TU.prototype,AU=fU(IU.delete),RU=fU(IU.has),wU=fU(IU.get),CU=fU(IU.set);pU(IU,{delete:function(e){if(gU(e)&&!yU(e)){var t=SU(this);return t.frozen||(t.frozen=new dU),AU(this,e)||t.frozen.delete(e)}return AU(this,e)},has:function(e){if(gU(e)&&!yU(e)){var t=SU(this);return t.frozen||(t.frozen=new dU),RU(this,e)||t.frozen.has(e)}return RU(this,e)},get:function(e){if(gU(e)&&!yU(e)){var t=SU(this);return t.frozen||(t.frozen=new dU),RU(this,e)?wU(this,e):t.frozen.get(e)}return wU(this,e)},set:function(e,t){if(gU(e)&&!yU(e)){var r=SU(this);r.frozen||(r.frozen=new dU),RU(this,e)?CU(this,e,t):r.frozen.set(e,t)}else CU(this,e,t);return this}})}var OU=ee.WeakMap;Rr({target:"WeakMap",proto:!0,real:!0,forced:!0},{emplace:jy}),Rr({target:"WeakMap",stat:!0,forced:!0},{from:xy}),Rr({target:"WeakMap",stat:!0,forced:!0},{of:Py}),Rr({target:"WeakMap",proto:!0,real:!0,forced:!0},{deleteAll:Uy}),Rr({target:"WeakMap",proto:!0,real:!0,forced:!0},{upsert:cE});var xU=OU,DU=function(e){OI(f,e);var t,r,n,i,o,a,s,c,u,d,l,h=qI(f);function f(){var e,t,r;return Wd(this,f),sd(ZT(r=h.call(this)),"inited",!1),sd(ZT(r),"deviceMap",{audioinput:new uE,audiooutput:new uE,videoinput:new uE}),sd(ZT(r),"checkDeviceChangeTimer",null),sd(ZT(r),"isSupportedPermissionsQuery",!1),sd(ZT(r),"isGrantedMicrophonePermission",!1),sd(ZT(r),"isGrantedCameraPermission",!1),r.isSupportedPermissionsQuery=!uw()&&!(null===(e=navigator)||void 0===e||null===(t=e.permissions)||void 0===t||!t.query),r._handleDeviceChange=r._handleDeviceChange.bind(ZT(r)),!uw()&&r.refreshDevices(),r}return qd(f,[{key:"refreshDevices",value:(l=km(Em().mark((function e(){var t,r,n=this;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(navigator.mediaDevices){e.next=2;break}return e.abrupt("return");case 2:if(t=void 0,!fw){e.next=12;break}return e.prev=4,e.next=7,navigator.mediaDevices.getUserMedia({audio:!0});case 7:t=e.sent,e.next=12;break;case 10:e.prev=10,e.t0=e.catch(4);case 12:return e.next=14,navigator.mediaDevices.enumerateDevices();case 14:r=e.sent,t&&t.getTracks().forEach((function(e){return e.stop()})),r.forEach((function(e){var t;e.deviceId&&(null===(t=n.deviceMap[e.kind])||void 0===t||t.set(e.deviceId,e))})),this.inited||this.initListener(),this.inited=!0;case 19:case"end":return e.stop()}}),e,this,[[4,10]])}))),function(){return l.apply(this,arguments)})},{key:"initListener",value:(d=km(Em().mark((function e(){var t,r,n,i,o=this;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(void 0!==(null===(t=navigator.mediaDevices)||void 0===t?void 0:t.ondevicechange)&&"function"==typeof(null===(r=navigator.mediaDevices)||void 0===r?void 0:r.addEventListener)?navigator.mediaDevices.addEventListener("devicechange",(function(){o._handleDeviceChange(),setTimeout((function(){o._handleDeviceChange()}),300)})):this.checkDeviceChangeTimer=window.setInterval((function(){o._handleDeviceChange()}),3e3),!this.isSupportedPermissionsQuery){e.next=22;break}return e.prev=2,e.next=5,navigator.permissions.query({name:"microphone"});case 5:n=e.sent,this.isGrantedMicrophonePermission="granted"===n.state,n.addEventListener("change",(function(){o.isGrantedMicrophonePermission="granted"===n.state})),e.next=12;break;case 10:e.prev=10,e.t0=e.catch(2);case 12:return e.prev=12,e.next=15,navigator.permissions.query({name:"camera"});case 15:i=e.sent,this.isGrantedCameraPermission="granted"===i.state,i.addEventListener("change",(function(){o.isGrantedCameraPermission="granted"===i.state})),e.next=22;break;case 20:e.prev=20,e.t1=e.catch(12);case 22:case"end":return e.stop()}}),e,this,[[2,10],[12,20]])}))),function(){return d.apply(this,arguments)})},{key:"_handleDeviceChange",value:(u=km(Em().mark((function e(){var t,r,n,i,o,a,s,c=this;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(o=void 0,!fw){e.next=5;break}return e.next=4,navigator.mediaDevices.getUserMedia({audio:!0});case 4:o=e.sent;case 5:return e.next=7,navigator.mediaDevices.enumerateDevices();case 7:a=e.sent,a=Gs(a).call(a,(function(e){return!!e.deviceId})),o&&o.getTracks().forEach((function(e){return e.stop()})),s=Xk(wm(t=[]).call(t,Wk(tA(r=this.deviceMap.audioinput).call(r)),Wk(tA(n=this.deviceMap.videoinput).call(n)),Wk(tA(i=this.deviceMap.audiooutput).call(i)))),a.forEach((function(e){var t,r,n=c.deviceMap[e.kind].get(e.deviceId);c.deviceMap[e.kind].set(e.deviceId,e),n||(Jm(t=e.kind).call(t,"video")?c.emit(Kd.onVideoDeviceStateChanged,{mediaDeviceInfo:e,deviceState:"active"}):Jm(r=e.kind).call(r,"audio")&&c.emit(Kd.onAudioDeviceStateChanged,{mediaDeviceInfo:e,deviceState:"active"}))})),s.forEach((function(e){var t,r;bb(a).call(a,(function(t){return t.deviceId===e.deviceId&&t.kind===e.kind}))||(c.deviceMap[e.kind].delete(e.deviceId),Jm(t=e.kind).call(t,"video")?c.emit(Kd.onVideoDeviceStateChanged,{mediaDeviceInfo:e,deviceState:"inactive"}):Jm(r=e.kind).call(r,"audio")&&c.emit(Kd.onAudioDeviceStateChanged,{mediaDeviceInfo:e,deviceState:"inactive"}))}));case 13:case"end":return e.stop()}}),e,this)}))),function(){return u.apply(this,arguments)})},{key:"getUserMedia",value:(c=km(Em().mark((function e(t){var r;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,navigator.mediaDevices.getUserMedia(t);case 2:return r=e.sent,null!=t&&t.audio&&(this.isGrantedMicrophonePermission=!0),null!=t&&t.video&&(this.isGrantedCameraPermission=!0),this.refreshDevices(),e.abrupt("return",r);case 7:case"end":return e.stop()}}),e,this)}))),function(e){return c.apply(this,arguments)})},{key:"checkPermissionsByDevices",value:(s=km(Em().mark((function e(){var t,r;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t={audio:!1,video:!1},navigator.mediaDevices){e.next=3;break}return e.abrupt("return",t);case 3:return e.next=5,navigator.mediaDevices.enumerateDevices();case 5:return r=e.sent,t.audio=Gs(r).call(r,(function(e){return"audioinput"===e.kind&&e.label&&e.deviceId})).length>0,t.video=Gs(r).call(r,(function(e){return"videoinput"===e.kind&&e.label&&e.deviceId})).length>0,e.abrupt("return",t);case 9:case"end":return e.stop()}}),e)}))),function(){return s.apply(this,arguments)})},{key:"getPermissions",value:(a=km(Em().mark((function e(){var t,r,n,i,o,a,s,c=this,u=arguments;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=u.length>0&&void 0!==u[0]?u[0]:{},n=r.audio,i=r.video,o=r.force,n||i||(n=!0,i=!0),a={audio:!1,video:!1},o){e.next=30;break}if(!this.isSupportedPermissionsQuery){e.next=20;break}if(!n||!i){e.next=14;break}if(!this.isGrantedMicrophonePermission||!this.isGrantedCameraPermission){e.next=12;break}return a.audio=!0,a.video=!0,e.abrupt("return",a);case 12:e.next=18;break;case 14:if(!(n&&this.isGrantedMicrophonePermission||i&&this.isGrantedCameraPermission)){e.next=18;break}return a.audio=this.isGrantedMicrophonePermission,a.video=this.isGrantedCameraPermission,e.abrupt("return",a);case 18:case 26:e.next=30;break;case 20:return e.next=22,this.checkPermissionsByDevices();case 22:if(s=e.sent,!n||!i){e.next=28;break}if(!s.audio||!s.video){e.next=26;break}return e.abrupt("return",s);case 28:if(!(n&&s.audio||i&&s.video)){e.next=30;break}return e.abrupt("return",s);case 30:if(null===(t=navigator.mediaDevices)||void 0===t||!t.getUserMedia){e.next=33;break}return e.next=33,navigator.mediaDevices.getUserMedia({audio:n,video:i}).then((function(e){e&&(e.getTracks().forEach((function(e){return e.stop()})),n&&(a.audio=!0,c.isGrantedMicrophonePermission=!0),i&&(a.video=!0,c.isGrantedCameraPermission=!0))})).catch((function(){}));case 33:return e.next=35,this.refreshDevices();case 35:return e.abrupt("return",a);case 36:case"end":return e.stop()}}),e,this)}))),function(){return a.apply(this,arguments)})},{key:"enumerateDevices",value:(o=km(Em().mark((function e(){var t,r,n,i;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.getPermissions();case 2:return e.next=4,this.refreshDevices();case 4:return e.abrupt("return",Xk(wm(t=[]).call(t,Wk(tA(r=this.deviceMap.audioinput).call(r)),Wk(tA(n=this.deviceMap.videoinput).call(n)),Wk(tA(i=this.deviceMap.audiooutput).call(i)))));case 5:case"end":return e.stop()}}),e,this)}))),function(){return o.apply(this,arguments)})},{key:"enumerateAudioCaptureDevices",value:(i=km(Em().mark((function e(){var t;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.getPermissions({audio:!0});case 2:return e.next=4,this.refreshDevices();case 4:return e.abrupt("return",Xk(tA(t=this.deviceMap.audioinput).call(t)));case 5:case"end":return e.stop()}}),e,this)}))),function(){return i.apply(this,arguments)})},{key:"enumerateVideoCaptureDevices",value:(n=km(Em().mark((function e(){var t;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.getPermissions({video:!0});case 2:return e.next=4,this.refreshDevices();case 4:return e.abrupt("return",Xk(tA(t=this.deviceMap.videoinput).call(t)));case 5:case"end":return e.stop()}}),e,this)}))),function(){return n.apply(this,arguments)})},{key:"enumerateAudioPlaybackDevices",value:(r=km(Em().mark((function e(){var t;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.getPermissions({audio:!0});case 2:return e.next=4,this.refreshDevices();case 4:return e.abrupt("return",Xk(tA(t=this.deviceMap.audiooutput).call(t)));case 5:case"end":return e.stop()}}),e,this)}))),function(){return r.apply(this,arguments)})},{key:"getDeviceById",value:(t=km(Em().mark((function e(t){var r;return Em().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",bb(r).call(r,(function(e){return e.deviceId===t})));case 4:case"end":return e.stop()}}),e,this)}))),function(e){return t.apply(this,arguments)})}]),f}(OC),PU=new DU;!uw()&&(window.__rtc_dd__=PU);var NU=function(){function e(){Wd(this,e),sd(this,"_audioContextInstance",void 0)}return qd(e,[{key:"getAudioContextInstance",value:function(){if(!this._audioContextInstance){var e=window.AudioContext||window.webkitAudioContext;this._audioContextInstance=new e}return this._audioContextInstance}}]),e}(),MU=function(){function e(t){Wd(this,e),sd(this,"_ctx",void 0),sd(this,"_analyserNode",void 0),sd(this,"_audioSource",void 0);var r=LU.getAudioContextInstance();if(t instanceof MediaStreamTrack){var n=new MediaStream;n.addTrack(t),this._audioSource=r.createMediaStreamSource(n)}else this._audioSource=r.createMediaElementSource(t),this._audioSource.connect(r.destination);var i=r.createAnalyser();this._audioSource.connect(i),this._analyserNode=i,this._ctx=r}var t;return qd(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;t.forEach((function(e){return r=Math.max(r,Math.abs(e-128))}));var n=r/128*255;return n>2?n:0}},{key:"resume",value:(t=km(Em().mark((function e(){var t;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,null===(t=this._ctx)||void 0===t?void 0:t.resume();case 2:case"end":return e.stop()}}),e,this)}))),function(){return t.apply(this,arguments)})},{key:"destroy",value:function(){this._audioSource.disconnect(),this._analyserNode.disconnect()}}]),e}(),LU=new NU,UU=function(e){return e[e.CAPTURE=0]="CAPTURE",e[e.PRE_PROCESSING=1]="PRE_PROCESSING",e[e.ENCODE=2]="ENCODE",e[e.TRANSFER=3]="TRANSFER",e[e.POST_PROCESSING=4]="POST_PROCESSING",e[e.DECODE=5]="DECODE",e[e.RENDERING=6]="RENDERING",e}(UU||{}),VU=function(){function e(){Wd(this,e),sd(this,"_plugins",new uE),sd(this,"_monitor",void 0)}var t;return qd(e,[{key:"setMinotor",value:function(e){this._monitor=e}},{key:"register",value:function(e){e.monitor=this._monitor;var t=this._plugins.get(e.type)||[];if(qA(t).call(t,(function(t){return t.name===e.name}))>-1)throw new Error("Failed to register ".concat(e.name,": name is repeated."));t.push(e),this._plugins.set(e.type,t)}},{key:"getPluginsByType",value:function(e){return this._plugins.get(e)||[]}},{key:"getPluginByName",value:function(e,t){var r;return bb(r=this._plugins.get(e)||[]).call(r,(function(e){return e.name===t}))}},{key:"getPreProcessingTrack",value:(t=km(Em().mark((function e(t){var r,n,i,o,a;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:r=this._plugins.get(1)||[],n=t.getTrack(),i=QT(r),e.prev=3,i.s();case 5:if((o=i.n()).done){e.next=12;break}return a=o.value,e.next=9,a.effect(t,n);case 9:n=e.sent;case 10:e.next=5;break;case 12:e.next=17;break;case 14:e.prev=14,e.t0=e.catch(3),i.e(e.t0);case 17:return e.prev=17,i.f(),e.finish(17);case 20:return e.abrupt("return",n);case 21:case"end":return e.stop()}}),e,this,[[3,14,17,20]])}))),function(e){return t.apply(this,arguments)})},{key:"destroy",value:function(){this._plugins.forEach((function(e){e.forEach((function(e){return e.destroy()}))})),this._plugins.clear()}}]),e}(),FU=function(e){return e[e.EXTERNAL=0]="EXTERNAL",e[e.INTERNAL=1]="INTERNAL",e}(FU||{}),BU=new RC("VERTC",0),jU=new xU,GU=function(e){OI(r,e);var t=qI(r);function r(e,n){var i;return Wd(this,r),sd(ZT(i=t.call(this)),"sourceType",1),sd(ZT(i),"mediaType",void 0),sd(ZT(i),"_trackId",void 0),i._trackId=e,i.mediaType=n,i}return qd(r,[{key:"getId",value:function(){return this._trackId}}]),r}(OC),HU=function(e){OI(n,e);var t,r=qI(n);function n(e,t,i){var o;return Wd(this,n),sd(ZT(o=r.call(this,t,i)),"_mediaTrack",void 0),sd(ZT(o),"_preProcessingTrack",void 0),sd(ZT(o),"handleTrackEnded",(function(){iP.rtcError("track-ended mediaType: ".concat(o._mediaTrack.kind),-1001),o.emit("track-ended",ZT(o))})),o._mediaTrack=e,o._initListeners(),o}return qd(n,[{key:"getTrack",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"origin";return"origin"===e?this._mediaTrack:this._preProcessingTrack||this._mediaTrack}},{key:"setTrack",value:function(e,t){this._mediaTrack=e,t&&this.generatePreProcessingTrack(t)}},{key:"generatePreProcessingTrack",value:(t=km(Em().mark((function e(t){var r;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,t.getPreProcessingTrack(this);case 3:(r=e.sent)instanceof MediaStreamTrack&&(this._preProcessingTrack=r),e.next=10;break;case 7:e.prev=7,e.t0=e.catch(0),console.error(e.t0);case 10:case"end":return e.stop()}}),e,this,[[0,7]])}))),function(e){return t.apply(this,arguments)})},{key:"close",value:function(){var e,t,r;return this._mediaTrack.onended=null,this._mediaTrack.onmute=null,this._mediaTrack.onunmute=null,null===(e=this._mediaTrack)||void 0===e||e.removeEventListener("ended",this.handleTrackEnded),null===(t=this._preProcessingTrack)||void 0===t||t.stop(),null===(r=this._mediaTrack)||void 0===r?void 0:r.stop()}},{key:"_initListeners",value:function(){this._mediaTrack instanceof MediaStreamTrack&&this._mediaTrack.addEventListener("ended",this.handleTrackEnded)}}]),n}(GU),zU=function(e){OI(r,e);var t=qI(r);function r(e,n,i){var o;return Wd(this,r),sd(ZT(o=t.call(this,n,i)),"_mediaTrack",void 0),o._mediaTrack=e,o}return qd(r,[{key:"getTrack",value:function(){return this._mediaTrack}}]),r}(GU),KU=function(e){OI(n,e);var t,r=qI(n);function n(e,t){var i;return Wd(this,n),sd(ZT(i=r.call(this,e,t,"video")),"resolution",void 0),sd(ZT(i),"dummy",!1),i.resolution={width:0,height:0},i}return qd(n,[{key:"updateVideoCaptureConfig",value:(t=km(Em().mark((function e(t){var r,n;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.getTrack()){e.next=2;break}return e.abrupt("return");case 2:return BU.print("updateVideoEncoderConfig","update localVideoTrack: ",t),delete(r=ud({},t)).contentHint,fw&&(r.frameRate={ideal:30,max:30}),e.next=8,this.getTrack().applyConstraints(r);case 8:((n=this.getTrack().getSettings()).width&&n.width!==this.resolution.width||n.height&&n.height!==this.resolution.height)&&(this.resolution={width:n.width,height:n.height},this.emit("resolution-change",this.resolution));case 10:case"end":return e.stop()}}),e,this)}))),function(e){return t.apply(this,arguments)})},{key:"replaceTrack",value:function(e){this.setTrack(e)}},{key:"setContentHint",value:function(e){var t;this._mediaTrack&&"contentHint"in this._mediaTrack&&Jm(t=["text","motion","detail"]).call(t,e)&&(this._mediaTrack.contentHint=e)}}]),n}(HU),XU=function(e){OI(n,e);var t,r=qI(n);function n(e,t){var i;return Wd(this,n),sd(ZT(i=r.call(this,e,t,"audio")),"audioCaptureConfig",void 0),sd(ZT(i),"_audioLevelFetcher",void 0),sd(ZT(i),"mixedAudioTrack",void 0),sd(ZT(i),"mixType",Gd.PLAYOUT_AND_PUBLISH),i}return qd(n,[{key:"getAudioLevel",value:function(){return this._audioLevelFetcher||(this._audioLevelFetcher=new MU(this.getTrack("preprocessing"))),this._audioLevelFetcher.getAudioLevel()}},{key:"updateAudioCaptureConfig",value:(t=km(Em().mark((function e(){var t;return Em().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 BU.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}(HU),qU=function(e){OI(r,e);var t=qI(r);function r(e,n){return Wd(this,r),t.call(this,e,n,"video")}return qd(r)}(zU),WU=function(e){OI(r,e);var t=qI(r);function r(e,n){var i;return Wd(this,r),sd(ZT(i=t.call(this,e,n,"audio")),"_audioLevelFetcher",void 0),i}return qd(r,[{key:"getAudioLevel",value:function(){return this._audioLevelFetcher||(this._audioLevelFetcher=new MU(this.getTrack())),this._audioLevelFetcher.getAudioLevel()}}]),r}(zU),YU=function(e){OI(r,e);var t=qI(r);function r(){var e,n;Wd(this,r);for(var i=arguments.length,o=new Array(i),a=0;a<i;a++)o[a]=arguments[a];return sd(ZT(n=t.call.apply(t,wm(e=[this]).call(e,o))),"streamIndex",yd.STREAM_INDEX_MAIN),n}return qd(r)}(XU),QU=function(e){OI(r,e);var t=qI(r);function r(){var e,n;Wd(this,r);for(var i=arguments.length,o=new Array(i),a=0;a<i;a++)o[a]=arguments[a];return sd(ZT(n=t.call.apply(t,wm(e=[this]).call(e,o))),"streamIndex",yd.STREAM_INDEX_MAIN),n}return qd(r)}(KU),JU=function(e){OI(r,e);var t=qI(r);function r(){var e,n;Wd(this,r);for(var i=arguments.length,o=new Array(i),a=0;a<i;a++)o[a]=arguments[a];return sd(ZT(n=t.call.apply(t,wm(e=[this]).call(e,o))),"streamIndex",yd.STREAM_INDEX_MAIN),sd(ZT(n),"sourceType",0),n}return qd(r)}(KU),ZU=function(e){OI(r,e);var t=qI(r);function r(){var e,n;Wd(this,r);for(var i=arguments.length,o=new Array(i),a=0;a<i;a++)o[a]=arguments[a];return sd(ZT(n=t.call.apply(t,wm(e=[this]).call(e,o))),"streamIndex",yd.STREAM_INDEX_MAIN),sd(ZT(n),"sourceType",0),n}return qd(r)}(XU),$U=function(e){OI(r,e);var t=qI(r);function r(){var e,n;Wd(this,r);for(var i=arguments.length,o=new Array(i),a=0;a<i;a++)o[a]=arguments[a];return sd(ZT(n=t.call.apply(t,wm(e=[this]).call(e,o))),"streamIndex",yd.STREAM_INDEX_SCREEN),n}return qd(r)}(KU),eV=function(e){OI(r,e);var t=qI(r);function r(){var e,n;Wd(this,r);for(var i=arguments.length,o=new Array(i),a=0;a<i;a++)o[a]=arguments[a];return sd(ZT(n=t.call.apply(t,wm(e=[this]).call(e,o))),"streamIndex",yd.STREAM_INDEX_SCREEN),n}return qd(r)}(XU),tV=function(e){OI(r,e);var t=qI(r);function r(){var e,n;Wd(this,r);for(var i=arguments.length,o=new Array(i),a=0;a<i;a++)o[a]=arguments[a];return sd(ZT(n=t.call.apply(t,wm(e=[this]).call(e,o))),"streamIndex",yd.STREAM_INDEX_SCREEN),sd(ZT(n),"sourceType",0),n}return qd(r)}(KU),rV=function(e){OI(r,e);var t=qI(r);function r(){var e,n;Wd(this,r);for(var i=arguments.length,o=new Array(i),a=0;a<i;a++)o[a]=arguments[a];return sd(ZT(n=t.call.apply(t,wm(e=[this]).call(e,o))),"streamIndex",yd.STREAM_INDEX_SCREEN),sd(ZT(n),"sourceType",0),n}return qd(r)}(XU);function nV(e,t){return iV.apply(this,arguments)}function iV(){return(iV=km(Em().mark((function e(t,r){var n;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return(n=new QU(t,aw())).dummy=!0,e.next=4,n.generatePreProcessingTrack(r);case 4:return e.abrupt("return",n);case 5:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function oV(e,t){return aV.apply(this,arguments)}function aV(){return(aV=km(Em().mark((function e(t,r){var n;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return(n=new $U(t,aw())).dummy=!0,e.next=4,n.generatePreProcessingTrack(r);case 4:return e.abrupt("return",n);case 5:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function sV(e,t){return cV.apply(this,arguments)}function cV(){return(cV=km(Em().mark((function e(t,r){var n,i,o,a,s,c,u;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return o=(null==t||null===(n=t.deviceId)||void 0===n?void 0:n.exact)||"default",e.prev=1,BU.print("createCameraVideoTrack","constraints:",t),iP.rtcVideoCaptureEvent({event_type:ZD.START,media_device_id:o}),a=sw(),fw&&(t.frameRate={ideal:30,max:30}),e.next=8,PU.getUserMedia({video:t});case 8:i=e.sent,iP.rtcVideoCaptureEvent({event_type:ZD.START_CAPTURE_RESULT,media_device_id:o,reason:$D.SUCCESS,elapse:sw()-a}),e.next=16;break;case 12:throw e.prev=12,e.t0=e.catch(1),iP.rtcVideoCaptureEvent({event_type:ZD.RUNNING_FAILED,media_device_id:o,error_code:e.t0.code,reason:e.t0.name+e.t0.message}),new lR(uR.GET_VIDEO_TRACK_FAILED,wm(s="throw error from getUserMedia. [".concat(e.t0.name||"unknown name","]: ")).call(s,e.t0.message||"unknown message","."),e.t0);case 16:return c=i.getVideoTracks()[0],jU.set(c,i),u=new QU(c,aw()),e.next=21,u.generatePreProcessingTrack(r);case 21:return e.abrupt("return",u);case 22:case"end":return e.stop()}}),e,null,[[1,12]])})))).apply(this,arguments)}function uV(e,t){return dV.apply(this,arguments)}function dV(){return(dV=km(Em().mark((function e(t,r){var n,i,o,a,s,c,u,d;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return BU.print("createMicrophoneAudioTrack","constraints:",t),o=(null==t||null===(n=t.deviceId)||void 0===n?void 0:n.exact)||"default",e.prev=2,iP.rtcVideoCaptureEvent({event_type:ZD.START,media_device_id:o}),a=sw(),(s=r.getPluginByName(UU.PRE_PROCESSING,"RTCAIAnsExtension"))&&(s.isOpen()?(t.autoGainControl=!0,t.noiseSuppression=!1):t.noiseSuppression=!0),e.next=9,PU.getUserMedia({audio:t});case 9:i=e.sent,iP.rtcVideoCaptureEvent({event_type:ZD.START_CAPTURE_RESULT,media_device_id:o,reason:$D.SUCCESS,elapse:sw()-a}),e.next=17;break;case 13:throw e.prev=13,e.t0=e.catch(2),iP.rtcVideoCaptureEvent({event_type:ZD.RUNNING_FAILED,media_device_id:o,error_code:e.t0.code,reason:e.t0.name+e.t0.message}),new lR(uR.GET_AUDIO_TRACK_FAILED,wm(c="throw error from getUserMedia. [".concat(e.t0.name||"unknown name","]: ")).call(c,e.t0.message||"unknown message","."),e.t0);case 17:return u=i.getAudioTracks()[0],jU.set(u,i),d=new YU(u,aw()),e.next=22,d.generatePreProcessingTrack(r);case 22:return e.abrupt("return",d);case 23:case"end":return e.stop()}}),e,null,[[2,13]])})))).apply(this,arguments)}function lV(){return hV.apply(this,arguments)}function hV(){return hV=km(Em().mark((function e(){var t,r,n,i,o,a,s,c,u,d=arguments;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=d.length>0&&void 0!==d[0]&&d[0],r=d.length>1?d[1]:void 0,n=d.length>2?d[2]:void 0,BU.print("createScreenTracks","withAudio: %o, constraints: %o",t,n),e.prev=4,iP.rtcVideoCaptureEvent({event_type:ZD.START,media_device_id:"screen"}),o=sw(),e.next=9,navigator.mediaDevices.getDisplayMedia({video:!(n&&(!pw||16!==gw))||n,audio:!!t&&{channelCount:2,noiseSuppression:!1,echoCancellation:!1,autoGainControl:!1}});case 9:i=e.sent,iP.rtcVideoCaptureEvent({event_type:ZD.START_CAPTURE_RESULT,media_device_id:"screen",reason:$D.SUCCESS,elapse:sw()-o}),e.next=17;break;case 13:throw e.prev=13,e.t0=e.catch(4),iP.rtcVideoCaptureEvent({event_type:ZD.RUNNING_FAILED,media_device_id:"screen",error_code:e.t0.code,reason:e.t0.name+e.t0.message}),new lR(uR.GET_SCREEN_TRACK_FAILED,"throw error from getDisplayMedia",e.t0);case 17:return a=i.getVideoTracks()[0],s=new $U(a,aw()),e.next=21,s.generatePreProcessingTrack(r);case 21:if(!(c=i.getAudioTracks()[0])){e.next=27;break}return u=new eV(c,aw()),e.next=26,u.generatePreProcessingTrack(r);case 26:return e.abrupt("return",[s,u]);case 27:return e.abrupt("return",[s,void 0]);case 28:case"end":return e.stop()}}),e,null,[[4,13]])}))),hV.apply(this,arguments)}function fV(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:aw();return new WU(e,t)}function pV(e,t){return vV.apply(this,arguments)}function vV(){return(vV=km(Em().mark((function e(t,r){var n;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=new JU(t,aw()),e.next=3,n.generatePreProcessingTrack(r);case 3:return e.abrupt("return",n);case 4:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function _V(e,t){return mV.apply(this,arguments)}function mV(){return(mV=km(Em().mark((function e(t,r){var n;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=new ZU(t,aw()),e.next=3,n.generatePreProcessingTrack(r);case 3:return e.abrupt("return",n);case 4:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function gV(e,t){return yV.apply(this,arguments)}function yV(){return(yV=km(Em().mark((function e(t,r){var n;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=new tV(t,aw()),e.next=3,n.generatePreProcessingTrack(r);case 3:return e.abrupt("return",n);case 4:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function SV(e,t){return EV.apply(this,arguments)}function EV(){return(EV=km(Em().mark((function e(t,r){var n;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=new rV(t,aw()),e.next=3,n.generatePreProcessingTrack(r);case 3:return e.abrupt("return",n);case 4:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var bV=XU,kV=function(e){return e[e.NONE=0]="NONE",e}(kV||{}),TV=function(){function e(){Wd(this,e)}return qd(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,s,c=new Uint8Array(Sm(a=t.buffer).call(a,i,i+n.headerLength));n.pos===t.position&&t.skip(n.headerLength),o=(n=e.getHeaderPositionAnnexB(t)).pos;var u={header:c,body:new Uint8Array(Sm(s=t.buffer).call(s,i+c.byteLength,o)),type:-1};e.analyseNal(u),u.type<=9&&0!==u.type&&r.push(u),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,o,a=new Uint8Array(Sm(i=t.buffer).call(i,t.position,t.position+4));t.skip(4);var s=new Uint8Array(Sm(o=t.buffer).call(o,t.position,t.position+n));t.skip(n);var c={header:a,body:s,type:-1};e.analyseNal(c),c.type<=9&&0!==c.type&&r.push(c)}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}}}]),e}(),IV=function(){function e(t){Wd(this,e),sd(this,"_position",0),sd(this,"_dataview",void 0),this._dataview=new DataView(t)}return qd(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}(),AV=function(e){return e[e.internal=0]="internal",e[e.external=1]="external",e[e.bypass=2]="bypass",e}(AV||{}),RV=new Uint8Array([109,167,53,190,103,90,72,1,170,89,63,164,194,199,19,85]),wV=new Uint8Array([109,167,53,190,103,90,72,1,170,89,63,164,194,199,19,84]),CV=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 OV(e){for(var t=[];e>=255;)e-=255,t.push(255);return t.push(e),new Uint8Array(t)}function xV(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 DV=function(){function e(){Wd(this,e)}return qd(e,null,[{key:"generateSEI",value:function(e){var t,r=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=new Uint8Array([0,0,0,1]),i=new Uint8Array([6]),o=new Uint8Array([5]),a=r?RV:wV,s=OV(e.byteLength+a.byteLength),c=CV(e);return new Uint8Array(wm(t=[]).call(t,Wk(n),Wk(i),Wk(o),Wk(s),Wk(a),Wk(c),[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=Sm(e).call(e,0,e.length-1));if(!(t.byteLength<2)){var r=0;if(5===t[1]||100===t[1]){var n=JT(xV(t,r+=2),2),i=n[0],o=2,a=(r=n[1])+i;return t.byteLength>=wV.byteLength&&i>=wV.byteLength&&Sm(t).call(t,r,r+wV.byteLength).toString()===wV.toString()?(r+=wV.byteLength,o=1):t.byteLength>=wV.byteLength&&i>=wV.byteLength&&Sm(t).call(t,r,r+RV.byteLength).toString()===RV.toString()&&(r+=RV.byteLength,o=0),{type:o,payload:Sm(t).call(t,r,a)}}}}},{key:"parseInternalSEI",value:function(e){var t=new uE,r=0;if(0===e.type){for(;e.payload.byteLength-r>=2;){var n=JT(xV(e.payload,r),2),i=n[0];r=n[1];var o,a=JT(xV(e.payload,r),2),s=a[0];if(r=a[1],t.get(i)||!(s<=e.payload.byteLength-r))break;t.set(i,Sm(o=e.payload).call(o,r,r+s)),r+=s}return t}}},{key:"makeInternalSei",value:function(e){var t,r=[],n=QT(e);try{for(n.s();!(t=n.n()).done;){var i=JT(t.value,2),o=i[0],a=i[1],s=OV(o),c=OV(a.byteLength);r.push(s,c,a)}}catch(l){n.e(l)}finally{n.f()}var u=TE(r).call(r,(function(e,t){return e+t.byteLength}),0),d=new Uint8Array(u);return TE(r).call(r,(function(e,t){return d.set(t,e),e+t.byteLength}),0),d}}]),e}(),PV=function(){function e(t){Wd(this,e),sd(this,"player",void 0),sd(this,"_stream",void 0),sd(this,"_timer",void 0),sd(this,"client",void 0),sd(this,"handler",void 0),sd(this,"monitor",void 0),this._stream=t}return qd(e,[{key:"setVar",value:function(e,t,r){this.client=e,this.handler=t,this.monitor=r}},{key:"delStatsEvtInterval",value:function(){var e;clearTimeout(this._timer),this._timer=void 0,null===(e=this.monitor)||void 0===e||e.rtcInvokeStatus("".concat((new Error).stack),0,"del_media_statistics_timer",this._stream.streamId||"",0)}},{key:"filterIllegal",value:function(e){var t={};return an(e).forEach((function(r){null===e[r]||void 0===e[r]||Number.isNaN(e[r])||(t[r]=e[r])})),t}},{key:"destroy",value:function(){var e;null===(e=this.monitor)||void 0===e||e.rtcInvokeStatus("".concat((new Error).stack),0,"media_statistics_destroy","".concat(this._stream.streamId),0),this.delStatsEvtInterval()}}]),e}(),NV=function(e){OI(i,e);var t,r,n=qI(i);function i(e){var t;return Wd(this,i),sd(ZT(t=n.call(this,e)),"_context",void 0),t._stream=e,t}return qd(i,[{key:"setLocalStreamStatsEvtInterval",value:function(e,t,r,n){var i,o,a,s=this;if(!this._timer){this.setVar(e,t,r),this._context=n,e.once(FP.ABNORMAL_DISCONNECTION,(function(){s.destroy()}));var c={audio:{},video:{}},u=this._stream,d=null===(i=u.audioTrack)||void 0===i?void 0:i.getTrack("preprocessing"),l=null===(o=u.videoTrack)||void 0===o?void 0:o.getTrack("preprocessing");this.getAudioStats(d,c,null===(a=u.audioTrack)||void 0===a?void 0:a.getAudioLevel()),this.getVideoStats(l,c),this.delStatsEvtInterval();var h=function(){var e=km(Em().mark((function e(){var t,r,n,i,o,a,d;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=null===(t=u.audioTrack)||void 0===t?void 0:t.getTrack("preprocessing"),o=null===(r=u.videoTrack)||void 0===r?void 0:r.getTrack("preprocessing"),e.next=4,s.getAudioStats(i,c,null===(n=u.audioTrack)||void 0===n?void 0:n.getAudioLevel());case 4:return a=e.sent,e.next=7,s.getVideoStats(o,c);case 7:return d=e.sent,e.abrupt("return",{audioStats:a,videoStats:d,isScreen:u.isScreen});case 9:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),f=function(){var e=km(Em().mark((function e(){var t,r;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,h();case 2:r=e.sent,null===(t=s.client)||void 0===t||t.emit("onLocalStreamStats",r),s._timer&&clearTimeout(s._timer),s._timer=setTimeout(f,2e3);case 6:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}();this._timer&&clearTimeout(this._timer),this._timer=setTimeout(f,2e3)}}},{key:"unpublish",value:function(){this.delStatsEvtInterval()}},{key:"getAudioStats",value:(r=km(Em().mark((function e(t,r,n){var i,o,a,s,c,u,d,l,h,f,p;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(i={},o={timestamp:Date.now()},a=this._stream,s=a.streamId,c=a.audioMid,u=a.isScreen,d=a.pubAttributes,l=a.pubAudio,h={media_type:"audio",is_screen:!!u,direction:"up",stream_id:s,vid:c,connection_status:navigator.onLine,track_enabled:null==t?void 0:t.enabled,capture_state:d.localaudio?"capture_state_on":"capture_state_off",mute_state:l?"mute_state_off":"mute_state_on"},t&&this.handler){e.next=6;break}return e.abrupt("return",i);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",i);case 11:if(f.forEach((function(e){var t=e.type,r=e.packetsSent,n=e.packetsLost,a=e.bytesSent,s=e.clockRate,c=e.roundTripTime,u=e.channels,d=e.audioLevel;e.googRtt;var l=e.mimeType,f=e.availableIncomingBitrate,p=e.availableOutgoingBitrate,v=e.bytesReceived,_=e.nominated,m=e.id,g=e.currentRoundTripTime,y=e.state,S=e.writable,E=e.requestsReceived,b=e.responsesReceived,k=e.requestsSent,T=e.consentRequestsSent,I=e.responsesSent,A=e.jitter,R=e.candidateType,w=e.ip,C=e.address,O=e.networkType,x=e.port,D=e.protocol,P=e.nackCount,N=e.retransmittedBytesSent,M=e.retransmittedPacketsSent,L=e.audioInputLevel,U=e.ssrc,V=e.totalAudioEnergy,F=e.totalSamplesDuration,B=e.mediaType,j=e.fractionLost;"outbound-rtp"===t?(o.packetsSent=r,o.bytesSent=a,h.bytes=a,h.packetsSent=r,h.nackCount=P,h.ssrc=U,h.retransmitted_bytes_sent=N,h.retransmitted_packets_sent=M,o.retransmittedBytesSent=N,o.retransmittedPacketsSent=M):"remote-inbound-rtp"===t?(o.packetsLost=n,h.packetsLost=n,h.net_jitter=1e3*A,i.rtt=1e3*c,h.rtt=i.rtt,i._fractionLost=j||0):"codec"===t?(i.recordSampleRate=s,i.numChannels=u,h.codecName=l):"media-source"===t&&void 0!==d?(h.audio_level=d?-10*qR(Math.pow(d,2)):d,h.volume=255*d,h.total_audio_energy=V,h.totalInputDuration=F):"ssrc"===t&&"audio"===B?h.send_level=L:"candidate-pair"===t?(h.ice_available_incoming_bitrate=f,h.ice_available_outgoing_bitrate=p,h.ice_bytes_received=v,h.ice_bytes_sent=a,h.ice_nominated=+_,h.ice_pair_id=m,h.ice_pair_rtt=g,h.ice_pair_state=y,h.ice_pair_writable=S,h.recv_ping_requests=E,h.recv_ping_responses=b,h.sent_ping_requests_before_first_response=k,h.sent_ping_requests_total=k+(T||0),h.sent_ping_responses=I):"local-candidate"===t?(h.local_candidate_type=R,h.local_ip=w||C,h.local_network_type=O,h.local_port=x,h.protocol=D):"remote-candidate"===t&&(h.remote_candidate_type=R,h.remote_ip=w||C,h.remote_port=x);var G=CP("STATS_SCALLBACK_SUPPORT");hw&&G||"media-source"===t&&(h.send_level=d)})),void 0===h.volume&&void 0!==n&&(h.volume=n,h.audio_level=n?-10*qR(Math.pow(n/255,2)):n),(p=r.audio).timestamp){e.next=17;break}return r.audio=o,e.abrupt("return",this.filterIllegal(i));case 17:return void 0!==o.packetsLost&&(i.audioLossRate=(o.packetsLost-p.packetsLost)/(o.packetsSent-p.packetsSent),i.audioLossRate=Number.isNaN(i.audioLossRate)?0:i.audioLossRate,h.fraction_lost=i.audioLossRate),i.statsInterval=o.timestamp-p.timestamp,h.stats_interval=i.statsInterval,i.sendKBitrate=(o.bytesSent-p.bytesSent||0)/i.statsInterval*8,h.mediaBitratebps=Math.round(1e3*i.sendKBitrate),h.bandwidth=Math.round(h.mediaBitratebps/1024),void 0!==o.retransmittedBytesSent&&(h.retransmitBitratebps=(o.retransmittedBytesSent-p.retransmittedBytesSent||0)/i.statsInterval),r.audio=o,this.monitor.rtcMediaStatistics(h,{}),i._retransmittedRate=(o.retransmittedPacketsSent-p.retransmittedPacketsSent)/(o.packetsSent-p.packetsSent),void 0===i.audioLossRate&&(i.audioLossRate=i._retransmittedRate,h.fraction_lost=i.audioLossRate),i._fractionLost=Math.max(i._fractionLost,i.audioLossRate),e.abrupt("return",this.filterIllegal(i));case 30:case"end":return e.stop()}}),e,this)}))),function(e,t,n){return r.apply(this,arguments)})},{key:"getVideoStats",value:(t=km(Em().mark((function e(t,r){var n,i,o,a,s,c,u,d,l,h,f,p,v,_,m,g,y,S;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(o={},a={timestamp:Date.now(),simulcast:{}},s=this._stream,c=s.streamId,u=s.videoMid,d=s.isScreen,l=s.pubAttributes,h=s.enableSimulcast,f=s.pubVideo,p={media_type:"video",is_screen:!!d,direction:"up",stream_id:c,vid:u,connection_status:navigator.onLine,track_enabled:null==t?void 0:t.enabled,capture_state:l.localvideo?"capture_state_on":"capture_state_off",mute_state:f?"mute_state_off":"mute_state_on"},t&&this.handler){e.next=6;break}return e.abrupt("return",o);case 6:return p.cap_frame_width=t.getSettings().width,p.cap_frame_height=t.getSettings().height,o.isScreen=d,e.next=11,this.handler.getStats(t);case 11:if((v=e.sent).length){e.next=14;break}return e.abrupt("return",o);case 14:if(null===(n=this.monitor)||void 0===n||n.rtcInvokeStatus(wm(i="reports.length: ".concat(v.length,"; videoTrack: ")).call(i,t.id),0,"get_video_stats",c||"",0),_=0,v.forEach((function(e){var n=e.type,i=e.framesEncoded,s=e.packetsLost,c=e.bytesSent,u=e.framesSent,d=e.retransmittedBytesSent,l=e.totalPacketSendDelay,f=e.totalEncodeTime,v=e.firCount,m=e.targetBitrate,g=e.roundTripTime,y=e.mimeType,S=e.frameWidth,E=e.frameHeight,b=e.packetsSent,k=e.googActualEncBitrate,T=e.googAvailableReceiveBandwidth,I=e.googAvailableSendBandwidth,A=e.googAvgEncodeMs,R=e.googBucketDelay,w=e.googEncodeUsagePercent,C=e.googFrameRateInput,O=e.availableIncomingBitrate,x=e.availableOutgoingBitrate,D=e.bytesReceived,P=e.nominated,N=e.id,M=e.currentRoundTripTime,L=e.state,U=e.writable,V=e.candidateType,F=e.ip,B=e.address,j=e.networkType,G=e.port,H=e.nackCount,z=e.pliCount,K=e.protocol,X=e.qpSum,q=e.requestsReceived,W=e.responsesReceived,Y=e.googRetransmitBitrate,Q=e.requestsSent,J=e.consentRequestsSent,Z=e.responsesSent,$=e.ssrc,ee=e.googTargetEncBitrate,te=e.googTransmitBitrate,re=e.retransmittedPacketsSent,ne=e.encoderImplementation,ie=e.jitter,oe=e.rid,ae=e.fractionLost,se=e.googAdaptationChanges,ce=e.qualityLimitationReason,ue=e.qualityLimitationDurations,de=e.googFirsReceived,le=e.googFrameRateSent,he=e.keyFramesEncoded;"outbound-rtp"===n?(h&&(oe?a.simulcast[oe]=e:a.simulcast[_]=e,_++),a.framesEncoded=i||a.framesEncoded||0,p.key_frames_encoded=he||0,a.bytesSent=c||a.bytesSent||0,a.framesSent=u||a.framesSent||0,p.bytes=c||p.bytes||0,a.packetsSent=b||a.packetsSent||0,p.packetsSent=b||p.packetsSent||0,p.nackCount=H||p.nackCount||0,p.pli_count=z||p.pli_count||0,p.qp_sum=X||p.qp_sum||0,p.ssrc=$||p.ssrc||0,p.retransmitted_packets_sent=re,a.retransmittedPacketsSent=re,a.retransmittedBytesSent=d,p.encoder_implementation=ne,p.qualityLimitationReason=ce,p.qualityLimitationDurations=ue,void 0!==S&&((!o.encodedFrameWidth||S>o.encodedFrameWidth)&&(o.encodedFrameWidth=S),(!o.encodedFrameHeight||E>o.encodedFrameHeight)&&(o.encodedFrameHeight=E),p.frame_size_height=E,p.frame_size_width=S)):"track"===n?(o.encodedFrameWidth=S,o.encodedFrameHeight=E,p.frame_size_height=E,p.frame_size_width=S):"remote-inbound-rtp"===n?(a.packetsLost=s,o.rtt=1e3*g,p.rtt=o.rtt,p.jitter=ie,p.packetsLost=s,o._fractionLost=ae||0):"codec"===n?(o.codecType=y,p.codecName=y):"candidate-pair"===n?(p.ice_available_incoming_bitrate=O,p.ice_available_outgoing_bitrate=x,p.ice_bytes_received=D,p.ice_bytes_sent=c,p.ice_nominated=+P,p.ice_pair_id=N,p.ice_pair_rtt=M,p.ice_pair_state=L,p.ice_pair_writable=U,p.recv_ping_requests=q,p.recv_ping_responses=W,p.sent_ping_requests_before_first_response=Q,p.sent_ping_requests_total=Q+J,p.sent_ping_responses=Z):"local-candidate"===n?(p.local_candidate_type=V,p.local_ip=F||B,p.local_network_type=j,p.local_port=G,p.protocol=K):"remote-candidate"===n?(p.remote_candidate_type=V,p.remote_ip=F||B,p.remote_port=G):"VideoBwe"===n?(p.encBitratebps=k,p.available_receive_bandwidth=T,p.available_send_bandwidth=I,p.bucket_delay=R,p.retransmitBitratebps=Y,p.targetEncBitratebps=ee,p.transmit_bitrate=te,o._sendBandWidth=+I):"ssrc"===n&&(p.avg_encode_ms=A,p.encodeUsage=w,p.frame_rate_input=C,p.orignal_input_Framerate=+C,p.ddaptationChanges=se,p.firsReceived=de,p.frameRateSent=le);var fe=CP("STATS_SCALLBACK_SUPPORT");if(!hw||!fe){var pe=r.video,ve=a.timestamp-pe.timestamp;if("outbound-rtp"===n){var _e=c-pe.bytesSent,me=d-pe.retransmittedBytesSent;p.encBitratebps=Math.round(8e3*(_e-me)/ve),p.bucket_delay=l/b,p.retransmitBitratebps=Math.round(8e3*me/ve),p.targetEncBitratebps=m,p.transmit_bitrate=Math.round(1e3*(c-pe.bytesSent)*8/ve),p.avg_encode_ms=1e3*f/i,p.firsReceived=v+z}else"candidate-pair"===n&&(p.available_send_bandwidth=x,o._sendBandWidth=x);if(t){var ge=null==t?void 0:t.getSettings().frameRate;p.orignal_input_Framerate=ge,p.frameRateSent=t.getSettings().frameRate}}})),(m=r.video).timestamp){e.next=21;break}return r.video=a,e.abrupt("return",this.filterIllegal(o));case 21:return o.statsInterval=a.timestamp-m.timestamp,p.stats_interval=o.statsInterval,g=an(a.simulcast),h?(p.sim_enc_width=[],p.sim_enc_height=[],p.sim_enc_bps=[],p.sim_enc_framerate=[],p.sim_enc_key_frames=[],p.sim_rids=[],p.sim_enc_bandwidth=[],p.sim_sent_framerate=[],p.sim_fraction_lost=[],p.sim_keyencoded=[],p.active_sim_streams=(null===(y=this._context)||void 0===y?void 0:y.activeSimStreams)||[],p.sim_retransmittedRate=[],S=!1,VA(g).call(g,(function(e,t){return+e-+t})).forEach((function(e){var t=a.simulcast[e],r=t.frameWidth,n=t.frameHeight,i=t.bytesSent,s=t.framesEncoded,c=t.framesSent,u=t.packetsLost,d=t.packetsSent,l=t.qualityLimitationReason,h=t.qualityLimitationDurations,f=t.qualityLimitationResolutionChanges,v=t.retransmittedPacketsSent,_=t.pliCount,g=t.keyFramesEncoded;void 0!==l&&(p.sim_qualityLimitationReason||(p.sim_qualityLimitationReason=[],p.sim_qualityLimitationDurations=[],p.sim_qualityLimitationResolutionChanges=[]),p.sim_qualityLimitationReason.push(l),p.sim_qualityLimitationDurations.push(h),p.sim_qualityLimitationResolutionChanges.push(f));var y=m.simulcast[e];if(p.sim_enc_width.push(r||0),p.sim_enc_height.push(n||0),p.sim_enc_key_frames.push(g||0),y){var E=(i-y.bytesSent||0)/o.statsInterval;p.sim_enc_bps.push(Math.round(8e3*E)),p.sim_enc_bandwidth.push(Math.round(8e3*E/1024));var b=1e3*(s-y.framesEncoded)/o.statsInterval;p.sim_enc_framerate.push(Math.round(b)),p.sim_rids.push(e);var k=void 0!==c?c-y.framesSent:s-y.framesEncoded,T=1e3*k/o.statsInterval;p.sim_sent_framerate.push(Math.round(T));var I=(u-y.packetsLost)/(d-y.packetsSent);o._retransmittedRate=(v-y.retransmittedPacketsSent)/(d-y.packetsSent),I=Number.isNaN(I)?0:I,p.sim_fraction_lost.push(I),p.sim_keyencoded.push(_-y.pliCount>0),p.sim_retransmittedRate.push(o._retransmittedRate),r>0&&!S&&(o.sentKBitrate=8*E,o.encoderOutputFrameRate=b,o.encodedFrameCount=k,o.sentFrameRate=T,o.videoLossRate=I,S=!0)}})),this.monitor.rtcMediaStatistics(p,{})):(o.encodedFrameCount=void 0!==a.framesSent?a.framesSent-m.framesSent:a.framesEncoded-m.framesEncoded,o.sentKBitrate=(a.bytesSent-m.bytesSent||0)/o.statsInterval*8,p.bitrate=Math.round(1e3*o.sentKBitrate),p.bandwidth=Math.round(p.bitrate/1024),o.encoderOutputFrameRate=1e3*(a.framesEncoded-m.framesEncoded)/o.statsInterval,p.frame_rate_encoded=Math.round(o.encoderOutputFrameRate),o.sentFrameRate=1e3*o.encodedFrameCount/o.statsInterval,p.frame_rate_sent=Math.round(o.sentFrameRate),o.videoLossRate=(a.packetsLost-m.packetsLost)/(a.packetsSent-m.packetsSent),o.videoLossRate=Number.isNaN(o.videoLossRate)?0:o.videoLossRate,p.fraction_lost=o.videoLossRate,o._retransmittedRate=(a.retransmittedPacketsSent-m.retransmittedPacketsSent)/(a.packetsSent-m.packetsSent),this.monitor.rtcMediaStatistics(p,{})),r.video=a,o._fractionLost=Math.max(o._fractionLost,o.videoLossRate),e.abrupt("return",this.filterIllegal(o));case 28:case"end":return e.stop()}}),e,this)}))),function(e,r){return t.apply(this,arguments)})}]),i}(PV),MV=function(e){OI(o,e);var t,r,n,i=qI(o);function o(e){var t;return Wd(this,o),sd(ZT(t=i.call(this,e)),"isPaused",void 0),sd(ZT(t),"pauseStart",void 0),sd(ZT(t),"pauseDuration",void 0),sd(ZT(t),"_audioStallCount",void 0),sd(ZT(t),"_setAudioStallCount",void 0),sd(ZT(t),"_audioStallTimer",void 0),sd(ZT(t),"_audioStallInterval",void 0),sd(ZT(t),"_audioStallRatio",void 0),sd(ZT(t),"_videoInWaiting",void 0),sd(ZT(t),"_context",void 0),t._videoInWaiting=!1,t.pauseDuration=0,t}return qd(o,[{key:"setRemoteStreamStatsEvtInterval",value:(n=km(Em().mark((function e(t,r,n,i){var a,s,c,u,d,l,h,f,p,v,_,m,g,y,S=this;return Em().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),this._context=i,t.once(FP.ABNORMAL_DISCONNECTION,(function(){S.destroy()})),this._audioStallInterval=o.audioStallInterval||100,this._audioStallRatio=o.audioStallRatio||.6,c={audio:{},video:{}},u=this._stream,d=null===(a=u.audioTrack)||void 0===a?void 0:a.getTrack(),l=null===(s=u.videoTrack)||void 0===s?void 0:s.getTrack(),this.getRemoteVideoStats(l,c),e.next=14,this.getRemoteAudioStats(d,c);case 14:this.delStatsEvtInterval(),h=0,f=0,v=[],_=0,m=sw(),this._setAudioStallCount=function(){if(RP.AUDIO_STALL&&S._audioStallInterval>0&&void 0!==c.audio.concealedSamples){var e=c.audio.concealedSamples,t=c.audio.totalSamplesReceived;m=sw();var r={isStall:!1,counted:!1,diff:0},n=.5*S._audioStallInterval;S._audioStallCount=km(Em().mark((function i(){var o,a,s,c,d,l,p,g,y,E,b,k,T,I,A,R,w;return Em().wrap((function(i){for(;;)switch(i.prev=i.next){case 0:if(a=u.hasAudio,s=u.subAudio,a&&s){i.next=7;break}return r.isStall=!1,r.counted=!1,v.push({reason:wm(c="hasAudio: ".concat(a,", subAudio: ")).call(c,s)}),m=sw(),i.abrupt("return",{stall_count:h,stall_duration:f,stall_list:v,stats_count:_});case 7:return d=null===(o=u.audioTrack)||void 0===o?void 0:o.getTrack(),l=Date.now(),i.next=11,S.handler.getStats(d,!0);case 11:if(p=i.sent,g=Date.now(),y=sw(),!((E=y-m)<n)){i.next=18;break}return v.push({diff:E,start:m,end:y,get_stats_cost:g-l,get_stats_start:l,get_stats_end:g,reason:wm(b="diff(".concat(E,") < minInterval(")).call(b,n,")")}),i.abrupt("return",{stall_count:h,stall_duration:f,stall_list:v,stats_count:_});case 18:if(k=p.length,T=bb(p).call(p,(function(e){return"inbound-rtp"===e.type}))){i.next=23;break}return v.push({diff:E,start:m,end:y,get_stats_cost:g-l,get_stats_start:l,get_stats_end:g,reason:k?"no inbound-rtp":"no report"}),i.abrupt("return",{stall_count:h,stall_duration:f,stall_list:v,stats_count:_});case 23:return I=T.concealedSamples,A=T.totalSamplesReceived,w=A-t,(R=I-e)>=0&&w>=0&&R>=S._audioStallRatio*w?(v.push({concealed:R,received:w,diff:E,start:m,end:y,get_stats_cost:g-l,get_stats_start:l,get_stats_end:g,is_stall:!0}),r.isStall?(r.counted?f+=E:(f=f+r.diff+E,h++),r.counted=!0):E>=200?(f+=E,h++,r.counted=!0):(r.counted=!1,r.diff=E),r.isStall=!0):(v.push({concealed:R,received:w,diff:E,start:m,end:y,get_stats_cost:g-l,get_stats_start:l,get_stats_end:g}),r.isStall=!1,r.counted=!1),e=I,t=A,m=y,_++,i.abrupt("return",{stall_count:h,stall_duration:f,stall_list:v,stats_count:_});case 32:case"end":return i.stop()}}),i)}))),p=function(){var e=km(Em().mark((function e(){return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!S._audioStallCount&&S._setAudioStallCount&&S._setAudioStallCount(),!S._audioStallCount){e.next=6;break}return e.next=4,S._audioStallCount();case 4:S._audioStallTimer&&clearTimeout(S._audioStallTimer),S._audioStallTimer=setTimeout(p,S._audioStallInterval);case 6:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),S._audioStallTimer&&clearTimeout(S._audioStallTimer),S._audioStallTimer=setTimeout(p,S._audioStallInterval)}},this._setAudioStallCount(),g=function(){var e=km(Em().mark((function e(){var t,r,n,i,o,a;return Em().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,S.getRemoteAudioStats(n,c);case 4:return o=e.sent,h=0,f=0,v=[],_=0,e.next=11,S.getRemoteVideoStats(i,c);case 11:return a=e.sent,e.abrupt("return",{audioStats:o,videoStats:a,isScreen:u.isScreen,userId:u.userId});case 13:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),y=function(){var e=km(Em().mark((function e(){var t,r;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,g();case 2:r=e.sent,null===(t=S.client)||void 0===t||t.emit("onRemoteStreamStats",r),p&&(m=sw(),S._audioStallTimer&&clearTimeout(S._audioStallTimer),S._audioStallTimer=setTimeout(p,S._audioStallInterval)),S._timer&&clearTimeout(S._timer),S._timer=setTimeout(y,2e3);case 7:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),this._timer&&clearTimeout(this._timer),this._timer=setTimeout(y,2e3);case 26:case"end":return e.stop()}}),e,this)}))),function(e,t,r,i){return n.apply(this,arguments)})},{key:"delStatsEvtInterval",value:function(){wI(AI(o.prototype),"delStatsEvtInterval",this).call(this),clearTimeout(this._audioStallTimer),this._audioStallCount=void 0,this._setAudioStallCount=void 0,this.pauseDuration=0}},{key:"unsubscribe",value:function(){this.delStatsEvtInterval(),this._videoInWaiting=!1}},{key:"getRemoteAudioStats",value:(r=km(Em().mark((function e(t,r){var n,i,o,a,s,c,u,d,l,h,f,p,v,_,m,g,y,S,E,b=this;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n={},i={},o=this._stream,a=o.streamId,s=o.userId,c=o.isScreen,u=o.audioMid,d=o.subMediaType,l=o._attributes,h=o.virtual,f={media_type:"audio",is_screen:!!c,direction:"down",stream_id:a,stream_user_id:s,vid:u,audio_mux:h,connection_status:navigator.onLine,track_enabled:null==t?void 0:t.enabled,mute_state:Dw(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((p=e.sent).length){e.next=11;break}return e.abrupt("return",n);case 11:if(p.forEach((function(e){var t=e.type,r=e.packetsLost,o=e.packetsReceived,s=e.bytesReceived,c=e.jitterBufferDelay,u=e.jitterBufferEmittedCount,d=e.clockRate,l=e.channels,h=e.totalSamplesReceived,p=e.concealedSamples,v=e.silentConcealedSamples,_=e.concealmentEvents,m=e.totalRoundTripTime,g=e.packetsDiscarded,y=e.state,S=e.currentRoundTripTime,E=e.audioLevel,k=e.totalAudioEnergy,T=e.totalSamplesDuration,I=e.mimeType,A=e.googDecodingNormal,R=e.googDecodingMuted,w=e.availableIncomingBitrate,C=e.availableOutgoingBitrate,O=e.bytesSent,x=e.nominated,D=e.id,P=e.writable,N=e.jitter,M=e.candidateType,L=e.ip,U=e.address,V=e.networkType,F=e.port,B=e.protocol,j=e.audioOutputLevel,G=e.requestsReceived,H=e.responsesReceived,z=e.requestsSent,K=e.consentRequestsSent,X=e.responsesSent,q=e.ssrc;e.kind;var W=e.nackCount,Y=e.lastPacketReceivedTimestamp,Q=e.concealmentevents,J=e.fecPacketsReceived;if("inbound-rtp"===t)i.packetsLost=r,i.packetsReceived=o,f.packetsReceived=o,f.packetsDiscarded=g,f.nackCount=W,f.lastPacketReceivedTimestamp=Y,f.concealmentevents=Q,i.bytesReceived=s,void 0!==c&&(n.jitterBufferDelay=c/u*1e3,f.average_jitter_buffer_delay_ms=n.jitterBufferDelay),void 0!==h&&(i.totalSamplesReceived=h,n.concealedSamples=p,i.concealedSamples=p,i.silentConcealedSamples=v,f.concealedSamples=p,n.concealmentEvents=_,f.totalSamplesReceived=h),void 0!==J&&(f.fec_packets_received=J,i.fecPacketsReceived=J),f.jitter=1e3*N,f.ssrc=q,void 0!==E&&(f.audio_level=E?-10*qR(Math.pow(E,2)):E),void 0!==E&&(f.volume=255*E),void 0!==k&&(f.total_audio_energy=k),void 0!==T&&(f.totalAudioDuration=T);else if("codec"===t)n.recordSampleRate=d,l&&(n.numChannels=l),f.codecName=I;else if("candidate-pair"===t){var Z,$,ee;f.ice_available_incoming_bitrate=w,f.ice_available_outgoing_bitrate=C,f.ice_bytes_received=s,f.ice_bytes_sent=O,f.ice_nominated=+x,f.ice_pair_id=D,f.ice_pair_rtt=S,f.rtt=1e3*S,f.rtt&&null!==(Z=b._context)&&void 0!==Z&&null!==($=Z.streamRTT)&&void 0!==$&&null!==(ee=$[a])&&void 0!==ee&&ee.audio&&(f.total_rtt_ms=f.rtt+b._context.streamRTT[a].audio),f.ice_pair_state=y,f.ice_pair_writable=P,f.recv_ping_requests=G,f.recv_ping_responses=H,f.sent_ping_requests_before_first_response=z,f.sent_ping_requests_total=z+(K||0),f.sent_ping_responses=X,"succeeded"===y&&(n.rtt=1e3*S,n.total_rtt=1e3*m)}else"track"===t&&void 0!==E?(f.audio_level=E?-10*qR(Math.pow(E,2)):E,f.volume=255*E,f.total_audio_energy=k,f.totalAudioDuration=T):"ssrc"===t?(f.decodingNormal=A,f.recvAudioLevel=j,f.decodingMuted=R):"local-candidate"===t?(f.local_candidate_type=M,f.local_ip=L||U,f.local_network_type=V,f.local_port=F,f.protocol=B):"remote-candidate"===t&&(f.remote_candidate_type=M,f.remote_ip=L||U,f.remote_port=F)})),(v=r.audio).timestamp){e.next=17;break}return i.timestamp=Date.now(),r.audio=i,e.abrupt("return",this.filterIllegal(n));case 17:if(_={},void 0!==i.concealedSamples&&(f.interval_concealed_samples=i.concealedSamples-v.concealedSamples,f.interval_samples_received=i.totalSamplesReceived-v.totalSamplesReceived,f.interval_silent_concealed_samples=i.silentConcealedSamples-v.silentConcealedSamples),!(this._audioStallInterval>0&&void 0!==v.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:m=e.sent,g=m.stall_count,y=m.stall_duration,S=m.stall_list,E=m.stats_count,_.stall_list=S,_.stats_count=E,f.concealedSamples===f.interval_concealed_samples&&f.totalSamplesReceived===f.interval_samples_received?(f.stall_count=0,f.stall_duration=0):(f.stall_count=g,f.stall_duration=y),n.stallCount=f.stall_count,n.stallDuration=f.stall_duration;case 35:return i.timestamp=Date.now(),n.audioLossRate=(i.packetsLost-v.packetsLost)/(i.packetsReceived-v.packetsReceived+(i.packetsLost-v.packetsLost)),n.audioLossRate=Number.isNaN(n.audioLossRate)?0:n.audioLossRate,f.packetsLost=Math.round(i.packetsLost-v.packetsLost),f.fraction_lost=n.audioLossRate,n.statsInterval=i.timestamp-v.timestamp,f.stats_interval=n.statsInterval,n.receivedKBitrate=(i.bytesReceived-v.bytesReceived||0)/n.statsInterval*8,f.bandwidth=Math.round(1e3*n.receivedKBitrate/1024),void 0!==i.concealedSamples&&(n.receivedSampleRate=1e3*f.interval_samples_received/n.statsInterval),void 0!==i.fecPacketsReceived&&(f.fecBitratebps=(i.fecPacketsReceived-v.fecPacketsReceived||0)/n.statsInterval),f.average_jitter_buffer_delay_ms&&f.total_rtt_ms&&(n.e2eDelay=f.average_jitter_buffer_delay_ms+f.total_rtt_ms),r.audio=i,this.monitor.rtcMediaStatistics(f,{},_),e.abrupt("return",this.filterIllegal(n));case 50:case"end":return e.stop()}}),e,this)}))),function(e,t){return r.apply(this,arguments)})},{key:"getRemoteVideoStats",value:(t=km(Em().mark((function e(t,r){var n,i,o,a,s,c,u,d,l,h,f,p,v,_,m=this;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(o={},a={timestamp:Date.now()},s=this._stream,c=s.streamId,u=s.userId,d=s.isScreen,l=s.subMediaType,h=s._attributes,f={media_type:"video",is_screen:!!d,direction:"down",stream_id:c,stream_user_id:u,vid:this._stream.videoMid,connection_status:navigator.onLine,track_enabled:null==t?void 0:t.enabled,mute_state:Pw(l)?"mute_state_off":"mute_state_on",remote_user_capture_state:h.localvideo?"capture_state_on":"capture_state_off",remote_user_mute_state:h.localvideo&&h.videostream?"mute_state_off":"mute_state_on"},t&&this.handler){e.next=6;break}return e.abrupt("return",o);case 6:return o.isScreen=d,e.next=9,this.handler.getStats(t);case 9:if(p=e.sent,null===(n=this.monitor)||void 0===n||n.rtcInvokeStatus(wm(i="reports.length: ".concat(p.length,"; videoTrack: ")).call(i,t.id),0,"get_remote_video_stats",c,0),p.length){e.next=13;break}return e.abrupt("return",o);case 13:if(p.forEach((function(e){var t=e.type,r=e.frameHeight,n=e.frameWidth,i=e.packetsLost,s=e.packetsReceived,u=e.bytesReceived,d=e.framesDecoded,l=e.jitterBufferDelay,h=e.jitterBufferEmittedCount,p=e.mimeType,v=e.firCount,_=e.availableIncomingBitrate,g=e.availableOutgoingBitrate,y=e.bytesSent,S=e.nominated,E=e.id,b=e.currentRoundTripTime,k=e.state,T=e.writable,I=e.candidateType,A=e.ip,R=e.address,w=e.networkType,C=e.port,O=e.nackCount,x=e.pliCount,D=e.protocol,P=e.requestsReceived,N=e.responsesReceived,M=e.requestsSent,L=e.consentRequestsSent,U=e.responsesSent,V=e.ssrc,F=e.jitter,B=e.framesReceived,j=e.keyFramesDecoded,G=e.totalDecodeTime,H=e.decoderImplementation,z=e.lastPacketReceivedTimestamp;if("inbound-rtp"===t)a.packetsLost=i,f.packetsLost=i,a.packetsReceived=s,f.packetsReceived=s,a.bytesReceived=u,f.bytes=u,a.framesDecoded=d,a.totalDecodeTime=G,void 0!==l&&(a.jitterBufferDelay=l/h*1e3,f.average_jitter_buffer_delay_ms=a.jitterBufferDelay),f.fir_count=v,f.nackCount=O,a.nackCount=O,f.pli_count=x,f.ssrc=V,f.jitter=F,f.framesReceived=B,a.framesReceived=B,f.framesDecoded=d,f.key_frames_decoded=j,f.decoder_name=H,f.last_packet_received_timestamp=z,void 0!==n&&(o.width=n,f.frame_size_width=n,o.height=r,f.frame_size_height=r);else if("track"===t&&void 0!==n)o.width=n,f.frame_size_width=n,o.height=r,f.frame_size_height=r,void 0!==B&&(f.framesReceived=B,a.framesReceived=B);else if("codec"===t)f.codecName=p;else if("candidate-pair"===t){var K,X,q;f.ice_available_incoming_bitrate=_,f.ice_available_outgoing_bitrate=g,f.ice_bytes_received=u,f.ice_bytes_sent=y,f.ice_nominated=+S,f.ice_pair_id=E,f.ice_pair_rtt=b,f.rtt=1e3*b,f.rtt&&null!==(K=m._context)&&void 0!==K&&null!==(X=K.streamRTT)&&void 0!==X&&null!==(q=X[c])&&void 0!==q&&q.video&&(f.total_rtt_ms=f.rtt+m._context.streamRTT[c].video),o.rtt=f.rtt,f.ice_pair_state=k,f.ice_pair_writable=T,f.recv_ping_requests=P,f.recv_ping_responses=N,f.sent_ping_requests_before_first_response=M,f.sent_ping_requests_total=M+(L||0),f.sent_ping_responses=U}else"local-candidate"===t?(f.local_candidate_type=I,f.local_ip=A||R,f.local_network_type=w,f.local_port=C,f.protocol=D):"remote-candidate"===t&&(f.remote_candidate_type=I,f.remote_ip=A||R,f.remote_port=C)})),(v=r.video).timestamp){e.next=18;break}return r.video=a,e.abrupt("return",this.filterIllegal(o));case 18:return o.videoLossRate=(a.packetsLost-v.packetsLost)/(a.packetsReceived-v.packetsReceived+(a.packetsLost-v.packetsLost)),v.totalDecodeTime&&v.framesDecoded&&a.framesDecoded!==v.framesDecoded&&(f.decode_elapse_per_frame=+((a.totalDecodeTime-v.totalDecodeTime)/(a.framesDecoded-v.framesDecoded)*1e3).toFixed(2)),o._retransmittedRate=(a.nackCount-v.nackCount)/(a.packetsReceived-v.packetsReceived+(a.packetsLost-v.packetsLost)),o.videoLossRate=Number.isNaN(o.videoLossRate)?0:o.videoLossRate,f.fraction_lost=o.videoLossRate,o.statsInterval=a.timestamp-v.timestamp,f.stats_interval=o.statsInterval,o.receivedKBitrate=(a.bytesReceived-v.bytesReceived||0)/o.statsInterval*8,f.bitrate=Math.round(1e3*o.receivedKBitrate),f.bandwidth=Math.round(f.bitrate/1024),o.decoderOutputFrameRate=1e3*(a.framesDecoded-v.framesDecoded)/o.statsInterval,o.receivedFrameRate=1e3*(a.framesReceived-v.framesReceived)/o.statsInterval,f.frame_rate_decoded=Math.round(o.decoderOutputFrameRate),f.frame_rate_received=Math.round(o.receivedFrameRate),f.average_jitter_buffer_delay_ms&&f.total_rtt_ms&&(o.e2eDelay=f.average_jitter_buffer_delay_ms+f.total_rtt_ms),r.video=a,this.processStall(this._stream,f,o,d),this.isPaused?(_=a.timestamp-(this.pauseStart||0),f.pause_duration=this.pauseDuration+(_>500?_:0),this.pauseStart=a.timestamp):f.pause_duration=this.pauseDuration,f.pause_duration=Math.min(f.stall_duration||f.stuck_length||0,f.pause_duration),this.pauseDuration=0,this.monitor.rtcMediaStatistics(f,{}),e.abrupt("return",this.filterIllegal(o));case 40: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&&this.player&&this.player.played){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=Math.min(o,t.stats_interval),t.stall_duration=void 0):(t.stall_duration=Math.min(o,t.stats_interval),t.stuck_length=void 0),t.play_time=a,r.stallCount=i,r.stallDuration=o}},{key:"destroy",value:function(){wI(AI(o.prototype),"destroy",this).call(this),this.delStatsEvtInterval(),this._videoInWaiting=!1}}],[{key:"audioStallConfig",set:function(e){o.audioStallInterval=((null==e?void 0:e.audio_stall_interval)||200)/2,o.audioStallRatio=null==e?void 0:e.audio_stall_ratio}}]),o}(PV);sd(MV,"audioStallInterval",void 0),sd(MV,"audioStallRatio",void 0);var LV,UV,VV,FV=new RC("Stream",0),BV=function(e){return e[e.INIT=0]="INIT",e[e.SUB_ING=1]="SUB_ING",e[e.SUB_ED=2]="SUB_ED",e}(BV||{}),jV=function(){function e(){Wd(this,e),sd(this,"isScreen",!1),sd(this,"stream",void 0),sd(this,"streamId",void 0),sd(this,"audioMid",void 0),sd(this,"videoMid",void 0),sd(this,"seiList",[]),sd(this,"videoTrack",void 0),sd(this,"audioTrack",void 0),sd(this,"videoTransceiver",void 0),sd(this,"audioTransceiver",void 0),sd(this,"videoEncodeConfig",[xP]),sd(this,"subVideoDescriptions",[]),sd(this,"enableSimulcast",!1),sd(this,"observer",void 0),sd(this,"statsReport",void 0),sd(this,"prevBitrate",0),sd(this,"pubAudio",!1),sd(this,"pubVideo",!1),sd(this,"pubAttributes",void 0),this.stream=new MediaStream,this.pubAttributes={localaudio:!1,localvideo:!1,videostream:!1,audiostream:!1,extvideo:!1,extaudio:!1},this.statsReport=new NV(this)}return qd(e,[{key:"audioHasCapture",get:function(){return this.pubAttributes.localaudio}},{key:"audioHasPublish",get:function(){return this.pubAttributes.audiostream}},{key:"videoHasCapture",get:function(){return this.pubAttributes.localvideo}},{key:"videoHasPublish",get:function(){return this.pubAttributes.videostream}},{key:"hasPublished",get:function(){return this.audioMid&&this.videoMid}},{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(_L()){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,o=DV.generateSEI(n.content),a=new Uint8Array(o.byteLength+t.data.byteLength);if(0===n.repeatCount)ok(i=e.seiList).call(i,0,1);n.repeatCount--,a.set(new Uint8Array(t.data)),a.set(o,t.data.byteLength),t.data=a.buffer,r.enqueue(t)}else r.enqueue(t)}});n.pipeThrough(o).pipeTo(i)}}else FV.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 FV.print("no sender found when trying to bind encodedTransform")}},{key:"clean",value:function(){var e;iP.rtcInvokeStatus("".concat((new Error).stack),0,"localstream_clean",this.streamId||"",0),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.prevBitrate=0,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}(),GV=function(e){OI(r,e);var t=qI(r);function r(e,n,i,o){var a;return Wd(this,r),sd(ZT(a=t.call(this)),"streamId",void 0),sd(ZT(a),"userId",void 0),sd(ZT(a),"isScreen",void 0),sd(ZT(a),"hasVideo",void 0),sd(ZT(a),"hasAudio",void 0),sd(ZT(a),"_attributes",void 0),sd(ZT(a),"streamState",void 0),sd(ZT(a),"observer",void 0),sd(ZT(a),"statsReport",void 0),sd(ZT(a),"subVideo",void 0),sd(ZT(a),"subAudio",void 0),sd(ZT(a),"subMediaType",void 0),sd(ZT(a),"subLayer",void 0),sd(ZT(a),"audioMid",void 0),sd(ZT(a),"videoMid",void 0),sd(ZT(a),"_sequenceId",void 0),sd(ZT(a),"stream",void 0),sd(ZT(a),"videoTrack",void 0),sd(ZT(a),"audioTrack",void 0),sd(ZT(a),"videoTransceiver",void 0),sd(ZT(a),"audioTransceiver",void 0),sd(ZT(a),"recordedVideoFrames",void 0),sd(ZT(a),"stillExist",void 0),sd(ZT(a),"originalMediaType",void 0),sd(ZT(a),"originalStreamIndex",0),sd(ZT(a),"virtual",void 0),a.virtual=!1,a.userId=e,a.isScreen=i,a.streamId=n,a.hasAudio=o.audiostream&&o.localaudio,a.hasVideo=o.videostream&&o.localvideo,a._attributes=o,a.subVideo=!1,a.subAudio=!1,a._sequenceId=0,a.subMediaType=kV.NONE,a.subLayer={spatialLayer:0,spatialSubLayer:-1},a.streamState=0,a.statsReport=new MV(ZT(a)),a}return qd(r,[{key:"audioHasCapture",get:function(){return this._attributes.localaudio}},{key:"audioHasPublish",get:function(){return this._attributes.audiostream}},{key:"videoHasCapture",get:function(){return this._attributes.localvideo}},{key:"videoHasPublish",get:function(){return this._attributes.videostream}},{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){TV.getNalunits(new IV(t.data)).forEach((function(t){if(t.sei){var r=DV.decodeSeiBody(t.body);r&&r.type!==AV.internal&&e.safeEmit("onSEIMessage",r.payload)}})),r.enqueue(t)}})).pipeTo(n)}else FV.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 FV.print("no receiver found when trying to bind encodedTransform")}},{key:"ontrack",value:function(e){var t,r,n,i,o,a;try{var s;iP.rtcInvokeStatus(vk({uid:this.userId,streamId:this.streamId,streams:TE(s=e.streams).call(s,(function(e,t){return e+(null==(r=t)?"undefined | null":"string"==typeof r?r:vk({id:r.id,active:r.active}));var r}),""),transceiver:(i=e.transceiver,null==i?"undefined | null":"string"==typeof i?i:vk({currentDirection:i.currentDirection,direction:i.direction,mid:i.mid,stopped:i.stopped,receiver:(a=i.receiver,null==a?"undefined | null":"string"==typeof a?a:vk({track:Lw(a.track)})),sender:(o=i.sender,null==o?"undefined | null":"string"==typeof o?o:vk({track:Lw(o.track)}))})),track:Lw(e.track)}),0,"Stream.ontrack","",0)}catch(mW){}if(null!==(t=e.streams)&&void 0!==t&&null!==(r=t[0])&&void 0!==r&&null!==(n=r.id)&&void 0!==n&&Jm(n).call(n,this.streamId)){var c,u=e.track;"video"===(null==u?void 0:u.kind)?this._setVideoTrack(u):"audio"===(null===(c=e.track)||void 0===c?void 0:c.kind)&&this._setAudioTrack(u),this._setStream(e.streams[0])}this.safeEmit("ontrack",e)}},{key:"clean",value:function(){var e,t;FV.print("clean",wm(e="exec stream.clean ".concat(this.streamId," ")).call(e,this.userId)),iP.rtcInvokeStatus("".concat((new Error).stack),0,"remotestream_clean",this.streamId,0),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,null===(t=this.observer)||void 0===t||t.reset(),this.statsReport.destroy()}},{key:"resetHasSubscribed",value:function(){this.streamState=0}},{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=fV(e),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=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:aw();return new qU(e,t)}(e),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,c=bb(i).call(i,(function(e){return e.width===a&&e.height===s}));return{spatialLayer:e,spatialSubLayer:(null==c?void 0:c.sub_index)||-1}}}]),r}(OC),HV=new RC("queue",4),zV=function(e){return e[e.ADD=0]="ADD",e[e.CLOSE=1]="CLOSE",e}(zV||{}),KV=function(e){return e.publish="publish",e.unpublish="unpublish",e.subscribe="subscribe",e.unsubscribe="unsubscribe",e.pushtrack="pushtrack",e.removetrack="removetrack",e}(KV||{}),XV=(sd(LV={},"publish","unpublish"),sd(LV,"subscribe","unsubscribe"),sd(LV,"pushtrack","removetrack"),LV),qV=(sd(UV={},"publish",0),sd(UV,"subscribe",0),sd(UV,"pushtrack",0),sd(UV,"unpublish",1),sd(UV,"unsubscribe",1),sd(UV,"removetrack",1),UV),WV=function(e){OI(r,e);var t=qI(r);function r(){var e;return Wd(this,r),sd(ZT(e=t.call(this)),"_queue",void 0),e._queue=[],e}return qd(r,[{key:"queue",get:function(){return this._queue}},{key:"enqueue",value:function(e){var t,r=this._queue.length,n="";return this._queue=Gs(t=this._queue).call(t,(function(t){return t.streamId!==e.streamId||e.action!==XV[t.action]||(n=t.streamId,HV.print("offsetStreamId",n),!1)})),this._queue.length===r&&this._queue.push(e),this.emit("start"),n}},{key:"dequeue",value:function(){var e;if(!this._queue.length)return null;var t=this._queue.length;Tw&&(t=Math.min(this._queue.length,5));for(var r=qV[this._queue[0].action],n=1;n<t;n++){var i;if(qV[this._queue[n].action]!==r)return{sdpStrategy:r,items:ok(i=this._queue).call(i,0,n)}}return{sdpStrategy:r,items:ok(e=this._queue).call(e,0,t)}}}]),r}(lC),YV=new RC("ChromeHandler",3),QV=_L(),JV=function(e){OI(l,e);var t,r,n,i,o,a,s,c,u,d=qI(l);function l(e,t){var r;return Wd(this,l),sd(ZT(r=d.call(this,e,t)),"name","chrome"),sd(ZT(r),"_queueBusy",!1),sd(ZT(r),"_sdpQueue",void 0),sd(ZT(r),"_aSendonlyOfferTpl",void 0),sd(ZT(r),"_vSendonlyOfferTpl",void 0),sd(ZT(r),"_aRecvonlyOfferTpl",void 0),sd(ZT(r),"_vRecvonlyOfferTpl",void 0),sd(ZT(r),"_mid",10),sd(ZT(r),"_offerSession",void 0),sd(ZT(r),"_answerSession",void 0),sd(ZT(r),"_offerMlines",[]),sd(ZT(r),"_answerMlines",[]),sd(ZT(r),"_inactiveMlineIndex",[]),sd(ZT(r),"_mlinesCache",{}),r._sdpQueue=new WV,r._sdpQueue.on("start",(function(){r._queueBusy||"stable"!==r._peerConnection.signalingState||(YV.print("dequeue start"),r.dequeue())})),r}return qd(l,[{key:"connect",value:(u=km(Em().mark((function e(t){var r,n,i,o,a,s,c,u=this;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return YV.print("connect","invoke connect"),this._offerIce={iceUfrag:null===(r=t.iceParams)||void 0===r?void 0:r.clientIceUfrag,icePwd:null===(n=t.iceParams)||void 0===n?void 0:n.clientIcePwd,iceOptions:"renomination"},e.next=4,VL(t);case 4:return this._answerIce=e.sent,this.connection_id=this._answerIce.iceUfrag||"",this.ms_addr=vk((null==t||null===(i=t.publicIPs)||void 0===i?void 0:lk(i).call(i,(function(e){return{ip:e.ip,tcp:e.tcpPorts,udp:e.udpPorts}})))||[]),e.next=9,this._peerConnection.createOffer();case 9:return o=e.sent,a=mL.parse(o.sdp),s=JT(a.media,1),c=s[0],this._offerIce.fingerprint=a.fingerprint||c.fingerprint,delete a.media,this._offerSession=ud({},a),this._answerSession=ud({},a),this._answerSession.fingerprint&&(this._answerSession.fingerprint=this._answerIce.fingerprint),this._offerMlines=[ud(ud(ud({},c),this._offerIce),{},{mid:"".concat(0)})],this._answerMlines=[ud(ud(ud({},c),this._answerIce),{},{sctpmap:{sctpmapNumber:5e3,app:"webrtc-datachannel",maxMessageSize:262144},mid:"".concat(0)})],this.setDescription(),e.next=23,new X_((function(e,t){u._dataChannel.onopen=function(){YV.print("connect","dataChannel open"),pP("es.dc.open","",0,!1,u.connection_id,{ms_addr:u.ms_addr}),e("")},u._dataChannel.onerror=function(e){iP.rtcSignalingMsgError(e.error.sdpLineNumber,e.error.errorDetail,OD.INVALID_DATA),pP("es.dc.error","",0,!1,u.connection_id,{ms_addr:u.ms_addr}),t(e)},u._dataChannel.onclose=function(e){pP("es.dc.close","",0,!1,u.connection_id,{ms_addr:u.ms_addr}),t(e)},u._peerConnection.addEventListener("connectionstatechange",(function(e){"failed"!==u._peerConnection.iceConnectionState&&"closed"!==u._peerConnection.iceConnectionState&&"failed"!==u._peerConnection.connectionState||t(e)}))}));case 23:return YV.print("connect","dataChannel establish success"),e.abrupt("return",this._dataChannel);case 25:case"end":return e.stop()}}),e,this)}))),function(e){return u.apply(this,arguments)})},{key:"disconnect",value:function(){this._peerConnection.close(),this._dataChannel.close(),this._peerConnection.ontrack=null}},{key:"destroy",value:function(){wI(AI(l.prototype),"destroy",this).call(this),this._mlinesCache={}}},{key:"publish",value:(c=km(Em().mark((function e(t){var r,n,i,o,a,s,c,u,d,h,f,p,v,_,m,g,y,S,E,b,k,T,I,A,R,w,C,O,x,D,P,N,M,L,U,V,F;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return u=t.stream,d=t.enableSimulcast,h=wI(AI(l.prototype),"internalPublish",this).call(this,t),f=h.videoDescriptions,p=h.subVideoDescriptions,v=h.audioTransceiverInit,_=h.videoTransceiverInit,m=PL(this._nextSsrc),this._nextSsrc=m.next,g="".concat(this._mid++),y="".concat(this._mid++),S=ud(ud(ud({},this._aSendonlyOfferTpl),this._offerIce),{},{mid:g,msid:wm(r="".concat(u.id," ")).call(r,u.id,"-audio"),ssrcs:NL(u.id,"audio",m.audio,xL)}),E=ud(ud(ud({},this._vSendonlyOfferTpl),this._offerIce),{},{mid:y,msid:wm(n="".concat(u.id," ")).call(n,u.id,"-video")}),d?(YV.print("subVideoDesc","desc: %o ",p),delete E.ssrcGroups,delete E.ssrcs,b=[],E.rids=lk(f).call(f,(function(e){var t=e.rid;return b.unshift(t),{id:t,direction:"send"}})),E.simulcast={dir1:"send",list1:b.join(";")}):(k=ML(u.id,m,{cname:xL}),T=k.ssrcs,I=k.ssrcGroups,E.ssrcs=T,E.ssrcGroups=I),null!==(i=this._context)&&void 0!==i&&null!==(o=i.serverConfig)&&void 0!==o&&o.audioRed&&Array.isArray(S.rtp)&&(-1!==(R=qA(A=S.rtp).call(A,(function(e){return"red"===e.codec})))&&(C=ok(w=S.rtp).call(w,R,1),O=JT(C,1),x=O[0],S.rtp.unshift(x)),D=[],S.rtp.forEach((function(e){return D.push(e.payload)})),S.payloads=D.join(" ")),null!==(a=this._context)&&void 0!==a&&null!==(s=a.serverConfig)&&void 0!==s&&s.videoCodec&&GL(E,null===(P=this._context)||void 0===P||null===(N=P.serverConfig)||void 0===N?void 0:N.videoCodec),(pw||Sw)&&Array.isArray(E.ext)&&(E.ext=Gs(M=E.ext).call(M,(function(e){var t;return!(null!=e&&null!==(t=e.uri)&&void 0!==t&&Jm(t).call(t,"video-orientation"))}))),(L=null==S?void 0:bb(c=S.rtp).call(c,(function(e){return"opus"===e.codec})))&&S.fmtp&&(F=bb(U=S.fmtp).call(U,(function(e){return e.payload===L.payload})))&&null!==(V=this._context)&&void 0!==V&&V.audioProfileManager&&(F.config=this._context.audioProfileManager.getOpusConfigStr(F.config)),d||pw||this.addBitrateLimit(E,t.videoEncodeConfig[0].maxKbps),this._mlinesCache[t.stream.id]=[S,E],e.abrupt("return",{partialSdp:UL(this._offerSession,S,E),audioMid:g,videoMid:y,type:"incroffer",semantics:"unified-plan",videoDescriptions:f,subVideoDescriptions:p,audioTransceiverInit:v,videoTransceiverInit:_});case 17:case"end":return e.stop()}}),e,this)}))),function(e){return c.apply(this,arguments)})},{key:"subscribe",value:(s=km(Em().mark((function e(t,r){var n,i,o,a,s,c,u,d,l,h,f,p,v,_,m,g,y,S,E,b,k,T,I,A,R,w,C,O,x,D,P=this;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(YV.print("subscribe"),a="incroffer",s="unified-plan",this._aRecvonlyOfferTpl&&this._vRecvonlyOfferTpl){e.next=9;break}return e.next=6,this._genOfferSdp();case 6:return c=e.sent,e.next=9,this.createAVMlineOfferTpl(c);case 9:if(u="",d="",l=!1,h=!1,f=void 0,p=void 0,this._mlinesCache[t.streamId]=[f,p],t.virtual?(u="".concat(this._mid++),l=!0):r.multiChatMode?(u="".concat(this._mid++),d="".concat(this._mid++),h=!0):(l=!0,h=!0,u="".concat(this._mid++),d="".concat(this._mid++)),u&&(f=ud(ud({},this._aRecvonlyOfferTpl),{},{mid:u})),l&&(this._mlinesCache[t.streamId][0]=f,v={track:"audio",init:{direction:"recvonly"}}),d&&(p=ud(ud({},this._vRecvonlyOfferTpl),{},{mid:d})),h&&(this._mlinesCache[t.streamId][1]=p,_={track:"video",init:{direction:"recvonly"}}),m=UL(this._offerSession,f,p),g=void 0,r.multiChatMode||t.virtual||!this._aSendonlyAnswerTpl||!this._vSendonlyAnswerTpl){e.next=32;break}return g=PL(this._nextSsrc),this._nextSsrc=g.next,A=ud(ud(ud({},this._aSendonlyAnswerTpl),this._answerIce),{},{mid:u,msid:wm(y=wm(S="".concat(t.streamId)).call(S,null!==(E=this._context)&&void 0!==E&&E.avSync?"":"-audio"," ")).call(y,t.streamId,"-audio"),ssrcs:NL(t.streamId,"audio",g.audio)}),R=ud(ud(ud({},this._vSendonlyAnswerTpl),this._answerIce),{},{mid:d,msid:wm(b=wm(k="".concat(t.streamId)).call(k,null!==(T=this._context)&&void 0!==T&&T.avSync?"":"-video"," ")).call(b,t.streamId,"-video")},ML(t.streamId,g,{flexfec:this._enableSubFlexfec})),w=new X_((function(e){P._sdpQueue.enqueue({action:KV.subscribe,streamId:t.streamId,audioMid:u,videoMid:d,audioTransceiverInit:v,videoTransceiverInit:_,signalingAck:{sdp:mL.write(ud(ud({},P._answerSession),{},{media:[A,R]})),sequenceId:t.sequenceId?++t.sequenceId:0},stream:t,sdp:m,onSuccess:function(){YV.print("subscribe()","sub success"),e(0)}})})),e.next=31,w;case 31:null===(I=g)||void 0===I||delete I.next;case 32:return(C=null===(n=f)||void 0===n?void 0:bb(i=n.rtp).call(i,(function(e){return"opus"===e.codec})))&&null!==(o=f)&&void 0!==o&&o.fmtp&&(D=null===(O=f)||void 0===O?void 0:bb(x=O.fmtp).call(x,(function(e){return e.payload===C.payload})))&&this._context&&(D.config+=";stereo=1;sprop-stereo=1"),e.abrupt("return",{partialSdp:m,audioMid:u,videoMid:d,type:a,semantics:s,audioTransceiverInit:v,videoTransceiverInit:_,allSsrc:g});case 35:case"end":return e.stop()}}),e,this)}))),function(e,t){return s.apply(this,arguments)})},{key:"handleAck",value:(a=km(Em().mark((function e(t){return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(YV.print("handleAck()","item: %o",t),!t.generatorSsrc){e.next=4;break}return YV.print("already set remote"),e.abrupt("return","");case 4:return e.abrupt("return",this._sdpQueue.enqueue(t));case 5:case"end":return e.stop()}}),e,this)}))),function(e){return a.apply(this,arguments)})},{key:"dequeue",value:(o=km(Em().mark((function e(){var t,r,n,i,o,a,s,c,u,d,l,h,f,p,v,_=this;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._queueBusy=!0,t=this._sdpQueue.dequeue(),YV.print("dequeue()","ret: %o",t),t){e.next=6;break}return this._queueBusy=!1,e.abrupt("return");case 6:if(e.prev=6,r=t.items,n=t.sdpStrategy,i=[],o=[],a=[],n!==zV.ADD){e.next=15;break}return e.delegateYield(Em().mark((function e(){var t,n;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:delete(t=ud({},_._answerIce)).candidates,s=!1,c=!1,e.prev=4,d=gN(r);case 6:return e.next=8,d.next();case 8:if(!(s=!(l=e.sent).done)){e.next=16;break}if(n=l.value,"break"!==function(){var e=n.audioMid,r=n.videoMid,s=n.action,c=n.audioTransceiverInit,u=n.videoTransceiverInit,d=n.signalingAck,l=n.stream,h=l instanceof GV;if(n.onSuccess&&a.push(n.onSuccess),h&&(null==d?void 0:d.sequenceId)<l.sequenceId)return"break";var f,p={},v={},m=mL.parse(d.sdp);Array.isArray(m.media)&&VA(f=m.media).call(f,(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(n){"audio"===(n=ud(ud({},n),t)).type?(p=n).mid=e:(v=n).mid=r}));var g,y=l.streamId;if(s===KV.publish&&(y=null===(g=l.stream)||void 0===g?void 0:g.id),!_._mlinesCache[y])return"break";var S=JT(_._mlinesCache[y],2),E=S[0],b=S[1];if(c&&E){l.audioTransceiver=_._peerConnection.addTransceiver(c.track,c.init),_.monitor.rtcInvokeStatus(vk({audioStreamTrack:Lw(c.track)}),0,"chromeHandler.addTrack","",0);var k=_._inactiveMlineIndex.shift();k||(k=_._offerMlines.length),_._offerMlines[k]=ud({},E),_._answerMlines[k]=p,QV&&l.initAudioEncodedTransform()}if(u&&b){var T,I;l.videoTransceiver=_._peerConnection.addTransceiver(u.track,u.init),_.monitor.rtcInvokeStatus(vk({videoStreamTrack:Lw(u.track)}),0,"chromeHandler.addTrack","",0);var A,R,w=_._inactiveMlineIndex.shift();w||(w=_._offerMlines.length),_._offerMlines[w]=ud({},b),s===KV.publish&&null!==(T=_._context)&&void 0!==T&&null!==(I=T.serverConfig)&&void 0!==I&&I.videoCodec&&GL(v,null===(A=_._context)||void 0===A||null===(R=A.serverConfig)||void 0===R?void 0:R.videoCodec),_._answerMlines[w]=v,QV&&l.initVideoEncodedTransform()}i.push(l.streamId||""),o.push(h?l.userId:"local"),h&&(l.sequenceId=null==d?void 0:d.sequenceId),delete _._mlinesCache[y]}()){e.next=13;break}return e.abrupt("break",16);case 13:s=!1,e.next=6;break;case 16:e.next=22;break;case 18:e.prev=18,e.t0=e.catch(4),c=!0,u=e.t0;case 22:if(e.prev=22,e.prev=23,!s||null==d.return){e.next=27;break}return e.next=27,d.return();case 27:if(e.prev=27,!c){e.next=30;break}throw u;case 30:return e.finish(27);case 31:return e.finish(22);case 32:case"end":return e.stop()}}),e,null,[[4,18,22,32],[23,,27,31]])}))(),"t0",13);case 13:e.next=20;break;case 15:v={},r.forEach((function(e){var t=e.audioMid,r=e.videoMid,n=e.action;v[t]=t,n!==KV.removetrack&&(v[r]=r),v[t]=t})),this._offerMlines=lk(h=this._offerMlines).call(h,(function(e,t){return v[e.mid]&&(e=LL(e),_._inactiveMlineIndex.push(t)),e})),VA(f=this._inactiveMlineIndex).call(f,(function(e,t){return e-t})),this._answerMlines=lk(p=this._answerMlines).call(p,(function(e){return v[e.mid]&&(e=LL(e)),e}));case 20:return e.next=22,this.setDescription(i.length?{streamId:i.join(","),streamUserId:o.join(",")}:void 0);case 22:try{a.forEach((function(e){return e()}))}catch(mW){}YV.print("dequeue","loop"),e.next=29;break;case 26:e.prev=26,e.t1=e.catch(6),YV.print("dequeue","unknown error: %o",e.t1);case 29:return e.prev=29,this.dequeue(),e.finish(29);case 32:case"end":return e.stop()}}),e,this,[[6,26,29,32]])}))),function(){return o.apply(this,arguments)})},{key:"setDescription",value:(i=km(Em().mark((function e(t){var r,n;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return YV.print("setDescription"),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=sw(),t&&iP.rtcBeginCreateOffer("local"===t.streamUserId?DD.UP:DD.DOWN,t.streamId,t.streamUserId),e.next=10,this._peerConnection.createOffer();case 10:return t&&iP.rtcCreateOffer(0,"local"===t.streamUserId?PD.UP:PD.DOWN,t.streamId,t.streamUserId,sw()-n),e.next=13,this.setLocalDescription(mL.write(this._offerSession),t);case 13:return e.next=15,this.setRemoteDescription(mL.write(this._answerSession),t);case 15:case"end":return e.stop()}}),e,this)}))),function(e){return i.apply(this,arguments)})},{key:"getDefaultSdp",value:(n=km(Em().mark((function e(){var t,r,n,i;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._genOfferSdp();case 2:return r=e.sent,this.createAVMlineOfferTpl(r),n=mL.parse(r),i=[],n.media=Gs(t=n.media).call(t,(function(e){var t;return"recvonly"===e.direction&&(Array.isArray(e.ext)&&(e.ext=Gs(t=e.ext).call(t,(function(e){return"urn:ietf:params:rtp-hdrext:sdes:rtp-stream-id"!==e.uri}))),i.push(e.mid+""),!0)})),n.groups=[{mids:i.join(" "),type:"BUNDLE"}],e.abrupt("return",{sdp:mL.write(n),semantics:"unified-plan",type:"incroffer"});case 9:case"end":return e.stop()}}),e,this)}))),function(){return n.apply(this,arguments)})},{key:"rollback",value:(r=km(Em().mark((function e(t){return Em().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 r.apply(this,arguments)})},{key:"createAVMlineOfferTpl",value:function(e){var t=this;mL.parse(e).media.forEach((function(e){if("audio"===e.type)if("sendonly"===e.direction)t._aSendonlyOfferTpl=e;else{var r;if(Array.isArray(e.ext))e.ext=Gs(r=e.ext).call(r,(function(e){return"urn:ietf:params:rtp-hdrext:sdes:rtp-stream-id"!==e.uri}));t._aRecvonlyOfferTpl=e}else if("video"===e.type)if("sendonly"===e.direction)t._vSendonlyOfferTpl=e;else{var n;if(Array.isArray(e.ext))e.ext=Gs(n=e.ext).call(n,(function(e){return"urn:ietf:params:rtp-hdrext:sdes:rtp-stream-id"!==e.uri}));t._vRecvonlyOfferTpl=e}}))}},{key:"_genOfferSdp",value:(t=km(Em().mark((function e(){var t,r;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,Cw(!0);case 3:if(t=e.sent){e.next=6;break}throw"pc.createOffer() return empty.";case 6:e.next=12;break;case 8:throw e.prev=8,e.t0=e.catch(0),r="Get offer Error. ".concat(e.t0.message|e.t0),new lR(uR.NOT_SUPPORTED,r);case 12:return e.abrupt("return",t);case 13:case"end":return e.stop()}}),e,null,[[0,8]])}))),function(){return t.apply(this,arguments)})}]),l}(KL),ZV=new RC("FirefoxHandler",3),$V=function(e){OI(l,e);var t,r,n,i,o,a,s,c,u,d=qI(l);function l(){var e,t;Wd(this,l);for(var r=arguments.length,n=new Array(r),i=0;i<r;i++)n[i]=arguments[i];return sd(ZT(t=d.call.apply(d,wm(e=[this]).call(e,n))),"name","firefox"),sd(ZT(t),"_aRecvonlyOfferTpl",void 0),t}return qd(l,[{key:"connect",value:(u=km(Em().mark((function e(t){var r,n,i,o,a,s,c,u,d,l,h,f=this;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return ZV.print("connect","invoke connect"),this._offerIce={iceUfrag:null===(r=t.iceParams)||void 0===r?void 0:r.clientIceUfrag,icePwd:null===(n=t.iceParams)||void 0===n?void 0:n.clientIcePwd,iceOptions:"renomination"},e.next=4,VL(t);case 4:return this._answerIce=e.sent,this.connection_id=this._answerIce.iceUfrag||"",this.ms_addr=vk((null==t||null===(i=t.publicIPs)||void 0===i?void 0:lk(i).call(i,(function(e){return{ip:e.ip,tcp:e.tcpPorts,udp:e.udpPorts}})))||[]),this._peerConnection.addTransceiver("audio",{direction:"recvonly"}),this._peerConnection.addTransceiver("video",{direction:"recvonly"}),e.next=11,this._peerConnection.createOffer();case 11:return c=e.sent,u=mL.parse(c.sdp),d=JT(u.media,1),l=d[0],this._offerIce.fingerprint=u.fingerprint||l.fingerprint,u.media=lk(o=u.media).call(o,(function(e){return ud(ud({},e),f._offerIce)})),lk(a=u.media).call(a,(function(e){var t,r;"video"===e.type&&(e.ext=null===(t=e.ext)||void 0===t?void 0:Gs(t).call(t,(function(e){var t;return-1===Pb(t=e.uri).call(t,"abs-send-time")})),e.rtcpFb=null===(r=e.rtcpFb)||void 0===r?void 0:Gs(r).call(r,(function(e){return"goog-remb"!==e.type})))})),(h=ud({},u)).fingerprint=this._answerIce.fingerprint,h.media=lk(s=h.media).call(s,(function(e){return delete(e=ud(ud({},e),f._answerIce)).bundleOnly,e.port=9,"application"===e.type?e.sctpmap={sctpmapNumber:5e3,app:"webrtc-datachannel",maxMessageSize:262144}:("audio"===e.type&&(e.msid="ff-stream ff-stream-audio"),e.direction="sendonly"),e})),e.next=22,this.setLocalDescription(mL.write(u));case 22:return e.next=24,this.setRemoteDescription(mL.write(h));case 24:return e.next=26,new X_((function(e,t){f._dataChannel.onopen=function(){ZV.print("connect","dataChannel open"),pP("es.dc.open","",0,!1,f.connection_id,{ms_addr:f.ms_addr}),e("")},f._dataChannel.onerror=function(e){iP.rtcSignalingMsgError(e.error.sdpLineNumber,e.error.errorDetail,OD.INVALID_DATA),pP("es.dc.error","",0,!1,f.connection_id,{ms_addr:f.ms_addr}),t(e)},f._dataChannel.onclose=function(e){pP("es.dc.close","",0,!1,f.connection_id,{ms_addr:f.ms_addr}),t(e)},f._peerConnection.addEventListener("connectionstatechange",(function(e){"failed"!==f._peerConnection.iceConnectionState&&"closed"!==f._peerConnection.iceConnectionState&&"failed"!==f._peerConnection.connectionState||t(e)}))}));case 26:return ZV.print("connect","dataChannel establish success"),e.abrupt("return",this._dataChannel);case 28:case"end":return e.stop()}}),e,this)}))),function(e){return u.apply(this,arguments)})},{key:"publish",value:(c=km(Em().mark((function e(t){var r,n,i,o,a,s,c,u,d,h,f,p,v,_,m=this;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=wI(AI(l.prototype),"internalPublish",this).call(this,t),o=i.videoDescriptions,a=i.subVideoDescriptions,s=i.audioTransceiverInit,c=i.videoTransceiverInit,t.audioTransceiver=this._peerConnection.addTransceiver(s.track,s.init),t.videoTransceiver=this._peerConnection.addTransceiver(c.track,c.init),u=sw(),iP.rtcBeginCreateOffer(DD.UP,"",""),e.next=7,this._peerConnection.createOffer();case 7:return d=e.sent,iP.rtcCreateOffer(0,PD.UP,"","",sw()-u),(h=mL.parse(d.sdp)).media=null===(r=h.media)||void 0===r?void 0:lk(r).call(r,(function(e){return ud(ud({},e),m._offerIce)})),e.next=13,this.setLocalDescription(mL.write(h));case 13:return f=t.audioTransceiver.mid,p=t.videoTransceiver.mid,v=null,_=null,h.media=null===(n=h.media)||void 0===n?void 0:lk(n).call(n,(function(e){if("".concat(e.mid)===f){var t,r,n=null===(t=v=e)||void 0===t?void 0:bb(r=t.rtp).call(r,(function(e){return"opus"===e.codec}));if(n&&v.fmtp){var i,o,a=bb(i=v.fmtp).call(i,(function(e){return e.payload===n.payload}));a&&null!==(o=m._context)&&void 0!==o&&o.audioProfileManager&&(a.config=m._context.audioProfileManager.getOpusConfigStr(a.config))}}else if("".concat(e.mid)===p){var s,c,u,d;null!==(s=m._context)&&void 0!==s&&null!==(c=s.serverConfig)&&void 0!==c&&c.videoCodec&&GL(e,null===(u=m._context)||void 0===u||null===(d=u.serverConfig)||void 0===d?void 0:d.videoCodec),_=e}return e})),this.addBitrateLimit(_,t.videoEncodeConfig[0].maxKbps),e.next=21,this.setLocalDescription(mL.write(h));case 21:return e.abrupt("return",{partialSdp:UL(h,v,_,!1),audioMid:f,videoMid:p,type:"incroffer",semantics:"unified-plan",videoDescriptions:o,subVideoDescriptions:a,audioTransceiverInit:s,videoTransceiverInit:c});case 22:case"end":return e.stop()}}),e,this)}))),function(e){return c.apply(this,arguments)})},{key:"subscribe",value:(s=km(Em().mark((function e(t,r){var n,i,o,a,s,c,u,d,l,h,f,p,v,_,m,g,y,S,E,b,k,T,I,A,R=this;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return ZV.print("subscribe()"),c="",u="",d=!1,l=!1,h=void 0,f=void 0,t.virtual?d=!0:(r.multiChatMode||(d=!0),l=!0),d&&(t.audioTransceiver=this._peerConnection.addTransceiver("audio",{direction:"recvonly"})),l&&(t.videoTransceiver=this._peerConnection.addTransceiver("video",{direction:"recvonly"})),p=sw(),iP.rtcBeginCreateOffer(DD.UP,t.streamId,t.userId),e.next=14,this._peerConnection.createOffer();case 14:return v=e.sent,iP.rtcCreateOffer(0,PD.UP,t.streamId,t.userId,sw()-p),(_=mL.parse(v.sdp)).media=null===(n=_.media)||void 0===n?void 0:lk(n).call(n,(function(e){return ud(ud({},e),R._offerIce)})),lk(i=_.media).call(i,(function(e){var t,r;"video"===e.type&&(e.ext=null===(t=e.ext)||void 0===t?void 0:Gs(t).call(t,(function(e){var t;return-1===Pb(t=e.uri).call(t,"abs-send-time")})),e.rtcpFb=null===(r=e.rtcpFb)||void 0===r?void 0:Gs(r).call(r,(function(e){return"goog-remb"!==e.type})))})),e.next=21,this.setLocalDescription(mL.write(_),{streamId:t.streamId||"",streamUserId:t.userId});case 21:if(c=null===(o=t.audioTransceiver)||void 0===o?void 0:o.mid,u=null===(a=t.videoTransceiver)||void 0===a?void 0:a.mid,null===(s=_.media)||void 0===s||s.forEach((function(e){"".concat(e.mid)===c?h=e:"".concat(e.mid)===u&&(f=e)})),c&&h||(c="audio_".concat(u),h=ud(ud({},this._aRecvonlyOfferTpl),{},{mid:c})),t.audioMid=c,t.videoMid=u,m=void 0,r.multiChatMode||t.virtual||!this._aSendonlyAnswerTpl||!this._aSendonlyAnswerTpl){e.next=36;break}return m=PL(this._nextSsrc),this._nextSsrc=m.next,I=ud(ud(ud({},this._aSendonlyAnswerTpl),this._answerIce),{},{mid:c,msid:wm(g=wm(y="".concat(t.streamId)).call(y,null!==(S=this._context)&&void 0!==S&&S.avSync?"":"-audio"," ")).call(g,t.streamId,"-audio"),ssrcs:NL(t.streamId,"audio",m.audio)}),A=ud(ud(ud({},this._vSendonlyAnswerTpl),this._answerIce),{},{mid:u,msid:wm(E=wm(b="".concat(t.streamId)).call(b,null!==(k=this._context)&&void 0!==k&&k.avSync?"":"-video"," ")).call(E,t.streamId,"-video")},ML(t.streamId,m,{flexfec:this._enableSubFlexfec})),e.next=35,this._internalSetRemoteDescription([I,A],t);case 35:null===(T=m)||void 0===T||delete T.next;case 36:return e.abrupt("return",{partialSdp:UL(_,h,f,!1),audioMid:c,videoMid:u,type:"incroffer",semantics:"unified-plan",audioTransceiverInit:t.audioTransceiver?{track:"audio",init:{direction:"recvonly"}}:void 0,videoTransceiverInit:t.videoTransceiver?{track:"video",init:{direction:"recvonly"}}:void 0,allSsrc:m});case 37:case"end":return e.stop()}}),e,this)}))),function(e,t){return s.apply(this,arguments)})},{key:"handleAck",value:(a=km(Em().mark((function e(t){var r,n,i,o;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=t.signalingAck,n=t.stream,(i=t.action)!==KV.unpublish&&i!==KV.unsubscribe&&i!==KV.removetrack){e.next=5;break}return e.next=4,this.close(n);case 4:return e.abrupt("return",n.streamId||"");case 5:if(!t.generatorSsrc){e.next=8;break}return ZV.print("already set remote"),e.abrupt("return","");case 8:return o=mL.parse(null==r?void 0:r.sdp),e.next=11,this._internalSetRemoteDescription(o.media,n);case 11:return e.abrupt("return","");case 12:case"end":return e.stop()}}),e,this)}))),function(e){return a.apply(this,arguments)})},{key:"_internalSetRemoteDescription",value:(o=km(Em().mark((function e(t,r){var n,i,o,a,s,c,u,d,l=this;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return s={},(c=mL.parse(null===(n=this._peerConnection.remoteDescription)||void 0===n?void 0:n.sdp)).media.forEach((function(e){void 0!==e.mid&&(s[e.mid]=e)})),t.forEach((function(e){if("audio"===(e=ud(ud({},e),l._answerIce)).type&&(r.audioMid?(e.mid=r.audioMid,s[r.audioMid]=e):s[e.mid]=e),"video"===e.type){if(r instanceof jV&&yw<=87){var t,n,i,o,a={};Array.isArray(e.rtp)&&(e.rtp=Gs(t=e.rtp).call(t,(function(e){return"rtx"!==e.codec||(a[e.payload]=e.payload,!1)}))),"string"==typeof e.payloads&&(e.payloads=Gs(n=e.payloads.split(" ")).call(n,(function(e){return!a[e]})).join(" ")),Array.isArray(e.fmtp)&&(e.fmtp=Gs(i=e.fmtp).call(i,(function(e){return!a[e.payload]}))),Array.isArray(e.rtcpFb)&&(e.fmtp=Gs(o=e.fmtp).call(o,(function(e){return!a[e.payload]})))}r.videoMid?(e.mid=r.videoMid,s[r.videoMid]=e):s[e.mid]=e}})),u=mL.parse(null===(i=this._peerConnection.localDescription)||void 0===i?void 0:i.sdp),d=lk(o=u.media).call(o,(function(e){var t=s[e.mid];return"inactive"===e.direction?e:t})),c.groups=u.groups,c.media=d,lk(a=c.media).call(a,(function(e){var t,r;"video"===e.type&&(e.ext=null===(t=e.ext)||void 0===t?void 0:Gs(t).call(t,(function(e){var t;return-1===Pb(t=e.uri).call(t,"abs-send-time")})),e.rtcpFb=null===(r=e.rtcpFb)||void 0===r?void 0:Gs(r).call(r,(function(e){return"goog-remb"!==e.type})))})),e.next=11,this.setRemoteDescription(mL.write(c));case 11:case"end":return e.stop()}}),e,this)}))),function(e,t){return o.apply(this,arguments)})},{key:"getDefaultSdp",value:(i=km(Em().mark((function e(){var t,r,n,i,o;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=mL.parse(null===(t=this._peerConnection.localDescription)||void 0===t?void 0:t.sdp),this.createAVMlineOfferTpl(null===(r=this._peerConnection.localDescription)||void 0===r?void 0:r.sdp),o=[],i.media=Gs(n=i.media).call(n,(function(e){return"recvonly"===e.direction&&(e.mid=e.mid+1,o.push(e.mid+""),!0)})),i.groups=[{mids:o.join(" "),type:"BUNDLE"}],e.abrupt("return",{sdp:mL.write(i),semantics:"unified-plan",type:"incroffer"});case 6:case"end":return e.stop()}}),e,this)}))),function(){return i.apply(this,arguments)})},{key:"rollback",value:(n=km(Em().mark((function e(t,r,n){return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return ZV.print("rollback()"),e.abrupt("return",this.close(r));case 2:case"end":return e.stop()}}),e,this)}))),function(e,t,r){return n.apply(this,arguments)})},{key:"close",value:(r=km(Em().mark((function e(t,r){var n,i,o,a,s,c,u,d,l,h=this;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return ZV.print("close()"),a={},t.audioTransceiver&&t.audioMid&&(t.audioTransceiver.stop(),a[t.audioMid]=t.audioMid),t.videoTransceiver&&t.videoMid&&!r&&(t.videoTransceiver.stop(),a[t.videoMid]=t.videoMid),s=[],e.next=7,this._peerConnection.createOffer();case 7:return c=e.sent,(u=mL.parse(null==c?void 0:c.sdp)).media=lk(n=u.media).call(n,(function(e){return a[e.mid]&&(e=LL(e)),"inactive"!==e.direction&&s.push(e.mid),ud(ud({},e),h._offerIce)})),d=mL.parse(null===(i=this._peerConnection.remoteDescription)||void 0===i?void 0:i.sdp),l={},d.media.forEach((function(e){void 0!==e.mid&&(l[e.mid]=e)})),d.media=lk(o=u.media).call(o,(function(e){return"inactive"===e.direction?e:l[e.mid]})),u.groups&&d.groups&&(u.groups[0].mids=s.join(" "),d.groups[0].mids=s.join(" ")),e.next=17,this.setLocalDescription(mL.write(u));case 17:return e.next=19,this.setRemoteDescription(mL.write(d));case 19:case"end":return e.stop()}}),e,this)}))),function(e,t){return r.apply(this,arguments)})},{key:"setCurrentDescription",value:(t=km(Em().mark((function e(){return Em().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)})},{key:"createAVMlineOfferTpl",value:function(e){var t=this;mL.parse(e).media.forEach((function(e){"audio"===e.type&&(t._aRecvonlyOfferTpl=e)}))}}]),l}(KL),eF=function(e,t){return fw?new $V(e,t):new JV(e,t)},tF=new RC("Locker",2),rF=1,nF=function(){function e(t){var r;Wd(this,e),sd(this,"lockingPromise",X_.resolve()),sd(this,"locks",0),sd(this,"name",""),sd(this,"lockId",void 0),this.lockId=rF++,t&&(this.name=t),tF.print(wm(r="[lock-".concat(this.name,"-")).call(r,this.lockId,"] is created."))}return qd(e,[{key:"isLocked",get:function(){return this.locks>0}},{key:"lock",value:function(){var e,t,r,n=this;this.locks+=1,tF.print(wm(e=wm(t="[lock-".concat(this.name,"-")).call(t,this.lockId,"] locked, current queue ")).call(e,this.locks,"."));var i=new X_((function(e){r=function(){var t,r;n.locks-=1,tF.print(wm(t=wm(r="[lock-".concat(n.name,"-")).call(r,n.lockId,"] unlocked, current queue ")).call(t,n.locks,".")),e()}})),o=this.lockingPromise.then((function(){return r}));return this.lockingPromise=this.lockingPromise.then((function(){return i})),o}}]),e}(),iF=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_SUBTITLE_STATE_CHANGED="ON_SUBTITLE_STATE_CHANGED",e.ON_SUBTITLE_MESSAGE_RECEIVED="ON_SUBTITLE_MESSAGE_RECEIVED",e.ON_VIDEO_STREAM_BANNED="ON_VIDEO_STREAM_BANNED",e.ON_AUDIO_STREAM_BANNED="ON_AUDIO_STREAM_BANNED",e}(iF||{}),oF=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}(oF||{}),aF=function(e){return e[e.PUB=0]="PUB",e[e.UNPUB=1]="UNPUB",e}(aF||{}),sF=function(e){return e[e.SUB=0]="SUB",e[e.UNSUB=1]="UNSUB",e}(sF||{}),cF=(sd(VV={},Dd.communication,[0]),sd(VV,Dd.chat,[0]),sd(VV,Dd.chatRoom,[1,"IES_chatroom"]),sd(VV,Dd.coHost,[1,"IES_PK"]),sd(VV,Dd.meeting,[16]),sd(VV,Dd.classRoom,[0]),VV),uF=ad,dF=tc,lF=function(e,t,r,n){for(var i,o=n>1?void 0:n?dF(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&&uF(t,r,o),o},hF=new RC("MediaServerClient",2),fF=6e4,pF=function(e){return e.DISCONNECTED="disconnected",e.DISCONNECTING="disconnecting",e.CONNECTED="connected",e.CONNECTING="connecting",e}(pF||{}),vF=function(e,t){hF.print(e,"userId: %o, subAudio: %o, subVideo: %o, audioMid: %o, videoMid: %o, sequenceId: %o",t.userId,t.subAudio,t.subVideo,t.audioMid,t.videoMid,t.sequenceId)},_F=function(e){OI(b,e);var t,r,n,i,o,a,s,c,u,d,l,h,f,p,v,_,m,g,y,S,E=qI(b);function b(e){var t,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:iP;return Wd(this,b),sd(ZT(t=E.call(this)),"id",void 0),sd(ZT(t),"_token",void 0),sd(ZT(t),"_appId",void 0),sd(ZT(t),"_roomId",void 0),sd(ZT(t),"_roomAttributes",void 0),sd(ZT(t),"_clientId",void 0),sd(ZT(t),"_businessId",void 0),sd(ZT(t),"_userInfo",void 0),sd(ZT(t),"_useCloudProxy",void 0),sd(ZT(t),"_expectedIDC",void 0),sd(ZT(t),"_authorization",void 0),sd(ZT(t),"_sessionId",void 0),sd(ZT(t),"_iceConfigRequestManager",void 0),sd(ZT(t),"_ontrackCallbackMap",new uE),sd(ZT(t),"_subResolves",{}),sd(ZT(t),"supportConcurrent",!1),sd(ZT(t),"_handler",void 0),sd(ZT(t),"_pubSubLock",void 0),sd(ZT(t),"_joinLeaveLock",void 0),sd(ZT(t),"_state",void 0),sd(ZT(t),"_dataChannelSignal",void 0),sd(ZT(t),"_subConfig",{}),sd(ZT(t),"monitor",void 0),sd(ZT(t),"_roomProfile",Dd.communication),sd(ZT(t),"_context",void 0),sd(ZT(t),"_subStreamQueue",{}),t.id=null==e?void 0:e.id,t.monitor=r,t._pubSubLock=new nF("pubSubLock"),t._joinLeaveLock=new nF("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 qd(b,[{key:"_addHandlerEvents",value:function(){var e,t=this;null===(e=this._handler)||void 0===e||e.once("disconnect",(function(){hF.print("emit ABNORMAL_DISCONNECTION ice"),t.safeEmit(FP.ABNORMAL_DISCONNECTION)}))}},{key:"_addSignalEventHandler",value:function(){var e,t=this;[UP.ON_ADD_STREAM,UP.ON_ADD_STREAM_LIST,UP.ON_REMOVE_STREAM,UP.ON_REMOVE_STREAM_LIST,UP.USER_CONNECTION,UP.USER_CONNECTION_LIST,UP.USER_DISCONNECTION,UP.USER_DISCONNECTION_LIST,UP.ON_UPDATE_STREAM_ATTRIBUTES,UP.ON_UPDATE_ROOM_ATTRIBUTES,UP.ON_PUSH_TRACK,UP.NODE_CHANGE,UP.ON_CUSTOM_MESSAGE,UP.USER_MESSAGE_RECEIVED,UP.USER_BINARY_MESSAGE_RECEIVED,UP.POST_PROCESSING_MESSAGE,UP.ON_USER_TOKEN_WILL_EXPIRE,UP.STREAM_CONTROL_MESSAGE,UP.ON_UPDATE_USER_ATTRIBUTES,UP.ON_SPEAKER_CHANGE,VP.RSCP,VP.RTT,UP.ON_STREAM_FAILED].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(){hF.print("emit ABNORMAL_DISCONNECTION datachannel"),t.safeEmit(FP.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(FP.ON_CONNECTION_STATE_CHANGE,{prev:this._state,next:e}),this._state=e)}},{key:"businessId",set:function(e){this._businessId=e}},{key:"connect",value:(S=km(Em().mark((function e(t){var r,n,i,o,a,s,c,u,d=this,l=arguments;return Em().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],pP("es.join.nodeChange",i),e.next=20;break;case 11:return X_.resolve().then((function(){return d.emit("onGetIceConfigHook")})),this._iceConfigRequestManager=new vN,e.next=15,null===(a=this._iceConfigRequestManager)||void 0===a?void 0:a.getAccessNode(t,r,n,bP.getDeviceId(),null==i?void 0:i.reason,null==i?void 0:i.feedbackNode,this._useCloudProxy,this._expectedIDC);case 15:if(o=e.sent){e.next=19;break}throw pP("es.join.getNodeFailed",""),new lR(uR.ICE_SERVER_WRONG,"get ICE config failed");case 19:pP("es.join.getNodeSuccess",o);case 20:return X_.resolve().then((function(){return d.emit("onEstablishConnectionHook")})),e.prev=21,c=!1,u=lk(o).call(o,(function(e){var t=eF(d.monitor,d._context);return t.connect(e).then((function(r){var n;d.emit("onConnectSuccessHook",null===(n=o)||void 0===n?void 0:n.length),c?t.destroy():(c=!0,s=r,d.safeEmit("prevIceNode",e),d._handler=t,sP.setStats({connection_id:t.connection_id}),d.supportConcurrent="chrome"===t.name,d._addHandlerEvents())})).catch((function(e){throw t.destroy(),e}))})),e.next=26,Ow(u);case 26:hF.print("join","establish peerConnection success"),e.next=33;break;case 29:throw e.prev=29,e.t0=e.catch(21),this.connectionState="disconnected",new lR(uR.ESTABLISH_DATACHANNEL_FAILED,"establish dataChannel failed",e.t0);case 33:if(!s){e.next=39;break}this._dataChannelSignal=new hN(this.id,s),this._addSignalEventHandler(),this._dataChannelSignal.sendPingSignaling(),e.next=41;break;case 39:throw this.connectionState="disconnected",new lR(uR.ESTABLISH_DATACHANNEL_FAILED,"establish dataChannel failed");case 41:case"end":return e.stop()}}),e,this,[[21,29]])}))),function(e){return S.apply(this,arguments)})},{key:"join",value:(y=km(Em().mark((function e(t){var r,n,i,o,a,s,c,u,d,l,h,f,p,v,_,m=this,g=arguments;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=g.length>1&&void 0!==g[1]?g[1]:{},i=g.length>2&&void 0!==g[2]&&g[2],o=g.length>3?g[3]:void 0,hF.print("join()","info: %o, params: %o, reconnect: %o, controlMessage: %o",t,n,i,o),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._expectedIDC=t.expectedIDC,this._roomProfile=t.roomProfile,this._sessionId=n.sessionId,e.next=16,this.connect(this._appId,this._roomId,this._clientId,n);case 16:return e.t0=dw.token2auth(this._appId,this._roomId,this._clientId,this._token),e.t1=this._sessionId||"",e.t2=Date.now(),e.t3=o,e.t4={extra_info:this._userInfo.extraInfo,role:this._userInfo.role},e.next=23,null===(r=this._handler)||void 0===r?void 0:r.getDefaultSdp();case 23:return e.t5=e.sent,e.next=26,oL();case 26:return e.t6=e.sent,e.t7=window.navigator.userAgent,e.t8=RP.VERSION,e.t9=bP.getDeviceId(),e.t10=this._appId,e.t11=this._roomId,e.t12=this._clientId,e.t13=this._businessId,e.t14=this._useCloudProxy,e.t15=cF[this._roomProfile]?cF[this._roomProfile][0]+"":"0",e.t16={supportedCodecs:e.t6,deviceType:"web",userAgent:e.t7,sdkVersion:e.t8,deviceId:e.t9,appId:e.t10,roomId:e.t11,userId:e.t12,businessId:e.t13,enableCloudProxy:e.t14,channelProfile:e.t15},e.t17={supportTokenExpireCallBack:!0,enableSceneConfigV2:!0,enableUnBundleMode:!0,enableAudioMux:!0,enableBigRoomMode:!0,needNegotiateSDP:!0},a={Authorization:e.t0,sessionId:e.t1,timestamp:e.t2,controlMessage:e.t3,userAttributes:e.t4,sdpInfo:e.t5,params:e.t16,options:e.t17},X_.resolve().then((function(){return m.emit("onSendingJoinMessageHook")})),e.prev=40,c=i?"reconnected":"joinRoom",e.next=44,this._dataChannelSignal.sendSignaling(c,a);case 44:return u=e.sent,hF.print("join","send join message success"),d=u.config||{},l=d.engine_WEB,this._authorization=a.Authorization,this.connectionState="connected",bP.setEngineWebConfig(this._appId,this._roomId,l),this._context&&(this._context.serverConfig={videoCodec:(null==l?void 0:l.video_codec)||"H264",audioRed:!(null==l||!l.pub_audio_red),muteReplaceUnsub:!(null===(h=u.config)||void 0===h||!h.mute_replace_unsub),simulcastOnDemand:!(fw||!1===(null===(f=u.config)||void 0===f||null===(p=f.engine_VPM)||void 0===p||null===(v=p.ondemand)||void 0===v?void 0:v.enable))},"boolean"==typeof(null==l?void 0:l.av_sync)&&(this._context.avSync=l.av_sync)),MV.audioStallConfig=l,null!=u&&null!==(s=u.relayMessage)&&void 0!==s&&s.sdp&&(null===(_=this._handler)||void 0===_||_.createAVMlineAnswerTpl(u.relayMessage.sdp)),e.abrupt("return",u);case 56:if(e.prev=56,e.t18=e.catch(40),this.connectionState="disconnected",!((null===e.t18||void 0===e.t18?void 0:e.t18.code)>=700&&(null===e.t18||void 0===e.t18?void 0:e.t18.code)<800)){e.next=61;break}throw new lR(uR.INVALID_TOKEN,(null===e.t18||void 0===e.t18?void 0:e.t18.message)||"Invalid token");case 61:if(200===(null===e.t18||void 0===e.t18?void 0:e.t18.code)){e.next=63;break}throw new lR(uR.JOIN_ROOM_FAILED,(null===e.t18||void 0===e.t18?void 0:e.t18.message)||"Join room failed");case 63:case"end":return e.stop()}}),e,this,[[40,56]])}))),function(e){return y.apply(this,arguments)})},{key:"publish",value:(g=km(Em().mark((function e(t){var r,n,i,o,a,s,c,u,d,l,h,f,p,v,_,m,g,y,S,E,b=this;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return hF.print("publish()","localStream: %o",t),r=t.videoTrack,n=t.audioTrack,i=sw(),o="",a="",e.prev=6,e.next=9,null===(s=this._handler)||void 0===s?void 0:s.publish(t);case 9:if(_=e.sent){e.next=12;break}throw new lR(uR.ADD_TRANSCEIVER_FAILED,"add transceiver failed");case 12:if("H264"!==(null===(c=this._context)||void 0===c||null===(u=c.serverConfig)||void 0===u?void 0:u.videoCodec)){e.next=18;break}return e.next=15,hL();case 15:if(e.sent){e.next=18;break}throw new lR(uR.PUBLISH_FAILED,"h264 is not supported");case 18:return o=_.audioMid,a=_.videoMid,t.pubAttributes={localaudio:!!n,localvideo:!!r,videostream:t.pubVideo,audiostream:t.pubAudio,extvideo:!!(r instanceof JU),extaudio:!!(n instanceof ZU)},m={attributes:ud({videoDescriptions:_.videoDescriptions},t.pubAttributes),audio:!0,video:!0,screen:t.isScreen,audioMid:o,videoMid:a,sdpInfo:{msid:t.stream.id,type:_.type,sdp:_.partialSdp,semantics:_.semantics}},(g=t.enableSimulcast&&(null===(d=this._context)||void 0===d||null===(l=d.serverConfig)||void 0===l?void 0:l.simulcastOnDemand)&&(null===(h=_.subVideoDescriptions)||void 0===h?void 0:h.length))&&(m.attributes.subVideoDescriptions=_.subVideoDescriptions),e.next=26,null===(f=this._dataChannelSignal)||void 0===f?void 0:f.sendSignaling("publish",m);case 26:if(200===(null==(y=e.sent)?void 0:y.code)){e.next=29;break}throw new lR(uR.PUBLISH_FAILED,(null==y?void 0:y.message)||"publish failed");case 29:if(iP.rtcRecvAnswer(0,LD.INCRANSWER,(null==y||null===(p=y.relayMessage)||void 0===p?void 0:p.sequenceId)||0,null==y||null===(v=y.relayMessage)||void 0===v?void 0:v.sdp,UD.UP,"",""),S=new X_((function(e,r){var n,i,s;null===(n=b._handler)||void 0===n||n.handleAck({action:KV.publish,streamId:y.streamId,audioMid:o,videoMid:a,audioTransceiverInit:null==_?void 0:_.audioTransceiverInit,videoTransceiverInit:null==_?void 0:_.videoTransceiverInit,signalingAck:{sdp:null==y||null===(i=y.relayMessage)||void 0===i?void 0:i.sdp,sequenceId:null==y||null===(s=y.relayMessage)||void 0===s?void 0:s.sequenceId},sdp:_.sdp,stream:t,onSuccess:function(){hF.print("publish()","publish success"),e(0)}})})),e.t0=!fw,!e.t0){e.next=35;break}return e.next=35,S;case 35:return g&&this.emit(VP.RSCP,[{StreamIds:[t.stream.id],Metadata:{VideoIndex:0}}]),t.streamId=y.streamId,t.videoMid=a,t.audioMid=o,t.subVideoDescriptions=_.subVideoDescriptions,this.monitor.rtcPublishStat(VD.SUCCESS,FD.W_0,i,BD.UNKNOWN),t.statsReport.setLocalStreamStatsEvtInterval(this,this._handler,this.monitor,this._context),e.abrupt("return");case 45:return e.prev=45,e.t1=e.catch(6),e.t1 instanceof Error&&this.monitor.rtcPublishStat(VD.FAIL,FD.W_0,i,e.t1.message),e.next=50,null===(E=this._handler)||void 0===E?void 0:E.rollback(t.stream.id,t);case 50:throw e.t1;case 51:case"end":return e.stop()}}),e,this,[[6,45]])}))),function(e){return g.apply(this,arguments)})},{key:"updatePubTrack",value:(m=km(Em().mark((function e(t){var r,n,i,o,a,s,c,u,d,l,h,f,p,v,_,m,g,y,S,E,b,k,T,I,A,R,w,C,O,x,D;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:hF.print("updatePubTrack()","localStream: %o",t),i=t.videoTrack,o=t.audioTrack,a=t.pubAudio,s=t.pubVideo,c=null==o?void 0:o.getTrack("preprocessing"),u=null==i?void 0:i.getTrack("preprocessing"),s&&u?null===(d=t.videoTransceiver)||void 0===d||d.sender.replaceTrack(u):null===(l=t.videoTransceiver)||void 0===l||l.sender.replaceTrack(null),null===(r=this._handler)||void 0===r||r.updateMaxBitrate(t),a&&c?(f=o.mixType,(p=o.mixedAudioTrack)&&f!==Gd.PLAYOUT&&!0===c.enabled&&(c=p),null===(h=t.audioTransceiver)||void 0===h||h.sender.replaceTrack(c)):(null===(v=t.audioTransceiver)||void 0===v||v.sender.replaceTrack(null),this.monitor.rtcInvokeStatus("null",0,"MediaClient.updatePubTrack(audio)","",0));try{this.monitor.rtcInvokeStatus(vk({audioStreamTrack:Lw(c),videoStreamTrack:Lw(u)}),0,"MediaClient.updatePubTrack","",0)}catch(mW){}for(m={},g=0,y=SR(_={localaudio:!!o,localvideo:!!i,videostream:s,audiostream:a,extvideo:!!(i instanceof JU),extaudio:!!(o instanceof ZU)});g<y.length;g++)S=JT(y[g],2),E=S[0],(b=S[1])!==sI(t.pubAttributes,E)&&FC(m,E,b);if(an(m).length){e.next=13;break}return e.abrupt("return");case 13:return t.observer&&(k=t.observer,T=m.audiostream,I=m.videostream,A=m.localaudio,R=m.localvideo,w=m.extaudio,C=m.extvideo,void 0!==R?void 0!==C?k.setPushVideo(C):k.setEnableVideo(R):void 0!==I&&k.setUnmuteVideo(I),void 0!==A?void 0!==w?k.setPushAudio(w):k.setEnableAudio(A):void 0!==T&&k.setUnmuteAudio(T)),t.pubAttributes=_,O={roomId:this._roomId,streamId:t.streamId,attributes:m},e.next=18,null===(n=this._dataChannelSignal)||void 0===n?void 0:n.sendSignaling("updateStreamAttributes",O);case 18:if(200===(null==(x=e.sent)?void 0:x.code)){e.next=21;break}throw new lR(uR.UPDATE_TRACK_FAILED,(null==x?void 0:x.message)||"update track failed");case 21:if(!fw){e.next=24;break}return e.next=24,null===(D=this._handler)||void 0===D?void 0:D.setCurrentDescription();case 24:case"end":return e.stop()}}),e,this)}))),function(e){return m.apply(this,arguments)})},{key:"updateToken",value:(_=km(Em().mark((function e(t){var r,n,i,o,a;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(hF.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 lR(uR.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 lR(uR.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 _.apply(this,arguments)})},{key:"unpublish",value:(v=km(Em().mark((function e(t){var r,n,i;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return hF.print("unpublish()","localStream: %o",t),i={roomId:this._roomId,initStreamId:t.initStreamId,streamId:t.streamId},null===(r=this._dataChannelSignal)||void 0===r||r.sendSignaling("unpublish",i),e.next=5,null===(n=this._handler)||void 0===n?void 0:n.handleAck({action:KV.unpublish,audioMid:t.audioMid,videoMid:t.videoMid,stream:t,streamId:t.streamId});case 5:t.statsReport.unpublish();case 6:case"end":return e.stop()}}),e,this)}))),function(e){return v.apply(this,arguments)})},{key:"subscribe",value:(p=km(Em().mark((function e(t,r,n){var i=this;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",new X_(function(){var e=km(Em().mark((function e(o,a){var s,c,u,d,l,h,f,p,v,_,m,g,y,S,E,b,k,T,I,A,R,w,C,O,x,D,P,N,M,L;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t.streamState!==BV.SUB_ED){e.next=2;break}return e.abrupt("return",i._updateSubTrack(t,r,sF.SUB).then(o,a));case 2:if(t.streamState!==BV.SUB_ING){e.next=7;break}return i._subStreamQueue[t.streamId]||(i._subStreamQueue[t.streamId]=[]),hF.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(hF.print("subscribe()","mediaType: %o",r),vF("subscribe()",t),t.streamState=BV.SUB_ING,c=!1,u=!1,Dw(r)&&(u=!0),Pw(r)&&(c=!0),c||!i.multiChatMode()){e.next=17;break}return t.streamState=BV.INIT,i.emit("SUB_END",t.streamId),e.abrupt("return",o(null));case 17:return d=sw(),l=t.subVideo,h=[],f=!i.multiChatMode(),i._subResolves[t.streamId]||(i._subResolves[t.streamId]=[]),h.push(new X_((function(e,r){i._subResolves[t.streamId].push(e);var n=setTimeout((function(){return r(new lR(uR.TIME_OUT,"wait video timeout for userId: ".concat(t.userId)))}),fF);t.on("ontrack",(function r(i){"video"===i.mediaType&&(hF.print("remoteStream ".concat(t.userId," received video track")),t.off("ontrack",r),clearTimeout(n),e(0))}))}))),f&&h.push(new X_((function(e,r){i._subResolves[t.streamId].push(e);var n=setTimeout((function(){return r(new lR(uR.TIME_OUT,"wait audio timeout for userId: ".concat(t.userId)))}),fF);t.on("ontrack",(function r(i){"audio"===i.mediaType&&(hF.print("remoteStream ".concat(t.userId," received audio track")),t.off("ontrack",r),clearTimeout(n),e(0))}))}))),p=function(e){t.ontrack(e)},null===(s=i._handler)||void 0===s||s.on("ontrack",p),i._ontrackCallbackMap.set(t,p),e.prev=27,e.next=30,null===(v=i._handler)||void 0===v?void 0:v.subscribe(t,{multiChatMode:i.multiChatMode()});case 30:if(k=e.sent){e.next=33;break}throw new lR(uR.ADD_TRANSCEIVER_FAILED,"add transceiver failed");case 33:return T=k.audioMid,I=k.videoMid,t.subVideo=c,A={spatialLayer:(null==n?void 0:n.spatialLayer)||0,temporalLayer:0,spatialSubLayer:(null==n?void 0:n.spatialSubLayer)||-1},R={audio:!i.multiChatMode(),video:!0,data:!0,screen:t.isScreen,browser:"chrome-stable",videoMid:I,audioMid:T,sdpInfo:{sdp:null==k?void 0:k.partialSdp,semantics:null==k?void 0:k.semantics,type:null==k?void 0:k.type},streamUserId:t.userId,streamId:t.streamId,config:{enableMediaType:{audio:!!i.multiChatMode()||u,video:c},qualityLayer:A},extra:{enableSendRTT:!0}},w=i._context||{},C=w.subscribeFallbackOption,O=w.userPriority,"number"==typeof C&&(R.config.fallbackOption=C),null!=O&&O.has(t.userId)&&(R.config.priority=O.get(t.userId)),null!=k&&k.allSsrc&&(R.extra.subscribeSSRC=k.allSsrc),e.next=44,null===(_=i._dataChannelSignal)||void 0===_?void 0:_.sendSignaling("subscribe",R);case 44:if(200===(null==(x=e.sent)?void 0:x.code)){e.next=47;break}throw new lR(uR.SUBSCRIBE_FAILED,(null==x?void 0:x.message)||"subscribe failed");case 47:return D=null==x?void 0:x.relayMessage,P=D.audioMid,N=D.videoMid,sd(m={},T,P),sd(m,I,N),M=m,hF.print("sub midmap",t.userId,M),t.videoMid=I,t.audioMid=T,t.subMediaType=r,t.streamState=BV.SUB_ED,t.subLayer=A,iP.rtcRecvAnswer(0,LD.INCRANSWER,(null==x||null===(g=x.relayMessage)||void 0===g?void 0:g.sequenceId)||0,null==x||null===(y=x.relayMessage)||void 0===y?void 0:y.sdp,UD.DOWN,t.streamId,t.userId),e.next=58,null===(S=i._handler)||void 0===S?void 0:S.handleAck({action:KV.subscribe,streamId:t.streamId,audioMid:T,videoMid:I,audioTransceiverInit:null==k?void 0:k.audioTransceiverInit,videoTransceiverInit:null==k?void 0:k.videoTransceiverInit,signalingAck:{sdp:null==x||null===(E=x.relayMessage)||void 0===E?void 0:E.sdp,sequenceId:null==x||null===(b=x.relayMessage)||void 0===b?void 0:b.sequenceId},stream:t,sdp:k.sdp,generatorSsrc:!!k.allSsrc});case 58:return e.next=60,X_.all(h);case 60:i.multiChatMode()||(t.subAudio=u),i.monitor.rtcSubscribeStat(jD.SUCCESS,d,GD.UNKNOWN,t.userId),i._context&&t.statsReport.setRemoteStreamStatsEvtInterval(i,i._handler,i.monitor,i._context),o(null),i.emit("SUB_END",t.streamId),e.next=76;break;case 67:return e.prev=67,e.t0=e.catch(27),e.t0 instanceof Error&&i.monitor.rtcSubscribeStat(jD.FAIL,d,e.t0.message,t.userId),t.subVideo=l,t.streamState=BV.INIT,e.next=74,null===(L=i._handler)||void 0===L?void 0:L.rollback(t.streamId,t);case 74:a(e.t0),i.emit("SUB_END",t.streamId);case 76:case"end":return e.stop()}}),e,null,[[27,67]])})));return function(t,r){return e.apply(this,arguments)}}()));case 1:case"end":return e.stop()}}),e)}))),function(e,t,r){return p.apply(this,arguments)})},{key:"_handleSubStreamQueue",value:function(e){var t,r=this;if(null!==(t=this._subStreamQueue[e])&&void 0!==t&&t.length){hF.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 hF.print("_subStreamQueue","streamId: %o, END",e)}},{key:"controlMessage",value:(f=km(Em().mark((function e(t){var r,n;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return hF.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 f.apply(this,arguments)})},{key:"updateUserAttributes",value:(h=km(Em().mark((function e(t){var r;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return hF.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 h.apply(this,arguments)})},{key:"updateSubTrack",value:(l=km(Em().mark((function e(t,r,n){return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this._updateSubTrack(t,r,n));case 1:case"end":return e.stop()}}),e,this)}))),function(e,t,r){return l.apply(this,arguments)})},{key:"updateSubTrackLayer",value:(d=km(Em().mark((function e(t,r){var n,i,o;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(hF.print("updateSubTrack()","subLayer: %o",r),t.subLayer.spatialLayer!==r.spatialLayer||t.subLayer.spatialSubLayer!==r.spatialSubLayer){e.next=4;break}return hF.print("updateSubTrack()","subLayer no change"),e.abrupt("return");case 4:return i={roomId:this._roomId,streamList:[t.streamId],streamId:t.streamId,streamUserId:t.userId,config:{qualityLayer:r}},e.next=7,null===(n=this._dataChannelSignal)||void 0===n?void 0:n.sendSignaling("updateSubscribe",i);case 7:if(200===(null==(o=e.sent)?void 0:o.code)){e.next=10;break}throw new lR(uR.UPDATE_TRACK_FAILED,(null==o?void 0:o.message)||"update track failed");case 10:return t.subLayer=r,e.abrupt("return",t);case 12:case"end":return e.stop()}}),e,this)}))),function(e,t){return d.apply(this,arguments)})},{key:"_updateSubTrack",value:(u=km(Em().mark((function e(t,r,n){var i,o,a,s,c,u,d,l,h,f,p;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(hF.print("updateSubTrack()","mediaType: %o",r),vF("updateSubTrack()",t),!this.multiChatMode()||r!==Sd.AUDIO){e.next=5;break}return hF.print("updateSubTrack","multiChatMode mediaType only audio"),e.abrupt("return",t);case 5:return a=0,a=n===sF.SUB?t.subMediaType|r:t.subMediaType-(t.subMediaType&r),hF.print("updateSubTrack","prev: %o, direction: %o, mediaType: %o, newMediaType: %o",t.subMediaType,n,r,a),t.subMediaType===a&&hF.print("updateSubTrack","mediaType no change"),s=!1,c=!1,Dw(a)&&(c=!0),Pw(a)&&(s=!0),u={roomId:this._roomId,streamList:[t.streamId],config:{enableMediaType:{video:s,audio:!!this.multiChatMode()||c}}},d=this._context||{},l=d.subscribeFallbackOption,h=d.userPriority,"number"==typeof l&&(u.config.fallbackOption=l),null!=h&&h.has(t.userId)&&(u.config.priority=h.get(t.userId)),e.next=18,null===(i=this._dataChannelSignal)||void 0===i?void 0:i.sendSignaling("updateSubscribe",u);case 18:if(200===(null==(f=e.sent)?void 0:f.code)){e.next=21;break}throw new lR(uR.UPDATE_TRACK_FAILED,(null==f?void 0:f.message)||"update track failed");case 21:return this.multiChatMode()||(null===(p=t.observer)||void 0===p||p.setUnmuteAudio(c),t.subAudio=c),null===(o=t.observer)||void 0===o||o.setUnmuteVideo(s),t.subVideo=s,t.subMediaType=a,e.abrupt("return",t);case 26:case"end":return e.stop()}}),e,this)}))),function(e,t,r){return u.apply(this,arguments)})},{key:"subscribe4pushTrack",value:(c=km(Em().mark((function e(t,r){var n,i,o,a,s,c,u,d,l;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return hF.print("subscribe4pushTrack()","streamInfo: %o",r),vF("subscribe4pushTrack()",t),t.subAudio=!0,null===(n=t.observer)||void 0===n||n.setPushTrack(!0),e.next=6,null===(i=this._handler)||void 0===i?void 0:i.subscribe(t,{multiChatMode:this.multiChatMode()});case 6:if(s=e.sent){e.next=9;break}throw new lR(uR.ADD_TRANSCEIVER_FAILED,"add transceiver failed");case 9:return c=s.audioMid,u=s.videoMid,(d=[]).push(new X_((function(e,r){var n=setTimeout((function(){return r(new lR(uR.TIME_OUT,"wait audio timeout for userId: ".concat(t.userId)))}),fF);t.on("ontrack",(function r(i){"audio"===i.mediaType&&(hF.print("remoteStream ".concat(t.userId," received audio track")),t.off("ontrack",r),clearTimeout(n),e(0))}))}))),l=function(e){t.ontrack(e)},null===(o=this._handler)||void 0===o||o.on("ontrack",l),this._ontrackCallbackMap.set(t,l),e.next=18,null===(a=this._handler)||void 0===a?void 0:a.handleAck({action:KV.pushtrack,streamId:t.streamId,audioMid:c,videoMid:u,stream:t,audioTransceiverInit:null==s?void 0:s.audioTransceiverInit,videoTransceiverInit:null==s?void 0:s.videoTransceiverInit,signalingAck:null==r?void 0:r.message,sdp:s.sdp});case 18:return e.next=20,X_.all(d);case 20:this._context&&t.statsReport.setRemoteStreamStatsEvtInterval(this,this._handler,this.monitor,this._context);case 21:case"end":return e.stop()}}),e,this)}))),function(e,t){return c.apply(this,arguments)})},{key:"unsubscribe4removeTrack",value:(s=km(Em().mark((function e(t,r){return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:vF("unsubscribe4removeTrack()",t),hF.print("unsubscribe4removeTrack()","sequenceId: ",r.sequenceId);case 2:case"end":return e.stop()}}),e)}))),function(e,t){return s.apply(this,arguments)})},{key:"unsubscribe",value:(a=km(Em().mark((function e(t,r){var n,i,o=arguments;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=o.length>2&&void 0!==o[2]&&o[2],vF("unsubscribe()",t),!n){e.next=4;break}return e.abrupt("return",this._unsubscribe(t,r));case 4:if(!this.multiChatMode()||!Pw(r)){e.next=6;break}return e.abrupt("return",this._unsubscribe(t,r));case 6:if(i=t.subMediaType-(t.subMediaType&r),this.multiChatMode()||i!==kV.NONE){e.next=9;break}return e.abrupt("return",this._unsubscribe(t,r));case 9:return e.abrupt("return",this._updateSubTrack(t,r,sF.UNSUB));case 10:case"end":return e.stop()}}),e,this)}))),function(e,t){return a.apply(this,arguments)})},{key:"_unsubscribe",value:(o=km(Em().mark((function e(t,r){var n,i,o,a,s,c;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t.hasSubscribed){e.next=2;break}return e.abrupt("return");case 2:if(!this._subConfig.muteReplaceUnsub){e.next=4;break}return e.abrupt("return",this._updateSubTrack(t,r,sF.UNSUB));case 4:return s={roomId:this._roomId,streamId:t.streamId,userId:t.userId},null===(n=this._dataChannelSignal)||void 0===n||n.sendSignaling("unsubscribe",s).catch((function(){})),t.streamState=BV.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,null===(i=t.observer)||void 0===i||i.setSubscribeVideo(!1),!this.multiChatMode()&&(null===(o=t.observer)||void 0===o||o.setSubscribeAudio(!1)),e.next=13,null===(a=this._handler)||void 0===a?void 0:a.handleAck({action:KV.unsubscribe,streamId:t.streamId,audioMid:t.audioMid,videoMid:t.videoMid,stream:t});case 13:c=e.sent,this._subResolves[c]&&this._subResolves[c].forEach((function(e){return e(0)})),hF.print("unsubscribe","clean unsub ".concat(t.userId)),t.clean(),this.removeOnTrackListener(t),t.statsReport.unsubscribe();case 19:case"end":return e.stop()}}),e,this)}))),function(e,t){return o.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:(i=km(Em().mark((function e(t,r){return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(vF("handleRemoveStream()",t),t.subVideo=!1,t.hasSubscribed){e.next=4;break}return e.abrupt("return");case 4:this.unsubscribe(t,Sd.AUDIO_AND_VIDEO,!0);case 5:case"end":return e.stop()}}),e,this)}))),function(e,t){return i.apply(this,arguments)})},{key:"leave",value:(n=km(Em().mark((function e(){var t,r,n;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(hF.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",X_.reject(new lR(uR.NOT_CONNECTED_YET,"server not connected")));case 23:case"end":return e.stop()}}),e,this,[[7,13,17,20]])}))),function(){return n.apply(this,arguments)})},{key:"subscribePublicStream",value:(r=km(Em().mark((function e(t){var r,n,i,o,a,s,c,u,d,l,h,f,p,v,_,m=this;return Em().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,{multiChatMode:!1});case 2:if(a=e.sent){e.next=5;break}throw new lR(uR.ADD_TRANSCEIVER_FAILED,"add transceiver failed");case 5:return s=sw(),c=a.audioMid,u=a.videoMid,e.t0=this._appId,e.t1=t.streamId,e.t2=c,e.t3=u,e.t4={sdp:null==a?void 0:a.partialSdp,semantics:null==a?void 0:a.semantics,type:null==a?void 0:a.type},e.next=15,oL();case 15:return e.t5=e.sent,e.t6=window.navigator.userAgent,e.t7=RP.VERSION,e.t8=bP.getDeviceId(),e.t9=this._appId,e.t10=this._businessId,e.t11=this._useCloudProxy,e.t12={supportedCodecs:e.t5,deviceType:"web",userAgent:e.t6,sdkVersion:e.t7,deviceId:e.t8,appId:e.t9,businessId:e.t10,enableCloudProxy:e.t11},e.t13={enableMediaType:{audio:!0,video:!0},qualityLayer:{spatialLayer:0,temporalLayer:0}},d={appId:e.t0,streamId:e.t1,audio:!0,video:!0,data:!0,audioMid:e.t2,videoMid:e.t3,sdpInfo:e.t4,params:e.t12,config:e.t13},e.next=27,null===(n=this._dataChannelSignal)||void 0===n?void 0:n.sendSignaling("startPullStream",d);case 27:return l=e.sent,h=[],this._subResolves[t.streamId]=[],h.push(new X_((function(e,r){m._subResolves[t.streamId].push(e);var n=setTimeout((function(){return r(new lR(uR.TIME_OUT,"wait video timeout for streamId: ".concat(t.streamId)))}),fF);t.on("ontrack",(function r(i){"video"===i.mediaType&&(hF.print("remoteStream ".concat(t.userId," received video track")),t.off("ontrack",r),clearTimeout(n),e(0))}))}))),h.push(new X_((function(e,r){m._subResolves[t.streamId].push(e);var n=setTimeout((function(){return r(new lR(uR.TIME_OUT,"wait audio timeout for streamId: ".concat(t.streamId)))}),fF);t.on("ontrack",(function r(i){"audio"===i.mediaType&&(hF.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,v=p.sequenceId,_=p.sdp,t.videoMid=u,t.audioMid=c,t.sequenceId=v,t.streamState=BV.SUB_ED,t.subAudio=!0,t.subVideo=!0,e.next=44,null===(o=this._handler)||void 0===o?void 0:o.handleAck({action:KV.subscribe,streamId:t.streamId,audioMid:c,videoMid:u,audioTransceiverInit:null==a?void 0:a.audioTransceiverInit,videoTransceiverInit:null==a?void 0:a.videoTransceiverInit,signalingAck:{sdp:_,sequenceId:v},stream:t});case 44:return e.next=46,X_.all(h);case 46:this.monitor.rtcSubscribeStat(jD.SUCCESS,s,GD.UNKNOWN,t.userId),this._context&&t.statsReport.setRemoteStreamStatsEvtInterval(this,this._handler,this.monitor,this._context);case 48:case"end":return e.stop()}}),e,this)}))),function(e){return r.apply(this,arguments)})},{key:"unsubscribePublicStream",value:(t=km(Em().mark((function e(t){var r,n,i;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return vF("unsubscribePublicStream()",t),n={appId:this._appId,streamId:t.streamId},e.prev=2,e.next=5,null===(i=this._dataChannelSignal)||void 0===i?void 0:i.sendSignaling("stopPullStream",n);case 5:e.next=9;break;case 7:e.prev=7,e.t0=e.catch(2);case 9:return t.streamState=BV.INIT,t.subVideo=!1,t.subAudio=!1,e.next=14,null===(r=this._handler)||void 0===r?void 0:r.handleAck({action:KV.unsubscribe,streamId:t.streamId,audioMid:t.audioMid,videoMid:t.videoMid,stream:t});case 14: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;hF.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}}]),b}(OC);function mF(e,t,r){var n=r.value;return r.value=km(Em().mark((function e(){var r,i,o,a=arguments;return Em().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 lR(uR.NOT_CONNECTED_YET,"error in ".concat(t,": try again after joined"));case 7:case"end":return e.stop()}}),e,this)}))),r}function gF(e,t,r){var n=r.value;return r.value=km(Em().mark((function e(){var t,r,i,o,a=arguments;return Em().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}lF([function(e,t,r){var n=r.value;return r.value=km(Em().mark((function e(){var t,r,i,o,a=this,s=arguments;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:for(t=s.length,r=new Array(t),i=0;i<t;i++)r[i]=s[i];return o=!1,e.abrupt("return",new X_(function(){var e=km(Em().mark((function e(t,i){var s;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return a.on("INTERRUPT",(function(){o=!0,i(new lR(uR.OPERATION_CANCEL,"operation not finish when leave"))})),e.prev=1,e.next=4,n.apply(a,r);case 4:s=e.sent,t(s),e.next=11;break;case 8:e.prev=8,e.t0=e.catch(1),o||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}],_F.prototype,"join",1),lF([gF,mF],_F.prototype,"publish",1),lF([gF,mF],_F.prototype,"updatePubTrack",1),lF([gF,mF],_F.prototype,"unpublish",1),lF([gF,mF],_F.prototype,"subscribe",1),lF([mF],_F.prototype,"controlMessage",1),lF([mF],_F.prototype,"updateUserAttributes",1),lF([mF],_F.prototype,"updateSubTrack",1),lF([mF],_F.prototype,"updateSubTrackLayer",1),lF([gF,mF],_F.prototype,"subscribe4pushTrack",1),lF([gF,mF],_F.prototype,"unsubscribe4removeTrack",1),lF([gF,mF],_F.prototype,"unsubscribe",1),lF([mF],_F.prototype,"handleRemoveStream",1),lF([gF],_F.prototype,"subscribePublicStream",1),lF([gF],_F.prototype,"unsubscribePublicStream",1);var yF=_E.right,SF=pe,EF=sf;Rr({target:"Array",proto:!0,forced:!Iu("reduceRight")||!EF&&SF>79&&SF<83},{reduceRight:function(e){return yF(this,e,arguments.length,arguments.length>1?arguments[1]:void 0)}});var bF=Us("Array").reduceRight,kF=ae,TF=bF,IF=Array.prototype,AF=function(e){var t=e.reduceRight;return e===IF||kF(IF,e)&&t===IF.reduceRight?TF:t},RF={};ad(RF,"__esModule",{value:!0});var wF=function(){return(wF=FE||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var i in t=arguments[r])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)};function CF(e,t){var r="function"==typeof _l&&Ok(e);if(!r)return e;var n,i,o=r.call(e),a=[];try{for(;(void 0===t||0<t--)&&!(n=o.next()).done;)a.push(n.value)}catch(s){i={error:s}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return a}function OF(e){return"object"==Ml(e)&&null!==e}function xF(e){return"function"==typeof e}function DF(){if("object"==("undefined"==typeof window?"undefined":Ml(window))&&OF(window))return window}function PF(){if("object"==("undefined"==typeof document?"undefined":Ml(document))&&OF(document))return document}var NF=function(e){if(e)return e.__SLARDAR_REGISTRY__||(e.__SLARDAR_REGISTRY__={Slardar:{plugins:[],errors:[],subject:{}}}),e.__SLARDAR_REGISTRY__.Slardar},MF=function(e,t,r,n){void 0===t&&(t={}),void 0===n&&(n=[]);try{var i=e.apply(void 0,function(e,t,r){if(r||2===arguments.length)for(var n,i=0,o=t.length;i<o;i++)!n&&i in t||((n=n||Sm(Array.prototype).call(t,0,i))[i]=t[i]);return wm(e).call(e,n||Sm(Array.prototype).call(t))}([],CF(n),!1));return i&&i(t,r)||[]}catch(o){return function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=NF(DF());r&&(r.errors||(r.errors=[]),r.errors.push(e))}(o),[]}},LF=function(e){return e.requestIdleCallback||function(t){return e.setTimeout(t,1)}},UF=function(){return Date.now()};var VF=function(e,t){return OF(e)?wF(wF({},t),e):!!e&&t};var FF=["SCRIPT","STYLE","META","HEAD"],BF=["js_error","http","resource_error"],jF=["performance","performance_longtask","performance_timing","custom"],GF=function e(t,r,n,i,o){if(void 0===r&&(r=0),void 0===n&&(n=0),void 0===i&&(i=1.5),void 0===o&&(o=FF),!t||-1<Pb(o).call(o,t.tagName)||i<=n||4<r)return n;var a=function(){if(!r)return 0;var e=(n=t.getBoundingClientRect()).top,n=n.height;return e>innerHeight||n<=0?0:1/Math.pow(2,r-1)}();return AF([]).call(t.children,(function(t,n){return e(n,r+1,t,i,o)}),n+a)},HF=function(e,t,r,n){if(function(){if(DF()&&"Promise"in window)return X_}()&&r&&n){if(r.html2canvas)return o();var i=n.createElement("script");i.src=t,null!==(t=n.head)&&void 0!==t&&t.appendChild(i),i.onload=o}function o(){LF(r)((function(){r.html2canvas&&r.html2canvas(n.body,{scale:360/r.innerWidth}).then((function(t){e(t.toDataURL("image/jpeg",.1))}))}))}},zF=function(e,t,r,n,i){if(void 0===e&&(e=DF()),void 0===t&&(t=PF()),void 0===r&&(r=function(){if(DF()&&xF(window.PerformanceObserver))return window.PerformanceObserver}()),void 0===n&&(n=function(){if(DF()&&xF(window.MutationObserver))return window.MutationObserver}()),void 0===i&&(i=function(){if(DF()&&OF(window.performance))return window.performance}()),t&&e)return function(o,a){var s,c,u,d,l,h,f=o.threshold,p=o.screenshot,v=o.rootSelector,_=o.autoDetect,m=o.ssUrl,g=LF(e),y=CF(function(e){var t=e&&e.timing||void 0;return[t,function(){return e&&e.now?e.now():(Date.now?Date.now():+new Date)-(t&&t.navigationStart||0)},function(t){var r=(e||{}).getEntriesByType;return xF(r)&&r.call(e,t)||[]},function(){var t=(e||{}).clearResourceTimings;xF(t)&&t.call(e)},function(t){var r=(e||{}).getEntriesByName;return xF(r)&&r.call(e,t)||[]}]}(i),2)[1],S=0,E=!1,b=function(e){s&&a&&a({ev_type:"blank_screen",payload:{timestamp:s[0],score:s[1],screenshot:e,error:c}})},k=(d=function(){s&&!E&&(E=!0,I(),p?HF(b,m,e,t):b())},function(){l||(h=UF(),l=e.setTimeout((function(){l=0,h<S||d()}),y()>1e4?2e3:8e3))});function T(){u&&clearTimeout(u),u=e.setTimeout((function(){g((function(){e.requestAnimationFrame((function(){var e=v?t.querySelector(v):t.body;e&&((e=GF(e,0,0,f))<f?(s=[UF(),e],k()):s=void 0)}))}))}),1e3)}!function(e){var t=CF(function(e){var t=!1;return[function(r){t||(t=!0,e&&e(r))}]}(e),1)[0];["unload","beforeunload","pagehide"].forEach((function(e){addEventListener(e,t)}))}((function(){!E&&c&&b()}));var I=function(){clearTimeout(u),R&&R(),C&&C()},A=(o=CF(function(e,t){var r=e&&new e(t);return[function(e,t){r&&e&&r.observe(e,t)},function(){return r&&r.disconnect()}]}(n,T),2),o[0]),R=o[1],w=(o=CF(function(e,t,r,n){var i=e&&new e((function(e,i){e.getEntries?e.getEntries().forEach((function(e,r,n){return t(e,r,n,i)})):n&&n(),r&&i.disconnect()}));return[function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];if(!e||!i)return n&&n();try{t.forEach((function(t){var r;-1<Pb(r=e.supportedEntryTypes).call(r,t)&&i.observe({type:t,buffered:!1})}))}catch(o){try{i.observe({entryTypes:t})}catch(a){return n&&n()}}},function(){return i&&i.disconnect()}]}(r,(function(e,t,r){return u&&1<r.length&&T()})),2),o[0]),C=o[1];return _&&function(e){var t=DF(),r=PF();t&&r&&("loading"!==r.readyState?e():t.addEventListener("DOMContentLoaded",(function(){setTimeout((function(){e()}),0)}),!1))}((function(){var e;A(null===(e=PF())||void 0===e?void 0:e.body,{subtree:!0,childList:!0}),w("longtask","resource"),T()})),[I,function(e){E||function(e){return~Pb(jF).call(jF,e.ev_type)}(e)||(S=UF(),c&&S-c.timestamp>1e4&&(c=void 0),c=function(e,t){if(-1===Pb(BF).call(BF,t.ev_type))return e;if("http"===t.ev_type&&t.payload.response.status<400)return e;if(e&&Pb(BF).call(BF,e.type)<Pb(BF).call(BF,t.ev_type))return e;var r="";switch(t.ev_type){case"js_error":r=t.payload.error.message;break;case"http":r=t.payload.request.url;break;case"resource_error":r=t.payload.url}return{type:t.ev_type,message:r,timestamp:UF()}}(c,e))},T]}},KF="blankScreen";function XF(e,t,r){e.on("init",(function(){var n,i,o,a=function(e,t,r){return t=null===(e=e.config())||void 0===e?void 0:e.plugins[t],VF(t,r)}(e,KF,t)||VF(r,t);a&&(a=CF(MF(zF,a,e.report.bind(e)),3),n=a[0],i=a[1],a=a[2],e.on("report",o=function(e){return i(e),e}),e.on("beforeDestroy",(function(){n(),e.off("report",o)})),e.provide("detectBlankScreen",a))}))}var qF={autoDetect:!0,threshold:1.5,screenshot:!0,ssUrl:"https://apm.volccdn.com/mars-web/apmplus/web/html2canvas.min.js"};var WF=RF.blankScreenPlugin=function(e){return{name:KF,setup:function(t){!function(e,t){XF(e,qF,t)}(t,e)}}},YF=NR.start;Rr({target:"String",proto:!0,forced:MR},{padStart:function(e){return YF(this,e,arguments.length>1?arguments[1]:void 0)}});var QF,JF=Us("String").padStart,ZF=ae,$F=JF,eB=String.prototype,tB=function(e){var t=e.padStart;return"string"==typeof e||e===eB||ZF(eB,e)&&t===eB.padStart?$F:t},rB={};ad(rB,"__esModule",{value:!0});var nB=function(){return(nB=FE||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var i in t=arguments[r])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)};function iB(e,t){var r="function"==typeof _l&&Ok(e);if(!r)return e;var n,i,o=r.call(e),a=[];try{for(;(void 0===t||0<t--)&&!(n=o.next()).done;)a.push(n.value)}catch(s){i={error:s}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return a}function oB(e,t,r){if(r||2===arguments.length)for(var n,i=0,o=t.length;i<o;i++)!n&&i in t||((n=n||Sm(Array.prototype).call(t,0,i))[i]=t[i]);return wm(e).call(e,n||Sm(Array.prototype).call(t))}var aB=function(e){return vk({ev_type:"batch",list:e})};var sB=["init","start","config","beforeDestroy","provide","beforeReport","report","beforeBuild","build","beforeSend","send","beforeConfig"],cB=function(){return{}};function uB(e){return"object"==Ml(e)&&null!==e}var dB=Object.prototype;function lB(e){return!!uB(e)&&("function"!=typeof jl?"[object Object]"===dB.toString.call(e):(e=jl(e))===dB||null===e)}function hB(e){return"[object Array]"===dB.toString.call(e)}function fB(e){return"function"==typeof e}function pB(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function vB(e,t){var r,n=nB({},e);for(r in t)pB(t,r)&&void 0!==t[r]&&(uB(t[r])&&lB(t[r])?n[r]=vB(uB(e[r])?e[r]:{},t[r]):hB(t[r])&&hB(e[r])?n[r]=_B(e[r],t[r]):n[r]=t[r]);return n}function _B(e,t){var r;return e=hB(e)?e:[],t=hB(t)?t:[],lk(r=wm(Array.prototype).call(e,t)).call(r,(function(e){return e instanceof RegExp?e:uB(e)&&lB(e)?vB({},e):hB(e)?_B([],e):e}))}function mB(e,t){if(!hB(e))return!1;if(0===e.length)return!1;for(var r=0;r<e.length;){if(e[r]===t)return!0;r++}return!1}var gB=function(e,t){if(!hB(e))return e;var r=Pb(e).call(e,t);return 0<=r?(t=Sm(e).call(e),ok(t).call(t,r,1),t):e},yB=function(e,t,r){return function(e,t,r){for(var n,i=(t=iB(t.split(".")))[0],o=Sm(t).call(t,1);e&&0<o.length;)e=e[i],i=(n=iB(o))[0],o=Sm(n).call(n,1);if(e)return r(e,i)}(e,t,(function(e,t){if(e&&t in e&&fB(e[t]))try{return e[t].apply(e,r)}catch(n){return}}))};function SB(e){try{return function(e){return"string"==typeof e}(e)?e:vk(e)}catch(t){return"[FAILED_TO_STRINGIFY]:"+String(t)}}var EB=0,bB=function(){for(var e,t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];console.error.apply(console,oB(["[SDK]",Date.now(),tB(e=""+EB++).call(e,8," ")],iB(t),!1))},kB=0,TB=function(){for(var e,t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];console.warn.apply(console,oB(["[SDK]",Date.now(),tB(e=""+kB++).call(e,8," ")],iB(t),!1))},IB=function(e){return function(t){for(var r=t,n=0;n<e.length&&r;n++)try{r=e[n](r)}catch(i){bB(i)}return r}};function AB(){var e=function(){for(var e=new Array(16),t=0,r=0;r<16;r++)0==(3&r)&&(t=4294967296*Math.random()),e[r]=t>>>((3&r)<<3)&255;return e}();return e[6]=15&e[6]|64,e[8]=63&e[8]|128,function(e){for(var t=[],r=0;r<256;++r)t[r]=(r+256).toString(16).substr(1);var n=0,i=t;return[i[e[n++]],i[e[n++]],i[e[n++]],i[e[n++]],"-",i[e[n++]],i[e[n++]],"-",i[e[n++]],i[e[n++]],"-",i[e[n++]],i[e[n++]],"-",i[e[n++]],i[e[n++]],i[e[n++]],i[e[n++]],i[e[14]],i[e[15]]].join("")}(e)}var RB=function e(t,r){var n=TE(r).call(r,(function(e,r){try{var n=r(t);"function"==typeof n&&e.push(n)}catch(i){}return e}),[]);return function(t){return e(t,n)}},wB=function(e){function t(e){n=gB(n,e),o||a()}var r,n=[],i=[],o=!1,a=function(e,t,r){var n=0;return function(){if(e())return n&&clearTimeout(n),void(n=0);0===n&&(n=setTimeout(t,r))}}((function(){return!!n.length}),(function(){o=!0,r&&r[0](),i.forEach((function(e){return e()})),i.length=0,r=void 0}),e=void 0===e?3e5:e);return{next:function(e){return RB(e,n)},complete:function(e){i.push(e)},attach:function(e,t){r=[e,t]},subscribe:function(e){if(o)throw new Error("Observer is closed");return n.push(e),r&&r[1]&&r[1](e),a(),function(){return t(e)}},unsubscribe:t}};var CB=function(e){var t,r,n,i=(t={},r={},n={set:function(e,i){return t[e]=i,r[e]=SB(i),n},merge:function(e){return t=nB(nB({},t),e),an(e).forEach((function(t){r[t]=SB(e[t])})),n},delete:function(e){return delete t[e],delete r[e],n},clear:function(){return t={},r={},n},get:function(e){return r[e]},toString:function(){return nB({},r)}},n);e.provide("context",i),e.on("report",(function(e){return e.extra||(e.extra={}),e.extra.context=i.toString(),e}))},OB=function(e,t,r){function n(){for(var r=[],i=0;i<arguments.length;i++)r[i]=arguments[i];if(c=r[0]){var a=c.split(".")[0];if(a in n)return yB(n,c,Sm([]).call(r,1));var s=o[a]||[],c=null!==(c=null==t?void 0:t(e))&&void 0!==c?c:{};s.push(oB([c],iB(r),!1)),o[a]=s}}var i,o={};for(i in function(e,t,r,n){return void 0===n&&(n=!0),function(){for(var i=[],o=0;o<arguments.length;o++)i[o]=arguments[o];if(!e)return cB;var a=e[t],s=r.apply(void 0,oB([a],iB(i),!1)),c=s;return fB(c)&&n&&(c=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];try{return s.apply(this,e)}catch(r){return fB(a)&&a.apply(this,e)}}),e[t]=c,function(r){r||(c===e[t]?e[t]=a:s=a)}}}(e,"provide",(function(t){return function(r,i){n[r]=i,t.call(e,r,i)}}))(),e)Object.prototype.hasOwnProperty.call(e,i)&&(n[i]=e[i]);return e.on("provide",(function(t){o[t]&&(o[t].forEach((function(t){t=(n=iB(t))[0];var n=Sm(n).call(n,1);null!=r&&r(e,t,n)})),o[t]=null)})),n};function xB(e,t){var r=t||{};e.provide("initSubject",(function(e){var t=(e=iB(e,2))[0];e=e[1];return r[t]||(r[t]=function(t,r){var n=wB();try{t(n.next,n.attach),r&&n.complete(r)}catch(e){}return[n.subscribe,n.unsubscribe]}(e,(function(){r[t]=void 0}))),r[t]})),e.provide("getSubject",(function(e){return r[e]}))}function DB(){if("object"==("undefined"==typeof window?"undefined":Ml(window))&&uB(window))return window}function PB(){var e=function(){if(DB()&&"navigator"in window)return window.navigator}();if(e)return e.connection||e.mozConnection||e.webkitConnection}function NB(){var e=DB()&&DB()&&window.location;return null==e?void 0:e.href}var MB=function(e){var t={url:NB(),timestamp:Date.now()},r=e.config();return null!=r&&r.pid&&(t.pid=r.pid),null!=e&&e.context&&(t.context=e.context.toString()),t};function LB(e){return(null==e?void 0:e.effectiveType)||(null==e?void 0:e.type)||""}var UB=function(e,t,r){var n,i=t.url,o=t.data,a=void 0===(n=t.success)?cB:n,s=void 0===(n=t.fail)?cB:n,c=void 0===(n=t.getResponseText)?cB:n;t=void 0!==(t=t.withCredentials)&&t;(r=new r).withCredentials=t,r.open(e,i,!0),r.setRequestHeader("Content-Type","application/json"),r.onload=function(){null!=c&&c(this.responseText);try{var e;this.responseText?(e=JSON.parse(this.responseText),a(e)):a({})}catch(t){s(t)}},r.onerror=function(){s(new Error("Network request failed"))},r.onabort=function(){s(new Error("Network request aborted"))},r.send(o)},VB=function(){var e=function(){if("function"==typeof XMLHttpRequest&&fB(XMLHttpRequest))return XMLHttpRequest}();return e?{get:function(t){UB("GET",t,e)},post:function(t){UB("POST",t,e)}}:{get:cB,post:cB}};function FB(e){function t(e){n.post(r.getEndpoint(),aB([e]))}var r=function(e){var t=e.transport,r=e.endpoint,n=e.size,i=void 0===n?10:n,o=void 0===(e=e.wait)?1e3:e,a=[],s=0;function c(){a.length&&(t.post({url:r,data:this.getBatchData()}),a=[])}return{getSize:function(){return i},getWait:function(){return o},setSize:function(e){i=e},setWait:function(e){o=e},getEndpoint:function(){return r},setEndpoint:function(e){r=e},send:function(e){a.push(e),a.length>=i&&c.call(this),clearTimeout(s),s=setTimeout(c.bind(this),o)},flush:function(){clearTimeout(s),c.call(this)},getBatchData:function(){return a.length?aB(a):""},clear:function(){clearTimeout(s),a=[]}}}(e),n=function(){var e=DB();return e&&e.navigator.sendBeacon?{get:function(){},post:function(t,r){e.navigator.sendBeacon(t,r)}}:{get:cB,post:cB}}();return function(e){var t=iB(function(e){var t=!1;return[function(r){t||(t=!0,e&&e(r))}]}(e),1)[0];["unload","beforeunload","pagehide"].forEach((function(e){addEventListener(e,t)}))}((function(){var e=r.getBatchData();e&&(n.post(r.getEndpoint(),e),r.clear()),r.send=t})),r}var BB={build:function(e){return{ev_type:e.ev_type,payload:e.payload,common:nB(nB({},e.extra||{}),e.overrides||{})}}};function jB(e){var t,r=e.plugins||{};for(t in r)r[t]&&!uB(r[t])&&(r[t]={});return nB(nB({},e),{plugins:r})}function GB(e){return uB(e)&&"aid"in e}function HB(e){return nB({},e)}var zB="/settings/get/webpro",KB="/monitor_web/collect",XB=[KB,zB,"/monitor_browser/collect"],qB={sample_rate:1,include_users:[],sample_granularity:"session",rules:{}},WB=function(e,t){return void 0===t&&(t=KB),(e&&0<=Pb(e).call(e,"//")?"":"https://")+e+t},YB=function(e,t){return void 0===t&&(t=zB),(e&&0<=Pb(e).call(e,"//")?"":"https://")+e+t},QB=function(e){return e+"_"+Date.now()},JB=function(e){return"APMPLUS"+e},ZB=function(e){return function(e){try{var t=localStorage.getItem(e),r=t;return t&&"string"==typeof t?JSON.parse(t):r}catch(n){return}}(e=JB(e))||{userId:AB(),deviceId:AB(),r:Math.random()}},$B=function(e){var t=e.aid,r=e.userId,n=e.deviceId;e=e.sample;!function(e,t){try{var r="string"==typeof t?t:vk(t);localStorage.setItem(e,r)}catch(n){}}(t=JB(t),{userId:r,deviceId:n,r:e.r})},ej=function(e){var t,r,n,i=e,o={},a=cB,s=cB;return{getConfig:function(){return i},setConfig:function(e){return o=nB(nB({},o),e||{}),c(),t||(t=e,i.useLocalConfig?(n={},a()):r?u():function(e,t,r,n){e.get({withCredentials:!0,url:YB(t)+"?aid="+r,success:function(e){n(e.data||{})},fail:function(){n()}})}(i.transport,i.domain,i.aid,(function(e){r=e,u()}))),i},onChange:function(e){s=e},onReady:function(t){a=function(){e.userId!==i.userId&&(e.sample.r=Math.random(),c()),$B(i),t()},n&&a()}};function c(){var t=nB(nB(nB({},e),n||{}),o);t.plugins=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];for(var r={},n=0;n<e.length;)r=vB(r,e[n++]);return r}(e.plugins,(null==n?void 0:n.plugins)||{},o.plugins||{}),t.sample=tj(tj(e.sample,null==n?void 0:n.sample),o.sample),i=t,s()}function u(){n=function(e){var t;if(!e)return{};var r=e.sample,n=e.timestamp,i=e.status;if(!r)return{};var o=r.sample_rate;return e=r.sample_granularity,{sample:{include_users:r.include_users,sample_rate:i&&4===i?0:o,sample_granularity:e,rules:TE(t=r.rules).call(t,(function(e,t){var r=t.name,n=t.enable,i=t.sample_rate;return t=t.conditional_sample_rules,e[r]={enable:n,sample_rate:i,conditional_sample_rules:t},e}),{})},serverTimestamp:n}}(r),c(),a()}};function tj(e,t){var r;if(!e||!t)return e||t;var n=nB(nB({},e),t);return n.include_users=oB(oB([],iB(e.include_users||[]),!1),iB(t.include_users||[]),!1),n.rules=TE(r=oB(oB([],iB(an(e.rules||{})),!1),iB(an(t.rules||{})),!1)).call(r,(function(r,n){var i;return n in r||(n in(e.rules||{})&&n in(t.rules||{})?(r[n]=nB(nB({},e.rules[n]),t.rules[n]),r[n].conditional_sample_rules=oB(oB([],iB(e.rules[n].conditional_sample_rules||[]),!1),iB(t.rules[n].conditional_sample_rules||[]),!1)):r[n]=(null===(i=e.rules)||void 0===i?void 0:i[n])||(null===(i=t.rules)||void 0===i?void 0:i[n])),r}),{}),n}var rj=function(e){e.on("report",(function(e){return function(e){var t={url:NB(),timestamp:Date.now()};return nB(nB({},e),{extra:nB(nB({},t),e.extra||{})})}(e)}))},nj=function(e){e.on("beforeBuild",(function(t){return function(e,t){var r={};return r.aid=t.aid,r.pid=t.pid,r.view_id=t.viewId,r.user_id=t.userId,nB(nB({},e),{extra:nB(nB({},r),e.extra||{})})}(t,e.config())}))},ij=function(e){e.on("start",(function(){var t,r={did:(t=e.config()).deviceId,sid:t.sessionId,release:t.release,env:t.env,sname:"APM_PLUS_WEB",sversion:"1.7.0",soffset:t.offset||0,biz_id:r=t.aid,x_auth_token:t=t.token};(t=e.getSender()).setEndpoint(t.getEndpoint()+function(e){var t;return uB(e)?TE(t=an(e)).call(t,(function(t,r){return t+"&"+r+"="+e[r]}),"").replace("&","?"):""}(r))}))},oj=function(e){return e=ZB(e.aid),{aid:0,pid:"",token:"",viewId:QB("_"),userId:e.userId,deviceId:e.deviceId,sessionId:AB(),domain:"apmplus.volces.com",plugins:{ajax:{ignoreUrls:XB},fetch:{ignoreUrls:XB},breadcrumb:{},pageview:{},jsError:{},resource:{},resourceError:{},performance:{},tti:{},fmp:{},blankScreen:!1},release:"",env:"production",sample:nB(nB({},qB),{r:e.r}),transport:VB()}};QF=rB.createMinimalBrowserClient=function(e){var t=(r=void 0===e?{}:e).createSender,r=(e=r.builder,r.createDefaultConfig),n=function(e){var t,r,n=e.builder,i=e.createSender,o=e.createDefaultConfig,a=e.createConfigManager,s=e.userConfigNormalizer,c=e.initConfigNormalizer,u=e.validateInitConfig,d={};sB.forEach((function(e){return d[e]=[]}));var l=!1,h=!1,f=!1,p=[],v=[],_={getBuilder:function(){return n},getSender:function(){return t},getPreStartQueue:function(){return p},init:function(e){if(l)TB("already inited");else{if(!(e&&uB(e)&&u(e)))throw new Error("invalid InitConfig, init failed");var n=o(e);if(!n)throw new Error("defaultConfig missing");if(e=c(e),(r=a(n)).setConfig(e),r.onChange((function(){m("config")})),!(t=i(r.getConfig())))throw new Error("sender missing");m("init",l=!0)}},set:function(e){l&&e&&uB(e)&&(m("beforeConfig",!1,e),null!=r&&r.setConfig(e))},config:function(e){if(l)return e&&uB(e)&&(m("beforeConfig",!1,e),null!=r&&r.setConfig(s(e))),null==r?void 0:r.getConfig()},provide:function(e,t){mB(v,e)?TB("cannot provide "+e+", reserved"):(_[e]=t,m("provide",!1,e))},start:function(){var e=this;l&&(h||null!=r&&r.onReady((function(){m("start",h=!0),p.forEach((function(t){return e.build(t)})),p=[]})))},report:function(e){e&&(!(e=IB(d.beforeReport)(e))||(e=IB(d.report)(e))&&(h?this.build(e):p.push(e)))},build:function(e){!h||(e=IB(d.beforeBuild)(e))&&(!(e=n.build(e))||(e=IB(d.build)(e))&&this.send(e))},send:function(e){!h||(e=IB(d.beforeSend)(e))&&(t.send(e),m("send",!1,e))},destroy:function(){m("beforeDestroy",f=!0)},on:function(e,t){"init"===e&&l||"start"===e&&h||"beforeDestroy"===e&&f?t():d[e]&&d[e].push(t)},off:function(e,t){d[e]&&(d[e]=gB(d[e],t))}};return v=an(_),_;function m(e,t){void 0===t&&(t=!1);for(var r=[],n=2;n<arguments.length;n++)r[n-2]=arguments[n];d[e].forEach((function(e){try{e.apply(void 0,oB([],iB(r),!1))}catch(t){}})),t&&(d[e].length=0)}}({validateInitConfig:GB,initConfigNormalizer:jB,userConfigNormalizer:HB,createSender:void 0===t?function(e){return FB({size:20,endpoint:WB(e.domain),transport:e.transport})}:t,builder:void 0===e?BB:e,createDefaultConfig:void 0===r?oj:r,createConfigManager:ej});return CB(n),r=function(e){if(e)return e.__SLARDAR_REGISTRY__||(e.__SLARDAR_REGISTRY__={Slardar:{plugins:[],errors:[],subject:{}}}),e.__SLARDAR_REGISTRY__.Slardar}(DB()),xB(n,r&&r.subject),function(e){var t,r=!1;e.on("init",(function(){t=(new Date).getTime(),e.on("config",(function(){var n,i=null===(n=e.config())||void 0===n?void 0:n.serverTimestamp;isNaN(i)||Number(i)<=0||r||(r=!0,(n=(new Date).getTime())-t<700&&i&&(n=i-(n+t)/2,!isNaN(n)&&(0<n||n<-6e5)&&e.set({offset:n})))}))}))}(n),nj(n),rj(n),function(e){var t=PB(),r=LB(t);t&&(t.onchange=function(){r=LB(t)}),e.on("report",(function(e){return nB(nB({},e),{extra:nB(nB({},e.extra||{}),{network_type:r})})}))}(n),ij(n),r=OB(n,MB,(function(e,t,r){return function(e,t){return function(r){function n(e){return e.overrides=t,e}e.on("report",n),r(),e.off("report",n)}}(e,t)((function(){var e=(t=iB(r))[0],t=Sm(t).call(t,1);n[e].apply(n,oB([],iB(t),!1))}))})),function(e){e.on("init",(function(){var t=[],r=e.config();r&&r.integrations&&r.integrations.forEach((function(r){mB(t,r.name)||(t.push(r.name),r.setup(e),r.tearDown&&e.on("beforeDestroy",r.tearDown))}))}))}(r),r},rB.getDefaultConfig=oj;var aj={};ad(aj,"__esModule",{value:!0});var sj=function(){return(sj=FE||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var i in t=arguments[r])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)};function cj(e,t){var r="function"==typeof _l&&Ok(e);if(!r)return e;var n,i,o=r.call(e),a=[];try{for(;(void 0===t||0<t--)&&!(n=o.next()).done;)a.push(n.value)}catch(s){i={error:s}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return a}function uj(e,t,r){if(r||2===arguments.length)for(var n,i=0,o=t.length;i<o;i++)!n&&i in t||((n=n||Sm(Array.prototype).call(t,0,i))[i]=t[i]);return wm(e).call(e,n||Sm(Array.prototype).call(t))}var dj=function(){return{}};function lj(e){return"object"==Ml(e)&&null!==e}var hj=Object.prototype;function fj(e){return"function"==typeof e}function pj(e){return"string"==typeof e}function vj(e){return function(e){return"[object Array]"===hj.toString.call(e)}(e)&&e.length?function(e){for(var t=[],r=e.length,n=0;n<r;n++){var i=e[n];pj(i)?t.push(i.replace(/([.*+?^=!:${}()|[\]/\\])/g,"\\$1")):i&&i.source&&t.push(i.source)}return new RegExp(t.join("|"),"i")}(e):null}function _j(e){try{return pj(e)?e:vk(e)}catch(t){return"[FAILED_TO_STRINGIFY]:"+String(t)}}var mj=function(e,t,r,n){return void 0===n&&(n=!0),function(){for(var i=[],o=0;o<arguments.length;o++)i[o]=arguments[o];if(!e)return dj;var a=e[t],s=r.apply(void 0,uj([a],cj(i),!1)),c=s;return fj(c)&&n&&(c=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];try{return s.apply(this,e)}catch(r){return fj(a)&&a.apply(this,e)}}),e[t]=c,function(r){r||(c===e[t]?e[t]=a:s=a)}}};function gj(){if("object"==("undefined"==typeof window?"undefined":Ml(window))&&lj(window))return window}var yj=function(e){if(e)return e.__SLARDAR_REGISTRY__||(e.__SLARDAR_REGISTRY__={Slardar:{plugins:[],errors:[],subject:{}}}),e.__SLARDAR_REGISTRY__.Slardar},Sj=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=yj(gj());r&&(r.errors||(r.errors=[]),r.errors.push(e))};function Ej(e,t,r){return function(e,t){return lj(e)?sj(sj({},t),e):!!e&&t}(t=null===(e=e.config())||void 0===e?void 0:e.plugins[t],r)}var bj=["name","message","stack","filename","lineno","colno"],kj=function(e){var t;return function(e){switch(Object.prototype.toString.call(e)){case"[object Error]":case"[object Exception]":case"[object DOMError]":case"[object DOMException]":return!0;default:return e instanceof Error}}(e)?t=function(e,t){return e&&lj(e)?TE(t).call(t,(function(t,r){return t[r]=e[r],t}),{}):e}(e,bj):(function(e){return!!lj(e)&&("function"!=typeof jl?"[object Object]"===hj.toString.call(e):(e=jl(e))===hj||null===e)}(e)||function(e){return"undefined"!=typeof Event&&function(e,t){try{return e instanceof t}catch(r){return!1}}(e,Event)}(e)||pj(e))&&(t={message:_j(e)}),t},Tj=function(e){return kj(e.error)},Ij=function(e){var t;try{var r=void 0;if("reason"in e?r=e.reason:"detail"in e&&"reason"in e.detail&&(r=e.detail.reason),r){var n=kj(r);return sj(sj({},n),{name:null!==(t=n&&n.name)&&void 0!==t?t:"UnhandledRejection"})}}catch(i){}},Aj=function(e){return(function(e){return"[object ErrorEvent]"===Object.prototype.toString.call(e)}(e)?Tj:function(e){return"[object PromiseRejectionEvent]"===Object.prototype.toString.call(e)}(e)?Ij:kj)(e)},Rj=["EventTarget","Window","Node","ApplicationCache","ChannelMergerNode","EventSource","FileReader","HTMLUnknownElement","IDBDatabase","IDBRequest","IDBTransaction","MessagePort","Notification","SVGElementInstance","Screen","TextTrack","TextTrackCue","TextTrackList","WebSocket","Worker","XMLHttpRequest","XMLHttpRequestEventTarget","XMLHttpRequestUpload"],wj=["setTimeout","setInterval","requestAnimationFrame","requestIdleCallback"],Cj=["onload","onerror","onprogress","onreadystatechange"],Oj="addEventListener",xj=function(e,t,r){var n;function i(t,r){if(!fj(t))return t;var n={type:"capture-global",data:sj({},r)},o=t._w_||(t._w_=function(){try{return(t.handleEvent&&fj(t.handleEvent)?t.handleEvent:t).apply(this,lk([]).call(arguments,(function(e){return i(e,r)})))}catch(a){var o=kj(a);throw o&&e({error:o,source:n}),a}});return o._hook_=!0,o}void 0===t&&(t=gj()),void 0===r&&(r=function(){if("function"==typeof XMLHttpRequest&&fj(XMLHttpRequest))return XMLHttpRequest}());var o=[];return t&&o.push.apply(o,uj([],cj(lk(n=Gs(wj).call(wj,(function(e){return t[e]}))).call(n,(function(e){return mj(t,e,(function(t){return function(r){for(var n=[],o=1;o<arguments.length;o++)n[o-1]=arguments[o];return t&&t.call.apply(t,uj([this,i(r,{function:e})],cj(n),!1))}}),!1)()}))),!1)),r&&r.prototype&&o.push(mj(r.prototype,"send",(function(e){return function(){for(var t,r=this,n=[],a=0;a<arguments.length;a++)n[a]=arguments[a];return o.push.apply(o,uj([],cj(lk(t=Gs(Cj).call(Cj,(function(e){return r[e]&&!r[e]._hook_}))).call(t,(function(e){var t=mj(r,e,(function(t){return i(t,{function:e})}),!1)();return function(){t(),r[e]._hook_=void 0}}))),!1)),e.apply(this,n)}}),!1)()),Rj.forEach((function(e){var r=t[e]&&t[e].prototype;r&&r.addEventListener&&(o.push(mj(r,Oj,(function(t){return function(r,n,o){try{var a=n.handleEvent;fj(a)&&(n.handleEvent=i(a,{function:"handleEvent",target:e}))}catch(s){}return t&&t.call(this,r,i(n,{function:Oj,target:e}),o)}}),!1)()),o.push(mj(r,"removeEventListener",(function(e){return function(t,r,n){return null!=r&&r._w_&&e.call(this,t,r._w_,n),e.call(this,t,r,n)}}),!1)()))})),o},Dj=function(e,t){return e&&t&&e===t},Pj=function(){var e;return function(t){try{if(function(e,t){return!!(e&&t&&Dj(e.message,t.message)&&Dj(e.stack,t.stack))}(t,e))return void(e=t)}catch(r){Sj(r)}return e=t}},Nj=function(e){if(e=void 0===e?gj():e)return function(t,r){var n,i,o=t.ignoreErrors,a=t.onerror,s=t.onunhandledrejection,c=t.dedupe,u=(t=t.captureGlobalAsync,vj(o)),d=[],l=Pj(),h=function(e){var t=e.error,n=e.extra,i=e.react;e=e.source,t=c?l(t):t;r&&t&&(u&&u.test(t.message)||r({ev_type:"js_error",payload:{error:t,breadcrumbs:[],extra:n,react:i,source:e}}))};return a&&(e.addEventListener("error",n=function(e){return h({error:Tj(e),source:{type:"onerror"}})}),d.push((function(){return e.removeEventListener("error",n)}))),s&&(e.addEventListener("unhandledrejection",i=function(e){return h({error:Ij(e),source:{type:"onunhandledrejection"}})}),d.push((function(){return e.removeEventListener("unhandledrejection",i)}))),t&&d.push.apply(d,uj([],cj(xj(h)),!1)),[function(e,t,r){return h({error:Aj(e),extra:t,react:r,source:{type:"manual"}})},function(){d.forEach((function(e){return e()}))}]}},Mj="jsError",Lj={ignoreErrors:[],onerror:!0,onunhandledrejection:!0,captureGlobalAsync:!1,dedupe:!0};function Uj(e){e.on("init",(function(){window.removeEventListener("error",e.pcErr,!0),window.removeEventListener("unhandledrejection",e.pcRej,!0);var t,r=Ej(e,Mj,Lj);r&&(r=(t=cj(function(e,t,r,n){void 0===t&&(t={}),void 0===n&&(n=[]);try{var i=e.apply(void 0,uj([],cj(n),!1));return i&&i(t,r)||[]}catch(o){return Sj(o),[]}}(Nj,r,(function(t){e.getBreadcrumbs&&(t.payload.breadcrumbs=e.getBreadcrumbs()),e.report(t)})),2))[0],t=t[1],e.on("beforeDestroy",t),e.provide("captureException",r))}))}var Vj=aj.jsErrorPlugin=function(){return{name:Mj,setup:function(e){Uj(e)}}},Fj={};ad(Fj,"__esModule",{value:!0});var Bj=function(){return(Bj=FE||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var i in t=arguments[r])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)};function jj(e,t){var r="function"==typeof _l&&Ok(e);if(!r)return e;var n,i,o=r.call(e),a=[];try{for(;(void 0===t||0<t--)&&!(n=o.next()).done;)a.push(n.value)}catch(s){i={error:s}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return a}function Gj(e,t,r){if(r||2===arguments.length)for(var n,i=0,o=t.length;i<o;i++)!n&&i in t||((n=n||Sm(Array.prototype).call(t,0,i))[i]=t[i]);return wm(e).call(e,n||Sm(Array.prototype).call(t))}var Hj=function(){return{}};function zj(e){return"object"==Ml(e)&&null!==e}function Kj(e){return"function"==typeof e}var Xj=function(e,t,r,n){return void 0===n&&(n=!0),function(){for(var i=[],o=0;o<arguments.length;o++)i[o]=arguments[o];if(!e)return Hj;var a=e[t],s=r.apply(void 0,Gj([a],jj(i),!1)),c=s;return Kj(c)&&n&&(c=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];try{return s.apply(this,e)}catch(r){return Kj(a)&&a.apply(this,e)}}),e[t]=c,function(r){r||(c===e[t]?e[t]=a:s=a)}}};function qj(){if("object"==("undefined"==typeof window?"undefined":Ml(window))&&zj(window))return window}var Wj=function(e){if(e)return e.__SLARDAR_REGISTRY__||(e.__SLARDAR_REGISTRY__={Slardar:{plugins:[],errors:[],subject:{}}}),e.__SLARDAR_REGISTRY__.Slardar},Yj=function(e,t,r,n){void 0===t&&(t={}),void 0===n&&(n=[]);try{var i=e.apply(void 0,Gj([],jj(n),!1));return i&&i(t,r)||[]}catch(o){return function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=Wj(qj());r&&(r.errors||(r.errors=[]),r.errors.push(e))}(o),[]}};function Qj(e){var t,r=function(){if("object"==("undefined"==typeof document?"undefined":Ml(document))&&zj(document))return document}();return r&&e?((r=r.createElement("a")).href=e,"/"!==(e=r.pathname||"/")[0]&&(e="/"+e),{url:r.href,protocol:Sm(t=r.protocol).call(t,0,-1),domain:r.hostname,query:r.search.substring(1),path:e,hash:r.hash}):{url:e,protocol:"",domain:"",query:"",path:"",hash:""}}function Jj(e,t,r){return function(e,t){return zj(e)?Bj(Bj({},t),e):!!e&&t}(t=null===(e=e.config())||void 0===e?void 0:e.plugins[t],r)}var Zj=["hash_0",function(e,t){var r,n=qj();n&&(n.addEventListener("hashchange",r=function(){return e(location.href)},!0),t((function(){return n.removeEventListener("hashchange",r,!0)})))}],$j=["history_0",function(e,t){var r,n,i,o=qj()&&window.history;o&&(n=function(){return e(location.href)},(r=[]).push(Xj(o,"pushState",i=function(e){return function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];try{e.apply(o,t)}finally{n()}}})(),Xj(o,"replaceState",i)()),window.addEventListener("popstate",n,!0),r.push((function(){return window.removeEventListener("popstate",n,!0)})),t((function(){r.forEach((function(e){return e()}))})))}],eG=function(e,t){if(void 0===e&&(e=qj()),void 0===t&&(t=qj()&&window.location),e&&t)return function(e,r){var n,i,o,a=e.sendInit,s=e.initPid,c=e.routeMode,u=e.extractPid,d=e.onPidUpdate,l=(e=e.createObserver,[]),h="manual"===c?function(){return""}:function(e){return function(t){var r;return"hash"===e?(null===(r=Qj(t).hash)||void 0===r?void 0:r.replace(/^#/,""))||"/":Qj(t).path}}(c),f=u||function(){},p=(s=jj(function(e,t,r,n){var i=r,o=t;return n&&n(t),[function(t,r,a){"user_set"!==t&&r!==i?(i=r,o=null!=a?a:i,n&&n(o),e(t,o)):"user_set"===t&&r!==o&&(o=r,n&&n(o),e(t,o))},function(){t&&e("init",t)}]}((function(e,t){r&&r({ev_type:"pageview",payload:{pid:t,source:e}})}),s||(n=t.href,null!==(i=f(n))&&void 0!==i?i:h(n)),h(t.href),d),2),s[0]);d=s[1],s=p.bind(null,"user_set");return"manual"!==c&&(o=jj(function(e,t){var r=t;return[function(t,n){n!==r&&e(t,r=n)}]}((function(e,t){return p(e,h(t),f(t))}),""),1)[0],e=jj(e(c),1)[0],l.push(e((function(e){return o(c,e)})))),a&&d(),[s,function(){l.forEach((function(e){return e()}))}]}},tG="pageview",rG={sendInit:!0,routeMode:"history"};var nG=Fj.pageviewPlugin=function(){return{name:tG,setup:function(e){var t;(t=e).on("init",(function(){var e,r=Jj(t,tG,rG);r&&(r=jj(Yj(eG,Bj(Bj({},r),{initPid:null===(r=t.config())||void 0===r?void 0:r.pid,onPidUpdate:function(e){t.set({pid:e,viewId:e+"_"+Date.now(),actionId:void 0})},createObserver:function(e){return t.initSubject("hash"===e?Zj:$j)}}),t.report.bind(t)),2),e=r[0],r=r[1],t.on("config",(function(){e(t.config().pid)})),t.on("beforeDestroy",r),t.provide("sendPageview",e))}))}}};if(!uw()&&!window.__rtc_slardar__){var iG=QF();iG("init",{aid:432410,token:"d7271e1eac254529abcffc63e36b02c3",integrations:[nG(),Vj(),WF({screenshot:!1})]}),iG("on","beforeSend",(function(e){return"blank_screen"===e.ev_type&&iP.rtcError("blank_screen",0,e),e})),iG("start"),window.__rtc_slardar__=iG}var oG,aG=new(function(){function e(){Wd(this,e)}return qd(e,[{key:"setStats",value:function(e){!uw()&&window.__rtc_slardar__&&an(e).forEach((function(t){window.__rtc_slardar__("context.set",t,e[t])}))}}]),e}()),sG=new RC("RecvFrameObserver",0),cG=function(){function e(t,r){Wd(this,e),sd(this,"_audioEventSessionId",Aw()),sd(this,"_videoEventSessionId",Aw()),sd(this,"_handler",void 0),sd(this,"_stream",void 0),sd(this,"_firstAudioFrameTimer",void 0),sd(this,"_firstVideoFrameTimer",void 0),sd(this,"_transportDelayInterval",void 0),sd(this,"_transportDelay",void 0),sd(this,"_firstVideoFrameInterval",void 0),sd(this,"_firstAudioFrameInterval",void 0),sd(this,"_isScreen",!1),sd(this,"_audioFirstFrameState",0),sd(this,"_videoFirstFrameState",0),sd(this,"_timeout",1e4),sd(this,"_currentAudioRecv",{startTime:0,eventSessionId:0,type:XD.LOGIN}),sd(this,"_currentVideoRecv",{startTime:0,eventSessionId:0,type:XD.LOGIN}),sd(this,"_login",!1),sd(this,"_unMuteAudio",!1),sd(this,"_enableAudio",!1),sd(this,"_unMuteVideo",!1),sd(this,"_enableVideo",!1),sd(this,"_remoteUnmuteAudio",!1),sd(this,"_remoteUnmuteVideo",!1),sd(this,"_audioExternal",!1),sd(this,"_pushAudio",!1),sd(this,"_videoExternal",!1),sd(this,"_pushVideo",!1),sd(this,"_autoSubscribeVideo",!1),sd(this,"_autoSubscribeAudio",!1),sd(this,"_autoSubscribe",!1),sd(this,"_publishVideo",!1),sd(this,"_publishAudio",!1),sd(this,"_subscribeAudio",!1),sd(this,"_subscribeVideo",!1),sd(this,"_subscribe",!1),sd(this,"_pushTrack",!1),sd(this,"_multiChatMode",!1),this._stream=t,this._handler=r,this.getTransportDelay()}var t,r,n,i;return qd(e,[{key:"beginRecvFrame",value:(i=km(Em().mark((function e(t,r){var n,i,o,a,s,c,u,d,l,h,f,p,v,_,m,g=this;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.getTransportDelay();case 2:i=this._transportDelay,o=!0,a=XD.LOGIN,s=XD.UNMUTE,c=XD.SUBSCRIBE,u=XD.PUSH_TRACK,Pb(n=[a,s,c,u]).call(n,r)>=0&&(i=0,o=!1),t===KD.AUDIO?(o||this._audioEventSessionId++,this._currentAudioRecv={startTime:Date.now(),eventSessionId:this._audioEventSessionId,type:r},f={media_type:t,event_type:zD.BEGIN_RECV,type:r,is_screen:!(null===(d=this._stream)||void 0===d||!d.isScreen),start:null===(l=this._currentAudioRecv)||void 0===l?void 0:l.startTime,event_session_id:this._audioEventSessionId,stream_user_id:null===(h=this._stream)||void 0===h?void 0:h.userId,transport_delay:i},this._firstAudioFrameTimer&&window.clearTimeout(this._firstAudioFrameTimer),this._firstAudioFrameTimer=window.setTimeout((function(){g.stopRecvFrame(KD.AUDIO,qD.TIMEOUT),g._firstAudioFrameInterval&&window.clearInterval(g._firstAudioFrameInterval)}),this._timeout),sG.print("rtcFirstFrameRecv",vk(f)),iP.rtcFirstFrame(f),this._watchForFirstAudioFrameRecv(),this._audioFirstFrameState=1,this._login=!0,this._unMuteAudio=!0,this._enableAudio=!0,this._remoteUnmuteAudio=!0):t===KD.VIDEO&&(o||this._videoEventSessionId++,this._currentVideoRecv={startTime:Date.now(),eventSessionId:this._videoEventSessionId,type:r},m={media_type:t,event_type:zD.BEGIN_RECV,type:r,is_screen:!(null===(p=this._stream)||void 0===p||!p.isScreen),start:null===(v=this._currentVideoRecv)||void 0===v?void 0:v.startTime,event_session_id:this._videoEventSessionId,stream_user_id:null===(_=this._stream)||void 0===_?void 0:_.userId,transport_delay:i},this._firstVideoFrameTimer&&window.clearTimeout(this._firstVideoFrameTimer),this._firstVideoFrameTimer=window.setTimeout((function(){g.stopRecvFrame(KD.VIDEO,qD.TIMEOUT),g._firstVideoFrameInterval&&window.clearInterval(g._firstVideoFrameInterval)}),this._timeout),this._watchForFirstVideoFrameRecv(),sG.print("rtcFirstFrameRecv",vk(m)),iP.rtcFirstFrame(m),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===KD.AUDIO){var r,n,i,o;if(1!==this._audioFirstFrameState)return;var a={event_type:zD.RECV_END,media_type:e,is_screen:!(null===(r=this._stream)||void 0===r||!r.isScreen),start:null===(n=this._currentAudioRecv)||void 0===n?void 0:n.startTime,reason:t,result:!1,stream_user_id:null===(i=this._stream)||void 0===i?void 0:i.userId,event_session_id:this._audioEventSessionId,type:null===(o=this._currentAudioRecv)||void 0===o?void 0:o.type};this._firstAudioFrameTimer&&window.clearTimeout(this._firstAudioFrameTimer),delete this._currentAudioRecv,sG.print("rtcFirstFrameRecv",vk(a)),iP.rtcFirstFrame(a),this._audioFirstFrameState=2}else if(e===KD.VIDEO){var s,c,u,d;if(1!==this._videoFirstFrameState)return;var l={event_type:zD.RECV_END,media_type:e,is_screen:!(null===(s=this._stream)||void 0===s||!s.isScreen),start:null===(c=this._currentVideoRecv)||void 0===c?void 0:c.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===(d=this._currentVideoRecv)||void 0===d?void 0:d.type};this._firstVideoFrameTimer&&window.clearTimeout(this._firstVideoFrameTimer),delete this._currentVideoRecv,sG.print("rtcFirstFrameRecv",vk(l)),iP.rtcFirstFrame(l),this._videoFirstFrameState=2}}},{key:"recvFrameFinish",value:(n=km(Em().mark((function e(t){var r,n,i,o,a,s,c,u,d,l,h,f,p,v,_,m,g,y,S;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.getTransportDelay();case 2:if(r=this._transportDelay,n=XD.LOGIN,i=XD.UNMUTE,o=XD.SUBSCRIBE,a=XD.PUSH_TRACK,t!==KD.AUDIO){e.next=19;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:d=this._currentAudioRecv,l=d.type,h=d.startTime,Pb(s=[n,i,o,a]).call(s,l)>=0&&(r=0),f={event_type:zD.RECV_END,media_type:t,start:h,result:!0,is_screen:!(null===(c=this._stream)||void 0===c||!c.isScreen),stream_user_id:null===(u=this._stream)||void 0===u?void 0:u.userId,event_session_id:this._audioEventSessionId,type:l,transport_delay:r},delete this._currentAudioRecv,this._firstAudioFrameTimer&&window.clearTimeout(this._firstAudioFrameTimer),sG.print("rtcFirstFrameRecv",vk(f)),iP.rtcFirstFrame(f),this._audioFirstFrameState=3,e.next=32;break;case 19:if(t!==KD.VIDEO){e.next=32;break}if(1===this._videoFirstFrameState){e.next=22;break}return e.abrupt("return");case 22:if(this._currentVideoRecv){e.next=24;break}return e.abrupt("return");case 24:m=this._currentVideoRecv,g=m.type,y=m.startTime,Pb(p=[n,i,o,a]).call(p,g)>=0&&(r=0),S={event_type:zD.RECV_END,media_type:t,is_screen:!(null===(v=this._stream)||void 0===v||!v.isScreen),start:y,result:!0,stream_user_id:null===(_=this._stream)||void 0===_?void 0:_.userId,event_session_id:this._videoEventSessionId,type:g,transport_delay:r},delete this._currentVideoRecv,this._firstVideoFrameTimer&&window.clearTimeout(this._firstVideoFrameTimer),sG.print("rtcFirstFrameRecv",vk(S)),iP.rtcFirstFrame(S),this._videoFirstFrameState=3;case 32: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(KD.AUDIO,XD.LOGIN),e&&null!==(r=this._stream)&&void 0!==r&&r.hasVideo&&o.video&&this.beginRecvFrame(KD.VIDEO,XD.LOGIN),!e&&null!==(n=this._stream)&&void 0!==n&&n.hasAudio&&this.stopRecvFrame(KD.AUDIO,qD.LEAVE_ROOM),!e&&null!==(i=this._stream)&&void 0!==i&&i.hasVideo&&this.stopRecvFrame(KD.VIDEO,qD.LEAVE_ROOM))}},{key:"setUnmuteAudio",value:function(e){var t,r,n;if(this._unMuteAudio!==e){this._unMuteAudio=e;var i=!(null===(t=this._stream)||void 0===t||!t.hasAudio);null!==(r=this._stream)&&void 0!==r&&r.audioHasCapture&&null!==(n=this._stream)&&void 0!==n&&n.audioHasPublish&&(this._unMuteAudio&&i?this.beginRecvFrame(KD.AUDIO,XD.UNMUTE):i&&this.stopRecvFrame(KD.AUDIO,qD.MUTE))}}},{key:"setRemoteUnmuteAudio",value:function(e){var t;this._remoteUnmuteAudio!==e&&(this._remoteUnmuteAudio=e,this._remoteUnmuteAudio?this.beginRecvFrame(KD.AUDIO,XD.REMOTE_UNMUTE):null!==(t=this._stream)&&void 0!==t&&t.hasAudio&&this.stopRecvFrame(KD.AUDIO,qD.REMOTE_MUTE))}},{key:"setEnableAudio",value:function(e){var t;this._enableAudio!==e&&(this._enableAudio=e,this._enableAudio?this.beginRecvFrame(KD.AUDIO,XD.ENABLE):null!==(t=this._stream)&&void 0!==t&&t.hasAudio&&this.stopRecvFrame(KD.AUDIO,qD.DISABLE))}},{key:"setUnmuteVideo",value:function(e){var t,r,n;if(this._unMuteVideo!==e){this._unMuteVideo=e;var i=!(null===(t=this._stream)||void 0===t||!t.hasVideo);null!==(r=this._stream)&&void 0!==r&&r.videoHasCapture&&null!==(n=this._stream)&&void 0!==n&&n.videoHasPublish&&(this._unMuteVideo&&i?this.beginRecvFrame(KD.VIDEO,XD.UNMUTE):i&&this.stopRecvFrame(KD.VIDEO,qD.MUTE))}}},{key:"setRemoteUnmuteVideo",value:function(e){var t;this._remoteUnmuteVideo!==e&&(this._remoteUnmuteVideo=e,this._remoteUnmuteVideo?this.beginRecvFrame(KD.VIDEO,XD.REMOTE_UNMUTE):null!==(t=this._stream)&&void 0!==t&&t.hasAudio&&this.stopRecvFrame(KD.VIDEO,qD.REMOTE_MUTE))}},{key:"setEnableVideo",value:function(e){this._enableVideo!==e&&(this._enableVideo=e,this._enableVideo?this.beginRecvFrame(KD.VIDEO,XD.ENABLE):this.stopRecvFrame(KD.VIDEO,qD.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(KD.AUDIO,XD.PUSH),!e&&null!==(t=this._stream)&&void 0!==t&&t.hasAudio&&this.beginRecvFrame(KD.AUDIO,XD.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(KD.VIDEO,XD.PUSH),!e&&null!==(t=this._stream)&&void 0!==t&&t.hasVideo&&this.beginRecvFrame(KD.VIDEO,XD.PUSH)}},{key:"setPublishVideo",value:function(e){var t;this._publishVideo!==e&&(this._publishVideo=e),this._publishVideo&&this.beginRecvFrame(KD.VIDEO,XD.PUBLISH),!e&&null!==(t=this._stream)&&void 0!==t&&t.hasVideo&&this.stopRecvFrame(KD.VIDEO,qD.UNPUBLISH)}},{key:"setPublishAudio",value:function(e){var t;this._publishAudio!==e&&(this._publishAudio=e),this._publishAudio&&this.beginRecvFrame(KD.AUDIO,XD.PUBLISH),!e&&null!==(t=this._stream)&&void 0!==t&&t.hasAudio&&this.stopRecvFrame(KD.AUDIO,qD.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(KD.AUDIO,XD.SUBSCRIBE));!e&&null!==(t=this._stream)&&void 0!==t&&t.hasAudio&&this.stopRecvFrame(KD.AUDIO,qD.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(KD.VIDEO,XD.SUBSCRIBE));!e&&null!==(t=this._stream)&&void 0!==t&&t.hasVideo&&this.stopRecvFrame(KD.VIDEO,qD.UNSUBSCRIBE)}},{key:"setPushTrack",value:function(e){var t;this._pushTrack!==e&&(e&&!this._isScreen&&this.beginRecvFrame(KD.AUDIO,XD.PUSH_TRACK),!e&&null!==(t=this._stream)&&void 0!==t&&t.hasAudio&&this.stopRecvFrame(KD.AUDIO,qD.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,r=-1;this._firstVideoFrameInterval&&window.clearInterval(this._firstVideoFrameInterval),this._firstVideoFrameInterval=window.setInterval(km(Em().mark((function n(){var i,o,a,s,c,u,d,l;return Em().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(null===(i=e._handler)||void 0===i||!i.pc||null===(o=e._stream)||void 0===o||null===(a=o.videoTrack)||void 0===a||!a.getTrack()){n.next=12;break}return n.next=3,tL(null===(s=e._handler)||void 0===s?void 0:s.pc,null===(c=e._stream)||void 0===c||null===(u=c.videoTrack)||void 0===u?void 0:u.getTrack());case 3:if(d=n.sent,!(l=bb(d).call(d,(function(e){return"inbound-rtp"===e.type})))||!(l.framesReceived>t||l.packetsReceived>r)){n.next=12;break}if(-1!==t||-1!==r){n.next=10;break}return t=l.framesReceived,r=l.packetsReceived,n.abrupt("return");case 10:e.recvFrameFinish(KD.VIDEO),window.clearInterval(e._firstVideoFrameInterval);case 12:case"end":return n.stop()}}),n)}))),200)}},{key:"_watchForFirstAudioFrameRecv",value:function(){var e=this,t=-1,r=-1;this._firstAudioFrameInterval&&window.clearInterval(this._firstAudioFrameInterval),this._firstAudioFrameInterval=window.setInterval(km(Em().mark((function n(){var i,o,a,s,c,u,d,l;return Em().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(null===(i=e._handler)||void 0===i||!i.pc||null===(o=e._stream)||void 0===o||null===(a=o.audioTrack)||void 0===a||!a.getTrack()){n.next=12;break}return n.next=3,tL(null===(s=e._handler)||void 0===s?void 0:s.pc,null===(c=e._stream)||void 0===c||null===(u=c.audioTrack)||void 0===u?void 0:u.getTrack());case 3:if(d=n.sent,!(l=bb(d).call(d,(function(e){return"inbound-rtp"===e.type})))||!(l.totalSamplesReceived>t||l.packetsReceived>r)){n.next=12;break}if(-1!==t||-1!==r){n.next=10;break}return t=l.totalSamplesReceived,r=l.packetsReceived,n.abrupt("return");case 10:e.recvFrameFinish(KD.AUDIO),window.clearInterval(e._firstAudioFrameInterval);case 12:case"end":return n.stop()}}),n)}))),200)}},{key:"getTransportDelay",value:(r=km(Em().mark((function e(){var t=this;return Em().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(km(Em().mark((function e(){return Em().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=km(Em().mark((function e(){var t,r,n,i,o;return Em().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,tL(null===(r=this._handler)||void 0===r?void 0:r.pc);case 3:n=e.sent,i=bb(n).call(n,(function(e){return"transport"===e.type&&"connected"===e.dtlsState})),(o=bb(n).call(n,(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:XD.LOGIN},this._currentVideoRecv={startTime:0,eventSessionId:0,type:XD.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}(),uG=new RC("SendFrameObserver",0),dG=function(){function e(t,r){Wd(this,e),sd(this,"_audioEventSessionId",Aw()),sd(this,"_videoEventSessionId",Aw()),sd(this,"_pcSessionId",void 0),sd(this,"_handler",void 0),sd(this,"_firstAudioFrameTimer",void 0),sd(this,"_firstVideoFrameTimer",void 0),sd(this,"_stream",void 0),sd(this,"_firstVideoFrameInterval",void 0),sd(this,"_firstAudioFrameInterval",void 0),sd(this,"_currentAudioSend",{startTime:0,eventSessionId:0,type:XD.LOGIN}),sd(this,"_currentVideoSend",{startTime:0,eventSessionId:0,type:XD.LOGIN}),sd(this,"_login",!1),sd(this,"_publisher",!1),sd(this,"_unMuteAudio",!1),sd(this,"_enableAudio",!1),sd(this,"_unMuteVideo",!1),sd(this,"_enableVideo",!1),sd(this,"_audioExternal",!1),sd(this,"_pushAudio",!1),sd(this,"_videoExternal",!1),sd(this,"_pushVideo",!1),sd(this,"_autoPublish",!1),sd(this,"_publish",!1),sd(this,"_timeout",1e4),sd(this,"_audioFirstFrameState",0),sd(this,"_videoFirstFrameState",0),this._stream=t,this._handler=r}var t,r;return qd(e,[{key:"beginSendFrame",value:function(e,t){var r=this;if(e===KD.AUDIO){var n,i;this._audioEventSessionId++,this._currentAudioSend={startTime:Date.now(),eventSessionId:this._audioEventSessionId,type:t};var o={event_type:zD.BEGIN_SEND,media_type:e,is_screen:!(null===(n=this._stream)||void 0===n||!n.isScreen),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(){r.stopSendFrame(KD.AUDIO,qD.TIMEOUT),r._firstAudioFrameInterval&&window.clearInterval(r._firstAudioFrameInterval)}),this._timeout),uG.print("rtcFirstFrameSend",vk(o)),iP.rtcFirstFrame(o),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===KD.VIDEO){var a,s;this._videoEventSessionId++,this._currentVideoSend={startTime:Date.now(),eventSessionId:this._videoEventSessionId,type:t};var c={event_type:zD.BEGIN_SEND,media_type:e,is_screen:!(null===(a=this._stream)||void 0===a||!a.isScreen),type:t,start:null===(s=this._currentVideoSend)||void 0===s?void 0:s.startTime,event_session_id:this._videoEventSessionId};this._firstVideoFrameTimer&&window.clearTimeout(this._firstVideoFrameTimer),this._firstVideoFrameTimer=window.setTimeout((function(){r.stopSendFrame(KD.VIDEO,qD.TIMEOUT),r._firstVideoFrameInterval&&window.clearInterval(r._firstVideoFrameInterval)}),this._timeout),this._watchForFirstVideoFrameSend(),uG.print("rtcFirstFrameSend",vk(c)),iP.rtcFirstFrame(c),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===KD.AUDIO){var r,n,i;if(1!==this._audioFirstFrameState)return;var o={event_type:zD.SENT_END,media_type:e,is_screen:!(null===(r=this._stream)||void 0===r||!r.isScreen),start:null===(n=this._currentAudioSend)||void 0===n?void 0:n.startTime,reason:t,result:!1,event_session_id:this._audioEventSessionId,type:null===(i=this._currentAudioSend)||void 0===i?void 0:i.type};this._firstAudioFrameTimer&&window.clearTimeout(this._firstAudioFrameTimer),delete this._currentAudioSend,uG.print("rtcFirstFrameSend",vk(o)),iP.rtcFirstFrame(o),this._audioFirstFrameState=2}else if(e===KD.VIDEO){var a,s,c;if(1!==this._videoFirstFrameState)return;var u={event_type:zD.SENT_END,media_type:e,start:null===(a=this._currentVideoSend)||void 0===a?void 0:a.startTime,is_screen:!(null===(s=this._stream)||void 0===s||!s.isScreen),reason:t,result:!1,event_session_id:this._videoEventSessionId,type:null===(c=this._currentVideoSend)||void 0===c?void 0:c.type};this._firstVideoFrameTimer&&window.clearTimeout(this._firstVideoFrameTimer),delete this._currentVideoSend,uG.print("rtcFirstFrameSend",vk(u)),iP.rtcFirstFrame(u),this._videoFirstFrameState=2}}},{key:"sendFrameFinish",value:function(e){if(e===KD.AUDIO){var t;if(1!==this._audioFirstFrameState)return;if(!this._currentAudioSend)return;var r=this._currentAudioSend,n=r.type,i=r.startTime,o={event_type:zD.SENT_END,media_type:e,is_screen:!(null===(t=this._stream)||void 0===t||!t.isScreen),start:i,result:!0,event_session_id:this._audioEventSessionId,type:n};delete this._currentAudioSend,this._firstAudioFrameTimer&&window.clearTimeout(this._firstAudioFrameTimer),uG.print("rtcFirstFrameSend",vk(o)),iP.rtcFirstFrame(o),this._audioFirstFrameState=3}else if(e===KD.VIDEO){var a;if(1!==this._videoFirstFrameState)return;if(!this._currentVideoSend)return;var s=this._currentVideoSend,c=s.type,u=s.startTime,d={event_type:zD.SENT_END,media_type:e,is_screen:!(null===(a=this._stream)||void 0===a||!a.isScreen),start:u,result:!0,event_session_id:this._videoEventSessionId,type:c};delete this._currentVideoSend,this._firstVideoFrameTimer&&window.clearTimeout(this._firstVideoFrameTimer),uG.print("rtcFirstFrameSend",vk(d)),iP.rtcFirstFrame(d),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(KD.VIDEO,XD.LOGIN),null!==(r=this._stream)&&void 0!==r&&r.audioTrack&&this.beginSendFrame(KD.AUDIO,XD.LOGIN);!e&&this._audioSending&&this.stopSendFrame(KD.AUDIO,qD.LEAVE_ROOM),!e&&this._videoSending&&this.stopSendFrame(KD.VIDEO,qD.LEAVE_ROOM)}}},{key:"setPublish",value:function(e){if(this._publish!==e){var t,r,n,i;if(this._publish=e,e)(null===(t=this._stream)||void 0===t?void 0:t.videoTrack)&&(null===(r=this._stream)||void 0===r?void 0:r.pubVideo)&&this.beginSendFrame(KD.VIDEO,XD.PUBLISH),(null===(n=this._stream)||void 0===n?void 0:n.audioTrack)&&(null===(i=this._stream)||void 0===i?void 0:i.pubAudio)&&this.beginSendFrame(KD.AUDIO,XD.PUBLISH);!e&&this._audioSending&&this.stopSendFrame(KD.AUDIO,qD.UNPUBLISH),!e&&this._videoSending&&this.stopSendFrame(KD.VIDEO,qD.UNPUBLISH)}}},{key:"setUnmuteAudio",value:function(e){var t;this._unMuteAudio!==e&&(this._unMuteAudio=e,null!==(t=this._stream)&&void 0!==t&&t.audioHasCapture&&(e&&this.beginSendFrame(KD.AUDIO,XD.UNMUTE),!e&&this._audioSending&&this.stopSendFrame(KD.AUDIO,qD.MUTE)))}},{key:"setEnableAudio",value:function(e){var t;this._enableAudio!==e&&null!==(t=this._stream)&&void 0!==t&&t.pubAudio&&(this._enableAudio=e,e&&this.beginSendFrame(KD.AUDIO,XD.ENABLE),!e&&this._audioSending&&this.stopSendFrame(KD.AUDIO,qD.DISABLE))}},{key:"setUnmuteVideo",value:function(e){var t;this._unMuteVideo!==e&&(this._unMuteVideo=e,null!==(t=this._stream)&&void 0!==t&&t.videoHasCapture&&(e&&this.beginSendFrame(KD.VIDEO,XD.UNMUTE),!e&&this._videoSending&&this.stopSendFrame(KD.VIDEO,qD.MUTE)))}},{key:"setEnableVideo",value:function(e){var t;this._enableVideo!==e&&null!==(t=this._stream)&&void 0!==t&&t.pubVideo&&(this._enableVideo=e,e&&this.beginSendFrame(KD.VIDEO,XD.ENABLE),!e&&this._videoSending&&this.stopSendFrame(KD.VIDEO,qD.DISABLE))}},{key:"setExternalAudioSource",value:function(e){this._audioExternal!==e&&(this._audioExternal=e,e&&(this._audioSending&&this.stopSendFrame(KD.AUDIO,qD.DISABLE),this._enableAudio=!1),e||(this._audioSending&&this.stopSendFrame(KD.AUDIO,qD.STOP_PUSH),this._pushAudio=!1))}},{key:"setPushAudio",value:function(e){this._pushAudio!==e&&(this._pushAudio=e,e&&this.beginSendFrame(KD.AUDIO,XD.PUSH),!e&&this._audioSending&&this.stopSendFrame(KD.AUDIO,qD.STOP_PUSH))}},{key:"setExternalVideoSource",value:function(e){this._videoExternal!==e&&(this._videoExternal=e,e&&(this._videoSending&&this.stopSendFrame(KD.VIDEO,qD.DISABLE),this._enableVideo=!1),e||(this._videoSending&&this.stopSendFrame(KD.VIDEO,qD.STOP_PUSH),this._pushVideo=!1))}},{key:"setPushVideo",value:function(e){this._pushVideo!==e&&(this._pushVideo=e,e&&this.beginSendFrame(KD.VIDEO,XD.PUSH),!e&&this._videoSending&&this.stopSendFrame(KD.VIDEO,qD.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(KD.AUDIO,qD.AUDIENCE),!e&&this._videoSending&&this.stopSendFrame(KD.VIDEO,qD.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=km(Em().mark((function e(){var t,r,n,i,o,a,s;return Em().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("preprocessing")){e.next=5;break}return e.next=3,tL(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("preprocessing"));case 3:return s=e.sent,e.abrupt("return",bb(s).call(s,(function(e){return"outbound-rtp"===e.type})));case 5:case"end":return e.stop()}}),e,this)}))),function(){return r.apply(this,arguments)})},{key:"_getFirstAudioFrameStats",value:(t=km(Em().mark((function e(){var t,r,n,i,o,a,s;return Em().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("preprocessing")){e.next=5;break}return e.next=3,tL(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("preprocessing"));case 3:return s=e.sent,e.abrupt("return",bb(s).call(s,(function(e){return"outbound-rtp"===e.type})));case 5:case"end":return e.stop()}}),e,this)}))),function(){return t.apply(this,arguments)})},{key:"_watchForFirstVideoFrameSend",value:function(){var e=this,t=-1,r=-1;this._firstVideoFrameInterval&&window.clearInterval(this._firstVideoFrameInterval),this._firstVideoFrameInterval=window.setInterval(km(Em().mark((function n(){var i;return Em().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,e._getFirstVideoFrameStats();case 2:if(!(i=n.sent)||!(i.framesSent>t||i.packetsSent>r)){n.next=10;break}if(-1!==t||-1!==r){n.next=8;break}return t=i.framesSent,r=i.packetsSent,n.abrupt("return");case 8:e.sendFrameFinish(KD.VIDEO),window.clearInterval(e._firstVideoFrameInterval);case 10:case"end":return n.stop()}}),n)}))),100)}},{key:"_watchForFirstAudioFrameSend",value:function(){var e=this,t=-1;this._firstAudioFrameInterval&&window.clearInterval(this._firstAudioFrameInterval),this._firstAudioFrameInterval=window.setInterval(km(Em().mark((function r(){var n;return Em().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(KD.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:XD.LOGIN},this._currentVideoSend={startTime:0,eventSessionId:0,type:XD.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}(),lG=(sd(oG={},"audio",{delay:1200,stallRadio:.3}),sd(oG,"video",{delay:1200,stallRadio:.6}),sd(oG,"screen_audio",{delay:1600,stallRadio:.8}),sd(oG,"screen_video",{delay:1600,stallRadio:.8}),oG),hG=function(){function e(){Wd(this,e),sd(this,"_preUplinkStats",new uE),sd(this,"_preDownlinkStats",new uE),sd(this,"_timer",void 0),sd(this,"_delayTimer",void 0),sd(this,"_connectionState",pF.CONNECTED),sd(this,"reportor",void 0)}return qd(e,[{key:"updateUplinkStats",value:function(e){var t=e.audioStats,r=e.videoStats,n=e.isScreen;if(t.sendKBitrate>0&&t.rtt){var i,o,a=n?"screen_audio":"audio",s=t.rtt,c=t._fractionLost,u=t._retransmittedRate,d=this._getQosLevel(s,c||0,u||0),l=this._preUplinkStats.get(a)||[d];this._preUplinkStats.set(a,Sm(i=wm(o=[]).call(o,Wk(l),[d])).call(i,-2))}if(r.sentKBitrate>0&&r.rtt){var h,f,p=n?"screen_video":"video",v=r._fractionLost,_=r.rtt,m=r._sendBandWidth,g=r._retransmittedRate;0===m&&(v=Math.max(.65,v));var y=this._getQosLevel(_,v||0,g||0),S=this._preUplinkStats.get(p)||[y];this._preUplinkStats.set(p,Sm(h=wm(f=[]).call(f,Wk(S),[y])).call(h,-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,c=e.videoStats,u=e.isScreen,d=e.userId;if(o)if(0===s.receivedKBitrate)r=Od.VBAD;else{var l=s.rtt,h=s.audioLossRate,f=s.stallDuration,p=s.statsInterval,v=s.e2eDelay,_=f/p,m=u?"screen_audio":"audio",g=this._getQosLevel(l,h||0,c._retransmittedRate||0),y=this._getDownlinkQoE(m,_,v);r=this._getNetworkQuality(g,y)}if(a)if(0===c.receivedKBitrate||0===c.rtt)n=Od.VBAD;else{var S=c.rtt,E=c.videoLossRate,b=c.stallDuration,k=c.statsInterval,T=c.e2eDelay,I=c._retransmittedRate,A=b/k,R=u?"screen_video":"video",w=this._getQosLevel(S,E||0,I||0),C=this._getDownlinkQoE(R,A,T);n=this._getNetworkQuality(w,C)}var O=r&&n?Math.ceil((r+n)/2):r||n;if(O){var x,D,P,N=wm(x="".concat(d)).call(x,u?"_screen":""),M=this._preDownlinkStats.get(N)||[O];this._preDownlinkStats.set(N,Sm(D=wm(P=[]).call(P,Wk(M),[O])).call(D,-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!==pF.CONNECTED)e=t=Od.VBAD;else{var n,i,o,a=this._getBetterQualityAndRemoveOldest("audio","up"),s=this._getBetterQualityAndRemoveOldest("video","up");e=a&&s?Math.ceil((a+s)/2):a||s||this._getBetterQualityAndRemoveOldest("screen_video","up")||this._getBetterQualityAndRemoveOldest("screen_audio","up")||Od.EXCELLENT;var c=Gs(n=lk(i=Xk(yC(o=this._preDownlinkStats).call(o))).call(i,(function(e){return r._getBetterQualityAndRemoveOldest(e,"down")}))).call(n,(function(e){return e}));t=Math.ceil(TE(c).call(c,(function(e,t){return t+e}),0)/c.length)||Od.UNKNOWN}"function"==typeof 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||e<=250)&&t<=.15?1:(!e||e<=500)&&t<=.3?2:(!e||e<=750)&&t<=.45?3:(!e||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=lG[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=Od.UNKNOWN,n="up"===t?this._preUplinkStats:this._preDownlinkStats,i=n.get(e);if(i){var o=Gs(i).call(i,(function(e){return e}));o.length>0&&(r=Math.min.apply(Math,Wk(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&&Dw(t)&&r.localaudio&&r.audiostream,videoActive:n&&Pw(t)&&r.localvideo&&r.videostream}}}]),e}(),fG=function(){function e(t){Wd(this,e),sd(this,"_timer",void 0),sd(this,"_remoteVideoSizeCache",{}),sd(this,"_remoteScreenSizeCache",{}),sd(this,"onchange",void 0),this._room=t,this._start()}return qd(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,c=s[i]||{},u=c.width,d=void 0===u?0:u,l=c.height,h=void 0===l?0:l,f=a.getSettings(),p=f.width,v=void 0===p?0:p,_=f.height,m=void 0===_?0:_;h===m&&d===v||"function"==typeof e.onchange&&e.onchange(i,n.isScreen,v,m),delete s[i],(n.isScreen?r:t)[i]={width:v,height:m}}}))})),an(e._remoteVideoSizeCache).forEach((function(t){"function"==typeof e.onchange&&e.onchange(t,!1,0,0)})),an(e._remoteScreenSizeCache).forEach((function(t){"function"==typeof e.onchange&&e.onchange(t,!0,0,0)})),e._remoteVideoSizeCache=t,e._remoteScreenSizeCache=r}),1e3))}}]),e}(),pG=Xk((new TextEncoder).encode("subt")),vG={1:uR.SUBTITLE_ERR_POSTPROCESS,2:uR.SUBTITLE_ERR_CONNECTION_ERROR,3:uR.SUBTITLE_ERR_PROCESS_ERROR},_G=new RC("SubtitleTool",1),mG=function(e){if(e.extraInfo)try{var t,r=JSON.parse(e.extraInfo);r.source_language&&-1===Pb(t=["zh","en","ja"]).call(t,r.source_language)&&(delete r.source_language,e.extraInfo=vk(r))}catch(a){}else{var n,i,o=(null===(n=navigator.language)||void 0===n?void 0:n.substring(0,2))||"";Pb(i=["zh","en","ja"]).call(i,o)>-1&&(e.extraInfo=vk({source_language:o}))}},gG=function(){function e(t){var r,n,i;Wd(this,e),sd(this,"_taskId",void 0),sd(this,"_appId",void 0),sd(this,"_roomId",void 0),sd(this,"_userId",void 0),sd(this,"onEvent",void 0),sd(this,"onMessage",void 0),sd(this,"_preConfig",void 0),sd(this,"_timer",void 0),this._room=t,this._appId=null===(r=this._room._roomInfo)||void 0===r?void 0:r.appId,this._roomId=null===(n=this._room._roomInfo)||void 0===n?void 0:n.roomId,this._userId=null===(i=this._room._roomInfo)||void 0===i?void 0:i.userInfo.userId}var t,r,n;return qd(e,[{key:"start",value:(n=km(Em().mark((function e(t){var r=this;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(_G.print("start","Invoke config: %o",t),Kw(t.mode,"mode",[Ud.ASR_ONLY,Ud.ASR_AND_TRANSLATION]),t.mode!==Ud.ASR_AND_TRANSLATION||-1!==Pb(SG).call(SG,t.targetLanguage||"")){e.next=4;break}throw new lR(uR.INVALID_PARAMS,"Invalid targetLanguage.");case 4:if(!this._taskId){e.next=6;break}throw new lR(uR.SUBTITLE_ALREADY_ON,"Already turned on subtitle");case 6:return this._preConfig=t,this._taskId=(Date.now().toString()+this._roomId+this._userId).substring(0,20),e.next=10,this._room.subtitleControlMessage(this._genSubtitleSignaling("started",t,this._taskId));case 10:this._preConfig=t,this._timer=self.setTimeout((function(){var e;null===(e=r.onEvent)||void 0===e||e.call(r,{event:Vd.ERROR,errorCode:uR.TIME_OUT,errorMessage:"start subtitle timeout."}),delete r._timer,r.stop()}),3e4);case 12:case"end":return e.stop()}}),e,this)}))),function(e){return n.apply(this,arguments)})},{key:"update",value:(r=km(Em().mark((function e(t){var r;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(Kw(t.mode,"mode",[Ud.ASR_ONLY,Ud.ASR_AND_TRANSLATION]),t.mode!==Ud.ASR_AND_TRANSLATION||-1!==Pb(SG).call(SG,t.targetLanguage||"")){e.next=3;break}throw new lR(uR.INVALID_PARAMS,"Invalid targetLanguage.");case 3:if(!this._taskId){e.next=5;break}throw new lR(uR.SUBTITLE_ALREADY_ON,"Already started subtitle");case 5:if(this._taskId){e.next=7;break}throw new lR(uR.SUBTITLE_NOT_TURNED_ON,"Start subtitle first.");case 7:if((null===(r=this._preConfig)||void 0===r?void 0:r.mode)===t.mode&&this._preConfig.targetLanguage===t.targetLanguage){e.next=11;break}return this._preConfig=t,e.next=11,this._room.subtitleControlMessage(this._genSubtitleSignaling("update",t,this._taskId));case 11:case"end":return e.stop()}}),e,this)}))),function(e){return r.apply(this,arguments)})},{key:"stop",value:function(){var e=this;_G.print("stop","Invoke"),this._taskId&&this._room.subtitleControlMessage({type:"subtitle",action:"stopped",appId:this._appId,roomId:this._roomId,userId:this._userId,taskId:this._taskId}).finally((function(){var t;delete e._taskId,null===(t=e.onEvent)||void 0===t||t.call(e,{event:Vd.STOPPED}),e._clearTimer()}))}},{key:"reconnect",value:(t=km(Em().mark((function e(){return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this._taskId||!this._preConfig){e.next=5;break}return e.next=3,this._room.subtitleControlMessage({type:"subtitle",action:"stopped",appId:this._appId,roomId:this._roomId,userId:this._userId,taskId:this._taskId});case 3:delete this._taskId,this.start(this._preConfig);case 5:case"end":return e.stop()}}),e,this)}))),function(){return t.apply(this,arguments)})},{key:"getConfig",value:function(){return this._preConfig}},{key:"destroy",value:function(){_G.print("destroy","Invoke"),this.stop(),delete this._preConfig,delete this._taskId}},{key:"onResult",value:function(e){var t=e.body,r=t.error,n=t.errorMessage,i=t.eventType;if(0!==r){var o,a=new lR(vG[r]||uR.SUBTITLE_ERR_UNKNOWN,n||"");null===(o=this.onEvent)||void 0===o||o.call(this,{event:Vd.ERROR,errorCode:a.code,errorMessage:a.message}),this._clearTimer()}else if("SubtitleStarted"===i){var s;null===(s=this.onEvent)||void 0===s||s.call(this,{event:Vd.STARTED}),this._clearTimer()}}},{key:"onMessageRecv",value:function(e){if(this._taskId&&this._preConfig){var t=yG(e);if(t&&t.length>0){var r,n,i=this._preConfig,o=i.mode,a=i.targetLanguage,s=lk(r=Gs(t).call(t,(function(e){return o===Ud.ASR_ONLY?e.mode===o:o===Ud.ASR_AND_TRANSLATION&&e.language===a}))).call(r,(function(e){return{userId:e.userId,text:e.text,definite:e.definite,sequence:e.sequence}}));if(s.length>0)null===(n=this.onMessage)||void 0===n||n.call(this,s)}return!!t}return!1}},{key:"_genSubtitleSignaling",value:function(e,t,r){return{taskId:r,type:"subtitle",action:e,roomId:this._roomId,appId:this._appId,userId:this._userId,subtitleMeta:{subtitleConfig:{mode:t.mode,usersConfig:[{userId:this._userId,targetLanguages:[t.targetLanguage||""]}]},vendorConfig:{type:0}}}}},{key:"_clearTimer",value:function(){this._timer&&(self.clearTimeout(this._timer),delete this._timer)}}]),e}(),yG=function(e){var t=e.message;if(t instanceof ArrayBuffer&&t.byteLength>8)try{var r=new DataView(t,0),n=0;if(pG.every((function(e){return r.getUint8(n++)===e}))){var i=r.getUint32(n);if(n+=4,i===r.byteLength-8){var o=dw.ab2str(Sm(t).call(t,8)),a=JSON.parse(o),s=a.data;if("subtitle"===a.type)return s}}}catch(c){}return!1},SG=["zh","zh-Hant","tn","vi","iu","it","id","hi","en","ho","he","es","el","uk","ur","tk","tr","ti","ty","tl","to","th","ta","te","sl","sk","ss","eo","sm","sg","st","sv","ja","tw","qu","pt","pa","no","nb","nr","my","bn","mn","mh","mk","ml","mr","ms","lu","ro","lt","lv","lo","kj","hr","kn","ki","cs","ca","nl","ko","ht","gu","ka","kl","km","lg","kg","fi","fj","fr","ru","ng","de","tt","da","ts","cv","fa","bs","pl","bi","nd","ba","bg","az","ar","af","sq","ab","os","ee","et","ay","lzh","am","ckb","cy","gl","ha","hy","ig","kmr","ln","nso","ny","om","sn","so","sr","sw","xh","yo","zu"],EG=new RC("Room",1),bG={audiostream:!0,extaudio:!1,extvideo:!1,localaudio:!0,localvideo:!1,videoDescriptions:[],videostream:!1},kG=function(e){OI(I,e);var t,r,n,i,o,a,s,c,u,d,l,h,f,p,v,_,m,g,y,S,E,b,k,T=qI(I);function I(e,t){var r;return Wd(this,I),sd(ZT(r=T.call(this)),"id",void 0),sd(ZT(r),"_mediaServerClient",void 0),sd(ZT(r),"_localStream",void 0),sd(ZT(r),"_localScreenStream",void 0),sd(ZT(r),"_remoteUsers",new uE),sd(ZT(r),"_remoteStreams",new uE),sd(ZT(r),"_remoteStreamStreamIdUserIdMap",{}),sd(ZT(r),"_virtualStreams",[]),sd(ZT(r),"_joinResolveCallback",void 0),sd(ZT(r),"_joinRejectCallback",void 0),sd(ZT(r),"_getAccessNode",void 0),sd(ZT(r),"_getAccessFeedback",void 0),sd(ZT(r),"_getAccessFeedbackIceNode",void 0),sd(ZT(r),"_reconnectTimer",void 0),sd(ZT(r),"_isReconnecting",void 0),sd(ZT(r),"_context",void 0),sd(ZT(r),"_sessionId",void 0),sd(ZT(r),"_reconnectRecord",void 0),sd(ZT(r),"_connectionLostTimer",void 0),sd(ZT(r),"_liveControlMessage",void 0),sd(ZT(r),"_serverConfig",void 0),sd(ZT(r),"_liveTranscodingOnceSucc",!1),sd(ZT(r),"_roomConfig",void 0),sd(ZT(r),"_roomInfo",void 0),sd(ZT(r),"_waitForNewToken",!1),sd(ZT(r),"_userDuplicateLoginTimerMap",new uE),sd(ZT(r),"_networkQualityManager",void 0),sd(ZT(r),"_videoSizeObserver",void 0),sd(ZT(r),"_hasPublished",!1),sd(ZT(r),"_subtitleTool",void 0),sd(ZT(r),"_csrcUserIdMap",void 0),sd(ZT(r),"_publishOnDemandItem",void 0),sd(ZT(r),"_publishOnDemandBusy",!1),r.id=null==t?void 0:t.id,r._roomConfig=e,r._mediaServerClient=new _F(t),r._reconnectRecord=new TG,r._addHandlerEventHandler(),r._isReconnecting=!1,r._networkQualityManager=new hG,r._networkQualityManager.reportor=r._reportNetworkQuality.bind(ZT(r)),r._videoSizeObserver=new fG(ZT(r)),r._videoSizeObserver.onchange=r._emitVideoSizeChange.bind(ZT(r)),r._context=t,r._csrcUserIdMap={},r}return qd(I,[{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,c,u,d,l,h,f,p,v,_,m,g,y,S,E,b,k,T,I,A,R,w,C,O=this;null===(e=this._mediaServerClient)||void 0===e||e.on(UP.ON_ADD_STREAM,this._onAddStream.bind(this)),null===(t=this._mediaServerClient)||void 0===t||t.on(UP.ON_ADD_STREAM_LIST,(function(e){Array.isArray(null==e?void 0:e.streamList)&&e.streamList.forEach((function(e){return O._onAddStream(e)}))})),null===(r=this._mediaServerClient)||void 0===r||r.on(UP.ON_REMOVE_STREAM,this._onRemoveStream.bind(this)),null===(n=this._mediaServerClient)||void 0===n||n.on(UP.ON_REMOVE_STREAM_LIST,(function(e){Array.isArray(null==e?void 0:e.streamList)&&e.streamList.forEach((function(e){return O._onRemoveStream(e)}))})),null===(i=this._mediaServerClient)||void 0===i||i.on(UP.USER_CONNECTION,this._onUserConnection.bind(this)),null===(o=this._mediaServerClient)||void 0===o||o.on(UP.USER_CONNECTION_LIST,(function(e){Array.isArray(null==e?void 0:e.userList)&&e.userList.forEach((function(e){return O._onUserConnection(e)}))})),null===(a=this._mediaServerClient)||void 0===a||a.on(UP.USER_DISCONNECTION,this._onUserDisconnection.bind(this)),null===(s=this._mediaServerClient)||void 0===s||s.on(UP.USER_DISCONNECTION_LIST,(function(e){Array.isArray(null==e?void 0:e.userList)&&e.userList.forEach((function(e){return O._onUserDisconnection(e)}))})),null===(c=this._mediaServerClient)||void 0===c||c.on(UP.ON_UPDATE_ROOM_ATTRIBUTES,this._onUpdateRoomAttributes.bind(this)),null===(u=this._mediaServerClient)||void 0===u||u.on(UP.ON_UPDATE_USER_ATTRIBUTES,this._onUpdateUserAttributes.bind(this)),null===(d=this._mediaServerClient)||void 0===d||d.on(UP.ON_UPDATE_STREAM_ATTRIBUTES,this._onUpdateStreamAttributes.bind(this)),null===(l=this._mediaServerClient)||void 0===l||l.on(UP.ON_PUSH_TRACK,this._onPushTrack.bind(this)),null===(h=this._mediaServerClient)||void 0===h||h.on(UP.ON_REMOVE_TRACK,this._onRemoveTrack.bind(this)),null===(f=this._mediaServerClient)||void 0===f||f.on(UP.NODE_CHANGE,this._nodeChange.bind(this)),null===(p=this._mediaServerClient)||void 0===p||p.on(UP.ON_CUSTOM_MESSAGE,this._onCustomMessage.bind(this)),null===(v=this._mediaServerClient)||void 0===v||v.on(UP.USER_MESSAGE_RECEIVED,this._onUserMessageReceived.bind(this)),null===(_=this._mediaServerClient)||void 0===_||_.on(UP.USER_BINARY_MESSAGE_RECEIVED,this._onUserBinaryMessageReceived.bind(this)),null===(m=this._mediaServerClient)||void 0===m||m.on(UP.POST_PROCESSING_MESSAGE,this._onPostProcessingMessage.bind(this)),null===(g=this._mediaServerClient)||void 0===g||g.on(UP.ON_USER_TOKEN_WILL_EXPIRE,this._onUserTokenWillExpire.bind(this)),null===(y=this._mediaServerClient)||void 0===y||y.on(UP.STREAM_CONTROL_MESSAGE,this._onStreamControlMessage.bind(this)),null===(S=this._mediaServerClient)||void 0===S||S.on(UP.ON_STREAM_FAILED,this._onStreamFailed.bind(this)),null===(E=this._mediaServerClient)||void 0===E||E.on(VP.RSCP,(function(e){!!bb(e).call(e,(function(e){var t,r,n;return null==e||null===(t=e.StreamIds)||void 0===t?void 0:Jm(t).call(t,null===(r=O._localStream)||void 0===r||null===(n=r.stream)||void 0===n?void 0:n.id)}))&&(O._publishOnDemandItem=e,O._onPublishOnDemand())})),null===(b=this._mediaServerClient)||void 0===b||b.on(VP.RTT,this._onRTT.bind(this)),null===(k=this._mediaServerClient)||void 0===k||k.on(FP.ON_CONNECTION_STATE_CHANGE,this._onConnectionStateChange.bind(this)),null===(T=this._mediaServerClient)||void 0===T||T.on(FP.ABNORMAL_DISCONNECTION,this._handleAbnormalDisconnection.bind(this)),null===(I=this._mediaServerClient)||void 0===I||I.on(UP.ON_SPEAKER_CHANGE,this._onMeetingSpeakerChange.bind(this)),null===(A=this._mediaServerClient)||void 0===A||A.on("onRemoteStreamStats",(function(e){O._networkQualityManager.updateDownlinkStats(e,O._findRemoteStreamByScreen(e.userId,e.isScreen)),O.emit(iF.ON_REMOTE_STREAM_STATS,Nw(e))})),null===(R=this._mediaServerClient)||void 0===R||R.on("onLocalStreamStats",(function(e){O._networkQualityManager.updateUplinkStats(e),O.emit(iF.ON_LOCAL_STREAM_STATS,Nw(e))})),null===(w=this._mediaServerClient)||void 0===w||w.on("prevIceNode",(function(e){O._getAccessFeedbackIceNode=e})),null===(C=this._mediaServerClient)||void 0===C||C.on("prevIceNode",(function(e){O._getAccessFeedbackIceNode=e}))}},{key:"_removeHandlerEventHandler",value:function(){var e;null===(e=this._mediaServerClient)||void 0===e||e.removeAllListeners()}},{key:"join",value:(k=km(Em().mark((function e(t,r,n,i,o,a,s){var c=this;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return sP.setStats({rtc_app_id:t,room_id:r,user_id:i.userId}),aG.setStats({rtc_session_id:t,rtc_room_id:r}),EG.print("join()"),e.abrupt("return",new X_((function(e,u){var d,l,h=sw();c._joinResolveCallback=function(t){var r;iP.joinRoom(YD.END,h,!0,"",{enable_cloud_proxy:null===(r=c._roomInfo)||void 0===r?void 0:r.useCloudProxy}),c._initSubtitleTool(),e(t)},c._joinRejectCallback=function(e){var t;Array.isArray(e)&&e.length&&(e=e[0]),iP.joinRoom(YD.END,h,!1,e.message,{enable_cloud_proxy:null===(t=c._roomInfo)||void 0===t?void 0:t.useCloudProxy}),u(e)},c._liveControlMessage=o,c._roomInfo={appId:t,roomId:r,token:n,userInfo:i,useCloudProxy:a,roomProfile:c._roomConfig.roomProfileType,expectedIDC:s},c.setSessionId(),iP.joinRoom(YD.BEGIN,h,!1,"",{enable_cloud_proxy:null===(d=c._roomInfo)||void 0===d?void 0:d.useCloudProxy,expectedIDC:null===(l=c._roomInfo)||void 0===l?void 0:l.expectedIDC}),c._join(c._joinResolveCallback,c._joinRejectCallback,!1)})));case 4:case"end":return e.stop()}}),e)}))),function(e,t,r,n,i,o,a){return k.apply(this,arguments)})},{key:"_join",value:(b=km(Em().mark((function e(t,r){var n,i,o,a,s=arguments;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=s.length>2&&void 0!==s[2]&&s[2],i=sw(),EG.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:a=e.sent,this._mediaServerClient.roomAttributes=a.roomAttributes,null!==(o=a.roomAttributes)&&void 0!==o&&o.multiChatMode&&this._handleFFAudioTrack(),this._reconnectRecord.clear(),this._joinResolveCallback=void 0,this._joinRejectCallback=void 0,this._getAccessFeedback=void 0,this._getAccessNode=void 0,"function"==typeof t&&t({users:a.clients,streams:a.streams}),this._isReconnecting=!1,iP.rtcJoinRoom(0,"web","web",sw()-i),this._onJoinSucc(a,n),e.next=26;break;case 20:if(e.prev=20,e.t0=e.catch(3),this._getAccessFeedback=void 0,this._getAccessNode=void 0,e.t0.code===uR.OPERATION_CANCEL||"function"!=typeof r){e.next=26;break}return e.abrupt("return",r(e.t0));case 26:case"end":return e.stop()}}),e,this,[[3,20]])}))),function(e,t){return b.apply(this,arguments)})},{key:"publishScreen",value:(E=km(Em().mark((function e(t,r,n,i,o){var a,s,c,u,d,l,h,f,p,v;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(EG.print("publishScreen()"),this._localScreenStream||(this._localScreenStream=new jV,this._localScreenStream.isScreen=!0,this._mediaServerClient.handler&&(this._localScreenStream.observer=new dG(this._localScreenStream,this._mediaServerClient.handler))),a=!1,s=!1,c=!1,u=!1,!this._localScreenStream.videoTrack&&r?(r instanceof JU&&(s=!0),a=!0):this._localScreenStream.videoTrack&&!r&&(a=!1),!this._localScreenStream.audioTrack&&n?(n instanceof ZU&&(u=!0),c=!0):this._localScreenStream.audioTrack&&!n&&(c=!1),this._localScreenStream.videoTrack=r,this._localScreenStream.audioTrack=n,this._localScreenStream.videoEncodeConfig=t,i&&(Dw(i)&&(this._localScreenStream.pubAudio=o===aF.PUB),Pw(i)&&(this._localScreenStream.pubVideo=o===aF.PUB),EG.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),u?null===(p=this._localScreenStream.observer)||void 0===p||p.setPushAudio(c):null===(v=this._localScreenStream.observer)||void 0===v||v.setEnableAudio(c),e.next=28,this.updatePubScreenTrack();case 28:case"end":return e.stop()}}),e,this)}))),function(e,t,r,n,i){return E.apply(this,arguments)})},{key:"updatePubScreenTrack",value:(S=km(Em().mark((function e(){return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(EG.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 S.apply(this,arguments)})},{key:"unpublishScreen",value:(y=km(Em().mark((function e(){var t;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(EG.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 y.apply(this,arguments)})},{key:"liveControlMessage",value:(g=km(Em().mark((function e(t){var r,n=this;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return EG.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,this._liveTranscodingOnceSucc=!1),this._liveTranscodingOnceSucc=!0;case 7:case"end":return e.stop()}}),e,this)}))),function(e){return g.apply(this,arguments)})},{key:"publicStreamControlMessage",value:(m=km(Em().mark((function e(t){return Em().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 m.apply(this,arguments)})},{key:"subtitleControlMessage",value:(_=km(Em().mark((function e(t){return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._mediaServerClient.controlMessage(t);case 2:case"end":return e.stop()}}),e,this)}))),function(e){return _.apply(this,arguments)})},{key:"updateUserAttributes",value:(v=km(Em().mark((function e(t){return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return EG.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 v.apply(this,arguments)})},{key:"publish",value:(p=km(Em().mark((function e(t,r,n,i,o,a){var s,c,u,d,l,h,f,p,v,_,m,g,y=arguments;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(s=y.length>6&&void 0!==y[6]&&y[6],EG.print("publish","Invoke publish"),c=!1,this._localStream||(this._localStream=new jV,this._mediaServerClient.handler&&(this._localStream.observer=new dG(this._localStream,this._mediaServerClient.handler)),c=!0),this._localStream.videoTrack=n,this._localStream.audioTrack=i,this._localStream.videoEncodeConfig=t,this._localStream.enableSimulcast=r,o&&(Dw(o)&&(this._localStream.pubAudio=a===aF.PUB),Pw(o)&&(this._localStream.pubVideo=a===aF.PUB),EG.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===(u=this._localStream.observer)||void 0===u||u.setLogin(!0):c&&(d=!!this._localStream.videoTrack,l=!!this._localStream.audioTrack,h=this._localStream.videoTrack instanceof JU,f=this._localStream.audioTrack instanceof ZU,this._roomConfig.isAutoPublish&&!this._hasPublished?(d&&(h?null===(p=this._localStream.observer)||void 0===p||p.setPushVideo(!0):null===(v=this._localStream.observer)||void 0===v||v.setEnableVideo(!0)),l&&(f?null===(_=this._localStream.observer)||void 0===_||_.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(iF.ON_PUBLISH_RESULT,{isScreen:!1,state:_d.PUBLISH_SUCC}),e.next=24;break;case 20:throw e.prev=20,e.t0=e.catch(12),this.emit(iF.ON_PUBLISH_RESULT,{isScreen:!1,state:_d.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 p.apply(this,arguments)})},{key:"updatePubTrack",value:(f=km(Em().mark((function e(){return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(EG.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 f.apply(this,arguments)})},{key:"unpublish",value:(h=km(Em().mark((function e(){return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(EG.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 h.apply(this,arguments)})},{key:"subscribe",value:(l=km(Em().mark((function e(t,r,n){var i;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return EG.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 l.apply(this,arguments)})},{key:"updateSubTrack",value:(d=km(Em().mark((function e(t,r,n,i){var o,a;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(EG.print("updateSubTrack","Invoke updateSubTrack"),!i){e.next=4;break}return e.next=4,null===(a=this._mediaServerClient)||void 0===a?void 0:a.updateSubTrackLayer(t,i);case 4:return e.abrupt("return",null===(o=this._mediaServerClient)||void 0===o?void 0:o.updateSubTrack(t,r,n));case 5:case"end":return e.stop()}}),e,this)}))),function(e,t,r,n){return d.apply(this,arguments)})},{key:"updateSubVideoConfig",value:(u=km(Em().mark((function e(t,r){var n,i,o,a,s;return Em().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.updateSubTrackLayer(a,s));case 6:case"end":return e.stop()}}),e,this)}))),function(e,t){return u.apply(this,arguments)})},{key:"_getSubLayer",value:function(e,t){for(var r,n,i,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,f=0;f<(null==d?void 0:d.length);f++){var p,v;if(h>=(null===(p=d[f])||void 0===p?void 0:p.width)*(null===(v=d[f])||void 0===v?void 0:v.height)){l=f;break}}var _=d[0];if(-1===l)_=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);_=g<.1?d[l-1]:d[l],l=g<.1?l-1:l}return a=null!==(r=null===(n=_)||void 0===n?void 0:n.sub_index)&&void 0!==r?r:-1,{spatialLayer:null!==(i=null===(o=_)||void 0===o?void 0:o.video_index)&&void 0!==i?i:l,spatialSubLayer:a}}},{key:"unsubscribe",value:(c=km(Em().mark((function e(t,r){return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return EG.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 c.apply(this,arguments)})},{key:"startSubtitle",value:(s=km(Em().mark((function e(t){return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this._subtitleTool){e.next=5;break}return e.next=3,this._subtitleTool.start(t);case 3:e.next=6;break;case 5:throw new lR(uR.INVOKED_BEFORE_JOIN_ROOM,"join first");case 6:case"end":return e.stop()}}),e,this)}))),function(e){return s.apply(this,arguments)})},{key:"stopSubtitle",value:(a=km(Em().mark((function e(){var t;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:null===(t=this._subtitleTool)||void 0===t||t.stop();case 1:case"end":return e.stop()}}),e,this)}))),function(){return a.apply(this,arguments)})},{key:"leave",value:(o=km(Em().mark((function e(){var t,r,n,i,o,a,s,c,u=arguments;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:r=u.length>0&&void 0!==u[0]&&u[0],EG.print("leave","Invoke leave"),n=sw(),null===(t=this._subtitleTool)||void 0===t||t.destroy(),delete this._subtitleTool,e.prev=5,this._mediaServerClient.connectionState!==pF.CONNECTED&&this._joinRejectCallback&&this._joinRejectCallback(new Error(QD.LEAVE_ROOM)),clearTimeout(this._reconnectTimer),o=QT(tA(i=this._remoteStreams).call(i));try{for(o.s();!(a=o.n()).done;)s=a.value,Array.isArray(s)&&s.forEach((function(e){var t;null===(t=e.observer)||void 0===t||t.setLogin(!1)}))}catch(d){o.e(d)}finally{o.f()}return this._localStream&&(null===(c=this._localStream.observer)||void 0===c||c.setLogin(!1)),e.next=13,this._mediaServerClient.leave();case 13:this.destroy(),iP.rtcLeaveRoom(0,"",sw()-n),sP.setStats({room_id:void 0,user_id:void 0,rtc_session_id:void 0}),aG.setStats({rtc_room_id:void 0}),e.next=27;break;case 19:if(e.prev=19,e.t0=e.catch(5),!r){e.next=25;break}throw e.t0;case 25:this.destroy();case 26:e.t0 instanceof Error&&iP.rtcLeaveRoom(-1,e.t0.message,sw()-n);case 27:case"end":return e.stop()}}),e,this,[[5,19]])}))),function(){return o.apply(this,arguments)})},{key:"updateRemoteUserPriority",value:function(e){var t,r=this;null===(t=this.remoteStreams.get(e))||void 0===t||t.forEach((function(e){e.streamState!==BV.INIT&&r._mediaServerClient.subscribe(e,e.subMediaType)}))}},{key:"destroy",value:function(){var e;EG.print("destroy","Invoke destroy"),iP.rtcInvokeStatus("".concat((new Error).stack),0,"room_destroy","",0),null===(e=this._subtitleTool)||void 0===e||e.destroy(),delete this._subtitleTool,this._destroyAndInitMediaServerClient(),this._roomInfo=void 0,this._remoteUsers=new uE;var t,r,n,i=QT(this._remoteStreams);try{for(i.s();!(t=i.n()).done;){var o=JT(t.value,2)[1];Array.isArray(o)&&o.forEach((function(e){e&&e.clean()}))}}catch(a){i.e(a)}finally{i.f()}(this._virtualStreams.forEach((function(e){null==e||e.clean()})),this._remoteStreams=new uE,this._localStream)&&(null===(r=this._localStream)||void 0===r||r.clean(),this._localStream=void 0);this._localScreenStream&&(null===(n=this._localScreenStream)||void 0===n||n.clean(),this._localScreenStream=void 0);this._context=void 0,this._reconnectRecord=new TG,this._removeHandlerEventHandler(),clearTimeout(this._connectionLostTimer),this._userDuplicateLoginTimerMap.forEach((function(e){clearTimeout(e)})),this._userDuplicateLoginTimerMap.clear(),this._networkQualityManager.destroy(),this._videoSizeObserver.destroy(),this._csrcUserIdMap={},this._virtualStreams=[],this._remoteStreamStreamIdUserIdMap={}}},{key:"updateToken",value:(i=km(Em().mark((function e(t){return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return EG.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 i.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=nw(),sP.setStats({rtc_session_id:this._sessionId}),aG.setStats({rtc_session_id:this._sessionId})}},{key:"sendRoomMessage",value:(n=km(Em().mark((function e(t){var r,n,i,o,a,s=arguments;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(o=s.length>1&&void 0!==s[1]&&s[1],a={clientId:null===(r=this._roomInfo)||void 0===r?void 0:r.userInfo.userId,binary:o,message:"",roomId:null===(n=this._roomInfo)||void 0===n?void 0:n.roomId},!o){e.next=8;break}return e.next=5,dw.ab2b64str(t);case 5:a.message=e.sent,e.next=9;break;case 8:a.message=t;case 9:return e.abrupt("return",null===(i=this._mediaServerClient)||void 0===i?void 0:i.sendRoomMessage(a));case 10:case"end":return e.stop()}}),e,this)}))),function(e){return n.apply(this,arguments)})},{key:"_destroyAndInitMediaServerClient",value:function(){EG.print("_destroyAndInitMediaServerClient()"),this._mediaServerClient&&(this._mediaServerClient.destroy(),this._removeHandlerEventHandler()),this._mediaServerClient=new _F(this._context),this._addHandlerEventHandler()}},{key:"_onJoinSucc",value:function(e,t){var r,n,i,o=this;EG.print("JoinSuccess()"),this._serverConfig=e.config;var a=[],s=[],c=[],u=[],d=[];null===(r=e.clientsDetail)||void 0===r||r.forEach((function(t){if(t.attributes&&(t.attributes.serverMuteVideo&&o.safeEmit(iF.ON_VIDEO_STREAM_BANNED,{uid:t.clientId,banned:1===t.attributes.serverMuteVideo}),t.attributes.serverMuteAudio&&o.safeEmit(iF.ON_AUDIO_STREAM_BANNED,{uid:t.clientId,banned:1===t.attributes.serverMuteAudio})),t.clientId!==e.clientId){var r=o._remoteUsers.get(t.clientId);r?r._stillExist=!0:a.push(t)}}));var l,h=QT(tA(n=this._remoteUsers).call(n));try{for(h.s();!(l=h.n()).done;){var f=l.value;f._stillExist||s.push({clientId:f.userId}),delete f._stillExist}}catch(m){h.e(m)}finally{h.f()}e.streams.forEach((function(e){var t=o._findRemoteStreamByScreen(e.clientId,e.screen);t?(t.stillExist=!0,t.streamId=e.streamId,d.push(e)):u.push(e)}));var p,v=QT(tA(i=this._remoteStreams).call(i));try{for(v.s();!(p=v.n()).done;){var _=p.value;Array.isArray(_)&&_.forEach((function(e){e.stillExist?delete e.stillExist:c.push({clientId:e.userId,streamId:e.streamId,message:MP.clientDisconnected})}))}}catch(m){v.e(m)}finally{v.f()}s.forEach((function(e){return o._onUserDisconnection(e)})),a.forEach((function(e){return o._onUserConnection(e)})),c.forEach((function(e){return o._onRemoveStream(e)})),u.forEach((function(e){return o._onAddStream(e,{fromSignal:!1})})),d.forEach((function(e){return o._onUpdateStreamAttributes(e)})),t&&this._handleSendOrRecvStreamAfterReconnect()}},{key:"_handleSendOrRecvStreamAfterReconnect",value:function(){var e,t,r=this;this._localStream&&(this._localStream.clean(),this._mediaServerClient.publish(this._localStream).catch((function(e){}))),this._localScreenStream&&(this._localScreenStream.clean(),this._mediaServerClient.publish(this._localScreenStream).catch((function(e){})));var n,i=QT(tA(t=this._remoteStreams).call(t));try{for(i.s();!(n=i.n()).done;){var o=n.value;Array.isArray(o)&&o.forEach(function(){var e=km(Em().mark((function e(t){var n,i,o,a;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!t.hasSubscribed){e.next=15;break}return t.resetHasSubscribed(),e.prev=2,EG.print(wm(n="start resubscribe ".concat(t.userId," with ")).call(n,t.subMediaType)),e.next=6,r._mediaServerClient.subscribe(t,t.subMediaType);case 6:EG.print(wm(i="success resubscribe ".concat(t.userId," with ")).call(i,t.subMediaType)),r.safeEmit(iF.RESUBSCRIBE,{stream:t}),e.next=15;break;case 10:e.prev=10,e.t0=e.catch(2),EG.print(wm(o=wm(a="failed resubscribe ".concat(t.userId," with ")).call(a,t.subMediaType,", error:")).call(o,e.t0)),t.clean(),null==t||t.resetHasSubscribed();case 15:case"end":return e.stop()}}),e,null,[[2,10]])})));return function(t){return e.apply(this,arguments)}}())}}catch(a){i.e(a)}finally{i.f()}null===(e=this._subtitleTool)||void 0===e||e.reconnect()}},{key:"_handleFFAudioTrack",value:function(){var e,t,r,n,i=null===(e=this._mediaServerClient)||void 0===e||null===(t=e.handler)||void 0===t?void 0:t.audioTrack4ff,o=null===(r=this._mediaServerClient)||void 0===r||null===(n=r.handler)||void 0===n?void 0:n.getTransceivers();if(i&&Array.isArray(o)){var a=bb(o).call(o,(function(e){var t;return(null==e||null===(t=e.receiver)||void 0===t?void 0:t.track)===i}));if(a){var s=new GV("ff-stream","ff-stream",!1,bG);s.virtual=!0,s.audioTransceiver=a,s.audioMid="0",s.audioTrack=fV(i),this._virtualStreams.push(s),this.safeEmit(iF.SUBSCRIBE_PUSH_TRACK,{stream:s})}}}},{key:"_findRemoteStream",value:function(e,t){var r=this._remoteStreams.get(e);return Array.isArray(r)?bb(r).call(r,(function(e){return e.streamId===t})):null}},{key:"_findRemoteStreamByScreen",value:function(e,t){var r=this._remoteStreams.get(e);return Array.isArray(r)?bb(r).call(r,(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=r.needEmit,i=void 0===n||n,o=r.fromSignal,a=void 0===o||o,s=r.virtual,c=void 0!==s&&s;if(e.clientId!==(null===(t=this._roomInfo)||void 0===t?void 0:t.userInfo.userId)){var u=this._roomConfig,d=u.isAutoSubscribeAudio,l=u.isAutoSubscribeVideo,h=this._findRemoteStreamByScreen(e.clientId,e.screen);if(h&&h.streamId!==e.streamId){var f,p=null===(f=this._remoteStreams.get(e.clientId))||void 0===f?void 0:Gs(f).call(f,(function(e){return e.streamId!==h.streamId}));h.clean(),this._remoteStreams.set(e.clientId,p||[])}var v=this._findRemoteStream(e.clientId,e.streamId);if(this._remoteStreamStreamIdUserIdMap[e.streamId]=e.clientId,v)v.attributes=e.attributes;else if((v=new GV(e.clientId,e.streamId,e.screen,e.attributes)).virtual=c,this._initStreamListeners(v),!c){var _=this._remoteStreams.get(e.clientId);_?_.push(v):this._remoteStreams.set(e.clientId,[v])}if(this._mediaServerClient.handler&&(v.observer=new cG(v,this._mediaServerClient.handler)),!v.isScreen&&l){var m,g,y,S,E,b,k,T;if(a&&v.hasVideo)if(v.attributes.extvideo)null===(m=v.observer)||void 0===m||m.setExternalVideoSource(!0),null===(g=v.observer)||void 0===g||g.setPushVideo(!0);else null===(y=v.observer)||void 0===y||y.setExternalVideoSource(!1),null===(S=v.observer)||void 0===S||S.setPublishVideo(!0);if(a&&v.hasAudio&&d&&!this._mediaServerClient.roomAttributes.multiChatMode)if(v.attributes.extaudio)null===(E=v.observer)||void 0===E||E.setExternalAudioSource(!0),null===(b=v.observer)||void 0===b||b.setPushAudio(!0);else null===(k=v.observer)||void 0===k||k.setExternalAudioSource(!1),null===(T=v.observer)||void 0===T||T.setPublishAudio(!0);if(!0===i&&!1===a){var I,A=this._roomConfig,R=A.isAutoSubscribeAudio,w=A.isAutoSubscribeVideo;null===(I=v.observer)||void 0===I||I.setLogin(!0,{audio:!!R,video:!!w})}}return i&&this.safeEmit(UP.ON_ADD_STREAM,{stream:v}),v}}},{key:"_onUserConnection",value:function(e){var t;if(e.clientId!==(null===(t=this._roomInfo)||void 0===t?void 0:t.userInfo.userId)){var r=this._userDuplicateLoginTimerMap.get(e.clientId);if("number"==typeof r)return this._userDuplicateLoginTimerMap.delete(e.clientId),void self.clearTimeout(r);var n={userId:e.clientId,extraInfo:e.attributes.extra_info};this._remoteUsers.set(e.clientId,ud({},n)),this.safeEmit(UP.USER_CONNECTION,{userInfo:n}),e.attributes&&(e.attributes.serverMuteVideo&&this.safeEmit(iF.ON_VIDEO_STREAM_BANNED,{uid:e.clientId,banned:1===e.attributes.serverMuteVideo}),e.attributes.serverMuteAudio&&this.safeEmit(iF.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===BP.kickedByAdmin?a=uR.KICKED_OUT:i===BP.onUserTokenDidExpire?a=uR.TOKEN_EXPIRED:i===BP.userDuplicateLogin&&(a=uR.DUPLICATE_LOGIN),o===jP.roomDismissByAdmin&&(a=uR.ROOM_DISMISS),a&&this.safeEmit(iF.ON_ROOM_ERROR,{errorCode:a})}else{var s=hd.DROPPED;i===BP.userLeave?s=hd.QUIT:i===BP.kickedByAdmin?s=hd.KICKED_BY_ADMIN:i===BP.roleChanged&&(s=hd.SWITCH_TO_INVISIBLE);var c=function(){var e;r._remoteUsers.delete(n),null===(e=r._remoteStreams.get(n))||void 0===e||e.forEach((function(e){e.clean(),r._onRemoveStream({clientId:e.userId,streamId:e.streamId,message:MP.clientDisconnected})})),r._remoteStreams.delete(n),r.safeEmit(iF.ON_USER_LEAVE,{userInfo:{userId:n},reason:s})};if(i===BP.userDuplicateLogin){var u=this._userDuplicateLoginTimerMap.get(n);u&&self.clearTimeout(u);var d=self.setTimeout(c,5e3);this._userDuplicateLoginTimerMap.set(n,d)}else c()}}},{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=bb(n).call(n,(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(){var t=r._remoteStreams.get(e.clientId);t&&(t=Gs(t).call(t,(function(t){return t.streamId!==e.streamId||(t.clean(),!1)})),r._remoteStreams.set(e.clientId,t))})).finally((function(){r.safeEmit(UP.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(iF.ON_VIDEO_STREAM_BANNED,{uid:e.clientId,banned:1===e.attributes.serverMuteVideo}),e.attributes.serverMuteAudio&&this.safeEmit(iF.ON_AUDIO_STREAM_BANNED,{uid:e.clientId,banned:1===e.attributes.serverMuteAudio}))}},{key:"_onUpdateRoomAttributes",value:function(e){var t;e.roomAttributes&&(this._mediaServerClient.roomAttributes=ud(ud({},this._mediaServerClient.roomAttributes),e.roomAttributes)),null!==(t=e.roomAttributes)&&void 0!==t&&t.multiChatMode&&this._handleFFAudioTrack()}},{key:"_onUpdateStreamAttributes",value:function(e){var t=this._roomConfig,r=t.isAutoSubscribeAudio,n=t.isAutoSubscribeVideo,i=e.clientId,o=e.streamId,a=e.attributes,s=this._findRemoteStream(i,o);if(s){var c,u,d=s.attributes,l=ud(ud({},d),a),h=!1,f=l.localaudio!==d.localaudio,p=!1,v=!1,_=l.localvideo!==d.localvideo,m=!1,g=kV.NONE,y=kV.NONE;if(l.audiostream!==d.audiostream&&(h=l.localaudio,p=!!l.audiostream,l.audiostream?g|=Sd.AUDIO:y|=Sd.AUDIO),l.videostream!==d.videostream&&(v=l.localvideo,m=!!l.videostream,l.videostream?g|=Sd.VIDEO:y|=Sd.VIDEO),g&&this.safeEmit(iF.ON_USER_PUBLISH_STATE_CHANGE,{userId:i,mediaType:g,isScreen:s.isScreen,pubState:aF.PUB,remoteStream:s}),y&&this.safeEmit(iF.ON_USER_PUBLISH_STATE_CHANGE,{userId:i,mediaType:y,isScreen:s.isScreen,pubState:aF.UNPUB,remoteStream:s}),s.attributes=l,l.localaudio!==d.localaudio)if(l.localaudio){var S,E,b,k;if(r)if(l.extaudio)null===(S=s.observer)||void 0===S||S.setExternalAudioSource(!0),null===(E=s.observer)||void 0===E||E.setPushAudio(!0);else null===(b=s.observer)||void 0===b||b.setExternalAudioSource(!1),null===(k=s.observer)||void 0===k||k.setEnableAudio(!0);this.safeEmit(iF.ON_USER_START_AUDIO_CAPTURE,{userId:i},s)}else{var T,I,A,R;if(l.extaudio)null===(T=s.observer)||void 0===T||T.setExternalAudioSource(!0),null===(I=s.observer)||void 0===I||I.setPushAudio(!1);else null===(A=s.observer)||void 0===A||A.setExternalAudioSource(!1),null===(R=s.observer)||void 0===R||R.setEnableAudio(!1);!s.isScreen&&this.safeEmit(iF.ON_USER_STOP_AUDIO_CAPTURE,{userId:i})}if(l.localvideo!==d.localvideo)if(l.localvideo){var w,C,O,x;if(n)if(l.extvideo)null===(w=s.observer)||void 0===w||w.setExternalVideoSource(!0),null===(C=s.observer)||void 0===C||C.setPushVideo(!0);else null===(O=s.observer)||void 0===O||O.setExternalVideoSource(!1),null===(x=s.observer)||void 0===x||x.setEnableVideo(!0);this.safeEmit(iF.ON_USER_START_VIDEO_CAPTURE,{userId:i})}else{var D,P,N,M;if(l.extvideo)null===(D=s.observer)||void 0===D||D.setExternalVideoSource(!0),null===(P=s.observer)||void 0===P||P.setPushVideo(!1);else null===(N=s.observer)||void 0===N||N.setExternalVideoSource(!1),null===(M=s.observer)||void 0===M||M.setEnableVideo(!1);!s.isScreen&&this.safeEmit(iF.ON_USER_STOP_VIDEO_CAPTURE,{userId:i})}if(h&&!f)null===(c=s.observer)||void 0===c||c.setRemoteUnmuteAudio(p);if(v&&!_)null===(u=s.observer)||void 0===u||u.setRemoteUnmuteVideo(m)}}},{key:"_onPushTrack",value:function(e){var t,r=this;if(null!==(t=e.streamId)&&void 0!==t&&cR(t).call(t,"audio_mux")){var n=this._onAddStream(ud(ud({},e),{},{attributes:bG}),{needEmit:!1,fromSignal:!1,virtual:!0});n&&this._mediaServerClient.subscribe4pushTrack(n,e).then((function(){r.safeEmit(iF.SUBSCRIBE_PUSH_TRACK,{stream:n}),r._virtualStreams.push(n)})).catch((function(e){EG.print("subscribe","push track failed %o",e)}))}else{var i;iP.rtcError(wm(i="onPushTrack, userId: ".concat(e.clientId,", ")).call(i,e.streamId),-1001)}}},{key:"_onRemoveTrack",value:function(e){var t,r=e.clientId,n=e.streamId,i=e.message;EG.print("_onRemoveTrack","remove track: %o",r);var o=this._findRemoteStream(r,n);o&&(null===(t=this._mediaServerClient)||void 0===t||t.unsubscribe4removeTrack(o,i))}},{key:"_onMeetingSpeakerChange",value:function(e){if(Array.isArray(null==e?void 0:e.speakerCsrcInfo)){var t={};null==e||e.speakerCsrcInfo.forEach((function(e){var r=e.csrc,n=e.userId;e.isScreen||(t[r]=n)})),this._csrcUserIdMap=t}}},{key:"getActiveSpeakerInMultiChatMode",value:function(){var e=this,t=[];return this._virtualStreams.forEach((function(r){var n,i=null===(n=r.audioTransceiver)||void 0===n?void 0:n.receiver;if(i){var o=JT(i.getContributingSources()||[],1)[0];if(o){var a=o.audioLevel,s=o.source;e._csrcUserIdMap[s]&&t.push({userId:e._csrcUserIdMap[s],audioLevel:a})}}})),t.length&&VA(t).call(t,(function(e,t){return e.audioLevel-t.audioLevel})),t}},{key:"_nodeChange",value:function(e){var t,r=e.nodes,n=e.reason;bP.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,iP.rtcNodeChange(0,vk(e),vk(n)),this._joinResolveCallback&&this._joinRejectCallback?this._join(this._joinResolveCallback,this._joinRejectCallback):this._reconnect()}},{key:"_reconnect",value:function(){var e,t=this;this._isReconnecting=!0;var r,n=QT(tA(e=this._remoteStreams).call(e));try{for(n.s();!(r=n.n()).done;){var i=r.value;Array.isArray(i)&&i.forEach((function(e){return e.clean()}))}}catch(o){n.e(o)}finally{n.f()}iP.rtcReconnect(1002,TD.PEERCONNECTION_RECONNECTING,this._roomInfo.userInfo.userId,ID.PEERCONNECTION),this._liveTranscodingOnceSucc||delete this._liveControlMessage,this._join((function(){iP.rtcReconnected(AD.PEERCONNECTION_RECONNECTED,RD.PEERCONNECTION)}),(function(e){t._reconnectRecord.record(e),t._reconnectRecord.shouldReconnect?(EG.print("Reconnecting error, will reconnect after 3s",e),t._reconnectTimer=window.setTimeout(t._reconnect.bind(t),3e3)):(t.safeEmit(iF.RECONNECT_FAILED),t.destroy())}),!0)}},{key:"_handleAbnormalDisconnection",value:function(){EG.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===pF.DISCONNECTED)t=bd.CONNECTION_STATE_DISCONNECTED;else if(e.next===pF.CONNECTED)clearTimeout(this._connectionLostTimer),t=this._isReconnecting?bd.CONNECTION_STATE_RECONNECTED:bd.CONNECTION_STATE_CONNECTED;else{if(e.next!==pF.CONNECTING)return;t=this._isReconnecting?bd.CONNECTION_STATE_RECONNECTING:bd.CONNECTION_STATE_CONNECTING}e.prev===pF.CONNECTED&&e.next===pF.DISCONNECTED&&(this._connectionLostTimer=window.setTimeout((function(){r.safeEmit(FP.ON_CONNECTION_STATE_CHANGE,{state:bd.CONNECTION_STATE_LOST})}),1e4)),this._networkQualityManager.setConnectionState(e.next),this.safeEmit(FP.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(iF.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?yd.STREAM_INDEX_SCREEN:yd.STREAM_INDEX_MAIN}})}))}},{key:"_onCustomMessage",value:function(e){this.safeEmit(UP.ON_CUSTOM_MESSAGE,e)}},{key:"_onUserMessageReceived",value:function(e){this.safeEmit(UP.USER_MESSAGE_RECEIVED,{userId:e.from,message:e.msg})}},{key:"_onUserBinaryMessageReceived",value:function(e){var t,r={userId:e.from,message:e.msg};null!==(t=this._subtitleTool)&&void 0!==t&&t.onMessageRecv(r)||this.safeEmit(UP.USER_BINARY_MESSAGE_RECEIVED,r)}},{key:"_initSubtitleTool",value:function(){var e=this;this._subtitleTool=new gG(this),this._subtitleTool.onEvent=function(t){e.emit(iF.ON_SUBTITLE_STATE_CHANGED,t)},this._subtitleTool.onMessage=function(t){e.emit(iF.ON_SUBTITLE_MESSAGE_RECEIVED,t)}}},{key:"_onPostProcessingMessage",value:function(e){if(e.body)if("subtitleCallback"!==e.type){var t=e.body,r=t.error||0,n=oF.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=oF.START_FAILED);break;case"TranscodeStateChanged":n=0!==t.error?oF.START_FAILED:oF.START_SUCCESS;break;case"TranscodeStopped":n=0!==t.error?oF.STOP_FAILED:oF.STOP_SUCCESS;break;case"TranscodeUpdated":n=0!==t.error?oF.UPDATE_FAILED:oF.UPDATE_SUCCESS}this.safeEmit(UP.POST_PROCESSING_MESSAGE,{code:r,protocol:t.protocol,error:t.error,eventType:n,message:i[r]})}this.safeEmit(UP.POST_PROCESSING_MESSAGE,{code:r,message:i[r],type:e.type})}else{var o;null===(o=this._subtitleTool)||void 0===o||o.onResult(e)}}},{key:"_onUserTokenWillExpire",value:function(){this.safeEmit(UP.ON_USER_TOKEN_WILL_EXPIRE,null)}},{key:"_onStreamFailed",value:(r=km(Em().mark((function e(t){var r,n,i,o,a,s,c,u,d,l;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if("publish"!==t.type){e.next=11;break}if(s=void 0,(null===(r=this.localStream)||void 0===r?void 0:r.streamId)===t.streamId?s=this.localStream:(null===(n=this.localScreenStream)||void 0===n?void 0:n.streamId)===t.streamId&&(s=this.localScreenStream),s){e.next=5;break}return e.abrupt("return");case 5:return null===(i=s)||void 0===i||i.clean(),e.next=8,null===(o=this._mediaServerClient)||void 0===o?void 0:o.unpublish(s).catch((function(){}));case 8:null===(a=this._mediaServerClient)||void 0===a||a.publish(s).catch((function(){})),e.next=20;break;case 11:if("subscribe"!==t.type){e.next=20;break}if(c=this._remoteStreamStreamIdUserIdMap[t.streamId],!(u=this._findRemoteStream(c,t.streamId))){e.next=20;break}return e.next=17,null===(d=this._mediaServerClient)||void 0===d?void 0:d.unsubscribe(u,Sd.AUDIO_AND_VIDEO);case 17:return e.next=19,null===(l=this._mediaServerClient)||void 0===l?void 0:l.subscribe(u,u.subMediaType,u.subLayer);case 19:this.safeEmit(iF.RESUBSCRIBE,{stream:u});case 20:case"end":return e.stop()}}),e,this)}))),function(e){return r.apply(this,arguments)})},{key:"_onStreamControlMessage",value:function(e){var t,r;e.type===LP.PushLimitWarn&&(null!==(t=this._localStream)&&void 0!==t&&t.pubAudio||null!==(r=this._localStream)&&void 0!==r&&r.pubVideo||this.unpublish())}},{key:"_onPublishOnDemand",value:(t=km(Em().mark((function e(){var t,r,n,i,o,a,s,c,u,d,l,h,f,p;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this._publishOnDemandBusy&&!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)){e.next=2;break}return e.abrupt("return");case 2:if(a=this._publishOnDemandItem,this._publishOnDemandItem=void 0,a){e.next=6;break}return e.abrupt("return");case 6:if(null===(i=this._localStream)||void 0===i||!i.enableSimulcast||null===(o=this._localStream)||void 0===o||!o.videoTransceiver){e.next=16;break}return u=[],this._publishOnDemandBusy=!0,d=null===(s=this._localStream)||void 0===s?void 0:s.stream.id,l=null===(c=this._localStream)||void 0===c?void 0:c.videoTransceiver.sender,h=l.getParameters(),Array.isArray(h.encodings)&&Array.isArray(a)&&(p={},EG.print("_onPublishOnDemand exec","usedDescriptions: %o",a),a.forEach((function(e){var t;if(null!=e&&null!==(t=e.StreamIds)&&void 0!==t&&Jm(t).call(t,d)){var r=null==e?void 0:e.Metadata.VideoIndex;p[r]=!0}})),h.encodings=lk(f=h.encodings).call(f,(function(e){if(e.rid){p[e.rid]?e.active=!0:e.active=!1;var t=+e.rid;u[t]=e.active}return e})),this._context&&(this._context.activeSimStreams=u)),e.next=15,l.setParameters(h);case 15:this._publishOnDemandBusy=!1;case 16:this._onPublishOnDemand();case 17:case"end":return e.stop()}}),e,this)}))),function(){return t.apply(this,arguments)})},{key:"_onRTT",value:function(e){var t=e.StreamIds,r=e.Metadata;if(t.length&&r){var n,i=t[0];null!==(n=this._context)&&void 0!==n&&n.streamRTT&&(this._context.streamRTT[i]={audio:r.audio_rtt,video:r.video_rtt})}}},{key:"_reportNetworkQuality",value:function(e,t){this.emit(iF.ON_NETWORK_QUALITY,e,t)}},{key:"_emitVideoSizeChange",value:function(e,t,r,n){var i;this.emit(iF.ON_REMOTE_VIDEO_SIZE_CHANGED,{roomId:null===(i=this.roomInfo)||void 0===i?void 0:i.roomId,userId:e,streamIndex:t?yd.STREAM_INDEX_SCREEN:yd.STREAM_INDEX_MAIN},{width:r,height:n})}},{key:"multiChatMode",get:function(){var e;return null===(e=this._mediaServerClient)||void 0===e?void 0:e.multiChatMode()}}]),I}(OC),TG=function(){function e(){Wd(this,e),sd(this,"_all_201_count",void 0),sd(this,"_has_4xx",void 0),this._all_201_count=0,this._has_4xx=!1}return qd(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;lk(e).call(e,(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}(),IG=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&&FE(r.style,t.style),t.attributes&&SR(t.attributes).forEach((function(e){var t=JT(e,2),n=t[0],i=t[1];"muted"===n?r.muted=!0:r.setAttribute(n,i)})),r},AG=new RC("Player",0),RG=["play","playing","pause","ended","error","seeking","seeked","waiting","canplay","canplaythrough","durationchange","volumechange","loadedmetadata","loadeddata","loadstart","timeupdate"],wG={playsinline:"","webkit-playsinline":""},CG={playsinline:"","webkit-playsinline":"","x5-playsinline":"","x5-video-player-type":"h5","x-webkit-airplay":"allow",preload:"",muted:""},OG=function(e){OI(n,e);var t,r=qI(n);function n(e){var t;Wd(this,n),sd(ZT(t=r.call(this)),"_containerDom",void 0),sd(ZT(t),"_videoDom",void 0),sd(ZT(t),"__cumulativeTime",void 0),sd(ZT(t),"userId",void 0),sd(ZT(t),"renderMode",void 0),sd(ZT(t),"mirrorType",kd.MIRROR_TYPE_NONE),sd(ZT(t),"isScreen",void 0),sd(ZT(t),"isLocal",void 0),sd(ZT(t),"played",!1),sd(ZT(t),"_emitPlayFailed",!1),sd(ZT(t),"_videoContainer",void 0),sd(ZT(t),"_safari15VideoTimer",void 0),sd(ZT(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};switch(t.emit("playback_event",i),e.type){case"canplay":case"loadeddata":t._internalPlay();break;case"playing":AG.print("VideoPlayerPlaying","[userId-".concat(t.userId,"] video element playing"))}})),sd(ZT(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,i,o;t._emitPlayFailed||("AbortError"!==e.name?(t._emitPlayFailed=!0,iP.rtcError(wm(r="video autoplay failed, userId: ".concat(t.userId,", ")).call(r,e.name),-1e3),t.emit("playback_event",{type:"video",rawEvent:e,readyState:(null===(n=t._videoDom)||void 0===n?void 0:n.readyState)||0,userId:t.userId,eventName:"autoplay-error",currentTime:(null===(i=t._videoDom)||void 0===i?void 0:i.currentTime)||0,isScreen:t.isScreen})):iP.rtcError(wm(o="video autoplay failed, userId: ".concat(t.userId,", ")).call(o,e.name),-1e3))}))}}));var i=e.renderDom,o=e.userId;t.renderMode=void 0!==e.renderMode?e.renderMode:gd.RENDER_MODE_FIT;var a="string"==typeof i?document.getElementById(i):i;if(!a)throw new lR(uR.CANT_FIND_DOM,"can't find dom");return t._videoContainer=document.createElement("div"),t._videoContainer.style.width="100%",t._videoContainer.style.height="100%",t._videoContainer.style.position="relative",t._videoContainer.style.overflow="hidden",t._containerDom=a,t.userId=o,t.isLocal=!!e.isLocal,t.isScreen=!!e.isScreen,t._initVideo(),t}return qd(n,[{key:"_initVideo",value:function(){var e;this._videoDom||(this._videoDom=IG("video",{style:{width:"100%",height:"100%"},attributes:CG}),this._videoDom.id=wm(e="".concat(this.userId,"_")).call(e,aw()),this.renderMode===gd.RENDER_MODE_FIT?this._videoDom.style.objectFit="contain":this._videoDom.style.objectFit="cover",this.mirror(this.mirrorType===kd.MIRROR_TYPE_RENDER));this._videoContainer.appendChild(this._videoDom),this._containerDom.appendChild(this._videoContainer),this._initListeners()}},{key:"_initListeners",value:function(){var e=this;this._videoDom&&RG.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&&RG.forEach((function(t){var r;null===(r=e._videoDom)||void 0===r||r.removeEventListener(t,e.emitVideoEvent)}))}},{key:"_recordFrame",value:function(e){var t=this,r=e.isScreen?1.5:.5;if(pw&&RP.VIDEO_STALL){var n;if(null===(n=this._videoDom)||void 0===n||!n.requestVideoFrameCallback)return;this._videoDom.requestVideoFrameCallback((function n(i,o){var a=o.presentationTime;if(e.recordedVideoFrames||(e.recordedVideoFrames=[]),t.__cumulativeTime){var s,c=(a-t.__cumulativeTime)%2e3,u=c>1e3*r;null===(s=e.recordedVideoFrames)||void 0===s||s.push({playTime:a,isStall:u,stallCount:u?1:0,stallDuration:c})}t.__cumulativeTime=a,t._videoDom.requestVideoFrameCallback(n)}))}else this.on("playback_event",(function(n){var i;if("timeupdate"===n.eventName){if(!RP.VIDEO_STALL)return;if(0===(null===(i=t._videoDom)||void 0===i?void 0:i.currentTime))return;if(void 0===t.__cumulativeTime)return void(t.__cumulativeTime=t._videoDom.currentTime);if(e.recordedVideoFrames||(e.recordedVideoFrames=[]),t._videoDom.currentTime>t.__cumulativeTime){var o=Math.floor(1e3*(t._videoDom.currentTime-t.__cumulativeTime)),a=t._videoDom.currentTime-t.__cumulativeTime>r;e.recordedVideoFrames.push({playTime:t._videoDom.currentTime,isStall:a,stallCount:a?1:0,stallDuration:o%2e3})}t.__cumulativeTime=t._videoDom.currentTime}}))}},{key:"_recordPause",value:function(e){var t=this;void 0===e.statsReport.isPaused&&this.on("playback_event",(function(r){if("pause"===r.eventName)e.statsReport.isPaused=!0,e.statsReport.pauseStart=sw();else if("timeupdate"===r.eventName){var n;if((null===(n=t._videoDom)||void 0===n||!n.paused)&&e.statsReport.isPaused){e.statsReport.isPaused=!1;var i=sw()-(e.statsReport.pauseStart||0);i>500&&(e.statsReport.pauseDuration+=i)}}}))}},{key:"playVideo",value:(t=km(Em().mark((function e(t,r){var n,i,o,a,s=this;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(o=this._videoDom,AG.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=5;break}try{iP.rtcInvokeStatus("play video repeatedly",0,"playVideo",this.userId,0)}catch(mW){}return e.abrupt("return");case 5:o||(this._initVideo(),o=this._videoDom),AG.print("playVideo","play video by dom: ".concat(null===(i=o)||void 0===i?void 0:i.id)),(a=new MediaStream).addTrack(t.getTrack("preprocessing")),o.srcObject=a,o&&!this._containerDom.contains(this._videoContainer)&&this._containerDom.appendChild(this._videoContainer),o&&!this._videoContainer.contains(o)&&this._videoContainer.appendChild(o),setTimeout((function(){return s._internalPlay()})),r&&(this._recordFrame(r),this._recordPause(r),r.statsReport.player=this),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(AG.print("Invoke VideoPlayer.manuallyPlay",this.userId,this.isScreen),this._emitPlayFailed=!1,!this._videoDom)throw new lR(uR.INVALID_PARAMS,"Player not found");return 0!==this._videoDom.readyState||bw?this._videoDom.play():X_.resolve()}},{key:"mirror",value:function(e){var t;AG.print("mirror",wm(t="".concat(this.userId," set mirror: ")).call(t,e)),this.mirrorType=e?kd.MIRROR_TYPE_RENDER:kd.MIRROR_TYPE_NONE,this._videoDom&&(this._videoDom.style.transform=e?"rotateY(180deg)":"")}},{key:"stop",value:function(){var e,t=arguments.length>0&&void 0!==arguments[0]&&arguments[0],r=this._containerDom;(AG.print("stop","stop video track: ".concat(this.userId)),this._videoDom)&&(t||(this._videoDom.srcObject=null),null!=r&&r.contains(this._videoContainer)&&r.removeChild(this._videoContainer),null!==(e=this._videoContainer)&&void 0!==e&&e.contains(this._videoDom)&&this._videoContainer.removeChild(this._videoDom));this.__cumulativeTime=void 0,this.played=!1}},{key:"destroy",value:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];AG.print("destroy","video player: ".concat(this.userId)),this.stop(e),wI(AI(n.prototype),"removeAllListeners",this).call(this),this._removeListeners(),this._videoDom&&delete this._videoDom,this._safari15VideoTimer&&(window.clearInterval(this._safari15VideoTimer),this._safari15VideoTimer=void 0)}},{key:"domElement",get:function(){return this._videoDom}}]),n}(uC.exports.EventEmitter),xG=function(e){OI(i,e);var t,r,n=qI(i);function i(e){var t,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{divId:void 0,muted:!1,isScreen:!1},o=r.divId,a=r.muted,s=r.isScreen;if(Wd(this,i),sd(ZT(t=n.call(this)),"_containerDom",void 0),sd(ZT(t),"_audioDom",void 0),sd(ZT(t),"_fakeAudioDom",void 0),sd(ZT(t),"userId",void 0),sd(ZT(t),"muted",!1),sd(ZT(t),"_emitPlayFailed",!1),sd(ZT(t),"played",!1),sd(ZT(t),"isScreen",void 0),sd(ZT(t),"_wechatTimer",void 0),sd(ZT(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};"playing"===e.type&&AG.print("AudioPlayerPlaying","[userId-".concat(t.userId,"] audio element playing")),"pause"===e.type&&AG.print("AudioPlayerPause","[userId-".concat(t.userId,"] audio element pause")),kw&&bw&&("canplay"===e.type?(clearTimeout(t._wechatTimer),t._wechatTimer=window.setTimeout((function(){t._autoPlayError("wechat")}),500)):"playing"===e.type&&clearTimeout(t._wechatTimer)),t.emit("playback_event",i)})),sd(ZT(t),"_internalPlay",(function(){var e,r;if(pP("_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){var r,n;t._autoPlayError(e),iP.rtcError(wm(r=wm(n="audio autoplay failed, userId: ".concat(t.userId,": ")).call(n,e.message," ")).call(r,e.name),-1e3)})).then((function(){pP("_internalPlay successfully",{userId:t.userId})}))}catch(a){var i,o;t._autoPlayError(a),iP.rtcError(wm(i=wm(o="audio autoplay failed, userId: ".concat(t.userId,": ")).call(o,a.message," ")).call(i,a.name),-1e3)}})),o){var c=document.getElementById(o);if(!c)throw new lR(uR.CANT_FIND_DOM,"can't find dom");t._containerDom=c}else t._containerDom=document.body;return t.userId=e,t.muted=a,t.isScreen=s,t._initAudio(),t}return qd(i,[{key:"_initAudio",value:function(){var e;this._audioDom||(this._audioDom=IG("audio",{style:{display:"none"},attributes:wG}),this._audioDom.volume=this.muted?0:1,this._audioDom.muted=this.muted,this._audioDom.id=wm(e="".concat(this.userId,"_")).call(e,aw()),this._containerDom.appendChild(this._audioDom));this._initListeners()}},{key:"_initListeners",value:function(){var e=this;this._audioDom&&RG.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&&(RG.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=km(Em().mark((function e(t){var r,n,i,o,a,s=this;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(AG.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("preprocessing")),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,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:"pause",value:function(){if(!this._audioDom)throw new lR(uR.INVALID_PARAMS,"Player not found");this._audioDom.pause()}},{key:"manuallyPlay",value:function(){var e;if(AG.print("Invoke AudioPlayer.manuallyPlay"),this._emitPlayFailed=!1,!this._audioDom)throw new lR(uR.INVALID_PARAMS,"Player not found");if(!this.played)return X_.resolve();this._audioDom.volume=1,this._audioDom.muted=!1,null===(e=this._fakeAudioDom)||void 0===e||e.play();var t=this._audioDom.play();return null!=t&&t.then?t:X_.resolve(t)}},{key:"setPlaybackDevice",value:(t=km(Em().mark((function e(t){var r,n;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return AG.print("setPlaybackDevice","setPlaybackDevice: ".concat(t)),e.next=3,PU.enumerateAudioPlaybackDevices();case 3:if(r=e.sent,n=lk(r).call(r,(function(e){return e.deviceId})),Jm(n).call(n,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;AG.print("stopAudio","stop audio track: ".concat(this.userId)),this._audioDom&&(this._audioDom.srcObject=null,null!=e&&e.contains(this._audioDom)&&e.removeChild(this._audioDom)),this._fakeAudioDom&&(this._fakeAudioDom.srcObject=null,this._fakeAudioDom=void 0),this.played=!1}},{key:"domElement",get:function(){return this._audioDom}},{key:"destroy",value:function(){AG.print("destroy","audio player: ".concat(this.userId)),this.stop(),wI(AI(i.prototype),"removeAllListeners",this).call(this),this._removeListeners(),this._audioDom&&(this._audioDom.srcObject=null,delete this._audioDom)}}]),i}(uC.exports.EventEmitter);function DG(e,t,r,n){var i=function(){var e=km(Em().mark((function e(t,i){var o,a;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(o=null==n?void 0:n.get(i),Array.isArray(o)&&(o=null===(a=o)||void 0===a?void 0:bb(a).call(a,(function(e){return e.isScreen===r}))),!t){e.next=9;break}if(!t.played){e.next=8;break}return e.next=6,t.manuallyPlay();case 6:e.next=9;break;case 8:o&&(t instanceof OG&&o.videoTrack&&t.playVideo(o.videoTrack,o),t instanceof xG&&o.audioTrack&&t.playAudio(o.audioTrack));case 9:case"end":return e.stop()}}),e)})));return function(t,r){return e.apply(this,arguments)}}();if(t)return i(e.get(t),t);var o=[];return e.forEach((function(e,t){return o.push(i(e,t))})),X_.all(o)}var PG=function(){function e(){Wd(this,e),sd(this,"_timer",void 0),sd(this,"userMessage",void 0),sd(this,"roomMessage",void 0),this.userMessage={},this.roomMessage={},this._setTimer()}return qd(e,[{key:"_setTimer",value:function(){var e=this;!function t(){e._reportAndgReset(),clearTimeout(e._timer),e._timer=setTimeout(t,1e4)}()}},{key:"_reportAndgReset",value:function(){(an(this.userMessage).length||an(this.roomMessage).length)&&(this._report(),this._reset())}},{key:"_report",value:function(){var e,t,r=this;iP.rtcMessageStatistics(lk(e=an(this.userMessage)).call(e,(function(e){return r.userMessage[e]})),lk(t=an(this.roomMessage)).call(t,(function(e){return r.roomMessage[e]})),"")}},{key:"_reset",value:function(){this.userMessage={},this.roomMessage={}}},{key:"_checkInitUserMessage",value:function(e,t){var r,n;this.userMessage[wm(r="".concat(t,"-")).call(r,e)]||(this.userMessage[wm(n="".concat(t,"-")).call(n,e)]={dc_peer_user_id:e,dc_send_total:0,dc_recv_total:0,dc_send_ack:0,dc_send_fail:0,dc_fail_timeout:0,dc_fail_no_receiver:0,dc_fail_no_relay_path: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){var n,i;(this._checkInitUserMessage(e,t),this.userMessage[wm(n="".concat(t,"-")).call(n,e)].dc_send_total++,r)&&this.userMessage[wm(i="".concat(t,"-")).call(i,e)].dc_send_binary++}},{key:"_recvUserMessage",value:function(e,t){var r;this._checkInitUserMessage(e,t),this.userMessage[wm(r="".concat(t,"-")).call(r,e)].dc_recv_total++}},{key:"_sendUserFail",value:function(e,t,r){var n,i=this.userMessage[wm(n="".concat(t,"-")).call(n,e)];i&&(i.dc_send_fail++,this._handleUserFail(i,r))}},{key:"_handleUserFail",value:function(e,t){t&&(t.code||t.err)&&(t.code===uR.TIME_OUT||t.code===uR.USER_MESSAGE_TIMEOUT?e.dc_fail_timeout++:t.err===zP.NO_RECEIVER?e.dc_fail_no_receiver++:t.err===zP.NO_RELAYPATH?e.dc_fail_no_relay_path++:t.err===zP.TIMEOUT&&e.dc_fail_timeout++)}},{key:"_sendUserAck",value:function(e,t,r,n,i){var o,a=this.userMessage[wm(o="".concat(t,"-")).call(o,e)];a&&(a.dc_send_ack++,a.dc_cost_time+=r,a.dc_cost_s2s+=n||0,a.dc_cost_peer_s2e+=i,a.dc_cost_e2s+=r-(n||0)-i,r<=100?(a.dc_send_ack_100++,a.dc_send_ack_200++,a.dc_send_ack_400++,a.dc_send_ack_1s++):r<=200?(a.dc_send_ack_200++,a.dc_send_ack_400++,a.dc_send_ack_1s++):r<=400?(a.dc_send_ack_400++,a.dc_send_ack_1s++):r<=1e3&&a.dc_send_ack_1s++,r<a.dc_least_time&&(a.dc_least_time=r),r>a.dc_most_time&&(a.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,JD.P2P,t)}},{key:"recvP2PMessage",value:function(e){this._recvUserMessage(e,JD.P2P)}},{key:"sendP2PFail",value:function(e,t){this._sendUserFail(e,JD.P2P,t)}},{key:"sendP2PAck",value:function(e,t,r,n){this._sendUserAck(e,JD.P2P,t,r,n)}},{key:"sendP2POutRoomMessage",value:function(e,t){this._sendUserMessage(e,JD.P2P_OUTSIDE_ROOM,t)}},{key:"recvP2POutRoomMessage",value:function(e){this._recvUserMessage(e,JD.P2P_OUTSIDE_ROOM)}},{key:"sendP2POutRoomFail",value:function(e,t){this._sendUserFail(e,JD.P2P_OUTSIDE_ROOM,t)}},{key:"sendP2POutRoomAck",value:function(e,t,r,n){this._sendUserAck(e,JD.P2P_OUTSIDE_ROOM,t,r,n)}},{key:"sendP2serverMessage",value:function(e){this._sendUserMessage("",JD.P2SERVER,e)}},{key:"sendP2serverFail",value:function(e){this._sendUserFail("",JD.P2SERVER,e)}},{key:"sendP2serveAck",value:function(e,t,r){this._sendUserAck("",JD.P2SERVER,e,t,r)}},{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,i)}},{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,i)}},{key:"countServerMessage",value:function(e,t,r,n){this.sendP2serverMessage(t),e?(n=n||{},this.sendP2serveAck(Date.now()-r,n.s2s_time||0,n.s2e_time||0)):this.sendP2serverFail(n)}},{key:"destroy",value:function(){this._reset(),clearTimeout(this._timer)}}]),e}(),NG="object"==typeof global&&global&&global.Object===Object&&global,MG="object"==typeof self&&self&&self.Object===Object&&self,LG=NG||MG||Function("return this")(),UG=LG.Symbol,VG=Object.prototype,FG=VG.hasOwnProperty,BG=VG.toString,jG=UG?UG.toStringTag:void 0;var GG=Object.prototype.toString;var HG=UG?UG.toStringTag:void 0;function zG(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":HG&&HG in Object(e)?function(e){var t=FG.call(e,jG),r=e[jG];try{e[jG]=void 0;var n=!0}catch(o){}var i=BG.call(e);return n&&(t?e[jG]=r:delete e[jG]),i}(e):function(e){return GG.call(e)}(e)}function KG(e){return null!=e&&"object"==typeof e}var XG=Array.isArray;function qG(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function WG(e){return e}function YG(e){if(!qG(e))return!1;var t=zG(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t}var QG,JG=LG["__core-js_shared__"],ZG=(QG=/[^.]+$/.exec(JG&&JG.keys&&JG.keys.IE_PROTO||""))?"Symbol(src)_1."+QG:"";var $G=Function.prototype.toString;var eH=/^\[object .+?Constructor\]$/,tH=Function.prototype,rH=Object.prototype,nH=tH.toString,iH=rH.hasOwnProperty,oH=RegExp("^"+nH.call(iH).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function aH(e){return!(!qG(e)||(t=e,ZG&&ZG in t))&&(YG(e)?oH:eH).test(function(e){if(null!=e){try{return $G.call(e)}catch(t){}try{return e+""}catch(t){}}return""}(e));var t}function sH(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 cH=Date.now;var uH,dH,lH,hH=function(){try{var e=aH(t=function(e,t){return null==e?void 0:e[t]}(Object,"defineProperty"))?t:void 0;return e({},"",{}),e}catch(r){}var t}(),fH=hH,pH=fH?function(e,t){return fH(e,"toString",{configurable:!0,enumerable:!1,value:(r=t,function(){return r}),writable:!0});var r}:WG,vH=(uH=pH,dH=0,lH=0,function(){var e=cH(),t=16-(e-lH);if(lH=e,t>0){if(++dH>=800)return arguments[0]}else dH=0;return uH.apply(void 0,arguments)}),_H=vH,mH=/^(?:0|[1-9]\d*)$/;function gH(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 yH(e,t,r){"__proto__"==t&&fH?fH(e,t,{configurable:!0,enumerable:!0,value:r,writable:!0}):e[t]=r}function SH(e,t){return e===t||e!=e&&t!=t}var EH=Object.prototype.hasOwnProperty;function bH(e,t,r){var n=e[t];EH.call(e,t)&&SH(n,r)&&(void 0!==r||t in e)||yH(e,t,r)}var kH=Math.max;function TH(e,t){return _H(function(e,t,r){return t=kH(void 0===t?e.length-1:t,0),function(){for(var n=arguments,i=-1,o=kH(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),sH(e,this,s)}}(e,t,WG),e+"")}function IH(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=9007199254740991}function AH(e){return null!=e&&IH(e.length)&&!YG(e)}var RH=Object.prototype;function wH(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||RH)}function CH(e){return KG(e)&&"[object Arguments]"==zG(e)}var OH=Object.prototype,xH=OH.hasOwnProperty,DH=OH.propertyIsEnumerable,PH=CH(function(){return arguments}())?CH:function(e){return KG(e)&&xH.call(e,"callee")&&!DH.call(e,"callee")},NH=PH;var MH="object"==typeof exports&&exports&&!exports.nodeType&&exports,LH=MH&&"object"==typeof module&&module&&!module.nodeType&&module,UH=LH&&LH.exports===MH?LG.Buffer:void 0,VH=(UH?UH.isBuffer:void 0)||function(){return!1},FH={};FH["[object Float32Array]"]=FH["[object Float64Array]"]=FH["[object Int8Array]"]=FH["[object Int16Array]"]=FH["[object Int32Array]"]=FH["[object Uint8Array]"]=FH["[object Uint8ClampedArray]"]=FH["[object Uint16Array]"]=FH["[object Uint32Array]"]=!0,FH["[object Arguments]"]=FH["[object Array]"]=FH["[object ArrayBuffer]"]=FH["[object Boolean]"]=FH["[object DataView]"]=FH["[object Date]"]=FH["[object Error]"]=FH["[object Function]"]=FH["[object Map]"]=FH["[object Number]"]=FH["[object Object]"]=FH["[object RegExp]"]=FH["[object Set]"]=FH["[object String]"]=FH["[object WeakMap]"]=!1;var BH="object"==typeof exports&&exports&&!exports.nodeType&&exports,jH=BH&&"object"==typeof module&&module&&!module.nodeType&&module,GH=jH&&jH.exports===BH&&NG.process,HH=function(){try{var e=jH&&jH.require&&jH.require("util").types;return e||GH&&GH.binding&&GH.binding("util")}catch(t){}}(),zH=HH&&HH.isTypedArray,KH=zH?function(e){return function(t){return e(t)}}(zH):function(e){return KG(e)&&IH(e.length)&&!!FH[zG(e)]},XH=KH,qH=Object.prototype.hasOwnProperty;function WH(e,t){var r=XG(e),n=!r&&NH(e),i=!r&&!n&&VH(e),o=!r&&!n&&!i&&XH(e),a=r||n||i||o,s=a?function(e,t){for(var r=-1,n=Array(e);++r<e;)n[r]=t(r);return n}(e.length,String):[],c=s.length;for(var u in e)!t&&!qH.call(e,u)||a&&("length"==u||i&&("offset"==u||"parent"==u)||o&&("buffer"==u||"byteLength"==u||"byteOffset"==u)||gH(u,c))||s.push(u);return s}var YH=function(e,t){return function(r){return e(t(r))}}(Object.keys,Object),QH=YH,JH=Object.prototype.hasOwnProperty;function ZH(e){return AH(e)?WH(e):function(e){if(!wH(e))return QH(e);var t=[];for(var r in Object(e))JH.call(e,r)&&"constructor"!=r&&t.push(r);return t}(e)}var $H=Object.prototype.hasOwnProperty;function ez(e){if(!qG(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&&$H.call(e,n))&&r.push(n);return r}var tz,rz=(tz=function(e,t){!function(e,t,r,n){var i=!r;r||(r={});for(var o=-1,a=t.length;++o<a;){var s=t[o],c=n?n(r[s],e[s],s,r,e):void 0;void 0===c&&(c=e[s]),i?yH(r,s,c):bH(r,s,c)}}(t,function(e){return AH(e)?WH(e,!0):ez(e)}(t),e)},TH((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=tz.length>3&&"function"==typeof i?(n--,i):void 0,o&&function(e,t,r){if(!qG(r))return!1;var n=typeof t;return!!("number"==n?AH(r)&&gH(t,r.length):"string"==n&&t in r)&&SH(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&&tz(e,a,r,i)}return e})));function nz(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 iz(e){return null==e?[]:nz(e,ZH(e))}var oz=i,az=lt("iterator"),sz=!oz((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})),!e.toJSON||!t.sort||"http://a/c%20d?a=1&c=3"!==e.href||"3"!==t.get("c")||"a=1"!==String(new URLSearchParams("?a=1"))||!t[az]||"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})),cz=Qt,uz=b,dz=2147483647,lz=/[^\0-\u007E]/,hz=/[.\u3002\uFF0E\uFF61]/g,fz="Overflow: input needs wider integers to process",pz=RangeError,vz=uz(hz.exec),_z=Math.floor,mz=String.fromCharCode,gz=uz("".charCodeAt),yz=uz([].join),Sz=uz([].push),Ez=uz("".replace),bz=uz("".split),kz=uz("".toLowerCase),Tz=function(e){return e+22+75*(e<26)},Iz=function(e,t,r){var n=0;for(e=r?_z(e/700):e>>1,e+=_z(e/t);e>455;)e=_z(e/35),n+=36;return _z(n+36*e/(e+38))},Az=function(e){var t=[];e=function(e){for(var t=[],r=0,n=e.length;r<n;){var i=gz(e,r++);if(i>=55296&&i<=56319&&r<n){var o=gz(e,r++);56320==(64512&o)?Sz(t,((1023&i)<<10)+(1023&o)+65536):(Sz(t,i),r--)}else Sz(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&&Sz(t,mz(n));var c=t.length,u=c;for(c&&Sz(t,"-");u<i;){var d=dz;for(r=0;r<e.length;r++)(n=e[r])>=o&&n<d&&(d=n);var l=u+1;if(d-o>_z((dz-a)/l))throw pz(fz);for(a+=(d-o)*l,o=d,r=0;r<e.length;r++){if((n=e[r])<o&&++a>dz)throw pz(fz);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 v=h-p,_=36-p;Sz(t,mz(Tz(p+v%_))),h=_z(v/_),f+=36}Sz(t,mz(Tz(h))),s=Iz(a,l,u==c),a=0,u++}}a++,o++}return yz(t,"")},Rz=Rr,wz=n,Cz=x,Oz=b,xz=w,Dz=sz,Pz=li,Nz=sy,Mz=Mi,Lz=Nc,Uz=Zi,Vz=vf,Fz=A,Bz=Ye,jz=Yt,Gz=vn,Hz=tr,zz=$,Kz=gn,Xz=Hn,qz=V,Wz=_h,Yz=uh,Qz=Af,Jz=sA,Zz=lt("iterator"),$z="URLSearchParams",eK="URLSearchParamsIterator",tK=Uz.set,rK=Uz.getterFor($z),nK=Uz.getterFor(eK),iK=Object.getOwnPropertyDescriptor,oK=function(e){if(!xz)return wz[e];var t=iK(wz,e);return t&&t.value},aK=oK("fetch"),sK=oK("Request"),cK=oK("Headers"),uK=sK&&sK.prototype,dK=cK&&cK.prototype,lK=wz.RegExp,hK=wz.TypeError,fK=wz.decodeURIComponent,pK=wz.encodeURIComponent,vK=Oz("".charAt),_K=Oz([].join),mK=Oz([].push),gK=Oz("".replace),yK=Oz([].shift),SK=Oz([].splice),EK=Oz("".split),bK=Oz("".slice),kK=/\+/g,TK=Array(4),IK=function(e){return TK[e-1]||(TK[e-1]=lK("((?:%[\\da-f]{2}){"+e+"})","gi"))},AK=function(e){try{return fK(e)}catch(mW){return e}},RK=function(e){var t=gK(e,kK," "),r=4;try{return fK(t)}catch(mW){for(;r;)t=gK(t,IK(r--),AK);return t}},wK=/[!'()~]|%20/g,CK={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+"},OK=function(e){return CK[e]},xK=function(e){return gK(pK(e),wK,OK)},DK=Lz((function(e,t){tK(this,{type:eK,iterator:Wz(rK(e).entries),kind:t})}),"Iterator",(function(){var e=nK(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),PK=function(e){this.entries=[],this.url=null,void 0!==e&&(zz(e)?this.parseObject(e):this.parseQuery("string"==typeof e?"?"===vK(e,0)?bK(e,1):e:Kz(e)))};PK.prototype={type:$z,bindURL:function(e){this.url=e,this.update()},parseObject:function(e){var t,r,n,i,o,a,s,c=Yz(e);if(c)for(r=(t=Wz(e,c)).next;!(n=Cz(r,t)).done;){if(o=(i=Wz(Hz(n.value))).next,(a=Cz(o,i)).done||(s=Cz(o,i)).done||!Cz(o,i).done)throw hK("Expected sequence with length 2");mK(this.entries,{key:Kz(a.value),value:Kz(s.value)})}else for(var u in e)Bz(e,u)&&mK(this.entries,{key:u,value:Kz(e[u])})},parseQuery:function(e){if(e)for(var t,r,n=EK(e,"&"),i=0;i<n.length;)(t=n[i++]).length&&(r=EK(t,"="),mK(this.entries,{key:RK(yK(r)),value:RK(_K(r,"="))}))},serialize:function(){for(var e,t=this.entries,r=[],n=0;n<t.length;)e=t[n++],mK(r,xK(e.key)+"="+xK(e.value));return _K(r,"&")},update:function(){this.entries.length=0,this.parseQuery(this.url.query)},updateURL:function(){this.url&&this.url.update()}};var NK=function(){Vz(this,MK);var e=arguments.length>0?arguments[0]:void 0;tK(this,new PK(e))},MK=NK.prototype;if(Nz(MK,{append:function(e,t){Qz(arguments.length,2);var r=rK(this);mK(r.entries,{key:Kz(e),value:Kz(t)}),r.updateURL()},delete:function(e){Qz(arguments.length,1);for(var t=rK(this),r=t.entries,n=Kz(e),i=0;i<r.length;)r[i].key===n?SK(r,i,1):i++;t.updateURL()},get:function(e){Qz(arguments.length,1);for(var t=rK(this).entries,r=Kz(e),n=0;n<t.length;n++)if(t[n].key===r)return t[n].value;return null},getAll:function(e){Qz(arguments.length,1);for(var t=rK(this).entries,r=Kz(e),n=[],i=0;i<t.length;i++)t[i].key===r&&mK(n,t[i].value);return n},has:function(e){Qz(arguments.length,1);for(var t=rK(this).entries,r=Kz(e),n=0;n<t.length;)if(t[n++].key===r)return!0;return!1},set:function(e,t){Qz(arguments.length,1);for(var r,n=rK(this),i=n.entries,o=!1,a=Kz(e),s=Kz(t),c=0;c<i.length;c++)(r=i[c]).key===a&&(o?SK(i,c--,1):(o=!0,r.value=s));o||mK(i,{key:a,value:s}),n.updateURL()},sort:function(){var e=rK(this);Jz(e.entries,(function(e,t){return e.key>t.key?1:-1})),e.updateURL()},forEach:function(e){for(var t,r=rK(this).entries,n=jz(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 DK(this,"keys")},values:function(){return new DK(this,"values")},entries:function(){return new DK(this,"entries")}},{enumerable:!0}),Pz(MK,Zz,MK.entries,{name:"entries"}),Pz(MK,"toString",(function(){return rK(this).serialize()}),{enumerable:!0}),Mz(NK,$z),Rz({global:!0,constructor:!0,forced:!Dz},{URLSearchParams:NK}),!Dz&&Fz(cK)){var LK=Oz(dK.has),UK=Oz(dK.set),VK=function(e){if(zz(e)){var t,r=e.body;if(Gz(r)===$z)return t=e.headers?new cK(e.headers):new cK,LK(t,"content-type")||UK(t,"content-type","application/x-www-form-urlencoded;charset=UTF-8"),Xz(e,{body:qz(0,Kz(r)),headers:qz(0,t)})}return e};if(Fz(aK)&&Rz({global:!0,enumerable:!0,dontCallGetSet:!0,forced:!0},{fetch:function(e){return aK(e,arguments.length>1?VK(arguments[1]):{})}}),Fz(sK)){var FK=function(e){return Vz(this,uK),new sK(e,arguments.length>1?VK(arguments[1]):{})};uK.constructor=FK,FK.prototype=uK,Rz({global:!0,constructor:!0,dontCallGetSet:!0,forced:!0},{Request:FK})}}var BK,jK=Rr,GK=w,HK=sz,zK=n,KK=Yt,XK=b,qK=li,WK=function(e,t,r){return cz.f(e,t,r)},YK=vf,QK=Ye,JK=UE,ZK=zk,$K=ni,eX=Il.codeAt,tX=function(e){var t,r,n=[],i=bz(Ez(kz(e),hz,"."),".");for(t=0;t<i.length;t++)r=i[t],Sz(n,vz(lz,r)?"xn--"+Az(r):r);return yz(n,".")},rX=gn,nX=Mi,iX=Af,oX={URLSearchParams:NK,getState:rK},aX=Zi,sX=aX.set,cX=aX.getterFor("URL"),uX=oX.URLSearchParams,dX=oX.getState,lX=zK.URL,hX=zK.TypeError,fX=zK.parseInt,pX=Math.floor,vX=Math.pow,_X=XK("".charAt),mX=XK(/./.exec),gX=XK([].join),yX=XK(1..toString),SX=XK([].pop),EX=XK([].push),bX=XK("".replace),kX=XK([].shift),TX=XK("".split),IX=XK("".slice),AX=XK("".toLowerCase),RX=XK([].unshift),wX="Invalid scheme",CX="Invalid host",OX="Invalid port",xX=/[a-z]/i,DX=/[\d+-.a-z]/i,PX=/\d/,NX=/^0x/i,MX=/^[0-7]+$/,LX=/^\d+$/,UX=/^[\da-f]+$/i,VX=/[\0\t\n\r #%/:<>?@[\\\]^|]/,FX=/[\0\t\n\r #/:<>?@[\\\]^|]/,BX=/^[\u0000-\u0020]+|[\u0000-\u0020]+$/g,jX=/[\t\n\r]/g,GX=function(e){var t,r,n,i;if("number"==typeof e){for(t=[],r=0;r<4;r++)RX(t,e%256),e=pX(e/256);return gX(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+=yX(e[r],16),r<7&&(t+=":")));return"["+t+"]"}return e},HX={},zX=JK({},HX,{" ":1,'"':1,"<":1,">":1,"`":1}),KX=JK({},zX,{"#":1,"?":1,"{":1,"}":1}),XX=JK({},KX,{"/":1,":":1,";":1,"=":1,"@":1,"[":1,"\\":1,"]":1,"^":1,"|":1}),qX=function(e,t){var r=eX(e,0);return r>32&&r<127&&!QK(t,e)?e:encodeURIComponent(e)},WX={ftp:21,file:null,http:80,https:443,ws:80,wss:443},YX=function(e,t){var r;return 2==e.length&&mX(xX,_X(e,0))&&(":"==(r=_X(e,1))||!t&&"|"==r)},QX=function(e){var t;return e.length>1&&YX(IX(e,0,2))&&(2==e.length||"/"===(t=_X(e,2))||"\\"===t||"?"===t||"#"===t)},JX=function(e){return"."===e||"%2e"===AX(e)},ZX={},$X={},eq={},tq={},rq={},nq={},iq={},oq={},aq={},sq={},cq={},uq={},dq={},lq={},hq={},fq={},pq={},vq={},_q={},mq={},gq={},yq=function(e,t,r){var n,i,o,a=rX(e);if(t){if(i=this.parse(a))throw hX(i);this.searchParams=null}else{if(void 0!==r&&(n=new yq(r,!0)),i=this.parse(a,null,n))throw hX(i);(o=dX(new uX)).bindURL(this),this.searchParams=o}};yq.prototype={type:"URL",parse:function(e,t,r){var n,i,o,a,s,c=this,u=t||ZX,d=0,l="",h=!1,f=!1,p=!1;for(e=rX(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=bX(e,BX,"")),e=bX(e,jX,""),n=ZK(e);d<=n.length;){switch(i=n[d],u){case ZX:if(!i||!mX(xX,i)){if(t)return wX;u=eq;continue}l+=AX(i),u=$X;break;case $X:if(i&&(mX(DX,i)||"+"==i||"-"==i||"."==i))l+=AX(i);else{if(":"!=i){if(t)return wX;l="",u=eq,d=0;continue}if(t&&(c.isSpecial()!=QK(WX,l)||"file"==l&&(c.includesCredentials()||null!==c.port)||"file"==c.scheme&&!c.host))return;if(c.scheme=l,t)return void(c.isSpecial()&&WX[c.scheme]==c.port&&(c.port=null));l="","file"==c.scheme?u=lq:c.isSpecial()&&r&&r.scheme==c.scheme?u=tq:c.isSpecial()?u=oq:"/"==n[d+1]?(u=rq,d++):(c.cannotBeABaseURL=!0,EX(c.path,""),u=_q)}break;case eq:if(!r||r.cannotBeABaseURL&&"#"!=i)return wX;if(r.cannotBeABaseURL&&"#"==i){c.scheme=r.scheme,c.path=$K(r.path),c.query=r.query,c.fragment="",c.cannotBeABaseURL=!0,u=gq;break}u="file"==r.scheme?lq:nq;continue;case tq:if("/"!=i||"/"!=n[d+1]){u=nq;continue}u=aq,d++;break;case rq:if("/"==i){u=sq;break}u=vq;continue;case nq:if(c.scheme=r.scheme,i==BK)c.username=r.username,c.password=r.password,c.host=r.host,c.port=r.port,c.path=$K(r.path),c.query=r.query;else if("/"==i||"\\"==i&&c.isSpecial())u=iq;else if("?"==i)c.username=r.username,c.password=r.password,c.host=r.host,c.port=r.port,c.path=$K(r.path),c.query="",u=mq;else{if("#"!=i){c.username=r.username,c.password=r.password,c.host=r.host,c.port=r.port,c.path=$K(r.path),c.path.length--,u=vq;continue}c.username=r.username,c.password=r.password,c.host=r.host,c.port=r.port,c.path=$K(r.path),c.query=r.query,c.fragment="",u=gq}break;case iq:if(!c.isSpecial()||"/"!=i&&"\\"!=i){if("/"!=i){c.username=r.username,c.password=r.password,c.host=r.host,c.port=r.port,u=vq;continue}u=sq}else u=aq;break;case oq:if(u=aq,"/"!=i||"/"!=_X(l,d+1))continue;d++;break;case aq:if("/"!=i&&"\\"!=i){u=sq;continue}break;case sq:if("@"==i){h&&(l="%40"+l),h=!0,o=ZK(l);for(var v=0;v<o.length;v++){var _=o[v];if(":"!=_||p){var m=qX(_,XX);p?c.password+=m:c.username+=m}else p=!0}l=""}else if(i==BK||"/"==i||"?"==i||"#"==i||"\\"==i&&c.isSpecial()){if(h&&""==l)return"Invalid authority";d-=ZK(l).length+1,l="",u=cq}else l+=i;break;case cq:case uq:if(t&&"file"==c.scheme){u=fq;continue}if(":"!=i||f){if(i==BK||"/"==i||"?"==i||"#"==i||"\\"==i&&c.isSpecial()){if(c.isSpecial()&&""==l)return CX;if(t&&""==l&&(c.includesCredentials()||null!==c.port))return;if(a=c.parseHost(l))return a;if(l="",u=pq,t)return;continue}"["==i?f=!0:"]"==i&&(f=!1),l+=i}else{if(""==l)return CX;if(a=c.parseHost(l))return a;if(l="",u=dq,t==uq)return}break;case dq:if(!mX(PX,i)){if(i==BK||"/"==i||"?"==i||"#"==i||"\\"==i&&c.isSpecial()||t){if(""!=l){var g=fX(l,10);if(g>65535)return OX;c.port=c.isSpecial()&&g===WX[c.scheme]?null:g,l=""}if(t)return;u=pq;continue}return OX}l+=i;break;case lq:if(c.scheme="file","/"==i||"\\"==i)u=hq;else{if(!r||"file"!=r.scheme){u=vq;continue}if(i==BK)c.host=r.host,c.path=$K(r.path),c.query=r.query;else if("?"==i)c.host=r.host,c.path=$K(r.path),c.query="",u=mq;else{if("#"!=i){QX(gX($K(n,d),""))||(c.host=r.host,c.path=$K(r.path),c.shortenPath()),u=vq;continue}c.host=r.host,c.path=$K(r.path),c.query=r.query,c.fragment="",u=gq}}break;case hq:if("/"==i||"\\"==i){u=fq;break}r&&"file"==r.scheme&&!QX(gX($K(n,d),""))&&(YX(r.path[0],!0)?EX(c.path,r.path[0]):c.host=r.host),u=vq;continue;case fq:if(i==BK||"/"==i||"\\"==i||"?"==i||"#"==i){if(!t&&YX(l))u=vq;else if(""==l){if(c.host="",t)return;u=pq}else{if(a=c.parseHost(l))return a;if("localhost"==c.host&&(c.host=""),t)return;l="",u=pq}continue}l+=i;break;case pq:if(c.isSpecial()){if(u=vq,"/"!=i&&"\\"!=i)continue}else if(t||"?"!=i)if(t||"#"!=i){if(i!=BK&&(u=vq,"/"!=i))continue}else c.fragment="",u=gq;else c.query="",u=mq;break;case vq:if(i==BK||"/"==i||"\\"==i&&c.isSpecial()||!t&&("?"==i||"#"==i)){if(".."===(s=AX(s=l))||"%2e."===s||".%2e"===s||"%2e%2e"===s?(c.shortenPath(),"/"==i||"\\"==i&&c.isSpecial()||EX(c.path,"")):JX(l)?"/"==i||"\\"==i&&c.isSpecial()||EX(c.path,""):("file"==c.scheme&&!c.path.length&&YX(l)&&(c.host&&(c.host=""),l=_X(l,0)+":"),EX(c.path,l)),l="","file"==c.scheme&&(i==BK||"?"==i||"#"==i))for(;c.path.length>1&&""===c.path[0];)kX(c.path);"?"==i?(c.query="",u=mq):"#"==i&&(c.fragment="",u=gq)}else l+=qX(i,KX);break;case _q:"?"==i?(c.query="",u=mq):"#"==i?(c.fragment="",u=gq):i!=BK&&(c.path[0]+=qX(i,HX));break;case mq:t||"#"!=i?i!=BK&&("'"==i&&c.isSpecial()?c.query+="%27":c.query+="#"==i?"%23":qX(i,HX)):(c.fragment="",u=gq);break;case gq:i!=BK&&(c.fragment+=qX(i,zX))}d++}},parseHost:function(e){var t,r,n;if("["==_X(e,0)){if("]"!=_X(e,e.length-1))return CX;if(t=function(e){var t,r,n,i,o,a,s,c=[0,0,0,0,0,0,0,0],u=0,d=null,l=0,h=function(){return _X(e,l)};if(":"==h()){if(":"!=_X(e,1))return;l+=2,d=++u}for(;h();){if(8==u)return;if(":"!=h()){for(t=r=0;r<4&&mX(UX,h());)t=16*t+fX(h(),16),l++,r++;if("."==h()){if(0==r)return;if(l-=r,u>6)return;for(n=0;h();){if(i=null,n>0){if(!("."==h()&&n<4))return;l++}if(!mX(PX,h()))return;for(;mX(PX,h());){if(o=fX(h(),10),null===i)i=o;else{if(0==i)return;i=10*i+o}if(i>255)return;l++}c[u]=256*c[u]+i,2!=++n&&4!=n||u++}if(4!=n)return;break}if(":"==h()){if(l++,!h())return}else if(h())return;c[u++]=t}else{if(null!==d)return;l++,d=++u}}if(null!==d)for(a=u-d,u=7;0!=u&&a>0;)s=c[u],c[u--]=c[d+a-1],c[d+--a]=s;else if(8!=u)return;return c}(IX(e,1,-1)),!t)return CX;this.host=t}else if(this.isSpecial()){if(e=tX(e),mX(VX,e))return CX;if(t=function(e){var t,r,n,i,o,a,s,c=TX(e,".");if(c.length&&""==c[c.length-1]&&c.length--,(t=c.length)>4)return e;for(r=[],n=0;n<t;n++){if(""==(i=c[n]))return e;if(o=10,i.length>1&&"0"==_X(i,0)&&(o=mX(NX,i)?16:8,i=IX(i,8==o?1:2)),""===i)a=0;else{if(!mX(10==o?LX:8==o?MX:UX,i))return e;a=fX(i,o)}EX(r,a)}for(n=0;n<t;n++)if(a=r[n],n==t-1){if(a>=vX(256,5-t))return null}else if(a>255)return null;for(s=SX(r),n=0;n<r.length;n++)s+=r[n]*vX(256,3-n);return s}(e),null===t)return CX;this.host=t}else{if(mX(FX,e))return CX;for(t="",r=ZK(e),n=0;n<r.length;n++)t+=qX(r[n],HX);this.host=t}},cannotHaveUsernamePasswordPort:function(){return!this.host||this.cannotBeABaseURL||"file"==this.scheme},includesCredentials:function(){return""!=this.username||""!=this.password},isSpecial:function(){return QK(WX,this.scheme)},shortenPath:function(){var e=this.path,t=e.length;!t||"file"==this.scheme&&1==t&&YX(e[0],!0)||e.length--},serialize:function(){var e=this,t=e.scheme,r=e.username,n=e.password,i=e.host,o=e.port,a=e.path,s=e.query,c=e.fragment,u=t+":";return null!==i?(u+="//",e.includesCredentials()&&(u+=r+(n?":"+n:"")+"@"),u+=GX(i),null!==o&&(u+=":"+o)):"file"==t&&(u+="//"),u+=e.cannotBeABaseURL?a[0]:a.length?"/"+gX(a,"/"):"",null!==s&&(u+="?"+s),null!==c&&(u+="#"+c),u},setHref:function(e){var t=this.parse(e);if(t)throw hX(t);this.searchParams.update()},getOrigin:function(){var e=this.scheme,t=this.port;if("blob"==e)try{return new Sq(e.path[0]).origin}catch(mW){return"null"}return"file"!=e&&this.isSpecial()?e+"://"+GX(this.host)+(null!==t?":"+t:""):"null"},getProtocol:function(){return this.scheme+":"},setProtocol:function(e){this.parse(rX(e)+":",ZX)},getUsername:function(){return this.username},setUsername:function(e){var t=ZK(rX(e));if(!this.cannotHaveUsernamePasswordPort()){this.username="";for(var r=0;r<t.length;r++)this.username+=qX(t[r],XX)}},getPassword:function(){return this.password},setPassword:function(e){var t=ZK(rX(e));if(!this.cannotHaveUsernamePasswordPort()){this.password="";for(var r=0;r<t.length;r++)this.password+=qX(t[r],XX)}},getHost:function(){var e=this.host,t=this.port;return null===e?"":null===t?GX(e):GX(e)+":"+t},setHost:function(e){this.cannotBeABaseURL||this.parse(e,cq)},getHostname:function(){var e=this.host;return null===e?"":GX(e)},setHostname:function(e){this.cannotBeABaseURL||this.parse(e,uq)},getPort:function(){var e=this.port;return null===e?"":rX(e)},setPort:function(e){this.cannotHaveUsernamePasswordPort()||(""==(e=rX(e))?this.port=null:this.parse(e,dq))},getPathname:function(){var e=this.path;return this.cannotBeABaseURL?e[0]:e.length?"/"+gX(e,"/"):""},setPathname:function(e){this.cannotBeABaseURL||(this.path=[],this.parse(e,pq))},getSearch:function(){var e=this.query;return e?"?"+e:""},setSearch:function(e){""==(e=rX(e))?this.query=null:("?"==_X(e,0)&&(e=IX(e,1)),this.query="",this.parse(e,mq)),this.searchParams.update()},getSearchParams:function(){return this.searchParams.facade},getHash:function(){var e=this.fragment;return e?"#"+e:""},setHash:function(e){""!=(e=rX(e))?("#"==_X(e,0)&&(e=IX(e,1)),this.fragment="",this.parse(e,gq)):this.fragment=null},update:function(){this.query=this.searchParams.serialize()||null}};var Sq=function(e){var t=YK(this,Eq),r=iX(arguments.length,1)>1?arguments[1]:void 0,n=sX(t,new yq(e,!1,r));GK||(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())},Eq=Sq.prototype,bq=function(e,t){return{get:function(){return cX(this)[e]()},set:t&&function(e){return cX(this)[t](e)},configurable:!0,enumerable:!0}};if(GK&&(WK(Eq,"href",bq("serialize","setHref")),WK(Eq,"origin",bq("getOrigin")),WK(Eq,"protocol",bq("getProtocol","setProtocol")),WK(Eq,"username",bq("getUsername","setUsername")),WK(Eq,"password",bq("getPassword","setPassword")),WK(Eq,"host",bq("getHost","setHost")),WK(Eq,"hostname",bq("getHostname","setHostname")),WK(Eq,"port",bq("getPort","setPort")),WK(Eq,"pathname",bq("getPathname","setPathname")),WK(Eq,"search",bq("getSearch","setSearch")),WK(Eq,"searchParams",bq("getSearchParams")),WK(Eq,"hash",bq("getHash","setHash"))),qK(Eq,"toJSON",(function(){return cX(this).serialize()}),{enumerable:!0}),qK(Eq,"toString",(function(){return cX(this).serialize()}),{enumerable:!0}),lX){var kq=lX.createObjectURL,Tq=lX.revokeObjectURL;kq&&qK(Sq,"createObjectURL",KK(kq,lX)),Tq&&qK(Sq,"revokeObjectURL",KK(Tq,lX))}nX(Sq,"URL"),jK({global:!0,constructor:!0,forced:!HK,sham:!GK},{URL:Sq});var Iq=ee.URL,Aq=function(){var e=km(Em().mark((function e(t,r){var n;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=new Audio(Iq.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)}}(),Rq=ad,wq=tc,Cq=function(e,t,r,n){for(var i,o=n>1?void 0:n?wq(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&&Rq(t,r,o),o},Oq=function(){function e(t){Wd(this,e),sd(this,"_sharedAudioContext",new AudioContext),sd(this,"_audioDestination",this._sharedAudioContext.createMediaStreamDestination()),sd(this,"_localGainNode",this._sharedAudioContext.createGain()),sd(this,"_bufferGainNode",this._sharedAudioContext.createGain()),sd(this,"_audioBufferSource",void 0),sd(this,"_localSource",void 0),sd(this,"_context",void 0),sd(this,"_failedAudioList",[]),sd(this,"_startingIds",new uE),sd(this,"_revokeURLs",new JM),sd(this,"mixingMap",new uE),sd(this,"resourcesCache",new uE),sd(this,"volumeConfig",new uE),sd(this,"cachedBuffer",[]),sd(this,"id","AudioMixingManager"),this._context=t,this._localGainNode.gain.value=1}var t,r,n;return qd(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=km(Em().mark((function e(t,r,n){var i,o,a,s,c,u,d,l,h,f,p,v,_,m=this;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(void 0===this._startingIds.get(t)){e.next=3;break}return console.warn("AudioMixing task id: ".concat(t," is starting")),e.abrupt("return");case 3:if(this._startingIds.set(t,t),console.log(this._startingIds),i=n.playCount,Kw(o=n.type,"mixingType",iz(Gd)),a=this._context.getLocalAudioTrack()){e.next=10;break}return e.abrupt("return");case 10:if((s=a.getTrack("preprocessing"))&&this.mixMediaStream(new MediaStream([s])),null!=(c=this.mixingMap.get(t))&&c.audioNode){c.audioNode.pause(),this._context.emitMessage({mixId:t,state:Hd.AUDIO_MIXING_STATE_STOPPED,error:dR.AUDIO_MIXING_ERROR_OK});try{c.gainNode.disconnect(this._audioDestination),c.audioSource.disconnect(c.gainNode)}catch(g){}}if(!(d=this.resourcesCache.get(t))||d.filePath!==r){e.next=19;break}u=d.getAudioNode(),e.next=32;break;case 19:return e.next=21,fetch(r,{mode:"cors",credentials:"include"}).then((function(e){if(e.ok)return e.arrayBuffer();throw m._context.emitMessage({mixId:t,state:Hd.AUDIO_MIXING_STATE_FAILED,error:dR.AUDIO_MIXING_ERROR_START_FAILED}),new lR(uR.LOAD_RESOURCES_FAILED,e.statusText)}));case 21:return l=e.sent,eb(r).call(r,"mp3")?h={type:"audio/mpeg"}:eb(r).call(r,"aac")&&(h={type:"audio/aac"}),e.next=25,Aq(l,h);case 25:if(e.sent){e.next=29;break}throw this._context.emitMessage({mixId:t,state:Hd.AUDIO_MIXING_STATE_FAILED,error:dR.AUDIO_MIXING_ERROR_START_FAILED}),new lR(uR.LOAD_RESOURCES_FAILED,"invalid audio resource");case 29:(u=new Audio).crossOrigin="anonymous",u.src=Iq.createObjectURL(new Blob([l],h));case 32:return i<=0?u.loop=!0:i>0&&(f=i,u.onended=function(){--f>0?u.play():(m.mixingMap.delete(t),m._context.emitMessage({mixId:t,state:Hd.AUDIO_MIXING_STATE_FINISHED,error:dR.AUDIO_MIXING_ERROR_OK}))}),e.prev=33,e.next=36,u.play();case 36:e.next=43;break;case 38:e.prev=38,e.t0=e.catch(33),console.error(e.t0),this._failedAudioList.push(u),this._context.onAutoPlayFailed({userId:this.id,kind:"audio",streamIndex:yd.STREAM_INDEX_MAIN,mediaType:Sd.AUDIO});case 43:if(this._startingIds.delete(t),p=this._sharedAudioContext.createMediaElementSource(u),v=this._sharedAudioContext.createGain(),_=this.volumeConfig.get(t),v.gain.value=_?_/100:1,p.connect(v).connect(this._audioDestination),this.mixingMap.set(t,{audioSource:p,audioNode:u,gainNode:v,type:"file"}),o===Gd.PUBLISH)try{v.disconnect(this._sharedAudioContext.destination)}catch(g){}else v.connect(this._sharedAudioContext.destination);this._context.updateLocalAudioTrack(this._audioDestination.stream.getAudioTracks()[0],n.type),this._context.emitMessage({mixId:t,state:Hd.AUDIO_MIXING_STATE_PLAYING,error:dR.AUDIO_MIXING_ERROR_OK});case 53:case"end":return e.stop()}}),e,this,[[33,38]])}))),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:Hd.AUDIO_MIXING_STATE_STOPPED,error:dR.AUDIO_MIXING_ERROR_OK}))}},{key:"pauseAudioMixing",value:function(e){var t=this.mixingMap.get(e);t&&(this._context.emitMessage({mixId:e,state:Hd.AUDIO_MIXING_STATE_PAUSED,error:dR.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:Hd.AUDIO_MIXING_STATE_PLAYING,error:dR.AUDIO_MIXING_ERROR_OK}),t.audioNode.play())}},{key:"preloadAudioMixing",value:(r=km(Em().mark((function e(t,r){var n,i,o=this;return Em().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 new lR(uR.LOAD_RESOURCES_FAILED,e.statusText)})).catch((function(e){if(o._context.emitMessage({mixId:t,state:Hd.AUDIO_MIXING_STATE_FAILED,error:dR.AUDIO_MIXING_ERROR_PRELOAD_FAILED}),e instanceof lR)throw e;throw new lR(uR.LOAD_RESOURCES_FAILED,"Load resources failed",e)}));case 3:return n=e.sent,eb(r).call(r,"mp3")?i={type:"audio/mpeg"}:eb(r).call(r,"aac")&&(i={type:"audio/aac"}),e.next=7,Aq(n,i);case 7:if(e.sent){e.next=11;break}throw this._context.emitMessage({mixId:t,state:Hd.AUDIO_MIXING_STATE_FAILED,error:dR.AUDIO_MIXING_ERROR_PRELOAD_FAILED}),new lR(uR.LOAD_RESOURCES_FAILED,"Load resources failed");case 11:return this._context.emitMessage({mixId:t,state:Hd.AUDIO_MIXING_STATE_PRELOADED,error:dR.AUDIO_MIXING_ERROR_OK}),this.resourcesCache.set(t,{getAudioNode:function(){var e=Iq.createObjectURL(new Blob([n],i));return o._revokeURLs.add(e),new Audio(e)},filePath:r,duration:0}),e.next=15,new X_((function(e){var r=Iq.createObjectURL(new Blob([n],i)),a=new Audio(r);a.addEventListener("durationchange",(function(){var n=o.resourcesCache.get(t);n&&(n.duration=a.duration,o.resourcesCache.set(t,n)),Iq.revokeObjectURL(r),e(null)}))}));case 15: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.resourcesCache.get(e);return t||r?t?1e3*t.audioNode.duration:r?1e3*r.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){Kw(e,"type",iz(Gd));var t=this._context.getLocalAudioTrack();if(t){var r=t.getTrack("preprocessing");if(r&&this.mixMediaStream(new MediaStream([r])),e===Gd.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:Hd.AUDIO_MIXING_STATE_PCM_ENABLED,error:dR.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:Hd.AUDIO_MIXING_STATE_PCM_DISABLED,error:dR.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=km(Em().mark((function e(){var t,r,n,i;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:t=[],r=QT(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({userId:this.id,kind:"audio",streamIndex:yd.STREAM_INDEX_MAIN,mediaType:Sd.AUDIO}),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(),this._startingIds=new uE,this._revokeURLs.forEach((function(e){Iq.revokeObjectURL(e)}))}}]),e}();Cq([hP("default","id","filePath","options")],Oq.prototype,"startAudioMixing",1),Cq([hP("default","id")],Oq.prototype,"stopAudioMixing",1),Cq([hP("default","id")],Oq.prototype,"pauseAudioMixing",1),Cq([hP("default","id")],Oq.prototype,"resumeAudioMixing",1),Cq([hP("default","id")],Oq.prototype,"preloadAudioMixing",1),Cq([hP("default","id")],Oq.prototype,"unloadAudioMixing",1),Cq([hP("default","id")],Oq.prototype,"getAudioMixingVolume",1),Cq([hP("default","id","volume")],Oq.prototype,"setAudioMixingVolume",1),Cq([hP("default","id")],Oq.prototype,"getAudioMixingDuration",1),Cq([hP("default","id")],Oq.prototype,"getAudioMixingCurrentPosition",1),Cq([hP("default","id","position")],Oq.prototype,"setAudioMixingPosition",1),Cq([hP("default","type")],Oq.prototype,"enableAudioMixingBuffer",1),Cq([hP()],Oq.prototype,"disableAudioMixingBuffer",1),Cq([hP("default","buffer")],Oq.prototype,"pushAudioMixingBuffer",1);var xq=function(e){return e.NORMAL_USER="normalUser",e.SILENT_USER="silentUser",e}(xq||{}),Dq=new RC("RTMClient",1),Pq=function(e){OI(u,e);var t,r,n,i,o,a,s,c=qI(u);function u(e,t){var r;return Wd(this,u),sd(ZT(r=c.call(this)),"_dataChannelSignal",null),sd(ZT(r),"_handler",null),sd(ZT(r),"_dataChannelSignalState",pF.DISCONNECTED),sd(ZT(r),"_loginSessionId",null),sd(ZT(r),"_userId",null),sd(ZT(r),"_token",null),sd(ZT(r),"_isReconnecting",!1),sd(ZT(r),"_reconnectTimer",null),sd(ZT(r),"_loginResolveCallback",null),sd(ZT(r),"_loginRejectCallback",null),sd(ZT(r),"_iceConfigNode",null),sd(ZT(r),"_wait_login_token",!1),sd(ZT(r),"_serverParamsCache",void 0),r.id=e,r._appId=t,r}return qd(u,[{key:"login",value:function(e,t){var r=this;return new X_((function(n,i){if(Dq.print("login","invoke login, token: %o, userId: %o",e,t),r._loginSessionId)throw new lR(uR.ALREADY_LOGIN,"Already logined");if(r._loginResolveCallback)throw new lR(uR.LOGIN_FAILED,"Is logging in, please try again later.");r._userId=t,r._token=e,cP.setStats({rtc_app_id:r._appId,rtm_user_id:t}),r._loginResolveCallback=n,r._loginRejectCallback=i,r._dataChannelSignal?r._login():(Dq.print("login","init dataChannelSingling"),r._dataChannelSignalState=pF.CONNECTING,r._createDataChannelSignaling(t).then((function(e){r._dataChannelSignal=e,r._login()})).catch((function(){r._onDisconnect()})))}))}},{key:"logout",value:(s=km(Em().mark((function e(){var t;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._loginSessionId&&this._userId){e.next=2;break}throw new lR(uR.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:lN.C2RTM}).catch((function(){}));case 4:this._closeDataChannelSignaling(),this._clearState();case 6:case"end":return e.stop()}}),e,this)}))),function(){return s.apply(this,arguments)})},{key:"updateLoginToken",value:(a=km(Em().mark((function e(t){var r=this;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this._token=t,e.abrupt("return",new X_((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 a.apply(this,arguments)})},{key:"getPeerOnlineStatus",value:(o=km(Em().mark((function e(t){var r;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._loginSessionId&&this._userId){e.next=2;break}throw new lR(uR.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:lN.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 o.apply(this,arguments)})},{key:"sendUserMessageOutsideRoom",value:(i=km(Em().mark((function e(t,r){return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._loginSessionId&&this._userId){e.next=2;break}throw new lR(uR.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=km(Em().mark((function e(t,r){return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(e.prev=0,zw(t,"signature"),zw(r,"url"),this._loginSessionId&&this._userId){e.next=5;break}throw new lR(uR.NOT_LOGIN,"login first");case 5:return this._checkDataChannelSignal(),e.next=8,this._dataChannelSignal.sendSignaling("setServerParams",{loginSessionId:this._loginSessionId,userId:this._userId,appId:this._appId,signature:t,url:r},{functionType:lN.C2RTM}).catch((function(e){throw new lR(uR.UNEXPECTED_ERROR,e.msg)}));case 8:this._serverParamsCache={signature:t,url:r},this.emit("onServerParamsSetResult"),e.next=16;break;case 12:throw e.prev=12,e.t0=e.catch(0),this.emit("onServerParamsSetResult",e.t0),e.t0;case 16:case"end":return e.stop()}}),e,this,[[0,12]])}))),function(e,t){return n.apply(this,arguments)})},{key:"sendServerMessage",value:(r=km(Em().mark((function e(t){return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._loginSessionId&&this._userId){e.next=2;break}throw new lR(uR.NOT_LOGIN,"login first");case 2:return this._checkDataChannelSignal(),e.abrupt("return",this._dataChannelSignal.sendP2PMessage({from:this._userId,app:this._appId,to:"",room:"",type:HP.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(),wI(AI(u.prototype),"removeAllListeners",this).call(this),delete this._serverParamsCache}},{key:"_login",value:function(){var e=this;if(this._userId){var t=aw();this._checkDataChannelSignal(),this._dataChannelSignal.sendSignaling("login",{Token:dw.token2auth(this._appId,null,this._userId,this._token),timestamp:Date.now(),loginSessionId:t,params:{deviceType:"web",userAgent:window.navigator.userAgent,sdkVersion:RP.VERSION,deviceId:bP.getDeviceId(),appId:this._appId,userId:this._userId}},{functionType:lN.C2RTM}).then((function(){"function"==typeof e._loginResolveCallback&&e._loginResolveCallback(),e._loginSessionId=t,$P(e.id,t),e._wait_login_token=!1,e._serverParamsCache&&e.setServerParams(e._serverParamsCache.signature,e._serverParamsCache.url)})).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=uR.INVALID_PARAMS,n="Invalid userId"):(r=uR.INVALID_TOKEN,n="Invalid token",e._wait_login_token=!0,e._loginRejectCallback||e.emit("onRTMTokenError")):(r=uR.LOGIN_FAILED,n="login failed"),"function"==typeof e._loginRejectCallback&&e._loginRejectCallback(new lR(r,a||n))})).finally((function(){e._loginResolveCallback=null,e._loginRejectCallback=null}))}}},{key:"_createDataChannelSignaling",value:(t=km(Em().mark((function e(t){var r,n,i,o,a,s,c,u=this;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=new vN,i=this._iceConfigNode){e.next=16;break}return e.prev=3,e.next=6,null==n?void 0:n.getAccessNode(this._appId,"",t,bP.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),pP("rtm.login.getNodeFailed","",0,!0),new lR(uR.ICE_SERVER_WRONG,"get ICE config failed");case 16:return pP("rtm.login.getNodeSuccess",i,0,!0),Dq.print("_createDataChannelSignaling()","get node success",i),this._handler=eF(oP),null===(r=this._handler)||void 0===r||r.once("disconnect",(function(){Dq.print("_createDataChannelSignaling()","recv BasicHandler event: disconnect"),u._onDisconnect()})),e.prev=20,e.next=23,null===(s=this._handler)||void 0===s?void 0:s.connect(i);case 23:a=e.sent,Dq.print("_createDataChannelSignaling()","establish peerConnection success"),this._dataChannelSignalState=pF.CONNECTED,e.next=33;break;case 28:throw e.prev=28,e.t1=e.catch(20),this._iceConfigNode=null,this._dataChannelSignalState=pF.DISCONNECTED,new lR(uR.ESTABLISH_DATACHANNEL_FAILED,"establish dataChannel failed",e.t1);case 33:return c=new hN(this.id,a),Dq.print("_createDataChannelSignaling()","send ping"),c.sendPingSignaling(),c.once("close",(function(){Dq.print("_createDataChannelSignaling()","recv DataChannelSignaling event: close"),u._onDisconnect()})),c.on(UP.USER_MESSAGE_RECEIVED_OUTSIDE_ROOM,(function(e){u.emit("onUserMessageReceivedOutsideRoom",{userId:e.from,message:e.msg})})),c.on(UP.USER_BINARY_MESSAGE_RECEIVED_OUTSIDE_ROOM,(function(e){u.emit("onUserBinaryMessageReceivedOutsideRoom",{userId:e.from,message:e.msg})})),c.on(UP.USER_DISCONNECTION,(function(){u.emit("onUserDisconnection"),u._clearState()})),c.on(UP.NODE_CHANGE,(function(e){pP("rtm.nodeChange",vk(e),0,!0),Array.isArray(e.nodes)&&e.nodes.length&&(u._iceConfigNode=e.nodes[0]),u._loginResolveCallback&&u._loginRejectCallback?u._login():u._reconnect()})),e.abrupt("return",c);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!==pF.CONNECTED)throw new lR(uR.NOT_CONNECTED_YET,"datachannel not connect")}},{key:"_onDisconnect",value:function(){this._dataChannelSignalState=pF.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&&(Dq.print("_reconnect()","start reconnect..."),this._isReconnecting=!0,this._createDataChannelSignaling(this._userId).then((function(t){Dq.print("_reconnect()","reconnect success!"),e._dataChannelSignal=t,e._login(),e._reconnectTimer=null})).catch((function(t){Dq.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,$P(this.id,""),null!==this._reconnectTimer&&(self.clearTimeout(this._reconnectTimer),this._reconnectTimer=null)}}]),u}(uC.exports.EventEmitter),Nq=function(e){OI(o,e);var t,r,n,i=qI(o);function o(e,t,r){var n,a=r.businessId;return Wd(this,o),sd(ZT(n=i.call(this)),"_mediaServerClient",void 0),sd(ZT(n),"_appId",void 0),sd(ZT(n),"_reconnectTimer",void 0),sd(ZT(n),"remoteStreams",void 0),sd(ZT(n),"_businessId",void 0),n.id=e,n._appId=t,n.remoteStreams=new uE,n._businessId=a,n}return qd(o,[{key:"connect",value:(n=km(Em().mark((function e(){return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this._mediaServerClient=new _F({id:this.id,avSync:!0}),this._businessId&&(this._mediaServerClient.businessId=this._businessId),this._bindEvents(),e.next=5,this._mediaServerClient.connect(this._appId);case 5:case"end":return e.stop()}}),e,this)}))),function(){return n.apply(this,arguments)})},{key:"startPlayPublicStream",value:(r=km(Em().mark((function e(t){var r,n=this;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this.remoteStreams.get(t)){e.next=2;break}throw new lR(uR.REPEAT_PLAY,"repeat play public media stream");case 2:return(r=new GV(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=Mw(e),i=0;i<t.seiCount;i++)n.emit(iF.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 uE,this._mediaServerClient&&this._mediaServerClient.destroy()}},{key:"_handleReconnected",value:(t=km(Em().mark((function e(){var t,r,n,i=this;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:clearTimeout(this._reconnectTimer),t=QT(this.remoteStreams);try{for(n=function(){var e=JT(r.value,1)[0];i.remoteStreams.delete(e),i.startPlayPublicStream(e).then((function(){var t=i.remoteStreams.get(e);i.safeEmit(iF.RESUBSCRIBE,{stream:t})}))},t.s();!(r=t.n()).done;)n()}catch(o){t.e(o)}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=window.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(FP.ABNORMAL_DISCONNECTION,this._reconnect.bind(this)),null===(t=this._mediaServerClient)||void 0===t||t.on("onRemoteStreamStats",(function(e){r.emit("onRemoteStreamStats",e)}))}}]),o}(OC),Mq=new RC("AudioDeviceManager",1),Lq=function(e){OI(c,e);var t,r,n,i,o,a,s=qI(c);function c(e){var t;return Wd(this,c),sd(ZT(t=s.call(this)),"_audioLevelFetcher",void 0),sd(ZT(t),"_playbackDeviceTestTimer",void 0),sd(ZT(t),"_audioElement",void 0),sd(ZT(t),"_audioTrack",void 0),sd(ZT(t),"_mediaRecorder",void 0),sd(ZT(t),"_recoderTimer",void 0),sd(ZT(t),"_isAudioPlaybackDeviceTesting",!1),sd(ZT(t),"_isAudioDeviceRecordTesting",!1),sd(ZT(t),"_audioCaptureAndRecoderResolve",void 0),sd(ZT(t),"_onAutoplayFailed",void 0),sd(ZT(t),"_audioPlaybackDeviceId",void 0),t._extensionManager=e,t}return qd(c,[{key:"startAudioPlaybackDeviceTest",value:(a=km(Em().mark((function e(t,r){return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this._isAudioPlaybackDeviceTesting&&!this._isAudioDeviceRecordTesting){e.next=2;break}throw new lR(uR.REPEAT_DEVICE_TEST,"device test cannot be called repeatedly at the same time.");case 2:return this._isAudioPlaybackDeviceTesting=!0,Mq.print("startAudioPlaybackDeviceTest()","Invoke"),e.prev=4,e.next=7,this._playAudioFile(t,{loop:!0});case 7:e.next=14;break;case 9:throw e.prev=9,e.t0=e.catch(4),Mq.print("startAudioPlaybackDeviceTest()","error",e.t0),this.stopAudioPlaybackDeviceTest(),e.t0;case 14:this._startEmitAudioPlaybackDeviceTestVolume(r);case 15:case"end":return e.stop()}}),e,this,[[4,9]])}))),function(e,t){return a.apply(this,arguments)})},{key:"stopAudioPlaybackDeviceTest",value:function(){this._isAudioPlaybackDeviceTesting&&(Mq.print("stopAudioPlaybackDeviceTest()","Invoke"),this._isAudioPlaybackDeviceTesting=!1,this._stopEmitAudioPlaybackDeviceTestVolume(),this._destroyAudioElement())}},{key:"startAudioDeviceRecordTest",value:(o=km(Em().mark((function e(t,r){var n=this;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(window.MediaRecorder){e.next=2;break}throw new lR(uR.NOT_SUPPORTED,"Your browser does not support MediaRecorder.");case 2:if(!this._isAudioDeviceRecordTesting){e.next=4;break}throw new lR(uR.REPEAT_DEVICE_TEST,"device test cannot be called repeatedly at the same time.");case 4:return this._isAudioDeviceRecordTesting=!0,Mq.print("startAudioDeviceRecordTest()","Invoke"),this._recoderTimer=window.setTimeout((function(){Mq.print("startAudioDeviceRecordTest()","".concat(3e4,'ms automatic call method "stopAudioDeviceRecordAndPlayTest"')),n._stopAudioCaptureAndRecoder()}),3e4),e.prev=7,this._onAutoplayFailed=r,e.next=11,this._startAudioCaptureAndRecoder(t);case 11:e.next=18;break;case 13:throw e.prev=13,e.t0=e.catch(7),this._isAudioDeviceRecordTesting=!1,delete this._onAutoplayFailed,e.t0;case 18:delete this._audioCaptureAndRecoderResolve;case 19:case"end":return e.stop()}}),e,this,[[7,13]])}))),function(e,t){return o.apply(this,arguments)})},{key:"stopAudioDeviceRecordAndPlayTest",value:function(){Mq.print("stopAudioDeviceRecordAndPlayTest()","Invoke"),void 0!==this._recoderTimer&&(clearTimeout(this._recoderTimer),delete this._recoderTimer),this._stopAudioCaptureAndRecoder()}},{key:"stopAudioDevicePlayTest",value:function(){this._isAudioDeviceRecordTesting&&(Mq.print("stopAudioDevicePlayTest()","Invoke"),this._isAudioDeviceRecordTesting=!1,this.stopAudioDeviceRecordAndPlayTest(),this._stopEmitAudioPlaybackDeviceTestVolume(),this._destroyAudioElement()),delete this._onAutoplayFailed}},{key:"getRecordTrack",value:function(){return this._audioTrack}},{key:"setSinkId",value:(i=km(Em().mark((function e(t){var r;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(Mq.print("setSinkId()","Invoke"),void 0!==HTMLAudioElement.prototype.setSinkId){e.next=3;break}throw new lR(uR.NOT_SUPPORTED,"setSinkId not supported by current browser");case 3:return e.next=5,PU.getDeviceById(t);case 5:if(r=e.sent){e.next=8;break}throw new lR(uR.INVALID_DEVICE_ID,"audio playback device id ".concat(t," is invalid"));case 8:return this._audioPlaybackDeviceId=t,this._setAudioCtxSinkId(),e.abrupt("return",r);case 11:case"end":return e.stop()}}),e,this)}))),function(e){return i.apply(this,arguments)})},{key:"getSinkId",value:function(){return this._audioPlaybackDeviceId}},{key:"destroy",value:function(){Mq.print("destroy()","Invoke"),wI(AI(c.prototype),"removeAllListeners",this).call(this),this.stopAudioPlaybackDeviceTest(),this.stopAudioDevicePlayTest()}},{key:"_playAudioFile",value:(n=km(Em().mark((function e(t,r){var n,i=this;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return Mq.print("_playAudioFile()",wm(n="Invoke url=".concat(t,"; loop=")).call(n,r.loop)),e.abrupt("return",new X_((function(e,n){var o=IG("audio",{attributes:{src:t,crossOrigin:"anonymous"}});i._audioElement=o,o.loop=r.loop,i._audioLevelFetcher=new MU(o),o.onplaying=function(){o.onplaying=null,Mq.print("_playAudioFile()","onplaying"),e()},o.onerror=function(){var e=km(Em().mark((function e(t){var r,i;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:Mq.print("_playAudioFile()","onerror",t),i=t.message||(null==o||null===(r=o.error)||void 0===r?void 0:r.message),n(new lR(uR.LOAD_RESOURCES_FAILED,"Failed to play recorded audio"+(i?", reason: ".concat(i):".")));case 3:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),i._setAudioCtxSinkId().then((function(){var e,t;return null===(e=o.play())||void 0===e||null===(t=e.catch)||void 0===t?void 0:t.call(e,(function(e){var t;Mq.print("_playAudioFile()","autoplay error",e);var r=wm(t="Failed to play recorded audio, ".concat(e.name,": ")).call(t,e.message);"NotAllowedError"===e.name&&i._onAutoplayFailed?i._onAutoplayFailed((function(){var e;return X_.all([null===(e=i._audioLevelFetcher)||void 0===e?void 0:e.resume(),o.play()])})):n(new lR(uR.LOAD_RESOURCES_FAILED,r))}))}))})));case 2:case"end":return e.stop()}}),e)}))),function(e,t){return n.apply(this,arguments)})},{key:"_destroyAudioElement",value:function(){this._audioElement&&(Mq.print("_destroyAudioElement()","Invoke"),this._audioElement.onplaying=null,this._audioElement.onerror=null,this._audioElement.src="",delete this._audioElement,"function"==typeof this._audioCaptureAndRecoderResolve&&this._audioCaptureAndRecoderResolve())}},{key:"_startEmitAudioPlaybackDeviceTestVolume",value:function(e){var t=this;e=Math.max(e,100),this._audioElement&&(Mq.print("_startEmitAudioPlaybackDeviceTestVolume()","start timer(".concat(e,"ms)")),this._playbackDeviceTestTimer=self.setInterval((function(){t._audioLevelFetcher&&t.emit("onAudioPlaybackDeviceTestVolume",t._audioLevelFetcher.getAudioLevel())}),e))}},{key:"_stopEmitAudioPlaybackDeviceTestVolume",value:function(){var e;void 0!==this._playbackDeviceTestTimer&&(Mq.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:(r=km(Em().mark((function e(t){var r,n=this;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,uV({},this._extensionManager);case 2:return this._audioTrack=e.sent,i=this._audioTrack.getTrack("preprocessing"),r=jU.get(i),Mq.print("startAudioDeviceRecordTest()","create microphone track success!"),e.abrupt("return",new X_((function(e,i){var o,a;"function"==typeof MediaRecorder.isTypeSupported&&(o=bb(a=["audio/webm","audio/mp4"]).call(a,(function(e){return MediaRecorder.isTypeSupported(e)})),Mq.print("startAudioDeviceRecordTest()","use mimeType: ".concat(o))),n._mediaRecorder=new MediaRecorder(r,o?{mimeType:o}:void 0);var s=n._mediaRecorder.mimeType;n._mediaRecorder.ondataavailable=function(){var r=km(Em().mark((function r(o){var a,c;return Em().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:if(!n._isAudioDeviceRecordTesting){r.next=16;break}return Mq.print("startAudioDeviceRecordTest()","get recorded file(mimeType: ".concat(s,").")),c=new Blob([o.data],{type:s}),r.prev=3,r.next=6,n._playAudioFile(Iq.createObjectURL(c),{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 lR(uR.AUDIO_DEVICE_TEST_FAILED,e.message||"mediaRecorder error"))},n._mediaRecorder.start()})));case 6:case"end":return e.stop()}var i}),e,this)}))),function(e){return r.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}},{key:"_setAudioCtxSinkId",value:(t=km(Em().mark((function e(){var t,r,n,i;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=this._audioPlaybackDeviceId){"default"===t&&(t="");try{null===(r=LU.getAudioContextInstance())||void 0===r||null===(n=r.setSinkId)||void 0===n||n.call(r,t),Mq.print("setSinkId","ctx.sinkId=".concat(t))}catch(o){Mq.print("setSinkId",wm(i="failed, ".concat(o.name," - ")).call(i,o.message))}}case 2:case"end":return e.stop()}}),e,this)}))),function(){return t.apply(this,arguments)})}]),c}(uC.exports.EventEmitter),Uq=function(){function e(t){Wd(this,e),sd(this,"_roomId",void 0),sd(this,"_constraints",{}),sd(this,"_profile",void 0),this._appId=t}return qd(e,[{key:"setRoomId",value:function(e){this._roomId=e}},{key:"setAudioProfile",value:function(e){this._profile=e}},{key:"getOpusConfigStr",value:function(){var e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",r=bP.getEngineWebConfig(this._appId,this._roomId||""),n=r.audio_encode,i=this.getConstraints(),o=i.sampleRate,a=i.channelCount,s="number"==typeof o?o:null==o?void 0:o.exact,c="number"==typeof a?a:null==a?void 0:a.exact,u={};t.split(";").forEach((function(e){var t=JT(e.split("="),2),r=t[0],n=t[1];r&&n&&(u[r]=n)}));var d=(null==n?void 0:n.bitrate)||this._getConfigByAudioProfile().bitrate;d&&(u.maxaveragebitrate=d);var l=(null==n?void 0:n.enc_sample_rate)||s;l&&(u["sprop-maxcapturerate"]=l);var h=(null==n?void 0:n.playback_rate)||s;return h&&(u.maxplaybackrate=h),(c&&c>1||null!=n&&n.stereo)&&(u["sprop-stereo"]=1,u.stereo=1),null!=n&&n.dtx&&(u.usedtx=1),lk(e=an(u)).call(e,(function(e){var t;return wm(t="".concat(e,"=")).call(t,u[e])})).join(";")}},{key:"updateConstraints",value:function(e){this._constraints=ud(ud({},this._constraints),e)}},{key:"getConstraints",value:function(){var e=ud({},this._constraints),t=bP.getEngineWebConfig(this._appId,this._roomId||"").audio_capture;Uw(null==t?void 0:t.sample_rate)||(e.sampleRate=t.sample_rate),Uw(null==t?void 0:t.channel)||(e.channelCount=t.channel),Uw(null==t?void 0:t.agc)||(e.autoGainControl=t.agc),Uw(null==t?void 0:t.ans)||(e.noiseSuppression=t.ans),Uw(null==t?void 0:t.aec)||(e.echoCancellation=t.aec);var r=this._getConfigByAudioProfile(),n=r.sampleRate,i=r.channel;return Uw(e.sampleRate)&&!Uw(n)&&(e.sampleRate=n),Uw(e.channelCount)&&!Uw(i)&&(e.channelCount=i),e}},{key:"_getConfigByAudioProfile",value:function(){var e={};switch(this._profile){case Pd.fluent:e.sampleRate=16e3,e.bitrate=24e3;break;case Pd.standard:e.sampleRate=48e3,e.bitrate=48e3;break;case Pd.hd:e.sampleRate=48e3,e.bitrate=128e3,e.channel=2;break;case Pd.standardStereo:e.sampleRate=48e3,e.bitrate=8e4,e.channel=2;break;case Pd.hdMono:e.sampleRate=48e3,e.bitrate=128e3}return e}}]),e}(),Vq=new RC("VideoSnapshot",1),Fq=function(e){var t=null==e?void 0:e.domElement;if(t&&!t.paused&&4===t.readyState)return t},Bq=function(){var e=km(Em().mark((function e(t,r,n){var i,o,a,s,c,u,d,l;return Em().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(),!(c=Fq(n))){e.next=16;break}return Vq.print("takeSnapshot","VideoPlayer already set."),e.next=11,a(c,c.videoWidth,c.videoHeight);case 11:return u=e.sent,Vq.print("takeSnapshot","success, cost ".concat(Date.now()-s,"ms")),e.abrupt("return",u);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 Vq.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,Vq.print("takeSnapshot","success, cost ".concat(Date.now()-s,"ms")),e.abrupt("return",l);case 29:return Vq.print("takeSnapshot","use temp video"),e.abrupt("return",new X_((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);Vq.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)}}(),jq=function(){return{url:"",video:{codec:Ld.H264,width:640,height:360,fps:15,gop:2,kBitRate:Gq(640,360,15)},audio:{codec:"AAC",kBitRate:64,sampleRate:48e3,channels:2,AACProfile:Md.LC},layout:{regions:[],appData:"",backgroundColor:"#000000"}}};function Gq(e,t,r){return e*t<=288e3?r<=15?800:1200:e*t<=864e3?r<=15?1200:1800:e*t<=1152e3?r<=15?1600:2400:e*t<=2592e3?r<=15?2500:3750:r<=15?3300:5e3}function Hq(e){if("string"!=typeof e||!/^rtmps?:\/\//.test(e))throw new lR(uR.INVALID_PARAMS,"Invalid rtmp address")}function zq(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];if(null==e||!e.length)throw new lR(uR.INVALID_PARAMS,"regions should not be empty.");var t,r=QT(e);try{for(r.s();!(t=r.n()).done;){var n=t.value;if("string"!=typeof n.userId)throw new lR(uR.INVALID_PARAMS,"region.userId(".concat(n.userId,") should be a string."));if("boolean"!=typeof n.isScreenStream)throw new lR(uR.INVALID_PARAMS,"region.isScreenStream(".concat(n.isScreenStream,") should be a boolean."))}}catch(i){r.e(i)}finally{r.f()}}function Kq(e,t){var r,n,i,o=function(e,r){var n=TE(e).call(e,(function(e,t){return null==e?void 0:e[t]}),t),i=TE(e).call(e,(function(e,t){return null==e?void 0:e[t]}),jq());return n&&r(n)?n:i},a=function(e){return e%2==0?e:e+1},s=a(o(["video","width"],(function(e){return e>=2&&e<=1920}))),c=a(o(["video","height"],(function(e){return e>=2&&e<=1920}))),u=o(["video","fps"],(function(e){return e>=1&&e<=60})),d=(null===(r=t.video)||void 0===r?void 0:r.kBitRate)||0,l=o(["audio","sampleRate"],(function(e){var t;return!!bb(t=[32e3,44100,48e3]).call(t,(function(t){return t===e||t/1e3===e}))}));return{type:"transcode",action:e,transcodeMeta:{transcode:{url:t.url},control:{protocol:"2.0"},audio:{codec:o(["audio","codec"],(function(e){return"AAC"===e})),bitRate:1e3*o(["audio","kBitRate"],(function(e){return e>=32&&e<=192})),sampleRate:l<100?1e3*l:l,channels:o(["audio","channels"],(function(e){var t;return Jm(t=[1,2]).call(t,e)})),profile:o(["audio","AACProfile"],(function(e){var t;return Jm(t=[Md.LC,Md.HEv1,Md.HEv2]).call(t,e)}))},video:{codec:o(["video","codec"],(function(e){var t;return Jm(t=["H264","H265"]).call(t,e)})),fps:u,gop:o(["video","gop"],(function(e){return e>=1&&e<=5}))*u,bitRate:1e3*(d>=16&&d<=1e4?d:Gq(s,c,u)),width:s,height:c},layout:{canvas:{bgnd:o(["layout","backgroundColor"],(function(e){return/^#([0-9a-fA-F]{6}|[0-9a-fA-F]{3})$/.test(e)}))},regions:(null===(n=t.layout)||void 0===n||null===(i=n.regions)||void 0===i?void 0:lk(i).call(i,(function(e){var t,r;return{alpha:!e.alpha||+e.alpha>1||+e.alpha<=0?1:+e.alpha,uid:e.userId,zorder:!e.zorder||+e.zorder<0||+e.zorder>100?0:+e.zorder,x:!e.x||+e.x>=1||+e.x<0?0:+e.x,y:!e.y||+e.y>=1||+e.y<0?0:+e.y,w:!e.w||+e.w>1||+e.w<=0?1:+e.w,h:!e.h||+e.h>1||+e.h<=0?1:+e.h,renderMode:e.renderMode&&Jm(t=[1,2,3]).call(t,e.renderMode)?e.renderMode:1,contentControl:e.contentControl&&Jm(r=[0,1,2]).call(r,e.contentControl)?e.contentControl:0,screen:!!e.isScreenStream}})))||[],app_data:o(["layout","appData"],(function(e){return"string"==typeof e}))}}}}var Xq,qq,Wq={getDefaultValue:jq,checkStartParams:function(e){var t;Hq(e.url),zq(null===(t=e.layout)||void 0===t?void 0:t.regions)},checckUpdateParams:function(e){var t;e.url&&Hq(e.url),zq(null===(t=e.layout)||void 0===t?void 0:t.regions)},getStartParams:function(e){return Kq("started",e)},getUpdateParams:function(e){return Kq("layoutChanged",e)}},Yq=ad,Qq=tc,Jq=function(e,t,r,n){for(var i,o=n>1?void 0:n?Qq(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&&Yq(t,r,o),o},Zq=new RC("Engine",0),$q=(qq=function(e){OI(_e,e);var t,r,n,i,o,a,s,c,u,d,l,h,f,p,v,_,m,g,y,S,E,b,k,T,I,A,R,w,C,O,x,D,P,N,M,L,U,V,F,B,j,G,H,z,K,X,q,W,Y,Q,J,Z,$,ee,te,re,ne,ie,oe,ae,se,ce,ue,de,le,he,fe,pe,ve=qI(_e);function _e(e,t){var r;return Wd(this,_e),sd(ZT(r=ve.call(this)),"id",(_e.GUID++).toString()),sd(ZT(r),"_room",void 0),sd(ZT(r),"_publicStreamManager",void 0),sd(ZT(r),"_appId",void 0),sd(ZT(r),"_businessId",void 0),sd(ZT(r),"_visibility",!0),sd(ZT(r),"_localVideoTrack",void 0),sd(ZT(r),"_localAudioTrack",void 0),sd(ZT(r),"_localImgVideoTrack",void 0),sd(ZT(r),"_localImgScreenTrack",void 0),sd(ZT(r),"_localScreenVideoTrack",void 0),sd(ZT(r),"_localScreenAudioTrack",void 0),sd(ZT(r),"_tempMixingAudioTrack",void 0),sd(ZT(r),"_videoPlayer",void 0),sd(ZT(r),"_screenPlayer",void 0),sd(ZT(r),"_remoteVideoPlayer",new uE),sd(ZT(r),"_remoteScreenPlayer",new uE),sd(ZT(r),"_remoteAudioPlayer",new uE),sd(ZT(r),"_remoteScreenAudioPlayer",new uE),sd(ZT(r),"_publicStreamAudioPlayer",new uE),sd(ZT(r),"_publicStreamVideoPlayer",new uE),sd(ZT(r),"_publicStreamIds",new uE),sd(ZT(r),"_roomConfig",void 0),sd(ZT(r),"_videoStreamConstraints",xP),sd(ZT(r),"_audioStreamConstraints",{}),sd(ZT(r),"_enableSimulcast",!1),sd(ZT(r),"_videoStreamEncodeConfig",[xP]),sd(ZT(r),"_screenStreamEncodeConfig",[DP]),sd(ZT(r),"_dummyMainImage",void 0),sd(ZT(r),"_dummyScreenImage",void 0),sd(ZT(r),"_trackSourceType",void 0),sd(ZT(r),"_liveTranscodeConfig",void 0),sd(ZT(r),"_useCloudProxy",void 0),sd(ZT(r),"_startCloudProxyTimestamp",void 0),sd(ZT(r),"_localVideoDeviceId",void 0),sd(ZT(r),"_localAudioDeviceId",void 0),sd(ZT(r),"_pauseAllSubscribeState",{audio:void 0,video:void 0,resumeStreamIds:{}}),sd(ZT(r),"_audioVolumeIndicationTimer",void 0),sd(ZT(r),"_dummyMainTimer",void 0),sd(ZT(r),"_dummyScreenTimer",void 0),sd(ZT(r),"_audioPropertiesReportTimer",null),sd(ZT(r),"_mirrorType",kd.MIRROR_TYPE_RENDER),sd(ZT(r),"_audioMixingManager",void 0),sd(ZT(r),"_pubLock",void 0),sd(ZT(r),"_rtmClient",void 0),sd(ZT(r),"_messageStatisticsObserver",void 0),sd(ZT(r),"_tempRoomInfo",void 0),sd(ZT(r),"_originIceConfigRequestUrls",void 0),sd(ZT(r),"_originConfigServerUrls",void 0),sd(ZT(r),"_originLogServerUrl",void 0),sd(ZT(r),"_extensionManager",new VU),sd(ZT(r),"_audioDeviceManager",new Lq(r._extensionManager)),sd(ZT(r),"_audioProfileManager",void 0),sd(ZT(r),"_requestManager",new _N),sd(ZT(r),"_remoteVideoConfig",new uE),sd(ZT(r),"_userPriorityMap",new uE),sd(ZT(r),"_subscribeFallbackOption",void 0),sd(ZT(r),"_cameraCapturing",!1),sd(ZT(r),"_interruptCameraCapture",!1),sd(ZT(r),"_micCapturing",!1),sd(ZT(r),"_interruptMicCapture",!1),sd(ZT(r),"_avSync",!0),sd(ZT(r),"_config",void 0),sd(ZT(r),"_needClosePreTrack",!1),sd(ZT(r),"_updateMixAudioTrack",function(){var e=km(Em().mark((function e(t){var n,i,o=arguments;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(i=o.length>1&&void 0!==o[1]?o[1]:Gd.PLAYOUT_AND_PUBLISH,Zq.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)}}()),sd(ZT(r),"_onAudioMixingMessage",(function(e){r.safeEmit(Kd.onAudioMixingStateChanged,e)})),sd(ZT(r),"_onAudioMixingAutoplayFailed",(function(e){r.safeEmit(Kd.onAutoplayFailed,e)})),r._appId=e,r._pubLock=new nF("pubLock"),r._addDeviceEventHandler(),r._audioMixingManager=new Oq({getLocalAudioTrack:function(){return r._localAudioTrack},updateLocalAudioTrack:r._updateMixAudioTrack,emitMessage:r._onAudioMixingMessage,onAutoPlayFailed:r._onAudioMixingAutoplayFailed}),r._audioProfileManager=new Uq(e),window.__rtc_engine__=ZT(r),window["__rtc_engine__".concat(Math.floor(100*Math.random()+1))]=ZT(r),r._trackSourceType={video:dd.VIDEO_SOURCE_TYPE_INTERNAL,screenVideo:dd.VIDEO_SOURCE_TYPE_INTERNAL,audio:ld.AUDIO_SOURCE_TYPE_INTERNAL,screenAudio:ld.AUDIO_SOURCE_TYPE_INTERNAL},r._config=t,r._rtmClient=new Pq(r.id,e),r._handleRTMClient(r._rtmClient),r._useCloudProxy=!1,r._handleAudioDeviceManager(),r._messageStatisticsObserver=new PG,r._extensionManager.setMinotor(iP),QP(r.id),r._requestManager.getConfig(e).then((function(e){e.rts_report&&YP(e.rts_report)})),r}return qd(_e,[{key:"appId",get:function(){return this._appId},set:function(e){this._appId=e}},{key:"updateToken",value:(pe=km(Em().mark((function e(t){var r,n,i,o,a;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(Zq.print("updateToken()","token: %s",t),zw(t,"token"),!this.waitForNewToken||!this._tempRoomInfo){e.next=8;break}return n=this._tempRoomInfo,i=n.config,o=n.userInfo,a=n.roomId,delete this._tempRoomInfo,e.next=7,this.joinRoom(t,a,o,i);case 7:return e.abrupt("return",e.sent);case 8:if(this._room){e.next=10;break}throw new lR(uR.UPDATE_TOKEN_BEFORE_JOIN,"update token before join room");case 10:return e.next=12,null===(r=this._room)||void 0===r?void 0:r.updateToken(t);case 12:case"end":return e.stop()}}),e,this)}))),function(e){return pe.apply(this,arguments)})},{key:"setVideoCaptureDevice",value:(fe=km(Em().mark((function e(t){var r,n,i=this;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(Zq.print("setVideoCaptureDevice()","deviceId: %s",t),zw(t,"deviceId"),this._localVideoDeviceId=t,this._localVideoTrack){e.next=5;break}return e.abrupt("return");case 5:return r=rz({},this._videoStreamConstraints),"user"===t||"environment"===t||"left"===t||"right"===t?(delete r.deviceId,r.facingMode=t):r.deviceId={exact:t},this._needClosePreTrack&&(this._removeLocalTrackEvents(this._localVideoTrack),this._localVideoTrack.close(),delete this._localVideoTrack),Zq.print("setVideoCaptureDevice()","start createCameraVideoTrack..."),e.next=11,sV(r,this._extensionManager).catch((function(e){if(i._localVideoTrack&&!i._localVideoTrack.dummy)return Zq.print("setVideoCaptureDevice()","createCameraVideoTrack failed, stop pre VideoTrack."),i._removeLocalTrackEvents(i._localVideoTrack),i._localVideoTrack.close(),delete i._localVideoTrack,sV(r,i._extensionManager).then((function(e){return i._needClosePreTrack=!0,e})).catch(km(Em().mark((function t(){var r;return Em().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return Zq.print("setVideoCaptureDevice()","createCameraVideoTrack failed, rollback."),t.next=3,sV(i._videoStreamConstraints,i._extensionManager);case 3:throw r=t.sent,i._switchTrack(r),e;case 6:case"end":return t.stop()}}),t)}))));throw e}));case 11:return n=e.sent,Zq.print("setVideoCaptureDevice()","createCameraVideoTrack success."),this._videoStreamConstraints=r,this._localVideoTrack&&(this._removeLocalTrackEvents(this._localVideoTrack),this._localVideoTrack.close()),e.next=17,this._switchTrack(n);case 17:case"end":return e.stop()}}),e,this)}))),function(e){return fe.apply(this,arguments)})},{key:"setAudioCaptureDevice",value:(he=km(Em().mark((function e(t){var r;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(Zq.print("setAudioCaptureDevice()","deviceId: %s",t),zw(t,"deviceId"),this._localAudioDeviceId=t,this._localAudioTrack){e.next=5;break}return e.abrupt("return");case 5:return this._audioProfileManager.updateConstraints({deviceId:{exact:t}}),this._localAudioTrack.close(),this._removeLocalTrackEvents(this._localAudioTrack),e.next=10,uV(this._audioProfileManager.getConstraints(),this._extensionManager);case 10:if(r=e.sent,this._initLocalTrackEvents(r),this._localAudioTrack=r,this._room){e.next=15;break}return e.abrupt("return");case 15:if(!this._room.hasPublished){e.next=18;break}return e.next=18,this._updatePublish();case 18:case"end":return e.stop()}}),e,this)}))),function(e){return he.apply(this,arguments)})},{key:"_addDeviceEventHandler",value:function(){PU.on(Kd.onVideoDeviceStateChanged,this._onVideoDeviceStateChange.bind(this)),PU.on(Kd.onAudioDeviceStateChanged,this._onAudioDeviceStateChange.bind(this))}},{key:"_addHandlerEventHandler",value:function(){var e,t,r,n,i,o,a,s,c,u,d,l,h,f,p,v,_,m,g,y,S,E,b,k,T,I,A,R,w,C,O,x=this;null===(e=this._room)||void 0===e||e.on(UP.ON_ADD_STREAM,this._onAddStream.bind(this)),null===(t=this._room)||void 0===t||t.on(UP.ON_REMOVE_STREAM,this._onRemoveStream.bind(this)),null===(r=this._room)||void 0===r||r.on(UP.USER_CONNECTION,this._onUserConnection.bind(this)),null===(n=this._room)||void 0===n||n.on(iF.ON_USER_LEAVE,this._onUserLeave.bind(this)),null===(i=this._room)||void 0===i||i.on(iF.ON_ROOM_ERROR,this._onRoomError.bind(this)),null===(o=this._room)||void 0===o||o.on(iF.ON_NETWORK_QUALITY,this._onNetworkQuality.bind(this)),null===(a=this._room)||void 0===a||a.on(UP.ON_CUSTOM_MESSAGE,this._onCustomMessage.bind(this)),null===(s=this._room)||void 0===s||s.on(UP.USER_MESSAGE_RECEIVED,this._onUserMessageReceived.bind(this)),null===(c=this._room)||void 0===c||c.on(UP.USER_BINARY_MESSAGE_RECEIVED,this._onUserBinaryMessageReceived.bind(this)),null===(u=this._room)||void 0===u||u.on(UP.ON_USER_TOKEN_WILL_EXPIRE,this._onUserTokenWillExpire.bind(this)),null===(d=this._room)||void 0===d||d.on(UP.POST_PROCESSING_MESSAGE,(function(e){"2.0"===e.protocol?x._onStreamMixingEvent({error:e.error,event:e.eventType,message:e.message}):"publicStreamCallback"===e.type?x._onPushPublicStreamResult(e):"transcodeStatusCallback"===e.type&&x._onLiveTranscodingResult(e)})),null===(l=this._room)||void 0===l||l.on(FP.ON_CONNECTION_STATE_CHANGE,this._onConnectionStateChange.bind(this)),null===(h=this._room)||void 0===h||h.on(iF.RESUBSCRIBE,this._onResubscribe.bind(this)),null===(f=this._room)||void 0===f||f.on(iF.SUBSCRIBE_PUSH_TRACK,this._onSubscribePushTrack.bind(this)),null===(p=this._room)||void 0===p||p.on(iF.REMOVE_PUSH_TRACK,this._onRemovePushTrack.bind(this)),null===(v=this._room)||void 0===v||v.on(iF.ON_PUBLISH_RESULT,(function(e){var t;null!==(t=x._room)&&void 0!==t&&t._roomConfig.isAutoPublish&&x.safeEmit(Kd.onAutoPublishResult,e)})),null===(_=this._room)||void 0===_||_.on(iF.ON_REMOTE_STREAM_STATS,(function(e){x.safeEmit(Kd.onRemoteStreamStats,e)})),null===(m=this._room)||void 0===m||m.on(iF.ON_LOCAL_STREAM_STATS,(function(e){x.safeEmit(Kd.onLocalStreamStats,e)})),null===(g=this._room)||void 0===g||g.on(iF.ON_SUBTITLE_STATE_CHANGED,(function(e){x.safeEmit(Kd.onSubtitleStateChanged,e)})),null===(y=this._room)||void 0===y||y.on(iF.ON_SUBTITLE_MESSAGE_RECEIVED,(function(e){x.safeEmit(Kd.onSubtitleMessageReceived,e)})),null===(S=this._room)||void 0===S||S.on(iF.ON_USER_PUBLISH_STATE_CHANGE,this._onUserPublishStateChange.bind(this)),null===(E=this._room)||void 0===E||E.on(iF.ON_USER_START_AUDIO_CAPTURE,(function(e,t){var r=e.userId;x._updateAudioPlayerState(t),x.safeEmit(Kd.onUserStartAudioCapture,{userId:r})})),null===(b=this._room)||void 0===b||b.on(iF.ON_USER_STOP_AUDIO_CAPTURE,(function(e){var t=e.userId;x.safeEmit(Kd.onUserStopAudioCapture,{userId:t})})),null===(k=this._room)||void 0===k||k.on(iF.ON_USER_START_VIDEO_CAPTURE,(function(e){var t=e.userId;x.safeEmit(Kd.onUserStartVideoCapture,{userId:t})})),null===(T=this._room)||void 0===T||T.on(iF.ON_USER_STOP_VIDEO_CAPTURE,(function(e){var t=e.userId;x.safeEmit(Kd.onUserStopVideoCapture,{userId:t})})),null===(I=this._room)||void 0===I||I.on(iF.ON_SEI_MESSAGED_RECEIVED,(function(e){x.safeEmit(Kd.onSEIMessageReceived,e)})),null===(A=this._room)||void 0===A||A.on(iF.ON_REMOTE_VIDEO_SIZE_CHANGED,(function(e,t){x.safeEmit(Kd.onRemoteVideoSizeChanged,e,t)})),null===(R=this._room)||void 0===R||R.on(iF.ON_SIMULCAST_SUBSCRIBE_FALLBACK,(function(e){return x.safeEmit(Kd.onSimulcastSubscribeFallback,e)})),null===(w=this._room)||void 0===w||w.on(iF.RECONNECT_FAILED,(function(){x.safeEmit(Kd.onError,{errorCode:uR.RECONNECT_FAILED})})),null===(C=this._room)||void 0===C||C.on(iF.ON_VIDEO_STREAM_BANNED,(function(e){x.safeEmit(Kd.onVideoStreamBanned,{uid:e.uid,banned:e.banned})})),null===(O=this._room)||void 0===O||O.on(iF.ON_AUDIO_STREAM_BANNED,(function(e){x.safeEmit(Kd.onAudioStreamBanned,{uid:e.uid,banned:e.banned})}))}},{key:"safeEmit",value:function(e){for(var t,r,n=arguments.length,i=new Array(n>1?n-1:0),o=1;o<n;o++)i[o-1]=arguments[o];return oC(e)&&fP(e,ww(i)),(t=wI(AI(_e.prototype),"safeEmit",this)).call.apply(t,wm(r=[this,e]).call(r,i))}},{key:"_removeHandlerEventHandler",value:function(){var e;null===(e=this._room)||void 0===e||e.removeAllListeners()}},{key:"setConnectionMode",value:function(e){Kw(e,"mode",[Fd.AUTO,Fd.FORCE_TCP,Fd.FORCE_UDP]),wP("CONNECTION_MODE",e)}},{key:"joinRoom",value:(le=km(Em().mark((function e(t,r,n,i){var o,a,s,c,u,d;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(Zq.print("joinRoom()","token: %o roomId: %o, userInfo: %o, roomConfig: %o",t,r,n,i),Jw(t)||zw(t,"token"),Zw(r),tC(n),rC(i=rz({isAutoPublish:!0,isAutoSubscribeAudio:!0,isAutoSubscribeVideo:!0,roomProfileType:Dd.communication},i)),!this._room||this._room.connectionState===pF.DISCONNECTED){e.next=10;break}throw new lR(uR.REPEAT_JOIN,"Already joined");case 10:return this._room=new kG(i,{id:this.id,audioProfileManager:this._audioProfileManager,streamRTT:{},subscribeFallbackOption:this._subscribeFallbackOption,userPriority:this._userPriorityMap,avSync:this._avSync}),this._addHandlerEventHandler(),o=this._liveTranscodeConfig&&Wq.getStartParams(this._liveTranscodeConfig),a=ud(ud({},n),{},{businessId:this._businessId,role:this._visibility?xq.NORMAL_USER:xq.SILENT_USER}),e.prev=14,this._useCloudProxy&&(this._startCloudProxyTimestamp=Date.now()),mG(a),e.next=19,this._room.join(this._appId,r,t,a,o,this._useCloudProxy,null===(s=this._config)||void 0===s?void 0:s.expectedIDC);case 19:return u=e.sent,this._roomConfig=i,this._audioProfileManager.setRoomId(r),this._tempRoomInfo&&delete this._tempRoomInfo,null!==(c=i)&&void 0!==c&&c.isAutoPublish&&(this._visibility?this._updatePublish({invokeByJoinRoom:!0,mediaType:Sd.AUDIO_AND_VIDEO}):this.safeEmit(Kd.onAutoPublishResult,{isScreen:!1,state:_d.PUBLISH_FAIL})),ZP(this.id,this._room.roomInfo),e.abrupt("return",u);case 28:throw e.prev=28,e.t0=e.catch(14),e.t0.code===uR.INVALID_TOKEN&&(this._tempRoomInfo={config:i,roomId:r,userInfo:a}),null===(d=this._room)||void 0===d||d.destroy(),e.t0;case 33:case"end":return e.stop()}}),e,this,[[14,28]])}))),function(e,t,r,n){return le.apply(this,arguments)})},{key:"leaveRoom",value:(de=km(Em().mark((function e(){var t,r,n,i=arguments;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=i.length>0&&void 0!==i[0]&&i[0],Zq.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._audioProfileManager.setRoomId(),this._liveTranscodeConfig&&this.stopLiveTranscoding(),this._room=void 0,this._remoteAudioPlayer.forEach((function(e){return e.destroy()})),this._remoteAudioPlayer=new uE,this._remoteScreenAudioPlayer.forEach((function(e){return e.destroy()})),this._remoteScreenAudioPlayer=new uE,this._remoteScreenPlayer.forEach((function(e){return e.destroy()})),this._remoteScreenPlayer=new uE,this._remoteVideoPlayer.forEach((function(e){return e.destroy()})),this._remoteVideoPlayer=new uE,this._roomConfig=void 0,this._publicStreamIds=new uE,ZP(this.id);case 23:case"end":return e.stop()}}),e,this)}))),function(){return de.apply(this,arguments)})},{key:"destroy",value:function(){var e,t,r;Zq.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._videoStreamEncodeConfig=[xP],this._screenStreamEncodeConfig=[DP],this._pauseAllSubscribeState={audio:void 0,video:void 0,resumeStreamIds:{}},this._messageStatisticsObserver.destroy(),JP(this.id),clearInterval(this._audioVolumeIndicationTimer),clearInterval(this._dummyMainTimer),clearInterval(this._dummyScreenTimer),this._audioVolumeIndicationTimer=void 0,this._stopAudioPropertiesReport(),this._localAudioTrack&&(this._removeLocalTrackEvents(this._localAudioTrack),this._localAudioTrack.close(),this._localAudioTrack=void 0),this._localVideoTrack&&(this._removeLocalTrackEvents(this._localVideoTrack),this._localVideoTrack.close(),this._localVideoTrack=void 0),this._localScreenAudioTrack&&(this._removeLocalTrackEvents(this._localScreenAudioTrack),this._localScreenAudioTrack.close(),this._localScreenAudioTrack=void 0),this._localScreenVideoTrack&&(this._removeLocalTrackEvents(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 uE,this._remoteScreenAudioPlayer.forEach((function(e){return e.destroy()})),this._remoteScreenAudioPlayer=new uE,this._remoteScreenPlayer.forEach((function(e){return e.destroy()})),this._remoteScreenPlayer=new uE,this._remoteVideoPlayer.forEach((function(e){return e.destroy()})),this._remoteVideoPlayer=new uE,this._publicStreamAudioPlayer.forEach((function(e){return e.destroy()})),this._publicStreamAudioPlayer=new uE,this._publicStreamVideoPlayer.forEach((function(e){return e.destroy()})),this._publicStreamVideoPlayer=new uE,this._roomConfig=void 0,this._audioMixingManager.destroy(),this._rtmClient.destroy(),null===(r=this._publicStreamManager)||void 0===r||r.destroy(),this._publicStreamIds=new uE,this._audioDeviceManager.destroy(),this._remoteVideoConfig=new uE,this._userPriorityMap.clear(),this._extensionManager.destroy(),this._cameraCapturing=!1,this._micCapturing=!1,this._interruptCameraCapture=!1,this._interruptMicCapture=!1,this._avSync=!0}},{key:"publishStream",value:(ue=km(Em().mark((function e(t){return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(Zq.print("publishStream()","mediaType: %o",t),this._checkMediaType(t),this._assertNotInRoom(),!Pw(t)||this._localVideoTrack||!this._localImgVideoTrack){e.next=7;break}return e.next=6,nV(this._localImgVideoTrack,this._extensionManager);case 6:this._localVideoTrack=e.sent;case 7:return e.next=9,this._updatePublish({mediaType:t});case 9:case"end":return e.stop()}}),e,this)}))),function(e){return ue.apply(this,arguments)})},{key:"unpublishStream",value:(ce=km(Em().mark((function e(t,r){var n;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(Zq.print("unpublishStream()","mediaType: %o",t),this._checkMediaType(t),this._assertNotInRoom(),!r){e.next=5;break}return e.abrupt("return",null===(n=this._room)||void 0===n?void 0:n.unpublish());case 5:return e.next=7,this._updatePublish({mediaType:t,pubState:aF.UNPUB});case 7:case"end":return e.stop()}}),e,this)}))),function(e,t){return ce.apply(this,arguments)})},{key:"publishScreen",value:(se=km(Em().mark((function e(t){return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(Zq.print("publishScreen()","mediaType: %o",t),this._checkMediaType(t),this._assertNotInRoom(),e.prev=3,!Pw(t)||this._localScreenVideoTrack||!this._localImgScreenTrack){e.next=8;break}return e.next=7,oV(this._localImgScreenTrack,this._extensionManager);case 7:this._localScreenVideoTrack=e.sent;case 8:return e.next=10,this._updateScreenPublish({mediaType:t,pubState:aF.PUB});case 10:e.next=19;break;case 12:if(e.prev=12,e.t0=e.catch(3),!(e.t0 instanceof lR)){e.next=18;break}throw e.t0;case 18:throw new lR(uR.UNEXPECTED_ERROR,"unexpected error",e.t0);case 19:case"end":return e.stop()}}),e,this,[[3,12]])}))),function(e){return se.apply(this,arguments)})},{key:"unpublishScreen",value:(ae=km(Em().mark((function e(t){return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return Zq.print("unpublishScreen()","mediaType: %o",t),this._checkMediaType(t),this._assertNotInRoom(),e.next=5,this._updateScreenPublish({mediaType:t,pubState:aF.UNPUB});case 5:case"end":return e.stop()}}),e,this)}))),function(e){return ae.apply(this,arguments)})},{key:"subscribeStream",value:(oe=km(Em().mark((function e(t,r){return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return Zq.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 oe.apply(this,arguments)})},{key:"_subscribe",value:(ie=km(Em().mark((function e(t,r,n){var i,o,a,s,c,u,d,l,h,f,p,v,_,m,g,y;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._checkMediaType(n),this._assertNotInRoom(),n!==Sd.AUDIO||null===(i=this._room)||void 0===i||!i.multiChatMode){e.next=5;break}return Zq.print("subscribeStream()","due to multiChatMode return"),e.abrupt("return");case 5:if(u=this._room.remoteStreams.get(r),d=null==u?void 0:bb(u).call(u,(function(e){return e.isScreen===t}))){e.next=9;break}throw new lR(uR.STREAM_NOT_EXIST,"stream not exist");case 9:return l=this._pauseAllSubscribeState.audio,h=this._pauseAllSubscribeState.video,this._pauseAllSubscribeState.audio&&(n-=n&Sd.AUDIO),this._pauseAllSubscribeState.video&&(n-=n&Sd.VIDEO),Zq.print("subscribeStream()","due to pauseAll mediaType: %o",n),f=d.hasSubscribed,p=this._remoteVideoConfig.get(r)||(null===(o=this._roomConfig)||void 0===o?void 0:o.remoteVideoConfig),d.originalMediaType=n,e.next=19,this._room.subscribe(d,n,p);case 19:Dw(n)&&this._updateAudioPlayerState(d),Pw(n)&&this._updateVideoPlayerState(d),v=0,_=0,l!==this._pauseAllSubscribeState.audio&&(this._pauseAllSubscribeState.audio?v|=Sd.AUDIO:_|=Sd.AUDIO),h!==this._pauseAllSubscribeState.video&&(this._pauseAllSubscribeState.video?v|=Sd.VIDEO:_|=Sd.VIDEO),v&&this.pauseAllSubscribedStream(v),_&&this.resumeAllSubscribedStream(_),this._pauseAllSubscribeState.resumeStreamIds[d.streamId]=d.streamId,!t&&(null!==(a=this._roomConfig)&&void 0!==a&&a.isAutoSubscribeAudio||null!==(s=this._roomConfig)&&void 0!==s&&s.isAutoSubscribeVideo)&&(d.audioTrack||d.videoTrack)&&(m={userId:r,isScreen:!1,state:vd.SUBSCRIBE_SUCC},this.safeEmit(Kd.onAutoSubscribeResult,m)),null!==(c=this._room)&&void 0!==c&&c.multiChatMode||f||!Dw(n)||!d.hasAudio||null===(g=d.observer)||void 0===g||g.setSubscribeAudio(!0),!f&&Pw(n)&&d.hasVideo&&(null===(y=d.observer)||void 0===y||y.setSubscribeVideo(!0));case 31:case"end":return e.stop()}}),e,this)}))),function(e,t,r){return ie.apply(this,arguments)})},{key:"unsubscribeStream",value:(ne=km(Em().mark((function e(t,r){return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:Zq.print("unsubscribeStream()","userId: %o, mediaType: %o",t,r),this._unsubscribe(!1,t,r);case 2:case"end":return e.stop()}}),e,this)}))),function(e,t){return ne.apply(this,arguments)})},{key:"subscribeScreen",value:(re=km(Em().mark((function e(t,r){return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return Zq.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 re.apply(this,arguments)})},{key:"unsubscribeScreen",value:(te=km(Em().mark((function e(t,r){return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:Zq.print("unsubscribeScreen() userId: %o, mediaType: %o",t,r),this._unsubscribe(!0,t,r);case 2:case"end":return e.stop()}}),e,this)}))),function(e,t){return te.apply(this,arguments)})},{key:"_unsubscribe",value:function(e,t,r,n){var i,o=this;if(this._checkMediaType(r),this._assertNotInRoom(),r!==Sd.AUDIO||null===(i=this._room)||void 0===i||!i.multiChatMode){var a=this._room.remoteStreams.get(t),s=null==a?void 0:bb(a).call(a,(function(t){return t.isScreen===e}));if(null==s||!s.hasSubscribed)throw new lR(uR.STREAM_NOT_EXIST,"stream not exist");return this._room.unsubscribe(s,r).then((function(){n||delete o._pauseAllSubscribeState.resumeStreamIds[s.streamId]}))}Zq.print("subscribeStream()","due to multiChatMode return")}},{key:"setRemoteVideoConfig",value:(ee=km(Em().mark((function e(t,r){var n;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return Zq.print("setRemoteVideoConfig() userId: %o, remoteVideoConfig: %o",t,r),$w(t),aC(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 ee.apply(this,arguments)})},{key:"startVideoCapture",value:($=km(Em().mark((function e(t){var r,n,i,o,a,s,c,u,d,l=this;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(Zq.print("startVideoCapture()","deviceId: %s",t),Jw(t)||zw(t,"deviceId"),t=t||this._localVideoDeviceId,this._localVideoDeviceId=t,this._trackSourceType.video!==dd.VIDEO_SOURCE_TYPE_EXTERNAL){e.next=6;break}throw new lR(uR.STREAM_TYPE_NOT_MATCH,"setVideoSourceType as internal first");case 6:if(!(this._cameraCapturing||this._localVideoTrack&&!this._localVideoTrack.dummy)){e.next=8;break}throw new lR(uR.REPEAT_CAPTURE,"Has already capture");case 8:return i=this._videoStreamConstraints,t&&("user"===t||"environment"===t||"left"===t||"right"===t?i.facingMode=t:i.deviceId={exact:t},this._videoStreamConstraints=i),o={},e.prev=11,this._cameraCapturing=!0,e.next=15,sV(i,this._extensionManager);case 15:if(s=e.sent,!this._interruptCameraCapture){e.next=21;break}throw this._interruptCameraCapture=!1,this._removeLocalTrackEvents(s),s.close(),new lR(uR.INTERRUPT,"interrupt by stopVideoCapture");case 21:if(this._initLocalTrackEvents(s),this._localVideoTrack=s,null===(a=this._videoPlayer)||void 0===a||a.playVideo(s),(c=null==s?void 0:s.getTrack())&&(o=c.getSettings(),u={width:o.width,height:o.height},this._localVideoTrack.resolution=u,setTimeout((function(){return l.safeEmit(Kd.onLocalVideoSizeChanged,{streamIndex:yd.STREAM_INDEX_MAIN,info:u})}))),this._room){e.next=28;break}return e.abrupt("return",o);case 28:return e.prev=28,this._cameraCapturing=!1,e.finish(28);case 31:return d=this._room._roomConfig.isAutoPublish,(this._room.hasPublished||d)&&(this._visibility?this._updatePublish():this.safeEmit(Kd.onAutoPublishResult,{isScreen:!1,state:_d.PUBLISH_FAIL})),null===(r=this._room.localStream)||void 0===r||null===(n=r.observer)||void 0===n||n.setEnableVideo(!0),e.abrupt("return",o);case 35:case"end":return e.stop()}}),e,this,[[11,,28,31]])}))),function(e){return $.apply(this,arguments)})},{key:"stopVideoCapture",value:(Z=km(Em().mark((function e(){var t,r,n,i,o,a;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(Zq.print("stopVideoCapture()"),!this._cameraCapturing){e.next=5;break}return this._interruptCameraCapture=!0,Zq.print("stopVideoCapture()","capturing"),e.abrupt("return");case 5:if(this._trackSourceType.video!==dd.VIDEO_SOURCE_TYPE_EXTERNAL){e.next=7;break}throw new lR(uR.STREAM_TYPE_NOT_MATCH,"setVideoSourceType as internal first");case 7:if(null===(t=this._videoPlayer)||void 0===t||t.stop(),this._localVideoTrack&&(this._localVideoTrack.dummy||(this._removeLocalTrackEvents(this._localVideoTrack),this._localVideoTrack.close(),this._localImgVideoTrack?(null===(a=this._localVideoTrack)||void 0===a||a.setTrack(this._localImgVideoTrack,this._extensionManager),this._localVideoTrack.dummy=!0):this._localVideoTrack=void 0)),this._room){e.next=11;break}return e.abrupt("return");case 11:if(null===(r=this._room)||void 0===r||!r.hasPublished){e.next=14;break}return e.next=14,this._updatePublish();case 14:null===(n=this._room)||void 0===n||null===(i=n.localStream)||void 0===i||null===(o=i.observer)||void 0===o||o.setEnableVideo(!1);case 15:case"end":return e.stop()}}),e,this)}))),function(){return Z.apply(this,arguments)})},{key:"startAudioCapture",value:(J=km(Em().mark((function e(t){var r,n,i,o,a,s;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(Zq.print("startAudioCapture()","deviceId: $o",t),Jw(t)||zw(t,"deviceId"),t=t||this._localAudioDeviceId,this._localAudioDeviceId=t,this._trackSourceType.audio!==ld.AUDIO_SOURCE_TYPE_EXTERNAL){e.next=6;break}throw new lR(uR.STREAM_TYPE_NOT_MATCH,"setAudioSourceType as internal first");case 6:if(!this._micCapturing&&!this._localAudioTrack){e.next=8;break}throw new lR(uR.REPEAT_CAPTURE,"Has already capture");case 8:return t&&this._audioProfileManager.updateConstraints({deviceId:{exact:t}}),i={},e.prev=10,this._micCapturing=!0,e.next=14,uV(this._audioProfileManager.getConstraints(),this._extensionManager);case 14:if(o=e.sent,!this._interruptMicCapture){e.next=20;break}throw this._interruptMicCapture=!1,this._removeLocalTrackEvents(o),o.close(),new lR(uR.INTERRUPT,"interrupt by stopAudioCapture");case 20:if(this._initLocalTrackEvents(o),this._localAudioTrack=o,this._tempMixingAudioTrack&&(this._localAudioTrack.mixType=this._tempMixingAudioTrack.type,this._localAudioTrack.mixedAudioTrack=this._tempMixingAudioTrack.track,delete this._tempMixingAudioTrack),(a=null==o?void 0:o.getTrack())&&(i=a.getSettings()),this._room){e.next=27;break}return e.abrupt("return",i);case 27:return e.prev=27,this._micCapturing=!1,e.finish(27);case 30:return s=this._room._roomConfig.isAutoPublish,(this._room.hasPublished||s)&&(this._visibility?this._updatePublish():this.safeEmit(Kd.onAutoPublishResult,{isScreen:!1,state:_d.PUBLISH_FAIL})),null===(r=this._room.localStream)||void 0===r||null===(n=r.observer)||void 0===n||n.setEnableAudio(!0),e.abrupt("return",i);case 34:case"end":return e.stop()}}),e,this,[[10,,27,30]])}))),function(e){return J.apply(this,arguments)})},{key:"stopAudioCapture",value:(Q=km(Em().mark((function e(){var t,r;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(Zq.print("stopAudioCapture()"),!this._micCapturing){e.next=5;break}return this._interruptMicCapture=!0,Zq.print("stopAudioCapture()","capturing"),e.abrupt("return");case 5:if(this._trackSourceType.audio!==ld.AUDIO_SOURCE_TYPE_EXTERNAL){e.next=7;break}throw new lR(uR.STREAM_TYPE_NOT_MATCH,"setAudioSourceType as internal first");case 7:if(this._localAudioTrack&&(this._removeLocalTrackEvents(this._localAudioTrack),this._localAudioTrack.close()),this._localAudioTrack=void 0,this._audioMixingManager.stopAll(),this._room){e.next=12;break}return e.abrupt("return");case 12:if(!this._room.hasPublished){e.next=15;break}return e.next=15,this._updatePublish();case 15:null===(t=this._room.localStream)||void 0===t||null===(r=t.observer)||void 0===r||r.setEnableAudio(!1);case 16:case"end":return e.stop()}}),e,this)}))),function(){return Q.apply(this,arguments)})},{key:"getAudioMixingManager",value:function(){return Zq.print("getAudioMixingManager()"),this._audioMixingManager}},{key:"startScreenCapture",value:(Y=km(Em().mark((function e(){var t,r,n,i,o,a,s,c,u,d,l,h,f,p=this,v=arguments;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(o=v.length>0&&void 0!==v[0]?v[0]:{},Zq.print("startScreenCapture()","config: %o",o),a=o.enableAudio,s=void 0!==a&&a,this._trackSourceType.screenVideo!==dd.VIDEO_SOURCE_TYPE_EXTERNAL){e.next=5;break}throw new lR(uR.STREAM_TYPE_NOT_MATCH,"setVideoSourceType as internal first");case 5:if(this._trackSourceType.screenAudio!==ld.AUDIO_SOURCE_TYPE_EXTERNAL){e.next=7;break}throw new lR(uR.STREAM_TYPE_NOT_MATCH,"setAudioSourceType as internal first");case 7:return e.next=9,lV(s,this._extensionManager,this._screenStreamEncodeConfig[0]);case 9:if(c=e.sent,u=JT(c,2),d=u[0],l=u[1],this._localScreenVideoTrack&&!this._localScreenVideoTrack.dummy&&(this._removeLocalTrackEvents(this._localScreenVideoTrack),this._localScreenVideoTrack.close()),null===(t=this._localScreenAudioTrack)||void 0===t||t.close(),delete this._localScreenAudioTrack,this._localScreenVideoTrack=d,null!==(r=this._screenStreamEncodeConfig[0])&&void 0!==r&&r.contentHint&&d.setContentHint(null===(h=this._screenStreamEncodeConfig[0])||void 0===h?void 0:h.contentHint),(f=null==d?void 0:d.getTrack())&&setTimeout((function(){var e=f.getSettings(),t={width:e.width,height:e.height};d.resolution=t,p.safeEmit(Kd.onLocalVideoSizeChanged,{streamIndex:yd.STREAM_INDEX_SCREEN,info:{width:e.width,height:e.height}})}),500),l&&(this._localScreenAudioTrack=l,this._initLocalTrackEvents(l)),null===(n=this._screenPlayer)||void 0===n||n.playVideo(this._localScreenVideoTrack),this._initLocalTrackEvents(this._localScreenVideoTrack,!0),null===(i=this._room)||void 0===i||!i.hasScreenPublished){e.next=26;break}return e.next=26,this._updateScreenPublish();case 26:case"end":return e.stop()}}),e,this)}))),function(){return Y.apply(this,arguments)})},{key:"stopScreenCapture",value:(W=km(Em().mark((function e(){var t,r,n;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(Zq.print("stopScreenCapture()"),null===(t=this._screenPlayer)||void 0===t||t.stop(),this._localScreenVideoTrack&&(this._localScreenVideoTrack.dummy||(this._removeLocalTrackEvents(this._localScreenVideoTrack),this._localScreenVideoTrack.close(),this._localImgScreenTrack&&(null===(n=this._localScreenVideoTrack)||void 0===n||n.setTrack(this._localImgScreenTrack,this._extensionManager),this._localScreenVideoTrack.dummy=!0))),this._localScreenAudioTrack&&(this._removeLocalTrackEvents(this._localScreenAudioTrack),this._localScreenAudioTrack.close()),this._localScreenAudioTrack=void 0,null===(r=this._room)||void 0===r||!r.hasScreenPublished){e.next=8;break}return e.next=8,this._updateScreenPublish();case 8:case"end":return e.stop()}}),e,this)}))),function(){return W.apply(this,arguments)})},{key:"setLocalVideoPlayer",value:function(e,t){if(Zq.print("setLocalVideoPlayer()","streamIndex: %o, videoPlayerOption: %o",e,t),Kw(e,"streamIndex",[yd.STREAM_INDEX_MAIN,yd.STREAM_INDEX_SCREEN]),t&&t.renderDom){var r,n,i=ud(ud({userId:this._getUserId()},t),{},{isLocal:!0});if(nC(i),e===yd.STREAM_INDEX_MAIN&&!this._videoPlayer)return this._videoPlayer=new OG(i),this._initPlayerEvents(this._videoPlayer,!1,e),this._videoPlayer.mirror(!!this._mirrorType),this._localVideoTrack&&!this._localVideoTrack.dummy&&(null===(r=this._config)||void 0===r?void 0:r.autoPlayPolicy)!==Nd.PLAY_MANUALLY&&this._videoPlayer.playVideo(this._localVideoTrack),this._videoPlayer.domElement;if(e===yd.STREAM_INDEX_SCREEN&&!this._screenPlayer)return this._screenPlayer=new OG(ud(ud({},i),{},{isScreen:!0,isLocal:!0})),this._initPlayerEvents(this._screenPlayer,!1,e),this._localScreenVideoTrack&&!this._localScreenVideoTrack.dummy&&(null===(n=this._config)||void 0===n?void 0:n.autoPlayPolicy)!==Nd.PLAY_MANUALLY&&this._screenPlayer.playVideo(this._localScreenVideoTrack),this._screenPlayer.domElement}else{var o,a;e===yd.STREAM_INDEX_MAIN?(null===(o=this._videoPlayer)||void 0===o||o.destroy(!0),delete this._videoPlayer):(null===(a=this._screenPlayer)||void 0===a||a.destroy(),delete this._screenPlayer)}}},{key:"startLiveTranscoding",value:(q=km(Em().mark((function e(t){var r,n,i;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(Zq.print("startLiveTranscoding()","transcode: %o",t),Wq.checkStartParams(t),this._liveTranscodeConfig=t,!((n=null===(r=this._room)||void 0===r?void 0:r.roomInfo)&&n.roomId.length+n.userInfo.userId.length>126)){e.next=6;break}throw new lR(uR.INVALID_PARAMS,"The roomId+userId must be within 126 bytes");case 6:if(e.prev=6,this.safeEmit(Kd.onStreamMixingEvent,{event:oF.START,error:0,message:""}),!this._room||this._room.connectionState!==pF.CONNECTED){e.next=11;break}return e.next=11,null===(i=this._room)||void 0===i?void 0:i.liveControlMessage(Wq.getStartParams(this._liveTranscodeConfig));case 11:e.next=20;break;case 13:if(e.prev=13,e.t0=e.catch(6),!(e.t0 instanceof lR)){e.next=19;break}throw e.t0;case 19:throw new lR(uR.UNEXPECTED_ERROR,"unexpected error",e.t0);case 20:case"end":return e.stop()}}),e,this,[[6,13]])}))),function(e){return q.apply(this,arguments)})},{key:"updateLiveTranscoding",value:(X=km(Em().mark((function e(t){var r,n,i,o;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(Zq.print("updateLiveTranscoding()","transcode: %o",t),this._liveTranscodeConfig){e.next=3;break}return e.abrupt("return");case 3:return delete(i=rz({},t)).audio,null===(r=i.video)||void 0===r||delete r.codec,null===(n=i.video)||void 0===n||delete n.gop,Wq.checckUpdateParams(i),this._liveTranscodeConfig=rz(this._liveTranscodeConfig,i),e.prev=9,this.safeEmit(Kd.onStreamMixingEvent,{event:oF.UPDATE,error:0,message:""}),e.next=13,null===(o=this._room)||void 0===o?void 0:o.liveControlMessage(Wq.getUpdateParams(this._liveTranscodeConfig));case 13:e.next=22;break;case 15:if(e.prev=15,e.t0=e.catch(9),!(e.t0 instanceof lR)){e.next=21;break}throw e.t0;case 21:throw new lR(uR.UNEXPECTED_ERROR,"unexpected error",e.t0);case 22:case"end":return e.stop()}}),e,this,[[9,15]])}))),function(e){return X.apply(this,arguments)})},{key:"stopLiveTranscoding",value:(K=km(Em().mark((function e(){var t;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(Zq.print("stopLiveTranscoding()"),this._liveTranscodeConfig){e.next=3;break}return e.abrupt("return");case 3:return delete this._liveTranscodeConfig,e.prev=4,this.safeEmit(Kd.onStreamMixingEvent,{event:oF.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 lR)){e.next=16;break}throw e.t0;case 16:throw new lR(uR.UNEXPECTED_ERROR,"unexpected error",e.t0);case 17:case"end":return e.stop()}}),e,this,[[4,10]])}))),function(){return K.apply(this,arguments)})},{key:"startSubtitle",value:(z=km(Em().mark((function e(t){var r;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return Zq.print("startSubtitle()","config: %o",t),this._assertNotInRoom(),e.next=4,null===(r=this._room)||void 0===r?void 0:r.startSubtitle(t);case 4:case"end":return e.stop()}}),e,this)}))),function(e){return z.apply(this,arguments)})},{key:"stopSubtitle",value:function(){var e;Zq.print("stopSubtitle()","invoke"),null===(e=this._room)||void 0===e||e.stopSubtitle()}},{key:"setBusinessId",value:function(e){return Zq.print("setBusinessId()","businessId: %s",e),!function(e){return"string"!=typeof e}(e)&&!this._room&&(sP.setStats({rtc_business_id:e}),aG.setStats({rtc_business_id:e}),this._businessId=e,!0)}},{key:"setUserVisibility",value:(H=km(Em().mark((function e(t){var r,n;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(Zq.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._assertNotInRoom(),this._room.localStream&&(null===(n=this._room.localStream.observer)||void 0===n||n.setPublisher(t)),e.t0=!t,!e.t0){e.next=13;break}return e.next=13,this._room.unpublish();case 13:return e.next=15,this._room.updateUserAttributes({role:t?xq.NORMAL_USER:xq.SILENT_USER});case 15:this._visibility=t,t&&null!==(r=this._roomConfig)&&void 0!==r&&r.isAutoPublish&&this._updatePublish({mediaType:Sd.AUDIO_AND_VIDEO});case 17:case"end":return e.stop()}}),e,this)}))),function(e){return H.apply(this,arguments)})},{key:"_initPlayerEvents",value:function(e){var t=this,r=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:yd.STREAM_INDEX_MAIN,i=n===yd.STREAM_INDEX_SCREEN;e.on("playback_event",(function(n){switch(n.eventName){case"timeupdate":return;case"loadeddata":if("audio"===n.type){var o=e.userId.replace("_screen","");r?t.safeEmit(Kd.onFirstPublicStreamAudioFrameDecoded,{publicStreamId:o}):(t.safeEmit(Kd.onAudioFirstFrameDecoded,{userId:o,isScreen:i}),t.safeEmit(Kd.onRemoteAudioFirstFrame,{userId:o,isScreen:i})),iP.firstRemoteAudioRender("",o||"",{isScreen:i})}else{var a,s,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,isScreen:i};r?(c.publicStreamId=c.userId,delete c.userId,delete c.isScreen,t.safeEmit(Kd.onFirstPublicStreamVideoFrameRendered,c),t.safeEmit(Kd.onFirstPublicStreamVideoFrameDecoded,c)):e.isLocal||(t.safeEmit(Kd.onVideoFirstFrameRendered,c),t.safeEmit(Kd.onVideoFirstFrameDecoded,c),t.safeEmit(Kd.onRemoteVideoFirstFrame,c)),iP.firstRemoteVideoRender("",n.userId||"",{isScreen:i})}break;case"autoplay-error":return r&&(n.publicStreamId=n.userId),iP.rtcInvokeStatus(e instanceof OG?"video":"audio",0,"autoplay-error",n.userId||"",0),void t.safeEmit(Kd.onAutoplayFailed,{userId:n.userId,kind:e instanceof OG?"video":"audio",mediaType:e instanceof OG?Sd.VIDEO:Sd.AUDIO,streamIndex:e.isScreen?yd.STREAM_INDEX_SCREEN:yd.STREAM_INDEX_MAIN})}t.safeEmit(Kd.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(Kd.onTrackEnded,{kind:e.getTrack().kind,isScreen:r})})),e.on("resolution-change",(function(e){t._extensionManager.getPluginsByType(UU.PRE_PROCESSING).forEach((function(t){var r;null==t||null===(r=t.applyConstraints)||void 0===r||r.call(t,e)})),t.safeEmit(Kd.onLocalVideoSizeChanged,{streamIndex:r?yd.STREAM_INDEX_SCREEN:yd.STREAM_INDEX_MAIN,info:e})}))}},{key:"_removeLocalTrackEvents",value:function(e){e.removeAllListeners("track-ended"),e.removeAllListeners("resolution-change")}},{key:"setRemoteVideoPlayer",value:function(e,t){Zq.print("setRemoteVideoPlayer()","streamIndex: %o, videoPlayerOption: %o",e,t),Kw(e,"streamIndex",[yd.STREAM_INDEX_MAIN,yd.STREAM_INDEX_SCREEN]),nC(t);var r,n,i,o=t.userId;if(e===yd.STREAM_INDEX_MAIN){var a,s,c;if(null===(a=this._remoteVideoPlayer.get(o))||void 0===a||a.destroy(),!t.renderDom)return;var u=new OG(t);this._initPlayerEvents(u,!1,e),this._remoteVideoPlayer.set(o,u);var d=null===(s=this._room)||void 0===s||null===(c=s.remoteStreams.get(o))||void 0===c?void 0:bb(c).call(c,(function(e){return!e.isScreen}));return d&&this._updateVideoPlayerState(d),u.domElement}if(null===(r=this._remoteScreenPlayer.get(o))||void 0===r||r.destroy(),t.renderDom){var l=new OG(ud(ud({},t),{},{isScreen:!0}));this._remoteScreenPlayer.set(o,l),this._initPlayerEvents(l,!1,e);var h=null===(n=this._room)||void 0===n||null===(i=n.remoteStreams.get(o))||void 0===i?void 0:bb(i).call(i,(function(e){return e.isScreen}));return h&&this._updateVideoPlayerState(h),l.domElement}}},{key:"setLocalVideoMirrorType",value:function(e){Zq.print("setLocalVideoMirrorType()","mirrorType: %o",e),Kw(e,"mirrorType",[kd.MIRROR_TYPE_NONE,kd.MIRROR_TYPE_RENDER]),this._mirrorType=e,this._videoPlayer&&this._videoPlayer.mirror(!!e)}},{key:"setAudioPlaybackDevice",value:(G=km(Em().mark((function e(t){var r;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return Zq.print("setAudioPlaybackDevice()","deviceId: %s",t),zw(t,"deviceId"),e.next=4,this._audioDeviceManager.setSinkId(t);case 4:r=e.sent,this._remoteAudioPlayer.forEach((function(e){e.setPlaybackDevice(t)})),this._remoteScreenAudioPlayer.forEach((function(e){e.setPlaybackDevice(t)})),this.safeEmit(Kd.onAudioPlaybackDeviceChanged,r),iP.rtcAudioDevice(HD.PLAYOUT_DEVICE_SWITCH,t,0);case 9:case"end":return e.stop()}}),e,this)}))),function(e){return G.apply(this,arguments)})},{key:"play",value:(j=km(Em().mark((function e(t){var r,n,i,o,a,s,c,u,d,l,h,f,p,v,_,m,g=arguments;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return o=g.length>1&&void 0!==g[1]?g[1]:Sd.AUDIO_AND_VIDEO,a=g.length>2?g[2]:void 0,Zq.print("play()","userId: %s, mediaType: %s, streamIndex: %s",t,o,a),s=!t||t===this._getUserId()||"local_user"===t,c=void 0===a||a===yd.STREAM_INDEX_MAIN,u=void 0===a||a===yd.STREAM_INDEX_SCREEN,d=o!==Sd.VIDEO,l=o!==Sd.AUDIO,h=[],s&&l&&(c&&this._localVideoTrack&&(null===(f=this._videoPlayer)||void 0===f||f.mirror(!!this._mirrorType),h.push(null===(p=this._videoPlayer)||void 0===p?void 0:p.playVideo(this._localVideoTrack))),u&&this._localScreenVideoTrack&&h.push(null===(v=this._screenPlayer)||void 0===v?void 0:v.playVideo(this._localScreenVideoTrack))),t===(null===(r=this._audioMixingManager)||void 0===r?void 0:r.id)&&h.push(this._audioMixingManager.resumeLocalPlay()),_=null===(n=this._room)||void 0===n?void 0:n.remoteStreams,l&&c&&h.push(DG(this._remoteVideoPlayer,t,!1,_)),l&&u&&h.push(DG(this._remoteScreenPlayer,t,!0,_)),d&&c&&h.push(DG(this._remoteAudioPlayer,t,!1,_)),l&&u&&h.push(DG(this._remoteScreenAudioPlayer,t,!0,_)),m=null===(i=this._publicStreamManager)||void 0===i?void 0:i.remoteStreams,d&&h.push(DG(this._publicStreamVideoPlayer,t,!1,m)),l&&h.push(DG(this._publicStreamAudioPlayer,t,!1,m)),e.abrupt("return",X_.all(h).then((function(){})));case 20:case"end":return e.stop()}}),e,this)}))),function(e){return j.apply(this,arguments)})},{key:"pauseAllSubscribedStream",value:(B=km(Em().mark((function e(t){var r,n,i,o,a,s=this;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(Zq.print("pauseAllSubscribedStream()","mediaType: %o",t),this._checkMediaType(t),Dw(t)&&(s._pauseAllSubscribeState.audio=!0),Pw(t)&&(s._pauseAllSubscribeState.video=!0),this._room){e.next=6;break}return e.abrupt("return",X_.resolve());case 6:n=[],i=QT(tA(r=this._room.remoteStreams).call(r));try{for(i.s();!(o=i.n()).done;)a=o.value,Array.isArray(a)&&a.forEach((function(e){if(e.hasSubscribed){s._pauseAllSubscribeState.resumeStreamIds[e.streamId]=e.streamId;var r=s._unsubscribe(e.isScreen,e.userId,t,!0);r&&n.push(r)}}))}catch(c){i.e(c)}finally{i.f()}return e.abrupt("return",X_.all(n).then((function(){})));case 10:case"end":return e.stop()}}),e,this)}))),function(e){return B.apply(this,arguments)})},{key:"resumeAllSubscribedStream",value:(F=km(Em().mark((function e(t){var r,n,i,o,a,s=this;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(Zq.print("resumeAllSubscribedStream()","mediaType: %o",t),this._checkMediaType(t),Dw(t)&&(s._pauseAllSubscribeState.audio=!1),Pw(t)&&(s._pauseAllSubscribeState.video=!1),this._room){e.next=6;break}return e.abrupt("return",X_.resolve());case 6:n=[],i=QT(tA(r=this._room.remoteStreams).call(r));try{for(i.s();!(o=i.n()).done;)a=o.value,Array.isArray(a)&&a.forEach((function(e){if(s._pauseAllSubscribeState.resumeStreamIds[e.streamId]){delete s._pauseAllSubscribeState.resumeStreamIds[e.streamId];var r=s._subscribe(e.isScreen,e.userId,t);r&&n.push(r)}}))}catch(c){i.e(c)}finally{i.f()}return e.abrupt("return",X_.all(n).then((function(){var e,t;null===(e=s._room)||void 0===e||null===(t=e.remoteStreams)||void 0===t||t.forEach((function(e){Array.isArray(e)&&e.forEach((function(e){s._updateAudioPlayerState(e),s._updateVideoPlayerState(e)}))}))})));case 10:case"end":return e.stop()}}),e,this)}))),function(e){return F.apply(this,arguments)})},{key:"sendUserMessage",value:(V=km(Em().mark((function e(t,r){var n,i,o,a=this;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return $w(t),iC(r),this._assertNotInRoom(),o=Date.now(),e.abrupt("return",null===(n=this._room)||void 0===n||null===(i=n.sendUserMessage(t,r))||void 0===i?void 0:i.then((function(e){return a._messageStatisticsObserver.countP2PMessage(!0,t,!1,o,e),e.id})).catch((function(e){throw a._messageStatisticsObserver.countP2PMessage(!1,t,!1,o,e),e})));case 5:case"end":return e.stop()}}),e,this)}))),function(e,t){return V.apply(this,arguments)})},{key:"sendUserBinaryMessage",value:(U=km(Em().mark((function e(t,r){var n,i,o,a=this;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return $w(t),Ww(r,"message"),iC(r),this._assertNotInRoom(),o=Date.now(),e.abrupt("return",null===(n=this._room)||void 0===n||null===(i=n.sendUserMessage(t,r))||void 0===i?void 0:i.then((function(e){return a._messageStatisticsObserver.countP2PMessage(!0,t,!0,o,e),e.id})).catch((function(e){throw a._messageStatisticsObserver.countP2PMessage(!1,t,!0,o,e),e})));case 6:case"end":return e.stop()}}),e,this)}))),function(e,t){return U.apply(this,arguments)})},{key:"sendRoomMessage",value:(L=km(Em().mark((function e(t){var r,n,i,o=this;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return iC(t),this._assertNotInRoom(),i=Date.now(),e.abrupt("return",null===(r=this._room)||void 0===r||null===(n=r.sendRoomMessage(t))||void 0===n?void 0:n.then((function(e){var t,r;return o._messageStatisticsObserver.countRoomMessage(!0,null===(t=o._room)||void 0===t||null===(r=t.roomInfo)||void 0===r?void 0:r.roomId,!1,i),e})).catch((function(e){var t,r;throw o._messageStatisticsObserver.countRoomMessage(!1,null===(t=o._room)||void 0===t||null===(r=t.roomInfo)||void 0===r?void 0:r.roomId,!1,i),e})));case 4:case"end":return e.stop()}}),e,this)}))),function(e){return L.apply(this,arguments)})},{key:"sendRoomBinaryMessage",value:(M=km(Em().mark((function e(t){var r,n,i,o=this;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return iC(t),this._assertNotInRoom(),i=Date.now(),e.abrupt("return",null===(r=this._room)||void 0===r||null===(n=r.sendRoomMessage(t,!0))||void 0===n?void 0:n.then((function(e){var t,r;return o._messageStatisticsObserver.countRoomMessage(!0,null===(t=o._room)||void 0===t||null===(r=t.roomInfo)||void 0===r?void 0:r.roomId,!0,i),e})).catch((function(e){var t,r;throw o._messageStatisticsObserver.countRoomMessage(!1,null===(t=o._room)||void 0===t||null===(r=t.roomInfo)||void 0===r?void 0:r.roomId,!0,i),e})));case 4:case"end":return e.stop()}}),e,this)}))),function(e){return M.apply(this,arguments)})},{key:"setAudioCaptureConfig",value:(N=km(Em().mark((function e(){var t,r=arguments;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:t=r.length>0&&void 0!==r[0]?r[0]:{},Zq.print("setAudioCaptureConfig()","config: %o",t),delete t.deviceId,Yw(t),this._shouldUpdateAudioConf("setAudioCaptureConfig")&&this._audioProfileManager.updateConstraints(t);case 5:case"end":return e.stop()}}),e,this)}))),function(){return N.apply(this,arguments)})},{key:"setVideoCaptureConfig",value:(P=km(Em().mark((function e(){var t,r=arguments;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=r.length>0&&void 0!==r[0]?r[0]:{},Zq.print("setVideoCaptureConfig()","config: %o",t),e.abrupt("return",this._setVideoCaptureConfig(t));case 3:case"end":return e.stop()}}),e,this)}))),function(){return P.apply(this,arguments)})},{key:"_setVideoCaptureConfig",value:(D=km(Em().mark((function e(){var t,r,n,i=arguments;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(delete(r=i.length>0&&void 0!==i[0]?i[0]:{}).deviceId,Yw(r),n=ud(ud({},r),{},{deviceId:this._videoStreamConstraints.deviceId}),!this._localVideoTrack){e.next=7;break}return e.next=7,this._localVideoTrack.updateVideoCaptureConfig(n);case 7:return this._videoStreamConstraints=n,e.abrupt("return",(null===(t=this._localVideoTrack)||void 0===t?void 0:t.getTrack().getSettings())||{});case 9:case"end":return e.stop()}}),e,this)}))),function(){return D.apply(this,arguments)})},{key:"enableSimulcastMode",value:function(e){var t;return Zq.print("enableSimulcastMode()","enabled: %o",e),this._enableSimulcast=e,null!==(t=this._room)&&void 0!==t&&t.hasPublished&&Fw("You must call this API before publishing the video streams"),!0}},{key:"setVideoEncoderConfig",value:(x=km(Em().mark((function e(t){var r,n,i;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:for(Zq.print("setVideoEncoderConfig()"," descriptions: %o",t),Array.isArray(t)||(t=[t]),cC(t=Gs(t).call(t,(function(e){return!!e}))),t.length>3&&(Fw("setVideoEncoderConfig: You can set parameters for up to 3 streams"),t=Sm(t).call(t,0,3)),n=1;n<t.length;n++)i=Bw(t[0].width)/Bw(t[n].width)||1,Math.floor(i)!==i&&Fw("setVideoEncoderConfig: The resolution setting needs to be an integer multiple");VA(t).call(t,(function(e,t){return t.maxKbps-e.maxKbps})),this._setVideoCaptureConfig(ud({},t[0])),this._videoStreamEncodeConfig=t,this._updateDummyCaptureImage(yd.STREAM_INDEX_MAIN),null!==(r=this._room)&&void 0!==r&&r.hasPublished&&this._updatePublish();case 11:case"end":return e.stop()}}),e,this)}))),function(e){return x.apply(this,arguments)})},{key:"setScreenEncoderConfig",value:(O=km(Em().mark((function e(t){var r;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:Zq.print("setScreenEncoderConfig()","description: %o",t),this._screenStreamEncodeConfig=[t],this._localScreenVideoTrack&&(this._localScreenVideoTrack.updateVideoCaptureConfig(t),t.contentHint&&this._localScreenVideoTrack.setContentHint(t.contentHint)),this._updateDummyCaptureImage(yd.STREAM_INDEX_SCREEN),null!==(r=this._room)&&void 0!==r&&r.hasScreenPublished&&this._updateScreenPublish();case 5:case"end":return e.stop()}}),e,this)}))),function(e){return O.apply(this,arguments)})},{key:"sendSEIMessage",value:function(e,t,r){if(Zq.print("sendSEIMessage()","streamIdex: %o, message: %o, repeatCount: %o",e,t,r),!_L())throw new lR(uR.NOT_SUPPORTED,"Browser does not support sending SEI");Kw(e,"streamIndex",[yd.STREAM_INDEX_MAIN,yd.STREAM_INDEX_SCREEN]),Hw(r,"repeatCount",0,30);var n="string"==typeof t?new Uint8Array(dw.str2ab(t)):t;if(t.length){var i;if(e===yd.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 c,u,d;if(null===(c=this._room)||void 0===c||null===(u=c.localScreenStream)||void 0===u||!u.hasPublished)return;i=null===(d=this._room)||void 0===d?void 0:d.localScreenStream}if(n.byteLength>4096)Zq.print("sei size must not bigger than 4KB");else{var l=aw();i.seiList.push({content:n,uuid:l,repeatCount:r}),setTimeout((function(){var e;if(i){var t,r=qA(e=i.seiList).call(e,(function(e){return e.uuid===l}));if(r)ok(t=i.seiList).call(t,r,1)}}),2e3)}}else Zq.print("sei message must not be empty")}},{key:"setAudioVolumeIndicationInterval",value:function(e){var t=this;Zq.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=bb(e).call(e,(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(Kd.onAudioVolumeIndication,{speakers:r})}),e)}},{key:"_sendActiveSpeaker",value:function(e,t){if(this._room&&this._room.remoteUsers.size>=1){var r,n=e[0],i=TE(t).call(t,(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>-35){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(Kd.onActiveSpeaker,{userId:o.userId,extraInfo:o.extraInfo})}}}},{key:"enableAudioPropertiesReport",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};Zq.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:yd.STREAM_INDEX_MAIN,audioPropertiesInfo:{linearVolume:i,nonlinearVolume:xw(i)}})}if(e._localScreenAudioTrack){var o=e._localScreenAudioTrack.getAudioLevel();t.push({streamIndex:yd.STREAM_INDEX_SCREEN,audioPropertiesInfo:{linearVolume:o,nonlinearVolume:xw(o)}})}if(e.safeEmit(Kd.onLocalAudioPropertiesReport,t),e._room){var a,s=[];if(null!==(a=e._room)&&void 0!==a&&a.multiChatMode)e._room.getActiveSpeakerInMultiChatMode().forEach((function(t){var r,n,i=255*t.audioLevel;s.push({streamKey:{userId:t.userId,streamIndex:yd.STREAM_INDEX_MAIN,roomId:null===(r=e._room)||void 0===r||null===(n=r._roomInfo)||void 0===n?void 0:n.roomId},audioPropertiesInfo:{linearVolume:i,nonlinearVolume:xw(i)}})}));else e._room.remoteStreams.forEach((function(t,r){t.forEach((function(t){if(t.audioTrack){var n,i,o=t.audioTrack.getAudioLevel();s.push({streamKey:{userId:r,streamIndex:t.isScreen?yd.STREAM_INDEX_SCREEN:yd.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:xw(o)}})}}))}));e.safeEmit(Kd.onRemoteAudioPropertiesReport,s),e._sendActiveSpeaker(t,Gs(s).call(s,(function(e){return e.streamKey.streamIndex!==yd.STREAM_INDEX_SCREEN})))}}}),o))}},{key:"setVideoSourceType",value:(C=km(Em().mark((function e(t,r){var n,i,o,a,s,c,u,d,l,h,f,p,v,_,m,g,y,S,E,b,k,T;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(Zq.print("setVideoSourceType()","index: %o, videoSourceType: %o",t,r),Kw(t,"streamIndex",[yd.STREAM_INDEX_MAIN,yd.STREAM_INDEX_SCREEN]),Kw(r,"VideoSourceType",[dd.VIDEO_SOURCE_TYPE_EXTERNAL,dd.VIDEO_SOURCE_TYPE_INTERNAL]),n=t===yd.STREAM_INDEX_MAIN?"video":"screenVideo",this._trackSourceType[n]===r){e.next=26;break}if(this._trackSourceType[n]=r,Zq.print("setVideoSourceType",wm(i="set ".concat(n," source type to ")).call(i,r)),!this._localVideoTrack||t!==yd.STREAM_INDEX_MAIN){e.next=17;break}if(c=!1,r===dd.VIDEO_SOURCE_TYPE_EXTERNAL&&(c=!0,this._removeLocalTrackEvents(this._localVideoTrack),this._localVideoTrack.close()),null===(o=this._videoPlayer)||void 0===o||o.stop(),this._localVideoTrack=void 0,u=null===(a=this._room)||void 0===a?void 0:a._roomConfig.isAutoPublish,c?null===(d=this._room)||void 0===d||null===(l=d.localStream)||void 0===l||null===(h=l.observer)||void 0===h||h.setEnableVideo(!1):null===(f=this._room)||void 0===f||null===(p=f.localStream)||void 0===p||null===(v=p.observer)||void 0===v||v.setPushVideo(!1),!(null!==(s=this._room)&&void 0!==s&&s.hasPublished||u)){e.next=17;break}return e.next=17,this._updatePublish();case 17:if(!this._localScreenVideoTrack||t!==yd.STREAM_INDEX_SCREEN){e.next=26;break}if(g=!1,r===dd.VIDEO_SOURCE_TYPE_EXTERNAL&&(g=!0,this._removeLocalTrackEvents(this._localScreenVideoTrack),this._localScreenVideoTrack.close()),null===(_=this._screenPlayer)||void 0===_||_.stop(),this._localScreenVideoTrack=void 0,g?null===(y=this._room)||void 0===y||null===(S=y.localScreenStream)||void 0===S||null===(E=S.observer)||void 0===E||E.setEnableVideo(!1):null===(b=this._room)||void 0===b||null===(k=b.localScreenStream)||void 0===k||null===(T=k.observer)||void 0===T||T.setPushVideo(!1),null===(m=this._room)||void 0===m||!m.hasScreenPublished){e.next=26;break}return e.next=26,this._updateScreenPublish();case 26:case"end":return e.stop()}}),e,this)}))),function(e,t){return C.apply(this,arguments)})},{key:"setExternalVideoTrack",value:(w=km(Em().mark((function e(t,r){var n,i,o,a,s,c,u,d,l;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(Zq.print("setExternalVideoTrack()","index: %o, track: %o",t,r),Kw(t,"streamIndex",[yd.STREAM_INDEX_MAIN,yd.STREAM_INDEX_SCREEN]),Xw(r),t!==yd.STREAM_INDEX_MAIN){e.next=15;break}if(this._trackSourceType.video===dd.VIDEO_SOURCE_TYPE_EXTERNAL){e.next=6;break}throw new lR(uR.STREAM_TYPE_NOT_MATCH,"setVideoSourceType as external first");case 6:return e.next=8,pV(r,this._extensionManager);case 8:if(this._localVideoTrack=e.sent,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=15;break}return e.next=15,this._updatePublish();case 15:if(t!==yd.STREAM_INDEX_SCREEN){e.next=27;break}if(this._trackSourceType.screenVideo===dd.VIDEO_SOURCE_TYPE_EXTERNAL){e.next=18;break}throw new lR(uR.STREAM_TYPE_NOT_MATCH,"setVideoSourceType as external first");case 18:return e.next=20,gV(r,this._extensionManager);case 20:if(this._localScreenVideoTrack=e.sent,this._initLocalTrackEvents(this._localScreenVideoTrack,!0),null===(s=this._screenPlayer)||void 0===s||s.playVideo(this._localScreenVideoTrack),null===(c=this._room)||void 0===c||null===(u=c.localScreenStream)||void 0===u||null===(d=u.observer)||void 0===d||d.setPushVideo(!0),null===(l=this._room)||void 0===l||!l.hasScreenPublished){e.next=27;break}return e.next=27,this._updateScreenPublish();case 27:case"end":return e.stop()}}),e,this)}))),function(e,t){return w.apply(this,arguments)})},{key:"setAudioSourceType",value:(R=km(Em().mark((function e(t,r){var n,i,o,a,s,c,u,d,l,h,f,p,v,_,m,g,y,S,E,b;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(Zq.print("setAudioSourceType()","index: %o, audioSourceType: %o",t,r),Kw(t,"streamIndex",[yd.STREAM_INDEX_MAIN,yd.STREAM_INDEX_SCREEN]),Kw(r,"audioSourceType",[ld.AUDIO_SOURCE_TYPE_EXTERNAL,ld.AUDIO_SOURCE_TYPE_INTERNAL]),n=t===yd.STREAM_INDEX_MAIN?"audio":"screenAudio",this._trackSourceType[n]===r){e.next=24;break}if(this._trackSourceType[n]=r,Zq.print("setVideoSourceType",wm(i="set ".concat(n," source type to ")).call(i,r)),!this._localAudioTrack||t!==yd.STREAM_INDEX_MAIN){e.next=16;break}if(s=!1,this._trackSourceType.audio===ld.AUDIO_SOURCE_TYPE_EXTERNAL&&(s=!0,this._removeLocalTrackEvents(this._localAudioTrack),this._localAudioTrack.close()),this._localAudioTrack=void 0,c=null===(o=this._room)||void 0===o?void 0:o._roomConfig.isAutoPublish,s?null===(u=this._room)||void 0===u||null===(d=u.localStream)||void 0===d||null===(l=d.observer)||void 0===l||l.setEnableAudio(!1):null===(h=this._room)||void 0===h||null===(f=h.localStream)||void 0===f||null===(p=f.observer)||void 0===p||p.setPushAudio(!1),!(null!==(a=this._room)&&void 0!==a&&a.hasPublished||c)){e.next=16;break}return e.next=16,this._updatePublish();case 16:if(!this._localScreenAudioTrack||t!==yd.STREAM_INDEX_SCREEN){e.next=24;break}if(_=!1,this._trackSourceType.audio===ld.AUDIO_SOURCE_TYPE_EXTERNAL&&(_=!0,this._removeLocalTrackEvents(this._localScreenAudioTrack),this._localScreenAudioTrack.close()),this._localScreenAudioTrack=void 0,_?null===(m=this._room)||void 0===m||null===(g=m.localScreenStream)||void 0===g||null===(y=g.observer)||void 0===y||y.setEnableAudio(!1):null===(S=this._room)||void 0===S||null===(E=S.localScreenStream)||void 0===E||null===(b=E.observer)||void 0===b||b.setPushAudio(!1),null===(v=this._room)||void 0===v||!v.hasScreenPublished){e.next=24;break}return e.next=24,this._updateScreenPublish();case 24:case"end":return e.stop()}}),e,this)}))),function(e,t){return R.apply(this,arguments)})},{key:"setExternalAudioTrack",value:(A=km(Em().mark((function e(t,r){var n,i,o,a,s,c,u,d,l,h;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(Zq.print("setExternalAudioTrack()","index: %o, track: %o",t,r),Kw(t,"streamIndex",[yd.STREAM_INDEX_MAIN,yd.STREAM_INDEX_SCREEN]),Xw(r),t!==yd.STREAM_INDEX_MAIN){e.next=15;break}if(this._trackSourceType.audio===ld.AUDIO_SOURCE_TYPE_EXTERNAL){e.next=6;break}throw new lR(uR.STREAM_TYPE_NOT_MATCH,"setAudioSourceType as external first");case 6:return e.next=8,_V(r,this._extensionManager);case 8:if(this._localAudioTrack=e.sent,this._initLocalTrackEvents(this._localAudioTrack),c=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||c)){e.next=15;break}return e.next=15,this._updatePublish();case 15:if(t!==yd.STREAM_INDEX_SCREEN){e.next=26;break}if(this._trackSourceType.screenAudio===ld.AUDIO_SOURCE_TYPE_EXTERNAL){e.next=18;break}throw new lR(uR.STREAM_TYPE_NOT_MATCH,"setAudioSourceType as external first");case 18:return e.next=20,SV(r,this._extensionManager);case 20:if(this._localScreenAudioTrack=e.sent,this._initLocalTrackEvents(this._localScreenAudioTrack),null===(u=this._room)||void 0===u||null===(d=u.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=26;break}return e.next=26,this._updateScreenPublish();case 26:case"end":return e.stop()}}),e,this)}))),function(e,t){return A.apply(this,arguments)})},{key:"login",value:(I=km(Em().mark((function e(t,r){return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return Zq.print("login()","token: %o, userInfo: %o",t,r),Jw(t)||zw(t,"token"),$w(r),e.abrupt("return",this._rtmClient.login(t,r));case 4:case"end":return e.stop()}}),e,this)}))),function(e,t){return I.apply(this,arguments)})},{key:"logout",value:(T=km(Em().mark((function e(){return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return Zq.print("logout()"),e.abrupt("return",this._rtmClient.logout());case 2:case"end":return e.stop()}}),e,this)}))),function(){return T.apply(this,arguments)})},{key:"updateLoginToken",value:(k=km(Em().mark((function e(t){return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return Zq.print("updateLoginToken()","token: %o",t),Jw(t)||zw(t,"token"),e.abrupt("return",this._rtmClient.updateLoginToken(t));case 3:case"end":return e.stop()}}),e,this)}))),function(e){return k.apply(this,arguments)})},{key:"getPeerOnlineStatus",value:(b=km(Em().mark((function e(t){return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return Zq.print("getPeerOnlineStatus()","userId: %o",t),$w(t),e.abrupt("return",this._rtmClient.getPeerOnlineStatus(t));case 3:case"end":return e.stop()}}),e,this)}))),function(e){return b.apply(this,arguments)})},{key:"sendUserMessageOutsideRoom",value:(E=km(Em().mark((function e(t,r){var n,i=this;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return $w(t),iC(r),n=Date.now(),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),e})));case 4:case"end":return e.stop()}}),e,this)}))),function(e,t){return E.apply(this,arguments)})},{key:"sendUserBinaryMessageOutsideRoom",value:(S=km(Em().mark((function e(t,r){var n,i=this;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return $w(t),Ww(r,"message"),iC(r),n=Date.now(),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),e})));case 5:case"end":return e.stop()}}),e,this)}))),function(e,t){return S.apply(this,arguments)})},{key:"setServerParams",value:(y=km(Em().mark((function e(t,r){return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return Zq.print("setServerParams()","signature: %o, url: %0",t,r),e.abrupt("return",this._rtmClient.setServerParams(t,r));case 2:case"end":return e.stop()}}),e,this)}))),function(e,t){return y.apply(this,arguments)})},{key:"sendServerMessage",value:(g=km(Em().mark((function e(t){var r,n=this;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return zw(t,"message"),iC(t),r=Date.now(),e.abrupt("return",this._rtmClient.sendServerMessage(t).then((function(e){n._messageStatisticsObserver.countServerMessage(!0,!1,r,e)})).catch((function(e){throw n._messageStatisticsObserver.countServerMessage(!1,!1,r,e),e})));case 4:case"end":return e.stop()}}),e,this)}))),function(e){return g.apply(this,arguments)})},{key:"sendServerBinaryMessage",value:(m=km(Em().mark((function e(t){var r,n=this;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return Ww(t,"message"),iC(t),r=Date.now(),e.abrupt("return",this._rtmClient.sendServerMessage(t).then((function(e){n._messageStatisticsObserver.countServerMessage(!0,!0,r,e)})).catch((function(e){throw n._messageStatisticsObserver.countServerMessage(!1,!0,r,e),e})));case 4:case"end":return e.stop()}}),e,this)}))),function(e){return m.apply(this,arguments)})},{key:"startCloudProxy",value:function(e){if(this._room)throw new lR(uR.START_CLOUD_PROXY_AFTER_JOIN,"[startCloudProxy] should be invoke before join room ");Zq.print("startCloudProxy()",e),zw(e.logProxy,"logProxy"),zw(e.accessProxy,"accessProxy"),zw(e.configProxy,"configProxy"),this._originIceConfigRequestUrls=CP("ICE_CONFIG_REQUEST_URLS"),this._originLogServerUrl=CP("LOG_SERVER_URL"),this._originConfigServerUrls=CP("CONFIG_REQUEST_DOMAINS"),wP("ICE_CONFIG_REQUEST_URLS",e.accessProxy),wP("LOG_SERVER_URL",function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return/^https?:\/\/.+/.test(e)||(e="https://"+e),"".concat(e,"/video/v1/webrtc_log/")}(e.logProxy)),wP("CONFIG_REQUEST_DOMAINS",[e.configProxy]),this._useCloudProxy=!0}},{key:"stopCloudProxy",value:function(){if(this._room)throw new lR(uR.STOP_CLOUD_PROXY_BEFORE_LEAVE,"[stopCloudProxy] should be invoke after leave room ");Zq.print("stopCloudProxy()"),wP("ICE_CONFIG_REQUEST_URLS",[]),wP("LOG_SERVER_URL",this._originLogServerUrl),wP("CONFIG_REQUEST_DOMAINS",this._originConfigServerUrls),this._useCloudProxy=!1,this._startCloudProxyTimestamp=void 0}},{key:"startPushPublicStream",value:(_=km(Em().mark((function e(t,r){var n,i,o,a=this;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(Zq.print("startPushPublicStream()","publicStreamId: %o, publicStreamParam: %o",t,r),eC(t),this._assertNotInRoom(),!this._publicStreamIds.get(t)){e.next=5;break}throw new lR(uR.REPEAT_PUSH,"repeat push public media stream");case 5:return o=OP(t,"started",r),e.abrupt("return",null===(n=this._room)||void 0===n||null===(i=n.publicStreamControlMessage(o))||void 0===i?void 0:i.then((function(){a._publicStreamIds.set(t,t)})));case 7:case"end":return e.stop()}}),e,this)}))),function(e,t){return _.apply(this,arguments)})},{key:"updatePublicStreamParam",value:(v=km(Em().mark((function e(t,r){var n,i;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return Zq.print("startPushPublicStream()","publicStreamId: %o, publicStreamParam: %o",t,r),eC(t),this._assertNotInRoom(),i=OP(t,"layoutChanged",r),e.abrupt("return",null===(n=this._room)||void 0===n?void 0:n.publicStreamControlMessage(i));case 5:case"end":return e.stop()}}),e,this)}))),function(e,t){return v.apply(this,arguments)})},{key:"stopPushPublicStream",value:(p=km(Em().mark((function e(t){var r,n=this;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return Zq.print("startPushPublicStream()","publicStreamId: %o",t),eC(t),this._assertNotInRoom(),e.abrupt("return",null===(r=this._room)||void 0===r?void 0:r.publicStreamControlMessage({type:"publicstream",action:"stopped",publicStreamID:t}).then((function(){n._publicStreamIds.delete(t)})));case 4:case"end":return e.stop()}}),e,this)}))),function(e){return p.apply(this,arguments)})},{key:"startPlayPublicStream",value:(f=km(Em().mark((function e(t){var r,n,i,o,a,s,c=this;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(eC(t),this._publicStreamManager){e.next=8;break}return this._publicStreamManager=new Nq(this.id,this._appId,{businessId:this._businessId}),this._publicStreamManager.on(iF.RESUBSCRIBE,(function(e){var t=e.stream;if(t){var r,n=c._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=c._publicStreamVideoPlayer.get(t.streamId);o&&t.videoTrack&&o.playVideo(null===(i=e.stream)||void 0===i?void 0:i.videoTrack)}})),null===(r=this._publicStreamManager)||void 0===r||r.on("onRemoteStreamStats",(function(e){e.publicStreamId=e.userId,delete e.userId,delete e.isScreen,c.safeEmit(Kd.onPublicStreamStats,e)})),null===(n=this._publicStreamManager)||void 0===n||n.on(iF.ON_SEI_MESSAGED_RECEIVED,(function(e){c.safeEmit(Kd.onPublicStreamSEIMessageReceived,e)})),e.next=8,this._publicStreamManager.connect();case 8:return e.next=10,this._publicStreamManager.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 xG(t,{muted:(null===(s=this._config)||void 0===s?void 0:s.autoPlayPolicy)===Nd.VIDEO_ONLY,isScreen:!1}),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 f.apply(this,arguments)})},{key:"stopPlayPublicStream",value:(h=km(Em().mark((function e(t){var r;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._publicStreamManager){e.next=2;break}return e.abrupt("return");case 2:this._publicStreamManager.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 h.apply(this,arguments)})},{key:"setAudioProfile",value:(l=km(Em().mark((function e(t){return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:Zq.print("setAudioProfile()","profile: %o",t),this._shouldUpdateAudioConf("setAudioProfile")&&this._audioProfileManager.setAudioProfile(t);case 2:case"end":return e.stop()}}),e,this)}))),function(e){return l.apply(this,arguments)})},{key:"setPublicStreamVideoPlayer",value:function(e,t){var r,n,i,o;Zq.print("setPublicStreamVideoPlayer()","publicStreamId: %o, videoPlayerOption: %o",e,t);var a=this._publicStreamVideoPlayer.get(e);if(null===(r=a)||void 0===r||r.destroy(),null!=t&&t.renderDom){a=new OG(ud(ud({},t),{},{userId:e})),this._initPlayerEvents(a,!0),this._publicStreamVideoPlayer.set(e,a);var s=null===(n=this._publicStreamManager)||void 0===n||null===(i=n.remoteStreams)||void 0===i?void 0:i.get(e);null!=s&&s.videoTrack&&(null===(o=this._config)||void 0===o?void 0:o.autoPlayPolicy)!==Nd.PLAY_MANUALLY&&a.playVideo(s.videoTrack,s)}else this._publicStreamVideoPlayer.delete(e)}},{key:"setDummyCaptureImagePath",value:(d=km(Em().mark((function e(t,r){var n=this;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",new X_((function(e,i){zw(r,"filePath");var o=new Image;o.crossOrigin="anonymous",o.src=r,o.onload=function(){t===yd.STREAM_INDEX_MAIN?n._dummyMainImage=o:n._dummyScreenImage=o;try{n._updateDummyCaptureImage(t),e()}catch(r){i(new lR(uR.UNEXPECTED_ERROR,r.message))}},o.onerror=function(){i(new lR(uR.UNEXPECTED_ERROR,"Load image error"))}})));case 1:case"end":return e.stop()}}),e)}))),function(e,t){return d.apply(this,arguments)})},{key:"_updateDummyCaptureImage",value:function(e){var t,r;if(e===yd.STREAM_INDEX_MAIN?(t=this._dummyMainImage,r=this._videoStreamEncodeConfig[0]):(t=this._dummyScreenImage,r=this._screenStreamEncodeConfig[0]),t){var n,i,o=document.createElement("canvas"),a=o.getContext("2d"),s=Bw(r.width),c=Bw(r.height);if(!a)throw new lR(uR.UNEXPECTED_ERROR,"Not support canvas");!s||!c||t.width<=s&&t.height<=c?(n=t.width,i=t.height):(n=Math.min(s,t.width*c/t.height),i=Math.min(c,t.height*s/t.width)),o.width=n,o.height=i,a.drawImage(t,0,0,t.width,t.height,0,0,n,i);var u=window.setInterval((function(){t&&a.drawImage(t,0,0,t.width,t.height,0,0,n,i)}),200);e===yd.STREAM_INDEX_MAIN?(clearInterval(this._dummyMainTimer),this._dummyMainTimer=u):(clearInterval(this._dummyScreenTimer),this._dummyScreenTimer=u);var d,l,h,f,p=o.captureStream(5).getVideoTracks()[0];if(e===yd.STREAM_INDEX_MAIN){if(this._localImgVideoTrack=p,null!==(d=this._localVideoTrack)&&void 0!==d&&d.dummy)null===(l=this._localVideoTrack)||void 0===l||l.setTrack(this._localImgVideoTrack,this._extensionManager)}else if(this._localImgScreenTrack=p,null!==(h=this._localScreenVideoTrack)&&void 0!==h&&h.dummy)null===(f=this._localScreenVideoTrack)||void 0===f||f.setTrack(this._localImgScreenTrack,this._extensionManager)}}},{key:"_addListenExtensionEvent",value:function(e){var t=this;e.on("re-capture-audio",(function(){t._localAudioTrack&&t.stopAudioCapture().then((function(){t.startAudioCapture()}))})),e.on("re-capture-video",(function(){t._localVideoTrack&&!t._localVideoTrack.dummy&&t.stopVideoCapture().then((function(){t.startVideoCapture()}))}))}},{key:"registerExtension",value:(u=km(Em().mark((function e(t){return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t.monitor=iP,t.isSupported()){e.next=3;break}throw new Error("This extension is not supported.");case 3:return e.next=5,t.init();case 5:this._extensionManager.register(t),this._addListenExtensionEvent(t);case 7:case"end":return e.stop()}}),e,this)}))),function(e){return u.apply(this,arguments)})},{key:"defaultTranscoding",value:function(){return JSON.parse(vk(Wq.getDefaultValue()))}},{key:"_updatePublish",value:(c=km(Em().mark((function e(){var t,r,n,i=arguments;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=i.length>0&&void 0!==i[0]?i[0]:{},Zq.print("_updatePublish()","config: %o",t),r={mediaType:void 0,invokeByJoinRoom:!1,pubState:aF.PUB},t=ud(ud({},r),t),this._visibility){e.next=6;break}throw new lR(uR.NO_PUBLISH_PERMISSION,"no publish permission");case 6:return e.next=8,this._pubLock.lock();case 8:if(n=e.sent,this._room&&this._room.connectionState===pF.CONNECTED){e.next=12;break}return n(),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 lR)){e.next=23;break}throw e.t0;case 23:throw new lR(uR.UNEXPECTED_ERROR,"unexpected error",e.t0);case 24:return e.prev=24,n(),e.finish(24);case 27:case"end":return e.stop()}}),e,this,[[12,17,24,27]])}))),function(){return c.apply(this,arguments)})},{key:"startAudioPlaybackDeviceTest",value:(s=km(Em().mark((function e(t,r){return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return Zq.print("startAudioPlaybackDeviceTest()","filePath: %o, indicationInterval: %o",t,r),zw(t,"filePath"),Hw(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 s.apply(this,arguments)})},{key:"stopAudioPlaybackDeviceTest",value:function(){Zq.print("stopAudioPlaybackDeviceTest()"),this._audioDeviceManager.stopAudioPlaybackDeviceTest()}},{key:"startAudioDeviceRecordTest",value:(a=km(Em().mark((function e(t,r){return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return Zq.print("startAudioDeviceRecordTest()","indicationInterval: %o",t),Hw(t,"indicationInterval"),e.next=4,this._audioDeviceManager.startAudioDeviceRecordTest(t,r);case 4:case"end":return e.stop()}}),e,this)}))),function(e,t){return a.apply(this,arguments)})},{key:"stopAudioDeviceRecordAndPlayTest",value:function(){Zq.print("stopAudioDeviceRecordAndPlayTest()"),this._audioDeviceManager.stopAudioDeviceRecordAndPlayTest()}},{key:"stopAudioDevicePlayTest",value:function(){Zq.print("stopAudioDevicePlayTest()"),this._audioDeviceManager.stopAudioDevicePlayTest()}},{key:"setRemoteUserPriority",value:function(e,t){var r;Zq.print("setRemoteUserPriority()","userId: %o, priority: %o",e,t);try{$w(e),Kw(t,"priority",[Cd.HIGH,Cd.MEDIUM,Cd.LOW])}catch(n){return console.warn(n),!1}return this._userPriorityMap.set(e,t),null===(r=this._room)||void 0===r||r.updateRemoteUserPriority(e),!0}},{key:"takeLocalSnapshot",value:(o=km(Em().mark((function e(t){var r,n;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(Zq.print("takeLocalSnapshot()","streamIndex: %o",t),Kw(t,"streamIndex",[yd.STREAM_INDEX_MAIN,yd.STREAM_INDEX_SCREEN]),r=t===yd.STREAM_INDEX_MAIN?this.localVideoTrack:this.localScreenVideoTrack){e.next=5;break}throw new lR(uR.INVOKED_BEFORE_CAPTURE,"capture first");case 5:return n=t===yd.STREAM_INDEX_MAIN?this._videoPlayer:this._screenPlayer,e.abrupt("return",Bq(r.getTrack("preprocessing"),(null==n?void 0:n.mirrorType)===kd.MIRROR_TYPE_RENDER,n));case 7:case"end":return e.stop()}}),e,this)}))),function(e){return o.apply(this,arguments)})},{key:"takeRemoteSnapshot",value:(i=km(Em().mark((function e(t,r){var n,i,o,a,s,c;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(Zq.print("takeRemoteSnapshot()","id: %o, streamIndex: %o",t,r),zw(t,"id"),Kw(r,"streamIndex",[yd.STREAM_INDEX_MAIN,yd.STREAM_INDEX_SCREEN]),c=(null===(n=this._room)||void 0===n||null===(i=n.remoteStreams.get(t))||void 0===i||null===(o=bb(i).call(i,(function(e){return e.isScreen===(r===yd.STREAM_INDEX_SCREEN)})))||void 0===o?void 0:o.videoTrack)||(null===(a=this._publicStreamManager)||void 0===a||null===(s=a.remoteStreams.get(t))||void 0===s?void 0:s.videoTrack)){e.next=6;break}throw new lR(uR.STREAM_NOT_EXIST,"stream not exist");case 6:return e.abrupt("return",Bq(c.getTrack(),!1,r===yd.STREAM_INDEX_MAIN?this._remoteVideoPlayer.get(t):this._remoteScreenPlayer.get(t)));case 7:case"end":return e.stop()}}),e,this)}))),function(e,t){return i.apply(this,arguments)})},{key:"setSubscribeFallbackOption",value:function(e){Zq.print("setSubscribeFallbackOption()","option: %o",e);try{Kw(e,"option",[wd.DISABLE,wd.VIDEO_STREAM_LOW,wd.AUDIO_ONLY])}catch(t){return console.warn(t),!1}return!this._room&&(this._subscribeFallbackOption=e,!0)}},{key:"getLocalStreamTrack",value:function(e,t){var r,n,i,o=this;if(e===yd.STREAM_INDEX_MAIN?(n="video"===t?this.localVideoTrack:this.localAudioTrack,i=function(){var e;return null===(e=o._room)||void 0===e?void 0:e.localStream}):(n="video"===t?this.localScreenVideoTrack:this.localScreenAudioTrack,i=function(){var e;return null===(e=o._room)||void 0===e?void 0:e.localScreenStream}),n){var a=n instanceof bV&&n.mixedAudioTrack?n.mixedAudioTrack:n.getTrack("preprocessing");if(a){var s=i();return this._reportMsTrackEvent(a,(null==s||null===(r=s.stream)||void 0===r?void 0:r.id)||"local"),a}}}},{key:"getRemoteStreamTrack",value:function(e,t,r){var n,i,o=(null===(n=this._room)||void 0===n?void 0:n.remoteStreams.get(e))||[];if(o&&o.length){var a,s,c,u,d;if(t===yd.STREAM_INDEX_MAIN)a=bb(o).call(o,(function(e){return!e.isScreen})),i="video"===r?null===(s=a)||void 0===s?void 0:s.videoTrack:null===(c=a)||void 0===c?void 0:c.audioTrack;else a=bb(o).call(o,(function(e){return e.isScreen})),i="video"===r?null===(u=a)||void 0===u?void 0:u.videoTrack:null===(d=a)||void 0===d?void 0:d.audioTrack;if(i){var l=i.getTrack();if(l&&a){var h=a.streamId;return this._reportMsTrackEvent(l,h),l}}}}},{key:"getPublicStreamTrack",value:function(e,t){if(this._publicStreamManager&&this._publicStreamManager.remoteStreams){var r=this._publicStreamManager.remoteStreams.get(e);if(r){var n="video"===t?r.videoTrack:r.audioTrack;if(n){var i=n.getTrack();if(i){var o=r.streamId;return this._reportMsTrackEvent(i,o),i}}}}}},{key:"setRemoteStreamRenderSync",value:function(e){return!this._room&&(this._avSync=!!e,!0)}},{key:"_reportMsTrackEvent",value:function(e,t){if(!e.hookStop){e.hookStop=!0;var r=e.stop;e.stop=function(){iP.rtcInvokeStatus(t,0,"stop",t||"",0),r.call(e)}}}},{key:"_updateScreenPublish",value:(n=km(Em().mark((function e(){var t,r,n,i=arguments;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=i.length>0&&void 0!==i[0]?i[0]:{},Zq.print("_updateScreenPublish()"),r={mediaType:void 0,pubState:aF.PUB},t=ud(ud({},r),t),e.next=6,this._pubLock.lock();case 6:if(n=e.sent,this._room&&this._room.connectionState===pF.CONNECTED){e.next=10;break}return n(),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 lR)){e.next=21;break}throw e.t0;case 21:throw new lR(uR.UNEXPECTED_ERROR,"unexpected error",e.t0);case 22:return e.prev=22,n(),e.finish(22);case 25:case"end":return e.stop()}}),e,this,[[10,15,22,25]])}))),function(){return n.apply(this,arguments)})},{key:"_updateAudioPlayerState",value:function(e){Zq.print("_updateAudioPlayerState()");var t,r=e.userId,n=e.isScreen,i=n?this._remoteScreenAudioPlayer:this._remoteAudioPlayer,o=i.get(r);if(e.audioTrack&&(e.attributes.audiostream&&e.subAudio||this.multiChatMode)){var a;if(!o){var s;o=new xG(r,{muted:(null===(s=this._config)||void 0===s?void 0:s.autoPlayPolicy)===Nd.VIDEO_ONLY,isScreen:n}),this._initPlayerEvents(o,!1,n?yd.STREAM_INDEX_SCREEN:yd.STREAM_INDEX_MAIN),i.set(r,o);var c=this._audioDeviceManager.getSinkId();c&&o.setPlaybackDevice(c)}(null===(a=this._config)||void 0===a?void 0:a.autoPlayPolicy)!==Nd.PLAY_MANUALLY&&o.playAudio(e.audioTrack),pw&&Ew&&(t=this._remoteAudioPlayer,Xq&&clearTimeout(Xq),Xq=setTimeout((function(){var e,r=QT(t);try{for(r.s();!(e=r.n()).done;){var n=JT(e.value,2),i=n[0],o=n[1];null!=i&&cR(i).call(i,"mux")&&o.pause()}}catch(l){r.e(l)}finally{r.f()}var a,s=QT(t);try{for(s.s();!(a=s.n()).done;){var c=JT(a.value,2),u=c[0],d=c[1];null!=u&&cR(u).call(u,"mux")&&d.manuallyPlay()}}catch(l){s.e(l)}finally{s.f()}}),2e3))}else{var u;null===(u=o)||void 0===u||u.stop()}}},{key:"_updateVideoPlayerState",value:function(e){var t;Zq.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)!==Nd.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:(r=km(Em().mark((function e(t){var r,n,i,o,a,s,c,u;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=t.stream,n=null==r?void 0:r.attributes,i=n.localaudio,o=n.audiostream,a=n.localvideo,s=n.videostream,c=kV.NONE,o&&(c|=Sd.AUDIO),s&&(c|=Sd.VIDEO),!c){e.next=11;break}return e.next=8,new X_((function(e){return setTimeout(e)}));case 8:null!=r&&r.isScreen?this.safeEmit(Kd.onUserPublishScreen,{userId:r.userId,mediaType:c}):(this.safeEmit(Kd.onUserPublishStream,{userId:r.userId,mediaType:c,videoStreamDescriptions:null==r||null===(u=r.attributes)||void 0===u?void 0:u.videoDescriptions}),this._handleAutoSubscribe(r,!0)),this.safeEmit("onAddStream",{userId:r.userId,mediaType:c,isScreen:!(null==r||!r.isScreen)}),null!=r&&r.isScreen||(i&&this.safeEmit(Kd.onUserStartAudioCapture,{userId:r.userId}),a&&this.safeEmit(Kd.onUserStartVideoCapture,{userId:r.userId}));case 11:case"end":return e.stop()}}),e,this)}))),function(e){return r.apply(this,arguments)})},{key:"_handleAutoSubscribe",value:function(e,t){var r,n,i=kV.NONE;if(null!==(r=this._roomConfig)&&void 0!==r&&r.isAutoSubscribeAudio&&(i|=Sd.AUDIO),null!==(n=this._roomConfig)&&void 0!==n&&n.isAutoSubscribeVideo&&(i|=Sd.VIDEO),i){var o,a;if(t&&Dw(i))null===(o=e.observer)||void 0===o||o.setAutoSubscribeAudio(!0);if(t&&Pw(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=nW[e.reason])&&void 0!==t?t:Ed.STREAM_REMOVE_REASON_OTHER,o=n.isScreen?Kd.onUserUnpublishScreen:Kd.onUserUnpublishStream,a=kV.NONE;n.attributes.audiostream&&(a|=Sd.AUDIO),n.attributes.videostream&&(a|=Sd.VIDEO),a!==kV.NONE&&(this.safeEmit(o,{userId:n.userId,mediaType:a,reason:i}),this.safeEmit("onRemoveStream",{userId:n.userId,isScreen:n.isScreen})),this._getRemotePlayer(n.userId,n.isScreen).forEach((function(e){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){var t=this;setTimeout((function(){return t.safeEmit(Kd.onUserJoined,e)}))}},{key:"_onUserLeave",value:function(e){this.safeEmit(Kd.onUserLeave,e)}},{key:"_onRoomError",value:function(e){var t;this.safeEmit(Kd.onError,e),null===(t=this._room)||void 0===t||t.destroy(),this._room=void 0}},{key:"_onNetworkQuality",value:function(){for(var e,t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];this.safeEmit.apply(this,wm(e=[Kd.onNetworkQuality]).call(e,r))}},{key:"_onConnectionStateChange",value:function(e){if(void 0!==this._startCloudProxyTimestamp&&this._useCloudProxy&&e.state===bd.CONNECTION_STATE_CONNECTED&&this.safeEmit(Kd.onCloudProxyConnected,{interval:Date.now()-this._startCloudProxyTimestamp}),this.safeEmit(Kd.onConnectionStateChanged,e),e.state===bd.CONNECTION_STATE_RECONNECTING){var t,r=QT(this._remoteAudioPlayer);try{for(r.s();!(t=r.n()).done;){var n=JT(t.value,2),i=n[0],o=n[1];null!=i&&cR(i).call(i,"mux")&&o.stop()}}catch(a){r.e(a)}finally{r.f()}}}},{key:"_getRemotePlayer",value:function(e,t){return[(t?this._remoteScreenAudioPlayer:this._remoteAudioPlayer).get(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:"_onVideoDeviceStateChange",value:function(e){this.safeEmit(Kd.onVideoDeviceStateChanged,e)}},{key:"_onAudioDeviceStateChange",value:function(e){this.safeEmit(Kd.onAudioDeviceStateChanged,e)}},{key:"_onUserPublishStateChange",value:function(e){var t,r=e.userId,n=e.isScreen,i=e.mediaType,o=e.pubState,a=e.remoteStream,s={userId:r,mediaType:i};n?o===aF.PUB?this.safeEmit(Kd.onUserPublishScreen,s):this.safeEmit(Kd.onUserUnpublishScreen,ud(ud({},s),{},{reason:Ed.STREAM_REMOVE_REASON_UNPUBLISH})):o===aF.PUB?(s.videoStreamDescriptions=null==a||null===(t=a.attributes)||void 0===t?void 0:t.videoDescriptions,this.safeEmit(Kd.onUserPublishStream,s),this._handleAutoSubscribe(a,!0)):this.safeEmit(Kd.onUserUnpublishStream,ud(ud({},s),{},{reason:Ed.STREAM_REMOVE_REASON_UNPUBLISH}))}},{key:"_onCustomMessage",value:function(e){var t=e.message;e.binary?this.safeEmit(Kd.onRoomBinaryMessageReceived,{userId:e.clientId,message:t}):this.safeEmit(Kd.onRoomMessageReceived,{userId:e.clientId,message:t})}},{key:"_onUserMessageReceived",value:function(e){this._messageStatisticsObserver.recvP2PMessage(e.userId),this.safeEmit(Kd.onUserMessageReceived,e)}},{key:"_onUserBinaryMessageReceived",value:function(e){this._messageStatisticsObserver.recvP2PMessage(e.userId),this.safeEmit(Kd.onUserBinaryMessageReceived,e)}},{key:"_onLiveTranscodingResult",value:function(e){this.safeEmit(Kd.onLiveTranscodingResult,e)}},{key:"_onStreamMixingEvent",value:function(e){this.safeEmit(Kd.onStreamMixingEvent,e)}},{key:"_onUserTokenWillExpire",value:function(){this.safeEmit(Kd.onTokenWillExpire)}},{key:"_onPushPublicStreamResult",value:function(e){this.safeEmit(Kd.onPushPublicStreamResult,e)}},{key:"_handleRTMClient",value:function(e){var t=this;e.on("onUserMessageReceivedOutsideRoom",(function(e){t._messageStatisticsObserver.recvP2POutRoomMessage(e.userId),t.safeEmit(Kd.onUserMessageReceivedOutsideRoom,e)})),e.on("onUserBinaryMessageReceivedOutsideRoom",(function(e){t._messageStatisticsObserver.recvP2POutRoomMessage(e.userId),t.safeEmit(Kd.onUserBinaryMessageReceivedOutsideRoom,e)})),e.on("onUserDisconnection",(function(){t.safeEmit(Kd.onError,{errorCode:uR.RTM_DUPLICATE_LOGIN})})),e.on("onRTMTokenError",(function(){t.safeEmit(Kd.onError,{errorCode:uR.RTM_TOKEN_ERROR})})),e.on("onServerParamsSetResult",(function(e){t.safeEmit(Kd.onServerParamsSetResult,null==e?void 0:e.code)}))}},{key:"waitForNewToken",get:function(){return!!this._tempRoomInfo}},{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:"iceState",get:function(){var e,t,r,n;return null===(e=this._room)||void 0===e||null===(t=e._mediaServerClient)||void 0===t||null===(r=t.handler)||void 0===r||null===(n=r._peerConnection)||void 0===n?void 0:n.iceConnectionState}},{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:"multiChatMode",get:function(){var e,t;return!(null===(e=this._room)||void 0===e||null===(t=e._mediaServerClient)||void 0===t||!t.roomAttributes.multiChatMode)}},{key:"_handleAudioDeviceManager",value:function(){var e=this;this._audioDeviceManager.on("onAudioPlaybackDeviceTestVolume",(function(t){e.safeEmit(Kd.onAudioPlaybackDeviceTestVolume,t)}))}},{key:"_assertNotInRoom",value:function(){if(!this._room||this._room.connectionState!==pF.CONNECTED)throw new lR(uR.NOT_CONNECTED_YET,"server not connected")}},{key:"_checkMediaType",value:function(e){Kw(e,"mediaType",[Sd.AUDIO,Sd.VIDEO,Sd.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"}},{key:"_switchTrack",value:(t=km(Em().mark((function e(t){var r,n;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._initLocalTrackEvents(t),this._localVideoTrack=t,null!==(r=this._videoPlayer)&&void 0!==r&&r.played&&(this._videoPlayer.stop(),this._videoPlayer.playVideo(t),this._videoPlayer.mirror(!!this._mirrorType)),null===(n=this._room)||void 0===n||!n.hasPublished){e.next=6;break}return e.next=6,this._updatePublish();case 6:case"end":return e.stop()}}),e,this)}))),function(e){return t.apply(this,arguments)})},{key:"_shouldUpdateAudioConf",value:function(e){var t,r=(null===(t=this._room)||void 0===t?void 0:t.hasPublished)||this._localAudioTrack&&this._localAudioTrack.sourceType===FU.INTERNAL;if(r){var n="engine.".concat(e," should be called before publishing or capturing.");console.warn("[RTC WebSDK]: "+n),pP(e,n)}return!r}}]),_e}(OC),sd(qq,"GUID",1),qq),eW=$q;Jq([hP()],eW.prototype,"updateToken",1),Jq([hP()],eW.prototype,"setVideoCaptureDevice",1),Jq([hP()],eW.prototype,"setAudioCaptureDevice",1),Jq([hP()],eW.prototype,"joinRoom",1),Jq([hP()],eW.prototype,"leaveRoom",1),Jq([hP()],eW.prototype,"destroy",1),Jq([hP()],eW.prototype,"publishStream",1),Jq([hP()],eW.prototype,"unpublishStream",1),Jq([hP()],eW.prototype,"publishScreen",1),Jq([hP()],eW.prototype,"unpublishScreen",1),Jq([hP()],eW.prototype,"subscribeStream",1),Jq([hP()],eW.prototype,"unsubscribeStream",1),Jq([hP()],eW.prototype,"subscribeScreen",1),Jq([hP()],eW.prototype,"unsubscribeScreen",1),Jq([hP()],eW.prototype,"setRemoteVideoConfig",1),Jq([hP()],eW.prototype,"startVideoCapture",1),Jq([hP()],eW.prototype,"stopVideoCapture",1),Jq([hP()],eW.prototype,"startAudioCapture",1),Jq([hP()],eW.prototype,"stopAudioCapture",1),Jq([hP()],eW.prototype,"getAudioMixingManager",1),Jq([hP()],eW.prototype,"startScreenCapture",1),Jq([hP()],eW.prototype,"stopScreenCapture",1),Jq([hP()],eW.prototype,"setLocalVideoPlayer",1),Jq([hP()],eW.prototype,"startLiveTranscoding",1),Jq([hP()],eW.prototype,"updateLiveTranscoding",1),Jq([hP()],eW.prototype,"stopLiveTranscoding",1),Jq([hP()],eW.prototype,"startSubtitle",1),Jq([hP()],eW.prototype,"stopSubtitle",1),Jq([hP()],eW.prototype,"setBusinessId",1),Jq([hP()],eW.prototype,"setUserVisibility",1),Jq([hP()],eW.prototype,"setRemoteVideoPlayer",1),Jq([hP()],eW.prototype,"setLocalVideoMirrorType",1),Jq([hP()],eW.prototype,"setAudioPlaybackDevice",1),Jq([hP()],eW.prototype,"play",1),Jq([hP()],eW.prototype,"pauseAllSubscribedStream",1),Jq([hP()],eW.prototype,"resumeAllSubscribedStream",1),Jq([hP()],eW.prototype,"sendUserMessage",1),Jq([hP()],eW.prototype,"sendUserBinaryMessage",1),Jq([hP()],eW.prototype,"sendRoomMessage",1),Jq([hP()],eW.prototype,"sendRoomBinaryMessage",1),Jq([hP()],eW.prototype,"setAudioCaptureConfig",1),Jq([Vw("4.51"),hP()],eW.prototype,"setVideoCaptureConfig",1),Jq([hP()],eW.prototype,"enableSimulcastMode",1),Jq([hP()],eW.prototype,"setVideoEncoderConfig",1),Jq([hP()],eW.prototype,"setScreenEncoderConfig",1),Jq([hP()],eW.prototype,"sendSEIMessage",1),Jq([Vw("4.42"),hP()],eW.prototype,"setAudioVolumeIndicationInterval",1),Jq([hP()],eW.prototype,"enableAudioPropertiesReport",1),Jq([hP()],eW.prototype,"setVideoSourceType",1),Jq([hP()],eW.prototype,"setExternalVideoTrack",1),Jq([hP()],eW.prototype,"setAudioSourceType",1),Jq([hP()],eW.prototype,"setExternalAudioTrack",1),Jq([hP("rtm")],eW.prototype,"login",1),Jq([hP("rtm")],eW.prototype,"logout",1),Jq([hP("rtm")],eW.prototype,"updateLoginToken",1),Jq([hP("rtm")],eW.prototype,"getPeerOnlineStatus",1),Jq([hP("rtm")],eW.prototype,"sendUserMessageOutsideRoom",1),Jq([hP("rtm")],eW.prototype,"sendUserBinaryMessageOutsideRoom",1),Jq([hP("rtm")],eW.prototype,"setServerParams",1),Jq([hP("rtm")],eW.prototype,"sendServerMessage",1),Jq([hP("rtm")],eW.prototype,"sendServerBinaryMessage",1),Jq([hP()],eW.prototype,"startCloudProxy",1),Jq([hP()],eW.prototype,"stopCloudProxy",1),Jq([hP()],eW.prototype,"startPushPublicStream",1),Jq([hP()],eW.prototype,"updatePublicStreamParam",1),Jq([hP()],eW.prototype,"stopPushPublicStream",1),Jq([hP("outsideRoom","streamId")],eW.prototype,"startPlayPublicStream",1),Jq([hP("outsideRoom","streamId")],eW.prototype,"stopPlayPublicStream",1),Jq([hP()],eW.prototype,"setAudioProfile",1),Jq([hP("outsideRoom")],eW.prototype,"setPublicStreamVideoPlayer",1),Jq([hP()],eW.prototype,"setDummyCaptureImagePath",1),Jq([hP()],eW.prototype,"registerExtension",1),Jq([hP()],eW.prototype,"startAudioPlaybackDeviceTest",1),Jq([hP()],eW.prototype,"stopAudioPlaybackDeviceTest",1),Jq([hP()],eW.prototype,"startAudioDeviceRecordTest",1),Jq([hP()],eW.prototype,"stopAudioDeviceRecordAndPlayTest",1),Jq([hP()],eW.prototype,"stopAudioDevicePlayTest",1),Jq([hP()],eW.prototype,"setRemoteUserPriority",1),Jq([hP()],eW.prototype,"takeLocalSnapshot",1),Jq([hP()],eW.prototype,"takeRemoteSnapshot",1),Jq([hP()],eW.prototype,"setSubscribeFallbackOption",1),Jq([hP()],eW.prototype,"getLocalStreamTrack",1),Jq([hP()],eW.prototype,"getRemoteStreamTrack",1),Jq([hP()],eW.prototype,"getPublicStreamTrack",1),Jq([hP()],eW.prototype,"setRemoteStreamRenderSync",1);var tW,rW,nW={"client unpublished":Ed.STREAM_REMOVE_REASON_UNPUBLISH,"publish failed":Ed.STREAM_REMOVE_REASON_PUBLISH_FAILED,"stream removed":Ed.STREAM_REMOVE_REASON_KEEP_LIVE_FAILED,"client disconnected":Ed.STREAM_REMOVE_REASON_CLIENT_DISCONNECTED,"client republish":Ed.STREAM_REMOVE_REASON_REPUBLISH},iW=new RC("VERTC",0);kC.storeKey=wm(tW="".concat(Date.now(),"-")).call(tW,bP.getDeviceId()),[sP,cP,uP].forEach((function(e){var t;return e.setStats({rtc_sdk_version:RP.VERSION,product_line:SD.RTC,report_version:ED.W_5,os:bD.WEB,device_id:bP.getDeviceId(),log_cache_key:kC.storeKey,user_agent:uw()?"":null===(t=navigator)||void 0===t?void 0:t.userAgent})})),aG.setStats({rtc_sdk_version:RP.VERSION,log_cache_key:kC.storeKey});var oW=function(e,t){return iW.print("createEngine","Invoke VERTC.createEngine"),zw(e,"appId"),[sP,cP,uP].forEach((function(r){return r.setStats({rtc_app_id:e,auto_play_policy:null==t?void 0:t.autoPlayPolicy})})),aG.setStats({rtc_app_id:e}),iP.sdkInitEngine(Date.now(),WD.BEGIN),new eW(e,t)},aW=function(e){if(iW.print("destroyEngine","Invoke VERTC.destroyEngine"),!(e instanceof eW))throw new lR(uR.INVALID_ENGINE,"Invalid engine object");e.destroy(),iP.sdkInitEngine(Date.now(),WD.END)},sW=function(){var e=km(Em().mark((function e(){return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",PU.enumerateDevices());case 1:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),cW=function(){var e=km(Em().mark((function e(){var t,r,n,i,o,a,s=arguments;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=s.length>0&&void 0!==s[0]?s[0]:{video:!0,audio:!0},r=t.video,n=t.audio,i={video:!1,audio:!1},!r){e.next=13;break}return e.prev=4,e.next=7,PU.getPermissions({video:!0,force:!0});case 7:o=e.sent,i.video=o.video,e.next=13;break;case 11:e.prev=11,e.t0=e.catch(4);case 13:if(!n){e.next=23;break}return e.prev=14,e.next=17,PU.getPermissions({audio:!0,force:!0});case 17:a=e.sent,i.audio=a.audio,e.next=23;break;case 21:e.prev=21,e.t1=e.catch(14);case 23:return e.abrupt("return",i);case 24:case"end":return e.stop()}}),e,null,[[4,11],[14,21]])})));return function(){return e.apply(this,arguments)}}(),uW=function(){var e=km(Em().mark((function e(){return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",PU.enumerateAudioCaptureDevices());case 1:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),dW=function(){var e=km(Em().mark((function e(){return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",PU.enumerateVideoCaptureDevices());case 1:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),lW=function(){var e=km(Em().mark((function e(){return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",PU.enumerateAudioPlaybackDevices());case 1:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),hW=function(){return RP.VERSION},fW=function(){return iP.rtcSdkApiCall("isSupported",0,""),iL()},pW=function(){return iP.rtcSdkApiCall("getSupportedCodecs",0,""),aL()},vW=function(e){var t=e.logLevel,r=e.LogfileSize;t&&(kC.logLevel=t),r&&(kC.LogfileSize=r)},_W=function(e){kC.download(e)};return!uw()&&Jm(rW=location.search).call(rW,"_rtc_autotest_"),ud(ud(ud(ud({},new(qd((function e(){Wd(this,e),sd(this,"getSdkVersion",hW),sd(this,"createEngine",oW),sd(this,"destroyEngine",aW),sd(this,"enumerateDevices",sW),sd(this,"enableDevices",cW),sd(this,"enumerateAudioCaptureDevices",uW),sd(this,"enumerateVideoCaptureDevices",dW),sd(this,"enumerateAudioPlaybackDevices",lW),sd(this,"getParameter",CP),sd(this,"setParameter",wP),sd(this,"isSupported",fW),sd(this,"getSupportedCodecs",pW),sd(this,"ConnectionMode",Fd),sd(this,"events",Kd),sd(this,"ErrorCode",uR),sd(this,"platform","BytePlus"),sd(this,"_monitor",iP),sd(this,"_rtmMonitor",oP),sd(this,"downloadLog",_W),sd(this,"setLogConfig",vW)})))),Bd),zd),{},{events:Kd})}));
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"}))}var t="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 t&&t)||function(){return this}()||Function("return this")(),i=function(e){try{return!!e()}catch(t){return!0}},o=!i((function(){var e=function(){}.bind();return"function"!=typeof e||e.hasOwnProperty("prototype")})),a=o,s=Function.prototype,c=s.apply,u=s.call,d="object"==typeof Reflect&&Reflect.apply||(a?u.bind(c):function(){return u.apply(c,arguments)}),l=o,h=Function.prototype,f=h.call,p=l&&h.bind.bind(f,f),v=l?p:function(e){return function(){return f.apply(e,arguments)}},_=v,m=_({}.toString),g=_("".slice),y=function(e){return g(m(e),8,-1)},S=y,E=v,b=function(e){if("Function"===S(e))return E(e)},k="object"==typeof document&&document.all,T={all:k,IS_HTMLDDA:void 0===k&&void 0!==k},I=T.all,A=T.IS_HTMLDDA?function(e){return"function"==typeof e||e===I}:function(e){return"function"==typeof e},R={},w=!i((function(){return 7!=Object.defineProperty({},1,{get:function(){return 7}})[1]})),C=o,O=Function.prototype.call,D=C?O.bind(O):function(){return O.apply(O,arguments)},x={},N={}.propertyIsEnumerable,P=Object.getOwnPropertyDescriptor,M=P&&!N.call({1:2},1);x.f=M?function(e){var t=P(this,e);return!!t&&t.enumerable}:N;var L,U,V=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}},F=i,B=y,j=Object,G=b("".split),H=F((function(){return!j("z").propertyIsEnumerable(0)}))?function(e){return"String"==B(e)?G(e,""):j(e)}:j,z=function(e){return null==e},K=z,X=TypeError,q=function(e){if(K(e))throw X("Can't call method on "+e);return e},W=H,Y=q,Q=function(e){return W(Y(e))},J=A,Z=T.all,$=T.IS_HTMLDDA?function(e){return"object"==typeof e?null!==e:J(e)||e===Z}:function(e){return"object"==typeof e?null!==e:J(e)},ee={},te=ee,re=n,ne=A,ie=function(e){return ne(e)?e:void 0},oe=function(e,t){return arguments.length<2?ie(te[e])||ie(re[e]):te[e]&&te[e][t]||re[e]&&re[e][t]},ae=b({}.isPrototypeOf),se=oe("navigator","userAgent")||"",ce=n,ue=se,de=ce.process,le=ce.Deno,he=de&&de.versions||le&&le.version,fe=he&&he.v8;fe&&(U=(L=fe.split("."))[0]>0&&L[0]<4?1:+(L[0]+L[1])),!U&&ue&&(!(L=ue.match(/Edge\/(\d+)/))||L[1]>=74)&&(L=ue.match(/Chrome\/(\d+)/))&&(U=+L[1]);var pe=U,ve=pe,_e=i,me=!!Object.getOwnPropertySymbols&&!_e((function(){var e=Symbol();return!String(e)||!(Object(e)instanceof Symbol)||!Symbol.sham&&ve&&ve<41})),ge=me&&!Symbol.sham&&"symbol"==typeof Symbol.iterator,ye=oe,Se=A,Ee=ae,be=Object,ke=ge?function(e){return"symbol"==typeof e}:function(e){var t=ye("Symbol");return Se(t)&&Ee(t.prototype,be(e))},Te=String,Ie=function(e){try{return Te(e)}catch(t){return"Object"}},Ae=A,Re=Ie,we=TypeError,Ce=function(e){if(Ae(e))return e;throw we(Re(e)+" is not a function")},Oe=Ce,De=z,xe=function(e,t){var r=e[t];return De(r)?void 0:Oe(r)},Ne=D,Pe=A,Me=$,Le=TypeError,Ue={exports:{}},Ve=n,Fe=Object.defineProperty,Be=function(e,t){try{Fe(Ve,e,{value:t,configurable:!0,writable:!0})}catch(r){Ve[e]=t}return t},je="__core-js_shared__",Ge=n[je]||Be(je,{}),He=Ge;(Ue.exports=function(e,t){return He[e]||(He[e]=void 0!==t?t:{})})("versions",[]).push({version:"3.26.0",mode:"pure",copyright:"© 2014-2022 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.26.0/LICENSE",source:"https://github.com/zloirock/core-js"});var ze=q,Ke=Object,Xe=function(e){return Ke(ze(e))},qe=Xe,We=b({}.hasOwnProperty),Ye=Object.hasOwn||function(e,t){return We(qe(e),t)},Qe=b,Je=0,Ze=Math.random(),$e=Qe(1..toString),et=function(e){return"Symbol("+(void 0===e?"":e)+")_"+$e(++Je+Ze,36)},tt=n,rt=Ue.exports,nt=Ye,it=et,ot=me,at=ge,st=rt("wks"),ct=tt.Symbol,ut=ct&&ct.for,dt=at?ct:ct&&ct.withoutSetter||it,lt=function(e){if(!nt(st,e)||!ot&&"string"!=typeof st[e]){var t="Symbol."+e;ot&&nt(ct,e)?st[e]=ct[e]:st[e]=at&&ut?ut(t):dt(t)}return st[e]},ht=D,ft=$,pt=ke,vt=xe,_t=function(e,t){var r,n;if("string"===t&&Pe(r=e.toString)&&!Me(n=Ne(r,e)))return n;if(Pe(r=e.valueOf)&&!Me(n=Ne(r,e)))return n;if("string"!==t&&Pe(r=e.toString)&&!Me(n=Ne(r,e)))return n;throw Le("Can't convert object to primitive value")},mt=TypeError,gt=lt("toPrimitive"),yt=function(e,t){if(!ft(e)||pt(e))return e;var r,n=vt(e,gt);if(n){if(void 0===t&&(t="default"),r=ht(n,e,t),!ft(r)||pt(r))return r;throw mt("Can't convert object to primitive value")}return void 0===t&&(t="number"),_t(e,t)},St=ke,Et=function(e){var t=yt(e,"string");return St(t)?t:t+""},bt=$,kt=n.document,Tt=bt(kt)&&bt(kt.createElement),It=function(e){return Tt?kt.createElement(e):{}},At=It,Rt=!w&&!i((function(){return 7!=Object.defineProperty(At("div"),"a",{get:function(){return 7}}).a})),wt=w,Ct=D,Ot=x,Dt=V,xt=Q,Nt=Et,Pt=Ye,Mt=Rt,Lt=Object.getOwnPropertyDescriptor;R.f=wt?Lt:function(e,t){if(e=xt(e),t=Nt(t),Mt)try{return Lt(e,t)}catch(r){}if(Pt(e,t))return Dt(!Ct(Ot.f,e,t),e[t])};var Ut=i,Vt=A,Ft=/#|\.prototype\./,Bt=function(e,t){var r=Gt[jt(e)];return r==zt||r!=Ht&&(Vt(t)?Ut(t):!!t)},jt=Bt.normalize=function(e){return String(e).replace(Ft,".").toLowerCase()},Gt=Bt.data={},Ht=Bt.NATIVE="N",zt=Bt.POLYFILL="P",Kt=Bt,Xt=Ce,qt=o,Wt=b(b.bind),Yt=function(e,t){return Xt(e),void 0===t?e:qt?Wt(e,t):function(){return e.apply(t,arguments)}},Qt={},Jt=w&&i((function(){return 42!=Object.defineProperty((function(){}),"prototype",{value:42,writable:!1}).prototype})),Zt=$,$t=String,er=TypeError,tr=function(e){if(Zt(e))return e;throw er($t(e)+" is not an object")},rr=w,nr=Rt,ir=Jt,or=tr,ar=Et,sr=TypeError,cr=Object.defineProperty,ur=Object.getOwnPropertyDescriptor,dr="enumerable",lr="configurable",hr="writable";Qt.f=rr?ir?function(e,t,r){if(or(e),t=ar(t),or(r),"function"==typeof e&&"prototype"===t&&"value"in r&&hr in r&&!r.writable){var n=ur(e,t);n&&n.writable&&(e[t]=r.value,r={configurable:lr in r?r.configurable:n.configurable,enumerable:dr in r?r.enumerable:n.enumerable,writable:!1})}return cr(e,t,r)}:cr:function(e,t,r){if(or(e),t=ar(t),or(r),nr)try{return cr(e,t,r)}catch(n){}if("get"in r||"set"in r)throw sr("Accessors not supported");return"value"in r&&(e[t]=r.value),e};var fr=Qt,pr=V,vr=w?function(e,t,r){return fr.f(e,t,pr(1,r))}:function(e,t,r){return e[t]=r,e},_r=n,mr=d,gr=b,yr=A,Sr=R.f,Er=Kt,br=ee,kr=Yt,Tr=vr,Ir=Ye,Ar=function(e){var t=function(r,n,i){if(this instanceof t){switch(arguments.length){case 0:return new e;case 1:return new e(r);case 2:return new e(r,n)}return new e(r,n,i)}return mr(e,this,arguments)};return t.prototype=e.prototype,t},Rr=function(e,t){var r,n,i,o,a,s,c,u,d=e.target,l=e.global,h=e.stat,f=e.proto,p=l?_r:h?_r[d]:(_r[d]||{}).prototype,v=l?br:br[d]||Tr(br,d,{})[d],_=v.prototype;for(i in t)r=!Er(l?i:d+(h?".":"#")+i,e.forced)&&p&&Ir(p,i),a=v[i],r&&(s=e.dontCallGetSet?(u=Sr(p,i))&&u.value:p[i]),o=r&&s?s:t[i],r&&typeof a==typeof o||(c=e.bind&&r?kr(o,_r):e.wrap&&r?Ar(o):f&&yr(o)?gr(o):o,(e.sham||o&&o.sham||a&&a.sham)&&Tr(c,"sham",!0),Tr(v,i,c),f&&(Ir(br,n=d+"Prototype")||Tr(br,n,{}),Tr(br[n],i,o),e.real&&_&&!_[i]&&Tr(_,i,o)))},wr=Math.ceil,Cr=Math.floor,Or=Math.trunc||function(e){var t=+e;return(t>0?Cr:wr)(t)},Dr=function(e){var t=+e;return t!=t||0===t?0:Or(t)},xr=Dr,Nr=Math.max,Pr=Math.min,Mr=function(e,t){var r=xr(e);return r<0?Nr(r+t,0):Pr(r,t)},Lr=Dr,Ur=Math.min,Vr=function(e){return e>0?Ur(Lr(e),9007199254740991):0},Fr=Vr,Br=function(e){return Fr(e.length)},jr=Q,Gr=Mr,Hr=Br,zr=function(e){return function(t,r,n){var i,o=jr(t),a=Hr(o),s=Gr(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}},Kr={includes:zr(!0),indexOf:zr(!1)},Xr={},qr=Ye,Wr=Q,Yr=Kr.indexOf,Qr=Xr,Jr=b([].push),Zr=function(e,t){var r,n=Wr(e),i=0,o=[];for(r in n)!qr(Qr,r)&&qr(n,r)&&Jr(o,r);for(;t.length>i;)qr(n,r=t[i++])&&(~Yr(o,r)||Jr(o,r));return o},$r=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],en=Zr,tn=$r,rn=Object.keys||function(e){return en(e,tn)},nn=Xe,on=rn;Rr({target:"Object",stat:!0,forced:i((function(){on(1)}))},{keys:function(e){return on(nn(e))}});var an=ee.Object.keys,sn={};sn[lt("toStringTag")]="z";var cn="[object z]"===String(sn),un=cn,dn=A,ln=y,hn=lt("toStringTag"),fn=Object,pn="Arguments"==ln(function(){return arguments}()),vn=un?ln: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=fn(e),hn))?r:pn?ln(t):"Object"==(n=ln(t))&&dn(t.callee)?"Arguments":n},_n=vn,mn=String,gn=function(e){if("Symbol"===_n(e))throw TypeError("Cannot convert a Symbol value to a string");return mn(e)},yn={},Sn=w,En=Jt,bn=Qt,kn=tr,Tn=Q,In=rn;yn.f=Sn&&!En?Object.defineProperties:function(e,t){kn(e);for(var r,n=Tn(t),i=In(t),o=i.length,a=0;o>a;)bn.f(e,r=i[a++],n[r]);return e};var An,Rn=oe("document","documentElement"),wn=Ue.exports,Cn=et,On=wn("keys"),Dn=function(e){return On[e]||(On[e]=Cn(e))},xn=tr,Nn=yn,Pn=$r,Mn=Xr,Ln=Rn,Un=It,Vn=Dn("IE_PROTO"),Fn=function(){},Bn=function(e){return"<script>"+e+"</"+"script>"},jn=function(e){e.write(Bn("")),e.close();var t=e.parentWindow.Object;return e=null,t},Gn=function(){try{An=new ActiveXObject("htmlfile")}catch(n){}var e,t;Gn="undefined"!=typeof document?document.domain&&An?jn(An):((t=Un("iframe")).style.display="none",Ln.appendChild(t),t.src=String("javascript:"),(e=t.contentWindow.document).open(),e.write(Bn("document.F=Object")),e.close(),e.F):jn(An);for(var r=Pn.length;r--;)delete Gn.prototype[Pn[r]];return Gn()};Mn[Vn]=!0;var Hn=Object.create||function(e,t){var r;return null!==e?(Fn.prototype=xn(e),r=new Fn,Fn.prototype=null,r[Vn]=e):r=Gn(),void 0===t?r:Nn.f(r,t)},zn={},Kn=Zr,Xn=$r.concat("length","prototype");zn.f=Object.getOwnPropertyNames||function(e){return Kn(e,Xn)};var qn={},Wn=Et,Yn=Qt,Qn=V,Jn=function(e,t,r){var n=Wn(t);n in e?Yn.f(e,n,Qn(0,r)):e[n]=r},Zn=Mr,$n=Br,ei=Jn,ti=Array,ri=Math.max,ni=function(e,t,r){for(var n=$n(e),i=Zn(t,n),o=Zn(void 0===r?n:r,n),a=ti(ri(o-i,0)),s=0;i<o;i++,s++)ei(a,s,e[i]);return a.length=s,a},ii=y,oi=Q,ai=zn.f,si=ni,ci="object"==typeof window&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[];qn.f=function(e){return ci&&"Window"==ii(e)?function(e){try{return ai(e)}catch(t){return si(ci)}}(e):ai(oi(e))};var ui={};ui.f=Object.getOwnPropertySymbols;var di=vr,li=function(e,t,r,n){return n&&n.enumerable?e[t]=r:di(e,t,r),e},hi={},fi=lt;hi.f=fi;var pi,vi,_i,mi=ee,gi=Ye,yi=hi,Si=Qt.f,Ei=function(e){var t=mi.Symbol||(mi.Symbol={});gi(t,e)||Si(t,e,{value:yi.f(e)})},bi=D,ki=oe,Ti=lt,Ii=li,Ai=function(){var e=ki("Symbol"),t=e&&e.prototype,r=t&&t.valueOf,n=Ti("toPrimitive");t&&!t[n]&&Ii(t,n,(function(e){return bi(r,this)}),{arity:1})},Ri=vn,wi=cn?{}.toString:function(){return"[object "+Ri(this)+"]"},Ci=cn,Oi=Qt.f,Di=vr,xi=Ye,Ni=wi,Pi=lt("toStringTag"),Mi=function(e,t,r,n){if(e){var i=r?e:e.prototype;xi(i,Pi)||Oi(i,Pi,{configurable:!0,value:t}),n&&!Ci&&Di(i,"toString",Ni)}},Li=A,Ui=n.WeakMap,Vi=Li(Ui)&&/native code/.test(String(Ui)),Fi=Vi,Bi=n,ji=$,Gi=vr,Hi=Ye,zi=Ge,Ki=Dn,Xi=Xr,qi="Object already initialized",Wi=Bi.TypeError,Yi=Bi.WeakMap;if(Fi||zi.state){var Qi=zi.state||(zi.state=new Yi);Qi.get=Qi.get,Qi.has=Qi.has,Qi.set=Qi.set,pi=function(e,t){if(Qi.has(e))throw Wi(qi);return t.facade=e,Qi.set(e,t),t},vi=function(e){return Qi.get(e)||{}},_i=function(e){return Qi.has(e)}}else{var Ji=Ki("state");Xi[Ji]=!0,pi=function(e,t){if(Hi(e,Ji))throw Wi(qi);return t.facade=e,Gi(e,Ji,t),t},vi=function(e){return Hi(e,Ji)?e[Ji]:{}},_i=function(e){return Hi(e,Ji)}}var Zi={set:pi,get:vi,has:_i,enforce:function(e){return _i(e)?vi(e):pi(e,{})},getterFor:function(e){return function(t){var r;if(!ji(t)||(r=vi(t)).type!==e)throw Wi("Incompatible receiver, "+e+" required");return r}}},$i=y,eo=Array.isArray||function(e){return"Array"==$i(e)},to=A,ro=Ge,no=b(Function.toString);to(ro.inspectSource)||(ro.inspectSource=function(e){return no(e)});var io=ro.inspectSource,oo=b,ao=i,so=A,co=vn,uo=io,lo=function(){},ho=[],fo=oe("Reflect","construct"),po=/^\s*(?:class|function)\b/,vo=oo(po.exec),_o=!po.exec(lo),mo=function(e){if(!so(e))return!1;try{return fo(lo,ho,e),!0}catch(t){return!1}},go=function(e){if(!so(e))return!1;switch(co(e)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return _o||!!vo(po,uo(e))}catch(t){return!0}};go.sham=!0;var yo=!fo||ao((function(){var e;return mo(mo.call)||!mo(Object)||!mo((function(){e=!0}))||e}))?go:mo,So=eo,Eo=yo,bo=$,ko=lt("species"),To=Array,Io=function(e){var t;return So(e)&&(t=e.constructor,(Eo(t)&&(t===To||So(t.prototype))||bo(t)&&null===(t=t[ko]))&&(t=void 0)),void 0===t?To:t},Ao=function(e,t){return new(Io(e))(0===t?0:t)},Ro=Yt,wo=H,Co=Xe,Oo=Br,Do=Ao,xo=b([].push),No=function(e){var t=1==e,r=2==e,n=3==e,i=4==e,o=6==e,a=7==e,s=5==e||o;return function(c,u,d,l){for(var h,f,p=Co(c),v=wo(p),_=Ro(u,d),m=Oo(v),g=0,y=l||Do,S=t?y(c,m):r||a?y(c,0):void 0;m>g;g++)if((s||g in v)&&(f=_(h=v[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:xo(S,h)}else switch(e){case 4:return!1;case 7:xo(S,h)}return o?-1:n||i?i:S}},Po={forEach:No(0),map:No(1),filter:No(2),some:No(3),every:No(4),find:No(5),findIndex:No(6),filterReject:No(7)},Mo=Rr,Lo=n,Uo=D,Vo=b,Fo=w,Bo=me,jo=i,Go=Ye,Ho=ae,zo=tr,Ko=Q,Xo=Et,qo=gn,Wo=V,Yo=Hn,Qo=rn,Jo=zn,Zo=qn,$o=ui,ea=R,ta=Qt,ra=yn,na=x,ia=li,oa=Ue.exports,aa=Xr,sa=et,ca=lt,ua=hi,da=Ei,la=Ai,ha=Mi,fa=Zi,pa=Po.forEach,va=Dn("hidden"),_a="Symbol",ma=fa.set,ga=fa.getterFor(_a),ya=Object.prototype,Sa=Lo.Symbol,Ea=Sa&&Sa.prototype,ba=Lo.TypeError,ka=Lo.QObject,Ta=ea.f,Ia=ta.f,Aa=Zo.f,Ra=na.f,wa=Vo([].push),Ca=oa("symbols"),Oa=oa("op-symbols"),Da=oa("wks"),xa=!ka||!ka.prototype||!ka.prototype.findChild,Na=Fo&&jo((function(){return 7!=Yo(Ia({},"a",{get:function(){return Ia(this,"a",{value:7}).a}})).a}))?function(e,t,r){var n=Ta(ya,t);n&&delete ya[t],Ia(e,t,r),n&&e!==ya&&Ia(ya,t,n)}:Ia,Pa=function(e,t){var r=Ca[e]=Yo(Ea);return ma(r,{type:_a,tag:e,description:t}),Fo||(r.description=t),r},Ma=function(e,t,r){e===ya&&Ma(Oa,t,r),zo(e);var n=Xo(t);return zo(r),Go(Ca,n)?(r.enumerable?(Go(e,va)&&e[va][n]&&(e[va][n]=!1),r=Yo(r,{enumerable:Wo(0,!1)})):(Go(e,va)||Ia(e,va,Wo(1,{})),e[va][n]=!0),Na(e,n,r)):Ia(e,n,r)},La=function(e,t){zo(e);var r=Ko(t),n=Qo(r).concat(Ba(r));return pa(n,(function(t){Fo&&!Uo(Ua,r,t)||Ma(e,t,r[t])})),e},Ua=function(e){var t=Xo(e),r=Uo(Ra,this,t);return!(this===ya&&Go(Ca,t)&&!Go(Oa,t))&&(!(r||!Go(this,t)||!Go(Ca,t)||Go(this,va)&&this[va][t])||r)},Va=function(e,t){var r=Ko(e),n=Xo(t);if(r!==ya||!Go(Ca,n)||Go(Oa,n)){var i=Ta(r,n);return!i||!Go(Ca,n)||Go(r,va)&&r[va][n]||(i.enumerable=!0),i}},Fa=function(e){var t=Aa(Ko(e)),r=[];return pa(t,(function(e){Go(Ca,e)||Go(aa,e)||wa(r,e)})),r},Ba=function(e){var t=e===ya,r=Aa(t?Oa:Ko(e)),n=[];return pa(r,(function(e){!Go(Ca,e)||t&&!Go(ya,e)||wa(n,Ca[e])})),n};Bo||(Sa=function(){if(Ho(Ea,this))throw ba("Symbol is not a constructor");var e=arguments.length&&void 0!==arguments[0]?qo(arguments[0]):void 0,t=sa(e),r=function(e){this===ya&&Uo(r,Oa,e),Go(this,va)&&Go(this[va],t)&&(this[va][t]=!1),Na(this,t,Wo(1,e))};return Fo&&xa&&Na(ya,t,{configurable:!0,set:r}),Pa(t,e)},ia(Ea=Sa.prototype,"toString",(function(){return ga(this).tag})),ia(Sa,"withoutSetter",(function(e){return Pa(sa(e),e)})),na.f=Ua,ta.f=Ma,ra.f=La,ea.f=Va,Jo.f=Zo.f=Fa,$o.f=Ba,ua.f=function(e){return Pa(ca(e),e)},Fo&&Ia(Ea,"description",{configurable:!0,get:function(){return ga(this).description}})),Mo({global:!0,constructor:!0,wrap:!0,forced:!Bo,sham:!Bo},{Symbol:Sa}),pa(Qo(Da),(function(e){da(e)})),Mo({target:_a,stat:!0,forced:!Bo},{useSetter:function(){xa=!0},useSimple:function(){xa=!1}}),Mo({target:"Object",stat:!0,forced:!Bo,sham:!Fo},{create:function(e,t){return void 0===t?Yo(e):La(Yo(e),t)},defineProperty:Ma,defineProperties:La,getOwnPropertyDescriptor:Va}),Mo({target:"Object",stat:!0,forced:!Bo},{getOwnPropertyNames:Fa}),la(),ha(Sa,_a),aa[va]=!0;var ja=me&&!!Symbol.for&&!!Symbol.keyFor,Ga=Rr,Ha=oe,za=Ye,Ka=gn,Xa=Ue.exports,qa=ja,Wa=Xa("string-to-symbol-registry"),Ya=Xa("symbol-to-string-registry");Ga({target:"Symbol",stat:!0,forced:!qa},{for:function(e){var t=Ka(e);if(za(Wa,t))return Wa[t];var r=Ha("Symbol")(t);return Wa[t]=r,Ya[r]=t,r}});var Qa=Rr,Ja=Ye,Za=ke,$a=Ie,es=ja,ts=(0,Ue.exports)("symbol-to-string-registry");Qa({target:"Symbol",stat:!0,forced:!es},{keyFor:function(e){if(!Za(e))throw TypeError($a(e)+" is not a symbol");if(Ja(ts,e))return ts[e]}});var rs=b([].slice),ns=Rr,is=oe,os=d,as=D,ss=b,cs=i,us=eo,ds=A,ls=$,hs=ke,fs=rs,ps=me,vs=is("JSON","stringify"),_s=ss(/./.exec),ms=ss("".charAt),gs=ss("".charCodeAt),ys=ss("".replace),Ss=ss(1..toString),Es=/[\uD800-\uDFFF]/g,bs=/^[\uD800-\uDBFF]$/,ks=/^[\uDC00-\uDFFF]$/,Ts=!ps||cs((function(){var e=is("Symbol")();return"[null]"!=vs([e])||"{}"!=vs({a:e})||"{}"!=vs(Object(e))})),Is=cs((function(){return'"\\udf06\\ud834"'!==vs("\udf06\ud834")||'"\\udead"'!==vs("\udead")})),As=function(e,t){var r=fs(arguments),n=t;if((ls(t)||void 0!==e)&&!hs(e))return us(t)||(t=function(e,t){if(ds(n)&&(t=as(n,this,e,t)),!hs(t))return t}),r[1]=t,os(vs,null,r)},Rs=function(e,t,r){var n=ms(r,t-1),i=ms(r,t+1);return _s(bs,e)&&!_s(ks,i)||_s(ks,e)&&!_s(bs,n)?"\\u"+Ss(gs(e,0),16):e};vs&&ns({target:"JSON",stat:!0,arity:3,forced:Ts||Is},{stringify:function(e,t,r){var n=fs(arguments),i=os(Ts?As:vs,null,n);return Is&&"string"==typeof i?ys(i,Es,Rs):i}});var ws=ui,Cs=Xe;Rr({target:"Object",stat:!0,forced:!me||i((function(){ws.f(1)}))},{getOwnPropertySymbols:function(e){var t=ws.f;return t?t(Cs(e)):[]}});var Os=ee.Object.getOwnPropertySymbols,Ds=i,xs=pe,Ns=lt("species"),Ps=function(e){return xs>=51||!Ds((function(){var t=[];return(t.constructor={})[Ns]=function(){return{foo:1}},1!==t[e](Boolean).foo}))},Ms=Po.filter;Rr({target:"Array",proto:!0,forced:!Ps("filter")},{filter:function(e){return Ms(this,e,arguments.length>1?arguments[1]:void 0)}});var Ls=ee,Us=function(e){return Ls[e+"Prototype"]},Vs=Us("Array").filter,Fs=ae,Bs=Vs,js=Array.prototype,Gs=function(e){var t=e.filter;return e===js||Fs(js,e)&&t===js.filter?Bs:t},Hs={exports:{}},zs=Rr,Ks=i,Xs=Q,qs=R.f,Ws=w,Ys=Ks((function(){qs(1)}));zs({target:"Object",stat:!0,forced:!Ws||Ys,sham:!Ws},{getOwnPropertyDescriptor:function(e,t){return qs(Xs(e),t)}});var Qs=ee.Object,Js=Hs.exports=function(e,t){return Qs.getOwnPropertyDescriptor(e,t)};Qs.getOwnPropertyDescriptor.sham&&(Js.sham=!0);var Zs,$s,ec,tc=Hs.exports,rc={},nc=w,ic=Ye,oc=Function.prototype,ac=nc&&Object.getOwnPropertyDescriptor,sc=ic(oc,"name"),cc={EXISTS:sc,PROPER:sc&&"something"===function(){}.name,CONFIGURABLE:sc&&(!nc||nc&&ac(oc,"name").configurable)},uc=!i((function(){function e(){}return e.prototype.constructor=null,Object.getPrototypeOf(new e)!==e.prototype})),dc=Ye,lc=A,hc=Xe,fc=uc,pc=Dn("IE_PROTO"),vc=Object,_c=vc.prototype,mc=fc?vc.getPrototypeOf:function(e){var t=hc(e);if(dc(t,pc))return t[pc];var r=t.constructor;return lc(r)&&t instanceof r?r.prototype:t instanceof vc?_c:null},gc=i,yc=A,Sc=$,Ec=Hn,bc=mc,kc=li,Tc=lt("iterator"),Ic=!1;[].keys&&("next"in(ec=[].keys())?($s=bc(bc(ec)))!==Object.prototype&&(Zs=$s):Ic=!0);var Ac=!Sc(Zs)||gc((function(){var e={};return Zs[Tc].call(e)!==e}));yc((Zs=Ac?{}:Ec(Zs))[Tc])||kc(Zs,Tc,(function(){return this}));var Rc={IteratorPrototype:Zs,BUGGY_SAFARI_ITERATORS:Ic},wc=Rc.IteratorPrototype,Cc=Hn,Oc=V,Dc=Mi,xc=rc,Nc=function(){return this},Pc=function(e,t,r,n){var i=t+" Iterator";return e.prototype=Cc(wc,{next:Oc(+!n,r)}),Dc(e,i,!1,!0),xc[i]=Nc,e},Mc=A,Lc=String,Uc=TypeError,Vc=b,Fc=tr,Bc=function(e){if("object"==typeof e||Mc(e))return e;throw Uc("Can't set "+Lc(e)+" as a prototype")},jc=Object.setPrototypeOf||("__proto__"in{}?function(){var e,t=!1,r={};try{(e=Vc(Object.getOwnPropertyDescriptor(Object.prototype,"__proto__").set))(r,[]),t=r instanceof Array}catch(n){}return function(r,n){return Fc(r),Bc(n),t?e(r,n):r.__proto__=n,r}}():void 0),Gc=Rr,Hc=D,zc=cc,Kc=Pc,Xc=mc,qc=Mi,Wc=li,Yc=rc,Qc=Rc,Jc=zc.PROPER,Zc=Qc.BUGGY_SAFARI_ITERATORS,$c=lt("iterator"),eu="keys",tu="values",ru="entries",nu=function(){return this},iu=function(e,t,r,n,i,o,a){Kc(r,t,n);var s,c,u,d=function(e){if(e===i&&v)return v;if(!Zc&&e in f)return f[e];switch(e){case eu:case tu:case ru:return function(){return new r(this,e)}}return function(){return new r(this)}},l=t+" Iterator",h=!1,f=e.prototype,p=f[$c]||f["@@iterator"]||i&&f[i],v=!Zc&&p||d(i),_="Array"==t&&f.entries||p;if(_&&(s=Xc(_.call(new e)))!==Object.prototype&&s.next&&(qc(s,l,!0,!0),Yc[l]=nu),Jc&&i==tu&&p&&p.name!==tu&&(h=!0,v=function(){return Hc(p,this)}),i)if(c={values:d(tu),keys:o?v:d(eu),entries:d(ru)},a)for(u in c)(Zc||h||!(u in f))&&Wc(f,u,c[u]);else Gc({target:t,proto:!0,forced:Zc||h},c);return a&&f[$c]!==v&&Wc(f,$c,v,{name:i}),Yc[t]=v,c},ou=function(e,t){return{value:e,done:t}},au=Q,su=function(){},cu=rc,uu=Zi,du=(Qt.f,iu),lu=ou,hu="Array Iterator",fu=uu.set,pu=uu.getterFor(hu);du(Array,"Array",(function(e,t){fu(this,{type:hu,target:au(e),index:0,kind:t})}),(function(){var e=pu(this),t=e.target,r=e.kind,n=e.index++;return!t||n>=t.length?(e.target=void 0,lu(void 0,!0)):lu("keys"==r?n:"values"==r?t[n]:[n,t[n]],!1)}),"values");cu.Arguments=cu.Array;su(),su(),su();var vu={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},_u=n,mu=vn,gu=vr,yu=rc,Su=lt("toStringTag");for(var Eu in vu){var bu=_u[Eu],ku=bu&&bu.prototype;ku&&mu(ku)!==Su&&gu(ku,Su,Eu),yu[Eu]=yu.Array}var Tu=i,Iu=function(e,t){var r=[][e];return!!r&&Tu((function(){r.call(null,t||function(){return 1},1)}))},Au=Po.forEach,Ru=Iu("forEach")?[].forEach:function(e){return Au(this,e,arguments.length>1?arguments[1]:void 0)};Rr({target:"Array",proto:!0,forced:[].forEach!=Ru},{forEach:Ru});var wu=Us("Array").forEach,Cu=vn,Ou=Ye,Du=ae,xu=wu,Nu=Array.prototype,Pu={DOMTokenList:!0,NodeList:!0},Mu=function(e){var t=e.forEach;return e===Nu||Du(Nu,e)&&t===Nu.forEach||Ou(Pu,Cu(e))?xu:t},Lu=oe,Uu=zn,Vu=ui,Fu=tr,Bu=b([].concat),ju=Lu("Reflect","ownKeys")||function(e){var t=Uu.f(Fu(e)),r=Vu.f;return r?Bu(t,r(e)):t},Gu=ju,Hu=Q,zu=R,Ku=Jn;Rr({target:"Object",stat:!0,sham:!w},{getOwnPropertyDescriptors:function(e){for(var t,r,n=Hu(e),i=zu.f,o=Gu(n),a={},s=0;o.length>s;)void 0!==(r=i(n,t=o[s++]))&&Ku(a,t,r);return a}});var Xu=ee.Object.getOwnPropertyDescriptors,qu={exports:{}},Wu=Rr,Yu=w,Qu=yn.f;Wu({target:"Object",stat:!0,forced:Object.defineProperties!==Qu,sham:!Yu},{defineProperties:Qu});var Ju=ee.Object,Zu=qu.exports=function(e,t){return Ju.defineProperties(e,t)};Ju.defineProperties.sham&&(Zu.sham=!0);var $u=qu.exports,ed={exports:{}},td=Rr,rd=w,nd=Qt.f;td({target:"Object",stat:!0,forced:Object.defineProperty!==nd,sham:!rd},{defineProperty:nd});var id=ee.Object,od=ed.exports=function(e,t,r){return id.defineProperty(e,t,r)};id.defineProperty.sham&&(od.sham=!0);var ad=ed.exports;function sd(e,t,r){return t in e?ad(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function cd(e,t){var r=an(e);if(Os){var n=Os(e);t&&(n=Gs(n).call(n,(function(t){return tc(e,t).enumerable}))),r.push.apply(r,n)}return r}function ud(e){for(var t=1;t<arguments.length;t++){var r,n,i=null!=arguments[t]?arguments[t]:{};t%2?Mu(r=cd(Object(i),!0)).call(r,(function(t){sd(e,t,i[t])})):Xu?$u(e,Xu(i)):Mu(n=cd(Object(i))).call(n,(function(t){ad(e,t,tc(i,t))}))}return e}var dd=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}(dd||{}),ld=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}(ld||{}),hd=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}(hd||{}),fd=function(e){return e[e.CHANNEL_PROFILE_COMMUNICATION=0]="CHANNEL_PROFILE_COMMUNICATION",e[e.CHANNEL_PROFILE_LIVE_BROADCASTING=1]="CHANNEL_PROFILE_LIVE_BROADCASTING",e}(fd||{}),pd=function(e){return e[e.AUTO_SUBSCRIBE_MODE=0]="AUTO_SUBSCRIBE_MODE",e[e.MANUAL_SUBSCRIBE_MODE=1]="MANUAL_SUBSCRIBE_MODE",e}(pd||{}),vd=function(e){return e[e.SUBSCRIBE_SUCC=0]="SUBSCRIBE_SUCC",e[e.SUBSCRIBE_FAIL=1]="SUBSCRIBE_FAIL",e}(vd||{}),_d=function(e){return e[e.PUBLISH_SUCC=0]="PUBLISH_SUCC",e[e.PUBLISH_FAIL=1]="PUBLISH_FAIL",e}(_d||{}),md=function(e){return e[e.MIRROR_MODE_OFF=0]="MIRROR_MODE_OFF",e[e.MIRROR_MODE_ON=1]="MIRROR_MODE_ON",e}(md||{}),gd=function(e){return e[e.RENDER_MODE_HIDDEN=0]="RENDER_MODE_HIDDEN",e[e.RENDER_MODE_FIT=1]="RENDER_MODE_FIT",e}(gd||{}),yd=function(e){return e[e.STREAM_INDEX_MAIN=0]="STREAM_INDEX_MAIN",e[e.STREAM_INDEX_SCREEN=1]="STREAM_INDEX_SCREEN",e}(yd||{}),Sd=function(e){return e[e.AUDIO=1]="AUDIO",e[e.VIDEO=2]="VIDEO",e[e.AUDIO_AND_VIDEO=3]="AUDIO_AND_VIDEO",e}(Sd||{}),Ed=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}(Ed||{}),bd=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}(bd||{}),kd=function(e){return e[e.MIRROR_TYPE_NONE=0]="MIRROR_TYPE_NONE",e[e.MIRROR_TYPE_RENDER=1]="MIRROR_TYPE_RENDER",e}(kd||{}),Td=function(e){return e[e.domestic=0]="domestic",e[e.overseas=1]="overseas",e}(Td||{}),Id=function(e){return e[e.OFFLINE=0]="OFFLINE",e[e.ONLINE=1]="ONLINE",e[e.UNREACHABLE=2]="UNREACHABLE",e}(Id||{}),Ad=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}(Ad||{}),Rd=function(e){return e[e.PREV_FRAME=0]="PREV_FRAME",e[e.OTHER_FRAME=1]="OTHER_FRAME",e}(Rd||{}),wd=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}(wd||{}),Cd=function(e){return e[e.LOW=0]="LOW",e[e.MEDIUM=100]="MEDIUM",e[e.HIGH=200]="HIGH",e}(Cd||{}),Od=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}(Od||{}),Dd=function(e){return e[e.Unknown=-1]="Unknown",e[e.SubscribeFallbackByBandwidth=0]="SubscribeFallbackByBandwidth",e[e.SubscribeRecoverByBandwidth=2]="SubscribeRecoverByBandwidth",e}(Dd||{}),xd=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}(xd||{}),Nd=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}(Nd||{}),Pd=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}(Pd||{}),Md=function(e){return e.LC="LC",e.HEv1="HEv1",e.HEv2="HEv2",e}(Md||{}),Ld=function(e){return e.H264="H264",e.H265="H265",e}(Ld||{}),Ud=function(e){return e[e.ASR_ONLY=0]="ASR_ONLY",e[e.ASR_AND_TRANSLATION=1]="ASR_AND_TRANSLATION",e}(Ud||{}),Vd=function(e){return e[e.STARTED=0]="STARTED",e[e.STOPPED=1]="STOPPED",e[e.ERROR=2]="ERROR",e}(Vd||{}),Fd=function(e){return e.AUTO="auto",e.FORCE_TCP="forceTCP",e.FORCE_UDP="forceUDP",e}(Fd||{}),Bd=Object.freeze(Object.defineProperty({__proto__:null,VideoSourceType:dd,AudioSourceType:ld,UserOfflineReason:hd,ChannelProfile:fd,SubscribeMode:pd,SubscribeState:vd,PublishState:_d,MirrorMode:md,VideoRenderMode:gd,StreamIndex:yd,MediaType:Sd,StreamRemoveReason:Ed,ConnectionState:bd,MirrorType:kd,LogChannel:Td,USER_ONLINE_STATUS:Id,PublicStreamType:Ad,PublicInterpolationMode:Rd,SubscribeFallbackOption:wd,RemoteUserPriority:Cd,NetworkQuality:Od,FallbackOrRecoverReason:Dd,RoomProfileType:xd,AudioProfileType:Nd,RTCAutoPlayPolicy:Pd,AAC_PROFILE:Md,TRANSCODING_VIDEO_CODEC:Ld,SUBTITLE_MODE:Ud,SubtitleEventType:Vd,ConnectionMode:Fd},Symbol.toStringTag,{value:"Module"})),jd=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}(jd||{}),Gd=function(e){return e[e.PLAYOUT=0]="PLAYOUT",e[e.PUBLISH=1]="PUBLISH",e[e.PLAYOUT_AND_PUBLISH=2]="PLAYOUT_AND_PUBLISH",e}(Gd||{}),Hd=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}(Hd||{}),zd=Object.freeze(Object.defineProperty({__proto__:null,AudioMixingDualMonoMode:jd,AudioMixingType:Gd,AudioMixingState:Hd},Symbol.toStringTag,{value:"Module"})),Kd=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.onRemoteVideoFirstFrame="onRemoteVideoFirstFrame",e.onAudioFirstFrameDecoded="onAudioFirstFrameDecoded",e.onRemoteAudioFirstFrame="onRemoteAudioFirstFrame",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.onSubtitleStateChanged="onSubtitleStateChanged",e.onSubtitleMessageReceived="onSubtitleMessageReceived",e.onServerParamsSetResult="onServerParamsSetResult",e}(Kd||{});function Xd(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),ad(e,n.key,n)}}function qd(e,t,r){return t&&Xd(e.prototype,t),r&&Xd(e,r),ad(e,"prototype",{writable:!1}),e}function Wd(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var Yd=TypeError,Qd=function(e){if(e>9007199254740991)throw Yd("Maximum allowed index exceeded");return e},Jd=Rr,Zd=i,$d=eo,el=$,tl=Xe,rl=Br,nl=Qd,il=Jn,ol=Ao,al=Ps,sl=pe,cl=lt("isConcatSpreadable"),ul=sl>=51||!Zd((function(){var e=[];return e[cl]=!1,e.concat()[0]!==e})),dl=al("concat"),ll=function(e){if(!el(e))return!1;var t=e[cl];return void 0!==t?!!t:$d(e)};Jd({target:"Array",proto:!0,arity:1,forced:!ul||!dl},{concat:function(e){var t,r,n,i,o,a=tl(this),s=ol(a,0),c=0;for(t=-1,n=arguments.length;t<n;t++)if(ll(o=-1===t?a:arguments[t]))for(i=rl(o),nl(c+i),r=0;r<i;r++,c++)r in o&&il(s,c,o[r]);else nl(c+1),il(s,c++,o);return s.length=c,s}}),Ei("asyncIterator"),Ei("hasInstance"),Ei("isConcatSpreadable"),Ei("iterator"),Ei("match"),Ei("matchAll"),Ei("replace"),Ei("search"),Ei("species"),Ei("split");var hl=Ai;Ei("toPrimitive"),hl();var fl=oe,pl=Mi;Ei("toStringTag"),pl(fl("Symbol"),"Symbol"),Ei("unscopables"),Mi(n.JSON,"JSON",!0);var vl=ee.Symbol;Ei("asyncDispose"),Ei("dispose"),Ei("matcher"),Ei("metadataKey"),Ei("observable"),Ei("metadata"),Ei("patternMatch"),Ei("replaceAll");var _l=vl,ml=b,gl=Dr,yl=gn,Sl=q,El=ml("".charAt),bl=ml("".charCodeAt),kl=ml("".slice),Tl=function(e){return function(t,r){var n,i,o=yl(Sl(t)),a=gl(r),s=o.length;return a<0||a>=s?e?"":void 0:(n=bl(o,a))<55296||n>56319||a+1===s||(i=bl(o,a+1))<56320||i>57343?e?El(o,a):n:e?kl(o,a,a+2):i-56320+(n-55296<<10)+65536}},Il={codeAt:Tl(!1),charAt:Tl(!0)},Al=Il.charAt,Rl=gn,wl=Zi,Cl=iu,Ol=ou,Dl="String Iterator",xl=wl.set,Nl=wl.getterFor(Dl);Cl(String,"String",(function(e){xl(this,{type:Dl,string:Rl(e),index:0})}),(function(){var e,t=Nl(this),r=t.string,n=t.index;return n>=r.length?Ol(void 0,!0):(e=Al(r,n),t.index+=e.length,Ol(e,!1))}));var Pl=hi.f("iterator");function Ml(e){return(Ml="function"==typeof _l&&"symbol"==typeof Pl?function(e){return typeof e}:function(e){return e&&"function"==typeof _l&&e.constructor===_l&&e!==_l.prototype?"symbol":typeof e})(e)}Rr({target:"Object",stat:!0,sham:!w},{create:Hn});var Ll=ee.Object,Ul=function(e,t){return Ll.create(e,t)},Vl=Xe,Fl=mc,Bl=uc;Rr({target:"Object",stat:!0,forced:i((function(){Fl(1)})),sham:!Bl},{getPrototypeOf:function(e){return Fl(Vl(e))}});var jl=ee.Object.getPrototypeOf;Rr({target:"Object",stat:!0},{setPrototypeOf:jc});var Gl=ee.Object.setPrototypeOf,Hl=Ye,zl=ju,Kl=R,Xl=Qt,ql=Error,Wl=b("".replace),Yl=String(ql("zxcasd").stack),Ql=/\n\s*at [^:]*:[^\n]*/,Jl=Ql.test(Yl),Zl=$,$l=vr,eh=rc,th=lt("iterator"),rh=Array.prototype,nh=function(e){return void 0!==e&&(eh.Array===e||rh[th]===e)},ih=vn,oh=xe,ah=z,sh=rc,ch=lt("iterator"),uh=function(e){if(!ah(e))return oh(e,ch)||oh(e,"@@iterator")||sh[ih(e)]},dh=D,lh=Ce,hh=tr,fh=Ie,ph=uh,vh=TypeError,_h=function(e,t){var r=arguments.length<2?ph(e):t;if(lh(r))return hh(dh(r,e));throw vh(fh(e)+" is not iterable")},mh=D,gh=tr,yh=xe,Sh=function(e,t,r){var n,i;gh(e);try{if(!(n=yh(e,"return"))){if("throw"===t)throw r;return r}n=mh(n,e)}catch(o){i=!0,n=o}if("throw"===t)throw r;if(i)throw n;return gh(n),r},Eh=Yt,bh=D,kh=tr,Th=Ie,Ih=nh,Ah=Br,Rh=ae,wh=_h,Ch=uh,Oh=Sh,Dh=TypeError,xh=function(e,t){this.stopped=e,this.result=t},Nh=xh.prototype,Ph=function(e,t,r){var n,i,o,a,s,c,u,d=r&&r.that,l=!(!r||!r.AS_ENTRIES),h=!(!r||!r.IS_RECORD),f=!(!r||!r.IS_ITERATOR),p=!(!r||!r.INTERRUPTED),v=Eh(t,d),_=function(e){return n&&Oh(n,"normal",e),new xh(!0,e)},m=function(e){return l?(kh(e),p?v(e[0],e[1],_):v(e[0],e[1])):p?v(e,_):v(e)};if(h)n=e.iterator;else if(f)n=e;else{if(!(i=Ch(e)))throw Dh(Th(e)+" is not iterable");if(Ih(i)){for(o=0,a=Ah(e);a>o;o++)if((s=m(e[o]))&&Rh(Nh,s))return s;return new xh(!1)}n=wh(e,i)}for(c=h?e.next:n.next;!(u=bh(c,n)).done;){try{s=m(u.value)}catch(g){Oh(n,"throw",g)}if("object"==typeof s&&s&&Rh(Nh,s))return s}return new xh(!1)},Mh=gn,Lh=V,Uh=!i((function(){var e=Error("a");return!("stack"in e)||(Object.defineProperty(e,"stack",Lh(1,7)),7!==e.stack)})),Vh=Rr,Fh=ae,Bh=mc,jh=jc,Gh=function(e,t,r){for(var n=zl(t),i=Xl.f,o=Kl.f,a=0;a<n.length;a++){var s=n[a];Hl(e,s)||r&&Hl(r,s)||i(e,s,o(t,s))}},Hh=Hn,zh=vr,Kh=V,Xh=function(e,t){if(Jl&&"string"==typeof e&&!ql.prepareStackTrace)for(;t--;)e=Wl(e,Ql,"");return e},qh=function(e,t){Zl(t)&&"cause"in t&&$l(e,"cause",t.cause)},Wh=Ph,Yh=function(e,t){return void 0===e?arguments.length<2?"":t:Mh(e)},Qh=Uh,Jh=lt("toStringTag"),Zh=Error,$h=[].push,ef=function(e,t){var r,n=arguments.length>2?arguments[2]:void 0,i=Fh(tf,this);jh?r=jh(Zh(),i?Bh(this):tf):(r=i?this:Hh(tf),zh(r,Jh,"Error")),void 0!==t&&zh(r,"message",Yh(t)),Qh&&zh(r,"stack",Xh(r.stack,1)),qh(r,n);var o=[];return Wh(e,$h,{that:o}),zh(r,"errors",o),r};jh?jh(ef,Zh):Gh(ef,Zh,{name:!0});var tf=ef.prototype=Hh(Zh.prototype,{constructor:Kh(1,ef),message:Kh(1,""),name:Kh(1,"AggregateError")});Vh({global:!0,constructor:!0,arity:2},{AggregateError:ef});var rf,nf,of,af,sf="process"==y(n.process),cf=oe,uf=Qt,df=w,lf=lt("species"),hf=function(e){var t=cf(e),r=uf.f;df&&t&&!t[lf]&&r(t,lf,{configurable:!0,get:function(){return this}})},ff=ae,pf=TypeError,vf=function(e,t){if(ff(t,e))return e;throw pf("Incorrect invocation")},_f=yo,mf=Ie,gf=TypeError,yf=function(e){if(_f(e))return e;throw gf(mf(e)+" is not a constructor")},Sf=tr,Ef=yf,bf=z,kf=lt("species"),Tf=function(e,t){var r,n=Sf(e).constructor;return void 0===n||bf(r=Sf(n)[kf])?t:Ef(r)},If=TypeError,Af=function(e,t){if(e<t)throw If("Not enough arguments");return e},Rf=/(?:ipad|iphone|ipod).*applewebkit/i.test(se),wf=n,Cf=d,Of=Yt,Df=A,xf=Ye,Nf=i,Pf=Rn,Mf=rs,Lf=It,Uf=Af,Vf=Rf,Ff=sf,Bf=wf.setImmediate,jf=wf.clearImmediate,Gf=wf.process,Hf=wf.Dispatch,zf=wf.Function,Kf=wf.MessageChannel,Xf=wf.String,qf=0,Wf={},Yf="onreadystatechange";try{rf=wf.location}catch(EW){}var Qf=function(e){if(xf(Wf,e)){var t=Wf[e];delete Wf[e],t()}},Jf=function(e){return function(){Qf(e)}},Zf=function(e){Qf(e.data)},$f=function(e){wf.postMessage(Xf(e),rf.protocol+"//"+rf.host)};Bf&&jf||(Bf=function(e){Uf(arguments.length,1);var t=Df(e)?e:zf(e),r=Mf(arguments,1);return Wf[++qf]=function(){Cf(t,void 0,r)},nf(qf),qf},jf=function(e){delete Wf[e]},Ff?nf=function(e){Gf.nextTick(Jf(e))}:Hf&&Hf.now?nf=function(e){Hf.now(Jf(e))}:Kf&&!Vf?(af=(of=new Kf).port2,of.port1.onmessage=Zf,nf=Of(af.postMessage,af)):wf.addEventListener&&Df(wf.postMessage)&&!wf.importScripts&&rf&&"file:"!==rf.protocol&&!Nf($f)?(nf=$f,wf.addEventListener("message",Zf,!1)):nf=Yf in Lf("script")?function(e){Pf.appendChild(Lf("script")).onreadystatechange=function(){Pf.removeChild(this),Qf(e)}}:function(e){setTimeout(Jf(e),0)});var ep,tp,rp,np,ip,op,ap,sp,cp={set:Bf,clear:jf},up=n,dp=/ipad|iphone|ipod/i.test(se)&&void 0!==up.Pebble,lp=/web0s(?!.*chrome)/i.test(se),hp=n,fp=Yt,pp=R.f,vp=cp.set,_p=Rf,mp=dp,gp=lp,yp=sf,Sp=hp.MutationObserver||hp.WebKitMutationObserver,Ep=hp.document,bp=hp.process,kp=hp.Promise,Tp=pp(hp,"queueMicrotask"),Ip=Tp&&Tp.value;Ip||(ep=function(){var e,t;for(yp&&(e=bp.domain)&&e.exit();tp;){t=tp.fn,tp=tp.next;try{t()}catch(EW){throw tp?np():rp=void 0,EW}}rp=void 0,e&&e.enter()},_p||yp||gp||!Sp||!Ep?!mp&&kp&&kp.resolve?((ap=kp.resolve(void 0)).constructor=kp,sp=fp(ap.then,ap),np=function(){sp(ep)}):yp?np=function(){bp.nextTick(ep)}:(vp=fp(vp,hp),np=function(){vp(ep)}):(ip=!0,op=Ep.createTextNode(""),new Sp(ep).observe(op,{characterData:!0}),np=function(){op.data=ip=!ip}));var Ap=Ip||function(e){var t={fn:e,next:void 0};rp&&(rp.next=t),tp||(tp=t,np()),rp=t},Rp=n,wp=function(e){try{return{error:!1,value:e()}}catch(EW){return{error:!0,value:EW}}},Cp=function(){this.head=null,this.tail=null};Cp.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 Op=Cp,Dp=n.Promise,xp="object"==typeof Deno&&Deno&&"object"==typeof Deno.version,Np=!xp&&!sf&&"object"==typeof window&&"object"==typeof document,Pp=n,Mp=Dp,Lp=A,Up=Kt,Vp=io,Fp=lt,Bp=Np,jp=xp,Gp=pe,Hp=Mp&&Mp.prototype,zp=Fp("species"),Kp=!1,Xp=Lp(Pp.PromiseRejectionEvent),qp={CONSTRUCTOR:Up("Promise",(function(){var e=Vp(Mp),t=e!==String(Mp);if(!t&&66===Gp)return!0;if(!Hp.catch||!Hp.finally)return!0;if(!Gp||Gp<51||!/native code/.test(e)){var r=new Mp((function(e){e(1)})),n=function(e){e((function(){}),(function(){}))};if((r.constructor={})[zp]=n,!(Kp=r.then((function(){}))instanceof n))return!0}return!t&&(Bp||jp)&&!Xp})),REJECTION_EVENT:Xp,SUBCLASSING:Kp},Wp={},Yp=Ce,Qp=TypeError,Jp=function(e){var t,r;this.promise=new e((function(e,n){if(void 0!==t||void 0!==r)throw Qp("Bad Promise constructor");t=e,r=n})),this.resolve=Yp(t),this.reject=Yp(r)};Wp.f=function(e){return new Jp(e)};var Zp,$p,ev=Rr,tv=sf,rv=n,nv=D,iv=li,ov=Mi,av=hf,sv=Ce,cv=A,uv=$,dv=vf,lv=Tf,hv=cp.set,fv=Ap,pv=function(e,t){var r=Rp.console;r&&r.error&&(1==arguments.length?r.error(e):r.error(e,t))},vv=wp,_v=Op,mv=Zi,gv=Dp,yv=qp,Sv=Wp,Ev="Promise",bv=yv.CONSTRUCTOR,kv=yv.REJECTION_EVENT,Tv=mv.getterFor(Ev),Iv=mv.set,Av=gv&&gv.prototype,Rv=gv,wv=Av,Cv=rv.TypeError,Ov=rv.document,Dv=rv.process,xv=Sv.f,Nv=xv,Pv=!!(Ov&&Ov.createEvent&&rv.dispatchEvent),Mv="unhandledrejection",Lv=function(e){var t;return!(!uv(e)||!cv(t=e.then))&&t},Uv=function(e,t){var r,n,i,o=t.value,a=1==t.state,s=a?e.ok:e.fail,c=e.resolve,u=e.reject,d=e.domain;try{s?(a||(2===t.rejection&&Gv(t),t.rejection=1),!0===s?r=o:(d&&d.enter(),r=s(o),d&&(d.exit(),i=!0)),r===e.promise?u(Cv("Promise-chain cycle")):(n=Lv(r))?nv(n,r,c,u):c(r)):u(o)}catch(EW){d&&!i&&d.exit(),u(EW)}},Vv=function(e,t){e.notified||(e.notified=!0,fv((function(){for(var r,n=e.reactions;r=n.get();)Uv(r,e);e.notified=!1,t&&!e.rejection&&Bv(e)})))},Fv=function(e,t,r){var n,i;Pv?((n=Ov.createEvent("Event")).promise=t,n.reason=r,n.initEvent(e,!1,!0),rv.dispatchEvent(n)):n={promise:t,reason:r},!kv&&(i=rv["on"+e])?i(n):e===Mv&&pv("Unhandled promise rejection",r)},Bv=function(e){nv(hv,rv,(function(){var t,r=e.facade,n=e.value;if(jv(e)&&(t=vv((function(){tv?Dv.emit("unhandledRejection",n,r):Fv(Mv,r,n)})),e.rejection=tv||jv(e)?2:1,t.error))throw t.value}))},jv=function(e){return 1!==e.rejection&&!e.parent},Gv=function(e){nv(hv,rv,(function(){var t=e.facade;tv?Dv.emit("rejectionHandled",t):Fv("rejectionhandled",t,e.value)}))},Hv=function(e,t,r){return function(n){e(t,n,r)}},zv=function(e,t,r){e.done||(e.done=!0,r&&(e=r),e.value=t,e.state=2,Vv(e,!0))},Kv=function(e,t,r){if(!e.done){e.done=!0,r&&(e=r);try{if(e.facade===t)throw Cv("Promise can't be resolved itself");var n=Lv(t);n?fv((function(){var r={done:!1};try{nv(n,t,Hv(Kv,r,e),Hv(zv,r,e))}catch(EW){zv(r,EW,e)}})):(e.value=t,e.state=1,Vv(e,!1))}catch(EW){zv({done:!1},EW,e)}}};bv&&(wv=(Rv=function(e){dv(this,wv),sv(e),nv(Zp,this);var t=Tv(this);try{e(Hv(Kv,t),Hv(zv,t))}catch(EW){zv(t,EW)}}).prototype,(Zp=function(e){Iv(this,{type:Ev,done:!1,notified:!1,parent:!1,reactions:new _v,rejection:!1,state:0,value:void 0})}).prototype=iv(wv,"then",(function(e,t){var r=Tv(this),n=xv(lv(this,Rv));return r.parent=!0,n.ok=!cv(e)||e,n.fail=cv(t)&&t,n.domain=tv?Dv.domain:void 0,0==r.state?r.reactions.add(n):fv((function(){Uv(n,r)})),n.promise})),$p=function(){var e=new Zp,t=Tv(e);this.promise=e,this.resolve=Hv(Kv,t),this.reject=Hv(zv,t)},Sv.f=xv=function(e){return e===Rv||undefined===e?new $p(e):Nv(e)}),ev({global:!0,constructor:!0,wrap:!0,forced:bv},{Promise:Rv}),ov(Rv,Ev,!1,!0),av(Ev);var Xv=lt("iterator"),qv=!1;try{var Wv=0,Yv={next:function(){return{done:!!Wv++}},return:function(){qv=!0}};Yv[Xv]=function(){return this},Array.from(Yv,(function(){throw 2}))}catch(EW){}var Qv=function(e,t){if(!t&&!qv)return!1;var r=!1;try{var n={};n[Xv]=function(){return{next:function(){return{done:r=!0}}}},e(n)}catch(EW){}return r},Jv=Dp,Zv=qp.CONSTRUCTOR||!Qv((function(e){Jv.all(e).then(void 0,(function(){}))})),$v=D,e_=Ce,t_=Wp,r_=wp,n_=Ph;Rr({target:"Promise",stat:!0,forced:Zv},{all:function(e){var t=this,r=t_.f(t),n=r.resolve,i=r.reject,o=r_((function(){var r=e_(t.resolve),o=[],a=0,s=1;n_(e,(function(e){var c=a++,u=!1;s++,$v(r,t,e).then((function(e){u||(u=!0,o[c]=e,--s||n(o))}),i)})),--s||n(o)}));return o.error&&i(o.value),r.promise}});var i_=Rr,o_=qp.CONSTRUCTOR;Dp&&Dp.prototype,i_({target:"Promise",proto:!0,forced:o_,real:!0},{catch:function(e){return this.then(void 0,e)}});var a_=D,s_=Ce,c_=Wp,u_=wp,d_=Ph;Rr({target:"Promise",stat:!0,forced:Zv},{race:function(e){var t=this,r=c_.f(t),n=r.reject,i=u_((function(){var i=s_(t.resolve);d_(e,(function(e){a_(i,t,e).then(r.resolve,n)}))}));return i.error&&n(i.value),r.promise}});var l_=D,h_=Wp;Rr({target:"Promise",stat:!0,forced:qp.CONSTRUCTOR},{reject:function(e){var t=h_.f(this);return l_(t.reject,void 0,e),t.promise}});var f_=tr,p_=$,v_=Wp,__=function(e,t){if(f_(e),p_(t)&&t.constructor===e)return t;var r=v_.f(e);return(0,r.resolve)(t),r.promise},m_=Rr,g_=Dp,y_=qp.CONSTRUCTOR,S_=__,E_=oe("Promise"),b_=!y_;m_({target:"Promise",stat:!0,forced:true},{resolve:function(e){return S_(b_&&this===E_?g_:this,e)}});var k_=D,T_=Ce,I_=Wp,A_=wp,R_=Ph;Rr({target:"Promise",stat:!0},{allSettled:function(e){var t=this,r=I_.f(t),n=r.resolve,i=r.reject,o=A_((function(){var r=T_(t.resolve),i=[],o=0,a=1;R_(e,(function(e){var s=o++,c=!1;a++,k_(r,t,e).then((function(e){c||(c=!0,i[s]={status:"fulfilled",value:e},--a||n(i))}),(function(e){c||(c=!0,i[s]={status:"rejected",reason:e},--a||n(i))}))})),--a||n(i)}));return o.error&&i(o.value),r.promise}});var w_=D,C_=Ce,O_=oe,D_=Wp,x_=wp,N_=Ph,P_="No one promise resolved";Rr({target:"Promise",stat:!0},{any:function(e){var t=this,r=O_("AggregateError"),n=D_.f(t),i=n.resolve,o=n.reject,a=x_((function(){var n=C_(t.resolve),a=[],s=0,c=1,u=!1;N_(e,(function(e){var d=s++,l=!1;c++,w_(n,t,e).then((function(e){l||u||(u=!0,i(e))}),(function(e){l||u||(l=!0,a[d]=e,--c||o(new r(a,P_)))}))})),--c||o(new r(a,P_))}));return a.error&&o(a.value),n.promise}});var M_=Rr,L_=Dp,U_=i,V_=oe,F_=A,B_=Tf,j_=__,G_=L_&&L_.prototype;M_({target:"Promise",proto:!0,real:!0,forced:!!L_&&U_((function(){G_.finally.call({then:function(){}},(function(){}))}))},{finally:function(e){var t=B_(this,V_("Promise")),r=F_(e);return this.then(r?function(r){return j_(t,e()).then((function(){return r}))}:e,r?function(r){return j_(t,e()).then((function(){throw r}))}:e)}});var H_=ee.Promise,z_=Wp,K_=wp;Rr({target:"Promise",stat:!0,forced:!0},{try:function(e){var t=z_.f(this),r=K_(e);return(r.error?t.reject:t.resolve)(r.value),t.promise}});var X_=H_,q_=Rr,W_=eo,Y_=b([].reverse),Q_=[1,2];q_({target:"Array",proto:!0,forced:String(Q_)===String(Q_.reverse())},{reverse:function(){return W_(this)&&(this.length=this.length),Y_(this)}});var J_=Us("Array").reverse,Z_=ae,$_=J_,em=Array.prototype,tm=function(e){var t=e.reverse;return e===em||Z_(em,e)&&t===em.reverse?$_:t},rm=Rr,nm=eo,im=yo,om=$,am=Mr,sm=Br,cm=Q,um=Jn,dm=lt,lm=rs,hm=Ps("slice"),fm=dm("species"),pm=Array,vm=Math.max;rm({target:"Array",proto:!0,forced:!hm},{slice:function(e,t){var r,n,i,o=cm(this),a=sm(o),s=am(e,a),c=am(void 0===t?a:t,a);if(nm(o)&&(r=o.constructor,(im(r)&&(r===pm||nm(r.prototype))||om(r)&&null===(r=r[fm]))&&(r=void 0),r===pm||void 0===r))return lm(o,s,c);for(n=new(void 0===r?pm:r)(vm(c-s,0)),i=0;s<c;s++,i++)s in o&&um(n,i,o[s]);return n.length=i,n}});var _m=Us("Array").slice,mm=ae,gm=_m,ym=Array.prototype,Sm=function(e){var t=e.slice;return e===ym||mm(ym,e)&&t===ym.slice?gm:t};function Em(){Em=function(){return e};var e={},t=Object.prototype,r=t.hasOwnProperty,n=ad||function(e,t,r){e[t]=r.value},i="function"==typeof _l?_l:{},o=i.iterator||"@@iterator",a=i.asyncIterator||"@@asyncIterator",s=i.toStringTag||"@@toStringTag";function c(e,t,r){return ad(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{c({},"")}catch(R){c=function(e,t,r){return e[t]=r}}function u(e,t,r,i){var o=t&&t.prototype instanceof h?t:h,a=Ul(o.prototype),s=new T(i||[]);return n(a,"_invoke",{value:S(e,r,s)}),a}function d(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(R){return{type:"throw",arg:R}}}e.wrap=u;var l={};function h(){}function f(){}function p(){}var v={};c(v,o,(function(){return this}));var _=jl&&jl(jl(I([])));_&&_!==t&&r.call(_,o)&&(v=_);var m=p.prototype=h.prototype=Ul(v);function g(e){var t;Mu(t=["next","throw","return"]).call(t,(function(t){c(e,t,(function(e){return this._invoke(t,e)}))}))}function y(e,t){function i(n,o,a,s){var c=d(e[n],e,o);if("throw"!==c.type){var u=c.arg,l=u.value;return l&&"object"==Ml(l)&&r.call(l,"__await")?t.resolve(l.__await).then((function(e){i("next",e,a,s)}),(function(e){i("throw",e,a,s)})):t.resolve(l).then((function(e){u.value=e,a(u)}),(function(e){return i("throw",e,a,s)}))}s(c.arg)}var o;n(this,"_invoke",{value:function(e,r){function n(){return new t((function(t,n){i(e,r,t,n)}))}return o=o?o.then(n,n):n()}})}function S(e,t,r){var n="suspendedStart";return function(i,o){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===i)throw o;return{value:void 0,done:!0}}for(r.method=i,r.arg=o;;){var a=r.delegate;if(a){var s=E(a,r);if(s){if(s===l)continue;return s}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var c=d(e,t,r);if("normal"===c.type){if(n=r.done?"completed":"suspendedYield",c.arg===l)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(n="completed",r.method="throw",r.arg=c.arg)}}}function E(e,t){var r=e.iterator[t.method];if(void 0===r){if(t.delegate=null,"throw"===t.method){if(e.iterator.return&&(t.method="return",t.arg=void 0,E(e,t),"throw"===t.method))return l;t.method="throw",t.arg=new TypeError("The iterator does not provide a 'throw' method")}return l}var n=d(r,e.iterator,t.arg);if("throw"===n.type)return t.method="throw",t.arg=n.arg,t.delegate=null,l;var i=n.arg;return i?i.done?(t[e.resultName]=i.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,l):i:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,l)}function b(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 k(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function T(e){this.tryEntries=[{tryLoc:"root"}],Mu(e).call(e,b,this),this.reset(!0)}function I(e){if(e){var t=e[o];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var n=-1,i=function t(){for(;++n<e.length;)if(r.call(e,n))return t.value=e[n],t.done=!1,t;return t.value=void 0,t.done=!0,t};return i.next=i}}return{next:A}}function A(){return{value:void 0,done:!0}}return f.prototype=p,n(m,"constructor",{value:p,configurable:!0}),n(p,"constructor",{value:f,configurable:!0}),f.displayName=c(p,s,"GeneratorFunction"),e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===f||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Gl?Gl(e,p):(e.__proto__=p,c(e,s,"GeneratorFunction")),e.prototype=Ul(m),e},e.awrap=function(e){return{__await:e}},g(y.prototype),c(y.prototype,a,(function(){return this})),e.AsyncIterator=y,e.async=function(t,r,n,i,o){void 0===o&&(o=X_);var a=new y(u(t,r,n,i),o);return e.isGeneratorFunction(r)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},g(m),c(m,s,"Generator"),c(m,o,(function(){return this})),c(m,"toString",(function(){return"[object Generator]"})),e.keys=function(e){var t=Object(e),r=[];for(var n in t)r.push(n);return tm(r).call(r),function e(){for(;r.length;){var n=r.pop();if(n in t)return e.value=n,e.done=!1,e}return e.done=!0,e}},e.values=I,T.prototype={constructor:T,reset:function(e){var t;if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,Mu(t=this.tryEntries).call(t,k),!e)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+Sm(n).call(n,1))&&(this[n]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function n(r,n){return a.type="throw",a.arg=e,t.next=r,n&&(t.method="next",t.arg=void 0),!!n}for(var i=this.tryEntries.length-1;i>=0;--i){var o=this.tryEntries[i],a=o.completion;if("root"===o.tryLoc)return n("end");if(o.tryLoc<=this.prev){var s=r.call(o,"catchLoc"),c=r.call(o,"finallyLoc");if(s&&c){if(this.prev<o.catchLoc)return n(o.catchLoc,!0);if(this.prev<o.finallyLoc)return n(o.finallyLoc)}else if(s){if(this.prev<o.catchLoc)return n(o.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return n(o.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&r.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var o=i;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var a=o?o.completion:{};return a.type=e,a.arg=t,o?(this.method="next",this.next=o.finallyLoc,l):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),l},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),k(r),l}},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;k(r)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,r){return this.delegate={iterator:I(e),resultName:t,nextLoc:r},"next"===this.method&&(this.arg=void 0),l}},e}function bm(e,t,r,n,i,o,a){try{var s=e[o](a),c=s.value}catch(EW){return void r(EW)}s.done?t(c):X_.resolve(c).then(n,i)}function km(e){return function(){var t=this,r=arguments;return new X_((function(n,i){var o=e.apply(t,r);function a(e){bm(o,n,i,a,s,"next",e)}function s(e){bm(o,n,i,a,s,"throw",e)}a(void 0)}))}}var Tm=Us("Array").concat,Im=ae,Am=Tm,Rm=Array.prototype,wm=function(e){var t=e.concat;return e===Rm||Im(Rm,e)&&t===Rm.concat?Am:t},Cm=Kr.includes;Rr({target:"Array",proto:!0,forced:i((function(){return!Array(1).includes()}))},{includes:function(e){return Cm(this,e,arguments.length>1?arguments[1]:void 0)}});var Om=Us("Array").includes,Dm=$,xm=y,Nm=lt("match"),Pm=function(e){var t;return Dm(e)&&(void 0!==(t=e[Nm])?!!t:"RegExp"==xm(e))},Mm=TypeError,Lm=function(e){if(Pm(e))throw Mm("The method doesn't accept regular expressions");return e},Um=lt("match"),Vm=function(e){var t=/./;try{"/./"[e](t)}catch(r){try{return t[Um]=!1,"/./"[e](t)}catch(EW){}}return!1},Fm=Rr,Bm=Lm,jm=q,Gm=gn,Hm=Vm,zm=b("".indexOf);Fm({target:"String",proto:!0,forced:!Hm("includes")},{includes:function(e){return!!~zm(Gm(jm(this)),Gm(Bm(e)),arguments.length>1?arguments[1]:void 0)}});var Km=Us("String").includes,Xm=ae,qm=Om,Wm=Km,Ym=Array.prototype,Qm=String.prototype,Jm=function(e){var t=e.includes;return e===Ym||Xm(Ym,e)&&t===Ym.includes?qm:"string"==typeof e||e===Qm||Xm(Qm,e)&&t===Qm.includes?Wm:t},Zm=ee,$m=d;Zm.JSON||(Zm.JSON={stringify:JSON.stringify});var eg=function(e,t,r){return $m(Zm.JSON.stringify,null,arguments)},tg=eg,rg=Po.map;Rr({target:"Array",proto:!0,forced:!Ps("map")},{map:function(e){return rg(this,e,arguments.length>1?arguments[1]:void 0)}});var ng=Us("Array").map,ig=ae,og=ng,ag=Array.prototype,sg=function(e){var t=e.map;return e===ag||ig(ag,e)&&t===ag.map?og:t},cg="\t\n\v\f\r                 \u2028\u2029\ufeff",ug=q,dg=gn,lg=b("".replace),hg="[\t\n\v\f\r                 \u2028\u2029\ufeff]",fg=RegExp("^"+hg+hg+"*"),pg=RegExp(hg+hg+"*$"),vg=function(e){return function(t){var r=dg(ug(t));return 1&e&&(r=lg(r,fg,"")),2&e&&(r=lg(r,pg,"")),r}},_g={start:vg(1),end:vg(2),trim:vg(3)},mg=n,gg=i,yg=b,Sg=gn,Eg=_g.trim,bg=cg,kg=mg.parseInt,Tg=mg.Symbol,Ig=Tg&&Tg.iterator,Ag=/^[+-]?0x/i,Rg=yg(Ag.exec),wg=8!==kg(bg+"08")||22!==kg(bg+"0x16")||Ig&&!gg((function(){kg(Object(Ig))}))?function(e,t){var r=Eg(Sg(e));return kg(r,t>>>0||(Rg(Ag,r)?16:10))}:kg;Rr({global:!0,forced:parseInt!=wg},{parseInt:wg});var Cg=ee.parseInt,Og={exports:{}},Dg=i((function(){if("function"==typeof ArrayBuffer){var e=new ArrayBuffer(8);Object.isExtensible(e)&&Object.defineProperty(e,"a",{value:8})}})),xg=i,Ng=$,Pg=y,Mg=Dg,Lg=Object.isExtensible,Ug=xg((function(){Lg(1)}))||Mg?function(e){return!!Ng(e)&&((!Mg||"ArrayBuffer"!=Pg(e))&&(!Lg||Lg(e)))}:Lg,Vg=!i((function(){return Object.isExtensible(Object.preventExtensions({}))})),Fg=Rr,Bg=b,jg=Xr,Gg=$,Hg=Ye,zg=Qt.f,Kg=zn,Xg=qn,qg=Ug,Wg=Vg,Yg=!1,Qg=et("meta"),Jg=0,Zg=function(e){zg(e,Qg,{value:{objectID:"O"+Jg++,weakData:{}}})},$g=Og.exports={enable:function(){$g.enable=function(){},Yg=!0;var e=Kg.f,t=Bg([].splice),r={};r[Qg]=1,e(r).length&&(Kg.f=function(r){for(var n=e(r),i=0,o=n.length;i<o;i++)if(n[i]===Qg){t(n,i,1);break}return n},Fg({target:"Object",stat:!0,forced:!0},{getOwnPropertyNames:Xg.f}))},fastKey:function(e,t){if(!Gg(e))return"symbol"==typeof e?e:("string"==typeof e?"S":"P")+e;if(!Hg(e,Qg)){if(!qg(e))return"F";if(!t)return"E";Zg(e)}return e[Qg].objectID},getWeakData:function(e,t){if(!Hg(e,Qg)){if(!qg(e))return!0;if(!t)return!1;Zg(e)}return e[Qg].weakData},onFreeze:function(e){return Wg&&Yg&&qg(e)&&!Hg(e,Qg)&&Zg(e),e}};jg[Qg]=!0;var ey=Rr,ty=n,ry=Og.exports,ny=i,iy=vr,oy=Ph,ay=vf,sy=A,cy=$,uy=Mi,dy=Qt.f,ly=Po.forEach,hy=w,fy=Zi.set,py=Zi.getterFor,vy=function(e,t,r){var n,i=-1!==e.indexOf("Map"),o=-1!==e.indexOf("Weak"),a=i?"set":"add",s=ty[e],c=s&&s.prototype,u={};if(hy&&sy(s)&&(o||c.forEach&&!ny((function(){(new s).entries().next()})))){var d=(n=t((function(t,r){fy(ay(t,d),{type:e,collection:new s}),null!=r&&oy(r,t[a],{that:t,AS_ENTRIES:i})}))).prototype,l=py(e);ly(["add","clear","delete","forEach","get","has","set","keys","values","entries"],(function(e){var t="add"==e||"set"==e;!(e in c)||o&&"clear"==e||iy(d,e,(function(r,n){var i=l(this).collection;if(!t&&o&&!cy(r))return"get"==e&&void 0;var a=i[e](0===r?0:r,n);return t?this:a}))})),o||dy(d,"size",{configurable:!0,get:function(){return l(this).collection.size}})}else n=r.getConstructor(t,e,i,a),ry.enable();return uy(n,e,!1,!0),u[e]=n,ey({global:!0,forced:!0},u),o||r.setStrong(n,e,i),n},_y=li,my=function(e,t,r){for(var n in t)r&&r.unsafe&&e[n]?e[n]=t[n]:_y(e,n,t[n],r);return e},gy=Qt.f,yy=Hn,Sy=my,Ey=Yt,by=vf,ky=z,Ty=Ph,Iy=iu,Ay=ou,Ry=hf,wy=w,Cy=Og.exports.fastKey,Oy=Zi.set,Dy=Zi.getterFor,xy={getConstructor:function(e,t,r,n){var i=e((function(e,i){by(e,o),Oy(e,{type:t,index:yy(null),first:void 0,last:void 0,size:0}),wy||(e.size=0),ky(i)||Ty(i,e[n],{that:e,AS_ENTRIES:r})})),o=i.prototype,a=Dy(t),s=function(e,t,r){var n,i,o=a(e),s=c(e,t);return s?s.value=r:(o.last=s={index:i=Cy(t,!0),key:t,value:r,previous:n=o.last,next:void 0,removed:!1},o.first||(o.first=s),n&&(n.next=s),wy?o.size++:e.size++,"F"!==i&&(o.index[i]=s)),e},c=function(e,t){var r,n=a(e),i=Cy(t);if("F"!==i)return n.index[i];for(r=n.first;r;r=r.next)if(r.key==t)return r};return Sy(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,wy?e.size=0:this.size=0},delete:function(e){var t=this,r=a(t),n=c(t,e);if(n){var i=n.next,o=n.previous;delete r.index[n.index],n.removed=!0,o&&(o.next=i),i&&(i.previous=o),r.first==n&&(r.first=i),r.last==n&&(r.last=o),wy?r.size--:t.size--}return!!n},forEach:function(e){for(var t,r=a(this),n=Ey(e,arguments.length>1?arguments[1]:void 0);t=t?t.next:r.first;)for(n(t.value,t.key,this);t&&t.removed;)t=t.previous},has:function(e){return!!c(this,e)}}),Sy(o,r?{get:function(e){var t=c(this,e);return t&&t.value},set:function(e,t){return s(this,0===e?0:e,t)}}:{add:function(e){return s(this,e=0===e?0:e,e)}}),wy&&gy(o,"size",{get:function(){return a(this).size}}),i},setStrong:function(e,t,r){var n=t+" Iterator",i=Dy(t),o=Dy(n);Iy(e,t,(function(e,t){Oy(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)?Ay("keys"==t?r.key:"values"==t?r.value:[r.key,r.value],!1):(e.target=void 0,Ay(void 0,!0))}),r?"entries":"values",!r,!0),Ry(t)}};vy("Map",(function(e){return function(){return e(this,arguments.length?arguments[0]:void 0)}}),xy);var Ny=ee.Map,Py=Yt,My=D,Ly=Ce,Uy=yf,Vy=z,Fy=Ph,By=[].push,jy=function(e){var t,r,n,i,o=arguments.length,a=o>1?arguments[1]:void 0;return Uy(this),(t=void 0!==a)&&Ly(a),Vy(e)?new this:(r=[],t?(n=0,i=Py(a,o>2?arguments[2]:void 0),Fy(e,(function(e){My(By,r,i(e,n++))}))):Fy(e,By,{that:r}),new this(r))};Rr({target:"Map",stat:!0,forced:!0},{from:jy});var Gy=rs,Hy=function(){return new this(Gy(arguments))};Rr({target:"Map",stat:!0,forced:!0},{of:Hy});var zy=D,Ky=Ce,Xy=tr,qy=function(){for(var e,t=Xy(this),r=Ky(t.delete),n=!0,i=0,o=arguments.length;i<o;i++)e=zy(r,t,arguments[i]),n=n&&e;return!!n};Rr({target:"Map",proto:!0,real:!0,forced:!0},{deleteAll:qy});var Wy=D,Yy=Ce,Qy=tr,Jy=function(e,t){var r,n,i=Qy(this),o=Yy(i.get),a=Yy(i.has),s=Yy(i.set);return Wy(a,i,e)?(r=Wy(o,i,e),"update"in t&&(r=t.update(r,e,i),Wy(s,i,e,r)),r):(n=t.insert(e,i),Wy(s,i,e,n),n)};Rr({target:"Map",proto:!0,real:!0,forced:!0},{emplace:Jy});var Zy=_h,$y=tr,eS=Yt,tS=Zy,rS=Ph;Rr({target:"Map",proto:!0,real:!0,forced:!0},{every:function(e){var t=$y(this),r=tS(t),n=eS(e,arguments.length>1?arguments[1]:void 0);return!rS(r,(function(e,r,i){if(!n(r,e,t))return i()}),{AS_ENTRIES:!0,IS_ITERATOR:!0,INTERRUPTED:!0}).stopped}});var nS=oe,iS=Yt,oS=D,aS=Ce,sS=tr,cS=Tf,uS=Zy,dS=Ph;Rr({target:"Map",proto:!0,real:!0,forced:!0},{filter:function(e){var t=sS(this),r=uS(t),n=iS(e,arguments.length>1?arguments[1]:void 0),i=new(cS(t,nS("Map"))),o=aS(i.set);return dS(r,(function(e,r){n(r,e,t)&&oS(o,i,e,r)}),{AS_ENTRIES:!0,IS_ITERATOR:!0}),i}});var lS=tr,hS=Yt,fS=Zy,pS=Ph;Rr({target:"Map",proto:!0,real:!0,forced:!0},{find:function(e){var t=lS(this),r=fS(t),n=hS(e,arguments.length>1?arguments[1]:void 0);return pS(r,(function(e,r,i){if(n(r,e,t))return i(r)}),{AS_ENTRIES:!0,IS_ITERATOR:!0,INTERRUPTED:!0}).result}});var vS=tr,_S=Yt,mS=Zy,gS=Ph;Rr({target:"Map",proto:!0,real:!0,forced:!0},{findKey:function(e){var t=vS(this),r=mS(t),n=_S(e,arguments.length>1?arguments[1]:void 0);return gS(r,(function(e,r,i){if(n(r,e,t))return i(e)}),{AS_ENTRIES:!0,IS_ITERATOR:!0,INTERRUPTED:!0}).result}});var yS=Rr,SS=D,ES=Ce,bS=_h,kS=Ph,TS=b([].push);yS({target:"Map",stat:!0,forced:!0},{groupBy:function(e,t){ES(t);var r=bS(e),n=new this,i=ES(n.has),o=ES(n.get),a=ES(n.set);return kS(r,(function(e){var r=t(e);SS(i,n,r)?TS(SS(o,n,r),e):SS(a,n,r,[e])}),{IS_ITERATOR:!0}),n}});var IS=tr,AS=Zy,RS=function(e,t){return e===t||e!=e&&t!=t},wS=Ph;Rr({target:"Map",proto:!0,real:!0,forced:!0},{includes:function(e){return wS(AS(IS(this)),(function(t,r,n){if(RS(r,e))return n()}),{AS_ENTRIES:!0,IS_ITERATOR:!0,INTERRUPTED:!0}).stopped}});var CS=D,OS=Ph,DS=Ce;Rr({target:"Map",stat:!0,forced:!0},{keyBy:function(e,t){var r=new this;DS(t);var n=DS(r.set);return OS(e,(function(e){CS(n,r,t(e),e)})),r}});var xS=tr,NS=Zy,PS=Ph;Rr({target:"Map",proto:!0,real:!0,forced:!0},{keyOf:function(e){return PS(NS(xS(this)),(function(t,r,n){if(r===e)return n(t)}),{AS_ENTRIES:!0,IS_ITERATOR:!0,INTERRUPTED:!0}).result}});var MS=oe,LS=Yt,US=D,VS=Ce,FS=tr,BS=Tf,jS=Zy,GS=Ph;Rr({target:"Map",proto:!0,real:!0,forced:!0},{mapKeys:function(e){var t=FS(this),r=jS(t),n=LS(e,arguments.length>1?arguments[1]:void 0),i=new(BS(t,MS("Map"))),o=VS(i.set);return GS(r,(function(e,r){US(o,i,n(r,e,t),r)}),{AS_ENTRIES:!0,IS_ITERATOR:!0}),i}});var HS=oe,zS=Yt,KS=D,XS=Ce,qS=tr,WS=Tf,YS=Zy,QS=Ph;Rr({target:"Map",proto:!0,real:!0,forced:!0},{mapValues:function(e){var t=qS(this),r=YS(t),n=zS(e,arguments.length>1?arguments[1]:void 0),i=new(WS(t,HS("Map"))),o=XS(i.set);return QS(r,(function(e,r){KS(o,i,e,n(r,e,t))}),{AS_ENTRIES:!0,IS_ITERATOR:!0}),i}});var JS=Ce,ZS=tr,$S=Ph;Rr({target:"Map",proto:!0,real:!0,arity:1,forced:!0},{merge:function(e){for(var t=ZS(this),r=JS(t.set),n=arguments.length,i=0;i<n;)$S(arguments[i++],r,{that:t,AS_ENTRIES:!0});return t}});var eE=tr,tE=Ce,rE=Zy,nE=Ph,iE=TypeError;Rr({target:"Map",proto:!0,real:!0,forced:!0},{reduce:function(e){var t=eE(this),r=rE(t),n=arguments.length<2,i=n?void 0:arguments[1];if(tE(e),nE(r,(function(r,o){n?(n=!1,i=o):i=e(i,o,r,t)}),{AS_ENTRIES:!0,IS_ITERATOR:!0}),n)throw iE("Reduce of empty map with no initial value");return i}});var oE=tr,aE=Yt,sE=Zy,cE=Ph;Rr({target:"Map",proto:!0,real:!0,forced:!0},{some:function(e){var t=oE(this),r=sE(t),n=aE(e,arguments.length>1?arguments[1]:void 0);return cE(r,(function(e,r,i){if(n(r,e,t))return i()}),{AS_ENTRIES:!0,IS_ITERATOR:!0,INTERRUPTED:!0}).stopped}});var uE=D,dE=tr,lE=Ce,hE=TypeError;Rr({target:"Map",proto:!0,real:!0,forced:!0},{update:function(e,t){var r=dE(this),n=lE(r.get),i=lE(r.has),o=lE(r.set),a=arguments.length;lE(t);var s=uE(i,r,e);if(!s&&a<3)throw hE("Updating absent value");var c=s?uE(n,r,e):lE(a>2?arguments[2]:void 0)(e,r);return uE(o,r,e,t(c,e,r)),r}});var fE=D,pE=Ce,vE=A,_E=tr,mE=TypeError,gE=function(e,t){var r,n=_E(this),i=pE(n.get),o=pE(n.has),a=pE(n.set),s=arguments.length>2?arguments[2]:void 0;if(!vE(t)&&!vE(s))throw mE("At least one callback required");return fE(o,n,e)?(r=fE(i,n,e),vE(t)&&(r=t(r),fE(a,n,e,r))):vE(s)&&(r=s(),fE(a,n,e,r)),r};Rr({target:"Map",proto:!0,real:!0,forced:!0},{upsert:gE}),Rr({target:"Map",proto:!0,real:!0,name:"upsert",forced:!0},{updateOrInsert:gE});var yE=Ny,SE=Ce,EE=Xe,bE=H,kE=Br,TE=TypeError,IE=function(e){return function(t,r,n,i){SE(r);var o=EE(t),a=bE(o),s=kE(o),c=e?s-1:0,u=e?-1:1;if(n<2)for(;;){if(c in a){i=a[c],c+=u;break}if(c+=u,e?c<0:s<=c)throw TE("Reduce of empty array with no initial value")}for(;e?c>=0:s>c;c+=u)c in a&&(i=r(i,a[c],c,o));return i}},AE={left:IE(!1),right:IE(!0)},RE=AE.left,wE=pe,CE=sf;Rr({target:"Array",proto:!0,forced:!Iu("reduce")||!CE&&wE>79&&wE<83},{reduce:function(e){var t=arguments.length;return RE(this,e,t,t>1?arguments[1]:void 0)}});var OE=Us("Array").reduce,DE=ae,xE=OE,NE=Array.prototype,PE=function(e){var t=e.reduce;return e===NE||DE(NE,e)&&t===NE.reduce?xE:t},ME=w,LE=b,UE=D,VE=i,FE=rn,BE=ui,jE=x,GE=Xe,HE=H,zE=Object.assign,KE=Object.defineProperty,XE=LE([].concat),qE=!zE||VE((function(){if(ME&&1!==zE({b:1},zE(KE({},"a",{enumerable:!0,get:function(){KE(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!=zE({},e)[r]||FE(zE({},t)).join("")!=n}))?function(e,t){for(var r=GE(e),n=arguments.length,i=1,o=BE.f,a=jE.f;n>i;)for(var s,c=HE(arguments[i++]),u=o?XE(FE(c),o(c)):FE(c),d=u.length,l=0;d>l;)s=u[l++],ME&&!UE(a,c,s)||(r[s]=c[s]);return r}:zE,WE=qE;Rr({target:"Object",stat:!0,arity:2,forced:Object.assign!==WE},{assign:WE});var YE=ee.Object.assign,QE=Rr,JE=b;R.f;var ZE=Vr,$E=gn,eb=Lm,tb=q,rb=Vm,nb=JE("".endsWith),ib=JE("".slice),ob=Math.min;QE({target:"String",proto:!0,forced:!rb("endsWith")},{endsWith:function(e){var t=$E(tb(this));eb(e);var r=arguments.length>1?arguments[1]:void 0,n=t.length,i=void 0===r?n:ob(ZE(r),n),o=$E(e);return nb?nb(t,o,i):ib(t,i-o.length,i)===o}});var ab=Us("String").endsWith,sb=ae,cb=ab,ub=String.prototype,db=function(e){var t=e.endsWith;return"string"==typeof e||e===ub||sb(ub,e)&&t===ub.endsWith?cb:t},lb=!0,hb=!0;function fb(e,t,r){var n=e.match(t);return n&&n.length>=r&&Cg(n[r],10)}function pb(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 yE),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===an(this._eventMap).length&&delete this._eventMap,o.apply(this,[e,n])},ad(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 vb(e){return"boolean"!=typeof e?new Error("Argument type: "+Ml(e)+". Please use a boolean."):(lb=e,e?"adapter.js logging disabled":"adapter.js logging enabled")}function _b(e){return"boolean"!=typeof e?new Error("Argument type: "+Ml(e)+". Please use a boolean."):(hb=!e,"adapter.js deprecation warnings "+(e?"disabled":"enabled"))}function mb(){if("object"===("undefined"==typeof window?"undefined":Ml(window))){if(lb)return;"undefined"!=typeof console&&"function"==typeof console.log&&console.log.apply(console,arguments)}}function gb(e,t){hb&&console.warn(e+" is deprecated, please use "+t+" instead.")}function yb(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=fb(r.userAgent,/Firefox\/(\d+)\./,1);else if(r.webkitGetUserMedia||!1===e.isSecureContext&&e.webkitRTCPeerConnection)t.browser="chrome",t.version=fb(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=fb(r.userAgent,/AppleWebKit\/(\d+)\./,1),t.supportsUnifiedPlan=e.RTCRtpTransceiver&&"currentDirection"in e.RTCRtpTransceiver.prototype}return t}function Sb(e){return"[object Object]"===Object.prototype.toString.call(e)}function Eb(e){var t;return Sb(e)?PE(t=an(e)).call(t,(function(t,r){var n=Sb(e[r]),i=n?Eb(e[r]):e[r],o=n&&!an(i).length;return void 0===i||o?t:YE(t,sd({},r,i))}),{}):e}function bb(e,t,r){t&&!r.has(t.id)&&(r.set(t.id,t),an(t).forEach((function(n){db(n).call(n,"Id")?bb(e,e.get(t[n]),r):db(n).call(n,"Ids")&&t[n].forEach((function(t){bb(e,e.get(t),r)}))})))}function kb(e,t,r){var n=r?"outbound-rtp":"inbound-rtp",i=new yE;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&&bb(e,r,i)}))})),i}var Tb=Rr,Ib=Po.find,Ab="find",Rb=!0;Ab in[]&&Array(1).find((function(){Rb=!1})),Tb({target:"Array",proto:!0,forced:Rb},{find:function(e){return Ib(this,e,arguments.length>1?arguments[1]:void 0)}});var wb=Us("Array").find,Cb=ae,Ob=wb,Db=Array.prototype,xb=function(e){var t=e.find;return e===Db||Cb(Db,e)&&t===Db.find?Ob:t},Nb=Rr,Pb=Kr.indexOf,Mb=Iu,Lb=b([].indexOf),Ub=!!Lb&&1/Lb([1],1,-0)<0,Vb=Mb("indexOf");Nb({target:"Array",proto:!0,forced:Ub||!Vb},{indexOf:function(e){var t=arguments.length>1?arguments[1]:void 0;return Ub?Lb(this,e,t)||0:Pb(this,e,t)}});var Fb=Us("Array").indexOf,Bb=ae,jb=Fb,Gb=Array.prototype,Hb=function(e){var t=e.indexOf;return e===Gb||Bb(Gb,e)&&t===Gb.indexOf?jb:t},zb=w,Kb=eo,Xb=TypeError,qb=Object.getOwnPropertyDescriptor,Wb=zb&&!function(){if(void 0!==this)return!0;try{Object.defineProperty([],"length",{writable:!1}).length=1}catch(EW){return EW instanceof TypeError}}(),Yb=Ie,Qb=TypeError,Jb=function(e,t){if(!delete e[t])throw Qb("Cannot delete property "+Yb(t)+" of "+Yb(e))},Zb=Rr,$b=Xe,ek=Mr,tk=Dr,rk=Br,nk=Wb?function(e,t){if(Kb(e)&&!qb(e,"length").writable)throw Xb("Cannot set read only .length");return e.length=t}:function(e,t){return e.length=t},ik=Qd,ok=Ao,ak=Jn,sk=Jb,ck=Ps("splice"),uk=Math.max,dk=Math.min;Zb({target:"Array",proto:!0,forced:!ck},{splice:function(e,t){var r,n,i,o,a,s,c=$b(this),u=rk(c),d=ek(e,u),l=arguments.length;for(0===l?r=n=0:1===l?(r=0,n=u-d):(r=l-2,n=dk(uk(tk(t),0),u-d)),ik(u+r-n),i=ok(c,n),o=0;o<n;o++)(a=d+o)in c&&ak(i,o,c[a]);if(i.length=n,r<n){for(o=d;o<u-n;o++)s=o+r,(a=o+n)in c?c[s]=c[a]:sk(c,s);for(o=u;o>u-n+r;o--)sk(c,o-1)}else if(r>n)for(o=u-n;o>d;o--)s=o+r-1,(a=o+n-1)in c?c[s]=c[a]:sk(c,s);for(o=0;o<r;o++)c[o+d]=arguments[o+2];return nk(c,u-n+r),i}});var lk=Us("Array").splice,hk=ae,fk=lk,pk=Array.prototype,vk=function(e){var t=e.splice;return e===pk||hk(pk,e)&&t===pk.splice?fk:t},_k=mb;function mk(e,t){var r=e&&e.navigator;if(r.mediaDevices){var n=function(e){if("object"!==Ml(e)||e.mandatory||e.optional)return e;var t,r={};(an(e).forEach((function(t){if("require"!==t&&"advanced"!==t&&"mediaSource"!==t){var n="object"===Ml(e[t])?e[t]:{ideal:e[t]};void 0!==n.exact&&"number"==typeof n.exact&&(n.min=n.max=n.exact);var i=function(e,t){return e?e+t.charAt(0).toUpperCase()+Sm(t).call(t,1):"deviceId"===t?"sourceId":t};if(void 0!==n.ideal){r.optional=r.optional||[];var o={};"number"==typeof n.ideal?(o[i("min",t)]=n.ideal,r.optional.push(o),(o={})[i("max",t)]=n.ideal,r.optional.push(o)):(o[i("",t)]=n.ideal,r.optional.push(o))}void 0!==n.exact&&"number"!=typeof n.exact?(r.mandatory=r.mandatory||{},r.mandatory[i("",t)]=n.exact):["min","max"].forEach((function(e){void 0!==n[e]&&(r.mandatory=r.mandatory||{},r.mandatory[i(e,t)]=n[e])}))}})),e.advanced)&&(r.optional=wm(t=r.optional||[]).call(t,e.advanced));return r},i=function(e,i){if(t.version>=61)return i(e);if((e=JSON.parse(tg(e)))&&"object"===Ml(e.audio)){var o=function(e,t,r){t in e&&!(r in e)&&(e[r]=e[t],delete e[t])};o((e=JSON.parse(tg(e))).audio,"autoGainControl","googAutoGainControl"),o(e.audio,"noiseSuppression","googNoiseSuppression"),e.audio=n(e.audio)}if(e&&"object"===Ml(e.video)){var a=e.video.facingMode;a=a&&("object"===Ml(a)?a:{ideal:a});var s,c=t.version<66;if(a&&("user"===a.exact||"environment"===a.exact||"user"===a.ideal||"environment"===a.ideal)&&(!r.mediaDevices.getSupportedConstraints||!r.mediaDevices.getSupportedConstraints().facingMode||c))if(delete e.video.facingMode,"environment"===a.exact||"environment"===a.ideal?s=["back","rear"]:"user"!==a.exact&&"user"!==a.ideal||(s=["front"]),s)return r.mediaDevices.enumerateDevices().then((function(t){t=Gs(t).call(t,(function(e){return"videoinput"===e.kind}));var r=xb(t).call(t,(function(e){return s.some((function(t){var r;return Jm(r=e.label.toLowerCase()).call(r,t)}))}));return!r&&t.length&&Jm(s).call(s,"back")&&(r=t[t.length-1]),r&&(e.video.deviceId=a.exact?{exact:r.deviceId}:{ideal:r.deviceId}),e.video=n(e.video),_k("chrome: "+tg(e)),i(e)}));e.video=n(e.video)}return _k("chrome: "+tg(e)),i(e)},o=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){i(e,(function(e){r.webkitGetUserMedia(e,t,(function(e){n&&n(o(e))}))}))}.bind(r),r.mediaDevices.getUserMedia){var a=r.mediaDevices.getUserMedia.bind(r.mediaDevices);r.mediaDevices.getUserMedia=function(e){return i(e,(function(e){return a(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 X_.reject(o(e))}))}))}}}}function gk(e){e.MediaStream=e.MediaStream||e.webkitMediaStream}function yk(e){if("object"===Ml(e)&&e.RTCPeerConnection&&!("ontrack"in e.RTCPeerConnection.prototype)){ad(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,o;e.RTCPeerConnection.prototype.getReceivers?i=xb(o=r.getReceivers()).call(o,(function(e){return e.track&&e.track.id===n.track.id})):i={track:n.track};var a=new Event("track");a.track=n.track,a.receiver=i,a.transceiver={receiver:i},a.streams=[t.stream],r.dispatchEvent(a)})),t.stream.getTracks().forEach((function(n){var i,o;e.RTCPeerConnection.prototype.getReceivers?i=xb(o=r.getReceivers()).call(o,(function(e){return e.track&&e.track.id===n.id})):i={track:n};var a=new Event("track");a.track=n,a.receiver=i,a.transceiver={receiver:i},a.streams=[t.stream],r.dispatchEvent(a)}))},this.addEventListener("addstream",this._ontrackpoly)),t.apply(this,arguments)}}else pb(e,"track",(function(e){return e.transceiver||ad(e,"transceiver",{value:{receiver:e.receiver}}),e}))}function Sk(e){if("object"===Ml(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(){var e;return this._senders=this._senders||[],Sm(e=this._senders).call(e)};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 n=e.RTCPeerConnection.prototype.removeTrack;e.RTCPeerConnection.prototype.removeTrack=function(e){var t;n.apply(this,arguments);var r,i=Hb(t=this._senders).call(t,e);-1!==i&&vk(r=this._senders).call(r,i,1)}}var i=e.RTCPeerConnection.prototype.addStream;e.RTCPeerConnection.prototype.addStream=function(e){var r=this;this._senders=this._senders||[],i.apply(this,[e]),e.getTracks().forEach((function(e){r._senders.push(t(r,e))}))};var o=e.RTCPeerConnection.prototype.removeStream;e.RTCPeerConnection.prototype.removeStream=function(e){var t=this;this._senders=this._senders||[],o.apply(this,[e]),e.getTracks().forEach((function(e){var r,n,i,o=xb(r=t._senders).call(r,(function(t){return t.track===e}));o&&vk(n=t._senders).call(n,Hb(i=t._senders).call(i,o),1)}))}}else if("object"===Ml(e)&&e.RTCPeerConnection&&"getSenders"in e.RTCPeerConnection.prototype&&"createDTMFSender"in e.RTCPeerConnection.prototype&&e.RTCRtpSender&&!("dtmf"in e.RTCRtpSender.prototype)){var a=e.RTCPeerConnection.prototype.getSenders;e.RTCPeerConnection.prototype.getSenders=function(){var e=this,t=a.apply(this,[]);return t.forEach((function(t){return t._pc=e})),t},ad(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 Ek(e){if(e.RTCPeerConnection){var t=e.RTCPeerConnection.prototype.getStats;e.RTCPeerConnection.prototype.getStats=function(){var e=this,r=Sm(Array.prototype).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){var t;return new yE(sg(t=an(e)).call(t,(function(t){return[t,e[t]]})))};if(arguments.length>=2){var c=function(e){i(s(a(e)))};return t.apply(this,[c,n])}return new X_((function(r,n){t.apply(e,[function(e){r(s(a(e)))},n])})).then(i,o)}}}function bk(e){if("object"===Ml(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 kb(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}),pb(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 kb(t,e.track,!1)}))}}if("getStats"in e.RTCRtpSender.prototype&&"getStats"in e.RTCRtpReceiver.prototype){var i=e.RTCPeerConnection.prototype.getStats;e.RTCPeerConnection.prototype.getStats=function(){if(arguments.length>0&&arguments[0]instanceof e.MediaStreamTrack){var t,r,n,o=arguments[0];return this.getSenders().forEach((function(e){e.track===o&&(t?n=!0:t=e)})),this.getReceivers().forEach((function(e){return e.track===o&&(r?n=!0:r=e),e.track===o})),n||t&&r?X_.reject(new DOMException("There are more than one sender or receiver for the track.","InvalidAccessError")):t?t.getStats():r?r.getStats():X_.reject(new DOMException("There is no sender or receiver for the track.","InvalidAccessError"))}return i.apply(this,arguments)}}}}function kk(e){e.RTCPeerConnection.prototype.getLocalStreams=function(){var e,t=this;return this._shimmedLocalStreams=this._shimmedLocalStreams||{},sg(e=an(this._shimmedLocalStreams)).call(e,(function(e){return t._shimmedLocalStreams[e][0]}))};var t=e.RTCPeerConnection.prototype.addTrack;e.RTCPeerConnection.prototype.addTrack=function(e,r){var n;if(!r)return t.apply(this,arguments);this._shimmedLocalStreams=this._shimmedLocalStreams||{};var i=t.apply(this,arguments);return this._shimmedLocalStreams[r.id]?-1===Hb(n=this._shimmedLocalStreams[r.id]).call(n,i)&&this._shimmedLocalStreams[r.id].push(i):this._shimmedLocalStreams[r.id]=[r,i],i};var r=e.RTCPeerConnection.prototype.addStream;e.RTCPeerConnection.prototype.addStream=function(e){var t,n,i=this;this._shimmedLocalStreams=this._shimmedLocalStreams||{},e.getTracks().forEach((function(e){var t;if(xb(t=i.getSenders()).call(t,(function(t){return t.track===e})))throw new DOMException("Track already exists.","InvalidAccessError")}));var o=this.getSenders();r.apply(this,arguments);var a=Gs(t=this.getSenders()).call(t,(function(e){return-1===Hb(o).call(o,e)}));this._shimmedLocalStreams[e.id]=wm(n=[e]).call(n,a)};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&&an(this._shimmedLocalStreams).forEach((function(r){var n,i,o=Hb(n=t._shimmedLocalStreams[r]).call(n,e);-1!==o&&vk(i=t._shimmedLocalStreams[r]).call(i,o,1);1===t._shimmedLocalStreams[r].length&&delete t._shimmedLocalStreams[r]})),i.apply(this,arguments)}}function Tk(e,t){if(e.RTCPeerConnection){if(e.RTCPeerConnection.prototype.addTrack&&t.version>=65)return kk(e);var r=e.RTCPeerConnection.prototype.getLocalStreams;e.RTCPeerConnection.prototype.getLocalStreams=function(){var e=this,t=r.apply(this);return this._reverseStreams=this._reverseStreams||{},sg(t).call(t,(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){var t;if(xb(t=r.getSenders()).call(t,(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,i,o,a=this;if("closed"===this.signalingState)throw new DOMException("The RTCPeerConnection's signalingState is 'closed'.","InvalidStateError");var s=Sm([]).call(arguments,1);if(1!==s.length||!xb(n=s[0].getTracks()).call(n,(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 c=xb(i=this.getSenders()).call(i,(function(e){return e.track===t}));if(c)throw new DOMException("Track already exists.","InvalidAccessError");this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{};var u=this._streams[r.id];if(u)u.addTrack(t),X_.resolve().then((function(){a.dispatchEvent(new Event("negotiationneeded"))}));else{var d=new e.MediaStream([t]);this._streams[r.id]=d,this._reverseStreams[d.id]=r,this.addStream(d)}return xb(o=this.getSenders()).call(o,(function(e){return e.track===t}))},["createOffer","createAnswer"].forEach((function(t){var r=e.RTCPeerConnection.prototype[t],n=sd({},t,(function(){var e=this,t=arguments,n=arguments.length&&"function"==typeof arguments[0];return n?r.apply(this,[function(r){var n=s(e,r);t[0].apply(null,[n])},function(e){t[1]&&t[1].apply(null,e)},arguments[2]]):r.apply(this,arguments).then((function(t){return s(e,t)}))}));e.RTCPeerConnection.prototype[t]=n[t]}));var o=e.RTCPeerConnection.prototype.setLocalDescription;e.RTCPeerConnection.prototype.setLocalDescription=function(){return arguments.length&&arguments[0].type?(arguments[0]=c(this,arguments[0]),o.apply(this,arguments)):o.apply(this,arguments)};var a=tc(e.RTCPeerConnection.prototype,"localDescription");ad(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||{},an(this._streams).forEach((function(n){var i;xb(i=r._streams[n].getTracks()).call(i,(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 an(e._reverseStreams||[]).forEach((function(t){var n=e._reverseStreams[t],i=e._streams[n.id];r=r.replace(new RegExp(i.id,"g"),n.id)})),new RTCSessionDescription({type:t.type,sdp:r})}function c(e,t){var r=t.sdp;return an(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 Ik(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=sd({},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 Ak(e,t){pb(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 Rk=Object.freeze(Object.defineProperty({__proto__:null,shimMediaStream:gk,shimOnTrack:yk,shimGetSendersWithDtmf:Sk,shimGetStats:Ek,shimSenderReceiverGetStats:bk,shimAddTrackRemoveTrackWithNative:kk,shimAddTrackRemoveTrack:Tk,shimPeerConnection:Ik,fixNegotiationNeeded:Ak,shimGetUserMedia:mk,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"}));Rr({target:"Array",stat:!0},{isArray:eo});var wk=ee.Array.isArray;function Ck(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}var Ok=uh,Dk=tr,xk=Sh,Nk=Yt,Pk=D,Mk=Xe,Lk=function(e,t,r,n){try{return n?t(Dk(r)[0],r[1]):t(r)}catch(EW){xk(e,"throw",EW)}},Uk=nh,Vk=yo,Fk=Br,Bk=Jn,jk=_h,Gk=uh,Hk=Array,zk=function(e){var t=Mk(e),r=Vk(this),n=arguments.length,i=n>1?arguments[1]:void 0,o=void 0!==i;o&&(i=Nk(i,n>2?arguments[2]:void 0));var a,s,c,u,d,l,h=Gk(t),f=0;if(!h||this===Hk&&Uk(h))for(a=Fk(t),s=r?new this(a):Hk(a);a>f;f++)l=o?i(t[f],f):t[f],Bk(s,f,l);else for(d=(u=jk(t,h)).next,s=r?new this:[];!(c=Pk(d,u)).done;f++)l=o?Lk(u,i,[c.value,f],!0):c.value,Bk(s,f,l);return s.length=f,s},Kk=zk;Rr({target:"Array",stat:!0,forced:!Qv((function(e){Array.from(e)}))},{from:Kk});var Xk=ee.Array.from;function qk(e,t){var r;if(e){if("string"==typeof e)return Ck(e,t);var n=Sm(r=Object.prototype.toString.call(e)).call(r,8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Xk(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Ck(e,t):void 0}}function Wk(e){return function(e){if(wk(e))return Ck(e)}(e)||function(e){if(void 0!==_l&&null!=Ok(e)||null!=e["@@iterator"])return Xk(e)}(e)||qk(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.")}()}var Yk=n,Qk=i,Jk=gn,Zk=_g.trim,$k=b("".charAt),eT=Yk.parseFloat,tT=Yk.Symbol,rT=tT&&tT.iterator,nT=1/eT("\t\n\v\f\r                 \u2028\u2029\ufeff-0")!=-1/0||rT&&!Qk((function(){eT(Object(rT))}))?function(e){var t=Zk(Jk(e)),r=eT(t);return 0===r&&"-"==$k(t,0)?-0:r}:eT;Rr({global:!0,forced:parseFloat!=nT},{parseFloat:nT});var iT=ee.parseFloat;function oT(e,t){var r=e&&e.navigator,n=e&&e.MediaStreamTrack;if(r.getUserMedia=function(e,t,n){gb("navigator.getUserMedia","navigator.mediaDevices.getUserMedia"),r.mediaDevices.getUserMedia(e).then(t,n)},!(t.version>55&&"autoGainControl"in r.mediaDevices.getSupportedConstraints())){var i=function(e,t,r){t in e&&!(r in e)&&(e[r]=e[t],delete e[t])},o=r.mediaDevices.getUserMedia.bind(r.mediaDevices);if(r.mediaDevices.getUserMedia=function(e){return"object"===Ml(e)&&"object"===Ml(e.audio)&&(e=JSON.parse(tg(e)),i(e.audio,"autoGainControl","mozAutoGainControl"),i(e.audio,"noiseSuppression","mozNoiseSuppression")),o(e)},n&&n.prototype.getSettings){var a=n.prototype.getSettings;n.prototype.getSettings=function(){var e=a.apply(this,arguments);return i(e,"mozAutoGainControl","autoGainControl"),i(e,"mozNoiseSuppression","noiseSuppression"),e}}if(n&&n.prototype.applyConstraints){var s=n.prototype.applyConstraints;n.prototype.applyConstraints=function(e){return"audio"===this.kind&&"object"===Ml(e)&&(e=JSON.parse(tg(e)),i(e,"autoGainControl","mozAutoGainControl"),i(e,"noiseSuppression","mozNoiseSuppression")),s.apply(this,[e])}}}}function aT(e){"object"===Ml(e)&&e.RTCTrackEvent&&"receiver"in e.RTCTrackEvent.prototype&&!("transceiver"in e.RTCTrackEvent.prototype)&&ad(e.RTCTrackEvent.prototype,"transceiver",{get:function(){return{receiver:this.receiver}}})}function sT(e,t){if("object"===Ml(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=sd({},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"},n=e.RTCPeerConnection.prototype.getStats;e.RTCPeerConnection.prototype.getStats=function(){var e=Sm(Array.prototype).call(arguments),i=e[0],o=e[1],a=e[2];return n.apply(this,[i||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,YE({},t,{type:r[t.type]||t.type}))}))}return e})).then(o,a)}}}function cT(e){if("object"===Ml(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):X_.resolve(new yE)}}}function uT(e){if("object"===Ml(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}),pb(e,"track",(function(e){return e.receiver._pc=e.srcElement,e})),e.RTCRtpReceiver.prototype.getStats=function(){return this._pc.getStats(this.track)}}}function dT(e){e.RTCPeerConnection&&!("removeStream"in e.RTCPeerConnection.prototype)&&(e.RTCPeerConnection.prototype.removeStream=function(e){var t=this;gb("removeStream","removeTrack"),this.getSenders().forEach((function(r){var n;r.track&&Jm(n=e.getTracks()).call(n,r.track)&&t.removeTrack(r)}))})}function lT(e){e.DataChannel&&!e.RTCDataChannel&&(e.RTCDataChannel=e.DataChannel)}function hT(e){if("object"===Ml(e)&&e.RTCPeerConnection){var t=e.RTCPeerConnection.prototype.addTransceiver;t&&(e.RTCPeerConnection.prototype.addTransceiver=function(){this.setParametersPromises=[];var e=arguments[1]&&arguments[1].sendEncodings;void 0===e&&(e=[]);var r=(e=Wk(e)).length>0;r&&e.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&&!(iT(e.scaleResolutionDownBy)>=1))throw new RangeError("scale_resolution_down_by must be >= 1.0");if("maxFramerate"in e&&!(iT(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===an(o.encodings[0]).length)&&(o.encodings=e,i.sendEncodings=e,this.setParametersPromises.push(i.setParameters(o).then((function(){delete i.sendEncodings})).catch((function(){delete i.sendEncodings}))))}return n})}}function fT(e){if("object"===Ml(e)&&e.RTCRtpSender){var t=e.RTCRtpSender.prototype.getParameters;t&&(e.RTCRtpSender.prototype.getParameters=function(){var e,r=t.apply(this,arguments);"encodings"in r||(r.encodings=wm(e=[]).call(e,this.sendEncodings||[{}]));return r})}}function pT(e){if("object"===Ml(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?X_.all(this.setParametersPromises).then((function(){return t.apply(r,e)})).finally((function(){r.setParametersPromises=[]})):t.apply(this,arguments)}}}function vT(e){if("object"===Ml(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?X_.all(this.setParametersPromises).then((function(){return t.apply(r,e)})).finally((function(){r.setParametersPromises=[]})):t.apply(this,arguments)}}}var _T=Object.freeze(Object.defineProperty({__proto__:null,shimOnTrack:aT,shimPeerConnection:sT,shimSenderGetStats:cT,shimReceiverGetStats:uT,shimRemoveStream:dT,shimRTCDataChannel:lT,shimAddTransceiver:hT,shimGetParameters:fT,shimCreateOffer:pT,shimCreateAnswer:vT,shimGetUserMedia:oT,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,X_.reject(n)}return!0===r.video?r.video={mediaSource:t}:r.video.mediaSource=t,e.navigator.mediaDevices.getUserMedia(r)})}},Symbol.toStringTag,{value:"Module"}));function mT(e){if("object"===Ml(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,n=this;this._localStreams||(this._localStreams=[]),Jm(r=this._localStreams).call(r,e)||this._localStreams.push(e),e.getAudioTracks().forEach((function(r){return t.call(n,r,e)})),e.getVideoTracks().forEach((function(r){return t.call(n,r,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){var t;r._localStreams?Jm(t=r._localStreams).call(t,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,r,n=this;this._localStreams||(this._localStreams=[]);var i=Hb(t=this._localStreams).call(t,e);if(-1!==i){vk(r=this._localStreams).call(r,i,1);var o=e.getTracks();this.getSenders().forEach((function(e){Jm(o).call(o,e.track)&&n.removeTrack(e)}))}})}}function gT(e){if("object"===Ml(e)&&e.RTCPeerConnection&&("getRemoteStreams"in e.RTCPeerConnection.prototype||(e.RTCPeerConnection.prototype.getRemoteStreams=function(){return this._remoteStreams?this._remoteStreams:[]}),!("onaddstream"in e.RTCPeerConnection.prototype))){ad(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){var r;if(t._remoteStreams||(t._remoteStreams=[]),!Jm(r=t._remoteStreams).call(r,e)){t._remoteStreams.push(e);var n=new Event("addstream");n.stream=e,t.dispatchEvent(n)}}))})}});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){var r;if(e._remoteStreams||(e._remoteStreams=[]),!(Hb(r=e._remoteStreams).call(r,t)>=0)){e._remoteStreams.push(t);var n=new Event("addstream");n.stream=t,e.dispatchEvent(n)}}))}),t.apply(e,arguments)}}}function yT(e){if("object"===Ml(e)&&e.RTCPeerConnection){var t=e.RTCPeerConnection.prototype,r=t.createOffer,n=t.createAnswer,i=t.setLocalDescription,o=t.setRemoteDescription,a=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),X_.resolve()):i},t.createAnswer=function(e,t){var r=arguments.length>=2?arguments[2]:arguments[0],i=n.apply(this,[r]);return t?(i.then(e,t),X_.resolve()):i};var s=function(e,t,r){var n=i.apply(this,[e]);return r?(n.then(t,r),X_.resolve()):n};t.setLocalDescription=s,s=function(e,t,r){var n=o.apply(this,[e]);return r?(n.then(t,r),X_.resolve()):n},t.setRemoteDescription=s,s=function(e,t,r){var n=a.apply(this,[e]);return r?(n.then(t,r),X_.resolve()):n},t.addIceCandidate=s}}function ST(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(ET(e))}}!t.getUserMedia&&t.mediaDevices&&t.mediaDevices.getUserMedia&&(t.getUserMedia=function(e,r,n){t.mediaDevices.getUserMedia(e).then(r,n)}.bind(t))}function ET(e){return e&&void 0!==e.video?YE({},e,{video:Eb(e.video)}):e}function bT(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")?(gb("RTCIceServer.url","RTCIceServer.urls"),(o=JSON.parse(tg(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&&ad(e.RTCPeerConnection,"generateCertificate",{get:function(){return t.generateCertificate}})}}function kT(e){"object"===Ml(e)&&e.RTCTrackEvent&&"receiver"in e.RTCTrackEvent.prototype&&!("transceiver"in e.RTCTrackEvent.prototype)&&ad(e.RTCTrackEvent.prototype,"transceiver",{get:function(){return{receiver:this.receiver}}})}function TT(e){var t=e.RTCPeerConnection.prototype.createOffer;e.RTCPeerConnection.prototype.createOffer=function(e){if(e){var r,n;void 0!==e.offerToReceiveAudio&&(e.offerToReceiveAudio=!!e.offerToReceiveAudio);var i=xb(r=this.getTransceivers()).call(r,(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 o=xb(n=this.getTransceivers()).call(n,(function(e){return"video"===e.receiver.track.kind}));!1===e.offerToReceiveVideo&&o?"sendrecv"===o.direction?o.setDirection?o.setDirection("sendonly"):o.direction="sendonly":"recvonly"===o.direction&&(o.setDirection?o.setDirection("inactive"):o.direction="inactive"):!0!==e.offerToReceiveVideo||o||this.addTransceiver("video",{direction:"recvonly"})}return t.apply(this,arguments)}}function IT(e){"object"!==Ml(e)||e.AudioContext||(e.AudioContext=e.webkitAudioContext)}var AT=Object.freeze(Object.defineProperty({__proto__:null,shimLocalStreamsAPI:mT,shimRemoteStreamsAPI:gT,shimCallbacksAPI:yT,shimGetUserMedia:ST,shimConstraints:ET,shimRTCIceServerUrls:bT,shimTrackEventTransceiver:kT,shimCreateOfferLegacy:TT,shimAudioContext:IT},Symbol.toStringTag,{value:"Module"})),RT=cc.PROPER,wT=i,CT=cg,OT=_g.trim;Rr({target:"String",proto:!0,forced:function(e){return wT((function(){return!!CT[e]()||"​…᠎"!=="​…᠎"[e]()||RT&&CT[e].name!==e}))}("trim")},{trim:function(){return OT(this)}});var DT,xT,NT=Us("String").trim,PT=ae,MT=NT,LT=String.prototype,UT=function(e){var t=e.trim;return"string"==typeof e||e===LT||PT(LT,e)&&t===LT.trim?MT:t},VT={exports:{}};DT=VT,(xT={generateIdentifier:function(){return Math.random().toString(36).substr(2,10)}}).localCName=xT.generateIdentifier(),xT.splitLines=function(e){var t;return sg(t=UT(e).call(e).split("\n")).call(t,(function(e){return UT(e).call(e)}))},xT.splitSections=function(e){var t=e.split("\nm=");return sg(t).call(t,(function(e,t){var r;return UT(r=t>0?"m="+e:e).call(r)+"\r\n"}))},xT.getDescription=function(e){var t=xT.splitSections(e);return t&&t[0]},xT.getMediaSections=function(e){var t=xT.splitSections(e);return t.shift(),t},xT.matchPrefix=function(e,t){var r;return Gs(r=xT.splitLines(e)).call(r,(function(e){return 0===Hb(e).call(e,t)}))},xT.parseCandidate=function(e){for(var t,r={foundation:(t=0===Hb(e).call(e,"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:Cg(t[3],10),ip:t[4],address:t[4],port:Cg(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=Cg(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},xT.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(" ")},xT.parseIceOptions=function(e){return e.substr(14).split(" ")},xT.parseRtpMap=function(e){var t=e.substr(9).split(" "),r={payloadType:Cg(t.shift(),10)};return t=t[0].split("/"),r.name=t[0],r.clockRate=Cg(t[1],10),r.channels=3===t.length?Cg(t[2],10):1,r.numChannels=r.channels,r},xT.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"},xT.parseExtmap=function(e){var t,r=e.substr(9).split(" ");return{id:Cg(r[0],10),direction:Hb(t=r[0]).call(t,"/")>0?r[0].split("/")[1]:"sendrecv",uri:r[1]}},xT.writeExtmap=function(e){return"a=extmap:"+(e.id||e.preferredId)+(e.direction&&"sendrecv"!==e.direction?"/"+e.direction:"")+" "+e.uri+"\r\n"},xT.parseFmtp=function(e){for(var t,r={},n=e.substr(Hb(e).call(e," ")+1).split(";"),i=0;i<n.length;i++){var o,a;t=UT(o=n[i]).call(o).split("="),r[UT(a=t[0]).call(a)]=t[1]}return r},xT.writeFmtp=function(e){var t="",r=e.payloadType;if(void 0!==e.preferredPayloadType&&(r=e.preferredPayloadType),e.parameters&&an(e.parameters).length){var n=[];an(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},xT.parseRtcpFb=function(e){var t=e.substr(Hb(e).call(e," ")+1).split(" ");return{type:t.shift(),parameter:t.join(" ")}},xT.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},xT.parseSsrcMedia=function(e){var t=Hb(e).call(e," "),r={ssrc:Cg(e.substr(7,t-7),10)},n=Hb(e).call(e,":",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},xT.parseSsrcGroup=function(e){var t=e.substr(13).split(" ");return{semantics:t.shift(),ssrcs:sg(t).call(t,(function(e){return Cg(e,10)}))}},xT.getMid=function(e){var t=xT.matchPrefix(e,"a=mid:")[0];if(t)return t.substr(6)},xT.parseFingerprint=function(e){var t=e.substr(14).split(" ");return{algorithm:t[0].toLowerCase(),value:t[1].toUpperCase()}},xT.getDtlsParameters=function(e,t){var r=xT.matchPrefix(e+t,"a=fingerprint:");return{role:"auto",fingerprints:sg(r).call(r,xT.parseFingerprint)}},xT.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},xT.parseCryptoLine=function(e){var t=e.substr(9).split(" ");return{tag:Cg(t[0],10),cryptoSuite:t[1],keyParams:t[2],sessionParams:Sm(t).call(t,3)}},xT.writeCryptoLine=function(e){return"a=crypto:"+e.tag+" "+e.cryptoSuite+" "+("object"===Ml(e.keyParams)?xT.writeCryptoKeyParams(e.keyParams):e.keyParams)+(e.sessionParams?" "+e.sessionParams.join(" "):"")+"\r\n"},xT.parseCryptoKeyParams=function(e){if(0!==Hb(e).call(e,"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}},xT.writeCryptoKeyParams=function(e){return e.keyMethod+":"+e.keySalt+(e.lifeTime?"|"+e.lifeTime:"")+(e.mkiValue&&e.mkiLength?"|"+e.mkiValue+":"+e.mkiLength:"")},xT.getCryptoParameters=function(e,t){var r=xT.matchPrefix(e+t,"a=crypto:");return sg(r).call(r,xT.parseCryptoLine)},xT.getIceParameters=function(e,t){var r=xT.matchPrefix(e+t,"a=ice-ufrag:")[0],n=xT.matchPrefix(e+t,"a=ice-pwd:")[0];return r&&n?{usernameFragment:r.substr(12),password:n.substr(10)}:null},xT.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},xT.parseRtpParameters=function(e){for(var t={codecs:[],headerExtensions:[],fecMechanisms:[],rtcp:[]},r=xT.splitLines(e)[0].split(" "),n=3;n<r.length;n++){var i=r[n],o=xT.matchPrefix(e,"a=rtpmap:"+i+" ")[0];if(o){var a,s=xT.parseRtpMap(o),c=xT.matchPrefix(e,"a=fmtp:"+i+" ");switch(s.parameters=c.length?xT.parseFmtp(c[0]):{},s.rtcpFeedback=sg(a=xT.matchPrefix(e,"a=rtcp-fb:"+i+" ")).call(a,xT.parseRtcpFb),t.codecs.push(s),s.name.toUpperCase()){case"RED":case"ULPFEC":t.fecMechanisms.push(s.name.toUpperCase())}}}return xT.matchPrefix(e,"a=extmap:").forEach((function(e){t.headerExtensions.push(xT.parseExtmap(e))})),t},xT.writeRtpDescription=function(e,t){var r,n="";n+="m="+e+" ",n+=t.codecs.length>0?"9":"0",n+=" UDP/TLS/RTP/SAVPF ",n+=sg(r=t.codecs).call(r,(function(e){return void 0!==e.preferredPayloadType?e.preferredPayloadType:e.payloadType})).join(" ")+"\r\n",n+="c=IN IP4 0.0.0.0\r\n",n+="a=rtcp:9 IN IP4 0.0.0.0\r\n",t.codecs.forEach((function(e){n+=xT.writeRtpMap(e),n+=xT.writeFmtp(e),n+=xT.writeRtcpFb(e)}));var i=0;return t.codecs.forEach((function(e){e.maxptime>i&&(i=e.maxptime)})),i>0&&(n+="a=maxptime:"+i+"\r\n"),t.headerExtensions&&t.headerExtensions.forEach((function(e){n+=xT.writeExtmap(e)})),n},xT.parseRtpEncodingParameters=function(e){var t,r,n,i,o,a,s=[],c=xT.parseRtpParameters(e),u=-1!==Hb(t=c.fecMechanisms).call(t,"RED"),d=-1!==Hb(r=c.fecMechanisms).call(r,"ULPFEC"),l=Gs(n=sg(i=xT.matchPrefix(e,"a=ssrc:")).call(i,(function(e){return xT.parseSsrcMedia(e)}))).call(n,(function(e){return"cname"===e.attribute})),h=l.length>0&&l[0].ssrc,f=sg(o=xT.matchPrefix(e,"a=ssrc-group:FID")).call(o,(function(e){var t=e.substr(17).split(" ");return sg(t).call(t,(function(e){return Cg(e,10)}))}));f.length>0&&f[0].length>1&&f[0][0]===h&&(a=f[0][1]),c.codecs.forEach((function(e){if("RTX"===e.name.toUpperCase()&&e.parameters.apt){var t={ssrc:h,codecPayloadType:Cg(e.parameters.apt,10)};h&&a&&(t.rtx={ssrc:a}),s.push(t),u&&((t=JSON.parse(tg(t))).fec={ssrc:h,mechanism:d?"red+ulpfec":"red"},s.push(t))}})),0===s.length&&h&&s.push({ssrc:h});var p,v,_=xT.matchPrefix(e,"b=");return _.length&&(_=0===Hb(p=_[0]).call(p,"b=TIAS:")?Cg(_[0].substr(7),10):0===Hb(v=_[0]).call(v,"b=AS:")?1e3*Cg(_[0].substr(5),10)*.95-16e3:void 0,s.forEach((function(e){e.maxBitrate=_}))),s},xT.parseRtcpParameters=function(e){var t,r,n={},i=Gs(t=sg(r=xT.matchPrefix(e,"a=ssrc:")).call(r,(function(e){return xT.parseSsrcMedia(e)}))).call(t,(function(e){return"cname"===e.attribute}))[0];i&&(n.cname=i.value,n.ssrc=i.ssrc);var o=xT.matchPrefix(e,"a=rtcp-rsize");n.reducedSize=o.length>0,n.compound=0===o.length;var a=xT.matchPrefix(e,"a=rtcp-mux");return n.mux=a.length>0,n},xT.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},xT.parseMsid=function(e){var t,r,n,i=xT.matchPrefix(e,"a=msid:");if(1===i.length)return{stream:(n=i[0].substr(7).split(" "))[0],track:n[1]};var o=Gs(t=sg(r=xT.matchPrefix(e,"a=ssrc:")).call(r,(function(e){return xT.parseSsrcMedia(e)}))).call(t,(function(e){return"msid"===e.attribute}));return o.length>0?{stream:(n=o[0].value.split(" "))[0],track:n[1]}:void 0},xT.parseSctpDescription=function(e){var t,r=xT.parseMLine(e),n=xT.matchPrefix(e,"a=max-message-size:");n.length>0&&(t=Cg(n[0].substr(19),10)),isNaN(t)&&(t=65536);var i=xT.matchPrefix(e,"a=sctp-port:");if(i.length>0)return{port:Cg(i[0].substr(12),10),protocol:r.fmt,maxMessageSize:t};var o=xT.matchPrefix(e,"a=sctpmap:");if(o.length>0){var a=o[0].substr(10).split(" ");return{port:Cg(a[0],10),protocol:a[1],maxMessageSize:t}}},xT.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("")},xT.generateSessionId=function(){return Math.random().toString().substr(2,21)},xT.writeSessionBoilerplate=function(e,t,r){var n=void 0!==t?t:2;return"v=0\r\no="+(r||"thisisadapterortc")+" "+(e||xT.generateSessionId())+" "+n+" IN IP4 127.0.0.1\r\ns=-\r\nt=0 0\r\n"},xT.getDirection=function(e,t){for(var r=xT.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?xT.getDirection(t):"sendrecv"},xT.getKind=function(e){return xT.splitLines(e)[0].split(" ")[0].substr(2)},xT.isRejected=function(e){return"0"===e.split(" ",2)[1]},xT.parseMLine=function(e){var t=xT.splitLines(e)[0].substr(2).split(" ");return{kind:t[0],port:Cg(t[1],10),protocol:t[2],fmt:Sm(t).call(t,3).join(" ")}},xT.parseOLine=function(e){var t=xT.matchPrefix(e,"o=")[0].substr(2).split(" ");return{username:t[0],sessionId:t[1],sessionVersion:Cg(t[2],10),netType:t[3],addressType:t[4],address:t[5]}},xT.isValidSDP=function(e){if("string"!=typeof e||0===e.length)return!1;for(var t=xT.splitLines(e),r=0;r<t.length;r++)if(t[r].length<2||"="!==t[r].charAt(1))return!1;return!0},DT.exports=xT;var FT=VT.exports,BT=e({__proto__:null,default:FT},[VT.exports]);function jT(e){if(!(!e.RTCIceCandidate||e.RTCIceCandidate&&"foundation"in e.RTCIceCandidate.prototype)){var t=e.RTCIceCandidate;e.RTCIceCandidate=function(e){var r;if("object"===Ml(e)&&e.candidate&&0===Hb(r=e.candidate).call(r,"a=")&&((e=JSON.parse(tg(e))).candidate=e.candidate.substr(2)),e.candidate&&e.candidate.length){var n=new t(e),i=FT.parseCandidate(e.candidate),o=YE(n,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,pb(e,"icecandidate",(function(t){return t.candidate&&ad(t,"candidate",{value:new e.RTCIceCandidate(t.candidate),writable:"false"}),t}))}}function GT(e){!e.RTCIceCandidate||e.RTCIceCandidate&&"relayProtocol"in e.RTCIceCandidate.prototype||pb(e,"icecandidate",(function(e){if(e.candidate){var t=FT.parseCandidate(e.candidate.candidate);"relay"===t.type&&(e.candidate.relayProtocol={0:"tls",1:"tcp",2:"udp"}[t.priority>>24])}return e}))}function HT(e,t){if(e.RTCPeerConnection){"sctp"in e.RTCPeerConnection.prototype||ad(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=FT.splitSections(e.sdp);return t.shift(),t.some((function(e){var t,r=FT.parseMLine(e);return r&&"application"===r.kind&&-1!==Hb(t=r.protocol).call(t,"SCTP")}))},n=function(e){var t=e.sdp.match(/mozilla...THIS_IS_SDPARTA-(\d+)/);if(null===t||t.length<2)return-1;var r=Cg(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=FT.matchPrefix(e.sdp,"a=max-message-size:");return i.length>0?n=Cg(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&&ad(this,"sctp",{get:function(){return void 0===this._sctp?null:this._sctp},enumerable:!0,configurable:!0})}if(r(arguments[0])){var c,u=n(arguments[0]),d=i(u),l=o(arguments[0],u);c=0===d&&0===l?Number.POSITIVE_INFINITY:0===d||0===l?Math.max(d,l):Math.min(d,l);var h={};ad(h,"maxMessageSize",{get:function(){return c}}),this._sctp=h}return a.apply(this,arguments)}}}function zT(e){if(e.RTCPeerConnection&&"createDataChannel"in e.RTCPeerConnection.prototype){var t=e.RTCPeerConnection.prototype.createDataChannel;e.RTCPeerConnection.prototype.createDataChannel=function(){var e=t.apply(this,arguments);return r(e,this),e},pb(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 KT(e){if(e.RTCPeerConnection&&!("connectionState"in e.RTCPeerConnection.prototype)){var t=e.RTCPeerConnection.prototype;ad(t,"connectionState",{get:function(){return{completed:"connected",checking:"connecting"}[this.iceConnectionState]||this.iceConnectionState},enumerable:!0,configurable:!0}),ad(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 XT(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){var n;if(t&&t.sdp&&-1!==Hb(n=t.sdp).call(n,"\na=extmap-allow-mixed")){var i,o=Gs(i=t.sdp.split("\n")).call(i,(function(e){return"a=extmap-allow-mixed"!==UT(e).call(e)})).join("\n");e.RTCSessionDescription&&t instanceof e.RTCSessionDescription?arguments[0]=new e.RTCSessionDescription({type:t.type,sdp:o}):t.sdp=o}return r.apply(this,arguments)}}}function qT(e,t){if(e.RTCPeerConnection&&e.RTCPeerConnection.prototype){var r=e.RTCPeerConnection.prototype.addIceCandidate;r&&0!==r.length&&(e.RTCPeerConnection.prototype.addIceCandidate=function(){return arguments[0]?("chrome"===t.browser&&t.version<78||"firefox"===t.browser&&t.version<68||"safari"===t.browser)&&arguments[0]&&""===arguments[0].candidate?X_.resolve():r.apply(this,arguments):(arguments[1]&&arguments[1].apply(null),X_.resolve())})}}function WT(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"!==Ml(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 n="offer"===t.type?this.createOffer:this.createAnswer;return n.apply(this).then((function(t){return r.apply(e,[t])}))})}}var YT=Object.freeze(Object.defineProperty({__proto__:null,shimRTCIceCandidate:jT,shimRTCIceCandidateRelayProtocol:GT,shimMaxMessageSize:HT,shimSendThrowTypeError:zT,shimConnectionState:KT,removeExtmapAllowMixed:XT,shimAddIceCandidateNullOrEmpty:qT,shimParameterlessSetLocalDescription:WT},Symbol.toStringTag,{value:"Module"}));function QT(e,t){var r=void 0!==_l&&Ok(e)||e["@@iterator"];if(!r){if(wk(e)||(r=qk(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}}}}function JT(e,t){return function(e){if(wk(e))return e}(e)||function(e,t){var r=null==e?null:void 0!==_l&&Ok(e)||e["@@iterator"];if(null!=r){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(c){s=!0,i=c}finally{try{a||null==r.return||r.return()}finally{if(s)throw i}}return o}}(e,t)||qk(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 ZT(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}!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=mb,i=yb(t),o={browserDetails:i,commonShim:YT,extractVersion:fb,disableLog:vb,disableWarnings:_b,sdp:BT};switch(i.browser){case"chrome":if(!Rk||!Ik||!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=Rk,qT(t,i),WT(t),mk(t,i),gk(t),Ik(t,i),yk(t),Tk(t,i),Sk(t),Ek(t),bk(t),Ak(t,i),jT(t),GT(t),KT(t),HT(t,i),zT(t),XT(t,i);break;case"firefox":if(!_T||!sT||!r.shimFirefox)return n("Firefox shim is not included in this adapter release."),o;n("adapter.js shimming firefox."),o.browserShim=_T,qT(t,i),WT(t),oT(t,i),sT(t,i),aT(t),dT(t),cT(t),uT(t),lT(t),hT(t),fT(t),pT(t),vT(t),jT(t),KT(t),HT(t,i),zT(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,qT(t,i),WT(t),bT(t),TT(t),yT(t),mT(t),gT(t),kT(t),ST(t),IT(t),jT(t),GT(t),HT(t,i),zT(t),XT(t,i);break;default:n("Unsupported browser!")}}({window:"undefined"==typeof window?void 0:window});var $T=Ye,eI=function(e){return void 0!==e&&($T(e,"value")||$T(e,"writable"))},tI=D,rI=$,nI=tr,iI=eI,oI=R,aI=mc;Rr({target:"Reflect",stat:!0},{get:function e(t,r){var n,i,o=arguments.length<3?t:arguments[2];return nI(t)===o?t[r]:(n=oI.f(t,r))?iI(n)?n.value:void 0===n.get?void 0:tI(n.get,o):rI(i=aI(t))?e(i,r,o):void 0}});var sI=ee.Reflect.get,cI=b,uI=Ce,dI=$,lI=Ye,hI=rs,fI=o,pI=Function,vI=cI([].concat),_I=cI([].join),mI={},gI=function(e,t,r){if(!lI(mI,t)){for(var n=[],i=0;i<t;i++)n[i]="a["+i+"]";mI[t]=pI("C,a","return new C("+_I(n,",")+")")}return mI[t](e,r)},yI=fI?pI.bind:function(e){var t=uI(this),r=t.prototype,n=hI(arguments,1),i=function(){var r=vI(n,hI(arguments));return this instanceof i?gI(t,r.length,r):t.apply(e,r)};return dI(r)&&(i.prototype=r),i},SI=yI;Rr({target:"Function",proto:!0,forced:Function.bind!==SI},{bind:SI});var EI=Us("Function").bind,bI=ae,kI=EI,TI=Function.prototype,II=function(e){var t=e.bind;return e===TI||bI(TI,e)&&t===TI.bind?kI:t};function AI(e){var t;return(AI=Gl?II(t=jl).call(t):function(e){return e.__proto__||jl(e)})(e)}function RI(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=AI(e)););return e}function wI(){var e;"undefined"!=typeof Reflect&&sI?wI=II(e=sI).call(e):wI=function(e,t,r){var n=RI(e,t);if(n){var i=tc(n,t);return i.get?i.get.call(arguments.length<3?e:r):i.value}};return wI.apply(this,arguments)}function CI(e,t){var r;return(CI=Gl?II(r=Gl).call(r):function(e,t){return e.__proto__=t,e})(e,t)}function OI(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Ul(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),ad(e,"prototype",{writable:!1}),t&&CI(e,t)}var DI=Rr,xI=d,NI=yI,PI=yf,MI=tr,LI=$,UI=Hn,VI=i,FI=oe("Reflect","construct"),BI=Object.prototype,jI=[].push,GI=VI((function(){function e(){}return!(FI((function(){}),[],e)instanceof e)})),HI=!VI((function(){FI((function(){}))})),zI=GI||HI;DI({target:"Reflect",stat:!0,forced:zI,sham:zI},{construct:function(e,t){PI(e),MI(t);var r=arguments.length<3?e:PI(arguments[2]);if(HI&&!GI)return FI(e,t,r);if(e==r){switch(t.length){case 0:return new e;case 1:return new e(t[0]);case 2:return new e(t[0],t[1]);case 3:return new e(t[0],t[1],t[2]);case 4:return new e(t[0],t[1],t[2],t[3])}var n=[null];return xI(jI,n,t),new(xI(NI,e,n))}var i=r.prototype,o=UI(LI(i)?i:BI),a=xI(e,o,t);return LI(a)?a:o}});var KI=ee.Reflect.construct;function XI(e,t){if(t&&("object"===Ml(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return ZT(e)}function qI(e){var t=function(){if("undefined"==typeof Reflect||!KI)return!1;if(KI.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(KI(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=AI(e);if(t){var i=AI(this).constructor;r=KI(n,arguments,i)}else r=n.apply(this,arguments);return XI(this,r)}}var WI=Us("Array").values,YI=vn,QI=Ye,JI=ae,ZI=WI,$I=Array.prototype,eA={DOMTokenList:!0,NodeList:!0},tA=function(e){var t=e.values;return e===$I||JI($I,e)&&t===$I.values||QI(eA,YI(e))?ZI:t},rA=ni,nA=Math.floor,iA=function(e,t){var r=e.length,n=nA(r/2);return r<8?oA(e,t):aA(e,iA(rA(e,0,n),t),iA(rA(e,n),t),t)},oA=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},aA=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},sA=iA,cA=se.match(/firefox\/(\d+)/i),uA=!!cA&&+cA[1],dA=/MSIE|Trident/.test(se),lA=se.match(/AppleWebKit\/(\d+)\./),hA=!!lA&&+lA[1],fA=Rr,pA=b,vA=Ce,_A=Xe,mA=Br,gA=Jb,yA=gn,SA=i,EA=sA,bA=Iu,kA=uA,TA=dA,IA=pe,AA=hA,RA=[],wA=pA(RA.sort),CA=pA(RA.push),OA=SA((function(){RA.sort(void 0)})),DA=SA((function(){RA.sort(null)})),xA=bA("sort"),NA=!SA((function(){if(IA)return IA<70;if(!(kA&&kA>3)){if(TA)return!0;if(AA)return AA<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++)RA.push({k:t+n,v:r})}for(RA.sort((function(e,t){return t.v-e.v})),n=0;n<RA.length;n++)t=RA[n].k.charAt(0),i.charAt(i.length-1)!==t&&(i+=t);return"DGBEFHACIJK"!==i}}));fA({target:"Array",proto:!0,forced:OA||!DA||!xA||!NA},{sort:function(e){void 0!==e&&vA(e);var t=_A(this);if(NA)return void 0===e?wA(t):wA(t,e);var r,n,i=[],o=mA(t);for(n=0;n<o;n++)n in t&&CA(i,t[n]);for(EA(i,function(e){return function(t,r){return void 0===r?-1:void 0===t?1:void 0!==e?+e(t,r)||0:yA(t)>yA(r)?1:-1}}(e)),r=mA(i),n=0;n<r;)t[n]=i[n++];for(;n<o;)gA(t,n++);return t}});var PA=Us("Array").sort,MA=ae,LA=PA,UA=Array.prototype,VA=function(e){var t=e.sort;return e===UA||MA(UA,e)&&t===UA.sort?LA:t},FA=Rr,BA=Po.findIndex,jA="findIndex",GA=!0;jA in[]&&Array(1).findIndex((function(){GA=!1})),FA({target:"Array",proto:!0,forced:GA},{findIndex:function(e){return BA(this,e,arguments.length>1?arguments[1]:void 0)}});var HA=Us("Array").findIndex,zA=ae,KA=HA,XA=Array.prototype,qA=function(e){var t=e.findIndex;return e===XA||zA(XA,e)&&t===XA.findIndex?KA:t},WA=Rr,YA=b;R.f;var QA=Vr,JA=gn,ZA=Lm,$A=q,eR=Vm,tR=YA("".startsWith),rR=YA("".slice),nR=Math.min;WA({target:"String",proto:!0,forced:!eR("startsWith")},{startsWith:function(e){var t=JA($A(this));ZA(e);var r=QA(nR(arguments.length>1?arguments[1]:void 0,t.length)),n=JA(e);return tR?tR(t,n,r):rR(t,r,r+n.length)===n}});var iR=Us("String").startsWith,oR=ae,aR=iR,sR=String.prototype,cR=function(e){var t=e.startsWith;return"string"==typeof e||e===sR||oR(sR,e)&&t===sR.startsWith?aR:t},uR=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.INTERRUPT="INTERRUPT",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_EXCEED_QPS="USER_MESSAGE_EXCEED_QPS",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.SUBTITLE_ALREADY_ON="SUBTITLE_ALREADY_ON",e.SUBTITLE_NOT_TURNED_ON="SUBTITLE_NOT_TURNED_ON",e.SUBTITLE_ERR_POSTPROCESS="SUBTITLE_ERR_POSTPROCESS",e.SUBTITLE_ERR_CONNECTION_ERROR="SUBTITLE_ERR_CONNECTION_ERROR",e.SUBTITLE_ERR_PROCESS_ERROR="SUBTITLE_ERR_PROCESS_ERROR",e.SUBTITLE_ERR_UNKNOWN="SUBTITLE_ERR_UNKNOWN",e}(uR||{}),dR=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}(dR||{}),lR=qd((function e(t,r,n){Wd(this,e),sd(this,"code",void 0),sd(this,"message",void 0),sd(this,"error",void 0),this.code=t,this.message=r,this.error=n})),hR=w,fR=b,pR=rn,vR=Q,_R=fR(x.f),mR=fR([].push),gR=function(e){return function(t){for(var r,n=vR(t),i=pR(n),o=i.length,a=0,s=[];o>a;)r=i[a++],hR&&!_R(n,r)||mR(s,e?[r,n[r]]:n[r]);return s}},yR={entries:gR(!0),values:gR(!1)}.entries;Rr({target:"Object",stat:!0},{entries:function(e){return yR(e)}});var SR=ee.Object.entries,ER=Dr,bR=gn,kR=q,TR=RangeError,IR=b,AR=Vr,RR=gn,wR=function(e){var t=bR(kR(this)),r="",n=ER(e);if(n<0||n==1/0)throw TR("Wrong number of repetitions");for(;n>0;(n>>>=1)&&(t+=t))1&n&&(r+=t);return r},CR=q,OR=IR(wR),DR=IR("".slice),xR=Math.ceil,NR=function(e){return function(t,r,n){var i,o,a=RR(CR(t)),s=AR(r),c=a.length,u=void 0===n?" ":RR(n);return s<=c||""==u?a:((o=OR(u,xR((i=s-c)/u.length))).length>i&&(o=DR(o,0,i)),e?a+o:o+a)}},PR={start:NR(!1),end:NR(!0)},MR=/Version\/10(?:\.\d+){1,2}(?: [\w./]+)?(?: Mobile\/\w+)? Safari\//.test(se),LR=PR.end;Rr({target:"String",proto:!0,forced:MR},{padEnd:function(e){return LR(this,e,arguments.length>1?arguments[1]:void 0)}});var UR=Us("String").padEnd,VR=ae,FR=UR,BR=String.prototype,jR=function(e){var t=e.padEnd;return"string"==typeof e||e===BR||VR(BR,e)&&t===BR.padEnd?FR:t},GR=wg;Rr({target:"Number",stat:!0,forced:Number.parseInt!=GR},{parseInt:GR});var HR=ee.Number.parseInt,zR=Math.log,KR=Math.LOG10E;Rr({target:"Math",stat:!0},{log10:Math.log10||function(e){return zR(e)*KR}});var XR,qR=ee.Math.log10,WR=new Uint8Array(16);function YR(){if(!XR&&!(XR="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 XR(WR)}var QR=/^(?:[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 JR(e){return"string"==typeof e&&QR.test(e)}for(var ZR,$R,ew,tw=[],rw=0;rw<256;++rw)tw.push((rw+256).toString(16).substr(1));function nw(e,t,r){var n=(e=e||{}).random||(e.rng||YR)();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=(tw[e[t+0]]+tw[e[t+1]]+tw[e[t+2]]+tw[e[t+3]]+"-"+tw[e[t+4]]+tw[e[t+5]]+"-"+tw[e[t+6]]+tw[e[t+7]]+"-"+tw[e[t+8]]+tw[e[t+9]]+"-"+tw[e[t+10]]+tw[e[t+11]]+tw[e[t+12]]+tw[e[t+13]]+tw[e[t+14]]+tw[e[t+15]]).toLowerCase();if(!JR(r))throw TypeError("Stringified UUID is invalid");return r}(n)}var iw=new TextDecoder,ow=new TextEncoder,aw=function(){return nw()},sw=function(){return Date.now()};function cw(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 c=new e(t),u=0,d=0,l=n;d<l.length;d++){var h=l[d];c.set(h,u),u+=h.length}return c}var uw=function(){return"undefined"==typeof window},dw=function(){function e(){Wd(this,e)}var t,r;return qd(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){var n;return window.btoa(Gs(n=[e,t,r]).call(n,(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]:{},n=0,i=SR(t);n<i.length;n++){var o=JT(i[n],2),a=o[0],s=o[1];null!==s&&"object"===Ml(s)?e.merge(t[a],r[a]):void 0!==r[a]&&(t[a]=r[a])}}},{key:"ab2str",value:function(e){return iw.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 ow.encode(e).buffer}},{key:"ab2b64str",value:(r=km(Em().mark((function e(t){var r;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,new X_((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=km(Em().mark((function e(t){return Em().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 lw(){var e="none";return uw()||(null!==window.navigator.userAgent.match("Firefox")?e="mozilla":null!==window.navigator.userAgent.match("Chrome")?(e="chrome-stable",null!==window.navigator.userAgent.match("Electron")&&(e="electron")):(null!==window.navigator.userAgent.match("Safari")||null!==window.navigator.userAgent.match("AppleWebKit"))&&(e="safari")),e}var hw=function(){if("chrome-stable"===lw()){var e=window.navigator.userAgent.match(/Chrome\/([\d.]+)/);if(e&&e.length>1)if(Number(e[1].split(".")[0])<114)return!0}return!1}(),fw="mozilla"===lw(),pw="safari"===lw(),vw=0,_w=!uw()&&(null===(ZR=navigator.userAgent.match(/version\/(\d+)/i))||void 0===ZR?void 0:ZR[1]);pw&&_w&&(vw=+_w);var mw=!uw()&&(null===($R=navigator.userAgent.match(/Firefox\/(\d+)/i))||void 0===$R?void 0:$R[1]);fw&&mw&&(vw=+mw);var gw=vw,yw=vw,Sw=!uw()&&!!/(iPhone|iPad|iPod)/i.exec(navigator.userAgent);!uw()&&/(iPhone|iPod)/i.exec(navigator.userAgent);var Ew=!uw()&&(!!/(iPad)/i.exec(navigator.userAgent)||/Macintosh/i.test(navigator.userAgent)&&"ontouchend"in document),bw=!uw()&&/MicroMessenger/i.test(navigator.userAgent),kw=!uw()&&/Android/i.test(navigator.userAgent);!uw()&&Jm(ew=navigator.userAgent.toLowerCase()).call(ew,"mobile");var Tw=!uw()&&/chrome\/(86)|(87)|(88)|(89)|(90)|(91)|(92)/i.test(navigator.userAgent);function Iw(){for(var e,t,r=(+jR(e=Sm(t="".concat(Math.random())).call(t,-7)).call(e,7,"0")).toString(2),n=jR(r).call(r,28,"1").split(""),i=[];n.length;)i.push(vk(n).call(n,0,7));return sg(i).call(i,(function(e,t){var r=t===i.length-1?"0":"1";return HR(r+e.join(""),2)}))}var Aw=function(){return Math.floor(65535*Math.random())};function Rw(e){return"string"==typeof e&&Hb(e).call(e,"__web__rtc__rtt__")>-1}function ww(e){return sg(e).call(e,(function e(t){var r;if(null!=t&&t._reportName)return t._reportName;if(t instanceof HTMLElement)return t.toString();if(t instanceof ArrayBuffer||ArrayBuffer.isView(t)){var n,i,o=ArrayBuffer.isView(t)?t.buffer:t,a=o.byteLength,s=[];if(a>10){var c,u,d,l,h=new DataView(o),f=sg(c=Xk({length:5})).call(c,(function(e,t){return h.getUint8(t)})),p=sg(u=sg(d=Xk({length:5})).call(d,(function(e,t){return a-1-t})).reverse()).call(u,(function(e){return h.getUint8(e)}));s=wm(l=[]).call(l,Wk(f),["..."],Wk(p))}else s=Xk(new Uint8Array(o));return wm(n=wm(i="".concat(t.constructor.name,"(")).call(i,a,") [")).call(n,s.join(", "),"]")}if(t instanceof ImageData)return"ImageData";if(Array.isArray(t))return sg(t).call(t,e);if(Jm(r=["[object Object]","[object MediaStreamTrack]"]).call(r,Object.prototype.toString.call(t))){var v={};for(var _ in t)v[_]=e(t[_]);return v}return t}))}var Cw=function(){var e=km(Em().mark((function e(){var t,r,n,i=arguments;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=i.length>0&&void 0!==i[0]&&i[0],(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=8,r.createOffer();case 8:return n=e.sent,r.close(),e.abrupt("return",n.sdp);case 11:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),Ow=function(e){return new X_((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 Dw(e){return+Math.max(-127,10*qR(Math.pow(e/255,2))).toFixed(2)}function xw(e){return(e&Sd.AUDIO)===Sd.AUDIO}function Nw(e){return(e&Sd.VIDEO)===Sd.VIDEO}function Pw(e){var t={};return an(e).forEach((function(r){"object"===Ml(e[r])?t[r]=Pw(e[r]):cR(r).call(r,"_")||(t[r]=e[r])})),t}function Mw(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 Lw(e){return null==e?"undefined | null":"string"==typeof e?e:tg({contentHint:e.contentHint,enabled:e.enabled,id:e.id,kind:e.kind,label:e.label,muted:e.muted,readyState:e.readyState})}function Uw(e){return void 0===e}function Vw(e){return function(t,r,n){var i=n.value;n.value=function(){var t;console.warn(wm(t="[RTC WebSDK]: Api: ".concat(r," has been abandoned from version ")).call(t,e));for(var n=arguments.length,o=new Array(n),a=0;a<n;a++)o[a]=arguments[a];return i.apply(this,o)}}}function Fw(e){console.warn("[RTC WebSDK]: "+e)}function Bw(e){return"number"==typeof e?e:"number"==typeof(null==e?void 0:e.exact)?e.exact:"number"==typeof(null==e?void 0:e.ideal)?e.ideal:"number"==typeof(null==e?void 0:e.max)?e.max:"number"==typeof(null==e?void 0:e.min)?e.min:1}var jw=function(){function e(){Wd(this,e),sd(this,"_running",!1),sd(this,"_queue",[])}return qd(e,[{key:"add",value:function(e,t){this._queue.push([e,t]),this._running||(this._running=!0,this._process())}},{key:"_process",value:function(){var e=this,t=JT(this._queue.shift()||[],2),r=t[0],n=t[1];r&&n?r.then((function(t){n(t),e._process()})).catch((function(){e._process()})):this._running=!1}}]),e}();function Gw(e,t){if("boolean"!=typeof e)throw new lR(uR.INVALID_PARAMS,"Invalid ".concat(t,": The value should be boolean type."))}function Hw(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,o,a=new lR(uR.INVALID_PARAMS,wm(i=wm(o="Invalid ".concat(t,": the value range is [")).call(o,r,", ")).call(i,n,"]. integer only"));throw a}}function zw(e,t){var r,n,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:Number.POSITIVE_INFINITY;if(null==e)throw new lR(uR.INVALID_PARAMS,"".concat(t," cannot be empty"));if(!Qw(e,i,o))throw new lR(uR.INVALID_PARAMS,wm(r=wm(n="Invalid ".concat(t,": The value should be string type. Length of the string: [")).call(n,i,",")).call(r,o,"]"))}function Kw(e,t,r){var n;if(!Jm(r).call(r,e))throw new lR(uR.INVALID_PARAMS,wm(n="Invalid ".concat(t,": The value can only be set as ")).call(n,tg(r)))}function Xw(e){if(!(e instanceof MediaStreamTrack))throw new lR(uR.INVALID_PARAMS,"Invalid track, The value should be MediaStreamTrack type.")}function qw(e,t){if(Jw(e))throw new lR(uR.INVALID_PARAMS,"Invalid ".concat(t,", should not be empty"))}function Ww(e,t){if(!(e instanceof ArrayBuffer))throw new lR(uR.INVALID_PARAMS,"Invalid ".concat(t,", should be ArrayBuffer"))}function Yw(e){try{for(var t=navigator.mediaDevices.getSupportedConstraints(),r=0,n=an(e);r<n.length;r++){var i=n[r];t[i]||delete e[i]}}catch(o){}}function Qw(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 Jw(e){return null==e}function Zw(e){if("string"!=typeof e||!/^[a-zA-Z0-9@._\-]{1,128}$/.test(e))throw new lR(uR.INVALID_PARAMS,"The RoomId must be within 128 bytes. The supported characters: a-z,A-Z,0-9,@,-,_,.")}function $w(e){if("string"!=typeof e||!/^[a-zA-Z0-9@._\-]{1,128}$/.test(e))throw new lR(uR.INVALID_PARAMS,"The userId must be within 128 bytes. The supported characters: a-z,A-Z,0-9,@,-,_,.")}function eC(e){if("string"!=typeof e||!/^[a-zA-Z0-9@._\-]{1,128}$/.test(e))throw new lR(uR.INVALID_PARAMS,"The publicStreamId must be within 128 bytes. The supported characters: a-z,A-Z,0-9,@,-,_,.")}function tC(e){qw(e,"userInfo"),$w(e.userId),Jw(e.extraInfo)||zw(e.extraInfo,"userInfo.extraInfo",1,200)}function rC(e){qw(e,"roomConfig"),Gw(e.isAutoPublish,"roomConfig.isAutoPublish"),Gw(e.isAutoSubscribeAudio,"roomConfig.isAutoSubscribeAudio"),Gw(e.isAutoSubscribeVideo,"roomConfig.isAutoSubscribeVideo"),Jw(e.roomProfileType)||Kw(e.roomProfileType,"roomConfig",[xd.communication,xd.chat,xd.chatRoom,xd.coHost,xd.meeting,xd.classRoom])}function nC(e){qw(e,"videoPlayerOption")}function iC(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 lR(uR.INVALID_PARAMS,"The message cannot be empty");if((null===(t=e instanceof ArrayBuffer?e:dw.str2ab(tg(e)))||void 0===t?void 0:t.byteLength)>1e3*r)throw new lR(uR.INVALID_PARAMS,"The message length must be less than ".concat(r,"K"))}function oC(e){var t;return!Jm(t=[Kd.onRemoteStreamStats,Kd.onLocalStreamStats,Kd.onAudioVolumeIndication,Kd.onLocalAudioPropertiesReport,Kd.onRemoteAudioPropertiesReport]).call(t,e)}function aC(e){if("number"!=typeof(null==e?void 0:e.width)||"number"!=typeof(null==e?void 0:e.height))throw new lR(uR.INVALID_PARAMS,"remoteVideoConfig must contain width, height, frameRate")}function sC(e,t){if("number"!=typeof e||Number.isNaN(e)||!(e>=1)){var r=e;if(!(null!=r&&r.min||null!=r&&r.max||null!=r&&r.exact||null!=r&&r.ideal))throw new lR(uR.INVALID_PARAMS,"".concat(t," is not a valid ConstrainULong"))}}function cC(e){var t,r=QT(e);try{for(r.s();!(t=r.n()).done;){var n=t.value;Hw(null==n?void 0:n.maxKbps,"maxKbps"),sC(null==n?void 0:n.width,"width"),sC(null==n?void 0:n.height,"height"),sC(null==n?void 0:n.frameRate,"frameRate")}}catch(i){r.e(i)}finally{r.f()}}var uC={exports:{}};!function(e){var t=Object.prototype.hasOwnProperty,r="~";function n(){}function i(e,t,r){this.fn=e,this.context=t,this.once=r||!1}function o(e,t,n,o,a){if("function"!=typeof n)throw new TypeError("The listener must be a function");var s=new i(n,o||e,a),c=r?r+t:t;return e._events[c]?e._events[c].fn?e._events[c]=[e._events[c],s]:e._events[c].push(s):(e._events[c]=s,e._eventsCount++),e}function a(e,t){0==--e._eventsCount?e._events=new n:delete e._events[t]}function s(){this._events=new n,this._eventsCount=0}Object.create&&(n.prototype=Object.create(null),(new n).__proto__||(r=!1)),s.prototype.eventNames=function(){var e,n,i=[];if(0===this._eventsCount)return i;for(n in e=this._events)t.call(e,n)&&i.push(r?Sm(n).call(n,1):n);return Os?wm(i).call(i,Os(e)):i},s.prototype.listeners=function(e){var t=r?r+e:e,n=this._events[t];if(!n)return[];if(n.fn)return[n.fn];for(var i=0,o=n.length,a=new Array(o);i<o;i++)a[i]=n[i].fn;return a},s.prototype.listenerCount=function(e){var t=r?r+e:e,n=this._events[t];return n?n.fn?1:n.length:0},s.prototype.emit=function(e,t,n,i,o,a){var s=r?r+e:e;if(!this._events[s])return!1;var c,u,d=this._events[s],l=arguments.length;if(d.fn){switch(d.once&&this.removeListener(e,d.fn,void 0,!0),l){case 1:return d.fn.call(d.context),!0;case 2:return d.fn.call(d.context,t),!0;case 3:return d.fn.call(d.context,t,n),!0;case 4:return d.fn.call(d.context,t,n,i),!0;case 5:return d.fn.call(d.context,t,n,i,o),!0;case 6:return d.fn.call(d.context,t,n,i,o,a),!0}for(u=1,c=new Array(l-1);u<l;u++)c[u-1]=arguments[u];d.fn.apply(d.context,c)}else{var h,f=d.length;for(u=0;u<f;u++)switch(d[u].once&&this.removeListener(e,d[u].fn,void 0,!0),l){case 1:d[u].fn.call(d[u].context);break;case 2:d[u].fn.call(d[u].context,t);break;case 3:d[u].fn.call(d[u].context,t,n);break;case 4:d[u].fn.call(d[u].context,t,n,i);break;default:if(!c)for(h=1,c=new Array(l-1);h<l;h++)c[h-1]=arguments[h];d[u].fn.apply(d[u].context,c)}}return!0},s.prototype.on=function(e,t,r){return o(this,e,t,r,!1)},s.prototype.once=function(e,t,r){return o(this,e,t,r,!0)},s.prototype.removeListener=function(e,t,n,i){var o=r?r+e:e;if(!this._events[o])return this;if(!t)return a(this,o),this;var s=this._events[o];if(s.fn)s.fn!==t||i&&!s.once||n&&s.context!==n||a(this,o);else{for(var c=0,u=[],d=s.length;c<d;c++)(s[c].fn!==t||i&&!s[c].once||n&&s[c].context!==n)&&u.push(s[c]);u.length?this._events[o]=1===u.length?u[0]:u:a(this,o)}return this},s.prototype.removeAllListeners=function(e){var t;return e?(t=r?r+e:e,this._events[t]&&a(this,t)):(this._events=new n,this._eventsCount=0),this},s.prototype.off=s.prototype.removeListener,s.prototype.addListener=s.prototype.on,s.prefixed=r,s.EventEmitter=s,e.exports=s}(uC);var dC,lC=uC.exports,hC=Us("Array").keys,fC=vn,pC=Ye,vC=ae,_C=hC,mC=Array.prototype,gC={DOMTokenList:!0,NodeList:!0},yC=function(e){var t=e.keys;return e===mC||vC(mC,e)&&t===mC.keys||pC(gC,fC(e))?_C:t},SC="@byted/ve-rtc",EC="@byted/ve-rtc-cache-size",bC=function(){function e(){Wd(this,e),sd(this,"storeKey",void 0),sd(this,"logLevel",void 0),sd(this,"LogfileSize",void 0),sd(this,"db",void 0),sd(this,"logId",void 0),sd(this,"cacheLog",void 0),sd(this,"cachedSize",void 0),sd(this,"preCacheTime",void 0),sd(this,"timer",void 0),sd(this,"_getSize",(function(e){return new Blob(e).size/1048576})),this.storeKey="",this.logId=1,this.cacheLog="",this.logLevel="none",this.LogfileSize=100,this._createStore()}return qd(e,[{key:"_createStore",value:function(){var e=this;if(!uw()&&window.indexedDB){var t=indexedDB.open("@byted/ve-rtc");t.onupgradeneeded=function(){t.result.createObjectStore(SC);try{localStorage.removeItem(EC)}catch(EW){}},t.onerror=function(e){},t.onsuccess=function(){e.db=t.result,e._getCachedSize()}}}},{key:"_getCachedSize",value:function(){var e=this;try{var t=localStorage.getItem(EC);if(t)this.cachedSize=+t;else tA(this).call(this).then((function(t){e.cachedSize=e._getSize(t),e._setCachedSize()}))}catch(EW){}}},{key:"_setCachedSize",value:function(){try{localStorage.setItem(EC,"".concat(this.cachedSize))}catch(EW){}}},{key:"_getStore",value:function(e){if(this.db)return this.db.transaction(SC,e).objectStore(SC)}},{key:"set",value:function(e){var t=this;return new X_((function(r,n){if("none"===t.logLevel)return r();var i;if(e&&t.preCacheTime&&t.preCacheTime-Date.now()<1e3)return t.cacheLog+=wm(i="\n\n".concat(t.logId,": ")).call(i,e),t.logId++,t.timer||(t.timer=setTimeout((function(){t.set("")}),1e3-(t.preCacheTime-Date.now()))),r();clearTimeout(t.timer),t.timer=null;var o=t._getStore("readwrite");if(!o)return n("get store fail");t.cachedSize&&t.cachedSize>t.LogfileSize&&t.keyEarliest().then((function(e){t.get(e).then((function(r){t.del(e).then((function(){t.cachedSize=t.cachedSize-t._getSize(["".concat(r)]),t._setCachedSize()}))}))}));var a=o.get(t.storeKey);a.onsuccess=function(){try{var i,s,c,u,d,l=wm(i="".concat(a.result||"")).call(i,t.cacheLog),h=e?wm(s=wm(c="".concat(l?"\n\n":"")).call(c,t.logId,": ")).call(s,e):"";o.put(wm(u="".concat(l)).call(u,h),t.storeKey),e&&t.logId++,t.cacheLog="",t.cachedSize=(t.cachedSize||0)+t._getSize([wm(d="".concat(t.cacheLog)).call(d,h)]),t._setCachedSize(),t.preCacheTime=Date.now(),r()}catch(p){var f;if(!e)return n(p);t.cacheLog+=wm(f="\n\n".concat(t.logId,": ")).call(f,e),t.logId++,n(p)}},a.onerror=function(r){var i;if(!e)return n(r);t.cacheLog+=wm(i="\n\n".concat(t.logId,": ")).call(i,e),t.logId++,n(r)}}))}},{key:"get",value:function(e){var t=this;return new X_((function(r,n){var i=t._getStore("readonly");if(!i)return n();var o=i.get(e);o.onsuccess=function(){r(o.result)},o.onerror=function(e){n(e)}}))}},{key:"del",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.storeKey;return new X_((function(r,n){var i=e._getStore("readwrite");if(!i)return n();var o=i.delete(t);o.onsuccess=function(){return r(o.result)},o.onerror=function(e){return n(e)}}))}},{key:"keyEarliest",value:function(){return yC(this).call(this).then((function(e){var t,r=Date.now();return e.forEach((function(e){if(e&&e.length){var n=e.split("-")[0];Number(n)<r&&(r=Number(n),t=e)}})),t}))}},{key:"keys",value:function(){var e=this;return new X_((function(t,r){var n=e._getStore("readonly");if(!n)return r();if(n.getAllKeys){var i=n.getAllKeys();return i.onsuccess=function(){t(i.result)},void(i.onerror=function(){r()})}var o=[];n.openCursor().onsuccess=function(){this.result&&(o.push(this.result.key),this.result.continue())},n.transaction.oncomplete=function(){return t(o)}}))}},{key:"values",value:function(){var e=this;return new X_((function(t,r){var n=e._getStore("readonly");if(!n)return r();if(n.getAll){var i=n.getAll();return i.onsuccess=function(){t(i.result)},void(i.onerror=function(){r()})}var o=[];n.openCursor().onsuccess=function(){this.result&&(o.push(this.result.value),this.result.continue())},n.transaction.oncomplete=function(){return t(o)}}))}},{key:"download",value:function(e){e=e||this.storeKey,this.get(e).then((function(t){var r=document.createElement("a");r.download="".concat(e,".txt"),r.href="data:text/paint;utf-8,"+(t||""),r.click()}))}}]),e}(),kC=new bC,TC="[VERTC]",IC=["#0050b3","#0050b3","#0050b3","#0050b3","#0050b3"],AC=!uw()&&Jm(dC=window.location.search).call(dC,"_rtc_debug_"),RC=function(){function e(t,r,n){Wd(this,e),sd(this,"_indent",void 0),sd(this,"_module",void 0),sd(this,"_id",void 0),this._module=t,this._indent=r}return qd(e,[{key:"print",value:function(e){for(var t,r,n,i,o,a,s,c=arguments.length,u=new Array(c>1?c-1:0),d=1;d<c;d++)u[d-1]=arguments[d];var l=u.shift();try{var h,f,p,v,_=wm(h=[]).call(h,u),m="".concat(l).replace(/\%o/gi,(function(){var e=_.shift();return tg(e)}));kC.set(wm(f=wm(p=wm(v="".concat(TC,"[").concat(this._module,".")).call(v,e,"] ")).call(p,m," ")).call(f,sg(_).call(_,(function(e){return tg(e)})).join(", ")))}catch(EW){}if(AC){for(var g="",y=0;y<this._indent;y++)g+=" ";(t=console).log.apply(t,wm(r=[wm(n=wm(i=wm(o=wm(a=wm(s="%c".concat(wC(),"-")).call(s,TC)).call(a,g,"[")).call(o,this._module,".")).call(i,e,"] ")).call(n,l),"color:".concat(IC[this._indent],";")]).call(r,u))}}}]),e}(),wC=function(){var e=new Date;return e.toTimeString().split(" ")[0]+":"+e.getMilliseconds()},CC=new RC("VERTC",0),OC=function(e){OI(r,e);var t=qI(r);function r(){return Wd(this,r),t.apply(this,arguments)}return qd(r,[{key:"safeEmit",value:function(e){var t=this.listenerCount(e);try{for(var n,i,o=arguments.length,a=new Array(o>1?o-1:0),s=1;s<o;s++)a[s-1]=arguments[s];return(n=wI(AI(r.prototype),"emit",this)).call.apply(n,wm(i=[this,e]).call(i,a))}catch(EW){return CC.print("safeEmit","safeEmit() | event listener threw an error [event:%s]:%o",e,EW),console.error(EW),Boolean(t)}}}]),r}(uC.exports.EventEmitter),DC=D,xC=tr,NC=$,PC=eI,MC=Qt,LC=R,UC=mc,VC=V;Rr({target:"Reflect",stat:!0,forced:i((function(){var e=function(){},t=MC.f(new e,"a",{configurable:!0});return!1!==Reflect.set(e.prototype,"a",1,t)}))},{set:function e(t,r,n){var i,o,a,s=arguments.length<4?t:arguments[3],c=LC.f(xC(t),r);if(!c){if(NC(o=UC(t)))return e(o,r,n,s);c=VC(0)}if(PC(c)){if(!1===c.writable||!NC(s))return!1;if(i=LC.f(s,r)){if(i.get||i.set||!1===i.writable)return!1;i.value=n,MC.f(s,r,i)}else MC.f(s,r,VC(0,n))}else{if(void 0===(a=c.set))return!1;DC(a,s,n)}return!0}});var FC=ee.Reflect.set,BC={};!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=Sm(Array.prototype).call(arguments,1);t.length;){var n=t.shift();if(n){if("object"!==Ml(n))throw new TypeError(n+"must be non-object");for(var i in n)r(n,i)&&(e[i]=n[i])}}return e},e.shrinkBuf=function(e,t){return e.length===t?e:e.subarray?e.subarray(0,t):(e.length=t,e)};var n={arraySet:function(e,t,r,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}},i={arraySet:function(e,t,r,n,i){for(var o=0;o<n;o++)e[i+o]=t[r+o]},flattenChunks:function(e){return wm([]).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,i))},e.setTyped(t)}(BC);var jC={},GC={},HC={},zC=BC;function KC(e){for(var t=e.length;--t>=0;)e[t]=0}var XC=256,qC=286,WC=30,YC=15,QC=[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],JC=[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],ZC=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],$C=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],eO=new Array(576);KC(eO);var tO=new Array(60);KC(tO);var rO=new Array(512);KC(rO);var nO=new Array(256);KC(nO);var iO=new Array(29);KC(iO);var oO,aO,sO,cO=new Array(WC);function uO(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 dO(e,t){this.dyn_tree=e,this.max_code=0,this.stat_desc=t}function lO(e){return e<256?rO[e]:rO[256+(e>>>7)]}function hO(e,t){e.pending_buf[e.pending++]=255&t,e.pending_buf[e.pending++]=t>>>8&255}function fO(e,t,r){e.bi_valid>16-r?(e.bi_buf|=t<<e.bi_valid&65535,hO(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 pO(e,t,r){fO(e,r[2*t],r[2*t+1])}function vO(e,t){var r=0;do{r|=1&e,e>>>=1,r<<=1}while(--t>0);return r>>>1}function _O(e,t,r){var n,i,o=new Array(16),a=0;for(n=1;n<=YC;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]=vO(o[s]++,s))}}function mO(e){var t;for(t=0;t<qC;t++)e.dyn_ltree[2*t]=0;for(t=0;t<WC;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 gO(e){e.bi_valid>8?hO(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 yO(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 SO(e,t,r){for(var n=e.heap[r],i=r<<1;i<=e.heap_len&&(i<e.heap_len&&yO(t,e.heap[i+1],e.heap[i],e.depth)&&i++,!yO(t,n,e.heap[i],e.depth));)e.heap[r]=e.heap[i],r=i,i<<=1;e.heap[r]=n}function EO(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?pO(e,i,t):(pO(e,(o=nO[i])+XC+1,t),0!==(a=QC[o])&&fO(e,i-=iO[o],a),pO(e,o=lO(--n),r),0!==(a=JC[o])&&fO(e,n-=cO[o],a))}while(s<e.last_lit);pO(e,256,t)}function bO(e,t){var r,n,i,o=t.dyn_tree,a=t.stat_desc.static_tree,s=t.stat_desc.has_stree,c=t.stat_desc.elems,u=-1;for(e.heap_len=0,e.heap_max=573,r=0;r<c;r++)0!==o[2*r]?(e.heap[++e.heap_len]=u=r,e.depth[r]=0):o[2*r+1]=0;for(;e.heap_len<2;)o[2*(i=e.heap[++e.heap_len]=u<2?++u:0)]=1,e.depth[i]=0,e.opt_len--,s&&(e.static_len-=a[2*i+1]);for(t.max_code=u,r=e.heap_len>>1;r>=1;r--)SO(e,o,r);i=c;do{r=e.heap[1],e.heap[1]=e.heap[e.heap_len--],SO(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++,SO(e,o,1)}while(e.heap_len>=2);e.heap[--e.heap_max]=e.heap[1],function(e,t){var r,n,i,o,a,s,c=t.dyn_tree,u=t.max_code,d=t.stat_desc.static_tree,l=t.stat_desc.has_stree,h=t.stat_desc.extra_bits,f=t.stat_desc.extra_base,p=t.stat_desc.max_length,v=0;for(o=0;o<=YC;o++)e.bl_count[o]=0;for(c[2*e.heap[e.heap_max]+1]=0,r=e.heap_max+1;r<573;r++)(o=c[2*c[2*(n=e.heap[r])+1]+1]+1)>p&&(o=p,v++),c[2*n+1]=o,n>u||(e.bl_count[o]++,a=0,n>=f&&(a=h[n-f]),s=c[2*n],e.opt_len+=s*(o+a),l&&(e.static_len+=s*(d[2*n+1]+a)));if(0!==v){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]--,v-=2}while(v>0);for(o=p;0!==o;o--)for(n=e.bl_count[o];0!==n;)(i=e.heap[--r])>u||(c[2*i+1]!==o&&(e.opt_len+=(o-c[2*i+1])*c[2*i],c[2*i+1]=o),n--)}}(e,t),_O(o,u,e.bl_count)}function kO(e,t,r){var n,i,o=-1,a=t[1],s=0,c=7,u=4;for(0===a&&(c=138,u=3),t[2*(r+1)+1]=65535,n=0;n<=r;n++)i=a,a=t[2*(n+1)+1],++s<c&&i===a||(s<u?e.bl_tree[2*i]+=s:0!==i?(i!==o&&e.bl_tree[2*i]++,e.bl_tree[32]++):s<=10?e.bl_tree[34]++:e.bl_tree[36]++,s=0,o=i,0===a?(c=138,u=3):i===a?(c=6,u=3):(c=7,u=4))}function TO(e,t,r){var n,i,o=-1,a=t[1],s=0,c=7,u=4;for(0===a&&(c=138,u=3),n=0;n<=r;n++)if(i=a,a=t[2*(n+1)+1],!(++s<c&&i===a)){if(s<u)do{pO(e,i,e.bl_tree)}while(0!=--s);else 0!==i?(i!==o&&(pO(e,i,e.bl_tree),s--),pO(e,16,e.bl_tree),fO(e,s-3,2)):s<=10?(pO(e,17,e.bl_tree),fO(e,s-3,3)):(pO(e,18,e.bl_tree),fO(e,s-11,7));s=0,o=i,0===a?(c=138,u=3):i===a?(c=6,u=3):(c=7,u=4)}}KC(cO);var IO=!1;function AO(e,t,r,n){fO(e,0+(n?1:0),3),function(e,t,r,n){gO(e),n&&(hO(e,r),hO(e,~r)),zC.arraySet(e.pending_buf,e.window,t,r,e.pending),e.pending+=r}(e,t,r,!0)}HC._tr_init=function(e){IO||(!function(){var e,t,r,n,i,o=new Array(16);for(r=0,n=0;n<28;n++)for(iO[n]=r,e=0;e<1<<QC[n];e++)nO[r++]=n;for(nO[r-1]=n,i=0,n=0;n<16;n++)for(cO[n]=i,e=0;e<1<<JC[n];e++)rO[i++]=n;for(i>>=7;n<WC;n++)for(cO[n]=i<<7,e=0;e<1<<JC[n]-7;e++)rO[256+i++]=n;for(t=0;t<=YC;t++)o[t]=0;for(e=0;e<=143;)eO[2*e+1]=8,e++,o[8]++;for(;e<=255;)eO[2*e+1]=9,e++,o[9]++;for(;e<=279;)eO[2*e+1]=7,e++,o[7]++;for(;e<=287;)eO[2*e+1]=8,e++,o[8]++;for(_O(eO,287,o),e=0;e<WC;e++)tO[2*e+1]=5,tO[2*e]=vO(e,5);oO=new uO(eO,QC,257,qC,YC),aO=new uO(tO,JC,0,WC,YC),sO=new uO(new Array(0),ZC,0,19,7)}(),IO=!0),e.l_desc=new dO(e.dyn_ltree,oO),e.d_desc=new dO(e.dyn_dtree,aO),e.bl_desc=new dO(e.bl_tree,sO),e.bi_buf=0,e.bi_valid=0,mO(e)},HC._tr_stored_block=AO,HC._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<XC;t++)if(0!==e.dyn_ltree[2*t])return 1;return 0}(e)),bO(e,e.l_desc),bO(e,e.d_desc),a=function(e){var t;for(kO(e,e.dyn_ltree,e.l_desc.max_code),kO(e,e.dyn_dtree,e.d_desc.max_code),bO(e,e.bl_desc),t=18;t>=3&&0===e.bl_tree[2*$C[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?AO(e,t,r,n):4===e.strategy||o===i?(fO(e,2+(n?1:0),3),EO(e,eO,tO)):(fO(e,4+(n?1:0),3),function(e,t,r,n){var i;for(fO(e,t-257,5),fO(e,r-1,5),fO(e,n-4,4),i=0;i<n;i++)fO(e,e.bl_tree[2*$C[i]+1],3);TO(e,e.dyn_ltree,t-1),TO(e,e.dyn_dtree,r-1)}(e,e.l_desc.max_code+1,e.d_desc.max_code+1,a+1),EO(e,e.dyn_ltree,e.dyn_dtree)),mO(e),n&&gO(e)},HC._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*(nO[r]+XC+1)]++,e.dyn_dtree[2*lO(t)]++),e.last_lit===e.lit_bufsize-1},HC._tr_align=function(e){fO(e,2,3),pO(e,256,eO),function(e){16===e.bi_valid?(hO(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 RO=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 wO=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 CO,OO=function(e,t,r,n){var i=wO,o=n+r;e^=-1;for(var a=n;a<o;a++)e=e>>>8^i[255&(e^t[a])];return-1^e},DO={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"},xO=BC,NO=HC,PO=RO,MO=OO,LO=DO,UO=-2,VO=258,FO=262,BO=103,jO=113,GO=666;function HO(e,t){return e.msg=LO[t],t}function zO(e){return(e<<1)-(e>4?9:0)}function KO(e){for(var t=e.length;--t>=0;)e[t]=0}function XO(e){var t=e.state,r=t.pending;r>e.avail_out&&(r=e.avail_out),0!==r&&(xO.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 qO(e,t){NO._tr_flush_block(e,e.block_start>=0?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,XO(e.strm)}function WO(e,t){e.pending_buf[e.pending++]=t}function YO(e,t){e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=255&t}function QO(e,t){var r,n,i=e.max_chain_length,o=e.strstart,a=e.prev_length,s=e.nice_match,c=e.strstart>e.w_size-FO?e.strstart-(e.w_size-FO):0,u=e.window,d=e.w_mask,l=e.prev,h=e.strstart+VO,f=u[o+a-1],p=u[o+a];e.prev_length>=e.good_match&&(i>>=2),s>e.lookahead&&(s=e.lookahead);do{if(u[(r=t)+a]===p&&u[r+a-1]===f&&u[r]===u[o]&&u[++r]===u[o+1]){o+=2,r++;do{}while(u[++o]===u[++r]&&u[++o]===u[++r]&&u[++o]===u[++r]&&u[++o]===u[++r]&&u[++o]===u[++r]&&u[++o]===u[++r]&&u[++o]===u[++r]&&u[++o]===u[++r]&&o<h);if(n=VO-(h-o),o=h-VO,n>a){if(e.match_start=t,a=n,n>=s)break;f=u[o+a-1],p=u[o+a]}}}while((t=l[t&d])>c&&0!=--i);return a<=e.lookahead?a:e.lookahead}function JO(e){var t,r,n,i,o,a,s,c,u,d,l=e.w_size;do{if(i=e.window_size-e.lookahead-e.strstart,e.strstart>=l+(l-FO)){xO.arraySet(e.window,e.window,l,l,0),e.match_start-=l,e.strstart-=l,e.block_start-=l,t=r=e.hash_size;do{n=e.head[--t],e.head[t]=n>=l?n-l:0}while(--r);t=r=l;do{n=e.prev[--t],e.prev[t]=n>=l?n-l:0}while(--r);i+=l}if(0===e.strm.avail_in)break;if(a=e.strm,s=e.window,c=e.strstart+e.lookahead,u=i,d=void 0,(d=a.avail_in)>u&&(d=u),r=0===d?0:(a.avail_in-=d,xO.arraySet(s,a.input,a.next_in,d,c),1===a.state.wrap?a.adler=PO(a.adler,s,d,c):2===a.state.wrap&&(a.adler=MO(a.adler,s,d,c)),a.next_in+=d,a.total_in+=d,d),e.lookahead+=r,e.lookahead+e.insert>=3)for(o=e.strstart-e.insert,e.ins_h=e.window[o],e.ins_h=(e.ins_h<<e.hash_shift^e.window[o+1])&e.hash_mask;e.insert&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[o+3-1])&e.hash_mask,e.prev[o&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=o,o++,e.insert--,!(e.lookahead+e.insert<3)););}while(e.lookahead<FO&&0!==e.strm.avail_in)}function ZO(e,t){for(var r,n;;){if(e.lookahead<FO){if(JO(e),e.lookahead<FO&&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-FO&&(e.match_length=QO(e,r)),e.match_length>=3)if(n=NO._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=NO._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++;if(n&&(qO(e,!1),0===e.strm.avail_out))return 1}return e.insert=e.strstart<2?e.strstart:2,4===t?(qO(e,!0),0===e.strm.avail_out?3:4):e.last_lit&&(qO(e,!1),0===e.strm.avail_out)?1:2}function $O(e,t){for(var r,n,i;;){if(e.lookahead<FO){if(JO(e),e.lookahead<FO&&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-FO&&(e.match_length=QO(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=NO._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&&(qO(e,!1),0===e.strm.avail_out))return 1}else if(e.match_available){if((n=NO._tr_tally(e,0,e.window[e.strstart-1]))&&qO(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=NO._tr_tally(e,0,e.window[e.strstart-1]),e.match_available=0),e.insert=e.strstart<2?e.strstart:2,4===t?(qO(e,!0),0===e.strm.avail_out?3:4):e.last_lit&&(qO(e,!1),0===e.strm.avail_out)?1:2}function eD(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 tD(){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 xO.Buf16(1146),this.dyn_dtree=new xO.Buf16(122),this.bl_tree=new xO.Buf16(78),KO(this.dyn_ltree),KO(this.dyn_dtree),KO(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new xO.Buf16(16),this.heap=new xO.Buf16(573),KO(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new xO.Buf16(573),KO(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 rD(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:jO,e.adler=2===t.wrap?0:1,t.last_flush=0,NO._tr_init(t),0):HO(e,UO)}function nD(e){var t,r=rD(e);return 0===r&&((t=e.state).window_size=2*t.w_size,KO(t.head),t.max_lazy_match=CO[t.level].max_lazy,t.good_match=CO[t.level].good_length,t.nice_match=CO[t.level].nice_length,t.max_chain_length=CO[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 iD(e,t,r,n,i,o){if(!e)return UO;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 HO(e,UO);8===n&&(n=9);var s=new tD;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 xO.Buf8(2*s.w_size),s.head=new xO.Buf16(s.hash_size),s.prev=new xO.Buf16(s.w_size),s.lit_bufsize=1<<i+6,s.pending_buf_size=4*s.lit_bufsize,s.pending_buf=new xO.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,nD(e)}CO=[new eD(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(JO(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,qO(e,!1),0===e.strm.avail_out))return 1;if(e.strstart-e.block_start>=e.w_size-FO&&(qO(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,4===t?(qO(e,!0),0===e.strm.avail_out?3:4):(e.strstart>e.block_start&&(qO(e,!1),e.strm.avail_out),1)})),new eD(4,4,8,4,ZO),new eD(4,5,16,8,ZO),new eD(4,6,32,32,ZO),new eD(4,4,16,16,$O),new eD(8,16,32,32,$O),new eD(8,16,128,128,$O),new eD(8,32,128,256,$O),new eD(32,128,258,1024,$O),new eD(32,258,258,4096,$O)],GC.deflateInit=function(e,t){return iD(e,t,8,15,8,0)},GC.deflateInit2=iD,GC.deflateReset=nD,GC.deflateResetKeep=rD,GC.deflateSetHeader=function(e,t){return e&&e.state?2!==e.state.wrap?UO:(e.state.gzhead=t,0):UO},GC.deflate=function(e,t){var r,n,i,o;if(!e||!e.state||t>5||t<0)return e?HO(e,UO):UO;if(n=e.state,!e.output||!e.input&&0!==e.avail_in||n.status===GO&&4!==t)return HO(e,0===e.avail_out?-5:UO);if(n.strm=e,r=n.last_flush,n.last_flush=t,42===n.status)if(2===n.wrap)e.adler=0,WO(n,31),WO(n,139),WO(n,8),n.gzhead?(WO(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)),WO(n,255&n.gzhead.time),WO(n,n.gzhead.time>>8&255),WO(n,n.gzhead.time>>16&255),WO(n,n.gzhead.time>>24&255),WO(n,9===n.level?2:n.strategy>=2||n.level<2?4:0),WO(n,255&n.gzhead.os),n.gzhead.extra&&n.gzhead.extra.length&&(WO(n,255&n.gzhead.extra.length),WO(n,n.gzhead.extra.length>>8&255)),n.gzhead.hcrc&&(e.adler=MO(e.adler,n.pending_buf,n.pending,0)),n.gzindex=0,n.status=69):(WO(n,0),WO(n,0),WO(n,0),WO(n,0),WO(n,0),WO(n,9===n.level?2:n.strategy>=2||n.level<2?4:0),WO(n,3),n.status=jO);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=jO,YO(n,a),0!==n.strstart&&(YO(n,e.adler>>>16),YO(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=MO(e.adler,n.pending_buf,n.pending-i,i)),XO(e),i=n.pending,n.pending!==n.pending_buf_size));)WO(n,255&n.gzhead.extra[n.gzindex]),n.gzindex++;n.gzhead.hcrc&&n.pending>i&&(e.adler=MO(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=MO(e.adler,n.pending_buf,n.pending-i,i)),XO(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,WO(n,o)}while(0!==o);n.gzhead.hcrc&&n.pending>i&&(e.adler=MO(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=MO(e.adler,n.pending_buf,n.pending-i,i)),XO(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,WO(n,o)}while(0!==o);n.gzhead.hcrc&&n.pending>i&&(e.adler=MO(e.adler,n.pending_buf,n.pending-i,i)),0===o&&(n.status=BO)}else n.status=BO;if(n.status===BO&&(n.gzhead.hcrc?(n.pending+2>n.pending_buf_size&&XO(e),n.pending+2<=n.pending_buf_size&&(WO(n,255&e.adler),WO(n,e.adler>>8&255),e.adler=0,n.status=jO)):n.status=jO),0!==n.pending){if(XO(e),0===e.avail_out)return n.last_flush=-1,0}else if(0===e.avail_in&&zO(t)<=zO(r)&&4!==t)return HO(e,-5);if(n.status===GO&&0!==e.avail_in)return HO(e,-5);if(0!==e.avail_in||0!==n.lookahead||0!==t&&n.status!==GO){var s=2===n.strategy?function(e,t){for(var r;;){if(0===e.lookahead&&(JO(e),0===e.lookahead)){if(0===t)return 1;break}if(e.match_length=0,r=NO._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,r&&(qO(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,4===t?(qO(e,!0),0===e.strm.avail_out?3:4):e.last_lit&&(qO(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<=VO){if(JO(e),e.lookahead<=VO&&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+VO;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=VO-(o-i),e.match_length>e.lookahead&&(e.match_length=e.lookahead)}if(e.match_length>=3?(r=NO._tr_tally(e,1,e.match_length-3),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(r=NO._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),r&&(qO(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,4===t?(qO(e,!0),0===e.strm.avail_out?3:4):e.last_lit&&(qO(e,!1),0===e.strm.avail_out)?1:2}(n,t):CO[n.level].func(n,t);if(3!==s&&4!==s||(n.status=GO),1===s||3===s)return 0===e.avail_out&&(n.last_flush=-1),0;if(2===s&&(1===t?NO._tr_align(n):5!==t&&(NO._tr_stored_block(n,0,0,!1),3===t&&(KO(n.head),0===n.lookahead&&(n.strstart=0,n.block_start=0,n.insert=0))),XO(e),0===e.avail_out))return n.last_flush=-1,0}return 4!==t?0:n.wrap<=0?1:(2===n.wrap?(WO(n,255&e.adler),WO(n,e.adler>>8&255),WO(n,e.adler>>16&255),WO(n,e.adler>>24&255),WO(n,255&e.total_in),WO(n,e.total_in>>8&255),WO(n,e.total_in>>16&255),WO(n,e.total_in>>24&255)):(YO(n,e.adler>>>16),YO(n,65535&e.adler)),XO(e),n.wrap>0&&(n.wrap=-n.wrap),0!==n.pending?0:1)},GC.deflateEnd=function(e){var t;return e&&e.state?42!==(t=e.state.status)&&69!==t&&73!==t&&91!==t&&t!==BO&&t!==jO&&t!==GO?HO(e,UO):(e.state=null,t===jO?HO(e,-3):0):UO},GC.deflateSetDictionary=function(e,t){var r,n,i,o,a,s,c,u,d=t.length;if(!e||!e.state)return UO;if(2===(o=(r=e.state).wrap)||1===o&&42!==r.status||r.lookahead)return UO;for(1===o&&(e.adler=PO(e.adler,t,d,0)),r.wrap=0,d>=r.w_size&&(0===o&&(KO(r.head),r.strstart=0,r.block_start=0,r.insert=0),u=new xO.Buf8(r.w_size),xO.arraySet(u,t,d-r.w_size,r.w_size,0),t=u,d=r.w_size),a=e.avail_in,s=e.next_in,c=e.input,e.avail_in=d,e.next_in=0,e.input=t,JO(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,JO(r)}return r.strstart+=r.lookahead,r.block_start=r.strstart,r.insert=r.lookahead,r.lookahead=0,r.match_length=r.prev_length=2,r.match_available=0,e.next_in=s,e.input=c,e.avail_in=a,r.wrap=o,0},GC.deflateInfo="pako deflate (from Nodeca project)";var oD={},aD=BC,sD=!0,cD=!0;try{String.fromCharCode.apply(null,[0])}catch(bW){sD=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(bW){cD=!1}for(var uD=new aD.Buf8(256),dD=0;dD<256;dD++)uD[dD]=dD>=252?6:dD>=248?5:dD>=240?4:dD>=224?3:dD>=192?2:1;function lD(e,t){if(t<65534&&(e.subarray&&cD||!e.subarray&&sD))return String.fromCharCode.apply(null,aD.shrinkBuf(e,t));for(var r="",n=0;n<t;n++)r+=String.fromCharCode(e[n]);return r}uD[254]=uD[254]=1,oD.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 aD.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},oD.buf2binstring=function(e){return lD(e,e.length)},oD.binstring2buf=function(e){for(var t=new aD.Buf8(e.length),r=0,n=t.length;r<n;r++)t[r]=e.charCodeAt(r);return t},oD.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=uD[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 lD(s,n)},oD.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+uD[e[r]]>t?r:t};var hD=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},fD=GC,pD=BC,vD=oD,_D=DO,mD=hD,gD=Object.prototype.toString;function yD(e){if(!(this instanceof yD))return new yD(e);this.options=pD.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 mD,this.strm.avail_out=0;var r=fD.deflateInit2(this.strm,t.level,t.method,t.windowBits,t.memLevel,t.strategy);if(0!==r)throw new Error(_D[r]);if(t.header&&fD.deflateSetHeader(this.strm,t.header),t.dictionary){var n;if(n="string"==typeof t.dictionary?vD.string2buf(t.dictionary):"[object ArrayBuffer]"===gD.call(t.dictionary)?new Uint8Array(t.dictionary):t.dictionary,0!==(r=fD.deflateSetDictionary(this.strm,n)))throw new Error(_D[r]);this._dict_set=!0}}function SD(e,t){var r=new yD(t);if(r.push(e,!0),r.err)throw r.msg||_D[r.err];return r.result}yD.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=vD.string2buf(e):"[object ArrayBuffer]"===gD.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 pD.Buf8(o),i.next_out=0,i.avail_out=o),1!==(r=fD.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(vD.buf2binstring(pD.shrinkBuf(i.output,i.next_out))):this.onData(pD.shrinkBuf(i.output,i.next_out)))}while((i.avail_in>0||0===i.avail_out)&&1!==r);return 4===n?(r=fD.deflateEnd(this.strm),this.onEnd(r),this.ended=!0,0===r):2!==n||(this.onEnd(0),i.avail_out=0,!0)},yD.prototype.onData=function(e){this.chunks.push(e)},yD.prototype.onEnd=function(e){0===e&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=pD.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg},jC.Deflate=yD,jC.deflate=SD,jC.deflateRaw=function(e,t){return(t=t||{}).raw=!0,SD(e,t)},jC.gzip=function(e,t){return(t=t||{}).gzip=!0,SD(e,t)};var ED={},bD=tr,kD=D,TD=Ye,ID=ae,AD=function(){var e=bD(this),t="";return e.hasIndices&&(t+="d"),e.global&&(t+="g"),e.ignoreCase&&(t+="i"),e.multiline&&(t+="m"),e.dotAll&&(t+="s"),e.unicode&&(t+="u"),e.unicodeSets&&(t+="v"),e.sticky&&(t+="y"),t},RD=RegExp.prototype,wD=ae,CD=function(e){var t=e.flags;return void 0!==t||"flags"in RD||TD(e,"flags")||!ID(RD,e)?t:kD(AD,e)},OD=RegExp.prototype,DD=function(e){return e===OD||wD(OD,e)?CD(e):e.flags},xD={},ND=BC,PD=15,MD=[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],LD=[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],UD=[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],VD=[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],FD=BC,BD=RO,jD=OO,GD=function(e,t){var r,n,i,o,a,s,c,u,d,l,h,f,p,v,_,m,g,y,S,E,b,k,T,I,A;r=e.state,n=e.next_in,I=e.input,i=n+(e.avail_in-5),o=e.next_out,A=e.output,a=o-(t-e.avail_out),s=o+(e.avail_out-257),c=r.dmax,u=r.wsize,d=r.whave,l=r.wnext,h=r.window,f=r.hold,p=r.bits,v=r.lencode,_=r.distcode,m=(1<<r.lenbits)-1,g=(1<<r.distbits)-1;e:do{p<15&&(f+=I[n++]<<p,p+=8,f+=I[n++]<<p,p+=8),y=v[f&m];t:for(;;){if(f>>>=S=y>>>24,p-=S,0===(S=y>>>16&255))A[o++]=65535&y;else{if(!(16&S)){if(0==(64&S)){y=v[(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}E=65535&y,(S&=15)&&(p<S&&(f+=I[n++]<<p,p+=8),E+=f&(1<<S)-1,f>>>=S,p-=S),p<15&&(f+=I[n++]<<p,p+=8,f+=I[n++]<<p,p+=8),y=_[f&g];r:for(;;){if(f>>>=S=y>>>24,p-=S,!(16&(S=y>>>16&255))){if(0==(64&S)){y=_[(65535&y)+(f&(1<<S)-1)];continue r}e.msg="invalid distance code",r.mode=30;break e}if(b=65535&y,p<(S&=15)&&(f+=I[n++]<<p,(p+=8)<S&&(f+=I[n++]<<p,p+=8)),(b+=f&(1<<S)-1)>c){e.msg="invalid distance too far back",r.mode=30;break e}if(f>>>=S,p-=S,b>(S=o-a)){if((S=b-S)>d&&r.sane){e.msg="invalid distance too far back",r.mode=30;break e}if(k=0,T=h,0===l){if(k+=u-S,S<E){E-=S;do{A[o++]=h[k++]}while(--S);k=o-b,T=A}}else if(l<S){if(k+=u+l-S,(S-=l)<E){E-=S;do{A[o++]=h[k++]}while(--S);if(k=0,l<E){E-=S=l;do{A[o++]=h[k++]}while(--S);k=o-b,T=A}}}else if(k+=l-S,S<E){E-=S;do{A[o++]=h[k++]}while(--S);k=o-b,T=A}for(;E>2;)A[o++]=T[k++],A[o++]=T[k++],A[o++]=T[k++],E-=3;E&&(A[o++]=T[k++],E>1&&(A[o++]=T[k++]))}else{k=o-b;do{A[o++]=A[k++],A[o++]=A[k++],A[o++]=A[k++],E-=3}while(E>2);E&&(A[o++]=A[k++],E>1&&(A[o++]=A[k++]))}break}}break}}while(n<i&&o<s);n-=E=p>>3,f&=(1<<(p-=E<<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},HD=function(e,t,r,n,i,o,a,s){var c,u,d,l,h,f,p,v,_,m=s.bits,g=0,y=0,S=0,E=0,b=0,k=0,T=0,I=0,A=0,R=0,w=null,C=0,O=new ND.Buf16(16),D=new ND.Buf16(16),x=null,N=0;for(g=0;g<=PD;g++)O[g]=0;for(y=0;y<n;y++)O[t[r+y]]++;for(b=m,E=PD;E>=1&&0===O[E];E--);if(b>E&&(b=E),0===E)return i[o++]=20971520,i[o++]=20971520,s.bits=1,0;for(S=1;S<E&&0===O[S];S++);for(b<S&&(b=S),I=1,g=1;g<=PD;g++)if(I<<=1,(I-=O[g])<0)return-1;if(I>0&&(0===e||1!==E))return-1;for(D[1]=0,g=1;g<PD;g++)D[g+1]=D[g]+O[g];for(y=0;y<n;y++)0!==t[r+y]&&(a[D[t[r+y]]++]=y);if(0===e?(w=x=a,f=19):1===e?(w=MD,C-=257,x=LD,N-=257,f=256):(w=UD,x=VD,f=-1),R=0,y=0,g=S,h=o,k=b,T=0,d=-1,l=(A=1<<b)-1,1===e&&A>852||2===e&&A>592)return 1;for(;;){p=g-T,a[y]<f?(v=0,_=a[y]):a[y]>f?(v=x[N+a[y]],_=w[C+a[y]]):(v=96,_=0),c=1<<g-T,S=u=1<<k;do{i[h+(R>>T)+(u-=c)]=p<<24|v<<16|_|0}while(0!==u);for(c=1<<g-1;R&c;)c>>=1;if(0!==c?(R&=c-1,R+=c):R=0,y++,0==--O[g]){if(g===E)break;g=t[r+a[y]]}if(g>b&&(R&l)!==d){for(0===T&&(T=b),h+=S,I=1<<(k=g-T);k+T<E&&!((I-=O[k+T])<=0);)k++,I<<=1;if(A+=1<<k,1===e&&A>852||2===e&&A>592)return 1;i[d=R&l]=b<<24|k<<16|h-o|0}}return 0!==R&&(i[h+R]=g-T<<24|64<<16|0),s.bits=b,0},zD=-2,KD=12,XD=30;function qD(e){return(e>>>24&255)+(e>>>8&65280)+((65280&e)<<8)+((255&e)<<24)}function WD(){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 FD.Buf16(320),this.work=new FD.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function YD(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 FD.Buf32(852),t.distcode=t.distdyn=new FD.Buf32(592),t.sane=1,t.back=-1,0):zD}function QD(e){var t;return e&&e.state?((t=e.state).wsize=0,t.whave=0,t.wnext=0,YD(e)):zD}function JD(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)?zD:(null!==n.window&&n.wbits!==t&&(n.window=null),n.wrap=r,n.wbits=t,QD(e))):zD}function ZD(e,t){var r,n;return e?(n=new WD,e.state=n,n.window=null,0!==(r=JD(e,t))&&(e.state=null),r):zD}var $D,ex,tx=!0;function rx(e){if(tx){var t;for($D=new FD.Buf32(512),ex=new FD.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(HD(1,e.lens,0,288,$D,0,e.work,{bits:9}),t=0;t<32;)e.lens[t++]=5;HD(2,e.lens,0,32,ex,0,e.work,{bits:5}),tx=!1}e.lencode=$D,e.lenbits=9,e.distcode=ex,e.distbits=5}function nx(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 FD.Buf8(o.wsize)),n>=o.wsize?(FD.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),FD.arraySet(o.window,t,r-n,i,o.wnext),(n-=i)?(FD.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}xD.inflateReset=QD,xD.inflateReset2=JD,xD.inflateResetKeep=YD,xD.inflateInit=function(e){return ZD(e,15)},xD.inflateInit2=ZD,xD.inflate=function(e,t){var r,n,i,o,a,s,c,u,d,l,h,f,p,v,_,m,g,y,S,E,b,k,T,I,A=0,R=new FD.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 zD;(r=e.state).mode===KD&&(r.mode=13),a=e.next_out,i=e.output,c=e.avail_out,o=e.next_in,n=e.input,s=e.avail_in,u=r.hold,d=r.bits,l=s,h=c,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--,u+=n[o++]<<d,d+=8}if(2&r.wrap&&35615===u){r.check=0,R[0]=255&u,R[1]=u>>>8&255,r.check=jD(r.check,R,2,0),u=0,d=0,r.mode=2;break}if(r.flags=0,r.head&&(r.head.done=!1),!(1&r.wrap)||(((255&u)<<8)+(u>>8))%31){e.msg="incorrect header check",r.mode=XD;break}if(8!=(15&u)){e.msg="unknown compression method",r.mode=XD;break}if(d-=4,b=8+(15&(u>>>=4)),0===r.wbits)r.wbits=b;else if(b>r.wbits){e.msg="invalid window size",r.mode=XD;break}r.dmax=1<<b,e.adler=r.check=1,r.mode=512&u?10:KD,u=0,d=0;break;case 2:for(;d<16;){if(0===s)break e;s--,u+=n[o++]<<d,d+=8}if(r.flags=u,8!=(255&DD(r))){e.msg="unknown compression method",r.mode=XD;break}if(57344&DD(r)){e.msg="unknown header flags set",r.mode=XD;break}r.head&&(r.head.text=u>>8&1),512&DD(r)&&(R[0]=255&u,R[1]=u>>>8&255,r.check=jD(r.check,R,2,0)),u=0,d=0,r.mode=3;case 3:for(;d<32;){if(0===s)break e;s--,u+=n[o++]<<d,d+=8}r.head&&(r.head.time=u),512&DD(r)&&(R[0]=255&u,R[1]=u>>>8&255,R[2]=u>>>16&255,R[3]=u>>>24&255,r.check=jD(r.check,R,4,0)),u=0,d=0,r.mode=4;case 4:for(;d<16;){if(0===s)break e;s--,u+=n[o++]<<d,d+=8}r.head&&(r.head.xflags=255&u,r.head.os=u>>8),512&DD(r)&&(R[0]=255&u,R[1]=u>>>8&255,r.check=jD(r.check,R,2,0)),u=0,d=0,r.mode=5;case 5:if(1024&DD(r)){for(;d<16;){if(0===s)break e;s--,u+=n[o++]<<d,d+=8}r.length=u,r.head&&(r.head.extra_len=u),512&DD(r)&&(R[0]=255&u,R[1]=u>>>8&255,r.check=jD(r.check,R,2,0)),u=0,d=0}else r.head&&(r.head.extra=null);r.mode=6;case 6:if(1024&DD(r)&&((f=r.length)>s&&(f=s),f&&(r.head&&(b=r.head.extra_len-r.length,r.head.extra||(r.head.extra=new Array(r.head.extra_len)),FD.arraySet(r.head.extra,n,o,f,b)),512&DD(r)&&(r.check=jD(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&DD(r)){if(0===s)break e;f=0;do{b=n[o+f++],r.head&&b&&r.length<65536&&(r.head.name+=String.fromCharCode(b))}while(b&&f<s);if(512&DD(r)&&(r.check=jD(r.check,n,f,o)),s-=f,o+=f,b)break e}else r.head&&(r.head.name=null);r.length=0,r.mode=8;case 8:if(4096&DD(r)){if(0===s)break e;f=0;do{b=n[o+f++],r.head&&b&&r.length<65536&&(r.head.comment+=String.fromCharCode(b))}while(b&&f<s);if(512&DD(r)&&(r.check=jD(r.check,n,f,o)),s-=f,o+=f,b)break e}else r.head&&(r.head.comment=null);r.mode=9;case 9:if(512&DD(r)){for(;d<16;){if(0===s)break e;s--,u+=n[o++]<<d,d+=8}if(u!==(65535&r.check)){e.msg="header crc mismatch",r.mode=XD;break}u=0,d=0}r.head&&(r.head.hcrc=DD(r)>>9&1,r.head.done=!0),e.adler=r.check=0,r.mode=KD;break;case 10:for(;d<32;){if(0===s)break e;s--,u+=n[o++]<<d,d+=8}e.adler=r.check=qD(u),u=0,d=0,r.mode=11;case 11:if(0===r.havedict)return e.next_out=a,e.avail_out=c,e.next_in=o,e.avail_in=s,r.hold=u,r.bits=d,2;e.adler=r.check=1,r.mode=KD;case KD:if(5===t||6===t)break e;case 13:if(r.last){u>>>=7&d,d-=7&d,r.mode=27;break}for(;d<3;){if(0===s)break e;s--,u+=n[o++]<<d,d+=8}switch(r.last=1&u,d-=1,3&(u>>>=1)){case 0:r.mode=14;break;case 1:if(rx(r),r.mode=20,6===t){u>>>=2,d-=2;break e}break;case 2:r.mode=17;break;case 3:e.msg="invalid block type",r.mode=XD}u>>>=2,d-=2;break;case 14:for(u>>>=7&d,d-=7&d;d<32;){if(0===s)break e;s--,u+=n[o++]<<d,d+=8}if((65535&u)!=(u>>>16^65535)){e.msg="invalid stored block lengths",r.mode=XD;break}if(r.length=65535&u,u=0,d=0,r.mode=15,6===t)break e;case 15:r.mode=16;case 16:if(f=r.length){if(f>s&&(f=s),f>c&&(f=c),0===f)break e;FD.arraySet(i,n,o,f,a),s-=f,o+=f,c-=f,a+=f,r.length-=f;break}r.mode=KD;break;case 17:for(;d<14;){if(0===s)break e;s--,u+=n[o++]<<d,d+=8}if(r.nlen=257+(31&u),u>>>=5,d-=5,r.ndist=1+(31&u),u>>>=5,d-=5,r.ncode=4+(15&u),u>>>=4,d-=4,r.nlen>286||r.ndist>30){e.msg="too many length or distance symbols",r.mode=XD;break}r.have=0,r.mode=18;case 18:for(;r.have<r.ncode;){for(;d<3;){if(0===s)break e;s--,u+=n[o++]<<d,d+=8}r.lens[w[r.have++]]=7&u,u>>>=3,d-=3}for(;r.have<19;)r.lens[w[r.have++]]=0;if(r.lencode=r.lendyn,r.lenbits=7,T={bits:r.lenbits},k=HD(0,r.lens,0,19,r.lencode,0,r.work,T),r.lenbits=T.bits,k){e.msg="invalid code lengths set",r.mode=XD;break}r.have=0,r.mode=19;case 19:for(;r.have<r.nlen+r.ndist;){for(;m=(A=r.lencode[u&(1<<r.lenbits)-1])>>>16&255,g=65535&A,!((_=A>>>24)<=d);){if(0===s)break e;s--,u+=n[o++]<<d,d+=8}if(g<16)u>>>=_,d-=_,r.lens[r.have++]=g;else{if(16===g){for(I=_+2;d<I;){if(0===s)break e;s--,u+=n[o++]<<d,d+=8}if(u>>>=_,d-=_,0===r.have){e.msg="invalid bit length repeat",r.mode=XD;break}b=r.lens[r.have-1],f=3+(3&u),u>>>=2,d-=2}else if(17===g){for(I=_+3;d<I;){if(0===s)break e;s--,u+=n[o++]<<d,d+=8}d-=_,b=0,f=3+(7&(u>>>=_)),u>>>=3,d-=3}else{for(I=_+7;d<I;){if(0===s)break e;s--,u+=n[o++]<<d,d+=8}d-=_,b=0,f=11+(127&(u>>>=_)),u>>>=7,d-=7}if(r.have+f>r.nlen+r.ndist){e.msg="invalid bit length repeat",r.mode=XD;break}for(;f--;)r.lens[r.have++]=b}}if(r.mode===XD)break;if(0===r.lens[256]){e.msg="invalid code -- missing end-of-block",r.mode=XD;break}if(r.lenbits=9,T={bits:r.lenbits},k=HD(1,r.lens,0,r.nlen,r.lencode,0,r.work,T),r.lenbits=T.bits,k){e.msg="invalid literal/lengths set",r.mode=XD;break}if(r.distbits=6,r.distcode=r.distdyn,T={bits:r.distbits},k=HD(2,r.lens,r.nlen,r.ndist,r.distcode,0,r.work,T),r.distbits=T.bits,k){e.msg="invalid distances set",r.mode=XD;break}if(r.mode=20,6===t)break e;case 20:r.mode=21;case 21:if(s>=6&&c>=258){e.next_out=a,e.avail_out=c,e.next_in=o,e.avail_in=s,r.hold=u,r.bits=d,GD(e,h),a=e.next_out,i=e.output,c=e.avail_out,o=e.next_in,n=e.input,s=e.avail_in,u=r.hold,d=r.bits,r.mode===KD&&(r.back=-1);break}for(r.back=0;m=(A=r.lencode[u&(1<<r.lenbits)-1])>>>16&255,g=65535&A,!((_=A>>>24)<=d);){if(0===s)break e;s--,u+=n[o++]<<d,d+=8}if(m&&0==(240&m)){for(y=_,S=m,E=g;m=(A=r.lencode[E+((u&(1<<y+S)-1)>>y)])>>>16&255,g=65535&A,!(y+(_=A>>>24)<=d);){if(0===s)break e;s--,u+=n[o++]<<d,d+=8}u>>>=y,d-=y,r.back+=y}if(u>>>=_,d-=_,r.back+=_,r.length=g,0===m){r.mode=26;break}if(32&m){r.back=-1,r.mode=KD;break}if(64&m){e.msg="invalid literal/length code",r.mode=XD;break}r.extra=15&m,r.mode=22;case 22:if(r.extra){for(I=r.extra;d<I;){if(0===s)break e;s--,u+=n[o++]<<d,d+=8}r.length+=u&(1<<r.extra)-1,u>>>=r.extra,d-=r.extra,r.back+=r.extra}r.was=r.length,r.mode=23;case 23:for(;m=(A=r.distcode[u&(1<<r.distbits)-1])>>>16&255,g=65535&A,!((_=A>>>24)<=d);){if(0===s)break e;s--,u+=n[o++]<<d,d+=8}if(0==(240&m)){for(y=_,S=m,E=g;m=(A=r.distcode[E+((u&(1<<y+S)-1)>>y)])>>>16&255,g=65535&A,!(y+(_=A>>>24)<=d);){if(0===s)break e;s--,u+=n[o++]<<d,d+=8}u>>>=y,d-=y,r.back+=y}if(u>>>=_,d-=_,r.back+=_,64&m){e.msg="invalid distance code",r.mode=XD;break}r.offset=g,r.extra=15&m,r.mode=24;case 24:if(r.extra){for(I=r.extra;d<I;){if(0===s)break e;s--,u+=n[o++]<<d,d+=8}r.offset+=u&(1<<r.extra)-1,u>>>=r.extra,d-=r.extra,r.back+=r.extra}if(r.offset>r.dmax){e.msg="invalid distance too far back",r.mode=XD;break}r.mode=25;case 25:if(0===c)break e;if(f=h-c,r.offset>f){if((f=r.offset-f)>r.whave&&r.sane){e.msg="invalid distance too far back",r.mode=XD;break}f>r.wnext?(f-=r.wnext,p=r.wsize-f):p=r.wnext-f,f>r.length&&(f=r.length),v=r.window}else v=i,p=a-r.offset,f=r.length;f>c&&(f=c),c-=f,r.length-=f;do{i[a++]=v[p++]}while(--f);0===r.length&&(r.mode=21);break;case 26:if(0===c)break e;i[a++]=r.length,c--,r.mode=21;break;case 27:if(r.wrap){for(;d<32;){if(0===s)break e;s--,u|=n[o++]<<d,d+=8}if(h-=c,e.total_out+=h,r.total+=h,h&&(e.adler=r.check=DD(r)?jD(r.check,i,h,a-h):BD(r.check,i,h,a-h)),h=c,(DD(r)?u:qD(u))!==r.check){e.msg="incorrect data check",r.mode=XD;break}u=0,d=0}r.mode=28;case 28:if(r.wrap&&DD(r)){for(;d<32;){if(0===s)break e;s--,u+=n[o++]<<d,d+=8}if(u!==(4294967295&r.total)){e.msg="incorrect length check",r.mode=XD;break}u=0,d=0}r.mode=29;case 29:k=1;break e;case XD:k=-3;break e;case 31:return-4;default:return zD}return e.next_out=a,e.avail_out=c,e.next_in=o,e.avail_in=s,r.hold=u,r.bits=d,(r.wsize||h!==e.avail_out&&r.mode<XD&&(r.mode<27||4!==t))&&nx(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=DD(r)?jD(r.check,i,h,e.next_out-h):BD(r.check,i,h,e.next_out-h)),e.data_type=r.bits+(r.last?64:0)+(r.mode===KD?128:0)+(20===r.mode||15===r.mode?256:0),(0===l&&0===h||4===t)&&0===k&&(k=-5),k},xD.inflateEnd=function(e){if(!e||!e.state)return zD;var t=e.state;return t.window&&(t.window=null),e.state=null,0},xD.inflateGetHeader=function(e,t){var r;return e&&e.state?0==(2&(r=e.state).wrap)?zD:(r.head=t,t.done=!1,0):zD},xD.inflateSetDictionary=function(e,t){var r,n=t.length;return e&&e.state?0!==(r=e.state).wrap&&11!==r.mode?zD:11===r.mode&&BD(1,t,n,0)!==r.check?-3:nx(e,t,n,n)?(r.mode=31,-4):(r.havedict=1,0):zD},xD.inflateInfo="pako inflate (from Nodeca project)";var ix={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 ox=xD,ax=BC,sx=oD,cx=ix,ux=DO,dx=hD,lx=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},hx=Object.prototype.toString;function fx(e){if(!(this instanceof fx))return new fx(e);this.options=ax.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 dx,this.strm.avail_out=0;var r=ox.inflateInit2(this.strm,t.windowBits);if(r!==cx.Z_OK)throw new Error(ux[r]);if(this.header=new lx,ox.inflateGetHeader(this.strm,this.header),t.dictionary&&("string"==typeof t.dictionary?t.dictionary=sx.string2buf(t.dictionary):"[object ArrayBuffer]"===hx.call(t.dictionary)&&(t.dictionary=new Uint8Array(t.dictionary)),t.raw&&(r=ox.inflateSetDictionary(this.strm,t.dictionary))!==cx.Z_OK))throw new Error(ux[r])}function px(e,t){var r=new fx(t);if(r.push(e,!0),r.err)throw r.msg||ux[r.err];return r.result}fx.prototype.push=function(e,t){var r,n,i,o,a,s=this.strm,c=this.options.chunkSize,u=this.options.dictionary,d=!1;if(this.ended)return!1;n=t===~~t?t:!0===t?cx.Z_FINISH:cx.Z_NO_FLUSH,"string"==typeof e?s.input=sx.binstring2buf(e):"[object ArrayBuffer]"===hx.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 ax.Buf8(c),s.next_out=0,s.avail_out=c),(r=ox.inflate(s,cx.Z_NO_FLUSH))===cx.Z_NEED_DICT&&u&&(r=ox.inflateSetDictionary(this.strm,u)),r===cx.Z_BUF_ERROR&&!0===d&&(r=cx.Z_OK,d=!1),r!==cx.Z_STREAM_END&&r!==cx.Z_OK)return this.onEnd(r),this.ended=!0,!1;s.next_out&&(0!==s.avail_out&&r!==cx.Z_STREAM_END&&(0!==s.avail_in||n!==cx.Z_FINISH&&n!==cx.Z_SYNC_FLUSH)||("string"===this.options.to?(i=sx.utf8border(s.output,s.next_out),o=s.next_out-i,a=sx.buf2string(s.output,i),s.next_out=o,s.avail_out=c-o,o&&ax.arraySet(s.output,s.output,i,o,0),this.onData(a)):this.onData(ax.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!==cx.Z_STREAM_END);return r===cx.Z_STREAM_END&&(n=cx.Z_FINISH),n===cx.Z_FINISH?(r=ox.inflateEnd(this.strm),this.onEnd(r),this.ended=!0,r===cx.Z_OK):n!==cx.Z_SYNC_FLUSH||(this.onEnd(cx.Z_OK),s.avail_out=0,!0)},fx.prototype.onData=function(e){this.chunks.push(e)},fx.prototype.onEnd=function(e){e===cx.Z_OK&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=ax.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg},ED.Inflate=fx,ED.inflate=px,ED.inflateRaw=function(e,t){return(t=t||{}).raw=!0,px(e,t)},ED.ungzip=px;var vx={};(0,BC.assign)(vx,jC,ED,ix);var _x=vx,mx="BytePlusRTC",gx=function(){return window.indexedDB||window.mozIndexedDB||window.webkitIndexedDB||window.msIndexedDB},yx=function(){function e(t){Wd(this,e),sd(this,"storeName",void 0),sd(this,"pendingList",[]),this.storeName=t,!uw()&&gx()&&this._checkAndCreateStore(t)}var t,r;return qd(e,[{key:"_checkAndCreateStore",value:function(t,r){var n=this;e.db&&e.db.close();var i=r?gx().open(mx,r):gx().open(mx);i.onupgradeneeded=function(){i.result.createObjectStore(t)},i.onerror=function(e){console.error("IndexedDBInterface error",i.error)},i.onsuccess=function(){var r=i.result;e.db=r;try{e.db.transaction(n.storeName,"readonly"),n.pendingList.forEach(function(){var e=km(Em().mark((function e(t){var r,i,o,a;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=t.txMode,i=t.resolve,o=t.reject,e.prev=1,e.next=4,n._getStore(r);case 4:a=e.sent,i(a),e.next=11;break;case 8:e.prev=8,e.t0=e.catch(1),o();case 11:case"end":return e.stop()}}),e,null,[[1,8]])})));return function(t){return e.apply(this,arguments)}}())}catch(o){n._checkAndCreateStore(t,r.version+1)}}}},{key:"_getStore",value:function(t){var r=this;return new X_((function(n,i){e.db?n(e.db.transaction(r.storeName,t).objectStore(r.storeName)):r.pendingList.push({txMode:t,resolve:n,reject:i})}))}},{key:"put",value:(r=km(Em().mark((function e(t,r){var n;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._getStore("readwrite");case 2:return n=e.sent,e.abrupt("return",new X_((function(e,i){var o=n.put(t,r);o.onsuccess=function(){e()},o.onerror=function(e){i(e)}})));case 4:case"end":return e.stop()}}),e,this)}))),function(e,t){return r.apply(this,arguments)})},{key:"get",value:(t=km(Em().mark((function e(t){var r;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._getStore("readonly");case 2:return r=e.sent,e.abrupt("return",new X_((function(e,n){var i=r.get(t);i.onsuccess=function(){e(i.result)},i.onerror=function(e){n(e)}})));case 4:case"end":return e.stop()}}),e,this)}))),function(e){return t.apply(this,arguments)})}]),e}();sd(yx,"db",void 0),sd(yx,"state","init");var Sx=function(e){return e.RTC="rtc",e}(Sx||{}),Ex=function(e){return e.W_5="5",e}(Ex||{}),bx=function(e){return e.IOS="ios",e.ANDROID="android",e.WEB="web",e.WINDOWS="windows",e.MAC="mac",e.LINUX="linux",e}(bx||{}),kx=function(e){return e.REQUEST="request",e.RESPONSE="response",e}(kx||{}),Tx=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}(Tx||{}),Ix=function(e){return e.WEBSOCKET="websocket",e.NETWORKCHANGED="networkChanged",e.PEERCONNECTION="peerconnection",e}(Ix||{}),Ax=function(e){return e.WEBSOCKET_RECONNECTED="websocket reconnected",e.PEERCONNECTION_RECONNECTED="peerconnection reconnected",e}(Ax||{}),Rx=function(e){return e.WEBSOCKET="websocket",e.NETWORKCHANGED="networkChanged",e.PEERCONNECTION="peerconnection",e}(Rx||{}),wx=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}(wx||{}),Cx=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}(Cx||{}),Ox=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}(Ox||{}),Dx=function(e){return e.UP="up",e.DOWN="down",e.DIRECT="direct",e}(Dx||{}),xx=function(e){return e.UP="up",e.DOWN="down",e.PRE="pre",e}(xx||{}),Nx=function(e){return e.UP="up",e.DOWN="down",e.PRE="pre",e}(Nx||{}),Px=function(e){return e.W_0="0",e.W_1="1",e}(Px||{}),Mx=function(e){return e.UP="up",e.DOWN="down",e}(Mx||{}),Lx=function(e){return e.ANSWER="answer",e.INCRANSWER="incranswer",e}(Lx||{}),Ux=function(e){return e.UP="up",e.DOWN="down",e}(Ux||{}),Vx=function(e){return e.SUCCESS="success",e.FAIL="fail",e}(Vx||{}),Fx=function(e){return e.W_0="0",e.W_1="1",e}(Fx||{}),Bx=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}(Bx||{}),jx=function(e){return e.SUCCESS="success",e.FAIL="fail",e.IGNORE="ignore",e}(jx||{}),Gx=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}(Gx||{}),Hx=function(e){return e.PLAYOUT_DEVICE_SWITCH="playout_device_switch",e.RECORD_DEVICE_SWITCH="record_device_switch",e.UNKNOWN="unknown",e}(Hx||{}),zx=function(e){return e.BEGIN_SEND="begin_send",e.SENT_END="sent_end",e.BEGIN_RECV="begin_recv",e.RECV_END="recv_end",e}(zx||{}),Kx=function(e){return e.AUDIO="audio",e.VIDEO="video",e.SCREEN_VIDEO="screen_video",e.SCREEN_AUDIO="screen_audio",e}(Kx||{}),Xx=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}(Xx||{}),qx=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}(qx||{}),Wx=function(e){return e.BEGIN="begin",e.END="end",e}(Wx||{}),Yx=function(e){return e.BEGIN="begin",e.END="end",e}(Yx||{}),Qx=function(e){return 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",e}(Qx||{}),Jx=function(e){return e.P2P="p2p",e.P2P_OUTSIDE_ROOM="p2p_outside_room",e.P2SERVER="p2server",e}(Jx||{}),Zx=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}(Zx||{}),$x=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}($x||{}),eN=function(){function e(t){Wd(this,e),sd(this,"_event_key",void 0),sd(this,"_device_id",void 0),sd(this,"_rtc_app_id",void 0),sd(this,"_product_line",void 0),sd(this,"_report_version",void 0),sd(this,"_os",void 0),sd(this,"_rtc_sdk_version",void 0),sd(this,"_rtc_timestamp",void 0),sd(this,"_rtc_sdk_git_commit",void 0),sd(this,"_report_id",void 0),sd(this,"_connection_id",void 0),sd(this,"_rtc_sid",void 0),sd(this,"_engine_session_id",void 0),sd(this,"_rtc_business_id",void 0),sd(this,"_app_state",void 0),sd(this,"_project_key",void 0),sd(this,"_network_type",void 0),sd(this,"_app_version",void 0),sd(this,"_aid",void 0),sd(this,"_device_model",void 0),sd(this,"_device_brand",void 0),sd(this,"_common_extra_info",void 0),sd(this,"_had_selected_p2p",void 0),sd(this,"_rtc_env_type",void 0),sd(this,"_room_id",void 0),sd(this,"_user_id",void 0),sd(this,"_rtc_session_id",void 0),sd(this,"_user_agent",void 0),sd(this,"_auto_play_policy",void 0),sd(this,"_platform",void 0),sd(this,"_product",void 0),sd(this,"_log_cache_key",void 0),sd(this,"_overSea","0"),this.monitor=t}return qd(e,[{key:"setStats",value:function(e){var t=this;an(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:"app_state",get:function(){return this._app_state}},{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}},{key:"platform",get:function(){return this._platform||"web"}},{key:"product",get:function(){return this._product||"webrtc"}},{key:"log_cache_key",get:function(){return this._log_cache_key}},{key:"overSea",get:function(){return this._overSea}}]),e}(),tN="ReportErrorBuffer",rN=function(){function e(){Wd(this,e),sd(this,"_buffer",new yx(tN))}var t,r;return qd(e,[{key:"set",value:(r=km(Em().mark((function e(t){return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._buffer.put(t,tN);case 2:case"end":return e.stop()}}),e,this)}))),function(e){return r.apply(this,arguments)})},{key:"get",value:(t=km(Em().mark((function e(){var t;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=[],e.prev=1,e.next=4,this._buffer.get(tN);case 4:t=e.sent,e.next=9;break;case 7:e.prev=7,e.t0=e.catch(1);case 9:return e.abrupt("return",t);case 10:case"end":return e.stop()}}),e,this,[[1,7]])}))),function(){return t.apply(this,arguments)})}]),e}(),nN=function(e){OI(n,e);var t,r=qI(n);function n(){var e;return Wd(this,n),sd(ZT(e=r.call(this)),"report_id",void 0),sd(ZT(e),"report_common",void 0),sd(ZT(e),"modify_ids",void 0),sd(ZT(e),"dataBuffer",void 0),sd(ZT(e),"posting",void 0),sd(ZT(e),"sucSendTimer",void 0),sd(ZT(e),"preSucTime",void 0),sd(ZT(e),"errSendTimer",void 0),sd(ZT(e),"errSendDelay",void 0),sd(ZT(e),"errSendBuffer",void 0),sd(ZT(e),"commonStats",void 0),sd(ZT(e),"_retryCount",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 eN(ZT(e)),uw()||window.addEventListener("beforeunload",(function(){clearTimeout(e.errSendTimer),clearTimeout(e.sucSendTimer),e.send(null,!0)})),e}return qd(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:"enableErrorBuffer",value:function(){this.errSendBuffer=new rN,this.loadErrorBuffer()}},{key:"unshift",value:function(e){this.dataBuffer=wm(e).call(e,this.dataBuffer)}},{key:"send",value:function(e,t){var r,n,i=this;if(e||this.dataBuffer.length){var o={data:e||vk(r=this.dataBuffer).call(r,0,4e3),header:ud(ud({},this.report_common),{},{http_retry_count:this._retryCount}),from:"web",os:"web",version:"1"},a=new XMLHttpRequest;a.timeout=1e4,a.onreadystatechange=function(){if(4===a.readyState){var r,n,s,c,u;if(e||(i.posting=!1),200===a.status||304===a.status)try{r=JSON.parse(a.responseText)}catch(EW){n=EW}if(r&&0===r.StatusCode){if(!e&&!t)!uw()&&Jm(s=location.search).call(s,"_rtc_autotest_")&&i.safeEmit("report_event",o),null===(c=i.errSendBuffer)||void 0===c||c.set([]),i.sucSend()}else if(setTimeout((function(){var e,t;i.rtcError(wm(e="reportor error, res:".concat(null===(t=r)||void 0===t?void 0:t.toString()," err:")).call(e,n),a.status,n)}),0),e)i.send(e);else i.unshift(o.data),null===(u=i.errSendBuffer)||void 0===u||u.set(Wk(i.dataBuffer)),t?i.send():i.errSend()}};var s=CN.LOG_SERVER_URL;if(a.open("POST",s,!0),e||(this.posting=!0),!uw()&&Jm(n=location.search).call(n,"_rtc_debug_"))a.send(tg(o));else{var c=_x.gzip(tg(o));a.setRequestHeader("Content-Encoding","gzip"),a.setRequestHeader("Content-Type","application/x-www-form-urlencoded; charset=UTF-8"),a.send(c)}}}},{key:"sucSend",value:function(){this.errSendDelay=100,this._retryCount=0,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,this._retryCount++}},{key:"loadErrorBuffer",value:(t=km(Em().mark((function e(){var t,r,n=this;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,null===(r=this.errSendBuffer)||void 0===r?void 0:r.get();case 2:if(e.t1=t=e.sent,e.t0=null!==e.t1,!e.t0){e.next=6;break}e.t0=void 0!==t;case 6:if(!e.t0){e.next=10;break}e.t2=t,e.next=11;break;case 10:e.t2=[];case 11:e.t2.forEach((function(e){n.push(e)}));case 13:case"end":return e.stop()}}),e,this)}))),function(){return t.apply(this,arguments)})},{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,c=t.rtc_sdk_version,u=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,v=t.project_key,_=t.network_type,m=t.app_version,g=t.aid,y=t.device_model,S=t.device_brand,E=t.common_extra_info,b=t.had_selected_p2p,k=t.rtc_env_type,T=t.user_agent,I=t.auto_play_policy,A=t.platform,R=t.product,w=t.log_cache_key,C=t.overSea;YE(e,{event_key:r,device_id:n,rtc_app_id:i,product_line:o,report_version:a,os:s,rtc_sdk_version:c,rtc_timestamp:u,rtc_sdk_git_commit:d,report_id:l,rtc_sid:h,engine_session_id:f,rtc_business_id:p,project_key:v,network_type:_,app_version:m,aid:g,device_model:y,device_brand:S,common_extra_info:E,had_selected_p2p:b,rtc_env_type:k,user_agent:T,auto_play_policy:I,platform:A,product:R,log_cache_key:w,extra_is_oversea:C}),this.modify_ids.room_id=this.commonStats.room_id,this.modify_ids.user_id=this.commonStats.user_id,this.modify_ids.rtc_session_id=this.commonStats.rtc_session_id,this.modify_ids.connection_id=this.commonStats.connection_id,this.modify_ids.app_state=this.commonStats.app_state}},{key:"rtcSdkApiCall",value:function(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},i=ud(ud({event_key:"rtc_sdk_api_call",report_id:this.report_id++,rtc_timestamp:Date.now(),sdk_api_name:e,error_code:t,message:r},this.modify_ids),{},{common_extra_info:tg(n)});n.streamId&&(i.stream_id=n.streamId),this.push(i)}},{key:"rtcSdkCallback",value:function(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},i=ud(ud({event_key:"rtc_sdk_callback",report_id:this.report_id++,rtc_timestamp:Date.now(),sdk_callback_name:e,error_code:t,message:r},this.modify_ids),{},{common_extra_info:tg(n)});this.push(i)}},{key:"rtcGetConfig",value:function(e,t,r,n,i,o,a){var s=arguments.length>7&&void 0!==arguments[7]?arguments[7]:{},c=ud(ud({event_key:"rtc_get_config",report_id:this.report_id++,rtc_timestamp:Date.now(),error_code:e,message:t,elapse:r,host:n,type:i,config_id:o,enable_cloud_proxy:a},this.modify_ids),{},{common_extra_info:tg(s)});this.push(c)}},{key:"rtcReconnect",value:function(e,t,r,n){var i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{},o=ud(ud({event_key:"rtc_reconnect",report_id:this.report_id++,rtc_timestamp:Date.now(),error_code:e,message:t,reconnect_id:r,reconnect_type:n},this.modify_ids),{},{common_extra_info:tg(i)});this.push(o)}},{key:"rtcReconnected",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=ud(ud({event_key:"rtc_reconnected",report_id:this.report_id++,rtc_timestamp:Date.now(),message:e,reconnect_type:t},this.modify_ids),{},{common_extra_info:tg(r)});this.push(n)}},{key:"rtcGetAccess",value:function(e,t,r,n,i,o){var a=arguments.length>6&&void 0!==arguments[6]?arguments[6]:{},s=ud(ud({event_key:"rtc_get_access",report_id:this.report_id++,rtc_timestamp:Date.now(),error_code:e,message:t,elapse:r,type:n,host:i,connect_session_id:o},this.modify_ids),{},{common_extra_info:tg(a)});this.push(s)}},{key:"rtcPreIceState",value:function(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},i=ud(ud({event_key:"rtc_pre_ice_state",report_id:this.report_id++,rtc_timestamp:Date.now(),message:e,ice_state:t},this.modify_ids),{},{connection_id:r,common_extra_info:tg(n)});this.push(i)}},{key:"rtcNodeChange",value:function(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},i=ud(ud({event_key:"rtc_node_change",report_id:this.report_id++,rtc_timestamp:Date.now(),error_code:e,message:t,reason:r},this.modify_ids),{},{common_extra_info:tg(n)});this.push(i)}},{key:"rtcSignalingMsgError",value:function(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},i=ud(ud({event_key:"rtc_signaling_msg_error",report_id:this.report_id++,rtc_timestamp:Date.now(),error_code:e,message:t,reason:r},this.modify_ids),{},{common_extra_info:tg(n)});this.push(i)}},{key:"rtcSignaling",value:function(e,t,r,n,i,o,a){var s=arguments.length>7&&void 0!==arguments[7]?arguments[7]:{},c=ud(ud({event_key:"rtc_signaling",report_id:this.report_id++,rtc_timestamp:Date.now(),error_code:e,message:t,signaling_event:r,signaling_type:n,stream_id:i,stream_user_id:o,direction:a},this.modify_ids),{},{common_extra_info:tg(s)});this.push(c)}},{key:"rtcJoinRoom",value:function(e,t,r,n){var i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{},o=ud(ud({event_key:"rtc_join_room",report_id:this.report_id++,rtc_timestamp:Date.now(),error_code:e,deviceModel:t,deviceManufacturer:r,elapse:n},this.modify_ids),{},{common_extra_info:tg(i)});this.push(o)}},{key:"rtcLeaveRoom",value:function(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},i=ud(ud({event_key:"rtc_leave_room",report_id:this.report_id++,rtc_timestamp:Date.now(),error_code:e,message:t,elapse:r},this.modify_ids),{},{common_extra_info:tg(n)});this.push(i)}},{key:"rtcBeginCreateOffer",value:function(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},i=ud(ud({event_key:"rtc_begin_create_offer",report_id:this.report_id++,rtc_timestamp:Date.now(),direction:e,stream_id:t,stream_user_id:r},this.modify_ids),{},{common_extra_info:tg(n)});this.push(i)}},{key:"rtcCreateOffer",value:function(e,t,r,n,i){var o=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{},a=ud(ud({event_key:"rtc_create_offer",report_id:this.report_id++,rtc_timestamp:Date.now(),error_code:e,direction:t,stream_id:r,stream_user_id:n,elapse:i},this.modify_ids),{},{common_extra_info:tg(o)});this.push(a)}},{key:"rtcSetDescription",value:function(e,t,r,n,i,o,a,s){var c=arguments.length>8&&void 0!==arguments[8]?arguments[8]:{},u=ud(ud({event_key:"rtc_set_description",report_id:this.report_id++,rtc_timestamp:Date.now(),error_code:e,message:t,is_local:r,direction:n,stream_id:i,stream_user_id:o,elapse:a},this.modify_ids),{},{connection_id:s,common_extra_info:tg(c)});this.push(u)}},{key:"rtcRecvAnswer",value:function(e,t,r,n,i,o,a){var s=arguments.length>7&&void 0!==arguments[7]?arguments[7]:{},c=ud(ud({event_key:"rtc_recv_answer",report_id:this.report_id++,rtc_timestamp:Date.now(),error_code:e,answer_type:t,sequence_id:r,message:n,direction:i,stream_id:o,stream_user_id:a},this.modify_ids),{},{common_extra_info:tg(s)});this.push(c)}},{key:"firstRemoteAudioRender",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=ud(ud({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:tg(r)});this.push(n)}},{key:"firstRemoteVideoRender",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=ud(ud({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:tg(r)});this.push(n)}},{key:"rtcPublishStat",value:function(e,t,r,n){var i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{},o=ud(ud({event_key:"rtc_publish_stat",report_id:this.report_id++,rtc_timestamp:Date.now(),result:e,is_screen:t,start:r,message:n},this.modify_ids),{},{common_extra_info:tg(i)});this.push(o)}},{key:"rtcSubscribeStat",value:function(e,t,r,n){var i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{},o=ud(ud({event_key:"rtc_subscribe_stat",report_id:this.report_id++,rtc_timestamp:Date.now(),result:e,start:t,message:r,stream_user_id:n},this.modify_ids),{},{common_extra_info:tg(i)});this.push(o)}},{key:"rtcAudioDevice",value:function(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},i=ud(ud({event_key:"rtc_audio_device",report_id:this.report_id++,rtc_timestamp:Date.now(),audio_event:e,message:t,error_code:r},this.modify_ids),{},{common_extra_info:tg(n)});this.push(i)}},{key:"rtcMediaStatistics",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=ud(ud(ud(ud({event_key:"rtc_media_statistics",report_id:this.report_id++,rtc_timestamp:Date.now()},e),t),this.modify_ids),{},{common_extra_info:tg(r)});this.push(n)}},{key:"rtcMessageStatistics",value:function(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},i=ud(ud({event_key:"rtc_message_statistics",report_id:this.report_id++,rtc_timestamp:Date.now(),dc_user_message:e,dc_room_message:t,media_server_ip:r},this.modify_ids),{},{common_extra_info:tg(n)});this.push(i)}},{key:"rtsMessageReport",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=ud(ud(ud({event_key:"rts_message",report_id:this.report_id++,rtc_timestamp:Date.now()},e),this.modify_ids),{},{common_extra_info:tg(t)});this.push(r)}},{key:"rtcError",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=ud(ud({event_key:"rtc_error",report_id:this.report_id++,rtc_timestamp:Date.now(),message:e,error_code:t},this.modify_ids),{},{common_extra_info:tg(r)});this.push(n)}},{key:"rtcInvokeStatus",value:function(e,t,r,n,i){var o=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{},a=arguments.length>6&&void 0!==arguments[6]?arguments[6]:"",s=ud(ud({event_key:"rtc_invoke_status",report_id:this.report_id++,rtc_timestamp:Date.now(),message:e,error_code:t,sdk_api_name:r,stream_id:n,elapse:i},this.modify_ids),{},{connection_id:a,common_extra_info:tg(o),direction:o.direction});this.push(s)}},{key:"rtcFirstFrame",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=ud(ud(ud({event_key:"rtc_first_frame",report_id:this.report_id++,rtc_timestamp:Date.now()},e),this.modify_ids),{},{common_extra_info:tg(t)});this.push(r)}},{key:"rtcMuteRemote",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=ud(ud({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:tg(r)});this.push(n)}},{key:"sdkInitEngine",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=ud(ud({event_key:"sdk_init_engine",report_id:this.report_id++,rtc_timestamp:Date.now(),start:e,type:t},this.modify_ids),{},{common_extra_info:tg(r)});this.push(n)}},{key:"joinRoom",value:function(e,t,r,n){var i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{},o=ud(ud({event_key:"join_room",report_id:this.report_id++,rtc_timestamp:Date.now(),type:e,start:t,result:r,reason:n},this.modify_ids),{},{common_extra_info:tg(i)});this.push(o)}},{key:"p2pConnectionStatus",value:function(e,t,r,n,i){var o=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{},a=ud(ud({event_key:"p2p_connection_status",report_id:this.report_id++,rtc_timestamp:Date.now(),room_id:e,user_id:t,peer_user_id:r,status:n,elapse:i},this.modify_ids),{},{common_extra_info:tg(o)});this.push(a)}},{key:"p2pConnectClosed",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=ud(ud({event_key:"p2p_connect_closed",report_id:this.report_id++,rtc_timestamp:Date.now(),p2p_selected:e},this.modify_ids),{},{common_extra_info:tg(t)});this.push(r)}},{key:"rtcDeviceError",value:function(e,t,r,n,i,o,a,s,c,u,d,l,h,f,p,v){var _=arguments.length>16&&void 0!==arguments[16]?arguments[16]:{},m=ud(ud({event_key:"rtc_device_error",report_id:this.report_id++,rtc_timestamp:Date.now(),device_type:e,device_stage:t,error_code:r,system_error_code:n,system_api:i,call_parameters:o,location:a,message:s,media_device_id:c,media_device_name:u,elapse:d,scenario:l,event_session_id:h,device_pid:f,device_vid:p,media_mode:v},this.modify_ids),{},{common_extra_info:tg(_)});this.push(m)}},{key:"rtcVideoDevice",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=ud(ud({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:tg(r)});this.push(n)}},{key:"rtcVideoCaptureEvent",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=ud(ud(ud({event_key:"rtc_video_capture_event",report_id:this.report_id++,rtc_timestamp:Date.now()},e),this.modify_ids),{},{common_extra_info:tg(t)});this.push(r)}},{key:"rtcEncodeFirstFrame",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=ud(ud(ud(ud({event_key:"rtc_encode_first_frame",report_id:this.report_id++,rtc_timestamp:Date.now()},e),t),this.modify_ids),{},{common_extra_info:tg(r)});this.push(n)}},{key:"rtcFirstFrameEncoded",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=ud(ud(ud(ud({event_key:"rtc_first_frame_encoded",report_id:this.report_id++,rtc_timestamp:Date.now()},e),t),this.modify_ids),{},{common_extra_info:tg(r)});this.push(n)}},{key:"rtcSendFirstPacket",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=ud(ud(ud(ud({event_key:"rtc_send_first_packet",report_id:this.report_id++,rtc_timestamp:Date.now()},e),t),this.modify_ids),{},{common_extra_info:tg(r)});this.push(n)}},{key:"rtcRecvFirstPacket",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=ud(ud(ud(ud({event_key:"rtc_recv_first_packet",report_id:this.report_id++,rtc_timestamp:Date.now()},e),t),this.modify_ids),{},{common_extra_info:tg(r)});this.push(n)}},{key:"rtcRecvFirstFrame",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=ud(ud(ud(ud({event_key:"rtc_recv_first_frame",report_id:this.report_id++,rtc_timestamp:Date.now()},e),t),this.modify_ids),{},{common_extra_info:tg(r)});this.push(n)}},{key:"rtcDecodeFirstFrame",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=ud(ud(ud(ud({event_key:"rtc_decode_first_frame",report_id:this.report_id++,rtc_timestamp:Date.now()},e),t),this.modify_ids),{},{common_extra_info:tg(r)});this.push(n)}}]),n}(OC),iN=new nN,oN=new nN,aN=new nN,sN=iN.commonStats,cN=oN.commonStats,uN=aN.commonStats;function dN(e){sN.setStats({app_state:e}),cN.setStats({app_state:e}),uN.setStats({app_state:e})}!uw()&&(dN("active"),document.addEventListener("visibilitychange",(function(){"visible"===document.visibilityState?dN("active"):"hidden"===document.visibilityState&&dN("background")})));var lN={default:iN,rtm:oN,outsideRoom:aN},hN=function(e,t,r){iN.rtcSdkApiCall(e,t,r)},fN=function(e,t,r){iN.rtcSdkCallback(e,t,r)};function pN(){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&&sN.setStats({room_id:i[1]}),lN[e].rtcSdkApiCall(n,0,tg(ww(i)),s);var c=o.apply(this,i);return"function"==typeof(null==c?void 0:c.then)?c.then((function(t){return lN[e].rtcSdkCallback(n,0,tg(ww([t||{}]))),t})).catch((function(t){throw lN[e].rtcSdkCallback(n,t.code,tg(t.message)),t})):(lN[e].rtcSdkCallback(n,0,tg(ww([c||{}]))),c)}}}}function vN(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=e===Kd.onUserMessageReceivedOutsideRoom||e===Kd.onUserBinaryMessageReceivedOutsideRoom;(n?oN:iN).rtcSdkCallback(e,r,tg(t))}function _N(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=arguments.length>3&&void 0!==arguments[3]&&arguments[3],i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:"",o=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{};(n?oN:iN).rtcInvokeStatus(tg(t),r,e,"",0,o,i)}var mN="BytePlus",gN="RTC_DEVICE_ID",yN="RTC_ACCESS_NODE",SN="RTC_ACCESS_URLS",EN="ENGINE_WEB_CONFIG",bN=function(){function e(){Wd(this,e)}return qd(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,tg(n)),!0}catch(i){return!1}}},{key:"delete",value:function(e){try{return localStorage.removeItem(e),!0}catch(t){return!1}}}]),e}(),kN=function(e){OI(r,e);var t=qI(r);function r(){return Wd(this,r),t.apply(this,arguments)}return qd(r,[{key:"getDeviceId",value:function(){if(uw())return"";var e=this.get(gN);return e&&!/^[0-9a-f]{8}(-[0-9a-f]{4}){3}-[0-9a-f]{12}$/.test(e)||(e=function(e){for(var t="",r=0;r<e;r++)t+=Math.floor(10*Math.random());return t}(30)),this.setDeviceId(e),e}},{key:"setDeviceId",value:function(e){return[sN,cN,uN].forEach((function(t){return t.setStats({device_id:e})})),this.set(gN,e),e}},{key:"getAccessNode",value:function(e){var t;return this.get(wm(t="".concat(yN,"_").concat(e,"-")).call(t,mN))}},{key:"setAccessNode",value:function(e,t,r){var n;return this.set(wm(n="".concat(yN,"_").concat(e,"-")).call(n,mN),t,1e3*r)}},{key:"clearAccessNode",value:function(e){var t;this.delete(wm(t="".concat(yN,"_").concat(e,"-")).call(t,mN))}},{key:"getAccessUrls",value:function(){return this.get("".concat(SN,"-").concat(mN))}},{key:"setAccessUrls",value:function(e){var t=sg(e).call(e,(function(e){var t,r=e.host,n=e.path;return wm(t="https://".concat(r)).call(t,n)}));return this.set("".concat(SN,"-").concat(mN),t)}},{key:"clearAccessUrls",value:function(){this.delete("".concat(SN,"-").concat(mN))}},{key:"getEngineWebConfig",value:function(e,t){var r,n,i,o=wm(r=wm(n="".concat(e,"_")).call(n,t,"_")).call(r,this.getDeviceId()),a=this.get(EN);return(null==a||null===(i=xb(a).call(a,(function(e){return e.key===o})))||void 0===i?void 0:i.config)||{}}},{key:"setEngineWebConfig",value:function(e,t,r){var n,i;if(r){var o=wm(n=wm(i="".concat(e,"_")).call(i,t,"_")).call(n,this.getDeviceId()),a=this.get(EN)||[];return(a=Gs(a).call(a,(function(e){return e.key!==o}))).push({key:o,config:r}),this.set(EN,Sm(a).call(a,-5))}}}]),r}(bN),TN=new kN,IN="rtc-access.rtcplus.com,rtc-access-sg.rtcplus.com,rtc-access-va.rtcplus.com,rtc-access-fr.rtcplus.com".split(",");function AN(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return/^https?:\/\/.+/.test(e)||(e="https://"+e),"".concat(e,"/dispatch/v1/AccessInfo?Action=GetAccessInfo")}var RN="https://web-log-report.rtcplus.com/video/v1/webrtc_log/",wN="rtc.rtcplus.com".split(","),CN={VERSION:"4.51.7",ICE_CONFIG_REQUEST_URLS_INTERNAL:sg(IN).call(IN,AN),ICE_CONFIG_REQUEST_URLS:[],EXPECTED_ADDR:"",LOG_SERVER_URL:RN,CONFIG_REQUEST_DOMAINS:wN,DEVICE_ID:"",OVERSEA:!1,PLATFORM:"",PRODUCT:"",CONNECTION_MODE:Fd.AUTO,AUDIO_STALL:!0,VIDEO_STALL:!0,STATS_SCALLBACK_SUPPORT:!0,ENABLE_REPORT_ERROR_BUFFER:!1};function ON(e,t){var r;if(iN.rtcSdkApiCall("setParameter",0,wm(r="key: ".concat(e,", value: ")).call(r,t)),"VERSION"!==e){if("ICE_CONFIG_REQUEST_URLS"===e)return"string"==typeof t&&(t=[t]),void(CN.ICE_CONFIG_REQUEST_URLS=sg(t).call(t,AN));if("PLATFORM"!==e||"string"!=typeof t)if("PRODUCT"!==e||"string"!=typeof t)if("LOG_SERVER_URL"!==e||t!==Td.overseas)if("LOG_SERVER_URL"!==e||t!==Td.domestic)if("LOG_SERVER_URL"!==e||"string"!=typeof t){if("OVERSEA"===e)return sN.setStats({overSea:t?"1":"0"}),void(CN.OVERSEA=t);"DEVICE_ID"===e&&TN.setDeviceId(t),"ENABLE_REPORT_ERROR_BUFFER"===e&&t&&iN.enableErrorBuffer(),CN[e]=t}else CN.LOG_SERVER_URL=t;else CN.LOG_SERVER_URL=RN;else CN.LOG_SERVER_URL="https://web-log-report.rtcplus.com/video/v1/webrtc_log/";else sN.setStats({product:t});else sN.setStats({platform:t})}}function DN(e){return"DEVICE_ID"===e?TN.getDeviceId():CN[e]}function xN(e,t,r){var n,i,o,a,s,c,u,d,l;return{type:"publicstream",action:t,publicStreamID:e,publicStreamMeta:{audio:{},video:{fps:(null===(n=r.video)||void 0===n?void 0:n.fps)||15,bitrate:1e3*((null===(i=r.video)||void 0===i?void 0:i.kBitRate)||40),width:(null===(o=r.video)||void 0===o?void 0:o.width)||640,height:(null===(a=r.video)||void 0===a?void 0:a.height)||360},layout:{layoutMode:2,interpolationMode:(null===(s=r.layout)||void 0===s?void 0:s.interpolationMode)||Rd.PREV_FRAME,canvas:{bgColor:(null===(c=r.layout)||void 0===c?void 0:c.backgroundColor)||"#000000",bgImage:(null===(u=r.layout)||void 0===u?void 0:u.backgroundImage)||""},regions:(null===(d=r.layout)||void 0===d||null===(l=d.regions)||void 0===l?void 0:sg(l).call(l,(function(e){return{roomId:e.roomId,userId:e.userId,alterImage:e.alertImage||"",alpha:!e.alpha||+e.alpha>1||+e.alpha<=0?1:+e.alpha,x:!e.x||+e.x>=1||+e.x<0?0:+e.x,y:!e.y||+e.y>=1||+e.y<0?0:+e.y,w:!e.w||+e.w>1||+e.w<=0?1:+e.w,h:!e.h||+e.h>1||+e.h<=0?1:+e.h,zorder:!e.zorder||+e.zorder<0||+e.zorder>100?0:+e.zorder,renderMode:void 0===e.renderMode?1:e.renderMode,streamType:e.isScreenStream?1:0,mediaType:e.mediaType||0,sourceCrop:e.sourceCrop}})))||[]}}}}var NN={width:640,height:480,frameRate:15,maxKbps:600},PN={width:1920,height:1080,frameRate:15,maxKbps:3e3};function MN(e,t){if(null==e)return{};var r,n,i=function(e,t){if(null==e)return{};var r,n,i={},o=an(e);for(n=0;n<o.length;n++)r=o[n],Hb(t).call(t,r)>=0||(i[r]=e[r]);return i}(e,t);if(Os){var o=Os(e);for(n=0;n<o.length;n++)r=o[n],Hb(t).call(t,r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(i[r]=e[r])}return i}var LN,UN=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}(UN||{}),VN=function(e){return e.PushLimitWarn="PushLimitWarn",e}(VN||{}),FN=function(e){return e.ON_ADD_STREAM="onAddStream",e.ON_ADD_STREAM_LIST="onAddStreamList",e.ON_REMOVE_STREAM="onRemoveStream",e.ON_REMOVE_STREAM_LIST="onRemoveStreamList",e.USER_DISCONNECTION="userDisconnection",e.USER_DISCONNECTION_LIST="userDisconnectionList",e.USER_CONNECTION="userConnection",e.USER_CONNECTION_LIST="userConnectionList",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_SPEAKER_CHANGE="onSpeakerChange",e.ON_STREAM_FAILED="streamFailed",e}(FN||{}),BN=function(e){return e.RSCP="RSCP",e.RTT="RTT",e}(BN||{}),jN=function(e){return e.ON_CONNECTION_STATE_CHANGE="onConnectionStateChange",e.ABNORMAL_DISCONNECTION="normalConnection",e}(jN||{}),GN=function(e){return e.userLeave="userLeave",e.connectionLost="connectionLost",e.userDuplicateLogin="userDuplicateLogin",e.kickedByAdmin="kickedByAdmin",e.roleChanged="roleChanged",e.onUserTokenDidExpire="onUserTokenDidExpire",e}(GN||{}),HN=function(e){return e[e.roomDismissByAdmin=2]="roomDismissByAdmin",e}(HN||{}),zN=function(e){return e[e.SEND=0]="SEND",e[e.FEEDBACK=1]="FEEDBACK",e}(zN||{}),KN=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}(KN||{}),XN=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.EXCEED_QPS=5]="EXCEED_QPS",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.NOT_LOGIN=105]="NOT_LOGIN",e[e.SERVER_PARAMS_NOTSET=106]="SERVER_PARAMS_NOTSET",e[e.UNKNOWN=1e3]="UNKNOWN",e}(XN||{}),qN=(sd(LN={},0,[0,"success"]),sd(LN,1,[uR.USER_MESSAGE_TIMEOUT,"timeout, failed to send."]),sd(LN,2,[uR.USER_MESSAGE_BROKEN,"dataChannel broken, failed to send."]),sd(LN,3,[uR.USER_MESSAGE_NO_RECEIVER,"cannot find the receiver."]),sd(LN,4,[uR.USER_MESSAGE_NO_RECEIVER,"cannot find relay path."]),sd(LN,5,[uR.USER_MESSAGE_EXCEED_QPS,"cannot find relay path."]),sd(LN,17,[uR.USER_MESSAGE_SEND_TO_SERVER_ERROR,"failed to send to business server."]),sd(LN,18,[uR.USER_MESSAGE_SERVER_RESPONSE_ERROR,"business server response error."]),sd(LN,100,[uR.USER_MESSAGE_NOT_JOIN,"not join room"]),sd(LN,105,[uR.USER_MESSAGE_NOT_LOGIN,"not login."]),sd(LN,106,[uR.USER_MESSAGE_SERVER_PARAMS_NOTSET,"server param is not set."]),sd(LN,1e3,[uR.USER_MESSAGE_UNKNOWN,"unknown."]),LN),WN=new RC("RTSMsgReportor",1),YN=function(){function e(t){Wd(this,e),sd(this,"_preTime",Date.now()),sd(this,"_one2oneNum",0),sd(this,"_one2manyNum",0),sd(this,"_one2oneMsgCache",new yE),sd(this,"_one2manyMsgCache",new yE),sd(this,"roomInfo",void 0),sd(this,"rtsSessionId",""),this.id=t}return qd(e,[{key:"needReport",value:function(t){return!!e.config&&(Date.now()-this._preTime>=36e5&&(this._preTime=Date.now(),this._one2oneNum=0,this._one2manyNum=0),"one2one"===t&&this._one2oneNum<e.config.max_one2one_fpt_per_hour&&Math.random()<=e.config.one2one_fpt_ratio/100||"one2many"===t&&this._one2manyNum<e.config.max_one2many_fpt_per_hour&&Math.random()<=e.config.one2many_fpt_ratio/100)}},{key:"cacheP2PMsg",value:function(t){var r;this._one2oneMsgCache.set(t.msg_id,ud({config_version:(null===(r=e.config)||void 0===r?void 0:r.version)||""},t))}},{key:"updateP2PMsg",value:function(e,t){var r=this._one2oneMsgCache.get(e);r&&this._one2oneMsgCache.set(e,ud(ud({},r),t))}},{key:"cacheCustomMsg",value:function(t){var r;this._one2manyMsgCache.set(t.msg_id,ud({config_version:(null===(r=e.config)||void 0===r?void 0:r.version)||""},t))}},{key:"updateOne2ManyMsg",value:function(e,t){var r=this._one2manyMsgCache.get(e);r&&this._one2manyMsgCache.set(e,ud(ud({},r),t))}},{key:"reportP2PMsg",value:function(e){var t=this._one2oneMsgCache.get(e);t&&(WN.print("reportP2PMsg",t.msg_type,tg(t)),iN.rtsMessageReport(t))}},{key:"reportOne2ManyMsg",value:function(e){var t=this._one2manyMsgCache.get(e);t&&(WN.print("reportOne2ManyMsg",t.msg_type,tg(t)),iN.rtsMessageReport(t))}},{key:"reportMsgRecv",value:function(t){var r;t.config_version=(null===(r=e.config)||void 0===r?void 0:r.version)||"",WN.print("reportMsgRecv",t.msg_type,tg(t)),iN.rtsMessageReport(t)}},{key:"destroy",value:function(){this._one2manyNum=0,this._one2oneNum=0,this._one2manyMsgCache.clear(),this._one2oneMsgCache.clear(),this._preTime=Date.now(),delete this.roomInfo,this.rtsSessionId=""}}]),e}();sd(YN,"config",void 0);var QN=new yE,JN=function(e){WN.print("setConfig","get config: "+tg(e)),YN.config=e},ZN=function(e){var t=QN.get(e)||new YN(e);return QN.set(e,t),t},$N=function(e){var t=QN.get(e);t&&(t.destroy(),QN.delete(e))},eP=function(e,t){var r=QN.get(e);r&&(r.roomInfo=t)},tP=function(e,t){var r=QN.get(e);r&&(r.rtsSessionId=t)},rP=function(e,t,r){var n,i;t.enable_report&&t.report_msg_id&&(null===(n=QN.get(e))||void 0===n||n.updateP2PMsg(wm(i="".concat(t.from)).call(i,t.report_msg_id),{send_ts:Date.now(),msg_size:r}))},nP=function(e,t,r){if(t.enable_report&&t.report_msg_id){var n,i,o=QN.get(e);null==o||o.updateP2PMsg(wm(n="".concat(t.from)).call(n,t.report_msg_id),{ack_ts:Date.now(),error_code:r}),null==o||o.reportP2PMsg(wm(i="".concat(t.from)).call(i,t.report_msg_id))}},iP=function(e,t,r){var n,i,o,a=QN.get(e);null!=a&&a.needReport("one2many")&&(r.enable_report=!0,r.report_msg_id=t,a.cacheCustomMsg({rts_session_id:a.rtsSessionId,msg_id:wm(n="".concat(r.clientId)).call(n,t),node_role:"src_sdk",from:r.clientId,to:(null===(i=a.roomInfo)||void 0===i?void 0:i.roomId)||"",msg_type:"one2many",rts_room_id:(null===(o=a.roomInfo)||void 0===o?void 0:o.roomId)||"",req_ts:Date.now(),send_ts:Date.now(),ack_ts:Date.now(),msg_size:0}));return r},oP=function(e,t,r){if(t.enable_report&&t.report_msg_id){var n,i=QN.get(e);if(i)i.updateOne2ManyMsg(wm(n="".concat(t.clientId)).call(n,t.report_msg_id),{send_ts:Date.now(),msg_size:r})}},aP=function(e,t,r){if(t.enable_report&&t.report_msg_id){var n,i,o=QN.get(e);if(o)null==o||o.updateOne2ManyMsg(wm(n="".concat(t.clientId)).call(n,t.report_msg_id),{ack_ts:Date.now(),error_code:r}),null==o||o.reportOne2ManyMsg(wm(i="".concat(t.clientId)).call(i,t.report_msg_id))}},sP=function(e,t,r){if(t.enable_report&&t.report_msg_id){var n,i,o=QN.get(e);null==o||o.reportMsgRecv({rts_session_id:o.rtsSessionId,msg_id:wm(n="".concat(t.from)).call(n,t.report_msg_id),msg_size:r.msg_size,node_role:"dst_sdk",msg_type:t.to?"one2one":"one2many",rts_room_id:t.room,from:t.from,to:t.to||t.room,error_code:0,recv_msg_ts:r.recv_msg_ts,fwd_msg_ts:r.fwd_msg_ts,reply_ack_ts:Date.now(),cur_dst_uid:t.to?"":null===(i=o.roomInfo)||void 0===i?void 0:i.userInfo.userId})}},cP=function(e,t,r){if(t.enable_report&&t.report_msg_id){var n,i,o=QN.get(e);null==o||o.reportMsgRecv({rts_session_id:o.rtsSessionId,msg_id:wm(n="".concat(t.clientId)).call(n,t.report_msg_id),msg_size:r.msg_size,node_role:"dst_sdk",msg_type:"one2many",rts_room_id:t.roomId,from:t.clientId,to:t.roomId,error_code:0,recv_msg_ts:r.recv_msg_ts,fwd_msg_ts:r.fwd_msg_ts,reply_ack_ts:Date.now(),cur_dst_uid:null===(i=o.roomInfo)||void 0===i?void 0:i.userInfo.userId})}},uP=Object.freeze(Object.defineProperty({__proto__:null,_cache:QN,setConfig:JN,setRtsSessionId:tP,createRTSMsgReportor:ZN,destroyRTSMsgReportor:$N,setRoomInfo:eP,samplingP2PMsg:function(e,t){var r=QN.get(e);if(null!=r&&r.needReport("one2one")){var n,i=wm(n="".concat(t.from)).call(n,t.id);t.enable_report=!0,t.report_msg_id=t.id,r.cacheP2PMsg({rts_session_id:r.rtsSessionId,msg_id:i,node_role:"src_sdk",from:t.from,to:t.to||"server",msg_type:t.to?"one2one":"one2server",rts_room_id:t.room,req_ts:Date.now(),send_ts:Date.now(),ack_ts:Date.now(),msg_size:0})}return t},updateP2PMsgReq:rP,updateP2PMsgAck:nP,samplingOne2ManyMsg:iP,reportP2PMsgRecv:sP,updateOne2ManyMsgAck:aP,updateOne2ManyMsgReq:oP,reportOne2ManyMsgRecv:cP},Symbol.toStringTag,{value:"Module"})),dP=["msg"],lP=new RC("DataChannelSignaling",3),hP=["onSpeakerChange"],fP=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}(fP||{}),pP=function(e){OI(i,e);var t,r,n=qI(i);function i(e,t){var r;return Wd(this,i),sd(ZT(r=n.call(this)),"_singlingCache",new yE),sd(ZT(r),"_p2pCache",new yE),sd(ZT(r),"_rttIds",{}),sd(ZT(r),"_p2pMessageId",0),sd(ZT(r),"_clearDataChannelListener",void 0),sd(ZT(r),"_asyncQueue",new jw),r.id=e,r._dataChannel=t,r._clearDataChannelListener=r._handleHandler(),window.__rtc_mock_signaling__=r.emit.bind(ZT(r)),r}return qd(i,[{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 iN.rtcSignaling(0,tg(t),"call-".concat(e),"Send",t.streamId,t.streamUserId,Dx.UP),new X_((function(i,o){var a,s=n._genHeader(r);s.id=Iw();var c=s.id.join("-"),u="customMessage"===e;u&&iP(n.id,+s.id.join(""),t);var d=setTimeout((function(){n._singlingCache.delete(c),o(new lR(uR.TIME_OUT,"".concat(e," message time out"))),u&&aP(n.id,t,999)}),6e4);n._singlingCache.set(c,{signalingType:e,success:function(e){clearTimeout(d),i(e),u&&aP(n.id,t,0)},error:function(e){clearTimeout(d),o(e),u&&aP(n.id,t,e.code)}}),lP.print("Signal",wm(a=">>>>>> [".concat(e,"][")).call(a,c,"]"),t),n._sendMessage(e,s,t)}))}},{key:"sendPingSignaling",value:function(){return this.sendSignaling("CheckConnectivity",{ts:Date.now()},{functionType:2})}},{key:"sendP2PMessage",value:(r=km(Em().mark((function e(t,r){var n,i,o;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=t.msg,i=MN(t,dP),o=n instanceof ArrayBuffer,e.t0=this,e.t1=uP,e.t2=this.id,e.t3=ud,e.t4=ud({ver:1,id:this._p2pMessageId++,time:Date.now(),dir:zN.SEND,type:KN.P2P,err:XN.SUCCESS},i),e.t5={},e.t6=o,!o){e.next=15;break}return e.next=12,dw.ab2b64str(n);case 12:e.t7=e.sent,e.next=16;break;case 15:e.t7=n;case 16:return e.t8=e.t7,e.t9={binary:e.t6,msg:e.t8},e.t10=(0,e.t3)(e.t4,e.t5,e.t9),e.t11=e.t1.samplingP2PMsg.call(e.t1,e.t2,e.t10),e.t12=r,e.abrupt("return",e.t0._sendP2PMessage.call(e.t0,e.t11,e.t12));case 22:case"end":return e.stop()}}),e,this)}))),function(e,t){return r.apply(this,arguments)})},{key:"_sendP2PMessage",value:function(e){var t=this,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return Rw(e.msg)?this._rttIds[e.id]=e.id:e.dir===zN.SEND&&lP.print("_sendP2PMessage [DC Signaling p2p >>]",tg(e)),new X_((function(n,i){var o=t._genHeader(ud(ud({needAck:!0,functionType:1},r),{},{id:Iw()}));if(e.dir===zN.SEND){var a=setTimeout((function(){t._p2pCache.delete(e.id),i(new lR(uR.USER_MESSAGE_TIMEOUT,"P2P message timeout")),nP(t.id,e,999)}),12e3);t._p2pCache.set(e.id,{success:function(r,i){clearTimeout(a),n(i),nP(t.id,e,0)},error:function(r){var n;clearTimeout(a),nP(t.id,e,r.err);var o=JT(qN[r.err]||[uR.USER_MESSAGE_UNKNOWN,wm(n="err: ".concat(r.err,", msg: ")).call(n,r.msg)],2),s=o[0],c=o[1];i({err:r.err,code:s,message:r.msg||c})}})}try{t._sendMessage("p2p",o,e)}catch(s){throw s.code===uR.SIGNALING_CHANNEL_NOT_OPEN&&(s.code=uR.USER_MESSAGE_BROKEN),s}}))}},{key:"_sendMessage",value:function(e,t,r){var n;if(!this._dataChannel||"open"!==this._dataChannel.readyState)throw new lR(uR.SIGNALING_CHANNEL_NOT_OPEN,"DataChannel not open");var i=t.version+(+t.zip<<5)+(+t.encrypt<<6),o=+t.needAck+(+t.direction<<1)+(+t.functionType<<2)+(+t.binary<<6),a=dw.str2ab(tg([e,r])),s=cw(Uint8Array,wm(n=[i,o]).call(n,Wk(t.id||[])),new Uint8Array(a));this._dataChannel.send(s.buffer),"p2p"===e?rP(this.id,r,s.buffer.byteLength):"customMessage"===e&&oP(this.id,r,s.buffer.byteLength)}},{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=Xk(Sm(t).call(t,2,r))}return{header:o,data:Sm(t).call(t,r)}}},{key:"_feedbackSignaling",value:function(e,t,r){var n,i,o=this._genHeader({needAck:!0,direction:1,id:sg(n=e.split("-")).call(n,(function(e){return+e}))});Jm(hP).call(hP,t)||lP.print("Signal",wm(i=">>>>>> [".concat(t,"-res][")).call(i,e,"]"));this._sendMessage("".concat(t,"-res"),o,r)}},{key:"_handleMessage",value:(t=km(Em().mark((function e(t){var r,n,i,o,a,s,c,u,d,l,h,f,p,v,_,m,g,y,S,E,b,k,T,I,A,R,w,C,O,D,x,N,P,M,L,U=this;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:s=Date.now(),c=t.byteLength,u=this._dispartData(t),d=u.data,(l=u.header).zip&&((h=new _x.Inflate).push(d,!0),d=h.result),f=dw.ab2str(d),p=[],e.prev=8,p=JSON.parse(f),e.next=16;break;case 12:return e.prev=12,e.t0=e.catch(8),e.t0 instanceof Error&&iN.rtcSignalingMsgError(-1,e.t0.message,Ox.MESSAGE_PARSE_FAILED),e.abrupt("return");case 16:e.t1=l.functionType,e.next=0===e.t1?19:1===e.t1?38:2===e.t1?73:91;break;case 19:if(v=(null===(r=l.id)||void 0===r?void 0:r.join("-"))||"",1!==l.direction){e.next=24;break}this._handleAckMessage(v,p[0]||{},f),e.next=37;break;case 24:if(!Array.isArray(p)){e.next=37;break}if(_=p[0],p=p[1],Jm(hP).call(hP,_)||lP.print("Signal","<<<<<< ".concat(_),p,v),this._feedbackSignaling(v,_,_===FN.ON_CUSTOM_MESSAGE?ud(ud({},p),{},{message:""}):""),!p.binary||"string"!=typeof p.message){e.next=33;break}return e.next=32,dw.b64str2ab(p.message);case 32:p.message=e.sent;case 33:m=Date.now(),this.emit(_,ud({},p)),_===FN.ON_CUSTOM_MESSAGE&&cP(this.id,p,{msg_size:c,recv_msg_ts:s,fwd_msg_ts:m}),iN.rtcSignaling(0,f,"on-".concat(_),"Recv",p.streamId,p.clientId,Dx.DOWN);case 37:return e.abrupt("break",92);case 38:Array.isArray(p)&&(p=p[1]),g=null===(n=p)||void 0===n?void 0:n.id,this._rttIds[g]||(null===(i=p)||void 0===i?void 0:i.dir)===zN.FEEDBACK||Rw(null===(o=p)||void 0===o?void 0:o.msg)?delete this._rttIds[g]:lP.print("Signal","<<<<<< p2p response",p),e.t2=p.dir,e.next=e.t2===zN.SEND?44:e.t2===zN.FEEDBACK?69:71;break;case 44:if(y=Date.now(),Rw(null===(a=p)||void 0===a?void 0:a.msg)){e.next=66;break}if(E=(S=p).binary,b=S.msg,k=S.room,T=S.to,I=S.from,A=""===k?E?FN.USER_BINARY_MESSAGE_RECEIVED_OUTSIDE_ROOM:FN.USER_MESSAGE_RECEIVED_OUTSIDE_ROOM:E?FN.USER_BINARY_MESSAGE_RECEIVED:FN.USER_MESSAGE_RECEIVED,T){e.next=65;break}if(e.t3=this,e.t4=FN.ON_CUSTOM_MESSAGE,e.t5=I,e.t6=E,!E){e.next=59;break}return e.next=56,dw.b64str2ab(b);case 56:e.t7=e.sent,e.next=60;break;case 59:e.t7=b;case 60: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=66;break;case 65:E?this._asyncQueue.add(dw.b64str2ab(b),(function(e){return U.emit(A,ud(ud({},p),{},{msg:e}))})):this.emit(A,ud(ud({},p),{},{msg:b}));case 66:return this._sendP2PMessage(ud(ud({},p),{},{dir:zN.FEEDBACK,msg:""})),sP(this.id,p,{msg_size:c,recv_msg_ts:s,fwd_msg_ts:y}),e.abrupt("break",72);case 69:return this._handleP2PMsgFeedback(p),e.abrupt("break",72);case 71:return e.abrupt("break",72);case 72:return e.abrupt("break",92);case 73:if(1!==l.direction){e.next=78;break}w=(null===(R=l.id)||void 0===R?void 0:R.join("-"))||"",this._handleAckMessage(w,p[0]||{},f),e.next=90;break;case 78:if(C=JT(p,2),O=C[0],D=C[1],x=void 0===D?{}:D,"RXMediaMsg"!==O){e.next=90;break}N=x.type,P=x.data,iN.rtcSignaling(0,f,"on-".concat(N),"Recv","","",Dx.DOWN),e.t10=N,e.next="RSCP"===e.t10?85:"RTT"===e.t10?87:89;break;case 85:try{M=JSON.parse(P),Array.isArray(M)&&this.emit(N,M)}catch(V){}return e.abrupt("break",90);case 87:try{(L=JSON.parse(P)).length&&this.emit(N,L[0])}catch(V){}return e.abrupt("break",90);case 89:return e.abrupt("break",90);case 90:case 91:return e.abrupt("break",92);case 92:case"end":return e.stop()}}),e,this,[[8,12]])}))),function(e){return t.apply(this,arguments)})},{key:"_handleHandler",value:function(){var e=this,t=function(t){lP.print("_handleHandler","dataChannel close",t),e.emit("close",t)},r=function(t){lP.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 ud({version:2,zip:!1,encrypt:!1,needAck:!0,direction:0,functionType:0,binary:!1},e)}},{key:"_handleAckMessage",value:function(e,t,r){var n,i=this._singlingCache.get(e);i&&(this._singlingCache.delete(e),200===t.code?i.success(t):i.error(t),lP.print("Signal",wm(n="<<<<<< [".concat(i.signalingType,"-ack] ")).call(n,e),t));iN.rtcSignaling(0,r,null==i?void 0:i.signalingType,"Ack","","",Dx.DOWN)}},{key:"_handleP2PMsgFeedback",value:function(e){var t=this._p2pCache.get(e.id);t&&(this._p2pCache.delete(e.id),e.err===XN.SUCCESS?t.success(e.id,e):t.error(e))}}]),i}(uC.exports.EventEmitter),vP=function(){function e(){Wd(this,e),sd(this,"xhr",void 0),sd(this,"isSending",void 0),sd(this,"timeout",void 0),this.isSending=!1}return qd(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,c=e.stringify,u=void 0===c||c;return new X_((function(e,i){t.isSending=!0;var a=new XMLHttpRequest;a.open(r,n,!0);for(var c=0,d=SR(s);c<d.length;c++){var l=JT(d[c],2),h=l[0],f=l[1];a.setRequestHeader(h,f)}a.onreadystatechange=function(){if(4===a.readyState)if(t.isSending=!1,200===a.status)e(JSON.parse(a.responseText));else{var r=a.statusText,n=a.status;if(a.responseText)try{var o=JSON.parse(a.responseText);o.errMessage&&(r=o.errMessage),o.code&&(n=o.code)}catch(s){}i({message:r,code:n})}},a.onabort=function(){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),u&&(o=tg(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}(),_P=new RC("ICE Request",3),mP=function(){function e(){Wd(this,e),sd(this,"_request",void 0),this._request=new vP}var t,r,n;return qd(e,[{key:"getAccessNode",value:(n=km(Em().mark((function e(t,r,n,i,o,a,s,c){var u;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!(u=TN.getAccessNode(t))){e.next=9;break}if(this.getAccessNodeFromServer(t,r,n,i,o,a,s,c),_N("es.R.node.cache",u),!Array.isArray(u)){e.next=8;break}return e.abrupt("return",X_.resolve(u));case 8:return e.abrupt("return",X_.resolve([u]));case 9:return e.abrupt("return",this.getAccessNodeFromServer(t,r,n,i,o,a,s,c));case 10:case"end":return e.stop()}}),e,this)}))),function(e,t,r,i,o,a,s,c){return n.apply(this,arguments)})},{key:"getAccessNodeFromServer",value:(r=km(Em().mark((function e(t,r,n,i,o,a,s,c){var u,d,l,h,f=this;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return l=TN.getAccessUrls(),h=!0,_N("es.R.req.cache.urls",l),(null===(u=l)||void 0===u?void 0:u.length)>0||(l=CN.ICE_CONFIG_REQUEST_URLS,h=!1,_N("es.R.req.external.urls",l)),(null===(d=l)||void 0===d?void 0:d.length)>0||(l=CN.ICE_CONFIG_REQUEST_URLS_INTERNAL,h=!1,_N("es.R.req.internal.urls",l)),e.abrupt("return",this.getICEConfigFromServer(l,t,r,n,i,o,a,s,c).then((function(e){var r=e.nodes;return TN.setAccessNode(t,r,e.ttl||11200),e.dispatchDomains&&TN.setAccessUrls(e.dispatchDomains),r})).catch((function(e){if(h)return _N("es.R.req.fallback",""),TN.clearAccessUrls(),f.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,c){return r.apply(this,arguments)})},{key:"getICEConfigFromServer",value:(t=km(Em().mark((function e(t,r,n,i,o,a,s,c,u){var d,l,h,f,p=this;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return d={appID:r,userID:i,deviceID:o,connectSessionID:aw(),os:"web",sdkVersion:CN.VERSION,isOversea:CN.OVERSEA,expectedAddr:DN("EXPECTED_ADDR"),productPlatform:"BytePlus",enableCloudProxy:c,expectedIDC:u},a&&s&&(d.feedbackInfo=[{feedbackIP:null===(l=s.publicIPs[0])||void 0===l?void 0:l.ip,feedbackReason:{type:"NODE_CHANGED",reason:a}}],delete d.expectedAddr),h=Date.now(),iN.rtcGetAccess(0,tg(d),0,wx.REQUEST,t.join(","),d.connectSessionID),f=sg(t).call(t,function(){var e=km(Em().mark((function e(t,r){var n,i;return Em().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 lR(uR.ICE_SERVER_WRONG,"get ICE config failed",e.t0);case 9:if(200===n.code){e.next=11;break}throw new lR(uR.ICE_SERVER_WRONG,"get ICE config failed",{server_code:n.code,message:tg(n)});case 11:if(i=n.nodes[0]){e.next=14;break}throw new lR(uR.ICE_SERVER_WRONG,"ICE config server return empty nodes",{code:n.code,message:tg(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",Ow(f).then((function(e){var r=e.result;e.firstNode;var n=e.index;return iN.rtcGetAccess(200,tg(r),Date.now()-h,wx.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 iN.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,wx.RESPONSE,t.join(","),d.connectSessionID,{error:tg(i)}),e})));case 6:case"end":return e.stop()}}),e)}))),function(e,r,n,i,o,a,s,c,u){return t.apply(this,arguments)})},{key:"abort",value:function(){this._request.isSending&&(_P.print("abort","HTTP Request of [getICEConfigFromServer] abort"),this._request.abort())}}]),e}(),gP=function(){function e(){Wd(this,e),sd(this,"_request",void 0),this._request=new vP}return qd(e,[{key:"getConfig",value:function(e){var t,r=this,n={keys:["rts_report"],labelSelector:"",sdkVersion:"4.51.7",deviceType:"web",appId:e},i=sg(t=CN.CONFIG_REQUEST_DOMAINS).call(t,(function(e){return"https://".concat(e,"/decision/v1/multi")}));iN.rtcGetConfig(0,tg(n),0,i.join(","),kx.REQUEST,"",!1);var o=sg(i).call(i,function(){var e=km(Em().mark((function e(t,i){var o;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,r._request.post(t,n);case 3:o=e.sent,e.next=9;break;case 6:throw e.prev=6,e.t0=e.catch(0),new lR(uR.ICE_SERVER_WRONG,"get config failed");case 9:return e.abrupt("return",{result:o,index:i});case 10:case"end":return e.stop()}}),e,null,[[0,6]])})));return function(t,r){return e.apply(this,arguments)}}());return new X_((function(e){Ow(o).then((function(t){var r=t.result,n=t.index;iN.rtcGetConfig(200,tg(r),0,i[n],kx.RESPONSE,"",!1),e(r)})).catch((function(e){iN.rtcGetConfig(500,e.message,0,"",kx.RESPONSE,"",!1)}))}))}}]),e}(),yP=hi.f("asyncIterator");function SP(e){var t,r,n,i=2;for(void 0!==_l&&(r=yP,n=Pl);i--;){if(r&&null!=(t=e[r]))return t.call(e);if(n&&null!=(t=e[n]))return new EP(t.call(e));r="@@asyncIterator",n="@@iterator"}throw new TypeError("Object is not async iterable")}function EP(e){function t(e){if(Object(e)!==e)return X_.reject(new TypeError(e+" is not an object."));var t=e.done;return X_.resolve(e.value).then((function(e){return{value:e,done:t}}))}return(EP=function(e){this.s=e,this.n=e.next}).prototype={s:null,n:null,next:function(){return t(this.n.apply(this.s,arguments))},return:function(e){var r=this.s.return;return void 0===r?X_.resolve({value:e,done:!0}):t(r.apply(this.s,arguments))},throw:function(e){var r=this.s.return;return void 0===r?X_.reject(e):t(r.apply(this.s,arguments))}},new EP(e)}var bP=[{maxLayers:3,totalPixels:2073600},{maxLayers:3,totalPixels:921600},{maxLayers:3,totalPixels:518400},{maxLayers:2,totalPixels:230400},{maxLayers:2,totalPixels:129600},{maxLayers:1,totalPixels:57600},{maxLayers:1,totalPixels:0}];vy("Set",(function(e){return function(){return e(this,arguments.length?arguments[0]:void 0)}}),xy);var kP=ee.Set;Rr({target:"Set",stat:!0,forced:!0},{from:jy}),Rr({target:"Set",stat:!0,forced:!0},{of:Hy});var TP=D,IP=Ce,AP=tr,RP=function(){for(var e=AP(this),t=IP(e.add),r=0,n=arguments.length;r<n;r++)TP(t,e,arguments[r]);return e};Rr({target:"Set",proto:!0,real:!0,forced:!0},{addAll:RP}),Rr({target:"Set",proto:!0,real:!0,forced:!0},{deleteAll:qy});var wP=_h,CP=tr,OP=Yt,DP=wP,xP=Ph;Rr({target:"Set",proto:!0,real:!0,forced:!0},{every:function(e){var t=CP(this),r=DP(t),n=OP(e,arguments.length>1?arguments[1]:void 0);return!xP(r,(function(e,r){if(!n(e,e,t))return r()}),{IS_ITERATOR:!0,INTERRUPTED:!0}).stopped}});var NP=oe,PP=D,MP=Ce,LP=tr,UP=Tf,VP=Ph;Rr({target:"Set",proto:!0,real:!0,forced:!0},{difference:function(e){var t=LP(this),r=new(UP(t,NP("Set")))(t),n=MP(r.delete);return VP(e,(function(e){PP(n,r,e)})),r}});var FP=oe,BP=D,jP=Ce,GP=tr,HP=Yt,zP=Tf,KP=wP,XP=Ph;Rr({target:"Set",proto:!0,real:!0,forced:!0},{filter:function(e){var t=GP(this),r=KP(t),n=HP(e,arguments.length>1?arguments[1]:void 0),i=new(zP(t,FP("Set"))),o=jP(i.add);return XP(r,(function(e){n(e,e,t)&&BP(o,i,e)}),{IS_ITERATOR:!0}),i}});var qP=tr,WP=Yt,YP=wP,QP=Ph;Rr({target:"Set",proto:!0,real:!0,forced:!0},{find:function(e){var t=qP(this),r=YP(t),n=WP(e,arguments.length>1?arguments[1]:void 0);return QP(r,(function(e,r){if(n(e,e,t))return r(e)}),{IS_ITERATOR:!0,INTERRUPTED:!0}).result}});var JP=oe,ZP=D,$P=Ce,eM=tr,tM=Tf,rM=Ph;Rr({target:"Set",proto:!0,real:!0,forced:!0},{intersection:function(e){var t=eM(this),r=new(tM(t,JP("Set"))),n=$P(t.has),i=$P(r.add);return rM(e,(function(e){ZP(n,t,e)&&ZP(i,r,e)})),r}});var nM=D,iM=Ce,oM=tr,aM=Ph;Rr({target:"Set",proto:!0,real:!0,forced:!0},{isDisjointFrom:function(e){var t=oM(this),r=iM(t.has);return!aM(e,(function(e,n){if(!0===nM(r,t,e))return n()}),{INTERRUPTED:!0}).stopped}});var sM=oe,cM=D,uM=Ce,dM=A,lM=tr,hM=_h,fM=Ph;Rr({target:"Set",proto:!0,real:!0,forced:!0},{isSubsetOf:function(e){var t=hM(this),r=lM(e),n=r.has;return dM(n)||(r=new(sM("Set"))(e),n=uM(r.has)),!fM(t,(function(e,t){if(!1===cM(n,r,e))return t()}),{IS_ITERATOR:!0,INTERRUPTED:!0}).stopped}});var pM=D,vM=Ce,_M=tr,mM=Ph;Rr({target:"Set",proto:!0,real:!0,forced:!0},{isSupersetOf:function(e){var t=_M(this),r=vM(t.has);return!mM(e,(function(e,n){if(!1===pM(r,t,e))return n()}),{INTERRUPTED:!0}).stopped}});var gM=Rr,yM=tr,SM=gn,EM=wP,bM=Ph,kM=b([].join),TM=[].push;gM({target:"Set",proto:!0,real:!0,forced:!0},{join:function(e){var t=yM(this),r=EM(t),n=void 0===e?",":SM(e),i=[];return bM(r,TM,{that:i,IS_ITERATOR:!0}),kM(i,n)}});var IM=oe,AM=Yt,RM=D,wM=Ce,CM=tr,OM=Tf,DM=wP,xM=Ph;Rr({target:"Set",proto:!0,real:!0,forced:!0},{map:function(e){var t=CM(this),r=DM(t),n=AM(e,arguments.length>1?arguments[1]:void 0),i=new(OM(t,IM("Set"))),o=wM(i.add);return xM(r,(function(e){RM(o,i,n(e,e,t))}),{IS_ITERATOR:!0}),i}});var NM=Ce,PM=tr,MM=wP,LM=Ph,UM=TypeError;Rr({target:"Set",proto:!0,real:!0,forced:!0},{reduce:function(e){var t=PM(this),r=MM(t),n=arguments.length<2,i=n?void 0:arguments[1];if(NM(e),LM(r,(function(r){n?(n=!1,i=r):i=e(i,r,r,t)}),{IS_ITERATOR:!0}),n)throw UM("Reduce of empty set with no initial value");return i}});var VM=tr,FM=Yt,BM=wP,jM=Ph;Rr({target:"Set",proto:!0,real:!0,forced:!0},{some:function(e){var t=VM(this),r=BM(t),n=FM(e,arguments.length>1?arguments[1]:void 0);return jM(r,(function(e,r){if(n(e,e,t))return r()}),{IS_ITERATOR:!0,INTERRUPTED:!0}).stopped}});var GM=oe,HM=D,zM=Ce,KM=tr,XM=Tf,qM=Ph;Rr({target:"Set",proto:!0,real:!0,forced:!0},{symmetricDifference:function(e){var t=KM(this),r=new(XM(t,GM("Set")))(t),n=zM(r.delete),i=zM(r.add);return qM(e,(function(e){HM(n,r,e)||HM(i,r,e)})),r}});var WM=oe,YM=Ce,QM=tr,JM=Tf,ZM=Ph;Rr({target:"Set",proto:!0,real:!0,forced:!0},{union:function(e){var t=QM(this),r=new(JM(t,WM("Set")))(t);return ZM(e,YM(r.add),{that:r}),r}});var $M=kP,eL=new yE,tL=function(){var e=km(Em().mark((function e(t){return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",new X_((function(e,r){var n=DN("STATS_SCALLBACK_SUPPORT");if("chrome-stable"===lw()&&void 0===window.InstallTrigger&&hw&&n)try{t.getStats((function(t){var r=[];t.result().forEach((function(e){if(!Jm(oL).call(oL,e.type)){var t={};e.names().forEach((function(r){t[r]=e.stat(r)})),r.push(ud(ud({},t),{},{id:e.id,type:e.type,timestamp:e.timestamp}))}})),e({all:r,getTrackStats:function(e){return Gs(r).call(r,(function(t){return"ssrc"!==t.type||t.googTrackId===e}))}})}))}catch(EW){r(EW)}else e({all:[],getTrackStats:function(){return[]}})})));case 1:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),rL=function(){var e=km(Em().mark((function e(t){var r,n,i,o,a,s;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,t.getStats();case 2:return i=e.sent,o={all:[]},a=new yE,i.forEach((function(e){var t=a.get(e.type)||new yE;t.set(e.id,e),a.set(e.type,t),o.all.push(e)})),s=function(e,t){e.forEach((function(e){var r,n,i,o,s,c,u=e.codecId,d=e.transportId,l=e.trackId,h=e.playoutId;if(null===(r=a.get(iL.codec))||void 0===r||r.forEach((function(e){e.id===u&&t.add(e)})),null===(n=a.get(iL.transport))||void 0===n||n.forEach((function(e){e.id===d&&(s=e,t.add(e))})),null===(i=a.get(iL.track))||void 0===i||i.forEach((function(e){e.id===l&&t.add(e)})),null===(o=a.get(iL.mediaPlayout))||void 0===o||o.forEach((function(e){e.id===h&&t.add(e)})),s){var f,p,v=s,_=v.localCertificateId,m=v.remoteCertificateId,g=v.selectedCandidatePairId;null===(f=a.get(iL.certificate))||void 0===f||f.forEach((function(e){(e.id===_||e.id===m)&&t.add(e)})),null===(p=a.get(iL.candidatePair))||void 0===p||p.forEach((function(e){e.id===g&&(c=e,t.add(e))}))}if(c){var y,S,E=c,b=E.localCandidateId,k=E.remoteCandidateId;null===(y=a.get(iL.localCandidate))||void 0===y||y.forEach((function(e){e.id===b&&t.add(e)})),null===(S=a.get(iL.remoteCandidate))||void 0===S||S.forEach((function(e){e.id===k&&t.add(e)}))}}))},null===(r=a.get(iL.mediaSource))||void 0===r||r.forEach((function(e){var t,r=new $M;r.add(e);var n=[];null===(t=a.get(iL.outboundRtp))||void 0===t||t.forEach((function(t){var i;t.mediaSourceId===e.id&&(r.add(t),n.push(t),null===(i=a.get(iL.remoteInboundRtp))||void 0===i||i.forEach((function(e){e.localId===t.id&&r.add(e)})))})),s(n,r),o[e.trackIdentifier]=Xk(r)})),null===(n=a.get(iL.inboundRtp))||void 0===n||n.forEach((function(e){var t,r=new $M;r.add(e),null===(t=a.get(iL.remoteOutboundRtp))||void 0===t||t.forEach((function(t){t.localId===e.id&&r.add(t)})),s([e],r);var n,i=e.trackIdentifier;i||(null===(n=a.get(iL.track))||void 0===n||n.forEach((function(t){t.id===e.trackId&&(i=t.trackIdentifier)})));o[i]=Xk(r)})),e.abrupt("return",o);case 10:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),nL=function(){var e=km(Em().mark((function e(t,r,n){var i,o,a,s,c,u;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(i=null==r?void 0:r.id,t instanceof RTCPeerConnection){e.next=3;break}return e.abrupt("return",[]);case 3:if(!fw&&!pw){e.next=10;break}return o=[],e.next=7,t.getStats(r);case 7:return e.sent.forEach((function(e){o.push(e)})),e.abrupt("return",o);case 10:return(!(a=eL.get(t))||Date.now()-a.timestamp>150)&&(a={timestamp:Date.now(),statsPromise:rL(t),extraStatsPromise:tL(t)},eL.set(t,a)),e.next=14,a.statsPromise;case 14:if(s=e.sent,c=(i?s[i]:s.all)||[],n){e.next=21;break}return e.next=19,a.extraStatsPromise;case 19:u=e.sent,c=wm(c).call(c,(i?u.getTrackStats(i):u.all)||[]);case 21:return e.abrupt("return",c);case 22:case"end":return e.stop()}}),e)})));return function(t,r,n){return e.apply(this,arguments)}}();lw();var iL=function(e){return e.codec="codec",e.inboundRtp="inbound-rtp",e.outboundRtp="outbound-rtp",e.remoteInboundRtp="remote-inbound-rtp",e.remoteOutboundRtp="remote-outbound-rtp",e.mediaSource="media-source",e.csrc="csrc",e.peerConnection="peer-connection",e.dataChannel="data-channel",e.stream="stream",e.track="track",e.transceiver="transceiver",e.sender="sender",e.receiver="receiver",e.transport="transport",e.sctpTransport="sctp-transport",e.candidatePair="candidate-pair",e.localCandidate="local-candidate",e.remoteCandidate="remote-candidate",e.certificate="certificate",e.iceServer="ice-server",e.mediaPlayout="media-playout",e}(iL||{}),oL=["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"],aL=function(){var e=km(Em().mark((function e(){return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(e.prev=0,!uw()&&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,vL();case 5:if(e.t0=e.sent,!e.t0){e.next=10;break}return e.next=9,pL();case 9:e.t0=e.sent;case 10:return e.abrupt("return",e.t0);case 13:return e.prev=13,e.t1=e.catch(0),e.abrupt("return",!1);case 16:case"end":return e.stop()}}),e,null,[[0,13]])})));return function(){return e.apply(this,arguments)}}(),sL=function(){var e=km(Em().mark((function e(){var t;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=[],e.next=3,vL();case 3:if(e.t0=e.sent,!e.t0){e.next=8;break}return e.next=7,pL();case 7:e.t0=e.sent;case 8:if(!e.t0){e.next=10;break}t.push("H264");case 10:return e.next=12,mL();case 12:if(e.t1=e.sent,!e.t1){e.next=17;break}return e.next=16,_L();case 16:e.t1=e.sent;case 17:if(!e.t1){e.next=19;break}t.push("vp8");case 19:return e.abrupt("return",t);case 20:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),cL=function(){var e=km(Em().mark((function e(){var t;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,sL();case 2:return t=e.sent,e.abrupt("return",sg(t).call(t,(function(e){return e.toUpperCase()})));case 4:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),uL={};function dL(e){var t;if(xb(t=["level-asymmetry-allowed=1;packetization-mode=1;profile-level-id=42e01f","profile-level-id=42e01f;level-asymmetry-allowed=1;packetization-mode=1","packetization-mode=1;profile-level-id=42e01f;level-asymmetry-allowed=1"]).call(t,(function(t){return null==e?void 0:Jm(e).call(e,t)}))){for(var r=navigator.userAgent.toLowerCase(),n=!1,i=0,o=["miuibrowser"];i<o.length;i++){var a=o[i];Jm(r).call(r,a)&&(n=!0)}return!n}return!1}var lL=function(){var e=km(Em().mark((function e(t){var r,n;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return(r=new RTCPeerConnection).addTransceiver("audio",{direction:t}),r.addTransceiver("video",{direction:t}),e.next=5,r.createOffer();case 5:return n=e.sent,r.close(),e.abrupt("return",n.sdp);case 8:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),hL=function(){var e=km(Em().mark((function e(){var t,r;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,lL("sendonly");case 2:if(r=e.sent,!Jm(t=navigator.userAgent).call(t,"VivoBrowser")){e.next=7;break}return e.next=6,lL("sendonly");case 6:r=e.sent;case 7:return uL.h264encode=dL(r),uL.vp8encode=Hb(r).call(r,"VP8")>-1,e.abrupt("return",uL);case 10:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),fL=function(){var e=km(Em().mark((function e(){var t,r;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,lL("recvonly");case 2:if(r=e.sent,!Jm(t=navigator.userAgent).call(t,"VivoBrowser")){e.next=7;break}return e.next=6,lL("recvonly");case 6:r=e.sent;case 7:return uL.h264decode=dL(r),uL.vp8decode=Hb(r).call(r,"VP8")>-1,e.abrupt("return",uL);case 10:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),pL=function(){var e=km(Em().mark((function e(){return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(void 0!==uL.h264encode){e.next=9;break}return e.prev=1,e.next=4,hL();case 4:e.next=9;break;case 6:return e.prev=6,e.t0=e.catch(1),e.abrupt("return",!1);case 9:return e.abrupt("return",uL.h264encode||!1);case 10:case"end":return e.stop()}}),e,null,[[1,6]])})));return function(){return e.apply(this,arguments)}}(),vL=function(){var e=km(Em().mark((function e(){return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(void 0!==uL.h264decode){e.next=9;break}return e.prev=1,e.next=4,fL();case 4:e.next=9;break;case 6:return e.prev=6,e.t0=e.catch(1),e.abrupt("return",!1);case 9:return e.abrupt("return",uL.h264decode||!1);case 10:case"end":return e.stop()}}),e,null,[[1,6]])})));return function(){return e.apply(this,arguments)}}(),_L=function(){var e=km(Em().mark((function e(){return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(void 0!==uL.vp8encode){e.next=9;break}return e.prev=1,e.next=4,hL();case 4:e.next=9;break;case 6:return e.prev=6,e.t0=e.catch(1),e.abrupt("return",!1);case 9:return e.abrupt("return",uL.vp8encode||!1);case 10:case"end":return e.stop()}}),e,null,[[1,6]])})));return function(){return e.apply(this,arguments)}}(),mL=function(){var e=km(Em().mark((function e(){return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(void 0!==uL.vp8decode){e.next=9;break}return e.prev=1,e.next=4,fL();case 4:e.next=9;break;case 6:return e.prev=6,e.t0=e.catch(1),e.abrupt("return",!1);case 9:return e.abrupt("return",uL.vp8decode||!1);case 10:case"end":return e.stop()}}),e,null,[[1,6]])})));return function(){return e.apply(this,arguments)}}(),gL=function(){return"undefined"!=typeof TransformStream&&"undefined"!=typeof RTCRtpSender&&"undefined"!=typeof RTCRtpReceiver&&void 0!==RTCRtpSender.prototype.createEncodedStreams&&void 0!==RTCRtpReceiver.prototype.createEncodedStreams},yL={},SL={},EL={exports:{}},bL=EL.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"]}]};an(bL).forEach((function(e){bL[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=EL.exports,i=RegExp.prototype.test.bind(/^([a-z])=(.*)/);e.parse=function(e){var t,o={},a=[],s=o;return Gs(t=e.split(/(\r\n|\r|\n)/)).call(t,i).forEach((function(e){var t=e[0],i=Sm(e).call(e,2);"m"===t&&(a.push({rtp:[],fmtp:[]}),s=a[a.length-1]);for(var o=0;o<(n[t]||[]).length;o+=1){var c=n[t][o];if(c.reg.test(i))return r(c,s,i)}})),o.media=a,o};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){var t;return PE(t=e.split(/;\s?/)).call(t,o,{})},e.parseFmtpConfig=e.parseParams,e.parsePayloads=function(e){var t;return sg(t=e.toString().split(" ")).call(t,Number)},e.parseRemoteCandidates=function(e){for(var r,n=[],i=sg(r=e.split(" ")).call(r,t),o=0;o<i.length;o+=3)n.push({component:i[o],ip:i[o+1],port:i[o+2]});return n},e.parseImageAttributes=function(e){var t;return sg(t=e.split(" ")).call(t,(function(e){var t;return PE(t=e.substring(1,e.length-1).split(",")).call(t,o,{})}))},e.parseSimulcastStreamList=function(e){var r;return sg(r=e.split(";")).call(r,(function(e){var r;return sg(r=e.split(",")).call(r,(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}}))}))}}(SL);var kL=EL.exports,TL=/%[sdv%]/g,IL=function(e){var t=1,r=arguments,n=r.length;return e.replace(TL,(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""}}))},AL=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 IL.apply(null,n)},RL=["v","o","s","i","u","e","p","c","b","t","r","z","a"],wL=["i","c","b","a"],CL=SL,OL=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||RL,n=t.innerOrder||wL,i=[];return r.forEach((function(t){kL[t].forEach((function(r){r.name in e&&null!=e[r.name]?i.push(AL(t,r,e)):r.push in e&&null!=e[r.push]&&e[r.push].forEach((function(e){i.push(AL(t,r,e))}))}))})),e.media.forEach((function(e){i.push(AL("m",kL.m[0],e)),n.forEach((function(t){kL[t].forEach((function(r){r.name in e&&null!=e[r.name]?i.push(AL(t,r,e)):r.push in e&&null!=e[r.push]&&e[r.push].forEach((function(e){i.push(AL(t,r,e))}))}))}))})),i.join("\r\n")+"\r\n"};yL.write=OL,yL.parse=CL.parse,yL.parseParams=CL.parseParams,yL.parseFmtpConfig=CL.parseFmtpConfig,yL.parsePayloads=CL.parsePayloads,yL.parseRemoteCandidates=CL.parseRemoteCandidates,yL.parseImageAttributes=CL.parseImageAttributes,yL.parseSimulcastStreamList=CL.parseSimulcastStreamList;var DL=new RC("FirefoxHandler",3),xL=Math.pow(2,32),NL="kp34Za0H+aVf862l",PL="o/i14u9pJrxRKAsu";function ML(e){return e>xL-18?(DL.print("generateAllSsrc","reset start id",e),ML(e=e-xL+1e4+18)):{audio:e,audioFec:e+1,audioRtx:e+2,video:e+3,videoFec:e+4,videoRtx:e+5,next:e+18}}var LL=function(e,t,r){var n,i,o,a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:PL;return[{id:r,attribute:"cname",value:a},{id:r,attribute:"msid",value:wm(n=wm(i="".concat(e," ")).call(i,e,"-")).call(n,t)},{id:r,attribute:"mslabel",value:"".concat(e)},{id:r,attribute:"label",value:wm(o="".concat(e,"-")).call(o,t)}]},UL=function(e,t){var r,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=t.video,o=t.videoRtx,a=t.videoFec,s=[i,o],c=n.cname,u=n.flexfec;u&&s.push(a);var d,l=PE(s).call(s,(function(t,r){return wm(t).call(t,LL(e,"video",r,c))}),[]),h=[{semantics:"FID",ssrcs:wm(r="".concat(i," ")).call(r,o)}];u&&h.push({semantics:"FEC-FR",ssrcs:wm(d="".concat(i," ")).call(d,a)});return{ssrcs:l,ssrcGroups:h}};function VL(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 FL=function(e,t,r){var n=!(arguments.length>3&&void 0!==arguments[3])||arguments[3],i=ud(ud({},e),{},{media:[]});return n&&(i.invalid=[{value:"realx-exts:rscp"}]),t&&i.media.push(t),r&&i.media.push(r),delete i.groups,delete i.msidSemantic,yL.write(i)};function BL(e){return jL.apply(this,arguments)}function jL(){return(jL=km(Em().mark((function e(t){var r,n,i,o,a;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r={},n=t.publicIPs,i=t.certFingerprint,o=t.iceParams,a=t.iceConfig,r.fingerprint={type:"sha-256",hash:i},r.icePwd=o.serverIcePwd,e.next=6,HL(o.serverIceUfrag);case 6:return r.iceUfrag=e.sent,r.candidates=GL(n,a),r.setup="active",r.iceOptions="renomination",e.abrupt("return",r);case 11:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function GL(e,t){if(!Array.isArray(e))return[];var r=0,n=2130706431,i=[],o=DN("CONNECTION_MODE");return e.forEach((function(e){var a={component:1,ip:e.ip,type:"host",generation:e.generation};e.udpPorts&&!t.tcpOnly&&o!==Fd.FORCE_TCP&&e.udpPorts.forEach((function(e){i.push(ud(ud({},a),{},{foundation:r++,transport:"udp",port:e,priority:n}))})),e.tcpPorts&&o!==Fd.FORCE_UDP&&e.tcpPorts.forEach((function(e){i.push(ud(ud({},a),{},{foundation:r++,transport:"tcp",port:e,tcptype:"passive",priority:2130705431}))}))})),i}var HL=function(){var e=km(Em().mark((function e(t){var r,n,i,o,a,s,c;return Em().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,dw.b64str2ab(t);case 5:return e.t1=e.sent,i=new e.t0(e.t1),o=new Uint8Array(4),crypto.getRandomValues(o),(a=new Uint8Array(2))[0]=0,a[1]=1,s=cw(Uint8Array,n,i,o,a),e.next=15,dw.ab2b64str(s.buffer);case 15:return c=e.sent,e.abrupt("return",c);case 17:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),zL=function(e,t){var r=0;if(Array.isArray(e.fmtp)&&Array.isArray(e.rtp)){var n,i=QT(e.fmtp);try{for(i.s();!(n=i.n()).done;){var o,a,s,c=n.value;if(Jm(o=c.config).call(o,"level-asymmetry-allowed=1")&&Jm(a=c.config).call(a,"packetization-mode=1")&&Jm(s=c.config).call(s,"profile-level-id=42e01f")){r=c.payload;break}}}catch(p){i.e(p)}finally{i.f()}for(var u=0;u<e.rtp.length;u++){var d=e.rtp[u];if("H264"===t){if(d.payload===r){var l;e.rtp.unshift(vk(l=e.rtp).call(l,u,1)[0]);break}}else if(d.codec===t){var h;e.rtp.unshift(vk(h=e.rtp).call(h,u,1)[0]);break}}var f=[];e.rtp.forEach((function(e){return f.push(e.payload)})),e.payloads=f.join(" ")}},KL=new RC("BasicHandler",3),XL={iceServers:[],iceTransportPolicy:"all",bundlePolicy:"max-bundle",rtcpMuxPolicy:"require",sdpSemantics:"unified-plan",encodedInsertableStreams:!!gL()||void 0},qL=function(e){OI(o,e);var t,r,n,i=qI(o);function o(e,t){var r;return Wd(this,o),sd(ZT(r=i.call(this)),"_peerConnection",void 0),sd(ZT(r),"_dataChannel",void 0),sd(ZT(r),"_context",void 0),sd(ZT(r),"monitor",void 0),sd(ZT(r),"_offerIce",{}),sd(ZT(r),"_answerIce",{}),sd(ZT(r),"_initSctpEvents",!1),sd(ZT(r),"_nextSsrc",Math.floor(Math.random()*xL+1e4)),sd(ZT(r),"_aSendonlyAnswerTpl",void 0),sd(ZT(r),"_vSendonlyAnswerTpl",void 0),sd(ZT(r),"_enableSubFlexfec",!1),sd(ZT(r),"audioTrack4ff",void 0),sd(ZT(r),"connection_id",""),sd(ZT(r),"ms_addr",""),r.monitor=e,r._peerConnection=new RTCPeerConnection(XL),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,i,o,a=null===(t=e.streams)||void 0===t||null===(n=t[0])||void 0===n?void 0:n.id;KL.print("constructor",wm(i=wm(o="pc.ontrack ".concat(e.track.kind," ")).call(o,e.track.id," ")).call(i,a)),"ff-stream"===a&&(r.audioTrack4ff=e.track),r.emit("ontrack",e)},r._peerConnection.onconnectionstatechange=function(e){var t;KL.print("constructor",wm(t="onconnectionstatechange ".concat(r._peerConnection.iceConnectionState," -> ")).call(t,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,Cx["".concat(t.toUpperCase())],r.connection_id,{ms_addr:r.ms_addr})},r}return qd(o,[{key:"disconnect",value:function(){this._peerConnection.close(),this._dataChannel.close(),this._peerConnection.ontrack=null}},{key:"destroy",value:function(){KL.print("destroy"),this.disconnect(),this._context=void 0}},{key:"getTransceivers",value:function(){return this._peerConnection.getTransceivers()}},{key:"_simulcast",value:function(e,t,r,n,i){var o,a,s,c=[];1===e.videoEncodeConfig.length?(c=function(e,t){var r=[];if(t<=1)return r;var n=Math.min(e.width,e.height)/90;return r.push({scaleResolutionDownBy:n,width:Math.floor(e.width/n),height:Math.floor(e.height/n),maxkbps:100,frameRate:10}),t<=2||r.unshift({scaleResolutionDownBy:2,width:Math.floor(e.width/2),height:Math.floor(e.height/2),maxkbps:Math.floor(e.maxKbps/2),frameRate:e.frameRate>=30?Math.floor(e.frameRate/2):e.frameRate}),r}(t,i),KL.print("simulcast() ","simulcastLayers: %o",c)):(c=sg(o=Sm(a=Sm(s=e.videoEncodeConfig).call(s,1)).call(a,1-i)).call(o,(function(e){var r=Bw(e.width),n=t.width/r;return{width:r,height:Math.floor(t.height/n),scaleResolutionDownBy:n,frameRate:Bw(e.frameRate)||15,maxkbps:e.maxKbps||600}})),KL.print("simulcast() ","simulcastLayers2: %o",c));var u=[!0];c.forEach((function(e,t){var i,o={maxBitrate:1e3*e.maxkbps,scaleResolutionDownBy:e.scaleResolutionDownBy,rid:"".concat(t+1),maxFramerate:e.frameRate};null===(i=r.sendEncodings)||void 0===i||i.unshift(o),n.push({width:e.width,height:e.height,framerate:e.frameRate,maxkbps:e.maxkbps,rid:"".concat(t+1)}),u.push(!0)})),this._context&&(this._context.activeSimStreams=u)}},{key:"internalPublish",value:function(e){var t=e.stream,r=e.videoTrack,n=e.audioTrack,i=e.enableSimulcast,o=e.pubAudio,a=e.pubVideo,s={direction:"sendonly",streams:[t]},c={direction:"sendonly",streams:[t]},u=[],d=[];if(Array.isArray(null==e?void 0:e.videoEncodeConfig)&&e.videoEncodeConfig.length){var l=null==r?void 0:r.getTrack(),h=ud({},NN);if(l){var f=null==l?void 0:l.getSettings();h={width:Math.floor(f.width),height:Math.floor(f.height),frameRate:Math.floor(f.frameRate)}}"number"!=typeof h.frameRate&&(h.frameRate=30);var p=null==e?void 0:e.videoEncodeConfig[0],v={maxBitrate:1e3*p.maxKbps,rid:"0"};if(e.prevBitrate=p.maxKbps,c.sendEncodings=[v],u.push({width:h.width,height:h.height,framerate:h.frameRate,maxkbps:p.maxKbps,rid:"0"}),!fw&&i){var _,m,g=function(e){for(var t=0,r=e.width*e.height,n=0;n<bP.length;n++)if(r>=bP[n].totalPixels){t=n;break}if(0===t)return bP[t].maxLayers;var i=bP[t-1].totalPixels;return(i-r)/(i-bP[t].totalPixels)<.1?bP[t-1].maxLayers:bP[t].maxLayers}(h);if(KL.print("simulcast() ","maxLayers: %o",g),g>1)this._simulcast(e,ud(ud({},h),{},{maxKbps:p.maxKbps}),c,u,g),null!==(_=this._context)&&void 0!==_&&null!==(m=_.serverConfig)&&void 0!==m&&m.simulcastOnDemand&&(d=sg(u).call(u,(function(e,t){return ud(ud({},e),{},{video_index:t,sub_index:t})})))}}KL.print("publish videoTransceiverInit videoDescriptions","",c,u);var y=null==n?void 0:n.getTrack("preprocessing");(null==n?void 0:n.mixType)!==Gd.PLAYOUT&&null!=n&&n.mixedAudioTrack&&(y=null==n?void 0:n.mixedAudioTrack),y=o&&y?y:"audio";var S=null==r?void 0:r.getTrack("preprocessing");S=a&&S?S:"video";try{this.monitor.rtcInvokeStatus(tg({aTrack:Lw(y),vTrack:Lw(S),audioTransceiverInit:s,videoTransceiverInit:c}),0,"Handler.internalPublish","",0)}catch(EW){}return{semantics:"unified-plan",videoDescriptions:u,subVideoDescriptions:d,audioTransceiverInit:{track:y,init:s},videoTransceiverInit:{track:S,init:c}}}},{key:"updateMaxBitrate",value:function(e){var t,r,n,i;KL.print("updateMaxBitrate()");var o=null===(t=e.videoTrack)||void 0===t?void 0:t.getTrack(),a=e.videoTransceiver;if(o&&e.pubVideo&&a){var s=null===(r=e.videoEncodeConfig)||void 0===r||null===(n=r[0])||void 0===n?void 0:n.maxKbps;if(s){if(s===e.prevBitrate)return void KL.print("updateMaxBitrate()","no change");e.prevBitrate=s}var c=null===(i=a.sender)||void 0===i?void 0:i.getParameters();if(c){var u;c.encodings=null==c||null===(u=c.encodings)||void 0===u?void 0:sg(u).call(u,(function(t){var r,n=+t.rid||0,i=null===(r=e.videoEncodeConfig[n])||void 0===r?void 0:r.maxKbps;return"number"==typeof i&&(t.maxBitrate=1e3*i),t})),null==a||a.sender.setParameters(c);try{this.monitor.rtcInvokeStatus(tg(c.encodings),0,"Handler.updateScaleResolutionDownBy","",0)}catch(EW){}}}else KL.print("updateMaxBitrate()","no pub")}},{key:"getStats",value:function(e,t){return nL(this._peerConnection,e,t)}},{key:"setLocalDescription",value:(n=km(Em().mark((function e(t,r){var n,i,o,a=this;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=sw(),e.prev=1,e.next=4,this._peerConnection.setLocalDescription(new RTCSessionDescription({type:"offer",sdp:t}));case 4:this.monitor.rtcSetDescription(0,t,Px.W_1,"local"===(null==r?void 0:r.streamUserId)?Mx.UP:Mx.DOWN,(null==r?void 0:r.streamId)||"",(null==r?void 0:r.streamUserId)||"",sw()-n,this.connection_id,{type:"offer",ms_addr:this.ms_addr}),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,{ms_addr:a.ms_addr},a.connection_id)},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,{ms_addr:a.ms_addr},a.connection_id)}))),e.next=12;break;case 8:e.prev=8,e.t0=e.catch(1),console.error("setLocal",e.t0),this.monitor.rtcSetDescription(-1,e.t0.message+t,Px.W_1,"local"===(null==r?void 0:r.streamUserId)?Mx.UP:Mx.DOWN,"","",sw()-n,this.connection_id,{type:"offer",ms_addr:this.ms_addr});case 12:case"end":return e.stop()}}),e,this,[[1,8]])}))),function(e,t){return n.apply(this,arguments)})},{key:"setRemoteDescription",value:(r=km(Em().mark((function e(t,r){var n;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=sw(),e.prev=1,e.next=4,this._peerConnection.setRemoteDescription(new RTCSessionDescription({type:"answer",sdp:t}));case 4:this.monitor.rtcSetDescription(0,t,Px.W_0,"local"===(null==r?void 0:r.streamUserId)?Mx.UP:Mx.DOWN,(null==r?void 0:r.streamId)||"",(null==r?void 0:r.streamUserId)||"",sw()-n,this.connection_id,{type:"answer",ms_addr:this.ms_addr}),e.next=11;break;case 7:e.prev=7,e.t0=e.catch(1),console.error("setRemote",e.t0),this.monitor.rtcSetDescription(-1,e.t0.message+t,Px.W_1,"local"===(null==r?void 0:r.streamUserId)?Mx.UP:Mx.DOWN,(null==r?void 0:r.streamId)||"",(null==r?void 0:r.streamUserId)||"",sw()-n,this.connection_id,{type:"answer",ms_addr:this.ms_addr});case 11:case"end":return e.stop()}}),e,this,[[1,7]])}))),function(e,t){return r.apply(this,arguments)})},{key:"setCurrentDescription",value:(t=km(Em().mark((function e(){return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:case"end":return e.stop()}}),e)}))),function(){return t.apply(this,arguments)})},{key:"createAVMlineAnswerTpl",value:function(e){var t=this;yL.parse(e).media.forEach((function(e){if("audio"===e.type){if("sendonly"===e.direction){var r,n=null==e?void 0:xb(r=e.rtp).call(r,(function(e){return"opus"===e.codec}));if(n&&null!=e&&e.fmtp){var i,o=null==e?void 0:xb(i=e.fmtp).call(i,(function(e){return e.payload===n.payload}));o&&t._context&&(o.config+=";stereo=1;sprop-stereo=1")}t._aSendonlyAnswerTpl=e}}else"video"===e.type&&("sendonly"===e.direction&&(t._vSendonlyAnswerTpl=e),Array.isArray(e.rtp)&&e.rtp.forEach((function(e){var r;null!==(r=e.codec)&&void 0!==r&&Jm(r).call(r,"flexfec")&&(t._enableSubFlexfec=!0)})))}))}},{key:"pc",get:function(){return this._peerConnection}},{key:"addBitrateLimit",value:function(e,t){null==e||e.rtp.forEach((function(r){var n,i=r.codec,o=r.payload;if(Jm(n=["vp8","h264"]).call(n,i.toLocaleLowerCase())){var a,s,c=xb(a=e.fmtp).call(a,(function(e){return e.payload===o}));if(c)c.config=wm(s=[]).call(s,Wk(c.config.split(";")),["x-google-min-bitrate=100","x-google-start-bitrate=".concat(t)]).join(";");else e.fmtp.push({payload:o,config:"x-google-min-bitrate=100;x-google-start-bitrate=".concat(t)})}}))}}]),o}(uC.exports.EventEmitter),WL=b,YL=my,QL=Og.exports.getWeakData,JL=vf,ZL=tr,$L=z,eU=$,tU=Ph,rU=Ye,nU=Zi.set,iU=Zi.getterFor,oU=Po.find,aU=Po.findIndex,sU=WL([].splice),cU=0,uU=function(e){return e.frozen||(e.frozen=new dU)},dU=function(){this.entries=[]},lU=function(e,t){return oU(e.entries,(function(e){return e[0]===t}))};dU.prototype={get:function(e){var t=lU(this,e);if(t)return t[1]},has:function(e){return!!lU(this,e)},set:function(e,t){var r=lU(this,e);r?r[1]=t:this.entries.push([e,t])},delete:function(e){var t=aU(this.entries,(function(t){return t[0]===e}));return~t&&sU(this.entries,t,1),!!~t}};var hU,fU={getConstructor:function(e,t,r,n){var i=e((function(e,i){JL(e,o),nU(e,{type:t,id:cU++,frozen:void 0}),$L(i)||tU(i,e[n],{that:e,AS_ENTRIES:r})})),o=i.prototype,a=iU(t),s=function(e,t,r){var n=a(e),i=QL(ZL(t),!0);return!0===i?uU(n).set(t,r):i[n.id]=r,e};return YL(o,{delete:function(e){var t=a(this);if(!eU(e))return!1;var r=QL(e);return!0===r?uU(t).delete(e):r&&rU(r,t.id)&&delete r[t.id]},has:function(e){var t=a(this);if(!eU(e))return!1;var r=QL(e);return!0===r?uU(t).has(e):r&&rU(r,t.id)}}),YL(o,r?{get:function(e){var t=a(this);if(eU(e)){var r=QL(e);return!0===r?uU(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}},pU=n,vU=b,_U=my,mU=Og.exports,gU=vy,yU=fU,SU=$,EU=Ug,bU=Zi.enforce,kU=Vi,TU=!pU.ActiveXObject&&"ActiveXObject"in pU,IU=function(e){return function(){return e(this,arguments.length?arguments[0]:void 0)}},AU=gU("WeakMap",IU,yU);if(kU&&TU){hU=yU.getConstructor(IU,"WeakMap",!0),mU.enable();var RU=AU.prototype,wU=vU(RU.delete),CU=vU(RU.has),OU=vU(RU.get),DU=vU(RU.set);_U(RU,{delete:function(e){if(SU(e)&&!EU(e)){var t=bU(this);return t.frozen||(t.frozen=new hU),wU(this,e)||t.frozen.delete(e)}return wU(this,e)},has:function(e){if(SU(e)&&!EU(e)){var t=bU(this);return t.frozen||(t.frozen=new hU),CU(this,e)||t.frozen.has(e)}return CU(this,e)},get:function(e){if(SU(e)&&!EU(e)){var t=bU(this);return t.frozen||(t.frozen=new hU),CU(this,e)?OU(this,e):t.frozen.get(e)}return OU(this,e)},set:function(e,t){if(SU(e)&&!EU(e)){var r=bU(this);r.frozen||(r.frozen=new hU),CU(this,e)?DU(this,e,t):r.frozen.set(e,t)}else DU(this,e,t);return this}})}var xU=ee.WeakMap;Rr({target:"WeakMap",proto:!0,real:!0,forced:!0},{emplace:Jy}),Rr({target:"WeakMap",stat:!0,forced:!0},{from:jy}),Rr({target:"WeakMap",stat:!0,forced:!0},{of:Hy}),Rr({target:"WeakMap",proto:!0,real:!0,forced:!0},{deleteAll:qy}),Rr({target:"WeakMap",proto:!0,real:!0,forced:!0},{upsert:gE});var NU=xU,PU=function(e){OI(f,e);var t,r,n,i,o,a,s,c,u,d,l,h=qI(f);function f(){var e,t,r;return Wd(this,f),sd(ZT(r=h.call(this)),"inited",!1),sd(ZT(r),"deviceMap",{audioinput:new yE,audiooutput:new yE,videoinput:new yE}),sd(ZT(r),"checkDeviceChangeTimer",null),sd(ZT(r),"isSupportedPermissionsQuery",!1),sd(ZT(r),"isGrantedMicrophonePermission",!1),sd(ZT(r),"isGrantedCameraPermission",!1),r.isSupportedPermissionsQuery=!uw()&&!(null===(e=navigator)||void 0===e||null===(t=e.permissions)||void 0===t||!t.query),r._handleDeviceChange=r._handleDeviceChange.bind(ZT(r)),!uw()&&r.refreshDevices(),r}return qd(f,[{key:"refreshDevices",value:(l=km(Em().mark((function e(){var t,r,n=this;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(navigator.mediaDevices){e.next=2;break}return e.abrupt("return");case 2:if(t=void 0,!fw){e.next=12;break}return e.prev=4,e.next=7,navigator.mediaDevices.getUserMedia({audio:!0});case 7:t=e.sent,e.next=12;break;case 10:e.prev=10,e.t0=e.catch(4);case 12:return e.next=14,navigator.mediaDevices.enumerateDevices();case 14:r=e.sent,t&&t.getTracks().forEach((function(e){return e.stop()})),r.forEach((function(e){var t;e.deviceId&&(null===(t=n.deviceMap[e.kind])||void 0===t||t.set(e.deviceId,e))})),this.inited||this.initListener(),this.inited=!0;case 19:case"end":return e.stop()}}),e,this,[[4,10]])}))),function(){return l.apply(this,arguments)})},{key:"initListener",value:(d=km(Em().mark((function e(){var t,r,n,i,o=this;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(void 0!==(null===(t=navigator.mediaDevices)||void 0===t?void 0:t.ondevicechange)&&"function"==typeof(null===(r=navigator.mediaDevices)||void 0===r?void 0:r.addEventListener)?navigator.mediaDevices.addEventListener("devicechange",(function(){o._handleDeviceChange(),setTimeout((function(){o._handleDeviceChange()}),300)})):this.checkDeviceChangeTimer=window.setInterval((function(){o._handleDeviceChange()}),3e3),!this.isSupportedPermissionsQuery){e.next=22;break}return e.prev=2,e.next=5,navigator.permissions.query({name:"microphone"});case 5:n=e.sent,this.isGrantedMicrophonePermission="granted"===n.state,n.addEventListener("change",(function(){o.isGrantedMicrophonePermission="granted"===n.state})),e.next=12;break;case 10:e.prev=10,e.t0=e.catch(2);case 12:return e.prev=12,e.next=15,navigator.permissions.query({name:"camera"});case 15:i=e.sent,this.isGrantedCameraPermission="granted"===i.state,i.addEventListener("change",(function(){o.isGrantedCameraPermission="granted"===i.state})),e.next=22;break;case 20:e.prev=20,e.t1=e.catch(12);case 22:case"end":return e.stop()}}),e,this,[[2,10],[12,20]])}))),function(){return d.apply(this,arguments)})},{key:"_handleDeviceChange",value:(u=km(Em().mark((function e(){var t,r,n,i,o,a,s,c=this;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(o=void 0,!fw){e.next=5;break}return e.next=4,navigator.mediaDevices.getUserMedia({audio:!0});case 4:o=e.sent;case 5:return e.next=7,navigator.mediaDevices.enumerateDevices();case 7:a=e.sent,a=Gs(a).call(a,(function(e){return!!e.deviceId})),o&&o.getTracks().forEach((function(e){return e.stop()})),s=Xk(wm(t=[]).call(t,Wk(tA(r=this.deviceMap.audioinput).call(r)),Wk(tA(n=this.deviceMap.videoinput).call(n)),Wk(tA(i=this.deviceMap.audiooutput).call(i)))),a.forEach((function(e){var t,r,n=c.deviceMap[e.kind].get(e.deviceId);c.deviceMap[e.kind].set(e.deviceId,e),n||(Jm(t=e.kind).call(t,"video")?c.emit(Kd.onVideoDeviceStateChanged,{mediaDeviceInfo:e,deviceState:"active"}):Jm(r=e.kind).call(r,"audio")&&c.emit(Kd.onAudioDeviceStateChanged,{mediaDeviceInfo:e,deviceState:"active"}))})),s.forEach((function(e){var t,r;xb(a).call(a,(function(t){return t.deviceId===e.deviceId&&t.kind===e.kind}))||(c.deviceMap[e.kind].delete(e.deviceId),Jm(t=e.kind).call(t,"video")?c.emit(Kd.onVideoDeviceStateChanged,{mediaDeviceInfo:e,deviceState:"inactive"}):Jm(r=e.kind).call(r,"audio")&&c.emit(Kd.onAudioDeviceStateChanged,{mediaDeviceInfo:e,deviceState:"inactive"}))}));case 13:case"end":return e.stop()}}),e,this)}))),function(){return u.apply(this,arguments)})},{key:"getUserMedia",value:(c=km(Em().mark((function e(t){var r;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,navigator.mediaDevices.getUserMedia(t);case 2:return r=e.sent,null!=t&&t.audio&&(this.isGrantedMicrophonePermission=!0),null!=t&&t.video&&(this.isGrantedCameraPermission=!0),this.refreshDevices(),e.abrupt("return",r);case 7:case"end":return e.stop()}}),e,this)}))),function(e){return c.apply(this,arguments)})},{key:"checkPermissionsByDevices",value:(s=km(Em().mark((function e(){var t,r;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t={audio:!1,video:!1},navigator.mediaDevices){e.next=3;break}return e.abrupt("return",t);case 3:return e.next=5,navigator.mediaDevices.enumerateDevices();case 5:return r=e.sent,t.audio=Gs(r).call(r,(function(e){return"audioinput"===e.kind&&e.label&&e.deviceId})).length>0,t.video=Gs(r).call(r,(function(e){return"videoinput"===e.kind&&e.label&&e.deviceId})).length>0,e.abrupt("return",t);case 9:case"end":return e.stop()}}),e)}))),function(){return s.apply(this,arguments)})},{key:"getPermissions",value:(a=km(Em().mark((function e(){var t,r,n,i,o,a,s,c=this,u=arguments;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=u.length>0&&void 0!==u[0]?u[0]:{},n=r.audio,i=r.video,o=r.force,n||i||(n=!0,i=!0),a={audio:!1,video:!1},o){e.next=30;break}if(!this.isSupportedPermissionsQuery){e.next=20;break}if(!n||!i){e.next=14;break}if(!this.isGrantedMicrophonePermission||!this.isGrantedCameraPermission){e.next=12;break}return a.audio=!0,a.video=!0,e.abrupt("return",a);case 12:e.next=18;break;case 14:if(!(n&&this.isGrantedMicrophonePermission||i&&this.isGrantedCameraPermission)){e.next=18;break}return a.audio=this.isGrantedMicrophonePermission,a.video=this.isGrantedCameraPermission,e.abrupt("return",a);case 18:case 26:e.next=30;break;case 20:return e.next=22,this.checkPermissionsByDevices();case 22:if(s=e.sent,!n||!i){e.next=28;break}if(!s.audio||!s.video){e.next=26;break}return e.abrupt("return",s);case 28:if(!(n&&s.audio||i&&s.video)){e.next=30;break}return e.abrupt("return",s);case 30:if(null===(t=navigator.mediaDevices)||void 0===t||!t.getUserMedia){e.next=33;break}return e.next=33,navigator.mediaDevices.getUserMedia({audio:n,video:i}).then((function(e){e&&(e.getTracks().forEach((function(e){return e.stop()})),n&&(a.audio=!0,c.isGrantedMicrophonePermission=!0),i&&(a.video=!0,c.isGrantedCameraPermission=!0))})).catch((function(){}));case 33:return e.next=35,this.refreshDevices();case 35:return e.abrupt("return",a);case 36:case"end":return e.stop()}}),e,this)}))),function(){return a.apply(this,arguments)})},{key:"enumerateDevices",value:(o=km(Em().mark((function e(){var t,r,n,i;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.getPermissions();case 2:return e.next=4,this.refreshDevices();case 4:return e.abrupt("return",Xk(wm(t=[]).call(t,Wk(tA(r=this.deviceMap.audioinput).call(r)),Wk(tA(n=this.deviceMap.videoinput).call(n)),Wk(tA(i=this.deviceMap.audiooutput).call(i)))));case 5:case"end":return e.stop()}}),e,this)}))),function(){return o.apply(this,arguments)})},{key:"enumerateAudioCaptureDevices",value:(i=km(Em().mark((function e(){var t;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.getPermissions({audio:!0});case 2:return e.next=4,this.refreshDevices();case 4:return e.abrupt("return",Xk(tA(t=this.deviceMap.audioinput).call(t)));case 5:case"end":return e.stop()}}),e,this)}))),function(){return i.apply(this,arguments)})},{key:"enumerateVideoCaptureDevices",value:(n=km(Em().mark((function e(){var t;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.getPermissions({video:!0});case 2:return e.next=4,this.refreshDevices();case 4:return e.abrupt("return",Xk(tA(t=this.deviceMap.videoinput).call(t)));case 5:case"end":return e.stop()}}),e,this)}))),function(){return n.apply(this,arguments)})},{key:"enumerateAudioPlaybackDevices",value:(r=km(Em().mark((function e(){var t;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.getPermissions({audio:!0});case 2:return e.next=4,this.refreshDevices();case 4:return e.abrupt("return",Xk(tA(t=this.deviceMap.audiooutput).call(t)));case 5:case"end":return e.stop()}}),e,this)}))),function(){return r.apply(this,arguments)})},{key:"getDeviceById",value:(t=km(Em().mark((function e(t){var r;return Em().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",xb(r).call(r,(function(e){return e.deviceId===t})));case 4:case"end":return e.stop()}}),e,this)}))),function(e){return t.apply(this,arguments)})}]),f}(OC),MU=new PU;!uw()&&(window.__rtc_dd__=MU);var LU=function(){function e(){Wd(this,e),sd(this,"_audioContextInstance",void 0)}return qd(e,[{key:"getAudioContextInstance",value:function(){if(!this._audioContextInstance){var e=window.AudioContext||window.webkitAudioContext;this._audioContextInstance=new e}return this._audioContextInstance}}]),e}(),UU=function(){function e(t){Wd(this,e),sd(this,"_ctx",void 0),sd(this,"_analyserNode",void 0),sd(this,"_audioSource",void 0);var r=VU.getAudioContextInstance();if(t instanceof MediaStreamTrack){var n=new MediaStream;n.addTrack(t),this._audioSource=r.createMediaStreamSource(n)}else this._audioSource=r.createMediaElementSource(t),this._audioSource.connect(r.destination);var i=r.createAnalyser();this._audioSource.connect(i),this._analyserNode=i,this._ctx=r}var t;return qd(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;t.forEach((function(e){return r=Math.max(r,Math.abs(e-128))}));var n=r/128*255;return n>2?n:0}},{key:"resume",value:(t=km(Em().mark((function e(){var t;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,null===(t=this._ctx)||void 0===t?void 0:t.resume();case 2:case"end":return e.stop()}}),e,this)}))),function(){return t.apply(this,arguments)})},{key:"destroy",value:function(){this._audioSource.disconnect(),this._analyserNode.disconnect()}}]),e}(),VU=new LU,FU=function(e){return e[e.CAPTURE=0]="CAPTURE",e[e.PRE_PROCESSING=1]="PRE_PROCESSING",e[e.ENCODE=2]="ENCODE",e[e.TRANSFER=3]="TRANSFER",e[e.POST_PROCESSING=4]="POST_PROCESSING",e[e.DECODE=5]="DECODE",e[e.RENDERING=6]="RENDERING",e}(FU||{}),BU=function(){function e(){Wd(this,e),sd(this,"_plugins",new yE),sd(this,"_monitor",void 0)}var t;return qd(e,[{key:"setMinotor",value:function(e){this._monitor=e}},{key:"register",value:function(e){e.monitor=this._monitor;var t=this._plugins.get(e.type)||[];if(qA(t).call(t,(function(t){return t.name===e.name}))>-1)throw new Error("Failed to register ".concat(e.name,": name is repeated."));t.push(e),this._plugins.set(e.type,t)}},{key:"getPluginsByType",value:function(e){return this._plugins.get(e)||[]}},{key:"getPluginByName",value:function(e,t){var r;return xb(r=this._plugins.get(e)||[]).call(r,(function(e){return e.name===t}))}},{key:"getPreProcessingTrack",value:(t=km(Em().mark((function e(t){var r,n,i,o,a;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:r=this._plugins.get(1)||[],n=t.getTrack(),i=QT(r),e.prev=3,i.s();case 5:if((o=i.n()).done){e.next=12;break}return a=o.value,e.next=9,a.effect(t,n);case 9:n=e.sent;case 10:e.next=5;break;case 12:e.next=17;break;case 14:e.prev=14,e.t0=e.catch(3),i.e(e.t0);case 17:return e.prev=17,i.f(),e.finish(17);case 20:return e.abrupt("return",n);case 21:case"end":return e.stop()}}),e,this,[[3,14,17,20]])}))),function(e){return t.apply(this,arguments)})},{key:"destroy",value:function(){this._plugins.forEach((function(e){e.forEach((function(e){return e.destroy()}))})),this._plugins.clear()}}]),e}(),jU=function(e){return e[e.EXTERNAL=0]="EXTERNAL",e[e.INTERNAL=1]="INTERNAL",e}(jU||{}),GU=new RC("VERTC",0),HU=new NU,zU=function(e){OI(r,e);var t=qI(r);function r(e,n){var i;return Wd(this,r),sd(ZT(i=t.call(this)),"sourceType",1),sd(ZT(i),"mediaType",void 0),sd(ZT(i),"_trackId",void 0),i._trackId=e,i.mediaType=n,i}return qd(r,[{key:"getId",value:function(){return this._trackId}}]),r}(OC),KU=function(e){OI(n,e);var t,r=qI(n);function n(e,t,i){var o;return Wd(this,n),sd(ZT(o=r.call(this,t,i)),"_mediaTrack",void 0),sd(ZT(o),"_preProcessingTrack",void 0),sd(ZT(o),"handleTrackEnded",(function(){iN.rtcError("track-ended mediaType: ".concat(o._mediaTrack.kind),-1001),o.emit("track-ended",ZT(o))})),o._mediaTrack=e,o._initListeners(),o}return qd(n,[{key:"getTrack",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"origin";return"origin"===e?this._mediaTrack:this._preProcessingTrack||this._mediaTrack}},{key:"setTrack",value:function(e,t){this._mediaTrack=e,t&&this.generatePreProcessingTrack(t)}},{key:"generatePreProcessingTrack",value:(t=km(Em().mark((function e(t){var r;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,t.getPreProcessingTrack(this);case 3:(r=e.sent)instanceof MediaStreamTrack&&(this._preProcessingTrack=r),e.next=10;break;case 7:e.prev=7,e.t0=e.catch(0),console.error(e.t0);case 10:case"end":return e.stop()}}),e,this,[[0,7]])}))),function(e){return t.apply(this,arguments)})},{key:"close",value:function(){var e,t,r;return this._mediaTrack.onended=null,this._mediaTrack.onmute=null,this._mediaTrack.onunmute=null,null===(e=this._mediaTrack)||void 0===e||e.removeEventListener("ended",this.handleTrackEnded),null===(t=this._preProcessingTrack)||void 0===t||t.stop(),null===(r=this._mediaTrack)||void 0===r?void 0:r.stop()}},{key:"_initListeners",value:function(){this._mediaTrack instanceof MediaStreamTrack&&this._mediaTrack.addEventListener("ended",this.handleTrackEnded)}}]),n}(zU),XU=function(e){OI(r,e);var t=qI(r);function r(e,n,i){var o;return Wd(this,r),sd(ZT(o=t.call(this,n,i)),"_mediaTrack",void 0),o._mediaTrack=e,o}return qd(r,[{key:"getTrack",value:function(){return this._mediaTrack}}]),r}(zU),qU=function(e){OI(n,e);var t,r=qI(n);function n(e,t){var i;return Wd(this,n),sd(ZT(i=r.call(this,e,t,"video")),"resolution",void 0),sd(ZT(i),"dummy",!1),i.resolution={width:0,height:0},i}return qd(n,[{key:"updateVideoCaptureConfig",value:(t=km(Em().mark((function e(t){var r,n;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.getTrack()){e.next=2;break}return e.abrupt("return");case 2:return GU.print("updateVideoEncoderConfig","update localVideoTrack: ",t),delete(r=ud({},t)).contentHint,fw&&(r.frameRate={ideal:30,max:30}),e.next=8,this.getTrack().applyConstraints(r);case 8:((n=this.getTrack().getSettings()).width&&n.width!==this.resolution.width||n.height&&n.height!==this.resolution.height)&&(this.resolution={width:n.width,height:n.height},this.emit("resolution-change",this.resolution));case 10:case"end":return e.stop()}}),e,this)}))),function(e){return t.apply(this,arguments)})},{key:"replaceTrack",value:function(e){this.setTrack(e)}},{key:"setContentHint",value:function(e){var t;this._mediaTrack&&"contentHint"in this._mediaTrack&&Jm(t=["text","motion","detail"]).call(t,e)&&(this._mediaTrack.contentHint=e)}}]),n}(KU),WU=function(e){OI(n,e);var t,r=qI(n);function n(e,t){var i;return Wd(this,n),sd(ZT(i=r.call(this,e,t,"audio")),"audioCaptureConfig",void 0),sd(ZT(i),"_audioLevelFetcher",void 0),sd(ZT(i),"mixedAudioTrack",void 0),sd(ZT(i),"mixType",Gd.PLAYOUT_AND_PUBLISH),i}return qd(n,[{key:"getAudioLevel",value:function(){return this._audioLevelFetcher||(this._audioLevelFetcher=new UU(this.getTrack("preprocessing"))),this._audioLevelFetcher.getAudioLevel()}},{key:"updateAudioCaptureConfig",value:(t=km(Em().mark((function e(){var t;return Em().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 GU.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}(KU),YU=function(e){OI(r,e);var t=qI(r);function r(e,n){return Wd(this,r),t.call(this,e,n,"video")}return qd(r)}(XU),QU=function(e){OI(r,e);var t=qI(r);function r(e,n){var i;return Wd(this,r),sd(ZT(i=t.call(this,e,n,"audio")),"_audioLevelFetcher",void 0),i}return qd(r,[{key:"getAudioLevel",value:function(){return this._audioLevelFetcher||(this._audioLevelFetcher=new UU(this.getTrack())),this._audioLevelFetcher.getAudioLevel()}}]),r}(XU),JU=function(e){OI(r,e);var t=qI(r);function r(){var e,n;Wd(this,r);for(var i=arguments.length,o=new Array(i),a=0;a<i;a++)o[a]=arguments[a];return sd(ZT(n=t.call.apply(t,wm(e=[this]).call(e,o))),"streamIndex",yd.STREAM_INDEX_MAIN),n}return qd(r)}(WU),ZU=function(e){OI(r,e);var t=qI(r);function r(){var e,n;Wd(this,r);for(var i=arguments.length,o=new Array(i),a=0;a<i;a++)o[a]=arguments[a];return sd(ZT(n=t.call.apply(t,wm(e=[this]).call(e,o))),"streamIndex",yd.STREAM_INDEX_MAIN),n}return qd(r)}(qU),$U=function(e){OI(r,e);var t=qI(r);function r(){var e,n;Wd(this,r);for(var i=arguments.length,o=new Array(i),a=0;a<i;a++)o[a]=arguments[a];return sd(ZT(n=t.call.apply(t,wm(e=[this]).call(e,o))),"streamIndex",yd.STREAM_INDEX_MAIN),sd(ZT(n),"sourceType",0),n}return qd(r)}(qU),eV=function(e){OI(r,e);var t=qI(r);function r(){var e,n;Wd(this,r);for(var i=arguments.length,o=new Array(i),a=0;a<i;a++)o[a]=arguments[a];return sd(ZT(n=t.call.apply(t,wm(e=[this]).call(e,o))),"streamIndex",yd.STREAM_INDEX_MAIN),sd(ZT(n),"sourceType",0),n}return qd(r)}(WU),tV=function(e){OI(r,e);var t=qI(r);function r(){var e,n;Wd(this,r);for(var i=arguments.length,o=new Array(i),a=0;a<i;a++)o[a]=arguments[a];return sd(ZT(n=t.call.apply(t,wm(e=[this]).call(e,o))),"streamIndex",yd.STREAM_INDEX_SCREEN),n}return qd(r)}(qU),rV=function(e){OI(r,e);var t=qI(r);function r(){var e,n;Wd(this,r);for(var i=arguments.length,o=new Array(i),a=0;a<i;a++)o[a]=arguments[a];return sd(ZT(n=t.call.apply(t,wm(e=[this]).call(e,o))),"streamIndex",yd.STREAM_INDEX_SCREEN),n}return qd(r)}(WU),nV=function(e){OI(r,e);var t=qI(r);function r(){var e,n;Wd(this,r);for(var i=arguments.length,o=new Array(i),a=0;a<i;a++)o[a]=arguments[a];return sd(ZT(n=t.call.apply(t,wm(e=[this]).call(e,o))),"streamIndex",yd.STREAM_INDEX_SCREEN),sd(ZT(n),"sourceType",0),n}return qd(r)}(qU),iV=function(e){OI(r,e);var t=qI(r);function r(){var e,n;Wd(this,r);for(var i=arguments.length,o=new Array(i),a=0;a<i;a++)o[a]=arguments[a];return sd(ZT(n=t.call.apply(t,wm(e=[this]).call(e,o))),"streamIndex",yd.STREAM_INDEX_SCREEN),sd(ZT(n),"sourceType",0),n}return qd(r)}(WU);function oV(e,t){return aV.apply(this,arguments)}function aV(){return(aV=km(Em().mark((function e(t,r){var n;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return(n=new ZU(t,aw())).dummy=!0,e.next=4,n.generatePreProcessingTrack(r);case 4:return e.abrupt("return",n);case 5:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function sV(e,t){return cV.apply(this,arguments)}function cV(){return(cV=km(Em().mark((function e(t,r){var n;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return(n=new tV(t,aw())).dummy=!0,e.next=4,n.generatePreProcessingTrack(r);case 4:return e.abrupt("return",n);case 5:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function uV(e,t){return dV.apply(this,arguments)}function dV(){return(dV=km(Em().mark((function e(t,r){var n,i,o,a,s,c,u;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return o=(null==t||null===(n=t.deviceId)||void 0===n?void 0:n.exact)||"default",e.prev=1,GU.print("createCameraVideoTrack","constraints:",t),iN.rtcVideoCaptureEvent({event_type:Zx.START,media_device_id:o}),a=sw(),fw&&(t.frameRate={ideal:30,max:30}),e.next=8,MU.getUserMedia({video:t});case 8:i=e.sent,iN.rtcVideoCaptureEvent({event_type:Zx.START_CAPTURE_RESULT,media_device_id:o,reason:$x.SUCCESS,elapse:sw()-a}),e.next=16;break;case 12:throw e.prev=12,e.t0=e.catch(1),iN.rtcVideoCaptureEvent({event_type:Zx.RUNNING_FAILED,media_device_id:o,error_code:e.t0.code,reason:e.t0.name+e.t0.message}),new lR(uR.GET_VIDEO_TRACK_FAILED,wm(s="throw error from getUserMedia. [".concat(e.t0.name||"unknown name","]: ")).call(s,e.t0.message||"unknown message","."),e.t0);case 16:return c=i.getVideoTracks()[0],HU.set(c,i),u=new ZU(c,aw()),e.next=21,u.generatePreProcessingTrack(r);case 21:return e.abrupt("return",u);case 22:case"end":return e.stop()}}),e,null,[[1,12]])})))).apply(this,arguments)}function lV(e,t){return hV.apply(this,arguments)}function hV(){return(hV=km(Em().mark((function e(t,r){var n,i,o,a,s,c,u,d;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return GU.print("createMicrophoneAudioTrack","constraints:",t),o=(null==t||null===(n=t.deviceId)||void 0===n?void 0:n.exact)||"default",e.prev=2,iN.rtcVideoCaptureEvent({event_type:Zx.START,media_device_id:o}),a=sw(),(s=r.getPluginByName(FU.PRE_PROCESSING,"RTCAIAnsExtension"))&&(s.isOpen()?(t.autoGainControl=!0,t.noiseSuppression=!1):t.noiseSuppression=!0),e.next=9,MU.getUserMedia({audio:t});case 9:i=e.sent,iN.rtcVideoCaptureEvent({event_type:Zx.START_CAPTURE_RESULT,media_device_id:o,reason:$x.SUCCESS,elapse:sw()-a}),e.next=17;break;case 13:throw e.prev=13,e.t0=e.catch(2),iN.rtcVideoCaptureEvent({event_type:Zx.RUNNING_FAILED,media_device_id:o,error_code:e.t0.code,reason:e.t0.name+e.t0.message}),new lR(uR.GET_AUDIO_TRACK_FAILED,wm(c="throw error from getUserMedia. [".concat(e.t0.name||"unknown name","]: ")).call(c,e.t0.message||"unknown message","."),e.t0);case 17:return u=i.getAudioTracks()[0],HU.set(u,i),d=new JU(u,aw()),e.next=22,d.generatePreProcessingTrack(r);case 22:return e.abrupt("return",d);case 23:case"end":return e.stop()}}),e,null,[[2,13]])})))).apply(this,arguments)}function fV(){return pV.apply(this,arguments)}function pV(){return pV=km(Em().mark((function e(){var t,r,n,i,o,a,s,c,u,d=arguments;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=d.length>0&&void 0!==d[0]&&d[0],r=d.length>1?d[1]:void 0,n=d.length>2?d[2]:void 0,GU.print("createScreenTracks","withAudio: %o, constraints: %o",t,n),e.prev=4,iN.rtcVideoCaptureEvent({event_type:Zx.START,media_device_id:"screen"}),o=sw(),e.next=9,navigator.mediaDevices.getDisplayMedia({video:!(n&&(!pw||16!==gw))||n,audio:!!t&&{channelCount:2,noiseSuppression:!1,echoCancellation:!1,autoGainControl:!1}});case 9:i=e.sent,iN.rtcVideoCaptureEvent({event_type:Zx.START_CAPTURE_RESULT,media_device_id:"screen",reason:$x.SUCCESS,elapse:sw()-o}),e.next=17;break;case 13:throw e.prev=13,e.t0=e.catch(4),iN.rtcVideoCaptureEvent({event_type:Zx.RUNNING_FAILED,media_device_id:"screen",error_code:e.t0.code,reason:e.t0.name+e.t0.message}),new lR(uR.GET_SCREEN_TRACK_FAILED,"throw error from getDisplayMedia",e.t0);case 17:return a=i.getVideoTracks()[0],s=new tV(a,aw()),e.next=21,s.generatePreProcessingTrack(r);case 21:if(!(c=i.getAudioTracks()[0])){e.next=27;break}return u=new rV(c,aw()),e.next=26,u.generatePreProcessingTrack(r);case 26:return e.abrupt("return",[s,u]);case 27:return e.abrupt("return",[s,void 0]);case 28:case"end":return e.stop()}}),e,null,[[4,13]])}))),pV.apply(this,arguments)}function vV(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:aw();return new QU(e,t)}function _V(e,t){return mV.apply(this,arguments)}function mV(){return(mV=km(Em().mark((function e(t,r){var n;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=new $U(t,aw()),e.next=3,n.generatePreProcessingTrack(r);case 3:return e.abrupt("return",n);case 4:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function gV(e,t){return yV.apply(this,arguments)}function yV(){return(yV=km(Em().mark((function e(t,r){var n;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=new eV(t,aw()),e.next=3,n.generatePreProcessingTrack(r);case 3:return e.abrupt("return",n);case 4:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function SV(e,t){return EV.apply(this,arguments)}function EV(){return(EV=km(Em().mark((function e(t,r){var n;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=new nV(t,aw()),e.next=3,n.generatePreProcessingTrack(r);case 3:return e.abrupt("return",n);case 4:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function bV(e,t){return kV.apply(this,arguments)}function kV(){return(kV=km(Em().mark((function e(t,r){var n;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=new iV(t,aw()),e.next=3,n.generatePreProcessingTrack(r);case 3:return e.abrupt("return",n);case 4:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var TV=WU,IV=function(e){return e[e.NONE=0]="NONE",e}(IV||{}),AV=function(){function e(){Wd(this,e)}return qd(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,s,c=new Uint8Array(Sm(a=t.buffer).call(a,i,i+n.headerLength));n.pos===t.position&&t.skip(n.headerLength),o=(n=e.getHeaderPositionAnnexB(t)).pos;var u={header:c,body:new Uint8Array(Sm(s=t.buffer).call(s,i+c.byteLength,o)),type:-1};e.analyseNal(u),u.type<=9&&0!==u.type&&r.push(u),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,o,a=new Uint8Array(Sm(i=t.buffer).call(i,t.position,t.position+4));t.skip(4);var s=new Uint8Array(Sm(o=t.buffer).call(o,t.position,t.position+n));t.skip(n);var c={header:a,body:s,type:-1};e.analyseNal(c),c.type<=9&&0!==c.type&&r.push(c)}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}}}]),e}(),RV=function(){function e(t){Wd(this,e),sd(this,"_position",0),sd(this,"_dataview",void 0),this._dataview=new DataView(t)}return qd(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}(),wV=function(e){return e[e.internal=0]="internal",e[e.external=1]="external",e[e.bypass=2]="bypass",e}(wV||{}),CV=new Uint8Array([109,167,53,190,103,90,72,1,170,89,63,164,194,199,19,85]),OV=new Uint8Array([109,167,53,190,103,90,72,1,170,89,63,164,194,199,19,84]),DV=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 xV(e){for(var t=[];e>=255;)e-=255,t.push(255);return t.push(e),new Uint8Array(t)}function NV(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 PV=function(){function e(){Wd(this,e)}return qd(e,null,[{key:"generateSEI",value:function(e){var t,r=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=new Uint8Array([0,0,0,1]),i=new Uint8Array([6]),o=new Uint8Array([5]),a=r?CV:OV,s=xV(e.byteLength+a.byteLength),c=DV(e);return new Uint8Array(wm(t=[]).call(t,Wk(n),Wk(i),Wk(o),Wk(s),Wk(a),Wk(c),[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=Sm(e).call(e,0,e.length-1));if(!(t.byteLength<2)){var r=0;if(5===t[1]||100===t[1]){var n=JT(NV(t,r+=2),2),i=n[0],o=2,a=(r=n[1])+i;return t.byteLength>=OV.byteLength&&i>=OV.byteLength&&Sm(t).call(t,r,r+OV.byteLength).toString()===OV.toString()?(r+=OV.byteLength,o=1):t.byteLength>=OV.byteLength&&i>=OV.byteLength&&Sm(t).call(t,r,r+CV.byteLength).toString()===CV.toString()&&(r+=CV.byteLength,o=0),{type:o,payload:Sm(t).call(t,r,a)}}}}},{key:"parseInternalSEI",value:function(e){var t=new yE,r=0;if(0===e.type){for(;e.payload.byteLength-r>=2;){var n=JT(NV(e.payload,r),2),i=n[0];r=n[1];var o,a=JT(NV(e.payload,r),2),s=a[0];if(r=a[1],t.get(i)||!(s<=e.payload.byteLength-r))break;t.set(i,Sm(o=e.payload).call(o,r,r+s)),r+=s}return t}}},{key:"makeInternalSei",value:function(e){var t,r=[],n=QT(e);try{for(n.s();!(t=n.n()).done;){var i=JT(t.value,2),o=i[0],a=i[1],s=xV(o),c=xV(a.byteLength);r.push(s,c,a)}}catch(l){n.e(l)}finally{n.f()}var u=PE(r).call(r,(function(e,t){return e+t.byteLength}),0),d=new Uint8Array(u);return PE(r).call(r,(function(e,t){return d.set(t,e),e+t.byteLength}),0),d}}]),e}(),MV=function(){function e(t){Wd(this,e),sd(this,"player",void 0),sd(this,"_stream",void 0),sd(this,"_timer",void 0),sd(this,"client",void 0),sd(this,"handler",void 0),sd(this,"monitor",void 0),this._stream=t}return qd(e,[{key:"setVar",value:function(e,t,r){this.client=e,this.handler=t,this.monitor=r}},{key:"delStatsEvtInterval",value:function(){var e;clearTimeout(this._timer),this._timer=void 0,null===(e=this.monitor)||void 0===e||e.rtcInvokeStatus("".concat((new Error).stack),0,"del_media_statistics_timer",this._stream.streamId||"",0)}},{key:"filterIllegal",value:function(e){var t={};return an(e).forEach((function(r){null===e[r]||void 0===e[r]||Number.isNaN(e[r])||(t[r]=e[r])})),t}},{key:"destroy",value:function(){var e;null===(e=this.monitor)||void 0===e||e.rtcInvokeStatus("".concat((new Error).stack),0,"media_statistics_destroy","".concat(this._stream.streamId),0),this.delStatsEvtInterval()}}]),e}(),LV=function(e){OI(i,e);var t,r,n=qI(i);function i(e){var t;return Wd(this,i),sd(ZT(t=n.call(this,e)),"_context",void 0),t._stream=e,t}return qd(i,[{key:"setLocalStreamStatsEvtInterval",value:function(e,t,r,n){var i,o,a,s=this;if(!this._timer){this.setVar(e,t,r),this._context=n,e.once(jN.ABNORMAL_DISCONNECTION,(function(){s.destroy()}));var c={audio:{},video:{}},u=this._stream,d=null===(i=u.audioTrack)||void 0===i?void 0:i.getTrack("preprocessing"),l=null===(o=u.videoTrack)||void 0===o?void 0:o.getTrack("preprocessing");this.getAudioStats(d,c,null===(a=u.audioTrack)||void 0===a?void 0:a.getAudioLevel()),this.getVideoStats(l,c),this.delStatsEvtInterval();var h=function(){var e=km(Em().mark((function e(){var t,r,n,i,o,a,d;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=null===(t=u.audioTrack)||void 0===t?void 0:t.getTrack("preprocessing"),o=null===(r=u.videoTrack)||void 0===r?void 0:r.getTrack("preprocessing"),e.next=4,s.getAudioStats(i,c,null===(n=u.audioTrack)||void 0===n?void 0:n.getAudioLevel());case 4:return a=e.sent,e.next=7,s.getVideoStats(o,c);case 7:return d=e.sent,e.abrupt("return",{audioStats:a,videoStats:d,isScreen:u.isScreen});case 9:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),f=function(){var e=km(Em().mark((function e(){var t,r;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,h();case 2:r=e.sent,null===(t=s.client)||void 0===t||t.emit("onLocalStreamStats",r),s._timer&&clearTimeout(s._timer),s._timer=setTimeout(f,2e3);case 6:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}();this._timer&&clearTimeout(this._timer),this._timer=setTimeout(f,2e3)}}},{key:"unpublish",value:function(){this.delStatsEvtInterval()}},{key:"getAudioStats",value:(r=km(Em().mark((function e(t,r,n){var i,o,a,s,c,u,d,l,h,f,p;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(i={},o={timestamp:Date.now()},a=this._stream,s=a.streamId,c=a.audioMid,u=a.isScreen,d=a.pubAttributes,l=a.pubAudio,h={media_type:"audio",is_screen:!!u,direction:"up",stream_id:s,vid:c,connection_status:navigator.onLine,track_enabled:null==t?void 0:t.enabled,capture_state:d.localaudio?"capture_state_on":"capture_state_off",mute_state:l?"mute_state_off":"mute_state_on"},t&&this.handler){e.next=6;break}return e.abrupt("return",i);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",i);case 11:if(f.forEach((function(e){var t=e.type,r=e.packetsSent,n=e.packetsLost,a=e.bytesSent,s=e.clockRate,c=e.roundTripTime,u=e.channels,d=e.audioLevel;e.googRtt;var l=e.mimeType,f=e.availableIncomingBitrate,p=e.availableOutgoingBitrate,v=e.bytesReceived,_=e.nominated,m=e.id,g=e.currentRoundTripTime,y=e.state,S=e.writable,E=e.requestsReceived,b=e.responsesReceived,k=e.requestsSent,T=e.consentRequestsSent,I=e.responsesSent,A=e.jitter,R=e.candidateType,w=e.ip,C=e.address,O=e.networkType,D=e.port,x=e.protocol,N=e.nackCount,P=e.retransmittedBytesSent,M=e.retransmittedPacketsSent,L=e.audioInputLevel,U=e.ssrc,V=e.totalAudioEnergy,F=e.totalSamplesDuration,B=e.mediaType,j=e.fractionLost;"outbound-rtp"===t?(o.packetsSent=r,o.bytesSent=a,h.bytes=a,h.packetsSent=r,h.nackCount=N,h.ssrc=U,h.retransmitted_bytes_sent=P,h.retransmitted_packets_sent=M,o.retransmittedBytesSent=P,o.retransmittedPacketsSent=M):"remote-inbound-rtp"===t?(o.packetsLost=n,h.packetsLost=n,h.net_jitter=1e3*A,i.rtt=1e3*c,h.rtt=i.rtt,i._fractionLost=j||0):"codec"===t?(i.recordSampleRate=s,i.numChannels=u,h.codecName=l):"media-source"===t&&void 0!==d?(h.audio_level=d?-10*qR(Math.pow(d,2)):d,h.volume=255*d,h.total_audio_energy=V,h.totalInputDuration=F):"ssrc"===t&&"audio"===B?h.send_level=L:"candidate-pair"===t?(h.ice_available_incoming_bitrate=f,h.ice_available_outgoing_bitrate=p,h.ice_bytes_received=v,h.ice_bytes_sent=a,h.ice_nominated=+_,h.ice_pair_id=m,h.ice_pair_rtt=g,h.ice_pair_state=y,h.ice_pair_writable=S,h.recv_ping_requests=E,h.recv_ping_responses=b,h.sent_ping_requests_before_first_response=k,h.sent_ping_requests_total=k+(T||0),h.sent_ping_responses=I):"local-candidate"===t?(h.local_candidate_type=R,h.local_ip=w||C,h.local_network_type=O,h.local_port=D,h.protocol=x):"remote-candidate"===t&&(h.remote_candidate_type=R,h.remote_ip=w||C,h.remote_port=D);var G=DN("STATS_SCALLBACK_SUPPORT");hw&&G||"media-source"===t&&(h.send_level=d)})),void 0===h.volume&&void 0!==n&&(h.volume=n,h.audio_level=n?-10*qR(Math.pow(n/255,2)):n),(p=r.audio).timestamp){e.next=17;break}return r.audio=o,e.abrupt("return",this.filterIllegal(i));case 17:return void 0!==o.packetsLost&&(i.audioLossRate=(o.packetsLost-p.packetsLost)/(o.packetsSent-p.packetsSent),i.audioLossRate=Number.isNaN(i.audioLossRate)?0:i.audioLossRate,h.fraction_lost=i.audioLossRate),i.statsInterval=o.timestamp-p.timestamp,h.stats_interval=i.statsInterval,i.sendKBitrate=(o.bytesSent-p.bytesSent||0)/i.statsInterval*8,h.mediaBitratebps=Math.round(1e3*i.sendKBitrate),h.bandwidth=Math.round(h.mediaBitratebps/1024),void 0!==o.retransmittedBytesSent&&(h.retransmitBitratebps=(o.retransmittedBytesSent-p.retransmittedBytesSent||0)/i.statsInterval),r.audio=o,this.monitor.rtcMediaStatistics(h,{}),i._retransmittedRate=(o.retransmittedPacketsSent-p.retransmittedPacketsSent)/(o.packetsSent-p.packetsSent),void 0===i.audioLossRate&&(i.audioLossRate=i._retransmittedRate,h.fraction_lost=i.audioLossRate),i._fractionLost=Math.max(i._fractionLost,i.audioLossRate),e.abrupt("return",this.filterIllegal(i));case 30:case"end":return e.stop()}}),e,this)}))),function(e,t,n){return r.apply(this,arguments)})},{key:"getVideoStats",value:(t=km(Em().mark((function e(t,r){var n,i,o,a,s,c,u,d,l,h,f,p,v,_,m,g,y,S;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(o={},a={timestamp:Date.now(),simulcast:{}},s=this._stream,c=s.streamId,u=s.videoMid,d=s.isScreen,l=s.pubAttributes,h=s.enableSimulcast,f=s.pubVideo,p={media_type:"video",is_screen:!!d,direction:"up",stream_id:c,vid:u,connection_status:navigator.onLine,track_enabled:null==t?void 0:t.enabled,capture_state:l.localvideo?"capture_state_on":"capture_state_off",mute_state:f?"mute_state_off":"mute_state_on"},t&&this.handler){e.next=6;break}return e.abrupt("return",o);case 6:return p.cap_frame_width=t.getSettings().width,p.cap_frame_height=t.getSettings().height,o.isScreen=d,e.next=11,this.handler.getStats(t);case 11:if((v=e.sent).length){e.next=14;break}return e.abrupt("return",o);case 14:if(null===(n=this.monitor)||void 0===n||n.rtcInvokeStatus(wm(i="reports.length: ".concat(v.length,"; videoTrack: ")).call(i,t.id),0,"get_video_stats",c||"",0),_=0,v.forEach((function(e){var n=e.type,i=e.framesEncoded,s=e.packetsLost,c=e.bytesSent,u=e.framesSent,d=e.retransmittedBytesSent,l=e.totalPacketSendDelay,f=e.totalEncodeTime,v=e.firCount,m=e.targetBitrate,g=e.roundTripTime,y=e.mimeType,S=e.frameWidth,E=e.frameHeight,b=e.packetsSent,k=e.googActualEncBitrate,T=e.googAvailableReceiveBandwidth,I=e.googAvailableSendBandwidth,A=e.googAvgEncodeMs,R=e.googBucketDelay,w=e.googEncodeUsagePercent,C=e.googFrameRateInput,O=e.availableIncomingBitrate,D=e.availableOutgoingBitrate,x=e.bytesReceived,N=e.nominated,P=e.id,M=e.currentRoundTripTime,L=e.state,U=e.writable,V=e.candidateType,F=e.ip,B=e.address,j=e.networkType,G=e.port,H=e.nackCount,z=e.pliCount,K=e.protocol,X=e.qpSum,q=e.requestsReceived,W=e.responsesReceived,Y=e.googRetransmitBitrate,Q=e.requestsSent,J=e.consentRequestsSent,Z=e.responsesSent,$=e.ssrc,ee=e.googTargetEncBitrate,te=e.googTransmitBitrate,re=e.retransmittedPacketsSent,ne=e.encoderImplementation,ie=e.jitter,oe=e.rid,ae=e.fractionLost,se=e.googAdaptationChanges,ce=e.qualityLimitationReason,ue=e.qualityLimitationDurations,de=e.googFirsReceived,le=e.googFrameRateSent,he=e.keyFramesEncoded;"outbound-rtp"===n?(h&&(oe?a.simulcast[oe]=e:a.simulcast[_]=e,_++),a.framesEncoded=i||a.framesEncoded||0,p.key_frames_encoded=he||0,a.bytesSent=c||a.bytesSent||0,a.framesSent=u||a.framesSent||0,p.bytes=c||p.bytes||0,a.packetsSent=b||a.packetsSent||0,p.packetsSent=b||p.packetsSent||0,p.nackCount=H||p.nackCount||0,p.pli_count=z||p.pli_count||0,p.qp_sum=X||p.qp_sum||0,p.ssrc=$||p.ssrc||0,p.retransmitted_packets_sent=re,a.retransmittedPacketsSent=re,a.retransmittedBytesSent=d,p.encoder_implementation=ne,p.qualityLimitationReason=ce,p.qualityLimitationDurations=ue,void 0!==S&&((!o.encodedFrameWidth||S>o.encodedFrameWidth)&&(o.encodedFrameWidth=S),(!o.encodedFrameHeight||E>o.encodedFrameHeight)&&(o.encodedFrameHeight=E),p.frame_size_height=E,p.frame_size_width=S)):"track"===n?(o.encodedFrameWidth=S,o.encodedFrameHeight=E,p.frame_size_height=E,p.frame_size_width=S):"remote-inbound-rtp"===n?(a.packetsLost=s,o.rtt=1e3*g,p.rtt=o.rtt,p.jitter=ie,p.packetsLost=s,o._fractionLost=ae||0):"codec"===n?(o.codecType=y,p.codecName=y):"candidate-pair"===n?(p.ice_available_incoming_bitrate=O,p.ice_available_outgoing_bitrate=D,p.ice_bytes_received=x,p.ice_bytes_sent=c,p.ice_nominated=+N,p.ice_pair_id=P,p.ice_pair_rtt=M,p.ice_pair_state=L,p.ice_pair_writable=U,p.recv_ping_requests=q,p.recv_ping_responses=W,p.sent_ping_requests_before_first_response=Q,p.sent_ping_requests_total=Q+J,p.sent_ping_responses=Z):"local-candidate"===n?(p.local_candidate_type=V,p.local_ip=F||B,p.local_network_type=j,p.local_port=G,p.protocol=K):"remote-candidate"===n?(p.remote_candidate_type=V,p.remote_ip=F||B,p.remote_port=G):"VideoBwe"===n?(p.encBitratebps=k,p.available_receive_bandwidth=T,p.available_send_bandwidth=I,p.bucket_delay=R,p.retransmitBitratebps=Y,p.targetEncBitratebps=ee,p.transmit_bitrate=te,o._sendBandWidth=+I):"ssrc"===n&&(p.avg_encode_ms=A,p.encodeUsage=w,p.frame_rate_input=C,p.orignal_input_Framerate=+C,p.ddaptationChanges=se,p.firsReceived=de,p.frameRateSent=le);var fe=DN("STATS_SCALLBACK_SUPPORT");if(!hw||!fe){var pe=r.video,ve=a.timestamp-pe.timestamp;if("outbound-rtp"===n){var _e=c-pe.bytesSent,me=d-pe.retransmittedBytesSent;p.encBitratebps=Math.round(8e3*(_e-me)/ve),p.bucket_delay=l/b,p.retransmitBitratebps=Math.round(8e3*me/ve),p.targetEncBitratebps=m,p.transmit_bitrate=Math.round(1e3*(c-pe.bytesSent)*8/ve),p.avg_encode_ms=1e3*f/i,p.firsReceived=v+z}else"candidate-pair"===n&&(p.available_send_bandwidth=D,o._sendBandWidth=D);if(t){var ge=null==t?void 0:t.getSettings().frameRate;p.orignal_input_Framerate=ge,p.frameRateSent=t.getSettings().frameRate}}})),(m=r.video).timestamp){e.next=21;break}return r.video=a,e.abrupt("return",this.filterIllegal(o));case 21:return o.statsInterval=a.timestamp-m.timestamp,p.stats_interval=o.statsInterval,g=an(a.simulcast),h?(p.sim_enc_width=[],p.sim_enc_height=[],p.sim_enc_bps=[],p.sim_enc_framerate=[],p.sim_enc_key_frames=[],p.sim_rids=[],p.sim_enc_bandwidth=[],p.sim_sent_framerate=[],p.sim_fraction_lost=[],p.sim_keyencoded=[],p.active_sim_streams=(null===(y=this._context)||void 0===y?void 0:y.activeSimStreams)||[],p.sim_retransmittedRate=[],S=!1,VA(g).call(g,(function(e,t){return+e-+t})).forEach((function(e){var t=a.simulcast[e],r=t.frameWidth,n=t.frameHeight,i=t.bytesSent,s=t.framesEncoded,c=t.framesSent,u=t.packetsLost,d=t.packetsSent,l=t.qualityLimitationReason,h=t.qualityLimitationDurations,f=t.qualityLimitationResolutionChanges,v=t.retransmittedPacketsSent,_=t.pliCount,g=t.keyFramesEncoded;void 0!==l&&(p.sim_qualityLimitationReason||(p.sim_qualityLimitationReason=[],p.sim_qualityLimitationDurations=[],p.sim_qualityLimitationResolutionChanges=[]),p.sim_qualityLimitationReason.push(l),p.sim_qualityLimitationDurations.push(h),p.sim_qualityLimitationResolutionChanges.push(f));var y=m.simulcast[e];if(p.sim_enc_width.push(r||0),p.sim_enc_height.push(n||0),p.sim_enc_key_frames.push(g||0),y){var E=(i-y.bytesSent||0)/o.statsInterval;p.sim_enc_bps.push(Math.round(8e3*E)),p.sim_enc_bandwidth.push(Math.round(8e3*E/1024));var b=1e3*(s-y.framesEncoded)/o.statsInterval;p.sim_enc_framerate.push(Math.round(b)),p.sim_rids.push(e);var k=void 0!==c?c-y.framesSent:s-y.framesEncoded,T=1e3*k/o.statsInterval;p.sim_sent_framerate.push(Math.round(T));var I=(u-y.packetsLost)/(d-y.packetsSent);o._retransmittedRate=(v-y.retransmittedPacketsSent)/(d-y.packetsSent),I=Number.isNaN(I)?0:I,p.sim_fraction_lost.push(I),p.sim_keyencoded.push(_-y.pliCount>0),p.sim_retransmittedRate.push(o._retransmittedRate),r>0&&!S&&(o.sentKBitrate=8*E,o.encoderOutputFrameRate=b,o.encodedFrameCount=k,o.sentFrameRate=T,o.videoLossRate=I,S=!0)}})),this.monitor.rtcMediaStatistics(p,{})):(o.encodedFrameCount=void 0!==a.framesSent?a.framesSent-m.framesSent:a.framesEncoded-m.framesEncoded,o.sentKBitrate=(a.bytesSent-m.bytesSent||0)/o.statsInterval*8,p.bitrate=Math.round(1e3*o.sentKBitrate),p.bandwidth=Math.round(p.bitrate/1024),o.encoderOutputFrameRate=1e3*(a.framesEncoded-m.framesEncoded)/o.statsInterval,p.frame_rate_encoded=Math.round(o.encoderOutputFrameRate),o.sentFrameRate=1e3*o.encodedFrameCount/o.statsInterval,p.frame_rate_sent=Math.round(o.sentFrameRate),o.videoLossRate=(a.packetsLost-m.packetsLost)/(a.packetsSent-m.packetsSent),o.videoLossRate=Number.isNaN(o.videoLossRate)?0:o.videoLossRate,p.fraction_lost=o.videoLossRate,o._retransmittedRate=(a.retransmittedPacketsSent-m.retransmittedPacketsSent)/(a.packetsSent-m.packetsSent),this.monitor.rtcMediaStatistics(p,{})),r.video=a,o._fractionLost=Math.max(o._fractionLost,o.videoLossRate),e.abrupt("return",this.filterIllegal(o));case 28:case"end":return e.stop()}}),e,this)}))),function(e,r){return t.apply(this,arguments)})}]),i}(MV),UV=function(e){OI(o,e);var t,r,n,i=qI(o);function o(e){var t;return Wd(this,o),sd(ZT(t=i.call(this,e)),"isPaused",void 0),sd(ZT(t),"pauseStart",void 0),sd(ZT(t),"pauseDuration",void 0),sd(ZT(t),"_audioStallCount",void 0),sd(ZT(t),"_setAudioStallCount",void 0),sd(ZT(t),"_audioStallTimer",void 0),sd(ZT(t),"_audioStallInterval",void 0),sd(ZT(t),"_audioStallRatio",void 0),sd(ZT(t),"_videoInWaiting",void 0),sd(ZT(t),"_context",void 0),t._videoInWaiting=!1,t.pauseDuration=0,t}return qd(o,[{key:"setRemoteStreamStatsEvtInterval",value:(n=km(Em().mark((function e(t,r,n,i){var a,s,c,u,d,l,h,f,p,v,_,m,g,y,S=this;return Em().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),this._context=i,t.once(jN.ABNORMAL_DISCONNECTION,(function(){S.destroy()})),this._audioStallInterval=o.audioStallInterval||100,this._audioStallRatio=o.audioStallRatio||.6,c={audio:{},video:{}},u=this._stream,d=null===(a=u.audioTrack)||void 0===a?void 0:a.getTrack(),l=null===(s=u.videoTrack)||void 0===s?void 0:s.getTrack(),this.getRemoteVideoStats(l,c),e.next=14,this.getRemoteAudioStats(d,c);case 14:this.delStatsEvtInterval(),h=0,f=0,v=[],_=0,m=sw(),this._setAudioStallCount=function(){if(CN.AUDIO_STALL&&S._audioStallInterval>0&&void 0!==c.audio.concealedSamples){var e=c.audio.concealedSamples,t=c.audio.totalSamplesReceived;m=sw();var r={isStall:!1,counted:!1,diff:0},n=.5*S._audioStallInterval;S._audioStallCount=km(Em().mark((function i(){var o,a,s,c,d,l,p,g,y,E,b,k,T,I,A,R,w;return Em().wrap((function(i){for(;;)switch(i.prev=i.next){case 0:if(a=u.hasAudio,s=u.subAudio,a&&s){i.next=7;break}return r.isStall=!1,r.counted=!1,v.push({reason:wm(c="hasAudio: ".concat(a,", subAudio: ")).call(c,s)}),m=sw(),i.abrupt("return",{stall_count:h,stall_duration:f,stall_list:v,stats_count:_});case 7:return d=null===(o=u.audioTrack)||void 0===o?void 0:o.getTrack(),l=Date.now(),i.next=11,S.handler.getStats(d,!0);case 11:if(p=i.sent,g=Date.now(),y=sw(),!((E=y-m)<n)){i.next=18;break}return v.push({diff:E,start:m,end:y,get_stats_cost:g-l,get_stats_start:l,get_stats_end:g,reason:wm(b="diff(".concat(E,") < minInterval(")).call(b,n,")")}),i.abrupt("return",{stall_count:h,stall_duration:f,stall_list:v,stats_count:_});case 18:if(k=p.length,T=xb(p).call(p,(function(e){return"inbound-rtp"===e.type}))){i.next=23;break}return v.push({diff:E,start:m,end:y,get_stats_cost:g-l,get_stats_start:l,get_stats_end:g,reason:k?"no inbound-rtp":"no report"}),i.abrupt("return",{stall_count:h,stall_duration:f,stall_list:v,stats_count:_});case 23:return I=T.concealedSamples,A=T.totalSamplesReceived,w=A-t,(R=I-e)>=0&&w>=0&&R>=S._audioStallRatio*w?(v.push({concealed:R,received:w,diff:E,start:m,end:y,get_stats_cost:g-l,get_stats_start:l,get_stats_end:g,is_stall:!0}),r.isStall?(r.counted?f+=E:(f=f+r.diff+E,h++),r.counted=!0):E>=200?(f+=E,h++,r.counted=!0):(r.counted=!1,r.diff=E),r.isStall=!0):(v.push({concealed:R,received:w,diff:E,start:m,end:y,get_stats_cost:g-l,get_stats_start:l,get_stats_end:g}),r.isStall=!1,r.counted=!1),e=I,t=A,m=y,_++,i.abrupt("return",{stall_count:h,stall_duration:f,stall_list:v,stats_count:_});case 32:case"end":return i.stop()}}),i)}))),p=function(){var e=km(Em().mark((function e(){return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!S._audioStallCount&&S._setAudioStallCount&&S._setAudioStallCount(),!S._audioStallCount){e.next=6;break}return e.next=4,S._audioStallCount();case 4:S._audioStallTimer&&clearTimeout(S._audioStallTimer),S._audioStallTimer=setTimeout(p,S._audioStallInterval);case 6:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),S._audioStallTimer&&clearTimeout(S._audioStallTimer),S._audioStallTimer=setTimeout(p,S._audioStallInterval)}},this._setAudioStallCount(),g=function(){var e=km(Em().mark((function e(){var t,r,n,i,o,a;return Em().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,S.getRemoteAudioStats(n,c);case 4:return o=e.sent,h=0,f=0,v=[],_=0,e.next=11,S.getRemoteVideoStats(i,c);case 11:return a=e.sent,e.abrupt("return",{audioStats:o,videoStats:a,isScreen:u.isScreen,userId:u.userId});case 13:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),y=function(){var e=km(Em().mark((function e(){var t,r;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,g();case 2:r=e.sent,null===(t=S.client)||void 0===t||t.emit("onRemoteStreamStats",r),p&&(m=sw(),S._audioStallTimer&&clearTimeout(S._audioStallTimer),S._audioStallTimer=setTimeout(p,S._audioStallInterval)),S._timer&&clearTimeout(S._timer),S._timer=setTimeout(y,2e3);case 7:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),this._timer&&clearTimeout(this._timer),this._timer=setTimeout(y,2e3);case 26:case"end":return e.stop()}}),e,this)}))),function(e,t,r,i){return n.apply(this,arguments)})},{key:"delStatsEvtInterval",value:function(){wI(AI(o.prototype),"delStatsEvtInterval",this).call(this),clearTimeout(this._audioStallTimer),this._audioStallCount=void 0,this._setAudioStallCount=void 0,this.pauseDuration=0}},{key:"unsubscribe",value:function(){this.delStatsEvtInterval(),this._videoInWaiting=!1}},{key:"getRemoteAudioStats",value:(r=km(Em().mark((function e(t,r){var n,i,o,a,s,c,u,d,l,h,f,p,v,_,m,g,y,S,E,b=this;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n={},i={},o=this._stream,a=o.streamId,s=o.userId,c=o.isScreen,u=o.audioMid,d=o.subMediaType,l=o._attributes,h=o.virtual,f={media_type:"audio",is_screen:!!c,direction:"down",stream_id:a,stream_user_id:s,vid:u,audio_mux:h,connection_status:navigator.onLine,track_enabled:null==t?void 0:t.enabled,mute_state:xw(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((p=e.sent).length){e.next=11;break}return e.abrupt("return",n);case 11:if(p.forEach((function(e){var t=e.type,r=e.packetsLost,o=e.packetsReceived,s=e.bytesReceived,c=e.jitterBufferDelay,u=e.jitterBufferEmittedCount,d=e.clockRate,l=e.channels,h=e.totalSamplesReceived,p=e.concealedSamples,v=e.silentConcealedSamples,_=e.concealmentEvents,m=e.totalRoundTripTime,g=e.packetsDiscarded,y=e.state,S=e.currentRoundTripTime,E=e.audioLevel,k=e.totalAudioEnergy,T=e.totalSamplesDuration,I=e.mimeType,A=e.googDecodingNormal,R=e.googDecodingMuted,w=e.availableIncomingBitrate,C=e.availableOutgoingBitrate,O=e.bytesSent,D=e.nominated,x=e.id,N=e.writable,P=e.jitter,M=e.candidateType,L=e.ip,U=e.address,V=e.networkType,F=e.port,B=e.protocol,j=e.audioOutputLevel,G=e.requestsReceived,H=e.responsesReceived,z=e.requestsSent,K=e.consentRequestsSent,X=e.responsesSent,q=e.ssrc;e.kind;var W=e.nackCount,Y=e.lastPacketReceivedTimestamp,Q=e.concealmentevents,J=e.fecPacketsReceived;if("inbound-rtp"===t)i.packetsLost=r,i.packetsReceived=o,f.packetsReceived=o,f.packetsDiscarded=g,f.nackCount=W,f.lastPacketReceivedTimestamp=Y,f.concealmentevents=Q,i.bytesReceived=s,void 0!==c&&(n.jitterBufferDelay=c/u*1e3,f.average_jitter_buffer_delay_ms=n.jitterBufferDelay),void 0!==h&&(i.totalSamplesReceived=h,n.concealedSamples=p,i.concealedSamples=p,i.silentConcealedSamples=v,f.concealedSamples=p,n.concealmentEvents=_,f.totalSamplesReceived=h),void 0!==J&&(f.fec_packets_received=J,i.fecPacketsReceived=J),f.jitter=1e3*P,f.ssrc=q,void 0!==E&&(f.audio_level=E?-10*qR(Math.pow(E,2)):E),void 0!==E&&(f.volume=255*E),void 0!==k&&(f.total_audio_energy=k),void 0!==T&&(f.totalAudioDuration=T);else if("codec"===t)n.recordSampleRate=d,l&&(n.numChannels=l),f.codecName=I;else if("candidate-pair"===t){var Z,$,ee;f.ice_available_incoming_bitrate=w,f.ice_available_outgoing_bitrate=C,f.ice_bytes_received=s,f.ice_bytes_sent=O,f.ice_nominated=+D,f.ice_pair_id=x,f.ice_pair_rtt=S,f.rtt=1e3*S,f.rtt&&null!==(Z=b._context)&&void 0!==Z&&null!==($=Z.streamRTT)&&void 0!==$&&null!==(ee=$[a])&&void 0!==ee&&ee.audio&&(f.total_rtt_ms=f.rtt+b._context.streamRTT[a].audio),f.ice_pair_state=y,f.ice_pair_writable=N,f.recv_ping_requests=G,f.recv_ping_responses=H,f.sent_ping_requests_before_first_response=z,f.sent_ping_requests_total=z+(K||0),f.sent_ping_responses=X,"succeeded"===y&&(n.rtt=1e3*S,n.total_rtt=1e3*m)}else"track"===t&&void 0!==E?(f.audio_level=E?-10*qR(Math.pow(E,2)):E,f.volume=255*E,f.total_audio_energy=k,f.totalAudioDuration=T):"ssrc"===t?(f.decodingNormal=A,f.recvAudioLevel=j,f.decodingMuted=R):"local-candidate"===t?(f.local_candidate_type=M,f.local_ip=L||U,f.local_network_type=V,f.local_port=F,f.protocol=B):"remote-candidate"===t&&(f.remote_candidate_type=M,f.remote_ip=L||U,f.remote_port=F)})),(v=r.audio).timestamp){e.next=17;break}return i.timestamp=Date.now(),r.audio=i,e.abrupt("return",this.filterIllegal(n));case 17:if(_={},void 0!==i.concealedSamples&&(f.interval_concealed_samples=i.concealedSamples-v.concealedSamples,f.interval_samples_received=i.totalSamplesReceived-v.totalSamplesReceived,f.interval_silent_concealed_samples=i.silentConcealedSamples-v.silentConcealedSamples),!(this._audioStallInterval>0&&void 0!==v.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:m=e.sent,g=m.stall_count,y=m.stall_duration,S=m.stall_list,E=m.stats_count,_.stall_list=S,_.stats_count=E,f.concealedSamples===f.interval_concealed_samples&&f.totalSamplesReceived===f.interval_samples_received?(f.stall_count=0,f.stall_duration=0):(f.stall_count=g,f.stall_duration=y),n.stallCount=f.stall_count,n.stallDuration=f.stall_duration;case 35:return i.timestamp=Date.now(),n.audioLossRate=(i.packetsLost-v.packetsLost)/(i.packetsReceived-v.packetsReceived+(i.packetsLost-v.packetsLost)),n.audioLossRate=Number.isNaN(n.audioLossRate)?0:n.audioLossRate,f.packetsLost=Math.round(i.packetsLost-v.packetsLost),f.fraction_lost=n.audioLossRate,n.statsInterval=i.timestamp-v.timestamp,f.stats_interval=n.statsInterval,n.receivedKBitrate=(i.bytesReceived-v.bytesReceived||0)/n.statsInterval*8,f.bandwidth=Math.round(1e3*n.receivedKBitrate/1024),void 0!==i.concealedSamples&&(n.receivedSampleRate=1e3*f.interval_samples_received/n.statsInterval),void 0!==i.fecPacketsReceived&&(f.fecBitratebps=(i.fecPacketsReceived-v.fecPacketsReceived||0)/n.statsInterval),f.average_jitter_buffer_delay_ms&&f.total_rtt_ms&&(n.e2eDelay=f.average_jitter_buffer_delay_ms+f.total_rtt_ms),r.audio=i,this.monitor.rtcMediaStatistics(f,{},_),e.abrupt("return",this.filterIllegal(n));case 50:case"end":return e.stop()}}),e,this)}))),function(e,t){return r.apply(this,arguments)})},{key:"getRemoteVideoStats",value:(t=km(Em().mark((function e(t,r){var n,i,o,a,s,c,u,d,l,h,f,p,v,_,m=this;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(o={},a={timestamp:Date.now()},s=this._stream,c=s.streamId,u=s.userId,d=s.isScreen,l=s.subMediaType,h=s._attributes,f={media_type:"video",is_screen:!!d,direction:"down",stream_id:c,stream_user_id:u,vid:this._stream.videoMid,connection_status:navigator.onLine,track_enabled:null==t?void 0:t.enabled,mute_state:Nw(l)?"mute_state_off":"mute_state_on",remote_user_capture_state:h.localvideo?"capture_state_on":"capture_state_off",remote_user_mute_state:h.localvideo&&h.videostream?"mute_state_off":"mute_state_on"},t&&this.handler){e.next=6;break}return e.abrupt("return",o);case 6:return o.isScreen=d,e.next=9,this.handler.getStats(t);case 9:if(p=e.sent,null===(n=this.monitor)||void 0===n||n.rtcInvokeStatus(wm(i="reports.length: ".concat(p.length,"; videoTrack: ")).call(i,t.id),0,"get_remote_video_stats",c,0),p.length){e.next=13;break}return e.abrupt("return",o);case 13:if(p.forEach((function(e){var t=e.type,r=e.frameHeight,n=e.frameWidth,i=e.packetsLost,s=e.packetsReceived,u=e.bytesReceived,d=e.framesDecoded,l=e.jitterBufferDelay,h=e.jitterBufferEmittedCount,p=e.mimeType,v=e.firCount,_=e.availableIncomingBitrate,g=e.availableOutgoingBitrate,y=e.bytesSent,S=e.nominated,E=e.id,b=e.currentRoundTripTime,k=e.state,T=e.writable,I=e.candidateType,A=e.ip,R=e.address,w=e.networkType,C=e.port,O=e.nackCount,D=e.pliCount,x=e.protocol,N=e.requestsReceived,P=e.responsesReceived,M=e.requestsSent,L=e.consentRequestsSent,U=e.responsesSent,V=e.ssrc,F=e.jitter,B=e.framesReceived,j=e.keyFramesDecoded,G=e.totalDecodeTime,H=e.decoderImplementation,z=e.lastPacketReceivedTimestamp;if("inbound-rtp"===t)a.packetsLost=i,f.packetsLost=i,a.packetsReceived=s,f.packetsReceived=s,a.bytesReceived=u,f.bytes=u,a.framesDecoded=d,a.totalDecodeTime=G,void 0!==l&&(a.jitterBufferDelay=l/h*1e3,f.average_jitter_buffer_delay_ms=a.jitterBufferDelay),f.fir_count=v,f.nackCount=O,a.nackCount=O,f.pli_count=D,f.ssrc=V,f.jitter=F,f.framesReceived=B,a.framesReceived=B,f.framesDecoded=d,f.key_frames_decoded=j,f.decoder_name=H,f.last_packet_received_timestamp=z,void 0!==n&&(o.width=n,f.frame_size_width=n,o.height=r,f.frame_size_height=r);else if("track"===t&&void 0!==n)o.width=n,f.frame_size_width=n,o.height=r,f.frame_size_height=r,void 0!==B&&(f.framesReceived=B,a.framesReceived=B);else if("codec"===t)f.codecName=p;else if("candidate-pair"===t){var K,X,q;f.ice_available_incoming_bitrate=_,f.ice_available_outgoing_bitrate=g,f.ice_bytes_received=u,f.ice_bytes_sent=y,f.ice_nominated=+S,f.ice_pair_id=E,f.ice_pair_rtt=b,f.rtt=1e3*b,f.rtt&&null!==(K=m._context)&&void 0!==K&&null!==(X=K.streamRTT)&&void 0!==X&&null!==(q=X[c])&&void 0!==q&&q.video&&(f.total_rtt_ms=f.rtt+m._context.streamRTT[c].video),o.rtt=f.rtt,f.ice_pair_state=k,f.ice_pair_writable=T,f.recv_ping_requests=N,f.recv_ping_responses=P,f.sent_ping_requests_before_first_response=M,f.sent_ping_requests_total=M+(L||0),f.sent_ping_responses=U}else"local-candidate"===t?(f.local_candidate_type=I,f.local_ip=A||R,f.local_network_type=w,f.local_port=C,f.protocol=x):"remote-candidate"===t&&(f.remote_candidate_type=I,f.remote_ip=A||R,f.remote_port=C)})),(v=r.video).timestamp){e.next=18;break}return r.video=a,e.abrupt("return",this.filterIllegal(o));case 18:return o.videoLossRate=(a.packetsLost-v.packetsLost)/(a.packetsReceived-v.packetsReceived+(a.packetsLost-v.packetsLost)),v.totalDecodeTime&&v.framesDecoded&&a.framesDecoded!==v.framesDecoded&&(f.decode_elapse_per_frame=+((a.totalDecodeTime-v.totalDecodeTime)/(a.framesDecoded-v.framesDecoded)*1e3).toFixed(2)),o._retransmittedRate=(a.nackCount-v.nackCount)/(a.packetsReceived-v.packetsReceived+(a.packetsLost-v.packetsLost)),o.videoLossRate=Number.isNaN(o.videoLossRate)?0:o.videoLossRate,f.fraction_lost=o.videoLossRate,o.statsInterval=a.timestamp-v.timestamp,f.stats_interval=o.statsInterval,o.receivedKBitrate=(a.bytesReceived-v.bytesReceived||0)/o.statsInterval*8,f.bitrate=Math.round(1e3*o.receivedKBitrate),f.bandwidth=Math.round(f.bitrate/1024),o.decoderOutputFrameRate=1e3*(a.framesDecoded-v.framesDecoded)/o.statsInterval,o.receivedFrameRate=1e3*(a.framesReceived-v.framesReceived)/o.statsInterval,f.frame_rate_decoded=Math.round(o.decoderOutputFrameRate),f.frame_rate_received=Math.round(o.receivedFrameRate),f.average_jitter_buffer_delay_ms&&f.total_rtt_ms&&(o.e2eDelay=f.average_jitter_buffer_delay_ms+f.total_rtt_ms),r.video=a,this.processStall(this._stream,f,o,d),this.isPaused?(_=a.timestamp-(this.pauseStart||0),f.pause_duration=this.pauseDuration+(_>500?_:0),this.pauseStart=a.timestamp):f.pause_duration=this.pauseDuration,f.pause_duration=Math.min(f.stall_duration||f.stuck_length||0,f.pause_duration),this.pauseDuration=0,this.monitor.rtcMediaStatistics(f,{}),e.abrupt("return",this.filterIllegal(o));case 40: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&&this.player&&this.player.played){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=Math.min(o,t.stats_interval),t.stall_duration=void 0):(t.stall_duration=Math.min(o,t.stats_interval),t.stuck_length=void 0),t.play_time=a,r.stallCount=i,r.stallDuration=o}},{key:"destroy",value:function(){wI(AI(o.prototype),"destroy",this).call(this),this.delStatsEvtInterval(),this._videoInWaiting=!1}}],[{key:"audioStallConfig",set:function(e){o.audioStallInterval=((null==e?void 0:e.audio_stall_interval)||200)/2,o.audioStallRatio=null==e?void 0:e.audio_stall_ratio}}]),o}(MV);sd(UV,"audioStallInterval",void 0),sd(UV,"audioStallRatio",void 0);var VV,FV,BV,jV=new RC("Stream",0),GV=function(e){return e[e.INIT=0]="INIT",e[e.SUB_ING=1]="SUB_ING",e[e.SUB_ED=2]="SUB_ED",e}(GV||{}),HV=function(){function e(){Wd(this,e),sd(this,"isScreen",!1),sd(this,"stream",void 0),sd(this,"streamId",void 0),sd(this,"audioMid",void 0),sd(this,"videoMid",void 0),sd(this,"seiList",[]),sd(this,"videoTrack",void 0),sd(this,"audioTrack",void 0),sd(this,"videoTransceiver",void 0),sd(this,"audioTransceiver",void 0),sd(this,"videoEncodeConfig",[NN]),sd(this,"subVideoDescriptions",[]),sd(this,"enableSimulcast",!1),sd(this,"observer",void 0),sd(this,"statsReport",void 0),sd(this,"prevBitrate",0),sd(this,"pubAudio",!1),sd(this,"pubVideo",!1),sd(this,"pubAttributes",void 0),this.stream=new MediaStream,this.pubAttributes={localaudio:!1,localvideo:!1,videostream:!1,audiostream:!1,extvideo:!1,extaudio:!1},this.statsReport=new LV(this)}return qd(e,[{key:"audioHasCapture",get:function(){return this.pubAttributes.localaudio}},{key:"audioHasPublish",get:function(){return this.pubAttributes.audiostream}},{key:"videoHasCapture",get:function(){return this.pubAttributes.localvideo}},{key:"videoHasPublish",get:function(){return this.pubAttributes.videostream}},{key:"hasPublished",get:function(){return this.audioMid&&this.videoMid}},{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(gL()){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,o=PV.generateSEI(n.content),a=new Uint8Array(o.byteLength+t.data.byteLength);if(0===n.repeatCount)vk(i=e.seiList).call(i,0,1);n.repeatCount--,a.set(new Uint8Array(t.data)),a.set(o,t.data.byteLength),t.data=a.buffer,r.enqueue(t)}else r.enqueue(t)}});n.pipeThrough(o).pipeTo(i)}}else jV.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 jV.print("no sender found when trying to bind encodedTransform")}},{key:"clean",value:function(){var e;iN.rtcInvokeStatus("".concat((new Error).stack),0,"localstream_clean",this.streamId||"",0),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.prevBitrate=0,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}(),zV=function(e){OI(r,e);var t=qI(r);function r(e,n,i,o){var a;return Wd(this,r),sd(ZT(a=t.call(this)),"streamId",void 0),sd(ZT(a),"userId",void 0),sd(ZT(a),"isScreen",void 0),sd(ZT(a),"hasVideo",void 0),sd(ZT(a),"hasAudio",void 0),sd(ZT(a),"_attributes",void 0),sd(ZT(a),"streamState",void 0),sd(ZT(a),"observer",void 0),sd(ZT(a),"statsReport",void 0),sd(ZT(a),"subVideo",void 0),sd(ZT(a),"subAudio",void 0),sd(ZT(a),"subMediaType",void 0),sd(ZT(a),"subLayer",void 0),sd(ZT(a),"audioMid",void 0),sd(ZT(a),"videoMid",void 0),sd(ZT(a),"_sequenceId",void 0),sd(ZT(a),"stream",void 0),sd(ZT(a),"videoTrack",void 0),sd(ZT(a),"audioTrack",void 0),sd(ZT(a),"videoTransceiver",void 0),sd(ZT(a),"audioTransceiver",void 0),sd(ZT(a),"recordedVideoFrames",void 0),sd(ZT(a),"stillExist",void 0),sd(ZT(a),"originalMediaType",void 0),sd(ZT(a),"originalStreamIndex",0),sd(ZT(a),"virtual",void 0),a.virtual=!1,a.userId=e,a.isScreen=i,a.streamId=n,a.hasAudio=o.audiostream&&o.localaudio,a.hasVideo=o.videostream&&o.localvideo,a._attributes=o,a.subVideo=!1,a.subAudio=!1,a._sequenceId=0,a.subMediaType=IV.NONE,a.subLayer={spatialLayer:0,spatialSubLayer:-1},a.streamState=0,a.statsReport=new UV(ZT(a)),a}return qd(r,[{key:"audioHasCapture",get:function(){return this._attributes.localaudio}},{key:"audioHasPublish",get:function(){return this._attributes.audiostream}},{key:"videoHasCapture",get:function(){return this._attributes.localvideo}},{key:"videoHasPublish",get:function(){return this._attributes.videostream}},{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){AV.getNalunits(new RV(t.data)).forEach((function(t){if(t.sei){var r=PV.decodeSeiBody(t.body);r&&r.type!==wV.internal&&e.safeEmit("onSEIMessage",r.payload)}})),r.enqueue(t)}})).pipeTo(n)}else jV.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 jV.print("no receiver found when trying to bind encodedTransform")}},{key:"ontrack",value:function(e){var t,r,n,i,o,a;try{var s;iN.rtcInvokeStatus(tg({uid:this.userId,streamId:this.streamId,streams:PE(s=e.streams).call(s,(function(e,t){return e+(null==(r=t)?"undefined | null":"string"==typeof r?r:tg({id:r.id,active:r.active}));var r}),""),transceiver:(i=e.transceiver,null==i?"undefined | null":"string"==typeof i?i:tg({currentDirection:i.currentDirection,direction:i.direction,mid:i.mid,stopped:i.stopped,receiver:(a=i.receiver,null==a?"undefined | null":"string"==typeof a?a:tg({track:Lw(a.track)})),sender:(o=i.sender,null==o?"undefined | null":"string"==typeof o?o:tg({track:Lw(o.track)}))})),track:Lw(e.track)}),0,"Stream.ontrack","",0)}catch(EW){}if(null!==(t=e.streams)&&void 0!==t&&null!==(r=t[0])&&void 0!==r&&null!==(n=r.id)&&void 0!==n&&Jm(n).call(n,this.streamId)){var c,u=e.track;"video"===(null==u?void 0:u.kind)?this._setVideoTrack(u):"audio"===(null===(c=e.track)||void 0===c?void 0:c.kind)&&this._setAudioTrack(u),this._setStream(e.streams[0])}this.safeEmit("ontrack",e)}},{key:"clean",value:function(){var e,t;jV.print("clean",wm(e="exec stream.clean ".concat(this.streamId," ")).call(e,this.userId)),iN.rtcInvokeStatus("".concat((new Error).stack),0,"remotestream_clean",this.streamId,0),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,null===(t=this.observer)||void 0===t||t.reset(),this.statsReport.destroy()}},{key:"resetHasSubscribed",value:function(){this.streamState=0}},{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=vV(e),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=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:aw();return new YU(e,t)}(e),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,c=xb(i).call(i,(function(e){return e.width===a&&e.height===s}));return{spatialLayer:e,spatialSubLayer:(null==c?void 0:c.sub_index)||-1}}}]),r}(OC),KV=new RC("queue",4),XV=function(e){return e[e.ADD=0]="ADD",e[e.CLOSE=1]="CLOSE",e}(XV||{}),qV=function(e){return e.publish="publish",e.unpublish="unpublish",e.subscribe="subscribe",e.unsubscribe="unsubscribe",e.pushtrack="pushtrack",e.removetrack="removetrack",e}(qV||{}),WV=(sd(VV={},"publish","unpublish"),sd(VV,"subscribe","unsubscribe"),sd(VV,"pushtrack","removetrack"),VV),YV=(sd(FV={},"publish",0),sd(FV,"subscribe",0),sd(FV,"pushtrack",0),sd(FV,"unpublish",1),sd(FV,"unsubscribe",1),sd(FV,"removetrack",1),FV),QV=function(e){OI(r,e);var t=qI(r);function r(){var e;return Wd(this,r),sd(ZT(e=t.call(this)),"_queue",void 0),e._queue=[],e}return qd(r,[{key:"queue",get:function(){return this._queue}},{key:"enqueue",value:function(e){var t,r=this._queue.length,n="";return this._queue=Gs(t=this._queue).call(t,(function(t){return t.streamId!==e.streamId||e.action!==WV[t.action]||(n=t.streamId,KV.print("offsetStreamId",n),!1)})),this._queue.length===r&&this._queue.push(e),this.emit("start"),n}},{key:"dequeue",value:function(){var e;if(!this._queue.length)return null;var t=this._queue.length;Tw&&(t=Math.min(this._queue.length,5));for(var r=YV[this._queue[0].action],n=1;n<t;n++){var i;if(YV[this._queue[n].action]!==r)return{sdpStrategy:r,items:vk(i=this._queue).call(i,0,n)}}return{sdpStrategy:r,items:vk(e=this._queue).call(e,0,t)}}}]),r}(lC),JV=new RC("ChromeHandler",3),ZV=gL(),$V=function(e){OI(l,e);var t,r,n,i,o,a,s,c,u,d=qI(l);function l(e,t){var r;return Wd(this,l),sd(ZT(r=d.call(this,e,t)),"name","chrome"),sd(ZT(r),"_queueBusy",!1),sd(ZT(r),"_sdpQueue",void 0),sd(ZT(r),"_aSendonlyOfferTpl",void 0),sd(ZT(r),"_vSendonlyOfferTpl",void 0),sd(ZT(r),"_aRecvonlyOfferTpl",void 0),sd(ZT(r),"_vRecvonlyOfferTpl",void 0),sd(ZT(r),"_mid",10),sd(ZT(r),"_offerSession",void 0),sd(ZT(r),"_answerSession",void 0),sd(ZT(r),"_offerMlines",[]),sd(ZT(r),"_answerMlines",[]),sd(ZT(r),"_inactiveMlineIndex",[]),sd(ZT(r),"_mlinesCache",{}),r._sdpQueue=new QV,r._sdpQueue.on("start",(function(){r._queueBusy||"stable"!==r._peerConnection.signalingState||(JV.print("dequeue start"),r.dequeue())})),r}return qd(l,[{key:"connect",value:(u=km(Em().mark((function e(t){var r,n,i,o,a,s,c,u=this;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return JV.print("connect","invoke connect"),this._offerIce={iceUfrag:null===(r=t.iceParams)||void 0===r?void 0:r.clientIceUfrag,icePwd:null===(n=t.iceParams)||void 0===n?void 0:n.clientIcePwd,iceOptions:"renomination"},e.next=4,BL(t);case 4:return this._answerIce=e.sent,this.connection_id=this._answerIce.iceUfrag||"",this.ms_addr=tg((null==t||null===(i=t.publicIPs)||void 0===i?void 0:sg(i).call(i,(function(e){return{ip:e.ip,tcp:e.tcpPorts,udp:e.udpPorts}})))||[]),e.next=9,this._peerConnection.createOffer();case 9:return o=e.sent,a=yL.parse(o.sdp),s=JT(a.media,1),c=s[0],this._offerIce.fingerprint=a.fingerprint||c.fingerprint,delete a.media,this._offerSession=ud({},a),this._answerSession=ud({},a),this._answerSession.fingerprint&&(this._answerSession.fingerprint=this._answerIce.fingerprint),this._offerMlines=[ud(ud(ud({},c),this._offerIce),{},{mid:"".concat(0)})],this._answerMlines=[ud(ud(ud({},c),this._answerIce),{},{sctpmap:{sctpmapNumber:5e3,app:"webrtc-datachannel",maxMessageSize:262144},mid:"".concat(0)})],this.setDescription(),e.next=23,new X_((function(e,t){u._dataChannel.onopen=function(){JV.print("connect","dataChannel open"),_N("es.dc.open","",0,!1,u.connection_id,{ms_addr:u.ms_addr}),e("")},u._dataChannel.onerror=function(e){iN.rtcSignalingMsgError(e.error.sdpLineNumber,e.error.errorDetail,Ox.INVALID_DATA),_N("es.dc.error","",0,!1,u.connection_id,{ms_addr:u.ms_addr}),t(e)},u._dataChannel.onclose=function(e){_N("es.dc.close","",0,!1,u.connection_id,{ms_addr:u.ms_addr}),t(e)},u._peerConnection.addEventListener("connectionstatechange",(function(e){"failed"!==u._peerConnection.iceConnectionState&&"closed"!==u._peerConnection.iceConnectionState&&"failed"!==u._peerConnection.connectionState||t(e)}))}));case 23:return JV.print("connect","dataChannel establish success"),e.abrupt("return",this._dataChannel);case 25:case"end":return e.stop()}}),e,this)}))),function(e){return u.apply(this,arguments)})},{key:"disconnect",value:function(){this._peerConnection.close(),this._dataChannel.close(),this._peerConnection.ontrack=null}},{key:"destroy",value:function(){wI(AI(l.prototype),"destroy",this).call(this),this._mlinesCache={}}},{key:"publish",value:(c=km(Em().mark((function e(t){var r,n,i,o,a,s,c,u,d,h,f,p,v,_,m,g,y,S,E,b,k,T,I,A,R,w,C,O,D,x,N,P,M,L,U,V,F;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return u=t.stream,d=t.enableSimulcast,h=wI(AI(l.prototype),"internalPublish",this).call(this,t),f=h.videoDescriptions,p=h.subVideoDescriptions,v=h.audioTransceiverInit,_=h.videoTransceiverInit,m=ML(this._nextSsrc),this._nextSsrc=m.next,g="".concat(this._mid++),y="".concat(this._mid++),S=ud(ud(ud({},this._aSendonlyOfferTpl),this._offerIce),{},{mid:g,msid:wm(r="".concat(u.id," ")).call(r,u.id,"-audio"),ssrcs:LL(u.id,"audio",m.audio,NL)}),E=ud(ud(ud({},this._vSendonlyOfferTpl),this._offerIce),{},{mid:y,msid:wm(n="".concat(u.id," ")).call(n,u.id,"-video")}),d?(JV.print("subVideoDesc","desc: %o ",p),delete E.ssrcGroups,delete E.ssrcs,b=[],E.rids=sg(f).call(f,(function(e){var t=e.rid;return b.unshift(t),{id:t,direction:"send"}})),E.simulcast={dir1:"send",list1:b.join(";")}):(k=UL(u.id,m,{cname:NL}),T=k.ssrcs,I=k.ssrcGroups,E.ssrcs=T,E.ssrcGroups=I),null!==(i=this._context)&&void 0!==i&&null!==(o=i.serverConfig)&&void 0!==o&&o.audioRed&&Array.isArray(S.rtp)&&(-1!==(R=qA(A=S.rtp).call(A,(function(e){return"red"===e.codec})))&&(C=vk(w=S.rtp).call(w,R,1),O=JT(C,1),D=O[0],S.rtp.unshift(D)),x=[],S.rtp.forEach((function(e){return x.push(e.payload)})),S.payloads=x.join(" ")),null!==(a=this._context)&&void 0!==a&&null!==(s=a.serverConfig)&&void 0!==s&&s.videoCodec&&zL(E,null===(N=this._context)||void 0===N||null===(P=N.serverConfig)||void 0===P?void 0:P.videoCodec),(pw||Sw)&&Array.isArray(E.ext)&&(E.ext=Gs(M=E.ext).call(M,(function(e){var t;return!(null!=e&&null!==(t=e.uri)&&void 0!==t&&Jm(t).call(t,"video-orientation"))}))),(L=null==S?void 0:xb(c=S.rtp).call(c,(function(e){return"opus"===e.codec})))&&S.fmtp&&(F=xb(U=S.fmtp).call(U,(function(e){return e.payload===L.payload})))&&null!==(V=this._context)&&void 0!==V&&V.audioProfileManager&&(F.config=this._context.audioProfileManager.getOpusConfigStr(F.config)),d||pw||this.addBitrateLimit(E,t.videoEncodeConfig[0].maxKbps),this._mlinesCache[t.stream.id]=[S,E],e.abrupt("return",{partialSdp:FL(this._offerSession,S,E),audioMid:g,videoMid:y,type:"incroffer",semantics:"unified-plan",videoDescriptions:f,subVideoDescriptions:p,audioTransceiverInit:v,videoTransceiverInit:_});case 17:case"end":return e.stop()}}),e,this)}))),function(e){return c.apply(this,arguments)})},{key:"subscribe",value:(s=km(Em().mark((function e(t,r){var n,i,o,a,s,c,u,d,l,h,f,p,v,_,m,g,y,S,E,b,k,T,I,A,R,w,C,O,D,x,N=this;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(JV.print("subscribe"),a="incroffer",s="unified-plan",this._aRecvonlyOfferTpl&&this._vRecvonlyOfferTpl){e.next=9;break}return e.next=6,this._genOfferSdp();case 6:return c=e.sent,e.next=9,this.createAVMlineOfferTpl(c);case 9:if(u="",d="",l=!1,h=!1,f=void 0,p=void 0,this._mlinesCache[t.streamId]=[f,p],t.virtual?(u="".concat(this._mid++),l=!0):r.multiChatMode?(u="".concat(this._mid++),d="".concat(this._mid++),h=!0):(l=!0,h=!0,u="".concat(this._mid++),d="".concat(this._mid++)),u&&(f=ud(ud({},this._aRecvonlyOfferTpl),{},{mid:u})),l&&(this._mlinesCache[t.streamId][0]=f,v={track:"audio",init:{direction:"recvonly"}}),d&&(p=ud(ud({},this._vRecvonlyOfferTpl),{},{mid:d})),h&&(this._mlinesCache[t.streamId][1]=p,_={track:"video",init:{direction:"recvonly"}}),m=FL(this._offerSession,f,p),g=void 0,r.multiChatMode||t.virtual||!this._aSendonlyAnswerTpl||!this._vSendonlyAnswerTpl){e.next=32;break}return g=ML(this._nextSsrc),this._nextSsrc=g.next,A=ud(ud(ud({},this._aSendonlyAnswerTpl),this._answerIce),{},{mid:u,msid:wm(y=wm(S="".concat(t.streamId)).call(S,null!==(E=this._context)&&void 0!==E&&E.avSync?"":"-audio"," ")).call(y,t.streamId,"-audio"),ssrcs:LL(t.streamId,"audio",g.audio)}),R=ud(ud(ud({},this._vSendonlyAnswerTpl),this._answerIce),{},{mid:d,msid:wm(b=wm(k="".concat(t.streamId)).call(k,null!==(T=this._context)&&void 0!==T&&T.avSync?"":"-video"," ")).call(b,t.streamId,"-video")},UL(t.streamId,g,{flexfec:this._enableSubFlexfec})),w=new X_((function(e){N._sdpQueue.enqueue({action:qV.subscribe,streamId:t.streamId,audioMid:u,videoMid:d,audioTransceiverInit:v,videoTransceiverInit:_,signalingAck:{sdp:yL.write(ud(ud({},N._answerSession),{},{media:[A,R]})),sequenceId:t.sequenceId?++t.sequenceId:0},stream:t,sdp:m,onSuccess:function(){JV.print("subscribe()","sub success"),e(0)}})})),e.next=31,w;case 31:null===(I=g)||void 0===I||delete I.next;case 32:return(C=null===(n=f)||void 0===n?void 0:xb(i=n.rtp).call(i,(function(e){return"opus"===e.codec})))&&null!==(o=f)&&void 0!==o&&o.fmtp&&(x=null===(O=f)||void 0===O?void 0:xb(D=O.fmtp).call(D,(function(e){return e.payload===C.payload})))&&this._context&&(x.config+=";stereo=1;sprop-stereo=1"),e.abrupt("return",{partialSdp:m,audioMid:u,videoMid:d,type:a,semantics:s,audioTransceiverInit:v,videoTransceiverInit:_,allSsrc:g});case 35:case"end":return e.stop()}}),e,this)}))),function(e,t){return s.apply(this,arguments)})},{key:"handleAck",value:(a=km(Em().mark((function e(t){return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(JV.print("handleAck()","item: %o",t),!t.generatorSsrc){e.next=4;break}return JV.print("already set remote"),e.abrupt("return","");case 4:return e.abrupt("return",this._sdpQueue.enqueue(t));case 5:case"end":return e.stop()}}),e,this)}))),function(e){return a.apply(this,arguments)})},{key:"dequeue",value:(o=km(Em().mark((function e(){var t,r,n,i,o,a,s,c,u,d,l,h,f,p,v,_=this;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._queueBusy=!0,t=this._sdpQueue.dequeue(),JV.print("dequeue()","ret: %o",t),t){e.next=6;break}return this._queueBusy=!1,e.abrupt("return");case 6:if(e.prev=6,r=t.items,n=t.sdpStrategy,i=[],o=[],a=[],n!==XV.ADD){e.next=15;break}return e.delegateYield(Em().mark((function e(){var t,n;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:delete(t=ud({},_._answerIce)).candidates,s=!1,c=!1,e.prev=4,d=SP(r);case 6:return e.next=8,d.next();case 8:if(!(s=!(l=e.sent).done)){e.next=16;break}if(n=l.value,"break"!==function(){var e=n.audioMid,r=n.videoMid,s=n.action,c=n.audioTransceiverInit,u=n.videoTransceiverInit,d=n.signalingAck,l=n.stream,h=l instanceof zV;if(n.onSuccess&&a.push(n.onSuccess),h&&(null==d?void 0:d.sequenceId)<l.sequenceId)return"break";var f,p={},v={},m=yL.parse(d.sdp);Array.isArray(m.media)&&VA(f=m.media).call(f,(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(n){"audio"===(n=ud(ud({},n),t)).type?(p=n).mid=e:(v=n).mid=r}));var g,y=l.streamId;if(s===qV.publish&&(y=null===(g=l.stream)||void 0===g?void 0:g.id),!_._mlinesCache[y])return"break";var S=JT(_._mlinesCache[y],2),E=S[0],b=S[1];if(c&&E){l.audioTransceiver=_._peerConnection.addTransceiver(c.track,c.init),_.monitor.rtcInvokeStatus(tg({audioStreamTrack:Lw(c.track)}),0,"chromeHandler.addTrack","",0);var k=_._inactiveMlineIndex.shift();k||(k=_._offerMlines.length),_._offerMlines[k]=ud({},E),_._answerMlines[k]=p,ZV&&l.initAudioEncodedTransform()}if(u&&b){var T,I;l.videoTransceiver=_._peerConnection.addTransceiver(u.track,u.init),_.monitor.rtcInvokeStatus(tg({videoStreamTrack:Lw(u.track)}),0,"chromeHandler.addTrack","",0);var A,R,w=_._inactiveMlineIndex.shift();w||(w=_._offerMlines.length),_._offerMlines[w]=ud({},b),s===qV.publish&&null!==(T=_._context)&&void 0!==T&&null!==(I=T.serverConfig)&&void 0!==I&&I.videoCodec&&zL(v,null===(A=_._context)||void 0===A||null===(R=A.serverConfig)||void 0===R?void 0:R.videoCodec),_._answerMlines[w]=v,ZV&&l.initVideoEncodedTransform()}i.push(l.streamId||""),o.push(h?l.userId:"local"),h&&(l.sequenceId=null==d?void 0:d.sequenceId),delete _._mlinesCache[y]}()){e.next=13;break}return e.abrupt("break",16);case 13:s=!1,e.next=6;break;case 16:e.next=22;break;case 18:e.prev=18,e.t0=e.catch(4),c=!0,u=e.t0;case 22:if(e.prev=22,e.prev=23,!s||null==d.return){e.next=27;break}return e.next=27,d.return();case 27:if(e.prev=27,!c){e.next=30;break}throw u;case 30:return e.finish(27);case 31:return e.finish(22);case 32:case"end":return e.stop()}}),e,null,[[4,18,22,32],[23,,27,31]])}))(),"t0",13);case 13:e.next=20;break;case 15:v={},r.forEach((function(e){var t=e.audioMid,r=e.videoMid,n=e.action;v[t]=t,n!==qV.removetrack&&(v[r]=r),v[t]=t})),this._offerMlines=sg(h=this._offerMlines).call(h,(function(e,t){return v[e.mid]&&(e=VL(e),_._inactiveMlineIndex.push(t)),e})),VA(f=this._inactiveMlineIndex).call(f,(function(e,t){return e-t})),this._answerMlines=sg(p=this._answerMlines).call(p,(function(e){return v[e.mid]&&(e=VL(e)),e}));case 20:return e.next=22,this.setDescription(i.length?{streamId:i.join(","),streamUserId:o.join(",")}:void 0);case 22:try{a.forEach((function(e){return e()}))}catch(EW){}JV.print("dequeue","loop"),e.next=29;break;case 26:e.prev=26,e.t1=e.catch(6),JV.print("dequeue","unknown error: %o",e.t1);case 29:return e.prev=29,this.dequeue(),e.finish(29);case 32:case"end":return e.stop()}}),e,this,[[6,26,29,32]])}))),function(){return o.apply(this,arguments)})},{key:"setDescription",value:(i=km(Em().mark((function e(t){var r,n;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return JV.print("setDescription"),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=sw(),t&&iN.rtcBeginCreateOffer("local"===t.streamUserId?xx.UP:xx.DOWN,t.streamId,t.streamUserId),e.next=10,this._peerConnection.createOffer();case 10:return t&&iN.rtcCreateOffer(0,"local"===t.streamUserId?Nx.UP:Nx.DOWN,t.streamId,t.streamUserId,sw()-n),e.next=13,this.setLocalDescription(yL.write(this._offerSession),t);case 13:return e.next=15,this.setRemoteDescription(yL.write(this._answerSession),t);case 15:case"end":return e.stop()}}),e,this)}))),function(e){return i.apply(this,arguments)})},{key:"getDefaultSdp",value:(n=km(Em().mark((function e(){var t,r,n,i;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._genOfferSdp();case 2:return r=e.sent,this.createAVMlineOfferTpl(r),n=yL.parse(r),i=[],n.media=Gs(t=n.media).call(t,(function(e){var t;return"recvonly"===e.direction&&(Array.isArray(e.ext)&&(e.ext=Gs(t=e.ext).call(t,(function(e){return"urn:ietf:params:rtp-hdrext:sdes:rtp-stream-id"!==e.uri}))),i.push(e.mid+""),!0)})),n.groups=[{mids:i.join(" "),type:"BUNDLE"}],e.abrupt("return",{sdp:yL.write(n),semantics:"unified-plan",type:"incroffer"});case 9:case"end":return e.stop()}}),e,this)}))),function(){return n.apply(this,arguments)})},{key:"rollback",value:(r=km(Em().mark((function e(t){return Em().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 r.apply(this,arguments)})},{key:"createAVMlineOfferTpl",value:function(e){var t=this;yL.parse(e).media.forEach((function(e){if("audio"===e.type)if("sendonly"===e.direction)t._aSendonlyOfferTpl=e;else{var r;if(Array.isArray(e.ext))e.ext=Gs(r=e.ext).call(r,(function(e){return"urn:ietf:params:rtp-hdrext:sdes:rtp-stream-id"!==e.uri}));t._aRecvonlyOfferTpl=e}else if("video"===e.type)if("sendonly"===e.direction)t._vSendonlyOfferTpl=e;else{var n;if(Array.isArray(e.ext))e.ext=Gs(n=e.ext).call(n,(function(e){return"urn:ietf:params:rtp-hdrext:sdes:rtp-stream-id"!==e.uri}));t._vRecvonlyOfferTpl=e}}))}},{key:"_genOfferSdp",value:(t=km(Em().mark((function e(){var t,r;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,Cw(!0);case 3:if(t=e.sent){e.next=6;break}throw"pc.createOffer() return empty.";case 6:e.next=12;break;case 8:throw e.prev=8,e.t0=e.catch(0),r="Get offer Error. ".concat(e.t0.message|e.t0),new lR(uR.NOT_SUPPORTED,r);case 12:return e.abrupt("return",t);case 13:case"end":return e.stop()}}),e,null,[[0,8]])}))),function(){return t.apply(this,arguments)})}]),l}(qL),eF=new RC("FirefoxHandler",3),tF=function(e){OI(l,e);var t,r,n,i,o,a,s,c,u,d=qI(l);function l(){var e,t;Wd(this,l);for(var r=arguments.length,n=new Array(r),i=0;i<r;i++)n[i]=arguments[i];return sd(ZT(t=d.call.apply(d,wm(e=[this]).call(e,n))),"name","firefox"),sd(ZT(t),"_aRecvonlyOfferTpl",void 0),t}return qd(l,[{key:"connect",value:(u=km(Em().mark((function e(t){var r,n,i,o,a,s,c,u,d,l,h,f=this;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return eF.print("connect","invoke connect"),this._offerIce={iceUfrag:null===(r=t.iceParams)||void 0===r?void 0:r.clientIceUfrag,icePwd:null===(n=t.iceParams)||void 0===n?void 0:n.clientIcePwd,iceOptions:"renomination"},e.next=4,BL(t);case 4:return this._answerIce=e.sent,this.connection_id=this._answerIce.iceUfrag||"",this.ms_addr=tg((null==t||null===(i=t.publicIPs)||void 0===i?void 0:sg(i).call(i,(function(e){return{ip:e.ip,tcp:e.tcpPorts,udp:e.udpPorts}})))||[]),this._peerConnection.addTransceiver("audio",{direction:"recvonly"}),this._peerConnection.addTransceiver("video",{direction:"recvonly"}),e.next=11,this._peerConnection.createOffer();case 11:return c=e.sent,u=yL.parse(c.sdp),d=JT(u.media,1),l=d[0],this._offerIce.fingerprint=u.fingerprint||l.fingerprint,u.media=sg(o=u.media).call(o,(function(e){return ud(ud({},e),f._offerIce)})),sg(a=u.media).call(a,(function(e){var t,r;"video"===e.type&&(e.ext=null===(t=e.ext)||void 0===t?void 0:Gs(t).call(t,(function(e){var t;return-1===Hb(t=e.uri).call(t,"abs-send-time")})),e.rtcpFb=null===(r=e.rtcpFb)||void 0===r?void 0:Gs(r).call(r,(function(e){return"goog-remb"!==e.type})))})),(h=ud({},u)).fingerprint=this._answerIce.fingerprint,h.media=sg(s=h.media).call(s,(function(e){return delete(e=ud(ud({},e),f._answerIce)).bundleOnly,e.port=9,"application"===e.type?e.sctpmap={sctpmapNumber:5e3,app:"webrtc-datachannel",maxMessageSize:262144}:("audio"===e.type&&(e.msid="ff-stream ff-stream-audio"),e.direction="sendonly"),e})),e.next=22,this.setLocalDescription(yL.write(u));case 22:return e.next=24,this.setRemoteDescription(yL.write(h));case 24:return e.next=26,new X_((function(e,t){f._dataChannel.onopen=function(){eF.print("connect","dataChannel open"),_N("es.dc.open","",0,!1,f.connection_id,{ms_addr:f.ms_addr}),e("")},f._dataChannel.onerror=function(e){iN.rtcSignalingMsgError(e.error.sdpLineNumber,e.error.errorDetail,Ox.INVALID_DATA),_N("es.dc.error","",0,!1,f.connection_id,{ms_addr:f.ms_addr}),t(e)},f._dataChannel.onclose=function(e){_N("es.dc.close","",0,!1,f.connection_id,{ms_addr:f.ms_addr}),t(e)},f._peerConnection.addEventListener("connectionstatechange",(function(e){"failed"!==f._peerConnection.iceConnectionState&&"closed"!==f._peerConnection.iceConnectionState&&"failed"!==f._peerConnection.connectionState||t(e)}))}));case 26:return eF.print("connect","dataChannel establish success"),e.abrupt("return",this._dataChannel);case 28:case"end":return e.stop()}}),e,this)}))),function(e){return u.apply(this,arguments)})},{key:"publish",value:(c=km(Em().mark((function e(t){var r,n,i,o,a,s,c,u,d,h,f,p,v,_,m=this;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=wI(AI(l.prototype),"internalPublish",this).call(this,t),o=i.videoDescriptions,a=i.subVideoDescriptions,s=i.audioTransceiverInit,c=i.videoTransceiverInit,t.audioTransceiver=this._peerConnection.addTransceiver(s.track,s.init),t.videoTransceiver=this._peerConnection.addTransceiver(c.track,c.init),u=sw(),iN.rtcBeginCreateOffer(xx.UP,"",""),e.next=7,this._peerConnection.createOffer();case 7:return d=e.sent,iN.rtcCreateOffer(0,Nx.UP,"","",sw()-u),(h=yL.parse(d.sdp)).media=null===(r=h.media)||void 0===r?void 0:sg(r).call(r,(function(e){return ud(ud({},e),m._offerIce)})),e.next=13,this.setLocalDescription(yL.write(h));case 13:return f=t.audioTransceiver.mid,p=t.videoTransceiver.mid,v=null,_=null,h.media=null===(n=h.media)||void 0===n?void 0:sg(n).call(n,(function(e){if("".concat(e.mid)===f){var t,r,n=null===(t=v=e)||void 0===t?void 0:xb(r=t.rtp).call(r,(function(e){return"opus"===e.codec}));if(n&&v.fmtp){var i,o,a=xb(i=v.fmtp).call(i,(function(e){return e.payload===n.payload}));a&&null!==(o=m._context)&&void 0!==o&&o.audioProfileManager&&(a.config=m._context.audioProfileManager.getOpusConfigStr(a.config))}}else if("".concat(e.mid)===p){var s,c,u,d;null!==(s=m._context)&&void 0!==s&&null!==(c=s.serverConfig)&&void 0!==c&&c.videoCodec&&zL(e,null===(u=m._context)||void 0===u||null===(d=u.serverConfig)||void 0===d?void 0:d.videoCodec),_=e}return e})),this.addBitrateLimit(_,t.videoEncodeConfig[0].maxKbps),e.next=21,this.setLocalDescription(yL.write(h));case 21:return e.abrupt("return",{partialSdp:FL(h,v,_,!1),audioMid:f,videoMid:p,type:"incroffer",semantics:"unified-plan",videoDescriptions:o,subVideoDescriptions:a,audioTransceiverInit:s,videoTransceiverInit:c});case 22:case"end":return e.stop()}}),e,this)}))),function(e){return c.apply(this,arguments)})},{key:"subscribe",value:(s=km(Em().mark((function e(t,r){var n,i,o,a,s,c,u,d,l,h,f,p,v,_,m,g,y,S,E,b,k,T,I,A,R=this;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return eF.print("subscribe()"),c="",u="",d=!1,l=!1,h=void 0,f=void 0,t.virtual?d=!0:(r.multiChatMode||(d=!0),l=!0),d&&(t.audioTransceiver=this._peerConnection.addTransceiver("audio",{direction:"recvonly"})),l&&(t.videoTransceiver=this._peerConnection.addTransceiver("video",{direction:"recvonly"})),p=sw(),iN.rtcBeginCreateOffer(xx.UP,t.streamId,t.userId),e.next=14,this._peerConnection.createOffer();case 14:return v=e.sent,iN.rtcCreateOffer(0,Nx.UP,t.streamId,t.userId,sw()-p),(_=yL.parse(v.sdp)).media=null===(n=_.media)||void 0===n?void 0:sg(n).call(n,(function(e){return ud(ud({},e),R._offerIce)})),sg(i=_.media).call(i,(function(e){var t,r;"video"===e.type&&(e.ext=null===(t=e.ext)||void 0===t?void 0:Gs(t).call(t,(function(e){var t;return-1===Hb(t=e.uri).call(t,"abs-send-time")})),e.rtcpFb=null===(r=e.rtcpFb)||void 0===r?void 0:Gs(r).call(r,(function(e){return"goog-remb"!==e.type})))})),e.next=21,this.setLocalDescription(yL.write(_),{streamId:t.streamId||"",streamUserId:t.userId});case 21:if(c=null===(o=t.audioTransceiver)||void 0===o?void 0:o.mid,u=null===(a=t.videoTransceiver)||void 0===a?void 0:a.mid,null===(s=_.media)||void 0===s||s.forEach((function(e){"".concat(e.mid)===c?h=e:"".concat(e.mid)===u&&(f=e)})),c&&h||(c="audio_".concat(u),h=ud(ud({},this._aRecvonlyOfferTpl),{},{mid:c})),t.audioMid=c,t.videoMid=u,m=void 0,r.multiChatMode||t.virtual||!this._aSendonlyAnswerTpl||!this._aSendonlyAnswerTpl){e.next=36;break}return m=ML(this._nextSsrc),this._nextSsrc=m.next,I=ud(ud(ud({},this._aSendonlyAnswerTpl),this._answerIce),{},{mid:c,msid:wm(g=wm(y="".concat(t.streamId)).call(y,null!==(S=this._context)&&void 0!==S&&S.avSync?"":"-audio"," ")).call(g,t.streamId,"-audio"),ssrcs:LL(t.streamId,"audio",m.audio)}),A=ud(ud(ud({},this._vSendonlyAnswerTpl),this._answerIce),{},{mid:u,msid:wm(E=wm(b="".concat(t.streamId)).call(b,null!==(k=this._context)&&void 0!==k&&k.avSync?"":"-video"," ")).call(E,t.streamId,"-video")},UL(t.streamId,m,{flexfec:this._enableSubFlexfec})),e.next=35,this._internalSetRemoteDescription([I,A],t);case 35:null===(T=m)||void 0===T||delete T.next;case 36:return e.abrupt("return",{partialSdp:FL(_,h,f,!1),audioMid:c,videoMid:u,type:"incroffer",semantics:"unified-plan",audioTransceiverInit:t.audioTransceiver?{track:"audio",init:{direction:"recvonly"}}:void 0,videoTransceiverInit:t.videoTransceiver?{track:"video",init:{direction:"recvonly"}}:void 0,allSsrc:m});case 37:case"end":return e.stop()}}),e,this)}))),function(e,t){return s.apply(this,arguments)})},{key:"handleAck",value:(a=km(Em().mark((function e(t){var r,n,i,o;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=t.signalingAck,n=t.stream,(i=t.action)!==qV.unpublish&&i!==qV.unsubscribe&&i!==qV.removetrack){e.next=5;break}return e.next=4,this.close(n);case 4:return e.abrupt("return",n.streamId||"");case 5:if(!t.generatorSsrc){e.next=8;break}return eF.print("already set remote"),e.abrupt("return","");case 8:return o=yL.parse(null==r?void 0:r.sdp),e.next=11,this._internalSetRemoteDescription(o.media,n);case 11:return e.abrupt("return","");case 12:case"end":return e.stop()}}),e,this)}))),function(e){return a.apply(this,arguments)})},{key:"_internalSetRemoteDescription",value:(o=km(Em().mark((function e(t,r){var n,i,o,a,s,c,u,d,l=this;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return s={},(c=yL.parse(null===(n=this._peerConnection.remoteDescription)||void 0===n?void 0:n.sdp)).media.forEach((function(e){void 0!==e.mid&&(s[e.mid]=e)})),t.forEach((function(e){if("audio"===(e=ud(ud({},e),l._answerIce)).type&&(r.audioMid?(e.mid=r.audioMid,s[r.audioMid]=e):s[e.mid]=e),"video"===e.type){if(r instanceof HV&&yw<=87){var t,n,i,o,a={};Array.isArray(e.rtp)&&(e.rtp=Gs(t=e.rtp).call(t,(function(e){return"rtx"!==e.codec||(a[e.payload]=e.payload,!1)}))),"string"==typeof e.payloads&&(e.payloads=Gs(n=e.payloads.split(" ")).call(n,(function(e){return!a[e]})).join(" ")),Array.isArray(e.fmtp)&&(e.fmtp=Gs(i=e.fmtp).call(i,(function(e){return!a[e.payload]}))),Array.isArray(e.rtcpFb)&&(e.fmtp=Gs(o=e.fmtp).call(o,(function(e){return!a[e.payload]})))}r.videoMid?(e.mid=r.videoMid,s[r.videoMid]=e):s[e.mid]=e}})),u=yL.parse(null===(i=this._peerConnection.localDescription)||void 0===i?void 0:i.sdp),d=sg(o=u.media).call(o,(function(e){var t=s[e.mid];return"inactive"===e.direction?e:t})),c.groups=u.groups,c.media=d,sg(a=c.media).call(a,(function(e){var t,r;"video"===e.type&&(e.ext=null===(t=e.ext)||void 0===t?void 0:Gs(t).call(t,(function(e){var t;return-1===Hb(t=e.uri).call(t,"abs-send-time")})),e.rtcpFb=null===(r=e.rtcpFb)||void 0===r?void 0:Gs(r).call(r,(function(e){return"goog-remb"!==e.type})))})),e.next=11,this.setRemoteDescription(yL.write(c));case 11:case"end":return e.stop()}}),e,this)}))),function(e,t){return o.apply(this,arguments)})},{key:"getDefaultSdp",value:(i=km(Em().mark((function e(){var t,r,n,i,o;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=yL.parse(null===(t=this._peerConnection.localDescription)||void 0===t?void 0:t.sdp),this.createAVMlineOfferTpl(null===(r=this._peerConnection.localDescription)||void 0===r?void 0:r.sdp),o=[],i.media=Gs(n=i.media).call(n,(function(e){return"recvonly"===e.direction&&(e.mid=e.mid+1,o.push(e.mid+""),!0)})),i.groups=[{mids:o.join(" "),type:"BUNDLE"}],e.abrupt("return",{sdp:yL.write(i),semantics:"unified-plan",type:"incroffer"});case 6:case"end":return e.stop()}}),e,this)}))),function(){return i.apply(this,arguments)})},{key:"rollback",value:(n=km(Em().mark((function e(t,r,n){return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return eF.print("rollback()"),e.abrupt("return",this.close(r));case 2:case"end":return e.stop()}}),e,this)}))),function(e,t,r){return n.apply(this,arguments)})},{key:"close",value:(r=km(Em().mark((function e(t,r){var n,i,o,a,s,c,u,d,l,h=this;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return eF.print("close()"),a={},t.audioTransceiver&&t.audioMid&&(t.audioTransceiver.stop(),a[t.audioMid]=t.audioMid),t.videoTransceiver&&t.videoMid&&!r&&(t.videoTransceiver.stop(),a[t.videoMid]=t.videoMid),s=[],e.next=7,this._peerConnection.createOffer();case 7:return c=e.sent,(u=yL.parse(null==c?void 0:c.sdp)).media=sg(n=u.media).call(n,(function(e){return a[e.mid]&&(e=VL(e)),"inactive"!==e.direction&&s.push(e.mid),ud(ud({},e),h._offerIce)})),d=yL.parse(null===(i=this._peerConnection.remoteDescription)||void 0===i?void 0:i.sdp),l={},d.media.forEach((function(e){void 0!==e.mid&&(l[e.mid]=e)})),d.media=sg(o=u.media).call(o,(function(e){return"inactive"===e.direction?e:l[e.mid]})),u.groups&&d.groups&&(u.groups[0].mids=s.join(" "),d.groups[0].mids=s.join(" ")),e.next=17,this.setLocalDescription(yL.write(u));case 17:return e.next=19,this.setRemoteDescription(yL.write(d));case 19:case"end":return e.stop()}}),e,this)}))),function(e,t){return r.apply(this,arguments)})},{key:"setCurrentDescription",value:(t=km(Em().mark((function e(){return Em().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)})},{key:"createAVMlineOfferTpl",value:function(e){var t=this;yL.parse(e).media.forEach((function(e){"audio"===e.type&&(t._aRecvonlyOfferTpl=e)}))}}]),l}(qL),rF=function(e,t){return fw?new tF(e,t):new $V(e,t)},nF=new RC("Locker",2),iF=1,oF=function(){function e(t){var r;Wd(this,e),sd(this,"lockingPromise",X_.resolve()),sd(this,"locks",0),sd(this,"name",""),sd(this,"lockId",void 0),this.lockId=iF++,t&&(this.name=t),nF.print(wm(r="[lock-".concat(this.name,"-")).call(r,this.lockId,"] is created."))}return qd(e,[{key:"isLocked",get:function(){return this.locks>0}},{key:"lock",value:function(){var e,t,r,n=this;this.locks+=1,nF.print(wm(e=wm(t="[lock-".concat(this.name,"-")).call(t,this.lockId,"] locked, current queue ")).call(e,this.locks,"."));var i=new X_((function(e){r=function(){var t,r;n.locks-=1,nF.print(wm(t=wm(r="[lock-".concat(n.name,"-")).call(r,n.lockId,"] unlocked, current queue ")).call(t,n.locks,".")),e()}})),o=this.lockingPromise.then((function(){return r}));return this.lockingPromise=this.lockingPromise.then((function(){return i})),o}}]),e}(),aF=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_SUBTITLE_STATE_CHANGED="ON_SUBTITLE_STATE_CHANGED",e.ON_SUBTITLE_MESSAGE_RECEIVED="ON_SUBTITLE_MESSAGE_RECEIVED",e.ON_VIDEO_STREAM_BANNED="ON_VIDEO_STREAM_BANNED",e.ON_AUDIO_STREAM_BANNED="ON_AUDIO_STREAM_BANNED",e}(aF||{}),sF=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}(sF||{}),cF=function(e){return e[e.PUB=0]="PUB",e[e.UNPUB=1]="UNPUB",e}(cF||{}),uF=function(e){return e[e.SUB=0]="SUB",e[e.UNSUB=1]="UNSUB",e}(uF||{}),dF=(sd(BV={},xd.communication,[0]),sd(BV,xd.chat,[0]),sd(BV,xd.chatRoom,[1,"IES_chatroom"]),sd(BV,xd.coHost,[1,"IES_PK"]),sd(BV,xd.meeting,[16]),sd(BV,xd.classRoom,[0]),BV),lF=ad,hF=tc,fF=function(e,t,r,n){for(var i,o=n>1?void 0:n?hF(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&&lF(t,r,o),o},pF=new RC("MediaServerClient",2),vF=6e4,_F=function(e){return e.DISCONNECTED="disconnected",e.DISCONNECTING="disconnecting",e.CONNECTED="connected",e.CONNECTING="connecting",e}(_F||{}),mF=function(e,t){pF.print(e,"userId: %o, subAudio: %o, subVideo: %o, audioMid: %o, videoMid: %o, sequenceId: %o",t.userId,t.subAudio,t.subVideo,t.audioMid,t.videoMid,t.sequenceId)},gF=function(e){OI(b,e);var t,r,n,i,o,a,s,c,u,d,l,h,f,p,v,_,m,g,y,S,E=qI(b);function b(e){var t,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:iN;return Wd(this,b),sd(ZT(t=E.call(this)),"id",void 0),sd(ZT(t),"_token",void 0),sd(ZT(t),"_appId",void 0),sd(ZT(t),"_roomId",void 0),sd(ZT(t),"_roomAttributes",void 0),sd(ZT(t),"_clientId",void 0),sd(ZT(t),"_businessId",void 0),sd(ZT(t),"_userInfo",void 0),sd(ZT(t),"_useCloudProxy",void 0),sd(ZT(t),"_expectedIDC",void 0),sd(ZT(t),"_authorization",void 0),sd(ZT(t),"_sessionId",void 0),sd(ZT(t),"_iceConfigRequestManager",void 0),sd(ZT(t),"_ontrackCallbackMap",new yE),sd(ZT(t),"_subResolves",{}),sd(ZT(t),"supportConcurrent",!1),sd(ZT(t),"_handler",void 0),sd(ZT(t),"_pubSubLock",void 0),sd(ZT(t),"_joinLeaveLock",void 0),sd(ZT(t),"_state",void 0),sd(ZT(t),"_dataChannelSignal",void 0),sd(ZT(t),"_subConfig",{}),sd(ZT(t),"monitor",void 0),sd(ZT(t),"_roomProfile",xd.communication),sd(ZT(t),"_context",void 0),sd(ZT(t),"_subStreamQueue",{}),t.id=null==e?void 0:e.id,t.monitor=r,t._pubSubLock=new oF("pubSubLock"),t._joinLeaveLock=new oF("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 qd(b,[{key:"_addHandlerEvents",value:function(){var e,t=this;null===(e=this._handler)||void 0===e||e.once("disconnect",(function(){pF.print("emit ABNORMAL_DISCONNECTION ice"),t.safeEmit(jN.ABNORMAL_DISCONNECTION)}))}},{key:"_addSignalEventHandler",value:function(){var e,t=this;[FN.ON_ADD_STREAM,FN.ON_ADD_STREAM_LIST,FN.ON_REMOVE_STREAM,FN.ON_REMOVE_STREAM_LIST,FN.USER_CONNECTION,FN.USER_CONNECTION_LIST,FN.USER_DISCONNECTION,FN.USER_DISCONNECTION_LIST,FN.ON_UPDATE_STREAM_ATTRIBUTES,FN.ON_UPDATE_ROOM_ATTRIBUTES,FN.ON_PUSH_TRACK,FN.NODE_CHANGE,FN.ON_CUSTOM_MESSAGE,FN.USER_MESSAGE_RECEIVED,FN.USER_BINARY_MESSAGE_RECEIVED,FN.POST_PROCESSING_MESSAGE,FN.ON_USER_TOKEN_WILL_EXPIRE,FN.STREAM_CONTROL_MESSAGE,FN.ON_UPDATE_USER_ATTRIBUTES,FN.ON_SPEAKER_CHANGE,BN.RSCP,BN.RTT,FN.ON_STREAM_FAILED].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(){pF.print("emit ABNORMAL_DISCONNECTION datachannel"),t.safeEmit(jN.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(jN.ON_CONNECTION_STATE_CHANGE,{prev:this._state,next:e}),this._state=e)}},{key:"businessId",set:function(e){this._businessId=e}},{key:"connect",value:(S=km(Em().mark((function e(t){var r,n,i,o,a,s,c,u,d=this,l=arguments;return Em().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],_N("es.join.nodeChange",i),e.next=20;break;case 11:return X_.resolve().then((function(){return d.emit("onGetIceConfigHook")})),this._iceConfigRequestManager=new mP,e.next=15,null===(a=this._iceConfigRequestManager)||void 0===a?void 0:a.getAccessNode(t,r,n,TN.getDeviceId(),null==i?void 0:i.reason,null==i?void 0:i.feedbackNode,this._useCloudProxy,this._expectedIDC);case 15:if(o=e.sent){e.next=19;break}throw _N("es.join.getNodeFailed",""),new lR(uR.ICE_SERVER_WRONG,"get ICE config failed");case 19:_N("es.join.getNodeSuccess",o);case 20:return X_.resolve().then((function(){return d.emit("onEstablishConnectionHook")})),e.prev=21,c=!1,u=sg(o).call(o,(function(e){var t=rF(d.monitor,d._context);return t.connect(e).then((function(r){var n;d.emit("onConnectSuccessHook",null===(n=o)||void 0===n?void 0:n.length),c?t.destroy():(c=!0,s=r,d.safeEmit("prevIceNode",e),d._handler=t,sN.setStats({connection_id:t.connection_id}),d.supportConcurrent="chrome"===t.name,d._addHandlerEvents())})).catch((function(e){throw t.destroy(),e}))})),e.next=26,Ow(u);case 26:pF.print("join","establish peerConnection success"),e.next=33;break;case 29:throw e.prev=29,e.t0=e.catch(21),this.connectionState="disconnected",new lR(uR.ESTABLISH_DATACHANNEL_FAILED,"establish dataChannel failed",e.t0);case 33:if(!s){e.next=39;break}this._dataChannelSignal=new pP(this.id,s),this._addSignalEventHandler(),this._dataChannelSignal.sendPingSignaling(),e.next=41;break;case 39:throw this.connectionState="disconnected",new lR(uR.ESTABLISH_DATACHANNEL_FAILED,"establish dataChannel failed");case 41:case"end":return e.stop()}}),e,this,[[21,29]])}))),function(e){return S.apply(this,arguments)})},{key:"join",value:(y=km(Em().mark((function e(t){var r,n,i,o,a,s,c,u,d,l,h,f,p,v,_,m=this,g=arguments;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=g.length>1&&void 0!==g[1]?g[1]:{},i=g.length>2&&void 0!==g[2]&&g[2],o=g.length>3?g[3]:void 0,pF.print("join()","info: %o, params: %o, reconnect: %o, controlMessage: %o",t,n,i,o),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._expectedIDC=t.expectedIDC,this._roomProfile=t.roomProfile,this._sessionId=n.sessionId,e.next=16,this.connect(this._appId,this._roomId,this._clientId,n);case 16:return e.t0=dw.token2auth(this._appId,this._roomId,this._clientId,this._token),e.t1=this._sessionId||"",e.t2=Date.now(),e.t3=o,e.t4={extra_info:this._userInfo.extraInfo,role:this._userInfo.role},e.next=23,null===(r=this._handler)||void 0===r?void 0:r.getDefaultSdp();case 23:return e.t5=e.sent,e.next=26,sL();case 26:return e.t6=e.sent,e.t7=window.navigator.userAgent,e.t8=CN.VERSION,e.t9=TN.getDeviceId(),e.t10=this._appId,e.t11=this._roomId,e.t12=this._clientId,e.t13=this._businessId,e.t14=this._useCloudProxy,e.t15=dF[this._roomProfile]?dF[this._roomProfile][0]+"":"0",e.t16={supportedCodecs:e.t6,deviceType:"web",userAgent:e.t7,sdkVersion:e.t8,deviceId:e.t9,appId:e.t10,roomId:e.t11,userId:e.t12,businessId:e.t13,enableCloudProxy:e.t14,channelProfile:e.t15},e.t17={supportTokenExpireCallBack:!0,enableSceneConfigV2:!0,enableUnBundleMode:!0,enableAudioMux:!0,enableBigRoomMode:!0,needNegotiateSDP:!0},a={Authorization:e.t0,sessionId:e.t1,timestamp:e.t2,controlMessage:e.t3,userAttributes:e.t4,sdpInfo:e.t5,params:e.t16,options:e.t17},X_.resolve().then((function(){return m.emit("onSendingJoinMessageHook")})),e.prev=40,c=i?"reconnected":"joinRoom",e.next=44,this._dataChannelSignal.sendSignaling(c,a);case 44:return u=e.sent,pF.print("join","send join message success"),d=u.config||{},l=d.engine_WEB,this._authorization=a.Authorization,this.connectionState="connected",TN.setEngineWebConfig(this._appId,this._roomId,l),this._context&&(this._context.serverConfig={videoCodec:(null==l?void 0:l.video_codec)||"H264",audioRed:!(null==l||!l.pub_audio_red),muteReplaceUnsub:!(null===(h=u.config)||void 0===h||!h.mute_replace_unsub),simulcastOnDemand:!(fw||!1===(null===(f=u.config)||void 0===f||null===(p=f.engine_VPM)||void 0===p||null===(v=p.ondemand)||void 0===v?void 0:v.enable))},"boolean"==typeof(null==l?void 0:l.av_sync)&&(this._context.avSync=l.av_sync)),UV.audioStallConfig=l,null!=u&&null!==(s=u.relayMessage)&&void 0!==s&&s.sdp&&(null===(_=this._handler)||void 0===_||_.createAVMlineAnswerTpl(u.relayMessage.sdp)),e.abrupt("return",u);case 56:if(e.prev=56,e.t18=e.catch(40),this.connectionState="disconnected",!((null===e.t18||void 0===e.t18?void 0:e.t18.code)>=700&&(null===e.t18||void 0===e.t18?void 0:e.t18.code)<800)){e.next=61;break}throw new lR(uR.INVALID_TOKEN,(null===e.t18||void 0===e.t18?void 0:e.t18.message)||"Invalid token");case 61:if(200===(null===e.t18||void 0===e.t18?void 0:e.t18.code)){e.next=63;break}throw new lR(uR.JOIN_ROOM_FAILED,(null===e.t18||void 0===e.t18?void 0:e.t18.message)||"Join room failed");case 63:case"end":return e.stop()}}),e,this,[[40,56]])}))),function(e){return y.apply(this,arguments)})},{key:"publish",value:(g=km(Em().mark((function e(t){var r,n,i,o,a,s,c,u,d,l,h,f,p,v,_,m,g,y,S,E,b=this;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return pF.print("publish()","localStream: %o",t),r=t.videoTrack,n=t.audioTrack,i=sw(),o="",a="",e.prev=6,e.next=9,null===(s=this._handler)||void 0===s?void 0:s.publish(t);case 9:if(_=e.sent){e.next=12;break}throw new lR(uR.ADD_TRANSCEIVER_FAILED,"add transceiver failed");case 12:if("H264"!==(null===(c=this._context)||void 0===c||null===(u=c.serverConfig)||void 0===u?void 0:u.videoCodec)){e.next=18;break}return e.next=15,pL();case 15:if(e.sent){e.next=18;break}throw new lR(uR.PUBLISH_FAILED,"h264 is not supported");case 18:return o=_.audioMid,a=_.videoMid,t.pubAttributes={localaudio:!!n,localvideo:!!r,videostream:t.pubVideo,audiostream:t.pubAudio,extvideo:!!(r instanceof $U),extaudio:!!(n instanceof eV)},m={attributes:ud({videoDescriptions:_.videoDescriptions},t.pubAttributes),audio:!0,video:!0,screen:t.isScreen,audioMid:o,videoMid:a,sdpInfo:{msid:t.stream.id,type:_.type,sdp:_.partialSdp,semantics:_.semantics}},(g=t.enableSimulcast&&(null===(d=this._context)||void 0===d||null===(l=d.serverConfig)||void 0===l?void 0:l.simulcastOnDemand)&&(null===(h=_.subVideoDescriptions)||void 0===h?void 0:h.length))&&(m.attributes.subVideoDescriptions=_.subVideoDescriptions),e.next=26,null===(f=this._dataChannelSignal)||void 0===f?void 0:f.sendSignaling("publish",m);case 26:if(200===(null==(y=e.sent)?void 0:y.code)){e.next=29;break}throw new lR(uR.PUBLISH_FAILED,(null==y?void 0:y.message)||"publish failed");case 29:if(iN.rtcRecvAnswer(0,Lx.INCRANSWER,(null==y||null===(p=y.relayMessage)||void 0===p?void 0:p.sequenceId)||0,null==y||null===(v=y.relayMessage)||void 0===v?void 0:v.sdp,Ux.UP,"",""),S=new X_((function(e,r){var n,i,s;null===(n=b._handler)||void 0===n||n.handleAck({action:qV.publish,streamId:y.streamId,audioMid:o,videoMid:a,audioTransceiverInit:null==_?void 0:_.audioTransceiverInit,videoTransceiverInit:null==_?void 0:_.videoTransceiverInit,signalingAck:{sdp:null==y||null===(i=y.relayMessage)||void 0===i?void 0:i.sdp,sequenceId:null==y||null===(s=y.relayMessage)||void 0===s?void 0:s.sequenceId},sdp:_.sdp,stream:t,onSuccess:function(){pF.print("publish()","publish success"),e(0)}})})),e.t0=!fw,!e.t0){e.next=35;break}return e.next=35,S;case 35:return g&&this.emit(BN.RSCP,[{StreamIds:[t.stream.id],Metadata:{VideoIndex:0}}]),t.streamId=y.streamId,t.videoMid=a,t.audioMid=o,t.subVideoDescriptions=_.subVideoDescriptions,this.monitor.rtcPublishStat(Vx.SUCCESS,Fx.W_0,i,Bx.UNKNOWN),t.statsReport.setLocalStreamStatsEvtInterval(this,this._handler,this.monitor,this._context),e.abrupt("return");case 45:return e.prev=45,e.t1=e.catch(6),e.t1 instanceof Error&&this.monitor.rtcPublishStat(Vx.FAIL,Fx.W_0,i,e.t1.message),e.next=50,null===(E=this._handler)||void 0===E?void 0:E.rollback(t.stream.id,t);case 50:throw e.t1;case 51:case"end":return e.stop()}}),e,this,[[6,45]])}))),function(e){return g.apply(this,arguments)})},{key:"updatePubTrack",value:(m=km(Em().mark((function e(t){var r,n,i,o,a,s,c,u,d,l,h,f,p,v,_,m,g,y,S,E,b,k,T,I,A,R,w,C,O,D,x;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:pF.print("updatePubTrack()","localStream: %o",t),i=t.videoTrack,o=t.audioTrack,a=t.pubAudio,s=t.pubVideo,c=null==o?void 0:o.getTrack("preprocessing"),u=null==i?void 0:i.getTrack("preprocessing"),s&&u?null===(d=t.videoTransceiver)||void 0===d||d.sender.replaceTrack(u):null===(l=t.videoTransceiver)||void 0===l||l.sender.replaceTrack(null),null===(r=this._handler)||void 0===r||r.updateMaxBitrate(t),a&&c?(f=o.mixType,(p=o.mixedAudioTrack)&&f!==Gd.PLAYOUT&&!0===c.enabled&&(c=p),null===(h=t.audioTransceiver)||void 0===h||h.sender.replaceTrack(c)):(null===(v=t.audioTransceiver)||void 0===v||v.sender.replaceTrack(null),this.monitor.rtcInvokeStatus("null",0,"MediaClient.updatePubTrack(audio)","",0));try{this.monitor.rtcInvokeStatus(tg({audioStreamTrack:Lw(c),videoStreamTrack:Lw(u)}),0,"MediaClient.updatePubTrack","",0)}catch(EW){}for(m={},g=0,y=SR(_={localaudio:!!o,localvideo:!!i,videostream:s,audiostream:a,extvideo:!!(i instanceof $U),extaudio:!!(o instanceof eV)});g<y.length;g++)S=JT(y[g],2),E=S[0],(b=S[1])!==sI(t.pubAttributes,E)&&FC(m,E,b);if(an(m).length){e.next=13;break}return e.abrupt("return");case 13:return t.observer&&(k=t.observer,T=m.audiostream,I=m.videostream,A=m.localaudio,R=m.localvideo,w=m.extaudio,C=m.extvideo,void 0!==R?void 0!==C?k.setPushVideo(C):k.setEnableVideo(R):void 0!==I&&k.setUnmuteVideo(I),void 0!==A?void 0!==w?k.setPushAudio(w):k.setEnableAudio(A):void 0!==T&&k.setUnmuteAudio(T)),t.pubAttributes=_,O={roomId:this._roomId,streamId:t.streamId,attributes:m},e.next=18,null===(n=this._dataChannelSignal)||void 0===n?void 0:n.sendSignaling("updateStreamAttributes",O);case 18:if(200===(null==(D=e.sent)?void 0:D.code)){e.next=21;break}throw new lR(uR.UPDATE_TRACK_FAILED,(null==D?void 0:D.message)||"update track failed");case 21:if(!fw){e.next=24;break}return e.next=24,null===(x=this._handler)||void 0===x?void 0:x.setCurrentDescription();case 24:case"end":return e.stop()}}),e,this)}))),function(e){return m.apply(this,arguments)})},{key:"updateToken",value:(_=km(Em().mark((function e(t){var r,n,i,o,a;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(pF.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 lR(uR.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 lR(uR.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 _.apply(this,arguments)})},{key:"unpublish",value:(v=km(Em().mark((function e(t){var r,n,i;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return pF.print("unpublish()","localStream: %o",t),i={roomId:this._roomId,initStreamId:t.initStreamId,streamId:t.streamId},null===(r=this._dataChannelSignal)||void 0===r||r.sendSignaling("unpublish",i),e.next=5,null===(n=this._handler)||void 0===n?void 0:n.handleAck({action:qV.unpublish,audioMid:t.audioMid,videoMid:t.videoMid,stream:t,streamId:t.streamId});case 5:t.statsReport.unpublish();case 6:case"end":return e.stop()}}),e,this)}))),function(e){return v.apply(this,arguments)})},{key:"subscribe",value:(p=km(Em().mark((function e(t,r,n){var i=this;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",new X_(function(){var e=km(Em().mark((function e(o,a){var s,c,u,d,l,h,f,p,v,_,m,g,y,S,E,b,k,T,I,A,R,w,C,O,D,x,N,P,M,L;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t.streamState!==GV.SUB_ED){e.next=2;break}return e.abrupt("return",i._updateSubTrack(t,r,uF.SUB).then(o,a));case 2:if(t.streamState!==GV.SUB_ING){e.next=7;break}return i._subStreamQueue[t.streamId]||(i._subStreamQueue[t.streamId]=[]),pF.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(pF.print("subscribe()","mediaType: %o",r),mF("subscribe()",t),t.streamState=GV.SUB_ING,c=!1,u=!1,xw(r)&&(u=!0),Nw(r)&&(c=!0),c||!i.multiChatMode()){e.next=17;break}return t.streamState=GV.INIT,i.emit("SUB_END",t.streamId),e.abrupt("return",o(null));case 17:return d=sw(),l=t.subVideo,h=[],f=!i.multiChatMode(),i._subResolves[t.streamId]||(i._subResolves[t.streamId]=[]),h.push(new X_((function(e,r){i._subResolves[t.streamId].push(e);var n=setTimeout((function(){return r(new lR(uR.TIME_OUT,"wait video timeout for userId: ".concat(t.userId)))}),vF);t.on("ontrack",(function r(i){"video"===i.mediaType&&(pF.print("remoteStream ".concat(t.userId," received video track")),t.off("ontrack",r),clearTimeout(n),e(0))}))}))),f&&h.push(new X_((function(e,r){i._subResolves[t.streamId].push(e);var n=setTimeout((function(){return r(new lR(uR.TIME_OUT,"wait audio timeout for userId: ".concat(t.userId)))}),vF);t.on("ontrack",(function r(i){"audio"===i.mediaType&&(pF.print("remoteStream ".concat(t.userId," received audio track")),t.off("ontrack",r),clearTimeout(n),e(0))}))}))),p=function(e){t.ontrack(e)},null===(s=i._handler)||void 0===s||s.on("ontrack",p),i._ontrackCallbackMap.set(t,p),e.prev=27,e.next=30,null===(v=i._handler)||void 0===v?void 0:v.subscribe(t,{multiChatMode:i.multiChatMode()});case 30:if(k=e.sent){e.next=33;break}throw new lR(uR.ADD_TRANSCEIVER_FAILED,"add transceiver failed");case 33:return T=k.audioMid,I=k.videoMid,t.subVideo=c,A={spatialLayer:(null==n?void 0:n.spatialLayer)||0,temporalLayer:0,spatialSubLayer:(null==n?void 0:n.spatialSubLayer)||-1},R={audio:!i.multiChatMode(),video:!0,data:!0,screen:t.isScreen,browser:"chrome-stable",videoMid:I,audioMid:T,sdpInfo:{sdp:null==k?void 0:k.partialSdp,semantics:null==k?void 0:k.semantics,type:null==k?void 0:k.type},streamUserId:t.userId,streamId:t.streamId,config:{enableMediaType:{audio:!!i.multiChatMode()||u,video:c},qualityLayer:A},extra:{enableSendRTT:!0}},w=i._context||{},C=w.subscribeFallbackOption,O=w.userPriority,"number"==typeof C&&(R.config.fallbackOption=C),null!=O&&O.has(t.userId)&&(R.config.priority=O.get(t.userId)),null!=k&&k.allSsrc&&(R.extra.subscribeSSRC=k.allSsrc),e.next=44,null===(_=i._dataChannelSignal)||void 0===_?void 0:_.sendSignaling("subscribe",R);case 44:if(200===(null==(D=e.sent)?void 0:D.code)){e.next=47;break}throw new lR(uR.SUBSCRIBE_FAILED,(null==D?void 0:D.message)||"subscribe failed");case 47:return x=null==D?void 0:D.relayMessage,N=x.audioMid,P=x.videoMid,sd(m={},T,N),sd(m,I,P),M=m,pF.print("sub midmap",t.userId,M),t.videoMid=I,t.audioMid=T,t.subMediaType=r,t.streamState=GV.SUB_ED,t.subLayer=A,iN.rtcRecvAnswer(0,Lx.INCRANSWER,(null==D||null===(g=D.relayMessage)||void 0===g?void 0:g.sequenceId)||0,null==D||null===(y=D.relayMessage)||void 0===y?void 0:y.sdp,Ux.DOWN,t.streamId,t.userId),e.next=58,null===(S=i._handler)||void 0===S?void 0:S.handleAck({action:qV.subscribe,streamId:t.streamId,audioMid:T,videoMid:I,audioTransceiverInit:null==k?void 0:k.audioTransceiverInit,videoTransceiverInit:null==k?void 0:k.videoTransceiverInit,signalingAck:{sdp:null==D||null===(E=D.relayMessage)||void 0===E?void 0:E.sdp,sequenceId:null==D||null===(b=D.relayMessage)||void 0===b?void 0:b.sequenceId},stream:t,sdp:k.sdp,generatorSsrc:!!k.allSsrc});case 58:return e.next=60,X_.all(h);case 60:i.multiChatMode()||(t.subAudio=u),i.monitor.rtcSubscribeStat(jx.SUCCESS,d,Gx.UNKNOWN,t.userId),i._context&&t.statsReport.setRemoteStreamStatsEvtInterval(i,i._handler,i.monitor,i._context),o(null),i.emit("SUB_END",t.streamId),e.next=76;break;case 67:return e.prev=67,e.t0=e.catch(27),e.t0 instanceof Error&&i.monitor.rtcSubscribeStat(jx.FAIL,d,e.t0.message,t.userId),t.subVideo=l,t.streamState=GV.INIT,e.next=74,null===(L=i._handler)||void 0===L?void 0:L.rollback(t.streamId,t);case 74:a(e.t0),i.emit("SUB_END",t.streamId);case 76:case"end":return e.stop()}}),e,null,[[27,67]])})));return function(t,r){return e.apply(this,arguments)}}()));case 1:case"end":return e.stop()}}),e)}))),function(e,t,r){return p.apply(this,arguments)})},{key:"_handleSubStreamQueue",value:function(e){var t,r=this;if(null!==(t=this._subStreamQueue[e])&&void 0!==t&&t.length){pF.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 pF.print("_subStreamQueue","streamId: %o, END",e)}},{key:"controlMessage",value:(f=km(Em().mark((function e(t){var r,n;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return pF.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 f.apply(this,arguments)})},{key:"updateUserAttributes",value:(h=km(Em().mark((function e(t){var r;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return pF.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 h.apply(this,arguments)})},{key:"updateSubTrack",value:(l=km(Em().mark((function e(t,r,n){return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this._updateSubTrack(t,r,n));case 1:case"end":return e.stop()}}),e,this)}))),function(e,t,r){return l.apply(this,arguments)})},{key:"updateSubTrackLayer",value:(d=km(Em().mark((function e(t,r){var n,i,o;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(pF.print("updateSubTrack()","subLayer: %o",r),t.subLayer.spatialLayer!==r.spatialLayer||t.subLayer.spatialSubLayer!==r.spatialSubLayer){e.next=4;break}return pF.print("updateSubTrack()","subLayer no change"),e.abrupt("return");case 4:return i={roomId:this._roomId,streamList:[t.streamId],streamId:t.streamId,streamUserId:t.userId,config:{qualityLayer:r}},e.next=7,null===(n=this._dataChannelSignal)||void 0===n?void 0:n.sendSignaling("updateSubscribe",i);case 7:if(200===(null==(o=e.sent)?void 0:o.code)){e.next=10;break}throw new lR(uR.UPDATE_TRACK_FAILED,(null==o?void 0:o.message)||"update track failed");case 10:return t.subLayer=r,e.abrupt("return",t);case 12:case"end":return e.stop()}}),e,this)}))),function(e,t){return d.apply(this,arguments)})},{key:"_updateSubTrack",value:(u=km(Em().mark((function e(t,r,n){var i,o,a,s,c,u,d,l,h,f,p;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(pF.print("updateSubTrack()","mediaType: %o",r),mF("updateSubTrack()",t),!this.multiChatMode()||r!==Sd.AUDIO){e.next=5;break}return pF.print("updateSubTrack","multiChatMode mediaType only audio"),e.abrupt("return",t);case 5:return a=0,a=n===uF.SUB?t.subMediaType|r:t.subMediaType-(t.subMediaType&r),pF.print("updateSubTrack","prev: %o, direction: %o, mediaType: %o, newMediaType: %o",t.subMediaType,n,r,a),t.subMediaType===a&&pF.print("updateSubTrack","mediaType no change"),s=!1,c=!1,xw(a)&&(c=!0),Nw(a)&&(s=!0),u={roomId:this._roomId,streamList:[t.streamId],config:{enableMediaType:{video:s,audio:!!this.multiChatMode()||c}}},d=this._context||{},l=d.subscribeFallbackOption,h=d.userPriority,"number"==typeof l&&(u.config.fallbackOption=l),null!=h&&h.has(t.userId)&&(u.config.priority=h.get(t.userId)),e.next=18,null===(i=this._dataChannelSignal)||void 0===i?void 0:i.sendSignaling("updateSubscribe",u);case 18:if(200===(null==(f=e.sent)?void 0:f.code)){e.next=21;break}throw new lR(uR.UPDATE_TRACK_FAILED,(null==f?void 0:f.message)||"update track failed");case 21:return this.multiChatMode()||(null===(p=t.observer)||void 0===p||p.setUnmuteAudio(c),t.subAudio=c),null===(o=t.observer)||void 0===o||o.setUnmuteVideo(s),t.subVideo=s,t.subMediaType=a,e.abrupt("return",t);case 26:case"end":return e.stop()}}),e,this)}))),function(e,t,r){return u.apply(this,arguments)})},{key:"subscribe4pushTrack",value:(c=km(Em().mark((function e(t,r){var n,i,o,a,s,c,u,d,l;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return pF.print("subscribe4pushTrack()","streamInfo: %o",r),mF("subscribe4pushTrack()",t),t.subAudio=!0,null===(n=t.observer)||void 0===n||n.setPushTrack(!0),e.next=6,null===(i=this._handler)||void 0===i?void 0:i.subscribe(t,{multiChatMode:this.multiChatMode()});case 6:if(s=e.sent){e.next=9;break}throw new lR(uR.ADD_TRANSCEIVER_FAILED,"add transceiver failed");case 9:return c=s.audioMid,u=s.videoMid,(d=[]).push(new X_((function(e,r){var n=setTimeout((function(){return r(new lR(uR.TIME_OUT,"wait audio timeout for userId: ".concat(t.userId)))}),vF);t.on("ontrack",(function r(i){"audio"===i.mediaType&&(pF.print("remoteStream ".concat(t.userId," received audio track")),t.off("ontrack",r),clearTimeout(n),e(0))}))}))),l=function(e){t.ontrack(e)},null===(o=this._handler)||void 0===o||o.on("ontrack",l),this._ontrackCallbackMap.set(t,l),e.next=18,null===(a=this._handler)||void 0===a?void 0:a.handleAck({action:qV.pushtrack,streamId:t.streamId,audioMid:c,videoMid:u,stream:t,audioTransceiverInit:null==s?void 0:s.audioTransceiverInit,videoTransceiverInit:null==s?void 0:s.videoTransceiverInit,signalingAck:null==r?void 0:r.message,sdp:s.sdp});case 18:return e.next=20,X_.all(d);case 20:this._context&&t.statsReport.setRemoteStreamStatsEvtInterval(this,this._handler,this.monitor,this._context);case 21:case"end":return e.stop()}}),e,this)}))),function(e,t){return c.apply(this,arguments)})},{key:"unsubscribe4removeTrack",value:(s=km(Em().mark((function e(t,r){return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:mF("unsubscribe4removeTrack()",t),pF.print("unsubscribe4removeTrack()","sequenceId: ",r.sequenceId);case 2:case"end":return e.stop()}}),e)}))),function(e,t){return s.apply(this,arguments)})},{key:"unsubscribe",value:(a=km(Em().mark((function e(t,r){var n,i,o=arguments;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=o.length>2&&void 0!==o[2]&&o[2],mF("unsubscribe()",t),!n){e.next=4;break}return e.abrupt("return",this._unsubscribe(t,r));case 4:if(!this.multiChatMode()||!Nw(r)){e.next=6;break}return e.abrupt("return",this._unsubscribe(t,r));case 6:if(i=t.subMediaType-(t.subMediaType&r),this.multiChatMode()||i!==IV.NONE){e.next=9;break}return e.abrupt("return",this._unsubscribe(t,r));case 9:return e.abrupt("return",this._updateSubTrack(t,r,uF.UNSUB));case 10:case"end":return e.stop()}}),e,this)}))),function(e,t){return a.apply(this,arguments)})},{key:"_unsubscribe",value:(o=km(Em().mark((function e(t,r){var n,i,o,a,s,c;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t.hasSubscribed){e.next=2;break}return e.abrupt("return");case 2:if(!this._subConfig.muteReplaceUnsub){e.next=4;break}return e.abrupt("return",this._updateSubTrack(t,r,uF.UNSUB));case 4:return s={roomId:this._roomId,streamId:t.streamId,userId:t.userId},null===(n=this._dataChannelSignal)||void 0===n||n.sendSignaling("unsubscribe",s).catch((function(){})),t.streamState=GV.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,null===(i=t.observer)||void 0===i||i.setSubscribeVideo(!1),!this.multiChatMode()&&(null===(o=t.observer)||void 0===o||o.setSubscribeAudio(!1)),e.next=13,null===(a=this._handler)||void 0===a?void 0:a.handleAck({action:qV.unsubscribe,streamId:t.streamId,audioMid:t.audioMid,videoMid:t.videoMid,stream:t});case 13:c=e.sent,this._subResolves[c]&&this._subResolves[c].forEach((function(e){return e(0)})),pF.print("unsubscribe","clean unsub ".concat(t.userId)),t.clean(),this.removeOnTrackListener(t),t.statsReport.unsubscribe();case 19:case"end":return e.stop()}}),e,this)}))),function(e,t){return o.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:(i=km(Em().mark((function e(t,r){return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(mF("handleRemoveStream()",t),t.subVideo=!1,t.hasSubscribed){e.next=4;break}return e.abrupt("return");case 4:this.unsubscribe(t,Sd.AUDIO_AND_VIDEO,!0);case 5:case"end":return e.stop()}}),e,this)}))),function(e,t){return i.apply(this,arguments)})},{key:"leave",value:(n=km(Em().mark((function e(){var t,r,n;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(pF.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",X_.reject(new lR(uR.NOT_CONNECTED_YET,"server not connected")));case 23:case"end":return e.stop()}}),e,this,[[7,13,17,20]])}))),function(){return n.apply(this,arguments)})},{key:"subscribePublicStream",value:(r=km(Em().mark((function e(t){var r,n,i,o,a,s,c,u,d,l,h,f,p,v,_,m=this;return Em().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,{multiChatMode:!1});case 2:if(a=e.sent){e.next=5;break}throw new lR(uR.ADD_TRANSCEIVER_FAILED,"add transceiver failed");case 5:return s=sw(),c=a.audioMid,u=a.videoMid,e.t0=this._appId,e.t1=t.streamId,e.t2=c,e.t3=u,e.t4={sdp:null==a?void 0:a.partialSdp,semantics:null==a?void 0:a.semantics,type:null==a?void 0:a.type},e.next=15,sL();case 15:return e.t5=e.sent,e.t6=window.navigator.userAgent,e.t7=CN.VERSION,e.t8=TN.getDeviceId(),e.t9=this._appId,e.t10=this._businessId,e.t11=this._useCloudProxy,e.t12={supportedCodecs:e.t5,deviceType:"web",userAgent:e.t6,sdkVersion:e.t7,deviceId:e.t8,appId:e.t9,businessId:e.t10,enableCloudProxy:e.t11},e.t13={enableMediaType:{audio:!0,video:!0},qualityLayer:{spatialLayer:0,temporalLayer:0}},d={appId:e.t0,streamId:e.t1,audio:!0,video:!0,data:!0,audioMid:e.t2,videoMid:e.t3,sdpInfo:e.t4,params:e.t12,config:e.t13},e.next=27,null===(n=this._dataChannelSignal)||void 0===n?void 0:n.sendSignaling("startPullStream",d);case 27:return l=e.sent,h=[],this._subResolves[t.streamId]=[],h.push(new X_((function(e,r){m._subResolves[t.streamId].push(e);var n=setTimeout((function(){return r(new lR(uR.TIME_OUT,"wait video timeout for streamId: ".concat(t.streamId)))}),vF);t.on("ontrack",(function r(i){"video"===i.mediaType&&(pF.print("remoteStream ".concat(t.userId," received video track")),t.off("ontrack",r),clearTimeout(n),e(0))}))}))),h.push(new X_((function(e,r){m._subResolves[t.streamId].push(e);var n=setTimeout((function(){return r(new lR(uR.TIME_OUT,"wait audio timeout for streamId: ".concat(t.streamId)))}),vF);t.on("ontrack",(function r(i){"audio"===i.mediaType&&(pF.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,v=p.sequenceId,_=p.sdp,t.videoMid=u,t.audioMid=c,t.sequenceId=v,t.streamState=GV.SUB_ED,t.subAudio=!0,t.subVideo=!0,e.next=44,null===(o=this._handler)||void 0===o?void 0:o.handleAck({action:qV.subscribe,streamId:t.streamId,audioMid:c,videoMid:u,audioTransceiverInit:null==a?void 0:a.audioTransceiverInit,videoTransceiverInit:null==a?void 0:a.videoTransceiverInit,signalingAck:{sdp:_,sequenceId:v},stream:t});case 44:return e.next=46,X_.all(h);case 46:this.monitor.rtcSubscribeStat(jx.SUCCESS,s,Gx.UNKNOWN,t.userId),this._context&&t.statsReport.setRemoteStreamStatsEvtInterval(this,this._handler,this.monitor,this._context);case 48:case"end":return e.stop()}}),e,this)}))),function(e){return r.apply(this,arguments)})},{key:"unsubscribePublicStream",value:(t=km(Em().mark((function e(t){var r,n,i;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return mF("unsubscribePublicStream()",t),n={appId:this._appId,streamId:t.streamId},e.prev=2,e.next=5,null===(i=this._dataChannelSignal)||void 0===i?void 0:i.sendSignaling("stopPullStream",n);case 5:e.next=9;break;case 7:e.prev=7,e.t0=e.catch(2);case 9:return t.streamState=GV.INIT,t.subVideo=!1,t.subAudio=!1,e.next=14,null===(r=this._handler)||void 0===r?void 0:r.handleAck({action:qV.unsubscribe,streamId:t.streamId,audioMid:t.audioMid,videoMid:t.videoMid,stream:t});case 14: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;pF.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}}]),b}(OC);function yF(e,t,r){var n=r.value;return r.value=km(Em().mark((function e(){var r,i,o,a=arguments;return Em().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 lR(uR.NOT_CONNECTED_YET,"error in ".concat(t,": try again after joined"));case 7:case"end":return e.stop()}}),e,this)}))),r}function SF(e,t,r){var n=r.value;return r.value=km(Em().mark((function e(){var t,r,i,o,a=arguments;return Em().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}fF([function(e,t,r){var n=r.value;return r.value=km(Em().mark((function e(){var t,r,i,o,a=this,s=arguments;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:for(t=s.length,r=new Array(t),i=0;i<t;i++)r[i]=s[i];return o=!1,e.abrupt("return",new X_(function(){var e=km(Em().mark((function e(t,i){var s;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return a.on("INTERRUPT",(function(){o=!0,i(new lR(uR.OPERATION_CANCEL,"operation not finish when leave"))})),e.prev=1,e.next=4,n.apply(a,r);case 4:s=e.sent,t(s),e.next=11;break;case 8:e.prev=8,e.t0=e.catch(1),o||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}],gF.prototype,"join",1),fF([SF,yF],gF.prototype,"publish",1),fF([SF,yF],gF.prototype,"updatePubTrack",1),fF([SF,yF],gF.prototype,"unpublish",1),fF([SF,yF],gF.prototype,"subscribe",1),fF([yF],gF.prototype,"controlMessage",1),fF([yF],gF.prototype,"updateUserAttributes",1),fF([yF],gF.prototype,"updateSubTrack",1),fF([yF],gF.prototype,"updateSubTrackLayer",1),fF([SF,yF],gF.prototype,"subscribe4pushTrack",1),fF([SF,yF],gF.prototype,"unsubscribe4removeTrack",1),fF([SF,yF],gF.prototype,"unsubscribe",1),fF([yF],gF.prototype,"handleRemoveStream",1),fF([SF],gF.prototype,"subscribePublicStream",1),fF([SF],gF.prototype,"unsubscribePublicStream",1);var EF=AE.right,bF=pe,kF=sf;Rr({target:"Array",proto:!0,forced:!Iu("reduceRight")||!kF&&bF>79&&bF<83},{reduceRight:function(e){return EF(this,e,arguments.length,arguments.length>1?arguments[1]:void 0)}});var TF=Us("Array").reduceRight,IF=ae,AF=TF,RF=Array.prototype,wF=function(e){var t=e.reduceRight;return e===RF||IF(RF,e)&&t===RF.reduceRight?AF:t},CF={};ad(CF,"__esModule",{value:!0});var OF=function(){return(OF=YE||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var i in t=arguments[r])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)};function DF(e,t){var r="function"==typeof _l&&Ok(e);if(!r)return e;var n,i,o=r.call(e),a=[];try{for(;(void 0===t||0<t--)&&!(n=o.next()).done;)a.push(n.value)}catch(s){i={error:s}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return a}function xF(e){return"object"==Ml(e)&&null!==e}function NF(e){return"function"==typeof e}function PF(){if("object"==("undefined"==typeof window?"undefined":Ml(window))&&xF(window))return window}function MF(){if("object"==("undefined"==typeof document?"undefined":Ml(document))&&xF(document))return document}var LF=function(e){if(e)return e.__SLARDAR_REGISTRY__||(e.__SLARDAR_REGISTRY__={Slardar:{plugins:[],errors:[],subject:{}}}),e.__SLARDAR_REGISTRY__.Slardar},UF=function(e,t,r,n){void 0===t&&(t={}),void 0===n&&(n=[]);try{var i=e.apply(void 0,function(e,t,r){if(r||2===arguments.length)for(var n,i=0,o=t.length;i<o;i++)!n&&i in t||((n=n||Sm(Array.prototype).call(t,0,i))[i]=t[i]);return wm(e).call(e,n||Sm(Array.prototype).call(t))}([],DF(n),!1));return i&&i(t,r)||[]}catch(o){return function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=LF(PF());r&&(r.errors||(r.errors=[]),r.errors.push(e))}(o),[]}},VF=function(e){return e.requestIdleCallback||function(t){return e.setTimeout(t,1)}},FF=function(){return Date.now()};var BF=function(e,t){return xF(e)?OF(OF({},t),e):!!e&&t};var jF=["SCRIPT","STYLE","META","HEAD"],GF=["js_error","http","resource_error"],HF=["performance","performance_longtask","performance_timing","custom"],zF=function e(t,r,n,i,o){if(void 0===r&&(r=0),void 0===n&&(n=0),void 0===i&&(i=1.5),void 0===o&&(o=jF),!t||-1<Hb(o).call(o,t.tagName)||i<=n||4<r)return n;var a=function(){if(!r)return 0;var e=(n=t.getBoundingClientRect()).top,n=n.height;return e>innerHeight||n<=0?0:1/Math.pow(2,r-1)}();return wF([]).call(t.children,(function(t,n){return e(n,r+1,t,i,o)}),n+a)},KF=function(e,t,r,n){if(function(){if(PF()&&"Promise"in window)return X_}()&&r&&n){if(r.html2canvas)return o();var i=n.createElement("script");i.src=t,null!==(t=n.head)&&void 0!==t&&t.appendChild(i),i.onload=o}function o(){VF(r)((function(){r.html2canvas&&r.html2canvas(n.body,{scale:360/r.innerWidth}).then((function(t){e(t.toDataURL("image/jpeg",.1))}))}))}},XF=function(e,t,r,n,i){if(void 0===e&&(e=PF()),void 0===t&&(t=MF()),void 0===r&&(r=function(){if(PF()&&NF(window.PerformanceObserver))return window.PerformanceObserver}()),void 0===n&&(n=function(){if(PF()&&NF(window.MutationObserver))return window.MutationObserver}()),void 0===i&&(i=function(){if(PF()&&xF(window.performance))return window.performance}()),t&&e)return function(o,a){var s,c,u,d,l,h,f=o.threshold,p=o.screenshot,v=o.rootSelector,_=o.autoDetect,m=o.ssUrl,g=VF(e),y=DF(function(e){var t=e&&e.timing||void 0;return[t,function(){return e&&e.now?e.now():(Date.now?Date.now():+new Date)-(t&&t.navigationStart||0)},function(t){var r=(e||{}).getEntriesByType;return NF(r)&&r.call(e,t)||[]},function(){var t=(e||{}).clearResourceTimings;NF(t)&&t.call(e)},function(t){var r=(e||{}).getEntriesByName;return NF(r)&&r.call(e,t)||[]}]}(i),2)[1],S=0,E=!1,b=function(e){s&&a&&a({ev_type:"blank_screen",payload:{timestamp:s[0],score:s[1],screenshot:e,error:c}})},k=(d=function(){s&&!E&&(E=!0,I(),p?KF(b,m,e,t):b())},function(){l||(h=FF(),l=e.setTimeout((function(){l=0,h<S||d()}),y()>1e4?2e3:8e3))});function T(){u&&clearTimeout(u),u=e.setTimeout((function(){g((function(){e.requestAnimationFrame((function(){var e=v?t.querySelector(v):t.body;e&&((e=zF(e,0,0,f))<f?(s=[FF(),e],k()):s=void 0)}))}))}),1e3)}!function(e){var t=DF(function(e){var t=!1;return[function(r){t||(t=!0,e&&e(r))}]}(e),1)[0];["unload","beforeunload","pagehide"].forEach((function(e){addEventListener(e,t)}))}((function(){!E&&c&&b()}));var I=function(){clearTimeout(u),R&&R(),C&&C()},A=(o=DF(function(e,t){var r=e&&new e(t);return[function(e,t){r&&e&&r.observe(e,t)},function(){return r&&r.disconnect()}]}(n,T),2),o[0]),R=o[1],w=(o=DF(function(e,t,r,n){var i=e&&new e((function(e,i){e.getEntries?e.getEntries().forEach((function(e,r,n){return t(e,r,n,i)})):n&&n(),r&&i.disconnect()}));return[function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];if(!e||!i)return n&&n();try{t.forEach((function(t){var r;-1<Hb(r=e.supportedEntryTypes).call(r,t)&&i.observe({type:t,buffered:!1})}))}catch(o){try{i.observe({entryTypes:t})}catch(a){return n&&n()}}},function(){return i&&i.disconnect()}]}(r,(function(e,t,r){return u&&1<r.length&&T()})),2),o[0]),C=o[1];return _&&function(e){var t=PF(),r=MF();t&&r&&("loading"!==r.readyState?e():t.addEventListener("DOMContentLoaded",(function(){setTimeout((function(){e()}),0)}),!1))}((function(){var e;A(null===(e=MF())||void 0===e?void 0:e.body,{subtree:!0,childList:!0}),w("longtask","resource"),T()})),[I,function(e){E||function(e){return~Hb(HF).call(HF,e.ev_type)}(e)||(S=FF(),c&&S-c.timestamp>1e4&&(c=void 0),c=function(e,t){if(-1===Hb(GF).call(GF,t.ev_type))return e;if("http"===t.ev_type&&t.payload.response.status<400)return e;if(e&&Hb(GF).call(GF,e.type)<Hb(GF).call(GF,t.ev_type))return e;var r="";switch(t.ev_type){case"js_error":r=t.payload.error.message;break;case"http":r=t.payload.request.url;break;case"resource_error":r=t.payload.url}return{type:t.ev_type,message:r,timestamp:FF()}}(c,e))},T]}},qF="blankScreen";function WF(e,t,r){e.on("init",(function(){var n,i,o,a=function(e,t,r){return t=null===(e=e.config())||void 0===e?void 0:e.plugins[t],BF(t,r)}(e,qF,t)||BF(r,t);a&&(a=DF(UF(XF,a,e.report.bind(e)),3),n=a[0],i=a[1],a=a[2],e.on("report",o=function(e){return i(e),e}),e.on("beforeDestroy",(function(){n(),e.off("report",o)})),e.provide("detectBlankScreen",a))}))}var YF={autoDetect:!0,threshold:1.5,screenshot:!0,ssUrl:"https://apm.volccdn.com/mars-web/apmplus/web/html2canvas.min.js"};var QF=CF.blankScreenPlugin=function(e){return{name:qF,setup:function(t){!function(e,t){WF(e,YF,t)}(t,e)}}},JF=PR.start;Rr({target:"String",proto:!0,forced:MR},{padStart:function(e){return JF(this,e,arguments.length>1?arguments[1]:void 0)}});var ZF,$F=Us("String").padStart,eB=ae,tB=$F,rB=String.prototype,nB=function(e){var t=e.padStart;return"string"==typeof e||e===rB||eB(rB,e)&&t===rB.padStart?tB:t},iB={};ad(iB,"__esModule",{value:!0});var oB=function(){return(oB=YE||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var i in t=arguments[r])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)};function aB(e,t){var r="function"==typeof _l&&Ok(e);if(!r)return e;var n,i,o=r.call(e),a=[];try{for(;(void 0===t||0<t--)&&!(n=o.next()).done;)a.push(n.value)}catch(s){i={error:s}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return a}function sB(e,t,r){if(r||2===arguments.length)for(var n,i=0,o=t.length;i<o;i++)!n&&i in t||((n=n||Sm(Array.prototype).call(t,0,i))[i]=t[i]);return wm(e).call(e,n||Sm(Array.prototype).call(t))}var cB=function(e){return tg({ev_type:"batch",list:e})};var uB=["init","start","config","beforeDestroy","provide","beforeReport","report","beforeBuild","build","beforeSend","send","beforeConfig"],dB=function(){return{}};function lB(e){return"object"==Ml(e)&&null!==e}var hB=Object.prototype;function fB(e){return!!lB(e)&&("function"!=typeof jl?"[object Object]"===hB.toString.call(e):(e=jl(e))===hB||null===e)}function pB(e){return"[object Array]"===hB.toString.call(e)}function vB(e){return"function"==typeof e}function _B(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function mB(e,t){var r,n=oB({},e);for(r in t)_B(t,r)&&void 0!==t[r]&&(lB(t[r])&&fB(t[r])?n[r]=mB(lB(e[r])?e[r]:{},t[r]):pB(t[r])&&pB(e[r])?n[r]=gB(e[r],t[r]):n[r]=t[r]);return n}function gB(e,t){var r;return e=pB(e)?e:[],t=pB(t)?t:[],sg(r=wm(Array.prototype).call(e,t)).call(r,(function(e){return e instanceof RegExp?e:lB(e)&&fB(e)?mB({},e):pB(e)?gB([],e):e}))}function yB(e,t){if(!pB(e))return!1;if(0===e.length)return!1;for(var r=0;r<e.length;){if(e[r]===t)return!0;r++}return!1}var SB=function(e,t){if(!pB(e))return e;var r=Hb(e).call(e,t);return 0<=r?(t=Sm(e).call(e),vk(t).call(t,r,1),t):e},EB=function(e,t,r){return function(e,t,r){for(var n,i=(t=aB(t.split(".")))[0],o=Sm(t).call(t,1);e&&0<o.length;)e=e[i],i=(n=aB(o))[0],o=Sm(n).call(n,1);if(e)return r(e,i)}(e,t,(function(e,t){if(e&&t in e&&vB(e[t]))try{return e[t].apply(e,r)}catch(n){return}}))};function bB(e){try{return function(e){return"string"==typeof e}(e)?e:tg(e)}catch(t){return"[FAILED_TO_STRINGIFY]:"+String(t)}}var kB=0,TB=function(){for(var e,t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];console.error.apply(console,sB(["[SDK]",Date.now(),nB(e=""+kB++).call(e,8," ")],aB(t),!1))},IB=0,AB=function(){for(var e,t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];console.warn.apply(console,sB(["[SDK]",Date.now(),nB(e=""+IB++).call(e,8," ")],aB(t),!1))},RB=function(e){return function(t){for(var r=t,n=0;n<e.length&&r;n++)try{r=e[n](r)}catch(i){TB(i)}return r}};function wB(){var e=function(){for(var e=new Array(16),t=0,r=0;r<16;r++)0==(3&r)&&(t=4294967296*Math.random()),e[r]=t>>>((3&r)<<3)&255;return e}();return e[6]=15&e[6]|64,e[8]=63&e[8]|128,function(e){for(var t=[],r=0;r<256;++r)t[r]=(r+256).toString(16).substr(1);var n=0,i=t;return[i[e[n++]],i[e[n++]],i[e[n++]],i[e[n++]],"-",i[e[n++]],i[e[n++]],"-",i[e[n++]],i[e[n++]],"-",i[e[n++]],i[e[n++]],"-",i[e[n++]],i[e[n++]],i[e[n++]],i[e[n++]],i[e[14]],i[e[15]]].join("")}(e)}var CB=function e(t,r){var n=PE(r).call(r,(function(e,r){try{var n=r(t);"function"==typeof n&&e.push(n)}catch(i){}return e}),[]);return function(t){return e(t,n)}},OB=function(e){function t(e){n=SB(n,e),o||a()}var r,n=[],i=[],o=!1,a=function(e,t,r){var n=0;return function(){if(e())return n&&clearTimeout(n),void(n=0);0===n&&(n=setTimeout(t,r))}}((function(){return!!n.length}),(function(){o=!0,r&&r[0](),i.forEach((function(e){return e()})),i.length=0,r=void 0}),e=void 0===e?3e5:e);return{next:function(e){return CB(e,n)},complete:function(e){i.push(e)},attach:function(e,t){r=[e,t]},subscribe:function(e){if(o)throw new Error("Observer is closed");return n.push(e),r&&r[1]&&r[1](e),a(),function(){return t(e)}},unsubscribe:t}};var DB=function(e){var t,r,n,i=(t={},r={},n={set:function(e,i){return t[e]=i,r[e]=bB(i),n},merge:function(e){return t=oB(oB({},t),e),an(e).forEach((function(t){r[t]=bB(e[t])})),n},delete:function(e){return delete t[e],delete r[e],n},clear:function(){return t={},r={},n},get:function(e){return r[e]},toString:function(){return oB({},r)}},n);e.provide("context",i),e.on("report",(function(e){return e.extra||(e.extra={}),e.extra.context=i.toString(),e}))},xB=function(e,t,r){function n(){for(var r=[],i=0;i<arguments.length;i++)r[i]=arguments[i];if(c=r[0]){var a=c.split(".")[0];if(a in n)return EB(n,c,Sm([]).call(r,1));var s=o[a]||[],c=null!==(c=null==t?void 0:t(e))&&void 0!==c?c:{};s.push(sB([c],aB(r),!1)),o[a]=s}}var i,o={};for(i in function(e,t,r,n){return void 0===n&&(n=!0),function(){for(var i=[],o=0;o<arguments.length;o++)i[o]=arguments[o];if(!e)return dB;var a=e[t],s=r.apply(void 0,sB([a],aB(i),!1)),c=s;return vB(c)&&n&&(c=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];try{return s.apply(this,e)}catch(r){return vB(a)&&a.apply(this,e)}}),e[t]=c,function(r){r||(c===e[t]?e[t]=a:s=a)}}}(e,"provide",(function(t){return function(r,i){n[r]=i,t.call(e,r,i)}}))(),e)Object.prototype.hasOwnProperty.call(e,i)&&(n[i]=e[i]);return e.on("provide",(function(t){o[t]&&(o[t].forEach((function(t){t=(n=aB(t))[0];var n=Sm(n).call(n,1);null!=r&&r(e,t,n)})),o[t]=null)})),n};function NB(e,t){var r=t||{};e.provide("initSubject",(function(e){var t=(e=aB(e,2))[0];e=e[1];return r[t]||(r[t]=function(t,r){var n=OB();try{t(n.next,n.attach),r&&n.complete(r)}catch(e){}return[n.subscribe,n.unsubscribe]}(e,(function(){r[t]=void 0}))),r[t]})),e.provide("getSubject",(function(e){return r[e]}))}function PB(){if("object"==("undefined"==typeof window?"undefined":Ml(window))&&lB(window))return window}function MB(){var e=function(){if(PB()&&"navigator"in window)return window.navigator}();if(e)return e.connection||e.mozConnection||e.webkitConnection}function LB(){var e=PB()&&PB()&&window.location;return null==e?void 0:e.href}var UB=function(e){var t={url:LB(),timestamp:Date.now()},r=e.config();return null!=r&&r.pid&&(t.pid=r.pid),null!=e&&e.context&&(t.context=e.context.toString()),t};function VB(e){return(null==e?void 0:e.effectiveType)||(null==e?void 0:e.type)||""}var FB=function(e,t,r){var n,i=t.url,o=t.data,a=void 0===(n=t.success)?dB:n,s=void 0===(n=t.fail)?dB:n,c=void 0===(n=t.getResponseText)?dB:n;t=void 0!==(t=t.withCredentials)&&t;(r=new r).withCredentials=t,r.open(e,i,!0),r.setRequestHeader("Content-Type","application/json"),r.onload=function(){null!=c&&c(this.responseText);try{var e;this.responseText?(e=JSON.parse(this.responseText),a(e)):a({})}catch(t){s(t)}},r.onerror=function(){s(new Error("Network request failed"))},r.onabort=function(){s(new Error("Network request aborted"))},r.send(o)},BB=function(){var e=function(){if("function"==typeof XMLHttpRequest&&vB(XMLHttpRequest))return XMLHttpRequest}();return e?{get:function(t){FB("GET",t,e)},post:function(t){FB("POST",t,e)}}:{get:dB,post:dB}};function jB(e){function t(e){n.post(r.getEndpoint(),cB([e]))}var r=function(e){var t=e.transport,r=e.endpoint,n=e.size,i=void 0===n?10:n,o=void 0===(e=e.wait)?1e3:e,a=[],s=0;function c(){a.length&&(t.post({url:r,data:this.getBatchData()}),a=[])}return{getSize:function(){return i},getWait:function(){return o},setSize:function(e){i=e},setWait:function(e){o=e},getEndpoint:function(){return r},setEndpoint:function(e){r=e},send:function(e){a.push(e),a.length>=i&&c.call(this),clearTimeout(s),s=setTimeout(c.bind(this),o)},flush:function(){clearTimeout(s),c.call(this)},getBatchData:function(){return a.length?cB(a):""},clear:function(){clearTimeout(s),a=[]}}}(e),n=function(){var e=PB();return e&&e.navigator.sendBeacon?{get:function(){},post:function(t,r){e.navigator.sendBeacon(t,r)}}:{get:dB,post:dB}}();return function(e){var t=aB(function(e){var t=!1;return[function(r){t||(t=!0,e&&e(r))}]}(e),1)[0];["unload","beforeunload","pagehide"].forEach((function(e){addEventListener(e,t)}))}((function(){var e=r.getBatchData();e&&(n.post(r.getEndpoint(),e),r.clear()),r.send=t})),r}var GB={build:function(e){return{ev_type:e.ev_type,payload:e.payload,common:oB(oB({},e.extra||{}),e.overrides||{})}}};function HB(e){var t,r=e.plugins||{};for(t in r)r[t]&&!lB(r[t])&&(r[t]={});return oB(oB({},e),{plugins:r})}function zB(e){return lB(e)&&"aid"in e}function KB(e){return oB({},e)}var XB="/settings/get/webpro",qB="/monitor_web/collect",WB=[qB,XB,"/monitor_browser/collect"],YB={sample_rate:1,include_users:[],sample_granularity:"session",rules:{}},QB=function(e,t){return void 0===t&&(t=qB),(e&&0<=Hb(e).call(e,"//")?"":"https://")+e+t},JB=function(e,t){return void 0===t&&(t=XB),(e&&0<=Hb(e).call(e,"//")?"":"https://")+e+t},ZB=function(e){return e+"_"+Date.now()},$B=function(e){return"APMPLUS"+e},ej=function(e){return function(e){try{var t=localStorage.getItem(e),r=t;return t&&"string"==typeof t?JSON.parse(t):r}catch(n){return}}(e=$B(e))||{userId:wB(),deviceId:wB(),r:Math.random()}},tj=function(e){var t=e.aid,r=e.userId,n=e.deviceId;e=e.sample;!function(e,t){try{var r="string"==typeof t?t:tg(t);localStorage.setItem(e,r)}catch(n){}}(t=$B(t),{userId:r,deviceId:n,r:e.r})},rj=function(e){var t,r,n,i=e,o={},a=dB,s=dB;return{getConfig:function(){return i},setConfig:function(e){return o=oB(oB({},o),e||{}),c(),t||(t=e,i.useLocalConfig?(n={},a()):r?u():function(e,t,r,n){e.get({withCredentials:!0,url:JB(t)+"?aid="+r,success:function(e){n(e.data||{})},fail:function(){n()}})}(i.transport,i.domain,i.aid,(function(e){r=e,u()}))),i},onChange:function(e){s=e},onReady:function(t){a=function(){e.userId!==i.userId&&(e.sample.r=Math.random(),c()),tj(i),t()},n&&a()}};function c(){var t=oB(oB(oB({},e),n||{}),o);t.plugins=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];for(var r={},n=0;n<e.length;)r=mB(r,e[n++]);return r}(e.plugins,(null==n?void 0:n.plugins)||{},o.plugins||{}),t.sample=nj(nj(e.sample,null==n?void 0:n.sample),o.sample),i=t,s()}function u(){n=function(e){var t;if(!e)return{};var r=e.sample,n=e.timestamp,i=e.status;if(!r)return{};var o=r.sample_rate;return e=r.sample_granularity,{sample:{include_users:r.include_users,sample_rate:i&&4===i?0:o,sample_granularity:e,rules:PE(t=r.rules).call(t,(function(e,t){var r=t.name,n=t.enable,i=t.sample_rate;return t=t.conditional_sample_rules,e[r]={enable:n,sample_rate:i,conditional_sample_rules:t},e}),{})},serverTimestamp:n}}(r),c(),a()}};function nj(e,t){var r;if(!e||!t)return e||t;var n=oB(oB({},e),t);return n.include_users=sB(sB([],aB(e.include_users||[]),!1),aB(t.include_users||[]),!1),n.rules=PE(r=sB(sB([],aB(an(e.rules||{})),!1),aB(an(t.rules||{})),!1)).call(r,(function(r,n){var i;return n in r||(n in(e.rules||{})&&n in(t.rules||{})?(r[n]=oB(oB({},e.rules[n]),t.rules[n]),r[n].conditional_sample_rules=sB(sB([],aB(e.rules[n].conditional_sample_rules||[]),!1),aB(t.rules[n].conditional_sample_rules||[]),!1)):r[n]=(null===(i=e.rules)||void 0===i?void 0:i[n])||(null===(i=t.rules)||void 0===i?void 0:i[n])),r}),{}),n}var ij=function(e){e.on("report",(function(e){return function(e){var t={url:LB(),timestamp:Date.now()};return oB(oB({},e),{extra:oB(oB({},t),e.extra||{})})}(e)}))},oj=function(e){e.on("beforeBuild",(function(t){return function(e,t){var r={};return r.aid=t.aid,r.pid=t.pid,r.view_id=t.viewId,r.user_id=t.userId,oB(oB({},e),{extra:oB(oB({},r),e.extra||{})})}(t,e.config())}))},aj=function(e){e.on("start",(function(){var t,r={did:(t=e.config()).deviceId,sid:t.sessionId,release:t.release,env:t.env,sname:"APM_PLUS_WEB",sversion:"1.7.0",soffset:t.offset||0,biz_id:r=t.aid,x_auth_token:t=t.token};(t=e.getSender()).setEndpoint(t.getEndpoint()+function(e){var t;return lB(e)?PE(t=an(e)).call(t,(function(t,r){return t+"&"+r+"="+e[r]}),"").replace("&","?"):""}(r))}))},sj=function(e){return e=ej(e.aid),{aid:0,pid:"",token:"",viewId:ZB("_"),userId:e.userId,deviceId:e.deviceId,sessionId:wB(),domain:"apmplus.volces.com",plugins:{ajax:{ignoreUrls:WB},fetch:{ignoreUrls:WB},breadcrumb:{},pageview:{},jsError:{},resource:{},resourceError:{},performance:{},tti:{},fmp:{},blankScreen:!1},release:"",env:"production",sample:oB(oB({},YB),{r:e.r}),transport:BB()}};ZF=iB.createMinimalBrowserClient=function(e){var t=(r=void 0===e?{}:e).createSender,r=(e=r.builder,r.createDefaultConfig),n=function(e){var t,r,n=e.builder,i=e.createSender,o=e.createDefaultConfig,a=e.createConfigManager,s=e.userConfigNormalizer,c=e.initConfigNormalizer,u=e.validateInitConfig,d={};uB.forEach((function(e){return d[e]=[]}));var l=!1,h=!1,f=!1,p=[],v=[],_={getBuilder:function(){return n},getSender:function(){return t},getPreStartQueue:function(){return p},init:function(e){if(l)AB("already inited");else{if(!(e&&lB(e)&&u(e)))throw new Error("invalid InitConfig, init failed");var n=o(e);if(!n)throw new Error("defaultConfig missing");if(e=c(e),(r=a(n)).setConfig(e),r.onChange((function(){m("config")})),!(t=i(r.getConfig())))throw new Error("sender missing");m("init",l=!0)}},set:function(e){l&&e&&lB(e)&&(m("beforeConfig",!1,e),null!=r&&r.setConfig(e))},config:function(e){if(l)return e&&lB(e)&&(m("beforeConfig",!1,e),null!=r&&r.setConfig(s(e))),null==r?void 0:r.getConfig()},provide:function(e,t){yB(v,e)?AB("cannot provide "+e+", reserved"):(_[e]=t,m("provide",!1,e))},start:function(){var e=this;l&&(h||null!=r&&r.onReady((function(){m("start",h=!0),p.forEach((function(t){return e.build(t)})),p=[]})))},report:function(e){e&&(!(e=RB(d.beforeReport)(e))||(e=RB(d.report)(e))&&(h?this.build(e):p.push(e)))},build:function(e){!h||(e=RB(d.beforeBuild)(e))&&(!(e=n.build(e))||(e=RB(d.build)(e))&&this.send(e))},send:function(e){!h||(e=RB(d.beforeSend)(e))&&(t.send(e),m("send",!1,e))},destroy:function(){m("beforeDestroy",f=!0)},on:function(e,t){"init"===e&&l||"start"===e&&h||"beforeDestroy"===e&&f?t():d[e]&&d[e].push(t)},off:function(e,t){d[e]&&(d[e]=SB(d[e],t))}};return v=an(_),_;function m(e,t){void 0===t&&(t=!1);for(var r=[],n=2;n<arguments.length;n++)r[n-2]=arguments[n];d[e].forEach((function(e){try{e.apply(void 0,sB([],aB(r),!1))}catch(t){}})),t&&(d[e].length=0)}}({validateInitConfig:zB,initConfigNormalizer:HB,userConfigNormalizer:KB,createSender:void 0===t?function(e){return jB({size:20,endpoint:QB(e.domain),transport:e.transport})}:t,builder:void 0===e?GB:e,createDefaultConfig:void 0===r?sj:r,createConfigManager:rj});return DB(n),r=function(e){if(e)return e.__SLARDAR_REGISTRY__||(e.__SLARDAR_REGISTRY__={Slardar:{plugins:[],errors:[],subject:{}}}),e.__SLARDAR_REGISTRY__.Slardar}(PB()),NB(n,r&&r.subject),function(e){var t,r=!1;e.on("init",(function(){t=(new Date).getTime(),e.on("config",(function(){var n,i=null===(n=e.config())||void 0===n?void 0:n.serverTimestamp;isNaN(i)||Number(i)<=0||r||(r=!0,(n=(new Date).getTime())-t<700&&i&&(n=i-(n+t)/2,!isNaN(n)&&(0<n||n<-6e5)&&e.set({offset:n})))}))}))}(n),oj(n),ij(n),function(e){var t=MB(),r=VB(t);t&&(t.onchange=function(){r=VB(t)}),e.on("report",(function(e){return oB(oB({},e),{extra:oB(oB({},e.extra||{}),{network_type:r})})}))}(n),aj(n),r=xB(n,UB,(function(e,t,r){return function(e,t){return function(r){function n(e){return e.overrides=t,e}e.on("report",n),r(),e.off("report",n)}}(e,t)((function(){var e=(t=aB(r))[0],t=Sm(t).call(t,1);n[e].apply(n,sB([],aB(t),!1))}))})),function(e){e.on("init",(function(){var t=[],r=e.config();r&&r.integrations&&r.integrations.forEach((function(r){yB(t,r.name)||(t.push(r.name),r.setup(e),r.tearDown&&e.on("beforeDestroy",r.tearDown))}))}))}(r),r},iB.getDefaultConfig=sj;var cj={};ad(cj,"__esModule",{value:!0});var uj=function(){return(uj=YE||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var i in t=arguments[r])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)};function dj(e,t){var r="function"==typeof _l&&Ok(e);if(!r)return e;var n,i,o=r.call(e),a=[];try{for(;(void 0===t||0<t--)&&!(n=o.next()).done;)a.push(n.value)}catch(s){i={error:s}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return a}function lj(e,t,r){if(r||2===arguments.length)for(var n,i=0,o=t.length;i<o;i++)!n&&i in t||((n=n||Sm(Array.prototype).call(t,0,i))[i]=t[i]);return wm(e).call(e,n||Sm(Array.prototype).call(t))}var hj=function(){return{}};function fj(e){return"object"==Ml(e)&&null!==e}var pj=Object.prototype;function vj(e){return"function"==typeof e}function _j(e){return"string"==typeof e}function mj(e){return function(e){return"[object Array]"===pj.toString.call(e)}(e)&&e.length?function(e){for(var t=[],r=e.length,n=0;n<r;n++){var i=e[n];_j(i)?t.push(i.replace(/([.*+?^=!:${}()|[\]/\\])/g,"\\$1")):i&&i.source&&t.push(i.source)}return new RegExp(t.join("|"),"i")}(e):null}function gj(e){try{return _j(e)?e:tg(e)}catch(t){return"[FAILED_TO_STRINGIFY]:"+String(t)}}var yj=function(e,t,r,n){return void 0===n&&(n=!0),function(){for(var i=[],o=0;o<arguments.length;o++)i[o]=arguments[o];if(!e)return hj;var a=e[t],s=r.apply(void 0,lj([a],dj(i),!1)),c=s;return vj(c)&&n&&(c=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];try{return s.apply(this,e)}catch(r){return vj(a)&&a.apply(this,e)}}),e[t]=c,function(r){r||(c===e[t]?e[t]=a:s=a)}}};function Sj(){if("object"==("undefined"==typeof window?"undefined":Ml(window))&&fj(window))return window}var Ej=function(e){if(e)return e.__SLARDAR_REGISTRY__||(e.__SLARDAR_REGISTRY__={Slardar:{plugins:[],errors:[],subject:{}}}),e.__SLARDAR_REGISTRY__.Slardar},bj=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=Ej(Sj());r&&(r.errors||(r.errors=[]),r.errors.push(e))};function kj(e,t,r){return function(e,t){return fj(e)?uj(uj({},t),e):!!e&&t}(t=null===(e=e.config())||void 0===e?void 0:e.plugins[t],r)}var Tj=["name","message","stack","filename","lineno","colno"],Ij=function(e){var t;return function(e){switch(Object.prototype.toString.call(e)){case"[object Error]":case"[object Exception]":case"[object DOMError]":case"[object DOMException]":return!0;default:return e instanceof Error}}(e)?t=function(e,t){return e&&fj(e)?PE(t).call(t,(function(t,r){return t[r]=e[r],t}),{}):e}(e,Tj):(function(e){return!!fj(e)&&("function"!=typeof jl?"[object Object]"===pj.toString.call(e):(e=jl(e))===pj||null===e)}(e)||function(e){return"undefined"!=typeof Event&&function(e,t){try{return e instanceof t}catch(r){return!1}}(e,Event)}(e)||_j(e))&&(t={message:gj(e)}),t},Aj=function(e){return Ij(e.error)},Rj=function(e){var t;try{var r=void 0;if("reason"in e?r=e.reason:"detail"in e&&"reason"in e.detail&&(r=e.detail.reason),r){var n=Ij(r);return uj(uj({},n),{name:null!==(t=n&&n.name)&&void 0!==t?t:"UnhandledRejection"})}}catch(i){}},wj=function(e){return(function(e){return"[object ErrorEvent]"===Object.prototype.toString.call(e)}(e)?Aj:function(e){return"[object PromiseRejectionEvent]"===Object.prototype.toString.call(e)}(e)?Rj:Ij)(e)},Cj=["EventTarget","Window","Node","ApplicationCache","ChannelMergerNode","EventSource","FileReader","HTMLUnknownElement","IDBDatabase","IDBRequest","IDBTransaction","MessagePort","Notification","SVGElementInstance","Screen","TextTrack","TextTrackCue","TextTrackList","WebSocket","Worker","XMLHttpRequest","XMLHttpRequestEventTarget","XMLHttpRequestUpload"],Oj=["setTimeout","setInterval","requestAnimationFrame","requestIdleCallback"],Dj=["onload","onerror","onprogress","onreadystatechange"],xj="addEventListener",Nj=function(e,t,r){var n;function i(t,r){if(!vj(t))return t;var n={type:"capture-global",data:uj({},r)},o=t._w_||(t._w_=function(){try{return(t.handleEvent&&vj(t.handleEvent)?t.handleEvent:t).apply(this,sg([]).call(arguments,(function(e){return i(e,r)})))}catch(a){var o=Ij(a);throw o&&e({error:o,source:n}),a}});return o._hook_=!0,o}void 0===t&&(t=Sj()),void 0===r&&(r=function(){if("function"==typeof XMLHttpRequest&&vj(XMLHttpRequest))return XMLHttpRequest}());var o=[];return t&&o.push.apply(o,lj([],dj(sg(n=Gs(Oj).call(Oj,(function(e){return t[e]}))).call(n,(function(e){return yj(t,e,(function(t){return function(r){for(var n=[],o=1;o<arguments.length;o++)n[o-1]=arguments[o];return t&&t.call.apply(t,lj([this,i(r,{function:e})],dj(n),!1))}}),!1)()}))),!1)),r&&r.prototype&&o.push(yj(r.prototype,"send",(function(e){return function(){for(var t,r=this,n=[],a=0;a<arguments.length;a++)n[a]=arguments[a];return o.push.apply(o,lj([],dj(sg(t=Gs(Dj).call(Dj,(function(e){return r[e]&&!r[e]._hook_}))).call(t,(function(e){var t=yj(r,e,(function(t){return i(t,{function:e})}),!1)();return function(){t(),r[e]._hook_=void 0}}))),!1)),e.apply(this,n)}}),!1)()),Cj.forEach((function(e){var r=t[e]&&t[e].prototype;r&&r.addEventListener&&(o.push(yj(r,xj,(function(t){return function(r,n,o){try{var a=n.handleEvent;vj(a)&&(n.handleEvent=i(a,{function:"handleEvent",target:e}))}catch(s){}return t&&t.call(this,r,i(n,{function:xj,target:e}),o)}}),!1)()),o.push(yj(r,"removeEventListener",(function(e){return function(t,r,n){return null!=r&&r._w_&&e.call(this,t,r._w_,n),e.call(this,t,r,n)}}),!1)()))})),o},Pj=function(e,t){return e&&t&&e===t},Mj=function(){var e;return function(t){try{if(function(e,t){return!!(e&&t&&Pj(e.message,t.message)&&Pj(e.stack,t.stack))}(t,e))return void(e=t)}catch(r){bj(r)}return e=t}},Lj=function(e){if(e=void 0===e?Sj():e)return function(t,r){var n,i,o=t.ignoreErrors,a=t.onerror,s=t.onunhandledrejection,c=t.dedupe,u=(t=t.captureGlobalAsync,mj(o)),d=[],l=Mj(),h=function(e){var t=e.error,n=e.extra,i=e.react;e=e.source,t=c?l(t):t;r&&t&&(u&&u.test(t.message)||r({ev_type:"js_error",payload:{error:t,breadcrumbs:[],extra:n,react:i,source:e}}))};return a&&(e.addEventListener("error",n=function(e){return h({error:Aj(e),source:{type:"onerror"}})}),d.push((function(){return e.removeEventListener("error",n)}))),s&&(e.addEventListener("unhandledrejection",i=function(e){return h({error:Rj(e),source:{type:"onunhandledrejection"}})}),d.push((function(){return e.removeEventListener("unhandledrejection",i)}))),t&&d.push.apply(d,lj([],dj(Nj(h)),!1)),[function(e,t,r){return h({error:wj(e),extra:t,react:r,source:{type:"manual"}})},function(){d.forEach((function(e){return e()}))}]}},Uj="jsError",Vj={ignoreErrors:[],onerror:!0,onunhandledrejection:!0,captureGlobalAsync:!1,dedupe:!0};function Fj(e){e.on("init",(function(){window.removeEventListener("error",e.pcErr,!0),window.removeEventListener("unhandledrejection",e.pcRej,!0);var t,r=kj(e,Uj,Vj);r&&(r=(t=dj(function(e,t,r,n){void 0===t&&(t={}),void 0===n&&(n=[]);try{var i=e.apply(void 0,lj([],dj(n),!1));return i&&i(t,r)||[]}catch(o){return bj(o),[]}}(Lj,r,(function(t){e.getBreadcrumbs&&(t.payload.breadcrumbs=e.getBreadcrumbs()),e.report(t)})),2))[0],t=t[1],e.on("beforeDestroy",t),e.provide("captureException",r))}))}var Bj=cj.jsErrorPlugin=function(){return{name:Uj,setup:function(e){Fj(e)}}},jj={};ad(jj,"__esModule",{value:!0});var Gj=function(){return(Gj=YE||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var i in t=arguments[r])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)};function Hj(e,t){var r="function"==typeof _l&&Ok(e);if(!r)return e;var n,i,o=r.call(e),a=[];try{for(;(void 0===t||0<t--)&&!(n=o.next()).done;)a.push(n.value)}catch(s){i={error:s}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return a}function zj(e,t,r){if(r||2===arguments.length)for(var n,i=0,o=t.length;i<o;i++)!n&&i in t||((n=n||Sm(Array.prototype).call(t,0,i))[i]=t[i]);return wm(e).call(e,n||Sm(Array.prototype).call(t))}var Kj=function(){return{}};function Xj(e){return"object"==Ml(e)&&null!==e}function qj(e){return"function"==typeof e}var Wj=function(e,t,r,n){return void 0===n&&(n=!0),function(){for(var i=[],o=0;o<arguments.length;o++)i[o]=arguments[o];if(!e)return Kj;var a=e[t],s=r.apply(void 0,zj([a],Hj(i),!1)),c=s;return qj(c)&&n&&(c=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];try{return s.apply(this,e)}catch(r){return qj(a)&&a.apply(this,e)}}),e[t]=c,function(r){r||(c===e[t]?e[t]=a:s=a)}}};function Yj(){if("object"==("undefined"==typeof window?"undefined":Ml(window))&&Xj(window))return window}var Qj=function(e){if(e)return e.__SLARDAR_REGISTRY__||(e.__SLARDAR_REGISTRY__={Slardar:{plugins:[],errors:[],subject:{}}}),e.__SLARDAR_REGISTRY__.Slardar},Jj=function(e,t,r,n){void 0===t&&(t={}),void 0===n&&(n=[]);try{var i=e.apply(void 0,zj([],Hj(n),!1));return i&&i(t,r)||[]}catch(o){return function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=Qj(Yj());r&&(r.errors||(r.errors=[]),r.errors.push(e))}(o),[]}};function Zj(e){var t,r=function(){if("object"==("undefined"==typeof document?"undefined":Ml(document))&&Xj(document))return document}();return r&&e?((r=r.createElement("a")).href=e,"/"!==(e=r.pathname||"/")[0]&&(e="/"+e),{url:r.href,protocol:Sm(t=r.protocol).call(t,0,-1),domain:r.hostname,query:r.search.substring(1),path:e,hash:r.hash}):{url:e,protocol:"",domain:"",query:"",path:"",hash:""}}function $j(e,t,r){return function(e,t){return Xj(e)?Gj(Gj({},t),e):!!e&&t}(t=null===(e=e.config())||void 0===e?void 0:e.plugins[t],r)}var eG=["hash_0",function(e,t){var r,n=Yj();n&&(n.addEventListener("hashchange",r=function(){return e(location.href)},!0),t((function(){return n.removeEventListener("hashchange",r,!0)})))}],tG=["history_0",function(e,t){var r,n,i,o=Yj()&&window.history;o&&(n=function(){return e(location.href)},(r=[]).push(Wj(o,"pushState",i=function(e){return function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];try{e.apply(o,t)}finally{n()}}})(),Wj(o,"replaceState",i)()),window.addEventListener("popstate",n,!0),r.push((function(){return window.removeEventListener("popstate",n,!0)})),t((function(){r.forEach((function(e){return e()}))})))}],rG=function(e,t){if(void 0===e&&(e=Yj()),void 0===t&&(t=Yj()&&window.location),e&&t)return function(e,r){var n,i,o,a=e.sendInit,s=e.initPid,c=e.routeMode,u=e.extractPid,d=e.onPidUpdate,l=(e=e.createObserver,[]),h="manual"===c?function(){return""}:function(e){return function(t){var r;return"hash"===e?(null===(r=Zj(t).hash)||void 0===r?void 0:r.replace(/^#/,""))||"/":Zj(t).path}}(c),f=u||function(){},p=(s=Hj(function(e,t,r,n){var i=r,o=t;return n&&n(t),[function(t,r,a){"user_set"!==t&&r!==i?(i=r,o=null!=a?a:i,n&&n(o),e(t,o)):"user_set"===t&&r!==o&&(o=r,n&&n(o),e(t,o))},function(){t&&e("init",t)}]}((function(e,t){r&&r({ev_type:"pageview",payload:{pid:t,source:e}})}),s||(n=t.href,null!==(i=f(n))&&void 0!==i?i:h(n)),h(t.href),d),2),s[0]);d=s[1],s=p.bind(null,"user_set");return"manual"!==c&&(o=Hj(function(e,t){var r=t;return[function(t,n){n!==r&&e(t,r=n)}]}((function(e,t){return p(e,h(t),f(t))}),""),1)[0],e=Hj(e(c),1)[0],l.push(e((function(e){return o(c,e)})))),a&&d(),[s,function(){l.forEach((function(e){return e()}))}]}},nG="pageview",iG={sendInit:!0,routeMode:"history"};var oG=jj.pageviewPlugin=function(){return{name:nG,setup:function(e){var t;(t=e).on("init",(function(){var e,r=$j(t,nG,iG);r&&(r=Hj(Jj(rG,Gj(Gj({},r),{initPid:null===(r=t.config())||void 0===r?void 0:r.pid,onPidUpdate:function(e){t.set({pid:e,viewId:e+"_"+Date.now(),actionId:void 0})},createObserver:function(e){return t.initSubject("hash"===e?eG:tG)}}),t.report.bind(t)),2),e=r[0],r=r[1],t.on("config",(function(){e(t.config().pid)})),t.on("beforeDestroy",r),t.provide("sendPageview",e))}))}}};if(!uw()&&!window.__rtc_slardar__){var aG=ZF();aG("init",{aid:432410,token:"d7271e1eac254529abcffc63e36b02c3",integrations:[oG(),Bj(),QF({screenshot:!1})]}),aG("on","beforeSend",(function(e){return"blank_screen"===e.ev_type&&iN.rtcError("blank_screen",0,e),e})),aG("start"),window.__rtc_slardar__=aG}var sG,cG=new(function(){function e(){Wd(this,e)}return qd(e,[{key:"setStats",value:function(e){!uw()&&window.__rtc_slardar__&&an(e).forEach((function(t){window.__rtc_slardar__("context.set",t,e[t])}))}}]),e}()),uG=new RC("RecvFrameObserver",0),dG=function(){function e(t,r){Wd(this,e),sd(this,"_audioEventSessionId",Aw()),sd(this,"_videoEventSessionId",Aw()),sd(this,"_handler",void 0),sd(this,"_stream",void 0),sd(this,"_firstAudioFrameTimer",void 0),sd(this,"_firstVideoFrameTimer",void 0),sd(this,"_transportDelayInterval",void 0),sd(this,"_transportDelay",void 0),sd(this,"_firstVideoFrameInterval",void 0),sd(this,"_firstAudioFrameInterval",void 0),sd(this,"_isScreen",!1),sd(this,"_audioFirstFrameState",0),sd(this,"_videoFirstFrameState",0),sd(this,"_timeout",1e4),sd(this,"_currentAudioRecv",{startTime:0,eventSessionId:0,type:Xx.LOGIN}),sd(this,"_currentVideoRecv",{startTime:0,eventSessionId:0,type:Xx.LOGIN}),sd(this,"_login",!1),sd(this,"_unMuteAudio",!1),sd(this,"_enableAudio",!1),sd(this,"_unMuteVideo",!1),sd(this,"_enableVideo",!1),sd(this,"_remoteUnmuteAudio",!1),sd(this,"_remoteUnmuteVideo",!1),sd(this,"_audioExternal",!1),sd(this,"_pushAudio",!1),sd(this,"_videoExternal",!1),sd(this,"_pushVideo",!1),sd(this,"_autoSubscribeVideo",!1),sd(this,"_autoSubscribeAudio",!1),sd(this,"_autoSubscribe",!1),sd(this,"_publishVideo",!1),sd(this,"_publishAudio",!1),sd(this,"_subscribeAudio",!1),sd(this,"_subscribeVideo",!1),sd(this,"_subscribe",!1),sd(this,"_pushTrack",!1),sd(this,"_multiChatMode",!1),this._stream=t,this._handler=r,this.getTransportDelay()}var t,r,n,i;return qd(e,[{key:"beginRecvFrame",value:(i=km(Em().mark((function e(t,r){var n,i,o,a,s,c,u,d,l,h,f,p,v,_,m,g=this;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.getTransportDelay();case 2:i=this._transportDelay,o=!0,a=Xx.LOGIN,s=Xx.UNMUTE,c=Xx.SUBSCRIBE,u=Xx.PUSH_TRACK,Hb(n=[a,s,c,u]).call(n,r)>=0&&(i=0,o=!1),t===Kx.AUDIO?(o||this._audioEventSessionId++,this._currentAudioRecv={startTime:Date.now(),eventSessionId:this._audioEventSessionId,type:r},f={media_type:t,event_type:zx.BEGIN_RECV,type:r,is_screen:!(null===(d=this._stream)||void 0===d||!d.isScreen),start:null===(l=this._currentAudioRecv)||void 0===l?void 0:l.startTime,event_session_id:this._audioEventSessionId,stream_user_id:null===(h=this._stream)||void 0===h?void 0:h.userId,transport_delay:i},this._firstAudioFrameTimer&&window.clearTimeout(this._firstAudioFrameTimer),this._firstAudioFrameTimer=window.setTimeout((function(){g.stopRecvFrame(Kx.AUDIO,qx.TIMEOUT),g._firstAudioFrameInterval&&window.clearInterval(g._firstAudioFrameInterval)}),this._timeout),uG.print("rtcFirstFrameRecv",tg(f)),iN.rtcFirstFrame(f),this._watchForFirstAudioFrameRecv(),this._audioFirstFrameState=1,this._login=!0,this._unMuteAudio=!0,this._enableAudio=!0,this._remoteUnmuteAudio=!0):t===Kx.VIDEO&&(o||this._videoEventSessionId++,this._currentVideoRecv={startTime:Date.now(),eventSessionId:this._videoEventSessionId,type:r},m={media_type:t,event_type:zx.BEGIN_RECV,type:r,is_screen:!(null===(p=this._stream)||void 0===p||!p.isScreen),start:null===(v=this._currentVideoRecv)||void 0===v?void 0:v.startTime,event_session_id:this._videoEventSessionId,stream_user_id:null===(_=this._stream)||void 0===_?void 0:_.userId,transport_delay:i},this._firstVideoFrameTimer&&window.clearTimeout(this._firstVideoFrameTimer),this._firstVideoFrameTimer=window.setTimeout((function(){g.stopRecvFrame(Kx.VIDEO,qx.TIMEOUT),g._firstVideoFrameInterval&&window.clearInterval(g._firstVideoFrameInterval)}),this._timeout),this._watchForFirstVideoFrameRecv(),uG.print("rtcFirstFrameRecv",tg(m)),iN.rtcFirstFrame(m),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===Kx.AUDIO){var r,n,i,o;if(1!==this._audioFirstFrameState)return;var a={event_type:zx.RECV_END,media_type:e,is_screen:!(null===(r=this._stream)||void 0===r||!r.isScreen),start:null===(n=this._currentAudioRecv)||void 0===n?void 0:n.startTime,reason:t,result:!1,stream_user_id:null===(i=this._stream)||void 0===i?void 0:i.userId,event_session_id:this._audioEventSessionId,type:null===(o=this._currentAudioRecv)||void 0===o?void 0:o.type};this._firstAudioFrameTimer&&window.clearTimeout(this._firstAudioFrameTimer),delete this._currentAudioRecv,uG.print("rtcFirstFrameRecv",tg(a)),iN.rtcFirstFrame(a),this._audioFirstFrameState=2}else if(e===Kx.VIDEO){var s,c,u,d;if(1!==this._videoFirstFrameState)return;var l={event_type:zx.RECV_END,media_type:e,is_screen:!(null===(s=this._stream)||void 0===s||!s.isScreen),start:null===(c=this._currentVideoRecv)||void 0===c?void 0:c.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===(d=this._currentVideoRecv)||void 0===d?void 0:d.type};this._firstVideoFrameTimer&&window.clearTimeout(this._firstVideoFrameTimer),delete this._currentVideoRecv,uG.print("rtcFirstFrameRecv",tg(l)),iN.rtcFirstFrame(l),this._videoFirstFrameState=2}}},{key:"recvFrameFinish",value:(n=km(Em().mark((function e(t){var r,n,i,o,a,s,c,u,d,l,h,f,p,v,_,m,g,y,S;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.getTransportDelay();case 2:if(r=this._transportDelay,n=Xx.LOGIN,i=Xx.UNMUTE,o=Xx.SUBSCRIBE,a=Xx.PUSH_TRACK,t!==Kx.AUDIO){e.next=19;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:d=this._currentAudioRecv,l=d.type,h=d.startTime,Hb(s=[n,i,o,a]).call(s,l)>=0&&(r=0),f={event_type:zx.RECV_END,media_type:t,start:h,result:!0,is_screen:!(null===(c=this._stream)||void 0===c||!c.isScreen),stream_user_id:null===(u=this._stream)||void 0===u?void 0:u.userId,event_session_id:this._audioEventSessionId,type:l,transport_delay:r},delete this._currentAudioRecv,this._firstAudioFrameTimer&&window.clearTimeout(this._firstAudioFrameTimer),uG.print("rtcFirstFrameRecv",tg(f)),iN.rtcFirstFrame(f),this._audioFirstFrameState=3,e.next=32;break;case 19:if(t!==Kx.VIDEO){e.next=32;break}if(1===this._videoFirstFrameState){e.next=22;break}return e.abrupt("return");case 22:if(this._currentVideoRecv){e.next=24;break}return e.abrupt("return");case 24:m=this._currentVideoRecv,g=m.type,y=m.startTime,Hb(p=[n,i,o,a]).call(p,g)>=0&&(r=0),S={event_type:zx.RECV_END,media_type:t,is_screen:!(null===(v=this._stream)||void 0===v||!v.isScreen),start:y,result:!0,stream_user_id:null===(_=this._stream)||void 0===_?void 0:_.userId,event_session_id:this._videoEventSessionId,type:g,transport_delay:r},delete this._currentVideoRecv,this._firstVideoFrameTimer&&window.clearTimeout(this._firstVideoFrameTimer),uG.print("rtcFirstFrameRecv",tg(S)),iN.rtcFirstFrame(S),this._videoFirstFrameState=3;case 32: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(Kx.AUDIO,Xx.LOGIN),e&&null!==(r=this._stream)&&void 0!==r&&r.hasVideo&&o.video&&this.beginRecvFrame(Kx.VIDEO,Xx.LOGIN),!e&&null!==(n=this._stream)&&void 0!==n&&n.hasAudio&&this.stopRecvFrame(Kx.AUDIO,qx.LEAVE_ROOM),!e&&null!==(i=this._stream)&&void 0!==i&&i.hasVideo&&this.stopRecvFrame(Kx.VIDEO,qx.LEAVE_ROOM))}},{key:"setUnmuteAudio",value:function(e){var t,r,n;if(this._unMuteAudio!==e){this._unMuteAudio=e;var i=!(null===(t=this._stream)||void 0===t||!t.hasAudio);null!==(r=this._stream)&&void 0!==r&&r.audioHasCapture&&null!==(n=this._stream)&&void 0!==n&&n.audioHasPublish&&(this._unMuteAudio&&i?this.beginRecvFrame(Kx.AUDIO,Xx.UNMUTE):i&&this.stopRecvFrame(Kx.AUDIO,qx.MUTE))}}},{key:"setRemoteUnmuteAudio",value:function(e){var t;this._remoteUnmuteAudio!==e&&(this._remoteUnmuteAudio=e,this._remoteUnmuteAudio?this.beginRecvFrame(Kx.AUDIO,Xx.REMOTE_UNMUTE):null!==(t=this._stream)&&void 0!==t&&t.hasAudio&&this.stopRecvFrame(Kx.AUDIO,qx.REMOTE_MUTE))}},{key:"setEnableAudio",value:function(e){var t;this._enableAudio!==e&&(this._enableAudio=e,this._enableAudio?this.beginRecvFrame(Kx.AUDIO,Xx.ENABLE):null!==(t=this._stream)&&void 0!==t&&t.hasAudio&&this.stopRecvFrame(Kx.AUDIO,qx.DISABLE))}},{key:"setUnmuteVideo",value:function(e){var t,r,n;if(this._unMuteVideo!==e){this._unMuteVideo=e;var i=!(null===(t=this._stream)||void 0===t||!t.hasVideo);null!==(r=this._stream)&&void 0!==r&&r.videoHasCapture&&null!==(n=this._stream)&&void 0!==n&&n.videoHasPublish&&(this._unMuteVideo&&i?this.beginRecvFrame(Kx.VIDEO,Xx.UNMUTE):i&&this.stopRecvFrame(Kx.VIDEO,qx.MUTE))}}},{key:"setRemoteUnmuteVideo",value:function(e){var t;this._remoteUnmuteVideo!==e&&(this._remoteUnmuteVideo=e,this._remoteUnmuteVideo?this.beginRecvFrame(Kx.VIDEO,Xx.REMOTE_UNMUTE):null!==(t=this._stream)&&void 0!==t&&t.hasAudio&&this.stopRecvFrame(Kx.VIDEO,qx.REMOTE_MUTE))}},{key:"setEnableVideo",value:function(e){this._enableVideo!==e&&(this._enableVideo=e,this._enableVideo?this.beginRecvFrame(Kx.VIDEO,Xx.ENABLE):this.stopRecvFrame(Kx.VIDEO,qx.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(Kx.AUDIO,Xx.PUSH),!e&&null!==(t=this._stream)&&void 0!==t&&t.hasAudio&&this.beginRecvFrame(Kx.AUDIO,Xx.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(Kx.VIDEO,Xx.PUSH),!e&&null!==(t=this._stream)&&void 0!==t&&t.hasVideo&&this.beginRecvFrame(Kx.VIDEO,Xx.PUSH)}},{key:"setPublishVideo",value:function(e){var t;this._publishVideo!==e&&(this._publishVideo=e),this._publishVideo&&this.beginRecvFrame(Kx.VIDEO,Xx.PUBLISH),!e&&null!==(t=this._stream)&&void 0!==t&&t.hasVideo&&this.stopRecvFrame(Kx.VIDEO,qx.UNPUBLISH)}},{key:"setPublishAudio",value:function(e){var t;this._publishAudio!==e&&(this._publishAudio=e),this._publishAudio&&this.beginRecvFrame(Kx.AUDIO,Xx.PUBLISH),!e&&null!==(t=this._stream)&&void 0!==t&&t.hasAudio&&this.stopRecvFrame(Kx.AUDIO,qx.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(Kx.AUDIO,Xx.SUBSCRIBE));!e&&null!==(t=this._stream)&&void 0!==t&&t.hasAudio&&this.stopRecvFrame(Kx.AUDIO,qx.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(Kx.VIDEO,Xx.SUBSCRIBE));!e&&null!==(t=this._stream)&&void 0!==t&&t.hasVideo&&this.stopRecvFrame(Kx.VIDEO,qx.UNSUBSCRIBE)}},{key:"setPushTrack",value:function(e){var t;this._pushTrack!==e&&(e&&!this._isScreen&&this.beginRecvFrame(Kx.AUDIO,Xx.PUSH_TRACK),!e&&null!==(t=this._stream)&&void 0!==t&&t.hasAudio&&this.stopRecvFrame(Kx.AUDIO,qx.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,r=-1;this._firstVideoFrameInterval&&window.clearInterval(this._firstVideoFrameInterval),this._firstVideoFrameInterval=window.setInterval(km(Em().mark((function n(){var i,o,a,s,c,u,d,l;return Em().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(null===(i=e._handler)||void 0===i||!i.pc||null===(o=e._stream)||void 0===o||null===(a=o.videoTrack)||void 0===a||!a.getTrack()){n.next=12;break}return n.next=3,nL(null===(s=e._handler)||void 0===s?void 0:s.pc,null===(c=e._stream)||void 0===c||null===(u=c.videoTrack)||void 0===u?void 0:u.getTrack());case 3:if(d=n.sent,!(l=xb(d).call(d,(function(e){return"inbound-rtp"===e.type})))||!(l.framesReceived>t||l.packetsReceived>r)){n.next=12;break}if(-1!==t||-1!==r){n.next=10;break}return t=l.framesReceived,r=l.packetsReceived,n.abrupt("return");case 10:e.recvFrameFinish(Kx.VIDEO),window.clearInterval(e._firstVideoFrameInterval);case 12:case"end":return n.stop()}}),n)}))),200)}},{key:"_watchForFirstAudioFrameRecv",value:function(){var e=this,t=-1,r=-1;this._firstAudioFrameInterval&&window.clearInterval(this._firstAudioFrameInterval),this._firstAudioFrameInterval=window.setInterval(km(Em().mark((function n(){var i,o,a,s,c,u,d,l;return Em().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(null===(i=e._handler)||void 0===i||!i.pc||null===(o=e._stream)||void 0===o||null===(a=o.audioTrack)||void 0===a||!a.getTrack()){n.next=12;break}return n.next=3,nL(null===(s=e._handler)||void 0===s?void 0:s.pc,null===(c=e._stream)||void 0===c||null===(u=c.audioTrack)||void 0===u?void 0:u.getTrack());case 3:if(d=n.sent,!(l=xb(d).call(d,(function(e){return"inbound-rtp"===e.type})))||!(l.totalSamplesReceived>t||l.packetsReceived>r)){n.next=12;break}if(-1!==t||-1!==r){n.next=10;break}return t=l.totalSamplesReceived,r=l.packetsReceived,n.abrupt("return");case 10:e.recvFrameFinish(Kx.AUDIO),window.clearInterval(e._firstAudioFrameInterval);case 12:case"end":return n.stop()}}),n)}))),200)}},{key:"getTransportDelay",value:(r=km(Em().mark((function e(){var t=this;return Em().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(km(Em().mark((function e(){return Em().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=km(Em().mark((function e(){var t,r,n,i,o;return Em().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,nL(null===(r=this._handler)||void 0===r?void 0:r.pc);case 3:n=e.sent,i=xb(n).call(n,(function(e){return"transport"===e.type&&"connected"===e.dtlsState})),(o=xb(n).call(n,(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:Xx.LOGIN},this._currentVideoRecv={startTime:0,eventSessionId:0,type:Xx.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}(),lG=new RC("SendFrameObserver",0),hG=function(){function e(t,r){Wd(this,e),sd(this,"_audioEventSessionId",Aw()),sd(this,"_videoEventSessionId",Aw()),sd(this,"_pcSessionId",void 0),sd(this,"_handler",void 0),sd(this,"_firstAudioFrameTimer",void 0),sd(this,"_firstVideoFrameTimer",void 0),sd(this,"_stream",void 0),sd(this,"_firstVideoFrameInterval",void 0),sd(this,"_firstAudioFrameInterval",void 0),sd(this,"_currentAudioSend",{startTime:0,eventSessionId:0,type:Xx.LOGIN}),sd(this,"_currentVideoSend",{startTime:0,eventSessionId:0,type:Xx.LOGIN}),sd(this,"_login",!1),sd(this,"_publisher",!1),sd(this,"_unMuteAudio",!1),sd(this,"_enableAudio",!1),sd(this,"_unMuteVideo",!1),sd(this,"_enableVideo",!1),sd(this,"_audioExternal",!1),sd(this,"_pushAudio",!1),sd(this,"_videoExternal",!1),sd(this,"_pushVideo",!1),sd(this,"_autoPublish",!1),sd(this,"_publish",!1),sd(this,"_timeout",1e4),sd(this,"_audioFirstFrameState",0),sd(this,"_videoFirstFrameState",0),this._stream=t,this._handler=r}var t,r;return qd(e,[{key:"beginSendFrame",value:function(e,t){var r=this;if(e===Kx.AUDIO){var n,i;this._audioEventSessionId++,this._currentAudioSend={startTime:Date.now(),eventSessionId:this._audioEventSessionId,type:t};var o={event_type:zx.BEGIN_SEND,media_type:e,is_screen:!(null===(n=this._stream)||void 0===n||!n.isScreen),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(){r.stopSendFrame(Kx.AUDIO,qx.TIMEOUT),r._firstAudioFrameInterval&&window.clearInterval(r._firstAudioFrameInterval)}),this._timeout),lG.print("rtcFirstFrameSend",tg(o)),iN.rtcFirstFrame(o),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===Kx.VIDEO){var a,s;this._videoEventSessionId++,this._currentVideoSend={startTime:Date.now(),eventSessionId:this._videoEventSessionId,type:t};var c={event_type:zx.BEGIN_SEND,media_type:e,is_screen:!(null===(a=this._stream)||void 0===a||!a.isScreen),type:t,start:null===(s=this._currentVideoSend)||void 0===s?void 0:s.startTime,event_session_id:this._videoEventSessionId};this._firstVideoFrameTimer&&window.clearTimeout(this._firstVideoFrameTimer),this._firstVideoFrameTimer=window.setTimeout((function(){r.stopSendFrame(Kx.VIDEO,qx.TIMEOUT),r._firstVideoFrameInterval&&window.clearInterval(r._firstVideoFrameInterval)}),this._timeout),this._watchForFirstVideoFrameSend(),lG.print("rtcFirstFrameSend",tg(c)),iN.rtcFirstFrame(c),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===Kx.AUDIO){var r,n,i;if(1!==this._audioFirstFrameState)return;var o={event_type:zx.SENT_END,media_type:e,is_screen:!(null===(r=this._stream)||void 0===r||!r.isScreen),start:null===(n=this._currentAudioSend)||void 0===n?void 0:n.startTime,reason:t,result:!1,event_session_id:this._audioEventSessionId,type:null===(i=this._currentAudioSend)||void 0===i?void 0:i.type};this._firstAudioFrameTimer&&window.clearTimeout(this._firstAudioFrameTimer),delete this._currentAudioSend,lG.print("rtcFirstFrameSend",tg(o)),iN.rtcFirstFrame(o),this._audioFirstFrameState=2}else if(e===Kx.VIDEO){var a,s,c;if(1!==this._videoFirstFrameState)return;var u={event_type:zx.SENT_END,media_type:e,start:null===(a=this._currentVideoSend)||void 0===a?void 0:a.startTime,is_screen:!(null===(s=this._stream)||void 0===s||!s.isScreen),reason:t,result:!1,event_session_id:this._videoEventSessionId,type:null===(c=this._currentVideoSend)||void 0===c?void 0:c.type};this._firstVideoFrameTimer&&window.clearTimeout(this._firstVideoFrameTimer),delete this._currentVideoSend,lG.print("rtcFirstFrameSend",tg(u)),iN.rtcFirstFrame(u),this._videoFirstFrameState=2}}},{key:"sendFrameFinish",value:function(e){if(e===Kx.AUDIO){var t;if(1!==this._audioFirstFrameState)return;if(!this._currentAudioSend)return;var r=this._currentAudioSend,n=r.type,i=r.startTime,o={event_type:zx.SENT_END,media_type:e,is_screen:!(null===(t=this._stream)||void 0===t||!t.isScreen),start:i,result:!0,event_session_id:this._audioEventSessionId,type:n};delete this._currentAudioSend,this._firstAudioFrameTimer&&window.clearTimeout(this._firstAudioFrameTimer),lG.print("rtcFirstFrameSend",tg(o)),iN.rtcFirstFrame(o),this._audioFirstFrameState=3}else if(e===Kx.VIDEO){var a;if(1!==this._videoFirstFrameState)return;if(!this._currentVideoSend)return;var s=this._currentVideoSend,c=s.type,u=s.startTime,d={event_type:zx.SENT_END,media_type:e,is_screen:!(null===(a=this._stream)||void 0===a||!a.isScreen),start:u,result:!0,event_session_id:this._videoEventSessionId,type:c};delete this._currentVideoSend,this._firstVideoFrameTimer&&window.clearTimeout(this._firstVideoFrameTimer),lG.print("rtcFirstFrameSend",tg(d)),iN.rtcFirstFrame(d),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(Kx.VIDEO,Xx.LOGIN),null!==(r=this._stream)&&void 0!==r&&r.audioTrack&&this.beginSendFrame(Kx.AUDIO,Xx.LOGIN);!e&&this._audioSending&&this.stopSendFrame(Kx.AUDIO,qx.LEAVE_ROOM),!e&&this._videoSending&&this.stopSendFrame(Kx.VIDEO,qx.LEAVE_ROOM)}}},{key:"setPublish",value:function(e){if(this._publish!==e){var t,r,n,i;if(this._publish=e,e)(null===(t=this._stream)||void 0===t?void 0:t.videoTrack)&&(null===(r=this._stream)||void 0===r?void 0:r.pubVideo)&&this.beginSendFrame(Kx.VIDEO,Xx.PUBLISH),(null===(n=this._stream)||void 0===n?void 0:n.audioTrack)&&(null===(i=this._stream)||void 0===i?void 0:i.pubAudio)&&this.beginSendFrame(Kx.AUDIO,Xx.PUBLISH);!e&&this._audioSending&&this.stopSendFrame(Kx.AUDIO,qx.UNPUBLISH),!e&&this._videoSending&&this.stopSendFrame(Kx.VIDEO,qx.UNPUBLISH)}}},{key:"setUnmuteAudio",value:function(e){var t;this._unMuteAudio!==e&&(this._unMuteAudio=e,null!==(t=this._stream)&&void 0!==t&&t.audioHasCapture&&(e&&this.beginSendFrame(Kx.AUDIO,Xx.UNMUTE),!e&&this._audioSending&&this.stopSendFrame(Kx.AUDIO,qx.MUTE)))}},{key:"setEnableAudio",value:function(e){var t;this._enableAudio!==e&&null!==(t=this._stream)&&void 0!==t&&t.pubAudio&&(this._enableAudio=e,e&&this.beginSendFrame(Kx.AUDIO,Xx.ENABLE),!e&&this._audioSending&&this.stopSendFrame(Kx.AUDIO,qx.DISABLE))}},{key:"setUnmuteVideo",value:function(e){var t;this._unMuteVideo!==e&&(this._unMuteVideo=e,null!==(t=this._stream)&&void 0!==t&&t.videoHasCapture&&(e&&this.beginSendFrame(Kx.VIDEO,Xx.UNMUTE),!e&&this._videoSending&&this.stopSendFrame(Kx.VIDEO,qx.MUTE)))}},{key:"setEnableVideo",value:function(e){var t;this._enableVideo!==e&&null!==(t=this._stream)&&void 0!==t&&t.pubVideo&&(this._enableVideo=e,e&&this.beginSendFrame(Kx.VIDEO,Xx.ENABLE),!e&&this._videoSending&&this.stopSendFrame(Kx.VIDEO,qx.DISABLE))}},{key:"setExternalAudioSource",value:function(e){this._audioExternal!==e&&(this._audioExternal=e,e&&(this._audioSending&&this.stopSendFrame(Kx.AUDIO,qx.DISABLE),this._enableAudio=!1),e||(this._audioSending&&this.stopSendFrame(Kx.AUDIO,qx.STOP_PUSH),this._pushAudio=!1))}},{key:"setPushAudio",value:function(e){this._pushAudio!==e&&(this._pushAudio=e,e&&this.beginSendFrame(Kx.AUDIO,Xx.PUSH),!e&&this._audioSending&&this.stopSendFrame(Kx.AUDIO,qx.STOP_PUSH))}},{key:"setExternalVideoSource",value:function(e){this._videoExternal!==e&&(this._videoExternal=e,e&&(this._videoSending&&this.stopSendFrame(Kx.VIDEO,qx.DISABLE),this._enableVideo=!1),e||(this._videoSending&&this.stopSendFrame(Kx.VIDEO,qx.STOP_PUSH),this._pushVideo=!1))}},{key:"setPushVideo",value:function(e){this._pushVideo!==e&&(this._pushVideo=e,e&&this.beginSendFrame(Kx.VIDEO,Xx.PUSH),!e&&this._videoSending&&this.stopSendFrame(Kx.VIDEO,qx.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(Kx.AUDIO,qx.AUDIENCE),!e&&this._videoSending&&this.stopSendFrame(Kx.VIDEO,qx.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=km(Em().mark((function e(){var t,r,n,i,o,a,s;return Em().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("preprocessing")){e.next=5;break}return e.next=3,nL(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("preprocessing"));case 3:return s=e.sent,e.abrupt("return",xb(s).call(s,(function(e){return"outbound-rtp"===e.type})));case 5:case"end":return e.stop()}}),e,this)}))),function(){return r.apply(this,arguments)})},{key:"_getFirstAudioFrameStats",value:(t=km(Em().mark((function e(){var t,r,n,i,o,a,s;return Em().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("preprocessing")){e.next=5;break}return e.next=3,nL(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("preprocessing"));case 3:return s=e.sent,e.abrupt("return",xb(s).call(s,(function(e){return"outbound-rtp"===e.type})));case 5:case"end":return e.stop()}}),e,this)}))),function(){return t.apply(this,arguments)})},{key:"_watchForFirstVideoFrameSend",value:function(){var e=this,t=-1,r=-1;this._firstVideoFrameInterval&&window.clearInterval(this._firstVideoFrameInterval),this._firstVideoFrameInterval=window.setInterval(km(Em().mark((function n(){var i;return Em().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,e._getFirstVideoFrameStats();case 2:if(!(i=n.sent)||!(i.framesSent>t||i.packetsSent>r)){n.next=10;break}if(-1!==t||-1!==r){n.next=8;break}return t=i.framesSent,r=i.packetsSent,n.abrupt("return");case 8:e.sendFrameFinish(Kx.VIDEO),window.clearInterval(e._firstVideoFrameInterval);case 10:case"end":return n.stop()}}),n)}))),100)}},{key:"_watchForFirstAudioFrameSend",value:function(){var e=this,t=-1;this._firstAudioFrameInterval&&window.clearInterval(this._firstAudioFrameInterval),this._firstAudioFrameInterval=window.setInterval(km(Em().mark((function r(){var n;return Em().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(Kx.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:Xx.LOGIN},this._currentVideoSend={startTime:0,eventSessionId:0,type:Xx.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}(),fG=(sd(sG={},"audio",{delay:1200,stallRadio:.3}),sd(sG,"video",{delay:1200,stallRadio:.6}),sd(sG,"screen_audio",{delay:1600,stallRadio:.8}),sd(sG,"screen_video",{delay:1600,stallRadio:.8}),sG),pG=function(){function e(){Wd(this,e),sd(this,"_preUplinkStats",new yE),sd(this,"_preDownlinkStats",new yE),sd(this,"_timer",void 0),sd(this,"_delayTimer",void 0),sd(this,"_connectionState",_F.CONNECTED),sd(this,"reportor",void 0)}return qd(e,[{key:"updateUplinkStats",value:function(e){var t=e.audioStats,r=e.videoStats,n=e.isScreen;if(t.sendKBitrate>0&&t.rtt){var i,o,a=n?"screen_audio":"audio",s=t.rtt,c=t._fractionLost,u=t._retransmittedRate,d=this._getQosLevel(s,c||0,u||0),l=this._preUplinkStats.get(a)||[d];this._preUplinkStats.set(a,Sm(i=wm(o=[]).call(o,Wk(l),[d])).call(i,-2))}if(r.sentKBitrate>0&&r.rtt){var h,f,p=n?"screen_video":"video",v=r._fractionLost,_=r.rtt,m=r._sendBandWidth,g=r._retransmittedRate;0===m&&(v=Math.max(.65,v));var y=this._getQosLevel(_,v||0,g||0),S=this._preUplinkStats.get(p)||[y];this._preUplinkStats.set(p,Sm(h=wm(f=[]).call(f,Wk(S),[y])).call(h,-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,c=e.videoStats,u=e.isScreen,d=e.userId;if(o)if(0===s.receivedKBitrate)r=Od.VBAD;else{var l=s.rtt,h=s.audioLossRate,f=s.stallDuration,p=s.statsInterval,v=s.e2eDelay,_=f/p,m=u?"screen_audio":"audio",g=this._getQosLevel(l,h||0,c._retransmittedRate||0),y=this._getDownlinkQoE(m,_,v);r=this._getNetworkQuality(g,y)}if(a)if(0===c.receivedKBitrate||0===c.rtt)n=Od.VBAD;else{var S=c.rtt,E=c.videoLossRate,b=c.stallDuration,k=c.statsInterval,T=c.e2eDelay,I=c._retransmittedRate,A=b/k,R=u?"screen_video":"video",w=this._getQosLevel(S,E||0,I||0),C=this._getDownlinkQoE(R,A,T);n=this._getNetworkQuality(w,C)}var O=r&&n?Math.ceil((r+n)/2):r||n;if(O){var D,x,N,P=wm(D="".concat(d)).call(D,u?"_screen":""),M=this._preDownlinkStats.get(P)||[O];this._preDownlinkStats.set(P,Sm(x=wm(N=[]).call(N,Wk(M),[O])).call(x,-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!==_F.CONNECTED)e=t=Od.VBAD;else{var n,i,o,a=this._getBetterQualityAndRemoveOldest("audio","up"),s=this._getBetterQualityAndRemoveOldest("video","up");e=a&&s?Math.ceil((a+s)/2):a||s||this._getBetterQualityAndRemoveOldest("screen_video","up")||this._getBetterQualityAndRemoveOldest("screen_audio","up")||Od.EXCELLENT;var c=Gs(n=sg(i=Xk(yC(o=this._preDownlinkStats).call(o))).call(i,(function(e){return r._getBetterQualityAndRemoveOldest(e,"down")}))).call(n,(function(e){return e}));t=Math.ceil(PE(c).call(c,(function(e,t){return t+e}),0)/c.length)||Od.UNKNOWN}"function"==typeof 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||e<=250)&&t<=.15?1:(!e||e<=500)&&t<=.3?2:(!e||e<=750)&&t<=.45?3:(!e||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=fG[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=Od.UNKNOWN,n="up"===t?this._preUplinkStats:this._preDownlinkStats,i=n.get(e);if(i){var o=Gs(i).call(i,(function(e){return e}));o.length>0&&(r=Math.min.apply(Math,Wk(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&&xw(t)&&r.localaudio&&r.audiostream,videoActive:n&&Nw(t)&&r.localvideo&&r.videostream}}}]),e}(),vG=function(){function e(t){Wd(this,e),sd(this,"_timer",void 0),sd(this,"_remoteVideoSizeCache",{}),sd(this,"_remoteScreenSizeCache",{}),sd(this,"onchange",void 0),this._room=t,this._start()}return qd(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,c=s[i]||{},u=c.width,d=void 0===u?0:u,l=c.height,h=void 0===l?0:l,f=a.getSettings(),p=f.width,v=void 0===p?0:p,_=f.height,m=void 0===_?0:_;h===m&&d===v||"function"==typeof e.onchange&&e.onchange(i,n.isScreen,v,m),delete s[i],(n.isScreen?r:t)[i]={width:v,height:m}}}))})),an(e._remoteVideoSizeCache).forEach((function(t){"function"==typeof e.onchange&&e.onchange(t,!1,0,0)})),an(e._remoteScreenSizeCache).forEach((function(t){"function"==typeof e.onchange&&e.onchange(t,!0,0,0)})),e._remoteVideoSizeCache=t,e._remoteScreenSizeCache=r}),1e3))}}]),e}(),_G=Xk((new TextEncoder).encode("subt")),mG={1:uR.SUBTITLE_ERR_POSTPROCESS,2:uR.SUBTITLE_ERR_CONNECTION_ERROR,3:uR.SUBTITLE_ERR_PROCESS_ERROR},gG=new RC("SubtitleTool",1),yG=function(e){if(e.extraInfo)try{var t,r=JSON.parse(e.extraInfo);r.source_language&&Hb(t=["zh","en","ja"]).call(t,r.source_language)}catch(a){}else{var n,i,o=(null===(n=navigator.language)||void 0===n?void 0:n.substring(0,2))||"";Hb(i=["zh","en","ja"]).call(i,o)>-1&&(e.extraInfo=tg({source_language:o}))}},SG=function(){function e(t){var r,n,i;Wd(this,e),sd(this,"_taskId",void 0),sd(this,"_appId",void 0),sd(this,"_roomId",void 0),sd(this,"_userId",void 0),sd(this,"onEvent",void 0),sd(this,"onMessage",void 0),sd(this,"_preConfig",void 0),sd(this,"_timer",void 0),this._room=t,this._appId=null===(r=this._room._roomInfo)||void 0===r?void 0:r.appId,this._roomId=null===(n=this._room._roomInfo)||void 0===n?void 0:n.roomId,this._userId=null===(i=this._room._roomInfo)||void 0===i?void 0:i.userInfo.userId}var t,r,n;return qd(e,[{key:"start",value:(n=km(Em().mark((function e(t){var r=this;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(gG.print("start","Invoke config: %o",t),Kw(t.mode,"mode",[Ud.ASR_ONLY,Ud.ASR_AND_TRANSLATION]),t.mode!==Ud.ASR_AND_TRANSLATION||-1!==Hb(bG).call(bG,t.targetLanguage||"")){e.next=4;break}throw new lR(uR.INVALID_PARAMS,"Invalid targetLanguage.");case 4:if(!this._taskId){e.next=6;break}throw new lR(uR.SUBTITLE_ALREADY_ON,"Already turned on subtitle");case 6:return this._preConfig=t,this._taskId=(Date.now().toString()+this._roomId+this._userId).substring(0,20),e.next=10,this._room.subtitleControlMessage(this._genSubtitleSignaling("started",t,this._taskId));case 10:this._preConfig=t,this._timer=self.setTimeout((function(){var e;null===(e=r.onEvent)||void 0===e||e.call(r,{event:Vd.ERROR,errorCode:uR.TIME_OUT,errorMessage:"start subtitle timeout."}),delete r._timer,r.stop()}),3e4);case 12:case"end":return e.stop()}}),e,this)}))),function(e){return n.apply(this,arguments)})},{key:"update",value:(r=km(Em().mark((function e(t){var r;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(Kw(t.mode,"mode",[Ud.ASR_ONLY,Ud.ASR_AND_TRANSLATION]),t.mode!==Ud.ASR_AND_TRANSLATION||-1!==Hb(bG).call(bG,t.targetLanguage||"")){e.next=3;break}throw new lR(uR.INVALID_PARAMS,"Invalid targetLanguage.");case 3:if(!this._taskId){e.next=5;break}throw new lR(uR.SUBTITLE_ALREADY_ON,"Already started subtitle");case 5:if(this._taskId){e.next=7;break}throw new lR(uR.SUBTITLE_NOT_TURNED_ON,"Start subtitle first.");case 7:if((null===(r=this._preConfig)||void 0===r?void 0:r.mode)===t.mode&&this._preConfig.targetLanguage===t.targetLanguage){e.next=11;break}return this._preConfig=t,e.next=11,this._room.subtitleControlMessage(this._genSubtitleSignaling("update",t,this._taskId));case 11:case"end":return e.stop()}}),e,this)}))),function(e){return r.apply(this,arguments)})},{key:"stop",value:function(){var e=this;gG.print("stop","Invoke"),this._taskId&&this._room.subtitleControlMessage({type:"subtitle",action:"stopped",appId:this._appId,roomId:this._roomId,userId:this._userId,taskId:this._taskId}).finally((function(){var t;delete e._taskId,null===(t=e.onEvent)||void 0===t||t.call(e,{event:Vd.STOPPED}),e._clearTimer()}))}},{key:"reconnect",value:(t=km(Em().mark((function e(){return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this._taskId||!this._preConfig){e.next=5;break}return e.next=3,this._room.subtitleControlMessage({type:"subtitle",action:"stopped",appId:this._appId,roomId:this._roomId,userId:this._userId,taskId:this._taskId});case 3:delete this._taskId,this.start(this._preConfig);case 5:case"end":return e.stop()}}),e,this)}))),function(){return t.apply(this,arguments)})},{key:"getConfig",value:function(){return this._preConfig}},{key:"destroy",value:function(){gG.print("destroy","Invoke"),this.stop(),delete this._preConfig,delete this._taskId}},{key:"onResult",value:function(e){var t=e.body,r=t.error,n=t.errorMessage,i=t.eventType;if(0!==r){var o,a=new lR(mG[r]||uR.SUBTITLE_ERR_UNKNOWN,n||"");null===(o=this.onEvent)||void 0===o||o.call(this,{event:Vd.ERROR,errorCode:a.code,errorMessage:a.message}),this._clearTimer()}else if("SubtitleStarted"===i){var s;null===(s=this.onEvent)||void 0===s||s.call(this,{event:Vd.STARTED}),this._clearTimer()}}},{key:"onMessageRecv",value:function(e){if(this._taskId&&this._preConfig){var t=EG(e);if(t&&t.length>0){var r,n=this._preConfig,i=n.mode,o=n.targetLanguage,a=[];if(t.forEach((function(e){i===Ud.ASR_ONLY?e.mode===i&&a.push(e):i===Ud.ASR_AND_TRANSLATION&&(e.language!==o&&e.mode!==Ud.ASR_ONLY||a.push(e),e.mode===Ud.ASR_ONLY&&e.language===o&&a.push(ud(ud({},e),{},{mode:Ud.ASR_AND_TRANSLATION})))})),a.length>0)null===(r=this.onMessage)||void 0===r||r.call(this,a)}return!!t}return!1}},{key:"_genSubtitleSignaling",value:function(e,t,r){return{taskId:r,type:"subtitle",action:e,roomId:this._roomId,appId:this._appId,userId:this._userId,subtitleMeta:{subtitleConfig:{mode:t.mode,usersConfig:[{userId:this._userId,targetLanguages:[t.targetLanguage||""]}]},vendorConfig:{type:0}}}}},{key:"_clearTimer",value:function(){this._timer&&(self.clearTimeout(this._timer),delete this._timer)}}]),e}(),EG=function(e){var t=e.message;if(t instanceof ArrayBuffer&&t.byteLength>8)try{var r=new DataView(t,0),n=0;if(_G.every((function(e){return r.getUint8(n++)===e}))){var i=r.getUint32(n);if(n+=4,i===r.byteLength-8){var o=dw.ab2str(Sm(t).call(t,8)),a=JSON.parse(o),s=a.data;if("subtitle"===a.type)return s}}}catch(c){}return!1},bG=["zh","zh-Hant","tn","vi","iu","it","id","hi","en","ho","he","es","el","uk","ur","tk","tr","ti","ty","tl","to","th","ta","te","sl","sk","ss","eo","sm","sg","st","sv","ja","tw","qu","pt","pa","no","nb","nr","my","bn","mn","mh","mk","ml","mr","ms","lu","ro","lt","lv","lo","kj","hr","kn","ki","cs","ca","nl","ko","ht","gu","ka","kl","km","lg","kg","fi","fj","fr","ru","ng","de","tt","da","ts","cv","fa","bs","pl","bi","nd","ba","bg","az","ar","af","sq","ab","os","ee","et","ay","lzh","am","ckb","cy","gl","ha","hy","ig","kmr","ln","nso","ny","om","sn","so","sr","sw","xh","yo","zu"],kG=new RC("Room",1),TG={audiostream:!0,extaudio:!1,extvideo:!1,localaudio:!0,localvideo:!1,videoDescriptions:[],videostream:!1},IG=function(e){OI(I,e);var t,r,n,i,o,a,s,c,u,d,l,h,f,p,v,_,m,g,y,S,E,b,k,T=qI(I);function I(e,t){var r;return Wd(this,I),sd(ZT(r=T.call(this)),"id",void 0),sd(ZT(r),"_mediaServerClient",void 0),sd(ZT(r),"_localStream",void 0),sd(ZT(r),"_localScreenStream",void 0),sd(ZT(r),"_remoteUsers",new yE),sd(ZT(r),"_remoteStreams",new yE),sd(ZT(r),"_remoteStreamStreamIdUserIdMap",{}),sd(ZT(r),"_virtualStreams",[]),sd(ZT(r),"_joinResolveCallback",void 0),sd(ZT(r),"_joinRejectCallback",void 0),sd(ZT(r),"_getAccessNode",void 0),sd(ZT(r),"_getAccessFeedback",void 0),sd(ZT(r),"_getAccessFeedbackIceNode",void 0),sd(ZT(r),"_reconnectTimer",void 0),sd(ZT(r),"_isReconnecting",void 0),sd(ZT(r),"_context",void 0),sd(ZT(r),"_sessionId",void 0),sd(ZT(r),"_reconnectRecord",void 0),sd(ZT(r),"_connectionLostTimer",void 0),sd(ZT(r),"_liveControlMessage",void 0),sd(ZT(r),"_serverConfig",void 0),sd(ZT(r),"_liveTranscodingOnceSucc",!1),sd(ZT(r),"_roomConfig",void 0),sd(ZT(r),"_roomInfo",void 0),sd(ZT(r),"_waitForNewToken",!1),sd(ZT(r),"_userDuplicateLoginTimerMap",new yE),sd(ZT(r),"_networkQualityManager",void 0),sd(ZT(r),"_videoSizeObserver",void 0),sd(ZT(r),"_hasPublished",!1),sd(ZT(r),"_subtitleTool",void 0),sd(ZT(r),"_csrcUserIdMap",void 0),sd(ZT(r),"_publishOnDemandItem",void 0),sd(ZT(r),"_publishOnDemandBusy",!1),r.id=null==t?void 0:t.id,r._roomConfig=e,r._mediaServerClient=new gF(t),r._reconnectRecord=new AG,r._addHandlerEventHandler(),r._isReconnecting=!1,r._networkQualityManager=new pG,r._networkQualityManager.reportor=r._reportNetworkQuality.bind(ZT(r)),r._videoSizeObserver=new vG(ZT(r)),r._videoSizeObserver.onchange=r._emitVideoSizeChange.bind(ZT(r)),r._context=t,r._csrcUserIdMap={},r}return qd(I,[{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,c,u,d,l,h,f,p,v,_,m,g,y,S,E,b,k,T,I,A,R,w,C,O=this;null===(e=this._mediaServerClient)||void 0===e||e.on(FN.ON_ADD_STREAM,this._onAddStream.bind(this)),null===(t=this._mediaServerClient)||void 0===t||t.on(FN.ON_ADD_STREAM_LIST,(function(e){Array.isArray(null==e?void 0:e.streamList)&&e.streamList.forEach((function(e){return O._onAddStream(e)}))})),null===(r=this._mediaServerClient)||void 0===r||r.on(FN.ON_REMOVE_STREAM,this._onRemoveStream.bind(this)),null===(n=this._mediaServerClient)||void 0===n||n.on(FN.ON_REMOVE_STREAM_LIST,(function(e){Array.isArray(null==e?void 0:e.streamList)&&e.streamList.forEach((function(e){return O._onRemoveStream(e)}))})),null===(i=this._mediaServerClient)||void 0===i||i.on(FN.USER_CONNECTION,this._onUserConnection.bind(this)),null===(o=this._mediaServerClient)||void 0===o||o.on(FN.USER_CONNECTION_LIST,(function(e){Array.isArray(null==e?void 0:e.userList)&&e.userList.forEach((function(e){return O._onUserConnection(e)}))})),null===(a=this._mediaServerClient)||void 0===a||a.on(FN.USER_DISCONNECTION,this._onUserDisconnection.bind(this)),null===(s=this._mediaServerClient)||void 0===s||s.on(FN.USER_DISCONNECTION_LIST,(function(e){Array.isArray(null==e?void 0:e.userList)&&e.userList.forEach((function(e){return O._onUserDisconnection(e)}))})),null===(c=this._mediaServerClient)||void 0===c||c.on(FN.ON_UPDATE_ROOM_ATTRIBUTES,this._onUpdateRoomAttributes.bind(this)),null===(u=this._mediaServerClient)||void 0===u||u.on(FN.ON_UPDATE_USER_ATTRIBUTES,this._onUpdateUserAttributes.bind(this)),null===(d=this._mediaServerClient)||void 0===d||d.on(FN.ON_UPDATE_STREAM_ATTRIBUTES,this._onUpdateStreamAttributes.bind(this)),null===(l=this._mediaServerClient)||void 0===l||l.on(FN.ON_PUSH_TRACK,this._onPushTrack.bind(this)),null===(h=this._mediaServerClient)||void 0===h||h.on(FN.ON_REMOVE_TRACK,this._onRemoveTrack.bind(this)),null===(f=this._mediaServerClient)||void 0===f||f.on(FN.NODE_CHANGE,this._nodeChange.bind(this)),null===(p=this._mediaServerClient)||void 0===p||p.on(FN.ON_CUSTOM_MESSAGE,this._onCustomMessage.bind(this)),null===(v=this._mediaServerClient)||void 0===v||v.on(FN.USER_MESSAGE_RECEIVED,this._onUserMessageReceived.bind(this)),null===(_=this._mediaServerClient)||void 0===_||_.on(FN.USER_BINARY_MESSAGE_RECEIVED,this._onUserBinaryMessageReceived.bind(this)),null===(m=this._mediaServerClient)||void 0===m||m.on(FN.POST_PROCESSING_MESSAGE,this._onPostProcessingMessage.bind(this)),null===(g=this._mediaServerClient)||void 0===g||g.on(FN.ON_USER_TOKEN_WILL_EXPIRE,this._onUserTokenWillExpire.bind(this)),null===(y=this._mediaServerClient)||void 0===y||y.on(FN.STREAM_CONTROL_MESSAGE,this._onStreamControlMessage.bind(this)),null===(S=this._mediaServerClient)||void 0===S||S.on(FN.ON_STREAM_FAILED,this._onStreamFailed.bind(this)),null===(E=this._mediaServerClient)||void 0===E||E.on(BN.RSCP,(function(e){!!xb(e).call(e,(function(e){var t,r,n;return null==e||null===(t=e.StreamIds)||void 0===t?void 0:Jm(t).call(t,null===(r=O._localStream)||void 0===r||null===(n=r.stream)||void 0===n?void 0:n.id)}))&&(O._publishOnDemandItem=e,O._onPublishOnDemand())})),null===(b=this._mediaServerClient)||void 0===b||b.on(BN.RTT,this._onRTT.bind(this)),null===(k=this._mediaServerClient)||void 0===k||k.on(jN.ON_CONNECTION_STATE_CHANGE,this._onConnectionStateChange.bind(this)),null===(T=this._mediaServerClient)||void 0===T||T.on(jN.ABNORMAL_DISCONNECTION,this._handleAbnormalDisconnection.bind(this)),null===(I=this._mediaServerClient)||void 0===I||I.on(FN.ON_SPEAKER_CHANGE,this._onMeetingSpeakerChange.bind(this)),null===(A=this._mediaServerClient)||void 0===A||A.on("onRemoteStreamStats",(function(e){O._networkQualityManager.updateDownlinkStats(e,O._findRemoteStreamByScreen(e.userId,e.isScreen)),O.emit(aF.ON_REMOTE_STREAM_STATS,Pw(e))})),null===(R=this._mediaServerClient)||void 0===R||R.on("onLocalStreamStats",(function(e){O._networkQualityManager.updateUplinkStats(e),O.emit(aF.ON_LOCAL_STREAM_STATS,Pw(e))})),null===(w=this._mediaServerClient)||void 0===w||w.on("prevIceNode",(function(e){O._getAccessFeedbackIceNode=e})),null===(C=this._mediaServerClient)||void 0===C||C.on("prevIceNode",(function(e){O._getAccessFeedbackIceNode=e}))}},{key:"_removeHandlerEventHandler",value:function(){var e;null===(e=this._mediaServerClient)||void 0===e||e.removeAllListeners()}},{key:"join",value:(k=km(Em().mark((function e(t,r,n,i,o,a,s){var c=this;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return sN.setStats({rtc_app_id:t,room_id:r,user_id:i.userId}),cG.setStats({rtc_session_id:t,rtc_room_id:r}),kG.print("join()"),e.abrupt("return",new X_((function(e,u){var d,l,h=sw();c._joinResolveCallback=function(t){var r;iN.joinRoom(Yx.END,h,!0,"",{enable_cloud_proxy:null===(r=c._roomInfo)||void 0===r?void 0:r.useCloudProxy}),c._initSubtitleTool(),e(t)},c._joinRejectCallback=function(e){var t;Array.isArray(e)&&e.length&&(e=e[0]),iN.joinRoom(Yx.END,h,!1,e.message,{enable_cloud_proxy:null===(t=c._roomInfo)||void 0===t?void 0:t.useCloudProxy}),u(e)},c._liveControlMessage=o,c._roomInfo={appId:t,roomId:r,token:n,userInfo:i,useCloudProxy:a,roomProfile:c._roomConfig.roomProfileType,expectedIDC:s},c.setSessionId(),iN.joinRoom(Yx.BEGIN,h,!1,"",{enable_cloud_proxy:null===(d=c._roomInfo)||void 0===d?void 0:d.useCloudProxy,expectedIDC:null===(l=c._roomInfo)||void 0===l?void 0:l.expectedIDC}),c._join(c._joinResolveCallback,c._joinRejectCallback,!1)})));case 4:case"end":return e.stop()}}),e)}))),function(e,t,r,n,i,o,a){return k.apply(this,arguments)})},{key:"_join",value:(b=km(Em().mark((function e(t,r){var n,i,o,a,s=arguments;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=s.length>2&&void 0!==s[2]&&s[2],i=sw(),kG.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:a=e.sent,this._mediaServerClient.roomAttributes=a.roomAttributes,null!==(o=a.roomAttributes)&&void 0!==o&&o.multiChatMode&&this._handleFFAudioTrack(),this._reconnectRecord.clear(),this._joinResolveCallback=void 0,this._joinRejectCallback=void 0,this._getAccessFeedback=void 0,this._getAccessNode=void 0,"function"==typeof t&&t({users:a.clients,streams:a.streams}),this._isReconnecting=!1,iN.rtcJoinRoom(0,"web","web",sw()-i),this._onJoinSucc(a,n),e.next=26;break;case 20:if(e.prev=20,e.t0=e.catch(3),this._getAccessFeedback=void 0,this._getAccessNode=void 0,e.t0.code===uR.OPERATION_CANCEL||"function"!=typeof r){e.next=26;break}return e.abrupt("return",r(e.t0));case 26:case"end":return e.stop()}}),e,this,[[3,20]])}))),function(e,t){return b.apply(this,arguments)})},{key:"publishScreen",value:(E=km(Em().mark((function e(t,r,n,i,o){var a,s,c,u,d,l,h,f,p,v;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(kG.print("publishScreen()"),this._localScreenStream||(this._localScreenStream=new HV,this._localScreenStream.isScreen=!0,this._mediaServerClient.handler&&(this._localScreenStream.observer=new hG(this._localScreenStream,this._mediaServerClient.handler))),a=!1,s=!1,c=!1,u=!1,!this._localScreenStream.videoTrack&&r?(r instanceof $U&&(s=!0),a=!0):this._localScreenStream.videoTrack&&!r&&(a=!1),!this._localScreenStream.audioTrack&&n?(n instanceof eV&&(u=!0),c=!0):this._localScreenStream.audioTrack&&!n&&(c=!1),this._localScreenStream.videoTrack=r,this._localScreenStream.audioTrack=n,this._localScreenStream.videoEncodeConfig=t,i&&(xw(i)&&(this._localScreenStream.pubAudio=o===cF.PUB),Nw(i)&&(this._localScreenStream.pubVideo=o===cF.PUB),kG.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),u?null===(p=this._localScreenStream.observer)||void 0===p||p.setPushAudio(c):null===(v=this._localScreenStream.observer)||void 0===v||v.setEnableAudio(c),e.next=28,this.updatePubScreenTrack();case 28:case"end":return e.stop()}}),e,this)}))),function(e,t,r,n,i){return E.apply(this,arguments)})},{key:"updatePubScreenTrack",value:(S=km(Em().mark((function e(){return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(kG.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 S.apply(this,arguments)})},{key:"unpublishScreen",value:(y=km(Em().mark((function e(){var t;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(kG.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 y.apply(this,arguments)})},{key:"liveControlMessage",value:(g=km(Em().mark((function e(t){var r,n=this;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return kG.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,this._liveTranscodingOnceSucc=!1),this._liveTranscodingOnceSucc=!0;case 7:case"end":return e.stop()}}),e,this)}))),function(e){return g.apply(this,arguments)})},{key:"publicStreamControlMessage",value:(m=km(Em().mark((function e(t){return Em().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 m.apply(this,arguments)})},{key:"subtitleControlMessage",value:(_=km(Em().mark((function e(t){return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._mediaServerClient.controlMessage(t);case 2:case"end":return e.stop()}}),e,this)}))),function(e){return _.apply(this,arguments)})},{key:"updateUserAttributes",value:(v=km(Em().mark((function e(t){return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return kG.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 v.apply(this,arguments)})},{key:"publish",value:(p=km(Em().mark((function e(t,r,n,i,o,a){var s,c,u,d,l,h,f,p,v,_,m,g,y=arguments;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(s=y.length>6&&void 0!==y[6]&&y[6],kG.print("publish","Invoke publish"),c=!1,this._localStream||(this._localStream=new HV,this._mediaServerClient.handler&&(this._localStream.observer=new hG(this._localStream,this._mediaServerClient.handler)),c=!0),this._localStream.videoTrack=n,this._localStream.audioTrack=i,this._localStream.videoEncodeConfig=t,this._localStream.enableSimulcast=r,o&&(xw(o)&&(this._localStream.pubAudio=a===cF.PUB),Nw(o)&&(this._localStream.pubVideo=a===cF.PUB),kG.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===(u=this._localStream.observer)||void 0===u||u.setLogin(!0):c&&(d=!!this._localStream.videoTrack,l=!!this._localStream.audioTrack,h=this._localStream.videoTrack instanceof $U,f=this._localStream.audioTrack instanceof eV,this._roomConfig.isAutoPublish&&!this._hasPublished?(d&&(h?null===(p=this._localStream.observer)||void 0===p||p.setPushVideo(!0):null===(v=this._localStream.observer)||void 0===v||v.setEnableVideo(!0)),l&&(f?null===(_=this._localStream.observer)||void 0===_||_.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(aF.ON_PUBLISH_RESULT,{isScreen:!1,state:_d.PUBLISH_SUCC}),e.next=24;break;case 20:throw e.prev=20,e.t0=e.catch(12),this.emit(aF.ON_PUBLISH_RESULT,{isScreen:!1,state:_d.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 p.apply(this,arguments)})},{key:"updatePubTrack",value:(f=km(Em().mark((function e(){return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(kG.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 f.apply(this,arguments)})},{key:"unpublish",value:(h=km(Em().mark((function e(){return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(kG.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 h.apply(this,arguments)})},{key:"subscribe",value:(l=km(Em().mark((function e(t,r,n){var i;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return kG.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 l.apply(this,arguments)})},{key:"updateSubTrack",value:(d=km(Em().mark((function e(t,r,n,i){var o,a;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(kG.print("updateSubTrack","Invoke updateSubTrack"),!i){e.next=4;break}return e.next=4,null===(a=this._mediaServerClient)||void 0===a?void 0:a.updateSubTrackLayer(t,i);case 4:return e.abrupt("return",null===(o=this._mediaServerClient)||void 0===o?void 0:o.updateSubTrack(t,r,n));case 5:case"end":return e.stop()}}),e,this)}))),function(e,t,r,n){return d.apply(this,arguments)})},{key:"updateSubVideoConfig",value:(u=km(Em().mark((function e(t,r){var n,i,o,a,s;return Em().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.updateSubTrackLayer(a,s));case 6:case"end":return e.stop()}}),e,this)}))),function(e,t){return u.apply(this,arguments)})},{key:"_getSubLayer",value:function(e,t){for(var r,n,i,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,f=0;f<(null==d?void 0:d.length);f++){var p,v;if(h>=(null===(p=d[f])||void 0===p?void 0:p.width)*(null===(v=d[f])||void 0===v?void 0:v.height)){l=f;break}}var _=d[0];if(-1===l)_=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);_=g<.1?d[l-1]:d[l],l=g<.1?l-1:l}return a=null!==(r=null===(n=_)||void 0===n?void 0:n.sub_index)&&void 0!==r?r:-1,{spatialLayer:null!==(i=null===(o=_)||void 0===o?void 0:o.video_index)&&void 0!==i?i:l,spatialSubLayer:a}}},{key:"unsubscribe",value:(c=km(Em().mark((function e(t,r){return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return kG.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 c.apply(this,arguments)})},{key:"startSubtitle",value:(s=km(Em().mark((function e(t){return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this._subtitleTool){e.next=5;break}return e.next=3,this._subtitleTool.start(t);case 3:e.next=6;break;case 5:throw new lR(uR.INVOKED_BEFORE_JOIN_ROOM,"join first");case 6:case"end":return e.stop()}}),e,this)}))),function(e){return s.apply(this,arguments)})},{key:"stopSubtitle",value:(a=km(Em().mark((function e(){var t;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:null===(t=this._subtitleTool)||void 0===t||t.stop();case 1:case"end":return e.stop()}}),e,this)}))),function(){return a.apply(this,arguments)})},{key:"leave",value:(o=km(Em().mark((function e(){var t,r,n,i,o,a,s,c,u=arguments;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:r=u.length>0&&void 0!==u[0]&&u[0],kG.print("leave","Invoke leave"),n=sw(),null===(t=this._subtitleTool)||void 0===t||t.destroy(),delete this._subtitleTool,e.prev=5,this._mediaServerClient.connectionState!==_F.CONNECTED&&this._joinRejectCallback&&this._joinRejectCallback(new Error(Qx.LEAVE_ROOM)),clearTimeout(this._reconnectTimer),o=QT(tA(i=this._remoteStreams).call(i));try{for(o.s();!(a=o.n()).done;)s=a.value,Array.isArray(s)&&s.forEach((function(e){var t;null===(t=e.observer)||void 0===t||t.setLogin(!1)}))}catch(d){o.e(d)}finally{o.f()}return this._localStream&&(null===(c=this._localStream.observer)||void 0===c||c.setLogin(!1)),e.next=13,this._mediaServerClient.leave();case 13:this.destroy(),iN.rtcLeaveRoom(0,"",sw()-n),sN.setStats({room_id:void 0,user_id:void 0,rtc_session_id:void 0}),cG.setStats({rtc_room_id:void 0}),e.next=27;break;case 19:if(e.prev=19,e.t0=e.catch(5),!r){e.next=25;break}throw e.t0;case 25:this.destroy();case 26:e.t0 instanceof Error&&iN.rtcLeaveRoom(-1,e.t0.message,sw()-n);case 27:case"end":return e.stop()}}),e,this,[[5,19]])}))),function(){return o.apply(this,arguments)})},{key:"updateRemoteUserPriority",value:function(e){var t,r=this;null===(t=this.remoteStreams.get(e))||void 0===t||t.forEach((function(e){e.streamState!==GV.INIT&&r._mediaServerClient.subscribe(e,e.subMediaType)}))}},{key:"destroy",value:function(){var e;kG.print("destroy","Invoke destroy"),iN.rtcInvokeStatus("".concat((new Error).stack),0,"room_destroy","",0),null===(e=this._subtitleTool)||void 0===e||e.destroy(),delete this._subtitleTool,this._destroyAndInitMediaServerClient(),this._roomInfo=void 0,this._remoteUsers=new yE;var t,r,n,i=QT(this._remoteStreams);try{for(i.s();!(t=i.n()).done;){var o=JT(t.value,2)[1];Array.isArray(o)&&o.forEach((function(e){e&&e.clean()}))}}catch(a){i.e(a)}finally{i.f()}(this._virtualStreams.forEach((function(e){null==e||e.clean()})),this._remoteStreams=new yE,this._localStream)&&(null===(r=this._localStream)||void 0===r||r.clean(),this._localStream=void 0);this._localScreenStream&&(null===(n=this._localScreenStream)||void 0===n||n.clean(),this._localScreenStream=void 0);this._context=void 0,this._reconnectRecord=new AG,this._removeHandlerEventHandler(),clearTimeout(this._connectionLostTimer),this._userDuplicateLoginTimerMap.forEach((function(e){clearTimeout(e)})),this._userDuplicateLoginTimerMap.clear(),this._networkQualityManager.destroy(),this._videoSizeObserver.destroy(),this._csrcUserIdMap={},this._virtualStreams=[],this._remoteStreamStreamIdUserIdMap={}}},{key:"updateToken",value:(i=km(Em().mark((function e(t){return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return kG.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 i.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=nw(),sN.setStats({rtc_session_id:this._sessionId}),cG.setStats({rtc_session_id:this._sessionId})}},{key:"sendRoomMessage",value:(n=km(Em().mark((function e(t){var r,n,i,o,a,s=arguments;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(o=s.length>1&&void 0!==s[1]&&s[1],a={clientId:null===(r=this._roomInfo)||void 0===r?void 0:r.userInfo.userId,binary:o,message:"",roomId:null===(n=this._roomInfo)||void 0===n?void 0:n.roomId},!o){e.next=8;break}return e.next=5,dw.ab2b64str(t);case 5:a.message=e.sent,e.next=9;break;case 8:a.message=t;case 9:return e.abrupt("return",null===(i=this._mediaServerClient)||void 0===i?void 0:i.sendRoomMessage(a));case 10:case"end":return e.stop()}}),e,this)}))),function(e){return n.apply(this,arguments)})},{key:"_destroyAndInitMediaServerClient",value:function(){kG.print("_destroyAndInitMediaServerClient()"),this._mediaServerClient&&(this._mediaServerClient.destroy(),this._removeHandlerEventHandler()),this._mediaServerClient=new gF(this._context),this._addHandlerEventHandler()}},{key:"_onJoinSucc",value:function(e,t){var r,n,i,o=this;kG.print("JoinSuccess()"),this._serverConfig=e.config;var a=[],s=[],c=[],u=[],d=[];null===(r=e.clientsDetail)||void 0===r||r.forEach((function(t){if(t.attributes&&(t.attributes.serverMuteVideo&&o.safeEmit(aF.ON_VIDEO_STREAM_BANNED,{uid:t.clientId,banned:1===t.attributes.serverMuteVideo}),t.attributes.serverMuteAudio&&o.safeEmit(aF.ON_AUDIO_STREAM_BANNED,{uid:t.clientId,banned:1===t.attributes.serverMuteAudio})),t.clientId!==e.clientId){var r=o._remoteUsers.get(t.clientId);r?r._stillExist=!0:a.push(t)}}));var l,h=QT(tA(n=this._remoteUsers).call(n));try{for(h.s();!(l=h.n()).done;){var f=l.value;f._stillExist||s.push({clientId:f.userId}),delete f._stillExist}}catch(m){h.e(m)}finally{h.f()}e.streams.forEach((function(e){var t=o._findRemoteStreamByScreen(e.clientId,e.screen);t?(t.stillExist=!0,t.streamId=e.streamId,d.push(e)):u.push(e)}));var p,v=QT(tA(i=this._remoteStreams).call(i));try{for(v.s();!(p=v.n()).done;){var _=p.value;Array.isArray(_)&&_.forEach((function(e){e.stillExist?delete e.stillExist:c.push({clientId:e.userId,streamId:e.streamId,message:UN.clientDisconnected})}))}}catch(m){v.e(m)}finally{v.f()}s.forEach((function(e){return o._onUserDisconnection(e)})),a.forEach((function(e){return o._onUserConnection(e)})),c.forEach((function(e){return o._onRemoveStream(e)})),u.forEach((function(e){return o._onAddStream(e,{fromSignal:!1})})),d.forEach((function(e){return o._onUpdateStreamAttributes(e)})),t&&this._handleSendOrRecvStreamAfterReconnect()}},{key:"_handleSendOrRecvStreamAfterReconnect",value:function(){var e,t,r=this;this._localStream&&(this._localStream.clean(),this._mediaServerClient.publish(this._localStream).catch((function(e){}))),this._localScreenStream&&(this._localScreenStream.clean(),this._mediaServerClient.publish(this._localScreenStream).catch((function(e){})));var n,i=QT(tA(t=this._remoteStreams).call(t));try{for(i.s();!(n=i.n()).done;){var o=n.value;Array.isArray(o)&&o.forEach(function(){var e=km(Em().mark((function e(t){var n,i,o,a;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!t.hasSubscribed){e.next=15;break}return t.resetHasSubscribed(),e.prev=2,kG.print(wm(n="start resubscribe ".concat(t.userId," with ")).call(n,t.subMediaType)),e.next=6,r._mediaServerClient.subscribe(t,t.subMediaType);case 6:kG.print(wm(i="success resubscribe ".concat(t.userId," with ")).call(i,t.subMediaType)),r.safeEmit(aF.RESUBSCRIBE,{stream:t}),e.next=15;break;case 10:e.prev=10,e.t0=e.catch(2),kG.print(wm(o=wm(a="failed resubscribe ".concat(t.userId," with ")).call(a,t.subMediaType,", error:")).call(o,e.t0)),t.clean(),null==t||t.resetHasSubscribed();case 15:case"end":return e.stop()}}),e,null,[[2,10]])})));return function(t){return e.apply(this,arguments)}}())}}catch(a){i.e(a)}finally{i.f()}null===(e=this._subtitleTool)||void 0===e||e.reconnect()}},{key:"_handleFFAudioTrack",value:function(){var e,t,r,n,i=null===(e=this._mediaServerClient)||void 0===e||null===(t=e.handler)||void 0===t?void 0:t.audioTrack4ff,o=null===(r=this._mediaServerClient)||void 0===r||null===(n=r.handler)||void 0===n?void 0:n.getTransceivers();if(i&&Array.isArray(o)){var a=xb(o).call(o,(function(e){var t;return(null==e||null===(t=e.receiver)||void 0===t?void 0:t.track)===i}));if(a){var s=new zV("ff-stream","ff-stream",!1,TG);s.virtual=!0,s.audioTransceiver=a,s.audioMid="0",s.audioTrack=vV(i),this._virtualStreams.push(s),this.safeEmit(aF.SUBSCRIBE_PUSH_TRACK,{stream:s})}}}},{key:"_findRemoteStream",value:function(e,t){var r=this._remoteStreams.get(e);return Array.isArray(r)?xb(r).call(r,(function(e){return e.streamId===t})):null}},{key:"_findRemoteStreamByScreen",value:function(e,t){var r=this._remoteStreams.get(e);return Array.isArray(r)?xb(r).call(r,(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=r.needEmit,i=void 0===n||n,o=r.fromSignal,a=void 0===o||o,s=r.virtual,c=void 0!==s&&s;if(e.clientId!==(null===(t=this._roomInfo)||void 0===t?void 0:t.userInfo.userId)){var u=this._roomConfig,d=u.isAutoSubscribeAudio,l=u.isAutoSubscribeVideo,h=this._findRemoteStreamByScreen(e.clientId,e.screen);if(h&&h.streamId!==e.streamId){var f,p=null===(f=this._remoteStreams.get(e.clientId))||void 0===f?void 0:Gs(f).call(f,(function(e){return e.streamId!==h.streamId}));h.clean(),this._remoteStreams.set(e.clientId,p||[])}var v=this._findRemoteStream(e.clientId,e.streamId);if(this._remoteStreamStreamIdUserIdMap[e.streamId]=e.clientId,v)v.attributes=e.attributes;else if((v=new zV(e.clientId,e.streamId,e.screen,e.attributes)).virtual=c,this._initStreamListeners(v),!c){var _=this._remoteStreams.get(e.clientId);_?_.push(v):this._remoteStreams.set(e.clientId,[v])}if(this._mediaServerClient.handler&&(v.observer=new dG(v,this._mediaServerClient.handler)),!v.isScreen&&l){var m,g,y,S,E,b,k,T;if(a&&v.hasVideo)if(v.attributes.extvideo)null===(m=v.observer)||void 0===m||m.setExternalVideoSource(!0),null===(g=v.observer)||void 0===g||g.setPushVideo(!0);else null===(y=v.observer)||void 0===y||y.setExternalVideoSource(!1),null===(S=v.observer)||void 0===S||S.setPublishVideo(!0);if(a&&v.hasAudio&&d&&!this._mediaServerClient.roomAttributes.multiChatMode)if(v.attributes.extaudio)null===(E=v.observer)||void 0===E||E.setExternalAudioSource(!0),null===(b=v.observer)||void 0===b||b.setPushAudio(!0);else null===(k=v.observer)||void 0===k||k.setExternalAudioSource(!1),null===(T=v.observer)||void 0===T||T.setPublishAudio(!0);if(!0===i&&!1===a){var I,A=this._roomConfig,R=A.isAutoSubscribeAudio,w=A.isAutoSubscribeVideo;null===(I=v.observer)||void 0===I||I.setLogin(!0,{audio:!!R,video:!!w})}}return i&&this.safeEmit(FN.ON_ADD_STREAM,{stream:v}),v}}},{key:"_onUserConnection",value:function(e){var t;if(e.clientId!==(null===(t=this._roomInfo)||void 0===t?void 0:t.userInfo.userId)){var r=this._userDuplicateLoginTimerMap.get(e.clientId);if("number"==typeof r)return this._userDuplicateLoginTimerMap.delete(e.clientId),void self.clearTimeout(r);var n={userId:e.clientId,extraInfo:e.attributes.extra_info};this._remoteUsers.set(e.clientId,ud({},n)),this.safeEmit(FN.USER_CONNECTION,{userInfo:n}),e.attributes&&(e.attributes.serverMuteVideo&&this.safeEmit(aF.ON_VIDEO_STREAM_BANNED,{uid:e.clientId,banned:1===e.attributes.serverMuteVideo}),e.attributes.serverMuteAudio&&this.safeEmit(aF.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===GN.kickedByAdmin?a=uR.KICKED_OUT:i===GN.onUserTokenDidExpire?a=uR.TOKEN_EXPIRED:i===GN.userDuplicateLogin&&(a=uR.DUPLICATE_LOGIN),o===HN.roomDismissByAdmin&&(a=uR.ROOM_DISMISS),a&&this.safeEmit(aF.ON_ROOM_ERROR,{errorCode:a})}else{var s=hd.DROPPED;i===GN.userLeave?s=hd.QUIT:i===GN.kickedByAdmin?s=hd.KICKED_BY_ADMIN:i===GN.roleChanged&&(s=hd.SWITCH_TO_INVISIBLE);var c=function(){var e;r._remoteUsers.delete(n),null===(e=r._remoteStreams.get(n))||void 0===e||e.forEach((function(e){e.clean(),r._onRemoveStream({clientId:e.userId,streamId:e.streamId,message:UN.clientDisconnected})})),r._remoteStreams.delete(n),r.safeEmit(aF.ON_USER_LEAVE,{userInfo:{userId:n},reason:s})};if(i===GN.userDuplicateLogin){var u=this._userDuplicateLoginTimerMap.get(n);u&&self.clearTimeout(u);var d=self.setTimeout(c,5e3);this._userDuplicateLoginTimerMap.set(n,d)}else c()}}},{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=xb(n).call(n,(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(){var t=r._remoteStreams.get(e.clientId);t&&(t=Gs(t).call(t,(function(t){return t.streamId!==e.streamId||(t.clean(),!1)})),r._remoteStreams.set(e.clientId,t))})).finally((function(){r.safeEmit(FN.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(aF.ON_VIDEO_STREAM_BANNED,{uid:e.clientId,banned:1===e.attributes.serverMuteVideo}),e.attributes.serverMuteAudio&&this.safeEmit(aF.ON_AUDIO_STREAM_BANNED,{uid:e.clientId,banned:1===e.attributes.serverMuteAudio}))}},{key:"_onUpdateRoomAttributes",value:function(e){var t;e.roomAttributes&&(this._mediaServerClient.roomAttributes=ud(ud({},this._mediaServerClient.roomAttributes),e.roomAttributes)),null!==(t=e.roomAttributes)&&void 0!==t&&t.multiChatMode&&this._handleFFAudioTrack()}},{key:"_onUpdateStreamAttributes",value:function(e){var t=this._roomConfig,r=t.isAutoSubscribeAudio,n=t.isAutoSubscribeVideo,i=e.clientId,o=e.streamId,a=e.attributes,s=this._findRemoteStream(i,o);if(s){var c,u,d=s.attributes,l=ud(ud({},d),a),h=!1,f=l.localaudio!==d.localaudio,p=!1,v=!1,_=l.localvideo!==d.localvideo,m=!1,g=IV.NONE,y=IV.NONE;if(l.audiostream!==d.audiostream&&(h=l.localaudio,p=!!l.audiostream,l.audiostream?g|=Sd.AUDIO:y|=Sd.AUDIO),l.videostream!==d.videostream&&(v=l.localvideo,m=!!l.videostream,l.videostream?g|=Sd.VIDEO:y|=Sd.VIDEO),g&&this.safeEmit(aF.ON_USER_PUBLISH_STATE_CHANGE,{userId:i,mediaType:g,isScreen:s.isScreen,pubState:cF.PUB,remoteStream:s}),y&&this.safeEmit(aF.ON_USER_PUBLISH_STATE_CHANGE,{userId:i,mediaType:y,isScreen:s.isScreen,pubState:cF.UNPUB,remoteStream:s}),s.attributes=l,l.localaudio!==d.localaudio)if(l.localaudio){var S,E,b,k;if(r)if(l.extaudio)null===(S=s.observer)||void 0===S||S.setExternalAudioSource(!0),null===(E=s.observer)||void 0===E||E.setPushAudio(!0);else null===(b=s.observer)||void 0===b||b.setExternalAudioSource(!1),null===(k=s.observer)||void 0===k||k.setEnableAudio(!0);this.safeEmit(aF.ON_USER_START_AUDIO_CAPTURE,{userId:i},s)}else{var T,I,A,R;if(l.extaudio)null===(T=s.observer)||void 0===T||T.setExternalAudioSource(!0),null===(I=s.observer)||void 0===I||I.setPushAudio(!1);else null===(A=s.observer)||void 0===A||A.setExternalAudioSource(!1),null===(R=s.observer)||void 0===R||R.setEnableAudio(!1);!s.isScreen&&this.safeEmit(aF.ON_USER_STOP_AUDIO_CAPTURE,{userId:i})}if(l.localvideo!==d.localvideo)if(l.localvideo){var w,C,O,D;if(n)if(l.extvideo)null===(w=s.observer)||void 0===w||w.setExternalVideoSource(!0),null===(C=s.observer)||void 0===C||C.setPushVideo(!0);else null===(O=s.observer)||void 0===O||O.setExternalVideoSource(!1),null===(D=s.observer)||void 0===D||D.setEnableVideo(!0);this.safeEmit(aF.ON_USER_START_VIDEO_CAPTURE,{userId:i})}else{var x,N,P,M;if(l.extvideo)null===(x=s.observer)||void 0===x||x.setExternalVideoSource(!0),null===(N=s.observer)||void 0===N||N.setPushVideo(!1);else null===(P=s.observer)||void 0===P||P.setExternalVideoSource(!1),null===(M=s.observer)||void 0===M||M.setEnableVideo(!1);!s.isScreen&&this.safeEmit(aF.ON_USER_STOP_VIDEO_CAPTURE,{userId:i})}if(h&&!f)null===(c=s.observer)||void 0===c||c.setRemoteUnmuteAudio(p);if(v&&!_)null===(u=s.observer)||void 0===u||u.setRemoteUnmuteVideo(m)}}},{key:"_onPushTrack",value:function(e){var t,r=this;if(null!==(t=e.streamId)&&void 0!==t&&cR(t).call(t,"audio_mux")){var n=this._onAddStream(ud(ud({},e),{},{attributes:TG}),{needEmit:!1,fromSignal:!1,virtual:!0});n&&this._mediaServerClient.subscribe4pushTrack(n,e).then((function(){r.safeEmit(aF.SUBSCRIBE_PUSH_TRACK,{stream:n}),r._virtualStreams.push(n)})).catch((function(e){kG.print("subscribe","push track failed %o",e)}))}else{var i;iN.rtcError(wm(i="onPushTrack, userId: ".concat(e.clientId,", ")).call(i,e.streamId),-1001)}}},{key:"_onRemoveTrack",value:function(e){var t,r=e.clientId,n=e.streamId,i=e.message;kG.print("_onRemoveTrack","remove track: %o",r);var o=this._findRemoteStream(r,n);o&&(null===(t=this._mediaServerClient)||void 0===t||t.unsubscribe4removeTrack(o,i))}},{key:"_onMeetingSpeakerChange",value:function(e){if(Array.isArray(null==e?void 0:e.speakerCsrcInfo)){var t={};null==e||e.speakerCsrcInfo.forEach((function(e){var r=e.csrc,n=e.userId;e.isScreen||(t[r]=n)})),this._csrcUserIdMap=t}}},{key:"getActiveSpeakerInMultiChatMode",value:function(){var e=this,t=[];return this._virtualStreams.forEach((function(r){var n,i=null===(n=r.audioTransceiver)||void 0===n?void 0:n.receiver;if(i){var o=JT(i.getContributingSources()||[],1)[0];if(o){var a=o.audioLevel,s=o.source;e._csrcUserIdMap[s]&&t.push({userId:e._csrcUserIdMap[s],audioLevel:a})}}})),t.length&&VA(t).call(t,(function(e,t){return e.audioLevel-t.audioLevel})),t}},{key:"_nodeChange",value:function(e){var t,r=e.nodes,n=e.reason;TN.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,iN.rtcNodeChange(0,tg(e),tg(n)),this._joinResolveCallback&&this._joinRejectCallback?this._join(this._joinResolveCallback,this._joinRejectCallback):this._reconnect()}},{key:"_reconnect",value:function(){var e,t=this;this._isReconnecting=!0;var r,n=QT(tA(e=this._remoteStreams).call(e));try{for(n.s();!(r=n.n()).done;){var i=r.value;Array.isArray(i)&&i.forEach((function(e){return e.clean()}))}}catch(o){n.e(o)}finally{n.f()}iN.rtcReconnect(1002,Tx.PEERCONNECTION_RECONNECTING,this._roomInfo.userInfo.userId,Ix.PEERCONNECTION),this._liveTranscodingOnceSucc||delete this._liveControlMessage,this._join((function(){iN.rtcReconnected(Ax.PEERCONNECTION_RECONNECTED,Rx.PEERCONNECTION)}),(function(e){t._reconnectRecord.record(e),t._reconnectRecord.shouldReconnect?(kG.print("Reconnecting error, will reconnect after 3s",e),t._reconnectTimer=window.setTimeout(t._reconnect.bind(t),3e3)):(t.safeEmit(aF.RECONNECT_FAILED),t.destroy())}),!0)}},{key:"_handleAbnormalDisconnection",value:function(){kG.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===_F.DISCONNECTED)t=bd.CONNECTION_STATE_DISCONNECTED;else if(e.next===_F.CONNECTED)clearTimeout(this._connectionLostTimer),t=this._isReconnecting?bd.CONNECTION_STATE_RECONNECTED:bd.CONNECTION_STATE_CONNECTED;else{if(e.next!==_F.CONNECTING)return;t=this._isReconnecting?bd.CONNECTION_STATE_RECONNECTING:bd.CONNECTION_STATE_CONNECTING}e.prev===_F.CONNECTED&&e.next===_F.DISCONNECTED&&(this._connectionLostTimer=window.setTimeout((function(){r.safeEmit(jN.ON_CONNECTION_STATE_CHANGE,{state:bd.CONNECTION_STATE_LOST})}),1e4)),this._networkQualityManager.setConnectionState(e.next),this.safeEmit(jN.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(aF.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?yd.STREAM_INDEX_SCREEN:yd.STREAM_INDEX_MAIN}})}))}},{key:"_onCustomMessage",value:function(e){this.safeEmit(FN.ON_CUSTOM_MESSAGE,e)}},{key:"_onUserMessageReceived",value:function(e){this.safeEmit(FN.USER_MESSAGE_RECEIVED,{userId:e.from,message:e.msg})}},{key:"_onUserBinaryMessageReceived",value:function(e){var t,r={userId:e.from,message:e.msg};null!==(t=this._subtitleTool)&&void 0!==t&&t.onMessageRecv(r)||this.safeEmit(FN.USER_BINARY_MESSAGE_RECEIVED,r)}},{key:"_initSubtitleTool",value:function(){var e=this;this._subtitleTool=new SG(this),this._subtitleTool.onEvent=function(t){e.emit(aF.ON_SUBTITLE_STATE_CHANGED,t)},this._subtitleTool.onMessage=function(t){e.emit(aF.ON_SUBTITLE_MESSAGE_RECEIVED,t)}}},{key:"_onPostProcessingMessage",value:function(e){if(e.body)if("subtitleCallback"!==e.type){var t=e.body,r=t.error||0,n=sF.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=sF.START_FAILED);break;case"TranscodeStateChanged":n=0!==t.error?sF.START_FAILED:sF.START_SUCCESS;break;case"TranscodeStopped":n=0!==t.error?sF.STOP_FAILED:sF.STOP_SUCCESS;break;case"TranscodeUpdated":n=0!==t.error?sF.UPDATE_FAILED:sF.UPDATE_SUCCESS}this.safeEmit(FN.POST_PROCESSING_MESSAGE,{code:r,protocol:t.protocol,error:t.error,eventType:n,message:i[r]})}this.safeEmit(FN.POST_PROCESSING_MESSAGE,{code:r,message:i[r],type:e.type})}else{var o;null===(o=this._subtitleTool)||void 0===o||o.onResult(e)}}},{key:"_onUserTokenWillExpire",value:function(){this.safeEmit(FN.ON_USER_TOKEN_WILL_EXPIRE,null)}},{key:"_onStreamFailed",value:(r=km(Em().mark((function e(t){var r,n,i,o,a,s,c,u,d,l;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if("publish"!==t.type){e.next=11;break}if(s=void 0,(null===(r=this.localStream)||void 0===r?void 0:r.streamId)===t.streamId?s=this.localStream:(null===(n=this.localScreenStream)||void 0===n?void 0:n.streamId)===t.streamId&&(s=this.localScreenStream),s){e.next=5;break}return e.abrupt("return");case 5:return null===(i=s)||void 0===i||i.clean(),e.next=8,null===(o=this._mediaServerClient)||void 0===o?void 0:o.unpublish(s).catch((function(){}));case 8:null===(a=this._mediaServerClient)||void 0===a||a.publish(s).catch((function(){})),e.next=20;break;case 11:if("subscribe"!==t.type){e.next=20;break}if(c=this._remoteStreamStreamIdUserIdMap[t.streamId],!(u=this._findRemoteStream(c,t.streamId))){e.next=20;break}return e.next=17,null===(d=this._mediaServerClient)||void 0===d?void 0:d.unsubscribe(u,Sd.AUDIO_AND_VIDEO);case 17:return e.next=19,null===(l=this._mediaServerClient)||void 0===l?void 0:l.subscribe(u,u.subMediaType,u.subLayer);case 19:this.safeEmit(aF.RESUBSCRIBE,{stream:u});case 20:case"end":return e.stop()}}),e,this)}))),function(e){return r.apply(this,arguments)})},{key:"_onStreamControlMessage",value:function(e){var t,r;e.type===VN.PushLimitWarn&&(null!==(t=this._localStream)&&void 0!==t&&t.pubAudio||null!==(r=this._localStream)&&void 0!==r&&r.pubVideo||this.unpublish())}},{key:"_onPublishOnDemand",value:(t=km(Em().mark((function e(){var t,r,n,i,o,a,s,c,u,d,l,h,f,p;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this._publishOnDemandBusy&&!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)){e.next=2;break}return e.abrupt("return");case 2:if(a=this._publishOnDemandItem,this._publishOnDemandItem=void 0,a){e.next=6;break}return e.abrupt("return");case 6:if(null===(i=this._localStream)||void 0===i||!i.enableSimulcast||null===(o=this._localStream)||void 0===o||!o.videoTransceiver){e.next=16;break}return u=[],this._publishOnDemandBusy=!0,d=null===(s=this._localStream)||void 0===s?void 0:s.stream.id,l=null===(c=this._localStream)||void 0===c?void 0:c.videoTransceiver.sender,h=l.getParameters(),Array.isArray(h.encodings)&&Array.isArray(a)&&(p={},kG.print("_onPublishOnDemand exec","usedDescriptions: %o",a),a.forEach((function(e){var t;if(null!=e&&null!==(t=e.StreamIds)&&void 0!==t&&Jm(t).call(t,d)){var r=null==e?void 0:e.Metadata.VideoIndex;p[r]=!0}})),h.encodings=sg(f=h.encodings).call(f,(function(e){if(e.rid){p[e.rid]?e.active=!0:e.active=!1;var t=+e.rid;u[t]=e.active}return e})),this._context&&(this._context.activeSimStreams=u)),e.next=15,l.setParameters(h);case 15:this._publishOnDemandBusy=!1;case 16:this._onPublishOnDemand();case 17:case"end":return e.stop()}}),e,this)}))),function(){return t.apply(this,arguments)})},{key:"_onRTT",value:function(e){var t=e.StreamIds,r=e.Metadata;if(t.length&&r){var n,i=t[0];null!==(n=this._context)&&void 0!==n&&n.streamRTT&&(this._context.streamRTT[i]={audio:r.audio_rtt,video:r.video_rtt})}}},{key:"_reportNetworkQuality",value:function(e,t){this.emit(aF.ON_NETWORK_QUALITY,e,t)}},{key:"_emitVideoSizeChange",value:function(e,t,r,n){var i;this.emit(aF.ON_REMOTE_VIDEO_SIZE_CHANGED,{roomId:null===(i=this.roomInfo)||void 0===i?void 0:i.roomId,userId:e,streamIndex:t?yd.STREAM_INDEX_SCREEN:yd.STREAM_INDEX_MAIN},{width:r,height:n})}},{key:"multiChatMode",get:function(){var e;return null===(e=this._mediaServerClient)||void 0===e?void 0:e.multiChatMode()}}]),I}(OC),AG=function(){function e(){Wd(this,e),sd(this,"_all_201_count",void 0),sd(this,"_has_4xx",void 0),this._all_201_count=0,this._has_4xx=!1}return qd(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;sg(e).call(e,(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}(),RG=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&&YE(r.style,t.style),t.attributes&&SR(t.attributes).forEach((function(e){var t=JT(e,2),n=t[0],i=t[1];"muted"===n?r.muted=!0:r.setAttribute(n,i)})),r},wG=new RC("Player",0),CG=["play","playing","pause","ended","error","seeking","seeked","waiting","canplay","canplaythrough","durationchange","volumechange","loadedmetadata","loadeddata","loadstart","timeupdate"],OG={playsinline:"","webkit-playsinline":""},DG={playsinline:"","webkit-playsinline":"","x5-playsinline":"","x5-video-player-type":"h5","x-webkit-airplay":"allow",preload:"",muted:""},xG=function(e){OI(n,e);var t,r=qI(n);function n(e){var t;Wd(this,n),sd(ZT(t=r.call(this)),"_containerDom",void 0),sd(ZT(t),"_videoDom",void 0),sd(ZT(t),"__cumulativeTime",void 0),sd(ZT(t),"userId",void 0),sd(ZT(t),"renderMode",void 0),sd(ZT(t),"mirrorType",kd.MIRROR_TYPE_NONE),sd(ZT(t),"isScreen",void 0),sd(ZT(t),"isLocal",void 0),sd(ZT(t),"played",!1),sd(ZT(t),"_emitPlayFailed",!1),sd(ZT(t),"_videoContainer",void 0),sd(ZT(t),"_safari15VideoTimer",void 0),sd(ZT(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};switch(t.emit("playback_event",i),e.type){case"canplay":case"loadeddata":t._internalPlay();break;case"playing":wG.print("VideoPlayerPlaying","[userId-".concat(t.userId,"] video element playing"))}})),sd(ZT(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,i,o;t._emitPlayFailed||("AbortError"!==e.name?(t._emitPlayFailed=!0,iN.rtcError(wm(r="video autoplay failed, userId: ".concat(t.userId,", ")).call(r,e.name),-1e3),t.emit("playback_event",{type:"video",rawEvent:e,readyState:(null===(n=t._videoDom)||void 0===n?void 0:n.readyState)||0,userId:t.userId,eventName:"autoplay-error",currentTime:(null===(i=t._videoDom)||void 0===i?void 0:i.currentTime)||0,isScreen:t.isScreen})):iN.rtcError(wm(o="video autoplay failed, userId: ".concat(t.userId,", ")).call(o,e.name),-1e3))}))}}));var i=e.renderDom,o=e.userId;t.renderMode=void 0!==e.renderMode?e.renderMode:gd.RENDER_MODE_FIT;var a="string"==typeof i?document.getElementById(i):i;if(!a)throw new lR(uR.CANT_FIND_DOM,"can't find dom");return t._videoContainer=document.createElement("div"),t._videoContainer.style.width="100%",t._videoContainer.style.height="100%",t._videoContainer.style.position="relative",t._videoContainer.style.overflow="hidden",t._containerDom=a,t.userId=o,t.isLocal=!!e.isLocal,t.isScreen=!!e.isScreen,t._initVideo(),t}return qd(n,[{key:"_initVideo",value:function(){var e;this._videoDom||(this._videoDom=RG("video",{style:{width:"100%",height:"100%"},attributes:DG}),this._videoDom.id=wm(e="".concat(this.userId,"_")).call(e,aw()),this.renderMode===gd.RENDER_MODE_FIT?this._videoDom.style.objectFit="contain":this._videoDom.style.objectFit="cover",this.mirror(this.mirrorType===kd.MIRROR_TYPE_RENDER));this._videoContainer.appendChild(this._videoDom),this._containerDom.appendChild(this._videoContainer),this._initListeners()}},{key:"_initListeners",value:function(){var e=this;this._videoDom&&CG.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&&CG.forEach((function(t){var r;null===(r=e._videoDom)||void 0===r||r.removeEventListener(t,e.emitVideoEvent)}))}},{key:"_recordFrame",value:function(e){var t=this,r=e.isScreen?1.5:.5;if(pw&&CN.VIDEO_STALL){var n;if(null===(n=this._videoDom)||void 0===n||!n.requestVideoFrameCallback)return;this._videoDom.requestVideoFrameCallback((function n(i,o){var a=o.presentationTime;if(e.recordedVideoFrames||(e.recordedVideoFrames=[]),t.__cumulativeTime){var s,c=(a-t.__cumulativeTime)%2e3,u=c>1e3*r;null===(s=e.recordedVideoFrames)||void 0===s||s.push({playTime:a,isStall:u,stallCount:u?1:0,stallDuration:c})}t.__cumulativeTime=a,t._videoDom.requestVideoFrameCallback(n)}))}else this.on("playback_event",(function(n){var i;if("timeupdate"===n.eventName){if(!CN.VIDEO_STALL)return;if(0===(null===(i=t._videoDom)||void 0===i?void 0:i.currentTime))return;if(void 0===t.__cumulativeTime)return void(t.__cumulativeTime=t._videoDom.currentTime);if(e.recordedVideoFrames||(e.recordedVideoFrames=[]),t._videoDom.currentTime>t.__cumulativeTime){var o=Math.floor(1e3*(t._videoDom.currentTime-t.__cumulativeTime)),a=t._videoDom.currentTime-t.__cumulativeTime>r;e.recordedVideoFrames.push({playTime:t._videoDom.currentTime,isStall:a,stallCount:a?1:0,stallDuration:o%2e3})}t.__cumulativeTime=t._videoDom.currentTime}}))}},{key:"_recordPause",value:function(e){var t=this;void 0===e.statsReport.isPaused&&this.on("playback_event",(function(r){if("pause"===r.eventName)e.statsReport.isPaused=!0,e.statsReport.pauseStart=sw();else if("timeupdate"===r.eventName){var n;if((null===(n=t._videoDom)||void 0===n||!n.paused)&&e.statsReport.isPaused){e.statsReport.isPaused=!1;var i=sw()-(e.statsReport.pauseStart||0);i>500&&(e.statsReport.pauseDuration+=i)}}}))}},{key:"playVideo",value:(t=km(Em().mark((function e(t,r){var n,i,o,a,s=this;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(o=this._videoDom,wG.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=5;break}try{iN.rtcInvokeStatus("play video repeatedly",0,"playVideo",this.userId,0)}catch(EW){}return e.abrupt("return");case 5:o||(this._initVideo(),o=this._videoDom),wG.print("playVideo","play video by dom: ".concat(null===(i=o)||void 0===i?void 0:i.id)),(a=new MediaStream).addTrack(t.getTrack("preprocessing")),o.srcObject=a,o&&!this._containerDom.contains(this._videoContainer)&&this._containerDom.appendChild(this._videoContainer),o&&!this._videoContainer.contains(o)&&this._videoContainer.appendChild(o),setTimeout((function(){return s._internalPlay()})),r&&(this._recordFrame(r),this._recordPause(r),r.statsReport.player=this),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(wG.print("Invoke VideoPlayer.manuallyPlay",this.userId,this.isScreen),this._emitPlayFailed=!1,!this._videoDom)throw new lR(uR.INVALID_PARAMS,"Player not found");return 0!==this._videoDom.readyState||bw?this._videoDom.play():X_.resolve()}},{key:"mirror",value:function(e){var t;wG.print("mirror",wm(t="".concat(this.userId," set mirror: ")).call(t,e)),this.mirrorType=e?kd.MIRROR_TYPE_RENDER:kd.MIRROR_TYPE_NONE,this._videoDom&&(this._videoDom.style.transform=e?"rotateY(180deg)":"")}},{key:"stop",value:function(){var e,t=arguments.length>0&&void 0!==arguments[0]&&arguments[0],r=this._containerDom;(wG.print("stop","stop video track: ".concat(this.userId)),this._videoDom)&&(t||(this._videoDom.srcObject=null),null!=r&&r.contains(this._videoContainer)&&r.removeChild(this._videoContainer),null!==(e=this._videoContainer)&&void 0!==e&&e.contains(this._videoDom)&&this._videoContainer.removeChild(this._videoDom));this.__cumulativeTime=void 0,this.played=!1}},{key:"destroy",value:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];wG.print("destroy","video player: ".concat(this.userId)),this.stop(e),wI(AI(n.prototype),"removeAllListeners",this).call(this),this._removeListeners(),this._videoDom&&delete this._videoDom,this._safari15VideoTimer&&(window.clearInterval(this._safari15VideoTimer),this._safari15VideoTimer=void 0)}},{key:"domElement",get:function(){return this._videoDom}}]),n}(uC.exports.EventEmitter),NG=function(e){OI(i,e);var t,r,n=qI(i);function i(e){var t,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{divId:void 0,muted:!1,isScreen:!1},o=r.divId,a=r.muted,s=r.isScreen;if(Wd(this,i),sd(ZT(t=n.call(this)),"_containerDom",void 0),sd(ZT(t),"_audioDom",void 0),sd(ZT(t),"_fakeAudioDom",void 0),sd(ZT(t),"userId",void 0),sd(ZT(t),"muted",!1),sd(ZT(t),"_emitPlayFailed",!1),sd(ZT(t),"played",!1),sd(ZT(t),"isScreen",void 0),sd(ZT(t),"_wechatTimer",void 0),sd(ZT(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};"playing"===e.type&&wG.print("AudioPlayerPlaying","[userId-".concat(t.userId,"] audio element playing")),"pause"===e.type&&wG.print("AudioPlayerPause","[userId-".concat(t.userId,"] audio element pause")),kw&&bw&&("canplay"===e.type?(clearTimeout(t._wechatTimer),t._wechatTimer=window.setTimeout((function(){t._autoPlayError("wechat")}),500)):"playing"===e.type&&clearTimeout(t._wechatTimer)),t.emit("playback_event",i)})),sd(ZT(t),"_internalPlay",(function(){var e,r;if(_N("_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){var r,n;t._autoPlayError(e),iN.rtcError(wm(r=wm(n="audio autoplay failed, userId: ".concat(t.userId,": ")).call(n,e.message," ")).call(r,e.name),-1e3)})).then((function(){_N("_internalPlay successfully",{userId:t.userId})}))}catch(a){var i,o;t._autoPlayError(a),iN.rtcError(wm(i=wm(o="audio autoplay failed, userId: ".concat(t.userId,": ")).call(o,a.message," ")).call(i,a.name),-1e3)}})),o){var c=document.getElementById(o);if(!c)throw new lR(uR.CANT_FIND_DOM,"can't find dom");t._containerDom=c}else t._containerDom=document.body;return t.userId=e,t.muted=a,t.isScreen=s,t._initAudio(),t}return qd(i,[{key:"_initAudio",value:function(){var e;this._audioDom||(this._audioDom=RG("audio",{style:{display:"none"},attributes:OG}),this._audioDom.volume=this.muted?0:1,this._audioDom.muted=this.muted,this._audioDom.id=wm(e="".concat(this.userId,"_")).call(e,aw()),this._containerDom.appendChild(this._audioDom));this._initListeners()}},{key:"_initListeners",value:function(){var e=this;this._audioDom&&CG.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&&(CG.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=km(Em().mark((function e(t){var r,n,i,o,a,s=this;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(wG.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("preprocessing")),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,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:"pause",value:function(){if(!this._audioDom)throw new lR(uR.INVALID_PARAMS,"Player not found");this._audioDom.pause()}},{key:"manuallyPlay",value:function(){var e;if(wG.print("Invoke AudioPlayer.manuallyPlay"),this._emitPlayFailed=!1,!this._audioDom)throw new lR(uR.INVALID_PARAMS,"Player not found");if(!this.played)return X_.resolve();this._audioDom.volume=1,this._audioDom.muted=!1,null===(e=this._fakeAudioDom)||void 0===e||e.play();var t=this._audioDom.play();return null!=t&&t.then?t:X_.resolve(t)}},{key:"setPlaybackDevice",value:(t=km(Em().mark((function e(t){var r,n;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return wG.print("setPlaybackDevice","setPlaybackDevice: ".concat(t)),e.next=3,MU.enumerateAudioPlaybackDevices();case 3:if(r=e.sent,n=sg(r).call(r,(function(e){return e.deviceId})),Jm(n).call(n,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;wG.print("stopAudio","stop audio track: ".concat(this.userId)),this._audioDom&&(this._audioDom.srcObject=null,null!=e&&e.contains(this._audioDom)&&e.removeChild(this._audioDom)),this._fakeAudioDom&&(this._fakeAudioDom.srcObject=null,this._fakeAudioDom=void 0),this.played=!1}},{key:"domElement",get:function(){return this._audioDom}},{key:"destroy",value:function(){wG.print("destroy","audio player: ".concat(this.userId)),this.stop(),wI(AI(i.prototype),"removeAllListeners",this).call(this),this._removeListeners(),this._audioDom&&(this._audioDom.srcObject=null,delete this._audioDom)}}]),i}(uC.exports.EventEmitter);function PG(e,t,r,n){var i=function(){var e=km(Em().mark((function e(t,i){var o,a;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(o=null==n?void 0:n.get(i),Array.isArray(o)&&(o=null===(a=o)||void 0===a?void 0:xb(a).call(a,(function(e){return e.isScreen===r}))),!t){e.next=9;break}if(!t.played){e.next=8;break}return e.next=6,t.manuallyPlay();case 6:e.next=9;break;case 8:o&&(t instanceof xG&&o.videoTrack&&t.playVideo(o.videoTrack,o),t instanceof NG&&o.audioTrack&&t.playAudio(o.audioTrack));case 9:case"end":return e.stop()}}),e)})));return function(t,r){return e.apply(this,arguments)}}();if(t)return i(e.get(t),t);var o=[];return e.forEach((function(e,t){return o.push(i(e,t))})),X_.all(o)}var MG=function(){function e(){Wd(this,e),sd(this,"_timer",void 0),sd(this,"userMessage",void 0),sd(this,"roomMessage",void 0),this.userMessage={},this.roomMessage={},this._setTimer()}return qd(e,[{key:"_setTimer",value:function(){var e=this;!function t(){e._reportAndgReset(),clearTimeout(e._timer),e._timer=setTimeout(t,1e4)}()}},{key:"_reportAndgReset",value:function(){(an(this.userMessage).length||an(this.roomMessage).length)&&(this._report(),this._reset())}},{key:"_report",value:function(){var e,t,r=this;iN.rtcMessageStatistics(sg(e=an(this.userMessage)).call(e,(function(e){return r.userMessage[e]})),sg(t=an(this.roomMessage)).call(t,(function(e){return r.roomMessage[e]})),"")}},{key:"_reset",value:function(){this.userMessage={},this.roomMessage={}}},{key:"_checkInitUserMessage",value:function(e,t){var r,n;this.userMessage[wm(r="".concat(t,"-")).call(r,e)]||(this.userMessage[wm(n="".concat(t,"-")).call(n,e)]={dc_peer_user_id:e,dc_send_total:0,dc_recv_total:0,dc_send_ack:0,dc_send_fail:0,dc_fail_timeout:0,dc_fail_no_receiver:0,dc_fail_no_relay_path: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){var n,i;(this._checkInitUserMessage(e,t),this.userMessage[wm(n="".concat(t,"-")).call(n,e)].dc_send_total++,r)&&this.userMessage[wm(i="".concat(t,"-")).call(i,e)].dc_send_binary++}},{key:"_recvUserMessage",value:function(e,t){var r;this._checkInitUserMessage(e,t),this.userMessage[wm(r="".concat(t,"-")).call(r,e)].dc_recv_total++}},{key:"_sendUserFail",value:function(e,t,r){var n,i=this.userMessage[wm(n="".concat(t,"-")).call(n,e)];i&&(i.dc_send_fail++,this._handleUserFail(i,r))}},{key:"_handleUserFail",value:function(e,t){t&&(t.code||t.err)&&(t.code===uR.TIME_OUT||t.code===uR.USER_MESSAGE_TIMEOUT?e.dc_fail_timeout++:t.err===XN.NO_RECEIVER?e.dc_fail_no_receiver++:t.err===XN.NO_RELAYPATH?e.dc_fail_no_relay_path++:t.err===XN.TIMEOUT&&e.dc_fail_timeout++)}},{key:"_sendUserAck",value:function(e,t,r,n,i){var o,a=this.userMessage[wm(o="".concat(t,"-")).call(o,e)];a&&(a.dc_send_ack++,a.dc_cost_time+=r,a.dc_cost_s2s+=n||0,a.dc_cost_peer_s2e+=i,a.dc_cost_e2s+=r-(n||0)-i,r<=100?(a.dc_send_ack_100++,a.dc_send_ack_200++,a.dc_send_ack_400++,a.dc_send_ack_1s++):r<=200?(a.dc_send_ack_200++,a.dc_send_ack_400++,a.dc_send_ack_1s++):r<=400?(a.dc_send_ack_400++,a.dc_send_ack_1s++):r<=1e3&&a.dc_send_ack_1s++,r<a.dc_least_time&&(a.dc_least_time=r),r>a.dc_most_time&&(a.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,Jx.P2P,t)}},{key:"recvP2PMessage",value:function(e){this._recvUserMessage(e,Jx.P2P)}},{key:"sendP2PFail",value:function(e,t){this._sendUserFail(e,Jx.P2P,t)}},{key:"sendP2PAck",value:function(e,t,r,n){this._sendUserAck(e,Jx.P2P,t,r,n)}},{key:"sendP2POutRoomMessage",value:function(e,t){this._sendUserMessage(e,Jx.P2P_OUTSIDE_ROOM,t)}},{key:"recvP2POutRoomMessage",value:function(e){this._recvUserMessage(e,Jx.P2P_OUTSIDE_ROOM)}},{key:"sendP2POutRoomFail",value:function(e,t){this._sendUserFail(e,Jx.P2P_OUTSIDE_ROOM,t)}},{key:"sendP2POutRoomAck",value:function(e,t,r,n){this._sendUserAck(e,Jx.P2P_OUTSIDE_ROOM,t,r,n)}},{key:"sendP2serverMessage",value:function(e){this._sendUserMessage("",Jx.P2SERVER,e)}},{key:"sendP2serverFail",value:function(e){this._sendUserFail("",Jx.P2SERVER,e)}},{key:"sendP2serveAck",value:function(e,t,r){this._sendUserAck("",Jx.P2SERVER,e,t,r)}},{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,i)}},{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,i)}},{key:"countServerMessage",value:function(e,t,r,n){this.sendP2serverMessage(t),e?(n=n||{},this.sendP2serveAck(Date.now()-r,n.s2s_time||0,n.s2e_time||0)):this.sendP2serverFail(n)}},{key:"destroy",value:function(){this._reset(),clearTimeout(this._timer)}}]),e}(),LG="object"==typeof global&&global&&global.Object===Object&&global,UG="object"==typeof self&&self&&self.Object===Object&&self,VG=LG||UG||Function("return this")(),FG=VG.Symbol,BG=Object.prototype,jG=BG.hasOwnProperty,GG=BG.toString,HG=FG?FG.toStringTag:void 0;var zG=Object.prototype.toString;var KG=FG?FG.toStringTag:void 0;function XG(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":KG&&KG in Object(e)?function(e){var t=jG.call(e,HG),r=e[HG];try{e[HG]=void 0;var n=!0}catch(o){}var i=GG.call(e);return n&&(t?e[HG]=r:delete e[HG]),i}(e):function(e){return zG.call(e)}(e)}function qG(e){return null!=e&&"object"==typeof e}var WG=Array.isArray;function YG(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function QG(e){return e}function JG(e){if(!YG(e))return!1;var t=XG(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t}var ZG,$G=VG["__core-js_shared__"],eH=(ZG=/[^.]+$/.exec($G&&$G.keys&&$G.keys.IE_PROTO||""))?"Symbol(src)_1."+ZG:"";var tH=Function.prototype.toString;var rH=/^\[object .+?Constructor\]$/,nH=Function.prototype,iH=Object.prototype,oH=nH.toString,aH=iH.hasOwnProperty,sH=RegExp("^"+oH.call(aH).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function cH(e){return!(!YG(e)||(t=e,eH&&eH in t))&&(JG(e)?sH:rH).test(function(e){if(null!=e){try{return tH.call(e)}catch(t){}try{return e+""}catch(t){}}return""}(e));var t}function uH(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 dH=Date.now;var lH,hH,fH,pH=function(){try{var e=cH(t=function(e,t){return null==e?void 0:e[t]}(Object,"defineProperty"))?t:void 0;return e({},"",{}),e}catch(r){}var t}(),vH=pH,_H=vH?function(e,t){return vH(e,"toString",{configurable:!0,enumerable:!1,value:(r=t,function(){return r}),writable:!0});var r}:QG,mH=(lH=_H,hH=0,fH=0,function(){var e=dH(),t=16-(e-fH);if(fH=e,t>0){if(++hH>=800)return arguments[0]}else hH=0;return lH.apply(void 0,arguments)}),gH=mH,yH=/^(?:0|[1-9]\d*)$/;function SH(e,t){var r=typeof e;return!!(t=null==t?9007199254740991:t)&&("number"==r||"symbol"!=r&&yH.test(e))&&e>-1&&e%1==0&&e<t}function EH(e,t,r){"__proto__"==t&&vH?vH(e,t,{configurable:!0,enumerable:!0,value:r,writable:!0}):e[t]=r}function bH(e,t){return e===t||e!=e&&t!=t}var kH=Object.prototype.hasOwnProperty;function TH(e,t,r){var n=e[t];kH.call(e,t)&&bH(n,r)&&(void 0!==r||t in e)||EH(e,t,r)}var IH=Math.max;function AH(e,t){return gH(function(e,t,r){return t=IH(void 0===t?e.length-1:t,0),function(){for(var n=arguments,i=-1,o=IH(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),uH(e,this,s)}}(e,t,QG),e+"")}function RH(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=9007199254740991}function wH(e){return null!=e&&RH(e.length)&&!JG(e)}var CH=Object.prototype;function OH(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||CH)}function DH(e){return qG(e)&&"[object Arguments]"==XG(e)}var xH=Object.prototype,NH=xH.hasOwnProperty,PH=xH.propertyIsEnumerable,MH=DH(function(){return arguments}())?DH:function(e){return qG(e)&&NH.call(e,"callee")&&!PH.call(e,"callee")},LH=MH;var UH="object"==typeof exports&&exports&&!exports.nodeType&&exports,VH=UH&&"object"==typeof module&&module&&!module.nodeType&&module,FH=VH&&VH.exports===UH?VG.Buffer:void 0,BH=(FH?FH.isBuffer:void 0)||function(){return!1},jH={};jH["[object Float32Array]"]=jH["[object Float64Array]"]=jH["[object Int8Array]"]=jH["[object Int16Array]"]=jH["[object Int32Array]"]=jH["[object Uint8Array]"]=jH["[object Uint8ClampedArray]"]=jH["[object Uint16Array]"]=jH["[object Uint32Array]"]=!0,jH["[object Arguments]"]=jH["[object Array]"]=jH["[object ArrayBuffer]"]=jH["[object Boolean]"]=jH["[object DataView]"]=jH["[object Date]"]=jH["[object Error]"]=jH["[object Function]"]=jH["[object Map]"]=jH["[object Number]"]=jH["[object Object]"]=jH["[object RegExp]"]=jH["[object Set]"]=jH["[object String]"]=jH["[object WeakMap]"]=!1;var GH="object"==typeof exports&&exports&&!exports.nodeType&&exports,HH=GH&&"object"==typeof module&&module&&!module.nodeType&&module,zH=HH&&HH.exports===GH&&LG.process,KH=function(){try{var e=HH&&HH.require&&HH.require("util").types;return e||zH&&zH.binding&&zH.binding("util")}catch(t){}}(),XH=KH&&KH.isTypedArray,qH=XH?function(e){return function(t){return e(t)}}(XH):function(e){return qG(e)&&RH(e.length)&&!!jH[XG(e)]},WH=qH,YH=Object.prototype.hasOwnProperty;function QH(e,t){var r=WG(e),n=!r&&LH(e),i=!r&&!n&&BH(e),o=!r&&!n&&!i&&WH(e),a=r||n||i||o,s=a?function(e,t){for(var r=-1,n=Array(e);++r<e;)n[r]=t(r);return n}(e.length,String):[],c=s.length;for(var u in e)!t&&!YH.call(e,u)||a&&("length"==u||i&&("offset"==u||"parent"==u)||o&&("buffer"==u||"byteLength"==u||"byteOffset"==u)||SH(u,c))||s.push(u);return s}var JH=function(e,t){return function(r){return e(t(r))}}(Object.keys,Object),ZH=JH,$H=Object.prototype.hasOwnProperty;function ez(e){return wH(e)?QH(e):function(e){if(!OH(e))return ZH(e);var t=[];for(var r in Object(e))$H.call(e,r)&&"constructor"!=r&&t.push(r);return t}(e)}var tz=Object.prototype.hasOwnProperty;function rz(e){if(!YG(e))return function(e){var t=[];if(null!=e)for(var r in Object(e))t.push(r);return t}(e);var t=OH(e),r=[];for(var n in e)("constructor"!=n||!t&&tz.call(e,n))&&r.push(n);return r}var nz,iz=(nz=function(e,t){!function(e,t,r,n){var i=!r;r||(r={});for(var o=-1,a=t.length;++o<a;){var s=t[o],c=n?n(r[s],e[s],s,r,e):void 0;void 0===c&&(c=e[s]),i?EH(r,s,c):TH(r,s,c)}}(t,function(e){return wH(e)?QH(e,!0):rz(e)}(t),e)},AH((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=nz.length>3&&"function"==typeof i?(n--,i):void 0,o&&function(e,t,r){if(!YG(r))return!1;var n=typeof t;return!!("number"==n?wH(r)&&SH(t,r.length):"string"==n&&t in r)&&bH(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&&nz(e,a,r,i)}return e})));function oz(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 az(e){return null==e?[]:oz(e,ez(e))}var sz=i,cz=lt("iterator"),uz=!sz((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})),!e.toJSON||!t.sort||"http://a/c%20d?a=1&c=3"!==e.href||"3"!==t.get("c")||"a=1"!==String(new URLSearchParams("?a=1"))||!t[cz]||"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})),dz=Qt,lz=b,hz=2147483647,fz=/[^\0-\u007E]/,pz=/[.\u3002\uFF0E\uFF61]/g,vz="Overflow: input needs wider integers to process",_z=RangeError,mz=lz(pz.exec),gz=Math.floor,yz=String.fromCharCode,Sz=lz("".charCodeAt),Ez=lz([].join),bz=lz([].push),kz=lz("".replace),Tz=lz("".split),Iz=lz("".toLowerCase),Az=function(e){return e+22+75*(e<26)},Rz=function(e,t,r){var n=0;for(e=r?gz(e/700):e>>1,e+=gz(e/t);e>455;)e=gz(e/35),n+=36;return gz(n+36*e/(e+38))},wz=function(e){var t=[];e=function(e){for(var t=[],r=0,n=e.length;r<n;){var i=Sz(e,r++);if(i>=55296&&i<=56319&&r<n){var o=Sz(e,r++);56320==(64512&o)?bz(t,((1023&i)<<10)+(1023&o)+65536):(bz(t,i),r--)}else bz(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&&bz(t,yz(n));var c=t.length,u=c;for(c&&bz(t,"-");u<i;){var d=hz;for(r=0;r<e.length;r++)(n=e[r])>=o&&n<d&&(d=n);var l=u+1;if(d-o>gz((hz-a)/l))throw _z(vz);for(a+=(d-o)*l,o=d,r=0;r<e.length;r++){if((n=e[r])<o&&++a>hz)throw _z(vz);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 v=h-p,_=36-p;bz(t,yz(Az(p+v%_))),h=gz(v/_),f+=36}bz(t,yz(Az(h))),s=Rz(a,l,u==c),a=0,u++}}a++,o++}return Ez(t,"")},Cz=Rr,Oz=n,Dz=D,xz=b,Nz=w,Pz=uz,Mz=li,Lz=my,Uz=Mi,Vz=Pc,Fz=Zi,Bz=vf,jz=A,Gz=Ye,Hz=Yt,zz=vn,Kz=tr,Xz=$,qz=gn,Wz=Hn,Yz=V,Qz=_h,Jz=uh,Zz=Af,$z=sA,eK=lt("iterator"),tK="URLSearchParams",rK="URLSearchParamsIterator",nK=Fz.set,iK=Fz.getterFor(tK),oK=Fz.getterFor(rK),aK=Object.getOwnPropertyDescriptor,sK=function(e){if(!Nz)return Oz[e];var t=aK(Oz,e);return t&&t.value},cK=sK("fetch"),uK=sK("Request"),dK=sK("Headers"),lK=uK&&uK.prototype,hK=dK&&dK.prototype,fK=Oz.RegExp,pK=Oz.TypeError,vK=Oz.decodeURIComponent,_K=Oz.encodeURIComponent,mK=xz("".charAt),gK=xz([].join),yK=xz([].push),SK=xz("".replace),EK=xz([].shift),bK=xz([].splice),kK=xz("".split),TK=xz("".slice),IK=/\+/g,AK=Array(4),RK=function(e){return AK[e-1]||(AK[e-1]=fK("((?:%[\\da-f]{2}){"+e+"})","gi"))},wK=function(e){try{return vK(e)}catch(EW){return e}},CK=function(e){var t=SK(e,IK," "),r=4;try{return vK(t)}catch(EW){for(;r;)t=SK(t,RK(r--),wK);return t}},OK=/[!'()~]|%20/g,DK={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+"},xK=function(e){return DK[e]},NK=function(e){return SK(_K(e),OK,xK)},PK=Vz((function(e,t){nK(this,{type:rK,iterator:Qz(iK(e).entries),kind:t})}),"Iterator",(function(){var e=oK(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),MK=function(e){this.entries=[],this.url=null,void 0!==e&&(Xz(e)?this.parseObject(e):this.parseQuery("string"==typeof e?"?"===mK(e,0)?TK(e,1):e:qz(e)))};MK.prototype={type:tK,bindURL:function(e){this.url=e,this.update()},parseObject:function(e){var t,r,n,i,o,a,s,c=Jz(e);if(c)for(r=(t=Qz(e,c)).next;!(n=Dz(r,t)).done;){if(o=(i=Qz(Kz(n.value))).next,(a=Dz(o,i)).done||(s=Dz(o,i)).done||!Dz(o,i).done)throw pK("Expected sequence with length 2");yK(this.entries,{key:qz(a.value),value:qz(s.value)})}else for(var u in e)Gz(e,u)&&yK(this.entries,{key:u,value:qz(e[u])})},parseQuery:function(e){if(e)for(var t,r,n=kK(e,"&"),i=0;i<n.length;)(t=n[i++]).length&&(r=kK(t,"="),yK(this.entries,{key:CK(EK(r)),value:CK(gK(r,"="))}))},serialize:function(){for(var e,t=this.entries,r=[],n=0;n<t.length;)e=t[n++],yK(r,NK(e.key)+"="+NK(e.value));return gK(r,"&")},update:function(){this.entries.length=0,this.parseQuery(this.url.query)},updateURL:function(){this.url&&this.url.update()}};var LK=function(){Bz(this,UK);var e=arguments.length>0?arguments[0]:void 0;nK(this,new MK(e))},UK=LK.prototype;if(Lz(UK,{append:function(e,t){Zz(arguments.length,2);var r=iK(this);yK(r.entries,{key:qz(e),value:qz(t)}),r.updateURL()},delete:function(e){Zz(arguments.length,1);for(var t=iK(this),r=t.entries,n=qz(e),i=0;i<r.length;)r[i].key===n?bK(r,i,1):i++;t.updateURL()},get:function(e){Zz(arguments.length,1);for(var t=iK(this).entries,r=qz(e),n=0;n<t.length;n++)if(t[n].key===r)return t[n].value;return null},getAll:function(e){Zz(arguments.length,1);for(var t=iK(this).entries,r=qz(e),n=[],i=0;i<t.length;i++)t[i].key===r&&yK(n,t[i].value);return n},has:function(e){Zz(arguments.length,1);for(var t=iK(this).entries,r=qz(e),n=0;n<t.length;)if(t[n++].key===r)return!0;return!1},set:function(e,t){Zz(arguments.length,1);for(var r,n=iK(this),i=n.entries,o=!1,a=qz(e),s=qz(t),c=0;c<i.length;c++)(r=i[c]).key===a&&(o?bK(i,c--,1):(o=!0,r.value=s));o||yK(i,{key:a,value:s}),n.updateURL()},sort:function(){var e=iK(this);$z(e.entries,(function(e,t){return e.key>t.key?1:-1})),e.updateURL()},forEach:function(e){for(var t,r=iK(this).entries,n=Hz(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 PK(this,"keys")},values:function(){return new PK(this,"values")},entries:function(){return new PK(this,"entries")}},{enumerable:!0}),Mz(UK,eK,UK.entries,{name:"entries"}),Mz(UK,"toString",(function(){return iK(this).serialize()}),{enumerable:!0}),Uz(LK,tK),Cz({global:!0,constructor:!0,forced:!Pz},{URLSearchParams:LK}),!Pz&&jz(dK)){var VK=xz(hK.has),FK=xz(hK.set),BK=function(e){if(Xz(e)){var t,r=e.body;if(zz(r)===tK)return t=e.headers?new dK(e.headers):new dK,VK(t,"content-type")||FK(t,"content-type","application/x-www-form-urlencoded;charset=UTF-8"),Wz(e,{body:Yz(0,qz(r)),headers:Yz(0,t)})}return e};if(jz(cK)&&Cz({global:!0,enumerable:!0,dontCallGetSet:!0,forced:!0},{fetch:function(e){return cK(e,arguments.length>1?BK(arguments[1]):{})}}),jz(uK)){var jK=function(e){return Bz(this,lK),new uK(e,arguments.length>1?BK(arguments[1]):{})};lK.constructor=jK,jK.prototype=lK,Cz({global:!0,constructor:!0,dontCallGetSet:!0,forced:!0},{Request:jK})}}var GK,HK=Rr,zK=w,KK=uz,XK=n,qK=Yt,WK=b,YK=li,QK=function(e,t,r){return dz.f(e,t,r)},JK=vf,ZK=Ye,$K=qE,eX=zk,tX=ni,rX=Il.codeAt,nX=function(e){var t,r,n=[],i=Tz(kz(Iz(e),pz,"."),".");for(t=0;t<i.length;t++)r=i[t],bz(n,mz(fz,r)?"xn--"+wz(r):r);return Ez(n,".")},iX=gn,oX=Mi,aX=Af,sX={URLSearchParams:LK,getState:iK},cX=Zi,uX=cX.set,dX=cX.getterFor("URL"),lX=sX.URLSearchParams,hX=sX.getState,fX=XK.URL,pX=XK.TypeError,vX=XK.parseInt,_X=Math.floor,mX=Math.pow,gX=WK("".charAt),yX=WK(/./.exec),SX=WK([].join),EX=WK(1..toString),bX=WK([].pop),kX=WK([].push),TX=WK("".replace),IX=WK([].shift),AX=WK("".split),RX=WK("".slice),wX=WK("".toLowerCase),CX=WK([].unshift),OX="Invalid scheme",DX="Invalid host",xX="Invalid port",NX=/[a-z]/i,PX=/[\d+-.a-z]/i,MX=/\d/,LX=/^0x/i,UX=/^[0-7]+$/,VX=/^\d+$/,FX=/^[\da-f]+$/i,BX=/[\0\t\n\r #%/:<>?@[\\\]^|]/,jX=/[\0\t\n\r #/:<>?@[\\\]^|]/,GX=/^[\u0000-\u0020]+|[\u0000-\u0020]+$/g,HX=/[\t\n\r]/g,zX=function(e){var t,r,n,i;if("number"==typeof e){for(t=[],r=0;r<4;r++)CX(t,e%256),e=_X(e/256);return SX(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+=EX(e[r],16),r<7&&(t+=":")));return"["+t+"]"}return e},KX={},XX=$K({},KX,{" ":1,'"':1,"<":1,">":1,"`":1}),qX=$K({},XX,{"#":1,"?":1,"{":1,"}":1}),WX=$K({},qX,{"/":1,":":1,";":1,"=":1,"@":1,"[":1,"\\":1,"]":1,"^":1,"|":1}),YX=function(e,t){var r=rX(e,0);return r>32&&r<127&&!ZK(t,e)?e:encodeURIComponent(e)},QX={ftp:21,file:null,http:80,https:443,ws:80,wss:443},JX=function(e,t){var r;return 2==e.length&&yX(NX,gX(e,0))&&(":"==(r=gX(e,1))||!t&&"|"==r)},ZX=function(e){var t;return e.length>1&&JX(RX(e,0,2))&&(2==e.length||"/"===(t=gX(e,2))||"\\"===t||"?"===t||"#"===t)},$X=function(e){return"."===e||"%2e"===wX(e)},eq={},tq={},rq={},nq={},iq={},oq={},aq={},sq={},cq={},uq={},dq={},lq={},hq={},fq={},pq={},vq={},_q={},mq={},gq={},yq={},Sq={},Eq=function(e,t,r){var n,i,o,a=iX(e);if(t){if(i=this.parse(a))throw pX(i);this.searchParams=null}else{if(void 0!==r&&(n=new Eq(r,!0)),i=this.parse(a,null,n))throw pX(i);(o=hX(new lX)).bindURL(this),this.searchParams=o}};Eq.prototype={type:"URL",parse:function(e,t,r){var n,i,o,a,s,c=this,u=t||eq,d=0,l="",h=!1,f=!1,p=!1;for(e=iX(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=TX(e,GX,"")),e=TX(e,HX,""),n=eX(e);d<=n.length;){switch(i=n[d],u){case eq:if(!i||!yX(NX,i)){if(t)return OX;u=rq;continue}l+=wX(i),u=tq;break;case tq:if(i&&(yX(PX,i)||"+"==i||"-"==i||"."==i))l+=wX(i);else{if(":"!=i){if(t)return OX;l="",u=rq,d=0;continue}if(t&&(c.isSpecial()!=ZK(QX,l)||"file"==l&&(c.includesCredentials()||null!==c.port)||"file"==c.scheme&&!c.host))return;if(c.scheme=l,t)return void(c.isSpecial()&&QX[c.scheme]==c.port&&(c.port=null));l="","file"==c.scheme?u=fq:c.isSpecial()&&r&&r.scheme==c.scheme?u=nq:c.isSpecial()?u=sq:"/"==n[d+1]?(u=iq,d++):(c.cannotBeABaseURL=!0,kX(c.path,""),u=gq)}break;case rq:if(!r||r.cannotBeABaseURL&&"#"!=i)return OX;if(r.cannotBeABaseURL&&"#"==i){c.scheme=r.scheme,c.path=tX(r.path),c.query=r.query,c.fragment="",c.cannotBeABaseURL=!0,u=Sq;break}u="file"==r.scheme?fq:oq;continue;case nq:if("/"!=i||"/"!=n[d+1]){u=oq;continue}u=cq,d++;break;case iq:if("/"==i){u=uq;break}u=mq;continue;case oq:if(c.scheme=r.scheme,i==GK)c.username=r.username,c.password=r.password,c.host=r.host,c.port=r.port,c.path=tX(r.path),c.query=r.query;else if("/"==i||"\\"==i&&c.isSpecial())u=aq;else if("?"==i)c.username=r.username,c.password=r.password,c.host=r.host,c.port=r.port,c.path=tX(r.path),c.query="",u=yq;else{if("#"!=i){c.username=r.username,c.password=r.password,c.host=r.host,c.port=r.port,c.path=tX(r.path),c.path.length--,u=mq;continue}c.username=r.username,c.password=r.password,c.host=r.host,c.port=r.port,c.path=tX(r.path),c.query=r.query,c.fragment="",u=Sq}break;case aq:if(!c.isSpecial()||"/"!=i&&"\\"!=i){if("/"!=i){c.username=r.username,c.password=r.password,c.host=r.host,c.port=r.port,u=mq;continue}u=uq}else u=cq;break;case sq:if(u=cq,"/"!=i||"/"!=gX(l,d+1))continue;d++;break;case cq:if("/"!=i&&"\\"!=i){u=uq;continue}break;case uq:if("@"==i){h&&(l="%40"+l),h=!0,o=eX(l);for(var v=0;v<o.length;v++){var _=o[v];if(":"!=_||p){var m=YX(_,WX);p?c.password+=m:c.username+=m}else p=!0}l=""}else if(i==GK||"/"==i||"?"==i||"#"==i||"\\"==i&&c.isSpecial()){if(h&&""==l)return"Invalid authority";d-=eX(l).length+1,l="",u=dq}else l+=i;break;case dq:case lq:if(t&&"file"==c.scheme){u=vq;continue}if(":"!=i||f){if(i==GK||"/"==i||"?"==i||"#"==i||"\\"==i&&c.isSpecial()){if(c.isSpecial()&&""==l)return DX;if(t&&""==l&&(c.includesCredentials()||null!==c.port))return;if(a=c.parseHost(l))return a;if(l="",u=_q,t)return;continue}"["==i?f=!0:"]"==i&&(f=!1),l+=i}else{if(""==l)return DX;if(a=c.parseHost(l))return a;if(l="",u=hq,t==lq)return}break;case hq:if(!yX(MX,i)){if(i==GK||"/"==i||"?"==i||"#"==i||"\\"==i&&c.isSpecial()||t){if(""!=l){var g=vX(l,10);if(g>65535)return xX;c.port=c.isSpecial()&&g===QX[c.scheme]?null:g,l=""}if(t)return;u=_q;continue}return xX}l+=i;break;case fq:if(c.scheme="file","/"==i||"\\"==i)u=pq;else{if(!r||"file"!=r.scheme){u=mq;continue}if(i==GK)c.host=r.host,c.path=tX(r.path),c.query=r.query;else if("?"==i)c.host=r.host,c.path=tX(r.path),c.query="",u=yq;else{if("#"!=i){ZX(SX(tX(n,d),""))||(c.host=r.host,c.path=tX(r.path),c.shortenPath()),u=mq;continue}c.host=r.host,c.path=tX(r.path),c.query=r.query,c.fragment="",u=Sq}}break;case pq:if("/"==i||"\\"==i){u=vq;break}r&&"file"==r.scheme&&!ZX(SX(tX(n,d),""))&&(JX(r.path[0],!0)?kX(c.path,r.path[0]):c.host=r.host),u=mq;continue;case vq:if(i==GK||"/"==i||"\\"==i||"?"==i||"#"==i){if(!t&&JX(l))u=mq;else if(""==l){if(c.host="",t)return;u=_q}else{if(a=c.parseHost(l))return a;if("localhost"==c.host&&(c.host=""),t)return;l="",u=_q}continue}l+=i;break;case _q:if(c.isSpecial()){if(u=mq,"/"!=i&&"\\"!=i)continue}else if(t||"?"!=i)if(t||"#"!=i){if(i!=GK&&(u=mq,"/"!=i))continue}else c.fragment="",u=Sq;else c.query="",u=yq;break;case mq:if(i==GK||"/"==i||"\\"==i&&c.isSpecial()||!t&&("?"==i||"#"==i)){if(".."===(s=wX(s=l))||"%2e."===s||".%2e"===s||"%2e%2e"===s?(c.shortenPath(),"/"==i||"\\"==i&&c.isSpecial()||kX(c.path,"")):$X(l)?"/"==i||"\\"==i&&c.isSpecial()||kX(c.path,""):("file"==c.scheme&&!c.path.length&&JX(l)&&(c.host&&(c.host=""),l=gX(l,0)+":"),kX(c.path,l)),l="","file"==c.scheme&&(i==GK||"?"==i||"#"==i))for(;c.path.length>1&&""===c.path[0];)IX(c.path);"?"==i?(c.query="",u=yq):"#"==i&&(c.fragment="",u=Sq)}else l+=YX(i,qX);break;case gq:"?"==i?(c.query="",u=yq):"#"==i?(c.fragment="",u=Sq):i!=GK&&(c.path[0]+=YX(i,KX));break;case yq:t||"#"!=i?i!=GK&&("'"==i&&c.isSpecial()?c.query+="%27":c.query+="#"==i?"%23":YX(i,KX)):(c.fragment="",u=Sq);break;case Sq:i!=GK&&(c.fragment+=YX(i,XX))}d++}},parseHost:function(e){var t,r,n;if("["==gX(e,0)){if("]"!=gX(e,e.length-1))return DX;if(t=function(e){var t,r,n,i,o,a,s,c=[0,0,0,0,0,0,0,0],u=0,d=null,l=0,h=function(){return gX(e,l)};if(":"==h()){if(":"!=gX(e,1))return;l+=2,d=++u}for(;h();){if(8==u)return;if(":"!=h()){for(t=r=0;r<4&&yX(FX,h());)t=16*t+vX(h(),16),l++,r++;if("."==h()){if(0==r)return;if(l-=r,u>6)return;for(n=0;h();){if(i=null,n>0){if(!("."==h()&&n<4))return;l++}if(!yX(MX,h()))return;for(;yX(MX,h());){if(o=vX(h(),10),null===i)i=o;else{if(0==i)return;i=10*i+o}if(i>255)return;l++}c[u]=256*c[u]+i,2!=++n&&4!=n||u++}if(4!=n)return;break}if(":"==h()){if(l++,!h())return}else if(h())return;c[u++]=t}else{if(null!==d)return;l++,d=++u}}if(null!==d)for(a=u-d,u=7;0!=u&&a>0;)s=c[u],c[u--]=c[d+a-1],c[d+--a]=s;else if(8!=u)return;return c}(RX(e,1,-1)),!t)return DX;this.host=t}else if(this.isSpecial()){if(e=nX(e),yX(BX,e))return DX;if(t=function(e){var t,r,n,i,o,a,s,c=AX(e,".");if(c.length&&""==c[c.length-1]&&c.length--,(t=c.length)>4)return e;for(r=[],n=0;n<t;n++){if(""==(i=c[n]))return e;if(o=10,i.length>1&&"0"==gX(i,0)&&(o=yX(LX,i)?16:8,i=RX(i,8==o?1:2)),""===i)a=0;else{if(!yX(10==o?VX:8==o?UX:FX,i))return e;a=vX(i,o)}kX(r,a)}for(n=0;n<t;n++)if(a=r[n],n==t-1){if(a>=mX(256,5-t))return null}else if(a>255)return null;for(s=bX(r),n=0;n<r.length;n++)s+=r[n]*mX(256,3-n);return s}(e),null===t)return DX;this.host=t}else{if(yX(jX,e))return DX;for(t="",r=eX(e),n=0;n<r.length;n++)t+=YX(r[n],KX);this.host=t}},cannotHaveUsernamePasswordPort:function(){return!this.host||this.cannotBeABaseURL||"file"==this.scheme},includesCredentials:function(){return""!=this.username||""!=this.password},isSpecial:function(){return ZK(QX,this.scheme)},shortenPath:function(){var e=this.path,t=e.length;!t||"file"==this.scheme&&1==t&&JX(e[0],!0)||e.length--},serialize:function(){var e=this,t=e.scheme,r=e.username,n=e.password,i=e.host,o=e.port,a=e.path,s=e.query,c=e.fragment,u=t+":";return null!==i?(u+="//",e.includesCredentials()&&(u+=r+(n?":"+n:"")+"@"),u+=zX(i),null!==o&&(u+=":"+o)):"file"==t&&(u+="//"),u+=e.cannotBeABaseURL?a[0]:a.length?"/"+SX(a,"/"):"",null!==s&&(u+="?"+s),null!==c&&(u+="#"+c),u},setHref:function(e){var t=this.parse(e);if(t)throw pX(t);this.searchParams.update()},getOrigin:function(){var e=this.scheme,t=this.port;if("blob"==e)try{return new bq(e.path[0]).origin}catch(EW){return"null"}return"file"!=e&&this.isSpecial()?e+"://"+zX(this.host)+(null!==t?":"+t:""):"null"},getProtocol:function(){return this.scheme+":"},setProtocol:function(e){this.parse(iX(e)+":",eq)},getUsername:function(){return this.username},setUsername:function(e){var t=eX(iX(e));if(!this.cannotHaveUsernamePasswordPort()){this.username="";for(var r=0;r<t.length;r++)this.username+=YX(t[r],WX)}},getPassword:function(){return this.password},setPassword:function(e){var t=eX(iX(e));if(!this.cannotHaveUsernamePasswordPort()){this.password="";for(var r=0;r<t.length;r++)this.password+=YX(t[r],WX)}},getHost:function(){var e=this.host,t=this.port;return null===e?"":null===t?zX(e):zX(e)+":"+t},setHost:function(e){this.cannotBeABaseURL||this.parse(e,dq)},getHostname:function(){var e=this.host;return null===e?"":zX(e)},setHostname:function(e){this.cannotBeABaseURL||this.parse(e,lq)},getPort:function(){var e=this.port;return null===e?"":iX(e)},setPort:function(e){this.cannotHaveUsernamePasswordPort()||(""==(e=iX(e))?this.port=null:this.parse(e,hq))},getPathname:function(){var e=this.path;return this.cannotBeABaseURL?e[0]:e.length?"/"+SX(e,"/"):""},setPathname:function(e){this.cannotBeABaseURL||(this.path=[],this.parse(e,_q))},getSearch:function(){var e=this.query;return e?"?"+e:""},setSearch:function(e){""==(e=iX(e))?this.query=null:("?"==gX(e,0)&&(e=RX(e,1)),this.query="",this.parse(e,yq)),this.searchParams.update()},getSearchParams:function(){return this.searchParams.facade},getHash:function(){var e=this.fragment;return e?"#"+e:""},setHash:function(e){""!=(e=iX(e))?("#"==gX(e,0)&&(e=RX(e,1)),this.fragment="",this.parse(e,Sq)):this.fragment=null},update:function(){this.query=this.searchParams.serialize()||null}};var bq=function(e){var t=JK(this,kq),r=aX(arguments.length,1)>1?arguments[1]:void 0,n=uX(t,new Eq(e,!1,r));zK||(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())},kq=bq.prototype,Tq=function(e,t){return{get:function(){return dX(this)[e]()},set:t&&function(e){return dX(this)[t](e)},configurable:!0,enumerable:!0}};if(zK&&(QK(kq,"href",Tq("serialize","setHref")),QK(kq,"origin",Tq("getOrigin")),QK(kq,"protocol",Tq("getProtocol","setProtocol")),QK(kq,"username",Tq("getUsername","setUsername")),QK(kq,"password",Tq("getPassword","setPassword")),QK(kq,"host",Tq("getHost","setHost")),QK(kq,"hostname",Tq("getHostname","setHostname")),QK(kq,"port",Tq("getPort","setPort")),QK(kq,"pathname",Tq("getPathname","setPathname")),QK(kq,"search",Tq("getSearch","setSearch")),QK(kq,"searchParams",Tq("getSearchParams")),QK(kq,"hash",Tq("getHash","setHash"))),YK(kq,"toJSON",(function(){return dX(this).serialize()}),{enumerable:!0}),YK(kq,"toString",(function(){return dX(this).serialize()}),{enumerable:!0}),fX){var Iq=fX.createObjectURL,Aq=fX.revokeObjectURL;Iq&&YK(bq,"createObjectURL",qK(Iq,fX)),Aq&&YK(bq,"revokeObjectURL",qK(Aq,fX))}oX(bq,"URL"),HK({global:!0,constructor:!0,forced:!KK,sham:!zK},{URL:bq});var Rq=ee.URL,wq=function(){var e=km(Em().mark((function e(t,r){var n;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=new Audio(Rq.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)}}(),Cq=ad,Oq=tc,Dq=function(e,t,r,n){for(var i,o=n>1?void 0:n?Oq(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&&Cq(t,r,o),o},xq=function(){function e(t){Wd(this,e),sd(this,"_sharedAudioContext",new AudioContext),sd(this,"_audioDestination",this._sharedAudioContext.createMediaStreamDestination()),sd(this,"_localGainNode",this._sharedAudioContext.createGain()),sd(this,"_bufferGainNode",this._sharedAudioContext.createGain()),sd(this,"_audioBufferSource",void 0),sd(this,"_localSource",void 0),sd(this,"_context",void 0),sd(this,"_failedAudioList",[]),sd(this,"_startingIds",new yE),sd(this,"_revokeURLs",new $M),sd(this,"mixingMap",new yE),sd(this,"resourcesCache",new yE),sd(this,"volumeConfig",new yE),sd(this,"cachedBuffer",[]),sd(this,"id","AudioMixingManager"),this._context=t,this._localGainNode.gain.value=1}var t,r,n;return qd(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=km(Em().mark((function e(t,r,n){var i,o,a,s,c,u,d,l,h,f,p,v,_,m=this;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(void 0===this._startingIds.get(t)){e.next=3;break}return console.warn("AudioMixing task id: ".concat(t," is starting")),e.abrupt("return");case 3:if(this._startingIds.set(t,t),console.log(this._startingIds),i=n.playCount,Kw(o=n.type,"mixingType",az(Gd)),a=this._context.getLocalAudioTrack()){e.next=10;break}return e.abrupt("return");case 10:if((s=a.getTrack("preprocessing"))&&this.mixMediaStream(new MediaStream([s])),null!=(c=this.mixingMap.get(t))&&c.audioNode){c.audioNode.pause(),this._context.emitMessage({mixId:t,state:Hd.AUDIO_MIXING_STATE_STOPPED,error:dR.AUDIO_MIXING_ERROR_OK});try{c.gainNode.disconnect(this._audioDestination),c.audioSource.disconnect(c.gainNode)}catch(g){}}if(!(d=this.resourcesCache.get(t))||d.filePath!==r){e.next=19;break}u=d.getAudioNode(),e.next=32;break;case 19:return e.next=21,fetch(r,{mode:"cors",credentials:"include"}).then((function(e){if(e.ok)return e.arrayBuffer();throw m._context.emitMessage({mixId:t,state:Hd.AUDIO_MIXING_STATE_FAILED,error:dR.AUDIO_MIXING_ERROR_START_FAILED}),new lR(uR.LOAD_RESOURCES_FAILED,e.statusText)}));case 21:return l=e.sent,db(r).call(r,"mp3")?h={type:"audio/mpeg"}:db(r).call(r,"aac")&&(h={type:"audio/aac"}),e.next=25,wq(l,h);case 25:if(e.sent){e.next=29;break}throw this._context.emitMessage({mixId:t,state:Hd.AUDIO_MIXING_STATE_FAILED,error:dR.AUDIO_MIXING_ERROR_START_FAILED}),new lR(uR.LOAD_RESOURCES_FAILED,"invalid audio resource");case 29:(u=new Audio).crossOrigin="anonymous",u.src=Rq.createObjectURL(new Blob([l],h));case 32:return i<=0?u.loop=!0:i>0&&(f=i,u.onended=function(){--f>0?u.play():(m.mixingMap.delete(t),m._context.emitMessage({mixId:t,state:Hd.AUDIO_MIXING_STATE_FINISHED,error:dR.AUDIO_MIXING_ERROR_OK}))}),e.prev=33,e.next=36,u.play();case 36:e.next=43;break;case 38:e.prev=38,e.t0=e.catch(33),console.error(e.t0),this._failedAudioList.push(u),this._context.onAutoPlayFailed({userId:this.id,kind:"audio",streamIndex:yd.STREAM_INDEX_MAIN,mediaType:Sd.AUDIO});case 43:if(this._startingIds.delete(t),p=this._sharedAudioContext.createMediaElementSource(u),v=this._sharedAudioContext.createGain(),_=this.volumeConfig.get(t),v.gain.value=_?_/100:1,p.connect(v).connect(this._audioDestination),this.mixingMap.set(t,{audioSource:p,audioNode:u,gainNode:v,type:"file"}),o===Gd.PUBLISH)try{v.disconnect(this._sharedAudioContext.destination)}catch(g){}else v.connect(this._sharedAudioContext.destination);this._context.updateLocalAudioTrack(this._audioDestination.stream.getAudioTracks()[0],n.type),this._context.emitMessage({mixId:t,state:Hd.AUDIO_MIXING_STATE_PLAYING,error:dR.AUDIO_MIXING_ERROR_OK});case 53:case"end":return e.stop()}}),e,this,[[33,38]])}))),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:Hd.AUDIO_MIXING_STATE_STOPPED,error:dR.AUDIO_MIXING_ERROR_OK}))}},{key:"pauseAudioMixing",value:function(e){var t=this.mixingMap.get(e);t&&(this._context.emitMessage({mixId:e,state:Hd.AUDIO_MIXING_STATE_PAUSED,error:dR.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:Hd.AUDIO_MIXING_STATE_PLAYING,error:dR.AUDIO_MIXING_ERROR_OK}),t.audioNode.play())}},{key:"preloadAudioMixing",value:(r=km(Em().mark((function e(t,r){var n,i,o=this;return Em().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 new lR(uR.LOAD_RESOURCES_FAILED,e.statusText)})).catch((function(e){if(o._context.emitMessage({mixId:t,state:Hd.AUDIO_MIXING_STATE_FAILED,error:dR.AUDIO_MIXING_ERROR_PRELOAD_FAILED}),e instanceof lR)throw e;throw new lR(uR.LOAD_RESOURCES_FAILED,"Load resources failed",e)}));case 3:return n=e.sent,db(r).call(r,"mp3")?i={type:"audio/mpeg"}:db(r).call(r,"aac")&&(i={type:"audio/aac"}),e.next=7,wq(n,i);case 7:if(e.sent){e.next=11;break}throw this._context.emitMessage({mixId:t,state:Hd.AUDIO_MIXING_STATE_FAILED,error:dR.AUDIO_MIXING_ERROR_PRELOAD_FAILED}),new lR(uR.LOAD_RESOURCES_FAILED,"Load resources failed");case 11:return this._context.emitMessage({mixId:t,state:Hd.AUDIO_MIXING_STATE_PRELOADED,error:dR.AUDIO_MIXING_ERROR_OK}),this.resourcesCache.set(t,{getAudioNode:function(){var e=Rq.createObjectURL(new Blob([n],i));return o._revokeURLs.add(e),new Audio(e)},filePath:r,duration:0}),e.next=15,new X_((function(e){var r=Rq.createObjectURL(new Blob([n],i)),a=new Audio(r);a.addEventListener("durationchange",(function(){var n=o.resourcesCache.get(t);n&&(n.duration=a.duration,o.resourcesCache.set(t,n)),Rq.revokeObjectURL(r),e(null)}))}));case 15: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.resourcesCache.get(e);return t||r?t?1e3*t.audioNode.duration:r?1e3*r.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){Kw(e,"type",az(Gd));var t=this._context.getLocalAudioTrack();if(t){var r=t.getTrack("preprocessing");if(r&&this.mixMediaStream(new MediaStream([r])),e===Gd.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:Hd.AUDIO_MIXING_STATE_PCM_ENABLED,error:dR.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:Hd.AUDIO_MIXING_STATE_PCM_DISABLED,error:dR.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=km(Em().mark((function e(){var t,r,n,i;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:t=[],r=QT(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({userId:this.id,kind:"audio",streamIndex:yd.STREAM_INDEX_MAIN,mediaType:Sd.AUDIO}),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(),this._startingIds=new yE,this._revokeURLs.forEach((function(e){Rq.revokeObjectURL(e)}))}}]),e}();Dq([pN("default","id","filePath","options")],xq.prototype,"startAudioMixing",1),Dq([pN("default","id")],xq.prototype,"stopAudioMixing",1),Dq([pN("default","id")],xq.prototype,"pauseAudioMixing",1),Dq([pN("default","id")],xq.prototype,"resumeAudioMixing",1),Dq([pN("default","id")],xq.prototype,"preloadAudioMixing",1),Dq([pN("default","id")],xq.prototype,"unloadAudioMixing",1),Dq([pN("default","id")],xq.prototype,"getAudioMixingVolume",1),Dq([pN("default","id","volume")],xq.prototype,"setAudioMixingVolume",1),Dq([pN("default","id")],xq.prototype,"getAudioMixingDuration",1),Dq([pN("default","id")],xq.prototype,"getAudioMixingCurrentPosition",1),Dq([pN("default","id","position")],xq.prototype,"setAudioMixingPosition",1),Dq([pN("default","type")],xq.prototype,"enableAudioMixingBuffer",1),Dq([pN()],xq.prototype,"disableAudioMixingBuffer",1),Dq([pN("default","buffer")],xq.prototype,"pushAudioMixingBuffer",1);var Nq=function(e){return e.NORMAL_USER="normalUser",e.SILENT_USER="silentUser",e}(Nq||{}),Pq=new RC("RTMClient",1),Mq=function(e){OI(u,e);var t,r,n,i,o,a,s,c=qI(u);function u(e,t){var r;return Wd(this,u),sd(ZT(r=c.call(this)),"_dataChannelSignal",null),sd(ZT(r),"_handler",null),sd(ZT(r),"_dataChannelSignalState",_F.DISCONNECTED),sd(ZT(r),"_loginSessionId",null),sd(ZT(r),"_userId",null),sd(ZT(r),"_token",null),sd(ZT(r),"_isReconnecting",!1),sd(ZT(r),"_reconnectTimer",null),sd(ZT(r),"_loginResolveCallback",null),sd(ZT(r),"_loginRejectCallback",null),sd(ZT(r),"_iceConfigNode",null),sd(ZT(r),"_wait_login_token",!1),sd(ZT(r),"_serverParamsCache",void 0),r.id=e,r._appId=t,r}return qd(u,[{key:"login",value:function(e,t){var r=this;return new X_((function(n,i){if(Pq.print("login","invoke login, token: %o, userId: %o",e,t),r._loginSessionId)throw new lR(uR.ALREADY_LOGIN,"Already logined");if(r._loginResolveCallback)throw new lR(uR.LOGIN_FAILED,"Is logging in, please try again later.");r._userId=t,r._token=e,cN.setStats({rtc_app_id:r._appId,rtm_user_id:t}),r._loginResolveCallback=n,r._loginRejectCallback=i,r._dataChannelSignal?r._login():(Pq.print("login","init dataChannelSingling"),r._dataChannelSignalState=_F.CONNECTING,r._createDataChannelSignaling(t).then((function(e){r._dataChannelSignal=e,r._login()})).catch((function(){r._onDisconnect()})))}))}},{key:"logout",value:(s=km(Em().mark((function e(){var t;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._loginSessionId&&this._userId){e.next=2;break}throw new lR(uR.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:fP.C2RTM}).catch((function(){}));case 4:this._closeDataChannelSignaling(),this._clearState();case 6:case"end":return e.stop()}}),e,this)}))),function(){return s.apply(this,arguments)})},{key:"updateLoginToken",value:(a=km(Em().mark((function e(t){var r=this;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this._token=t,e.abrupt("return",new X_((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 a.apply(this,arguments)})},{key:"getPeerOnlineStatus",value:(o=km(Em().mark((function e(t){var r;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._loginSessionId&&this._userId){e.next=2;break}throw new lR(uR.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:fP.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 o.apply(this,arguments)})},{key:"sendUserMessageOutsideRoom",value:(i=km(Em().mark((function e(t,r){return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._loginSessionId&&this._userId){e.next=2;break}throw new lR(uR.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=km(Em().mark((function e(t,r){return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(e.prev=0,zw(t,"signature"),zw(r,"url"),this._loginSessionId&&this._userId){e.next=5;break}throw new lR(uR.NOT_LOGIN,"login first");case 5:return this._checkDataChannelSignal(),e.next=8,this._dataChannelSignal.sendSignaling("setServerParams",{loginSessionId:this._loginSessionId,userId:this._userId,appId:this._appId,signature:t,url:r},{functionType:fP.C2RTM}).catch((function(e){throw new lR(uR.UNEXPECTED_ERROR,e.msg)}));case 8:this._serverParamsCache={signature:t,url:r},this.emit("onServerParamsSetResult"),e.next=16;break;case 12:throw e.prev=12,e.t0=e.catch(0),this.emit("onServerParamsSetResult",e.t0),e.t0;case 16:case"end":return e.stop()}}),e,this,[[0,12]])}))),function(e,t){return n.apply(this,arguments)})},{key:"sendServerMessage",value:(r=km(Em().mark((function e(t){return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._loginSessionId&&this._userId){e.next=2;break}throw new lR(uR.NOT_LOGIN,"login first");case 2:return this._checkDataChannelSignal(),e.abrupt("return",this._dataChannelSignal.sendP2PMessage({from:this._userId,app:this._appId,to:"",room:"",type:KN.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(),wI(AI(u.prototype),"removeAllListeners",this).call(this),delete this._serverParamsCache}},{key:"_login",value:function(){var e=this;if(this._userId){var t=aw();this._checkDataChannelSignal(),this._dataChannelSignal.sendSignaling("login",{Token:dw.token2auth(this._appId,null,this._userId,this._token),timestamp:Date.now(),loginSessionId:t,params:{deviceType:"web",userAgent:window.navigator.userAgent,sdkVersion:CN.VERSION,deviceId:TN.getDeviceId(),appId:this._appId,userId:this._userId}},{functionType:fP.C2RTM}).then((function(){"function"==typeof e._loginResolveCallback&&e._loginResolveCallback(),e._loginSessionId=t,tP(e.id,t),e._wait_login_token=!1,e._serverParamsCache&&e.setServerParams(e._serverParamsCache.signature,e._serverParamsCache.url)})).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=uR.INVALID_PARAMS,n="Invalid userId"):(r=uR.INVALID_TOKEN,n="Invalid token",e._wait_login_token=!0,e._loginRejectCallback||e.emit("onRTMTokenError")):(r=uR.LOGIN_FAILED,n="login failed"),"function"==typeof e._loginRejectCallback&&e._loginRejectCallback(new lR(r,a||n))})).finally((function(){e._loginResolveCallback=null,e._loginRejectCallback=null}))}}},{key:"_createDataChannelSignaling",value:(t=km(Em().mark((function e(t){var r,n,i,o,a,s,c,u=this;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=new mP,i=this._iceConfigNode){e.next=16;break}return e.prev=3,e.next=6,null==n?void 0:n.getAccessNode(this._appId,"",t,TN.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),_N("rtm.login.getNodeFailed","",0,!0),new lR(uR.ICE_SERVER_WRONG,"get ICE config failed");case 16:return _N("rtm.login.getNodeSuccess",i,0,!0),Pq.print("_createDataChannelSignaling()","get node success",i),this._handler=rF(oN),null===(r=this._handler)||void 0===r||r.once("disconnect",(function(){Pq.print("_createDataChannelSignaling()","recv BasicHandler event: disconnect"),u._onDisconnect()})),e.prev=20,e.next=23,null===(s=this._handler)||void 0===s?void 0:s.connect(i);case 23:a=e.sent,Pq.print("_createDataChannelSignaling()","establish peerConnection success"),this._dataChannelSignalState=_F.CONNECTED,e.next=33;break;case 28:throw e.prev=28,e.t1=e.catch(20),this._iceConfigNode=null,this._dataChannelSignalState=_F.DISCONNECTED,new lR(uR.ESTABLISH_DATACHANNEL_FAILED,"establish dataChannel failed",e.t1);case 33:return c=new pP(this.id,a),Pq.print("_createDataChannelSignaling()","send ping"),c.sendPingSignaling(),c.once("close",(function(){Pq.print("_createDataChannelSignaling()","recv DataChannelSignaling event: close"),u._onDisconnect()})),c.on(FN.USER_MESSAGE_RECEIVED_OUTSIDE_ROOM,(function(e){u.emit("onUserMessageReceivedOutsideRoom",{userId:e.from,message:e.msg})})),c.on(FN.USER_BINARY_MESSAGE_RECEIVED_OUTSIDE_ROOM,(function(e){u.emit("onUserBinaryMessageReceivedOutsideRoom",{userId:e.from,message:e.msg})})),c.on(FN.USER_DISCONNECTION,(function(){u.emit("onUserDisconnection"),u._clearState()})),c.on(FN.NODE_CHANGE,(function(e){_N("rtm.nodeChange",tg(e),0,!0),Array.isArray(e.nodes)&&e.nodes.length&&(u._iceConfigNode=e.nodes[0]),u._loginResolveCallback&&u._loginRejectCallback?u._login():u._reconnect()})),e.abrupt("return",c);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!==_F.CONNECTED)throw new lR(uR.NOT_CONNECTED_YET,"datachannel not connect")}},{key:"_onDisconnect",value:function(){this._dataChannelSignalState=_F.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&&(Pq.print("_reconnect()","start reconnect..."),this._isReconnecting=!0,this._createDataChannelSignaling(this._userId).then((function(t){Pq.print("_reconnect()","reconnect success!"),e._dataChannelSignal=t,e._login(),e._reconnectTimer=null})).catch((function(t){Pq.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,tP(this.id,""),null!==this._reconnectTimer&&(self.clearTimeout(this._reconnectTimer),this._reconnectTimer=null)}}]),u}(uC.exports.EventEmitter),Lq=function(e){OI(o,e);var t,r,n,i=qI(o);function o(e,t,r){var n,a=r.businessId;return Wd(this,o),sd(ZT(n=i.call(this)),"_mediaServerClient",void 0),sd(ZT(n),"_appId",void 0),sd(ZT(n),"_reconnectTimer",void 0),sd(ZT(n),"remoteStreams",void 0),sd(ZT(n),"_businessId",void 0),n.id=e,n._appId=t,n.remoteStreams=new yE,n._businessId=a,n}return qd(o,[{key:"connect",value:(n=km(Em().mark((function e(){return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this._mediaServerClient=new gF({id:this.id,avSync:!0}),this._businessId&&(this._mediaServerClient.businessId=this._businessId),this._bindEvents(),e.next=5,this._mediaServerClient.connect(this._appId);case 5:case"end":return e.stop()}}),e,this)}))),function(){return n.apply(this,arguments)})},{key:"startPlayPublicStream",value:(r=km(Em().mark((function e(t){var r,n=this;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this.remoteStreams.get(t)){e.next=2;break}throw new lR(uR.REPEAT_PLAY,"repeat play public media stream");case 2:return(r=new zV(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=Mw(e),i=0;i<t.seiCount;i++)n.emit(aF.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 yE,this._mediaServerClient&&this._mediaServerClient.destroy()}},{key:"_handleReconnected",value:(t=km(Em().mark((function e(){var t,r,n,i=this;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:clearTimeout(this._reconnectTimer),t=QT(this.remoteStreams);try{for(n=function(){var e=JT(r.value,1)[0];i.remoteStreams.delete(e),i.startPlayPublicStream(e).then((function(){var t=i.remoteStreams.get(e);i.safeEmit(aF.RESUBSCRIBE,{stream:t})}))},t.s();!(r=t.n()).done;)n()}catch(o){t.e(o)}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=window.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(jN.ABNORMAL_DISCONNECTION,this._reconnect.bind(this)),null===(t=this._mediaServerClient)||void 0===t||t.on("onRemoteStreamStats",(function(e){r.emit("onRemoteStreamStats",e)}))}}]),o}(OC),Uq=new RC("AudioDeviceManager",1),Vq=function(e){OI(c,e);var t,r,n,i,o,a,s=qI(c);function c(e){var t;return Wd(this,c),sd(ZT(t=s.call(this)),"_audioLevelFetcher",void 0),sd(ZT(t),"_playbackDeviceTestTimer",void 0),sd(ZT(t),"_audioElement",void 0),sd(ZT(t),"_audioTrack",void 0),sd(ZT(t),"_mediaRecorder",void 0),sd(ZT(t),"_recoderTimer",void 0),sd(ZT(t),"_isAudioPlaybackDeviceTesting",!1),sd(ZT(t),"_isAudioDeviceRecordTesting",!1),sd(ZT(t),"_audioCaptureAndRecoderResolve",void 0),sd(ZT(t),"_onAutoplayFailed",void 0),sd(ZT(t),"_audioPlaybackDeviceId",void 0),t._extensionManager=e,t}return qd(c,[{key:"startAudioPlaybackDeviceTest",value:(a=km(Em().mark((function e(t,r){return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this._isAudioPlaybackDeviceTesting&&!this._isAudioDeviceRecordTesting){e.next=2;break}throw new lR(uR.REPEAT_DEVICE_TEST,"device test cannot be called repeatedly at the same time.");case 2:return this._isAudioPlaybackDeviceTesting=!0,Uq.print("startAudioPlaybackDeviceTest()","Invoke"),e.prev=4,e.next=7,this._playAudioFile(t,{loop:!0});case 7:e.next=14;break;case 9:throw e.prev=9,e.t0=e.catch(4),Uq.print("startAudioPlaybackDeviceTest()","error",e.t0),this.stopAudioPlaybackDeviceTest(),e.t0;case 14:this._startEmitAudioPlaybackDeviceTestVolume(r);case 15:case"end":return e.stop()}}),e,this,[[4,9]])}))),function(e,t){return a.apply(this,arguments)})},{key:"stopAudioPlaybackDeviceTest",value:function(){this._isAudioPlaybackDeviceTesting&&(Uq.print("stopAudioPlaybackDeviceTest()","Invoke"),this._isAudioPlaybackDeviceTesting=!1,this._stopEmitAudioPlaybackDeviceTestVolume(),this._destroyAudioElement())}},{key:"startAudioDeviceRecordTest",value:(o=km(Em().mark((function e(t,r){var n=this;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(window.MediaRecorder){e.next=2;break}throw new lR(uR.NOT_SUPPORTED,"Your browser does not support MediaRecorder.");case 2:if(!this._isAudioDeviceRecordTesting){e.next=4;break}throw new lR(uR.REPEAT_DEVICE_TEST,"device test cannot be called repeatedly at the same time.");case 4:return this._isAudioDeviceRecordTesting=!0,Uq.print("startAudioDeviceRecordTest()","Invoke"),this._recoderTimer=window.setTimeout((function(){Uq.print("startAudioDeviceRecordTest()","".concat(3e4,'ms automatic call method "stopAudioDeviceRecordAndPlayTest"')),n._stopAudioCaptureAndRecoder()}),3e4),e.prev=7,this._onAutoplayFailed=r,e.next=11,this._startAudioCaptureAndRecoder(t);case 11:e.next=18;break;case 13:throw e.prev=13,e.t0=e.catch(7),this._isAudioDeviceRecordTesting=!1,delete this._onAutoplayFailed,e.t0;case 18:delete this._audioCaptureAndRecoderResolve;case 19:case"end":return e.stop()}}),e,this,[[7,13]])}))),function(e,t){return o.apply(this,arguments)})},{key:"stopAudioDeviceRecordAndPlayTest",value:function(){Uq.print("stopAudioDeviceRecordAndPlayTest()","Invoke"),void 0!==this._recoderTimer&&(clearTimeout(this._recoderTimer),delete this._recoderTimer),this._stopAudioCaptureAndRecoder()}},{key:"stopAudioDevicePlayTest",value:function(){this._isAudioDeviceRecordTesting&&(Uq.print("stopAudioDevicePlayTest()","Invoke"),this._isAudioDeviceRecordTesting=!1,this.stopAudioDeviceRecordAndPlayTest(),this._stopEmitAudioPlaybackDeviceTestVolume(),this._destroyAudioElement()),delete this._onAutoplayFailed}},{key:"getRecordTrack",value:function(){return this._audioTrack}},{key:"setSinkId",value:(i=km(Em().mark((function e(t){var r;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(Uq.print("setSinkId()","Invoke"),void 0!==HTMLAudioElement.prototype.setSinkId){e.next=3;break}throw new lR(uR.NOT_SUPPORTED,"setSinkId not supported by current browser");case 3:return e.next=5,MU.getDeviceById(t);case 5:if(r=e.sent){e.next=8;break}throw new lR(uR.INVALID_DEVICE_ID,"audio playback device id ".concat(t," is invalid"));case 8:return this._audioPlaybackDeviceId=t,this._setAudioCtxSinkId(),e.abrupt("return",r);case 11:case"end":return e.stop()}}),e,this)}))),function(e){return i.apply(this,arguments)})},{key:"getSinkId",value:function(){return this._audioPlaybackDeviceId}},{key:"destroy",value:function(){Uq.print("destroy()","Invoke"),wI(AI(c.prototype),"removeAllListeners",this).call(this),this.stopAudioPlaybackDeviceTest(),this.stopAudioDevicePlayTest()}},{key:"_playAudioFile",value:(n=km(Em().mark((function e(t,r){var n,i=this;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return Uq.print("_playAudioFile()",wm(n="Invoke url=".concat(t,"; loop=")).call(n,r.loop)),e.abrupt("return",new X_((function(e,n){var o=RG("audio",{attributes:{src:t,crossOrigin:"anonymous"}});i._audioElement=o,o.loop=r.loop,i._audioLevelFetcher=new UU(o),o.onplaying=function(){o.onplaying=null,Uq.print("_playAudioFile()","onplaying"),e()},o.onerror=function(){var e=km(Em().mark((function e(t){var r,i;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:Uq.print("_playAudioFile()","onerror",t),i=t.message||(null==o||null===(r=o.error)||void 0===r?void 0:r.message),n(new lR(uR.LOAD_RESOURCES_FAILED,"Failed to play recorded audio"+(i?", reason: ".concat(i):".")));case 3:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),i._setAudioCtxSinkId().then((function(){var e,t;return null===(e=o.play())||void 0===e||null===(t=e.catch)||void 0===t?void 0:t.call(e,(function(e){var t;Uq.print("_playAudioFile()","autoplay error",e);var r=wm(t="Failed to play recorded audio, ".concat(e.name,": ")).call(t,e.message);"NotAllowedError"===e.name&&i._onAutoplayFailed?i._onAutoplayFailed((function(){var e;return X_.all([null===(e=i._audioLevelFetcher)||void 0===e?void 0:e.resume(),o.play()])})):n(new lR(uR.LOAD_RESOURCES_FAILED,r))}))}))})));case 2:case"end":return e.stop()}}),e)}))),function(e,t){return n.apply(this,arguments)})},{key:"_destroyAudioElement",value:function(){this._audioElement&&(Uq.print("_destroyAudioElement()","Invoke"),this._audioElement.onplaying=null,this._audioElement.onerror=null,this._audioElement.src="",delete this._audioElement,"function"==typeof this._audioCaptureAndRecoderResolve&&this._audioCaptureAndRecoderResolve())}},{key:"_startEmitAudioPlaybackDeviceTestVolume",value:function(e){var t=this;e=Math.max(e,100),this._audioElement&&(Uq.print("_startEmitAudioPlaybackDeviceTestVolume()","start timer(".concat(e,"ms)")),this._playbackDeviceTestTimer=self.setInterval((function(){t._audioLevelFetcher&&t.emit("onAudioPlaybackDeviceTestVolume",t._audioLevelFetcher.getAudioLevel())}),e))}},{key:"_stopEmitAudioPlaybackDeviceTestVolume",value:function(){var e;void 0!==this._playbackDeviceTestTimer&&(Uq.print("_stopEmitAudioPlaybackDeviceTestVolume()","stop timer"),self.clearInterval(this._playbackDeviceTestTimer),delete this._playbackDeviceTestTimer),null===(e=this._audioLevelFetcher)||void 0===e||e.destroy(),delete this._audioLevelFetcher}},{key:"_startAudioCaptureAndRecoder",value:(r=km(Em().mark((function e(t){var r,n=this;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,lV({},this._extensionManager);case 2:return this._audioTrack=e.sent,i=this._audioTrack.getTrack("preprocessing"),r=HU.get(i),Uq.print("startAudioDeviceRecordTest()","create microphone track success!"),e.abrupt("return",new X_((function(e,i){var o,a;"function"==typeof MediaRecorder.isTypeSupported&&(o=xb(a=["audio/webm","audio/mp4"]).call(a,(function(e){return MediaRecorder.isTypeSupported(e)})),Uq.print("startAudioDeviceRecordTest()","use mimeType: ".concat(o))),n._mediaRecorder=new MediaRecorder(r,o?{mimeType:o}:void 0);var s=n._mediaRecorder.mimeType;n._mediaRecorder.ondataavailable=function(){var r=km(Em().mark((function r(o){var a,c;return Em().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:if(!n._isAudioDeviceRecordTesting){r.next=16;break}return Uq.print("startAudioDeviceRecordTest()","get recorded file(mimeType: ".concat(s,").")),c=new Blob([o.data],{type:s}),r.prev=3,r.next=6,n._playAudioFile(Rq.createObjectURL(c),{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 lR(uR.AUDIO_DEVICE_TEST_FAILED,e.message||"mediaRecorder error"))},n._mediaRecorder.start()})));case 6:case"end":return e.stop()}var i}),e,this)}))),function(e){return r.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}},{key:"_setAudioCtxSinkId",value:(t=km(Em().mark((function e(){var t,r,n,i;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=this._audioPlaybackDeviceId){"default"===t&&(t="");try{null===(r=VU.getAudioContextInstance())||void 0===r||null===(n=r.setSinkId)||void 0===n||n.call(r,t),Uq.print("setSinkId","ctx.sinkId=".concat(t))}catch(o){Uq.print("setSinkId",wm(i="failed, ".concat(o.name," - ")).call(i,o.message))}}case 2:case"end":return e.stop()}}),e,this)}))),function(){return t.apply(this,arguments)})}]),c}(uC.exports.EventEmitter),Fq=function(){function e(t){Wd(this,e),sd(this,"_roomId",void 0),sd(this,"_constraints",{}),sd(this,"_profile",void 0),this._appId=t}return qd(e,[{key:"setRoomId",value:function(e){this._roomId=e}},{key:"setAudioProfile",value:function(e){this._profile=e}},{key:"getOpusConfigStr",value:function(){var e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",r=TN.getEngineWebConfig(this._appId,this._roomId||""),n=r.audio_encode,i=this.getConstraints(),o=i.sampleRate,a=i.channelCount,s="number"==typeof o?o:null==o?void 0:o.exact,c="number"==typeof a?a:null==a?void 0:a.exact,u={};t.split(";").forEach((function(e){var t=JT(e.split("="),2),r=t[0],n=t[1];r&&n&&(u[r]=n)}));var d=(null==n?void 0:n.bitrate)||this._getConfigByAudioProfile().bitrate;d&&(u.maxaveragebitrate=d);var l=(null==n?void 0:n.enc_sample_rate)||s;l&&(u["sprop-maxcapturerate"]=l);var h=(null==n?void 0:n.playback_rate)||s;return h&&(u.maxplaybackrate=h),(c&&c>1||null!=n&&n.stereo)&&(u["sprop-stereo"]=1,u.stereo=1),null!=n&&n.dtx&&(u.usedtx=1),sg(e=an(u)).call(e,(function(e){var t;return wm(t="".concat(e,"=")).call(t,u[e])})).join(";")}},{key:"updateConstraints",value:function(e){this._constraints=ud(ud({},this._constraints),e)}},{key:"getConstraints",value:function(){var e=ud({},this._constraints),t=TN.getEngineWebConfig(this._appId,this._roomId||"").audio_capture;Uw(null==t?void 0:t.sample_rate)||(e.sampleRate=t.sample_rate),Uw(null==t?void 0:t.channel)||(e.channelCount=t.channel),Uw(null==t?void 0:t.agc)||(e.autoGainControl=t.agc),Uw(null==t?void 0:t.ans)||(e.noiseSuppression=t.ans),Uw(null==t?void 0:t.aec)||(e.echoCancellation=t.aec);var r=this._getConfigByAudioProfile(),n=r.sampleRate,i=r.channel;return Uw(e.sampleRate)&&!Uw(n)&&(e.sampleRate=n),Uw(e.channelCount)&&!Uw(i)&&(e.channelCount=i),e}},{key:"_getConfigByAudioProfile",value:function(){var e={};switch(this._profile){case Nd.fluent:e.sampleRate=16e3,e.bitrate=24e3;break;case Nd.standard:e.sampleRate=48e3,e.bitrate=48e3;break;case Nd.hd:e.sampleRate=48e3,e.bitrate=128e3,e.channel=2;break;case Nd.standardStereo:e.sampleRate=48e3,e.bitrate=8e4,e.channel=2;break;case Nd.hdMono:e.sampleRate=48e3,e.bitrate=128e3}return e}}]),e}(),Bq=new RC("VideoSnapshot",1),jq=function(e){var t=null==e?void 0:e.domElement;if(t&&!t.paused&&4===t.readyState)return t},Gq=function(){var e=km(Em().mark((function e(t,r,n){var i,o,a,s,c,u,d,l;return Em().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(),!(c=jq(n))){e.next=16;break}return Bq.print("takeSnapshot","VideoPlayer already set."),e.next=11,a(c,c.videoWidth,c.videoHeight);case 11:return u=e.sent,Bq.print("takeSnapshot","success, cost ".concat(Date.now()-s,"ms")),e.abrupt("return",u);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 Bq.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,Bq.print("takeSnapshot","success, cost ".concat(Date.now()-s,"ms")),e.abrupt("return",l);case 29:return Bq.print("takeSnapshot","use temp video"),e.abrupt("return",new X_((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);Bq.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)}}(),Hq=function(){return{url:"",video:{codec:Ld.H264,width:640,height:360,fps:15,gop:2,kBitRate:zq(640,360,15)},audio:{codec:"AAC",kBitRate:64,sampleRate:48e3,channels:2,AACProfile:Md.LC},layout:{regions:[],appData:"",backgroundColor:"#000000"}}};function zq(e,t,r){return e*t<=288e3?r<=15?800:1200:e*t<=864e3?r<=15?1200:1800:e*t<=1152e3?r<=15?1600:2400:e*t<=2592e3?r<=15?2500:3750:r<=15?3300:5e3}function Kq(e){if("string"!=typeof e||!/^rtmps?:\/\//.test(e))throw new lR(uR.INVALID_PARAMS,"Invalid rtmp address")}function Xq(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];if(null==e||!e.length)throw new lR(uR.INVALID_PARAMS,"regions should not be empty.");var t,r=QT(e);try{for(r.s();!(t=r.n()).done;){var n=t.value;if("string"!=typeof n.userId)throw new lR(uR.INVALID_PARAMS,"region.userId(".concat(n.userId,") should be a string."));if("boolean"!=typeof n.isScreenStream)throw new lR(uR.INVALID_PARAMS,"region.isScreenStream(".concat(n.isScreenStream,") should be a boolean."))}}catch(i){r.e(i)}finally{r.f()}}function qq(e,t){var r,n,i,o=function(e,r){var n=PE(e).call(e,(function(e,t){return null==e?void 0:e[t]}),t),i=PE(e).call(e,(function(e,t){return null==e?void 0:e[t]}),Hq());return n&&r(n)?n:i},a=function(e){return e%2==0?e:e+1},s=a(o(["video","width"],(function(e){return e>=2&&e<=1920}))),c=a(o(["video","height"],(function(e){return e>=2&&e<=1920}))),u=o(["video","fps"],(function(e){return e>=1&&e<=60})),d=(null===(r=t.video)||void 0===r?void 0:r.kBitRate)||0,l=o(["audio","sampleRate"],(function(e){var t;return!!xb(t=[32e3,44100,48e3]).call(t,(function(t){return t===e||t/1e3===e}))}));return{type:"transcode",action:e,transcodeMeta:{transcode:{url:t.url},control:{protocol:"2.0"},audio:{codec:o(["audio","codec"],(function(e){return"AAC"===e})),bitRate:1e3*o(["audio","kBitRate"],(function(e){return e>=32&&e<=192})),sampleRate:l<100?1e3*l:l,channels:o(["audio","channels"],(function(e){var t;return Jm(t=[1,2]).call(t,e)})),profile:o(["audio","AACProfile"],(function(e){var t;return Jm(t=[Md.LC,Md.HEv1,Md.HEv2]).call(t,e)}))},video:{codec:o(["video","codec"],(function(e){var t;return Jm(t=["H264","H265"]).call(t,e)})),fps:u,gop:o(["video","gop"],(function(e){return e>=1&&e<=5}))*u,bitRate:1e3*(d>=16&&d<=1e4?d:zq(s,c,u)),width:s,height:c},layout:{canvas:{bgnd:o(["layout","backgroundColor"],(function(e){return/^#([0-9a-fA-F]{6}|[0-9a-fA-F]{3})$/.test(e)}))},regions:(null===(n=t.layout)||void 0===n||null===(i=n.regions)||void 0===i?void 0:sg(i).call(i,(function(e){var t,r;return{alpha:!e.alpha||+e.alpha>1||+e.alpha<=0?1:+e.alpha,uid:e.userId,zorder:!e.zorder||+e.zorder<0||+e.zorder>100?0:+e.zorder,x:!e.x||+e.x>=1||+e.x<0?0:+e.x,y:!e.y||+e.y>=1||+e.y<0?0:+e.y,w:!e.w||+e.w>1||+e.w<=0?1:+e.w,h:!e.h||+e.h>1||+e.h<=0?1:+e.h,renderMode:e.renderMode&&Jm(t=[1,2,3]).call(t,e.renderMode)?e.renderMode:1,contentControl:e.contentControl&&Jm(r=[0,1,2]).call(r,e.contentControl)?e.contentControl:0,screen:!!e.isScreenStream}})))||[],app_data:o(["layout","appData"],(function(e){return"string"==typeof e}))}}}}var Wq,Yq,Qq={getDefaultValue:Hq,checkStartParams:function(e){var t;Kq(e.url),Xq(null===(t=e.layout)||void 0===t?void 0:t.regions)},checckUpdateParams:function(e){var t;e.url&&Kq(e.url),Xq(null===(t=e.layout)||void 0===t?void 0:t.regions)},getStartParams:function(e){return qq("started",e)},getUpdateParams:function(e){return qq("layoutChanged",e)}},Jq=ad,Zq=tc,$q=function(e,t,r,n){for(var i,o=n>1?void 0:n?Zq(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&&Jq(t,r,o),o},eW=new RC("Engine",0),tW=(Yq=function(e){OI(_e,e);var t,r,n,i,o,a,s,c,u,d,l,h,f,p,v,_,m,g,y,S,E,b,k,T,I,A,R,w,C,O,D,x,N,P,M,L,U,V,F,B,j,G,H,z,K,X,q,W,Y,Q,J,Z,$,ee,te,re,ne,ie,oe,ae,se,ce,ue,de,le,he,fe,pe,ve=qI(_e);function _e(e,t){var r;return Wd(this,_e),sd(ZT(r=ve.call(this)),"id",(_e.GUID++).toString()),sd(ZT(r),"_room",void 0),sd(ZT(r),"_publicStreamManager",void 0),sd(ZT(r),"_appId",void 0),sd(ZT(r),"_businessId",void 0),sd(ZT(r),"_visibility",!0),sd(ZT(r),"_localVideoTrack",void 0),sd(ZT(r),"_localAudioTrack",void 0),sd(ZT(r),"_localImgVideoTrack",void 0),sd(ZT(r),"_localImgScreenTrack",void 0),sd(ZT(r),"_localScreenVideoTrack",void 0),sd(ZT(r),"_localScreenAudioTrack",void 0),sd(ZT(r),"_tempMixingAudioTrack",void 0),sd(ZT(r),"_videoPlayer",void 0),sd(ZT(r),"_screenPlayer",void 0),sd(ZT(r),"_remoteVideoPlayer",new yE),sd(ZT(r),"_remoteScreenPlayer",new yE),sd(ZT(r),"_remoteAudioPlayer",new yE),sd(ZT(r),"_remoteScreenAudioPlayer",new yE),sd(ZT(r),"_publicStreamAudioPlayer",new yE),sd(ZT(r),"_publicStreamVideoPlayer",new yE),sd(ZT(r),"_publicStreamIds",new yE),sd(ZT(r),"_roomConfig",void 0),sd(ZT(r),"_videoStreamConstraints",NN),sd(ZT(r),"_audioStreamConstraints",{}),sd(ZT(r),"_enableSimulcast",!1),sd(ZT(r),"_videoStreamEncodeConfig",[NN]),sd(ZT(r),"_screenStreamEncodeConfig",[PN]),sd(ZT(r),"_dummyMainImage",void 0),sd(ZT(r),"_dummyScreenImage",void 0),sd(ZT(r),"_trackSourceType",void 0),sd(ZT(r),"_liveTranscodeConfig",void 0),sd(ZT(r),"_useCloudProxy",void 0),sd(ZT(r),"_startCloudProxyTimestamp",void 0),sd(ZT(r),"_localVideoDeviceId",void 0),sd(ZT(r),"_localAudioDeviceId",void 0),sd(ZT(r),"_pauseAllSubscribeState",{audio:void 0,video:void 0,resumeStreamIds:{}}),sd(ZT(r),"_audioVolumeIndicationTimer",void 0),sd(ZT(r),"_dummyMainTimer",void 0),sd(ZT(r),"_dummyScreenTimer",void 0),sd(ZT(r),"_audioPropertiesReportTimer",null),sd(ZT(r),"_mirrorType",kd.MIRROR_TYPE_RENDER),sd(ZT(r),"_audioMixingManager",void 0),sd(ZT(r),"_pubLock",void 0),sd(ZT(r),"_rtmClient",void 0),sd(ZT(r),"_messageStatisticsObserver",void 0),sd(ZT(r),"_tempRoomInfo",void 0),sd(ZT(r),"_originIceConfigRequestUrls",void 0),sd(ZT(r),"_originConfigServerUrls",void 0),sd(ZT(r),"_originLogServerUrl",void 0),sd(ZT(r),"_extensionManager",new BU),sd(ZT(r),"_audioDeviceManager",new Vq(r._extensionManager)),sd(ZT(r),"_audioProfileManager",void 0),sd(ZT(r),"_requestManager",new gP),sd(ZT(r),"_remoteVideoConfig",new yE),sd(ZT(r),"_userPriorityMap",new yE),sd(ZT(r),"_subscribeFallbackOption",void 0),sd(ZT(r),"_cameraCapturing",!1),sd(ZT(r),"_interruptCameraCapture",!1),sd(ZT(r),"_micCapturing",!1),sd(ZT(r),"_interruptMicCapture",!1),sd(ZT(r),"_avSync",!0),sd(ZT(r),"_config",void 0),sd(ZT(r),"_needClosePreTrack",!1),sd(ZT(r),"_updateMixAudioTrack",function(){var e=km(Em().mark((function e(t){var n,i,o=arguments;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(i=o.length>1&&void 0!==o[1]?o[1]:Gd.PLAYOUT_AND_PUBLISH,eW.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)}}()),sd(ZT(r),"_onAudioMixingMessage",(function(e){r.safeEmit(Kd.onAudioMixingStateChanged,e)})),sd(ZT(r),"_onAudioMixingAutoplayFailed",(function(e){r.safeEmit(Kd.onAutoplayFailed,e)})),r._appId=e,r._pubLock=new oF("pubLock"),r._addDeviceEventHandler(),r._audioMixingManager=new xq({getLocalAudioTrack:function(){return r._localAudioTrack},updateLocalAudioTrack:r._updateMixAudioTrack,emitMessage:r._onAudioMixingMessage,onAutoPlayFailed:r._onAudioMixingAutoplayFailed}),r._audioProfileManager=new Fq(e),window.__rtc_engine__=ZT(r),window["__rtc_engine__".concat(Math.floor(100*Math.random()+1))]=ZT(r),r._trackSourceType={video:dd.VIDEO_SOURCE_TYPE_INTERNAL,screenVideo:dd.VIDEO_SOURCE_TYPE_INTERNAL,audio:ld.AUDIO_SOURCE_TYPE_INTERNAL,screenAudio:ld.AUDIO_SOURCE_TYPE_INTERNAL},r._config=t,r._rtmClient=new Mq(r.id,e),r._handleRTMClient(r._rtmClient),r._useCloudProxy=!1,r._handleAudioDeviceManager(),r._messageStatisticsObserver=new MG,r._extensionManager.setMinotor(iN),ZN(r.id),r._requestManager.getConfig(e).then((function(e){e.rts_report&&JN(e.rts_report)})),r}return qd(_e,[{key:"appId",get:function(){return this._appId},set:function(e){this._appId=e}},{key:"updateToken",value:(pe=km(Em().mark((function e(t){var r,n,i,o,a;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(eW.print("updateToken()","token: %s",t),zw(t,"token"),!this.waitForNewToken||!this._tempRoomInfo){e.next=8;break}return n=this._tempRoomInfo,i=n.config,o=n.userInfo,a=n.roomId,delete this._tempRoomInfo,e.next=7,this.joinRoom(t,a,o,i);case 7:return e.abrupt("return",e.sent);case 8:if(this._room){e.next=10;break}throw new lR(uR.UPDATE_TOKEN_BEFORE_JOIN,"update token before join room");case 10:return e.next=12,null===(r=this._room)||void 0===r?void 0:r.updateToken(t);case 12:case"end":return e.stop()}}),e,this)}))),function(e){return pe.apply(this,arguments)})},{key:"setVideoCaptureDevice",value:(fe=km(Em().mark((function e(t){var r,n,i=this;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(eW.print("setVideoCaptureDevice()","deviceId: %s",t),zw(t,"deviceId"),this._localVideoDeviceId=t,this._localVideoTrack){e.next=5;break}return e.abrupt("return");case 5:return r=iz({},this._videoStreamConstraints),"user"===t||"environment"===t||"left"===t||"right"===t?(delete r.deviceId,r.facingMode=t):r.deviceId={exact:t},this._needClosePreTrack&&(this._removeLocalTrackEvents(this._localVideoTrack),this._localVideoTrack.close(),delete this._localVideoTrack),eW.print("setVideoCaptureDevice()","start createCameraVideoTrack..."),e.next=11,uV(r,this._extensionManager).catch((function(e){if(i._localVideoTrack&&!i._localVideoTrack.dummy)return eW.print("setVideoCaptureDevice()","createCameraVideoTrack failed, stop pre VideoTrack."),i._removeLocalTrackEvents(i._localVideoTrack),i._localVideoTrack.close(),delete i._localVideoTrack,uV(r,i._extensionManager).then((function(e){return i._needClosePreTrack=!0,e})).catch(km(Em().mark((function t(){var r;return Em().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return eW.print("setVideoCaptureDevice()","createCameraVideoTrack failed, rollback."),t.next=3,uV(i._videoStreamConstraints,i._extensionManager);case 3:throw r=t.sent,i._switchTrack(r),e;case 6:case"end":return t.stop()}}),t)}))));throw e}));case 11:return n=e.sent,eW.print("setVideoCaptureDevice()","createCameraVideoTrack success."),this._videoStreamConstraints=r,this._localVideoTrack&&(this._removeLocalTrackEvents(this._localVideoTrack),this._localVideoTrack.close()),e.next=17,this._switchTrack(n);case 17:case"end":return e.stop()}}),e,this)}))),function(e){return fe.apply(this,arguments)})},{key:"setAudioCaptureDevice",value:(he=km(Em().mark((function e(t){var r;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(eW.print("setAudioCaptureDevice()","deviceId: %s",t),zw(t,"deviceId"),this._localAudioDeviceId=t,this._localAudioTrack){e.next=5;break}return e.abrupt("return");case 5:return this._audioProfileManager.updateConstraints({deviceId:{exact:t}}),this._localAudioTrack.close(),this._removeLocalTrackEvents(this._localAudioTrack),e.next=10,lV(this._audioProfileManager.getConstraints(),this._extensionManager);case 10:if(r=e.sent,this._initLocalTrackEvents(r),this._localAudioTrack=r,this._room){e.next=15;break}return e.abrupt("return");case 15:if(!this._room.hasPublished){e.next=18;break}return e.next=18,this._updatePublish();case 18:case"end":return e.stop()}}),e,this)}))),function(e){return he.apply(this,arguments)})},{key:"_addDeviceEventHandler",value:function(){MU.on(Kd.onVideoDeviceStateChanged,this._onVideoDeviceStateChange.bind(this)),MU.on(Kd.onAudioDeviceStateChanged,this._onAudioDeviceStateChange.bind(this))}},{key:"_addHandlerEventHandler",value:function(){var e,t,r,n,i,o,a,s,c,u,d,l,h,f,p,v,_,m,g,y,S,E,b,k,T,I,A,R,w,C,O,D=this;null===(e=this._room)||void 0===e||e.on(FN.ON_ADD_STREAM,this._onAddStream.bind(this)),null===(t=this._room)||void 0===t||t.on(FN.ON_REMOVE_STREAM,this._onRemoveStream.bind(this)),null===(r=this._room)||void 0===r||r.on(FN.USER_CONNECTION,this._onUserConnection.bind(this)),null===(n=this._room)||void 0===n||n.on(aF.ON_USER_LEAVE,this._onUserLeave.bind(this)),null===(i=this._room)||void 0===i||i.on(aF.ON_ROOM_ERROR,this._onRoomError.bind(this)),null===(o=this._room)||void 0===o||o.on(aF.ON_NETWORK_QUALITY,this._onNetworkQuality.bind(this)),null===(a=this._room)||void 0===a||a.on(FN.ON_CUSTOM_MESSAGE,this._onCustomMessage.bind(this)),null===(s=this._room)||void 0===s||s.on(FN.USER_MESSAGE_RECEIVED,this._onUserMessageReceived.bind(this)),null===(c=this._room)||void 0===c||c.on(FN.USER_BINARY_MESSAGE_RECEIVED,this._onUserBinaryMessageReceived.bind(this)),null===(u=this._room)||void 0===u||u.on(FN.ON_USER_TOKEN_WILL_EXPIRE,this._onUserTokenWillExpire.bind(this)),null===(d=this._room)||void 0===d||d.on(FN.POST_PROCESSING_MESSAGE,(function(e){"2.0"===e.protocol?D._onStreamMixingEvent({error:e.error,event:e.eventType,message:e.message}):"publicStreamCallback"===e.type?D._onPushPublicStreamResult(e):"transcodeStatusCallback"===e.type&&D._onLiveTranscodingResult(e)})),null===(l=this._room)||void 0===l||l.on(jN.ON_CONNECTION_STATE_CHANGE,this._onConnectionStateChange.bind(this)),null===(h=this._room)||void 0===h||h.on(aF.RESUBSCRIBE,this._onResubscribe.bind(this)),null===(f=this._room)||void 0===f||f.on(aF.SUBSCRIBE_PUSH_TRACK,this._onSubscribePushTrack.bind(this)),null===(p=this._room)||void 0===p||p.on(aF.REMOVE_PUSH_TRACK,this._onRemovePushTrack.bind(this)),null===(v=this._room)||void 0===v||v.on(aF.ON_PUBLISH_RESULT,(function(e){var t;null!==(t=D._room)&&void 0!==t&&t._roomConfig.isAutoPublish&&D.safeEmit(Kd.onAutoPublishResult,e)})),null===(_=this._room)||void 0===_||_.on(aF.ON_REMOTE_STREAM_STATS,(function(e){D.safeEmit(Kd.onRemoteStreamStats,e)})),null===(m=this._room)||void 0===m||m.on(aF.ON_LOCAL_STREAM_STATS,(function(e){D.safeEmit(Kd.onLocalStreamStats,e)})),null===(g=this._room)||void 0===g||g.on(aF.ON_SUBTITLE_STATE_CHANGED,(function(e){D.safeEmit(Kd.onSubtitleStateChanged,e)})),null===(y=this._room)||void 0===y||y.on(aF.ON_SUBTITLE_MESSAGE_RECEIVED,(function(e){D.safeEmit(Kd.onSubtitleMessageReceived,e)})),null===(S=this._room)||void 0===S||S.on(aF.ON_USER_PUBLISH_STATE_CHANGE,this._onUserPublishStateChange.bind(this)),null===(E=this._room)||void 0===E||E.on(aF.ON_USER_START_AUDIO_CAPTURE,(function(e,t){var r=e.userId;D._updateAudioPlayerState(t),D.safeEmit(Kd.onUserStartAudioCapture,{userId:r})})),null===(b=this._room)||void 0===b||b.on(aF.ON_USER_STOP_AUDIO_CAPTURE,(function(e){var t=e.userId;D.safeEmit(Kd.onUserStopAudioCapture,{userId:t})})),null===(k=this._room)||void 0===k||k.on(aF.ON_USER_START_VIDEO_CAPTURE,(function(e){var t=e.userId;D.safeEmit(Kd.onUserStartVideoCapture,{userId:t})})),null===(T=this._room)||void 0===T||T.on(aF.ON_USER_STOP_VIDEO_CAPTURE,(function(e){var t=e.userId;D.safeEmit(Kd.onUserStopVideoCapture,{userId:t})})),null===(I=this._room)||void 0===I||I.on(aF.ON_SEI_MESSAGED_RECEIVED,(function(e){D.safeEmit(Kd.onSEIMessageReceived,e)})),null===(A=this._room)||void 0===A||A.on(aF.ON_REMOTE_VIDEO_SIZE_CHANGED,(function(e,t){D.safeEmit(Kd.onRemoteVideoSizeChanged,e,t)})),null===(R=this._room)||void 0===R||R.on(aF.ON_SIMULCAST_SUBSCRIBE_FALLBACK,(function(e){return D.safeEmit(Kd.onSimulcastSubscribeFallback,e)})),null===(w=this._room)||void 0===w||w.on(aF.RECONNECT_FAILED,(function(){D.safeEmit(Kd.onError,{errorCode:uR.RECONNECT_FAILED})})),null===(C=this._room)||void 0===C||C.on(aF.ON_VIDEO_STREAM_BANNED,(function(e){D.safeEmit(Kd.onVideoStreamBanned,{uid:e.uid,banned:e.banned})})),null===(O=this._room)||void 0===O||O.on(aF.ON_AUDIO_STREAM_BANNED,(function(e){D.safeEmit(Kd.onAudioStreamBanned,{uid:e.uid,banned:e.banned})}))}},{key:"safeEmit",value:function(e){for(var t,r,n=arguments.length,i=new Array(n>1?n-1:0),o=1;o<n;o++)i[o-1]=arguments[o];return oC(e)&&vN(e,ww(i)),(t=wI(AI(_e.prototype),"safeEmit",this)).call.apply(t,wm(r=[this,e]).call(r,i))}},{key:"_removeHandlerEventHandler",value:function(){var e;null===(e=this._room)||void 0===e||e.removeAllListeners()}},{key:"setConnectionMode",value:function(e){Kw(e,"mode",[Fd.AUTO,Fd.FORCE_TCP,Fd.FORCE_UDP]),ON("CONNECTION_MODE",e)}},{key:"joinRoom",value:(le=km(Em().mark((function e(t,r,n,i){var o,a,s,c,u,d;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(eW.print("joinRoom()","token: %o roomId: %o, userInfo: %o, roomConfig: %o",t,r,n,i),Jw(t)||zw(t,"token"),Zw(r),tC(n),rC(i=iz({isAutoPublish:!0,isAutoSubscribeAudio:!0,isAutoSubscribeVideo:!0,roomProfileType:xd.communication},i)),!this._room||this._room.connectionState===_F.DISCONNECTED){e.next=10;break}throw new lR(uR.REPEAT_JOIN,"Already joined");case 10:return this._room=new IG(i,{id:this.id,audioProfileManager:this._audioProfileManager,streamRTT:{},subscribeFallbackOption:this._subscribeFallbackOption,userPriority:this._userPriorityMap,avSync:this._avSync}),this._addHandlerEventHandler(),o=this._liveTranscodeConfig&&Qq.getStartParams(this._liveTranscodeConfig),a=ud(ud({},n),{},{businessId:this._businessId,role:this._visibility?Nq.NORMAL_USER:Nq.SILENT_USER}),e.prev=14,this._useCloudProxy&&(this._startCloudProxyTimestamp=Date.now()),yG(a),e.next=19,this._room.join(this._appId,r,t,a,o,this._useCloudProxy,null===(s=this._config)||void 0===s?void 0:s.expectedIDC);case 19:return u=e.sent,this._roomConfig=i,this._audioProfileManager.setRoomId(r),this._tempRoomInfo&&delete this._tempRoomInfo,null!==(c=i)&&void 0!==c&&c.isAutoPublish&&(this._visibility?this._updatePublish({invokeByJoinRoom:!0,mediaType:Sd.AUDIO_AND_VIDEO}):this.safeEmit(Kd.onAutoPublishResult,{isScreen:!1,state:_d.PUBLISH_FAIL})),eP(this.id,this._room.roomInfo),e.abrupt("return",u);case 28:throw e.prev=28,e.t0=e.catch(14),e.t0.code===uR.INVALID_TOKEN&&(this._tempRoomInfo={config:i,roomId:r,userInfo:a}),null===(d=this._room)||void 0===d||d.destroy(),e.t0;case 33:case"end":return e.stop()}}),e,this,[[14,28]])}))),function(e,t,r,n){return le.apply(this,arguments)})},{key:"leaveRoom",value:(de=km(Em().mark((function e(){var t,r,n,i=arguments;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=i.length>0&&void 0!==i[0]&&i[0],eW.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._audioProfileManager.setRoomId(),this._liveTranscodeConfig&&this.stopLiveTranscoding(),this._room=void 0,this._remoteAudioPlayer.forEach((function(e){return e.destroy()})),this._remoteAudioPlayer=new yE,this._remoteScreenAudioPlayer.forEach((function(e){return e.destroy()})),this._remoteScreenAudioPlayer=new yE,this._remoteScreenPlayer.forEach((function(e){return e.destroy()})),this._remoteScreenPlayer=new yE,this._remoteVideoPlayer.forEach((function(e){return e.destroy()})),this._remoteVideoPlayer=new yE,this._roomConfig=void 0,this._publicStreamIds=new yE,eP(this.id);case 23:case"end":return e.stop()}}),e,this)}))),function(){return de.apply(this,arguments)})},{key:"destroy",value:function(){var e,t,r;eW.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._videoStreamEncodeConfig=[NN],this._screenStreamEncodeConfig=[PN],this._pauseAllSubscribeState={audio:void 0,video:void 0,resumeStreamIds:{}},this._messageStatisticsObserver.destroy(),$N(this.id),clearInterval(this._audioVolumeIndicationTimer),clearInterval(this._dummyMainTimer),clearInterval(this._dummyScreenTimer),this._audioVolumeIndicationTimer=void 0,this._stopAudioPropertiesReport(),this._localAudioTrack&&(this._removeLocalTrackEvents(this._localAudioTrack),this._localAudioTrack.close(),this._localAudioTrack=void 0),this._localVideoTrack&&(this._removeLocalTrackEvents(this._localVideoTrack),this._localVideoTrack.close(),this._localVideoTrack=void 0),this._localScreenAudioTrack&&(this._removeLocalTrackEvents(this._localScreenAudioTrack),this._localScreenAudioTrack.close(),this._localScreenAudioTrack=void 0),this._localScreenVideoTrack&&(this._removeLocalTrackEvents(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 yE,this._remoteScreenAudioPlayer.forEach((function(e){return e.destroy()})),this._remoteScreenAudioPlayer=new yE,this._remoteScreenPlayer.forEach((function(e){return e.destroy()})),this._remoteScreenPlayer=new yE,this._remoteVideoPlayer.forEach((function(e){return e.destroy()})),this._remoteVideoPlayer=new yE,this._publicStreamAudioPlayer.forEach((function(e){return e.destroy()})),this._publicStreamAudioPlayer=new yE,this._publicStreamVideoPlayer.forEach((function(e){return e.destroy()})),this._publicStreamVideoPlayer=new yE,this._roomConfig=void 0,this._audioMixingManager.destroy(),this._rtmClient.destroy(),null===(r=this._publicStreamManager)||void 0===r||r.destroy(),this._publicStreamIds=new yE,this._audioDeviceManager.destroy(),this._remoteVideoConfig=new yE,this._userPriorityMap.clear(),this._extensionManager.destroy(),this._cameraCapturing=!1,this._micCapturing=!1,this._interruptCameraCapture=!1,this._interruptMicCapture=!1,this._avSync=!0}},{key:"publishStream",value:(ue=km(Em().mark((function e(t){return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(eW.print("publishStream()","mediaType: %o",t),this._checkMediaType(t),this._assertNotInRoom(),!Nw(t)||this._localVideoTrack||!this._localImgVideoTrack){e.next=7;break}return e.next=6,oV(this._localImgVideoTrack,this._extensionManager);case 6:this._localVideoTrack=e.sent;case 7:return e.next=9,this._updatePublish({mediaType:t});case 9:case"end":return e.stop()}}),e,this)}))),function(e){return ue.apply(this,arguments)})},{key:"unpublishStream",value:(ce=km(Em().mark((function e(t,r){var n;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(eW.print("unpublishStream()","mediaType: %o",t),this._checkMediaType(t),this._assertNotInRoom(),!r){e.next=5;break}return e.abrupt("return",null===(n=this._room)||void 0===n?void 0:n.unpublish());case 5:return e.next=7,this._updatePublish({mediaType:t,pubState:cF.UNPUB});case 7:case"end":return e.stop()}}),e,this)}))),function(e,t){return ce.apply(this,arguments)})},{key:"publishScreen",value:(se=km(Em().mark((function e(t){return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(eW.print("publishScreen()","mediaType: %o",t),this._checkMediaType(t),this._assertNotInRoom(),e.prev=3,!Nw(t)||this._localScreenVideoTrack||!this._localImgScreenTrack){e.next=8;break}return e.next=7,sV(this._localImgScreenTrack,this._extensionManager);case 7:this._localScreenVideoTrack=e.sent;case 8:return e.next=10,this._updateScreenPublish({mediaType:t,pubState:cF.PUB});case 10:e.next=19;break;case 12:if(e.prev=12,e.t0=e.catch(3),!(e.t0 instanceof lR)){e.next=18;break}throw e.t0;case 18:throw new lR(uR.UNEXPECTED_ERROR,"unexpected error",e.t0);case 19:case"end":return e.stop()}}),e,this,[[3,12]])}))),function(e){return se.apply(this,arguments)})},{key:"unpublishScreen",value:(ae=km(Em().mark((function e(t){return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return eW.print("unpublishScreen()","mediaType: %o",t),this._checkMediaType(t),this._assertNotInRoom(),e.next=5,this._updateScreenPublish({mediaType:t,pubState:cF.UNPUB});case 5:case"end":return e.stop()}}),e,this)}))),function(e){return ae.apply(this,arguments)})},{key:"subscribeStream",value:(oe=km(Em().mark((function e(t,r){return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return eW.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 oe.apply(this,arguments)})},{key:"_subscribe",value:(ie=km(Em().mark((function e(t,r,n){var i,o,a,s,c,u,d,l,h,f,p,v,_,m,g,y;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._checkMediaType(n),this._assertNotInRoom(),n!==Sd.AUDIO||null===(i=this._room)||void 0===i||!i.multiChatMode){e.next=5;break}return eW.print("subscribeStream()","due to multiChatMode return"),e.abrupt("return");case 5:if(u=this._room.remoteStreams.get(r),d=null==u?void 0:xb(u).call(u,(function(e){return e.isScreen===t}))){e.next=9;break}throw new lR(uR.STREAM_NOT_EXIST,"stream not exist");case 9:return l=this._pauseAllSubscribeState.audio,h=this._pauseAllSubscribeState.video,this._pauseAllSubscribeState.audio&&(n-=n&Sd.AUDIO),this._pauseAllSubscribeState.video&&(n-=n&Sd.VIDEO),eW.print("subscribeStream()","due to pauseAll mediaType: %o",n),f=d.hasSubscribed,p=this._remoteVideoConfig.get(r)||(null===(o=this._roomConfig)||void 0===o?void 0:o.remoteVideoConfig),d.originalMediaType=n,e.next=19,this._room.subscribe(d,n,p);case 19:xw(n)&&this._updateAudioPlayerState(d),Nw(n)&&this._updateVideoPlayerState(d),v=0,_=0,l!==this._pauseAllSubscribeState.audio&&(this._pauseAllSubscribeState.audio?v|=Sd.AUDIO:_|=Sd.AUDIO),h!==this._pauseAllSubscribeState.video&&(this._pauseAllSubscribeState.video?v|=Sd.VIDEO:_|=Sd.VIDEO),v&&this.pauseAllSubscribedStream(v),_&&this.resumeAllSubscribedStream(_),this._pauseAllSubscribeState.resumeStreamIds[d.streamId]=d.streamId,!t&&(null!==(a=this._roomConfig)&&void 0!==a&&a.isAutoSubscribeAudio||null!==(s=this._roomConfig)&&void 0!==s&&s.isAutoSubscribeVideo)&&(d.audioTrack||d.videoTrack)&&(m={userId:r,isScreen:!1,state:vd.SUBSCRIBE_SUCC},this.safeEmit(Kd.onAutoSubscribeResult,m)),null!==(c=this._room)&&void 0!==c&&c.multiChatMode||f||!xw(n)||!d.hasAudio||null===(g=d.observer)||void 0===g||g.setSubscribeAudio(!0),!f&&Nw(n)&&d.hasVideo&&(null===(y=d.observer)||void 0===y||y.setSubscribeVideo(!0));case 31:case"end":return e.stop()}}),e,this)}))),function(e,t,r){return ie.apply(this,arguments)})},{key:"unsubscribeStream",value:(ne=km(Em().mark((function e(t,r){return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:eW.print("unsubscribeStream()","userId: %o, mediaType: %o",t,r),this._unsubscribe(!1,t,r);case 2:case"end":return e.stop()}}),e,this)}))),function(e,t){return ne.apply(this,arguments)})},{key:"subscribeScreen",value:(re=km(Em().mark((function e(t,r){return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return eW.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 re.apply(this,arguments)})},{key:"unsubscribeScreen",value:(te=km(Em().mark((function e(t,r){return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:eW.print("unsubscribeScreen() userId: %o, mediaType: %o",t,r),this._unsubscribe(!0,t,r);case 2:case"end":return e.stop()}}),e,this)}))),function(e,t){return te.apply(this,arguments)})},{key:"_unsubscribe",value:function(e,t,r,n){var i,o=this;if(this._checkMediaType(r),this._assertNotInRoom(),r!==Sd.AUDIO||null===(i=this._room)||void 0===i||!i.multiChatMode){var a=this._room.remoteStreams.get(t),s=null==a?void 0:xb(a).call(a,(function(t){return t.isScreen===e}));if(null==s||!s.hasSubscribed)throw new lR(uR.STREAM_NOT_EXIST,"stream not exist");return this._room.unsubscribe(s,r).then((function(){n||delete o._pauseAllSubscribeState.resumeStreamIds[s.streamId]}))}eW.print("subscribeStream()","due to multiChatMode return")}},{key:"setRemoteVideoConfig",value:(ee=km(Em().mark((function e(t,r){var n;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return eW.print("setRemoteVideoConfig() userId: %o, remoteVideoConfig: %o",t,r),$w(t),aC(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 ee.apply(this,arguments)})},{key:"startVideoCapture",value:($=km(Em().mark((function e(t){var r,n,i,o,a,s,c,u,d,l=this;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(eW.print("startVideoCapture()","deviceId: %s",t),Jw(t)||zw(t,"deviceId"),t=t||this._localVideoDeviceId,this._localVideoDeviceId=t,this._trackSourceType.video!==dd.VIDEO_SOURCE_TYPE_EXTERNAL){e.next=6;break}throw new lR(uR.STREAM_TYPE_NOT_MATCH,"setVideoSourceType as internal first");case 6:if(!(this._cameraCapturing||this._localVideoTrack&&!this._localVideoTrack.dummy)){e.next=8;break}throw new lR(uR.REPEAT_CAPTURE,"Has already capture");case 8:return i=this._videoStreamConstraints,t&&("user"===t||"environment"===t||"left"===t||"right"===t?i.facingMode=t:i.deviceId={exact:t},this._videoStreamConstraints=i),o={},e.prev=11,this._cameraCapturing=!0,e.next=15,uV(i,this._extensionManager);case 15:if(s=e.sent,!this._interruptCameraCapture){e.next=21;break}throw this._interruptCameraCapture=!1,this._removeLocalTrackEvents(s),s.close(),new lR(uR.INTERRUPT,"interrupt by stopVideoCapture");case 21:if(this._initLocalTrackEvents(s),this._localVideoTrack=s,null===(a=this._videoPlayer)||void 0===a||a.playVideo(s),(c=null==s?void 0:s.getTrack())&&(o=c.getSettings(),u={width:o.width,height:o.height},this._localVideoTrack.resolution=u,setTimeout((function(){return l.safeEmit(Kd.onLocalVideoSizeChanged,{streamIndex:yd.STREAM_INDEX_MAIN,info:u})}))),this._room){e.next=28;break}return e.abrupt("return",o);case 28:return e.prev=28,this._cameraCapturing=!1,e.finish(28);case 31:return d=this._room._roomConfig.isAutoPublish,(this._room.hasPublished||d)&&(this._visibility?this._updatePublish():this.safeEmit(Kd.onAutoPublishResult,{isScreen:!1,state:_d.PUBLISH_FAIL})),null===(r=this._room.localStream)||void 0===r||null===(n=r.observer)||void 0===n||n.setEnableVideo(!0),e.abrupt("return",o);case 35:case"end":return e.stop()}}),e,this,[[11,,28,31]])}))),function(e){return $.apply(this,arguments)})},{key:"stopVideoCapture",value:(Z=km(Em().mark((function e(){var t,r,n,i,o,a;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(eW.print("stopVideoCapture()"),!this._cameraCapturing){e.next=5;break}return this._interruptCameraCapture=!0,eW.print("stopVideoCapture()","capturing"),e.abrupt("return");case 5:if(this._trackSourceType.video!==dd.VIDEO_SOURCE_TYPE_EXTERNAL){e.next=7;break}throw new lR(uR.STREAM_TYPE_NOT_MATCH,"setVideoSourceType as internal first");case 7:if(null===(t=this._videoPlayer)||void 0===t||t.stop(),this._localVideoTrack&&(this._localVideoTrack.dummy||(this._removeLocalTrackEvents(this._localVideoTrack),this._localVideoTrack.close(),this._localImgVideoTrack?(null===(a=this._localVideoTrack)||void 0===a||a.setTrack(this._localImgVideoTrack,this._extensionManager),this._localVideoTrack.dummy=!0):this._localVideoTrack=void 0)),this._room){e.next=11;break}return e.abrupt("return");case 11:if(null===(r=this._room)||void 0===r||!r.hasPublished){e.next=14;break}return e.next=14,this._updatePublish();case 14:null===(n=this._room)||void 0===n||null===(i=n.localStream)||void 0===i||null===(o=i.observer)||void 0===o||o.setEnableVideo(!1);case 15:case"end":return e.stop()}}),e,this)}))),function(){return Z.apply(this,arguments)})},{key:"startAudioCapture",value:(J=km(Em().mark((function e(t){var r,n,i,o,a,s;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(eW.print("startAudioCapture()","deviceId: $o",t),Jw(t)||zw(t,"deviceId"),t=t||this._localAudioDeviceId,this._localAudioDeviceId=t,this._trackSourceType.audio!==ld.AUDIO_SOURCE_TYPE_EXTERNAL){e.next=6;break}throw new lR(uR.STREAM_TYPE_NOT_MATCH,"setAudioSourceType as internal first");case 6:if(!this._micCapturing&&!this._localAudioTrack){e.next=8;break}throw new lR(uR.REPEAT_CAPTURE,"Has already capture");case 8:return t&&this._audioProfileManager.updateConstraints({deviceId:{exact:t}}),i={},e.prev=10,this._micCapturing=!0,e.next=14,lV(this._audioProfileManager.getConstraints(),this._extensionManager);case 14:if(o=e.sent,!this._interruptMicCapture){e.next=20;break}throw this._interruptMicCapture=!1,this._removeLocalTrackEvents(o),o.close(),new lR(uR.INTERRUPT,"interrupt by stopAudioCapture");case 20:if(this._initLocalTrackEvents(o),this._localAudioTrack=o,this._tempMixingAudioTrack&&(this._localAudioTrack.mixType=this._tempMixingAudioTrack.type,this._localAudioTrack.mixedAudioTrack=this._tempMixingAudioTrack.track,delete this._tempMixingAudioTrack),(a=null==o?void 0:o.getTrack())&&(i=a.getSettings()),this._room){e.next=27;break}return e.abrupt("return",i);case 27:return e.prev=27,this._micCapturing=!1,e.finish(27);case 30:return s=this._room._roomConfig.isAutoPublish,(this._room.hasPublished||s)&&(this._visibility?this._updatePublish():this.safeEmit(Kd.onAutoPublishResult,{isScreen:!1,state:_d.PUBLISH_FAIL})),null===(r=this._room.localStream)||void 0===r||null===(n=r.observer)||void 0===n||n.setEnableAudio(!0),e.abrupt("return",i);case 34:case"end":return e.stop()}}),e,this,[[10,,27,30]])}))),function(e){return J.apply(this,arguments)})},{key:"stopAudioCapture",value:(Q=km(Em().mark((function e(){var t,r;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(eW.print("stopAudioCapture()"),!this._micCapturing){e.next=5;break}return this._interruptMicCapture=!0,eW.print("stopAudioCapture()","capturing"),e.abrupt("return");case 5:if(this._trackSourceType.audio!==ld.AUDIO_SOURCE_TYPE_EXTERNAL){e.next=7;break}throw new lR(uR.STREAM_TYPE_NOT_MATCH,"setAudioSourceType as internal first");case 7:if(this._localAudioTrack&&(this._removeLocalTrackEvents(this._localAudioTrack),this._localAudioTrack.close()),this._localAudioTrack=void 0,this._audioMixingManager.stopAll(),this._room){e.next=12;break}return e.abrupt("return");case 12:if(!this._room.hasPublished){e.next=15;break}return e.next=15,this._updatePublish();case 15:null===(t=this._room.localStream)||void 0===t||null===(r=t.observer)||void 0===r||r.setEnableAudio(!1);case 16:case"end":return e.stop()}}),e,this)}))),function(){return Q.apply(this,arguments)})},{key:"getAudioMixingManager",value:function(){return eW.print("getAudioMixingManager()"),this._audioMixingManager}},{key:"startScreenCapture",value:(Y=km(Em().mark((function e(){var t,r,n,i,o,a,s,c,u,d,l,h,f,p=this,v=arguments;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(o=v.length>0&&void 0!==v[0]?v[0]:{},eW.print("startScreenCapture()","config: %o",o),a=o.enableAudio,s=void 0!==a&&a,this._trackSourceType.screenVideo!==dd.VIDEO_SOURCE_TYPE_EXTERNAL){e.next=5;break}throw new lR(uR.STREAM_TYPE_NOT_MATCH,"setVideoSourceType as internal first");case 5:if(this._trackSourceType.screenAudio!==ld.AUDIO_SOURCE_TYPE_EXTERNAL){e.next=7;break}throw new lR(uR.STREAM_TYPE_NOT_MATCH,"setAudioSourceType as internal first");case 7:return e.next=9,fV(s,this._extensionManager,this._screenStreamEncodeConfig[0]);case 9:if(c=e.sent,u=JT(c,2),d=u[0],l=u[1],this._localScreenVideoTrack&&!this._localScreenVideoTrack.dummy&&(this._removeLocalTrackEvents(this._localScreenVideoTrack),this._localScreenVideoTrack.close()),null===(t=this._localScreenAudioTrack)||void 0===t||t.close(),delete this._localScreenAudioTrack,this._localScreenVideoTrack=d,null!==(r=this._screenStreamEncodeConfig[0])&&void 0!==r&&r.contentHint&&d.setContentHint(null===(h=this._screenStreamEncodeConfig[0])||void 0===h?void 0:h.contentHint),(f=null==d?void 0:d.getTrack())&&setTimeout((function(){var e=f.getSettings(),t={width:e.width,height:e.height};d.resolution=t,p.safeEmit(Kd.onLocalVideoSizeChanged,{streamIndex:yd.STREAM_INDEX_SCREEN,info:{width:e.width,height:e.height}})}),500),l&&(this._localScreenAudioTrack=l,this._initLocalTrackEvents(l)),null===(n=this._screenPlayer)||void 0===n||n.playVideo(this._localScreenVideoTrack),this._initLocalTrackEvents(this._localScreenVideoTrack,!0),null===(i=this._room)||void 0===i||!i.hasScreenPublished){e.next=26;break}return e.next=26,this._updateScreenPublish();case 26:case"end":return e.stop()}}),e,this)}))),function(){return Y.apply(this,arguments)})},{key:"stopScreenCapture",value:(W=km(Em().mark((function e(){var t,r,n;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(eW.print("stopScreenCapture()"),null===(t=this._screenPlayer)||void 0===t||t.stop(),this._localScreenVideoTrack&&(this._localScreenVideoTrack.dummy||(this._removeLocalTrackEvents(this._localScreenVideoTrack),this._localScreenVideoTrack.close(),this._localImgScreenTrack&&(null===(n=this._localScreenVideoTrack)||void 0===n||n.setTrack(this._localImgScreenTrack,this._extensionManager),this._localScreenVideoTrack.dummy=!0))),this._localScreenAudioTrack&&(this._removeLocalTrackEvents(this._localScreenAudioTrack),this._localScreenAudioTrack.close()),this._localScreenAudioTrack=void 0,null===(r=this._room)||void 0===r||!r.hasScreenPublished){e.next=8;break}return e.next=8,this._updateScreenPublish();case 8:case"end":return e.stop()}}),e,this)}))),function(){return W.apply(this,arguments)})},{key:"setLocalVideoPlayer",value:function(e,t){if(eW.print("setLocalVideoPlayer()","streamIndex: %o, videoPlayerOption: %o",e,t),Kw(e,"streamIndex",[yd.STREAM_INDEX_MAIN,yd.STREAM_INDEX_SCREEN]),t&&t.renderDom){var r,n,i=ud(ud({userId:this._getUserId()},t),{},{isLocal:!0});if(nC(i),e===yd.STREAM_INDEX_MAIN&&!this._videoPlayer)return this._videoPlayer=new xG(i),this._initPlayerEvents(this._videoPlayer,!1,e),this._videoPlayer.mirror(!!this._mirrorType),this._localVideoTrack&&!this._localVideoTrack.dummy&&(null===(r=this._config)||void 0===r?void 0:r.autoPlayPolicy)!==Pd.PLAY_MANUALLY&&this._videoPlayer.playVideo(this._localVideoTrack),this._videoPlayer.domElement;if(e===yd.STREAM_INDEX_SCREEN&&!this._screenPlayer)return this._screenPlayer=new xG(ud(ud({},i),{},{isScreen:!0,isLocal:!0})),this._initPlayerEvents(this._screenPlayer,!1,e),this._localScreenVideoTrack&&!this._localScreenVideoTrack.dummy&&(null===(n=this._config)||void 0===n?void 0:n.autoPlayPolicy)!==Pd.PLAY_MANUALLY&&this._screenPlayer.playVideo(this._localScreenVideoTrack),this._screenPlayer.domElement}else{var o,a;e===yd.STREAM_INDEX_MAIN?(null===(o=this._videoPlayer)||void 0===o||o.destroy(!0),delete this._videoPlayer):(null===(a=this._screenPlayer)||void 0===a||a.destroy(),delete this._screenPlayer)}}},{key:"startLiveTranscoding",value:(q=km(Em().mark((function e(t){var r,n,i;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(eW.print("startLiveTranscoding()","transcode: %o",t),Qq.checkStartParams(t),this._liveTranscodeConfig=t,!((n=null===(r=this._room)||void 0===r?void 0:r.roomInfo)&&n.roomId.length+n.userInfo.userId.length>126)){e.next=6;break}throw new lR(uR.INVALID_PARAMS,"The roomId+userId must be within 126 bytes");case 6:if(e.prev=6,this.safeEmit(Kd.onStreamMixingEvent,{event:sF.START,error:0,message:""}),!this._room||this._room.connectionState!==_F.CONNECTED){e.next=11;break}return e.next=11,null===(i=this._room)||void 0===i?void 0:i.liveControlMessage(Qq.getStartParams(this._liveTranscodeConfig));case 11:e.next=20;break;case 13:if(e.prev=13,e.t0=e.catch(6),!(e.t0 instanceof lR)){e.next=19;break}throw e.t0;case 19:throw new lR(uR.UNEXPECTED_ERROR,"unexpected error",e.t0);case 20:case"end":return e.stop()}}),e,this,[[6,13]])}))),function(e){return q.apply(this,arguments)})},{key:"updateLiveTranscoding",value:(X=km(Em().mark((function e(t){var r,n,i,o;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(eW.print("updateLiveTranscoding()","transcode: %o",t),this._liveTranscodeConfig){e.next=3;break}return e.abrupt("return");case 3:return delete(i=iz({},t)).audio,null===(r=i.video)||void 0===r||delete r.codec,null===(n=i.video)||void 0===n||delete n.gop,Qq.checckUpdateParams(i),this._liveTranscodeConfig=iz(this._liveTranscodeConfig,i),e.prev=9,this.safeEmit(Kd.onStreamMixingEvent,{event:sF.UPDATE,error:0,message:""}),e.next=13,null===(o=this._room)||void 0===o?void 0:o.liveControlMessage(Qq.getUpdateParams(this._liveTranscodeConfig));case 13:e.next=22;break;case 15:if(e.prev=15,e.t0=e.catch(9),!(e.t0 instanceof lR)){e.next=21;break}throw e.t0;case 21:throw new lR(uR.UNEXPECTED_ERROR,"unexpected error",e.t0);case 22:case"end":return e.stop()}}),e,this,[[9,15]])}))),function(e){return X.apply(this,arguments)})},{key:"stopLiveTranscoding",value:(K=km(Em().mark((function e(){var t;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(eW.print("stopLiveTranscoding()"),this._liveTranscodeConfig){e.next=3;break}return e.abrupt("return");case 3:return delete this._liveTranscodeConfig,e.prev=4,this.safeEmit(Kd.onStreamMixingEvent,{event:sF.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 lR)){e.next=16;break}throw e.t0;case 16:throw new lR(uR.UNEXPECTED_ERROR,"unexpected error",e.t0);case 17:case"end":return e.stop()}}),e,this,[[4,10]])}))),function(){return K.apply(this,arguments)})},{key:"startSubtitle",value:(z=km(Em().mark((function e(t){var r;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return eW.print("startSubtitle()","config: %o",t),this._assertNotInRoom(),e.next=4,null===(r=this._room)||void 0===r?void 0:r.startSubtitle(t);case 4:case"end":return e.stop()}}),e,this)}))),function(e){return z.apply(this,arguments)})},{key:"stopSubtitle",value:function(){var e;eW.print("stopSubtitle()","invoke"),null===(e=this._room)||void 0===e||e.stopSubtitle()}},{key:"setBusinessId",value:function(e){return eW.print("setBusinessId()","businessId: %s",e),!function(e){return"string"!=typeof e}(e)&&!this._room&&(sN.setStats({rtc_business_id:e}),cG.setStats({rtc_business_id:e}),this._businessId=e,!0)}},{key:"setUserVisibility",value:(H=km(Em().mark((function e(t){var r,n;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(eW.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._assertNotInRoom(),this._room.localStream&&(null===(n=this._room.localStream.observer)||void 0===n||n.setPublisher(t)),e.t0=!t,!e.t0){e.next=13;break}return e.next=13,this._room.unpublish();case 13:return e.next=15,this._room.updateUserAttributes({role:t?Nq.NORMAL_USER:Nq.SILENT_USER});case 15:this._visibility=t,t&&null!==(r=this._roomConfig)&&void 0!==r&&r.isAutoPublish&&this._updatePublish({mediaType:Sd.AUDIO_AND_VIDEO});case 17:case"end":return e.stop()}}),e,this)}))),function(e){return H.apply(this,arguments)})},{key:"_initPlayerEvents",value:function(e){var t=this,r=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:yd.STREAM_INDEX_MAIN,i=n===yd.STREAM_INDEX_SCREEN;e.on("playback_event",(function(n){switch(n.eventName){case"timeupdate":return;case"loadeddata":if("audio"===n.type){var o=e.userId.replace("_screen","");r?t.safeEmit(Kd.onFirstPublicStreamAudioFrameDecoded,{publicStreamId:o}):(t.safeEmit(Kd.onAudioFirstFrameDecoded,{userId:o,isScreen:i}),t.safeEmit(Kd.onRemoteAudioFirstFrame,{userId:o,isScreen:i})),iN.firstRemoteAudioRender("",o||"",{isScreen:i})}else{var a,s,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,isScreen:i};r?(c.publicStreamId=c.userId,delete c.userId,delete c.isScreen,t.safeEmit(Kd.onFirstPublicStreamVideoFrameRendered,c),t.safeEmit(Kd.onFirstPublicStreamVideoFrameDecoded,c)):e.isLocal||(t.safeEmit(Kd.onVideoFirstFrameRendered,c),t.safeEmit(Kd.onVideoFirstFrameDecoded,c),t.safeEmit(Kd.onRemoteVideoFirstFrame,c)),iN.firstRemoteVideoRender("",n.userId||"",{isScreen:i})}break;case"autoplay-error":return r&&(n.publicStreamId=n.userId),iN.rtcInvokeStatus(e instanceof xG?"video":"audio",0,"autoplay-error",n.userId||"",0),void t.safeEmit(Kd.onAutoplayFailed,{userId:n.userId,kind:e instanceof xG?"video":"audio",mediaType:e instanceof xG?Sd.VIDEO:Sd.AUDIO,streamIndex:e.isScreen?yd.STREAM_INDEX_SCREEN:yd.STREAM_INDEX_MAIN})}t.safeEmit(Kd.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(Kd.onTrackEnded,{kind:e.getTrack().kind,isScreen:r})})),e.on("resolution-change",(function(e){t._extensionManager.getPluginsByType(FU.PRE_PROCESSING).forEach((function(t){var r;null==t||null===(r=t.applyConstraints)||void 0===r||r.call(t,e)})),t.safeEmit(Kd.onLocalVideoSizeChanged,{streamIndex:r?yd.STREAM_INDEX_SCREEN:yd.STREAM_INDEX_MAIN,info:e})}))}},{key:"_removeLocalTrackEvents",value:function(e){e.removeAllListeners("track-ended"),e.removeAllListeners("resolution-change")}},{key:"setRemoteVideoPlayer",value:function(e,t){eW.print("setRemoteVideoPlayer()","streamIndex: %o, videoPlayerOption: %o",e,t),Kw(e,"streamIndex",[yd.STREAM_INDEX_MAIN,yd.STREAM_INDEX_SCREEN]),nC(t);var r,n,i,o=t.userId;if(e===yd.STREAM_INDEX_MAIN){var a,s,c;if(null===(a=this._remoteVideoPlayer.get(o))||void 0===a||a.destroy(),!t.renderDom)return;var u=new xG(t);this._initPlayerEvents(u,!1,e),this._remoteVideoPlayer.set(o,u);var d=null===(s=this._room)||void 0===s||null===(c=s.remoteStreams.get(o))||void 0===c?void 0:xb(c).call(c,(function(e){return!e.isScreen}));return d&&this._updateVideoPlayerState(d),u.domElement}if(null===(r=this._remoteScreenPlayer.get(o))||void 0===r||r.destroy(),t.renderDom){var l=new xG(ud(ud({},t),{},{isScreen:!0}));this._remoteScreenPlayer.set(o,l),this._initPlayerEvents(l,!1,e);var h=null===(n=this._room)||void 0===n||null===(i=n.remoteStreams.get(o))||void 0===i?void 0:xb(i).call(i,(function(e){return e.isScreen}));return h&&this._updateVideoPlayerState(h),l.domElement}}},{key:"setLocalVideoMirrorType",value:function(e){eW.print("setLocalVideoMirrorType()","mirrorType: %o",e),Kw(e,"mirrorType",[kd.MIRROR_TYPE_NONE,kd.MIRROR_TYPE_RENDER]),this._mirrorType=e,this._videoPlayer&&this._videoPlayer.mirror(!!e)}},{key:"setAudioPlaybackDevice",value:(G=km(Em().mark((function e(t){var r;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return eW.print("setAudioPlaybackDevice()","deviceId: %s",t),zw(t,"deviceId"),e.next=4,this._audioDeviceManager.setSinkId(t);case 4:r=e.sent,this._remoteAudioPlayer.forEach((function(e){e.setPlaybackDevice(t)})),this._remoteScreenAudioPlayer.forEach((function(e){e.setPlaybackDevice(t)})),this.safeEmit(Kd.onAudioPlaybackDeviceChanged,r),iN.rtcAudioDevice(Hx.PLAYOUT_DEVICE_SWITCH,t,0);case 9:case"end":return e.stop()}}),e,this)}))),function(e){return G.apply(this,arguments)})},{key:"play",value:(j=km(Em().mark((function e(t){var r,n,i,o,a,s,c,u,d,l,h,f,p,v,_,m,g=arguments;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return o=g.length>1&&void 0!==g[1]?g[1]:Sd.AUDIO_AND_VIDEO,a=g.length>2?g[2]:void 0,eW.print("play()","userId: %s, mediaType: %s, streamIndex: %s",t,o,a),s=!t||t===this._getUserId()||"local_user"===t,c=void 0===a||a===yd.STREAM_INDEX_MAIN,u=void 0===a||a===yd.STREAM_INDEX_SCREEN,d=o!==Sd.VIDEO,l=o!==Sd.AUDIO,h=[],s&&l&&(c&&this._localVideoTrack&&(null===(f=this._videoPlayer)||void 0===f||f.mirror(!!this._mirrorType),h.push(null===(p=this._videoPlayer)||void 0===p?void 0:p.playVideo(this._localVideoTrack))),u&&this._localScreenVideoTrack&&h.push(null===(v=this._screenPlayer)||void 0===v?void 0:v.playVideo(this._localScreenVideoTrack))),t===(null===(r=this._audioMixingManager)||void 0===r?void 0:r.id)&&h.push(this._audioMixingManager.resumeLocalPlay()),_=null===(n=this._room)||void 0===n?void 0:n.remoteStreams,l&&c&&h.push(PG(this._remoteVideoPlayer,t,!1,_)),l&&u&&h.push(PG(this._remoteScreenPlayer,t,!0,_)),d&&c&&h.push(PG(this._remoteAudioPlayer,t,!1,_)),l&&u&&h.push(PG(this._remoteScreenAudioPlayer,t,!0,_)),m=null===(i=this._publicStreamManager)||void 0===i?void 0:i.remoteStreams,d&&h.push(PG(this._publicStreamVideoPlayer,t,!1,m)),l&&h.push(PG(this._publicStreamAudioPlayer,t,!1,m)),e.abrupt("return",X_.all(h).then((function(){})));case 20:case"end":return e.stop()}}),e,this)}))),function(e){return j.apply(this,arguments)})},{key:"pauseAllSubscribedStream",value:(B=km(Em().mark((function e(t){var r,n,i,o,a,s=this;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(eW.print("pauseAllSubscribedStream()","mediaType: %o",t),this._checkMediaType(t),xw(t)&&(s._pauseAllSubscribeState.audio=!0),Nw(t)&&(s._pauseAllSubscribeState.video=!0),this._room){e.next=6;break}return e.abrupt("return",X_.resolve());case 6:n=[],i=QT(tA(r=this._room.remoteStreams).call(r));try{for(i.s();!(o=i.n()).done;)a=o.value,Array.isArray(a)&&a.forEach((function(e){if(e.hasSubscribed){s._pauseAllSubscribeState.resumeStreamIds[e.streamId]=e.streamId;var r=s._unsubscribe(e.isScreen,e.userId,t,!0);r&&n.push(r)}}))}catch(c){i.e(c)}finally{i.f()}return e.abrupt("return",X_.all(n).then((function(){})));case 10:case"end":return e.stop()}}),e,this)}))),function(e){return B.apply(this,arguments)})},{key:"resumeAllSubscribedStream",value:(F=km(Em().mark((function e(t){var r,n,i,o,a,s=this;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(eW.print("resumeAllSubscribedStream()","mediaType: %o",t),this._checkMediaType(t),xw(t)&&(s._pauseAllSubscribeState.audio=!1),Nw(t)&&(s._pauseAllSubscribeState.video=!1),this._room){e.next=6;break}return e.abrupt("return",X_.resolve());case 6:n=[],i=QT(tA(r=this._room.remoteStreams).call(r));try{for(i.s();!(o=i.n()).done;)a=o.value,Array.isArray(a)&&a.forEach((function(e){if(s._pauseAllSubscribeState.resumeStreamIds[e.streamId]){delete s._pauseAllSubscribeState.resumeStreamIds[e.streamId];var r=s._subscribe(e.isScreen,e.userId,t);r&&n.push(r)}}))}catch(c){i.e(c)}finally{i.f()}return e.abrupt("return",X_.all(n).then((function(){var e,t;null===(e=s._room)||void 0===e||null===(t=e.remoteStreams)||void 0===t||t.forEach((function(e){Array.isArray(e)&&e.forEach((function(e){s._updateAudioPlayerState(e),s._updateVideoPlayerState(e)}))}))})));case 10:case"end":return e.stop()}}),e,this)}))),function(e){return F.apply(this,arguments)})},{key:"sendUserMessage",value:(V=km(Em().mark((function e(t,r){var n,i,o,a=this;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return $w(t),iC(r),this._assertNotInRoom(),o=Date.now(),e.abrupt("return",null===(n=this._room)||void 0===n||null===(i=n.sendUserMessage(t,r))||void 0===i?void 0:i.then((function(e){return a._messageStatisticsObserver.countP2PMessage(!0,t,!1,o,e),e.id})).catch((function(e){throw a._messageStatisticsObserver.countP2PMessage(!1,t,!1,o,e),e})));case 5:case"end":return e.stop()}}),e,this)}))),function(e,t){return V.apply(this,arguments)})},{key:"sendUserBinaryMessage",value:(U=km(Em().mark((function e(t,r){var n,i,o,a=this;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return $w(t),Ww(r,"message"),iC(r),this._assertNotInRoom(),o=Date.now(),e.abrupt("return",null===(n=this._room)||void 0===n||null===(i=n.sendUserMessage(t,r))||void 0===i?void 0:i.then((function(e){return a._messageStatisticsObserver.countP2PMessage(!0,t,!0,o,e),e.id})).catch((function(e){throw a._messageStatisticsObserver.countP2PMessage(!1,t,!0,o,e),e})));case 6:case"end":return e.stop()}}),e,this)}))),function(e,t){return U.apply(this,arguments)})},{key:"sendRoomMessage",value:(L=km(Em().mark((function e(t){var r,n,i,o=this;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return iC(t),this._assertNotInRoom(),i=Date.now(),e.abrupt("return",null===(r=this._room)||void 0===r||null===(n=r.sendRoomMessage(t))||void 0===n?void 0:n.then((function(e){var t,r;return o._messageStatisticsObserver.countRoomMessage(!0,null===(t=o._room)||void 0===t||null===(r=t.roomInfo)||void 0===r?void 0:r.roomId,!1,i),e})).catch((function(e){var t,r;throw o._messageStatisticsObserver.countRoomMessage(!1,null===(t=o._room)||void 0===t||null===(r=t.roomInfo)||void 0===r?void 0:r.roomId,!1,i),e})));case 4:case"end":return e.stop()}}),e,this)}))),function(e){return L.apply(this,arguments)})},{key:"sendRoomBinaryMessage",value:(M=km(Em().mark((function e(t){var r,n,i,o=this;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return iC(t),this._assertNotInRoom(),i=Date.now(),e.abrupt("return",null===(r=this._room)||void 0===r||null===(n=r.sendRoomMessage(t,!0))||void 0===n?void 0:n.then((function(e){var t,r;return o._messageStatisticsObserver.countRoomMessage(!0,null===(t=o._room)||void 0===t||null===(r=t.roomInfo)||void 0===r?void 0:r.roomId,!0,i),e})).catch((function(e){var t,r;throw o._messageStatisticsObserver.countRoomMessage(!1,null===(t=o._room)||void 0===t||null===(r=t.roomInfo)||void 0===r?void 0:r.roomId,!0,i),e})));case 4:case"end":return e.stop()}}),e,this)}))),function(e){return M.apply(this,arguments)})},{key:"setAudioCaptureConfig",value:(P=km(Em().mark((function e(){var t,r=arguments;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:t=r.length>0&&void 0!==r[0]?r[0]:{},eW.print("setAudioCaptureConfig()","config: %o",t),delete t.deviceId,Yw(t),this._shouldUpdateAudioConf("setAudioCaptureConfig")&&this._audioProfileManager.updateConstraints(t);case 5:case"end":return e.stop()}}),e,this)}))),function(){return P.apply(this,arguments)})},{key:"setVideoCaptureConfig",value:(N=km(Em().mark((function e(){var t,r=arguments;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=r.length>0&&void 0!==r[0]?r[0]:{},eW.print("setVideoCaptureConfig()","config: %o",t),e.abrupt("return",this._setVideoCaptureConfig(t));case 3:case"end":return e.stop()}}),e,this)}))),function(){return N.apply(this,arguments)})},{key:"_setVideoCaptureConfig",value:(x=km(Em().mark((function e(){var t,r,n,i=arguments;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(delete(r=i.length>0&&void 0!==i[0]?i[0]:{}).deviceId,Yw(r),n=ud(ud({},r),{},{deviceId:this._videoStreamConstraints.deviceId}),!this._localVideoTrack){e.next=7;break}return e.next=7,this._localVideoTrack.updateVideoCaptureConfig(n);case 7:return this._videoStreamConstraints=n,e.abrupt("return",(null===(t=this._localVideoTrack)||void 0===t?void 0:t.getTrack().getSettings())||{});case 9:case"end":return e.stop()}}),e,this)}))),function(){return x.apply(this,arguments)})},{key:"enableSimulcastMode",value:function(e){var t;return eW.print("enableSimulcastMode()","enabled: %o",e),this._enableSimulcast=e,null!==(t=this._room)&&void 0!==t&&t.hasPublished&&Fw("You must call this API before publishing the video streams"),!0}},{key:"setVideoEncoderConfig",value:(D=km(Em().mark((function e(t){var r,n,i;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:for(eW.print("setVideoEncoderConfig()"," descriptions: %o",t),Array.isArray(t)||(t=[t]),cC(t=Gs(t).call(t,(function(e){return!!e}))),t.length>3&&(Fw("setVideoEncoderConfig: You can set parameters for up to 3 streams"),t=Sm(t).call(t,0,3)),n=1;n<t.length;n++)i=Bw(t[0].width)/Bw(t[n].width)||1,Math.floor(i)!==i&&Fw("setVideoEncoderConfig: The resolution setting needs to be an integer multiple");VA(t).call(t,(function(e,t){return t.maxKbps-e.maxKbps})),this._setVideoCaptureConfig(ud({},t[0])),this._videoStreamEncodeConfig=t,this._updateDummyCaptureImage(yd.STREAM_INDEX_MAIN),null!==(r=this._room)&&void 0!==r&&r.hasPublished&&this._updatePublish();case 11:case"end":return e.stop()}}),e,this)}))),function(e){return D.apply(this,arguments)})},{key:"setScreenEncoderConfig",value:(O=km(Em().mark((function e(t){var r;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:eW.print("setScreenEncoderConfig()","description: %o",t),this._screenStreamEncodeConfig=[t],this._localScreenVideoTrack&&(this._localScreenVideoTrack.updateVideoCaptureConfig(t),t.contentHint&&this._localScreenVideoTrack.setContentHint(t.contentHint)),this._updateDummyCaptureImage(yd.STREAM_INDEX_SCREEN),null!==(r=this._room)&&void 0!==r&&r.hasScreenPublished&&this._updateScreenPublish();case 5:case"end":return e.stop()}}),e,this)}))),function(e){return O.apply(this,arguments)})},{key:"sendSEIMessage",value:function(e,t,r){if(eW.print("sendSEIMessage()","streamIdex: %o, message: %o, repeatCount: %o",e,t,r),!gL())throw new lR(uR.NOT_SUPPORTED,"Browser does not support sending SEI");Kw(e,"streamIndex",[yd.STREAM_INDEX_MAIN,yd.STREAM_INDEX_SCREEN]),Hw(r,"repeatCount",0,30);var n="string"==typeof t?new Uint8Array(dw.str2ab(t)):t;if(t.length){var i;if(e===yd.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 c,u,d;if(null===(c=this._room)||void 0===c||null===(u=c.localScreenStream)||void 0===u||!u.hasPublished)return;i=null===(d=this._room)||void 0===d?void 0:d.localScreenStream}if(n.byteLength>4096)eW.print("sei size must not bigger than 4KB");else{var l=aw();i.seiList.push({content:n,uuid:l,repeatCount:r}),setTimeout((function(){var e;if(i){var t,r=qA(e=i.seiList).call(e,(function(e){return e.uuid===l}));if(r)vk(t=i.seiList).call(t,r,1)}}),2e3)}}else eW.print("sei message must not be empty")}},{key:"setAudioVolumeIndicationInterval",value:function(e){var t=this;eW.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=xb(e).call(e,(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(Kd.onAudioVolumeIndication,{speakers:r})}),e)}},{key:"_sendActiveSpeaker",value:function(e,t){if(this._room&&this._room.remoteUsers.size>=1){var r,n=e[0],i=PE(t).call(t,(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>-35){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(Kd.onActiveSpeaker,{userId:o.userId,extraInfo:o.extraInfo})}}}},{key:"enableAudioPropertiesReport",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};eW.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:yd.STREAM_INDEX_MAIN,audioPropertiesInfo:{linearVolume:i,nonlinearVolume:Dw(i)}})}if(e._localScreenAudioTrack){var o=e._localScreenAudioTrack.getAudioLevel();t.push({streamIndex:yd.STREAM_INDEX_SCREEN,audioPropertiesInfo:{linearVolume:o,nonlinearVolume:Dw(o)}})}if(e.safeEmit(Kd.onLocalAudioPropertiesReport,t),e._room){var a,s=[];if(null!==(a=e._room)&&void 0!==a&&a.multiChatMode)e._room.getActiveSpeakerInMultiChatMode().forEach((function(t){var r,n,i=255*t.audioLevel;s.push({streamKey:{userId:t.userId,streamIndex:yd.STREAM_INDEX_MAIN,roomId:null===(r=e._room)||void 0===r||null===(n=r._roomInfo)||void 0===n?void 0:n.roomId},audioPropertiesInfo:{linearVolume:i,nonlinearVolume:Dw(i)}})}));else e._room.remoteStreams.forEach((function(t,r){t.forEach((function(t){if(t.audioTrack){var n,i,o=t.audioTrack.getAudioLevel();s.push({streamKey:{userId:r,streamIndex:t.isScreen?yd.STREAM_INDEX_SCREEN:yd.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:Dw(o)}})}}))}));e.safeEmit(Kd.onRemoteAudioPropertiesReport,s),e._sendActiveSpeaker(t,Gs(s).call(s,(function(e){return e.streamKey.streamIndex!==yd.STREAM_INDEX_SCREEN})))}}}),o))}},{key:"setVideoSourceType",value:(C=km(Em().mark((function e(t,r){var n,i,o,a,s,c,u,d,l,h,f,p,v,_,m,g,y,S,E,b,k,T;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(eW.print("setVideoSourceType()","index: %o, videoSourceType: %o",t,r),Kw(t,"streamIndex",[yd.STREAM_INDEX_MAIN,yd.STREAM_INDEX_SCREEN]),Kw(r,"VideoSourceType",[dd.VIDEO_SOURCE_TYPE_EXTERNAL,dd.VIDEO_SOURCE_TYPE_INTERNAL]),n=t===yd.STREAM_INDEX_MAIN?"video":"screenVideo",this._trackSourceType[n]===r){e.next=26;break}if(this._trackSourceType[n]=r,eW.print("setVideoSourceType",wm(i="set ".concat(n," source type to ")).call(i,r)),!this._localVideoTrack||t!==yd.STREAM_INDEX_MAIN){e.next=17;break}if(c=!1,r===dd.VIDEO_SOURCE_TYPE_EXTERNAL&&(c=!0,this._removeLocalTrackEvents(this._localVideoTrack),this._localVideoTrack.close()),null===(o=this._videoPlayer)||void 0===o||o.stop(),this._localVideoTrack=void 0,u=null===(a=this._room)||void 0===a?void 0:a._roomConfig.isAutoPublish,c?null===(d=this._room)||void 0===d||null===(l=d.localStream)||void 0===l||null===(h=l.observer)||void 0===h||h.setEnableVideo(!1):null===(f=this._room)||void 0===f||null===(p=f.localStream)||void 0===p||null===(v=p.observer)||void 0===v||v.setPushVideo(!1),!(null!==(s=this._room)&&void 0!==s&&s.hasPublished||u)){e.next=17;break}return e.next=17,this._updatePublish();case 17:if(!this._localScreenVideoTrack||t!==yd.STREAM_INDEX_SCREEN){e.next=26;break}if(g=!1,r===dd.VIDEO_SOURCE_TYPE_EXTERNAL&&(g=!0,this._removeLocalTrackEvents(this._localScreenVideoTrack),this._localScreenVideoTrack.close()),null===(_=this._screenPlayer)||void 0===_||_.stop(),this._localScreenVideoTrack=void 0,g?null===(y=this._room)||void 0===y||null===(S=y.localScreenStream)||void 0===S||null===(E=S.observer)||void 0===E||E.setEnableVideo(!1):null===(b=this._room)||void 0===b||null===(k=b.localScreenStream)||void 0===k||null===(T=k.observer)||void 0===T||T.setPushVideo(!1),null===(m=this._room)||void 0===m||!m.hasScreenPublished){e.next=26;break}return e.next=26,this._updateScreenPublish();case 26:case"end":return e.stop()}}),e,this)}))),function(e,t){return C.apply(this,arguments)})},{key:"setExternalVideoTrack",value:(w=km(Em().mark((function e(t,r){var n,i,o,a,s,c,u,d,l;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(eW.print("setExternalVideoTrack()","index: %o, track: %o",t,r),Kw(t,"streamIndex",[yd.STREAM_INDEX_MAIN,yd.STREAM_INDEX_SCREEN]),Xw(r),t!==yd.STREAM_INDEX_MAIN){e.next=15;break}if(this._trackSourceType.video===dd.VIDEO_SOURCE_TYPE_EXTERNAL){e.next=6;break}throw new lR(uR.STREAM_TYPE_NOT_MATCH,"setVideoSourceType as external first");case 6:return e.next=8,_V(r,this._extensionManager);case 8:if(this._localVideoTrack=e.sent,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=15;break}return e.next=15,this._updatePublish();case 15:if(t!==yd.STREAM_INDEX_SCREEN){e.next=27;break}if(this._trackSourceType.screenVideo===dd.VIDEO_SOURCE_TYPE_EXTERNAL){e.next=18;break}throw new lR(uR.STREAM_TYPE_NOT_MATCH,"setVideoSourceType as external first");case 18:return e.next=20,SV(r,this._extensionManager);case 20:if(this._localScreenVideoTrack=e.sent,this._initLocalTrackEvents(this._localScreenVideoTrack,!0),null===(s=this._screenPlayer)||void 0===s||s.playVideo(this._localScreenVideoTrack),null===(c=this._room)||void 0===c||null===(u=c.localScreenStream)||void 0===u||null===(d=u.observer)||void 0===d||d.setPushVideo(!0),null===(l=this._room)||void 0===l||!l.hasScreenPublished){e.next=27;break}return e.next=27,this._updateScreenPublish();case 27:case"end":return e.stop()}}),e,this)}))),function(e,t){return w.apply(this,arguments)})},{key:"setAudioSourceType",value:(R=km(Em().mark((function e(t,r){var n,i,o,a,s,c,u,d,l,h,f,p,v,_,m,g,y,S,E,b;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(eW.print("setAudioSourceType()","index: %o, audioSourceType: %o",t,r),Kw(t,"streamIndex",[yd.STREAM_INDEX_MAIN,yd.STREAM_INDEX_SCREEN]),Kw(r,"audioSourceType",[ld.AUDIO_SOURCE_TYPE_EXTERNAL,ld.AUDIO_SOURCE_TYPE_INTERNAL]),n=t===yd.STREAM_INDEX_MAIN?"audio":"screenAudio",this._trackSourceType[n]===r){e.next=24;break}if(this._trackSourceType[n]=r,eW.print("setVideoSourceType",wm(i="set ".concat(n," source type to ")).call(i,r)),!this._localAudioTrack||t!==yd.STREAM_INDEX_MAIN){e.next=16;break}if(s=!1,this._trackSourceType.audio===ld.AUDIO_SOURCE_TYPE_EXTERNAL&&(s=!0,this._removeLocalTrackEvents(this._localAudioTrack),this._localAudioTrack.close()),this._localAudioTrack=void 0,c=null===(o=this._room)||void 0===o?void 0:o._roomConfig.isAutoPublish,s?null===(u=this._room)||void 0===u||null===(d=u.localStream)||void 0===d||null===(l=d.observer)||void 0===l||l.setEnableAudio(!1):null===(h=this._room)||void 0===h||null===(f=h.localStream)||void 0===f||null===(p=f.observer)||void 0===p||p.setPushAudio(!1),!(null!==(a=this._room)&&void 0!==a&&a.hasPublished||c)){e.next=16;break}return e.next=16,this._updatePublish();case 16:if(!this._localScreenAudioTrack||t!==yd.STREAM_INDEX_SCREEN){e.next=24;break}if(_=!1,this._trackSourceType.audio===ld.AUDIO_SOURCE_TYPE_EXTERNAL&&(_=!0,this._removeLocalTrackEvents(this._localScreenAudioTrack),this._localScreenAudioTrack.close()),this._localScreenAudioTrack=void 0,_?null===(m=this._room)||void 0===m||null===(g=m.localScreenStream)||void 0===g||null===(y=g.observer)||void 0===y||y.setEnableAudio(!1):null===(S=this._room)||void 0===S||null===(E=S.localScreenStream)||void 0===E||null===(b=E.observer)||void 0===b||b.setPushAudio(!1),null===(v=this._room)||void 0===v||!v.hasScreenPublished){e.next=24;break}return e.next=24,this._updateScreenPublish();case 24:case"end":return e.stop()}}),e,this)}))),function(e,t){return R.apply(this,arguments)})},{key:"setExternalAudioTrack",value:(A=km(Em().mark((function e(t,r){var n,i,o,a,s,c,u,d,l,h;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(eW.print("setExternalAudioTrack()","index: %o, track: %o",t,r),Kw(t,"streamIndex",[yd.STREAM_INDEX_MAIN,yd.STREAM_INDEX_SCREEN]),Xw(r),t!==yd.STREAM_INDEX_MAIN){e.next=15;break}if(this._trackSourceType.audio===ld.AUDIO_SOURCE_TYPE_EXTERNAL){e.next=6;break}throw new lR(uR.STREAM_TYPE_NOT_MATCH,"setAudioSourceType as external first");case 6:return e.next=8,gV(r,this._extensionManager);case 8:if(this._localAudioTrack=e.sent,this._initLocalTrackEvents(this._localAudioTrack),c=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||c)){e.next=15;break}return e.next=15,this._updatePublish();case 15:if(t!==yd.STREAM_INDEX_SCREEN){e.next=26;break}if(this._trackSourceType.screenAudio===ld.AUDIO_SOURCE_TYPE_EXTERNAL){e.next=18;break}throw new lR(uR.STREAM_TYPE_NOT_MATCH,"setAudioSourceType as external first");case 18:return e.next=20,bV(r,this._extensionManager);case 20:if(this._localScreenAudioTrack=e.sent,this._initLocalTrackEvents(this._localScreenAudioTrack),null===(u=this._room)||void 0===u||null===(d=u.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=26;break}return e.next=26,this._updateScreenPublish();case 26:case"end":return e.stop()}}),e,this)}))),function(e,t){return A.apply(this,arguments)})},{key:"login",value:(I=km(Em().mark((function e(t,r){return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return eW.print("login()","token: %o, userInfo: %o",t,r),Jw(t)||zw(t,"token"),$w(r),e.abrupt("return",this._rtmClient.login(t,r));case 4:case"end":return e.stop()}}),e,this)}))),function(e,t){return I.apply(this,arguments)})},{key:"logout",value:(T=km(Em().mark((function e(){return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return eW.print("logout()"),e.abrupt("return",this._rtmClient.logout());case 2:case"end":return e.stop()}}),e,this)}))),function(){return T.apply(this,arguments)})},{key:"updateLoginToken",value:(k=km(Em().mark((function e(t){return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return eW.print("updateLoginToken()","token: %o",t),Jw(t)||zw(t,"token"),e.abrupt("return",this._rtmClient.updateLoginToken(t));case 3:case"end":return e.stop()}}),e,this)}))),function(e){return k.apply(this,arguments)})},{key:"getPeerOnlineStatus",value:(b=km(Em().mark((function e(t){return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return eW.print("getPeerOnlineStatus()","userId: %o",t),$w(t),e.abrupt("return",this._rtmClient.getPeerOnlineStatus(t));case 3:case"end":return e.stop()}}),e,this)}))),function(e){return b.apply(this,arguments)})},{key:"sendUserMessageOutsideRoom",value:(E=km(Em().mark((function e(t,r){var n,i=this;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return $w(t),iC(r),n=Date.now(),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),e})));case 4:case"end":return e.stop()}}),e,this)}))),function(e,t){return E.apply(this,arguments)})},{key:"sendUserBinaryMessageOutsideRoom",value:(S=km(Em().mark((function e(t,r){var n,i=this;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return $w(t),Ww(r,"message"),iC(r),n=Date.now(),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),e})));case 5:case"end":return e.stop()}}),e,this)}))),function(e,t){return S.apply(this,arguments)})},{key:"setServerParams",value:(y=km(Em().mark((function e(t,r){return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return eW.print("setServerParams()","signature: %o, url: %0",t,r),e.abrupt("return",this._rtmClient.setServerParams(t,r));case 2:case"end":return e.stop()}}),e,this)}))),function(e,t){return y.apply(this,arguments)})},{key:"sendServerMessage",value:(g=km(Em().mark((function e(t){var r,n=this;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return zw(t,"message"),iC(t),r=Date.now(),e.abrupt("return",this._rtmClient.sendServerMessage(t).then((function(e){n._messageStatisticsObserver.countServerMessage(!0,!1,r,e)})).catch((function(e){throw n._messageStatisticsObserver.countServerMessage(!1,!1,r,e),e})));case 4:case"end":return e.stop()}}),e,this)}))),function(e){return g.apply(this,arguments)})},{key:"sendServerBinaryMessage",value:(m=km(Em().mark((function e(t){var r,n=this;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return Ww(t,"message"),iC(t),r=Date.now(),e.abrupt("return",this._rtmClient.sendServerMessage(t).then((function(e){n._messageStatisticsObserver.countServerMessage(!0,!0,r,e)})).catch((function(e){throw n._messageStatisticsObserver.countServerMessage(!1,!0,r,e),e})));case 4:case"end":return e.stop()}}),e,this)}))),function(e){return m.apply(this,arguments)})},{key:"startCloudProxy",value:function(e){if(this._room)throw new lR(uR.START_CLOUD_PROXY_AFTER_JOIN,"[startCloudProxy] should be invoke before join room ");eW.print("startCloudProxy()",e),zw(e.logProxy,"logProxy"),zw(e.accessProxy,"accessProxy"),zw(e.configProxy,"configProxy"),this._originIceConfigRequestUrls=DN("ICE_CONFIG_REQUEST_URLS"),this._originLogServerUrl=DN("LOG_SERVER_URL"),this._originConfigServerUrls=DN("CONFIG_REQUEST_DOMAINS"),ON("ICE_CONFIG_REQUEST_URLS",e.accessProxy),ON("LOG_SERVER_URL",function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return/^https?:\/\/.+/.test(e)||(e="https://"+e),"".concat(e,"/video/v1/webrtc_log/")}(e.logProxy)),ON("CONFIG_REQUEST_DOMAINS",[e.configProxy]),this._useCloudProxy=!0}},{key:"stopCloudProxy",value:function(){if(this._room)throw new lR(uR.STOP_CLOUD_PROXY_BEFORE_LEAVE,"[stopCloudProxy] should be invoke after leave room ");eW.print("stopCloudProxy()"),ON("ICE_CONFIG_REQUEST_URLS",[]),ON("LOG_SERVER_URL",this._originLogServerUrl),ON("CONFIG_REQUEST_DOMAINS",this._originConfigServerUrls),this._useCloudProxy=!1,this._startCloudProxyTimestamp=void 0}},{key:"startPushPublicStream",value:(_=km(Em().mark((function e(t,r){var n,i,o,a=this;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(eW.print("startPushPublicStream()","publicStreamId: %o, publicStreamParam: %o",t,r),eC(t),this._assertNotInRoom(),!this._publicStreamIds.get(t)){e.next=5;break}throw new lR(uR.REPEAT_PUSH,"repeat push public media stream");case 5:return o=xN(t,"started",r),e.abrupt("return",null===(n=this._room)||void 0===n||null===(i=n.publicStreamControlMessage(o))||void 0===i?void 0:i.then((function(){a._publicStreamIds.set(t,t)})));case 7:case"end":return e.stop()}}),e,this)}))),function(e,t){return _.apply(this,arguments)})},{key:"updatePublicStreamParam",value:(v=km(Em().mark((function e(t,r){var n,i;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return eW.print("startPushPublicStream()","publicStreamId: %o, publicStreamParam: %o",t,r),eC(t),this._assertNotInRoom(),i=xN(t,"layoutChanged",r),e.abrupt("return",null===(n=this._room)||void 0===n?void 0:n.publicStreamControlMessage(i));case 5:case"end":return e.stop()}}),e,this)}))),function(e,t){return v.apply(this,arguments)})},{key:"stopPushPublicStream",value:(p=km(Em().mark((function e(t){var r,n=this;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return eW.print("startPushPublicStream()","publicStreamId: %o",t),eC(t),this._assertNotInRoom(),e.abrupt("return",null===(r=this._room)||void 0===r?void 0:r.publicStreamControlMessage({type:"publicstream",action:"stopped",publicStreamID:t}).then((function(){n._publicStreamIds.delete(t)})));case 4:case"end":return e.stop()}}),e,this)}))),function(e){return p.apply(this,arguments)})},{key:"startPlayPublicStream",value:(f=km(Em().mark((function e(t){var r,n,i,o,a,s,c=this;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(eC(t),this._publicStreamManager){e.next=8;break}return this._publicStreamManager=new Lq(this.id,this._appId,{businessId:this._businessId}),this._publicStreamManager.on(aF.RESUBSCRIBE,(function(e){var t=e.stream;if(t){var r,n=c._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=c._publicStreamVideoPlayer.get(t.streamId);o&&t.videoTrack&&o.playVideo(null===(i=e.stream)||void 0===i?void 0:i.videoTrack)}})),null===(r=this._publicStreamManager)||void 0===r||r.on("onRemoteStreamStats",(function(e){e.publicStreamId=e.userId,delete e.userId,delete e.isScreen,c.safeEmit(Kd.onPublicStreamStats,e)})),null===(n=this._publicStreamManager)||void 0===n||n.on(aF.ON_SEI_MESSAGED_RECEIVED,(function(e){c.safeEmit(Kd.onPublicStreamSEIMessageReceived,e)})),e.next=8,this._publicStreamManager.connect();case 8:return e.next=10,this._publicStreamManager.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 NG(t,{muted:(null===(s=this._config)||void 0===s?void 0:s.autoPlayPolicy)===Pd.VIDEO_ONLY,isScreen:!1}),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 f.apply(this,arguments)})},{key:"stopPlayPublicStream",value:(h=km(Em().mark((function e(t){var r;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._publicStreamManager){e.next=2;break}return e.abrupt("return");case 2:this._publicStreamManager.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 h.apply(this,arguments)})},{key:"setAudioProfile",value:(l=km(Em().mark((function e(t){return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:eW.print("setAudioProfile()","profile: %o",t),this._shouldUpdateAudioConf("setAudioProfile")&&this._audioProfileManager.setAudioProfile(t);case 2:case"end":return e.stop()}}),e,this)}))),function(e){return l.apply(this,arguments)})},{key:"setPublicStreamVideoPlayer",value:function(e,t){var r,n,i,o;eW.print("setPublicStreamVideoPlayer()","publicStreamId: %o, videoPlayerOption: %o",e,t);var a=this._publicStreamVideoPlayer.get(e);if(null===(r=a)||void 0===r||r.destroy(),null!=t&&t.renderDom){a=new xG(ud(ud({},t),{},{userId:e})),this._initPlayerEvents(a,!0),this._publicStreamVideoPlayer.set(e,a);var s=null===(n=this._publicStreamManager)||void 0===n||null===(i=n.remoteStreams)||void 0===i?void 0:i.get(e);null!=s&&s.videoTrack&&(null===(o=this._config)||void 0===o?void 0:o.autoPlayPolicy)!==Pd.PLAY_MANUALLY&&a.playVideo(s.videoTrack,s)}else this._publicStreamVideoPlayer.delete(e)}},{key:"setDummyCaptureImagePath",value:(d=km(Em().mark((function e(t,r){var n=this;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",new X_((function(e,i){zw(r,"filePath");var o=new Image;o.crossOrigin="anonymous",o.src=r,o.onload=function(){t===yd.STREAM_INDEX_MAIN?n._dummyMainImage=o:n._dummyScreenImage=o;try{n._updateDummyCaptureImage(t),e()}catch(r){i(new lR(uR.UNEXPECTED_ERROR,r.message))}},o.onerror=function(){i(new lR(uR.UNEXPECTED_ERROR,"Load image error"))}})));case 1:case"end":return e.stop()}}),e)}))),function(e,t){return d.apply(this,arguments)})},{key:"_updateDummyCaptureImage",value:function(e){var t,r;if(e===yd.STREAM_INDEX_MAIN?(t=this._dummyMainImage,r=this._videoStreamEncodeConfig[0]):(t=this._dummyScreenImage,r=this._screenStreamEncodeConfig[0]),t){var n,i,o=document.createElement("canvas"),a=o.getContext("2d"),s=Bw(r.width),c=Bw(r.height);if(!a)throw new lR(uR.UNEXPECTED_ERROR,"Not support canvas");!s||!c||t.width<=s&&t.height<=c?(n=t.width,i=t.height):(n=Math.min(s,t.width*c/t.height),i=Math.min(c,t.height*s/t.width)),o.width=n,o.height=i,a.drawImage(t,0,0,t.width,t.height,0,0,n,i);var u=window.setInterval((function(){t&&a.drawImage(t,0,0,t.width,t.height,0,0,n,i)}),200);e===yd.STREAM_INDEX_MAIN?(clearInterval(this._dummyMainTimer),this._dummyMainTimer=u):(clearInterval(this._dummyScreenTimer),this._dummyScreenTimer=u);var d,l,h,f,p=o.captureStream(5).getVideoTracks()[0];if(e===yd.STREAM_INDEX_MAIN){if(this._localImgVideoTrack=p,null!==(d=this._localVideoTrack)&&void 0!==d&&d.dummy)null===(l=this._localVideoTrack)||void 0===l||l.setTrack(this._localImgVideoTrack,this._extensionManager)}else if(this._localImgScreenTrack=p,null!==(h=this._localScreenVideoTrack)&&void 0!==h&&h.dummy)null===(f=this._localScreenVideoTrack)||void 0===f||f.setTrack(this._localImgScreenTrack,this._extensionManager)}}},{key:"_addListenExtensionEvent",value:function(e){var t=this;e.on("re-capture-audio",(function(){t._localAudioTrack&&t.stopAudioCapture().then((function(){t.startAudioCapture()}))})),e.on("re-capture-video",(function(){t._localVideoTrack&&!t._localVideoTrack.dummy&&t.stopVideoCapture().then((function(){t.startVideoCapture()}))}))}},{key:"registerExtension",value:(u=km(Em().mark((function e(t){return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t.monitor=iN,t.isSupported()){e.next=3;break}throw new Error("This extension is not supported.");case 3:return e.next=5,t.init();case 5:this._extensionManager.register(t),this._addListenExtensionEvent(t);case 7:case"end":return e.stop()}}),e,this)}))),function(e){return u.apply(this,arguments)})},{key:"defaultTranscoding",value:function(){return JSON.parse(tg(Qq.getDefaultValue()))}},{key:"_updatePublish",value:(c=km(Em().mark((function e(){var t,r,n,i=arguments;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=i.length>0&&void 0!==i[0]?i[0]:{},eW.print("_updatePublish()","config: %o",t),r={mediaType:void 0,invokeByJoinRoom:!1,pubState:cF.PUB},t=ud(ud({},r),t),this._visibility){e.next=6;break}throw new lR(uR.NO_PUBLISH_PERMISSION,"no publish permission");case 6:return e.next=8,this._pubLock.lock();case 8:if(n=e.sent,this._room&&this._room.connectionState===_F.CONNECTED){e.next=12;break}return n(),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 lR)){e.next=23;break}throw e.t0;case 23:throw new lR(uR.UNEXPECTED_ERROR,"unexpected error",e.t0);case 24:return e.prev=24,n(),e.finish(24);case 27:case"end":return e.stop()}}),e,this,[[12,17,24,27]])}))),function(){return c.apply(this,arguments)})},{key:"startAudioPlaybackDeviceTest",value:(s=km(Em().mark((function e(t,r){return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return eW.print("startAudioPlaybackDeviceTest()","filePath: %o, indicationInterval: %o",t,r),zw(t,"filePath"),Hw(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 s.apply(this,arguments)})},{key:"stopAudioPlaybackDeviceTest",value:function(){eW.print("stopAudioPlaybackDeviceTest()"),this._audioDeviceManager.stopAudioPlaybackDeviceTest()}},{key:"startAudioDeviceRecordTest",value:(a=km(Em().mark((function e(t,r){return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return eW.print("startAudioDeviceRecordTest()","indicationInterval: %o",t),Hw(t,"indicationInterval"),e.next=4,this._audioDeviceManager.startAudioDeviceRecordTest(t,r);case 4:case"end":return e.stop()}}),e,this)}))),function(e,t){return a.apply(this,arguments)})},{key:"stopAudioDeviceRecordAndPlayTest",value:function(){eW.print("stopAudioDeviceRecordAndPlayTest()"),this._audioDeviceManager.stopAudioDeviceRecordAndPlayTest()}},{key:"stopAudioDevicePlayTest",value:function(){eW.print("stopAudioDevicePlayTest()"),this._audioDeviceManager.stopAudioDevicePlayTest()}},{key:"setRemoteUserPriority",value:function(e,t){var r;eW.print("setRemoteUserPriority()","userId: %o, priority: %o",e,t);try{$w(e),Kw(t,"priority",[Cd.HIGH,Cd.MEDIUM,Cd.LOW])}catch(n){return console.warn(n),!1}return this._userPriorityMap.set(e,t),null===(r=this._room)||void 0===r||r.updateRemoteUserPriority(e),!0}},{key:"takeLocalSnapshot",value:(o=km(Em().mark((function e(t){var r,n;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(eW.print("takeLocalSnapshot()","streamIndex: %o",t),Kw(t,"streamIndex",[yd.STREAM_INDEX_MAIN,yd.STREAM_INDEX_SCREEN]),r=t===yd.STREAM_INDEX_MAIN?this.localVideoTrack:this.localScreenVideoTrack){e.next=5;break}throw new lR(uR.INVOKED_BEFORE_CAPTURE,"capture first");case 5:return n=t===yd.STREAM_INDEX_MAIN?this._videoPlayer:this._screenPlayer,e.abrupt("return",Gq(r.getTrack("preprocessing"),(null==n?void 0:n.mirrorType)===kd.MIRROR_TYPE_RENDER,n));case 7:case"end":return e.stop()}}),e,this)}))),function(e){return o.apply(this,arguments)})},{key:"takeRemoteSnapshot",value:(i=km(Em().mark((function e(t,r){var n,i,o,a,s,c;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(eW.print("takeRemoteSnapshot()","id: %o, streamIndex: %o",t,r),zw(t,"id"),Kw(r,"streamIndex",[yd.STREAM_INDEX_MAIN,yd.STREAM_INDEX_SCREEN]),c=(null===(n=this._room)||void 0===n||null===(i=n.remoteStreams.get(t))||void 0===i||null===(o=xb(i).call(i,(function(e){return e.isScreen===(r===yd.STREAM_INDEX_SCREEN)})))||void 0===o?void 0:o.videoTrack)||(null===(a=this._publicStreamManager)||void 0===a||null===(s=a.remoteStreams.get(t))||void 0===s?void 0:s.videoTrack)){e.next=6;break}throw new lR(uR.STREAM_NOT_EXIST,"stream not exist");case 6:return e.abrupt("return",Gq(c.getTrack(),!1,r===yd.STREAM_INDEX_MAIN?this._remoteVideoPlayer.get(t):this._remoteScreenPlayer.get(t)));case 7:case"end":return e.stop()}}),e,this)}))),function(e,t){return i.apply(this,arguments)})},{key:"setSubscribeFallbackOption",value:function(e){eW.print("setSubscribeFallbackOption()","option: %o",e);try{Kw(e,"option",[wd.DISABLE,wd.VIDEO_STREAM_LOW,wd.AUDIO_ONLY])}catch(t){return console.warn(t),!1}return!this._room&&(this._subscribeFallbackOption=e,!0)}},{key:"getLocalStreamTrack",value:function(e,t){var r,n,i,o=this;if(e===yd.STREAM_INDEX_MAIN?(n="video"===t?this.localVideoTrack:this.localAudioTrack,i=function(){var e;return null===(e=o._room)||void 0===e?void 0:e.localStream}):(n="video"===t?this.localScreenVideoTrack:this.localScreenAudioTrack,i=function(){var e;return null===(e=o._room)||void 0===e?void 0:e.localScreenStream}),n){var a=n instanceof TV&&n.mixedAudioTrack?n.mixedAudioTrack:n.getTrack("preprocessing");if(a){var s=i();return this._reportMsTrackEvent(a,(null==s||null===(r=s.stream)||void 0===r?void 0:r.id)||"local"),a}}}},{key:"getRemoteStreamTrack",value:function(e,t,r){var n,i,o=(null===(n=this._room)||void 0===n?void 0:n.remoteStreams.get(e))||[];if(o&&o.length){var a,s,c,u,d;if(t===yd.STREAM_INDEX_MAIN)a=xb(o).call(o,(function(e){return!e.isScreen})),i="video"===r?null===(s=a)||void 0===s?void 0:s.videoTrack:null===(c=a)||void 0===c?void 0:c.audioTrack;else a=xb(o).call(o,(function(e){return e.isScreen})),i="video"===r?null===(u=a)||void 0===u?void 0:u.videoTrack:null===(d=a)||void 0===d?void 0:d.audioTrack;if(i){var l=i.getTrack();if(l&&a){var h=a.streamId;return this._reportMsTrackEvent(l,h),l}}}}},{key:"getPublicStreamTrack",value:function(e,t){if(this._publicStreamManager&&this._publicStreamManager.remoteStreams){var r=this._publicStreamManager.remoteStreams.get(e);if(r){var n="video"===t?r.videoTrack:r.audioTrack;if(n){var i=n.getTrack();if(i){var o=r.streamId;return this._reportMsTrackEvent(i,o),i}}}}}},{key:"setRemoteStreamRenderSync",value:function(e){return!this._room&&(this._avSync=!!e,!0)}},{key:"_reportMsTrackEvent",value:function(e,t){if(!e.hookStop){e.hookStop=!0;var r=e.stop;e.stop=function(){iN.rtcInvokeStatus(t,0,"stop",t||"",0),r.call(e)}}}},{key:"_updateScreenPublish",value:(n=km(Em().mark((function e(){var t,r,n,i=arguments;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=i.length>0&&void 0!==i[0]?i[0]:{},eW.print("_updateScreenPublish()"),r={mediaType:void 0,pubState:cF.PUB},t=ud(ud({},r),t),e.next=6,this._pubLock.lock();case 6:if(n=e.sent,this._room&&this._room.connectionState===_F.CONNECTED){e.next=10;break}return n(),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 lR)){e.next=21;break}throw e.t0;case 21:throw new lR(uR.UNEXPECTED_ERROR,"unexpected error",e.t0);case 22:return e.prev=22,n(),e.finish(22);case 25:case"end":return e.stop()}}),e,this,[[10,15,22,25]])}))),function(){return n.apply(this,arguments)})},{key:"_updateAudioPlayerState",value:function(e){eW.print("_updateAudioPlayerState()");var t,r=e.userId,n=e.isScreen,i=n?this._remoteScreenAudioPlayer:this._remoteAudioPlayer,o=i.get(r);if(e.audioTrack&&(e.attributes.audiostream&&e.subAudio||this.multiChatMode)){var a;if(!o){var s;o=new NG(r,{muted:(null===(s=this._config)||void 0===s?void 0:s.autoPlayPolicy)===Pd.VIDEO_ONLY,isScreen:n}),this._initPlayerEvents(o,!1,n?yd.STREAM_INDEX_SCREEN:yd.STREAM_INDEX_MAIN),i.set(r,o);var c=this._audioDeviceManager.getSinkId();c&&o.setPlaybackDevice(c)}(null===(a=this._config)||void 0===a?void 0:a.autoPlayPolicy)!==Pd.PLAY_MANUALLY&&o.playAudio(e.audioTrack),pw&&Ew&&(t=this._remoteAudioPlayer,Wq&&clearTimeout(Wq),Wq=setTimeout((function(){var e,r=QT(t);try{for(r.s();!(e=r.n()).done;){var n=JT(e.value,2),i=n[0],o=n[1];null!=i&&cR(i).call(i,"mux")&&o.pause()}}catch(l){r.e(l)}finally{r.f()}var a,s=QT(t);try{for(s.s();!(a=s.n()).done;){var c=JT(a.value,2),u=c[0],d=c[1];null!=u&&cR(u).call(u,"mux")&&d.manuallyPlay()}}catch(l){s.e(l)}finally{s.f()}}),2e3))}else{var u;null===(u=o)||void 0===u||u.stop()}}},{key:"_updateVideoPlayerState",value:function(e){var t;eW.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)!==Pd.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:(r=km(Em().mark((function e(t){var r,n,i,o,a,s,c,u;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=t.stream,n=null==r?void 0:r.attributes,i=n.localaudio,o=n.audiostream,a=n.localvideo,s=n.videostream,c=IV.NONE,o&&(c|=Sd.AUDIO),s&&(c|=Sd.VIDEO),!c){e.next=11;break}return e.next=8,new X_((function(e){return setTimeout(e)}));case 8:null!=r&&r.isScreen?this.safeEmit(Kd.onUserPublishScreen,{userId:r.userId,mediaType:c}):(this.safeEmit(Kd.onUserPublishStream,{userId:r.userId,mediaType:c,videoStreamDescriptions:null==r||null===(u=r.attributes)||void 0===u?void 0:u.videoDescriptions}),this._handleAutoSubscribe(r,!0)),this.safeEmit("onAddStream",{userId:r.userId,mediaType:c,isScreen:!(null==r||!r.isScreen)}),null!=r&&r.isScreen||(i&&this.safeEmit(Kd.onUserStartAudioCapture,{userId:r.userId}),a&&this.safeEmit(Kd.onUserStartVideoCapture,{userId:r.userId}));case 11:case"end":return e.stop()}}),e,this)}))),function(e){return r.apply(this,arguments)})},{key:"_handleAutoSubscribe",value:function(e,t){var r,n,i=IV.NONE;if(null!==(r=this._roomConfig)&&void 0!==r&&r.isAutoSubscribeAudio&&(i|=Sd.AUDIO),null!==(n=this._roomConfig)&&void 0!==n&&n.isAutoSubscribeVideo&&(i|=Sd.VIDEO),i){var o,a;if(t&&xw(i))null===(o=e.observer)||void 0===o||o.setAutoSubscribeAudio(!0);if(t&&Nw(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=oW[e.reason])&&void 0!==t?t:Ed.STREAM_REMOVE_REASON_OTHER,o=n.isScreen?Kd.onUserUnpublishScreen:Kd.onUserUnpublishStream,a=IV.NONE;n.attributes.audiostream&&(a|=Sd.AUDIO),n.attributes.videostream&&(a|=Sd.VIDEO),a!==IV.NONE&&(this.safeEmit(o,{userId:n.userId,mediaType:a,reason:i}),this.safeEmit("onRemoveStream",{userId:n.userId,isScreen:n.isScreen})),this._getRemotePlayer(n.userId,n.isScreen).forEach((function(e){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){var t=this;setTimeout((function(){return t.safeEmit(Kd.onUserJoined,e)}))}},{key:"_onUserLeave",value:function(e){this.safeEmit(Kd.onUserLeave,e)}},{key:"_onRoomError",value:function(e){var t;this.safeEmit(Kd.onError,e),null===(t=this._room)||void 0===t||t.destroy(),this._room=void 0}},{key:"_onNetworkQuality",value:function(){for(var e,t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];this.safeEmit.apply(this,wm(e=[Kd.onNetworkQuality]).call(e,r))}},{key:"_onConnectionStateChange",value:function(e){if(void 0!==this._startCloudProxyTimestamp&&this._useCloudProxy&&e.state===bd.CONNECTION_STATE_CONNECTED&&this.safeEmit(Kd.onCloudProxyConnected,{interval:Date.now()-this._startCloudProxyTimestamp}),this.safeEmit(Kd.onConnectionStateChanged,e),e.state===bd.CONNECTION_STATE_RECONNECTING){var t,r=QT(this._remoteAudioPlayer);try{for(r.s();!(t=r.n()).done;){var n=JT(t.value,2),i=n[0],o=n[1];null!=i&&cR(i).call(i,"mux")&&o.stop()}}catch(a){r.e(a)}finally{r.f()}}}},{key:"_getRemotePlayer",value:function(e,t){return[(t?this._remoteScreenAudioPlayer:this._remoteAudioPlayer).get(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:"_onVideoDeviceStateChange",value:function(e){this.safeEmit(Kd.onVideoDeviceStateChanged,e)}},{key:"_onAudioDeviceStateChange",value:function(e){this.safeEmit(Kd.onAudioDeviceStateChanged,e)}},{key:"_onUserPublishStateChange",value:function(e){var t,r=this,n=e.userId,i=e.isScreen,o=e.mediaType,a=e.pubState,s=e.remoteStream,c={userId:n,mediaType:o};(o&Sd.AUDIO&&setTimeout((function(){r._updateAudioPlayerState(s)})),i)?a===cF.PUB?this.safeEmit(Kd.onUserPublishScreen,c):this.safeEmit(Kd.onUserUnpublishScreen,ud(ud({},c),{},{reason:Ed.STREAM_REMOVE_REASON_UNPUBLISH})):a===cF.PUB?(c.videoStreamDescriptions=null==s||null===(t=s.attributes)||void 0===t?void 0:t.videoDescriptions,this.safeEmit(Kd.onUserPublishStream,c),this._handleAutoSubscribe(s,!0)):this.safeEmit(Kd.onUserUnpublishStream,ud(ud({},c),{},{reason:Ed.STREAM_REMOVE_REASON_UNPUBLISH}))}},{key:"_onCustomMessage",value:function(e){var t=e.message;e.binary?this.safeEmit(Kd.onRoomBinaryMessageReceived,{userId:e.clientId,message:t}):this.safeEmit(Kd.onRoomMessageReceived,{userId:e.clientId,message:t})}},{key:"_onUserMessageReceived",value:function(e){this._messageStatisticsObserver.recvP2PMessage(e.userId),this.safeEmit(Kd.onUserMessageReceived,e)}},{key:"_onUserBinaryMessageReceived",value:function(e){this._messageStatisticsObserver.recvP2PMessage(e.userId),this.safeEmit(Kd.onUserBinaryMessageReceived,e)}},{key:"_onLiveTranscodingResult",value:function(e){this.safeEmit(Kd.onLiveTranscodingResult,e)}},{key:"_onStreamMixingEvent",value:function(e){this.safeEmit(Kd.onStreamMixingEvent,e)}},{key:"_onUserTokenWillExpire",value:function(){this.safeEmit(Kd.onTokenWillExpire)}},{key:"_onPushPublicStreamResult",value:function(e){this.safeEmit(Kd.onPushPublicStreamResult,e)}},{key:"_handleRTMClient",value:function(e){var t=this;e.on("onUserMessageReceivedOutsideRoom",(function(e){t._messageStatisticsObserver.recvP2POutRoomMessage(e.userId),t.safeEmit(Kd.onUserMessageReceivedOutsideRoom,e)})),e.on("onUserBinaryMessageReceivedOutsideRoom",(function(e){t._messageStatisticsObserver.recvP2POutRoomMessage(e.userId),t.safeEmit(Kd.onUserBinaryMessageReceivedOutsideRoom,e)})),e.on("onUserDisconnection",(function(){t.safeEmit(Kd.onError,{errorCode:uR.RTM_DUPLICATE_LOGIN})})),e.on("onRTMTokenError",(function(){t.safeEmit(Kd.onError,{errorCode:uR.RTM_TOKEN_ERROR})})),e.on("onServerParamsSetResult",(function(e){t.safeEmit(Kd.onServerParamsSetResult,null==e?void 0:e.code)}))}},{key:"waitForNewToken",get:function(){return!!this._tempRoomInfo}},{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:"iceState",get:function(){var e,t,r,n;return null===(e=this._room)||void 0===e||null===(t=e._mediaServerClient)||void 0===t||null===(r=t.handler)||void 0===r||null===(n=r._peerConnection)||void 0===n?void 0:n.iceConnectionState}},{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:"multiChatMode",get:function(){var e,t;return!(null===(e=this._room)||void 0===e||null===(t=e._mediaServerClient)||void 0===t||!t.roomAttributes.multiChatMode)}},{key:"_handleAudioDeviceManager",value:function(){var e=this;this._audioDeviceManager.on("onAudioPlaybackDeviceTestVolume",(function(t){e.safeEmit(Kd.onAudioPlaybackDeviceTestVolume,t)}))}},{key:"_assertNotInRoom",value:function(){if(!this._room||this._room.connectionState!==_F.CONNECTED)throw new lR(uR.NOT_CONNECTED_YET,"server not connected")}},{key:"_checkMediaType",value:function(e){Kw(e,"mediaType",[Sd.AUDIO,Sd.VIDEO,Sd.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"}},{key:"_switchTrack",value:(t=km(Em().mark((function e(t){var r,n;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._initLocalTrackEvents(t),this._localVideoTrack=t,null!==(r=this._videoPlayer)&&void 0!==r&&r.played&&(this._videoPlayer.stop(),this._videoPlayer.playVideo(t),this._videoPlayer.mirror(!!this._mirrorType)),null===(n=this._room)||void 0===n||!n.hasPublished){e.next=6;break}return e.next=6,this._updatePublish();case 6:case"end":return e.stop()}}),e,this)}))),function(e){return t.apply(this,arguments)})},{key:"_shouldUpdateAudioConf",value:function(e){var t,r=(null===(t=this._room)||void 0===t?void 0:t.hasPublished)||this._localAudioTrack&&this._localAudioTrack.sourceType===jU.INTERNAL;if(r){var n="engine.".concat(e," should be called before publishing or capturing.");console.warn("[RTC WebSDK]: "+n),_N(e,n)}return!r}}]),_e}(OC),sd(Yq,"GUID",1),Yq),rW=tW;$q([pN()],rW.prototype,"updateToken",1),$q([pN()],rW.prototype,"setVideoCaptureDevice",1),$q([pN()],rW.prototype,"setAudioCaptureDevice",1),$q([pN()],rW.prototype,"joinRoom",1),$q([pN()],rW.prototype,"leaveRoom",1),$q([pN()],rW.prototype,"destroy",1),$q([pN()],rW.prototype,"publishStream",1),$q([pN()],rW.prototype,"unpublishStream",1),$q([pN()],rW.prototype,"publishScreen",1),$q([pN()],rW.prototype,"unpublishScreen",1),$q([pN()],rW.prototype,"subscribeStream",1),$q([pN()],rW.prototype,"unsubscribeStream",1),$q([pN()],rW.prototype,"subscribeScreen",1),$q([pN()],rW.prototype,"unsubscribeScreen",1),$q([pN()],rW.prototype,"setRemoteVideoConfig",1),$q([pN()],rW.prototype,"startVideoCapture",1),$q([pN()],rW.prototype,"stopVideoCapture",1),$q([pN()],rW.prototype,"startAudioCapture",1),$q([pN()],rW.prototype,"stopAudioCapture",1),$q([pN()],rW.prototype,"getAudioMixingManager",1),$q([pN()],rW.prototype,"startScreenCapture",1),$q([pN()],rW.prototype,"stopScreenCapture",1),$q([pN()],rW.prototype,"setLocalVideoPlayer",1),$q([pN()],rW.prototype,"startLiveTranscoding",1),$q([pN()],rW.prototype,"updateLiveTranscoding",1),$q([pN()],rW.prototype,"stopLiveTranscoding",1),$q([pN()],rW.prototype,"startSubtitle",1),$q([pN()],rW.prototype,"stopSubtitle",1),$q([pN()],rW.prototype,"setBusinessId",1),$q([pN()],rW.prototype,"setUserVisibility",1),$q([pN()],rW.prototype,"setRemoteVideoPlayer",1),$q([pN()],rW.prototype,"setLocalVideoMirrorType",1),$q([pN()],rW.prototype,"setAudioPlaybackDevice",1),$q([pN()],rW.prototype,"play",1),$q([pN()],rW.prototype,"pauseAllSubscribedStream",1),$q([pN()],rW.prototype,"resumeAllSubscribedStream",1),$q([pN()],rW.prototype,"sendUserMessage",1),$q([pN()],rW.prototype,"sendUserBinaryMessage",1),$q([pN()],rW.prototype,"sendRoomMessage",1),$q([pN()],rW.prototype,"sendRoomBinaryMessage",1),$q([pN()],rW.prototype,"setAudioCaptureConfig",1),$q([Vw("4.51"),pN()],rW.prototype,"setVideoCaptureConfig",1),$q([pN()],rW.prototype,"enableSimulcastMode",1),$q([pN()],rW.prototype,"setVideoEncoderConfig",1),$q([pN()],rW.prototype,"setScreenEncoderConfig",1),$q([pN()],rW.prototype,"sendSEIMessage",1),$q([Vw("4.42"),pN()],rW.prototype,"setAudioVolumeIndicationInterval",1),$q([pN()],rW.prototype,"enableAudioPropertiesReport",1),$q([pN()],rW.prototype,"setVideoSourceType",1),$q([pN()],rW.prototype,"setExternalVideoTrack",1),$q([pN()],rW.prototype,"setAudioSourceType",1),$q([pN()],rW.prototype,"setExternalAudioTrack",1),$q([pN("rtm")],rW.prototype,"login",1),$q([pN("rtm")],rW.prototype,"logout",1),$q([pN("rtm")],rW.prototype,"updateLoginToken",1),$q([pN("rtm")],rW.prototype,"getPeerOnlineStatus",1),$q([pN("rtm")],rW.prototype,"sendUserMessageOutsideRoom",1),$q([pN("rtm")],rW.prototype,"sendUserBinaryMessageOutsideRoom",1),$q([pN("rtm")],rW.prototype,"setServerParams",1),$q([pN("rtm")],rW.prototype,"sendServerMessage",1),$q([pN("rtm")],rW.prototype,"sendServerBinaryMessage",1),$q([pN()],rW.prototype,"startCloudProxy",1),$q([pN()],rW.prototype,"stopCloudProxy",1),$q([pN()],rW.prototype,"startPushPublicStream",1),$q([pN()],rW.prototype,"updatePublicStreamParam",1),$q([pN()],rW.prototype,"stopPushPublicStream",1),$q([pN("outsideRoom","streamId")],rW.prototype,"startPlayPublicStream",1),$q([pN("outsideRoom","streamId")],rW.prototype,"stopPlayPublicStream",1),$q([pN()],rW.prototype,"setAudioProfile",1),$q([pN("outsideRoom")],rW.prototype,"setPublicStreamVideoPlayer",1),$q([pN()],rW.prototype,"setDummyCaptureImagePath",1),$q([pN()],rW.prototype,"registerExtension",1),$q([pN()],rW.prototype,"startAudioPlaybackDeviceTest",1),$q([pN()],rW.prototype,"stopAudioPlaybackDeviceTest",1),$q([pN()],rW.prototype,"startAudioDeviceRecordTest",1),$q([pN()],rW.prototype,"stopAudioDeviceRecordAndPlayTest",1),$q([pN()],rW.prototype,"stopAudioDevicePlayTest",1),$q([pN()],rW.prototype,"setRemoteUserPriority",1),$q([pN()],rW.prototype,"takeLocalSnapshot",1),$q([pN()],rW.prototype,"takeRemoteSnapshot",1),$q([pN()],rW.prototype,"setSubscribeFallbackOption",1),$q([pN()],rW.prototype,"getLocalStreamTrack",1),$q([pN()],rW.prototype,"getRemoteStreamTrack",1),$q([pN()],rW.prototype,"getPublicStreamTrack",1),$q([pN()],rW.prototype,"setRemoteStreamRenderSync",1);var nW,iW,oW={"client unpublished":Ed.STREAM_REMOVE_REASON_UNPUBLISH,"publish failed":Ed.STREAM_REMOVE_REASON_PUBLISH_FAILED,"stream removed":Ed.STREAM_REMOVE_REASON_KEEP_LIVE_FAILED,"client disconnected":Ed.STREAM_REMOVE_REASON_CLIENT_DISCONNECTED,"client republish":Ed.STREAM_REMOVE_REASON_REPUBLISH},aW=new RC("VERTC",0);kC.storeKey=wm(nW="".concat(Date.now(),"-")).call(nW,TN.getDeviceId()),[sN,cN,uN].forEach((function(e){var t;return e.setStats({rtc_sdk_version:CN.VERSION,product_line:Sx.RTC,report_version:Ex.W_5,os:bx.WEB,device_id:TN.getDeviceId(),log_cache_key:kC.storeKey,user_agent:uw()?"":null===(t=navigator)||void 0===t?void 0:t.userAgent})})),cG.setStats({rtc_sdk_version:CN.VERSION,log_cache_key:kC.storeKey});var sW=function(e,t){return aW.print("createEngine","Invoke VERTC.createEngine"),zw(e,"appId"),[sN,cN,uN].forEach((function(r){return r.setStats({rtc_app_id:e,auto_play_policy:null==t?void 0:t.autoPlayPolicy})})),cG.setStats({rtc_app_id:e}),iN.sdkInitEngine(Date.now(),Wx.BEGIN),new rW(e,t)},cW=function(e){if(aW.print("destroyEngine","Invoke VERTC.destroyEngine"),!(e instanceof rW))throw new lR(uR.INVALID_ENGINE,"Invalid engine object");e.destroy(),iN.sdkInitEngine(Date.now(),Wx.END)},uW=function(){var e=km(Em().mark((function e(){return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",MU.enumerateDevices());case 1:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),dW=function(){var e=km(Em().mark((function e(){var t,r,n,i,o,a,s=arguments;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=s.length>0&&void 0!==s[0]?s[0]:{video:!0,audio:!0},r=t.video,n=t.audio,i={video:!1,audio:!1},!r){e.next=13;break}return e.prev=4,e.next=7,MU.getPermissions({video:!0,force:!0});case 7:o=e.sent,i.video=o.video,e.next=13;break;case 11:e.prev=11,e.t0=e.catch(4);case 13:if(!n){e.next=23;break}return e.prev=14,e.next=17,MU.getPermissions({audio:!0,force:!0});case 17:a=e.sent,i.audio=a.audio,e.next=23;break;case 21:e.prev=21,e.t1=e.catch(14);case 23:return e.abrupt("return",i);case 24:case"end":return e.stop()}}),e,null,[[4,11],[14,21]])})));return function(){return e.apply(this,arguments)}}(),lW=function(){var e=km(Em().mark((function e(){return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",MU.enumerateAudioCaptureDevices());case 1:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),hW=function(){var e=km(Em().mark((function e(){return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",MU.enumerateVideoCaptureDevices());case 1:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),fW=function(){var e=km(Em().mark((function e(){return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",MU.enumerateAudioPlaybackDevices());case 1:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),pW=function(){return CN.VERSION},vW=function(){return iN.rtcSdkApiCall("isSupported",0,""),aL()},_W=function(){return iN.rtcSdkApiCall("getSupportedCodecs",0,""),cL()},mW=function(e){var t=e.logLevel,r=e.LogfileSize;t&&(kC.logLevel=t),r&&(kC.LogfileSize=r)},gW=function(e){kC.download(e)};function yW(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return tg(sg(t).call(t,(function(e){return e instanceof rW?"[ENGINE]":e})))}function SW(e,t){return function(){hN(t,0,yW.apply(void 0,arguments));var r=e.apply(void 0,arguments);return"function"==typeof(null==r?void 0:r.then)?r.then((function(e){return fN(t,0,yW(e)),e})).catch((function(e){throw fN(t,e.code,e.message),e})):(fN(t,0,yW(r)),r)}}return!uw()&&Jm(iW=location.search).call(iW,"_rtc_autotest_"),ud(ud(ud(ud({},new(qd((function e(){Wd(this,e),sd(this,"getSdkVersion",SW(pW,"getSdkVersion")),sd(this,"createEngine",SW(sW,"createEngine")),sd(this,"destroyEngine",SW(cW,"destroyEngine")),sd(this,"enumerateDevices",SW(uW,"enumerateDevices")),sd(this,"enableDevices",SW(dW,"enableDevices")),sd(this,"enumerateAudioCaptureDevices",SW(lW,"enumerateAudioCaptureDevices")),sd(this,"enumerateVideoCaptureDevices",SW(hW,"enumerateVideoCaptureDevices")),sd(this,"enumerateAudioPlaybackDevices",SW(fW,"enumerateAudioPlaybackDevices")),sd(this,"getParameter",DN),sd(this,"setParameter",ON),sd(this,"isSupported",SW(vW,"isSupported")),sd(this,"getSupportedCodecs",SW(_W,"getSupportedCodecs")),sd(this,"ConnectionMode",Fd),sd(this,"events",Kd),sd(this,"ErrorCode",uR),sd(this,"platform","BytePlus"),sd(this,"_monitor",iN),sd(this,"_rtmMonitor",oN),sd(this,"downloadLog",SW(gW,"downloadLog")),sd(this,"setLogConfig",SW(mW,"setLogConfig"))})))),Bd),zd),{},{events:Kd})}));