@byteplus/rtc 4.53.5 → 4.53.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.53.5
4
+ * version: 4.53.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,v=h.call,p=l&&h.bind.bind(v,v),_=l?p:function(e){return function(){return v.apply(e,arguments)}},f=_,m=f({}.toString),g=f("".slice),y=function(e){return g(m(e),8,-1)},S=y,b=_,E=function(e){if("Function"===S(e))return b(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={},C=!i((function(){return 7!=Object.defineProperty({},1,{get:function(){return 7}})[1]})),w=o,x=Function.prototype.call,O=w?x.bind(x):function(){return x.apply(x,arguments)},P={},M={}.propertyIsEnumerable,N=Object.getOwnPropertyDescriptor,D=N&&!M.call({1:2},1);P.f=D?function(e){var t=N(this,e);return!!t&&t.enumerable}:M;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=E("".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},X=z,K=TypeError,q=function(e){if(X(e))throw K("Can't call method on "+e);return e},Y=H,W=q,Q=function(e){return Y(W(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=E({}.isPrototypeOf),se=oe("navigator","userAgent")||"",ce=n,ue=se,de=ce.process,le=ce.Deno,he=de&&de.versions||le&&le.version,ve=he&&he.v8;ve&&(U=(L=ve.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,_e=pe,fe=i,me=!!Object.getOwnPropertySymbols&&!fe((function(){var e=Symbol();return!String(e)||!(Object(e)instanceof Symbol)||!Symbol.sham&&_e&&_e<41})),ge=me&&!Symbol.sham&&"symbol"==typeof Symbol.iterator,ye=oe,Se=A,be=ae,Ee=Object,ke=ge?function(e){return"symbol"==typeof e}:function(e){var t=ye("Symbol");return Se(t)&&be(t.prototype,Ee(e))},Te=String,Ie=function(e){try{return Te(e)}catch(t){return"Object"}},Ae=A,Re=Ie,Ce=TypeError,we=function(e){if(Ae(e))return e;throw Ce(Re(e)+" is not a function")},xe=we,Oe=z,Pe=function(e,t){var r=e[t];return Oe(r)?void 0:xe(r)},Me=O,Ne=A,De=$,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,Xe=Object,Ke=function(e){return Xe(ze(e))},qe=Ke,Ye=E({}.hasOwnProperty),We=Object.hasOwn||function(e,t){return Ye(qe(e),t)},Qe=E,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=We,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=O,vt=$,pt=ke,_t=Pe,ft=function(e,t){var r,n;if("string"===t&&Ne(r=e.toString)&&!De(n=Me(r,e)))return n;if(Ne(r=e.valueOf)&&!De(n=Me(r,e)))return n;if("string"!==t&&Ne(r=e.toString)&&!De(n=Me(r,e)))return n;throw Le("Can't convert object to primitive value")},mt=TypeError,gt=lt("toPrimitive"),yt=function(e,t){if(!vt(e)||pt(e))return e;var r,n=_t(e,gt);if(n){if(void 0===t&&(t="default"),r=ht(n,e,t),!vt(r)||pt(r))return r;throw mt("Can't convert object to primitive value")}return void 0===t&&(t="number"),ft(e,t)},St=ke,bt=function(e){var t=yt(e,"string");return St(t)?t:t+""},Et=$,kt=n.document,Tt=Et(kt)&&Et(kt.createElement),It=function(e){return Tt?kt.createElement(e):{}},At=It,Rt=!C&&!i((function(){return 7!=Object.defineProperty(At("div"),"a",{get:function(){return 7}}).a})),Ct=C,wt=O,xt=P,Ot=V,Pt=Q,Mt=bt,Nt=We,Dt=Rt,Lt=Object.getOwnPropertyDescriptor;R.f=Ct?Lt:function(e,t){if(e=Pt(e),t=Mt(t),Dt)try{return Lt(e,t)}catch(r){}if(Nt(e,t))return Ot(!wt(xt.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",Xt=Bt,Kt=we,qt=o,Yt=E(E.bind),Wt=function(e,t){return Kt(e),void 0===t?e:qt?Yt(e,t):function(){return e.apply(t,arguments)}},Qt={},Jt=C&&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=C,nr=Rt,ir=Jt,or=tr,ar=bt,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 vr=Qt,pr=V,_r=C?function(e,t,r){return vr.f(e,t,pr(1,r))}:function(e,t,r){return e[t]=r,e},fr=n,mr=d,gr=E,yr=A,Sr=R.f,br=Xt,Er=ee,kr=Wt,Tr=_r,Ir=We,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,v=e.proto,p=l?fr:h?fr[d]:(fr[d]||{}).prototype,_=l?Er:Er[d]||Tr(Er,d,{})[d],f=_.prototype;for(i in t)r=!br(l?i:d+(h?".":"#")+i,e.forced)&&p&&Ir(p,i),a=_[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,fr):e.wrap&&r?Ar(o):v&&yr(o)?gr(o):o,(e.sham||o&&o.sham||a&&a.sham)&&Tr(c,"sham",!0),Tr(_,i,c),v&&(Ir(Er,n=d+"Prototype")||Tr(Er,n,{}),Tr(Er[n],i,o),e.real&&f&&!f[i]&&Tr(f,i,o)))},Cr=Math.ceil,wr=Math.floor,xr=Math.trunc||function(e){var t=+e;return(t>0?wr:Cr)(t)},Or=function(e){var t=+e;return t!=t||0===t?0:xr(t)},Pr=Or,Mr=Math.max,Nr=Math.min,Dr=function(e,t){var r=Pr(e);return r<0?Mr(r+t,0):Nr(r,t)},Lr=Or,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=Dr,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}},Xr={includes:zr(!0),indexOf:zr(!1)},Kr={},qr=We,Yr=Q,Wr=Xr.indexOf,Qr=Kr,Jr=E([].push),Zr=function(e,t){var r,n=Yr(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++])&&(~Wr(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=Ke,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"),vn=Object,pn="Arguments"==ln(function(){return arguments}()),_n=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=vn(e),hn))?r:pn?ln(t):"Object"==(n=ln(t))&&dn(t.callee)?"Arguments":n},fn=_n,mn=String,gn=function(e){if("Symbol"===fn(e))throw TypeError("Cannot convert a Symbol value to a string");return mn(e)},yn={},Sn=C,bn=Jt,En=Qt,kn=tr,Tn=Q,In=rn;yn.f=Sn&&!bn?Object.defineProperties:function(e,t){kn(e);for(var r,n=Tn(t),i=In(t),o=i.length,a=0;o>a;)En.f(e,r=i[a++],n[r]);return e};var An,Rn=oe("document","documentElement"),Cn=Ue.exports,wn=et,xn=Cn("keys"),On=function(e){return xn[e]||(xn[e]=wn(e))},Pn=tr,Mn=yn,Nn=$r,Dn=Kr,Ln=Rn,Un=It,Vn=On("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()};Dn[Vn]=!0;var Hn=Object.create||function(e,t){var r;return null!==e?(Fn.prototype=Pn(e),r=new Fn,Fn.prototype=null,r[Vn]=e):r=Gn(),void 0===t?r:Mn.f(r,t)},zn={},Xn=Zr,Kn=$r.concat("length","prototype");zn.f=Object.getOwnPropertyNames||function(e){return Xn(e,Kn)};var qn={},Yn=bt,Wn=Qt,Qn=V,Jn=function(e,t,r){var n=Yn(t);n in e?Wn.f(e,n,Qn(0,r)):e[n]=r},Zn=Dr,$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=_r,li=function(e,t,r,n){return n&&n.enumerable?e[t]=r:di(e,t,r),e},hi={},vi=lt;hi.f=vi;var pi,_i,fi,mi=ee,gi=We,yi=hi,Si=Qt.f,bi=function(e){var t=mi.Symbol||(mi.Symbol={});gi(t,e)||Si(t,e,{value:yi.f(e)})},Ei=O,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 Ei(r,this)}),{arity:1})},Ri=_n,Ci=cn?{}.toString:function(){return"[object "+Ri(this)+"]"},wi=cn,xi=Qt.f,Oi=_r,Pi=We,Mi=Ci,Ni=lt("toStringTag"),Di=function(e,t,r,n){if(e){var i=r?e:e.prototype;Pi(i,Ni)||xi(i,Ni,{configurable:!0,value:t}),n&&!wi&&Oi(i,"toString",Mi)}},Li=A,Ui=n.WeakMap,Vi=Li(Ui)&&/native code/.test(String(Ui)),Fi=Vi,Bi=n,ji=$,Gi=_r,Hi=We,zi=Ge,Xi=On,Ki=Kr,qi="Object already initialized",Yi=Bi.TypeError,Wi=Bi.WeakMap;if(Fi||zi.state){var Qi=zi.state||(zi.state=new Wi);Qi.get=Qi.get,Qi.has=Qi.has,Qi.set=Qi.set,pi=function(e,t){if(Qi.has(e))throw Yi(qi);return t.facade=e,Qi.set(e,t),t},_i=function(e){return Qi.get(e)||{}},fi=function(e){return Qi.has(e)}}else{var Ji=Xi("state");Ki[Ji]=!0,pi=function(e,t){if(Hi(e,Ji))throw Yi(qi);return t.facade=e,Gi(e,Ji,t),t},_i=function(e){return Hi(e,Ji)?e[Ji]:{}},fi=function(e){return Hi(e,Ji)}}var Zi={set:pi,get:_i,has:fi,enforce:function(e){return fi(e)?_i(e):pi(e,{})},getterFor:function(e){return function(t){var r;if(!ji(t)||(r=_i(t)).type!==e)throw Yi("Incompatible receiver, "+e+" required");return r}}},$i=y,eo=Array.isArray||function(e){return"Array"==$i(e)},to=A,ro=Ge,no=E(Function.toString);to(ro.inspectSource)||(ro.inspectSource=function(e){return no(e)});var io=ro.inspectSource,oo=E,ao=i,so=A,co=_n,uo=io,lo=function(){},ho=[],vo=oe("Reflect","construct"),po=/^\s*(?:class|function)\b/,_o=oo(po.exec),fo=!po.exec(lo),mo=function(e){if(!so(e))return!1;try{return vo(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 fo||!!_o(po,uo(e))}catch(t){return!0}};go.sham=!0;var yo=!vo||ao((function(){var e;return mo(mo.call)||!mo(Object)||!mo((function(){e=!0}))||e}))?go:mo,So=eo,bo=yo,Eo=$,ko=lt("species"),To=Array,Io=function(e){var t;return So(e)&&(t=e.constructor,(bo(t)&&(t===To||So(t.prototype))||Eo(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=Wt,Co=H,wo=Ke,xo=Br,Oo=Ao,Po=E([].push),Mo=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,v,p=wo(c),_=Co(p),f=Ro(u,d),m=xo(_),g=0,y=l||Oo,S=t?y(c,m):r||a?y(c,0):void 0;m>g;g++)if((s||g in _)&&(v=f(h=_[g],g,p),e))if(t)S[g]=v;else if(v)switch(e){case 3:return!0;case 5:return h;case 6:return g;case 2:Po(S,h)}else switch(e){case 4:return!1;case 7:Po(S,h)}return o?-1:n||i?i:S}},No={forEach:Mo(0),map:Mo(1),filter:Mo(2),some:Mo(3),every:Mo(4),find:Mo(5),findIndex:Mo(6),filterReject:Mo(7)},Do=Rr,Lo=n,Uo=O,Vo=E,Fo=C,Bo=me,jo=i,Go=We,Ho=ae,zo=tr,Xo=Q,Ko=bt,qo=gn,Yo=V,Wo=Hn,Qo=rn,Jo=zn,Zo=qn,$o=ui,ea=R,ta=Qt,ra=yn,na=P,ia=li,oa=Ue.exports,aa=Kr,sa=et,ca=lt,ua=hi,da=bi,la=Ai,ha=Di,va=Zi,pa=No.forEach,_a=On("hidden"),fa="Symbol",ma=va.set,ga=va.getterFor(fa),ya=Object.prototype,Sa=Lo.Symbol,ba=Sa&&Sa.prototype,Ea=Lo.TypeError,ka=Lo.QObject,Ta=ea.f,Ia=ta.f,Aa=Zo.f,Ra=na.f,Ca=Vo([].push),wa=oa("symbols"),xa=oa("op-symbols"),Oa=oa("wks"),Pa=!ka||!ka.prototype||!ka.prototype.findChild,Ma=Fo&&jo((function(){return 7!=Wo(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=wa[e]=Wo(ba);return ma(r,{type:fa,tag:e,description:t}),Fo||(r.description=t),r},Da=function(e,t,r){e===ya&&Da(xa,t,r),zo(e);var n=Ko(t);return zo(r),Go(wa,n)?(r.enumerable?(Go(e,_a)&&e[_a][n]&&(e[_a][n]=!1),r=Wo(r,{enumerable:Yo(0,!1)})):(Go(e,_a)||Ia(e,_a,Yo(1,{})),e[_a][n]=!0),Ma(e,n,r)):Ia(e,n,r)},La=function(e,t){zo(e);var r=Xo(t),n=Qo(r).concat(Ba(r));return pa(n,(function(t){Fo&&!Uo(Ua,r,t)||Da(e,t,r[t])})),e},Ua=function(e){var t=Ko(e),r=Uo(Ra,this,t);return!(this===ya&&Go(wa,t)&&!Go(xa,t))&&(!(r||!Go(this,t)||!Go(wa,t)||Go(this,_a)&&this[_a][t])||r)},Va=function(e,t){var r=Xo(e),n=Ko(t);if(r!==ya||!Go(wa,n)||Go(xa,n)){var i=Ta(r,n);return!i||!Go(wa,n)||Go(r,_a)&&r[_a][n]||(i.enumerable=!0),i}},Fa=function(e){var t=Aa(Xo(e)),r=[];return pa(t,(function(e){Go(wa,e)||Go(aa,e)||Ca(r,e)})),r},Ba=function(e){var t=e===ya,r=Aa(t?xa:Xo(e)),n=[];return pa(r,(function(e){!Go(wa,e)||t&&!Go(ya,e)||Ca(n,wa[e])})),n};Bo||(Sa=function(){if(Ho(ba,this))throw Ea("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,xa,e),Go(this,_a)&&Go(this[_a],t)&&(this[_a][t]=!1),Ma(this,t,Yo(1,e))};return Fo&&Pa&&Ma(ya,t,{configurable:!0,set:r}),Na(t,e)},ia(ba=Sa.prototype,"toString",(function(){return ga(this).tag})),ia(Sa,"withoutSetter",(function(e){return Na(sa(e),e)})),na.f=Ua,ta.f=Da,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(ba,"description",{configurable:!0,get:function(){return ga(this).description}})),Do({global:!0,constructor:!0,wrap:!0,forced:!Bo,sham:!Bo},{Symbol:Sa}),pa(Qo(Oa),(function(e){da(e)})),Do({target:fa,stat:!0,forced:!Bo},{useSetter:function(){Pa=!0},useSimple:function(){Pa=!1}}),Do({target:"Object",stat:!0,forced:!Bo,sham:!Fo},{create:function(e,t){return void 0===t?Wo(e):La(Wo(e),t)},defineProperty:Da,defineProperties:La,getOwnPropertyDescriptor:Va}),Do({target:"Object",stat:!0,forced:!Bo},{getOwnPropertyNames:Fa}),la(),ha(Sa,fa),aa[_a]=!0;var ja=me&&!!Symbol.for&&!!Symbol.keyFor,Ga=Rr,Ha=oe,za=We,Xa=gn,Ka=Ue.exports,qa=ja,Ya=Ka("string-to-symbol-registry"),Wa=Ka("symbol-to-string-registry");Ga({target:"Symbol",stat:!0,forced:!qa},{for:function(e){var t=Xa(e);if(za(Ya,t))return Ya[t];var r=Ha("Symbol")(t);return Ya[t]=r,Wa[r]=t,r}});var Qa=Rr,Ja=We,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=E([].slice),ns=Rr,is=oe,os=d,as=O,ss=E,cs=i,us=eo,ds=A,ls=$,hs=ke,vs=rs,ps=me,_s=is("JSON","stringify"),fs=ss(/./.exec),ms=ss("".charAt),gs=ss("".charCodeAt),ys=ss("".replace),Ss=ss(1..toString),bs=/[\uD800-\uDFFF]/g,Es=/^[\uD800-\uDBFF]$/,ks=/^[\uDC00-\uDFFF]$/,Ts=!ps||cs((function(){var e=is("Symbol")();return"[null]"!=_s([e])||"{}"!=_s({a:e})||"{}"!=_s(Object(e))})),Is=cs((function(){return'"\\udf06\\ud834"'!==_s("\udf06\ud834")||'"\\udead"'!==_s("\udead")})),As=function(e,t){var r=vs(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(_s,null,r)},Rs=function(e,t,r){var n=ms(r,t-1),i=ms(r,t+1);return fs(Es,e)&&!fs(ks,i)||fs(ks,e)&&!fs(Es,n)?"\\u"+Ss(gs(e,0),16):e};_s&&ns({target:"JSON",stat:!0,arity:3,forced:Ts||Is},{stringify:function(e,t,r){var n=vs(arguments),i=os(Ts?As:_s,null,n);return Is&&"string"==typeof i?ys(i,bs,Rs):i}});var Cs=ui,ws=Ke;Rr({target:"Object",stat:!0,forced:!me||i((function(){Cs.f(1)}))},{getOwnPropertySymbols:function(e){var t=Cs.f;return t?t(ws(e)):[]}});var xs=ee.Object.getOwnPropertySymbols,Os=i,Ps=pe,Ms=lt("species"),Ns=function(e){return Ps>=51||!Os((function(){var t=[];return(t.constructor={})[Ms]=function(){return{foo:1}},1!==t[e](Boolean).foo}))},Ds=No.filter;Rr({target:"Array",proto:!0,forced:!Ns("filter")},{filter:function(e){return Ds(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,Xs=i,Ks=Q,qs=R.f,Ys=C,Ws=Xs((function(){qs(1)}));zs({target:"Object",stat:!0,forced:!Ys||Ws,sham:!Ys},{getOwnPropertyDescriptor:function(e,t){return qs(Ks(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=C,ic=We,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=We,lc=A,hc=Ke,vc=uc,pc=On("IE_PROTO"),_c=Object,fc=_c.prototype,mc=vc?_c.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 _c?fc:null},gc=i,yc=A,Sc=$,bc=Hn,Ec=mc,kc=li,Tc=lt("iterator"),Ic=!1;[].keys&&("next"in(ec=[].keys())?($s=Ec(Ec(ec)))!==Object.prototype&&(Zs=$s):Ic=!0);var Ac=!Sc(Zs)||gc((function(){var e={};return Zs[Tc].call(e)!==e}));yc((Zs=Ac?{}:bc(Zs))[Tc])||kc(Zs,Tc,(function(){return this}));var Rc={IteratorPrototype:Zs,BUGGY_SAFARI_ITERATORS:Ic},Cc=Rc.IteratorPrototype,wc=Hn,xc=V,Oc=Di,Pc=rc,Mc=function(){return this},Nc=function(e,t,r,n){var i=t+" Iterator";return e.prototype=wc(Cc,{next:xc(+!n,r)}),Oc(e,i,!1,!0),Pc[i]=Mc,e},Dc=A,Lc=String,Uc=TypeError,Vc=E,Fc=tr,Bc=function(e){if("object"==typeof e||Dc(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=O,zc=cc,Xc=Nc,Kc=mc,qc=Di,Yc=li,Wc=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){Xc(r,t,n);var s,c,u,d=function(e){if(e===i&&_)return _;if(!Zc&&e in v)return v[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,v=e.prototype,p=v[$c]||v["@@iterator"]||i&&v[i],_=!Zc&&p||d(i),f="Array"==t&&v.entries||p;if(f&&(s=Kc(f.call(new e)))!==Object.prototype&&s.next&&(qc(s,l,!0,!0),Wc[l]=nu),Jc&&i==tu&&p&&p.name!==tu&&(h=!0,_=function(){return Hc(p,this)}),i)if(c={values:d(tu),keys:o?_:d(eu),entries:d(ru)},a)for(u in c)(Zc||h||!(u in v))&&Yc(v,u,c[u]);else Gc({target:t,proto:!0,forced:Zc||h},c);return a&&v[$c]!==_&&Yc(v,$c,_,{name:i}),Wc[t]=_,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",vu=uu.set,pu=uu.getterFor(hu);du(Array,"Array",(function(e,t){vu(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 _u={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},fu=n,mu=_n,gu=_r,yu=rc,Su=lt("toStringTag");for(var bu in _u){var Eu=fu[bu],ku=Eu&&Eu.prototype;ku&&mu(ku)!==Su&&gu(ku,Su,bu),yu[bu]=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 Cu=Us("Array").forEach,wu=_n,xu=We,Ou=ae,Pu=Cu,Mu=Array.prototype,Nu={DOMTokenList:!0,NodeList:!0},Du=function(e){var t=e.forEach;return e===Mu||Ou(Mu,e)&&t===Mu.forEach||xu(Nu,wu(e))?Pu:t},Lu=oe,Uu=zn,Vu=ui,Fu=tr,Bu=E([].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,Xu=Jn;Rr({target:"Object",stat:!0,sham:!C},{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++]))&&Xu(a,t,r);return a}});var Ku=ee.Object.getOwnPropertyDescriptors,qu={exports:{}},Yu=Rr,Wu=C,Qu=yn.f;Yu({target:"Object",stat:!0,forced:Object.defineProperties!==Qu,sham:!Wu},{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=C,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,sd=TypeError,cd=function(e){if(e>9007199254740991)throw sd("Maximum allowed index exceeded");return e},ud=Rr,dd=i,ld=eo,hd=$,vd=Ke,pd=Br,_d=cd,fd=Jn,md=Ao,gd=Ns,yd=pe,Sd=lt("isConcatSpreadable"),bd=yd>=51||!dd((function(){var e=[];return e[Sd]=!1,e.concat()[0]!==e})),Ed=gd("concat"),kd=function(e){if(!hd(e))return!1;var t=e[Sd];return void 0!==t?!!t:ld(e)};ud({target:"Array",proto:!0,arity:1,forced:!bd||!Ed},{concat:function(e){var t,r,n,i,o,a=vd(this),s=md(a,0),c=0;for(t=-1,n=arguments.length;t<n;t++)if(kd(o=-1===t?a:arguments[t]))for(i=pd(o),_d(c+i),r=0;r<i;r++,c++)r in o&&fd(s,c,o[r]);else _d(c+1),fd(s,c++,o);return s.length=c,s}}),bi("asyncIterator"),bi("hasInstance"),bi("isConcatSpreadable"),bi("iterator"),bi("match"),bi("matchAll"),bi("replace"),bi("search"),bi("species"),bi("split");var Td=Ai;bi("toPrimitive"),Td();var Id=oe,Ad=Di;bi("toStringTag"),Ad(Id("Symbol"),"Symbol"),bi("unscopables"),Di(n.JSON,"JSON",!0);var Rd=ee.Symbol;bi("asyncDispose"),bi("dispose"),bi("matcher"),bi("metadataKey"),bi("observable"),bi("metadata"),bi("patternMatch"),bi("replaceAll");var Cd=Rd,wd=E,xd=Or,Od=gn,Pd=q,Md=wd("".charAt),Nd=wd("".charCodeAt),Dd=wd("".slice),Ld=function(e){return function(t,r){var n,i,o=Od(Pd(t)),a=xd(r),s=o.length;return a<0||a>=s?e?"":void 0:(n=Nd(o,a))<55296||n>56319||a+1===s||(i=Nd(o,a+1))<56320||i>57343?e?Md(o,a):n:e?Dd(o,a,a+2):i-56320+(n-55296<<10)+65536}},Ud={codeAt:Ld(!1),charAt:Ld(!0)},Vd=Ud.charAt,Fd=gn,Bd=Zi,jd=iu,Gd=ou,Hd="String Iterator",zd=Bd.set,Xd=Bd.getterFor(Hd);jd(String,"String",(function(e){zd(this,{type:Hd,string:Fd(e),index:0})}),(function(){var e,t=Xd(this),r=t.string,n=t.index;return n>=r.length?Gd(void 0,!0):(e=Vd(r,n),t.index+=e.length,Gd(e,!1))}));var Kd=hi.f("iterator");function qd(e){return(qd="function"==typeof Cd&&"symbol"==typeof Kd?function(e){return typeof e}:function(e){return e&&"function"==typeof Cd&&e.constructor===Cd&&e!==Cd.prototype?"symbol":typeof e})(e)}var Yd=hi.f("toPrimitive");function Wd(e){var t=function(e,t){if("object"!==qd(e)||null===e)return e;var r=e[Yd];if(void 0!==r){var n=r.call(e,t||"default");if("object"!==qd(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===qd(t)?t:String(t)}function Qd(e,t,r){return(t=Wd(t))in e?ad(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Jd(e,t){var r=an(e);if(xs){var n=xs(e);t&&(n=Gs(n).call(n,(function(t){return tc(e,t).enumerable}))),r.push.apply(r,n)}return r}function Zd(e){for(var t=1;t<arguments.length;t++){var r,n,i=null!=arguments[t]?arguments[t]:{};t%2?Du(r=Jd(Object(i),!0)).call(r,(function(t){Qd(e,t,i[t])})):Ku?$u(e,Ku(i)):Du(n=Jd(Object(i))).call(n,(function(t){ad(e,t,tc(i,t))}))}return e}var $d=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}($d||{}),el=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}(el||{}),tl=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}(tl||{}),rl=function(e){return e[e.CHANNEL_PROFILE_COMMUNICATION=0]="CHANNEL_PROFILE_COMMUNICATION",e[e.CHANNEL_PROFILE_LIVE_BROADCASTING=1]="CHANNEL_PROFILE_LIVE_BROADCASTING",e}(rl||{}),nl=function(e){return e[e.AUTO_SUBSCRIBE_MODE=0]="AUTO_SUBSCRIBE_MODE",e[e.MANUAL_SUBSCRIBE_MODE=1]="MANUAL_SUBSCRIBE_MODE",e}(nl||{}),il=function(e){return e[e.SUBSCRIBE_SUCC=0]="SUBSCRIBE_SUCC",e[e.SUBSCRIBE_FAIL=1]="SUBSCRIBE_FAIL",e}(il||{}),ol=function(e){return e[e.PUBLISH_SUCC=0]="PUBLISH_SUCC",e[e.PUBLISH_FAIL=1]="PUBLISH_FAIL",e}(ol||{}),al=function(e){return e[e.MIRROR_MODE_OFF=0]="MIRROR_MODE_OFF",e[e.MIRROR_MODE_ON=1]="MIRROR_MODE_ON",e}(al||{}),sl=function(e){return e[e.RENDER_MODE_HIDDEN=0]="RENDER_MODE_HIDDEN",e[e.RENDER_MODE_FIT=1]="RENDER_MODE_FIT",e[e.RENDER_MODE_FILL=2]="RENDER_MODE_FILL",e}(sl||{}),cl=function(e){return e[e.STREAM_INDEX_MAIN=0]="STREAM_INDEX_MAIN",e[e.STREAM_INDEX_SCREEN=1]="STREAM_INDEX_SCREEN",e}(cl||{}),ul=function(e){return e[e.AUDIO=1]="AUDIO",e[e.VIDEO=2]="VIDEO",e[e.AUDIO_AND_VIDEO=3]="AUDIO_AND_VIDEO",e}(ul||{}),dl=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}(dl||{}),ll=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}(ll||{}),hl=function(e){return e[e.MIRROR_TYPE_NONE=0]="MIRROR_TYPE_NONE",e[e.MIRROR_TYPE_RENDER=1]="MIRROR_TYPE_RENDER",e}(hl||{}),vl=function(e){return e[e.domestic=0]="domestic",e[e.overseas=1]="overseas",e}(vl||{}),pl=function(e){return e[e.OFFLINE=0]="OFFLINE",e[e.ONLINE=1]="ONLINE",e[e.UNREACHABLE=2]="UNREACHABLE",e}(pl||{}),_l=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}(_l||{}),fl=function(e){return e[e.PREV_FRAME=0]="PREV_FRAME",e[e.OTHER_FRAME=1]="OTHER_FRAME",e}(fl||{}),ml=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}(ml||{}),gl=function(e){return e[e.LOW=0]="LOW",e[e.MEDIUM=100]="MEDIUM",e[e.HIGH=200]="HIGH",e}(gl||{}),yl=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}(yl||{}),Sl=function(e){return e[e.Unknown=-1]="Unknown",e[e.SubscribeFallbackByBandwidth=0]="SubscribeFallbackByBandwidth",e[e.SubscribeRecoverByBandwidth=2]="SubscribeRecoverByBandwidth",e}(Sl||{}),bl=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}(bl||{}),El=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}(El||{}),kl=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}(kl||{}),Tl=function(e){return e.LC="LC",e.HEv1="HEv1",e.HEv2="HEv2",e}(Tl||{}),Il=function(e){return e.H264="H264",e.H265="H265",e}(Il||{}),Al=function(e){return e[e.ASR_ONLY=0]="ASR_ONLY",e[e.ASR_AND_TRANSLATION=1]="ASR_AND_TRANSLATION",e}(Al||{}),Rl=function(e){return e[e.STARTED=0]="STARTED",e[e.STOPPED=1]="STOPPED",e[e.ERROR=2]="ERROR",e}(Rl||{}),Cl=Object.freeze(Object.defineProperty({__proto__:null,VideoSourceType:$d,AudioSourceType:el,UserOfflineReason:tl,ChannelProfile:rl,SubscribeMode:nl,SubscribeState:il,PublishState:ol,MirrorMode:al,VideoRenderMode:sl,StreamIndex:cl,MediaType:ul,StreamRemoveReason:dl,ConnectionState:ll,MirrorType:hl,LogChannel:vl,USER_ONLINE_STATUS:pl,PublicStreamType:_l,PublicInterpolationMode:fl,SubscribeFallbackOption:ml,RemoteUserPriority:gl,NetworkQuality:yl,FallbackOrRecoverReason:Sl,RoomProfileType:bl,AudioProfileType:El,RTCAutoPlayPolicy:kl,AAC_PROFILE:Tl,TRANSCODING_VIDEO_CODEC:Il,SUBTITLE_MODE:Al,SubtitleEventType:Rl},Symbol.toStringTag,{value:"Module"})),wl=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}(wl||{}),xl=function(e){return e[e.PLAYOUT=0]="PLAYOUT",e[e.PUBLISH=1]="PUBLISH",e[e.PLAYOUT_AND_PUBLISH=2]="PLAYOUT_AND_PUBLISH",e}(xl||{}),Ol=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}(Ol||{}),Pl=Object.freeze(Object.defineProperty({__proto__:null,AudioMixingDualMonoMode:wl,AudioMixingType:xl,AudioMixingState:Ol},Symbol.toStringTag,{value:"Module"})),Ml=function(e){return e.onTrackEnded="onTrackEnded",e.onTrackMute="onTrackMute",e.onTrackUnmute="onTrackUnmute",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.onVendorConnectionStateChanged="onVendorConnectionStateChanged",e}(Ml||{});function Nl(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,Wd(n.key),n)}}function Dl(e,t,r){return t&&Nl(e.prototype,t),r&&Nl(e,r),ad(e,"prototype",{writable:!1}),e}function Ll(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Rr({target:"Object",stat:!0,sham:!C},{create:Hn});var Ul=ee.Object,Vl=function(e,t){return Ul.create(e,t)},Fl=Ke,Bl=mc,jl=uc;Rr({target:"Object",stat:!0,forced:i((function(){Bl(1)})),sham:!jl},{getPrototypeOf:function(e){return Bl(Fl(e))}});var Gl=ee.Object.getPrototypeOf;Rr({target:"Object",stat:!0},{setPrototypeOf:jc});var Hl=ee.Object.setPrototypeOf,zl=We,Xl=ju,Kl=R,ql=Qt,Yl=Error,Wl=E("".replace),Ql=String(Yl("zxcasd").stack),Jl=/\n\s*at [^:]*:[^\n]*/,Zl=Jl.test(Ql),$l=$,eh=_r,th=rc,rh=lt("iterator"),nh=Array.prototype,ih=function(e){return void 0!==e&&(th.Array===e||nh[rh]===e)},oh=_n,ah=Pe,sh=z,ch=rc,uh=lt("iterator"),dh=function(e){if(!sh(e))return ah(e,uh)||ah(e,"@@iterator")||ch[oh(e)]},lh=O,hh=we,vh=tr,ph=Ie,_h=dh,fh=TypeError,mh=function(e,t){var r=arguments.length<2?_h(e):t;if(hh(r))return vh(lh(r,e));throw fh(ph(e)+" is not iterable")},gh=O,yh=tr,Sh=Pe,bh=function(e,t,r){var n,i;yh(e);try{if(!(n=Sh(e,"return"))){if("throw"===t)throw r;return r}n=gh(n,e)}catch(o){i=!0,n=o}if("throw"===t)throw r;if(i)throw n;return yh(n),r},Eh=Wt,kh=O,Th=tr,Ih=Ie,Ah=ih,Rh=Br,Ch=ae,wh=mh,xh=dh,Oh=bh,Ph=TypeError,Mh=function(e,t){this.stopped=e,this.result=t},Nh=Mh.prototype,Dh=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),v=!(!r||!r.IS_ITERATOR),p=!(!r||!r.INTERRUPTED),_=Eh(t,d),f=function(e){return n&&Oh(n,"normal",e),new Mh(!0,e)},m=function(e){return l?(Th(e),p?_(e[0],e[1],f):_(e[0],e[1])):p?_(e,f):_(e)};if(h)n=e.iterator;else if(v)n=e;else{if(!(i=xh(e)))throw Ph(Ih(e)+" is not iterable");if(Ah(i)){for(o=0,a=Rh(e);a>o;o++)if((s=m(e[o]))&&Ch(Nh,s))return s;return new Mh(!1)}n=wh(e,i)}for(c=h?e.next:n.next;!(u=kh(c,n)).done;){try{s=m(u.value)}catch(g){Oh(n,"throw",g)}if("object"==typeof s&&s&&Ch(Nh,s))return s}return new Mh(!1)},Lh=gn,Uh=V,Vh=!i((function(){var e=Error("a");return!("stack"in e)||(Object.defineProperty(e,"stack",Uh(1,7)),7!==e.stack)})),Fh=Rr,Bh=ae,jh=mc,Gh=jc,Hh=function(e,t,r){for(var n=Xl(t),i=ql.f,o=Kl.f,a=0;a<n.length;a++){var s=n[a];zl(e,s)||r&&zl(r,s)||i(e,s,o(t,s))}},zh=Hn,Xh=_r,Kh=V,qh=function(e,t){if(Zl&&"string"==typeof e&&!Yl.prepareStackTrace)for(;t--;)e=Wl(e,Jl,"");return e},Yh=function(e,t){$l(t)&&"cause"in t&&eh(e,"cause",t.cause)},Wh=Dh,Qh=function(e,t){return void 0===e?arguments.length<2?"":t:Lh(e)},Jh=Vh,Zh=lt("toStringTag"),$h=Error,ev=[].push,tv=function(e,t){var r,n=arguments.length>2?arguments[2]:void 0,i=Bh(rv,this);Gh?r=Gh($h(),i?jh(this):rv):(r=i?this:zh(rv),Xh(r,Zh,"Error")),void 0!==t&&Xh(r,"message",Qh(t)),Jh&&Xh(r,"stack",qh(r.stack,1)),Yh(r,n);var o=[];return Wh(e,ev,{that:o}),Xh(r,"errors",o),r};Gh?Gh(tv,$h):Hh(tv,$h,{name:!0});var rv=tv.prototype=zh($h.prototype,{constructor:Kh(1,tv),message:Kh(1,""),name:Kh(1,"AggregateError")});Fh({global:!0,constructor:!0,arity:2},{AggregateError:tv});var nv,iv,ov,av,sv="process"==y(n.process),cv=oe,uv=Qt,dv=C,lv=lt("species"),hv=function(e){var t=cv(e),r=uv.f;dv&&t&&!t[lv]&&r(t,lv,{configurable:!0,get:function(){return this}})},vv=ae,pv=TypeError,_v=function(e,t){if(vv(t,e))return e;throw pv("Incorrect invocation")},fv=yo,mv=Ie,gv=TypeError,yv=function(e){if(fv(e))return e;throw gv(mv(e)+" is not a constructor")},Sv=tr,bv=yv,Ev=z,kv=lt("species"),Tv=function(e,t){var r,n=Sv(e).constructor;return void 0===n||Ev(r=Sv(n)[kv])?t:bv(r)},Iv=TypeError,Av=function(e,t){if(e<t)throw Iv("Not enough arguments");return e},Rv=/(?:ipad|iphone|ipod).*applewebkit/i.test(se),Cv=n,wv=d,xv=Wt,Ov=A,Pv=We,Mv=i,Nv=Rn,Dv=rs,Lv=It,Uv=Av,Vv=Rv,Fv=sv,Bv=Cv.setImmediate,jv=Cv.clearImmediate,Gv=Cv.process,Hv=Cv.Dispatch,zv=Cv.Function,Xv=Cv.MessageChannel,Kv=Cv.String,qv=0,Yv={},Wv="onreadystatechange";try{nv=Cv.location}catch(TK){}var Qv=function(e){if(Pv(Yv,e)){var t=Yv[e];delete Yv[e],t()}},Jv=function(e){return function(){Qv(e)}},Zv=function(e){Qv(e.data)},$v=function(e){Cv.postMessage(Kv(e),nv.protocol+"//"+nv.host)};Bv&&jv||(Bv=function(e){Uv(arguments.length,1);var t=Ov(e)?e:zv(e),r=Dv(arguments,1);return Yv[++qv]=function(){wv(t,void 0,r)},iv(qv),qv},jv=function(e){delete Yv[e]},Fv?iv=function(e){Gv.nextTick(Jv(e))}:Hv&&Hv.now?iv=function(e){Hv.now(Jv(e))}:Xv&&!Vv?(av=(ov=new Xv).port2,ov.port1.onmessage=Zv,iv=xv(av.postMessage,av)):Cv.addEventListener&&Ov(Cv.postMessage)&&!Cv.importScripts&&nv&&"file:"!==nv.protocol&&!Mv($v)?(iv=$v,Cv.addEventListener("message",Zv,!1)):iv=Wv in Lv("script")?function(e){Nv.appendChild(Lv("script")).onreadystatechange=function(){Nv.removeChild(this),Qv(e)}}:function(e){setTimeout(Jv(e),0)});var ep,tp,rp,np,ip,op,ap,sp,cp={set:Bv,clear:jv},up=n,dp=/ipad|iphone|ipod/i.test(se)&&void 0!==up.Pebble,lp=/web0s(?!.*chrome)/i.test(se),hp=n,vp=Wt,pp=R.f,_p=cp.set,fp=Rv,mp=dp,gp=lp,yp=sv,Sp=hp.MutationObserver||hp.WebKitMutationObserver,bp=hp.document,Ep=hp.process,kp=hp.Promise,Tp=pp(hp,"queueMicrotask"),Ip=Tp&&Tp.value;Ip||(ep=function(){var e,t;for(yp&&(e=Ep.domain)&&e.exit();tp;){t=tp.fn,tp=tp.next;try{t()}catch(TK){throw tp?np():rp=void 0,TK}}rp=void 0,e&&e.enter()},fp||yp||gp||!Sp||!bp?!mp&&kp&&kp.resolve?((ap=kp.resolve(void 0)).constructor=kp,sp=vp(ap.then,ap),np=function(){sp(ep)}):yp?np=function(){Ep.nextTick(ep)}:(_p=vp(_p,hp),np=function(){_p(ep)}):(ip=!0,op=bp.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,Cp=function(e){try{return{error:!1,value:e()}}catch(TK){return{error:!0,value:TK}}},wp=function(){this.head=null,this.tail=null};wp.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 xp=wp,Op=n.Promise,Pp="object"==typeof Deno&&Deno&&"object"==typeof Deno.version,Mp=!Pp&&!sv&&"object"==typeof window&&"object"==typeof document,Np=n,Dp=Op,Lp=A,Up=Xt,Vp=io,Fp=lt,Bp=Mp,jp=Pp,Gp=pe,Hp=Dp&&Dp.prototype,zp=Fp("species"),Xp=!1,Kp=Lp(Np.PromiseRejectionEvent),qp={CONSTRUCTOR:Up("Promise",(function(){var e=Vp(Dp),t=e!==String(Dp);if(!t&&66===Gp)return!0;if(!Hp.catch||!Hp.finally)return!0;if(!Gp||Gp<51||!/native code/.test(e)){var r=new Dp((function(e){e(1)})),n=function(e){e((function(){}),(function(){}))};if((r.constructor={})[zp]=n,!(Xp=r.then((function(){}))instanceof n))return!0}return!t&&(Bp||jp)&&!Kp})),REJECTION_EVENT:Kp,SUBCLASSING:Xp},Yp={},Wp=we,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=Wp(t),this.reject=Wp(r)};Yp.f=function(e){return new Jp(e)};var Zp,$p,e_=Rr,t_=sv,r_=n,n_=O,i_=li,o_=Di,a_=hv,s_=we,c_=A,u_=$,d_=_v,l_=Tv,h_=cp.set,v_=Ap,p_=function(e,t){var r=Rp.console;r&&r.error&&(1==arguments.length?r.error(e):r.error(e,t))},__=Cp,f_=xp,m_=Zi,g_=Op,y_=qp,S_=Yp,b_="Promise",E_=y_.CONSTRUCTOR,k_=y_.REJECTION_EVENT,T_=m_.getterFor(b_),I_=m_.set,A_=g_&&g_.prototype,R_=g_,C_=A_,w_=r_.TypeError,x_=r_.document,O_=r_.process,P_=S_.f,M_=P_,N_=!!(x_&&x_.createEvent&&r_.dispatchEvent),D_="unhandledrejection",L_=function(e){var t;return!(!u_(e)||!c_(t=e.then))&&t},U_=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&&G_(t),t.rejection=1),!0===s?r=o:(d&&d.enter(),r=s(o),d&&(d.exit(),i=!0)),r===e.promise?u(w_("Promise-chain cycle")):(n=L_(r))?n_(n,r,c,u):c(r)):u(o)}catch(TK){d&&!i&&d.exit(),u(TK)}},V_=function(e,t){e.notified||(e.notified=!0,v_((function(){for(var r,n=e.reactions;r=n.get();)U_(r,e);e.notified=!1,t&&!e.rejection&&B_(e)})))},F_=function(e,t,r){var n,i;N_?((n=x_.createEvent("Event")).promise=t,n.reason=r,n.initEvent(e,!1,!0),r_.dispatchEvent(n)):n={promise:t,reason:r},!k_&&(i=r_["on"+e])?i(n):e===D_&&p_("Unhandled promise rejection",r)},B_=function(e){n_(h_,r_,(function(){var t,r=e.facade,n=e.value;if(j_(e)&&(t=__((function(){t_?O_.emit("unhandledRejection",n,r):F_(D_,r,n)})),e.rejection=t_||j_(e)?2:1,t.error))throw t.value}))},j_=function(e){return 1!==e.rejection&&!e.parent},G_=function(e){n_(h_,r_,(function(){var t=e.facade;t_?O_.emit("rejectionHandled",t):F_("rejectionhandled",t,e.value)}))},H_=function(e,t,r){return function(n){e(t,n,r)}},z_=function(e,t,r){e.done||(e.done=!0,r&&(e=r),e.value=t,e.state=2,V_(e,!0))},X_=function(e,t,r){if(!e.done){e.done=!0,r&&(e=r);try{if(e.facade===t)throw w_("Promise can't be resolved itself");var n=L_(t);n?v_((function(){var r={done:!1};try{n_(n,t,H_(X_,r,e),H_(z_,r,e))}catch(TK){z_(r,TK,e)}})):(e.value=t,e.state=1,V_(e,!1))}catch(TK){z_({done:!1},TK,e)}}};E_&&(C_=(R_=function(e){d_(this,C_),s_(e),n_(Zp,this);var t=T_(this);try{e(H_(X_,t),H_(z_,t))}catch(TK){z_(t,TK)}}).prototype,(Zp=function(e){I_(this,{type:b_,done:!1,notified:!1,parent:!1,reactions:new f_,rejection:!1,state:0,value:void 0})}).prototype=i_(C_,"then",(function(e,t){var r=T_(this),n=P_(l_(this,R_));return r.parent=!0,n.ok=!c_(e)||e,n.fail=c_(t)&&t,n.domain=t_?O_.domain:void 0,0==r.state?r.reactions.add(n):v_((function(){U_(n,r)})),n.promise})),$p=function(){var e=new Zp,t=T_(e);this.promise=e,this.resolve=H_(X_,t),this.reject=H_(z_,t)},S_.f=P_=function(e){return e===R_||undefined===e?new $p(e):M_(e)}),e_({global:!0,constructor:!0,wrap:!0,forced:E_},{Promise:R_}),o_(R_,b_,!1,!0),a_(b_);var K_=lt("iterator"),q_=!1;try{var Y_=0,W_={next:function(){return{done:!!Y_++}},return:function(){q_=!0}};W_[K_]=function(){return this},Array.from(W_,(function(){throw 2}))}catch(TK){}var Q_=function(e,t){if(!t&&!q_)return!1;var r=!1;try{var n={};n[K_]=function(){return{next:function(){return{done:r=!0}}}},e(n)}catch(TK){}return r},J_=Op,Z_=qp.CONSTRUCTOR||!Q_((function(e){J_.all(e).then(void 0,(function(){}))})),$_=O,ef=we,tf=Yp,rf=Cp,nf=Dh;Rr({target:"Promise",stat:!0,forced:Z_},{all:function(e){var t=this,r=tf.f(t),n=r.resolve,i=r.reject,o=rf((function(){var r=ef(t.resolve),o=[],a=0,s=1;nf(e,(function(e){var c=a++,u=!1;s++,$_(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 of=Rr,af=qp.CONSTRUCTOR;Op&&Op.prototype,of({target:"Promise",proto:!0,forced:af,real:!0},{catch:function(e){return this.then(void 0,e)}});var sf=O,cf=we,uf=Yp,df=Cp,lf=Dh;Rr({target:"Promise",stat:!0,forced:Z_},{race:function(e){var t=this,r=uf.f(t),n=r.reject,i=df((function(){var i=cf(t.resolve);lf(e,(function(e){sf(i,t,e).then(r.resolve,n)}))}));return i.error&&n(i.value),r.promise}});var hf=O,vf=Yp;Rr({target:"Promise",stat:!0,forced:qp.CONSTRUCTOR},{reject:function(e){var t=vf.f(this);return hf(t.reject,void 0,e),t.promise}});var pf=tr,_f=$,ff=Yp,mf=function(e,t){if(pf(e),_f(t)&&t.constructor===e)return t;var r=ff.f(e);return(0,r.resolve)(t),r.promise},gf=Rr,yf=Op,Sf=qp.CONSTRUCTOR,bf=mf,Ef=oe("Promise"),kf=!Sf;gf({target:"Promise",stat:!0,forced:true},{resolve:function(e){return bf(kf&&this===Ef?yf:this,e)}});var Tf=O,If=we,Af=Yp,Rf=Cp,Cf=Dh;Rr({target:"Promise",stat:!0},{allSettled:function(e){var t=this,r=Af.f(t),n=r.resolve,i=r.reject,o=Rf((function(){var r=If(t.resolve),i=[],o=0,a=1;Cf(e,(function(e){var s=o++,c=!1;a++,Tf(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 wf=O,xf=we,Of=oe,Pf=Yp,Mf=Cp,Nf=Dh,Df="No one promise resolved";Rr({target:"Promise",stat:!0},{any:function(e){var t=this,r=Of("AggregateError"),n=Pf.f(t),i=n.resolve,o=n.reject,a=Mf((function(){var n=xf(t.resolve),a=[],s=0,c=1,u=!1;Nf(e,(function(e){var d=s++,l=!1;c++,wf(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,Df)))}))})),--c||o(new r(a,Df))}));return a.error&&o(a.value),n.promise}});var Lf=Rr,Uf=Op,Vf=i,Ff=oe,Bf=A,jf=Tv,Gf=mf,Hf=Uf&&Uf.prototype;Lf({target:"Promise",proto:!0,real:!0,forced:!!Uf&&Vf((function(){Hf.finally.call({then:function(){}},(function(){}))}))},{finally:function(e){var t=jf(this,Ff("Promise")),r=Bf(e);return this.then(r?function(r){return Gf(t,e()).then((function(){return r}))}:e,r?function(r){return Gf(t,e()).then((function(){throw r}))}:e)}});var zf=ee.Promise,Xf=Yp,Kf=Cp;Rr({target:"Promise",stat:!0,forced:!0},{try:function(e){var t=Xf.f(this),r=Kf(e);return(r.error?t.reject:t.resolve)(r.value),t.promise}});var qf=zf,Yf=Rr,Wf=eo,Qf=E([].reverse),Jf=[1,2];Yf({target:"Array",proto:!0,forced:String(Jf)===String(Jf.reverse())},{reverse:function(){return Wf(this)&&(this.length=this.length),Qf(this)}});var Zf=Us("Array").reverse,$f=ae,em=Zf,tm=Array.prototype,rm=function(e){var t=e.reverse;return e===tm||$f(tm,e)&&t===tm.reverse?em:t},nm=Rr,im=eo,om=yo,am=$,sm=Dr,cm=Br,um=Q,dm=Jn,lm=lt,hm=rs,vm=Ns("slice"),pm=lm("species"),_m=Array,fm=Math.max;nm({target:"Array",proto:!0,forced:!vm},{slice:function(e,t){var r,n,i,o=um(this),a=cm(o),s=sm(e,a),c=sm(void 0===t?a:t,a);if(im(o)&&(r=o.constructor,(om(r)&&(r===_m||im(r.prototype))||am(r)&&null===(r=r[pm]))&&(r=void 0),r===_m||void 0===r))return hm(o,s,c);for(n=new(void 0===r?_m:r)(fm(c-s,0)),i=0;s<c;s++,i++)s in o&&dm(n,i,o[s]);return n.length=i,n}});var mm=Us("Array").slice,gm=ae,ym=mm,Sm=Array.prototype,bm=function(e){var t=e.slice;return e===Sm||gm(Sm,e)&&t===Sm.slice?ym: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 Cd?Cd:{},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=Vl(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 v(){}function p(){}var _={};c(_,o,(function(){return this}));var f=Gl&&Gl(Gl(I([])));f&&f!==t&&r.call(f,o)&&(_=f);var m=p.prototype=h.prototype=Vl(_);function g(e){var t;Du(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"==qd(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=b(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 b(e,t){var r=t.method,n=e.iterator[r];if(void 0===n)return t.delegate=null,"throw"===r&&e.iterator.return&&(t.method="return",t.arg=void 0,b(e,t),"throw"===t.method)||"return"!==r&&(t.method="throw",t.arg=new TypeError("The iterator does not provide a '"+r+"' method")),l;var i=d(n,e.iterator,t.arg);if("throw"===i.type)return t.method="throw",t.arg=i.arg,t.delegate=null,l;var o=i.arg;return o?o.done?(t[e.resultName]=o.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,l):o:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,l)}function E(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"}],Du(e).call(e,E,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 v.prototype=p,n(m,"constructor",{value:p,configurable:!0}),n(p,"constructor",{value:v,configurable:!0}),v.displayName=c(p,s,"GeneratorFunction"),e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===v||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Hl?Hl(e,p):(e.__proto__=p,c(e,s,"GeneratorFunction")),e.prototype=Vl(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=qf);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 rm(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,Du(t=this.tryEntries).call(t,k),!e)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+bm(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 km(e,t,r,n,i,o,a){try{var s=e[o](a),c=s.value}catch(TK){return void r(TK)}s.done?t(c):qf.resolve(c).then(n,i)}function Tm(e){return function(){var t=this,r=arguments;return new qf((function(n,i){var o=e.apply(t,r);function a(e){km(o,n,i,a,s,"next",e)}function s(e){km(o,n,i,a,s,"throw",e)}a(void 0)}))}}var Im=Us("Array").concat,Am=ae,Rm=Im,Cm=Array.prototype,wm=function(e){var t=e.concat;return e===Cm||Am(Cm,e)&&t===Cm.concat?Rm:t},xm=ee,Om=d;xm.JSON||(xm.JSON={stringify:JSON.stringify});var Pm=function(e,t,r){return Om(xm.JSON.stringify,null,arguments)},Mm=Pm,Nm=No.map;Rr({target:"Array",proto:!0,forced:!Ns("map")},{map:function(e){return Nm(this,e,arguments.length>1?arguments[1]:void 0)}});var Dm=Us("Array").map,Lm=ae,Um=Dm,Vm=Array.prototype,Fm=function(e){var t=e.map;return e===Vm||Lm(Vm,e)&&t===Vm.map?Um:t},Bm="\t\n\v\f\r                 \u2028\u2029\ufeff",jm=q,Gm=gn,Hm=E("".replace),zm="[\t\n\v\f\r                 \u2028\u2029\ufeff]",Xm=RegExp("^"+zm+zm+"*"),Km=RegExp(zm+zm+"*$"),qm=function(e){return function(t){var r=Gm(jm(t));return 1&e&&(r=Hm(r,Xm,"")),2&e&&(r=Hm(r,Km,"")),r}},Ym={start:qm(1),end:qm(2),trim:qm(3)},Wm=n,Qm=i,Jm=E,Zm=gn,$m=Ym.trim,eg=Bm,tg=Wm.parseInt,rg=Wm.Symbol,ng=rg&&rg.iterator,ig=/^[+-]?0x/i,og=Jm(ig.exec),ag=8!==tg(eg+"08")||22!==tg(eg+"0x16")||ng&&!Qm((function(){tg(Object(ng))}))?function(e,t){var r=$m(Zm(e));return tg(r,t>>>0||(og(ig,r)?16:10))}:tg;Rr({global:!0,forced:parseInt!=ag},{parseInt:ag});var sg=ee.parseInt,cg={exports:{}},ug=i((function(){if("function"==typeof ArrayBuffer){var e=new ArrayBuffer(8);Object.isExtensible(e)&&Object.defineProperty(e,"a",{value:8})}})),dg=i,lg=$,hg=y,vg=ug,pg=Object.isExtensible,_g=dg((function(){pg(1)}))||vg?function(e){return!!lg(e)&&((!vg||"ArrayBuffer"!=hg(e))&&(!pg||pg(e)))}:pg,fg=!i((function(){return Object.isExtensible(Object.preventExtensions({}))})),mg=Rr,gg=E,yg=Kr,Sg=$,bg=We,Eg=Qt.f,kg=zn,Tg=qn,Ig=_g,Ag=fg,Rg=!1,Cg=et("meta"),wg=0,xg=function(e){Eg(e,Cg,{value:{objectID:"O"+wg++,weakData:{}}})},Og=cg.exports={enable:function(){Og.enable=function(){},Rg=!0;var e=kg.f,t=gg([].splice),r={};r[Cg]=1,e(r).length&&(kg.f=function(r){for(var n=e(r),i=0,o=n.length;i<o;i++)if(n[i]===Cg){t(n,i,1);break}return n},mg({target:"Object",stat:!0,forced:!0},{getOwnPropertyNames:Tg.f}))},fastKey:function(e,t){if(!Sg(e))return"symbol"==typeof e?e:("string"==typeof e?"S":"P")+e;if(!bg(e,Cg)){if(!Ig(e))return"F";if(!t)return"E";xg(e)}return e[Cg].objectID},getWeakData:function(e,t){if(!bg(e,Cg)){if(!Ig(e))return!0;if(!t)return!1;xg(e)}return e[Cg].weakData},onFreeze:function(e){return Ag&&Rg&&Ig(e)&&!bg(e,Cg)&&xg(e),e}};yg[Cg]=!0;var Pg=Rr,Mg=n,Ng=cg.exports,Dg=i,Lg=_r,Ug=Dh,Vg=_v,Fg=A,Bg=$,jg=Di,Gg=Qt.f,Hg=No.forEach,zg=C,Xg=Zi.set,Kg=Zi.getterFor,qg=function(e,t,r){var n,i=-1!==e.indexOf("Map"),o=-1!==e.indexOf("Weak"),a=i?"set":"add",s=Mg[e],c=s&&s.prototype,u={};if(zg&&Fg(s)&&(o||c.forEach&&!Dg((function(){(new s).entries().next()})))){var d=(n=t((function(t,r){Xg(Vg(t,d),{type:e,collection:new s}),null!=r&&Ug(r,t[a],{that:t,AS_ENTRIES:i})}))).prototype,l=Kg(e);Hg(["add","clear","delete","forEach","get","has","set","keys","values","entries"],(function(e){var t="add"==e||"set"==e;!(e in c)||o&&"clear"==e||Lg(d,e,(function(r,n){var i=l(this).collection;if(!t&&o&&!Bg(r))return"get"==e&&void 0;var a=i[e](0===r?0:r,n);return t?this:a}))})),o||Gg(d,"size",{configurable:!0,get:function(){return l(this).collection.size}})}else n=r.getConstructor(t,e,i,a),Ng.enable();return jg(n,e,!1,!0),u[e]=n,Pg({global:!0,forced:!0},u),o||r.setStrong(n,e,i),n},Yg=li,Wg=function(e,t,r){for(var n in t)r&&r.unsafe&&e[n]?e[n]=t[n]:Yg(e,n,t[n],r);return e},Qg=Qt.f,Jg=Hn,Zg=Wg,$g=Wt,ey=_v,ty=z,ry=Dh,ny=iu,iy=ou,oy=hv,ay=C,sy=cg.exports.fastKey,cy=Zi.set,uy=Zi.getterFor,dy={getConstructor:function(e,t,r,n){var i=e((function(e,i){ey(e,o),cy(e,{type:t,index:Jg(null),first:void 0,last:void 0,size:0}),ay||(e.size=0),ty(i)||ry(i,e[n],{that:e,AS_ENTRIES:r})})),o=i.prototype,a=uy(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=sy(t,!0),key:t,value:r,previous:n=o.last,next:void 0,removed:!1},o.first||(o.first=s),n&&(n.next=s),ay?o.size++:e.size++,"F"!==i&&(o.index[i]=s)),e},c=function(e,t){var r,n=a(e),i=sy(t);if("F"!==i)return n.index[i];for(r=n.first;r;r=r.next)if(r.key==t)return r};return Zg(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,ay?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),ay?r.size--:t.size--}return!!n},forEach:function(e){for(var t,r=a(this),n=$g(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)}}),Zg(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)}}),ay&&Qg(o,"size",{get:function(){return a(this).size}}),i},setStrong:function(e,t,r){var n=t+" Iterator",i=uy(t),o=uy(n);ny(e,t,(function(e,t){cy(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)?iy("keys"==t?r.key:"values"==t?r.value:[r.key,r.value],!1):(e.target=void 0,iy(void 0,!0))}),r?"entries":"values",!r,!0),oy(t)}};qg("Map",(function(e){return function(){return e(this,arguments.length?arguments[0]:void 0)}}),dy);var ly=ee.Map,hy=Wt,vy=O,py=we,_y=yv,fy=z,my=Dh,gy=[].push,yy=function(e){var t,r,n,i,o=arguments.length,a=o>1?arguments[1]:void 0;return _y(this),(t=void 0!==a)&&py(a),fy(e)?new this:(r=[],t?(n=0,i=hy(a,o>2?arguments[2]:void 0),my(e,(function(e){vy(gy,r,i(e,n++))}))):my(e,gy,{that:r}),new this(r))};Rr({target:"Map",stat:!0,forced:!0},{from:yy});var Sy=rs,by=function(){return new this(Sy(arguments))};Rr({target:"Map",stat:!0,forced:!0},{of:by});var Ey=O,ky=we,Ty=tr,Iy=function(){for(var e,t=Ty(this),r=ky(t.delete),n=!0,i=0,o=arguments.length;i<o;i++)e=Ey(r,t,arguments[i]),n=n&&e;return!!n};Rr({target:"Map",proto:!0,real:!0,forced:!0},{deleteAll:Iy});var Ay=O,Ry=we,Cy=tr,wy=function(e,t){var r,n,i=Cy(this),o=Ry(i.get),a=Ry(i.has),s=Ry(i.set);return Ay(a,i,e)?(r=Ay(o,i,e),"update"in t&&(r=t.update(r,e,i),Ay(s,i,e,r)),r):(n=t.insert(e,i),Ay(s,i,e,n),n)};Rr({target:"Map",proto:!0,real:!0,forced:!0},{emplace:wy});var xy=mh,Oy=tr,Py=Wt,My=xy,Ny=Dh;Rr({target:"Map",proto:!0,real:!0,forced:!0},{every:function(e){var t=Oy(this),r=My(t),n=Py(e,arguments.length>1?arguments[1]:void 0);return!Ny(r,(function(e,r,i){if(!n(r,e,t))return i()}),{AS_ENTRIES:!0,IS_ITERATOR:!0,INTERRUPTED:!0}).stopped}});var Dy=oe,Ly=Wt,Uy=O,Vy=we,Fy=tr,By=Tv,jy=xy,Gy=Dh;Rr({target:"Map",proto:!0,real:!0,forced:!0},{filter:function(e){var t=Fy(this),r=jy(t),n=Ly(e,arguments.length>1?arguments[1]:void 0),i=new(By(t,Dy("Map"))),o=Vy(i.set);return Gy(r,(function(e,r){n(r,e,t)&&Uy(o,i,e,r)}),{AS_ENTRIES:!0,IS_ITERATOR:!0}),i}});var Hy=tr,zy=Wt,Xy=xy,Ky=Dh;Rr({target:"Map",proto:!0,real:!0,forced:!0},{find:function(e){var t=Hy(this),r=Xy(t),n=zy(e,arguments.length>1?arguments[1]:void 0);return Ky(r,(function(e,r,i){if(n(r,e,t))return i(r)}),{AS_ENTRIES:!0,IS_ITERATOR:!0,INTERRUPTED:!0}).result}});var qy=tr,Yy=Wt,Wy=xy,Qy=Dh;Rr({target:"Map",proto:!0,real:!0,forced:!0},{findKey:function(e){var t=qy(this),r=Wy(t),n=Yy(e,arguments.length>1?arguments[1]:void 0);return Qy(r,(function(e,r,i){if(n(r,e,t))return i(e)}),{AS_ENTRIES:!0,IS_ITERATOR:!0,INTERRUPTED:!0}).result}});var Jy=Rr,Zy=O,$y=we,eS=mh,tS=Dh,rS=E([].push);Jy({target:"Map",stat:!0,forced:!0},{groupBy:function(e,t){$y(t);var r=eS(e),n=new this,i=$y(n.has),o=$y(n.get),a=$y(n.set);return tS(r,(function(e){var r=t(e);Zy(i,n,r)?rS(Zy(o,n,r),e):Zy(a,n,r,[e])}),{IS_ITERATOR:!0}),n}});var nS=tr,iS=xy,oS=function(e,t){return e===t||e!=e&&t!=t},aS=Dh;Rr({target:"Map",proto:!0,real:!0,forced:!0},{includes:function(e){return aS(iS(nS(this)),(function(t,r,n){if(oS(r,e))return n()}),{AS_ENTRIES:!0,IS_ITERATOR:!0,INTERRUPTED:!0}).stopped}});var sS=O,cS=Dh,uS=we;Rr({target:"Map",stat:!0,forced:!0},{keyBy:function(e,t){var r=new this;uS(t);var n=uS(r.set);return cS(e,(function(e){sS(n,r,t(e),e)})),r}});var dS=tr,lS=xy,hS=Dh;Rr({target:"Map",proto:!0,real:!0,forced:!0},{keyOf:function(e){return hS(lS(dS(this)),(function(t,r,n){if(r===e)return n(t)}),{AS_ENTRIES:!0,IS_ITERATOR:!0,INTERRUPTED:!0}).result}});var vS=oe,pS=Wt,_S=O,fS=we,mS=tr,gS=Tv,yS=xy,SS=Dh;Rr({target:"Map",proto:!0,real:!0,forced:!0},{mapKeys:function(e){var t=mS(this),r=yS(t),n=pS(e,arguments.length>1?arguments[1]:void 0),i=new(gS(t,vS("Map"))),o=fS(i.set);return SS(r,(function(e,r){_S(o,i,n(r,e,t),r)}),{AS_ENTRIES:!0,IS_ITERATOR:!0}),i}});var bS=oe,ES=Wt,kS=O,TS=we,IS=tr,AS=Tv,RS=xy,CS=Dh;Rr({target:"Map",proto:!0,real:!0,forced:!0},{mapValues:function(e){var t=IS(this),r=RS(t),n=ES(e,arguments.length>1?arguments[1]:void 0),i=new(AS(t,bS("Map"))),o=TS(i.set);return CS(r,(function(e,r){kS(o,i,e,n(r,e,t))}),{AS_ENTRIES:!0,IS_ITERATOR:!0}),i}});var wS=we,xS=tr,OS=Dh;Rr({target:"Map",proto:!0,real:!0,arity:1,forced:!0},{merge:function(e){for(var t=xS(this),r=wS(t.set),n=arguments.length,i=0;i<n;)OS(arguments[i++],r,{that:t,AS_ENTRIES:!0});return t}});var PS=tr,MS=we,NS=xy,DS=Dh,LS=TypeError;Rr({target:"Map",proto:!0,real:!0,forced:!0},{reduce:function(e){var t=PS(this),r=NS(t),n=arguments.length<2,i=n?void 0:arguments[1];if(MS(e),DS(r,(function(r,o){n?(n=!1,i=o):i=e(i,o,r,t)}),{AS_ENTRIES:!0,IS_ITERATOR:!0}),n)throw LS("Reduce of empty map with no initial value");return i}});var US=tr,VS=Wt,FS=xy,BS=Dh;Rr({target:"Map",proto:!0,real:!0,forced:!0},{some:function(e){var t=US(this),r=FS(t),n=VS(e,arguments.length>1?arguments[1]:void 0);return BS(r,(function(e,r,i){if(n(r,e,t))return i()}),{AS_ENTRIES:!0,IS_ITERATOR:!0,INTERRUPTED:!0}).stopped}});var jS=O,GS=tr,HS=we,zS=TypeError;Rr({target:"Map",proto:!0,real:!0,forced:!0},{update:function(e,t){var r=GS(this),n=HS(r.get),i=HS(r.has),o=HS(r.set),a=arguments.length;HS(t);var s=jS(i,r,e);if(!s&&a<3)throw zS("Updating absent value");var c=s?jS(n,r,e):HS(a>2?arguments[2]:void 0)(e,r);return jS(o,r,e,t(c,e,r)),r}});var XS=O,KS=we,qS=A,YS=tr,WS=TypeError,QS=function(e,t){var r,n=YS(this),i=KS(n.get),o=KS(n.has),a=KS(n.set),s=arguments.length>2?arguments[2]:void 0;if(!qS(t)&&!qS(s))throw WS("At least one callback required");return XS(o,n,e)?(r=XS(i,n,e),qS(t)&&(r=t(r),XS(a,n,e,r))):qS(s)&&(r=s(),XS(a,n,e,r)),r};Rr({target:"Map",proto:!0,real:!0,forced:!0},{upsert:QS}),Rr({target:"Map",proto:!0,real:!0,name:"upsert",forced:!0},{updateOrInsert:QS});var JS=ly,ZS=we,$S=Ke,eb=H,tb=Br,rb=TypeError,nb=function(e){return function(t,r,n,i){ZS(r);var o=$S(t),a=eb(o),s=tb(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 rb("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}},ib={left:nb(!1),right:nb(!0)}.left,ob=pe,ab=sv;Rr({target:"Array",proto:!0,forced:!Iu("reduce")||!ab&&ob>79&&ob<83},{reduce:function(e){var t=arguments.length;return ib(this,e,t,t>1?arguments[1]:void 0)}});var sb=Us("Array").reduce,cb=ae,ub=sb,db=Array.prototype,lb=function(e){var t=e.reduce;return e===db||cb(db,e)&&t===db.reduce?ub:t},hb=C,vb=E,pb=O,_b=i,fb=rn,mb=ui,gb=P,yb=Ke,Sb=H,bb=Object.assign,Eb=Object.defineProperty,kb=vb([].concat),Tb=!bb||_b((function(){if(hb&&1!==bb({b:1},bb(Eb({},"a",{enumerable:!0,get:function(){Eb(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!=bb({},e)[r]||fb(bb({},t)).join("")!=n}))?function(e,t){for(var r=yb(e),n=arguments.length,i=1,o=mb.f,a=gb.f;n>i;)for(var s,c=Sb(arguments[i++]),u=o?kb(fb(c),o(c)):fb(c),d=u.length,l=0;d>l;)s=u[l++],hb&&!pb(a,c,s)||(r[s]=c[s]);return r}:bb,Ib=Tb;Rr({target:"Object",stat:!0,arity:2,forced:Object.assign!==Ib},{assign:Ib});var Ab=ee.Object.assign,Rb=$,Cb=y,wb=lt("match"),xb=function(e){var t;return Rb(e)&&(void 0!==(t=e[wb])?!!t:"RegExp"==Cb(e))},Ob=TypeError,Pb=function(e){if(xb(e))throw Ob("The method doesn't accept regular expressions");return e},Mb=lt("match"),Nb=function(e){var t=/./;try{"/./"[e](t)}catch(r){try{return t[Mb]=!1,"/./"[e](t)}catch(n){}}return!1},Db=Rr,Lb=E;R.f;var Ub=Vr,Vb=gn,Fb=Pb,Bb=q,jb=Nb,Gb=Lb("".endsWith),Hb=Lb("".slice),zb=Math.min;Db({target:"String",proto:!0,forced:!jb("endsWith")},{endsWith:function(e){var t=Vb(Bb(this));Fb(e);var r=arguments.length>1?arguments[1]:void 0,n=t.length,i=void 0===r?n:zb(Ub(r),n),o=Vb(e);return Gb?Gb(t,o,i):Hb(t,i-o.length,i)===o}});var Xb=Us("String").endsWith,Kb=ae,qb=Xb,Yb=String.prototype,Wb=function(e){var t=e.endsWith;return"string"==typeof e||e===Yb||Kb(Yb,e)&&t===Yb.endsWith?qb:t},Qb=!0,Jb=!0;function Zb(e,t,r){var n=e.match(t);return n&&n.length>=r&&sg(n[r],10)}function $b(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 JS),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 eE(e){return"boolean"!=typeof e?new Error("Argument type: "+qd(e)+". Please use a boolean."):(Qb=e,e?"adapter.js logging disabled":"adapter.js logging enabled")}function tE(e){return"boolean"!=typeof e?new Error("Argument type: "+qd(e)+". Please use a boolean."):(Jb=!e,"adapter.js deprecation warnings "+(e?"disabled":"enabled"))}function rE(){if("object"===("undefined"==typeof window?"undefined":qd(window))){if(Qb)return;"undefined"!=typeof console&&"function"==typeof console.log&&console.log.apply(console,arguments)}}function nE(e,t){Jb&&console.warn(e+" is deprecated, please use "+t+" instead.")}function iE(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=Zb(r.userAgent,/Firefox\/(\d+)\./,1);else if(r.webkitGetUserMedia||!1===e.isSecureContext&&e.webkitRTCPeerConnection)t.browser="chrome",t.version=Zb(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=Zb(r.userAgent,/AppleWebKit\/(\d+)\./,1),t.supportsUnifiedPlan=e.RTCRtpTransceiver&&"currentDirection"in e.RTCRtpTransceiver.prototype}return t}function oE(e){return"[object Object]"===Object.prototype.toString.call(e)}function aE(e){var t;return oE(e)?lb(t=an(e)).call(t,(function(t,r){var n=oE(e[r]),i=n?aE(e[r]):e[r],o=n&&!an(i).length;return void 0===i||o?t:Ab(t,Qd({},r,i))}),{}):e}function sE(e,t,r){t&&!r.has(t.id)&&(r.set(t.id,t),an(t).forEach((function(n){Wb(n).call(n,"Id")?sE(e,e.get(t[n]),r):Wb(n).call(n,"Ids")&&t[n].forEach((function(t){sE(e,e.get(t),r)}))})))}function cE(e,t,r){var n=r?"outbound-rtp":"inbound-rtp",i=new JS;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&&sE(e,r,i)}))})),i}var uE=Rr,dE=No.find,lE="find",hE=!0;lE in[]&&Array(1).find((function(){hE=!1})),uE({target:"Array",proto:!0,forced:hE},{find:function(e){return dE(this,e,arguments.length>1?arguments[1]:void 0)}});var vE=Us("Array").find,pE=ae,_E=vE,fE=Array.prototype,mE=function(e){var t=e.find;return e===fE||pE(fE,e)&&t===fE.find?_E:t},gE=Rr,yE=Xr.indexOf,SE=Iu,bE=E([].indexOf),EE=!!bE&&1/bE([1],1,-0)<0,kE=SE("indexOf");gE({target:"Array",proto:!0,forced:EE||!kE},{indexOf:function(e){var t=arguments.length>1?arguments[1]:void 0;return EE?bE(this,e,t)||0:yE(this,e,t)}});var TE=Us("Array").indexOf,IE=ae,AE=TE,RE=Array.prototype,CE=function(e){var t=e.indexOf;return e===RE||IE(RE,e)&&t===RE.indexOf?AE:t},wE=C,xE=eo,OE=TypeError,PE=Object.getOwnPropertyDescriptor,ME=wE&&!function(){if(void 0!==this)return!0;try{Object.defineProperty([],"length",{writable:!1}).length=1}catch(TK){return TK instanceof TypeError}}(),NE=Ie,DE=TypeError,LE=function(e,t){if(!delete e[t])throw DE("Cannot delete property "+NE(t)+" of "+NE(e))},UE=Rr,VE=Ke,FE=Dr,BE=Or,jE=Br,GE=ME?function(e,t){if(xE(e)&&!PE(e,"length").writable)throw OE("Cannot set read only .length");return e.length=t}:function(e,t){return e.length=t},HE=cd,zE=Ao,XE=Jn,KE=LE,qE=Ns("splice"),YE=Math.max,WE=Math.min;UE({target:"Array",proto:!0,forced:!qE},{splice:function(e,t){var r,n,i,o,a,s,c=VE(this),u=jE(c),d=FE(e,u),l=arguments.length;for(0===l?r=n=0:1===l?(r=0,n=u-d):(r=l-2,n=WE(YE(BE(t),0),u-d)),HE(u+r-n),i=zE(c,n),o=0;o<n;o++)(a=d+o)in c&&XE(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]:KE(c,s);for(o=u;o>u-n+r;o--)KE(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]:KE(c,s);for(o=0;o<r;o++)c[o+d]=arguments[o+2];return GE(c,u-n+r),i}});var QE=Us("Array").splice,JE=ae,ZE=QE,$E=Array.prototype,ek=function(e){var t=e.splice;return e===$E||JE($E,e)&&t===$E.splice?ZE:t},tk=Xr.includes;Rr({target:"Array",proto:!0,forced:i((function(){return!Array(1).includes()}))},{includes:function(e){return tk(this,e,arguments.length>1?arguments[1]:void 0)}});var rk=Us("Array").includes,nk=Rr,ik=Pb,ok=q,ak=gn,sk=Nb,ck=E("".indexOf);nk({target:"String",proto:!0,forced:!sk("includes")},{includes:function(e){return!!~ck(ak(ok(this)),ak(ik(e)),arguments.length>1?arguments[1]:void 0)}});var uk=Us("String").includes,dk=ae,lk=rk,hk=uk,vk=Array.prototype,pk=String.prototype,_k=function(e){var t=e.includes;return e===vk||dk(vk,e)&&t===vk.includes?lk:"string"==typeof e||e===pk||dk(pk,e)&&t===pk.includes?hk:t},fk=rE;function mk(e,t){var r=e&&e.navigator;if(r.mediaDevices){var n=function(e){if("object"!==qd(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"===qd(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()+bm(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(Mm(e)))&&"object"===qd(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(Mm(e))).audio,"autoGainControl","googAutoGainControl"),o(e.audio,"noiseSuppression","googNoiseSuppression"),e.audio=n(e.audio)}if(e&&"object"===qd(e.video)){var a=e.video.facingMode;a=a&&("object"===qd(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=mE(t).call(t,(function(e){return s.some((function(t){var r;return _k(r=e.label.toLowerCase()).call(r,t)}))}));return!r&&t.length&&_k(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),fk("chrome: "+Mm(e)),i(e)}));e.video=n(e.video)}return fk("chrome: "+Mm(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 qf.reject(o(e))}))}))}}}}function gk(e){e.MediaStream=e.MediaStream||e.webkitMediaStream}function yk(e){if("object"===qd(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=mE(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=mE(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 $b(e,"track",(function(e){return e.transceiver||ad(e,"transceiver",{value:{receiver:e.receiver}}),e}))}function Sk(e){if("object"===qd(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||[],bm(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=CE(t=this._senders).call(t,e);-1!==i&&ek(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=mE(r=t._senders).call(r,(function(t){return t.track===e}));o&&ek(n=t._senders).call(n,CE(i=t._senders).call(i,o),1)}))}}else if("object"===qd(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 bk(e){if(e.RTCPeerConnection){var t=e.RTCPeerConnection.prototype.getStats;e.RTCPeerConnection.prototype.getStats=function(){var e=this,r=bm(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 JS(Fm(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 qf((function(r,n){t.apply(e,[function(e){r(s(a(e)))},n])})).then(i,o)}}}function Ek(e){if("object"===qd(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 cE(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}),$b(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 cE(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?qf.reject(new DOMException("There are more than one sender or receiver for the track.","InvalidAccessError")):t?t.getStats():r?r.getStats():qf.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||{},Fm(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===CE(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(mE(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===CE(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=CE(n=t._shimmedLocalStreams[r]).call(n,e);-1!==o&&ek(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||{},Fm(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(mE(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=bm([]).call(arguments,1);if(1!==s.length||!mE(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=mE(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),qf.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 mE(o=this.getSenders()).call(o,(function(e){return e.track===t}))},["createOffer","createAnswer"].forEach((function(t){var r=e.RTCPeerConnection.prototype[t],n=Qd({},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;mE(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=Qd({},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){$b(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:bk,shimSenderReceiverGetStats:Ek,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 Ck=ee.Array.isArray;function wk(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 xk=dh,Ok=tr,Pk=bh,Mk=Wt,Nk=O,Dk=Ke,Lk=function(e,t,r,n){try{return n?t(Ok(r)[0],r[1]):t(r)}catch(TK){Pk(e,"throw",TK)}},Uk=ih,Vk=yo,Fk=Br,Bk=Jn,jk=mh,Gk=dh,Hk=Array,zk=function(e){var t=Dk(e),r=Vk(this),n=arguments.length,i=n>1?arguments[1]:void 0,o=void 0!==i;o&&(i=Mk(i,n>2?arguments[2]:void 0));var a,s,c,u,d,l,h=Gk(t),v=0;if(!h||this===Hk&&Uk(h))for(a=Fk(t),s=r?new this(a):Hk(a);a>v;v++)l=o?i(t[v],v):t[v],Bk(s,v,l);else for(d=(u=jk(t,h)).next,s=r?new this:[];!(c=Nk(d,u)).done;v++)l=o?Lk(u,i,[c.value,v],!0):c.value,Bk(s,v,l);return s.length=v,s},Xk=zk;Rr({target:"Array",stat:!0,forced:!Q_((function(e){Array.from(e)}))},{from:Xk});var Kk=ee.Array.from;function qk(e,t){var r;if(e){if("string"==typeof e)return wk(e,t);var n=bm(r=Object.prototype.toString.call(e)).call(r,8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Kk(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?wk(e,t):void 0}}function Yk(e){return function(e){if(Ck(e))return wk(e)}(e)||function(e){if(void 0!==Cd&&null!=xk(e)||null!=e["@@iterator"])return Kk(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 Wk=n,Qk=i,Jk=gn,Zk=Ym.trim,$k=E("".charAt),eT=Wk.parseFloat,tT=Wk.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){nE("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"===qd(e)&&"object"===qd(e.audio)&&(e=JSON.parse(Mm(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"===qd(e)&&(e=JSON.parse(Mm(e)),i(e,"autoGainControl","mozAutoGainControl"),i(e,"noiseSuppression","mozNoiseSuppression")),s.apply(this,[e])}}}}function aT(e){"object"===qd(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"===qd(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=Qd({},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=bm(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,Ab({},t,{type:r[t.type]||t.type}))}))}return e})).then(o,a)}}}function cT(e){if("object"===qd(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):qf.resolve(new JS)}}}function uT(e){if("object"===qd(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}),$b(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;nE("removeStream","removeTrack"),this.getSenders().forEach((function(r){var n;r.track&&_k(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"===qd(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=Yk(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 vT(e){if("object"===qd(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"===qd(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?qf.all(this.setParametersPromises).then((function(){return t.apply(r,e)})).finally((function(){r.setParametersPromises=[]})):t.apply(this,arguments)}}}function _T(e){if("object"===qd(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?qf.all(this.setParametersPromises).then((function(){return t.apply(r,e)})).finally((function(){r.setParametersPromises=[]})):t.apply(this,arguments)}}}var fT=Object.freeze(Object.defineProperty({__proto__:null,shimOnTrack:aT,shimPeerConnection:sT,shimSenderGetStats:cT,shimReceiverGetStats:uT,shimRemoveStream:dT,shimRTCDataChannel:lT,shimAddTransceiver:hT,shimGetParameters:vT,shimCreateOffer:pT,shimCreateAnswer:_T,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,qf.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"===qd(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=[]),_k(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?_k(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=CE(t=this._localStreams).call(t,e);if(-1!==i){ek(r=this._localStreams).call(r,i,1);var o=e.getTracks();this.getSenders().forEach((function(e){_k(o).call(o,e.track)&&n.removeTrack(e)}))}})}}function gT(e){if("object"===qd(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=[]),!_k(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=[]),!(CE(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"===qd(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),qf.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),qf.resolve()):i};var s=function(e,t,r){var n=i.apply(this,[e]);return r?(n.then(t,r),qf.resolve()):n};t.setLocalDescription=s,s=function(e,t,r){var n=o.apply(this,[e]);return r?(n.then(t,r),qf.resolve()):n},t.setRemoteDescription=s,s=function(e,t,r){var n=a.apply(this,[e]);return r?(n.then(t,r),qf.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(bT(e))}}!t.getUserMedia&&t.mediaDevices&&t.mediaDevices.getUserMedia&&(t.getUserMedia=function(e,r,n){t.mediaDevices.getUserMedia(e).then(r,n)}.bind(t))}function bT(e){return e&&void 0!==e.video?Ab({},e,{video:aE(e.video)}):e}function ET(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")?(nE("RTCIceServer.url","RTCIceServer.urls"),(o=JSON.parse(Mm(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"===qd(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=mE(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=mE(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"!==qd(e)||e.AudioContext||(e.AudioContext=e.webkitAudioContext)}var AT=Object.freeze(Object.defineProperty({__proto__:null,shimLocalStreamsAPI:mT,shimRemoteStreamsAPI:gT,shimCallbacksAPI:yT,shimGetUserMedia:ST,shimConstraints:bT,shimRTCIceServerUrls:ET,shimTrackEventTransceiver:kT,shimCreateOfferLegacy:TT,shimAudioContext:IT},Symbol.toStringTag,{value:"Module"})),RT=cc.PROPER,CT=i,wT=Bm,xT=Ym.trim;Rr({target:"String",proto:!0,forced:function(e){return CT((function(){return!!wT[e]()||"​…᠎"!=="​…᠎"[e]()||RT&&wT[e].name!==e}))}("trim")},{trim:function(){return xT(this)}});var OT,PT,MT=Us("String").trim,NT=ae,DT=MT,LT=String.prototype,UT=function(e){var t=e.trim;return"string"==typeof e||e===LT||NT(LT,e)&&t===LT.trim?DT:t},VT={exports:{}};OT=VT,(PT={generateIdentifier:function(){return Math.random().toString(36).substr(2,10)}}).localCName=PT.generateIdentifier(),PT.splitLines=function(e){var t;return Fm(t=UT(e).call(e).split("\n")).call(t,(function(e){return UT(e).call(e)}))},PT.splitSections=function(e){var t=e.split("\nm=");return Fm(t).call(t,(function(e,t){var r;return UT(r=t>0?"m="+e:e).call(r)+"\r\n"}))},PT.getDescription=function(e){var t=PT.splitSections(e);return t&&t[0]},PT.getMediaSections=function(e){var t=PT.splitSections(e);return t.shift(),t},PT.matchPrefix=function(e,t){var r;return Gs(r=PT.splitLines(e)).call(r,(function(e){return 0===CE(e).call(e,t)}))},PT.parseCandidate=function(e){for(var t,r={foundation:(t=0===CE(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:sg(t[3],10),ip:t[4],address:t[4],port:sg(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=sg(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},PT.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(" ")},PT.parseIceOptions=function(e){return e.substr(14).split(" ")},PT.parseRtpMap=function(e){var t=e.substr(9).split(" "),r={payloadType:sg(t.shift(),10)};return t=t[0].split("/"),r.name=t[0],r.clockRate=sg(t[1],10),r.channels=3===t.length?sg(t[2],10):1,r.numChannels=r.channels,r},PT.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"},PT.parseExtmap=function(e){var t,r=e.substr(9).split(" ");return{id:sg(r[0],10),direction:CE(t=r[0]).call(t,"/")>0?r[0].split("/")[1]:"sendrecv",uri:r[1]}},PT.writeExtmap=function(e){return"a=extmap:"+(e.id||e.preferredId)+(e.direction&&"sendrecv"!==e.direction?"/"+e.direction:"")+" "+e.uri+"\r\n"},PT.parseFmtp=function(e){for(var t,r={},n=e.substr(CE(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},PT.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},PT.parseRtcpFb=function(e){var t=e.substr(CE(e).call(e," ")+1).split(" ");return{type:t.shift(),parameter:t.join(" ")}},PT.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},PT.parseSsrcMedia=function(e){var t=CE(e).call(e," "),r={ssrc:sg(e.substr(7,t-7),10)},n=CE(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},PT.parseSsrcGroup=function(e){var t=e.substr(13).split(" ");return{semantics:t.shift(),ssrcs:Fm(t).call(t,(function(e){return sg(e,10)}))}},PT.getMid=function(e){var t=PT.matchPrefix(e,"a=mid:")[0];if(t)return t.substr(6)},PT.parseFingerprint=function(e){var t=e.substr(14).split(" ");return{algorithm:t[0].toLowerCase(),value:t[1].toUpperCase()}},PT.getDtlsParameters=function(e,t){var r=PT.matchPrefix(e+t,"a=fingerprint:");return{role:"auto",fingerprints:Fm(r).call(r,PT.parseFingerprint)}},PT.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},PT.parseCryptoLine=function(e){var t=e.substr(9).split(" ");return{tag:sg(t[0],10),cryptoSuite:t[1],keyParams:t[2],sessionParams:bm(t).call(t,3)}},PT.writeCryptoLine=function(e){return"a=crypto:"+e.tag+" "+e.cryptoSuite+" "+("object"===qd(e.keyParams)?PT.writeCryptoKeyParams(e.keyParams):e.keyParams)+(e.sessionParams?" "+e.sessionParams.join(" "):"")+"\r\n"},PT.parseCryptoKeyParams=function(e){if(0!==CE(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}},PT.writeCryptoKeyParams=function(e){return e.keyMethod+":"+e.keySalt+(e.lifeTime?"|"+e.lifeTime:"")+(e.mkiValue&&e.mkiLength?"|"+e.mkiValue+":"+e.mkiLength:"")},PT.getCryptoParameters=function(e,t){var r=PT.matchPrefix(e+t,"a=crypto:");return Fm(r).call(r,PT.parseCryptoLine)},PT.getIceParameters=function(e,t){var r=PT.matchPrefix(e+t,"a=ice-ufrag:")[0],n=PT.matchPrefix(e+t,"a=ice-pwd:")[0];return r&&n?{usernameFragment:r.substr(12),password:n.substr(10)}:null},PT.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},PT.parseRtpParameters=function(e){for(var t={codecs:[],headerExtensions:[],fecMechanisms:[],rtcp:[]},r=PT.splitLines(e)[0].split(" "),n=3;n<r.length;n++){var i=r[n],o=PT.matchPrefix(e,"a=rtpmap:"+i+" ")[0];if(o){var a,s=PT.parseRtpMap(o),c=PT.matchPrefix(e,"a=fmtp:"+i+" ");switch(s.parameters=c.length?PT.parseFmtp(c[0]):{},s.rtcpFeedback=Fm(a=PT.matchPrefix(e,"a=rtcp-fb:"+i+" ")).call(a,PT.parseRtcpFb),t.codecs.push(s),s.name.toUpperCase()){case"RED":case"ULPFEC":t.fecMechanisms.push(s.name.toUpperCase())}}}return PT.matchPrefix(e,"a=extmap:").forEach((function(e){t.headerExtensions.push(PT.parseExtmap(e))})),t},PT.writeRtpDescription=function(e,t){var r,n="";n+="m="+e+" ",n+=t.codecs.length>0?"9":"0",n+=" UDP/TLS/RTP/SAVPF ",n+=Fm(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+=PT.writeRtpMap(e),n+=PT.writeFmtp(e),n+=PT.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+=PT.writeExtmap(e)})),n},PT.parseRtpEncodingParameters=function(e){var t,r,n,i,o,a,s=[],c=PT.parseRtpParameters(e),u=-1!==CE(t=c.fecMechanisms).call(t,"RED"),d=-1!==CE(r=c.fecMechanisms).call(r,"ULPFEC"),l=Gs(n=Fm(i=PT.matchPrefix(e,"a=ssrc:")).call(i,(function(e){return PT.parseSsrcMedia(e)}))).call(n,(function(e){return"cname"===e.attribute})),h=l.length>0&&l[0].ssrc,v=Fm(o=PT.matchPrefix(e,"a=ssrc-group:FID")).call(o,(function(e){var t=e.substr(17).split(" ");return Fm(t).call(t,(function(e){return sg(e,10)}))}));v.length>0&&v[0].length>1&&v[0][0]===h&&(a=v[0][1]),c.codecs.forEach((function(e){if("RTX"===e.name.toUpperCase()&&e.parameters.apt){var t={ssrc:h,codecPayloadType:sg(e.parameters.apt,10)};h&&a&&(t.rtx={ssrc:a}),s.push(t),u&&((t=JSON.parse(Mm(t))).fec={ssrc:h,mechanism:d?"red+ulpfec":"red"},s.push(t))}})),0===s.length&&h&&s.push({ssrc:h});var p,_,f=PT.matchPrefix(e,"b=");return f.length&&(f=0===CE(p=f[0]).call(p,"b=TIAS:")?sg(f[0].substr(7),10):0===CE(_=f[0]).call(_,"b=AS:")?1e3*sg(f[0].substr(5),10)*.95-16e3:void 0,s.forEach((function(e){e.maxBitrate=f}))),s},PT.parseRtcpParameters=function(e){var t,r,n={},i=Gs(t=Fm(r=PT.matchPrefix(e,"a=ssrc:")).call(r,(function(e){return PT.parseSsrcMedia(e)}))).call(t,(function(e){return"cname"===e.attribute}))[0];i&&(n.cname=i.value,n.ssrc=i.ssrc);var o=PT.matchPrefix(e,"a=rtcp-rsize");n.reducedSize=o.length>0,n.compound=0===o.length;var a=PT.matchPrefix(e,"a=rtcp-mux");return n.mux=a.length>0,n},PT.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},PT.parseMsid=function(e){var t,r,n,i=PT.matchPrefix(e,"a=msid:");if(1===i.length)return{stream:(n=i[0].substr(7).split(" "))[0],track:n[1]};var o=Gs(t=Fm(r=PT.matchPrefix(e,"a=ssrc:")).call(r,(function(e){return PT.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},PT.parseSctpDescription=function(e){var t,r=PT.parseMLine(e),n=PT.matchPrefix(e,"a=max-message-size:");n.length>0&&(t=sg(n[0].substr(19),10)),isNaN(t)&&(t=65536);var i=PT.matchPrefix(e,"a=sctp-port:");if(i.length>0)return{port:sg(i[0].substr(12),10),protocol:r.fmt,maxMessageSize:t};var o=PT.matchPrefix(e,"a=sctpmap:");if(o.length>0){var a=o[0].substr(10).split(" ");return{port:sg(a[0],10),protocol:a[1],maxMessageSize:t}}},PT.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("")},PT.generateSessionId=function(){return Math.random().toString().substr(2,21)},PT.writeSessionBoilerplate=function(e,t,r){var n=void 0!==t?t:2;return"v=0\r\no="+(r||"thisisadapterortc")+" "+(e||PT.generateSessionId())+" "+n+" IN IP4 127.0.0.1\r\ns=-\r\nt=0 0\r\n"},PT.getDirection=function(e,t){for(var r=PT.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?PT.getDirection(t):"sendrecv"},PT.getKind=function(e){return PT.splitLines(e)[0].split(" ")[0].substr(2)},PT.isRejected=function(e){return"0"===e.split(" ",2)[1]},PT.parseMLine=function(e){var t=PT.splitLines(e)[0].substr(2).split(" ");return{kind:t[0],port:sg(t[1],10),protocol:t[2],fmt:bm(t).call(t,3).join(" ")}},PT.parseOLine=function(e){var t=PT.matchPrefix(e,"o=")[0].substr(2).split(" ");return{username:t[0],sessionId:t[1],sessionVersion:sg(t[2],10),netType:t[3],addressType:t[4],address:t[5]}},PT.isValidSDP=function(e){if("string"!=typeof e||0===e.length)return!1;for(var t=PT.splitLines(e),r=0;r<t.length;r++)if(t[r].length<2||"="!==t[r].charAt(1))return!1;return!0},OT.exports=PT;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"===qd(e)&&e.candidate&&0===CE(r=e.candidate).call(r,"a=")&&((e=JSON.parse(Mm(e))).candidate=e.candidate.substr(2)),e.candidate&&e.candidate.length){var n=new t(e),i=FT.parseCandidate(e.candidate),o=Ab(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,$b(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||$b(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!==CE(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=sg(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=sg(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},$b(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 XT(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 KT(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!==CE(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?qf.resolve():r.apply(this,arguments):(arguments[1]&&arguments[1].apply(null),qf.resolve())})}}function YT(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"!==qd(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 WT=Object.freeze(Object.defineProperty({__proto__:null,shimRTCIceCandidate:jT,shimRTCIceCandidateRelayProtocol:GT,shimMaxMessageSize:HT,shimSendThrowTypeError:zT,shimConnectionState:XT,removeExtmapAllowMixed:KT,shimAddIceCandidateNullOrEmpty:qT,shimParameterlessSetLocalDescription:YT},Symbol.toStringTag,{value:"Module"}));if(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=rE,i=iE(t),o={browserDetails:i,commonShim:WT,extractVersion:Zb,disableLog:eE,disableWarnings:tE,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),YT(t),mk(t,i),gk(t),Ik(t,i),yk(t),Tk(t,i),Sk(t),bk(t),Ek(t),Ak(t,i),jT(t),GT(t),XT(t),HT(t,i),zT(t),KT(t,i);break;case"firefox":if(!fT||!sT||!r.shimFirefox)return n("Firefox shim is not included in this adapter release."),o;n("adapter.js shimming firefox."),o.browserShim=fT,qT(t,i),YT(t),oT(t,i),sT(t,i),aT(t),dT(t),cT(t),uT(t),lT(t),hT(t),vT(t),pT(t),_T(t),jT(t),XT(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),YT(t),ET(t),TT(t),yT(t),mT(t),gT(t),kT(t),ST(t),IT(t),jT(t),GT(t),HT(t,i),zT(t),KT(t,i);break;default:n("Unsupported browser!")}}({window:"undefined"==typeof window?void 0:window}),"undefined"!=typeof MediaStreamTrack){var QT=MediaStreamTrack.prototype.getSettings;MediaStreamTrack.prototype.getSettings=function(){var e=QT.call(this);return e.width&&(e.width=Math.floor(e.width)),e.height&&(e.height=Math.floor(e.height)),e.frameRate&&(e.frameRate=Math.floor(e.frameRate)),e}}function JT(e,t){var r=void 0!==Cd&&xk(e)||e["@@iterator"];if(!r){if(Ck(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 ZT(e,t){return function(e){if(Ck(e))return e}(e)||function(e,t){var r=null==e?null:void 0!==Cd&&xk(e)||e["@@iterator"];if(null!=r){var n,i,o,a,s=[],c=!0,u=!1;try{if(o=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;c=!1}else for(;!(c=(n=o.call(r)).done)&&(s.push(n.value),s.length!==t);c=!0);}catch(d){u=!0,i=d}finally{try{if(!c&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(u)throw i}}return s}}(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 $T(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}var eI=We,tI=function(e){return void 0!==e&&(eI(e,"value")||eI(e,"writable"))},rI=O,nI=$,iI=tr,oI=tI,aI=R,sI=mc;Rr({target:"Reflect",stat:!0},{get:function e(t,r){var n,i,o=arguments.length<3?t:arguments[2];return iI(t)===o?t[r]:(n=aI.f(t,r))?oI(n)?n.value:void 0===n.get?void 0:rI(n.get,o):nI(i=sI(t))?e(i,r,o):void 0}});var cI=ee.Reflect.get,uI=E,dI=we,lI=$,hI=We,vI=rs,pI=o,_I=Function,fI=uI([].concat),mI=uI([].join),gI={},yI=function(e,t,r){if(!hI(gI,t)){for(var n=[],i=0;i<t;i++)n[i]="a["+i+"]";gI[t]=_I("C,a","return new C("+mI(n,",")+")")}return gI[t](e,r)},SI=pI?_I.bind:function(e){var t=dI(this),r=t.prototype,n=vI(arguments,1),i=function(){var r=fI(n,vI(arguments));return this instanceof i?yI(t,r.length,r):t.apply(e,r)};return lI(r)&&(i.prototype=r),i},bI=SI;Rr({target:"Function",proto:!0,forced:Function.bind!==bI},{bind:bI});var EI=Us("Function").bind,kI=ae,TI=EI,II=Function.prototype,AI=function(e){var t=e.bind;return e===II||kI(II,e)&&t===II.bind?TI:t};function RI(e){var t;return(RI=Hl?AI(t=Gl).call(t):function(e){return e.__proto__||Gl(e)})(e)}function CI(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=RI(e)););return e}function wI(){var e;"undefined"!=typeof Reflect&&cI?wI=AI(e=cI).call(e):wI=function(e,t,r){var n=CI(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 xI(e,t){var r;return(xI=Hl?AI(r=Hl).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=Vl(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),ad(e,"prototype",{writable:!1}),t&&xI(e,t)}var PI=Rr,MI=d,NI=SI,DI=yv,LI=tr,UI=$,VI=Hn,FI=i,BI=oe("Reflect","construct"),jI=Object.prototype,GI=[].push,HI=FI((function(){function e(){}return!(BI((function(){}),[],e)instanceof e)})),zI=!FI((function(){BI((function(){}))})),XI=HI||zI;PI({target:"Reflect",stat:!0,forced:XI,sham:XI},{construct:function(e,t){DI(e),LI(t);var r=arguments.length<3?e:DI(arguments[2]);if(zI&&!HI)return BI(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 MI(GI,n,t),new(MI(NI,e,n))}var i=r.prototype,o=VI(UI(i)?i:jI),a=MI(e,o,t);return UI(a)?a:o}});var KI=ee.Reflect.construct;function qI(e,t){if(t&&("object"===qd(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return $T(e)}function YI(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=RI(e);if(t){var i=RI(this).constructor;r=KI(n,arguments,i)}else r=n.apply(this,arguments);return qI(this,r)}}var WI=Us("Array").values,QI=_n,JI=We,ZI=ae,$I=WI,eA=Array.prototype,tA={DOMTokenList:!0,NodeList:!0},rA=function(e){var t=e.values;return e===eA||ZI(eA,e)&&t===eA.values||JI(tA,QI(e))?$I:t},nA=ni,iA=Math.floor,oA=function(e,t){var r=e.length,n=iA(r/2);return r<8?aA(e,t):sA(e,oA(nA(e,0,n),t),oA(nA(e,n),t),t)},aA=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},sA=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},cA=oA,uA=se.match(/firefox\/(\d+)/i),dA=!!uA&&+uA[1],lA=/MSIE|Trident/.test(se),hA=se.match(/AppleWebKit\/(\d+)\./),vA=!!hA&&+hA[1],pA=Rr,_A=E,fA=we,mA=Ke,gA=Br,yA=LE,SA=gn,bA=i,EA=cA,kA=Iu,TA=dA,IA=lA,AA=pe,RA=vA,CA=[],wA=_A(CA.sort),xA=_A(CA.push),OA=bA((function(){CA.sort(void 0)})),PA=bA((function(){CA.sort(null)})),MA=kA("sort"),NA=!bA((function(){if(AA)return AA<70;if(!(TA&&TA>3)){if(IA)return!0;if(RA)return RA<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++)CA.push({k:t+n,v:r})}for(CA.sort((function(e,t){return t.v-e.v})),n=0;n<CA.length;n++)t=CA[n].k.charAt(0),i.charAt(i.length-1)!==t&&(i+=t);return"DGBEFHACIJK"!==i}}));pA({target:"Array",proto:!0,forced:OA||!PA||!MA||!NA},{sort:function(e){void 0!==e&&fA(e);var t=mA(this);if(NA)return void 0===e?wA(t):wA(t,e);var r,n,i=[],o=gA(t);for(n=0;n<o;n++)n in t&&xA(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:SA(t)>SA(r)?1:-1}}(e)),r=gA(i),n=0;n<r;)t[n]=i[n++];for(;n<o;)yA(t,n++);return t}});var DA=Us("Array").sort,LA=ae,UA=DA,VA=Array.prototype,FA=function(e){var t=e.sort;return e===VA||LA(VA,e)&&t===VA.sort?UA:t},BA=Rr,jA=No.findIndex,GA="findIndex",HA=!0;GA in[]&&Array(1).findIndex((function(){HA=!1})),BA({target:"Array",proto:!0,forced:HA},{findIndex:function(e){return jA(this,e,arguments.length>1?arguments[1]:void 0)}});var zA=Us("Array").findIndex,XA=ae,KA=zA,qA=Array.prototype,YA=function(e){var t=e.findIndex;return e===qA||XA(qA,e)&&t===qA.findIndex?KA:t},WA=Rr,QA=E;R.f;var JA=Vr,ZA=gn,$A=Pb,eR=q,tR=Nb,rR=QA("".startsWith),nR=QA("".slice),iR=Math.min;WA({target:"String",proto:!0,forced:!tR("startsWith")},{startsWith:function(e){var t=ZA(eR(this));$A(e);var r=JA(iR(arguments.length>1?arguments[1]:void 0,t.length)),n=ZA(e);return rR?rR(t,n,r):nR(t,r,r+n.length)===n}});var oR=Us("String").startsWith,aR=ae,sR=oR,cR=String.prototype,uR=function(e){var t=e.startsWith;return"string"==typeof e||e===cR||aR(cR,e)&&t===cR.startsWith?sR:t},dR=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}(dR||{}),lR=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}(lR||{}),hR=Dl((function e(t,r,n){Ll(this,e),Qd(this,"code",void 0),Qd(this,"message",void 0),Qd(this,"error",void 0),this.code=t,this.message=r,this.error=n})),vR=C,pR=E,_R=rn,fR=Q,mR=pR(P.f),gR=pR([].push),yR=function(e){return function(t){for(var r,n=fR(t),i=_R(n),o=i.length,a=0,s=[];o>a;)r=i[a++],vR&&!mR(n,r)||gR(s,e?[r,n[r]]:n[r]);return s}},SR={entries:yR(!0),values:yR(!1)}.entries;Rr({target:"Object",stat:!0},{entries:function(e){return SR(e)}});var bR=ee.Object.entries,ER=Or,kR=gn,TR=q,IR=RangeError,AR=E,RR=Vr,CR=gn,wR=function(e){var t=kR(TR(this)),r="",n=ER(e);if(n<0||n==1/0)throw IR("Wrong number of repetitions");for(;n>0;(n>>>=1)&&(t+=t))1&n&&(r+=t);return r},xR=q,OR=AR(wR),PR=AR("".slice),MR=Math.ceil,NR=function(e){return function(t,r,n){var i,o,a=CR(xR(t)),s=RR(r),c=a.length,u=void 0===n?" ":CR(n);return s<=c||""==u?a:((o=OR(u,MR((i=s-c)/u.length))).length>i&&(o=PR(o,0,i)),e?a+o:o+a)}},DR={start:NR(!1),end:NR(!0)},LR=/Version\/10(?:\.\d+){1,2}(?: [\w./]+)?(?: Mobile\/\w+)? Safari\//.test(se),UR=DR.end;Rr({target:"String",proto:!0,forced:LR},{padEnd:function(e){return UR(this,e,arguments.length>1?arguments[1]:void 0)}});var VR=Us("String").padEnd,FR=ae,BR=VR,jR=String.prototype,GR=function(e){var t=e.padEnd;return"string"==typeof e||e===jR||FR(jR,e)&&t===jR.padEnd?BR:t},HR=ag;Rr({target:"Number",stat:!0,forced:Number.parseInt!=HR},{parseInt:HR});var zR=ee.Number.parseInt,XR=Math.log,KR=Math.LOG10E;Rr({target:"Math",stat:!0},{log10:Math.log10||function(e){return XR(e)*KR}});var qR,YR=ee.Math.log10,WR=new Uint8Array(16);function QR(){if(!qR&&!(qR="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 qR(WR)}var JR=/^(?:[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 ZR(e){return"string"==typeof e&&JR.test(e)}for(var $R=[],eC=0;eC<256;++eC)$R.push((eC+256).toString(16).substr(1));function tC(e,t,r){var n=(e=e||{}).random||(e.rng||QR)();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=($R[e[t+0]]+$R[e[t+1]]+$R[e[t+2]]+$R[e[t+3]]+"-"+$R[e[t+4]]+$R[e[t+5]]+"-"+$R[e[t+6]]+$R[e[t+7]]+"-"+$R[e[t+8]]+$R[e[t+9]]+"-"+$R[e[t+10]]+$R[e[t+11]]+$R[e[t+12]]+$R[e[t+13]]+$R[e[t+14]]+$R[e[t+15]]).toLowerCase();if(!ZR(r))throw TypeError("Stringified UUID is invalid");return r}(n)}var rC=function(){return"undefined"==typeof window},nC=function(){return tC()},iC=function(e){return"number"==typeof e},oC={};!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=bm(Array.prototype).call(arguments,1);t.length;){var n=t.shift();if(n){if("object"!==qd(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)}(oC);var aC={},sC={},cC={},uC=oC;function dC(e){for(var t=e.length;--t>=0;)e[t]=0}var lC=256,hC=286,vC=30,pC=15,_C=[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],fC=[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],mC=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],gC=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],yC=new Array(576);dC(yC);var SC=new Array(60);dC(SC);var bC=new Array(512);dC(bC);var EC=new Array(256);dC(EC);var kC=new Array(29);dC(kC);var TC,IC,AC,RC=new Array(vC);function CC(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 wC(e,t){this.dyn_tree=e,this.max_code=0,this.stat_desc=t}function xC(e){return e<256?bC[e]:bC[256+(e>>>7)]}function OC(e,t){e.pending_buf[e.pending++]=255&t,e.pending_buf[e.pending++]=t>>>8&255}function PC(e,t,r){e.bi_valid>16-r?(e.bi_buf|=t<<e.bi_valid&65535,OC(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 MC(e,t,r){PC(e,r[2*t],r[2*t+1])}function NC(e,t){var r=0;do{r|=1&e,e>>>=1,r<<=1}while(--t>0);return r>>>1}function DC(e,t,r){var n,i,o=new Array(16),a=0;for(n=1;n<=pC;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]=NC(o[s]++,s))}}function LC(e){var t;for(t=0;t<hC;t++)e.dyn_ltree[2*t]=0;for(t=0;t<vC;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 UC(e){e.bi_valid>8?OC(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 VC(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 FC(e,t,r){for(var n=e.heap[r],i=r<<1;i<=e.heap_len&&(i<e.heap_len&&VC(t,e.heap[i+1],e.heap[i],e.depth)&&i++,!VC(t,n,e.heap[i],e.depth));)e.heap[r]=e.heap[i],r=i,i<<=1;e.heap[r]=n}function BC(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?MC(e,i,t):(MC(e,(o=EC[i])+lC+1,t),0!==(a=_C[o])&&PC(e,i-=kC[o],a),MC(e,o=xC(--n),r),0!==(a=fC[o])&&PC(e,n-=RC[o],a))}while(s<e.last_lit);MC(e,256,t)}function jC(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--)FC(e,o,r);i=c;do{r=e.heap[1],e.heap[1]=e.heap[e.heap_len--],FC(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++,FC(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,v=t.stat_desc.extra_base,p=t.stat_desc.max_length,_=0;for(o=0;o<=pC;o++)e.bl_count[o]=0;for(c[2*e.heap[e.heap_max]+1]=0,r=e.heap_max+1;r<573;r++)(o=c[2*c[2*(n=e.heap[r])+1]+1]+1)>p&&(o=p,_++),c[2*n+1]=o,n>u||(e.bl_count[o]++,a=0,n>=v&&(a=h[n-v]),s=c[2*n],e.opt_len+=s*(o+a),l&&(e.static_len+=s*(d[2*n+1]+a)));if(0!==_){do{for(o=p-1;0===e.bl_count[o];)o--;e.bl_count[o]--,e.bl_count[o+1]+=2,e.bl_count[p]--,_-=2}while(_>0);for(o=p;0!==o;o--)for(n=e.bl_count[o];0!==n;)(i=e.heap[--r])>u||(c[2*i+1]!==o&&(e.opt_len+=(o-c[2*i+1])*c[2*i],c[2*i+1]=o),n--)}}(e,t),DC(o,u,e.bl_count)}function GC(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 HC(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{MC(e,i,e.bl_tree)}while(0!=--s);else 0!==i?(i!==o&&(MC(e,i,e.bl_tree),s--),MC(e,16,e.bl_tree),PC(e,s-3,2)):s<=10?(MC(e,17,e.bl_tree),PC(e,s-3,3)):(MC(e,18,e.bl_tree),PC(e,s-11,7));s=0,o=i,0===a?(c=138,u=3):i===a?(c=6,u=3):(c=7,u=4)}}dC(RC);var zC=!1;function XC(e,t,r,n){PC(e,0+(n?1:0),3),function(e,t,r,n){UC(e),n&&(OC(e,r),OC(e,~r)),uC.arraySet(e.pending_buf,e.window,t,r,e.pending),e.pending+=r}(e,t,r,!0)}cC._tr_init=function(e){zC||(!function(){var e,t,r,n,i,o=new Array(16);for(r=0,n=0;n<28;n++)for(kC[n]=r,e=0;e<1<<_C[n];e++)EC[r++]=n;for(EC[r-1]=n,i=0,n=0;n<16;n++)for(RC[n]=i,e=0;e<1<<fC[n];e++)bC[i++]=n;for(i>>=7;n<vC;n++)for(RC[n]=i<<7,e=0;e<1<<fC[n]-7;e++)bC[256+i++]=n;for(t=0;t<=pC;t++)o[t]=0;for(e=0;e<=143;)yC[2*e+1]=8,e++,o[8]++;for(;e<=255;)yC[2*e+1]=9,e++,o[9]++;for(;e<=279;)yC[2*e+1]=7,e++,o[7]++;for(;e<=287;)yC[2*e+1]=8,e++,o[8]++;for(DC(yC,287,o),e=0;e<vC;e++)SC[2*e+1]=5,SC[2*e]=NC(e,5);TC=new CC(yC,_C,257,hC,pC),IC=new CC(SC,fC,0,vC,pC),AC=new CC(new Array(0),mC,0,19,7)}(),zC=!0),e.l_desc=new wC(e.dyn_ltree,TC),e.d_desc=new wC(e.dyn_dtree,IC),e.bl_desc=new wC(e.bl_tree,AC),e.bi_buf=0,e.bi_valid=0,LC(e)},cC._tr_stored_block=XC,cC._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<lC;t++)if(0!==e.dyn_ltree[2*t])return 1;return 0}(e)),jC(e,e.l_desc),jC(e,e.d_desc),a=function(e){var t;for(GC(e,e.dyn_ltree,e.l_desc.max_code),GC(e,e.dyn_dtree,e.d_desc.max_code),jC(e,e.bl_desc),t=18;t>=3&&0===e.bl_tree[2*gC[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?XC(e,t,r,n):4===e.strategy||o===i?(PC(e,2+(n?1:0),3),BC(e,yC,SC)):(PC(e,4+(n?1:0),3),function(e,t,r,n){var i;for(PC(e,t-257,5),PC(e,r-1,5),PC(e,n-4,4),i=0;i<n;i++)PC(e,e.bl_tree[2*gC[i]+1],3);HC(e,e.dyn_ltree,t-1),HC(e,e.dyn_dtree,r-1)}(e,e.l_desc.max_code+1,e.d_desc.max_code+1,a+1),BC(e,e.dyn_ltree,e.dyn_dtree)),LC(e),n&&UC(e)},cC._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*(EC[r]+lC+1)]++,e.dyn_dtree[2*xC(t)]++),e.last_lit===e.lit_bufsize-1},cC._tr_align=function(e){PC(e,2,3),MC(e,256,yC),function(e){16===e.bi_valid?(OC(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 KC=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 qC=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 YC,WC=function(e,t,r,n){var i=qC,o=n+r;e^=-1;for(var a=n;a<o;a++)e=e>>>8^i[255&(e^t[a])];return-1^e},QC={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"},JC=oC,ZC=cC,$C=KC,ew=WC,tw=QC,rw=-2,nw=258,iw=262,ow=103,aw=113,sw=666;function cw(e,t){return e.msg=tw[t],t}function uw(e){return(e<<1)-(e>4?9:0)}function dw(e){for(var t=e.length;--t>=0;)e[t]=0}function lw(e){var t=e.state,r=t.pending;r>e.avail_out&&(r=e.avail_out),0!==r&&(JC.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 hw(e,t){ZC._tr_flush_block(e,e.block_start>=0?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,lw(e.strm)}function vw(e,t){e.pending_buf[e.pending++]=t}function pw(e,t){e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=255&t}function _w(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-iw?e.strstart-(e.w_size-iw):0,u=e.window,d=e.w_mask,l=e.prev,h=e.strstart+nw,v=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]===v&&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=nw-(h-o),o=h-nw,n>a){if(e.match_start=t,a=n,n>=s)break;v=u[o+a-1],p=u[o+a]}}}while((t=l[t&d])>c&&0!=--i);return a<=e.lookahead?a:e.lookahead}function fw(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-iw)){JC.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,JC.arraySet(s,a.input,a.next_in,d,c),1===a.state.wrap?a.adler=$C(a.adler,s,d,c):2===a.state.wrap&&(a.adler=ew(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<iw&&0!==e.strm.avail_in)}function mw(e,t){for(var r,n;;){if(e.lookahead<iw){if(fw(e),e.lookahead<iw&&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-iw&&(e.match_length=_w(e,r)),e.match_length>=3)if(n=ZC._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=ZC._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++;if(n&&(hw(e,!1),0===e.strm.avail_out))return 1}return e.insert=e.strstart<2?e.strstart:2,4===t?(hw(e,!0),0===e.strm.avail_out?3:4):e.last_lit&&(hw(e,!1),0===e.strm.avail_out)?1:2}function gw(e,t){for(var r,n,i;;){if(e.lookahead<iw){if(fw(e),e.lookahead<iw&&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-iw&&(e.match_length=_w(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=ZC._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&&(hw(e,!1),0===e.strm.avail_out))return 1}else if(e.match_available){if((n=ZC._tr_tally(e,0,e.window[e.strstart-1]))&&hw(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=ZC._tr_tally(e,0,e.window[e.strstart-1]),e.match_available=0),e.insert=e.strstart<2?e.strstart:2,4===t?(hw(e,!0),0===e.strm.avail_out?3:4):e.last_lit&&(hw(e,!1),0===e.strm.avail_out)?1:2}function yw(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 Sw(){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 JC.Buf16(1146),this.dyn_dtree=new JC.Buf16(122),this.bl_tree=new JC.Buf16(78),dw(this.dyn_ltree),dw(this.dyn_dtree),dw(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new JC.Buf16(16),this.heap=new JC.Buf16(573),dw(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new JC.Buf16(573),dw(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 bw(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:aw,e.adler=2===t.wrap?0:1,t.last_flush=0,ZC._tr_init(t),0):cw(e,rw)}function Ew(e){var t,r=bw(e);return 0===r&&((t=e.state).window_size=2*t.w_size,dw(t.head),t.max_lazy_match=YC[t.level].max_lazy,t.good_match=YC[t.level].good_length,t.nice_match=YC[t.level].nice_length,t.max_chain_length=YC[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 kw(e,t,r,n,i,o){if(!e)return rw;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 cw(e,rw);8===n&&(n=9);var s=new Sw;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 JC.Buf8(2*s.w_size),s.head=new JC.Buf16(s.hash_size),s.prev=new JC.Buf16(s.w_size),s.lit_bufsize=1<<i+6,s.pending_buf_size=4*s.lit_bufsize,s.pending_buf=new JC.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,Ew(e)}YC=[new yw(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(fw(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,hw(e,!1),0===e.strm.avail_out))return 1;if(e.strstart-e.block_start>=e.w_size-iw&&(hw(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,4===t?(hw(e,!0),0===e.strm.avail_out?3:4):(e.strstart>e.block_start&&(hw(e,!1),e.strm.avail_out),1)})),new yw(4,4,8,4,mw),new yw(4,5,16,8,mw),new yw(4,6,32,32,mw),new yw(4,4,16,16,gw),new yw(8,16,32,32,gw),new yw(8,16,128,128,gw),new yw(8,32,128,256,gw),new yw(32,128,258,1024,gw),new yw(32,258,258,4096,gw)],sC.deflateInit=function(e,t){return kw(e,t,8,15,8,0)},sC.deflateInit2=kw,sC.deflateReset=Ew,sC.deflateResetKeep=bw,sC.deflateSetHeader=function(e,t){return e&&e.state?2!==e.state.wrap?rw:(e.state.gzhead=t,0):rw},sC.deflate=function(e,t){var r,n,i,o;if(!e||!e.state||t>5||t<0)return e?cw(e,rw):rw;if(n=e.state,!e.output||!e.input&&0!==e.avail_in||n.status===sw&&4!==t)return cw(e,0===e.avail_out?-5:rw);if(n.strm=e,r=n.last_flush,n.last_flush=t,42===n.status)if(2===n.wrap)e.adler=0,vw(n,31),vw(n,139),vw(n,8),n.gzhead?(vw(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)),vw(n,255&n.gzhead.time),vw(n,n.gzhead.time>>8&255),vw(n,n.gzhead.time>>16&255),vw(n,n.gzhead.time>>24&255),vw(n,9===n.level?2:n.strategy>=2||n.level<2?4:0),vw(n,255&n.gzhead.os),n.gzhead.extra&&n.gzhead.extra.length&&(vw(n,255&n.gzhead.extra.length),vw(n,n.gzhead.extra.length>>8&255)),n.gzhead.hcrc&&(e.adler=ew(e.adler,n.pending_buf,n.pending,0)),n.gzindex=0,n.status=69):(vw(n,0),vw(n,0),vw(n,0),vw(n,0),vw(n,0),vw(n,9===n.level?2:n.strategy>=2||n.level<2?4:0),vw(n,3),n.status=aw);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=aw,pw(n,a),0!==n.strstart&&(pw(n,e.adler>>>16),pw(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=ew(e.adler,n.pending_buf,n.pending-i,i)),lw(e),i=n.pending,n.pending!==n.pending_buf_size));)vw(n,255&n.gzhead.extra[n.gzindex]),n.gzindex++;n.gzhead.hcrc&&n.pending>i&&(e.adler=ew(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=ew(e.adler,n.pending_buf,n.pending-i,i)),lw(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,vw(n,o)}while(0!==o);n.gzhead.hcrc&&n.pending>i&&(e.adler=ew(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=ew(e.adler,n.pending_buf,n.pending-i,i)),lw(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,vw(n,o)}while(0!==o);n.gzhead.hcrc&&n.pending>i&&(e.adler=ew(e.adler,n.pending_buf,n.pending-i,i)),0===o&&(n.status=ow)}else n.status=ow;if(n.status===ow&&(n.gzhead.hcrc?(n.pending+2>n.pending_buf_size&&lw(e),n.pending+2<=n.pending_buf_size&&(vw(n,255&e.adler),vw(n,e.adler>>8&255),e.adler=0,n.status=aw)):n.status=aw),0!==n.pending){if(lw(e),0===e.avail_out)return n.last_flush=-1,0}else if(0===e.avail_in&&uw(t)<=uw(r)&&4!==t)return cw(e,-5);if(n.status===sw&&0!==e.avail_in)return cw(e,-5);if(0!==e.avail_in||0!==n.lookahead||0!==t&&n.status!==sw){var s=2===n.strategy?function(e,t){for(var r;;){if(0===e.lookahead&&(fw(e),0===e.lookahead)){if(0===t)return 1;break}if(e.match_length=0,r=ZC._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,r&&(hw(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,4===t?(hw(e,!0),0===e.strm.avail_out?3:4):e.last_lit&&(hw(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<=nw){if(fw(e),e.lookahead<=nw&&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+nw;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=nw-(o-i),e.match_length>e.lookahead&&(e.match_length=e.lookahead)}if(e.match_length>=3?(r=ZC._tr_tally(e,1,e.match_length-3),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(r=ZC._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),r&&(hw(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,4===t?(hw(e,!0),0===e.strm.avail_out?3:4):e.last_lit&&(hw(e,!1),0===e.strm.avail_out)?1:2}(n,t):YC[n.level].func(n,t);if(3!==s&&4!==s||(n.status=sw),1===s||3===s)return 0===e.avail_out&&(n.last_flush=-1),0;if(2===s&&(1===t?ZC._tr_align(n):5!==t&&(ZC._tr_stored_block(n,0,0,!1),3===t&&(dw(n.head),0===n.lookahead&&(n.strstart=0,n.block_start=0,n.insert=0))),lw(e),0===e.avail_out))return n.last_flush=-1,0}return 4!==t?0:n.wrap<=0?1:(2===n.wrap?(vw(n,255&e.adler),vw(n,e.adler>>8&255),vw(n,e.adler>>16&255),vw(n,e.adler>>24&255),vw(n,255&e.total_in),vw(n,e.total_in>>8&255),vw(n,e.total_in>>16&255),vw(n,e.total_in>>24&255)):(pw(n,e.adler>>>16),pw(n,65535&e.adler)),lw(e),n.wrap>0&&(n.wrap=-n.wrap),0!==n.pending?0:1)},sC.deflateEnd=function(e){var t;return e&&e.state?42!==(t=e.state.status)&&69!==t&&73!==t&&91!==t&&t!==ow&&t!==aw&&t!==sw?cw(e,rw):(e.state=null,t===aw?cw(e,-3):0):rw},sC.deflateSetDictionary=function(e,t){var r,n,i,o,a,s,c,u,d=t.length;if(!e||!e.state)return rw;if(2===(o=(r=e.state).wrap)||1===o&&42!==r.status||r.lookahead)return rw;for(1===o&&(e.adler=$C(e.adler,t,d,0)),r.wrap=0,d>=r.w_size&&(0===o&&(dw(r.head),r.strstart=0,r.block_start=0,r.insert=0),u=new JC.Buf8(r.w_size),JC.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,fw(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,fw(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},sC.deflateInfo="pako deflate (from Nodeca project)";var Tw={},Iw=oC,Aw=!0,Rw=!0;try{String.fromCharCode.apply(null,[0])}catch(IK){Aw=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(IK){Rw=!1}for(var Cw=new Iw.Buf8(256),ww=0;ww<256;ww++)Cw[ww]=ww>=252?6:ww>=248?5:ww>=240?4:ww>=224?3:ww>=192?2:1;function xw(e,t){if(t<65534&&(e.subarray&&Rw||!e.subarray&&Aw))return String.fromCharCode.apply(null,Iw.shrinkBuf(e,t));for(var r="",n=0;n<t;n++)r+=String.fromCharCode(e[n]);return r}Cw[254]=Cw[254]=1,Tw.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 Iw.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},Tw.buf2binstring=function(e){return xw(e,e.length)},Tw.binstring2buf=function(e){for(var t=new Iw.Buf8(e.length),r=0,n=t.length;r<n;r++)t[r]=e.charCodeAt(r);return t},Tw.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=Cw[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 xw(s,n)},Tw.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+Cw[e[r]]>t?r:t};var Ow=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},Pw=sC,Mw=oC,Nw=Tw,Dw=QC,Lw=Ow,Uw=Object.prototype.toString;function Vw(e){if(!(this instanceof Vw))return new Vw(e);this.options=Mw.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 Lw,this.strm.avail_out=0;var r=Pw.deflateInit2(this.strm,t.level,t.method,t.windowBits,t.memLevel,t.strategy);if(0!==r)throw new Error(Dw[r]);if(t.header&&Pw.deflateSetHeader(this.strm,t.header),t.dictionary){var n;if(n="string"==typeof t.dictionary?Nw.string2buf(t.dictionary):"[object ArrayBuffer]"===Uw.call(t.dictionary)?new Uint8Array(t.dictionary):t.dictionary,0!==(r=Pw.deflateSetDictionary(this.strm,n)))throw new Error(Dw[r]);this._dict_set=!0}}function Fw(e,t){var r=new Vw(t);if(r.push(e,!0),r.err)throw r.msg||Dw[r.err];return r.result}Vw.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=Nw.string2buf(e):"[object ArrayBuffer]"===Uw.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 Mw.Buf8(o),i.next_out=0,i.avail_out=o),1!==(r=Pw.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(Nw.buf2binstring(Mw.shrinkBuf(i.output,i.next_out))):this.onData(Mw.shrinkBuf(i.output,i.next_out)))}while((i.avail_in>0||0===i.avail_out)&&1!==r);return 4===n?(r=Pw.deflateEnd(this.strm),this.onEnd(r),this.ended=!0,0===r):2!==n||(this.onEnd(0),i.avail_out=0,!0)},Vw.prototype.onData=function(e){this.chunks.push(e)},Vw.prototype.onEnd=function(e){0===e&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=Mw.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg},aC.Deflate=Vw,aC.deflate=Fw,aC.deflateRaw=function(e,t){return(t=t||{}).raw=!0,Fw(e,t)},aC.gzip=function(e,t){return(t=t||{}).gzip=!0,Fw(e,t)};var Bw={},jw=tr,Gw=O,Hw=We,zw=ae,Xw=function(){var e=jw(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},Kw=RegExp.prototype,qw=ae,Yw=function(e){var t=e.flags;return void 0!==t||"flags"in Kw||Hw(e,"flags")||!zw(Kw,e)?t:Gw(Xw,e)},Ww=RegExp.prototype,Qw=function(e){return e===Ww||qw(Ww,e)?Yw(e):e.flags},Jw={},Zw=oC,$w=15,ex=[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],tx=[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],rx=[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],nx=[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],ix=oC,ox=KC,ax=WC,sx=function(e,t){var r,n,i,o,a,s,c,u,d,l,h,v,p,_,f,m,g,y,S,b,E,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,v=r.hold,p=r.bits,_=r.lencode,f=r.distcode,m=(1<<r.lenbits)-1,g=(1<<r.distbits)-1;e:do{p<15&&(v+=I[n++]<<p,p+=8,v+=I[n++]<<p,p+=8),y=_[v&m];t:for(;;){if(v>>>=S=y>>>24,p-=S,0===(S=y>>>16&255))A[o++]=65535&y;else{if(!(16&S)){if(0==(64&S)){y=_[(65535&y)+(v&(1<<S)-1)];continue t}if(32&S){r.mode=12;break e}e.msg="invalid literal/length code",r.mode=30;break e}b=65535&y,(S&=15)&&(p<S&&(v+=I[n++]<<p,p+=8),b+=v&(1<<S)-1,v>>>=S,p-=S),p<15&&(v+=I[n++]<<p,p+=8,v+=I[n++]<<p,p+=8),y=f[v&g];r:for(;;){if(v>>>=S=y>>>24,p-=S,!(16&(S=y>>>16&255))){if(0==(64&S)){y=f[(65535&y)+(v&(1<<S)-1)];continue r}e.msg="invalid distance code",r.mode=30;break e}if(E=65535&y,p<(S&=15)&&(v+=I[n++]<<p,(p+=8)<S&&(v+=I[n++]<<p,p+=8)),(E+=v&(1<<S)-1)>c){e.msg="invalid distance too far back",r.mode=30;break e}if(v>>>=S,p-=S,E>(S=o-a)){if((S=E-S)>d&&r.sane){e.msg="invalid distance too far back",r.mode=30;break e}if(k=0,T=h,0===l){if(k+=u-S,S<b){b-=S;do{A[o++]=h[k++]}while(--S);k=o-E,T=A}}else if(l<S){if(k+=u+l-S,(S-=l)<b){b-=S;do{A[o++]=h[k++]}while(--S);if(k=0,l<b){b-=S=l;do{A[o++]=h[k++]}while(--S);k=o-E,T=A}}}else if(k+=l-S,S<b){b-=S;do{A[o++]=h[k++]}while(--S);k=o-E,T=A}for(;b>2;)A[o++]=T[k++],A[o++]=T[k++],A[o++]=T[k++],b-=3;b&&(A[o++]=T[k++],b>1&&(A[o++]=T[k++]))}else{k=o-E;do{A[o++]=A[k++],A[o++]=A[k++],A[o++]=A[k++],b-=3}while(b>2);b&&(A[o++]=A[k++],b>1&&(A[o++]=A[k++]))}break}}break}}while(n<i&&o<s);n-=b=p>>3,v&=(1<<(p-=b<<3))-1,e.next_in=n,e.next_out=o,e.avail_in=n<i?i-n+5:5-(n-i),e.avail_out=o<s?s-o+257:257-(o-s),r.hold=v,r.bits=p},cx=function(e,t,r,n,i,o,a,s){var c,u,d,l,h,v,p,_,f,m=s.bits,g=0,y=0,S=0,b=0,E=0,k=0,T=0,I=0,A=0,R=0,C=null,w=0,x=new Zw.Buf16(16),O=new Zw.Buf16(16),P=null,M=0;for(g=0;g<=$w;g++)x[g]=0;for(y=0;y<n;y++)x[t[r+y]]++;for(E=m,b=$w;b>=1&&0===x[b];b--);if(E>b&&(E=b),0===b)return i[o++]=20971520,i[o++]=20971520,s.bits=1,0;for(S=1;S<b&&0===x[S];S++);for(E<S&&(E=S),I=1,g=1;g<=$w;g++)if(I<<=1,(I-=x[g])<0)return-1;if(I>0&&(0===e||1!==b))return-1;for(O[1]=0,g=1;g<$w;g++)O[g+1]=O[g]+x[g];for(y=0;y<n;y++)0!==t[r+y]&&(a[O[t[r+y]]++]=y);if(0===e?(C=P=a,v=19):1===e?(C=ex,w-=257,P=tx,M-=257,v=256):(C=rx,P=nx,v=-1),R=0,y=0,g=S,h=o,k=E,T=0,d=-1,l=(A=1<<E)-1,1===e&&A>852||2===e&&A>592)return 1;for(;;){p=g-T,a[y]<v?(_=0,f=a[y]):a[y]>v?(_=P[M+a[y]],f=C[w+a[y]]):(_=96,f=0),c=1<<g-T,S=u=1<<k;do{i[h+(R>>T)+(u-=c)]=p<<24|_<<16|f|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==--x[g]){if(g===b)break;g=t[r+a[y]]}if(g>E&&(R&l)!==d){for(0===T&&(T=E),h+=S,I=1<<(k=g-T);k+T<b&&!((I-=x[k+T])<=0);)k++,I<<=1;if(A+=1<<k,1===e&&A>852||2===e&&A>592)return 1;i[d=R&l]=E<<24|k<<16|h-o|0}}return 0!==R&&(i[h+R]=g-T<<24|64<<16|0),s.bits=E,0},ux=-2,dx=12,lx=30;function hx(e){return(e>>>24&255)+(e>>>8&65280)+((65280&e)<<8)+((255&e)<<24)}function vx(){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 ix.Buf16(320),this.work=new ix.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function px(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 ix.Buf32(852),t.distcode=t.distdyn=new ix.Buf32(592),t.sane=1,t.back=-1,0):ux}function _x(e){var t;return e&&e.state?((t=e.state).wsize=0,t.whave=0,t.wnext=0,px(e)):ux}function fx(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)?ux:(null!==n.window&&n.wbits!==t&&(n.window=null),n.wrap=r,n.wbits=t,_x(e))):ux}function mx(e,t){var r,n;return e?(n=new vx,e.state=n,n.window=null,0!==(r=fx(e,t))&&(e.state=null),r):ux}var gx,yx,Sx=!0;function bx(e){if(Sx){var t;for(gx=new ix.Buf32(512),yx=new ix.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(cx(1,e.lens,0,288,gx,0,e.work,{bits:9}),t=0;t<32;)e.lens[t++]=5;cx(2,e.lens,0,32,yx,0,e.work,{bits:5}),Sx=!1}e.lencode=gx,e.lenbits=9,e.distcode=yx,e.distbits=5}function Ex(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 ix.Buf8(o.wsize)),n>=o.wsize?(ix.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),ix.arraySet(o.window,t,r-n,i,o.wnext),(n-=i)?(ix.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}Jw.inflateReset=_x,Jw.inflateReset2=fx,Jw.inflateResetKeep=px,Jw.inflateInit=function(e){return mx(e,15)},Jw.inflateInit2=mx,Jw.inflate=function(e,t){var r,n,i,o,a,s,c,u,d,l,h,v,p,_,f,m,g,y,S,b,E,k,T,I,A=0,R=new ix.Buf8(4),C=[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 ux;(r=e.state).mode===dx&&(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=ax(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=lx;break}if(8!=(15&u)){e.msg="unknown compression method",r.mode=lx;break}if(d-=4,E=8+(15&(u>>>=4)),0===r.wbits)r.wbits=E;else if(E>r.wbits){e.msg="invalid window size",r.mode=lx;break}r.dmax=1<<E,e.adler=r.check=1,r.mode=512&u?10:dx,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&Qw(r))){e.msg="unknown compression method",r.mode=lx;break}if(57344&Qw(r)){e.msg="unknown header flags set",r.mode=lx;break}r.head&&(r.head.text=u>>8&1),512&Qw(r)&&(R[0]=255&u,R[1]=u>>>8&255,r.check=ax(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&Qw(r)&&(R[0]=255&u,R[1]=u>>>8&255,R[2]=u>>>16&255,R[3]=u>>>24&255,r.check=ax(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&Qw(r)&&(R[0]=255&u,R[1]=u>>>8&255,r.check=ax(r.check,R,2,0)),u=0,d=0,r.mode=5;case 5:if(1024&Qw(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&Qw(r)&&(R[0]=255&u,R[1]=u>>>8&255,r.check=ax(r.check,R,2,0)),u=0,d=0}else r.head&&(r.head.extra=null);r.mode=6;case 6:if(1024&Qw(r)&&((v=r.length)>s&&(v=s),v&&(r.head&&(E=r.head.extra_len-r.length,r.head.extra||(r.head.extra=new Array(r.head.extra_len)),ix.arraySet(r.head.extra,n,o,v,E)),512&Qw(r)&&(r.check=ax(r.check,n,v,o)),s-=v,o+=v,r.length-=v),r.length))break e;r.length=0,r.mode=7;case 7:if(2048&Qw(r)){if(0===s)break e;v=0;do{E=n[o+v++],r.head&&E&&r.length<65536&&(r.head.name+=String.fromCharCode(E))}while(E&&v<s);if(512&Qw(r)&&(r.check=ax(r.check,n,v,o)),s-=v,o+=v,E)break e}else r.head&&(r.head.name=null);r.length=0,r.mode=8;case 8:if(4096&Qw(r)){if(0===s)break e;v=0;do{E=n[o+v++],r.head&&E&&r.length<65536&&(r.head.comment+=String.fromCharCode(E))}while(E&&v<s);if(512&Qw(r)&&(r.check=ax(r.check,n,v,o)),s-=v,o+=v,E)break e}else r.head&&(r.head.comment=null);r.mode=9;case 9:if(512&Qw(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=lx;break}u=0,d=0}r.head&&(r.head.hcrc=Qw(r)>>9&1,r.head.done=!0),e.adler=r.check=0,r.mode=dx;break;case 10:for(;d<32;){if(0===s)break e;s--,u+=n[o++]<<d,d+=8}e.adler=r.check=hx(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=dx;case dx: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(bx(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=lx}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=lx;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(v=r.length){if(v>s&&(v=s),v>c&&(v=c),0===v)break e;ix.arraySet(i,n,o,v,a),s-=v,o+=v,c-=v,a+=v,r.length-=v;break}r.mode=dx;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=lx;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[C[r.have++]]=7&u,u>>>=3,d-=3}for(;r.have<19;)r.lens[C[r.have++]]=0;if(r.lencode=r.lendyn,r.lenbits=7,T={bits:r.lenbits},k=cx(0,r.lens,0,19,r.lencode,0,r.work,T),r.lenbits=T.bits,k){e.msg="invalid code lengths set",r.mode=lx;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,!((f=A>>>24)<=d);){if(0===s)break e;s--,u+=n[o++]<<d,d+=8}if(g<16)u>>>=f,d-=f,r.lens[r.have++]=g;else{if(16===g){for(I=f+2;d<I;){if(0===s)break e;s--,u+=n[o++]<<d,d+=8}if(u>>>=f,d-=f,0===r.have){e.msg="invalid bit length repeat",r.mode=lx;break}E=r.lens[r.have-1],v=3+(3&u),u>>>=2,d-=2}else if(17===g){for(I=f+3;d<I;){if(0===s)break e;s--,u+=n[o++]<<d,d+=8}d-=f,E=0,v=3+(7&(u>>>=f)),u>>>=3,d-=3}else{for(I=f+7;d<I;){if(0===s)break e;s--,u+=n[o++]<<d,d+=8}d-=f,E=0,v=11+(127&(u>>>=f)),u>>>=7,d-=7}if(r.have+v>r.nlen+r.ndist){e.msg="invalid bit length repeat",r.mode=lx;break}for(;v--;)r.lens[r.have++]=E}}if(r.mode===lx)break;if(0===r.lens[256]){e.msg="invalid code -- missing end-of-block",r.mode=lx;break}if(r.lenbits=9,T={bits:r.lenbits},k=cx(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=lx;break}if(r.distbits=6,r.distcode=r.distdyn,T={bits:r.distbits},k=cx(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=lx;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,sx(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===dx&&(r.back=-1);break}for(r.back=0;m=(A=r.lencode[u&(1<<r.lenbits)-1])>>>16&255,g=65535&A,!((f=A>>>24)<=d);){if(0===s)break e;s--,u+=n[o++]<<d,d+=8}if(m&&0==(240&m)){for(y=f,S=m,b=g;m=(A=r.lencode[b+((u&(1<<y+S)-1)>>y)])>>>16&255,g=65535&A,!(y+(f=A>>>24)<=d);){if(0===s)break e;s--,u+=n[o++]<<d,d+=8}u>>>=y,d-=y,r.back+=y}if(u>>>=f,d-=f,r.back+=f,r.length=g,0===m){r.mode=26;break}if(32&m){r.back=-1,r.mode=dx;break}if(64&m){e.msg="invalid literal/length code",r.mode=lx;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,!((f=A>>>24)<=d);){if(0===s)break e;s--,u+=n[o++]<<d,d+=8}if(0==(240&m)){for(y=f,S=m,b=g;m=(A=r.distcode[b+((u&(1<<y+S)-1)>>y)])>>>16&255,g=65535&A,!(y+(f=A>>>24)<=d);){if(0===s)break e;s--,u+=n[o++]<<d,d+=8}u>>>=y,d-=y,r.back+=y}if(u>>>=f,d-=f,r.back+=f,64&m){e.msg="invalid distance code",r.mode=lx;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=lx;break}r.mode=25;case 25:if(0===c)break e;if(v=h-c,r.offset>v){if((v=r.offset-v)>r.whave&&r.sane){e.msg="invalid distance too far back",r.mode=lx;break}v>r.wnext?(v-=r.wnext,p=r.wsize-v):p=r.wnext-v,v>r.length&&(v=r.length),_=r.window}else _=i,p=a-r.offset,v=r.length;v>c&&(v=c),c-=v,r.length-=v;do{i[a++]=_[p++]}while(--v);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=Qw(r)?ax(r.check,i,h,a-h):ox(r.check,i,h,a-h)),h=c,(Qw(r)?u:hx(u))!==r.check){e.msg="incorrect data check",r.mode=lx;break}u=0,d=0}r.mode=28;case 28:if(r.wrap&&Qw(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=lx;break}u=0,d=0}r.mode=29;case 29:k=1;break e;case lx:k=-3;break e;case 31:return-4;default:return ux}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<lx&&(r.mode<27||4!==t))&&Ex(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=Qw(r)?ax(r.check,i,h,e.next_out-h):ox(r.check,i,h,e.next_out-h)),e.data_type=r.bits+(r.last?64:0)+(r.mode===dx?128:0)+(20===r.mode||15===r.mode?256:0),(0===l&&0===h||4===t)&&0===k&&(k=-5),k},Jw.inflateEnd=function(e){if(!e||!e.state)return ux;var t=e.state;return t.window&&(t.window=null),e.state=null,0},Jw.inflateGetHeader=function(e,t){var r;return e&&e.state?0==(2&(r=e.state).wrap)?ux:(r.head=t,t.done=!1,0):ux},Jw.inflateSetDictionary=function(e,t){var r,n=t.length;return e&&e.state?0!==(r=e.state).wrap&&11!==r.mode?ux:11===r.mode&&ox(1,t,n,0)!==r.check?-3:Ex(e,t,n,n)?(r.mode=31,-4):(r.havedict=1,0):ux},Jw.inflateInfo="pako inflate (from Nodeca project)";var kx={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 Tx=Jw,Ix=oC,Ax=Tw,Rx=kx,Cx=QC,wx=Ow,xx=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},Ox=Object.prototype.toString;function Px(e){if(!(this instanceof Px))return new Px(e);this.options=Ix.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 wx,this.strm.avail_out=0;var r=Tx.inflateInit2(this.strm,t.windowBits);if(r!==Rx.Z_OK)throw new Error(Cx[r]);if(this.header=new xx,Tx.inflateGetHeader(this.strm,this.header),t.dictionary&&("string"==typeof t.dictionary?t.dictionary=Ax.string2buf(t.dictionary):"[object ArrayBuffer]"===Ox.call(t.dictionary)&&(t.dictionary=new Uint8Array(t.dictionary)),t.raw&&(r=Tx.inflateSetDictionary(this.strm,t.dictionary))!==Rx.Z_OK))throw new Error(Cx[r])}function Mx(e,t){var r=new Px(t);if(r.push(e,!0),r.err)throw r.msg||Cx[r.err];return r.result}Px.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?Rx.Z_FINISH:Rx.Z_NO_FLUSH,"string"==typeof e?s.input=Ax.binstring2buf(e):"[object ArrayBuffer]"===Ox.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 Ix.Buf8(c),s.next_out=0,s.avail_out=c),(r=Tx.inflate(s,Rx.Z_NO_FLUSH))===Rx.Z_NEED_DICT&&u&&(r=Tx.inflateSetDictionary(this.strm,u)),r===Rx.Z_BUF_ERROR&&!0===d&&(r=Rx.Z_OK,d=!1),r!==Rx.Z_STREAM_END&&r!==Rx.Z_OK)return this.onEnd(r),this.ended=!0,!1;s.next_out&&(0!==s.avail_out&&r!==Rx.Z_STREAM_END&&(0!==s.avail_in||n!==Rx.Z_FINISH&&n!==Rx.Z_SYNC_FLUSH)||("string"===this.options.to?(i=Ax.utf8border(s.output,s.next_out),o=s.next_out-i,a=Ax.buf2string(s.output,i),s.next_out=o,s.avail_out=c-o,o&&Ix.arraySet(s.output,s.output,i,o,0),this.onData(a)):this.onData(Ix.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!==Rx.Z_STREAM_END);return r===Rx.Z_STREAM_END&&(n=Rx.Z_FINISH),n===Rx.Z_FINISH?(r=Tx.inflateEnd(this.strm),this.onEnd(r),this.ended=!0,r===Rx.Z_OK):n!==Rx.Z_SYNC_FLUSH||(this.onEnd(Rx.Z_OK),s.avail_out=0,!0)},Px.prototype.onData=function(e){this.chunks.push(e)},Px.prototype.onEnd=function(e){e===Rx.Z_OK&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=Ix.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg},Bw.Inflate=Px,Bw.inflate=Mx,Bw.inflateRaw=function(e,t){return(t=t||{}).raw=!0,Mx(e,t)},Bw.ungzip=Mx;var Nx={};(0,oC.assign)(Nx,aC,Bw,kx);var Dx,Lx=Nx,Ux="BytePlusRTC",Vx=function(){return window.indexedDB||window.mozIndexedDB||window.webkitIndexedDB||window.msIndexedDB},Fx=function(){function e(t){Ll(this,e),Qd(this,"storeName",void 0),Qd(this,"pendingList",[]),this.storeName=t,!rC()&&Vx()&&this._checkAndCreateStore(t)}var t,r;return Dl(e,[{key:"_checkAndCreateStore",value:function(t,r){var n=this;e.db&&e.db.close();var i=r?Vx().open(Ux,r):Vx().open(Ux);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=Tm(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 qf((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=Tm(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 qf((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=Tm(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 qf((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}();Qd(Fx,"db",void 0),Qd(Fx,"state","init");var Bx,jx={product_line:"rtc",report_version:"5",os:"web",user_agent:rC()?"":null===(Dx=navigator)||void 0===Dx?void 0:Dx.userAgent,platform:"web",product:"webrtc",app_state:"active"},Gx="ReportErrorBuffer",Hx=function(){function e(){Ll(this,e),Qd(this,"_buffer",new Fx(Gx))}var t,r;return Dl(e,[{key:"set",value:(r=Tm(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,Gx);case 2:case"end":return e.stop()}}),e,this)}))),function(e){return r.apply(this,arguments)})},{key:"get",value:(t=Tm(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(Gx);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}(),zx=function(){function e(){var t=this;Ll(this,e),Qd(this,"report_common",jx),Qd(this,"dataBuffer",[]),Qd(this,"posting",!1),Qd(this,"sucSendTimer",void 0),Qd(this,"preSucTime",0),Qd(this,"errSendTimer",void 0),Qd(this,"errSendDelay",100),Qd(this,"errSendBuffer",void 0),Qd(this,"_logServerUrl",void 0),Qd(this,"_retryCount",0),rC()||(window.addEventListener("beforeunload",(function(){clearTimeout(t.errSendTimer),clearTimeout(t.sucSendTimer),t._send(void 0,!0)})),document.addEventListener("visibilitychange",(function(){"visible"===document.visibilityState?t.setCommonStats({app_state:"active"}):"hidden"===document.visibilityState&&t.setCommonStats({app_state:"background"})})))}var t;return Dl(e,[{key:"setUrl",value:function(e){this._logServerUrl=e}},{key:"setCommonStats",value:function(e){this.report_common=Ab(this.report_common,e)}},{key:"enableErrorBuffer",value:function(){this.errSendBuffer=new Hx,this.loadErrorBuffer()}},{key:"push",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];t?this._send(e):(this.dataBuffer.push(e),!this.posting&&!this.errSendTimer&&Date.now()-this.preSucTime>2e3&&(clearTimeout(this.sucSendTimer),this._send()))}},{key:"_unshift",value:function(e){this.dataBuffer=wm(e).call(e,this.dataBuffer)}},{key:"_send",value:function(e,t){var r,n,i=this;if((e||this.dataBuffer.length)&&this._logServerUrl){var o={data:e||ek(r=this.dataBuffer).call(r,0,4e3),header:Zd(Zd({},this.report_common),{},{http_retry_count:this._retryCount}),from:"web",os:"web",version:"1"},a=new XMLHttpRequest;if(a.timeout=1e4,a.onreadystatechange=function(){if(4===a.readyState){var r,n,s,c;if(e||(i.posting=!1),200===a.status||304===a.status)try{r=JSON.parse(a.responseText)}catch(TK){n=TK}if(r&&0===r.StatusCode){if(!e&&!t)null===(s=i.errSendBuffer)||void 0===s||s.set([]),i._sucSend()}else if(setTimeout((function(){var e,t;SO(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===(c=i.errSendBuffer)||void 0===c||c.set(Yk(i.dataBuffer)),t?i._send():i._errSend()}},a.open("POST",this._logServerUrl,!0),e||(this.posting=!0),!rC()&&_k(n=location.search).call(n,"_rtc_debug_"))a.send(Mm(o));else{var s=Lx.gzip(Mm(o));a.setRequestHeader("Content-Encoding","gzip"),a.setRequestHeader("Content-Type","application/x-www-form-urlencoded; charset=UTF-8"),a.send(s)}}}},{key:"_sucSend",value:function(){this.errSendDelay=100,this._retryCount=0,this.preSucTime=Date.now(),this.sucSendTimer=window.setTimeout(this._send.bind(this),2e3)}},{key:"_errSend",value:function(){var e=this;this.errSendTimer=window.setTimeout((function(){e._send(),delete e.errSendTimer}),this.errSendDelay),this.errSendDelay*=2,this._retryCount++}},{key:"loadErrorBuffer",value:(t=Tm(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)})}]),e}(),Xx=new zx,Kx=function(){function e(t){Ll(this,e),Qd(this,"report_id",0),Qd(this,"modify_ids",{}),this.id=t}return Dl(e,[{key:"report",value:function(e,t){var r,n,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},o=Zd(Zd(Zd({event_key:e,report_id:this.report_id++,rtc_timestamp:Date.now()},this.modify_ids),t),{},{common_extra_info:Mm(i)});(Xx.push(o),rC())||(null===(r=(n=window).__onRTCReport)||void 0===r||r.call(n,this.id,o))}},{key:"set",value:function(e){this.modify_ids=Ab(this.modify_ids,e)}},{key:"destroy",value:function(){}}]),e}(),qx=Us("Array").keys,Yx=_n,Wx=We,Qx=ae,Jx=qx,Zx=Array.prototype,$x={DOMTokenList:!0,NodeList:!0},eO=function(e){var t=e.keys;return e===Zx||Qx(Zx,e)&&t===Zx.keys||Wx($x,Yx(e))?Jx:t},tO="@byted/ve-rtc",rO="@byted/ve-rtc-cache-size",nO=function(){function e(){Ll(this,e),Qd(this,"storeKey",void 0),Qd(this,"logLevel",void 0),Qd(this,"LogfileSize",void 0),Qd(this,"db",void 0),Qd(this,"logId",void 0),Qd(this,"cacheLog",void 0),Qd(this,"cachedSize",void 0),Qd(this,"preCacheTime",void 0),Qd(this,"timer",void 0),Qd(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 Dl(e,[{key:"_createStore",value:function(){var e=this;if(!rC()&&window.indexedDB){var t=indexedDB.open("@byted/ve-rtc");t.onupgradeneeded=function(){t.result.createObjectStore(tO);try{localStorage.removeItem(rO)}catch(TK){}},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(rO);if(t)this.cachedSize=+t;else rA(this).call(this).then((function(t){e.cachedSize=e._getSize(t),e._setCachedSize()}))}catch(TK){}}},{key:"_setCachedSize",value:function(){try{localStorage.setItem(rO,"".concat(this.cachedSize))}catch(TK){}}},{key:"_getStore",value:function(e){if(this.db)return this.db.transaction(tO,e).objectStore(tO)}},{key:"set",value:function(e){var t=this;return new qf((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 v;if(!e)return n(p);t.cacheLog+=wm(v="\n\n".concat(t.logId,": ")).call(v,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 qf((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 qf((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 eO(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 qf((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 qf((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}(),iO=new nO,oO="[VERTC]",aO=["#0050b3","#0050b3","#0050b3","#0050b3","#0050b3"],sO="undefined"!=typeof window&&_k(Bx=window.location.search).call(Bx,"_rtc_debug_"),cO=function(){function e(t,r,n){Ll(this,e),Qd(this,"_indent",void 0),Qd(this,"_module",void 0),Qd(this,"_id",void 0),this._module=t,this._indent=r}return Dl(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,v,p,_,f=wm(h=[]).call(h,u),m="".concat(l).replace(/\%o/gi,(function(){var e=f.shift();return Mm(e)}));iO.set(wm(v=wm(p=wm(_="".concat(oO,"[").concat(this._module,".")).call(_,e,"] ")).call(p,m," ")).call(v,Fm(f).call(f,(function(e){return Mm(e)})).join(", ")))}catch(TK){}if(sO){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(uO(),"-")).call(s,oO)).call(a,g,"[")).call(o,this._module,".")).call(i,e,"] ")).call(n,l),"color:".concat(aO[this._indent],";")]).call(r,u))}}}]),e}(),uO=function(){var e=new Date;return e.toTimeString().split(" ")[0]+":"+e.getMilliseconds()},dO=new cO("MessageReportor",1),lO=function(){function e(t){Ll(this,e),Qd(this,"_preTime",Date.now()),Qd(this,"_one2oneNum",0),Qd(this,"_one2manyNum",0),Qd(this,"_one2oneMsgCache",new JS),Qd(this,"_one2manyMsgCache",new JS),Qd(this,"roomId",""),Qd(this,"userId",""),Qd(this,"rtsSessionId",""),this.id=t}return Dl(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,Zd({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,Zd(Zd({},r),t))}},{key:"cacheCustomMsg",value:function(t){var r;this._one2manyMsgCache.set(t.msg_id,Zd({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,Zd(Zd({},r),t))}},{key:"reportP2PMsg",value:function(e){var t,r=this._one2oneMsgCache.get(e);r&&(dO.print("reportP2PMsg",r.type,Mm(r)),null===(t=kO(this.id))||void 0===t||t.report("rts_message",r))}},{key:"reportOne2ManyMsg",value:function(e){var t,r=this._one2manyMsgCache.get(e);r&&(dO.print("reportOne2ManyMsg",r.type,Mm(r)),null===(t=kO(this.id))||void 0===t||t.report("rts_message",r))}},{key:"reportMsgRecv",value:function(t){var r,n;t.config_version=(null===(r=e.config)||void 0===r?void 0:r.version)||"",dO.print("reportMsgRecv",t.type,Mm(t)),null===(n=kO(this.id))||void 0===n||n.report("rts_message",t)}},{key:"destroy",value:function(){this._one2manyNum=0,this._one2oneNum=0,this._one2manyMsgCache.clear(),this._one2oneMsgCache.clear(),this._preTime=Date.now(),this.roomId="",this.userId="",this.rtsSessionId=""}}]),e}();Qd(lO,"config",void 0);var hO=new JS,vO={_cache:hO,setConfig:function(e){dO.print("setConfig","get config: "+Mm(e)),lO.config=e},setRtsSessionId:function(e,t){var r=hO.get(e);r&&(r.rtsSessionId=t)},createRTSMsgReportor:function(e){var t=hO.get(e)||new lO(e);return hO.set(e,t),t},destroyRTSMsgReportor:function(e){var t=hO.get(e);t&&(t.destroy(),hO.delete(e))},setRoomId:function(e,t){var r=hO.get(e);r&&(r.roomId=t||"")},setUserId:function(e,t){var r=hO.get(e);r&&(r.userId=t||"")},samplingP2PMsg:function(e,t){var r=hO.get(e);if(null!=r&&r.needReport("one2one")){var n,i=wm(n="".concat(t.from)).call(n,t.id),o=t.to?"one2one":"one2server";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",type:o,rts_room_id:t.room,req_ts:Date.now(),send_ts:Date.now(),ack_ts:Date.now(),msg_size:0,error_code:0,recv_msg_ts:0,fwd_msg_ts:0,reply_ack_ts:0,cur_dst_uid:""})}return t},updateP2PMsgReq:function(e,t,r){var n,i;t.enable_report&&iC(t.report_msg_id)&&(null===(n=hO.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}))},updateP2PMsgAck:function(e,t,r){if(t.enable_report&&iC(t.report_msg_id)){var n,i,o=hO.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))}},samplingOne2ManyMsg:function(e,t,r){var n,i=hO.get(e);null!=i&&i.needReport("one2many")&&(r.enable_report=!0,r.report_msg_id=t,i.cacheCustomMsg({rts_session_id:i.rtsSessionId,msg_id:wm(n="".concat(r.clientId)).call(n,t),node_role:"src_sdk",from:r.clientId,to:i.roomId,type:"one2many",rts_room_id:i.roomId,req_ts:Date.now(),send_ts:Date.now(),ack_ts:Date.now(),msg_size:0,error_code:0,recv_msg_ts:0,fwd_msg_ts:0,reply_ack_ts:0,cur_dst_uid:""}));return r},reportP2PMsgRecv:function(e,t,r){if(t.enable_report&&iC(t.report_msg_id)){var n,i=hO.get(e),o=t.to?"one2one":"one2many";null==i||i.reportMsgRecv({rts_session_id:i.rtsSessionId,msg_id:wm(n="".concat(t.from)).call(n,t.report_msg_id),msg_size:r.msg_size,node_role:"dst_sdk",type:o,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?"":i.userId,config_version:"",req_ts:0,send_ts:0,ack_ts:0})}},updateOne2ManyMsgAck:function(e,t,r){if(t.enable_report&&iC(t.report_msg_id)){var n,i,o=hO.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))}},updateOne2ManyMsgReq:function(e,t,r){if(t.enable_report&&iC(t.report_msg_id)){var n,i=hO.get(e);if(i)i.updateOne2ManyMsg(wm(n="".concat(t.clientId)).call(n,t.report_msg_id),{send_ts:Date.now(),msg_size:r})}},reportOne2ManyMsgRecv:function(e,t,r){if(t.enable_report&&iC(t.report_msg_id)){var n,i=hO.get(e);null==i||i.reportMsgRecv({rts_session_id:i.rtsSessionId,msg_id:wm(n="".concat(t.clientId)).call(n,t.report_msg_id),msg_size:r.msg_size,node_role:"dst_sdk",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:i.userId,config_version:"",req_ts:0,send_ts:0,ack_ts:0})}}},pO=function(){function e(t){Ll(this,e),Qd(this,"_timer",void 0),Qd(this,"userMessage",{}),Qd(this,"roomMessage",{}),this.id=t,this._setTimer()}return Dl(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,n=this;null===(e=kO(this.id))||void 0===e||e.report("rtc_message_statistics",{dc_user_message:Fm(t=an(this.userMessage)).call(t,(function(e){return n.userMessage[e]})),dc_room_message:Fm(r=an(this.roomMessage)).call(r,(function(e){return n.roomMessage[e]})),media_server_ip:""})}},{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){var r;t&&(t.code||t.err)&&(_k(r=["TIME_OUT","USER_MESSAGE_TIMEOUT"]).call(r,t.code)?e.dc_fail_timeout++:3===t.err?e.dc_fail_no_receiver++:4===t.err?e.dc_fail_no_relay_path++:1===t.err&&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,"p2p",t)}},{key:"recvP2PMessage",value:function(e){this._recvUserMessage(e,"p2p")}},{key:"sendP2PFail",value:function(e,t){this._sendUserFail(e,"p2p",t)}},{key:"sendP2PAck",value:function(e,t,r,n){this._sendUserAck(e,"p2p",t,r,n)}},{key:"sendP2POutRoomMessage",value:function(e,t){this._sendUserMessage(e,"p2p_outside_room",t)}},{key:"recvP2POutRoomMessage",value:function(e){this._recvUserMessage(e,"p2p_outside_room")}},{key:"sendP2POutRoomFail",value:function(e,t){this._sendUserFail(e,"p2p_outside_room",t)}},{key:"sendP2POutRoomAck",value:function(e,t,r,n){this._sendUserAck(e,"p2p_outside_room",t,r,n)}},{key:"sendP2serverMessage",value:function(e){this._sendUserMessage("","p2server",e)}},{key:"sendP2serverFail",value:function(e){this._sendUserFail("","p2server",e)}},{key:"sendP2serveAck",value:function(e,t,r){this._sendUserAck("","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}(),_O=function(e){Xx.setCommonStats(e)},fO=function(e){Xx.setUrl(e)},mO=new Kx("global"),gO=function(e,t,r){mO.report("rtc_sdk_api_call",{sdk_api_name:e,error_code:t,message:r})},yO=function(e,t,r){mO.report("rtc_sdk_callback",{sdk_callback_name:e,error_code:t,message:r})},SO=function(e,t,r){mO.report("rtc_error",{message:e,error_code:t},r)},bO=function(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?arguments[4]:void 0;mO.report("rtc_invoke_status",{sdk_api_name:e,message:t,error_code:r,stream_id:n,elapse:0},i)},EO=new JS,kO=function(e){return EO.get(e)};function TO(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return function(e,r,n){if("function"==typeof n.value){var i=n.value;n.value=function(){for(var e,n=arguments.length,o=new Array(n),a=0;a<n;a++)o[a]=arguments[a];var s,c,u=this.engineId||this.id,d={};(t.forEach((function(e,t){d[e]=o[t]})),"joinRoom"===r)&&(null===(s=kO(u))||void 0===s||s.set({room_id:o[1],user_id:null===(c=o[2])||void 0===c?void 0:c.userId}));null===(e=kO(u))||void 0===e||e.report("rtc_sdk_api_call",{sdk_api_name:r,message:Mm(RO(o)),error_code:0},d);var l=i.apply(this,o);return"function"==typeof(null==l?void 0:l.then)?l.then((function(e){return IO(u,r,[e||{}]),e})).catch((function(e){throw IO(u,r,e.message,e.code),e})):(IO(u,r,[l||{}]),l)}}}}var IO=function(e,t,r){var n,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,o=arguments.length>4?arguments[4]:void 0,a={sdk_callback_name:t,error_code:i,message:Mm(Array.isArray(r)?RO(r):r)};o&&(a.room_id=o),null===(n=kO(e))||void 0===n||n.report("rtc_sdk_callback",a)},AO=function(e,t,r){var n,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:"",a=arguments.length>5?arguments[5]:void 0;null===(n=kO(e))||void 0===n||n.report("rtc_invoke_status",{sdk_api_name:t,message:r,error_code:i,stream_id:o,elapse:0},a)};function RO(e){return Fm(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),v=Fm(c=Kk({length:5})).call(c,(function(e,t){return h.getUint8(t)})),p=Fm(u=Fm(d=Kk({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,Yk(v),["..."],Yk(p))}else s=Kk(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 Fm(t).call(t,e);if(_k(r=["[object Object]","[object MediaStreamTrack]"]).call(r,Object.prototype.toString.call(t))){var _={};for(var f in t)_[f]=e(t[f]);return _}return t}))}var CO=function(e){var t,r=kO(e.engineId),n={keys:eO(e),labelSelector:"",sdkVersion:e.sdkVersion,deviceType:"web",appId:e.appId},i=Fm(t=e.requestDomains).call(t,(function(e){return"https://".concat(e,"/decision/v1/multi")}));null==r||r.report("rtc_get_config",{error_code:0,message:Mm(n),elapse:0,host:i.join(","),type:"request",config_id:"",enable_cloud_proxy:!1});var o=Fm(i).call(i,function(){var e=Tm(Em().mark((function e(t,r){var i;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,fetch(t,{method:"POST",body:Mm(n)}).then((function(e){return e.json()}));case 2:return i=e.sent,e.abrupt("return",{result:i,index:r});case 4:case"end":return e.stop()}}),e)})));return function(t,r){return e.apply(this,arguments)}}());return new qf((function(e){(function(e){return new qf((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)}))}))}))})(o).then((function(t){var n=t.result,o=t.index;null==r||r.report("rtc_get_config",{error_code:200,message:Mm(n),elapse:0,host:i[o],type:"response",config_id:"",enable_cloud_proxy:!1}),e(n)})).catch((function(e){var t;null==r||r.report("rtc_get_config",{error_code:500,message:null===(t=e[0])||void 0===t?void 0:t.message,elapse:0,host:"",type:"response",config_id:"",enable_cloud_proxy:!1})}))}))},wO=new TextDecoder,xO=new TextEncoder,OO=function(){return tC()},PO=function(){return Date.now()};function MO(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 NO=function(){function e(){Ll(this,e)}var t,r;return Dl(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=bR(t);n<i.length;n++){var o=ZT(i[n],2),a=o[0],s=o[1];null!==s&&"object"===qd(s)?e.merge(t[a],r[a]):void 0!==r[a]&&(t[a]=r[a])}}},{key:"ab2str",value:function(e){return wO.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 xO.encode(e).buffer}},{key:"ab2b64str",value:(r=Tm(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 qf((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=Tm(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 DO(){for(var e,t,r=(+GR(e=bm(t="".concat(Math.random())).call(t,-7)).call(e,7,"0")).toString(2),n=GR(r).call(r,28,"1").split(""),i=[];n.length;)i.push(ek(n).call(n,0,7));return Fm(i).call(i,(function(e,t){var r=t===i.length-1?"0":"1";return zR(r+e.join(""),2)}))}var LO=function(){return Math.floor(65535*Math.random())};function UO(e){return"string"==typeof e&&CE(e).call(e,"__web__rtc__rtt__")>-1}var VO,FO,BO,jO,GO,HO,zO,XO,KO=function(){var e=Tm(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)}}(),qO=function(e){return new qf((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 YO(e){return+Math.max(-127,10*YR(Math.pow(e/255,2))).toFixed(2)}function WO(e){return(e&ul.AUDIO)===ul.AUDIO}function QO(e){return(e&ul.VIDEO)===ul.VIDEO}function JO(e){var t={};return an(e).forEach((function(r){"object"===qd(e[r])?t[r]=JO(e[r]):uR(r).call(r,"_")||(t[r]=e[r])})),t}function ZO(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 $O(e){return null==e?"undefined | null":"string"==typeof e?e:Mm({contentHint:e.contentHint,enabled:e.enabled,id:e.id,kind:e.kind,label:e.label,muted:e.muted,readyState:e.readyState})}function eP(e){return void 0===e}function tP(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 rP(e){console.warn("[RTC WebSDK]: "+e)}function nP(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 iP=function(){return"undefined"==typeof window},oP=iP()?"":window.navigator.userAgent;function aP(){var e="none";return iP()||(null!==oP.match("Firefox")?e="mozilla":null!==oP.match("Chrome")?(e="chrome-stable",null!==oP.match("Electron")&&(e="electron")):(null!==oP.match("Safari")||null!==oP.match("AppleWebKit"))&&(e="safari")),e}var sP="mozilla"===aP(),cP="safari"===aP(),uP="chrome-stable"===aP(),dP=!iP()&&/CriOS/i.test(oP);!iP()&&/(iPhone|iPod)/i.exec(oP);var lP=!iP()&&(!!/(iPad)/i.exec(oP)||/Macintosh/i.test(oP)&&"ontouchend"in document),hP=!iP()&&/Macintosh/i.test(oP),vP=!iP()&&/MicroMessenger/i.test(oP),pP=!iP()&&_k(VO=oP.toLowerCase()).call(VO,"mobile");!iP()&&/SM-\w+/i.test(oP);var _P=!iP()&&!!/(iPhone|iPad|iPod)/i.exec(oP),fP=!iP()&&/Android/i.test(oP),mP=!iP()&&/Windows/i.test(oP),gP=0,yP=!iP()&&(null===(FO=oP.match(/version\/(\d+)/i))||void 0===FO?void 0:FO[1]);cP&&yP&&(gP=+yP);var SP=!iP()&&(null===(BO=oP.match(/Firefox\/(\d+)/i))||void 0===BO?void 0:BO[1]);sP&&SP&&(gP=+SP);var bP=gP,EP=gP,kP=null!==(jO=!iP()&&(null===(GO=oP.match(/ ([\d_]+) like Mac OS X/i))||void 0===GO||null===(HO=GO[1])||void 0===HO?void 0:Fm(zO=HO.split("_")).call(zO,(function(e){return sg(e)}))))&&void 0!==jO?jO:[],TP=0,IP=!iP()&&(null===(XO=oP.match(/Chrome\/(\d+)/i))||void 0===XO?void 0:XO[1]);IP&&(TP=+IP);var AP=TP,RP="BytePlus",CP="RTC_DEVICE_ID",wP="RTC_ACCESS_NODE",xP="RTC_ACCESS_URLS",OP="ENGINE_WEB_CONFIG",PP=function(){function e(){Ll(this,e)}return Dl(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,Mm(n)),!0}catch(i){return!1}}},{key:"delete",value:function(e){try{return localStorage.removeItem(e),!0}catch(t){return!1}}}]),e}(),MP=function(e){OI(r,e);var t=YI(r);function r(){return Ll(this,r),t.apply(this,arguments)}return Dl(r,[{key:"getDeviceId",value:function(){if(iP())return"";var e=this.get(CP);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 _O({device_id:e}),this.set(CP,e),e}},{key:"getAccessNode",value:function(e){var t;return this.get(wm(t="".concat(wP,"_").concat(e,"-")).call(t,RP))}},{key:"setAccessNode",value:function(e,t,r){var n;return this.set(wm(n="".concat(wP,"_").concat(e,"-")).call(n,RP),t,1e3*r)}},{key:"clearAccessNode",value:function(e){var t;this.delete(wm(t="".concat(wP,"_").concat(e,"-")).call(t,RP))}},{key:"getAccessUrls",value:function(){return this.get("".concat(xP,"-").concat(RP))}},{key:"setAccessUrls",value:function(e){var t=Fm(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(xP,"-").concat(RP),t)}},{key:"clearAccessUrls",value:function(){this.delete("".concat(xP,"-").concat(RP))}},{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(OP);return(null==a||null===(i=mE(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(OP)||[];return(a=Gs(a).call(a,(function(e){return e.key!==o}))).push({key:o,config:r}),this.set(OP,bm(a).call(a,-5))}}}]),r}(PP),NP=new MP,DP="rtc-access.rtcplus.com,rtc-access-sg.rtcplus.com,rtc-access-va.rtcplus.com,rtc-access-fr.rtcplus.com".split(",");function LP(){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 UP="https://web-log-report.rtcplus.com/video/v1/webrtc_log/",VP="rtc.rtcplus.com".split(","),FP={VERSION:"4.53.5",ICE_CONFIG_REQUEST_URLS_INTERNAL:Fm(DP).call(DP,LP),ICE_CONFIG_REQUEST_URLS:[],EXPECTED_ADDR:"",LOG_SERVER_URL:UP,CONFIG_REQUEST_DOMAINS:VP,DEVICE_ID:"",OVERSEA:!1,PLATFORM:"",PRODUCT:"",FORCE_ENABLED_REPORT_CALLBACKS:[],SKIP_WEB_AUDIO_IN_TRACK:!1,AUDIO_STALL:!0,VIDEO_STALL:!0,STATS_SCALLBACK_SUPPORT:!0,ENABLE_REPORT_ERROR_BUFFER:!1};function BP(e,t){var r;if(gO("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(FP.ICE_CONFIG_REQUEST_URLS=Fm(t).call(t,LP));if("PLATFORM"!==e||"string"!=typeof t)if("PRODUCT"!==e||"string"!=typeof t){if("FORCE_ENABLED_REPORT_CALLBACKS"===e)return"string"==typeof t&&(t=[t]),void(FP.FORCE_ENABLED_REPORT_CALLBACKS=t);if("LOG_SERVER_URL"===e){var n=t===vl.overseas?"https://web-log-report.rtcplus.com/video/v1/webrtc_log/":t===vl.domestic?UP:"string"==typeof t?t:void 0;n&&(FP.LOG_SERVER_URL=n,fO(n))}else if("OVERSEA"===e)return _O({extra_is_oversea:t?"1":"0"}),void(FP.OVERSEA=t);"DEVICE_ID"===e&&NP.setDeviceId(t),"ENABLE_REPORT_ERROR_BUFFER"===e&&t&&Xx.enableErrorBuffer(),FP[e]=t}else _O({product:t});else _O({platform:t})}}function jP(e){return"DEVICE_ID"===e?NP.getDeviceId():FP[e]}function GP(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)||fl.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:Fm(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 HP={width:640,height:480,frameRate:15,maxKbps:600},zP={width:1920,height:1080,frameRate:15,maxKbps:3e3};function XP(e,t){if("boolean"!=typeof e)throw new hR(dR.INVALID_PARAMS,"Invalid ".concat(t,": The value should be boolean type."))}function KP(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 hR(dR.INVALID_PARAMS,wm(i=wm(o="Invalid ".concat(t,": the value range is [")).call(o,r,", ")).call(i,n,"]. integer only"));throw a}}function qP(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 hR(dR.INVALID_PARAMS,"".concat(t," cannot be empty"));if(!$P(e,i,o))throw new hR(dR.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 YP(e,t,r){var n;if(!_k(r).call(r,e))throw new hR(dR.INVALID_PARAMS,wm(n="Invalid ".concat(t,": The value can only be set as ")).call(n,Mm(r)))}function WP(e){if(!(e instanceof MediaStreamTrack))throw new hR(dR.INVALID_PARAMS,"Invalid track, The value should be MediaStreamTrack type.")}function QP(e,t){if(eM(e))throw new hR(dR.INVALID_PARAMS,"Invalid ".concat(t,", should not be empty"))}function JP(e,t){if(!(e instanceof ArrayBuffer))throw new hR(dR.INVALID_PARAMS,"Invalid ".concat(t,", should be ArrayBuffer"))}function ZP(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 $P(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 eM(e){return null==e}function tM(e){if("string"!=typeof e||!/^[a-zA-Z0-9@._\-]{1,128}$/.test(e))throw new hR(dR.INVALID_PARAMS,"The RoomId must be within 128 bytes. The supported characters: a-z,A-Z,0-9,@,-,_,.")}function rM(e){if("string"!=typeof e||!/^[a-zA-Z0-9@._\-]{1,128}$/.test(e))throw new hR(dR.INVALID_PARAMS,"The userId must be within 128 bytes. The supported characters: a-z,A-Z,0-9,@,-,_,.")}function nM(e){if("string"!=typeof e||!/^[a-zA-Z0-9@._\-]{1,128}$/.test(e))throw new hR(dR.INVALID_PARAMS,"The publicStreamId must be within 128 bytes. The supported characters: a-z,A-Z,0-9,@,-,_,.")}function iM(e){QP(e,"userInfo"),rM(e.userId),eM(e.extraInfo)||qP(e.extraInfo,"userInfo.extraInfo",1,200)}function oM(e){QP(e,"roomConfig"),XP(e.isAutoPublish,"roomConfig.isAutoPublish"),XP(e.isAutoSubscribeAudio,"roomConfig.isAutoSubscribeAudio"),XP(e.isAutoSubscribeVideo,"roomConfig.isAutoSubscribeVideo"),eM(e.roomProfileType)||YP(e.roomProfileType,"roomConfig",[bl.communication,bl.chat,bl.chatRoom,bl.coHost,bl.meeting,bl.classRoom])}function aM(e){QP(e,"videoPlayerOption")}function sM(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 hR(dR.INVALID_PARAMS,"The message cannot be empty");if((null===(t=e instanceof ArrayBuffer?e:NO.str2ab(Mm(e)))||void 0===t?void 0:t.byteLength)>1e3*r)throw new hR(dR.INVALID_PARAMS,"The message length must be less than ".concat(r,"K"))}function cM(e){var t,r=jP("FORCE_ENABLED_REPORT_CALLBACKS");return!(null==r||!_k(r).call(r,e))||!_k(t=[Ml.onRemoteStreamStats,Ml.onLocalStreamStats,Ml.onAudioVolumeIndication,Ml.onLocalAudioPropertiesReport,Ml.onRemoteAudioPropertiesReport]).call(t,e)}function uM(e){if("number"!=typeof(null==e?void 0:e.width)||"number"!=typeof(null==e?void 0:e.height))throw new hR(dR.INVALID_PARAMS,"remoteVideoConfig must contain width, height, frameRate")}function dM(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 hR(dR.INVALID_PARAMS,"".concat(t," is not a valid ConstrainULong"))}}function lM(e){var t,r=JT(e);try{for(r.s();!(t=r.n()).done;){var n=t.value;KP(null==n?void 0:n.maxKbps,"maxKbps"),dM(null==n?void 0:n.width,"width"),dM(null==n?void 0:n.height,"height"),dM(null==n?void 0:n.frameRate,"frameRate")}}catch(i){r.e(i)}finally{r.f()}}function hM(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:Number.NEGATIVE_INFINITY,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:Number.POSITIVE_INFINITY;return KP(e,t,Number.NEGATIVE_INFINITY,Number.POSITIVE_INFINITY),e=(e=e>r?e:r)<n?e:n}var vM={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?bm(n).call(n,1):n);return xs?wm(i).call(i,xs(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,v=d.length;for(u=0;u<v;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}(vM);var pM=vM.exports,_M=new cO("VERTC",0),fM=function(e){OI(r,e);var t=YI(r);function r(){return Ll(this,r),t.apply(this,arguments)}return Dl(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(RI(r.prototype),"emit",this)).call.apply(n,wm(i=[this,e]).call(i,a))}catch(TK){return _M.print("safeEmit","safeEmit() | event listener threw an error [event:%s]:%o",e,TK),console.error(TK),Boolean(t)}}}]),r}(vM.exports.EventEmitter),mM=O,gM=tr,yM=$,SM=tI,bM=Qt,EM=R,kM=mc,TM=V;Rr({target:"Reflect",stat:!0,forced:i((function(){var e=function(){},t=bM.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=EM.f(gM(t),r);if(!c){if(yM(o=kM(t)))return e(o,r,n,s);c=TM(0)}if(SM(c)){if(!1===c.writable||!yM(s))return!1;if(i=EM.f(s,r)){if(i.get||i.set||!1===i.writable)return!1;i.value=n,bM.f(s,r,i)}else bM.f(s,r,TM(0,n))}else{if(void 0===(a=c.set))return!1;mM(a,s,n)}return!0}});var IM=ee.Reflect.set;function AM(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],CE(t).call(t,r)>=0||(i[r]=e[r]);return i}(e,t);if(xs){var o=xs(e);for(n=0;n<o.length;n++)r=o[n],CE(t).call(t,r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(i[r]=e[r])}return i}var RM,CM=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}(CM||{}),wM=function(e){return e.PushLimitWarn="PushLimitWarn",e}(wM||{}),xM=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.ON_NOTIFY_RECONNECT="notifyReconnect",e}(xM||{}),OM=function(e){return e.RSCP="RSCP",e.RTT="RTT",e.SSC="SSC",e}(OM||{}),PM=function(e){return e.ON_CONNECTION_STATE_CHANGE="onConnectionStateChange",e.ON_VENDOR_CONNECTION_STATE_CHANGE="onVendorConnectionStateChange",e.ABNORMAL_DISCONNECTION="normalConnection",e}(PM||{}),MM=function(e){return e.userLeave="userLeave",e.connectionLost="connectionLost",e.userDuplicateLogin="userDuplicateLogin",e.kickedByAdmin="kickedByAdmin",e.roleChanged="roleChanged",e.onUserTokenDidExpire="onUserTokenDidExpire",e}(MM||{}),NM=function(e){return e[e.roomDismissByAdmin=2]="roomDismissByAdmin",e}(NM||{}),DM=function(e){return e[e.SEND=0]="SEND",e[e.FEEDBACK=1]="FEEDBACK",e}(DM||{}),LM=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}(LM||{}),UM=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}(UM||{}),VM=(Qd(RM={},0,[0,"success"]),Qd(RM,1,[dR.USER_MESSAGE_TIMEOUT,"timeout, failed to send."]),Qd(RM,2,[dR.USER_MESSAGE_BROKEN,"dataChannel broken, failed to send."]),Qd(RM,3,[dR.USER_MESSAGE_NO_RECEIVER,"cannot find the receiver."]),Qd(RM,4,[dR.USER_MESSAGE_NO_RECEIVER,"cannot find relay path."]),Qd(RM,5,[dR.USER_MESSAGE_EXCEED_QPS,"cannot find relay path."]),Qd(RM,17,[dR.USER_MESSAGE_SEND_TO_SERVER_ERROR,"failed to send to business server."]),Qd(RM,18,[dR.USER_MESSAGE_SERVER_RESPONSE_ERROR,"business server response error."]),Qd(RM,100,[dR.USER_MESSAGE_NOT_JOIN,"not join room"]),Qd(RM,105,[dR.USER_MESSAGE_NOT_LOGIN,"not login."]),Qd(RM,106,[dR.USER_MESSAGE_SERVER_PARAMS_NOTSET,"server param is not set."]),Qd(RM,1e3,[dR.USER_MESSAGE_UNKNOWN,"unknown."]),RM),FM=["msg"],BM=new cO("DataChannelSignaling",3),jM=["onSpeakerChange"],GM=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}(GM||{}),HM=function(e){OI(a,e);var t,r,n,i,o=YI(a);function a(e,t){var r;return Ll(this,a),Qd($T(r=o.call(this)),"_singlingCache",new JS),Qd($T(r),"_p2pCache",new JS),Qd($T(r),"_rttIds",{}),Qd($T(r),"_p2pMessageId",1),Qd($T(r),"_clearDataChannelListener",void 0),Qd($T(r),"_monitor",void 0),r.id=e,r._dataChannel=t,r._clearDataChannelListener=r._handleHandler(),r._monitor=kO(e),window.__rtc_mock_signaling__=r.emit.bind($T(r)),r}return Dl(a,[{key:"destroy",value:function(){this._dataChannel&&(this._clearDataChannelListener(),this._dataChannel.close()),this._singlingCache.clear(),this._p2pCache.clear(),this._p2pMessageId=1,this._rttIds={}}},{key:"sendSignaling",value:function(e,t,r){var n,i=this;return null===(n=this._monitor)||void 0===n||n.report("rtc_signaling",{error_code:0,message:Mm(t),signaling_event:"call-".concat(e),signaling_type:"Send",stream_id:t.streamId,stream_user_id:t.streamUserId,direction:"up"}),new qf((function(n,o){var a,s=i._genHeader(r);s.id=DO();var c=s.id.join("-"),u="customMessage"===e;u&&vO.samplingOne2ManyMsg(i.id,+s.id.join(""),t);var d=setTimeout((function(){i._singlingCache.delete(c),o(new hR(dR.TIME_OUT,"".concat(e," message time out"))),u&&vO.updateOne2ManyMsgAck(i.id,t,999)}),6e4);i._singlingCache.set(c,{signalingType:e,success:function(e){clearTimeout(d),n(e),u&&vO.updateOne2ManyMsgAck(i.id,t,0)},error:function(e){clearTimeout(d),o(e),u&&vO.updateOne2ManyMsgAck(i.id,t,e.code)}}),BM.print("Signal",wm(a=">>>>>> [".concat(e,"][")).call(a,c,"]"),t),i._sendMessage(e,s,t)}))}},{key:"sendPingSignaling",value:function(){return this.sendSignaling("CheckConnectivity",{ts:Date.now()},{functionType:2})}},{key:"sendP2PMessage",value:(i=Tm(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=AM(t,FM),o=n instanceof ArrayBuffer,e.t0=this,e.t1=vO,e.t2=this.id,e.t3=Zd,e.t4=Zd({ver:1,id:this._p2pMessageId++,time:Date.now(),dir:DM.SEND,type:LM.P2P,err:UM.SUCCESS},i),e.t5={},e.t6=o,!o){e.next=15;break}return e.next=12,NO.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 i.apply(this,arguments)})},{key:"_sendP2PMessage",value:function(e){var t=this,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return UO(e.msg)?this._rttIds[e.id]=e.id:e.dir===DM.SEND&&BM.print("_sendP2PMessage [DC Signaling p2p >>]",Mm(e)),new qf((function(n,i){var o=t._genHeader(Zd(Zd({needAck:!0,functionType:1},r),{},{id:DO()}));if(e.dir===DM.SEND){var a=setTimeout((function(){t._p2pCache.delete(e.id),i(new hR(dR.USER_MESSAGE_TIMEOUT,"P2P message timeout")),vO.updateP2PMsgAck(t.id,e,999)}),12e3);t._p2pCache.set(e.id,{success:function(r,i){clearTimeout(a),n(i),vO.updateP2PMsgAck(t.id,e,0)},error:function(r){var n;clearTimeout(a),vO.updateP2PMsgAck(t.id,e,r.err);var o=ZT(VM[r.err]||[dR.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===dR.SIGNALING_CHANNEL_NOT_OPEN&&(s.code=dR.USER_MESSAGE_BROKEN),s}}))}},{key:"_sendMessage",value:function(e,t,r){var n;if(!this._dataChannel||"open"!==this._dataChannel.readyState)throw new hR(dR.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=NO.str2ab(Mm([e,r])),s=MO(Uint8Array,wm(n=[i,o]).call(n,Yk(t.id||[])),new Uint8Array(a));this._dataChannel.send(s.buffer),"p2p"===e?vO.updateP2PMsgReq(this.id,r,s.buffer.byteLength):"customMessage"===e&&vO.updateOne2ManyMsgReq(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=Kk(bm(t).call(t,2,r))}return{header:o,data:bm(t).call(t,r)}}},{key:"_feedbackSignaling",value:function(e,t,r){var n,i,o=this._genHeader({needAck:!0,direction:1,id:Fm(n=e.split("-")).call(n,(function(e){return+e}))});_k(jM).call(jM,t)||BM.print("Signal",wm(i=">>>>>> [".concat(t,"-res][")).call(i,e,"]"));this._sendMessage("".concat(t,"-res"),o,r)}},{key:"_handleMessage",value:(n=Tm(Em().mark((function e(t){var r,n,i,o,a,s,c,u,d;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:r=Date.now(),n=t.byteLength,i=this._dispartData(t),o=i.data,(a=i.header).zip&&((s=new Lx.Inflate).push(o,!0),o=s.result),c=NO.ab2str(o),u=[],e.prev=8,u=JSON.parse(c),e.next=16;break;case 12:return e.prev=12,e.t0=e.catch(8),e.t0 instanceof Error&&(null===(d=this._monitor)||void 0===d||d.report("rtc_signaling_msg_error",{error_code:-1,message:e.t0.message,reason:"message parse failed"})),e.abrupt("return");case 16:e.t1=a.functionType,e.next=0===e.t1?19:1===e.t1?21:2===e.t1?23:25;break;case 19:return this.C2S(a,u,c,n,r),e.abrupt("break",26);case 21:return this.C2C(u,n,r),e.abrupt("break",26);case 23:return this.C2GW(a,u,c),e.abrupt("break",26);case 25:return e.abrupt("break",26);case 26:case"end":return e.stop()}}),e,this,[[8,12]])}))),function(e){return n.apply(this,arguments)})},{key:"C2S",value:(r=Tm(Em().mark((function e(t,r,n,i,o){var a,s,c,u,d;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(s=(null===(a=t.id)||void 0===a?void 0:a.join("-"))||"",1!==t.direction){e.next=5;break}this._handleAckMessage(s,r[0]||{},n),e.next=18;break;case 5:if(!Array.isArray(r)){e.next=18;break}if(u=r[0],r=r[1],_k(jM).call(jM,u)||BM.print("Signal","<<<<<< ".concat(u),r,s),this._feedbackSignaling(s,u,u===xM.ON_CUSTOM_MESSAGE?Zd(Zd({},r),{},{message:""}):""),!r.binary||"string"!=typeof r.message){e.next=14;break}return e.next=13,NO.b64str2ab(r.message);case 13:r.message=e.sent;case 14:d=Date.now(),this.emit(u,Zd({},r)),u===xM.ON_CUSTOM_MESSAGE&&vO.reportOne2ManyMsgRecv(this.id,r,{msg_size:i,recv_msg_ts:o,fwd_msg_ts:d}),null===(c=this._monitor)||void 0===c||c.report("rtc_signaling",{error_code:0,message:n,signaling_event:"on-".concat(u),signaling_type:"Recv",stream_id:r.streamId,stream_user_id:r.clientId,direction:"down"});case 18:case"end":return e.stop()}}),e,this)}))),function(e,t,n,i,o){return r.apply(this,arguments)})},{key:"C2C",value:(t=Tm(Em().mark((function e(t,r,n){var i,o,a,s,c,u,d,l,h,v,p,_,f;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:Array.isArray(t)&&(t=t[1]),c=null===(i=t)||void 0===i?void 0:i.id,this._rttIds[c]||(null===(o=t)||void 0===o?void 0:o.dir)===DM.FEEDBACK||UO(null===(a=t)||void 0===a?void 0:a.msg)?delete this._rttIds[c]:BM.print("Signal","<<<<<< p2p response",t),e.t0=t.dir,e.next=e.t0===DM.SEND?6:e.t0===DM.FEEDBACK?46:48;break;case 6:if(u=Date.now(),UO(null===(s=t)||void 0===s?void 0:s.msg)){e.next=43;break}if(l=(d=t).binary,h=d.msg,v=d.room,p=d.to,_=d.from,f=""===v?l?xM.USER_BINARY_MESSAGE_RECEIVED_OUTSIDE_ROOM:xM.USER_MESSAGE_RECEIVED_OUTSIDE_ROOM:l?xM.USER_BINARY_MESSAGE_RECEIVED:xM.USER_MESSAGE_RECEIVED,p){e.next=27;break}if(e.t1=this,e.t2=xM.ON_CUSTOM_MESSAGE,e.t3=_,e.t4=l,!l){e.next=21;break}return e.next=18,NO.b64str2ab(h);case 18:e.t5=e.sent,e.next=22;break;case 21:e.t5=h;case 22:e.t6=e.t5,e.t7={clientId:e.t3,binary:e.t4,message:e.t6},e.t1.emit.call(e.t1,e.t2,e.t7),e.next=43;break;case 27:if(e.t8=this,e.t9=f,e.t10=Zd,e.t11=Zd({},t),e.t12={},!l){e.next=38;break}return e.next=35,NO.b64str2ab(h);case 35:e.t13=e.sent,e.next=39;break;case 38:e.t13=h;case 39:e.t14=e.t13,e.t15={msg:e.t14},e.t16=(0,e.t10)(e.t11,e.t12,e.t15),e.t8.emit.call(e.t8,e.t9,e.t16);case 43:return this._sendP2PMessage(Zd(Zd({},t),{},{dir:DM.FEEDBACK,msg:""})),vO.reportP2PMsgRecv(this.id,t,{msg_size:r,recv_msg_ts:n,fwd_msg_ts:u}),e.abrupt("break",49);case 46:return this._handleP2PMsgFeedback(t),e.abrupt("break",49);case 48:return e.abrupt("break",49);case 49:case"end":return e.stop()}}),e,this)}))),function(e,r,n){return t.apply(this,arguments)})},{key:"C2GW",value:function(e,t,r){if(1===e.direction){var n,i=(null===(n=e.id)||void 0===n?void 0:n.join("-"))||"";this._handleAckMessage(i,t[0]||{},r)}else{var o=ZT(t,2),a=o[0],s=o[1],c=void 0===s?{}:s;if("RXMediaMsg"===a){var u,d=c.type,l=c.data;switch(null===(u=this._monitor)||void 0===u||u.report("rtc_signaling",{error_code:0,message:r,signaling_event:"on-".concat(d),signaling_type:"Recv",stream_id:"",stream_user_id:"",direction:"down"}),d){case"RSCP":try{var h=JSON.parse(l);Array.isArray(h)&&this.emit(d,h)}catch(_){}break;case"RTT":try{var v=JSON.parse(l);v.length&&this.emit(d,v[0])}catch(_){}break;case"SSC":try{var p=JSON.parse(l);p.length&&this.emit(d,p[0])}catch(_){}}}}}},{key:"_handleHandler",value:function(){var e=this,t=function(t){BM.print("_handleHandler","dataChannel close",t),e.emit("close",t)},r=function(t){BM.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 Zd({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,o=this._singlingCache.get(e);o&&(this._singlingCache.delete(e),200===t.code?o.success(t):o.error(t),BM.print("Signal",wm(i="<<<<<< [".concat(o.signalingType,"-ack] ")).call(i,e),t));null===(n=this._monitor)||void 0===n||n.report("rtc_signaling",{error_code:0,message:r,signaling_event:null==o?void 0:o.signalingType,signaling_type:"Ack",stream_id:"",stream_user_id:"",direction:"down"})}},{key:"_handleP2PMsgFeedback",value:function(e){var t=this._p2pCache.get(e.id);t&&(this._p2pCache.delete(e.id),e.err===UM.SUCCESS?t.success(e.id,e):t.error(e))}}]),a}(vM.exports.EventEmitter),zM=function(){function e(){Ll(this,e),Qd(this,"xhr",void 0),Qd(this,"isSending",void 0),Qd(this,"timeout",void 0),this.isSending=!1}return Dl(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 qf((function(e,i){t.isSending=!0;var a=new XMLHttpRequest;a.open(r,n,!0);for(var c=0,d=bR(s);c<d.length;c++){var l=ZT(d[c],2),h=l[0],v=l[1];a.setRequestHeader(h,v)}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=Mm(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}(),XM=new cO("ICE Request",3),KM=function(){function e(t){Ll(this,e),Qd(this,"_request",void 0),Qd(this,"_monitor",void 0),this.id=t,this._request=new zM,this._monitor=kO(this.id)}var t,r,n;return Dl(e,[{key:"getAccessNode",value:(n=Tm(Em().mark((function e(t,r,n,i,o){var a;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!(a=NP.getAccessNode(t))){e.next=9;break}if(this.getAccessNodeFromServer(t,r,n,i,o),AO(this.id,"es.R.node.cache",a),!Array.isArray(a)){e.next=8;break}return e.abrupt("return",qf.resolve(a));case 8:return e.abrupt("return",qf.resolve([a]));case 9:return e.abrupt("return",this.getAccessNodeFromServer(t,r,n,i,o));case 10:case"end":return e.stop()}}),e,this)}))),function(e,t,r,i,o){return n.apply(this,arguments)})},{key:"getAccessNodeFromServer",value:(r=Tm(Em().mark((function e(t,r,n,i,o){var a,s,c,u,d=this;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return c=NP.getAccessUrls(),u=!0,AO(this.id,"es.R.req.cache.urls",c),(null===(a=c)||void 0===a?void 0:a.length)>0||(c=FP.ICE_CONFIG_REQUEST_URLS,u=!1,AO(this.id,"es.R.req.external.urls",c)),(null===(s=c)||void 0===s?void 0:s.length)>0||(c=FP.ICE_CONFIG_REQUEST_URLS_INTERNAL,u=!1,AO(this.id,"es.R.req.internal.urls",c)),e.abrupt("return",this.getICEConfigFromServer(c,t,r,n,i,o).then((function(e){var r=e.nodes;return NP.setAccessNode(t,r,e.ttl||11200),e.dispatchDomains&&NP.setAccessUrls(e.dispatchDomains),r})).catch((function(e){if(u)return AO(d.id,"es.R.req.fallback",""),NP.clearAccessUrls(),d.getAccessNodeFromServer(t,r,n,i);throw e})));case 6:case"end":return e.stop()}}),e,this)}))),function(e,t,n,i,o){return r.apply(this,arguments)})},{key:"getICEConfigFromServer",value:(t=Tm(Em().mark((function e(t,r,n,i,o,a){var s,c,u,d,l,h=this;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return c={appID:r,deviceID:NP.getDeviceId(),connectSessionID:OO(),os:"web",sdkVersion:FP.VERSION,isOversea:FP.OVERSEA,expectedAddr:jP("EXPECTED_ADDR"),productPlatform:"BytePlus",enableCloudProxy:o,expectedIDC:a},n&&i&&(c.feedbackInfo=[{feedbackIP:null===(u=i.publicIPs[0])||void 0===u?void 0:u.ip,feedbackReason:{type:"NODE_CHANGED",reason:n}}],delete c.expectedAddr),d=Date.now(),null===(s=this._monitor)||void 0===s||s.report("rtc_get_access",{error_code:0,message:Mm(c),elapse:0,type:"request",host:t.join(","),connect_session_id:c.connectSessionID}),l=Fm(t).call(t,function(){var e=Tm(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,h._request.post(t,c);case 3:n=e.sent,e.next=9;break;case 6:throw e.prev=6,e.t0=e.catch(0),new hR(dR.ICE_SERVER_WRONG,"get ICE config failed",e.t0);case 9:if(200===n.code){e.next=11;break}throw new hR(dR.ICE_SERVER_WRONG,"get ICE config failed",{server_code:n.code,message:Mm(n)});case 11:if(i=n.nodes[0]){e.next=14;break}throw new hR(dR.ICE_SERVER_WRONG,"ICE config server return empty nodes",{code:n.code,message:Mm(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",qO(l).then((function(e){var r,n=e.result;e.firstNode;var i=e.index;return null===(r=h._monitor)||void 0===r||r.report("rtc_get_access",{error_code:200,message:Mm(n),elapse:Date.now()-d,type:"response",host:t[i],connect_session_id:c.connectSessionID}),n})).catch((function(e){var r,n,i,o=null===(r=e[0])||void 0===r?void 0:r.error;throw null===(n=h._monitor)||void 0===n||n.report("rtc_get_access",{error_code:+((null==o?void 0:o.code)||(null==o?void 0:o.server_code)),message:null===(i=e[0])||void 0===i?void 0:i.message,elapse:Date.now()-d,type:"response",host:t.join(","),connect_session_id:c.connectSessionID},{error:Mm(o)}),e})));case 6:case"end":return e.stop()}}),e,this)}))),function(e,r,n,i,o,a){return t.apply(this,arguments)})},{key:"abort",value:function(){this._request.isSending&&(XM.print("abort","HTTP Request of [getICEConfigFromServer] abort"),this._request.abort())}}]),e}(),qM=hi.f("asyncIterator");function YM(e){var t,r,n,i=2;for(void 0!==Cd&&(r=qM,n=Kd);i--;){if(r&&null!=(t=e[r]))return t.call(e);if(n&&null!=(t=e[n]))return new WM(t.call(e));r="@@asyncIterator",n="@@iterator"}throw new TypeError("Object is not async iterable")}function WM(e){function t(e){if(Object(e)!==e)return qf.reject(new TypeError(e+" is not an object."));var t=e.done;return qf.resolve(e.value).then((function(e){return{value:e,done:t}}))}return(WM=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?qf.resolve({value:e,done:!0}):t(r.apply(this.s,arguments))},throw:function(e){var r=this.s.return;return void 0===r?qf.reject(e):t(r.apply(this.s,arguments))}},new WM(e)}var QM=[{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}];qg("Set",(function(e){return function(){return e(this,arguments.length?arguments[0]:void 0)}}),dy);var JM=ee.Set;Rr({target:"Set",stat:!0,forced:!0},{from:yy}),Rr({target:"Set",stat:!0,forced:!0},{of:by});var ZM=O,$M=we,eN=tr,tN=function(){for(var e=eN(this),t=$M(e.add),r=0,n=arguments.length;r<n;r++)ZM(t,e,arguments[r]);return e};Rr({target:"Set",proto:!0,real:!0,forced:!0},{addAll:tN}),Rr({target:"Set",proto:!0,real:!0,forced:!0},{deleteAll:Iy});var rN=mh,nN=tr,iN=Wt,oN=rN,aN=Dh;Rr({target:"Set",proto:!0,real:!0,forced:!0},{every:function(e){var t=nN(this),r=oN(t),n=iN(e,arguments.length>1?arguments[1]:void 0);return!aN(r,(function(e,r){if(!n(e,e,t))return r()}),{IS_ITERATOR:!0,INTERRUPTED:!0}).stopped}});var sN=oe,cN=O,uN=we,dN=tr,lN=Tv,hN=Dh;Rr({target:"Set",proto:!0,real:!0,forced:!0},{difference:function(e){var t=dN(this),r=new(lN(t,sN("Set")))(t),n=uN(r.delete);return hN(e,(function(e){cN(n,r,e)})),r}});var vN=oe,pN=O,_N=we,fN=tr,mN=Wt,gN=Tv,yN=rN,SN=Dh;Rr({target:"Set",proto:!0,real:!0,forced:!0},{filter:function(e){var t=fN(this),r=yN(t),n=mN(e,arguments.length>1?arguments[1]:void 0),i=new(gN(t,vN("Set"))),o=_N(i.add);return SN(r,(function(e){n(e,e,t)&&pN(o,i,e)}),{IS_ITERATOR:!0}),i}});var bN=tr,EN=Wt,kN=rN,TN=Dh;Rr({target:"Set",proto:!0,real:!0,forced:!0},{find:function(e){var t=bN(this),r=kN(t),n=EN(e,arguments.length>1?arguments[1]:void 0);return TN(r,(function(e,r){if(n(e,e,t))return r(e)}),{IS_ITERATOR:!0,INTERRUPTED:!0}).result}});var IN=oe,AN=O,RN=we,CN=tr,wN=Tv,xN=Dh;Rr({target:"Set",proto:!0,real:!0,forced:!0},{intersection:function(e){var t=CN(this),r=new(wN(t,IN("Set"))),n=RN(t.has),i=RN(r.add);return xN(e,(function(e){AN(n,t,e)&&AN(i,r,e)})),r}});var ON=O,PN=we,MN=tr,NN=Dh;Rr({target:"Set",proto:!0,real:!0,forced:!0},{isDisjointFrom:function(e){var t=MN(this),r=PN(t.has);return!NN(e,(function(e,n){if(!0===ON(r,t,e))return n()}),{INTERRUPTED:!0}).stopped}});var DN=oe,LN=O,UN=we,VN=A,FN=tr,BN=mh,jN=Dh;Rr({target:"Set",proto:!0,real:!0,forced:!0},{isSubsetOf:function(e){var t=BN(this),r=FN(e),n=r.has;return VN(n)||(r=new(DN("Set"))(e),n=UN(r.has)),!jN(t,(function(e,t){if(!1===LN(n,r,e))return t()}),{IS_ITERATOR:!0,INTERRUPTED:!0}).stopped}});var GN=O,HN=we,zN=tr,XN=Dh;Rr({target:"Set",proto:!0,real:!0,forced:!0},{isSupersetOf:function(e){var t=zN(this),r=HN(t.has);return!XN(e,(function(e,n){if(!1===GN(r,t,e))return n()}),{INTERRUPTED:!0}).stopped}});var KN=Rr,qN=tr,YN=gn,WN=rN,QN=Dh,JN=E([].join),ZN=[].push;KN({target:"Set",proto:!0,real:!0,forced:!0},{join:function(e){var t=qN(this),r=WN(t),n=void 0===e?",":YN(e),i=[];return QN(r,ZN,{that:i,IS_ITERATOR:!0}),JN(i,n)}});var $N=oe,eD=Wt,tD=O,rD=we,nD=tr,iD=Tv,oD=rN,aD=Dh;Rr({target:"Set",proto:!0,real:!0,forced:!0},{map:function(e){var t=nD(this),r=oD(t),n=eD(e,arguments.length>1?arguments[1]:void 0),i=new(iD(t,$N("Set"))),o=rD(i.add);return aD(r,(function(e){tD(o,i,n(e,e,t))}),{IS_ITERATOR:!0}),i}});var sD=we,cD=tr,uD=rN,dD=Dh,lD=TypeError;Rr({target:"Set",proto:!0,real:!0,forced:!0},{reduce:function(e){var t=cD(this),r=uD(t),n=arguments.length<2,i=n?void 0:arguments[1];if(sD(e),dD(r,(function(r){n?(n=!1,i=r):i=e(i,r,r,t)}),{IS_ITERATOR:!0}),n)throw lD("Reduce of empty set with no initial value");return i}});var hD=tr,vD=Wt,pD=rN,_D=Dh;Rr({target:"Set",proto:!0,real:!0,forced:!0},{some:function(e){var t=hD(this),r=pD(t),n=vD(e,arguments.length>1?arguments[1]:void 0);return _D(r,(function(e,r){if(n(e,e,t))return r()}),{IS_ITERATOR:!0,INTERRUPTED:!0}).stopped}});var fD=oe,mD=O,gD=we,yD=tr,SD=Tv,bD=Dh;Rr({target:"Set",proto:!0,real:!0,forced:!0},{symmetricDifference:function(e){var t=yD(this),r=new(SD(t,fD("Set")))(t),n=gD(r.delete),i=gD(r.add);return bD(e,(function(e){mD(n,r,e)||mD(i,r,e)})),r}});var ED=oe,kD=we,TD=tr,ID=Tv,AD=Dh;Rr({target:"Set",proto:!0,real:!0,forced:!0},{union:function(e){var t=TD(this),r=new(ID(t,ED("Set")))(t);return AD(e,kD(r.add),{that:r}),r}});var RD=JM,CD=function(){var e=Tm(Em().mark((function e(){return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(e.prev=0,!iP()&&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,UD();case 5:if(e.t0=e.sent,!e.t0){e.next=10;break}return e.next=9,LD();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)}}(),wD=function(){var e=Tm(Em().mark((function e(){var t;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=[],e.next=3,UD();case 3:if(e.t0=e.sent,!e.t0){e.next=8;break}return e.next=7,LD();case 7:e.t0=e.sent;case 8:if(!e.t0){e.next=10;break}t.push("H264");case 10:return e.next=12,FD();case 12:if(e.t1=e.sent,!e.t1){e.next=17;break}return e.next=16,VD();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)}}(),xD=function(){var e=Tm(Em().mark((function e(){var t;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,wD();case 2:return t=e.sent,e.abrupt("return",Fm(t).call(t,(function(e){return e.toUpperCase()})));case 4:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),OD={};function PD(e){var t,r=!1,n=JT(e.split("\n"));try{for(n.s();!(t=n.n()).done;){var i=t.value;if(_k(i).call(i,"level-asymmetry-allowed=1")&&_k(i).call(i,"packetization-mode=1")&&_k(i).call(i,"profile-level-id=42e0")){r=!0;break}}}catch(d){n.e(d)}finally{n.f()}if(r){for(var o=navigator.userAgent.toLowerCase(),a=!1,s=0,c=["miuibrowser"];s<c.length;s++){var u=c[s];_k(o).call(o,u)&&(a=!0)}return!a}return!1}var MD=function(){var e=Tm(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({sdpSemantics:"unified-plan"})).addTransceiver("video",{direction:t}),e.next=4,r.createOffer();case 4:return n=e.sent,r.close(),e.abrupt("return",n.sdp.toLowerCase());case 7:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),ND=function(){var e=Tm(Em().mark((function e(){var t,r;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,MD("sendonly");case 2:if(r=e.sent,!_k(t=navigator.userAgent).call(t,"VivoBrowser")){e.next=7;break}return e.next=6,MD("sendonly");case 6:r=e.sent;case 7:return OD.h264encode=PD(r),OD.vp8encode=CE(r).call(r,"vp8")>-1,e.abrupt("return",OD);case 10:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),DD=function(){var e=Tm(Em().mark((function e(){var t,r;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,MD("recvonly");case 2:if(r=e.sent,!_k(t=navigator.userAgent).call(t,"VivoBrowser")){e.next=7;break}return e.next=6,MD("recvonly");case 6:r=e.sent;case 7:return OD.h264decode=PD(r),OD.vp8decode=CE(r).call(r,"vp8")>-1,e.abrupt("return",OD);case 10:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),LD=function(){var e=Tm(Em().mark((function e(){return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(void 0!==OD.h264encode){e.next=9;break}return e.prev=1,e.next=4,ND();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",OD.h264encode||!1);case 10:case"end":return e.stop()}}),e,null,[[1,6]])})));return function(){return e.apply(this,arguments)}}(),UD=function(){var e=Tm(Em().mark((function e(){return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(void 0!==OD.h264decode){e.next=9;break}return e.prev=1,e.next=4,DD();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",OD.h264decode||!1);case 10:case"end":return e.stop()}}),e,null,[[1,6]])})));return function(){return e.apply(this,arguments)}}(),VD=function(){var e=Tm(Em().mark((function e(){return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(void 0!==OD.vp8encode){e.next=9;break}return e.prev=1,e.next=4,ND();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",OD.vp8encode||!1);case 10:case"end":return e.stop()}}),e,null,[[1,6]])})));return function(){return e.apply(this,arguments)}}(),FD=function(){var e=Tm(Em().mark((function e(){return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(void 0!==OD.vp8decode){e.next=9;break}return e.prev=1,e.next=4,DD();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",OD.vp8decode||!1);case 10:case"end":return e.stop()}}),e,null,[[1,6]])})));return function(){return e.apply(this,arguments)}}(),BD=function(){return"undefined"!=typeof TransformStream&&"undefined"!=typeof RTCRtpSender&&"undefined"!=typeof RTCRtpReceiver&&void 0!==RTCRtpSender.prototype.createEncodedStreams&&void 0!==RTCRtpReceiver.prototype.createEncodedStreams},jD=function(){return hP?uP&&AP>=70||sP&&EP>=80||cP&&bP>=14:mP?uP&&AP>=70||sP&&EP>=80:_P?kP[0]>=14:!!fP&&(uP&&AP>=86)},GD=uP&&AP<114,HD=new JS,zD=function(){var e=Tm(Em().mark((function e(t){return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",new qf((function(e,r){var n=jP("STATS_SCALLBACK_SUPPORT");if(uP&&void 0===window.InstallTrigger&&GD&&n)try{t.getStats((function(t){var r=[];t.result().forEach((function(e){if(!_k(YD).call(YD,e.type)){var t={};e.names().forEach((function(r){t[r]=e.stat(r)})),r.push(Zd(Zd({},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(TK){r(TK)}else e({all:[],getTrackStats:function(){return[]}})})));case 1:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),XD=function(){var e=Tm(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 e.next=2,t.getStats();case 2:return n=e.sent,i={all:[]},o=new JS,n.forEach((function(e){var t=o.get(e.type)||new JS;t.set(e.id,e),o.set(e.type,t),i.all.push(e)})),a=function(e,t){e.forEach((function(e){var r,n,i,a,s,c,u=e.codecId,d=e.transportId,l=e.trackId,h=e.playoutId;if(null===(r=o.get(qD.codec))||void 0===r||r.forEach((function(e){e.id===u&&t.add(e)})),null===(n=o.get(qD.transport))||void 0===n||n.forEach((function(e){e.id===d&&(s=e,t.add(e))})),null===(i=o.get(qD.track))||void 0===i||i.forEach((function(e){e.id===l&&t.add(e)})),null===(a=o.get(qD.mediaPlayout))||void 0===a||a.forEach((function(e){e.id===h&&t.add(e)})),s){var v,p,_=s,f=_.localCertificateId,m=_.remoteCertificateId,g=_.selectedCandidatePairId;null===(v=o.get(qD.certificate))||void 0===v||v.forEach((function(e){(e.id===f||e.id===m)&&t.add(e)})),null===(p=o.get(qD.candidatePair))||void 0===p||p.forEach((function(e){e.id===g&&(c=e,t.add(e))}))}if(c){var y,S,b=c,E=b.localCandidateId,k=b.remoteCandidateId;null===(y=o.get(qD.localCandidate))||void 0===y||y.forEach((function(e){e.id===E&&t.add(e)})),null===(S=o.get(qD.remoteCandidate))||void 0===S||S.forEach((function(e){e.id===k&&t.add(e)}))}}))},o.get(qD.mediaSource)?null===(s=o.get(qD.mediaSource))||void 0===s||s.forEach((function(e){var t,r=new RD;r.add(e);var n=[];null===(t=o.get(qD.outboundRtp))||void 0===t||t.forEach((function(t){var i;t.mediaSourceId===e.id&&(r.add(t),n.push(t),null===(i=o.get(qD.remoteInboundRtp))||void 0===i||i.forEach((function(e){e.localId===t.id&&r.add(e)})))})),a(n,r),i[e.trackIdentifier]=Kk(r)})):o.get(qD.track)&&(null===(c=o.get(qD.track))||void 0===c||c.forEach((function(e){var t,r=new RD;r.add(e);var n=[];null===(t=o.get(qD.outboundRtp))||void 0===t||t.forEach((function(t){var i;t.trackId===e.id&&(r.add(t),n.push(t),null===(i=o.get(qD.remoteInboundRtp))||void 0===i||i.forEach((function(e){e.localId===t.id&&r.add(e)})))})),a(n,r),i[e.trackIdentifier]=Kk(r)}))),null===(r=o.get(qD.inboundRtp))||void 0===r||r.forEach((function(e){var t,r=new RD;r.add(e),null===(t=o.get(qD.remoteOutboundRtp))||void 0===t||t.forEach((function(t){t.localId===e.id&&r.add(t)})),a([e],r);var n,s=e.trackIdentifier;s||(null===(n=o.get(qD.track))||void 0===n||n.forEach((function(t){t.id===e.trackId&&(s=t.trackIdentifier)})));i[s]=Kk(r)})),e.abrupt("return",i);case 10:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),KD=function(){var e=Tm(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(!sP&&!cP){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=HD.get(t))||Date.now()-a.timestamp>150)&&(a={timestamp:Date.now(),statsPromise:XD(t),extraStatsPromise:zD(t)},HD.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)}}(),qD=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}(qD||{}),YD=["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"],WD={},QD={},JD={exports:{}},ZD=JD.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(ZD).forEach((function(e){ZD[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=JD.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=bm(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 lb(t=e.split(/;\s?/)).call(t,o,{})},e.parseFmtpConfig=e.parseParams,e.parsePayloads=function(e){var t;return Fm(t=e.toString().split(" ")).call(t,Number)},e.parseRemoteCandidates=function(e){for(var r,n=[],i=Fm(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 Fm(t=e.split(" ")).call(t,(function(e){var t;return lb(t=e.substring(1,e.length-1).split(",")).call(t,o,{})}))},e.parseSimulcastStreamList=function(e){var r;return Fm(r=e.split(";")).call(r,(function(e){var r;return Fm(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}}))}))}}(QD);var $D=JD.exports,eL=/%[sdv%]/g,tL=function(e){var t=1,r=arguments,n=r.length;return e.replace(eL,(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""}}))},rL=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 tL.apply(null,n)},nL=["v","o","s","i","u","e","p","c","b","t","r","z","a"],iL=["i","c","b","a"],oL=QD,aL=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||nL,n=t.innerOrder||iL,i=[];return r.forEach((function(t){$D[t].forEach((function(r){r.name in e&&null!=e[r.name]?i.push(rL(t,r,e)):r.push in e&&null!=e[r.push]&&e[r.push].forEach((function(e){i.push(rL(t,r,e))}))}))})),e.media.forEach((function(e){i.push(rL("m",$D.m[0],e)),n.forEach((function(t){$D[t].forEach((function(r){r.name in e&&null!=e[r.name]?i.push(rL(t,r,e)):r.push in e&&null!=e[r.push]&&e[r.push].forEach((function(e){i.push(rL(t,r,e))}))}))}))})),i.join("\r\n")+"\r\n"};WD.write=aL,WD.parse=oL.parse,WD.parseParams=oL.parseParams,WD.parseFmtpConfig=oL.parseFmtpConfig,WD.parsePayloads=oL.parsePayloads,WD.parseRemoteCandidates=oL.parseRemoteCandidates,WD.parseImageAttributes=oL.parseImageAttributes,WD.parseSimulcastStreamList=oL.parseSimulcastStreamList;var sL=new cO("FirefoxHandler",3),cL=Math.pow(2,32),uL="kp34Za0H+aVf862l",dL="o/i14u9pJrxRKAsu",lL=function(){return Math.floor(Math.random()*cL+1e4)};function hL(e){return e>cL-18?(sL.print("generateAllSsrc","reset start id",e),hL(e=e-cL+1e4+18)):{audio:e,audioFec:e+1,audioRtx:e+2,video:e+3,videoFec:e+4,videoRtx:e+5,next:e+18}}var vL=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)}]},pL=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=lb(s).call(s,(function(t,r){return wm(t).call(t,vL(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 _L(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=Zd(Zd({},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,WD.write(i)};function mL(e,t){return gL.apply(this,arguments)}function gL(){return(gL=Tm(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:return n={},i=r.publicIPs,o=r.certFingerprint,a=r.iceParams,s=r.iceConfig,n.fingerprint={type:"sha-256",hash:o},n.icePwd=a.serverIcePwd,e.next=6,SL(a.serverIceUfrag);case 6:return n.iceUfrag=e.sent,n.candidates=yL(i,s),n.setup="active",n.iceOptions="renomination",e.abrupt("return",n);case 11:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function yL(e,t){if(!Array.isArray(e))return[];var r=0,n=2130706431,i=[];return e.forEach((function(e){var o={component:1,ip:e.ip,type:"host",generation:e.generation};e.udpPorts&&!t.tcpOnly&&e.udpPorts.forEach((function(e){i.push(Zd(Zd({},o),{},{foundation:r++,transport:"udp",port:e,priority:n}))})),e.tcpPorts&&e.tcpPorts.forEach((function(e){i.push(Zd(Zd({},o),{},{foundation:r++,transport:"tcp",port:e,tcptype:"passive",priority:2130705431}))}))})),i}var SL=function(){var e=Tm(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,NO.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=MO(Uint8Array,n,i,o,a),e.next=15,NO.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)}}(),bL=function(e,t){var r=0;if(Array.isArray(e.fmtp)&&Array.isArray(e.rtp)){var n,i=JT(e.fmtp);try{for(i.s();!(n=i.n()).done;){var o,a,s,c=n.value;if(_k(o=c.config).call(o,"level-asymmetry-allowed=1")&&_k(a=c.config).call(a,"packetization-mode=1")&&_k(s=c.config).call(s,"profile-level-id=42e0")){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(ek(l=e.rtp).call(l,u,1)[0]);break}}else if(d.codec===t){var h;e.rtp.unshift(ek(h=e.rtp).call(h,u,1)[0]);break}}var v=[];e.rtp.forEach((function(e){return v.push(e.payload)})),e.payloads=v.join(" ")}},EL=new cO("BasicHandler",3),kL={iceServers:[],iceTransportPolicy:"all",bundlePolicy:"max-bundle",rtcpMuxPolicy:"require",sdpSemantics:"unified-plan",encodedInsertableStreams:!!BD()||void 0},TL=function(e){OI(o,e);var t,r,n,i=YI(o);function o(e){var t,r=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return Ll(this,o),Qd($T(t=i.call(this)),"_peerConnection",void 0),Qd($T(t),"_dataChannel",void 0),Qd($T(t),"_context",void 0),Qd($T(t),"peerConnectionMode",0),Qd($T(t),"peerConnectionId",""),Qd($T(t),"id",void 0),Qd($T(t),"_monitor",void 0),Qd($T(t),"_offerIce",{}),Qd($T(t),"_answerIce",{}),Qd($T(t),"_initSctpEvents",!1),Qd($T(t),"_nextSsrc",lL()),Qd($T(t),"_aSendonlyAnswerTpl",void 0),Qd($T(t),"_vSendonlyAnswerTpl",void 0),Qd($T(t),"_enableSubFlexfec",!1),Qd($T(t),"audioTrack4ff",void 0),Qd($T(t),"_connectionId",void 0),t.id=e.id,t._monitor=kO(t.id),t._peerConnection=new RTCPeerConnection(kL),r&&(t._dataChannel=t._peerConnection.createDataChannel("signaling",{negotiated:!0,id:100}),t._dataChannel.binaryType="arraybuffer"),t._context=e,t._peerConnection.ontrack=function(e){var r,n,i,o,a=null===(r=e.streams)||void 0===r||null===(n=r[0])||void 0===n?void 0:n.id;EL.print(t.peerConnectionId||"",wm(i=wm(o="pc.ontrack ".concat(e.track.kind," ")).call(o,e.track.id," ")).call(i,a)),"ff-stream"===a&&(t.audioTrack4ff=e.track),t.emit("ontrack",e)},t._peerConnection.onconnectionstatechange=function(e){var r;EL.print(t.peerConnectionId||"",wm(r="onconnectionstatechange ".concat(t._peerConnection.iceConnectionState," -> ")).call(r,t._peerConnection.connectionState)),"failed"!==t._peerConnection.iceConnectionState&&"closed"!==t._peerConnection.iceConnectionState&&"failed"!==t._peerConnection.connectionState||t.emit("disconnect")},t._peerConnection.oniceconnectionstatechange=function(){var e=t._peerConnection.iceConnectionState;t._report("rtc_pre_ice_state",{message:e,ice_state:e.toUpperCase()}),t.emit("ice_state",e)},t}return Dl(o,[{key:"getConnectionId",value:function(){return this._connectionId}},{key:"disconnect",value:function(){var e;this._peerConnection.close(),null===(e=this._dataChannel)||void 0===e||e.close(),this._peerConnection.ontrack=null}},{key:"destroy",value:function(){EL.print("destroy",this.peerConnectionId||""),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),EL.print("simulcast() ","simulcastLayers: %o",c)):(c=Fm(o=bm(a=bm(s=e.videoEncodeConfig).call(s,1)).call(a,1-i)).call(o,(function(e){var r=nP(e.width),n=t.width/r;return{width:r,height:Math.floor(t.height/n),scaleResolutionDownBy:n,frameRate:nP(e.frameRate)||15,maxkbps:e.maxKbps||600}})),EL.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=Zd({},HP);if(l){var v=null==l?void 0:l.getSettings();h={width:Math.floor(v.width),height:Math.floor(v.height),frameRate:Math.floor(v.frameRate)}}"number"!=typeof h.frameRate&&(h.frameRate=30);var p=null==e?void 0:e.videoEncodeConfig[0],_={maxBitrate:1e3*p.maxKbps,rid:"0"};if(e.prevBitrate=p.maxKbps,c.sendEncodings=[_],u.push({width:h.width,height:h.height,framerate:h.frameRate,maxkbps:p.maxKbps,rid:"0"}),!sP&&i){var f,m,g=function(e){for(var t=0,r=e.width*e.height,n=0;n<QM.length;n++)if(r>=QM[n].totalPixels){t=n;break}if(0===t)return QM[t].maxLayers;var i=QM[t-1].totalPixels;return(i-r)/(i-QM[t].totalPixels)<.1?QM[t-1].maxLayers:QM[t].maxLayers}(h);if(EL.print("simulcast() ","maxLayers: %o",g),g>1)this._simulcast(e,Zd(Zd({},h),{},{maxKbps:p.maxKbps}),c,u,g),null!==(f=this._context)&&void 0!==f&&null!==(m=f.serverConfig)&&void 0!==m&&m.simulcastOnDemand&&(d=Fm(u).call(u,(function(e,t){return Zd(Zd({},e),{},{video_index:t,sub_index:t})})))}}EL.print("publish videoTransceiverInit videoDescriptions","",c,u);var y=null==n?void 0:n.getTrack("preprocessing");(null==n?void 0:n.mixType)!==xl.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._reportRtcInvokeStatus("Handler.internalPublish",Mm({aTrack:$O(y),vTrack:$O(S),audioTransceiverInit:s,videoTransceiverInit:c}))}catch(TK){}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;EL.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 EL.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:Fm(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._reportRtcInvokeStatus("Handler.updateScaleResolutionDownBy",Mm(c.encodings))}catch(TK){}}}else EL.print("updateMaxBitrate()","no pub")}},{key:"getStats",value:function(e,t){return KD(this._peerConnection,e,t)}},{key:"setLocalDescription",value:(n=Tm(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=PO(),e.prev=1,e.next=4,this._peerConnection.setLocalDescription(new RTCSessionDescription({type:"offer",sdp:t}));case 4:this._report("rtc_set_description",{error_code:0,message:t,is_local:"1",direction:"local"===(null==r?void 0:r.streamUserId)?"up":"down",stream_id:(null==r?void 0:r.streamId)||"",stream_user_id:(null==r?void 0:r.streamUserId)||"",elapse:PO()-n},{type:"offer"}),this._initSctpEvents||(this._initSctpEvents=!0,(o=null===(i=this._peerConnection)||void 0===i?void 0:i.sctp)&&(o.onstatechange=function(){a._reportRtcInvokeStatus("sctp","sctp state change TO: ".concat(o.state))},o.transport&&(o.transport.onstatechange=function(){var e;a._reportRtcInvokeStatus("dtls","dtls state change TO: ".concat(null==o||null===(e=o.transport)||void 0===e?void 0:e.state))}))),e.next=12;break;case 8:e.prev=8,e.t0=e.catch(1),console.error("setLocal",e.t0),this._report("rtc_set_description",{error_code:-1,message:e.t0.message+t,is_local:"1",direction:"local"===(null==r?void 0:r.streamUserId)?"up":"down",stream_id:"",stream_user_id:"",elapse:PO()-n},{type:"offer"});case 12:case"end":return e.stop()}}),e,this,[[1,8]])}))),function(e,t){return n.apply(this,arguments)})},{key:"setRemoteDescription",value:(r=Tm(Em().mark((function e(t,r){var n;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=PO(),e.prev=1,e.next=4,this._peerConnection.setRemoteDescription(new RTCSessionDescription({type:"answer",sdp:t}));case 4:this._report("rtc_set_description",{error_code:0,message:t,is_local:"0",direction:"local"===(null==r?void 0:r.streamUserId)?"up":"down",stream_id:(null==r?void 0:r.streamId)||"",stream_user_id:(null==r?void 0:r.streamUserId)||"",elapse:PO()-n},{type:"answer"}),e.next=11;break;case 7:e.prev=7,e.t0=e.catch(1),console.error("setRemote",e.t0),this._report("rtc_set_description",{error_code:-1,message:e.t0.message+t,is_local:"0",direction:"local"===(null==r?void 0:r.streamUserId)?"up":"down",stream_id:(null==r?void 0:r.streamId)||"",stream_user_id:(null==r?void 0:r.streamUserId)||"",elapse:PO()-n},{type:"answer"});case 11:case"end":return e.stop()}}),e,this,[[1,7]])}))),function(e,t){return r.apply(this,arguments)})},{key:"setCurrentDescription",value:(t=Tm(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;WD.parse(e).media.forEach((function(e){if("audio"===e.type){if("sendonly"===e.direction){var r,n=null==e?void 0:mE(r=e.rtp).call(r,(function(e){return"opus"===e.codec}));if(n&&null!=e&&e.fmtp){var i,o=null==e?void 0:mE(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&&_k(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(_k(n=["vp8","h264"]).call(n,i.toLocaleLowerCase())){var a,s,c=mE(a=e.fmtp).call(a,(function(e){return e.payload===o}));if(c)c.config=wm(s=[]).call(s,Yk(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)})}}))}},{key:"_report",value:function(e,t,r){var n;null===(n=this._monitor)||void 0===n||n.report(e,Zd(Zd({},t),{},{connection_id:this._connectionId}),r)}},{key:"_reportRtcInvokeStatus",value:function(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?arguments[4]:void 0;this._report("rtc_invoke_status",{sdk_api_name:e,message:t,error_code:r,stream_id:n,elapse:0},i)}}]),o}(vM.exports.EventEmitter),IL=E,AL=Wg,RL=cg.exports.getWeakData,CL=_v,wL=tr,xL=z,OL=$,PL=Dh,ML=We,NL=Zi.set,DL=Zi.getterFor,LL=No.find,UL=No.findIndex,VL=IL([].splice),FL=0,BL=function(e){return e.frozen||(e.frozen=new jL)},jL=function(){this.entries=[]},GL=function(e,t){return LL(e.entries,(function(e){return e[0]===t}))};jL.prototype={get:function(e){var t=GL(this,e);if(t)return t[1]},has:function(e){return!!GL(this,e)},set:function(e,t){var r=GL(this,e);r?r[1]=t:this.entries.push([e,t])},delete:function(e){var t=UL(this.entries,(function(t){return t[0]===e}));return~t&&VL(this.entries,t,1),!!~t}};var HL,zL={getConstructor:function(e,t,r,n){var i=e((function(e,i){CL(e,o),NL(e,{type:t,id:FL++,frozen:void 0}),xL(i)||PL(i,e[n],{that:e,AS_ENTRIES:r})})),o=i.prototype,a=DL(t),s=function(e,t,r){var n=a(e),i=RL(wL(t),!0);return!0===i?BL(n).set(t,r):i[n.id]=r,e};return AL(o,{delete:function(e){var t=a(this);if(!OL(e))return!1;var r=RL(e);return!0===r?BL(t).delete(e):r&&ML(r,t.id)&&delete r[t.id]},has:function(e){var t=a(this);if(!OL(e))return!1;var r=RL(e);return!0===r?BL(t).has(e):r&&ML(r,t.id)}}),AL(o,r?{get:function(e){var t=a(this);if(OL(e)){var r=RL(e);return!0===r?BL(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}},XL=n,KL=E,qL=Wg,YL=cg.exports,WL=qg,QL=zL,JL=$,ZL=_g,$L=Zi.enforce,eU=Vi,tU=!XL.ActiveXObject&&"ActiveXObject"in XL,rU=function(e){return function(){return e(this,arguments.length?arguments[0]:void 0)}},nU=WL("WeakMap",rU,QL);if(eU&&tU){HL=QL.getConstructor(rU,"WeakMap",!0),YL.enable();var iU=nU.prototype,oU=KL(iU.delete),aU=KL(iU.has),sU=KL(iU.get),cU=KL(iU.set);qL(iU,{delete:function(e){if(JL(e)&&!ZL(e)){var t=$L(this);return t.frozen||(t.frozen=new HL),oU(this,e)||t.frozen.delete(e)}return oU(this,e)},has:function(e){if(JL(e)&&!ZL(e)){var t=$L(this);return t.frozen||(t.frozen=new HL),aU(this,e)||t.frozen.has(e)}return aU(this,e)},get:function(e){if(JL(e)&&!ZL(e)){var t=$L(this);return t.frozen||(t.frozen=new HL),aU(this,e)?sU(this,e):t.frozen.get(e)}return sU(this,e)},set:function(e,t){if(JL(e)&&!ZL(e)){var r=$L(this);r.frozen||(r.frozen=new HL),aU(this,e)?cU(this,e,t):r.frozen.set(e,t)}else cU(this,e,t);return this}})}var uU=ee.WeakMap;Rr({target:"WeakMap",proto:!0,real:!0,forced:!0},{emplace:wy}),Rr({target:"WeakMap",stat:!0,forced:!0},{from:yy}),Rr({target:"WeakMap",stat:!0,forced:!0},{of:by}),Rr({target:"WeakMap",proto:!0,real:!0,forced:!0},{deleteAll:Iy}),Rr({target:"WeakMap",proto:!0,real:!0,forced:!0},{upsert:QS});var dU=uU,lU=function(e){OI(v,e);var t,r,n,i,o,a,s,c,u,d,l,h=YI(v);function v(){var e,t,r;return Ll(this,v),Qd($T(r=h.call(this)),"inited",!1),Qd($T(r),"deviceMap",{audioinput:new JS,audiooutput:new JS,videoinput:new JS}),Qd($T(r),"checkDeviceChangeTimer",null),Qd($T(r),"isSupportedPermissionsQuery",!1),Qd($T(r),"isGrantedMicrophonePermission",!1),Qd($T(r),"isGrantedCameraPermission",!1),r.isSupportedPermissionsQuery=!iP()&&!(null===(e=navigator)||void 0===e||null===(t=e.permissions)||void 0===t||!t.query),r._handleDeviceChange=r._handleDeviceChange.bind($T(r)),!iP()&&r.refreshDevices(),r}return Dl(v,[{key:"refreshDevices",value:(l=Tm(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,!sP){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=Tm(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=Tm(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,!sP){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=Kk(wm(t=[]).call(t,Yk(rA(r=this.deviceMap.audioinput).call(r)),Yk(rA(n=this.deviceMap.videoinput).call(n)),Yk(rA(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||(_k(t=e.kind).call(t,"video")?c.emit(Ml.onVideoDeviceStateChanged,{mediaDeviceInfo:e,deviceState:"active"}):_k(r=e.kind).call(r,"audio")&&c.emit(Ml.onAudioDeviceStateChanged,{mediaDeviceInfo:e,deviceState:"active"}))})),s.forEach((function(e){var t,r;mE(a).call(a,(function(t){return t.deviceId===e.deviceId&&t.kind===e.kind}))||(c.deviceMap[e.kind].delete(e.deviceId),_k(t=e.kind).call(t,"video")?c.emit(Ml.onVideoDeviceStateChanged,{mediaDeviceInfo:e,deviceState:"inactive"}):_k(r=e.kind).call(r,"audio")&&c.emit(Ml.onAudioDeviceStateChanged,{mediaDeviceInfo:e,deviceState:"inactive"}))}));case 13:case"end":return e.stop()}}),e,this)}))),function(){return u.apply(this,arguments)})},{key:"getUserMedia",value:(c=Tm(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=Tm(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=Tm(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=Tm(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",Kk(wm(t=[]).call(t,Yk(rA(r=this.deviceMap.audioinput).call(r)),Yk(rA(n=this.deviceMap.videoinput).call(n)),Yk(rA(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=Tm(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",Kk(rA(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=Tm(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",Kk(rA(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=Tm(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",Kk(rA(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=Tm(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",mE(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)})}]),v}(fM),hU=new lU;!iP()&&(window.__rtc_dd__=hU);var vU=new cO("AudioContext",1),pU=function(){function e(){var t=this;Ll(this,e),Qd(this,"_audioContextInstance",void 0),Qd(this,"_contextStuckAt",0);var r=0;iP()||setInterval((function(){if(t._audioContextInstance){var e=t._audioContextInstance.currentTime;t._contextStuckAt?t._contextStuckAt!==e&&(t._contextStuckAt=0,vU.print("currentTime resume"),bO("currentTime resume","")):e&&r===e&&(t._contextStuckAt=e,vU.print("currentTime stuck",t._contextStuckAt),t._audioContextInstance.suspend(),t._audioContextInstance.resume(),bO("AudioContext currentTime stuck",t._contextStuckAt)),r=e}}),3e3)}return Dl(e,[{key:"getAudioContextInstance",value:function(){var e=this;if(!this._audioContextInstance){var t=window.AudioContext||window.webkitAudioContext;this._audioContextInstance=new t,this._audioContextInstance.onstatechange=function(){var t,r;vU.print("state change",null===(t=e._audioContextInstance)||void 0===t?void 0:t.state),"interrupted"===(null===(r=e._audioContextInstance)||void 0===r?void 0:r.state)&&e._audioContextInstance.resume()}}return this._audioContextInstance}}]),e}(),_U=function(){function e(t){Ll(this,e),Qd(this,"_ctx",void 0),Qd(this,"_analyserNode",void 0),Qd(this,"_audioSource",void 0);var r=fU.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 Dl(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=Tm(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}(),fU=new pU,mU=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}(mU||{}),gU=function(){function e(t){Ll(this,e),Qd(this,"_plugins",new JS),this.id=t}var t;return Dl(e,[{key:"register",value:function(e){var t=this._plugins.get(e.type)||[];if(YA(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 mE(r=this._plugins.get(e)||[]).call(r,(function(e){return e.name===t}))}},{key:"getPreProcessingTrack",value:(t=Tm(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=JT(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}(),yU=function(e){return e[e.EXTERNAL=0]="EXTERNAL",e[e.INTERNAL=1]="INTERNAL",e}(yU||{}),SU=new cO("VERTC",0),bU=new dU,EU=function(e){OI(r,e);var t=YI(r);function r(e,n){var i;return Ll(this,r),Qd($T(i=t.call(this)),"sourceType",1),Qd($T(i),"mediaType",void 0),Qd($T(i),"_trackId",void 0),Qd($T(i),"_ac",void 0),Qd($T(i),"_sourceNode",void 0),Qd($T(i),"_gainNode",void 0),Qd($T(i),"_destNode",void 0),Qd($T(i),"_channelCount",void 0),i._trackId=e,i.mediaType=n,"audio"===n&&jD()&&!jP("SKIP_WEB_AUDIO_IN_TRACK")&&(i._ac=fU.getAudioContextInstance(),i._gainNode=i._ac.createGain(),i._destNode=i._ac.createMediaStreamDestination(),i._gainNode.connect(i._destNode)),i}return Dl(r,[{key:"getId",value:function(){return this._trackId}},{key:"setVolume",value:function(e){this._gainNode&&(this._gainNode.gain.value=e/100)}},{key:"getVolume",value:function(){return this._gainNode?Math.round(100*this._gainNode.gain.value):-1}},{key:"channelCount",get:function(){var e;return null!==(e=this._channelCount)&&void 0!==e?e:0}},{key:"connectAudioTrack",value:function(e){var t;if(this._channelCount=e.getSettings().channelCount,!jD()||jP("SKIP_WEB_AUDIO_IN_TRACK"))return e;this._sourceNode&&(this._sourceNode.mediaStream.getTracks().forEach((function(e){e.stop()})),delete this._sourceNode);var r,n=new MediaStream;(n.addTrack(e),this._sourceNode=null===(t=this._ac)||void 0===t?void 0:t.createMediaStreamSource(n),this._gainNode)&&(null===(r=this._sourceNode)||void 0===r||r.connect(this._gainNode));return this._destNode.stream.getTracks()[0]}},{key:"destroy",value:function(){var e,t,r,n;(null===(e=this._sourceNode)||void 0===e||e.mediaStream.getTracks().forEach((function(e){e.stop()})),13!==bP)&&(null===(n=this._destNode)||void 0===n||n.stream.getTracks().forEach((function(e){e.stop()})));null===(t=this._sourceNode)||void 0===t||t.disconnect(),null===(r=this._gainNode)||void 0===r||r.disconnect(),delete this._sourceNode,delete this._gainNode,delete this._destNode}}]),r}(fM),kU=function(e){OI(n,e);var t,r=YI(n);function n(e,t,i){var o;return Ll(this,n),Qd($T(o=r.call(this,t,i)),"_mediaTrack",void 0),Qd($T(o),"_preProcessingTrack",void 0),Qd($T(o),"_originTrack",void 0),Qd($T(o),"handleTrackEnded",(function(){o.emit("track-ended",$T(o)),o.close()})),Qd($T(o),"handleMute",(function(){o.emit("track-mute",$T(o))})),Qd($T(o),"handleUnmute",(function(){o.emit("track-unmute",$T(o))})),o._mediaTrack="audio"===o.mediaType?o.connectAudioTrack(e):e,o._originTrack=e,o._initListeners(),o}return Dl(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="audio"===this.mediaType?this.connectAudioTrack(e):e,this._originTrack=e,t&&this.generatePreProcessingTrack(t)}},{key:"generatePreProcessingTrack",value:(t=Tm(Em().mark((function e(t){var r;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this._preProcessingTrack=void 0,e.prev=1,e.next=4,t.getPreProcessingTrack(this);case 4:(r=e.sent)instanceof MediaStreamTrack&&(this._preProcessingTrack=r),e.next=11;break;case 8:e.prev=8,e.t0=e.catch(1),console.error(e.t0);case 11:case"end":return e.stop()}}),e,this,[[1,8]])}))),function(e){return t.apply(this,arguments)})},{key:"getOrgTrack",value:function(){return this._originTrack}},{key:"close",value:function(){var e,t,r,n,i;return this._mediaTrack.onended=null,this._mediaTrack.onmute=null,this._mediaTrack.onunmute=null,null===(e=this._originTrack)||void 0===e||e.removeEventListener("ended",this.handleTrackEnded),null===(t=this._originTrack)||void 0===t||t.removeEventListener("mute",this.handleMute),null===(r=this._originTrack)||void 0===r||r.removeEventListener("unmute",this.handleUnmute),null===(n=this._preProcessingTrack)||void 0===n||n.stop(),"audio"===this.mediaType?this.destroy():null===(i=this._mediaTrack)||void 0===i?void 0:i.stop()}},{key:"_initListeners",value:function(){this._originTrack instanceof MediaStreamTrack&&(this._originTrack.addEventListener("ended",this.handleTrackEnded),this._originTrack.addEventListener("mute",this.handleMute),this._originTrack.addEventListener("unmute",this.handleUnmute))}}]),n}(EU),TU=function(e){OI(r,e);var t=YI(r);function r(e,n,i){var o;return Ll(this,r),Qd($T(o=t.call(this,n,i)),"_mediaTrack",void 0),Qd($T(o),"_originTrack",void 0),o._mediaTrack="audio"===o.mediaType?o.connectAudioTrack(e):e,o._originTrack=e,o}return Dl(r,[{key:"getTrack",value:function(){return this._mediaTrack}},{key:"getOrgTrack",value:function(){return this._originTrack}},{key:"close",value:function(){return this.destroy()}}]),r}(EU),IU=function(e){OI(n,e);var t,r=YI(n);function n(e,t){var i;return Ll(this,n),Qd($T(i=r.call(this,e,t,"video")),"resolution",void 0),Qd($T(i),"dummy",!1),i.resolution={width:0,height:0},i}return Dl(n,[{key:"updateVideoCaptureConfig",value:(t=Tm(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 SU.print("updateVideoEncoderConfig","update localVideoTrack: ",t),delete(r=Zd({},t)).contentHint,sP&&(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&&_k(t=["text","motion","detail"]).call(t,e)&&(this._mediaTrack.contentHint=e)}}]),n}(kU),AU=function(e){OI(n,e);var t,r=YI(n);function n(e,t){var i;return Ll(this,n),Qd($T(i=r.call(this,e,t,"audio")),"audioCaptureConfig",void 0),Qd($T(i),"_audioLevelFetcher",void 0),Qd($T(i),"mixedAudioTrack",void 0),Qd($T(i),"mixType",xl.PLAYOUT_AND_PUBLISH),i}return Dl(n,[{key:"getAudioLevel",value:function(){return this._audioLevelFetcher||(this._audioLevelFetcher=new _U(this.getTrack("preprocessing"))),this._audioLevelFetcher.getAudioLevel()}},{key:"updateAudioCaptureConfig",value:(t=Tm(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 SU.print("updateAudioCaptureConfig","update localAudioTrack: ",this.audioCaptureConfig),e.next=5,null===(t=this.getOrgTrack())||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),RU=function(e){OI(r,e);var t=YI(r);function r(e,n){return Ll(this,r),t.call(this,e,n,"video")}return Dl(r)}(TU),CU=function(e){OI(r,e);var t=YI(r);function r(e,n){var i;return Ll(this,r),Qd($T(i=t.call(this,e,n,"audio")),"_audioLevelFetcher",void 0),i}return Dl(r,[{key:"getAudioLevel",value:function(){return this._audioLevelFetcher||(this._audioLevelFetcher=new _U(this.getOrgTrack())),this._audioLevelFetcher.getAudioLevel()}}]),r}(TU),wU=function(e){OI(r,e);var t=YI(r);function r(){var e,n;Ll(this,r);for(var i=arguments.length,o=new Array(i),a=0;a<i;a++)o[a]=arguments[a];return Qd($T(n=t.call.apply(t,wm(e=[this]).call(e,o))),"streamIndex",cl.STREAM_INDEX_MAIN),n}return Dl(r)}(AU),xU=function(e){OI(r,e);var t=YI(r);function r(){var e,n;Ll(this,r);for(var i=arguments.length,o=new Array(i),a=0;a<i;a++)o[a]=arguments[a];return Qd($T(n=t.call.apply(t,wm(e=[this]).call(e,o))),"streamIndex",cl.STREAM_INDEX_MAIN),n}return Dl(r)}(IU),OU=function(e){OI(r,e);var t=YI(r);function r(){var e,n;Ll(this,r);for(var i=arguments.length,o=new Array(i),a=0;a<i;a++)o[a]=arguments[a];return Qd($T(n=t.call.apply(t,wm(e=[this]).call(e,o))),"streamIndex",cl.STREAM_INDEX_MAIN),Qd($T(n),"sourceType",0),n}return Dl(r)}(IU),PU=function(e){OI(r,e);var t=YI(r);function r(){var e,n;Ll(this,r);for(var i=arguments.length,o=new Array(i),a=0;a<i;a++)o[a]=arguments[a];return Qd($T(n=t.call.apply(t,wm(e=[this]).call(e,o))),"streamIndex",cl.STREAM_INDEX_MAIN),Qd($T(n),"sourceType",0),n}return Dl(r)}(AU),MU=function(e){OI(r,e);var t=YI(r);function r(){var e,n;Ll(this,r);for(var i=arguments.length,o=new Array(i),a=0;a<i;a++)o[a]=arguments[a];return Qd($T(n=t.call.apply(t,wm(e=[this]).call(e,o))),"streamIndex",cl.STREAM_INDEX_SCREEN),n}return Dl(r)}(IU),NU=function(e){OI(r,e);var t=YI(r);function r(){var e,n;Ll(this,r);for(var i=arguments.length,o=new Array(i),a=0;a<i;a++)o[a]=arguments[a];return Qd($T(n=t.call.apply(t,wm(e=[this]).call(e,o))),"streamIndex",cl.STREAM_INDEX_SCREEN),n}return Dl(r)}(AU),DU=function(e){OI(r,e);var t=YI(r);function r(){var e,n;Ll(this,r);for(var i=arguments.length,o=new Array(i),a=0;a<i;a++)o[a]=arguments[a];return Qd($T(n=t.call.apply(t,wm(e=[this]).call(e,o))),"streamIndex",cl.STREAM_INDEX_SCREEN),Qd($T(n),"sourceType",0),n}return Dl(r)}(IU),LU=function(e){OI(r,e);var t=YI(r);function r(){var e,n;Ll(this,r);for(var i=arguments.length,o=new Array(i),a=0;a<i;a++)o[a]=arguments[a];return Qd($T(n=t.call.apply(t,wm(e=[this]).call(e,o))),"streamIndex",cl.STREAM_INDEX_SCREEN),Qd($T(n),"sourceType",0),n}return Dl(r)}(AU);function UU(e,t){return VU.apply(this,arguments)}function VU(){return(VU=Tm(Em().mark((function e(t,r){var n;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return(n=new xU(t,OO())).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 FU(e,t){return BU.apply(this,arguments)}function BU(){return(BU=Tm(Em().mark((function e(t,r){var n;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return(n=new MU(t,OO())).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 jU(e,t){return GU.apply(this,arguments)}function GU(){return(GU=Tm(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 o=(null==t||null===(n=t.deviceId)||void 0===n?void 0:n.exact)||"default",a=kO(r.id),e.prev=2,SU.print("createCameraVideoTrack","constraints:",t),null==a||a.report("rtc_video_capture_event",{event_type:"start",media_device_id:o}),s=PO(),sP&&(t.frameRate={ideal:30,max:30}),e.next=9,hU.getUserMedia({video:t});case 9:i=e.sent,null==a||a.report("rtc_video_capture_event",{event_type:"start_capture_result",media_device_id:o,reason:"success",elapse:PO()-s}),e.next=17;break;case 13:throw e.prev=13,e.t0=e.catch(2),null==a||a.report("rtc_video_capture_event",{event_type:"running_failed",media_device_id:o,error_code:e.t0.code,reason:e.t0.name+e.t0.message}),new hR(dR.GET_VIDEO_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.getVideoTracks()[0],bU.set(u,i),d=new xU(u,OO()),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 HU(e,t){return zU.apply(this,arguments)}function zU(){return(zU=Tm(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 SU.print("createMicrophoneAudioTrack","constraints:",t),o=(null==t||null===(n=t.deviceId)||void 0===n?void 0:n.exact)||"default",a=kO(r.id),e.prev=3,null==a||a.report("rtc_video_capture_event",{event_type:"start",media_device_id:o}),s=PO(),(c=r.getPluginByName(mU.PRE_PROCESSING,"RTCAIAnsExtension"))&&(c.isOpen()?(t.autoGainControl=!0,t.noiseSuppression=!1):t.noiseSuppression=!0),e.next=10,hU.getUserMedia({audio:t});case 10:i=e.sent,null==a||a.report("rtc_video_capture_event",{event_type:"start_capture_result",media_device_id:o,reason:"success",elapse:PO()-s}),e.next=18;break;case 14:throw e.prev=14,e.t0=e.catch(3),null==a||a.report("rtc_video_capture_event",{event_type:"running_failed",media_device_id:o,error_code:e.t0.code,reason:e.t0.name+e.t0.message}),new hR(dR.GET_AUDIO_TRACK_FAILED,wm(u="throw error from getUserMedia. [".concat(e.t0.name||"unknown name","]: ")).call(u,e.t0.message||"unknown message","."),e.t0);case 18:return d=i.getAudioTracks()[0],bU.set(d,i),l=new wU(d,OO()),e.next=23,l.generatePreProcessingTrack(r);case 23:return e.abrupt("return",l);case 24:case"end":return e.stop()}}),e,null,[[3,14]])})))).apply(this,arguments)}function XU(){return KU.apply(this,arguments)}function KU(){return KU=Tm(Em().mark((function e(){var t,r,n,i,o,a,s,c,u,d,l=arguments;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=l.length>0&&void 0!==l[0]&&l[0],r=l.length>1?l[1]:void 0,n=l.length>2?l[2]:void 0,SU.print("createScreenTracks","withAudio: %o, constraints: %o",t,n),o=kO(r.id),e.prev=5,null==o||o.report("rtc_video_capture_event",{event_type:"start",media_device_id:"screen"}),a=PO(),e.next=10,navigator.mediaDevices.getDisplayMedia({video:!(n&&(!cP||16!==bP))||n,audio:!!t&&{channelCount:2,noiseSuppression:!1,echoCancellation:!1,autoGainControl:!1}});case 10:i=e.sent,null==o||o.report("rtc_video_capture_event",{event_type:"start_capture_result",media_device_id:"screen",reason:"success",elapse:PO()-a}),e.next=18;break;case 14:throw e.prev=14,e.t0=e.catch(5),null==o||o.report("rtc_video_capture_event",{event_type:"running_failed",media_device_id:"screen",error_code:e.t0.code,reason:e.t0.name+e.t0.message}),new hR(dR.GET_SCREEN_TRACK_FAILED,"throw error from getDisplayMedia",e.t0);case 18:return s=i.getVideoTracks()[0],c=new MU(s,OO()),e.next=22,c.generatePreProcessingTrack(r);case 22:if(!(u=i.getAudioTracks()[0])){e.next=28;break}return d=new NU(u,OO()),e.next=27,d.generatePreProcessingTrack(r);case 27:return e.abrupt("return",[c,d]);case 28:return e.abrupt("return",[c,void 0]);case 29:case"end":return e.stop()}}),e,null,[[5,14]])}))),KU.apply(this,arguments)}function qU(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:OO();return new CU(e,t)}function YU(e,t){return WU.apply(this,arguments)}function WU(){return(WU=Tm(Em().mark((function e(t,r){var n;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=new OU(t,OO()),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 QU(e,t){return JU.apply(this,arguments)}function JU(){return(JU=Tm(Em().mark((function e(t,r){var n;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=new PU(t,OO()),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 ZU(e,t){return $U.apply(this,arguments)}function $U(){return($U=Tm(Em().mark((function e(t,r){var n;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=new DU(t,OO()),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 eV(e,t){return tV.apply(this,arguments)}function tV(){return(tV=Tm(Em().mark((function e(t,r){var n;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=new LU(t,OO()),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 rV=AU,nV=CU,iV=function(e){return e[e.NONE=0]="NONE",e}(iV||{}),oV=function(){function e(){Ll(this,e)}return Dl(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(bm(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(bm(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(bm(i=t.buffer).call(i,t.position,t.position+4));t.skip(4);var s=new Uint8Array(bm(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}(),aV=function(){function e(t){Ll(this,e),Qd(this,"_position",0),Qd(this,"_dataview",void 0),this._dataview=new DataView(t)}return Dl(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}(),sV=function(e){return e[e.internal=0]="internal",e[e.external=1]="external",e[e.bypass=2]="bypass",e}(sV||{}),cV=new Uint8Array([109,167,53,190,103,90,72,1,170,89,63,164,194,199,19,85]),uV=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 lV(e){for(var t=[];e>=255;)e-=255,t.push(255);return t.push(e),new Uint8Array(t)}function hV(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 vV=function(){function e(){Ll(this,e)}return Dl(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:uV,s=lV(e.byteLength+a.byteLength),c=dV(e);return new Uint8Array(wm(t=[]).call(t,Yk(n),Yk(i),Yk(o),Yk(s),Yk(a),Yk(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=bm(e).call(e,0,e.length-1));if(!(t.byteLength<2)){var r=0;if(5===t[1]||100===t[1]){var n=ZT(hV(t,r+=2),2),i=n[0],o=2,a=(r=n[1])+i;return t.byteLength>=uV.byteLength&&i>=uV.byteLength&&bm(t).call(t,r,r+uV.byteLength).toString()===uV.toString()?(r+=uV.byteLength,o=1):t.byteLength>=uV.byteLength&&i>=uV.byteLength&&bm(t).call(t,r,r+cV.byteLength).toString()===cV.toString()&&(r+=cV.byteLength,o=0),{type:o,payload:bm(t).call(t,r,a)}}}}},{key:"parseInternalSEI",value:function(e){var t=new JS,r=0;if(0===e.type){for(;e.payload.byteLength-r>=2;){var n=ZT(hV(e.payload,r),2),i=n[0];r=n[1];var o,a=ZT(hV(e.payload,r),2),s=a[0];if(r=a[1],t.get(i)||!(s<=e.payload.byteLength-r))break;t.set(i,bm(o=e.payload).call(o,r,r+s)),r+=s}return t}}},{key:"makeInternalSei",value:function(e){var t,r=[],n=JT(e);try{for(n.s();!(t=n.n()).done;){var i=ZT(t.value,2),o=i[0],a=i[1],s=lV(o),c=lV(a.byteLength);r.push(s,c,a)}}catch(l){n.e(l)}finally{n.f()}var u=lb(r).call(r,(function(e,t){return e+t.byteLength}),0),d=new Uint8Array(u);return lb(r).call(r,(function(e,t){return d.set(t,e),e+t.byteLength}),0),d}}]),e}(),pV=new cO("Stats",3),_V=function(){function e(t){Ll(this,e),Qd(this,"player",void 0),Qd(this,"_timer",void 0),Qd(this,"handler",void 0),Qd(this,"_monitor",void 0),Qd(this,"_destroyed",!1),this.id=t,this._monitor=kO(t)}return Dl(e,[{key:"setVar",value:function(e){this.handler=e}},{key:"clearTimer",value:function(){this._timer&&(pV.print("clearTimer","invoke"),clearTimeout(this._timer),delete this._timer,AO(this.id,"del_media_statistics_timer","".concat((new Error).stack),0,this._stream.streamId||""))}},{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(){pV.print("destroy","invoke"),AO(this.id,"media_statistics_destroy","".concat((new Error).stack),0,"".concat(this._stream.streamId)),this.clearTimer(),this._destroyed=!0}}]),e}(),fV=function(e){OI(i,e);var t,r,n=YI(i);function i(e,t){var r;return Ll(this,i),Qd($T(r=n.call(this,e)),"_context",void 0),r._stream=t,r}return Dl(i,[{key:"setLocalStreamStatsEvtInterval",value:function(e,t,r){var n,i,o,a=this;if(!this._timer){pV.print("setLocalStreamStatsEvtInterval","invoke"),this.setVar(t),this._context=r,this._destroyed=!1;var s={audio:{},video:{}},c=this._stream,u=null===(n=c.audioTrack)||void 0===n?void 0:n.getTrack("preprocessing"),d=null===(i=c.videoTrack)||void 0===i?void 0:i.getTrack("preprocessing");this.getAudioStats(u,s,null===(o=c.audioTrack)||void 0===o?void 0:o.getAudioLevel()),this.getVideoStats(d,s);var l=function(){var e=Tm(Em().mark((function e(){var t,r,n,i,o,u,d;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=null===(t=c.audioTrack)||void 0===t?void 0:t.getTrack("preprocessing"),o=null===(r=c.videoTrack)||void 0===r?void 0:r.getTrack("preprocessing"),e.next=4,a.getAudioStats(i,s,null===(n=c.audioTrack)||void 0===n?void 0:n.getAudioLevel());case 4:return u=e.sent,e.next=7,a.getVideoStats(o,s);case 7:return d=e.sent,e.abrupt("return",{audioStats:u,videoStats:d,isScreen:c.isScreen});case 9:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),h=function(){var t=Tm(Em().mark((function t(){var r;return Em().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,l();case 2:r=t.sent,e(r),a._destroyed||(a._timer=setTimeout(h,2e3));case 5:case"end":return t.stop()}}),t)})));return function(){return t.apply(this,arguments)}}();this._timer=setTimeout(h,2e3)}}},{key:"unpublish",value:function(){this.clearTimer()}},{key:"getAudioStats",value:(r=Tm(Em().mark((function e(t,r,n){var i,o,a,s,c,u,d,l,h,v,p,_,f,m,g;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(s={},c={timestamp:Date.now()},u=this._stream,d=u.streamId,l=u.audioMid,h=u.isScreen,v=u.pubAttributes,p=u.pubAudio,_=u.audioTrack,f={media_type:"audio",is_screen:!!h,direction:"up",stream_id:d,vid:l,connection_status:navigator.onLine,track_enabled:null==t?void 0:t.enabled,capture_state:v.localaudio?"capture_state_on":"capture_state_off",mute_state:p?"mute_state_off":"mute_state_on"},_&&(f.playback_volume=_.getVolume()),t&&this.handler){e.next=7;break}return e.abrupt("return",s);case 7:return e.next=9,this.handler.getStats(t);case 9:if((m=e.sent).length){e.next=12;break}return e.abrupt("return",s);case 12:if(m.forEach((function(e){var t=e.type,r=e.packetsSent,n=e.packetsLost,i=e.bytesSent,o=e.clockRate,a=e.roundTripTime,u=e.channels,d=e.audioLevel;e.googRtt;var l=e.mimeType,h=e.availableIncomingBitrate,v=e.availableOutgoingBitrate,p=e.bytesReceived,_=e.nominated,m=e.id,g=e.currentRoundTripTime,y=e.state,S=e.writable,b=e.requestsReceived,E=e.responsesReceived,k=e.requestsSent,T=e.consentRequestsSent,I=e.responsesSent,A=e.jitter,R=e.candidateType,C=e.ip,w=e.address,x=e.networkType,O=e.port,P=e.protocol,M=e.nackCount,N=e.retransmittedBytesSent,D=e.retransmittedPacketsSent,L=e.audioInputLevel,U=e.ssrc,V=e.totalAudioEnergy,F=e.totalSamplesDuration,B=e.mediaType,j=e.fractionLost;"outbound-rtp"===t?(c.packetsSent=r,c.bytesSent=i,f.bytes=i,f.packetsSent=r,f.nackCount=M,f.ssrc=U,f.retransmitted_bytes_sent=N,f.retransmitted_packets_sent=D,c.retransmittedBytesSent=N,c.retransmittedPacketsSent=D):"remote-inbound-rtp"===t?(c.packetsLost=n,f.packetsLost=n,f.net_jitter=1e3*A,s.rtt=1e3*a,f.rtt=s.rtt,s._fractionLost=j||0):"codec"===t?(s.recordSampleRate=o,s.numChannels=u,f.codecName=l):"media-source"===t&&void 0!==d?(f.audio_level=d?-10*YR(Math.pow(d,2)):d,f.volume=255*d,f.total_audio_energy=V,f.totalInputDuration=F):"ssrc"===t&&"audio"===B?f.send_level=L:"candidate-pair"===t?(f.ice_available_incoming_bitrate=h,f.ice_available_outgoing_bitrate=v,f.ice_bytes_received=p,f.ice_bytes_sent=i,f.ice_nominated=+_,f.ice_pair_id=m,f.ice_pair_rtt=g,f.ice_pair_state=y,f.ice_pair_writable=S,f.recv_ping_requests=b,f.recv_ping_responses=E,f.sent_ping_requests_before_first_response=k,f.sent_ping_requests_total=k+(T||0),f.sent_ping_responses=I):"local-candidate"===t?(f.local_candidate_type=R,f.local_ip=C||w,f.local_network_type=x,f.local_port=O,f.protocol=P):"remote-candidate"===t&&(f.remote_candidate_type=R,f.remote_ip=C||w,f.remote_port=O);var G=jP("STATS_SCALLBACK_SUPPORT");GD&&G||"media-source"===t&&(f.send_level=d)})),void 0===f.volume&&void 0!==n&&(f.volume=n,f.audio_level=n?-10*YR(Math.pow(n/255,2)):n),(g=r.audio).timestamp){e.next=18;break}return r.audio=c,e.abrupt("return",this.filterIllegal(s));case 18:return void 0!==c.packetsLost&&(s.audioLossRate=(c.packetsLost-g.packetsLost)/(c.packetsSent-g.packetsSent),s.audioLossRate=Number.isNaN(s.audioLossRate)?0:s.audioLossRate,f.fraction_lost=s.audioLossRate),s.statsInterval=c.timestamp-g.timestamp,f.stats_interval=s.statsInterval,s.sendKBitrate=(c.bytesSent-g.bytesSent||0)/s.statsInterval*8,f.mediaBitratebps=Math.round(1e3*s.sendKBitrate),f.bandwidth=Math.round(f.mediaBitratebps/1024),void 0!==c.retransmittedBytesSent&&(f.retransmitBitratebps=(c.retransmittedBytesSent-g.retransmittedBytesSent||0)/s.statsInterval),r.audio=c,f.vendor_mode=(null===(i=this._stream)||void 0===i?void 0:i.vendorCode)||0,f.pc_session_id=null===(o=this.handler)||void 0===o?void 0:o.peerConnectionId,null===(a=this._monitor)||void 0===a||a.report("rtc_media_statistics",f),s._retransmittedRate=(c.retransmittedPacketsSent-g.retransmittedPacketsSent)/(c.packetsSent-g.packetsSent),void 0===s.audioLossRate&&(s.audioLossRate=s._retransmittedRate,f.fraction_lost=s.audioLossRate),s._fractionLost=Math.max(s._fractionLost,s.audioLossRate),e.abrupt("return",this.filterIllegal(s));case 33:case"end":return e.stop()}}),e,this)}))),function(e,t,n){return r.apply(this,arguments)})},{key:"getVideoStats",value:(t=Tm(Em().mark((function e(t,r){var n,i,o,a,s,c,u,d,l,h,v,p,_,f,m,g,y,S,b,E,k,T;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n={},i={timestamp:Date.now(),simulcast:{}},o=this._stream,a=o.streamId,s=o.videoMid,c=o.isScreen,u=o.pubAttributes,d=o.enableSimulcast,l=o.pubVideo,e.t0=Zd,e.t1={media_type:"video",is_screen:!!c,direction:"up",stream_id:a,vid:s,connection_status:navigator.onLine,track_enabled:null==t?void 0:t.enabled,capture_state:u.localvideo?"capture_state_on":"capture_state_off",mute_state:l?"mute_state_off":"mute_state_on"},e.next=7,this._stream.requestVideoFrameCallback();case 7:if(e.t2=e.sent,h=(0,e.t0)(e.t1,e.t2),t&&this.handler){e.next=11;break}return e.abrupt("return",n);case 11:return h.cap_frame_width=t.getSettings().width,h.cap_frame_height=t.getSettings().height,n.isScreen=c,e.next=16,this.handler.getStats(t);case 16:if((v=e.sent).length){e.next=19;break}return e.abrupt("return",n);case 19:if(p=0,v.forEach((function(e){var o=e.type,a=e.framesEncoded,s=e.packetsLost,c=e.bytesSent,u=e.framesSent,l=e.retransmittedBytesSent,v=e.totalPacketSendDelay,_=e.totalEncodeTime,f=e.firCount,m=e.targetBitrate,g=e.roundTripTime,y=e.mimeType,S=e.frameWidth,b=e.frameHeight,E=e.packetsSent,k=e.googActualEncBitrate,T=e.googAvailableReceiveBandwidth,I=e.googAvailableSendBandwidth,A=e.googAvgEncodeMs,R=e.googBucketDelay,C=e.googEncodeUsagePercent,w=e.googFrameRateInput,x=e.availableIncomingBitrate,O=e.availableOutgoingBitrate,P=e.bytesReceived,M=e.nominated,N=e.id,D=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,X=e.protocol,K=e.qpSum,q=e.requestsReceived,Y=e.responsesReceived,W=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,ve=e.scalabilityMode;"outbound-rtp"===o?(d&&(oe?i.simulcast[oe]=e:i.simulcast[p]=e,p++),i.framesEncoded=a||i.framesEncoded||0,h.key_frames_encoded=he||0,i.bytesSent=c||i.bytesSent||0,i.framesSent=u||i.framesSent,h.bytes=c||h.bytes||0,i.packetsSent=E||i.packetsSent||0,h.packetsSent=E||h.packetsSent||0,h.nackCount=H||h.nackCount||0,h.pli_count=z||h.pli_count||0,h.qp_sum=K||h.qp_sum||0,h.ssrc=$||h.ssrc||0,h.retransmitted_packets_sent=re,i.retransmittedPacketsSent=re,i.retransmittedBytesSent=l,h.encoder_implementation=ne,h.qualityLimitationReason=ce,h.qualityLimitationDurations=ue,h.scalabilityMode=ve,void 0!==S&&((!n.encodedFrameWidth||S>n.encodedFrameWidth)&&(n.encodedFrameWidth=S),(!n.encodedFrameHeight||b>n.encodedFrameHeight)&&(n.encodedFrameHeight=b),h.frame_size_height=b,h.frame_size_width=S)):"track"===o?(n.encodedFrameWidth=S,n.encodedFrameHeight=b,h.frame_size_height=b,h.frame_size_width=S):"remote-inbound-rtp"===o?(i.packetsLost=s,n.rtt=1e3*g,h.rtt=n.rtt,h.jitter=1e3*ie,h.packetsLost=s,n._fractionLost=ae||0):"codec"===o?(n.codecType=y,h.codecName=y):"candidate-pair"===o?(h.ice_available_incoming_bitrate=x,h.ice_available_outgoing_bitrate=O,h.ice_bytes_received=P,h.ice_bytes_sent=c,h.ice_nominated=+M,h.ice_pair_id=N,h.ice_pair_rtt=D,h.ice_pair_state=L,h.ice_pair_writable=U,h.recv_ping_requests=q,h.recv_ping_responses=Y,h.sent_ping_requests_before_first_response=Q,h.sent_ping_requests_total=Q+J,h.sent_ping_responses=Z):"local-candidate"===o?(h.local_candidate_type=V,h.local_ip=F||B,h.local_network_type=j,h.local_port=G,h.protocol=X):"remote-candidate"===o?(h.remote_candidate_type=V,h.remote_ip=F||B,h.remote_port=G):"VideoBwe"===o?(h.encBitratebps=k,h.available_receive_bandwidth=T,h.available_send_bandwidth=I,h.bucket_delay=R,h.retransmitBitratebps=W,h.targetEncBitratebps=ee,h.transmit_bitrate=te,n._sendBandWidth=+I):"ssrc"===o&&(h.avg_encode_ms=A,h.encodeUsage=C,h.frame_rate_input=w,h.orignal_input_Framerate=+w,h.ddaptationChanges=se,h.firsReceived=de,h.frameRateSent=le);var pe=jP("STATS_SCALLBACK_SUPPORT");if(!GD||!pe){var _e=r.video,fe=i.timestamp-_e.timestamp;if("outbound-rtp"===o){var me=c-_e.bytesSent,ge=l-_e.retransmittedBytesSent;h.encBitratebps=Math.round(8e3*(me-ge)/fe),h.bucket_delay=v/E,h.retransmitBitratebps=Math.round(8e3*ge/fe),h.targetEncBitratebps=m,h.transmit_bitrate=Math.round(1e3*(c-_e.bytesSent)*8/fe),h.avg_encode_ms=1e3*_/a,h.firsReceived=f+z}else"candidate-pair"===o&&(h.available_send_bandwidth=O,n._sendBandWidth=O);if(t){var ye=null==t?void 0:t.getSettings().frameRate;h.orignal_input_Framerate=ye,h.frameRateSent=t.getSettings().frameRate}}})),(_=r.video).timestamp){e.next=25;break}return r.video=i,e.abrupt("return",this.filterIllegal(n));case 25:return n.statsInterval=i.timestamp-_.timestamp,h.stats_interval=n.statsInterval,f=an(i.simulcast),d?(h.sim_enc_width=[],h.sim_enc_height=[],h.sim_enc_bps=[],h.sim_enc_framerate=[],h.sim_enc_key_frames=[],h.sim_rids=[],h.sim_enc_bandwidth=[],h.sim_sent_framerate=[],h.sim_fraction_lost=[],h.sim_keyencoded=[],h.active_sim_streams=(null===(m=this._context)||void 0===m?void 0:m.activeSimStreams)||[],h.sim_retransmittedRate=[],b=!1,FA(f).call(f,(function(e,t){return+e-+t})).forEach((function(e){var t=i.simulcast[e],r=t.frameWidth,o=t.frameHeight,a=t.bytesSent,s=t.framesEncoded,c=t.framesSent,u=t.packetsLost,d=t.packetsSent,l=t.qualityLimitationReason,v=t.qualityLimitationDurations,p=t.qualityLimitationResolutionChanges,f=t.retransmittedPacketsSent,m=t.pliCount,g=t.keyFramesEncoded;void 0!==l&&(h.sim_qualityLimitationReason||(h.sim_qualityLimitationReason=[],h.sim_qualityLimitationDurations=[],h.sim_qualityLimitationResolutionChanges=[]),h.sim_qualityLimitationReason.push(l),h.sim_qualityLimitationDurations.push(v),h.sim_qualityLimitationResolutionChanges.push(p));var y=_.simulcast[e];if(h.sim_enc_width.push(r||0),h.sim_enc_height.push(o||0),h.sim_enc_key_frames.push(g||0),y){var S=(a-y.bytesSent||0)/n.statsInterval;h.sim_enc_bps.push(Math.round(8e3*S)),h.sim_enc_bandwidth.push(Math.round(8e3*S/1024));var E=1e3*(s-y.framesEncoded)/n.statsInterval;h.sim_enc_framerate.push(Math.round(E)),h.sim_rids.push(e);var k=void 0!==c?c-y.framesSent:s-y.framesEncoded,T=1e3*k/n.statsInterval;h.sim_sent_framerate.push(Math.round(T));var I=(u-y.packetsLost)/(d-y.packetsSent);n._retransmittedRate=(f-y.retransmittedPacketsSent)/(d-y.packetsSent),I=Number.isNaN(I)?0:I,h.sim_fraction_lost.push(I),h.sim_keyencoded.push(m-y.pliCount>0),h.sim_retransmittedRate.push(n._retransmittedRate),r>0&&!b&&(n.sentKBitrate=8*S,n.encoderOutputFrameRate=E,n.encodedFrameCount=k,n.sentFrameRate=T,n.videoLossRate=I,b=!0)}})),h.vendor_mode=(null===(g=this._stream)||void 0===g?void 0:g.vendorCode)||0,h.pc_session_id=null===(y=this.handler)||void 0===y?void 0:y.peerConnectionId,null===(S=this._monitor)||void 0===S||S.report("rtc_media_statistics",h)):(n.encodedFrameCount=void 0!==i.framesSent?i.framesSent-_.framesSent:i.framesEncoded-_.framesEncoded,n.sentKBitrate=(i.bytesSent-_.bytesSent||0)/n.statsInterval*8,h.bitrate=Math.round(1e3*n.sentKBitrate),h.bandwidth=Math.round(h.bitrate/1024),n.encoderOutputFrameRate=1e3*(i.framesEncoded-_.framesEncoded)/n.statsInterval,h.frame_rate_encoded=Math.round(n.encoderOutputFrameRate),n.sentFrameRate=1e3*n.encodedFrameCount/n.statsInterval,h.frame_rate_sent=Math.round(n.sentFrameRate),n.videoLossRate=(i.packetsLost-_.packetsLost)/(i.packetsSent-_.packetsSent),n.videoLossRate=Number.isNaN(n.videoLossRate)?0:n.videoLossRate,h.fraction_lost=n.videoLossRate,n._retransmittedRate=(i.retransmittedPacketsSent-_.retransmittedPacketsSent)/(i.packetsSent-_.packetsSent),h.vendor_mode=(null===(E=this._stream)||void 0===E?void 0:E.vendorCode)||0,h.pc_session_id=null===(k=this.handler)||void 0===k?void 0:k.peerConnectionId,null===(T=this._monitor)||void 0===T||T.report("rtc_media_statistics",h)),r.video=i,n._fractionLost=Math.max(n._fractionLost,n.videoLossRate),e.abrupt("return",this.filterIllegal(n));case 32:case"end":return e.stop()}}),e,this)}))),function(e,r){return t.apply(this,arguments)})}]),i}(_V),mV=function(e){OI(o,e);var t,r,n,i=YI(o);function o(e,t){var r;return Ll(this,o),Qd($T(r=i.call(this,e)),"isPaused",void 0),Qd($T(r),"pauseStart",void 0),Qd($T(r),"pauseDuration",void 0),Qd($T(r),"_audioStallCount",void 0),Qd($T(r),"_setAudioStallCount",void 0),Qd($T(r),"_audioStallTimer",void 0),Qd($T(r),"_audioStallInterval",void 0),Qd($T(r),"_audioStallRatio",void 0),Qd($T(r),"_videoInWaiting",void 0),Qd($T(r),"_context",void 0),r._stream=t,r._videoInWaiting=!1,r.pauseDuration=0,r}return Dl(o,[{key:"setRemoteStreamStatsEvtInterval",value:(n=Tm(Em().mark((function e(t,r,n){var i,a,s,c,u,d,l,h,v,p,_,f,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 pV.print("setRemoteStreamStatsEvtInterval","invoke"),this.setVar(r),this._context=n,this._audioStallInterval=o.audioStallInterval||100,this._audioStallRatio=o.audioStallRatio||.6,c={audio:{},video:{}},this._destroyed=!1,u=this._stream,d=null===(i=u.audioTrack)||void 0===i?void 0:i.getOrgTrack(),l=null===(a=u.videoTrack)||void 0===a?void 0:a.getTrack(),this.getRemoteVideoStats(l,c),e.next=15,this.getRemoteAudioStats(d,c,null===(s=this._stream.audioTrack)||void 0===s?void 0:s.getAudioLevel());case 15:this.delStatsEvtInterval(),h=0,v=0,_=[],f=0,m=PO(),this._setAudioStallCount=function(){if(FP.AUDIO_STALL&&S._audioStallInterval>0&&void 0!==c.audio.concealedSamples){var e=c.audio.concealedSamples,t=c.audio.totalSamplesReceived;m=PO();var r={isStall:!1,counted:!1,diff:0},n=.5*S._audioStallInterval;S._audioStallCount=Tm(Em().mark((function i(){var o,a,s,c,d,l,p,g,y,b,E,k,T,I,A,R,C;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,_.push({reason:wm(c="hasAudio: ".concat(a,", subAudio: ")).call(c,s)}),m=PO(),i.abrupt("return",{stall_count:h,stall_duration:v,stall_list:_,stats_count:f});case 7:return d=null===(o=u.audioTrack)||void 0===o?void 0:o.getOrgTrack(),l=Date.now(),i.next=11,S.handler.getStats(d,!0);case 11:if(p=i.sent,g=Date.now(),y=PO(),!((b=y-m)<n)){i.next=18;break}return _.push({diff:b,start:m,end:y,get_stats_cost:g-l,get_stats_start:l,get_stats_end:g,reason:wm(E="diff(".concat(b,") < minInterval(")).call(E,n,")")}),i.abrupt("return",{stall_count:h,stall_duration:v,stall_list:_,stats_count:f});case 18:if(k=p.length,T=mE(p).call(p,(function(e){return"inbound-rtp"===e.type}))){i.next=23;break}return _.push({diff:b,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:v,stall_list:_,stats_count:f});case 23:return I=T.concealedSamples,A=T.totalSamplesReceived,C=A-t,(R=I-e)>=0&&C>=0&&R>=S._audioStallRatio*C?(_.push({concealed:R,received:C,diff:b,start:m,end:y,get_stats_cost:g-l,get_stats_start:l,get_stats_end:g,is_stall:!0}),r.isStall?(r.counted?v+=b:(v=v+r.diff+b,h++),r.counted=!0):b>=200?(v+=b,h++,r.counted=!0):(r.counted=!1,r.diff=b),r.isStall=!0):(_.push({concealed:R,received:C,diff:b,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,f++,i.abrupt("return",{stall_count:h,stall_duration:v,stall_list:_,stats_count:f});case 32:case"end":return i.stop()}}),i)}))),p=function(){var e=Tm(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=Tm(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:return i=null===(t=u.audioTrack)||void 0===t?void 0:t.getOrgTrack(),o=null===(r=u.videoTrack)||void 0===r?void 0:r.getTrack(),e.next=4,S.getRemoteAudioStats(i,c,null===(n=S._stream.audioTrack)||void 0===n?void 0:n.getAudioLevel());case 4:return a=e.sent,h=0,v=0,_=[],f=0,e.next=11,S.getRemoteVideoStats(o,c);case 11:return s=e.sent,e.abrupt("return",{audioStats:a,videoStats:s,isScreen:u.isScreen,userId:u.userId,streamId:u.streamId});case 13:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),y=function(){var e=Tm(Em().mark((function e(){var r;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,g();case 2:r=e.sent,t(r),p&&(m=PO(),S._audioStallTimer&&clearTimeout(S._audioStallTimer),S._audioStallTimer=setTimeout(p,S._audioStallInterval)),S._timer&&clearTimeout(S._timer),S._destroyed||(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 27:case"end":return e.stop()}}),e,this)}))),function(e,t,r){return n.apply(this,arguments)})},{key:"delStatsEvtInterval",value:function(){wI(RI(o.prototype),"clearTimer",this).call(this),clearTimeout(this._audioStallTimer),this._audioStallCount=void 0,this._setAudioStallCount=void 0,this.pauseDuration=0}},{key:"unsubscribe",value:function(){pV.print("unsubscribe","invoke"),this.delStatsEvtInterval(),this._videoInWaiting=!1}},{key:"getRemoteAudioStats",value:(r=Tm(Em().mark((function e(t,r,n){var i,o,a,s,c,u,d,l,h,v,p,_,f,m,g,y,S,b,E,k,T,I,A,R,C,w,x=this;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(d={},l={},h=this._stream,v=h.streamId,p=h.userId,_=h.isScreen,f=h.audioMid,m=h.subMediaType,g=h._attributes,y=h.virtual,S=h.audioTrack,b={media_type:"audio",is_screen:!!_,direction:"down",stream_id:v,stream_user_id:p,vid:f,audio_mux:y,connection_status:navigator.onLine,track_enabled:null==t?void 0:t.enabled,mute_state:WO(m)?"mute_state_off":"mute_state_on",remote_user_capture_state:g.localaudio?"capture_state_on":"capture_state_off",remote_user_mute_state:g.localaudio&&g.audiostream?"mute_state_off":"mute_state_on"},S&&(b.playback_volume=S.getVolume()),t&&this.handler){e.next=7;break}return e.abrupt("return",d);case 7:return e.next=9,this.handler.getStats(t);case 9:if((E=e.sent).length){e.next=12;break}return e.abrupt("return",d);case 12:if(E.forEach((function(e){var t=e.type,r=e.packetsLost,i=e.packetsReceived,o=e.bytesReceived,a=e.jitterBufferDelay,s=e.jitterBufferEmittedCount,c=e.clockRate,u=e.channels,h=e.totalSamplesReceived,p=e.concealedSamples,_=e.silentConcealedSamples,f=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,C=e.availableIncomingBitrate,w=e.availableOutgoingBitrate,O=e.bytesSent,P=e.nominated,M=e.id,N=e.writable,D=e.jitter,L=e.candidateType,U=e.ip,V=e.address,F=e.networkType,B=e.port,j=e.protocol,G=e.audioOutputLevel,H=e.requestsReceived,z=e.responsesReceived,X=e.requestsSent,K=e.consentRequestsSent,q=e.responsesSent,Y=e.ssrc;e.kind;var W=e.nackCount,Q=e.lastPacketReceivedTimestamp,J=e.concealmentevents,Z=e.fecPacketsReceived;if("inbound-rtp"===t)l.packetsLost=r,l.packetsReceived=i,b.packetsLost=r,b.packetsReceived=i,b.packetsDiscarded=g,b.nackCount=W,b.lastPacketReceivedTimestamp=Q,b.concealmentevents=J,l.bytesReceived=o,void 0!==a&&(d.jitterBufferDelay=a/s*1e3,b.average_jitter_buffer_delay_ms=d.jitterBufferDelay),void 0!==h&&(l.totalSamplesReceived=h,d.concealedSamples=p,l.concealedSamples=p,l.silentConcealedSamples=_,b.concealedSamples=p,d.concealmentEvents=f,b.totalSamplesReceived=h),void 0!==Z&&(b.fec_packets_received=Z,l.fecPacketsReceived=Z),b.jitter=1e3*D,b.ssrc=Y,void 0!==E&&0!==E?(b.audio_level=E?-10*YR(Math.pow(E,2)):E,b.volume=255*E):(b.volume=null!=n?n:255*E,b.audio_level=n?-10*YR(Math.pow(n/255,2)):n),void 0!==k&&(b.total_audio_energy=k),void 0!==T&&(b.totalAudioDuration=T);else if("codec"===t)d.recordSampleRate=c,u&&(d.numChannels=u),b.codecName=I;else if("candidate-pair"===t){var $,ee,te;b.ice_available_incoming_bitrate=C,b.ice_available_outgoing_bitrate=w,b.ice_bytes_received=o,b.ice_bytes_sent=O,b.ice_nominated=+P,b.ice_pair_id=M,b.ice_pair_rtt=S,b.rtt=1e3*S,b.rtt&&null!==($=x._context)&&void 0!==$&&null!==(ee=$.streamRTT)&&void 0!==ee&&null!==(te=ee[v])&&void 0!==te&&te.audio&&(b.total_rtt_ms=b.rtt+x._context.streamRTT[v].audio),b.ice_pair_state=y,b.ice_pair_writable=N,b.recv_ping_requests=H,b.recv_ping_responses=z,b.sent_ping_requests_before_first_response=X,b.sent_ping_requests_total=X+(K||0),b.sent_ping_responses=q,"succeeded"===y&&(d.rtt=1e3*S,d.total_rtt=1e3*m)}else"track"===t&&void 0!==E?(0===E&&0!==n?(b.volume=n,b.audio_level=n?-10*YR(Math.pow(n/255,2)):n):(b.audio_level=E?-10*YR(Math.pow(E,2)):E,b.volume=255*E),b.total_audio_energy=k,b.totalAudioDuration=T):"ssrc"===t?(b.decodingNormal=A,b.recvAudioLevel=G,b.decodingMuted=R):"local-candidate"===t?(b.local_candidate_type=L,b.local_ip=U||V,b.local_network_type=F,b.local_port=B,b.protocol=j):"remote-candidate"===t&&(b.remote_candidate_type=L,b.remote_ip=U||V,b.remote_port=B)})),(k=r.audio).timestamp){e.next=18;break}return l.timestamp=Date.now(),r.audio=l,e.abrupt("return",this.filterIllegal(d));case 18:if(T={},void 0!==l.concealedSamples&&(b.interval_concealed_samples=l.concealedSamples-k.concealedSamples,b.interval_samples_received=l.totalSamplesReceived-k.totalSamplesReceived,b.interval_silent_concealed_samples=l.silentConcealedSamples-k.silentConcealedSamples),!(this._audioStallInterval>0&&void 0!==k.concealedSamples)){e.next=36;break}if(!this._audioStallCount&&this._setAudioStallCount&&this._setAudioStallCount(),clearTimeout(this._audioStallTimer),!this._audioStallCount){e.next=36;break}return e.next=26,this._audioStallCount();case 26:I=e.sent,A=I.stall_count,R=I.stall_duration,C=I.stall_list,w=I.stats_count,T.stall_list=C,T.stats_count=w,b.concealedSamples===b.interval_concealed_samples&&b.totalSamplesReceived===b.interval_samples_received?(b.stall_count=0,b.stall_duration=0):(b.stall_count=A,b.stall_duration=R),d.stallCount=b.stall_count,d.stallDuration=b.stall_duration;case 36:return l.timestamp=Date.now(),d.audioLossRate=(l.packetsLost-k.packetsLost)/(l.packetsReceived-k.packetsReceived+(l.packetsLost-k.packetsLost)),d.audioLossRate=Number.isNaN(d.audioLossRate)?0:d.audioLossRate,b.fraction_lost=d.audioLossRate,d.statsInterval=l.timestamp-k.timestamp,b.stats_interval=d.statsInterval,d.receivedKBitrate=(l.bytesReceived-k.bytesReceived||0)/d.statsInterval*8,b.bandwidth=Math.round(1e3*d.receivedKBitrate/1024),void 0!==l.concealedSamples&&(d.receivedSampleRate=1e3*b.interval_samples_received/d.statsInterval),void 0!==l.fecPacketsReceived&&(b.fecBitratebps=(l.fecPacketsReceived-k.fecPacketsReceived||0)/d.statsInterval),b.average_jitter_buffer_delay_ms&&b.total_rtt_ms&&(d.e2eDelay=b.average_jitter_buffer_delay_ms+b.total_rtt_ms),null!==(i=this._context)&&void 0!==i&&null!==(o=i.streamRTT)&&void 0!==o&&null!==(a=o[v])&&void 0!==a&&a.audio&&(d.totalRtt=(b.rtt?b.rtt:0)+this._context.streamRTT[v].audio),r.audio=l,b.vendor_mode=(null===(s=this._stream)||void 0===s?void 0:s.vendorCode)||0,b.pc_session_id=null===(c=this.handler)||void 0===c?void 0:c.peerConnectionId,null===(u=this._monitor)||void 0===u||u.report("rtc_media_statistics",b,T),e.abrupt("return",this.filterIllegal(d));case 53:case"end":return e.stop()}}),e,this)}))),function(e,t,n){return r.apply(this,arguments)})},{key:"getRemoteVideoStats",value:(t=Tm(Em().mark((function e(t,r){var n,i,o,a,s,c,u,d,l,h,v,p,_,f,m,g,y,S,b=this;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return u={},d={timestamp:Date.now()},l=this._stream,h=l.streamId,v=l.userId,p=l.isScreen,_=l.subMediaType,f=l._attributes,e.t0=Zd,e.t1={media_type:"video",is_screen:!!p,direction:"down",stream_id:h,stream_user_id:v,vid:this._stream.videoMid,connection_status:navigator.onLine,track_enabled:null==t?void 0:t.enabled,mute_state:QO(_)?"mute_state_off":"mute_state_on",remote_user_capture_state:f.localvideo?"capture_state_on":"capture_state_off",remote_user_mute_state:f.localvideo&&f.videostream?"mute_state_off":"mute_state_on"},e.next=7,this._stream.requestVideoFrameCallback();case 7:if(e.t2=e.sent,m=(0,e.t0)(e.t1,e.t2),t&&this.handler){e.next=11;break}return e.abrupt("return",u);case 11:return u.isScreen=p,e.next=14,this.handler.getStats(t);case 14:if((g=e.sent).length){e.next=17;break}return e.abrupt("return",u);case 17:if(g.forEach((function(e){var t=e.type,r=e.frameHeight,n=e.frameWidth,i=e.packetsLost,o=e.packetsReceived,a=e.bytesReceived,s=e.framesDecoded,c=e.jitterBufferDelay,l=e.jitterBufferEmittedCount,v=e.mimeType,p=e.firCount,_=e.availableIncomingBitrate,f=e.availableOutgoingBitrate,g=e.bytesSent,y=e.nominated,S=e.id,E=e.currentRoundTripTime,k=e.state,T=e.writable,I=e.candidateType,A=e.ip,R=e.address,C=e.networkType,w=e.port,x=e.nackCount,O=e.pliCount,P=e.protocol,M=e.requestsReceived,N=e.responsesReceived,D=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,X=e.framesDropped;if("inbound-rtp"===t)d.packetsLost=i,m.packetsLost=i,d.packetsReceived=o,m.packetsReceived=o,d.bytesReceived=a,m.bytes=a,d.framesDecoded=s,d.totalDecodeTime=G,void 0!==c&&(d.jitterBufferDelay=c/l*1e3,m.average_jitter_buffer_delay_ms=d.jitterBufferDelay),m.fir_count=p,m.nackCount=x,d.nackCount=x,m.pli_count=O,m.ssrc=V,m.framesDropped=X,m.jitter=1e3*F,m.framesReceived=B,d.framesReceived=B,m.framesDecoded=s,m.key_frames_decoded=j,m.decoder_name=H,m.last_packet_received_timestamp=z,void 0!==n&&(u.width=n,m.frame_size_width=n,u.height=r,m.frame_size_height=r);else if("track"===t&&void 0!==n)u.width=n,m.frame_size_width=n,u.height=r,m.frame_size_height=r,void 0!==B&&(m.framesReceived=B,d.framesReceived=B);else if("codec"===t)m.codecName=v;else if("candidate-pair"===t){var K,q,Y;m.ice_available_incoming_bitrate=_,m.ice_available_outgoing_bitrate=f,m.ice_bytes_received=a,m.ice_bytes_sent=g,m.ice_nominated=+y,m.ice_pair_id=S,m.ice_pair_rtt=E,m.rtt=1e3*E,m.rtt&&null!==(K=b._context)&&void 0!==K&&null!==(q=K.streamRTT)&&void 0!==q&&null!==(Y=q[h])&&void 0!==Y&&Y.video&&(m.total_rtt_ms=m.rtt+b._context.streamRTT[h].video),u.rtt=m.rtt,m.ice_pair_state=k,m.ice_pair_writable=T,m.recv_ping_requests=M,m.recv_ping_responses=N,m.sent_ping_requests_before_first_response=D,m.sent_ping_requests_total=D+(L||0),m.sent_ping_responses=U}else"local-candidate"===t?(m.local_candidate_type=I,m.local_ip=A||R,m.local_network_type=C,m.local_port=w,m.protocol=P):"remote-candidate"===t&&(m.remote_candidate_type=I,m.remote_ip=A||R,m.remote_port=w)})),(y=r.video).timestamp){e.next=22;break}return r.video=d,e.abrupt("return",this.filterIllegal(u));case 22:return u.videoLossRate=(d.packetsLost-y.packetsLost)/(d.packetsReceived-y.packetsReceived+(d.packetsLost-y.packetsLost)),y.totalDecodeTime&&y.framesDecoded&&d.framesDecoded!==y.framesDecoded&&(m.decode_elapse_per_frame=+((d.totalDecodeTime-y.totalDecodeTime)/(d.framesDecoded-y.framesDecoded)*1e3).toFixed(2)),u._retransmittedRate=(d.nackCount-y.nackCount)/(d.packetsReceived-y.packetsReceived+(d.packetsLost-y.packetsLost)),u.videoLossRate=Number.isNaN(u.videoLossRate)?0:u.videoLossRate,m.fraction_lost=u.videoLossRate,u.statsInterval=d.timestamp-y.timestamp,m.stats_interval=u.statsInterval,u.receivedKBitrate=(d.bytesReceived-y.bytesReceived||0)/u.statsInterval*8,m.bitrate=Math.round(1e3*u.receivedKBitrate),m.bandwidth=Math.round(m.bitrate/1024),u.decoderOutputFrameRate=1e3*(d.framesDecoded-y.framesDecoded)/u.statsInterval,u.receivedFrameRate=1e3*(d.framesReceived-y.framesReceived)/u.statsInterval,m.frame_rate_decoded=Math.round(u.decoderOutputFrameRate),m.frame_rate_received=Math.round(u.receivedFrameRate),m.average_jitter_buffer_delay_ms&&m.total_rtt_ms&&(u.e2eDelay=m.average_jitter_buffer_delay_ms+m.total_rtt_ms),null!==(n=this._context)&&void 0!==n&&null!==(i=n.streamRTT)&&void 0!==i&&null!==(o=i[h])&&void 0!==o&&o.video&&(u.totalRtt=(m.rtt?m.rtt:0)+this._context.streamRTT[h].video),r.video=d,this.processStall(this._stream,m,u,p),this.isPaused?(S=d.timestamp-(this.pauseStart||0),m.pause_duration=this.pauseDuration+(S>500?S:0),this.pauseStart=d.timestamp):m.pause_duration=this.pauseDuration,m.pause_duration=Math.min(m.stall_duration||m.stuck_length||0,m.pause_duration),this.pauseDuration=0,m.vendor_mode=(null===(a=this._stream)||void 0===a?void 0:a.vendorCode)||0,m.pc_session_id=null===(s=this.handler)||void 0===s?void 0:s.peerConnectionId,null===(c=this._monitor)||void 0===c||c.report("rtc_media_statistics",m),e.abrupt("return",this.filterIllegal(u));case 47: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(RI(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}(_V);Qd(mV,"audioStallInterval",void 0),Qd(mV,"audioStallRatio",void 0);var gV,yV,SV=new cO("Stream",0),bV=function(e){OI(r,e);var t=YI(r);function r(){var e,n;Ll(this,r);for(var i=arguments.length,o=new Array(i),a=0;a<i;a++)o[a]=arguments[a];return Qd($T(n=t.call.apply(t,wm(e=[this]).call(e,o))),"videoDom",void 0),n}return Dl(r,[{key:"requestVideoFrameCallback",value:function(){var e=this;return new qf((function(t){var r,n=null===(r=e.videoDom)||void 0===r?void 0:r.requestVideoFrameCallback;if("function"==typeof n){var i=function(e,r){var n={};an(r).forEach((function(e){var t=e.replace(/[a-z]{1}[A-Z]{1}/g,(function(e){var t;return wm(t="".concat(e[0],"_")).call(t,e[1].toLowerCase())}));n["video_".concat(t)]=r[e]})),clearInterval(o),t(n)};n.call(e.videoDom,i);var o=setTimeout((function(){var r;null===(r=e.videoDom)||void 0===r||r.cancelVideoFrameCallback(i),t({})}),500)}else t({})}))}},{key:"stopReport",value:function(){this.statsReport.destroy()}}]),r}(fM),EV=function(e){return e[e.INIT=0]="INIT",e[e.SUB_ING=1]="SUB_ING",e[e.SUB_ED=2]="SUB_ED",e}(EV||{}),kV=function(e){OI(r,e);var t=YI(r);function r(e){var n;return Ll(this,r),Qd($T(n=t.call(this)),"isScreen",!1),Qd($T(n),"stream",void 0),Qd($T(n),"streamId",void 0),Qd($T(n),"audioMid",void 0),Qd($T(n),"videoMid",void 0),Qd($T(n),"seiList",[]),Qd($T(n),"videoTrack",void 0),Qd($T(n),"audioTrack",void 0),Qd($T(n),"videoTransceiver",void 0),Qd($T(n),"audioTransceiver",void 0),Qd($T(n),"videoEncodeConfig",[HP]),Qd($T(n),"subVideoDescriptions",[]),Qd($T(n),"enableSimulcast",!1),Qd($T(n),"observer",void 0),Qd($T(n),"statsReport",void 0),Qd($T(n),"prevBitrate",0),Qd($T(n),"pubAudio",!1),Qd($T(n),"pubVideo",!1),Qd($T(n),"vendorHandler",void 0),Qd($T(n),"pubAttributes",void 0),Qd($T(n),"vendorCode",0),Qd($T(n),"pcSessionId",void 0),n.engineId=e,n.stream=new MediaStream,n.pubAttributes={localaudio:!1,localvideo:!1,videostream:!1,audiostream:!1,extvideo:!1,extaudio:!1},n.statsReport=new fV(e,$T(n)),n}return Dl(r,[{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(BD()){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=vV.generateSEI(n.content),a=new Uint8Array(o.byteLength+t.data.byteLength);if(0===n.repeatCount)ek(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 SV.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 SV.print("no sender found when trying to bind encodedTransform")}},{key:"clean",value:function(){var e,t;AO(this.engineId,"localstream_clean","".concat((new Error).stack),0,this.streamId||""),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.stopReport(),this.prevBitrate=0,this.subVideoDescriptions=[],null===(t=this.vendorHandler)||void 0===t||t.destroy(),this.vendorCode=0,delete this.vendorHandler}},{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)}}]),r}(bV),TV=function(e){OI(r,e);var t=YI(r);function r(e,n,i,o,a,s){var c;return Ll(this,r),Qd($T(c=t.call(this)),"streamId",void 0),Qd($T(c),"userId",void 0),Qd($T(c),"isScreen",void 0),Qd($T(c),"isPublic",void 0),Qd($T(c),"hasVideo",void 0),Qd($T(c),"hasAudio",void 0),Qd($T(c),"_attributes",void 0),Qd($T(c),"streamState",void 0),Qd($T(c),"observer",void 0),Qd($T(c),"statsReport",void 0),Qd($T(c),"subVideo",void 0),Qd($T(c),"subAudio",void 0),Qd($T(c),"subMediaType",void 0),Qd($T(c),"subLayer",void 0),Qd($T(c),"audioMid",void 0),Qd($T(c),"videoMid",void 0),Qd($T(c),"_sequenceId",void 0),Qd($T(c),"stream",void 0),Qd($T(c),"videoTrack",void 0),Qd($T(c),"audioTrack",void 0),Qd($T(c),"videoTransceiver",void 0),Qd($T(c),"audioTransceiver",void 0),Qd($T(c),"recordedVideoFrames",void 0),Qd($T(c),"stillExist",void 0),Qd($T(c),"originalMediaType",void 0),Qd($T(c),"priority",void 0),Qd($T(c),"originalStreamIndex",0),Qd($T(c),"virtual",void 0),Qd($T(c),"vendorHandler",void 0),Qd($T(c),"vendorCode",0),Qd($T(c),"pcSessionId",void 0),c.engineId=e,c.virtual=!1,c.userId=n,c.isScreen=o,c.isPublic=a,c.streamId=i,c.hasAudio=s.audiostream&&s.localaudio,c.hasVideo=s.videostream&&s.localvideo,c._attributes=s,c.vendorCode=(null==s?void 0:s.vendorCode)||0,c.subVideo=!1,c.subAudio=!1,c._sequenceId=0,c.subMediaType=iV.NONE,c.subLayer={spatialLayer:0,spatialSubLayer:-1},c.streamState=0,c.statsReport=new mV(e,$T(c)),c.enableVendorMode&&(c.pcSessionId=nC()),c}return Dl(r,[{key:"vendor",get:function(){return this._attributes.vendorCode}},{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:"enableVendorMode",get:function(){return"number"==typeof this.attributes.vendorCode&&0!==this.attributes.vendorCode}},{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,this.vendorCode=e.vendorCode||0}},{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){oV.getNalunits(new aV(t.data)).forEach((function(t){if(t.sei){var r=vV.decodeSeiBody(t.body);r&&r.type!==sV.internal&&e.safeEmit("onSEIMessage",r.payload)}})),r.enqueue(t)}})).pipeTo(n)}else SV.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 SV.print("no receiver found when trying to bind encodedTransform")}},{key:"ontrack",value:function(e){var t,r,n,i,o,a;try{var s;AO(this.engineId,"Stream.ontrack",Mm({uid:this.userId,streamId:this.streamId,streams:lb(s=e.streams).call(s,(function(e,t){return e+(null==(r=t)?"undefined | null":"string"==typeof r?r:Mm({id:r.id,active:r.active}));var r}),""),transceiver:(i=e.transceiver,null==i?"undefined | null":"string"==typeof i?i:Mm({currentDirection:i.currentDirection,direction:i.direction,mid:i.mid,stopped:i.stopped,receiver:(a=i.receiver,null==a?"undefined | null":"string"==typeof a?a:Mm({track:$O(a.track)})),sender:(o=i.sender,null==o?"undefined | null":"string"==typeof o?o:Mm({track:$O(o.track)}))})),track:$O(e.track)}),0,this.streamId||"")}catch(TK){}if(this.enableVendorMode||null!==(t=e.streams)&&void 0!==t&&null!==(r=t[0])&&void 0!==r&&null!==(n=r.id)&&void 0!==n&&_k(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,r,n;SV.print("clean",wm(e="exec stream.clean ".concat(this.streamId," ")).call(e,this.userId)),AO(this.engineId,"remotestream_clean","".concat((new Error).stack),0,this.streamId),this.subAudio=!1,this.subVideo=!1,this.audioMid=void 0,this.videoMid=void 0,this.sequenceId=0,this.videoTrack=void 0,null===(t=this.audioTrack)||void 0===t||t.close(),this.audioTrack=void 0,this.stream=void 0,this.videoTransceiver=void 0,this.audioTransceiver=void 0,this.recordedVideoFrames=void 0,null===(r=this.observer)||void 0===r||r.reset(),null===(n=this.vendorHandler)||void 0===n||n.destroy(),this.vendorCode=0,delete this.vendorHandler,this.stopReport(),delete this.priority}},{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=qU(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]:OO();return new RU(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=mE(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}(bV),IV=new cO("queue",4),AV=function(e){return e[e.ADD=0]="ADD",e[e.CLOSE=1]="CLOSE",e}(AV||{}),RV=function(e){return e.publish="publish",e.unpublish="unpublish",e.subscribe="subscribe",e.unsubscribe="unsubscribe",e.pushtrack="pushtrack",e.removetrack="removetrack",e}(RV||{}),CV=(Qd(gV={},"publish","unpublish"),Qd(gV,"subscribe","unsubscribe"),Qd(gV,"pushtrack","removetrack"),gV),wV=(Qd(yV={},"publish",0),Qd(yV,"subscribe",0),Qd(yV,"pushtrack",0),Qd(yV,"unpublish",1),Qd(yV,"unsubscribe",1),Qd(yV,"removetrack",1),yV),xV=function(e){OI(r,e);var t=YI(r);function r(){var e;return Ll(this,r),Qd($T(e=t.call(this)),"_queue",void 0),e._queue=[],e}return Dl(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!==CV[t.action]||(n=t.streamId,IV.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;uP&&AP>=86&&AP<=92&&(t=Math.min(this._queue.length,5));for(var r=wV[this._queue[0].action],n=1;n<t;n++){var i;if(wV[this._queue[n].action]!==r)return{sdpStrategy:r,items:ek(i=this._queue).call(i,0,n)}}return{sdpStrategy:r,items:ek(e=this._queue).call(e,0,t)}}}]),r}(pM),OV="object"==typeof global&&global&&global.Object===Object&&global,PV="object"==typeof self&&self&&self.Object===Object&&self,MV=OV||PV||Function("return this")(),NV=MV.Symbol,DV=Object.prototype,LV=DV.hasOwnProperty,UV=DV.toString,VV=NV?NV.toStringTag:void 0;var FV=Object.prototype.toString;var BV=NV?NV.toStringTag:void 0;function jV(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":BV&&BV in Object(e)?function(e){var t=LV.call(e,VV),r=e[VV];try{e[VV]=void 0;var n=!0}catch(o){}var i=UV.call(e);return n&&(t?e[VV]=r:delete e[VV]),i}(e):function(e){return FV.call(e)}(e)}function GV(e){return null!=e&&"object"==typeof e}var HV=Array.isArray;function zV(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function XV(e){return e}function KV(e){if(!zV(e))return!1;var t=jV(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t}var qV,YV=MV["__core-js_shared__"],WV=(qV=/[^.]+$/.exec(YV&&YV.keys&&YV.keys.IE_PROTO||""))?"Symbol(src)_1."+qV:"";var QV=Function.prototype.toString;function JV(e){if(null!=e){try{return QV.call(e)}catch(t){}try{return e+""}catch(t){}}return""}var ZV=/^\[object .+?Constructor\]$/,$V=Function.prototype,eF=Object.prototype,tF=$V.toString,rF=eF.hasOwnProperty,nF=RegExp("^"+tF.call(rF).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function iF(e){return!(!zV(e)||(t=e,WV&&WV in t))&&(KV(e)?nF:ZV).test(JV(e));var t}function oF(e,t){var r=function(e,t){return null==e?void 0:e[t]}(e,t);return iF(r)?r:void 0}var aF=oF(MV,"WeakMap"),sF=Object.create,cF=function(){function e(){}return function(t){if(!zV(t))return{};if(sF)return sF(t);e.prototype=t;var r=new e;return e.prototype=void 0,r}}();function uF(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 dF=Date.now;var lF,hF,vF,pF=function(){try{var e=oF(Object,"defineProperty");return e({},"",{}),e}catch(t){}}(),_F=pF,fF=_F?function(e,t){return _F(e,"toString",{configurable:!0,enumerable:!1,value:(r=t,function(){return r}),writable:!0});var r}:XV,mF=(lF=fF,hF=0,vF=0,function(){var e=dF(),t=16-(e-vF);if(vF=e,t>0){if(++hF>=800)return arguments[0]}else hF=0;return lF.apply(void 0,arguments)}),gF=mF;var yF=/^(?:0|[1-9]\d*)$/;function SF(e,t){var r=typeof e;return!!(t=null==t?9007199254740991:t)&&("number"==r||"symbol"!=r&&yF.test(e))&&e>-1&&e%1==0&&e<t}function bF(e,t,r){"__proto__"==t&&_F?_F(e,t,{configurable:!0,enumerable:!0,value:r,writable:!0}):e[t]=r}function EF(e,t){return e===t||e!=e&&t!=t}var kF=Object.prototype.hasOwnProperty;function TF(e,t,r){var n=e[t];kF.call(e,t)&&EF(n,r)&&(void 0!==r||t in e)||bF(e,t,r)}function IF(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?bF(r,s,c):TF(r,s,c)}return r}var AF=Math.max;function RF(e,t){return gF(function(e,t,r){return t=AF(void 0===t?e.length-1:t,0),function(){for(var n=arguments,i=-1,o=AF(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),uF(e,this,s)}}(e,t,XV),e+"")}function CF(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=9007199254740991}function wF(e){return null!=e&&CF(e.length)&&!KV(e)}var xF=Object.prototype;function OF(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||xF)}function PF(e){return GV(e)&&"[object Arguments]"==jV(e)}var MF=Object.prototype,NF=MF.hasOwnProperty,DF=MF.propertyIsEnumerable,LF=PF(function(){return arguments}())?PF:function(e){return GV(e)&&NF.call(e,"callee")&&!DF.call(e,"callee")},UF=LF;var VF="object"==typeof exports&&exports&&!exports.nodeType&&exports,FF=VF&&"object"==typeof module&&module&&!module.nodeType&&module,BF=FF&&FF.exports===VF?MV.Buffer:void 0,jF=(BF?BF.isBuffer:void 0)||function(){return!1},GF={};function HF(e){return function(t){return e(t)}}GF["[object Float32Array]"]=GF["[object Float64Array]"]=GF["[object Int8Array]"]=GF["[object Int16Array]"]=GF["[object Int32Array]"]=GF["[object Uint8Array]"]=GF["[object Uint8ClampedArray]"]=GF["[object Uint16Array]"]=GF["[object Uint32Array]"]=!0,GF["[object Arguments]"]=GF["[object Array]"]=GF["[object ArrayBuffer]"]=GF["[object Boolean]"]=GF["[object DataView]"]=GF["[object Date]"]=GF["[object Error]"]=GF["[object Function]"]=GF["[object Map]"]=GF["[object Number]"]=GF["[object Object]"]=GF["[object RegExp]"]=GF["[object Set]"]=GF["[object String]"]=GF["[object WeakMap]"]=!1;var zF="object"==typeof exports&&exports&&!exports.nodeType&&exports,XF=zF&&"object"==typeof module&&module&&!module.nodeType&&module,KF=XF&&XF.exports===zF&&OV.process,qF=function(){try{var e=XF&&XF.require&&XF.require("util").types;return e||KF&&KF.binding&&KF.binding("util")}catch(t){}}(),YF=qF&&qF.isTypedArray,WF=YF?HF(YF):function(e){return GV(e)&&CF(e.length)&&!!GF[jV(e)]},QF=Object.prototype.hasOwnProperty;function JF(e,t){var r=HV(e),n=!r&&UF(e),i=!r&&!n&&jF(e),o=!r&&!n&&!i&&WF(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&&!QF.call(e,u)||a&&("length"==u||i&&("offset"==u||"parent"==u)||o&&("buffer"==u||"byteLength"==u||"byteOffset"==u)||SF(u,c))||s.push(u);return s}function ZF(e,t){return function(r){return e(t(r))}}var $F=ZF(Object.keys,Object),eB=Object.prototype.hasOwnProperty;function tB(e){return wF(e)?JF(e):function(e){if(!OF(e))return $F(e);var t=[];for(var r in Object(e))eB.call(e,r)&&"constructor"!=r&&t.push(r);return t}(e)}var rB=Object.prototype.hasOwnProperty;function nB(e){if(!zV(e))return function(e){var t=[];if(null!=e)for(var r in Object(e))t.push(r);return t}(e);var t=OF(e),r=[];for(var n in e)("constructor"!=n||!t&&rB.call(e,n))&&r.push(n);return r}function iB(e){return wF(e)?JF(e,!0):nB(e)}var oB,aB=(oB=function(e,t){IF(t,iB(t),e)},RF((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=oB.length>3&&"function"==typeof i?(n--,i):void 0,o&&function(e,t,r){if(!zV(r))return!1;var n=typeof t;return!!("number"==n?wF(r)&&SF(t,r.length):"string"==n&&t in r)&&EF(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&&oB(e,a,r,i)}return e}))),sB=oF(Object,"create");var cB=Object.prototype.hasOwnProperty;var uB=Object.prototype.hasOwnProperty;function dB(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}function lB(e,t){for(var r=e.length;r--;)if(EF(e[r][0],t))return r;return-1}dB.prototype.clear=function(){this.__data__=sB?sB(null):{},this.size=0},dB.prototype.delete=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t},dB.prototype.get=function(e){var t=this.__data__;if(sB){var r=t[e];return"__lodash_hash_undefined__"===r?void 0:r}return cB.call(t,e)?t[e]:void 0},dB.prototype.has=function(e){var t=this.__data__;return sB?void 0!==t[e]:uB.call(t,e)},dB.prototype.set=function(e,t){var r=this.__data__;return this.size+=this.has(e)?0:1,r[e]=sB&&void 0===t?"__lodash_hash_undefined__":t,this};var hB=Array.prototype.splice;function vB(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}vB.prototype.clear=function(){this.__data__=[],this.size=0},vB.prototype.delete=function(e){var t=this.__data__,r=lB(t,e);return!(r<0)&&(r==t.length-1?t.pop():hB.call(t,r,1),--this.size,!0)},vB.prototype.get=function(e){var t=this.__data__,r=lB(t,e);return r<0?void 0:t[r][1]},vB.prototype.has=function(e){return lB(this.__data__,e)>-1},vB.prototype.set=function(e,t){var r=this.__data__,n=lB(r,e);return n<0?(++this.size,r.push([e,t])):r[n][1]=t,this};var pB=oF(MV,"Map");function _B(e,t){var r,n,i=e.__data__;return("string"==(n=typeof(r=t))||"number"==n||"symbol"==n||"boolean"==n?"__proto__"!==r:null===r)?i["string"==typeof t?"string":"hash"]:i.map}function fB(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}function mB(e,t){for(var r=-1,n=t.length,i=e.length;++r<n;)e[i+r]=t[r];return e}fB.prototype.clear=function(){this.size=0,this.__data__={hash:new dB,map:new(pB||vB),string:new dB}},fB.prototype.delete=function(e){var t=_B(this,e).delete(e);return this.size-=t?1:0,t},fB.prototype.get=function(e){return _B(this,e).get(e)},fB.prototype.has=function(e){return _B(this,e).has(e)},fB.prototype.set=function(e,t){var r=_B(this,e),n=r.size;return r.set(e,t),this.size+=r.size==n?0:1,this};var gB=ZF(Object.getPrototypeOf,Object);function yB(e){var t=this.__data__=new vB(e);this.size=t.size}yB.prototype.clear=function(){this.__data__=new vB,this.size=0},yB.prototype.delete=function(e){var t=this.__data__,r=t.delete(e);return this.size=t.size,r},yB.prototype.get=function(e){return this.__data__.get(e)},yB.prototype.has=function(e){return this.__data__.has(e)},yB.prototype.set=function(e,t){var r=this.__data__;if(r instanceof vB){var n=r.__data__;if(!pB||n.length<199)return n.push([e,t]),this.size=++r.size,this;r=this.__data__=new fB(n)}return r.set(e,t),this.size=r.size,this};var SB="object"==typeof exports&&exports&&!exports.nodeType&&exports,bB=SB&&"object"==typeof module&&module&&!module.nodeType&&module,EB=bB&&bB.exports===SB?MV.Buffer:void 0,kB=EB?EB.allocUnsafe:void 0;function TB(){return[]}var IB=Object.prototype.propertyIsEnumerable,AB=Object.getOwnPropertySymbols,RB=AB?function(e){return null==e?[]:(e=Object(e),function(e,t){for(var r=-1,n=null==e?0:e.length,i=0,o=[];++r<n;){var a=e[r];t(a,r,e)&&(o[i++]=a)}return o}(AB(e),(function(t){return IB.call(e,t)})))}:TB;var CB=Object.getOwnPropertySymbols?function(e){for(var t=[];e;)mB(t,RB(e)),e=gB(e);return t}:TB;function wB(e,t,r){var n=t(e);return HV(e)?n:mB(n,r(e))}function xB(e){return wB(e,tB,RB)}function OB(e){return wB(e,iB,CB)}var PB=oF(MV,"DataView"),MB=oF(MV,"Promise"),NB=oF(MV,"Set"),DB="[object Map]",LB="[object Promise]",UB="[object Set]",VB="[object WeakMap]",FB="[object DataView]",BB=JV(PB),jB=JV(pB),GB=JV(MB),HB=JV(NB),zB=JV(aF),XB=jV;(PB&&XB(new PB(new ArrayBuffer(1)))!=FB||pB&&XB(new pB)!=DB||MB&&XB(MB.resolve())!=LB||NB&&XB(new NB)!=UB||aF&&XB(new aF)!=VB)&&(XB=function(e){var t=jV(e),r="[object Object]"==t?e.constructor:void 0,n=r?JV(r):"";if(n)switch(n){case BB:return FB;case jB:return DB;case GB:return LB;case HB:return UB;case zB:return VB}return t});var KB=XB,qB=Object.prototype.hasOwnProperty;var YB=MV.Uint8Array;function WB(e){var t=new e.constructor(e.byteLength);return new YB(t).set(new YB(e)),t}var QB=/\w*$/;var JB=NV?NV.prototype:void 0,ZB=JB?JB.valueOf:void 0;function $B(e,t,r){var n,i,o,a=e.constructor;switch(t){case"[object ArrayBuffer]":return WB(e);case"[object Boolean]":case"[object Date]":return new a(+e);case"[object DataView]":return function(e,t){var r=t?WB(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.byteLength)}(e,r);case"[object Float32Array]":case"[object Float64Array]":case"[object Int8Array]":case"[object Int16Array]":case"[object Int32Array]":case"[object Uint8Array]":case"[object Uint8ClampedArray]":case"[object Uint16Array]":case"[object Uint32Array]":return function(e,t){var r=t?WB(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.length)}(e,r);case"[object Map]":case"[object Set]":return new a;case"[object Number]":case"[object String]":return new a(e);case"[object RegExp]":return(o=new(i=e).constructor(i.source,QB.exec(i))).lastIndex=i.lastIndex,o;case"[object Symbol]":return n=e,ZB?Object(ZB.call(n)):{}}}var ej=qF&&qF.isMap,tj=ej?HF(ej):function(e){return GV(e)&&"[object Map]"==KB(e)};var rj=qF&&qF.isSet,nj=rj?HF(rj):function(e){return GV(e)&&"[object Set]"==KB(e)},ij="[object Arguments]",oj="[object Function]",aj="[object Object]",sj={};function cj(e,t,r,n,i,o){var a,s=1&t,c=2&t,u=4&t;if(r&&(a=i?r(e,n,i,o):r(e)),void 0!==a)return a;if(!zV(e))return e;var d=HV(e);if(d){if(a=function(e){var t=e.length,r=new e.constructor(t);return t&&"string"==typeof e[0]&&qB.call(e,"index")&&(r.index=e.index,r.input=e.input),r}(e),!s)return function(e,t){var r=-1,n=e.length;for(t||(t=Array(n));++r<n;)t[r]=e[r];return t}(e,a)}else{var l=KB(e),h=l==oj||"[object GeneratorFunction]"==l;if(jF(e))return function(e,t){if(t)return e.slice();var r=e.length,n=kB?kB(r):new e.constructor(r);return e.copy(n),n}(e,s);if(l==aj||l==ij||h&&!i){if(a=c||h?{}:function(e){return"function"!=typeof e.constructor||OF(e)?{}:cF(gB(e))}(e),!s)return c?function(e,t){return IF(e,CB(e),t)}(e,function(e,t){return e&&IF(t,iB(t),e)}(a,e)):function(e,t){return IF(e,RB(e),t)}(e,function(e,t){return e&&IF(t,tB(t),e)}(a,e))}else{if(!sj[l])return i?e:{};a=$B(e,l,s)}}o||(o=new yB);var v=o.get(e);if(v)return v;o.set(e,a),nj(e)?e.forEach((function(n){a.add(cj(n,t,r,n,e,o))})):tj(e)&&e.forEach((function(n,i){a.set(i,cj(n,t,r,i,e,o))}));var p=d?void 0:(u?c?OB:xB:c?iB:tB)(e);return function(e,t){for(var r=-1,n=null==e?0:e.length;++r<n&&!1!==t(e[r],r,e););}(p||e,(function(n,i){p&&(n=e[i=n]),TF(a,i,cj(n,t,r,i,e,o))})),a}sj[ij]=sj["[object Array]"]=sj["[object ArrayBuffer]"]=sj["[object DataView]"]=sj["[object Boolean]"]=sj["[object Date]"]=sj["[object Float32Array]"]=sj["[object Float64Array]"]=sj["[object Int8Array]"]=sj["[object Int16Array]"]=sj["[object Int32Array]"]=sj["[object Map]"]=sj["[object Number]"]=sj[aj]=sj["[object RegExp]"]=sj["[object Set]"]=sj["[object String]"]=sj["[object Symbol]"]=sj["[object Uint8Array]"]=sj["[object Uint8ClampedArray]"]=sj["[object Uint16Array]"]=sj["[object Uint32Array]"]=!0,sj["[object Error]"]=sj[oj]=sj["[object WeakMap]"]=!1;function uj(e){return cj(e,5)}function dj(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 lj(e){return null==e?[]:dj(e,tB(e))}var hj,vj=new cO("ChromeHandler",3),pj=BD(),_j=function(e){OI(l,e);var t,r,n,i,o,a,s,c,u,d=YI(l);function l(e){var t;return Ll(this,l),Qd($T(t=d.call(this,e)),"name","chrome"),Qd($T(t),"_queueBusy",!1),Qd($T(t),"_sdpQueue",void 0),Qd($T(t),"_aSendonlyOfferTpl",void 0),Qd($T(t),"_vSendonlyOfferTpl",void 0),Qd($T(t),"_aRecvonlyOfferTpl",void 0),Qd($T(t),"_vRecvonlyOfferTpl",void 0),Qd($T(t),"_mid",10),Qd($T(t),"_offerSession",void 0),Qd($T(t),"_answerSession",void 0),Qd($T(t),"_offerMlines",[]),Qd($T(t),"_answerMlines",[]),Qd($T(t),"_inactiveMlineIndex",[]),Qd($T(t),"_mlinesCache",{}),t._sdpQueue=new xV,t._sdpQueue.on("start",(function(){t._queueBusy||"stable"!==t._peerConnection.signalingState||(vj.print("dequeue start"),t.dequeue())})),t}return Dl(l,[{key:"connect",value:(u=Tm(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:return vj.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,mL(this.id,t);case 4:return this._answerIce=e.sent,this._connectionId=this._answerIce.iceUfrag,e.next=8,this._peerConnection.createOffer();case 8:return i=e.sent,this.peerConnectionId=this._answerIce.iceUfrag,o=WD.parse(i.sdp),a=ZT(o.media,1),s=a[0],this._offerIce.fingerprint=o.fingerprint||s.fingerprint,delete o.media,this._offerSession=Zd({},o),this._answerSession=Zd({},o),this._answerSession.fingerprint&&(this._answerSession.fingerprint=this._answerIce.fingerprint),this._offerMlines=[Zd(Zd(Zd({},s),this._offerIce),{},{mid:"".concat(0)})],this._answerMlines=[Zd(Zd(Zd({},s),this._answerIce),{},{sctpmap:{sctpmapNumber:5e3,app:"webrtc-datachannel",maxMessageSize:262144},mid:"".concat(0)})],this.setDescription(),e.next=23,new qf((function(e,t){c._dataChannel.onopen=function(){vj.print("connect","dataChannel open"),c._reportRtcInvokeStatus("es.dc.open",""),e("")},c._dataChannel.onerror=function(e){c._report("rtc_signaling_msg_error",{error_code:e.error.sdpLineNumber,message:e.error.errorDetail,reason:"invalid data"}),c._reportRtcInvokeStatus("es.dc.error",""),t(e)},c._dataChannel.onclose=function(e){c._reportRtcInvokeStatus("es.dc.close",""),t(e)},c._peerConnection.addEventListener("connectionstatechange",(function(e){"failed"!==c._peerConnection.iceConnectionState&&"closed"!==c._peerConnection.iceConnectionState&&"failed"!==c._peerConnection.connectionState||t(e)}))}));case 23:return vj.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(){var e;this._peerConnection.close(),null===(e=this._dataChannel)||void 0===e||e.close(),this._peerConnection.ontrack=null}},{key:"destroy",value:function(){wI(RI(l.prototype),"destroy",this).call(this),this._mlinesCache={}}},{key:"publish",value:(c=Tm(Em().mark((function e(t){var r,n,i,o,a,s,c,u,d,h,v,p,_,f,m,g,y,S,b,E,k,T,I,A,R,C,w,x,O,P,M,N,D,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(RI(l.prototype),"internalPublish",this).call(this,t),v=h.videoDescriptions,p=h.subVideoDescriptions,_=h.audioTransceiverInit,f=h.videoTransceiverInit,m=hL(this._nextSsrc),this._nextSsrc=m.next,g="".concat(this._mid++),y="".concat(this._mid++),S=Zd(Zd(Zd({},this._aSendonlyOfferTpl),this._offerIce),{},{mid:g,msid:wm(r="".concat(u.id," ")).call(r,u.id,"-audio"),ssrcs:vL(u.id,"audio",m.audio,uL)}),b=Zd(Zd(Zd({},this._vSendonlyOfferTpl),this._offerIce),{},{mid:y,msid:wm(n="".concat(u.id," ")).call(n,u.id,"-video")}),d?(vj.print("subVideoDesc","desc: %o ",p),delete b.ssrcGroups,delete b.ssrcs,E=[],b.rids=Fm(v).call(v,(function(e){var t=e.rid;return E.unshift(t),{id:t,direction:"send"}})),b.simulcast={dir1:"send",list1:E.join(";")}):(k=pL(u.id,m,{cname:uL}),T=k.ssrcs,I=k.ssrcGroups,b.ssrcs=T,b.ssrcGroups=I),null!==(i=this._context)&&void 0!==i&&null!==(o=i.serverConfig)&&void 0!==o&&o.audioRed&&Array.isArray(S.rtp)&&(-1!==(R=YA(A=S.rtp).call(A,(function(e){return"red"===e.codec})))&&(w=ek(C=S.rtp).call(C,R,1),x=ZT(w,1),O=x[0],S.rtp.unshift(O)),P=[],S.rtp.forEach((function(e){return P.push(e.payload)})),S.payloads=P.join(" ")),null!==(a=this._context)&&void 0!==a&&null!==(s=a.serverConfig)&&void 0!==s&&s.videoCodec&&bL(b,null===(M=this._context)||void 0===M||null===(N=M.serverConfig)||void 0===N?void 0:N.videoCodec),(cP||_P)&&Array.isArray(b.ext)&&(b.ext=Gs(D=b.ext).call(D,(function(e){var t;return!(null!=e&&null!==(t=e.uri)&&void 0!==t&&_k(t).call(t,"video-orientation"))}))),(L=null==S?void 0:mE(c=S.rtp).call(c,(function(e){return"opus"===e.codec})))&&S.fmtp&&(F=mE(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||cP||this.addBitrateLimit(b,t.videoEncodeConfig[0].maxKbps),this._mlinesCache[t.stream.id]=[S,b],e.abrupt("return",{partialSdp:fL(this._offerSession,S,b),audioMid:g,videoMid:y,type:"incroffer",semantics:"unified-plan",videoDescriptions:v,subVideoDescriptions:p,audioTransceiverInit:_,videoTransceiverInit:f,peerConnectionMode:this.peerConnectionMode});case 17:case"end":return e.stop()}}),e,this)}))),function(e){return c.apply(this,arguments)})},{key:"subscribe",value:(s=Tm(Em().mark((function e(t,r){var n,i,o,a,s,c,u,d,l,h,v,p,_,f,m,g,y,S,b,E,k,T,I,A,R,C,w,x,O,P,M,N,D,L,U,V=this;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(vj.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,v=void 0,p=void 0,this._mlinesCache[t.streamId]=[v,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&&(v=Zd(Zd({},uj(this._aRecvonlyOfferTpl)),{},{mid:u})),l&&(this._mlinesCache[t.streamId][0]=v,_={track:"audio",init:{direction:"recvonly"}}),d&&(p=Zd(Zd({},uj(this._vRecvonlyOfferTpl)),{},{mid:d})),h&&(this._mlinesCache[t.streamId][1]=p,f={track:"video",init:{direction:"recvonly"}}),m=fL(this._offerSession,v,p),g=void 0,t.enableVendorMode||r.multiChatMode||t.virtual||!this._aSendonlyAnswerTpl||!this._vSendonlyAnswerTpl){e.next=32;break}return g=hL(this._nextSsrc),this._nextSsrc=g.next,A=Zd(Zd(Zd({},this._aSendonlyAnswerTpl),this._answerIce),{},{mid:u,msid:wm(y=wm(S="".concat(t.streamId)).call(S,null!==(b=this._context)&&void 0!==b&&b.avSync?"":"-audio"," ")).call(y,t.streamId,"-audio"),ssrcs:vL(t.streamId,"audio",g.audio)}),R=Zd(Zd(Zd({},this._vSendonlyAnswerTpl),this._answerIce),{},{mid:d,msid:wm(E=wm(k="".concat(t.streamId)).call(k,null!==(T=this._context)&&void 0!==T&&T.avSync?"":"-video"," ")).call(E,t.streamId,"-video")},pL(t.streamId,g,{flexfec:this._enableSubFlexfec})),C=new qf((function(e){V._sdpQueue.enqueue({action:RV.subscribe,streamId:t.streamId,audioMid:u,videoMid:d,audioTransceiverInit:_,videoTransceiverInit:f,signalingAck:{sdp:WD.write(Zd(Zd({},V._answerSession),{},{media:[A,R]})),sequenceId:t.sequenceId?++t.sequenceId:0},stream:t,sdp:m,onSuccess:function(){vj.print("subscribe()","sub success"),e(0)}})})),e.next=31,C;case 31:null===(I=g)||void 0===I||delete I.next;case 32:return(w=null===(n=v)||void 0===n?void 0:mE(i=n.rtp).call(i,(function(e){return"opus"===e.codec})))&&null!==(o=v)&&void 0!==o&&o.fmtp&&(P=null===(x=v)||void 0===x?void 0:mE(O=x.fmtp).call(O,(function(e){return e.payload===w.payload})))&&this._context&&(P.config+=";stereo=1;sprop-stereo=1"),t.isPublic&&AP>=86&&null!=(L=null===(M=p)||void 0===M?void 0:Gs(N=M.rtp).call(N,(function(e){return"H264"===e.codec})))&&L.length&&null!==(D=p)&&void 0!==D&&D.fmtp&&(null===(U=p)||void 0===U||U.fmtp.forEach((function(e){mE(L).call(L,(function(t){return t.payload===e.payload}))&&(e.config+=";sps-pps-idr-in-keyframe=1")}))),e.abrupt("return",{partialSdp:m,audioMid:u,videoMid:d,type:a,semantics:s,audioTransceiverInit:_,videoTransceiverInit:f,allSsrc:g,peerConnectionMode:this.peerConnectionMode});case 36:case"end":return e.stop()}}),e,this)}))),function(e,t){return s.apply(this,arguments)})},{key:"handleAck",value:(a=Tm(Em().mark((function e(t){return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(vj.print("handleAck()","item: %o",t),!t.generatorSsrc){e.next=4;break}return vj.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=Tm(Em().mark((function e(){var t,r,n,i,o,a,s,c,u,d,l,h,v,p,_,f=this;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._queueBusy=!0,t=this._sdpQueue.dequeue(),vj.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!==AV.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=Zd({},f._answerIce)).candidates,s=!1,c=!1,e.prev=4,d=YM(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 TV;if(n.onSuccess&&a.push(n.onSuccess),h&&(null==d?void 0:d.sequenceId)<l.sequenceId)return"break";var v,p={},_={},m=WD.parse(d.sdp);Array.isArray(m.media)&&FA(v=m.media).call(v,(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=Zd(Zd({},n),t)).type?(p=n).mid=e:(_=n).mid=r}));var g,y=l.streamId;if(s===RV.publish&&(y=null===(g=l.stream)||void 0===g?void 0:g.id),!f._mlinesCache[y])return"break";var S=ZT(f._mlinesCache[y],2),b=S[0],E=S[1];if(c&&b){l.audioTransceiver=f._peerConnection.addTransceiver(c.track,c.init),f._reportRtcInvokeStatus("chromeHandler.addTrack",Mm({audioStreamTrack:$O(c.track)}));var k=f._inactiveMlineIndex.shift();k||(k=f._offerMlines.length),f._offerMlines[k]=Zd({},b),f._answerMlines[k]=p,pj&&l.initAudioEncodedTransform()}if(u&&E){var T,I;l.videoTransceiver=f._peerConnection.addTransceiver(u.track,u.init),f._reportRtcInvokeStatus("chromeHandler.addTrack",Mm({videoStreamTrack:$O(u.track)}));var A,R,C=f._inactiveMlineIndex.shift();C||(C=f._offerMlines.length),f._offerMlines[C]=Zd({},E),s===RV.publish&&null!==(T=f._context)&&void 0!==T&&null!==(I=T.serverConfig)&&void 0!==I&&I.videoCodec&&bL(_,null===(A=f._context)||void 0===A||null===(R=A.serverConfig)||void 0===R?void 0:R.videoCodec),f._answerMlines[C]=_,pj&&l.initVideoEncodedTransform()}i.push(l.streamId||""),o.push(h?l.userId:"local"),h&&(l.sequenceId=null==d?void 0:d.sequenceId),delete f._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:_={},r.forEach((function(e){var t=e.audioMid,r=e.videoMid,n=e.action;_[t]=t,n!==RV.removetrack&&(_[r]=r),_[t]=t})),this._offerMlines=Fm(h=this._offerMlines).call(h,(function(e,t){return _[e.mid]&&(e=_L(e),f._inactiveMlineIndex.push(t)),e})),FA(v=this._inactiveMlineIndex).call(v,(function(e,t){return e-t})),this._answerMlines=Fm(p=this._answerMlines).call(p,(function(e){return _[e.mid]&&(e=_L(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(TK){}vj.print("dequeue","loop"),e.next=29;break;case 26:e.prev=26,e.t1=e.catch(6),vj.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=Tm(Em().mark((function e(t){var r,n;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return vj.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=PO(),t&&this._report("rtc_begin_create_offer",{direction:"local"===t.streamUserId?"up":"down",stream_id:t.streamId,stream_user_id:t.streamUserId,pc_session_id:this.peerConnectionId,vendor_mode:0}),e.next=10,this._peerConnection.createOffer();case 10:return t&&this._report("rtc_create_offer",{error_code:0,direction:"local"===t.streamUserId?"up":"down",stream_id:t.streamId,stream_user_id:t.streamUserId,elapse:PO()-n}),e.next=13,this.setLocalDescription(WD.write(this._offerSession),t);case 13:return e.next=15,this.setRemoteDescription(WD.write(this._answerSession),t);case 15:case"end":return e.stop()}}),e,this)}))),function(e){return i.apply(this,arguments)})},{key:"getDefaultSdp",value:(n=Tm(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=WD.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:WD.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=Tm(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;WD.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=Tm(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,KO(!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 hR(dR.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}(TL),fj=new cO("FirefoxHandler",3),mj=function(e){OI(l,e);var t,r,n,i,o,a,s,c,u,d=YI(l);function l(){var e,t;Ll(this,l);for(var r=arguments.length,n=new Array(r),i=0;i<r;i++)n[i]=arguments[i];return Qd($T(t=d.call.apply(d,wm(e=[this]).call(e,n))),"name","firefox"),Qd($T(t),"_aRecvonlyOfferTpl",void 0),t}return Dl(l,[{key:"connect",value:(u=Tm(Em().mark((function e(t){var r,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 fj.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,mL(this.id,t);case 4:return this._answerIce=e.sent,this._connectionId=this._answerIce.iceUfrag,this.peerConnectionId=this._answerIce.iceUfrag,this._peerConnection.addTransceiver("audio",{direction:"recvonly"}),this._peerConnection.addTransceiver("video",{direction:"recvonly"}),e.next=11,this._peerConnection.createOffer();case 11:return s=e.sent,c=WD.parse(s.sdp),u=ZT(c.media,1),d=u[0],this._offerIce.fingerprint=c.fingerprint||d.fingerprint,c.media=Fm(i=c.media).call(i,(function(e){return Zd(Zd({},e),h._offerIce)})),Fm(o=c.media).call(o,(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===CE(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})))})),(l=Zd({},c)).fingerprint=this._answerIce.fingerprint,l.media=Fm(a=l.media).call(a,(function(e){return delete(e=Zd(Zd({},e),h._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(WD.write(c));case 22:return e.next=24,this.setRemoteDescription(WD.write(l));case 24:return e.next=26,new qf((function(e,t){h._dataChannel.onopen=function(){fj.print("connect","dataChannel open"),h._reportRtcInvokeStatus("es.dc.open",""),e("")},h._dataChannel.onerror=function(e){h._report("rtc_signaling_msg_error",{error_code:e.error.sdpLineNumber,message:e.error.errorDetail,reason:"invalid data"}),h._reportRtcInvokeStatus("es.dc.error",""),t(e)},h._dataChannel.onclose=function(e){h._reportRtcInvokeStatus("es.dc.close",""),t(e)},h._peerConnection.addEventListener("connectionstatechange",(function(e){"failed"!==h._peerConnection.iceConnectionState&&"closed"!==h._peerConnection.iceConnectionState&&"failed"!==h._peerConnection.connectionState||t(e)}))}));case 26:return fj.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=Tm(Em().mark((function e(t){var r,n,i,o,a,s,c,u,d,h,v,p,_,f,m=this;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=wI(RI(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=PO(),this._report("rtc_begin_create_offer",{direction:"up",stream_id:"",stream_user_id:"",pc_session_id:this.peerConnectionId,vendor_mode:0}),e.next=7,this._peerConnection.createOffer();case 7:return d=e.sent,this._report("rtc_create_offer",{direction:"up",error_code:0,stream_id:"",stream_user_id:"",elapse:PO()-u}),(h=WD.parse(d.sdp)).media=null===(r=h.media)||void 0===r?void 0:Fm(r).call(r,(function(e){return Zd(Zd({},e),m._offerIce)})),e.next=13,this.setLocalDescription(WD.write(h));case 13:return v=t.audioTransceiver.mid,p=t.videoTransceiver.mid,_=null,f=null,h.media=null===(n=h.media)||void 0===n?void 0:Fm(n).call(n,(function(e){if("".concat(e.mid)===v){var t,r,n=null===(t=_=e)||void 0===t?void 0:mE(r=t.rtp).call(r,(function(e){return"opus"===e.codec}));if(n&&_.fmtp){var i,o,a=mE(i=_.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&&bL(e,null===(u=m._context)||void 0===u||null===(d=u.serverConfig)||void 0===d?void 0:d.videoCodec),f=e}return e})),this.addBitrateLimit(f,t.videoEncodeConfig[0].maxKbps),e.next=21,this.setLocalDescription(WD.write(h));case 21:return e.abrupt("return",{partialSdp:fL(h,_,f,!1),audioMid:v,videoMid:p,type:"incroffer",semantics:"unified-plan",videoDescriptions:o,subVideoDescriptions:a,audioTransceiverInit:s,videoTransceiverInit:c,peerConnectionMode:this.peerConnectionMode});case 22:case"end":return e.stop()}}),e,this)}))),function(e){return c.apply(this,arguments)})},{key:"subscribe",value:(s=Tm(Em().mark((function e(t,r){var n,i,o,a,s,c,u,d,l,h,v,p,_,f,m,g,y,S,b,E,k,T,I,A,R=this;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return fj.print("subscribe()"),c="",u="",d=!1,l=!1,h=void 0,v=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=PO(),this._report("rtc_begin_create_offer",{direction:"up",stream_id:t.streamId,stream_user_id:t.userId,pc_session_id:this.peerConnectionId,vendor_mode:0}),e.next=14,this._peerConnection.createOffer();case 14:return _=e.sent,this._report("rtc_create_offer",{error_code:0,direction:"up",stream_id:t.streamId,stream_user_id:t.userId,elapse:PO()-p}),(f=WD.parse(_.sdp)).media=null===(n=f.media)||void 0===n?void 0:Fm(n).call(n,(function(e){return Zd(Zd({},e),R._offerIce)})),Fm(i=f.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===CE(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(WD.write(f),{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=f.media)||void 0===s||s.forEach((function(e){"".concat(e.mid)===c?h=e:"".concat(e.mid)===u&&(v=e)})),c&&h||(c="audio_".concat(u),h=Zd(Zd({},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=hL(this._nextSsrc),this._nextSsrc=m.next,I=Zd(Zd(Zd({},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:vL(t.streamId,"audio",m.audio)}),A=Zd(Zd(Zd({},this._vSendonlyAnswerTpl),this._answerIce),{},{mid:u,msid:wm(b=wm(E="".concat(t.streamId)).call(E,null!==(k=this._context)&&void 0!==k&&k.avSync?"":"-video"," ")).call(b,t.streamId,"-video")},pL(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(f,h,v,!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,peerConnectionMode:this.peerConnectionMode});case 37:case"end":return e.stop()}}),e,this)}))),function(e,t){return s.apply(this,arguments)})},{key:"handleAck",value:(a=Tm(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)!==RV.unpublish&&i!==RV.unsubscribe&&i!==RV.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 fj.print("already set remote"),e.abrupt("return","");case 8:return o=WD.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=Tm(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=WD.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=Zd(Zd({},e),l._answerIce)).type&&(r.audioMid?(e.mid=r.audioMid,s[r.audioMid]=e):s[e.mid]=e),"video"===e.type){if(r instanceof kV&&EP<=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=WD.parse(null===(i=this._peerConnection.localDescription)||void 0===i?void 0:i.sdp),d=Fm(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,Fm(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===CE(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(WD.write(c));case 11:case"end":return e.stop()}}),e,this)}))),function(e,t){return o.apply(this,arguments)})},{key:"getDefaultSdp",value:(i=Tm(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=WD.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:WD.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=Tm(Em().mark((function e(t,r,n){return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return fj.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=Tm(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 fj.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=WD.parse(null==c?void 0:c.sdp)).media=Fm(n=u.media).call(n,(function(e){return a[e.mid]&&(e=_L(e)),"inactive"!==e.direction&&s.push(e.mid),Zd(Zd({},e),h._offerIce)})),d=WD.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=Fm(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(WD.write(u));case 17:return e.next=19,this.setRemoteDescription(WD.write(d));case 19:case"end":return e.stop()}}),e,this)}))),function(e,t){return r.apply(this,arguments)})},{key:"setCurrentDescription",value:(t=Tm(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;WD.parse(e).media.forEach((function(e){"audio"===e.type&&(t._aRecvonlyOfferTpl=e)}))}}]),l}(TL),gj=function(e){return sP?new mj(e):new _j(e)},yj=new cO("Locker",2),Sj=1,bj=function(){function e(t){var r;Ll(this,e),Qd(this,"lockingPromise",qf.resolve()),Qd(this,"locks",0),Qd(this,"name",""),Qd(this,"lockId",void 0),this.lockId=Sj++,t&&(this.name=t),yj.print(wm(r="[lock-".concat(this.name,"-")).call(r,this.lockId,"] is created."))}return Dl(e,[{key:"isLocked",get:function(){return this.locks>0}},{key:"lock",value:function(){var e,t,r,n=this;this.locks+=1,yj.print(wm(e=wm(t="[lock-".concat(this.name,"-")).call(t,this.lockId,"] locked, current queue ")).call(e,this.locks,"."));var i=new qf((function(e){r=function(){var t,r;n.locks-=1,yj.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}(),Ej=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}(Ej||{}),kj=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}(kj||{}),Tj=function(e){return e[e.PUB=0]="PUB",e[e.UNPUB=1]="UNPUB",e}(Tj||{}),Ij=function(e){return e[e.SUB=0]="SUB",e[e.UNSUB=1]="UNSUB",e}(Ij||{}),Aj=(Qd(hj={},bl.communication,[0]),Qd(hj,bl.chat,[0]),Qd(hj,bl.chatRoom,[1,"IES_chatroom"]),Qd(hj,bl.coHost,[1,"IES_PK"]),Qd(hj,bl.meeting,[16]),Qd(hj,bl.classRoom,[0]),hj),Rj=BD(),Cj=function(e){OI(s,e);var t,r,n,i,o,a=YI(s);function s(e){var t;return Ll(this,s),Qd($T(t=a.call(this,e,!1)),"peerConnectionId",OO()),Qd($T(t),"peerConnectionMode",1),Qd($T(t),"name","vendor"),Qd($T(t),"direction","up"),Qd($T(t),"stream",void 0),t.on("ice_state",(function(e){t._report("rtc_ice_state",{pc_session_id:t.peerConnectionId,direction:t.direction,error_code:0,ice_state:e.toUpperCase(),message:"",peer_connection_id:t.peerConnectionId,stream_id:"",stream_user_id:""})})),t}return Dl(s,[{key:"publish",value:(o=Tm(Em().mark((function e(t){var r,n,i,o,a,c,u,d,l,h,v=this;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t.enableSimulcast=!1,this.stream=t,r=wI(RI(s.prototype),"internalPublish",this).call(this,t),n=r.videoDescriptions,i=r.subVideoDescriptions,o=r.audioTransceiverInit,a=r.videoTransceiverInit,t.audioTransceiver=this._peerConnection.addTransceiver(o.track,o.init),t.videoTransceiver=this._peerConnection.addTransceiver(a.track,a.init),Rj&&(t.initAudioEncodedTransform(),t.initVideoEncodedTransform()),this._report("rtc_begin_create_offer",{direction:"up",stream_id:"",stream_user_id:"",pc_session_id:this.peerConnectionId,vendor_mode:(null==t?void 0:t.vendorCode)||0}),e.next=9,this._peerConnection.createOffer();case 9:return c=e.sent,u=PO(),d=WD.parse(c.sdp),Array.isArray(d.media)&&(d.media=Fm(l=d.media).call(l,(function(e){var r,n,i,o,a;if("video"===e.type)null!==(r=v._context)&&void 0!==r&&null!==(n=r.serverConfig)&&void 0!==n&&n.videoCodec&&bL(e,null===(i=v._context)||void 0===i||null===(o=i.serverConfig)||void 0===o?void 0:o.videoCodec),(cP||_P)&&Array.isArray(e.ext)&&(e.ext=Gs(a=e.ext).call(a,(function(e){var t;return!(null!=e&&null!==(t=e.uri)&&void 0!==t&&_k(t).call(t,"video-orientation"))}))),cP||v.addBitrateLimit(e,t.videoEncodeConfig[0].maxKbps);else if("audio"===e.type){var s,c=null==e?void 0:mE(s=e.rtp).call(s,(function(e){return"opus"===e.codec}));if(c&&e.fmtp){var u,d,l=mE(u=e.fmtp).call(u,(function(e){return e.payload===c.payload}));l&&null!==(d=v._context)&&void 0!==d&&d.audioProfileManager&&(l.config=v._context.audioProfileManager.getOpusConfigStr(l.config))}}return e}))),h=new RTCSessionDescription({type:"offer",sdp:WD.write(d)}),e.prev=14,e.next=17,this._peerConnection.setLocalDescription(h);case 17:this._report("rtc_set_description",{error_code:0,message:h.sdp||"",is_local:"1",direction:"up",stream_id:"",stream_user_id:"",elapse:PO()-u},{type:"offer"}),e.next=24;break;case 20:throw e.prev=20,e.t0=e.catch(14),this._report("rtc_set_description",{error_code:-1,message:e.t0.message+h.sdp,is_local:"1",direction:"up",stream_id:"",stream_user_id:"",elapse:PO()-u},{type:"offer"}),e.t0;case 24:return e.abrupt("return",{partialSdp:h.sdp||"",audioMid:"0",videoMid:"1",type:"offer",semantics:"unified-plan",videoDescriptions:n,subVideoDescriptions:i,audioTransceiverInit:o,videoTransceiverInit:a,peerConnectionMode:this.peerConnectionMode,peerConnectionId:this.peerConnectionId});case 25:case"end":return e.stop()}}),e,this,[[14,20]])}))),function(e){return o.apply(this,arguments)})},{key:"subscribe",value:(i=Tm(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:return this.stream=t,this.direction="down",t.audioTransceiver=this._peerConnection.addTransceiver("audio",{direction:"recvonly"}),t.videoTransceiver=this._peerConnection.addTransceiver("video",{direction:"recvonly"}),Rj&&(t.initAudioEncodedTransform(),t.initVideoEncodedTransform()),this._report("rtc_begin_create_offer",{direction:"down",stream_id:t.streamId,stream_user_id:t.userId,pc_session_id:this.peerConnectionId,vendor_mode:t.vendorCode||0}),e.next=8,this._peerConnection.createOffer();case 8:return r=e.sent,n=PO(),i=WD.parse(r.sdp),Array.isArray(i.media)&&(i.media=Fm(o=i.media).call(o,(function(e){if("audio"===e.type){var t,r=null==e?void 0:mE(t=e.rtp).call(t,(function(e){return"opus"===e.codec}));if(r&&null!=e&&e.fmtp){var n,i=null==e?void 0:mE(n=e.fmtp).call(n,(function(e){return e.payload===r.payload}));i&&s._context&&(i.config+=";stereo=1;sprop-stereo=1")}}return e}))),a=new RTCSessionDescription({type:"offer",sdp:WD.write(i)}),e.prev=13,e.next=16,this._peerConnection.setLocalDescription(a);case 16:this._report("rtc_set_description",{error_code:0,message:a.sdp||"",is_local:"1",direction:"down",stream_id:t.streamId,stream_user_id:t.userId,elapse:PO()-n},{type:"offer"}),e.next=23;break;case 19:throw e.prev=19,e.t0=e.catch(13),this._report("rtc_set_description",{error_code:-1,message:e.t0.message+a.sdp,is_local:"1",direction:"down",stream_id:t.streamId,stream_user_id:t.userId,elapse:PO()-n},{type:"offer"}),e.t0;case 23:return e.abrupt("return",{partialSdp:a.sdp||"",audioMid:"0",videoMid:"1",type:"offer",semantics:"unified-plan",peerConnectionMode:this.peerConnectionMode,peerConnectionId:this.peerConnectionId});case 24:case"end":return e.stop()}}),e,this,[[13,19]])}))),function(e){return i.apply(this,arguments)})},{key:"handleAck",value:(n=Tm(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:if(t.action!==RV.publish&&t.action!==RV.subscribe){e.next=16;break}return n=new RTCSessionDescription({sdp:null===(r=t.signalingAck)||void 0===r?void 0:r.sdp,type:"answer"}),i=PO(),e.prev=3,e.next=6,this._peerConnection.setRemoteDescription(n);case 6:this._report("rtc_set_description",{error_code:0,message:n.sdp||"",is_local:"1",direction:"down",stream_id:null===(o=t.stream)||void 0===o?void 0:o.userId,stream_user_id:(null===(a=t.stream)||void 0===a?void 0:a.streamId)||"",elapse:PO()-i},{type:"answer"}),e.next=13;break;case 9:throw e.prev=9,e.t0=e.catch(3),this._report("rtc_set_description",{error_code:-1,message:e.t0.message+n.sdp,is_local:"1",direction:"down",stream_id:null===(s=t.stream)||void 0===s?void 0:s.userId,stream_user_id:(null===(c=t.stream)||void 0===c?void 0:c.streamId)||"",elapse:PO()-i},{type:"offer"}),e.t0;case 13:"function"==typeof t.onSuccess&&t.onSuccess(),e.next=17;break;case 16:t.action!==RV.unpublish&&t.action!==RV.unsubscribe||this.destroy();case 17:return e.abrupt("return","");case 18:case"end":return e.stop()}}),e,this,[[3,9]])}))),function(e){return n.apply(this,arguments)})},{key:"getDefaultSdp",value:(r=Tm(Em().mark((function e(){return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",{sdp:"",type:"offer",semantics:""});case 1:case"end":return e.stop()}}),e)}))),function(){return r.apply(this,arguments)})},{key:"connect",value:function(){throw new Error("Method not implemented.")}},{key:"rollback",value:(t=Tm(Em().mark((function e(){return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:try{this._peerConnection.close()}catch(t){}case 1:case"end":return e.stop()}}),e,this)}))),function(){return t.apply(this,arguments)})}]),s}(TL),wj=ad,xj=tc,Oj=function(e,t,r,n){for(var i,o=n>1?void 0:n?xj(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&&wj(t,r,o),o},Pj=new cO("MediaServerClient",2),Mj=6e4,Nj=function(e){return e.DISCONNECTED="disconnected",e.DISCONNECTING="disconnecting",e.CONNECTED="connected",e.CONNECTING="connecting",e}(Nj||{}),Dj=function(e,t){Pj.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)},Lj=function(e){OI(k,e);var t,r,n,i,o,a,s,c,u,d,l,h,v,p,_,f,m,g,y,S,b,E=YI(k);function k(e){var t;return Ll(this,k),Qd($T(t=E.call(this)),"id",void 0),Qd($T(t),"_token",void 0),Qd($T(t),"_appId",void 0),Qd($T(t),"_roomId",void 0),Qd($T(t),"_roomAttributes",void 0),Qd($T(t),"_vendorConfig",{enableMultiVendor:!1,vendorCode:0}),Qd($T(t),"_clientId",void 0),Qd($T(t),"_businessId",void 0),Qd($T(t),"_userInfo",void 0),Qd($T(t),"_useCloudProxy",void 0),Qd($T(t),"_expectedIDC",void 0),Qd($T(t),"_authorization",void 0),Qd($T(t),"_sessionId",void 0),Qd($T(t),"_iceConfigRequestManager",void 0),Qd($T(t),"_ontrackCallbackMap",new JS),Qd($T(t),"_subResolves",{}),Qd($T(t),"supportConcurrent",!1),Qd($T(t),"_handler",void 0),Qd($T(t),"_pubSubLock",void 0),Qd($T(t),"_joinLeaveLock",void 0),Qd($T(t),"_state",void 0),Qd($T(t),"_dataChannelSignal",void 0),Qd($T(t),"_subConfig",{}),Qd($T(t),"_monitor",void 0),Qd($T(t),"_roomProfile",bl.communication),Qd($T(t),"_context",void 0),Qd($T(t),"_subStreamQueue",{}),t.id=e.id,t._monitor=kO(t.id),t._pubSubLock=new bj("pubSubLock"),t._joinLeaveLock=new bj("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 Dl(k,[{key:"_addHandlerEvents",value:function(){var e,t=this;null===(e=this._handler)||void 0===e||e.once("disconnect",(function(){Pj.print("emit ABNORMAL_DISCONNECTION ice"),t.safeEmit(PM.ABNORMAL_DISCONNECTION)}))}},{key:"_addSignalEventHandler",value:function(){var e,t=this;[xM.ON_ADD_STREAM,xM.ON_ADD_STREAM_LIST,xM.ON_REMOVE_STREAM,xM.ON_REMOVE_STREAM_LIST,xM.USER_CONNECTION,xM.USER_CONNECTION_LIST,xM.USER_DISCONNECTION,xM.USER_DISCONNECTION_LIST,xM.ON_UPDATE_STREAM_ATTRIBUTES,xM.ON_UPDATE_ROOM_ATTRIBUTES,xM.ON_PUSH_TRACK,xM.NODE_CHANGE,xM.ON_CUSTOM_MESSAGE,xM.USER_MESSAGE_RECEIVED,xM.USER_BINARY_MESSAGE_RECEIVED,xM.POST_PROCESSING_MESSAGE,xM.ON_USER_TOKEN_WILL_EXPIRE,xM.STREAM_CONTROL_MESSAGE,xM.ON_UPDATE_USER_ATTRIBUTES,xM.ON_SPEAKER_CHANGE,OM.RSCP,OM.RTT,xM.ON_STREAM_FAILED,xM.ON_NOTIFY_RECONNECT,OM.SSC].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(){Pj.print("emit ABNORMAL_DISCONNECTION datachannel"),t.safeEmit(PM.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(PM.ON_CONNECTION_STATE_CHANGE,{prev:this._state,next:e}),this._state=e)}},{key:"businessId",set:function(e){this._businessId=e}},{key:"connect",value:(b=Tm(Em().mark((function e(t){var 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>1&&void 0!==u[1]?u[1]:{},this.connectionState="connecting",this._appId=t,this._handler&&(this._removeSignalEventHandler(),this._handler.destroy()),!r.node){e.next=9;break}n=[r.node],AO(this.id,"es.join.nodeChange",r),e.next=18;break;case 9:return qf.resolve().then((function(){return c.emit("onGetIceConfigHook")})),this._iceConfigRequestManager=new KM(this.id),e.next=13,null===(i=this._iceConfigRequestManager)||void 0===i?void 0:i.getAccessNode(t,null==r?void 0:r.reason,null==r?void 0:r.feedbackNode,this._useCloudProxy,this._expectedIDC);case 13:if(n=e.sent){e.next=17;break}throw AO(this.id,"es.join.getNodeFailed",""),new hR(dR.ICE_SERVER_WRONG,"get ICE config failed");case 17:AO(this.id,"es.join.getNodeSuccess",n);case 18:return qf.resolve().then((function(){return c.emit("onEstablishConnectionHook")})),e.prev=19,a=!1,s=Fm(n).call(n,(function(e){var t=gj(c._context);return t.connect(e).then((function(r){var i,s;c.emit("onConnectSuccessHook",null===(i=n)||void 0===i?void 0:i.length),a?t.destroy():(a=!0,o=r,c.safeEmit("prevIceNode",e),c._handler=t,c.supportConcurrent="chrome"===t.name,c._addHandlerEvents(),null===(s=c._monitor)||void 0===s||s.set({connection_id:t.getConnectionId()}))})).catch((function(e){throw t.destroy(),e}))})),e.next=24,qO(s);case 24:Pj.print("connect","establish peerConnection success"),e.next=31;break;case 27:throw e.prev=27,e.t0=e.catch(19),this.connectionState="disconnected",new hR(dR.ESTABLISH_DATACHANNEL_FAILED,"establish dataChannel failed",e.t0);case 31:if(!o){e.next=37;break}this._dataChannelSignal=new HM(this.id,o),this._addSignalEventHandler(),this._dataChannelSignal.sendPingSignaling(),e.next=39;break;case 37:throw this.connectionState="disconnected",new hR(dR.ESTABLISH_DATACHANNEL_FAILED,"establish dataChannel failed");case 39:case"end":return e.stop()}}),e,this,[[19,27]])}))),function(e){return b.apply(this,arguments)})},{key:"join",value:(S=Tm(Em().mark((function e(t){var r,n,i,o,a,s,c,u,d,l,h,v,p,_,f,m,g,y=this,S=arguments;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=S.length>1&&void 0!==S[1]?S[1]:{},i=S.length>2&&void 0!==S[2]&&S[2],o=S.length>3?S[3]:void 0,Pj.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,this._handler){e.next=17;break}return e.next=17,this.connect(this._appId,n);case 17:return e.t0=NO.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=24,null===(r=this._handler)||void 0===r?void 0:r.getDefaultSdp();case 24:return e.t5=e.sent,e.next=27,wD();case 27:return e.t6=e.sent,e.t7=window.navigator.userAgent,e.t8=FP.VERSION,e.t9=NP.getDeviceId(),e.t10=this._appId,e.t11=this._roomId,e.t12=this._clientId,e.t13=this._businessId,e.t14=this._useCloudProxy,e.t15=Aj[this._roomProfile]?Aj[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,supportMultiVendor:!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},qf.resolve().then((function(){return y.emit("onSendingJoinMessageHook")})),e.prev=41,c=i?"reconnected":"joinRoom",e.next=45,this._dataChannelSignal.sendSignaling(c,a);case 45:return u=e.sent,Pj.print("join","send join message success"),d=u.config||{},l=d.engine_WEB,this._authorization=a.Authorization,this.connectionState="connected",NP.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:!(sP||!1===(null===(v=u.config)||void 0===v||null===(p=v.engine_VPM)||void 0===p||null===(_=p.ondemand)||void 0===_?void 0:_.enable)),forceUniHandler:1===(null==u||null===(f=u.config)||void 0===f||null===(m=f.vendor_param)||void 0===m?void 0:m.vendor_stream_sub_mode)},"boolean"==typeof(null==l?void 0:l.av_sync)&&(this._context.avSync=l.av_sync)),u.vendorConfig&&(this._vendorConfig=u.vendorConfig),mV.audioStallConfig=l,null!=u&&null!==(s=u.relayMessage)&&void 0!==s&&s.sdp&&(null===(g=this._handler)||void 0===g||g.createAVMlineAnswerTpl(u.relayMessage.sdp)),e.abrupt("return",u);case 58:if(e.prev=58,e.t18=e.catch(41),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=63;break}throw new hR(dR.INVALID_TOKEN,(null===e.t18||void 0===e.t18?void 0:e.t18.message)||"Invalid token");case 63:if(200===(null===e.t18||void 0===e.t18?void 0:e.t18.code)){e.next=65;break}throw new hR(dR.JOIN_ROOM_FAILED,(null===e.t18||void 0===e.t18?void 0:e.t18.message)||"Join room failed");case 65:case"end":return e.stop()}}),e,this,[[41,58]])}))),function(e){return S.apply(this,arguments)})},{key:"publish",value:(y=Tm(Em().mark((function e(t){var r,n,i,o,a,s,c,u,d,l,h,v,p,_,f,m,g,y,S,b,E,k,T,I,A,R,C,w,x=this;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(Pj.print("publish()","localStream: %o",t),r=t.videoTrack,n=t.audioTrack,i=PO(),o="",a="",s=this._handler,e.prev=7,!this._vendorConfig.enableMultiVendor){e.next=19;break}return t.vendorHandler=new Cj(this._context),t.pcSessionId&&(t.vendorHandler.peerConnectionId=t.pcSessionId),e.next=13,t.vendorHandler.publish(t);case 13:E=e.sent,(s=t.vendorHandler).on("ice_state",(function(e){x.emit(PM.ON_VENDOR_CONNECTION_STATE_CHANGE,{state:{checking:ll.CONNECTION_STATE_CONNECTING,connected:ll.CONNECTION_STATE_CONNECTED,disconnected:ll.CONNECTION_STATE_RECONNECTING}[e],userId:x._clientId})})),s.once("disconnect",Tm(Em().mark((function e(){var r,n,i;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(null===(r=s)||void 0===r||r.removeAllListeners(),"connected"===(null===(n=x._handler)||void 0===n||null===(i=n.pc)||void 0===i?void 0:i.iceConnectionState)){e.next=4;break}return Pj.print("vendor ice failed",t.streamId),e.abrupt("return");case 4:t.clean(),x.publish(t);case 6:case"end":return e.stop()}}),e)})))),e.next=22;break;case 19:return e.next=21,null===(k=this._handler)||void 0===k?void 0:k.publish(t);case 21:E=e.sent;case 22:if(null===(c=t.observer)||void 0===c||c.setHandler(s),E){e.next=25;break}throw new hR(dR.ADD_TRANSCEIVER_FAILED,"add transceiver failed");case 25:if("H264"!==(null===(u=this._context)||void 0===u||null===(d=u.serverConfig)||void 0===d?void 0:d.videoCodec)){e.next=31;break}return e.next=28,LD();case 28:if(e.sent){e.next=31;break}throw new hR(dR.PUBLISH_FAILED,"h264 is not supported");case 31:return o=E.audioMid,a=E.videoMid,t.pubAttributes={localaudio:!!n,localvideo:!!r,videostream:t.pubVideo,audiostream:t.pubAudio,extvideo:!!(r instanceof OU),extaudio:!!(n instanceof PU)},T={attributes:Zd({videoDescriptions:E.videoDescriptions},t.pubAttributes),audio:!0,video:!0,screen:t.isScreen,audioMid:o,videoMid:a,sdpInfo:{msid:t.stream.id,type:E.type,sdp:E.partialSdp,semantics:E.semantics},peerConnectionMode:null===(l=E)||void 0===l?void 0:l.peerConnectionMode,supportMultiVendor:!0},(I=!this._vendorConfig.enableMultiVendor&&t.enableSimulcast&&(null===(h=this._context)||void 0===h||null===(v=h.serverConfig)||void 0===v?void 0:v.simulcastOnDemand)&&(null===(p=E.subVideoDescriptions)||void 0===p?void 0:p.length))&&(T.attributes.subVideoDescriptions=E.subVideoDescriptions),null!==(_=E)&&void 0!==_&&_.peerConnectionId&&(T.peerConnectionId=E.peerConnectionId),e.next=40,null===(f=this._dataChannelSignal)||void 0===f?void 0:f.sendSignaling("publish",T);case 40:if(200===(null==(A=e.sent)?void 0:A.code)){e.next=43;break}throw new hR(dR.PUBLISH_FAILED,(null==A?void 0:A.message)||"publish failed");case 43:if(null===(m=this._monitor)||void 0===m||m.report("rtc_recv_answer",{error_code:0,answer_type:null==A?void 0:A.relayMessage.type,sequence_id:(null==A||null===(g=A.relayMessage)||void 0===g?void 0:g.sequenceId)||0,message:null==A||null===(y=A.relayMessage)||void 0===y?void 0:y.sdp,direction:"up",stream_id:"",stream_user_id:"",pc_session_id:(null===(S=s)||void 0===S?void 0:S.peerConnectionId)||""}),R=new qf((function(e,r){var n,i,c,u,d,l;null===(n=s)||void 0===n||n.handleAck({action:RV.publish,streamId:A.streamId,audioMid:o,videoMid:a,audioTransceiverInit:null===(i=E)||void 0===i?void 0:i.audioTransceiverInit,videoTransceiverInit:null===(c=E)||void 0===c?void 0:c.videoTransceiverInit,signalingAck:{sdp:null==A||null===(u=A.relayMessage)||void 0===u?void 0:u.sdp,sequenceId:null==A||null===(d=A.relayMessage)||void 0===d?void 0:d.sequenceId},sdp:null===(l=E)||void 0===l?void 0:l.sdp,stream:t,onSuccess:function(){Pj.print("publish()","publish success"),e(0)}})})),e.t0=!sP,!e.t0){e.next=49;break}return e.next=49,R;case 49:return I&&this.emit(OM.RSCP,[{StreamIds:[t.stream.id],Metadata:{VideoIndex:0}}]),t.streamId=A.streamId,t.videoMid=a,t.audioMid=o,t.subVideoDescriptions=E.subVideoDescriptions,null===(b=this._monitor)||void 0===b||b.report("rtc_publish_stat",{result:"success",is_screen:"0",start:i,message:"unknown"}),t.statsReport.setLocalStreamStatsEvtInterval((function(e){return x.emit("onLocalStreamStats",e)}),s,this._context),e.abrupt("return");case 59:return e.prev=59,e.t1=e.catch(7),e.t1 instanceof Error&&(null===(w=this._monitor)||void 0===w||w.report("rtc_publish_stat",{result:"fail",is_screen:"0",start:i,message:e.t1.message})),e.next=64,null===(C=s)||void 0===C?void 0:C.rollback(t.stream.id,t);case 64:throw e.t1;case 65:case"end":return e.stop()}}),e,this,[[7,59]])}))),function(e){return y.apply(this,arguments)})},{key:"updatePubTrack",value:(g=Tm(Em().mark((function e(t){var r,n,i,o,a,s,c,u,d,l,h,v,p,_,f,m,g,y,S,b,E,k,T,I,A,R,C,w,x,O;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:Pj.print("updatePubTrack()","localStream: %o",t),n=t.videoTrack,i=t.audioTrack,o=t.pubAudio,a=t.pubVideo,s=t.vendorHandler||this.handler,c=null==i?void 0:i.getTrack("preprocessing"),u=null==n?void 0:n.getTrack("preprocessing"),a&&u?null===(d=t.videoTransceiver)||void 0===d||d.sender.replaceTrack(u):null===(l=t.videoTransceiver)||void 0===l||l.sender.replaceTrack(null),null==s||s.updateMaxBitrate(t),o&&c?(v=i.mixType,(p=i.mixedAudioTrack)&&v!==xl.PLAYOUT&&!0===c.enabled&&(c=p),null===(h=t.audioTransceiver)||void 0===h||h.sender.replaceTrack(c)):(null===(_=t.audioTransceiver)||void 0===_||_.sender.replaceTrack(null),AO(this.id,"MediaClient.updatePubTrack(audio)","null"));try{AO(this.id,"MediaClient.updatePubTrack",Mm({audioStreamTrack:$O(c),videoStreamTrack:$O(u)}))}catch(TK){}for(m={},g=0,y=bR(f={localaudio:!!i,localvideo:!!n,videostream:a,audiostream:o,extvideo:!!(n instanceof OU),extaudio:!!(i instanceof PU)});g<y.length;g++)S=ZT(y[g],2),b=S[0],(E=S[1])!==cI(t.pubAttributes,b)&&IM(m,b,E);if(an(m).length){e.next=14;break}return e.abrupt("return");case 14:return t.observer&&(k=t.observer,T=m.audiostream,I=m.videostream,A=m.localaudio,R=m.localvideo,C=m.extaudio,w=m.extvideo,void 0!==R?void 0!==w?k.setPushVideo(w):k.setEnableVideo(R):void 0!==I&&k.setUnmuteVideo(I),void 0!==A?void 0!==C?k.setPushAudio(C):k.setEnableAudio(A):void 0!==T&&k.setUnmuteAudio(T)),t.pubAttributes=f,x={roomId:this._roomId,streamId:t.streamId,attributes:m},e.next=19,null===(r=this._dataChannelSignal)||void 0===r?void 0:r.sendSignaling("updateStreamAttributes",x);case 19:if(200===(null==(O=e.sent)?void 0:O.code)){e.next=22;break}throw new hR(dR.UPDATE_TRACK_FAILED,(null==O?void 0:O.message)||"update track failed");case 22:if(!sP){e.next=25;break}return e.next=25,null==s?void 0:s.setCurrentDescription();case 25:case"end":return e.stop()}}),e,this)}))),function(e){return g.apply(this,arguments)})},{key:"updateToken",value:(m=Tm(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(Pj.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 hR(dR.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 hR(dR.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 m.apply(this,arguments)})},{key:"unpublish",value:(f=Tm(Em().mark((function e(t){var r,n,i;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return Pj.print("unpublish()","localStream: %o",t),n={roomId:this._roomId,initStreamId:t.initStreamId,streamId:t.streamId},null===(r=this._dataChannelSignal)||void 0===r||r.sendSignaling("unpublish",n),i=t.vendorHandler||this._handler,e.next=6,null==i?void 0:i.handleAck({action:RV.unpublish,audioMid:t.audioMid,videoMid:t.videoMid,stream:t,streamId:t.streamId});case 6:t.statsReport.unpublish();case 7:case"end":return e.stop()}}),e,this)}))),function(e){return f.apply(this,arguments)})},{key:"subscribe",value:(_=Tm(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 qf(function(){var e=Tm(Em().mark((function e(o,a){var s,c,u,d,l,h,v,p,_,f,m,g,y,S,b,E,k,T,I,A,R,C,w,x,O,P,M,N,D,L,U,V,F,B,j,G,H,z,X,K,q,Y,W,Q,J,Z;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t.streamState!==EV.SUB_ED){e.next=2;break}return e.abrupt("return",i._updateSubTrack(t,r,Ij.SUB).then(o,a));case 2:if(t.streamState!==EV.SUB_ING){e.next=7;break}return i._subStreamQueue[t.streamId]||(i._subStreamQueue[t.streamId]=[]),Pj.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(Pj.print("subscribe()","mediaType: %o",r),Dj("subscribe()",t),t.streamState=EV.SUB_ING,c=!1,u=!1,WO(r)&&(u=!0),QO(r)&&(c=!0),c||!i.multiChatMode()){e.next=17;break}return t.streamState=EV.INIT,i.emit("SUB_END",t.streamId),e.abrupt("return",o(null));case 17:if(d=PO(),l=t.subVideo,h=[],v=!i.multiChatMode(),i._subResolves[t.streamId]||(i._subResolves[t.streamId]=[]),h.push(new qf((function(e,r){i._subResolves[t.streamId].push(e);var n=setTimeout((function(){return r(new hR(dR.TIME_OUT,"wait video timeout for userId: ".concat(t.userId)))}),Mj);t.on("ontrack",(function r(i){"video"===i.mediaType&&(Pj.print("remoteStream ".concat(t.userId," received video track")),t.off("ontrack",r),clearTimeout(n),e(0))}))}))),v&&h.push(new qf((function(e,r){i._subResolves[t.streamId].push(e);var n=setTimeout((function(){return r(new hR(dR.TIME_OUT,"wait audio timeout for userId: ".concat(t.userId)))}),Mj);t.on("ontrack",(function r(i){"audio"===i.mediaType&&(Pj.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),_=i._handler,e.prev=28,null!==(f=i._context.serverConfig)&&void 0!==f&&f.forceUniHandler||!t.enableVendorMode){e.next=41;break}return t.vendorHandler=new Cj(i._context),t.pcSessionId&&(t.vendorHandler.peerConnectionId=t.pcSessionId),(_=t.vendorHandler).on("ontrack",p),e.next=36,t.vendorHandler.subscribe(t);case 36:U=e.sent,_.on("ice_state",(function(e){i.emit(PM.ON_VENDOR_CONNECTION_STATE_CHANGE,{state:{checking:ll.CONNECTION_STATE_CONNECTING,connected:ll.CONNECTION_STATE_CONNECTED,disconnected:ll.CONNECTION_STATE_RECONNECTING}[e],userId:t.userId})})),_.once("disconnect",Tm(Em().mark((function e(){var r,n,o;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(null===(r=_)||void 0===r||r.removeAllListeners(),"connected"===(null===(n=i._handler)||void 0===n||null===(o=n.pc)||void 0===o?void 0:o.iceConnectionState)){e.next=4;break}return Pj.print("vendor ice failed",t.streamId),e.abrupt("return");case 4:return t.resetHasSubscribed(),e.next=7,i.subscribe(t,t.subMediaType);case 7:i.emit(Ej.RESUBSCRIBE,{stream:t});case 8:case"end":return e.stop()}}),e)})))),e.next=44;break;case 41:return e.next=43,null===(V=i._handler)||void 0===V?void 0:V.subscribe(t,{multiChatMode:i.multiChatMode()});case 43:U=e.sent;case 44:if(null===(m=t.observer)||void 0===m||m.setHandler(_),U){e.next=47;break}throw new hR(dR.ADD_TRANSCEIVER_FAILED,"add transceiver failed");case 47:return F=U.audioMid,B=U.videoMid,t.subVideo=c,j={spatialLayer:(null==n?void 0:n.spatialLayer)||0,temporalLayer:0,spatialSubLayer:(null==n?void 0:n.spatialSubLayer)||-1},G={audio:!i.multiChatMode(),video:!0,data:!0,screen:t.isScreen,browser:"chrome-stable",videoMid:B,audioMid:F,sdpInfo:{sdp:null===(g=U)||void 0===g?void 0:g.partialSdp,semantics:null===(y=U)||void 0===y?void 0:y.semantics,type:null===(S=U)||void 0===S?void 0:S.type},streamUserId:t.userId,streamId:t.streamId,config:{enableMediaType:{audio:!!i.multiChatMode()||u,video:c},qualityLayer:j},extra:{enableSendRTT:!0},peerConnectionMode:null===(b=U)||void 0===b?void 0:b.peerConnectionMode,supportMultiVendor:!0},null!==(E=U)&&void 0!==E&&E.peerConnectionId&&(G.peerConnectionId=U.peerConnectionId),H=i._context||{},z=H.subscribeFallbackOption,X=H.userPriority,"number"==typeof z&&(G.config.fallbackOption=z),null!=X&&X.has(t.userId)&&(G.config.priority=X.get(t.userId)),null!==(k=U)&&void 0!==k&&k.allSsrc&&(G.extra.subscribeSSRC=U.allSsrc),e.next=59,null===(T=i._dataChannelSignal)||void 0===T?void 0:T.sendSignaling("subscribe",G);case 59:if(200===(null==(K=e.sent)?void 0:K.code)){e.next=62;break}throw new hR(dR.SUBSCRIBE_FAILED,(null==K?void 0:K.message)||"subscribe failed");case 62:return q=null==K?void 0:K.relayMessage,Y=q.audioMid,W=q.videoMid,Qd(I={},F,Y),Qd(I,B,W),Q=I,Pj.print("sub midmap",t.userId,Q),t.videoMid=B,t.audioMid=F,t.subMediaType=r,t.streamState=EV.SUB_ED,t.subLayer=j,null===(A=i._monitor)||void 0===A||A.report("rtc_recv_answer",{error_code:0,answer_type:null==K||null===(R=K.relayMessage)||void 0===R?void 0:R.type,sequence_id:(null==K||null===(C=K.relayMessage)||void 0===C?void 0:C.sequenceId)||0,message:null==K||null===(w=K.relayMessage)||void 0===w?void 0:w.sdp,direction:"down",stream_id:t.streamId,stream_user_id:t.userId,pc_session_id:(null===(x=_)||void 0===x?void 0:x.peerConnectionId)||""}),e.next=73,null===(O=_)||void 0===O?void 0:O.handleAck({action:RV.subscribe,streamId:t.streamId,audioMid:F,videoMid:B,audioTransceiverInit:null===(P=U)||void 0===P?void 0:P.audioTransceiverInit,videoTransceiverInit:null===(M=U)||void 0===M?void 0:M.videoTransceiverInit,signalingAck:{sdp:null==K||null===(N=K.relayMessage)||void 0===N?void 0:N.sdp,sequenceId:null==K||null===(D=K.relayMessage)||void 0===D?void 0:D.sequenceId},stream:t,sdp:U.sdp,generatorSsrc:!!U.allSsrc});case 73:return e.next=75,qf.all(h);case 75:i.multiChatMode()||(t.subAudio=u),null===(L=i._monitor)||void 0===L||L.report("rtc_subscribe_stat",{result:"success",start:d,message:"unknown",stream_user_id:t.userId}),i._context&&t.statsReport.setRemoteStreamStatsEvtInterval((function(e){return i.emit("onRemoteStreamStats",e)}),_,i._context),o(null),i.emit("SUB_END",t.streamId),e.next=91;break;case 82:return e.prev=82,e.t0=e.catch(28),e.t0 instanceof Error&&(null===(Z=i._monitor)||void 0===Z||Z.report("rtc_subscribe_stat",{result:"fail",start:d,message:e.t0.message,stream_user_id:t.userId})),t.subVideo=l,t.streamState=EV.INIT,e.next=89,null===(J=_)||void 0===J?void 0:J.rollback(t.streamId,t);case 89:a(e.t0),i.emit("SUB_END",t.streamId);case 91:case"end":return e.stop()}}),e,null,[[28,82]])})));return function(t,r){return e.apply(this,arguments)}}()));case 1:case"end":return e.stop()}}),e)}))),function(e,t,r){return _.apply(this,arguments)})},{key:"_handleSubStreamQueue",value:function(e){var t,r=this;if(null!==(t=this._subStreamQueue[e])&&void 0!==t&&t.length){Pj.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 Pj.print("_subStreamQueue","streamId: %o, END",e)}},{key:"controlMessage",value:(p=Tm(Em().mark((function e(t){var r,n;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return Pj.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 p.apply(this,arguments)})},{key:"updateUserAttributes",value:(v=Tm(Em().mark((function e(t){var r;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return Pj.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 v.apply(this,arguments)})},{key:"updateSubTrack",value:(h=Tm(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 h.apply(this,arguments)})},{key:"updateSubTrackLayer",value:(l=Tm(Em().mark((function e(t,r){var n,i,o;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(Pj.print("updateSubTrack()","subLayer: %o",r),t.subLayer.spatialLayer!==r.spatialLayer||t.subLayer.spatialSubLayer!==r.spatialSubLayer){e.next=4;break}return Pj.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 hR(dR.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 l.apply(this,arguments)})},{key:"updateSubPriority",value:(d=Tm(Em().mark((function e(t,r){var n,i,o;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(Pj.print("updateSubPriority()","priority: %o",r),t.priority!==r){e.next=4;break}return Pj.print("updateSubPriority()","priority no change"),e.abrupt("return",t);case 4:return i={roomId:this._roomId,streamList:[t.streamId],streamId:t.streamId,streamUserId:t.userId,config:{priority: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 hR(dR.UPDATE_TRACK_FAILED,(null==o?void 0:o.message)||"update track failed");case 10:return t.priority=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=Tm(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(Pj.print("updateSubTrack()","mediaType: %o",r),Dj("updateSubTrack()",t),!this.multiChatMode()||r!==ul.AUDIO){e.next=5;break}return Pj.print("updateSubTrack","multiChatMode mediaType only audio"),e.abrupt("return",t);case 5:return a=0,a=n===Ij.SUB?t.subMediaType|r:t.subMediaType-(t.subMediaType&r),Pj.print("updateSubTrack","prev: %o, direction: %o, mediaType: %o, newMediaType: %o",t.subMediaType,n,r,a),t.subMediaType===a&&Pj.print("updateSubTrack","mediaType no change"),s=!1,c=!1,WO(a)&&(c=!0),QO(a)&&(s=!0),u={roomId:this._roomId,streamList:[t.streamId],config:{enableMediaType:{video:s,audio:!!this.multiChatMode()||c}}},e.next=15,null===(i=this._dataChannelSignal)||void 0===i?void 0:i.sendSignaling("updateSubscribe",u);case 15:if(200===(null==(d=e.sent)?void 0:d.code)){e.next=18;break}throw new hR(dR.UPDATE_TRACK_FAILED,(null==d?void 0:d.message)||"update track failed");case 18:return this.multiChatMode()||(null===(l=t.observer)||void 0===l||l.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 23:case"end":return e.stop()}}),e,this)}))),function(e,t,r){return u.apply(this,arguments)})},{key:"subscribe4pushTrack",value:(c=Tm(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 Pj.print("subscribe4pushTrack()","streamInfo: %o",r),Dj("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 hR(dR.ADD_TRANSCEIVER_FAILED,"add transceiver failed");case 9:return c=s.audioMid,u=s.videoMid,(d=[]).push(new qf((function(e,r){var n=setTimeout((function(){return r(new hR(dR.TIME_OUT,"wait audio timeout for userId: ".concat(t.userId)))}),Mj);t.on("ontrack",(function r(i){"audio"===i.mediaType&&(Pj.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:RV.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,qf.all(d);case 20:this._context&&t.statsReport.setRemoteStreamStatsEvtInterval((function(e){return h.emit("onRemoteStreamStats",e)}),this._handler,this._context);case 21:case"end":return e.stop()}}),e,this)}))),function(e,t){return c.apply(this,arguments)})},{key:"unsubscribe4removeTrack",value:(s=Tm(Em().mark((function e(t,r){return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:Dj("unsubscribe4removeTrack()",t),Pj.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=Tm(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],Dj("unsubscribe()",t),!n){e.next=4;break}return e.abrupt("return",this._unsubscribe(t,r));case 4:if(!this.multiChatMode()||!QO(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,Ij.UNSUB));case 10:case"end":return e.stop()}}),e,this)}))),function(e,t){return a.apply(this,arguments)})},{key:"_unsubscribe",value:(o=Tm(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(!this._subConfig.muteReplaceUnsub){e.next=2;break}return e.abrupt("return",this._updateSubTrack(t,r,Ij.UNSUB));case 2:return a={roomId:this._roomId,streamId:t.streamId,userId:t.userId},s=t.vendorHandler||this.handler,null===(n=this._dataChannelSignal)||void 0===n||n.sendSignaling("unsubscribe",a).catch((function(){})),t.streamState=EV.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=12,null==s?void 0:s.handleAck({action:RV.unsubscribe,streamId:t.streamId,audioMid:t.audioMid,videoMid:t.videoMid,stream:t});case 12:c=e.sent,this._subResolves[c]&&this._subResolves[c].forEach((function(e){return e(0)})),Pj.print("unsubscribe","clean unsub ".concat(t.userId)),t.clean(),this.removeOnTrackListener(t),t.statsReport.unsubscribe();case 18:case"end":return e.stop()}}),e,this)}))),function(e,t){return o.apply(this,arguments)})},{key:"removeOnTrackListener",value:function(e){var t=this._ontrackCallbackMap.get(e);if(t){var r=e.vendorHandler||this._handler;null==r||r.off("ontrack",t),this._ontrackCallbackMap.delete(e)}}},{key:"handleRemoveStream",value:(i=Tm(Em().mark((function e(t,r){return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(Dj("handleRemoveStream()",t),t.subVideo=!1,t.streamState!==EV.INIT){e.next=4;break}return e.abrupt("return");case 4:this.unsubscribe(t,ul.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=Tm(Em().mark((function e(){var t,r,n;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(Pj.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",qf.reject(new hR(dR.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=Tm(Em().mark((function e(t){var r,n,i,o,a,s,c,u,d,l,h,v,p,_,f,m,g=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(s=e.sent){e.next=5;break}throw new hR(dR.ADD_TRANSCEIVER_FAILED,"add transceiver failed");case 5:return c=PO(),u=s.audioMid,d=s.videoMid,e.t0=this._appId,e.t1=t.streamId,e.t2=u,e.t3=d,e.t4={sdp:null==s?void 0:s.partialSdp,semantics:null==s?void 0:s.semantics,type:null==s?void 0:s.type},e.next=15,wD();case 15:return e.t5=e.sent,e.t6=window.navigator.userAgent,e.t7=FP.VERSION,e.t8=NP.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}},l={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",l);case 27:return h=e.sent,v=[],this._subResolves[t.streamId]=[],v.push(new qf((function(e,r){g._subResolves[t.streamId].push(e);var n=setTimeout((function(){return r(new hR(dR.TIME_OUT,"wait video timeout for streamId: ".concat(t.streamId)))}),Mj);t.on("ontrack",(function r(i){"video"===i.mediaType&&(Pj.print("remoteStream ".concat(t.userId," received video track")),t.off("ontrack",r),clearTimeout(n),e(0))}))}))),v.push(new qf((function(e,r){g._subResolves[t.streamId].push(e);var n=setTimeout((function(){return r(new hR(dR.TIME_OUT,"wait audio timeout for streamId: ".concat(t.streamId)))}),Mj);t.on("ontrack",(function r(i){"audio"===i.mediaType&&(Pj.print("remoteStream ".concat(t.userId," received audio track")),t.off("ontrack",r),clearTimeout(n),e(0))}))}))),p=function(e){t.ontrack(e)},null===(i=this._handler)||void 0===i||i.on("ontrack",p),this._ontrackCallbackMap.set(t,p),_=null==h?void 0:h.relayMessage,f=_.sequenceId,m=_.sdp,t.videoMid=d,t.audioMid=u,t.sequenceId=f,t.streamState=EV.SUB_ED,t.subAudio=!0,t.subVideo=!0,e.next=44,null===(o=this._handler)||void 0===o?void 0:o.handleAck({action:RV.subscribe,streamId:t.streamId,audioMid:u,videoMid:d,audioTransceiverInit:null==s?void 0:s.audioTransceiverInit,videoTransceiverInit:null==s?void 0:s.videoTransceiverInit,signalingAck:{sdp:m,sequenceId:f},stream:t});case 44:return e.next=46,qf.all(v);case 46:null===(a=this._monitor)||void 0===a||a.report("rtc_subscribe_stat",{result:"success",start:c,message:"unknown",stream_user_id:t.userId}),this._context&&t.statsReport.setRemoteStreamStatsEvtInterval((function(e){return g.emit("onRemoteStreamStats",e)}),this._handler,this._context);case 48:case"end":return e.stop()}}),e,this)}))),function(e){return r.apply(this,arguments)})},{key:"unsubscribePublicStream",value:(t=Tm(Em().mark((function e(t){var r,n,i;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return Dj("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=EV.INIT,t.subVideo=!1,t.subAudio=!1,e.next=14,null===(r=this._handler)||void 0===r?void 0:r.handleAck({action:RV.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,n;Pj.print("destroy()"),this._token=void 0,this._appId=void 0,this._roomId=void 0,this._clientId=void 0,this._authorization=void 0,this._sessionId=void 0,null===(e=this._handler)||void 0===e||e.destroy(),null===(t=this._monitor)||void 0===t||t.set({connection_id:""}),null===(r=this._dataChannelSignal)||void 0===r||r.destroy(),null===(n=this._iceConfigRequestManager)||void 0===n||n.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}},{key:"vendorConfig",get:function(){return this._vendorConfig}}]),k}(fM);function Uj(e,t,r){var n=r.value;return r.value=Tm(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 hR(dR.NOT_CONNECTED_YET,"error in ".concat(t,": try again after joined"));case 7:case"end":return e.stop()}}),e,this)}))),r}function Vj(e,t,r){var n=r.value;return r.value=Tm(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}Oj([function(e,t,r){var n=r.value;return r.value=Tm(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 qf(function(){var e=Tm(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 hR(dR.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}],Lj.prototype,"join",1),Oj([Vj,Uj],Lj.prototype,"publish",1),Oj([Vj,Uj],Lj.prototype,"updatePubTrack",1),Oj([Vj,Uj],Lj.prototype,"unpublish",1),Oj([Vj,Uj],Lj.prototype,"subscribe",1),Oj([Uj],Lj.prototype,"controlMessage",1),Oj([Uj],Lj.prototype,"updateUserAttributes",1),Oj([Uj],Lj.prototype,"updateSubTrack",1),Oj([Uj],Lj.prototype,"updateSubTrackLayer",1),Oj([Uj],Lj.prototype,"updateSubPriority",1),Oj([Vj,Uj],Lj.prototype,"subscribe4pushTrack",1),Oj([Vj,Uj],Lj.prototype,"unsubscribe4removeTrack",1),Oj([Vj,Uj],Lj.prototype,"unsubscribe",1),Oj([Uj],Lj.prototype,"handleRemoveStream",1),Oj([Vj],Lj.prototype,"subscribePublicStream",1),Oj([Vj],Lj.prototype,"unsubscribePublicStream",1);var Fj,Bj=new cO("RecvFrameObserver",0),jj=function(e){OI(a,e);var t,r,n,i,o=YI(a);function a(e,t){var r;return Ll(this,a),Qd($T(r=o.call(this)),"_audioEventSessionId",LO()),Qd($T(r),"_videoEventSessionId",LO()),Qd($T(r),"_handler",void 0),Qd($T(r),"_stream",void 0),Qd($T(r),"_firstAudioFrameTimer",void 0),Qd($T(r),"_firstVideoFrameTimer",void 0),Qd($T(r),"_transportDelayInterval",void 0),Qd($T(r),"_transportDelay",void 0),Qd($T(r),"_firstVideoFrameInterval",void 0),Qd($T(r),"_firstAudioFrameInterval",void 0),Qd($T(r),"_isScreen",!1),Qd($T(r),"_audioFirstFrameState",0),Qd($T(r),"_videoFirstFrameState",0),Qd($T(r),"_timeout",1e4),Qd($T(r),"_currentAudioRecv",{startTime:0,eventSessionId:0,type:"login"}),Qd($T(r),"_currentVideoRecv",{startTime:0,eventSessionId:0,type:"login"}),Qd($T(r),"_login",!1),Qd($T(r),"_unMuteAudio",!1),Qd($T(r),"_enableAudio",!1),Qd($T(r),"_unMuteVideo",!1),Qd($T(r),"_enableVideo",!1),Qd($T(r),"_remoteUnmuteAudio",!1),Qd($T(r),"_remoteUnmuteVideo",!1),Qd($T(r),"_audioExternal",!1),Qd($T(r),"_pushAudio",!1),Qd($T(r),"_videoExternal",!1),Qd($T(r),"_pushVideo",!1),Qd($T(r),"_autoSubscribeVideo",!1),Qd($T(r),"_autoSubscribeAudio",!1),Qd($T(r),"_autoSubscribe",!1),Qd($T(r),"_publishVideo",!1),Qd($T(r),"_publishAudio",!1),Qd($T(r),"_subscribeAudio",!1),Qd($T(r),"_subscribeVideo",!1),Qd($T(r),"_subscribe",!1),Qd($T(r),"_pushTrack",!1),Qd($T(r),"_multiChatMode",!1),Qd($T(r),"_monitor",void 0),r._stream=e,r._handler=t,r.getTransportDelay(),r._monitor=kO(e.engineId),r}return Dl(a,[{key:"beginRecvFrame",value:(i=Tm(Em().mark((function e(t,r){var n,i,o,a,s,c,u,d,l,h,v,p,_,f,m,g,y,S,b,E=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,CE(n=["login","unmute","subscribe","push_track"]).call(n,r)>=0&&(i=0,o=!1),"audio"===t?(o||this._audioEventSessionId++,this._currentAudioRecv={startTime:Date.now(),eventSessionId:this._audioEventSessionId,type:r},v={media_type:t,event_type:"begin_recv",type:r,is_screen:!(null===(a=this._stream)||void 0===a||!a.isScreen),start:null===(s=this._currentAudioRecv)||void 0===s?void 0:s.startTime,event_session_id:this._audioEventSessionId,stream_user_id:null===(c=this._stream)||void 0===c?void 0:c.userId,transport_delay:i,vendor_mode:(null===(u=this._stream)||void 0===u?void 0:u.vendorCode)||0,pc_session_id:(null===(d=this._stream)||void 0===d?void 0:d.pcSessionId)||(null===(l=this._handler)||void 0===l?void 0:l.peerConnectionId)},this._firstAudioFrameTimer&&window.clearTimeout(this._firstAudioFrameTimer),this._firstAudioFrameTimer=window.setTimeout((function(){E.stopRecvFrame("audio","timeout"),E._firstAudioFrameInterval&&window.clearInterval(E._firstAudioFrameInterval)}),this._timeout),Bj.print("rtcFirstFrameRecv",Mm(v)),null===(h=this._monitor)||void 0===h||h.report("rtc_first_frame",v),this._watchForFirstAudioFrameRecv(),this._audioFirstFrameState=1,this._login=!0,this._unMuteAudio=!0,this._enableAudio=!0,this._remoteUnmuteAudio=!0):"video"===t&&(o||this._videoEventSessionId++,this._currentVideoRecv={startTime:Date.now(),eventSessionId:this._videoEventSessionId,type:r},b={media_type:t,event_type:"begin_recv",type:r,is_screen:!(null===(p=this._stream)||void 0===p||!p.isScreen),start:null===(_=this._currentVideoRecv)||void 0===_?void 0:_.startTime,event_session_id:this._videoEventSessionId,stream_user_id:null===(f=this._stream)||void 0===f?void 0:f.userId,transport_delay:i,vendor_mode:(null===(m=this._stream)||void 0===m?void 0:m.vendorCode)||0,pc_session_id:(null===(g=this._stream)||void 0===g?void 0:g.pcSessionId)||(null===(y=this._handler)||void 0===y?void 0:y.peerConnectionId)},this._firstVideoFrameTimer&&window.clearTimeout(this._firstVideoFrameTimer),this._firstVideoFrameTimer=window.setTimeout((function(){Tm(Em().mark((function e(){var t,r,n,i,o,a,s,c,u,d,l,h,v,p,_,f,m;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(e.t0=null===(t=E._handler)||void 0===t?void 0:t.pc,!e.t0){e.next=5;break}return e.next=4,KD(null===(r=E._handler)||void 0===r?void 0:r.pc,null===(n=E._stream)||void 0===n||null===(i=n.videoTrack)||void 0===i?void 0:i.getTrack());case 4:e.t0=e.sent;case 5:return p=e.t0,_=mE(o=p||[]).call(o,(function(e){return"inbound-rtp"===e.type})),e.next=9,null===(a=E._stream)||void 0===a||null===(s=a.videoTransceiver)||void 0===s?void 0:s.receiver.getStats();case 9:f=e.sent,m=[],null==f||f.forEach((function(e){return m.push(e.type)})),null===(c=E._monitor)||void 0===c||c.report("rtc_invoke_status",{sdk_api_name:"first_video_frame_timeout",error_code:-1,message:Mm({reports:Fm(p).call(p,(function(e){return e.type})),reports2:m,pc:(null===(u=E._handler)||void 0===u?void 0:u.pc)||null,track:(null===(d=E._stream)||void 0===d||null===(l=d.videoTrack)||void 0===l?void 0:l.getTrack().id)||null,framesReceived:null==_?void 0:_.framesReceived,packetsReceived:null==_?void 0:_.packetsReceived}),stream_id:(null===(h=E._stream)||void 0===h?void 0:h.streamId)||"",stream_user_id:null===(v=E._stream)||void 0===v?void 0:v.userId,elapse:0});case 13:case"end":return e.stop()}}),e)})))(),E.stopRecvFrame("video","timeout"),E._firstVideoFrameInterval&&window.clearInterval(E._firstVideoFrameInterval)}),this._timeout),this._watchForFirstVideoFrameRecv(),Bj.print("rtcFirstFrameRecv",Mm(b)),null===(S=this._monitor)||void 0===S||S.report("rtc_first_frame",b),this._videoFirstFrameState=1,this._login=!0,this._unMuteVideo=!0,this._enableVideo=!0,this._remoteUnmuteVideo=!0);case 6:case"end":return e.stop()}}),e,this)}))),function(e,t){return i.apply(this,arguments)})},{key:"stopRecvFrame",value:function(e,t){if("audio"===e){var r,n,i,o,a,s,c,u;if(1!==this._audioFirstFrameState)return;var d={event_type:"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,vendor_mode:(null===(a=this._stream)||void 0===a?void 0:a.vendorCode)||0,pc_session_id:(null===(s=this._stream)||void 0===s?void 0:s.pcSessionId)||(null===(c=this._handler)||void 0===c?void 0:c.peerConnectionId)};this._firstAudioFrameTimer&&window.clearTimeout(this._firstAudioFrameTimer),delete this._currentAudioRecv,Bj.print("rtcFirstFrameRecv",Mm(d)),null===(u=this._monitor)||void 0===u||u.report("rtc_first_frame",d),this._audioFirstFrameState=2}else if("video"===e){var l,h,v,p,_,f,m,g;if(1!==this._videoFirstFrameState)return;var y={event_type:"recv_end",media_type:e,is_screen:!(null===(l=this._stream)||void 0===l||!l.isScreen),start:null===(h=this._currentVideoRecv)||void 0===h?void 0:h.startTime,reason:t,result:!1,stream_user_id:null===(v=this._stream)||void 0===v?void 0:v.userId,event_session_id:this._videoEventSessionId,type:null===(p=this._currentVideoRecv)||void 0===p?void 0:p.type,vendor_mode:(null===(_=this._stream)||void 0===_?void 0:_.vendorCode)||0,pc_session_id:(null===(f=this._stream)||void 0===f?void 0:f.pcSessionId)||(null===(m=this._handler)||void 0===m?void 0:m.peerConnectionId)};this._firstVideoFrameTimer&&window.clearTimeout(this._firstVideoFrameTimer),delete this._currentVideoRecv,Bj.print("rtcFirstFrameRecv",Mm(y)),null===(g=this._monitor)||void 0===g||g.report("rtc_first_frame",y),this._videoFirstFrameState=2}}},{key:"recvFrameFinish",value:(n=Tm(Em().mark((function e(t){var r,n,i,o,a,s,c,u,d,l,h,v,p,_,f,m,g,y,S,b,E,k,T;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,"audio"!==t){e.next=19;break}if(1===this._audioFirstFrameState){e.next=6;break}return e.abrupt("return");case 6:if(this._currentAudioRecv){e.next=8;break}return e.abrupt("return");case 8:d=this._currentAudioRecv,l=d.type,h=d.startTime,CE(n=["login","unmute","subscribe","push_track"]).call(n,l)>=0&&(r=0),v={event_type:"recv_end",media_type:t,start:h,result:!0,is_screen:!(null===(i=this._stream)||void 0===i||!i.isScreen),stream_user_id:null===(o=this._stream)||void 0===o?void 0:o.userId,event_session_id:this._audioEventSessionId,type:l,transport_delay:r,vendor_mode:(null===(a=this._stream)||void 0===a?void 0:a.vendorCode)||0,pc_session_id:(null===(s=this._stream)||void 0===s?void 0:s.pcSessionId)||(null===(c=this._handler)||void 0===c?void 0:c.peerConnectionId)},delete this._currentAudioRecv,this._firstAudioFrameTimer&&window.clearTimeout(this._firstAudioFrameTimer),Bj.print("rtcFirstFrameRecv",Mm(v)),null===(u=this._monitor)||void 0===u||u.report("rtc_first_frame",v),this.emit("recvAudioFirstFrame"),this._audioFirstFrameState=3,e.next=33;break;case 19:if("video"!==t){e.next=33;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:b=this._currentVideoRecv,E=b.type,k=b.startTime,CE(p=["login","unmute","subscribe","push_track"]).call(p,E)>=0&&(r=0),T={event_type:"recv_end",media_type:t,is_screen:!(null===(_=this._stream)||void 0===_||!_.isScreen),start:k,result:!0,stream_user_id:null===(f=this._stream)||void 0===f?void 0:f.userId,event_session_id:this._videoEventSessionId,type:E,transport_delay:r,vendor_mode:(null===(m=this._stream)||void 0===m?void 0:m.vendorCode)||0,pc_session_id:(null===(g=this._stream)||void 0===g?void 0:g.pcSessionId)||(null===(y=this._handler)||void 0===y?void 0:y.peerConnectionId)},delete this._currentVideoRecv,this._firstVideoFrameTimer&&window.clearTimeout(this._firstVideoFrameTimer),Bj.print("rtcFirstFrameRecv",Mm(T)),null===(S=this._monitor)||void 0===S||S.report("rtc_first_frame",T),this.emit("recvVideoFirstFrame"),this._videoFirstFrameState=3;case 33: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("audio","login"),e&&null!==(r=this._stream)&&void 0!==r&&r.hasVideo&&o.video&&this.beginRecvFrame("video","login"),!e&&null!==(n=this._stream)&&void 0!==n&&n.hasAudio&&this.stopRecvFrame("audio","leave_room"),!e&&null!==(i=this._stream)&&void 0!==i&&i.hasVideo&&this.stopRecvFrame("video","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("audio","unmute"):i&&this.stopRecvFrame("audio","mute"))}}},{key:"setRemoteUnmuteAudio",value:function(e){this._remoteUnmuteAudio!==e&&(this._remoteUnmuteAudio=e,this._remoteUnmuteAudio?this.beginRecvFrame("audio","remote_unmute"):this.stopRecvFrame("audio","remote_mute"))}},{key:"setEnableAudio",value:function(e){var t;this._enableAudio!==e&&(this._enableAudio=e,this._enableAudio?this.beginRecvFrame("audio","enable"):null!==(t=this._stream)&&void 0!==t&&t.hasAudio&&this.stopRecvFrame("audio","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("video","unmute"):i&&this.stopRecvFrame("video","mute"))}}},{key:"setHandler",value:function(e){this._handler=e}},{key:"setRemoteUnmuteVideo",value:function(e){this._remoteUnmuteVideo!==e&&(this._remoteUnmuteVideo=e,this._remoteUnmuteVideo?this.beginRecvFrame("video","remote_unmute"):this.stopRecvFrame("video","remote_mute"))}},{key:"setEnableVideo",value:function(e){this._enableVideo!==e&&(this._enableVideo=e,this._enableVideo?this.beginRecvFrame("video","enable"):this.stopRecvFrame("video","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("audio","push"),!e&&null!==(t=this._stream)&&void 0!==t&&t.hasAudio&&this.beginRecvFrame("audio","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("video","push"),!e&&null!==(t=this._stream)&&void 0!==t&&t.hasVideo&&this.beginRecvFrame("video","push")}},{key:"setPublishVideo",value:function(e){var t;this._publishVideo!==e&&(this._publishVideo=e),this._publishVideo&&this.beginRecvFrame("video","publish"),!e&&null!==(t=this._stream)&&void 0!==t&&t.hasVideo&&this.stopRecvFrame("video","unpublish")}},{key:"setPublishAudio",value:function(e){var t;this._publishAudio!==e&&(this._publishAudio=e),this._publishAudio&&this.beginRecvFrame("audio","publish"),!e&&null!==(t=this._stream)&&void 0!==t&&t.hasAudio&&this.stopRecvFrame("audio","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("audio","subscribe"));!e&&null!==(t=this._stream)&&void 0!==t&&t.hasAudio&&this.stopRecvFrame("audio","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("video","subscribe"));!e&&null!==(t=this._stream)&&void 0!==t&&t.hasVideo&&this.stopRecvFrame("video","unsubscribe")}},{key:"setPushTrack",value:function(e){var t;this._pushTrack!==e&&(e&&!this._isScreen&&this.beginRecvFrame("audio","push_track"),!e&&null!==(t=this._stream)&&void 0!==t&&t.hasAudio&&this.stopRecvFrame("audio","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(Tm(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,KD(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=mE(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("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(Tm(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.getOrgTrack()){n.next=12;break}return n.next=3,KD(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.getOrgTrack());case 3:if(d=n.sent,!(l=mE(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("audio"),window.clearInterval(e._firstAudioFrameInterval);case 12:case"end":return n.stop()}}),n)}))),200)}},{key:"getTransportDelay",value:(r=Tm(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(Tm(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=Tm(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,KD(null===(r=this._handler)||void 0===r?void 0:r.pc);case 3:n=e.sent,i=mE(n).call(n,(function(e){return"transport"===e.type&&"connected"===e.dtlsState})),(o=mE(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:"login"},this._currentVideoRecv={startTime:0,eventSessionId:0,type:"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)}},{key:"audioFirstFrameReceived",get:function(){return 3===this._audioFirstFrameState}},{key:"FirstFrameReceived",get:function(){return 3===this._audioFirstFrameState}}]),a}(vM.exports.EventEmitter),Gj=new cO("SendFrameObserver",0),Hj=function(){function e(t,r){Ll(this,e),Qd(this,"_audioEventSessionId",LO()),Qd(this,"_videoEventSessionId",LO()),Qd(this,"_pcSessionId",void 0),Qd(this,"_handler",void 0),Qd(this,"_firstAudioFrameTimer",void 0),Qd(this,"_firstVideoFrameTimer",void 0),Qd(this,"_stream",void 0),Qd(this,"_firstVideoFrameInterval",void 0),Qd(this,"_firstAudioFrameInterval",void 0),Qd(this,"_currentAudioSend",{startTime:0,eventSessionId:0,type:"login"}),Qd(this,"_currentVideoSend",{startTime:0,eventSessionId:0,type:"login"}),Qd(this,"_login",!1),Qd(this,"_publisher",!1),Qd(this,"_unMuteAudio",!1),Qd(this,"_enableAudio",!1),Qd(this,"_unMuteVideo",!1),Qd(this,"_enableVideo",!1),Qd(this,"_audioExternal",!1),Qd(this,"_pushAudio",!1),Qd(this,"_videoExternal",!1),Qd(this,"_pushVideo",!1),Qd(this,"_autoPublish",!1),Qd(this,"_publish",!1),Qd(this,"_timeout",1e4),Qd(this,"_audioFirstFrameState",0),Qd(this,"_videoFirstFrameState",0),Qd(this,"_monitor",void 0),this._stream=t,this._handler=r,this._monitor=kO(t.engineId)}var t,r;return Dl(e,[{key:"beginSendFrame",value:function(e,t){var r=this;if("audio"===e){var n,i,o,a,s,c;this._audioEventSessionId++,this._currentAudioSend={startTime:Date.now(),eventSessionId:this._audioEventSessionId,type:t};var u={event_type:"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,vendor_mode:(null===(o=this._stream)||void 0===o?void 0:o.vendorCode)||0,pc_session_id:(null===(a=this._stream)||void 0===a?void 0:a.pcSessionId)||(null===(s=this._handler)||void 0===s?void 0:s.peerConnectionId)};this._firstAudioFrameTimer&&window.clearTimeout(this._firstAudioFrameTimer),this._firstAudioFrameTimer=window.setTimeout((function(){r.stopSendFrame("audio","timeout"),r._firstAudioFrameInterval&&window.clearInterval(r._firstAudioFrameInterval)}),this._timeout),Gj.print("rtcFirstFrameSend",Mm(u)),null===(c=this._monitor)||void 0===c||c.report("rtc_first_frame",u),this._watchForFirstAudioFrameSend(),this._audioFirstFrameState=1,this._login=!0,this._publisher=!0,this._publish=!0,this._unMuteAudio=!0,this._pushAudio||(this._enableAudio=!0)}else if("video"===e){var d,l,h,v,p,_;this._videoEventSessionId++,this._currentVideoSend={startTime:Date.now(),eventSessionId:this._videoEventSessionId,type:t};var f={event_type:"begin_send",media_type:e,is_screen:!(null===(d=this._stream)||void 0===d||!d.isScreen),type:t,start:null===(l=this._currentVideoSend)||void 0===l?void 0:l.startTime,event_session_id:this._videoEventSessionId,vendor_mode:(null===(h=this._stream)||void 0===h?void 0:h.vendorCode)||0,pc_session_id:(null===(v=this._stream)||void 0===v?void 0:v.pcSessionId)||(null===(p=this._handler)||void 0===p?void 0:p.peerConnectionId)};this._firstVideoFrameTimer&&window.clearTimeout(this._firstVideoFrameTimer),this._firstVideoFrameTimer=window.setTimeout((function(){r.stopSendFrame("video","timeout"),r._firstVideoFrameInterval&&window.clearInterval(r._firstVideoFrameInterval)}),this._timeout),this._watchForFirstVideoFrameSend(),Gj.print("rtcFirstFrameSend",Mm(f)),null===(_=this._monitor)||void 0===_||_.report("rtc_first_frame",f),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("audio"===e){var r,n,i,o,a,s,c;if(1!==this._audioFirstFrameState)return;var u={event_type:"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,vendor_mode:(null===(o=this._stream)||void 0===o?void 0:o.vendorCode)||0,pc_session_id:(null===(a=this._stream)||void 0===a?void 0:a.pcSessionId)||(null===(s=this._handler)||void 0===s?void 0:s.peerConnectionId)};this._firstAudioFrameTimer&&window.clearTimeout(this._firstAudioFrameTimer),delete this._currentAudioSend,Gj.print("rtcFirstFrameSend",Mm(u)),null===(c=this._monitor)||void 0===c||c.report("rtc_first_frame",u),this._audioFirstFrameState=2}else if("video"===e){var d,l,h,v,p,_,f;if(1!==this._videoFirstFrameState)return;var m={event_type:"sent_end",media_type:e,start:null===(d=this._currentVideoSend)||void 0===d?void 0:d.startTime,is_screen:!(null===(l=this._stream)||void 0===l||!l.isScreen),reason:t,result:!1,event_session_id:this._videoEventSessionId,type:null===(h=this._currentVideoSend)||void 0===h?void 0:h.type,vendor_mode:(null===(v=this._stream)||void 0===v?void 0:v.vendorCode)||0,pc_session_id:(null===(p=this._stream)||void 0===p?void 0:p.pcSessionId)||(null===(_=this._handler)||void 0===_?void 0:_.peerConnectionId)};this._firstVideoFrameTimer&&window.clearTimeout(this._firstVideoFrameTimer),delete this._currentVideoSend,Gj.print("rtcFirstFrameSend",Mm(m)),null===(f=this._monitor)||void 0===f||f.report("rtc_first_frame",m),this._videoFirstFrameState=2}}},{key:"sendFrameFinish",value:function(e){if("audio"===e){var t,r,n,i,o;if(1!==this._audioFirstFrameState)return;if(!this._currentAudioSend)return;var a=this._currentAudioSend,s=a.type,c=a.startTime,u={event_type:"sent_end",media_type:e,is_screen:!(null===(t=this._stream)||void 0===t||!t.isScreen),start:c,result:!0,event_session_id:this._audioEventSessionId,type:s,vendor_mode:(null===(r=this._stream)||void 0===r?void 0:r.vendorCode)||0,pc_session_id:(null===(n=this._stream)||void 0===n?void 0:n.pcSessionId)||(null===(i=this._handler)||void 0===i?void 0:i.peerConnectionId)};delete this._currentAudioSend,this._firstAudioFrameTimer&&window.clearTimeout(this._firstAudioFrameTimer),Gj.print("rtcFirstFrameSend",Mm(u)),null===(o=this._monitor)||void 0===o||o.report("rtc_first_frame",u),this._audioFirstFrameState=3}else if("video"===e){var d,l,h,v,p;if(1!==this._videoFirstFrameState)return;if(!this._currentVideoSend)return;var _=this._currentVideoSend,f=_.type,m=_.startTime,g={event_type:"sent_end",media_type:e,is_screen:!(null===(d=this._stream)||void 0===d||!d.isScreen),start:m,result:!0,event_session_id:this._videoEventSessionId,type:f,vendor_mode:(null===(l=this._stream)||void 0===l?void 0:l.vendorCode)||0,pc_session_id:(null===(h=this._stream)||void 0===h?void 0:h.pcSessionId)||(null===(v=this._handler)||void 0===v?void 0:v.peerConnectionId)};delete this._currentVideoSend,this._firstVideoFrameTimer&&window.clearTimeout(this._firstVideoFrameTimer),Gj.print("rtcFirstFrameSend",Mm(g)),null===(p=this._monitor)||void 0===p||p.report("rtc_first_frame",g),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("video","login"),null!==(r=this._stream)&&void 0!==r&&r.audioTrack&&this.beginSendFrame("audio","login");!e&&this._audioSending&&this.stopSendFrame("audio","leave_room"),!e&&this._videoSending&&this.stopSendFrame("video","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("video","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("audio","publish");!e&&this._audioSending&&this.stopSendFrame("audio","unpublish"),!e&&this._videoSending&&this.stopSendFrame("video","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("audio","unmute"),!e&&this._audioSending&&this.stopSendFrame("audio","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("audio","enable"),!e&&this._audioSending&&this.stopSendFrame("audio","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("video","unmute"),!e&&this._videoSending&&this.stopSendFrame("video","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("video","enable"),!e&&this._videoSending&&this.stopSendFrame("video","disable"))}},{key:"setExternalAudioSource",value:function(e){this._audioExternal!==e&&(this._audioExternal=e,e&&(this._audioSending&&this.stopSendFrame("audio","disable"),this._enableAudio=!1),e||(this._audioSending&&this.stopSendFrame("audio","stop_push"),this._pushAudio=!1))}},{key:"setPushAudio",value:function(e){this._pushAudio!==e&&(this._pushAudio=e,e&&this.beginSendFrame("audio","push"),!e&&this._audioSending&&this.stopSendFrame("audio","stop_push"))}},{key:"setExternalVideoSource",value:function(e){this._videoExternal!==e&&(this._videoExternal=e,e&&(this._videoSending&&this.stopSendFrame("video","disable"),this._enableVideo=!1),e||(this._videoSending&&this.stopSendFrame("video","stop_push"),this._pushVideo=!1))}},{key:"setPushVideo",value:function(e){this._pushVideo!==e&&(this._pushVideo=e,e&&this.beginSendFrame("video","push"),!e&&this._videoSending&&this.stopSendFrame("video","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("audio","audience"),!e&&this._videoSending&&this.stopSendFrame("video","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=Tm(Em().mark((function e(){var t,r,n,i,o,a,s,c;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=6;break}return e.next=3,KD(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,c=Gs(s).call(s,(function(e){return"outbound-rtp"===e.type})),e.abrupt("return",c);case 6:case"end":return e.stop()}}),e,this)}))),function(){return r.apply(this,arguments)})},{key:"_getFirstAudioFrameStats",value:(t=Tm(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,KD(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",mE(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(Tm(Em().mark((function n(){var i,o,a;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,o=0,a=0,null==i||Fm(i).call(i,(function(e){o+=e.framesSent,a+=e.packetsSent})),!(i&&i.length>0&&(o>t||a>r))){n.next=12;break}if(-1!==t||-1!==r){n.next=10;break}return t=o,r=a,n.abrupt("return");case 10:e.sendFrameFinish("video"),window.clearInterval(e._firstVideoFrameInterval);case 12: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(Tm(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("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:"login"},this._currentVideoSend={startTime:0,eventSessionId:0,type:"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}(),zj=(Qd(Fj={},"audio",{delay:1200,stallRadio:.3}),Qd(Fj,"video",{delay:1200,stallRadio:.6}),Qd(Fj,"screen_audio",{delay:1600,stallRadio:.8}),Qd(Fj,"screen_video",{delay:1600,stallRadio:.8}),Fj),Xj=function(){function e(){Ll(this,e),Qd(this,"_preUplinkStats",new JS),Qd(this,"_preDownlinkStats",new JS),Qd(this,"_timer",void 0),Qd(this,"_delayTimer",void 0),Qd(this,"_connectionState",Nj.CONNECTED),Qd(this,"reportor",void 0)}return Dl(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,bm(i=wm(o=[]).call(o,Yk(l),[d])).call(i,-2))}if(r.sentKBitrate>0&&r.rtt){var h,v,p=n?"screen_video":"video",_=r._fractionLost,f=r.rtt,m=r._sendBandWidth,g=r._retransmittedRate;0===m&&(_=Math.max(.65,_));var y=this._getQosLevel(f,_||0,g||0),S=this._preUplinkStats.get(p)||[y];this._preUplinkStats.set(p,bm(h=wm(v=[]).call(v,Yk(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=yl.VBAD;else{var l=s.rtt,h=s.audioLossRate,v=s.stallDuration,p=s.statsInterval,_=s.e2eDelay,f=v/p,m=u?"screen_audio":"audio",g=this._getQosLevel(l,h||0,c._retransmittedRate||0),y=this._getDownlinkQoE(m,f,_);r=this._getNetworkQuality(g,y)}if(a)if(0===c.receivedKBitrate||0===c.rtt)n=yl.VBAD;else{var S=c.rtt,b=c.videoLossRate,E=c.stallDuration,k=c.statsInterval,T=c.e2eDelay,I=c._retransmittedRate,A=E/k,R=u?"screen_video":"video",C=this._getQosLevel(S,b||0,I||0),w=this._getDownlinkQoE(R,A,T);n=this._getNetworkQuality(C,w)}var x=r&&n?Math.ceil((r+n)/2):r||n;if(x){var O,P,M,N=wm(O="".concat(d)).call(O,u?"_screen":""),D=this._preDownlinkStats.get(N)||[x];this._preDownlinkStats.set(N,bm(P=wm(M=[]).call(M,Yk(D),[x])).call(P,-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!==Nj.CONNECTED)e=t=yl.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")||yl.EXCELLENT;var c=Gs(n=Fm(i=Kk(eO(o=this._preDownlinkStats).call(o))).call(i,(function(e){return r._getBetterQualityAndRemoveOldest(e,"down")}))).call(n,(function(e){return e}));t=Math.ceil(lb(c).call(c,(function(e,t){return t+e}),0)/c.length)||yl.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=zj[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=yl.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,Yk(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&&WO(t)&&r.localaudio&&r.audiostream,videoActive:n&&QO(t)&&r.localvideo&&r.videostream}}}]),e}(),Kj=function(){function e(t){Ll(this,e),Qd(this,"_timer",void 0),Qd(this,"_remoteVideoSizeCache",{}),Qd(this,"_remoteScreenSizeCache",{}),Qd(this,"onchange",void 0),this._room=t,this._start()}return Dl(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,v=a.getSettings(),p=v.width,_=void 0===p?0:p,f=v.height,m=void 0===f?0:f;h===m&&d===_||"function"==typeof e.onchange&&e.onchange(i,n.isScreen,_,m),delete s[i],(n.isScreen?r:t)[i]={width:_,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}(),qj=Kk((new TextEncoder).encode("subt")),Yj={1:dR.SUBTITLE_ERR_POSTPROCESS,2:dR.SUBTITLE_ERR_CONNECTION_ERROR,3:dR.SUBTITLE_ERR_PROCESS_ERROR},Wj=new cO("SubtitleTool",1),Qj=function(e){if(e.extraInfo)try{var t,r=JSON.parse(e.extraInfo);r.source_language&&CE(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))||"";CE(i=["zh","en","ja"]).call(i,o)>-1&&(e.extraInfo=Mm({source_language:o}))}},Jj=function(){function e(t){var r,n,i;Ll(this,e),Qd(this,"_taskId",void 0),Qd(this,"_appId",void 0),Qd(this,"_roomId",void 0),Qd(this,"_userId",void 0),Qd(this,"onEvent",void 0),Qd(this,"onMessage",void 0),Qd(this,"_preConfig",void 0),Qd(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 Dl(e,[{key:"start",value:(n=Tm(Em().mark((function e(t){var r=this;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(Wj.print("start","Invoke config: %o",t),YP(t.mode,"mode",[Al.ASR_ONLY,Al.ASR_AND_TRANSLATION]),t.mode!==Al.ASR_AND_TRANSLATION||-1!==CE($j).call($j,t.targetLanguage||"")){e.next=4;break}throw new hR(dR.INVALID_PARAMS,"Invalid targetLanguage.");case 4:if(!this._taskId){e.next=6;break}throw new hR(dR.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:Rl.ERROR,errorCode:dR.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=Tm(Em().mark((function e(t){var r;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(YP(t.mode,"mode",[Al.ASR_ONLY,Al.ASR_AND_TRANSLATION]),t.mode!==Al.ASR_AND_TRANSLATION||-1!==CE($j).call($j,t.targetLanguage||"")){e.next=3;break}throw new hR(dR.INVALID_PARAMS,"Invalid targetLanguage.");case 3:if(!this._taskId){e.next=5;break}throw new hR(dR.SUBTITLE_ALREADY_ON,"Already started subtitle");case 5:if(this._taskId){e.next=7;break}throw new hR(dR.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;Wj.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:Rl.STOPPED}),e._clearTimer()}))}},{key:"reconnect",value:(t=Tm(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(){Wj.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 hR(Yj[r]||dR.SUBTITLE_ERR_UNKNOWN,n||"");null===(o=this.onEvent)||void 0===o||o.call(this,{event:Rl.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:Rl.STARTED}),this._clearTimer()}}},{key:"onMessageRecv",value:function(e){if(this._taskId&&this._preConfig){var t=Zj(e);if(t&&t.length>0){var r,n=this._preConfig,i=n.mode,o=n.targetLanguage,a=[];if(t.forEach((function(e){i===Al.ASR_ONLY?e.mode===i&&a.push(e):i===Al.ASR_AND_TRANSLATION&&(e.language!==o&&e.mode!==Al.ASR_ONLY||a.push(e),e.mode===Al.ASR_ONLY&&e.language===o&&a.push(Zd(Zd({},e),{},{mode:Al.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}(),Zj=function(e){var t=e.message;if(t instanceof ArrayBuffer&&t.byteLength>8)try{var r=new DataView(t,0),n=0;if(qj.every((function(e){return r.getUint8(n++)===e}))){var i=r.getUint32(n);if(n+=4,i===r.byteLength-8){var o=NO.ab2str(bm(t).call(t,8)),a=JSON.parse(o),s=a.data;if("subtitle"===a.type)return s}}}catch(c){}return!1},$j=["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 cO("Room",1),tG={audiostream:!0,extaudio:!1,extvideo:!1,localaudio:!0,localvideo:!1,videoDescriptions:[],videostream:!1,publishTime:0},rG=function(e){OI(A,e);var t,r,n,i,o,a,s,c,u,d,l,h,v,p,_,f,m,g,y,S,b,E,k,T,I=YI(A);function A(e,t){var r;return Ll(this,A),Qd($T(r=I.call(this)),"id",void 0),Qd($T(r),"_mediaServerClient",void 0),Qd($T(r),"_localStream",void 0),Qd($T(r),"_localScreenStream",void 0),Qd($T(r),"_remoteUsers",new JS),Qd($T(r),"_remoteStreams",new JS),Qd($T(r),"_remoteStreamStreamIdUserIdMap",{}),Qd($T(r),"_virtualStreams",[]),Qd($T(r),"_joinResolveCallback",void 0),Qd($T(r),"_joinRejectCallback",void 0),Qd($T(r),"_getAccessNode",void 0),Qd($T(r),"_getAccessFeedback",void 0),Qd($T(r),"_getAccessFeedbackIceNode",void 0),Qd($T(r),"_reconnectTimer",void 0),Qd($T(r),"_isReconnecting",void 0),Qd($T(r),"_context",void 0),Qd($T(r),"_sessionId",void 0),Qd($T(r),"_reconnectRecord",void 0),Qd($T(r),"_connectionLostTimer",void 0),Qd($T(r),"_liveControlMessage",void 0),Qd($T(r),"_serverConfig",void 0),Qd($T(r),"_liveTranscodingOnceSucc",!1),Qd($T(r),"_roomConfig",void 0),Qd($T(r),"_roomInfo",void 0),Qd($T(r),"_userDuplicateLoginTimerMap",new JS),Qd($T(r),"_networkQualityManager",void 0),Qd($T(r),"_videoSizeObserver",void 0),Qd($T(r),"_hasPublished",!1),Qd($T(r),"_subtitleTool",void 0),Qd($T(r),"_csrcUserIdMap",void 0),Qd($T(r),"_publishOnDemandItem",void 0),Qd($T(r),"_publishOnDemandBusy",!1),Qd($T(r),"_monitor",void 0),r.id=t.id,r._roomConfig=e,r._mediaServerClient=new Lj(t),r._reconnectRecord=new nG,r._addHandlerEventHandler(),r._isReconnecting=!1,r._networkQualityManager=new Xj,r._networkQualityManager.reportor=r._reportNetworkQuality.bind($T(r)),r._videoSizeObserver=new Kj($T(r)),r._videoSizeObserver.onchange=r._emitVideoSizeChange.bind($T(r)),r._context=t,r._csrcUserIdMap={},r._monitor=kO(r.id),r}return Dl(A,[{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:"roomConfig",set:function(e){this._roomConfig=e}},{key:"_addHandlerEventHandler",value:function(){var e,t,r,n,i,o,a,s,c,u,d,l,h,v,p,_,f,m,g,y,S,b,E,k,T,I,A,R,C,w,x,O,P,M=this;null===(e=this._mediaServerClient)||void 0===e||e.on(xM.ON_ADD_STREAM,this._onAddStream.bind(this)),null===(t=this._mediaServerClient)||void 0===t||t.on(xM.ON_ADD_STREAM_LIST,(function(e){Array.isArray(null==e?void 0:e.streamList)&&e.streamList.forEach((function(e){return M._onAddStream(e)}))})),null===(r=this._mediaServerClient)||void 0===r||r.on(xM.ON_REMOVE_STREAM,this._onRemoveStream.bind(this)),null===(n=this._mediaServerClient)||void 0===n||n.on(xM.ON_REMOVE_STREAM_LIST,(function(e){Array.isArray(null==e?void 0:e.streamList)&&e.streamList.forEach((function(e){return M._onRemoveStream(e)}))})),null===(i=this._mediaServerClient)||void 0===i||i.on(xM.USER_CONNECTION,this._onUserConnection.bind(this)),null===(o=this._mediaServerClient)||void 0===o||o.on(xM.USER_CONNECTION_LIST,(function(e){Array.isArray(null==e?void 0:e.userList)&&e.userList.forEach((function(e){return M._onUserConnection(e)}))})),null===(a=this._mediaServerClient)||void 0===a||a.on(xM.USER_DISCONNECTION,this._onUserDisconnection.bind(this)),null===(s=this._mediaServerClient)||void 0===s||s.on(xM.USER_DISCONNECTION_LIST,(function(e){Array.isArray(null==e?void 0:e.userList)&&e.userList.forEach((function(e){return M._onUserDisconnection(e)}))})),null===(c=this._mediaServerClient)||void 0===c||c.on(xM.ON_UPDATE_ROOM_ATTRIBUTES,this._onUpdateRoomAttributes.bind(this)),null===(u=this._mediaServerClient)||void 0===u||u.on(xM.ON_UPDATE_USER_ATTRIBUTES,this._onUpdateUserAttributes.bind(this)),null===(d=this._mediaServerClient)||void 0===d||d.on(xM.ON_UPDATE_STREAM_ATTRIBUTES,this._onUpdateStreamAttributes.bind(this)),null===(l=this._mediaServerClient)||void 0===l||l.on(xM.ON_PUSH_TRACK,this._onPushTrack.bind(this)),null===(h=this._mediaServerClient)||void 0===h||h.on(xM.ON_REMOVE_TRACK,this._onRemoveTrack.bind(this)),null===(v=this._mediaServerClient)||void 0===v||v.on(xM.NODE_CHANGE,this._nodeChange.bind(this)),null===(p=this._mediaServerClient)||void 0===p||p.on(xM.ON_CUSTOM_MESSAGE,this._onCustomMessage.bind(this)),null===(_=this._mediaServerClient)||void 0===_||_.on(xM.USER_MESSAGE_RECEIVED,this._onUserMessageReceived.bind(this)),null===(f=this._mediaServerClient)||void 0===f||f.on(xM.USER_BINARY_MESSAGE_RECEIVED,this._onUserBinaryMessageReceived.bind(this)),null===(m=this._mediaServerClient)||void 0===m||m.on(xM.POST_PROCESSING_MESSAGE,this._onPostProcessingMessage.bind(this)),null===(g=this._mediaServerClient)||void 0===g||g.on(xM.ON_USER_TOKEN_WILL_EXPIRE,this._onUserTokenWillExpire.bind(this)),null===(y=this._mediaServerClient)||void 0===y||y.on(xM.STREAM_CONTROL_MESSAGE,this._onStreamControlMessage.bind(this)),null===(S=this._mediaServerClient)||void 0===S||S.on(xM.ON_STREAM_FAILED,this._onStreamFailed.bind(this)),null===(b=this._mediaServerClient)||void 0===b||b.on(OM.RSCP,(function(e){!!mE(e).call(e,(function(e){var t,r,n;return null==e||null===(t=e.StreamIds)||void 0===t?void 0:_k(t).call(t,null===(r=M._localStream)||void 0===r||null===(n=r.stream)||void 0===n?void 0:n.id)}))&&(M._publishOnDemandItem=e,M._onPublishOnDemand())})),null===(E=this._mediaServerClient)||void 0===E||E.on(OM.RTT,this._onRTT.bind(this)),null===(k=this._mediaServerClient)||void 0===k||k.on(OM.SSC,this._onSSC.bind(this)),null===(T=this._mediaServerClient)||void 0===T||T.on(PM.ON_CONNECTION_STATE_CHANGE,this._onConnectionStateChange.bind(this)),null===(I=this._mediaServerClient)||void 0===I||I.on(PM.ON_VENDOR_CONNECTION_STATE_CHANGE,(function(e){return M.emit(PM.ON_VENDOR_CONNECTION_STATE_CHANGE,e)})),null===(A=this._mediaServerClient)||void 0===A||A.on(PM.ABNORMAL_DISCONNECTION,this._handleAbnormalDisconnection.bind(this)),null===(R=this._mediaServerClient)||void 0===R||R.on(xM.ON_SPEAKER_CHANGE,this._onMeetingSpeakerChange.bind(this)),null===(C=this._mediaServerClient)||void 0===C||C.on("onRemoteStreamStats",(function(e){M._networkQualityManager.updateDownlinkStats(e,M._findRemoteStreamByScreen(e.userId,e.isScreen)),M.emit(Ej.ON_REMOTE_STREAM_STATS,JO(e))})),null===(w=this._mediaServerClient)||void 0===w||w.on("onLocalStreamStats",(function(e){M._networkQualityManager.updateUplinkStats(e),M.emit(Ej.ON_LOCAL_STREAM_STATS,JO(e))})),null===(x=this._mediaServerClient)||void 0===x||x.on("prevIceNode",(function(e){M._getAccessFeedbackIceNode=e})),null===(O=this._mediaServerClient)||void 0===O||O.on(Ej.RESUBSCRIBE,(function(e){M.emit(Ej.RESUBSCRIBE,e)})),null===(P=this._mediaServerClient)||void 0===P||P.on(xM.ON_NOTIFY_RECONNECT,this._notifyReconnect.bind(this))}},{key:"_removeHandlerEventHandler",value:function(){var e;null===(e=this._mediaServerClient)||void 0===e||e.removeAllListeners()}},{key:"connect",value:(T=Tm(Em().mark((function e(t){return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._mediaServerClient.connect(t);case 2:case"end":return e.stop()}}),e,this)}))),function(e){return T.apply(this,arguments)})},{key:"join",value:(k=Tm(Em().mark((function e(t,r,n,i,o,a,s){var c,u=this;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return null===(c=this._monitor)||void 0===c||c.set({rtc_app_id:t,room_id:r,user_id:i.userId}),eG.print("join()"),e.abrupt("return",new qf((function(e,c){var d,l,h,v=PO();u._joinResolveCallback=function(t){var r,n;null===(r=u._monitor)||void 0===r||r.report("join_room",{type:"end",start:v,result:!0,reason:""},{enable_cloud_proxy:null===(n=u._roomInfo)||void 0===n?void 0:n.useCloudProxy}),u._initSubtitleTool(),e(t)},u._joinRejectCallback=function(e){var t,r;Array.isArray(e)&&e.length&&(e=e[0]),null===(t=u._monitor)||void 0===t||t.report("join_room",{type:"end",start:v,result:!1,reason:e.message},{enable_cloud_proxy:null===(r=u._roomInfo)||void 0===r?void 0:r.useCloudProxy}),c(e)},u._liveControlMessage=o,u._roomInfo={appId:t,roomId:r,token:n,userInfo:i,useCloudProxy:a,roomProfile:u._roomConfig.roomProfileType,expectedIDC:s},u.setSessionId(),null===(d=u._monitor)||void 0===d||d.report("join_room",{type:"begin",start:v,result:!1,reason:""},{enable_cloud_proxy:null===(l=u._roomInfo)||void 0===l?void 0:l.useCloudProxy,expectedIDC:null===(h=u._roomInfo)||void 0===h?void 0:h.expectedIDC}),u._join(u._joinResolveCallback,u._joinRejectCallback,!1)})));case 3:case"end":return e.stop()}}),e,this)}))),function(e,t,r,n,i,o,a){return k.apply(this,arguments)})},{key:"_join",value:(E=Tm(Em().mark((function e(t,r){var n,i,o,a,s,c,u,d,l=arguments;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=l.length>2&&void 0!==l[2]&&l[2],i=PO(),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:d=e.sent,this._mediaServerClient.roomAttributes=d.roomAttributes,null!==(o=d.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:d.clients,streams:d.streams}),this._isReconnecting=!1,null===(a=this._monitor)||void 0===a||a.set({rtc_vid:(null===(s=this._getAccessFeedbackIceNode)||void 0===s||null===(c=s.iceConfig)||void 0===c?void 0:c._abtest_vid)||""}),null===(u=this._monitor)||void 0===u||u.report("rtc_join_room",{error_code:0,deviceModel:"web",deviceManufacturer:"web",elapse:PO()-i}),this._onJoinSucc(d,n),e.next=27;break;case 21:if(e.prev=21,e.t0=e.catch(3),this._getAccessFeedback=void 0,this._getAccessNode=void 0,e.t0.code===dR.OPERATION_CANCEL||"function"!=typeof r){e.next=27;break}return e.abrupt("return",r(e.t0));case 27:case"end":return e.stop()}}),e,this,[[3,21]])}))),function(e,t){return E.apply(this,arguments)})},{key:"publishScreen",value:(b=Tm(Em().mark((function e(t,r,n,i,o){var a,s,c,u,d,l,h,v,p,_,f,m;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(eG.print("publishScreen()"),this._localScreenStream||(this._localScreenStream=new kV(this.id),null!==(a=this._mediaServerClient)&&void 0!==a&&null!==(s=a.vendorConfig)&&void 0!==s&&s.enableMultiVendor&&(this._localScreenStream.pcSessionId=nC()),this._localScreenStream.isScreen=!0,this._mediaServerClient.handler&&(this._localScreenStream.observer=new Hj(this._localScreenStream,this._mediaServerClient.handler))),c=!1,u=!1,d=!1,l=!1,!this._localScreenStream.videoTrack&&r?(r instanceof OU&&(u=!0),c=!0):this._localScreenStream.videoTrack&&!r&&(c=!1),!this._localScreenStream.audioTrack&&n?(n instanceof PU&&(l=!0),d=!0):this._localScreenStream.audioTrack&&!n&&(d=!1),this._localScreenStream.videoTrack=r,this._localScreenStream.audioTrack=n,this._localScreenStream.videoEncodeConfig=t,i&&(WO(i)&&(this._localScreenStream.pubAudio=o===Tj.PUB),QO(i)&&(this._localScreenStream.pubVideo=o===Tj.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===(h=this._localScreenStream)||void 0===h||!h.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===(v=this._localScreenStream.observer)||void 0===v||v.setPublish(!0),e.next=22,this._mediaServerClient.publish(this._localScreenStream);case 22:e.next=28;break;case 24:return u?null===(p=this._localScreenStream.observer)||void 0===p||p.setPushVideo(c):null===(_=this._localScreenStream.observer)||void 0===_||_.setEnableVideo(c),l?null===(f=this._localScreenStream.observer)||void 0===f||f.setPushAudio(d):null===(m=this._localScreenStream.observer)||void 0===m||m.setEnableAudio(d),e.next=28,this.updatePubScreenTrack();case 28:case"end":return e.stop()}}),e,this)}))),function(e,t,r,n,i){return b.apply(this,arguments)})},{key:"updatePubScreenTrack",value:(S=Tm(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=Tm(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=Tm(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=Tm(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:(f=Tm(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 f.apply(this,arguments)})},{key:"updateUserAttributes",value:(_=Tm(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 _.apply(this,arguments)})},{key:"publish",value:(p=Tm(Em().mark((function e(t,r,n,i,o,a){var s,c,u,d,l,h,v,p,_,f,m,g,y,S,b,E=arguments;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(s=E.length>6&&void 0!==E[6]&&E[6],eG.print("publish","Invoke publish"),c=!1,this._localStream||(this._localStream=new kV(this.id),null!==(u=this._mediaServerClient)&&void 0!==u&&null!==(d=u.vendorConfig)&&void 0!==d&&d.enableMultiVendor&&(this._localStream.pcSessionId=nC()),this._mediaServerClient.handler&&(this._localStream.observer=new Hj(this._localStream,this._mediaServerClient.handler)),c=!0,this._localStream.vendorCode=(null===(l=this._mediaServerClient.vendorConfig)||void 0===l?void 0:l.vendorCode)||0),this._localStream.videoTrack=n,this._localStream.audioTrack=i,this._localStream.videoEncodeConfig=t,this._localStream.enableSimulcast=r,o&&(WO(o)&&(this._localStream.pubAudio=a===Tj.PUB),QO(o)&&(this._localStream.pubVideo=a===Tj.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===(h=this._localStream.observer)||void 0===h||h.setLogin(!0):c&&(v=!!this._localStream.videoTrack,p=!!this._localStream.audioTrack,_=this._localStream.videoTrack instanceof OU,f=this._localStream.audioTrack instanceof PU,this._roomConfig.isAutoPublish&&!this._hasPublished?(v&&(_?null===(m=this._localStream.observer)||void 0===m||m.setPushVideo(!0):null===(g=this._localStream.observer)||void 0===g||g.setEnableVideo(!0)),p&&(f?null===(y=this._localStream.observer)||void 0===y||y.setPushAudio(!0):null===(S=this._localStream.observer)||void 0===S||S.setEnableAudio(!0))):null===(b=this._localStream.observer)||void 0===b||b.setPublish(!0)),e.next=16,this._mediaServerClient.publish(this._localStream);case 16:this._hasPublished=!0,this.emit(Ej.ON_PUBLISH_RESULT,{isScreen:!1,state:ol.PUBLISH_SUCC}),e.next=24;break;case 20:throw e.prev=20,e.t0=e.catch(12),this.emit(Ej.ON_PUBLISH_RESULT,{isScreen:!1,state:ol.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:(v=Tm(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 v.apply(this,arguments)})},{key:"unpublish",value:(h=Tm(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=Tm(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=Tm(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=Tm(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,v=0;v<(null==d?void 0:d.length);v++){var p,_;if(h>=(null===(p=d[v])||void 0===p?void 0:p.width)*(null===(_=d[v])||void 0===_?void 0:_.height)){l=v;break}}var f=d[0];if(-1===l)f=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);f=g<.1?d[l-1]:d[l],l=g<.1?l-1:l}return a=null!==(r=null===(n=f)||void 0===n?void 0:n.sub_index)&&void 0!==r?r:-1,{spatialLayer:null!==(i=null===(o=f)||void 0===o?void 0:o.video_index)&&void 0!==i?i:l,spatialSubLayer:a}}},{key:"unsubscribe",value:(c=Tm(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=Tm(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 hR(dR.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=Tm(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=Tm(Em().mark((function e(){var t,r,n,i,o,a,s,c,u,d,l,h=arguments;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:r=h.length>0&&void 0!==h[0]&&h[0],eG.print("leave","Invoke leave"),n=PO(),null===(t=this._subtitleTool)||void 0===t||t.destroy(),delete this._subtitleTool,e.prev=5,this._mediaServerClient.connectionState!==Nj.CONNECTED&&this._joinRejectCallback&&this._joinRejectCallback(new Error("leave_room")),clearTimeout(this._reconnectTimer),s=JT(rA(a=this._remoteStreams).call(a));try{for(s.s();!(c=s.n()).done;)u=c.value,Array.isArray(u)&&u.forEach((function(e){var t;null===(t=e.observer)||void 0===t||t.setLogin(!1)}))}catch(v){s.e(v)}finally{s.f()}return this._localStream&&(null===(d=this._localStream.observer)||void 0===d||d.setLogin(!1)),e.next=13,this._mediaServerClient.leave();case 13:this.destroy(),null===(i=this._monitor)||void 0===i||i.report("rtc_leave_room",{error_code:0,message:"",elapse:PO()-n}),null===(o=this._monitor)||void 0===o||o.set({room_id:"",user_id:"",rtc_session_id:"",rtc_vid:""}),e.next=26;break;case 18:if(e.prev=18,e.t0=e.catch(5),!r){e.next=24;break}throw e.t0;case 24:this.destroy();case 25:e.t0 instanceof Error&&(null===(l=this._monitor)||void 0===l||l.report("rtc_leave_room",{error_code:-1,message:e.t0.message,elapse:PO()-n}));case 26:case"end":return e.stop()}}),e,this,[[5,18]])}))),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(t){var n=(r._context||{}).userPriority;t.hasSubscribed&&null!=n&&n.has(e)&&r._mediaServerClient.updateSubPriority(t,n.get(e))}))}},{key:"destroy",value:function(){var e;eG.print("destroy","Invoke destroy"),AO(this.id,"room_destroy","".concat((new Error).stack)),null===(e=this._subtitleTool)||void 0===e||e.destroy(),delete this._subtitleTool,this._destroyAndInitMediaServerClient(),this._roomInfo=void 0,this._remoteUsers=new JS;var t,r,n,i=JT(this._remoteStreams);try{for(i.s();!(t=i.n()).done;){var o=ZT(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 JS,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._reconnectRecord=new nG,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=Tm(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.prev=2,e.next=5,this._mediaServerClient.updateToken(t);case 5:e.next=11;break;case 7:throw e.prev=7,e.t0=e.catch(2),this.safeEmit(Ej.ON_ROOM_ERROR,{errorCode:dR.UPDATE_TOKEN_WITH_INVALID_TOKEN}),e.t0;case 11:case"end":return e.stop()}}),e,this,[[2,7]])}))),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(){var e;this._sessionId=tC(),null===(e=this._monitor)||void 0===e||e.set({rtc_session_id:this._sessionId})}},{key:"sendRoomMessage",value:(n=Tm(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,NO.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 Lj(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(Ej.ON_VIDEO_STREAM_BANNED,{uid:t.clientId,banned:1===t.attributes.serverMuteVideo}),t.attributes.serverMuteAudio&&o.safeEmit(Ej.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=JT(rA(n=this._remoteUsers).call(n));try{for(h.s();!(l=h.n()).done;){var v=l.value;v._stillExist||s.push({clientId:v.userId}),delete v._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,_=JT(rA(i=this._remoteStreams).call(i));try{for(_.s();!(p=_.n()).done;){var f=p.value;Array.isArray(f)&&f.forEach((function(e){e.stillExist?delete e.stillExist:c.push({clientId:e.userId,streamId:e.streamId,message:CM.clientDisconnected})}))}}catch(m){_.e(m)}finally{_.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,n,i,o=this;this._localStream&&(this._localStream.clean(),this._localStream.vendorCode=(null===(r=this._mediaServerClient.vendorConfig)||void 0===r?void 0:r.vendorCode)||0,null===(n=this._localStream.observer)||void 0===n||n.setLogin(!0),this._mediaServerClient.publish(this._localStream).catch((function(e){})));this._localScreenStream&&(this._localScreenStream.clean(),null===(i=this._localScreenStream.observer)||void 0===i||i.setLogin(!0),this._mediaServerClient.publish(this._localScreenStream).catch((function(e){})));var a,s=JT(rA(t=this._remoteStreams).call(t));try{for(s.s();!(a=s.n()).done;){var c=a.value;Array.isArray(c)&&c.forEach(function(){var e=Tm(Em().mark((function e(t){var r,n,i,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(r="start resubscribe ".concat(t.userId," with ")).call(r,t.subMediaType)),e.next=6,o._mediaServerClient.subscribe(t,t.subMediaType);case 6:eG.print(wm(n="success resubscribe ".concat(t.userId," with ")).call(n,t.subMediaType)),o.safeEmit(Ej.RESUBSCRIBE,{stream:t}),e.next=15;break;case 10:e.prev=10,e.t0=e.catch(2),eG.print(wm(i=wm(a="failed resubscribe ".concat(t.userId," with ")).call(a,t.subMediaType,", error:")).call(i,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(u){s.e(u)}finally{s.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=mE(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 TV(this.id,"ff-stream","ff-stream",!1,!1,tG);s.virtual=!0,s.audioTransceiver=a,s.audioMid="0",s.audioTrack=qU(i),this._virtualStreams.push(s),this.safeEmit(Ej.SUBSCRIBE_PUSH_TRACK,{stream:s})}}}},{key:"_findRemoteStream",value:function(e,t){var r=this._remoteStreams.get(e);return Array.isArray(r)?mE(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)?mE(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 v,p=null===(v=this._remoteStreams.get(e.clientId))||void 0===v?void 0:Gs(v).call(v,(function(e){return e.streamId!==h.streamId}));h.clean(),this._remoteStreams.set(e.clientId,p||[])}var _=this._findRemoteStream(e.clientId,e.streamId);if(this._remoteStreamStreamIdUserIdMap[e.streamId]=e.clientId,_)_.attributes=e.attributes;else if((_=new TV(this.id,e.clientId,e.streamId,e.screen,!1,e.attributes)).virtual=c,this._initStreamListeners(_),!c){var f=this._remoteStreams.get(e.clientId);f?f.push(_):this._remoteStreams.set(e.clientId,[_])}if(this._mediaServerClient.handler&&(_.observer=new jj(_,this._mediaServerClient.handler)),!_.isScreen&&l){var m,g,y,S,b,E,k,T;if(a&&_.hasVideo)if(_.attributes.extvideo)null===(m=_.observer)||void 0===m||m.setExternalVideoSource(!0),null===(g=_.observer)||void 0===g||g.setPushVideo(!0);else null===(y=_.observer)||void 0===y||y.setExternalVideoSource(!1),null===(S=_.observer)||void 0===S||S.setPublishVideo(!0);if(a&&_.hasAudio&&d&&!this._mediaServerClient.roomAttributes.multiChatMode)if(_.attributes.extaudio)null===(b=_.observer)||void 0===b||b.setExternalAudioSource(!0),null===(E=_.observer)||void 0===E||E.setPushAudio(!0);else null===(k=_.observer)||void 0===k||k.setExternalAudioSource(!1),null===(T=_.observer)||void 0===T||T.setPublishAudio(!0);if(!0===i&&!1===a){var I,A=this._roomConfig,R=A.isAutoSubscribeAudio,C=A.isAutoSubscribeVideo;null===(I=_.observer)||void 0===I||I.setLogin(!0,{audio:!!R,video:!!C})}}return i&&this.safeEmit(xM.ON_ADD_STREAM,{stream:_}),_}}},{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,Zd({},n)),this.safeEmit(xM.USER_CONNECTION,{userInfo:n}),e.attributes&&(e.attributes.serverMuteVideo&&this.safeEmit(Ej.ON_VIDEO_STREAM_BANNED,{uid:e.clientId,banned:1===e.attributes.serverMuteVideo}),e.attributes.serverMuteAudio&&this.safeEmit(Ej.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===MM.kickedByAdmin?a=dR.KICKED_OUT:i===MM.onUserTokenDidExpire?a=dR.TOKEN_EXPIRED:i===MM.userDuplicateLogin&&(a=dR.DUPLICATE_LOGIN),o===NM.roomDismissByAdmin&&(a=dR.ROOM_DISMISS),a&&this.safeEmit(Ej.ON_ROOM_ERROR,{errorCode:a})}else{var s=tl.DROPPED;i===MM.userLeave?s=tl.QUIT:i===MM.kickedByAdmin?s=tl.KICKED_BY_ADMIN:i===MM.roleChanged&&(s=tl.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:CM.clientDisconnected})})),r._remoteStreams.delete(n),r.safeEmit(Ej.ON_USER_LEAVE,{userInfo:{userId:n},reason:s})};if(i===MM.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=mE(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(xM.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(Ej.ON_VIDEO_STREAM_BANNED,{uid:e.clientId,banned:1===e.attributes.serverMuteVideo}),e.attributes.serverMuteAudio&&this.safeEmit(Ej.ON_AUDIO_STREAM_BANNED,{uid:e.clientId,banned:1===e.attributes.serverMuteAudio}))}},{key:"_onUpdateRoomAttributes",value:function(e){var t;e.roomAttributes&&(this._mediaServerClient.roomAttributes=Zd(Zd({},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=Zd(Zd({},d),a),h=!1,v=l.localaudio!==d.localaudio,p=!1,_=!1,f=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|=ul.AUDIO:y|=ul.AUDIO),l.videostream!==d.videostream&&(_=l.localvideo,m=!!l.videostream,l.videostream?g|=ul.VIDEO:y|=ul.VIDEO),g&&this.safeEmit(Ej.ON_USER_PUBLISH_STATE_CHANGE,{userId:i,mediaType:g,isScreen:s.isScreen,pubState:Tj.PUB,remoteStream:s}),y&&this.safeEmit(Ej.ON_USER_PUBLISH_STATE_CHANGE,{userId:i,mediaType:y,isScreen:s.isScreen,pubState:Tj.UNPUB,remoteStream:s}),s.attributes=l,l.localaudio!==d.localaudio)if(l.localaudio){var S,b,E,k;if(r&&l.audiostream)if(l.extaudio)null===(S=s.observer)||void 0===S||S.setExternalAudioSource(!0),null===(b=s.observer)||void 0===b||b.setPushAudio(!0);else null===(E=s.observer)||void 0===E||E.setExternalAudioSource(!1),null===(k=s.observer)||void 0===k||k.setEnableAudio(!0);this.safeEmit(Ej.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(Ej.ON_USER_STOP_AUDIO_CAPTURE,{userId:i})}if(l.localvideo!==d.localvideo)if(l.localvideo){var C,w,x,O;if(n&&l.videostream)if(l.extvideo)null===(C=s.observer)||void 0===C||C.setExternalVideoSource(!0),null===(w=s.observer)||void 0===w||w.setPushVideo(!0);else null===(x=s.observer)||void 0===x||x.setExternalVideoSource(!1),null===(O=s.observer)||void 0===O||O.setEnableVideo(!0);this.safeEmit(Ej.ON_USER_START_VIDEO_CAPTURE,{userId:i})}else{var P,M,N,D;if(l.extvideo)null===(P=s.observer)||void 0===P||P.setExternalVideoSource(!0),null===(M=s.observer)||void 0===M||M.setPushVideo(!1);else null===(N=s.observer)||void 0===N||N.setExternalVideoSource(!1),null===(D=s.observer)||void 0===D||D.setEnableVideo(!1);!s.isScreen&&this.safeEmit(Ej.ON_USER_STOP_VIDEO_CAPTURE,{userId:i})}if(h&&!v)null===(c=s.observer)||void 0===c||c.setRemoteUnmuteAudio(p);if(_&&!f)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&&uR(t).call(t,"audio_mux")){var n=this._onAddStream(Zd(Zd({},e),{},{attributes:tG}),{needEmit:!1,fromSignal:!1,virtual:!0});n&&this._mediaServerClient.subscribe4pushTrack(n,e).then((function(){r.safeEmit(Ej.SUBSCRIBE_PUSH_TRACK,{stream:n}),r._virtualStreams.push(n)})).catch((function(e){eG.print("subscribe","push track failed %o",e)}))}else{var i,o;null===(i=this._monitor)||void 0===i||i.report("rtc_error",{message:wm(o="onPushTrack, userId: ".concat(e.clientId,", ")).call(o,e.streamId),error_code:-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=ZT(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&&FA(t).call(t,(function(e,t){return e.audioLevel-t.audioLevel})),t}},{key:"_nodeChange",value:function(e){var t,r,n=e.nodes,i=e.reason;null===(t=this._monitor)||void 0===t||t.report("rtc_node_change",{error_code:0,message:Mm(e),reason:Mm(i)}),NP.clearAccessNode(null===(r=this._roomInfo)||void 0===r?void 0:r.appId),this._destroyAndInitMediaServerClient(),Array.isArray(n)&&n.length?this._getAccessNode=n[0]:this._getAccessFeedback=i,this._joinResolveCallback&&this._joinRejectCallback?this._join(this._joinResolveCallback,this._joinRejectCallback):this._reconnect()}},{key:"_notifyReconnect",value:function(){this._reconnect()}},{key:"_reconnect",value:function(){var e,t,r,n,i=this;this._isReconnecting=!0;var o,a=JT(rA(n=this._remoteStreams).call(n));try{for(a.s();!(o=a.n()).done;){var s=o.value;Array.isArray(s)&&s.forEach((function(e){return e.clean()}))}}catch(c){a.e(c)}finally{a.f()}null===(e=this.localStream)||void 0===e||e.clean(),null===(t=this.localScreenStream)||void 0===t||t.clean(),null===(r=this._monitor)||void 0===r||r.report("rtc_reconnect",{error_code:1002,message:"peerconnection reconnecting",reconnect_id:this._roomInfo.userInfo.userId,reconnect_type:"peerconnection"}),this._liveTranscodingOnceSucc||delete this._liveControlMessage,this._join((function(){var e;null===(e=i._monitor)||void 0===e||e.report("rtc_reconnected",{message:"peerconnection reconnected",reconnect_type:"peerconnection"})}),(function(e){i._reconnectRecord.record(e),i._reconnectRecord.shouldReconnect?(eG.print("Reconnecting error, will reconnect after 3s",e),i._reconnectTimer=window.setTimeout(i._reconnect.bind(i),3e3)):(i.safeEmit(Ej.RECONNECT_FAILED),i.destroy())}),!0)}},{key:"_handleAbnormalDisconnection",value:function(){var e,t;eG.print("on ABNORMAL_DISCONNECTION"),null===(e=this.localStream)||void 0===e||e.stopReport(),null===(t=this.remoteStreams)||void 0===t||t.forEach((function(e){return null==e?void 0:e.forEach((function(e){return e.stopReport()}))})),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===Nj.DISCONNECTED)t=ll.CONNECTION_STATE_DISCONNECTED;else if(e.next===Nj.CONNECTED)clearTimeout(this._connectionLostTimer),t=this._isReconnecting?ll.CONNECTION_STATE_RECONNECTED:ll.CONNECTION_STATE_CONNECTED;else{if(e.next!==Nj.CONNECTING)return;t=this._isReconnecting?ll.CONNECTION_STATE_RECONNECTING:ll.CONNECTION_STATE_CONNECTING}e.prev===Nj.CONNECTED&&e.next===Nj.DISCONNECTED&&(this._connectionLostTimer=window.setTimeout((function(){r.safeEmit(PM.ON_CONNECTION_STATE_CHANGE,{state:ll.CONNECTION_STATE_LOST})}),1e4)),this._networkQualityManager.setConnectionState(e.next),this.safeEmit(PM.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(Ej.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?cl.STREAM_INDEX_SCREEN:cl.STREAM_INDEX_MAIN}})}))}},{key:"_onCustomMessage",value:function(e){this.safeEmit(xM.ON_CUSTOM_MESSAGE,e)}},{key:"_onUserMessageReceived",value:function(e){this.safeEmit(xM.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(xM.USER_BINARY_MESSAGE_RECEIVED,r)}},{key:"_initSubtitleTool",value:function(){var e=this;this._subtitleTool=new Jj(this),this._subtitleTool.onEvent=function(t){e.emit(Ej.ON_SUBTITLE_STATE_CHANGED,t)},this._subtitleTool.onMessage=function(t){e.emit(Ej.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=kj.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=kj.START_FAILED);break;case"TranscodeStateChanged":n=0!==t.error?kj.START_FAILED:kj.START_SUCCESS;break;case"TranscodeStopped":n=0!==t.error?kj.STOP_FAILED:kj.STOP_SUCCESS;break;case"TranscodeUpdated":n=0!==t.error?kj.UPDATE_FAILED:kj.UPDATE_SUCCESS}this.safeEmit(xM.POST_PROCESSING_MESSAGE,{code:r,protocol:t.protocol,error:t.error,eventType:n,message:i[r]})}this.safeEmit(xM.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(xM.ON_USER_TOKEN_WILL_EXPIRE,null)}},{key:"_onStreamFailed",value:(r=Tm(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,ul.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(Ej.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===wM.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=Tm(Em().mark((function e(){var t,r,n,i,o,a,s,c,u,d,l,h,v,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&&_k(t).call(t,d)){var r=null==e?void 0:e.Metadata.VideoIndex;p[r]=!0}})),h.encodings=Fm(v=h.encodings).call(v,(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:"_onSSC",value:function(e){var t=e.StreamIds,r=e.Metadata,n=t[0],i=this._remoteStreamStreamIdUserIdMap[n],o=this._findRemoteStream(i,n),a={userId:i,isScreen:!!o&&o.isScreen,beforeVideoIndex:r.ssc_items[0].prev_layer_id,afterVideoIndex:r.ssc_items[0].cur_layer_id,beforeEnable:0!==r.ssc_items[0].prev_video_open,afterEnable:0!==r.ssc_items[0].cur_video_open,reason:r.ssc_items[0].change_reason};this.emit(Ej.ON_SIMULCAST_SUBSCRIBE_FALLBACK,a)}},{key:"_reportNetworkQuality",value:function(e,t){this.emit(Ej.ON_NETWORK_QUALITY,e,t)}},{key:"_emitVideoSizeChange",value:function(e,t,r,n){var i;this.emit(Ej.ON_REMOTE_VIDEO_SIZE_CHANGED,{roomId:null===(i=this.roomInfo)||void 0===i?void 0:i.roomId,userId:e,streamIndex:t?cl.STREAM_INDEX_SCREEN:cl.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()}}]),A}(fM),nG=function(){function e(){Ll(this,e),Qd(this,"_all_201_count",void 0),Qd(this,"_has_4xx",void 0),this._all_201_count=0,this._has_4xx=!1}return Dl(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;Fm(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&&Ab(r.style,t.style),t.attributes&&bR(t.attributes).forEach((function(e){var t=ZT(e,2),n=t[0],i=t[1];"muted"===n?r.muted=!0:r.setAttribute(n,i)})),r},oG=new cO("Player",0),aG=["play","playing","pause","ended","error","seeking","seeked","waiting","canplay","canplaythrough","durationchange","volumechange","loadedmetadata","loadeddata","loadstart","timeupdate"],sG={playsinline:"","webkit-playsinline":""},cG={playsinline:"","webkit-playsinline":"","x5-playsinline":"","x5-video-player-type":"h5","x-webkit-airplay":"allow",preload:"",muted:""},uG=function(e){OI(n,e);var t,r=YI(n);function n(e,t){var i;Ll(this,n),Qd($T(i=r.call(this)),"_containerDom",void 0),Qd($T(i),"_videoDom",void 0),Qd($T(i),"__cumulativeTime",void 0),Qd($T(i),"userId",void 0),Qd($T(i),"renderMode",void 0),Qd($T(i),"mirrorType",hl.MIRROR_TYPE_NONE),Qd($T(i),"isScreen",void 0),Qd($T(i),"isLocal",void 0),Qd($T(i),"played",!1),Qd($T(i),"_needLoad",!1),Qd($T(i),"_emitPlayFailed",!1),Qd($T(i),"_videoContainer",void 0),Qd($T(i),"_safari15VideoTimer",void 0),Qd($T(i),"_monitor",void 0),Qd($T(i),"emitVideoEvent",(function(e){var t,r,n={type:"video",rawEvent:e,readyState:(null===(t=i._videoDom)||void 0===t?void 0:t.readyState)||0,userId:i.userId,eventName:e.type,currentTime:(null===(r=i._videoDom)||void 0===r?void 0:r.currentTime)||0,isScreen:i.isScreen};switch(i.emit("playback_event",n),e.type){case"canplay":case"loadeddata":i._internalPlay();break;case"playing":oG.print("VideoPlayerPlaying","[userId-".concat(i.userId,"] video element playing"))}})),Qd($T(i),"_internalPlay",(function(){var e;if(null!==(e=i._videoDom)&&void 0!==e&&e.paused){var t=i._videoDom.play();null!=t&&t.then&&t.then((function(){var e;i.isLocal&&dP&&!i._needLoad&&(null===(e=i._videoDom)||void 0===e||e.load(),i._needLoad=!0)})).catch((function(e){var t,r,n,o,a,s;i._emitPlayFailed||("AbortError"!==e.name?(i._emitPlayFailed=!0,null===(t=i._monitor)||void 0===t||t.report("rtc_error",{message:wm(r="video autoplay failed, userId: ".concat(i.userId,", ")).call(r,e.name),error_code:-1e3}),i.emit("playback_event",{type:"video",rawEvent:e,readyState:(null===(n=i._videoDom)||void 0===n?void 0:n.readyState)||0,userId:i.userId,eventName:"autoplay-error",currentTime:(null===(o=i._videoDom)||void 0===o?void 0:o.currentTime)||0,isScreen:i.isScreen})):null===(a=i._monitor)||void 0===a||a.report("rtc_error",{message:wm(s="video autoplay failed, userId: ".concat(i.userId,", ")).call(s,e.name),error_code:-1e3}))}))}})),i.engineId=e;var o=t.renderDom;i._monitor=kO(e);var a=t.userId,s=t.isScreen?sl.RENDER_MODE_FIT:sl.RENDER_MODE_HIDDEN;i.renderMode=void 0!==t.renderMode?t.renderMode:s;var c="string"==typeof o?document.getElementById(o):o;if(!c)throw new hR(dR.CANT_FIND_DOM,"can't find dom");return i._videoContainer=document.createElement("div"),i._videoContainer.style.width="100%",i._videoContainer.style.height="100%",i._videoContainer.style.position="relative",i._videoContainer.style.overflow="hidden",i._containerDom=c,i.userId=a,i.isLocal=!!t.isLocal,i.isScreen=!!t.isScreen,i._initVideo(),i}return Dl(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,OO()),this.setRenderMode(this.renderMode),this.mirror(this.mirrorType===hl.MIRROR_TYPE_RENDER));this._videoContainer.appendChild(this._videoDom),this._containerDom.appendChild(this._videoContainer),this._initListeners()}},{key:"_initListeners",value:function(){var e=this;this._videoDom&&aG.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&&aG.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:.55;if(cP){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(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=PO();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=PO()-(e.statsReport.pauseStart||0);i>500&&(e.statsReport.pauseDuration+=i)}}}))}},{key:"setRenderMode",value:function(e){this.renderMode=e,this._videoDom&&(this.renderMode===sl.RENDER_MODE_FIT?this._videoDom.style.objectFit="contain":this.renderMode===sl.RENDER_MODE_FILL?this._videoDom.style.objectFit="fill":this._videoDom.style.objectFit="cover")}},{key:"playVideo",value:(t=Tm(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,oG.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{AO(this.engineId,"playVideo","play video repeatedly",0,this.userId)}catch(TK){}return e.abrupt("return");case 5:o||(this._initVideo(),o=this._videoDom),oG.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&&FP.VIDEO_STALL&&(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:"removeTrack",value:function(){var e,t=null===(e=this._videoDom)||void 0===e?void 0:e.srcObject;if(t){var r=t.getVideoTracks();null!=r&&r.length&&r.forEach((function(e){t.removeTrack(e)}))}}},{key:"manuallyPlay",value:function(){if(oG.print("Invoke VideoPlayer.manuallyPlay",this.userId,this.isScreen),this._emitPlayFailed=!1,!this._videoDom)throw new hR(dR.INVALID_PARAMS,"Player not found");return 0!==this._videoDom.readyState||vP?this._videoDom.play():qf.resolve()}},{key:"mirror",value:function(e){var t;oG.print("mirror",wm(t="".concat(this.userId," set mirror: ")).call(t,e)),this.mirrorType=e?hl.MIRROR_TYPE_RENDER:hl.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;(oG.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];oG.print("destroy","video player: ".concat(this.userId)),this.stop(e),wI(RI(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}(vM.exports.EventEmitter),dG=function(e){OI(i,e);var t,r,n=YI(i);function i(e,t){var r,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{divId:void 0,muted:!1,isScreen:!1},a=o.divId,s=o.muted,c=o.isScreen;if(Ll(this,i),Qd($T(r=n.call(this)),"_containerDom",void 0),Qd($T(r),"_audioDom",void 0),Qd($T(r),"_fakeAudioDom",void 0),Qd($T(r),"userId",void 0),Qd($T(r),"muted",!1),Qd($T(r),"_emitPlayFailed",!1),Qd($T(r),"played",!1),Qd($T(r),"isScreen",void 0),Qd($T(r),"_wechatTimer",void 0),Qd($T(r),"_monitor",void 0),Qd($T(r),"_pasued",!0),Qd($T(r),"emitAudioEvent",(function(e){var t,n,i={type:"audio",rawEvent:e,readyState:(null===(t=r._audioDom)||void 0===t?void 0:t.readyState)||0,userId:r.userId,eventName:e.type,currentTime:(null===(n=r._audioDom)||void 0===n?void 0:n.currentTime)||0};"playing"===e.type&&oG.print("AudioPlayerPlaying","[userId-".concat(r.userId,"] audio element playing")),"pause"===e.type&&(oG.print("AudioPlayerPause","[userId-".concat(r.userId,"] audio element pause")),r._pasued||r._internalPlay()),fP&&vP&&("canplay"===e.type?(clearTimeout(r._wechatTimer),r._wechatTimer=window.setTimeout((function(){r._autoPlayError("wechat")}),500)):"playing"===e.type&&clearTimeout(r._wechatTimer)),r.emit("playback_event",i)})),Qd($T(r),"_internalPlay",(function(){var e,t;if(AO(r.engineId,"_internalPlay",{paused:null===(e=r._audioDom)||void 0===e?void 0:e.paused}),null!==(t=r._audioDom)&&void 0!==t&&t.paused)try{var n,i=r._audioDom.play(),o=fU.getAudioContextInstance();if("suspended"===o.state){var a=o.resume(),s=setTimeout((function(){var e;"suspended"===o.state&&(r._autoPlayError("AudioContext cannot resume"),null===(e=r._monitor)||void 0===e||e.report("rtc_error",{message:"audio autoplay failed, userId: ".concat(r.userId,": Cannot resume the AudioContext - timeout"),error_code:-1e3}));clearTimeout(s)}));a.catch((function(e){var t,n,i;r._autoPlayError("AudioContext cannot resume"),null===(t=r._monitor)||void 0===t||t.report("rtc_error",{message:wm(n=wm(i="audio autoplay failed, userId: ".concat(r.userId,": Cannot resume the AudioContext - rejected by: [")).call(i,null==e?void 0:e.name,"]")).call(n,null==e?void 0:e.message),error_code:-1e3})})).finally((function(){clearTimeout(s)}))}null!==(n=i)&&void 0!==n&&n.then&&(fP&&pP&&(i=i.then((function(){return new qf((function(e){setTimeout(Tm(Em().mark((function t(){var n;return Em().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return null===(n=r._audioDom)||void 0===n||n.pause(),r._audioDom.volume=1,t.next=4,r._audioDom.play();case 4:e();case 5:case"end":return t.stop()}}),t)}))),500)}))}))),i.then((function(){AO(r.engineId,"_internalPlay successfully",{userId:r.userId}),r._pasued=!1})).catch((function(e){var t,n,i;r._autoPlayError(e),null===(t=r._monitor)||void 0===t||t.report("rtc_error",{message:wm(n=wm(i="audio autoplay failed, userId: ".concat(r.userId,": ")).call(i,e.message," ")).call(n,e.name),error_code:-1e3})})))}catch(l){var c,u,d;r._autoPlayError(l),null===(c=r._monitor)||void 0===c||c.report("rtc_error",{message:wm(u=wm(d="audio autoplay failed, userId: ".concat(r.userId,": ")).call(d,l.message," ")).call(u,l.name),error_code:-1e3})}})),r.engineId=e,a){var u=document.getElementById(a);if(!u)throw new hR(dR.CANT_FIND_DOM,"can't find dom");r._containerDom=u}else r._containerDom=document.body;return r.userId=t,r.muted=s,r.isScreen=c,r._monitor=kO(e),r._initAudio(),r}return Dl(i,[{key:"_initAudio",value:function(){var e;this._audioDom||(this._audioDom=iG("audio",{style:{display:"none"},attributes:sG}),this._audioDom.volume=this.muted?0:1,this._audioDom.muted=this.muted,this._audioDom.id=wm(e="".concat(this.userId,"_")).call(e,OO()),this._containerDom.appendChild(this._audioDom));this._initListeners()}},{key:"_initListeners",value:function(){var e=this;this._audioDom&&aG.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&&(aG.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=Tm(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(oG.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,t instanceof nV?(this._fakeAudioDom=new Audio,this._fakeAudioDom.muted=!0,this._fakeAudioDom.srcObject=new MediaStream([t.getOrgTrack()]),a.addTrack(t.getTrack())):a.addTrack(t.getTrack("preprocessing")),fP&&pP&&(this._audioDom.volume=0),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 13: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 hR(dR.INVALID_PARAMS,"Player not found");this._pasued=!0,this._audioDom.pause()}},{key:"manuallyPlay",value:function(){var e,t=this;if(oG.print("Invoke AudioPlayer.manuallyPlay"),this._emitPlayFailed=!1,!this._audioDom)throw new hR(dR.INVALID_PARAMS,"Player not found");if(!this.played)return qf.resolve();this._audioDom.volume=1,this._audioDom.muted=!1,null===(e=this._fakeAudioDom)||void 0===e||e.play();var r=[],n=this._audioDom.play();null!=n&&n.then&&r.push(n);var i=fU.getAudioContextInstance();if("suspended"===i.state){var o=i.resume();null!=o&&o.then&&r.push(o)}(r.length>0?qf.all(r):qf.resolve(n)).then((function(){t._pasued=!1}))}},{key:"setPlaybackDevice",value:(t=Tm(Em().mark((function e(t){var r,n;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return oG.print("setPlaybackDevice","setPlaybackDevice: ".concat(t)),e.next=3,hU.enumerateAudioPlaybackDevices();case 3:if(r=e.sent,n=Fm(r).call(r,(function(e){return e.deviceId})),_k(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;oG.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(){oG.print("destroy","audio player: ".concat(this.userId)),this.stop(),wI(RI(i.prototype),"removeAllListeners",this).call(this),this._removeListeners(),this._audioDom&&(this._audioDom.srcObject=null,delete this._audioDom)}}]),i}(vM.exports.EventEmitter);function lG(e,t,r,n){var i=function(){var e=Tm(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:mE(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 uG&&o.videoTrack&&t.playVideo(o.videoTrack,o),t instanceof dG&&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))})),qf.all(o)}var hG=i,vG=lt("iterator"),pG=!hG((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[vG]||"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})),_G=Qt,fG=E,mG=2147483647,gG=/[^\0-\u007E]/,yG=/[.\u3002\uFF0E\uFF61]/g,SG="Overflow: input needs wider integers to process",bG=RangeError,EG=fG(yG.exec),kG=Math.floor,TG=String.fromCharCode,IG=fG("".charCodeAt),AG=fG([].join),RG=fG([].push),CG=fG("".replace),wG=fG("".split),xG=fG("".toLowerCase),OG=function(e){return e+22+75*(e<26)},PG=function(e,t,r){var n=0;for(e=r?kG(e/700):e>>1,e+=kG(e/t);e>455;)e=kG(e/35),n+=36;return kG(n+36*e/(e+38))},MG=function(e){var t=[];e=function(e){for(var t=[],r=0,n=e.length;r<n;){var i=IG(e,r++);if(i>=55296&&i<=56319&&r<n){var o=IG(e,r++);56320==(64512&o)?RG(t,((1023&i)<<10)+(1023&o)+65536):(RG(t,i),r--)}else RG(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&&RG(t,TG(n));var c=t.length,u=c;for(c&&RG(t,"-");u<i;){var d=mG;for(r=0;r<e.length;r++)(n=e[r])>=o&&n<d&&(d=n);var l=u+1;if(d-o>kG((mG-a)/l))throw bG(SG);for(a+=(d-o)*l,o=d,r=0;r<e.length;r++){if((n=e[r])<o&&++a>mG)throw bG(SG);if(n==o){for(var h=a,v=36;;){var p=v<=s?1:v>=s+26?26:v-s;if(h<p)break;var _=h-p,f=36-p;RG(t,TG(OG(p+_%f))),h=kG(_/f),v+=36}RG(t,TG(OG(h))),s=PG(a,l,u==c),a=0,u++}}a++,o++}return AG(t,"")},NG=Rr,DG=n,LG=O,UG=E,VG=C,FG=pG,BG=li,jG=Wg,GG=Di,HG=Nc,zG=Zi,XG=_v,KG=A,qG=We,YG=Wt,WG=_n,QG=tr,JG=$,ZG=gn,$G=Hn,eH=V,tH=mh,rH=dh,nH=Av,iH=cA,oH=lt("iterator"),aH="URLSearchParams",sH="URLSearchParamsIterator",cH=zG.set,uH=zG.getterFor(aH),dH=zG.getterFor(sH),lH=Object.getOwnPropertyDescriptor,hH=function(e){if(!VG)return DG[e];var t=lH(DG,e);return t&&t.value},vH=hH("fetch"),pH=hH("Request"),_H=hH("Headers"),fH=pH&&pH.prototype,mH=_H&&_H.prototype,gH=DG.RegExp,yH=DG.TypeError,SH=DG.decodeURIComponent,bH=DG.encodeURIComponent,EH=UG("".charAt),kH=UG([].join),TH=UG([].push),IH=UG("".replace),AH=UG([].shift),RH=UG([].splice),CH=UG("".split),wH=UG("".slice),xH=/\+/g,OH=Array(4),PH=function(e){return OH[e-1]||(OH[e-1]=gH("((?:%[\\da-f]{2}){"+e+"})","gi"))},MH=function(e){try{return SH(e)}catch(TK){return e}},NH=function(e){var t=IH(e,xH," "),r=4;try{return SH(t)}catch(TK){for(;r;)t=IH(t,PH(r--),MH);return t}},DH=/[!'()~]|%20/g,LH={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+"},UH=function(e){return LH[e]},VH=function(e){return IH(bH(e),DH,UH)},FH=HG((function(e,t){cH(this,{type:sH,iterator:tH(uH(e).entries),kind:t})}),"Iterator",(function(){var e=dH(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),BH=function(e){this.entries=[],this.url=null,void 0!==e&&(JG(e)?this.parseObject(e):this.parseQuery("string"==typeof e?"?"===EH(e,0)?wH(e,1):e:ZG(e)))};BH.prototype={type:aH,bindURL:function(e){this.url=e,this.update()},parseObject:function(e){var t,r,n,i,o,a,s,c=rH(e);if(c)for(r=(t=tH(e,c)).next;!(n=LG(r,t)).done;){if(o=(i=tH(QG(n.value))).next,(a=LG(o,i)).done||(s=LG(o,i)).done||!LG(o,i).done)throw yH("Expected sequence with length 2");TH(this.entries,{key:ZG(a.value),value:ZG(s.value)})}else for(var u in e)qG(e,u)&&TH(this.entries,{key:u,value:ZG(e[u])})},parseQuery:function(e){if(e)for(var t,r,n=CH(e,"&"),i=0;i<n.length;)(t=n[i++]).length&&(r=CH(t,"="),TH(this.entries,{key:NH(AH(r)),value:NH(kH(r,"="))}))},serialize:function(){for(var e,t=this.entries,r=[],n=0;n<t.length;)e=t[n++],TH(r,VH(e.key)+"="+VH(e.value));return kH(r,"&")},update:function(){this.entries.length=0,this.parseQuery(this.url.query)},updateURL:function(){this.url&&this.url.update()}};var jH=function(){XG(this,GH);var e=arguments.length>0?arguments[0]:void 0;cH(this,new BH(e))},GH=jH.prototype;if(jG(GH,{append:function(e,t){nH(arguments.length,2);var r=uH(this);TH(r.entries,{key:ZG(e),value:ZG(t)}),r.updateURL()},delete:function(e){nH(arguments.length,1);for(var t=uH(this),r=t.entries,n=ZG(e),i=0;i<r.length;)r[i].key===n?RH(r,i,1):i++;t.updateURL()},get:function(e){nH(arguments.length,1);for(var t=uH(this).entries,r=ZG(e),n=0;n<t.length;n++)if(t[n].key===r)return t[n].value;return null},getAll:function(e){nH(arguments.length,1);for(var t=uH(this).entries,r=ZG(e),n=[],i=0;i<t.length;i++)t[i].key===r&&TH(n,t[i].value);return n},has:function(e){nH(arguments.length,1);for(var t=uH(this).entries,r=ZG(e),n=0;n<t.length;)if(t[n++].key===r)return!0;return!1},set:function(e,t){nH(arguments.length,1);for(var r,n=uH(this),i=n.entries,o=!1,a=ZG(e),s=ZG(t),c=0;c<i.length;c++)(r=i[c]).key===a&&(o?RH(i,c--,1):(o=!0,r.value=s));o||TH(i,{key:a,value:s}),n.updateURL()},sort:function(){var e=uH(this);iH(e.entries,(function(e,t){return e.key>t.key?1:-1})),e.updateURL()},forEach:function(e){for(var t,r=uH(this).entries,n=YG(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 FH(this,"keys")},values:function(){return new FH(this,"values")},entries:function(){return new FH(this,"entries")}},{enumerable:!0}),BG(GH,oH,GH.entries,{name:"entries"}),BG(GH,"toString",(function(){return uH(this).serialize()}),{enumerable:!0}),GG(jH,aH),NG({global:!0,constructor:!0,forced:!FG},{URLSearchParams:jH}),!FG&&KG(_H)){var HH=UG(mH.has),zH=UG(mH.set),XH=function(e){if(JG(e)){var t,r=e.body;if(WG(r)===aH)return t=e.headers?new _H(e.headers):new _H,HH(t,"content-type")||zH(t,"content-type","application/x-www-form-urlencoded;charset=UTF-8"),$G(e,{body:eH(0,ZG(r)),headers:eH(0,t)})}return e};if(KG(vH)&&NG({global:!0,enumerable:!0,dontCallGetSet:!0,forced:!0},{fetch:function(e){return vH(e,arguments.length>1?XH(arguments[1]):{})}}),KG(pH)){var KH=function(e){return XG(this,fH),new pH(e,arguments.length>1?XH(arguments[1]):{})};fH.constructor=KH,KH.prototype=fH,NG({global:!0,constructor:!0,dontCallGetSet:!0,forced:!0},{Request:KH})}}var qH,YH=Rr,WH=C,QH=pG,JH=n,ZH=Wt,$H=E,ez=li,tz=function(e,t,r){return _G.f(e,t,r)},rz=_v,nz=We,iz=Tb,oz=zk,az=ni,sz=Ud.codeAt,cz=function(e){var t,r,n=[],i=wG(CG(xG(e),yG,"."),".");for(t=0;t<i.length;t++)r=i[t],RG(n,EG(gG,r)?"xn--"+MG(r):r);return AG(n,".")},uz=gn,dz=Di,lz=Av,hz={URLSearchParams:jH,getState:uH},vz=Zi,pz=vz.set,_z=vz.getterFor("URL"),fz=hz.URLSearchParams,mz=hz.getState,gz=JH.URL,yz=JH.TypeError,Sz=JH.parseInt,bz=Math.floor,Ez=Math.pow,kz=$H("".charAt),Tz=$H(/./.exec),Iz=$H([].join),Az=$H(1..toString),Rz=$H([].pop),Cz=$H([].push),wz=$H("".replace),xz=$H([].shift),Oz=$H("".split),Pz=$H("".slice),Mz=$H("".toLowerCase),Nz=$H([].unshift),Dz="Invalid scheme",Lz="Invalid host",Uz="Invalid port",Vz=/[a-z]/i,Fz=/[\d+-.a-z]/i,Bz=/\d/,jz=/^0x/i,Gz=/^[0-7]+$/,Hz=/^\d+$/,zz=/^[\da-f]+$/i,Xz=/[\0\t\n\r #%/:<>?@[\\\]^|]/,Kz=/[\0\t\n\r #/:<>?@[\\\]^|]/,qz=/^[\u0000-\u0020]+|[\u0000-\u0020]+$/g,Yz=/[\t\n\r]/g,Wz=function(e){var t,r,n,i;if("number"==typeof e){for(t=[],r=0;r<4;r++)Nz(t,e%256),e=bz(e/256);return Iz(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+=Az(e[r],16),r<7&&(t+=":")));return"["+t+"]"}return e},Qz={},Jz=iz({},Qz,{" ":1,'"':1,"<":1,">":1,"`":1}),Zz=iz({},Jz,{"#":1,"?":1,"{":1,"}":1}),$z=iz({},Zz,{"/":1,":":1,";":1,"=":1,"@":1,"[":1,"\\":1,"]":1,"^":1,"|":1}),eX=function(e,t){var r=sz(e,0);return r>32&&r<127&&!nz(t,e)?e:encodeURIComponent(e)},tX={ftp:21,file:null,http:80,https:443,ws:80,wss:443},rX=function(e,t){var r;return 2==e.length&&Tz(Vz,kz(e,0))&&(":"==(r=kz(e,1))||!t&&"|"==r)},nX=function(e){var t;return e.length>1&&rX(Pz(e,0,2))&&(2==e.length||"/"===(t=kz(e,2))||"\\"===t||"?"===t||"#"===t)},iX=function(e){return"."===e||"%2e"===Mz(e)},oX={},aX={},sX={},cX={},uX={},dX={},lX={},hX={},vX={},pX={},_X={},fX={},mX={},gX={},yX={},SX={},bX={},EX={},kX={},TX={},IX={},AX=function(e,t,r){var n,i,o,a=uz(e);if(t){if(i=this.parse(a))throw yz(i);this.searchParams=null}else{if(void 0!==r&&(n=new AX(r,!0)),i=this.parse(a,null,n))throw yz(i);(o=mz(new fz)).bindURL(this),this.searchParams=o}};AX.prototype={type:"URL",parse:function(e,t,r){var n,i,o,a,s,c=this,u=t||oX,d=0,l="",h=!1,v=!1,p=!1;for(e=uz(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=wz(e,qz,"")),e=wz(e,Yz,""),n=oz(e);d<=n.length;){switch(i=n[d],u){case oX:if(!i||!Tz(Vz,i)){if(t)return Dz;u=sX;continue}l+=Mz(i),u=aX;break;case aX:if(i&&(Tz(Fz,i)||"+"==i||"-"==i||"."==i))l+=Mz(i);else{if(":"!=i){if(t)return Dz;l="",u=sX,d=0;continue}if(t&&(c.isSpecial()!=nz(tX,l)||"file"==l&&(c.includesCredentials()||null!==c.port)||"file"==c.scheme&&!c.host))return;if(c.scheme=l,t)return void(c.isSpecial()&&tX[c.scheme]==c.port&&(c.port=null));l="","file"==c.scheme?u=gX:c.isSpecial()&&r&&r.scheme==c.scheme?u=cX:c.isSpecial()?u=hX:"/"==n[d+1]?(u=uX,d++):(c.cannotBeABaseURL=!0,Cz(c.path,""),u=kX)}break;case sX:if(!r||r.cannotBeABaseURL&&"#"!=i)return Dz;if(r.cannotBeABaseURL&&"#"==i){c.scheme=r.scheme,c.path=az(r.path),c.query=r.query,c.fragment="",c.cannotBeABaseURL=!0,u=IX;break}u="file"==r.scheme?gX:dX;continue;case cX:if("/"!=i||"/"!=n[d+1]){u=dX;continue}u=vX,d++;break;case uX:if("/"==i){u=pX;break}u=EX;continue;case dX:if(c.scheme=r.scheme,i==qH)c.username=r.username,c.password=r.password,c.host=r.host,c.port=r.port,c.path=az(r.path),c.query=r.query;else if("/"==i||"\\"==i&&c.isSpecial())u=lX;else if("?"==i)c.username=r.username,c.password=r.password,c.host=r.host,c.port=r.port,c.path=az(r.path),c.query="",u=TX;else{if("#"!=i){c.username=r.username,c.password=r.password,c.host=r.host,c.port=r.port,c.path=az(r.path),c.path.length--,u=EX;continue}c.username=r.username,c.password=r.password,c.host=r.host,c.port=r.port,c.path=az(r.path),c.query=r.query,c.fragment="",u=IX}break;case lX:if(!c.isSpecial()||"/"!=i&&"\\"!=i){if("/"!=i){c.username=r.username,c.password=r.password,c.host=r.host,c.port=r.port,u=EX;continue}u=pX}else u=vX;break;case hX:if(u=vX,"/"!=i||"/"!=kz(l,d+1))continue;d++;break;case vX:if("/"!=i&&"\\"!=i){u=pX;continue}break;case pX:if("@"==i){h&&(l="%40"+l),h=!0,o=oz(l);for(var _=0;_<o.length;_++){var f=o[_];if(":"!=f||p){var m=eX(f,$z);p?c.password+=m:c.username+=m}else p=!0}l=""}else if(i==qH||"/"==i||"?"==i||"#"==i||"\\"==i&&c.isSpecial()){if(h&&""==l)return"Invalid authority";d-=oz(l).length+1,l="",u=_X}else l+=i;break;case _X:case fX:if(t&&"file"==c.scheme){u=SX;continue}if(":"!=i||v){if(i==qH||"/"==i||"?"==i||"#"==i||"\\"==i&&c.isSpecial()){if(c.isSpecial()&&""==l)return Lz;if(t&&""==l&&(c.includesCredentials()||null!==c.port))return;if(a=c.parseHost(l))return a;if(l="",u=bX,t)return;continue}"["==i?v=!0:"]"==i&&(v=!1),l+=i}else{if(""==l)return Lz;if(a=c.parseHost(l))return a;if(l="",u=mX,t==fX)return}break;case mX:if(!Tz(Bz,i)){if(i==qH||"/"==i||"?"==i||"#"==i||"\\"==i&&c.isSpecial()||t){if(""!=l){var g=Sz(l,10);if(g>65535)return Uz;c.port=c.isSpecial()&&g===tX[c.scheme]?null:g,l=""}if(t)return;u=bX;continue}return Uz}l+=i;break;case gX:if(c.scheme="file","/"==i||"\\"==i)u=yX;else{if(!r||"file"!=r.scheme){u=EX;continue}if(i==qH)c.host=r.host,c.path=az(r.path),c.query=r.query;else if("?"==i)c.host=r.host,c.path=az(r.path),c.query="",u=TX;else{if("#"!=i){nX(Iz(az(n,d),""))||(c.host=r.host,c.path=az(r.path),c.shortenPath()),u=EX;continue}c.host=r.host,c.path=az(r.path),c.query=r.query,c.fragment="",u=IX}}break;case yX:if("/"==i||"\\"==i){u=SX;break}r&&"file"==r.scheme&&!nX(Iz(az(n,d),""))&&(rX(r.path[0],!0)?Cz(c.path,r.path[0]):c.host=r.host),u=EX;continue;case SX:if(i==qH||"/"==i||"\\"==i||"?"==i||"#"==i){if(!t&&rX(l))u=EX;else if(""==l){if(c.host="",t)return;u=bX}else{if(a=c.parseHost(l))return a;if("localhost"==c.host&&(c.host=""),t)return;l="",u=bX}continue}l+=i;break;case bX:if(c.isSpecial()){if(u=EX,"/"!=i&&"\\"!=i)continue}else if(t||"?"!=i)if(t||"#"!=i){if(i!=qH&&(u=EX,"/"!=i))continue}else c.fragment="",u=IX;else c.query="",u=TX;break;case EX:if(i==qH||"/"==i||"\\"==i&&c.isSpecial()||!t&&("?"==i||"#"==i)){if(".."===(s=Mz(s=l))||"%2e."===s||".%2e"===s||"%2e%2e"===s?(c.shortenPath(),"/"==i||"\\"==i&&c.isSpecial()||Cz(c.path,"")):iX(l)?"/"==i||"\\"==i&&c.isSpecial()||Cz(c.path,""):("file"==c.scheme&&!c.path.length&&rX(l)&&(c.host&&(c.host=""),l=kz(l,0)+":"),Cz(c.path,l)),l="","file"==c.scheme&&(i==qH||"?"==i||"#"==i))for(;c.path.length>1&&""===c.path[0];)xz(c.path);"?"==i?(c.query="",u=TX):"#"==i&&(c.fragment="",u=IX)}else l+=eX(i,Zz);break;case kX:"?"==i?(c.query="",u=TX):"#"==i?(c.fragment="",u=IX):i!=qH&&(c.path[0]+=eX(i,Qz));break;case TX:t||"#"!=i?i!=qH&&("'"==i&&c.isSpecial()?c.query+="%27":c.query+="#"==i?"%23":eX(i,Qz)):(c.fragment="",u=IX);break;case IX:i!=qH&&(c.fragment+=eX(i,Jz))}d++}},parseHost:function(e){var t,r,n;if("["==kz(e,0)){if("]"!=kz(e,e.length-1))return Lz;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 kz(e,l)};if(":"==h()){if(":"!=kz(e,1))return;l+=2,d=++u}for(;h();){if(8==u)return;if(":"!=h()){for(t=r=0;r<4&&Tz(zz,h());)t=16*t+Sz(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(!Tz(Bz,h()))return;for(;Tz(Bz,h());){if(o=Sz(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}(Pz(e,1,-1)),!t)return Lz;this.host=t}else if(this.isSpecial()){if(e=cz(e),Tz(Xz,e))return Lz;if(t=function(e){var t,r,n,i,o,a,s,c=Oz(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"==kz(i,0)&&(o=Tz(jz,i)?16:8,i=Pz(i,8==o?1:2)),""===i)a=0;else{if(!Tz(10==o?Hz:8==o?Gz:zz,i))return e;a=Sz(i,o)}Cz(r,a)}for(n=0;n<t;n++)if(a=r[n],n==t-1){if(a>=Ez(256,5-t))return null}else if(a>255)return null;for(s=Rz(r),n=0;n<r.length;n++)s+=r[n]*Ez(256,3-n);return s}(e),null===t)return Lz;this.host=t}else{if(Tz(Kz,e))return Lz;for(t="",r=oz(e),n=0;n<r.length;n++)t+=eX(r[n],Qz);this.host=t}},cannotHaveUsernamePasswordPort:function(){return!this.host||this.cannotBeABaseURL||"file"==this.scheme},includesCredentials:function(){return""!=this.username||""!=this.password},isSpecial:function(){return nz(tX,this.scheme)},shortenPath:function(){var e=this.path,t=e.length;!t||"file"==this.scheme&&1==t&&rX(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+=Wz(i),null!==o&&(u+=":"+o)):"file"==t&&(u+="//"),u+=e.cannotBeABaseURL?a[0]:a.length?"/"+Iz(a,"/"):"",null!==s&&(u+="?"+s),null!==c&&(u+="#"+c),u},setHref:function(e){var t=this.parse(e);if(t)throw yz(t);this.searchParams.update()},getOrigin:function(){var e=this.scheme,t=this.port;if("blob"==e)try{return new RX(e.path[0]).origin}catch(TK){return"null"}return"file"!=e&&this.isSpecial()?e+"://"+Wz(this.host)+(null!==t?":"+t:""):"null"},getProtocol:function(){return this.scheme+":"},setProtocol:function(e){this.parse(uz(e)+":",oX)},getUsername:function(){return this.username},setUsername:function(e){var t=oz(uz(e));if(!this.cannotHaveUsernamePasswordPort()){this.username="";for(var r=0;r<t.length;r++)this.username+=eX(t[r],$z)}},getPassword:function(){return this.password},setPassword:function(e){var t=oz(uz(e));if(!this.cannotHaveUsernamePasswordPort()){this.password="";for(var r=0;r<t.length;r++)this.password+=eX(t[r],$z)}},getHost:function(){var e=this.host,t=this.port;return null===e?"":null===t?Wz(e):Wz(e)+":"+t},setHost:function(e){this.cannotBeABaseURL||this.parse(e,_X)},getHostname:function(){var e=this.host;return null===e?"":Wz(e)},setHostname:function(e){this.cannotBeABaseURL||this.parse(e,fX)},getPort:function(){var e=this.port;return null===e?"":uz(e)},setPort:function(e){this.cannotHaveUsernamePasswordPort()||(""==(e=uz(e))?this.port=null:this.parse(e,mX))},getPathname:function(){var e=this.path;return this.cannotBeABaseURL?e[0]:e.length?"/"+Iz(e,"/"):""},setPathname:function(e){this.cannotBeABaseURL||(this.path=[],this.parse(e,bX))},getSearch:function(){var e=this.query;return e?"?"+e:""},setSearch:function(e){""==(e=uz(e))?this.query=null:("?"==kz(e,0)&&(e=Pz(e,1)),this.query="",this.parse(e,TX)),this.searchParams.update()},getSearchParams:function(){return this.searchParams.facade},getHash:function(){var e=this.fragment;return e?"#"+e:""},setHash:function(e){""!=(e=uz(e))?("#"==kz(e,0)&&(e=Pz(e,1)),this.fragment="",this.parse(e,IX)):this.fragment=null},update:function(){this.query=this.searchParams.serialize()||null}};var RX=function(e){var t=rz(this,CX),r=lz(arguments.length,1)>1?arguments[1]:void 0,n=pz(t,new AX(e,!1,r));WH||(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())},CX=RX.prototype,wX=function(e,t){return{get:function(){return _z(this)[e]()},set:t&&function(e){return _z(this)[t](e)},configurable:!0,enumerable:!0}};if(WH&&(tz(CX,"href",wX("serialize","setHref")),tz(CX,"origin",wX("getOrigin")),tz(CX,"protocol",wX("getProtocol","setProtocol")),tz(CX,"username",wX("getUsername","setUsername")),tz(CX,"password",wX("getPassword","setPassword")),tz(CX,"host",wX("getHost","setHost")),tz(CX,"hostname",wX("getHostname","setHostname")),tz(CX,"port",wX("getPort","setPort")),tz(CX,"pathname",wX("getPathname","setPathname")),tz(CX,"search",wX("getSearch","setSearch")),tz(CX,"searchParams",wX("getSearchParams")),tz(CX,"hash",wX("getHash","setHash"))),ez(CX,"toJSON",(function(){return _z(this).serialize()}),{enumerable:!0}),ez(CX,"toString",(function(){return _z(this).serialize()}),{enumerable:!0}),gz){var xX=gz.createObjectURL,OX=gz.revokeObjectURL;xX&&ez(RX,"createObjectURL",ZH(xX,gz)),OX&&ez(RX,"revokeObjectURL",ZH(OX,gz))}dz(RX,"URL"),YH({global:!0,constructor:!0,forced:!QH,sham:!WH},{URL:RX});var PX=ee.URL,MX=function(){var e=Tm(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(PX.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)}}(),NX=ad,DX=tc,LX=function(e,t,r,n){for(var i,o=n>1?void 0:n?DX(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&&NX(t,r,o),o},UX=function(){function e(t,r){Ll(this,e),Qd(this,"_sharedAudioContext",new AudioContext),Qd(this,"_audioDestination",this._sharedAudioContext.createMediaStreamDestination()),Qd(this,"_localGainNode",this._sharedAudioContext.createGain()),Qd(this,"_bufferGainNode",this._sharedAudioContext.createGain()),Qd(this,"_audioBufferSource",void 0),Qd(this,"_localSource",void 0),Qd(this,"_context",void 0),Qd(this,"_failedAudioList",[]),Qd(this,"_startingIds",new JS),Qd(this,"_revokeURLs",new RD),Qd(this,"mixingMap",new JS),Qd(this,"resourcesCache",new JS),Qd(this,"volumeConfig",new JS),Qd(this,"cachedBuffer",[]),Qd(this,"id","AudioMixingManager"),this.engineId=r,this._context=t,this._localGainNode.gain.value=1}var t,r,n;return Dl(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=Tm(Em().mark((function e(t,r,n){var i,o,a,s,c,u,d,l,h,v,p,_,f,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),i=n.playCount,YP(o=n.type,"mixingType",lj(xl)),a=this._context.getLocalAudioTrack()){e.next=9;break}return e.abrupt("return");case 9: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:Ol.AUDIO_MIXING_STATE_STOPPED,error:lR.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=18;break}u=d.getAudioNode(),e.next=31;break;case 18:return e.next=20,fetch(r,{mode:"cors",credentials:"include"}).then((function(e){if(e.ok)return e.arrayBuffer();throw m._context.emitMessage({mixId:t,state:Ol.AUDIO_MIXING_STATE_FAILED,error:lR.AUDIO_MIXING_ERROR_START_FAILED}),new hR(dR.LOAD_RESOURCES_FAILED,e.statusText)}));case 20:return l=e.sent,Wb(r).call(r,"mp3")?h={type:"audio/mpeg"}:Wb(r).call(r,"aac")&&(h={type:"audio/aac"}),e.next=24,MX(l,h);case 24:if(e.sent){e.next=28;break}throw this._context.emitMessage({mixId:t,state:Ol.AUDIO_MIXING_STATE_FAILED,error:lR.AUDIO_MIXING_ERROR_START_FAILED}),new hR(dR.LOAD_RESOURCES_FAILED,"invalid audio resource");case 28:(u=new Audio).crossOrigin="anonymous",u.src=PX.createObjectURL(new Blob([l],h));case 31:return i<=0?u.loop=!0:i>0&&(v=i,u.onended=function(){--v>0?u.play():(m.mixingMap.delete(t),m._context.emitMessage({mixId:t,state:Ol.AUDIO_MIXING_STATE_FINISHED,error:lR.AUDIO_MIXING_ERROR_OK}))}),e.prev=32,e.next=35,u.play();case 35:e.next=42;break;case 37:e.prev=37,e.t0=e.catch(32),console.error(e.t0),this._failedAudioList.push(u),this._context.onAutoPlayFailed({userId:this.id,kind:"audio",streamIndex:cl.STREAM_INDEX_MAIN,mediaType:ul.AUDIO});case 42:if(this._startingIds.delete(t),p=this._sharedAudioContext.createMediaElementSource(u),_=this._sharedAudioContext.createGain(),f=this.volumeConfig.get(t),_.gain.value=f?f/100:1,p.connect(_).connect(this._audioDestination),this.mixingMap.set(t,{audioSource:p,audioNode:u,gainNode:_,type:"file"}),o===xl.PUBLISH)try{_.disconnect(this._sharedAudioContext.destination)}catch(g){}else _.connect(this._sharedAudioContext.destination);this._context.updateLocalAudioTrack(this._audioDestination.stream.getAudioTracks()[0],n.type),this._context.emitMessage({mixId:t,state:Ol.AUDIO_MIXING_STATE_PLAYING,error:lR.AUDIO_MIXING_ERROR_OK});case 52:case"end":return e.stop()}}),e,this,[[32,37]])}))),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:Ol.AUDIO_MIXING_STATE_STOPPED,error:lR.AUDIO_MIXING_ERROR_OK}))}},{key:"pauseAudioMixing",value:function(e){var t=this.mixingMap.get(e);t&&(this._context.emitMessage({mixId:e,state:Ol.AUDIO_MIXING_STATE_PAUSED,error:lR.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:Ol.AUDIO_MIXING_STATE_PLAYING,error:lR.AUDIO_MIXING_ERROR_OK}),t.audioNode.play())}},{key:"preloadAudioMixing",value:(r=Tm(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 hR(dR.LOAD_RESOURCES_FAILED,e.statusText)})).catch((function(e){if(o._context.emitMessage({mixId:t,state:Ol.AUDIO_MIXING_STATE_FAILED,error:lR.AUDIO_MIXING_ERROR_PRELOAD_FAILED}),e instanceof hR)throw e;throw new hR(dR.LOAD_RESOURCES_FAILED,"Load resources failed",e)}));case 3:return n=e.sent,Wb(r).call(r,"mp3")?i={type:"audio/mpeg"}:Wb(r).call(r,"aac")&&(i={type:"audio/aac"}),e.next=7,MX(n,i);case 7:if(e.sent){e.next=11;break}throw this._context.emitMessage({mixId:t,state:Ol.AUDIO_MIXING_STATE_FAILED,error:lR.AUDIO_MIXING_ERROR_PRELOAD_FAILED}),new hR(dR.LOAD_RESOURCES_FAILED,"Load resources failed");case 11:return this._context.emitMessage({mixId:t,state:Ol.AUDIO_MIXING_STATE_PRELOADED,error:lR.AUDIO_MIXING_ERROR_OK}),this.resourcesCache.set(t,{getAudioNode:function(){var e=PX.createObjectURL(new Blob([n],i));return o._revokeURLs.add(e),new Audio(e)},filePath:r,duration:0}),e.next=15,new qf((function(e){var r=PX.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)),PX.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){YP(e,"type",lj(xl));var t=this._context.getLocalAudioTrack();if(t){var r=t.getTrack("preprocessing");if(r&&this.mixMediaStream(new MediaStream([r])),e===xl.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:Ol.AUDIO_MIXING_STATE_PCM_ENABLED,error:lR.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:Ol.AUDIO_MIXING_STATE_PCM_DISABLED,error:lR.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=Tm(Em().mark((function e(){var t,r,n,i;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:t=[],r=JT(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:cl.STREAM_INDEX_MAIN,mediaType:ul.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 JS,this._revokeURLs.forEach((function(e){PX.revokeObjectURL(e)}))}}]),e}();LX([TO("id","filePath","options")],UX.prototype,"startAudioMixing",1),LX([TO("id")],UX.prototype,"stopAudioMixing",1),LX([TO("id")],UX.prototype,"pauseAudioMixing",1),LX([TO("id")],UX.prototype,"resumeAudioMixing",1),LX([TO("id")],UX.prototype,"preloadAudioMixing",1),LX([TO("id")],UX.prototype,"unloadAudioMixing",1),LX([TO("id")],UX.prototype,"getAudioMixingVolume",1),LX([TO("id","volume")],UX.prototype,"setAudioMixingVolume",1),LX([TO("id")],UX.prototype,"getAudioMixingDuration",1),LX([TO("id")],UX.prototype,"getAudioMixingCurrentPosition",1),LX([TO("id","position")],UX.prototype,"setAudioMixingPosition",1),LX([TO("type")],UX.prototype,"enableAudioMixingBuffer",1),LX([TO()],UX.prototype,"disableAudioMixingBuffer",1),LX([TO("buffer")],UX.prototype,"pushAudioMixingBuffer",1);var VX=function(e){return e.NORMAL_USER="normalUser",e.SILENT_USER="silentUser",e}(VX||{}),FX=new cO("RTMClient",1),BX=function(e){OI(u,e);var t,r,n,i,o,a,s,c=YI(u);function u(e,t){var r;return Ll(this,u),Qd($T(r=c.call(this)),"_dataChannelSignal",null),Qd($T(r),"_handler",null),Qd($T(r),"_dataChannelSignalState",Nj.DISCONNECTED),Qd($T(r),"_loginSessionId",null),Qd($T(r),"_userId",null),Qd($T(r),"_token",null),Qd($T(r),"_isReconnecting",!1),Qd($T(r),"_reconnectTimer",null),Qd($T(r),"_loginResolveCallback",null),Qd($T(r),"_loginRejectCallback",null),Qd($T(r),"_iceConfigNode",null),Qd($T(r),"_wait_login_token",!1),Qd($T(r),"_serverParamsCache",void 0),r.id=e,r._appId=t,r}return Dl(u,[{key:"login",value:function(e,t){var r=this;return new qf((function(n,i){var o;if(FX.print("login","invoke login, token: %o, userId: %o",e,t),r._loginSessionId)throw new hR(dR.ALREADY_LOGIN,"Already logined");if(r._loginResolveCallback)throw new hR(dR.LOGIN_FAILED,"Is logging in, please try again later.");r._userId=t,r._token=e,null===(o=kO(r.id))||void 0===o||o.set({rtm_user_id:t}),r._loginResolveCallback=n,r._loginRejectCallback=i,r._dataChannelSignal?r._login():(FX.print("login","init dataChannelSingling"),r._dataChannelSignalState=Nj.CONNECTING,r._createDataChannelSignaling(t).then((function(e){r._dataChannelSignal=e,r._login()})).catch((function(){r._onDisconnect()})))}))}},{key:"logout",value:(s=Tm(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 hR(dR.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:GM.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=Tm(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 qf((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=Tm(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 hR(dR.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:GM.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=Tm(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 hR(dR.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=Tm(Em().mark((function e(t,r){return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(e.prev=0,qP(t,"signature"),qP(r,"url"),this._loginSessionId&&this._userId){e.next=5;break}throw new hR(dR.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:GM.C2RTM}).catch((function(e){throw new hR(dR.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=Tm(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 hR(dR.NOT_LOGIN,"login first");case 2:return this._checkDataChannelSignal(),e.abrupt("return",this._dataChannelSignal.sendP2PMessage({from:this._userId,app:this._appId,to:"",room:"",type:LM.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(RI(u.prototype),"removeAllListeners",this).call(this),delete this._serverParamsCache}},{key:"_login",value:function(){var e=this;if(this._userId){var t=OO();this._checkDataChannelSignal(),this._dataChannelSignal.sendSignaling("login",{Token:NO.token2auth(this._appId,null,this._userId,this._token),timestamp:Date.now(),loginSessionId:t,params:{deviceType:"web",userAgent:window.navigator.userAgent,sdkVersion:FP.VERSION,deviceId:NP.getDeviceId(),appId:this._appId,userId:this._userId}},{functionType:GM.C2RTM}).then((function(){"function"==typeof e._loginResolveCallback&&e._loginResolveCallback(),e._loginSessionId=t,vO.setRtsSessionId(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=dR.INVALID_PARAMS,n="Invalid userId"):(r=dR.INVALID_TOKEN,n="Invalid token",e._wait_login_token=!0,e._loginRejectCallback||e.emit("onRTMTokenError")):(r=dR.LOGIN_FAILED,n="login failed"),"function"==typeof e._loginRejectCallback&&e._loginRejectCallback(new hR(r,a||n))})).finally((function(){e._loginResolveCallback=null,e._loginRejectCallback=null}))}}},{key:"_createDataChannelSignaling",value:(t=Tm(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 KM(this.id),i=this._iceConfigNode){e.next=16;break}return e.prev=3,e.next=6,null==n?void 0:n.getAccessNode(this._appId,"");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),AO(this.id,"rtm.login.getNodeFailed",null===e.t0||void 0===e.t0?void 0:e.t0.message),new hR(dR.ICE_SERVER_WRONG,"get ICE config failed");case 16:return AO(this.id,"rtm.login.getNodeSuccess",i),FX.print("_createDataChannelSignaling()","get node success",i),this._handler=gj({id:this.id,avSync:!0}),null===(r=this._handler)||void 0===r||r.once("disconnect",(function(){FX.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,FX.print("_createDataChannelSignaling()","establish peerConnection success"),this._dataChannelSignalState=Nj.CONNECTED,e.next=33;break;case 28:throw e.prev=28,e.t1=e.catch(20),this._iceConfigNode=null,this._dataChannelSignalState=Nj.DISCONNECTED,new hR(dR.ESTABLISH_DATACHANNEL_FAILED,"establish dataChannel failed",e.t1);case 33:return c=new HM(this.id,a),FX.print("_createDataChannelSignaling()","send ping"),c.sendPingSignaling(),c.once("close",(function(){FX.print("_createDataChannelSignaling()","recv DataChannelSignaling event: close"),u._onDisconnect()})),c.on(xM.USER_MESSAGE_RECEIVED_OUTSIDE_ROOM,(function(e){u.emit("onUserMessageReceivedOutsideRoom",{userId:e.from,message:e.msg})})),c.on(xM.USER_BINARY_MESSAGE_RECEIVED_OUTSIDE_ROOM,(function(e){u.emit("onUserBinaryMessageReceivedOutsideRoom",{userId:e.from,message:e.msg})})),c.on(xM.USER_DISCONNECTION,(function(){u.emit("onUserDisconnection"),u._clearState()})),c.on(xM.NODE_CHANGE,(function(e){AO(u.id,"rtm.nodeChange",Mm(e)),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!==Nj.CONNECTED)throw new hR(dR.NOT_CONNECTED_YET,"datachannel not connect")}},{key:"_onDisconnect",value:function(){this._dataChannelSignalState=Nj.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&&(FX.print("_reconnect()","start reconnect..."),this._isReconnecting=!0,this._createDataChannelSignaling(this._userId).then((function(t){FX.print("_reconnect()","reconnect success!"),e._dataChannelSignal=t,e._login(),e._reconnectTimer=null})).catch((function(t){FX.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,vO.setRtsSessionId(this.id,""),null!==this._reconnectTimer&&(self.clearTimeout(this._reconnectTimer),this._reconnectTimer=null)}}]),u}(vM.exports.EventEmitter),jX=function(e){OI(o,e);var t,r,n,i=YI(o);function o(e,t,r){var n,a=r.businessId;return Ll(this,o),Qd($T(n=i.call(this)),"_mediaServerClient",void 0),Qd($T(n),"_appId",void 0),Qd($T(n),"_reconnectTimer",void 0),Qd($T(n),"remoteStreams",void 0),Qd($T(n),"_businessId",void 0),n.id=e,n._appId=t,n.remoteStreams=new JS,n._businessId=a,n}return Dl(o,[{key:"connect",value:(n=Tm(Em().mark((function e(){return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this._mediaServerClient=new Lj({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=Tm(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 hR(dR.REPEAT_PLAY,"repeat play public media stream");case 2:return(r=new TV(this.id,t,t,!1,!0,{audiostream:!0,localaudio:!0,videostream:!0,localvideo:!0,extaudio:!1,extvideo:!1,videoDescriptions:[]})).on("onSEIMessage",(function(e){if(e instanceof Uint8Array)for(var t=ZO(e),i=0;i<t.seiCount;i++)n.emit(Ej.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 JS,this._mediaServerClient&&this._mediaServerClient.destroy()}},{key:"_handleReconnected",value:(t=Tm(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=JT(this.remoteStreams);try{for(n=function(){var e=ZT(r.value,1)[0];i.remoteStreams.delete(e),i.startPlayPublicStream(e).then((function(){var t=i.remoteStreams.get(e);i.safeEmit(Ej.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(PM.ABNORMAL_DISCONNECTION,this._reconnect.bind(this)),null===(t=this._mediaServerClient)||void 0===t||t.on("onRemoteStreamStats",(function(e){r.emit("onRemoteStreamStats",e)}))}}]),o}(fM),GX=new cO("AudioDeviceManager",1),HX=function(e){OI(c,e);var t,r,n,i,o,a,s=YI(c);function c(e){var t;return Ll(this,c),Qd($T(t=s.call(this)),"_audioLevelFetcher",void 0),Qd($T(t),"_playbackDeviceTestTimer",void 0),Qd($T(t),"_audioElement",void 0),Qd($T(t),"_audioTrack",void 0),Qd($T(t),"_mediaRecorder",void 0),Qd($T(t),"_recoderTimer",void 0),Qd($T(t),"_isAudioPlaybackDeviceTesting",!1),Qd($T(t),"_isAudioDeviceRecordTesting",!1),Qd($T(t),"_audioCaptureAndRecoderResolve",void 0),Qd($T(t),"_onAutoplayFailed",void 0),Qd($T(t),"_audioPlaybackDeviceId",void 0),t._extensionManager=e,t}return Dl(c,[{key:"audioTrack",get:function(){return this._audioTrack}},{key:"startAudioPlaybackDeviceTest",value:(a=Tm(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 hR(dR.REPEAT_DEVICE_TEST,"device test cannot be called repeatedly at the same time.");case 2:return this._isAudioPlaybackDeviceTesting=!0,GX.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),GX.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&&(GX.print("stopAudioPlaybackDeviceTest()","Invoke"),this._isAudioPlaybackDeviceTesting=!1,this._stopEmitAudioPlaybackDeviceTestVolume(),this._destroyAudioElement())}},{key:"startAudioDeviceRecordTest",value:(o=Tm(Em().mark((function e(t,r,n){var i=this;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(window.MediaRecorder){e.next=2;break}throw new hR(dR.NOT_SUPPORTED,"Your browser does not support MediaRecorder.");case 2:if(!this._isAudioDeviceRecordTesting){e.next=4;break}throw new hR(dR.REPEAT_DEVICE_TEST,"device test cannot be called repeatedly at the same time.");case 4:return this._isAudioDeviceRecordTesting=!0,GX.print("startAudioDeviceRecordTest()","Invoke"),this._recoderTimer=window.setTimeout((function(){GX.print("startAudioDeviceRecordTest()","".concat(3e4,'ms automatic call method "stopAudioDeviceRecordAndPlayTest"')),i._stopAudioCaptureAndRecoder()}),3e4),e.prev=7,this._onAutoplayFailed=r,e.next=11,this._startAudioCaptureAndRecoder(t,null!=n?n:100);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,r){return o.apply(this,arguments)})},{key:"stopAudioDeviceRecordAndPlayTest",value:function(){GX.print("stopAudioDeviceRecordAndPlayTest()","Invoke"),void 0!==this._recoderTimer&&(clearTimeout(this._recoderTimer),delete this._recoderTimer),this._stopAudioCaptureAndRecoder()}},{key:"stopAudioDevicePlayTest",value:function(){this._isAudioDeviceRecordTesting&&(GX.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=Tm(Em().mark((function e(t){var r;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(GX.print("setSinkId()","Invoke"),void 0!==HTMLAudioElement.prototype.setSinkId){e.next=3;break}throw new hR(dR.NOT_SUPPORTED,"setSinkId not supported by current browser");case 3:return e.next=5,hU.getDeviceById(t);case 5:if(r=e.sent){e.next=8;break}throw new hR(dR.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(){GX.print("destroy()","Invoke"),wI(RI(c.prototype),"removeAllListeners",this).call(this),this.stopAudioPlaybackDeviceTest(),this.stopAudioDevicePlayTest()}},{key:"_playAudioFile",value:(n=Tm(Em().mark((function e(t,r){var n,i=this;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return GX.print("_playAudioFile()",wm(n="Invoke url=".concat(t,"; loop=")).call(n,r.loop)),e.abrupt("return",new qf((function(e,n){var o=iG("audio",{attributes:{src:t,crossOrigin:"anonymous"}});i._audioElement=o,o.loop=r.loop,i._audioLevelFetcher=new _U(o),o.onplaying=function(){o.onplaying=null,GX.print("_playAudioFile()","onplaying"),e()},o.onerror=function(){var e=Tm(Em().mark((function e(t){var r,i;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:GX.print("_playAudioFile()","onerror",t),i=t.message||(null==o||null===(r=o.error)||void 0===r?void 0:r.message),n(new hR(dR.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;GX.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 qf.all([null===(e=i._audioLevelFetcher)||void 0===e?void 0:e.resume(),o.play()])})):n(new hR(dR.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&&(GX.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&&(GX.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&&(GX.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=Tm(Em().mark((function e(t,r){var n,i=this;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,HU({},this._extensionManager);case 2:return this._audioTrack=e.sent,this._audioTrack.setVolume(r),n=new MediaStream([this._audioTrack.getTrack("preprocessing")]),GX.print("startAudioDeviceRecordTest()","create microphone track success!"),e.abrupt("return",new qf((function(e,r){var o,a;"function"==typeof MediaRecorder.isTypeSupported&&(o=mE(a=["audio/webm","audio/mp4"]).call(a,(function(e){return MediaRecorder.isTypeSupported(e)})),GX.print("startAudioDeviceRecordTest()","use mimeType: ".concat(o))),i._mediaRecorder=new MediaRecorder(n,o?{mimeType:o}:void 0);var s=i._mediaRecorder.mimeType;i._mediaRecorder.ondataavailable=function(){var n=Tm(Em().mark((function n(o){var a,c;return Em().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(!i._isAudioDeviceRecordTesting){n.next=16;break}return GX.print("startAudioDeviceRecordTest()","get recorded file(mimeType: ".concat(s,").")),c=new Blob([o.data],{type:s}),n.prev=3,n.next=6,i._playAudioFile(PX.createObjectURL(c),{loop:!1});case 6:n.next=11;break;case 8:return n.prev=8,n.t0=n.catch(3),n.abrupt("return",r(n.t0));case 11:i._startEmitAudioPlaybackDeviceTestVolume(t),null===(a=i._audioElement)||void 0===a||a.addEventListener("ended",(function(){i.stopAudioDevicePlayTest(),e()})),i._audioCaptureAndRecoderResolve=e,n.next=17;break;case 16:e();case 17:case"end":return n.stop()}}),n,null,[[3,8]])})));return function(e){return n.apply(this,arguments)}}(),i._mediaRecorder.onerror=function(e){r(new hR(dR.AUDIO_DEVICE_TEST_FAILED,e.message||"mediaRecorder error"))},i._mediaRecorder.start()})));case 7:case"end":return e.stop()}}),e,this)}))),function(e,t){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=Tm(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=fU.getAudioContextInstance())||void 0===r||null===(n=r.setSinkId)||void 0===n||n.call(r,t),GX.print("setSinkId","ctx.sinkId=".concat(t))}catch(o){GX.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}(vM.exports.EventEmitter),zX=function(){function e(t){Ll(this,e),Qd(this,"_roomId",void 0),Qd(this,"_constraints",{}),Qd(this,"_profile",void 0),this._appId=t}return Dl(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=NP.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=ZT(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),Fm(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=Zd(Zd({},this._constraints),e)}},{key:"getConstraints",value:function(){var e=Zd({},this._constraints),t=NP.getEngineWebConfig(this._appId,this._roomId||"").audio_capture;eP(null==t?void 0:t.sample_rate)||(e.sampleRate=t.sample_rate),eP(null==t?void 0:t.channel)||(e.channelCount=t.channel),eP(null==t?void 0:t.agc)||(e.autoGainControl=t.agc),eP(null==t?void 0:t.ans)||(e.noiseSuppression=t.ans),eP(null==t?void 0:t.aec)||(e.echoCancellation=t.aec);var r=this._getConfigByAudioProfile(),n=r.sampleRate,i=r.channel;return eP(e.sampleRate)&&!eP(n)&&(e.sampleRate=n),eP(e.channelCount)&&!eP(i)&&(e.channelCount=i),e}},{key:"_getConfigByAudioProfile",value:function(){var e={};switch(this._profile){case El.fluent:e.sampleRate=16e3,e.bitrate=24e3;break;case El.standard:e.sampleRate=48e3,e.bitrate=48e3;break;case El.hd:e.sampleRate=48e3,e.bitrate=128e3,e.channel=2;break;case El.standardStereo:e.sampleRate=48e3,e.bitrate=8e4,e.channel=2;break;case El.hdMono:e.sampleRate=48e3,e.bitrate=128e3}return e}}]),e}(),XX=new cO("VideoSnapshot",1),KX=function(e){var t=null==e?void 0:e.domElement;if(t&&!t.paused&&4===t.readyState)return t},qX=function(){var e=Tm(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=KX(n))){e.next=16;break}return XX.print("takeSnapshot","VideoPlayer already set."),e.next=11,a(c,c.videoWidth,c.videoHeight);case 11:return u=e.sent,XX.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 XX.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,XX.print("takeSnapshot","success, cost ".concat(Date.now()-s,"ms")),e.abrupt("return",l);case 29:return XX.print("takeSnapshot","use temp video"),e.abrupt("return",new qf((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);XX.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)}}(),YX=function(){return{url:"",video:{codec:Il.H264,width:640,height:360,fps:15,gop:2,kBitRate:WX(640,360,15)},audio:{codec:"AAC",kBitRate:64,sampleRate:48e3,channels:2,AACProfile:Tl.LC},layout:{regions:[],appData:"",backgroundColor:"#000000"}}};function WX(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 QX(e){if("string"!=typeof e||!/^rtmps?:\/\//.test(e))throw new hR(dR.INVALID_PARAMS,"Invalid rtmp address")}function JX(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];if(null==e||!e.length)throw new hR(dR.INVALID_PARAMS,"regions should not be empty.");var t,r=JT(e);try{for(r.s();!(t=r.n()).done;){var n=t.value;if("string"!=typeof n.userId)throw new hR(dR.INVALID_PARAMS,"region.userId(".concat(n.userId,") should be a string."));if("boolean"!=typeof n.isScreenStream)throw new hR(dR.INVALID_PARAMS,"region.isScreenStream(".concat(n.isScreenStream,") should be a boolean."))}}catch(i){r.e(i)}finally{r.f()}}function ZX(e,t){var r,n,i,o=function(e,r){var n=lb(e).call(e,(function(e,t){return null==e?void 0:e[t]}),t),i=lb(e).call(e,(function(e,t){return null==e?void 0:e[t]}),YX());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!!mE(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 _k(t=[1,2]).call(t,e)})),profile:o(["audio","AACProfile"],(function(e){var t;return _k(t=[Tl.LC,Tl.HEv1,Tl.HEv2]).call(t,e)}))},video:{codec:o(["video","codec"],(function(e){var t;return _k(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:WX(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:Fm(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&&_k(t=[1,2,3]).call(t,e.renderMode)?e.renderMode:1,contentControl:e.contentControl&&_k(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 $X,eK={getDefaultValue:YX,checkStartParams:function(e){var t;QX(e.url),JX(null===(t=e.layout)||void 0===t?void 0:t.regions)},checckUpdateParams:function(e){var t;e.url&&QX(e.url),JX(null===(t=e.layout)||void 0===t?void 0:t.regions)},getStartParams:function(e){return ZX("started",e)},getUpdateParams:function(e){return ZX("layoutChanged",e)}},tK=ad,rK=tc,nK=function(e,t,r,n){for(var i,o=n>1?void 0:n?rK(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&&tK(t,r,o),o},iK=new cO("Engine",0),oK=function(e){OI(me,e);var t,r,n,i,o,a,s,c,u,d,l,h,v,p,_,f,m,g,y,S,b,E,k,T,I,A,R,C,w,x,O,P,M,N,D,L,U,V,F,B,j,G,H,z,X,K,q,Y,W,Q,J,Z,$,ee,te,re,ne,ie,oe,ae,se,ce,ue,de,le,he,ve,pe,_e,fe=YI(me);function me(e,t,r){var n;return Ll(this,me),Qd($T(n=fe.call(this)),"monitor",void 0),Qd($T(n),"_room",void 0),Qd($T(n),"_publicStreamManager",void 0),Qd($T(n),"_appId",void 0),Qd($T(n),"_businessId",void 0),Qd($T(n),"_visibility",!0),Qd($T(n),"_localVideoTrack",void 0),Qd($T(n),"_localAudioTrack",void 0),Qd($T(n),"_localImgVideoTrack",void 0),Qd($T(n),"_localImgScreenTrack",void 0),Qd($T(n),"_localScreenVideoTrack",void 0),Qd($T(n),"_localScreenAudioTrack",void 0),Qd($T(n),"_tempMixingAudioTrack",void 0),Qd($T(n),"_localAudioVolume",100),Qd($T(n),"_localScreenAudioVolume",100),Qd($T(n),"_remoteAudioVolume",new JS),Qd($T(n),"_remoteScreenAudioVolume",new JS),Qd($T(n),"_publicAudioVolume",new JS),Qd($T(n),"_videoPlayer",void 0),Qd($T(n),"_screenPlayer",void 0),Qd($T(n),"_remoteVideoPlayer",new JS),Qd($T(n),"_remoteScreenPlayer",new JS),Qd($T(n),"_remoteAudioPlayer",new JS),Qd($T(n),"_remoteScreenAudioPlayer",new JS),Qd($T(n),"_publicStreamAudioPlayer",new JS),Qd($T(n),"_publicStreamVideoPlayer",new JS),Qd($T(n),"_publicStreamIds",new JS),Qd($T(n),"_roomConfig",void 0),Qd($T(n),"_videoStreamConstraints",HP),Qd($T(n),"_audioStreamConstraints",{}),Qd($T(n),"_enableSimulcast",!1),Qd($T(n),"_videoStreamEncodeConfig",[HP]),Qd($T(n),"_screenStreamEncodeConfig",[zP]),Qd($T(n),"_dummyMainImage",void 0),Qd($T(n),"_dummyScreenImage",void 0),Qd($T(n),"_trackSourceType",void 0),Qd($T(n),"_liveTranscodeConfig",void 0),Qd($T(n),"_useCloudProxy",void 0),Qd($T(n),"_startCloudProxyTimestamp",void 0),Qd($T(n),"_localVideoDeviceId",void 0),Qd($T(n),"_localAudioDeviceId",void 0),Qd($T(n),"_pauseAllSubscribeState",{audio:void 0,video:void 0,resumeStreamIds:{}}),Qd($T(n),"_audioVolumeIndicationTimer",void 0),Qd($T(n),"_dummyMainTimer",void 0),Qd($T(n),"_dummyScreenTimer",void 0),Qd($T(n),"_audioPropertiesReportTimer",null),Qd($T(n),"_mirrorType",hl.MIRROR_TYPE_RENDER),Qd($T(n),"_audioMixingManager",void 0),Qd($T(n),"_pubLock",void 0),Qd($T(n),"_rtmClient",void 0),Qd($T(n),"_messageStatisticsObserver",void 0),Qd($T(n),"_tempRoomInfo",void 0),Qd($T(n),"_originIceConfigRequestUrls",void 0),Qd($T(n),"_originConfigServerUrls",void 0),Qd($T(n),"_originLogServerUrl",void 0),Qd($T(n),"_extensionManager",void 0),Qd($T(n),"_audioDeviceManager",void 0),Qd($T(n),"_audioProfileManager",void 0),Qd($T(n),"_remoteVideoConfig",new JS),Qd($T(n),"_userPriorityMap",new JS),Qd($T(n),"_subscribeFallbackOption",void 0),Qd($T(n),"_cameraCapturing",!1),Qd($T(n),"_interruptCameraCapture",!1),Qd($T(n),"_micCapturing",!1),Qd($T(n),"_interruptMicCapture",!1),Qd($T(n),"_avSync",!0),Qd($T(n),"_config",void 0),Qd($T(n),"_needClosePreTrack",!1),Qd($T(n),"_updateMixAudioTrack",function(){var e=Tm(Em().mark((function e(t){var r,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]:xl.PLAYOUT_AND_PUBLISH,iK.print("_updateMixAudioTrack()"),n._localAudioTrack){e.next=5;break}return t&&(n._tempMixingAudioTrack={track:t,type:i}),e.abrupt("return");case 5:if(t?(n._localAudioTrack.mixType=i,n._localAudioTrack.mixedAudioTrack=t):(delete n._localAudioTrack.mixType,delete n._localAudioTrack.mixedAudioTrack),null===(r=n._room)||void 0===r||!r.hasPublished){e.next=9;break}return e.next=9,n._updatePublish();case 9:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()),Qd($T(n),"_onAudioMixingMessage",(function(e){n.safeEmit(Ml.onAudioMixingStateChanged,e)})),Qd($T(n),"_onAudioMixingAutoplayFailed",(function(e){n.safeEmit(Ml.onAutoplayFailed,e)})),n.id=t,n._appId=e,n._pubLock=new bj("pubLock"),n._addDeviceEventHandler(),n._extensionManager=new gU(t),n._audioDeviceManager=new HX(n._extensionManager),n._audioMixingManager=new UX({getLocalAudioTrack:function(){return n._localAudioTrack},updateLocalAudioTrack:n._updateMixAudioTrack,emitMessage:n._onAudioMixingMessage,onAutoPlayFailed:n._onAudioMixingAutoplayFailed},t),n._audioProfileManager=new zX(e),window.__rtc_engine__=$T(n),window["__rtc_engine__".concat(Math.floor(100*Math.random()+1))]=$T(n),n._trackSourceType={video:$d.VIDEO_SOURCE_TYPE_INTERNAL,screenVideo:$d.VIDEO_SOURCE_TYPE_INTERNAL,audio:el.AUDIO_SOURCE_TYPE_INTERNAL,screenAudio:el.AUDIO_SOURCE_TYPE_INTERNAL},n._config=r,n._rtmClient=new BX(t,e),n._handleRTMClient(n._rtmClient),n._useCloudProxy=!1,n._handleAudioDeviceManager(),n._messageStatisticsObserver=new pO(t),n.monitor=kO(t),vO.createRTSMsgReportor(n.id),n._getServerConfig(),n}return Dl(me,[{key:"appId",get:function(){return this._appId},set:function(e){this._appId=e}},{key:"updateToken",value:(_e=Tm(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(iK.print("updateToken()","token: %s",t),qP(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 hR(dR.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 _e.apply(this,arguments)})},{key:"setVideoCaptureDevice",value:(pe=Tm(Em().mark((function e(t){var r,n,i,o=this;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(iK.print("setVideoCaptureDevice()","deviceId: %s",t),qP(t,"deviceId"),this._localVideoDeviceId=t,this._localVideoTrack){e.next=5;break}return e.abrupt("return");case 5:return r=aB({},this._videoStreamConstraints),"user"===t||"environment"===t||"left"===t||"right"===t?(delete r.deviceId,r.facingMode=t):r.deviceId={exact:t},fP&&uP&&AP>=85&&AP<=91&&(null===(n=this._videoPlayer)||void 0===n||n.removeTrack()),this._needClosePreTrack&&(this._removeLocalTrackEvents(this._localVideoTrack),this._localVideoTrack.close(),delete this._localVideoTrack),iK.print("setVideoCaptureDevice()","start createCameraVideoTrack..."),e.next=12,jU(r,this._extensionManager).catch((function(e){if(o._localVideoTrack&&!o._localVideoTrack.dummy)return iK.print("setVideoCaptureDevice()","createCameraVideoTrack failed, stop pre VideoTrack."),o._removeLocalTrackEvents(o._localVideoTrack),o._localVideoTrack.close(),delete o._localVideoTrack,jU(r,o._extensionManager).then((function(e){return o._needClosePreTrack=!0,e})).catch(Tm(Em().mark((function t(){var r;return Em().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return iK.print("setVideoCaptureDevice()","createCameraVideoTrack failed, rollback."),t.next=3,jU(o._videoStreamConstraints,o._extensionManager);case 3:throw r=t.sent,o._switchTrack(r),e;case 6:case"end":return t.stop()}}),t)}))));throw e}));case 12:return i=e.sent,iK.print("setVideoCaptureDevice()","createCameraVideoTrack success."),this._videoStreamConstraints=r,this._localVideoTrack&&(this._removeLocalTrackEvents(this._localVideoTrack),this._localVideoTrack.close()),e.next=18,this._switchTrack(i);case 18:case"end":return e.stop()}}),e,this)}))),function(e){return pe.apply(this,arguments)})},{key:"setAudioCaptureDevice",value:(ve=Tm(Em().mark((function e(t){var r,n,i;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(iK.print("setAudioCaptureDevice()","deviceId: %s",t),qP(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.prev=8,this._micCapturing=!0,e.next=12,HU(this._audioProfileManager.getConstraints(),this._extensionManager);case 12:if(i=e.sent,!this._interruptMicCapture){e.next=17;break}return this._interruptMicCapture=!1,i.close(),e.abrupt("return");case 17:if(this._initLocalTrackEvents(i),this._localAudioTrack=i,this._localAudioTrack.setVolume(this._localAudioVolume),this._room){e.next=22;break}return e.abrupt("return");case 22:if(null===(r=this._room)||void 0===r||null===(n=r.localStream)||void 0===n||!n.pubAudio){e.next=25;break}return e.next=25,this._updatePublish();case 25:return e.prev=25,this._micCapturing=!1,e.finish(25);case 28:case"end":return e.stop()}}),e,this,[[8,,25,28]])}))),function(e){return ve.apply(this,arguments)})},{key:"_addDeviceEventHandler",value:function(){hU.on(Ml.onVideoDeviceStateChanged,this._onVideoDeviceStateChange.bind(this)),hU.on(Ml.onAudioDeviceStateChanged,this._onAudioDeviceStateChange.bind(this))}},{key:"_addHandlerEventHandler",value:function(){var e,t,r,n,i,o,a,s,c,u,d,l,h,v,p,_,f,m,g,y,S,b,E,k,T,I,A,R,C,w,x,O,P=this;null===(e=this._room)||void 0===e||e.on(xM.ON_ADD_STREAM,this._onAddStream.bind(this)),null===(t=this._room)||void 0===t||t.on(xM.ON_REMOVE_STREAM,this._onRemoveStream.bind(this)),null===(r=this._room)||void 0===r||r.on(xM.USER_CONNECTION,this._onUserConnection.bind(this)),null===(n=this._room)||void 0===n||n.on(Ej.ON_USER_LEAVE,this._onUserLeave.bind(this)),null===(i=this._room)||void 0===i||i.on(Ej.ON_ROOM_ERROR,this._onRoomError.bind(this)),null===(o=this._room)||void 0===o||o.on(Ej.ON_NETWORK_QUALITY,this._onNetworkQuality.bind(this)),null===(a=this._room)||void 0===a||a.on(xM.ON_CUSTOM_MESSAGE,this._onCustomMessage.bind(this)),null===(s=this._room)||void 0===s||s.on(xM.USER_MESSAGE_RECEIVED,this._onUserMessageReceived.bind(this)),null===(c=this._room)||void 0===c||c.on(xM.USER_BINARY_MESSAGE_RECEIVED,this._onUserBinaryMessageReceived.bind(this)),null===(u=this._room)||void 0===u||u.on(xM.ON_USER_TOKEN_WILL_EXPIRE,this._onUserTokenWillExpire.bind(this)),null===(d=this._room)||void 0===d||d.on(xM.POST_PROCESSING_MESSAGE,(function(e){"2.0"===e.protocol?P._onStreamMixingEvent({error:e.error,event:e.eventType,message:e.message}):"publicStreamCallback"===e.type?P._onPushPublicStreamResult(e):"transcodeStatusCallback"===e.type&&P._onLiveTranscodingResult(e)})),null===(l=this._room)||void 0===l||l.on(PM.ON_CONNECTION_STATE_CHANGE,this._onConnectionStateChange.bind(this)),null===(h=this._room)||void 0===h||h.on(PM.ON_VENDOR_CONNECTION_STATE_CHANGE,(function(e){return P.safeEmit(Ml.onVendorConnectionStateChanged,e)})),null===(v=this._room)||void 0===v||v.on(Ej.RESUBSCRIBE,this._onResubscribe.bind(this)),null===(p=this._room)||void 0===p||p.on(Ej.SUBSCRIBE_PUSH_TRACK,this._onSubscribePushTrack.bind(this)),null===(_=this._room)||void 0===_||_.on(Ej.REMOVE_PUSH_TRACK,this._onRemovePushTrack.bind(this)),null===(f=this._room)||void 0===f||f.on(Ej.ON_PUBLISH_RESULT,(function(e){var t;null!==(t=P._room)&&void 0!==t&&t._roomConfig.isAutoPublish&&P.safeEmit(Ml.onAutoPublishResult,e)})),null===(m=this._room)||void 0===m||m.on(Ej.ON_REMOTE_STREAM_STATS,(function(e){P.safeEmit(Ml.onRemoteStreamStats,e)})),null===(g=this._room)||void 0===g||g.on(Ej.ON_LOCAL_STREAM_STATS,(function(e){P.safeEmit(Ml.onLocalStreamStats,e)})),null===(y=this._room)||void 0===y||y.on(Ej.ON_SUBTITLE_STATE_CHANGED,(function(e){P.safeEmit(Ml.onSubtitleStateChanged,e)})),null===(S=this._room)||void 0===S||S.on(Ej.ON_SUBTITLE_MESSAGE_RECEIVED,(function(e){P.safeEmit(Ml.onSubtitleMessageReceived,e)})),null===(b=this._room)||void 0===b||b.on(Ej.ON_USER_PUBLISH_STATE_CHANGE,this._onUserPublishStateChange.bind(this)),null===(E=this._room)||void 0===E||E.on(Ej.ON_USER_START_AUDIO_CAPTURE,(function(e,t){var r=e.userId;P._updateAudioPlayerState(t),P.safeEmit(Ml.onUserStartAudioCapture,{userId:r})})),null===(k=this._room)||void 0===k||k.on(Ej.ON_USER_STOP_AUDIO_CAPTURE,(function(e){var t=e.userId;P.safeEmit(Ml.onUserStopAudioCapture,{userId:t})})),null===(T=this._room)||void 0===T||T.on(Ej.ON_USER_START_VIDEO_CAPTURE,(function(e){var t=e.userId;P.safeEmit(Ml.onUserStartVideoCapture,{userId:t})})),null===(I=this._room)||void 0===I||I.on(Ej.ON_USER_STOP_VIDEO_CAPTURE,(function(e){var t=e.userId;P.safeEmit(Ml.onUserStopVideoCapture,{userId:t})})),null===(A=this._room)||void 0===A||A.on(Ej.ON_SEI_MESSAGED_RECEIVED,(function(e){P.safeEmit(Ml.onSEIMessageReceived,e)})),null===(R=this._room)||void 0===R||R.on(Ej.ON_REMOTE_VIDEO_SIZE_CHANGED,(function(e,t){P.safeEmit(Ml.onRemoteVideoSizeChanged,e,t)})),null===(C=this._room)||void 0===C||C.on(Ej.ON_SIMULCAST_SUBSCRIBE_FALLBACK,(function(e){return P.safeEmit(Ml.onSimulcastSubscribeFallback,e)})),null===(w=this._room)||void 0===w||w.on(Ej.RECONNECT_FAILED,(function(){P.safeEmit(Ml.onError,{errorCode:dR.RECONNECT_FAILED})})),null===(x=this._room)||void 0===x||x.on(Ej.ON_VIDEO_STREAM_BANNED,(function(e){P.safeEmit(Ml.onVideoStreamBanned,{uid:e.uid,banned:e.banned})})),null===(O=this._room)||void 0===O||O.on(Ej.ON_AUDIO_STREAM_BANNED,(function(e){P.safeEmit(Ml.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 cM(e)&&IO(this.id,e,i),(t=wI(RI(me.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:"connect",value:(he=Tm(Em().mark((function e(){return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this._room){e.next=2;break}return e.abrupt("return",!1);case 2:return this._room=new rG({isAutoPublish:!0,isAutoSubscribeAudio:!0,isAutoSubscribeVideo:!0,roomProfileType:bl.communication},{id:this.id,audioProfileManager:this._audioProfileManager,streamRTT:{},subscribeFallbackOption:this._subscribeFallbackOption,userPriority:this._userPriorityMap,avSync:this._avSync}),this._addHandlerEventHandler(),e.next=6,this._room.connect(this._appId);case 6:case"end":return e.stop()}}),e,this)}))),function(){return he.apply(this,arguments)})},{key:"joinRoom",value:(le=Tm(Em().mark((function e(t,r,n,i){var o,a,s,c,u,d,l;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(iK.print("joinRoom()","token: %o roomId: %o, userInfo: %o, roomConfig: %o",t,r,n,i),eM(t)||qP(t,"token"),tM(r),iM(n),oM(i=aB({isAutoPublish:!0,isAutoSubscribeAudio:!0,isAutoSubscribeVideo:!0,roomProfileType:bl.communication},i)),(null===(o=this._room)||void 0===o?void 0:o.connectionState)!==Nj.CONNECTED){e.next=8;break}throw new hR(dR.REPEAT_JOIN,"Already joined");case 8:return this._room||(this._room=new rG(i,{id:this.id,audioProfileManager:this._audioProfileManager,streamRTT:{},subscribeFallbackOption:this._subscribeFallbackOption,userPriority:this._userPriorityMap,avSync:this._avSync}),this._addHandlerEventHandler()),this._room.roomConfig=i,a=this._liveTranscodeConfig&&eK.getStartParams(this._liveTranscodeConfig),s=Zd(Zd({},n),{},{businessId:this._businessId,role:this._visibility?VX.NORMAL_USER:VX.SILENT_USER}),e.prev=12,this._useCloudProxy&&(this._startCloudProxyTimestamp=Date.now()),Qj(s),e.next=17,this._room.join(this._appId,r,t,s,a,this._useCloudProxy,null===(c=this._config)||void 0===c?void 0:c.expectedIDC);case 17:return d=e.sent,this._roomConfig=i,this._audioProfileManager.setRoomId(r),this._tempRoomInfo&&delete this._tempRoomInfo,null!==(u=i)&&void 0!==u&&u.isAutoPublish&&(this._visibility?this._updatePublish({invokeByJoinRoom:!0,mediaType:ul.AUDIO_AND_VIDEO}):this.safeEmit(Ml.onAutoPublishResult,{isScreen:!1,state:ol.PUBLISH_FAIL})),vO.setRoomId(this.id,r),vO.setUserId(this.id,n.userId),e.abrupt("return",d);case 27:throw e.prev=27,e.t0=e.catch(12),e.t0.code===dR.INVALID_TOKEN&&(this._tempRoomInfo={config:i,roomId:r,userInfo:s}),null===(l=this._room)||void 0===l||l.destroy(),e.t0;case 32:case"end":return e.stop()}}),e,this,[[12,27]])}))),function(e,t,r,n){return le.apply(this,arguments)})},{key:"leaveRoom",value:(de=Tm(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],iK.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 JS,this._remoteScreenAudioPlayer.forEach((function(e){return e.destroy()})),this._remoteScreenAudioPlayer=new JS,this._remoteScreenPlayer.forEach((function(e){return e.destroy()})),this._remoteScreenPlayer=new JS,this._remoteVideoPlayer.forEach((function(e){return e.destroy()})),this._remoteVideoPlayer=new JS,this._roomConfig=void 0,this._publicStreamIds=new JS,vO.setRoomId(this.id,""),vO.setUserId(this.id,"");case 24:case"end":return e.stop()}}),e,this)}))),function(){return de.apply(this,arguments)})},{key:"destroy",value:function(){var e,t,r;iK.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=[HP],this._screenStreamEncodeConfig=[zP],this._pauseAllSubscribeState={audio:void 0,video:void 0,resumeStreamIds:{}},this._messageStatisticsObserver.destroy(),this.monitor.destroy(),vO.destroyRTSMsgReportor(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 JS,this._remoteScreenAudioPlayer.forEach((function(e){return e.destroy()})),this._remoteScreenAudioPlayer=new JS,this._remoteScreenPlayer.forEach((function(e){return e.destroy()})),this._remoteScreenPlayer=new JS,this._remoteVideoPlayer.forEach((function(e){return e.destroy()})),this._remoteVideoPlayer=new JS,this._publicStreamAudioPlayer.forEach((function(e){return e.destroy()})),this._publicStreamAudioPlayer=new JS,this._publicStreamVideoPlayer.forEach((function(e){return e.destroy()})),this._publicStreamVideoPlayer=new JS,this._roomConfig=void 0,this._audioMixingManager.destroy(),this._rtmClient.destroy(),null===(r=this._publicStreamManager)||void 0===r||r.destroy(),this._publicStreamIds=new JS,this._audioDeviceManager.destroy(),this._remoteVideoConfig=new JS,this._userPriorityMap.clear(),this._extensionManager.destroy(),this._cameraCapturing=!1,this._micCapturing=!1,this._interruptCameraCapture=!1,this._interruptMicCapture=!1,this._avSync=!0,this._localAudioVolume=100,this._localScreenAudioVolume=100,this._remoteAudioVolume.clear(),this._remoteScreenAudioVolume.clear(),this._publicAudioVolume.clear()}},{key:"publishStream",value:(ue=Tm(Em().mark((function e(t){return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(iK.print("publishStream()","mediaType: %o",t),this._checkMediaType(t),this._assertNotInRoom(),!QO(t)||this._localVideoTrack||!this._localImgVideoTrack){e.next=7;break}return e.next=6,UU(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=Tm(Em().mark((function e(t,r){var n;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(iK.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:Tj.UNPUB});case 7:case"end":return e.stop()}}),e,this)}))),function(e,t){return ce.apply(this,arguments)})},{key:"publishScreen",value:(se=Tm(Em().mark((function e(t){return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(iK.print("publishScreen()","mediaType: %o",t),this._checkMediaType(t),this._assertNotInRoom(),e.prev=3,!QO(t)||this._localScreenVideoTrack||!this._localImgScreenTrack){e.next=8;break}return e.next=7,FU(this._localImgScreenTrack,this._extensionManager);case 7:this._localScreenVideoTrack=e.sent;case 8:return e.next=10,this._updateScreenPublish({mediaType:t,pubState:Tj.PUB});case 10:e.next=19;break;case 12:if(e.prev=12,e.t0=e.catch(3),!(e.t0 instanceof hR)){e.next=18;break}throw e.t0;case 18:throw new hR(dR.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=Tm(Em().mark((function e(t){return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return iK.print("unpublishScreen()","mediaType: %o",t),this._checkMediaType(t),this._assertNotInRoom(),e.next=5,this._updateScreenPublish({mediaType:t,pubState:Tj.UNPUB});case 5:case"end":return e.stop()}}),e,this)}))),function(e){return ae.apply(this,arguments)})},{key:"subscribeStream",value:(oe=Tm(Em().mark((function e(t,r){return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return iK.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=Tm(Em().mark((function e(t,r,n){var i,o,a,s,c,u,d,l,h,v,p,_,f,m,g,y;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._checkMediaType(n),this._assertNotInRoom(),n!==ul.AUDIO||null===(i=this._room)||void 0===i||!i.multiChatMode){e.next=5;break}return iK.print("subscribeStream()","due to multiChatMode return"),e.abrupt("return");case 5:if(u=this._room.remoteStreams.get(r),d=null==u?void 0:mE(u).call(u,(function(e){return e.isScreen===t}))){e.next=9;break}throw new hR(dR.STREAM_NOT_EXIST,"stream not exist");case 9:return l=this._pauseAllSubscribeState.audio,h=this._pauseAllSubscribeState.video,this._pauseAllSubscribeState.audio&&(n-=n&ul.AUDIO),this._pauseAllSubscribeState.video&&(n-=n&ul.VIDEO),iK.print("subscribeStream()","due to pauseAll mediaType: %o",n),v=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:WO(n)&&this._updateAudioPlayerState(d),QO(n)&&this._updateVideoPlayerState(d),_=0,f=0,l!==this._pauseAllSubscribeState.audio&&(this._pauseAllSubscribeState.audio?_|=ul.AUDIO:f|=ul.AUDIO),h!==this._pauseAllSubscribeState.video&&(this._pauseAllSubscribeState.video?_|=ul.VIDEO:f|=ul.VIDEO),_&&this.pauseAllSubscribedStream(_),f&&this.resumeAllSubscribedStream(f),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:il.SUBSCRIBE_SUCC},this.safeEmit(Ml.onAutoSubscribeResult,m)),null!==(c=this._room)&&void 0!==c&&c.multiChatMode||v||!WO(n)||!d.hasAudio||null===(g=d.observer)||void 0===g||g.setSubscribeAudio(!0),!v&&QO(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=Tm(Em().mark((function e(t,r){return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:iK.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=Tm(Em().mark((function e(t,r){return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return iK.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=Tm(Em().mark((function e(t,r){return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:iK.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!==ul.AUDIO||null===(i=this._room)||void 0===i||!i.multiChatMode){var a=this._room.remoteStreams.get(t),s=null==a?void 0:mE(a).call(a,(function(t){return t.isScreen===e}));if(null==s||!s.hasSubscribed)throw new hR(dR.STREAM_NOT_EXIST,"stream not exist");if(fP&&AP&&AP>=85&&AP<=91&&r!==ul.AUDIO)(e?this._remoteScreenPlayer.get(t):this._remoteVideoPlayer.get(t)).stop();return this._room.unsubscribe(s,r).then((function(){n||delete o._pauseAllSubscribeState.resumeStreamIds[s.streamId]}))}iK.print("subscribeStream()","due to multiChatMode return")}},{key:"setRemoteVideoConfig",value:(ee=Tm(Em().mark((function e(t,r){var n;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return iK.print("setRemoteVideoConfig() userId: %o, remoteVideoConfig: %o",t,r),rM(t),uM(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:($=Tm(Em().mark((function e(t){var r,n,i,o,a,s,c,u,d,l,h,v=this;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(iK.print("startVideoCapture()","deviceId: %s",t),eM(t)||qP(t,"deviceId"),t=t||this._localVideoDeviceId,this._localVideoDeviceId=t,this._trackSourceType.video!==$d.VIDEO_SOURCE_TYPE_EXTERNAL){e.next=6;break}throw new hR(dR.STREAM_TYPE_NOT_MATCH,"setVideoSourceType as internal first");case 6:if(!(this._cameraCapturing||this._localVideoTrack&&!this._localVideoTrack.dummy)){e.next=8;break}throw new hR(dR.REPEAT_CAPTURE,"Has already capture");case 8:return a=this._videoStreamConstraints,t&&("user"===t||"environment"===t||"left"===t||"right"===t?a.facingMode=t:a.deviceId={exact:t},this._videoStreamConstraints=a),s={},e.prev=11,this._cameraCapturing=!0,e.next=15,jU(a,this._extensionManager);case 15:if(u=e.sent,!this._interruptCameraCapture){e.next=21;break}throw this._interruptCameraCapture=!1,this._removeLocalTrackEvents(u),u.close(),new hR(dR.INTERRUPT,"interrupt by stopVideoCapture");case 21:if(this._initLocalTrackEvents(u),this._localVideoTrack=u,null===(c=this._videoPlayer)||void 0===c||c.playVideo(u),(d=null==u?void 0:u.getTrack())&&(s=d.getSettings(),l={width:s.width,height:s.height},this._localVideoTrack.resolution=l,setTimeout((function(){return v.safeEmit(Ml.onLocalVideoSizeChanged,{streamIndex:cl.STREAM_INDEX_MAIN,info:l})}))),this._room){e.next=28;break}return e.abrupt("return",s);case 28:return e.prev=28,this._cameraCapturing=!1,e.finish(28);case 31:return h=this._room._roomConfig.isAutoPublish,(null!==(r=this._room)&&void 0!==r&&null!==(n=r.localStream)&&void 0!==n&&n.pubVideo||h)&&(this._visibility?this._updatePublish():this.safeEmit(Ml.onAutoPublishResult,{isScreen:!1,state:ol.PUBLISH_FAIL})),null===(i=this._room.localStream)||void 0===i||null===(o=i.observer)||void 0===o||o.setEnableVideo(!0),e.abrupt("return",s);case 35:case"end":return e.stop()}}),e,this,[[11,,28,31]])}))),function(e){return $.apply(this,arguments)})},{key:"stopVideoCapture",value:(Z=Tm(Em().mark((function e(){var t,r,n,i,o,a,s,c;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(iK.print("stopVideoCapture()"),!this._cameraCapturing){e.next=5;break}return this._interruptCameraCapture=!0,iK.print("stopVideoCapture()","capturing"),e.abrupt("return");case 5:if(this._trackSourceType.video!==$d.VIDEO_SOURCE_TYPE_EXTERNAL){e.next=7;break}throw new hR(dR.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||((s=this._extensionManager.getPluginByName(mU.PRE_PROCESSING,"RTCBeautyExtension"))&&s.emit("stop"),this._removeLocalTrackEvents(this._localVideoTrack),this._localVideoTrack.close(),this._localImgVideoTrack?(null===(c=this._localVideoTrack)||void 0===c||c.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||null===(n=r.localStream)||void 0===n||!n.pubVideo){e.next=14;break}return e.next=14,this._updatePublish();case 14:null===(i=this._room)||void 0===i||null===(o=i.localStream)||void 0===o||null===(a=o.observer)||void 0===a||a.setEnableVideo(!1);case 15:case"end":return e.stop()}}),e,this)}))),function(){return Z.apply(this,arguments)})},{key:"startAudioCapture",value:(J=Tm(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(iK.print("startAudioCapture()","deviceId: $o",t),eM(t)||qP(t,"deviceId"),t=t||this._localAudioDeviceId,this._localAudioDeviceId=t,this._trackSourceType.audio!==el.AUDIO_SOURCE_TYPE_EXTERNAL){e.next=6;break}throw new hR(dR.STREAM_TYPE_NOT_MATCH,"setAudioSourceType as internal first");case 6:if(!this._micCapturing&&!this._localAudioTrack){e.next=8;break}throw new hR(dR.REPEAT_CAPTURE,"Has already capture");case 8:return t&&this._audioProfileManager.updateConstraints({deviceId:{exact:t}}),e.prev=9,this._micCapturing=!0,e.next=13,HU(this._audioProfileManager.getConstraints(),this._extensionManager);case 13:if(a=e.sent,!this._interruptMicCapture){e.next=19;break}throw this._interruptMicCapture=!1,this._removeLocalTrackEvents(a),a.close(),new hR(dR.INTERRUPT,"interrupt by stopAudioCapture");case 19:if(this._initLocalTrackEvents(a),this._localAudioTrack=a,this._localAudioTrack.setVolume(this._localAudioVolume),this._tempMixingAudioTrack&&(this._localAudioTrack.mixType=this._tempMixingAudioTrack.type,this._localAudioTrack.mixedAudioTrack=this._tempMixingAudioTrack.track,delete this._tempMixingAudioTrack),this._room){e.next=25;break}return e.abrupt("return");case 25:return e.prev=25,this._micCapturing=!1,e.finish(25);case 28:s=this._room._roomConfig.isAutoPublish,(null!==(r=this._room)&&void 0!==r&&null!==(n=r.localStream)&&void 0!==n&&n.pubAudio||s)&&(this._visibility?this._updatePublish():this.safeEmit(Ml.onAutoPublishResult,{isScreen:!1,state:ol.PUBLISH_FAIL})),null===(i=this._room.localStream)||void 0===i||null===(o=i.observer)||void 0===o||o.setEnableAudio(!0);case 31:case"end":return e.stop()}}),e,this,[[9,,25,28]])}))),function(e){return J.apply(this,arguments)})},{key:"stopAudioCapture",value:(Q=Tm(Em().mark((function e(){var t,r,n,i;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(iK.print("stopAudioCapture()"),!this._micCapturing){e.next=5;break}return this._interruptMicCapture=!0,iK.print("stopAudioCapture()","capturing"),e.abrupt("return");case 5:if(this._trackSourceType.audio!==el.AUDIO_SOURCE_TYPE_EXTERNAL){e.next=7;break}throw new hR(dR.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(null===(t=this._room)||void 0===t||null===(r=t.localStream)||void 0===r||!r.pubAudio){e.next=15;break}return e.next=15,this._updatePublish();case 15:null===(n=this._room.localStream)||void 0===n||null===(i=n.observer)||void 0===i||i.setEnableAudio(!1);case 16:case"end":return e.stop()}}),e,this)}))),function(){return Q.apply(this,arguments)})},{key:"getAudioMixingManager",value:function(){return iK.print("getAudioMixingManager()","invoke"),this._audioMixingManager}},{key:"startScreenCapture",value:(W=Tm(Em().mark((function e(){var t,r,n,i,o,a,s,c,u,d,l,h,v,p,_,f,m=this,g=arguments;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(c=g.length>0&&void 0!==g[0]?g[0]:{},iK.print("startScreenCapture()","config: %o",c),u=c.enableAudio,d=void 0!==u&&u,this._trackSourceType.screenVideo!==$d.VIDEO_SOURCE_TYPE_EXTERNAL){e.next=5;break}throw new hR(dR.STREAM_TYPE_NOT_MATCH,"setVideoSourceType as internal first");case 5:if(this._trackSourceType.screenAudio!==el.AUDIO_SOURCE_TYPE_EXTERNAL){e.next=7;break}throw new hR(dR.STREAM_TYPE_NOT_MATCH,"setAudioSourceType as internal first");case 7:return e.next=9,XU(d,this._extensionManager,this._screenStreamEncodeConfig[0]);case 9:if(l=e.sent,h=ZT(l,2),v=h[0],null==(p=h[1])||p.setVolume(this._localScreenAudioVolume),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=v,null!==(r=this._screenStreamEncodeConfig[0])&&void 0!==r&&r.contentHint&&v.setContentHint(null===(_=this._screenStreamEncodeConfig[0])||void 0===_?void 0:_.contentHint),(f=null==v?void 0:v.getTrack())&&setTimeout((function(){var e=f.getSettings(),t={width:e.width,height:e.height};v.resolution=t,m.safeEmit(Ml.onLocalVideoSizeChanged,{streamIndex:cl.STREAM_INDEX_SCREEN,info:{width:e.width,height:e.height}})}),500),p&&(this._localScreenAudioTrack=p,this._initLocalTrackEvents(p)),null===(n=this._screenPlayer)||void 0===n||n.playVideo(this._localScreenVideoTrack),this._initLocalTrackEvents(this._localScreenVideoTrack,!0),!(null!==(i=this._room)&&void 0!==i&&null!==(o=i.localScreenStream)&&void 0!==o&&o.pubAudio||null!==(a=this._room)&&void 0!==a&&null!==(s=a.localScreenStream)&&void 0!==s&&s.pubVideo)){e.next=27;break}return e.next=27,this._updateScreenPublish();case 27:case"end":return e.stop()}}),e,this)}))),function(){return W.apply(this,arguments)})},{key:"stopScreenCapture",value:(Y=Tm(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(iK.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===(a=this._localScreenVideoTrack)||void 0===a||a.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&&null!==(n=r.localScreenStream)&&void 0!==n&&n.pubAudio||null!==(i=this._room)&&void 0!==i&&null!==(o=i.localScreenStream)&&void 0!==o&&o.pubVideo)){e.next=8;break}return e.next=8,this._updateScreenPublish();case 8:case"end":return e.stop()}}),e,this)}))),function(){return Y.apply(this,arguments)})},{key:"setLocalVideoPlayer",value:function(e,t){if(iK.print("setLocalVideoPlayer()","streamIndex: %o, videoPlayerOption: %o",e,t),YP(e,"streamIndex",[cl.STREAM_INDEX_MAIN,cl.STREAM_INDEX_SCREEN]),t&&t.renderDom){var r,n,i,o,a=Zd(Zd({userId:this._getUserId()},t),{},{isLocal:!0});if(aM(a),e===cl.STREAM_INDEX_MAIN&&!this._videoPlayer)return this._videoPlayer=new uG(this.id,a),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)!==kl.PLAY_MANUALLY&&this._videoPlayer.playVideo(this._localVideoTrack),(null===(n=this._room)||void 0===n?void 0:n.localStream)&&(this._room.localStream.videoDom=this._videoPlayer.domElement),this._videoPlayer.domElement;if(e===cl.STREAM_INDEX_SCREEN&&!this._screenPlayer)return this._screenPlayer=new uG(this.id,Zd(Zd({},a),{},{isScreen:!0,isLocal:!0})),this._initPlayerEvents(this._screenPlayer,!1,e),this._localScreenVideoTrack&&!this._localScreenVideoTrack.dummy&&(null===(i=this._config)||void 0===i?void 0:i.autoPlayPolicy)!==kl.PLAY_MANUALLY&&this._screenPlayer.playVideo(this._localScreenVideoTrack),(null===(o=this._room)||void 0===o?void 0:o.localScreenStream)&&(this._room.localScreenStream.videoDom=this._screenPlayer.domElement),this._screenPlayer.domElement;if(t&&void 0!==t.renderMode){var s=e===cl.STREAM_INDEX_MAIN?this._videoPlayer:this._screenPlayer;null==s||s.setRenderMode(t.renderMode)}}else{var c,u;e===cl.STREAM_INDEX_MAIN?(null===(c=this._videoPlayer)||void 0===c||c.destroy(!0),delete this._videoPlayer):(null===(u=this._screenPlayer)||void 0===u||u.destroy(),delete this._screenPlayer)}}},{key:"startLiveTranscoding",value:(q=Tm(Em().mark((function e(t){var r,n,i;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(iK.print("startLiveTranscoding()","transcode: %o",t),eK.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 hR(dR.INVALID_PARAMS,"The roomId+userId must be within 126 bytes");case 6:if(e.prev=6,this.safeEmit(Ml.onStreamMixingEvent,{event:kj.START,error:0,message:""}),!this._room||this._room.connectionState!==Nj.CONNECTED){e.next=11;break}return e.next=11,null===(i=this._room)||void 0===i?void 0:i.liveControlMessage(eK.getStartParams(this._liveTranscodeConfig));case 11:e.next=20;break;case 13:if(e.prev=13,e.t0=e.catch(6),!(e.t0 instanceof hR)){e.next=19;break}throw e.t0;case 19:throw new hR(dR.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:(K=Tm(Em().mark((function e(t){var r,n,i,o;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(iK.print("updateLiveTranscoding()","transcode: %o",t),this._liveTranscodeConfig){e.next=3;break}return e.abrupt("return");case 3:return delete(i=aB({},t)).audio,null===(r=i.video)||void 0===r||delete r.codec,null===(n=i.video)||void 0===n||delete n.gop,eK.checckUpdateParams(i),this._liveTranscodeConfig=aB(this._liveTranscodeConfig,i),e.prev=9,this.safeEmit(Ml.onStreamMixingEvent,{event:kj.UPDATE,error:0,message:""}),e.next=13,null===(o=this._room)||void 0===o?void 0:o.liveControlMessage(eK.getUpdateParams(this._liveTranscodeConfig));case 13:e.next=22;break;case 15:if(e.prev=15,e.t0=e.catch(9),!(e.t0 instanceof hR)){e.next=21;break}throw e.t0;case 21:throw new hR(dR.UNEXPECTED_ERROR,"unexpected error",e.t0);case 22:case"end":return e.stop()}}),e,this,[[9,15]])}))),function(e){return K.apply(this,arguments)})},{key:"stopLiveTranscoding",value:(X=Tm(Em().mark((function e(){var t;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(iK.print("stopLiveTranscoding()"),this._liveTranscodeConfig){e.next=3;break}return e.abrupt("return");case 3:return delete this._liveTranscodeConfig,e.prev=4,this.safeEmit(Ml.onStreamMixingEvent,{event:kj.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 hR)){e.next=16;break}throw e.t0;case 16:throw new hR(dR.UNEXPECTED_ERROR,"unexpected error",e.t0);case 17:case"end":return e.stop()}}),e,this,[[4,10]])}))),function(){return X.apply(this,arguments)})},{key:"startSubtitle",value:(z=Tm(Em().mark((function e(t){var r;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return iK.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;iK.print("stopSubtitle()","invoke"),null===(e=this._room)||void 0===e||e.stopSubtitle()}},{key:"setBusinessId",value:function(e){return iK.print("setBusinessId()","businessId: %s",e),!function(e){return"string"!=typeof e}(e)&&!this._room&&(this.monitor.set({rtc_business_id:e}),this._businessId=e,!0)}},{key:"setUserVisibility",value:(H=Tm(Em().mark((function e(t){var r,n;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(iK.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?VX.NORMAL_USER:VX.SILENT_USER});case 15:this._visibility=t,t&&null!==(r=this._roomConfig)&&void 0!==r&&r.isAutoPublish&&this._updatePublish({mediaType:ul.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]:cl.STREAM_INDEX_MAIN,i=n===cl.STREAM_INDEX_SCREEN;e.on("playback_event",(function(n){switch(n.eventName){case"timeupdate":return;case"loadeddata":if("audio"===n.type){var o,a,s=e.userId.replace("_screen",""),c=null===(o=t._room)||void 0===o||null===(a=o.remoteStreams.get(s))||void 0===a?void 0:mE(a).call(a,(function(e){return e.isScreen===i})),u=function(){r?t.safeEmit(Ml.onFirstPublicStreamAudioFrameDecoded,{publicStreamId:s}):(t.safeEmit(Ml.onAudioFirstFrameDecoded,{userId:s,isScreen:i}),t.safeEmit(Ml.onRemoteAudioFirstFrame,{userId:s,isScreen:i})),t.monitor.report("first_remote_audio_render",{stream_id:"",stream_user_id:s||""},{isScreen:i})};c&&c.observer&&!c.observer.audioFirstFrameReceived?c.observer.once("recvAudioFirstFrame",u):u()}else{var d,l,h={userId:e.userId,height:(null===(d=e.domElement)||void 0===d?void 0:d.videoHeight)||0,width:(null===(l=e.domElement)||void 0===l?void 0:l.videoWidth)||0,isScreen:i};r?(h.publicStreamId=h.userId,delete h.userId,delete h.isScreen,t.safeEmit(Ml.onFirstPublicStreamVideoFrameRendered,h),t.safeEmit(Ml.onFirstPublicStreamVideoFrameDecoded,h)):e.isLocal||(t.safeEmit(Ml.onVideoFirstFrameRendered,h),t.safeEmit(Ml.onVideoFirstFrameDecoded,h),t.safeEmit(Ml.onRemoteVideoFirstFrame,h)),t.monitor.report("first_remote_video_render",{stream_id:"",stream_user_id:n.userId||""},{isScreen:i})}break;case"autoplay-error":return r&&(n.publicStreamId=n.userId),AO(t.id,"autoplay-error",e instanceof uG?"video":"audio",0,n.userId||""),void t.safeEmit(Ml.onAutoplayFailed,{userId:n.userId,kind:e instanceof uG?"video":"audio",mediaType:e instanceof uG?ul.VIDEO:ul.AUDIO,streamIndex:e.isScreen?cl.STREAM_INDEX_SCREEN:cl.STREAM_INDEX_MAIN})}t.safeEmit(Ml.onPlayerEvent,n)}))}},{key:"_initLocalTrackEvents",value:function(e){var t=this,r=arguments.length>1&&void 0!==arguments[1]&&arguments[1];["track-ended","track-mute","track-unmute"].forEach((function(r){e.on(r,function(){var e=Tm(Em().mark((function e(n){var i,o;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t.monitor.report("rtc_error",{message:wm(i="track-".concat(r," mediaType: ")).call(i,n.getTrack().kind),error_code:-1001}),o=!1,n!==t._localScreenAudioTrack&&n!==t._localScreenVideoTrack||(o=!0),t.safeEmit({"track-ended":Ml.onTrackEnded,"track-mute":Ml.onTrackMute,"track-unmute":Ml.onTrackUnmute}[r],{kind:n.getTrack().kind,isScreen:o}),"track-mute"!==r||!_P){e.next=8;break}return e.next=7,t.stopAudioCapture();case 7:t.startAudioCapture();case 8:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}())})),e.on("resolution-change",(function(e){t._extensionManager.getPluginsByType(mU.PRE_PROCESSING).forEach((function(t){var r;null==t||null===(r=t.applyConstraints)||void 0===r||r.call(t,e)})),t.safeEmit(Ml.onLocalVideoSizeChanged,{streamIndex:r?cl.STREAM_INDEX_SCREEN:cl.STREAM_INDEX_MAIN,info:e})}))}},{key:"_removeLocalTrackEvents",value:function(e){e.removeAllListeners("track-ended"),e.removeAllListeners("track-mute"),e.removeAllListeners("track-unmute"),e.removeAllListeners("resolution-change")}},{key:"setRemoteVideoPlayer",value:function(e,t){iK.print("setRemoteVideoPlayer()","streamIndex: %o, videoPlayerOption: %o",e,t),YP(e,"streamIndex",[cl.STREAM_INDEX_MAIN,cl.STREAM_INDEX_SCREEN]),aM(t);var r,n,i,o=t.userId;if(e===cl.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 uG(this.id,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:mE(c).call(c,(function(e){return!e.isScreen}));return d&&(this._updateVideoPlayerState(d),d.videoDom=u.domElement),u.domElement}if(null===(r=this._remoteScreenPlayer.get(o))||void 0===r||r.destroy(),t.renderDom){var l=new uG(this.id,Zd(Zd({},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:mE(i).call(i,(function(e){return e.isScreen}));return h&&(this._updateVideoPlayerState(h),h.videoDom=l.domElement),l.domElement}}},{key:"setLocalVideoMirrorType",value:function(e){iK.print("setLocalVideoMirrorType()","mirrorType: %o",e),YP(e,"mirrorType",[hl.MIRROR_TYPE_NONE,hl.MIRROR_TYPE_RENDER]),this._mirrorType=e,this._videoPlayer&&this._videoPlayer.mirror(!!e)}},{key:"setAudioPlaybackDevice",value:(G=Tm(Em().mark((function e(t){var r;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return iK.print("setAudioPlaybackDevice()","deviceId: %s",t),qP(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(Ml.onAudioPlaybackDeviceChanged,r),this.monitor.report("rtc_audio_device",{audio_event:"playout_device_switch",message:Mm(r),error_code:0});case 9:case"end":return e.stop()}}),e,this)}))),function(e){return G.apply(this,arguments)})},{key:"play",value:(j=Tm(Em().mark((function e(t){var r,n,i,o,a,s,c,u,d,l,h,v,p,_,f,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]:ul.AUDIO_AND_VIDEO,a=g.length>2?g[2]:void 0,iK.print("play()","userId: %s, mediaType: %s, streamIndex: %s",t,o,a),s=!t||t===this._getUserId()||"local_user"===t,c=void 0===a||a===cl.STREAM_INDEX_MAIN,u=void 0===a||a===cl.STREAM_INDEX_SCREEN,d=o!==ul.VIDEO,l=o!==ul.AUDIO,h=[],s&&l&&(c&&this._localVideoTrack&&(null===(v=this._videoPlayer)||void 0===v||v.mirror(!!this._mirrorType),h.push(null===(p=this._videoPlayer)||void 0===p?void 0:p.manuallyPlay())),u&&this._localScreenVideoTrack&&h.push(null===(_=this._screenPlayer)||void 0===_?void 0:_.manuallyPlay())),t===(null===(r=this._audioMixingManager)||void 0===r?void 0:r.id)&&h.push(this._audioMixingManager.resumeLocalPlay()),f=null===(n=this._room)||void 0===n?void 0:n.remoteStreams,l&&c&&h.push(lG(this._remoteVideoPlayer,t,!1,f)),l&&u&&h.push(lG(this._remoteScreenPlayer,t,!0,f)),d&&c&&h.push(lG(this._remoteAudioPlayer,t,!1,f)),l&&u&&h.push(lG(this._remoteScreenAudioPlayer,t,!0,f)),m=null===(i=this._publicStreamManager)||void 0===i?void 0:i.remoteStreams,d&&h.push(lG(this._publicStreamVideoPlayer,t,!1,m)),l&&h.push(lG(this._publicStreamAudioPlayer,t,!1,m)),e.abrupt("return",qf.all(h).then((function(){})));case 20:case"end":return e.stop()}}),e,this)}))),function(e){return j.apply(this,arguments)})},{key:"pauseAllSubscribedStream",value:(B=Tm(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(iK.print("pauseAllSubscribedStream()","mediaType: %o",t),this._checkMediaType(t),WO(t)&&(s._pauseAllSubscribeState.audio=!0),QO(t)&&(s._pauseAllSubscribeState.video=!0),this._room){e.next=6;break}return e.abrupt("return",qf.resolve());case 6:n=[],i=JT(rA(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",qf.all(n).then((function(){})));case 10:case"end":return e.stop()}}),e,this)}))),function(e){return B.apply(this,arguments)})},{key:"resumeAllSubscribedStream",value:(F=Tm(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(iK.print("resumeAllSubscribedStream()","mediaType: %o",t),this._checkMediaType(t),WO(t)&&(s._pauseAllSubscribeState.audio=!1),QO(t)&&(s._pauseAllSubscribeState.video=!1),this._room){e.next=6;break}return e.abrupt("return",qf.resolve());case 6:n=[],i=JT(rA(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",qf.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=Tm(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 rM(t),sM(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=Tm(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 rM(t),JP(r,"message"),sM(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=Tm(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 sM(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:(D=Tm(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 sM(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 D.apply(this,arguments)})},{key:"setAudioCaptureConfig",value:(N=Tm(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]:{},iK.print("setAudioCaptureConfig()","config: %o",t),delete t.deviceId,ZP(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:(M=Tm(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]:{},iK.print("setVideoCaptureConfig()","config: %o",t),e.abrupt("return",this._setVideoCaptureConfig(t));case 3:case"end":return e.stop()}}),e,this)}))),function(){return M.apply(this,arguments)})},{key:"_setVideoCaptureConfig",value:(P=Tm(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,ZP(r),n=Zd(Zd({},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 P.apply(this,arguments)})},{key:"enableSimulcastMode",value:function(e){var t;return iK.print("enableSimulcastMode()","enabled: %o",e),this._enableSimulcast=e,14!==(null==kP?void 0:kP[0])&&(null!==(t=this._room)&&void 0!==t&&t.hasPublished&&rP("You must call this API before publishing the video streams"),!0)}},{key:"setVideoEncoderConfig",value:(O=Tm(Em().mark((function e(t){var r,n,i;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:for(iK.print("setVideoEncoderConfig()"," descriptions: %o",t),Array.isArray(t)||(t=[t]),lM(t=Gs(t).call(t,(function(e){return!!e}))),t.length>3&&(rP("setVideoEncoderConfig: You can set parameters for up to 3 streams"),t=bm(t).call(t,0,3)),n=1;n<t.length;n++)i=nP(t[0].width)/nP(t[n].width)||1,Math.floor(i)!==i&&rP("setVideoEncoderConfig: The resolution setting needs to be an integer multiple");FA(t).call(t,(function(e,t){return t.maxKbps-e.maxKbps})),this._setVideoCaptureConfig(Zd({},t[0])),this._videoStreamEncodeConfig=t,this._updateDummyCaptureImage(cl.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 O.apply(this,arguments)})},{key:"setScreenEncoderConfig",value:(x=Tm(Em().mark((function e(t){var r;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:iK.print("setScreenEncoderConfig()","description: %o",t),this._screenStreamEncodeConfig=[t],this._localScreenVideoTrack&&(this._localScreenVideoTrack.updateVideoCaptureConfig(t),t.contentHint&&this._localScreenVideoTrack.setContentHint(t.contentHint)),this._updateDummyCaptureImage(cl.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 x.apply(this,arguments)})},{key:"sendSEIMessage",value:function(e,t,r){if(iK.print("sendSEIMessage()","streamIdex: %o, message: %o, repeatCount: %o",e,t,r),!BD())throw new hR(dR.NOT_SUPPORTED,"Browser does not support sending SEI");YP(e,"streamIndex",[cl.STREAM_INDEX_MAIN,cl.STREAM_INDEX_SCREEN]),KP(r,"repeatCount",0,30);var n="string"==typeof t?new Uint8Array(NO.str2ab(t)):t;if(t.length){var i;if(e===cl.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)iK.print("sei size must not bigger than 4KB");else{var l=OO();i.seiList.push({content:n,uuid:l,repeatCount:r}),setTimeout((function(){var e;if(i){var t,r=YA(e=i.seiList).call(e,(function(e){return e.uuid===l}));if(r)ek(t=i.seiList).call(t,r,1)}}),2e3)}}else iK.print("sei message must not be empty")}},{key:"setAudioVolumeIndicationInterval",value:function(e){var t=this;iK.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=mE(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(Ml.onAudioVolumeIndication,{speakers:r})}),e)}},{key:"_sendActiveSpeaker",value:function(e,t){if(this._room&&this._room.remoteUsers.size>=1){var r,n=e[0],i=lb(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(Ml.onActiveSpeaker,{userId:o.userId,extraInfo:o.extraInfo})}}}},{key:"enableAudioPropertiesReport",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};iK.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:cl.STREAM_INDEX_MAIN,audioPropertiesInfo:{linearVolume:i,nonlinearVolume:YO(i)}})}if(e._localScreenAudioTrack){var o=e._localScreenAudioTrack.getAudioLevel();t.push({streamIndex:cl.STREAM_INDEX_SCREEN,audioPropertiesInfo:{linearVolume:o,nonlinearVolume:YO(o)}})}if(e.safeEmit(Ml.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:cl.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:YO(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?cl.STREAM_INDEX_SCREEN:cl.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:YO(o)}})}}))}));e.safeEmit(Ml.onRemoteAudioPropertiesReport,s),e._sendActiveSpeaker(t,Gs(s).call(s,(function(e){return e.streamKey.streamIndex!==cl.STREAM_INDEX_SCREEN})))}}}),o))}},{key:"setVideoSourceType",value:(w=Tm(Em().mark((function e(t,r){var n,i,o,a,s,c,u,d,l,h,v,p,_,f,m,g,y,S,b,E,k,T,I,A,R;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(iK.print("setVideoSourceType()","index: %o, videoSourceType: %o",t,r),YP(t,"streamIndex",[cl.STREAM_INDEX_MAIN,cl.STREAM_INDEX_SCREEN]),YP(r,"VideoSourceType",[$d.VIDEO_SOURCE_TYPE_EXTERNAL,$d.VIDEO_SOURCE_TYPE_INTERNAL]),n=t===cl.STREAM_INDEX_MAIN?"video":"screenVideo",this._trackSourceType[n]===r){e.next=26;break}if(this._trackSourceType[n]=r,iK.print("setVideoSourceType",wm(i="set ".concat(n," source type to ")).call(i,r)),!this._localVideoTrack||t!==cl.STREAM_INDEX_MAIN){e.next=17;break}if(u=!1,r===$d.VIDEO_SOURCE_TYPE_EXTERNAL&&(u=!0,(d=this._extensionManager.getPluginByName(mU.PRE_PROCESSING,"RTCBeautyExtension"))&&d.emit("stop"),this._removeLocalTrackEvents(this._localVideoTrack),this._localVideoTrack.close()),null===(o=this._videoPlayer)||void 0===o||o.stop(),this._localVideoTrack=void 0,l=null===(a=this._room)||void 0===a?void 0:a._roomConfig.isAutoPublish,u?null===(h=this._room)||void 0===h||null===(v=h.localStream)||void 0===v||null===(p=v.observer)||void 0===p||p.setEnableVideo(!1):null===(_=this._room)||void 0===_||null===(f=_.localStream)||void 0===f||null===(m=f.observer)||void 0===m||m.setPushVideo(!1),!(null!==(s=this._room)&&void 0!==s&&null!==(c=s.localStream)&&void 0!==c&&c.pubVideo||l)){e.next=17;break}return e.next=17,this._updatePublish();case 17:if(!this._localScreenVideoTrack||t!==cl.STREAM_INDEX_SCREEN){e.next=26;break}if(b=!1,r===$d.VIDEO_SOURCE_TYPE_EXTERNAL&&(b=!0,this._removeLocalTrackEvents(this._localScreenVideoTrack),this._localScreenVideoTrack.close()),null===(g=this._screenPlayer)||void 0===g||g.stop(),this._localScreenVideoTrack=void 0,b?null===(E=this._room)||void 0===E||null===(k=E.localScreenStream)||void 0===k||null===(T=k.observer)||void 0===T||T.setEnableVideo(!1):null===(I=this._room)||void 0===I||null===(A=I.localScreenStream)||void 0===A||null===(R=A.observer)||void 0===R||R.setPushVideo(!1),null===(y=this._room)||void 0===y||null===(S=y.localScreenStream)||void 0===S||!S.pubVideo){e.next=26;break}return e.next=26,this._updateScreenPublish();case 26:case"end":return e.stop()}}),e,this)}))),function(e,t){return w.apply(this,arguments)})},{key:"setExternalVideoTrack",value:(C=Tm(Em().mark((function e(t,r){var n,i,o,a,s,c,u,d,l,h,v;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(iK.print("setExternalVideoTrack()","index: %o, track: %o",t,r),YP(t,"streamIndex",[cl.STREAM_INDEX_MAIN,cl.STREAM_INDEX_SCREEN]),WP(r),t!==cl.STREAM_INDEX_MAIN){e.next=15;break}if(this._trackSourceType.video===$d.VIDEO_SOURCE_TYPE_EXTERNAL){e.next=6;break}throw new hR(dR.STREAM_TYPE_NOT_MATCH,"setVideoSourceType as external first");case 6:return e.next=8,YU(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),s=null===(i=this._room)||void 0===i?void 0:i._roomConfig.isAutoPublish,!(null!==(o=this._room)&&void 0!==o&&null!==(a=o.localStream)&&void 0!==a&&a.pubVideo||s)){e.next=15;break}return e.next=15,this._updatePublish();case 15:if(t!==cl.STREAM_INDEX_SCREEN){e.next=27;break}if(this._trackSourceType.screenVideo===$d.VIDEO_SOURCE_TYPE_EXTERNAL){e.next=18;break}throw new hR(dR.STREAM_TYPE_NOT_MATCH,"setVideoSourceType as external first");case 18:return e.next=20,ZU(r,this._extensionManager);case 20:if(this._localScreenVideoTrack=e.sent,this._initLocalTrackEvents(this._localScreenVideoTrack,!0),null===(c=this._screenPlayer)||void 0===c||c.playVideo(this._localScreenVideoTrack),null===(u=this._room)||void 0===u||null===(d=u.localScreenStream)||void 0===d||null===(l=d.observer)||void 0===l||l.setPushVideo(!0),null===(h=this._room)||void 0===h||null===(v=h.localScreenStream)||void 0===v||!v.pubVideo){e.next=27;break}return e.next=27,this._updateScreenPublish();case 27:case"end":return e.stop()}}),e,this)}))),function(e,t){return C.apply(this,arguments)})},{key:"setAudioSourceType",value:(R=Tm(Em().mark((function e(t,r){var n,i,o,a,s,c,u,d,l,h,v,p,_,f,m,g,y,S,b,E,k,T;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(iK.print("setAudioSourceType()","index: %o, audioSourceType: %o",t,r),YP(t,"streamIndex",[cl.STREAM_INDEX_MAIN,cl.STREAM_INDEX_SCREEN]),YP(r,"audioSourceType",[el.AUDIO_SOURCE_TYPE_EXTERNAL,el.AUDIO_SOURCE_TYPE_INTERNAL]),n=t===cl.STREAM_INDEX_MAIN?"audio":"screenAudio",this._trackSourceType[n]===r){e.next=24;break}if(this._trackSourceType[n]=r,iK.print("setVideoSourceType",wm(i="set ".concat(n," source type to ")).call(i,r)),!this._localAudioTrack||t!==cl.STREAM_INDEX_MAIN){e.next=16;break}if(c=!1,this._trackSourceType.audio===el.AUDIO_SOURCE_TYPE_EXTERNAL&&(c=!0,this._removeLocalTrackEvents(this._localAudioTrack),this._localAudioTrack.close()),this._localAudioTrack=void 0,u=null===(o=this._room)||void 0===o?void 0:o._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.setEnableAudio(!1):null===(v=this._room)||void 0===v||null===(p=v.localStream)||void 0===p||null===(_=p.observer)||void 0===_||_.setPushAudio(!1),!(null!==(a=this._room)&&void 0!==a&&null!==(s=a.localStream)&&void 0!==s&&s.pubAudio||u)){e.next=16;break}return e.next=16,this._updatePublish();case 16:if(!this._localScreenAudioTrack||t!==cl.STREAM_INDEX_SCREEN){e.next=24;break}if(g=!1,this._trackSourceType.audio===el.AUDIO_SOURCE_TYPE_EXTERNAL&&(g=!0,this._removeLocalTrackEvents(this._localScreenAudioTrack),this._localScreenAudioTrack.close()),this._localScreenAudioTrack=void 0,g?null===(y=this._room)||void 0===y||null===(S=y.localScreenStream)||void 0===S||null===(b=S.observer)||void 0===b||b.setEnableAudio(!1):null===(E=this._room)||void 0===E||null===(k=E.localScreenStream)||void 0===k||null===(T=k.observer)||void 0===T||T.setPushAudio(!1),null===(f=this._room)||void 0===f||null===(m=f.localScreenStream)||void 0===m||!m.pubAudio){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=Tm(Em().mark((function e(t,r){var n,i,o,a,s,c,u,d,l,h,v,p;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(iK.print("setExternalAudioTrack()","index: %o, track: %o",t,r),YP(t,"streamIndex",[cl.STREAM_INDEX_MAIN,cl.STREAM_INDEX_SCREEN]),WP(r),t!==cl.STREAM_INDEX_MAIN){e.next=16;break}if(this._trackSourceType.audio===el.AUDIO_SOURCE_TYPE_EXTERNAL){e.next=6;break}throw new hR(dR.STREAM_TYPE_NOT_MATCH,"setAudioSourceType as external first");case 6:return e.next=8,QU(r,this._extensionManager);case 8:if(this._localAudioTrack=e.sent,this._localAudioTrack.setVolume(this._localAudioVolume),this._initLocalTrackEvents(this._localAudioTrack),u=null===(n=this._room)||void 0===n?void 0:n._roomConfig.isAutoPublish,null===(i=this._room)||void 0===i||null===(o=i.localStream)||void 0===o||null===(a=o.observer)||void 0===a||a.setPushAudio(!0),!(null!==(s=this._room)&&void 0!==s&&null!==(c=s.localStream)&&void 0!==c&&c.pubAudio||u)){e.next=16;break}return e.next=16,this._updatePublish();case 16:if(t!==cl.STREAM_INDEX_SCREEN){e.next=28;break}if(this._trackSourceType.screenAudio===el.AUDIO_SOURCE_TYPE_EXTERNAL){e.next=19;break}throw new hR(dR.STREAM_TYPE_NOT_MATCH,"setAudioSourceType as external first");case 19:return e.next=21,eV(r,this._extensionManager);case 21:if(this._localScreenAudioTrack=e.sent,this._localScreenAudioTrack.setVolume(this._localScreenAudioVolume),this._initLocalTrackEvents(this._localScreenAudioTrack),null===(d=this._room)||void 0===d||null===(l=d.localScreenStream)||void 0===l||null===(h=l.observer)||void 0===h||h.setPushAudio(!0),null===(v=this._room)||void 0===v||null===(p=v.localScreenStream)||void 0===p||!p.pubAudio){e.next=28;break}return e.next=28,this._updateScreenPublish();case 28:case"end":return e.stop()}}),e,this)}))),function(e,t){return A.apply(this,arguments)})},{key:"login",value:(I=Tm(Em().mark((function e(t,r){return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return iK.print("login()","token: %o, userInfo: %o",t,r),eM(t)||qP(t,"token"),rM(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=Tm(Em().mark((function e(){return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return iK.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=Tm(Em().mark((function e(t){return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return iK.print("updateLoginToken()","token: %o",t),eM(t)||qP(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:(E=Tm(Em().mark((function e(t){return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return iK.print("getPeerOnlineStatus()","userId: %o",t),rM(t),e.abrupt("return",this._rtmClient.getPeerOnlineStatus(t));case 3:case"end":return e.stop()}}),e,this)}))),function(e){return E.apply(this,arguments)})},{key:"sendUserMessageOutsideRoom",value:(b=Tm(Em().mark((function e(t,r){var n,i=this;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return rM(t),sM(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 b.apply(this,arguments)})},{key:"sendUserBinaryMessageOutsideRoom",value:(S=Tm(Em().mark((function e(t,r){var n,i=this;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return rM(t),JP(r,"message"),sM(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=Tm(Em().mark((function e(t,r){return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return iK.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=Tm(Em().mark((function e(t){var r,n=this;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return qP(t,"message"),sM(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=Tm(Em().mark((function e(t){var r,n=this;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return JP(t,"message"),sM(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 hR(dR.START_CLOUD_PROXY_AFTER_JOIN,"[startCloudProxy] should be invoke before join room ");iK.print("startCloudProxy()",e),qP(e.logProxy,"logProxy"),qP(e.accessProxy,"accessProxy"),qP(e.configProxy,"configProxy"),this._originIceConfigRequestUrls=jP("ICE_CONFIG_REQUEST_URLS"),this._originLogServerUrl=jP("LOG_SERVER_URL"),this._originConfigServerUrls=jP("CONFIG_REQUEST_DOMAINS"),BP("ICE_CONFIG_REQUEST_URLS",e.accessProxy),BP("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)),BP("CONFIG_REQUEST_DOMAINS",[e.configProxy]),this._useCloudProxy=!0}},{key:"stopCloudProxy",value:function(){if(this._room)throw new hR(dR.STOP_CLOUD_PROXY_BEFORE_LEAVE,"[stopCloudProxy] should be invoke after leave room ");iK.print("stopCloudProxy()"),BP("ICE_CONFIG_REQUEST_URLS",[]),BP("LOG_SERVER_URL",this._originLogServerUrl),BP("CONFIG_REQUEST_DOMAINS",this._originConfigServerUrls),this._useCloudProxy=!1,this._startCloudProxyTimestamp=void 0}},{key:"startPushPublicStream",value:(f=Tm(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(iK.print("startPushPublicStream()","publicStreamId: %o, publicStreamParam: %o",t,r),nM(t),this._assertNotInRoom(),!this._publicStreamIds.get(t)){e.next=5;break}throw new hR(dR.REPEAT_PUSH,"repeat push public media stream");case 5:return o=GP(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 f.apply(this,arguments)})},{key:"updatePublicStreamParam",value:(_=Tm(Em().mark((function e(t,r){var n,i;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return iK.print("startPushPublicStream()","publicStreamId: %o, publicStreamParam: %o",t,r),nM(t),this._assertNotInRoom(),i=GP(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 _.apply(this,arguments)})},{key:"stopPushPublicStream",value:(p=Tm(Em().mark((function e(t){var r,n=this;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return iK.print("startPushPublicStream()","publicStreamId: %o",t),nM(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:(v=Tm(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(nM(t),this._publicStreamManager){e.next=8;break}return this._publicStreamManager=new jX(this.id,this._appId,{businessId:this._businessId}),this._publicStreamManager.on(Ej.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(Ml.onPublicStreamStats,e)})),null===(n=this._publicStreamManager)||void 0===n||n.on(Ej.ON_SEI_MESSAGED_RECEIVED,(function(e){c.safeEmit(Ml.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 dG(this.id,t,{muted:(null===(s=this._config)||void 0===s?void 0:s.autoPlayPolicy)===kl.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 v.apply(this,arguments)})},{key:"stopPlayPublicStream",value:(h=Tm(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=Tm(Em().mark((function e(t){return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:iK.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;iK.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 uG(this.id,Zd(Zd({},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)!==kl.PLAY_MANUALLY&&a.playVideo(s.videoTrack,s)}else this._publicStreamVideoPlayer.delete(e)}},{key:"setDummyCaptureImagePath",value:(d=Tm(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 qf((function(e,i){qP(r,"filePath");var o=new Image;o.crossOrigin="anonymous",o.src=r,o.onload=function(){t===cl.STREAM_INDEX_MAIN?n._dummyMainImage=o:n._dummyScreenImage=o;try{n._updateDummyCaptureImage(t),e()}catch(r){i(new hR(dR.UNEXPECTED_ERROR,r.message))}},o.onerror=function(){i(new hR(dR.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===cl.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=nP(r.width),c=nP(r.height);if(!a)throw new hR(dR.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===cl.STREAM_INDEX_MAIN?(clearInterval(this._dummyMainTimer),this._dummyMainTimer=u):(clearInterval(this._dummyScreenTimer),this._dummyScreenTimer=u);var d,l,h,v,p=o.captureStream(5).getVideoTracks()[0];if(e===cl.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===(v=this._localScreenVideoTrack)||void 0===v||v.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()}))})),e.on("reset-video-effect",Tm(Em().mark((function e(){return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!t._localVideoTrack||t._localVideoTrack.dummy){e.next=6;break}return t._localVideoTrack&&t._removeLocalTrackEvents(t._localVideoTrack),e.next=4,t._localVideoTrack.generatePreProcessingTrack(t._extensionManager);case 4:return e.next=6,t._switchTrack(t._localVideoTrack);case 6:case"end":return e.stop()}}),e)}))))}},{key:"registerExtension",value:(u=Tm(Em().mark((function e(t){return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t.monitor=this.monitor,e.prev=1,e.next=4,t.isSupported();case 4:if(e.sent){e.next=7;break}throw new Error("This extension is not supported.");case 7:e.next=12;break;case 9:throw e.prev=9,e.t0=e.catch(1),new Error("This extension is not supported.");case 12:return e.next=14,t.init({videoCaptureConfig:this._videoStreamConstraints});case 14:this._extensionManager.register(t),this._addListenExtensionEvent(t);case 16:case"end":return e.stop()}}),e,this,[[1,9]])}))),function(e){return u.apply(this,arguments)})},{key:"defaultTranscoding",value:function(){return JSON.parse(Mm(eK.getDefaultValue()))}},{key:"_updatePublish",value:(c=Tm(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]:{},iK.print("_updatePublish()","config: %o",t),r={mediaType:void 0,invokeByJoinRoom:!1,pubState:Tj.PUB},t=Zd(Zd({},r),t),this._visibility){e.next=6;break}throw new hR(dR.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===Nj.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:this._videoPlayer&&this._room.localStream&&(this._room.localStream.videoDom=this._videoPlayer.domElement),e.next=25;break;case 18:if(e.prev=18,e.t0=e.catch(12),!(e.t0 instanceof hR)){e.next=24;break}throw e.t0;case 24:throw new hR(dR.UNEXPECTED_ERROR,"unexpected error",e.t0);case 25:return e.prev=25,n(),e.finish(25);case 28:case"end":return e.stop()}}),e,this,[[12,18,25,28]])}))),function(){return c.apply(this,arguments)})},{key:"startAudioPlaybackDeviceTest",value:(s=Tm(Em().mark((function e(t,r){return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return iK.print("startAudioPlaybackDeviceTest()","filePath: %o, indicationInterval: %o",t,r),qP(t,"filePath"),KP(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(){iK.print("stopAudioPlaybackDeviceTest()"),this._audioDeviceManager.stopAudioPlaybackDeviceTest()}},{key:"startAudioDeviceRecordTest",value:(a=Tm(Em().mark((function e(t,r){return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return iK.print("startAudioDeviceRecordTest()","indicationInterval: %o",t),KP(t,"indicationInterval"),e.next=4,this._audioDeviceManager.startAudioDeviceRecordTest(t,r,this._localAudioVolume);case 4:case"end":return e.stop()}}),e,this)}))),function(e,t){return a.apply(this,arguments)})},{key:"stopAudioDeviceRecordAndPlayTest",value:function(){iK.print("stopAudioDeviceRecordAndPlayTest()"),this._audioDeviceManager.stopAudioDeviceRecordAndPlayTest()}},{key:"stopAudioDevicePlayTest",value:function(){iK.print("stopAudioDevicePlayTest()"),this._audioDeviceManager.stopAudioDevicePlayTest()}},{key:"setRemoteUserPriority",value:function(e,t){var r;iK.print("setRemoteUserPriority()","userId: %o, priority: %o",e,t);try{rM(e),YP(t,"priority",[gl.HIGH,gl.MEDIUM,gl.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=Tm(Em().mark((function e(t){var r,n;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(iK.print("takeLocalSnapshot()","streamIndex: %o",t),YP(t,"streamIndex",[cl.STREAM_INDEX_MAIN,cl.STREAM_INDEX_SCREEN]),r=t===cl.STREAM_INDEX_MAIN?this.localVideoTrack:this.localScreenVideoTrack){e.next=5;break}throw new hR(dR.INVOKED_BEFORE_CAPTURE,"capture first");case 5:return n=t===cl.STREAM_INDEX_MAIN?this._videoPlayer:this._screenPlayer,e.abrupt("return",qX(r.getTrack("preprocessing"),(null==n?void 0:n.mirrorType)===hl.MIRROR_TYPE_RENDER,n));case 7:case"end":return e.stop()}}),e,this)}))),function(e){return o.apply(this,arguments)})},{key:"takeRemoteSnapshot",value:(i=Tm(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(iK.print("takeRemoteSnapshot()","id: %o, streamIndex: %o",t,r),qP(t,"id"),YP(r,"streamIndex",[cl.STREAM_INDEX_MAIN,cl.STREAM_INDEX_SCREEN]),c=(null===(n=this._room)||void 0===n||null===(i=n.remoteStreams.get(t))||void 0===i||null===(o=mE(i).call(i,(function(e){return e.isScreen===(r===cl.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 hR(dR.STREAM_NOT_EXIST,"stream not exist");case 6:return e.abrupt("return",qX(c.getTrack(),!1,r===cl.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){iK.print("setSubscribeFallbackOption()","option: %o",e);try{YP(e,"option",[ml.DISABLE,ml.VIDEO_STREAM_LOW,ml.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===cl.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 rV&&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===cl.STREAM_INDEX_MAIN)a=mE(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=mE(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:"setCaptureVolume",value:function(e,t){var r,n,i;(YP(e,"streamIndex",[cl.STREAM_INDEX_MAIN,cl.STREAM_INDEX_SCREEN]),t=hM(t,"volume",0,400),e===cl.STREAM_INDEX_SCREEN)?(null===(r=this._localScreenAudioTrack)||void 0===r||r.setVolume(t),this._localScreenAudioVolume=t):(null===(n=this._localAudioTrack)||void 0===n||n.setVolume(t),null===(i=this._audioDeviceManager.audioTrack)||void 0===i||i.setVolume(t),this._localAudioVolume=t)}},{key:"setPlaybackVolume",value:function(e,t,r){var n,i,o;if(rM(e),YP(t,"streamIndex",[cl.STREAM_INDEX_MAIN,cl.STREAM_INDEX_SCREEN]),r=hM(r,"volume",0,400),null!==(n=this._room)&&void 0!==n&&n.multiChatMode)rP("setPlaybackVolume is not supported in Conference mode");else{var a=t===cl.STREAM_INDEX_SCREEN;a?this._remoteScreenAudioVolume.set(e,r):this._remoteAudioVolume.set(e,r),null===(i=this._room)||void 0===i||null===(o=i.remoteStreams.get(e))||void 0===o||o.forEach((function(e){var t;e.isScreen===a&&(null===(t=e.audioTrack)||void 0===t||t.setVolume(r))}))}}},{key:"setPublicStreamVolume",value:function(e,t){var r,n,i;qP(e,"publicStreamId"),t=hM(t,"volume",0,400),this._publicAudioVolume.set(e,t),null===(r=this._publicStreamManager)||void 0===r||null===(n=r.remoteStreams.get(e))||void 0===n||null===(i=n.audioTrack)||void 0===i||i.setVolume(t)}},{key:"_reportMsTrackEvent",value:function(e,t){var r=this;if(!e.hookStop){e.hookStop=!0;var n=e.stop;e.stop=function(){AO(r.id,"stop",t,0,t),n.call(e)}}}},{key:"_updateScreenPublish",value:(n=Tm(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]:{},iK.print("_updateScreenPublish()"),r={mediaType:void 0,pubState:Tj.PUB},t=Zd(Zd({},r),t),e.next=6,this._pubLock.lock();case 6:if(n=e.sent,this._room&&this._room.connectionState===Nj.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:this._screenPlayer&&this._room.localScreenStream&&(this._room.localScreenStream.videoDom=this._screenPlayer.domElement),e.next=23;break;case 16:if(e.prev=16,e.t0=e.catch(10),!(e.t0 instanceof hR)){e.next=22;break}throw e.t0;case 22:throw new hR(dR.UNEXPECTED_ERROR,"unexpected error",e.t0);case 23:return e.prev=23,n(),e.finish(23);case 26:case"end":return e.stop()}}),e,this,[[10,16,23,26]])}))),function(){return n.apply(this,arguments)})},{key:"_updateAudioPlayerState",value:function(e){iK.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,s,c,u=n?null!==(a=this._remoteScreenAudioVolume.get(r))&&void 0!==a?a:100:null!==(s=this._remoteAudioVolume.get(r))&&void 0!==s?s:100;if(e.audioTrack.setVolume(u),!o){var d;o=new dG(this.id,r,{muted:(null===(d=this._config)||void 0===d?void 0:d.autoPlayPolicy)===kl.VIDEO_ONLY,isScreen:n}),this._initPlayerEvents(o,!1,n?cl.STREAM_INDEX_SCREEN:cl.STREAM_INDEX_MAIN),i.set(r,o);var l=this._audioDeviceManager.getSinkId();l&&o.setPlaybackDevice(l)}(null===(c=this._config)||void 0===c?void 0:c.autoPlayPolicy)!==kl.PLAY_MANUALLY&&o.playAudio(e.audioTrack),cP&&lP&&(t=this._remoteAudioPlayer,$X&&clearTimeout($X),$X=setTimeout((function(){var e,r=JT(t);try{for(r.s();!(e=r.n()).done;){var n=ZT(e.value,2),i=n[0],o=n[1];null!=i&&uR(i).call(i,"mux")&&o.pause()}}catch(l){r.e(l)}finally{r.f()}var a,s=JT(t);try{for(s.s();!(a=s.n()).done;){var c=ZT(a.value,2),u=c[0],d=c[1];null!=u&&uR(u).call(u,"mux")&&d.manuallyPlay()}}catch(l){s.e(l)}finally{s.f()}}),2e3))}else{var h;null===(h=o)||void 0===h||h.stop()}}},{key:"_updateVideoPlayerState",value:function(e){var t;iK.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)!==kl.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=Tm(Em().mark((function e(t){var r,n,i,o,a,s,c,u,d;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if((n=t.stream).videoDom=null===(r=this._remoteVideoPlayer.get(n.userId))||void 0===r?void 0:r.domElement,i=null==n?void 0:n.attributes,o=i.localaudio,a=i.audiostream,s=i.localvideo,c=i.videostream,u=iV.NONE,a&&(u|=ul.AUDIO),c&&(u|=ul.VIDEO),!u){e.next=12;break}return e.next=9,new qf((function(e){return setTimeout(e)}));case 9:null!=n&&n.isScreen?this.safeEmit(Ml.onUserPublishScreen,{userId:n.userId,mediaType:u}):(this.safeEmit(Ml.onUserPublishStream,{userId:n.userId,mediaType:u,videoStreamDescriptions:null==n||null===(d=n.attributes)||void 0===d?void 0:d.videoDescriptions}),this._handleAutoSubscribe(n,!0)),this.safeEmit("onAddStream",{userId:n.userId,mediaType:u,isScreen:!(null==n||!n.isScreen)}),null!=n&&n.isScreen||(o&&this.safeEmit(Ml.onUserStartAudioCapture,{userId:n.userId}),s&&this.safeEmit(Ml.onUserStartVideoCapture,{userId:n.userId}));case 12: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|=ul.AUDIO),null!==(n=this._roomConfig)&&void 0!==n&&n.isAutoSubscribeVideo&&(i|=ul.VIDEO),i){var o,a;if(t&&WO(i))null===(o=e.observer)||void 0===o||o.setAutoSubscribeAudio(!0);if(t&&QO(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=sK[e.reason])&&void 0!==t?t:dl.STREAM_REMOVE_REASON_OTHER,o=n.isScreen?Ml.onUserUnpublishScreen:Ml.onUserUnpublishStream,a=iV.NONE;n.attributes.audiostream&&(a|=ul.AUDIO),n.attributes.videostream&&(a|=ul.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){n.isScreen?(r._remoteScreenPlayer.delete(n.userId),r._remoteScreenAudioPlayer.delete(n.userId)):(r._remoteAudioPlayer.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(Ml.onUserJoined,e)}))}},{key:"_onUserLeave",value:function(e){this.safeEmit(Ml.onUserLeave,e)}},{key:"_onRoomError",value:function(e){var t;this.safeEmit(Ml.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=[Ml.onNetworkQuality]).call(e,r))}},{key:"_onConnectionStateChange",value:function(e){if(void 0!==this._startCloudProxyTimestamp&&this._useCloudProxy&&e.state===ll.CONNECTION_STATE_CONNECTED&&this.safeEmit(Ml.onCloudProxyConnected,{interval:Date.now()-this._startCloudProxyTimestamp}),this.safeEmit(Ml.onConnectionStateChanged,e),e.state===ll.CONNECTION_STATE_RECONNECTING){var t,r=JT(this._remoteAudioPlayer);try{for(r.s();!(t=r.n()).done;){var n=ZT(t.value,2),i=n[0],o=n[1];null!=i&&uR(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(Ml.onVideoDeviceStateChanged,e)}},{key:"_onAudioDeviceStateChange",value:function(e){this.safeEmit(Ml.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&ul.AUDIO&&setTimeout((function(){r._updateAudioPlayerState(s)})),i)?a===Tj.PUB?this.safeEmit(Ml.onUserPublishScreen,c):this.safeEmit(Ml.onUserUnpublishScreen,Zd(Zd({},c),{},{reason:dl.STREAM_REMOVE_REASON_UNPUBLISH})):a===Tj.PUB?(c.videoStreamDescriptions=null==s||null===(t=s.attributes)||void 0===t?void 0:t.videoDescriptions,this.safeEmit(Ml.onUserPublishStream,c),this._handleAutoSubscribe(s,!0)):this.safeEmit(Ml.onUserUnpublishStream,Zd(Zd({},c),{},{reason:dl.STREAM_REMOVE_REASON_UNPUBLISH}))}},{key:"_onCustomMessage",value:function(e){var t=e.message;e.binary?this.safeEmit(Ml.onRoomBinaryMessageReceived,{userId:e.clientId,message:t}):this.safeEmit(Ml.onRoomMessageReceived,{userId:e.clientId,message:t})}},{key:"_onUserMessageReceived",value:function(e){this._messageStatisticsObserver.recvP2PMessage(e.userId),this.safeEmit(Ml.onUserMessageReceived,e)}},{key:"_onUserBinaryMessageReceived",value:function(e){this._messageStatisticsObserver.recvP2PMessage(e.userId),this.safeEmit(Ml.onUserBinaryMessageReceived,e)}},{key:"_onLiveTranscodingResult",value:function(e){this.safeEmit(Ml.onLiveTranscodingResult,e)}},{key:"_onStreamMixingEvent",value:function(e){this.safeEmit(Ml.onStreamMixingEvent,e)}},{key:"_onUserTokenWillExpire",value:function(){this.safeEmit(Ml.onTokenWillExpire)}},{key:"_onPushPublicStreamResult",value:function(e){this.safeEmit(Ml.onPushPublicStreamResult,e)}},{key:"_handleRTMClient",value:function(e){var t=this;e.on("onUserMessageReceivedOutsideRoom",(function(e){t._messageStatisticsObserver.recvP2POutRoomMessage(e.userId),t.safeEmit(Ml.onUserMessageReceivedOutsideRoom,e)})),e.on("onUserBinaryMessageReceivedOutsideRoom",(function(e){t._messageStatisticsObserver.recvP2POutRoomMessage(e.userId),t.safeEmit(Ml.onUserBinaryMessageReceivedOutsideRoom,e)})),e.on("onUserDisconnection",(function(){t.safeEmit(Ml.onError,{errorCode:dR.RTM_DUPLICATE_LOGIN})})),e.on("onRTMTokenError",(function(){t.safeEmit(Ml.onError,{errorCode:dR.RTM_TOKEN_ERROR})})),e.on("onServerParamsSetResult",(function(e){t.safeEmit(Ml.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(Ml.onAudioPlaybackDeviceTestVolume,t)}))}},{key:"_assertNotInRoom",value:function(){if(!this._room||this._room.connectionState!==Nj.CONNECTED)throw new hR(dR.NOT_CONNECTED_YET,"server not connected")}},{key:"_checkMediaType",value:function(e){YP(e,"mediaType",[ul.AUDIO,ul.VIDEO,ul.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=Tm(Em().mark((function e(t){var r,n,i;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||null===(i=n.localStream)||void 0===i||!i.pubVideo){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,n,i=(null===(t=this._room)||void 0===t?void 0:t.hasPublished)||(null===(r=this._room)||void 0===r||null===(n=r.localStream)||void 0===n?void 0:n.pubAudio)||this._localAudioTrack&&this._localAudioTrack.sourceType===yU.INTERNAL;if(i){var o="engine.".concat(e," should be called before publishing or capturing.");console.warn("[RTC WebSDK]: "+o),AO(this.id,e,o)}return!i}},{key:"_getServerConfig",value:function(){CO({engineId:this.id,appId:this.appId,sdkVersion:jP("VERSION"),requestDomains:jP("CONFIG_REQUEST_DOMAINS"),keys:["rts_report"]}).then((function(e){e.rts_report&&vO.setConfig(e.rts_report)}))}}]),me}(fM);nK([TO()],oK.prototype,"updateToken",1),nK([TO()],oK.prototype,"setVideoCaptureDevice",1),nK([TO()],oK.prototype,"setAudioCaptureDevice",1),nK([function(e,t,r){if("function"==typeof r.value){var n=r.value;r.value=function(){for(var e,t=kO(this.id),r=arguments.length,i=new Array(r),o=0;o<r;o++)i[o]=arguments[o];return null==t||t.set({room_id:i[1],user_id:null===(e=i[2])||void 0===e?void 0:e.userId}),n.apply(this,i)}}},TO()],oK.prototype,"connect",1),nK([TO()],oK.prototype,"joinRoom",1),nK([TO()],oK.prototype,"leaveRoom",1),nK([TO()],oK.prototype,"destroy",1),nK([TO()],oK.prototype,"publishStream",1),nK([TO()],oK.prototype,"unpublishStream",1),nK([TO()],oK.prototype,"publishScreen",1),nK([TO()],oK.prototype,"unpublishScreen",1),nK([TO()],oK.prototype,"subscribeStream",1),nK([TO()],oK.prototype,"unsubscribeStream",1),nK([TO()],oK.prototype,"subscribeScreen",1),nK([TO()],oK.prototype,"unsubscribeScreen",1),nK([TO()],oK.prototype,"setRemoteVideoConfig",1),nK([TO()],oK.prototype,"startVideoCapture",1),nK([TO()],oK.prototype,"stopVideoCapture",1),nK([TO()],oK.prototype,"startAudioCapture",1),nK([TO()],oK.prototype,"stopAudioCapture",1),nK([TO()],oK.prototype,"getAudioMixingManager",1),nK([TO()],oK.prototype,"startScreenCapture",1),nK([TO()],oK.prototype,"stopScreenCapture",1),nK([TO()],oK.prototype,"setLocalVideoPlayer",1),nK([TO()],oK.prototype,"startLiveTranscoding",1),nK([TO()],oK.prototype,"updateLiveTranscoding",1),nK([TO()],oK.prototype,"stopLiveTranscoding",1),nK([TO()],oK.prototype,"startSubtitle",1),nK([TO()],oK.prototype,"stopSubtitle",1),nK([TO()],oK.prototype,"setBusinessId",1),nK([TO()],oK.prototype,"setUserVisibility",1),nK([TO()],oK.prototype,"setRemoteVideoPlayer",1),nK([TO()],oK.prototype,"setLocalVideoMirrorType",1),nK([TO()],oK.prototype,"setAudioPlaybackDevice",1),nK([TO()],oK.prototype,"play",1),nK([TO()],oK.prototype,"pauseAllSubscribedStream",1),nK([TO()],oK.prototype,"resumeAllSubscribedStream",1),nK([TO()],oK.prototype,"sendUserMessage",1),nK([TO()],oK.prototype,"sendUserBinaryMessage",1),nK([TO()],oK.prototype,"sendRoomMessage",1),nK([TO()],oK.prototype,"sendRoomBinaryMessage",1),nK([TO()],oK.prototype,"setAudioCaptureConfig",1),nK([tP("4.51"),TO()],oK.prototype,"setVideoCaptureConfig",1),nK([TO()],oK.prototype,"enableSimulcastMode",1),nK([TO()],oK.prototype,"setVideoEncoderConfig",1),nK([TO()],oK.prototype,"setScreenEncoderConfig",1),nK([TO()],oK.prototype,"sendSEIMessage",1),nK([tP("4.42"),TO()],oK.prototype,"setAudioVolumeIndicationInterval",1),nK([TO()],oK.prototype,"enableAudioPropertiesReport",1),nK([TO()],oK.prototype,"setVideoSourceType",1),nK([TO()],oK.prototype,"setExternalVideoTrack",1),nK([TO()],oK.prototype,"setAudioSourceType",1),nK([TO()],oK.prototype,"setExternalAudioTrack",1),nK([TO()],oK.prototype,"login",1),nK([TO()],oK.prototype,"logout",1),nK([TO()],oK.prototype,"updateLoginToken",1),nK([TO()],oK.prototype,"getPeerOnlineStatus",1),nK([TO()],oK.prototype,"sendUserMessageOutsideRoom",1),nK([TO()],oK.prototype,"sendUserBinaryMessageOutsideRoom",1),nK([TO()],oK.prototype,"setServerParams",1),nK([TO()],oK.prototype,"sendServerMessage",1),nK([TO()],oK.prototype,"sendServerBinaryMessage",1),nK([TO()],oK.prototype,"startCloudProxy",1),nK([TO()],oK.prototype,"stopCloudProxy",1),nK([TO()],oK.prototype,"startPushPublicStream",1),nK([TO()],oK.prototype,"updatePublicStreamParam",1),nK([TO()],oK.prototype,"stopPushPublicStream",1),nK([TO("streamId")],oK.prototype,"startPlayPublicStream",1),nK([TO("streamId")],oK.prototype,"stopPlayPublicStream",1),nK([TO()],oK.prototype,"setAudioProfile",1),nK([TO()],oK.prototype,"setPublicStreamVideoPlayer",1),nK([TO()],oK.prototype,"setDummyCaptureImagePath",1),nK([TO()],oK.prototype,"registerExtension",1),nK([TO()],oK.prototype,"startAudioPlaybackDeviceTest",1),nK([TO()],oK.prototype,"stopAudioPlaybackDeviceTest",1),nK([TO()],oK.prototype,"startAudioDeviceRecordTest",1),nK([TO()],oK.prototype,"stopAudioDeviceRecordAndPlayTest",1),nK([TO()],oK.prototype,"stopAudioDevicePlayTest",1),nK([TO()],oK.prototype,"setRemoteUserPriority",1),nK([TO()],oK.prototype,"takeLocalSnapshot",1),nK([TO()],oK.prototype,"takeRemoteSnapshot",1),nK([TO()],oK.prototype,"setSubscribeFallbackOption",1),nK([TO()],oK.prototype,"getLocalStreamTrack",1),nK([TO()],oK.prototype,"getRemoteStreamTrack",1),nK([TO()],oK.prototype,"getPublicStreamTrack",1),nK([TO()],oK.prototype,"setRemoteStreamRenderSync",1);var aK,sK={"client unpublished":dl.STREAM_REMOVE_REASON_UNPUBLISH,"publish failed":dl.STREAM_REMOVE_REASON_PUBLISH_FAILED,"stream removed":dl.STREAM_REMOVE_REASON_KEEP_LIVE_FAILED,"client disconnected":dl.STREAM_REMOVE_REASON_CLIENT_DISCONNECTED,"client republish":dl.STREAM_REMOVE_REASON_REPUBLISH},cK=new cO("VERTC",0);iO.storeKey=wm(aK="".concat(Date.now(),"-")).call(aK,NP.getDeviceId()),_O({rtc_sdk_version:FP.VERSION,device_id:NP.getDeviceId(),log_cache_key:iO.storeKey}),fO(FP.LOG_SERVER_URL);var uK=1,dK=function(e,t){cK.print("createEngine","Invoke VERTC.createEngine"),qP(e,"appId");var r=(uK++).toString();return function(e,t){var r=new Kx(e);r.set(Zd(Zd({},t),{},{engine_session_id:nC()})),r.report("sdk_init_engine",{start:Date.now(),type:"begin"}),EO.set(e,r)}(r,{rtc_app_id:e,auto_play_policy:null==t?void 0:t.autoPlayPolicy}),new oK(e,r,t)},lK=function(e){if(cK.print("destroyEngine","Invoke VERTC.destroyEngine"),!(e instanceof oK))throw new hR(dR.INVALID_ENGINE,"Invalid engine object");var t;e.destroy(),(t=e.monitor).report("sdk_init_engine",{start:Date.now(),type:"end"}),EO.delete(t.id)},hK=function(){var e=Tm(Em().mark((function e(){return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",hU.enumerateDevices());case 1:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),vK=function(){var e=Tm(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,hU.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,hU.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)}}(),pK=function(){var e=Tm(Em().mark((function e(){return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",hU.enumerateAudioCaptureDevices());case 1:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),_K=function(){var e=Tm(Em().mark((function e(){return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",hU.enumerateVideoCaptureDevices());case 1:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),fK=function(){var e=Tm(Em().mark((function e(){return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",hU.enumerateAudioPlaybackDevices());case 1:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),mK=function(){return FP.VERSION},gK=function(){return gO("isSupported",0,""),CD()},yK=function(){return gO("getSupportedCodecs",0,""),xD()},SK=function(e){var t=e.logLevel,r=e.LogfileSize;t&&(iO.logLevel=t),r&&(iO.LogfileSize=r)},bK=function(e){iO.download(e)};function EK(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return Mm(Fm(t).call(t,(function(e){return e instanceof oK?"[ENGINE]":e})))}function kK(e,t){return function(){gO(t,0,EK.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 yO(t,0,EK(e)),e})).catch((function(e){throw yO(t,e.code,e.message),e})):(yO(t,0,EK(r)),r)}}return Zd(Zd(Zd(Zd({},new(Dl((function e(){Ll(this,e),Qd(this,"getSdkVersion",kK(mK,"getSdkVersion")),Qd(this,"createEngine",kK(dK,"createEngine")),Qd(this,"destroyEngine",kK(lK,"destroyEngine")),Qd(this,"enumerateDevices",kK(hK,"enumerateDevices")),Qd(this,"enableDevices",kK(vK,"enableDevices")),Qd(this,"enumerateAudioCaptureDevices",kK(pK,"enumerateAudioCaptureDevices")),Qd(this,"enumerateVideoCaptureDevices",kK(_K,"enumerateVideoCaptureDevices")),Qd(this,"enumerateAudioPlaybackDevices",kK(fK,"enumerateAudioPlaybackDevices")),Qd(this,"getParameter",jP),Qd(this,"setParameter",BP),Qd(this,"isSupported",kK(gK,"isSupported")),Qd(this,"getSupportedCodecs",kK(yK,"getSupportedCodecs")),Qd(this,"events",Ml),Qd(this,"ErrorCode",dR),Qd(this,"platform","BytePlus"),Qd(this,"commitInfo","release_453<2c7553a*>"),Qd(this,"downloadLog",kK(bK,"downloadLog")),Qd(this,"setLogConfig",kK(SK,"setLogConfig"))})))),Cl),Pl),{},{events:Ml})}));
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:{};var 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,p=h.call,v=l&&h.bind.bind(p,p),f=l?v:function(e){return function(){return p.apply(e,arguments)}},_=f,m=_({}.toString),g=_("".slice),y=function(e){return g(m(e),8,-1)},S=y,b=f,E=function(e){if("Function"===S(e))return b(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={},C=!i((function(){return 7!=Object.defineProperty({},1,{get:function(){return 7}})[1]})),w=o,x=Function.prototype.call,O=w?x.bind(x):function(){return x.apply(x,arguments)},P={},M={}.propertyIsEnumerable,D=Object.getOwnPropertyDescriptor,N=D&&!M.call({1:2},1);P.f=N?function(e){var t=D(this,e);return!!t&&t.enumerable}:M;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=E("".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},Y=H,W=q,Q=function(e){return Y(W(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=E({}.isPrototypeOf),se=oe("navigator","userAgent")||"",ce=n,ue=se,de=ce.process,le=ce.Deno,he=de&&de.versions||le&&le.version,pe=he&&he.v8;pe&&(U=(L=pe.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 ve=U,fe=ve,_e=i,me=!!Object.getOwnPropertySymbols&&!_e((function(){var e=Symbol();return!String(e)||!(Object(e)instanceof Symbol)||!Symbol.sham&&fe&&fe<41})),ge=me&&!Symbol.sham&&"symbol"==typeof Symbol.iterator,ye=oe,Se=A,be=ae,Ee=Object,ke=ge?function(e){return"symbol"==typeof e}:function(e){var t=ye("Symbol");return Se(t)&&be(t.prototype,Ee(e))},Te=String,Ie=function(e){try{return Te(e)}catch(t){return"Object"}},Ae=A,Re=Ie,Ce=TypeError,we=function(e){if(Ae(e))return e;throw Ce(Re(e)+" is not a function")},xe=we,Oe=z,Pe=function(e,t){var r=e[t];return Oe(r)?void 0:xe(r)},Me=O,De=A,Ne=$,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,Ye=E({}.hasOwnProperty),We=Object.hasOwn||function(e,t){return Ye(qe(e),t)},Qe=E,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=We,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=O,pt=$,vt=ke,ft=Pe,_t=function(e,t){var r,n;if("string"===t&&De(r=e.toString)&&!Ne(n=Me(r,e)))return n;if(De(r=e.valueOf)&&!Ne(n=Me(r,e)))return n;if("string"!==t&&De(r=e.toString)&&!Ne(n=Me(r,e)))return n;throw Le("Can't convert object to primitive value")},mt=TypeError,gt=lt("toPrimitive"),yt=function(e,t){if(!pt(e)||vt(e))return e;var r,n=ft(e,gt);if(n){if(void 0===t&&(t="default"),r=ht(n,e,t),!pt(r)||vt(r))return r;throw mt("Can't convert object to primitive value")}return void 0===t&&(t="number"),_t(e,t)},St=ke,bt=function(e){var t=yt(e,"string");return St(t)?t:t+""},Et=$,kt=n.document,Tt=Et(kt)&&Et(kt.createElement),It=function(e){return Tt?kt.createElement(e):{}},At=It,Rt=!C&&!i((function(){return 7!=Object.defineProperty(At("div"),"a",{get:function(){return 7}}).a})),Ct=C,wt=O,xt=P,Ot=V,Pt=Q,Mt=bt,Dt=We,Nt=Rt,Lt=Object.getOwnPropertyDescriptor;R.f=Ct?Lt:function(e,t){if(e=Pt(e),t=Mt(t),Nt)try{return Lt(e,t)}catch(r){}if(Dt(e,t))return Ot(!wt(xt.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=we,qt=o,Yt=E(E.bind),Wt=function(e,t){return Xt(e),void 0===t?e:qt?Yt(e,t):function(){return e.apply(t,arguments)}},Qt={},Jt=C&&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=C,nr=Rt,ir=Jt,or=tr,ar=bt,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 pr=Qt,vr=V,fr=C?function(e,t,r){return pr.f(e,t,vr(1,r))}:function(e,t,r){return e[t]=r,e},_r=n,mr=d,gr=E,yr=A,Sr=R.f,br=Kt,Er=ee,kr=Wt,Tr=fr,Ir=We,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,p=e.proto,v=l?_r:h?_r[d]:(_r[d]||{}).prototype,f=l?Er:Er[d]||Tr(Er,d,{})[d],_=f.prototype;for(i in t)r=!br(l?i:d+(h?".":"#")+i,e.forced)&&v&&Ir(v,i),a=f[i],r&&(s=e.dontCallGetSet?(u=Sr(v,i))&&u.value:v[i]),o=r&&s?s:t[i],r&&typeof a==typeof o||(c=e.bind&&r?kr(o,_r):e.wrap&&r?Ar(o):p&&yr(o)?gr(o):o,(e.sham||o&&o.sham||a&&a.sham)&&Tr(c,"sham",!0),Tr(f,i,c),p&&(Ir(Er,n=d+"Prototype")||Tr(Er,n,{}),Tr(Er[n],i,o),e.real&&_&&!_[i]&&Tr(_,i,o)))},Cr=Math.ceil,wr=Math.floor,xr=Math.trunc||function(e){var t=+e;return(t>0?wr:Cr)(t)},Or=function(e){var t=+e;return t!=t||0===t?0:xr(t)},Pr=Or,Mr=Math.max,Dr=Math.min,Nr=function(e,t){var r=Pr(e);return r<0?Mr(r+t,0):Dr(r,t)},Lr=Or,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=Nr,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=We,Yr=Q,Wr=Kr.indexOf,Qr=Xr,Jr=E([].push),Zr=function(e,t){var r,n=Yr(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++])&&(~Wr(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"),pn=Object,vn="Arguments"==ln(function(){return arguments}()),fn=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=pn(e),hn))?r:vn?ln(t):"Object"==(n=ln(t))&&dn(t.callee)?"Arguments":n},_n=fn,mn=String,gn=function(e){if("Symbol"===_n(e))throw TypeError("Cannot convert a Symbol value to a string");return mn(e)},yn={},Sn=C,bn=Jt,En=Qt,kn=tr,Tn=Q,In=rn;yn.f=Sn&&!bn?Object.defineProperties:function(e,t){kn(e);for(var r,n=Tn(t),i=In(t),o=i.length,a=0;o>a;)En.f(e,r=i[a++],n[r]);return e};var An,Rn=oe("document","documentElement"),Cn=Ue.exports,wn=et,xn=Cn("keys"),On=function(e){return xn[e]||(xn[e]=wn(e))},Pn=tr,Mn=yn,Dn=$r,Nn=Xr,Ln=Rn,Un=It,Vn=On("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=Dn.length;r--;)delete Gn.prototype[Dn[r]];return Gn()};Nn[Vn]=!0;var Hn=Object.create||function(e,t){var r;return null!==e?(Fn.prototype=Pn(e),r=new Fn,Fn.prototype=null,r[Vn]=e):r=Gn(),void 0===t?r:Mn.f(r,t)},zn={},Kn=Zr,Xn=$r.concat("length","prototype");zn.f=Object.getOwnPropertyNames||function(e){return Kn(e,Xn)};var qn={},Yn=bt,Wn=Qt,Qn=V,Jn=function(e,t,r){var n=Yn(t);n in e?Wn.f(e,n,Qn(0,r)):e[n]=r},Zn=Nr,$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=fr,li=function(e,t,r,n){return n&&n.enumerable?e[t]=r:di(e,t,r),e},hi={},pi=lt;hi.f=pi;var vi,fi,_i,mi=ee,gi=We,yi=hi,Si=Qt.f,bi=function(e){var t=mi.Symbol||(mi.Symbol={});gi(t,e)||Si(t,e,{value:yi.f(e)})},Ei=O,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 Ei(r,this)}),{arity:1})},Ri=fn,Ci=cn?{}.toString:function(){return"[object "+Ri(this)+"]"},wi=cn,xi=Qt.f,Oi=fr,Pi=We,Mi=Ci,Di=lt("toStringTag"),Ni=function(e,t,r,n){if(e){var i=r?e:e.prototype;Pi(i,Di)||xi(i,Di,{configurable:!0,value:t}),n&&!wi&&Oi(i,"toString",Mi)}},Li=A,Ui=n.WeakMap,Vi=Li(Ui)&&/native code/.test(String(Ui)),Fi=Vi,Bi=n,ji=$,Gi=fr,Hi=We,zi=Ge,Ki=On,Xi=Xr,qi="Object already initialized",Yi=Bi.TypeError,Wi=Bi.WeakMap;if(Fi||zi.state){var Qi=zi.state||(zi.state=new Wi);Qi.get=Qi.get,Qi.has=Qi.has,Qi.set=Qi.set,vi=function(e,t){if(Qi.has(e))throw Yi(qi);return t.facade=e,Qi.set(e,t),t},fi=function(e){return Qi.get(e)||{}},_i=function(e){return Qi.has(e)}}else{var Ji=Ki("state");Xi[Ji]=!0,vi=function(e,t){if(Hi(e,Ji))throw Yi(qi);return t.facade=e,Gi(e,Ji,t),t},fi=function(e){return Hi(e,Ji)?e[Ji]:{}},_i=function(e){return Hi(e,Ji)}}var Zi={set:vi,get:fi,has:_i,enforce:function(e){return _i(e)?fi(e):vi(e,{})},getterFor:function(e){return function(t){var r;if(!ji(t)||(r=fi(t)).type!==e)throw Yi("Incompatible receiver, "+e+" required");return r}}},$i=y,eo=Array.isArray||function(e){return"Array"==$i(e)},to=A,ro=Ge,no=E(Function.toString);to(ro.inspectSource)||(ro.inspectSource=function(e){return no(e)});var io=ro.inspectSource,oo=E,ao=i,so=A,co=fn,uo=io,lo=function(){},ho=[],po=oe("Reflect","construct"),vo=/^\s*(?:class|function)\b/,fo=oo(vo.exec),_o=!vo.exec(lo),mo=function(e){if(!so(e))return!1;try{return po(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||!!fo(vo,uo(e))}catch(t){return!0}};go.sham=!0;var yo=!po||ao((function(){var e;return mo(mo.call)||!mo(Object)||!mo((function(){e=!0}))||e}))?go:mo,So=eo,bo=yo,Eo=$,ko=lt("species"),To=Array,Io=function(e){var t;return So(e)&&(t=e.constructor,(bo(t)&&(t===To||So(t.prototype))||Eo(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=Wt,Co=H,wo=Xe,xo=Br,Oo=Ao,Po=E([].push),Mo=function(e){var t=1==e,r=2==e,n=3==e,i=4==e,o=6==e,a=7==e,s=5==e||o;return function(c,u,d,l){for(var h,p,v=wo(c),f=Co(v),_=Ro(u,d),m=xo(f),g=0,y=l||Oo,S=t?y(c,m):r||a?y(c,0):void 0;m>g;g++)if((s||g in f)&&(p=_(h=f[g],g,v),e))if(t)S[g]=p;else if(p)switch(e){case 3:return!0;case 5:return h;case 6:return g;case 2:Po(S,h)}else switch(e){case 4:return!1;case 7:Po(S,h)}return o?-1:n||i?i:S}},Do={forEach:Mo(0),map:Mo(1),filter:Mo(2),some:Mo(3),every:Mo(4),find:Mo(5),findIndex:Mo(6),filterReject:Mo(7)},No=Rr,Lo=n,Uo=O,Vo=E,Fo=C,Bo=me,jo=i,Go=We,Ho=ae,zo=tr,Ko=Q,Xo=bt,qo=gn,Yo=V,Wo=Hn,Qo=rn,Jo=zn,Zo=qn,$o=ui,ea=R,ta=Qt,ra=yn,na=P,ia=li,oa=Ue.exports,aa=Xr,sa=et,ca=lt,ua=hi,da=bi,la=Ai,ha=Ni,pa=Zi,va=Do.forEach,fa=On("hidden"),_a="Symbol",ma=pa.set,ga=pa.getterFor(_a),ya=Object.prototype,Sa=Lo.Symbol,ba=Sa&&Sa.prototype,Ea=Lo.TypeError,ka=Lo.QObject,Ta=ea.f,Ia=ta.f,Aa=Zo.f,Ra=na.f,Ca=Vo([].push),wa=oa("symbols"),xa=oa("op-symbols"),Oa=oa("wks"),Pa=!ka||!ka.prototype||!ka.prototype.findChild,Ma=Fo&&jo((function(){return 7!=Wo(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,Da=function(e,t){var r=wa[e]=Wo(ba);return ma(r,{type:_a,tag:e,description:t}),Fo||(r.description=t),r},Na=function(e,t,r){e===ya&&Na(xa,t,r),zo(e);var n=Xo(t);return zo(r),Go(wa,n)?(r.enumerable?(Go(e,fa)&&e[fa][n]&&(e[fa][n]=!1),r=Wo(r,{enumerable:Yo(0,!1)})):(Go(e,fa)||Ia(e,fa,Yo(1,{})),e[fa][n]=!0),Ma(e,n,r)):Ia(e,n,r)},La=function(e,t){zo(e);var r=Ko(t),n=Qo(r).concat(Ba(r));return va(n,(function(t){Fo&&!Uo(Ua,r,t)||Na(e,t,r[t])})),e},Ua=function(e){var t=Xo(e),r=Uo(Ra,this,t);return!(this===ya&&Go(wa,t)&&!Go(xa,t))&&(!(r||!Go(this,t)||!Go(wa,t)||Go(this,fa)&&this[fa][t])||r)},Va=function(e,t){var r=Ko(e),n=Xo(t);if(r!==ya||!Go(wa,n)||Go(xa,n)){var i=Ta(r,n);return!i||!Go(wa,n)||Go(r,fa)&&r[fa][n]||(i.enumerable=!0),i}},Fa=function(e){var t=Aa(Ko(e)),r=[];return va(t,(function(e){Go(wa,e)||Go(aa,e)||Ca(r,e)})),r},Ba=function(e){var t=e===ya,r=Aa(t?xa:Ko(e)),n=[];return va(r,(function(e){!Go(wa,e)||t&&!Go(ya,e)||Ca(n,wa[e])})),n};Bo||(Sa=function(){if(Ho(ba,this))throw Ea("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,xa,e),Go(this,fa)&&Go(this[fa],t)&&(this[fa][t]=!1),Ma(this,t,Yo(1,e))};return Fo&&Pa&&Ma(ya,t,{configurable:!0,set:r}),Da(t,e)},ia(ba=Sa.prototype,"toString",(function(){return ga(this).tag})),ia(Sa,"withoutSetter",(function(e){return Da(sa(e),e)})),na.f=Ua,ta.f=Na,ra.f=La,ea.f=Va,Jo.f=Zo.f=Fa,$o.f=Ba,ua.f=function(e){return Da(ca(e),e)},Fo&&Ia(ba,"description",{configurable:!0,get:function(){return ga(this).description}})),No({global:!0,constructor:!0,wrap:!0,forced:!Bo,sham:!Bo},{Symbol:Sa}),va(Qo(Oa),(function(e){da(e)})),No({target:_a,stat:!0,forced:!Bo},{useSetter:function(){Pa=!0},useSimple:function(){Pa=!1}}),No({target:"Object",stat:!0,forced:!Bo,sham:!Fo},{create:function(e,t){return void 0===t?Wo(e):La(Wo(e),t)},defineProperty:Na,defineProperties:La,getOwnPropertyDescriptor:Va}),No({target:"Object",stat:!0,forced:!Bo},{getOwnPropertyNames:Fa}),la(),ha(Sa,_a),aa[fa]=!0;var ja=me&&!!Symbol.for&&!!Symbol.keyFor,Ga=Rr,Ha=oe,za=We,Ka=gn,Xa=Ue.exports,qa=ja,Ya=Xa("string-to-symbol-registry"),Wa=Xa("symbol-to-string-registry");Ga({target:"Symbol",stat:!0,forced:!qa},{for:function(e){var t=Ka(e);if(za(Ya,t))return Ya[t];var r=Ha("Symbol")(t);return Ya[t]=r,Wa[r]=t,r}});var Qa=Rr,Ja=We,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=E([].slice),ns=Rr,is=oe,os=d,as=O,ss=E,cs=i,us=eo,ds=A,ls=$,hs=ke,ps=rs,vs=me,fs=is("JSON","stringify"),_s=ss(/./.exec),ms=ss("".charAt),gs=ss("".charCodeAt),ys=ss("".replace),Ss=ss(1..toString),bs=/[\uD800-\uDFFF]/g,Es=/^[\uD800-\uDBFF]$/,ks=/^[\uDC00-\uDFFF]$/,Ts=!vs||cs((function(){var e=is("Symbol")();return"[null]"!=fs([e])||"{}"!=fs({a:e})||"{}"!=fs(Object(e))})),Is=cs((function(){return'"\\udf06\\ud834"'!==fs("\udf06\ud834")||'"\\udead"'!==fs("\udead")})),As=function(e,t){var r=ps(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(fs,null,r)},Rs=function(e,t,r){var n=ms(r,t-1),i=ms(r,t+1);return _s(Es,e)&&!_s(ks,i)||_s(ks,e)&&!_s(Es,n)?"\\u"+Ss(gs(e,0),16):e};fs&&ns({target:"JSON",stat:!0,arity:3,forced:Ts||Is},{stringify:function(e,t,r){var n=ps(arguments),i=os(Ts?As:fs,null,n);return Is&&"string"==typeof i?ys(i,bs,Rs):i}});var Cs=ui,ws=Xe;Rr({target:"Object",stat:!0,forced:!me||i((function(){Cs.f(1)}))},{getOwnPropertySymbols:function(e){var t=Cs.f;return t?t(ws(e)):[]}});var xs=ee.Object.getOwnPropertySymbols,Os=i,Ps=ve,Ms=lt("species"),Ds=function(e){return Ps>=51||!Os((function(){var t=[];return(t.constructor={})[Ms]=function(){return{foo:1}},1!==t[e](Boolean).foo}))},Ns=Do.filter;Rr({target:"Array",proto:!0,forced:!Ds("filter")},{filter:function(e){return Ns(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,Ys=C,Ws=Ks((function(){qs(1)}));zs({target:"Object",stat:!0,forced:!Ys||Ws,sham:!Ys},{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=C,ic=We,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=We,lc=A,hc=Xe,pc=uc,vc=On("IE_PROTO"),fc=Object,_c=fc.prototype,mc=pc?fc.getPrototypeOf:function(e){var t=hc(e);if(dc(t,vc))return t[vc];var r=t.constructor;return lc(r)&&t instanceof r?r.prototype:t instanceof fc?_c:null},gc=i,yc=A,Sc=$,bc=Hn,Ec=mc,kc=li,Tc=lt("iterator"),Ic=!1;[].keys&&("next"in(ec=[].keys())?($s=Ec(Ec(ec)))!==Object.prototype&&(Zs=$s):Ic=!0);var Ac=!Sc(Zs)||gc((function(){var e={};return Zs[Tc].call(e)!==e}));yc((Zs=Ac?{}:bc(Zs))[Tc])||kc(Zs,Tc,(function(){return this}));var Rc={IteratorPrototype:Zs,BUGGY_SAFARI_ITERATORS:Ic},Cc=Rc.IteratorPrototype,wc=Hn,xc=V,Oc=Ni,Pc=rc,Mc=function(){return this},Dc=function(e,t,r,n){var i=t+" Iterator";return e.prototype=wc(Cc,{next:xc(+!n,r)}),Oc(e,i,!1,!0),Pc[i]=Mc,e},Nc=A,Lc=String,Uc=TypeError,Vc=E,Fc=tr,Bc=function(e){if("object"==typeof e||Nc(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=O,zc=cc,Kc=Dc,Xc=mc,qc=Ni,Yc=li,Wc=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&&f)return f;if(!Zc&&e in p)return p[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,p=e.prototype,v=p[$c]||p["@@iterator"]||i&&p[i],f=!Zc&&v||d(i),_="Array"==t&&p.entries||v;if(_&&(s=Xc(_.call(new e)))!==Object.prototype&&s.next&&(qc(s,l,!0,!0),Wc[l]=nu),Jc&&i==tu&&v&&v.name!==tu&&(h=!0,f=function(){return Hc(v,this)}),i)if(c={values:d(tu),keys:o?f:d(eu),entries:d(ru)},a)for(u in c)(Zc||h||!(u in p))&&Yc(p,u,c[u]);else Gc({target:t,proto:!0,forced:Zc||h},c);return a&&p[$c]!==f&&Yc(p,$c,f,{name:i}),Wc[t]=f,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",pu=uu.set,vu=uu.getterFor(hu);du(Array,"Array",(function(e,t){pu(this,{type:hu,target:au(e),index:0,kind:t})}),(function(){var e=vu(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 fu={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=fn,gu=fr,yu=rc,Su=lt("toStringTag");for(var bu in fu){var Eu=_u[bu],ku=Eu&&Eu.prototype;ku&&mu(ku)!==Su&&gu(ku,Su,bu),yu[bu]=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=Do.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 Cu=Us("Array").forEach,wu=fn,xu=We,Ou=ae,Pu=Cu,Mu=Array.prototype,Du={DOMTokenList:!0,NodeList:!0},Nu=function(e){var t=e.forEach;return e===Mu||Ou(Mu,e)&&t===Mu.forEach||xu(Du,wu(e))?Pu:t},Lu=oe,Uu=zn,Vu=ui,Fu=tr,Bu=E([].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:!C},{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:{}},Yu=Rr,Wu=C,Qu=yn.f;Yu({target:"Object",stat:!0,forced:Object.defineProperties!==Qu,sham:!Wu},{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=C,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,sd=TypeError,cd=function(e){if(e>9007199254740991)throw sd("Maximum allowed index exceeded");return e},ud=Rr,dd=i,ld=eo,hd=$,pd=Xe,vd=Br,fd=cd,_d=Jn,md=Ao,gd=Ds,yd=ve,Sd=lt("isConcatSpreadable"),bd=yd>=51||!dd((function(){var e=[];return e[Sd]=!1,e.concat()[0]!==e})),Ed=gd("concat"),kd=function(e){if(!hd(e))return!1;var t=e[Sd];return void 0!==t?!!t:ld(e)};ud({target:"Array",proto:!0,arity:1,forced:!bd||!Ed},{concat:function(e){var t,r,n,i,o,a=pd(this),s=md(a,0),c=0;for(t=-1,n=arguments.length;t<n;t++)if(kd(o=-1===t?a:arguments[t]))for(i=vd(o),fd(c+i),r=0;r<i;r++,c++)r in o&&_d(s,c,o[r]);else fd(c+1),_d(s,c++,o);return s.length=c,s}}),bi("asyncIterator"),bi("hasInstance"),bi("isConcatSpreadable"),bi("iterator"),bi("match"),bi("matchAll"),bi("replace"),bi("search"),bi("species"),bi("split");var Td=Ai;bi("toPrimitive"),Td();var Id=oe,Ad=Ni;bi("toStringTag"),Ad(Id("Symbol"),"Symbol"),bi("unscopables"),Ni(n.JSON,"JSON",!0);var Rd=ee.Symbol;bi("asyncDispose"),bi("dispose"),bi("matcher"),bi("metadataKey"),bi("observable"),bi("metadata"),bi("patternMatch"),bi("replaceAll");var Cd=Rd,wd=E,xd=Or,Od=gn,Pd=q,Md=wd("".charAt),Dd=wd("".charCodeAt),Nd=wd("".slice),Ld=function(e){return function(t,r){var n,i,o=Od(Pd(t)),a=xd(r),s=o.length;return a<0||a>=s?e?"":void 0:(n=Dd(o,a))<55296||n>56319||a+1===s||(i=Dd(o,a+1))<56320||i>57343?e?Md(o,a):n:e?Nd(o,a,a+2):i-56320+(n-55296<<10)+65536}},Ud={codeAt:Ld(!1),charAt:Ld(!0)},Vd=Ud.charAt,Fd=gn,Bd=Zi,jd=iu,Gd=ou,Hd="String Iterator",zd=Bd.set,Kd=Bd.getterFor(Hd);jd(String,"String",(function(e){zd(this,{type:Hd,string:Fd(e),index:0})}),(function(){var e,t=Kd(this),r=t.string,n=t.index;return n>=r.length?Gd(void 0,!0):(e=Vd(r,n),t.index+=e.length,Gd(e,!1))}));var Xd=hi.f("iterator");function qd(e){return(qd="function"==typeof Cd&&"symbol"==typeof Xd?function(e){return typeof e}:function(e){return e&&"function"==typeof Cd&&e.constructor===Cd&&e!==Cd.prototype?"symbol":typeof e})(e)}var Yd=hi.f("toPrimitive");function Wd(e){var t=function(e,t){if("object"!==qd(e)||null===e)return e;var r=e[Yd];if(void 0!==r){var n=r.call(e,t||"default");if("object"!==qd(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===qd(t)?t:String(t)}function Qd(e,t,r){return(t=Wd(t))in e?ad(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Jd(e,t){var r=an(e);if(xs){var n=xs(e);t&&(n=Gs(n).call(n,(function(t){return tc(e,t).enumerable}))),r.push.apply(r,n)}return r}function Zd(e){for(var t=1;t<arguments.length;t++){var r,n,i=null!=arguments[t]?arguments[t]:{};t%2?Nu(r=Jd(Object(i),!0)).call(r,(function(t){Qd(e,t,i[t])})):Xu?$u(e,Xu(i)):Nu(n=Jd(Object(i))).call(n,(function(t){ad(e,t,tc(i,t))}))}return e}var $d=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}($d||{}),el=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}(el||{}),tl=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}(tl||{}),rl=function(e){return e[e.CHANNEL_PROFILE_COMMUNICATION=0]="CHANNEL_PROFILE_COMMUNICATION",e[e.CHANNEL_PROFILE_LIVE_BROADCASTING=1]="CHANNEL_PROFILE_LIVE_BROADCASTING",e}(rl||{}),nl=function(e){return e[e.AUTO_SUBSCRIBE_MODE=0]="AUTO_SUBSCRIBE_MODE",e[e.MANUAL_SUBSCRIBE_MODE=1]="MANUAL_SUBSCRIBE_MODE",e}(nl||{}),il=function(e){return e[e.SUBSCRIBE_SUCC=0]="SUBSCRIBE_SUCC",e[e.SUBSCRIBE_FAIL=1]="SUBSCRIBE_FAIL",e}(il||{}),ol=function(e){return e[e.PUBLISH_SUCC=0]="PUBLISH_SUCC",e[e.PUBLISH_FAIL=1]="PUBLISH_FAIL",e}(ol||{}),al=function(e){return e[e.MIRROR_MODE_OFF=0]="MIRROR_MODE_OFF",e[e.MIRROR_MODE_ON=1]="MIRROR_MODE_ON",e}(al||{}),sl=function(e){return e[e.RENDER_MODE_HIDDEN=0]="RENDER_MODE_HIDDEN",e[e.RENDER_MODE_FIT=1]="RENDER_MODE_FIT",e[e.RENDER_MODE_FILL=2]="RENDER_MODE_FILL",e}(sl||{}),cl=function(e){return e[e.STREAM_INDEX_MAIN=0]="STREAM_INDEX_MAIN",e[e.STREAM_INDEX_SCREEN=1]="STREAM_INDEX_SCREEN",e}(cl||{}),ul=function(e){return e[e.AUDIO=1]="AUDIO",e[e.VIDEO=2]="VIDEO",e[e.AUDIO_AND_VIDEO=3]="AUDIO_AND_VIDEO",e}(ul||{}),dl=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}(dl||{}),ll=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}(ll||{}),hl=function(e){return e[e.MIRROR_TYPE_NONE=0]="MIRROR_TYPE_NONE",e[e.MIRROR_TYPE_RENDER=1]="MIRROR_TYPE_RENDER",e}(hl||{}),pl=function(e){return e[e.domestic=0]="domestic",e[e.overseas=1]="overseas",e}(pl||{}),vl=function(e){return e[e.OFFLINE=0]="OFFLINE",e[e.ONLINE=1]="ONLINE",e[e.UNREACHABLE=2]="UNREACHABLE",e}(vl||{}),fl=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}(fl||{}),_l=function(e){return e[e.PREV_FRAME=0]="PREV_FRAME",e[e.OTHER_FRAME=1]="OTHER_FRAME",e}(_l||{}),ml=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}(ml||{}),gl=function(e){return e[e.LOW=0]="LOW",e[e.MEDIUM=100]="MEDIUM",e[e.HIGH=200]="HIGH",e}(gl||{}),yl=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}(yl||{}),Sl=function(e){return e[e.Unknown=-1]="Unknown",e[e.SubscribeFallbackByBandwidth=0]="SubscribeFallbackByBandwidth",e[e.SubscribeRecoverByBandwidth=2]="SubscribeRecoverByBandwidth",e}(Sl||{}),bl=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}(bl||{}),El=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}(El||{}),kl=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}(kl||{}),Tl=function(e){return e.LC="LC",e.HEv1="HEv1",e.HEv2="HEv2",e}(Tl||{}),Il=function(e){return e.H264="H264",e.H265="H265",e}(Il||{}),Al=function(e){return e[e.ASR_ONLY=0]="ASR_ONLY",e[e.ASR_AND_TRANSLATION=1]="ASR_AND_TRANSLATION",e}(Al||{}),Rl=function(e){return e[e.STARTED=0]="STARTED",e[e.STOPPED=1]="STOPPED",e[e.ERROR=2]="ERROR",e}(Rl||{}),Cl=Object.freeze(Object.defineProperty({__proto__:null,VideoSourceType:$d,AudioSourceType:el,UserOfflineReason:tl,ChannelProfile:rl,SubscribeMode:nl,SubscribeState:il,PublishState:ol,MirrorMode:al,VideoRenderMode:sl,StreamIndex:cl,MediaType:ul,StreamRemoveReason:dl,ConnectionState:ll,MirrorType:hl,LogChannel:pl,USER_ONLINE_STATUS:vl,PublicStreamType:fl,PublicInterpolationMode:_l,SubscribeFallbackOption:ml,RemoteUserPriority:gl,NetworkQuality:yl,FallbackOrRecoverReason:Sl,RoomProfileType:bl,AudioProfileType:El,RTCAutoPlayPolicy:kl,AAC_PROFILE:Tl,TRANSCODING_VIDEO_CODEC:Il,SUBTITLE_MODE:Al,SubtitleEventType:Rl},Symbol.toStringTag,{value:"Module"})),wl=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}(wl||{}),xl=function(e){return e[e.PLAYOUT=0]="PLAYOUT",e[e.PUBLISH=1]="PUBLISH",e[e.PLAYOUT_AND_PUBLISH=2]="PLAYOUT_AND_PUBLISH",e}(xl||{}),Ol=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}(Ol||{}),Pl=Object.freeze(Object.defineProperty({__proto__:null,AudioMixingDualMonoMode:wl,AudioMixingType:xl,AudioMixingState:Ol},Symbol.toStringTag,{value:"Module"})),Ml=function(e){return e.onTrackEnded="onTrackEnded",e.onTrackMute="onTrackMute",e.onTrackUnmute="onTrackUnmute",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.onVendorConnectionStateChanged="onVendorConnectionStateChanged",e}(Ml||{});function Dl(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,Wd(n.key),n)}}function Nl(e,t,r){return t&&Dl(e.prototype,t),r&&Dl(e,r),ad(e,"prototype",{writable:!1}),e}function Ll(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Rr({target:"Object",stat:!0,sham:!C},{create:Hn});var Ul=ee.Object,Vl=function(e,t){return Ul.create(e,t)},Fl=Xe,Bl=mc,jl=uc;Rr({target:"Object",stat:!0,forced:i((function(){Bl(1)})),sham:!jl},{getPrototypeOf:function(e){return Bl(Fl(e))}});var Gl=ee.Object.getPrototypeOf;Rr({target:"Object",stat:!0},{setPrototypeOf:jc});var Hl=ee.Object.setPrototypeOf,zl=We,Kl=ju,Xl=R,ql=Qt,Yl=Error,Wl=E("".replace),Ql=String(Yl("zxcasd").stack),Jl=/\n\s*at [^:]*:[^\n]*/,Zl=Jl.test(Ql),$l=$,eh=fr,th=rc,rh=lt("iterator"),nh=Array.prototype,ih=function(e){return void 0!==e&&(th.Array===e||nh[rh]===e)},oh=fn,ah=Pe,sh=z,ch=rc,uh=lt("iterator"),dh=function(e){if(!sh(e))return ah(e,uh)||ah(e,"@@iterator")||ch[oh(e)]},lh=O,hh=we,ph=tr,vh=Ie,fh=dh,_h=TypeError,mh=function(e,t){var r=arguments.length<2?fh(e):t;if(hh(r))return ph(lh(r,e));throw _h(vh(e)+" is not iterable")},gh=O,yh=tr,Sh=Pe,bh=function(e,t,r){var n,i;yh(e);try{if(!(n=Sh(e,"return"))){if("throw"===t)throw r;return r}n=gh(n,e)}catch(o){i=!0,n=o}if("throw"===t)throw r;if(i)throw n;return yh(n),r},Eh=Wt,kh=O,Th=tr,Ih=Ie,Ah=ih,Rh=Br,Ch=ae,wh=mh,xh=dh,Oh=bh,Ph=TypeError,Mh=function(e,t){this.stopped=e,this.result=t},Dh=Mh.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),p=!(!r||!r.IS_ITERATOR),v=!(!r||!r.INTERRUPTED),f=Eh(t,d),_=function(e){return n&&Oh(n,"normal",e),new Mh(!0,e)},m=function(e){return l?(Th(e),v?f(e[0],e[1],_):f(e[0],e[1])):v?f(e,_):f(e)};if(h)n=e.iterator;else if(p)n=e;else{if(!(i=xh(e)))throw Ph(Ih(e)+" is not iterable");if(Ah(i)){for(o=0,a=Rh(e);a>o;o++)if((s=m(e[o]))&&Ch(Dh,s))return s;return new Mh(!1)}n=wh(e,i)}for(c=h?e.next:n.next;!(u=kh(c,n)).done;){try{s=m(u.value)}catch(g){Oh(n,"throw",g)}if("object"==typeof s&&s&&Ch(Dh,s))return s}return new Mh(!1)},Lh=gn,Uh=V,Vh=!i((function(){var e=Error("a");return!("stack"in e)||(Object.defineProperty(e,"stack",Uh(1,7)),7!==e.stack)})),Fh=Rr,Bh=ae,jh=mc,Gh=jc,Hh=function(e,t,r){for(var n=Kl(t),i=ql.f,o=Xl.f,a=0;a<n.length;a++){var s=n[a];zl(e,s)||r&&zl(r,s)||i(e,s,o(t,s))}},zh=Hn,Kh=fr,Xh=V,qh=function(e,t){if(Zl&&"string"==typeof e&&!Yl.prepareStackTrace)for(;t--;)e=Wl(e,Jl,"");return e},Yh=function(e,t){$l(t)&&"cause"in t&&eh(e,"cause",t.cause)},Wh=Nh,Qh=function(e,t){return void 0===e?arguments.length<2?"":t:Lh(e)},Jh=Vh,Zh=lt("toStringTag"),$h=Error,ep=[].push,tp=function(e,t){var r,n=arguments.length>2?arguments[2]:void 0,i=Bh(rp,this);Gh?r=Gh($h(),i?jh(this):rp):(r=i?this:zh(rp),Kh(r,Zh,"Error")),void 0!==t&&Kh(r,"message",Qh(t)),Jh&&Kh(r,"stack",qh(r.stack,1)),Yh(r,n);var o=[];return Wh(e,ep,{that:o}),Kh(r,"errors",o),r};Gh?Gh(tp,$h):Hh(tp,$h,{name:!0});var rp=tp.prototype=zh($h.prototype,{constructor:Xh(1,tp),message:Xh(1,""),name:Xh(1,"AggregateError")});Fh({global:!0,constructor:!0,arity:2},{AggregateError:tp});var np,ip,op,ap,sp="process"==y(n.process),cp=oe,up=Qt,dp=C,lp=lt("species"),hp=function(e){var t=cp(e),r=up.f;dp&&t&&!t[lp]&&r(t,lp,{configurable:!0,get:function(){return this}})},pp=ae,vp=TypeError,fp=function(e,t){if(pp(t,e))return e;throw vp("Incorrect invocation")},_p=yo,mp=Ie,gp=TypeError,yp=function(e){if(_p(e))return e;throw gp(mp(e)+" is not a constructor")},Sp=tr,bp=yp,Ep=z,kp=lt("species"),Tp=function(e,t){var r,n=Sp(e).constructor;return void 0===n||Ep(r=Sp(n)[kp])?t:bp(r)},Ip=TypeError,Ap=function(e,t){if(e<t)throw Ip("Not enough arguments");return e},Rp=/(?:ipad|iphone|ipod).*applewebkit/i.test(se),Cp=n,wp=d,xp=Wt,Op=A,Pp=We,Mp=i,Dp=Rn,Np=rs,Lp=It,Up=Ap,Vp=Rp,Fp=sp,Bp=Cp.setImmediate,jp=Cp.clearImmediate,Gp=Cp.process,Hp=Cp.Dispatch,zp=Cp.Function,Kp=Cp.MessageChannel,Xp=Cp.String,qp=0,Yp={},Wp="onreadystatechange";try{np=Cp.location}catch(sq){}var Qp=function(e){if(Pp(Yp,e)){var t=Yp[e];delete Yp[e],t()}},Jp=function(e){return function(){Qp(e)}},Zp=function(e){Qp(e.data)},$p=function(e){Cp.postMessage(Xp(e),np.protocol+"//"+np.host)};Bp&&jp||(Bp=function(e){Up(arguments.length,1);var t=Op(e)?e:zp(e),r=Np(arguments,1);return Yp[++qp]=function(){wp(t,void 0,r)},ip(qp),qp},jp=function(e){delete Yp[e]},Fp?ip=function(e){Gp.nextTick(Jp(e))}:Hp&&Hp.now?ip=function(e){Hp.now(Jp(e))}:Kp&&!Vp?(ap=(op=new Kp).port2,op.port1.onmessage=Zp,ip=xp(ap.postMessage,ap)):Cp.addEventListener&&Op(Cp.postMessage)&&!Cp.importScripts&&np&&"file:"!==np.protocol&&!Mp($p)?(ip=$p,Cp.addEventListener("message",Zp,!1)):ip=Wp in Lp("script")?function(e){Dp.appendChild(Lp("script")).onreadystatechange=function(){Dp.removeChild(this),Qp(e)}}:function(e){setTimeout(Jp(e),0)});var ev,tv,rv,nv,iv,ov,av,sv,cv={set:Bp,clear:jp},uv=n,dv=/ipad|iphone|ipod/i.test(se)&&void 0!==uv.Pebble,lv=/web0s(?!.*chrome)/i.test(se),hv=n,pv=Wt,vv=R.f,fv=cv.set,_v=Rp,mv=dv,gv=lv,yv=sp,Sv=hv.MutationObserver||hv.WebKitMutationObserver,bv=hv.document,Ev=hv.process,kv=hv.Promise,Tv=vv(hv,"queueMicrotask"),Iv=Tv&&Tv.value;Iv||(ev=function(){var e,t;for(yv&&(e=Ev.domain)&&e.exit();tv;){t=tv.fn,tv=tv.next;try{t()}catch(sq){throw tv?nv():rv=void 0,sq}}rv=void 0,e&&e.enter()},_v||yv||gv||!Sv||!bv?!mv&&kv&&kv.resolve?((av=kv.resolve(void 0)).constructor=kv,sv=pv(av.then,av),nv=function(){sv(ev)}):yv?nv=function(){Ev.nextTick(ev)}:(fv=pv(fv,hv),nv=function(){fv(ev)}):(iv=!0,ov=bv.createTextNode(""),new Sv(ev).observe(ov,{characterData:!0}),nv=function(){ov.data=iv=!iv}));var Av=Iv||function(e){var t={fn:e,next:void 0};rv&&(rv.next=t),tv||(tv=t,nv()),rv=t},Rv=n,Cv=function(e){try{return{error:!1,value:e()}}catch(sq){return{error:!0,value:sq}}},wv=function(){this.head=null,this.tail=null};wv.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 xv=wv,Ov=n.Promise,Pv="object"==typeof Deno&&Deno&&"object"==typeof Deno.version,Mv=!Pv&&!sp&&"object"==typeof window&&"object"==typeof document,Dv=n,Nv=Ov,Lv=A,Uv=Kt,Vv=io,Fv=lt,Bv=Mv,jv=Pv,Gv=ve,Hv=Nv&&Nv.prototype,zv=Fv("species"),Kv=!1,Xv=Lv(Dv.PromiseRejectionEvent),qv={CONSTRUCTOR:Uv("Promise",(function(){var e=Vv(Nv),t=e!==String(Nv);if(!t&&66===Gv)return!0;if(!Hv.catch||!Hv.finally)return!0;if(!Gv||Gv<51||!/native code/.test(e)){var r=new Nv((function(e){e(1)})),n=function(e){e((function(){}),(function(){}))};if((r.constructor={})[zv]=n,!(Kv=r.then((function(){}))instanceof n))return!0}return!t&&(Bv||jv)&&!Xv})),REJECTION_EVENT:Xv,SUBCLASSING:Kv},Yv={},Wv=we,Qv=TypeError,Jv=function(e){var t,r;this.promise=new e((function(e,n){if(void 0!==t||void 0!==r)throw Qv("Bad Promise constructor");t=e,r=n})),this.resolve=Wv(t),this.reject=Wv(r)};Yv.f=function(e){return new Jv(e)};var Zv,$v,ef=Rr,tf=sp,rf=n,nf=O,of=li,af=Ni,sf=hp,cf=we,uf=A,df=$,lf=fp,hf=Tp,pf=cv.set,vf=Av,ff=function(e,t){var r=Rv.console;r&&r.error&&(1==arguments.length?r.error(e):r.error(e,t))},_f=Cv,mf=xv,gf=Zi,yf=Ov,Sf=qv,bf=Yv,Ef="Promise",kf=Sf.CONSTRUCTOR,Tf=Sf.REJECTION_EVENT,If=gf.getterFor(Ef),Af=gf.set,Rf=yf&&yf.prototype,Cf=yf,wf=Rf,xf=rf.TypeError,Of=rf.document,Pf=rf.process,Mf=bf.f,Df=Mf,Nf=!!(Of&&Of.createEvent&&rf.dispatchEvent),Lf="unhandledrejection",Uf=function(e){var t;return!(!df(e)||!uf(t=e.then))&&t},Vf=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&&Hf(t),t.rejection=1),!0===s?r=o:(d&&d.enter(),r=s(o),d&&(d.exit(),i=!0)),r===e.promise?u(xf("Promise-chain cycle")):(n=Uf(r))?nf(n,r,c,u):c(r)):u(o)}catch(sq){d&&!i&&d.exit(),u(sq)}},Ff=function(e,t){e.notified||(e.notified=!0,vf((function(){for(var r,n=e.reactions;r=n.get();)Vf(r,e);e.notified=!1,t&&!e.rejection&&jf(e)})))},Bf=function(e,t,r){var n,i;Nf?((n=Of.createEvent("Event")).promise=t,n.reason=r,n.initEvent(e,!1,!0),rf.dispatchEvent(n)):n={promise:t,reason:r},!Tf&&(i=rf["on"+e])?i(n):e===Lf&&ff("Unhandled promise rejection",r)},jf=function(e){nf(pf,rf,(function(){var t,r=e.facade,n=e.value;if(Gf(e)&&(t=_f((function(){tf?Pf.emit("unhandledRejection",n,r):Bf(Lf,r,n)})),e.rejection=tf||Gf(e)?2:1,t.error))throw t.value}))},Gf=function(e){return 1!==e.rejection&&!e.parent},Hf=function(e){nf(pf,rf,(function(){var t=e.facade;tf?Pf.emit("rejectionHandled",t):Bf("rejectionhandled",t,e.value)}))},zf=function(e,t,r){return function(n){e(t,n,r)}},Kf=function(e,t,r){e.done||(e.done=!0,r&&(e=r),e.value=t,e.state=2,Ff(e,!0))},Xf=function(e,t,r){if(!e.done){e.done=!0,r&&(e=r);try{if(e.facade===t)throw xf("Promise can't be resolved itself");var n=Uf(t);n?vf((function(){var r={done:!1};try{nf(n,t,zf(Xf,r,e),zf(Kf,r,e))}catch(sq){Kf(r,sq,e)}})):(e.value=t,e.state=1,Ff(e,!1))}catch(sq){Kf({done:!1},sq,e)}}};kf&&(wf=(Cf=function(e){lf(this,wf),cf(e),nf(Zv,this);var t=If(this);try{e(zf(Xf,t),zf(Kf,t))}catch(sq){Kf(t,sq)}}).prototype,(Zv=function(e){Af(this,{type:Ef,done:!1,notified:!1,parent:!1,reactions:new mf,rejection:!1,state:0,value:void 0})}).prototype=of(wf,"then",(function(e,t){var r=If(this),n=Mf(hf(this,Cf));return r.parent=!0,n.ok=!uf(e)||e,n.fail=uf(t)&&t,n.domain=tf?Pf.domain:void 0,0==r.state?r.reactions.add(n):vf((function(){Vf(n,r)})),n.promise})),$v=function(){var e=new Zv,t=If(e);this.promise=e,this.resolve=zf(Xf,t),this.reject=zf(Kf,t)},bf.f=Mf=function(e){return e===Cf||undefined===e?new $v(e):Df(e)}),ef({global:!0,constructor:!0,wrap:!0,forced:kf},{Promise:Cf}),af(Cf,Ef,!1,!0),sf(Ef);var qf=lt("iterator"),Yf=!1;try{var Wf=0,Qf={next:function(){return{done:!!Wf++}},return:function(){Yf=!0}};Qf[qf]=function(){return this},Array.from(Qf,(function(){throw 2}))}catch(sq){}var Jf=function(e,t){if(!t&&!Yf)return!1;var r=!1;try{var n={};n[qf]=function(){return{next:function(){return{done:r=!0}}}},e(n)}catch(sq){}return r},Zf=Ov,$f=qv.CONSTRUCTOR||!Jf((function(e){Zf.all(e).then(void 0,(function(){}))})),e_=O,t_=we,r_=Yv,n_=Cv,i_=Nh;Rr({target:"Promise",stat:!0,forced:$f},{all:function(e){var t=this,r=r_.f(t),n=r.resolve,i=r.reject,o=n_((function(){var r=t_(t.resolve),o=[],a=0,s=1;i_(e,(function(e){var c=a++,u=!1;s++,e_(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 o_=Rr,a_=qv.CONSTRUCTOR;Ov&&Ov.prototype,o_({target:"Promise",proto:!0,forced:a_,real:!0},{catch:function(e){return this.then(void 0,e)}});var s_=O,c_=we,u_=Yv,d_=Cv,l_=Nh;Rr({target:"Promise",stat:!0,forced:$f},{race:function(e){var t=this,r=u_.f(t),n=r.reject,i=d_((function(){var i=c_(t.resolve);l_(e,(function(e){s_(i,t,e).then(r.resolve,n)}))}));return i.error&&n(i.value),r.promise}});var h_=O,p_=Yv;Rr({target:"Promise",stat:!0,forced:qv.CONSTRUCTOR},{reject:function(e){var t=p_.f(this);return h_(t.reject,void 0,e),t.promise}});var v_=tr,f_=$,__=Yv,m_=function(e,t){if(v_(e),f_(t)&&t.constructor===e)return t;var r=__.f(e);return(0,r.resolve)(t),r.promise},g_=Rr,y_=Ov,S_=qv.CONSTRUCTOR,b_=m_,E_=oe("Promise"),k_=!S_;g_({target:"Promise",stat:!0,forced:true},{resolve:function(e){return b_(k_&&this===E_?y_:this,e)}});var T_=O,I_=we,A_=Yv,R_=Cv,C_=Nh;Rr({target:"Promise",stat:!0},{allSettled:function(e){var t=this,r=A_.f(t),n=r.resolve,i=r.reject,o=R_((function(){var r=I_(t.resolve),i=[],o=0,a=1;C_(e,(function(e){var s=o++,c=!1;a++,T_(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_=O,x_=we,O_=oe,P_=Yv,M_=Cv,D_=Nh,N_="No one promise resolved";Rr({target:"Promise",stat:!0},{any:function(e){var t=this,r=O_("AggregateError"),n=P_.f(t),i=n.resolve,o=n.reject,a=M_((function(){var n=x_(t.resolve),a=[],s=0,c=1,u=!1;D_(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 L_=Rr,U_=Ov,V_=i,F_=oe,B_=A,j_=Tp,G_=m_,H_=U_&&U_.prototype;L_({target:"Promise",proto:!0,real:!0,forced:!!U_&&V_((function(){H_.finally.call({then:function(){}},(function(){}))}))},{finally:function(e){var t=j_(this,F_("Promise")),r=B_(e);return this.then(r?function(r){return G_(t,e()).then((function(){return r}))}:e,r?function(r){return G_(t,e()).then((function(){throw r}))}:e)}});var z_=ee.Promise,K_=Yv,X_=Cv;Rr({target:"Promise",stat:!0,forced:!0},{try:function(e){var t=K_.f(this),r=X_(e);return(r.error?t.reject:t.resolve)(r.value),t.promise}});var q_=z_,Y_=Rr,W_=eo,Q_=E([].reverse),J_=[1,2];Y_({target:"Array",proto:!0,forced:String(J_)===String(J_.reverse())},{reverse:function(){return W_(this)&&(this.length=this.length),Q_(this)}});var Z_=Us("Array").reverse,$_=ae,em=Z_,tm=Array.prototype,rm=function(e){var t=e.reverse;return e===tm||$_(tm,e)&&t===tm.reverse?em:t},nm=Rr,im=eo,om=yo,am=$,sm=Nr,cm=Br,um=Q,dm=Jn,lm=lt,hm=rs,pm=Ds("slice"),vm=lm("species"),fm=Array,_m=Math.max;nm({target:"Array",proto:!0,forced:!pm},{slice:function(e,t){var r,n,i,o=um(this),a=cm(o),s=sm(e,a),c=sm(void 0===t?a:t,a);if(im(o)&&(r=o.constructor,(om(r)&&(r===fm||im(r.prototype))||am(r)&&null===(r=r[vm]))&&(r=void 0),r===fm||void 0===r))return hm(o,s,c);for(n=new(void 0===r?fm:r)(_m(c-s,0)),i=0;s<c;s++,i++)s in o&&dm(n,i,o[s]);return n.length=i,n}});var mm=Us("Array").slice,gm=ae,ym=mm,Sm=Array.prototype,bm=function(e){var t=e.slice;return e===Sm||gm(Sm,e)&&t===Sm.slice?ym: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 Cd?Cd:{},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=Vl(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 p(){}function v(){}var f={};c(f,o,(function(){return this}));var _=Gl&&Gl(Gl(I([])));_&&_!==t&&r.call(_,o)&&(f=_);var m=v.prototype=h.prototype=Vl(f);function g(e){var t;Nu(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"==qd(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=b(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 b(e,t){var r=t.method,n=e.iterator[r];if(void 0===n)return t.delegate=null,"throw"===r&&e.iterator.return&&(t.method="return",t.arg=void 0,b(e,t),"throw"===t.method)||"return"!==r&&(t.method="throw",t.arg=new TypeError("The iterator does not provide a '"+r+"' method")),l;var i=d(n,e.iterator,t.arg);if("throw"===i.type)return t.method="throw",t.arg=i.arg,t.delegate=null,l;var o=i.arg;return o?o.done?(t[e.resultName]=o.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,l):o:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,l)}function E(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"}],Nu(e).call(e,E,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 p.prototype=v,n(m,"constructor",{value:v,configurable:!0}),n(v,"constructor",{value:p,configurable:!0}),p.displayName=c(v,s,"GeneratorFunction"),e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===p||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Hl?Hl(e,v):(e.__proto__=v,c(e,s,"GeneratorFunction")),e.prototype=Vl(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=q_);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 rm(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,Nu(t=this.tryEntries).call(t,k),!e)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+bm(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 km(e,t,r,n,i,o,a){try{var s=e[o](a),c=s.value}catch(sq){return void r(sq)}s.done?t(c):q_.resolve(c).then(n,i)}function Tm(e){return function(){var t=this,r=arguments;return new q_((function(n,i){var o=e.apply(t,r);function a(e){km(o,n,i,a,s,"next",e)}function s(e){km(o,n,i,a,s,"throw",e)}a(void 0)}))}}var Im=Us("Array").concat,Am=ae,Rm=Im,Cm=Array.prototype,wm=function(e){var t=e.concat;return e===Cm||Am(Cm,e)&&t===Cm.concat?Rm:t},xm=ee,Om=d;xm.JSON||(xm.JSON={stringify:JSON.stringify});var Pm=function(e,t,r){return Om(xm.JSON.stringify,null,arguments)},Mm=Pm,Dm=Do.map;Rr({target:"Array",proto:!0,forced:!Ds("map")},{map:function(e){return Dm(this,e,arguments.length>1?arguments[1]:void 0)}});var Nm=Us("Array").map,Lm=ae,Um=Nm,Vm=Array.prototype,Fm=function(e){var t=e.map;return e===Vm||Lm(Vm,e)&&t===Vm.map?Um:t},Bm="\t\n\v\f\r                 \u2028\u2029\ufeff",jm=q,Gm=gn,Hm=E("".replace),zm="[\t\n\v\f\r                 \u2028\u2029\ufeff]",Km=RegExp("^"+zm+zm+"*"),Xm=RegExp(zm+zm+"*$"),qm=function(e){return function(t){var r=Gm(jm(t));return 1&e&&(r=Hm(r,Km,"")),2&e&&(r=Hm(r,Xm,"")),r}},Ym={start:qm(1),end:qm(2),trim:qm(3)},Wm=n,Qm=i,Jm=E,Zm=gn,$m=Ym.trim,eg=Bm,tg=Wm.parseInt,rg=Wm.Symbol,ng=rg&&rg.iterator,ig=/^[+-]?0x/i,og=Jm(ig.exec),ag=8!==tg(eg+"08")||22!==tg(eg+"0x16")||ng&&!Qm((function(){tg(Object(ng))}))?function(e,t){var r=$m(Zm(e));return tg(r,t>>>0||(og(ig,r)?16:10))}:tg;Rr({global:!0,forced:parseInt!=ag},{parseInt:ag});var sg=ee.parseInt,cg={exports:{}},ug=i((function(){if("function"==typeof ArrayBuffer){var e=new ArrayBuffer(8);Object.isExtensible(e)&&Object.defineProperty(e,"a",{value:8})}})),dg=i,lg=$,hg=y,pg=ug,vg=Object.isExtensible,fg=dg((function(){vg(1)}))||pg?function(e){return!!lg(e)&&((!pg||"ArrayBuffer"!=hg(e))&&(!vg||vg(e)))}:vg,_g=!i((function(){return Object.isExtensible(Object.preventExtensions({}))})),mg=Rr,gg=E,yg=Xr,Sg=$,bg=We,Eg=Qt.f,kg=zn,Tg=qn,Ig=fg,Ag=_g,Rg=!1,Cg=et("meta"),wg=0,xg=function(e){Eg(e,Cg,{value:{objectID:"O"+wg++,weakData:{}}})},Og=cg.exports={enable:function(){Og.enable=function(){},Rg=!0;var e=kg.f,t=gg([].splice),r={};r[Cg]=1,e(r).length&&(kg.f=function(r){for(var n=e(r),i=0,o=n.length;i<o;i++)if(n[i]===Cg){t(n,i,1);break}return n},mg({target:"Object",stat:!0,forced:!0},{getOwnPropertyNames:Tg.f}))},fastKey:function(e,t){if(!Sg(e))return"symbol"==typeof e?e:("string"==typeof e?"S":"P")+e;if(!bg(e,Cg)){if(!Ig(e))return"F";if(!t)return"E";xg(e)}return e[Cg].objectID},getWeakData:function(e,t){if(!bg(e,Cg)){if(!Ig(e))return!0;if(!t)return!1;xg(e)}return e[Cg].weakData},onFreeze:function(e){return Ag&&Rg&&Ig(e)&&!bg(e,Cg)&&xg(e),e}};yg[Cg]=!0;var Pg=Rr,Mg=n,Dg=cg.exports,Ng=i,Lg=fr,Ug=Nh,Vg=fp,Fg=A,Bg=$,jg=Ni,Gg=Qt.f,Hg=Do.forEach,zg=C,Kg=Zi.set,Xg=Zi.getterFor,qg=function(e,t,r){var n,i=-1!==e.indexOf("Map"),o=-1!==e.indexOf("Weak"),a=i?"set":"add",s=Mg[e],c=s&&s.prototype,u={};if(zg&&Fg(s)&&(o||c.forEach&&!Ng((function(){(new s).entries().next()})))){var d=(n=t((function(t,r){Kg(Vg(t,d),{type:e,collection:new s}),null!=r&&Ug(r,t[a],{that:t,AS_ENTRIES:i})}))).prototype,l=Xg(e);Hg(["add","clear","delete","forEach","get","has","set","keys","values","entries"],(function(e){var t="add"==e||"set"==e;!(e in c)||o&&"clear"==e||Lg(d,e,(function(r,n){var i=l(this).collection;if(!t&&o&&!Bg(r))return"get"==e&&void 0;var a=i[e](0===r?0:r,n);return t?this:a}))})),o||Gg(d,"size",{configurable:!0,get:function(){return l(this).collection.size}})}else n=r.getConstructor(t,e,i,a),Dg.enable();return jg(n,e,!1,!0),u[e]=n,Pg({global:!0,forced:!0},u),o||r.setStrong(n,e,i),n},Yg=li,Wg=function(e,t,r){for(var n in t)r&&r.unsafe&&e[n]?e[n]=t[n]:Yg(e,n,t[n],r);return e},Qg=Qt.f,Jg=Hn,Zg=Wg,$g=Wt,ey=fp,ty=z,ry=Nh,ny=iu,iy=ou,oy=hp,ay=C,sy=cg.exports.fastKey,cy=Zi.set,uy=Zi.getterFor,dy={getConstructor:function(e,t,r,n){var i=e((function(e,i){ey(e,o),cy(e,{type:t,index:Jg(null),first:void 0,last:void 0,size:0}),ay||(e.size=0),ty(i)||ry(i,e[n],{that:e,AS_ENTRIES:r})})),o=i.prototype,a=uy(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=sy(t,!0),key:t,value:r,previous:n=o.last,next:void 0,removed:!1},o.first||(o.first=s),n&&(n.next=s),ay?o.size++:e.size++,"F"!==i&&(o.index[i]=s)),e},c=function(e,t){var r,n=a(e),i=sy(t);if("F"!==i)return n.index[i];for(r=n.first;r;r=r.next)if(r.key==t)return r};return Zg(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,ay?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),ay?r.size--:t.size--}return!!n},forEach:function(e){for(var t,r=a(this),n=$g(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)}}),Zg(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)}}),ay&&Qg(o,"size",{get:function(){return a(this).size}}),i},setStrong:function(e,t,r){var n=t+" Iterator",i=uy(t),o=uy(n);ny(e,t,(function(e,t){cy(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)?iy("keys"==t?r.key:"values"==t?r.value:[r.key,r.value],!1):(e.target=void 0,iy(void 0,!0))}),r?"entries":"values",!r,!0),oy(t)}};qg("Map",(function(e){return function(){return e(this,arguments.length?arguments[0]:void 0)}}),dy);var ly=ee.Map,hy=Wt,py=O,vy=we,fy=yp,_y=z,my=Nh,gy=[].push,yy=function(e){var t,r,n,i,o=arguments.length,a=o>1?arguments[1]:void 0;return fy(this),(t=void 0!==a)&&vy(a),_y(e)?new this:(r=[],t?(n=0,i=hy(a,o>2?arguments[2]:void 0),my(e,(function(e){py(gy,r,i(e,n++))}))):my(e,gy,{that:r}),new this(r))};Rr({target:"Map",stat:!0,forced:!0},{from:yy});var Sy=rs,by=function(){return new this(Sy(arguments))};Rr({target:"Map",stat:!0,forced:!0},{of:by});var Ey=O,ky=we,Ty=tr,Iy=function(){for(var e,t=Ty(this),r=ky(t.delete),n=!0,i=0,o=arguments.length;i<o;i++)e=Ey(r,t,arguments[i]),n=n&&e;return!!n};Rr({target:"Map",proto:!0,real:!0,forced:!0},{deleteAll:Iy});var Ay=O,Ry=we,Cy=tr,wy=function(e,t){var r,n,i=Cy(this),o=Ry(i.get),a=Ry(i.has),s=Ry(i.set);return Ay(a,i,e)?(r=Ay(o,i,e),"update"in t&&(r=t.update(r,e,i),Ay(s,i,e,r)),r):(n=t.insert(e,i),Ay(s,i,e,n),n)};Rr({target:"Map",proto:!0,real:!0,forced:!0},{emplace:wy});var xy=mh,Oy=tr,Py=Wt,My=xy,Dy=Nh;Rr({target:"Map",proto:!0,real:!0,forced:!0},{every:function(e){var t=Oy(this),r=My(t),n=Py(e,arguments.length>1?arguments[1]:void 0);return!Dy(r,(function(e,r,i){if(!n(r,e,t))return i()}),{AS_ENTRIES:!0,IS_ITERATOR:!0,INTERRUPTED:!0}).stopped}});var Ny=oe,Ly=Wt,Uy=O,Vy=we,Fy=tr,By=Tp,jy=xy,Gy=Nh;Rr({target:"Map",proto:!0,real:!0,forced:!0},{filter:function(e){var t=Fy(this),r=jy(t),n=Ly(e,arguments.length>1?arguments[1]:void 0),i=new(By(t,Ny("Map"))),o=Vy(i.set);return Gy(r,(function(e,r){n(r,e,t)&&Uy(o,i,e,r)}),{AS_ENTRIES:!0,IS_ITERATOR:!0}),i}});var Hy=tr,zy=Wt,Ky=xy,Xy=Nh;Rr({target:"Map",proto:!0,real:!0,forced:!0},{find: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(r)}),{AS_ENTRIES:!0,IS_ITERATOR:!0,INTERRUPTED:!0}).result}});var qy=tr,Yy=Wt,Wy=xy,Qy=Nh;Rr({target:"Map",proto:!0,real:!0,forced:!0},{findKey:function(e){var t=qy(this),r=Wy(t),n=Yy(e,arguments.length>1?arguments[1]:void 0);return Qy(r,(function(e,r,i){if(n(r,e,t))return i(e)}),{AS_ENTRIES:!0,IS_ITERATOR:!0,INTERRUPTED:!0}).result}});var Jy=Rr,Zy=O,$y=we,eS=mh,tS=Nh,rS=E([].push);Jy({target:"Map",stat:!0,forced:!0},{groupBy:function(e,t){$y(t);var r=eS(e),n=new this,i=$y(n.has),o=$y(n.get),a=$y(n.set);return tS(r,(function(e){var r=t(e);Zy(i,n,r)?rS(Zy(o,n,r),e):Zy(a,n,r,[e])}),{IS_ITERATOR:!0}),n}});var nS=tr,iS=xy,oS=function(e,t){return e===t||e!=e&&t!=t},aS=Nh;Rr({target:"Map",proto:!0,real:!0,forced:!0},{includes:function(e){return aS(iS(nS(this)),(function(t,r,n){if(oS(r,e))return n()}),{AS_ENTRIES:!0,IS_ITERATOR:!0,INTERRUPTED:!0}).stopped}});var sS=O,cS=Nh,uS=we;Rr({target:"Map",stat:!0,forced:!0},{keyBy:function(e,t){var r=new this;uS(t);var n=uS(r.set);return cS(e,(function(e){sS(n,r,t(e),e)})),r}});var dS=tr,lS=xy,hS=Nh;Rr({target:"Map",proto:!0,real:!0,forced:!0},{keyOf:function(e){return hS(lS(dS(this)),(function(t,r,n){if(r===e)return n(t)}),{AS_ENTRIES:!0,IS_ITERATOR:!0,INTERRUPTED:!0}).result}});var pS=oe,vS=Wt,fS=O,_S=we,mS=tr,gS=Tp,yS=xy,SS=Nh;Rr({target:"Map",proto:!0,real:!0,forced:!0},{mapKeys:function(e){var t=mS(this),r=yS(t),n=vS(e,arguments.length>1?arguments[1]:void 0),i=new(gS(t,pS("Map"))),o=_S(i.set);return SS(r,(function(e,r){fS(o,i,n(r,e,t),r)}),{AS_ENTRIES:!0,IS_ITERATOR:!0}),i}});var bS=oe,ES=Wt,kS=O,TS=we,IS=tr,AS=Tp,RS=xy,CS=Nh;Rr({target:"Map",proto:!0,real:!0,forced:!0},{mapValues:function(e){var t=IS(this),r=RS(t),n=ES(e,arguments.length>1?arguments[1]:void 0),i=new(AS(t,bS("Map"))),o=TS(i.set);return CS(r,(function(e,r){kS(o,i,e,n(r,e,t))}),{AS_ENTRIES:!0,IS_ITERATOR:!0}),i}});var wS=we,xS=tr,OS=Nh;Rr({target:"Map",proto:!0,real:!0,arity:1,forced:!0},{merge:function(e){for(var t=xS(this),r=wS(t.set),n=arguments.length,i=0;i<n;)OS(arguments[i++],r,{that:t,AS_ENTRIES:!0});return t}});var PS=tr,MS=we,DS=xy,NS=Nh,LS=TypeError;Rr({target:"Map",proto:!0,real:!0,forced:!0},{reduce:function(e){var t=PS(this),r=DS(t),n=arguments.length<2,i=n?void 0:arguments[1];if(MS(e),NS(r,(function(r,o){n?(n=!1,i=o):i=e(i,o,r,t)}),{AS_ENTRIES:!0,IS_ITERATOR:!0}),n)throw LS("Reduce of empty map with no initial value");return i}});var US=tr,VS=Wt,FS=xy,BS=Nh;Rr({target:"Map",proto:!0,real:!0,forced:!0},{some:function(e){var t=US(this),r=FS(t),n=VS(e,arguments.length>1?arguments[1]:void 0);return BS(r,(function(e,r,i){if(n(r,e,t))return i()}),{AS_ENTRIES:!0,IS_ITERATOR:!0,INTERRUPTED:!0}).stopped}});var jS=O,GS=tr,HS=we,zS=TypeError;Rr({target:"Map",proto:!0,real:!0,forced:!0},{update:function(e,t){var r=GS(this),n=HS(r.get),i=HS(r.has),o=HS(r.set),a=arguments.length;HS(t);var s=jS(i,r,e);if(!s&&a<3)throw zS("Updating absent value");var c=s?jS(n,r,e):HS(a>2?arguments[2]:void 0)(e,r);return jS(o,r,e,t(c,e,r)),r}});var KS=O,XS=we,qS=A,YS=tr,WS=TypeError,QS=function(e,t){var r,n=YS(this),i=XS(n.get),o=XS(n.has),a=XS(n.set),s=arguments.length>2?arguments[2]:void 0;if(!qS(t)&&!qS(s))throw WS("At least one callback required");return KS(o,n,e)?(r=KS(i,n,e),qS(t)&&(r=t(r),KS(a,n,e,r))):qS(s)&&(r=s(),KS(a,n,e,r)),r};Rr({target:"Map",proto:!0,real:!0,forced:!0},{upsert:QS}),Rr({target:"Map",proto:!0,real:!0,name:"upsert",forced:!0},{updateOrInsert:QS});var JS=ly,ZS=we,$S=Xe,eb=H,tb=Br,rb=TypeError,nb=function(e){return function(t,r,n,i){ZS(r);var o=$S(t),a=eb(o),s=tb(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 rb("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}},ib={left:nb(!1),right:nb(!0)}.left,ob=ve,ab=sp;Rr({target:"Array",proto:!0,forced:!Iu("reduce")||!ab&&ob>79&&ob<83},{reduce:function(e){var t=arguments.length;return ib(this,e,t,t>1?arguments[1]:void 0)}});var sb=Us("Array").reduce,cb=ae,ub=sb,db=Array.prototype,lb=function(e){var t=e.reduce;return e===db||cb(db,e)&&t===db.reduce?ub:t},hb=C,pb=E,vb=O,fb=i,_b=rn,mb=ui,gb=P,yb=Xe,Sb=H,bb=Object.assign,Eb=Object.defineProperty,kb=pb([].concat),Tb=!bb||fb((function(){if(hb&&1!==bb({b:1},bb(Eb({},"a",{enumerable:!0,get:function(){Eb(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!=bb({},e)[r]||_b(bb({},t)).join("")!=n}))?function(e,t){for(var r=yb(e),n=arguments.length,i=1,o=mb.f,a=gb.f;n>i;)for(var s,c=Sb(arguments[i++]),u=o?kb(_b(c),o(c)):_b(c),d=u.length,l=0;d>l;)s=u[l++],hb&&!vb(a,c,s)||(r[s]=c[s]);return r}:bb,Ib=Tb;Rr({target:"Object",stat:!0,arity:2,forced:Object.assign!==Ib},{assign:Ib});var Ab=ee.Object.assign,Rb=$,Cb=y,wb=lt("match"),xb=function(e){var t;return Rb(e)&&(void 0!==(t=e[wb])?!!t:"RegExp"==Cb(e))},Ob=TypeError,Pb=function(e){if(xb(e))throw Ob("The method doesn't accept regular expressions");return e},Mb=lt("match"),Db=function(e){var t=/./;try{"/./"[e](t)}catch(r){try{return t[Mb]=!1,"/./"[e](t)}catch(n){}}return!1},Nb=Rr,Lb=E;R.f;var Ub=Vr,Vb=gn,Fb=Pb,Bb=q,jb=Db,Gb=Lb("".endsWith),Hb=Lb("".slice),zb=Math.min;Nb({target:"String",proto:!0,forced:!jb("endsWith")},{endsWith:function(e){var t=Vb(Bb(this));Fb(e);var r=arguments.length>1?arguments[1]:void 0,n=t.length,i=void 0===r?n:zb(Ub(r),n),o=Vb(e);return Gb?Gb(t,o,i):Hb(t,i-o.length,i)===o}});var Kb=Us("String").endsWith,Xb=ae,qb=Kb,Yb=String.prototype,Wb=function(e){var t=e.endsWith;return"string"==typeof e||e===Yb||Xb(Yb,e)&&t===Yb.endsWith?qb:t},Qb=!0,Jb=!0;function Zb(e,t,r){var n=e.match(t);return n&&n.length>=r&&sg(n[r],10)}function $b(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 JS),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 eE(e){return"boolean"!=typeof e?new Error("Argument type: "+qd(e)+". Please use a boolean."):(Qb=e,e?"adapter.js logging disabled":"adapter.js logging enabled")}function tE(e){return"boolean"!=typeof e?new Error("Argument type: "+qd(e)+". Please use a boolean."):(Jb=!e,"adapter.js deprecation warnings "+(e?"disabled":"enabled"))}function rE(){if("object"===("undefined"==typeof window?"undefined":qd(window))){if(Qb)return;"undefined"!=typeof console&&"function"==typeof console.log&&console.log.apply(console,arguments)}}function nE(e,t){Jb&&console.warn(e+" is deprecated, please use "+t+" instead.")}function iE(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=Zb(r.userAgent,/Firefox\/(\d+)\./,1);else if(r.webkitGetUserMedia||!1===e.isSecureContext&&e.webkitRTCPeerConnection)t.browser="chrome",t.version=Zb(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=Zb(r.userAgent,/AppleWebKit\/(\d+)\./,1),t.supportsUnifiedPlan=e.RTCRtpTransceiver&&"currentDirection"in e.RTCRtpTransceiver.prototype}return t}function oE(e){return"[object Object]"===Object.prototype.toString.call(e)}function aE(e){var t;return oE(e)?lb(t=an(e)).call(t,(function(t,r){var n=oE(e[r]),i=n?aE(e[r]):e[r],o=n&&!an(i).length;return void 0===i||o?t:Ab(t,Qd({},r,i))}),{}):e}function sE(e,t,r){t&&!r.has(t.id)&&(r.set(t.id,t),an(t).forEach((function(n){Wb(n).call(n,"Id")?sE(e,e.get(t[n]),r):Wb(n).call(n,"Ids")&&t[n].forEach((function(t){sE(e,e.get(t),r)}))})))}function cE(e,t,r){var n=r?"outbound-rtp":"inbound-rtp",i=new JS;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&&sE(e,r,i)}))})),i}var uE=Rr,dE=Do.find,lE="find",hE=!0;lE in[]&&Array(1).find((function(){hE=!1})),uE({target:"Array",proto:!0,forced:hE},{find:function(e){return dE(this,e,arguments.length>1?arguments[1]:void 0)}});var pE=Us("Array").find,vE=ae,fE=pE,_E=Array.prototype,mE=function(e){var t=e.find;return e===_E||vE(_E,e)&&t===_E.find?fE:t},gE=Rr,yE=Kr.indexOf,SE=Iu,bE=E([].indexOf),EE=!!bE&&1/bE([1],1,-0)<0,kE=SE("indexOf");gE({target:"Array",proto:!0,forced:EE||!kE},{indexOf:function(e){var t=arguments.length>1?arguments[1]:void 0;return EE?bE(this,e,t)||0:yE(this,e,t)}});var TE=Us("Array").indexOf,IE=ae,AE=TE,RE=Array.prototype,CE=function(e){var t=e.indexOf;return e===RE||IE(RE,e)&&t===RE.indexOf?AE:t},wE=C,xE=eo,OE=TypeError,PE=Object.getOwnPropertyDescriptor,ME=wE&&!function(){if(void 0!==this)return!0;try{Object.defineProperty([],"length",{writable:!1}).length=1}catch(sq){return sq instanceof TypeError}}(),DE=Ie,NE=TypeError,LE=function(e,t){if(!delete e[t])throw NE("Cannot delete property "+DE(t)+" of "+DE(e))},UE=Rr,VE=Xe,FE=Nr,BE=Or,jE=Br,GE=ME?function(e,t){if(xE(e)&&!PE(e,"length").writable)throw OE("Cannot set read only .length");return e.length=t}:function(e,t){return e.length=t},HE=cd,zE=Ao,KE=Jn,XE=LE,qE=Ds("splice"),YE=Math.max,WE=Math.min;UE({target:"Array",proto:!0,forced:!qE},{splice:function(e,t){var r,n,i,o,a,s,c=VE(this),u=jE(c),d=FE(e,u),l=arguments.length;for(0===l?r=n=0:1===l?(r=0,n=u-d):(r=l-2,n=WE(YE(BE(t),0),u-d)),HE(u+r-n),i=zE(c,n),o=0;o<n;o++)(a=d+o)in c&&KE(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]:XE(c,s);for(o=u;o>u-n+r;o--)XE(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]:XE(c,s);for(o=0;o<r;o++)c[o+d]=arguments[o+2];return GE(c,u-n+r),i}});var QE=Us("Array").splice,JE=ae,ZE=QE,$E=Array.prototype,ek=function(e){var t=e.splice;return e===$E||JE($E,e)&&t===$E.splice?ZE:t},tk=Kr.includes;Rr({target:"Array",proto:!0,forced:i((function(){return!Array(1).includes()}))},{includes:function(e){return tk(this,e,arguments.length>1?arguments[1]:void 0)}});var rk=Us("Array").includes,nk=Rr,ik=Pb,ok=q,ak=gn,sk=Db,ck=E("".indexOf);nk({target:"String",proto:!0,forced:!sk("includes")},{includes:function(e){return!!~ck(ak(ok(this)),ak(ik(e)),arguments.length>1?arguments[1]:void 0)}});var uk=Us("String").includes,dk=ae,lk=rk,hk=uk,pk=Array.prototype,vk=String.prototype,fk=function(e){var t=e.includes;return e===pk||dk(pk,e)&&t===pk.includes?lk:"string"==typeof e||e===vk||dk(vk,e)&&t===vk.includes?hk:t},_k=rE;function mk(e,t){var r=e&&e.navigator;if(r.mediaDevices){var n=function(e){if("object"!==qd(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"===qd(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()+bm(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(Mm(e)))&&"object"===qd(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(Mm(e))).audio,"autoGainControl","googAutoGainControl"),o(e.audio,"noiseSuppression","googNoiseSuppression"),e.audio=n(e.audio)}if(e&&"object"===qd(e.video)){var a=e.video.facingMode;a=a&&("object"===qd(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=mE(t).call(t,(function(e){return s.some((function(t){var r;return fk(r=e.label.toLowerCase()).call(r,t)}))}));return!r&&t.length&&fk(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: "+Mm(e)),i(e)}));e.video=n(e.video)}return _k("chrome: "+Mm(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 q_.reject(o(e))}))}))}}}}function gk(e){e.MediaStream=e.MediaStream||e.webkitMediaStream}function yk(e){if("object"===qd(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=mE(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=mE(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 $b(e,"track",(function(e){return e.transceiver||ad(e,"transceiver",{value:{receiver:e.receiver}}),e}))}function Sk(e){if("object"===qd(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||[],bm(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=CE(t=this._senders).call(t,e);-1!==i&&ek(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=mE(r=t._senders).call(r,(function(t){return t.track===e}));o&&ek(n=t._senders).call(n,CE(i=t._senders).call(i,o),1)}))}}else if("object"===qd(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 bk(e){if(e.RTCPeerConnection){var t=e.RTCPeerConnection.prototype.getStats;e.RTCPeerConnection.prototype.getStats=function(){var e=this,r=bm(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 JS(Fm(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 q_((function(r,n){t.apply(e,[function(e){r(s(a(e)))},n])})).then(i,o)}}}function Ek(e){if("object"===qd(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 cE(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}),$b(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 cE(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?q_.reject(new DOMException("There are more than one sender or receiver for the track.","InvalidAccessError")):t?t.getStats():r?r.getStats():q_.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||{},Fm(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===CE(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(mE(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===CE(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=CE(n=t._shimmedLocalStreams[r]).call(n,e);-1!==o&&ek(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||{},Fm(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(mE(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=bm([]).call(arguments,1);if(1!==s.length||!mE(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=mE(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),q_.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 mE(o=this.getSenders()).call(o,(function(e){return e.track===t}))},["createOffer","createAnswer"].forEach((function(t){var r=e.RTCPeerConnection.prototype[t],n=Qd({},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;mE(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=Qd({},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){$b(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:bk,shimSenderReceiverGetStats:Ek,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 Ck=ee.Array.isArray;function wk(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 xk=dh,Ok=tr,Pk=bh,Mk=Wt,Dk=O,Nk=Xe,Lk=function(e,t,r,n){try{return n?t(Ok(r)[0],r[1]):t(r)}catch(sq){Pk(e,"throw",sq)}},Uk=ih,Vk=yo,Fk=Br,Bk=Jn,jk=mh,Gk=dh,Hk=Array,zk=function(e){var t=Nk(e),r=Vk(this),n=arguments.length,i=n>1?arguments[1]:void 0,o=void 0!==i;o&&(i=Mk(i,n>2?arguments[2]:void 0));var a,s,c,u,d,l,h=Gk(t),p=0;if(!h||this===Hk&&Uk(h))for(a=Fk(t),s=r?new this(a):Hk(a);a>p;p++)l=o?i(t[p],p):t[p],Bk(s,p,l);else for(d=(u=jk(t,h)).next,s=r?new this:[];!(c=Dk(d,u)).done;p++)l=o?Lk(u,i,[c.value,p],!0):c.value,Bk(s,p,l);return s.length=p,s},Kk=zk;Rr({target:"Array",stat:!0,forced:!Jf((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 wk(e,t);var n=bm(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)?wk(e,t):void 0}}function Yk(e){return function(e){if(Ck(e))return wk(e)}(e)||function(e){if(void 0!==Cd&&null!=xk(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 Wk=n,Qk=i,Jk=gn,Zk=Ym.trim,$k=E("".charAt),eT=Wk.parseFloat,tT=Wk.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){nE("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"===qd(e)&&"object"===qd(e.audio)&&(e=JSON.parse(Mm(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"===qd(e)&&(e=JSON.parse(Mm(e)),i(e,"autoGainControl","mozAutoGainControl"),i(e,"noiseSuppression","mozNoiseSuppression")),s.apply(this,[e])}}}}function aT(e){"object"===qd(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"===qd(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=Qd({},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=bm(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,Ab({},t,{type:r[t.type]||t.type}))}))}return e})).then(o,a)}}}function cT(e){if("object"===qd(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):q_.resolve(new JS)}}}function uT(e){if("object"===qd(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}),$b(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;nE("removeStream","removeTrack"),this.getSenders().forEach((function(r){var n;r.track&&fk(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"===qd(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=Yk(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 pT(e){if("object"===qd(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 vT(e){if("object"===qd(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?q_.all(this.setParametersPromises).then((function(){return t.apply(r,e)})).finally((function(){r.setParametersPromises=[]})):t.apply(this,arguments)}}}function fT(e){if("object"===qd(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?q_.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:pT,shimCreateOffer:vT,shimCreateAnswer:fT,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,q_.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"===qd(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=[]),fk(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?fk(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=CE(t=this._localStreams).call(t,e);if(-1!==i){ek(r=this._localStreams).call(r,i,1);var o=e.getTracks();this.getSenders().forEach((function(e){fk(o).call(o,e.track)&&n.removeTrack(e)}))}})}}function gT(e){if("object"===qd(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=[]),!fk(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=[]),!(CE(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"===qd(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),q_.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),q_.resolve()):i};var s=function(e,t,r){var n=i.apply(this,[e]);return r?(n.then(t,r),q_.resolve()):n};t.setLocalDescription=s,s=function(e,t,r){var n=o.apply(this,[e]);return r?(n.then(t,r),q_.resolve()):n},t.setRemoteDescription=s,s=function(e,t,r){var n=a.apply(this,[e]);return r?(n.then(t,r),q_.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(bT(e))}}!t.getUserMedia&&t.mediaDevices&&t.mediaDevices.getUserMedia&&(t.getUserMedia=function(e,r,n){t.mediaDevices.getUserMedia(e).then(r,n)}.bind(t))}function bT(e){return e&&void 0!==e.video?Ab({},e,{video:aE(e.video)}):e}function ET(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")?(nE("RTCIceServer.url","RTCIceServer.urls"),(o=JSON.parse(Mm(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"===qd(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=mE(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=mE(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"!==qd(e)||e.AudioContext||(e.AudioContext=e.webkitAudioContext)}var AT=Object.freeze(Object.defineProperty({__proto__:null,shimLocalStreamsAPI:mT,shimRemoteStreamsAPI:gT,shimCallbacksAPI:yT,shimGetUserMedia:ST,shimConstraints:bT,shimRTCIceServerUrls:ET,shimTrackEventTransceiver:kT,shimCreateOfferLegacy:TT,shimAudioContext:IT},Symbol.toStringTag,{value:"Module"})),RT=cc.PROPER,CT=i,wT=Bm,xT=Ym.trim;Rr({target:"String",proto:!0,forced:function(e){return CT((function(){return!!wT[e]()||"​…᠎"!=="​…᠎"[e]()||RT&&wT[e].name!==e}))}("trim")},{trim:function(){return xT(this)}});var OT,PT,MT=Us("String").trim,DT=ae,NT=MT,LT=String.prototype,UT=function(e){var t=e.trim;return"string"==typeof e||e===LT||DT(LT,e)&&t===LT.trim?NT:t},VT={exports:{}};OT=VT,(PT={generateIdentifier:function(){return Math.random().toString(36).substr(2,10)}}).localCName=PT.generateIdentifier(),PT.splitLines=function(e){var t;return Fm(t=UT(e).call(e).split("\n")).call(t,(function(e){return UT(e).call(e)}))},PT.splitSections=function(e){var t=e.split("\nm=");return Fm(t).call(t,(function(e,t){var r;return UT(r=t>0?"m="+e:e).call(r)+"\r\n"}))},PT.getDescription=function(e){var t=PT.splitSections(e);return t&&t[0]},PT.getMediaSections=function(e){var t=PT.splitSections(e);return t.shift(),t},PT.matchPrefix=function(e,t){var r;return Gs(r=PT.splitLines(e)).call(r,(function(e){return 0===CE(e).call(e,t)}))},PT.parseCandidate=function(e){for(var t,r={foundation:(t=0===CE(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:sg(t[3],10),ip:t[4],address:t[4],port:sg(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=sg(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},PT.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(" ")},PT.parseIceOptions=function(e){return e.substr(14).split(" ")},PT.parseRtpMap=function(e){var t=e.substr(9).split(" "),r={payloadType:sg(t.shift(),10)};return t=t[0].split("/"),r.name=t[0],r.clockRate=sg(t[1],10),r.channels=3===t.length?sg(t[2],10):1,r.numChannels=r.channels,r},PT.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"},PT.parseExtmap=function(e){var t,r=e.substr(9).split(" ");return{id:sg(r[0],10),direction:CE(t=r[0]).call(t,"/")>0?r[0].split("/")[1]:"sendrecv",uri:r[1]}},PT.writeExtmap=function(e){return"a=extmap:"+(e.id||e.preferredId)+(e.direction&&"sendrecv"!==e.direction?"/"+e.direction:"")+" "+e.uri+"\r\n"},PT.parseFmtp=function(e){for(var t,r={},n=e.substr(CE(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},PT.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},PT.parseRtcpFb=function(e){var t=e.substr(CE(e).call(e," ")+1).split(" ");return{type:t.shift(),parameter:t.join(" ")}},PT.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},PT.parseSsrcMedia=function(e){var t=CE(e).call(e," "),r={ssrc:sg(e.substr(7,t-7),10)},n=CE(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},PT.parseSsrcGroup=function(e){var t=e.substr(13).split(" ");return{semantics:t.shift(),ssrcs:Fm(t).call(t,(function(e){return sg(e,10)}))}},PT.getMid=function(e){var t=PT.matchPrefix(e,"a=mid:")[0];if(t)return t.substr(6)},PT.parseFingerprint=function(e){var t=e.substr(14).split(" ");return{algorithm:t[0].toLowerCase(),value:t[1].toUpperCase()}},PT.getDtlsParameters=function(e,t){var r=PT.matchPrefix(e+t,"a=fingerprint:");return{role:"auto",fingerprints:Fm(r).call(r,PT.parseFingerprint)}},PT.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},PT.parseCryptoLine=function(e){var t=e.substr(9).split(" ");return{tag:sg(t[0],10),cryptoSuite:t[1],keyParams:t[2],sessionParams:bm(t).call(t,3)}},PT.writeCryptoLine=function(e){return"a=crypto:"+e.tag+" "+e.cryptoSuite+" "+("object"===qd(e.keyParams)?PT.writeCryptoKeyParams(e.keyParams):e.keyParams)+(e.sessionParams?" "+e.sessionParams.join(" "):"")+"\r\n"},PT.parseCryptoKeyParams=function(e){if(0!==CE(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}},PT.writeCryptoKeyParams=function(e){return e.keyMethod+":"+e.keySalt+(e.lifeTime?"|"+e.lifeTime:"")+(e.mkiValue&&e.mkiLength?"|"+e.mkiValue+":"+e.mkiLength:"")},PT.getCryptoParameters=function(e,t){var r=PT.matchPrefix(e+t,"a=crypto:");return Fm(r).call(r,PT.parseCryptoLine)},PT.getIceParameters=function(e,t){var r=PT.matchPrefix(e+t,"a=ice-ufrag:")[0],n=PT.matchPrefix(e+t,"a=ice-pwd:")[0];return r&&n?{usernameFragment:r.substr(12),password:n.substr(10)}:null},PT.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},PT.parseRtpParameters=function(e){for(var t={codecs:[],headerExtensions:[],fecMechanisms:[],rtcp:[]},r=PT.splitLines(e)[0].split(" "),n=3;n<r.length;n++){var i=r[n],o=PT.matchPrefix(e,"a=rtpmap:"+i+" ")[0];if(o){var a,s=PT.parseRtpMap(o),c=PT.matchPrefix(e,"a=fmtp:"+i+" ");switch(s.parameters=c.length?PT.parseFmtp(c[0]):{},s.rtcpFeedback=Fm(a=PT.matchPrefix(e,"a=rtcp-fb:"+i+" ")).call(a,PT.parseRtcpFb),t.codecs.push(s),s.name.toUpperCase()){case"RED":case"ULPFEC":t.fecMechanisms.push(s.name.toUpperCase())}}}return PT.matchPrefix(e,"a=extmap:").forEach((function(e){t.headerExtensions.push(PT.parseExtmap(e))})),t},PT.writeRtpDescription=function(e,t){var r,n="";n+="m="+e+" ",n+=t.codecs.length>0?"9":"0",n+=" UDP/TLS/RTP/SAVPF ",n+=Fm(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+=PT.writeRtpMap(e),n+=PT.writeFmtp(e),n+=PT.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+=PT.writeExtmap(e)})),n},PT.parseRtpEncodingParameters=function(e){var t,r,n,i,o,a,s=[],c=PT.parseRtpParameters(e),u=-1!==CE(t=c.fecMechanisms).call(t,"RED"),d=-1!==CE(r=c.fecMechanisms).call(r,"ULPFEC"),l=Gs(n=Fm(i=PT.matchPrefix(e,"a=ssrc:")).call(i,(function(e){return PT.parseSsrcMedia(e)}))).call(n,(function(e){return"cname"===e.attribute})),h=l.length>0&&l[0].ssrc,p=Fm(o=PT.matchPrefix(e,"a=ssrc-group:FID")).call(o,(function(e){var t=e.substr(17).split(" ");return Fm(t).call(t,(function(e){return sg(e,10)}))}));p.length>0&&p[0].length>1&&p[0][0]===h&&(a=p[0][1]),c.codecs.forEach((function(e){if("RTX"===e.name.toUpperCase()&&e.parameters.apt){var t={ssrc:h,codecPayloadType:sg(e.parameters.apt,10)};h&&a&&(t.rtx={ssrc:a}),s.push(t),u&&((t=JSON.parse(Mm(t))).fec={ssrc:h,mechanism:d?"red+ulpfec":"red"},s.push(t))}})),0===s.length&&h&&s.push({ssrc:h});var v,f,_=PT.matchPrefix(e,"b=");return _.length&&(_=0===CE(v=_[0]).call(v,"b=TIAS:")?sg(_[0].substr(7),10):0===CE(f=_[0]).call(f,"b=AS:")?1e3*sg(_[0].substr(5),10)*.95-16e3:void 0,s.forEach((function(e){e.maxBitrate=_}))),s},PT.parseRtcpParameters=function(e){var t,r,n={},i=Gs(t=Fm(r=PT.matchPrefix(e,"a=ssrc:")).call(r,(function(e){return PT.parseSsrcMedia(e)}))).call(t,(function(e){return"cname"===e.attribute}))[0];i&&(n.cname=i.value,n.ssrc=i.ssrc);var o=PT.matchPrefix(e,"a=rtcp-rsize");n.reducedSize=o.length>0,n.compound=0===o.length;var a=PT.matchPrefix(e,"a=rtcp-mux");return n.mux=a.length>0,n},PT.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},PT.parseMsid=function(e){var t,r,n,i=PT.matchPrefix(e,"a=msid:");if(1===i.length)return{stream:(n=i[0].substr(7).split(" "))[0],track:n[1]};var o=Gs(t=Fm(r=PT.matchPrefix(e,"a=ssrc:")).call(r,(function(e){return PT.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},PT.parseSctpDescription=function(e){var t,r=PT.parseMLine(e),n=PT.matchPrefix(e,"a=max-message-size:");n.length>0&&(t=sg(n[0].substr(19),10)),isNaN(t)&&(t=65536);var i=PT.matchPrefix(e,"a=sctp-port:");if(i.length>0)return{port:sg(i[0].substr(12),10),protocol:r.fmt,maxMessageSize:t};var o=PT.matchPrefix(e,"a=sctpmap:");if(o.length>0){var a=o[0].substr(10).split(" ");return{port:sg(a[0],10),protocol:a[1],maxMessageSize:t}}},PT.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("")},PT.generateSessionId=function(){return Math.random().toString().substr(2,21)},PT.writeSessionBoilerplate=function(e,t,r){var n=void 0!==t?t:2;return"v=0\r\no="+(r||"thisisadapterortc")+" "+(e||PT.generateSessionId())+" "+n+" IN IP4 127.0.0.1\r\ns=-\r\nt=0 0\r\n"},PT.getDirection=function(e,t){for(var r=PT.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?PT.getDirection(t):"sendrecv"},PT.getKind=function(e){return PT.splitLines(e)[0].split(" ")[0].substr(2)},PT.isRejected=function(e){return"0"===e.split(" ",2)[1]},PT.parseMLine=function(e){var t=PT.splitLines(e)[0].substr(2).split(" ");return{kind:t[0],port:sg(t[1],10),protocol:t[2],fmt:bm(t).call(t,3).join(" ")}},PT.parseOLine=function(e){var t=PT.matchPrefix(e,"o=")[0].substr(2).split(" ");return{username:t[0],sessionId:t[1],sessionVersion:sg(t[2],10),netType:t[3],addressType:t[4],address:t[5]}},PT.isValidSDP=function(e){if("string"!=typeof e||0===e.length)return!1;for(var t=PT.splitLines(e),r=0;r<t.length;r++)if(t[r].length<2||"="!==t[r].charAt(1))return!1;return!0},OT.exports=PT;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"===qd(e)&&e.candidate&&0===CE(r=e.candidate).call(r,"a=")&&((e=JSON.parse(Mm(e))).candidate=e.candidate.substr(2)),e.candidate&&e.candidate.length){var n=new t(e),i=FT.parseCandidate(e.candidate),o=Ab(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,$b(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||$b(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!==CE(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=sg(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=sg(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},$b(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!==CE(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?q_.resolve():r.apply(this,arguments):(arguments[1]&&arguments[1].apply(null),q_.resolve())})}}function YT(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"!==qd(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 WT=Object.freeze(Object.defineProperty({__proto__:null,shimRTCIceCandidate:jT,shimRTCIceCandidateRelayProtocol:GT,shimMaxMessageSize:HT,shimSendThrowTypeError:zT,shimConnectionState:KT,removeExtmapAllowMixed:XT,shimAddIceCandidateNullOrEmpty:qT,shimParameterlessSetLocalDescription:YT},Symbol.toStringTag,{value:"Module"}));if(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=rE,i=iE(t),o={browserDetails:i,commonShim:WT,extractVersion:Zb,disableLog:eE,disableWarnings:tE,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),YT(t),mk(t,i),gk(t),Ik(t,i),yk(t),Tk(t,i),Sk(t),bk(t),Ek(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),YT(t),oT(t,i),sT(t,i),aT(t),dT(t),cT(t),uT(t),lT(t),hT(t),pT(t),vT(t),fT(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),YT(t),ET(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}),"undefined"!=typeof MediaStreamTrack){var QT=MediaStreamTrack.prototype.getSettings;MediaStreamTrack.prototype.getSettings=function(){var e=QT.call(this);return e.width&&(e.width=Math.floor(e.width)),e.height&&(e.height=Math.floor(e.height)),e.frameRate&&(e.frameRate=Math.floor(e.frameRate)),e}}function JT(e,t){var r=void 0!==Cd&&xk(e)||e["@@iterator"];if(!r){if(Ck(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 ZT(e,t){return function(e){if(Ck(e))return e}(e)||function(e,t){var r=null==e?null:void 0!==Cd&&xk(e)||e["@@iterator"];if(null!=r){var n,i,o,a,s=[],c=!0,u=!1;try{if(o=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;c=!1}else for(;!(c=(n=o.call(r)).done)&&(s.push(n.value),s.length!==t);c=!0);}catch(d){u=!0,i=d}finally{try{if(!c&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(u)throw i}}return s}}(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 $T(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}var eI=We,tI=function(e){return void 0!==e&&(eI(e,"value")||eI(e,"writable"))},rI=O,nI=$,iI=tr,oI=tI,aI=R,sI=mc;Rr({target:"Reflect",stat:!0},{get:function e(t,r){var n,i,o=arguments.length<3?t:arguments[2];return iI(t)===o?t[r]:(n=aI.f(t,r))?oI(n)?n.value:void 0===n.get?void 0:rI(n.get,o):nI(i=sI(t))?e(i,r,o):void 0}});var cI=ee.Reflect.get,uI=E,dI=we,lI=$,hI=We,pI=rs,vI=o,fI=Function,_I=uI([].concat),mI=uI([].join),gI={},yI=function(e,t,r){if(!hI(gI,t)){for(var n=[],i=0;i<t;i++)n[i]="a["+i+"]";gI[t]=fI("C,a","return new C("+mI(n,",")+")")}return gI[t](e,r)},SI=vI?fI.bind:function(e){var t=dI(this),r=t.prototype,n=pI(arguments,1),i=function(){var r=_I(n,pI(arguments));return this instanceof i?yI(t,r.length,r):t.apply(e,r)};return lI(r)&&(i.prototype=r),i},bI=SI;Rr({target:"Function",proto:!0,forced:Function.bind!==bI},{bind:bI});var EI=Us("Function").bind,kI=ae,TI=EI,II=Function.prototype,AI=function(e){var t=e.bind;return e===II||kI(II,e)&&t===II.bind?TI:t};function RI(e){var t;return(RI=Hl?AI(t=Gl).call(t):function(e){return e.__proto__||Gl(e)})(e)}function CI(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=RI(e)););return e}function wI(){var e;"undefined"!=typeof Reflect&&cI?wI=AI(e=cI).call(e):wI=function(e,t,r){var n=CI(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 xI(e,t){var r;return(xI=Hl?AI(r=Hl).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=Vl(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),ad(e,"prototype",{writable:!1}),t&&xI(e,t)}var PI=Rr,MI=d,DI=SI,NI=yp,LI=tr,UI=$,VI=Hn,FI=i,BI=oe("Reflect","construct"),jI=Object.prototype,GI=[].push,HI=FI((function(){function e(){}return!(BI((function(){}),[],e)instanceof e)})),zI=!FI((function(){BI((function(){}))})),KI=HI||zI;PI({target:"Reflect",stat:!0,forced:KI,sham:KI},{construct:function(e,t){NI(e),LI(t);var r=arguments.length<3?e:NI(arguments[2]);if(zI&&!HI)return BI(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 MI(GI,n,t),new(MI(DI,e,n))}var i=r.prototype,o=VI(UI(i)?i:jI),a=MI(e,o,t);return UI(a)?a:o}});var XI=ee.Reflect.construct;function qI(e,t){if(t&&("object"===qd(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return $T(e)}function YI(e){var t=function(){if("undefined"==typeof Reflect||!XI)return!1;if(XI.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(XI(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=RI(e);if(t){var i=RI(this).constructor;r=XI(n,arguments,i)}else r=n.apply(this,arguments);return qI(this,r)}}var WI=Us("Array").values,QI=fn,JI=We,ZI=ae,$I=WI,eA=Array.prototype,tA={DOMTokenList:!0,NodeList:!0},rA=function(e){var t=e.values;return e===eA||ZI(eA,e)&&t===eA.values||JI(tA,QI(e))?$I:t},nA=ni,iA=Math.floor,oA=function(e,t){var r=e.length,n=iA(r/2);return r<8?aA(e,t):sA(e,oA(nA(e,0,n),t),oA(nA(e,n),t),t)},aA=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},sA=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},cA=oA,uA=se.match(/firefox\/(\d+)/i),dA=!!uA&&+uA[1],lA=/MSIE|Trident/.test(se),hA=se.match(/AppleWebKit\/(\d+)\./),pA=!!hA&&+hA[1],vA=Rr,fA=E,_A=we,mA=Xe,gA=Br,yA=LE,SA=gn,bA=i,EA=cA,kA=Iu,TA=dA,IA=lA,AA=ve,RA=pA,CA=[],wA=fA(CA.sort),xA=fA(CA.push),OA=bA((function(){CA.sort(void 0)})),PA=bA((function(){CA.sort(null)})),MA=kA("sort"),DA=!bA((function(){if(AA)return AA<70;if(!(TA&&TA>3)){if(IA)return!0;if(RA)return RA<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++)CA.push({k:t+n,v:r})}for(CA.sort((function(e,t){return t.v-e.v})),n=0;n<CA.length;n++)t=CA[n].k.charAt(0),i.charAt(i.length-1)!==t&&(i+=t);return"DGBEFHACIJK"!==i}}));vA({target:"Array",proto:!0,forced:OA||!PA||!MA||!DA},{sort:function(e){void 0!==e&&_A(e);var t=mA(this);if(DA)return void 0===e?wA(t):wA(t,e);var r,n,i=[],o=gA(t);for(n=0;n<o;n++)n in t&&xA(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:SA(t)>SA(r)?1:-1}}(e)),r=gA(i),n=0;n<r;)t[n]=i[n++];for(;n<o;)yA(t,n++);return t}});var NA=Us("Array").sort,LA=ae,UA=NA,VA=Array.prototype,FA=function(e){var t=e.sort;return e===VA||LA(VA,e)&&t===VA.sort?UA:t},BA=Rr,jA=Do.findIndex,GA="findIndex",HA=!0;GA in[]&&Array(1).findIndex((function(){HA=!1})),BA({target:"Array",proto:!0,forced:HA},{findIndex:function(e){return jA(this,e,arguments.length>1?arguments[1]:void 0)}});var zA=Us("Array").findIndex,KA=ae,XA=zA,qA=Array.prototype,YA=function(e){var t=e.findIndex;return e===qA||KA(qA,e)&&t===qA.findIndex?XA:t},WA=Rr,QA=E;R.f;var JA=Vr,ZA=gn,$A=Pb,eR=q,tR=Db,rR=QA("".startsWith),nR=QA("".slice),iR=Math.min;WA({target:"String",proto:!0,forced:!tR("startsWith")},{startsWith:function(e){var t=ZA(eR(this));$A(e);var r=JA(iR(arguments.length>1?arguments[1]:void 0,t.length)),n=ZA(e);return rR?rR(t,n,r):nR(t,r,r+n.length)===n}});var oR=Us("String").startsWith,aR=ae,sR=oR,cR=String.prototype,uR=function(e){var t=e.startsWith;return"string"==typeof e||e===cR||aR(cR,e)&&t===cR.startsWith?sR:t},dR=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}(dR||{}),lR=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}(lR||{}),hR=Nl((function e(t,r,n){Ll(this,e),Qd(this,"code",void 0),Qd(this,"message",void 0),Qd(this,"error",void 0),this.code=t,this.message=r,this.error=n})),pR=C,vR=E,fR=rn,_R=Q,mR=vR(P.f),gR=vR([].push),yR=function(e){return function(t){for(var r,n=_R(t),i=fR(n),o=i.length,a=0,s=[];o>a;)r=i[a++],pR&&!mR(n,r)||gR(s,e?[r,n[r]]:n[r]);return s}},SR={entries:yR(!0),values:yR(!1)}.entries;Rr({target:"Object",stat:!0},{entries:function(e){return SR(e)}});var bR=ee.Object.entries,ER=Or,kR=gn,TR=q,IR=RangeError,AR=E,RR=Vr,CR=gn,wR=function(e){var t=kR(TR(this)),r="",n=ER(e);if(n<0||n==1/0)throw IR("Wrong number of repetitions");for(;n>0;(n>>>=1)&&(t+=t))1&n&&(r+=t);return r},xR=q,OR=AR(wR),PR=AR("".slice),MR=Math.ceil,DR=function(e){return function(t,r,n){var i,o,a=CR(xR(t)),s=RR(r),c=a.length,u=void 0===n?" ":CR(n);return s<=c||""==u?a:((o=OR(u,MR((i=s-c)/u.length))).length>i&&(o=PR(o,0,i)),e?a+o:o+a)}},NR={start:DR(!1),end:DR(!0)},LR=/Version\/10(?:\.\d+){1,2}(?: [\w./]+)?(?: Mobile\/\w+)? Safari\//.test(se),UR=NR.end;Rr({target:"String",proto:!0,forced:LR},{padEnd:function(e){return UR(this,e,arguments.length>1?arguments[1]:void 0)}});var VR=Us("String").padEnd,FR=ae,BR=VR,jR=String.prototype,GR=function(e){var t=e.padEnd;return"string"==typeof e||e===jR||FR(jR,e)&&t===jR.padEnd?BR:t},HR=ag;Rr({target:"Number",stat:!0,forced:Number.parseInt!=HR},{parseInt:HR});var zR=ee.Number.parseInt,KR=Math.log,XR=Math.LOG10E;Rr({target:"Math",stat:!0},{log10:Math.log10||function(e){return KR(e)*XR}});var qR,YR=ee.Math.log10,WR=new Uint8Array(16);function QR(){if(!qR&&!(qR="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 qR(WR)}var JR=/^(?:[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 ZR(e){return"string"==typeof e&&JR.test(e)}for(var $R=[],eC=0;eC<256;++eC)$R.push((eC+256).toString(16).substr(1));function tC(e,t,r){var n=(e=e||{}).random||(e.rng||QR)();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=($R[e[t+0]]+$R[e[t+1]]+$R[e[t+2]]+$R[e[t+3]]+"-"+$R[e[t+4]]+$R[e[t+5]]+"-"+$R[e[t+6]]+$R[e[t+7]]+"-"+$R[e[t+8]]+$R[e[t+9]]+"-"+$R[e[t+10]]+$R[e[t+11]]+$R[e[t+12]]+$R[e[t+13]]+$R[e[t+14]]+$R[e[t+15]]).toLowerCase();if(!ZR(r))throw TypeError("Stringified UUID is invalid");return r}(n)}var rC=function(){return"undefined"==typeof window},nC=function(){return tC()},iC=function(e){return"number"==typeof e},oC={};!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=bm(Array.prototype).call(arguments,1);t.length;){var n=t.shift();if(n){if("object"!==qd(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)}(oC);var aC={},sC={},cC={},uC=oC;function dC(e){for(var t=e.length;--t>=0;)e[t]=0}var lC=256,hC=286,pC=30,vC=15,fC=[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],_C=[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],mC=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],gC=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],yC=new Array(576);dC(yC);var SC=new Array(60);dC(SC);var bC=new Array(512);dC(bC);var EC=new Array(256);dC(EC);var kC=new Array(29);dC(kC);var TC,IC,AC,RC=new Array(pC);function CC(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 wC(e,t){this.dyn_tree=e,this.max_code=0,this.stat_desc=t}function xC(e){return e<256?bC[e]:bC[256+(e>>>7)]}function OC(e,t){e.pending_buf[e.pending++]=255&t,e.pending_buf[e.pending++]=t>>>8&255}function PC(e,t,r){e.bi_valid>16-r?(e.bi_buf|=t<<e.bi_valid&65535,OC(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 MC(e,t,r){PC(e,r[2*t],r[2*t+1])}function DC(e,t){var r=0;do{r|=1&e,e>>>=1,r<<=1}while(--t>0);return r>>>1}function NC(e,t,r){var n,i,o=new Array(16),a=0;for(n=1;n<=vC;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]=DC(o[s]++,s))}}function LC(e){var t;for(t=0;t<hC;t++)e.dyn_ltree[2*t]=0;for(t=0;t<pC;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 UC(e){e.bi_valid>8?OC(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 VC(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 FC(e,t,r){for(var n=e.heap[r],i=r<<1;i<=e.heap_len&&(i<e.heap_len&&VC(t,e.heap[i+1],e.heap[i],e.depth)&&i++,!VC(t,n,e.heap[i],e.depth));)e.heap[r]=e.heap[i],r=i,i<<=1;e.heap[r]=n}function BC(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?MC(e,i,t):(MC(e,(o=EC[i])+lC+1,t),0!==(a=fC[o])&&PC(e,i-=kC[o],a),MC(e,o=xC(--n),r),0!==(a=_C[o])&&PC(e,n-=RC[o],a))}while(s<e.last_lit);MC(e,256,t)}function jC(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--)FC(e,o,r);i=c;do{r=e.heap[1],e.heap[1]=e.heap[e.heap_len--],FC(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++,FC(e,o,1)}while(e.heap_len>=2);e.heap[--e.heap_max]=e.heap[1],function(e,t){var r,n,i,o,a,s,c=t.dyn_tree,u=t.max_code,d=t.stat_desc.static_tree,l=t.stat_desc.has_stree,h=t.stat_desc.extra_bits,p=t.stat_desc.extra_base,v=t.stat_desc.max_length,f=0;for(o=0;o<=vC;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)>v&&(o=v,f++),c[2*n+1]=o,n>u||(e.bl_count[o]++,a=0,n>=p&&(a=h[n-p]),s=c[2*n],e.opt_len+=s*(o+a),l&&(e.static_len+=s*(d[2*n+1]+a)));if(0!==f){do{for(o=v-1;0===e.bl_count[o];)o--;e.bl_count[o]--,e.bl_count[o+1]+=2,e.bl_count[v]--,f-=2}while(f>0);for(o=v;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),NC(o,u,e.bl_count)}function GC(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 HC(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{MC(e,i,e.bl_tree)}while(0!=--s);else 0!==i?(i!==o&&(MC(e,i,e.bl_tree),s--),MC(e,16,e.bl_tree),PC(e,s-3,2)):s<=10?(MC(e,17,e.bl_tree),PC(e,s-3,3)):(MC(e,18,e.bl_tree),PC(e,s-11,7));s=0,o=i,0===a?(c=138,u=3):i===a?(c=6,u=3):(c=7,u=4)}}dC(RC);var zC=!1;function KC(e,t,r,n){PC(e,0+(n?1:0),3),function(e,t,r,n){UC(e),n&&(OC(e,r),OC(e,~r)),uC.arraySet(e.pending_buf,e.window,t,r,e.pending),e.pending+=r}(e,t,r,!0)}cC._tr_init=function(e){zC||(!function(){var e,t,r,n,i,o=new Array(16);for(r=0,n=0;n<28;n++)for(kC[n]=r,e=0;e<1<<fC[n];e++)EC[r++]=n;for(EC[r-1]=n,i=0,n=0;n<16;n++)for(RC[n]=i,e=0;e<1<<_C[n];e++)bC[i++]=n;for(i>>=7;n<pC;n++)for(RC[n]=i<<7,e=0;e<1<<_C[n]-7;e++)bC[256+i++]=n;for(t=0;t<=vC;t++)o[t]=0;for(e=0;e<=143;)yC[2*e+1]=8,e++,o[8]++;for(;e<=255;)yC[2*e+1]=9,e++,o[9]++;for(;e<=279;)yC[2*e+1]=7,e++,o[7]++;for(;e<=287;)yC[2*e+1]=8,e++,o[8]++;for(NC(yC,287,o),e=0;e<pC;e++)SC[2*e+1]=5,SC[2*e]=DC(e,5);TC=new CC(yC,fC,257,hC,vC),IC=new CC(SC,_C,0,pC,vC),AC=new CC(new Array(0),mC,0,19,7)}(),zC=!0),e.l_desc=new wC(e.dyn_ltree,TC),e.d_desc=new wC(e.dyn_dtree,IC),e.bl_desc=new wC(e.bl_tree,AC),e.bi_buf=0,e.bi_valid=0,LC(e)},cC._tr_stored_block=KC,cC._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<lC;t++)if(0!==e.dyn_ltree[2*t])return 1;return 0}(e)),jC(e,e.l_desc),jC(e,e.d_desc),a=function(e){var t;for(GC(e,e.dyn_ltree,e.l_desc.max_code),GC(e,e.dyn_dtree,e.d_desc.max_code),jC(e,e.bl_desc),t=18;t>=3&&0===e.bl_tree[2*gC[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?KC(e,t,r,n):4===e.strategy||o===i?(PC(e,2+(n?1:0),3),BC(e,yC,SC)):(PC(e,4+(n?1:0),3),function(e,t,r,n){var i;for(PC(e,t-257,5),PC(e,r-1,5),PC(e,n-4,4),i=0;i<n;i++)PC(e,e.bl_tree[2*gC[i]+1],3);HC(e,e.dyn_ltree,t-1),HC(e,e.dyn_dtree,r-1)}(e,e.l_desc.max_code+1,e.d_desc.max_code+1,a+1),BC(e,e.dyn_ltree,e.dyn_dtree)),LC(e),n&&UC(e)},cC._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*(EC[r]+lC+1)]++,e.dyn_dtree[2*xC(t)]++),e.last_lit===e.lit_bufsize-1},cC._tr_align=function(e){PC(e,2,3),MC(e,256,yC),function(e){16===e.bi_valid?(OC(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 XC=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 qC=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 YC,WC=function(e,t,r,n){var i=qC,o=n+r;e^=-1;for(var a=n;a<o;a++)e=e>>>8^i[255&(e^t[a])];return-1^e},QC={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"},JC=oC,ZC=cC,$C=XC,ew=WC,tw=QC,rw=-2,nw=258,iw=262,ow=103,aw=113,sw=666;function cw(e,t){return e.msg=tw[t],t}function uw(e){return(e<<1)-(e>4?9:0)}function dw(e){for(var t=e.length;--t>=0;)e[t]=0}function lw(e){var t=e.state,r=t.pending;r>e.avail_out&&(r=e.avail_out),0!==r&&(JC.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 hw(e,t){ZC._tr_flush_block(e,e.block_start>=0?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,lw(e.strm)}function pw(e,t){e.pending_buf[e.pending++]=t}function vw(e,t){e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=255&t}function fw(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-iw?e.strstart-(e.w_size-iw):0,u=e.window,d=e.w_mask,l=e.prev,h=e.strstart+nw,p=u[o+a-1],v=u[o+a];e.prev_length>=e.good_match&&(i>>=2),s>e.lookahead&&(s=e.lookahead);do{if(u[(r=t)+a]===v&&u[r+a-1]===p&&u[r]===u[o]&&u[++r]===u[o+1]){o+=2,r++;do{}while(u[++o]===u[++r]&&u[++o]===u[++r]&&u[++o]===u[++r]&&u[++o]===u[++r]&&u[++o]===u[++r]&&u[++o]===u[++r]&&u[++o]===u[++r]&&u[++o]===u[++r]&&o<h);if(n=nw-(h-o),o=h-nw,n>a){if(e.match_start=t,a=n,n>=s)break;p=u[o+a-1],v=u[o+a]}}}while((t=l[t&d])>c&&0!=--i);return a<=e.lookahead?a:e.lookahead}function _w(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-iw)){JC.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,JC.arraySet(s,a.input,a.next_in,d,c),1===a.state.wrap?a.adler=$C(a.adler,s,d,c):2===a.state.wrap&&(a.adler=ew(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<iw&&0!==e.strm.avail_in)}function mw(e,t){for(var r,n;;){if(e.lookahead<iw){if(_w(e),e.lookahead<iw&&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-iw&&(e.match_length=fw(e,r)),e.match_length>=3)if(n=ZC._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=ZC._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++;if(n&&(hw(e,!1),0===e.strm.avail_out))return 1}return e.insert=e.strstart<2?e.strstart:2,4===t?(hw(e,!0),0===e.strm.avail_out?3:4):e.last_lit&&(hw(e,!1),0===e.strm.avail_out)?1:2}function gw(e,t){for(var r,n,i;;){if(e.lookahead<iw){if(_w(e),e.lookahead<iw&&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-iw&&(e.match_length=fw(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=ZC._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&&(hw(e,!1),0===e.strm.avail_out))return 1}else if(e.match_available){if((n=ZC._tr_tally(e,0,e.window[e.strstart-1]))&&hw(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=ZC._tr_tally(e,0,e.window[e.strstart-1]),e.match_available=0),e.insert=e.strstart<2?e.strstart:2,4===t?(hw(e,!0),0===e.strm.avail_out?3:4):e.last_lit&&(hw(e,!1),0===e.strm.avail_out)?1:2}function yw(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 Sw(){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 JC.Buf16(1146),this.dyn_dtree=new JC.Buf16(122),this.bl_tree=new JC.Buf16(78),dw(this.dyn_ltree),dw(this.dyn_dtree),dw(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new JC.Buf16(16),this.heap=new JC.Buf16(573),dw(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new JC.Buf16(573),dw(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 bw(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:aw,e.adler=2===t.wrap?0:1,t.last_flush=0,ZC._tr_init(t),0):cw(e,rw)}function Ew(e){var t,r=bw(e);return 0===r&&((t=e.state).window_size=2*t.w_size,dw(t.head),t.max_lazy_match=YC[t.level].max_lazy,t.good_match=YC[t.level].good_length,t.nice_match=YC[t.level].nice_length,t.max_chain_length=YC[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 kw(e,t,r,n,i,o){if(!e)return rw;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 cw(e,rw);8===n&&(n=9);var s=new Sw;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 JC.Buf8(2*s.w_size),s.head=new JC.Buf16(s.hash_size),s.prev=new JC.Buf16(s.w_size),s.lit_bufsize=1<<i+6,s.pending_buf_size=4*s.lit_bufsize,s.pending_buf=new JC.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,Ew(e)}YC=[new yw(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(_w(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,hw(e,!1),0===e.strm.avail_out))return 1;if(e.strstart-e.block_start>=e.w_size-iw&&(hw(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,4===t?(hw(e,!0),0===e.strm.avail_out?3:4):(e.strstart>e.block_start&&(hw(e,!1),e.strm.avail_out),1)})),new yw(4,4,8,4,mw),new yw(4,5,16,8,mw),new yw(4,6,32,32,mw),new yw(4,4,16,16,gw),new yw(8,16,32,32,gw),new yw(8,16,128,128,gw),new yw(8,32,128,256,gw),new yw(32,128,258,1024,gw),new yw(32,258,258,4096,gw)],sC.deflateInit=function(e,t){return kw(e,t,8,15,8,0)},sC.deflateInit2=kw,sC.deflateReset=Ew,sC.deflateResetKeep=bw,sC.deflateSetHeader=function(e,t){return e&&e.state?2!==e.state.wrap?rw:(e.state.gzhead=t,0):rw},sC.deflate=function(e,t){var r,n,i,o;if(!e||!e.state||t>5||t<0)return e?cw(e,rw):rw;if(n=e.state,!e.output||!e.input&&0!==e.avail_in||n.status===sw&&4!==t)return cw(e,0===e.avail_out?-5:rw);if(n.strm=e,r=n.last_flush,n.last_flush=t,42===n.status)if(2===n.wrap)e.adler=0,pw(n,31),pw(n,139),pw(n,8),n.gzhead?(pw(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)),pw(n,255&n.gzhead.time),pw(n,n.gzhead.time>>8&255),pw(n,n.gzhead.time>>16&255),pw(n,n.gzhead.time>>24&255),pw(n,9===n.level?2:n.strategy>=2||n.level<2?4:0),pw(n,255&n.gzhead.os),n.gzhead.extra&&n.gzhead.extra.length&&(pw(n,255&n.gzhead.extra.length),pw(n,n.gzhead.extra.length>>8&255)),n.gzhead.hcrc&&(e.adler=ew(e.adler,n.pending_buf,n.pending,0)),n.gzindex=0,n.status=69):(pw(n,0),pw(n,0),pw(n,0),pw(n,0),pw(n,0),pw(n,9===n.level?2:n.strategy>=2||n.level<2?4:0),pw(n,3),n.status=aw);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=aw,vw(n,a),0!==n.strstart&&(vw(n,e.adler>>>16),vw(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=ew(e.adler,n.pending_buf,n.pending-i,i)),lw(e),i=n.pending,n.pending!==n.pending_buf_size));)pw(n,255&n.gzhead.extra[n.gzindex]),n.gzindex++;n.gzhead.hcrc&&n.pending>i&&(e.adler=ew(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=ew(e.adler,n.pending_buf,n.pending-i,i)),lw(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,pw(n,o)}while(0!==o);n.gzhead.hcrc&&n.pending>i&&(e.adler=ew(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=ew(e.adler,n.pending_buf,n.pending-i,i)),lw(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,pw(n,o)}while(0!==o);n.gzhead.hcrc&&n.pending>i&&(e.adler=ew(e.adler,n.pending_buf,n.pending-i,i)),0===o&&(n.status=ow)}else n.status=ow;if(n.status===ow&&(n.gzhead.hcrc?(n.pending+2>n.pending_buf_size&&lw(e),n.pending+2<=n.pending_buf_size&&(pw(n,255&e.adler),pw(n,e.adler>>8&255),e.adler=0,n.status=aw)):n.status=aw),0!==n.pending){if(lw(e),0===e.avail_out)return n.last_flush=-1,0}else if(0===e.avail_in&&uw(t)<=uw(r)&&4!==t)return cw(e,-5);if(n.status===sw&&0!==e.avail_in)return cw(e,-5);if(0!==e.avail_in||0!==n.lookahead||0!==t&&n.status!==sw){var s=2===n.strategy?function(e,t){for(var r;;){if(0===e.lookahead&&(_w(e),0===e.lookahead)){if(0===t)return 1;break}if(e.match_length=0,r=ZC._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,r&&(hw(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,4===t?(hw(e,!0),0===e.strm.avail_out?3:4):e.last_lit&&(hw(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<=nw){if(_w(e),e.lookahead<=nw&&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+nw;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=nw-(o-i),e.match_length>e.lookahead&&(e.match_length=e.lookahead)}if(e.match_length>=3?(r=ZC._tr_tally(e,1,e.match_length-3),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(r=ZC._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),r&&(hw(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,4===t?(hw(e,!0),0===e.strm.avail_out?3:4):e.last_lit&&(hw(e,!1),0===e.strm.avail_out)?1:2}(n,t):YC[n.level].func(n,t);if(3!==s&&4!==s||(n.status=sw),1===s||3===s)return 0===e.avail_out&&(n.last_flush=-1),0;if(2===s&&(1===t?ZC._tr_align(n):5!==t&&(ZC._tr_stored_block(n,0,0,!1),3===t&&(dw(n.head),0===n.lookahead&&(n.strstart=0,n.block_start=0,n.insert=0))),lw(e),0===e.avail_out))return n.last_flush=-1,0}return 4!==t?0:n.wrap<=0?1:(2===n.wrap?(pw(n,255&e.adler),pw(n,e.adler>>8&255),pw(n,e.adler>>16&255),pw(n,e.adler>>24&255),pw(n,255&e.total_in),pw(n,e.total_in>>8&255),pw(n,e.total_in>>16&255),pw(n,e.total_in>>24&255)):(vw(n,e.adler>>>16),vw(n,65535&e.adler)),lw(e),n.wrap>0&&(n.wrap=-n.wrap),0!==n.pending?0:1)},sC.deflateEnd=function(e){var t;return e&&e.state?42!==(t=e.state.status)&&69!==t&&73!==t&&91!==t&&t!==ow&&t!==aw&&t!==sw?cw(e,rw):(e.state=null,t===aw?cw(e,-3):0):rw},sC.deflateSetDictionary=function(e,t){var r,n,i,o,a,s,c,u,d=t.length;if(!e||!e.state)return rw;if(2===(o=(r=e.state).wrap)||1===o&&42!==r.status||r.lookahead)return rw;for(1===o&&(e.adler=$C(e.adler,t,d,0)),r.wrap=0,d>=r.w_size&&(0===o&&(dw(r.head),r.strstart=0,r.block_start=0,r.insert=0),u=new JC.Buf8(r.w_size),JC.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,_w(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,_w(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},sC.deflateInfo="pako deflate (from Nodeca project)";var Tw={},Iw=oC,Aw=!0,Rw=!0;try{String.fromCharCode.apply(null,[0])}catch(cq){Aw=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(cq){Rw=!1}for(var Cw=new Iw.Buf8(256),ww=0;ww<256;ww++)Cw[ww]=ww>=252?6:ww>=248?5:ww>=240?4:ww>=224?3:ww>=192?2:1;function xw(e,t){if(t<65534&&(e.subarray&&Rw||!e.subarray&&Aw))return String.fromCharCode.apply(null,Iw.shrinkBuf(e,t));for(var r="",n=0;n<t;n++)r+=String.fromCharCode(e[n]);return r}Cw[254]=Cw[254]=1,Tw.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 Iw.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},Tw.buf2binstring=function(e){return xw(e,e.length)},Tw.binstring2buf=function(e){for(var t=new Iw.Buf8(e.length),r=0,n=t.length;r<n;r++)t[r]=e.charCodeAt(r);return t},Tw.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=Cw[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 xw(s,n)},Tw.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+Cw[e[r]]>t?r:t};var Ow=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},Pw=sC,Mw=oC,Dw=Tw,Nw=QC,Lw=Ow,Uw=Object.prototype.toString;function Vw(e){if(!(this instanceof Vw))return new Vw(e);this.options=Mw.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 Lw,this.strm.avail_out=0;var r=Pw.deflateInit2(this.strm,t.level,t.method,t.windowBits,t.memLevel,t.strategy);if(0!==r)throw new Error(Nw[r]);if(t.header&&Pw.deflateSetHeader(this.strm,t.header),t.dictionary){var n;if(n="string"==typeof t.dictionary?Dw.string2buf(t.dictionary):"[object ArrayBuffer]"===Uw.call(t.dictionary)?new Uint8Array(t.dictionary):t.dictionary,0!==(r=Pw.deflateSetDictionary(this.strm,n)))throw new Error(Nw[r]);this._dict_set=!0}}function Fw(e,t){var r=new Vw(t);if(r.push(e,!0),r.err)throw r.msg||Nw[r.err];return r.result}Vw.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=Dw.string2buf(e):"[object ArrayBuffer]"===Uw.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 Mw.Buf8(o),i.next_out=0,i.avail_out=o),1!==(r=Pw.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(Dw.buf2binstring(Mw.shrinkBuf(i.output,i.next_out))):this.onData(Mw.shrinkBuf(i.output,i.next_out)))}while((i.avail_in>0||0===i.avail_out)&&1!==r);return 4===n?(r=Pw.deflateEnd(this.strm),this.onEnd(r),this.ended=!0,0===r):2!==n||(this.onEnd(0),i.avail_out=0,!0)},Vw.prototype.onData=function(e){this.chunks.push(e)},Vw.prototype.onEnd=function(e){0===e&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=Mw.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg},aC.Deflate=Vw,aC.deflate=Fw,aC.deflateRaw=function(e,t){return(t=t||{}).raw=!0,Fw(e,t)},aC.gzip=function(e,t){return(t=t||{}).gzip=!0,Fw(e,t)};var Bw={},jw=tr,Gw=O,Hw=We,zw=ae,Kw=function(){var e=jw(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},Xw=RegExp.prototype,qw=ae,Yw=function(e){var t=e.flags;return void 0!==t||"flags"in Xw||Hw(e,"flags")||!zw(Xw,e)?t:Gw(Kw,e)},Ww=RegExp.prototype,Qw=function(e){return e===Ww||qw(Ww,e)?Yw(e):e.flags},Jw={},Zw=oC,$w=15,ex=[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],tx=[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],rx=[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],nx=[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],ix=oC,ox=XC,ax=WC,sx=function(e,t){var r,n,i,o,a,s,c,u,d,l,h,p,v,f,_,m,g,y,S,b,E,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,p=r.hold,v=r.bits,f=r.lencode,_=r.distcode,m=(1<<r.lenbits)-1,g=(1<<r.distbits)-1;e:do{v<15&&(p+=I[n++]<<v,v+=8,p+=I[n++]<<v,v+=8),y=f[p&m];t:for(;;){if(p>>>=S=y>>>24,v-=S,0===(S=y>>>16&255))A[o++]=65535&y;else{if(!(16&S)){if(0==(64&S)){y=f[(65535&y)+(p&(1<<S)-1)];continue t}if(32&S){r.mode=12;break e}e.msg="invalid literal/length code",r.mode=30;break e}b=65535&y,(S&=15)&&(v<S&&(p+=I[n++]<<v,v+=8),b+=p&(1<<S)-1,p>>>=S,v-=S),v<15&&(p+=I[n++]<<v,v+=8,p+=I[n++]<<v,v+=8),y=_[p&g];r:for(;;){if(p>>>=S=y>>>24,v-=S,!(16&(S=y>>>16&255))){if(0==(64&S)){y=_[(65535&y)+(p&(1<<S)-1)];continue r}e.msg="invalid distance code",r.mode=30;break e}if(E=65535&y,v<(S&=15)&&(p+=I[n++]<<v,(v+=8)<S&&(p+=I[n++]<<v,v+=8)),(E+=p&(1<<S)-1)>c){e.msg="invalid distance too far back",r.mode=30;break e}if(p>>>=S,v-=S,E>(S=o-a)){if((S=E-S)>d&&r.sane){e.msg="invalid distance too far back",r.mode=30;break e}if(k=0,T=h,0===l){if(k+=u-S,S<b){b-=S;do{A[o++]=h[k++]}while(--S);k=o-E,T=A}}else if(l<S){if(k+=u+l-S,(S-=l)<b){b-=S;do{A[o++]=h[k++]}while(--S);if(k=0,l<b){b-=S=l;do{A[o++]=h[k++]}while(--S);k=o-E,T=A}}}else if(k+=l-S,S<b){b-=S;do{A[o++]=h[k++]}while(--S);k=o-E,T=A}for(;b>2;)A[o++]=T[k++],A[o++]=T[k++],A[o++]=T[k++],b-=3;b&&(A[o++]=T[k++],b>1&&(A[o++]=T[k++]))}else{k=o-E;do{A[o++]=A[k++],A[o++]=A[k++],A[o++]=A[k++],b-=3}while(b>2);b&&(A[o++]=A[k++],b>1&&(A[o++]=A[k++]))}break}}break}}while(n<i&&o<s);n-=b=v>>3,p&=(1<<(v-=b<<3))-1,e.next_in=n,e.next_out=o,e.avail_in=n<i?i-n+5:5-(n-i),e.avail_out=o<s?s-o+257:257-(o-s),r.hold=p,r.bits=v},cx=function(e,t,r,n,i,o,a,s){var c,u,d,l,h,p,v,f,_,m=s.bits,g=0,y=0,S=0,b=0,E=0,k=0,T=0,I=0,A=0,R=0,C=null,w=0,x=new Zw.Buf16(16),O=new Zw.Buf16(16),P=null,M=0;for(g=0;g<=$w;g++)x[g]=0;for(y=0;y<n;y++)x[t[r+y]]++;for(E=m,b=$w;b>=1&&0===x[b];b--);if(E>b&&(E=b),0===b)return i[o++]=20971520,i[o++]=20971520,s.bits=1,0;for(S=1;S<b&&0===x[S];S++);for(E<S&&(E=S),I=1,g=1;g<=$w;g++)if(I<<=1,(I-=x[g])<0)return-1;if(I>0&&(0===e||1!==b))return-1;for(O[1]=0,g=1;g<$w;g++)O[g+1]=O[g]+x[g];for(y=0;y<n;y++)0!==t[r+y]&&(a[O[t[r+y]]++]=y);if(0===e?(C=P=a,p=19):1===e?(C=ex,w-=257,P=tx,M-=257,p=256):(C=rx,P=nx,p=-1),R=0,y=0,g=S,h=o,k=E,T=0,d=-1,l=(A=1<<E)-1,1===e&&A>852||2===e&&A>592)return 1;for(;;){v=g-T,a[y]<p?(f=0,_=a[y]):a[y]>p?(f=P[M+a[y]],_=C[w+a[y]]):(f=96,_=0),c=1<<g-T,S=u=1<<k;do{i[h+(R>>T)+(u-=c)]=v<<24|f<<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==--x[g]){if(g===b)break;g=t[r+a[y]]}if(g>E&&(R&l)!==d){for(0===T&&(T=E),h+=S,I=1<<(k=g-T);k+T<b&&!((I-=x[k+T])<=0);)k++,I<<=1;if(A+=1<<k,1===e&&A>852||2===e&&A>592)return 1;i[d=R&l]=E<<24|k<<16|h-o|0}}return 0!==R&&(i[h+R]=g-T<<24|64<<16|0),s.bits=E,0},ux=-2,dx=12,lx=30;function hx(e){return(e>>>24&255)+(e>>>8&65280)+((65280&e)<<8)+((255&e)<<24)}function px(){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 ix.Buf16(320),this.work=new ix.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function vx(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 ix.Buf32(852),t.distcode=t.distdyn=new ix.Buf32(592),t.sane=1,t.back=-1,0):ux}function fx(e){var t;return e&&e.state?((t=e.state).wsize=0,t.whave=0,t.wnext=0,vx(e)):ux}function _x(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)?ux:(null!==n.window&&n.wbits!==t&&(n.window=null),n.wrap=r,n.wbits=t,fx(e))):ux}function mx(e,t){var r,n;return e?(n=new px,e.state=n,n.window=null,0!==(r=_x(e,t))&&(e.state=null),r):ux}var gx,yx,Sx=!0;function bx(e){if(Sx){var t;for(gx=new ix.Buf32(512),yx=new ix.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(cx(1,e.lens,0,288,gx,0,e.work,{bits:9}),t=0;t<32;)e.lens[t++]=5;cx(2,e.lens,0,32,yx,0,e.work,{bits:5}),Sx=!1}e.lencode=gx,e.lenbits=9,e.distcode=yx,e.distbits=5}function Ex(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 ix.Buf8(o.wsize)),n>=o.wsize?(ix.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),ix.arraySet(o.window,t,r-n,i,o.wnext),(n-=i)?(ix.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}Jw.inflateReset=fx,Jw.inflateReset2=_x,Jw.inflateResetKeep=vx,Jw.inflateInit=function(e){return mx(e,15)},Jw.inflateInit2=mx,Jw.inflate=function(e,t){var r,n,i,o,a,s,c,u,d,l,h,p,v,f,_,m,g,y,S,b,E,k,T,I,A=0,R=new ix.Buf8(4),C=[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 ux;(r=e.state).mode===dx&&(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=ax(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=lx;break}if(8!=(15&u)){e.msg="unknown compression method",r.mode=lx;break}if(d-=4,E=8+(15&(u>>>=4)),0===r.wbits)r.wbits=E;else if(E>r.wbits){e.msg="invalid window size",r.mode=lx;break}r.dmax=1<<E,e.adler=r.check=1,r.mode=512&u?10:dx,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&Qw(r))){e.msg="unknown compression method",r.mode=lx;break}if(57344&Qw(r)){e.msg="unknown header flags set",r.mode=lx;break}r.head&&(r.head.text=u>>8&1),512&Qw(r)&&(R[0]=255&u,R[1]=u>>>8&255,r.check=ax(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&Qw(r)&&(R[0]=255&u,R[1]=u>>>8&255,R[2]=u>>>16&255,R[3]=u>>>24&255,r.check=ax(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&Qw(r)&&(R[0]=255&u,R[1]=u>>>8&255,r.check=ax(r.check,R,2,0)),u=0,d=0,r.mode=5;case 5:if(1024&Qw(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&Qw(r)&&(R[0]=255&u,R[1]=u>>>8&255,r.check=ax(r.check,R,2,0)),u=0,d=0}else r.head&&(r.head.extra=null);r.mode=6;case 6:if(1024&Qw(r)&&((p=r.length)>s&&(p=s),p&&(r.head&&(E=r.head.extra_len-r.length,r.head.extra||(r.head.extra=new Array(r.head.extra_len)),ix.arraySet(r.head.extra,n,o,p,E)),512&Qw(r)&&(r.check=ax(r.check,n,p,o)),s-=p,o+=p,r.length-=p),r.length))break e;r.length=0,r.mode=7;case 7:if(2048&Qw(r)){if(0===s)break e;p=0;do{E=n[o+p++],r.head&&E&&r.length<65536&&(r.head.name+=String.fromCharCode(E))}while(E&&p<s);if(512&Qw(r)&&(r.check=ax(r.check,n,p,o)),s-=p,o+=p,E)break e}else r.head&&(r.head.name=null);r.length=0,r.mode=8;case 8:if(4096&Qw(r)){if(0===s)break e;p=0;do{E=n[o+p++],r.head&&E&&r.length<65536&&(r.head.comment+=String.fromCharCode(E))}while(E&&p<s);if(512&Qw(r)&&(r.check=ax(r.check,n,p,o)),s-=p,o+=p,E)break e}else r.head&&(r.head.comment=null);r.mode=9;case 9:if(512&Qw(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=lx;break}u=0,d=0}r.head&&(r.head.hcrc=Qw(r)>>9&1,r.head.done=!0),e.adler=r.check=0,r.mode=dx;break;case 10:for(;d<32;){if(0===s)break e;s--,u+=n[o++]<<d,d+=8}e.adler=r.check=hx(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=dx;case dx: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(bx(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=lx}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=lx;break}if(r.length=65535&u,u=0,d=0,r.mode=15,6===t)break e;case 15:r.mode=16;case 16:if(p=r.length){if(p>s&&(p=s),p>c&&(p=c),0===p)break e;ix.arraySet(i,n,o,p,a),s-=p,o+=p,c-=p,a+=p,r.length-=p;break}r.mode=dx;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=lx;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[C[r.have++]]=7&u,u>>>=3,d-=3}for(;r.have<19;)r.lens[C[r.have++]]=0;if(r.lencode=r.lendyn,r.lenbits=7,T={bits:r.lenbits},k=cx(0,r.lens,0,19,r.lencode,0,r.work,T),r.lenbits=T.bits,k){e.msg="invalid code lengths set",r.mode=lx;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=lx;break}E=r.lens[r.have-1],p=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-=_,E=0,p=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-=_,E=0,p=11+(127&(u>>>=_)),u>>>=7,d-=7}if(r.have+p>r.nlen+r.ndist){e.msg="invalid bit length repeat",r.mode=lx;break}for(;p--;)r.lens[r.have++]=E}}if(r.mode===lx)break;if(0===r.lens[256]){e.msg="invalid code -- missing end-of-block",r.mode=lx;break}if(r.lenbits=9,T={bits:r.lenbits},k=cx(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=lx;break}if(r.distbits=6,r.distcode=r.distdyn,T={bits:r.distbits},k=cx(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=lx;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,sx(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===dx&&(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,b=g;m=(A=r.lencode[b+((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=dx;break}if(64&m){e.msg="invalid literal/length code",r.mode=lx;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,b=g;m=(A=r.distcode[b+((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=lx;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=lx;break}r.mode=25;case 25:if(0===c)break e;if(p=h-c,r.offset>p){if((p=r.offset-p)>r.whave&&r.sane){e.msg="invalid distance too far back",r.mode=lx;break}p>r.wnext?(p-=r.wnext,v=r.wsize-p):v=r.wnext-p,p>r.length&&(p=r.length),f=r.window}else f=i,v=a-r.offset,p=r.length;p>c&&(p=c),c-=p,r.length-=p;do{i[a++]=f[v++]}while(--p);0===r.length&&(r.mode=21);break;case 26:if(0===c)break e;i[a++]=r.length,c--,r.mode=21;break;case 27:if(r.wrap){for(;d<32;){if(0===s)break e;s--,u|=n[o++]<<d,d+=8}if(h-=c,e.total_out+=h,r.total+=h,h&&(e.adler=r.check=Qw(r)?ax(r.check,i,h,a-h):ox(r.check,i,h,a-h)),h=c,(Qw(r)?u:hx(u))!==r.check){e.msg="incorrect data check",r.mode=lx;break}u=0,d=0}r.mode=28;case 28:if(r.wrap&&Qw(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=lx;break}u=0,d=0}r.mode=29;case 29:k=1;break e;case lx:k=-3;break e;case 31:return-4;default:return ux}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<lx&&(r.mode<27||4!==t))&&Ex(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=Qw(r)?ax(r.check,i,h,e.next_out-h):ox(r.check,i,h,e.next_out-h)),e.data_type=r.bits+(r.last?64:0)+(r.mode===dx?128:0)+(20===r.mode||15===r.mode?256:0),(0===l&&0===h||4===t)&&0===k&&(k=-5),k},Jw.inflateEnd=function(e){if(!e||!e.state)return ux;var t=e.state;return t.window&&(t.window=null),e.state=null,0},Jw.inflateGetHeader=function(e,t){var r;return e&&e.state?0==(2&(r=e.state).wrap)?ux:(r.head=t,t.done=!1,0):ux},Jw.inflateSetDictionary=function(e,t){var r,n=t.length;return e&&e.state?0!==(r=e.state).wrap&&11!==r.mode?ux:11===r.mode&&ox(1,t,n,0)!==r.check?-3:Ex(e,t,n,n)?(r.mode=31,-4):(r.havedict=1,0):ux},Jw.inflateInfo="pako inflate (from Nodeca project)";var kx={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 Tx=Jw,Ix=oC,Ax=Tw,Rx=kx,Cx=QC,wx=Ow,xx=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},Ox=Object.prototype.toString;function Px(e){if(!(this instanceof Px))return new Px(e);this.options=Ix.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 wx,this.strm.avail_out=0;var r=Tx.inflateInit2(this.strm,t.windowBits);if(r!==Rx.Z_OK)throw new Error(Cx[r]);if(this.header=new xx,Tx.inflateGetHeader(this.strm,this.header),t.dictionary&&("string"==typeof t.dictionary?t.dictionary=Ax.string2buf(t.dictionary):"[object ArrayBuffer]"===Ox.call(t.dictionary)&&(t.dictionary=new Uint8Array(t.dictionary)),t.raw&&(r=Tx.inflateSetDictionary(this.strm,t.dictionary))!==Rx.Z_OK))throw new Error(Cx[r])}function Mx(e,t){var r=new Px(t);if(r.push(e,!0),r.err)throw r.msg||Cx[r.err];return r.result}Px.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?Rx.Z_FINISH:Rx.Z_NO_FLUSH,"string"==typeof e?s.input=Ax.binstring2buf(e):"[object ArrayBuffer]"===Ox.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 Ix.Buf8(c),s.next_out=0,s.avail_out=c),(r=Tx.inflate(s,Rx.Z_NO_FLUSH))===Rx.Z_NEED_DICT&&u&&(r=Tx.inflateSetDictionary(this.strm,u)),r===Rx.Z_BUF_ERROR&&!0===d&&(r=Rx.Z_OK,d=!1),r!==Rx.Z_STREAM_END&&r!==Rx.Z_OK)return this.onEnd(r),this.ended=!0,!1;s.next_out&&(0!==s.avail_out&&r!==Rx.Z_STREAM_END&&(0!==s.avail_in||n!==Rx.Z_FINISH&&n!==Rx.Z_SYNC_FLUSH)||("string"===this.options.to?(i=Ax.utf8border(s.output,s.next_out),o=s.next_out-i,a=Ax.buf2string(s.output,i),s.next_out=o,s.avail_out=c-o,o&&Ix.arraySet(s.output,s.output,i,o,0),this.onData(a)):this.onData(Ix.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!==Rx.Z_STREAM_END);return r===Rx.Z_STREAM_END&&(n=Rx.Z_FINISH),n===Rx.Z_FINISH?(r=Tx.inflateEnd(this.strm),this.onEnd(r),this.ended=!0,r===Rx.Z_OK):n!==Rx.Z_SYNC_FLUSH||(this.onEnd(Rx.Z_OK),s.avail_out=0,!0)},Px.prototype.onData=function(e){this.chunks.push(e)},Px.prototype.onEnd=function(e){e===Rx.Z_OK&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=Ix.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg},Bw.Inflate=Px,Bw.inflate=Mx,Bw.inflateRaw=function(e,t){return(t=t||{}).raw=!0,Mx(e,t)},Bw.ungzip=Mx;var Dx={};(0,oC.assign)(Dx,aC,Bw,kx);var Nx,Lx=Dx,Ux="BytePlusRTC",Vx=function(){return window.indexedDB||window.mozIndexedDB||window.webkitIndexedDB||window.msIndexedDB},Fx=function(){function e(t){Ll(this,e),Qd(this,"storeName",void 0),Qd(this,"pendingList",[]),this.storeName=t,!rC()&&Vx()&&this._checkAndCreateStore(t)}var t,r;return Nl(e,[{key:"_checkAndCreateStore",value:function(t,r){var n=this;e.db&&e.db.close();var i=r?Vx().open(Ux,r):Vx().open(Ux);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=Tm(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 q_((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=Tm(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 q_((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=Tm(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 q_((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}();Qd(Fx,"db",void 0),Qd(Fx,"state","init");var Bx,jx={product_line:"rtc",report_version:"5",os:"web",user_agent:rC()?"":null===(Nx=navigator)||void 0===Nx?void 0:Nx.userAgent,platform:"web",product:"webrtc",app_state:"active"},Gx="ReportErrorBuffer",Hx=function(){function e(){Ll(this,e),Qd(this,"_buffer",new Fx(Gx))}var t,r;return Nl(e,[{key:"set",value:(r=Tm(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,Gx);case 2:case"end":return e.stop()}}),e,this)}))),function(e){return r.apply(this,arguments)})},{key:"get",value:(t=Tm(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(Gx);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}(),zx=function(){function e(){var t=this;Ll(this,e),Qd(this,"report_common",jx),Qd(this,"dataBuffer",[]),Qd(this,"posting",!1),Qd(this,"sucSendTimer",void 0),Qd(this,"preSucTime",0),Qd(this,"errSendTimer",void 0),Qd(this,"errSendDelay",100),Qd(this,"errSendBuffer",void 0),Qd(this,"_logServerUrl",void 0),Qd(this,"_retryCount",0),rC()||(window.addEventListener("beforeunload",(function(){clearTimeout(t.errSendTimer),clearTimeout(t.sucSendTimer),t._send(void 0,!0)})),document.addEventListener("visibilitychange",(function(){"visible"===document.visibilityState?t.setCommonStats({app_state:"active"}):"hidden"===document.visibilityState&&t.setCommonStats({app_state:"background"})})))}var t;return Nl(e,[{key:"setUrl",value:function(e){this._logServerUrl=e}},{key:"setCommonStats",value:function(e){this.report_common=Ab(this.report_common,e)}},{key:"enableErrorBuffer",value:function(){this.errSendBuffer=new Hx,this.loadErrorBuffer()}},{key:"push",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];t?this._send(e):(this.dataBuffer.push(e),!this.posting&&!this.errSendTimer&&Date.now()-this.preSucTime>2e3&&(clearTimeout(this.sucSendTimer),this._send()))}},{key:"_unshift",value:function(e){this.dataBuffer=wm(e).call(e,this.dataBuffer)}},{key:"_send",value:function(e,t){var r,n,i=this;if((e||this.dataBuffer.length)&&this._logServerUrl){var o={data:e||ek(r=this.dataBuffer).call(r,0,4e3),header:Zd(Zd({},this.report_common),{},{http_retry_count:this._retryCount}),from:"web",os:"web",version:"1"},a=new XMLHttpRequest;if(a.timeout=1e4,a.onreadystatechange=function(){if(4===a.readyState){var r,n,s,c;if(e||(i.posting=!1),200===a.status||304===a.status)try{r=JSON.parse(a.responseText)}catch(sq){n=sq}if(r&&0===r.StatusCode){if(!e&&!t)null===(s=i.errSendBuffer)||void 0===s||s.set([]),i._sucSend()}else if(setTimeout((function(){var e,t;SO(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===(c=i.errSendBuffer)||void 0===c||c.set(Yk(i.dataBuffer)),t?i._send():i._errSend()}},a.open("POST",this._logServerUrl,!0),e||(this.posting=!0),!rC()&&fk(n=location.search).call(n,"_rtc_debug_"))a.send(Mm(o));else{var s=Lx.gzip(Mm(o));a.setRequestHeader("Content-Encoding","gzip"),a.setRequestHeader("Content-Type","application/x-www-form-urlencoded; charset=UTF-8"),a.send(s)}}}},{key:"_sucSend",value:function(){this.errSendDelay=100,this._retryCount=0,this.preSucTime=Date.now(),this.sucSendTimer=window.setTimeout(this._send.bind(this),2e3)}},{key:"_errSend",value:function(){var e=this;this.errSendTimer=window.setTimeout((function(){e._send(),delete e.errSendTimer}),this.errSendDelay),this.errSendDelay*=2,this._retryCount++}},{key:"loadErrorBuffer",value:(t=Tm(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)})}]),e}(),Kx=new zx,Xx=function(){function e(t){Ll(this,e),Qd(this,"report_id",0),Qd(this,"modify_ids",{}),this.id=t}return Nl(e,[{key:"report",value:function(e,t){var r,n,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},o=Zd(Zd(Zd({event_key:e,report_id:this.report_id++,rtc_timestamp:Date.now()},this.modify_ids),t),{},{common_extra_info:Mm(i)});(Kx.push(o),rC())||(null===(r=(n=window).__onRTCReport)||void 0===r||r.call(n,this.id,o))}},{key:"set",value:function(e){this.modify_ids=Ab(this.modify_ids,e)}},{key:"destroy",value:function(){}}]),e}(),qx=Us("Array").keys,Yx=fn,Wx=We,Qx=ae,Jx=qx,Zx=Array.prototype,$x={DOMTokenList:!0,NodeList:!0},eO=function(e){var t=e.keys;return e===Zx||Qx(Zx,e)&&t===Zx.keys||Wx($x,Yx(e))?Jx:t},tO="@byted/ve-rtc",rO="@byted/ve-rtc-cache-size",nO=function(){function e(){Ll(this,e),Qd(this,"storeKey",void 0),Qd(this,"logLevel",void 0),Qd(this,"LogfileSize",void 0),Qd(this,"db",void 0),Qd(this,"logId",void 0),Qd(this,"cacheLog",void 0),Qd(this,"cachedSize",void 0),Qd(this,"preCacheTime",void 0),Qd(this,"timer",void 0),Qd(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 Nl(e,[{key:"_createStore",value:function(){var e=this;if(!rC()&&window.indexedDB){var t=indexedDB.open("@byted/ve-rtc");t.onupgradeneeded=function(){t.result.createObjectStore(tO);try{localStorage.removeItem(rO)}catch(sq){}},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(rO);if(t)this.cachedSize=+t;else rA(this).call(this).then((function(t){e.cachedSize=e._getSize(t),e._setCachedSize()}))}catch(sq){}}},{key:"_setCachedSize",value:function(){try{localStorage.setItem(rO,"".concat(this.cachedSize))}catch(sq){}}},{key:"_getStore",value:function(e){if(this.db)return this.db.transaction(tO,e).objectStore(tO)}},{key:"set",value:function(e){var t=this;return new q_((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(v){var p;if(!e)return n(v);t.cacheLog+=wm(p="\n\n".concat(t.logId,": ")).call(p,e),t.logId++,n(v)}},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 q_((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 q_((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 eO(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 q_((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 q_((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}(),iO=new nO,oO="[VERTC]",aO=["#0050b3","#0050b3","#0050b3","#0050b3","#0050b3"],sO="undefined"!=typeof window&&fk(Bx=window.location.search).call(Bx,"_rtc_debug_"),cO=function(){function e(t,r,n){Ll(this,e),Qd(this,"_indent",void 0),Qd(this,"_module",void 0),Qd(this,"_id",void 0),this._module=t,this._indent=r}return Nl(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,p,v,f,_=wm(h=[]).call(h,u),m="".concat(l).replace(/\%o/gi,(function(){var e=_.shift();return Mm(e)}));iO.set(wm(p=wm(v=wm(f="".concat(oO,"[").concat(this._module,".")).call(f,e,"] ")).call(v,m," ")).call(p,Fm(_).call(_,(function(e){return Mm(e)})).join(", ")))}catch(sq){}if(sO){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(uO(),"-")).call(s,oO)).call(a,g,"[")).call(o,this._module,".")).call(i,e,"] ")).call(n,l),"color:".concat(aO[this._indent],";")]).call(r,u))}}}]),e}(),uO=function(){var e=new Date;return e.toTimeString().split(" ")[0]+":"+e.getMilliseconds()},dO=new cO("MessageReportor",1),lO=function(){function e(t){Ll(this,e),Qd(this,"_preTime",Date.now()),Qd(this,"_one2oneNum",0),Qd(this,"_one2manyNum",0),Qd(this,"_one2oneMsgCache",new JS),Qd(this,"_one2manyMsgCache",new JS),Qd(this,"roomId",""),Qd(this,"userId",""),Qd(this,"rtsSessionId",""),this.id=t}return Nl(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,Zd({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,Zd(Zd({},r),t))}},{key:"cacheCustomMsg",value:function(t){var r;this._one2manyMsgCache.set(t.msg_id,Zd({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,Zd(Zd({},r),t))}},{key:"reportP2PMsg",value:function(e){var t,r=this._one2oneMsgCache.get(e);r&&(dO.print("reportP2PMsg",r.type,Mm(r)),null===(t=kO(this.id))||void 0===t||t.report("rts_message",r))}},{key:"reportOne2ManyMsg",value:function(e){var t,r=this._one2manyMsgCache.get(e);r&&(dO.print("reportOne2ManyMsg",r.type,Mm(r)),null===(t=kO(this.id))||void 0===t||t.report("rts_message",r))}},{key:"reportMsgRecv",value:function(t){var r,n;t.config_version=(null===(r=e.config)||void 0===r?void 0:r.version)||"",dO.print("reportMsgRecv",t.type,Mm(t)),null===(n=kO(this.id))||void 0===n||n.report("rts_message",t)}},{key:"destroy",value:function(){this._one2manyNum=0,this._one2oneNum=0,this._one2manyMsgCache.clear(),this._one2oneMsgCache.clear(),this._preTime=Date.now(),this.roomId="",this.userId="",this.rtsSessionId=""}}]),e}();Qd(lO,"config",void 0);var hO=new JS,pO={_cache:hO,setConfig:function(e){dO.print("setConfig","get config: "+Mm(e)),lO.config=e},setRtsSessionId:function(e,t){var r=hO.get(e);r&&(r.rtsSessionId=t)},createRTSMsgReportor:function(e){var t=hO.get(e)||new lO(e);return hO.set(e,t),t},destroyRTSMsgReportor:function(e){var t=hO.get(e);t&&(t.destroy(),hO.delete(e))},setRoomId:function(e,t){var r=hO.get(e);r&&(r.roomId=t||"")},setUserId:function(e,t){var r=hO.get(e);r&&(r.userId=t||"")},samplingP2PMsg:function(e,t){var r=hO.get(e);if(null!=r&&r.needReport("one2one")){var n,i=wm(n="".concat(t.from)).call(n,t.id),o=t.to?"one2one":"one2server";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",type:o,rts_room_id:t.room,req_ts:Date.now(),send_ts:Date.now(),ack_ts:Date.now(),msg_size:0,error_code:0,recv_msg_ts:0,fwd_msg_ts:0,reply_ack_ts:0,cur_dst_uid:""})}return t},updateP2PMsgReq:function(e,t,r){var n,i;t.enable_report&&iC(t.report_msg_id)&&(null===(n=hO.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}))},updateP2PMsgAck:function(e,t,r){if(t.enable_report&&iC(t.report_msg_id)){var n,i,o=hO.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))}},samplingOne2ManyMsg:function(e,t,r){var n,i=hO.get(e);null!=i&&i.needReport("one2many")&&(r.enable_report=!0,r.report_msg_id=t,i.cacheCustomMsg({rts_session_id:i.rtsSessionId,msg_id:wm(n="".concat(r.clientId)).call(n,t),node_role:"src_sdk",from:r.clientId,to:i.roomId,type:"one2many",rts_room_id:i.roomId,req_ts:Date.now(),send_ts:Date.now(),ack_ts:Date.now(),msg_size:0,error_code:0,recv_msg_ts:0,fwd_msg_ts:0,reply_ack_ts:0,cur_dst_uid:""}));return r},reportP2PMsgRecv:function(e,t,r){if(t.enable_report&&iC(t.report_msg_id)){var n,i=hO.get(e),o=t.to?"one2one":"one2many";null==i||i.reportMsgRecv({rts_session_id:i.rtsSessionId,msg_id:wm(n="".concat(t.from)).call(n,t.report_msg_id),msg_size:r.msg_size,node_role:"dst_sdk",type:o,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?"":i.userId,config_version:"",req_ts:0,send_ts:0,ack_ts:0})}},updateOne2ManyMsgAck:function(e,t,r){if(t.enable_report&&iC(t.report_msg_id)){var n,i,o=hO.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))}},updateOne2ManyMsgReq:function(e,t,r){if(t.enable_report&&iC(t.report_msg_id)){var n,i=hO.get(e);if(i)i.updateOne2ManyMsg(wm(n="".concat(t.clientId)).call(n,t.report_msg_id),{send_ts:Date.now(),msg_size:r})}},reportOne2ManyMsgRecv:function(e,t,r){if(t.enable_report&&iC(t.report_msg_id)){var n,i=hO.get(e);null==i||i.reportMsgRecv({rts_session_id:i.rtsSessionId,msg_id:wm(n="".concat(t.clientId)).call(n,t.report_msg_id),msg_size:r.msg_size,node_role:"dst_sdk",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:i.userId,config_version:"",req_ts:0,send_ts:0,ack_ts:0})}}},vO=function(){function e(t){Ll(this,e),Qd(this,"_timer",void 0),Qd(this,"userMessage",{}),Qd(this,"roomMessage",{}),this.id=t,this._setTimer()}return Nl(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,n=this;null===(e=kO(this.id))||void 0===e||e.report("rtc_message_statistics",{dc_user_message:Fm(t=an(this.userMessage)).call(t,(function(e){return n.userMessage[e]})),dc_room_message:Fm(r=an(this.roomMessage)).call(r,(function(e){return n.roomMessage[e]})),media_server_ip:""})}},{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){var r;t&&(t.code||t.err)&&(fk(r=["TIME_OUT","USER_MESSAGE_TIMEOUT"]).call(r,t.code)?e.dc_fail_timeout++:3===t.err?e.dc_fail_no_receiver++:4===t.err?e.dc_fail_no_relay_path++:1===t.err&&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,"p2p",t)}},{key:"recvP2PMessage",value:function(e){this._recvUserMessage(e,"p2p")}},{key:"sendP2PFail",value:function(e,t){this._sendUserFail(e,"p2p",t)}},{key:"sendP2PAck",value:function(e,t,r,n){this._sendUserAck(e,"p2p",t,r,n)}},{key:"sendP2POutRoomMessage",value:function(e,t){this._sendUserMessage(e,"p2p_outside_room",t)}},{key:"recvP2POutRoomMessage",value:function(e){this._recvUserMessage(e,"p2p_outside_room")}},{key:"sendP2POutRoomFail",value:function(e,t){this._sendUserFail(e,"p2p_outside_room",t)}},{key:"sendP2POutRoomAck",value:function(e,t,r,n){this._sendUserAck(e,"p2p_outside_room",t,r,n)}},{key:"sendP2serverMessage",value:function(e){this._sendUserMessage("","p2server",e)}},{key:"sendP2serverFail",value:function(e){this._sendUserFail("","p2server",e)}},{key:"sendP2serveAck",value:function(e,t,r){this._sendUserAck("","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}(),fO=function(e){Kx.setCommonStats(e)},_O=function(e){Kx.setUrl(e)},mO=new Xx("global"),gO=function(e,t,r){mO.report("rtc_sdk_api_call",{sdk_api_name:e,error_code:t,message:r})},yO=function(e,t,r){mO.report("rtc_sdk_callback",{sdk_callback_name:e,error_code:t,message:r})},SO=function(e,t,r){mO.report("rtc_error",{message:e,error_code:t},r)},bO=function(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?arguments[4]:void 0;mO.report("rtc_invoke_status",{sdk_api_name:e,message:t,error_code:r,stream_id:n,elapse:0},i)},EO=new JS,kO=function(e){return EO.get(e)};function TO(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return function(e,r,n){if("function"==typeof n.value){var i=n.value;n.value=function(){for(var e,n=arguments.length,o=new Array(n),a=0;a<n;a++)o[a]=arguments[a];var s,c,u=this.engineId||this.id,d={};(t.forEach((function(e,t){d[e]=o[t]})),"joinRoom"===r)&&(null===(s=kO(u))||void 0===s||s.set({room_id:o[1],user_id:null===(c=o[2])||void 0===c?void 0:c.userId}));null===(e=kO(u))||void 0===e||e.report("rtc_sdk_api_call",{sdk_api_name:r,message:Mm(RO(o)),error_code:0},d);var l=i.apply(this,o);return"function"==typeof(null==l?void 0:l.then)?l.then((function(e){return IO(u,r,[e||{}]),e})).catch((function(e){throw IO(u,r,e.message,e.code),e})):(IO(u,r,[l||{}]),l)}}}}var IO=function(e,t,r){var n,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,o=arguments.length>4?arguments[4]:void 0,a={sdk_callback_name:t,error_code:i,message:Mm(Array.isArray(r)?RO(r):r)};o&&(a.room_id=o),null===(n=kO(e))||void 0===n||n.report("rtc_sdk_callback",a)},AO=function(e,t,r){var n,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:"",a=arguments.length>5?arguments[5]:void 0;null===(n=kO(e))||void 0===n||n.report("rtc_invoke_status",{sdk_api_name:t,message:r,error_code:i,stream_id:o,elapse:0},a)};function RO(e){return Fm(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),p=Fm(c=Xk({length:5})).call(c,(function(e,t){return h.getUint8(t)})),v=Fm(u=Fm(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,Yk(p),["..."],Yk(v))}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 Fm(t).call(t,e);if(fk(r=["[object Object]","[object MediaStreamTrack]"]).call(r,Object.prototype.toString.call(t))){var f={};for(var _ in t)f[_]=e(t[_]);return f}return t}))}var CO=function(e){var t,r=kO(e.engineId),n={keys:eO(e),labelSelector:"",sdkVersion:e.sdkVersion,deviceType:"web",appId:e.appId,deviceId:e.deviceId,userAgent:"undefined"!=typeof navigator?navigator.userAgent:void 0},i=Fm(t=e.requestDomains).call(t,(function(e){return"https://".concat(e,"/decision/v1/multi")}));null==r||r.report("rtc_get_config",{error_code:0,message:Mm(n),elapse:0,host:i.join(","),type:"request",config_id:"",enable_cloud_proxy:!1});var o=Fm(i).call(i,function(){var e=Tm(Em().mark((function e(t,r){var i;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,fetch(t,{method:"POST",body:Mm(n)}).then((function(e){return e.json()}));case 2:return i=e.sent,e.abrupt("return",{result:i,index:r});case 4:case"end":return e.stop()}}),e)})));return function(t,r){return e.apply(this,arguments)}}());return new q_((function(e){(function(e){return new q_((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)}))}))}))})(o).then((function(t){var n=t.result,o=t.index;null==r||r.report("rtc_get_config",{error_code:200,message:Mm(n),elapse:0,host:i[o],type:"response",config_id:"",enable_cloud_proxy:!1}),e(n)})).catch((function(e){var t;null==r||r.report("rtc_get_config",{error_code:500,message:null===(t=e[0])||void 0===t?void 0:t.message,elapse:0,host:"",type:"response",config_id:"",enable_cloud_proxy:!1})}))}))},wO={exports:{}},xO=n;Rr({global:!0,forced:xO.globalThis!==xO},{globalThis:xO});var OO=n,PO={exports:{}};!function(e,r){var n;e.exports=(n=n||function(e,r){var n;if("undefined"!=typeof window&&window.crypto&&(n=window.crypto),"undefined"!=typeof self&&self.crypto&&(n=self.crypto),void 0!==OO&&OO.crypto&&(n=OO.crypto),!n&&"undefined"!=typeof window&&window.msCrypto&&(n=window.msCrypto),!n&&void 0!==t&&t.crypto&&(n=t.crypto),!n)try{n=require("crypto")}catch(_){}var i=function(){if(n){if("function"==typeof n.getRandomValues)try{return n.getRandomValues(new Uint32Array(1))[0]}catch(_){}if("function"==typeof n.randomBytes)try{return n.randomBytes(4).readInt32LE()}catch(_){}}throw new Error("Native crypto module could not be used to get secure random number.")},o=Object.create||function(){function e(){}return function(t){var r;return e.prototype=t,r=new e,e.prototype=null,r}}(),a={},s=a.lib={},c=s.Base={extend:function(e){var t=o(this);return e&&t.mixIn(e),t.hasOwnProperty("init")&&this.init!==t.init||(t.init=function(){t.$super.init.apply(this,arguments)}),t.init.prototype=t,t.$super=this,t},create:function(){var e=this.extend();return e.init.apply(e,arguments),e},init:function(){},mixIn:function(e){for(var t in e)e.hasOwnProperty(t)&&(this[t]=e[t]);e.hasOwnProperty("toString")&&(this.toString=e.toString)},clone:function(){return this.init.prototype.extend(this)}},u=s.WordArray=c.extend({init:function(e,t){e=this.words=e||[],this.sigBytes=t!=r?t:4*e.length},toString:function(e){return(e||l).stringify(this)},concat:function(e){var t=this.words,r=e.words,n=this.sigBytes,i=e.sigBytes;if(this.clamp(),n%4)for(var o=0;o<i;o++){var a=r[o>>>2]>>>24-o%4*8&255;t[n+o>>>2]|=a<<24-(n+o)%4*8}else for(var s=0;s<i;s+=4)t[n+s>>>2]=r[s>>>2];return this.sigBytes+=i,this},clamp:function(){var t=this.words,r=this.sigBytes;t[r>>>2]&=4294967295<<32-r%4*8,t.length=e.ceil(r/4)},clone:function(){var e,t=c.clone.call(this);return t.words=bm(e=this.words).call(e,0),t},random:function(e){for(var t=[],r=0;r<e;r+=4)t.push(i());return new u.init(t,e)}}),d=a.enc={},l=d.Hex={stringify:function(e){for(var t=e.words,r=e.sigBytes,n=[],i=0;i<r;i++){var o=t[i>>>2]>>>24-i%4*8&255;n.push((o>>>4).toString(16)),n.push((15&o).toString(16))}return n.join("")},parse:function(e){for(var t=e.length,r=[],n=0;n<t;n+=2)r[n>>>3]|=sg(e.substr(n,2),16)<<24-n%8*4;return new u.init(r,t/2)}},h=d.Latin1={stringify:function(e){for(var t=e.words,r=e.sigBytes,n=[],i=0;i<r;i++){var o=t[i>>>2]>>>24-i%4*8&255;n.push(String.fromCharCode(o))}return n.join("")},parse:function(e){for(var t=e.length,r=[],n=0;n<t;n++)r[n>>>2]|=(255&e.charCodeAt(n))<<24-n%4*8;return new u.init(r,t)}},p=d.Utf8={stringify:function(e){try{return decodeURIComponent(escape(h.stringify(e)))}catch(t){throw new Error("Malformed UTF-8 data")}},parse:function(e){return h.parse(unescape(encodeURIComponent(e)))}},v=s.BufferedBlockAlgorithm=c.extend({reset:function(){this._data=new u.init,this._nDataBytes=0},_append:function(e){var t;"string"==typeof e&&(e=p.parse(e)),wm(t=this._data).call(t,e),this._nDataBytes+=e.sigBytes},_process:function(t){var r,n=this._data,i=n.words,o=n.sigBytes,a=this.blockSize,s=o/(4*a),c=(s=t?e.ceil(s):e.max((0|s)-this._minBufferSize,0))*a,d=e.min(4*c,o);if(c){for(var l=0;l<c;l+=a)this._doProcessBlock(i,l);r=ek(i).call(i,0,c),n.sigBytes-=d}return new u.init(r,d)},clone:function(){var e=c.clone.call(this);return e._data=this._data.clone(),e},_minBufferSize:0});s.Hasher=v.extend({cfg:c.extend(),init:function(e){this.cfg=this.cfg.extend(e),this.reset()},reset:function(){v.reset.call(this),this._doReset()},update:function(e){return this._append(e),this._process(),this},finalize:function(e){return e&&this._append(e),this._doFinalize()},blockSize:16,_createHelper:function(e){return function(t,r){return new e.init(r).finalize(t)}},_createHmacHelper:function(e){return function(t,r){return new f.HMAC.init(e,r).finalize(t)}}});var f=a.algo={};return a}(Math),n)}(PO),function(e,t){var r;e.exports=(r=PO.exports,function(){if("function"==typeof ArrayBuffer){var e=r.lib.WordArray,t=e.init,n=e.init=function(e){if(e instanceof ArrayBuffer&&(e=new Uint8Array(e)),(e instanceof Int8Array||"undefined"!=typeof Uint8ClampedArray&&e instanceof Uint8ClampedArray||e instanceof Int16Array||e instanceof Uint16Array||e instanceof Int32Array||e instanceof Uint32Array||e instanceof Float32Array||e instanceof Float64Array)&&(e=new Uint8Array(e.buffer,e.byteOffset,e.byteLength)),e instanceof Uint8Array){for(var r=e.byteLength,n=[],i=0;i<r;i++)n[i>>>2]|=e[i]<<24-i%4*8;t.call(this,n,r)}else t.apply(this,arguments)};n.prototype=e}}(),r.lib.WordArray)}(wO);var MO=wO.exports,DO={exports:{}},NO={exports:{}};!function(e,t){var r;e.exports=(r=PO.exports,function(){var e=r,t=e.lib.WordArray;function n(e,r,n){for(var i=[],o=0,a=0;a<r;a++)if(a%4){var s=n[e.charCodeAt(a-1)]<<a%4*2|n[e.charCodeAt(a)]>>>6-a%4*2;i[o>>>2]|=s<<24-o%4*8,o++}return t.create(i,o)}e.enc.Base64={stringify:function(e){var t=e.words,r=e.sigBytes,n=this._map;e.clamp();for(var i=[],o=0;o<r;o+=3)for(var a=(t[o>>>2]>>>24-o%4*8&255)<<16|(t[o+1>>>2]>>>24-(o+1)%4*8&255)<<8|t[o+2>>>2]>>>24-(o+2)%4*8&255,s=0;s<4&&o+.75*s<r;s++)i.push(n.charAt(a>>>6*(3-s)&63));var c=n.charAt(64);if(c)for(;i.length%4;)i.push(c);return i.join("")},parse:function(e){var t=e.length,r=this._map,i=this._reverseMap;if(!i){i=this._reverseMap=[];for(var o=0;o<r.length;o++)i[r.charCodeAt(o)]=o}var a=r.charAt(64);if(a){var s=CE(e).call(e,a);-1!==s&&(t=s)}return n(e,t,i)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="}}(),r.enc.Base64)}(NO);var LO={exports:{}};!function(e,t){var r;e.exports=(r=PO.exports,function(e){var t=r,n=t.lib,i=n.WordArray,o=n.Hasher,a=t.algo,s=[];!function(){for(var t=0;t<64;t++)s[t]=4294967296*e.abs(e.sin(t+1))|0}();var c=a.MD5=o.extend({_doReset:function(){this._hash=new i.init([1732584193,4023233417,2562383102,271733878])},_doProcessBlock:function(e,t){for(var r=0;r<16;r++){var n=t+r,i=e[n];e[n]=16711935&(i<<8|i>>>24)|4278255360&(i<<24|i>>>8)}var o=this._hash.words,a=e[t+0],c=e[t+1],p=e[t+2],v=e[t+3],f=e[t+4],_=e[t+5],m=e[t+6],g=e[t+7],y=e[t+8],S=e[t+9],b=e[t+10],E=e[t+11],k=e[t+12],T=e[t+13],I=e[t+14],A=e[t+15],R=o[0],C=o[1],w=o[2],x=o[3];R=u(R,C,w,x,a,7,s[0]),x=u(x,R,C,w,c,12,s[1]),w=u(w,x,R,C,p,17,s[2]),C=u(C,w,x,R,v,22,s[3]),R=u(R,C,w,x,f,7,s[4]),x=u(x,R,C,w,_,12,s[5]),w=u(w,x,R,C,m,17,s[6]),C=u(C,w,x,R,g,22,s[7]),R=u(R,C,w,x,y,7,s[8]),x=u(x,R,C,w,S,12,s[9]),w=u(w,x,R,C,b,17,s[10]),C=u(C,w,x,R,E,22,s[11]),R=u(R,C,w,x,k,7,s[12]),x=u(x,R,C,w,T,12,s[13]),w=u(w,x,R,C,I,17,s[14]),R=d(R,C=u(C,w,x,R,A,22,s[15]),w,x,c,5,s[16]),x=d(x,R,C,w,m,9,s[17]),w=d(w,x,R,C,E,14,s[18]),C=d(C,w,x,R,a,20,s[19]),R=d(R,C,w,x,_,5,s[20]),x=d(x,R,C,w,b,9,s[21]),w=d(w,x,R,C,A,14,s[22]),C=d(C,w,x,R,f,20,s[23]),R=d(R,C,w,x,S,5,s[24]),x=d(x,R,C,w,I,9,s[25]),w=d(w,x,R,C,v,14,s[26]),C=d(C,w,x,R,y,20,s[27]),R=d(R,C,w,x,T,5,s[28]),x=d(x,R,C,w,p,9,s[29]),w=d(w,x,R,C,g,14,s[30]),R=l(R,C=d(C,w,x,R,k,20,s[31]),w,x,_,4,s[32]),x=l(x,R,C,w,y,11,s[33]),w=l(w,x,R,C,E,16,s[34]),C=l(C,w,x,R,I,23,s[35]),R=l(R,C,w,x,c,4,s[36]),x=l(x,R,C,w,f,11,s[37]),w=l(w,x,R,C,g,16,s[38]),C=l(C,w,x,R,b,23,s[39]),R=l(R,C,w,x,T,4,s[40]),x=l(x,R,C,w,a,11,s[41]),w=l(w,x,R,C,v,16,s[42]),C=l(C,w,x,R,m,23,s[43]),R=l(R,C,w,x,S,4,s[44]),x=l(x,R,C,w,k,11,s[45]),w=l(w,x,R,C,A,16,s[46]),R=h(R,C=l(C,w,x,R,p,23,s[47]),w,x,a,6,s[48]),x=h(x,R,C,w,g,10,s[49]),w=h(w,x,R,C,I,15,s[50]),C=h(C,w,x,R,_,21,s[51]),R=h(R,C,w,x,k,6,s[52]),x=h(x,R,C,w,v,10,s[53]),w=h(w,x,R,C,b,15,s[54]),C=h(C,w,x,R,c,21,s[55]),R=h(R,C,w,x,y,6,s[56]),x=h(x,R,C,w,A,10,s[57]),w=h(w,x,R,C,m,15,s[58]),C=h(C,w,x,R,T,21,s[59]),R=h(R,C,w,x,f,6,s[60]),x=h(x,R,C,w,E,10,s[61]),w=h(w,x,R,C,p,15,s[62]),C=h(C,w,x,R,S,21,s[63]),o[0]=o[0]+R|0,o[1]=o[1]+C|0,o[2]=o[2]+w|0,o[3]=o[3]+x|0},_doFinalize:function(){var t=this._data,r=t.words,n=8*this._nDataBytes,i=8*t.sigBytes;r[i>>>5]|=128<<24-i%32;var o=e.floor(n/4294967296),a=n;r[15+(i+64>>>9<<4)]=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8),r[14+(i+64>>>9<<4)]=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8),t.sigBytes=4*(r.length+1),this._process();for(var s=this._hash,c=s.words,u=0;u<4;u++){var d=c[u];c[u]=16711935&(d<<8|d>>>24)|4278255360&(d<<24|d>>>8)}return s},clone:function(){var e=o.clone.call(this);return e._hash=this._hash.clone(),e}});function u(e,t,r,n,i,o,a){var s=e+(t&r|~t&n)+i+a;return(s<<o|s>>>32-o)+t}function d(e,t,r,n,i,o,a){var s=e+(t&n|r&~n)+i+a;return(s<<o|s>>>32-o)+t}function l(e,t,r,n,i,o,a){var s=e+(t^r^n)+i+a;return(s<<o|s>>>32-o)+t}function h(e,t,r,n,i,o,a){var s=e+(r^(t|~n))+i+a;return(s<<o|s>>>32-o)+t}t.MD5=o._createHelper(c),t.HmacMD5=o._createHmacHelper(c)}(Math),r.MD5)}(LO);var UO={exports:{}},VO={exports:{}};!function(e,t){var r,n,i,o,a,s,c,u;e.exports=(n=(r=u=PO.exports).lib,i=n.WordArray,o=n.Hasher,a=r.algo,s=[],c=a.SHA1=o.extend({_doReset:function(){this._hash=new i.init([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(e,t){for(var r=this._hash.words,n=r[0],i=r[1],o=r[2],a=r[3],c=r[4],u=0;u<80;u++){if(u<16)s[u]=0|e[t+u];else{var d=s[u-3]^s[u-8]^s[u-14]^s[u-16];s[u]=d<<1|d>>>31}var l=(n<<5|n>>>27)+c+s[u];l+=u<20?1518500249+(i&o|~i&a):u<40?1859775393+(i^o^a):u<60?(i&o|i&a|o&a)-1894007588:(i^o^a)-899497514,c=a,a=o,o=i<<30|i>>>2,i=n,n=l}r[0]=r[0]+n|0,r[1]=r[1]+i|0,r[2]=r[2]+o|0,r[3]=r[3]+a|0,r[4]=r[4]+c|0},_doFinalize:function(){var e=this._data,t=e.words,r=8*this._nDataBytes,n=8*e.sigBytes;return t[n>>>5]|=128<<24-n%32,t[14+(n+64>>>9<<4)]=Math.floor(r/4294967296),t[15+(n+64>>>9<<4)]=r,e.sigBytes=4*t.length,this._process(),this._hash},clone:function(){var e=o.clone.call(this);return e._hash=this._hash.clone(),e}}),r.SHA1=o._createHelper(c),r.HmacSHA1=o._createHmacHelper(c),u.SHA1)}(VO);var FO={exports:{}};!function(e,t){var r,n,i;e.exports=(n=(r=PO.exports).lib.Base,i=r.enc.Utf8,void(r.algo.HMAC=n.extend({init:function(e,t){e=this._hasher=new e.init,"string"==typeof t&&(t=i.parse(t));var r=e.blockSize,n=4*r;t.sigBytes>n&&(t=e.finalize(t)),t.clamp();for(var o=this._oKey=t.clone(),a=this._iKey=t.clone(),s=o.words,c=a.words,u=0;u<r;u++)s[u]^=1549556828,c[u]^=909522486;o.sigBytes=a.sigBytes=n,this.reset()},reset:function(){var e=this._hasher;e.reset(),e.update(this._iKey)},update:function(e){return this._hasher.update(e),this},finalize:function(e){var t,r=this._hasher,n=r.finalize(e);return r.reset(),r.finalize(wm(t=this._oKey.clone()).call(t,n))}})))}(FO),function(e,t){var r,n,i,o,a,s,c,u;e.exports=(n=(r=u=PO.exports).lib,i=n.Base,o=n.WordArray,a=r.algo,s=a.MD5,c=a.EvpKDF=i.extend({cfg:i.extend({keySize:4,hasher:s,iterations:1}),init:function(e){this.cfg=this.cfg.extend(e)},compute:function(e,t){for(var r,n=this.cfg,i=n.hasher.create(),a=o.create(),s=a.words,c=n.keySize,u=n.iterations;s.length<c;){r&&i.update(r),r=i.update(e).finalize(t),i.reset();for(var d=1;d<u;d++)r=i.finalize(r),i.reset();wm(a).call(a,r)}return a.sigBytes=4*c,a}}),r.EvpKDF=function(e,t,r){return c.create(r).compute(e,t)},u.EvpKDF)}(UO);var BO={exports:{}};!function(e,t){var r;e.exports=void((r=PO.exports).lib.Cipher||function(e){var t=r,n=t.lib,i=n.Base,o=n.WordArray,a=n.BufferedBlockAlgorithm,s=t.enc;s.Utf8;var c=s.Base64,u=t.algo.EvpKDF,d=n.Cipher=a.extend({cfg:i.extend(),createEncryptor:function(e,t){return this.create(this._ENC_XFORM_MODE,e,t)},createDecryptor:function(e,t){return this.create(this._DEC_XFORM_MODE,e,t)},init:function(e,t,r){this.cfg=this.cfg.extend(r),this._xformMode=e,this._key=t,this.reset()},reset:function(){a.reset.call(this),this._doReset()},process:function(e){return this._append(e),this._process()},finalize:function(e){return e&&this._append(e),this._doFinalize()},keySize:4,ivSize:4,_ENC_XFORM_MODE:1,_DEC_XFORM_MODE:2,_createHelper:function(){function e(e){return"string"==typeof e?y:m}return function(t){return{encrypt:function(r,n,i){return e(n).encrypt(t,r,n,i)},decrypt:function(r,n,i){return e(n).decrypt(t,r,n,i)}}}}()});n.StreamCipher=d.extend({_doFinalize:function(){return this._process(!0)},blockSize:1});var l=t.mode={},h=n.BlockCipherMode=i.extend({createEncryptor:function(e,t){return this.Encryptor.create(e,t)},createDecryptor:function(e,t){return this.Decryptor.create(e,t)},init:function(e,t){this._cipher=e,this._iv=t}}),p=l.CBC=function(){var t=h.extend();function r(t,r,n){var i,o=this._iv;o?(i=o,this._iv=e):i=this._prevBlock;for(var a=0;a<n;a++)t[r+a]^=i[a]}return t.Encryptor=t.extend({processBlock:function(e,t){var n=this._cipher,i=n.blockSize;r.call(this,e,t,i),n.encryptBlock(e,t),this._prevBlock=bm(e).call(e,t,t+i)}}),t.Decryptor=t.extend({processBlock:function(e,t){var n=this._cipher,i=n.blockSize,o=bm(e).call(e,t,t+i);n.decryptBlock(e,t),r.call(this,e,t,i),this._prevBlock=o}}),t}(),v=(t.pad={}).Pkcs7={pad:function(e,t){for(var r=4*t,n=r-e.sigBytes%r,i=n<<24|n<<16|n<<8|n,a=[],s=0;s<n;s+=4)a.push(i);var c=o.create(a,n);wm(e).call(e,c)},unpad:function(e){var t=255&e.words[e.sigBytes-1>>>2];e.sigBytes-=t}};n.BlockCipher=d.extend({cfg:d.cfg.extend({mode:p,padding:v}),reset:function(){var e;d.reset.call(this);var t=this.cfg,r=t.iv,n=t.mode;this._xformMode==this._ENC_XFORM_MODE?e=n.createEncryptor:(e=n.createDecryptor,this._minBufferSize=1),this._mode&&this._mode.__creator==e?this._mode.init(this,r&&r.words):(this._mode=e.call(n,this,r&&r.words),this._mode.__creator=e)},_doProcessBlock:function(e,t){this._mode.processBlock(e,t)},_doFinalize:function(){var e,t=this.cfg.padding;return this._xformMode==this._ENC_XFORM_MODE?(t.pad(this._data,this.blockSize),e=this._process(!0)):(e=this._process(!0),t.unpad(e)),e},blockSize:4});var f=n.CipherParams=i.extend({init:function(e){this.mixIn(e)},toString:function(e){return(e||this.formatter).stringify(this)}}),_=(t.format={}).OpenSSL={stringify:function(e){var t,r,n=e.ciphertext,i=e.salt;return(i?wm(t=wm(r=o.create([1398893684,1701076831])).call(r,i)).call(t,n):n).toString(c)},parse:function(e){var t,r=c.parse(e),n=r.words;return 1398893684==n[0]&&1701076831==n[1]&&(t=o.create(bm(n).call(n,2,4)),ek(n).call(n,0,4),r.sigBytes-=16),f.create({ciphertext:r,salt:t})}},m=n.SerializableCipher=i.extend({cfg:i.extend({format:_}),encrypt:function(e,t,r,n){n=this.cfg.extend(n);var i=e.createEncryptor(r,n),o=i.finalize(t),a=i.cfg;return f.create({ciphertext:o,key:r,iv:a.iv,algorithm:e,mode:a.mode,padding:a.padding,blockSize:e.blockSize,formatter:n.format})},decrypt:function(e,t,r,n){return n=this.cfg.extend(n),t=this._parse(t,n.format),e.createDecryptor(r,n).finalize(t.ciphertext)},_parse:function(e,t){return"string"==typeof e?t.parse(e,this):e}}),g=(t.kdf={}).OpenSSL={execute:function(e,t,r,n,i){var a;if(n||(n=o.random(8)),i)s=u.create({keySize:t+r,hasher:i}).compute(e,n);else var s=u.create({keySize:t+r}).compute(e,n);var c=o.create(bm(a=s.words).call(a,t),4*r);return s.sigBytes=4*t,f.create({key:s,iv:c,salt:n})}},y=n.PasswordBasedCipher=m.extend({cfg:m.cfg.extend({kdf:g}),encrypt:function(e,t,r,n){var i=(n=this.cfg.extend(n)).kdf.execute(r,e.keySize,e.ivSize,n.salt,n.hasher);n.iv=i.iv;var o=m.encrypt.call(this,e,t,i.key,n);return o.mixIn(i),o},decrypt:function(e,t,r,n){n=this.cfg.extend(n),t=this._parse(t,n.format);var i=n.kdf.execute(r,e.keySize,e.ivSize,t.salt,n.hasher);return n.iv=i.iv,m.decrypt.call(this,e,t,i.key,n)}})}())}(BO),function(e,t){var r;e.exports=(r=PO.exports,function(){var e=r,t=e.lib.BlockCipher,n=e.algo,i=[],o=[],a=[],s=[],c=[],u=[],d=[],l=[],h=[],p=[];!function(){for(var e=[],t=0;t<256;t++)e[t]=t<128?t<<1:t<<1^283;var r=0,n=0;for(t=0;t<256;t++){var v=n^n<<1^n<<2^n<<3^n<<4;v=v>>>8^255&v^99,i[r]=v,o[v]=r;var f=e[r],_=e[f],m=e[_],g=257*e[v]^16843008*v;a[r]=g<<24|g>>>8,s[r]=g<<16|g>>>16,c[r]=g<<8|g>>>24,u[r]=g,g=16843009*m^65537*_^257*f^16843008*r,d[v]=g<<24|g>>>8,l[v]=g<<16|g>>>16,h[v]=g<<8|g>>>24,p[v]=g,r?(r=f^e[e[e[m^f]]],n^=e[e[n]]):r=n=1}}();var v=[0,1,2,4,8,16,32,64,128,27,54],f=n.AES=t.extend({_doReset:function(){if(!this._nRounds||this._keyPriorReset!==this._key){for(var e=this._keyPriorReset=this._key,t=e.words,r=e.sigBytes/4,n=4*((this._nRounds=r+6)+1),o=this._keySchedule=[],a=0;a<n;a++)a<r?o[a]=t[a]:(u=o[a-1],a%r?r>6&&a%r==4&&(u=i[u>>>24]<<24|i[u>>>16&255]<<16|i[u>>>8&255]<<8|i[255&u]):(u=i[(u=u<<8|u>>>24)>>>24]<<24|i[u>>>16&255]<<16|i[u>>>8&255]<<8|i[255&u],u^=v[a/r|0]<<24),o[a]=o[a-r]^u);for(var s=this._invKeySchedule=[],c=0;c<n;c++){if(a=n-c,c%4)var u=o[a];else u=o[a-4];s[c]=c<4||a<=4?u:d[i[u>>>24]]^l[i[u>>>16&255]]^h[i[u>>>8&255]]^p[i[255&u]]}}},encryptBlock:function(e,t){this._doCryptBlock(e,t,this._keySchedule,a,s,c,u,i)},decryptBlock:function(e,t){var r=e[t+1];e[t+1]=e[t+3],e[t+3]=r,this._doCryptBlock(e,t,this._invKeySchedule,d,l,h,p,o),r=e[t+1],e[t+1]=e[t+3],e[t+3]=r},_doCryptBlock:function(e,t,r,n,i,o,a,s){for(var c=this._nRounds,u=e[t]^r[0],d=e[t+1]^r[1],l=e[t+2]^r[2],h=e[t+3]^r[3],p=4,v=1;v<c;v++){var f=n[u>>>24]^i[d>>>16&255]^o[l>>>8&255]^a[255&h]^r[p++],_=n[d>>>24]^i[l>>>16&255]^o[h>>>8&255]^a[255&u]^r[p++],m=n[l>>>24]^i[h>>>16&255]^o[u>>>8&255]^a[255&d]^r[p++],g=n[h>>>24]^i[u>>>16&255]^o[d>>>8&255]^a[255&l]^r[p++];u=f,d=_,l=m,h=g}f=(s[u>>>24]<<24|s[d>>>16&255]<<16|s[l>>>8&255]<<8|s[255&h])^r[p++],_=(s[d>>>24]<<24|s[l>>>16&255]<<16|s[h>>>8&255]<<8|s[255&u])^r[p++],m=(s[l>>>24]<<24|s[h>>>16&255]<<16|s[u>>>8&255]<<8|s[255&d])^r[p++],g=(s[h>>>24]<<24|s[u>>>16&255]<<16|s[d>>>8&255]<<8|s[255&l])^r[p++],e[t]=f,e[t+1]=_,e[t+2]=m,e[t+3]=g},keySize:8});e.AES=t._createHelper(f)}(),r.AES)}(DO);var jO={exports:{}};!function(e,t){e.exports=PO.exports.enc.Hex}(jO);var GO=jO.exports,HO={exports:{}};!function(e,t){var r,n,i;e.exports=((i=PO.exports).mode.CTR=(r=i.lib.BlockCipherMode.extend(),n=r.Encryptor=r.extend({processBlock:function(e,t){var r=this._cipher,n=r.blockSize,i=this._iv,o=this._counter;i&&(o=this._counter=bm(i).call(i,0),this._iv=void 0);var a=bm(o).call(o,0);r.encryptBlock(a,0),o[n-1]=o[n-1]+1|0;for(var s=0;s<n;s++)e[t+s]^=a[s]}}),r.Decryptor=n,r),i.mode.CTR)}(HO);var zO=HO.exports,KO={exports:{}};!function(e,t){var r;e.exports=((r=PO.exports).pad.NoPadding={pad:function(){},unpad:function(){}},r.pad.NoPadding)}(KO);var XO=KO.exports,qO=new TextDecoder,YO=new TextEncoder,WO=function(){return tC()},QO=function(){return Date.now()};function JO(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 ZO=function(){function e(){Ll(this,e)}var t,r;return Nl(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=bR(t);n<i.length;n++){var o=ZT(i[n],2),a=o[0],s=o[1];null!==s&&"object"===qd(s)?e.merge(t[a],r[a]):void 0!==r[a]&&(t[a]=r[a])}}},{key:"ab2str",value:function(e){return qO.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 YO.encode(e).buffer}},{key:"ab2b64str",value:(r=Tm(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 q_((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=Tm(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 $O(){for(var e,t,r=(+GR(e=bm(t="".concat(Math.random())).call(t,-7)).call(e,7,"0")).toString(2),n=GR(r).call(r,28,"1").split(""),i=[];n.length;)i.push(ek(n).call(n,0,7));return Fm(i).call(i,(function(e,t){var r=t===i.length-1?"0":"1";return zR(r+e.join(""),2)}))}var eP=function(){return Math.floor(65535*Math.random())};function tP(e){return"string"==typeof e&&CE(e).call(e,"__web__rtc__rtt__")>-1}var rP,nP,iP,oP,aP,sP,cP,uP,dP=function(){var e=Tm(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)}}(),lP=function(e){return new q_((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 hP(e){return+Math.max(-127,10*YR(Math.pow(e/255,2))).toFixed(2)}function pP(e){return(e&ul.AUDIO)===ul.AUDIO}function vP(e){return(e&ul.VIDEO)===ul.VIDEO}function fP(e){var t={};return an(e).forEach((function(r){"object"===qd(e[r])?t[r]=fP(e[r]):uR(r).call(r,"_")||(t[r]=e[r])})),t}function _P(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 mP(e){return null==e?"undefined | null":"string"==typeof e?e:Mm({contentHint:e.contentHint,enabled:e.enabled,id:e.id,kind:e.kind,label:e.label,muted:e.muted,readyState:e.readyState})}function gP(e){return void 0===e}function yP(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 SP(e){console.warn("[RTC WebSDK]: "+e)}function bP(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}function EP(e){for(var t=atob(e),r=t.length,n=new Uint8Array(r),i=0;i<r;i++)n[i]=t.charCodeAt(i);return n}function kP(e){for(var t="",r=e.byteLength,n=0;n<r;n++)t+=String.fromCharCode(e[n]);return btoa(t)}function TP(e,t,r){var n=IP(e),i=IP(t),o=IP(r);return function(e){for(var t=e.toString(GO),r=new Uint8Array(t.length/2),n=0;n<t.length;n+=2)r[n/2]=sg(t.substr(n,2),16);return r}(DO.exports.encrypt(n,i,{iv:o,mode:zO,padding:XO}).ciphertext)}function IP(e){for(var t=[],r=0;r<e.length;r+=4)t.push(e[r]<<24|(e[r+1]||0)<<16|(e[r+2]||0)<<8|(e[r+3]||0));return MO.create(t,e.length)}var AP=function(){return"undefined"==typeof window},RP=AP()?"":window.navigator.userAgent;function CP(){var e="none";return AP()||(null!==RP.match("Firefox")?e="mozilla":null!==RP.match("Chrome")?(e="chrome-stable",null!==RP.match("Electron")&&(e="electron")):(null!==RP.match("Safari")||null!==RP.match("AppleWebKit"))&&(e="safari")),e}var wP="mozilla"===CP(),xP="safari"===CP(),OP="chrome-stable"===CP(),PP=!AP()&&/CriOS/i.test(RP);!AP()&&/(iPhone|iPod)/i.exec(RP);var MP=!AP()&&(!!/(iPad)/i.exec(RP)||/Macintosh/i.test(RP)&&"ontouchend"in document),DP=!AP()&&/Macintosh/i.test(RP),NP=!AP()&&/MicroMessenger/i.test(RP),LP=!AP()&&fk(rP=RP.toLowerCase()).call(rP,"mobile");!AP()&&/SM-\w+/i.test(RP);var UP=!AP()&&!!/(iPhone|iPad|iPod)/i.exec(RP),VP=!AP()&&/Android/i.test(RP),FP=!AP()&&/Windows/i.test(RP),BP=0,jP=!AP()&&(null===(nP=RP.match(/version\/(\d+)/i))||void 0===nP?void 0:nP[1]);xP&&jP&&(BP=+jP);var GP=!AP()&&(null===(iP=RP.match(/Firefox\/(\d+)/i))||void 0===iP?void 0:iP[1]);wP&&GP&&(BP=+GP);var HP=BP,zP=BP,KP=null!==(oP=!AP()&&(null===(aP=RP.match(/ ([\d_]+) like Mac OS X/i))||void 0===aP||null===(sP=aP[1])||void 0===sP?void 0:Fm(cP=sP.split("_")).call(cP,(function(e){return sg(e)}))))&&void 0!==oP?oP:[],XP=0,qP=!AP()&&(null===(uP=RP.match(/Chrome\/(\d+)/i))||void 0===uP?void 0:uP[1]);qP&&(XP=+qP);var YP=XP,WP="BytePlus",QP="RTC_DEVICE_ID",JP="RTC_ACCESS_NODE",ZP="RTC_ACCESS_URLS",$P="ENGINE_WEB_CONFIG",eM="SERVER_CONFIG",tM=function(){function e(){Ll(this,e)}return Nl(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,Mm(n)),!0}catch(i){return!1}}},{key:"delete",value:function(e){try{return localStorage.removeItem(e),!0}catch(t){return!1}}}]),e}(),rM=function(e){OI(r,e);var t=YI(r);function r(){var e,n;Ll(this,r);for(var i=arguments.length,o=new Array(i),a=0;a<i;a++)o[a]=arguments[a];return Qd($T(n=t.call.apply(t,wm(e=[this]).call(e,o))),"_accessVersion","v2"),n}return Nl(r,[{key:"getDeviceId",value:function(){if(AP())return"";var e=this.get(QP);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 fO({device_id:e}),this.set(QP,e),e}},{key:"getAccessNode",value:function(e){var t,r;return this.get(wm(t=wm(r="".concat(JP,"_").concat(e,"-")).call(r,WP,"-")).call(t,this._accessVersion))}},{key:"setAccessNode",value:function(e,t,r){var n,i;return this.set(wm(n=wm(i="".concat(JP,"_").concat(e,"-")).call(i,WP,"-")).call(n,this._accessVersion),t,1e3*r)}},{key:"clearAccessNode",value:function(e){var t;this.delete(wm(t="".concat(JP,"_").concat(e,"-")).call(t,WP))}},{key:"getAccessUrls",value:function(){return this.get("".concat(ZP,"-").concat(WP))}},{key:"setAccessUrls",value:function(e){var t=Fm(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(ZP,"-").concat(WP),t)}},{key:"clearAccessUrls",value:function(){this.delete("".concat(ZP,"-").concat(WP))}},{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($P);return(null==a||null===(i=mE(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($P)||[];return(a=Gs(a).call(a,(function(e){return e.key!==o}))).push({key:o,config:r}),this.set($P,bm(a).call(a,-5))}}},{key:"getServerConfig",value:function(e){var t,r="".concat(e),n=this.get(eM);return(null==n||null===(t=mE(n).call(n,(function(e){return e.key===r})))||void 0===t?void 0:t.config)||{}}},{key:"setServerConfig",value:function(e,t){if(t){var r="".concat(e),n=this.get(eM)||[];return(n=Gs(n).call(n,(function(e){return e.key!==r}))).push({key:r,config:t}),this.set(eM,bm(n).call(n,-5))}}}]),r}(tM),nM=new rM,iM="rtc-access.rtcplus.com,rtc-access-sg.rtcplus.com,rtc-access-va.rtcplus.com,rtc-access-fr.rtcplus.com".split(",");function oM(){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 aM="https://web-log-report.rtcplus.com/video/v1/webrtc_log/",sM="rtc.rtcplus.com".split(","),cM={VERSION:"4.53.7",ICE_CONFIG_REQUEST_URLS_INTERNAL:Fm(iM).call(iM,oM),ICE_CONFIG_REQUEST_URLS:[],EXPECTED_ADDR:"",LOG_SERVER_URL:aM,CONFIG_REQUEST_DOMAINS:sM,DEVICE_ID:"",OVERSEA:!1,PLATFORM:"",PRODUCT:"",FORCE_ENABLED_REPORT_CALLBACKS:[],SKIP_WEB_AUDIO_IN_TRACK:!1,AUDIO_STALL:!0,VIDEO_STALL:!0,STATS_SCALLBACK_SUPPORT:!0,ENABLE_REPORT_ERROR_BUFFER:!1,ENABLE_FALLBACK_HANDLER:!1};function uM(e,t){var r;if(gO("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(cM.ICE_CONFIG_REQUEST_URLS=Fm(t).call(t,oM));if("PLATFORM"!==e||"string"!=typeof t)if("PRODUCT"!==e||"string"!=typeof t){if("FORCE_ENABLED_REPORT_CALLBACKS"===e)return"string"==typeof t&&(t=[t]),void(cM.FORCE_ENABLED_REPORT_CALLBACKS=t);if("LOG_SERVER_URL"===e){var n=t===pl.overseas?"https://web-log-report.rtcplus.com/video/v1/webrtc_log/":t===pl.domestic?aM:"string"==typeof t?t:void 0;n&&(cM.LOG_SERVER_URL=n,_O(n))}else if("OVERSEA"===e)return fO({extra_is_oversea:t?"1":"0"}),void(cM.OVERSEA=t);"DEVICE_ID"===e&&nM.setDeviceId(t),"ENABLE_REPORT_ERROR_BUFFER"===e&&t&&Kx.enableErrorBuffer(),cM[e]=t}else fO({product:t});else fO({platform:t})}}function dM(e){return"DEVICE_ID"===e?nM.getDeviceId():cM[e]}function lM(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)||_l.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:Fm(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 hM={width:640,height:480,frameRate:15,maxKbps:600},pM={width:1920,height:1080,frameRate:15,maxKbps:3e3};function vM(e,t){if("boolean"!=typeof e)throw new hR(dR.INVALID_PARAMS,"Invalid ".concat(t,": The value should be boolean type."))}function fM(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 hR(dR.INVALID_PARAMS,wm(i=wm(o="Invalid ".concat(t,": the value range is [")).call(o,r,", ")).call(i,n,"]. integer only"));throw a}}function _M(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 hR(dR.INVALID_PARAMS,"".concat(t," cannot be empty"));if(!EM(e,i,o))throw new hR(dR.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 mM(e,t,r){var n;if(!fk(r).call(r,e))throw new hR(dR.INVALID_PARAMS,wm(n="Invalid ".concat(t,": The value can only be set as ")).call(n,Mm(r)))}function gM(e){if(!(e instanceof MediaStreamTrack))throw new hR(dR.INVALID_PARAMS,"Invalid track, The value should be MediaStreamTrack type.")}function yM(e,t){if(kM(e))throw new hR(dR.INVALID_PARAMS,"Invalid ".concat(t,", should not be empty"))}function SM(e,t){if(!(e instanceof ArrayBuffer))throw new hR(dR.INVALID_PARAMS,"Invalid ".concat(t,", should be ArrayBuffer"))}function bM(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 EM(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 kM(e){return null==e}function TM(e){if("string"!=typeof e||!/^[a-zA-Z0-9@._\-]{1,128}$/.test(e))throw new hR(dR.INVALID_PARAMS,"The RoomId must be within 128 bytes. The supported characters: a-z,A-Z,0-9,@,-,_,.")}function IM(e){if("string"!=typeof e||!/^[a-zA-Z0-9@._\-]{1,128}$/.test(e))throw new hR(dR.INVALID_PARAMS,"The userId must be within 128 bytes. The supported characters: a-z,A-Z,0-9,@,-,_,.")}function AM(e){if("string"!=typeof e||!/^[a-zA-Z0-9@._\-]{1,128}$/.test(e))throw new hR(dR.INVALID_PARAMS,"The publicStreamId must be within 128 bytes. The supported characters: a-z,A-Z,0-9,@,-,_,.")}function RM(e){yM(e,"userInfo"),IM(e.userId),kM(e.extraInfo)||_M(e.extraInfo,"userInfo.extraInfo",1,200)}function CM(e){yM(e,"roomConfig"),vM(e.isAutoPublish,"roomConfig.isAutoPublish"),vM(e.isAutoSubscribeAudio,"roomConfig.isAutoSubscribeAudio"),vM(e.isAutoSubscribeVideo,"roomConfig.isAutoSubscribeVideo"),kM(e.roomProfileType)||mM(e.roomProfileType,"roomConfig",[bl.communication,bl.chat,bl.chatRoom,bl.coHost,bl.meeting,bl.classRoom])}function wM(e){yM(e,"videoPlayerOption")}function xM(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 hR(dR.INVALID_PARAMS,"The message cannot be empty");if((null===(t=e instanceof ArrayBuffer?e:ZO.str2ab(Mm(e)))||void 0===t?void 0:t.byteLength)>1e3*r)throw new hR(dR.INVALID_PARAMS,"The message length must be less than ".concat(r,"K"))}function OM(e){var t,r=dM("FORCE_ENABLED_REPORT_CALLBACKS");return!(null==r||!fk(r).call(r,e))||!fk(t=[Ml.onRemoteStreamStats,Ml.onLocalStreamStats,Ml.onAudioVolumeIndication,Ml.onLocalAudioPropertiesReport,Ml.onRemoteAudioPropertiesReport]).call(t,e)}function PM(e){if("number"!=typeof(null==e?void 0:e.width)||"number"!=typeof(null==e?void 0:e.height))throw new hR(dR.INVALID_PARAMS,"remoteVideoConfig must contain width, height, frameRate")}function MM(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 hR(dR.INVALID_PARAMS,"".concat(t," is not a valid ConstrainULong"))}}function DM(e){var t,r=JT(e);try{for(r.s();!(t=r.n()).done;){var n=t.value;fM(null==n?void 0:n.maxKbps,"maxKbps"),MM(null==n?void 0:n.width,"width"),MM(null==n?void 0:n.height,"height"),MM(null==n?void 0:n.frameRate,"frameRate")}}catch(i){r.e(i)}finally{r.f()}}function NM(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:Number.NEGATIVE_INFINITY,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:Number.POSITIVE_INFINITY;return fM(e,t,Number.NEGATIVE_INFINITY,Number.POSITIVE_INFINITY),e=(e=e>r?e:r)<n?e:n}var LM={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?bm(n).call(n,1):n);return xs?wm(i).call(i,xs(e)):i},s.prototype.listeners=function(e){var t=r?r+e:e,n=this._events[t];if(!n)return[];if(n.fn)return[n.fn];for(var i=0,o=n.length,a=new Array(o);i<o;i++)a[i]=n[i].fn;return a},s.prototype.listenerCount=function(e){var t=r?r+e:e,n=this._events[t];return n?n.fn?1:n.length:0},s.prototype.emit=function(e,t,n,i,o,a){var s=r?r+e:e;if(!this._events[s])return!1;var c,u,d=this._events[s],l=arguments.length;if(d.fn){switch(d.once&&this.removeListener(e,d.fn,void 0,!0),l){case 1:return d.fn.call(d.context),!0;case 2:return d.fn.call(d.context,t),!0;case 3:return d.fn.call(d.context,t,n),!0;case 4:return d.fn.call(d.context,t,n,i),!0;case 5:return d.fn.call(d.context,t,n,i,o),!0;case 6:return d.fn.call(d.context,t,n,i,o,a),!0}for(u=1,c=new Array(l-1);u<l;u++)c[u-1]=arguments[u];d.fn.apply(d.context,c)}else{var h,p=d.length;for(u=0;u<p;u++)switch(d[u].once&&this.removeListener(e,d[u].fn,void 0,!0),l){case 1:d[u].fn.call(d[u].context);break;case 2:d[u].fn.call(d[u].context,t);break;case 3:d[u].fn.call(d[u].context,t,n);break;case 4:d[u].fn.call(d[u].context,t,n,i);break;default:if(!c)for(h=1,c=new Array(l-1);h<l;h++)c[h-1]=arguments[h];d[u].fn.apply(d[u].context,c)}}return!0},s.prototype.on=function(e,t,r){return o(this,e,t,r,!1)},s.prototype.once=function(e,t,r){return o(this,e,t,r,!0)},s.prototype.removeListener=function(e,t,n,i){var o=r?r+e:e;if(!this._events[o])return this;if(!t)return a(this,o),this;var s=this._events[o];if(s.fn)s.fn!==t||i&&!s.once||n&&s.context!==n||a(this,o);else{for(var c=0,u=[],d=s.length;c<d;c++)(s[c].fn!==t||i&&!s[c].once||n&&s[c].context!==n)&&u.push(s[c]);u.length?this._events[o]=1===u.length?u[0]:u:a(this,o)}return this},s.prototype.removeAllListeners=function(e){var t;return e?(t=r?r+e:e,this._events[t]&&a(this,t)):(this._events=new n,this._eventsCount=0),this},s.prototype.off=s.prototype.removeListener,s.prototype.addListener=s.prototype.on,s.prefixed=r,s.EventEmitter=s,e.exports=s}(LM);var UM=LM.exports,VM=new cO("VERTC",0),FM=function(e){OI(r,e);var t=YI(r);function r(){return Ll(this,r),t.apply(this,arguments)}return Nl(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(RI(r.prototype),"emit",this)).call.apply(n,wm(i=[this,e]).call(i,a))}catch(sq){return VM.print("safeEmit","safeEmit() | event listener threw an error [event:%s]:%o",e,sq),console.error(sq),Boolean(t)}}}]),r}(LM.exports.EventEmitter),BM=O,jM=tr,GM=$,HM=tI,zM=Qt,KM=R,XM=mc,qM=V;Rr({target:"Reflect",stat:!0,forced:i((function(){var e=function(){},t=zM.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=KM.f(jM(t),r);if(!c){if(GM(o=XM(t)))return e(o,r,n,s);c=qM(0)}if(HM(c)){if(!1===c.writable||!GM(s))return!1;if(i=KM.f(s,r)){if(i.get||i.set||!1===i.writable)return!1;i.value=n,zM.f(s,r,i)}else zM.f(s,r,qM(0,n))}else{if(void 0===(a=c.set))return!1;BM(a,s,n)}return!0}});var YM=ee.Reflect.set;function WM(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],CE(t).call(t,r)>=0||(i[r]=e[r]);return i}(e,t);if(xs){var o=xs(e);for(n=0;n<o.length;n++)r=o[n],CE(t).call(t,r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(i[r]=e[r])}return i}var QM,JM=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}(JM||{}),ZM=function(e){return e.PushLimitWarn="PushLimitWarn",e}(ZM||{}),$M=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.ON_NOTIFY_RECONNECT="notifyReconnect",e}($M||{}),eD=function(e){return e.RSCP="RSCP",e.RTT="RTT",e.SSC="SSC",e}(eD||{}),tD=function(e){return e.ON_CONNECTION_STATE_CHANGE="onConnectionStateChange",e.ON_VENDOR_CONNECTION_STATE_CHANGE="onVendorConnectionStateChange",e.ABNORMAL_DISCONNECTION="normalConnection",e}(tD||{}),rD=function(e){return e.userLeave="userLeave",e.connectionLost="connectionLost",e.userDuplicateLogin="userDuplicateLogin",e.kickedByAdmin="kickedByAdmin",e.roleChanged="roleChanged",e.onUserTokenDidExpire="onUserTokenDidExpire",e}(rD||{}),nD=function(e){return e[e.roomDismissByAdmin=2]="roomDismissByAdmin",e}(nD||{}),iD=function(e){return e[e.SEND=0]="SEND",e[e.FEEDBACK=1]="FEEDBACK",e}(iD||{}),oD=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}(oD||{}),aD=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}(aD||{}),sD=(Qd(QM={},0,[0,"success"]),Qd(QM,1,[dR.USER_MESSAGE_TIMEOUT,"timeout, failed to send."]),Qd(QM,2,[dR.USER_MESSAGE_BROKEN,"dataChannel broken, failed to send."]),Qd(QM,3,[dR.USER_MESSAGE_NO_RECEIVER,"cannot find the receiver."]),Qd(QM,4,[dR.USER_MESSAGE_NO_RECEIVER,"cannot find relay path."]),Qd(QM,5,[dR.USER_MESSAGE_EXCEED_QPS,"cannot find relay path."]),Qd(QM,17,[dR.USER_MESSAGE_SEND_TO_SERVER_ERROR,"failed to send to business server."]),Qd(QM,18,[dR.USER_MESSAGE_SERVER_RESPONSE_ERROR,"business server response error."]),Qd(QM,100,[dR.USER_MESSAGE_NOT_JOIN,"not join room"]),Qd(QM,105,[dR.USER_MESSAGE_NOT_LOGIN,"not login."]),Qd(QM,106,[dR.USER_MESSAGE_SERVER_PARAMS_NOTSET,"server param is not set."]),Qd(QM,1e3,[dR.USER_MESSAGE_UNKNOWN,"unknown."]),QM),cD=["msg"],uD=new cO("DataChannelSignaling",3),dD=["onSpeakerChange"],lD=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}(lD||{}),hD=function(e){OI(a,e);var t,r,n,i,o=YI(a);function a(e,t){var r;return Ll(this,a),Qd($T(r=o.call(this)),"_singlingCache",new JS),Qd($T(r),"_p2pCache",new JS),Qd($T(r),"_rttIds",{}),Qd($T(r),"_p2pMessageId",1),Qd($T(r),"_clearDataChannelListener",void 0),Qd($T(r),"_monitor",void 0),r.id=e,r._dataChannel=t,r._clearDataChannelListener=r._handleHandler(),r._monitor=kO(e),window.__rtc_mock_signaling__=r.emit.bind($T(r)),r}return Nl(a,[{key:"destroy",value:function(){this._dataChannel&&(this._clearDataChannelListener(),this._dataChannel.close()),this._singlingCache.clear(),this._p2pCache.clear(),this._p2pMessageId=1,this._rttIds={}}},{key:"sendSignaling",value:function(e,t,r){var n,i=this;return null===(n=this._monitor)||void 0===n||n.report("rtc_signaling",{error_code:0,message:Mm(t),signaling_event:"call-".concat(e),signaling_type:"Send",stream_id:t.streamId,stream_user_id:t.streamUserId,direction:"up"}),new q_((function(n,o){var a,s=i._genHeader(r);s.id=$O();var c=s.id.join("-"),u="customMessage"===e;u&&pO.samplingOne2ManyMsg(i.id,+s.id.join(""),t);var d=setTimeout((function(){i._singlingCache.delete(c),o(new hR(dR.TIME_OUT,"".concat(e," message time out"))),u&&pO.updateOne2ManyMsgAck(i.id,t,999)}),6e4);i._singlingCache.set(c,{signalingType:e,success:function(e){clearTimeout(d),n(e),u&&pO.updateOne2ManyMsgAck(i.id,t,0)},error:function(e){clearTimeout(d),o(e),u&&pO.updateOne2ManyMsgAck(i.id,t,e.code)}}),uD.print("Signal",wm(a=">>>>>> [".concat(e,"][")).call(a,c,"]"),t),i._sendMessage(e,s,t)}))}},{key:"sendPingSignaling",value:function(){return this.sendSignaling("CheckConnectivity",{ts:Date.now()},{functionType:2})}},{key:"sendP2PMessage",value:(i=Tm(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=WM(t,cD),o=n instanceof ArrayBuffer,e.t0=this,e.t1=pO,e.t2=this.id,e.t3=Zd,e.t4=Zd({ver:1,id:this._p2pMessageId++,time:Date.now(),dir:iD.SEND,type:oD.P2P,err:aD.SUCCESS},i),e.t5={},e.t6=o,!o){e.next=15;break}return e.next=12,ZO.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 i.apply(this,arguments)})},{key:"_sendP2PMessage",value:function(e){var t=this,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return tP(e.msg)?this._rttIds[e.id]=e.id:e.dir===iD.SEND&&uD.print("_sendP2PMessage [DC Signaling p2p >>]",Mm(e)),new q_((function(n,i){var o=t._genHeader(Zd(Zd({needAck:!0,functionType:1},r),{},{id:$O()}));if(e.dir===iD.SEND){var a=setTimeout((function(){t._p2pCache.delete(e.id),i(new hR(dR.USER_MESSAGE_TIMEOUT,"P2P message timeout")),pO.updateP2PMsgAck(t.id,e,999)}),12e3);t._p2pCache.set(e.id,{success:function(r,i){clearTimeout(a),n(i),pO.updateP2PMsgAck(t.id,e,0)},error:function(r){var n;clearTimeout(a),pO.updateP2PMsgAck(t.id,e,r.err);var o=ZT(sD[r.err]||[dR.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===dR.SIGNALING_CHANNEL_NOT_OPEN&&(s.code=dR.USER_MESSAGE_BROKEN),s}}))}},{key:"_sendMessage",value:function(e,t,r){var n;if(!this._dataChannel||"open"!==this._dataChannel.readyState)throw new hR(dR.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=ZO.str2ab(Mm([e,r])),s=JO(Uint8Array,wm(n=[i,o]).call(n,Yk(t.id||[])),new Uint8Array(a));this._dataChannel.send(s.buffer),"p2p"===e?pO.updateP2PMsgReq(this.id,r,s.buffer.byteLength):"customMessage"===e&&pO.updateOne2ManyMsgReq(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(bm(t).call(t,2,r))}return{header:o,data:bm(t).call(t,r)}}},{key:"_feedbackSignaling",value:function(e,t,r){var n,i,o=this._genHeader({needAck:!0,direction:1,id:Fm(n=e.split("-")).call(n,(function(e){return+e}))});fk(dD).call(dD,t)||uD.print("Signal",wm(i=">>>>>> [".concat(t,"-res][")).call(i,e,"]"));this._sendMessage("".concat(t,"-res"),o,r)}},{key:"_handleMessage",value:(n=Tm(Em().mark((function e(t){var r,n,i,o,a,s,c,u,d;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:r=Date.now(),n=t.byteLength,i=this._dispartData(t),o=i.data,(a=i.header).zip&&((s=new Lx.Inflate).push(o,!0),o=s.result),c=ZO.ab2str(o),u=[],e.prev=8,u=JSON.parse(c),e.next=16;break;case 12:return e.prev=12,e.t0=e.catch(8),e.t0 instanceof Error&&(null===(d=this._monitor)||void 0===d||d.report("rtc_signaling_msg_error",{error_code:-1,message:e.t0.message,reason:"message parse failed"})),e.abrupt("return");case 16:e.t1=a.functionType,e.next=0===e.t1?19:1===e.t1?21:2===e.t1?23:25;break;case 19:return this.C2S(a,u,c,n,r),e.abrupt("break",26);case 21:return this.C2C(u,n,r),e.abrupt("break",26);case 23:return this.C2GW(a,u,c),e.abrupt("break",26);case 25:return e.abrupt("break",26);case 26:case"end":return e.stop()}}),e,this,[[8,12]])}))),function(e){return n.apply(this,arguments)})},{key:"C2S",value:(r=Tm(Em().mark((function e(t,r,n,i,o){var a,s,c,u,d;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(s=(null===(a=t.id)||void 0===a?void 0:a.join("-"))||"",1!==t.direction){e.next=5;break}this._handleAckMessage(s,r[0]||{},n),e.next=18;break;case 5:if(!Array.isArray(r)){e.next=18;break}if(u=r[0],r=r[1],fk(dD).call(dD,u)||uD.print("Signal","<<<<<< ".concat(u),r,s),this._feedbackSignaling(s,u,u===$M.ON_CUSTOM_MESSAGE?Zd(Zd({},r),{},{message:""}):""),!r.binary||"string"!=typeof r.message){e.next=14;break}return e.next=13,ZO.b64str2ab(r.message);case 13:r.message=e.sent;case 14:d=Date.now(),this.emit(u,Zd({},r)),u===$M.ON_CUSTOM_MESSAGE&&pO.reportOne2ManyMsgRecv(this.id,r,{msg_size:i,recv_msg_ts:o,fwd_msg_ts:d}),null===(c=this._monitor)||void 0===c||c.report("rtc_signaling",{error_code:0,message:n,signaling_event:"on-".concat(u),signaling_type:"Recv",stream_id:r.streamId,stream_user_id:r.clientId,direction:"down"});case 18:case"end":return e.stop()}}),e,this)}))),function(e,t,n,i,o){return r.apply(this,arguments)})},{key:"C2C",value:(t=Tm(Em().mark((function e(t,r,n){var i,o,a,s,c,u,d,l,h,p,v,f,_;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:Array.isArray(t)&&(t=t[1]),c=null===(i=t)||void 0===i?void 0:i.id,this._rttIds[c]||(null===(o=t)||void 0===o?void 0:o.dir)===iD.FEEDBACK||tP(null===(a=t)||void 0===a?void 0:a.msg)?delete this._rttIds[c]:uD.print("Signal","<<<<<< p2p response",t),e.t0=t.dir,e.next=e.t0===iD.SEND?6:e.t0===iD.FEEDBACK?46:48;break;case 6:if(u=Date.now(),tP(null===(s=t)||void 0===s?void 0:s.msg)){e.next=43;break}if(l=(d=t).binary,h=d.msg,p=d.room,v=d.to,f=d.from,_=""===p?l?$M.USER_BINARY_MESSAGE_RECEIVED_OUTSIDE_ROOM:$M.USER_MESSAGE_RECEIVED_OUTSIDE_ROOM:l?$M.USER_BINARY_MESSAGE_RECEIVED:$M.USER_MESSAGE_RECEIVED,v){e.next=27;break}if(e.t1=this,e.t2=$M.ON_CUSTOM_MESSAGE,e.t3=f,e.t4=l,!l){e.next=21;break}return e.next=18,ZO.b64str2ab(h);case 18:e.t5=e.sent,e.next=22;break;case 21:e.t5=h;case 22:e.t6=e.t5,e.t7={clientId:e.t3,binary:e.t4,message:e.t6},e.t1.emit.call(e.t1,e.t2,e.t7),e.next=43;break;case 27:if(e.t8=this,e.t9=_,e.t10=Zd,e.t11=Zd({},t),e.t12={},!l){e.next=38;break}return e.next=35,ZO.b64str2ab(h);case 35:e.t13=e.sent,e.next=39;break;case 38:e.t13=h;case 39:e.t14=e.t13,e.t15={msg:e.t14},e.t16=(0,e.t10)(e.t11,e.t12,e.t15),e.t8.emit.call(e.t8,e.t9,e.t16);case 43:return this._sendP2PMessage(Zd(Zd({},t),{},{dir:iD.FEEDBACK,msg:""})),pO.reportP2PMsgRecv(this.id,t,{msg_size:r,recv_msg_ts:n,fwd_msg_ts:u}),e.abrupt("break",49);case 46:return this._handleP2PMsgFeedback(t),e.abrupt("break",49);case 48:return e.abrupt("break",49);case 49:case"end":return e.stop()}}),e,this)}))),function(e,r,n){return t.apply(this,arguments)})},{key:"C2GW",value:function(e,t,r){if(1===e.direction){var n,i=(null===(n=e.id)||void 0===n?void 0:n.join("-"))||"";this._handleAckMessage(i,t[0]||{},r)}else{var o=ZT(t,2),a=o[0],s=o[1],c=void 0===s?{}:s;if("RXMediaMsg"===a){var u,d=c.type,l=c.data;switch(null===(u=this._monitor)||void 0===u||u.report("rtc_signaling",{error_code:0,message:r,signaling_event:"on-".concat(d),signaling_type:"Recv",stream_id:"",stream_user_id:"",direction:"down"}),d){case"RSCP":try{var h=JSON.parse(l);Array.isArray(h)&&this.emit(d,h)}catch(f){}break;case"RTT":try{var p=JSON.parse(l);p.length&&this.emit(d,p[0])}catch(f){}break;case"SSC":try{var v=JSON.parse(l);v.length&&this.emit(d,v[0])}catch(f){}}}}}},{key:"_handleHandler",value:function(){var e=this,t=function(t){uD.print("_handleHandler","dataChannel close",t),e.emit("close",t)},r=function(t){uD.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 Zd({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,o=this._singlingCache.get(e);o&&(this._singlingCache.delete(e),200===t.code?o.success(t):o.error(t),uD.print("Signal",wm(i="<<<<<< [".concat(o.signalingType,"-ack] ")).call(i,e),t));null===(n=this._monitor)||void 0===n||n.report("rtc_signaling",{error_code:0,message:r,signaling_event:null==o?void 0:o.signalingType,signaling_type:"Ack",stream_id:"",stream_user_id:"",direction:"down"})}},{key:"_handleP2PMsgFeedback",value:function(e){var t=this._p2pCache.get(e.id);t&&(this._p2pCache.delete(e.id),e.err===aD.SUCCESS?t.success(e.id,e):t.error(e))}}]),a}(LM.exports.EventEmitter),pD=function(){function e(){Ll(this,e),Qd(this,"xhr",void 0),Qd(this,"isSending",void 0),Qd(this,"timeout",void 0),this.isSending=!1}return Nl(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 q_((function(e,i){t.isSending=!0;var a=new XMLHttpRequest;a.open(r,n,!0);for(var c=0,d=bR(s);c<d.length;c++){var l=ZT(d[c],2),h=l[0],p=l[1];a.setRequestHeader(h,p)}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=Mm(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}(),vD=new cO("ICE Request",3),fD=function(){function e(t){Ll(this,e),Qd(this,"_request",void 0),Qd(this,"_monitor",void 0),this.id=t,this._request=new pD,this._monitor=kO(this.id)}var t,r,n;return Nl(e,[{key:"getAccessNode",value:(n=Tm(Em().mark((function e(t,r,n,i,o){var a;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!(a=nM.getAccessNode(t))){e.next=9;break}if(this.getAccessNodeFromServer(t,r,n,i,o),AO(this.id,"es.R.node.cache",a),!Array.isArray(a)){e.next=8;break}return e.abrupt("return",q_.resolve(a));case 8:return e.abrupt("return",q_.resolve([a]));case 9:return e.abrupt("return",this.getAccessNodeFromServer(t,r,n,i,o));case 10:case"end":return e.stop()}}),e,this)}))),function(e,t,r,i,o){return n.apply(this,arguments)})},{key:"getAccessNodeFromServer",value:(r=Tm(Em().mark((function e(t,r,n,i,o){var a,s,c,u,d=this;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return c=nM.getAccessUrls(),u=!0,AO(this.id,"es.R.req.cache.urls",c),(null===(a=c)||void 0===a?void 0:a.length)>0||(c=cM.ICE_CONFIG_REQUEST_URLS,u=!1,AO(this.id,"es.R.req.external.urls",c)),(null===(s=c)||void 0===s?void 0:s.length)>0||(c=cM.ICE_CONFIG_REQUEST_URLS_INTERNAL,u=!1,AO(this.id,"es.R.req.internal.urls",c)),e.abrupt("return",this.getICEConfigFromServer(c,t,r,n,i,o).then((function(e){var r=e.nodes;return nM.setAccessNode(t,r,e.ttl||11200),e.dispatchDomains&&nM.setAccessUrls(e.dispatchDomains),r})).catch((function(e){if(u)return AO(d.id,"es.R.req.fallback",""),nM.clearAccessUrls(),d.getAccessNodeFromServer(t,r,n,i);throw e})));case 6:case"end":return e.stop()}}),e,this)}))),function(e,t,n,i,o){return r.apply(this,arguments)})},{key:"getICEConfigFromServer",value:(t=Tm(Em().mark((function e(t,r,n,i,o,a){var s,c,u,d,l,h=this;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return c={appID:r,deviceID:nM.getDeviceId(),connectSessionID:WO(),os:"web",sdkVersion:cM.VERSION,isOversea:cM.OVERSEA,expectedAddr:dM("EXPECTED_ADDR"),productPlatform:"BytePlus",accessParams:Mm({requireICEUfragV2:!0})},n&&i&&(c.feedbackInfo=[{feedbackIP:null===(u=i.publicIPs[0])||void 0===u?void 0:u.ip,feedbackReason:{type:"NODE_CHANGED",reason:n}}],delete c.expectedAddr),d=Date.now(),null===(s=this._monitor)||void 0===s||s.report("rtc_get_access",{error_code:0,message:Mm(c),elapse:0,type:"request",host:t.join(","),connect_session_id:c.connectSessionID}),l=Fm(t).call(t,function(){var e=Tm(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,h._request.post(t,c);case 3:n=e.sent,e.next=9;break;case 6:throw e.prev=6,e.t0=e.catch(0),new hR(dR.ICE_SERVER_WRONG,"get ICE config failed",e.t0);case 9:if(200===n.code){e.next=11;break}throw new hR(dR.ICE_SERVER_WRONG,"get ICE config failed",{server_code:n.code,message:Mm(n)});case 11:if(i=n.nodes[0]){e.next=14;break}throw new hR(dR.ICE_SERVER_WRONG,"ICE config server return empty nodes",{code:n.code,message:Mm(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",lP(l).then((function(e){var r,n=e.result;e.firstNode;var i=e.index;return null===(r=h._monitor)||void 0===r||r.report("rtc_get_access",{error_code:200,message:Mm(n),elapse:Date.now()-d,type:"response",host:t[i],connect_session_id:c.connectSessionID}),n})).catch((function(e){var r,n,i,o=null===(r=e[0])||void 0===r?void 0:r.error;throw null===(n=h._monitor)||void 0===n||n.report("rtc_get_access",{error_code:+((null==o?void 0:o.code)||(null==o?void 0:o.server_code)),message:null===(i=e[0])||void 0===i?void 0:i.message,elapse:Date.now()-d,type:"response",host:t.join(","),connect_session_id:c.connectSessionID},{error:Mm(o)}),e})));case 6:case"end":return e.stop()}}),e,this)}))),function(e,r,n,i,o,a){return t.apply(this,arguments)})},{key:"abort",value:function(){this._request.isSending&&(vD.print("abort","HTTP Request of [getICEConfigFromServer] abort"),this._request.abort())}}]),e}(),_D=hi.f("asyncIterator");function mD(e){var t,r,n,i=2;for(void 0!==Cd&&(r=_D,n=Xd);i--;){if(r&&null!=(t=e[r]))return t.call(e);if(n&&null!=(t=e[n]))return new gD(t.call(e));r="@@asyncIterator",n="@@iterator"}throw new TypeError("Object is not async iterable")}function gD(e){function t(e){if(Object(e)!==e)return q_.reject(new TypeError(e+" is not an object."));var t=e.done;return q_.resolve(e.value).then((function(e){return{value:e,done:t}}))}return(gD=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?q_.resolve({value:e,done:!0}):t(r.apply(this.s,arguments))},throw:function(e){var r=this.s.return;return void 0===r?q_.reject(e):t(r.apply(this.s,arguments))}},new gD(e)}var yD=[{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}];qg("Set",(function(e){return function(){return e(this,arguments.length?arguments[0]:void 0)}}),dy);var SD=ee.Set;Rr({target:"Set",stat:!0,forced:!0},{from:yy}),Rr({target:"Set",stat:!0,forced:!0},{of:by});var bD=O,ED=we,kD=tr,TD=function(){for(var e=kD(this),t=ED(e.add),r=0,n=arguments.length;r<n;r++)bD(t,e,arguments[r]);return e};Rr({target:"Set",proto:!0,real:!0,forced:!0},{addAll:TD}),Rr({target:"Set",proto:!0,real:!0,forced:!0},{deleteAll:Iy});var ID=mh,AD=tr,RD=Wt,CD=ID,wD=Nh;Rr({target:"Set",proto:!0,real:!0,forced:!0},{every:function(e){var t=AD(this),r=CD(t),n=RD(e,arguments.length>1?arguments[1]:void 0);return!wD(r,(function(e,r){if(!n(e,e,t))return r()}),{IS_ITERATOR:!0,INTERRUPTED:!0}).stopped}});var xD=oe,OD=O,PD=we,MD=tr,DD=Tp,ND=Nh;Rr({target:"Set",proto:!0,real:!0,forced:!0},{difference:function(e){var t=MD(this),r=new(DD(t,xD("Set")))(t),n=PD(r.delete);return ND(e,(function(e){OD(n,r,e)})),r}});var LD=oe,UD=O,VD=we,FD=tr,BD=Wt,jD=Tp,GD=ID,HD=Nh;Rr({target:"Set",proto:!0,real:!0,forced:!0},{filter:function(e){var t=FD(this),r=GD(t),n=BD(e,arguments.length>1?arguments[1]:void 0),i=new(jD(t,LD("Set"))),o=VD(i.add);return HD(r,(function(e){n(e,e,t)&&UD(o,i,e)}),{IS_ITERATOR:!0}),i}});var zD=tr,KD=Wt,XD=ID,qD=Nh;Rr({target:"Set",proto:!0,real:!0,forced:!0},{find:function(e){var t=zD(this),r=XD(t),n=KD(e,arguments.length>1?arguments[1]:void 0);return qD(r,(function(e,r){if(n(e,e,t))return r(e)}),{IS_ITERATOR:!0,INTERRUPTED:!0}).result}});var YD=oe,WD=O,QD=we,JD=tr,ZD=Tp,$D=Nh;Rr({target:"Set",proto:!0,real:!0,forced:!0},{intersection:function(e){var t=JD(this),r=new(ZD(t,YD("Set"))),n=QD(t.has),i=QD(r.add);return $D(e,(function(e){WD(n,t,e)&&WD(i,r,e)})),r}});var eN=O,tN=we,rN=tr,nN=Nh;Rr({target:"Set",proto:!0,real:!0,forced:!0},{isDisjointFrom:function(e){var t=rN(this),r=tN(t.has);return!nN(e,(function(e,n){if(!0===eN(r,t,e))return n()}),{INTERRUPTED:!0}).stopped}});var iN=oe,oN=O,aN=we,sN=A,cN=tr,uN=mh,dN=Nh;Rr({target:"Set",proto:!0,real:!0,forced:!0},{isSubsetOf:function(e){var t=uN(this),r=cN(e),n=r.has;return sN(n)||(r=new(iN("Set"))(e),n=aN(r.has)),!dN(t,(function(e,t){if(!1===oN(n,r,e))return t()}),{IS_ITERATOR:!0,INTERRUPTED:!0}).stopped}});var lN=O,hN=we,pN=tr,vN=Nh;Rr({target:"Set",proto:!0,real:!0,forced:!0},{isSupersetOf:function(e){var t=pN(this),r=hN(t.has);return!vN(e,(function(e,n){if(!1===lN(r,t,e))return n()}),{INTERRUPTED:!0}).stopped}});var fN=Rr,_N=tr,mN=gn,gN=ID,yN=Nh,SN=E([].join),bN=[].push;fN({target:"Set",proto:!0,real:!0,forced:!0},{join:function(e){var t=_N(this),r=gN(t),n=void 0===e?",":mN(e),i=[];return yN(r,bN,{that:i,IS_ITERATOR:!0}),SN(i,n)}});var EN=oe,kN=Wt,TN=O,IN=we,AN=tr,RN=Tp,CN=ID,wN=Nh;Rr({target:"Set",proto:!0,real:!0,forced:!0},{map:function(e){var t=AN(this),r=CN(t),n=kN(e,arguments.length>1?arguments[1]:void 0),i=new(RN(t,EN("Set"))),o=IN(i.add);return wN(r,(function(e){TN(o,i,n(e,e,t))}),{IS_ITERATOR:!0}),i}});var xN=we,ON=tr,PN=ID,MN=Nh,DN=TypeError;Rr({target:"Set",proto:!0,real:!0,forced:!0},{reduce:function(e){var t=ON(this),r=PN(t),n=arguments.length<2,i=n?void 0:arguments[1];if(xN(e),MN(r,(function(r){n?(n=!1,i=r):i=e(i,r,r,t)}),{IS_ITERATOR:!0}),n)throw DN("Reduce of empty set with no initial value");return i}});var NN=tr,LN=Wt,UN=ID,VN=Nh;Rr({target:"Set",proto:!0,real:!0,forced:!0},{some:function(e){var t=NN(this),r=UN(t),n=LN(e,arguments.length>1?arguments[1]:void 0);return VN(r,(function(e,r){if(n(e,e,t))return r()}),{IS_ITERATOR:!0,INTERRUPTED:!0}).stopped}});var FN=oe,BN=O,jN=we,GN=tr,HN=Tp,zN=Nh;Rr({target:"Set",proto:!0,real:!0,forced:!0},{symmetricDifference:function(e){var t=GN(this),r=new(HN(t,FN("Set")))(t),n=jN(r.delete),i=jN(r.add);return zN(e,(function(e){BN(n,r,e)||BN(i,r,e)})),r}});var KN=oe,XN=we,qN=tr,YN=Tp,WN=Nh;Rr({target:"Set",proto:!0,real:!0,forced:!0},{union:function(e){var t=qN(this),r=new(YN(t,KN("Set")))(t);return WN(e,XN(r.add),{that:r}),r}});var QN=SD,JN=function(){var e=Tm(Em().mark((function e(){return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(e.prev=0,!AP()&&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,aL();case 5:if(e.t0=e.sent,!e.t0){e.next=10;break}return e.next=9,oL();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)}}(),ZN=function(){var e=Tm(Em().mark((function e(){var t;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=[],e.next=3,aL();case 3:if(e.t0=e.sent,!e.t0){e.next=8;break}return e.next=7,oL();case 7:e.t0=e.sent;case 8:if(!e.t0){e.next=10;break}t.push("H264");case 10:return e.next=12,cL();case 12:if(e.t1=e.sent,!e.t1){e.next=17;break}return e.next=16,sL();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)}}(),$N=function(){var e=Tm(Em().mark((function e(){var t;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,ZN();case 2:return t=e.sent,e.abrupt("return",Fm(t).call(t,(function(e){return e.toUpperCase()})));case 4:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),eL={};function tL(e){var t,r=!1,n=JT(e.split("\n"));try{for(n.s();!(t=n.n()).done;){var i=t.value;if(fk(i).call(i,"level-asymmetry-allowed=1")&&fk(i).call(i,"packetization-mode=1")&&fk(i).call(i,"profile-level-id=42e0")){r=!0;break}}}catch(d){n.e(d)}finally{n.f()}if(r){for(var o=navigator.userAgent.toLowerCase(),a=!1,s=0,c=["miuibrowser"];s<c.length;s++){var u=c[s];fk(o).call(o,u)&&(a=!0)}return!a}return!1}var rL=function(){var e=Tm(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({sdpSemantics:"unified-plan"})).addTransceiver("video",{direction:t}),e.next=4,r.createOffer();case 4:return n=e.sent,r.close(),e.abrupt("return",n.sdp.toLowerCase());case 7:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),nL=function(){var e=Tm(Em().mark((function e(){var t,r;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,rL("sendonly");case 2:if(r=e.sent,!fk(t=navigator.userAgent).call(t,"VivoBrowser")){e.next=7;break}return e.next=6,rL("sendonly");case 6:r=e.sent;case 7:return eL.h264encode=tL(r),eL.vp8encode=CE(r).call(r,"vp8")>-1,e.abrupt("return",eL);case 10:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),iL=function(){var e=Tm(Em().mark((function e(){var t,r;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,rL("recvonly");case 2:if(r=e.sent,!fk(t=navigator.userAgent).call(t,"VivoBrowser")){e.next=7;break}return e.next=6,rL("recvonly");case 6:r=e.sent;case 7:return eL.h264decode=tL(r),eL.vp8decode=CE(r).call(r,"vp8")>-1,e.abrupt("return",eL);case 10:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),oL=function(){var e=Tm(Em().mark((function e(){return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(void 0!==eL.h264encode){e.next=9;break}return e.prev=1,e.next=4,nL();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",eL.h264encode||!1);case 10:case"end":return e.stop()}}),e,null,[[1,6]])})));return function(){return e.apply(this,arguments)}}(),aL=function(){var e=Tm(Em().mark((function e(){return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(void 0!==eL.h264decode){e.next=9;break}return e.prev=1,e.next=4,iL();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",eL.h264decode||!1);case 10:case"end":return e.stop()}}),e,null,[[1,6]])})));return function(){return e.apply(this,arguments)}}(),sL=function(){var e=Tm(Em().mark((function e(){return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(void 0!==eL.vp8encode){e.next=9;break}return e.prev=1,e.next=4,nL();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",eL.vp8encode||!1);case 10:case"end":return e.stop()}}),e,null,[[1,6]])})));return function(){return e.apply(this,arguments)}}(),cL=function(){var e=Tm(Em().mark((function e(){return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(void 0!==eL.vp8decode){e.next=9;break}return e.prev=1,e.next=4,iL();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",eL.vp8decode||!1);case 10:case"end":return e.stop()}}),e,null,[[1,6]])})));return function(){return e.apply(this,arguments)}}(),uL=function(){return"undefined"!=typeof TransformStream&&"undefined"!=typeof RTCRtpSender&&"undefined"!=typeof RTCRtpReceiver&&void 0!==RTCRtpSender.prototype.createEncodedStreams&&void 0!==RTCRtpReceiver.prototype.createEncodedStreams},dL=function(){return DP?OP&&YP>=70||wP&&zP>=80||xP&&HP>=14:FP?OP&&YP>=70||wP&&zP>=80:UP?KP[0]>=14:!!VP&&(OP&&YP>=86)},lL=OP&&YP<114,hL=new JS,pL=function(){var e=Tm(Em().mark((function e(t){return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",new q_((function(e,r){var n=dM("STATS_SCALLBACK_SUPPORT");if(OP&&void 0===window.InstallTrigger&&lL&&n)try{t.getStats((function(t){var r=[];t.result().forEach((function(e){if(!fk(mL).call(mL,e.type)){var t={};e.names().forEach((function(r){t[r]=e.stat(r)})),r.push(Zd(Zd({},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(sq){r(sq)}else e({all:[],getTrackStats:function(){return[]}})})));case 1:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),vL=function(){var e=Tm(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 e.next=2,t.getStats();case 2:return n=e.sent,i={all:[]},o=new JS,n.forEach((function(e){var t=o.get(e.type)||new JS;t.set(e.id,e),o.set(e.type,t),i.all.push(e)})),a=function(e,t){e.forEach((function(e){var r,n,i,a,s,c,u=e.codecId,d=e.transportId,l=e.trackId,h=e.playoutId;if(null===(r=o.get(_L.codec))||void 0===r||r.forEach((function(e){e.id===u&&t.add(e)})),null===(n=o.get(_L.transport))||void 0===n||n.forEach((function(e){e.id===d&&(s=e,t.add(e))})),null===(i=o.get(_L.track))||void 0===i||i.forEach((function(e){e.id===l&&t.add(e)})),null===(a=o.get(_L.mediaPlayout))||void 0===a||a.forEach((function(e){e.id===h&&t.add(e)})),s){var p,v,f=s,_=f.localCertificateId,m=f.remoteCertificateId,g=f.selectedCandidatePairId;null===(p=o.get(_L.certificate))||void 0===p||p.forEach((function(e){(e.id===_||e.id===m)&&t.add(e)})),null===(v=o.get(_L.candidatePair))||void 0===v||v.forEach((function(e){e.id===g&&(c=e,t.add(e))}))}if(c){var y,S,b=c,E=b.localCandidateId,k=b.remoteCandidateId;null===(y=o.get(_L.localCandidate))||void 0===y||y.forEach((function(e){e.id===E&&t.add(e)})),null===(S=o.get(_L.remoteCandidate))||void 0===S||S.forEach((function(e){e.id===k&&t.add(e)}))}}))},o.get(_L.mediaSource)?null===(s=o.get(_L.mediaSource))||void 0===s||s.forEach((function(e){var t,r=new QN;r.add(e);var n=[];null===(t=o.get(_L.outboundRtp))||void 0===t||t.forEach((function(t){var i;t.mediaSourceId===e.id&&(r.add(t),n.push(t),null===(i=o.get(_L.remoteInboundRtp))||void 0===i||i.forEach((function(e){e.localId===t.id&&r.add(e)})))})),a(n,r),i[e.trackIdentifier]=Xk(r)})):o.get(_L.track)&&(null===(c=o.get(_L.track))||void 0===c||c.forEach((function(e){var t,r=new QN;r.add(e);var n=[];null===(t=o.get(_L.outboundRtp))||void 0===t||t.forEach((function(t){var i;t.trackId===e.id&&(r.add(t),n.push(t),null===(i=o.get(_L.remoteInboundRtp))||void 0===i||i.forEach((function(e){e.localId===t.id&&r.add(e)})))})),a(n,r),i[e.trackIdentifier]=Xk(r)}))),null===(r=o.get(_L.inboundRtp))||void 0===r||r.forEach((function(e){var t,r=new QN;r.add(e),null===(t=o.get(_L.remoteOutboundRtp))||void 0===t||t.forEach((function(t){t.localId===e.id&&r.add(t)})),a([e],r);var n,s=e.trackIdentifier;s||(null===(n=o.get(_L.track))||void 0===n||n.forEach((function(t){t.id===e.trackId&&(s=t.trackIdentifier)})));i[s]=Xk(r)})),e.abrupt("return",i);case 10:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),fL=function(){var e=Tm(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(!wP&&!xP){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=hL.get(t))||Date.now()-a.timestamp>150)&&(a={timestamp:Date.now(),statsPromise:vL(t),extraStatsPromise:pL(t)},hL.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)}}(),_L=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}(_L||{}),mL=["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"],gL={},yL={},SL={exports:{}},bL=SL.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=SL.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=bm(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 lb(t=e.split(/;\s?/)).call(t,o,{})},e.parseFmtpConfig=e.parseParams,e.parsePayloads=function(e){var t;return Fm(t=e.toString().split(" ")).call(t,Number)},e.parseRemoteCandidates=function(e){for(var r,n=[],i=Fm(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 Fm(t=e.split(" ")).call(t,(function(e){var t;return lb(t=e.substring(1,e.length-1).split(",")).call(t,o,{})}))},e.parseSimulcastStreamList=function(e){var r;return Fm(r=e.split(";")).call(r,(function(e){var r;return Fm(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}}))}))}}(yL);var EL=SL.exports,kL=/%[sdv%]/g,TL=function(e){var t=1,r=arguments,n=r.length;return e.replace(kL,(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""}}))},IL=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 TL.apply(null,n)},AL=["v","o","s","i","u","e","p","c","b","t","r","z","a"],RL=["i","c","b","a"],CL=yL,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||AL,n=t.innerOrder||RL,i=[];return r.forEach((function(t){EL[t].forEach((function(r){r.name in e&&null!=e[r.name]?i.push(IL(t,r,e)):r.push in e&&null!=e[r.push]&&e[r.push].forEach((function(e){i.push(IL(t,r,e))}))}))})),e.media.forEach((function(e){i.push(IL("m",EL.m[0],e)),n.forEach((function(t){EL[t].forEach((function(r){r.name in e&&null!=e[r.name]?i.push(IL(t,r,e)):r.push in e&&null!=e[r.push]&&e[r.push].forEach((function(e){i.push(IL(t,r,e))}))}))}))})),i.join("\r\n")+"\r\n"};gL.write=wL,gL.parse=CL.parse,gL.parseParams=CL.parseParams,gL.parseFmtpConfig=CL.parseFmtpConfig,gL.parsePayloads=CL.parsePayloads,gL.parseRemoteCandidates=CL.parseRemoteCandidates,gL.parseImageAttributes=CL.parseImageAttributes,gL.parseSimulcastStreamList=CL.parseSimulcastStreamList;var xL=Xe,OL=Nr,PL=Br,ML=function(e){for(var t=xL(this),r=PL(t),n=arguments.length,i=OL(n>1?arguments[1]:void 0,r),o=n>2?arguments[2]:void 0,a=void 0===o?r:OL(o,r);a>i;)t[i++]=e;return t};Rr({target:"Array",proto:!0},{fill:ML});var DL=Us("Array").fill,NL=ae,LL=DL,UL=Array.prototype,VL=function(e){var t=e.fill;return e===UL||NL(UL,e)&&t===UL.fill?LL:t},FL=new cO("FirefoxHandler",3),BL=Math.pow(2,32),jL="kp34Za0H+aVf862l",GL="o/i14u9pJrxRKAsu",HL=function(){return Math.floor(Math.random()*BL+1e4)};function zL(e){return e>BL-18?(FL.print("generateAllSsrc","reset start id",e),zL(e=e-BL+1e4+18)):{audio:e,audioFec:e+1,audioRtx:e+2,video:e+3,videoFec:e+4,videoRtx:e+5,next:e+18}}var KL=function(e,t,r){var n,i,o,a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:GL;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)}]},XL=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=lb(s).call(s,(function(t,r){return wm(t).call(t,KL(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 qL(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 YL=function(e,t,r){var n=!(arguments.length>3&&void 0!==arguments[3])||arguments[3],i=Zd(Zd({},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,gL.write(i)};function WL(e,t){return QL.apply(this,arguments)}function QL(){return(QL=Tm(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:return n={},i=r.publicIPs,o=r.certFingerprint,a=r.iceParams,s=r.iceConfig,n.fingerprint={type:"sha-256",hash:o},n.icePwd=a.serverIcePwd,e.next=6,ZL(a.serverIceUfrag);case 6:return n.iceUfrag=e.sent,n.candidates=JL(i,s),n.setup="active",n.iceOptions="renomination",e.abrupt("return",n);case 11:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function JL(e,t){if(!Array.isArray(e))return[];var r=0,n=2130706431,i=[];return e.forEach((function(e){var o={component:1,ip:e.ip,type:"host",generation:e.generation};e.udpPorts&&!t.tcpOnly&&e.udpPorts.forEach((function(e){i.push(Zd(Zd({},o),{},{foundation:r++,transport:"udp",port:e,priority:n}))})),e.tcpPorts&&e.tcpPorts.forEach((function(e){i.push(Zd(Zd({},o),{},{foundation:r++,transport:"tcp",port:e,tcptype:"passive",priority:2130705431}))}))})),i}var ZL=function(){var e=Tm(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,ZO.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=JO(Uint8Array,n,i,o,a),e.next=15,ZO.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)}}(),$L=function(e){return e[e.kICEConfigTypeSrtpDtlsType=0]="kICEConfigTypeSrtpDtlsType",e[e.kICEConfigTypeRenominationType=1]="kICEConfigTypeRenominationType",e[e.kICEConfigTypeTcpType=2]="kICEConfigTypeTcpType",e[e.kICEConfigTypeMultiSendType=3]="kICEConfigTypeMultiSendType",e[e.kICEConfigTypeKcpType=4]="kICEConfigTypeKcpType",e[e.kICEConfigTypeSrtpSdesType=5]="kICEConfigTypeSrtpSdesType",e}($L||{});function eU(e){var t,r=e.random,n=e.serverUfrag,i=e.serverPwd,o=e.clientPwd,a=e.options,s=(new TextEncoder).encode("WPRE");r||(r=new Uint8Array(4),crypto.getRandomValues(r));var c=EP(n);c.byteLength;var u=TP(EP(o),EP(i).subarray(0,16),EP(n).subarray(0,16));u.byteLength;var d=new Uint8Array(lb(t=an(a)).call(t,(function(e,t){var r=Number(t);return e.push(r),e.push(a[r]?1:0),e}),[]));d.byteLength;var l,h=JO(Uint8Array,s,r,[c.byteLength],c,[u.byteLength],u,d);h.byteLength%3!=0&&(h=JO(Uint8Array,h,VL(l=new Uint8Array(3-h.byteLength%3)).call(l,255)));return[kP(h),kP(JO(Uint8Array,r,c.subarray(0,20)))]}var tU=function(e,t){var r=0;if(Array.isArray(e.fmtp)&&Array.isArray(e.rtp)){var n,i=JT(e.fmtp);try{for(i.s();!(n=i.n()).done;){var o,a,s,c=n.value;if(fk(o=c.config).call(o,"level-asymmetry-allowed=1")&&fk(a=c.config).call(a,"packetization-mode=1")&&fk(s=c.config).call(s,"profile-level-id=42e0")){r=c.payload;break}}}catch(v){i.e(v)}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(ek(l=e.rtp).call(l,u,1)[0]);break}}else if(d.codec===t){var h;e.rtp.unshift(ek(h=e.rtp).call(h,u,1)[0]);break}}var p=[];e.rtp.forEach((function(e){return p.push(e.payload)})),e.payloads=p.join(" ")}},rU=new cO("BasicHandler",3),nU={iceServers:[],iceTransportPolicy:"all",bundlePolicy:"max-bundle",rtcpMuxPolicy:"require",sdpSemantics:"unified-plan",encodedInsertableStreams:!!uL()||void 0},iU=function(e){OI(o,e);var t,r,n,i=YI(o);function o(e){var t,r=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return Ll(this,o),Qd($T(t=i.call(this)),"_peerConnection",void 0),Qd($T(t),"_dataChannel",void 0),Qd($T(t),"_context",void 0),Qd($T(t),"peerConnectionMode",0),Qd($T(t),"peerConnectionId",""),Qd($T(t),"id",void 0),Qd($T(t),"_monitor",void 0),Qd($T(t),"_offerIce",{}),Qd($T(t),"_answerIce",{}),Qd($T(t),"_initSctpEvents",!1),Qd($T(t),"_nextSsrc",HL()),Qd($T(t),"_aSendonlyAnswerTpl",void 0),Qd($T(t),"_vSendonlyAnswerTpl",void 0),Qd($T(t),"_enableSubFlexfec",!1),Qd($T(t),"audioTrack4ff",void 0),Qd($T(t),"_connectionId",void 0),t.id=e.id,t._monitor=kO(t.id),t._peerConnection=new RTCPeerConnection(nU),r&&(t._dataChannel=t._peerConnection.createDataChannel("signaling",{negotiated:!0,id:100}),t._dataChannel.binaryType="arraybuffer"),t._context=e,t._peerConnection.ontrack=function(e){var r,n,i,o,a=null===(r=e.streams)||void 0===r||null===(n=r[0])||void 0===n?void 0:n.id;rU.print(t.peerConnectionId||"",wm(i=wm(o="pc.ontrack ".concat(e.track.kind," ")).call(o,e.track.id," ")).call(i,a)),"ff-stream"===a&&(t.audioTrack4ff=e.track),t.emit("ontrack",e)},t._peerConnection.onconnectionstatechange=function(e){var r;rU.print(t.peerConnectionId||"",wm(r="onconnectionstatechange ".concat(t._peerConnection.iceConnectionState," -> ")).call(r,t._peerConnection.connectionState)),"failed"!==t._peerConnection.iceConnectionState&&"closed"!==t._peerConnection.iceConnectionState&&"failed"!==t._peerConnection.connectionState||t.emit("disconnect")},t._peerConnection.oniceconnectionstatechange=function(){var e=t._peerConnection.iceConnectionState;t._report("rtc_pre_ice_state",{message:e,ice_state:e.toUpperCase()}),t.emit("ice_state",e)},t}return Nl(o,[{key:"getConnectionId",value:function(){return this._connectionId}},{key:"disconnect",value:function(){var e;this._peerConnection.close(),null===(e=this._dataChannel)||void 0===e||e.close(),this._peerConnection.ontrack=null}},{key:"destroy",value:function(){rU.print("destroy",this.peerConnectionId||""),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),rU.print("simulcast() ","simulcastLayers: %o",c)):(c=Fm(o=bm(a=bm(s=e.videoEncodeConfig).call(s,1)).call(a,1-i)).call(o,(function(e){var r=bP(e.width),n=t.width/r;return{width:r,height:Math.floor(t.height/n),scaleResolutionDownBy:n,frameRate:bP(e.frameRate)||15,maxkbps:e.maxKbps||600}})),rU.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=Zd({},hM);if(l){var p=null==l?void 0:l.getSettings();h={width:Math.floor(p.width),height:Math.floor(p.height),frameRate:Math.floor(p.frameRate)}}"number"!=typeof h.frameRate&&(h.frameRate=30);var v=null==e?void 0:e.videoEncodeConfig[0],f={maxBitrate:1e3*v.maxKbps,rid:"0"};if(e.prevBitrate=v.maxKbps,c.sendEncodings=[f],u.push({width:h.width,height:h.height,framerate:h.frameRate,maxkbps:v.maxKbps,rid:"0"}),!wP&&i){var _,m,g=function(e){for(var t=0,r=e.width*e.height,n=0;n<yD.length;n++)if(r>=yD[n].totalPixels){t=n;break}if(0===t)return yD[t].maxLayers;var i=yD[t-1].totalPixels;return(i-r)/(i-yD[t].totalPixels)<.1?yD[t-1].maxLayers:yD[t].maxLayers}(h);if(rU.print("simulcast() ","maxLayers: %o",g),g>1)this._simulcast(e,Zd(Zd({},h),{},{maxKbps:v.maxKbps}),c,u,g),null!==(_=this._context)&&void 0!==_&&null!==(m=_.serverConfig)&&void 0!==m&&m.simulcastOnDemand&&(d=Fm(u).call(u,(function(e,t){return Zd(Zd({},e),{},{video_index:t,sub_index:t})})))}}rU.print("publish videoTransceiverInit videoDescriptions","",c,u);var y=null==n?void 0:n.getTrack("preprocessing");(null==n?void 0:n.mixType)!==xl.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._reportRtcInvokeStatus("Handler.internalPublish",Mm({aTrack:mP(y),vTrack:mP(S),audioTransceiverInit:s,videoTransceiverInit:c}))}catch(sq){}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;rU.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 rU.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:Fm(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._reportRtcInvokeStatus("Handler.updateScaleResolutionDownBy",Mm(c.encodings))}catch(sq){}}}else rU.print("updateMaxBitrate()","no pub")}},{key:"getStats",value:function(e,t){return fL(this._peerConnection,e,t)}},{key:"setLocalDescription",value:(n=Tm(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=QO(),e.prev=1,e.next=4,this._peerConnection.setLocalDescription(new RTCSessionDescription({type:"offer",sdp:t}));case 4:this._report("rtc_set_description",{error_code:0,message:t,is_local:"1",direction:"local"===(null==r?void 0:r.streamUserId)?"up":"down",stream_id:(null==r?void 0:r.streamId)||"",stream_user_id:(null==r?void 0:r.streamUserId)||"",elapse:QO()-n},{type:"offer"}),this._initSctpEvents||(this._initSctpEvents=!0,(o=null===(i=this._peerConnection)||void 0===i?void 0:i.sctp)&&(o.onstatechange=function(){a._reportRtcInvokeStatus("sctp","sctp state change TO: ".concat(o.state))},o.transport&&(o.transport.onstatechange=function(){var e;a._reportRtcInvokeStatus("dtls","dtls state change TO: ".concat(null==o||null===(e=o.transport)||void 0===e?void 0:e.state))}))),e.next=12;break;case 8:e.prev=8,e.t0=e.catch(1),console.error("setLocal",e.t0),this._report("rtc_set_description",{error_code:-1,message:e.t0.message+t,is_local:"1",direction:"local"===(null==r?void 0:r.streamUserId)?"up":"down",stream_id:"",stream_user_id:"",elapse:QO()-n},{type:"offer"});case 12:case"end":return e.stop()}}),e,this,[[1,8]])}))),function(e,t){return n.apply(this,arguments)})},{key:"setRemoteDescription",value:(r=Tm(Em().mark((function e(t,r){var n;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=QO(),e.prev=1,e.next=4,this._peerConnection.setRemoteDescription(new RTCSessionDescription({type:"answer",sdp:t}));case 4:this._report("rtc_set_description",{error_code:0,message:t,is_local:"0",direction:"local"===(null==r?void 0:r.streamUserId)?"up":"down",stream_id:(null==r?void 0:r.streamId)||"",stream_user_id:(null==r?void 0:r.streamUserId)||"",elapse:QO()-n},{type:"answer"}),e.next=11;break;case 7:e.prev=7,e.t0=e.catch(1),console.error("setRemote",e.t0),this._report("rtc_set_description",{error_code:-1,message:e.t0.message+t,is_local:"0",direction:"local"===(null==r?void 0:r.streamUserId)?"up":"down",stream_id:(null==r?void 0:r.streamId)||"",stream_user_id:(null==r?void 0:r.streamUserId)||"",elapse:QO()-n},{type:"answer"});case 11:case"end":return e.stop()}}),e,this,[[1,7]])}))),function(e,t){return r.apply(this,arguments)})},{key:"setCurrentDescription",value:(t=Tm(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;gL.parse(e).media.forEach((function(e){if("audio"===e.type){if("sendonly"===e.direction){var r,n=null==e?void 0:mE(r=e.rtp).call(r,(function(e){return"opus"===e.codec}));if(n&&null!=e&&e.fmtp){var i,o=null==e?void 0:mE(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&&fk(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(fk(n=["vp8","h264"]).call(n,i.toLocaleLowerCase())){var a,s,c=mE(a=e.fmtp).call(a,(function(e){return e.payload===o}));if(c)c.config=wm(s=[]).call(s,Yk(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)})}}))}},{key:"_report",value:function(e,t,r){var n;null===(n=this._monitor)||void 0===n||n.report(e,Zd(Zd({},t),{},{connection_id:this._connectionId}),r)}},{key:"_reportRtcInvokeStatus",value:function(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?arguments[4]:void 0;this._report("rtc_invoke_status",{sdk_api_name:e,message:t,error_code:r,stream_id:n,elapse:0},i)}}]),o}(LM.exports.EventEmitter),oU=E,aU=Wg,sU=cg.exports.getWeakData,cU=fp,uU=tr,dU=z,lU=$,hU=Nh,pU=We,vU=Zi.set,fU=Zi.getterFor,_U=Do.find,mU=Do.findIndex,gU=oU([].splice),yU=0,SU=function(e){return e.frozen||(e.frozen=new bU)},bU=function(){this.entries=[]},EU=function(e,t){return _U(e.entries,(function(e){return e[0]===t}))};bU.prototype={get:function(e){var t=EU(this,e);if(t)return t[1]},has:function(e){return!!EU(this,e)},set:function(e,t){var r=EU(this,e);r?r[1]=t:this.entries.push([e,t])},delete:function(e){var t=mU(this.entries,(function(t){return t[0]===e}));return~t&&gU(this.entries,t,1),!!~t}};var kU,TU={getConstructor:function(e,t,r,n){var i=e((function(e,i){cU(e,o),vU(e,{type:t,id:yU++,frozen:void 0}),dU(i)||hU(i,e[n],{that:e,AS_ENTRIES:r})})),o=i.prototype,a=fU(t),s=function(e,t,r){var n=a(e),i=sU(uU(t),!0);return!0===i?SU(n).set(t,r):i[n.id]=r,e};return aU(o,{delete:function(e){var t=a(this);if(!lU(e))return!1;var r=sU(e);return!0===r?SU(t).delete(e):r&&pU(r,t.id)&&delete r[t.id]},has:function(e){var t=a(this);if(!lU(e))return!1;var r=sU(e);return!0===r?SU(t).has(e):r&&pU(r,t.id)}}),aU(o,r?{get:function(e){var t=a(this);if(lU(e)){var r=sU(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}},IU=n,AU=E,RU=Wg,CU=cg.exports,wU=qg,xU=TU,OU=$,PU=fg,MU=Zi.enforce,DU=Vi,NU=!IU.ActiveXObject&&"ActiveXObject"in IU,LU=function(e){return function(){return e(this,arguments.length?arguments[0]:void 0)}},UU=wU("WeakMap",LU,xU);if(DU&&NU){kU=xU.getConstructor(LU,"WeakMap",!0),CU.enable();var VU=UU.prototype,FU=AU(VU.delete),BU=AU(VU.has),jU=AU(VU.get),GU=AU(VU.set);RU(VU,{delete:function(e){if(OU(e)&&!PU(e)){var t=MU(this);return t.frozen||(t.frozen=new kU),FU(this,e)||t.frozen.delete(e)}return FU(this,e)},has:function(e){if(OU(e)&&!PU(e)){var t=MU(this);return t.frozen||(t.frozen=new kU),BU(this,e)||t.frozen.has(e)}return BU(this,e)},get:function(e){if(OU(e)&&!PU(e)){var t=MU(this);return t.frozen||(t.frozen=new kU),BU(this,e)?jU(this,e):t.frozen.get(e)}return jU(this,e)},set:function(e,t){if(OU(e)&&!PU(e)){var r=MU(this);r.frozen||(r.frozen=new kU),BU(this,e)?GU(this,e,t):r.frozen.set(e,t)}else GU(this,e,t);return this}})}var HU=ee.WeakMap;Rr({target:"WeakMap",proto:!0,real:!0,forced:!0},{emplace:wy}),Rr({target:"WeakMap",stat:!0,forced:!0},{from:yy}),Rr({target:"WeakMap",stat:!0,forced:!0},{of:by}),Rr({target:"WeakMap",proto:!0,real:!0,forced:!0},{deleteAll:Iy}),Rr({target:"WeakMap",proto:!0,real:!0,forced:!0},{upsert:QS});var zU=HU,KU=function(e){OI(p,e);var t,r,n,i,o,a,s,c,u,d,l,h=YI(p);function p(){var e,t,r;return Ll(this,p),Qd($T(r=h.call(this)),"inited",!1),Qd($T(r),"deviceMap",{audioinput:new JS,audiooutput:new JS,videoinput:new JS}),Qd($T(r),"checkDeviceChangeTimer",null),Qd($T(r),"isSupportedPermissionsQuery",!1),Qd($T(r),"isGrantedMicrophonePermission",!1),Qd($T(r),"isGrantedCameraPermission",!1),r.isSupportedPermissionsQuery=!AP()&&!(null===(e=navigator)||void 0===e||null===(t=e.permissions)||void 0===t||!t.query),r._handleDeviceChange=r._handleDeviceChange.bind($T(r)),!AP()&&r.refreshDevices(),r}return Nl(p,[{key:"refreshDevices",value:(l=Tm(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,!wP){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=Tm(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=Tm(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,!wP){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,Yk(rA(r=this.deviceMap.audioinput).call(r)),Yk(rA(n=this.deviceMap.videoinput).call(n)),Yk(rA(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||(fk(t=e.kind).call(t,"video")?c.emit(Ml.onVideoDeviceStateChanged,{mediaDeviceInfo:e,deviceState:"active"}):fk(r=e.kind).call(r,"audio")&&c.emit(Ml.onAudioDeviceStateChanged,{mediaDeviceInfo:e,deviceState:"active"}))})),s.forEach((function(e){var t,r;mE(a).call(a,(function(t){return t.deviceId===e.deviceId&&t.kind===e.kind}))||(c.deviceMap[e.kind].delete(e.deviceId),fk(t=e.kind).call(t,"video")?c.emit(Ml.onVideoDeviceStateChanged,{mediaDeviceInfo:e,deviceState:"inactive"}):fk(r=e.kind).call(r,"audio")&&c.emit(Ml.onAudioDeviceStateChanged,{mediaDeviceInfo:e,deviceState:"inactive"}))}));case 13:case"end":return e.stop()}}),e,this)}))),function(){return u.apply(this,arguments)})},{key:"getUserMedia",value:(c=Tm(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=Tm(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=Tm(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=Tm(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,Yk(rA(r=this.deviceMap.audioinput).call(r)),Yk(rA(n=this.deviceMap.videoinput).call(n)),Yk(rA(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=Tm(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(rA(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=Tm(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(rA(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=Tm(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(rA(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=Tm(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",mE(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)})}]),p}(FM),XU=new KU;!AP()&&(window.__rtc_dd__=XU);var qU=new cO("AudioContext",1),YU=function(){function e(){var t=this;Ll(this,e),Qd(this,"_audioContextInstance",void 0),Qd(this,"_contextStuckAt",0);var r=0;AP()||setInterval((function(){if(t._audioContextInstance){var e=t._audioContextInstance.currentTime;t._contextStuckAt?t._contextStuckAt!==e&&(t._contextStuckAt=0,qU.print("currentTime resume"),bO("currentTime resume","")):e&&r===e&&(t._contextStuckAt=e,qU.print("currentTime stuck",t._contextStuckAt),t._audioContextInstance.suspend(),t._audioContextInstance.resume(),bO("AudioContext currentTime stuck",t._contextStuckAt)),r=e}}),3e3)}return Nl(e,[{key:"getAudioContextInstance",value:function(){var e=this;if(!this._audioContextInstance){var t=window.AudioContext||window.webkitAudioContext;this._audioContextInstance=new t,this._audioContextInstance.onstatechange=function(){var t,r;qU.print("state change",null===(t=e._audioContextInstance)||void 0===t?void 0:t.state),"interrupted"===(null===(r=e._audioContextInstance)||void 0===r?void 0:r.state)&&e._audioContextInstance.resume()}}return this._audioContextInstance}}]),e}(),WU=function(){function e(t){Ll(this,e),Qd(this,"_ctx",void 0),Qd(this,"_analyserNode",void 0),Qd(this,"_audioSource",void 0);var r=QU.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 Nl(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=Tm(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}(),QU=new YU,JU=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}(JU||{}),ZU=function(){function e(t){Ll(this,e),Qd(this,"_plugins",new JS),this.id=t}var t;return Nl(e,[{key:"register",value:function(e){var t=this._plugins.get(e.type)||[];if(YA(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 mE(r=this._plugins.get(e)||[]).call(r,(function(e){return e.name===t}))}},{key:"getPreProcessingTrack",value:(t=Tm(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=JT(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}(),$U=function(e){return e[e.EXTERNAL=0]="EXTERNAL",e[e.INTERNAL=1]="INTERNAL",e}($U||{}),eV=new cO("VERTC",0),tV=new zU,rV=function(e){OI(r,e);var t=YI(r);function r(e,n){var i;return Ll(this,r),Qd($T(i=t.call(this)),"sourceType",1),Qd($T(i),"mediaType",void 0),Qd($T(i),"_trackId",void 0),Qd($T(i),"_ac",void 0),Qd($T(i),"_sourceNode",void 0),Qd($T(i),"_gainNode",void 0),Qd($T(i),"_destNode",void 0),Qd($T(i),"_channelCount",void 0),i._trackId=e,i.mediaType=n,"audio"===n&&dL()&&!dM("SKIP_WEB_AUDIO_IN_TRACK")&&(i._ac=QU.getAudioContextInstance(),i._gainNode=i._ac.createGain(),i._destNode=i._ac.createMediaStreamDestination(),i._gainNode.connect(i._destNode)),i}return Nl(r,[{key:"getId",value:function(){return this._trackId}},{key:"setVolume",value:function(e){this._gainNode&&(this._gainNode.gain.value=e/100)}},{key:"getVolume",value:function(){return this._gainNode?Math.round(100*this._gainNode.gain.value):-1}},{key:"channelCount",get:function(){var e;return null!==(e=this._channelCount)&&void 0!==e?e:0}},{key:"connectAudioTrack",value:function(e){var t;if(this._channelCount=e.getSettings().channelCount,!dL()||dM("SKIP_WEB_AUDIO_IN_TRACK"))return e;this._sourceNode&&(this._sourceNode.mediaStream.getTracks().forEach((function(e){e.stop()})),delete this._sourceNode);var r,n=new MediaStream;(n.addTrack(e),this._sourceNode=null===(t=this._ac)||void 0===t?void 0:t.createMediaStreamSource(n),this._gainNode)&&(null===(r=this._sourceNode)||void 0===r||r.connect(this._gainNode));return this._destNode.stream.getTracks()[0]}},{key:"destroy",value:function(){var e,t,r,n;(null===(e=this._sourceNode)||void 0===e||e.mediaStream.getTracks().forEach((function(e){e.stop()})),13!==HP)&&(null===(n=this._destNode)||void 0===n||n.stream.getTracks().forEach((function(e){e.stop()})));null===(t=this._sourceNode)||void 0===t||t.disconnect(),null===(r=this._gainNode)||void 0===r||r.disconnect(),delete this._sourceNode,delete this._gainNode,delete this._destNode}}]),r}(FM),nV=function(e){OI(n,e);var t,r=YI(n);function n(e,t,i){var o;return Ll(this,n),Qd($T(o=r.call(this,t,i)),"_mediaTrack",void 0),Qd($T(o),"_preProcessingTrack",void 0),Qd($T(o),"_originTrack",void 0),Qd($T(o),"handleTrackEnded",(function(){o.emit("track-ended",$T(o)),o.close()})),Qd($T(o),"handleMute",(function(){o.emit("track-mute",$T(o))})),Qd($T(o),"handleUnmute",(function(){o.emit("track-unmute",$T(o))})),o._mediaTrack="audio"===o.mediaType?o.connectAudioTrack(e):e,o._originTrack=e,o._initListeners(),o}return Nl(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="audio"===this.mediaType?this.connectAudioTrack(e):e,this._originTrack=e,t&&this.generatePreProcessingTrack(t)}},{key:"generatePreProcessingTrack",value:(t=Tm(Em().mark((function e(t){var r;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this._preProcessingTrack=void 0,e.prev=1,e.next=4,t.getPreProcessingTrack(this);case 4:(r=e.sent)instanceof MediaStreamTrack&&(this._preProcessingTrack=r),e.next=11;break;case 8:e.prev=8,e.t0=e.catch(1),console.error(e.t0);case 11:case"end":return e.stop()}}),e,this,[[1,8]])}))),function(e){return t.apply(this,arguments)})},{key:"getOrgTrack",value:function(){return this._originTrack}},{key:"close",value:function(){var e,t,r,n,i;return this._mediaTrack.onended=null,this._mediaTrack.onmute=null,this._mediaTrack.onunmute=null,null===(e=this._originTrack)||void 0===e||e.removeEventListener("ended",this.handleTrackEnded),null===(t=this._originTrack)||void 0===t||t.removeEventListener("mute",this.handleMute),null===(r=this._originTrack)||void 0===r||r.removeEventListener("unmute",this.handleUnmute),null===(n=this._preProcessingTrack)||void 0===n||n.stop(),"audio"===this.mediaType?this.destroy():null===(i=this._mediaTrack)||void 0===i?void 0:i.stop()}},{key:"_initListeners",value:function(){this._originTrack instanceof MediaStreamTrack&&(this._originTrack.addEventListener("ended",this.handleTrackEnded),this._originTrack.addEventListener("mute",this.handleMute),this._originTrack.addEventListener("unmute",this.handleUnmute))}}]),n}(rV),iV=function(e){OI(r,e);var t=YI(r);function r(e,n,i){var o;return Ll(this,r),Qd($T(o=t.call(this,n,i)),"_mediaTrack",void 0),Qd($T(o),"_originTrack",void 0),o._mediaTrack="audio"===o.mediaType?o.connectAudioTrack(e):e,o._originTrack=e,o}return Nl(r,[{key:"getTrack",value:function(){return this._mediaTrack}},{key:"getOrgTrack",value:function(){return this._originTrack}},{key:"close",value:function(){return this.destroy()}}]),r}(rV),oV=function(e){OI(n,e);var t,r=YI(n);function n(e,t){var i;return Ll(this,n),Qd($T(i=r.call(this,e,t,"video")),"resolution",void 0),Qd($T(i),"dummy",!1),i.resolution={width:0,height:0},i}return Nl(n,[{key:"updateVideoCaptureConfig",value:(t=Tm(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 eV.print("updateVideoEncoderConfig","update localVideoTrack: ",t),delete(r=Zd({},t)).contentHint,wP&&(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&&fk(t=["text","motion","detail"]).call(t,e)&&(this._mediaTrack.contentHint=e)}}]),n}(nV),aV=function(e){OI(n,e);var t,r=YI(n);function n(e,t){var i;return Ll(this,n),Qd($T(i=r.call(this,e,t,"audio")),"audioCaptureConfig",void 0),Qd($T(i),"_audioLevelFetcher",void 0),Qd($T(i),"mixedAudioTrack",void 0),Qd($T(i),"mixType",xl.PLAYOUT_AND_PUBLISH),i}return Nl(n,[{key:"getAudioLevel",value:function(){return this._audioLevelFetcher||(this._audioLevelFetcher=new WU(this.getTrack("preprocessing"))),this._audioLevelFetcher.getAudioLevel()}},{key:"updateAudioCaptureConfig",value:(t=Tm(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 eV.print("updateAudioCaptureConfig","update localAudioTrack: ",this.audioCaptureConfig),e.next=5,null===(t=this.getOrgTrack())||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}(nV),sV=function(e){OI(r,e);var t=YI(r);function r(e,n){return Ll(this,r),t.call(this,e,n,"video")}return Nl(r)}(iV),cV=function(e){OI(r,e);var t=YI(r);function r(e,n){var i;return Ll(this,r),Qd($T(i=t.call(this,e,n,"audio")),"_audioLevelFetcher",void 0),i}return Nl(r,[{key:"getAudioLevel",value:function(){return this._audioLevelFetcher||(this._audioLevelFetcher=new WU(this.getOrgTrack())),this._audioLevelFetcher.getAudioLevel()}}]),r}(iV),uV=function(e){OI(r,e);var t=YI(r);function r(){var e,n;Ll(this,r);for(var i=arguments.length,o=new Array(i),a=0;a<i;a++)o[a]=arguments[a];return Qd($T(n=t.call.apply(t,wm(e=[this]).call(e,o))),"streamIndex",cl.STREAM_INDEX_MAIN),n}return Nl(r)}(aV),dV=function(e){OI(r,e);var t=YI(r);function r(){var e,n;Ll(this,r);for(var i=arguments.length,o=new Array(i),a=0;a<i;a++)o[a]=arguments[a];return Qd($T(n=t.call.apply(t,wm(e=[this]).call(e,o))),"streamIndex",cl.STREAM_INDEX_MAIN),n}return Nl(r)}(oV),lV=function(e){OI(r,e);var t=YI(r);function r(){var e,n;Ll(this,r);for(var i=arguments.length,o=new Array(i),a=0;a<i;a++)o[a]=arguments[a];return Qd($T(n=t.call.apply(t,wm(e=[this]).call(e,o))),"streamIndex",cl.STREAM_INDEX_MAIN),Qd($T(n),"sourceType",0),n}return Nl(r)}(oV),hV=function(e){OI(r,e);var t=YI(r);function r(){var e,n;Ll(this,r);for(var i=arguments.length,o=new Array(i),a=0;a<i;a++)o[a]=arguments[a];return Qd($T(n=t.call.apply(t,wm(e=[this]).call(e,o))),"streamIndex",cl.STREAM_INDEX_MAIN),Qd($T(n),"sourceType",0),n}return Nl(r)}(aV),pV=function(e){OI(r,e);var t=YI(r);function r(){var e,n;Ll(this,r);for(var i=arguments.length,o=new Array(i),a=0;a<i;a++)o[a]=arguments[a];return Qd($T(n=t.call.apply(t,wm(e=[this]).call(e,o))),"streamIndex",cl.STREAM_INDEX_SCREEN),n}return Nl(r)}(oV),vV=function(e){OI(r,e);var t=YI(r);function r(){var e,n;Ll(this,r);for(var i=arguments.length,o=new Array(i),a=0;a<i;a++)o[a]=arguments[a];return Qd($T(n=t.call.apply(t,wm(e=[this]).call(e,o))),"streamIndex",cl.STREAM_INDEX_SCREEN),n}return Nl(r)}(aV),fV=function(e){OI(r,e);var t=YI(r);function r(){var e,n;Ll(this,r);for(var i=arguments.length,o=new Array(i),a=0;a<i;a++)o[a]=arguments[a];return Qd($T(n=t.call.apply(t,wm(e=[this]).call(e,o))),"streamIndex",cl.STREAM_INDEX_SCREEN),Qd($T(n),"sourceType",0),n}return Nl(r)}(oV),_V=function(e){OI(r,e);var t=YI(r);function r(){var e,n;Ll(this,r);for(var i=arguments.length,o=new Array(i),a=0;a<i;a++)o[a]=arguments[a];return Qd($T(n=t.call.apply(t,wm(e=[this]).call(e,o))),"streamIndex",cl.STREAM_INDEX_SCREEN),Qd($T(n),"sourceType",0),n}return Nl(r)}(aV);function mV(e,t){return gV.apply(this,arguments)}function gV(){return(gV=Tm(Em().mark((function e(t,r){var n;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return(n=new dV(t,WO())).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 yV(e,t){return SV.apply(this,arguments)}function SV(){return(SV=Tm(Em().mark((function e(t,r){var n;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return(n=new pV(t,WO())).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 bV(e,t){return EV.apply(this,arguments)}function EV(){return(EV=Tm(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 o=(null==t||null===(n=t.deviceId)||void 0===n?void 0:n.exact)||"default",a=kO(r.id),e.prev=2,eV.print("createCameraVideoTrack","constraints:",t),null==a||a.report("rtc_video_capture_event",{event_type:"start",media_device_id:o}),s=QO(),wP&&(t.frameRate={ideal:30,max:30}),e.next=9,XU.getUserMedia({video:t});case 9:i=e.sent,null==a||a.report("rtc_video_capture_event",{event_type:"start_capture_result",media_device_id:o,reason:"success",elapse:QO()-s}),e.next=17;break;case 13:throw e.prev=13,e.t0=e.catch(2),null==a||a.report("rtc_video_capture_event",{event_type:"running_failed",media_device_id:o,error_code:e.t0.code,reason:e.t0.name+e.t0.message}),new hR(dR.GET_VIDEO_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.getVideoTracks()[0],tV.set(u,i),d=new dV(u,WO()),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 kV(e,t){return TV.apply(this,arguments)}function TV(){return(TV=Tm(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 eV.print("createMicrophoneAudioTrack","constraints:",t),o=(null==t||null===(n=t.deviceId)||void 0===n?void 0:n.exact)||"default",a=kO(r.id),e.prev=3,null==a||a.report("rtc_video_capture_event",{event_type:"start",media_device_id:o}),s=QO(),(c=r.getPluginByName(JU.PRE_PROCESSING,"RTCAIAnsExtension"))&&(c.isOpen()?(t.autoGainControl=!0,t.noiseSuppression=!1):t.noiseSuppression=!0),e.next=10,XU.getUserMedia({audio:t});case 10:i=e.sent,null==a||a.report("rtc_video_capture_event",{event_type:"start_capture_result",media_device_id:o,reason:"success",elapse:QO()-s}),e.next=18;break;case 14:throw e.prev=14,e.t0=e.catch(3),null==a||a.report("rtc_video_capture_event",{event_type:"running_failed",media_device_id:o,error_code:e.t0.code,reason:e.t0.name+e.t0.message}),new hR(dR.GET_AUDIO_TRACK_FAILED,wm(u="throw error from getUserMedia. [".concat(e.t0.name||"unknown name","]: ")).call(u,e.t0.message||"unknown message","."),e.t0);case 18:return d=i.getAudioTracks()[0],tV.set(d,i),l=new uV(d,WO()),e.next=23,l.generatePreProcessingTrack(r);case 23:return e.abrupt("return",l);case 24:case"end":return e.stop()}}),e,null,[[3,14]])})))).apply(this,arguments)}function IV(){return AV.apply(this,arguments)}function AV(){return AV=Tm(Em().mark((function e(){var t,r,n,i,o,a,s,c,u,d,l=arguments;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=l.length>0&&void 0!==l[0]&&l[0],r=l.length>1?l[1]:void 0,n=l.length>2?l[2]:void 0,eV.print("createScreenTracks","withAudio: %o, constraints: %o",t,n),o=kO(r.id),e.prev=5,null==o||o.report("rtc_video_capture_event",{event_type:"start",media_device_id:"screen"}),a=QO(),e.next=10,navigator.mediaDevices.getDisplayMedia({video:!(n&&(!xP||16!==HP))||n,audio:!!t&&{channelCount:2,noiseSuppression:!1,echoCancellation:!1,autoGainControl:!1}});case 10:i=e.sent,null==o||o.report("rtc_video_capture_event",{event_type:"start_capture_result",media_device_id:"screen",reason:"success",elapse:QO()-a}),e.next=18;break;case 14:throw e.prev=14,e.t0=e.catch(5),null==o||o.report("rtc_video_capture_event",{event_type:"running_failed",media_device_id:"screen",error_code:e.t0.code,reason:e.t0.name+e.t0.message}),new hR(dR.GET_SCREEN_TRACK_FAILED,"throw error from getDisplayMedia",e.t0);case 18:return s=i.getVideoTracks()[0],c=new pV(s,WO()),e.next=22,c.generatePreProcessingTrack(r);case 22:if(!(u=i.getAudioTracks()[0])){e.next=28;break}return d=new vV(u,WO()),e.next=27,d.generatePreProcessingTrack(r);case 27:return e.abrupt("return",[c,d]);case 28:return e.abrupt("return",[c,void 0]);case 29:case"end":return e.stop()}}),e,null,[[5,14]])}))),AV.apply(this,arguments)}function RV(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:WO();return new cV(e,t)}function CV(e,t){return wV.apply(this,arguments)}function wV(){return(wV=Tm(Em().mark((function e(t,r){var n;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=new lV(t,WO()),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 xV(e,t){return OV.apply(this,arguments)}function OV(){return(OV=Tm(Em().mark((function e(t,r){var n;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=new hV(t,WO()),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 PV(e,t){return MV.apply(this,arguments)}function MV(){return(MV=Tm(Em().mark((function e(t,r){var n;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=new fV(t,WO()),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 DV(e,t){return NV.apply(this,arguments)}function NV(){return(NV=Tm(Em().mark((function e(t,r){var n;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=new _V(t,WO()),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 LV=aV,UV=cV,VV=function(e){return e[e.NONE=0]="NONE",e}(VV||{}),FV=function(){function e(){Ll(this,e)}return Nl(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(bm(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(bm(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(bm(i=t.buffer).call(i,t.position,t.position+4));t.skip(4);var s=new Uint8Array(bm(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}(),BV=function(){function e(t){Ll(this,e),Qd(this,"_position",0),Qd(this,"_dataview",void 0),this._dataview=new DataView(t)}return Nl(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}(),jV=function(e){return e[e.internal=0]="internal",e[e.external=1]="external",e[e.bypass=2]="bypass",e}(jV||{}),GV=new Uint8Array([109,167,53,190,103,90,72,1,170,89,63,164,194,199,19,85]),HV=new Uint8Array([109,167,53,190,103,90,72,1,170,89,63,164,194,199,19,84]),zV=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 KV(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 qV=function(){function e(){Ll(this,e)}return Nl(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?GV:HV,s=KV(e.byteLength+a.byteLength),c=zV(e);return new Uint8Array(wm(t=[]).call(t,Yk(n),Yk(i),Yk(o),Yk(s),Yk(a),Yk(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=bm(e).call(e,0,e.length-1));if(!(t.byteLength<2)){var r=0;if(5===t[1]||100===t[1]){var n=ZT(XV(t,r+=2),2),i=n[0],o=2,a=(r=n[1])+i;return t.byteLength>=HV.byteLength&&i>=HV.byteLength&&bm(t).call(t,r,r+HV.byteLength).toString()===HV.toString()?(r+=HV.byteLength,o=1):t.byteLength>=HV.byteLength&&i>=HV.byteLength&&bm(t).call(t,r,r+GV.byteLength).toString()===GV.toString()&&(r+=GV.byteLength,o=0),{type:o,payload:bm(t).call(t,r,a)}}}}},{key:"parseInternalSEI",value:function(e){var t=new JS,r=0;if(0===e.type){for(;e.payload.byteLength-r>=2;){var n=ZT(XV(e.payload,r),2),i=n[0];r=n[1];var o,a=ZT(XV(e.payload,r),2),s=a[0];if(r=a[1],t.get(i)||!(s<=e.payload.byteLength-r))break;t.set(i,bm(o=e.payload).call(o,r,r+s)),r+=s}return t}}},{key:"makeInternalSei",value:function(e){var t,r=[],n=JT(e);try{for(n.s();!(t=n.n()).done;){var i=ZT(t.value,2),o=i[0],a=i[1],s=KV(o),c=KV(a.byteLength);r.push(s,c,a)}}catch(l){n.e(l)}finally{n.f()}var u=lb(r).call(r,(function(e,t){return e+t.byteLength}),0),d=new Uint8Array(u);return lb(r).call(r,(function(e,t){return d.set(t,e),e+t.byteLength}),0),d}}]),e}(),YV=new cO("Stats",3),WV=function(){function e(t){Ll(this,e),Qd(this,"player",void 0),Qd(this,"_timer",void 0),Qd(this,"handler",void 0),Qd(this,"_monitor",void 0),Qd(this,"_destroyed",!1),this.id=t,this._monitor=kO(t)}return Nl(e,[{key:"setVar",value:function(e){this.handler=e}},{key:"clearTimer",value:function(){this._timer&&(YV.print("clearTimer","invoke"),clearTimeout(this._timer),delete this._timer,AO(this.id,"del_media_statistics_timer","".concat((new Error).stack),0,this._stream.streamId||""))}},{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(){YV.print("destroy","invoke"),AO(this.id,"media_statistics_destroy","".concat((new Error).stack),0,"".concat(this._stream.streamId)),this.clearTimer(),this._destroyed=!0}}]),e}(),QV=function(e){OI(i,e);var t,r,n=YI(i);function i(e,t){var r;return Ll(this,i),Qd($T(r=n.call(this,e)),"_context",void 0),r._stream=t,r}return Nl(i,[{key:"setLocalStreamStatsEvtInterval",value:function(e,t,r){var n,i,o,a=this;if(!this._timer){YV.print("setLocalStreamStatsEvtInterval","invoke"),this.setVar(t),this._context=r,this._destroyed=!1;var s={audio:{},video:{}},c=this._stream,u=null===(n=c.audioTrack)||void 0===n?void 0:n.getTrack("preprocessing"),d=null===(i=c.videoTrack)||void 0===i?void 0:i.getTrack("preprocessing");this.getAudioStats(u,s,null===(o=c.audioTrack)||void 0===o?void 0:o.getAudioLevel()),this.getVideoStats(d,s);var l=function(){var e=Tm(Em().mark((function e(){var t,r,n,i,o,u,d;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=null===(t=c.audioTrack)||void 0===t?void 0:t.getTrack("preprocessing"),o=null===(r=c.videoTrack)||void 0===r?void 0:r.getTrack("preprocessing"),e.next=4,a.getAudioStats(i,s,null===(n=c.audioTrack)||void 0===n?void 0:n.getAudioLevel());case 4:return u=e.sent,e.next=7,a.getVideoStats(o,s);case 7:return d=e.sent,e.abrupt("return",{audioStats:u,videoStats:d,isScreen:c.isScreen});case 9:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),h=function(){var t=Tm(Em().mark((function t(){var r;return Em().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,l();case 2:r=t.sent,e(r),a._destroyed||(a._timer=setTimeout(h,2e3));case 5:case"end":return t.stop()}}),t)})));return function(){return t.apply(this,arguments)}}();this._timer=setTimeout(h,2e3)}}},{key:"unpublish",value:function(){this.clearTimer()}},{key:"getAudioStats",value:(r=Tm(Em().mark((function e(t,r,n){var i,o,a,s,c,u,d,l,h,p,v,f,_,m,g;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(s={},c={timestamp:Date.now()},u=this._stream,d=u.streamId,l=u.audioMid,h=u.isScreen,p=u.pubAttributes,v=u.pubAudio,f=u.audioTrack,_={media_type:"audio",is_screen:!!h,direction:"up",stream_id:d,vid:l,connection_status:navigator.onLine,track_enabled:null==t?void 0:t.enabled,capture_state:p.localaudio?"capture_state_on":"capture_state_off",mute_state:v?"mute_state_off":"mute_state_on"},f&&(_.playback_volume=f.getVolume()),t&&this.handler){e.next=7;break}return e.abrupt("return",s);case 7:return e.next=9,this.handler.getStats(t);case 9:if((m=e.sent).length){e.next=12;break}return e.abrupt("return",s);case 12:if(m.forEach((function(e){var t=e.type,r=e.packetsSent,n=e.packetsLost,i=e.bytesSent,o=e.clockRate,a=e.roundTripTime,u=e.channels,d=e.audioLevel;e.googRtt;var l=e.mimeType,h=e.availableIncomingBitrate,p=e.availableOutgoingBitrate,v=e.bytesReceived,f=e.nominated,m=e.id,g=e.currentRoundTripTime,y=e.state,S=e.writable,b=e.requestsReceived,E=e.responsesReceived,k=e.requestsSent,T=e.consentRequestsSent,I=e.responsesSent,A=e.jitter,R=e.candidateType,C=e.ip,w=e.address,x=e.networkType,O=e.port,P=e.protocol,M=e.nackCount,D=e.retransmittedBytesSent,N=e.retransmittedPacketsSent,L=e.audioInputLevel,U=e.ssrc,V=e.totalAudioEnergy,F=e.totalSamplesDuration,B=e.mediaType,j=e.fractionLost;"outbound-rtp"===t?(c.packetsSent=r,c.bytesSent=i,_.bytes=i,_.packetsSent=r,_.nackCount=M,_.ssrc=U,_.retransmitted_bytes_sent=D,_.retransmitted_packets_sent=N,c.retransmittedBytesSent=D,c.retransmittedPacketsSent=N):"remote-inbound-rtp"===t?(c.packetsLost=n,_.packetsLost=n,_.net_jitter=1e3*A,s.rtt=1e3*a,_.rtt=s.rtt,s._fractionLost=j||0):"codec"===t?(s.recordSampleRate=o,s.numChannels=u,_.codecName=l):"media-source"===t&&void 0!==d?(_.audio_level=d?-10*YR(Math.pow(d,2)):d,_.volume=255*d,_.total_audio_energy=V,_.totalInputDuration=F):"ssrc"===t&&"audio"===B?_.send_level=L:"candidate-pair"===t?(_.ice_available_incoming_bitrate=h,_.ice_available_outgoing_bitrate=p,_.ice_bytes_received=v,_.ice_bytes_sent=i,_.ice_nominated=+f,_.ice_pair_id=m,_.ice_pair_rtt=g,_.ice_pair_state=y,_.ice_pair_writable=S,_.recv_ping_requests=b,_.recv_ping_responses=E,_.sent_ping_requests_before_first_response=k,_.sent_ping_requests_total=k+(T||0),_.sent_ping_responses=I):"local-candidate"===t?(_.local_candidate_type=R,_.local_ip=C||w,_.local_network_type=x,_.local_port=O,_.protocol=P):"remote-candidate"===t&&(_.remote_candidate_type=R,_.remote_ip=C||w,_.remote_port=O);var G=dM("STATS_SCALLBACK_SUPPORT");lL&&G||"media-source"===t&&(_.send_level=d)})),void 0===_.volume&&void 0!==n&&(_.volume=n,_.audio_level=n?-10*YR(Math.pow(n/255,2)):n),(g=r.audio).timestamp){e.next=18;break}return r.audio=c,e.abrupt("return",this.filterIllegal(s));case 18:return void 0!==c.packetsLost&&(s.audioLossRate=(c.packetsLost-g.packetsLost)/(c.packetsSent-g.packetsSent),s.audioLossRate=Number.isNaN(s.audioLossRate)?0:s.audioLossRate,_.fraction_lost=s.audioLossRate),s.statsInterval=c.timestamp-g.timestamp,_.stats_interval=s.statsInterval,s.sendKBitrate=(c.bytesSent-g.bytesSent||0)/s.statsInterval*8,_.mediaBitratebps=Math.round(1e3*s.sendKBitrate),_.bandwidth=Math.round(_.mediaBitratebps/1024),void 0!==c.retransmittedBytesSent&&(_.retransmitBitratebps=(c.retransmittedBytesSent-g.retransmittedBytesSent||0)/s.statsInterval),r.audio=c,_.vendor_mode=(null===(i=this._stream)||void 0===i?void 0:i.vendorCode)||0,_.pc_session_id=null===(o=this.handler)||void 0===o?void 0:o.peerConnectionId,null===(a=this._monitor)||void 0===a||a.report("rtc_media_statistics",_),s._retransmittedRate=(c.retransmittedPacketsSent-g.retransmittedPacketsSent)/(c.packetsSent-g.packetsSent),void 0===s.audioLossRate&&(s.audioLossRate=s._retransmittedRate,_.fraction_lost=s.audioLossRate),s._fractionLost=Math.max(s._fractionLost,s.audioLossRate),e.abrupt("return",this.filterIllegal(s));case 33:case"end":return e.stop()}}),e,this)}))),function(e,t,n){return r.apply(this,arguments)})},{key:"getVideoStats",value:(t=Tm(Em().mark((function e(t,r){var n,i,o,a,s,c,u,d,l,h,p,v,f,_,m,g,y,S,b,E,k,T;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n={},i={timestamp:Date.now(),simulcast:{}},o=this._stream,a=o.streamId,s=o.videoMid,c=o.isScreen,u=o.pubAttributes,d=o.enableSimulcast,l=o.pubVideo,e.t0=Zd,e.t1={media_type:"video",is_screen:!!c,direction:"up",stream_id:a,vid:s,connection_status:navigator.onLine,track_enabled:null==t?void 0:t.enabled,capture_state:u.localvideo?"capture_state_on":"capture_state_off",mute_state:l?"mute_state_off":"mute_state_on"},e.next=7,this._stream.requestVideoFrameCallback();case 7:if(e.t2=e.sent,h=(0,e.t0)(e.t1,e.t2),t&&this.handler){e.next=11;break}return e.abrupt("return",n);case 11:return h.cap_frame_width=t.getSettings().width,h.cap_frame_height=t.getSettings().height,n.isScreen=c,e.next=16,this.handler.getStats(t);case 16:if((p=e.sent).length){e.next=19;break}return e.abrupt("return",n);case 19:if(v=0,p.forEach((function(e){var o=e.type,a=e.framesEncoded,s=e.packetsLost,c=e.bytesSent,u=e.framesSent,l=e.retransmittedBytesSent,p=e.totalPacketSendDelay,f=e.totalEncodeTime,_=e.firCount,m=e.targetBitrate,g=e.roundTripTime,y=e.mimeType,S=e.frameWidth,b=e.frameHeight,E=e.packetsSent,k=e.googActualEncBitrate,T=e.googAvailableReceiveBandwidth,I=e.googAvailableSendBandwidth,A=e.googAvgEncodeMs,R=e.googBucketDelay,C=e.googEncodeUsagePercent,w=e.googFrameRateInput,x=e.availableIncomingBitrate,O=e.availableOutgoingBitrate,P=e.bytesReceived,M=e.nominated,D=e.id,N=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,Y=e.responsesReceived,W=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,pe=e.scalabilityMode;"outbound-rtp"===o?(d&&(oe?i.simulcast[oe]=e:i.simulcast[v]=e,v++),i.framesEncoded=a||i.framesEncoded||0,h.key_frames_encoded=he||0,i.bytesSent=c||i.bytesSent||0,i.framesSent=u||i.framesSent,h.bytes=c||h.bytes||0,i.packetsSent=E||i.packetsSent||0,h.packetsSent=E||h.packetsSent||0,h.nackCount=H||h.nackCount||0,h.pli_count=z||h.pli_count||0,h.qp_sum=X||h.qp_sum||0,h.ssrc=$||h.ssrc||0,h.retransmitted_packets_sent=re,i.retransmittedPacketsSent=re,i.retransmittedBytesSent=l,h.encoder_implementation=ne,h.qualityLimitationReason=ce,h.qualityLimitationDurations=ue,h.scalabilityMode=pe,void 0!==S&&((!n.encodedFrameWidth||S>n.encodedFrameWidth)&&(n.encodedFrameWidth=S),(!n.encodedFrameHeight||b>n.encodedFrameHeight)&&(n.encodedFrameHeight=b),h.frame_size_height=b,h.frame_size_width=S)):"track"===o?(n.encodedFrameWidth=S,n.encodedFrameHeight=b,h.frame_size_height=b,h.frame_size_width=S):"remote-inbound-rtp"===o?(i.packetsLost=s,n.rtt=1e3*g,h.rtt=n.rtt,h.jitter=1e3*ie,h.packetsLost=s,n._fractionLost=ae||0):"codec"===o?(n.codecType=y,h.codecName=y):"candidate-pair"===o?(h.ice_available_incoming_bitrate=x,h.ice_available_outgoing_bitrate=O,h.ice_bytes_received=P,h.ice_bytes_sent=c,h.ice_nominated=+M,h.ice_pair_id=D,h.ice_pair_rtt=N,h.ice_pair_state=L,h.ice_pair_writable=U,h.recv_ping_requests=q,h.recv_ping_responses=Y,h.sent_ping_requests_before_first_response=Q,h.sent_ping_requests_total=Q+J,h.sent_ping_responses=Z):"local-candidate"===o?(h.local_candidate_type=V,h.local_ip=F||B,h.local_network_type=j,h.local_port=G,h.protocol=K):"remote-candidate"===o?(h.remote_candidate_type=V,h.remote_ip=F||B,h.remote_port=G):"VideoBwe"===o?(h.encBitratebps=k,h.available_receive_bandwidth=T,h.available_send_bandwidth=I,h.bucket_delay=R,h.retransmitBitratebps=W,h.targetEncBitratebps=ee,h.transmit_bitrate=te,n._sendBandWidth=+I):"ssrc"===o&&(h.avg_encode_ms=A,h.encodeUsage=C,h.frame_rate_input=w,h.orignal_input_Framerate=+w,h.ddaptationChanges=se,h.firsReceived=de,h.frameRateSent=le);var ve=dM("STATS_SCALLBACK_SUPPORT");if(!lL||!ve){var fe=r.video,_e=i.timestamp-fe.timestamp;if("outbound-rtp"===o){var me=c-fe.bytesSent,ge=l-fe.retransmittedBytesSent;h.encBitratebps=Math.round(8e3*(me-ge)/_e),h.bucket_delay=p/E,h.retransmitBitratebps=Math.round(8e3*ge/_e),h.targetEncBitratebps=m,h.transmit_bitrate=Math.round(1e3*(c-fe.bytesSent)*8/_e),h.avg_encode_ms=1e3*f/a,h.firsReceived=_+z}else"candidate-pair"===o&&(h.available_send_bandwidth=O,n._sendBandWidth=O);if(t){var ye=null==t?void 0:t.getSettings().frameRate;h.orignal_input_Framerate=ye,h.frameRateSent=t.getSettings().frameRate}}})),(f=r.video).timestamp){e.next=25;break}return r.video=i,e.abrupt("return",this.filterIllegal(n));case 25:return n.statsInterval=i.timestamp-f.timestamp,h.stats_interval=n.statsInterval,_=an(i.simulcast),d?(h.sim_enc_width=[],h.sim_enc_height=[],h.sim_enc_bps=[],h.sim_enc_framerate=[],h.sim_enc_key_frames=[],h.sim_rids=[],h.sim_enc_bandwidth=[],h.sim_sent_framerate=[],h.sim_fraction_lost=[],h.sim_keyencoded=[],h.active_sim_streams=(null===(m=this._context)||void 0===m?void 0:m.activeSimStreams)||[],h.sim_retransmittedRate=[],b=!1,FA(_).call(_,(function(e,t){return+e-+t})).forEach((function(e){var t=i.simulcast[e],r=t.frameWidth,o=t.frameHeight,a=t.bytesSent,s=t.framesEncoded,c=t.framesSent,u=t.packetsLost,d=t.packetsSent,l=t.qualityLimitationReason,p=t.qualityLimitationDurations,v=t.qualityLimitationResolutionChanges,_=t.retransmittedPacketsSent,m=t.pliCount,g=t.keyFramesEncoded;void 0!==l&&(h.sim_qualityLimitationReason||(h.sim_qualityLimitationReason=[],h.sim_qualityLimitationDurations=[],h.sim_qualityLimitationResolutionChanges=[]),h.sim_qualityLimitationReason.push(l),h.sim_qualityLimitationDurations.push(p),h.sim_qualityLimitationResolutionChanges.push(v));var y=f.simulcast[e];if(h.sim_enc_width.push(r||0),h.sim_enc_height.push(o||0),h.sim_enc_key_frames.push(g||0),y){var S=(a-y.bytesSent||0)/n.statsInterval;h.sim_enc_bps.push(Math.round(8e3*S)),h.sim_enc_bandwidth.push(Math.round(8e3*S/1024));var E=1e3*(s-y.framesEncoded)/n.statsInterval;h.sim_enc_framerate.push(Math.round(E)),h.sim_rids.push(e);var k=void 0!==c?c-y.framesSent:s-y.framesEncoded,T=1e3*k/n.statsInterval;h.sim_sent_framerate.push(Math.round(T));var I=(u-y.packetsLost)/(d-y.packetsSent);n._retransmittedRate=(_-y.retransmittedPacketsSent)/(d-y.packetsSent),I=Number.isNaN(I)?0:I,h.sim_fraction_lost.push(I),h.sim_keyencoded.push(m-y.pliCount>0),h.sim_retransmittedRate.push(n._retransmittedRate),r>0&&!b&&(n.sentKBitrate=8*S,n.encoderOutputFrameRate=E,n.encodedFrameCount=k,n.sentFrameRate=T,n.videoLossRate=I,b=!0)}})),h.vendor_mode=(null===(g=this._stream)||void 0===g?void 0:g.vendorCode)||0,h.pc_session_id=null===(y=this.handler)||void 0===y?void 0:y.peerConnectionId,null===(S=this._monitor)||void 0===S||S.report("rtc_media_statistics",h)):(n.encodedFrameCount=void 0!==i.framesSent?i.framesSent-f.framesSent:i.framesEncoded-f.framesEncoded,n.sentKBitrate=(i.bytesSent-f.bytesSent||0)/n.statsInterval*8,h.bitrate=Math.round(1e3*n.sentKBitrate),h.bandwidth=Math.round(h.bitrate/1024),n.encoderOutputFrameRate=1e3*(i.framesEncoded-f.framesEncoded)/n.statsInterval,h.frame_rate_encoded=Math.round(n.encoderOutputFrameRate),n.sentFrameRate=1e3*n.encodedFrameCount/n.statsInterval,h.frame_rate_sent=Math.round(n.sentFrameRate),n.videoLossRate=(i.packetsLost-f.packetsLost)/(i.packetsSent-f.packetsSent),n.videoLossRate=Number.isNaN(n.videoLossRate)?0:n.videoLossRate,h.fraction_lost=n.videoLossRate,n._retransmittedRate=(i.retransmittedPacketsSent-f.retransmittedPacketsSent)/(i.packetsSent-f.packetsSent),h.vendor_mode=(null===(E=this._stream)||void 0===E?void 0:E.vendorCode)||0,h.pc_session_id=null===(k=this.handler)||void 0===k?void 0:k.peerConnectionId,null===(T=this._monitor)||void 0===T||T.report("rtc_media_statistics",h)),r.video=i,n._fractionLost=Math.max(n._fractionLost,n.videoLossRate),e.abrupt("return",this.filterIllegal(n));case 32:case"end":return e.stop()}}),e,this)}))),function(e,r){return t.apply(this,arguments)})}]),i}(WV),JV=function(e){OI(o,e);var t,r,n,i=YI(o);function o(e,t){var r;return Ll(this,o),Qd($T(r=i.call(this,e)),"isPaused",void 0),Qd($T(r),"pauseStart",void 0),Qd($T(r),"pauseDuration",void 0),Qd($T(r),"_audioStallCount",void 0),Qd($T(r),"_setAudioStallCount",void 0),Qd($T(r),"_audioStallTimer",void 0),Qd($T(r),"_audioStallInterval",void 0),Qd($T(r),"_audioStallRatio",void 0),Qd($T(r),"_videoInWaiting",void 0),Qd($T(r),"_context",void 0),r._stream=t,r._videoInWaiting=!1,r.pauseDuration=0,r}return Nl(o,[{key:"setRemoteStreamStatsEvtInterval",value:(n=Tm(Em().mark((function e(t,r,n){var i,a,s,c,u,d,l,h,p,v,f,_,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 YV.print("setRemoteStreamStatsEvtInterval","invoke"),this.setVar(r),this._context=n,this._audioStallInterval=o.audioStallInterval||100,this._audioStallRatio=o.audioStallRatio||.6,c={audio:{},video:{}},this._destroyed=!1,u=this._stream,d=null===(i=u.audioTrack)||void 0===i?void 0:i.getOrgTrack(),l=null===(a=u.videoTrack)||void 0===a?void 0:a.getTrack(),this.getRemoteVideoStats(l,c),e.next=15,this.getRemoteAudioStats(d,c,null===(s=this._stream.audioTrack)||void 0===s?void 0:s.getAudioLevel());case 15:this.delStatsEvtInterval(),h=0,p=0,f=[],_=0,m=QO(),this._setAudioStallCount=function(){if(cM.AUDIO_STALL&&S._audioStallInterval>0&&void 0!==c.audio.concealedSamples){var e=c.audio.concealedSamples,t=c.audio.totalSamplesReceived;m=QO();var r={isStall:!1,counted:!1,diff:0},n=.5*S._audioStallInterval;S._audioStallCount=Tm(Em().mark((function i(){var o,a,s,c,d,l,v,g,y,b,E,k,T,I,A,R,C;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,f.push({reason:wm(c="hasAudio: ".concat(a,", subAudio: ")).call(c,s)}),m=QO(),i.abrupt("return",{stall_count:h,stall_duration:p,stall_list:f,stats_count:_});case 7:return d=null===(o=u.audioTrack)||void 0===o?void 0:o.getOrgTrack(),l=Date.now(),i.next=11,S.handler.getStats(d,!0);case 11:if(v=i.sent,g=Date.now(),y=QO(),!((b=y-m)<n)){i.next=18;break}return f.push({diff:b,start:m,end:y,get_stats_cost:g-l,get_stats_start:l,get_stats_end:g,reason:wm(E="diff(".concat(b,") < minInterval(")).call(E,n,")")}),i.abrupt("return",{stall_count:h,stall_duration:p,stall_list:f,stats_count:_});case 18:if(k=v.length,T=mE(v).call(v,(function(e){return"inbound-rtp"===e.type}))){i.next=23;break}return f.push({diff:b,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:p,stall_list:f,stats_count:_});case 23:return I=T.concealedSamples,A=T.totalSamplesReceived,C=A-t,(R=I-e)>=0&&C>=0&&R>=S._audioStallRatio*C?(f.push({concealed:R,received:C,diff:b,start:m,end:y,get_stats_cost:g-l,get_stats_start:l,get_stats_end:g,is_stall:!0}),r.isStall?(r.counted?p+=b:(p=p+r.diff+b,h++),r.counted=!0):b>=200?(p+=b,h++,r.counted=!0):(r.counted=!1,r.diff=b),r.isStall=!0):(f.push({concealed:R,received:C,diff:b,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:p,stall_list:f,stats_count:_});case 32:case"end":return i.stop()}}),i)}))),v=function(){var e=Tm(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(v,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(v,S._audioStallInterval)}},this._setAudioStallCount(),g=function(){var e=Tm(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:return i=null===(t=u.audioTrack)||void 0===t?void 0:t.getOrgTrack(),o=null===(r=u.videoTrack)||void 0===r?void 0:r.getTrack(),e.next=4,S.getRemoteAudioStats(i,c,null===(n=S._stream.audioTrack)||void 0===n?void 0:n.getAudioLevel());case 4:return a=e.sent,h=0,p=0,f=[],_=0,e.next=11,S.getRemoteVideoStats(o,c);case 11:return s=e.sent,e.abrupt("return",{audioStats:a,videoStats:s,isScreen:u.isScreen,userId:u.userId,streamId:u.streamId});case 13:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),y=function(){var e=Tm(Em().mark((function e(){var r;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,g();case 2:r=e.sent,t(r),v&&(m=QO(),S._audioStallTimer&&clearTimeout(S._audioStallTimer),S._audioStallTimer=setTimeout(v,S._audioStallInterval)),S._timer&&clearTimeout(S._timer),S._destroyed||(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 27:case"end":return e.stop()}}),e,this)}))),function(e,t,r){return n.apply(this,arguments)})},{key:"delStatsEvtInterval",value:function(){wI(RI(o.prototype),"clearTimer",this).call(this),clearTimeout(this._audioStallTimer),this._audioStallCount=void 0,this._setAudioStallCount=void 0,this.pauseDuration=0}},{key:"unsubscribe",value:function(){YV.print("unsubscribe","invoke"),this.delStatsEvtInterval(),this._videoInWaiting=!1}},{key:"getRemoteAudioStats",value:(r=Tm(Em().mark((function e(t,r,n){var i,o,a,s,c,u,d,l,h,p,v,f,_,m,g,y,S,b,E,k,T,I,A,R,C,w,x=this;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(d={},l={},h=this._stream,p=h.streamId,v=h.userId,f=h.isScreen,_=h.audioMid,m=h.subMediaType,g=h._attributes,y=h.virtual,S=h.audioTrack,b={media_type:"audio",is_screen:!!f,direction:"down",stream_id:p,stream_user_id:v,vid:_,audio_mux:y,connection_status:navigator.onLine,track_enabled:null==t?void 0:t.enabled,mute_state:pP(m)?"mute_state_off":"mute_state_on",remote_user_capture_state:g.localaudio?"capture_state_on":"capture_state_off",remote_user_mute_state:g.localaudio&&g.audiostream?"mute_state_off":"mute_state_on"},S&&(b.playback_volume=S.getVolume()),t&&this.handler){e.next=7;break}return e.abrupt("return",d);case 7:return e.next=9,this.handler.getStats(t);case 9:if((E=e.sent).length){e.next=12;break}return e.abrupt("return",d);case 12:if(E.forEach((function(e){var t=e.type,r=e.packetsLost,i=e.packetsReceived,o=e.bytesReceived,a=e.jitterBufferDelay,s=e.jitterBufferEmittedCount,c=e.clockRate,u=e.channels,h=e.totalSamplesReceived,v=e.concealedSamples,f=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,C=e.availableIncomingBitrate,w=e.availableOutgoingBitrate,O=e.bytesSent,P=e.nominated,M=e.id,D=e.writable,N=e.jitter,L=e.candidateType,U=e.ip,V=e.address,F=e.networkType,B=e.port,j=e.protocol,G=e.audioOutputLevel,H=e.requestsReceived,z=e.responsesReceived,K=e.requestsSent,X=e.consentRequestsSent,q=e.responsesSent,Y=e.ssrc;e.kind;var W=e.nackCount,Q=e.lastPacketReceivedTimestamp,J=e.concealmentevents,Z=e.fecPacketsReceived;if("inbound-rtp"===t)l.packetsLost=r,l.packetsReceived=i,b.packetsLost=r,b.packetsReceived=i,b.packetsDiscarded=g,b.nackCount=W,b.lastPacketReceivedTimestamp=Q,b.concealmentevents=J,l.bytesReceived=o,void 0!==a&&(d.jitterBufferDelay=a/s*1e3,b.average_jitter_buffer_delay_ms=d.jitterBufferDelay),void 0!==h&&(l.totalSamplesReceived=h,d.concealedSamples=v,l.concealedSamples=v,l.silentConcealedSamples=f,b.concealedSamples=v,d.concealmentEvents=_,b.totalSamplesReceived=h),void 0!==Z&&(b.fec_packets_received=Z,l.fecPacketsReceived=Z),b.jitter=1e3*N,b.ssrc=Y,void 0!==E&&0!==E?(b.audio_level=E?-10*YR(Math.pow(E,2)):E,b.volume=255*E):(b.volume=null!=n?n:255*E,b.audio_level=n?-10*YR(Math.pow(n/255,2)):n),void 0!==k&&(b.total_audio_energy=k),void 0!==T&&(b.totalAudioDuration=T);else if("codec"===t)d.recordSampleRate=c,u&&(d.numChannels=u),b.codecName=I;else if("candidate-pair"===t){var $,ee,te;b.ice_available_incoming_bitrate=C,b.ice_available_outgoing_bitrate=w,b.ice_bytes_received=o,b.ice_bytes_sent=O,b.ice_nominated=+P,b.ice_pair_id=M,b.ice_pair_rtt=S,b.rtt=1e3*S,b.rtt&&null!==($=x._context)&&void 0!==$&&null!==(ee=$.streamRTT)&&void 0!==ee&&null!==(te=ee[p])&&void 0!==te&&te.audio&&(b.total_rtt_ms=b.rtt+x._context.streamRTT[p].audio),b.ice_pair_state=y,b.ice_pair_writable=D,b.recv_ping_requests=H,b.recv_ping_responses=z,b.sent_ping_requests_before_first_response=K,b.sent_ping_requests_total=K+(X||0),b.sent_ping_responses=q,"succeeded"===y&&(d.rtt=1e3*S,d.total_rtt=1e3*m)}else"track"===t&&void 0!==E?(0===E&&0!==n?(b.volume=n,b.audio_level=n?-10*YR(Math.pow(n/255,2)):n):(b.audio_level=E?-10*YR(Math.pow(E,2)):E,b.volume=255*E),b.total_audio_energy=k,b.totalAudioDuration=T):"ssrc"===t?(b.decodingNormal=A,b.recvAudioLevel=G,b.decodingMuted=R):"local-candidate"===t?(b.local_candidate_type=L,b.local_ip=U||V,b.local_network_type=F,b.local_port=B,b.protocol=j):"remote-candidate"===t&&(b.remote_candidate_type=L,b.remote_ip=U||V,b.remote_port=B)})),(k=r.audio).timestamp){e.next=18;break}return l.timestamp=Date.now(),r.audio=l,e.abrupt("return",this.filterIllegal(d));case 18:if(T={},void 0!==l.concealedSamples&&(b.interval_concealed_samples=l.concealedSamples-k.concealedSamples,b.interval_samples_received=l.totalSamplesReceived-k.totalSamplesReceived,b.interval_silent_concealed_samples=l.silentConcealedSamples-k.silentConcealedSamples),!(this._audioStallInterval>0&&void 0!==k.concealedSamples)){e.next=36;break}if(!this._audioStallCount&&this._setAudioStallCount&&this._setAudioStallCount(),clearTimeout(this._audioStallTimer),!this._audioStallCount){e.next=36;break}return e.next=26,this._audioStallCount();case 26:I=e.sent,A=I.stall_count,R=I.stall_duration,C=I.stall_list,w=I.stats_count,T.stall_list=C,T.stats_count=w,b.concealedSamples===b.interval_concealed_samples&&b.totalSamplesReceived===b.interval_samples_received?(b.stall_count=0,b.stall_duration=0):(b.stall_count=A,b.stall_duration=R),d.stallCount=b.stall_count,d.stallDuration=b.stall_duration;case 36:return l.timestamp=Date.now(),d.audioLossRate=(l.packetsLost-k.packetsLost)/(l.packetsReceived-k.packetsReceived+(l.packetsLost-k.packetsLost)),d.audioLossRate=Number.isNaN(d.audioLossRate)?0:d.audioLossRate,b.fraction_lost=d.audioLossRate,d.statsInterval=l.timestamp-k.timestamp,b.stats_interval=d.statsInterval,d.receivedKBitrate=(l.bytesReceived-k.bytesReceived||0)/d.statsInterval*8,b.bandwidth=Math.round(1e3*d.receivedKBitrate/1024),void 0!==l.concealedSamples&&(d.receivedSampleRate=1e3*b.interval_samples_received/d.statsInterval),void 0!==l.fecPacketsReceived&&(b.fecBitratebps=(l.fecPacketsReceived-k.fecPacketsReceived||0)/d.statsInterval),b.average_jitter_buffer_delay_ms&&b.total_rtt_ms&&(d.e2eDelay=b.average_jitter_buffer_delay_ms+b.total_rtt_ms),null!==(i=this._context)&&void 0!==i&&null!==(o=i.streamRTT)&&void 0!==o&&null!==(a=o[p])&&void 0!==a&&a.audio&&(d.totalRtt=(b.rtt?b.rtt:0)+this._context.streamRTT[p].audio),r.audio=l,b.vendor_mode=(null===(s=this._stream)||void 0===s?void 0:s.vendorCode)||0,b.pc_session_id=null===(c=this.handler)||void 0===c?void 0:c.peerConnectionId,null===(u=this._monitor)||void 0===u||u.report("rtc_media_statistics",b,T),e.abrupt("return",this.filterIllegal(d));case 53:case"end":return e.stop()}}),e,this)}))),function(e,t,n){return r.apply(this,arguments)})},{key:"getRemoteVideoStats",value:(t=Tm(Em().mark((function e(t,r){var n,i,o,a,s,c,u,d,l,h,p,v,f,_,m,g,y,S,b=this;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return u={},d={timestamp:Date.now()},l=this._stream,h=l.streamId,p=l.userId,v=l.isScreen,f=l.subMediaType,_=l._attributes,e.t0=Zd,e.t1={media_type:"video",is_screen:!!v,direction:"down",stream_id:h,stream_user_id:p,vid:this._stream.videoMid,connection_status:navigator.onLine,track_enabled:null==t?void 0:t.enabled,mute_state:vP(f)?"mute_state_off":"mute_state_on",remote_user_capture_state:_.localvideo?"capture_state_on":"capture_state_off",remote_user_mute_state:_.localvideo&&_.videostream?"mute_state_off":"mute_state_on"},e.next=7,this._stream.requestVideoFrameCallback();case 7:if(e.t2=e.sent,m=(0,e.t0)(e.t1,e.t2),t&&this.handler){e.next=11;break}return e.abrupt("return",u);case 11:return u.isScreen=v,e.next=14,this.handler.getStats(t);case 14:if((g=e.sent).length){e.next=17;break}return e.abrupt("return",u);case 17:if(g.forEach((function(e){var t=e.type,r=e.frameHeight,n=e.frameWidth,i=e.packetsLost,o=e.packetsReceived,a=e.bytesReceived,s=e.framesDecoded,c=e.jitterBufferDelay,l=e.jitterBufferEmittedCount,p=e.mimeType,v=e.firCount,f=e.availableIncomingBitrate,_=e.availableOutgoingBitrate,g=e.bytesSent,y=e.nominated,S=e.id,E=e.currentRoundTripTime,k=e.state,T=e.writable,I=e.candidateType,A=e.ip,R=e.address,C=e.networkType,w=e.port,x=e.nackCount,O=e.pliCount,P=e.protocol,M=e.requestsReceived,D=e.responsesReceived,N=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,K=e.framesDropped;if("inbound-rtp"===t)d.packetsLost=i,m.packetsLost=i,d.packetsReceived=o,m.packetsReceived=o,d.bytesReceived=a,m.bytes=a,d.framesDecoded=s,d.totalDecodeTime=G,void 0!==c&&(d.jitterBufferDelay=c/l*1e3,m.average_jitter_buffer_delay_ms=d.jitterBufferDelay),m.fir_count=v,m.nackCount=x,d.nackCount=x,m.pli_count=O,m.ssrc=V,m.framesDropped=K,m.jitter=1e3*F,m.framesReceived=B,d.framesReceived=B,m.framesDecoded=s,m.key_frames_decoded=j,m.decoder_name=H,m.last_packet_received_timestamp=z,void 0!==n&&(u.width=n,m.frame_size_width=n,u.height=r,m.frame_size_height=r);else if("track"===t&&void 0!==n)u.width=n,m.frame_size_width=n,u.height=r,m.frame_size_height=r,void 0!==B&&(m.framesReceived=B,d.framesReceived=B);else if("codec"===t)m.codecName=p;else if("candidate-pair"===t){var X,q,Y;m.ice_available_incoming_bitrate=f,m.ice_available_outgoing_bitrate=_,m.ice_bytes_received=a,m.ice_bytes_sent=g,m.ice_nominated=+y,m.ice_pair_id=S,m.ice_pair_rtt=E,m.rtt=1e3*E,m.rtt&&null!==(X=b._context)&&void 0!==X&&null!==(q=X.streamRTT)&&void 0!==q&&null!==(Y=q[h])&&void 0!==Y&&Y.video&&(m.total_rtt_ms=m.rtt+b._context.streamRTT[h].video),u.rtt=m.rtt,m.ice_pair_state=k,m.ice_pair_writable=T,m.recv_ping_requests=M,m.recv_ping_responses=D,m.sent_ping_requests_before_first_response=N,m.sent_ping_requests_total=N+(L||0),m.sent_ping_responses=U}else"local-candidate"===t?(m.local_candidate_type=I,m.local_ip=A||R,m.local_network_type=C,m.local_port=w,m.protocol=P):"remote-candidate"===t&&(m.remote_candidate_type=I,m.remote_ip=A||R,m.remote_port=w)})),(y=r.video).timestamp){e.next=22;break}return r.video=d,e.abrupt("return",this.filterIllegal(u));case 22:return u.videoLossRate=(d.packetsLost-y.packetsLost)/(d.packetsReceived-y.packetsReceived+(d.packetsLost-y.packetsLost)),y.totalDecodeTime&&y.framesDecoded&&d.framesDecoded!==y.framesDecoded&&(m.decode_elapse_per_frame=+((d.totalDecodeTime-y.totalDecodeTime)/(d.framesDecoded-y.framesDecoded)*1e3).toFixed(2)),u._retransmittedRate=(d.nackCount-y.nackCount)/(d.packetsReceived-y.packetsReceived+(d.packetsLost-y.packetsLost)),u.videoLossRate=Number.isNaN(u.videoLossRate)?0:u.videoLossRate,m.fraction_lost=u.videoLossRate,u.statsInterval=d.timestamp-y.timestamp,m.stats_interval=u.statsInterval,u.receivedKBitrate=(d.bytesReceived-y.bytesReceived||0)/u.statsInterval*8,m.bitrate=Math.round(1e3*u.receivedKBitrate),m.bandwidth=Math.round(m.bitrate/1024),u.decoderOutputFrameRate=1e3*(d.framesDecoded-y.framesDecoded)/u.statsInterval,u.receivedFrameRate=1e3*(d.framesReceived-y.framesReceived)/u.statsInterval,m.frame_rate_decoded=Math.round(u.decoderOutputFrameRate),m.frame_rate_received=Math.round(u.receivedFrameRate),m.average_jitter_buffer_delay_ms&&m.total_rtt_ms&&(u.e2eDelay=m.average_jitter_buffer_delay_ms+m.total_rtt_ms),null!==(n=this._context)&&void 0!==n&&null!==(i=n.streamRTT)&&void 0!==i&&null!==(o=i[h])&&void 0!==o&&o.video&&(u.totalRtt=(m.rtt?m.rtt:0)+this._context.streamRTT[h].video),r.video=d,this.processStall(this._stream,m,u,v),this.isPaused?(S=d.timestamp-(this.pauseStart||0),m.pause_duration=this.pauseDuration+(S>500?S:0),this.pauseStart=d.timestamp):m.pause_duration=this.pauseDuration,m.pause_duration=Math.min(m.stall_duration||m.stuck_length||0,m.pause_duration),this.pauseDuration=0,m.vendor_mode=(null===(a=this._stream)||void 0===a?void 0:a.vendorCode)||0,m.pc_session_id=null===(s=this.handler)||void 0===s?void 0:s.peerConnectionId,null===(c=this._monitor)||void 0===c||c.report("rtc_media_statistics",m),e.abrupt("return",this.filterIllegal(u));case 47: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(RI(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}(WV);Qd(JV,"audioStallInterval",void 0),Qd(JV,"audioStallRatio",void 0);var ZV,$V,eF=new cO("Stream",0),tF=function(e){OI(r,e);var t=YI(r);function r(){var e,n;Ll(this,r);for(var i=arguments.length,o=new Array(i),a=0;a<i;a++)o[a]=arguments[a];return Qd($T(n=t.call.apply(t,wm(e=[this]).call(e,o))),"videoDom",void 0),n}return Nl(r,[{key:"requestVideoFrameCallback",value:function(){var e=this;return new q_((function(t){var r,n=null===(r=e.videoDom)||void 0===r?void 0:r.requestVideoFrameCallback;if("function"==typeof n){var i=function(e,r){var n={};an(r).forEach((function(e){var t=e.replace(/[a-z]{1}[A-Z]{1}/g,(function(e){var t;return wm(t="".concat(e[0],"_")).call(t,e[1].toLowerCase())}));n["video_".concat(t)]=r[e]})),clearInterval(o),t(n)};n.call(e.videoDom,i);var o=setTimeout((function(){var r;null===(r=e.videoDom)||void 0===r||r.cancelVideoFrameCallback(i),t({})}),500)}else t({})}))}},{key:"stopReport",value:function(){this.statsReport.destroy()}}]),r}(FM),rF=function(e){return e[e.INIT=0]="INIT",e[e.SUB_ING=1]="SUB_ING",e[e.SUB_ED=2]="SUB_ED",e}(rF||{}),nF=function(e){OI(r,e);var t=YI(r);function r(e){var n;return Ll(this,r),Qd($T(n=t.call(this)),"isScreen",!1),Qd($T(n),"stream",void 0),Qd($T(n),"streamId",void 0),Qd($T(n),"audioMid",void 0),Qd($T(n),"videoMid",void 0),Qd($T(n),"seiList",[]),Qd($T(n),"videoTrack",void 0),Qd($T(n),"audioTrack",void 0),Qd($T(n),"videoTransceiver",void 0),Qd($T(n),"audioTransceiver",void 0),Qd($T(n),"videoEncodeConfig",[hM]),Qd($T(n),"subVideoDescriptions",[]),Qd($T(n),"enableSimulcast",!1),Qd($T(n),"observer",void 0),Qd($T(n),"statsReport",void 0),Qd($T(n),"prevBitrate",0),Qd($T(n),"pubAudio",!1),Qd($T(n),"pubVideo",!1),Qd($T(n),"vendorHandler",void 0),Qd($T(n),"pubAttributes",void 0),Qd($T(n),"vendorCode",0),Qd($T(n),"pcSessionId",void 0),n.engineId=e,n.stream=new MediaStream,n.pubAttributes={localaudio:!1,localvideo:!1,videostream:!1,audiostream:!1,extvideo:!1,extaudio:!1},n.statsReport=new QV(e,$T(n)),n}return Nl(r,[{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(uL()){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=qV.generateSEI(n.content),a=new Uint8Array(o.byteLength+t.data.byteLength);if(0===n.repeatCount)ek(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 eF.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 eF.print("no sender found when trying to bind encodedTransform")}},{key:"clean",value:function(){var e,t;AO(this.engineId,"localstream_clean","".concat((new Error).stack),0,this.streamId||""),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.stopReport(),this.prevBitrate=0,this.subVideoDescriptions=[],null===(t=this.vendorHandler)||void 0===t||t.destroy(),this.vendorCode=0,delete this.vendorHandler}},{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)}}]),r}(tF),iF=function(e){OI(r,e);var t=YI(r);function r(e,n,i,o,a,s){var c;return Ll(this,r),Qd($T(c=t.call(this)),"streamId",void 0),Qd($T(c),"userId",void 0),Qd($T(c),"isScreen",void 0),Qd($T(c),"isPublic",void 0),Qd($T(c),"hasVideo",void 0),Qd($T(c),"hasAudio",void 0),Qd($T(c),"_attributes",void 0),Qd($T(c),"streamState",void 0),Qd($T(c),"observer",void 0),Qd($T(c),"statsReport",void 0),Qd($T(c),"subVideo",void 0),Qd($T(c),"subAudio",void 0),Qd($T(c),"subMediaType",void 0),Qd($T(c),"subLayer",void 0),Qd($T(c),"audioMid",void 0),Qd($T(c),"videoMid",void 0),Qd($T(c),"_sequenceId",void 0),Qd($T(c),"stream",void 0),Qd($T(c),"videoTrack",void 0),Qd($T(c),"audioTrack",void 0),Qd($T(c),"videoTransceiver",void 0),Qd($T(c),"audioTransceiver",void 0),Qd($T(c),"recordedVideoFrames",void 0),Qd($T(c),"stillExist",void 0),Qd($T(c),"originalMediaType",void 0),Qd($T(c),"priority",void 0),Qd($T(c),"originalStreamIndex",0),Qd($T(c),"virtual",void 0),Qd($T(c),"vendorHandler",void 0),Qd($T(c),"vendorCode",0),Qd($T(c),"pcSessionId",void 0),c.engineId=e,c.virtual=!1,c.userId=n,c.isScreen=o,c.isPublic=a,c.streamId=i,c.hasAudio=s.audiostream&&s.localaudio,c.hasVideo=s.videostream&&s.localvideo,c._attributes=s,c.vendorCode=(null==s?void 0:s.vendorCode)||0,c.subVideo=!1,c.subAudio=!1,c._sequenceId=0,c.subMediaType=VV.NONE,c.subLayer={spatialLayer:0,spatialSubLayer:-1},c.streamState=0,c.statsReport=new JV(e,$T(c)),c.enableVendorMode&&(c.pcSessionId=nC()),c}return Nl(r,[{key:"vendor",get:function(){return this._attributes.vendorCode}},{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:"enableVendorMode",get:function(){return"number"==typeof this.attributes.vendorCode&&0!==this.attributes.vendorCode}},{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,this.vendorCode=e.vendorCode||0}},{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){FV.getNalunits(new BV(t.data)).forEach((function(t){if(t.sei){var r=qV.decodeSeiBody(t.body);r&&r.type!==jV.internal&&e.safeEmit("onSEIMessage",r.payload)}})),r.enqueue(t)}})).pipeTo(n)}else eF.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 eF.print("no receiver found when trying to bind encodedTransform")}},{key:"ontrack",value:function(e){var t,r,n,i,o,a;try{var s;AO(this.engineId,"Stream.ontrack",Mm({uid:this.userId,streamId:this.streamId,streams:lb(s=e.streams).call(s,(function(e,t){return e+(null==(r=t)?"undefined | null":"string"==typeof r?r:Mm({id:r.id,active:r.active}));var r}),""),transceiver:(i=e.transceiver,null==i?"undefined | null":"string"==typeof i?i:Mm({currentDirection:i.currentDirection,direction:i.direction,mid:i.mid,stopped:i.stopped,receiver:(a=i.receiver,null==a?"undefined | null":"string"==typeof a?a:Mm({track:mP(a.track)})),sender:(o=i.sender,null==o?"undefined | null":"string"==typeof o?o:Mm({track:mP(o.track)}))})),track:mP(e.track)}),0,this.streamId||"")}catch(sq){}if(this.enableVendorMode||null!==(t=e.streams)&&void 0!==t&&null!==(r=t[0])&&void 0!==r&&null!==(n=r.id)&&void 0!==n&&fk(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,r,n;eF.print("clean",wm(e="exec stream.clean ".concat(this.streamId," ")).call(e,this.userId)),AO(this.engineId,"remotestream_clean","".concat((new Error).stack),0,this.streamId),this.subAudio=!1,this.subVideo=!1,this.audioMid=void 0,this.videoMid=void 0,this.sequenceId=0,this.videoTrack=void 0,null===(t=this.audioTrack)||void 0===t||t.close(),this.audioTrack=void 0,this.stream=void 0,this.videoTransceiver=void 0,this.audioTransceiver=void 0,this.recordedVideoFrames=void 0,null===(r=this.observer)||void 0===r||r.reset(),null===(n=this.vendorHandler)||void 0===n||n.destroy(),this.vendorCode=0,delete this.vendorHandler,this.stopReport(),delete this.priority}},{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=RV(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]:WO();return new sV(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=mE(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}(tF),oF=new cO("queue",4),aF=function(e){return e[e.ADD=0]="ADD",e[e.CLOSE=1]="CLOSE",e}(aF||{}),sF=function(e){return e.publish="publish",e.unpublish="unpublish",e.subscribe="subscribe",e.unsubscribe="unsubscribe",e.pushtrack="pushtrack",e.removetrack="removetrack",e}(sF||{}),cF=(Qd(ZV={},"publish","unpublish"),Qd(ZV,"subscribe","unsubscribe"),Qd(ZV,"pushtrack","removetrack"),ZV),uF=(Qd($V={},"publish",0),Qd($V,"subscribe",0),Qd($V,"pushtrack",0),Qd($V,"unpublish",1),Qd($V,"unsubscribe",1),Qd($V,"removetrack",1),$V),dF=function(e){OI(r,e);var t=YI(r);function r(){var e;return Ll(this,r),Qd($T(e=t.call(this)),"_queue",void 0),e._queue=[],e}return Nl(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!==cF[t.action]||(n=t.streamId,oF.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;OP&&YP>=86&&YP<=92&&(t=Math.min(this._queue.length,5));for(var r=uF[this._queue[0].action],n=1;n<t;n++){var i;if(uF[this._queue[n].action]!==r)return{sdpStrategy:r,items:ek(i=this._queue).call(i,0,n)}}return{sdpStrategy:r,items:ek(e=this._queue).call(e,0,t)}}}]),r}(UM),lF="object"==typeof global&&global&&global.Object===Object&&global,hF="object"==typeof self&&self&&self.Object===Object&&self,pF=lF||hF||Function("return this")(),vF=pF.Symbol,fF=Object.prototype,_F=fF.hasOwnProperty,mF=fF.toString,gF=vF?vF.toStringTag:void 0;var yF=Object.prototype.toString;var SF=vF?vF.toStringTag:void 0;function bF(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":SF&&SF in Object(e)?function(e){var t=_F.call(e,gF),r=e[gF];try{e[gF]=void 0;var n=!0}catch(o){}var i=mF.call(e);return n&&(t?e[gF]=r:delete e[gF]),i}(e):function(e){return yF.call(e)}(e)}function EF(e){return null!=e&&"object"==typeof e}var kF=Array.isArray;function TF(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function IF(e){return e}function AF(e){if(!TF(e))return!1;var t=bF(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t}var RF,CF=pF["__core-js_shared__"],wF=(RF=/[^.]+$/.exec(CF&&CF.keys&&CF.keys.IE_PROTO||""))?"Symbol(src)_1."+RF:"";var xF=Function.prototype.toString;function OF(e){if(null!=e){try{return xF.call(e)}catch(t){}try{return e+""}catch(t){}}return""}var PF=/^\[object .+?Constructor\]$/,MF=Function.prototype,DF=Object.prototype,NF=MF.toString,LF=DF.hasOwnProperty,UF=RegExp("^"+NF.call(LF).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function VF(e){return!(!TF(e)||(t=e,wF&&wF in t))&&(AF(e)?UF:PF).test(OF(e));var t}function FF(e,t){var r=function(e,t){return null==e?void 0:e[t]}(e,t);return VF(r)?r:void 0}var BF=FF(pF,"WeakMap"),jF=Object.create,GF=function(){function e(){}return function(t){if(!TF(t))return{};if(jF)return jF(t);e.prototype=t;var r=new e;return e.prototype=void 0,r}}();function HF(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 zF=Date.now;var KF,XF,qF,YF=function(){try{var e=FF(Object,"defineProperty");return e({},"",{}),e}catch(t){}}(),WF=YF,QF=WF?function(e,t){return WF(e,"toString",{configurable:!0,enumerable:!1,value:(r=t,function(){return r}),writable:!0});var r}:IF,JF=(KF=QF,XF=0,qF=0,function(){var e=zF(),t=16-(e-qF);if(qF=e,t>0){if(++XF>=800)return arguments[0]}else XF=0;return KF.apply(void 0,arguments)}),ZF=JF;var $F=/^(?:0|[1-9]\d*)$/;function eB(e,t){var r=typeof e;return!!(t=null==t?9007199254740991:t)&&("number"==r||"symbol"!=r&&$F.test(e))&&e>-1&&e%1==0&&e<t}function tB(e,t,r){"__proto__"==t&&WF?WF(e,t,{configurable:!0,enumerable:!0,value:r,writable:!0}):e[t]=r}function rB(e,t){return e===t||e!=e&&t!=t}var nB=Object.prototype.hasOwnProperty;function iB(e,t,r){var n=e[t];nB.call(e,t)&&rB(n,r)&&(void 0!==r||t in e)||tB(e,t,r)}function oB(e,t,r,n){var i=!r;r||(r={});for(var o=-1,a=t.length;++o<a;){var s=t[o],c=n?n(r[s],e[s],s,r,e):void 0;void 0===c&&(c=e[s]),i?tB(r,s,c):iB(r,s,c)}return r}var aB=Math.max;function sB(e,t){return ZF(function(e,t,r){return t=aB(void 0===t?e.length-1:t,0),function(){for(var n=arguments,i=-1,o=aB(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),HF(e,this,s)}}(e,t,IF),e+"")}function cB(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=9007199254740991}function uB(e){return null!=e&&cB(e.length)&&!AF(e)}var dB=Object.prototype;function lB(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||dB)}function hB(e){return EF(e)&&"[object Arguments]"==bF(e)}var pB=Object.prototype,vB=pB.hasOwnProperty,fB=pB.propertyIsEnumerable,_B=hB(function(){return arguments}())?hB:function(e){return EF(e)&&vB.call(e,"callee")&&!fB.call(e,"callee")},mB=_B;var gB="object"==typeof exports&&exports&&!exports.nodeType&&exports,yB=gB&&"object"==typeof module&&module&&!module.nodeType&&module,SB=yB&&yB.exports===gB?pF.Buffer:void 0,bB=(SB?SB.isBuffer:void 0)||function(){return!1},EB={};function kB(e){return function(t){return e(t)}}EB["[object Float32Array]"]=EB["[object Float64Array]"]=EB["[object Int8Array]"]=EB["[object Int16Array]"]=EB["[object Int32Array]"]=EB["[object Uint8Array]"]=EB["[object Uint8ClampedArray]"]=EB["[object Uint16Array]"]=EB["[object Uint32Array]"]=!0,EB["[object Arguments]"]=EB["[object Array]"]=EB["[object ArrayBuffer]"]=EB["[object Boolean]"]=EB["[object DataView]"]=EB["[object Date]"]=EB["[object Error]"]=EB["[object Function]"]=EB["[object Map]"]=EB["[object Number]"]=EB["[object Object]"]=EB["[object RegExp]"]=EB["[object Set]"]=EB["[object String]"]=EB["[object WeakMap]"]=!1;var TB="object"==typeof exports&&exports&&!exports.nodeType&&exports,IB=TB&&"object"==typeof module&&module&&!module.nodeType&&module,AB=IB&&IB.exports===TB&&lF.process,RB=function(){try{var e=IB&&IB.require&&IB.require("util").types;return e||AB&&AB.binding&&AB.binding("util")}catch(t){}}(),CB=RB&&RB.isTypedArray,wB=CB?kB(CB):function(e){return EF(e)&&cB(e.length)&&!!EB[bF(e)]},xB=Object.prototype.hasOwnProperty;function OB(e,t){var r=kF(e),n=!r&&mB(e),i=!r&&!n&&bB(e),o=!r&&!n&&!i&&wB(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&&!xB.call(e,u)||a&&("length"==u||i&&("offset"==u||"parent"==u)||o&&("buffer"==u||"byteLength"==u||"byteOffset"==u)||eB(u,c))||s.push(u);return s}function PB(e,t){return function(r){return e(t(r))}}var MB=PB(Object.keys,Object),DB=Object.prototype.hasOwnProperty;function NB(e){return uB(e)?OB(e):function(e){if(!lB(e))return MB(e);var t=[];for(var r in Object(e))DB.call(e,r)&&"constructor"!=r&&t.push(r);return t}(e)}var LB=Object.prototype.hasOwnProperty;function UB(e){if(!TF(e))return function(e){var t=[];if(null!=e)for(var r in Object(e))t.push(r);return t}(e);var t=lB(e),r=[];for(var n in e)("constructor"!=n||!t&&LB.call(e,n))&&r.push(n);return r}function VB(e){return uB(e)?OB(e,!0):UB(e)}var FB,BB=(FB=function(e,t){oB(t,VB(t),e)},sB((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=FB.length>3&&"function"==typeof i?(n--,i):void 0,o&&function(e,t,r){if(!TF(r))return!1;var n=typeof t;return!!("number"==n?uB(r)&&eB(t,r.length):"string"==n&&t in r)&&rB(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&&FB(e,a,r,i)}return e}))),jB=FF(Object,"create");var GB=Object.prototype.hasOwnProperty;var HB=Object.prototype.hasOwnProperty;function zB(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}function KB(e,t){for(var r=e.length;r--;)if(rB(e[r][0],t))return r;return-1}zB.prototype.clear=function(){this.__data__=jB?jB(null):{},this.size=0},zB.prototype.delete=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t},zB.prototype.get=function(e){var t=this.__data__;if(jB){var r=t[e];return"__lodash_hash_undefined__"===r?void 0:r}return GB.call(t,e)?t[e]:void 0},zB.prototype.has=function(e){var t=this.__data__;return jB?void 0!==t[e]:HB.call(t,e)},zB.prototype.set=function(e,t){var r=this.__data__;return this.size+=this.has(e)?0:1,r[e]=jB&&void 0===t?"__lodash_hash_undefined__":t,this};var XB=Array.prototype.splice;function qB(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}qB.prototype.clear=function(){this.__data__=[],this.size=0},qB.prototype.delete=function(e){var t=this.__data__,r=KB(t,e);return!(r<0)&&(r==t.length-1?t.pop():XB.call(t,r,1),--this.size,!0)},qB.prototype.get=function(e){var t=this.__data__,r=KB(t,e);return r<0?void 0:t[r][1]},qB.prototype.has=function(e){return KB(this.__data__,e)>-1},qB.prototype.set=function(e,t){var r=this.__data__,n=KB(r,e);return n<0?(++this.size,r.push([e,t])):r[n][1]=t,this};var YB=FF(pF,"Map");function WB(e,t){var r,n,i=e.__data__;return("string"==(n=typeof(r=t))||"number"==n||"symbol"==n||"boolean"==n?"__proto__"!==r:null===r)?i["string"==typeof t?"string":"hash"]:i.map}function QB(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}function JB(e,t){for(var r=-1,n=t.length,i=e.length;++r<n;)e[i+r]=t[r];return e}QB.prototype.clear=function(){this.size=0,this.__data__={hash:new zB,map:new(YB||qB),string:new zB}},QB.prototype.delete=function(e){var t=WB(this,e).delete(e);return this.size-=t?1:0,t},QB.prototype.get=function(e){return WB(this,e).get(e)},QB.prototype.has=function(e){return WB(this,e).has(e)},QB.prototype.set=function(e,t){var r=WB(this,e),n=r.size;return r.set(e,t),this.size+=r.size==n?0:1,this};var ZB=PB(Object.getPrototypeOf,Object);function $B(e){var t=this.__data__=new qB(e);this.size=t.size}$B.prototype.clear=function(){this.__data__=new qB,this.size=0},$B.prototype.delete=function(e){var t=this.__data__,r=t.delete(e);return this.size=t.size,r},$B.prototype.get=function(e){return this.__data__.get(e)},$B.prototype.has=function(e){return this.__data__.has(e)},$B.prototype.set=function(e,t){var r=this.__data__;if(r instanceof qB){var n=r.__data__;if(!YB||n.length<199)return n.push([e,t]),this.size=++r.size,this;r=this.__data__=new QB(n)}return r.set(e,t),this.size=r.size,this};var ej="object"==typeof exports&&exports&&!exports.nodeType&&exports,tj=ej&&"object"==typeof module&&module&&!module.nodeType&&module,rj=tj&&tj.exports===ej?pF.Buffer:void 0,nj=rj?rj.allocUnsafe:void 0;function ij(){return[]}var oj=Object.prototype.propertyIsEnumerable,aj=Object.getOwnPropertySymbols,sj=aj?function(e){return null==e?[]:(e=Object(e),function(e,t){for(var r=-1,n=null==e?0:e.length,i=0,o=[];++r<n;){var a=e[r];t(a,r,e)&&(o[i++]=a)}return o}(aj(e),(function(t){return oj.call(e,t)})))}:ij;var cj=Object.getOwnPropertySymbols?function(e){for(var t=[];e;)JB(t,sj(e)),e=ZB(e);return t}:ij;function uj(e,t,r){var n=t(e);return kF(e)?n:JB(n,r(e))}function dj(e){return uj(e,NB,sj)}function lj(e){return uj(e,VB,cj)}var hj=FF(pF,"DataView"),pj=FF(pF,"Promise"),vj=FF(pF,"Set"),fj="[object Map]",_j="[object Promise]",mj="[object Set]",gj="[object WeakMap]",yj="[object DataView]",Sj=OF(hj),bj=OF(YB),Ej=OF(pj),kj=OF(vj),Tj=OF(BF),Ij=bF;(hj&&Ij(new hj(new ArrayBuffer(1)))!=yj||YB&&Ij(new YB)!=fj||pj&&Ij(pj.resolve())!=_j||vj&&Ij(new vj)!=mj||BF&&Ij(new BF)!=gj)&&(Ij=function(e){var t=bF(e),r="[object Object]"==t?e.constructor:void 0,n=r?OF(r):"";if(n)switch(n){case Sj:return yj;case bj:return fj;case Ej:return _j;case kj:return mj;case Tj:return gj}return t});var Aj=Ij,Rj=Object.prototype.hasOwnProperty;var Cj=pF.Uint8Array;function wj(e){var t=new e.constructor(e.byteLength);return new Cj(t).set(new Cj(e)),t}var xj=/\w*$/;var Oj=vF?vF.prototype:void 0,Pj=Oj?Oj.valueOf:void 0;function Mj(e,t,r){var n,i,o,a=e.constructor;switch(t){case"[object ArrayBuffer]":return wj(e);case"[object Boolean]":case"[object Date]":return new a(+e);case"[object DataView]":return function(e,t){var r=t?wj(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.byteLength)}(e,r);case"[object Float32Array]":case"[object Float64Array]":case"[object Int8Array]":case"[object Int16Array]":case"[object Int32Array]":case"[object Uint8Array]":case"[object Uint8ClampedArray]":case"[object Uint16Array]":case"[object Uint32Array]":return function(e,t){var r=t?wj(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.length)}(e,r);case"[object Map]":case"[object Set]":return new a;case"[object Number]":case"[object String]":return new a(e);case"[object RegExp]":return(o=new(i=e).constructor(i.source,xj.exec(i))).lastIndex=i.lastIndex,o;case"[object Symbol]":return n=e,Pj?Object(Pj.call(n)):{}}}var Dj=RB&&RB.isMap,Nj=Dj?kB(Dj):function(e){return EF(e)&&"[object Map]"==Aj(e)};var Lj=RB&&RB.isSet,Uj=Lj?kB(Lj):function(e){return EF(e)&&"[object Set]"==Aj(e)},Vj="[object Arguments]",Fj="[object Function]",Bj="[object Object]",jj={};function Gj(e,t,r,n,i,o){var a,s=1&t,c=2&t,u=4&t;if(r&&(a=i?r(e,n,i,o):r(e)),void 0!==a)return a;if(!TF(e))return e;var d=kF(e);if(d){if(a=function(e){var t=e.length,r=new e.constructor(t);return t&&"string"==typeof e[0]&&Rj.call(e,"index")&&(r.index=e.index,r.input=e.input),r}(e),!s)return function(e,t){var r=-1,n=e.length;for(t||(t=Array(n));++r<n;)t[r]=e[r];return t}(e,a)}else{var l=Aj(e),h=l==Fj||"[object GeneratorFunction]"==l;if(bB(e))return function(e,t){if(t)return e.slice();var r=e.length,n=nj?nj(r):new e.constructor(r);return e.copy(n),n}(e,s);if(l==Bj||l==Vj||h&&!i){if(a=c||h?{}:function(e){return"function"!=typeof e.constructor||lB(e)?{}:GF(ZB(e))}(e),!s)return c?function(e,t){return oB(e,cj(e),t)}(e,function(e,t){return e&&oB(t,VB(t),e)}(a,e)):function(e,t){return oB(e,sj(e),t)}(e,function(e,t){return e&&oB(t,NB(t),e)}(a,e))}else{if(!jj[l])return i?e:{};a=Mj(e,l,s)}}o||(o=new $B);var p=o.get(e);if(p)return p;o.set(e,a),Uj(e)?e.forEach((function(n){a.add(Gj(n,t,r,n,e,o))})):Nj(e)&&e.forEach((function(n,i){a.set(i,Gj(n,t,r,i,e,o))}));var v=d?void 0:(u?c?lj:dj:c?VB:NB)(e);return function(e,t){for(var r=-1,n=null==e?0:e.length;++r<n&&!1!==t(e[r],r,e););}(v||e,(function(n,i){v&&(n=e[i=n]),iB(a,i,Gj(n,t,r,i,e,o))})),a}jj[Vj]=jj["[object Array]"]=jj["[object ArrayBuffer]"]=jj["[object DataView]"]=jj["[object Boolean]"]=jj["[object Date]"]=jj["[object Float32Array]"]=jj["[object Float64Array]"]=jj["[object Int8Array]"]=jj["[object Int16Array]"]=jj["[object Int32Array]"]=jj["[object Map]"]=jj["[object Number]"]=jj[Bj]=jj["[object RegExp]"]=jj["[object Set]"]=jj["[object String]"]=jj["[object Symbol]"]=jj["[object Uint8Array]"]=jj["[object Uint8ClampedArray]"]=jj["[object Uint16Array]"]=jj["[object Uint32Array]"]=!0,jj["[object Error]"]=jj[Fj]=jj["[object WeakMap]"]=!1;function Hj(e){return Gj(e,5)}function zj(e,t){return function(e,t){for(var r=-1,n=null==e?0:e.length,i=Array(n);++r<n;)i[r]=t(e[r],r,e);return i}(t,(function(t){return e[t]}))}function Kj(e){return null==e?[]:zj(e,NB(e))}var Xj,qj=new cO("ChromeHandler",3),Yj=uL(),Wj=function(e){OI(l,e);var t,r,n,i,o,a,s,c,u,d=YI(l);function l(e){var t;return Ll(this,l),Qd($T(t=d.call(this,e)),"name","chrome"),Qd($T(t),"_queueBusy",!1),Qd($T(t),"_sdpQueue",void 0),Qd($T(t),"_aSendonlyOfferTpl",void 0),Qd($T(t),"_vSendonlyOfferTpl",void 0),Qd($T(t),"_aRecvonlyOfferTpl",void 0),Qd($T(t),"_vRecvonlyOfferTpl",void 0),Qd($T(t),"_mid",10),Qd($T(t),"_offerSession",void 0),Qd($T(t),"_answerSession",void 0),Qd($T(t),"_offerMlines",[]),Qd($T(t),"_answerMlines",[]),Qd($T(t),"_inactiveMlineIndex",[]),Qd($T(t),"_mlinesCache",{}),t._sdpQueue=new dF,t._sdpQueue.on("start",(function(){t._queueBusy||"stable"!==t._peerConnection.signalingState||(qj.print("dequeue start"),t.dequeue())})),t}return Nl(l,[{key:"connect",value:(u=Tm(Em().mark((function e(t){var r,n,i,o,a,s,c,u,d,l,h,p,v,f,_=this;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return qj.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,WL(this.id,t);case 4:return this._answerIce=e.sent,this._connectionId=this._answerIce.iceUfrag,e.next=8,this._peerConnection.createOffer();case 8:return i=e.sent,o=gL.parse(i.sdp),this.peerConnectionId=this._answerIce.iceUfrag||"",!this._offerIce.iceUfrag&&!this._offerIce.icePwd&&((u="renomination"===(null===(a=o.media[0])||void 0===a?void 0:a.iceOptions))||(delete this._offerIce.iceOptions,delete this._answerIce.iceOptions),delete this._offerIce.iceUfrag,delete this._offerIce.icePwd,d=eU({serverUfrag:t.iceParams.serverIceUfrag,serverPwd:t.iceParams.serverIcePwd,clientPwd:null===(s=o.media[0])||void 0===s?void 0:s.icePwd,options:(c={},Qd(c,$L.kICEConfigTypeSrtpDtlsType,!0),Qd(c,$L.kICEConfigTypeRenominationType,u),c)}),l=ZT(d,2),h=l[0],p=l[1],this.peerConnectionId=p,this._answerIce.iceUfrag=h,qj.print("use serverUfrag v2",Mm({dtls:!0,renomination:u}))),v=ZT(o.media,1),f=v[0],this._offerIce.fingerprint=o.fingerprint||f.fingerprint,delete o.media,this._offerSession=Zd({},o),this._answerSession=Zd({},o),this._answerSession.fingerprint&&(this._answerSession.fingerprint=this._answerIce.fingerprint),this._offerMlines=[Zd(Zd(Zd({},f),this._offerIce),{},{mid:"".concat(0)})],this._answerMlines=[Zd(Zd(Zd({},f),this._answerIce),{},{sctpmap:{sctpmapNumber:5e3,app:"webrtc-datachannel",maxMessageSize:262144},mid:"".concat(0)})],this.setDescription(),e.next=25,new q_((function(e,t){_._dataChannel.onopen=function(){qj.print("connect","dataChannel open"),_._reportRtcInvokeStatus("es.dc.open",""),e("")},_._dataChannel.onerror=function(e){_._report("rtc_signaling_msg_error",{error_code:e.error.sdpLineNumber,message:e.error.errorDetail,reason:"invalid data"}),_._reportRtcInvokeStatus("es.dc.error",""),t(e)},_._dataChannel.onclose=function(e){_._reportRtcInvokeStatus("es.dc.close",""),t(e)},_._peerConnection.addEventListener("connectionstatechange",(function(e){"failed"!==_._peerConnection.iceConnectionState&&"closed"!==_._peerConnection.iceConnectionState&&"failed"!==_._peerConnection.connectionState||t(e)}))}));case 25:return qj.print("connect","dataChannel establish success"),e.abrupt("return",this._dataChannel);case 27:case"end":return e.stop()}}),e,this)}))),function(e){return u.apply(this,arguments)})},{key:"disconnect",value:function(){var e;this._peerConnection.close(),null===(e=this._dataChannel)||void 0===e||e.close(),this._peerConnection.ontrack=null}},{key:"destroy",value:function(){wI(RI(l.prototype),"destroy",this).call(this),this._mlinesCache={}}},{key:"publish",value:(c=Tm(Em().mark((function e(t){var r,n,i,o,a,s,c,u,d,h,p,v,f,_,m,g,y,S,b,E,k,T,I,A,R,C,w,x,O,P,M,D,N,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(RI(l.prototype),"internalPublish",this).call(this,t),p=h.videoDescriptions,v=h.subVideoDescriptions,f=h.audioTransceiverInit,_=h.videoTransceiverInit,m=zL(this._nextSsrc),this._nextSsrc=m.next,g="".concat(this._mid++),y="".concat(this._mid++),S=Zd(Zd(Zd({},this._aSendonlyOfferTpl),this._offerIce),{},{mid:g,msid:wm(r="".concat(u.id," ")).call(r,u.id,"-audio"),ssrcs:KL(u.id,"audio",m.audio,jL)}),b=Zd(Zd(Zd({},this._vSendonlyOfferTpl),this._offerIce),{},{mid:y,msid:wm(n="".concat(u.id," ")).call(n,u.id,"-video")}),d?(qj.print("subVideoDesc","desc: %o ",v),delete b.ssrcGroups,delete b.ssrcs,E=[],b.rids=Fm(p).call(p,(function(e){var t=e.rid;return E.unshift(t),{id:t,direction:"send"}})),b.simulcast={dir1:"send",list1:E.join(";")}):(k=XL(u.id,m,{cname:jL}),T=k.ssrcs,I=k.ssrcGroups,b.ssrcs=T,b.ssrcGroups=I),null!==(i=this._context)&&void 0!==i&&null!==(o=i.serverConfig)&&void 0!==o&&o.audioRed&&Array.isArray(S.rtp)&&(-1!==(R=YA(A=S.rtp).call(A,(function(e){return"red"===e.codec})))&&(w=ek(C=S.rtp).call(C,R,1),x=ZT(w,1),O=x[0],S.rtp.unshift(O)),P=[],S.rtp.forEach((function(e){return P.push(e.payload)})),S.payloads=P.join(" ")),null!==(a=this._context)&&void 0!==a&&null!==(s=a.serverConfig)&&void 0!==s&&s.videoCodec&&tU(b,null===(M=this._context)||void 0===M||null===(D=M.serverConfig)||void 0===D?void 0:D.videoCodec),(xP||UP)&&Array.isArray(b.ext)&&(b.ext=Gs(N=b.ext).call(N,(function(e){var t;return!(null!=e&&null!==(t=e.uri)&&void 0!==t&&fk(t).call(t,"video-orientation"))}))),(L=null==S?void 0:mE(c=S.rtp).call(c,(function(e){return"opus"===e.codec})))&&S.fmtp&&(F=mE(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||xP||this.addBitrateLimit(b,t.videoEncodeConfig[0].maxKbps),this._mlinesCache[t.stream.id]=[S,b],e.abrupt("return",{partialSdp:YL(this._offerSession,S,b),audioMid:g,videoMid:y,type:"incroffer",semantics:"unified-plan",videoDescriptions:p,subVideoDescriptions:v,audioTransceiverInit:f,videoTransceiverInit:_,peerConnectionMode:this.peerConnectionMode});case 17:case"end":return e.stop()}}),e,this)}))),function(e){return c.apply(this,arguments)})},{key:"subscribe",value:(s=Tm(Em().mark((function e(t,r){var n,i,o,a,s,c,u,d,l,h,p,v,f,_,m,g,y,S,b,E,k,T,I,A,R,C,w,x,O,P,M,D,N,L,U,V=this;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(qj.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,p=void 0,v=void 0,this._mlinesCache[t.streamId]=[p,v],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&&(p=Zd(Zd({},Hj(this._aRecvonlyOfferTpl)),{},{mid:u})),l&&(this._mlinesCache[t.streamId][0]=p,f={track:"audio",init:{direction:"recvonly"}}),d&&(v=Zd(Zd({},Hj(this._vRecvonlyOfferTpl)),{},{mid:d})),h&&(this._mlinesCache[t.streamId][1]=v,_={track:"video",init:{direction:"recvonly"}}),m=YL(this._offerSession,p,v),g=void 0,t.enableVendorMode||r.multiChatMode||t.virtual||!this._aSendonlyAnswerTpl||!this._vSendonlyAnswerTpl){e.next=32;break}return g=zL(this._nextSsrc),this._nextSsrc=g.next,A=Zd(Zd(Zd({},this._aSendonlyAnswerTpl),this._answerIce),{},{mid:u,msid:wm(y=wm(S="".concat(t.streamId)).call(S,null!==(b=this._context)&&void 0!==b&&b.avSync?"":"-audio"," ")).call(y,t.streamId,"-audio"),ssrcs:KL(t.streamId,"audio",g.audio)}),R=Zd(Zd(Zd({},this._vSendonlyAnswerTpl),this._answerIce),{},{mid:d,msid:wm(E=wm(k="".concat(t.streamId)).call(k,null!==(T=this._context)&&void 0!==T&&T.avSync?"":"-video"," ")).call(E,t.streamId,"-video")},XL(t.streamId,g,{flexfec:this._enableSubFlexfec})),C=new q_((function(e){V._sdpQueue.enqueue({action:sF.subscribe,streamId:t.streamId,audioMid:u,videoMid:d,audioTransceiverInit:f,videoTransceiverInit:_,signalingAck:{sdp:gL.write(Zd(Zd({},V._answerSession),{},{media:[A,R]})),sequenceId:t.sequenceId?++t.sequenceId:0},stream:t,sdp:m,onSuccess:function(){qj.print("subscribe()","sub success"),e(0)}})})),e.next=31,C;case 31:null===(I=g)||void 0===I||delete I.next;case 32:return(w=null===(n=p)||void 0===n?void 0:mE(i=n.rtp).call(i,(function(e){return"opus"===e.codec})))&&null!==(o=p)&&void 0!==o&&o.fmtp&&(P=null===(x=p)||void 0===x?void 0:mE(O=x.fmtp).call(O,(function(e){return e.payload===w.payload})))&&this._context&&(P.config+=";stereo=1;sprop-stereo=1"),t.isPublic&&YP>=86&&null!=(L=null===(M=v)||void 0===M?void 0:Gs(D=M.rtp).call(D,(function(e){return"H264"===e.codec})))&&L.length&&null!==(N=v)&&void 0!==N&&N.fmtp&&(null===(U=v)||void 0===U||U.fmtp.forEach((function(e){mE(L).call(L,(function(t){return t.payload===e.payload}))&&(e.config+=";sps-pps-idr-in-keyframe=1")}))),e.abrupt("return",{partialSdp:m,audioMid:u,videoMid:d,type:a,semantics:s,audioTransceiverInit:f,videoTransceiverInit:_,allSsrc:g,peerConnectionMode:this.peerConnectionMode});case 36:case"end":return e.stop()}}),e,this)}))),function(e,t){return s.apply(this,arguments)})},{key:"handleAck",value:(a=Tm(Em().mark((function e(t){return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(qj.print("handleAck()","item: %o",t),!t.generatorSsrc){e.next=4;break}return qj.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=Tm(Em().mark((function e(){var t,r,n,i,o,a,s,c,u,d,l,h,p,v,f,_=this;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._queueBusy=!0,t=this._sdpQueue.dequeue(),qj.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!==aF.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=Zd({},_._answerIce)).candidates,s=!1,c=!1,e.prev=4,d=mD(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 iF;if(n.onSuccess&&a.push(n.onSuccess),h&&(null==d?void 0:d.sequenceId)<l.sequenceId)return"break";var p,v={},f={},m=gL.parse(d.sdp);Array.isArray(m.media)&&FA(p=m.media).call(p,(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=Zd(Zd({},n),t)).type?(v=n).mid=e:(f=n).mid=r}));var g,y=l.streamId;if(s===sF.publish&&(y=null===(g=l.stream)||void 0===g?void 0:g.id),!_._mlinesCache[y])return"break";var S=ZT(_._mlinesCache[y],2),b=S[0],E=S[1];if(c&&b){l.audioTransceiver=_._peerConnection.addTransceiver(c.track,c.init),_._reportRtcInvokeStatus("chromeHandler.addTrack",Mm({audioStreamTrack:mP(c.track)}));var k=_._inactiveMlineIndex.shift();k||(k=_._offerMlines.length),_._offerMlines[k]=Zd({},b),_._answerMlines[k]=v,Yj&&l.initAudioEncodedTransform()}if(u&&E){var T,I;l.videoTransceiver=_._peerConnection.addTransceiver(u.track,u.init),_._reportRtcInvokeStatus("chromeHandler.addTrack",Mm({videoStreamTrack:mP(u.track)}));var A,R,C=_._inactiveMlineIndex.shift();C||(C=_._offerMlines.length),_._offerMlines[C]=Zd({},E),s===sF.publish&&null!==(T=_._context)&&void 0!==T&&null!==(I=T.serverConfig)&&void 0!==I&&I.videoCodec&&tU(f,null===(A=_._context)||void 0===A||null===(R=A.serverConfig)||void 0===R?void 0:R.videoCodec),_._answerMlines[C]=f,Yj&&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:f={},r.forEach((function(e){var t=e.audioMid,r=e.videoMid,n=e.action;f[t]=t,n!==sF.removetrack&&(f[r]=r),f[t]=t})),this._offerMlines=Fm(h=this._offerMlines).call(h,(function(e,t){return f[e.mid]&&(e=qL(e),_._inactiveMlineIndex.push(t)),e})),FA(p=this._inactiveMlineIndex).call(p,(function(e,t){return e-t})),this._answerMlines=Fm(v=this._answerMlines).call(v,(function(e){return f[e.mid]&&(e=qL(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(sq){}qj.print("dequeue","loop"),e.next=29;break;case 26:e.prev=26,e.t1=e.catch(6),qj.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=Tm(Em().mark((function e(t){var r,n;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return qj.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=QO(),t&&this._report("rtc_begin_create_offer",{direction:"local"===t.streamUserId?"up":"down",stream_id:t.streamId,stream_user_id:t.streamUserId,pc_session_id:this.peerConnectionId,vendor_mode:0}),e.next=10,this._peerConnection.createOffer();case 10:return t&&this._report("rtc_create_offer",{error_code:0,direction:"local"===t.streamUserId?"up":"down",stream_id:t.streamId,stream_user_id:t.streamUserId,elapse:QO()-n}),e.next=13,this.setLocalDescription(gL.write(this._offerSession),t);case 13:return e.next=15,this.setRemoteDescription(gL.write(this._answerSession),t);case 15:case"end":return e.stop()}}),e,this)}))),function(e){return i.apply(this,arguments)})},{key:"getDefaultSdp",value:(n=Tm(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=gL.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:gL.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=Tm(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;gL.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=Tm(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,dP(!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 hR(dR.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}(iU),Qj=new cO("FirefoxHandler",3),Jj=function(e){OI(l,e);var t,r,n,i,o,a,s,c,u,d=YI(l);function l(){var e,t;Ll(this,l);for(var r=arguments.length,n=new Array(r),i=0;i<r;i++)n[i]=arguments[i];return Qd($T(t=d.call.apply(d,wm(e=[this]).call(e,n))),"name","firefox"),Qd($T(t),"_aRecvonlyOfferTpl",void 0),t}return Nl(l,[{key:"connect",value:(u=Tm(Em().mark((function e(t){var r,n,i,o,a,s,c,u,d,l,h,p,v,f,_,m,g,y,S=this;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return Qj.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,WL(this.id,t);case 4:return this._answerIce=e.sent,this._connectionId=this._answerIce.iceUfrag,this._peerConnection.addTransceiver("audio",{direction:"recvonly"}),this._peerConnection.addTransceiver("video",{direction:"recvonly"}),e.next=10,this._peerConnection.createOffer();case 10:return s=e.sent,c=gL.parse(s.sdp),this.peerConnectionId=this._answerIce.iceUfrag||"",!this._offerIce.iceUfrag&&!this._offerIce.icePwd&&((h="renomination"===(null===(u=c.media[0])||void 0===u?void 0:u.iceOptions))||(delete this._offerIce.iceOptions,delete this._answerIce.iceOptions),delete this._offerIce.iceUfrag,delete this._offerIce.icePwd,p=eU({serverUfrag:t.iceParams.serverIceUfrag,serverPwd:t.iceParams.serverIcePwd,clientPwd:null===(d=c.media[0])||void 0===d?void 0:d.icePwd,options:(l={},Qd(l,$L.kICEConfigTypeSrtpDtlsType,!0),Qd(l,$L.kICEConfigTypeRenominationType,h),l)}),v=ZT(p,2),f=v[0],_=v[1],this.peerConnectionId=_,this._answerIce.iceUfrag=f,Qj.print("use serverUfrag v2",Mm({dtls:!0,renomination:h}))),m=ZT(c.media,1),g=m[0],this._offerIce.fingerprint=c.fingerprint||g.fingerprint,c.media=Fm(i=c.media).call(i,(function(e){return Zd(Zd({},e),S._offerIce)})),Fm(o=c.media).call(o,(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===CE(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})))})),(y=Zd({},c)).fingerprint=this._answerIce.fingerprint,y.media=Fm(a=y.media).call(a,(function(e){return delete(e=Zd(Zd({},e),S._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=24,this.setLocalDescription(gL.write(c));case 24:return e.next=26,this.setRemoteDescription(gL.write(y));case 26:return e.next=28,new q_((function(e,t){S._dataChannel.onopen=function(){Qj.print("connect","dataChannel open"),S._reportRtcInvokeStatus("es.dc.open",""),e("")},S._dataChannel.onerror=function(e){S._report("rtc_signaling_msg_error",{error_code:e.error.sdpLineNumber,message:e.error.errorDetail,reason:"invalid data"}),S._reportRtcInvokeStatus("es.dc.error",""),t(e)},S._dataChannel.onclose=function(e){S._reportRtcInvokeStatus("es.dc.close",""),t(e)},S._peerConnection.addEventListener("connectionstatechange",(function(e){"failed"!==S._peerConnection.iceConnectionState&&"closed"!==S._peerConnection.iceConnectionState&&"failed"!==S._peerConnection.connectionState||t(e)}))}));case 28:return Qj.print("connect","dataChannel establish success"),e.abrupt("return",this._dataChannel);case 30:case"end":return e.stop()}}),e,this)}))),function(e){return u.apply(this,arguments)})},{key:"publish",value:(c=Tm(Em().mark((function e(t){var r,n,i,o,a,s,c,u,d,h,p,v,f,_,m=this;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=wI(RI(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=QO(),this._report("rtc_begin_create_offer",{direction:"up",stream_id:"",stream_user_id:"",pc_session_id:this.peerConnectionId,vendor_mode:0}),e.next=7,this._peerConnection.createOffer();case 7:return d=e.sent,this._report("rtc_create_offer",{direction:"up",error_code:0,stream_id:"",stream_user_id:"",elapse:QO()-u}),(h=gL.parse(d.sdp)).media=null===(r=h.media)||void 0===r?void 0:Fm(r).call(r,(function(e){return Zd(Zd({},e),m._offerIce)})),e.next=13,this.setLocalDescription(gL.write(h));case 13:return p=t.audioTransceiver.mid,v=t.videoTransceiver.mid,f=null,_=null,h.media=null===(n=h.media)||void 0===n?void 0:Fm(n).call(n,(function(e){if("".concat(e.mid)===p){var t,r,n=null===(t=f=e)||void 0===t?void 0:mE(r=t.rtp).call(r,(function(e){return"opus"===e.codec}));if(n&&f.fmtp){var i,o,a=mE(i=f.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)===v){var s,c,u,d;null!==(s=m._context)&&void 0!==s&&null!==(c=s.serverConfig)&&void 0!==c&&c.videoCodec&&tU(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(gL.write(h));case 21:return e.abrupt("return",{partialSdp:YL(h,f,_,!1),audioMid:p,videoMid:v,type:"incroffer",semantics:"unified-plan",videoDescriptions:o,subVideoDescriptions:a,audioTransceiverInit:s,videoTransceiverInit:c,peerConnectionMode:this.peerConnectionMode});case 22:case"end":return e.stop()}}),e,this)}))),function(e){return c.apply(this,arguments)})},{key:"subscribe",value:(s=Tm(Em().mark((function e(t,r){var n,i,o,a,s,c,u,d,l,h,p,v,f,_,m,g,y,S,b,E,k,T,I,A,R=this;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return Qj.print("subscribe()"),c="",u="",d=!1,l=!1,h=void 0,p=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"})),v=QO(),this._report("rtc_begin_create_offer",{direction:"up",stream_id:t.streamId,stream_user_id:t.userId,pc_session_id:this.peerConnectionId,vendor_mode:0}),e.next=14,this._peerConnection.createOffer();case 14:return f=e.sent,this._report("rtc_create_offer",{error_code:0,direction:"up",stream_id:t.streamId,stream_user_id:t.userId,elapse:QO()-v}),(_=gL.parse(f.sdp)).media=null===(n=_.media)||void 0===n?void 0:Fm(n).call(n,(function(e){return Zd(Zd({},e),R._offerIce)})),Fm(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===CE(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(gL.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&&(p=e)})),c&&h||(c="audio_".concat(u),h=Zd(Zd({},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=zL(this._nextSsrc),this._nextSsrc=m.next,I=Zd(Zd(Zd({},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:KL(t.streamId,"audio",m.audio)}),A=Zd(Zd(Zd({},this._vSendonlyAnswerTpl),this._answerIce),{},{mid:u,msid:wm(b=wm(E="".concat(t.streamId)).call(E,null!==(k=this._context)&&void 0!==k&&k.avSync?"":"-video"," ")).call(b,t.streamId,"-video")},XL(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:YL(_,h,p,!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,peerConnectionMode:this.peerConnectionMode});case 37:case"end":return e.stop()}}),e,this)}))),function(e,t){return s.apply(this,arguments)})},{key:"handleAck",value:(a=Tm(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)!==sF.unpublish&&i!==sF.unsubscribe&&i!==sF.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 Qj.print("already set remote"),e.abrupt("return","");case 8:return o=gL.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=Tm(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=gL.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=Zd(Zd({},e),l._answerIce)).type&&(r.audioMid?(e.mid=r.audioMid,s[r.audioMid]=e):s[e.mid]=e),"video"===e.type){if(r instanceof nF&&zP<=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=gL.parse(null===(i=this._peerConnection.localDescription)||void 0===i?void 0:i.sdp),d=Fm(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,Fm(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===CE(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(gL.write(c));case 11:case"end":return e.stop()}}),e,this)}))),function(e,t){return o.apply(this,arguments)})},{key:"getDefaultSdp",value:(i=Tm(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=gL.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:gL.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=Tm(Em().mark((function e(t,r,n){return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return Qj.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=Tm(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 Qj.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=gL.parse(null==c?void 0:c.sdp)).media=Fm(n=u.media).call(n,(function(e){return a[e.mid]&&(e=qL(e)),"inactive"!==e.direction&&s.push(e.mid),Zd(Zd({},e),h._offerIce)})),d=gL.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=Fm(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(gL.write(u));case 17:return e.next=19,this.setRemoteDescription(gL.write(d));case 19:case"end":return e.stop()}}),e,this)}))),function(e,t){return r.apply(this,arguments)})},{key:"setCurrentDescription",value:(t=Tm(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;gL.parse(e).media.forEach((function(e){"audio"===e.type&&(t._aRecvonlyOfferTpl=e)}))}}]),l}(iU),Zj=new cO("FallbackHandler",3),$j=function(e){OI(l,e);var t,r,n,i,o,a,s,c,u,d=YI(l);function l(e){var t;return Ll(this,l),Qd($T(t=d.call(this,e)),"name","fallback"),Qd($T(t),"_aRecvonlyOfferTpl",void 0),Zj.print("ctor","using fallback handler"),t._report("rtc_error",{message:"using fallback handler",error_code:-1}),t}return Nl(l,[{key:"connect",value:(u=Tm(Em().mark((function e(t){var r,n,i,o,a,s,c,u,d,l,h,p,v,f,_,m,g,y,S=this;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return Zj.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,WL(this.id,t);case 4:return this._answerIce=e.sent,this._connectionId=this._answerIce.iceUfrag,this._peerConnection.addTransceiver("audio",{direction:"recvonly"}),this._peerConnection.addTransceiver("video",{direction:"recvonly"}),e.next=10,this._peerConnection.createOffer();case 10:return s=e.sent,c=gL.parse(s.sdp),this.peerConnectionId=this._answerIce.iceUfrag||"",!this._offerIce.iceUfrag&&!this._offerIce.icePwd&&((h="renomination"===(null===(u=c.media[0])||void 0===u?void 0:u.iceOptions))||(delete this._offerIce.iceOptions,delete this._answerIce.iceOptions),delete this._offerIce.iceUfrag,delete this._offerIce.icePwd,p=eU({serverUfrag:t.iceParams.serverIceUfrag,serverPwd:t.iceParams.serverIcePwd,clientPwd:null===(d=c.media[0])||void 0===d?void 0:d.icePwd,options:(l={},Qd(l,$L.kICEConfigTypeSrtpDtlsType,!0),Qd(l,$L.kICEConfigTypeRenominationType,h),l)}),v=ZT(p,2),f=v[0],_=v[1],this.peerConnectionId=_,this._answerIce.iceUfrag=f,Zj.print("use serverUfrag v2",Mm({dtls:!0,renomination:h}))),m=ZT(c.media,1),g=m[0],this._offerIce.fingerprint=c.fingerprint||g.fingerprint,c.media=Fm(i=c.media).call(i,(function(e){return Zd(Zd({},e),S._offerIce)})),Fm(o=c.media).call(o,(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===CE(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})))})),(y=Zd({},c)).fingerprint=this._answerIce.fingerprint,y.media=Fm(a=y.media).call(a,(function(e){return delete(e=Zd(Zd({},e),S._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=24,this.setLocalDescription(s.sdp);case 24:return e.next=26,this.setRemoteDescription(gL.write(y));case 26:return e.next=28,new q_((function(e,t){S._dataChannel.onopen=function(){Zj.print("connect","dataChannel open"),S._reportRtcInvokeStatus("es.dc.open",""),e("")},S._dataChannel.onerror=function(e){S._report("rtc_signaling_msg_error",{error_code:e.error.sdpLineNumber,message:e.error.errorDetail,reason:"invalid data"}),S._reportRtcInvokeStatus("es.dc.error",""),t(e)},S._dataChannel.onclose=function(e){S._reportRtcInvokeStatus("es.dc.close",""),t(e)},S._peerConnection.addEventListener("connectionstatechange",(function(e){"failed"!==S._peerConnection.iceConnectionState&&"closed"!==S._peerConnection.iceConnectionState&&"failed"!==S._peerConnection.connectionState||t(e)}))}));case 28:return Zj.print("connect","dataChannel establish success"),e.abrupt("return",this._dataChannel);case 30:case"end":return e.stop()}}),e,this)}))),function(e){return u.apply(this,arguments)})},{key:"publish",value:(c=Tm(Em().mark((function e(t){var r,n,i,o,a,s,c,u,d,h,p,v,f;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=wI(RI(l.prototype),"internalPublish",this).call(this,t),i=n.videoDescriptions,o=n.subVideoDescriptions,a=n.audioTransceiverInit,s=n.videoTransceiverInit,t.audioTransceiver=this._peerConnection.addTransceiver(a.track,a.init),t.videoTransceiver=this._peerConnection.addTransceiver(s.track,s.init),c=QO(),this._report("rtc_begin_create_offer",{direction:"up",stream_id:"",stream_user_id:"",pc_session_id:this.peerConnectionId,vendor_mode:0}),e.next=7,this._peerConnection.createOffer();case 7:return u=e.sent,this._report("rtc_create_offer",{direction:"up",error_code:0,stream_id:"",stream_user_id:"",elapse:QO()-c}),d=gL.parse(u.sdp),e.next=12,this.setLocalDescription(u.sdp);case 12:return h=t.audioTransceiver.mid,p=t.videoTransceiver.mid,v=null,f=null,d.media=null===(r=d.media)||void 0===r?void 0:Fm(r).call(r,(function(e){return"".concat(e.mid)===h?v=e:"".concat(e.mid)===p&&(f=e),e})),uL()&&(t.initVideoEncodedTransform(),t.initAudioEncodedTransform()),e.abrupt("return",{partialSdp:YL(d,v,f,!1),audioMid:h,videoMid:p,type:"incroffer",semantics:"unified-plan",videoDescriptions:i,subVideoDescriptions:o,audioTransceiverInit:a,videoTransceiverInit:s,peerConnectionMode:this.peerConnectionMode});case 19:case"end":return e.stop()}}),e,this)}))),function(e){return c.apply(this,arguments)})},{key:"subscribe",value:(s=Tm(Em().mark((function e(t,r){var n,i,o,a,s,c,u,d,l,h,p,v,f,_,m,g,y,S,b,E,k,T;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return Zj.print("subscribe()"),a="",s="",c=!1,u=!1,d=void 0,l=void 0,t.virtual?c=!0:(r.multiChatMode||(c=!0),u=!0),c&&(t.audioTransceiver=this._peerConnection.addTransceiver("audio",{direction:"recvonly"})),u&&(t.videoTransceiver=this._peerConnection.addTransceiver("video",{direction:"recvonly"})),h=QO(),this._report("rtc_begin_create_offer",{direction:"up",stream_id:t.streamId,stream_user_id:t.userId,pc_session_id:this.peerConnectionId,vendor_mode:0}),e.next=14,this._peerConnection.createOffer();case 14:return p=e.sent,this._report("rtc_create_offer",{error_code:0,direction:"up",stream_id:t.streamId,stream_user_id:t.userId,elapse:QO()-h}),v=gL.parse(p.sdp),e.next=19,this.setLocalDescription(p.sdp,{streamId:t.streamId||"",streamUserId:t.userId});case 19:if(a=null===(n=t.audioTransceiver)||void 0===n?void 0:n.mid,s=null===(i=t.videoTransceiver)||void 0===i?void 0:i.mid,null===(o=v.media)||void 0===o||o.forEach((function(e){"".concat(e.mid)===a?d=e:"".concat(e.mid)===s&&(l=e)})),a&&d||(a="audio_".concat(s),d=Zd(Zd({},this._aRecvonlyOfferTpl),{},{mid:a})),t.audioMid=a,t.videoMid=s,f=void 0,r.multiChatMode||t.virtual||!this._aSendonlyAnswerTpl||!this._aSendonlyAnswerTpl){e.next=34;break}return f=zL(this._nextSsrc),this._nextSsrc=f.next,k=Zd(Zd(Zd({},this._aSendonlyAnswerTpl),this._answerIce),{},{mid:a,msid:wm(_=wm(m="".concat(t.streamId)).call(m,null!==(g=this._context)&&void 0!==g&&g.avSync?"":"-audio"," ")).call(_,t.streamId,"-audio"),ssrcs:KL(t.streamId,"audio",f.audio)}),T=Zd(Zd(Zd({},this._vSendonlyAnswerTpl),this._answerIce),{},{mid:s,msid:wm(y=wm(S="".concat(t.streamId)).call(S,null!==(b=this._context)&&void 0!==b&&b.avSync?"":"-video"," ")).call(y,t.streamId,"-video")},XL(t.streamId,f,{flexfec:this._enableSubFlexfec})),e.next=33,this._internalSetRemoteDescription([k,T],t);case 33:null===(E=f)||void 0===E||delete E.next;case 34:return uL()&&(t.initVideoEncodedTransform(),t.initAudioEncodedTransform()),e.abrupt("return",{partialSdp:YL(v,d,l,!1),audioMid:a,videoMid:s,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:f,peerConnectionMode:this.peerConnectionMode});case 36:case"end":return e.stop()}}),e,this)}))),function(e,t){return s.apply(this,arguments)})},{key:"handleAck",value:(a=Tm(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)!==sF.unpublish&&i!==sF.unsubscribe&&i!==sF.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 Zj.print("already set remote"),e.abrupt("return","");case 8:return o=gL.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=Tm(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=gL.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){"audio"===(e=Zd(Zd({},e),l._answerIce)).type&&(r.audioMid?(e.mid=r.audioMid,s[r.audioMid]=e):s[e.mid]=e),"video"===e.type&&(r.videoMid?(e.mid=r.videoMid,s[r.videoMid]=e):s[e.mid]=e)})),u=gL.parse(null===(i=this._peerConnection.localDescription)||void 0===i?void 0:i.sdp),d=Fm(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,Fm(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===CE(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(gL.write(c));case 11:case"end":return e.stop()}}),e,this)}))),function(e,t){return o.apply(this,arguments)})},{key:"getDefaultSdp",value:(i=Tm(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=gL.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("".concat(e.mid)),!0)})),i.groups=[{mids:o.join(" "),type:"BUNDLE"}],e.abrupt("return",{sdp:gL.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=Tm(Em().mark((function e(t,r,n){return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return Zj.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=Tm(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 Zj.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=gL.parse(null==c?void 0:c.sdp)).media=Fm(n=u.media).call(n,(function(e){return a[e.mid]&&(e=qL(e)),"inactive"!==e.direction&&s.push(e.mid),Zd(Zd({},e),h._offerIce)})),d=gL.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=Fm(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(null==c?void 0:c.sdp);case 17:return e.next=19,this.setRemoteDescription(gL.write(d));case 19:case"end":return e.stop()}}),e,this)}))),function(e,t){return r.apply(this,arguments)})},{key:"setCurrentDescription",value:(t=Tm(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;gL.parse(e).media.forEach((function(e){"audio"===e.type&&(t._aRecvonlyOfferTpl=e)}))}}]),l}(iU),eG=function(e){return e.enableFallbackHandler?new $j(e):wP?new Jj(e):new Wj(e)},tG=new cO("Locker",2),rG=1,nG=function(){function e(t){var r;Ll(this,e),Qd(this,"lockingPromise",q_.resolve()),Qd(this,"locks",0),Qd(this,"name",""),Qd(this,"lockId",void 0),this.lockId=rG++,t&&(this.name=t),tG.print(wm(r="[lock-".concat(this.name,"-")).call(r,this.lockId,"] is created."))}return Nl(e,[{key:"isLocked",get:function(){return this.locks>0}},{key:"lock",value:function(){var e,t,r,n=this;this.locks+=1,tG.print(wm(e=wm(t="[lock-".concat(this.name,"-")).call(t,this.lockId,"] locked, current queue ")).call(e,this.locks,"."));var i=new q_((function(e){r=function(){var t,r;n.locks-=1,tG.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}(),iG=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}(iG||{}),oG=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}(oG||{}),aG=function(e){return e[e.PUB=0]="PUB",e[e.UNPUB=1]="UNPUB",e}(aG||{}),sG=function(e){return e[e.SUB=0]="SUB",e[e.UNSUB=1]="UNSUB",e}(sG||{}),cG=(Qd(Xj={},bl.communication,[0]),Qd(Xj,bl.chat,[0]),Qd(Xj,bl.chatRoom,[1,"IES_chatroom"]),Qd(Xj,bl.coHost,[1,"IES_PK"]),Qd(Xj,bl.meeting,[16]),Qd(Xj,bl.classRoom,[0]),Xj),uG=uL(),dG=function(e){OI(s,e);var t,r,n,i,o,a=YI(s);function s(e){var t;return Ll(this,s),Qd($T(t=a.call(this,e,!1)),"peerConnectionId",WO()),Qd($T(t),"peerConnectionMode",1),Qd($T(t),"name","vendor"),Qd($T(t),"direction","up"),Qd($T(t),"stream",void 0),t.on("ice_state",(function(e){t._report("rtc_ice_state",{pc_session_id:t.peerConnectionId,direction:t.direction,error_code:0,ice_state:e.toUpperCase(),message:"",peer_connection_id:t.peerConnectionId,stream_id:"",stream_user_id:""})})),t}return Nl(s,[{key:"publish",value:(o=Tm(Em().mark((function e(t){var r,n,i,o,a,c,u,d,l,h,p=this;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t.enableSimulcast=!1,this.stream=t,r=wI(RI(s.prototype),"internalPublish",this).call(this,t),n=r.videoDescriptions,i=r.subVideoDescriptions,o=r.audioTransceiverInit,a=r.videoTransceiverInit,t.audioTransceiver=this._peerConnection.addTransceiver(o.track,o.init),t.videoTransceiver=this._peerConnection.addTransceiver(a.track,a.init),uG&&(t.initAudioEncodedTransform(),t.initVideoEncodedTransform()),this._report("rtc_begin_create_offer",{direction:"up",stream_id:"",stream_user_id:"",pc_session_id:this.peerConnectionId,vendor_mode:(null==t?void 0:t.vendorCode)||0}),e.next=9,this._peerConnection.createOffer();case 9:return c=e.sent,u=QO(),d=gL.parse(c.sdp),Array.isArray(d.media)&&(d.media=Fm(l=d.media).call(l,(function(e){var r,n,i,o,a;if("video"===e.type)null!==(r=p._context)&&void 0!==r&&null!==(n=r.serverConfig)&&void 0!==n&&n.videoCodec&&tU(e,null===(i=p._context)||void 0===i||null===(o=i.serverConfig)||void 0===o?void 0:o.videoCodec),(xP||UP)&&Array.isArray(e.ext)&&(e.ext=Gs(a=e.ext).call(a,(function(e){var t;return!(null!=e&&null!==(t=e.uri)&&void 0!==t&&fk(t).call(t,"video-orientation"))}))),xP||p.addBitrateLimit(e,t.videoEncodeConfig[0].maxKbps);else if("audio"===e.type){var s,c=null==e?void 0:mE(s=e.rtp).call(s,(function(e){return"opus"===e.codec}));if(c&&e.fmtp){var u,d,l=mE(u=e.fmtp).call(u,(function(e){return e.payload===c.payload}));l&&null!==(d=p._context)&&void 0!==d&&d.audioProfileManager&&(l.config=p._context.audioProfileManager.getOpusConfigStr(l.config))}}return e}))),h=new RTCSessionDescription({type:"offer",sdp:gL.write(d)}),e.prev=14,e.next=17,this._peerConnection.setLocalDescription(h);case 17:this._report("rtc_set_description",{error_code:0,message:h.sdp||"",is_local:"1",direction:"up",stream_id:"",stream_user_id:"",elapse:QO()-u},{type:"offer"}),e.next=24;break;case 20:throw e.prev=20,e.t0=e.catch(14),this._report("rtc_set_description",{error_code:-1,message:e.t0.message+h.sdp,is_local:"1",direction:"up",stream_id:"",stream_user_id:"",elapse:QO()-u},{type:"offer"}),e.t0;case 24:return e.abrupt("return",{partialSdp:h.sdp||"",audioMid:"0",videoMid:"1",type:"offer",semantics:"unified-plan",videoDescriptions:n,subVideoDescriptions:i,audioTransceiverInit:o,videoTransceiverInit:a,peerConnectionMode:this.peerConnectionMode,peerConnectionId:this.peerConnectionId});case 25:case"end":return e.stop()}}),e,this,[[14,20]])}))),function(e){return o.apply(this,arguments)})},{key:"subscribe",value:(i=Tm(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:return this.stream=t,this.direction="down",t.audioTransceiver=this._peerConnection.addTransceiver("audio",{direction:"recvonly"}),t.videoTransceiver=this._peerConnection.addTransceiver("video",{direction:"recvonly"}),uG&&(t.initAudioEncodedTransform(),t.initVideoEncodedTransform()),this._report("rtc_begin_create_offer",{direction:"down",stream_id:t.streamId,stream_user_id:t.userId,pc_session_id:this.peerConnectionId,vendor_mode:t.vendorCode||0}),e.next=8,this._peerConnection.createOffer();case 8:return r=e.sent,n=QO(),i=gL.parse(r.sdp),Array.isArray(i.media)&&(i.media=Fm(o=i.media).call(o,(function(e){if("audio"===e.type){var t,r=null==e?void 0:mE(t=e.rtp).call(t,(function(e){return"opus"===e.codec}));if(r&&null!=e&&e.fmtp){var n,i=null==e?void 0:mE(n=e.fmtp).call(n,(function(e){return e.payload===r.payload}));i&&s._context&&(i.config+=";stereo=1;sprop-stereo=1")}}return e}))),a=new RTCSessionDescription({type:"offer",sdp:gL.write(i)}),e.prev=13,e.next=16,this._peerConnection.setLocalDescription(a);case 16:this._report("rtc_set_description",{error_code:0,message:a.sdp||"",is_local:"1",direction:"down",stream_id:t.streamId,stream_user_id:t.userId,elapse:QO()-n},{type:"offer"}),e.next=23;break;case 19:throw e.prev=19,e.t0=e.catch(13),this._report("rtc_set_description",{error_code:-1,message:e.t0.message+a.sdp,is_local:"1",direction:"down",stream_id:t.streamId,stream_user_id:t.userId,elapse:QO()-n},{type:"offer"}),e.t0;case 23:return e.abrupt("return",{partialSdp:a.sdp||"",audioMid:"0",videoMid:"1",type:"offer",semantics:"unified-plan",peerConnectionMode:this.peerConnectionMode,peerConnectionId:this.peerConnectionId});case 24:case"end":return e.stop()}}),e,this,[[13,19]])}))),function(e){return i.apply(this,arguments)})},{key:"handleAck",value:(n=Tm(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:if(t.action!==sF.publish&&t.action!==sF.subscribe){e.next=16;break}return n=new RTCSessionDescription({sdp:null===(r=t.signalingAck)||void 0===r?void 0:r.sdp,type:"answer"}),i=QO(),e.prev=3,e.next=6,this._peerConnection.setRemoteDescription(n);case 6:this._report("rtc_set_description",{error_code:0,message:n.sdp||"",is_local:"1",direction:"down",stream_id:null===(o=t.stream)||void 0===o?void 0:o.userId,stream_user_id:(null===(a=t.stream)||void 0===a?void 0:a.streamId)||"",elapse:QO()-i},{type:"answer"}),e.next=13;break;case 9:throw e.prev=9,e.t0=e.catch(3),this._report("rtc_set_description",{error_code:-1,message:e.t0.message+n.sdp,is_local:"1",direction:"down",stream_id:null===(s=t.stream)||void 0===s?void 0:s.userId,stream_user_id:(null===(c=t.stream)||void 0===c?void 0:c.streamId)||"",elapse:QO()-i},{type:"offer"}),e.t0;case 13:"function"==typeof t.onSuccess&&t.onSuccess(),e.next=17;break;case 16:t.action!==sF.unpublish&&t.action!==sF.unsubscribe||this.destroy();case 17:return e.abrupt("return","");case 18:case"end":return e.stop()}}),e,this,[[3,9]])}))),function(e){return n.apply(this,arguments)})},{key:"getDefaultSdp",value:(r=Tm(Em().mark((function e(){return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",{sdp:"",type:"offer",semantics:""});case 1:case"end":return e.stop()}}),e)}))),function(){return r.apply(this,arguments)})},{key:"connect",value:function(){throw new Error("Method not implemented.")}},{key:"rollback",value:(t=Tm(Em().mark((function e(){return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:try{this._peerConnection.close()}catch(t){}case 1:case"end":return e.stop()}}),e,this)}))),function(){return t.apply(this,arguments)})}]),s}(iU),lG=ad,hG=tc,pG=function(e,t,r,n){for(var i,o=n>1?void 0:n?hG(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&&lG(t,r,o),o},vG=new cO("MediaServerClient",2),fG=6e4,_G=function(e){return e.DISCONNECTED="disconnected",e.DISCONNECTING="disconnecting",e.CONNECTED="connected",e.CONNECTING="connecting",e}(_G||{}),mG=function(e,t){vG.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)},gG=function(e){OI(k,e);var t,r,n,i,o,a,s,c,u,d,l,h,p,v,f,_,m,g,y,S,b,E=YI(k);function k(e){var t;return Ll(this,k),Qd($T(t=E.call(this)),"id",void 0),Qd($T(t),"_token",void 0),Qd($T(t),"_appId",void 0),Qd($T(t),"_roomId",void 0),Qd($T(t),"_roomAttributes",void 0),Qd($T(t),"_vendorConfig",{enableMultiVendor:!1,vendorCode:0}),Qd($T(t),"_clientId",void 0),Qd($T(t),"_businessId",void 0),Qd($T(t),"_userInfo",void 0),Qd($T(t),"_useCloudProxy",void 0),Qd($T(t),"_expectedIDC",void 0),Qd($T(t),"_authorization",void 0),Qd($T(t),"_sessionId",void 0),Qd($T(t),"_iceConfigRequestManager",void 0),Qd($T(t),"_ontrackCallbackMap",new JS),Qd($T(t),"_subResolves",{}),Qd($T(t),"supportConcurrent",!1),Qd($T(t),"_handler",void 0),Qd($T(t),"_pubSubLock",void 0),Qd($T(t),"_joinLeaveLock",void 0),Qd($T(t),"_state",void 0),Qd($T(t),"_dataChannelSignal",void 0),Qd($T(t),"_subConfig",{}),Qd($T(t),"_monitor",void 0),Qd($T(t),"_roomProfile",bl.communication),Qd($T(t),"_context",void 0),Qd($T(t),"_subStreamQueue",{}),t.id=e.id,t._monitor=kO(t.id),t._pubSubLock=new nG("pubSubLock"),t._joinLeaveLock=new nG("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 Nl(k,[{key:"_addHandlerEvents",value:function(){var e,t=this;null===(e=this._handler)||void 0===e||e.once("disconnect",(function(){vG.print("emit ABNORMAL_DISCONNECTION ice"),t.safeEmit(tD.ABNORMAL_DISCONNECTION)}))}},{key:"_addSignalEventHandler",value:function(){var e,t=this;[$M.ON_ADD_STREAM,$M.ON_ADD_STREAM_LIST,$M.ON_REMOVE_STREAM,$M.ON_REMOVE_STREAM_LIST,$M.USER_CONNECTION,$M.USER_CONNECTION_LIST,$M.USER_DISCONNECTION,$M.USER_DISCONNECTION_LIST,$M.ON_UPDATE_STREAM_ATTRIBUTES,$M.ON_UPDATE_ROOM_ATTRIBUTES,$M.ON_PUSH_TRACK,$M.NODE_CHANGE,$M.ON_CUSTOM_MESSAGE,$M.USER_MESSAGE_RECEIVED,$M.USER_BINARY_MESSAGE_RECEIVED,$M.POST_PROCESSING_MESSAGE,$M.ON_USER_TOKEN_WILL_EXPIRE,$M.STREAM_CONTROL_MESSAGE,$M.ON_UPDATE_USER_ATTRIBUTES,$M.ON_SPEAKER_CHANGE,eD.RSCP,eD.RTT,$M.ON_STREAM_FAILED,$M.ON_NOTIFY_RECONNECT,eD.SSC].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(){vG.print("emit ABNORMAL_DISCONNECTION datachannel"),t.safeEmit(tD.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(tD.ON_CONNECTION_STATE_CHANGE,{prev:this._state,next:e}),this._state=e)}},{key:"businessId",set:function(e){this._businessId=e}},{key:"connect",value:(b=Tm(Em().mark((function e(t){var 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>1&&void 0!==u[1]?u[1]:{},this.connectionState="connecting",this._appId=t,this._handler&&(this._removeSignalEventHandler(),this._handler.destroy()),!r.node){e.next=9;break}n=[r.node],AO(this.id,"es.join.nodeChange",r),e.next=18;break;case 9:return q_.resolve().then((function(){return c.emit("onGetIceConfigHook")})),this._iceConfigRequestManager=new fD(this.id),e.next=13,null===(i=this._iceConfigRequestManager)||void 0===i?void 0:i.getAccessNode(t,null==r?void 0:r.reason,null==r?void 0:r.feedbackNode,this._useCloudProxy,this._expectedIDC);case 13:if(n=e.sent){e.next=17;break}throw AO(this.id,"es.join.getNodeFailed",""),new hR(dR.ICE_SERVER_WRONG,"get ICE config failed");case 17:AO(this.id,"es.join.getNodeSuccess",n);case 18:return q_.resolve().then((function(){return c.emit("onEstablishConnectionHook")})),e.prev=19,a=!1,s=Fm(n).call(n,(function(e){var t=eG(c._context);return t.connect(e).then((function(r){var i,s;c.emit("onConnectSuccessHook",null===(i=n)||void 0===i?void 0:i.length),a?t.destroy():(a=!0,o=r,c.safeEmit("prevIceNode",e),c._handler=t,c.supportConcurrent="chrome"===t.name,c._addHandlerEvents(),null===(s=c._monitor)||void 0===s||s.set({connection_id:t.getConnectionId()}))})).catch((function(e){throw t.destroy(),e}))})),e.next=24,lP(s);case 24:vG.print("connect","establish peerConnection success"),e.next=31;break;case 27:throw e.prev=27,e.t0=e.catch(19),this.connectionState="disconnected",new hR(dR.ESTABLISH_DATACHANNEL_FAILED,"establish dataChannel failed",e.t0);case 31:if(!o){e.next=37;break}this._dataChannelSignal=new hD(this.id,o),this._addSignalEventHandler(),this._dataChannelSignal.sendPingSignaling(),e.next=39;break;case 37:throw this.connectionState="disconnected",new hR(dR.ESTABLISH_DATACHANNEL_FAILED,"establish dataChannel failed");case 39:case"end":return e.stop()}}),e,this,[[19,27]])}))),function(e){return b.apply(this,arguments)})},{key:"join",value:(S=Tm(Em().mark((function e(t){var r,n,i,o,a,s,c,u,d,l,h,p,v,f,_,m,g,y=this,S=arguments;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=S.length>1&&void 0!==S[1]?S[1]:{},i=S.length>2&&void 0!==S[2]&&S[2],o=S.length>3?S[3]:void 0,vG.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,this._handler){e.next=17;break}return e.next=17,this.connect(this._appId,n);case 17:return e.t0=ZO.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=24,null===(r=this._handler)||void 0===r?void 0:r.getDefaultSdp();case 24:return e.t5=e.sent,e.next=27,ZN();case 27:return e.t6=e.sent,e.t7=window.navigator.userAgent,e.t8=cM.VERSION,e.t9=nM.getDeviceId(),e.t10=this._appId,e.t11=this._roomId,e.t12=this._clientId,e.t13=this._businessId,e.t14=this._useCloudProxy,e.t15=cG[this._roomProfile]?cG[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,supportMultiVendor:!0},e.t18=Mm({requireICEUfragV2:!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,accessParams:e.t18},q_.resolve().then((function(){return y.emit("onSendingJoinMessageHook")})),e.prev=42,c=i?"reconnected":"joinRoom",e.next=46,this._dataChannelSignal.sendSignaling(c,a);case 46:return u=e.sent,vG.print("join","send join message success"),d=u.config||{},l=d.engine_WEB,this._authorization=a.Authorization,this.connectionState="connected",nM.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:!(wP||!1===(null===(p=u.config)||void 0===p||null===(v=p.engine_VPM)||void 0===v||null===(f=v.ondemand)||void 0===f?void 0:f.enable)),forceUniHandler:1===(null==u||null===(_=u.config)||void 0===_||null===(m=_.vendor_param)||void 0===m?void 0:m.vendor_stream_sub_mode)},"boolean"==typeof(null==l?void 0:l.av_sync)&&(this._context.avSync=l.av_sync)),u.vendorConfig&&(this._vendorConfig=u.vendorConfig),JV.audioStallConfig=l,null!=u&&null!==(s=u.relayMessage)&&void 0!==s&&s.sdp&&(null===(g=this._handler)||void 0===g||g.createAVMlineAnswerTpl(u.relayMessage.sdp)),e.abrupt("return",u);case 59:if(e.prev=59,e.t19=e.catch(42),this.connectionState="disconnected",!((null===e.t19||void 0===e.t19?void 0:e.t19.code)>=700&&(null===e.t19||void 0===e.t19?void 0:e.t19.code)<800)){e.next=64;break}throw new hR(dR.INVALID_TOKEN,(null===e.t19||void 0===e.t19?void 0:e.t19.message)||"Invalid token");case 64:if(200===(null===e.t19||void 0===e.t19?void 0:e.t19.code)){e.next=66;break}throw new hR(dR.JOIN_ROOM_FAILED,(null===e.t19||void 0===e.t19?void 0:e.t19.message)||"Join room failed");case 66:case"end":return e.stop()}}),e,this,[[42,59]])}))),function(e){return S.apply(this,arguments)})},{key:"publish",value:(y=Tm(Em().mark((function e(t){var r,n,i,o,a,s,c,u,d,l,h,p,v,f,_,m,g,y,S,b,E,k,T,I,A,R,C,w,x,O=this;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(vG.print("publish()","localStream: %o",t),r=t.videoTrack,n=t.audioTrack,i=QO(),o="",a="",s=this._handler,e.prev=7,!this._vendorConfig.enableMultiVendor){e.next=19;break}return t.vendorHandler=new dG(this._context),t.pcSessionId&&(t.vendorHandler.peerConnectionId=t.pcSessionId),e.next=13,t.vendorHandler.publish(t);case 13:k=e.sent,(s=t.vendorHandler).on("ice_state",(function(e){O.emit(tD.ON_VENDOR_CONNECTION_STATE_CHANGE,{state:{checking:ll.CONNECTION_STATE_CONNECTING,connected:ll.CONNECTION_STATE_CONNECTED,disconnected:ll.CONNECTION_STATE_RECONNECTING}[e],userId:O._clientId})})),s.once("disconnect",Tm(Em().mark((function e(){var r,n,i;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(null===(r=s)||void 0===r||r.removeAllListeners(),"connected"===(null===(n=O._handler)||void 0===n||null===(i=n.pc)||void 0===i?void 0:i.iceConnectionState)){e.next=4;break}return vG.print("vendor ice failed",t.streamId),e.abrupt("return");case 4:t.clean(),O.publish(t);case 6:case"end":return e.stop()}}),e)})))),e.next=22;break;case 19:return e.next=21,null===(T=this._handler)||void 0===T?void 0:T.publish(t);case 21:k=e.sent;case 22:if(null===(c=t.observer)||void 0===c||c.setHandler(s),k){e.next=25;break}throw new hR(dR.ADD_TRANSCEIVER_FAILED,"add transceiver failed");case 25:if("H264"!==(null===(u=this._context)||void 0===u||null===(d=u.serverConfig)||void 0===d?void 0:d.videoCodec)){e.next=31;break}return e.next=28,oL();case 28:if(e.sent){e.next=31;break}throw new hR(dR.PUBLISH_FAILED,"h264 is not supported");case 31:return o=k.audioMid,a=k.videoMid,t.pubAttributes={localaudio:!!n,localvideo:!!r,videostream:t.pubVideo,audiostream:t.pubAudio,extvideo:!!(r instanceof lV),extaudio:!!(n instanceof hV)},I={attributes:Zd({videoDescriptions:k.videoDescriptions},t.pubAttributes),audio:!0,video:!0,screen:t.isScreen,audioMid:o,videoMid:a,sdpInfo:{msid:t.stream.id,type:k.type,sdp:k.partialSdp,semantics:k.semantics},peerConnectionMode:null===(l=k)||void 0===l?void 0:l.peerConnectionMode,supportMultiVendor:!0},(A=!this._vendorConfig.enableMultiVendor&&t.enableSimulcast&&(null===(h=this._context)||void 0===h||null===(p=h.serverConfig)||void 0===p?void 0:p.simulcastOnDemand)&&(null===(v=k.subVideoDescriptions)||void 0===v?void 0:v.length))&&(I.attributes.subVideoDescriptions=k.subVideoDescriptions),null!==(f=k)&&void 0!==f&&f.peerConnectionId&&(I.peerConnectionId=k.peerConnectionId),e.next=40,null===(_=this._dataChannelSignal)||void 0===_?void 0:_.sendSignaling("publish",I);case 40:if(200===(null==(R=e.sent)?void 0:R.code)){e.next=43;break}throw new hR(dR.PUBLISH_FAILED,(null==R?void 0:R.message)||"publish failed");case 43:if(null===(m=this._monitor)||void 0===m||m.report("rtc_recv_answer",{error_code:0,answer_type:null==R?void 0:R.relayMessage.type,sequence_id:(null==R||null===(g=R.relayMessage)||void 0===g?void 0:g.sequenceId)||0,message:null==R||null===(y=R.relayMessage)||void 0===y?void 0:y.sdp,direction:"up",stream_id:"",stream_user_id:"",pc_session_id:(null===(S=s)||void 0===S?void 0:S.peerConnectionId)||""}),C=new q_((function(e,r){var n,i,c,u,d,l;null===(n=s)||void 0===n||n.handleAck({action:sF.publish,streamId:R.streamId,audioMid:o,videoMid:a,audioTransceiverInit:null===(i=k)||void 0===i?void 0:i.audioTransceiverInit,videoTransceiverInit:null===(c=k)||void 0===c?void 0:c.videoTransceiverInit,signalingAck:{sdp:null==R||null===(u=R.relayMessage)||void 0===u?void 0:u.sdp,sequenceId:null==R||null===(d=R.relayMessage)||void 0===d?void 0:d.sequenceId},sdp:null===(l=k)||void 0===l?void 0:l.sdp,stream:t,onSuccess:function(){vG.print("publish()","publish success"),e(0)}})})),"chrome"!==(null===(b=this.handler)||void 0===b?void 0:b.name)){e.next=48;break}return e.next=48,C;case 48:return A&&this.emit(eD.RSCP,[{StreamIds:[t.stream.id],Metadata:{VideoIndex:0}}]),t.streamId=R.streamId,t.videoMid=a,t.audioMid=o,t.subVideoDescriptions=k.subVideoDescriptions,null===(E=this._monitor)||void 0===E||E.report("rtc_publish_stat",{result:"success",is_screen:"0",start:i,message:"unknown"}),t.statsReport.setLocalStreamStatsEvtInterval((function(e){return O.emit("onLocalStreamStats",e)}),s,this._context),e.abrupt("return");case 58:return e.prev=58,e.t0=e.catch(7),e.t0 instanceof Error&&(null===(x=this._monitor)||void 0===x||x.report("rtc_publish_stat",{result:"fail",is_screen:"0",start:i,message:e.t0.message})),e.next=63,null===(w=s)||void 0===w?void 0:w.rollback(t.stream.id,t);case 63:throw e.t0;case 64:case"end":return e.stop()}}),e,this,[[7,58]])}))),function(e){return y.apply(this,arguments)})},{key:"updatePubTrack",value:(g=Tm(Em().mark((function e(t){var r,n,i,o,a,s,c,u,d,l,h,p,v,f,_,m,g,y,S,b,E,k,T,I,A,R,C,w,x,O,P;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:vG.print("updatePubTrack()","localStream: %o",t),i=t.videoTrack,o=t.audioTrack,a=t.pubAudio,s=t.pubVideo,c=t.vendorHandler||this.handler,u=null==o?void 0:o.getTrack("preprocessing"),d=null==i?void 0:i.getTrack("preprocessing"),s&&d?null===(l=t.videoTransceiver)||void 0===l||l.sender.replaceTrack(d):null===(h=t.videoTransceiver)||void 0===h||h.sender.replaceTrack(null),null==c||c.updateMaxBitrate(t),a&&u?(v=o.mixType,(f=o.mixedAudioTrack)&&v!==xl.PLAYOUT&&!0===u.enabled&&(u=f),null===(p=t.audioTransceiver)||void 0===p||p.sender.replaceTrack(u)):(null===(_=t.audioTransceiver)||void 0===_||_.sender.replaceTrack(null),AO(this.id,"MediaClient.updatePubTrack(audio)","null"));try{AO(this.id,"MediaClient.updatePubTrack",Mm({audioStreamTrack:mP(u),videoStreamTrack:mP(d)}))}catch(sq){}for(g={},y=0,S=bR(m={localaudio:!!o,localvideo:!!i,videostream:s,audiostream:a,extvideo:!!(i instanceof lV),extaudio:!!(o instanceof hV)});y<S.length;y++)b=ZT(S[y],2),E=b[0],(k=b[1])!==cI(t.pubAttributes,E)&&YM(g,E,k);if(an(g).length){e.next=14;break}return e.abrupt("return");case 14:return t.observer&&(T=t.observer,I=g.audiostream,A=g.videostream,R=g.localaudio,C=g.localvideo,w=g.extaudio,x=g.extvideo,void 0!==C?void 0!==x?T.setPushVideo(x):T.setEnableVideo(C):void 0!==A&&T.setUnmuteVideo(A),void 0!==R?void 0!==w?T.setPushAudio(w):T.setEnableAudio(R):void 0!==I&&T.setUnmuteAudio(I)),t.pubAttributes=m,O={roomId:this._roomId,streamId:t.streamId,attributes:g},e.next=19,null===(r=this._dataChannelSignal)||void 0===r?void 0:r.sendSignaling("updateStreamAttributes",O);case 19:if(200===(null==(P=e.sent)?void 0:P.code)){e.next=22;break}throw new hR(dR.UPDATE_TRACK_FAILED,(null==P?void 0:P.message)||"update track failed");case 22:if("chrome"===(null===(n=this.handler)||void 0===n?void 0:n.name)){e.next=25;break}return e.next=25,null==c?void 0:c.setCurrentDescription();case 25:case"end":return e.stop()}}),e,this)}))),function(e){return g.apply(this,arguments)})},{key:"updateToken",value:(m=Tm(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(vG.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 hR(dR.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 hR(dR.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 m.apply(this,arguments)})},{key:"unpublish",value:(_=Tm(Em().mark((function e(t){var r,n,i;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return vG.print("unpublish()","localStream: %o",t),n={roomId:this._roomId,initStreamId:t.initStreamId,streamId:t.streamId},null===(r=this._dataChannelSignal)||void 0===r||r.sendSignaling("unpublish",n),i=t.vendorHandler||this._handler,e.next=6,null==i?void 0:i.handleAck({action:sF.unpublish,audioMid:t.audioMid,videoMid:t.videoMid,stream:t,streamId:t.streamId});case 6:t.statsReport.unpublish();case 7:case"end":return e.stop()}}),e,this)}))),function(e){return _.apply(this,arguments)})},{key:"subscribe",value:(f=Tm(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 q_(function(){var e=Tm(Em().mark((function e(o,a){var s,c,u,d,l,h,p,v,f,_,m,g,y,S,b,E,k,T,I,A,R,C,w,x,O,P,M,D,N,L,U,V,F,B,j,G,H,z,K,X,q,Y,W,Q,J,Z;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t.streamState!==rF.SUB_ED){e.next=2;break}return e.abrupt("return",i._updateSubTrack(t,r,sG.SUB).then(o,a));case 2:if(t.streamState!==rF.SUB_ING){e.next=7;break}return i._subStreamQueue[t.streamId]||(i._subStreamQueue[t.streamId]=[]),vG.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(vG.print("subscribe()","mediaType: %o",r),mG("subscribe()",t),t.streamState=rF.SUB_ING,c=!1,u=!1,pP(r)&&(u=!0),vP(r)&&(c=!0),c||!i.multiChatMode()){e.next=17;break}return t.streamState=rF.INIT,i.emit("SUB_END",t.streamId),e.abrupt("return",o(null));case 17:if(d=QO(),l=t.subVideo,h=[],p=!i.multiChatMode(),i._subResolves[t.streamId]||(i._subResolves[t.streamId]=[]),h.push(new q_((function(e,r){i._subResolves[t.streamId].push(e);var n=setTimeout((function(){return r(new hR(dR.TIME_OUT,"wait video timeout for userId: ".concat(t.userId)))}),fG);t.on("ontrack",(function r(i){"video"===i.mediaType&&(vG.print("remoteStream ".concat(t.userId," received video track")),t.off("ontrack",r),clearTimeout(n),e(0))}))}))),p&&h.push(new q_((function(e,r){i._subResolves[t.streamId].push(e);var n=setTimeout((function(){return r(new hR(dR.TIME_OUT,"wait audio timeout for userId: ".concat(t.userId)))}),fG);t.on("ontrack",(function r(i){"audio"===i.mediaType&&(vG.print("remoteStream ".concat(t.userId," received audio track")),t.off("ontrack",r),clearTimeout(n),e(0))}))}))),v=function(e){t.ontrack(e)},null===(s=i._handler)||void 0===s||s.on("ontrack",v),i._ontrackCallbackMap.set(t,v),f=i._handler,e.prev=28,null!==(_=i._context.serverConfig)&&void 0!==_&&_.forceUniHandler||!t.enableVendorMode){e.next=41;break}return t.vendorHandler=new dG(i._context),t.pcSessionId&&(t.vendorHandler.peerConnectionId=t.pcSessionId),(f=t.vendorHandler).on("ontrack",v),e.next=36,t.vendorHandler.subscribe(t);case 36:U=e.sent,f.on("ice_state",(function(e){i.emit(tD.ON_VENDOR_CONNECTION_STATE_CHANGE,{state:{checking:ll.CONNECTION_STATE_CONNECTING,connected:ll.CONNECTION_STATE_CONNECTED,disconnected:ll.CONNECTION_STATE_RECONNECTING}[e],userId:t.userId})})),f.once("disconnect",Tm(Em().mark((function e(){var r,n,o;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(null===(r=f)||void 0===r||r.removeAllListeners(),"connected"===(null===(n=i._handler)||void 0===n||null===(o=n.pc)||void 0===o?void 0:o.iceConnectionState)){e.next=4;break}return vG.print("vendor ice failed",t.streamId),e.abrupt("return");case 4:return t.resetHasSubscribed(),e.next=7,i.subscribe(t,t.subMediaType);case 7:i.emit(iG.RESUBSCRIBE,{stream:t});case 8:case"end":return e.stop()}}),e)})))),e.next=44;break;case 41:return e.next=43,null===(V=i._handler)||void 0===V?void 0:V.subscribe(t,{multiChatMode:i.multiChatMode()});case 43:U=e.sent;case 44:if(null===(m=t.observer)||void 0===m||m.setHandler(f),U){e.next=47;break}throw new hR(dR.ADD_TRANSCEIVER_FAILED,"add transceiver failed");case 47:return F=U.audioMid,B=U.videoMid,t.subVideo=c,j={spatialLayer:(null==n?void 0:n.spatialLayer)||0,temporalLayer:0,spatialSubLayer:(null==n?void 0:n.spatialSubLayer)||-1},G={audio:!i.multiChatMode(),video:!0,data:!0,screen:t.isScreen,browser:"chrome-stable",videoMid:B,audioMid:F,sdpInfo:{sdp:null===(g=U)||void 0===g?void 0:g.partialSdp,semantics:null===(y=U)||void 0===y?void 0:y.semantics,type:null===(S=U)||void 0===S?void 0:S.type},streamUserId:t.userId,streamId:t.streamId,config:{enableMediaType:{audio:!!i.multiChatMode()||u,video:c},qualityLayer:j},extra:{enableSendRTT:!0},peerConnectionMode:null===(b=U)||void 0===b?void 0:b.peerConnectionMode,supportMultiVendor:!0},null!==(E=U)&&void 0!==E&&E.peerConnectionId&&(G.peerConnectionId=U.peerConnectionId),H=i._context||{},z=H.subscribeFallbackOption,K=H.userPriority,"number"==typeof z&&(G.config.fallbackOption=z),null!=K&&K.has(t.userId)&&(G.config.priority=K.get(t.userId)),null!==(k=U)&&void 0!==k&&k.allSsrc&&(G.extra.subscribeSSRC=U.allSsrc),e.next=59,null===(T=i._dataChannelSignal)||void 0===T?void 0:T.sendSignaling("subscribe",G);case 59:if(200===(null==(X=e.sent)?void 0:X.code)){e.next=62;break}throw new hR(dR.SUBSCRIBE_FAILED,(null==X?void 0:X.message)||"subscribe failed");case 62:return q=null==X?void 0:X.relayMessage,Y=q.audioMid,W=q.videoMid,Qd(I={},F,Y),Qd(I,B,W),Q=I,vG.print("sub midmap",t.userId,Q),t.videoMid=B,t.audioMid=F,t.subMediaType=r,t.streamState=rF.SUB_ED,t.subLayer=j,null===(A=i._monitor)||void 0===A||A.report("rtc_recv_answer",{error_code:0,answer_type:null==X||null===(R=X.relayMessage)||void 0===R?void 0:R.type,sequence_id:(null==X||null===(C=X.relayMessage)||void 0===C?void 0:C.sequenceId)||0,message:null==X||null===(w=X.relayMessage)||void 0===w?void 0:w.sdp,direction:"down",stream_id:t.streamId,stream_user_id:t.userId,pc_session_id:(null===(x=f)||void 0===x?void 0:x.peerConnectionId)||""}),e.next=73,null===(O=f)||void 0===O?void 0:O.handleAck({action:sF.subscribe,streamId:t.streamId,audioMid:F,videoMid:B,audioTransceiverInit:null===(P=U)||void 0===P?void 0:P.audioTransceiverInit,videoTransceiverInit:null===(M=U)||void 0===M?void 0:M.videoTransceiverInit,signalingAck:{sdp:null==X||null===(D=X.relayMessage)||void 0===D?void 0:D.sdp,sequenceId:null==X||null===(N=X.relayMessage)||void 0===N?void 0:N.sequenceId},stream:t,sdp:U.sdp,generatorSsrc:!!U.allSsrc});case 73:return e.next=75,q_.all(h);case 75:i.multiChatMode()||(t.subAudio=u),null===(L=i._monitor)||void 0===L||L.report("rtc_subscribe_stat",{result:"success",start:d,message:"unknown",stream_user_id:t.userId}),i._context&&t.statsReport.setRemoteStreamStatsEvtInterval((function(e){return i.emit("onRemoteStreamStats",e)}),f,i._context),o(null),i.emit("SUB_END",t.streamId),e.next=91;break;case 82:return e.prev=82,e.t0=e.catch(28),e.t0 instanceof Error&&(null===(Z=i._monitor)||void 0===Z||Z.report("rtc_subscribe_stat",{result:"fail",start:d,message:e.t0.message,stream_user_id:t.userId})),t.subVideo=l,t.streamState=rF.INIT,e.next=89,null===(J=f)||void 0===J?void 0:J.rollback(t.streamId,t);case 89:a(e.t0),i.emit("SUB_END",t.streamId);case 91:case"end":return e.stop()}}),e,null,[[28,82]])})));return function(t,r){return e.apply(this,arguments)}}()));case 1:case"end":return e.stop()}}),e)}))),function(e,t,r){return f.apply(this,arguments)})},{key:"_handleSubStreamQueue",value:function(e){var t,r=this;if(null!==(t=this._subStreamQueue[e])&&void 0!==t&&t.length){vG.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 vG.print("_subStreamQueue","streamId: %o, END",e)}},{key:"controlMessage",value:(v=Tm(Em().mark((function e(t){var r,n;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return vG.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 v.apply(this,arguments)})},{key:"updateUserAttributes",value:(p=Tm(Em().mark((function e(t){var r;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return vG.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 p.apply(this,arguments)})},{key:"updateSubTrack",value:(h=Tm(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 h.apply(this,arguments)})},{key:"updateSubTrackLayer",value:(l=Tm(Em().mark((function e(t,r){var n,i,o;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(vG.print("updateSubTrack()","subLayer: %o",r),t.subLayer.spatialLayer!==r.spatialLayer||t.subLayer.spatialSubLayer!==r.spatialSubLayer){e.next=4;break}return vG.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 hR(dR.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 l.apply(this,arguments)})},{key:"updateSubPriority",value:(d=Tm(Em().mark((function e(t,r){var n,i,o;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(vG.print("updateSubPriority()","priority: %o",r),t.priority!==r){e.next=4;break}return vG.print("updateSubPriority()","priority no change"),e.abrupt("return",t);case 4:return i={roomId:this._roomId,streamList:[t.streamId],streamId:t.streamId,streamUserId:t.userId,config:{priority: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 hR(dR.UPDATE_TRACK_FAILED,(null==o?void 0:o.message)||"update track failed");case 10:return t.priority=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=Tm(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(vG.print("updateSubTrack()","mediaType: %o",r),mG("updateSubTrack()",t),!this.multiChatMode()||r!==ul.AUDIO){e.next=5;break}return vG.print("updateSubTrack","multiChatMode mediaType only audio"),e.abrupt("return",t);case 5:return a=0,a=n===sG.SUB?t.subMediaType|r:t.subMediaType-(t.subMediaType&r),vG.print("updateSubTrack","prev: %o, direction: %o, mediaType: %o, newMediaType: %o",t.subMediaType,n,r,a),t.subMediaType===a&&vG.print("updateSubTrack","mediaType no change"),s=!1,c=!1,pP(a)&&(c=!0),vP(a)&&(s=!0),u={roomId:this._roomId,streamList:[t.streamId],config:{enableMediaType:{video:s,audio:!!this.multiChatMode()||c}}},e.next=15,null===(i=this._dataChannelSignal)||void 0===i?void 0:i.sendSignaling("updateSubscribe",u);case 15:if(200===(null==(d=e.sent)?void 0:d.code)){e.next=18;break}throw new hR(dR.UPDATE_TRACK_FAILED,(null==d?void 0:d.message)||"update track failed");case 18:return this.multiChatMode()||(null===(l=t.observer)||void 0===l||l.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 23:case"end":return e.stop()}}),e,this)}))),function(e,t,r){return u.apply(this,arguments)})},{key:"subscribe4pushTrack",value:(c=Tm(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 vG.print("subscribe4pushTrack()","streamInfo: %o",r),mG("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 hR(dR.ADD_TRANSCEIVER_FAILED,"add transceiver failed");case 9:return c=s.audioMid,u=s.videoMid,(d=[]).push(new q_((function(e,r){var n=setTimeout((function(){return r(new hR(dR.TIME_OUT,"wait audio timeout for userId: ".concat(t.userId)))}),fG);t.on("ontrack",(function r(i){"audio"===i.mediaType&&(vG.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:sF.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,q_.all(d);case 20:this._context&&t.statsReport.setRemoteStreamStatsEvtInterval((function(e){return h.emit("onRemoteStreamStats",e)}),this._handler,this._context);case 21:case"end":return e.stop()}}),e,this)}))),function(e,t){return c.apply(this,arguments)})},{key:"unsubscribe4removeTrack",value:(s=Tm(Em().mark((function e(t,r){return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:mG("unsubscribe4removeTrack()",t),vG.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=Tm(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],mG("unsubscribe()",t),!n){e.next=4;break}return e.abrupt("return",this._unsubscribe(t,r));case 4:if(!this.multiChatMode()||!vP(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!==VV.NONE){e.next=9;break}return e.abrupt("return",this._unsubscribe(t,r));case 9:return e.abrupt("return",this._updateSubTrack(t,r,sG.UNSUB));case 10:case"end":return e.stop()}}),e,this)}))),function(e,t){return a.apply(this,arguments)})},{key:"_unsubscribe",value:(o=Tm(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(!this._subConfig.muteReplaceUnsub){e.next=2;break}return e.abrupt("return",this._updateSubTrack(t,r,sG.UNSUB));case 2:return a={roomId:this._roomId,streamId:t.streamId,userId:t.userId},s=t.vendorHandler||this.handler,null===(n=this._dataChannelSignal)||void 0===n||n.sendSignaling("unsubscribe",a).catch((function(){})),t.streamState=rF.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=12,null==s?void 0:s.handleAck({action:sF.unsubscribe,streamId:t.streamId,audioMid:t.audioMid,videoMid:t.videoMid,stream:t});case 12:c=e.sent,this._subResolves[c]&&this._subResolves[c].forEach((function(e){return e(0)})),vG.print("unsubscribe","clean unsub ".concat(t.userId)),t.clean(),this.removeOnTrackListener(t),t.statsReport.unsubscribe();case 18:case"end":return e.stop()}}),e,this)}))),function(e,t){return o.apply(this,arguments)})},{key:"removeOnTrackListener",value:function(e){var t=this._ontrackCallbackMap.get(e);if(t){var r=e.vendorHandler||this._handler;null==r||r.off("ontrack",t),this._ontrackCallbackMap.delete(e)}}},{key:"handleRemoveStream",value:(i=Tm(Em().mark((function e(t,r){return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(mG("handleRemoveStream()",t),t.subVideo=!1,t.streamState!==rF.INIT){e.next=4;break}return e.abrupt("return");case 4:this.unsubscribe(t,ul.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=Tm(Em().mark((function e(){var t,r,n;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(vG.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",q_.reject(new hR(dR.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=Tm(Em().mark((function e(t){var r,n,i,o,a,s,c,u,d,l,h,p,v,f,_,m,g=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(s=e.sent){e.next=5;break}throw new hR(dR.ADD_TRANSCEIVER_FAILED,"add transceiver failed");case 5:return c=QO(),u=s.audioMid,d=s.videoMid,e.t0=this._appId,e.t1=t.streamId,e.t2=u,e.t3=d,e.t4={sdp:null==s?void 0:s.partialSdp,semantics:null==s?void 0:s.semantics,type:null==s?void 0:s.type},e.next=15,ZN();case 15:return e.t5=e.sent,e.t6=window.navigator.userAgent,e.t7=cM.VERSION,e.t8=nM.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}},l={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",l);case 27:return h=e.sent,p=[],this._subResolves[t.streamId]=[],p.push(new q_((function(e,r){g._subResolves[t.streamId].push(e);var n=setTimeout((function(){return r(new hR(dR.TIME_OUT,"wait video timeout for streamId: ".concat(t.streamId)))}),fG);t.on("ontrack",(function r(i){"video"===i.mediaType&&(vG.print("remoteStream ".concat(t.userId," received video track")),t.off("ontrack",r),clearTimeout(n),e(0))}))}))),p.push(new q_((function(e,r){g._subResolves[t.streamId].push(e);var n=setTimeout((function(){return r(new hR(dR.TIME_OUT,"wait audio timeout for streamId: ".concat(t.streamId)))}),fG);t.on("ontrack",(function r(i){"audio"===i.mediaType&&(vG.print("remoteStream ".concat(t.userId," received audio track")),t.off("ontrack",r),clearTimeout(n),e(0))}))}))),v=function(e){t.ontrack(e)},null===(i=this._handler)||void 0===i||i.on("ontrack",v),this._ontrackCallbackMap.set(t,v),f=null==h?void 0:h.relayMessage,_=f.sequenceId,m=f.sdp,t.videoMid=d,t.audioMid=u,t.sequenceId=_,t.streamState=rF.SUB_ED,t.subAudio=!0,t.subVideo=!0,e.next=44,null===(o=this._handler)||void 0===o?void 0:o.handleAck({action:sF.subscribe,streamId:t.streamId,audioMid:u,videoMid:d,audioTransceiverInit:null==s?void 0:s.audioTransceiverInit,videoTransceiverInit:null==s?void 0:s.videoTransceiverInit,signalingAck:{sdp:m,sequenceId:_},stream:t});case 44:return e.next=46,q_.all(p);case 46:null===(a=this._monitor)||void 0===a||a.report("rtc_subscribe_stat",{result:"success",start:c,message:"unknown",stream_user_id:t.userId}),this._context&&t.statsReport.setRemoteStreamStatsEvtInterval((function(e){return g.emit("onRemoteStreamStats",e)}),this._handler,this._context);case 48:case"end":return e.stop()}}),e,this)}))),function(e){return r.apply(this,arguments)})},{key:"unsubscribePublicStream",value:(t=Tm(Em().mark((function e(t){var r,n,i;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return mG("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=rF.INIT,t.subVideo=!1,t.subAudio=!1,e.next=14,null===(r=this._handler)||void 0===r?void 0:r.handleAck({action:sF.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,n;vG.print("destroy()"),this._token=void 0,this._appId=void 0,this._roomId=void 0,this._clientId=void 0,this._authorization=void 0,this._sessionId=void 0,null===(e=this._handler)||void 0===e||e.destroy(),null===(t=this._monitor)||void 0===t||t.set({connection_id:""}),null===(r=this._dataChannelSignal)||void 0===r||r.destroy(),null===(n=this._iceConfigRequestManager)||void 0===n||n.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}},{key:"vendorConfig",get:function(){return this._vendorConfig}}]),k}(FM);function yG(e,t,r){var n=r.value;return r.value=Tm(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 hR(dR.NOT_CONNECTED_YET,"error in ".concat(t,": try again after joined"));case 7:case"end":return e.stop()}}),e,this)}))),r}function SG(e,t,r){var n=r.value;return r.value=Tm(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}pG([function(e,t,r){var n=r.value;return r.value=Tm(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 q_(function(){var e=Tm(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 hR(dR.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}],gG.prototype,"join",1),pG([SG,yG],gG.prototype,"publish",1),pG([SG,yG],gG.prototype,"updatePubTrack",1),pG([SG,yG],gG.prototype,"unpublish",1),pG([SG,yG],gG.prototype,"subscribe",1),pG([yG],gG.prototype,"controlMessage",1),pG([yG],gG.prototype,"updateUserAttributes",1),pG([yG],gG.prototype,"updateSubTrack",1),pG([yG],gG.prototype,"updateSubTrackLayer",1),pG([yG],gG.prototype,"updateSubPriority",1),pG([SG,yG],gG.prototype,"subscribe4pushTrack",1),pG([SG,yG],gG.prototype,"unsubscribe4removeTrack",1),pG([SG,yG],gG.prototype,"unsubscribe",1),pG([yG],gG.prototype,"handleRemoveStream",1),pG([SG],gG.prototype,"subscribePublicStream",1),pG([SG],gG.prototype,"unsubscribePublicStream",1);var bG,EG=new cO("RecvFrameObserver",0),kG=function(e){OI(a,e);var t,r,n,i,o=YI(a);function a(e,t){var r;return Ll(this,a),Qd($T(r=o.call(this)),"_audioEventSessionId",eP()),Qd($T(r),"_videoEventSessionId",eP()),Qd($T(r),"_handler",void 0),Qd($T(r),"_stream",void 0),Qd($T(r),"_firstAudioFrameTimer",void 0),Qd($T(r),"_firstVideoFrameTimer",void 0),Qd($T(r),"_transportDelayInterval",void 0),Qd($T(r),"_transportDelay",void 0),Qd($T(r),"_firstVideoFrameInterval",void 0),Qd($T(r),"_firstAudioFrameInterval",void 0),Qd($T(r),"_isScreen",!1),Qd($T(r),"_audioFirstFrameState",0),Qd($T(r),"_videoFirstFrameState",0),Qd($T(r),"_timeout",1e4),Qd($T(r),"_currentAudioRecv",{startTime:0,eventSessionId:0,type:"login"}),Qd($T(r),"_currentVideoRecv",{startTime:0,eventSessionId:0,type:"login"}),Qd($T(r),"_login",!1),Qd($T(r),"_unMuteAudio",!1),Qd($T(r),"_enableAudio",!1),Qd($T(r),"_unMuteVideo",!1),Qd($T(r),"_enableVideo",!1),Qd($T(r),"_remoteUnmuteAudio",!1),Qd($T(r),"_remoteUnmuteVideo",!1),Qd($T(r),"_audioExternal",!1),Qd($T(r),"_pushAudio",!1),Qd($T(r),"_videoExternal",!1),Qd($T(r),"_pushVideo",!1),Qd($T(r),"_autoSubscribeVideo",!1),Qd($T(r),"_autoSubscribeAudio",!1),Qd($T(r),"_autoSubscribe",!1),Qd($T(r),"_publishVideo",!1),Qd($T(r),"_publishAudio",!1),Qd($T(r),"_subscribeAudio",!1),Qd($T(r),"_subscribeVideo",!1),Qd($T(r),"_subscribe",!1),Qd($T(r),"_pushTrack",!1),Qd($T(r),"_multiChatMode",!1),Qd($T(r),"_monitor",void 0),r._stream=e,r._handler=t,r.getTransportDelay(),r._monitor=kO(e.engineId),r}return Nl(a,[{key:"beginRecvFrame",value:(i=Tm(Em().mark((function e(t,r){var n,i,o,a,s,c,u,d,l,h,p,v,f,_,m,g,y,S,b,E=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,CE(n=["login","unmute","subscribe","push_track"]).call(n,r)>=0&&(i=0,o=!1),"audio"===t?(o||this._audioEventSessionId++,this._currentAudioRecv={startTime:Date.now(),eventSessionId:this._audioEventSessionId,type:r},p={media_type:t,event_type:"begin_recv",type:r,is_screen:!(null===(a=this._stream)||void 0===a||!a.isScreen),start:null===(s=this._currentAudioRecv)||void 0===s?void 0:s.startTime,event_session_id:this._audioEventSessionId,stream_user_id:null===(c=this._stream)||void 0===c?void 0:c.userId,transport_delay:i,vendor_mode:(null===(u=this._stream)||void 0===u?void 0:u.vendorCode)||0,pc_session_id:(null===(d=this._stream)||void 0===d?void 0:d.pcSessionId)||(null===(l=this._handler)||void 0===l?void 0:l.peerConnectionId)},this._firstAudioFrameTimer&&window.clearTimeout(this._firstAudioFrameTimer),this._firstAudioFrameTimer=window.setTimeout((function(){E.stopRecvFrame("audio","timeout"),E._firstAudioFrameInterval&&window.clearInterval(E._firstAudioFrameInterval)}),this._timeout),EG.print("rtcFirstFrameRecv",Mm(p)),null===(h=this._monitor)||void 0===h||h.report("rtc_first_frame",p),this._watchForFirstAudioFrameRecv(),this._audioFirstFrameState=1,this._login=!0,this._unMuteAudio=!0,this._enableAudio=!0,this._remoteUnmuteAudio=!0):"video"===t&&(o||this._videoEventSessionId++,this._currentVideoRecv={startTime:Date.now(),eventSessionId:this._videoEventSessionId,type:r},b={media_type:t,event_type:"begin_recv",type:r,is_screen:!(null===(v=this._stream)||void 0===v||!v.isScreen),start:null===(f=this._currentVideoRecv)||void 0===f?void 0:f.startTime,event_session_id:this._videoEventSessionId,stream_user_id:null===(_=this._stream)||void 0===_?void 0:_.userId,transport_delay:i,vendor_mode:(null===(m=this._stream)||void 0===m?void 0:m.vendorCode)||0,pc_session_id:(null===(g=this._stream)||void 0===g?void 0:g.pcSessionId)||(null===(y=this._handler)||void 0===y?void 0:y.peerConnectionId)},this._firstVideoFrameTimer&&window.clearTimeout(this._firstVideoFrameTimer),this._firstVideoFrameTimer=window.setTimeout((function(){Tm(Em().mark((function e(){var t,r,n,i,o,a,s,c,u,d,l,h,p,v,f,_,m;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(e.t0=null===(t=E._handler)||void 0===t?void 0:t.pc,!e.t0){e.next=5;break}return e.next=4,fL(null===(r=E._handler)||void 0===r?void 0:r.pc,null===(n=E._stream)||void 0===n||null===(i=n.videoTrack)||void 0===i?void 0:i.getTrack());case 4:e.t0=e.sent;case 5:return v=e.t0,f=mE(o=v||[]).call(o,(function(e){return"inbound-rtp"===e.type})),e.next=9,null===(a=E._stream)||void 0===a||null===(s=a.videoTransceiver)||void 0===s?void 0:s.receiver.getStats();case 9:_=e.sent,m=[],null==_||_.forEach((function(e){return m.push(e.type)})),null===(c=E._monitor)||void 0===c||c.report("rtc_invoke_status",{sdk_api_name:"first_video_frame_timeout",error_code:-1,message:Mm({reports:Fm(v).call(v,(function(e){return e.type})),reports2:m,pc:(null===(u=E._handler)||void 0===u?void 0:u.pc)||null,track:(null===(d=E._stream)||void 0===d||null===(l=d.videoTrack)||void 0===l?void 0:l.getTrack().id)||null,framesReceived:null==f?void 0:f.framesReceived,packetsReceived:null==f?void 0:f.packetsReceived}),stream_id:(null===(h=E._stream)||void 0===h?void 0:h.streamId)||"",stream_user_id:null===(p=E._stream)||void 0===p?void 0:p.userId,elapse:0});case 13:case"end":return e.stop()}}),e)})))(),E.stopRecvFrame("video","timeout"),E._firstVideoFrameInterval&&window.clearInterval(E._firstVideoFrameInterval)}),this._timeout),this._watchForFirstVideoFrameRecv(),EG.print("rtcFirstFrameRecv",Mm(b)),null===(S=this._monitor)||void 0===S||S.report("rtc_first_frame",b),this._videoFirstFrameState=1,this._login=!0,this._unMuteVideo=!0,this._enableVideo=!0,this._remoteUnmuteVideo=!0);case 6:case"end":return e.stop()}}),e,this)}))),function(e,t){return i.apply(this,arguments)})},{key:"stopRecvFrame",value:function(e,t){if("audio"===e){var r,n,i,o,a,s,c,u;if(1!==this._audioFirstFrameState)return;var d={event_type:"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,vendor_mode:(null===(a=this._stream)||void 0===a?void 0:a.vendorCode)||0,pc_session_id:(null===(s=this._stream)||void 0===s?void 0:s.pcSessionId)||(null===(c=this._handler)||void 0===c?void 0:c.peerConnectionId)};this._firstAudioFrameTimer&&window.clearTimeout(this._firstAudioFrameTimer),delete this._currentAudioRecv,EG.print("rtcFirstFrameRecv",Mm(d)),null===(u=this._monitor)||void 0===u||u.report("rtc_first_frame",d),this._audioFirstFrameState=2}else if("video"===e){var l,h,p,v,f,_,m,g;if(1!==this._videoFirstFrameState)return;var y={event_type:"recv_end",media_type:e,is_screen:!(null===(l=this._stream)||void 0===l||!l.isScreen),start:null===(h=this._currentVideoRecv)||void 0===h?void 0:h.startTime,reason:t,result:!1,stream_user_id:null===(p=this._stream)||void 0===p?void 0:p.userId,event_session_id:this._videoEventSessionId,type:null===(v=this._currentVideoRecv)||void 0===v?void 0:v.type,vendor_mode:(null===(f=this._stream)||void 0===f?void 0:f.vendorCode)||0,pc_session_id:(null===(_=this._stream)||void 0===_?void 0:_.pcSessionId)||(null===(m=this._handler)||void 0===m?void 0:m.peerConnectionId)};this._firstVideoFrameTimer&&window.clearTimeout(this._firstVideoFrameTimer),delete this._currentVideoRecv,EG.print("rtcFirstFrameRecv",Mm(y)),null===(g=this._monitor)||void 0===g||g.report("rtc_first_frame",y),this._videoFirstFrameState=2}}},{key:"recvFrameFinish",value:(n=Tm(Em().mark((function e(t){var r,n,i,o,a,s,c,u,d,l,h,p,v,f,_,m,g,y,S,b,E,k,T;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,"audio"!==t){e.next=19;break}if(1===this._audioFirstFrameState){e.next=6;break}return e.abrupt("return");case 6:if(this._currentAudioRecv){e.next=8;break}return e.abrupt("return");case 8:d=this._currentAudioRecv,l=d.type,h=d.startTime,CE(n=["login","unmute","subscribe","push_track"]).call(n,l)>=0&&(r=0),p={event_type:"recv_end",media_type:t,start:h,result:!0,is_screen:!(null===(i=this._stream)||void 0===i||!i.isScreen),stream_user_id:null===(o=this._stream)||void 0===o?void 0:o.userId,event_session_id:this._audioEventSessionId,type:l,transport_delay:r,vendor_mode:(null===(a=this._stream)||void 0===a?void 0:a.vendorCode)||0,pc_session_id:(null===(s=this._stream)||void 0===s?void 0:s.pcSessionId)||(null===(c=this._handler)||void 0===c?void 0:c.peerConnectionId)},delete this._currentAudioRecv,this._firstAudioFrameTimer&&window.clearTimeout(this._firstAudioFrameTimer),EG.print("rtcFirstFrameRecv",Mm(p)),null===(u=this._monitor)||void 0===u||u.report("rtc_first_frame",p),this.emit("recvAudioFirstFrame"),this._audioFirstFrameState=3,e.next=33;break;case 19:if("video"!==t){e.next=33;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:b=this._currentVideoRecv,E=b.type,k=b.startTime,CE(v=["login","unmute","subscribe","push_track"]).call(v,E)>=0&&(r=0),T={event_type:"recv_end",media_type:t,is_screen:!(null===(f=this._stream)||void 0===f||!f.isScreen),start:k,result:!0,stream_user_id:null===(_=this._stream)||void 0===_?void 0:_.userId,event_session_id:this._videoEventSessionId,type:E,transport_delay:r,vendor_mode:(null===(m=this._stream)||void 0===m?void 0:m.vendorCode)||0,pc_session_id:(null===(g=this._stream)||void 0===g?void 0:g.pcSessionId)||(null===(y=this._handler)||void 0===y?void 0:y.peerConnectionId)},delete this._currentVideoRecv,this._firstVideoFrameTimer&&window.clearTimeout(this._firstVideoFrameTimer),EG.print("rtcFirstFrameRecv",Mm(T)),null===(S=this._monitor)||void 0===S||S.report("rtc_first_frame",T),this.emit("recvVideoFirstFrame"),this._videoFirstFrameState=3;case 33: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("audio","login"),e&&null!==(r=this._stream)&&void 0!==r&&r.hasVideo&&o.video&&this.beginRecvFrame("video","login"),!e&&null!==(n=this._stream)&&void 0!==n&&n.hasAudio&&this.stopRecvFrame("audio","leave_room"),!e&&null!==(i=this._stream)&&void 0!==i&&i.hasVideo&&this.stopRecvFrame("video","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("audio","unmute"):i&&this.stopRecvFrame("audio","mute"))}}},{key:"setRemoteUnmuteAudio",value:function(e){this._remoteUnmuteAudio!==e&&(this._remoteUnmuteAudio=e,this._remoteUnmuteAudio?this.beginRecvFrame("audio","remote_unmute"):this.stopRecvFrame("audio","remote_mute"))}},{key:"setEnableAudio",value:function(e){var t;this._enableAudio!==e&&(this._enableAudio=e,this._enableAudio?this.beginRecvFrame("audio","enable"):null!==(t=this._stream)&&void 0!==t&&t.hasAudio&&this.stopRecvFrame("audio","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("video","unmute"):i&&this.stopRecvFrame("video","mute"))}}},{key:"setHandler",value:function(e){this._handler=e}},{key:"setRemoteUnmuteVideo",value:function(e){this._remoteUnmuteVideo!==e&&(this._remoteUnmuteVideo=e,this._remoteUnmuteVideo?this.beginRecvFrame("video","remote_unmute"):this.stopRecvFrame("video","remote_mute"))}},{key:"setEnableVideo",value:function(e){this._enableVideo!==e&&(this._enableVideo=e,this._enableVideo?this.beginRecvFrame("video","enable"):this.stopRecvFrame("video","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("audio","push"),!e&&null!==(t=this._stream)&&void 0!==t&&t.hasAudio&&this.beginRecvFrame("audio","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("video","push"),!e&&null!==(t=this._stream)&&void 0!==t&&t.hasVideo&&this.beginRecvFrame("video","push")}},{key:"setPublishVideo",value:function(e){var t;this._publishVideo!==e&&(this._publishVideo=e),this._publishVideo&&this.beginRecvFrame("video","publish"),!e&&null!==(t=this._stream)&&void 0!==t&&t.hasVideo&&this.stopRecvFrame("video","unpublish")}},{key:"setPublishAudio",value:function(e){var t;this._publishAudio!==e&&(this._publishAudio=e),this._publishAudio&&this.beginRecvFrame("audio","publish"),!e&&null!==(t=this._stream)&&void 0!==t&&t.hasAudio&&this.stopRecvFrame("audio","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("audio","subscribe"));!e&&null!==(t=this._stream)&&void 0!==t&&t.hasAudio&&this.stopRecvFrame("audio","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("video","subscribe"));!e&&null!==(t=this._stream)&&void 0!==t&&t.hasVideo&&this.stopRecvFrame("video","unsubscribe")}},{key:"setPushTrack",value:function(e){var t;this._pushTrack!==e&&(e&&!this._isScreen&&this.beginRecvFrame("audio","push_track"),!e&&null!==(t=this._stream)&&void 0!==t&&t.hasAudio&&this.stopRecvFrame("audio","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(Tm(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,fL(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=mE(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("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(Tm(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.getOrgTrack()){n.next=12;break}return n.next=3,fL(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.getOrgTrack());case 3:if(d=n.sent,!(l=mE(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("audio"),window.clearInterval(e._firstAudioFrameInterval);case 12:case"end":return n.stop()}}),n)}))),200)}},{key:"getTransportDelay",value:(r=Tm(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(Tm(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=Tm(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,fL(null===(r=this._handler)||void 0===r?void 0:r.pc);case 3:n=e.sent,i=mE(n).call(n,(function(e){return"transport"===e.type&&"connected"===e.dtlsState})),(o=mE(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:"login"},this._currentVideoRecv={startTime:0,eventSessionId:0,type:"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)}},{key:"audioFirstFrameReceived",get:function(){return 3===this._audioFirstFrameState}},{key:"FirstFrameReceived",get:function(){return 3===this._audioFirstFrameState}}]),a}(LM.exports.EventEmitter),TG=new cO("SendFrameObserver",0),IG=function(){function e(t,r){Ll(this,e),Qd(this,"_audioEventSessionId",eP()),Qd(this,"_videoEventSessionId",eP()),Qd(this,"_pcSessionId",void 0),Qd(this,"_handler",void 0),Qd(this,"_firstAudioFrameTimer",void 0),Qd(this,"_firstVideoFrameTimer",void 0),Qd(this,"_stream",void 0),Qd(this,"_firstVideoFrameInterval",void 0),Qd(this,"_firstAudioFrameInterval",void 0),Qd(this,"_currentAudioSend",{startTime:0,eventSessionId:0,type:"login"}),Qd(this,"_currentVideoSend",{startTime:0,eventSessionId:0,type:"login"}),Qd(this,"_login",!1),Qd(this,"_publisher",!1),Qd(this,"_unMuteAudio",!1),Qd(this,"_enableAudio",!1),Qd(this,"_unMuteVideo",!1),Qd(this,"_enableVideo",!1),Qd(this,"_audioExternal",!1),Qd(this,"_pushAudio",!1),Qd(this,"_videoExternal",!1),Qd(this,"_pushVideo",!1),Qd(this,"_autoPublish",!1),Qd(this,"_publish",!1),Qd(this,"_timeout",1e4),Qd(this,"_audioFirstFrameState",0),Qd(this,"_videoFirstFrameState",0),Qd(this,"_monitor",void 0),this._stream=t,this._handler=r,this._monitor=kO(t.engineId)}var t,r;return Nl(e,[{key:"beginSendFrame",value:function(e,t){var r=this;if("audio"===e){var n,i,o,a,s,c;this._audioEventSessionId++,this._currentAudioSend={startTime:Date.now(),eventSessionId:this._audioEventSessionId,type:t};var u={event_type:"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,vendor_mode:(null===(o=this._stream)||void 0===o?void 0:o.vendorCode)||0,pc_session_id:(null===(a=this._stream)||void 0===a?void 0:a.pcSessionId)||(null===(s=this._handler)||void 0===s?void 0:s.peerConnectionId)};this._firstAudioFrameTimer&&window.clearTimeout(this._firstAudioFrameTimer),this._firstAudioFrameTimer=window.setTimeout((function(){r.stopSendFrame("audio","timeout"),r._firstAudioFrameInterval&&window.clearInterval(r._firstAudioFrameInterval)}),this._timeout),TG.print("rtcFirstFrameSend",Mm(u)),null===(c=this._monitor)||void 0===c||c.report("rtc_first_frame",u),this._watchForFirstAudioFrameSend(),this._audioFirstFrameState=1,this._login=!0,this._publisher=!0,this._publish=!0,this._unMuteAudio=!0,this._pushAudio||(this._enableAudio=!0)}else if("video"===e){var d,l,h,p,v,f;this._videoEventSessionId++,this._currentVideoSend={startTime:Date.now(),eventSessionId:this._videoEventSessionId,type:t};var _={event_type:"begin_send",media_type:e,is_screen:!(null===(d=this._stream)||void 0===d||!d.isScreen),type:t,start:null===(l=this._currentVideoSend)||void 0===l?void 0:l.startTime,event_session_id:this._videoEventSessionId,vendor_mode:(null===(h=this._stream)||void 0===h?void 0:h.vendorCode)||0,pc_session_id:(null===(p=this._stream)||void 0===p?void 0:p.pcSessionId)||(null===(v=this._handler)||void 0===v?void 0:v.peerConnectionId)};this._firstVideoFrameTimer&&window.clearTimeout(this._firstVideoFrameTimer),this._firstVideoFrameTimer=window.setTimeout((function(){r.stopSendFrame("video","timeout"),r._firstVideoFrameInterval&&window.clearInterval(r._firstVideoFrameInterval)}),this._timeout),this._watchForFirstVideoFrameSend(),TG.print("rtcFirstFrameSend",Mm(_)),null===(f=this._monitor)||void 0===f||f.report("rtc_first_frame",_),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("audio"===e){var r,n,i,o,a,s,c;if(1!==this._audioFirstFrameState)return;var u={event_type:"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,vendor_mode:(null===(o=this._stream)||void 0===o?void 0:o.vendorCode)||0,pc_session_id:(null===(a=this._stream)||void 0===a?void 0:a.pcSessionId)||(null===(s=this._handler)||void 0===s?void 0:s.peerConnectionId)};this._firstAudioFrameTimer&&window.clearTimeout(this._firstAudioFrameTimer),delete this._currentAudioSend,TG.print("rtcFirstFrameSend",Mm(u)),null===(c=this._monitor)||void 0===c||c.report("rtc_first_frame",u),this._audioFirstFrameState=2}else if("video"===e){var d,l,h,p,v,f,_;if(1!==this._videoFirstFrameState)return;var m={event_type:"sent_end",media_type:e,start:null===(d=this._currentVideoSend)||void 0===d?void 0:d.startTime,is_screen:!(null===(l=this._stream)||void 0===l||!l.isScreen),reason:t,result:!1,event_session_id:this._videoEventSessionId,type:null===(h=this._currentVideoSend)||void 0===h?void 0:h.type,vendor_mode:(null===(p=this._stream)||void 0===p?void 0:p.vendorCode)||0,pc_session_id:(null===(v=this._stream)||void 0===v?void 0:v.pcSessionId)||(null===(f=this._handler)||void 0===f?void 0:f.peerConnectionId)};this._firstVideoFrameTimer&&window.clearTimeout(this._firstVideoFrameTimer),delete this._currentVideoSend,TG.print("rtcFirstFrameSend",Mm(m)),null===(_=this._monitor)||void 0===_||_.report("rtc_first_frame",m),this._videoFirstFrameState=2}}},{key:"sendFrameFinish",value:function(e){if("audio"===e){var t,r,n,i,o;if(1!==this._audioFirstFrameState)return;if(!this._currentAudioSend)return;var a=this._currentAudioSend,s=a.type,c=a.startTime,u={event_type:"sent_end",media_type:e,is_screen:!(null===(t=this._stream)||void 0===t||!t.isScreen),start:c,result:!0,event_session_id:this._audioEventSessionId,type:s,vendor_mode:(null===(r=this._stream)||void 0===r?void 0:r.vendorCode)||0,pc_session_id:(null===(n=this._stream)||void 0===n?void 0:n.pcSessionId)||(null===(i=this._handler)||void 0===i?void 0:i.peerConnectionId)};delete this._currentAudioSend,this._firstAudioFrameTimer&&window.clearTimeout(this._firstAudioFrameTimer),TG.print("rtcFirstFrameSend",Mm(u)),null===(o=this._monitor)||void 0===o||o.report("rtc_first_frame",u),this._audioFirstFrameState=3}else if("video"===e){var d,l,h,p,v;if(1!==this._videoFirstFrameState)return;if(!this._currentVideoSend)return;var f=this._currentVideoSend,_=f.type,m=f.startTime,g={event_type:"sent_end",media_type:e,is_screen:!(null===(d=this._stream)||void 0===d||!d.isScreen),start:m,result:!0,event_session_id:this._videoEventSessionId,type:_,vendor_mode:(null===(l=this._stream)||void 0===l?void 0:l.vendorCode)||0,pc_session_id:(null===(h=this._stream)||void 0===h?void 0:h.pcSessionId)||(null===(p=this._handler)||void 0===p?void 0:p.peerConnectionId)};delete this._currentVideoSend,this._firstVideoFrameTimer&&window.clearTimeout(this._firstVideoFrameTimer),TG.print("rtcFirstFrameSend",Mm(g)),null===(v=this._monitor)||void 0===v||v.report("rtc_first_frame",g),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("video","login"),null!==(r=this._stream)&&void 0!==r&&r.audioTrack&&this.beginSendFrame("audio","login");!e&&this._audioSending&&this.stopSendFrame("audio","leave_room"),!e&&this._videoSending&&this.stopSendFrame("video","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("video","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("audio","publish");!e&&this._audioSending&&this.stopSendFrame("audio","unpublish"),!e&&this._videoSending&&this.stopSendFrame("video","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("audio","unmute"),!e&&this._audioSending&&this.stopSendFrame("audio","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("audio","enable"),!e&&this._audioSending&&this.stopSendFrame("audio","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("video","unmute"),!e&&this._videoSending&&this.stopSendFrame("video","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("video","enable"),!e&&this._videoSending&&this.stopSendFrame("video","disable"))}},{key:"setExternalAudioSource",value:function(e){this._audioExternal!==e&&(this._audioExternal=e,e&&(this._audioSending&&this.stopSendFrame("audio","disable"),this._enableAudio=!1),e||(this._audioSending&&this.stopSendFrame("audio","stop_push"),this._pushAudio=!1))}},{key:"setPushAudio",value:function(e){this._pushAudio!==e&&(this._pushAudio=e,e&&this.beginSendFrame("audio","push"),!e&&this._audioSending&&this.stopSendFrame("audio","stop_push"))}},{key:"setExternalVideoSource",value:function(e){this._videoExternal!==e&&(this._videoExternal=e,e&&(this._videoSending&&this.stopSendFrame("video","disable"),this._enableVideo=!1),e||(this._videoSending&&this.stopSendFrame("video","stop_push"),this._pushVideo=!1))}},{key:"setPushVideo",value:function(e){this._pushVideo!==e&&(this._pushVideo=e,e&&this.beginSendFrame("video","push"),!e&&this._videoSending&&this.stopSendFrame("video","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("audio","audience"),!e&&this._videoSending&&this.stopSendFrame("video","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=Tm(Em().mark((function e(){var t,r,n,i,o,a,s,c;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=6;break}return e.next=3,fL(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,c=Gs(s).call(s,(function(e){return"outbound-rtp"===e.type})),e.abrupt("return",c);case 6:case"end":return e.stop()}}),e,this)}))),function(){return r.apply(this,arguments)})},{key:"_getFirstAudioFrameStats",value:(t=Tm(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,fL(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",mE(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(Tm(Em().mark((function n(){var i,o,a;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,o=0,a=0,null==i||Fm(i).call(i,(function(e){o+=e.framesSent,a+=e.packetsSent})),!(i&&i.length>0&&(o>t||a>r))){n.next=12;break}if(-1!==t||-1!==r){n.next=10;break}return t=o,r=a,n.abrupt("return");case 10:e.sendFrameFinish("video"),window.clearInterval(e._firstVideoFrameInterval);case 12: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(Tm(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("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:"login"},this._currentVideoSend={startTime:0,eventSessionId:0,type:"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}(),AG=(Qd(bG={},"audio",{delay:1200,stallRadio:.3}),Qd(bG,"video",{delay:1200,stallRadio:.6}),Qd(bG,"screen_audio",{delay:1600,stallRadio:.8}),Qd(bG,"screen_video",{delay:1600,stallRadio:.8}),bG),RG=function(){function e(){Ll(this,e),Qd(this,"_preUplinkStats",new JS),Qd(this,"_preDownlinkStats",new JS),Qd(this,"_timer",void 0),Qd(this,"_delayTimer",void 0),Qd(this,"_connectionState",_G.CONNECTED),Qd(this,"reportor",void 0)}return Nl(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,bm(i=wm(o=[]).call(o,Yk(l),[d])).call(i,-2))}if(r.sentKBitrate>0&&r.rtt){var h,p,v=n?"screen_video":"video",f=r._fractionLost,_=r.rtt,m=r._sendBandWidth,g=r._retransmittedRate;0===m&&(f=Math.max(.65,f));var y=this._getQosLevel(_,f||0,g||0),S=this._preUplinkStats.get(v)||[y];this._preUplinkStats.set(v,bm(h=wm(p=[]).call(p,Yk(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=yl.VBAD;else{var l=s.rtt,h=s.audioLossRate,p=s.stallDuration,v=s.statsInterval,f=s.e2eDelay,_=p/v,m=u?"screen_audio":"audio",g=this._getQosLevel(l,h||0,c._retransmittedRate||0),y=this._getDownlinkQoE(m,_,f);r=this._getNetworkQuality(g,y)}if(a)if(0===c.receivedKBitrate||0===c.rtt)n=yl.VBAD;else{var S=c.rtt,b=c.videoLossRate,E=c.stallDuration,k=c.statsInterval,T=c.e2eDelay,I=c._retransmittedRate,A=E/k,R=u?"screen_video":"video",C=this._getQosLevel(S,b||0,I||0),w=this._getDownlinkQoE(R,A,T);n=this._getNetworkQuality(C,w)}var x=r&&n?Math.ceil((r+n)/2):r||n;if(x){var O,P,M,D=wm(O="".concat(d)).call(O,u?"_screen":""),N=this._preDownlinkStats.get(D)||[x];this._preDownlinkStats.set(D,bm(P=wm(M=[]).call(M,Yk(N),[x])).call(P,-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!==_G.CONNECTED)e=t=yl.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")||yl.EXCELLENT;var c=Gs(n=Fm(i=Xk(eO(o=this._preDownlinkStats).call(o))).call(i,(function(e){return r._getBetterQualityAndRemoveOldest(e,"down")}))).call(n,(function(e){return e}));t=Math.ceil(lb(c).call(c,(function(e,t){return t+e}),0)/c.length)||yl.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=AG[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=yl.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,Yk(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&&pP(t)&&r.localaudio&&r.audiostream,videoActive:n&&vP(t)&&r.localvideo&&r.videostream}}}]),e}(),CG=function(){function e(t){Ll(this,e),Qd(this,"_timer",void 0),Qd(this,"_remoteVideoSizeCache",{}),Qd(this,"_remoteScreenSizeCache",{}),Qd(this,"onchange",void 0),this._room=t,this._start()}return Nl(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,p=a.getSettings(),v=p.width,f=void 0===v?0:v,_=p.height,m=void 0===_?0:_;h===m&&d===f||"function"==typeof e.onchange&&e.onchange(i,n.isScreen,f,m),delete s[i],(n.isScreen?r:t)[i]={width:f,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}(),wG=Xk((new TextEncoder).encode("subt")),xG={1:dR.SUBTITLE_ERR_POSTPROCESS,2:dR.SUBTITLE_ERR_CONNECTION_ERROR,3:dR.SUBTITLE_ERR_PROCESS_ERROR},OG=new cO("SubtitleTool",1),PG=function(e){if(e.extraInfo)try{var t,r=JSON.parse(e.extraInfo);r.source_language&&CE(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))||"";CE(i=["zh","en","ja"]).call(i,o)>-1&&(e.extraInfo=Mm({source_language:o}))}},MG=function(){function e(t){var r,n,i;Ll(this,e),Qd(this,"_taskId",void 0),Qd(this,"_appId",void 0),Qd(this,"_roomId",void 0),Qd(this,"_userId",void 0),Qd(this,"onEvent",void 0),Qd(this,"onMessage",void 0),Qd(this,"_preConfig",void 0),Qd(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 Nl(e,[{key:"start",value:(n=Tm(Em().mark((function e(t){var r=this;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(OG.print("start","Invoke config: %o",t),mM(t.mode,"mode",[Al.ASR_ONLY,Al.ASR_AND_TRANSLATION]),t.mode!==Al.ASR_AND_TRANSLATION||-1!==CE(NG).call(NG,t.targetLanguage||"")){e.next=4;break}throw new hR(dR.INVALID_PARAMS,"Invalid targetLanguage.");case 4:if(!this._taskId){e.next=6;break}throw new hR(dR.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:Rl.ERROR,errorCode:dR.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=Tm(Em().mark((function e(t){var r;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(mM(t.mode,"mode",[Al.ASR_ONLY,Al.ASR_AND_TRANSLATION]),t.mode!==Al.ASR_AND_TRANSLATION||-1!==CE(NG).call(NG,t.targetLanguage||"")){e.next=3;break}throw new hR(dR.INVALID_PARAMS,"Invalid targetLanguage.");case 3:if(!this._taskId){e.next=5;break}throw new hR(dR.SUBTITLE_ALREADY_ON,"Already started subtitle");case 5:if(this._taskId){e.next=7;break}throw new hR(dR.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;OG.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:Rl.STOPPED}),e._clearTimer()}))}},{key:"reconnect",value:(t=Tm(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(){OG.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 hR(xG[r]||dR.SUBTITLE_ERR_UNKNOWN,n||"");null===(o=this.onEvent)||void 0===o||o.call(this,{event:Rl.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:Rl.STARTED}),this._clearTimer()}}},{key:"onMessageRecv",value:function(e){if(this._taskId&&this._preConfig){var t=DG(e);if(t&&t.length>0){var r,n=this._preConfig,i=n.mode,o=n.targetLanguage,a=[];if(t.forEach((function(e){i===Al.ASR_ONLY?e.mode===i&&a.push(e):i===Al.ASR_AND_TRANSLATION&&(e.language!==o&&e.mode!==Al.ASR_ONLY||a.push(e),e.mode===Al.ASR_ONLY&&e.language===o&&a.push(Zd(Zd({},e),{},{mode:Al.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}(),DG=function(e){var t=e.message;if(t instanceof ArrayBuffer&&t.byteLength>8)try{var r=new DataView(t,0),n=0;if(wG.every((function(e){return r.getUint8(n++)===e}))){var i=r.getUint32(n);if(n+=4,i===r.byteLength-8){var o=ZO.ab2str(bm(t).call(t,8)),a=JSON.parse(o),s=a.data;if("subtitle"===a.type)return s}}}catch(c){}return!1},NG=["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"],LG=new cO("Room",1),UG={audiostream:!0,extaudio:!1,extvideo:!1,localaudio:!0,localvideo:!1,videoDescriptions:[],videostream:!1,publishTime:0},VG=function(e){OI(A,e);var t,r,n,i,o,a,s,c,u,d,l,h,p,v,f,_,m,g,y,S,b,E,k,T,I=YI(A);function A(e,t){var r;return Ll(this,A),Qd($T(r=I.call(this)),"id",void 0),Qd($T(r),"_mediaServerClient",void 0),Qd($T(r),"_localStream",void 0),Qd($T(r),"_localScreenStream",void 0),Qd($T(r),"_remoteUsers",new JS),Qd($T(r),"_remoteStreams",new JS),Qd($T(r),"_remoteStreamStreamIdUserIdMap",{}),Qd($T(r),"_virtualStreams",[]),Qd($T(r),"_joinResolveCallback",void 0),Qd($T(r),"_joinRejectCallback",void 0),Qd($T(r),"_getAccessNode",void 0),Qd($T(r),"_getAccessFeedback",void 0),Qd($T(r),"_getAccessFeedbackIceNode",void 0),Qd($T(r),"_reconnectTimer",void 0),Qd($T(r),"_isReconnecting",void 0),Qd($T(r),"_context",void 0),Qd($T(r),"_sessionId",void 0),Qd($T(r),"_reconnectRecord",void 0),Qd($T(r),"_connectionLostTimer",void 0),Qd($T(r),"_liveControlMessage",void 0),Qd($T(r),"_serverConfig",void 0),Qd($T(r),"_liveTranscodingOnceSucc",!1),Qd($T(r),"_roomConfig",void 0),Qd($T(r),"_roomInfo",void 0),Qd($T(r),"_userDuplicateLoginTimerMap",new JS),Qd($T(r),"_networkQualityManager",void 0),Qd($T(r),"_videoSizeObserver",void 0),Qd($T(r),"_hasPublished",!1),Qd($T(r),"_subtitleTool",void 0),Qd($T(r),"_csrcUserIdMap",void 0),Qd($T(r),"_publishOnDemandItem",void 0),Qd($T(r),"_publishOnDemandBusy",!1),Qd($T(r),"_monitor",void 0),r.id=t.id,r._roomConfig=e,r._mediaServerClient=new gG(t),r._reconnectRecord=new FG,r._addHandlerEventHandler(),r._isReconnecting=!1,r._networkQualityManager=new RG,r._networkQualityManager.reportor=r._reportNetworkQuality.bind($T(r)),r._videoSizeObserver=new CG($T(r)),r._videoSizeObserver.onchange=r._emitVideoSizeChange.bind($T(r)),r._context=t,r._csrcUserIdMap={},r._monitor=kO(r.id),r}return Nl(A,[{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:"roomConfig",set:function(e){this._roomConfig=e}},{key:"_addHandlerEventHandler",value:function(){var e,t,r,n,i,o,a,s,c,u,d,l,h,p,v,f,_,m,g,y,S,b,E,k,T,I,A,R,C,w,x,O,P,M=this;null===(e=this._mediaServerClient)||void 0===e||e.on($M.ON_ADD_STREAM,this._onAddStream.bind(this)),null===(t=this._mediaServerClient)||void 0===t||t.on($M.ON_ADD_STREAM_LIST,(function(e){Array.isArray(null==e?void 0:e.streamList)&&e.streamList.forEach((function(e){return M._onAddStream(e)}))})),null===(r=this._mediaServerClient)||void 0===r||r.on($M.ON_REMOVE_STREAM,this._onRemoveStream.bind(this)),null===(n=this._mediaServerClient)||void 0===n||n.on($M.ON_REMOVE_STREAM_LIST,(function(e){Array.isArray(null==e?void 0:e.streamList)&&e.streamList.forEach((function(e){return M._onRemoveStream(e)}))})),null===(i=this._mediaServerClient)||void 0===i||i.on($M.USER_CONNECTION,this._onUserConnection.bind(this)),null===(o=this._mediaServerClient)||void 0===o||o.on($M.USER_CONNECTION_LIST,(function(e){Array.isArray(null==e?void 0:e.userList)&&e.userList.forEach((function(e){return M._onUserConnection(e)}))})),null===(a=this._mediaServerClient)||void 0===a||a.on($M.USER_DISCONNECTION,this._onUserDisconnection.bind(this)),null===(s=this._mediaServerClient)||void 0===s||s.on($M.USER_DISCONNECTION_LIST,(function(e){Array.isArray(null==e?void 0:e.userList)&&e.userList.forEach((function(e){return M._onUserDisconnection(e)}))})),null===(c=this._mediaServerClient)||void 0===c||c.on($M.ON_UPDATE_ROOM_ATTRIBUTES,this._onUpdateRoomAttributes.bind(this)),null===(u=this._mediaServerClient)||void 0===u||u.on($M.ON_UPDATE_USER_ATTRIBUTES,this._onUpdateUserAttributes.bind(this)),null===(d=this._mediaServerClient)||void 0===d||d.on($M.ON_UPDATE_STREAM_ATTRIBUTES,this._onUpdateStreamAttributes.bind(this)),null===(l=this._mediaServerClient)||void 0===l||l.on($M.ON_PUSH_TRACK,this._onPushTrack.bind(this)),null===(h=this._mediaServerClient)||void 0===h||h.on($M.ON_REMOVE_TRACK,this._onRemoveTrack.bind(this)),null===(p=this._mediaServerClient)||void 0===p||p.on($M.NODE_CHANGE,this._nodeChange.bind(this)),null===(v=this._mediaServerClient)||void 0===v||v.on($M.ON_CUSTOM_MESSAGE,this._onCustomMessage.bind(this)),null===(f=this._mediaServerClient)||void 0===f||f.on($M.USER_MESSAGE_RECEIVED,this._onUserMessageReceived.bind(this)),null===(_=this._mediaServerClient)||void 0===_||_.on($M.USER_BINARY_MESSAGE_RECEIVED,this._onUserBinaryMessageReceived.bind(this)),null===(m=this._mediaServerClient)||void 0===m||m.on($M.POST_PROCESSING_MESSAGE,this._onPostProcessingMessage.bind(this)),null===(g=this._mediaServerClient)||void 0===g||g.on($M.ON_USER_TOKEN_WILL_EXPIRE,this._onUserTokenWillExpire.bind(this)),null===(y=this._mediaServerClient)||void 0===y||y.on($M.STREAM_CONTROL_MESSAGE,this._onStreamControlMessage.bind(this)),null===(S=this._mediaServerClient)||void 0===S||S.on($M.ON_STREAM_FAILED,this._onStreamFailed.bind(this)),null===(b=this._mediaServerClient)||void 0===b||b.on(eD.RSCP,(function(e){!!mE(e).call(e,(function(e){var t,r,n;return null==e||null===(t=e.StreamIds)||void 0===t?void 0:fk(t).call(t,null===(r=M._localStream)||void 0===r||null===(n=r.stream)||void 0===n?void 0:n.id)}))&&(M._publishOnDemandItem=e,M._onPublishOnDemand())})),null===(E=this._mediaServerClient)||void 0===E||E.on(eD.RTT,this._onRTT.bind(this)),null===(k=this._mediaServerClient)||void 0===k||k.on(eD.SSC,this._onSSC.bind(this)),null===(T=this._mediaServerClient)||void 0===T||T.on(tD.ON_CONNECTION_STATE_CHANGE,this._onConnectionStateChange.bind(this)),null===(I=this._mediaServerClient)||void 0===I||I.on(tD.ON_VENDOR_CONNECTION_STATE_CHANGE,(function(e){return M.emit(tD.ON_VENDOR_CONNECTION_STATE_CHANGE,e)})),null===(A=this._mediaServerClient)||void 0===A||A.on(tD.ABNORMAL_DISCONNECTION,this._handleAbnormalDisconnection.bind(this)),null===(R=this._mediaServerClient)||void 0===R||R.on($M.ON_SPEAKER_CHANGE,this._onMeetingSpeakerChange.bind(this)),null===(C=this._mediaServerClient)||void 0===C||C.on("onRemoteStreamStats",(function(e){M._networkQualityManager.updateDownlinkStats(e,M._findRemoteStreamByScreen(e.userId,e.isScreen)),M.emit(iG.ON_REMOTE_STREAM_STATS,fP(e))})),null===(w=this._mediaServerClient)||void 0===w||w.on("onLocalStreamStats",(function(e){M._networkQualityManager.updateUplinkStats(e),M.emit(iG.ON_LOCAL_STREAM_STATS,fP(e))})),null===(x=this._mediaServerClient)||void 0===x||x.on("prevIceNode",(function(e){M._getAccessFeedbackIceNode=e})),null===(O=this._mediaServerClient)||void 0===O||O.on(iG.RESUBSCRIBE,(function(e){M.emit(iG.RESUBSCRIBE,e)})),null===(P=this._mediaServerClient)||void 0===P||P.on($M.ON_NOTIFY_RECONNECT,this._notifyReconnect.bind(this))}},{key:"_removeHandlerEventHandler",value:function(){var e;null===(e=this._mediaServerClient)||void 0===e||e.removeAllListeners()}},{key:"connect",value:(T=Tm(Em().mark((function e(t){return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._mediaServerClient.connect(t);case 2:case"end":return e.stop()}}),e,this)}))),function(e){return T.apply(this,arguments)})},{key:"join",value:(k=Tm(Em().mark((function e(t,r,n,i,o,a,s){var c,u=this;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return null===(c=this._monitor)||void 0===c||c.set({rtc_app_id:t,room_id:r,user_id:i.userId}),LG.print("join()"),e.abrupt("return",new q_((function(e,c){var d,l,h,p=QO();u._joinResolveCallback=function(t){var r,n;null===(r=u._monitor)||void 0===r||r.report("join_room",{type:"end",start:p,result:!0,reason:""},{enable_cloud_proxy:null===(n=u._roomInfo)||void 0===n?void 0:n.useCloudProxy}),u._initSubtitleTool(),e(t)},u._joinRejectCallback=function(e){var t,r;Array.isArray(e)&&e.length&&(e=e[0]),null===(t=u._monitor)||void 0===t||t.report("join_room",{type:"end",start:p,result:!1,reason:e.message},{enable_cloud_proxy:null===(r=u._roomInfo)||void 0===r?void 0:r.useCloudProxy}),c(e)},u._liveControlMessage=o,u._roomInfo={appId:t,roomId:r,token:n,userInfo:i,useCloudProxy:a,roomProfile:u._roomConfig.roomProfileType,expectedIDC:s},u.setSessionId(),null===(d=u._monitor)||void 0===d||d.report("join_room",{type:"begin",start:p,result:!1,reason:""},{enable_cloud_proxy:null===(l=u._roomInfo)||void 0===l?void 0:l.useCloudProxy,expectedIDC:null===(h=u._roomInfo)||void 0===h?void 0:h.expectedIDC}),u._join(u._joinResolveCallback,u._joinRejectCallback,!1)})));case 3:case"end":return e.stop()}}),e,this)}))),function(e,t,r,n,i,o,a){return k.apply(this,arguments)})},{key:"_join",value:(E=Tm(Em().mark((function e(t,r){var n,i,o,a,s,c,u,d,l=arguments;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=l.length>2&&void 0!==l[2]&&l[2],i=QO(),LG.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:d=e.sent,this._mediaServerClient.roomAttributes=d.roomAttributes,null!==(o=d.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:d.clients,streams:d.streams}),this._isReconnecting=!1,null===(a=this._monitor)||void 0===a||a.set({rtc_vid:(null===(s=this._getAccessFeedbackIceNode)||void 0===s||null===(c=s.iceConfig)||void 0===c?void 0:c._abtest_vid)||""}),null===(u=this._monitor)||void 0===u||u.report("rtc_join_room",{error_code:0,deviceModel:"web",deviceManufacturer:"web",elapse:QO()-i}),this._onJoinSucc(d,n),e.next=27;break;case 21:if(e.prev=21,e.t0=e.catch(3),this._getAccessFeedback=void 0,this._getAccessNode=void 0,e.t0.code===dR.OPERATION_CANCEL||"function"!=typeof r){e.next=27;break}return e.abrupt("return",r(e.t0));case 27:case"end":return e.stop()}}),e,this,[[3,21]])}))),function(e,t){return E.apply(this,arguments)})},{key:"publishScreen",value:(b=Tm(Em().mark((function e(t,r,n,i,o){var a,s,c,u,d,l,h,p,v,f,_,m;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(LG.print("publishScreen()"),this._localScreenStream||(this._localScreenStream=new nF(this.id),null!==(a=this._mediaServerClient)&&void 0!==a&&null!==(s=a.vendorConfig)&&void 0!==s&&s.enableMultiVendor&&(this._localScreenStream.pcSessionId=nC()),this._localScreenStream.isScreen=!0,this._mediaServerClient.handler&&(this._localScreenStream.observer=new IG(this._localScreenStream,this._mediaServerClient.handler))),c=!1,u=!1,d=!1,l=!1,!this._localScreenStream.videoTrack&&r?(r instanceof lV&&(u=!0),c=!0):this._localScreenStream.videoTrack&&!r&&(c=!1),!this._localScreenStream.audioTrack&&n?(n instanceof hV&&(l=!0),d=!0):this._localScreenStream.audioTrack&&!n&&(d=!1),this._localScreenStream.videoTrack=r,this._localScreenStream.audioTrack=n,this._localScreenStream.videoEncodeConfig=t,i&&(pP(i)&&(this._localScreenStream.pubAudio=o===aG.PUB),vP(i)&&(this._localScreenStream.pubVideo=o===aG.PUB),LG.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===(h=this._localScreenStream)||void 0===h||!h.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===(p=this._localScreenStream.observer)||void 0===p||p.setPublish(!0),e.next=22,this._mediaServerClient.publish(this._localScreenStream);case 22:e.next=28;break;case 24:return u?null===(v=this._localScreenStream.observer)||void 0===v||v.setPushVideo(c):null===(f=this._localScreenStream.observer)||void 0===f||f.setEnableVideo(c),l?null===(_=this._localScreenStream.observer)||void 0===_||_.setPushAudio(d):null===(m=this._localScreenStream.observer)||void 0===m||m.setEnableAudio(d),e.next=28,this.updatePubScreenTrack();case 28:case"end":return e.stop()}}),e,this)}))),function(e,t,r,n,i){return b.apply(this,arguments)})},{key:"updatePubScreenTrack",value:(S=Tm(Em().mark((function e(){return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(LG.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=Tm(Em().mark((function e(){var t;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(LG.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=Tm(Em().mark((function e(t){var r,n=this;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return LG.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=Tm(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:(_=Tm(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:(f=Tm(Em().mark((function e(t){return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return LG.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 f.apply(this,arguments)})},{key:"publish",value:(v=Tm(Em().mark((function e(t,r,n,i,o,a){var s,c,u,d,l,h,p,v,f,_,m,g,y,S,b,E=arguments;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(s=E.length>6&&void 0!==E[6]&&E[6],LG.print("publish","Invoke publish"),c=!1,this._localStream||(this._localStream=new nF(this.id),null!==(u=this._mediaServerClient)&&void 0!==u&&null!==(d=u.vendorConfig)&&void 0!==d&&d.enableMultiVendor&&(this._localStream.pcSessionId=nC()),this._mediaServerClient.handler&&(this._localStream.observer=new IG(this._localStream,this._mediaServerClient.handler)),c=!0,this._localStream.vendorCode=(null===(l=this._mediaServerClient.vendorConfig)||void 0===l?void 0:l.vendorCode)||0),this._localStream.videoTrack=n,this._localStream.audioTrack=i,this._localStream.videoEncodeConfig=t,this._localStream.enableSimulcast=r,o&&(pP(o)&&(this._localStream.pubAudio=a===aG.PUB),vP(o)&&(this._localStream.pubVideo=a===aG.PUB),LG.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===(h=this._localStream.observer)||void 0===h||h.setLogin(!0):c&&(p=!!this._localStream.videoTrack,v=!!this._localStream.audioTrack,f=this._localStream.videoTrack instanceof lV,_=this._localStream.audioTrack instanceof hV,this._roomConfig.isAutoPublish&&!this._hasPublished?(p&&(f?null===(m=this._localStream.observer)||void 0===m||m.setPushVideo(!0):null===(g=this._localStream.observer)||void 0===g||g.setEnableVideo(!0)),v&&(_?null===(y=this._localStream.observer)||void 0===y||y.setPushAudio(!0):null===(S=this._localStream.observer)||void 0===S||S.setEnableAudio(!0))):null===(b=this._localStream.observer)||void 0===b||b.setPublish(!0)),e.next=16,this._mediaServerClient.publish(this._localStream);case 16:this._hasPublished=!0,this.emit(iG.ON_PUBLISH_RESULT,{isScreen:!1,state:ol.PUBLISH_SUCC}),e.next=24;break;case 20:throw e.prev=20,e.t0=e.catch(12),this.emit(iG.ON_PUBLISH_RESULT,{isScreen:!1,state:ol.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 v.apply(this,arguments)})},{key:"updatePubTrack",value:(p=Tm(Em().mark((function e(){return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(LG.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 p.apply(this,arguments)})},{key:"unpublish",value:(h=Tm(Em().mark((function e(){return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(LG.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=Tm(Em().mark((function e(t,r,n){var i;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return LG.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=Tm(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(LG.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=Tm(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,p=0;p<(null==d?void 0:d.length);p++){var v,f;if(h>=(null===(v=d[p])||void 0===v?void 0:v.width)*(null===(f=d[p])||void 0===f?void 0:f.height)){l=p;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=Tm(Em().mark((function e(t,r){return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return LG.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=Tm(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 hR(dR.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=Tm(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=Tm(Em().mark((function e(){var t,r,n,i,o,a,s,c,u,d,l,h=arguments;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:r=h.length>0&&void 0!==h[0]&&h[0],LG.print("leave","Invoke leave"),n=QO(),null===(t=this._subtitleTool)||void 0===t||t.destroy(),delete this._subtitleTool,e.prev=5,this._mediaServerClient.connectionState!==_G.CONNECTED&&this._joinRejectCallback&&this._joinRejectCallback(new Error("leave_room")),clearTimeout(this._reconnectTimer),s=JT(rA(a=this._remoteStreams).call(a));try{for(s.s();!(c=s.n()).done;)u=c.value,Array.isArray(u)&&u.forEach((function(e){var t;null===(t=e.observer)||void 0===t||t.setLogin(!1)}))}catch(p){s.e(p)}finally{s.f()}return this._localStream&&(null===(d=this._localStream.observer)||void 0===d||d.setLogin(!1)),e.next=13,this._mediaServerClient.leave();case 13:this.destroy(),null===(i=this._monitor)||void 0===i||i.report("rtc_leave_room",{error_code:0,message:"",elapse:QO()-n}),null===(o=this._monitor)||void 0===o||o.set({room_id:"",user_id:"",rtc_session_id:"",rtc_vid:""}),e.next=26;break;case 18:if(e.prev=18,e.t0=e.catch(5),!r){e.next=24;break}throw e.t0;case 24:this.destroy();case 25:e.t0 instanceof Error&&(null===(l=this._monitor)||void 0===l||l.report("rtc_leave_room",{error_code:-1,message:e.t0.message,elapse:QO()-n}));case 26:case"end":return e.stop()}}),e,this,[[5,18]])}))),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(t){var n=(r._context||{}).userPriority;t.hasSubscribed&&null!=n&&n.has(e)&&r._mediaServerClient.updateSubPriority(t,n.get(e))}))}},{key:"destroy",value:function(){var e;LG.print("destroy","Invoke destroy"),AO(this.id,"room_destroy","".concat((new Error).stack)),null===(e=this._subtitleTool)||void 0===e||e.destroy(),delete this._subtitleTool,this._destroyAndInitMediaServerClient(),this._roomInfo=void 0,this._remoteUsers=new JS;var t,r,n,i=JT(this._remoteStreams);try{for(i.s();!(t=i.n()).done;){var o=ZT(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 JS,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._reconnectRecord=new FG,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=Tm(Em().mark((function e(t){return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return LG.print("updateToken","Invoke updateToken"),this._roomInfo&&(this._roomInfo.token=t),e.prev=2,e.next=5,this._mediaServerClient.updateToken(t);case 5:e.next=11;break;case 7:throw e.prev=7,e.t0=e.catch(2),this.safeEmit(iG.ON_ROOM_ERROR,{errorCode:dR.UPDATE_TOKEN_WITH_INVALID_TOKEN}),e.t0;case 11:case"end":return e.stop()}}),e,this,[[2,7]])}))),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(){var e;this._sessionId=tC(),null===(e=this._monitor)||void 0===e||e.set({rtc_session_id:this._sessionId})}},{key:"sendRoomMessage",value:(n=Tm(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,ZO.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(){LG.print("_destroyAndInitMediaServerClient()"),this._mediaServerClient&&(this._mediaServerClient.destroy(),this._removeHandlerEventHandler()),this._mediaServerClient=new gG(this._context),this._addHandlerEventHandler()}},{key:"_onJoinSucc",value:function(e,t){var r,n,i,o=this;LG.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(iG.ON_VIDEO_STREAM_BANNED,{uid:t.clientId,banned:1===t.attributes.serverMuteVideo}),t.attributes.serverMuteAudio&&o.safeEmit(iG.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=JT(rA(n=this._remoteUsers).call(n));try{for(h.s();!(l=h.n()).done;){var p=l.value;p._stillExist||s.push({clientId:p.userId}),delete p._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 v,f=JT(rA(i=this._remoteStreams).call(i));try{for(f.s();!(v=f.n()).done;){var _=v.value;Array.isArray(_)&&_.forEach((function(e){e.stillExist?delete e.stillExist:c.push({clientId:e.userId,streamId:e.streamId,message:JM.clientDisconnected})}))}}catch(m){f.e(m)}finally{f.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,n,i,o=this;this._localStream&&(this._localStream.clean(),this._localStream.vendorCode=(null===(r=this._mediaServerClient.vendorConfig)||void 0===r?void 0:r.vendorCode)||0,null===(n=this._localStream.observer)||void 0===n||n.setLogin(!0),this._mediaServerClient.publish(this._localStream).catch((function(e){})));this._localScreenStream&&(this._localScreenStream.clean(),null===(i=this._localScreenStream.observer)||void 0===i||i.setLogin(!0),this._mediaServerClient.publish(this._localScreenStream).catch((function(e){})));var a,s=JT(rA(t=this._remoteStreams).call(t));try{for(s.s();!(a=s.n()).done;){var c=a.value;Array.isArray(c)&&c.forEach(function(){var e=Tm(Em().mark((function e(t){var r,n,i,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,LG.print(wm(r="start resubscribe ".concat(t.userId," with ")).call(r,t.subMediaType)),e.next=6,o._mediaServerClient.subscribe(t,t.subMediaType);case 6:LG.print(wm(n="success resubscribe ".concat(t.userId," with ")).call(n,t.subMediaType)),o.safeEmit(iG.RESUBSCRIBE,{stream:t}),e.next=15;break;case 10:e.prev=10,e.t0=e.catch(2),LG.print(wm(i=wm(a="failed resubscribe ".concat(t.userId," with ")).call(a,t.subMediaType,", error:")).call(i,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(u){s.e(u)}finally{s.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=mE(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 iF(this.id,"ff-stream","ff-stream",!1,!1,UG);s.virtual=!0,s.audioTransceiver=a,s.audioMid="0",s.audioTrack=RV(i),this._virtualStreams.push(s),this.safeEmit(iG.SUBSCRIBE_PUSH_TRACK,{stream:s})}}}},{key:"_findRemoteStream",value:function(e,t){var r=this._remoteStreams.get(e);return Array.isArray(r)?mE(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)?mE(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 p,v=null===(p=this._remoteStreams.get(e.clientId))||void 0===p?void 0:Gs(p).call(p,(function(e){return e.streamId!==h.streamId}));h.clean(),this._remoteStreams.set(e.clientId,v||[])}var f=this._findRemoteStream(e.clientId,e.streamId);if(this._remoteStreamStreamIdUserIdMap[e.streamId]=e.clientId,f)f.attributes=e.attributes;else if((f=new iF(this.id,e.clientId,e.streamId,e.screen,!1,e.attributes)).virtual=c,this._initStreamListeners(f),!c){var _=this._remoteStreams.get(e.clientId);_?_.push(f):this._remoteStreams.set(e.clientId,[f])}if(this._mediaServerClient.handler&&(f.observer=new kG(f,this._mediaServerClient.handler)),!f.isScreen&&l){var m,g,y,S,b,E,k,T;if(a&&f.hasVideo)if(f.attributes.extvideo)null===(m=f.observer)||void 0===m||m.setExternalVideoSource(!0),null===(g=f.observer)||void 0===g||g.setPushVideo(!0);else null===(y=f.observer)||void 0===y||y.setExternalVideoSource(!1),null===(S=f.observer)||void 0===S||S.setPublishVideo(!0);if(a&&f.hasAudio&&d&&!this._mediaServerClient.roomAttributes.multiChatMode)if(f.attributes.extaudio)null===(b=f.observer)||void 0===b||b.setExternalAudioSource(!0),null===(E=f.observer)||void 0===E||E.setPushAudio(!0);else null===(k=f.observer)||void 0===k||k.setExternalAudioSource(!1),null===(T=f.observer)||void 0===T||T.setPublishAudio(!0);if(!0===i&&!1===a){var I,A=this._roomConfig,R=A.isAutoSubscribeAudio,C=A.isAutoSubscribeVideo;null===(I=f.observer)||void 0===I||I.setLogin(!0,{audio:!!R,video:!!C})}}return i&&this.safeEmit($M.ON_ADD_STREAM,{stream:f}),f}}},{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,Zd({},n)),this.safeEmit($M.USER_CONNECTION,{userInfo:n}),e.attributes&&(e.attributes.serverMuteVideo&&this.safeEmit(iG.ON_VIDEO_STREAM_BANNED,{uid:e.clientId,banned:1===e.attributes.serverMuteVideo}),e.attributes.serverMuteAudio&&this.safeEmit(iG.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===rD.kickedByAdmin?a=dR.KICKED_OUT:i===rD.onUserTokenDidExpire?a=dR.TOKEN_EXPIRED:i===rD.userDuplicateLogin&&(a=dR.DUPLICATE_LOGIN),o===nD.roomDismissByAdmin&&(a=dR.ROOM_DISMISS),a&&this.safeEmit(iG.ON_ROOM_ERROR,{errorCode:a})}else{var s=tl.DROPPED;i===rD.userLeave?s=tl.QUIT:i===rD.kickedByAdmin?s=tl.KICKED_BY_ADMIN:i===rD.roleChanged&&(s=tl.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:JM.clientDisconnected})})),r._remoteStreams.delete(n),r.safeEmit(iG.ON_USER_LEAVE,{userInfo:{userId:n},reason:s})};if(i===rD.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=mE(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($M.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(iG.ON_VIDEO_STREAM_BANNED,{uid:e.clientId,banned:1===e.attributes.serverMuteVideo}),e.attributes.serverMuteAudio&&this.safeEmit(iG.ON_AUDIO_STREAM_BANNED,{uid:e.clientId,banned:1===e.attributes.serverMuteAudio}))}},{key:"_onUpdateRoomAttributes",value:function(e){var t;e.roomAttributes&&(this._mediaServerClient.roomAttributes=Zd(Zd({},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=Zd(Zd({},d),a),h=!1,p=l.localaudio!==d.localaudio,v=!1,f=!1,_=l.localvideo!==d.localvideo,m=!1,g=VV.NONE,y=VV.NONE;if(l.audiostream!==d.audiostream&&(h=l.localaudio,v=!!l.audiostream,l.audiostream?g|=ul.AUDIO:y|=ul.AUDIO),l.videostream!==d.videostream&&(f=l.localvideo,m=!!l.videostream,l.videostream?g|=ul.VIDEO:y|=ul.VIDEO),g&&this.safeEmit(iG.ON_USER_PUBLISH_STATE_CHANGE,{userId:i,mediaType:g,isScreen:s.isScreen,pubState:aG.PUB,remoteStream:s}),y&&this.safeEmit(iG.ON_USER_PUBLISH_STATE_CHANGE,{userId:i,mediaType:y,isScreen:s.isScreen,pubState:aG.UNPUB,remoteStream:s}),s.attributes=l,l.localaudio!==d.localaudio)if(l.localaudio){var S,b,E,k;if(r&&l.audiostream)if(l.extaudio)null===(S=s.observer)||void 0===S||S.setExternalAudioSource(!0),null===(b=s.observer)||void 0===b||b.setPushAudio(!0);else null===(E=s.observer)||void 0===E||E.setExternalAudioSource(!1),null===(k=s.observer)||void 0===k||k.setEnableAudio(!0);this.safeEmit(iG.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(iG.ON_USER_STOP_AUDIO_CAPTURE,{userId:i})}if(l.localvideo!==d.localvideo)if(l.localvideo){var C,w,x,O;if(n&&l.videostream)if(l.extvideo)null===(C=s.observer)||void 0===C||C.setExternalVideoSource(!0),null===(w=s.observer)||void 0===w||w.setPushVideo(!0);else null===(x=s.observer)||void 0===x||x.setExternalVideoSource(!1),null===(O=s.observer)||void 0===O||O.setEnableVideo(!0);this.safeEmit(iG.ON_USER_START_VIDEO_CAPTURE,{userId:i})}else{var P,M,D,N;if(l.extvideo)null===(P=s.observer)||void 0===P||P.setExternalVideoSource(!0),null===(M=s.observer)||void 0===M||M.setPushVideo(!1);else null===(D=s.observer)||void 0===D||D.setExternalVideoSource(!1),null===(N=s.observer)||void 0===N||N.setEnableVideo(!1);!s.isScreen&&this.safeEmit(iG.ON_USER_STOP_VIDEO_CAPTURE,{userId:i})}if(h&&!p)null===(c=s.observer)||void 0===c||c.setRemoteUnmuteAudio(v);if(f&&!_)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&&uR(t).call(t,"audio_mux")){var n=this._onAddStream(Zd(Zd({},e),{},{attributes:UG}),{needEmit:!1,fromSignal:!1,virtual:!0});n&&this._mediaServerClient.subscribe4pushTrack(n,e).then((function(){r.safeEmit(iG.SUBSCRIBE_PUSH_TRACK,{stream:n}),r._virtualStreams.push(n)})).catch((function(e){LG.print("subscribe","push track failed %o",e)}))}else{var i,o;null===(i=this._monitor)||void 0===i||i.report("rtc_error",{message:wm(o="onPushTrack, userId: ".concat(e.clientId,", ")).call(o,e.streamId),error_code:-1001})}}},{key:"_onRemoveTrack",value:function(e){var t,r=e.clientId,n=e.streamId,i=e.message;LG.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=ZT(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&&FA(t).call(t,(function(e,t){return e.audioLevel-t.audioLevel})),t}},{key:"_nodeChange",value:function(e){var t,r,n=e.nodes,i=e.reason;null===(t=this._monitor)||void 0===t||t.report("rtc_node_change",{error_code:0,message:Mm(e),reason:Mm(i)}),nM.clearAccessNode(null===(r=this._roomInfo)||void 0===r?void 0:r.appId),this._destroyAndInitMediaServerClient(),Array.isArray(n)&&n.length?this._getAccessNode=n[0]:this._getAccessFeedback=i,this._joinResolveCallback&&this._joinRejectCallback?this._join(this._joinResolveCallback,this._joinRejectCallback):this._reconnect()}},{key:"_notifyReconnect",value:function(){this._reconnect()}},{key:"_reconnect",value:function(){var e,t,r,n,i=this;this._isReconnecting=!0;var o,a=JT(rA(n=this._remoteStreams).call(n));try{for(a.s();!(o=a.n()).done;){var s=o.value;Array.isArray(s)&&s.forEach((function(e){return e.clean()}))}}catch(c){a.e(c)}finally{a.f()}null===(e=this.localStream)||void 0===e||e.clean(),null===(t=this.localScreenStream)||void 0===t||t.clean(),null===(r=this._monitor)||void 0===r||r.report("rtc_reconnect",{error_code:1002,message:"peerconnection reconnecting",reconnect_id:this._roomInfo.userInfo.userId,reconnect_type:"peerconnection"}),this._liveTranscodingOnceSucc||delete this._liveControlMessage,this._join((function(){var e;null===(e=i._monitor)||void 0===e||e.report("rtc_reconnected",{message:"peerconnection reconnected",reconnect_type:"peerconnection"})}),(function(e){i._reconnectRecord.record(e),i._reconnectRecord.shouldReconnect?(LG.print("Reconnecting error, will reconnect after 3s",e),i._reconnectTimer=window.setTimeout(i._reconnect.bind(i),3e3)):(i.safeEmit(iG.RECONNECT_FAILED),i.destroy())}),!0)}},{key:"_handleAbnormalDisconnection",value:function(){var e,t;LG.print("on ABNORMAL_DISCONNECTION"),null===(e=this.localStream)||void 0===e||e.stopReport(),null===(t=this.remoteStreams)||void 0===t||t.forEach((function(e){return null==e?void 0:e.forEach((function(e){return e.stopReport()}))})),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===_G.DISCONNECTED)t=ll.CONNECTION_STATE_DISCONNECTED;else if(e.next===_G.CONNECTED)clearTimeout(this._connectionLostTimer),t=this._isReconnecting?ll.CONNECTION_STATE_RECONNECTED:ll.CONNECTION_STATE_CONNECTED;else{if(e.next!==_G.CONNECTING)return;t=this._isReconnecting?ll.CONNECTION_STATE_RECONNECTING:ll.CONNECTION_STATE_CONNECTING}e.prev===_G.CONNECTED&&e.next===_G.DISCONNECTED&&(this._connectionLostTimer=window.setTimeout((function(){r.safeEmit(tD.ON_CONNECTION_STATE_CHANGE,{state:ll.CONNECTION_STATE_LOST})}),1e4)),this._networkQualityManager.setConnectionState(e.next),this.safeEmit(tD.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(iG.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?cl.STREAM_INDEX_SCREEN:cl.STREAM_INDEX_MAIN}})}))}},{key:"_onCustomMessage",value:function(e){this.safeEmit($M.ON_CUSTOM_MESSAGE,e)}},{key:"_onUserMessageReceived",value:function(e){this.safeEmit($M.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($M.USER_BINARY_MESSAGE_RECEIVED,r)}},{key:"_initSubtitleTool",value:function(){var e=this;this._subtitleTool=new MG(this),this._subtitleTool.onEvent=function(t){e.emit(iG.ON_SUBTITLE_STATE_CHANGED,t)},this._subtitleTool.onMessage=function(t){e.emit(iG.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=oG.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=oG.START_FAILED);break;case"TranscodeStateChanged":n=0!==t.error?oG.START_FAILED:oG.START_SUCCESS;break;case"TranscodeStopped":n=0!==t.error?oG.STOP_FAILED:oG.STOP_SUCCESS;break;case"TranscodeUpdated":n=0!==t.error?oG.UPDATE_FAILED:oG.UPDATE_SUCCESS}this.safeEmit($M.POST_PROCESSING_MESSAGE,{code:r,protocol:t.protocol,error:t.error,eventType:n,message:i[r]})}this.safeEmit($M.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($M.ON_USER_TOKEN_WILL_EXPIRE,null)}},{key:"_onStreamFailed",value:(r=Tm(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,ul.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(iG.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===ZM.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=Tm(Em().mark((function e(){var t,r,n,i,o,a,s,c,u,d,l,h,p,v;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)&&(v={},LG.print("_onPublishOnDemand exec","usedDescriptions: %o",a),a.forEach((function(e){var t;if(null!=e&&null!==(t=e.StreamIds)&&void 0!==t&&fk(t).call(t,d)){var r=null==e?void 0:e.Metadata.VideoIndex;v[r]=!0}})),h.encodings=Fm(p=h.encodings).call(p,(function(e){if(e.rid){v[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:"_onSSC",value:function(e){var t=e.StreamIds,r=e.Metadata,n=t[0],i=this._remoteStreamStreamIdUserIdMap[n],o=this._findRemoteStream(i,n),a={userId:i,isScreen:!!o&&o.isScreen,beforeVideoIndex:r.ssc_items[0].prev_layer_id,afterVideoIndex:r.ssc_items[0].cur_layer_id,beforeEnable:0!==r.ssc_items[0].prev_video_open,afterEnable:0!==r.ssc_items[0].cur_video_open,reason:r.ssc_items[0].change_reason};this.emit(iG.ON_SIMULCAST_SUBSCRIBE_FALLBACK,a)}},{key:"_reportNetworkQuality",value:function(e,t){this.emit(iG.ON_NETWORK_QUALITY,e,t)}},{key:"_emitVideoSizeChange",value:function(e,t,r,n){var i;this.emit(iG.ON_REMOTE_VIDEO_SIZE_CHANGED,{roomId:null===(i=this.roomInfo)||void 0===i?void 0:i.roomId,userId:e,streamIndex:t?cl.STREAM_INDEX_SCREEN:cl.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()}}]),A}(FM),FG=function(){function e(){Ll(this,e),Qd(this,"_all_201_count",void 0),Qd(this,"_has_4xx",void 0),this._all_201_count=0,this._has_4xx=!1}return Nl(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;Fm(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}(),BG=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&&Ab(r.style,t.style),t.attributes&&bR(t.attributes).forEach((function(e){var t=ZT(e,2),n=t[0],i=t[1];"muted"===n?r.muted=!0:r.setAttribute(n,i)})),r},jG=new cO("Player",0),GG=["play","playing","pause","ended","error","seeking","seeked","waiting","canplay","canplaythrough","durationchange","volumechange","loadedmetadata","loadeddata","loadstart","timeupdate"],HG={playsinline:"","webkit-playsinline":""},zG={playsinline:"","webkit-playsinline":"","x5-playsinline":"","x5-video-player-type":"h5","x-webkit-airplay":"allow",preload:"",muted:""},KG=function(e){OI(n,e);var t,r=YI(n);function n(e,t){var i;Ll(this,n),Qd($T(i=r.call(this)),"_containerDom",void 0),Qd($T(i),"_videoDom",void 0),Qd($T(i),"__cumulativeTime",void 0),Qd($T(i),"userId",void 0),Qd($T(i),"renderMode",void 0),Qd($T(i),"mirrorType",hl.MIRROR_TYPE_NONE),Qd($T(i),"isScreen",void 0),Qd($T(i),"isLocal",void 0),Qd($T(i),"played",!1),Qd($T(i),"_needLoad",!1),Qd($T(i),"_emitPlayFailed",!1),Qd($T(i),"_videoContainer",void 0),Qd($T(i),"_safari15VideoTimer",void 0),Qd($T(i),"_monitor",void 0),Qd($T(i),"emitVideoEvent",(function(e){var t,r,n={type:"video",rawEvent:e,readyState:(null===(t=i._videoDom)||void 0===t?void 0:t.readyState)||0,userId:i.userId,eventName:e.type,currentTime:(null===(r=i._videoDom)||void 0===r?void 0:r.currentTime)||0,isScreen:i.isScreen};switch(i.emit("playback_event",n),e.type){case"canplay":case"loadeddata":i._internalPlay();break;case"playing":jG.print("VideoPlayerPlaying","[userId-".concat(i.userId,"] video element playing"))}})),Qd($T(i),"_internalPlay",(function(){var e;if(null!==(e=i._videoDom)&&void 0!==e&&e.paused){var t=i._videoDom.play();null!=t&&t.then&&t.then((function(){var e;i.isLocal&&PP&&!i._needLoad&&(null===(e=i._videoDom)||void 0===e||e.load(),i._needLoad=!0)})).catch((function(e){var t,r,n,o,a,s;i._emitPlayFailed||("AbortError"!==e.name?(i._emitPlayFailed=!0,null===(t=i._monitor)||void 0===t||t.report("rtc_error",{message:wm(r="video autoplay failed, userId: ".concat(i.userId,", ")).call(r,e.name),error_code:-1e3}),i.emit("playback_event",{type:"video",rawEvent:e,readyState:(null===(n=i._videoDom)||void 0===n?void 0:n.readyState)||0,userId:i.userId,eventName:"autoplay-error",currentTime:(null===(o=i._videoDom)||void 0===o?void 0:o.currentTime)||0,isScreen:i.isScreen})):null===(a=i._monitor)||void 0===a||a.report("rtc_error",{message:wm(s="video autoplay failed, userId: ".concat(i.userId,", ")).call(s,e.name),error_code:-1e3}))}))}})),i.engineId=e;var o=t.renderDom;i._monitor=kO(e);var a=t.userId,s=t.isScreen?sl.RENDER_MODE_FIT:sl.RENDER_MODE_HIDDEN;i.renderMode=void 0!==t.renderMode?t.renderMode:s;var c="string"==typeof o?document.getElementById(o):o;if(!c)throw new hR(dR.CANT_FIND_DOM,"can't find dom");return i._videoContainer=document.createElement("div"),i._videoContainer.style.width="100%",i._videoContainer.style.height="100%",i._videoContainer.style.position="relative",i._videoContainer.style.overflow="hidden",i._containerDom=c,i.userId=a,i.isLocal=!!t.isLocal,i.isScreen=!!t.isScreen,i._initVideo(),i}return Nl(n,[{key:"_initVideo",value:function(){var e;this._videoDom||(this._videoDom=BG("video",{style:{width:"100%",height:"100%"},attributes:zG}),this._videoDom.id=wm(e="".concat(this.userId,"_")).call(e,WO()),this.setRenderMode(this.renderMode),this.mirror(this.mirrorType===hl.MIRROR_TYPE_RENDER));this._videoContainer.appendChild(this._videoDom),this._containerDom.appendChild(this._videoContainer),this._initListeners()}},{key:"_initListeners",value:function(){var e=this;this._videoDom&&GG.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&&GG.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:.55;if(xP){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(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=QO();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=QO()-(e.statsReport.pauseStart||0);i>500&&(e.statsReport.pauseDuration+=i)}}}))}},{key:"setRenderMode",value:function(e){this.renderMode=e,this._videoDom&&(this.renderMode===sl.RENDER_MODE_FIT?this._videoDom.style.objectFit="contain":this.renderMode===sl.RENDER_MODE_FILL?this._videoDom.style.objectFit="fill":this._videoDom.style.objectFit="cover")}},{key:"playVideo",value:(t=Tm(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,jG.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{AO(this.engineId,"playVideo","play video repeatedly",0,this.userId)}catch(sq){}return e.abrupt("return");case 5:o||(this._initVideo(),o=this._videoDom),jG.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&&cM.VIDEO_STALL&&(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:"removeTrack",value:function(){var e,t=null===(e=this._videoDom)||void 0===e?void 0:e.srcObject;if(t){var r=t.getVideoTracks();null!=r&&r.length&&r.forEach((function(e){t.removeTrack(e)}))}}},{key:"manuallyPlay",value:function(){if(jG.print("Invoke VideoPlayer.manuallyPlay",this.userId,this.isScreen),this._emitPlayFailed=!1,!this._videoDom)throw new hR(dR.INVALID_PARAMS,"Player not found");return 0!==this._videoDom.readyState||NP?this._videoDom.play():q_.resolve()}},{key:"mirror",value:function(e){var t;jG.print("mirror",wm(t="".concat(this.userId," set mirror: ")).call(t,e)),this.mirrorType=e?hl.MIRROR_TYPE_RENDER:hl.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;(jG.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];jG.print("destroy","video player: ".concat(this.userId)),this.stop(e),wI(RI(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}(LM.exports.EventEmitter),XG=function(e){OI(i,e);var t,r,n=YI(i);function i(e,t){var r,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{divId:void 0,muted:!1,isScreen:!1},a=o.divId,s=o.muted,c=o.isScreen;if(Ll(this,i),Qd($T(r=n.call(this)),"_containerDom",void 0),Qd($T(r),"_audioDom",void 0),Qd($T(r),"_fakeAudioDom",void 0),Qd($T(r),"userId",void 0),Qd($T(r),"muted",!1),Qd($T(r),"_emitPlayFailed",!1),Qd($T(r),"played",!1),Qd($T(r),"isScreen",void 0),Qd($T(r),"_wechatTimer",void 0),Qd($T(r),"_monitor",void 0),Qd($T(r),"_pasued",!0),Qd($T(r),"emitAudioEvent",(function(e){var t,n,i={type:"audio",rawEvent:e,readyState:(null===(t=r._audioDom)||void 0===t?void 0:t.readyState)||0,userId:r.userId,eventName:e.type,currentTime:(null===(n=r._audioDom)||void 0===n?void 0:n.currentTime)||0};"playing"===e.type&&jG.print("AudioPlayerPlaying","[userId-".concat(r.userId,"] audio element playing")),"pause"===e.type&&(jG.print("AudioPlayerPause","[userId-".concat(r.userId,"] audio element pause")),r._pasued||r._internalPlay()),VP&&NP&&("canplay"===e.type?(clearTimeout(r._wechatTimer),r._wechatTimer=window.setTimeout((function(){r._autoPlayError("wechat")}),500)):"playing"===e.type&&clearTimeout(r._wechatTimer)),r.emit("playback_event",i)})),Qd($T(r),"_internalPlay",(function(){var e,t;if(AO(r.engineId,"_internalPlay",{paused:null===(e=r._audioDom)||void 0===e?void 0:e.paused}),null!==(t=r._audioDom)&&void 0!==t&&t.paused)try{var n,i=r._audioDom.play(),o=QU.getAudioContextInstance();if("suspended"===o.state){var a=o.resume(),s=setTimeout((function(){var e;"suspended"===o.state&&(r._autoPlayError("AudioContext cannot resume"),null===(e=r._monitor)||void 0===e||e.report("rtc_error",{message:"audio autoplay failed, userId: ".concat(r.userId,": Cannot resume the AudioContext - timeout"),error_code:-1e3}));clearTimeout(s)}));a.catch((function(e){var t,n,i;r._autoPlayError("AudioContext cannot resume"),null===(t=r._monitor)||void 0===t||t.report("rtc_error",{message:wm(n=wm(i="audio autoplay failed, userId: ".concat(r.userId,": Cannot resume the AudioContext - rejected by: [")).call(i,null==e?void 0:e.name,"]")).call(n,null==e?void 0:e.message),error_code:-1e3})})).finally((function(){clearTimeout(s)}))}null!==(n=i)&&void 0!==n&&n.then&&(VP&&LP&&(i=i.then((function(){return new q_((function(e){setTimeout(Tm(Em().mark((function t(){var n;return Em().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return null===(n=r._audioDom)||void 0===n||n.pause(),r._audioDom.volume=1,t.next=4,r._audioDom.play();case 4:e();case 5:case"end":return t.stop()}}),t)}))),500)}))}))),i.then((function(){AO(r.engineId,"_internalPlay successfully",{userId:r.userId}),r._pasued=!1})).catch((function(e){var t,n,i;r._autoPlayError(e),null===(t=r._monitor)||void 0===t||t.report("rtc_error",{message:wm(n=wm(i="audio autoplay failed, userId: ".concat(r.userId,": ")).call(i,e.message," ")).call(n,e.name),error_code:-1e3})})))}catch(l){var c,u,d;r._autoPlayError(l),null===(c=r._monitor)||void 0===c||c.report("rtc_error",{message:wm(u=wm(d="audio autoplay failed, userId: ".concat(r.userId,": ")).call(d,l.message," ")).call(u,l.name),error_code:-1e3})}})),r.engineId=e,a){var u=document.getElementById(a);if(!u)throw new hR(dR.CANT_FIND_DOM,"can't find dom");r._containerDom=u}else r._containerDom=document.body;return r.userId=t,r.muted=s,r.isScreen=c,r._monitor=kO(e),r._initAudio(),r}return Nl(i,[{key:"_initAudio",value:function(){var e;this._audioDom||(this._audioDom=BG("audio",{style:{display:"none"},attributes:HG}),this._audioDom.volume=this.muted?0:1,this._audioDom.muted=this.muted,this._audioDom.id=wm(e="".concat(this.userId,"_")).call(e,WO()),this._containerDom.appendChild(this._audioDom));this._initListeners()}},{key:"_initListeners",value:function(){var e=this;this._audioDom&&GG.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&&(GG.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=Tm(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(jG.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,t instanceof UV?(this._fakeAudioDom=new Audio,this._fakeAudioDom.muted=!0,this._fakeAudioDom.srcObject=new MediaStream([t.getOrgTrack()]),a.addTrack(t.getTrack())):a.addTrack(t.getTrack("preprocessing")),VP&&LP&&(this._audioDom.volume=0),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 13: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 hR(dR.INVALID_PARAMS,"Player not found");this._pasued=!0,this._audioDom.pause()}},{key:"manuallyPlay",value:function(){var e,t=this;if(jG.print("Invoke AudioPlayer.manuallyPlay"),this._emitPlayFailed=!1,!this._audioDom)throw new hR(dR.INVALID_PARAMS,"Player not found");if(!this.played)return q_.resolve();this._audioDom.volume=1,this._audioDom.muted=!1,null===(e=this._fakeAudioDom)||void 0===e||e.play();var r=[],n=this._audioDom.play();null!=n&&n.then&&r.push(n);var i=QU.getAudioContextInstance();if("suspended"===i.state){var o=i.resume();null!=o&&o.then&&r.push(o)}(r.length>0?q_.all(r):q_.resolve(n)).then((function(){t._pasued=!1}))}},{key:"setPlaybackDevice",value:(t=Tm(Em().mark((function e(t){var r,n;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return jG.print("setPlaybackDevice","setPlaybackDevice: ".concat(t)),e.next=3,XU.enumerateAudioPlaybackDevices();case 3:if(r=e.sent,n=Fm(r).call(r,(function(e){return e.deviceId})),fk(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;jG.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(){jG.print("destroy","audio player: ".concat(this.userId)),this.stop(),wI(RI(i.prototype),"removeAllListeners",this).call(this),this._removeListeners(),this._audioDom&&(this._audioDom.srcObject=null,delete this._audioDom)}}]),i}(LM.exports.EventEmitter);function qG(e,t,r,n){var i=function(){var e=Tm(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:mE(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 KG&&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))})),q_.all(o)}var YG=i,WG=lt("iterator"),QG=!YG((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[WG]||"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})),JG=Qt,ZG=E,$G=2147483647,eH=/[^\0-\u007E]/,tH=/[.\u3002\uFF0E\uFF61]/g,rH="Overflow: input needs wider integers to process",nH=RangeError,iH=ZG(tH.exec),oH=Math.floor,aH=String.fromCharCode,sH=ZG("".charCodeAt),cH=ZG([].join),uH=ZG([].push),dH=ZG("".replace),lH=ZG("".split),hH=ZG("".toLowerCase),pH=function(e){return e+22+75*(e<26)},vH=function(e,t,r){var n=0;for(e=r?oH(e/700):e>>1,e+=oH(e/t);e>455;)e=oH(e/35),n+=36;return oH(n+36*e/(e+38))},fH=function(e){var t=[];e=function(e){for(var t=[],r=0,n=e.length;r<n;){var i=sH(e,r++);if(i>=55296&&i<=56319&&r<n){var o=sH(e,r++);56320==(64512&o)?uH(t,((1023&i)<<10)+(1023&o)+65536):(uH(t,i),r--)}else uH(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&&uH(t,aH(n));var c=t.length,u=c;for(c&&uH(t,"-");u<i;){var d=$G;for(r=0;r<e.length;r++)(n=e[r])>=o&&n<d&&(d=n);var l=u+1;if(d-o>oH(($G-a)/l))throw nH(rH);for(a+=(d-o)*l,o=d,r=0;r<e.length;r++){if((n=e[r])<o&&++a>$G)throw nH(rH);if(n==o){for(var h=a,p=36;;){var v=p<=s?1:p>=s+26?26:p-s;if(h<v)break;var f=h-v,_=36-v;uH(t,aH(pH(v+f%_))),h=oH(f/_),p+=36}uH(t,aH(pH(h))),s=vH(a,l,u==c),a=0,u++}}a++,o++}return cH(t,"")},_H=Rr,mH=n,gH=O,yH=E,SH=C,bH=QG,EH=li,kH=Wg,TH=Ni,IH=Dc,AH=Zi,RH=fp,CH=A,wH=We,xH=Wt,OH=fn,PH=tr,MH=$,DH=gn,NH=Hn,LH=V,UH=mh,VH=dh,FH=Ap,BH=cA,jH=lt("iterator"),GH="URLSearchParams",HH="URLSearchParamsIterator",zH=AH.set,KH=AH.getterFor(GH),XH=AH.getterFor(HH),qH=Object.getOwnPropertyDescriptor,YH=function(e){if(!SH)return mH[e];var t=qH(mH,e);return t&&t.value},WH=YH("fetch"),QH=YH("Request"),JH=YH("Headers"),ZH=QH&&QH.prototype,$H=JH&&JH.prototype,ez=mH.RegExp,tz=mH.TypeError,rz=mH.decodeURIComponent,nz=mH.encodeURIComponent,iz=yH("".charAt),oz=yH([].join),az=yH([].push),sz=yH("".replace),cz=yH([].shift),uz=yH([].splice),dz=yH("".split),lz=yH("".slice),hz=/\+/g,pz=Array(4),vz=function(e){return pz[e-1]||(pz[e-1]=ez("((?:%[\\da-f]{2}){"+e+"})","gi"))},fz=function(e){try{return rz(e)}catch(sq){return e}},_z=function(e){var t=sz(e,hz," "),r=4;try{return rz(t)}catch(sq){for(;r;)t=sz(t,vz(r--),fz);return t}},mz=/[!'()~]|%20/g,gz={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+"},yz=function(e){return gz[e]},Sz=function(e){return sz(nz(e),mz,yz)},bz=IH((function(e,t){zH(this,{type:HH,iterator:UH(KH(e).entries),kind:t})}),"Iterator",(function(){var e=XH(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),Ez=function(e){this.entries=[],this.url=null,void 0!==e&&(MH(e)?this.parseObject(e):this.parseQuery("string"==typeof e?"?"===iz(e,0)?lz(e,1):e:DH(e)))};Ez.prototype={type:GH,bindURL:function(e){this.url=e,this.update()},parseObject:function(e){var t,r,n,i,o,a,s,c=VH(e);if(c)for(r=(t=UH(e,c)).next;!(n=gH(r,t)).done;){if(o=(i=UH(PH(n.value))).next,(a=gH(o,i)).done||(s=gH(o,i)).done||!gH(o,i).done)throw tz("Expected sequence with length 2");az(this.entries,{key:DH(a.value),value:DH(s.value)})}else for(var u in e)wH(e,u)&&az(this.entries,{key:u,value:DH(e[u])})},parseQuery:function(e){if(e)for(var t,r,n=dz(e,"&"),i=0;i<n.length;)(t=n[i++]).length&&(r=dz(t,"="),az(this.entries,{key:_z(cz(r)),value:_z(oz(r,"="))}))},serialize:function(){for(var e,t=this.entries,r=[],n=0;n<t.length;)e=t[n++],az(r,Sz(e.key)+"="+Sz(e.value));return oz(r,"&")},update:function(){this.entries.length=0,this.parseQuery(this.url.query)},updateURL:function(){this.url&&this.url.update()}};var kz=function(){RH(this,Tz);var e=arguments.length>0?arguments[0]:void 0;zH(this,new Ez(e))},Tz=kz.prototype;if(kH(Tz,{append:function(e,t){FH(arguments.length,2);var r=KH(this);az(r.entries,{key:DH(e),value:DH(t)}),r.updateURL()},delete:function(e){FH(arguments.length,1);for(var t=KH(this),r=t.entries,n=DH(e),i=0;i<r.length;)r[i].key===n?uz(r,i,1):i++;t.updateURL()},get:function(e){FH(arguments.length,1);for(var t=KH(this).entries,r=DH(e),n=0;n<t.length;n++)if(t[n].key===r)return t[n].value;return null},getAll:function(e){FH(arguments.length,1);for(var t=KH(this).entries,r=DH(e),n=[],i=0;i<t.length;i++)t[i].key===r&&az(n,t[i].value);return n},has:function(e){FH(arguments.length,1);for(var t=KH(this).entries,r=DH(e),n=0;n<t.length;)if(t[n++].key===r)return!0;return!1},set:function(e,t){FH(arguments.length,1);for(var r,n=KH(this),i=n.entries,o=!1,a=DH(e),s=DH(t),c=0;c<i.length;c++)(r=i[c]).key===a&&(o?uz(i,c--,1):(o=!0,r.value=s));o||az(i,{key:a,value:s}),n.updateURL()},sort:function(){var e=KH(this);BH(e.entries,(function(e,t){return e.key>t.key?1:-1})),e.updateURL()},forEach:function(e){for(var t,r=KH(this).entries,n=xH(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 bz(this,"keys")},values:function(){return new bz(this,"values")},entries:function(){return new bz(this,"entries")}},{enumerable:!0}),EH(Tz,jH,Tz.entries,{name:"entries"}),EH(Tz,"toString",(function(){return KH(this).serialize()}),{enumerable:!0}),TH(kz,GH),_H({global:!0,constructor:!0,forced:!bH},{URLSearchParams:kz}),!bH&&CH(JH)){var Iz=yH($H.has),Az=yH($H.set),Rz=function(e){if(MH(e)){var t,r=e.body;if(OH(r)===GH)return t=e.headers?new JH(e.headers):new JH,Iz(t,"content-type")||Az(t,"content-type","application/x-www-form-urlencoded;charset=UTF-8"),NH(e,{body:LH(0,DH(r)),headers:LH(0,t)})}return e};if(CH(WH)&&_H({global:!0,enumerable:!0,dontCallGetSet:!0,forced:!0},{fetch:function(e){return WH(e,arguments.length>1?Rz(arguments[1]):{})}}),CH(QH)){var Cz=function(e){return RH(this,ZH),new QH(e,arguments.length>1?Rz(arguments[1]):{})};ZH.constructor=Cz,Cz.prototype=ZH,_H({global:!0,constructor:!0,dontCallGetSet:!0,forced:!0},{Request:Cz})}}var wz,xz=Rr,Oz=C,Pz=QG,Mz=n,Dz=Wt,Nz=E,Lz=li,Uz=function(e,t,r){return JG.f(e,t,r)},Vz=fp,Fz=We,Bz=Tb,jz=zk,Gz=ni,Hz=Ud.codeAt,zz=function(e){var t,r,n=[],i=lH(dH(hH(e),tH,"."),".");for(t=0;t<i.length;t++)r=i[t],uH(n,iH(eH,r)?"xn--"+fH(r):r);return cH(n,".")},Kz=gn,Xz=Ni,qz=Ap,Yz={URLSearchParams:kz,getState:KH},Wz=Zi,Qz=Wz.set,Jz=Wz.getterFor("URL"),Zz=Yz.URLSearchParams,$z=Yz.getState,eK=Mz.URL,tK=Mz.TypeError,rK=Mz.parseInt,nK=Math.floor,iK=Math.pow,oK=Nz("".charAt),aK=Nz(/./.exec),sK=Nz([].join),cK=Nz(1..toString),uK=Nz([].pop),dK=Nz([].push),lK=Nz("".replace),hK=Nz([].shift),pK=Nz("".split),vK=Nz("".slice),fK=Nz("".toLowerCase),_K=Nz([].unshift),mK="Invalid scheme",gK="Invalid host",yK="Invalid port",SK=/[a-z]/i,bK=/[\d+-.a-z]/i,EK=/\d/,kK=/^0x/i,TK=/^[0-7]+$/,IK=/^\d+$/,AK=/^[\da-f]+$/i,RK=/[\0\t\n\r #%/:<>?@[\\\]^|]/,CK=/[\0\t\n\r #/:<>?@[\\\]^|]/,wK=/^[\u0000-\u0020]+|[\u0000-\u0020]+$/g,xK=/[\t\n\r]/g,OK=function(e){var t,r,n,i;if("number"==typeof e){for(t=[],r=0;r<4;r++)_K(t,e%256),e=nK(e/256);return sK(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+=cK(e[r],16),r<7&&(t+=":")));return"["+t+"]"}return e},PK={},MK=Bz({},PK,{" ":1,'"':1,"<":1,">":1,"`":1}),DK=Bz({},MK,{"#":1,"?":1,"{":1,"}":1}),NK=Bz({},DK,{"/":1,":":1,";":1,"=":1,"@":1,"[":1,"\\":1,"]":1,"^":1,"|":1}),LK=function(e,t){var r=Hz(e,0);return r>32&&r<127&&!Fz(t,e)?e:encodeURIComponent(e)},UK={ftp:21,file:null,http:80,https:443,ws:80,wss:443},VK=function(e,t){var r;return 2==e.length&&aK(SK,oK(e,0))&&(":"==(r=oK(e,1))||!t&&"|"==r)},FK=function(e){var t;return e.length>1&&VK(vK(e,0,2))&&(2==e.length||"/"===(t=oK(e,2))||"\\"===t||"?"===t||"#"===t)},BK=function(e){return"."===e||"%2e"===fK(e)},jK={},GK={},HK={},zK={},KK={},XK={},qK={},YK={},WK={},QK={},JK={},ZK={},$K={},eX={},tX={},rX={},nX={},iX={},oX={},aX={},sX={},cX=function(e,t,r){var n,i,o,a=Kz(e);if(t){if(i=this.parse(a))throw tK(i);this.searchParams=null}else{if(void 0!==r&&(n=new cX(r,!0)),i=this.parse(a,null,n))throw tK(i);(o=$z(new Zz)).bindURL(this),this.searchParams=o}};cX.prototype={type:"URL",parse:function(e,t,r){var n,i,o,a,s,c=this,u=t||jK,d=0,l="",h=!1,p=!1,v=!1;for(e=Kz(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=lK(e,wK,"")),e=lK(e,xK,""),n=jz(e);d<=n.length;){switch(i=n[d],u){case jK:if(!i||!aK(SK,i)){if(t)return mK;u=HK;continue}l+=fK(i),u=GK;break;case GK:if(i&&(aK(bK,i)||"+"==i||"-"==i||"."==i))l+=fK(i);else{if(":"!=i){if(t)return mK;l="",u=HK,d=0;continue}if(t&&(c.isSpecial()!=Fz(UK,l)||"file"==l&&(c.includesCredentials()||null!==c.port)||"file"==c.scheme&&!c.host))return;if(c.scheme=l,t)return void(c.isSpecial()&&UK[c.scheme]==c.port&&(c.port=null));l="","file"==c.scheme?u=eX:c.isSpecial()&&r&&r.scheme==c.scheme?u=zK:c.isSpecial()?u=YK:"/"==n[d+1]?(u=KK,d++):(c.cannotBeABaseURL=!0,dK(c.path,""),u=oX)}break;case HK:if(!r||r.cannotBeABaseURL&&"#"!=i)return mK;if(r.cannotBeABaseURL&&"#"==i){c.scheme=r.scheme,c.path=Gz(r.path),c.query=r.query,c.fragment="",c.cannotBeABaseURL=!0,u=sX;break}u="file"==r.scheme?eX:XK;continue;case zK:if("/"!=i||"/"!=n[d+1]){u=XK;continue}u=WK,d++;break;case KK:if("/"==i){u=QK;break}u=iX;continue;case XK:if(c.scheme=r.scheme,i==wz)c.username=r.username,c.password=r.password,c.host=r.host,c.port=r.port,c.path=Gz(r.path),c.query=r.query;else if("/"==i||"\\"==i&&c.isSpecial())u=qK;else if("?"==i)c.username=r.username,c.password=r.password,c.host=r.host,c.port=r.port,c.path=Gz(r.path),c.query="",u=aX;else{if("#"!=i){c.username=r.username,c.password=r.password,c.host=r.host,c.port=r.port,c.path=Gz(r.path),c.path.length--,u=iX;continue}c.username=r.username,c.password=r.password,c.host=r.host,c.port=r.port,c.path=Gz(r.path),c.query=r.query,c.fragment="",u=sX}break;case qK:if(!c.isSpecial()||"/"!=i&&"\\"!=i){if("/"!=i){c.username=r.username,c.password=r.password,c.host=r.host,c.port=r.port,u=iX;continue}u=QK}else u=WK;break;case YK:if(u=WK,"/"!=i||"/"!=oK(l,d+1))continue;d++;break;case WK:if("/"!=i&&"\\"!=i){u=QK;continue}break;case QK:if("@"==i){h&&(l="%40"+l),h=!0,o=jz(l);for(var f=0;f<o.length;f++){var _=o[f];if(":"!=_||v){var m=LK(_,NK);v?c.password+=m:c.username+=m}else v=!0}l=""}else if(i==wz||"/"==i||"?"==i||"#"==i||"\\"==i&&c.isSpecial()){if(h&&""==l)return"Invalid authority";d-=jz(l).length+1,l="",u=JK}else l+=i;break;case JK:case ZK:if(t&&"file"==c.scheme){u=rX;continue}if(":"!=i||p){if(i==wz||"/"==i||"?"==i||"#"==i||"\\"==i&&c.isSpecial()){if(c.isSpecial()&&""==l)return gK;if(t&&""==l&&(c.includesCredentials()||null!==c.port))return;if(a=c.parseHost(l))return a;if(l="",u=nX,t)return;continue}"["==i?p=!0:"]"==i&&(p=!1),l+=i}else{if(""==l)return gK;if(a=c.parseHost(l))return a;if(l="",u=$K,t==ZK)return}break;case $K:if(!aK(EK,i)){if(i==wz||"/"==i||"?"==i||"#"==i||"\\"==i&&c.isSpecial()||t){if(""!=l){var g=rK(l,10);if(g>65535)return yK;c.port=c.isSpecial()&&g===UK[c.scheme]?null:g,l=""}if(t)return;u=nX;continue}return yK}l+=i;break;case eX:if(c.scheme="file","/"==i||"\\"==i)u=tX;else{if(!r||"file"!=r.scheme){u=iX;continue}if(i==wz)c.host=r.host,c.path=Gz(r.path),c.query=r.query;else if("?"==i)c.host=r.host,c.path=Gz(r.path),c.query="",u=aX;else{if("#"!=i){FK(sK(Gz(n,d),""))||(c.host=r.host,c.path=Gz(r.path),c.shortenPath()),u=iX;continue}c.host=r.host,c.path=Gz(r.path),c.query=r.query,c.fragment="",u=sX}}break;case tX:if("/"==i||"\\"==i){u=rX;break}r&&"file"==r.scheme&&!FK(sK(Gz(n,d),""))&&(VK(r.path[0],!0)?dK(c.path,r.path[0]):c.host=r.host),u=iX;continue;case rX:if(i==wz||"/"==i||"\\"==i||"?"==i||"#"==i){if(!t&&VK(l))u=iX;else if(""==l){if(c.host="",t)return;u=nX}else{if(a=c.parseHost(l))return a;if("localhost"==c.host&&(c.host=""),t)return;l="",u=nX}continue}l+=i;break;case nX:if(c.isSpecial()){if(u=iX,"/"!=i&&"\\"!=i)continue}else if(t||"?"!=i)if(t||"#"!=i){if(i!=wz&&(u=iX,"/"!=i))continue}else c.fragment="",u=sX;else c.query="",u=aX;break;case iX:if(i==wz||"/"==i||"\\"==i&&c.isSpecial()||!t&&("?"==i||"#"==i)){if(".."===(s=fK(s=l))||"%2e."===s||".%2e"===s||"%2e%2e"===s?(c.shortenPath(),"/"==i||"\\"==i&&c.isSpecial()||dK(c.path,"")):BK(l)?"/"==i||"\\"==i&&c.isSpecial()||dK(c.path,""):("file"==c.scheme&&!c.path.length&&VK(l)&&(c.host&&(c.host=""),l=oK(l,0)+":"),dK(c.path,l)),l="","file"==c.scheme&&(i==wz||"?"==i||"#"==i))for(;c.path.length>1&&""===c.path[0];)hK(c.path);"?"==i?(c.query="",u=aX):"#"==i&&(c.fragment="",u=sX)}else l+=LK(i,DK);break;case oX:"?"==i?(c.query="",u=aX):"#"==i?(c.fragment="",u=sX):i!=wz&&(c.path[0]+=LK(i,PK));break;case aX:t||"#"!=i?i!=wz&&("'"==i&&c.isSpecial()?c.query+="%27":c.query+="#"==i?"%23":LK(i,PK)):(c.fragment="",u=sX);break;case sX:i!=wz&&(c.fragment+=LK(i,MK))}d++}},parseHost:function(e){var t,r,n;if("["==oK(e,0)){if("]"!=oK(e,e.length-1))return gK;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 oK(e,l)};if(":"==h()){if(":"!=oK(e,1))return;l+=2,d=++u}for(;h();){if(8==u)return;if(":"!=h()){for(t=r=0;r<4&&aK(AK,h());)t=16*t+rK(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(!aK(EK,h()))return;for(;aK(EK,h());){if(o=rK(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}(vK(e,1,-1)),!t)return gK;this.host=t}else if(this.isSpecial()){if(e=zz(e),aK(RK,e))return gK;if(t=function(e){var t,r,n,i,o,a,s,c=pK(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"==oK(i,0)&&(o=aK(kK,i)?16:8,i=vK(i,8==o?1:2)),""===i)a=0;else{if(!aK(10==o?IK:8==o?TK:AK,i))return e;a=rK(i,o)}dK(r,a)}for(n=0;n<t;n++)if(a=r[n],n==t-1){if(a>=iK(256,5-t))return null}else if(a>255)return null;for(s=uK(r),n=0;n<r.length;n++)s+=r[n]*iK(256,3-n);return s}(e),null===t)return gK;this.host=t}else{if(aK(CK,e))return gK;for(t="",r=jz(e),n=0;n<r.length;n++)t+=LK(r[n],PK);this.host=t}},cannotHaveUsernamePasswordPort:function(){return!this.host||this.cannotBeABaseURL||"file"==this.scheme},includesCredentials:function(){return""!=this.username||""!=this.password},isSpecial:function(){return Fz(UK,this.scheme)},shortenPath:function(){var e=this.path,t=e.length;!t||"file"==this.scheme&&1==t&&VK(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+=OK(i),null!==o&&(u+=":"+o)):"file"==t&&(u+="//"),u+=e.cannotBeABaseURL?a[0]:a.length?"/"+sK(a,"/"):"",null!==s&&(u+="?"+s),null!==c&&(u+="#"+c),u},setHref:function(e){var t=this.parse(e);if(t)throw tK(t);this.searchParams.update()},getOrigin:function(){var e=this.scheme,t=this.port;if("blob"==e)try{return new uX(e.path[0]).origin}catch(sq){return"null"}return"file"!=e&&this.isSpecial()?e+"://"+OK(this.host)+(null!==t?":"+t:""):"null"},getProtocol:function(){return this.scheme+":"},setProtocol:function(e){this.parse(Kz(e)+":",jK)},getUsername:function(){return this.username},setUsername:function(e){var t=jz(Kz(e));if(!this.cannotHaveUsernamePasswordPort()){this.username="";for(var r=0;r<t.length;r++)this.username+=LK(t[r],NK)}},getPassword:function(){return this.password},setPassword:function(e){var t=jz(Kz(e));if(!this.cannotHaveUsernamePasswordPort()){this.password="";for(var r=0;r<t.length;r++)this.password+=LK(t[r],NK)}},getHost:function(){var e=this.host,t=this.port;return null===e?"":null===t?OK(e):OK(e)+":"+t},setHost:function(e){this.cannotBeABaseURL||this.parse(e,JK)},getHostname:function(){var e=this.host;return null===e?"":OK(e)},setHostname:function(e){this.cannotBeABaseURL||this.parse(e,ZK)},getPort:function(){var e=this.port;return null===e?"":Kz(e)},setPort:function(e){this.cannotHaveUsernamePasswordPort()||(""==(e=Kz(e))?this.port=null:this.parse(e,$K))},getPathname:function(){var e=this.path;return this.cannotBeABaseURL?e[0]:e.length?"/"+sK(e,"/"):""},setPathname:function(e){this.cannotBeABaseURL||(this.path=[],this.parse(e,nX))},getSearch:function(){var e=this.query;return e?"?"+e:""},setSearch:function(e){""==(e=Kz(e))?this.query=null:("?"==oK(e,0)&&(e=vK(e,1)),this.query="",this.parse(e,aX)),this.searchParams.update()},getSearchParams:function(){return this.searchParams.facade},getHash:function(){var e=this.fragment;return e?"#"+e:""},setHash:function(e){""!=(e=Kz(e))?("#"==oK(e,0)&&(e=vK(e,1)),this.fragment="",this.parse(e,sX)):this.fragment=null},update:function(){this.query=this.searchParams.serialize()||null}};var uX=function(e){var t=Vz(this,dX),r=qz(arguments.length,1)>1?arguments[1]:void 0,n=Qz(t,new cX(e,!1,r));Oz||(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())},dX=uX.prototype,lX=function(e,t){return{get:function(){return Jz(this)[e]()},set:t&&function(e){return Jz(this)[t](e)},configurable:!0,enumerable:!0}};if(Oz&&(Uz(dX,"href",lX("serialize","setHref")),Uz(dX,"origin",lX("getOrigin")),Uz(dX,"protocol",lX("getProtocol","setProtocol")),Uz(dX,"username",lX("getUsername","setUsername")),Uz(dX,"password",lX("getPassword","setPassword")),Uz(dX,"host",lX("getHost","setHost")),Uz(dX,"hostname",lX("getHostname","setHostname")),Uz(dX,"port",lX("getPort","setPort")),Uz(dX,"pathname",lX("getPathname","setPathname")),Uz(dX,"search",lX("getSearch","setSearch")),Uz(dX,"searchParams",lX("getSearchParams")),Uz(dX,"hash",lX("getHash","setHash"))),Lz(dX,"toJSON",(function(){return Jz(this).serialize()}),{enumerable:!0}),Lz(dX,"toString",(function(){return Jz(this).serialize()}),{enumerable:!0}),eK){var hX=eK.createObjectURL,pX=eK.revokeObjectURL;hX&&Lz(uX,"createObjectURL",Dz(hX,eK)),pX&&Lz(uX,"revokeObjectURL",Dz(pX,eK))}Xz(uX,"URL"),xz({global:!0,constructor:!0,forced:!Pz,sham:!Oz},{URL:uX});var vX=ee.URL,fX=function(){var e=Tm(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(vX.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)}}(),_X=ad,mX=tc,gX=function(e,t,r,n){for(var i,o=n>1?void 0:n?mX(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&&_X(t,r,o),o},yX=function(){function e(t,r){Ll(this,e),Qd(this,"_sharedAudioContext",new AudioContext),Qd(this,"_audioDestination",this._sharedAudioContext.createMediaStreamDestination()),Qd(this,"_localGainNode",this._sharedAudioContext.createGain()),Qd(this,"_bufferGainNode",this._sharedAudioContext.createGain()),Qd(this,"_audioBufferSource",void 0),Qd(this,"_localSource",void 0),Qd(this,"_context",void 0),Qd(this,"_failedAudioList",[]),Qd(this,"_startingIds",new JS),Qd(this,"_revokeURLs",new QN),Qd(this,"mixingMap",new JS),Qd(this,"resourcesCache",new JS),Qd(this,"volumeConfig",new JS),Qd(this,"cachedBuffer",[]),Qd(this,"id","AudioMixingManager"),this.engineId=r,this._context=t,this._localGainNode.gain.value=1}var t,r,n;return Nl(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=Tm(Em().mark((function e(t,r,n){var i,o,a,s,c,u,d,l,h,p,v,f,_,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),i=n.playCount,mM(o=n.type,"mixingType",Kj(xl)),a=this._context.getLocalAudioTrack()){e.next=9;break}return e.abrupt("return");case 9: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:Ol.AUDIO_MIXING_STATE_STOPPED,error:lR.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=18;break}u=d.getAudioNode(),e.next=31;break;case 18:return e.next=20,fetch(r,{mode:"cors",credentials:"include"}).then((function(e){if(e.ok)return e.arrayBuffer();throw m._context.emitMessage({mixId:t,state:Ol.AUDIO_MIXING_STATE_FAILED,error:lR.AUDIO_MIXING_ERROR_START_FAILED}),new hR(dR.LOAD_RESOURCES_FAILED,e.statusText)}));case 20:return l=e.sent,Wb(r).call(r,"mp3")?h={type:"audio/mpeg"}:Wb(r).call(r,"aac")&&(h={type:"audio/aac"}),e.next=24,fX(l,h);case 24:if(e.sent){e.next=28;break}throw this._context.emitMessage({mixId:t,state:Ol.AUDIO_MIXING_STATE_FAILED,error:lR.AUDIO_MIXING_ERROR_START_FAILED}),new hR(dR.LOAD_RESOURCES_FAILED,"invalid audio resource");case 28:(u=new Audio).crossOrigin="anonymous",u.src=vX.createObjectURL(new Blob([l],h));case 31:return i<=0?u.loop=!0:i>0&&(p=i,u.onended=function(){--p>0?u.play():(m.mixingMap.delete(t),m._context.emitMessage({mixId:t,state:Ol.AUDIO_MIXING_STATE_FINISHED,error:lR.AUDIO_MIXING_ERROR_OK}))}),e.prev=32,e.next=35,u.play();case 35:e.next=42;break;case 37:e.prev=37,e.t0=e.catch(32),console.error(e.t0),this._failedAudioList.push(u),this._context.onAutoPlayFailed({userId:this.id,kind:"audio",streamIndex:cl.STREAM_INDEX_MAIN,mediaType:ul.AUDIO});case 42:if(this._startingIds.delete(t),v=this._sharedAudioContext.createMediaElementSource(u),f=this._sharedAudioContext.createGain(),_=this.volumeConfig.get(t),f.gain.value=_?_/100:1,v.connect(f).connect(this._audioDestination),this.mixingMap.set(t,{audioSource:v,audioNode:u,gainNode:f,type:"file"}),o===xl.PUBLISH)try{f.disconnect(this._sharedAudioContext.destination)}catch(g){}else f.connect(this._sharedAudioContext.destination);this._context.updateLocalAudioTrack(this._audioDestination.stream.getAudioTracks()[0],n.type),this._context.emitMessage({mixId:t,state:Ol.AUDIO_MIXING_STATE_PLAYING,error:lR.AUDIO_MIXING_ERROR_OK});case 52:case"end":return e.stop()}}),e,this,[[32,37]])}))),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:Ol.AUDIO_MIXING_STATE_STOPPED,error:lR.AUDIO_MIXING_ERROR_OK}))}},{key:"pauseAudioMixing",value:function(e){var t=this.mixingMap.get(e);t&&(this._context.emitMessage({mixId:e,state:Ol.AUDIO_MIXING_STATE_PAUSED,error:lR.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:Ol.AUDIO_MIXING_STATE_PLAYING,error:lR.AUDIO_MIXING_ERROR_OK}),t.audioNode.play())}},{key:"preloadAudioMixing",value:(r=Tm(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 hR(dR.LOAD_RESOURCES_FAILED,e.statusText)})).catch((function(e){if(o._context.emitMessage({mixId:t,state:Ol.AUDIO_MIXING_STATE_FAILED,error:lR.AUDIO_MIXING_ERROR_PRELOAD_FAILED}),e instanceof hR)throw e;throw new hR(dR.LOAD_RESOURCES_FAILED,"Load resources failed",e)}));case 3:return n=e.sent,Wb(r).call(r,"mp3")?i={type:"audio/mpeg"}:Wb(r).call(r,"aac")&&(i={type:"audio/aac"}),e.next=7,fX(n,i);case 7:if(e.sent){e.next=11;break}throw this._context.emitMessage({mixId:t,state:Ol.AUDIO_MIXING_STATE_FAILED,error:lR.AUDIO_MIXING_ERROR_PRELOAD_FAILED}),new hR(dR.LOAD_RESOURCES_FAILED,"Load resources failed");case 11:return this._context.emitMessage({mixId:t,state:Ol.AUDIO_MIXING_STATE_PRELOADED,error:lR.AUDIO_MIXING_ERROR_OK}),this.resourcesCache.set(t,{getAudioNode:function(){var e=vX.createObjectURL(new Blob([n],i));return o._revokeURLs.add(e),new Audio(e)},filePath:r,duration:0}),e.next=15,new q_((function(e){var r=vX.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)),vX.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){mM(e,"type",Kj(xl));var t=this._context.getLocalAudioTrack();if(t){var r=t.getTrack("preprocessing");if(r&&this.mixMediaStream(new MediaStream([r])),e===xl.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:Ol.AUDIO_MIXING_STATE_PCM_ENABLED,error:lR.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:Ol.AUDIO_MIXING_STATE_PCM_DISABLED,error:lR.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=Tm(Em().mark((function e(){var t,r,n,i;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:t=[],r=JT(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:cl.STREAM_INDEX_MAIN,mediaType:ul.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 JS,this._revokeURLs.forEach((function(e){vX.revokeObjectURL(e)}))}}]),e}();gX([TO("id","filePath","options")],yX.prototype,"startAudioMixing",1),gX([TO("id")],yX.prototype,"stopAudioMixing",1),gX([TO("id")],yX.prototype,"pauseAudioMixing",1),gX([TO("id")],yX.prototype,"resumeAudioMixing",1),gX([TO("id")],yX.prototype,"preloadAudioMixing",1),gX([TO("id")],yX.prototype,"unloadAudioMixing",1),gX([TO("id")],yX.prototype,"getAudioMixingVolume",1),gX([TO("id","volume")],yX.prototype,"setAudioMixingVolume",1),gX([TO("id")],yX.prototype,"getAudioMixingDuration",1),gX([TO("id")],yX.prototype,"getAudioMixingCurrentPosition",1),gX([TO("id","position")],yX.prototype,"setAudioMixingPosition",1),gX([TO("type")],yX.prototype,"enableAudioMixingBuffer",1),gX([TO()],yX.prototype,"disableAudioMixingBuffer",1),gX([TO("buffer")],yX.prototype,"pushAudioMixingBuffer",1);var SX=function(e){return e.NORMAL_USER="normalUser",e.SILENT_USER="silentUser",e}(SX||{}),bX=new cO("RTMClient",1),EX=function(e){OI(u,e);var t,r,n,i,o,a,s,c=YI(u);function u(e,t){var r;return Ll(this,u),Qd($T(r=c.call(this)),"_dataChannelSignal",null),Qd($T(r),"_handler",null),Qd($T(r),"_dataChannelSignalState",_G.DISCONNECTED),Qd($T(r),"_loginSessionId",null),Qd($T(r),"_userId",null),Qd($T(r),"_token",null),Qd($T(r),"_isReconnecting",!1),Qd($T(r),"_reconnectTimer",null),Qd($T(r),"_loginResolveCallback",null),Qd($T(r),"_loginRejectCallback",null),Qd($T(r),"_iceConfigNode",null),Qd($T(r),"_wait_login_token",!1),Qd($T(r),"_serverParamsCache",void 0),r.id=e,r._appId=t,r}return Nl(u,[{key:"login",value:function(e,t){var r=this;return new q_((function(n,i){var o;if(bX.print("login","invoke login, token: %o, userId: %o",e,t),r._loginSessionId)throw new hR(dR.ALREADY_LOGIN,"Already logined");if(r._loginResolveCallback)throw new hR(dR.LOGIN_FAILED,"Is logging in, please try again later.");r._userId=t,r._token=e,null===(o=kO(r.id))||void 0===o||o.set({rtm_user_id:t}),r._loginResolveCallback=n,r._loginRejectCallback=i,r._dataChannelSignal?r._login():(bX.print("login","init dataChannelSingling"),r._dataChannelSignalState=_G.CONNECTING,r._createDataChannelSignaling(t).then((function(e){r._dataChannelSignal=e,r._login()})).catch((function(){r._onDisconnect()})))}))}},{key:"logout",value:(s=Tm(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 hR(dR.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:lD.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=Tm(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 q_((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=Tm(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 hR(dR.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:lD.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=Tm(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 hR(dR.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=Tm(Em().mark((function e(t,r){return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(e.prev=0,_M(t,"signature"),_M(r,"url"),this._loginSessionId&&this._userId){e.next=5;break}throw new hR(dR.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:lD.C2RTM}).catch((function(e){throw new hR(dR.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=Tm(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 hR(dR.NOT_LOGIN,"login first");case 2:return this._checkDataChannelSignal(),e.abrupt("return",this._dataChannelSignal.sendP2PMessage({from:this._userId,app:this._appId,to:"",room:"",type:oD.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(RI(u.prototype),"removeAllListeners",this).call(this),delete this._serverParamsCache}},{key:"_login",value:function(){var e=this;if(this._userId){var t=WO();this._checkDataChannelSignal(),this._dataChannelSignal.sendSignaling("login",{Token:ZO.token2auth(this._appId,null,this._userId,this._token),timestamp:Date.now(),loginSessionId:t,params:{deviceType:"web",userAgent:window.navigator.userAgent,sdkVersion:cM.VERSION,deviceId:nM.getDeviceId(),appId:this._appId,userId:this._userId},accessParams:Mm({requireICEUfragV2:!0})},{functionType:lD.C2RTM}).then((function(){"function"==typeof e._loginResolveCallback&&e._loginResolveCallback(),e._loginSessionId=t,pO.setRtsSessionId(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=dR.INVALID_PARAMS,n="Invalid userId"):(r=dR.INVALID_TOKEN,n="Invalid token",e._wait_login_token=!0,e._loginRejectCallback||e.emit("onRTMTokenError")):(r=dR.LOGIN_FAILED,n="login failed"),"function"==typeof e._loginRejectCallback&&e._loginRejectCallback(new hR(r,a||n))})).finally((function(){e._loginResolveCallback=null,e._loginRejectCallback=null}))}}},{key:"_createDataChannelSignaling",value:(t=Tm(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 fD(this.id),i=this._iceConfigNode){e.next=16;break}return e.prev=3,e.next=6,null==n?void 0:n.getAccessNode(this._appId,"");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),AO(this.id,"rtm.login.getNodeFailed",null===e.t0||void 0===e.t0?void 0:e.t0.message),new hR(dR.ICE_SERVER_WRONG,"get ICE config failed");case 16:return AO(this.id,"rtm.login.getNodeSuccess",i),bX.print("_createDataChannelSignaling()","get node success",i),this._handler=eG({id:this.id,avSync:!0,enableFallbackHandler:zX(this._appId)}),null===(r=this._handler)||void 0===r||r.once("disconnect",(function(){bX.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,bX.print("_createDataChannelSignaling()","establish peerConnection success"),this._dataChannelSignalState=_G.CONNECTED,e.next=33;break;case 28:throw e.prev=28,e.t1=e.catch(20),this._iceConfigNode=null,this._dataChannelSignalState=_G.DISCONNECTED,new hR(dR.ESTABLISH_DATACHANNEL_FAILED,"establish dataChannel failed",e.t1);case 33:return c=new hD(this.id,a),bX.print("_createDataChannelSignaling()","send ping"),c.sendPingSignaling(),c.once("close",(function(){bX.print("_createDataChannelSignaling()","recv DataChannelSignaling event: close"),u._onDisconnect()})),c.on($M.USER_MESSAGE_RECEIVED_OUTSIDE_ROOM,(function(e){u.emit("onUserMessageReceivedOutsideRoom",{userId:e.from,message:e.msg})})),c.on($M.USER_BINARY_MESSAGE_RECEIVED_OUTSIDE_ROOM,(function(e){u.emit("onUserBinaryMessageReceivedOutsideRoom",{userId:e.from,message:e.msg})})),c.on($M.USER_DISCONNECTION,(function(){u.emit("onUserDisconnection"),u._clearState()})),c.on($M.NODE_CHANGE,(function(e){AO(u.id,"rtm.nodeChange",Mm(e)),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!==_G.CONNECTED)throw new hR(dR.NOT_CONNECTED_YET,"datachannel not connect")}},{key:"_onDisconnect",value:function(){this._dataChannelSignalState=_G.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&&(bX.print("_reconnect()","start reconnect..."),this._isReconnecting=!0,this._createDataChannelSignaling(this._userId).then((function(t){bX.print("_reconnect()","reconnect success!"),e._dataChannelSignal=t,e._login(),e._reconnectTimer=null})).catch((function(t){bX.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,pO.setRtsSessionId(this.id,""),null!==this._reconnectTimer&&(self.clearTimeout(this._reconnectTimer),this._reconnectTimer=null)}}]),u}(LM.exports.EventEmitter),kX=function(e){OI(o,e);var t,r,n,i=YI(o);function o(e,t,r){var n,a=r.businessId;return Ll(this,o),Qd($T(n=i.call(this)),"_mediaServerClient",void 0),Qd($T(n),"_appId",void 0),Qd($T(n),"_reconnectTimer",void 0),Qd($T(n),"remoteStreams",void 0),Qd($T(n),"_businessId",void 0),n.id=e,n._appId=t,n.remoteStreams=new JS,n._businessId=a,n}return Nl(o,[{key:"connect",value:(n=Tm(Em().mark((function e(){return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this._mediaServerClient=new gG({id:this.id,avSync:!0,enableFallbackHandler:zX(this._appId)}),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=Tm(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 hR(dR.REPEAT_PLAY,"repeat play public media stream");case 2:return(r=new iF(this.id,t,t,!1,!0,{audiostream:!0,localaudio:!0,videostream:!0,localvideo:!0,extaudio:!1,extvideo:!1,videoDescriptions:[]})).on("onSEIMessage",(function(e){if(e instanceof Uint8Array)for(var t=_P(e),i=0;i<t.seiCount;i++)n.emit(iG.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 JS,this._mediaServerClient&&this._mediaServerClient.destroy()}},{key:"_handleReconnected",value:(t=Tm(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=JT(this.remoteStreams);try{for(n=function(){var e=ZT(r.value,1)[0];i.remoteStreams.delete(e),i.startPlayPublicStream(e).then((function(){var t=i.remoteStreams.get(e);i.safeEmit(iG.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(tD.ABNORMAL_DISCONNECTION,this._reconnect.bind(this)),null===(t=this._mediaServerClient)||void 0===t||t.on("onRemoteStreamStats",(function(e){r.emit("onRemoteStreamStats",e)}))}}]),o}(FM),TX=new cO("AudioDeviceManager",1),IX=function(e){OI(c,e);var t,r,n,i,o,a,s=YI(c);function c(e){var t;return Ll(this,c),Qd($T(t=s.call(this)),"_audioLevelFetcher",void 0),Qd($T(t),"_playbackDeviceTestTimer",void 0),Qd($T(t),"_audioElement",void 0),Qd($T(t),"_audioTrack",void 0),Qd($T(t),"_mediaRecorder",void 0),Qd($T(t),"_recoderTimer",void 0),Qd($T(t),"_isAudioPlaybackDeviceTesting",!1),Qd($T(t),"_isAudioDeviceRecordTesting",!1),Qd($T(t),"_audioCaptureAndRecoderResolve",void 0),Qd($T(t),"_onAutoplayFailed",void 0),Qd($T(t),"_audioPlaybackDeviceId",void 0),t._extensionManager=e,t}return Nl(c,[{key:"audioTrack",get:function(){return this._audioTrack}},{key:"startAudioPlaybackDeviceTest",value:(a=Tm(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 hR(dR.REPEAT_DEVICE_TEST,"device test cannot be called repeatedly at the same time.");case 2:return this._isAudioPlaybackDeviceTesting=!0,TX.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),TX.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&&(TX.print("stopAudioPlaybackDeviceTest()","Invoke"),this._isAudioPlaybackDeviceTesting=!1,this._stopEmitAudioPlaybackDeviceTestVolume(),this._destroyAudioElement())}},{key:"startAudioDeviceRecordTest",value:(o=Tm(Em().mark((function e(t,r,n){var i=this;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(window.MediaRecorder){e.next=2;break}throw new hR(dR.NOT_SUPPORTED,"Your browser does not support MediaRecorder.");case 2:if(!this._isAudioDeviceRecordTesting){e.next=4;break}throw new hR(dR.REPEAT_DEVICE_TEST,"device test cannot be called repeatedly at the same time.");case 4:return this._isAudioDeviceRecordTesting=!0,TX.print("startAudioDeviceRecordTest()","Invoke"),this._recoderTimer=window.setTimeout((function(){TX.print("startAudioDeviceRecordTest()","".concat(3e4,'ms automatic call method "stopAudioDeviceRecordAndPlayTest"')),i._stopAudioCaptureAndRecoder()}),3e4),e.prev=7,this._onAutoplayFailed=r,e.next=11,this._startAudioCaptureAndRecoder(t,null!=n?n:100);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,r){return o.apply(this,arguments)})},{key:"stopAudioDeviceRecordAndPlayTest",value:function(){TX.print("stopAudioDeviceRecordAndPlayTest()","Invoke"),void 0!==this._recoderTimer&&(clearTimeout(this._recoderTimer),delete this._recoderTimer),this._stopAudioCaptureAndRecoder()}},{key:"stopAudioDevicePlayTest",value:function(){this._isAudioDeviceRecordTesting&&(TX.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=Tm(Em().mark((function e(t){var r;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(TX.print("setSinkId()","Invoke"),void 0!==HTMLAudioElement.prototype.setSinkId){e.next=3;break}throw new hR(dR.NOT_SUPPORTED,"setSinkId not supported by current browser");case 3:return e.next=5,XU.getDeviceById(t);case 5:if(r=e.sent){e.next=8;break}throw new hR(dR.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(){TX.print("destroy()","Invoke"),wI(RI(c.prototype),"removeAllListeners",this).call(this),this.stopAudioPlaybackDeviceTest(),this.stopAudioDevicePlayTest()}},{key:"_playAudioFile",value:(n=Tm(Em().mark((function e(t,r){var n,i=this;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return TX.print("_playAudioFile()",wm(n="Invoke url=".concat(t,"; loop=")).call(n,r.loop)),e.abrupt("return",new q_((function(e,n){var o=BG("audio",{attributes:{src:t,crossOrigin:"anonymous"}});i._audioElement=o,o.loop=r.loop,i._audioLevelFetcher=new WU(o),o.onplaying=function(){o.onplaying=null,TX.print("_playAudioFile()","onplaying"),e()},o.onerror=function(){var e=Tm(Em().mark((function e(t){var r,i;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:TX.print("_playAudioFile()","onerror",t),i=t.message||(null==o||null===(r=o.error)||void 0===r?void 0:r.message),n(new hR(dR.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;TX.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 q_.all([null===(e=i._audioLevelFetcher)||void 0===e?void 0:e.resume(),o.play()])})):n(new hR(dR.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&&(TX.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&&(TX.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&&(TX.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=Tm(Em().mark((function e(t,r){var n,i=this;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,kV({},this._extensionManager);case 2:return this._audioTrack=e.sent,this._audioTrack.setVolume(r),n=new MediaStream([this._audioTrack.getTrack("preprocessing")]),TX.print("startAudioDeviceRecordTest()","create microphone track success!"),e.abrupt("return",new q_((function(e,r){var o,a;"function"==typeof MediaRecorder.isTypeSupported&&(o=mE(a=["audio/webm","audio/mp4"]).call(a,(function(e){return MediaRecorder.isTypeSupported(e)})),TX.print("startAudioDeviceRecordTest()","use mimeType: ".concat(o))),i._mediaRecorder=new MediaRecorder(n,o?{mimeType:o}:void 0);var s=i._mediaRecorder.mimeType;i._mediaRecorder.ondataavailable=function(){var n=Tm(Em().mark((function n(o){var a,c;return Em().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(!i._isAudioDeviceRecordTesting){n.next=16;break}return TX.print("startAudioDeviceRecordTest()","get recorded file(mimeType: ".concat(s,").")),c=new Blob([o.data],{type:s}),n.prev=3,n.next=6,i._playAudioFile(vX.createObjectURL(c),{loop:!1});case 6:n.next=11;break;case 8:return n.prev=8,n.t0=n.catch(3),n.abrupt("return",r(n.t0));case 11:i._startEmitAudioPlaybackDeviceTestVolume(t),null===(a=i._audioElement)||void 0===a||a.addEventListener("ended",(function(){i.stopAudioDevicePlayTest(),e()})),i._audioCaptureAndRecoderResolve=e,n.next=17;break;case 16:e();case 17:case"end":return n.stop()}}),n,null,[[3,8]])})));return function(e){return n.apply(this,arguments)}}(),i._mediaRecorder.onerror=function(e){r(new hR(dR.AUDIO_DEVICE_TEST_FAILED,e.message||"mediaRecorder error"))},i._mediaRecorder.start()})));case 7:case"end":return e.stop()}}),e,this)}))),function(e,t){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=Tm(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=QU.getAudioContextInstance())||void 0===r||null===(n=r.setSinkId)||void 0===n||n.call(r,t),TX.print("setSinkId","ctx.sinkId=".concat(t))}catch(o){TX.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}(LM.exports.EventEmitter),AX=function(){function e(t){Ll(this,e),Qd(this,"_roomId",void 0),Qd(this,"_constraints",{}),Qd(this,"_profile",void 0),this._appId=t}return Nl(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=nM.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=ZT(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),Fm(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=Zd(Zd({},this._constraints),e)}},{key:"getConstraints",value:function(){var e=Zd({},this._constraints),t=nM.getEngineWebConfig(this._appId,this._roomId||"").audio_capture;gP(null==t?void 0:t.sample_rate)||(e.sampleRate=t.sample_rate),gP(null==t?void 0:t.channel)||(e.channelCount=t.channel),gP(null==t?void 0:t.agc)||(e.autoGainControl=t.agc),gP(null==t?void 0:t.ans)||(e.noiseSuppression=t.ans),gP(null==t?void 0:t.aec)||(e.echoCancellation=t.aec);var r=this._getConfigByAudioProfile(),n=r.sampleRate,i=r.channel;return gP(e.sampleRate)&&!gP(n)&&(e.sampleRate=n),gP(e.channelCount)&&!gP(i)&&(e.channelCount=i),e}},{key:"_getConfigByAudioProfile",value:function(){var e={};switch(this._profile){case El.fluent:e.sampleRate=16e3,e.bitrate=24e3;break;case El.standard:e.sampleRate=48e3,e.bitrate=48e3;break;case El.hd:e.sampleRate=48e3,e.bitrate=128e3,e.channel=2;break;case El.standardStereo:e.sampleRate=48e3,e.bitrate=8e4,e.channel=2;break;case El.hdMono:e.sampleRate=48e3,e.bitrate=128e3}return e}}]),e}(),RX=new cO("VideoSnapshot",1),CX=function(e){var t=null==e?void 0:e.domElement;if(t&&!t.paused&&4===t.readyState)return t},wX=function(){var e=Tm(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=CX(n))){e.next=16;break}return RX.print("takeSnapshot","VideoPlayer already set."),e.next=11,a(c,c.videoWidth,c.videoHeight);case 11:return u=e.sent,RX.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 RX.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,RX.print("takeSnapshot","success, cost ".concat(Date.now()-s,"ms")),e.abrupt("return",l);case 29:return RX.print("takeSnapshot","use temp video"),e.abrupt("return",new q_((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);RX.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)}}(),xX=function(){return{url:"",video:{codec:Il.H264,width:640,height:360,fps:15,gop:2,kBitRate:OX(640,360,15)},audio:{codec:"AAC",kBitRate:64,sampleRate:48e3,channels:2,AACProfile:Tl.LC},layout:{regions:[],appData:"",backgroundColor:"#000000"}}};function OX(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 PX(e){if("string"!=typeof e||!/^rtmps?:\/\//.test(e))throw new hR(dR.INVALID_PARAMS,"Invalid rtmp address")}function MX(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];if(null==e||!e.length)throw new hR(dR.INVALID_PARAMS,"regions should not be empty.");var t,r=JT(e);try{for(r.s();!(t=r.n()).done;){var n=t.value;if("string"!=typeof n.userId)throw new hR(dR.INVALID_PARAMS,"region.userId(".concat(n.userId,") should be a string."));if("boolean"!=typeof n.isScreenStream)throw new hR(dR.INVALID_PARAMS,"region.isScreenStream(".concat(n.isScreenStream,") should be a boolean."))}}catch(i){r.e(i)}finally{r.f()}}function DX(e,t){var r,n,i,o=function(e,r){var n=lb(e).call(e,(function(e,t){return null==e?void 0:e[t]}),t),i=lb(e).call(e,(function(e,t){return null==e?void 0:e[t]}),xX());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!!mE(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 fk(t=[1,2]).call(t,e)})),profile:o(["audio","AACProfile"],(function(e){var t;return fk(t=[Tl.LC,Tl.HEv1,Tl.HEv2]).call(t,e)}))},video:{codec:o(["video","codec"],(function(e){var t;return fk(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:OX(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:Fm(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&&fk(t=[1,2,3]).call(t,e.renderMode)?e.renderMode:1,contentControl:e.contentControl&&fk(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 NX,LX={getDefaultValue:xX,checkStartParams:function(e){var t;PX(e.url),MX(null===(t=e.layout)||void 0===t?void 0:t.regions)},checckUpdateParams:function(e){var t;e.url&&PX(e.url),MX(null===(t=e.layout)||void 0===t?void 0:t.regions)},getStartParams:function(e){return DX("started",e)},getUpdateParams:function(e){return DX("layoutChanged",e)}},UX=ad,VX=tc,FX=function(e,t,r,n){for(var i,o=n>1?void 0:n?VX(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&&UX(t,r,o),o},BX=new cO("Engine",0),jX=function(e){OI(me,e);var t,r,n,i,o,a,s,c,u,d,l,h,p,v,f,_,m,g,y,S,b,E,k,T,I,A,R,C,w,x,O,P,M,D,N,L,U,V,F,B,j,G,H,z,K,X,q,Y,W,Q,J,Z,$,ee,te,re,ne,ie,oe,ae,se,ce,ue,de,le,he,pe,ve,fe,_e=YI(me);function me(e,t,r){var n;return Ll(this,me),Qd($T(n=_e.call(this)),"monitor",void 0),Qd($T(n),"_room",void 0),Qd($T(n),"_publicStreamManager",void 0),Qd($T(n),"_appId",void 0),Qd($T(n),"_businessId",void 0),Qd($T(n),"_visibility",!0),Qd($T(n),"_localVideoTrack",void 0),Qd($T(n),"_localAudioTrack",void 0),Qd($T(n),"_localImgVideoTrack",void 0),Qd($T(n),"_localImgScreenTrack",void 0),Qd($T(n),"_localScreenVideoTrack",void 0),Qd($T(n),"_localScreenAudioTrack",void 0),Qd($T(n),"_tempMixingAudioTrack",void 0),Qd($T(n),"_localAudioVolume",100),Qd($T(n),"_localScreenAudioVolume",100),Qd($T(n),"_remoteAudioVolume",new JS),Qd($T(n),"_remoteScreenAudioVolume",new JS),Qd($T(n),"_publicAudioVolume",new JS),Qd($T(n),"_videoPlayer",void 0),Qd($T(n),"_screenPlayer",void 0),Qd($T(n),"_remoteVideoPlayer",new JS),Qd($T(n),"_remoteScreenPlayer",new JS),Qd($T(n),"_remoteAudioPlayer",new JS),Qd($T(n),"_remoteScreenAudioPlayer",new JS),Qd($T(n),"_publicStreamAudioPlayer",new JS),Qd($T(n),"_publicStreamVideoPlayer",new JS),Qd($T(n),"_publicStreamIds",new JS),Qd($T(n),"_roomConfig",void 0),Qd($T(n),"_videoStreamConstraints",hM),Qd($T(n),"_audioStreamConstraints",{}),Qd($T(n),"_enableSimulcast",!1),Qd($T(n),"_videoStreamEncodeConfig",[hM]),Qd($T(n),"_screenStreamEncodeConfig",[pM]),Qd($T(n),"_dummyMainImage",void 0),Qd($T(n),"_dummyScreenImage",void 0),Qd($T(n),"_trackSourceType",void 0),Qd($T(n),"_liveTranscodeConfig",void 0),Qd($T(n),"_useCloudProxy",void 0),Qd($T(n),"_startCloudProxyTimestamp",void 0),Qd($T(n),"_localVideoDeviceId",void 0),Qd($T(n),"_localAudioDeviceId",void 0),Qd($T(n),"_pauseAllSubscribeState",{audio:void 0,video:void 0,resumeStreamIds:{}}),Qd($T(n),"_audioVolumeIndicationTimer",void 0),Qd($T(n),"_dummyMainTimer",void 0),Qd($T(n),"_dummyScreenTimer",void 0),Qd($T(n),"_audioPropertiesReportTimer",null),Qd($T(n),"_mirrorType",hl.MIRROR_TYPE_RENDER),Qd($T(n),"_audioMixingManager",void 0),Qd($T(n),"_pubLock",void 0),Qd($T(n),"_rtmClient",void 0),Qd($T(n),"_messageStatisticsObserver",void 0),Qd($T(n),"_tempRoomInfo",void 0),Qd($T(n),"_originIceConfigRequestUrls",void 0),Qd($T(n),"_originConfigServerUrls",void 0),Qd($T(n),"_originLogServerUrl",void 0),Qd($T(n),"_extensionManager",void 0),Qd($T(n),"_audioDeviceManager",void 0),Qd($T(n),"_audioProfileManager",void 0),Qd($T(n),"_remoteVideoConfig",new JS),Qd($T(n),"_userPriorityMap",new JS),Qd($T(n),"_subscribeFallbackOption",void 0),Qd($T(n),"_cameraCapturing",!1),Qd($T(n),"_interruptCameraCapture",!1),Qd($T(n),"_micCapturing",!1),Qd($T(n),"_interruptMicCapture",!1),Qd($T(n),"_avSync",!0),Qd($T(n),"_config",void 0),Qd($T(n),"_needClosePreTrack",!1),Qd($T(n),"_updateMixAudioTrack",function(){var e=Tm(Em().mark((function e(t){var r,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]:xl.PLAYOUT_AND_PUBLISH,BX.print("_updateMixAudioTrack()"),n._localAudioTrack){e.next=5;break}return t&&(n._tempMixingAudioTrack={track:t,type:i}),e.abrupt("return");case 5:if(t?(n._localAudioTrack.mixType=i,n._localAudioTrack.mixedAudioTrack=t):(delete n._localAudioTrack.mixType,delete n._localAudioTrack.mixedAudioTrack),null===(r=n._room)||void 0===r||!r.hasPublished){e.next=9;break}return e.next=9,n._updatePublish();case 9:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()),Qd($T(n),"_onAudioMixingMessage",(function(e){n.safeEmit(Ml.onAudioMixingStateChanged,e)})),Qd($T(n),"_onAudioMixingAutoplayFailed",(function(e){n.safeEmit(Ml.onAutoplayFailed,e)})),n.id=t,n._appId=e,n._pubLock=new nG("pubLock"),n._addDeviceEventHandler(),n._extensionManager=new ZU(t),n._audioDeviceManager=new IX(n._extensionManager),n._audioMixingManager=new yX({getLocalAudioTrack:function(){return n._localAudioTrack},updateLocalAudioTrack:n._updateMixAudioTrack,emitMessage:n._onAudioMixingMessage,onAutoPlayFailed:n._onAudioMixingAutoplayFailed},t),n._audioProfileManager=new AX(e),window.__rtc_engine__=$T(n),window["__rtc_engine__".concat(Math.floor(100*Math.random()+1))]=$T(n),n._trackSourceType={video:$d.VIDEO_SOURCE_TYPE_INTERNAL,screenVideo:$d.VIDEO_SOURCE_TYPE_INTERNAL,audio:el.AUDIO_SOURCE_TYPE_INTERNAL,screenAudio:el.AUDIO_SOURCE_TYPE_INTERNAL},n._config=r,n._rtmClient=new EX(t,e),n._handleRTMClient(n._rtmClient),n._useCloudProxy=!1,n._handleAudioDeviceManager(),n._messageStatisticsObserver=new vO(t),n.monitor=kO(t),pO.createRTSMsgReportor(n.id),n._getServerConfig(),n}return Nl(me,[{key:"appId",get:function(){return this._appId},set:function(e){this._appId=e}},{key:"updateToken",value:(fe=Tm(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(BX.print("updateToken()","token: %s",t),_M(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 hR(dR.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 fe.apply(this,arguments)})},{key:"setVideoCaptureDevice",value:(ve=Tm(Em().mark((function e(t){var r,n,i,o=this;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(BX.print("setVideoCaptureDevice()","deviceId: %s",t),_M(t,"deviceId"),this._localVideoDeviceId=t,this._localVideoTrack){e.next=5;break}return e.abrupt("return");case 5:return r=BB({},this._videoStreamConstraints),"user"===t||"environment"===t||"left"===t||"right"===t?(delete r.deviceId,r.facingMode=t):r.deviceId={exact:t},VP&&OP&&YP>=85&&YP<=91&&(null===(n=this._videoPlayer)||void 0===n||n.removeTrack()),this._needClosePreTrack&&(this._removeLocalTrackEvents(this._localVideoTrack),this._localVideoTrack.close(),delete this._localVideoTrack),BX.print("setVideoCaptureDevice()","start createCameraVideoTrack..."),e.next=12,bV(r,this._extensionManager).catch((function(e){if(o._localVideoTrack&&!o._localVideoTrack.dummy)return BX.print("setVideoCaptureDevice()","createCameraVideoTrack failed, stop pre VideoTrack."),o._removeLocalTrackEvents(o._localVideoTrack),o._localVideoTrack.close(),delete o._localVideoTrack,bV(r,o._extensionManager).then((function(e){return o._needClosePreTrack=!0,e})).catch(Tm(Em().mark((function t(){var r;return Em().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return BX.print("setVideoCaptureDevice()","createCameraVideoTrack failed, rollback."),t.next=3,bV(o._videoStreamConstraints,o._extensionManager);case 3:throw r=t.sent,o._switchTrack(r),e;case 6:case"end":return t.stop()}}),t)}))));throw e}));case 12:return i=e.sent,BX.print("setVideoCaptureDevice()","createCameraVideoTrack success."),this._videoStreamConstraints=r,this._localVideoTrack&&(this._removeLocalTrackEvents(this._localVideoTrack),this._localVideoTrack.close()),e.next=18,this._switchTrack(i);case 18:case"end":return e.stop()}}),e,this)}))),function(e){return ve.apply(this,arguments)})},{key:"setAudioCaptureDevice",value:(pe=Tm(Em().mark((function e(t){var r,n,i;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(BX.print("setAudioCaptureDevice()","deviceId: %s",t),_M(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.prev=8,this._micCapturing=!0,e.next=12,kV(this._audioProfileManager.getConstraints(),this._extensionManager);case 12:if(i=e.sent,!this._interruptMicCapture){e.next=17;break}return this._interruptMicCapture=!1,i.close(),e.abrupt("return");case 17:if(this._initLocalTrackEvents(i),this._localAudioTrack=i,this._localAudioTrack.setVolume(this._localAudioVolume),this._room){e.next=22;break}return e.abrupt("return");case 22:if(null===(r=this._room)||void 0===r||null===(n=r.localStream)||void 0===n||!n.pubAudio){e.next=25;break}return e.next=25,this._updatePublish();case 25:return e.prev=25,this._micCapturing=!1,e.finish(25);case 28:case"end":return e.stop()}}),e,this,[[8,,25,28]])}))),function(e){return pe.apply(this,arguments)})},{key:"_addDeviceEventHandler",value:function(){XU.on(Ml.onVideoDeviceStateChanged,this._onVideoDeviceStateChange.bind(this)),XU.on(Ml.onAudioDeviceStateChanged,this._onAudioDeviceStateChange.bind(this))}},{key:"_addHandlerEventHandler",value:function(){var e,t,r,n,i,o,a,s,c,u,d,l,h,p,v,f,_,m,g,y,S,b,E,k,T,I,A,R,C,w,x,O,P=this;null===(e=this._room)||void 0===e||e.on($M.ON_ADD_STREAM,this._onAddStream.bind(this)),null===(t=this._room)||void 0===t||t.on($M.ON_REMOVE_STREAM,this._onRemoveStream.bind(this)),null===(r=this._room)||void 0===r||r.on($M.USER_CONNECTION,this._onUserConnection.bind(this)),null===(n=this._room)||void 0===n||n.on(iG.ON_USER_LEAVE,this._onUserLeave.bind(this)),null===(i=this._room)||void 0===i||i.on(iG.ON_ROOM_ERROR,this._onRoomError.bind(this)),null===(o=this._room)||void 0===o||o.on(iG.ON_NETWORK_QUALITY,this._onNetworkQuality.bind(this)),null===(a=this._room)||void 0===a||a.on($M.ON_CUSTOM_MESSAGE,this._onCustomMessage.bind(this)),null===(s=this._room)||void 0===s||s.on($M.USER_MESSAGE_RECEIVED,this._onUserMessageReceived.bind(this)),null===(c=this._room)||void 0===c||c.on($M.USER_BINARY_MESSAGE_RECEIVED,this._onUserBinaryMessageReceived.bind(this)),null===(u=this._room)||void 0===u||u.on($M.ON_USER_TOKEN_WILL_EXPIRE,this._onUserTokenWillExpire.bind(this)),null===(d=this._room)||void 0===d||d.on($M.POST_PROCESSING_MESSAGE,(function(e){"2.0"===e.protocol?P._onStreamMixingEvent({error:e.error,event:e.eventType,message:e.message}):"publicStreamCallback"===e.type?P._onPushPublicStreamResult(e):"transcodeStatusCallback"===e.type&&P._onLiveTranscodingResult(e)})),null===(l=this._room)||void 0===l||l.on(tD.ON_CONNECTION_STATE_CHANGE,this._onConnectionStateChange.bind(this)),null===(h=this._room)||void 0===h||h.on(tD.ON_VENDOR_CONNECTION_STATE_CHANGE,(function(e){return P.safeEmit(Ml.onVendorConnectionStateChanged,e)})),null===(p=this._room)||void 0===p||p.on(iG.RESUBSCRIBE,this._onResubscribe.bind(this)),null===(v=this._room)||void 0===v||v.on(iG.SUBSCRIBE_PUSH_TRACK,this._onSubscribePushTrack.bind(this)),null===(f=this._room)||void 0===f||f.on(iG.REMOVE_PUSH_TRACK,this._onRemovePushTrack.bind(this)),null===(_=this._room)||void 0===_||_.on(iG.ON_PUBLISH_RESULT,(function(e){var t;null!==(t=P._room)&&void 0!==t&&t._roomConfig.isAutoPublish&&P.safeEmit(Ml.onAutoPublishResult,e)})),null===(m=this._room)||void 0===m||m.on(iG.ON_REMOTE_STREAM_STATS,(function(e){P.safeEmit(Ml.onRemoteStreamStats,e)})),null===(g=this._room)||void 0===g||g.on(iG.ON_LOCAL_STREAM_STATS,(function(e){P.safeEmit(Ml.onLocalStreamStats,e)})),null===(y=this._room)||void 0===y||y.on(iG.ON_SUBTITLE_STATE_CHANGED,(function(e){P.safeEmit(Ml.onSubtitleStateChanged,e)})),null===(S=this._room)||void 0===S||S.on(iG.ON_SUBTITLE_MESSAGE_RECEIVED,(function(e){P.safeEmit(Ml.onSubtitleMessageReceived,e)})),null===(b=this._room)||void 0===b||b.on(iG.ON_USER_PUBLISH_STATE_CHANGE,this._onUserPublishStateChange.bind(this)),null===(E=this._room)||void 0===E||E.on(iG.ON_USER_START_AUDIO_CAPTURE,(function(e,t){var r=e.userId;P._updateAudioPlayerState(t),P.safeEmit(Ml.onUserStartAudioCapture,{userId:r})})),null===(k=this._room)||void 0===k||k.on(iG.ON_USER_STOP_AUDIO_CAPTURE,(function(e){var t=e.userId;P.safeEmit(Ml.onUserStopAudioCapture,{userId:t})})),null===(T=this._room)||void 0===T||T.on(iG.ON_USER_START_VIDEO_CAPTURE,(function(e){var t=e.userId;P.safeEmit(Ml.onUserStartVideoCapture,{userId:t})})),null===(I=this._room)||void 0===I||I.on(iG.ON_USER_STOP_VIDEO_CAPTURE,(function(e){var t=e.userId;P.safeEmit(Ml.onUserStopVideoCapture,{userId:t})})),null===(A=this._room)||void 0===A||A.on(iG.ON_SEI_MESSAGED_RECEIVED,(function(e){P.safeEmit(Ml.onSEIMessageReceived,e)})),null===(R=this._room)||void 0===R||R.on(iG.ON_REMOTE_VIDEO_SIZE_CHANGED,(function(e,t){P.safeEmit(Ml.onRemoteVideoSizeChanged,e,t)})),null===(C=this._room)||void 0===C||C.on(iG.ON_SIMULCAST_SUBSCRIBE_FALLBACK,(function(e){return P.safeEmit(Ml.onSimulcastSubscribeFallback,e)})),null===(w=this._room)||void 0===w||w.on(iG.RECONNECT_FAILED,(function(){P.safeEmit(Ml.onError,{errorCode:dR.RECONNECT_FAILED})})),null===(x=this._room)||void 0===x||x.on(iG.ON_VIDEO_STREAM_BANNED,(function(e){P.safeEmit(Ml.onVideoStreamBanned,{uid:e.uid,banned:e.banned})})),null===(O=this._room)||void 0===O||O.on(iG.ON_AUDIO_STREAM_BANNED,(function(e){P.safeEmit(Ml.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 OM(e)&&IO(this.id,e,i),(t=wI(RI(me.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:"connect",value:(he=Tm(Em().mark((function e(){return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this._room){e.next=2;break}return e.abrupt("return",!1);case 2:return this._room=new VG({isAutoPublish:!0,isAutoSubscribeAudio:!0,isAutoSubscribeVideo:!0,roomProfileType:bl.communication},{id:this.id,audioProfileManager:this._audioProfileManager,streamRTT:{},subscribeFallbackOption:this._subscribeFallbackOption,userPriority:this._userPriorityMap,avSync:this._avSync,enableFallbackHandler:zX(this.appId)}),this._addHandlerEventHandler(),e.next=6,this._room.connect(this._appId);case 6:case"end":return e.stop()}}),e,this)}))),function(){return he.apply(this,arguments)})},{key:"joinRoom",value:(le=Tm(Em().mark((function e(t,r,n,i){var o,a,s,c,u,d,l;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(BX.print("joinRoom()","token: %o roomId: %o, userInfo: %o, roomConfig: %o",t,r,n,i),kM(t)||_M(t,"token"),TM(r),RM(n),CM(i=BB({isAutoPublish:!0,isAutoSubscribeAudio:!0,isAutoSubscribeVideo:!0,roomProfileType:bl.communication},i)),(null===(o=this._room)||void 0===o?void 0:o.connectionState)!==_G.CONNECTED){e.next=8;break}throw new hR(dR.REPEAT_JOIN,"Already joined");case 8:return this._room||(this._room=new VG(i,{id:this.id,audioProfileManager:this._audioProfileManager,streamRTT:{},subscribeFallbackOption:this._subscribeFallbackOption,userPriority:this._userPriorityMap,avSync:this._avSync,enableFallbackHandler:zX(this.appId)}),this._addHandlerEventHandler()),this._room.roomConfig=i,a=this._liveTranscodeConfig&&LX.getStartParams(this._liveTranscodeConfig),s=Zd(Zd({},n),{},{businessId:this._businessId,role:this._visibility?SX.NORMAL_USER:SX.SILENT_USER}),e.prev=12,this._useCloudProxy&&(this._startCloudProxyTimestamp=Date.now()),PG(s),e.next=17,this._room.join(this._appId,r,t,s,a,this._useCloudProxy,null===(c=this._config)||void 0===c?void 0:c.expectedIDC);case 17:return d=e.sent,this._roomConfig=i,this._audioProfileManager.setRoomId(r),this._tempRoomInfo&&delete this._tempRoomInfo,null!==(u=i)&&void 0!==u&&u.isAutoPublish&&(this._visibility?this._updatePublish({invokeByJoinRoom:!0,mediaType:ul.AUDIO_AND_VIDEO}):this.safeEmit(Ml.onAutoPublishResult,{isScreen:!1,state:ol.PUBLISH_FAIL})),pO.setRoomId(this.id,r),pO.setUserId(this.id,n.userId),e.abrupt("return",d);case 27:throw e.prev=27,e.t0=e.catch(12),e.t0.code===dR.INVALID_TOKEN&&(this._tempRoomInfo={config:i,roomId:r,userInfo:s}),null===(l=this._room)||void 0===l||l.destroy(),e.t0;case 32:case"end":return e.stop()}}),e,this,[[12,27]])}))),function(e,t,r,n){return le.apply(this,arguments)})},{key:"leaveRoom",value:(de=Tm(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],BX.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 JS,this._remoteScreenAudioPlayer.forEach((function(e){return e.destroy()})),this._remoteScreenAudioPlayer=new JS,this._remoteScreenPlayer.forEach((function(e){return e.destroy()})),this._remoteScreenPlayer=new JS,this._remoteVideoPlayer.forEach((function(e){return e.destroy()})),this._remoteVideoPlayer=new JS,this._roomConfig=void 0,this._publicStreamIds=new JS,pO.setRoomId(this.id,""),pO.setUserId(this.id,"");case 24:case"end":return e.stop()}}),e,this)}))),function(){return de.apply(this,arguments)})},{key:"destroy",value:function(){var e,t,r;BX.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=[hM],this._screenStreamEncodeConfig=[pM],this._pauseAllSubscribeState={audio:void 0,video:void 0,resumeStreamIds:{}},this._messageStatisticsObserver.destroy(),this.monitor.destroy(),pO.destroyRTSMsgReportor(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 JS,this._remoteScreenAudioPlayer.forEach((function(e){return e.destroy()})),this._remoteScreenAudioPlayer=new JS,this._remoteScreenPlayer.forEach((function(e){return e.destroy()})),this._remoteScreenPlayer=new JS,this._remoteVideoPlayer.forEach((function(e){return e.destroy()})),this._remoteVideoPlayer=new JS,this._publicStreamAudioPlayer.forEach((function(e){return e.destroy()})),this._publicStreamAudioPlayer=new JS,this._publicStreamVideoPlayer.forEach((function(e){return e.destroy()})),this._publicStreamVideoPlayer=new JS,this._roomConfig=void 0,this._audioMixingManager.destroy(),this._rtmClient.destroy(),null===(r=this._publicStreamManager)||void 0===r||r.destroy(),this._publicStreamIds=new JS,this._audioDeviceManager.destroy(),this._remoteVideoConfig=new JS,this._userPriorityMap.clear(),this._extensionManager.destroy(),this._cameraCapturing=!1,this._micCapturing=!1,this._interruptCameraCapture=!1,this._interruptMicCapture=!1,this._avSync=!0,this._localAudioVolume=100,this._localScreenAudioVolume=100,this._remoteAudioVolume.clear(),this._remoteScreenAudioVolume.clear(),this._publicAudioVolume.clear()}},{key:"publishStream",value:(ue=Tm(Em().mark((function e(t){return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(BX.print("publishStream()","mediaType: %o",t),this._checkMediaType(t),this._assertNotInRoom(),!vP(t)||this._localVideoTrack||!this._localImgVideoTrack){e.next=7;break}return e.next=6,mV(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=Tm(Em().mark((function e(t,r){var n;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(BX.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:aG.UNPUB});case 7:case"end":return e.stop()}}),e,this)}))),function(e,t){return ce.apply(this,arguments)})},{key:"publishScreen",value:(se=Tm(Em().mark((function e(t){return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(BX.print("publishScreen()","mediaType: %o",t),this._checkMediaType(t),this._assertNotInRoom(),e.prev=3,!vP(t)||this._localScreenVideoTrack||!this._localImgScreenTrack){e.next=8;break}return e.next=7,yV(this._localImgScreenTrack,this._extensionManager);case 7:this._localScreenVideoTrack=e.sent;case 8:return e.next=10,this._updateScreenPublish({mediaType:t,pubState:aG.PUB});case 10:e.next=19;break;case 12:if(e.prev=12,e.t0=e.catch(3),!(e.t0 instanceof hR)){e.next=18;break}throw e.t0;case 18:throw new hR(dR.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=Tm(Em().mark((function e(t){return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return BX.print("unpublishScreen()","mediaType: %o",t),this._checkMediaType(t),this._assertNotInRoom(),e.next=5,this._updateScreenPublish({mediaType:t,pubState:aG.UNPUB});case 5:case"end":return e.stop()}}),e,this)}))),function(e){return ae.apply(this,arguments)})},{key:"subscribeStream",value:(oe=Tm(Em().mark((function e(t,r){return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return BX.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=Tm(Em().mark((function e(t,r,n){var i,o,a,s,c,u,d,l,h,p,v,f,_,m,g,y;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._checkMediaType(n),this._assertNotInRoom(),n!==ul.AUDIO||null===(i=this._room)||void 0===i||!i.multiChatMode){e.next=5;break}return BX.print("subscribeStream()","due to multiChatMode return"),e.abrupt("return");case 5:if(u=this._room.remoteStreams.get(r),d=null==u?void 0:mE(u).call(u,(function(e){return e.isScreen===t}))){e.next=9;break}throw new hR(dR.STREAM_NOT_EXIST,"stream not exist");case 9:return l=this._pauseAllSubscribeState.audio,h=this._pauseAllSubscribeState.video,this._pauseAllSubscribeState.audio&&(n-=n&ul.AUDIO),this._pauseAllSubscribeState.video&&(n-=n&ul.VIDEO),BX.print("subscribeStream()","due to pauseAll mediaType: %o",n),p=d.hasSubscribed,v=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,v);case 19:pP(n)&&this._updateAudioPlayerState(d),vP(n)&&this._updateVideoPlayerState(d),f=0,_=0,l!==this._pauseAllSubscribeState.audio&&(this._pauseAllSubscribeState.audio?f|=ul.AUDIO:_|=ul.AUDIO),h!==this._pauseAllSubscribeState.video&&(this._pauseAllSubscribeState.video?f|=ul.VIDEO:_|=ul.VIDEO),f&&this.pauseAllSubscribedStream(f),_&&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:il.SUBSCRIBE_SUCC},this.safeEmit(Ml.onAutoSubscribeResult,m)),null!==(c=this._room)&&void 0!==c&&c.multiChatMode||p||!pP(n)||!d.hasAudio||null===(g=d.observer)||void 0===g||g.setSubscribeAudio(!0),!p&&vP(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=Tm(Em().mark((function e(t,r){return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:BX.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=Tm(Em().mark((function e(t,r){return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return BX.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=Tm(Em().mark((function e(t,r){return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:BX.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!==ul.AUDIO||null===(i=this._room)||void 0===i||!i.multiChatMode){var a=this._room.remoteStreams.get(t),s=null==a?void 0:mE(a).call(a,(function(t){return t.isScreen===e}));if(null==s||!s.hasSubscribed)throw new hR(dR.STREAM_NOT_EXIST,"stream not exist");if(VP&&YP&&YP>=85&&YP<=91&&r!==ul.AUDIO)(e?this._remoteScreenPlayer.get(t):this._remoteVideoPlayer.get(t)).stop();return this._room.unsubscribe(s,r).then((function(){n||delete o._pauseAllSubscribeState.resumeStreamIds[s.streamId]}))}BX.print("subscribeStream()","due to multiChatMode return")}},{key:"setRemoteVideoConfig",value:(ee=Tm(Em().mark((function e(t,r){var n;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return BX.print("setRemoteVideoConfig() userId: %o, remoteVideoConfig: %o",t,r),IM(t),PM(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:($=Tm(Em().mark((function e(t){var r,n,i,o,a,s,c,u,d,l,h,p=this;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(BX.print("startVideoCapture()","deviceId: %s",t),kM(t)||_M(t,"deviceId"),t=t||this._localVideoDeviceId,this._localVideoDeviceId=t,this._trackSourceType.video!==$d.VIDEO_SOURCE_TYPE_EXTERNAL){e.next=6;break}throw new hR(dR.STREAM_TYPE_NOT_MATCH,"setVideoSourceType as internal first");case 6:if(!(this._cameraCapturing||this._localVideoTrack&&!this._localVideoTrack.dummy)){e.next=8;break}throw new hR(dR.REPEAT_CAPTURE,"Has already capture");case 8:return a=this._videoStreamConstraints,t&&("user"===t||"environment"===t||"left"===t||"right"===t?a.facingMode=t:a.deviceId={exact:t},this._videoStreamConstraints=a),s={},e.prev=11,this._cameraCapturing=!0,e.next=15,bV(a,this._extensionManager);case 15:if(u=e.sent,!this._interruptCameraCapture){e.next=21;break}throw this._interruptCameraCapture=!1,this._removeLocalTrackEvents(u),u.close(),new hR(dR.INTERRUPT,"interrupt by stopVideoCapture");case 21:if(this._initLocalTrackEvents(u),this._localVideoTrack=u,null===(c=this._videoPlayer)||void 0===c||c.playVideo(u),(d=null==u?void 0:u.getTrack())&&(s=d.getSettings(),l={width:s.width,height:s.height},this._localVideoTrack.resolution=l,setTimeout((function(){return p.safeEmit(Ml.onLocalVideoSizeChanged,{streamIndex:cl.STREAM_INDEX_MAIN,info:l})}))),this._room){e.next=28;break}return e.abrupt("return",s);case 28:return e.prev=28,this._cameraCapturing=!1,e.finish(28);case 31:return h=this._room._roomConfig.isAutoPublish,(null!==(r=this._room)&&void 0!==r&&null!==(n=r.localStream)&&void 0!==n&&n.pubVideo||h)&&(this._visibility?this._updatePublish():this.safeEmit(Ml.onAutoPublishResult,{isScreen:!1,state:ol.PUBLISH_FAIL})),null===(i=this._room.localStream)||void 0===i||null===(o=i.observer)||void 0===o||o.setEnableVideo(!0),e.abrupt("return",s);case 35:case"end":return e.stop()}}),e,this,[[11,,28,31]])}))),function(e){return $.apply(this,arguments)})},{key:"stopVideoCapture",value:(Z=Tm(Em().mark((function e(){var t,r,n,i,o,a,s,c;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(BX.print("stopVideoCapture()"),!this._cameraCapturing){e.next=5;break}return this._interruptCameraCapture=!0,BX.print("stopVideoCapture()","capturing"),e.abrupt("return");case 5:if(this._trackSourceType.video!==$d.VIDEO_SOURCE_TYPE_EXTERNAL){e.next=7;break}throw new hR(dR.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||((s=this._extensionManager.getPluginByName(JU.PRE_PROCESSING,"RTCBeautyExtension"))&&s.emit("stop"),this._removeLocalTrackEvents(this._localVideoTrack),this._localVideoTrack.close(),this._localImgVideoTrack?(null===(c=this._localVideoTrack)||void 0===c||c.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||null===(n=r.localStream)||void 0===n||!n.pubVideo){e.next=14;break}return e.next=14,this._updatePublish();case 14:null===(i=this._room)||void 0===i||null===(o=i.localStream)||void 0===o||null===(a=o.observer)||void 0===a||a.setEnableVideo(!1);case 15:case"end":return e.stop()}}),e,this)}))),function(){return Z.apply(this,arguments)})},{key:"startAudioCapture",value:(J=Tm(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(BX.print("startAudioCapture()","deviceId: $o",t),kM(t)||_M(t,"deviceId"),t=t||this._localAudioDeviceId,this._localAudioDeviceId=t,this._trackSourceType.audio!==el.AUDIO_SOURCE_TYPE_EXTERNAL){e.next=6;break}throw new hR(dR.STREAM_TYPE_NOT_MATCH,"setAudioSourceType as internal first");case 6:if(!this._micCapturing&&!this._localAudioTrack){e.next=8;break}throw new hR(dR.REPEAT_CAPTURE,"Has already capture");case 8:return t&&this._audioProfileManager.updateConstraints({deviceId:{exact:t}}),e.prev=9,this._micCapturing=!0,e.next=13,kV(this._audioProfileManager.getConstraints(),this._extensionManager);case 13:if(a=e.sent,!this._interruptMicCapture){e.next=19;break}throw this._interruptMicCapture=!1,this._removeLocalTrackEvents(a),a.close(),new hR(dR.INTERRUPT,"interrupt by stopAudioCapture");case 19:if(this._initLocalTrackEvents(a),this._localAudioTrack=a,this._localAudioTrack.setVolume(this._localAudioVolume),this._tempMixingAudioTrack&&(this._localAudioTrack.mixType=this._tempMixingAudioTrack.type,this._localAudioTrack.mixedAudioTrack=this._tempMixingAudioTrack.track,delete this._tempMixingAudioTrack),this._room){e.next=25;break}return e.abrupt("return");case 25:return e.prev=25,this._micCapturing=!1,e.finish(25);case 28:s=this._room._roomConfig.isAutoPublish,(null!==(r=this._room)&&void 0!==r&&null!==(n=r.localStream)&&void 0!==n&&n.pubAudio||s)&&(this._visibility?this._updatePublish():this.safeEmit(Ml.onAutoPublishResult,{isScreen:!1,state:ol.PUBLISH_FAIL})),null===(i=this._room.localStream)||void 0===i||null===(o=i.observer)||void 0===o||o.setEnableAudio(!0);case 31:case"end":return e.stop()}}),e,this,[[9,,25,28]])}))),function(e){return J.apply(this,arguments)})},{key:"stopAudioCapture",value:(Q=Tm(Em().mark((function e(){var t,r,n,i;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(BX.print("stopAudioCapture()"),!this._micCapturing){e.next=5;break}return this._interruptMicCapture=!0,BX.print("stopAudioCapture()","capturing"),e.abrupt("return");case 5:if(this._trackSourceType.audio!==el.AUDIO_SOURCE_TYPE_EXTERNAL){e.next=7;break}throw new hR(dR.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(null===(t=this._room)||void 0===t||null===(r=t.localStream)||void 0===r||!r.pubAudio){e.next=15;break}return e.next=15,this._updatePublish();case 15:null===(n=this._room.localStream)||void 0===n||null===(i=n.observer)||void 0===i||i.setEnableAudio(!1);case 16:case"end":return e.stop()}}),e,this)}))),function(){return Q.apply(this,arguments)})},{key:"getAudioMixingManager",value:function(){return BX.print("getAudioMixingManager()","invoke"),this._audioMixingManager}},{key:"startScreenCapture",value:(W=Tm(Em().mark((function e(){var t,r,n,i,o,a,s,c,u,d,l,h,p,v,f,_,m=this,g=arguments;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(c=g.length>0&&void 0!==g[0]?g[0]:{},BX.print("startScreenCapture()","config: %o",c),u=c.enableAudio,d=void 0!==u&&u,this._trackSourceType.screenVideo!==$d.VIDEO_SOURCE_TYPE_EXTERNAL){e.next=5;break}throw new hR(dR.STREAM_TYPE_NOT_MATCH,"setVideoSourceType as internal first");case 5:if(this._trackSourceType.screenAudio!==el.AUDIO_SOURCE_TYPE_EXTERNAL){e.next=7;break}throw new hR(dR.STREAM_TYPE_NOT_MATCH,"setAudioSourceType as internal first");case 7:return e.next=9,IV(d,this._extensionManager,this._screenStreamEncodeConfig[0]);case 9:if(l=e.sent,h=ZT(l,2),p=h[0],null==(v=h[1])||v.setVolume(this._localScreenAudioVolume),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=p,null!==(r=this._screenStreamEncodeConfig[0])&&void 0!==r&&r.contentHint&&p.setContentHint(null===(f=this._screenStreamEncodeConfig[0])||void 0===f?void 0:f.contentHint),(_=null==p?void 0:p.getTrack())&&setTimeout((function(){var e=_.getSettings(),t={width:e.width,height:e.height};p.resolution=t,m.safeEmit(Ml.onLocalVideoSizeChanged,{streamIndex:cl.STREAM_INDEX_SCREEN,info:{width:e.width,height:e.height}})}),500),v&&(this._localScreenAudioTrack=v,this._initLocalTrackEvents(v)),null===(n=this._screenPlayer)||void 0===n||n.playVideo(this._localScreenVideoTrack),this._initLocalTrackEvents(this._localScreenVideoTrack,!0),!(null!==(i=this._room)&&void 0!==i&&null!==(o=i.localScreenStream)&&void 0!==o&&o.pubAudio||null!==(a=this._room)&&void 0!==a&&null!==(s=a.localScreenStream)&&void 0!==s&&s.pubVideo)){e.next=27;break}return e.next=27,this._updateScreenPublish();case 27:case"end":return e.stop()}}),e,this)}))),function(){return W.apply(this,arguments)})},{key:"stopScreenCapture",value:(Y=Tm(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(BX.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===(a=this._localScreenVideoTrack)||void 0===a||a.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&&null!==(n=r.localScreenStream)&&void 0!==n&&n.pubAudio||null!==(i=this._room)&&void 0!==i&&null!==(o=i.localScreenStream)&&void 0!==o&&o.pubVideo)){e.next=8;break}return e.next=8,this._updateScreenPublish();case 8:case"end":return e.stop()}}),e,this)}))),function(){return Y.apply(this,arguments)})},{key:"setLocalVideoPlayer",value:function(e,t){if(BX.print("setLocalVideoPlayer()","streamIndex: %o, videoPlayerOption: %o",e,t),mM(e,"streamIndex",[cl.STREAM_INDEX_MAIN,cl.STREAM_INDEX_SCREEN]),t&&t.renderDom){var r,n,i,o,a=Zd(Zd({userId:this._getUserId()},t),{},{isLocal:!0});if(wM(a),e===cl.STREAM_INDEX_MAIN&&!this._videoPlayer)return this._videoPlayer=new KG(this.id,a),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)!==kl.PLAY_MANUALLY&&this._videoPlayer.playVideo(this._localVideoTrack),(null===(n=this._room)||void 0===n?void 0:n.localStream)&&(this._room.localStream.videoDom=this._videoPlayer.domElement),this._videoPlayer.domElement;if(e===cl.STREAM_INDEX_SCREEN&&!this._screenPlayer)return this._screenPlayer=new KG(this.id,Zd(Zd({},a),{},{isScreen:!0,isLocal:!0})),this._initPlayerEvents(this._screenPlayer,!1,e),this._localScreenVideoTrack&&!this._localScreenVideoTrack.dummy&&(null===(i=this._config)||void 0===i?void 0:i.autoPlayPolicy)!==kl.PLAY_MANUALLY&&this._screenPlayer.playVideo(this._localScreenVideoTrack),(null===(o=this._room)||void 0===o?void 0:o.localScreenStream)&&(this._room.localScreenStream.videoDom=this._screenPlayer.domElement),this._screenPlayer.domElement;if(t&&void 0!==t.renderMode){var s=e===cl.STREAM_INDEX_MAIN?this._videoPlayer:this._screenPlayer;null==s||s.setRenderMode(t.renderMode)}}else{var c,u;e===cl.STREAM_INDEX_MAIN?(null===(c=this._videoPlayer)||void 0===c||c.destroy(!0),delete this._videoPlayer):(null===(u=this._screenPlayer)||void 0===u||u.destroy(),delete this._screenPlayer)}}},{key:"startLiveTranscoding",value:(q=Tm(Em().mark((function e(t){var r,n,i;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(BX.print("startLiveTranscoding()","transcode: %o",t),LX.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 hR(dR.INVALID_PARAMS,"The roomId+userId must be within 126 bytes");case 6:if(e.prev=6,this.safeEmit(Ml.onStreamMixingEvent,{event:oG.START,error:0,message:""}),!this._room||this._room.connectionState!==_G.CONNECTED){e.next=11;break}return e.next=11,null===(i=this._room)||void 0===i?void 0:i.liveControlMessage(LX.getStartParams(this._liveTranscodeConfig));case 11:e.next=20;break;case 13:if(e.prev=13,e.t0=e.catch(6),!(e.t0 instanceof hR)){e.next=19;break}throw e.t0;case 19:throw new hR(dR.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=Tm(Em().mark((function e(t){var r,n,i,o;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(BX.print("updateLiveTranscoding()","transcode: %o",t),this._liveTranscodeConfig){e.next=3;break}return e.abrupt("return");case 3:return delete(i=BB({},t)).audio,null===(r=i.video)||void 0===r||delete r.codec,null===(n=i.video)||void 0===n||delete n.gop,LX.checckUpdateParams(i),this._liveTranscodeConfig=BB(this._liveTranscodeConfig,i),e.prev=9,this.safeEmit(Ml.onStreamMixingEvent,{event:oG.UPDATE,error:0,message:""}),e.next=13,null===(o=this._room)||void 0===o?void 0:o.liveControlMessage(LX.getUpdateParams(this._liveTranscodeConfig));case 13:e.next=22;break;case 15:if(e.prev=15,e.t0=e.catch(9),!(e.t0 instanceof hR)){e.next=21;break}throw e.t0;case 21:throw new hR(dR.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=Tm(Em().mark((function e(){var t;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(BX.print("stopLiveTranscoding()"),this._liveTranscodeConfig){e.next=3;break}return e.abrupt("return");case 3:return delete this._liveTranscodeConfig,e.prev=4,this.safeEmit(Ml.onStreamMixingEvent,{event:oG.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 hR)){e.next=16;break}throw e.t0;case 16:throw new hR(dR.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=Tm(Em().mark((function e(t){var r;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return BX.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;BX.print("stopSubtitle()","invoke"),null===(e=this._room)||void 0===e||e.stopSubtitle()}},{key:"setBusinessId",value:function(e){return BX.print("setBusinessId()","businessId: %s",e),!function(e){return"string"!=typeof e}(e)&&!this._room&&(this.monitor.set({rtc_business_id:e}),this._businessId=e,!0)}},{key:"setUserVisibility",value:(H=Tm(Em().mark((function e(t){var r,n;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(BX.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?SX.NORMAL_USER:SX.SILENT_USER});case 15:this._visibility=t,t&&null!==(r=this._roomConfig)&&void 0!==r&&r.isAutoPublish&&this._updatePublish({mediaType:ul.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]:cl.STREAM_INDEX_MAIN,i=n===cl.STREAM_INDEX_SCREEN;e.on("playback_event",(function(n){switch(n.eventName){case"timeupdate":return;case"loadeddata":if("audio"===n.type){var o,a,s=e.userId.replace("_screen",""),c=null===(o=t._room)||void 0===o||null===(a=o.remoteStreams.get(s))||void 0===a?void 0:mE(a).call(a,(function(e){return e.isScreen===i})),u=function(){r?t.safeEmit(Ml.onFirstPublicStreamAudioFrameDecoded,{publicStreamId:s}):(t.safeEmit(Ml.onAudioFirstFrameDecoded,{userId:s,isScreen:i}),t.safeEmit(Ml.onRemoteAudioFirstFrame,{userId:s,isScreen:i})),t.monitor.report("first_remote_audio_render",{stream_id:"",stream_user_id:s||""},{isScreen:i})};c&&c.observer&&!c.observer.audioFirstFrameReceived?c.observer.once("recvAudioFirstFrame",u):u()}else{var d,l,h={userId:e.userId,height:(null===(d=e.domElement)||void 0===d?void 0:d.videoHeight)||0,width:(null===(l=e.domElement)||void 0===l?void 0:l.videoWidth)||0,isScreen:i};r?(h.publicStreamId=h.userId,delete h.userId,delete h.isScreen,t.safeEmit(Ml.onFirstPublicStreamVideoFrameRendered,h),t.safeEmit(Ml.onFirstPublicStreamVideoFrameDecoded,h)):e.isLocal||(t.safeEmit(Ml.onVideoFirstFrameRendered,h),t.safeEmit(Ml.onVideoFirstFrameDecoded,h),t.safeEmit(Ml.onRemoteVideoFirstFrame,h)),t.monitor.report("first_remote_video_render",{stream_id:"",stream_user_id:n.userId||""},{isScreen:i})}break;case"autoplay-error":return r&&(n.publicStreamId=n.userId),AO(t.id,"autoplay-error",e instanceof KG?"video":"audio",0,n.userId||""),void t.safeEmit(Ml.onAutoplayFailed,{userId:n.userId,kind:e instanceof KG?"video":"audio",mediaType:e instanceof KG?ul.VIDEO:ul.AUDIO,streamIndex:e.isScreen?cl.STREAM_INDEX_SCREEN:cl.STREAM_INDEX_MAIN})}t.safeEmit(Ml.onPlayerEvent,n)}))}},{key:"_initLocalTrackEvents",value:function(e){var t=this,r=arguments.length>1&&void 0!==arguments[1]&&arguments[1];["track-ended","track-mute","track-unmute"].forEach((function(r){e.on(r,function(){var e=Tm(Em().mark((function e(n){var i,o;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t.monitor.report("rtc_error",{message:wm(i="track-".concat(r," mediaType: ")).call(i,n.getTrack().kind),error_code:-1001}),o=!1,n!==t._localScreenAudioTrack&&n!==t._localScreenVideoTrack||(o=!0),t.safeEmit({"track-ended":Ml.onTrackEnded,"track-mute":Ml.onTrackMute,"track-unmute":Ml.onTrackUnmute}[r],{kind:n.getTrack().kind,isScreen:o}),"track-mute"!==r||!UP){e.next=8;break}return e.next=7,t.stopAudioCapture();case 7:t.startAudioCapture();case 8:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}())})),e.on("resolution-change",(function(e){t._extensionManager.getPluginsByType(JU.PRE_PROCESSING).forEach((function(t){var r;null==t||null===(r=t.applyConstraints)||void 0===r||r.call(t,e)})),t.safeEmit(Ml.onLocalVideoSizeChanged,{streamIndex:r?cl.STREAM_INDEX_SCREEN:cl.STREAM_INDEX_MAIN,info:e})}))}},{key:"_removeLocalTrackEvents",value:function(e){e.removeAllListeners("track-ended"),e.removeAllListeners("track-mute"),e.removeAllListeners("track-unmute"),e.removeAllListeners("resolution-change")}},{key:"setRemoteVideoPlayer",value:function(e,t){BX.print("setRemoteVideoPlayer()","streamIndex: %o, videoPlayerOption: %o",e,t),mM(e,"streamIndex",[cl.STREAM_INDEX_MAIN,cl.STREAM_INDEX_SCREEN]),wM(t);var r,n,i,o=t.userId;if(e===cl.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 KG(this.id,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:mE(c).call(c,(function(e){return!e.isScreen}));return d&&(this._updateVideoPlayerState(d),d.videoDom=u.domElement),u.domElement}if(null===(r=this._remoteScreenPlayer.get(o))||void 0===r||r.destroy(),t.renderDom){var l=new KG(this.id,Zd(Zd({},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:mE(i).call(i,(function(e){return e.isScreen}));return h&&(this._updateVideoPlayerState(h),h.videoDom=l.domElement),l.domElement}}},{key:"setLocalVideoMirrorType",value:function(e){BX.print("setLocalVideoMirrorType()","mirrorType: %o",e),mM(e,"mirrorType",[hl.MIRROR_TYPE_NONE,hl.MIRROR_TYPE_RENDER]),this._mirrorType=e,this._videoPlayer&&this._videoPlayer.mirror(!!e)}},{key:"setAudioPlaybackDevice",value:(G=Tm(Em().mark((function e(t){var r;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return BX.print("setAudioPlaybackDevice()","deviceId: %s",t),_M(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(Ml.onAudioPlaybackDeviceChanged,r),this.monitor.report("rtc_audio_device",{audio_event:"playout_device_switch",message:Mm(r),error_code:0});case 9:case"end":return e.stop()}}),e,this)}))),function(e){return G.apply(this,arguments)})},{key:"play",value:(j=Tm(Em().mark((function e(t){var r,n,i,o,a,s,c,u,d,l,h,p,v,f,_,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]:ul.AUDIO_AND_VIDEO,a=g.length>2?g[2]:void 0,BX.print("play()","userId: %s, mediaType: %s, streamIndex: %s",t,o,a),s=!t||t===this._getUserId()||"local_user"===t,c=void 0===a||a===cl.STREAM_INDEX_MAIN,u=void 0===a||a===cl.STREAM_INDEX_SCREEN,d=o!==ul.VIDEO,l=o!==ul.AUDIO,h=[],s&&l&&(c&&this._localVideoTrack&&(null===(p=this._videoPlayer)||void 0===p||p.mirror(!!this._mirrorType),h.push(null===(v=this._videoPlayer)||void 0===v?void 0:v.manuallyPlay())),u&&this._localScreenVideoTrack&&h.push(null===(f=this._screenPlayer)||void 0===f?void 0:f.manuallyPlay())),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(qG(this._remoteVideoPlayer,t,!1,_)),l&&u&&h.push(qG(this._remoteScreenPlayer,t,!0,_)),d&&c&&h.push(qG(this._remoteAudioPlayer,t,!1,_)),l&&u&&h.push(qG(this._remoteScreenAudioPlayer,t,!0,_)),m=null===(i=this._publicStreamManager)||void 0===i?void 0:i.remoteStreams,d&&h.push(qG(this._publicStreamVideoPlayer,t,!1,m)),l&&h.push(qG(this._publicStreamAudioPlayer,t,!1,m)),e.abrupt("return",q_.all(h).then((function(){})));case 20:case"end":return e.stop()}}),e,this)}))),function(e){return j.apply(this,arguments)})},{key:"pauseAllSubscribedStream",value:(B=Tm(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(BX.print("pauseAllSubscribedStream()","mediaType: %o",t),this._checkMediaType(t),pP(t)&&(s._pauseAllSubscribeState.audio=!0),vP(t)&&(s._pauseAllSubscribeState.video=!0),this._room){e.next=6;break}return e.abrupt("return",q_.resolve());case 6:n=[],i=JT(rA(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",q_.all(n).then((function(){})));case 10:case"end":return e.stop()}}),e,this)}))),function(e){return B.apply(this,arguments)})},{key:"resumeAllSubscribedStream",value:(F=Tm(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(BX.print("resumeAllSubscribedStream()","mediaType: %o",t),this._checkMediaType(t),pP(t)&&(s._pauseAllSubscribeState.audio=!1),vP(t)&&(s._pauseAllSubscribeState.video=!1),this._room){e.next=6;break}return e.abrupt("return",q_.resolve());case 6:n=[],i=JT(rA(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",q_.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=Tm(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 IM(t),xM(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=Tm(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 IM(t),SM(r,"message"),xM(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=Tm(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 xM(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:(N=Tm(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 xM(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 N.apply(this,arguments)})},{key:"setAudioCaptureConfig",value:(D=Tm(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]:{},BX.print("setAudioCaptureConfig()","config: %o",t),delete t.deviceId,bM(t),this._shouldUpdateAudioConf("setAudioCaptureConfig")&&this._audioProfileManager.updateConstraints(t);case 5:case"end":return e.stop()}}),e,this)}))),function(){return D.apply(this,arguments)})},{key:"setVideoCaptureConfig",value:(M=Tm(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]:{},BX.print("setVideoCaptureConfig()","config: %o",t),e.abrupt("return",this._setVideoCaptureConfig(t));case 3:case"end":return e.stop()}}),e,this)}))),function(){return M.apply(this,arguments)})},{key:"_setVideoCaptureConfig",value:(P=Tm(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,bM(r),n=Zd(Zd({},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 P.apply(this,arguments)})},{key:"enableSimulcastMode",value:function(e){var t;return BX.print("enableSimulcastMode()","enabled: %o",e),this._enableSimulcast=e,14!==(null==KP?void 0:KP[0])&&(null!==(t=this._room)&&void 0!==t&&t.hasPublished&&SP("You must call this API before publishing the video streams"),!0)}},{key:"setVideoEncoderConfig",value:(O=Tm(Em().mark((function e(t){var r,n,i;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:for(BX.print("setVideoEncoderConfig()"," descriptions: %o",t),Array.isArray(t)||(t=[t]),DM(t=Gs(t).call(t,(function(e){return!!e}))),t.length>3&&(SP("setVideoEncoderConfig: You can set parameters for up to 3 streams"),t=bm(t).call(t,0,3)),n=1;n<t.length;n++)i=bP(t[0].width)/bP(t[n].width)||1,Math.floor(i)!==i&&SP("setVideoEncoderConfig: The resolution setting needs to be an integer multiple");FA(t).call(t,(function(e,t){return t.maxKbps-e.maxKbps})),this._setVideoCaptureConfig(Zd({},t[0])),this._videoStreamEncodeConfig=t,this._updateDummyCaptureImage(cl.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 O.apply(this,arguments)})},{key:"setScreenEncoderConfig",value:(x=Tm(Em().mark((function e(t){var r;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:BX.print("setScreenEncoderConfig()","description: %o",t),this._screenStreamEncodeConfig=[t],this._localScreenVideoTrack&&(this._localScreenVideoTrack.updateVideoCaptureConfig(t),t.contentHint&&this._localScreenVideoTrack.setContentHint(t.contentHint)),this._updateDummyCaptureImage(cl.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 x.apply(this,arguments)})},{key:"sendSEIMessage",value:function(e,t,r){if(BX.print("sendSEIMessage()","streamIdex: %o, message: %o, repeatCount: %o",e,t,r),!uL())throw new hR(dR.NOT_SUPPORTED,"Browser does not support sending SEI");mM(e,"streamIndex",[cl.STREAM_INDEX_MAIN,cl.STREAM_INDEX_SCREEN]),fM(r,"repeatCount",0,30);var n="string"==typeof t?new Uint8Array(ZO.str2ab(t)):t;if(t.length){var i;if(e===cl.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)BX.print("sei size must not bigger than 4KB");else{var l=WO();i.seiList.push({content:n,uuid:l,repeatCount:r}),setTimeout((function(){var e;if(i){var t,r=YA(e=i.seiList).call(e,(function(e){return e.uuid===l}));if(r)ek(t=i.seiList).call(t,r,1)}}),2e3)}}else BX.print("sei message must not be empty")}},{key:"setAudioVolumeIndicationInterval",value:function(e){var t=this;BX.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=mE(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(Ml.onAudioVolumeIndication,{speakers:r})}),e)}},{key:"_sendActiveSpeaker",value:function(e,t){if(this._room&&this._room.remoteUsers.size>=1){var r,n=e[0],i=lb(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(Ml.onActiveSpeaker,{userId:o.userId,extraInfo:o.extraInfo})}}}},{key:"enableAudioPropertiesReport",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};BX.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:cl.STREAM_INDEX_MAIN,audioPropertiesInfo:{linearVolume:i,nonlinearVolume:hP(i)}})}if(e._localScreenAudioTrack){var o=e._localScreenAudioTrack.getAudioLevel();t.push({streamIndex:cl.STREAM_INDEX_SCREEN,audioPropertiesInfo:{linearVolume:o,nonlinearVolume:hP(o)}})}if(e.safeEmit(Ml.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:cl.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:hP(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?cl.STREAM_INDEX_SCREEN:cl.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:hP(o)}})}}))}));e.safeEmit(Ml.onRemoteAudioPropertiesReport,s),e._sendActiveSpeaker(t,Gs(s).call(s,(function(e){return e.streamKey.streamIndex!==cl.STREAM_INDEX_SCREEN})))}}}),o))}},{key:"setVideoSourceType",value:(w=Tm(Em().mark((function e(t,r){var n,i,o,a,s,c,u,d,l,h,p,v,f,_,m,g,y,S,b,E,k,T,I,A,R;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(BX.print("setVideoSourceType()","index: %o, videoSourceType: %o",t,r),mM(t,"streamIndex",[cl.STREAM_INDEX_MAIN,cl.STREAM_INDEX_SCREEN]),mM(r,"VideoSourceType",[$d.VIDEO_SOURCE_TYPE_EXTERNAL,$d.VIDEO_SOURCE_TYPE_INTERNAL]),n=t===cl.STREAM_INDEX_MAIN?"video":"screenVideo",this._trackSourceType[n]===r){e.next=26;break}if(this._trackSourceType[n]=r,BX.print("setVideoSourceType",wm(i="set ".concat(n," source type to ")).call(i,r)),!this._localVideoTrack||t!==cl.STREAM_INDEX_MAIN){e.next=17;break}if(u=!1,r===$d.VIDEO_SOURCE_TYPE_EXTERNAL&&(u=!0,(d=this._extensionManager.getPluginByName(JU.PRE_PROCESSING,"RTCBeautyExtension"))&&d.emit("stop"),this._removeLocalTrackEvents(this._localVideoTrack),this._localVideoTrack.close()),null===(o=this._videoPlayer)||void 0===o||o.stop(),this._localVideoTrack=void 0,l=null===(a=this._room)||void 0===a?void 0:a._roomConfig.isAutoPublish,u?null===(h=this._room)||void 0===h||null===(p=h.localStream)||void 0===p||null===(v=p.observer)||void 0===v||v.setEnableVideo(!1):null===(f=this._room)||void 0===f||null===(_=f.localStream)||void 0===_||null===(m=_.observer)||void 0===m||m.setPushVideo(!1),!(null!==(s=this._room)&&void 0!==s&&null!==(c=s.localStream)&&void 0!==c&&c.pubVideo||l)){e.next=17;break}return e.next=17,this._updatePublish();case 17:if(!this._localScreenVideoTrack||t!==cl.STREAM_INDEX_SCREEN){e.next=26;break}if(b=!1,r===$d.VIDEO_SOURCE_TYPE_EXTERNAL&&(b=!0,this._removeLocalTrackEvents(this._localScreenVideoTrack),this._localScreenVideoTrack.close()),null===(g=this._screenPlayer)||void 0===g||g.stop(),this._localScreenVideoTrack=void 0,b?null===(E=this._room)||void 0===E||null===(k=E.localScreenStream)||void 0===k||null===(T=k.observer)||void 0===T||T.setEnableVideo(!1):null===(I=this._room)||void 0===I||null===(A=I.localScreenStream)||void 0===A||null===(R=A.observer)||void 0===R||R.setPushVideo(!1),null===(y=this._room)||void 0===y||null===(S=y.localScreenStream)||void 0===S||!S.pubVideo){e.next=26;break}return e.next=26,this._updateScreenPublish();case 26:case"end":return e.stop()}}),e,this)}))),function(e,t){return w.apply(this,arguments)})},{key:"setExternalVideoTrack",value:(C=Tm(Em().mark((function e(t,r){var n,i,o,a,s,c,u,d,l,h,p;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(BX.print("setExternalVideoTrack()","index: %o, track: %o",t,r),mM(t,"streamIndex",[cl.STREAM_INDEX_MAIN,cl.STREAM_INDEX_SCREEN]),gM(r),t!==cl.STREAM_INDEX_MAIN){e.next=15;break}if(this._trackSourceType.video===$d.VIDEO_SOURCE_TYPE_EXTERNAL){e.next=6;break}throw new hR(dR.STREAM_TYPE_NOT_MATCH,"setVideoSourceType as external first");case 6:return e.next=8,CV(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),s=null===(i=this._room)||void 0===i?void 0:i._roomConfig.isAutoPublish,!(null!==(o=this._room)&&void 0!==o&&null!==(a=o.localStream)&&void 0!==a&&a.pubVideo||s)){e.next=15;break}return e.next=15,this._updatePublish();case 15:if(t!==cl.STREAM_INDEX_SCREEN){e.next=27;break}if(this._trackSourceType.screenVideo===$d.VIDEO_SOURCE_TYPE_EXTERNAL){e.next=18;break}throw new hR(dR.STREAM_TYPE_NOT_MATCH,"setVideoSourceType as external first");case 18:return e.next=20,PV(r,this._extensionManager);case 20:if(this._localScreenVideoTrack=e.sent,this._initLocalTrackEvents(this._localScreenVideoTrack,!0),null===(c=this._screenPlayer)||void 0===c||c.playVideo(this._localScreenVideoTrack),null===(u=this._room)||void 0===u||null===(d=u.localScreenStream)||void 0===d||null===(l=d.observer)||void 0===l||l.setPushVideo(!0),null===(h=this._room)||void 0===h||null===(p=h.localScreenStream)||void 0===p||!p.pubVideo){e.next=27;break}return e.next=27,this._updateScreenPublish();case 27:case"end":return e.stop()}}),e,this)}))),function(e,t){return C.apply(this,arguments)})},{key:"setAudioSourceType",value:(R=Tm(Em().mark((function e(t,r){var n,i,o,a,s,c,u,d,l,h,p,v,f,_,m,g,y,S,b,E,k,T;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(BX.print("setAudioSourceType()","index: %o, audioSourceType: %o",t,r),mM(t,"streamIndex",[cl.STREAM_INDEX_MAIN,cl.STREAM_INDEX_SCREEN]),mM(r,"audioSourceType",[el.AUDIO_SOURCE_TYPE_EXTERNAL,el.AUDIO_SOURCE_TYPE_INTERNAL]),n=t===cl.STREAM_INDEX_MAIN?"audio":"screenAudio",this._trackSourceType[n]===r){e.next=24;break}if(this._trackSourceType[n]=r,BX.print("setVideoSourceType",wm(i="set ".concat(n," source type to ")).call(i,r)),!this._localAudioTrack||t!==cl.STREAM_INDEX_MAIN){e.next=16;break}if(c=!1,this._trackSourceType.audio===el.AUDIO_SOURCE_TYPE_EXTERNAL&&(c=!0,this._removeLocalTrackEvents(this._localAudioTrack),this._localAudioTrack.close()),this._localAudioTrack=void 0,u=null===(o=this._room)||void 0===o?void 0:o._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.setEnableAudio(!1):null===(p=this._room)||void 0===p||null===(v=p.localStream)||void 0===v||null===(f=v.observer)||void 0===f||f.setPushAudio(!1),!(null!==(a=this._room)&&void 0!==a&&null!==(s=a.localStream)&&void 0!==s&&s.pubAudio||u)){e.next=16;break}return e.next=16,this._updatePublish();case 16:if(!this._localScreenAudioTrack||t!==cl.STREAM_INDEX_SCREEN){e.next=24;break}if(g=!1,this._trackSourceType.audio===el.AUDIO_SOURCE_TYPE_EXTERNAL&&(g=!0,this._removeLocalTrackEvents(this._localScreenAudioTrack),this._localScreenAudioTrack.close()),this._localScreenAudioTrack=void 0,g?null===(y=this._room)||void 0===y||null===(S=y.localScreenStream)||void 0===S||null===(b=S.observer)||void 0===b||b.setEnableAudio(!1):null===(E=this._room)||void 0===E||null===(k=E.localScreenStream)||void 0===k||null===(T=k.observer)||void 0===T||T.setPushAudio(!1),null===(_=this._room)||void 0===_||null===(m=_.localScreenStream)||void 0===m||!m.pubAudio){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=Tm(Em().mark((function e(t,r){var n,i,o,a,s,c,u,d,l,h,p,v;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(BX.print("setExternalAudioTrack()","index: %o, track: %o",t,r),mM(t,"streamIndex",[cl.STREAM_INDEX_MAIN,cl.STREAM_INDEX_SCREEN]),gM(r),t!==cl.STREAM_INDEX_MAIN){e.next=16;break}if(this._trackSourceType.audio===el.AUDIO_SOURCE_TYPE_EXTERNAL){e.next=6;break}throw new hR(dR.STREAM_TYPE_NOT_MATCH,"setAudioSourceType as external first");case 6:return e.next=8,xV(r,this._extensionManager);case 8:if(this._localAudioTrack=e.sent,this._localAudioTrack.setVolume(this._localAudioVolume),this._initLocalTrackEvents(this._localAudioTrack),u=null===(n=this._room)||void 0===n?void 0:n._roomConfig.isAutoPublish,null===(i=this._room)||void 0===i||null===(o=i.localStream)||void 0===o||null===(a=o.observer)||void 0===a||a.setPushAudio(!0),!(null!==(s=this._room)&&void 0!==s&&null!==(c=s.localStream)&&void 0!==c&&c.pubAudio||u)){e.next=16;break}return e.next=16,this._updatePublish();case 16:if(t!==cl.STREAM_INDEX_SCREEN){e.next=28;break}if(this._trackSourceType.screenAudio===el.AUDIO_SOURCE_TYPE_EXTERNAL){e.next=19;break}throw new hR(dR.STREAM_TYPE_NOT_MATCH,"setAudioSourceType as external first");case 19:return e.next=21,DV(r,this._extensionManager);case 21:if(this._localScreenAudioTrack=e.sent,this._localScreenAudioTrack.setVolume(this._localScreenAudioVolume),this._initLocalTrackEvents(this._localScreenAudioTrack),null===(d=this._room)||void 0===d||null===(l=d.localScreenStream)||void 0===l||null===(h=l.observer)||void 0===h||h.setPushAudio(!0),null===(p=this._room)||void 0===p||null===(v=p.localScreenStream)||void 0===v||!v.pubAudio){e.next=28;break}return e.next=28,this._updateScreenPublish();case 28:case"end":return e.stop()}}),e,this)}))),function(e,t){return A.apply(this,arguments)})},{key:"login",value:(I=Tm(Em().mark((function e(t,r){return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return BX.print("login()","token: %o, userInfo: %o",t,r),kM(t)||_M(t,"token"),IM(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=Tm(Em().mark((function e(){return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return BX.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=Tm(Em().mark((function e(t){return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return BX.print("updateLoginToken()","token: %o",t),kM(t)||_M(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:(E=Tm(Em().mark((function e(t){return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return BX.print("getPeerOnlineStatus()","userId: %o",t),IM(t),e.abrupt("return",this._rtmClient.getPeerOnlineStatus(t));case 3:case"end":return e.stop()}}),e,this)}))),function(e){return E.apply(this,arguments)})},{key:"sendUserMessageOutsideRoom",value:(b=Tm(Em().mark((function e(t,r){var n,i=this;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return IM(t),xM(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 b.apply(this,arguments)})},{key:"sendUserBinaryMessageOutsideRoom",value:(S=Tm(Em().mark((function e(t,r){var n,i=this;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return IM(t),SM(r,"message"),xM(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=Tm(Em().mark((function e(t,r){return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return BX.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=Tm(Em().mark((function e(t){var r,n=this;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return _M(t,"message"),xM(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=Tm(Em().mark((function e(t){var r,n=this;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return SM(t,"message"),xM(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 hR(dR.START_CLOUD_PROXY_AFTER_JOIN,"[startCloudProxy] should be invoke before join room ");BX.print("startCloudProxy()",e),_M(e.logProxy,"logProxy"),_M(e.accessProxy,"accessProxy"),_M(e.configProxy,"configProxy"),this._originIceConfigRequestUrls=dM("ICE_CONFIG_REQUEST_URLS"),this._originLogServerUrl=dM("LOG_SERVER_URL"),this._originConfigServerUrls=dM("CONFIG_REQUEST_DOMAINS"),uM("ICE_CONFIG_REQUEST_URLS",e.accessProxy),uM("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)),uM("CONFIG_REQUEST_DOMAINS",[e.configProxy]),this._useCloudProxy=!0}},{key:"stopCloudProxy",value:function(){if(this._room)throw new hR(dR.STOP_CLOUD_PROXY_BEFORE_LEAVE,"[stopCloudProxy] should be invoke after leave room ");BX.print("stopCloudProxy()"),uM("ICE_CONFIG_REQUEST_URLS",[]),uM("LOG_SERVER_URL",this._originLogServerUrl),uM("CONFIG_REQUEST_DOMAINS",this._originConfigServerUrls),this._useCloudProxy=!1,this._startCloudProxyTimestamp=void 0}},{key:"startPushPublicStream",value:(_=Tm(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(BX.print("startPushPublicStream()","publicStreamId: %o, publicStreamParam: %o",t,r),AM(t),this._assertNotInRoom(),!this._publicStreamIds.get(t)){e.next=5;break}throw new hR(dR.REPEAT_PUSH,"repeat push public media stream");case 5:return o=lM(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:(f=Tm(Em().mark((function e(t,r){var n,i;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return BX.print("startPushPublicStream()","publicStreamId: %o, publicStreamParam: %o",t,r),AM(t),this._assertNotInRoom(),i=lM(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 f.apply(this,arguments)})},{key:"stopPushPublicStream",value:(v=Tm(Em().mark((function e(t){var r,n=this;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return BX.print("startPushPublicStream()","publicStreamId: %o",t),AM(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 v.apply(this,arguments)})},{key:"startPlayPublicStream",value:(p=Tm(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(AM(t),this._publicStreamManager){e.next=8;break}return this._publicStreamManager=new kX(this.id,this._appId,{businessId:this._businessId}),this._publicStreamManager.on(iG.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(Ml.onPublicStreamStats,e)})),null===(n=this._publicStreamManager)||void 0===n||n.on(iG.ON_SEI_MESSAGED_RECEIVED,(function(e){c.safeEmit(Ml.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(this.id,t,{muted:(null===(s=this._config)||void 0===s?void 0:s.autoPlayPolicy)===kl.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 p.apply(this,arguments)})},{key:"stopPlayPublicStream",value:(h=Tm(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=Tm(Em().mark((function e(t){return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:BX.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;BX.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 KG(this.id,Zd(Zd({},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)!==kl.PLAY_MANUALLY&&a.playVideo(s.videoTrack,s)}else this._publicStreamVideoPlayer.delete(e)}},{key:"setDummyCaptureImagePath",value:(d=Tm(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 q_((function(e,i){_M(r,"filePath");var o=new Image;o.crossOrigin="anonymous",o.src=r,o.onload=function(){t===cl.STREAM_INDEX_MAIN?n._dummyMainImage=o:n._dummyScreenImage=o;try{n._updateDummyCaptureImage(t),e()}catch(r){i(new hR(dR.UNEXPECTED_ERROR,r.message))}},o.onerror=function(){i(new hR(dR.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===cl.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=bP(r.width),c=bP(r.height);if(!a)throw new hR(dR.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===cl.STREAM_INDEX_MAIN?(clearInterval(this._dummyMainTimer),this._dummyMainTimer=u):(clearInterval(this._dummyScreenTimer),this._dummyScreenTimer=u);var d,l,h,p,v=o.captureStream(5).getVideoTracks()[0];if(e===cl.STREAM_INDEX_MAIN){if(this._localImgVideoTrack=v,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=v,null!==(h=this._localScreenVideoTrack)&&void 0!==h&&h.dummy)null===(p=this._localScreenVideoTrack)||void 0===p||p.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()}))})),e.on("reset-video-effect",Tm(Em().mark((function e(){return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!t._localVideoTrack||t._localVideoTrack.dummy){e.next=6;break}return t._localVideoTrack&&t._removeLocalTrackEvents(t._localVideoTrack),e.next=4,t._localVideoTrack.generatePreProcessingTrack(t._extensionManager);case 4:return e.next=6,t._switchTrack(t._localVideoTrack);case 6:case"end":return e.stop()}}),e)}))))}},{key:"registerExtension",value:(u=Tm(Em().mark((function e(t){return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t.monitor=this.monitor,e.prev=1,e.next=4,t.isSupported();case 4:if(e.sent){e.next=7;break}throw new Error("This extension is not supported.");case 7:e.next=12;break;case 9:throw e.prev=9,e.t0=e.catch(1),new Error("This extension is not supported.");case 12:return e.next=14,t.init({videoCaptureConfig:this._videoStreamConstraints});case 14:this._extensionManager.register(t),this._addListenExtensionEvent(t);case 16:case"end":return e.stop()}}),e,this,[[1,9]])}))),function(e){return u.apply(this,arguments)})},{key:"defaultTranscoding",value:function(){return JSON.parse(Mm(LX.getDefaultValue()))}},{key:"_updatePublish",value:(c=Tm(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]:{},BX.print("_updatePublish()","config: %o",t),r={mediaType:void 0,invokeByJoinRoom:!1,pubState:aG.PUB},t=Zd(Zd({},r),t),this._visibility){e.next=6;break}throw new hR(dR.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===_G.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:this._videoPlayer&&this._room.localStream&&(this._room.localStream.videoDom=this._videoPlayer.domElement),e.next=25;break;case 18:if(e.prev=18,e.t0=e.catch(12),!(e.t0 instanceof hR)){e.next=24;break}throw e.t0;case 24:throw new hR(dR.UNEXPECTED_ERROR,"unexpected error",e.t0);case 25:return e.prev=25,n(),e.finish(25);case 28:case"end":return e.stop()}}),e,this,[[12,18,25,28]])}))),function(){return c.apply(this,arguments)})},{key:"startAudioPlaybackDeviceTest",value:(s=Tm(Em().mark((function e(t,r){return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return BX.print("startAudioPlaybackDeviceTest()","filePath: %o, indicationInterval: %o",t,r),_M(t,"filePath"),fM(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(){BX.print("stopAudioPlaybackDeviceTest()"),this._audioDeviceManager.stopAudioPlaybackDeviceTest()}},{key:"startAudioDeviceRecordTest",value:(a=Tm(Em().mark((function e(t,r){return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return BX.print("startAudioDeviceRecordTest()","indicationInterval: %o",t),fM(t,"indicationInterval"),e.next=4,this._audioDeviceManager.startAudioDeviceRecordTest(t,r,this._localAudioVolume);case 4:case"end":return e.stop()}}),e,this)}))),function(e,t){return a.apply(this,arguments)})},{key:"stopAudioDeviceRecordAndPlayTest",value:function(){BX.print("stopAudioDeviceRecordAndPlayTest()"),this._audioDeviceManager.stopAudioDeviceRecordAndPlayTest()}},{key:"stopAudioDevicePlayTest",value:function(){BX.print("stopAudioDevicePlayTest()"),this._audioDeviceManager.stopAudioDevicePlayTest()}},{key:"setRemoteUserPriority",value:function(e,t){var r;BX.print("setRemoteUserPriority()","userId: %o, priority: %o",e,t);try{IM(e),mM(t,"priority",[gl.HIGH,gl.MEDIUM,gl.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=Tm(Em().mark((function e(t){var r,n;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(BX.print("takeLocalSnapshot()","streamIndex: %o",t),mM(t,"streamIndex",[cl.STREAM_INDEX_MAIN,cl.STREAM_INDEX_SCREEN]),r=t===cl.STREAM_INDEX_MAIN?this.localVideoTrack:this.localScreenVideoTrack){e.next=5;break}throw new hR(dR.INVOKED_BEFORE_CAPTURE,"capture first");case 5:return n=t===cl.STREAM_INDEX_MAIN?this._videoPlayer:this._screenPlayer,e.abrupt("return",wX(r.getTrack("preprocessing"),(null==n?void 0:n.mirrorType)===hl.MIRROR_TYPE_RENDER,n));case 7:case"end":return e.stop()}}),e,this)}))),function(e){return o.apply(this,arguments)})},{key:"takeRemoteSnapshot",value:(i=Tm(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(BX.print("takeRemoteSnapshot()","id: %o, streamIndex: %o",t,r),_M(t,"id"),mM(r,"streamIndex",[cl.STREAM_INDEX_MAIN,cl.STREAM_INDEX_SCREEN]),c=(null===(n=this._room)||void 0===n||null===(i=n.remoteStreams.get(t))||void 0===i||null===(o=mE(i).call(i,(function(e){return e.isScreen===(r===cl.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 hR(dR.STREAM_NOT_EXIST,"stream not exist");case 6:return e.abrupt("return",wX(c.getTrack(),!1,r===cl.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){BX.print("setSubscribeFallbackOption()","option: %o",e);try{mM(e,"option",[ml.DISABLE,ml.VIDEO_STREAM_LOW,ml.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===cl.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 LV&&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===cl.STREAM_INDEX_MAIN)a=mE(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=mE(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:"setCaptureVolume",value:function(e,t){var r,n,i;(mM(e,"streamIndex",[cl.STREAM_INDEX_MAIN,cl.STREAM_INDEX_SCREEN]),t=NM(t,"volume",0,400),e===cl.STREAM_INDEX_SCREEN)?(null===(r=this._localScreenAudioTrack)||void 0===r||r.setVolume(t),this._localScreenAudioVolume=t):(null===(n=this._localAudioTrack)||void 0===n||n.setVolume(t),null===(i=this._audioDeviceManager.audioTrack)||void 0===i||i.setVolume(t),this._localAudioVolume=t)}},{key:"setPlaybackVolume",value:function(e,t,r){var n,i,o;if(IM(e),mM(t,"streamIndex",[cl.STREAM_INDEX_MAIN,cl.STREAM_INDEX_SCREEN]),r=NM(r,"volume",0,400),null!==(n=this._room)&&void 0!==n&&n.multiChatMode)SP("setPlaybackVolume is not supported in Conference mode");else{var a=t===cl.STREAM_INDEX_SCREEN;a?this._remoteScreenAudioVolume.set(e,r):this._remoteAudioVolume.set(e,r),null===(i=this._room)||void 0===i||null===(o=i.remoteStreams.get(e))||void 0===o||o.forEach((function(e){var t;e.isScreen===a&&(null===(t=e.audioTrack)||void 0===t||t.setVolume(r))}))}}},{key:"setPublicStreamVolume",value:function(e,t){var r,n,i;_M(e,"publicStreamId"),t=NM(t,"volume",0,400),this._publicAudioVolume.set(e,t),null===(r=this._publicStreamManager)||void 0===r||null===(n=r.remoteStreams.get(e))||void 0===n||null===(i=n.audioTrack)||void 0===i||i.setVolume(t)}},{key:"_reportMsTrackEvent",value:function(e,t){var r=this;if(!e.hookStop){e.hookStop=!0;var n=e.stop;e.stop=function(){AO(r.id,"stop",t,0,t),n.call(e)}}}},{key:"_updateScreenPublish",value:(n=Tm(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]:{},BX.print("_updateScreenPublish()"),r={mediaType:void 0,pubState:aG.PUB},t=Zd(Zd({},r),t),e.next=6,this._pubLock.lock();case 6:if(n=e.sent,this._room&&this._room.connectionState===_G.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:this._screenPlayer&&this._room.localScreenStream&&(this._room.localScreenStream.videoDom=this._screenPlayer.domElement),e.next=23;break;case 16:if(e.prev=16,e.t0=e.catch(10),!(e.t0 instanceof hR)){e.next=22;break}throw e.t0;case 22:throw new hR(dR.UNEXPECTED_ERROR,"unexpected error",e.t0);case 23:return e.prev=23,n(),e.finish(23);case 26:case"end":return e.stop()}}),e,this,[[10,16,23,26]])}))),function(){return n.apply(this,arguments)})},{key:"_updateAudioPlayerState",value:function(e){BX.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,s,c,u=n?null!==(a=this._remoteScreenAudioVolume.get(r))&&void 0!==a?a:100:null!==(s=this._remoteAudioVolume.get(r))&&void 0!==s?s:100;if(e.audioTrack.setVolume(u),!o){var d;o=new XG(this.id,r,{muted:(null===(d=this._config)||void 0===d?void 0:d.autoPlayPolicy)===kl.VIDEO_ONLY,isScreen:n}),this._initPlayerEvents(o,!1,n?cl.STREAM_INDEX_SCREEN:cl.STREAM_INDEX_MAIN),i.set(r,o);var l=this._audioDeviceManager.getSinkId();l&&o.setPlaybackDevice(l)}(null===(c=this._config)||void 0===c?void 0:c.autoPlayPolicy)!==kl.PLAY_MANUALLY&&o.playAudio(e.audioTrack),xP&&MP&&(t=this._remoteAudioPlayer,NX&&clearTimeout(NX),NX=setTimeout((function(){var e,r=JT(t);try{for(r.s();!(e=r.n()).done;){var n=ZT(e.value,2),i=n[0],o=n[1];null!=i&&uR(i).call(i,"mux")&&o.pause()}}catch(l){r.e(l)}finally{r.f()}var a,s=JT(t);try{for(s.s();!(a=s.n()).done;){var c=ZT(a.value,2),u=c[0],d=c[1];null!=u&&uR(u).call(u,"mux")&&d.manuallyPlay()}}catch(l){s.e(l)}finally{s.f()}}),2e3))}else{var h;null===(h=o)||void 0===h||h.stop()}}},{key:"_updateVideoPlayerState",value:function(e){var t;BX.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)!==kl.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=Tm(Em().mark((function e(t){var r,n,i,o,a,s,c,u,d;return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if((n=t.stream).videoDom=null===(r=this._remoteVideoPlayer.get(n.userId))||void 0===r?void 0:r.domElement,i=null==n?void 0:n.attributes,o=i.localaudio,a=i.audiostream,s=i.localvideo,c=i.videostream,u=VV.NONE,a&&(u|=ul.AUDIO),c&&(u|=ul.VIDEO),!u){e.next=12;break}return e.next=9,new q_((function(e){return setTimeout(e)}));case 9:null!=n&&n.isScreen?this.safeEmit(Ml.onUserPublishScreen,{userId:n.userId,mediaType:u}):(this.safeEmit(Ml.onUserPublishStream,{userId:n.userId,mediaType:u,videoStreamDescriptions:null==n||null===(d=n.attributes)||void 0===d?void 0:d.videoDescriptions}),this._handleAutoSubscribe(n,!0)),this.safeEmit("onAddStream",{userId:n.userId,mediaType:u,isScreen:!(null==n||!n.isScreen)}),null!=n&&n.isScreen||(o&&this.safeEmit(Ml.onUserStartAudioCapture,{userId:n.userId}),s&&this.safeEmit(Ml.onUserStartVideoCapture,{userId:n.userId}));case 12:case"end":return e.stop()}}),e,this)}))),function(e){return r.apply(this,arguments)})},{key:"_handleAutoSubscribe",value:function(e,t){var r,n,i=VV.NONE;if(null!==(r=this._roomConfig)&&void 0!==r&&r.isAutoSubscribeAudio&&(i|=ul.AUDIO),null!==(n=this._roomConfig)&&void 0!==n&&n.isAutoSubscribeVideo&&(i|=ul.VIDEO),i){var o,a;if(t&&pP(i))null===(o=e.observer)||void 0===o||o.setAutoSubscribeAudio(!0);if(t&&vP(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=HX[e.reason])&&void 0!==t?t:dl.STREAM_REMOVE_REASON_OTHER,o=n.isScreen?Ml.onUserUnpublishScreen:Ml.onUserUnpublishStream,a=VV.NONE;n.attributes.audiostream&&(a|=ul.AUDIO),n.attributes.videostream&&(a|=ul.VIDEO),a!==VV.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){n.isScreen?(r._remoteScreenPlayer.delete(n.userId),r._remoteScreenAudioPlayer.delete(n.userId)):(r._remoteAudioPlayer.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(Ml.onUserJoined,e)}))}},{key:"_onUserLeave",value:function(e){this.safeEmit(Ml.onUserLeave,e)}},{key:"_onRoomError",value:function(e){var t;this.safeEmit(Ml.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=[Ml.onNetworkQuality]).call(e,r))}},{key:"_onConnectionStateChange",value:function(e){if(void 0!==this._startCloudProxyTimestamp&&this._useCloudProxy&&e.state===ll.CONNECTION_STATE_CONNECTED&&this.safeEmit(Ml.onCloudProxyConnected,{interval:Date.now()-this._startCloudProxyTimestamp}),this.safeEmit(Ml.onConnectionStateChanged,e),e.state===ll.CONNECTION_STATE_RECONNECTING){var t,r=JT(this._remoteAudioPlayer);try{for(r.s();!(t=r.n()).done;){var n=ZT(t.value,2),i=n[0],o=n[1];null!=i&&uR(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(Ml.onVideoDeviceStateChanged,e)}},{key:"_onAudioDeviceStateChange",value:function(e){this.safeEmit(Ml.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&ul.AUDIO&&setTimeout((function(){r._updateAudioPlayerState(s)})),i)?a===aG.PUB?this.safeEmit(Ml.onUserPublishScreen,c):this.safeEmit(Ml.onUserUnpublishScreen,Zd(Zd({},c),{},{reason:dl.STREAM_REMOVE_REASON_UNPUBLISH})):a===aG.PUB?(c.videoStreamDescriptions=null==s||null===(t=s.attributes)||void 0===t?void 0:t.videoDescriptions,this.safeEmit(Ml.onUserPublishStream,c),this._handleAutoSubscribe(s,!0)):this.safeEmit(Ml.onUserUnpublishStream,Zd(Zd({},c),{},{reason:dl.STREAM_REMOVE_REASON_UNPUBLISH}))}},{key:"_onCustomMessage",value:function(e){var t=e.message;e.binary?this.safeEmit(Ml.onRoomBinaryMessageReceived,{userId:e.clientId,message:t}):this.safeEmit(Ml.onRoomMessageReceived,{userId:e.clientId,message:t})}},{key:"_onUserMessageReceived",value:function(e){this._messageStatisticsObserver.recvP2PMessage(e.userId),this.safeEmit(Ml.onUserMessageReceived,e)}},{key:"_onUserBinaryMessageReceived",value:function(e){this._messageStatisticsObserver.recvP2PMessage(e.userId),this.safeEmit(Ml.onUserBinaryMessageReceived,e)}},{key:"_onLiveTranscodingResult",value:function(e){this.safeEmit(Ml.onLiveTranscodingResult,e)}},{key:"_onStreamMixingEvent",value:function(e){this.safeEmit(Ml.onStreamMixingEvent,e)}},{key:"_onUserTokenWillExpire",value:function(){this.safeEmit(Ml.onTokenWillExpire)}},{key:"_onPushPublicStreamResult",value:function(e){this.safeEmit(Ml.onPushPublicStreamResult,e)}},{key:"_handleRTMClient",value:function(e){var t=this;e.on("onUserMessageReceivedOutsideRoom",(function(e){t._messageStatisticsObserver.recvP2POutRoomMessage(e.userId),t.safeEmit(Ml.onUserMessageReceivedOutsideRoom,e)})),e.on("onUserBinaryMessageReceivedOutsideRoom",(function(e){t._messageStatisticsObserver.recvP2POutRoomMessage(e.userId),t.safeEmit(Ml.onUserBinaryMessageReceivedOutsideRoom,e)})),e.on("onUserDisconnection",(function(){t.safeEmit(Ml.onError,{errorCode:dR.RTM_DUPLICATE_LOGIN})})),e.on("onRTMTokenError",(function(){t.safeEmit(Ml.onError,{errorCode:dR.RTM_TOKEN_ERROR})})),e.on("onServerParamsSetResult",(function(e){t.safeEmit(Ml.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(Ml.onAudioPlaybackDeviceTestVolume,t)}))}},{key:"_assertNotInRoom",value:function(){if(!this._room||this._room.connectionState!==_G.CONNECTED)throw new hR(dR.NOT_CONNECTED_YET,"server not connected")}},{key:"_checkMediaType",value:function(e){mM(e,"mediaType",[ul.AUDIO,ul.VIDEO,ul.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=Tm(Em().mark((function e(t){var r,n,i;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||null===(i=n.localStream)||void 0===i||!i.pubVideo){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,n,i=(null===(t=this._room)||void 0===t?void 0:t.hasPublished)||(null===(r=this._room)||void 0===r||null===(n=r.localStream)||void 0===n?void 0:n.pubAudio)||this._localAudioTrack&&this._localAudioTrack.sourceType===$U.INTERNAL;if(i){var o="engine.".concat(e," should be called before publishing or capturing.");console.warn("[RTC WebSDK]: "+o),AO(this.id,e,o)}return!i}},{key:"_getServerConfig",value:function(){var e=this,t=nM.getServerConfig(this.appId);t.rts_report&&pO.setConfig(t.rts_report),CO({engineId:this.id,appId:this.appId,sdkVersion:dM("VERSION"),requestDomains:dM("CONFIG_REQUEST_DOMAINS"),keys:["rts_report","web_rtc_config"],deviceId:dM("DEVICE_ID")}).then((function(t){nM.setServerConfig(e.appId,t)}))}}]),me}(FM);FX([TO()],jX.prototype,"updateToken",1),FX([TO()],jX.prototype,"setVideoCaptureDevice",1),FX([TO()],jX.prototype,"setAudioCaptureDevice",1),FX([function(e,t,r){if("function"==typeof r.value){var n=r.value;r.value=function(){for(var e,t=kO(this.id),r=arguments.length,i=new Array(r),o=0;o<r;o++)i[o]=arguments[o];return null==t||t.set({room_id:i[1],user_id:null===(e=i[2])||void 0===e?void 0:e.userId}),n.apply(this,i)}}},TO()],jX.prototype,"connect",1),FX([TO()],jX.prototype,"joinRoom",1),FX([TO()],jX.prototype,"leaveRoom",1),FX([TO()],jX.prototype,"destroy",1),FX([TO()],jX.prototype,"publishStream",1),FX([TO()],jX.prototype,"unpublishStream",1),FX([TO()],jX.prototype,"publishScreen",1),FX([TO()],jX.prototype,"unpublishScreen",1),FX([TO()],jX.prototype,"subscribeStream",1),FX([TO()],jX.prototype,"unsubscribeStream",1),FX([TO()],jX.prototype,"subscribeScreen",1),FX([TO()],jX.prototype,"unsubscribeScreen",1),FX([TO()],jX.prototype,"setRemoteVideoConfig",1),FX([TO()],jX.prototype,"startVideoCapture",1),FX([TO()],jX.prototype,"stopVideoCapture",1),FX([TO()],jX.prototype,"startAudioCapture",1),FX([TO()],jX.prototype,"stopAudioCapture",1),FX([TO()],jX.prototype,"getAudioMixingManager",1),FX([TO()],jX.prototype,"startScreenCapture",1),FX([TO()],jX.prototype,"stopScreenCapture",1),FX([TO()],jX.prototype,"setLocalVideoPlayer",1),FX([TO()],jX.prototype,"startLiveTranscoding",1),FX([TO()],jX.prototype,"updateLiveTranscoding",1),FX([TO()],jX.prototype,"stopLiveTranscoding",1),FX([TO()],jX.prototype,"startSubtitle",1),FX([TO()],jX.prototype,"stopSubtitle",1),FX([TO()],jX.prototype,"setBusinessId",1),FX([TO()],jX.prototype,"setUserVisibility",1),FX([TO()],jX.prototype,"setRemoteVideoPlayer",1),FX([TO()],jX.prototype,"setLocalVideoMirrorType",1),FX([TO()],jX.prototype,"setAudioPlaybackDevice",1),FX([TO()],jX.prototype,"play",1),FX([TO()],jX.prototype,"pauseAllSubscribedStream",1),FX([TO()],jX.prototype,"resumeAllSubscribedStream",1),FX([TO()],jX.prototype,"sendUserMessage",1),FX([TO()],jX.prototype,"sendUserBinaryMessage",1),FX([TO()],jX.prototype,"sendRoomMessage",1),FX([TO()],jX.prototype,"sendRoomBinaryMessage",1),FX([TO()],jX.prototype,"setAudioCaptureConfig",1),FX([yP("4.51"),TO()],jX.prototype,"setVideoCaptureConfig",1),FX([TO()],jX.prototype,"enableSimulcastMode",1),FX([TO()],jX.prototype,"setVideoEncoderConfig",1),FX([TO()],jX.prototype,"setScreenEncoderConfig",1),FX([TO()],jX.prototype,"sendSEIMessage",1),FX([yP("4.42"),TO()],jX.prototype,"setAudioVolumeIndicationInterval",1),FX([TO()],jX.prototype,"enableAudioPropertiesReport",1),FX([TO()],jX.prototype,"setVideoSourceType",1),FX([TO()],jX.prototype,"setExternalVideoTrack",1),FX([TO()],jX.prototype,"setAudioSourceType",1),FX([TO()],jX.prototype,"setExternalAudioTrack",1),FX([TO()],jX.prototype,"login",1),FX([TO()],jX.prototype,"logout",1),FX([TO()],jX.prototype,"updateLoginToken",1),FX([TO()],jX.prototype,"getPeerOnlineStatus",1),FX([TO()],jX.prototype,"sendUserMessageOutsideRoom",1),FX([TO()],jX.prototype,"sendUserBinaryMessageOutsideRoom",1),FX([TO()],jX.prototype,"setServerParams",1),FX([TO()],jX.prototype,"sendServerMessage",1),FX([TO()],jX.prototype,"sendServerBinaryMessage",1),FX([TO()],jX.prototype,"startCloudProxy",1),FX([TO()],jX.prototype,"stopCloudProxy",1),FX([TO()],jX.prototype,"startPushPublicStream",1),FX([TO()],jX.prototype,"updatePublicStreamParam",1),FX([TO()],jX.prototype,"stopPushPublicStream",1),FX([TO("streamId")],jX.prototype,"startPlayPublicStream",1),FX([TO("streamId")],jX.prototype,"stopPlayPublicStream",1),FX([TO()],jX.prototype,"setAudioProfile",1),FX([TO()],jX.prototype,"setPublicStreamVideoPlayer",1),FX([TO()],jX.prototype,"setDummyCaptureImagePath",1),FX([TO()],jX.prototype,"registerExtension",1),FX([TO()],jX.prototype,"startAudioPlaybackDeviceTest",1),FX([TO()],jX.prototype,"stopAudioPlaybackDeviceTest",1),FX([TO()],jX.prototype,"startAudioDeviceRecordTest",1),FX([TO()],jX.prototype,"stopAudioDeviceRecordAndPlayTest",1),FX([TO()],jX.prototype,"stopAudioDevicePlayTest",1),FX([TO()],jX.prototype,"setRemoteUserPriority",1),FX([TO()],jX.prototype,"takeLocalSnapshot",1),FX([TO()],jX.prototype,"takeRemoteSnapshot",1),FX([TO()],jX.prototype,"setSubscribeFallbackOption",1),FX([TO()],jX.prototype,"getLocalStreamTrack",1),FX([TO()],jX.prototype,"getRemoteStreamTrack",1),FX([TO()],jX.prototype,"getPublicStreamTrack",1),FX([TO()],jX.prototype,"setRemoteStreamRenderSync",1);var GX,HX={"client unpublished":dl.STREAM_REMOVE_REASON_UNPUBLISH,"publish failed":dl.STREAM_REMOVE_REASON_PUBLISH_FAILED,"stream removed":dl.STREAM_REMOVE_REASON_KEEP_LIVE_FAILED,"client disconnected":dl.STREAM_REMOVE_REASON_CLIENT_DISCONNECTED,"client republish":dl.STREAM_REMOVE_REASON_REPUBLISH};function zX(e){var t=nM.getServerConfig(e).web_rtc_config;return!(null==t||!t.fallback)||!!dM("ENABLE_FALLBACK_HANDLER")}var KX=new cO("VERTC",0);iO.storeKey=wm(GX="".concat(Date.now(),"-")).call(GX,nM.getDeviceId()),fO({rtc_sdk_version:cM.VERSION,device_id:nM.getDeviceId(),log_cache_key:iO.storeKey}),_O(cM.LOG_SERVER_URL);var XX=1,qX=function(e,t){KX.print("createEngine","Invoke VERTC.createEngine"),_M(e,"appId");var r=(XX++).toString();return function(e,t){var r=new Xx(e);r.set(Zd(Zd({},t),{},{engine_session_id:nC()})),r.report("sdk_init_engine",{start:Date.now(),type:"begin"}),EO.set(e,r)}(r,{rtc_app_id:e,auto_play_policy:null==t?void 0:t.autoPlayPolicy}),new jX(e,r,t)},YX=function(e){if(KX.print("destroyEngine","Invoke VERTC.destroyEngine"),!(e instanceof jX))throw new hR(dR.INVALID_ENGINE,"Invalid engine object");var t;e.destroy(),(t=e.monitor).report("sdk_init_engine",{start:Date.now(),type:"end"}),EO.delete(t.id)},WX=function(){var e=Tm(Em().mark((function e(){return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",XU.enumerateDevices());case 1:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),QX=function(){var e=Tm(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,XU.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,XU.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)}}(),JX=function(){var e=Tm(Em().mark((function e(){return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",XU.enumerateAudioCaptureDevices());case 1:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),ZX=function(){var e=Tm(Em().mark((function e(){return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",XU.enumerateVideoCaptureDevices());case 1:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),$X=function(){var e=Tm(Em().mark((function e(){return Em().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",XU.enumerateAudioPlaybackDevices());case 1:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),eq=function(){return cM.VERSION},tq=function(){return gO("isSupported",0,""),JN()},rq=function(){return gO("getSupportedCodecs",0,""),$N()},nq=function(e){var t=e.logLevel,r=e.LogfileSize;t&&(iO.logLevel=t),r&&(iO.LogfileSize=r)},iq=function(e){iO.download(e)};function oq(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return Mm(Fm(t).call(t,(function(e){return e instanceof jX?"[ENGINE]":e})))}function aq(e,t){return function(){gO(t,0,oq.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 yO(t,0,oq(e)),e})).catch((function(e){throw yO(t,e.code,e.message),e})):(yO(t,0,oq(r)),r)}}return Zd(Zd(Zd(Zd({},new(Nl((function e(){Ll(this,e),Qd(this,"getSdkVersion",aq(eq,"getSdkVersion")),Qd(this,"createEngine",aq(qX,"createEngine")),Qd(this,"destroyEngine",aq(YX,"destroyEngine")),Qd(this,"enumerateDevices",aq(WX,"enumerateDevices")),Qd(this,"enableDevices",aq(QX,"enableDevices")),Qd(this,"enumerateAudioCaptureDevices",aq(JX,"enumerateAudioCaptureDevices")),Qd(this,"enumerateVideoCaptureDevices",aq(ZX,"enumerateVideoCaptureDevices")),Qd(this,"enumerateAudioPlaybackDevices",aq($X,"enumerateAudioPlaybackDevices")),Qd(this,"getParameter",dM),Qd(this,"setParameter",uM),Qd(this,"isSupported",aq(tq,"isSupported")),Qd(this,"getSupportedCodecs",aq(rq,"getSupportedCodecs")),Qd(this,"events",Ml),Qd(this,"ErrorCode",dR),Qd(this,"platform","BytePlus"),Qd(this,"commitInfo","release_453<65a5a2a*>"),Qd(this,"downloadLog",aq(iq,"downloadLog")),Qd(this,"setLogConfig",aq(nq,"setLogConfig"))})))),Cl),Pl),{},{events:Ml})}));