trtc-sdk-v5 5.15.0-beta.17 → 5.15.0-beta.18

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.
Files changed (33) hide show
  1. package/assets/debug-dialog.js +2 -2
  2. package/assets/videodec.wasm +0 -0
  3. package/assets/videodec_simd.wasm +0 -0
  4. package/index.d.ts +2 -8
  5. package/package.json +1 -1
  6. package/plugins/cdn-streaming/package.json +1 -1
  7. package/plugins/chorus/package.json +1 -1
  8. package/plugins/cross-room/package.json +1 -1
  9. package/plugins/custom-encryption/package.json +1 -1
  10. package/plugins/device-detector/package.json +1 -1
  11. package/plugins/small-stream-auto-switcher/package.json +1 -1
  12. package/plugins/video-decoder/package.json +1 -1
  13. package/plugins/video-decoder/video-decoder.esm.js +1 -1
  14. package/plugins/video-decoder/video-decoder.umd.js +1 -1
  15. package/plugins/video-effect/basic-beauty/package.json +1 -1
  16. package/plugins/video-effect/beauty/package.json +1 -1
  17. package/plugins/video-effect/video-mixer/package.json +1 -1
  18. package/plugins/video-effect/video-mixer/video-mixer.esm.d.ts +0 -2
  19. package/plugins/video-effect/video-mixer/video-mixer.esm.js +1 -1
  20. package/plugins/video-effect/video-mixer/video-mixer.umd.js +1 -1
  21. package/plugins/video-effect/virtual-background/package.json +1 -1
  22. package/plugins/video-effect/watermark/package.json +1 -1
  23. package/plugins/voice-changer/package.json +1 -1
  24. package/trtc.esm.js +35 -39
  25. package/trtc.js +1 -1
  26. package/plugins/fast-webrtc/fast-webrtc.esm.d.ts +0 -27
  27. package/plugins/fast-webrtc/fast-webrtc.esm.js +0 -1
  28. package/plugins/fast-webrtc/fast-webrtc.umd.js +0 -1
  29. package/plugins/fast-webrtc/package.json +0 -29
  30. package/plugins/lebplayer/lebplayer.esm.d.ts +0 -260
  31. package/plugins/lebplayer/lebplayer.esm.js +0 -1
  32. package/plugins/lebplayer/lebplayer.umd.js +0 -1
  33. package/plugins/lebplayer/package.json +0 -29
@@ -1,4 +1,4 @@
1
- !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).TRTCDebugDialog=t()}(this,(function(){var e="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},t=function(e){return e&&e.Math===Math&&e},i=t("object"==typeof globalThis&&globalThis)||t("object"==typeof window&&window)||t("object"==typeof self&&self)||t("object"==typeof e&&e)||t("object"==typeof e&&e)||function(){return this}()||Function("return this")(),r={},n=function(e){try{return!!e()}catch(t){return!0}},a=!n((function(){return 7!==Object.defineProperty({},1,{get:function(){return 7}})[1]})),o=!n((function(){var e=function(){}.bind();return"function"!=typeof e||e.hasOwnProperty("prototype")})),s=o,c=Function.prototype.call,l=s?c.bind(c):function(){return c.apply(c,arguments)},d={},u={}.propertyIsEnumerable,h=Object.getOwnPropertyDescriptor,p=h&&!u.call({1:2},1);d.f=p?function(e){var t=h(this,e);return!!t&&t.enumerable}:u;var f,m,g=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}},v=o,_=Function.prototype,y=_.call,E=v&&_.bind.bind(y,y),b=v?E:function(e){return function(){return y.apply(e,arguments)}},w=b,I=w({}.toString),T=w("".slice),S=function(e){return T(I(e),8,-1)},A=n,R=S,k=Object,C=b("".split),D=A((function(){return!k("z").propertyIsEnumerable(0)}))?function(e){return"String"===R(e)?C(e,""):k(e)}:k,O=function(e){return null==e},N=O,L=TypeError,x=function(e){if(N(e))throw new L("Can't call method on "+e);return e},P=D,M=x,U=function(e){return P(M(e))},F="object"==typeof document&&document.all,B=void 0===F&&void 0!==F?function(e){return"function"==typeof e||e===F}:function(e){return"function"==typeof e},V=B,H=function(e){return"object"==typeof e?null!==e:V(e)},z=i,j=B,W=function(e,t){return arguments.length<2?(i=z[e],j(i)?i:void 0):z[e]&&z[e][t];var i},G=b({}.isPrototypeOf),q=i.navigator,K=q&&q.userAgent,Y=K?String(K):"",X=i,Z=Y,J=X.process,Q=X.Deno,$=J&&J.versions||Q&&Q.version,ee=$&&$.v8;ee&&(m=(f=ee.split("."))[0]>0&&f[0]<4?1:+(f[0]+f[1])),!m&&Z&&(!(f=Z.match(/Edge\/(\d+)/))||f[1]>=74)&&(f=Z.match(/Chrome\/(\d+)/))&&(m=+f[1]);var te=m,ie=te,re=n,ne=i.String,ae=!!Object.getOwnPropertySymbols&&!re((function(){var e=Symbol("symbol detection");return!ne(e)||!(Object(e)instanceof Symbol)||!Symbol.sham&&ie&&ie<41})),oe=ae&&!Symbol.sham&&"symbol"==typeof Symbol.iterator,se=W,ce=B,le=G,de=Object,ue=oe?function(e){return"symbol"==typeof e}:function(e){var t=se("Symbol");return ce(t)&&le(t.prototype,de(e))},he=String,pe=function(e){try{return he(e)}catch(t){return"Object"}},fe=B,me=pe,ge=TypeError,ve=function(e){if(fe(e))return e;throw new ge(me(e)+" is not a function")},_e=ve,ye=O,Ee=function(e,t){var i=e[t];return ye(i)?void 0:_e(i)},be=l,we=B,Ie=H,Te=TypeError,Se={exports:{}},Ae=i,Re=Object.defineProperty,ke=function(e,t){try{Re(Ae,e,{value:t,configurable:!0,writable:!0})}catch(i){Ae[e]=t}return t},Ce=i,De=ke,Oe="__core-js_shared__",Ne=Se.exports=Ce[Oe]||De(Oe,{});(Ne.versions||(Ne.versions=[])).push({version:"3.40.0",mode:"global",copyright:"© 2014-2025 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.40.0/LICENSE",source:"https://github.com/zloirock/core-js"});var Le=Se.exports,xe=Le,Pe=function(e,t){return xe[e]||(xe[e]=t||{})},Me=x,Ue=Object,Fe=function(e){return Ue(Me(e))},Be=Fe,Ve=b({}.hasOwnProperty),He=Object.hasOwn||function(e,t){return Ve(Be(e),t)},ze=b,je=0,We=Math.random(),Ge=ze(1..toString),qe=function(e){return"Symbol("+(void 0===e?"":e)+")_"+Ge(++je+We,36)},Ke=Pe,Ye=He,Xe=qe,Ze=ae,Je=oe,Qe=i.Symbol,$e=Ke("wks"),et=Je?Qe.for||Qe:Qe&&Qe.withoutSetter||Xe,tt=function(e){return Ye($e,e)||($e[e]=Ze&&Ye(Qe,e)?Qe[e]:et("Symbol."+e)),$e[e]},it=l,rt=H,nt=ue,at=Ee,ot=function(e,t){var i,r;if("string"===t&&we(i=e.toString)&&!Ie(r=be(i,e)))return r;if(we(i=e.valueOf)&&!Ie(r=be(i,e)))return r;if("string"!==t&&we(i=e.toString)&&!Ie(r=be(i,e)))return r;throw new Te("Can't convert object to primitive value")},st=TypeError,ct=tt("toPrimitive"),lt=function(e,t){if(!rt(e)||nt(e))return e;var i,r=at(e,ct);if(r){if(void 0===t&&(t="default"),i=it(r,e,t),!rt(i)||nt(i))return i;throw new st("Can't convert object to primitive value")}return void 0===t&&(t="number"),ot(e,t)},dt=lt,ut=ue,ht=function(e){var t=dt(e,"string");return ut(t)?t:t+""},pt=H,ft=i.document,mt=pt(ft)&&pt(ft.createElement),gt=function(e){return mt?ft.createElement(e):{}},vt=gt,_t=!a&&!n((function(){return 7!==Object.defineProperty(vt("div"),"a",{get:function(){return 7}}).a})),yt=a,Et=l,bt=d,wt=g,It=U,Tt=ht,St=He,At=_t,Rt=Object.getOwnPropertyDescriptor;r.f=yt?Rt:function(e,t){if(e=It(e),t=Tt(t),At)try{return Rt(e,t)}catch(i){}if(St(e,t))return wt(!Et(bt.f,e,t),e[t])};var kt={},Ct=a&&n((function(){return 42!==Object.defineProperty((function(){}),"prototype",{value:42,writable:!1}).prototype})),Dt=H,Ot=String,Nt=TypeError,Lt=function(e){if(Dt(e))return e;throw new Nt(Ot(e)+" is not an object")},xt=a,Pt=_t,Mt=Ct,Ut=Lt,Ft=ht,Bt=TypeError,Vt=Object.defineProperty,Ht=Object.getOwnPropertyDescriptor,zt="enumerable",jt="configurable",Wt="writable";kt.f=xt?Mt?function(e,t,i){if(Ut(e),t=Ft(t),Ut(i),"function"==typeof e&&"prototype"===t&&"value"in i&&Wt in i&&!i[Wt]){var r=Ht(e,t);r&&r[Wt]&&(e[t]=i.value,i={configurable:jt in i?i[jt]:r[jt],enumerable:zt in i?i[zt]:r[zt],writable:!1})}return Vt(e,t,i)}:Vt:function(e,t,i){if(Ut(e),t=Ft(t),Ut(i),Pt)try{return Vt(e,t,i)}catch(r){}if("get"in i||"set"in i)throw new Bt("Accessors not supported");return"value"in i&&(e[t]=i.value),e};var Gt=kt,qt=g,Kt=a?function(e,t,i){return Gt.f(e,t,qt(1,i))}:function(e,t,i){return e[t]=i,e},Yt={exports:{}},Xt=a,Zt=He,Jt=Function.prototype,Qt=Xt&&Object.getOwnPropertyDescriptor,$t=Zt(Jt,"name"),ei={EXISTS:$t,PROPER:$t&&"something"===function(){}.name,CONFIGURABLE:$t&&(!Xt||Xt&&Qt(Jt,"name").configurable)},ti=B,ii=Le,ri=b(Function.toString);ti(ii.inspectSource)||(ii.inspectSource=function(e){return ri(e)});var ni,ai,oi,si=ii.inspectSource,ci=B,li=i.WeakMap,di=ci(li)&&/native code/.test(String(li)),ui=qe,hi=Pe("keys"),pi=function(e){return hi[e]||(hi[e]=ui(e))},fi={},mi=di,gi=i,vi=H,_i=Kt,yi=He,Ei=Le,bi=pi,wi=fi,Ii="Object already initialized",Ti=gi.TypeError,Si=gi.WeakMap;if(mi||Ei.state){var Ai=Ei.state||(Ei.state=new Si);Ai.get=Ai.get,Ai.has=Ai.has,Ai.set=Ai.set,ni=function(e,t){if(Ai.has(e))throw new Ti(Ii);return t.facade=e,Ai.set(e,t),t},ai=function(e){return Ai.get(e)||{}},oi=function(e){return Ai.has(e)}}else{var Ri=bi("state");wi[Ri]=!0,ni=function(e,t){if(yi(e,Ri))throw new Ti(Ii);return t.facade=e,_i(e,Ri,t),t},ai=function(e){return yi(e,Ri)?e[Ri]:{}},oi=function(e){return yi(e,Ri)}}var ki={set:ni,get:ai,has:oi,enforce:function(e){return oi(e)?ai(e):ni(e,{})},getterFor:function(e){return function(t){var i;if(!vi(t)||(i=ai(t)).type!==e)throw new Ti("Incompatible receiver, "+e+" required");return i}}},Ci=b,Di=n,Oi=B,Ni=He,Li=a,xi=ei.CONFIGURABLE,Pi=si,Mi=ki.enforce,Ui=ki.get,Fi=String,Bi=Object.defineProperty,Vi=Ci("".slice),Hi=Ci("".replace),zi=Ci([].join),ji=Li&&!Di((function(){return 8!==Bi((function(){}),"length",{value:8}).length})),Wi=String(String).split("String"),Gi=Yt.exports=function(e,t,i){"Symbol("===Vi(Fi(t),0,7)&&(t="["+Hi(Fi(t),/^Symbol\(([^)]*)\).*$/,"$1")+"]"),i&&i.getter&&(t="get "+t),i&&i.setter&&(t="set "+t),(!Ni(e,"name")||xi&&e.name!==t)&&(Li?Bi(e,"name",{value:t,configurable:!0}):e.name=t),ji&&i&&Ni(i,"arity")&&e.length!==i.arity&&Bi(e,"length",{value:i.arity});try{i&&Ni(i,"constructor")&&i.constructor?Li&&Bi(e,"prototype",{writable:!1}):e.prototype&&(e.prototype=void 0)}catch(n){}var r=Mi(e);return Ni(r,"source")||(r.source=zi(Wi,"string"==typeof t?t:"")),e};Function.prototype.toString=Gi((function(){return Oi(this)&&Ui(this).source||Pi(this)}),"toString");var qi=Yt.exports,Ki=B,Yi=kt,Xi=qi,Zi=ke,Ji=function(e,t,i,r){r||(r={});var n=r.enumerable,a=void 0!==r.name?r.name:t;if(Ki(i)&&Xi(i,a,r),r.global)n?e[t]=i:Zi(t,i);else{try{r.unsafe?e[t]&&(n=!0):delete e[t]}catch(o){}n?e[t]=i:Yi.f(e,t,{value:i,enumerable:!1,configurable:!r.nonConfigurable,writable:!r.nonWritable})}return e},Qi={},$i=Math.ceil,er=Math.floor,tr=Math.trunc||function(e){var t=+e;return(t>0?er:$i)(t)},ir=function(e){var t=+e;return t!=t||0===t?0:tr(t)},rr=ir,nr=Math.max,ar=Math.min,or=function(e,t){var i=rr(e);return i<0?nr(i+t,0):ar(i,t)},sr=ir,cr=Math.min,lr=function(e){var t=sr(e);return t>0?cr(t,9007199254740991):0},dr=lr,ur=function(e){return dr(e.length)},hr=U,pr=or,fr=ur,mr=function(e){return function(t,i,r){var n=hr(t),a=fr(n);if(0===a)return!e&&-1;var o,s=pr(r,a);if(e&&i!=i){for(;a>s;)if((o=n[s++])!=o)return!0}else for(;a>s;s++)if((e||s in n)&&n[s]===i)return e||s||0;return!e&&-1}},gr={includes:mr(!0),indexOf:mr(!1)},vr=He,_r=U,yr=gr.indexOf,Er=fi,br=b([].push),wr=function(e,t){var i,r=_r(e),n=0,a=[];for(i in r)!vr(Er,i)&&vr(r,i)&&br(a,i);for(;t.length>n;)vr(r,i=t[n++])&&(~yr(a,i)||br(a,i));return a},Ir=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],Tr=wr,Sr=Ir.concat("length","prototype");Qi.f=Object.getOwnPropertyNames||function(e){return Tr(e,Sr)};var Ar={};Ar.f=Object.getOwnPropertySymbols;var Rr=W,kr=Qi,Cr=Ar,Dr=Lt,Or=b([].concat),Nr=Rr("Reflect","ownKeys")||function(e){var t=kr.f(Dr(e)),i=Cr.f;return i?Or(t,i(e)):t},Lr=He,xr=Nr,Pr=r,Mr=kt,Ur=function(e,t,i){for(var r=xr(t),n=Mr.f,a=Pr.f,o=0;o<r.length;o++){var s=r[o];Lr(e,s)||i&&Lr(i,s)||n(e,s,a(t,s))}},Fr=n,Br=B,Vr=/#|\.prototype\./,Hr=function(e,t){var i=jr[zr(e)];return i===Gr||i!==Wr&&(Br(t)?Fr(t):!!t)},zr=Hr.normalize=function(e){return String(e).replace(Vr,".").toLowerCase()},jr=Hr.data={},Wr=Hr.NATIVE="N",Gr=Hr.POLYFILL="P",qr=Hr,Kr=i,Yr=r.f,Xr=Kt,Zr=Ji,Jr=ke,Qr=Ur,$r=qr,en=function(e,t){var i,r,n,a,o,s=e.target,c=e.global,l=e.stat;if(i=c?Kr:l?Kr[s]||Jr(s,{}):Kr[s]&&Kr[s].prototype)for(r in t){if(a=t[r],n=e.dontCallGetSet?(o=Yr(i,r))&&o.value:i[r],!$r(c?r:s+(l?".":"#")+r,e.forced)&&void 0!==n){if(typeof a==typeof n)continue;Qr(a,n)}(e.sham||n&&n.sham)&&Xr(a,"sham",!0),Zr(i,r,a,e)}},tn={};tn[tt("toStringTag")]="z";var rn="[object z]"===String(tn),nn=B,an=S,on=tt("toStringTag"),sn=Object,cn="Arguments"===an(function(){return arguments}()),ln=rn?an:function(e){var t,i,r;return void 0===e?"Undefined":null===e?"Null":"string"==typeof(i=function(e,t){try{return e[t]}catch(i){}}(t=sn(e),on))?i:cn?an(t):"Object"===(r=an(t))&&nn(t.callee)?"Arguments":r},dn=ln,un=String,hn=function(e){if("Symbol"===dn(e))throw new TypeError("Cannot convert a Symbol value to a string");return un(e)},pn=qi,fn=kt,mn=function(e,t,i){return i.get&&pn(i.get,t,{getter:!0}),i.set&&pn(i.set,t,{setter:!0}),fn.f(e,t,i)},gn=en,vn=a,_n=b,yn=He,En=B,bn=G,wn=hn,In=mn,Tn=Ur,Sn=i.Symbol,An=Sn&&Sn.prototype;if(vn&&En(Sn)&&(!("description"in An)||void 0!==Sn().description)){var Rn={},kn=function(){var e=arguments.length<1||void 0===arguments[0]?void 0:wn(arguments[0]),t=bn(An,this)?new Sn(e):void 0===e?Sn():Sn(e);return""===e&&(Rn[t]=!0),t};Tn(kn,Sn),kn.prototype=An,An.constructor=kn;var Cn="Symbol(description detection)"===String(Sn("description detection")),Dn=_n(An.valueOf),On=_n(An.toString),Nn=/^Symbol\((.*)\)[^)]+$/,Ln=_n("".replace),xn=_n("".slice);In(An,"description",{configurable:!0,get:function(){var e=Dn(this);if(yn(Rn,e))return"";var t=On(e),i=Cn?xn(t,7,-1):Ln(t,Nn,"$1");return""===i?void 0:i}}),gn({global:!0,constructor:!0,forced:!0},{Symbol:kn})}var Pn={},Mn=wr,Un=Ir,Fn=Object.keys||function(e){return Mn(e,Un)},Bn=a,Vn=Ct,Hn=kt,zn=Lt,jn=U,Wn=Fn;Pn.f=Bn&&!Vn?Object.defineProperties:function(e,t){zn(e);for(var i,r=jn(t),n=Wn(t),a=n.length,o=0;a>o;)Hn.f(e,i=n[o++],r[i]);return e};var Gn,qn=W("document","documentElement"),Kn=Lt,Yn=Pn,Xn=Ir,Zn=fi,Jn=qn,Qn=gt,$n="prototype",ea="script",ta=pi("IE_PROTO"),ia=function(){},ra=function(e){return"<"+ea+">"+e+"</"+ea+">"},na=function(e){e.write(ra("")),e.close();var t=e.parentWindow.Object;return e=null,t},aa=function(){try{Gn=new ActiveXObject("htmlfile")}catch(n){}var e,t,i;aa="undefined"!=typeof document?document.domain&&Gn?na(Gn):(t=Qn("iframe"),i="java"+ea+":",t.style.display="none",Jn.appendChild(t),t.src=String(i),(e=t.contentWindow.document).open(),e.write(ra("document.F=Object")),e.close(),e.F):na(Gn);for(var r=Xn.length;r--;)delete aa[$n][Xn[r]];return aa()};Zn[ta]=!0;var oa=Object.create||function(e,t){var i;return null!==e?(ia[$n]=Kn(e),i=new ia,ia[$n]=null,i[ta]=e):i=aa(),void 0===t?i:Yn.f(i,t)},sa=tt,ca=oa,la=kt.f,da=sa("unscopables"),ua=Array.prototype;void 0===ua[da]&&la(ua,da,{configurable:!0,value:ca(null)});var ha=function(e){ua[da][e]=!0},pa=gr.includes,fa=ha;en({target:"Array",proto:!0,forced:n((function(){return!Array(1).includes()}))},{includes:function(e){return pa(this,e,arguments.length>1?arguments[1]:void 0)}}),fa("includes");var ma,ga,va,_a={},ya=!n((function(){function e(){}return e.prototype.constructor=null,Object.getPrototypeOf(new e)!==e.prototype})),Ea=He,ba=B,wa=Fe,Ia=ya,Ta=pi("IE_PROTO"),Sa=Object,Aa=Sa.prototype,Ra=Ia?Sa.getPrototypeOf:function(e){var t=wa(e);if(Ea(t,Ta))return t[Ta];var i=t.constructor;return ba(i)&&t instanceof i?i.prototype:t instanceof Sa?Aa:null},ka=n,Ca=B,Da=H,Oa=Ra,Na=Ji,La=tt("iterator"),xa=!1;[].keys&&("next"in(va=[].keys())?(ga=Oa(Oa(va)))!==Object.prototype&&(ma=ga):xa=!0);var Pa=!Da(ma)||ka((function(){var e={};return ma[La].call(e)!==e}));Pa&&(ma={}),Ca(ma[La])||Na(ma,La,(function(){return this}));var Ma={IteratorPrototype:ma,BUGGY_SAFARI_ITERATORS:xa},Ua=kt.f,Fa=He,Ba=tt("toStringTag"),Va=function(e,t,i){e&&!i&&(e=e.prototype),e&&!Fa(e,Ba)&&Ua(e,Ba,{configurable:!0,value:t})},Ha=Ma.IteratorPrototype,za=oa,ja=g,Wa=Va,Ga=_a,qa=function(){return this},Ka=function(e,t,i,r){var n=t+" Iterator";return e.prototype=za(Ha,{next:ja(+!r,i)}),Wa(e,n,!1),Ga[n]=qa,e},Ya=b,Xa=ve,Za=H,Ja=function(e){return Za(e)||null===e},Qa=String,$a=TypeError,eo=function(e,t,i){try{return Ya(Xa(Object.getOwnPropertyDescriptor(e,t)[i]))}catch(r){}},to=H,io=x,ro=function(e){if(Ja(e))return e;throw new $a("Can't set "+Qa(e)+" as a prototype")},no=Object.setPrototypeOf||("__proto__"in{}?function(){var e,t=!1,i={};try{(e=eo(Object.prototype,"__proto__","set"))(i,[]),t=i instanceof Array}catch(r){}return function(i,r){return io(i),ro(r),to(i)?(t?e(i,r):i.__proto__=r,i):i}}():void 0),ao=en,oo=l,so=B,co=Ka,lo=Ra,uo=no,ho=Va,po=Kt,fo=Ji,mo=_a,go=ei.PROPER,vo=ei.CONFIGURABLE,_o=Ma.IteratorPrototype,yo=Ma.BUGGY_SAFARI_ITERATORS,Eo=tt("iterator"),bo="keys",wo="values",Io="entries",To=function(){return this},So=function(e,t,i,r,n,a,o){co(i,t,r);var s,c,l,d=function(e){if(e===n&&m)return m;if(!yo&&e&&e in p)return p[e];switch(e){case bo:case wo:case Io:return function(){return new i(this,e)}}return function(){return new i(this)}},u=t+" Iterator",h=!1,p=e.prototype,f=p[Eo]||p["@@iterator"]||n&&p[n],m=!yo&&f||d(n),g="Array"===t&&p.entries||f;if(g&&(s=lo(g.call(new e)))!==Object.prototype&&s.next&&(lo(s)!==_o&&(uo?uo(s,_o):so(s[Eo])||fo(s,Eo,To)),ho(s,u,!0)),go&&n===wo&&f&&f.name!==wo&&(vo?po(p,"name",wo):(h=!0,m=function(){return oo(f,this)})),n)if(c={values:d(wo),keys:a?m:d(bo),entries:d(Io)},o)for(l in c)(yo||h||!(l in p))&&fo(p,l,c[l]);else ao({target:t,proto:!0,forced:yo||h},c);return p[Eo]!==m&&fo(p,Eo,m,{name:n}),mo[t]=m,c},Ao=function(e,t){return{value:e,done:t}},Ro=U,ko=ha,Co=_a,Do=ki,Oo=kt.f,No=So,Lo=Ao,xo=a,Po="Array Iterator",Mo=Do.set,Uo=Do.getterFor(Po),Fo=No(Array,"Array",(function(e,t){Mo(this,{type:Po,target:Ro(e),index:0,kind:t})}),(function(){var e=Uo(this),t=e.target,i=e.index++;if(!t||i>=t.length)return e.target=null,Lo(void 0,!0);switch(e.kind){case"keys":return Lo(i,!1);case"values":return Lo(t[i],!1)}return Lo([i,t[i]],!1)}),"values"),Bo=Co.Arguments=Co.Array;if(ko("keys"),ko("values"),ko("entries"),xo&&"values"!==Bo.name)try{Oo(Bo,"name",{value:"values"})}catch(TM){}var Vo=ve,Ho=Fe,zo=D,jo=ur,Wo=TypeError,Go="Reduce of empty array with no initial value",qo=function(e){return function(t,i,r,n){var a=Ho(t),o=zo(a),s=jo(a);if(Vo(i),0===s&&r<2)throw new Wo(Go);var c=e?s-1:0,l=e?-1:1;if(r<2)for(;;){if(c in o){n=o[c],c+=l;break}if(c+=l,e?c<0:s<=c)throw new Wo(Go)}for(;e?c>=0:s>c;c+=l)c in o&&(n=i(n,o[c],c,a));return n}},Ko={left:qo(!1),right:qo(!0)},Yo=n,Xo=function(e,t){var i=[][e];return!!i&&Yo((function(){i.call(null,t||function(){return 1},1)}))},Zo=i,Jo=Y,Qo=S,$o=function(e){return Jo.slice(0,e.length)===e},es=$o("Bun/")?"BUN":$o("Cloudflare-Workers")?"CLOUDFLARE":$o("Deno/")?"DENO":$o("Node.js/")?"NODE":Zo.Bun&&"string"==typeof Bun.version?"BUN":Zo.Deno&&"object"==typeof Deno.version?"DENO":"process"===Qo(Zo.process)?"NODE":Zo.window&&Zo.document?"BROWSER":"REST",ts="NODE"===es,is=Ko.left;en({target:"Array",proto:!0,forced:!ts&&te>79&&te<83||!Xo("reduce")},{reduce:function(e){var t=arguments.length;return is(this,e,t,t>1?arguments[1]:void 0)}});var rs=Ko.right;en({target:"Array",proto:!0,forced:!ts&&te>79&&te<83||!Xo("reduceRight")},{reduceRight:function(e){return rs(this,e,arguments.length,arguments.length>1?arguments[1]:void 0)}});var ns=S,as=Array.isArray||function(e){return"Array"===ns(e)},os=en,ss=as,cs=b([].reverse),ls=[1,2];os({target:"Array",proto:!0,forced:String(ls)===String(ls.reverse())},{reverse:function(){return ss(this)&&(this.length=this.length),cs(this)}});var ds="undefined"!=typeof ArrayBuffer&&"undefined"!=typeof DataView,us=Ji,hs=function(e,t,i){for(var r in t)us(e,r,t[r],i);return e},ps=G,fs=TypeError,ms=function(e,t){if(ps(t,e))return e;throw new fs("Incorrect invocation")},gs=ir,vs=lr,_s=RangeError,ys=function(e){if(void 0===e)return 0;var t=gs(e),i=vs(t);if(t!==i)throw new _s("Wrong length or index");return i},Es=Math.sign||function(e){var t=+e;return 0===t||t!=t?t:t<0?-1:1},bs=4503599627370496,ws=Es,Is=function(e){return e+bs-bs},Ts=Math.abs,Ss=function(e,t,i,r){var n=+e,a=Ts(n),o=ws(n);if(a<r)return o*Is(a/r/t)*r*t;var s=(1+t/2220446049250313e-31)*a,c=s-(s-a);return c>i||c!=c?Infinity*o:o*c},As=Math.fround||function(e){return Ss(e,1.1920928955078125e-7,34028234663852886e22,11754943508222875e-54)},Rs=Array,ks=Math.abs,Cs=Math.pow,Ds=Math.floor,Os=Math.log,Ns=Math.LN2,Ls={pack:function(e,t,i){var r,n,a,o=Rs(i),s=8*i-t-1,c=(1<<s)-1,l=c>>1,d=23===t?Cs(2,-24)-Cs(2,-77):0,u=e<0||0===e&&1/e<0?1:0,h=0;for((e=ks(e))!=e||Infinity===e?(n=e!=e?1:0,r=c):(r=Ds(Os(e)/Ns),e*(a=Cs(2,-r))<1&&(r--,a*=2),(e+=r+l>=1?d/a:d*Cs(2,1-l))*a>=2&&(r++,a/=2),r+l>=c?(n=0,r=c):r+l>=1?(n=(e*a-1)*Cs(2,t),r+=l):(n=e*Cs(2,l-1)*Cs(2,t),r=0));t>=8;)o[h++]=255&n,n/=256,t-=8;for(r=r<<t|n,s+=t;s>0;)o[h++]=255&r,r/=256,s-=8;return o[h-1]|=128*u,o},unpack:function(e,t){var i,r=e.length,n=8*r-t-1,a=(1<<n)-1,o=a>>1,s=n-7,c=r-1,l=e[c--],d=127&l;for(l>>=7;s>0;)d=256*d+e[c--],s-=8;for(i=d&(1<<-s)-1,d>>=-s,s+=t;s>0;)i=256*i+e[c--],s-=8;if(0===d)d=1-o;else{if(d===a)return i?NaN:l?-Infinity:Infinity;i+=Cs(2,t),d-=o}return(l?-1:1)*i*Cs(2,d-t)}},xs=Fe,Ps=or,Ms=ur,Us=function(e){for(var t=xs(this),i=Ms(t),r=arguments.length,n=Ps(r>1?arguments[1]:void 0,i),a=r>2?arguments[2]:void 0,o=void 0===a?i:Ps(a,i);o>n;)t[n++]=e;return t},Fs=b([].slice),Bs=B,Vs=H,Hs=no,zs=function(e,t,i){var r,n;return Hs&&Bs(r=t.constructor)&&r!==i&&Vs(n=r.prototype)&&n!==i.prototype&&Hs(e,n),e},js=i,Ws=b,Gs=a,qs=ds,Ks=Kt,Ys=mn,Xs=hs,Zs=n,Js=ms,Qs=ir,$s=lr,ec=ys,tc=As,ic=Ls,rc=Ra,nc=no,ac=Us,oc=Fs,sc=zs,cc=Ur,lc=Va,dc=ki,uc=ei.PROPER,hc=ei.CONFIGURABLE,pc="ArrayBuffer",fc="DataView",mc="prototype",gc="Wrong index",vc=dc.getterFor(pc),_c=dc.getterFor(fc),yc=dc.set,Ec=js[pc],bc=Ec,wc=bc&&bc[mc],Ic=js[fc],Tc=Ic&&Ic[mc],Sc=Object.prototype,Ac=js.Array,Rc=js.RangeError,kc=Ws(ac),Cc=Ws([].reverse),Dc=ic.pack,Oc=ic.unpack,Nc=function(e){return[255&e]},Lc=function(e){return[255&e,e>>8&255]},xc=function(e){return[255&e,e>>8&255,e>>16&255,e>>24&255]},Pc=function(e){return e[3]<<24|e[2]<<16|e[1]<<8|e[0]},Mc=function(e){return Dc(tc(e),23,4)},Uc=function(e){return Dc(e,52,8)},Fc=function(e,t,i){Ys(e[mc],t,{configurable:!0,get:function(){return i(this)[t]}})},Bc=function(e,t,i,r){var n=_c(e),a=ec(i),o=!!r;if(a+t>n.byteLength)throw new Rc(gc);var s=n.bytes,c=a+n.byteOffset,l=oc(s,c,c+t);return o?l:Cc(l)},Vc=function(e,t,i,r,n,a){var o=_c(e),s=ec(i),c=r(+n),l=!!a;if(s+t>o.byteLength)throw new Rc(gc);for(var d=o.bytes,u=s+o.byteOffset,h=0;h<t;h++)d[u+h]=c[l?h:t-h-1]};if(qs){var Hc=uc&&Ec.name!==pc;Zs((function(){Ec(1)}))&&Zs((function(){new Ec(-1)}))&&!Zs((function(){return new Ec,new Ec(1.5),new Ec(NaN),1!==Ec.length||Hc&&!hc}))?Hc&&hc&&Ks(Ec,"name",pc):((bc=function(e){return Js(this,wc),sc(new Ec(ec(e)),this,bc)})[mc]=wc,wc.constructor=bc,cc(bc,Ec)),nc&&rc(Tc)!==Sc&&nc(Tc,Sc);var zc=new Ic(new bc(2)),jc=Ws(Tc.setInt8);zc.setInt8(0,2147483648),zc.setInt8(1,2147483649),!zc.getInt8(0)&&zc.getInt8(1)||Xs(Tc,{setInt8:function(e,t){jc(this,e,t<<24>>24)},setUint8:function(e,t){jc(this,e,t<<24>>24)}},{unsafe:!0})}else wc=(bc=function(e){Js(this,wc);var t=ec(e);yc(this,{type:pc,bytes:kc(Ac(t),0),byteLength:t}),Gs||(this.byteLength=t,this.detached=!1)})[mc],Tc=(Ic=function(e,t,i){Js(this,Tc),Js(e,wc);var r=vc(e),n=r.byteLength,a=Qs(t);if(a<0||a>n)throw new Rc("Wrong offset");if(a+(i=void 0===i?n-a:$s(i))>n)throw new Rc("Wrong length");yc(this,{type:fc,buffer:e,byteLength:i,byteOffset:a,bytes:r.bytes}),Gs||(this.buffer=e,this.byteLength=i,this.byteOffset=a)})[mc],Gs&&(Fc(bc,"byteLength",vc),Fc(Ic,"buffer",_c),Fc(Ic,"byteLength",_c),Fc(Ic,"byteOffset",_c)),Xs(Tc,{getInt8:function(e){return Bc(this,1,e)[0]<<24>>24},getUint8:function(e){return Bc(this,1,e)[0]},getInt16:function(e){var t=Bc(this,2,e,arguments.length>1&&arguments[1]);return(t[1]<<8|t[0])<<16>>16},getUint16:function(e){var t=Bc(this,2,e,arguments.length>1&&arguments[1]);return t[1]<<8|t[0]},getInt32:function(e){return Pc(Bc(this,4,e,arguments.length>1&&arguments[1]))},getUint32:function(e){return Pc(Bc(this,4,e,arguments.length>1&&arguments[1]))>>>0},getFloat32:function(e){return Oc(Bc(this,4,e,arguments.length>1&&arguments[1]),23)},getFloat64:function(e){return Oc(Bc(this,8,e,arguments.length>1&&arguments[1]),52)},setInt8:function(e,t){Vc(this,1,e,Nc,t)},setUint8:function(e,t){Vc(this,1,e,Nc,t)},setInt16:function(e,t){Vc(this,2,e,Lc,t,arguments.length>2&&arguments[2])},setUint16:function(e,t){Vc(this,2,e,Lc,t,arguments.length>2&&arguments[2])},setInt32:function(e,t){Vc(this,4,e,xc,t,arguments.length>2&&arguments[2])},setUint32:function(e,t){Vc(this,4,e,xc,t,arguments.length>2&&arguments[2])},setFloat32:function(e,t){Vc(this,4,e,Mc,t,arguments.length>2&&arguments[2])},setFloat64:function(e,t){Vc(this,8,e,Uc,t,arguments.length>2&&arguments[2])}});lc(bc,pc),lc(Ic,fc);var Wc={ArrayBuffer:bc,DataView:Ic},Gc=W,qc=mn,Kc=a,Yc=tt("species"),Xc=function(e){var t=Gc(e);Kc&&t&&!t[Yc]&&qc(t,Yc,{configurable:!0,get:function(){return this}})},Zc=Xc,Jc="ArrayBuffer",Qc=Wc[Jc];en({global:!0,constructor:!0,forced:i[Jc]!==Qc},{ArrayBuffer:Qc}),Zc(Jc);var $c=S,el=b,tl=function(e){if("Function"===$c(e))return el(e)},il=en,rl=tl,nl=n,al=Lt,ol=or,sl=lr,cl=Wc.ArrayBuffer,ll=Wc.DataView,dl=ll.prototype,ul=rl(cl.prototype.slice),hl=rl(dl.getUint8),pl=rl(dl.setUint8);il({target:"ArrayBuffer",proto:!0,unsafe:!0,forced:nl((function(){return!new cl(2).slice(1,void 0).byteLength}))},{slice:function(e,t){if(ul&&void 0===t)return ul(al(this),e);for(var i=al(this).byteLength,r=ol(e,i),n=ol(void 0===t?i:t,i),a=new cl(sl(n-r)),o=new ll(this),s=new ll(a),c=0;r<n;)pl(s,c++,hl(o,r++));return a}});var fl=b,ml=n,gl=B,vl=ln,_l=si,yl=function(){},El=W("Reflect","construct"),bl=/^\s*(?:class|function)\b/,wl=fl(bl.exec),Il=!bl.test(yl),Tl=function(e){if(!gl(e))return!1;try{return El(yl,[],e),!0}catch(TM){return!1}},Sl=function(e){if(!gl(e))return!1;switch(vl(e)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return Il||!!wl(bl,_l(e))}catch(TM){return!0}};Sl.sham=!0;var Al,Rl,kl,Cl,Dl=!El||ml((function(){var e;return Tl(Tl.call)||!Tl(Object)||!Tl((function(){e=!0}))||e}))?Sl:Tl,Ol=Dl,Nl=pe,Ll=TypeError,xl=function(e){if(Ol(e))return e;throw new Ll(Nl(e)+" is not a constructor")},Pl=Lt,Ml=xl,Ul=O,Fl=tt("species"),Bl=function(e,t){var i,r=Pl(e).constructor;return void 0===r||Ul(i=Pl(r)[Fl])?t:Ml(i)},Vl=o,Hl=Function.prototype,zl=Hl.apply,jl=Hl.call,Wl="object"==typeof Reflect&&Reflect.apply||(Vl?jl.bind(zl):function(){return jl.apply(zl,arguments)}),Gl=ve,ql=o,Kl=tl(tl.bind),Yl=function(e,t){return Gl(e),void 0===t?e:ql?Kl(e,t):function(){return e.apply(t,arguments)}},Xl=TypeError,Zl=function(e,t){if(e<t)throw new Xl("Not enough arguments");return e},Jl=/(?:ipad|iphone|ipod).*applewebkit/i.test(Y),Ql=i,$l=Wl,ed=Yl,td=B,id=He,rd=n,nd=qn,ad=Fs,od=gt,sd=Zl,cd=Jl,ld=ts,dd=Ql.setImmediate,ud=Ql.clearImmediate,hd=Ql.process,pd=Ql.Dispatch,fd=Ql.Function,md=Ql.MessageChannel,gd=Ql.String,vd=0,_d={},yd="onreadystatechange";rd((function(){Al=Ql.location}));var Ed=function(e){if(id(_d,e)){var t=_d[e];delete _d[e],t()}},bd=function(e){return function(){Ed(e)}},wd=function(e){Ed(e.data)},Id=function(e){Ql.postMessage(gd(e),Al.protocol+"//"+Al.host)};dd&&ud||(dd=function(e){sd(arguments.length,1);var t=td(e)?e:fd(e),i=ad(arguments,1);return _d[++vd]=function(){$l(t,void 0,i)},Rl(vd),vd},ud=function(e){delete _d[e]},ld?Rl=function(e){hd.nextTick(bd(e))}:pd&&pd.now?Rl=function(e){pd.now(bd(e))}:md&&!cd?(Cl=(kl=new md).port2,kl.port1.onmessage=wd,Rl=ed(Cl.postMessage,Cl)):Ql.addEventListener&&td(Ql.postMessage)&&!Ql.importScripts&&Al&&"file:"!==Al.protocol&&!rd(Id)?(Rl=Id,Ql.addEventListener("message",wd,!1)):Rl=yd in od("script")?function(e){nd.appendChild(od("script"))[yd]=function(){nd.removeChild(this),Ed(e)}}:function(e){setTimeout(bd(e),0)});var Td={set:dd,clear:ud},Sd=i,Ad=a,Rd=Object.getOwnPropertyDescriptor,kd=function(e){if(!Ad)return Sd[e];var t=Rd(Sd,e);return t&&t.value},Cd=function(){this.head=null,this.tail=null};Cd.prototype={add:function(e){var t={item:e,next:null},i=this.tail;i?i.next=t:this.head=t,this.tail=t},get:function(){var e=this.head;if(e)return null===(this.head=e.next)&&(this.tail=null),e.item}};var Dd,Od,Nd,Ld,xd,Pd=Cd,Md=/ipad|iphone|ipod/i.test(Y)&&"undefined"!=typeof Pebble,Ud=/web0s(?!.*chrome)/i.test(Y),Fd=i,Bd=kd,Vd=Yl,Hd=Td.set,zd=Pd,jd=Jl,Wd=Md,Gd=Ud,qd=ts,Kd=Fd.MutationObserver||Fd.WebKitMutationObserver,Yd=Fd.document,Xd=Fd.process,Zd=Fd.Promise,Jd=Bd("queueMicrotask");if(!Jd){var Qd=new zd,$d=function(){var e,t;for(qd&&(e=Xd.domain)&&e.exit();t=Qd.get();)try{t()}catch(TM){throw Qd.head&&Dd(),TM}e&&e.enter()};jd||qd||Gd||!Kd||!Yd?!Wd&&Zd&&Zd.resolve?((Ld=Zd.resolve(void 0)).constructor=Zd,xd=Vd(Ld.then,Ld),Dd=function(){xd($d)}):qd?Dd=function(){Xd.nextTick($d)}:(Hd=Vd(Hd,Fd),Dd=function(){Hd($d)}):(Od=!0,Nd=Yd.createTextNode(""),new Kd($d).observe(Nd,{characterData:!0}),Dd=function(){Nd.data=Od=!Od}),Jd=function(e){Qd.head||Dd(),Qd.add(e)}}var eu=Jd,tu=function(e){try{return{error:!1,value:e()}}catch(TM){return{error:!0,value:TM}}},iu=i.Promise,ru=i,nu=iu,au=B,ou=qr,su=si,cu=tt,lu=es,du=te;nu&&nu.prototype;var uu=cu("species"),hu=!1,pu=au(ru.PromiseRejectionEvent),fu=ou("Promise",(function(){var e=su(nu),t=e!==String(nu);if(!t&&66===du)return!0;if(!du||du<51||!/native code/.test(e)){var i=new nu((function(e){e(1)})),r=function(e){e((function(){}),(function(){}))};if((i.constructor={})[uu]=r,!(hu=i.then((function(){}))instanceof r))return!0}return!(t||"BROWSER"!==lu&&"DENO"!==lu||pu)})),mu={CONSTRUCTOR:fu,REJECTION_EVENT:pu,SUBCLASSING:hu},gu={},vu=ve,_u=TypeError,yu=function(e){var t,i;this.promise=new e((function(e,r){if(void 0!==t||void 0!==i)throw new _u("Bad Promise constructor");t=e,i=r})),this.resolve=vu(t),this.reject=vu(i)};gu.f=function(e){return new yu(e)};var Eu,bu,wu,Iu=en,Tu=ts,Su=i,Au=l,Ru=Ji,ku=no,Cu=Va,Du=Xc,Ou=ve,Nu=B,Lu=H,xu=ms,Pu=Bl,Mu=Td.set,Uu=eu,Fu=function(e,t){try{1===arguments.length?console.error(e):console.error(e,t)}catch(TM){}},Bu=tu,Vu=Pd,Hu=ki,zu=iu,ju=gu,Wu="Promise",Gu=mu.CONSTRUCTOR,qu=mu.REJECTION_EVENT,Ku=mu.SUBCLASSING,Yu=Hu.getterFor(Wu),Xu=Hu.set,Zu=zu&&zu.prototype,Ju=zu,Qu=Zu,$u=Su.TypeError,eh=Su.document,th=Su.process,ih=ju.f,rh=ih,nh=!!(eh&&eh.createEvent&&Su.dispatchEvent),ah="unhandledrejection",oh=function(e){var t;return!(!Lu(e)||!Nu(t=e.then))&&t},sh=function(e,t){var i,r,n,a=t.value,o=1===t.state,s=o?e.ok:e.fail,c=e.resolve,l=e.reject,d=e.domain;try{s?(o||(2===t.rejection&&hh(t),t.rejection=1),!0===s?i=a:(d&&d.enter(),i=s(a),d&&(d.exit(),n=!0)),i===e.promise?l(new $u("Promise-chain cycle")):(r=oh(i))?Au(r,i,c,l):c(i)):l(a)}catch(TM){d&&!n&&d.exit(),l(TM)}},ch=function(e,t){e.notified||(e.notified=!0,Uu((function(){for(var i,r=e.reactions;i=r.get();)sh(i,e);e.notified=!1,t&&!e.rejection&&dh(e)})))},lh=function(e,t,i){var r,n;nh?((r=eh.createEvent("Event")).promise=t,r.reason=i,r.initEvent(e,!1,!0),Su.dispatchEvent(r)):r={promise:t,reason:i},!qu&&(n=Su["on"+e])?n(r):e===ah&&Fu("Unhandled promise rejection",i)},dh=function(e){Au(Mu,Su,(function(){var t,i=e.facade,r=e.value;if(uh(e)&&(t=Bu((function(){Tu?th.emit("unhandledRejection",r,i):lh(ah,i,r)})),e.rejection=Tu||uh(e)?2:1,t.error))throw t.value}))},uh=function(e){return 1!==e.rejection&&!e.parent},hh=function(e){Au(Mu,Su,(function(){var t=e.facade;Tu?th.emit("rejectionHandled",t):lh("rejectionhandled",t,e.value)}))},ph=function(e,t,i){return function(r){e(t,r,i)}},fh=function(e,t,i){e.done||(e.done=!0,i&&(e=i),e.value=t,e.state=2,ch(e,!0))},mh=function(e,t,i){if(!e.done){e.done=!0,i&&(e=i);try{if(e.facade===t)throw new $u("Promise can't be resolved itself");var r=oh(t);r?Uu((function(){var i={done:!1};try{Au(r,t,ph(mh,i,e),ph(fh,i,e))}catch(TM){fh(i,TM,e)}})):(e.value=t,e.state=1,ch(e,!1))}catch(TM){fh({done:!1},TM,e)}}};if(Gu&&(Qu=(Ju=function(e){xu(this,Qu),Ou(e),Au(Eu,this);var t=Yu(this);try{e(ph(mh,t),ph(fh,t))}catch(TM){fh(t,TM)}}).prototype,(Eu=function(e){Xu(this,{type:Wu,done:!1,notified:!1,parent:!1,reactions:new Vu,rejection:!1,state:0,value:null})}).prototype=Ru(Qu,"then",(function(e,t){var i=Yu(this),r=ih(Pu(this,Ju));return i.parent=!0,r.ok=!Nu(e)||e,r.fail=Nu(t)&&t,r.domain=Tu?th.domain:void 0,0===i.state?i.reactions.add(r):Uu((function(){sh(r,i)})),r.promise})),bu=function(){var e=new Eu,t=Yu(e);this.promise=e,this.resolve=ph(mh,t),this.reject=ph(fh,t)},ju.f=ih=function(e){return e===Ju||undefined===e?new bu(e):rh(e)},Nu(zu)&&Zu!==Object.prototype)){wu=Zu.then,Ku||Ru(Zu,"then",(function(e,t){var i=this;return new Ju((function(e,t){Au(wu,i,e,t)})).then(e,t)}),{unsafe:!0});try{delete Zu.constructor}catch(TM){}ku&&ku(Zu,Qu)}Iu({global:!0,constructor:!0,wrap:!0,forced:Gu},{Promise:Ju}),Cu(Ju,Wu,!1),Du(Wu);var gh=_a,vh=tt("iterator"),_h=Array.prototype,yh=function(e){return void 0!==e&&(gh.Array===e||_h[vh]===e)},Eh=ln,bh=Ee,wh=O,Ih=_a,Th=tt("iterator"),Sh=function(e){if(!wh(e))return bh(e,Th)||bh(e,"@@iterator")||Ih[Eh(e)]},Ah=l,Rh=ve,kh=Lt,Ch=pe,Dh=Sh,Oh=TypeError,Nh=function(e,t){var i=arguments.length<2?Dh(e):t;if(Rh(i))return kh(Ah(i,e));throw new Oh(Ch(e)+" is not iterable")},Lh=l,xh=Lt,Ph=Ee,Mh=function(e,t,i){var r,n;xh(e);try{if(!(r=Ph(e,"return"))){if("throw"===t)throw i;return i}r=Lh(r,e)}catch(TM){n=!0,r=TM}if("throw"===t)throw i;if(n)throw r;return xh(r),i},Uh=Yl,Fh=l,Bh=Lt,Vh=pe,Hh=yh,zh=ur,jh=G,Wh=Nh,Gh=Sh,qh=Mh,Kh=TypeError,Yh=function(e,t){this.stopped=e,this.result=t},Xh=Yh.prototype,Zh=function(e,t,i){var r,n,a,o,s,c,l,d=i&&i.that,u=!(!i||!i.AS_ENTRIES),h=!(!i||!i.IS_RECORD),p=!(!i||!i.IS_ITERATOR),f=!(!i||!i.INTERRUPTED),m=Uh(t,d),g=function(e){return r&&qh(r,"normal",e),new Yh(!0,e)},v=function(e){return u?(Bh(e),f?m(e[0],e[1],g):m(e[0],e[1])):f?m(e,g):m(e)};if(h)r=e.iterator;else if(p)r=e;else{if(!(n=Gh(e)))throw new Kh(Vh(e)+" is not iterable");if(Hh(n)){for(a=0,o=zh(e);o>a;a++)if((s=v(e[a]))&&jh(Xh,s))return s;return new Yh(!1)}r=Wh(e,n)}for(c=h?e.next:r.next;!(l=Fh(c,r)).done;){try{s=v(l.value)}catch(TM){qh(r,"throw",TM)}if("object"==typeof s&&s&&jh(Xh,s))return s}return new Yh(!1)},Jh=tt("iterator"),Qh=!1;try{var $h=0,ep={next:function(){return{done:!!$h++}},return:function(){Qh=!0}};ep[Jh]=function(){return this},Array.from(ep,(function(){throw 2}))}catch(TM){}var tp=function(e,t){try{if(!t&&!Qh)return!1}catch(TM){return!1}var i=!1;try{var r={};r[Jh]=function(){return{next:function(){return{done:i=!0}}}},e(r)}catch(TM){}return i},ip=iu,rp=mu.CONSTRUCTOR||!tp((function(e){ip.all(e).then(void 0,(function(){}))})),np=l,ap=ve,op=gu,sp=tu,cp=Zh;en({target:"Promise",stat:!0,forced:rp},{all:function(e){var t=this,i=op.f(t),r=i.resolve,n=i.reject,a=sp((function(){var i=ap(t.resolve),a=[],o=0,s=1;cp(e,(function(e){var c=o++,l=!1;s++,np(i,t,e).then((function(e){l||(l=!0,a[c]=e,--s||r(a))}),n)})),--s||r(a)}));return a.error&&n(a.value),i.promise}});var lp=en,dp=mu.CONSTRUCTOR,up=iu,hp=W,pp=B,fp=Ji,mp=up&&up.prototype;if(lp({target:"Promise",proto:!0,forced:dp,real:!0},{catch:function(e){return this.then(void 0,e)}}),pp(up)){var gp=hp("Promise").prototype.catch;mp.catch!==gp&&fp(mp,"catch",gp,{unsafe:!0})}var vp=l,_p=ve,yp=gu,Ep=tu,bp=Zh;en({target:"Promise",stat:!0,forced:rp},{race:function(e){var t=this,i=yp.f(t),r=i.reject,n=Ep((function(){var n=_p(t.resolve);bp(e,(function(e){vp(n,t,e).then(i.resolve,r)}))}));return n.error&&r(n.value),i.promise}});var wp=gu;en({target:"Promise",stat:!0,forced:mu.CONSTRUCTOR},{reject:function(e){var t=wp.f(this);return(0,t.reject)(e),t.promise}});var Ip=Lt,Tp=H,Sp=gu,Ap=function(e,t){if(Ip(e),Tp(t)&&t.constructor===e)return t;var i=Sp.f(e);return(0,i.resolve)(t),i.promise},Rp=en,kp=mu.CONSTRUCTOR,Cp=Ap;W("Promise"),Rp({target:"Promise",stat:!0,forced:kp},{resolve:function(e){return Cp(this,e)}});var Dp=en,Op=iu,Np=n,Lp=W,xp=B,Pp=Bl,Mp=Ap,Up=Ji,Fp=Op&&Op.prototype;if(Dp({target:"Promise",proto:!0,real:!0,forced:!!Op&&Np((function(){Fp.finally.call({then:function(){}},(function(){}))}))},{finally:function(e){var t=Pp(this,Lp("Promise")),i=xp(e);return this.then(i?function(i){return Mp(t,e()).then((function(){return i}))}:e,i?function(i){return Mp(t,e()).then((function(){throw i}))}:e)}}),xp(Op)){var Bp=Lp("Promise").prototype.finally;Fp.finally!==Bp&&Up(Fp,"finally",Bp,{unsafe:!0})}var Vp=H,Hp=S,zp=tt("match"),jp=function(e){var t;return Vp(e)&&(void 0!==(t=e[zp])?!!t:"RegExp"===Hp(e))},Wp=Lt,Gp=function(){var e=Wp(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},qp=l,Kp=He,Yp=G,Xp=Gp,Zp=RegExp.prototype,Jp=function(e){var t=e.flags;return void 0!==t||"flags"in Zp||Kp(e,"flags")||!Yp(Zp,e)?t:qp(Xp,e)},Qp=n,$p=i.RegExp,ef=Qp((function(){var e=$p("a","y");return e.lastIndex=2,null!==e.exec("abcd")})),tf=ef||Qp((function(){return!$p("a","y").sticky})),rf=ef||Qp((function(){var e=$p("^r","gy");return e.lastIndex=2,null!==e.exec("str")})),nf={BROKEN_CARET:rf,MISSED_STICKY:tf,UNSUPPORTED_Y:ef},af=kt.f,of=n,sf=i.RegExp,cf=of((function(){var e=sf(".","s");return!(e.dotAll&&e.test("\n")&&"s"===e.flags)})),lf=n,df=i.RegExp,uf=lf((function(){var e=df("(?<a>b)","g");return"b"!==e.exec("b").groups.a||"bc"!=="b".replace(e,"$<a>c")})),hf=a,pf=i,ff=b,mf=qr,gf=zs,vf=Kt,_f=oa,yf=Qi.f,Ef=G,bf=jp,wf=hn,If=Jp,Tf=nf,Sf=function(e,t,i){i in e||af(e,i,{configurable:!0,get:function(){return t[i]},set:function(e){t[i]=e}})},Af=Ji,Rf=n,kf=He,Cf=ki.enforce,Df=Xc,Of=cf,Nf=uf,Lf=tt("match"),xf=pf.RegExp,Pf=xf.prototype,Mf=pf.SyntaxError,Uf=ff(Pf.exec),Ff=ff("".charAt),Bf=ff("".replace),Vf=ff("".indexOf),Hf=ff("".slice),zf=/^\?<[^\s\d!#%&*+<=>@^][^\s!#%&*+<=>@^]*>/,jf=/a/g,Wf=/a/g,Gf=new xf(jf)!==jf,qf=Tf.MISSED_STICKY,Kf=Tf.UNSUPPORTED_Y,Yf=hf&&(!Gf||qf||Of||Nf||Rf((function(){return Wf[Lf]=!1,xf(jf)!==jf||xf(Wf)===Wf||"/a/i"!==String(xf(jf,"i"))})));if(mf("RegExp",Yf)){for(var Xf=function(e,t){var i,r,n,a,o,s,c=Ef(Pf,this),l=bf(e),d=void 0===t,u=[],h=e;if(!c&&l&&d&&e.constructor===Xf)return e;if((l||Ef(Pf,e))&&(e=e.source,d&&(t=If(h))),e=void 0===e?"":wf(e),t=void 0===t?"":wf(t),h=e,Of&&"dotAll"in jf&&(r=!!t&&Vf(t,"s")>-1)&&(t=Bf(t,/s/g,"")),i=t,qf&&"sticky"in jf&&(n=!!t&&Vf(t,"y")>-1)&&Kf&&(t=Bf(t,/y/g,"")),Nf&&(a=function(e){for(var t,i=e.length,r=0,n="",a=[],o=_f(null),s=!1,c=!1,l=0,d="";r<=i;r++){if("\\"===(t=Ff(e,r)))t+=Ff(e,++r);else if("]"===t)s=!1;else if(!s)switch(!0){case"["===t:s=!0;break;case"("===t:if(n+=t,"?:"===Hf(e,r+1,r+3))continue;Uf(zf,Hf(e,r+1))&&(r+=2,c=!0),l++;continue;case">"===t&&c:if(""===d||kf(o,d))throw new Mf("Invalid capture group name");o[d]=!0,a[a.length]=[d,l],c=!1,d="";continue}c?d+=t:n+=t}return[n,a]}(e),e=a[0],u=a[1]),o=gf(xf(e,t),c?this:Pf,Xf),(r||n||u.length)&&(s=Cf(o),r&&(s.dotAll=!0,s.raw=Xf(function(e){for(var t,i=e.length,r=0,n="",a=!1;r<=i;r++)"\\"!==(t=Ff(e,r))?a||"."!==t?("["===t?a=!0:"]"===t&&(a=!1),n+=t):n+="[\\s\\S]":n+=t+Ff(e,++r);return n}(e),i)),n&&(s.sticky=!0),u.length&&(s.groups=u)),e!==h)try{vf(o,"source",""===h?"(?:)":h)}catch(TM){}return o},Zf=yf(xf),Jf=0;Zf.length>Jf;)Sf(Xf,xf,Zf[Jf++]);Pf.constructor=Xf,Xf.prototype=Pf,Af(pf,"RegExp",Xf,{constructor:!0})}Df("RegExp");var Qf=l,$f=b,em=hn,tm=Gp,im=nf,rm=oa,nm=ki.get,am=cf,om=uf,sm=Pe("native-string-replace",String.prototype.replace),cm=RegExp.prototype.exec,lm=cm,dm=$f("".charAt),um=$f("".indexOf),hm=$f("".replace),pm=$f("".slice),fm=function(){var e=/a/,t=/b*/g;return Qf(cm,e,"a"),Qf(cm,t,"a"),0!==e.lastIndex||0!==t.lastIndex}(),mm=im.BROKEN_CARET,gm=void 0!==/()??/.exec("")[1];(fm||gm||mm||am||om)&&(lm=function(e){var t,i,r,n,a,o,s,c=this,l=nm(c),d=em(e),u=l.raw;if(u)return u.lastIndex=c.lastIndex,t=Qf(lm,u,d),c.lastIndex=u.lastIndex,t;var h=l.groups,p=mm&&c.sticky,f=Qf(tm,c),m=c.source,g=0,v=d;if(p&&(f=hm(f,"y",""),-1===um(f,"g")&&(f+="g"),v=pm(d,c.lastIndex),c.lastIndex>0&&(!c.multiline||c.multiline&&"\n"!==dm(d,c.lastIndex-1))&&(m="(?: "+m+")",v=" "+v,g++),i=new RegExp("^(?:"+m+")",f)),gm&&(i=new RegExp("^"+m+"$(?!\\s)",f)),fm&&(r=c.lastIndex),n=Qf(cm,p?i:c,v),p?n?(n.input=pm(n.input,g),n[0]=pm(n[0],g),n.index=c.lastIndex,c.lastIndex+=n[0].length):c.lastIndex=0:fm&&n&&(c.lastIndex=c.global?n.index+n[0].length:r),gm&&n&&n.length>1&&Qf(sm,n[0],i,(function(){for(a=1;a<arguments.length-2;a++)void 0===arguments[a]&&(n[a]=void 0)})),n&&h)for(n.groups=o=rm(null),a=0;a<h.length;a++)o[(s=h[a])[0]]=n[s[1]];return n});var vm=lm;en({target:"RegExp",proto:!0,forced:/./.exec!==vm},{exec:vm});var _m=a,ym=mn,Em=Gp,bm=n,wm=i.RegExp,Im=wm.prototype,Tm=_m&&bm((function(){var e=!0;try{wm(".","d")}catch(TM){e=!1}var t={},i="",r=e?"dgimsy":"gimsy",n=function(e,r){Object.defineProperty(t,e,{get:function(){return i+=r,!0}})},a={dotAll:"s",global:"g",ignoreCase:"i",multiline:"m",sticky:"y"};for(var o in e&&(a.hasIndices="d"),a)n(o,a[o]);return Object.getOwnPropertyDescriptor(Im,"flags").get.call(t)!==r||i!==r}));Tm&&ym(Im,"flags",{configurable:!0,get:Em});var Sm=ir,Am=hn,Rm=x,km=RangeError,Cm=b,Dm=lr,Om=hn,Nm=x,Lm=Cm((function(e){var t=Am(Rm(this)),i="",r=Sm(e);if(r<0||Infinity===r)throw new km("Wrong number of repetitions");for(;r>0;(r>>>=1)&&(t+=t))1&r&&(i+=t);return i})),xm=Cm("".slice),Pm=Math.ceil,Mm=function(e){return function(t,i,r){var n,a,o=Om(Nm(t)),s=Dm(i),c=o.length,l=void 0===r?" ":Om(r);return s<=c||""===l?o:((a=Lm(l,Pm((n=s-c)/l.length))).length>n&&(a=xm(a,0,n)),e?o+a:a+o)}},Um={start:Mm(!1),end:Mm(!0)},Fm=/Version\/10(?:\.\d+){1,2}(?: [\w./]+)?(?: Mobile\/\w+)? Safari\//.test(Y),Bm=Um.start;en({target:"String",proto:!0,forced:Fm},{padStart:function(e){return Bm(this,e,arguments.length>1?arguments[1]:void 0)}});var Vm=l,Hm=Ji,zm=vm,jm=n,Wm=tt,Gm=Kt,qm=Wm("species"),Km=RegExp.prototype,Ym=b,Xm=ir,Zm=hn,Jm=x,Qm=Ym("".charAt),$m=Ym("".charCodeAt),eg=Ym("".slice),tg=function(e){return function(t,i){var r,n,a=Zm(Jm(t)),o=Xm(i),s=a.length;return o<0||o>=s?e?"":void 0:(r=$m(a,o))<55296||r>56319||o+1===s||(n=$m(a,o+1))<56320||n>57343?e?Qm(a,o):r:e?eg(a,o,o+2):n-56320+(r-55296<<10)+65536}},ig={codeAt:tg(!1),charAt:tg(!0)},rg=ig.charAt,ng=b,ag=Fe,og=Math.floor,sg=ng("".charAt),cg=ng("".replace),lg=ng("".slice),dg=/\$([$&'`]|\d{1,2}|<[^>]*>)/g,ug=/\$([$&'`]|\d{1,2})/g,hg=function(e,t,i,r,n,a){var o=i+e.length,s=r.length,c=ug;return void 0!==n&&(n=ag(n),c=dg),cg(a,c,(function(a,c){var l;switch(sg(c,0)){case"$":return"$";case"&":return e;case"`":return lg(t,0,i);case"'":return lg(t,o);case"<":l=n[lg(c,1,-1)];break;default:var d=+c;if(0===d)return a;if(d>s){var u=og(d/10);return 0===u?a:u<=s?void 0===r[u-1]?sg(c,1):r[u-1]+sg(c,1):a}l=r[d-1]}return void 0===l?"":l}))},pg=l,fg=Lt,mg=B,gg=S,vg=vm,_g=TypeError,yg=Wl,Eg=l,bg=b,wg=function(e,t,i,r){var n=Wm(e),a=!jm((function(){var t={};return t[n]=function(){return 7},7!==""[e](t)})),o=a&&!jm((function(){var t=!1,i=/a/;return"split"===e&&((i={}).constructor={},i.constructor[qm]=function(){return i},i.flags="",i[n]=/./[n]),i.exec=function(){return t=!0,null},i[n](""),!t}));if(!a||!o||i){var s=/./[n],c=t(n,""[e],(function(e,t,i,r,n){var o=t.exec;return o===zm||o===Km.exec?a&&!n?{done:!0,value:Vm(s,t,i,r)}:{done:!0,value:Vm(e,i,t,r)}:{done:!1}}));Hm(String.prototype,e,c[0]),Hm(Km,n,c[1])}r&&Gm(Km[n],"sham",!0)},Ig=n,Tg=Lt,Sg=B,Ag=O,Rg=ir,kg=lr,Cg=hn,Dg=x,Og=function(e,t,i){return t+(i?rg(e,t).length:1)},Ng=Ee,Lg=hg,xg=function(e,t){var i=e.exec;if(mg(i)){var r=pg(i,e,t);return null!==r&&fg(r),r}if("RegExp"===gg(e))return pg(vg,e,t);throw new _g("RegExp#exec called on incompatible receiver")},Pg=tt("replace"),Mg=Math.max,Ug=Math.min,Fg=bg([].concat),Bg=bg([].push),Vg=bg("".indexOf),Hg=bg("".slice),zg=function(e){return void 0===e?e:String(e)},jg="$0"==="a".replace(/./,"$0"),Wg=!!/./[Pg]&&""===/./[Pg]("a","$0"),Gg=!Ig((function(){var e=/./;return e.exec=function(){var e=[];return e.groups={a:"7"},e},"7"!=="".replace(e,"$<a>")}));wg("replace",(function(e,t,i){var r=Wg?"$":"$0";return[function(e,i){var r=Dg(this),n=Ag(e)?void 0:Ng(e,Pg);return n?Eg(n,e,r,i):Eg(t,Cg(r),e,i)},function(e,n){var a=Tg(this),o=Cg(e);if("string"==typeof n&&-1===Vg(n,r)&&-1===Vg(n,"$<")){var s=i(t,a,o,n);if(s.done)return s.value}var c=Sg(n);c||(n=Cg(n));var l,d=a.global;d&&(l=a.unicode,a.lastIndex=0);for(var u,h=[];null!==(u=xg(a,o))&&(Bg(h,u),d);){""===Cg(u[0])&&(a.lastIndex=Og(o,kg(a.lastIndex),l))}for(var p="",f=0,m=0;m<h.length;m++){for(var g,v=Cg((u=h[m])[0]),_=Mg(Ug(Rg(u.index),o.length),0),y=[],E=1;E<u.length;E++)Bg(y,zg(u[E]));var b=u.groups;if(c){var w=Fg([v],y,_,o);void 0!==b&&Bg(w,b),g=Cg(yg(n,void 0,w))}else g=Lg(v,o,_,y,b,n);_>=f&&(p+=Hg(o,f,_)+g,f=_+v.length)}return p+Hg(o,f)}]}),!Gg||!jg||Wg);var qg="\t\n\v\f\r                 \u2028\u2029\ufeff",Kg=x,Yg=hn,Xg=qg,Zg=b("".replace),Jg=RegExp("^["+Xg+"]+"),Qg=RegExp("(^|[^"+Xg+"])["+Xg+"]+$"),$g=function(e){return function(t){var i=Yg(Kg(t));return 1&e&&(i=Zg(i,Jg,"")),2&e&&(i=Zg(i,Qg,"$1")),i}},ev={start:$g(1),end:$g(2),trim:$g(3)},tv=ei.PROPER,iv=n,rv=qg,nv=ev.trim;en({target:"String",proto:!0,forced:function(e){return iv((function(){return!!rv[e]()||"​…᠎"!=="​…᠎"[e]()||tv&&rv[e].name!==e}))}("trim")},{trim:function(){return nv(this)}});var av,ov,sv,cv={exports:{}},lv=ds,dv=a,uv=i,hv=B,pv=H,fv=He,mv=ln,gv=pe,vv=Kt,_v=Ji,yv=mn,Ev=G,bv=Ra,wv=no,Iv=tt,Tv=qe,Sv=ki.enforce,Av=ki.get,Rv=uv.Int8Array,kv=Rv&&Rv.prototype,Cv=uv.Uint8ClampedArray,Dv=Cv&&Cv.prototype,Ov=Rv&&bv(Rv),Nv=kv&&bv(kv),Lv=Object.prototype,xv=uv.TypeError,Pv=Iv("toStringTag"),Mv=Tv("TYPED_ARRAY_TAG"),Uv="TypedArrayConstructor",Fv=lv&&!!wv&&"Opera"!==mv(uv.opera),Bv=!1,Vv={Int8Array:1,Uint8Array:1,Uint8ClampedArray:1,Int16Array:2,Uint16Array:2,Int32Array:4,Uint32Array:4,Float32Array:4,Float64Array:8},Hv={BigInt64Array:8,BigUint64Array:8},zv=function(e){var t=bv(e);if(pv(t)){var i=Av(t);return i&&fv(i,Uv)?i[Uv]:zv(t)}},jv=function(e){if(!pv(e))return!1;var t=mv(e);return fv(Vv,t)||fv(Hv,t)};for(av in Vv)(sv=(ov=uv[av])&&ov.prototype)?Sv(sv)[Uv]=ov:Fv=!1;for(av in Hv)(sv=(ov=uv[av])&&ov.prototype)&&(Sv(sv)[Uv]=ov);if((!Fv||!hv(Ov)||Ov===Function.prototype)&&(Ov=function(){throw new xv("Incorrect invocation")},Fv))for(av in Vv)uv[av]&&wv(uv[av],Ov);if((!Fv||!Nv||Nv===Lv)&&(Nv=Ov.prototype,Fv))for(av in Vv)uv[av]&&wv(uv[av].prototype,Nv);if(Fv&&bv(Dv)!==Nv&&wv(Dv,Nv),dv&&!fv(Nv,Pv))for(av in Bv=!0,yv(Nv,Pv,{configurable:!0,get:function(){return pv(this)?this[Mv]:void 0}}),Vv)uv[av]&&vv(uv[av],Mv,av);var Wv={NATIVE_ARRAY_BUFFER_VIEWS:Fv,TYPED_ARRAY_TAG:Bv&&Mv,aTypedArray:function(e){if(jv(e))return e;throw new xv("Target is not a typed array")},aTypedArrayConstructor:function(e){if(hv(e)&&(!wv||Ev(Ov,e)))return e;throw new xv(gv(e)+" is not a typed array constructor")},exportTypedArrayMethod:function(e,t,i,r){if(dv){if(i)for(var n in Vv){var a=uv[n];if(a&&fv(a.prototype,e))try{delete a.prototype[e]}catch(TM){try{a.prototype[e]=t}catch(o){}}}Nv[e]&&!i||_v(Nv,e,i?t:Fv&&kv[e]||t,r)}},exportTypedArrayStaticMethod:function(e,t,i){var r,n;if(dv){if(wv){if(i)for(r in Vv)if((n=uv[r])&&fv(n,e))try{delete n[e]}catch(TM){}if(Ov[e]&&!i)return;try{return _v(Ov,e,i?t:Fv&&Ov[e]||t)}catch(TM){}}for(r in Vv)!(n=uv[r])||n[e]&&!i||_v(n,e,t)}},getTypedArrayConstructor:zv,isView:function(e){if(!pv(e))return!1;var t=mv(e);return"DataView"===t||fv(Vv,t)||fv(Hv,t)},isTypedArray:jv,TypedArray:Ov,TypedArrayPrototype:Nv},Gv=i,qv=n,Kv=tp,Yv=Wv.NATIVE_ARRAY_BUFFER_VIEWS,Xv=Gv.ArrayBuffer,Zv=Gv.Int8Array,Jv=!Yv||!qv((function(){Zv(1)}))||!qv((function(){new Zv(-1)}))||!Kv((function(e){new Zv,new Zv(null),new Zv(1.5),new Zv(e)}),!0)||qv((function(){return 1!==new Zv(new Xv(2),1,void 0).length})),Qv=H,$v=Math.floor,e_=Number.isInteger||function(e){return!Qv(e)&&isFinite(e)&&$v(e)===e},t_=ir,i_=RangeError,r_=function(e){var t=t_(e);if(t<0)throw new i_("The argument can't be less than 0");return t},n_=RangeError,a_=function(e,t){var i=r_(e);if(i%t)throw new n_("Wrong offset");return i},o_=Math.round,s_=ln,c_=lt,l_=TypeError,d_=function(e){var t=c_(e,"number");if("number"==typeof t)throw new l_("Can't convert number to bigint");return BigInt(t)},u_=Yl,h_=l,p_=xl,f_=Fe,m_=ur,g_=Nh,v_=Sh,__=yh,y_=function(e){var t=s_(e);return"BigInt64Array"===t||"BigUint64Array"===t},E_=Wv.aTypedArrayConstructor,b_=d_,w_=function(e){var t,i,r,n,a,o,s,c,l=p_(this),d=f_(e),u=arguments.length,h=u>1?arguments[1]:void 0,p=void 0!==h,f=v_(d);if(f&&!__(f))for(c=(s=g_(d,f)).next,d=[];!(o=h_(c,s)).done;)d.push(o.value);for(p&&u>2&&(h=u_(h,arguments[2])),i=m_(d),r=new(E_(l))(i),n=y_(r),t=0;i>t;t++)a=p?h(d[t],t):d[t],r[t]=n?b_(a):+a;return r},I_=as,T_=Dl,S_=H,A_=tt("species"),R_=Array,k_=function(e){var t;return I_(e)&&(t=e.constructor,(T_(t)&&(t===R_||I_(t.prototype))||S_(t)&&null===(t=t[A_]))&&(t=void 0)),void 0===t?R_:t},C_=Yl,D_=D,O_=Fe,N_=ur,L_=function(e,t){return new(k_(e))(0===t?0:t)},x_=b([].push),P_=function(e){var t=1===e,i=2===e,r=3===e,n=4===e,a=6===e,o=7===e,s=5===e||a;return function(c,l,d,u){for(var h,p,f=O_(c),m=D_(f),g=N_(m),v=C_(l,d),_=0,y=u||L_,E=t?y(c,g):i||o?y(c,0):void 0;g>_;_++)if((s||_ in m)&&(p=v(h=m[_],_,f),e))if(t)E[_]=p;else if(p)switch(e){case 3:return!0;case 5:return h;case 6:return _;case 2:x_(E,h)}else switch(e){case 4:return!1;case 7:x_(E,h)}return a?-1:r||n?n:E}},M_={forEach:P_(0),map:P_(1),filter:P_(2),some:P_(3),every:P_(4),find:P_(5),findIndex:P_(6),filterReject:P_(7)},U_=ur,F_=en,B_=i,V_=l,H_=a,z_=Jv,j_=Wv,W_=Wc,G_=ms,q_=g,K_=Kt,Y_=e_,X_=lr,Z_=ys,J_=a_,Q_=function(e){var t=o_(e);return t<0?0:t>255?255:255&t},$_=ht,ey=He,ty=ln,iy=H,ry=ue,ny=oa,ay=G,oy=no,sy=Qi.f,cy=w_,ly=M_.forEach,dy=Xc,uy=mn,hy=kt,py=r,fy=function(e,t,i){for(var r=0,n=arguments.length>2?i:U_(t),a=new e(n);n>r;)a[r]=t[r++];return a},my=zs,gy=ki.get,vy=ki.set,_y=ki.enforce,yy=hy.f,Ey=py.f,by=B_.RangeError,wy=W_.ArrayBuffer,Iy=wy.prototype,Ty=W_.DataView,Sy=j_.NATIVE_ARRAY_BUFFER_VIEWS,Ay=j_.TYPED_ARRAY_TAG,Ry=j_.TypedArray,ky=j_.TypedArrayPrototype,Cy=j_.isTypedArray,Dy="BYTES_PER_ELEMENT",Oy="Wrong length",Ny=function(e,t){uy(e,t,{configurable:!0,get:function(){return gy(this)[t]}})},Ly=function(e){var t;return ay(Iy,e)||"ArrayBuffer"===(t=ty(e))||"SharedArrayBuffer"===t},xy=function(e,t){return Cy(e)&&!ry(t)&&t in e&&Y_(+t)&&t>=0},Py=function(e,t){return t=$_(t),xy(e,t)?q_(2,e[t]):Ey(e,t)},My=function(e,t,i){return t=$_(t),!(xy(e,t)&&iy(i)&&ey(i,"value"))||ey(i,"get")||ey(i,"set")||i.configurable||ey(i,"writable")&&!i.writable||ey(i,"enumerable")&&!i.enumerable?yy(e,t,i):(e[t]=i.value,e)};H_?(Sy||(py.f=Py,hy.f=My,Ny(ky,"buffer"),Ny(ky,"byteOffset"),Ny(ky,"byteLength"),Ny(ky,"length")),F_({target:"Object",stat:!0,forced:!Sy},{getOwnPropertyDescriptor:Py,defineProperty:My}),cv.exports=function(e,t,i){var r=e.match(/\d+/)[0]/8,n=e+(i?"Clamped":"")+"Array",a="get"+e,o="set"+e,s=B_[n],c=s,l=c&&c.prototype,d={},u=function(e,t){yy(e,t,{get:function(){return function(e,t){var i=gy(e);return i.view[a](t*r+i.byteOffset,!0)}(this,t)},set:function(e){return function(e,t,n){var a=gy(e);a.view[o](t*r+a.byteOffset,i?Q_(n):n,!0)}(this,t,e)},enumerable:!0})};Sy?z_&&(c=t((function(e,t,i,n){return G_(e,l),my(iy(t)?Ly(t)?void 0!==n?new s(t,J_(i,r),n):void 0!==i?new s(t,J_(i,r)):new s(t):Cy(t)?fy(c,t):V_(cy,c,t):new s(Z_(t)),e,c)})),oy&&oy(c,Ry),ly(sy(s),(function(e){e in c||K_(c,e,s[e])})),c.prototype=l):(c=t((function(e,t,i,n){G_(e,l);var a,o,s,d=0,h=0;if(iy(t)){if(!Ly(t))return Cy(t)?fy(c,t):V_(cy,c,t);a=t,h=J_(i,r);var p=t.byteLength;if(void 0===n){if(p%r)throw new by(Oy);if((o=p-h)<0)throw new by(Oy)}else if((o=X_(n)*r)+h>p)throw new by(Oy);s=o/r}else s=Z_(t),a=new wy(o=s*r);for(vy(e,{buffer:a,byteOffset:h,byteLength:o,length:s,view:new Ty(a)});d<s;)u(e,d++)})),oy&&oy(c,Ry),l=c.prototype=ny(ky)),l.constructor!==c&&K_(l,"constructor",c),_y(l).TypedArrayConstructor=c,Ay&&K_(l,Ay,n);var h=c!==s;d[n]=c,F_({global:!0,constructor:!0,forced:h,sham:!Sy},d),Dy in c||K_(c,Dy,r),Dy in l||K_(l,Dy,r),dy(n)}):cv.exports=function(){};var Uy=cv.exports;Uy("Float32",(function(e){return function(t,i,r){return e(this,t,i,r)}})),Uy("Int32",(function(e){return function(t,i,r){return e(this,t,i,r)}})),Uy("Uint8",(function(e){return function(t,i,r){return e(this,t,i,r)}})),Uy("Uint16",(function(e){return function(t,i,r){return e(this,t,i,r)}})),Uy("Uint32",(function(e){return function(t,i,r){return e(this,t,i,r)}}));var Fy=Us,By=d_,Vy=ln,Hy=l,zy=n,jy=Wv.aTypedArray,Wy=Wv.exportTypedArrayMethod,Gy=b("".slice);Wy("fill",(function(e){var t=arguments.length;jy(this);var i="Big"===Gy(Vy(this),0,3)?By(e):+e;return Hy(Fy,this,i,t>1?arguments[1]:void 0,t>2?arguments[2]:void 0)}),zy((function(){var e=0;return new Int8Array(2).fill({valueOf:function(){return e++}}),1!==e}))),(0,Wv.exportTypedArrayStaticMethod)("from",w_,Jv);var qy=i,Ky=l,Yy=Wv,Xy=ur,Zy=a_,Jy=Fe,Qy=n,$y=qy.RangeError,eE=qy.Int8Array,tE=eE&&eE.prototype,iE=tE&&tE.set,rE=Yy.aTypedArray,nE=Yy.exportTypedArrayMethod,aE=!Qy((function(){var e=new Uint8ClampedArray(2);return Ky(iE,e,{length:1,0:3},1),3!==e[1]})),oE=aE&&Yy.NATIVE_ARRAY_BUFFER_VIEWS&&Qy((function(){var e=new eE(2);return e.set(1),e.set("2",1),0!==e[0]||2!==e[1]}));nE("set",(function(e){rE(this);var t=Zy(arguments.length>1?arguments[1]:void 0,1),i=Jy(e);if(aE)return Ky(iE,this,i,t);var r=this.length,n=Xy(i),a=0;if(n+t>r)throw new $y("Wrong length");for(;a<n;)this[t+a]=i[a++]}),!aE||oE);var sE=Fs,cE=Math.floor,lE=function(e,t){var i=e.length;if(i<8)for(var r,n,a=1;a<i;){for(n=a,r=e[a];n&&t(e[n-1],r)>0;)e[n]=e[--n];n!==a++&&(e[n]=r)}else for(var o=cE(i/2),s=lE(sE(e,0,o),t),c=lE(sE(e,o),t),l=s.length,d=c.length,u=0,h=0;u<l||h<d;)e[u+h]=u<l&&h<d?t(s[u],c[h])<=0?s[u++]:c[h++]:u<l?s[u++]:c[h++];return e},dE=lE,uE=Y.match(/firefox\/(\d+)/i),hE=!!uE&&+uE[1],pE=/MSIE|Trident/.test(Y),fE=Y.match(/AppleWebKit\/(\d+)\./),mE=!!fE&&+fE[1],gE=tl,vE=n,_E=ve,yE=dE,EE=hE,bE=pE,wE=te,IE=mE,TE=Wv.aTypedArray,SE=Wv.exportTypedArrayMethod,AE=i.Uint16Array,RE=AE&&gE(AE.prototype.sort),kE=!(!RE||vE((function(){RE(new AE(2),null)}))&&vE((function(){RE(new AE(2),{})}))),CE=!!RE&&!vE((function(){if(wE)return wE<74;if(EE)return EE<67;if(bE)return!0;if(IE)return IE<602;var e,t,i=new AE(516),r=Array(516);for(e=0;e<516;e++)t=e%4,i[e]=515-e,r[e]=e-2*t+3;for(RE(i,(function(e,t){return(e/4|0)-(t/4|0)})),e=0;e<516;e++)if(i[e]!==r[e])return!0}));SE("sort",(function(e){return void 0!==e&&_E(e),CE?RE(this,e):yE(TE(this),function(e){return function(t,i){return void 0!==e?+e(t,i)||0:i!=i?-1:t!=t?1:0===t&&0===i?1/t>0&&1/i<0?1:-1:t>i}}(e))}),!CE||kE);var DE=en,OE=l,NE=b,LE=x,xE=B,PE=O,ME=jp,UE=hn,FE=Ee,BE=Jp,VE=hg,HE=tt("replace"),zE=TypeError,jE=NE("".indexOf);NE("".replace);var WE=NE("".slice),GE=Math.max;DE({target:"String",proto:!0},{replaceAll:function(e,t){var i,r,n,a,o,s,c,l,d,u=LE(this),h=0,p="";if(!PE(e)){if(ME(e)&&(i=UE(LE(BE(e))),!~jE(i,"g")))throw new zE("`.replaceAll` does not allow non-global regexes");if(r=FE(e,HE))return OE(r,e,u,t)}for(n=UE(u),a=UE(e),(o=xE(t))||(t=UE(t)),s=a.length,c=GE(1,s),l=jE(n,a);-1!==l;)d=o?UE(t(a,l,n)):VE(a,n,l,[],void 0,t),p+=WE(n,h,l)+d,h=l+s,l=l+c>n.length?-1:jE(n,a,l+c);return h<n.length&&(p+=WE(n,h)),p}});var qE={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},KE=gt("span").classList,YE=KE&&KE.constructor&&KE.constructor.prototype,XE=YE===Object.prototype?void 0:YE,ZE=M_.forEach,JE=Xo("forEach")?[].forEach:function(e){return ZE(this,e,arguments.length>1?arguments[1]:void 0)},QE=i,$E=qE,eb=XE,tb=JE,ib=Kt,rb=function(e){if(e&&e.forEach!==tb)try{ib(e,"forEach",tb)}catch(TM){e.forEach=tb}};for(var nb in $E)$E[nb]&&rb(QE[nb]&&QE[nb].prototype);rb(eb);var ab=i,ob=qE,sb=XE,cb=Fo,lb=Kt,db=Va,ub=tt("iterator"),hb=cb.values,pb=function(e,t){if(e){if(e[ub]!==hb)try{lb(e,ub,hb)}catch(TM){e[ub]=hb}if(db(e,t,!0),ob[t])for(var i in cb)if(e[i]!==cb[i])try{lb(e,i,cb[i])}catch(TM){e[i]=cb[i]}}};for(var fb in ob)pb(ab[fb]&&ab[fb].prototype,fb);pb(sb,"DOMTokenList");var mb=Td.clear;en({global:!0,bind:!0,enumerable:!0,forced:i.clearImmediate!==mb},{clearImmediate:mb});var gb=i,vb=Wl,_b=B,yb=es,Eb=Y,bb=Fs,wb=Zl,Ib=gb.Function,Tb=/MSIE .\./.test(Eb)||"BUN"===yb&&function(){var e=gb.Bun.version.split(".");return e.length<3||"0"===e[0]&&(e[1]<3||"3"===e[1]&&"0"===e[2])}(),Sb=en,Ab=i,Rb=Td.set,kb=function(e,t){var i=t?2:1;return Tb?function(r,n){var a=wb(arguments.length,1)>i,o=_b(r)?r:Ib(r),s=a?bb(arguments,i):[],c=a?function(){vb(o,this,s)}:o;return t?e(c,n):e(c)}:e},Cb=Ab.setImmediate?kb(Rb,!1):Rb;Sb({global:!0,bind:!0,enumerable:!0,forced:Ab.setImmediate!==Cb},{setImmediate:Cb});var Db=ig.charAt,Ob=hn,Nb=ki,Lb=So,xb=Ao,Pb="String Iterator",Mb=Nb.set,Ub=Nb.getterFor(Pb);Lb(String,"String",(function(e){Mb(this,{type:Pb,string:Ob(e),index:0})}),(function(){var e,t=Ub(this),i=t.string,r=t.index;return r>=i.length?xb(void 0,!0):(e=Db(i,r),t.index+=e.length,xb(e,!1))}));var Fb=n,Bb=a,Vb=tt("iterator"),Hb=!Fb((function(){var e=new URL("b?a=1&b=2&c=3","https://a"),t=e.searchParams,i=new URLSearchParams("a=1&a=2&b=3"),r="";return e.pathname="c%20d",t.forEach((function(e,i){t.delete("b"),r+=i+e})),i.delete("a",2),i.delete("b",void 0),!t.size&&!Bb||!t.sort||"https://a/c%20d?a=1&c=3"!==e.href||"3"!==t.get("c")||"a=1"!==String(new URLSearchParams("?a=1"))||!t[Vb]||"a"!==new URL("https://a@b").username||"b"!==new URLSearchParams(new URLSearchParams("a=b")).get("a")||"xn--e1aybc"!==new URL("https://тест").host||"#%D0%B1"!==new URL("https://a#б").hash||"a1c3"!==r||"x"!==new URL("https://x",void 0).host})),zb=a,jb=b,Wb=l,Gb=n,qb=Fn,Kb=Ar,Yb=d,Xb=Fe,Zb=D,Jb=Object.assign,Qb=Object.defineProperty,$b=jb([].concat),ew=!Jb||Gb((function(){if(zb&&1!==Jb({b:1},Jb(Qb({},"a",{enumerable:!0,get:function(){Qb(this,"b",{value:3,enumerable:!1})}}),{b:2})).b)return!0;var e={},t={},i=Symbol("assign detection"),r="abcdefghijklmnopqrst";return e[i]=7,r.split("").forEach((function(e){t[e]=e})),7!==Jb({},e)[i]||qb(Jb({},t)).join("")!==r}))?function(e,t){for(var i=Xb(e),r=arguments.length,n=1,a=Kb.f,o=Yb.f;r>n;)for(var s,c=Zb(arguments[n++]),l=a?$b(qb(c),a(c)):qb(c),d=l.length,u=0;d>u;)s=l[u++],zb&&!Wb(o,c,s)||(i[s]=c[s]);return i}:Jb,tw=Lt,iw=Mh,rw=a,nw=kt,aw=g,ow=Yl,sw=l,cw=Fe,lw=function(e,t,i,r){try{return r?t(tw(i)[0],i[1]):t(i)}catch(TM){iw(e,"throw",TM)}},dw=yh,uw=Dl,hw=ur,pw=function(e,t,i){rw?nw.f(e,t,aw(0,i)):e[t]=i},fw=Nh,mw=Sh,gw=Array,vw=b,_w=2147483647,yw=/[^\0-\u007E]/,Ew=/[.\u3002\uFF0E\uFF61]/g,bw="Overflow: input needs wider integers to process",ww=RangeError,Iw=vw(Ew.exec),Tw=Math.floor,Sw=String.fromCharCode,Aw=vw("".charCodeAt),Rw=vw([].join),kw=vw([].push),Cw=vw("".replace),Dw=vw("".split),Ow=vw("".toLowerCase),Nw=function(e){return e+22+75*(e<26)},Lw=function(e,t,i){var r=0;for(e=i?Tw(e/700):e>>1,e+=Tw(e/t);e>455;)e=Tw(e/35),r+=36;return Tw(r+36*e/(e+38))},xw=function(e){var t=[];e=function(e){for(var t=[],i=0,r=e.length;i<r;){var n=Aw(e,i++);if(n>=55296&&n<=56319&&i<r){var a=Aw(e,i++);56320==(64512&a)?kw(t,((1023&n)<<10)+(1023&a)+65536):(kw(t,n),i--)}else kw(t,n)}return t}(e);var i,r,n=e.length,a=128,o=0,s=72;for(i=0;i<e.length;i++)(r=e[i])<128&&kw(t,Sw(r));var c=t.length,l=c;for(c&&kw(t,"-");l<n;){var d=_w;for(i=0;i<e.length;i++)(r=e[i])>=a&&r<d&&(d=r);var u=l+1;if(d-a>Tw((_w-o)/u))throw new ww(bw);for(o+=(d-a)*u,a=d,i=0;i<e.length;i++){if((r=e[i])<a&&++o>_w)throw new ww(bw);if(r===a){for(var h=o,p=36;;){var f=p<=s?1:p>=s+26?26:p-s;if(h<f)break;var m=h-f,g=36-f;kw(t,Sw(Nw(f+m%g))),h=Tw(m/g),p+=36}kw(t,Sw(Nw(h))),s=Lw(o,u,l===c),o=0,l++}}o++,a++}return Rw(t,"")},Pw=en,Mw=b,Uw=or,Fw=RangeError,Bw=String.fromCharCode,Vw=String.fromCodePoint,Hw=Mw([].join);Pw({target:"String",stat:!0,arity:1,forced:!!Vw&&1!==Vw.length},{fromCodePoint:function(e){for(var t,i=[],r=arguments.length,n=0;r>n;){if(t=+arguments[n++],Uw(t,1114111)!==t)throw new Fw(t+" is not a valid code point");i[n]=t<65536?Bw(t):Bw(55296+((t-=65536)>>10),t%1024+56320)}return Hw(i,"")}});var zw=en,jw=i,Ww=kd,Gw=W,qw=l,Kw=b,Yw=a,Xw=Hb,Zw=Ji,Jw=mn,Qw=hs,$w=Va,eI=Ka,tI=ki,iI=ms,rI=B,nI=He,aI=Yl,oI=ln,sI=Lt,cI=H,lI=hn,dI=oa,uI=g,hI=Nh,pI=Sh,fI=Ao,mI=Zl,gI=dE,vI=tt("iterator"),_I="URLSearchParams",yI=_I+"Iterator",EI=tI.set,bI=tI.getterFor(_I),wI=tI.getterFor(yI),II=Ww("fetch"),TI=Ww("Request"),SI=Ww("Headers"),AI=TI&&TI.prototype,RI=SI&&SI.prototype,kI=jw.TypeError,CI=jw.encodeURIComponent,DI=String.fromCharCode,OI=Gw("String","fromCodePoint"),NI=parseInt,LI=Kw("".charAt),xI=Kw([].join),PI=Kw([].push),MI=Kw("".replace),UI=Kw([].shift),FI=Kw([].splice),BI=Kw("".split),VI=Kw("".slice),HI=Kw(/./.exec),zI=/\+/g,jI=/^[0-9a-f]+$/i,WI=function(e,t){var i=VI(e,t,t+2);return HI(jI,i)?NI(i,16):NaN},GI=function(e){for(var t=0,i=128;i>0&&e&i;i>>=1)t++;return t},qI=function(e){var t=null;switch(e.length){case 1:t=e[0];break;case 2:t=(31&e[0])<<6|63&e[1];break;case 3:t=(15&e[0])<<12|(63&e[1])<<6|63&e[2];break;case 4:t=(7&e[0])<<18|(63&e[1])<<12|(63&e[2])<<6|63&e[3]}return t>1114111?null:t},KI=function(e){for(var t=(e=MI(e,zI," ")).length,i="",r=0;r<t;){var n=LI(e,r);if("%"===n){if("%"===LI(e,r+1)||r+3>t){i+="%",r++;continue}var a=WI(e,r+1);if(a!=a){i+=n,r++;continue}r+=2;var o=GI(a);if(0===o)n=DI(a);else{if(1===o||o>4){i+="�",r++;continue}for(var s=[a],c=1;c<o&&!(++r+3>t||"%"!==LI(e,r));){var l=WI(e,r+1);if(l!=l){r+=3;break}if(l>191||l<128)break;PI(s,l),r+=2,c++}if(s.length!==o){i+="�";continue}var d=qI(s);null===d?i+="�":n=OI(d)}}i+=n,r++}return i},YI=/[!'()~]|%20/g,XI={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+"},ZI=function(e){return XI[e]},JI=function(e){return MI(CI(e),YI,ZI)},QI=eI((function(e,t){EI(this,{type:yI,target:bI(e).entries,index:0,kind:t})}),_I,(function(){var e=wI(this),t=e.target,i=e.index++;if(!t||i>=t.length)return e.target=null,fI(void 0,!0);var r=t[i];switch(e.kind){case"keys":return fI(r.key,!1);case"values":return fI(r.value,!1)}return fI([r.key,r.value],!1)}),!0),$I=function(e){this.entries=[],this.url=null,void 0!==e&&(cI(e)?this.parseObject(e):this.parseQuery("string"==typeof e?"?"===LI(e,0)?VI(e,1):e:lI(e)))};$I.prototype={type:_I,bindURL:function(e){this.url=e,this.update()},parseObject:function(e){var t,i,r,n,a,o,s,c=this.entries,l=pI(e);if(l)for(i=(t=hI(e,l)).next;!(r=qw(i,t)).done;){if(a=(n=hI(sI(r.value))).next,(o=qw(a,n)).done||(s=qw(a,n)).done||!qw(a,n).done)throw new kI("Expected sequence with length 2");PI(c,{key:lI(o.value),value:lI(s.value)})}else for(var d in e)nI(e,d)&&PI(c,{key:d,value:lI(e[d])})},parseQuery:function(e){if(e)for(var t,i,r=this.entries,n=BI(e,"&"),a=0;a<n.length;)(t=n[a++]).length&&(i=BI(t,"="),PI(r,{key:KI(UI(i)),value:KI(xI(i,"="))}))},serialize:function(){for(var e,t=this.entries,i=[],r=0;r<t.length;)e=t[r++],PI(i,JI(e.key)+"="+JI(e.value));return xI(i,"&")},update:function(){this.entries.length=0,this.parseQuery(this.url.query)},updateURL:function(){this.url&&this.url.update()}};var eT=function(){iI(this,tT);var e=EI(this,new $I(arguments.length>0?arguments[0]:void 0));Yw||(this.size=e.entries.length)},tT=eT.prototype;if(Qw(tT,{append:function(e,t){var i=bI(this);mI(arguments.length,2),PI(i.entries,{key:lI(e),value:lI(t)}),Yw||this.length++,i.updateURL()},delete:function(e){for(var t=bI(this),i=mI(arguments.length,1),r=t.entries,n=lI(e),a=i<2?void 0:arguments[1],o=void 0===a?a:lI(a),s=0;s<r.length;){var c=r[s];if(c.key!==n||void 0!==o&&c.value!==o)s++;else if(FI(r,s,1),void 0!==o)break}Yw||(this.size=r.length),t.updateURL()},get:function(e){var t=bI(this).entries;mI(arguments.length,1);for(var i=lI(e),r=0;r<t.length;r++)if(t[r].key===i)return t[r].value;return null},getAll:function(e){var t=bI(this).entries;mI(arguments.length,1);for(var i=lI(e),r=[],n=0;n<t.length;n++)t[n].key===i&&PI(r,t[n].value);return r},has:function(e){for(var t=bI(this).entries,i=mI(arguments.length,1),r=lI(e),n=i<2?void 0:arguments[1],a=void 0===n?n:lI(n),o=0;o<t.length;){var s=t[o++];if(s.key===r&&(void 0===a||s.value===a))return!0}return!1},set:function(e,t){var i=bI(this);mI(arguments.length,1);for(var r,n=i.entries,a=!1,o=lI(e),s=lI(t),c=0;c<n.length;c++)(r=n[c]).key===o&&(a?FI(n,c--,1):(a=!0,r.value=s));a||PI(n,{key:o,value:s}),Yw||(this.size=n.length),i.updateURL()},sort:function(){var e=bI(this);gI(e.entries,(function(e,t){return e.key>t.key?1:-1})),e.updateURL()},forEach:function(e){for(var t,i=bI(this).entries,r=aI(e,arguments.length>1?arguments[1]:void 0),n=0;n<i.length;)r((t=i[n++]).value,t.key,this)},keys:function(){return new QI(this,"keys")},values:function(){return new QI(this,"values")},entries:function(){return new QI(this,"entries")}},{enumerable:!0}),Zw(tT,vI,tT.entries,{name:"entries"}),Zw(tT,"toString",(function(){return bI(this).serialize()}),{enumerable:!0}),Yw&&Jw(tT,"size",{get:function(){return bI(this).entries.length},configurable:!0,enumerable:!0}),$w(eT,_I),zw({global:!0,constructor:!0,forced:!Xw},{URLSearchParams:eT}),!Xw&&rI(SI)){var iT=Kw(RI.has),rT=Kw(RI.set),nT=function(e){if(cI(e)){var t,i=e.body;if(oI(i)===_I)return t=e.headers?new SI(e.headers):new SI,iT(t,"content-type")||rT(t,"content-type","application/x-www-form-urlencoded;charset=UTF-8"),dI(e,{body:uI(0,lI(i)),headers:uI(0,t)})}return e};if(rI(II)&&zw({global:!0,enumerable:!0,dontCallGetSet:!0,forced:!0},{fetch:function(e){return II(e,arguments.length>1?nT(arguments[1]):{})}}),rI(TI)){var aT=function(e){return iI(this,AI),new TI(e,arguments.length>1?nT(arguments[1]):{})};AI.constructor=aT,aT.prototype=AI,zw({global:!0,constructor:!0,dontCallGetSet:!0,forced:!0},{Request:aT})}}var oT,sT=en,cT=a,lT=Hb,dT=i,uT=Yl,hT=b,pT=Ji,fT=mn,mT=ms,gT=He,vT=ew,_T=function(e){var t=cw(e),i=uw(this),r=arguments.length,n=r>1?arguments[1]:void 0,a=void 0!==n;a&&(n=ow(n,r>2?arguments[2]:void 0));var o,s,c,l,d,u,h=mw(t),p=0;if(!h||this===gw&&dw(h))for(o=hw(t),s=i?new this(o):gw(o);o>p;p++)u=a?n(t[p],p):t[p],pw(s,p,u);else for(s=i?new this:[],d=(l=fw(t,h)).next;!(c=sw(d,l)).done;p++)u=a?lw(l,n,[c.value,p],!0):c.value,pw(s,p,u);return s.length=p,s},yT=Fs,ET=ig.codeAt,bT=function(e){var t,i,r=[],n=Dw(Cw(Ow(e),Ew,"."),".");for(t=0;t<n.length;t++)i=n[t],kw(r,Iw(yw,i)?"xn--"+xw(i):i);return Rw(r,".")},wT=hn,IT=Va,TT=Zl,ST={URLSearchParams:eT,getState:bI},AT=ki,RT=AT.set,kT=AT.getterFor("URL"),CT=ST.URLSearchParams,DT=ST.getState,OT=dT.URL,NT=dT.TypeError,LT=dT.parseInt,xT=Math.floor,PT=Math.pow,MT=hT("".charAt),UT=hT(/./.exec),FT=hT([].join),BT=hT(1..toString),VT=hT([].pop),HT=hT([].push),zT=hT("".replace),jT=hT([].shift),WT=hT("".split),GT=hT("".slice),qT=hT("".toLowerCase),KT=hT([].unshift),YT="Invalid scheme",XT="Invalid host",ZT="Invalid port",JT=/[a-z]/i,QT=/[\d+-.a-z]/i,$T=/\d/,eS=/^0x/i,tS=/^[0-7]+$/,iS=/^\d+$/,rS=/^[\da-f]+$/i,nS=/[\0\t\n\r #%/:<>?@[\\\]^|]/,aS=/[\0\t\n\r #/:<>?@[\\\]^|]/,oS=/^[\u0000-\u0020]+/,sS=/(^|[^\u0000-\u0020])[\u0000-\u0020]+$/,cS=/[\t\n\r]/g,lS=function(e){var t,i,r,n;if("number"==typeof e){for(t=[],i=0;i<4;i++)KT(t,e%256),e=xT(e/256);return FT(t,".")}if("object"==typeof e){for(t="",r=function(e){for(var t=null,i=1,r=null,n=0,a=0;a<8;a++)0!==e[a]?(n>i&&(t=r,i=n),r=null,n=0):(null===r&&(r=a),++n);return n>i?r:t}(e),i=0;i<8;i++)n&&0===e[i]||(n&&(n=!1),r===i?(t+=i?":":"::",n=!0):(t+=BT(e[i],16),i<7&&(t+=":")));return"["+t+"]"}return e},dS={},uS=vT({},dS,{" ":1,'"':1,"<":1,">":1,"`":1}),hS=vT({},uS,{"#":1,"?":1,"{":1,"}":1}),pS=vT({},hS,{"/":1,":":1,";":1,"=":1,"@":1,"[":1,"\\":1,"]":1,"^":1,"|":1}),fS=function(e,t){var i=ET(e,0);return i>32&&i<127&&!gT(t,e)?e:encodeURIComponent(e)},mS={ftp:21,file:null,http:80,https:443,ws:80,wss:443},gS=function(e,t){var i;return 2===e.length&&UT(JT,MT(e,0))&&(":"===(i=MT(e,1))||!t&&"|"===i)},vS=function(e){var t;return e.length>1&&gS(GT(e,0,2))&&(2===e.length||"/"===(t=MT(e,2))||"\\"===t||"?"===t||"#"===t)},_S=function(e){return"."===e||"%2e"===qT(e)},yS={},ES={},bS={},wS={},IS={},TS={},SS={},AS={},RS={},kS={},CS={},DS={},OS={},NS={},LS={},xS={},PS={},MS={},US={},FS={},BS={},VS=function(e,t,i){var r,n,a,o=wT(e);if(t){if(n=this.parse(o))throw new NT(n);this.searchParams=null}else{if(void 0!==i&&(r=new VS(i,!0)),n=this.parse(o,null,r))throw new NT(n);(a=DT(new CT)).bindURL(this),this.searchParams=a}};VS.prototype={type:"URL",parse:function(e,t,i){var r,n,a,o,s,c=this,l=t||yS,d=0,u="",h=!1,p=!1,f=!1;for(e=wT(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=zT(e,oS,""),e=zT(e,sS,"$1")),e=zT(e,cS,""),r=_T(e);d<=r.length;){switch(n=r[d],l){case yS:if(!n||!UT(JT,n)){if(t)return YT;l=bS;continue}u+=qT(n),l=ES;break;case ES:if(n&&(UT(QT,n)||"+"===n||"-"===n||"."===n))u+=qT(n);else{if(":"!==n){if(t)return YT;u="",l=bS,d=0;continue}if(t&&(c.isSpecial()!==gT(mS,u)||"file"===u&&(c.includesCredentials()||null!==c.port)||"file"===c.scheme&&!c.host))return;if(c.scheme=u,t)return void(c.isSpecial()&&mS[c.scheme]===c.port&&(c.port=null));u="","file"===c.scheme?l=NS:c.isSpecial()&&i&&i.scheme===c.scheme?l=wS:c.isSpecial()?l=AS:"/"===r[d+1]?(l=IS,d++):(c.cannotBeABaseURL=!0,HT(c.path,""),l=US)}break;case bS:if(!i||i.cannotBeABaseURL&&"#"!==n)return YT;if(i.cannotBeABaseURL&&"#"===n){c.scheme=i.scheme,c.path=yT(i.path),c.query=i.query,c.fragment="",c.cannotBeABaseURL=!0,l=BS;break}l="file"===i.scheme?NS:TS;continue;case wS:if("/"!==n||"/"!==r[d+1]){l=TS;continue}l=RS,d++;break;case IS:if("/"===n){l=kS;break}l=MS;continue;case TS:if(c.scheme=i.scheme,n===oT)c.username=i.username,c.password=i.password,c.host=i.host,c.port=i.port,c.path=yT(i.path),c.query=i.query;else if("/"===n||"\\"===n&&c.isSpecial())l=SS;else if("?"===n)c.username=i.username,c.password=i.password,c.host=i.host,c.port=i.port,c.path=yT(i.path),c.query="",l=FS;else{if("#"!==n){c.username=i.username,c.password=i.password,c.host=i.host,c.port=i.port,c.path=yT(i.path),c.path.length--,l=MS;continue}c.username=i.username,c.password=i.password,c.host=i.host,c.port=i.port,c.path=yT(i.path),c.query=i.query,c.fragment="",l=BS}break;case SS:if(!c.isSpecial()||"/"!==n&&"\\"!==n){if("/"!==n){c.username=i.username,c.password=i.password,c.host=i.host,c.port=i.port,l=MS;continue}l=kS}else l=RS;break;case AS:if(l=RS,"/"!==n||"/"!==MT(u,d+1))continue;d++;break;case RS:if("/"!==n&&"\\"!==n){l=kS;continue}break;case kS:if("@"===n){h&&(u="%40"+u),h=!0,a=_T(u);for(var m=0;m<a.length;m++){var g=a[m];if(":"!==g||f){var v=fS(g,pS);f?c.password+=v:c.username+=v}else f=!0}u=""}else if(n===oT||"/"===n||"?"===n||"#"===n||"\\"===n&&c.isSpecial()){if(h&&""===u)return"Invalid authority";d-=_T(u).length+1,u="",l=CS}else u+=n;break;case CS:case DS:if(t&&"file"===c.scheme){l=xS;continue}if(":"!==n||p){if(n===oT||"/"===n||"?"===n||"#"===n||"\\"===n&&c.isSpecial()){if(c.isSpecial()&&""===u)return XT;if(t&&""===u&&(c.includesCredentials()||null!==c.port))return;if(o=c.parseHost(u))return o;if(u="",l=PS,t)return;continue}"["===n?p=!0:"]"===n&&(p=!1),u+=n}else{if(""===u)return XT;if(o=c.parseHost(u))return o;if(u="",l=OS,t===DS)return}break;case OS:if(!UT($T,n)){if(n===oT||"/"===n||"?"===n||"#"===n||"\\"===n&&c.isSpecial()||t){if(""!==u){var _=LT(u,10);if(_>65535)return ZT;c.port=c.isSpecial()&&_===mS[c.scheme]?null:_,u=""}if(t)return;l=PS;continue}return ZT}u+=n;break;case NS:if(c.scheme="file","/"===n||"\\"===n)l=LS;else{if(!i||"file"!==i.scheme){l=MS;continue}switch(n){case oT:c.host=i.host,c.path=yT(i.path),c.query=i.query;break;case"?":c.host=i.host,c.path=yT(i.path),c.query="",l=FS;break;case"#":c.host=i.host,c.path=yT(i.path),c.query=i.query,c.fragment="",l=BS;break;default:vS(FT(yT(r,d),""))||(c.host=i.host,c.path=yT(i.path),c.shortenPath()),l=MS;continue}}break;case LS:if("/"===n||"\\"===n){l=xS;break}i&&"file"===i.scheme&&!vS(FT(yT(r,d),""))&&(gS(i.path[0],!0)?HT(c.path,i.path[0]):c.host=i.host),l=MS;continue;case xS:if(n===oT||"/"===n||"\\"===n||"?"===n||"#"===n){if(!t&&gS(u))l=MS;else if(""===u){if(c.host="",t)return;l=PS}else{if(o=c.parseHost(u))return o;if("localhost"===c.host&&(c.host=""),t)return;u="",l=PS}continue}u+=n;break;case PS:if(c.isSpecial()){if(l=MS,"/"!==n&&"\\"!==n)continue}else if(t||"?"!==n)if(t||"#"!==n){if(n!==oT&&(l=MS,"/"!==n))continue}else c.fragment="",l=BS;else c.query="",l=FS;break;case MS:if(n===oT||"/"===n||"\\"===n&&c.isSpecial()||!t&&("?"===n||"#"===n)){if(".."===(s=qT(s=u))||"%2e."===s||".%2e"===s||"%2e%2e"===s?(c.shortenPath(),"/"===n||"\\"===n&&c.isSpecial()||HT(c.path,"")):_S(u)?"/"===n||"\\"===n&&c.isSpecial()||HT(c.path,""):("file"===c.scheme&&!c.path.length&&gS(u)&&(c.host&&(c.host=""),u=MT(u,0)+":"),HT(c.path,u)),u="","file"===c.scheme&&(n===oT||"?"===n||"#"===n))for(;c.path.length>1&&""===c.path[0];)jT(c.path);"?"===n?(c.query="",l=FS):"#"===n&&(c.fragment="",l=BS)}else u+=fS(n,hS);break;case US:"?"===n?(c.query="",l=FS):"#"===n?(c.fragment="",l=BS):n!==oT&&(c.path[0]+=fS(n,dS));break;case FS:t||"#"!==n?n!==oT&&("'"===n&&c.isSpecial()?c.query+="%27":c.query+="#"===n?"%23":fS(n,dS)):(c.fragment="",l=BS);break;case BS:n!==oT&&(c.fragment+=fS(n,uS))}d++}},parseHost:function(e){var t,i,r;if("["===MT(e,0)){if("]"!==MT(e,e.length-1))return XT;if(t=function(e){var t,i,r,n,a,o,s,c=[0,0,0,0,0,0,0,0],l=0,d=null,u=0,h=function(){return MT(e,u)};if(":"===h()){if(":"!==MT(e,1))return;u+=2,d=++l}for(;h();){if(8===l)return;if(":"!==h()){for(t=i=0;i<4&&UT(rS,h());)t=16*t+LT(h(),16),u++,i++;if("."===h()){if(0===i)return;if(u-=i,l>6)return;for(r=0;h();){if(n=null,r>0){if(!("."===h()&&r<4))return;u++}if(!UT($T,h()))return;for(;UT($T,h());){if(a=LT(h(),10),null===n)n=a;else{if(0===n)return;n=10*n+a}if(n>255)return;u++}c[l]=256*c[l]+n,2!=++r&&4!==r||l++}if(4!==r)return;break}if(":"===h()){if(u++,!h())return}else if(h())return;c[l++]=t}else{if(null!==d)return;u++,d=++l}}if(null!==d)for(o=l-d,l=7;0!==l&&o>0;)s=c[l],c[l--]=c[d+o-1],c[d+--o]=s;else if(8!==l)return;return c}(GT(e,1,-1)),!t)return XT;this.host=t}else if(this.isSpecial()){if(e=bT(e),UT(nS,e))return XT;if(t=function(e){var t,i,r,n,a,o,s,c=WT(e,".");if(c.length&&""===c[c.length-1]&&c.length--,(t=c.length)>4)return e;for(i=[],r=0;r<t;r++){if(""===(n=c[r]))return e;if(a=10,n.length>1&&"0"===MT(n,0)&&(a=UT(eS,n)?16:8,n=GT(n,8===a?1:2)),""===n)o=0;else{if(!UT(10===a?iS:8===a?tS:rS,n))return e;o=LT(n,a)}HT(i,o)}for(r=0;r<t;r++)if(o=i[r],r===t-1){if(o>=PT(256,5-t))return null}else if(o>255)return null;for(s=VT(i),r=0;r<i.length;r++)s+=i[r]*PT(256,3-r);return s}(e),null===t)return XT;this.host=t}else{if(UT(aS,e))return XT;for(t="",i=_T(e),r=0;r<i.length;r++)t+=fS(i[r],dS);this.host=t}},cannotHaveUsernamePasswordPort:function(){return!this.host||this.cannotBeABaseURL||"file"===this.scheme},includesCredentials:function(){return""!==this.username||""!==this.password},isSpecial:function(){return gT(mS,this.scheme)},shortenPath:function(){var e=this.path,t=e.length;!t||"file"===this.scheme&&1===t&&gS(e[0],!0)||e.length--},serialize:function(){var e=this,t=e.scheme,i=e.username,r=e.password,n=e.host,a=e.port,o=e.path,s=e.query,c=e.fragment,l=t+":";return null!==n?(l+="//",e.includesCredentials()&&(l+=i+(r?":"+r:"")+"@"),l+=lS(n),null!==a&&(l+=":"+a)):"file"===t&&(l+="//"),l+=e.cannotBeABaseURL?o[0]:o.length?"/"+FT(o,"/"):"",null!==s&&(l+="?"+s),null!==c&&(l+="#"+c),l},setHref:function(e){var t=this.parse(e);if(t)throw new NT(t);this.searchParams.update()},getOrigin:function(){var e=this.scheme,t=this.port;if("blob"===e)try{return new HS(e.path[0]).origin}catch(TM){return"null"}return"file"!==e&&this.isSpecial()?e+"://"+lS(this.host)+(null!==t?":"+t:""):"null"},getProtocol:function(){return this.scheme+":"},setProtocol:function(e){this.parse(wT(e)+":",yS)},getUsername:function(){return this.username},setUsername:function(e){var t=_T(wT(e));if(!this.cannotHaveUsernamePasswordPort()){this.username="";for(var i=0;i<t.length;i++)this.username+=fS(t[i],pS)}},getPassword:function(){return this.password},setPassword:function(e){var t=_T(wT(e));if(!this.cannotHaveUsernamePasswordPort()){this.password="";for(var i=0;i<t.length;i++)this.password+=fS(t[i],pS)}},getHost:function(){var e=this.host,t=this.port;return null===e?"":null===t?lS(e):lS(e)+":"+t},setHost:function(e){this.cannotBeABaseURL||this.parse(e,CS)},getHostname:function(){var e=this.host;return null===e?"":lS(e)},setHostname:function(e){this.cannotBeABaseURL||this.parse(e,DS)},getPort:function(){var e=this.port;return null===e?"":wT(e)},setPort:function(e){this.cannotHaveUsernamePasswordPort()||(""===(e=wT(e))?this.port=null:this.parse(e,OS))},getPathname:function(){var e=this.path;return this.cannotBeABaseURL?e[0]:e.length?"/"+FT(e,"/"):""},setPathname:function(e){this.cannotBeABaseURL||(this.path=[],this.parse(e,PS))},getSearch:function(){var e=this.query;return e?"?"+e:""},setSearch:function(e){""===(e=wT(e))?this.query=null:("?"===MT(e,0)&&(e=GT(e,1)),this.query="",this.parse(e,FS)),this.searchParams.update()},getSearchParams:function(){return this.searchParams.facade},getHash:function(){var e=this.fragment;return e?"#"+e:""},setHash:function(e){""!==(e=wT(e))?("#"===MT(e,0)&&(e=GT(e,1)),this.fragment="",this.parse(e,BS)):this.fragment=null},update:function(){this.query=this.searchParams.serialize()||null}};var HS=function(e){var t=mT(this,zS),i=TT(arguments.length,1)>1?arguments[1]:void 0,r=RT(t,new VS(e,!1,i));cT||(t.href=r.serialize(),t.origin=r.getOrigin(),t.protocol=r.getProtocol(),t.username=r.getUsername(),t.password=r.getPassword(),t.host=r.getHost(),t.hostname=r.getHostname(),t.port=r.getPort(),t.pathname=r.getPathname(),t.search=r.getSearch(),t.searchParams=r.getSearchParams(),t.hash=r.getHash())},zS=HS.prototype,jS=function(e,t){return{get:function(){return kT(this)[e]()},set:t&&function(e){return kT(this)[t](e)},configurable:!0,enumerable:!0}};if(cT&&(fT(zS,"href",jS("serialize","setHref")),fT(zS,"origin",jS("getOrigin")),fT(zS,"protocol",jS("getProtocol","setProtocol")),fT(zS,"username",jS("getUsername","setUsername")),fT(zS,"password",jS("getPassword","setPassword")),fT(zS,"host",jS("getHost","setHost")),fT(zS,"hostname",jS("getHostname","setHostname")),fT(zS,"port",jS("getPort","setPort")),fT(zS,"pathname",jS("getPathname","setPathname")),fT(zS,"search",jS("getSearch","setSearch")),fT(zS,"searchParams",jS("getSearchParams")),fT(zS,"hash",jS("getHash","setHash"))),pT(zS,"toJSON",(function(){return kT(this).serialize()}),{enumerable:!0}),pT(zS,"toString",(function(){return kT(this).serialize()}),{enumerable:!0}),OT){var WS=OT.createObjectURL,GS=OT.revokeObjectURL;WS&&pT(HS,"createObjectURL",uT(WS,OT)),GS&&pT(HS,"revokeObjectURL",uT(GS,OT))}IT(HS,"URL"),sT({global:!0,constructor:!0,forced:!lT,sham:!cT},{URL:HS});var qS=l;en({target:"URL",proto:!0,enumerable:!0},{toJSON:function(){return qS(URL.prototype.toString,this)}});var KS,YS=Object.create,XS=Object.defineProperty,ZS=Object.defineProperties,JS=Object.getOwnPropertyDescriptor,QS=Object.getOwnPropertyDescriptors,$S=Object.getOwnPropertyNames,eA=Object.getOwnPropertySymbols,tA=Object.getPrototypeOf,iA=Object.prototype.hasOwnProperty,rA=Object.prototype.propertyIsEnumerable,nA=(e,t,i)=>t in e?XS(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i,aA=(e,t)=>{for(var i in t||(t={}))iA.call(t,i)&&nA(e,i,t[i]);if(eA)for(var i of eA(t))rA.call(t,i)&&nA(e,i,t[i]);return e},oA=(e,t)=>ZS(e,QS(t)),sA=(KS=function(e){if("undefined"!=typeof require)return require.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')},"undefined"!=typeof require?require:"undefined"!=typeof Proxy?new Proxy(KS,{get:(e,t)=>("undefined"!=typeof require?require:e)[t]}):KS),cA=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),lA=(e,t)=>{for(var i in t)XS(e,i,{get:t[i],enumerable:!0})},dA=(e,t,i)=>(i=null!=e?YS(tA(e)):{},((e,t,i,r)=>{if(t&&"object"==typeof t||"function"==typeof t)for(let n of $S(t))!iA.call(e,n)&&n!==i&&XS(e,n,{get:()=>t[n],enumerable:!(r=JS(t,n))||r.enumerable});return e})(!t&&e&&e.__esModule?i:XS(i,"default",{value:e,enumerable:!0}),e)),uA=(e,t,i,r)=>{for(var n,a=r>1?void 0:r?JS(t,i):t,o=e.length-1;o>=0;o--)(n=e[o])&&(a=(r?n(t,i,a):n(a))||a);return r&&a&&XS(t,i,a),a},hA=(e,t,i)=>nA(e,"symbol"!=typeof t?t+"":t,i),pA=cA(((e,t)=>{!function(i){"object"==typeof e&&void 0!==t?t.exports=i():"function"==typeof define&&define.amd?define([],i):("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).JSZip=i()}((function(){return function e(t,i,r){function n(o,s){if(!i[o]){if(!t[o]){var c="function"==typeof sA&&sA;if(!s&&c)return c(o,!0);if(a)return a(o,!0);var l=new Error("Cannot find module '"+o+"'");throw l.code="MODULE_NOT_FOUND",l}var d=i[o]={exports:{}};t[o][0].call(d.exports,(function(e){return n(t[o][1][e]||e)}),d,d.exports,e,t,i,r)}return i[o].exports}for(var a="function"==typeof sA&&sA,o=0;o<r.length;o++)n(r[o]);return n}({1:[function(e,t,i){var r=e("./utils"),n=e("./support"),a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";i.encode=function(e){for(var t,i,n,o,s,c,l,d=[],u=0,h=e.length,p=h,f="string"!==r.getTypeOf(e);u<e.length;)p=h-u,n=f?(t=e[u++],i=u<h?e[u++]:0,u<h?e[u++]:0):(t=e.charCodeAt(u++),i=u<h?e.charCodeAt(u++):0,u<h?e.charCodeAt(u++):0),o=t>>2,s=(3&t)<<4|i>>4,c=1<p?(15&i)<<2|n>>6:64,l=2<p?63&n:64,d.push(a.charAt(o)+a.charAt(s)+a.charAt(c)+a.charAt(l));return d.join("")},i.decode=function(e){var t,i,r,o,s,c,l=0,d=0,u="data:";if(e.substr(0,5)===u)throw new Error("Invalid base64 input, it looks like a data url.");var h,p=3*(e=e.replace(/[^A-Za-z0-9+/=]/g,"")).length/4;if(e.charAt(e.length-1)===a.charAt(64)&&p--,e.charAt(e.length-2)===a.charAt(64)&&p--,p%1!=0)throw new Error("Invalid base64 input, bad content length.");for(h=n.uint8array?new Uint8Array(0|p):new Array(0|p);l<e.length;)t=a.indexOf(e.charAt(l++))<<2|(o=a.indexOf(e.charAt(l++)))>>4,i=(15&o)<<4|(s=a.indexOf(e.charAt(l++)))>>2,r=(3&s)<<6|(c=a.indexOf(e.charAt(l++))),h[d++]=t,64!==s&&(h[d++]=i),64!==c&&(h[d++]=r);return h}},{"./support":30,"./utils":32}],2:[function(e,t,i){var r=e("./external"),n=e("./stream/DataWorker"),a=e("./stream/Crc32Probe"),o=e("./stream/DataLengthProbe");function s(e,t,i,r,n){this.compressedSize=e,this.uncompressedSize=t,this.crc32=i,this.compression=r,this.compressedContent=n}s.prototype={getContentWorker:function(){var e=new n(r.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new o("data_length")),t=this;return e.on("end",(function(){if(this.streamInfo.data_length!==t.uncompressedSize)throw new Error("Bug : uncompressed data size mismatch")})),e},getCompressedWorker:function(){return new n(r.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize",this.compressedSize).withStreamInfo("uncompressedSize",this.uncompressedSize).withStreamInfo("crc32",this.crc32).withStreamInfo("compression",this.compression)}},s.createWorkerFrom=function(e,t,i){return e.pipe(new a).pipe(new o("uncompressedSize")).pipe(t.compressWorker(i)).pipe(new o("compressedSize")).withStreamInfo("compression",t)},t.exports=s},{"./external":6,"./stream/Crc32Probe":25,"./stream/DataLengthProbe":26,"./stream/DataWorker":27}],3:[function(e,t,i){var r=e("./stream/GenericWorker");i.STORE={magic:"\0\0",compressWorker:function(){return new r("STORE compression")},uncompressWorker:function(){return new r("STORE decompression")}},i.DEFLATE=e("./flate")},{"./flate":7,"./stream/GenericWorker":28}],4:[function(e,t,i){var r=e("./utils"),n=function(){for(var e,t=[],i=0;i<256;i++){e=i;for(var r=0;r<8;r++)e=1&e?3988292384^e>>>1:e>>>1;t[i]=e}return t}();t.exports=function(e,t){return void 0!==e&&e.length?"string"!==r.getTypeOf(e)?function(e,t,i){var r=n,a=0+i;e^=-1;for(var o=0;o<a;o++)e=e>>>8^r[255&(e^t[o])];return~e}(0|t,e,e.length):function(e,t,i){var r=n,a=0+i;e^=-1;for(var o=0;o<a;o++)e=e>>>8^r[255&(e^t.charCodeAt(o))];return~e}(0|t,e,e.length):0}},{"./utils":32}],5:[function(e,t,i){i.base64=!1,i.binary=!1,i.dir=!1,i.createFolders=!0,i.date=null,i.compression=null,i.compressionOptions=null,i.comment=null,i.unixPermissions=null,i.dosPermissions=null},{}],6:[function(e,t,i){var r;r="undefined"!=typeof Promise?Promise:e("lie"),t.exports={Promise:r}},{lie:37}],7:[function(e,t,i){var r="undefined"!=typeof Uint8Array&&"undefined"!=typeof Uint16Array&&"undefined"!=typeof Uint32Array,n=e("pako"),a=e("./utils"),o=e("./stream/GenericWorker"),s=r?"uint8array":"array";function c(e,t){o.call(this,"FlateWorker/"+e),this._pako=null,this._pakoAction=e,this._pakoOptions=t,this.meta={}}i.magic="\b\0",a.inherits(c,o),c.prototype.processChunk=function(e){this.meta=e.meta,null===this._pako&&this._createPako(),this._pako.push(a.transformTo(s,e.data),!1)},c.prototype.flush=function(){o.prototype.flush.call(this),null===this._pako&&this._createPako(),this._pako.push([],!0)},c.prototype.cleanUp=function(){o.prototype.cleanUp.call(this),this._pako=null},c.prototype._createPako=function(){this._pako=new n[this._pakoAction]({raw:!0,level:this._pakoOptions.level||-1});var e=this;this._pako.onData=function(t){e.push({data:t,meta:e.meta})}},i.compressWorker=function(e){return new c("Deflate",e)},i.uncompressWorker=function(){return new c("Inflate",{})}},{"./stream/GenericWorker":28,"./utils":32,pako:38}],8:[function(e,t,i){function r(e,t){var i,r="";for(i=0;i<t;i++)r+=String.fromCharCode(255&e),e>>>=8;return r}function n(e,t,i,n,o,d){var u,h,p=e.file,f=e.compression,m=d!==s.utf8encode,g=a.transformTo("string",d(p.name)),v=a.transformTo("string",s.utf8encode(p.name)),_=p.comment,y=a.transformTo("string",d(_)),E=a.transformTo("string",s.utf8encode(_)),b=v.length!==p.name.length,w=E.length!==_.length,I="",T="",S="",A=p.dir,R=p.date,k={crc32:0,compressedSize:0,uncompressedSize:0};t&&!i||(k.crc32=e.crc32,k.compressedSize=e.compressedSize,k.uncompressedSize=e.uncompressedSize);var C=0;t&&(C|=8),m||!b&&!w||(C|=2048);var D,O,N,L=0,x=0;A&&(L|=16),"UNIX"===o?(x=798,L|=(D=p.unixPermissions,O=A,N=D,D||(N=O?16893:33204),(65535&N)<<16)):(x=20,L|=function(e){return 63&(e||0)}(p.dosPermissions)),u=R.getUTCHours(),u<<=6,u|=R.getUTCMinutes(),u<<=5,u|=R.getUTCSeconds()/2,h=R.getUTCFullYear()-1980,h<<=4,h|=R.getUTCMonth()+1,h<<=5,h|=R.getUTCDate(),b&&(T=r(1,1)+r(c(g),4)+v,I+="up"+r(T.length,2)+T),w&&(S=r(1,1)+r(c(y),4)+E,I+="uc"+r(S.length,2)+S);var P="";return P+="\n\0",P+=r(C,2),P+=f.magic,P+=r(u,2),P+=r(h,2),P+=r(k.crc32,4),P+=r(k.compressedSize,4),P+=r(k.uncompressedSize,4),P+=r(g.length,2),P+=r(I.length,2),{fileRecord:l.LOCAL_FILE_HEADER+P+g+I,dirRecord:l.CENTRAL_FILE_HEADER+r(x,2)+P+r(y.length,2)+"\0\0\0\0"+r(L,4)+r(n,4)+g+I+y}}var a=e("../utils"),o=e("../stream/GenericWorker"),s=e("../utf8"),c=e("../crc32"),l=e("../signature");function d(e,t,i,r){o.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=t,this.zipPlatform=i,this.encodeFileName=r,this.streamFiles=e,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}a.inherits(d,o),d.prototype.push=function(e){var t=e.meta.percent||0,i=this.entriesCount,r=this._sources.length;this.accumulate?this.contentBuffer.push(e):(this.bytesWritten+=e.data.length,o.prototype.push.call(this,{data:e.data,meta:{currentFile:this.currentFile,percent:i?(t+100*(i-r-1))/i:100}}))},d.prototype.openedSource=function(e){this.currentSourceOffset=this.bytesWritten,this.currentFile=e.file.name;var t=this.streamFiles&&!e.file.dir;if(t){var i=n(e,t,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:i.fileRecord,meta:{percent:0}})}else this.accumulate=!0},d.prototype.closedSource=function(e){this.accumulate=!1;var t,i=this.streamFiles&&!e.file.dir,a=n(e,i,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(a.dirRecord),i)this.push({data:(t=e,l.DATA_DESCRIPTOR+r(t.crc32,4)+r(t.compressedSize,4)+r(t.uncompressedSize,4)),meta:{percent:100}});else for(this.push({data:a.fileRecord,meta:{percent:0}});this.contentBuffer.length;)this.push(this.contentBuffer.shift());this.currentFile=null},d.prototype.flush=function(){for(var e=this.bytesWritten,t=0;t<this.dirRecords.length;t++)this.push({data:this.dirRecords[t],meta:{percent:100}});var i,n,o,s,c,d,u=this.bytesWritten-e,h=(i=this.dirRecords.length,n=u,o=e,s=this.zipComment,c=this.encodeFileName,d=a.transformTo("string",c(s)),l.CENTRAL_DIRECTORY_END+"\0\0\0\0"+r(i,2)+r(i,2)+r(n,4)+r(o,4)+r(d.length,2)+d);this.push({data:h,meta:{percent:100}})},d.prototype.prepareNextSource=function(){this.previous=this._sources.shift(),this.openedSource(this.previous.streamInfo),this.isPaused?this.previous.pause():this.previous.resume()},d.prototype.registerPrevious=function(e){this._sources.push(e);var t=this;return e.on("data",(function(e){t.processChunk(e)})),e.on("end",(function(){t.closedSource(t.previous.streamInfo),t._sources.length?t.prepareNextSource():t.end()})),e.on("error",(function(e){t.error(e)})),this},d.prototype.resume=function(){return!!o.prototype.resume.call(this)&&(!this.previous&&this._sources.length?(this.prepareNextSource(),!0):this.previous||this._sources.length||this.generatedError?void 0:(this.end(),!0))},d.prototype.error=function(e){var t=this._sources;if(!o.prototype.error.call(this,e))return!1;for(var i=0;i<t.length;i++)try{t[i].error(e)}catch(r){}return!0},d.prototype.lock=function(){o.prototype.lock.call(this);for(var e=this._sources,t=0;t<e.length;t++)e[t].lock()},t.exports=d},{"../crc32":4,"../signature":23,"../stream/GenericWorker":28,"../utf8":31,"../utils":32}],9:[function(e,t,i){var r=e("../compressions"),n=e("./ZipFileWorker");i.generateWorker=function(e,t,i){var a=new n(t.streamFiles,i,t.platform,t.encodeFileName),o=0;try{e.forEach((function(e,i){o++;var n=function(e,t){var i=e||t,n=r[i];if(!n)throw new Error(i+" is not a valid compression method !");return n}(i.options.compression,t.compression),s=i.options.compressionOptions||t.compressionOptions||{},c=i.dir,l=i.date;i._compressWorker(n,s).withStreamInfo("file",{name:e,dir:c,date:l,comment:i.comment||"",unixPermissions:i.unixPermissions,dosPermissions:i.dosPermissions}).pipe(a)})),a.entriesCount=o}catch(s){a.error(s)}return a}},{"../compressions":3,"./ZipFileWorker":8}],10:[function(e,t,i){function r(){if(!(this instanceof r))return new r;if(arguments.length)throw new Error("The constructor with parameters has been removed in JSZip 3.0, please check the upgrade guide.");this.files=Object.create(null),this.comment=null,this.root="",this.clone=function(){var e=new r;for(var t in this)"function"!=typeof this[t]&&(e[t]=this[t]);return e}}(r.prototype=e("./object")).loadAsync=e("./load"),r.support=e("./support"),r.defaults=e("./defaults"),r.version="3.10.1",r.loadAsync=function(e,t){return(new r).loadAsync(e,t)},r.external=e("./external"),t.exports=r},{"./defaults":5,"./external":6,"./load":11,"./object":15,"./support":30}],11:[function(e,t,i){var r=e("./utils"),n=e("./external"),a=e("./utf8"),o=e("./zipEntries"),s=e("./stream/Crc32Probe"),c=e("./nodejsUtils");function l(e){return new n.Promise((function(t,i){var r=e.decompressed.getContentWorker().pipe(new s);r.on("error",(function(e){i(e)})).on("end",(function(){r.streamInfo.crc32!==e.decompressed.crc32?i(new Error("Corrupted zip : CRC32 mismatch")):t()})).resume()}))}t.exports=function(e,t){var i=this;return t=r.extend(t||{},{base64:!1,checkCRC32:!1,optimizedBinaryString:!1,createFolders:!1,decodeFileName:a.utf8decode}),c.isNode&&c.isStream(e)?n.Promise.reject(new Error("JSZip can't accept a stream when loading a zip file.")):r.prepareContent("the loaded zip file",e,!0,t.optimizedBinaryString,t.base64).then((function(e){var i=new o(t);return i.load(e),i})).then((function(e){var i=[n.Promise.resolve(e)],r=e.files;if(t.checkCRC32)for(var a=0;a<r.length;a++)i.push(l(r[a]));return n.Promise.all(i)})).then((function(e){for(var n=e.shift(),a=n.files,o=0;o<a.length;o++){var s=a[o],c=s.fileNameStr,l=r.resolve(s.fileNameStr);i.file(l,s.decompressed,{binary:!0,optimizedBinaryString:!0,date:s.date,dir:s.dir,comment:s.fileCommentStr.length?s.fileCommentStr:null,unixPermissions:s.unixPermissions,dosPermissions:s.dosPermissions,createFolders:t.createFolders}),s.dir||(i.file(l).unsafeOriginalName=c)}return n.zipComment.length&&(i.comment=n.zipComment),i}))}},{"./external":6,"./nodejsUtils":14,"./stream/Crc32Probe":25,"./utf8":31,"./utils":32,"./zipEntries":33}],12:[function(e,t,i){var r=e("../utils"),n=e("../stream/GenericWorker");function a(e,t){n.call(this,"Nodejs stream input adapter for "+e),this._upstreamEnded=!1,this._bindStream(t)}r.inherits(a,n),a.prototype._bindStream=function(e){var t=this;(this._stream=e).pause(),e.on("data",(function(e){t.push({data:e,meta:{percent:0}})})).on("error",(function(e){t.isPaused?this.generatedError=e:t.error(e)})).on("end",(function(){t.isPaused?t._upstreamEnded=!0:t.end()}))},a.prototype.pause=function(){return!!n.prototype.pause.call(this)&&(this._stream.pause(),!0)},a.prototype.resume=function(){return!!n.prototype.resume.call(this)&&(this._upstreamEnded?this.end():this._stream.resume(),!0)},t.exports=a},{"../stream/GenericWorker":28,"../utils":32}],13:[function(e,t,i){var r=e("readable-stream").Readable;function n(e,t,i){r.call(this,t),this._helper=e;var n=this;e.on("data",(function(e,t){n.push(e)||n._helper.pause(),i&&i(t)})).on("error",(function(e){n.emit("error",e)})).on("end",(function(){n.push(null)}))}e("../utils").inherits(n,r),n.prototype._read=function(){this._helper.resume()},t.exports=n},{"../utils":32,"readable-stream":16}],14:[function(e,t,i){t.exports={isNode:"undefined"!=typeof Buffer,newBufferFrom:function(e,t){if(Buffer.from&&Buffer.from!==Uint8Array.from)return Buffer.from(e,t);if("number"==typeof e)throw new Error('The "data" argument must not be a number');return new Buffer(e,t)},allocBuffer:function(e){if(Buffer.alloc)return Buffer.alloc(e);var t=new Buffer(e);return t.fill(0),t},isBuffer:function(e){return Buffer.isBuffer(e)},isStream:function(e){return e&&"function"==typeof e.on&&"function"==typeof e.pause&&"function"==typeof e.resume}}},{}],15:[function(e,t,i){function r(e,t,i){var r,n=a.getTypeOf(t),s=a.extend(i||{},c);s.date=s.date||new Date,null!==s.compression&&(s.compression=s.compression.toUpperCase()),"string"==typeof s.unixPermissions&&(s.unixPermissions=parseInt(s.unixPermissions,8)),s.unixPermissions&&16384&s.unixPermissions&&(s.dir=!0),s.dosPermissions&&16&s.dosPermissions&&(s.dir=!0),s.dir&&(e=m(e)),s.createFolders&&(r=f(e))&&g.call(this,r,!0);var u="string"===n&&!1===s.binary&&!1===s.base64;i&&void 0!==i.binary||(s.binary=!u),(t instanceof l&&0===t.uncompressedSize||s.dir||!t||0===t.length)&&(s.base64=!1,s.binary=!0,t="",s.compression="STORE",n="string");var v;v=t instanceof l||t instanceof o?t:h.isNode&&h.isStream(t)?new p(e,t):a.prepareContent(e,t,s.binary,s.optimizedBinaryString,s.base64);var _=new d(e,v,s);this.files[e]=_}var n=e("./utf8"),a=e("./utils"),o=e("./stream/GenericWorker"),s=e("./stream/StreamHelper"),c=e("./defaults"),l=e("./compressedObject"),d=e("./zipObject"),u=e("./generate"),h=e("./nodejsUtils"),p=e("./nodejs/NodejsStreamInputAdapter"),f=function(e){"/"===e.slice(-1)&&(e=e.substring(0,e.length-1));var t=e.lastIndexOf("/");return 0<t?e.substring(0,t):""},m=function(e){return"/"!==e.slice(-1)&&(e+="/"),e},g=function(e,t){return t=void 0!==t?t:c.createFolders,e=m(e),this.files[e]||r.call(this,e,null,{dir:!0,createFolders:t}),this.files[e]};function v(e){return"[object RegExp]"===Object.prototype.toString.call(e)}var _={load:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},forEach:function(e){var t,i,r;for(t in this.files)r=this.files[t],(i=t.slice(this.root.length,t.length))&&t.slice(0,this.root.length)===this.root&&e(i,r)},filter:function(e){var t=[];return this.forEach((function(i,r){e(i,r)&&t.push(r)})),t},file:function(e,t,i){if(1!==arguments.length)return e=this.root+e,r.call(this,e,t,i),this;if(v(e)){var n=e;return this.filter((function(e,t){return!t.dir&&n.test(e)}))}var a=this.files[this.root+e];return a&&!a.dir?a:null},folder:function(e){if(!e)return this;if(v(e))return this.filter((function(t,i){return i.dir&&e.test(t)}));var t=this.root+e,i=g.call(this,t),r=this.clone();return r.root=i.name,r},remove:function(e){e=this.root+e;var t=this.files[e];if(t||("/"!==e.slice(-1)&&(e+="/"),t=this.files[e]),t&&!t.dir)delete this.files[e];else for(var i=this.filter((function(t,i){return i.name.slice(0,e.length)===e})),r=0;r<i.length;r++)delete this.files[i[r].name];return this},generate:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},generateInternalStream:function(e){var t,i={};try{if((i=a.extend(e||{},{streamFiles:!1,compression:"STORE",compressionOptions:null,type:"",platform:"DOS",comment:null,mimeType:"application/zip",encodeFileName:n.utf8encode})).type=i.type.toLowerCase(),i.compression=i.compression.toUpperCase(),"binarystring"===i.type&&(i.type="string"),!i.type)throw new Error("No output type specified.");a.checkSupport(i.type),"darwin"!==i.platform&&"freebsd"!==i.platform&&"linux"!==i.platform&&"sunos"!==i.platform||(i.platform="UNIX"),"win32"===i.platform&&(i.platform="DOS");var r=i.comment||this.comment||"";t=u.generateWorker(this,i,r)}catch(c){(t=new o("error")).error(c)}return new s(t,i.type||"string",i.mimeType)},generateAsync:function(e,t){return this.generateInternalStream(e).accumulate(t)},generateNodeStream:function(e,t){return(e=e||{}).type||(e.type="nodebuffer"),this.generateInternalStream(e).toNodejsStream(t)}};t.exports=_},{"./compressedObject":2,"./defaults":5,"./generate":9,"./nodejs/NodejsStreamInputAdapter":12,"./nodejsUtils":14,"./stream/GenericWorker":28,"./stream/StreamHelper":29,"./utf8":31,"./utils":32,"./zipObject":35}],16:[function(e,t,i){t.exports=e("stream")},{stream:void 0}],17:[function(e,t,i){var r=e("./DataReader");function n(e){r.call(this,e);for(var t=0;t<this.data.length;t++)e[t]=255&e[t]}e("../utils").inherits(n,r),n.prototype.byteAt=function(e){return this.data[this.zero+e]},n.prototype.lastIndexOfSignature=function(e){for(var t=e.charCodeAt(0),i=e.charCodeAt(1),r=e.charCodeAt(2),n=e.charCodeAt(3),a=this.length-4;0<=a;--a)if(this.data[a]===t&&this.data[a+1]===i&&this.data[a+2]===r&&this.data[a+3]===n)return a-this.zero;return-1},n.prototype.readAndCheckSignature=function(e){var t=e.charCodeAt(0),i=e.charCodeAt(1),r=e.charCodeAt(2),n=e.charCodeAt(3),a=this.readData(4);return t===a[0]&&i===a[1]&&r===a[2]&&n===a[3]},n.prototype.readData=function(e){if(this.checkOffset(e),0===e)return[];var t=this.data.slice(this.zero+this.index,this.zero+this.index+e);return this.index+=e,t},t.exports=n},{"../utils":32,"./DataReader":18}],18:[function(e,t,i){var r=e("../utils");function n(e){this.data=e,this.length=e.length,this.index=0,this.zero=0}n.prototype={checkOffset:function(e){this.checkIndex(this.index+e)},checkIndex:function(e){if(this.length<this.zero+e||e<0)throw new Error("End of data reached (data length = "+this.length+", asked index = "+e+"). Corrupted zip ?")},setIndex:function(e){this.checkIndex(e),this.index=e},skip:function(e){this.setIndex(this.index+e)},byteAt:function(){},readInt:function(e){var t,i=0;for(this.checkOffset(e),t=this.index+e-1;t>=this.index;t--)i=(i<<8)+this.byteAt(t);return this.index+=e,i},readString:function(e){return r.transformTo("string",this.readData(e))},readData:function(){},lastIndexOfSignature:function(){},readAndCheckSignature:function(){},readDate:function(){var e=this.readInt(4);return new Date(Date.UTC(1980+(e>>25&127),(e>>21&15)-1,e>>16&31,e>>11&31,e>>5&63,(31&e)<<1))}},t.exports=n},{"../utils":32}],19:[function(e,t,i){var r=e("./Uint8ArrayReader");function n(e){r.call(this,e)}e("../utils").inherits(n,r),n.prototype.readData=function(e){this.checkOffset(e);var t=this.data.slice(this.zero+this.index,this.zero+this.index+e);return this.index+=e,t},t.exports=n},{"../utils":32,"./Uint8ArrayReader":21}],20:[function(e,t,i){var r=e("./DataReader");function n(e){r.call(this,e)}e("../utils").inherits(n,r),n.prototype.byteAt=function(e){return this.data.charCodeAt(this.zero+e)},n.prototype.lastIndexOfSignature=function(e){return this.data.lastIndexOf(e)-this.zero},n.prototype.readAndCheckSignature=function(e){return e===this.readData(4)},n.prototype.readData=function(e){this.checkOffset(e);var t=this.data.slice(this.zero+this.index,this.zero+this.index+e);return this.index+=e,t},t.exports=n},{"../utils":32,"./DataReader":18}],21:[function(e,t,i){var r=e("./ArrayReader");function n(e){r.call(this,e)}e("../utils").inherits(n,r),n.prototype.readData=function(e){if(this.checkOffset(e),0===e)return new Uint8Array(0);var t=this.data.subarray(this.zero+this.index,this.zero+this.index+e);return this.index+=e,t},t.exports=n},{"../utils":32,"./ArrayReader":17}],22:[function(e,t,i){var r=e("../utils"),n=e("../support"),a=e("./ArrayReader"),o=e("./StringReader"),s=e("./NodeBufferReader"),c=e("./Uint8ArrayReader");t.exports=function(e){var t=r.getTypeOf(e);return r.checkSupport(t),"string"!==t||n.uint8array?"nodebuffer"===t?new s(e):n.uint8array?new c(r.transformTo("uint8array",e)):new a(r.transformTo("array",e)):new o(e)}},{"../support":30,"../utils":32,"./ArrayReader":17,"./NodeBufferReader":19,"./StringReader":20,"./Uint8ArrayReader":21}],23:[function(e,t,i){i.LOCAL_FILE_HEADER="PK",i.CENTRAL_FILE_HEADER="PK",i.CENTRAL_DIRECTORY_END="PK",i.ZIP64_CENTRAL_DIRECTORY_LOCATOR="PK",i.ZIP64_CENTRAL_DIRECTORY_END="PK",i.DATA_DESCRIPTOR="PK\b"},{}],24:[function(e,t,i){var r=e("./GenericWorker"),n=e("../utils");function a(e){r.call(this,"ConvertWorker to "+e),this.destType=e}n.inherits(a,r),a.prototype.processChunk=function(e){this.push({data:n.transformTo(this.destType,e.data),meta:e.meta})},t.exports=a},{"../utils":32,"./GenericWorker":28}],25:[function(e,t,i){var r=e("./GenericWorker"),n=e("../crc32");function a(){r.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}e("../utils").inherits(a,r),a.prototype.processChunk=function(e){this.streamInfo.crc32=n(e.data,this.streamInfo.crc32||0),this.push(e)},t.exports=a},{"../crc32":4,"../utils":32,"./GenericWorker":28}],26:[function(e,t,i){var r=e("../utils"),n=e("./GenericWorker");function a(e){n.call(this,"DataLengthProbe for "+e),this.propName=e,this.withStreamInfo(e,0)}r.inherits(a,n),a.prototype.processChunk=function(e){if(e){var t=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=t+e.data.length}n.prototype.processChunk.call(this,e)},t.exports=a},{"../utils":32,"./GenericWorker":28}],27:[function(e,t,i){var r=e("../utils"),n=e("./GenericWorker");function a(e){n.call(this,"DataWorker");var t=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type="",this._tickScheduled=!1,e.then((function(e){t.dataIsReady=!0,t.data=e,t.max=e&&e.length||0,t.type=r.getTypeOf(e),t.isPaused||t._tickAndRepeat()}),(function(e){t.error(e)}))}r.inherits(a,n),a.prototype.cleanUp=function(){n.prototype.cleanUp.call(this),this.data=null},a.prototype.resume=function(){return!!n.prototype.resume.call(this)&&(!this._tickScheduled&&this.dataIsReady&&(this._tickScheduled=!0,r.delay(this._tickAndRepeat,[],this)),!0)},a.prototype._tickAndRepeat=function(){this._tickScheduled=!1,this.isPaused||this.isFinished||(this._tick(),this.isFinished||(r.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0))},a.prototype._tick=function(){if(this.isPaused||this.isFinished)return!1;var e=null,t=Math.min(this.max,this.index+16384);if(this.index>=this.max)return this.end();switch(this.type){case"string":e=this.data.substring(this.index,t);break;case"uint8array":e=this.data.subarray(this.index,t);break;case"array":case"nodebuffer":e=this.data.slice(this.index,t)}return this.index=t,this.push({data:e,meta:{percent:this.max?this.index/this.max*100:0}})},t.exports=a},{"../utils":32,"./GenericWorker":28}],28:[function(e,t,i){function r(e){this.name=e||"default",this.streamInfo={},this.generatedError=null,this.extraStreamInfo={},this.isPaused=!0,this.isFinished=!1,this.isLocked=!1,this._listeners={data:[],end:[],error:[]},this.previous=null}r.prototype={push:function(e){this.emit("data",e)},end:function(){if(this.isFinished)return!1;this.flush();try{this.emit("end"),this.cleanUp(),this.isFinished=!0}catch(e){this.emit("error",e)}return!0},error:function(e){return!this.isFinished&&(this.isPaused?this.generatedError=e:(this.isFinished=!0,this.emit("error",e),this.previous&&this.previous.error(e),this.cleanUp()),!0)},on:function(e,t){return this._listeners[e].push(t),this},cleanUp:function(){this.streamInfo=this.generatedError=this.extraStreamInfo=null,this._listeners=[]},emit:function(e,t){if(this._listeners[e])for(var i=0;i<this._listeners[e].length;i++)this._listeners[e][i].call(this,t)},pipe:function(e){return e.registerPrevious(this)},registerPrevious:function(e){if(this.isLocked)throw new Error("The stream '"+this+"' has already been used.");this.streamInfo=e.streamInfo,this.mergeStreamInfo(),this.previous=e;var t=this;return e.on("data",(function(e){t.processChunk(e)})),e.on("end",(function(){t.end()})),e.on("error",(function(e){t.error(e)})),this},pause:function(){return!this.isPaused&&!this.isFinished&&(this.isPaused=!0,this.previous&&this.previous.pause(),!0)},resume:function(){if(!this.isPaused||this.isFinished)return!1;var e=this.isPaused=!1;return this.generatedError&&(this.error(this.generatedError),e=!0),this.previous&&this.previous.resume(),!e},flush:function(){},processChunk:function(e){this.push(e)},withStreamInfo:function(e,t){return this.extraStreamInfo[e]=t,this.mergeStreamInfo(),this},mergeStreamInfo:function(){for(var e in this.extraStreamInfo)Object.prototype.hasOwnProperty.call(this.extraStreamInfo,e)&&(this.streamInfo[e]=this.extraStreamInfo[e])},lock:function(){if(this.isLocked)throw new Error("The stream '"+this+"' has already been used.");this.isLocked=!0,this.previous&&this.previous.lock()},toString:function(){var e="Worker "+this.name;return this.previous?this.previous+" -> "+e:e}},t.exports=r},{}],29:[function(e,t,i){var r=e("../utils"),n=e("./ConvertWorker"),a=e("./GenericWorker"),o=e("../base64"),s=e("../support"),c=e("../external"),l=null;if(s.nodestream)try{l=e("../nodejs/NodejsStreamOutputAdapter")}catch(u){}function d(e,t,i){var o=t;switch(t){case"blob":case"arraybuffer":o="uint8array";break;case"base64":o="string"}try{this._internalType=o,this._outputType=t,this._mimeType=i,r.checkSupport(o),this._worker=e.pipe(new n(o)),e.lock()}catch(s){this._worker=new a("error"),this._worker.error(s)}}d.prototype={accumulate:function(e){return function(e,t){return new c.Promise((function(i,n){var a=[],s=e._internalType,c=e._outputType,l=e._mimeType;e.on("data",(function(e,i){a.push(e),t&&t(i)})).on("error",(function(e){a=[],n(e)})).on("end",(function(){try{var e=function(e,t,i){switch(e){case"blob":return r.newBlob(r.transformTo("arraybuffer",t),i);case"base64":return o.encode(t);default:return r.transformTo(e,t)}}(c,function(e,t){var i,r=0,n=null,a=0;for(i=0;i<t.length;i++)a+=t[i].length;switch(e){case"string":return t.join("");case"array":return Array.prototype.concat.apply([],t);case"uint8array":for(n=new Uint8Array(a),i=0;i<t.length;i++)n.set(t[i],r),r+=t[i].length;return n;case"nodebuffer":return Buffer.concat(t);default:throw new Error("concat : unsupported type '"+e+"'")}}(s,a),l);i(e)}catch(t){n(t)}a=[]})).resume()}))}(this,e)},on:function(e,t){var i=this;return"data"===e?this._worker.on(e,(function(e){t.call(i,e.data,e.meta)})):this._worker.on(e,(function(){r.delay(t,arguments,i)})),this},resume:function(){return r.delay(this._worker.resume,[],this._worker),this},pause:function(){return this._worker.pause(),this},toNodejsStream:function(e){if(r.checkSupport("nodestream"),"nodebuffer"!==this._outputType)throw new Error(this._outputType+" is not supported by this method");return new l(this,{objectMode:"nodebuffer"!==this._outputType},e)}},t.exports=d},{"../base64":1,"../external":6,"../nodejs/NodejsStreamOutputAdapter":13,"../support":30,"../utils":32,"./ConvertWorker":24,"./GenericWorker":28}],30:[function(e,t,i){if(i.base64=!0,i.array=!0,i.string=!0,i.arraybuffer="undefined"!=typeof ArrayBuffer&&"undefined"!=typeof Uint8Array,i.nodebuffer="undefined"!=typeof Buffer,i.uint8array="undefined"!=typeof Uint8Array,"undefined"==typeof ArrayBuffer)i.blob=!1;else{var r=new ArrayBuffer(0);try{i.blob=0===new Blob([r],{type:"application/zip"}).size}catch(a){try{var n=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);n.append(r),i.blob=0===n.getBlob("application/zip").size}catch(SA){i.blob=!1}}}try{i.nodestream=!!e("readable-stream").Readable}catch(a){i.nodestream=!1}},{"readable-stream":16}],31:[function(e,t,i){for(var r=e("./utils"),n=e("./support"),a=e("./nodejsUtils"),o=e("./stream/GenericWorker"),s=new Array(256),c=0;c<256;c++)s[c]=252<=c?6:248<=c?5:240<=c?4:224<=c?3:192<=c?2:1;function l(){o.call(this,"utf-8 decode"),this.leftOver=null}function d(){o.call(this,"utf-8 encode")}s[254]=s[254]=1,i.utf8encode=function(e){return n.nodebuffer?a.newBufferFrom(e,"utf-8"):function(e){var t,i,r,a,o,s=e.length,c=0;for(a=0;a<s;a++)55296==(64512&(i=e.charCodeAt(a)))&&a+1<s&&56320==(64512&(r=e.charCodeAt(a+1)))&&(i=65536+(i-55296<<10)+(r-56320),a++),c+=i<128?1:i<2048?2:i<65536?3:4;for(t=n.uint8array?new Uint8Array(c):new Array(c),a=o=0;o<c;a++)55296==(64512&(i=e.charCodeAt(a)))&&a+1<s&&56320==(64512&(r=e.charCodeAt(a+1)))&&(i=65536+(i-55296<<10)+(r-56320),a++),i<128?t[o++]=i:(i<2048?t[o++]=192|i>>>6:(i<65536?t[o++]=224|i>>>12:(t[o++]=240|i>>>18,t[o++]=128|i>>>12&63),t[o++]=128|i>>>6&63),t[o++]=128|63&i);return t}(e)},i.utf8decode=function(e){return n.nodebuffer?r.transformTo("nodebuffer",e).toString("utf-8"):function(e){var t,i,n,a,o=e.length,c=new Array(2*o);for(t=i=0;t<o;)if((n=e[t++])<128)c[i++]=n;else if(4<(a=s[n]))c[i++]=65533,t+=a-1;else{for(n&=2===a?31:3===a?15:7;1<a&&t<o;)n=n<<6|63&e[t++],a--;1<a?c[i++]=65533:n<65536?c[i++]=n:(n-=65536,c[i++]=55296|n>>10&1023,c[i++]=56320|1023&n)}return c.length!==i&&(c.subarray?c=c.subarray(0,i):c.length=i),r.applyFromCharCode(c)}(e=r.transformTo(n.uint8array?"uint8array":"array",e))},r.inherits(l,o),l.prototype.processChunk=function(e){var t=r.transformTo(n.uint8array?"uint8array":"array",e.data);if(this.leftOver&&this.leftOver.length){if(n.uint8array){var a=t;(t=new Uint8Array(a.length+this.leftOver.length)).set(this.leftOver,0),t.set(a,this.leftOver.length)}else t=this.leftOver.concat(t);this.leftOver=null}var o=function(e,t){var i;for((t=t||e.length)>e.length&&(t=e.length),i=t-1;0<=i&&128==(192&e[i]);)i--;return i<0||0===i?t:i+s[e[i]]>t?i:t}(t),c=t;o!==t.length&&(n.uint8array?(c=t.subarray(0,o),this.leftOver=t.subarray(o,t.length)):(c=t.slice(0,o),this.leftOver=t.slice(o,t.length))),this.push({data:i.utf8decode(c),meta:e.meta})},l.prototype.flush=function(){this.leftOver&&this.leftOver.length&&(this.push({data:i.utf8decode(this.leftOver),meta:{}}),this.leftOver=null)},i.Utf8DecodeWorker=l,r.inherits(d,o),d.prototype.processChunk=function(e){this.push({data:i.utf8encode(e.data),meta:e.meta})},i.Utf8EncodeWorker=d},{"./nodejsUtils":14,"./stream/GenericWorker":28,"./support":30,"./utils":32}],32:[function(e,t,i){var r=e("./support"),n=e("./base64"),a=e("./nodejsUtils"),o=e("./external");function s(e){return e}function c(e,t){for(var i=0;i<e.length;++i)t[i]=255&e.charCodeAt(i);return t}e("setimmediate"),i.newBlob=function(e,t){i.checkSupport("blob");try{return new Blob([e],{type:t})}catch(n){try{var r=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);return r.append(e),r.getBlob(t)}catch(a){throw new Error("Bug : can't construct the Blob.")}}};var l={stringifyByChunk:function(e,t,i){var r=[],n=0,a=e.length;if(a<=i)return String.fromCharCode.apply(null,e);for(;n<a;)"array"===t||"nodebuffer"===t?r.push(String.fromCharCode.apply(null,e.slice(n,Math.min(n+i,a)))):r.push(String.fromCharCode.apply(null,e.subarray(n,Math.min(n+i,a)))),n+=i;return r.join("")},stringifyByChar:function(e){for(var t="",i=0;i<e.length;i++)t+=String.fromCharCode(e[i]);return t},applyCanBeUsed:{uint8array:function(){try{return r.uint8array&&1===String.fromCharCode.apply(null,new Uint8Array(1)).length}catch(e){return!1}}(),nodebuffer:function(){try{return r.nodebuffer&&1===String.fromCharCode.apply(null,a.allocBuffer(1)).length}catch(e){return!1}}()}};function d(e){var t=65536,r=i.getTypeOf(e),n=!0;if("uint8array"===r?n=l.applyCanBeUsed.uint8array:"nodebuffer"===r&&(n=l.applyCanBeUsed.nodebuffer),n)for(;1<t;)try{return l.stringifyByChunk(e,r,t)}catch(a){t=Math.floor(t/2)}return l.stringifyByChar(e)}function u(e,t){for(var i=0;i<e.length;i++)t[i]=e[i];return t}i.applyFromCharCode=d;var h={};h.string={string:s,array:function(e){return c(e,new Array(e.length))},arraybuffer:function(e){return h.string.uint8array(e).buffer},uint8array:function(e){return c(e,new Uint8Array(e.length))},nodebuffer:function(e){return c(e,a.allocBuffer(e.length))}},h.array={string:d,array:s,arraybuffer:function(e){return new Uint8Array(e).buffer},uint8array:function(e){return new Uint8Array(e)},nodebuffer:function(e){return a.newBufferFrom(e)}},h.arraybuffer={string:function(e){return d(new Uint8Array(e))},array:function(e){return u(new Uint8Array(e),new Array(e.byteLength))},arraybuffer:s,uint8array:function(e){return new Uint8Array(e)},nodebuffer:function(e){return a.newBufferFrom(new Uint8Array(e))}},h.uint8array={string:d,array:function(e){return u(e,new Array(e.length))},arraybuffer:function(e){return e.buffer},uint8array:s,nodebuffer:function(e){return a.newBufferFrom(e)}},h.nodebuffer={string:d,array:function(e){return u(e,new Array(e.length))},arraybuffer:function(e){return h.nodebuffer.uint8array(e).buffer},uint8array:function(e){return u(e,new Uint8Array(e.length))},nodebuffer:s},i.transformTo=function(e,t){if(t=t||"",!e)return t;i.checkSupport(e);var r=i.getTypeOf(t);return h[r][e](t)},i.resolve=function(e){for(var t=e.split("/"),i=[],r=0;r<t.length;r++){var n=t[r];"."===n||""===n&&0!==r&&r!==t.length-1||(".."===n?i.pop():i.push(n))}return i.join("/")},i.getTypeOf=function(e){return"string"==typeof e?"string":"[object Array]"===Object.prototype.toString.call(e)?"array":r.nodebuffer&&a.isBuffer(e)?"nodebuffer":r.uint8array&&e instanceof Uint8Array?"uint8array":r.arraybuffer&&e instanceof ArrayBuffer?"arraybuffer":void 0},i.checkSupport=function(e){if(!r[e.toLowerCase()])throw new Error(e+" is not supported by this platform")},i.MAX_VALUE_16BITS=65535,i.MAX_VALUE_32BITS=-1,i.pretty=function(e){var t,i,r="";for(i=0;i<(e||"").length;i++)r+="\\x"+((t=e.charCodeAt(i))<16?"0":"")+t.toString(16).toUpperCase();return r},i.delay=function(e,t,i){setImmediate((function(){e.apply(i||null,t||[])}))},i.inherits=function(e,t){function i(){}i.prototype=t.prototype,e.prototype=new i},i.extend=function(){var e,t,i={};for(e=0;e<arguments.length;e++)for(t in arguments[e])Object.prototype.hasOwnProperty.call(arguments[e],t)&&void 0===i[t]&&(i[t]=arguments[e][t]);return i},i.prepareContent=function(e,t,a,s,l){return o.Promise.resolve(t).then((function(e){return r.blob&&(e instanceof Blob||-1!==["[object File]","[object Blob]"].indexOf(Object.prototype.toString.call(e)))&&"undefined"!=typeof FileReader?new o.Promise((function(t,i){var r=new FileReader;r.onload=function(e){t(e.target.result)},r.onerror=function(e){i(e.target.error)},r.readAsArrayBuffer(e)})):e})).then((function(t){var d,u=i.getTypeOf(t);return u?("arraybuffer"===u?t=i.transformTo("uint8array",t):"string"===u&&(l?t=n.decode(t):a&&!0!==s&&(t=c(d=t,r.uint8array?new Uint8Array(d.length):new Array(d.length)))),t):o.Promise.reject(new Error("Can't read the data of '"+e+"'. Is it in a supported JavaScript type (String, Blob, ArrayBuffer, etc) ?"))}))}},{"./base64":1,"./external":6,"./nodejsUtils":14,"./support":30,setimmediate:54}],33:[function(e,t,i){var r=e("./reader/readerFor"),n=e("./utils"),a=e("./signature"),o=e("./zipEntry"),s=e("./support");function c(e){this.files=[],this.loadOptions=e}c.prototype={checkSignature:function(e){if(!this.reader.readAndCheckSignature(e)){this.reader.index-=4;var t=this.reader.readString(4);throw new Error("Corrupted zip or bug: unexpected signature ("+n.pretty(t)+", expected "+n.pretty(e)+")")}},isSignature:function(e,t){var i=this.reader.index;this.reader.setIndex(e);var r=this.reader.readString(4)===t;return this.reader.setIndex(i),r},readBlockEndOfCentral:function(){this.diskNumber=this.reader.readInt(2),this.diskWithCentralDirStart=this.reader.readInt(2),this.centralDirRecordsOnThisDisk=this.reader.readInt(2),this.centralDirRecords=this.reader.readInt(2),this.centralDirSize=this.reader.readInt(4),this.centralDirOffset=this.reader.readInt(4),this.zipCommentLength=this.reader.readInt(2);var e=this.reader.readData(this.zipCommentLength),t=s.uint8array?"uint8array":"array",i=n.transformTo(t,e);this.zipComment=this.loadOptions.decodeFileName(i)},readBlockZip64EndOfCentral:function(){this.zip64EndOfCentralSize=this.reader.readInt(8),this.reader.skip(4),this.diskNumber=this.reader.readInt(4),this.diskWithCentralDirStart=this.reader.readInt(4),this.centralDirRecordsOnThisDisk=this.reader.readInt(8),this.centralDirRecords=this.reader.readInt(8),this.centralDirSize=this.reader.readInt(8),this.centralDirOffset=this.reader.readInt(8),this.zip64ExtensibleData={};for(var e,t,i,r=this.zip64EndOfCentralSize-44;0<r;)e=this.reader.readInt(2),t=this.reader.readInt(4),i=this.reader.readData(t),this.zip64ExtensibleData[e]={id:e,length:t,value:i}},readBlockZip64EndOfCentralLocator:function(){if(this.diskWithZip64CentralDirStart=this.reader.readInt(4),this.relativeOffsetEndOfZip64CentralDir=this.reader.readInt(8),this.disksCount=this.reader.readInt(4),1<this.disksCount)throw new Error("Multi-volumes zip are not supported")},readLocalFiles:function(){var e,t;for(e=0;e<this.files.length;e++)t=this.files[e],this.reader.setIndex(t.localHeaderOffset),this.checkSignature(a.LOCAL_FILE_HEADER),t.readLocalPart(this.reader),t.handleUTF8(),t.processAttributes()},readCentralDir:function(){var e;for(this.reader.setIndex(this.centralDirOffset);this.reader.readAndCheckSignature(a.CENTRAL_FILE_HEADER);)(e=new o({zip64:this.zip64},this.loadOptions)).readCentralPart(this.reader),this.files.push(e);if(this.centralDirRecords!==this.files.length&&0!==this.centralDirRecords&&0===this.files.length)throw new Error("Corrupted zip or bug: expected "+this.centralDirRecords+" records in central dir, got "+this.files.length)},readEndOfCentral:function(){var e=this.reader.lastIndexOfSignature(a.CENTRAL_DIRECTORY_END);if(e<0)throw this.isSignature(0,a.LOCAL_FILE_HEADER)?new Error("Corrupted zip: can't find end of central directory"):new Error("Can't find end of central directory : is this a zip file ? If it is, see https://stuk.github.io/jszip/documentation/howto/read_zip.html");this.reader.setIndex(e);var t=e;if(this.checkSignature(a.CENTRAL_DIRECTORY_END),this.readBlockEndOfCentral(),this.diskNumber===n.MAX_VALUE_16BITS||this.diskWithCentralDirStart===n.MAX_VALUE_16BITS||this.centralDirRecordsOnThisDisk===n.MAX_VALUE_16BITS||this.centralDirRecords===n.MAX_VALUE_16BITS||this.centralDirSize===n.MAX_VALUE_32BITS||this.centralDirOffset===n.MAX_VALUE_32BITS){if(this.zip64=!0,(e=this.reader.lastIndexOfSignature(a.ZIP64_CENTRAL_DIRECTORY_LOCATOR))<0)throw new Error("Corrupted zip: can't find the ZIP64 end of central directory locator");if(this.reader.setIndex(e),this.checkSignature(a.ZIP64_CENTRAL_DIRECTORY_LOCATOR),this.readBlockZip64EndOfCentralLocator(),!this.isSignature(this.relativeOffsetEndOfZip64CentralDir,a.ZIP64_CENTRAL_DIRECTORY_END)&&(this.relativeOffsetEndOfZip64CentralDir=this.reader.lastIndexOfSignature(a.ZIP64_CENTRAL_DIRECTORY_END),this.relativeOffsetEndOfZip64CentralDir<0))throw new Error("Corrupted zip: can't find the ZIP64 end of central directory");this.reader.setIndex(this.relativeOffsetEndOfZip64CentralDir),this.checkSignature(a.ZIP64_CENTRAL_DIRECTORY_END),this.readBlockZip64EndOfCentral()}var i=this.centralDirOffset+this.centralDirSize;this.zip64&&(i+=20,i+=12+this.zip64EndOfCentralSize);var r=t-i;if(0<r)this.isSignature(t,a.CENTRAL_FILE_HEADER)||(this.reader.zero=r);else if(r<0)throw new Error("Corrupted zip: missing "+Math.abs(r)+" bytes.")},prepareReader:function(e){this.reader=r(e)},load:function(e){this.prepareReader(e),this.readEndOfCentral(),this.readCentralDir(),this.readLocalFiles()}},t.exports=c},{"./reader/readerFor":22,"./signature":23,"./support":30,"./utils":32,"./zipEntry":34}],34:[function(e,t,i){var r=e("./reader/readerFor"),n=e("./utils"),a=e("./compressedObject"),o=e("./crc32"),s=e("./utf8"),c=e("./compressions"),l=e("./support");function d(e,t){this.options=e,this.loadOptions=t}d.prototype={isEncrypted:function(){return!(1&~this.bitFlag)},useUTF8:function(){return!(2048&~this.bitFlag)},readLocalPart:function(e){var t,i;if(e.skip(22),this.fileNameLength=e.readInt(2),i=e.readInt(2),this.fileName=e.readData(this.fileNameLength),e.skip(i),-1===this.compressedSize||-1===this.uncompressedSize)throw new Error("Bug or corrupted zip : didn't get enough information from the central directory (compressedSize === -1 || uncompressedSize === -1)");if(null===(t=function(e){for(var t in c)if(Object.prototype.hasOwnProperty.call(c,t)&&c[t].magic===e)return c[t];return null}(this.compressionMethod)))throw new Error("Corrupted zip : compression "+n.pretty(this.compressionMethod)+" unknown (inner file : "+n.transformTo("string",this.fileName)+")");this.decompressed=new a(this.compressedSize,this.uncompressedSize,this.crc32,t,e.readData(this.compressedSize))},readCentralPart:function(e){this.versionMadeBy=e.readInt(2),e.skip(2),this.bitFlag=e.readInt(2),this.compressionMethod=e.readString(2),this.date=e.readDate(),this.crc32=e.readInt(4),this.compressedSize=e.readInt(4),this.uncompressedSize=e.readInt(4);var t=e.readInt(2);if(this.extraFieldsLength=e.readInt(2),this.fileCommentLength=e.readInt(2),this.diskNumberStart=e.readInt(2),this.internalFileAttributes=e.readInt(2),this.externalFileAttributes=e.readInt(4),this.localHeaderOffset=e.readInt(4),this.isEncrypted())throw new Error("Encrypted zip are not supported");e.skip(t),this.readExtraFields(e),this.parseZIP64ExtraField(e),this.fileComment=e.readData(this.fileCommentLength)},processAttributes:function(){this.unixPermissions=null,this.dosPermissions=null;var e=this.versionMadeBy>>8;this.dir=!!(16&this.externalFileAttributes),0==e&&(this.dosPermissions=63&this.externalFileAttributes),3==e&&(this.unixPermissions=this.externalFileAttributes>>16&65535),this.dir||"/"!==this.fileNameStr.slice(-1)||(this.dir=!0)},parseZIP64ExtraField:function(){if(this.extraFields[1]){var e=r(this.extraFields[1].value);this.uncompressedSize===n.MAX_VALUE_32BITS&&(this.uncompressedSize=e.readInt(8)),this.compressedSize===n.MAX_VALUE_32BITS&&(this.compressedSize=e.readInt(8)),this.localHeaderOffset===n.MAX_VALUE_32BITS&&(this.localHeaderOffset=e.readInt(8)),this.diskNumberStart===n.MAX_VALUE_32BITS&&(this.diskNumberStart=e.readInt(4))}},readExtraFields:function(e){var t,i,r,n=e.index+this.extraFieldsLength;for(this.extraFields||(this.extraFields={});e.index+4<n;)t=e.readInt(2),i=e.readInt(2),r=e.readData(i),this.extraFields[t]={id:t,length:i,value:r};e.setIndex(n)},handleUTF8:function(){var e=l.uint8array?"uint8array":"array";if(this.useUTF8())this.fileNameStr=s.utf8decode(this.fileName),this.fileCommentStr=s.utf8decode(this.fileComment);else{var t=this.findExtraFieldUnicodePath();if(null!==t)this.fileNameStr=t;else{var i=n.transformTo(e,this.fileName);this.fileNameStr=this.loadOptions.decodeFileName(i)}var r=this.findExtraFieldUnicodeComment();if(null!==r)this.fileCommentStr=r;else{var a=n.transformTo(e,this.fileComment);this.fileCommentStr=this.loadOptions.decodeFileName(a)}}},findExtraFieldUnicodePath:function(){var e=this.extraFields[28789];if(e){var t=r(e.value);return 1!==t.readInt(1)||o(this.fileName)!==t.readInt(4)?null:s.utf8decode(t.readData(e.length-5))}return null},findExtraFieldUnicodeComment:function(){var e=this.extraFields[25461];if(e){var t=r(e.value);return 1!==t.readInt(1)||o(this.fileComment)!==t.readInt(4)?null:s.utf8decode(t.readData(e.length-5))}return null}},t.exports=d},{"./compressedObject":2,"./compressions":3,"./crc32":4,"./reader/readerFor":22,"./support":30,"./utf8":31,"./utils":32}],35:[function(e,t,i){function r(e,t,i){this.name=e,this.dir=i.dir,this.date=i.date,this.comment=i.comment,this.unixPermissions=i.unixPermissions,this.dosPermissions=i.dosPermissions,this._data=t,this._dataBinary=i.binary,this.options={compression:i.compression,compressionOptions:i.compressionOptions}}var n=e("./stream/StreamHelper"),a=e("./stream/DataWorker"),o=e("./utf8"),s=e("./compressedObject"),c=e("./stream/GenericWorker");r.prototype={internalStream:function(e){var t=null,i="string";try{if(!e)throw new Error("No output type specified.");var r="string"===(i=e.toLowerCase())||"text"===i;"binarystring"!==i&&"text"!==i||(i="string"),t=this._decompressWorker();var a=!this._dataBinary;a&&!r&&(t=t.pipe(new o.Utf8EncodeWorker)),!a&&r&&(t=t.pipe(new o.Utf8DecodeWorker))}catch(s){(t=new c("error")).error(s)}return new n(t,i,"")},async:function(e,t){return this.internalStream(e).accumulate(t)},nodeStream:function(e,t){return this.internalStream(e||"nodebuffer").toNodejsStream(t)},_compressWorker:function(e,t){if(this._data instanceof s&&this._data.compression.magic===e.magic)return this._data.getCompressedWorker();var i=this._decompressWorker();return this._dataBinary||(i=i.pipe(new o.Utf8EncodeWorker)),s.createWorkerFrom(i,e,t)},_decompressWorker:function(){return this._data instanceof s?this._data.getContentWorker():this._data instanceof c?this._data:new a(this._data)}};for(var l=["asText","asBinary","asNodeBuffer","asUint8Array","asArrayBuffer"],d=function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},u=0;u<l.length;u++)r.prototype[l[u]]=d;t.exports=r},{"./compressedObject":2,"./stream/DataWorker":27,"./stream/GenericWorker":28,"./stream/StreamHelper":29,"./utf8":31}],36:[function(e,t,i){(function(e){var i,r,n=e.MutationObserver||e.WebKitMutationObserver;if(n){var a=0,o=new n(d),s=e.document.createTextNode("");o.observe(s,{characterData:!0}),i=function(){s.data=a=++a%2}}else if(e.setImmediate||void 0===e.MessageChannel)i="document"in e&&"onreadystatechange"in e.document.createElement("script")?function(){var t=e.document.createElement("script");t.onreadystatechange=function(){d(),t.onreadystatechange=null,t.parentNode.removeChild(t),t=null},e.document.documentElement.appendChild(t)}:function(){setTimeout(d,0)};else{var c=new e.MessageChannel;c.port1.onmessage=d,i=function(){c.port2.postMessage(0)}}var l=[];function d(){var e,t;r=!0;for(var i=l.length;i;){for(t=l,l=[],e=-1;++e<i;)t[e]();i=l.length}r=!1}t.exports=function(e){1!==l.push(e)||r||i()}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],37:[function(e,t,i){var r=e("immediate");function n(){}var a={},o=["REJECTED"],s=["FULFILLED"],c=["PENDING"];function l(e){if("function"!=typeof e)throw new TypeError("resolver must be a function");this.state=c,this.queue=[],this.outcome=void 0,e!==n&&p(this,e)}function d(e,t,i){this.promise=e,"function"==typeof t&&(this.onFulfilled=t,this.callFulfilled=this.otherCallFulfilled),"function"==typeof i&&(this.onRejected=i,this.callRejected=this.otherCallRejected)}function u(e,t,i){r((function(){var r;try{r=t(i)}catch(vO){return a.reject(e,vO)}r===e?a.reject(e,new TypeError("Cannot resolve promise with itself")):a.resolve(e,r)}))}function h(e){var t=e&&e.then;if(e&&("object"==typeof e||"function"==typeof e)&&"function"==typeof t)return function(){t.apply(e,arguments)}}function p(e,t){var i=!1;function r(t){i||(i=!0,a.reject(e,t))}function n(t){i||(i=!0,a.resolve(e,t))}var o=f((function(){t(n,r)}));"error"===o.status&&r(o.value)}function f(e,t){var i={};try{i.value=e(t),i.status="success"}catch(r){i.status="error",i.value=r}return i}(t.exports=l).prototype.finally=function(e){if("function"!=typeof e)return this;var t=this.constructor;return this.then((function(i){return t.resolve(e()).then((function(){return i}))}),(function(i){return t.resolve(e()).then((function(){throw i}))}))},l.prototype.catch=function(e){return this.then(null,e)},l.prototype.then=function(e,t){if("function"!=typeof e&&this.state===s||"function"!=typeof t&&this.state===o)return this;var i=new this.constructor(n);return this.state!==c?u(i,this.state===s?e:t,this.outcome):this.queue.push(new d(i,e,t)),i},d.prototype.callFulfilled=function(e){a.resolve(this.promise,e)},d.prototype.otherCallFulfilled=function(e){u(this.promise,this.onFulfilled,e)},d.prototype.callRejected=function(e){a.reject(this.promise,e)},d.prototype.otherCallRejected=function(e){u(this.promise,this.onRejected,e)},a.resolve=function(e,t){var i=f(h,t);if("error"===i.status)return a.reject(e,i.value);var r=i.value;if(r)p(e,r);else{e.state=s,e.outcome=t;for(var n=-1,o=e.queue.length;++n<o;)e.queue[n].callFulfilled(t)}return e},a.reject=function(e,t){e.state=o,e.outcome=t;for(var i=-1,r=e.queue.length;++i<r;)e.queue[i].callRejected(t);return e},l.resolve=function(e){return e instanceof this?e:a.resolve(new this(n),e)},l.reject=function(e){var t=new this(n);return a.reject(t,e)},l.all=function(e){var t=this;if("[object Array]"!==Object.prototype.toString.call(e))return this.reject(new TypeError("must be an array"));var i=e.length,r=!1;if(!i)return this.resolve([]);for(var o=new Array(i),s=0,c=-1,l=new this(n);++c<i;)d(e[c],c);return l;function d(e,n){t.resolve(e).then((function(e){o[n]=e,++s!==i||r||(r=!0,a.resolve(l,o))}),(function(e){r||(r=!0,a.reject(l,e))}))}},l.race=function(e){if("[object Array]"!==Object.prototype.toString.call(e))return this.reject(new TypeError("must be an array"));var t,i=e.length,r=!1;if(!i)return this.resolve([]);for(var o=-1,s=new this(n);++o<i;)t=e[o],this.resolve(t).then((function(e){r||(r=!0,a.resolve(s,e))}),(function(e){r||(r=!0,a.reject(s,e))}));return s}},{immediate:36}],38:[function(e,t,i){var r={};(0,e("./lib/utils/common").assign)(r,e("./lib/deflate"),e("./lib/inflate"),e("./lib/zlib/constants")),t.exports=r},{"./lib/deflate":39,"./lib/inflate":40,"./lib/utils/common":41,"./lib/zlib/constants":44}],39:[function(e,t,i){var r=e("./zlib/deflate"),n=e("./utils/common"),a=e("./utils/strings"),o=e("./zlib/messages"),s=e("./zlib/zstream"),c=Object.prototype.toString;function l(e){if(!(this instanceof l))return new l(e);this.options=n.assign({level:-1,method:8,chunkSize:16384,windowBits:15,memLevel:8,strategy:0,to:""},e||{});var t=this.options;t.raw&&0<t.windowBits?t.windowBits=-t.windowBits:t.gzip&&0<t.windowBits&&t.windowBits<16&&(t.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new s,this.strm.avail_out=0;var i=r.deflateInit2(this.strm,t.level,t.method,t.windowBits,t.memLevel,t.strategy);if(0!==i)throw new Error(o[i]);if(t.header&&r.deflateSetHeader(this.strm,t.header),t.dictionary){var d;if(d="string"==typeof t.dictionary?a.string2buf(t.dictionary):"[object ArrayBuffer]"===c.call(t.dictionary)?new Uint8Array(t.dictionary):t.dictionary,0!==(i=r.deflateSetDictionary(this.strm,d)))throw new Error(o[i]);this._dict_set=!0}}function d(e,t){var i=new l(t);if(i.push(e,!0),i.err)throw i.msg||o[i.err];return i.result}l.prototype.push=function(e,t){var i,o,s=this.strm,l=this.options.chunkSize;if(this.ended)return!1;o=t===~~t?t:!0===t?4:0,"string"==typeof e?s.input=a.string2buf(e):"[object ArrayBuffer]"===c.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 n.Buf8(l),s.next_out=0,s.avail_out=l),1!==(i=r.deflate(s,o))&&0!==i)return this.onEnd(i),!(this.ended=!0);0!==s.avail_out&&(0!==s.avail_in||4!==o&&2!==o)||("string"===this.options.to?this.onData(a.buf2binstring(n.shrinkBuf(s.output,s.next_out))):this.onData(n.shrinkBuf(s.output,s.next_out)))}while((0<s.avail_in||0===s.avail_out)&&1!==i);return 4===o?(i=r.deflateEnd(this.strm),this.onEnd(i),this.ended=!0,0===i):2!==o||(this.onEnd(0),!(s.avail_out=0))},l.prototype.onData=function(e){this.chunks.push(e)},l.prototype.onEnd=function(e){0===e&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=n.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg},i.Deflate=l,i.deflate=d,i.deflateRaw=function(e,t){return(t=t||{}).raw=!0,d(e,t)},i.gzip=function(e,t){return(t=t||{}).gzip=!0,d(e,t)}},{"./utils/common":41,"./utils/strings":42,"./zlib/deflate":46,"./zlib/messages":51,"./zlib/zstream":53}],40:[function(e,t,i){var r=e("./zlib/inflate"),n=e("./utils/common"),a=e("./utils/strings"),o=e("./zlib/constants"),s=e("./zlib/messages"),c=e("./zlib/zstream"),l=e("./zlib/gzheader"),d=Object.prototype.toString;function u(e){if(!(this instanceof u))return new u(e);this.options=n.assign({chunkSize:16384,windowBits:0,to:""},e||{});var t=this.options;t.raw&&0<=t.windowBits&&t.windowBits<16&&(t.windowBits=-t.windowBits,0===t.windowBits&&(t.windowBits=-15)),!(0<=t.windowBits&&t.windowBits<16)||e&&e.windowBits||(t.windowBits+=32),15<t.windowBits&&t.windowBits<48&&!(15&t.windowBits)&&(t.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new c,this.strm.avail_out=0;var i=r.inflateInit2(this.strm,t.windowBits);if(i!==o.Z_OK)throw new Error(s[i]);this.header=new l,r.inflateGetHeader(this.strm,this.header)}function h(e,t){var i=new u(t);if(i.push(e,!0),i.err)throw i.msg||s[i.err];return i.result}u.prototype.push=function(e,t){var i,s,c,l,u,h,p=this.strm,f=this.options.chunkSize,m=this.options.dictionary,g=!1;if(this.ended)return!1;s=t===~~t?t:!0===t?o.Z_FINISH:o.Z_NO_FLUSH,"string"==typeof e?p.input=a.binstring2buf(e):"[object ArrayBuffer]"===d.call(e)?p.input=new Uint8Array(e):p.input=e,p.next_in=0,p.avail_in=p.input.length;do{if(0===p.avail_out&&(p.output=new n.Buf8(f),p.next_out=0,p.avail_out=f),(i=r.inflate(p,o.Z_NO_FLUSH))===o.Z_NEED_DICT&&m&&(h="string"==typeof m?a.string2buf(m):"[object ArrayBuffer]"===d.call(m)?new Uint8Array(m):m,i=r.inflateSetDictionary(this.strm,h)),i===o.Z_BUF_ERROR&&!0===g&&(i=o.Z_OK,g=!1),i!==o.Z_STREAM_END&&i!==o.Z_OK)return this.onEnd(i),!(this.ended=!0);p.next_out&&(0!==p.avail_out&&i!==o.Z_STREAM_END&&(0!==p.avail_in||s!==o.Z_FINISH&&s!==o.Z_SYNC_FLUSH)||("string"===this.options.to?(c=a.utf8border(p.output,p.next_out),l=p.next_out-c,u=a.buf2string(p.output,c),p.next_out=l,p.avail_out=f-l,l&&n.arraySet(p.output,p.output,c,l,0),this.onData(u)):this.onData(n.shrinkBuf(p.output,p.next_out)))),0===p.avail_in&&0===p.avail_out&&(g=!0)}while((0<p.avail_in||0===p.avail_out)&&i!==o.Z_STREAM_END);return i===o.Z_STREAM_END&&(s=o.Z_FINISH),s===o.Z_FINISH?(i=r.inflateEnd(this.strm),this.onEnd(i),this.ended=!0,i===o.Z_OK):s!==o.Z_SYNC_FLUSH||(this.onEnd(o.Z_OK),!(p.avail_out=0))},u.prototype.onData=function(e){this.chunks.push(e)},u.prototype.onEnd=function(e){e===o.Z_OK&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=n.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg},i.Inflate=u,i.inflate=h,i.inflateRaw=function(e,t){return(t=t||{}).raw=!0,h(e,t)},i.ungzip=h},{"./utils/common":41,"./utils/strings":42,"./zlib/constants":44,"./zlib/gzheader":47,"./zlib/inflate":49,"./zlib/messages":51,"./zlib/zstream":53}],41:[function(e,t,i){var r="undefined"!=typeof Uint8Array&&"undefined"!=typeof Uint16Array&&"undefined"!=typeof Int32Array;i.assign=function(e){for(var t=Array.prototype.slice.call(arguments,1);t.length;){var i=t.shift();if(i){if("object"!=typeof i)throw new TypeError(i+"must be non-object");for(var r in i)i.hasOwnProperty(r)&&(e[r]=i[r])}}return e},i.shrinkBuf=function(e,t){return e.length===t?e:e.subarray?e.subarray(0,t):(e.length=t,e)};var n={arraySet:function(e,t,i,r,n){if(t.subarray&&e.subarray)e.set(t.subarray(i,i+r),n);else for(var a=0;a<r;a++)e[n+a]=t[i+a]},flattenChunks:function(e){var t,i,r,n,a,o;for(t=r=0,i=e.length;t<i;t++)r+=e[t].length;for(o=new Uint8Array(r),t=n=0,i=e.length;t<i;t++)a=e[t],o.set(a,n),n+=a.length;return o}},a={arraySet:function(e,t,i,r,n){for(var a=0;a<r;a++)e[n+a]=t[i+a]},flattenChunks:function(e){return[].concat.apply([],e)}};i.setTyped=function(e){e?(i.Buf8=Uint8Array,i.Buf16=Uint16Array,i.Buf32=Int32Array,i.assign(i,n)):(i.Buf8=Array,i.Buf16=Array,i.Buf32=Array,i.assign(i,a))},i.setTyped(r)},{}],42:[function(e,t,i){var r=e("./common"),n=!0,a=!0;try{String.fromCharCode.apply(null,[0])}catch(l){n=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(l){a=!1}for(var o=new r.Buf8(256),s=0;s<256;s++)o[s]=252<=s?6:248<=s?5:240<=s?4:224<=s?3:192<=s?2:1;function c(e,t){if(t<65537&&(e.subarray&&a||!e.subarray&&n))return String.fromCharCode.apply(null,r.shrinkBuf(e,t));for(var i="",o=0;o<t;o++)i+=String.fromCharCode(e[o]);return i}o[254]=o[254]=1,i.string2buf=function(e){var t,i,n,a,o,s=e.length,c=0;for(a=0;a<s;a++)55296==(64512&(i=e.charCodeAt(a)))&&a+1<s&&56320==(64512&(n=e.charCodeAt(a+1)))&&(i=65536+(i-55296<<10)+(n-56320),a++),c+=i<128?1:i<2048?2:i<65536?3:4;for(t=new r.Buf8(c),a=o=0;o<c;a++)55296==(64512&(i=e.charCodeAt(a)))&&a+1<s&&56320==(64512&(n=e.charCodeAt(a+1)))&&(i=65536+(i-55296<<10)+(n-56320),a++),i<128?t[o++]=i:(i<2048?t[o++]=192|i>>>6:(i<65536?t[o++]=224|i>>>12:(t[o++]=240|i>>>18,t[o++]=128|i>>>12&63),t[o++]=128|i>>>6&63),t[o++]=128|63&i);return t},i.buf2binstring=function(e){return c(e,e.length)},i.binstring2buf=function(e){for(var t=new r.Buf8(e.length),i=0,n=t.length;i<n;i++)t[i]=e.charCodeAt(i);return t},i.buf2string=function(e,t){var i,r,n,a,s=t||e.length,l=new Array(2*s);for(i=r=0;i<s;)if((n=e[i++])<128)l[r++]=n;else if(4<(a=o[n]))l[r++]=65533,i+=a-1;else{for(n&=2===a?31:3===a?15:7;1<a&&i<s;)n=n<<6|63&e[i++],a--;1<a?l[r++]=65533:n<65536?l[r++]=n:(n-=65536,l[r++]=55296|n>>10&1023,l[r++]=56320|1023&n)}return c(l,r)},i.utf8border=function(e,t){var i;for((t=t||e.length)>e.length&&(t=e.length),i=t-1;0<=i&&128==(192&e[i]);)i--;return i<0||0===i?t:i+o[e[i]]>t?i:t}},{"./common":41}],43:[function(e,t,i){t.exports=function(e,t,i,r){for(var n=65535&e,a=e>>>16&65535,o=0;0!==i;){for(i-=o=2e3<i?2e3:i;a=a+(n=n+t[r++]|0)|0,--o;);n%=65521,a%=65521}return n|a<<16}},{}],44:[function(e,t,i){t.exports={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}},{}],45:[function(e,t,i){var r=function(){for(var e,t=[],i=0;i<256;i++){e=i;for(var r=0;r<8;r++)e=1&e?3988292384^e>>>1:e>>>1;t[i]=e}return t}();t.exports=function(e,t,i,n){var a=r,o=n+i;e^=-1;for(var s=n;s<o;s++)e=e>>>8^a[255&(e^t[s])];return~e}},{}],46:[function(e,t,i){var r,n=e("../utils/common"),a=e("./trees"),o=e("./adler32"),s=e("./crc32"),c=e("./messages"),l=-2,d=258,u=262,h=113;function p(e,t){return e.msg=c[t],t}function f(e){return(e<<1)-(4<e?9:0)}function m(e){for(var t=e.length;0<=--t;)e[t]=0}function g(e){var t=e.state,i=t.pending;i>e.avail_out&&(i=e.avail_out),0!==i&&(n.arraySet(e.output,t.pending_buf,t.pending_out,i,e.next_out),e.next_out+=i,t.pending_out+=i,e.total_out+=i,e.avail_out-=i,t.pending-=i,0===t.pending&&(t.pending_out=0))}function v(e,t){a._tr_flush_block(e,0<=e.block_start?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,g(e.strm)}function _(e,t){e.pending_buf[e.pending++]=t}function y(e,t){e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=255&t}function E(e,t){var i,r,n=e.max_chain_length,a=e.strstart,o=e.prev_length,s=e.nice_match,c=e.strstart>e.w_size-u?e.strstart-(e.w_size-u):0,l=e.window,h=e.w_mask,p=e.prev,f=e.strstart+d,m=l[a+o-1],g=l[a+o];e.prev_length>=e.good_match&&(n>>=2),s>e.lookahead&&(s=e.lookahead);do{if(l[(i=t)+o]===g&&l[i+o-1]===m&&l[i]===l[a]&&l[++i]===l[a+1]){a+=2,i++;do{}while(l[++a]===l[++i]&&l[++a]===l[++i]&&l[++a]===l[++i]&&l[++a]===l[++i]&&l[++a]===l[++i]&&l[++a]===l[++i]&&l[++a]===l[++i]&&l[++a]===l[++i]&&a<f);if(r=d-(f-a),a=f-d,o<r){if(e.match_start=t,s<=(o=r))break;m=l[a+o-1],g=l[a+o]}}}while((t=p[t&h])>c&&0!=--n);return o<=e.lookahead?o:e.lookahead}function b(e){var t,i,r,a,c,l,d,h,p,f,m=e.w_size;do{if(a=e.window_size-e.lookahead-e.strstart,e.strstart>=m+(m-u)){for(n.arraySet(e.window,e.window,m,m,0),e.match_start-=m,e.strstart-=m,e.block_start-=m,t=i=e.hash_size;r=e.head[--t],e.head[t]=m<=r?r-m:0,--i;);for(t=i=m;r=e.prev[--t],e.prev[t]=m<=r?r-m:0,--i;);a+=m}if(0===e.strm.avail_in)break;if(l=e.strm,d=e.window,h=e.strstart+e.lookahead,f=void 0,(p=a)<(f=l.avail_in)&&(f=p),i=0===f?0:(l.avail_in-=f,n.arraySet(d,l.input,l.next_in,f,h),1===l.state.wrap?l.adler=o(l.adler,d,f,h):2===l.state.wrap&&(l.adler=s(l.adler,d,f,h)),l.next_in+=f,l.total_in+=f,f),e.lookahead+=i,e.lookahead+e.insert>=3)for(c=e.strstart-e.insert,e.ins_h=e.window[c],e.ins_h=(e.ins_h<<e.hash_shift^e.window[c+1])&e.hash_mask;e.insert&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[c+3-1])&e.hash_mask,e.prev[c&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=c,c++,e.insert--,!(e.lookahead+e.insert<3)););}while(e.lookahead<u&&0!==e.strm.avail_in)}function w(e,t){for(var i,r;;){if(e.lookahead<u){if(b(e),e.lookahead<u&&0===t)return 1;if(0===e.lookahead)break}if(i=0,e.lookahead>=3&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+3-1])&e.hash_mask,i=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),0!==i&&e.strstart-i<=e.w_size-u&&(e.match_length=E(e,i)),e.match_length>=3)if(r=a._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){for(e.match_length--;e.strstart++,e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+3-1])&e.hash_mask,i=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart,0!=--e.match_length;);e.strstart++}else e.strstart+=e.match_length,e.match_length=0,e.ins_h=e.window[e.strstart],e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+1])&e.hash_mask;else r=a._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++;if(r&&(v(e,!1),0===e.strm.avail_out))return 1}return e.insert=e.strstart<2?e.strstart:2,4===t?(v(e,!0),0===e.strm.avail_out?3:4):e.last_lit&&(v(e,!1),0===e.strm.avail_out)?1:2}function I(e,t){for(var i,r,n;;){if(e.lookahead<u){if(b(e),e.lookahead<u&&0===t)return 1;if(0===e.lookahead)break}if(i=0,e.lookahead>=3&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+3-1])&e.hash_mask,i=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),e.prev_length=e.match_length,e.prev_match=e.match_start,e.match_length=2,0!==i&&e.prev_length<e.max_lazy_match&&e.strstart-i<=e.w_size-u&&(e.match_length=E(e,i),e.match_length<=5&&(1===e.strategy||3===e.match_length&&4096<e.strstart-e.match_start)&&(e.match_length=2)),e.prev_length>=3&&e.match_length<=e.prev_length){for(n=e.strstart+e.lookahead-3,r=a._tr_tally(e,e.strstart-1-e.prev_match,e.prev_length-3),e.lookahead-=e.prev_length-1,e.prev_length-=2;++e.strstart<=n&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+3-1])&e.hash_mask,i=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),0!=--e.prev_length;);if(e.match_available=0,e.match_length=2,e.strstart++,r&&(v(e,!1),0===e.strm.avail_out))return 1}else if(e.match_available){if((r=a._tr_tally(e,0,e.window[e.strstart-1]))&&v(e,!1),e.strstart++,e.lookahead--,0===e.strm.avail_out)return 1}else e.match_available=1,e.strstart++,e.lookahead--}return e.match_available&&(r=a._tr_tally(e,0,e.window[e.strstart-1]),e.match_available=0),e.insert=e.strstart<2?e.strstart:2,4===t?(v(e,!0),0===e.strm.avail_out?3:4):e.last_lit&&(v(e,!1),0===e.strm.avail_out)?1:2}function T(e,t,i,r,n){this.good_length=e,this.max_lazy=t,this.nice_length=i,this.max_chain=r,this.func=n}function S(){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 n.Buf16(1146),this.dyn_dtree=new n.Buf16(122),this.bl_tree=new n.Buf16(78),m(this.dyn_ltree),m(this.dyn_dtree),m(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new n.Buf16(16),this.heap=new n.Buf16(573),m(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new n.Buf16(573),m(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 A(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:h,e.adler=2===t.wrap?0:1,t.last_flush=0,a._tr_init(t),0):p(e,l)}function R(e){var t,i=A(e);return 0===i&&((t=e.state).window_size=2*t.w_size,m(t.head),t.max_lazy_match=r[t.level].max_lazy,t.good_match=r[t.level].good_length,t.nice_match=r[t.level].nice_length,t.max_chain_length=r[t.level].max_chain,t.strstart=0,t.block_start=0,t.lookahead=0,t.insert=0,t.match_length=t.prev_length=2,t.match_available=0,t.ins_h=0),i}function k(e,t,i,r,a,o){if(!e)return l;var s=1;if(-1===t&&(t=6),r<0?(s=0,r=-r):15<r&&(s=2,r-=16),a<1||9<a||8!==i||r<8||15<r||t<0||9<t||o<0||4<o)return p(e,l);8===r&&(r=9);var c=new S;return(e.state=c).strm=e,c.wrap=s,c.gzhead=null,c.w_bits=r,c.w_size=1<<c.w_bits,c.w_mask=c.w_size-1,c.hash_bits=a+7,c.hash_size=1<<c.hash_bits,c.hash_mask=c.hash_size-1,c.hash_shift=~~((c.hash_bits+3-1)/3),c.window=new n.Buf8(2*c.w_size),c.head=new n.Buf16(c.hash_size),c.prev=new n.Buf16(c.w_size),c.lit_bufsize=1<<a+6,c.pending_buf_size=4*c.lit_bufsize,c.pending_buf=new n.Buf8(c.pending_buf_size),c.d_buf=1*c.lit_bufsize,c.l_buf=3*c.lit_bufsize,c.level=t,c.strategy=o,c.method=i,R(e)}r=[new T(0,0,0,0,(function(e,t){var i=65535;for(i>e.pending_buf_size-5&&(i=e.pending_buf_size-5);;){if(e.lookahead<=1){if(b(e),0===e.lookahead&&0===t)return 1;if(0===e.lookahead)break}e.strstart+=e.lookahead,e.lookahead=0;var r=e.block_start+i;if((0===e.strstart||e.strstart>=r)&&(e.lookahead=e.strstart-r,e.strstart=r,v(e,!1),0===e.strm.avail_out)||e.strstart-e.block_start>=e.w_size-u&&(v(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,4===t?(v(e,!0),0===e.strm.avail_out?3:4):(e.strstart>e.block_start&&(v(e,!1),e.strm.avail_out),1)})),new T(4,4,8,4,w),new T(4,5,16,8,w),new T(4,6,32,32,w),new T(4,4,16,16,I),new T(8,16,32,32,I),new T(8,16,128,128,I),new T(8,32,128,256,I),new T(32,128,258,1024,I),new T(32,258,258,4096,I)],i.deflateInit=function(e,t){return k(e,t,8,15,8,0)},i.deflateInit2=k,i.deflateReset=R,i.deflateResetKeep=A,i.deflateSetHeader=function(e,t){return e&&e.state?2!==e.state.wrap?l:(e.state.gzhead=t,0):l},i.deflate=function(e,t){var i,n,o,c;if(!e||!e.state||5<t||t<0)return e?p(e,l):l;if(n=e.state,!e.output||!e.input&&0!==e.avail_in||666===n.status&&4!==t)return p(e,0===e.avail_out?-5:l);if(n.strm=e,i=n.last_flush,n.last_flush=t,42===n.status)if(2===n.wrap)e.adler=0,_(n,31),_(n,139),_(n,8),n.gzhead?(_(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)),_(n,255&n.gzhead.time),_(n,n.gzhead.time>>8&255),_(n,n.gzhead.time>>16&255),_(n,n.gzhead.time>>24&255),_(n,9===n.level?2:2<=n.strategy||n.level<2?4:0),_(n,255&n.gzhead.os),n.gzhead.extra&&n.gzhead.extra.length&&(_(n,255&n.gzhead.extra.length),_(n,n.gzhead.extra.length>>8&255)),n.gzhead.hcrc&&(e.adler=s(e.adler,n.pending_buf,n.pending,0)),n.gzindex=0,n.status=69):(_(n,0),_(n,0),_(n,0),_(n,0),_(n,0),_(n,9===n.level?2:2<=n.strategy||n.level<2?4:0),_(n,3),n.status=h);else{var u=8+(n.w_bits-8<<4)<<8;u|=(2<=n.strategy||n.level<2?0:n.level<6?1:6===n.level?2:3)<<6,0!==n.strstart&&(u|=32),u+=31-u%31,n.status=h,y(n,u),0!==n.strstart&&(y(n,e.adler>>>16),y(n,65535&e.adler)),e.adler=1}if(69===n.status)if(n.gzhead.extra){for(o=n.pending;n.gzindex<(65535&n.gzhead.extra.length)&&(n.pending!==n.pending_buf_size||(n.gzhead.hcrc&&n.pending>o&&(e.adler=s(e.adler,n.pending_buf,n.pending-o,o)),g(e),o=n.pending,n.pending!==n.pending_buf_size));)_(n,255&n.gzhead.extra[n.gzindex]),n.gzindex++;n.gzhead.hcrc&&n.pending>o&&(e.adler=s(e.adler,n.pending_buf,n.pending-o,o)),n.gzindex===n.gzhead.extra.length&&(n.gzindex=0,n.status=73)}else n.status=73;if(73===n.status)if(n.gzhead.name){o=n.pending;do{if(n.pending===n.pending_buf_size&&(n.gzhead.hcrc&&n.pending>o&&(e.adler=s(e.adler,n.pending_buf,n.pending-o,o)),g(e),o=n.pending,n.pending===n.pending_buf_size)){c=1;break}c=n.gzindex<n.gzhead.name.length?255&n.gzhead.name.charCodeAt(n.gzindex++):0,_(n,c)}while(0!==c);n.gzhead.hcrc&&n.pending>o&&(e.adler=s(e.adler,n.pending_buf,n.pending-o,o)),0===c&&(n.gzindex=0,n.status=91)}else n.status=91;if(91===n.status)if(n.gzhead.comment){o=n.pending;do{if(n.pending===n.pending_buf_size&&(n.gzhead.hcrc&&n.pending>o&&(e.adler=s(e.adler,n.pending_buf,n.pending-o,o)),g(e),o=n.pending,n.pending===n.pending_buf_size)){c=1;break}c=n.gzindex<n.gzhead.comment.length?255&n.gzhead.comment.charCodeAt(n.gzindex++):0,_(n,c)}while(0!==c);n.gzhead.hcrc&&n.pending>o&&(e.adler=s(e.adler,n.pending_buf,n.pending-o,o)),0===c&&(n.status=103)}else n.status=103;if(103===n.status&&(n.gzhead.hcrc?(n.pending+2>n.pending_buf_size&&g(e),n.pending+2<=n.pending_buf_size&&(_(n,255&e.adler),_(n,e.adler>>8&255),e.adler=0,n.status=h)):n.status=h),0!==n.pending){if(g(e),0===e.avail_out)return n.last_flush=-1,0}else if(0===e.avail_in&&f(t)<=f(i)&&4!==t)return p(e,-5);if(666===n.status&&0!==e.avail_in)return p(e,-5);if(0!==e.avail_in||0!==n.lookahead||0!==t&&666!==n.status){var E=2===n.strategy?function(e,t){for(var i;;){if(0===e.lookahead&&(b(e),0===e.lookahead)){if(0===t)return 1;break}if(e.match_length=0,i=a._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,i&&(v(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,4===t?(v(e,!0),0===e.strm.avail_out?3:4):e.last_lit&&(v(e,!1),0===e.strm.avail_out)?1:2}(n,t):3===n.strategy?function(e,t){for(var i,r,n,o,s=e.window;;){if(e.lookahead<=d){if(b(e),e.lookahead<=d&&0===t)return 1;if(0===e.lookahead)break}if(e.match_length=0,e.lookahead>=3&&0<e.strstart&&(r=s[n=e.strstart-1])===s[++n]&&r===s[++n]&&r===s[++n]){o=e.strstart+d;do{}while(r===s[++n]&&r===s[++n]&&r===s[++n]&&r===s[++n]&&r===s[++n]&&r===s[++n]&&r===s[++n]&&r===s[++n]&&n<o);e.match_length=d-(o-n),e.match_length>e.lookahead&&(e.match_length=e.lookahead)}if(e.match_length>=3?(i=a._tr_tally(e,1,e.match_length-3),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(i=a._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),i&&(v(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,4===t?(v(e,!0),0===e.strm.avail_out?3:4):e.last_lit&&(v(e,!1),0===e.strm.avail_out)?1:2}(n,t):r[n.level].func(n,t);if(3!==E&&4!==E||(n.status=666),1===E||3===E)return 0===e.avail_out&&(n.last_flush=-1),0;if(2===E&&(1===t?a._tr_align(n):5!==t&&(a._tr_stored_block(n,0,0,!1),3===t&&(m(n.head),0===n.lookahead&&(n.strstart=0,n.block_start=0,n.insert=0))),g(e),0===e.avail_out))return n.last_flush=-1,0}return 4!==t?0:n.wrap<=0?1:(2===n.wrap?(_(n,255&e.adler),_(n,e.adler>>8&255),_(n,e.adler>>16&255),_(n,e.adler>>24&255),_(n,255&e.total_in),_(n,e.total_in>>8&255),_(n,e.total_in>>16&255),_(n,e.total_in>>24&255)):(y(n,e.adler>>>16),y(n,65535&e.adler)),g(e),0<n.wrap&&(n.wrap=-n.wrap),0!==n.pending?0:1)},i.deflateEnd=function(e){var t;return e&&e.state?42!==(t=e.state.status)&&69!==t&&73!==t&&91!==t&&103!==t&&t!==h&&666!==t?p(e,l):(e.state=null,t===h?p(e,-3):0):l},i.deflateSetDictionary=function(e,t){var i,r,a,s,c,d,u,h,p=t.length;if(!e||!e.state||2===(s=(i=e.state).wrap)||1===s&&42!==i.status||i.lookahead)return l;for(1===s&&(e.adler=o(e.adler,t,p,0)),i.wrap=0,p>=i.w_size&&(0===s&&(m(i.head),i.strstart=0,i.block_start=0,i.insert=0),h=new n.Buf8(i.w_size),n.arraySet(h,t,p-i.w_size,i.w_size,0),t=h,p=i.w_size),c=e.avail_in,d=e.next_in,u=e.input,e.avail_in=p,e.next_in=0,e.input=t,b(i);i.lookahead>=3;){for(r=i.strstart,a=i.lookahead-2;i.ins_h=(i.ins_h<<i.hash_shift^i.window[r+3-1])&i.hash_mask,i.prev[r&i.w_mask]=i.head[i.ins_h],i.head[i.ins_h]=r,r++,--a;);i.strstart=r,i.lookahead=2,b(i)}return i.strstart+=i.lookahead,i.block_start=i.strstart,i.insert=i.lookahead,i.lookahead=0,i.match_length=i.prev_length=2,i.match_available=0,e.next_in=d,e.input=u,e.avail_in=c,i.wrap=s,0},i.deflateInfo="pako deflate (from Nodeca project)"},{"../utils/common":41,"./adler32":43,"./crc32":45,"./messages":51,"./trees":52}],47:[function(e,t,i){t.exports=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}},{}],48:[function(e,t,i){t.exports=function(e,t){var i,r,n,a,o,s,c,l,d,u,h,p,f,m,g,v,_,y,E,b,w,I,T,S,A;i=e.state,r=e.next_in,S=e.input,n=r+(e.avail_in-5),a=e.next_out,A=e.output,o=a-(t-e.avail_out),s=a+(e.avail_out-257),c=i.dmax,l=i.wsize,d=i.whave,u=i.wnext,h=i.window,p=i.hold,f=i.bits,m=i.lencode,g=i.distcode,v=(1<<i.lenbits)-1,_=(1<<i.distbits)-1;e:do{f<15&&(p+=S[r++]<<f,f+=8,p+=S[r++]<<f,f+=8),y=m[p&v];t:for(;;){if(p>>>=E=y>>>24,f-=E,0==(E=y>>>16&255))A[a++]=65535&y;else{if(!(16&E)){if(!(64&E)){y=m[(65535&y)+(p&(1<<E)-1)];continue t}if(32&E){i.mode=12;break e}e.msg="invalid literal/length code",i.mode=30;break e}b=65535&y,(E&=15)&&(f<E&&(p+=S[r++]<<f,f+=8),b+=p&(1<<E)-1,p>>>=E,f-=E),f<15&&(p+=S[r++]<<f,f+=8,p+=S[r++]<<f,f+=8),y=g[p&_];i:for(;;){if(p>>>=E=y>>>24,f-=E,!(16&(E=y>>>16&255))){if(!(64&E)){y=g[(65535&y)+(p&(1<<E)-1)];continue i}e.msg="invalid distance code",i.mode=30;break e}if(w=65535&y,f<(E&=15)&&(p+=S[r++]<<f,(f+=8)<E&&(p+=S[r++]<<f,f+=8)),c<(w+=p&(1<<E)-1)){e.msg="invalid distance too far back",i.mode=30;break e}if(p>>>=E,f-=E,(E=a-o)<w){if(d<(E=w-E)&&i.sane){e.msg="invalid distance too far back",i.mode=30;break e}if(T=h,(I=0)===u){if(I+=l-E,E<b){for(b-=E;A[a++]=h[I++],--E;);I=a-w,T=A}}else if(u<E){if(I+=l+u-E,(E-=u)<b){for(b-=E;A[a++]=h[I++],--E;);if(I=0,u<b){for(b-=E=u;A[a++]=h[I++],--E;);I=a-w,T=A}}}else if(I+=u-E,E<b){for(b-=E;A[a++]=h[I++],--E;);I=a-w,T=A}for(;2<b;)A[a++]=T[I++],A[a++]=T[I++],A[a++]=T[I++],b-=3;b&&(A[a++]=T[I++],1<b&&(A[a++]=T[I++]))}else{for(I=a-w;A[a++]=A[I++],A[a++]=A[I++],A[a++]=A[I++],2<(b-=3););b&&(A[a++]=A[I++],1<b&&(A[a++]=A[I++]))}break}}break}}while(r<n&&a<s);r-=b=f>>3,p&=(1<<(f-=b<<3))-1,e.next_in=r,e.next_out=a,e.avail_in=r<n?n-r+5:5-(r-n),e.avail_out=a<s?s-a+257:257-(a-s),i.hold=p,i.bits=f}},{}],49:[function(e,t,i){var r=e("../utils/common"),n=e("./adler32"),a=e("./crc32"),o=e("./inffast"),s=e("./inftrees"),c=-2;function l(e){return(e>>>24&255)+(e>>>8&65280)+((65280&e)<<8)+((255&e)<<24)}function d(){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 r.Buf16(320),this.work=new r.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function u(e){var t;return e&&e.state?(t=e.state,e.total_in=e.total_out=t.total=0,e.msg="",t.wrap&&(e.adler=1&t.wrap),t.mode=1,t.last=0,t.havedict=0,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new r.Buf32(852),t.distcode=t.distdyn=new r.Buf32(592),t.sane=1,t.back=-1,0):c}function h(e){var t;return e&&e.state?((t=e.state).wsize=0,t.whave=0,t.wnext=0,u(e)):c}function p(e,t){var i,r;return e&&e.state?(r=e.state,t<0?(i=0,t=-t):(i=1+(t>>4),t<48&&(t&=15)),t&&(t<8||15<t)?c:(null!==r.window&&r.wbits!==t&&(r.window=null),r.wrap=i,r.wbits=t,h(e))):c}function f(e,t){var i,r;return e?(r=new d,(e.state=r).window=null,0!==(i=p(e,t))&&(e.state=null),i):c}var m,g,v=!0;function _(e){if(v){var t;for(m=new r.Buf32(512),g=new r.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(s(1,e.lens,0,288,m,0,e.work,{bits:9}),t=0;t<32;)e.lens[t++]=5;s(2,e.lens,0,32,g,0,e.work,{bits:5}),v=!1}e.lencode=m,e.lenbits=9,e.distcode=g,e.distbits=5}function y(e,t,i,n){var a,o=e.state;return null===o.window&&(o.wsize=1<<o.wbits,o.wnext=0,o.whave=0,o.window=new r.Buf8(o.wsize)),n>=o.wsize?(r.arraySet(o.window,t,i-o.wsize,o.wsize,0),o.wnext=0,o.whave=o.wsize):(n<(a=o.wsize-o.wnext)&&(a=n),r.arraySet(o.window,t,i-n,a,o.wnext),(n-=a)?(r.arraySet(o.window,t,i-n,n,0),o.wnext=n,o.whave=o.wsize):(o.wnext+=a,o.wnext===o.wsize&&(o.wnext=0),o.whave<o.wsize&&(o.whave+=a))),0}i.inflateReset=h,i.inflateReset2=p,i.inflateResetKeep=u,i.inflateInit=function(e){return f(e,15)},i.inflateInit2=f,i.inflate=function(e,t){var i,d,u,h,p,f,m,g,v,E,b,w,I,T,S,A,R,k,C,D,O,N,L,x,P=0,M=new r.Buf8(4),U=[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 c;12===(i=e.state).mode&&(i.mode=13),p=e.next_out,u=e.output,m=e.avail_out,h=e.next_in,d=e.input,f=e.avail_in,g=i.hold,v=i.bits,E=f,b=m,N=0;e:for(;;)switch(i.mode){case 1:if(0===i.wrap){i.mode=13;break}for(;v<16;){if(0===f)break e;f--,g+=d[h++]<<v,v+=8}if(2&i.wrap&&35615===g){M[i.check=0]=255&g,M[1]=g>>>8&255,i.check=a(i.check,M,2,0),v=g=0,i.mode=2;break}if(i.flags=0,i.head&&(i.head.done=!1),!(1&i.wrap)||(((255&g)<<8)+(g>>8))%31){e.msg="incorrect header check",i.mode=30;break}if(8!=(15&g)){e.msg="unknown compression method",i.mode=30;break}if(v-=4,O=8+(15&(g>>>=4)),0===i.wbits)i.wbits=O;else if(O>i.wbits){e.msg="invalid window size",i.mode=30;break}i.dmax=1<<O,e.adler=i.check=1,i.mode=512&g?10:12,v=g=0;break;case 2:for(;v<16;){if(0===f)break e;f--,g+=d[h++]<<v,v+=8}if(i.flags=g,8!=(255&i.flags)){e.msg="unknown compression method",i.mode=30;break}if(57344&i.flags){e.msg="unknown header flags set",i.mode=30;break}i.head&&(i.head.text=g>>8&1),512&i.flags&&(M[0]=255&g,M[1]=g>>>8&255,i.check=a(i.check,M,2,0)),v=g=0,i.mode=3;case 3:for(;v<32;){if(0===f)break e;f--,g+=d[h++]<<v,v+=8}i.head&&(i.head.time=g),512&i.flags&&(M[0]=255&g,M[1]=g>>>8&255,M[2]=g>>>16&255,M[3]=g>>>24&255,i.check=a(i.check,M,4,0)),v=g=0,i.mode=4;case 4:for(;v<16;){if(0===f)break e;f--,g+=d[h++]<<v,v+=8}i.head&&(i.head.xflags=255&g,i.head.os=g>>8),512&i.flags&&(M[0]=255&g,M[1]=g>>>8&255,i.check=a(i.check,M,2,0)),v=g=0,i.mode=5;case 5:if(1024&i.flags){for(;v<16;){if(0===f)break e;f--,g+=d[h++]<<v,v+=8}i.length=g,i.head&&(i.head.extra_len=g),512&i.flags&&(M[0]=255&g,M[1]=g>>>8&255,i.check=a(i.check,M,2,0)),v=g=0}else i.head&&(i.head.extra=null);i.mode=6;case 6:if(1024&i.flags&&(f<(w=i.length)&&(w=f),w&&(i.head&&(O=i.head.extra_len-i.length,i.head.extra||(i.head.extra=new Array(i.head.extra_len)),r.arraySet(i.head.extra,d,h,w,O)),512&i.flags&&(i.check=a(i.check,d,w,h)),f-=w,h+=w,i.length-=w),i.length))break e;i.length=0,i.mode=7;case 7:if(2048&i.flags){if(0===f)break e;for(w=0;O=d[h+w++],i.head&&O&&i.length<65536&&(i.head.name+=String.fromCharCode(O)),O&&w<f;);if(512&i.flags&&(i.check=a(i.check,d,w,h)),f-=w,h+=w,O)break e}else i.head&&(i.head.name=null);i.length=0,i.mode=8;case 8:if(4096&i.flags){if(0===f)break e;for(w=0;O=d[h+w++],i.head&&O&&i.length<65536&&(i.head.comment+=String.fromCharCode(O)),O&&w<f;);if(512&i.flags&&(i.check=a(i.check,d,w,h)),f-=w,h+=w,O)break e}else i.head&&(i.head.comment=null);i.mode=9;case 9:if(512&i.flags){for(;v<16;){if(0===f)break e;f--,g+=d[h++]<<v,v+=8}if(g!==(65535&i.check)){e.msg="header crc mismatch",i.mode=30;break}v=g=0}i.head&&(i.head.hcrc=i.flags>>9&1,i.head.done=!0),e.adler=i.check=0,i.mode=12;break;case 10:for(;v<32;){if(0===f)break e;f--,g+=d[h++]<<v,v+=8}e.adler=i.check=l(g),v=g=0,i.mode=11;case 11:if(0===i.havedict)return e.next_out=p,e.avail_out=m,e.next_in=h,e.avail_in=f,i.hold=g,i.bits=v,2;e.adler=i.check=1,i.mode=12;case 12:if(5===t||6===t)break e;case 13:if(i.last){g>>>=7&v,v-=7&v,i.mode=27;break}for(;v<3;){if(0===f)break e;f--,g+=d[h++]<<v,v+=8}switch(i.last=1&g,v-=1,3&(g>>>=1)){case 0:i.mode=14;break;case 1:if(_(i),i.mode=20,6!==t)break;g>>>=2,v-=2;break e;case 2:i.mode=17;break;case 3:e.msg="invalid block type",i.mode=30}g>>>=2,v-=2;break;case 14:for(g>>>=7&v,v-=7&v;v<32;){if(0===f)break e;f--,g+=d[h++]<<v,v+=8}if((65535&g)!=(g>>>16^65535)){e.msg="invalid stored block lengths",i.mode=30;break}if(i.length=65535&g,v=g=0,i.mode=15,6===t)break e;case 15:i.mode=16;case 16:if(w=i.length){if(f<w&&(w=f),m<w&&(w=m),0===w)break e;r.arraySet(u,d,h,w,p),f-=w,h+=w,m-=w,p+=w,i.length-=w;break}i.mode=12;break;case 17:for(;v<14;){if(0===f)break e;f--,g+=d[h++]<<v,v+=8}if(i.nlen=257+(31&g),g>>>=5,v-=5,i.ndist=1+(31&g),g>>>=5,v-=5,i.ncode=4+(15&g),g>>>=4,v-=4,286<i.nlen||30<i.ndist){e.msg="too many length or distance symbols",i.mode=30;break}i.have=0,i.mode=18;case 18:for(;i.have<i.ncode;){for(;v<3;){if(0===f)break e;f--,g+=d[h++]<<v,v+=8}i.lens[U[i.have++]]=7&g,g>>>=3,v-=3}for(;i.have<19;)i.lens[U[i.have++]]=0;if(i.lencode=i.lendyn,i.lenbits=7,L={bits:i.lenbits},N=s(0,i.lens,0,19,i.lencode,0,i.work,L),i.lenbits=L.bits,N){e.msg="invalid code lengths set",i.mode=30;break}i.have=0,i.mode=19;case 19:for(;i.have<i.nlen+i.ndist;){for(;A=(P=i.lencode[g&(1<<i.lenbits)-1])>>>16&255,R=65535&P,!((S=P>>>24)<=v);){if(0===f)break e;f--,g+=d[h++]<<v,v+=8}if(R<16)g>>>=S,v-=S,i.lens[i.have++]=R;else{if(16===R){for(x=S+2;v<x;){if(0===f)break e;f--,g+=d[h++]<<v,v+=8}if(g>>>=S,v-=S,0===i.have){e.msg="invalid bit length repeat",i.mode=30;break}O=i.lens[i.have-1],w=3+(3&g),g>>>=2,v-=2}else if(17===R){for(x=S+3;v<x;){if(0===f)break e;f--,g+=d[h++]<<v,v+=8}v-=S,O=0,w=3+(7&(g>>>=S)),g>>>=3,v-=3}else{for(x=S+7;v<x;){if(0===f)break e;f--,g+=d[h++]<<v,v+=8}v-=S,O=0,w=11+(127&(g>>>=S)),g>>>=7,v-=7}if(i.have+w>i.nlen+i.ndist){e.msg="invalid bit length repeat",i.mode=30;break}for(;w--;)i.lens[i.have++]=O}}if(30===i.mode)break;if(0===i.lens[256]){e.msg="invalid code -- missing end-of-block",i.mode=30;break}if(i.lenbits=9,L={bits:i.lenbits},N=s(1,i.lens,0,i.nlen,i.lencode,0,i.work,L),i.lenbits=L.bits,N){e.msg="invalid literal/lengths set",i.mode=30;break}if(i.distbits=6,i.distcode=i.distdyn,L={bits:i.distbits},N=s(2,i.lens,i.nlen,i.ndist,i.distcode,0,i.work,L),i.distbits=L.bits,N){e.msg="invalid distances set",i.mode=30;break}if(i.mode=20,6===t)break e;case 20:i.mode=21;case 21:if(6<=f&&258<=m){e.next_out=p,e.avail_out=m,e.next_in=h,e.avail_in=f,i.hold=g,i.bits=v,o(e,b),p=e.next_out,u=e.output,m=e.avail_out,h=e.next_in,d=e.input,f=e.avail_in,g=i.hold,v=i.bits,12===i.mode&&(i.back=-1);break}for(i.back=0;A=(P=i.lencode[g&(1<<i.lenbits)-1])>>>16&255,R=65535&P,!((S=P>>>24)<=v);){if(0===f)break e;f--,g+=d[h++]<<v,v+=8}if(A&&!(240&A)){for(k=S,C=A,D=R;A=(P=i.lencode[D+((g&(1<<k+C)-1)>>k)])>>>16&255,R=65535&P,!(k+(S=P>>>24)<=v);){if(0===f)break e;f--,g+=d[h++]<<v,v+=8}g>>>=k,v-=k,i.back+=k}if(g>>>=S,v-=S,i.back+=S,i.length=R,0===A){i.mode=26;break}if(32&A){i.back=-1,i.mode=12;break}if(64&A){e.msg="invalid literal/length code",i.mode=30;break}i.extra=15&A,i.mode=22;case 22:if(i.extra){for(x=i.extra;v<x;){if(0===f)break e;f--,g+=d[h++]<<v,v+=8}i.length+=g&(1<<i.extra)-1,g>>>=i.extra,v-=i.extra,i.back+=i.extra}i.was=i.length,i.mode=23;case 23:for(;A=(P=i.distcode[g&(1<<i.distbits)-1])>>>16&255,R=65535&P,!((S=P>>>24)<=v);){if(0===f)break e;f--,g+=d[h++]<<v,v+=8}if(!(240&A)){for(k=S,C=A,D=R;A=(P=i.distcode[D+((g&(1<<k+C)-1)>>k)])>>>16&255,R=65535&P,!(k+(S=P>>>24)<=v);){if(0===f)break e;f--,g+=d[h++]<<v,v+=8}g>>>=k,v-=k,i.back+=k}if(g>>>=S,v-=S,i.back+=S,64&A){e.msg="invalid distance code",i.mode=30;break}i.offset=R,i.extra=15&A,i.mode=24;case 24:if(i.extra){for(x=i.extra;v<x;){if(0===f)break e;f--,g+=d[h++]<<v,v+=8}i.offset+=g&(1<<i.extra)-1,g>>>=i.extra,v-=i.extra,i.back+=i.extra}if(i.offset>i.dmax){e.msg="invalid distance too far back",i.mode=30;break}i.mode=25;case 25:if(0===m)break e;if(w=b-m,i.offset>w){if((w=i.offset-w)>i.whave&&i.sane){e.msg="invalid distance too far back",i.mode=30;break}I=w>i.wnext?(w-=i.wnext,i.wsize-w):i.wnext-w,w>i.length&&(w=i.length),T=i.window}else T=u,I=p-i.offset,w=i.length;for(m<w&&(w=m),m-=w,i.length-=w;u[p++]=T[I++],--w;);0===i.length&&(i.mode=21);break;case 26:if(0===m)break e;u[p++]=i.length,m--,i.mode=21;break;case 27:if(i.wrap){for(;v<32;){if(0===f)break e;f--,g|=d[h++]<<v,v+=8}if(b-=m,e.total_out+=b,i.total+=b,b&&(e.adler=i.check=i.flags?a(i.check,u,b,p-b):n(i.check,u,b,p-b)),b=m,(i.flags?g:l(g))!==i.check){e.msg="incorrect data check",i.mode=30;break}v=g=0}i.mode=28;case 28:if(i.wrap&&i.flags){for(;v<32;){if(0===f)break e;f--,g+=d[h++]<<v,v+=8}if(g!==(4294967295&i.total)){e.msg="incorrect length check",i.mode=30;break}v=g=0}i.mode=29;case 29:N=1;break e;case 30:N=-3;break e;case 31:return-4;default:return c}return e.next_out=p,e.avail_out=m,e.next_in=h,e.avail_in=f,i.hold=g,i.bits=v,(i.wsize||b!==e.avail_out&&i.mode<30&&(i.mode<27||4!==t))&&y(e,e.output,e.next_out,b-e.avail_out)?(i.mode=31,-4):(E-=e.avail_in,b-=e.avail_out,e.total_in+=E,e.total_out+=b,i.total+=b,i.wrap&&b&&(e.adler=i.check=i.flags?a(i.check,u,b,e.next_out-b):n(i.check,u,b,e.next_out-b)),e.data_type=i.bits+(i.last?64:0)+(12===i.mode?128:0)+(20===i.mode||15===i.mode?256:0),(0==E&&0===b||4===t)&&0===N&&(N=-5),N)},i.inflateEnd=function(e){if(!e||!e.state)return c;var t=e.state;return t.window&&(t.window=null),e.state=null,0},i.inflateGetHeader=function(e,t){var i;return e&&e.state&&2&(i=e.state).wrap?((i.head=t).done=!1,0):c},i.inflateSetDictionary=function(e,t){var i,r=t.length;return e&&e.state?0!==(i=e.state).wrap&&11!==i.mode?c:11===i.mode&&n(1,t,r,0)!==i.check?-3:y(e,t,r,r)?(i.mode=31,-4):(i.havedict=1,0):c},i.inflateInfo="pako inflate (from Nodeca project)"},{"../utils/common":41,"./adler32":43,"./crc32":45,"./inffast":48,"./inftrees":50}],50:[function(e,t,i){var r=e("../utils/common"),n=[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],a=[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],o=[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],s=[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];t.exports=function(e,t,i,c,l,d,u,h){var p,f,m,g,v,_,y,E,b,w=h.bits,I=0,T=0,S=0,A=0,R=0,k=0,C=0,D=0,O=0,N=0,L=null,x=0,P=new r.Buf16(16),M=new r.Buf16(16),U=null,F=0;for(I=0;I<=15;I++)P[I]=0;for(T=0;T<c;T++)P[t[i+T]]++;for(R=w,A=15;1<=A&&0===P[A];A--);if(A<R&&(R=A),0===A)return l[d++]=20971520,l[d++]=20971520,h.bits=1,0;for(S=1;S<A&&0===P[S];S++);for(R<S&&(R=S),I=D=1;I<=15;I++)if(D<<=1,(D-=P[I])<0)return-1;if(0<D&&(0===e||1!==A))return-1;for(M[1]=0,I=1;I<15;I++)M[I+1]=M[I]+P[I];for(T=0;T<c;T++)0!==t[i+T]&&(u[M[t[i+T]]++]=T);if(_=0===e?(L=U=u,19):1===e?(L=n,x-=257,U=a,F-=257,256):(L=o,U=s,-1),I=S,v=d,C=T=N=0,m=-1,g=(O=1<<(k=R))-1,1===e&&852<O||2===e&&592<O)return 1;for(;;){for(y=I-C,b=u[T]<_?(E=0,u[T]):u[T]>_?(E=U[F+u[T]],L[x+u[T]]):(E=96,0),p=1<<I-C,S=f=1<<k;l[v+(N>>C)+(f-=p)]=y<<24|E<<16|b,0!==f;);for(p=1<<I-1;N&p;)p>>=1;if(0!==p?(N&=p-1,N+=p):N=0,T++,0==--P[I]){if(I===A)break;I=t[i+u[T]]}if(R<I&&(N&g)!==m){for(0===C&&(C=R),v+=S,D=1<<(k=I-C);k+C<A&&!((D-=P[k+C])<=0);)k++,D<<=1;if(O+=1<<k,1===e&&852<O||2===e&&592<O)return 1;l[m=N&g]=R<<24|k<<16|v-d}}return 0!==N&&(l[v+N]=I-C<<24|64<<16),h.bits=R,0}},{"../utils/common":41}],51:[function(e,t,i){t.exports={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"}},{}],52:[function(e,t,i){var r=e("../utils/common");function n(e){for(var t=e.length;0<=--t;)e[t]=0}var a=256,o=286,s=30,c=15,l=[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],d=[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],u=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],h=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],p=new Array(576);n(p);var f=new Array(60);n(f);var m=new Array(512);n(m);var g=new Array(256);n(g);var v=new Array(29);n(v);var _,y,E,b=new Array(s);function w(e,t,i,r,n){this.static_tree=e,this.extra_bits=t,this.extra_base=i,this.elems=r,this.max_length=n,this.has_stree=e&&e.length}function I(e,t){this.dyn_tree=e,this.max_code=0,this.stat_desc=t}function T(e){return e<256?m[e]:m[256+(e>>>7)]}function S(e,t){e.pending_buf[e.pending++]=255&t,e.pending_buf[e.pending++]=t>>>8&255}function A(e,t,i){e.bi_valid>16-i?(e.bi_buf|=t<<e.bi_valid&65535,S(e,e.bi_buf),e.bi_buf=t>>16-e.bi_valid,e.bi_valid+=i-16):(e.bi_buf|=t<<e.bi_valid&65535,e.bi_valid+=i)}function R(e,t,i){A(e,i[2*t],i[2*t+1])}function k(e,t){for(var i=0;i|=1&e,e>>>=1,i<<=1,0<--t;);return i>>>1}function C(e,t,i){var r,n,a=new Array(16),o=0;for(r=1;r<=c;r++)a[r]=o=o+i[r-1]<<1;for(n=0;n<=t;n++){var s=e[2*n+1];0!==s&&(e[2*n]=k(a[s]++,s))}}function D(e){var t;for(t=0;t<o;t++)e.dyn_ltree[2*t]=0;for(t=0;t<s;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 O(e){8<e.bi_valid?S(e,e.bi_buf):0<e.bi_valid&&(e.pending_buf[e.pending++]=e.bi_buf),e.bi_buf=0,e.bi_valid=0}function N(e,t,i,r){var n=2*t,a=2*i;return e[n]<e[a]||e[n]===e[a]&&r[t]<=r[i]}function L(e,t,i){for(var r=e.heap[i],n=i<<1;n<=e.heap_len&&(n<e.heap_len&&N(t,e.heap[n+1],e.heap[n],e.depth)&&n++,!N(t,r,e.heap[n],e.depth));)e.heap[i]=e.heap[n],i=n,n<<=1;e.heap[i]=r}function x(e,t,i){var r,n,o,s,c=0;if(0!==e.last_lit)for(;r=e.pending_buf[e.d_buf+2*c]<<8|e.pending_buf[e.d_buf+2*c+1],n=e.pending_buf[e.l_buf+c],c++,0===r?R(e,n,t):(R(e,(o=g[n])+a+1,t),0!==(s=l[o])&&A(e,n-=v[o],s),R(e,o=T(--r),i),0!==(s=d[o])&&A(e,r-=b[o],s)),c<e.last_lit;);R(e,256,t)}function P(e,t){var i,r,n,a=t.dyn_tree,o=t.stat_desc.static_tree,s=t.stat_desc.has_stree,l=t.stat_desc.elems,d=-1;for(e.heap_len=0,e.heap_max=573,i=0;i<l;i++)0!==a[2*i]?(e.heap[++e.heap_len]=d=i,e.depth[i]=0):a[2*i+1]=0;for(;e.heap_len<2;)a[2*(n=e.heap[++e.heap_len]=d<2?++d:0)]=1,e.depth[n]=0,e.opt_len--,s&&(e.static_len-=o[2*n+1]);for(t.max_code=d,i=e.heap_len>>1;1<=i;i--)L(e,a,i);for(n=l;i=e.heap[1],e.heap[1]=e.heap[e.heap_len--],L(e,a,1),r=e.heap[1],e.heap[--e.heap_max]=i,e.heap[--e.heap_max]=r,a[2*n]=a[2*i]+a[2*r],e.depth[n]=(e.depth[i]>=e.depth[r]?e.depth[i]:e.depth[r])+1,a[2*i+1]=a[2*r+1]=n,e.heap[1]=n++,L(e,a,1),2<=e.heap_len;);e.heap[--e.heap_max]=e.heap[1],function(e,t){var i,r,n,a,o,s,l=t.dyn_tree,d=t.max_code,u=t.stat_desc.static_tree,h=t.stat_desc.has_stree,p=t.stat_desc.extra_bits,f=t.stat_desc.extra_base,m=t.stat_desc.max_length,g=0;for(a=0;a<=c;a++)e.bl_count[a]=0;for(l[2*e.heap[e.heap_max]+1]=0,i=e.heap_max+1;i<573;i++)m<(a=l[2*l[2*(r=e.heap[i])+1]+1]+1)&&(a=m,g++),l[2*r+1]=a,d<r||(e.bl_count[a]++,o=0,f<=r&&(o=p[r-f]),s=l[2*r],e.opt_len+=s*(a+o),h&&(e.static_len+=s*(u[2*r+1]+o)));if(0!==g){do{for(a=m-1;0===e.bl_count[a];)a--;e.bl_count[a]--,e.bl_count[a+1]+=2,e.bl_count[m]--,g-=2}while(0<g);for(a=m;0!==a;a--)for(r=e.bl_count[a];0!==r;)d<(n=e.heap[--i])||(l[2*n+1]!==a&&(e.opt_len+=(a-l[2*n+1])*l[2*n],l[2*n+1]=a),r--)}}(e,t),C(a,d,e.bl_count)}function M(e,t,i){var r,n,a=-1,o=t[1],s=0,c=7,l=4;for(0===o&&(c=138,l=3),t[2*(i+1)+1]=65535,r=0;r<=i;r++)n=o,o=t[2*(r+1)+1],++s<c&&n===o||(s<l?e.bl_tree[2*n]+=s:0!==n?(n!==a&&e.bl_tree[2*n]++,e.bl_tree[32]++):s<=10?e.bl_tree[34]++:e.bl_tree[36]++,a=n,l=(s=0)===o?(c=138,3):n===o?(c=6,3):(c=7,4))}function U(e,t,i){var r,n,a=-1,o=t[1],s=0,c=7,l=4;for(0===o&&(c=138,l=3),r=0;r<=i;r++)if(n=o,o=t[2*(r+1)+1],!(++s<c&&n===o)){if(s<l)for(;R(e,n,e.bl_tree),0!=--s;);else 0!==n?(n!==a&&(R(e,n,e.bl_tree),s--),R(e,16,e.bl_tree),A(e,s-3,2)):s<=10?(R(e,17,e.bl_tree),A(e,s-3,3)):(R(e,18,e.bl_tree),A(e,s-11,7));a=n,l=(s=0)===o?(c=138,3):n===o?(c=6,3):(c=7,4)}}n(b);var F=!1;function B(e,t,i,n){var a,o,s;A(e,0+(n?1:0),3),o=t,s=i,O(a=e),S(a,s),S(a,~s),r.arraySet(a.pending_buf,a.window,o,s,a.pending),a.pending+=s}i._tr_init=function(e){F||(function(){var e,t,i,r,n,a=new Array(16);for(r=i=0;r<28;r++)for(v[r]=i,e=0;e<1<<l[r];e++)g[i++]=r;for(g[i-1]=r,r=n=0;r<16;r++)for(b[r]=n,e=0;e<1<<d[r];e++)m[n++]=r;for(n>>=7;r<s;r++)for(b[r]=n<<7,e=0;e<1<<d[r]-7;e++)m[256+n++]=r;for(t=0;t<=c;t++)a[t]=0;for(e=0;e<=143;)p[2*e+1]=8,e++,a[8]++;for(;e<=255;)p[2*e+1]=9,e++,a[9]++;for(;e<=279;)p[2*e+1]=7,e++,a[7]++;for(;e<=287;)p[2*e+1]=8,e++,a[8]++;for(C(p,287,a),e=0;e<s;e++)f[2*e+1]=5,f[2*e]=k(e,5);_=new w(p,l,257,o,c),y=new w(f,d,0,s,c),E=new w(new Array(0),u,0,19,7)}(),F=!0),e.l_desc=new I(e.dyn_ltree,_),e.d_desc=new I(e.dyn_dtree,y),e.bl_desc=new I(e.bl_tree,E),e.bi_buf=0,e.bi_valid=0,D(e)},i._tr_stored_block=B,i._tr_flush_block=function(e,t,i,r){var n,o,s=0;0<e.level?(2===e.strm.data_type&&(e.strm.data_type=function(e){var t,i=4093624447;for(t=0;t<=31;t++,i>>>=1)if(1&i&&0!==e.dyn_ltree[2*t])return 0;if(0!==e.dyn_ltree[18]||0!==e.dyn_ltree[20]||0!==e.dyn_ltree[26])return 1;for(t=32;t<a;t++)if(0!==e.dyn_ltree[2*t])return 1;return 0}(e)),P(e,e.l_desc),P(e,e.d_desc),s=function(e){var t;for(M(e,e.dyn_ltree,e.l_desc.max_code),M(e,e.dyn_dtree,e.d_desc.max_code),P(e,e.bl_desc),t=18;3<=t&&0===e.bl_tree[2*h[t]+1];t--);return e.opt_len+=3*(t+1)+5+5+4,t}(e),n=e.opt_len+3+7>>>3,(o=e.static_len+3+7>>>3)<=n&&(n=o)):n=o=i+5,i+4<=n&&-1!==t?B(e,t,i,r):4===e.strategy||o===n?(A(e,2+(r?1:0),3),x(e,p,f)):(A(e,4+(r?1:0),3),function(e,t,i,r){var n;for(A(e,t-257,5),A(e,i-1,5),A(e,r-4,4),n=0;n<r;n++)A(e,e.bl_tree[2*h[n]+1],3);U(e,e.dyn_ltree,t-1),U(e,e.dyn_dtree,i-1)}(e,e.l_desc.max_code+1,e.d_desc.max_code+1,s+1),x(e,e.dyn_ltree,e.dyn_dtree)),D(e),r&&O(e)},i._tr_tally=function(e,t,i){return e.pending_buf[e.d_buf+2*e.last_lit]=t>>>8&255,e.pending_buf[e.d_buf+2*e.last_lit+1]=255&t,e.pending_buf[e.l_buf+e.last_lit]=255&i,e.last_lit++,0===t?e.dyn_ltree[2*i]++:(e.matches++,t--,e.dyn_ltree[2*(g[i]+a+1)]++,e.dyn_dtree[2*T(t)]++),e.last_lit===e.lit_bufsize-1},i._tr_align=function(e){var t;A(e,2,3),R(e,256,p),16===(t=e).bi_valid?(S(t,t.bi_buf),t.bi_buf=0,t.bi_valid=0):8<=t.bi_valid&&(t.pending_buf[t.pending++]=255&t.bi_buf,t.bi_buf>>=8,t.bi_valid-=8)}},{"../utils/common":41}],53:[function(e,t,i){t.exports=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}},{}],54:[function(e,t,i){(function(e){!function(e){if(!e.setImmediate){var t,i,r,n,a=1,o={},s=!1,c=e.document,l=Object.getPrototypeOf&&Object.getPrototypeOf(e);l=l&&l.setTimeout?l:e,t="[object process]"==={}.toString.call(e.process)?function(e){process.nextTick((function(){u(e)}))}:function(){if(e.postMessage&&!e.importScripts){var t=!0,i=e.onmessage;return e.onmessage=function(){t=!1},e.postMessage("","*"),e.onmessage=i,t}}()?(n="setImmediate$"+Math.random()+"$",e.addEventListener?e.addEventListener("message",h,!1):e.attachEvent("onmessage",h),function(t){e.postMessage(n+t,"*")}):e.MessageChannel?((r=new MessageChannel).port1.onmessage=function(e){u(e.data)},function(e){r.port2.postMessage(e)}):c&&"onreadystatechange"in c.createElement("script")?(i=c.documentElement,function(e){var t=c.createElement("script");t.onreadystatechange=function(){u(e),t.onreadystatechange=null,i.removeChild(t),t=null},i.appendChild(t)}):function(e){setTimeout(u,0,e)},l.setImmediate=function(e){"function"!=typeof e&&(e=new Function(""+e));for(var i=new Array(arguments.length-1),r=0;r<i.length;r++)i[r]=arguments[r+1];var n={callback:e,args:i};return o[a]=n,t(a),a++},l.clearImmediate=d}function d(e){delete o[e]}function u(e){if(s)setTimeout(u,0,e);else{var t=o[e];if(t){s=!0;try{!function(e){var t=e.callback,i=e.args;switch(i.length){case 0:t();break;case 1:t(i[0]);break;case 2:t(i[0],i[1]);break;case 3:t(i[0],i[1],i[2]);break;default:t.apply(undefined,i)}}(t)}finally{d(e),s=!1}}}}function h(t){t.source===e&&"string"==typeof t.data&&0===t.data.indexOf(n)&&u(+t.data.slice(n.length))}}("undefined"==typeof self?void 0===e?this:e:self)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}]},{},[10])(10)}))})),fA=cA(((e,t)=>{var i=Object.prototype.hasOwnProperty,r="~";function n(){}function a(e,t,i){this.fn=e,this.context=t,this.once=i||!1}function o(e,t,i,n,o){if("function"!=typeof i)throw new TypeError("The listener must be a function");var s=new a(i,n||e,o),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 s(e,t){0==--e._eventsCount?e._events=new n:delete e._events[t]}function c(){this._events=new n,this._eventsCount=0}Object.create&&(n.prototype=Object.create(null),(new n).__proto__||(r=!1)),c.prototype.eventNames=function(){var e,t,n=[];if(0===this._eventsCount)return n;for(t in e=this._events)i.call(e,t)&&n.push(r?t.slice(1):t);return Object.getOwnPropertySymbols?n.concat(Object.getOwnPropertySymbols(e)):n},c.prototype.listeners=function(e){var t=r?r+e:e,i=this._events[t];if(!i)return[];if(i.fn)return[i.fn];for(var n=0,a=i.length,o=new Array(a);n<a;n++)o[n]=i[n].fn;return o},c.prototype.listenerCount=function(e){var t=r?r+e:e,i=this._events[t];return i?i.fn?1:i.length:0},c.prototype.emit=function(e,t,i,n,a,o){var s=r?r+e:e;if(!this._events[s])return!1;var c,l,d=this._events[s],u=arguments.length;if(d.fn){switch(d.once&&this.removeListener(e,d.fn,void 0,!0),u){case 1:return d.fn.call(d.context),!0;case 2:return d.fn.call(d.context,t),!0;case 3:return d.fn.call(d.context,t,i),!0;case 4:return d.fn.call(d.context,t,i,n),!0;case 5:return d.fn.call(d.context,t,i,n,a),!0;case 6:return d.fn.call(d.context,t,i,n,a,o),!0}for(l=1,c=new Array(u-1);l<u;l++)c[l-1]=arguments[l];d.fn.apply(d.context,c)}else{var h,p=d.length;for(l=0;l<p;l++)switch(d[l].once&&this.removeListener(e,d[l].fn,void 0,!0),u){case 1:d[l].fn.call(d[l].context);break;case 2:d[l].fn.call(d[l].context,t);break;case 3:d[l].fn.call(d[l].context,t,i);break;case 4:d[l].fn.call(d[l].context,t,i,n);break;default:if(!c)for(h=1,c=new Array(u-1);h<u;h++)c[h-1]=arguments[h];d[l].fn.apply(d[l].context,c)}}return!0},c.prototype.on=function(e,t,i){return o(this,e,t,i,!1)},c.prototype.once=function(e,t,i){return o(this,e,t,i,!0)},c.prototype.removeListener=function(e,t,i,n){var a=r?r+e:e;if(!this._events[a])return this;if(!t)return s(this,a),this;var o=this._events[a];if(o.fn)o.fn===t&&(!n||o.once)&&(!i||o.context===i)&&s(this,a);else{for(var c=0,l=[],d=o.length;c<d;c++)(o[c].fn!==t||n&&!o[c].once||i&&o[c].context!==i)&&l.push(o[c]);l.length?this._events[a]=1===l.length?l[0]:l:s(this,a)}return this},c.prototype.removeAllListeners=function(e){var t;return e?(t=r?r+e:e,this._events[t]&&s(this,t)):(this._events=new n,this._eventsCount=0),this},c.prototype.off=c.prototype.removeListener,c.prototype.addListener=c.prototype.on,c.prefixed=r,c.EventEmitter=c,void 0!==t&&(t.exports=c)})),mA=cA(((e,t)=>{var i=t.exports={v:[{name:"version",reg:/^(\d*)$/}],o:[{name:"origin",reg:/^(\S*) (\d*) (\d*) (\S*) IP(\d) (\S*)/,names:["username","sessionId","sessionVersion","netType","ipVer","address"],format:"%s %s %d %s IP%d %s"}],s:[{name:"name"}],i:[{name:"description"}],u:[{name:"uri"}],e:[{name:"email"}],p:[{name:"phone"}],z:[{name:"timezones"}],r:[{name:"repeats"}],t:[{name:"timing",reg:/^(\d*) (\d*)/,names:["start","stop"],format:"%d %d"}],c:[{name:"connection",reg:/^IN IP(\d) (\S*)/,names:["version","ip"],format:"IN IP%d %s"}],b:[{push:"bandwidth",reg:/^(TIAS|AS|CT|RR|RS):(\d*)/,names:["type","limit"],format:"%s:%s"}],m:[{reg:/^(\w*) (\d*) ([\w/]*)(?: (.*))?/,names:["type","port","protocol","payloads"],format:"%s %d %s %s"}],a:[{push:"rtp",reg:/^rtpmap:(\d*) ([\w\-.]*)(?:\s*\/(\d*)(?:\s*\/(\S*))?)?/,names:["payload","codec","rate","encoding"],format:function(e){return e.encoding?"rtpmap:%d %s/%s/%s":e.rate?"rtpmap:%d %s/%s":"rtpmap:%d %s"}},{push:"fmtp",reg:/^fmtp:(\d*) ([\S| ]*)/,names:["payload","config"],format:"fmtp:%d %s"},{name:"control",reg:/^control:(.*)/,format:"control:%s"},{name:"rtcp",reg:/^rtcp:(\d*)(?: (\S*) IP(\d) (\S*))?/,names:["port","netType","ipVer","address"],format:function(e){return null!=e.address?"rtcp:%d %s IP%d %s":"rtcp:%d"}},{push:"rtcpFbTrrInt",reg:/^rtcp-fb:(\*|\d*) trr-int (\d*)/,names:["payload","value"],format:"rtcp-fb:%s trr-int %d"},{push:"rtcpFb",reg:/^rtcp-fb:(\*|\d*) ([\w-_]*)(?: ([\w-_]*))?/,names:["payload","type","subtype"],format:function(e){return null!=e.subtype?"rtcp-fb:%s %s %s":"rtcp-fb:%s %s"}},{push:"ext",reg:/^extmap:(\d+)(?:\/(\w+))?(?: (urn:ietf:params:rtp-hdrext:encrypt))? (\S*)(?: (\S*))?/,names:["value","direction","encrypt-uri","uri","config"],format:function(e){return"extmap:%d"+(e.direction?"/%s":"%v")+(e["encrypt-uri"]?" %s":"%v")+" %s"+(e.config?" %s":"")}},{name:"extmapAllowMixed",reg:/^(extmap-allow-mixed)/},{push:"crypto",reg:/^crypto:(\d*) ([\w_]*) (\S*)(?: (\S*))?/,names:["id","suite","config","sessionConfig"],format:function(e){return null!=e.sessionConfig?"crypto:%d %s %s %s":"crypto:%d %s %s"}},{name:"setup",reg:/^setup:(\w*)/,format:"setup:%s"},{name:"connectionType",reg:/^connection:(new|existing)/,format:"connection:%s"},{name:"mid",reg:/^mid:([^\s]*)/,format:"mid:%s"},{name:"msid",reg:/^msid:(.*)/,format:"msid:%s"},{name:"ptime",reg:/^ptime:(\d*(?:\.\d*)*)/,format:"ptime:%d"},{name:"maxptime",reg:/^maxptime:(\d*(?:\.\d*)*)/,format:"maxptime:%d"},{name:"direction",reg:/^(sendrecv|recvonly|sendonly|inactive)/},{name:"icelite",reg:/^(ice-lite)/},{name:"iceUfrag",reg:/^ice-ufrag:(\S*)/,format:"ice-ufrag:%s"},{name:"icePwd",reg:/^ice-pwd:(\S*)/,format:"ice-pwd:%s"},{name:"fingerprint",reg:/^fingerprint:(\S*) (\S*)/,names:["type","hash"],format:"fingerprint:%s %s"},{push:"candidates",reg:/^candidate:(\S*) (\d*) (\S*) (\d*) (\S*) (\d*) typ (\S*)(?: raddr (\S*) rport (\d*))?(?: tcptype (\S*))?(?: generation (\d*))?(?: network-id (\d*))?(?: network-cost (\d*))?/,names:["foundation","component","transport","priority","ip","port","type","raddr","rport","tcptype","generation","network-id","network-cost"],format:function(e){var t="candidate:%s %d %s %d %s %d typ %s";return t+=null!=e.raddr?" raddr %s rport %d":"%v%v",t+=null!=e.tcptype?" tcptype %s":"%v",null!=e.generation&&(t+=" generation %d"),t+=null!=e["network-id"]?" network-id %d":"%v",t+=null!=e["network-cost"]?" network-cost %d":"%v"}},{name:"endOfCandidates",reg:/^(end-of-candidates)/},{name:"remoteCandidates",reg:/^remote-candidates:(.*)/,format:"remote-candidates:%s"},{name:"iceOptions",reg:/^ice-options:(\S*)/,format:"ice-options:%s"},{push:"ssrcs",reg:/^ssrc:(\d*) ([\w_-]*)(?::(.*))?/,names:["id","attribute","value"],format:function(e){var t="ssrc:%d";return null!=e.attribute&&(t+=" %s",null!=e.value&&(t+=":%s")),t}},{push:"ssrcGroups",reg:/^ssrc-group:([\x21\x23\x24\x25\x26\x27\x2A\x2B\x2D\x2E\w]*) (.*)/,names:["semantics","ssrcs"],format:"ssrc-group:%s %s"},{name:"msidSemantic",reg:/^msid-semantic:\s?(\w*) (\S*)/,names:["semantic","token"],format:"msid-semantic: %s %s"},{push:"groups",reg:/^group:(\w*) (.*)/,names:["type","mids"],format:"group:%s %s"},{name:"rtcpMux",reg:/^(rtcp-mux)/},{name:"rtcpRsize",reg:/^(rtcp-rsize)/},{name:"sctpmap",reg:/^sctpmap:([\w_/]*) (\S*)(?: (\S*))?/,names:["sctpmapNumber","app","maxMessageSize"],format:function(e){return null!=e.maxMessageSize?"sctpmap:%s %s %s":"sctpmap:%s %s"}},{name:"xGoogleFlag",reg:/^x-google-flag:([^\s]*)/,format:"x-google-flag:%s"},{push:"rids",reg:/^rid:([\d\w]+) (\w+)(?: ([\S| ]*))?/,names:["id","direction","params"],format:function(e){return e.params?"rid:%s %s %s":"rid:%s %s"}},{push:"imageattrs",reg:new RegExp("^imageattr:(\\d+|\\*)[\\s\\t]+(send|recv)[\\s\\t]+(\\*|\\[\\S+\\](?:[\\s\\t]+\\[\\S+\\])*)(?:[\\s\\t]+(recv|send)[\\s\\t]+(\\*|\\[\\S+\\](?:[\\s\\t]+\\[\\S+\\])*))?"),names:["pt","dir1","attrs1","dir2","attrs2"],format:function(e){return"imageattr:%s %s %s"+(e.dir2?" %s %s":"")}},{name:"simulcast",reg:new RegExp("^simulcast:(send|recv) ([a-zA-Z0-9\\-_~;,]+)(?:\\s?(send|recv) ([a-zA-Z0-9\\-_~;,]+))?$"),names:["dir1","list1","dir2","list2"],format:function(e){return"simulcast:%s %s"+(e.dir2?" %s %s":"")}},{name:"simulcast_03",reg:/^simulcast:[\s\t]+([\S+\s\t]+)$/,names:["value"],format:"simulcast: %s"},{name:"framerate",reg:/^framerate:(\d+(?:$|\.\d+))/,format:"framerate:%s"},{name:"sourceFilter",reg:/^source-filter: *(excl|incl) (\S*) (IP4|IP6|\*) (\S*) (.*)/,names:["filterMode","netType","addressTypes","destAddress","srcList"],format:"source-filter: %s %s %s %s %s"},{name:"bundleOnly",reg:/^(bundle-only)/},{name:"label",reg:/^label:(.+)/,format:"label:%s"},{name:"sctpPort",reg:/^sctp-port:(\d+)$/,format:"sctp-port:%s"},{name:"maxMessageSize",reg:/^max-message-size:(\d+)$/,format:"max-message-size:%s"},{push:"tsRefClocks",reg:/^ts-refclk:([^\s=]*)(?:=(\S*))?/,names:["clksrc","clksrcExt"],format:function(e){return"ts-refclk:%s"+(null!=e.clksrcExt?"=%s":"")}},{name:"mediaClk",reg:/^mediaclk:(?:id=(\S*))? *([^\s=]*)(?:=(\S*))?(?: *rate=(\d+)\/(\d+))?/,names:["id","mediaClockName","mediaClockValue","rateNumerator","rateDenominator"],format:function(e){var t="mediaclk:";return t+=null!=e.id?"id=%s %s":"%v%s",t+=null!=e.mediaClockValue?"=%s":"",t+=null!=e.rateNumerator?" rate=%s":"",t+=null!=e.rateDenominator?"/%s":""}},{name:"keywords",reg:/^keywds:(.+)$/,format:"keywds:%s"},{name:"content",reg:/^content:(.+)/,format:"content:%s"},{name:"bfcpFloorCtrl",reg:/^floorctrl:(c-only|s-only|c-s)/,format:"floorctrl:%s"},{name:"bfcpConfId",reg:/^confid:(\d+)/,format:"confid:%s"},{name:"bfcpUserId",reg:/^userid:(\d+)/,format:"userid:%s"},{name:"bfcpFloorId",reg:/^floorid:(.+) (?:m-stream|mstrm):(.+)/,names:["id","mStream"],format:"floorid:%s mstrm:%s"},{push:"invalid",names:["value"]}]};Object.keys(i).forEach((function(e){i[e].forEach((function(e){e.reg||(e.reg=/(.*)/),e.format||(e.format="%s")}))}))})),gA=cA((e=>{var t=function(e){return String(Number(e))===e?Number(e):e},i=function(e,i,r){var n=e.name&&e.names;e.push&&!i[e.push]?i[e.push]=[]:n&&!i[e.name]&&(i[e.name]={});var a=e.push?{}:n?i[e.name]:i;(function(e,i,r,n){if(n&&!r)i[n]=t(e[1]);else for(var a=0;a<r.length;a+=1)null!=e[a+1]&&(i[r[a]]=t(e[a+1]))})(r.match(e.reg),a,e.names,e.name),e.push&&i[e.push].push(a)},r=mA(),n=RegExp.prototype.test.bind(/^([a-z])=(.*)/);e.parse=function(e){var t={},a=[],o=t;return e.split(/(\r\n|\r|\n)/).filter(n).forEach((function(e){var t=e[0],n=e.slice(2);"m"===t&&(a.push({rtp:[],fmtp:[]}),o=a[a.length-1]);for(var s=0;s<(r[t]||[]).length;s+=1){var c=r[t][s];if(c.reg.test(n))return i(c,o,n)}})),t.media=a,t};var a=function(e,i){var r=i.split(/=(.+)/,2);return 2===r.length?e[r[0]]=t(r[1]):1===r.length&&i.length>1&&(e[r[0]]=void 0),e};e.parseParams=function(e){return e.split(/;\s?/).reduce(a,{})},e.parseFmtpConfig=e.parseParams,e.parsePayloads=function(e){return e.toString().split(" ").map(Number)},e.parseRemoteCandidates=function(e){for(var i=[],r=e.split(" ").map(t),n=0;n<r.length;n+=3)i.push({component:r[n],ip:r[n+1],port:r[n+2]});return i},e.parseImageAttributes=function(e){return e.split(" ").map((function(e){return e.substring(1,e.length-1).split(",").reduce(a,{})}))},e.parseSimulcastStreamList=function(e){return e.split(";").map((function(e){return e.split(",").map((function(e){var i,r=!1;return"~"!==e[0]?i=t(e):(i=t(e.substring(1,e.length)),r=!0),{scid:i,paused:r}}))}))}})),vA=cA(((e,t)=>{var i=mA(),r=/%[sdv%]/g,n=function(e){var t=1,i=arguments,n=i.length;return e.replace(r,(function(e){if(t>=n)return e;var r=i[t];switch(t+=1,e){case"%%":return"%";case"%s":return String(r);case"%d":return Number(r);case"%v":return""}}))},a=function(e,t,i){var r=[e+"="+(t.format instanceof Function?t.format(t.push?i:i[t.name]):t.format)];if(t.names)for(var a=0;a<t.names.length;a+=1){var o=t.names[a];t.name?r.push(i[t.name][o]):r.push(i[t.names[a]])}else r.push(i[t.name]);return n.apply(null,r)},o=["v","o","s","i","u","e","p","c","b","t","r","z","a"],s=["i","c","b","a"];t.exports=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||o,n=t.innerOrder||s,c=[];return r.forEach((function(t){i[t].forEach((function(i){i.name in e&&null!=e[i.name]?c.push(a(t,i,e)):i.push in e&&null!=e[i.push]&&e[i.push].forEach((function(e){c.push(a(t,i,e))}))}))})),e.media.forEach((function(e){c.push(a("m",i.m[0],e)),n.forEach((function(t){i[t].forEach((function(i){i.name in e&&null!=e[i.name]?c.push(a(t,i,e)):i.push in e&&null!=e[i.push]&&e[i.push].forEach((function(e){c.push(a(t,i,e))}))}))}))})),c.join("\r\n")+"\r\n"}})),_A=cA((e=>{var t=gA(),i=vA(),r=mA();e.grammar=r,e.write=i,e.parse=t.parse,e.parseParams=t.parseParams,e.parseFmtpConfig=t.parseFmtpConfig,e.parsePayloads=t.parsePayloads,e.parseRemoteCandidates=t.parseRemoteCandidates,e.parseImageAttributes=t.parseImageAttributes,e.parseSimulcastStreamList=t.parseSimulcastStreamList})),yA=(e=>(e.ROOM_DESTROY="1",e.JOIN_START="21",e.JOIN_SCHEDULE_SUCCESS="22",e.JOIN_SIGNAL_CONNECTION_START="23",e.JOIN_SIGNAL_CONNECTION_END="24",e.JOIN_SEND_CMD="25",e.JOIN_RECEIVED_CMD_RES="26",e.JOIN_SUCCESS="27",e.JOIN_FAILED="28",e.LEAVE_START="51",e.LEAVE_SEND_CMD="52",e.LEAVE_SUCCESS="53",e.PUBLISH_START="61",e.SEND_FIRST_VIDEO_FRAME="62",e.PUBLISH_FAILED="63",e.SUBSCRIBE_START="81",e.SUBSCRIBE_SUCCESS="82",e.SUBSCRIBE_FAILED="84",e.UNSUBSCRIBE_SUCCESS="83",e.LOCAL_TRACK_CAPTURE_START="101",e.LOCAL_TRACK_CAPTURE_SUCCESS="102",e.LOCAL_TRACK_CAPTURE_FAILED="103",e.LOCAL_TRACK_PUBLISHED="104",e.LOCAL_TRACK_UNPUBLISHED="105",e.LOCAL_TRACK_REPLACED="106",e.SWITCH_DEVICE_SUCCESS="107",e.TRACK_MUTED="108",e.TRACK_UNMUTED="109",e.REMOTE_TRACK_SUBSCRIBED="110",e.REMOTE_TRACK_UNSUBSCRIBED="111",e.LOCAL_TRACK_RECAPTURE="112",e.LOCAL_AUDIO_STARTED="113",e.LOCAL_AUDIO_STOPPED="114",e.REMOTE_AUDIO_STARTED="115",e.REMOTE_AUDIO_STOPPED="116",e.PLAY_TRACK_START="151",e.PLAYER_STATE_CHANGED="152",e.VIDEO_LOADED_DATA="153",e.AUTOPLAY_DIALOG_CLICK_CONFIRM="154",e.AUDIO_CONTEXT_LONG_SUSPENDED="155",e.REMOTE_VIDEO_PLAY_START="156",e.REMOTE_VIDEO_PLAY_FINISH="157",e.SIGNAL_CONNECTION_STATE_CHANGED="201",e.PEER_CONNECTION_STATE_CHANGED="202",e.SINGLE_CONNECTION_STAT="203",e.SPC_RECONNECTED="204",e.HEARTBEAT_REPORT="251",e.RECEIVED_PUBLISHED_USER_LIST="252",e.REMOTE_PUBLISH_STATE_CHANGED="253",e.AUDIO_LEVEL_INTERVAL="260",e.NETWORK_QUALITY="261",e.VIDEO_CODEC_IMPLEMENTATION_CHANGED="262",e.QUALITY_LIMITATION_CHANGED="263",e.LOG="264",e.AUDIO_PROCESSOR_DEBUG="265",e.SSO_SWITCH="266",e.SEI_MESSAGE="267",e.SWITCH_ROOM_START="401",e.SWITCH_ROOM_SUCCESS="407",e.SWITCH_ROOM_FAILED="408",e))(yA||{});function EA(e){return bA(((t,i)=>async function(){for(var i=arguments.length,r=new Array(i),n=0;n<i;n++)r[n]=arguments[n];let a=await t.apply(this,r);return await e.call(this,...r),a}))}function bA(e){return function(t,i,r){return r.value=e(r.value,i),r}}var wA=new WeakMap;function IA(e,t){return bA(((i,r)=>function(){for(var r=arguments.length,n=new Array(r),a=0;a<r;a++)n[a]=arguments[a];let o=wA.get(this);o||(o=new Map,wA.set(this,o));let s=t(...n),c=o.get(s);if(!c||c<=0){i.apply(this,n);let t=setTimeout((()=>{var e;null==(e=wA.get(this))||e.delete(s)}),e);o.set(s,t)}else{clearTimeout(c);let t=window.setTimeout((()=>{var e;i.apply(this,n),null==(e=wA.get(this))||e.delete(s)}),e);o.set(s,t)}}))}var TA,SA,AA=((TA=AA||{})[TA.none=0]="none",TA[TA.horizontal=1]="horizontal",TA[TA.vertical=2]="vertical",TA),RA="5.0.0",kA="undefined"!=typeof importScripts,CA="undefined"!=typeof registerProcessor,DA="https://".concat("web.sdk.qcloud.com","/trtc/webrtc/doc"),OA="https://cloud.tencent.com/document/product/647/85386",NA="https://trtc.io/document/56025",LA="jssdk_log",xA="qcloud",PA=((SA=PA||{})[SA.TRACE=0]="TRACE",SA[SA.DEBUG=1]="DEBUG",SA[SA.INFO=2]="INFO",SA[SA.WARN=3]="WARN",SA[SA.ERROR=4]="ERROR",SA[SA.NONE=5]="NONE",SA),MA={unknown:0,wifi:1,"4g":2,"3g":3,"2g":4,wired:5,"5g":6},UA={width:640,height:480,frameRate:15,bitrate:500},FA="canvas",BA="audio",VA="video",HA="screen",zA="big",jA="mute",WA="unmute",GA="ended",qA="playing",KA="pause",YA="error",XA="loadstart",ZA="loadeddata",JA="loadedmetadata",QA="audioinput",$A="videoinput",eR="enterpictureinpicture",tR="leavepictureinpicture",iR="resize",rR="player-error",nR="load-worklet",aR="getUserMedia-retry",oR="default",sR=2e3,cR=["width","height","frameRate","facingMode","sampleRate","sampleSize","channelCount","deviceId","min","max"],lR="Log",dR="Network",uR="Dump",hR="Dumping",pR="End",fR="Upload Log",mR="Export Log",gR="Hide",vR="goBottom",_R="backTop",yR="Clear Log",ER="Uplink",bR="Downlink",wR="No Data",IR="Basic",TR="Duration",SR="Video",AR="Audio",RR="Screen",kR={"play() error: NotAllowedError:":{tips:e=>e.includes("main <video>")||e.includes("main <audio>")?"Remote stream auto play is restricted and playback fails":"Local stream playback failure, generally only occurs in Android WeChat devices, no need to handle",color:"red",class:"red"},"updateStream() try to recover local stream":{tips:"Device acquisition exception, automatic recovery is in progress"},"updateStream() recover local stream successfully":{tips:"Device acquisition exception, automatic recovery is successful"},"updateStream() failed to recover local stream":{tips:"Device acquisition exception, automatic recovery failed"},"main stream - video track is muted":{tips:"Indicates that the received video data is not enough for playback. This is usually caused by network reasons. When enough data is received for playback, the state will change to unmuted."},"main stream - audio track is muted":{tips:"Indicates that the received audio data is not enough for playback. This is usually caused by network reasons. When enough data is received for playback, the state will change to unmuted."},"auxiliary stream - video track is muted":{tips:"Indicates that the received screen sharing data is not enough for playback. This is usually caused by network reasons. When enough data is received for playback, the state will change to unmuted."},"main stream - video track is unable to provide media output":{tips:"Indicates that the received video data is not enough for playback. This is usually caused by network reasons. When enough data is received for playback, the state will change to unmuted."},"main stream - audio track is unable to provide media output":{tips:"Indicates that the received audio data is not enough for playback. This is usually caused by network reasons. When enough data is received for playback, the state will change to unmuted."},"auxiliary stream - video track is unable to provide media output":{tips:"Indicates that the received screen sharing data is not enough for playback. This is usually caused by network reasons. When enough data is received for playback, the state will change to unmuted."},"main stream - video track is unmuted":{tips:"Received enough playback video data"},"main stream - audio track is unmuted":{tips:"Received enough playback audio data"},"auxiliary stream - video track is unmuted":{tips:"Received enough playback screen sharing data"},"main stream - audio player track is ended":{tips:"Remote audio track stopped"},"main stream - video player track is ended":{tips:"Remote video track stopped"},"auxiliary stream - video player track is ended":{tips:"Received enough playback screen sharing data"},"stream - video track is muted":{tips:"Camera capture is paused, usually due to the device being occupied by other applications or the browser media permission being revoked. The client needs to re-capture.",color:"orange"},"stream - video track is unable to provide media output":{tips:"The camera acquisition is paused, usually because the device is occupied by other applications or the browser media permissions are revoked, and the customer needs to re-acquire. SDK v4.11.4+ will automatically resume acquisition without customer intervention",color:"orange"},"video track is unable to provide media output":{tips:e=>e.includes("↓")?"The remote track is temporarily unable to decode data, which may be caused by network fluctuations":"The camera acquisition is paused, usually because the device is occupied by other applications or the browser media permissions are revoked. The SDK will automatically resume the acquisition.",color:"orange"},"stream - video player track is ended":{tips:"The camera acquisition stops, usually because the device is unplugged. In this case, the SDK will automatically resume acquisition, and the access side does not need to handle it. It may also be caused by the device being occupied by other applications or the browser media permissions being reclaimed. It is recommended to remind the user to re-acquire on the page."},"video player track is ended":{tips:"The camera acquisition stops, usually because the device is unplugged. In this case, the SDK will automatically resume acquisition, and the access side does not need to handle it. It may also be caused by the device being occupied by other applications or the browser media permissions being reclaimed. It is recommended to remind the user to re-acquire on the page."},"stream - audio track is muted":{tips:"Microphone capture is paused, usually due to the device being occupied by other applications or the browser media permission being revoked. The client needs to re-capture.",color:"orange"},"audio track is unable to provide media output":{tips:e=>e.includes("↓")?"The remote track is temporarily unable to decode data, which may be caused by network fluctuations":"Microphone acquisition is paused, usually because the device is occupied by other applications or the browser media permissions are revoked. The SDK will automatically resume the acquisition.",color:"orange"},"stream - audio track is unable to provide media output":{tips:"The microphone acquisition is paused, usually because the device is occupied by other applications or the browser media permissions are revoked. The SDK will automatically resume the acquisition.",color:"orange"},"stream - audio player track is ended":{tips:"The microphone acquisition stops, usually because the device is unplugged. In this case, the SDK will automatically resume acquisition, and the access side does not need to handle it. It may also be caused by the device being occupied by other applications or the browser media permissions being reclaimed. It is recommended to remind the user to re-acquire on the page."},"audio player track is ended":{tips:"The microphone acquisition stops, usually because the device is unplugged. In this case, the SDK will automatically resume acquisition, and the access side does not need to handle it. It may also be caused by the device being occupied by other applications or the browser media permissions being reclaimed. It is recommended to remind the user to re-acquire on the page."},"is adding audio track to current published local stream":{tips:"add audio track",color:"orange"},"is removing audio track from current published local stream":{tips:"remove audio track",color:"orange"},"is removing video track from current published local stream":{tips:"remove video track",color:"orange"},"is adding video track to current published local stream":{tips:"add video track",color:"orange"},"is replacing audio track to current published local main stream":{tips:"replace audio track",color:"orange"},"is replacing video track to current published local main stream":{tips:"replace video track",color:"orange"},"downlink network quality change":{tips:"Downstream network quality change: 1: excellent, 2: good, 3: average, 4: poor, 5: extremely poor"},"uplink network quality change":{tips:"Upstream network quality change: 1: excellent, 2: good, 3: average, 4: poor, 5: extremely poor"},"localStream mute video":{tips:"mute upstream video stream",color:"orange"},"localStream unmute video":{tips:"unmute upstream video stream",color:"orange"},"localStream mute audio":{tips:"mute upstream audio stream",color:"orange"},"localStream unmute audio":{tips:"unmute upstream audio stream",color:"orange"},"black detected":{tips:"Detect black screen, which means fps = 0. It is usually caused by network, and the network will be recovered after a while. If the network is normal but has not been restored, it is an abnormal situation."},'main stream start to play with options: {"muted":true}':{tips:"Play the remote stream in silent mode. Generally, the remote stream does not need to be played in silent mode. You need to confirm whether the parameters passed in the client stream.play API call are correct.",color:"orange"},"main stream - audio player is starting playing":{tips:"Remote stream audio playback success",color:"#0dd90d",class:"success"},"main stream - video player is starting playing":{tips:"Remote stream video playback success",color:"#0dd90d",class:"success"},"video player is playing":{tips:"Local video playback success",color:"#0dd90d",class:"success"},"audio player is playing":{tips:"Local audio playback success",color:"#0dd90d",class:"success"},"stream - video player is starting playing":{tips:"Local video playback success",color:"#0dd90d",class:"success"},"stream - audio player is starting playing":{tips:"Local audio playback success",color:"#0dd90d",class:"success"},"switch camera success":{tips:"Switch camera success",color:"#0dd90d",class:"success"},"switch microphone success":{tips:"Switch microphone success",color:"#0dd90d",class:"success"},gotStream:{tips:"Local stream capture success"},"local stream is published successfully":{tips:"Publish success",color:"#0dd90d",class:"success"},"encoderImplementation change to OpenH264":{tips:"Use software encoding"},"encoderImplementation change to ExternalEncoder":{tips:"Use hardware encoding"},"getUserMedia with constraints":{tips:"Start media (camera/microphone) capture"},"getDisplayMedia with constraints":{tips:"Start screen sharing capture"},"client-banned":{tips:"Kicked out of the room",color:"red",class:"red",textColor:"#fff"},user_timeout:{tips:"The backend is too long without receiving SDK heartbeat, which is usually caused by the JS thread being blocked for a long time. If the reproduction probability is high, the application browser Performance tool analyzes where the JS thread is blocked.",color:"red",class:"red",textColor:"#fff"},"schedule failed":{tips:"Signaling request failed, does not affect the normal room entry process, SDK will connect to the default signaling domain."},"updateStream() video flag is true, but no camera detected, set video to false":{tips:"When trying to resume camera acquisition, the camera acquisition is not resumed because it is detected that there is no camera.",color:"orange",class:"orange",textColor:"#fff"},"qualityLimitationReason change to bandwidth":{tips:"bandwidth estimation is not enough to limit the quality of the encoding, which may cause the code rate, frame rate, and resolution to be lowered.",color:"orange",class:"orange",textColor:"#fff"},"qualityLimitationReason change to cpu":{tips:"cpu load is too high to limit the quality of the encoding, which may cause the code rate, frame rate, and resolution to be lowered.",color:"orange",class:"orange",textColor:"#fff"},"visibility change: hidden":{tips:"User page switched to backend, in mobile devices, this will cause the device to pause the capture, and it will be restored when the user switches backend to the frontend.",color:"orange",class:"orange",textColor:"#fff"},"visibility change: visible":{tips:"User page switched to frontend",color:"orange",class:"orange",textColor:"#fff"},"main stream - audio player is paused":{tips:"The remote stream audio playback is paused, which usually has two possibilities:\n 1. The business side passes in the div tag container for playing audio and video to be removed by the business side from the DOM.\n 2. If the user is in Chrome 70 and below, when the div container is moved, the playback will be paused.",color:"orange",class:"orange",textColor:"#fff"},"main stream - video player is paused":{tips:"The remote stream video playback is paused, which usually has two possibilities:\n 1. The business side passes in the div tag container for playing audio and video to be removed by the business side from the DOM.\n 2. If the user is in Chrome 70 and below, when the div container is moved, the playback will be paused.",color:"orange",class:"orange",textColor:"#fff"},'"displaySurface":"window"':{tips:"Screen sharing captures the application window",color:"blue",class:"blue",textColor:"#fff"},'"displaySurface":"monitor"':{tips:"Screen sharing captures the entire screen",color:"blue",class:"blue",textColor:"#fff"},'"displaySurface":"browser"':{tips:"Screen sharing captures a certain tab page",color:"blue",class:"blue",textColor:"#fff"},updateMediaSettings:{tips:"The resolution and frame rate below are the actual resolution and frame rate captured",color:"blue",class:"blue",textColor:"#fff"},"main stream start to play with":{tips:"Call remoteStream.play interface",color:"blue",class:"blue",textColor:"#fff"},"stream start to play with":{tips:"Call localStream.play interface",color:"blue",class:"blue",textColor:"#fff"},"main setAudioVolume to 0":{tips:"Business side calls remoteStream.setAudioVolume(0) interface to set the playback volume to 0, which will cause the playback to be silent",color:"orange",class:"orange",textColor:"#fff"},"screen sharing was stopped because the video track is ended":{tips:"Screen sharing capture stopped, possible reasons: user clicks the stop button, the window/page shared by the user is closed, etc.",color:"orange",class:"orange",textColor:"#fff"},"Join() => joining room":{tips:"Call client.join interface",color:"blue",class:"blue",textColor:"#fff"},"publish() => publishing local stream":{tips:"Call client.publish interface",color:"blue",class:"blue",textColor:"#fff"},"subscribe() => subscribe to":{tips:"Call client.subscribe interface",color:"blue",class:"blue",textColor:"#fff"},"switchRole() => switch role":{tips:"Call client.switchRole interface",color:"blue",class:"blue",textColor:"#fff"}};["enterRoom","exitRoom","switchRole","destroy","startLocalAudio","updateLocalAudio","stopLocalAudio","startLocalVideo","updateLocalVideo","stopLocalVideo","startScreenShare","updateScreenShare","stopScreenShare","startRemoteVideo","updateRemoteVideo","stopRemoteVideo","muteRemoteAudio","setRemoteAudioVolume"].forEach((e=>{kR["".concat(e,"()")]={tips:"Call trtc.".concat(e),color:"blue",class:"blue",textColor:"#fff"}}));var CR,DR=Object.keys(kR),OR=dA(pA()),NR=((CR=NR||{})[CR.INVALID_PARAMETER=4096]="INVALID_PARAMETER",CR[CR.INVALID_OPERATION=4097]="INVALID_OPERATION",CR[CR.NOT_SUPPORTED=4098]="NOT_SUPPORTED",CR[CR.DEVICE_NOT_FOUND=4099]="DEVICE_NOT_FOUND",CR[CR.INITIALIZE_FAILED=4100]="INITIALIZE_FAILED",CR[CR.SIGNAL_CHANNEL_SETUP_FAILED=16385]="SIGNAL_CHANNEL_SETUP_FAILED",CR[CR.SIGNAL_CHANNEL_ERROR=16386]="SIGNAL_CHANNEL_ERROR",CR[CR.ICE_TRANSPORT_ERROR=16387]="ICE_TRANSPORT_ERROR",CR[CR.JOIN_ROOM_FAILED=16388]="JOIN_ROOM_FAILED",CR[CR.CREATE_OFFER_FAILED=16389]="CREATE_OFFER_FAILED",CR[CR.SIGNAL_CHANNEL_RECONNECTION_FAILED=16390]="SIGNAL_CHANNEL_RECONNECTION_FAILED",CR[CR.UPLINK_RECONNECTION_FAILED=16391]="UPLINK_RECONNECTION_FAILED",CR[CR.DOWNLINK_RECONNECTION_FAILED=16392]="DOWNLINK_RECONNECTION_FAILED",CR[CR.REMOTE_STREAM_NOT_EXIST=16400]="REMOTE_STREAM_NOT_EXIST",CR[CR.CLIENT_BANNED=16448]="CLIENT_BANNED",CR[CR.SERVER_TIMEOUT=16449]="SERVER_TIMEOUT",CR[CR.SUBSCRIPTION_TIMEOUT=16450]="SUBSCRIPTION_TIMEOUT",CR[CR.PLAY_NOT_ALLOWED=16451]="PLAY_NOT_ALLOWED",CR[CR.DEVICE_AUTO_RECOVER_FAILED=16452]="DEVICE_AUTO_RECOVER_FAILED",CR[CR.START_PUBLISH_CDN_FAILED=16453]="START_PUBLISH_CDN_FAILED",CR[CR.STOP_PUBLISH_CDN_FAILED=16454]="STOP_PUBLISH_CDN_FAILED",CR[CR.START_MIX_TRANSCODE_FAILED=16455]="START_MIX_TRANSCODE_FAILED",CR[CR.STOP_MIX_TRANSCODE_FAILED=16456]="STOP_MIX_TRANSCODE_FAILED",CR[CR.NOT_SUPPORTED_H264=16457]="NOT_SUPPORTED_H264",CR[CR.SWITCH_ROLE_FAILED=16458]="SWITCH_ROLE_FAILED",CR[CR.API_CALL_TIMEOUT=16459]="API_CALL_TIMEOUT",CR[CR.SCHEDULE_FAILED=16460]="SCHEDULE_FAILED",CR[CR.API_CALL_ABORTED=16461]="API_CALL_ABORTED",CR[CR.SPC_INITIALIZED_FAILED=16462]="SPC_INITIALIZED_FAILED",CR[CR.VIDEO_MANAGER_ERROR=16463]="VIDEO_MANAGER_ERROR",CR[CR.SWITCH_ROOM_FAILED=16464]="SWITCH_ROOM_FAILED",CR[CR.VIDEO_ENCODE_FAILED=16465]="VIDEO_ENCODE_FAILED",CR[CR.AUDIO_ENCODE_FAILED=16466]="AUDIO_ENCODE_FAILED",CR[CR.UNKNOWN=65535]="UNKNOWN",CR),LR=NR,xR=class extends Error{constructor(e){let{name:t="RtcError",message:i,code:r=LR.UNKNOWN,extraCode:n=0,constraint:a}=e,o="<".concat(function(e){for(let t in LR)if(LR[t]===e)return t;return"UNKNOWN"}(r)," 0x").concat(r.toString(16),">"),s="".concat(i).concat(a?" constraint: ".concat(a):"").concat(null!=i&&i.includes(o)?"":" ".concat(o));super(s),hA(this,"code"),hA(this,"extraCode"),hA(this,"message"),hA(this,"originMessage"),hA(this,"name"),hA(this,"constraint"),this.code=r,this.extraCode=n,this.name=t,this.message=s,this.constraint=a,this.originMessage=i}getCode(){return this.code}getExtraCode(){return this.extraCode}toString(){return this.originMessage}},PR=xR,MR=function(){return Date.now()+0},UR=function(){let e=new Date;return e.setTime(MR()),e.toLocaleString()};lA({},{REPORT_TYPE:()=>fC,buildSSOPackage:()=>mC,bytes2ms:()=>mk,calculateScaleResolutionDownNumber:()=>dC,concatArrayBuffers:()=>gC,convertObjectNumberToInt:()=>aC,copyProperties:()=>fk,deepClone:()=>Xk,deepCloneBasic:()=>pC,deepMerge:()=>Yk,delay:()=>oC,fibonacci:()=>wk,formatedTime:()=>Qk,getConstructorName:()=>Mk,getContainerFromElement:()=>Jk,getEnv:()=>nk,getFirst16Bits:()=>_C,getInternalVersion:()=>zk,getLast16Bits:()=>vC,getLoggerUrl:()=>ok,getMediaStreamTrackInfo:()=>lC,getMuteStateFromFlag:()=>Gk,getNetworkType:()=>ck,getNumNetworkType:()=>pk,getReconnectionTimeout:()=>Ik,getStringByteLength:()=>tC,getTurnServer:()=>qk,getUint32Version:()=>nC,getValueType:()=>Tk,getViewListFromView:()=>Zk,glog:()=>yk,ipv4ToUint32:()=>Kk,isArray:()=>Ok,isAudioWorkletSupported:()=>Uk,isBoolean:()=>Ck,isConstructor:()=>Pk,isEmpty:()=>Wk,isFunction:()=>Sk,isLangChinese:()=>Ek,isMediaStreamTrack:()=>Nk,isNumber:()=>kk,isObject:()=>Dk,isOverseaSdkAppId:()=>ak,isPlainObject:()=>bk,isPortrait:()=>iC,isPromise:()=>xk,isRemoteTrack:()=>Lk,isRotate90Or270:()=>uC,isSetSinkIdSupported:()=>Fk,isString:()=>Rk,isUndefined:()=>Ak,loadImage:()=>rC,loadVideo:()=>hC,ms2bytes:()=>vk,ms2samples:()=>_k,normalizeUrl:()=>cC,performanceNow:()=>Vk,promiseAny:()=>Bk,samples2ms:()=>gk,setNetworkTypeFromWebRTC:()=>hk,stringify:()=>$k,stringifyIncludeValue:()=>eC,throttlePromise:()=>sC});var FR=function(e,t,i,r){return new(i||(i=Promise))((function(n,a){function o(e){try{c(r.next(e))}catch(t){a(t)}}function s(e){try{c(r.throw(e))}catch(t){a(t)}}function c(e){e.done?n(e.value):function(e){return e instanceof i?e:new i((function(t){t(e)}))}(e.value).then(o,s)}c((r=r.apply(e,t||[])).next())}))},BR=Symbol(32),VR=Symbol(16),HR=Symbol(8),zR=class{constructor(e){this.g=e,this.consumed=0,e&&(this.need=e.next().value)}setG(e){this.g=e,this.demand(e.next().value,!0)}consume(){this.buffer&&this.consumed&&(this.buffer.copyWithin(0,this.consumed),this.buffer=this.buffer.subarray(0,this.buffer.length-this.consumed),this.consumed=0)}demand(e,t){return t&&this.consume(),this.need=e,this.flush()}read(e){return FR(this,void 0,void 0,(function*(){return this.lastReadPromise&&(yield this.lastReadPromise),this.lastReadPromise=new Promise(((t,i)=>{var r;this.reject=i,this.resolve=e=>{delete this.lastReadPromise,delete this.resolve,delete this.need,t(e)},this.demand(e,!0)||null===(r=this.pull)||void 0===r||r.call(this,e)}))}))}readU32(){return this.read(BR)}readU16(){return this.read(VR)}readU8(){return this.read(HR)}close(){var e;this.g&&this.g.return(),this.buffer&&this.buffer.subarray(0,0),null===(e=this.reject)||void 0===e||e.call(this,new Error("EOF")),delete this.lastReadPromise}flush(){if(!this.buffer||!this.need)return;let e=null,t=this.buffer.subarray(this.consumed),i=0,r=e=>t.length<(i=e);if("number"==typeof this.need){if(r(this.need))return;e=t.subarray(0,i)}else if(this.need===BR){if(r(4))return;e=t[0]<<24|t[1]<<16|t[2]<<8|t[3]}else if(this.need===VR){if(r(2))return;e=t[0]<<8|t[1]}else if(this.need===HR){if(r(1))return;e=t[0]}else if("buffer"in this.need){if("byteOffset"in this.need){if(r(this.need.byteLength-this.need.byteOffset))return;new Uint8Array(this.need.buffer,this.need.byteOffset).set(t.subarray(0,i)),e=this.need}else if(this.g)return void this.g.throw(new Error("Unsupported type"))}else{if(r(this.need.byteLength))return;new Uint8Array(this.need).set(t.subarray(0,i)),e=this.need}return this.consumed+=i,this.g?this.demand(this.g.next(e).value,!0):this.resolve&&this.resolve(e),e}write(e){if(e instanceof Uint8Array?this.malloc(e.length).set(e):"buffer"in e?this.malloc(e.byteLength).set(new Uint8Array(e.buffer,e.byteOffset,e.byteLength)):this.malloc(e.byteLength).set(new Uint8Array(e)),!this.g&&!this.resolve)return new Promise((e=>this.pull=e));this.flush()}writeU32(e){this.malloc(4).set([e>>24&255,e>>16&255,e>>8&255,255&e]),this.flush()}writeU16(e){this.malloc(2).set([e>>8&255,255&e]),this.flush()}writeU8(e){this.malloc(1)[0]=e,this.flush()}malloc(e){if(this.buffer){let t=this.buffer.length,i=t+e;if(i<=this.buffer.buffer.byteLength-this.buffer.byteOffset)this.buffer=new Uint8Array(this.buffer.buffer,this.buffer.byteOffset,i);else{let e=new Uint8Array(i);e.set(this.buffer),this.buffer=e}return this.buffer.subarray(t,i)}return this.buffer=new Uint8Array(e),this.buffer}};zR.U32=BR,zR.U16=VR,zR.U8=HR;var jR=128;function WR(e){let t=new zR;for(;e>=128;)t.malloc(1)[0]=255&e|jR,e>>>=7;return t.malloc(1)[0]=255&e,t.buffer||new Uint8Array(0)}function GR(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=new zR,r=t<<3;switch(typeof e){case"boolean":let n=i.malloc(2);n[0]=r,n[1]=e?1:0;break;case"number":i.malloc(1)[0]=r,i.write(WR(e));break;case"string":i.malloc(1)[0]=2|r;let a=(new TextEncoder).encode(e);i.write(WR(a.length));let o=i.malloc(a.length);for(let e=0;e<a.length;e++)o[e]=a[e];break;case"object":let s=new zR;if(Array.isArray(e))for(let t=0;t<e.length;t++){let i=GR(e[t],t+1);i&&s.write(i)}else{let t=1;for(let i in e){let r=GR(e[i],t++);r&&s.write(r)}}0===t?s.buffer&&i.write(s.buffer):(i.malloc(1)[0]=2|r,s.buffer&&(i.write(WR(s.buffer.length)),i.write(s.buffer)))}return i.buffer||new Uint8Array(0)}var qR=class{constructor(){hA(this,"buffer"),this.buffer=[]}get data(){return this.buffer}get length(){return this.buffer.length}writeInt32(e){this.buffer.push(e>>>24&255),this.buffer.push(e>>>16&255),this.buffer.push(e>>>8&255),this.buffer.push(255&e)}writeInt16(e){this.buffer.push(e>>>8&255),this.buffer.push(255&e)}writeByte(e){this.buffer.push(255&e)}writeBytes(e){for(let t=0;t<e.length;t++)this.buffer.push(e[t])}};function KR(e,t,i){e[i]=t>>>24&255,e[i+1]=t>>>16&255,e[i+2]=t>>>8&255,e[i+3]=255&t}function YR(e,t){return e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3]}function XR(e,t){return e[t]}function ZR(e,t,i){return(new TextDecoder).decode(function(e,t,i){return e.slice(t,t+i)}(e,t,i))}var JR=0,QR=2654435769,$R=16,ek=2,tk=7;function ik(e,t){let i=new qR,r=function(e,t,i){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"AVQualityReportSvc.C2S";return{version:arguments.length>4&&void 0!==arguments[4]?arguments[4]:2e3,encryption:arguments.length>5&&void 0!==arguments[5]?arguments[5]:2,d2:"",d2Len:0,uinType:arguments.length>6&&void 0!==arguments[6]?arguments[6]:30,uin:"",uinLen:0,reqHead:{seqNumber:i,appId:e,appidAtThird:new Uint8Array(0),a2:"",a2Len:0,serviceCmd:r,serviceCmdLen:0,cookie:"",cookieLen:0,imei:"",imeiLen:0,ksid:"",ksidLen:0,clientVersionInfo:"",clientVersionInfoLen:0},busiBuff:t}}(t,e,JR);JR=JR+1&2147483647,i.writeInt32(0),i.writeInt32(r.version),i.writeByte(r.encryption);let n=(new TextEncoder).encode(r.d2);i.writeInt32(n.length+4),n&&i.writeBytes(n),i.writeByte(r.uinType);let a=(new TextEncoder).encode(r.uin);i.writeInt32(a.length+4),a.length&&i.writeBytes(a);let o=new qR;o.writeInt32(0),o.writeInt32(r.reqHead.seqNumber),o.writeInt32(r.reqHead.appId),o.writeByte(r.reqHead.appId>>>24&255),o.writeByte(r.reqHead.appId>>>16&255),o.writeByte(r.reqHead.appId>>>8&255),o.writeByte(255&r.reqHead.appId);for(let _=4;_<16;_++)o.writeByte(0);let s=(new TextEncoder).encode(r.reqHead.a2);o.writeInt32(s.length+4),s.length&&o.writeBytes(s);let c=(new TextEncoder).encode(r.reqHead.serviceCmd);o.writeInt32(c.length+4),c.length&&o.writeBytes(c);let l=(new TextEncoder).encode(r.reqHead.cookie);o.writeInt32(l.length+4),l.length&&o.writeBytes(l);let d=(new TextEncoder).encode(r.reqHead.imei);o.writeInt32(d.length+4),d.length&&o.writeBytes(d);let u=(new TextEncoder).encode(r.reqHead.ksid);o.writeInt32(u.length+4),u.length&&o.writeBytes(u);let h=(new TextEncoder).encode(r.reqHead.clientVersionInfo);o.writeInt16(h.length+2),h.length&&o.writeBytes(h);let p=o.length;o.data[0]=p>>>24&255,o.data[1]=p>>>16&255,o.data[2]=p>>>8&255,o.data[3]=255&p,Rk(e)&&(e=(new TextEncoder).encode(e)),o.writeInt32(e.length+4),e.length&&o.writeBytes(e);let f=new Uint8Array(o.data),m=null;1===r.encryption?m=(new TextEncoder).encode(r.uin):2===r.encryption&&(m=new Uint8Array(16)),m&&(f=function(e,t){let i=e.length,r=(i+1+ek+tk)%8;r&&(r=8-r);let n=i+1+ek+tk+r,a=new Uint8Array(n),o=0,s=new Uint8Array(8),c=new Uint8Array(8),l=new Uint8Array(8),d=0;s[0]=248&Math.floor(256*Math.random())|r,d=1;for(let h=0;h<r;h++)s[d]=255&Math.floor(256*Math.random()),d+=1;for(let h=0;h<ek;)if(d<8&&(s[d]=255&Math.floor(256*Math.random()),d+=1,h+=1),8===d){rk(s,t,c,l,a,o),o+=8,d=0;for(let e=0;e<8;e++)l[e]=a[o-8+e]}let u=0;for(;u<i;)if(d<8&&(s[d]=e[u],d+=1,u+=1),8===d){rk(s,t,c,l,a,o),o+=8,d=0;for(let e=0;e<8;e++)l[e]=a[o-8+e]}for(let h=0;h<tk;)if(d<8&&(s[d]=0,d+=1,h+=1),8===d){rk(s,t,c,l,a,o),o+=8,d=0;for(let e=0;e<8;e++)l[e]=a[o-8+e]}return a}(f,m)),i.writeBytes(f);let g=new Uint8Array(i.data),v=g.length;return g[0]=v>>>24&255,g[1]=v>>>16&255,g[2]=v>>>8&255,g[3]=255&v,g}function rk(e,t,i,r,n,a){for(let o=0;o<8;o++)e[o]^=r[o];!function(e,t,i,r){let n=YR(e,0),a=YR(e,4),o=[];for(let c=0;c<4;c++)o[c]=YR(t,4*c);let s=0;for(let c=0;c<$R;c++)s+=QR,s>>>=0,n+=(a<<4)+o[0]^a+s^(a>>>5)+o[1],n>>>=0,a+=(n<<4)+o[2]^n+s^(n>>>5)+o[3],a>>>=0;KR(i,n,r),KR(i,a,r+4)}(e,t,n,a);for(let o=0;o<8;o++)n[a+o]^=i[o];for(let o=0;o<8;o++)i[o]=e[o]}var nk=function(){return new URLSearchParams(location.search).get("trtc_env")||""},ak=e=>Number(e)<14e8,ok=function(e,t){let i;i=ak(e)?"https://apisgp.my-imcloud.com":"https://yun.tim.qq.com";let r=Math.floor(Math.random()*2**31);return"".concat(i,"/v5/AVQualityReportSvc/C2S?random=").concat(r,"&sdkappid=").concat(e,"&cmdtype=").concat(t)},sk="unknown";function ck(){!function(){var e;dk||(dk=!0,null==(e=navigator.connection)||e.addEventListener("typechange",lk))}();let{userAgent:e,connection:t}=navigator,i=(e.match(/NetType\/\S+/)||[])[0]||"";i=i.toLowerCase().replace("nettype/",""),"3gnet"===i&&(i="3g");let r=t&&t.type&&t.type.toLowerCase(),n=t&&t.effectiveType&&t.effectiveType.toLowerCase();return"slow-2"===n&&(n="2g"),r?uk(r,n):sk}function lk(){lO.warn("netType changed",ck())}var dk=!1;function uk(e,t){if(MA[e])return e;switch(e){case"cellular":case"wimax":return t||"unknown";case"ethernet":return"wired";default:return"unknown"}}function hk(e){sk=uk(e)}function pk(){return MA[ck()]}function fk(e,t){for(let i of Reflect.ownKeys(t))if("constructor"!==i&&"prototype"!==i&&"name"!==i){let r=Object.getOwnPropertyDescriptor(t,i)||"";Object.defineProperty(e,i,r)}return e}function mk(e){return gk(e/4,arguments.length>1&&void 0!==arguments[1]?arguments[1]:48e3)}function gk(e){return 1e3*e/(arguments.length>1&&void 0!==arguments[1]?arguments[1]:48e3)}function vk(e){return 4*_k(e,arguments.length>1&&void 0!==arguments[1]?arguments[1]:48e3)}function _k(e){return e*(arguments.length>1&&void 0!==arguments[1]?arguments[1]:48e3)/1e3}var yk="undefined"!=typeof window&&"function"==typeof window.glog?window.glog:()=>{},Ek=()=>{let e=navigator.language;return e=e.substring(0,2),"zh"===e},bk=function(e){if(!e||"object"!=typeof e||"[object Object]"!=Object.prototype.toString.call(e))return!1;let t=Object.getPrototypeOf(e);if(null===t)return!0;let i=Object.prototype.hasOwnProperty.call(t,"constructor")&&t.constructor;return"function"==typeof i&&i instanceof i&&Function.prototype.toString.call(i)===Function.prototype.toString.call(Object)};function wk(e){let t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;return e<=1?t:wk(e-1,t,(arguments.length>1&&void 0!==arguments[1]?arguments[1]:1)+t)}function Ik(e){return e>8?3e4:1e3*wk(e)}function Tk(e){return Reflect.apply(Object.prototype.toString,e,[]).replace(/^\[object\s(\w+)\]$/,"$1").toLowerCase()}var Sk=e=>"function"==typeof e,Ak=e=>void 0===e,Rk=e=>"string"==typeof e,kk=e=>"number"==typeof e,Ck=e=>"boolean"==typeof e,Dk=e=>"object"===Tk(e),Ok=e=>"array"===Tk(e),Nk=e=>Tk(e)==="MediaStreamTrack".toLowerCase(),Lk=e=>e.isRemote,xk=e=>"promise"===Tk(e),Pk=e=>Sk(e)&&e.prototype.constructor===e,Mk=e=>Pk(e)?e.prototype.constructor.name:"",Uk="undefined"!=typeof AudioWorkletNode,Fk="undefined"!=typeof HTMLMediaElement&&"setSinkId"in HTMLMediaElement.prototype;function Bk(e){return new Promise(((t,i)=>{let r=[];e.forEach((n=>{n.then(t).catch((t=>{r.push(t),r.length===e.length&&i(r)}))}))}))}function Vk(){return performance&&performance.now?Math.floor(performance.now()):Date.now()}var Hk=e=>+e<10?"0".concat(e):e,zk=e=>{let t=e.match(/^\d+\.\d+\.\d+/)[0];if(!t)return e;let i=t.split("."),r=Hk(i[1])+Hk(i[2]);return i[1]-15>0&&(i[1]="15"),i[2]-15>0&&(i[2]="15"),"".concat(i.join("."),".").concat(r)},jk=Object.prototype.hasOwnProperty;function Wk(e){if(null==e)return!0;if("boolean"==typeof e)return!1;if("number"==typeof e)return 0===e;if("string"==typeof e||"function"==typeof e||Array.isArray(e))return 0===e.length;if(e instanceof Error)return""===e.message;if(bk(e))switch(Object.prototype.toString.call(e)){case"[object File]":case"[object Map]":case"[object Set]":return 0===e.size;case"[object Object]":for(let t in e)if(jk.call(e,t))return!1;return!0}return!1}function Gk(e,t){return{userId:t,hasAudio:!!(8&e),hasVideo:!!(1&e),hasAuxiliary:!!(4&e),hasSmall:!!(2&e),audioMuted:!!(64&e),videoMuted:!!(16&e),audioAvailable:!(!(8&e)||64&e),videoAvailable:!(!(1&e)||16&e)}}function qk(e){let t={urls:e.url.startsWith("turn:")||e.url.startsWith("turns:")?e.url:"turn:".concat(e.url)};return!Ak(e.username)&&!Ak(e.credential)&&(t.username=e.username,t.credential=e.credential,t.credentialType="password",Ak(e.credentialType)||(t.credentialType=e.credentialType)),t}function Kk(e){let t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(!Rk(e))return 0;let i=e.split(".");return t?(Number(i[0])<<24|Number(i[1])<<16|Number(i[2])<<8|Number(i[3]))>>>0:(Number(i[3])<<24|Number(i[2])<<16|Number(i[1])<<8|Number(i[0]))>>>0}var Yk=function(e,t,i,r){if(!Dk(e)||!Dk(t))return 0;let n,a=0,o=Object.keys(t);for(let s=0,c=o.length;s<c;s++)if(n=o[s],!(Ak(t[n])||i&&i.includes(n)))if(Dk(e[n])&&Dk(t[n]))a+=Yk(e[n],t[n],i,r);else{if(r&&r.includes(t[n]))continue;e[n]!==t[n]&&(e[n]=Xk(t[n]),a+=1)}return a};function Xk(e){if(Ok(e)){let t=[];return e.forEach(((e,i)=>{t[i]=Xk(e)})),t}if(Dk(e)){let t={};return Object.keys(e).forEach((i=>{t[i]=Xk(e[i])})),t}return e}var Zk=e=>{let t=[];if(Ok(e))t=[...e];else if(Rk(e)){let i=document.getElementById(e);i&&t.push(i)}else e&&t.push(e);return t},Jk=e=>Rk(e)?document.getElementById(e):e,Qk=()=>(e=>{let t=e=>e<10?"0".concat(e):"".concat(e),i=e.getFullYear(),r=e.getMonth()+1,n=e.getDate(),a=t(e.getHours()),o=t(e.getMinutes()),s=t(e.getSeconds());return"".concat(i,"/").concat(r,"/").concat(n," ").concat(a,":").concat(o,":").concat(s)})(new Date);function $k(e,t){let{keysToInclude:i,keysToExclude:r}=t;try{if(Ok(e))return"[".concat(e.map((e=>$k(e,{keysToInclude:i,keysToExclude:r}))).join(","),"]");if(!bk(e)||!Ok(i)&&!Ok(r))return JSON.stringify(e);let t={},n=new Set(i),a=new Set(r);return Object.keys(e).forEach((o=>{(0===a.size&&n.has(o)||0===n.size&&!a.has(o))&&(t[o]=bk(e[o])||Ok(e[o])?JSON.parse($k(e[o],{keysToExclude:r,keysToInclude:i})):e[o])})),JSON.stringify(t)}catch(TA){return"{}"}}function eC(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=[];return Object.keys(e).forEach((r=>{t===e[r]&&i.push(r)})),$k(e,{keysToInclude:i})}function tC(e){return e.replace(/[\u4e00-\u9fa5]/g,"aa").length}var iC=()=>{var e,t,i,r;return null!=(e=window.screen)&&e.orientation?!(null==(r=null==(i=null==(t=window.screen)?void 0:t.orientation)?void 0:i.type)||!r.includes("portrait")):0===window.orientation||180===window.orientation},rC=async e=>new Promise(((t,i)=>{let r;if(Rk(e))r=new Image,r.crossOrigin="anonymous",r.src=e;else if(r=e,r.complete)return void t(r);r.onload=()=>t(r),r.onerror=()=>{i(new PR({code:LR.INVALID_PARAMETER,message:"load image failed, url: ".concat(e)}))}})),nC=e=>{let t=e.split(".");return+t[0]<<24|+t[1]<<16|+t[2]<<8|+t[3]},aC=e=>(Object.keys(e).forEach((t=>{kk(e[t])&&(t.startsWith("uint")||t.startsWith("int"))?e[t]=Math.floor(e[t]):(bk(e[t])||Ok(e[t]))&&aC(e[t])})),e);function oC(e,t){return new Promise((i=>{let r=setTimeout(i,e);t&&t(r)}))}function sC(e,t){let i=null;return function(){for(var r=arguments.length,n=new Array(r),a=0;a<r;a++)n[a]=arguments[a];return i||(i=e.apply(t||this,n),i.finally((()=>i=null)),i)}}function cC(e){return e.replace(/(^|[^:])\/{2,}/g,"$1/")}function lC(e){var t;try{let{width:i,height:r,frameRate:n,sampleRate:a,sampleSize:o,channelCount:s}=null==(t=e.getSettings)?void 0:t.call(e),c=e.kind===BA?"".concat(a,"x").concat(o,"@").concat(s):"".concat(i,"x").concat(r,"@").concat(n),l=e.stats?" stats: ".concat(JSON.stringify(e.stats).replaceAll('"',"")):"";return"".concat(e.id," ").concat(e.readyState," muted:").concat(e.muted," ").concat(e.kind," ").concat(e.label," ").concat(c).concat(l)}catch(Jx){return""}}function dC(e,t){return e.width*e.height==t.width*t.height?1:iC()&&t.width>t.height&&e.height>t.width?Math.max(e.width/t.height,e.height/t.width,1):Math.max(e.width/t.width,e.height/t.height,1)}function uC(e){return 90===e||270===e}async function hC(e){return new Promise(((t,i)=>{let r=document.createElement("video");r.crossOrigin="anonymous",r.src=e,r.muted=!0,r.loop=!0,r.playsInline=!0,r.play().then((()=>t(r))),r.onerror=()=>{i(r.error)}}))}function pC(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new WeakMap;if("object"!=typeof e||null===e)return e;if(t.has(e))return t.get(e);if(Array.isArray(e)){let i=[];return t.set(e,i),e.forEach(((e,r)=>{i[r]=pC(e,t)})),i}if("[object Object]"===Object.prototype.toString.call(e)){let i={};return t.set(e,i),Reflect.ownKeys(e).forEach((r=>{i[r]=pC(e[r],t)})),i}return e}var fC=(e=>(e[e.END_REPORT=2001]="END_REPORT",e[e.LOG=2002]="LOG",e[e.KEY_METRIC_REPORT=2003]="KEY_METRIC_REPORT",e))(fC||{});function mC(e,t,i,r){try{let n=function(e,t,i,r){let n={data:e,random:Math.floor(2147483648*Math.random()),sdkAppId:i};return Ak(r)||(n=oA(aA({},n),{gzip:+r})),{uint32_sdkappid:0,uint64_from_uin:0,uint32_timestamp:0,uint32_seq:0,msg_common_info:{msg_device_info:{enum_device_type:0,str_device_brand:"",str_device_model:"",str_device_board:"",str_device_cpu_abi:""},msg_system_info:{enum_os_type:0,str_os_version:"",msg_network_info:0},msg_network_info:{enum_network_type:0}},msg_report_content:{uint32_type:t,bytes_report_data:JSON.stringify(n)}}}(e,t,i,r);return ik(GR(n),i)}catch(n){return JSON.stringify(e)}}function gC(e,t){let i=new Uint8Array(e.byteLength+t.byteLength);return i.set(new Uint8Array(e),0),i.set(new Uint8Array(t),e.byteLength),i.buffer}function vC(e){return(65535&e)>>>0}function _C(e){return(4294901760&e)>>>0}function yC(e){let t=function(e){try{let t={},i=0;t.totalLength=YR(e,i),i+=4,t.version=YR(e,i),i+=4,t.encryption=XR(e,i),i+=1,t.uinType=XR(e,i),i+=1,t.uinLength=YR(e,i),i+=4,t.uin=t.uinLength>4?ZR(e,i,t.uinLength-4):"",i+=t.uinLength-4;let r=e.slice(i);if(2===t.encryption){e=function(e,t){let i=0,r=new Uint8Array(8).fill(0),n=new Uint8Array(e.slice(0,8)),a=EC(n,t),o=7&a[0],s=e.length-1-o-ek-tk,c=new Uint8Array(s),l=0,d=r,u=e.slice(0,8);i=8;let h=1;h+=o;for(let f=1;f<=ek;)if(h<8)h++,f++;else if(8===h){let r=bC(e,i,d,u,a,t);d=r.ivPreCrypt,u=r.ivCurCrypt,a=r.debiBuf,i=r.bufPos,h=0}let p=s;for(;p>0;)if(h<8)c[l++]=a[h]^d[h],h++,p--;else if(8===h){let r=bC(e,i,d,u,a,t);d=r.ivPreCrypt,u=r.ivCurCrypt,a=r.debiBuf,i=r.bufPos,h=0}for(let f=1;f<=tk;)if(h<8)a[h],d[h],h++,f++;else if(8===h){if(i>=e.length)break;let r=bC(e,i,d,u,a,t);if(!r.success)break;d=r.ivPreCrypt,u=r.ivCurCrypt,a=r.debiBuf,i=r.bufPos,h=0}return c}(r,new Uint8Array(16).fill(0)),t.decrypted=!0,i=0}else e=r,i=0;return t.rspHeadLength=YR(e,i),i+=4,t.seqNo=YR(e,i),i+=4,t.retCode=YR(e,i),i+=4,t.retStrLength=YR(e,i),i+=4,t.retStr=t.retStrLength?ZR(e,i,t.retStrLength-4):"",i+=t.retStrLength-4,t.serviceCmdLength=YR(e,i),i+=4,t.serviceCmd=t.serviceCmdLength?ZR(e,i,t.serviceCmdLength-4):"",i+=t.serviceCmdLength-4,t.cookieLength=YR(e,i),i+=4,t.cookie=t.cookieLength?ZR(e,i,t.cookieLength-4):"",i+=t.cookieLength-4,t.flag=YR(e,i),i+=4,t.busiBuffLength=YR(e,i),i+=4,t.busiBuff=t.busiBuffLength?ZR(e,i,t.busiBuffLength-4):"",i+=t.busiBuffLength-4,t}catch(t){}}(e);return null==t?void 0:t.busiBuff}function EC(e,t){let i=e[0]<<24|e[1]<<16|e[2]<<8|e[3],r=e[4]<<24|e[5]<<16|e[6]<<8|e[7];i>>>=0,r>>>=0;let n=QR*$R>>>0;for(let a=0;a<$R;a++)r-=(i<<4)+t[2]^i+n^(i>>>5)+t[3],r>>>=0,i-=(r<<4)+t[0]^r+n^(r>>>5)+t[1],i>>>=0,n-=QR,n>>>=0;return new Uint8Array([i>>>24&255,i>>>16&255,i>>>8&255,255&i,r>>>24&255,r>>>16&255,r>>>8&255,255&r])}function bC(e,t,i,r,n,a){if(t+8>e.length)return{success:!1};let o=new Uint8Array(r),s=e.slice(t,t+8),c=new Uint8Array(8);for(let l=0;l<8;l++)c[l]=n[l]^s[l];return{success:!0,ivPreCrypt:o,ivCurCrypt:s,debiBuf:EC(c,a),bufPos:t+8}}var wC="undefined"!=typeof TextDecoder?new TextDecoder:void 0;function IC(e){let{url:t,body:i,method:r="POST",timeout:n,priority:a}=e;return new Promise(((e,o)=>{if("fetch"in window)return fetch(t,{method:r,body:i,priority:a}).then((e=>e.clone().json().then((e=>({data:e})),(()=>e.arrayBuffer().then((e=>({data:yC(new Uint8Array(e))||(wC?wC.decode(e):e)}))))))).then(e,o);let s=new XMLHttpRequest;s.onreadystatechange=()=>{if(4===s.readyState)if(s.status>=200&&s.status<300)try{let t=JSON.parse(s.response);e({data:t})}catch(t){e({data:s.response})}else o({status:s.status,statusText:s.statusText||"request failed!"})},s.timeout=n||5e3,s.open(r,t,!0),s.send(i)}))}var TC=Object.prototype.hasOwnProperty,SC=e=>"function"==typeof e,AC=e=>void 0===e,RC=e=>e.isRemote;function kC(e){if(null==e)return!0;if("boolean"==typeof e)return!1;if("number"==typeof e)return 0===e;if("string"==typeof e||"function"==typeof e||Array.isArray(e))return 0===e.length;if(e instanceof Error)return""===e.message;if(function(e){if(!e||"object"!=typeof e||"[object Object]"!=Object.prototype.toString.call(e))return!1;let t=Object.getPrototypeOf(e);if(null===t)return!0;let i=Object.prototype.hasOwnProperty.call(t,"constructor")&&t.constructor;return"function"==typeof i&&i instanceof i&&Function.prototype.toString.call(i)===Function.prototype.toString.call(Object)}(e))switch(Object.prototype.toString.call(e)){case"[object File]":case"[object Map]":case"[object Set]":return 0===e.size;case"[object Object]":for(let t in e)if(TC.call(e,t))return!1;return!0}return!1}var CC=function(e){let{retryFunction:t,settings:i,onError:r,onRetrying:n,onRetryFailed:a,onRetrySuccess:o,context:s}=e;return function(){for(var e=arguments.length,c=new Array(e),l=0;l<e;l++)c[l]=arguments[l];let{retries:d=5,timeout:u=1e3}=i,h=0,p=-1,f=0,m=async(e,i)=>{let l=s||this;try{let i=await t.apply(l,c);h>0&&o&&o.call(this,h),h=0,e(i)}catch(g){let t=()=>{clearTimeout(p),h=0,f=2,i(g)},o=()=>{2!==f&&h<(SC(d)?d():d)?(h++,f=1,SC(n)&&n.call(this,h,t),p=window.setTimeout((()=>{p=-1,m(e,i)}),SC(u)?u(h):u)):(t(),SC(a)&&a.call(this,g))};SC(r)?r.call(this,{error:g,retry:o,reject:i,retryFuncArgs:c,retriedCount:h}):o()}};return new Promise(m)}},DC=class e{constructor(e){hA(this,"_parentPath"),hA(this,"userId"),hA(this,"remoteUserId"),hA(this,"id"),hA(this,"sdkAppId"),hA(this,"type"),hA(this,"isLocal"),this.id=e.id,this.userId=e.userId,this.sdkAppId=e.sdkAppId,this.remoteUserId=e.remoteUserId,this.isLocal=!(e=>"boolean"==typeof e)(e.isLocal)||e.isLocal,this.type=this.isLocal?"":e.type}getFullId(){return this._parentPath&&this.id?"".concat(this._parentPath,"-").concat(this.id):this._parentPath?this._parentPath:this.id}createChild(t){let i=new e({id:t.id,userId:AC(t.userId)?this.userId:t.userId,sdkAppId:AC(t.sdkAppId)?this.sdkAppId:t.sdkAppId,type:AC(t.type)?this.type:t.type,isLocal:AC(t.isLocal)?this.isLocal:t.isLocal,remoteUserId:AC(t.remoteUserId)?this.remoteUserId:t.remoteUserId});return i.bindParent(this),i}bindParent(e){let t=e.getFullId();this._parentPath!==t&&(this.debug("bind logger parent: ".concat(e.id)),this._parentPath=t,this.userId=e.userId||this.userId,this.sdkAppId=e.sdkAppId||this.sdkAppId)}setUserId(e){this.userId=e}setSdkAppId(e){this.sdkAppId=e}log(e,t){let i=this.isLocal?this.userId:this.remoteUserId,r=this.getFullId();t.unshift("[".concat(this.isLocal?"↑":"↓").concat(this.type&&"main"!==this.type?"*":"").concat(r).concat(i?"|".concat(i):"","]")),lO.log(e,t,AC(this.userId)||kC(this.userId),this.userId,this.sdkAppId)}info(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];this.log(2,t)}debug(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];this.log(1,t)}warn(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];this.log(3,t)}error(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];this.log(4,t)}},OC="undefined"==typeof navigator?"":navigator.userAgent,NC=e=>new RegExp(e,"i").test(OC),LC=e=>{if(NC(e)){let t=new RegExp("".concat(e,"\\/([\\d.]+)")),i=OC.match(t);if(i&&i[1])return i[1]}return""},xC=e=>{if(NC(e)){let t=new RegExp("".concat(e,"\\/(\\d+)")),i=OC.match(t);if(i&&i[1])return parseFloat(i[1])}return NaN},PC=/AppleWebKit\/([\d.]+)/i.exec(OC);PC&&parseFloat(PC[1]);var MC=NC("iPad"),UC="undefined"!=typeof navigator&&navigator.maxTouchPoints&&navigator.maxTouchPoints>2&&NC("Macintosh"),FC=NC("iPhone")&&!MC,BC=NC("iPod"),VC=FC||MC||BC||UC,HC=()=>{try{return VC&&navigator.maxTouchPoints>1&&navigator.vendor.includes("Apple")}catch(KS){return VC}},zC=NC("Android"),jC=function(){if(zC){let e=OC.match(/Android (\d+)(?:\.(\d+))?(?:\.(\d+))*/i);if(e){let t=e[1]&&parseFloat(e[1]),i=e[2]&&parseFloat(e[2]);if(t&&i)return parseFloat("".concat(e[1],".").concat(e[2]));if(t)return t}}return NaN}();zC&&NC("webkit");var WC=NC("Firefox"),GC=LC("Firefox"),qC=xC("Firefox"),KC=NC("Edge"),YC=LC("Edge"),XC=NC("Edg"),ZC=LC("Edg"),JC=xC("Edg"),QC=NC("SogouMobileBrowser"),$C=LC("SogouMobileBrowser"),eD=NC("MetaSr\\s"),tD=LC("MetaSr\\s"),iD=NC("TBS"),rD=LC("TBS"),nD=NC("XWEB"),aD=LC("XWEB");NC("MSIE\\s8\\.0");var oD=NC("MSIE\\/\\d+");!function(){if(oD){let e=/MSIE\s(\d+)\.\d/.exec(OC),t=e&&parseFloat(e[1]);return!t&&/Trident\/7.0/i.test(OC)&&/rv:11.0/.test(OC)&&(t=11),t}}();var sD=NC("(micromessenger|webbrowser)"),cD=LC("MicroMessenger"),lD=!iD&&NC("MQQBrowser")&&NC("COVC"),dD=!iD&&NC("MQQBrowser")&&!NC("COVC"),uD=dD||lD?LC("MQQBrowser"):"",hD=!iD&&NC(" QQBrowser"),pD=LC(" QQBrowser"),fD=!iD&&NC("QQBrowserLite"),mD=LC("QQBrowserLite"),gD=!iD&&NC("MQBHD"),vD=LC("MQBHD"),_D=NC("Windows"),yD=!VC&&NC("MAC OS X"),ED=!zC&&NC("Linux"),bD=NC("CrOS");NC("MicroMessenger");var wD=NC("UCBrowser");NC("Electron");var ID=NC("MiuiBrowser"),TD=LC("MiuiBrowser"),SD=NC("HuaweiBrowser"),AD=NC("Huawei")||NC("HUAWEI"),RD=NC("Honor")||NC("HONOR"),kD=LC("HuaweiBrowser"),CD=NC("SamsungBrowser"),DD=LC("SamsungBrowser"),OD=NC("HeyTapBrowser"),ND=LC("HeyTapBrowser"),LD=NC("VivoBrowser"),xD=LC("VivoBrowser"),PD=NC("OpenHarmony");LC("OpenHarmony");var MD=()=>xC("Chrome"),UD=NC("CriOS"),FD=NC("Chrome"),BD=!KC&&!eD&&!QC&&!iD&&!nD&&!XC&&!hD&&!ID&&!SD&&!CD&&!OD&&!LD&&FD,VD=NC("HeadlessChrome"),HD=MD(),zD=LC("Chrome");xC("Electron");var jD=!FD&&!dD&&!lD&&!fD&&!gD&&NC("Safari"),WD=jD||VC,GD=LC("Version");/Android.*(wv|.0.0.0)/.test(OC);var qD=(()=>{if(UC)return GD;if(VC){let e=OC.match(/OS (\d+)_(\d+)/i);if(e&&e[1]){let t=e[1];return e[2]&&(t+=".".concat(e[2])),t}}return""})();var KD=Number(qD.split(".")[0]),YD="15.1"===qD,XD=(()=>{let e=Number(qD.split(".")[0]);return 14===e||13===e})(),ZD=UD&&"11.1.1"===GD,JD="undefined"!=typeof location&&("file:"===location.protocol||"localhost"===location.hostname||"127.0.0.1"===location.hostname),QD=(()=>{let e;return()=>{if(void 0===e)try{e=!!window.localStorage}catch(t){e=!1}return e}})(),$D=function(){let e=new Map([[WC,["Firefox",GC]],[XC,["Edg",ZC]],[BD,["Chrome",zD]],[UD,["ChiOS",LC("CriOS")]],[jD&&!UD,["Safari",GD]],[iD,["TBS",rD]],[nD,["XWEB",aD]],[sD&&FC,["WeChat",cD]],[hD,["QQ(Win)",pD]],[dD,["QQ(Mobile)",uD]],[lD,["QQ(Mobile X5)",uD]],[fD,["QQ(Mac)",mD]],[gD,["QQ(iPad)",vD]],[ID,["MI",TD]],[SD,["HW",kD]],[CD,["Samsung",DD]],[OD,["OPPO",ND]],[LD,["VIVO",xD]],[KC,["EDGE",YC]],[QC,["SogouMobile",$C]],[eD,["Sogou",tD]]]),t="unknown",i="unknown";return e.has(!0)&&([t,i]=e.get(!0)),{name:t,version:i}}();function eO(){return function(){let e=/;\s*([^;)]+)\s+Build\//,t=OC.match(e);return null!=t&&t[1]?t[1].trim():null}()||""}var tO=new Map([[zC,"Android"],[VC,"iOS"],[_D,"Windows"],[yD,"MacOS"],[ED,"Linux"],[bD,"ChromeOS"]]),iO=function(){return tO.get(!0)?tO.get(!0):"unknown"};function rO(){return _D?1:zC?2:yD?3:VC?4:ED?5:bD?6:PD?7:0}var nO=()=>{let e=iO();return VC?e+="/".concat(qD):zC&&(e+="/".concat(jC)),e+="/".concat($D.name,"/").concat(jD&&!UD?$D.version:$D.version.split(".")[0]),e},aO=new(dA(fA(),1).default),oO=yA,sO=new class{constructor(){hA(this,"enable",!1),hA(this,"ssoFailCount",0),aO.on("22",(e=>{let{schedule:t}=e;var i;null!=(i=null==t?void 0:t.config)&&i.sso&&aO.emit("266",{enable:!0})})),aO.on("266",(e=>{let{enable:t}=e;this.enable=t}))}handleUploadFailed(){this.ssoFailCount++,this.ssoFailCount>3&&aO.emit("266",{enable:!1})}},cO=class e{constructor(){hA(this,"_isEnableUploadLog",!0),hA(this,"_localJoinedUser",new Map),hA(this,"_queue",[]),hA(this,"_timeoutId",-1),hA(this,"_logLevel",1),hA(this,"_logLevelToUpload",2),!kA&&!CA&&(this.checkURLParam(),this.installEvents())}get isAbleToUpload(){return this._isEnableUploadLog&&-1!==this._timeoutId}installEvents(){aO.on(oO.JOIN_SCHEDULE_SUCCESS,(e=>{let{schedule:t}=e;var i;null!=(i=null==t?void 0:t.config)&&i.logLevelToUpload&&PA[t.config.logLevelToUpload]&&(this._logLevelToUpload=t.config.logLevelToUpload)})),aO.on(oO.JOIN_START,(e=>{let{params:t}=e;this.addJoinedUser({userId:t.userId,sdkAppId:t.sdkAppId}),this.startUpload()})),aO.on(oO.LEAVE_SUCCESS,(e=>{let{room:t}=e;this.deleteJoinedUser(t.userId)}))}startUpload(){-1===this._timeoutId&&this.uploadInterval()}addJoinedUser(e){this._localJoinedUser.set(e.userId,e),this.startUpload()}deleteJoinedUser(e){this._localJoinedUser.delete(e)}uploadInterval(){this.upload().catch((()=>{})),this._timeoutId=window.setTimeout((()=>this.uploadInterval()),5e3)}getLogsToUpload(){let e={map:new Map,splicedQueue:[]};if(this._queue[0].forAllJoinedClients&&0===this._localJoinedUser.size)return e;let t=0;for(;t<this._queue.length&&50!==t;t++){let i=this._queue[t];if(i.forAllJoinedClients)this._localJoinedUser.forEach((t=>{let{userId:r,sdkAppId:n}=t;e.map.has(r)?e.map.get(r).logs.push(i):e.map.set(r,{userId:r,sdkAppId:n,logs:[i]})}));else if(Rk(i.userId)&&kk(i.sdkAppId)){let{userId:t,sdkAppId:r}=i;e.map.has(t)?e.map.get(t).logs.push(i):e.map.set(t,{userId:t,sdkAppId:r,logs:[i]})}}return e.map.size>0&&(e.splicedQueue=this._queue.splice(0,t)),e}async upload(){if(0===this._queue.length||!this._isEnableUploadLog)return;let{map:e,splicedQueue:t}=this.getLogsToUpload();if(0===e.size)return;try{let t=[...e.values()];for(let e=0;e<t.length;e++){let{userId:i,sdkAppId:r,logs:n}=t[e],a={timestamp:UR(),sdkAppId:String(r),userId:i,version:RA,log:n.map((e=>e.log)).join("\n")},o=JSON.stringify(a),s=sO.enable?mC(a,2002,r):o;await this.uploadLogWithRetry(s,r,s instanceof Uint8Array,o),n.forEach((e=>e.uploaded=!0))}}catch(r){}let i=t.filter((e=>!e.uploaded));i.length>0&&(this._queue=i.concat(this._queue))}uploadLogWithRetry(e,t,i,r){return CC({retryFunction:()=>IC({url:ok(t,LA),body:e,timeout:5e3,priority:"low"}).then((e=>{i&&"ok"!==e.data&&(sO.handleUploadFailed(),this.uploadLogWithRetry(r,t,!1,r))})),settings:{retries:3,timeout:2e3},onError:e=>{let{retry:t}=e;t()}})()}getPrefix(e){let t=new Date;return t.setTime(MR()),"[".concat(function(e){let t=String(e.getMilliseconds());return"padStart"in String.prototype&&(t=t.toString().padStart(3,"0")),"".concat(e.toTimeString().replace(/.*(\d{2}:\d{2}:\d{2}).*/,"$1"),":").concat(t)}(t),"] <").concat(PA[e],">")}getLogLevel(){return this._logLevel}setLogLevel(e){Ak(PA[e])||(this._logLevel!==e&&this.info("setLogLevel",e),this._logLevel=e)}enableUploadLog(){this._isEnableUploadLog=!0}disableUploadLog(){this.warn("disableUploadLog"),this._isEnableUploadLog=!1}logChunkToString(e){if(Rk(e))return e;try{return e instanceof Error?e.toString():JSON.stringify(e)}catch(Jx){return""}}addLogToQueue(e,t){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],r=arguments.length>3?arguments[3]:void 0,n=arguments.length>4?arguments[4]:void 0,a={log:t.reduce(((e,t)=>"".concat(e," ").concat(this.logChunkToString(t)).trim()),""),level:e,userId:r,sdkAppId:n,forAllJoinedClients:i};aO.emit(oO.LOG,{log:a}),this._isEnableUploadLog&&e>=this._logLevelToUpload&&this._queue.push(a)}log(t,i){let r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],n=arguments.length>3?arguments[3]:void 0,a=arguments.length>4?arguments[4]:void 0;var o;if(i.unshift(this.getPrefix(t)),this.addLogToQueue(t,i,r,n,a),t<this._logLevel)return;let s=(null==(o=PA[t])?void 0:o.toLowerCase())||"info";e.PRINT_LOG_TAG?console[s]("%cTRTC%c%s","padding: 1px 4px;border-radius: 3px;color: #fff;background: #1E88E5;","display: inline",...i):console[s](...i)}debug(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];this.log(1,t)}info(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];this.log(2,t)}warn(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];this.log(3,t)}error(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];this.log(4,t)}createLogger(e){if(e.parent instanceof DC){let t=e,{parent:i}=t,r=((e,t)=>{var i={};for(var r in e)iA.call(e,r)&&t.indexOf(r)<0&&(i[r]=e[r]);if(null!=e&&eA)for(var r of eA(e))t.indexOf(r)<0&&rA.call(e,r)&&(i[r]=e[r]);return i})(t,["parent"]),n=new DC(r);return n.bindParent(i),n}return new DC(e)}checkURLParam(){let e=new URLSearchParams(location.search).get("logLevelToUpload"),t=e?Number(e):-1;PA[t]&&(this._logLevelToUpload=t)}getQueue(){return this._queue}};hA(cO,"PRINT_LOG_TAG",!(VC||zC||VD));var lO=new cO,dO=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(e=>{let t=16*Math.random()|0;return("x"==e?t:3&t|8).toString(16)}))},uO=new class{constructor(){hA(this,"_prefix","TRTC"),hA(this,"_queue",new Map)}getRealKey(e){return"".concat(this._prefix,"_").concat(e)}checkStorage(){QD()&&(setInterval(this.doFlush.bind(this),2e4),Object.keys(localStorage).filter((e=>{if(e.startsWith(this._prefix))try{let t=localStorage.getItem(e);if(!t)return!1;let i=JSON.parse(t);if(i&&i.expiresIn<Date.now())return!0}catch(t){return!1}return!1})).forEach((e=>localStorage.removeItem(e))))}doFlush(){if(QD())try{for(let[e,t]of this._queue)localStorage.setItem(e,JSON.stringify(t))}catch(e){lO.warn(e)}}getItem(e){if(!QD())return null;try{let t=localStorage.getItem(this.getRealKey(e));if(!t)return null;let i=JSON.parse(t);return i&&i.expiresIn>=Date.now()?i.value:null}catch(Jx){lO.warn(Jx)}}setItem(e,t){if(QD())try{let i={expiresIn:Date.now()+6048e5,value:t};this._queue.set(this.getRealKey(e),i)}catch(TA){lO.warn(TA)}}deleteItem(e){if(!QD())return!1;try{return e=this.getRealKey(e),this._queue.delete(e),localStorage.removeItem(e),!0}catch(Jx){return lO.warn(Jx),!1}}clear(){if(QD())try{localStorage.clear()}catch(e){lO.warn(e)}}};lA({},{HTTPS_API:()=>HO,IS_GET_CAPABILITIES_FROM_INPUTDEVICE_SUPPORTED:()=>lN,IS_GET_CAPABILITIES_SUPPORTED:()=>cN,IS_GET_SETTINGS_SUPPORTED:()=>sN,IS_GET_SYNCHRONIZATION_SOURCES_SUPPORTED:()=>oN,IS_INSERTABLE_STREAM_SUPPORTED:()=>dN,IS_JITTER_BUFFER_TARGET_SUPPORTED:()=>IN,IS_RTC_RTP_SENDER_SUPPORTED:()=>rN,IS_SCRIPT_TRANSFORM_SUPPORTED:()=>uN,IS_SEI_SUPPORTED:()=>hN,IS_SPC_SUPPORTED:()=>tN,basis:()=>_N,capabilityCheck:()=>bN,checkSystemRequirementsInternal:()=>PO,decodeSupportStatus:()=>xO,detectVideoCodecCapabilities:()=>AN,detectVideoDecoderCapabilities:()=>kN,detectVideoEncoderCapabilities:()=>RN,encodeSupportStatus:()=>LO,getBrowserInfo:()=>SO,getDisplayResolution:()=>jO,getH264ProfileLevelIds:()=>CN,isAddTransceiverSupported:()=>eN,isBrowserSupported:()=>AO,isCanvasCaptureStreamAPISupported:()=>qO,isCanvasSmallStreamSupported:()=>KO,isGetReceiversSupported:()=>JO,isGetSendersSupported:()=>QO,isGetTransceiversSupported:()=>$O,isGetUserMediaSupported:()=>WO,isMediaDevicesSupported:()=>kO,isMediaSessionSupported:()=>mN,isMediaStreamTrackGeneratorSupported:()=>NO,isMediaStreamTrackProcessorSupported:()=>OO,isReplaceTrackSupported:()=>nN,isRequestVideoFrameCallbackSupported:()=>wN,isSIMDSupported:()=>vN,isScaleResolutionDownBySupported:()=>YO,isScreenCaptureApiAvailable:()=>UO,isSelectedCandidatePair:()=>zO,isSetParametersSupported:()=>aN,isSetSinkIdSupported:()=>FO,isSmallStreamSupported:()=>XO,isStopTransceiverSupported:()=>iN,isTRTCSupported:()=>MO,isUnifiedPlanDefault:()=>ZO,isUsedInHttpProtocol:()=>DO,isWebAudioSupported:()=>GO,isWebCodecSupported:()=>fN,isWebCodecsSupported:()=>RO,isWebRTCSupported:()=>pN,isWebTransportSupported:()=>gN});var hO={AVOID_REPEATED_CALL:"AVOID_REPEATED_CALL",INVALID_PARAMETER_REQUIRED:"INVALID_PARAMETER_REQUIRED",INVALID_PARAMETER_TYPE:"INVALID_PARAMETER_TYPE",INVALID_PARAMETER_EMPTY:"INVALID_PARAMETER_EMPTY",INVALID_PARAMETER_INSTANCE:"INVALID_PARAMETER_INSTANCE",INVALID_PARAMETER_RANGE:"INVALID_PARAMETER_RANGE",INVALID_PARAMETER_MIN:"INVALID_PARAMETER_MIN",INVALID_PARAMETER_MAX:"INVALID_PARAMETER_MAX",INVALID_PARAMETER_STREAMTYPE:"INVALID_PARAMETER_STREAMTYPE",API_CALL_TIMEOUT:"API_CALL_TIMEOUT",SIGNAL_CHANNEL_RECONNECTION_FAILED:"SIGNAL_CHANNEL_RECONNECTION_FAILED",SIGNAL_CHANNEL_SETUP_FAILED:"SIGNAL_CHANNEL_SETUP_FAILED",ERROR_MESSAGE:"ERROR_MESSAGE",EXCHANGE_SDP_TIMEOUT:"EXCHANGE_SDP_TIMEOUT",DOWNLINK_RECONNECTION_FAILED:"DOWNLINK_RECONNECTION_FAILED",EXCHANGE_SDP_FAILED:"EXCHANGE_SDP_FAILED",UPDATE_OFFER_TIMEOUT:"UPDATE_OFFER_TIMEOUT",UPLINK_RECONNECTION_FAILED:"UPLINK_RECONNECTION_FAILED",INVALID_RECORDID:"INVALID_RECORDID",INVALID_PURE_AUDIO:"INVALID_PURE_AUDIO",INVALID_STREAMID:"INVALID_STREAMID",INVALID_USER_DEFINE_RECORDID:"INVALID_USER_DEFINE_RECORDID",INVALID_USER_DEFINE_PUSH_ARGS:"INVALID_USER_DEFINE_PUSH_ARGS",INVALID_PROXY:"INVALID_PROXY",INVALID_JOIN:"INVALID_JOIN",INVALID_ROOMID_STRING:"INVALID_ROOMID_STRING",INVALID_ROOMID_INTEGER:"INVALID_ROOMID_INTEGER",INVALID_SIGNAL_CHANNEL:"INVALID_SIGNAL_CHANNEL",JOIN_ROOM_TIMEOUT:"JOIN_ROOM_TIMEOUT",JOIN_ROOM_FAILED:"JOIN_ROOM_FAILED",REJOIN_ROOM_FAILED:"REJOIN_ROOM_FAILED",INVALID_DESTROY:"INVALID_DESTROY",INVALID_PUBLISH:"INVALID_PUBLISH",INVALID_UNPUBLISH:"INVALID_UNPUBLISH",INVALID_AUDIENCE:"INVALID_AUDIENCE",INVALID_INITIALIZE:"INVALID_INITIALIZE",INVALID_DUPLICATE_PUBLISHING:"INVALID_DUPLICATE_PUBLISHING",INVALID_SUBSCRIBE_UNDEFINED:"INVALID_SUBSCRIBE_UNDEFINED",INVALID_SUBSCRIBE_LOCAL:"INVALID_SUBSCRIBE_LOCAL",INVALID_REMOTE_STREAM:"INVALID_REMOTE_STREAM",SUBSCRIBE_FAILED:"SUBSCRIBE_FAILED",INVALID_ROLE:"INVALID_ROLE",INVALID_PARAMETER_SWITCH_ROLE:"INVALID_PARAMETER_SWITCH_ROLE",INVALID_OPERATION_SWITCH_ROLE:"INVALID_OPERATION_SWITCH_ROLE",SWITCH_ROLE_TIMEOUT:"SWITCH_ROLE_TIMEOUT",SWITCH_ROLE_FAILED:"SWITCH_ROLE_FAILED",CLIENT_BANNED:"CLIENT_BANNED",INVALID_OPERATION_START_PUBLISH_CDN:"INVALID_OPERATION_START_PUBLISH_CDN",INVALID_OPERATION_STOP_PUBLISH_CDN:"INVALID_OPERATION_STOP_PUBLISH_CDN",INVALID_STREAM_ID:"INVALID_STREAM_ID",START_PUBLISH_CDN_FAILED:"START_PUBLISH_CDN_FAILED",STOP_PUBLISH_CDN_FAILED:"STOP_PUBLISH_CDN_FAILED",START_MIX_TRANSCODE:"START_MIX_TRANSCODE",STOP_MIX_TRANSCODE:"STOP_MIX_TRANSCODE",INVALID_AUDIO_VOLUME:"INVALID_AUDIO_VOLUME",ENABLE_SMALL_STREAM_PUBLISHED:"ENABLE_SMALL_STREAM_PUBLISHED",DISABLE_SMALL_STREAM_PUBLISHED:"DISABLE_SMALL_STREAM_PUBLISHED",NOT_SUPPORTED_SMALL_STREAM:"NOT_SUPPORTED_SMALL_STREAM",INVALID_SMALL_STREAM_PROFILE:"INVALID_SMALL_STREAM_PROFILE",INVALID_PARAMETER_REMOTE_STREAM:"INVALID_PARAMETER_REMOTE_STREAM",INVALID_OPERATION_CHANGE_SMALL:"INVALID_OPERATION_CHANGE_SMALL",REMOTE_NOT_PUBLISH_SMALL_STREAM:"REMOTE_NOT_PUBLISH_SMALL_STREAM",INVALID_SWITCH_DEVICE:"INVALID_SWITCH_DEVICE",INVALID_SWITCH_DEVICE_PUBLISHING:"INVALID_SWITCH_DEVICE_PUBLISHING",INVALID_REPLACE_TRACK:"INVALID_REPLACE_TRACK",INVALID_INITIALIZE_LOCAL_STREAM:"INVALID_INITIALIZE_LOCAL_STREAM",INVALID_ADD_TRACK_REPETITIVE:"INVALID_ADD_TRACK_REPETITIVE",INVALID_ADD_TRACK_REMOVING:"INVALID_ADD_TRACK_REMOVING",INVALID_ADD_TRACK_PUBLISHING:"INVALID_ADD_TRACK_PUBLISHING",INVALID_STREAM_INITIALIZED:"INVALID_STREAM_INITIALIZED",INVALID_ADD_TRACK_NUMBER:"INVALID_ADD_TRACK_NUMBER",INVALID_REMOVE_AUDIO_TRACK:"INVALID_REMOVE_AUDIO_TRACK",INVALID_REMOVE_AUDIO_ADDING:"INVALID_REMOVE_AUDIO_ADDING",INVALID_REMOVE_AUDIO_ON:"INVALID_REMOVE_AUDIO_ON",INVALID_REMOVE_TRACK_PUBLISHING:"INVALID_REMOVE_TRACK_PUBLISHING",INVALID_REMOVE_TRACK_NOT_TRACK:"INVALID_REMOVE_TRACK_NOT_TRACK",INVALID_REMOVE_TRACK_NUMBER:"INVALID_REMOVE_TRACK_NUMBER",INVALID_REPLACE_TRACK_NO_TRACK:"INVALID_REPLACE_TRACK_NO_TRACK",REPEAT_JOIN:"REPEAT_JOIN",CLIENT_DESTROYED:"CLIENT_DESTROYED",NOT_BUG_PACKAGE:"NOT_BUG_PACKAGE",START_MIX_TRANSCODE_FAILED:"START_MIX_TRANSCODE_FAILED",STOP_MIX_TRANSCODE_FAILED:"STOP_MIX_TRANSCODE_FAILED",MIX_TRANSCODE_NOT_STARTED:"MIX_TRANSCODE_NOT_STARTED",CANNOT_LESS_THAN_ZERO:"CANNOT_LESS_THAN_ZERO",MIX_PARAMS_VIDEO_FRAMERATE:"MIX_PARAMS_VIDEO_FRAMERATE",MIX_PARAMS_VIDEO_GOP:"MIX_PARAMS_VIDEO_GOP",MIX_PARAMS_AUDIO_BITRATE:"MIX_PARAMS_AUDIO_BITRATE",MIX_PARAMS_USER_Z_ORDER:"MIX_PARAMS_USER_Z_ORDER",MIX_PARAMS_NOT_SELF:"MIX_PARAMS_NOT_SELF",MIX_PARAMS_USER_STREAM:"MIX_PARAMS_USER_STREAM",INVALID_PLAY:"INVALID_PLAY",INVALID_ELEMENT_ID:"INVALID_ELEMENT_ID",INVALID_ELEMENT_ID_TYPE:"INVALID_ELEMENT_ID_TYPE",PLAY_FAILED:"PLAY_FAILED",INVALID_USERID:"INVALID_USERID",INVALID_CREATE_STREAM_SOURCE:"INVALID_CREATE_STREAM_SOURCE",INVALID_CREATE_STREAM_SCREEN:"INVALID_CREATE_STREAM_SCREEN",INVALID_CREATE_STREAM_AUDIO:"INVALID_CREATE_STREAM_AUDIO",INVALID_CREATE_STREAM_SCREEN_AUDIO:"INVALID_CREATE_STREAM_SCREEN_AUDIO",NOT_SUPPORTED_HTTP:"NOT_SUPPORTED_HTTP",NOT_SUPPORTED_WEBRTC:"NOT_SUPPORTED_WEBRTC",NOT_SUPPORTED_PROFILE:"NOT_SUPPORTED_PROFILE",NOT_SUPPORTED_MEDIA:"NOT_SUPPORTED_MEDIA",NOT_SUPPORTED_H264ENCODE:"NOT_SUPPORTED_H264ENCODE",NOT_SUPPORTED_H264DECODE:"NOT_SUPPORTED_H264DECODE",NOT_SUPPORTED_TRACK:"NOT_SUPPORTED_TRACK",NOT_SUPPORTED_SWITCH_DEVICE:"NOT_SUPPORTED_SWITCH_DEVICE",NOT_SUPPORTED_CAPTURE:"NOT_SUPPORTED_CAPTURE",NOT_SUPPORTED_AUX:"NOT_SUPPORTED_AUX",MICROPHONE_NOT_FOUND:"MICROPHONE_NOT_FOUND",CAMERA_NOT_FOUND:"CAMERA_NOT_FOUND",SIGNAL_RESPONSE_FAILED:"SIGNAL_RESPONSE_FAILED",CATCH_HANDLER_ERROR:"CATCH_HANDLER_ERROR",API_NOT_EXIST:"API_NOT_EXIST",CONNECTION_CLOSED:"CONNECTION_CLOSED",SUBSCRIBE_ALL_FALSE:"SUBSCRIBE_ALL_FALSE",SEI_NOT_SUPPORT:"SEI_NOT_SUPPORT",SEI_DISABLED:"SEI_DISABLED",SEI_BEFORE_PUBLISH:"SEI_BEFORE_PUBLISH",SEI_NOT_VIDEO:"SEI_NOT_VIDEO",CALL_FREQUENCY_LIMIT:"CALL_FREQUENCY_LIMIT",CONNECTION_ABORTED:"CONNECTION_ABORTED",API_CALL_ABORTED:"API_CALL_ABORTED",DUPLICATE_AUX:"DUPLICATE_AUX"},pO={AVOID_REPEATED_CALL:e=>"previous ".concat(e.name,"() is ongoing, please avoid repeated calls."),INVALID_PARAMETER_REQUIRED(e){let{key:t,rule:i,fnName:r,value:n}=e;return"'".concat(t||i.name,"' is a required param when calling ").concat(r,"(), received: ").concat(n,".")},INVALID_PARAMETER_TYPE(e){let{key:t,rule:i,fnName:r,value:n}=e,a="".concat(t||i.name),o="";return o=Array.isArray(i.type)?i.type.join("|"):i.type,"'".concat(a,"' must be type of ").concat(o," when calling ").concat(r,"(), received type: ").concat(Tk(n),".")},INVALID_PARAMETER_EMPTY(e){let{key:t,rule:i,fnName:r,value:n}=e;return"'".concat(t||i.name,"' cannot be '").concat(n,"' when calling ").concat(r,"().")},INVALID_PARAMETER_INSTANCE(e){let{key:t,rule:i,fnName:r,value:n}=e,a="".concat(t||i.name),o="".concat(i.instanceOf.name||i.instanceOf);return"'".concat(a,"' must be instanceof ").concat(o," when calling ").concat(r,"(), received type: ").concat(Tk(n),".")},INVALID_PARAMETER_RANGE(e){let{key:t,rule:i,fnName:r,value:n}=e;return"'".concat(t||i.name,"' must be one of ").concat(i.values.join("|")," when calling ").concat(r,"(), received: ").concat(n,".")},INVALID_PARAMETER_MIN(e){let{key:t,rule:i,fnName:r,value:n}=e;return"the min value of ".concat(t||i.name," is ").concat(i.min,", received: ").concat(n,".")},INVALID_PARAMETER_MAX(e){let{key:t,rule:i,fnName:r,value:n}=e;return"the max value of ".concat(t||i.name," is ").concat(i.max,", received: ").concat(n,".")},API_CALL_TIMEOUT:e=>"".concat(e.commandDesc||e.command," timeout observed."),SIGNAL_CHANNEL_RECONNECTION_FAILED:"signal channel reconnection failed, please check your network.",SIGNAL_CHANNEL_SETUP_FAILED:e=>"SignalChannel setup failure: (errorCode: ".concat(e.errorCode,", errorMsg: ").concat(e.errorMsg," })."),ERROR_MESSAGE(e){let t="".concat(e.type," failed");return e.message&&(t="".concat(t,": ").concat(e.message,".")),t},EXCHANGE_SDP_TIMEOUT:"exchange sdp timeout.",DOWNLINK_RECONNECTION_FAILED:"downlink reconnection failed, please check your network and re-join room.",EXCHANGE_SDP_FAILED:e=>"exchange sdp failed ".concat(e.errMsg,"."),UPDATE_OFFER_TIMEOUT:"update offer timeout observed.",UPLINK_RECONNECTION_FAILED:"uplink reconnection failed, please check your network and publish again.",INVALID_RECORDID:"recordId must be an integer number.",INVALID_PURE_AUDIO:"pureAudioPushMode must be 1 or 2.",INVALID_STREAMID:"streamId must be a sting literal within 64 bytes, and not be empty.",INVALID_USER_DEFINE_RECORDID:"userDefineRecordId must be a sting literal contains (a-zA-Z),(0-9), underline and hyphen, within 64 bytes, and not be empty.",INVALID_USER_DEFINE_PUSH_ARGS:"userDefinePushArgs must be a sting literal within 256 bytes, and not be empty.",INVALID_PROXY:'proxy server url must start with "wss://".',INVALID_JOIN:"duplicate join() called.",INVALID_ROOMID_STRING:e=>"'".concat(e,"' must be validate string when useStringRoomId is true."),INVALID_ROOMID_INTEGER:e=>"'".concat(e,"' must be an integer between [1, 4294967294] when useStringRoomId is false."),INVALID_SIGNAL_CHANNEL:"SignalChannel is not ready yet.",JOIN_ROOM_TIMEOUT:"join room timeout.",JOIN_ROOM_FAILED(e){let{error:t,code:i}=e;return"Failed to join room - ".concat(t," code: ").concat(i)},REJOIN_ROOM_FAILED:e=>"reJoin room: ".concat(e.roomId," failed, please check your network."),INVALID_DESTROY:"please call leave() before destroy().",INVALID_PUBLISH:"please call join() before publish().",INVALID_UNPUBLISH:"stream has not been published yet.",INVALID_AUDIENCE:'no permission to publish() under live/audience, please call switchRole("anchor") firstly before publish().',INVALID_INITIALIZE:"cannot publish stream because stream is not initialized, is switching device, or has been closed.",INVALID_DUPLICATE_PUBLISHING:e=>"duplicate ".concat(e," stream publishing, please unpublish your prev ").concat(e," stream and then re-publish."),INVALID_SUBSCRIBE_UNDEFINED:"stream is undefined or null.",INVALID_SUBSCRIBE_LOCAL:"stream cannot be LocalStream.",INVALID_REMOTE_STREAM:"remoteStream does not exist because it has been unpublished by remote peer.",SUBSCRIBE_FAILED(e){let{message:t,userId:i,streamType:r}=e;return"failed to subscribe ".concat(i," ").concat(r," stream, reason: ").concat(t,".")},INVALID_ROLE:"switchRole can only be called in live mode.",INVALID_PARAMETER_SWITCH_ROLE:"role could only be set to a value as anchor or audience.",INVALID_OPERATION_SWITCH_ROLE:"please call join() before switchRole().",SWITCH_ROLE_TIMEOUT:"switchRole timeout.",SWITCH_ROLE_FAILED:e=>"switchRole failed, errCode: ".concat(e.code," errMsg: ").concat(e.message,"."),CLIENT_BANNED:e=>"client was banned because of ".concat(e.message,"."),INVALID_OPERATION_START_PUBLISH_CDN:"please call startPublishCDNStream() after join room and publish the local stream.",INVALID_OPERATION_STOP_PUBLISH_CDN:"please call startPublishCDNStream() before stopPublishCDNStream().",START_PUBLISH_CDN_FAILED:e=>"startPublishCDNStream failed, errMsg: ".concat(e.message,"."),STOP_PUBLISH_CDN_FAILED:e=>"stopPublishCDNStream failed, errMsg: ".concat(e.message,"."),INVALID_STREAM_ID:e=>"'".concat(e,"' can only consist of uppercase and lowercase english letters (a-zA-Z), numbers (0-9), hyphens and underscores."),START_MIX_TRANSCODE:"please call startMixTranscode() after join().",STOP_MIX_TRANSCODE:"please call stopMixTranscode() after startMixTranscode().",INVALID_AUDIO_VOLUME:"interval must be a number.",ENABLE_SMALL_STREAM_PUBLISHED:"Cannot enable small stream after localStream published.",DISABLE_SMALL_STREAM_PUBLISHED:"Cannot disable small stream after localStream published.",NOT_SUPPORTED_SMALL_STREAM:"your browser does not support opening small stream.",INVALID_SMALL_STREAM_PROFILE:"small stream profile is invalid.",INVALID_PARAMETER_REMOTE_STREAM:"remoteStream is invalid.",INVALID_OPERATION_CHANGE_SMALL:"cannot switch to the small stream without subscribing to the video of remoteStream.",REMOTE_NOT_PUBLISH_SMALL_STREAM:"remote peer does not publish small stream.",INVALID_SWITCH_DEVICE:"cannot switch device on current stream.",INVALID_SWITCH_DEVICE_PUBLISHING:"cannot switch device when publishing localStream.",INVALID_REPLACE_TRACK:"cannot replace track when publishing localStream.",INVALID_INITIALIZE_LOCAL_STREAM:"local stream has not initialized yet.",INVALID_ADD_TRACK_REPETITIVE:"previous addTrack is ongoing, please avoid repetitive execution.",INVALID_ADD_TRACK_REMOVING:"cannot add track when a track is removing.",INVALID_ADD_TRACK_PUBLISHING:"cannot add track when publishing localStream.",INVALID_STREAM_INITIALIZED:"your local stream haven't been initialized yet.",INVALID_ADD_TRACK_NUMBER:"a Stream has at most one audio track and one video track.",INVALID_REMOVE_AUDIO_TRACK:"remove audio track is not supported on your browser.",INVALID_REMOVE_AUDIO_ADDING:"cannot remove track when a track is adding.",INVALID_REMOVE_AUDIO_ON:"previous removeTrack is ongoing, please avoid repetitive execution.",INVALID_REMOVE_TRACK_PUBLISHING:"cannot remove track when publishing localStream.",INVALID_REMOVE_TRACK_NOT_TRACK:"localStream has not this track.",INVALID_REMOVE_TRACK_NUMBER:"remove the only video track is not supported, please use replaceTrack or muteVideo.",INVALID_REPLACE_TRACK_NO_TRACK:e=>"cannot replace ".concat(e.kind," track because stream has not ").concat(e.kind," track"),NOT_BUG_PACKAGE:"You need to buy packages, refer to tencent console.",START_MIX_TRANSCODE_FAILED:e=>"startMixTranscode failed, errMsg: ".concat(e.message,"."),STOP_MIX_TRANSCODE_FAILED:e=>"stopMixTranscode failed, errMsg: ".concat(e.message,"."),MIX_TRANSCODE_NOT_STARTED:"mixTranscode has not been started.",CANNOT_LESS_THAN_ZERO(e){let{key:t,rule:i,fnName:r,value:n}=e;return"'".concat(t||i.name,"' cannot be less than 0 when calling ").concat(r,"().")},MIX_PARAMS_VIDEO_FRAMERATE:"'config.videoFramerate' should be an integer between 0 and 30, excluding 0.",MIX_PARAMS_VIDEO_GOP:"'config.videoGOP' should be an integer between 1 and 8.",MIX_PARAMS_AUDIO_BITRATE:"'config.audioBitrate' should be an integer between 32 and 192.",MIX_PARAMS_USER_Z_ORDER:e=>"'".concat(e,"' is required and must be between 1 and 15."),MIX_PARAMS_NOT_SELF:"'config.mixUsers' must contain self.",MIX_PARAMS_USER_STREAM:"'config.videoWidth' and 'config.videoHeight' of output stream should be contain all mix stream.",INVALID_PLAY:"duplicate play() call observed, please stop() firstly.",INVALID_ELEMENT_ID:e=>{let{key:t,fnName:i}=e;return"'".concat(t,"' is not found in the document object when calling ").concat(i,"().")},INVALID_ELEMENT_ID_TYPE:e=>{let{key:t,fnName:i,type:r}=e;return"the element corresponding to '".concat(t,"' must be instanceof HTMLElement when calling ").concat(i,"(), received: ").concat(r,".")},PLAY_FAILED:e=>"".concat(e.media," play failed, browser exception: ").concat(e.error.toString()),INVALID_USERID:"userId cannot be all spaces.",INVALID_CREATE_STREAM_SOURCE:"LocalStream must be created by createStream() with either audio/video or audioSource/videoSource, but can not be mixed with audio/video and audioSource/videoSource.",INVALID_CREATE_STREAM_SCREEN:"screen/video cannot be both true.",INVALID_CREATE_STREAM_AUDIO:"audio/screenAudio cannot be both true.",INVALID_CREATE_STREAM_SCREEN_AUDIO:"when screen is true, screenAudio can be configured.",NOT_SUPPORTED_HTTP:"http protocol does not support the ability to capture microphone, camera and screen. please use https to deploy your page.",NOT_SUPPORTED_WEBRTC:"your browser or environment does not support full WebRTC capabilities.",NOT_SUPPORTED_PROFILE:"your browser does not support setVideoProfile.",NOT_SUPPORTED_MEDIA:"your browser or environment does not support navigator.mediaDevices.",NOT_SUPPORTED_H264ENCODE:"your device does not support H.264 encoding.",NOT_SUPPORTED_H264DECODE:"your device does not support H.264 decoding.",NOT_SUPPORTED_TRACK:e=>"".concat(e,"Track is not supported on your browser."),NOT_SUPPORTED_SWITCH_DEVICE:"switchDevice is not supported on your browser.",NOT_SUPPORTED_CAPTURE:"Your browser or environment does not support screen sharing, please check whether the browser version.",MICROPHONE_NOT_FOUND:"no microphone detected, please check your microphone.",CAMERA_NOT_FOUND:"no camera detected, please check your camera.",SIGNAL_RESPONSE_FAILED:e=>"".concat(e.signalResponse," failed, response code is ").concat(e.code," , errMsg: ").concat(e.message,"."),CATCH_HANDLER_ERROR(e){let{name:t,event:i}=e;return"an error was caught in ".concat(t,".on('").concat(i,"', handler), please check your code in 'handler'.")},API_NOT_EXIST(e){let{name:t}=e;return"experimental api ".concat(t," does not exist.")},REPEAT_JOIN:e=>"please avoid repeated join.",CONNECTION_CLOSED:"remoteStream has been unsubscribed or unpublished by remote user.",SUBSCRIBE_ALL_FALSE:"cannot subscribe when both audio & video are false, use client.unsubscribe() instead",CLIENT_DESTROYED(e){let{funName:t}=e;return"failed to call ".concat(t,"() because client was destroyed.")},SEI_NOT_SUPPORT:e=>"not support to sendSEIMessage".concat(!1===e?" without using h264 codec":""),SEI_DISABLED:"SEI is disabled",SEI_BEFORE_PUBLISH:"please call sendSEIMessage() after publish() success",SEI_NOT_VIDEO:"cannot send sei when localStream has not video.",CALL_FREQUENCY_LIMIT:e=>{let{isSize:t,name:i,timesInSecond:r,maxSizeInSecond:n}=e;return"api ".concat(i," call ").concat(t?"size":"times"," is over ").concat(t?"".concat(n," bytes"):r," in a second.")},CONNECTION_ABORTED:e=>"connection aborted due to: ".concat(e),API_CALL_ABORTED(e){let t;return t=e.message.includes("REMOTE_STREAM_NOT_EXIST")?"Subscribe ".concat(e.userId," ").concat(e.streamType," stream aborted, reason: remote user ").concat(e.userId," unpublished stream."):"API aborted, reason: ".concat(e.message),t},DUPLICATE_AUX:"only one auxiliary stream can be published in a room.",NOT_SUPPORTED_AUX:"publish auxiliary stream is not supported on your browser.",INVALID_PARAMETER_STREAMTYPE:e=>"'streamType' is required when 'userId' is not '*', calling ".concat(e,"()")},fO=(e,t)=>t?"".concat(DA,"/").concat(e,"/").concat(t):"".concat(DA,"/").concat(e,"/index.html"),mO=()=>{if(window.TRTC_ERROR_INFO&&window.TRTC_ERROR_LINK)return{TRTC_ERROR_INFO:window.TRTC_ERROR_INFO,TRTC_ERROR_LINK:window.TRTC_ERROR_LINK};let e=null==localStorage?void 0:localStorage.getItem("trtc_error_assistance");if(e){e=JSON.parse(e);let t=document.createElement("script");t.type="text/javascript",t.text=e.message,document.body.appendChild(t);let i=window.TRTC_ERROR_INFO,r=window.TRTC_ERROR_LINK;return document.body.removeChild(t),{TRTC_ERROR_INFO:i,TRTC_ERROR_LINK:r}}return{}};function gO(e){let{key:t,data:i,link:r,addDocLink:n=!0}=e,a="",o="",s="";Sk(pO[t])?a=pO[t](i):Rk(pO[t])&&(a=pO[t]);let{TRTC_ERROR_INFO:c,TRTC_ERROR_LINK:l}=mO();r?s="".concat(r.className,".html#").concat(r.fnName):l&&l[t]&&(Sk(l[t])?s=l[t](i):Rk(l[t])&&(s=l[t]));let d=a;return Ek()&&(c&&c[t]&&(Sk(c[t])?o=c[t](i):Rk(c[t])&&(o=c[t])),o&&(d=n?"".concat(o,"\n请查看文档: ").concat(fO("zh-cn",s),"\n\n"):"".concat(o,"\n\n"),d+=a)),n&&(d+=" \nRefer to: ".concat(fO("en",s),"\n")),d}var vO,_O=dA(_A(),1),yO=class{constructor(){let e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];hA(this,"countMap",new Map),hA(this,"distributionMap",new Map),hA(this,"version"),hA(this,"log",lO.createLogger({id:"kv"})),e&&(aO.on("102",(e=>{let{track:t,cost:i}=e;this.addSuccessEvent({key:t.kind===BA?501700:511700,cost:i})})),aO.on("103",(e=>{let{track:t,error:i}=e;this.addFailedEvent({key:t.kind===BA?501700:511700,error:i})})),aO.on("266",(e=>{let{enable:t}=e;this.log.info("".concat(t?"enable":"disable"," sso")),t?this.addSuccessEvent({key:525701}):this.addFailedEvent({key:525701})})))}getReportData(e,t){let i={msg_sdk_basic_info:{uint32_sdk_version:nC(this.version||RA),uint32_terminal_type:15,bytes_device_name:"",bytes_os_version:"",uint32_framework:30,uint32_network_type:0},stats_count:[...this.countMap.entries()].map((e=>{let[t,i]=e;return{uint32_key:t,uint32_count:i}})),stats_distribution:[...this.distributionMap.entries()].map((e=>{let[t,i]=e;return{uint32_key:t,distribution_items:[...i.entries()].map((e=>{let[t,i]=e;return{uint32_item_key:t,uint32_item_value:i}}))}})),str_user_sig:e,bytes_report_token:t};return this.countMap.clear(),this.distributionMap.clear(),i}clear(){this.countMap.clear(),this.distributionMap.clear()}isEnumKey(e){let t=+String(e).slice(-3);return t>=700&&t<799}isErrorCodeKey(e){let t=+String(e).slice(-3);return t>=600&&t<699}isCountKey(e){let t=+String(e).slice(-3);return t>=0&&t<599}isNumberKey(e){let t=+String(e).slice(-3);return t>=800&&t<899}addCount(e){let{key:t,useUV:i=!1}=e;this.isCountKey(t)?i&&this.countMap.has(t)||this.countMap.set(t,(this.countMap.get(t)||0)+1):this.log.debug("".concat(t," is not count key, last 3 number should be 0~599"))}addEnum(e){let{key:t,value:i,useUV:r=!0}=e;var n;if(!this.isEnumKey(t))return this.log.debug("".concat(t," is not enum key, last 3 number should be 700~799"));if(r&&this.countMap.has(t))return;this.countMap.set(t,(this.countMap.get(t)||0)+1);let a=(null==(n=this.distributionMap)?void 0:n.get(t))||new Map;a.set(i,(a.get(i)||0)+1),this.distributionMap.set(t,a)}addNumber(e){let{key:t,value:i,split:r=100,useUV:n=!1,max:a=5e3}=e;var o;if(!this.isNumberKey(t))return this.log.debug("".concat(t," is not number key, last 3 number should be 800~899"));if(n&&this.countMap.has(t))return;i>a&&(i=a),this.countMap.set(t,(this.countMap.get(t)||0)+1);let s=(null==(o=this.distributionMap)?void 0:o.get(t))||new Map,c=0;if(kk(r))c=Math.floor(i/r);else for(let l=r.length-1;l>0;l--)if(i>r[l]){c=l;break}s.set(c,(s.get(c)||0)+1),this.distributionMap.set(t,s)}addSuccessEvent(e){let{key:t,cost:i,timeKey:r,split:n}=e;if(t&&(this.addEnum({key:t,value:1,useUV:!1}),i)){let e=+String(t).slice(-3);e<800&&e>=700?this.addNumber({key:r||t+100,value:i,split:n}):r||this.log.debug("time stat ignored, ".concat(t))}}addFailedEvent(e){let{key:t,error:i}=e;if(!t)return;let r=LR.UNKNOWN;i&&(kk(i)?r=i:(!Ak(i.extraCode)||!Ak(i.code))&&(r=i.extraCode||i.code)),this.addEnum({key:t,value:0,useUV:!1}),this.addEnum({key:t,value:Math.abs(r),useUV:!1})}},EO=((vO=EO||{})[vO.DECODER_TYPE=514700]="DECODER_TYPE",vO[vO.DECODER_HW_SW=514701]="DECODER_HW_SW",vO[vO.DECODE_RESULT=514702]="DECODE_RESULT",vO[vO.DECODE_FAILED_OS=514703]="DECODE_FAILED_OS",vO[vO.DOWNGRADE_RESULT=514704]="DOWNGRADE_RESULT",vO[vO.DOWNGRADE_WEBCODECS_VIDEO=514705]="DOWNGRADE_WEBCODECS_VIDEO",vO[vO.DOWNGRADE_WEBCODECS_2D=514706]="DOWNGRADE_WEBCODECS_2D",vO[vO.DOWNGRADE_WASM_WEGBL=514707]="DOWNGRADE_WASM_WEGBL",vO[vO.DOWNGRADE_WASM_VIDEO=514708]="DOWNGRADE_WASM_VIDEO",vO[vO.DOWNGRADE_WASM_2D=514709]="DOWNGRADE_WASM_2D",vO[vO.DECODE_H264_RESULT=514710]="DECODE_H264_RESULT",vO[vO.DECODE_H265_RESULT=514711]="DECODE_H265_RESULT",vO[vO.DECODE_VP8_RESULT=514712]="DECODE_VP8_RESULT",vO[vO.DECODE_CAPABILITIES=514713]="DECODE_CAPABILITIES",vO[vO.H264_PROFILE_LEVEL_ID_HIGH=514714]="H264_PROFILE_LEVEL_ID_HIGH",vO[vO.H264_PROFILE_LEVEL_ID_MAIN=514715]="H264_PROFILE_LEVEL_ID_MAIN",vO[vO.RENDER_FREEZE_RATE=514850]="RENDER_FREEZE_RATE",vO[vO.DATA_FREEZE_RATE=514851]="DATA_FREEZE_RATE",vO[vO.VIDEO_CONSUME_RENDER_RATE=514852]="VIDEO_CONSUME_RENDER_RATE",vO),bO=new yO(!0);new yO(!1);var wO=bO,IO={result:!1,detail:{isBrowserSupported:!1,isWebRTCSupported:!1,isWebCodecsSupported:!1,isMediaDevicesSupported:!1,isScreenShareSupported:!1,isSmallStreamSupported:!1,isH264EncodeSupported:!1,isVp8EncodeSupported:!1,isH265EncodeSupported:!1,isH264DecodeSupported:!1,isVp8DecodeSupported:!1,isH265DecodeSupported:!1}},TO=new Map([[WC,["Firefox",GC]],[XC,["Edg",ZC]],[BD,["Chrome",zD]],[jD,["Safari",GD]],[iD,["TBS",rD]],[nD,["XWEB",aD]],[sD&&FC,["WeChat",cD]],[hD,["QQ(Win)",pD]],[dD,["QQ(Mobile)",uD]],[lD,["QQ(Mobile X5)",uD]],[fD,["QQ(Mac)",mD]],[gD,["QQ(iPad)",vD]],[ID,["MI",TD]],[SD,["HW",kD]],[CD,["Samsung",DD]],[OD,["OPPO",ND]],[LD,["VIVO",xD]],[KC,["EDGE",YC]],[QC,["SogouMobile",$C]],[eD,["Sogou",tD]]]);function SO(){let e=TO.get(!0);return{browserName:e?e[0]:"unknown",browserVersion:e?e[1]:"unknown"}}var AO=function(){return!(wD||KC||XC&&JC<80||WC&&qC<56)},RO=function(){return["VideoDecoder","VideoEncoder","AudioEncoder","AudioDecoder"].every((e=>e in window))},kO=function(){if(!navigator.mediaDevices)return DO()||lO.error(pO.NOT_SUPPORTED_MEDIA),!1;let e=["getUserMedia","enumerateDevices"];return e.filter((e=>e in navigator.mediaDevices)).length===e.length},CO=!1;function DO(){return"http:"===location.protocol&&!JD&&(CO||lO.error(gO({key:hO.NOT_SUPPORTED_HTTP})),CO=!0,!0)}var OO=function(){return(null==window?void 0:window.OffscreenCanvas)&&(null==window?void 0:window.MediaStreamTrackProcessor)&&(null==window?void 0:window.MediaStreamTrackGenerator)},NO=function(){return!(null==window||!window.MediaStreamTrackGenerator)},LO=async function(){var e,t,i;if(IO.detail.isH264EncodeSupported&&IO.detail.isVp8EncodeSupported)return{isH264EncodeSupported:IO.detail.isH264EncodeSupported,isVp8EncodeSupported:IO.detail.isVp8EncodeSupported,isH265EncodeSupported:IO.detail.isH265EncodeSupported};let r,n=!1,a=!1,o=!1;try{let s=new RTCPeerConnection,c=document.createElement(FA);c.getContext("2d");let l=c.captureStream(0);return s.addTrack(l.getVideoTracks()[0],l),r=await s.createOffer(),n=-1!==(null==(e=r.sdp)?void 0:e.toLowerCase().indexOf("h264")),a=-1!==(null==(t=r.sdp)?void 0:t.toLowerCase().indexOf("vp8")),o=-1!==(null==(i=r.sdp)?void 0:i.toLowerCase().indexOf("h265")),s.close(),{isH264EncodeSupported:n,isVp8EncodeSupported:a,isH265EncodeSupported:o}}catch(s){return{isH264EncodeSupported:!1,isVp8EncodeSupported:!1,isH265EncodeSupported:!1}}},xO=async function(){var e;if(IO.detail.isH264DecodeSupported&&IO.detail.isVp8DecodeSupported)return{isH264DecodeSupported:IO.detail.isH264DecodeSupported,isVp8DecodeSupported:IO.detail.isVp8DecodeSupported,isH265DecodeSupported:IO.detail.isH265DecodeSupported};let t,i=!1,r=!1;try{let n=new RTCPeerConnection;eN()?(n.addTransceiver(VA,{direction:"recvonly"}),t=await n.createOffer()):t=await n.createOffer({offerToReceiveVideo:!0}),-1!==t.sdp.toLowerCase().indexOf("h264")&&(i=!0),-1!==t.sdp.toLowerCase().indexOf("vp8")&&(r=!0);let a=-1!==(null==(e=t.sdp)?void 0:e.toLowerCase().indexOf("h265"));return n.close(),{isH264DecodeSupported:i,isVp8DecodeSupported:r,isH265DecodeSupported:a}}catch(n){return{isH264DecodeSupported:!1,isVp8DecodeSupported:!1,isH265DecodeSupported:!1}}};var PO=sC((async e=>{let t=Date.now(),i=pN(),r=kO(),n=RO();if(IO.detail.isWebRTCSupported=i,IO.detail.isMediaDevicesSupported=r,IO.detail.isWebCodecsSupported=n,IO.detail.isScreenShareSupported=UO(),IO.detail.isSmallStreamSupported=XO(),37===e)return Object.assign(IO.detail,await async function(){return VO||(VO=new Promise((async e=>{let t={isH264EncodeSupported:!1,isH264DecodeSupported:!1,isVp8EncodeSupported:!1,isVp8DecodeSupported:!1};if(!RO())return void e(t);let i=null,r=null,n=null,a=()=>{n&&clearTimeout(n),i=null,r=null};try{i=document.createElement("canvas"),r=i.getContext("2d"),i.width=320,i.height=240;let o=0,s=()=>{!r||!i||(r.fillStyle="hsl(".concat(o%360,", 50%, 50%)"),r.fillRect(0,0,i.width,i.height),r.fillStyle="white",r.font="20px Arial",r.fillText("Frame ".concat(o),10,30),o++)};n=setTimeout((()=>{a(),e(t)}),5e3);let c=[{type:"h264",encodeConfig:{codec:"avc1.42E01E",avc:{format:"annexb"},width:320,height:240,bitrate:1e6},decodeConfig:{codec:"avc1.42E01E",avc:{format:"annexb"}}},{type:"vp8",encodeConfig:{codec:"vp8",width:320,height:240,bitrate:1e6},decodeConfig:{codec:"vp8"}}];(await Promise.all(c.map((async e=>{let t,r={type:e.type,encodeSupported:!1,decodeSupported:!1};try{t=await new Promise((async(t,n)=>{try{let a=new VideoEncoder({output:e=>{t(e),r.encodeSupported=!0},error:n});a.configure(e.encodeConfig),s();let o=new VideoFrame(i,{timestamp:0});a.encode(o,{keyFrame:!0}),o.close(),await a.flush(),a.close()}catch(a){n(a)}}))}catch(p){return lO.warn("".concat(e.type," encoder error:"),p),r}try{await new Promise((async(i,n)=>{try{let a=new VideoDecoder({output:e=>{r.decodeSupported=!0,i(0),e.close()},error:n});a.configure(e.decodeConfig),a.decode(t),await a.flush(),a.close()}catch(a){n(a)}}))}catch(p){lO.warn("".concat(e.type," decoder error:"),p)}return r})))).forEach((e=>{"h264"===e.type?(t.isH264EncodeSupported=e.encodeSupported,t.isH264DecodeSupported=e.decodeSupported):"vp8"===e.type&&(t.isVp8EncodeSupported=e.encodeSupported,t.isVp8DecodeSupported=e.decodeSupported)})),a(),e(t)}catch(o){a(),lO.warn("detectWebCodecsSupported failed:",o),e(t)}})),VO)}()),IO.detail.isBrowserSupported=n,IO.result=r&&n,IO.result||lO.error("".concat(navigator.userAgent," ").concat(eC(IO.detail,!1))),EN(e),wO.addNumber({key:523800,value:Date.now()-t}),IO;if(IO.result&&IO.detail.isH264EncodeSupported&&IO.detail.isVp8EncodeSupported&&IO.detail.isH265EncodeSupported&&IO.detail.isH264DecodeSupported&&IO.detail.isVp8DecodeSupported&&IO.detail.isH265DecodeSupported)return IO;let a=AO(),{encode:o,decode:s}=await async function(){let[e,t]=await Promise.all([LO(),xO()]);return{encode:{h264:e.isH264EncodeSupported,vp8:e.isVp8EncodeSupported,h265:e.isH265EncodeSupported},decode:{h264:t.isH264DecodeSupported,vp8:t.isVp8DecodeSupported,h265:t.isH265DecodeSupported}}}(),{h264:c,vp8:l}=o,{h264:d}=s,{h265:u}=o,{vp8:h,h265:p}=s;if(!c||!l){let e=await LO();lO.warn("detect encode again h264:".concat(c," vp8:").concat(l," result: ").concat(JSON.stringify(e))),c=e.isH264EncodeSupported,l=e.isVp8EncodeSupported}if(c&&d&&zC&&FD&&!nD&&!iD&&(!OD||115!==HD)){let{encode:e,decode:t}=await async function(){return BO||(BO=new Promise((async e=>{let t={encode:!1,decode:!1},i=()=>{};try{let r=document.createElement("canvas"),n=r.getContext("2d");r.width=640,r.height=480;let a=setInterval((()=>{n.fillText("test",Math.floor(640*Math.random()),Math.floor(480*Math.random()))}),66),o=-1,s=-1;i=()=>{clearInterval(o),clearInterval(a),clearTimeout(s),l.close(),d.close(),c.getTracks().forEach((e=>e.stop()))},s=setTimeout((()=>{i(),e(t)}),2e3);let c=r.captureStream(),l=new RTCPeerConnection({}),d=new RTCPeerConnection({offerToReceiveAudio:!0,offerToReceiveVideo:!0});l.addEventListener("icecandidate",(e=>d.addIceCandidate(e.candidate))),d.addEventListener("icecandidate",(e=>l.addIceCandidate(e.candidate))),l.addTrack(c.getVideoTracks()[0],c);let u=await l.createOffer();await l.setLocalDescription(u),await d.setRemoteDescription(u);let h=await d.createAnswer(),p=_O.default.parse(h.sdp),f=p.media[0].rtp.findIndex((e=>"H264"===e.codec));p.media[0].rtp=[p.media[0].rtp[f]],p.media[0].fmtp=p.media[0].fmtp.filter((e=>e.payload===p.media[0].rtp[0].payload)),p.media[0].rtcpFb&&(p.media[0].rtcpFb=p.media[0].rtcpFb.filter((e=>e.payload===p.media[0].rtp[0].payload))),h.sdp=_O.default.write(p),await d.setLocalDescription(h),await l.setRemoteDescription(h),o=setInterval((async()=>{t.encode&&t.decode&&(i(),e(t));let[r,n]=await Promise.all([l.getSenders()[0].getStats(),d.getReceivers()[0].getStats()]);t.encode||r.forEach((e=>{"outbound-rtp"===e.type&&e.mediaType===VA&&e.bytesSent>0&&(t.encode=!0)})),t.decode||n.forEach((e=>{"inbound-rtp"===e.type&&e.mediaType===VA&&e.bytesReceived>0&&(t.decode=!0)}))}),100)}catch(r){i(),lO.warn("detectH264Supported failed",r),e({encode:!0,decode:!0})}})).then((e=>(e.encode||(e.decode=!0),(!e.encode||!e.decode)&&lO.warn("detectH264Supported encode: ".concat(e.encode," decode: ").concat(e.decode," ").concat("")),e))),BO)}();c=e,d=t}return IO.result=a&&i&&r&&(c||l)&&(d||h),IO.detail.isBrowserSupported=a,IO.detail.isWebRTCSupported=i,IO.detail.isH264EncodeSupported=c,IO.detail.isVp8EncodeSupported=l,IO.detail.isH265EncodeSupported=u,IO.detail.isH264DecodeSupported=d,IO.detail.isVp8DecodeSupported=h,IO.detail.isH265DecodeSupported=p,IO.result||lO.error("".concat(navigator.userAgent," ").concat(eC(IO.detail,!1))),EN(),wO.addNumber({key:523800,value:Date.now()-t}),IO})),MO=function(){return IO.result},UO=function(){return!(!navigator.mediaDevices||!navigator.mediaDevices.getDisplayMedia)},FO="undefined"!=typeof HTMLMediaElement&&"setSinkId"in HTMLMediaElement.prototype,BO=null;var VO=null;var HO=(e,t,i)=>{"http:"===location.protocol&&!JD&&(e[t]=()=>{throw new PR({code:LR.INVALID_OPERATION,message:pO.NOT_SUPPORTED_HTTP})})},zO=function(e){return!("candidate-pair"!==e.type||!e.nominated||"in-progress"!==e.state&&"succeeded"!==e.state)&&!(Ck(e.selected)&&!e.selected)};function jO(){let e="";if(screen.width){let t=screen.width?screen.width*window.devicePixelRatio:"",i=screen.height?screen.height*window.devicePixelRatio:"";e+="".concat(t," * ").concat(i)}return e}function WO(){return navigator.getUserMedia||navigator.mediaDevices&&navigator.mediaDevices.getUserMedia}function GO(){let e={isSupported:!1},t=["AudioContext","webkitAudioContext","mozAudioContext","msAudioContext"];for(let i=0;i<t.length;i++)if(t[i]in window){e.isSupported=!0;break}return e.isSupported}function qO(){return"captureStream"in HTMLCanvasElement.prototype}function KO(){return!(sD||VC||HD&&HD<63)&&!(!AO()||!qO())}function YO(){return!(HD<74||KC||KD<11||qC<46)}function XO(){return KO()||YO()}var ZO=function(){if(Ak(window.RTCRtpTransceiver)||!eN()||!("currentDirection"in RTCRtpTransceiver.prototype))return!1;let e=null,t=!1;try{e=new RTCPeerConnection({sdpSemantics:"unified-plan"}),e.addTransceiver(BA),t=!0}catch(Jx){}return null==e||e.close(),t};function JO(){return"RTCPeerConnection"in window&&"getReceivers"in window.RTCPeerConnection.prototype}function QO(){return"RTCPeerConnection"in window&&"getSenders"in window.RTCPeerConnection.prototype}function $O(){return"RTCPeerConnection"in window&&"getTransceivers"in window.RTCPeerConnection.prototype}function eN(){return!(11===KD&&!ZD)&&("RTCPeerConnection"in window&&"addTransceiver"in window.RTCPeerConnection.prototype)}var tN=!(!eN()||FD&&HD<86);function iN(){return"RTCRtpTransceiver"in window&&"stop"in window.RTCRtpTransceiver.prototype}var rN="RTCRtpSender"in window;function nN(){return rN&&"replaceTrack"in window.RTCRtpSender.prototype}function aN(){return rN&&"setParameters"in window.RTCRtpSender.prototype&&QO()}var oN="RTCRtpReceiver"in window&&"getSynchronizationSources"in window.RTCRtpReceiver.prototype,sN=window.MediaStreamTrack&&"getSettings"in MediaStreamTrack.prototype,cN=window.MediaStreamTrack&&"getCapabilities"in MediaStreamTrack.prototype,lN="undefined"!=typeof InputDeviceInfo&&"getCapabilities"in InputDeviceInfo.prototype,dN=rN&&"createEncodedStreams"in window.RTCRtpSender.prototype&&MD()>=86,uN="RTCRtpScriptTransform"in window,hN=rN&&(dN||uN),pN=function(){return["RTCPeerConnection","webkitRTCPeerConnection","RTCIceGatherer"].filter((e=>e in window)).length>0};function fN(){let e={AudioDecoder:!1,AudioEncoder:!1,VideoDecoder:!1,VideoEncoder:!1,ImageDecoder:!1};return Ak(window.AudioDecoder)||(e.AudioDecoder=!0),Ak(window.AudioEncoder)||(e.AudioEncoder=!0),Ak(window.VideoDecoder)||(e.VideoDecoder=!0),Ak(window.VideoEncoder)||(e.VideoEncoder=!0),Ak(window.ImageDecoder)||(e.ImageDecoder=!0),e}function mN(){return"mediaSession"in navigator&&!Ak(navigator.mediaSession.setActionHandler)}function gN(){return!Ak(window.WebTransport)}function vN(){return"undefined"!=typeof WebAssembly&&WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,1,5,1,96,0,1,123,3,2,1,0,10,10,1,8,0,65,0,253,15,253,98,11]))}function _N(){let e={browser:"".concat($D.name,"/").concat($D.version),os:iO(),displayResolution:jO(),isScreenShareSupported:UO(),isWebRTCSupported:pN(),isGetUserMediaSupported:WO(),isWebAudioSupported:GO(),isWebSocketsSupported:"WebSocket"in window&&2===window.WebSocket.CLOSING,isWebCodecSupported:fN(),isMediaSessionSupported:mN(),isWebTransportSupported:gN()};return navigator.userAgent.includes("miniProgram")&&(e.browser="mini/".concat(e.browser)),e}var yN="checkResult";function EN(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:30;uO.setItem(yN+e,{ua:navigator.userAgent,checkResult:IO})}function bN(e){DO();let t=uO.getItem(yN+e);t&&t.ua===navigator.userAgent&&t.checkResult&&function(e,t){return!!Dk(e)&&Object.keys(t).every((t=>t in e))}(t.checkResult.detail,IO.detail)&&(IO=t.checkResult),PO(e)}function wN(){return"requestVideoFrameCallback"in HTMLVideoElement.prototype}var IN="RTCRtpReceiver"in window&&"jitterBufferTarget"in window.RTCRtpReceiver.prototype;function TN(e){return{h264:1,h265:2,vp8:3,vp9:4,av1:5}[e]}var SN=!1;async function AN(){var e;try{if(SN||null==(e=null==navigator?void 0:navigator.mediaCapabilities)||!e.encodingInfo)return;let t=rO(),i=sD||nD?4:FD?1:jD?2:WC?3:0;if(0===t||0===i)return;SN=!0;let r=["H264","VP8","VP9","AV1","H265"],[n,a]=await Promise.all([RN(r),kN(r)]);n&&Object.keys(n).forEach((e=>{let r=TN(e.toLowerCase());wO.addEnum({key:513707,value:+"".concat(r).concat(+n[e].supported).concat(+n[e].powerEfficient).concat(t).concat(i),useUV:!1})})),a&&Object.keys(a).forEach((e=>{let r=TN(e.toLowerCase());wO.addEnum({key:514713,value:+"".concat(r).concat(+a[e].supported).concat(+a[e].powerEfficient).concat(t).concat(i),useUV:!1})}));let{sender:o,receiver:s}=CN();wO.addEnum({key:513708,value:+"".concat(t).concat(i).concat(+o.high),useUV:!1}),wO.addEnum({key:513709,value:+"".concat(t).concat(i).concat(+o.main),useUV:!1}),wO.addEnum({key:514714,value:+"".concat(t).concat(i).concat(+s.high),useUV:!1}),wO.addEnum({key:514715,value:+"".concat(t).concat(i).concat(+s.main),useUV:!1})}catch(t){lO.info("detectVideoCodecCapabilities failed",t)}}async function RN(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1920,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1080,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:30,n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:3e3,a={};try{for(let o of e){let e=await navigator.mediaCapabilities.encodingInfo({type:"webrtc",video:{contentType:"video/".concat(o),width:t,height:i,bitrate:n,framerate:r}});a[o]=e}}catch(SA){}return a}async function kN(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1920,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1080,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:30,n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:3e3,a={};try{for(let o of e){let e=await navigator.mediaCapabilities.decodingInfo({type:"webrtc",video:{contentType:"video/".concat(o),width:t,height:i,bitrate:n,framerate:r}});a[o]=e}}catch(SA){}return a}function CN(){let e={sender:{base:!1,main:!1,high:!1},receiver:{base:!1,main:!1,high:!1}};try{if(RTCRtpSender&&"function"==typeof RTCRtpSender.getCapabilities){let t=RTCRtpSender.getCapabilities("video");t&&t.codecs&&t.codecs.filter((e=>"video/h264"===e.mimeType.toLowerCase())).forEach((t=>{if(t.sdpFmtpLine){let i=t.sdpFmtpLine.match(/profile-level-id=([0-9a-fA-F]+)/);if(i&&i[1])switch(i[1].slice(0,2)){case"42":e.sender.base=!0;break;case"4d":e.sender.main=!0;break;case"64":e.sender.high=!0}}}))}if(RTCRtpReceiver&&"function"==typeof RTCRtpReceiver.getCapabilities){let t=RTCRtpReceiver.getCapabilities("video");t&&t.codecs&&t.codecs.filter((e=>"video/h264"===e.mimeType.toLowerCase())).forEach((t=>{if(t.sdpFmtpLine){let i=t.sdpFmtpLine.match(/profile-level-id=([0-9a-fA-F]+)/);if(i&&i[1])switch(i[1].slice(0,2)){case"42":e.receiver.base=!0;break;case"4d":e.receiver.main=!0;break;case"64":e.receiver.high=!0}}}))}}catch(t){lO.warn("get H264 profile levelId failed",t)}return e}var DN=dA(fA(),1),ON=Symbol("instance"),NN=Symbol("cacheResult"),LN=class{constructor(e,t,i){this.oldState=e,this.newState=t,this.action=i,this.aborted=!1}abort(e){this.aborted=!0,FN.call(e,this.oldState,new Error("action '".concat(this.action,"' aborted")))}toString(){return"".concat(this.action,"ing")}},xN=class extends Error{constructor(e,t,i){super(t),this.state=e,this.message=t,this.cause=i}};var PN=new Map;function MN(e,t){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return(r,n,a)=>{let o=i.action||n;if(!i.context){let i=PN.get(r)||[];PN.has(r)||PN.set(r,i),i.push({from:e,to:t,action:o})}let s=a.value;a.value=function(){let r=this;for(var n=arguments.length,a=new Array(n),c=0;c<n;c++)a[c]=arguments[c];if(i.context&&(r=BN.get("function"==typeof i.context?i.context.call(this,...a):i.context)),r.state===t)return i.sync?r[NN]:Promise.resolve(r[NN]);r.state instanceof LN&&r.state.action==i.abortAction&&r.state.abort(r);let l=null;Array.isArray(e)?0==e.length?r.state instanceof LN&&r.state.abort(r):("string"!=typeof r.state||!e.includes(r.state))&&(l=new xN(r._state,"".concat(r.name," ").concat(o," to ").concat(t," failed: current state ").concat(r._state," not from ").concat(e.join("|")))):e!==r.state&&(l=new xN(r._state,"".concat(r.name," ").concat(o," to ").concat(t," failed: current state ").concat(r._state," not from ").concat(e)));let d=e=>{if(i.fail&&i.fail.call(this,e),i.sync){if(i.ignoreError)return e;throw e}return i.ignoreError?Promise.resolve(e):Promise.reject(e)};if(l)return d(l);let u=r.state,h=new LN(u,t,o);FN.call(r,h);let p=e=>{var n;return r[NN]=e,h.aborted||(FN.call(r,t),null===(n=i.success)||void 0===n||n.call(this,r[NN])),e},f=e=>(FN.call(r,u,e),d(e));try{let e=s.apply(this,a);return function(e){return"object"==typeof e&&e&&"then"in e}(e)?e.then(p).catch(f):i.sync?p(e):Promise.resolve(p(e))}catch(m){return f(new xN(r._state,"".concat(r.name," ").concat(o," from ").concat(e," to ").concat(t," failed: ").concat(m),m instanceof Error?m:new Error(String(m))))}}}}var UN="undefined"!=typeof window&&window.__AFSM__?(e,t)=>{window.dispatchEvent(new CustomEvent(e,{detail:t}))}:"undefined"!=typeof importScripts?(e,t)=>{postMessage({type:e,payload:t})}:()=>{};function FN(e,t){let i=this._state;this._state=e;let r=e.toString();e&&this.emit(r,i),this.emit(BN.STATECHANGED,e,i,t),this.updateDevTools({value:e,old:i,err:t instanceof Error?t.message:String(t)})}var BN=class e extends DN.default{constructor(t,i,r){super(),this.name=t,this.groupName=i,this._state=e.INIT,t||(t=Date.now().toString(36)),r?Object.setPrototypeOf(this,r):r=Object.getPrototypeOf(this),i||(this.groupName=this.constructor.name);let n=r[ON];n?this.name=n.name+"-"+n.count++:r[ON]={name:this.name,count:0},this.updateDevTools({diagram:this.stateDiagram})}get stateDiagram(){let e=Object.getPrototypeOf(this),t=PN.get(e)||[],i=new Set,r=[],n=[],a=new Set,o=Object.getPrototypeOf(e);PN.has(o)&&(o.stateDiagram.forEach((e=>i.add(e))),o.allStates.forEach((e=>a.add(e)))),t.forEach((e=>{let{from:t,to:i,action:a}=e;"string"==typeof t?r.push({from:t,to:i,action:a}):t.length?t.forEach((e=>{r.push({from:e,to:i,action:a})})):n.push({to:i,action:a})})),r.forEach((e=>{let{from:t,to:r,action:n}=e;a.add(t),a.add(r),a.add(n+"ing"),i.add("".concat(t," --\x3e ").concat(n,"ing : ").concat(n)),i.add("".concat(n,"ing --\x3e ").concat(r," : ").concat(n," 🟢")),i.add("".concat(n,"ing --\x3e ").concat(t," : ").concat(n," 🔴"))})),n.forEach((e=>{let{to:t,action:r}=e;i.add("".concat(r,"ing --\x3e ").concat(t," : ").concat(r," 🟢")),a.forEach((e=>{e!==t&&i.add("".concat(e," --\x3e ").concat(r,"ing : ").concat(r))}))}));let s=[...i];return Object.defineProperties(e,{stateDiagram:{value:s},allStates:{value:a}}),s}static get(t){let i;return"string"==typeof t?(i=e.instances.get(t),i||e.instances.set(t,i=new e(t,void 0,Object.create(e.prototype)))):(i=e.instances2.get(t),i||e.instances2.set(t,i=new e(t.constructor.name,void 0,Object.create(e.prototype)))),i}static getState(t){var i;return null===(i=e.get(t))||void 0===i?void 0:i.state}updateDevTools(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};UN(e.UPDATEAFSM,Object.assign({name:this.name,group:this.groupName},t))}get state(){return this._state}set state(e){FN.call(this,e)}};BN.STATECHANGED="stateChanged",BN.UPDATEAFSM="updateAFSM",BN.INIT="[*]",BN.ON="on",BN.OFF="off",BN.instances=new Map,BN.instances2=new WeakMap;var VN="undefined"!=typeof window,HN=VN&&window.requestIdleCallback||function(e){let t=Date.now();return setTimeout((()=>{e({didTimeout:!1,timeRemaining:()=>Math.max(0,50-(Date.now()-t))})}),1e3)},zN=VN&&window.cancelIdleCallback||function(e){clearTimeout(e)},jN=VN&&(window.cancelAnimationFrame||window.mozCancelAnimationFrame),WN=class e{static generateTaskID(){return this.currentTaskID++}static run(e,t,i){null!=i&&i.fps&&(i.delay=i.delay||Number((1e3/i.fps).toFixed(2))),i=aA("interval"===e?{delay:2e3,count:0,backgroundTask:!0}:"ric"===e?{delay:1e4,count:0}:"raf"===e?{fps:60,delay:16.6,count:0,backgroundTask:!0}:{delay:2e3,count:0,backgroundTask:!0},i);let r=oA(aA({taskID:this.generateTaskID(),loopCount:0,intervalID:null,timeoutID:null,rafID:null,ricID:null,taskName:e,callback:t},i),{delay:i.delay});return this.taskMap.set(r.taskID,r),this[e](r),r.taskID}static interval(t){return t.intervalID=setInterval((()=>{t.callback(),t.loopCount+=1,e.isBreakLoop(t)}),t.delay)}static intervalInWorker(t){e.sharedWorker||(e.sharedWorker=new Worker(URL.createObjectURL(new Blob(["\n const timers = new Map();\n self.onmessage = function(e) {\n const { taskId, delay, type } = e.data;\n if (type === 'start') {\n timers.set(taskId, setInterval(() => {\n self.postMessage({ type: 'tick', taskId });\n }, delay));\n } else if (type === 'stop') {\n clearInterval(timers.get(taskId));\n timers.delete(taskId);\n }\n };\n "],{type:"application/javascript"}))),e.sharedWorker.onmessage=t=>{var i;if("tick"===t.data.type){let r=e.workerTasks.get(t.data.taskId);r&&(e.isBreakLoop(r)?(null==(i=e.sharedWorker)||i.postMessage({type:"stop",taskId:r.taskID}),e.workerTasks.delete(r.taskID)):(r.callback(),r.loopCount+=1))}}),e.workerTasks.set(t.taskID,t),e.sharedWorker.postMessage({taskId:t.taskID,delay:t.delay,type:"start"})}static timeout(t){let i=()=>{if(t.callback(),t.loopCount+=1,!e.isBreakLoop(t))return t.timeoutID=setTimeout(i,t.delay)};return t.timeoutID=setTimeout(i,t.delay)}static ric(t){let i,r=Vk(),n=()=>{if(i=Vk()-r,i>=t.delay&&(r=Vk()-Math.floor(i%t.delay),t.callback(),t.loopCount+=1),!e.isBreakLoop(t))return t.ricID=HN(n,{timeout:t.delay})};return t.ricID=HN(n,{timeout:t.delay})}static raf(t){let i,r=Vk(),n=()=>document.hidden&&t.backgroundTask?(i=Vk()-r,r=Vk(),t.callback(),t.loopCount+=1,e.isBreakLoop(t)?void 0:t.timeoutID=setTimeout(n,t.delay-Math.floor(i%t.delay))):(i=Vk()-r,i>=t.delay&&(r=Vk()-Math.floor(i%t.delay),t.callback(),t.loopCount+=1),e.isBreakLoop(t)?void 0:t.rafID=requestAnimationFrame(n));if(t.rafID=requestAnimationFrame(n),t.backgroundTask){let e=()=>{if(document.hidden){let e=Vk()-r;e>=t.delay?n():t.timeoutID=setTimeout(n,t.delay-e)}};document.addEventListener("visibilitychange",e),t.onVisibilitychange=e,document.hidden&&e()}return t.taskID}static hasTask(e){return this.taskMap.has(e)}static clearTask(e){if(!this.taskMap.has(e))return!0;let{intervalID:t,timeoutID:i,rafID:r,ricID:n,onVisibilitychange:a}=this.taskMap.get(e);return t&&clearInterval(t),i&&clearTimeout(i),r&&jN&&jN(r),n&&zN(n),a&&document.removeEventListener("visibilitychange",a),this.taskMap.delete(e),!0}static isBreakLoop(e){return!this.hasTask(e.taskID)||0!==e.count&&e.loopCount>=e.count&&(this.clearTask(e.taskID),!0)}};hA(WN,"taskMap",new Map),hA(WN,"currentTaskID",1),hA(WN,"sharedWorker",null),hA(WN,"workerTasks",new Map);var GN=WN,qN={LOAD_START:XA,LOADED_DATA:ZA,LOADED_META_DATA:JA,MEDIA_TRACK_CHANGED:"media-track-changed",PLAYER_STATE_CHANGED:"player-state-changed",ERROR:"error",AUTOPLAY_FAILED:"autoplay-failed",RESIZE:iR,TIME_UPDATE:"time-update"},KN={};lA(KN,{create:()=>XN,remove:()=>ZN});var YN=new WeakMap;function XN(e,t){YN.has(e)||YN.set(e,[]);let i=YN.get(e),r={add:(e,n)=>("addEventListener"in t?(i.push(t.removeEventListener.bind(t,e,n)),t.addEventListener(e,n)):(i.push(t.off.bind(t,e,n)),t.on(e,n)),r)};return r}function ZN(e){let t=YN.get(e);t&&(t.forEach((e=>e())),YN.delete(e))}var JN=new class{constructor(){hA(this,"_roomIdMap",new Map),hA(this,"_configs"),"undefined"==typeof registerProcessor&&(this._configs={sdkAppId:"",userId:"",version:RA,env:xA,browserVersion:$D.name+$D.version,ua:navigator.userAgent})}setConfig(e){let{sdkAppId:t,env:i,userId:r,roomId:n}=e;t!==this._configs.sdkAppId&&(this._configs.sdkAppId=String(t)),this._configs.env=i,this._configs.userId=r,this._roomIdMap.set(r,String(n))}logSuccessEvent(e){JD||!lO.isAbleToUpload||this._configs.env===xA&&this.uploadEventToKibana(oA(aA({},e),{result:"success"}))}logFailedEvent(e){if(JD||!lO.isAbleToUpload)return;let{eventType:t,code:i,error:r,userId:n}=e,a={roomId:this._roomIdMap.get(n||this._configs.userId),userId:n,eventType:t,result:"failed",code:i||(null==r?void 0:r.extraCode)||(null==r?void 0:r.code)||LR.UNKNOWN};this._configs.env===xA&&this.uploadEventToKibana(oA(aA({},a),{error:r}))}uploadEventToKibana(e){let t="stat-".concat(e.eventType,"-").concat(e.result);("delta-join"===e.eventType||"delta-leave"===e.eventType||"delta-publish"===e.eventType)&&(t="".concat(e.eventType,":").concat(e.delta)),this.uploadEvent({log:t,userId:e.userId}),"failed"===e.result&&(t="stat-".concat(e.eventType,"-").concat(e.result,"-").concat(e.code),this.uploadEvent({log:t,userId:e.userId,error:e.error}))}uploadEvent(e){let{log:t,userId:i,error:r}=e,n={timestamp:UR(),sdkAppId:this._configs.sdkAppId,userId:i||this._configs.userId,version:RA,log:t};r&&(n.errorInfo=r.message,r.stack&&(n.errorInfo+="\n".concat(r.stack)));let a=sO.enable?mC(n,2002,Number(this._configs.sdkAppId)):JSON.stringify(n);this.sendRequest(ok(this._configs.sdkAppId,LA),a)}sendRequest(e,t){setTimeout((()=>IC({url:e,body:t,priority:"low"}).catch((()=>{}))),2e3)}},QN=new WeakMap;var $N=class extends BN{constructor(e,t){super(e.id,"".concat(t,"-player")),this.options=e,this.kind=t,hA(this,"id"),hA(this,"element",null),hA(this,"track"),hA(this,"url"),hA(this,"attr"),hA(this,"mode"),hA(this,"muted"),hA(this,"_log"),hA(this,"_isPausedByUserCall",!1),hA(this,"_pausedRetryCount"),hA(this,"_isElementPlayingFired",!1),hA(this,"_interval"),hA(this,"_delayDestroyTimeoutId",0),hA(this,"_playSuccessResolve"),hA(this,"_isReplayByRecreateMediaStreamCalled",!1),hA(this,"isPlayCalled",!1),hA(this,"isInAutoPlayFailedState",!1),this.id=e.id,this._log=e.log,this.track=e.track,this.muted=e.muted,this._pausedRetryCount=5,this._state="STOPPED",this.bindTrackEvents(),this._log.info("create ".concat(t,"-player ").concat(this.id))}get isPlaying(){var e;return"PLAYING"===this._state&&!1===(null==(e=this.element)?void 0:e.paused)}get isPaused(){var e;return"PAUSED"===this._state||!0===(null==(e=this.element)?void 0:e.paused)}get isStopped(){return"STOPPED"===this._state}setAttr(e){this.attr=e}setUrl(e){this.track&&(this.unbindTrackEvents(),this.element&&(this.element.srcObject=null),this.track=null),e!==this.url&&(this.url=e,null!==e&&this.element&&(this.element.crossOrigin="anonymous",this.element.src=e))}async play(){if(!this.isPlaying)try{this.isPlayCalled=!0,this._delayDestroyTimeoutId&&(clearTimeout(this._delayDestroyTimeoutId),this._delayDestroyTimeoutId=0,this.bindTrackEvents(),this.bindElementEvents()),this.bindAutoPlayEvent(),await new Promise(((e,t)=>{this._playSuccessResolve=e,this.element.play().then(e,t)}))}catch(Jx){let t=gO({key:hO.PLAY_FAILED,data:{media:this.kind,error:Jx}});if(this._log.warn(Jx),t.includes("NotAllowedError"))throw this.isInAutoPlayFailedState=!0,new PR({code:LR.PLAY_NOT_ALLOWED,message:t})}}stop(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;var t;this.isPlayCalled=!1,this._isElementPlayingFired=!1,this.unbindEvents(),e>0&&!WD?this._delayDestroyTimeoutId||(null==(t=this.element)||t.remove(),this._log.info("destroy element after 3 * ".concat(e)),this._delayDestroyTimeoutId=setTimeout((()=>this.destroyElement()),3*e)):this.destroyElement(),this.handleStopped(GA),this._interval>0&&GN.clearTask(this._interval)}destroyElement(){this.element&&(this._log.debug("destroy element"),this.element.remove(),this.element.src="",this.element.srcObject=null,this.element=null),clearTimeout(this._delayDestroyTimeoutId),this._delayDestroyTimeoutId=0}pause(){var e;this._log.info("pause"),this._isPausedByUserCall=!0,null==(e=this.element)||e.pause()}resume(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return this._isPausedByUserCall=!1,this.doResume(e)}doResume(){return this._log.info("resume"),this._isPausedByUserCall||this.isPlaying?Promise.resolve():YD?this.replay():this.play().catch((()=>{}))}setMuted(e){this.element&&(this.element.muted=e),this.muted=e}replay(){return this.stop(),this.play().catch((()=>{}))}bindElementEvents(){if(this.element){let e=this.handleElementEvent.bind(this);return XN(this.element,this.element).add(qA,e).add(GA,e).add(KA,e).add(YA,e).add(XA,e).add(ZA,e).add(JA,e)}}bindTrackEvents(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.track;if(e){let t=this.handleTrackEvent.bind(this);null==KN||KN.create(e,e).add(GA,t).add(jA,t).add(WA,t),e.readyState===GA&&this.handleTrackEvent({type:GA}),e.muted&&this.handleTrackEvent({type:jA})}}bindAutoPlayEvent(){aO.on(oO.AUTOPLAY_DIALOG_CLICK_CONFIRM,this.resume,this)}unbindTrackEvents(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.track;e&&ZN(e)}unbindEvents(){this.element&&ZN(this.element),this.unbindTrackEvents(),aO.off(oO.AUTOPLAY_DIALOG_CLICK_CONFIRM,this.resume,this)}handleElementEvent(e){switch(e.type){case qA:vL()||(this.isInAutoPlayFailedState=!1),this._isElementPlayingFired=!0,this._log.info("".concat(this.kind," player is playing")),this.handlePlaying(qA),this._interval&&(GN.clearTask(this._interval),this._interval=-1);break;case GA:this._log.info("".concat(this.kind," player is ended")),this.handleStopped(GA);break;case KA:this._log.info("".concat(this.kind," player is paused")),this.handlePaused(KA),VC&&(this._interval=GN.run("timeout",(()=>{this.element&&"PAUSED"===this._state&&!this._isPausedByUserCall&&this.doResume()}),{delay:3e3}));break;case YA:if(this.element&&this.element.error){this.handlePaused(YA);let{code:e,message:t}=this.element.error;this._log.error("".concat(this.kind," ").concat(this._log.isLocal?"local":"remote"," MediaError code: ").concat(e," message: ").concat(t," userAgent: ").concat(navigator.userAgent)),JN.uploadEvent({log:"stat-".concat(this.kind,"-").concat(rR,"-").concat(e,"-").concat(navigator.userAgent),error:this.element.error}),RD||AD?this.emit(qN.ERROR,this.element.error):this.replayByRecreateMediaStream(this.element.error)}break;case ZA:this.kind===VA&&this.emit(qN.LOADED_DATA);break;case JA:this.kind===VA&&this.emit(qN.LOADED_META_DATA);break;case XA:this.emit(qN.LOAD_START)}}replayByRecreateMediaStream(e){if(!this._isReplayByRecreateMediaStreamCalled)return this._isReplayByRecreateMediaStreamCalled=!0,this.doReplayByRecreateMediaStream(1e3).then((()=>{this._log.warn("replayByRecreateMediaStream success"),JN.uploadEvent({log:"stat-replayByRecreateMediaStream-success"}),wO.addSuccessEvent({key:this.kind===BA?506700:516700})})).catch((()=>{var t;this._log.error("replayByRecreateMediaStream failed"),JN.uploadEvent({log:"stat-replayByRecreateMediaStream-failed"}),wO.addFailedEvent({key:this.kind===BA?506700:516700,error:null==(t=this.element)?void 0:t.error}),this.emit(qN.ERROR,e)}))}doReplayByRecreateMediaStream(e){return this._log.warn("delay ".concat(e,"ms to recreate mediaStream")),new Promise(((t,i)=>{oC(e).then((()=>{this.element&&(this.element.srcObject=null,this.element.srcObject=new MediaStream([this.track]),this._log.warn("recreated mediaStream"),this.element.onerror=()=>{var e,t,r;this._log.warn("element onerror ".concat(null==(t=null==(e=this.element)?void 0:e.error)?void 0:t.code," fired after recreated mediaStream")),i(null==(r=this.element)?void 0:r.error)}),oC(5e3).then((()=>{var e,r;(!this.isPlaying||null!=(e=this.element)&&e.error)&&i(null==(r=this.element)?void 0:r.error),t()}))}))})).finally((()=>{this.element&&(this.element.onerror=null)}))}async handleTrackEvent(e){let t=e.type;switch(this.options.enableLogTrackState&&this._log[t===WA?"info":"warn"]("track ".concat(t)),t){case GA:this.handleStopped(GA);break;case jA:this.handlePaused(jA);break;case WA:this.mode>0?this.handlePlaying(this.mode.toString()):this.element&&(this.element.paused&&!this._isPausedByUserCall&&(this._log.warn("track unmuted and element is paused, resume"),await this.doResume()),this.element&&!this.element.paused&&this._isElementPlayingFired&&this.handlePlaying(WA))}}handlePlaying(e){var t;return this._log.debug("handlePlaying",e),null==(t=this._playSuccessResolve)||t.call(this,e),e}handlePaused(e){return this._log.debug("handlePaused",e),e}handleStopped(e){return this._log.debug("handleStopped",e),e}getElement(){return this.element}};hA($N,"PlayerEvent",qN),uA([function(e){let{settings:t={retries:5,timeout:2e3},onError:i,onRetrying:r,onRetryFailed:n}=e;return function(e,a,o){let s=CC({retryFunction:o.value,settings:t,onError(t){let{error:r,retry:n,reject:o,retryFuncArgs:s}=t;var c;i?i.call(this,r,(()=>{var t;null!=(t=QN.get(e))&&t.has(a)?n():o(r)}),o,s):null!=(c=QN.get(e))&&c.has(a)?n():o(r)},onRetrying(t,i){var n;SC(r)&&r.call(this,t,i),null!=(n=QN.get(e))&&n.has(a)&&(QN.get(e).get(a).stopRetry=i)},onRetryFailed:n});return o.value=function(){let t=QN.get(e);for(var i=arguments.length,r=new Array(i),n=0;n<i;n++)r[n]=arguments[n];return t?t.set(a,{args:r}):QN.set(e,new Map([[a,{args:r}]])),s.apply(this,r).finally((()=>{var t;return null==(t=QN.get(e))?void 0:t.delete(a)}))},o}}({settings:{retries:2,timeout:0},onError(e,t,i,r){r[0]=(r[0]||1e3)+1e3,t()}})],$N.prototype,"doReplayByRecreateMediaStream",1),uA([MN([],"PLAYING",{sync:!0,success(e){this.emit(qN.PLAYER_STATE_CHANGED,{type:this.kind,state:"PLAYING",reason:e})}})],$N.prototype,"handlePlaying",1),uA([MN("PLAYING","PAUSED",{ignoreError:!0,sync:!0,success(e){this.emit(qN.PLAYER_STATE_CHANGED,{type:this.kind,state:"PAUSED",reason:e})}})],$N.prototype,"handlePaused",1),uA([MN([],"STOPPED",{sync:!0,success(e){this.emit(qN.PLAYER_STATE_CHANGED,{type:this.kind,state:"STOPPED",reason:e})}})],$N.prototype,"handleStopped",1);var eL="trtc_autoplay",tL="".concat(eL,"_mask"),iL="".concat(eL,"_wrapper"),rL="".concat(eL,"_header"),nL="".concat(eL,"_content"),aL="".concat(eL,"_action_wrapper"),oL="".concat(eL,"_question"),sL="".concat(eL,"_collapse"),cL="".concat(eL,"_action_confirm"),lL="".concat(eL,"_detail"),dL="#2473E8",uL="dialog",hL="".concat(uL,"-show"),pL="".concat(uL,"-1"),fL="".concat(uL,"-2"),mL=!1,gL=!1,vL=()=>gL,_L="".concat(DA,"/").concat(Ek()?"zh-cn":"en","/tutorial-21-advanced-auto-play-policy.html"),yL="<br><a href='".concat(_L,"' target='_blank'>").concat(Ek()?"其他方案?":"Any other solution?","</a>"),EL="".concat(Ek()?"浏览器自动播放策略:在用户与页面产生交互(点击、触摸)之前,浏览器禁止播放有声媒体。该弹窗用于帮助用户恢复音视频播放。".concat(yL):"Autoplay Policy: Before user interacts with the web page (clicking, touching), page will not be allowed to play media with sound. This Dialog is used to help users resume playback. ".concat(yL)),bL=class{constructor(){if(hA(this,"content","音视频播放被浏览器拦截,请点击“恢复播放”。"),hA(this,"_dialogNode",null),hA(this,"_bodyPosition",""),hA(this,"_showDetail",!1),hA(this,"_isCollapseClicked",!1),hA(this,"_isQuestionClicked",!1),Ek()||(this.content='Media playback failed. Click the "Resume" to resume playback.'),!mL){let e=document.createElement("style");e.innerHTML=".".concat(tL,"{position:fixed;top:0;left:0;right:0;bottom:0;width:100vw;height:100vh;display:flex;justify-content:center;align-items:center;background:rgba(0,0,0,0.5);z-index:1500;}.").concat(tL," div:not(.").concat(aL,"){display:block !important;}.").concat(iL,"{padding:14px;background:#fff;border-radius:3px;box-shadow:0px 3px 15px #434343;border:1px solid #d1cfcf;max-width:500px;}.").concat(iL," a{color:").concat(dL,";}.").concat(rL,"{overflow:hidden;text-overflow:ellipsis;font-size:16px;font-weight:600;}.").concat(nL,"{margin:8px 0;}.").concat(aL,"{width:100%;display:flex !important;align-items:center;justify-content:right;float:right;}.").concat(sL,"{margin-right:auto;cursor:pointer}.").concat(oL,"{height:100%;line-height:16px;cursor:pointer;}.").concat(cL,"{margin-left:8px;color:#fff;background:").concat(dL,";padding:4px 12px;outline:none;border:1px solid;border-radius:3px;font-weight:bold;}.").concat(cL,":hover{opacity:0.9;}.").concat(sL,",.").concat(cL,",.").concat(nL,",.").concat(oL,"{font-size:14px;}@media screen and (max-width:750px){.").concat(iL,"{width:80vw;}}"),document.head.appendChild(e),mL=!0}this.addDiaLog()}createDiaLog(){let e=document.createElement("template");e.innerHTML='<div class="'.concat(tL,"\"><div class='").concat(iL,"'><div class='").concat(rL,"'>").concat(location.host,"</div><div class='").concat(nL,"'>").concat(this.content,"</div><div class='").concat(lL,'\' style="visibility:hidden;width:100%;height:0;font-size:12px;color:gray;">').concat(EL,"</div><div class='").concat(aL,"'></div></div></div>").trim();let t=document.createElement("button");t.className=cL,t.innerText=Ek()?"恢复播放":"Resume",t.onclick=this.onConfirm.bind(this);let i=document.createElement("div");i.className=oL,i.innerHTML='<?xml version="1.0" encoding="UTF-8"?>\n <svg class="icon" width="18" height="18" p-id="2030" t="1639646523624" version="1.1" viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg">\n <path d="m464 784.35c0 26.51 21.49 48 48 48s48-21.49 48-48-21.49-48-48-48-48 21.49-48 48z" p-id="2031"/>\n <path d="m512 960c-247.04 0-448-200.96-448-448s200.96-448 448-448 448 200.96 448 448-200.96 448-448 448zm0-831.71c-211.58 0-383.71 172.13-383.71 383.71 0 211.55 172.13 383.71 383.71 383.71 211.55 0 383.71-172.16 383.71-383.71 0-211.58-172.16-383.71-383.71-383.71z" p-id="2032"/>\n <path d="m512 673.7c-17.665 0-32.001-14.336-32.001-31.999v-54.112c0-52.353 40-92.352 75.328-127.65 25.887-25.92 52.672-52.672 52.672-74.017 0-53.343-43.072-96.735-95.999-96.735-53.823 0-95.999 41.536-95.999 94.559 0 17.665-14.336 31.999-32.001 31.999s-32.001-14.336-32.001-31.999c0-87.424 71.775-158.56 160-158.56s160 72.095 160 160.74c0 47.904-36.32 84.192-71.424 119.3-27.84 27.776-56.576 56.512-56.576 82.336v54.112c0 17.665-14.336 32.032-32.001 32.032z" p-id="2033"/>\n </svg>\n ',i.onclick=this.onQuestionClick.bind(this);let r=document.createElement("div");r.className=sL,r.innerText="".concat(Ek()?"详情 >":"Detail >"),r.onclick=this.onCollapseClick.bind(this);let n=e.content.firstChild,a=n.querySelector(".".concat(aL));return a.appendChild(r),a.appendChild(i),a.appendChild(t),n}addDiaLog(){vL()||(gL=!0,this._dialogNode=this.createDiaLog(),document.body.appendChild(this._dialogNode),this._dialogNode.onclick=this.onConfirm.bind(this),this._dialogNode.querySelector(".".concat(iL)).onclick=e=>e.stopPropagation(),this._bodyPosition=document.body.style.position,document.body.style.position="fixed",lO.info("show autoplay dialog"),JN.uploadEvent({log:hL}))}deleteDialog(){this._dialogNode&&(document.body.removeChild(this._dialogNode),document.body.style.position=this._bodyPosition,this._dialogNode=null,gL=!1)}onConfirm(){lO.warn("confirm clicked, try resume stream"),aO.emit(oO.AUTOPLAY_DIALOG_CLICK_CONFIRM),this.deleteDialog()}onCollapseClick(){let e=this._dialogNode.querySelector(".".concat(lL));e.style.visibility="".concat(this._showDetail?"hidden":"visible"),e.style.height="".concat(this._showDetail?0:"fit-content"),this._showDetail=!this._showDetail,this._isCollapseClicked||JN.uploadEvent({log:pL}),this._isCollapseClicked=!0}onQuestionClick(){window.open(_L,"_blank"),this._isQuestionClicked||JN.uploadEvent({log:fL}),this._isQuestionClicked=!0}},wL=null;var IL,TL=class extends $N{constructor(e){super(e,VA),hA(this,"stat",{}),hA(this,"_calculateTimeout",-1),hA(this,"viewMirror",!1),hA(this,"objectFit","cover"),hA(this,"container"),hA(this,"canvas"),hA(this,"shouldRenderAlpha",!1),hA(this,"_preSize",{width:0,height:0}),hA(this,"posterImg"),hA(this,"_originContainerPosition"),this.mode=e.canvas?1:0,this.container=e.container,this.canvas=e.canvas,Ak(e.viewMirror)||(this.viewMirror=e.viewMirror),Ak(e.objectFit)||(this.objectFit=e.objectFit),this.initializeElement()}get isPlaying(){var e;return!("PLAYING"!==this._state||this.element&&this.element.paused)&&("live"===(null==(e=this.track)?void 0:e.readyState)&&!this.track.muted)}initializeElement(){var e;let t=document.createElement(VA);this.track&&2!==this.mode&&(t.srcObject=new MediaStream([this.track])),t.muted=!0,t.setAttribute("id","video_".concat(this.id)),t.setAttribute("style",this.styleAttribute),this.canvas&&this.canvas.setAttribute("style",this.styleAttribute),t.setAttribute("autoplay","autoplay"),t.setAttribute("playsinline","playsinline"),this.element=t,zC&&(t.poster="noposter"),null==(e=this.container)||e.appendChild(this.elementToRender),this.bindElementEvents(),this.calculateStat()}get styleAttribute(){let e="width:100%;height:100%;object-fit:".concat(this.objectFit,";").concat(this.shouldRenderAlpha?"":"background-color:black",";");return this.viewMirror&&(e+="transform:scaleX(-1);"),e}setContainer(e){var t;this.container=e,this.track&&this.elementToRender&&(null==(t=this.container)||t.appendChild(this.elementToRender))}bindElementEvents(){let e=super.bindElementEvents();this.handleElementEvent=this.handleElementEvent.bind(this),e&&e.add(eR,this.handleElementEvent).add(tR,this.handleElementEvent).add(iR,this.handleElementEvent)}handleTrackEvent(e){var t;return e.type===jA&&null!=(t=this.stat)&&t.fps&&(this.stat.fps=0),super.handleTrackEvent(e)}handleElementEvent(e){var t,i,r,n,a,o;if(2===this.mode)return;super.handleElementEvent(e);let s=e.type;if(s===KA&&(this.container&&!this.container.isConnected&&(this._log.warn("".concat(this.kind," player has been remove, element ID: ").concat(this.container.id)),oC(500).then((()=>{var e;null!=(e=this.container)&&e.isConnected&&(this._pausedRetryCount=5,this._log.info("view container ".concat(this.container.id," is in dom, reset pausedRetryCount")))}))),this._pausedRetryCount>0&&!vL()&&!this._isPausedByUserCall&&(this._log.info("[".concat(5-this._pausedRetryCount+1,"/").concat(5,"] ").concat(this.kind," player auto resume when paused")),this.doResume(),this._pausedRetryCount--),this.stat.fps&&(this.stat.fps=0)),this.viewMirror&&this.element){let e=this.element.style.transform;s===eR?this.element.style.transform=e.replace("scaleX(-1)",""):s===tR&&!e.includes("scaleX")&&(this.element.style.transform="".concat(e," scaleX(-1)"))}s===iR&&(this._preSize.height!==(null==(t=this.element)?void 0:t.videoHeight)||this._preSize.width!==(null==(i=this.element)?void 0:i.videoWidth))&&(this._log.info("video size changed to ".concat(null==(r=this.element)?void 0:r.videoWidth,"x").concat(null==(n=this.element)?void 0:n.videoHeight)),this._preSize.height=(null==(a=this.element)?void 0:a.videoHeight)||0,this._preSize.width=(null==(o=this.element)?void 0:o.videoWidth)||0,this.emit(qN.RESIZE,{newWidth:this._preSize.width,newHeight:this._preSize.height}))}setCanvas(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;var i,r,n,a;this.canvas!==e&&(null==(i=this.canvas)||i.remove(),null==e||e.setAttribute("style",this.styleAttribute),this.canvas=e,this.mode=e?t:0,2===this.mode&&this.setTrack(e.captureStream().getVideoTracks()[0]),e?(null==(r=this.element)||r.remove(),null==(n=this.container)||n.appendChild(e)):this.element&&(null==(a=this.container)||a.appendChild(this.element)))}setAttr(e){let t=Object.assign({autoplay:"autoplay",playsinline:"playsinline",muted:!0},e);t.style=Object.assign({width:"100%",height:"100%"},t.style),super.setAttr(t)}get mirror(){return this.viewMirror}setRect(e,t){this.elementToRender&&(this.elementToRender.style.width="".concat(e,"px"),this.elementToRender.style.height="".concat(t,"px"))}setViewMirror(e){this.elementToRender&&(this.elementToRender.style.transform=e?"scaleX(-1)":""),this.viewMirror=e}setObjectFit(e){this.elementToRender&&(this.elementToRender.style.objectFit="".concat(e)),this.objectFit=e}setPoster(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return new Promise((i=>{if(!this.element||(this._log.info("setPoster",e.slice(0,10)),""===e?this.element.removeAttribute("poster"):this.element.poster=e,!t||!jD&&!WC))return i();if(""===e)return this.removePosterImg(),i();if(this.posterImg)return i();let r=document.createElement("img");r.src=e;let n=window.getComputedStyle(this.element).objectFit||this.objectFit;r.style="position:absolute;top:0;left:0;width:100%;height:100%;object-fit:".concat(n,";"),r.onload=async()=>{var e;try{r.decode&&await r.decode(),this.container&&"static"===window.getComputedStyle(this.container).position&&(this._originContainerPosition=this.container.style.position,this.container.style.position="relative"),this.posterImg=r,null==(e=this.container)||e.appendChild(r)}catch(t){this._log.warn("decode poster image error",t)}return i()},r.onerror=()=>(this._log.warn("load poster image error"),i())}))}removePosterImg(){this.posterImg&&(this.posterImg.remove(),URL.revokeObjectURL(this.posterImg.src),this.container&&!Ak(this._originContainerPosition)&&"relative"===this.container.style.position&&(this.container.style.position=this._originContainerPosition),delete this.posterImg)}get hasPoster(){var e;return!!this.posterImg||!(null==(e=this.element)||!e.getAttribute("poster"))}async pause(){let e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];return!this.hasPoster&&(FD&&HD>=128||e&&(WC||jD))&&await this.setPoster(this.getVideoFrame(),!0),super.pause()}resume(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return super.resume(e).then((()=>{var e;(this.posterImg||null!=(e=this.element)&&e.poster)&&this.setPoster("",!0)}))}doResume(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return this.isPaused&&e&&this.element&&this.track&&FD&&HD>=128&&"video"===this.track.kind&&(this.element.srcObject=new MediaStream([this.track])),super.doResume()}stop(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;var t;this.isPictureInPicture()&&this.exitPictureInPicture().catch((e=>{})),this.isFullscreen()&&this.exitFullscreen().catch((e=>{})),super.stop(e),null==(t=this.canvas)||t.remove(),this.removePosterImg()}play(){return this.element?this.elementToRender&&this.elementToRender.parentElement!==this.container&&this.container&&this.container.append(this.elementToRender):this.initializeElement(),2===this.mode?Promise.resolve():super.play()}get elementToRender(){return this.canvas||this.element}setTrack(e){e!==this.track&&(this.unbindTrackEvents(),this.track=e,this.emit(qN.MEDIA_TRACK_CHANGED,e),null!==e&&(this.bindTrackEvents(),this.element&&2!==this.mode&&(this.element.srcObject=new MediaStream([e]),this.element.remove()),this.elementToRender&&this.elementToRender.parentElement!==this.container&&this.container&&this.container.append(this.elementToRender)))}getVideoFrame(){if(this.canvas)return this.canvas.toDataURL("image/png");if(!this.element)return"";let e=document.createElement("canvas");return e.width=this.element.videoWidth,e.height=this.element.videoHeight,e.getContext("2d").drawImage(this.element,0,0),e.toDataURL("image/png")}getElement(){return this.element}calculateStat(){try{if(wN()&&this.element&&this._calculateTimeout<0){let e=0,t=null,i=(r,n)=>{this.stat.width=n.width,this.stat.height=n.height,t&&(this.stat.fps=Math.round((n.presentedFrames-t.presentedFrames)/(r-e)*1e3)),e=r,t=n,this._calculateTimeout=-1,this.element&&(this._calculateTimeout=setTimeout((()=>{var e;return null==(e=this.element)?void 0:e.requestVideoFrameCallback(i)}),2e3))};this.element.requestVideoFrameCallback(i)}}catch(Jx){this._log.warn("init stat failed",Jx)}}async enterFullscreen(){let e=this.elementToRender;if(!e)throw this._log.warn("no element to render, cannot enter fullscreen"),new Error("No element available for fullscreen");try{if(e.requestFullscreen)await e.requestFullscreen();else if(e.webkitRequestFullscreen)await e.webkitRequestFullscreen();else if(e.webkitEnterFullscreen)await e.webkitEnterFullscreen();else if(e.mozRequestFullScreen)await e.mozRequestFullScreen();else{if(!e.msRequestFullscreen)throw this._log.warn("fullscreen API not supported"),new Error("Fullscreen API not supported");await e.msRequestFullscreen()}this._log.info("entered fullscreen mode")}catch(TA){throw this._log.error("failed to enter fullscreen:",TA),TA}}async exitFullscreen(){try{if(document.exitFullscreen)await document.exitFullscreen();else if(document.webkitExitFullscreen)await document.webkitExitFullscreen();else if(document.mozCancelFullScreen)await document.mozCancelFullScreen();else{if(!document.msExitFullscreen)throw this._log.warn("exit fullscreen API not supported"),new Error("Exit fullscreen API not supported");await document.msExitFullscreen()}this._log.info("exited fullscreen mode")}catch(Jx){throw this._log.error("failed to exit fullscreen:",Jx),Jx}}isFullscreen(){let e=this.elementToRender;return!!e&&(document.fullscreenElement||document.webkitFullscreenElement||document.mozFullScreenElement||document.msFullscreenElement)===e}async toggleFullscreen(){this.isFullscreen()?await this.exitFullscreen():await this.enterFullscreen()}async enterPictureInPicture(){var e;try{if(!this.element)throw new Error("No video element available for pip");if(this.canvas&&1!==this.mode)throw new Error("pip is not supported for canvas-only mode");let{element:t}=this;if(t.requestPictureInPicture){this._log.info("requestPictureInPicture");let i=await t.requestPictureInPicture();return this._log.info("entered pip mode"),this.elementToRender===this.canvas&&(this.canvas.remove(),null==(e=this.container)||e.appendChild(this.element)),i}if(t.webkitSetPresentationMode)return this._log.info("webkitSetPresentationMode"),await t.webkitSetPresentationMode("picture-in-picture"),this._log.info("entered picture-in-picture mode (webkit)"),{};throw new Error("Picture-in-picture API not supported")}catch(TA){throw this._log.error("failed to enter picture-in-picture:",TA.name,TA.message),TA}}async exitPictureInPicture(){var e,t;try{if(document.pictureInPictureElement&&document.exitPictureInPicture)await document.exitPictureInPicture(),this.elementToRender===this.canvas&&(null==(e=this.element)||e.remove(),this._pausedRetryCount=5,null==(t=this.container)||t.appendChild(this.canvas)),this._log.info("exited pip mode");else{if(!this.element||!this.element.webkitSetPresentationMode)throw this._log.warn("exit picture-in-picture API not supported or not in PiP mode"),new Error("Exit picture-in-picture API not supported or not in PiP mode");await this.element.webkitSetPresentationMode("inline"),this._log.info("exited picture-in-picture mode (webkit)")}}catch(i){throw this._log.error("failed to exit picture-in-picture:",i),i}}isPictureInPicture(){if(!this.element)return!1;let{element:e}=this;return document.pictureInPictureElement?document.pictureInPictureElement===e:!!e.webkitPresentationMode&&"picture-in-picture"===e.webkitPresentationMode}async togglePictureInPicture(){this.isPictureInPicture()?await this.exitPictureInPicture():await this.enterPictureInPicture()}};"undefined"!=typeof AudioContext?IL=AudioContext:"undefined"!=typeof webkitAudioContext?IL=webkitAudioContext:"undefined"!=typeof mozAudioContext&&(IL=mozAudioContext);var SL,AL=-1,RL=0,kL=-1,CL=!1,DL=0,OL=-1,NL=-1;!function e(){try{if(SL)return;(SL=new IL({sampleRate:48e3})).onstatechange=()=>{lO.info("context state: ".concat(SL.state).concat("running"!==SL.state?" visibilityState: ".concat(document.visibilityState):"")),LL()},clearTimeout(AL)}catch(KS){lO.error("initAudioContext failed: ".concat(KS," typeof AudioContextClass: ").concat(typeof IL)),AL=setTimeout(e,1e3)}}();var LL=()=>{"suspended"===SL.state?(RL=Vk(),-1===kL&&(kL=setTimeout((()=>{"suspended"===SL.state&&(CL=!0,aO.emit("155",{isSuspended:!0}))}),1500)),ML(),document.addEventListener("click",LL)):"interrupted"===SL.state?ML():(RL&&(wO.addNumber({key:507800,value:Vk()-RL,split:[0,500,1e3,1500,2e3,3e3,4e3,5e3,1e4,3e4],max:6e4}),RL=0),-1!==kL&&(clearTimeout(kL),kL=-1,CL&&(CL=!1,aO.emit("155",{isSuspended:!1}))),document.removeEventListener("visibilitychange",LL),document.removeEventListener("click",LL))},xL=0,PL=-1;function ML(){return new Promise(((e,t)=>{if("running"===SL.state)return e();Date.now()-xL<1e3?(clearTimeout(PL),PL=setTimeout((()=>{xL=Date.now(),SL.resume().then(e,t)}),1e3)):(clearTimeout(PL),xL=Date.now(),SL.resume().then(e,t))})).catch((e=>{lO.warn("context resume failed: ".concat(e)),document.addEventListener("visibilitychange",LL)}))}document.addEventListener("click",LL);var UL=e=>SL,FL=class{constructor(e){this.name=e,hA(this,"node"),hA(this,"node2"),hA(this,"pre",new Set),hA(this,"next",new Set),hA(this,"context"),hA(this,"connectedNodes",new Set),hA(this,"nextInputChannelMap",new Map),hA(this,"_channelCount",1)}get channelCount(){return this._channelCount}set channelCount(e){this._channelCount=e,this.setChannelCount(this.node,e),this.setChannelCount(this.node2,e),this.next.forEach((t=>t.channelCount=e))}setChannelCount(e,t){!e||e instanceof ScriptProcessorNode||(e.channelCountMode="explicit",e.channelCount=t||this.channelCount||1)}setContext(e){this.context=e,this.node&&e.addMixWeight()}removeContext(){var e;this.node&&(null==(e=this.context)||e.reduceMixWeight()),delete this.context}replaceNode(e){var t;if(e!==this.node)try{this.node?this._disconnect():null==(t=this.context)||t.addMixWeight(),this.node=e,this.setChannelCount(this.node),this.preNodeReconnect(),this.reconnect()}catch(TA){lO.error(TA)}}setNode(e,t){var i;if(!this.node)try{null==(i=this.context)||i.addMixWeight(),this.node=e,this.setChannelCount(this.node),t&&(this.node2=t,this.setChannelCount(this.node2)),this.preNodeReconnect(),this.reconnect(),wO.addSuccessEvent({key:502701})}catch(r){lO.error(r),wO.addFailedEvent({key:502701,error:r})}}deleteNode(){var e;if(this.node)try{this._disconnect(),delete this.node,delete this.node2,null==(e=this.context)||e.reduceMixWeight(),this.preNodeReconnect(),wO.addSuccessEvent({key:502702})}catch(Jx){lO.error(Jx),wO.addFailedEvent({key:502702,error:Jx})}}preNodeReconnect(){this.pre.forEach((e=>{e.node?e.reconnect():e.preNodeReconnect()}))}connectNext(e){this.next.forEach((t=>{let i=this.nextInputChannelMap.get(t);e._connect(t.node,i)||t.connectNext(e)}))}_connect(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return!(!this.node||!e)&&((this.node2||this.node).connect(e,0,t),this.connectedNodes.add(e),!0)}_disconnect(){this.connectedNodes.forEach((e=>{var t;return null==(t=this.node2||this.node)?void 0:t.disconnect(e)})),this.connectedNodes.clear()}reconnect(){this._disconnect(),this.connectNext(this)}pipeTo(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return this.next.add(e),e.pre.add(this),this.nextInputChannelMap.set(e,t),e}},BL=class extends FL{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:256;super(),this.fftSize=e,hA(this,"dataArray",new Uint8Array(0))}setNode(e){e.fftSize=this.fftSize,this.dataArray=new Uint8Array(e.frequencyBinCount),super.setNode(e)}getByteTimeDomainData(){var e;return null==(e=this.node)||e.getByteTimeDomainData(this.dataArray),this.dataArray}get level(){var e;return null==(e=this.node)||e.getByteTimeDomainData(this.dataArray),Math.max(...this.dataArray)/128-1}get timeDomainPathData(){let e=this.getByteTimeDomainData(),t=0,i=0,r="M".concat(t,",").concat(i);for(let n=0;n<e.length;n++)i=e[n]/128*100/2,r+="L".concat(t,",").concat(i),t+=1;return r}},VL=class{constructor(){hA(this,"source",new FL),hA(this,"gain",new FL),hA(this,"destination",new FL)}get volume(){var e;return(null==(e=this.gain.node)?void 0:e.gain.value)||1}setVolume(e){1!==e?(this.gain.node||this.gain.setNode(UL().createGain()),this.gain.node.gain.value=e):this.gain.node&&this.gain.deleteNode()}replaceSource(e){let t=function(t){try{let e=HL.get(t);if(e)return e;let i=UL();if(t instanceof HTMLAudioElement)e=i.createMediaElementSource(t);else{if(!(t instanceof MediaStreamTrack))return t;e=i.createMediaStreamSource(new MediaStream([t]))}return HL.set(t,e),e}catch(e){if(!(WC&&e instanceof Error&&"NotSupportedError"===e.name))throw e;lO.warn(e)}}(e);t&&this.source.replaceNode(t)}get track(){var e;return null==(e=this.stream)?void 0:e.getAudioTracks()[0]}get stream(){var e;return null==(e=this.destination.node)?void 0:e.stream}},HL=new WeakMap;var zL=class e{constructor(e){hA(this,"_volume",0),hA(this,"_volumeDb",0),hA(this,"_log"),hA(this,"_scriptProcessorNode",null),hA(this,"_audioWorkletNode",null),hA(this,"_interval",200),hA(this,"ready",this.preload());let{log:t}=e;this._log=t,aO.on(oO.AUDIO_LEVEL_INTERVAL,this.handleAudioLevelInterval,this)}static get isRunning(){return Date.now()-e.lastMessageTime<2e3}get node(){return this._audioWorkletNode||this._scriptProcessorNode}preload(){if(!e.workletReady){let t='class VolumeMeterWorklet extends AudioWorkletProcessor{constructor(){super(),this.volume=0,this.intervalTime=200,this.tick=200,this.isStop=!1,this.cache=[],this.sentFirstInfo1=!1,this.unmute=!1,this.port.onmessage=t=>{var e=t.data;switch(e.name){case"chunk":this.cache.push(...e.data),this.sentFirstInfo1||(this.port.postMessage({cl:e.data.length}),this.sentFirstInfo1=!0);break;case"setIntervalTime":this.intervalTime=e.intervalTime;break;case"unmute":this.unmute=!0;break;case"stop":this.isStop=!0}}}process(t,s){t=t[0],s=s[0];if(t||s){if(this.isStop)return!1;var i=s&&s[0]?s[0].length:0,h=this.cache.length,a=(i<h?(s[0].set(this.cache.slice(0,i)),this.cache=this.cache.slice(i)):this.unmute&&s[0].set(t[0]),(i<h?s:t)[0]);if(a){let e=0;for(let t=0;t<a.length;++t)e=Math.max(Math.abs(a[t]),e);s=a.reduce((t,e)=>t+e*e,0)/a.length;this.volume=e,this.tick-=a.length,this.tick<0&&(this.tick+=this.intervalTime/1e3*sampleRate,this.port.postMessage({volume:this.volume,volumeDb:Math.max(10*Math.log10(s)+100,0)/100,cacheLen:h,outputLen:i}))}}return!0}}registerProcessor("volume-meter",VolumeMeterWorklet);';e.workletReady=async function(e,t){if(!e.audioWorklet)return Promise.reject("audioWorklet is not supported");try{await e.audioWorklet.addModule(t),lO.info("worklet addModule success")}catch(Jx){throw lO.info("worklet addModule catch error. ".concat(Jx.message)),Jx}}(e.audioContext,URL.createObjectURL(new Blob([t],{type:"application/javascript"})))}return e.workletReady.then((()=>this.initAudioWorklet())).catch((e=>(this._log.error("volumeMeter preload error: ".concat(e)),this.initScriptProcessor())))}initAudioWorklet(){if(!this._audioWorkletNode)try{this._audioWorkletNode=new AudioWorkletNode(e.audioContext,"volume-meter");let t=!1;this._audioWorkletNode.port.onmessage=i=>{e.lastMessageTime=Date.now(),this._volume=i.data.volume||0,this._volumeDb=i.data.volumeDb||0,!t&&i.data.cacheLen&&i.data.outputLen&&(this._log.warn("worklet play success"),t=!0)},this.handleAudioLevelInterval({interval:this._interval})}catch(t){this._log.error("volumeMeter init audio worklet error: ".concat(t)),JN.logFailedEvent({userId:this._log.userId,eventType:nR,error:t}),this.initScriptProcessor()}}initScriptProcessor(){if(!this._scriptProcessorNode)try{this._scriptProcessorNode=UL().createScriptProcessor(2048,1,1),this._scriptProcessorNode.onaudioprocess=t=>{e.lastMessageTime=Date.now();let i=t.inputBuffer.getChannelData(0),r=0;for(let e=0;e<i.length;++e)r+=i[e]*i[e];this._volume=Math.sqrt(r/i.length)||0}}catch(t){this._log.error("volumeMeter init script processor error: ".concat(t))}}destroy(){this._scriptProcessorNode&&(this._scriptProcessorNode.onaudioprocess=null),this._audioWorkletNode&&(this._audioWorkletNode.port.postMessage({name:"stop"}),this._audioWorkletNode.port.onmessage=null),this._audioWorkletNode=null,this._scriptProcessorNode=null,aO.off(oO.AUDIO_LEVEL_INTERVAL,this.handleAudioLevelInterval,this)}getInternalAudioLevel(){return this._volume}getCalculatedVolume(){return parseFloat(this._volume.toFixed(2))}getVolumeDb(){return Math.floor(100*this._volumeDb)}handleAudioLevelInterval(e){var t;let{interval:i}=e;this._interval=i,null==(t=this._audioWorkletNode)||t.port.postMessage({name:"setIntervalTime",intervalTime:i})}};hA(zL,"lastMessageTime",0),hA(zL,"audioContext",UL()),hA(zL,"workletReady");var jL=zL,WL=class extends FL{constructor(e){super(),hA(this,"_volumeMeter"),this._volumeMeter=new jL(e)}deleteNode(){super.deleteNode(),this._volumeMeter.destroy()}async init(){await this._volumeMeter.preload(),this.setNode(this._volumeMeter.node)}getCalculatedVolume(){return this._volumeMeter.getCalculatedVolume()}getInternalAudioLevel(){return this._volumeMeter.getInternalAudioLevel()}getVolumeDb(){return this._volumeMeter.getVolumeDb()}write(e){if(this.node){let t=e.allocationSize({planeIndex:0}),i=new Float32Array(t>>2);e.copyTo(i,{planeIndex:0}),this.node.port.postMessage({name:"chunk",data:i},[i.buffer]),e.close()}}},GL=dA(fA(),1),qL=e=>t=>t.deviceId===e,KL=class{constructor(e,t){hA(this,"kind"),hA(this,"type"),hA(this,"devices",[]),this.kind=e,this.type=t}update(e,t){let i=e.filter((e=>e.kind==="".concat(this.kind).concat(this.type.toLocaleLowerCase())));1===this.devices.length&&ZL(this.devices[0])||t&&(i.forEach((e=>{if(e.deviceId&&!this.devices.find(qL(e.deviceId))){let i="".concat(this.kind).concat(this.type,"Added");lO.warn("".concat(i,": ").concat(JSON.stringify(e))),t.emit(i,e)}})),this.devices.forEach((e=>{if(e.deviceId&&!i.find(qL(e.deviceId))){let i="".concat(this.kind).concat(this.type,"Removed");lO.warn("".concat(i,": ").concat(JSON.stringify(e))),t.emit(i,e)}}))),this.devices=i}hasDevice(e){return!!this.devices.find((t=>t.deviceId===e))}},YL=class extends GL.EventEmitter{constructor(){super(),hA(this,"audioInputs",new KL(BA,"Input")),hA(this,"videoInputs",new KL(VA,"Input")),hA(this,"audioOutputs",new KL(BA,"Output")),this.init(),navigator.mediaDevices&&(navigator.mediaDevices.addEventListener&&navigator.mediaDevices.addEventListener("devicechange",(()=>this.update())),"ondevicechange"in navigator.mediaDevices||GN.run("interval",(()=>{this.update()}),{delay:1e4}))}init(){JL().then((e=>{this.audioInputs.update(e),this.videoInputs.update(e),this.audioOutputs.update(e)}))}async update(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=await JL(e);return this.audioInputs.update(t,this),this.videoInputs.update(t,this),this.audioOutputs.update(t,this),this}hasBlueTooth(){var e;if(1e3*(null==(e=UL())?void 0:e.outputLatency)>150)return!0;let t=["bluetooth","air","wireless","bt","tws","buds","headset","headphone"];return this.audioOutputs.devices.some((e=>t.some((t=>e.label.toLowerCase().includes(t)))))||this.audioInputs.devices.some((e=>t.some((t=>e.label.toLowerCase().includes(t)))))}},XL=CA||kA?null:new YL;function ZL(e){return e.deviceId===e.groupId&&""===e.groupId}async function JL(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;if(DO()||!kO())return[];let t=await navigator.mediaDevices.enumerateDevices();if(0!==e){let r={audio:!1,video:!1};if(t.forEach((e=>{ZL(e)&&(e.kind===QA?r.audio=!0:e.kind===$A&&(r.video=!0))})),2===e&&(r.audio=!1),1===e&&(r.video=!1),r.audio||r.video){let e;try{e=await navigator.mediaDevices.getUserMedia(r),r.audio&&ML()}catch(i){lO.debug("capture before getDevices failed: ",i)}t=await navigator.mediaDevices.enumerateDevices(),null==e||e.getTracks().forEach((e=>e.stop()))}}return t.map(((e,t)=>{let i={kind:e.kind,deviceId:e.deviceId,groupId:e.groupId,label:e.label||"".concat(e.kind,"_").concat(t)};return e.deviceId.length>0&&ix.add("".concat(e.deviceId,"_").concat(e.kind)),e.getCapabilities&&(i.getCapabilities=()=>e.getCapabilities()),i}))}function QL(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return XL.update(e?1:0).then((e=>e.audioInputs.devices))}function $L(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return XL.update(e?2:0).then((e=>e.videoInputs.devices))}var ex=!1;async function tx(){try{ex||(ex=!0,lO.info("speakers:".concat((await async function(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return(VC||jD)&&(e=!1),XL.update(e?1:0).then((e=>e.audioOutputs.devices))}()).map((e=>" ".concat(e.deviceId.slice(0,8),": ").concat(e.label))))))}catch(KS){}}var ix=new Set;async function rx(e){let{newDeviceId:t,oldDeviceId:i,oldGroupId:r,oldLabel:n,kind:a}=e;return t===i&&(a!==BA||t!==oR||await async function(e,t){let i=(await QL()).find((e=>e.deviceId===oR));return!t&&(null==i?void 0:i.groupId)===e||(null==i?void 0:i.groupId)===e&&i.label===t}(r,n))}var nx,ax=class extends VL{constructor(e){super(),this.log=e,hA(this,"volumeMeter"),hA(this,"volumeMeterAfter3A"),hA(this,"volumeDestination"),hA(this,"analyser",new BL),this.volumeMeter=new WL({log:this.log}),this.volumeMeterAfter3A=new WL({log:this.log}),this.volumeDestination=new FL,this.volumeMeter.pipeTo(this.volumeDestination)}destroy(){this.gain.deleteNode(),this.volumeMeter.deleteNode(),this.analyser.deleteNode(),this.source.deleteNode(),this.destination.deleteNode(),this.volumeDestination.deleteNode()}},ox=class extends $N{constructor(e){super(e,BA),hA(this,"_outputDeviceId"),hA(this,"_floatVolume",1),hA(this,"_destination"),hA(this,"pipeline"),hA(this,"volumeMeterMode","worklet"),hA(this,"enableVolumeControlInIOS"),this.enableVolumeControlInIOS=e.enableVolumeControlInIOS,this.mode=0,e.url&&(this.url=e.url),this.pipeline=new ax(this._log)}setTrack(e){}get duration(){var e;return Math.floor(1e3*((null==(e=this.element)?void 0:e.duration)||0))}get currentTime(){var e;return Math.floor(1e3*((null==(e=this.element)?void 0:e.currentTime)||0))}set currentTime(e){this.element&&(this.element.currentTime=e/1e3)}getMediaStream(){return this.pipeline.stream||(this.track?new MediaStream([this.track]):null)}initializeElement(e){if(("15.2"===qD||"15.3"===qD||"15.4"===qD)&&this.muted)return void this._log.info("audioElement is muted.");let t=nx||new Audio;t.setAttribute("autoplay","autoplay"),t.srcObject=this.getMediaStream(),t.muted=this.muted,this.url&&(t.crossOrigin="anonymous",t.src=this.url),this.element=t,this.setVolume(kk(e)?e/100:this._floatVolume),t===nx&&(nx=void 0),this.options.enableTimeupdateEvent&&(this.element.ontimeupdate=()=>this.emit(qN.TIME_UPDATE,this.currentTime)),this.bindElementEvents()}async play(e){if(this.track||this.url)return!this.pipeline.source.node&&this.track&&this.pipeline.replaceSource(this.track),this.element||this.initializeElement(null==e?void 0:e.volume),this._outputDeviceId&&await this.setSinkId(this._outputDeviceId),"worklet"===this.volumeMeterMode?(this.pipeline.volumeMeter.init(),this.pipeline.volumeMeterAfter3A.init()):"analyser"===this.volumeMeterMode&&this.pipeline.analyser.setNode(UL().createAnalyser()),tx(),super.play()}stop(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;this.pipeline.destroy(),super.stop(e)}setVolume(e){this._floatVolume=e,this.element&&(this.element.volume=e)}async setSinkId(e){var t,i;this._outputDeviceId!==e&&(this._outputDeviceId=e),this.element&&this.element.sinkId!==e&&await(null==(i=(t=this.element).setSinkId)?void 0:i.call(t,e))}get useDestination(){return!!this.pipeline.stream}setLoop(e){this.element&&(this.element.loop=e)}getAudioLevel(){return this.pipeline.volumeMeter.getCalculatedVolume()}getInternalAudioLevel(){return this.pipeline.volumeMeter.getInternalAudioLevel()}getInternalAudioLevelAfter3A(){return this.pipeline.volumeMeterAfter3A.getInternalAudioLevel()}},sx=class extends ox{constructor(e){super(e),hA(this,"_sourceElement"),hA(this,"_output",new FL),this.pipeline.source.pipeTo(this.pipeline.gain),this.pipeline.gain.pipeTo(this.pipeline.volumeMeter).pipeTo(this._output),this.pipeline.gain.pipeTo(this.pipeline.destination)}setOutput(){this.mode=1,this._output.setNode(UL().destination)}write(e){this.pipeline.volumeMeter.write(e)}setTrack(e){var t,i,r;(null==(i=null==(t=this.element)?void 0:t.error)?void 0:i.code)!==MediaError.MEDIA_ERR_DECODE&&this.track!==e&&(this.unbindTrackEvents(),this.track=e,this.emit(qN.MEDIA_TRACK_CHANGED,e),e?(this.bindTrackEvents(),this._sourceElement?this._sourceElement.srcObject=new MediaStream([e]):!this.useDestination&&this.element&&(this.element.srcObject=new MediaStream([e])),this.pipeline.source.channelCount=(null==(r=e.getSettings())?void 0:r.channelCount)||1,this.pipeline.replaceSource(e)):this.pipeline.source.deleteNode())}setVolume(e){var t;let i=e<=1&&!HC();if(this._floatVolume!==e||!(i&&(null==(t=this.element)?void 0:t.volume)===e||!i&&this.pipeline.volume===e))if(this._floatVolume=e,this.useDestination)this.pipeline.setVolume(e),this._log.info("set pipeline volume: ".concat(e));else if(i)this.element?(this._log.info("set element volume: ".concat(e)),this.element.volume=e):this._log.info("set element volume: no element");else{if(HC()){if(!this.enableVolumeControlInIOS)return;!function(){if(!VC||-1!==NL)return;let e=()=>{Vk()-DL<500||(SL&&"running"===SL.state&&SL.currentTime===OL&&(lO.warn("context is fake running, auto resume"),SL.suspend().catch((e=>{lO.warn("context suspend failed: ".concat(e))}))),OL=SL.currentTime,DL=Vk())};NL=setInterval((()=>{e()}),2e3),document.addEventListener("visibilitychange",(()=>{"visible"===document.visibilityState&&e()}))}()}if(WC&&!this.pipeline.source.node)return void this._log.warn("set pipeline volume failed: no source node");this._log.info("start set pipeline volume: ".concat(e)),this.pipeline.setVolume(e),this.element&&!this._sourceElement&&(this._destination||(this._destination=UL().createMediaStreamDestination()),this.pipeline.destination.setNode(this._destination),ZN(this.element),this._sourceElement=this.element,this._sourceElement.muted=!0,this.element=null,this.play().catch((e=>{this.emit(qN.AUTOPLAY_FAILED,e)})))}}stop(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;this.pipeline.destroy();let t=this._sourceElement||this.element;t&&WD&&(nx=t),this._sourceElement&&(this._sourceElement.srcObject=null,delete this._sourceElement),super.stop(e)}},cx=class extends BN{constructor(e){let{userId:t,sdkAppId:i,mediaType:r,room:n,PlayerClass:a=(1===r?sx:TL)}=e;var o;super(),hA(this,"id",dO()),hA(this,"userId",""),hA(this,"isRemote"),hA(this,"mediaType"),hA(this,"room"),hA(this,"user"),hA(this,"_log"),hA(this,"_inputTrack"),hA(this,"_outputTrack"),hA(this,"isPlayCalled"),hA(this,"container",null),hA(this,"player"),hA(this,"subVideoPlayerMap"),hA(this,"muted",!1),hA(this,"abortCtrl"),hA(this,"objectFit","cover"),hA(this,"mirror"),hA(this,"rotation"),hA(this,"isScreen",!1),hA(this,"manager"),hA(this,"trackSettings"),hA(this,"isFirstVideoFrameEmitted",!1),this.userId=t||"",this.mediaType=r,this._log=lO.createLogger({parent:null==n?void 0:n.getLogger(),id:"".concat(this.kind[0],"t"),userId:null==(o=n||this.room)?void 0:o.userId,remoteUserId:this instanceof iP?void 0:this.userId,sdkAppId:i,type:2===this.mediaType?"auxiliary":"main",isLocal:this instanceof iP}),this.player=new a({id:this.userId||this.id,track:null,muted:!1,container:null,log:this._log,enableVolumeControlInIOS:null==n?void 0:n.enableVolumeControlInIOS}),this.player.on(qN.PLAYER_STATE_CHANGED,(e=>{if(aO.emit(oO.PLAYER_STATE_CHANGED,aA({track:this},e)),this.emit("player-state-changed",e),"PLAYING"===e.state&&this.room){let e=!0;for(let{remoteAudioTrack:t,remoteVideoTrack:i,remoteAuxiliaryTrack:r}of[...this.room.remotePublishedUserMap.values()])if(t.isAvailable&&!t.player.isPlaying||i.isAvailable&&!i.player.isPlaying||r.isAvailable&&!r.player.isPlaying){e=!1;break}e&&vL()&&wL&&(wL.deleteDialog(),wL=null)}})),this.kind===VA&&(this.player.on(qN.LOADED_DATA,(()=>{this.emitFirstVideoFrameEvent(qN.LOADED_DATA),aO.emit(oO.VIDEO_LOADED_DATA,{track:this})})),this.player.on(qN.LOADED_META_DATA,(()=>{this.emitFirstVideoFrameEvent(qN.LOADED_META_DATA)})),this.player.on(qN.MEDIA_TRACK_CHANGED,(e=>{var t;null==(t=this.subVideoPlayerMap)||t.forEach((t=>t.setTrack(e)))})),this.player.on(qN.RESIZE,(e=>{this.emitFirstVideoFrameEvent(qN.RESIZE),this.emit("video-size-changed",aA({userId:this.userId,streamType:2===this.mediaType?"auxiliary":"main"},e))}))),this.onTrackMuted=this.onTrackMuted.bind(this),this.onTrackUnmuted=this.onTrackUnmuted.bind(this),this.onTrackEnded=this.onTrackEnded.bind(this),this.onPlayerError&&this.player.on(qN.ERROR,this.onPlayerError.bind(this)),this.player.on(qN.AUTOPLAY_FAILED,this.handleAutoPlayFailed,this)}get log(){return this._log||lO}get kind(){return 1===this.mediaType?BA:VA}get isAudio(){return this.kind===BA}get strMediaType(){return 4===this.mediaType?VA:2===this.mediaType?HA:BA}get streamType(){return 2&this.mediaType?"auxiliary":"main"}get isMediaTrackActive(){return!!this.mediaTrack&&(!this.mediaTrack.muted&&"live"===this.mediaTrack.readyState&&this.mediaTrack.enabled)}async play(e,t){let i=Ok(e)?e[0]:e;if(this.isPlayCalled)return this.log.info("play update options: ".concat(JSON.stringify(t))),t&&!Ak(t.muted)&&this.setPlayerMute(t.muted),t&&!Ak(t.objectFit)&&(this.objectFit=t.objectFit),void(this.player instanceof TL&&(this.player.setObjectFit(this.objectFit),this.container!==i&&i&&(this.container=i,this.player.setContainer(i)),Ok(e)&&e.length>=1&&await this.playSubContainer(e.slice(1),t)));if(t&&!Ak(t.muted)?this.setPlayerMute(t.muted):(!this.isRemote||this.kind===VA)&&this.setPlayerMute(!0),t&&!Ak(t.objectFit)&&(this.objectFit=t.objectFit),this.player instanceof TL&&(this.player.setObjectFit(this.objectFit),t&&!Ak(t.poster)&&this.player.setPoster(t.poster)),this.isPlayCalled=!0,i&&(this.container=i,this.player instanceof TL&&this.player.setContainer(i)),aO.emit(oO.PLAY_TRACK_START,{track:this}),this._outputTrack){this._log.info("play with options: ".concat(JSON.stringify(t)));try{this.player.setTrack(this.playerMediaTrack),await this.player.play(t),Ok(e)&&e.length>1&&await this.playSubContainer(e.slice(1),t)}catch(r){throw this.handleAutoPlayFailed(r),r}}else this.log.info("play has not mediaTrack, abort")}setMirror(e,t){if(this.isScreen||this.kind!==VA||Ak(e)||e===this.mirror)return;this.mirror=e;let i=this.player;t&&(i=t);let r=this.manager;if(Ck(this.mirror))return i.setViewMirror(this.mirror),void(!this.isRemote&&r&&(r.mirror=!1));switch(this.mirror){case"view":r&&(r.mirror=!1),i.setViewMirror(!0);break;case"publish":r&&(r.mirror=!0),i.setViewMirror(!0);break;case"both":r&&(r.mirror=!0),i.setViewMirror(!1)}}async playSubContainer(e,t){if(!this._outputTrack||this.kind===BA)return;this.subVideoPlayerMap||(this.subVideoPlayerMap=new Map),this.subVideoPlayerMap.forEach(((t,i)=>{var r;e.find((e=>i===e))||(t.stop(),null==(r=this.subVideoPlayerMap)||r.delete(i))}));for(let[r,n]of e.entries()){let e=this.subVideoPlayerMap.get(n);e?t&&(Ak(t.objectFit)||e.setObjectFit(t.objectFit)):this.subVideoPlayerMap.set(n,new TL({id:this.userId||this.id,track:this.playerMediaTrack,container:n,muted:this.player.muted,objectFit:this.objectFit,log:this.log.createChild({id:"vp-sub".concat(r+1)})}))}let i=[...this.subVideoPlayerMap.values()];for(let r of i)r.setViewMirror(this.player.mirror),await r.play()}setAudioOutput(e){return this.player.setSinkId(e)}setAudioVolume(e){this.player.setVolume(e)}getAudioLevel(){return this.player.getAudioLevel()||0}getInternalAudioLevel(){var e;return(null==(e=this.player)?void 0:e.getInternalAudioLevel())||0}stop(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this.isPlayCalled&&(this.isPlayCalled=!1,this.isFirstVideoFrameEmitted=!1,this.player&&(this.log.info("stop ".concat(this.kind," player")),this.player.stop(RC(this)&&!e?this.jitterBufferDelay:0)),this.subVideoPlayerMap&&this.subVideoPlayerMap.size>0&&this.subVideoPlayerMap.forEach((e=>{e.stop()})),this.container=null)}async resume(){var e;this.isPlayCalled&&await(null==(e=this.player)?void 0:e.resume())}close(){this.log.info("close"),this.isPlayCalled&&this.stop(!0)}setMute(e){this.muted=e,this._inputTrack&&(this._inputTrack.enabled=!e),this._outputTrack&&(this._outputTrack.enabled=!e),this.emit(e?"mute":"unmute",this),aO.emit(e?oO.TRACK_MUTED:oO.TRACK_UNMUTED,{track:this})}setPlayerMute(e){this.player.setMuted(e)}get mediaTrack(){return this._inputTrack||null}get outMediaTrack(){return this._outputTrack||null}get playerMediaTrack(){return this.outMediaTrack}installTrackEvent(e){XN(e,e).add(jA,this.onTrackMuted).add(WA,this.onTrackUnmuted).add(GA,this.onTrackEnded),e.muted&&this.onTrackMuted(),e.readyState===GA&&this.onTrackEnded()}uninstallTrackEvent(e){ZN(e)}setInputMediaStreamTrack(e){var t;let i=this._inputTrack;if(e!==i)return this._inputTrack=e,this.trackSettings=null==(t=e.getSettings)?void 0:t.call(e),e.enabled=!this.muted,i&&this.uninstallTrackEvent(i),this.installTrackEvent(e),this.emit("input-media-track-changed",e||null,i||null),this.manager?this.manager.changeInput(this):this.setOutputMediaStreamTrack(e)}setOutputMediaStreamTrack(e){var t;e!==this._outputTrack&&(this.isRemote?this.log.debug("setOutputMediaStreamTrack",e.label):this.log.info("setOutputMediaStreamTrack",null==(t=e.getSettings)?void 0:t.call(e).deviceId,e.label),this._outputTrack=e,this._inputTrack&&(this._outputTrack.contentHint=this._inputTrack.contentHint,this._outputTrack.enabled=this._inputTrack.enabled),this.updatePlayingState(!!e),this.emit("output-media-track-changed",e))}setMediaType(e){this.mediaType=e}updatePlayingState(e){if(this.isPlayCalled)if(e){if(this.player.setTrack(this.playerMediaTrack),this.player.isStopped)return this.player.play().catch((e=>this.handleAutoPlayFailed(e))),void this.log.info("playing state updated, play ".concat(this.kind))}else if(!this.player.isStopped)return this.player.stop(RC(this)?this.jitterBufferDelay:0),void this.log.info("playing state updated, stop ".concat(this.kind));this.log.debug("updatePlayingState abort ".concat(this.isPlayCalled," ").concat(e," ").concat(this.player.isStopped))}async handleAutoPlayFailed(e){var t;this.log.warn("handleAutoPlayFailed",e);let i=()=>{this.resume().then((()=>{document.removeEventListener("click",i,!0)}))};if(this.room&&this.room.enableAutoPlayDialog){if((nD||sD)&&(await oC(100),null!=(t=this.player)&&t.isPlaying))return;wL||(wL=new bL)}else document.addEventListener("click",i,!0);aO.once(oO.LOCAL_TRACK_CAPTURE_SUCCESS,(e=>{let{track:t}=e;"audio"===t.kind&&vL()&&!this.player.isPlaying&&this.isRemote&&this.isAvailable&&i()})),this.emit("error",e)}getVideoFrame(){return this.player instanceof TL?this.player.getVideoFrame():""}emitFirstVideoFrameEvent(e){var t,i,r;if(this.isFirstVideoFrameEmitted)return;let n=null==(t=this.mediaTrack)?void 0:t.getSettings(),a=(null==n?void 0:n.width)||(null==(i=this.player.element)?void 0:i.videoWidth)||0,o=(null==n?void 0:n.height)||(null==(r=this.player.element)?void 0:r.videoHeight)||0;e===qN.RESIZE&&!a&&!o||e===qN.LOADED_META_DATA&&!a&&!o||(e===qN.LOADED_DATA&&!a&&!o&&this._log.warn("the dimension of video is 0x0 in first-video-frame event"),this.isFirstVideoFrameEmitted=!0,uC(this.rotation)&&([a,o]=[o,a]),this.emit("first-video-frame",{width:a,height:o,streamType:this.streamType,userId:this.isRemote?this.userId:""}))}onTrackMuted(){this._log.warn("".concat(this.kind," track is unable to provide media output"))}onTrackUnmuted(){this._log.info("".concat(this.kind," track is able to provide media output"))}onTrackEnded(){this._log.warn("".concat(this.kind," track ended"))}};uA([MN([],BN.INIT,{sync:!0})],cx.prototype,"close",1);var lx=Object.prototype.hasOwnProperty;var dx=function(e){if(null==e)return!0;if("boolean"==typeof e)return!1;if("number"==typeof e)return 0===e;if("string"==typeof e||"function"==typeof e||Array.isArray(e))return 0===e.length;if(e instanceof Error)return""===e.message;if(bk(e))switch(Object.prototype.toString.call(e)){case"[object File]":case"[object Map]":case"[object Set]":return 0===e.size;case"[object Object]":for(let t in e)if(lx.call(e,t))return!1;return!0}return!1},ux=CC({retryFunction:async function(e){let t=function(e){return{audio:px(e),video:fx(e)}}(e);lO.info("getUserMedia with constraints: ".concat(JSON.stringify(t)));let i=[],r=[],n=["label","deviceId","groupId"];if(t.audio&&(i=await QL(),lO.info("microphones: ".concat($k(i.map((e=>oA(aA({},e),{groupId:e.groupId.substring(0,8)}))),{keysToInclude:n})))),t.video&&(r=await $L(),lO.info("cameras: ".concat($k(r,{keysToInclude:n}))),!Ck(t.video)&&"user"===t.video.facingMode&&!t.video.deviceId)){let e=r.filter((e=>!e.label.includes("infrared"))).find((e=>e.label.includes("facing front")));e&&(t.video.deviceId=e.deviceId,lO.info("exclude infrared camera: ".concat(JSON.stringify(t))))}try{let i=await navigator.mediaDevices.getUserMedia(t);return cN&&i.getTracks().forEach((t=>{var i;let r=t.getCapabilities();lO.info("".concat(t.kind," capabilities: ").concat($k(r,{keysToInclude:cR}))),!Ak(e.echoCancellation)&&-1===(null==(i=r.echoCancellation)?void 0:i.indexOf(e.echoCancellation))&&lO.warn("Invalid argument for 'echoCancellation'. Expected one of [".concat(JSON.stringify(r.echoCancellation),"], but received '").concat(e.echoCancellation,"'"))})),t.audio&&ML(),i}catch(a){let{message:t}=a;throw"NotFoundError"===a.name&&(e.video&&r&&0===r.length&&(t=gO({key:hO.CAMERA_NOT_FOUND})),e.audio&&i&&0===i.length&&(t=gO({key:hO.MICROPHONE_NOT_FOUND}))),new PR({code:LR.INITIALIZE_FAILED,name:a.name,message:t,constraint:a.constraint})}},settings:{retries:3,timeout:500},onError:e=>{let{error:t,retry:i,reject:r,retryFuncArgs:n,retriedCount:a}=e,o=a+1;"NotReadableError"===t.name||"OverconstrainedError"===t.name||"AbortError"===t.name?(1===o?(n[0].video&&(n[0].maxResolution=!1,(!jD||n[0].width*n[0].height<=2073600)&&n[0].frameRate&&(n[0].frameRate=n[0].frameRate>10?10:5)),n[0].retryWhenExactFailed&&n[0].useExactDeviceId&&(n[0].useExactDeviceId=!1)):2===o?n[0].useDeviceIdOnly=!0:3===o&&!n[0].useExactDeviceId&&(n[0].useTrueAsConstraint=!0),i()):r(t),n[0].microphoneId&&hx(n[0].microphoneId,!1),n[0].cameraId&&hx(n[0].cameraId,!0)},onRetrying:e=>{lO.warn("getUserMedia NotReadableError observed, retrying [".concat(e,"/3]"))},onRetryFailed:e=>{JN.logFailedEvent({eventType:aR,error:e})},onRetrySuccess:e=>{JN.logSuccessEvent({eventType:aR}),JN.uploadEvent({log:"stat-".concat(aR,"-success-").concat(e)})}});async function hx(e,t){let i=(t?await $L():await QL()).find((t=>t.deviceId===e));i&&Sk(i.getCapabilities)&&lO.warn($k(i.getCapabilities(),{keysToInclude:cR}))}function px(e){if(!e.audio)return!1;if(e.useTrueAsConstraint)return!0;let t={echoCancellation:!0,noiseSuppression:!0,autoGainControl:!0,sampleRate:e.sampleRate};return!dx(e.microphoneId)&&(t.deviceId=e.useExactDeviceId?{exact:e.microphoneId}:e.microphoneId,e.useDeviceIdOnly)?t:(kk(e.channelCount)&&(t.channelCount=e.channelCount),(Ck(e.echoCancellation)||"remote-only"===e.echoCancellation||"all"===e.echoCancellation)&&(t.echoCancellation=e.echoCancellation),Ck(e.noiseSuppression)&&!e.noiseSuppression&&(t.noiseSuppression=!1),Ck(e.autoGainControl)&&!e.autoGainControl&&(t.autoGainControl=!1),!!dx(t)||t)}function fx(e){if(!e.video)return!1;if(e.useTrueAsConstraint)return!0;let{maxResolution:t=!0}=e,i={};return e.cameraId?i.deviceId=e.useExactDeviceId?{exact:e.cameraId}:e.cameraId:e.facingMode&&(i.facingMode=e.facingMode),e.useDeviceIdOnly&&!dx(i)?i:(e.width&&(i.width={ideal:e.width},t&&!WC&&(i.width.max=e.width)),e.height&&(i.height={ideal:e.height},t&&!WC&&(i.height.max=e.height)),WC&&yD&&e.width&&e.height&&e.width*e.height<101376&&(i.width=e.width,i.height=e.height),e.frameRate&&(i.frameRate=e.frameRate),!!dx(i)||i)}var mx=ux,gx=(()=>{let e=!1,t=document.visibilityState;return()=>{document.visibilityState!==t&&lO.info("visibility change: ".concat(document.visibilityState)),!e&&(document.addEventListener("visibilitychange",(()=>{lO.info("visibility change: ".concat(document.visibilityState)),t=document.visibilityState})),e=!0)}})(),vx=0,_x=class{constructor(){hA(this,"log",lO.createLogger({id:"fq".concat(++vx)})),hA(this,"isRunning",!1),hA(this,"queue",[])}get length(){return this.queue.length}get lastQueueItem(){return 0===this.length?null:this.queue[this.length-1]}push(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];var i,r;let n=aA({},e),a=new Promise(((e,t)=>{n.resolve=e,n.reject=t}));return n.promise=a,t?this.length<=1?this.queue.push(n):null==(r=null==(i=this.lastQueueItem)?void 0:i.promise)||r.then(n.resolve,n.reject):this.queue.push(n),this.log.debug("push ".concat(this.length)),this.isRunning||this.callNext(),a}shift(){let e=this.queue.shift();return this.log.debug("shift ".concat(this.length)),e}callNext(){if(this.isRunning||0===this.length)return;this.log.debug("callNext ",this.length);let{fn:e,args:t,context:i,resolve:r,reject:n}=this.queue[0];this.isRunning=!0,e.apply(i,t).then(r,n).finally((()=>{this.isRunning=!1,this.shift(),this.callNext()}))}},yx=new WeakMap;function Ex(e,t){return bA(((i,r)=>function(){let r=e;try{for(var n=arguments.length,a=new Array(n),o=0;o<n;o++)a[o]=arguments[o];let e=i.apply(this,a),s=Vk();return xk(e)?e.then((e=>(t?wO.addSuccessEvent({key:r,cost:Vk()-s}):wO.addSuccessEvent({key:r}),e))).catch((e=>{throw wO.addFailedEvent({key:r,error:e}),e})):(wO.addSuccessEvent({key:r}),e)}catch(SA){throw wO.addFailedEvent({key:r,error:SA}),SA}}))}function bx(){}var wx=e=>e();function Ix(){this.dispose()}var Tx=1,Sx=class extends Function{toString(){return"".concat(this.name,"(").concat(this.args.length?[...this.args].join(", "):"",")")}subscribe(e){let t=new Lx(e,this,this.streamId++);return xx.subscribe({id:this.id,end:!1},{nodeId:t.sourceId,streamId:t.id}),this(t),t}},Ax=class{constructor(){this.defers=new Set,this.disposed=!1}next(e){}complete(){this.dispose()}error(e){this.dispose()}get bindDispose(){return()=>this.dispose()}dispose(){this.disposed=!0,this.complete=bx,this.error=bx,this.next=bx,this.dispose=bx,this.subscribe=bx,this.doDefer()}subscribe(e){return e instanceof Sx?e.subscribe(this):e(this),this}get bindSubscribe(){return e=>this.subscribe(e)}doDefer(){this.defers.forEach(wx),this.defers.clear()}defer(e){this.defers.add(e)}removeDefer(e){this.defers.delete(e)}reset(){this.disposed=!1,delete this.complete,delete this.next,delete this.dispose,delete this.next,delete this.subscribe}resetNext(){delete this.next}resetComplete(){delete this.complete}resetError(){delete this.error}},Rx=class extends Ax{constructor(e){super(),this.sink=e,e.defer(this.bindDispose)}next(e){this.sink.next(e)}complete(){this.sink.complete()}error(e){this.sink.error(e)}},kx=class extends Ax{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:bx,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:bx,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:bx;if(super(),this._next=t,this._error=i,this._complete=r,this.then=bx,e instanceof Sx){let n={toString:()=>"subscribe",id:0,source:e};this.defer((()=>{xx.defer(n,0)})),xx.create(n),xx.pipe(n),this.sourceId=n.id,this.subscribe(e),xx.subscribe({id:n.id,end:!0}),t==bx?this._next=e=>xx.next(n,0,e):this.next=e=>{xx.next(n,0,e),t(e)},r==bx?this._complete=()=>xx.complete(n,0):this.complete=()=>{this.dispose(),xx.complete(n,0),r()},i==bx?this._error=e=>xx.complete(n,0,e):this.error=e=>{this.dispose(),xx.complete(n,0,e),i(e)}}else this.subscribe(e)}next(e){this._next(e)}complete(){this.dispose(),this._complete()}error(e){this.dispose(),this._error(e)}};function Cx(e){for(var t=arguments.length,i=new Array(t>1?t-1:0),r=1;r<t;r++)i[r-1]=arguments[r];return i.reduce(((e,t)=>t(e)),e)}function Dx(e,t,i){if("undefined"!=typeof __FASTRX_DEVTOOLS__){let r=Object.defineProperties(Object.setPrototypeOf(e,Sx.prototype),{streamId:{value:0,writable:!0,configurable:!0},name:{value:t,writable:!0,configurable:!0},args:{value:i,writable:!0,configurable:!0},id:{value:0,writable:!0,configurable:!0}});xx.create(r);for(let e=0;e<i.length;e++){let t=i[e];"function"==typeof t&&t instanceof Sx&&xx.addSource(r,t)}return r}return e}function Ox(e,t){return function(){for(var i=arguments.length,r=new Array(i),n=0;n<i;n++)r[n]=arguments[n];return i=>{if(i instanceof Sx){let n=Dx((t=>{let a=new e(t,...r);a.sourceId=n.id,a.subscribe(i)}),t,arguments);return n.source=i,xx.pipe(n),n}return t=>i(new e(t,...r))}}}function Nx(e,t){window.postMessage({source:"fastrx-devtools-backend",payload:{event:e,payload:t}})}var Lx=class extends Rx{constructor(e,t,i){super(e),this.source=t,this.id=i,this.sourceId=e.sourceId,this.defer((()=>{xx.defer(this.source,this.id)}))}next(e){xx.next(this.source,this.id,e),this.sink.next(e)}complete(){xx.complete(this.source,this.id),this.sink.complete()}error(e){xx.complete(this.source,this.id,e),this.sink.error(e)}},xx={addSource(e,t){Nx("addSource",{id:e.id,name:e.toString(),source:{id:t.id,name:t.toString()}})},next(e,t,i){Nx("next",{id:e.id,streamId:t,data:i&&i.toString()})},subscribe(e,t){let{id:i,end:r}=e;Nx("subscribe",{id:i,end:r,sink:{nodeId:t&&t.nodeId,streamId:t&&t.streamId}})},complete(e,t,i){Nx("complete",{id:e.id,streamId:t,err:i?i.toString():null})},defer(e,t){Nx("defer",{id:e.id,streamId:t})},pipe(e){Nx("pipe",{name:e.toString(),id:e.id,source:{id:e.source.id,name:e.source.toString()}})},update(e){Nx("update",{id:e.id,name:e.toString()})},create(e){e.id||(e.id=Tx++),Nx("create",{name:e.toString(),id:e.id})}},Px=class extends Ax{constructor(e){super(),this.source=e,this.sinks=new Set}add(e){e.defer((()=>this.remove(e))),1===this.sinks.add(e).size&&(this.reset(),this.subscribe(this.source))}remove(e){this.sinks.delete(e),0===this.sinks.size&&this.dispose()}next(e){this.sinks.forEach((t=>t.next(e)))}complete(){this.sinks.forEach((e=>e.complete())),this.sinks.clear()}error(e){this.sinks.forEach((t=>t.error(e))),this.sinks.clear()}};function Mx(){return e=>{let t=new Px(e);if(e instanceof Sx){let i=Dx((e=>{t.add(e)}),"share",arguments);return t.sourceId=i.id,i.source=e,xx.pipe(i),i}return Dx(t.add.bind(t),"share",arguments)}}function Ux(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];return Dx((e=>{let i=new Rx(e),r=t.length;i.complete=()=>{0==--r&&e.complete()},t.forEach(i.bindSubscribe)}),"merge",arguments)}function Fx(e){let t=arguments,i=Mx()(Dx((t=>{i.next=e=>t.next(e),i.complete=()=>t.complete(),i.error=e=>t.error(e),e&&t.subscribe(e)}),"subject",t));return i.next=bx,i.complete=bx,i.error=bx,i}function Bx(e,t){return i=>{let r=e=>i.next(e);i.defer((()=>t(r))),e(r)}}function Vx(e,t){if("on"in e&&"off"in e)return Dx(Bx((i=>e.on(t,i)),(i=>e.off(t,i))),"fromEvent",arguments);if("addListener"in e&&"removeListener"in e)return Dx(Bx((i=>e.addListener(t,i)),(i=>e.removeListener(t,i))),"fromEvent",arguments);if("addEventListener"in e)return Dx(Bx((i=>e.addEventListener(t,i)),(i=>e.removeEventListener(t,i))),"fromEvent",arguments);throw"target is not a EventDispachter"}var Hx=Ox(class extends Rx{constructor(e,t,i){super(e),this.filter=t,this.thisArg=i}next(e){this.filter.call(this.thisArg,e)&&this.sink.next(e)}},"filter"),zx=Ox(class extends Rx{constructor(e,t){super(e),this.count=t}next(e){this.sink.next(e),0==--this.count&&(this.doDefer(),this.complete())}},"take"),jx=Ox(class extends Rx{constructor(e,t){super(e);let i=new Rx(e);i.next=()=>{i.doDefer(),e.complete()},i.complete=Ix,i.subscribe(t)}},"takeUntil"),Wx=Ox(class extends Rx{constructor(e,t){super(e),this.f=t}next(e){this.f(e)||(this.next=super.next,this.next(e))}},"skipWhile"),Gx=Ox(class extends Rx{constructor(e,t,i){super(e),this.mapper=t,this.thisArg=i}next(e){super.next(this.mapper.call(this.thisArg,e))}},"map"),qx=class extends Rx{constructor(e,t,i){super(e),this.data=t,this.context=i}next(e){let t=this.context.combineResults;t?this.sink.next(t(this.data,e)):this.sink.next(e)}tryComplete(){this.context.resetComplete(),this.dispose()}},Kx=class e extends Rx{constructor(e,t,i){super(e),this.makeSource=t,this.combineResults=i,this.index=0}subInner(t,i){let r=this.currentSink=new i(this.sink,t,this);this.complete===e.prototype.complete&&(this.complete=this.tryComplete),r.complete=r.tryComplete,r.subscribe(this.makeSource(t,this.index++))}complete(){this.sink.complete()}tryComplete(){this.currentSink.resetComplete(),this.dispose()}},Yx=class extends qx{},Xx=class extends Kx{next(e){this.subInner(e,Yx),this.next=e=>{this.currentSink.dispose(),this.subInner(e,Yx)}}},Zx=Ox(Xx,"switchMap");var Jx,Qx=function(e){return(t,i)=>e((()=>t),i)}(Ox(Xx,"switchMapTo")),$x=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:bx,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:bx,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:bx;return r=>new kx(r,e,t,i)},eP=Ox(class extends Rx{constructor(e,t){super(e),t instanceof Function?this.next=i=>{t(i),e.next(i)}:(t.next&&(this.next=i=>{t.next(i),e.next(i)}),t.complete&&(this.complete=()=>{t.complete(),e.complete()}),t.error&&(this.error=i=>{t.error(i),e.error(i)}))}},"tap"),tP=((Jx=tP||{})[Jx.AUTO_SWITCH_NEW_DEVICE=0]="AUTO_SWITCH_NEW_DEVICE",Jx[Jx.WAIT_CURRENT_DEVICE=1]="WAIT_CURRENT_DEVICE",Jx),iP=class extends cx{constructor(e,t){super({mediaType:e,PlayerClass:t}),hA(this,"isRemote",!1),hA(this,"deviceId"),hA(this,"groupId",""),hA(this,"label",""),hA(this,"sourceTrack"),hA(this,"enableAutoSwitchWhenRecapturing",!0),hA(this,"_isRecapturing",!1),hA(this,"_lastRecaptureTime",0),hA(this,"_onMuteTimeoutId",-1),hA(this,"_encodeCheckTimeoutId",-1),hA(this,"recaptureMode",0),hA(this,"profile"),hA(this,"retryEncodeFailed")}get enableEncodeFrame(){return!1}get isPublishing(){return"publishing"===this.state.toString()}get isPublished(){return"publish"===this.state}get isUseCustomSource(){return this.sourceTrack&&this.mediaTrack&&this.sourceTrack!==this.mediaTrack}encodeFrame(e,t){throw new Error("Method not implemented.")}installTrackEvent(e){e.addEventListener(jA,this.onTrackMuted),e.addEventListener(WA,this.onTrackUnmuted),e.addEventListener(GA,this.onTrackEnded),e.muted&&this.onTrackMuted(),e.readyState===GA&&this.onTrackEnded()}uninstallTrackEvent(e){e.removeEventListener(jA,this.onTrackMuted),e.removeEventListener(WA,this.onTrackUnmuted),e.removeEventListener(GA,this.onTrackEnded)}setStateToReady(){}async capture(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];var i;let r=this.sourceTrack;try{let r,n=Vk();aO.emit(oO.LOCAL_TRACK_CAPTURE_START,{track:this}),e.customSource?(r=new MediaStream,r.addTrack(e.customSource)):(t||null==(i=this.sourceTrack)||i.stop(),r=await mx(e));let a=r.getTracks()[0];return await this.setInputMediaStreamTrack(a),e.customSource||(this.sourceTrack=a,this.updateDeviceIdInUse(),this.listenDeviceChange()),aO.emit(oO.LOCAL_TRACK_CAPTURE_SUCCESS,{track:this,cost:Vk()-n}),r}catch(SA){throw aO.emit(oO.LOCAL_TRACK_CAPTURE_FAILED,{track:this,error:SA}),this.log.error("getUserMedia error observed ".concat(SA)),SA}finally{t&&(null==r||r.stop())}}setOutputMediaStreamTrack(e){var t;if(super.setOutputMediaStreamTrack(e),this.setStateToReady(),this.isPublishing||this.isPublished)return null==(t=this.room)?void 0:t.replaceTrack(this)}get hasFlag(){var e,t;let i=Gk((null==(e=this.room)?void 0:e.localPublishFlag)||0,(null==(t=this.room)?void 0:t.userId)||"");return 4===this.mediaType&&i.hasVideo||1===this.mediaType&&i.hasAudio||2===this.mediaType&&i.hasAuxiliary}async publish(e,t){return this.room=e,this.room.localTracks.add(this),this.emit("4",{mediaType:this.strMediaType,state:"starting",prevState:"stopped"}),this.userId=e.userId,this._log.bindParent(e.getLogger()),await t,this._checkPublishFlag(e)}_checkPublishFlag(e){return new Promise((async(t,i)=>{var r,n,a,o;let s=()=>i(new PR({code:LR.API_CALL_ABORTED,message:"publish aborted"}));if(this.hasFlag||this.muted?t():((this.state===BN.INIT||"ready"===this.state)&&s(),Cx(Vx(e,"local-publish-flag-changed"),Hx((()=>this.hasFlag)),jx(Ux(Vx(this,BN.INIT),Vx(this,"ready"))),$x(t,i,s))),((null==(n=null==(r=this.room)?void 0:r.networkQuality)?void 0:n.uplinkNetworkQuality)||0)>3)return t();let c=e.heartbeatCount,l=(null==(o=null==(a=this.mediaTrack)?void 0:a.stats)?void 0:o.totalFrames)||0;this._encodeCheckTimeoutId=setTimeout((async()=>{var r,n,a,o,s,d,u;if(((null==(n=null==(r=this.room)?void 0:r.networkQuality)?void 0:n.uplinkNetworkQuality)||0)>3||e.heartbeatCount-c<3)return t();if((this.isPublished||this.isPublishing)&&this.isMediaTrackActive){if(null!=(a=this.mediaTrack)&&a.stats){let e=this.mediaTrack.stats.totalFrames||0;e-l==0&&this.log.warn("capture totalFrames is 0 during encode check, totalFrames",e)}let e=this.kind===BA,r=this.stat.bytesSent>0;if(wO[r?"addSuccessEvent":"addFailedEvent"]({key:e?503700:513702}),!e){let e={H264:513704,H265:513705,VP8:513706}[(null==(s=null==(o=this.room)?void 0:o.videoCodec)?void 0:s.toUpperCase())||"H264"];e&&wO[r?"addSuccessEvent":"addFailedEvent"]({key:e})}if(!r){if(wO.addEnum({key:e?503701:513703,value:rO()}),JN.uploadEvent({log:"stat-encode-failed-".concat(this.kind,"-").concat(eO()||nO()),userId:this.userId}),this.log.warn(e?"encode failed":"".concat(null==(u=null==(d=this.room)?void 0:d.videoCodec)?void 0:u.toUpperCase()," encode failed")),this.retryEncodeFailed&&(this.log.warn("retry encode"),await this.retryEncodeFailed(this),this.stat.bytesSent>0||this.hasFlag||(await oC(5e3),this.stat.bytesSent>0||this.hasFlag)))return t();this.emit("6",this),i(new PR({message:"".concat(this.strMediaType," encode failed"),code:e?LR.AUDIO_ENCODE_FAILED:LR.VIDEO_ENCODE_FAILED}))}}}),1e4)}))}unpublish(){this.room&&this.room.localTracks.delete(this),this.log.info("unpublish"),aO.emit(oO.LOCAL_TRACK_UNPUBLISHED,{track:this})}async updateDeviceIdInUse(){if(this.sourceTrack&&sN){let{deviceId:e,groupId:t}=this.sourceTrack.getSettings(),{label:i}=this.sourceTrack;await rx({newDeviceId:e,oldDeviceId:this.deviceId,oldGroupId:this.groupId,oldLabel:this.label,kind:this.kind})||(this.deviceId=e,this.label=i,t&&(this.groupId=t),JL().then((i=>{let r=i.find((i=>{let r=i.deviceId===e;return t&&(r=r&&i.groupId===t),r}));r&&this.emit("2",r)})))}}setProfile(e){this.log.info("setProfile",e),Object.assign(this.profile,e)}isNeedToRecapture(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return!(!this.deviceId||!this.sourceTrack||this.kind===BA&&!function(e){if(e instanceof CanvasCaptureMediaStreamTrack||!(e instanceof MediaStreamTrack))return!1;let t=e.label.toLocaleLowerCase();if(t.includes("mic")||t.includes("麦克风"))return!0;let i="".concat(((null==e?void 0:e.getSettings())||{}).deviceId,"_").concat(QA);return!!ix.has(i)}(this.sourceTrack)||this.kind===VA&&!function(e){if(e instanceof CanvasCaptureMediaStreamTrack||!(e instanceof MediaStreamTrack))return!1;let t=e.label.toLocaleLowerCase();if(t.includes("camera")||t.includes("webcam"))return!0;let i="".concat(((null==e?void 0:e.getSettings())||{}).deviceId,"_").concat($A);return!!ix.has(i)}(this.sourceTrack)||this._isRecapturing||e&&yD&&jD)}onTrackMuted(){if(super.onTrackMuted(),gx(),this.isNeedToRecapture(!0)){if(Date.now()-this._lastRecaptureTime<sR)return void setTimeout((()=>this.onTrackMuted()),sR);this._onMuteTimeoutId=setTimeout((async()=>{var e;if(null!=(e=this.sourceTrack)&&e.muted){if((VC||zC)&&"visible"!==document.visibilityState)return;this.recapture(await this.getRecoverCaptureDeviceId())}}),5e3)}}onTrackUnmuted(){super.onTrackUnmuted(),this._onMuteTimeoutId>0&&clearTimeout(this._onMuteTimeoutId)}async onTrackEnded(){if(super.onTrackEnded(),this.isNeedToRecapture()&&0===this.recaptureMode){if(Date.now()-this._lastRecaptureTime<sR)return void setTimeout((()=>this.onTrackEnded()),sR);this.emit("7"),this.recapture(await this.getRecoverCaptureDeviceId())}}async recapture(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];var i;if(this._isRecapturing||!this.sourceTrack)return;this.log.warn("recapture trying");let r=this.sourceTrack;t||null==(i=this.sourceTrack)||i.stop(),this._isRecapturing=!0,this._lastRecaptureTime=Date.now();let n={useExactDeviceId:!0};if("user"===e||"environment"===e)n.facingMode=e;else{let t;("audio"===this.kind?await QL():await $L()).find((t=>t.deviceId===e))&&(t=e),n.deviceId=t}return this.capture(n,t).then((()=>{this._isRecapturing=!1,this.log.warn("recapture success"),this.emit("1",{deviceId:this.deviceId}),aO.emit(oO.LOCAL_TRACK_RECAPTURE,{track:this})})).catch((e=>{this._isRecapturing=!1,this.log.warn("recapture failed ".concat(e.message)),this.emit("5",e),aO.emit(oO.LOCAL_TRACK_RECAPTURE,{track:this,error:e})})).finally((()=>{t&&(null==r||r.stop())}))}async getRecoverCaptureDeviceId(){let e=this instanceof oP;if(e&&this.facingMode)return this.facingMode;let{deviceId:t}=this;if(t){let i=(rP.get(t)||0)+1;if(rP.set(t,i),i>=3&&this.enableAutoSwitchWhenRecapturing){let r=e?(await $L()).find((e=>!rP.has(e.deviceId))):(await QL()).find((e=>!rP.has(e.deviceId)));r&&(this.log.warn("".concat(t," capture fail ").concat(i," times, change new ").concat(r.deviceId)),t=r.deviceId)}}return t}stopCapture(){var e;this.sourceTrack&&(this.sourceTrack.stop(),this.uninstallTrackEvent(this.sourceTrack)),this._inputTrack&&this.uninstallTrackEvent(this._inputTrack),null==(e=this.manager)||e.removeInput(this)}close(){super.close(),this.stopCapture()}};uA([MN(BN.INIT,"ready",{ignoreError:!0,sync:!0})],iP.prototype,"setStateToReady",1),uA([function(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return function(t,i,r){let n=r.value;return r.value=function(){let t=yx.get(this)||new _x;for(var i=arguments.length,r=new Array(i),a=0;a<i;a++)r[a]=arguments[a];return yx.set(this,t),t.push({fn:n,args:r,context:this},e)},r}}()],iP.prototype,"capture",1),uA([MN("ready","publish",{ignoreError:!0,success(){aO.emit(oO.LOCAL_TRACK_PUBLISHED,{track:this,room:this.room}),this.emit("4",{mediaType:this.strMediaType,state:"started",prevState:"starting"}),this.log.info("published")},fail(e){var t;null==(t=this.room)||t.localTracks.delete(this);let i="error",r=e instanceof PR?e:e.cause instanceof PR?e.cause:e,n=!1;r instanceof PR&&(r.message.includes("timeout")?i="timeout":r.code===LR.API_CALL_ABORTED&&(n=!0,i="api-call")),this.emit("4",{mediaType:this.strMediaType,state:"stopped",prevState:"starting",reason:i,error:r}),this.log[n?"info":"error"]("publish failed",r)}}),Ex(521714,!1)],iP.prototype,"publish",1),uA([bA((e=>async function(){let t="publish"===this.state?"started":"starting";e.call(this),this.emit("4",{mediaType:this.strMediaType,state:"stopped",prevState:t,reason:"api-call"}),clearTimeout(this._encodeCheckTimeoutId)})),MN([],"ready",{sync:!0})],iP.prototype,"unpublish",1);var rP=new Map;aO.on(oO.SWITCH_DEVICE_SUCCESS,(e=>{e.track.deviceId&&rP.delete(e.track.deviceId)}));var nP=class{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];this.dataView=e,this.isSEI&&(t?this.addPreventionByte():this.removePreventionByte())}addPreventionByte(){let{seiPayloadStartIndex:e}=this,t=this.dataView.byteLength-2,i=[],r=0;for(let a=e;a<=t;a++){let e=this.dataView.getInt8(a);switch(e){case 0:case 1:case 2:case 3:2===r&&(i.push(3),r=0),0===e?r+=1:r=0,i.push(e);break;default:r=0,i.push(e)}}i.push(this.dataView.getInt8(this.dataView.byteLength-1));let n=new DataView(new Uint8Array([...new Uint8Array(this.dataView.buffer).slice(0,e),...i]).buffer);this.dataView=n}removePreventionByte(){let{seiPayloadStartIndex:e}=this,t=this.dataView.byteLength-1,i=[],r=0;for(let a=e;a<=t;a++)switch(this.dataView.getInt8(a)){case 0:r++,i.push(this.dataView.getInt8(a));break;case 3:2!==r&&i.push(this.dataView.getInt8(a)),r=0;break;default:i.push(this.dataView.getInt8(a)),r=0}let n=new DataView(new Uint8Array([...new Uint8Array(this.dataView.buffer).slice(0,e),...i]).buffer);this.dataView=n}get seiPayloadStartIndex(){let e=6;for(let t=6;t<this.dataView.buffer.byteLength&&(e+=1,255===this.dataView.getUint8(t));t+=1);return e}get seiPayloadType(){return this.isSEI?this.dataView.getUint8(5):null}get seiPayload(){if(!this.isSEI)return null;let e=0,t=6;for(let a=6;a<this.dataView.buffer.byteLength;a+=1){let i=this.dataView.getUint8(a);if(t+=1,255!==i){e+=i;break}e+=255}let i=new ArrayBuffer(e),r=new DataView(i),n=t;for(let a=0;a<i.byteLength;a+=1)r.setInt8(a,this.dataView.getInt8(n+a));return r}get naluType(){let e=this.getStartCodeLength();return e>=this.dataView.byteLength?0:31&this.dataView.getUint8(e)}getStartCodeLength(){return this.dataView.byteLength>=4&&0===this.dataView.getUint8(0)&&0===this.dataView.getUint8(1)&&0===this.dataView.getUint8(2)&&1===this.dataView.getUint8(3)?4:this.dataView.byteLength>=3&&0===this.dataView.getUint8(0)&&0===this.dataView.getUint8(1)&&1===this.dataView.getUint8(2)?3:0}get isIDR(){return 5===this.naluType}get isSPS(){return 7===this.naluType}get isPPS(){return 8===this.naluType}get isSEI(){return 6===this.naluType}},aP=class{constructor(){hA(this,"_seiMessageList",[]),hA(this,"_smallSeiMessageList",[]),hA(this,"_seiPayloadType",243)}encodeSEINalu(e){let t=e.byteLength,i=parseInt(String(t/255),10),r=t%255,n=[];n.push(0,0,0,1,6,this._seiPayloadType);for(let o=0;o<i;o++)n.push(255);n.push(r);let a=new DataView(e);return n.push(...new Uint8Array(a.buffer)),n.push(128),new nP(new DataView(new Uint8Array(n).buffer),!0)}sendSEI(e,t){null!=t&&t.seiPayloadType&&(this._seiPayloadType=t.seiPayloadType),this._seiMessageList.push(e),null!=t&&t.small&&this._smallSeiMessageList.push(e)}isEmpty(){return!this._seiMessageList.length}getNaluCount(e){let t=0,i=0,r=new DataView(e);for(let n=0;n<e.byteLength;n++)switch(r.getUint8(n)){case 0:t++;break;case 1:(2===t||3===t)&&i++,t=0;break;default:t=0}return i}encode(e,t){let i=t?this._smallSeiMessageList:this._seiMessageList;if(i.length>0&&e.data.byteLength>0){let t=9-this.getNaluCount(e.data);if(t<=0)return 0;let r=i.splice(0,t).reverse().map(this.encodeSEINalu.bind(this)),n=r.reduce(((e,t)=>e+t.dataView.byteLength),0),a=new ArrayBuffer(n+e.data.byteLength),o=new DataView(a),s=new DataView(e.data),c=0;for(let e=0;e<r.length;e++)for(let t=0;t<r[e].dataView.byteLength;t++)o.setInt8(c++,r[e].dataView.getInt8(t));for(let i=0;i<e.data.byteLength;i++)o.setInt8(c++,s.getInt8(i));return e.data=a,r.length}return 0}},oP=class extends iP{constructor(e){super(arguments.length>1&&void 0!==arguments[1]?arguments[1]:4,TL),hA(this,"profile",aA({},UA)),hA(this,"avoidCropping",!1),hA(this,"_scaleResolutionDownBy"),hA(this,"stat",{bytesSent:0,packetsSent:0,framesEncoded:0,framesSent:0,frameWidth:0,frameHeight:0,fpsCapture:0,framesCaptured:0}),hA(this,"small"),hA(this,"isNeedToSetBandwidth"),hA(this,"muteImage"),hA(this,"manager"),hA(this,"_seiCodec",new aP),this.manager=e;let t=()=>{var e;if(this.isAllowed2k4k(this.profile))this.room&&this.settings.height>=1440&&"publish"===this.state&&this.room.sendAbilityStatus({"2k4k":1});else{let t=ak((null==(e=this.room)?void 0:e.sdkAppId)||0)?NA:OA;this.log.warn("Resolution is reset to 1080p, need to upgrade ability here ".concat(t)),this.setProfile(oA(aA({},this.profile),{width:1920,height:1080})),this.applyProfile()}};this.on("input-media-track-changed",t),this.on("publish",t),this.handleCameraAdded=this.handleCameraAdded.bind(this),this.handleCameraRemoved=this.handleCameraRemoved.bind(this)}get facingMode(){if(sN&&this.mediaTrack)return this.mediaTrack.getSettings().facingMode}get contentHint(){var e;return(null==(e=this._inputTrack)?void 0:e.contentHint)||""}get isQosClearFirst(){var e;return"detail"===(null==(e=this._inputTrack)?void 0:e.contentHint)}get hasSmall(){var e;return!(null==(e=this.manager)||!e.hasSmall)}async setMute(e){var t,i,r;if(Rk(e)){if(this.muteImage===e)return;await(null==(t=this.manager)?void 0:t.deleteWatermark("mute")),await(null==(i=this.manager)?void 0:i.setWatermark({x:0,y:0,width:this.settings.width,height:this.settings.height,type:"mute",zIndex:999,imageUrl:e,fillVideo:!0})),this.muteImage=e,super.setMute(!1)}else this.muteImage&&(await(null==(r=this.manager)?void 0:r.deleteWatermark("mute")),this.muteImage=void 0),super.setMute(e)}async capture(e){let{deviceId:t,facingMode:i,useExactDeviceId:r=!0,customSource:n,retryWhenExactFailed:a=!0}=e,o={audio:!1,video:!0,facingMode:i||this.facingMode,cameraId:t,width:this.profile.width,height:this.profile.height,frameRate:this.profile.frameRate,useExactDeviceId:r,retryWhenExactFailed:a,customSource:n};if("environment"===o.facingMode){let e=await this.getDeviceIdWhenUsingBackCamera();e&&(o.cameraId=e)}return super.capture(o)}setProfile(e){var t;let i=this.fallbackProfile(e);if(i.bitrate&&(this.isNeedToSetBandwidth=i.bitrate!==this.profile.bitrate),this.isAllowed2k4k(this.profile))super.setProfile(i);else{let e=ak((null==(t=this.room)?void 0:t.sdkAppId)||0)?NA:OA;this.log.warn("Resolution is reset to 1080p, need to upgrade ability here ".concat(e)),super.setProfile(oA(aA({},this.profile),{width:1920,height:1080}))}}async applyProfile(){var e;if(!this.mediaTrack)return;let{width:t=0,height:i=0}=(this.sourceTrack||this.mediaTrack).getSettings(),r=t*i,n=this.settings,a=n.height!==this.profile.height||n.width!==this.profile.width||n.frameRate!==this.profile.frameRate;if(a&&(16===KD&&this.deviceId?await this.recapture(this.deviceId):(await(null==(e=this.sourceTrack||this.mediaTrack)?void 0:e.applyConstraints({width:this.profile.width,height:this.profile.height,frameRate:this.profile.frameRate})),this.manager&&this.manager.changeInput(this)),this.room&&this.settings.height>=1440&&"publish"===this.state&&this.room.sendAbilityStatus({"2k4k":1})),this.isNeedToSetBandwidth&&this.room&&this.room.setBandWidth){this.isNeedToSetBandwidth=!1;let{width:e=0,height:t=0}=(this.sourceTrack||this.mediaTrack).getSettings(),i=e*t;return a&&i&&r&&i===r?void this.log.warn("set bandwidth failed: resolution is not changed"):this.room.setBandWidth({bandwidth:this.profile.bitrate,type:VA,videoType:zA})}}get settings(){let e={width:this.profile.width,height:this.profile.height,frameRate:this.profile.frameRate},t=this.sourceTrack||this.mediaTrack;return sN&&t&&Object.assign(e,t.getSettings()),e}get scaleResolutionDownBy(){return this._scaleResolutionDownBy?this._scaleResolutionDownBy:dC(this.settings,this.profile)}isAllowed2k4k(e){var t;return!(this.room&&this.room.scheduleResult&&!this.isScreen&&!(e.height*e.width<3686400))||1===(null==(t=this.room.scheduleResult.trtcAutoConf)?void 0:t["2k4k"])}isNeedToSwitchDevice(e){return!(!this.mediaTrack||this.deviceId===e||this.facingMode===e)}async switchDevice(e){try{if(!this.isNeedToSwitchDevice(e)&&!this.isUseCustomSource)return;let t={useExactDeviceId:!0,retryWhenExactFailed:!1};"user"===e||"environment"===e?t.facingMode=e:t.deviceId=e,this.sourceTrack&&this.sourceTrack.stop(),await this.capture(t),aO.emit(oO.SWITCH_DEVICE_SUCCESS,{track:this}),this.log.info("switch camera success")}catch(TA){throw this.log.error("switch camera failed ".concat(TA)),this.deviceId&&this.recapture(this.deviceId),TA}}async getDeviceIdWhenUsingBackCamera(){let e;try{if(AD&&!PD&&lN){let t=(await $L(!0)).map((e=>{var t;return oA(aA({},e),{capabilities:null==(t=e.getCapabilities)?void 0:t.call(e)})})).filter((e=>{var t,i;return null==(i=null==(t=e.capabilities)?void 0:t.facingMode)?void 0:i.includes("environment")})),i=t[0];t.forEach((e=>{var t,r,n,a;let{capabilities:o}=e;(null!=(t=o.width)&&t.max&&null!=(r=o.height)&&r.max?o.width.max*o.height.max:0)>(null!=(n=i.capabilities.width)&&n.max&&null!=(a=i.capabilities.height)&&a.max?i.capabilities.width.max*i.capabilities.height.max:0)&&(i=e)})),null!=i&&i.capabilities&&(this._log.info("use max resolution back camera",i),e=i.deviceId)}}catch(TA){this._log.warn("get max res camera failed",TA)}return e}updateSmallConfig(e){var t,i;this._log.info("update small stream config: ".concat(JSON.stringify(e)));let r=!this.small;this.small=this.fallbackProfile(e,!0),null==(t=this.manager)||t.update(),r&&(null==(i=this.room)||i.enableSmall(!0)),this.log.info("update small stream config success")}fallbackProfile(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=e.width>e.height,r=aA({},e);return e.width*e.height<=19200&&zC&&FD&&(this.log.warn("".concat(t?"small ":"","resolution is ").concat(e.width,"*").concat(e.height,", fallback to 240*180 for android chrome")),r.width=i?240:180,r.height=i?180:240,r.bitrate=Math.max(e.bitrate,150)),e.width*e.height>921600&&XD&&(r.width=i?1280:720,r.height=i?720:1280,this.log.warn("reset to 1280 * 720 on iOS 13~14")),function(e,t){let i=e.split(".").map((e=>Number(e))),r=t.split(".").map((e=>Number(e)));for(let n=0;n<Math.max(i.length,r.length);n++){let e=i[n]||0,t=r[n]||0;if(e<t)return!0;if(e>t)return!1}return!1}(qD,"14.3")&&function(e,t){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=e.split(".").map((e=>Number(e))),n=t.split(".").map((e=>Number(e)));for(let a=0;a<Math.max(r.length,n.length);a++){let e=r[a]||0,t=n[a]||0;if(e>t)return!0;if(e<t)return!1}return i}(qD,"14.0",!0)&&this.on("7",(()=>{let e=this.profile.width>this.profile.height;this.profile.width*this.profile.height>307200?(this.profile.width=e?640:480,this.profile.height=e?480:640,this.log.warn("reduce the resolution to 480p on iOS 14.0 ~ 14.2")):this.profile.width*this.profile.height>230400&&(this.profile.width=e?640:360,this.profile.height=e?360:640,this.log.warn("reduce the resolution to 360p on iOS 14.0 ~ 14.2"))})),!t&&this.avoidCropping&&(FD||WC)&&!(zC||VC||FC||MC||PD)&&e.width*e.height<=230400&&e.width/e.height==16/9&&(this._scaleResolutionDownBy=1280/e.width,e.width=1280,e.height=720,this.log.warn("capture 720p, scale: ".concat(this._scaleResolutionDownBy))),r}stopSmall(){var e,t;this.small&&(delete this.small,null==(e=this.manager)||e.update(),null==(t=this.room)||t.enableSmall(!1))}listenDeviceChange(){XL&&!XL.listeners("videoInputRemoved").includes(this.handleCameraRemoved)&&XL.on("videoInputRemoved",this.handleCameraRemoved,this)}async handleCameraRemoved(e){if(e.deviceId===this.deviceId){let t=1===this.recaptureMode;if(this.log.warn("RecaptureMode: ".concat(tP[this.recaptureMode],". Current camera is lost: ").concat(JSON.stringify(e))),0===this.recaptureMode){OP(this.userId,{eventId:2003,param1:7,streamType:2});let e=await $L();e[0]?this.recapture(e[0].deviceId):t=!0}t&&XL.on("videoInputAdded",this.handleCameraAdded,this)}}async handleCameraAdded(e){1===this.recaptureMode&&e.deviceId!==this.deviceId||(XL.off("videoInputAdded",this.handleCameraAdded,this),this.log.warn("camera added: ".concat(JSON.stringify(e))),this.recapture(e.deviceId))}encodeFrame(e,t){if(!this.manager)return e;let i=t?8:this.mediaType;return this.manager.encodePipeline.reduceRight(((e,t)=>t?t({frame:e,mediaType:i}):e),e)}get enableEncodeFrame(){return!!this.manager&&this.manager.encodePipeline.some((e=>e))}play(e,t){return Ak(this.mirror)&&!this.isScreen&&this.setMirror("view"),super.play(e,t)}close(){XL.off("videoInputAdded",this.handleCameraAdded,this),XL.off("videoInputRemoved",this.handleCameraRemoved,this),super.close()}async recapture(e){try{await super.recapture(e)}catch(TA){let i=(await $L()).find((t=>t.deviceId!==e));if(!i)throw TA;await super.recapture(i.deviceId)}}setContentHint(e){this.mediaTrack&&"contentHint"in this.mediaTrack&&(this.mediaTrack.contentHint!==e&&(this.log.info("setContentHint ".concat(e)),this.mediaTrack.contentHint=e),this.outMediaTrack&&this.outMediaTrack.contentHint!==e&&(this.outMediaTrack.contentHint=e))}setRotation(e){this.manager&&(this.isScreen||Ak(e)||e!==this.rotation&&(this.rotation=e,this.manager.rotation=e))}};uA([EA((function(e){this.setContentHint(e.contentHint||"motion")}))],oP.prototype,"capture",1);var sP=[-1,-1,1,-1,-1,1,1,1],cP=[0,0,1,0,0,1,1,1],lP=class e extends BN{constructor(e,t){if(super(),this.context=e,hA(this,"name"),hA(this,"input"),hA(this,"output"),hA(this,"texture"),hA(this,"ctx2d",null),hA(this,"fbo"),hA(this,"width",0),hA(this,"height",0),hA(this,"x",0),hA(this,"y",0),hA(this,"program"),hA(this,"vertexShader"),hA(this,"fragmentShader"),hA(this,"totalFrames",0),hA(this,"dropFrames",0),hA(this,"matchInputSize",!0),hA(this,"texCoordBuffer"),hA(this,"positionBuffer"),hA(this,"lastInfo",{name:"",timestamp:0,totalFrames:0,x:0,y:0,width:0,height:0,fps:0}),hA(this,"cost",0),hA(this,"_canvas",null),hA(this,"_image"),hA(this,"log"),this.context.on("disconnect",this.close,this),this.name=t.name,this.log=t.logger,this.matchInputSize=!1!==t.matchInputSize,this.width=t.width||e.width,this.height=t.height||e.height,this._image=t.image,e instanceof IP)e.ctx&&t.create2d&&("function"==typeof OffscreenCanvas&&16!==KD?this._canvas=new OffscreenCanvas(this.width,this.height):(this._canvas=document.createElement("canvas"),this._canvas.width=this.width,this._canvas.height=this.height),this.ctx2d=this._canvas.getContext("2d"),this._image=this._canvas);else try{let i=e.ctx;this.texCoordBuffer=this.createBuffer(cP),this.positionBuffer=this.createBuffer(sP),!1!==t.createTexture&&(this.texture=i.createTexture(),this.useTexture(),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MIN_FILTER,i.LINEAR),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MAG_FILTER,i.LINEAR),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_S,i.CLAMP_TO_EDGE),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_T,i.CLAMP_TO_EDGE),i.pixelStorei(i.UNPACK_ALIGNMENT,1)),t.useFbo&&(this.fbo=i.createFramebuffer(),this.useBufferFrame(),this.useTexture(),i.texImage2D(i.TEXTURE_2D,0,i.RGBA,this.width,this.height,0,i.RGBA,i.UNSIGNED_BYTE,null),i.framebufferTexture2D(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0,i.TEXTURE_2D,this.texture,0)),t.useDefaultProgram?this.program=e.defaultProgam:(t.vertexShaderSource||t.fragmentShaderSource)&&(this.vertexShader=t.vertexShaderSource?e.createShader(i.VERTEX_SHADER,t.vertexShaderSource):e.defaultVShader,this.fragmentShader=t.fragmentShaderSource?e.createShader(i.FRAGMENT_SHADER,t.fragmentShaderSource):e.defaultFShader,this.program=e.createProgram(this.vertexShader,this.fragmentShader))}catch(i){this.context.destroy(new PR({code:LR.VIDEO_MANAGER_ERROR,extraCode:3,message:"create video node ".concat(this.name," error ").concat(i.message||i)}))}}get image(){return this._image}set image(e){this._image=e}createFramebuffer(e){let t=this.context.ctx,i=t.createFramebuffer();return t.bindFramebuffer(t.FRAMEBUFFER,i),t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,e,0),i}connect(e){for(var t=arguments.length,i=new Array(t>1?t-1:0),r=1;r<t;r++)i[r-1]=arguments[r];return e.addInput(this,...i),this.output=e,e}addInput(e){this.input=e,this.matchInputSize&&e.width&&e.height&&this.resize(e.width,e.height)}requestFrame(e){let t=Date.now();return!!(this.context instanceof wP&&this.render(e)||this.context instanceof IP&&this.render2d(e))&&(this.totalFrames++,this.cost=Date.now()-t,!0)}render2d(e){var t;return!(null==(t=this.input)||!t.requestFrame(e))&&this.draw2d(this.input.image,0,0,this.width,this.height)}update(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;var t;null==(t=this.output)||t.update(e)}disconnect(){for(var e,t=arguments.length,i=new Array(t),r=0;r<t;r++)i[r]=arguments[r];null==(e=this.output)||e.removeInput(this,...i),delete this.output}removeInput(e){delete this.input}close(){var e,t;if(this.context.off("disconnect",this.close,this),null==(e=this.output)||e.removeInput(this),delete this.output,null==(t=this.input)||t.disconnect(),this.context instanceof wP){let e=this.context.ctx;e.deleteBuffer(this.texCoordBuffer),e.deleteBuffer(this.positionBuffer),this.fbo&&e.deleteFramebuffer(this.fbo),this.texture&&e.deleteTexture(this.texture),this.vertexShader&&this.vertexShader!==this.context.defaultVShader&&e.deleteShader(this.vertexShader),this.fragmentShader&&this.fragmentShader!==this.context.defaultFShader&&e.deleteShader(this.fragmentShader),this.program&&this.program!==this.context.defaultProgam&&e.deleteProgram(this.program)}this._canvas&&(this._canvas.width=0,this._canvas.height=0,this.ctx2d=null),this.removeAllListeners()}useTexture(){this.useTextures(this.texture)}useInputTexture(){var e;this.useTextures(null==(e=this.input)?void 0:e.texture)}useTextures(){let e=this.context.ctx;for(var t=arguments.length,i=new Array(t),r=0;r<t;r++)i[r]=arguments[r];i.forEach(((t,i)=>{t&&(e.activeTexture(e.TEXTURE0+i),e.bindTexture(e.TEXTURE_2D,t))}))}useProgram(){this.context.ctx.useProgram(this.program)}useBufferFrame(){let e=this.context.ctx;e.bindFramebuffer(e.FRAMEBUFFER,this.fbo||null)}createBuffer(e){let t=this.context.ctx,i=t.createBuffer();return t.bindBuffer(t.ARRAY_BUFFER,i),t.bufferData(t.ARRAY_BUFFER,new Float32Array(e),t.STATIC_DRAW),i}setTexBuffer(e){let t=this.context.ctx;t.bindBuffer(t.ARRAY_BUFFER,this.texCoordBuffer),t.bufferData(t.ARRAY_BUFFER,new Float32Array(e),t.STATIC_DRAW)}setPosBuffer(e){let t=this.context.ctx;t.bindBuffer(t.ARRAY_BUFFER,this.positionBuffer),t.bufferData(t.ARRAY_BUFFER,new Float32Array(e),t.STATIC_DRAW)}changeBufferData(e,t){let i=this.context.ctx;i.bindBuffer(i.ARRAY_BUFFER,e),i.bufferData(i.ARRAY_BUFFER,new Float32Array(t),i.STATIC_DRAW)}setAttributes(){let e=this.context.ctx;for(var t=arguments.length,i=new Array(t),r=0;r<t;r++)i[r]=arguments[r];i.forEach(((t,i)=>{e.enableVertexAttribArray(i),e.bindBuffer(e.ARRAY_BUFFER,t),e.vertexAttribPointer(i,2,e.FLOAT,!1,0,0)}))}getVertexPoint(e,t){return[e/this.width*2-1,t/this.height*2-1]}layout2texCoords(e){return[...this.getVertexPoint(e.x,e.y),...this.getVertexPoint(e.x+e.width,e.y),...this.getVertexPoint(e.x,e.y+e.height),...this.getVertexPoint(e.x+e.width,e.y+e.height)]}resize(e,t){if(this.width!==e||this.height!==t){if(this.width=e,this.height=t,this._canvas&&(this._canvas.width=e,this._canvas.height=t),this.texture&&this.fbo){this.useTexture();let i=this.context.ctx;i.texImage2D(i.TEXTURE_2D,0,i.RGBA,e,t,0,i.RGBA,i.UNSIGNED_BYTE,null)}this.output&&this.output.matchInputSize&&this.output.resize(e,t)}}draw(e,t){this.setAttributes(e||this.positionBuffer,t||this.texCoordBuffer);let i=this.context.ctx;i.drawArrays(i.TRIANGLE_STRIP,0,4)}draw2d(t,i,r,n,a,o,s,c,l){let d=!(Ak(o)||Ak(s)||Ak(c)||Ak(l));return!(!this.ctx2d||!t)&&(t instanceof ImageData?(d?this.ctx2d.putImageData(t,i,r,o,s,c,l):this.ctx2d.putImageData(t,i,r),this.emit(e.RENDER,this.ctx2d.canvas)):(d?this.ctx2d.drawImage(t,o,s,c,l,i,r,n,a):this.ctx2d.drawImage(t,i,r,n,a),this.emit(e.RENDER,t)),"undefined"!=typeof VideoFrame&&t instanceof VideoFrame&&t.close(),!0)}drawBackGround2d(e){this.ctx2d&&(this.ctx2d.save(),this.ctx2d.fillStyle=e,this.ctx2d.fillRect(0,0,this.width,this.height),this.ctx2d.restore())}getInfo(){var e;let{totalFrames:t,x:i,y:r,width:n,height:a,name:o,cost:s}=this,c=Date.now(),l=(t-this.lastInfo.totalFrames)/((c-this.lastInfo.timestamp)/1e3)|0;return this.lastInfo={totalFrames:t,x:i,y:r,width:n,height:a,timestamp:c,fps:l,name:o,cost:s},aA({parent:null==(e=this.input)?void 0:e.getInfo()},this.lastInfo)}createTexture(e){let t=this.context.ctx,i=t.createTexture();return this.useTextures(i),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.LINEAR),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.LINEAR),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),t.pixelStorei(t.UNPACK_ALIGNMENT,1),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,t.RGBA,t.UNSIGNED_BYTE,e),i}};hA(lP,"RENDER","render"),uA([MN(BN.INIT,"connected",{sync:!0})],lP.prototype,"connect",1),uA([MN("connected",BN.INIT,{ignoreError:!0,sync:!0})],lP.prototype,"disconnect",1),uA([MN([],"closed",{sync:!0})],lP.prototype,"close",1);var dP=lP,uP=Cx(function(e){return Dx((t=>{let i=0,r=setInterval((()=>t.next(i++)),e);return t.defer((()=>{clearInterval(r)})),"interval"}),"interval",arguments)}(250),Gx((()=>performance.now())),Mx()),hP=[0,1,1,1,0,0,1,0],pP=class extends dP{constructor(e,t){super(e,Object.assign({useDefaultProgram:!0,createTexture:!1,name:"destination"},t)),hA(this,"_intervalId",0),hA(this,"_sequence",0),hA(this,"checkGLError",!1),hA(this,"checkVisibilityChange"),e instanceof IP?this.ctx2d=e.ctx||null:e.available&&null!=t&&t.mirrorUpAndDown&&this.setTexBuffer(hP)}start(e){this.log.info("".concat(this.name," start render ").concat(e," fps")),GN.clearTask(this._intervalId),this._intervalId=GN.run("intervalInWorker",(()=>{if(e!==this.context.frameRate&&(GN.clearTask(this._intervalId),this.start(this.context.frameRate)),this.requestFrame(this._sequence++),this.checkGLError&&this.context instanceof wP){let e=this.context.ctx.getError();e&&this.context.destroy(new PR({code:LR.VIDEO_MANAGER_ERROR,extraCode:5,message:"".concat(this.name," req ").concat(this._sequence," render ").concat(this.totalFrames," faild ").concat(e)}))}}),{fps:this.context.frameRate})}render(e){var t;return!(null==(t=this.input)||!t.requestFrame(e))&&(this.useProgram(),this.useBufferFrame(),this.useInputTexture(),this.draw(),this.emit(dP.RENDER,this.context._canvas),!0)}addInput(e){for(var t=arguments.length,i=new Array(t>1?t-1:0),r=1;r<t;r++)i[r-1]=arguments[r];super.addInput(e,...i),this.start(this.context.frameRate)}update(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;"closed"!==this.state&&(this._intervalId&&(GN.clearTask(this._intervalId),this._intervalId=0,1===e&&(this.log.info("".concat(this.name," use requestVideoFrameCallback")),this.checkVisibilityChange=()=>{document.hidden&&(this.start(this.context.frameRate),this.log.info("".concat(this.name," use timer")),document.removeEventListener("visibilitychange",this.checkVisibilityChange))},document.addEventListener("visibilitychange",this.checkVisibilityChange))),this.requestFrame(this._sequence++))}removeInput(e){super.removeInput(e),GN.clearTask(this._intervalId)}resize(e,t){super.resize(e,t),this.context.setSize(e,t)}close(){super.close(),GN.clearTask(this._intervalId),document.removeEventListener("visibilitychange",this.checkVisibilityChange)}},fP=class extends pP{constructor(e,t){super(e,t),hA(this,"_videoTrack"),hA(this,"_muteOb"),hA(this,"_closedOb",Vx(this,"closed")),hA(this,"_subscription"),hA(this,"_canvasContainer"),Number(GD)<17&&(this._canvasContainer=document.createElement("div"),this._canvasContainer.style.display="none"),[this._videoTrack]=e.canvas.captureStream().getVideoTracks(),this._muteOb=Vx(this._videoTrack,"mute"),Cx(Vx(this._videoTrack,"ended"),jx(this._closedOb),$x((()=>{this.context.destroy(new PR({code:LR.VIDEO_MANAGER_ERROR,extraCode:8,message:"video track ended"}))})))}enableCheckMute(){this._subscription=Cx(this._muteOb,jx(this._closedOb),Qx((e=>t=>{let i=performance.now();Cx(uP,Wx((t=>t-i<e)),zx(1))(t)})(5e3)),Hx((()=>{var e;return!(null==(e=this._videoTrack)||!e.muted||document.hidden)})),$x((()=>{this.context.destroy(new PR({code:LR.VIDEO_MANAGER_ERROR,extraCode:7,message:"video track muted"}))})))}disableCheckMute(){var e;null==(e=this._subscription)||e.dispose()}get videoTrack(){return this._videoTrack}putCanvasIntoDom(){!this.context._canvas||!this._canvasContainer||document.getElementById(this.context._canvas.id)||(this.log.info("".concat(this.name," put canvas to body")),document.body.appendChild(this._canvasContainer),this._canvasContainer.appendChild(this.context._canvas))}render(e){return this.putCanvasIntoDom(),super.render(e)}render2d(e){return this.putCanvasIntoDom(),super.render2d(e)}close(){var e,t;super.close(),null==(e=this._videoTrack)||e.stop(),delete this._videoTrack,null==(t=this._canvasContainer)||t.remove()}},mP=class extends dP{constructor(e,t){super(e,aA({name:"imageSource"},t)),hA(this,"_lastImage"),hA(this,"_totalFrames",0),hA(this,"_autoResize",!1),hA(this,"_canvasRendered"),hA(this,"videoCallbackId",0),hA(this,"waitingFirstFrame",!0),hA(this,"shouldUpdate",!0),this._autoResize=!1!==(null==t?void 0:t.autoResize),16===KD&&(this._canvasRendered=Fx(),Cx(this._canvasRendered,function(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];return e=>Dx((function(i){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:t.length;for(;r<n&&!i.disposed;)i.next(t[r++]);i.disposed||i.subscribe(e)}),"startWith",arguments)}(this._image),Zx((e=>e instanceof HTMLCanvasElement?Vx(e,"rendered"):function(){return Dx((e=>e.complete()),"empty",arguments)}())),jx(Vx(this,"closed")),$x((()=>{this.update()}))))}onFirstFrame(){this.waitingFirstFrame=!1}tryVideoFrameCallback(){if(!this.shouldUpdate)return;let e=this.image;this.videoCallbackId&&e.cancelVideoFrameCallback(this.videoCallbackId),wN()&&!document.hidden&&(this.videoCallbackId=e.requestVideoFrameCallback(((e,t)=>{this.waitingFirstFrame&&this.onFirstFrame(),document.hidden||(this._totalFrames=t.presentedFrames,this.update(1))})))}_render(e,t){var i;let{width:r,height:n}=this,{image:a}=this;if(a instanceof HTMLVideoElement){if(this.tryVideoFrameCallback(),({videoWidth:r,videoHeight:n}=a),!r||!n)return!1;a.width=r,a.height=n}else if(a instanceof HTMLImageElement||a instanceof ImageData||a instanceof ImageBitmap){if(({width:r,height:n}=a),a!==this._lastImage)this._lastImage=a;else if(r===this.width&&n===this.height)return!0}else a instanceof HTMLCanvasElement||a instanceof OffscreenCanvas?(({width:r,height:n}=a),this._lastImage=a):"undefined"!=typeof VideoFrame&&a instanceof VideoFrame&&(({displayWidth:r,displayHeight:n}=a),null==(i=this._lastImage)||i.close(),this._lastImage=a);if(!this._autoResize)return!0;if(this.width===r&&this.height===n&&this.totalFrames){if(t){this.useTexture();let e=this.context.ctx;e.texSubImage2D(e.TEXTURE_2D,0,0,0,e.RGBA,e.UNSIGNED_BYTE,a)}}else{if(t){this.useTexture();let e=this.context.ctx;e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,a)}this.resize(r,n)}return!0}get image(){return this._image}set image(e){var t;null==(t=this._canvasRendered)||t.next(e),this._image=e}render(e){return this._render(e,!0)}render2d(e){return this._render(e,!1)}},gP=class extends mP{constructor(e,t,i){super(e,i),this._player=t,this.name="videoPlayerSource",Cx(Vx(this._player,qN.PLAYER_STATE_CHANGED),jx(Vx(this,"closed")),Hx((e=>{let{state:t}=e;return"PLAYING"===t})),$x((()=>{this.tryVideoFrameCallback()})))}get image(){return this._player.element}},vP=class extends gP{get available(){return this._player.isPlaying&&!this.waitingFirstFrame}constructor(e,t,i){super(e,new TL({id:i.name,track:t,muted:!0,container:null,objectFit:"contain",log:i.logger}),i),this.name="videoTrackSource",this._player.play()}replaceTrack(e){this.waitingFirstFrame=!0,this._player.setTrack(e),this._player.play()}close(){super.close(),this._player.stop()}},_P=class extends dP{constructor(e,t,i){super(e,oA(aA({name:"textSource"},i),{create2d:!0})),hA(this,"hasChange",!0),hA(this,"content",""),this.ctx2d.textBaseline="top",this.content=t.content||"",t.font&&(this.font=t.font),t.color&&(this.color=t.color)}set font(e){this.ctx2d&&(this.ctx2d.font=e,this.hasChange=!0)}get font(){var e;return(null==(e=this.ctx2d)?void 0:e.font)||""}set color(e){this.ctx2d&&(this.ctx2d.fillStyle=e,this.hasChange=!0)}get color(){var e;return(null==(e=this.ctx2d)?void 0:e.fillStyle)||""}render2d(e){return!(!this.ctx2d||!this.hasChange)&&(this.ctx2d.clearRect(0,0,this.width,this.height),this.drawMultilineText(0,0),this.hasChange=!1,!0)}render(e){return!1}resize(e,t){if(!this.ctx2d)return;let{color:i,font:r}=this;super.resize(e,t),this.color=i,this.font=r}drawMultilineText(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1.2;if(!this.ctx2d)return;let r=this.ctx2d.measureText(this.content);t+=r.fontBoundingBoxAscent||r.actualBoundingBoxAscent||0;let n=this.font.match(/(\d+)px/),a=(n?parseInt(n[1],10):16)*i,o=this.content.split("\n");for(let s=0;s<o.length;s++)this.ctx2d.fillText(o[s],e,t+s*a)}},yP=class extends BN{constructor(e){super(),hA(this,"frameRate"),hA(this,"_canvas"),hA(this,"log"),hA(this,"hasAlpha",!1),hA(this,"name"),hA(this,"error"),this.name=e.name,this.log=e.logger.createChild({id:"vc-".concat(this.name)}),this.frameRate=e.frameRate}get canvas(){return this._canvas}set width(e){this._canvas&&(this._canvas.width=e)}get width(){var e;return(null==(e=this._canvas)?void 0:e.width)||0}set height(e){this._canvas&&(this._canvas.height=e)}get height(){var e;return(null==(e=this._canvas)?void 0:e.height)||0}setSize(e,t){this._canvas&&(this._canvas.width=e,this._canvas.height=t)}createVideoTrackSource(e,t){return new vP(this,e,{logger:this.log,name:t})}createVideoTrackDestination(e){return new fP(this,e)}createVideoImageSource(e,t){return new mP(this,t?Object.assign(t,{logger:this.log,image:e}):{logger:this.log,image:e})}createVideoPlayerSource(e,t){return new gP(this,e,t?Object.assign(t,{logger:this.log}):{logger:this.log})}createTextSource(e,t){return new _P(this,e,t?Object.assign(t,{logger:this.log}):{logger:this.log})}get available(){return"created"===this.state}disconnect(){this.emit("disconnect")}};hA(yP,"_ids",0);var EP={alpha:!0,antialias:!1,premultipliedAlpha:!1,preserveDrawingBuffer:!1,depth:!1,stencil:!1,failIfMajorPerformanceCaveat:!0,powerPreference:"low-power"},bP=class extends yP{constructor(){super(...arguments),hA(this,"defaultProgam"),hA(this,"defaultVShader"),hA(this,"defaultFShader"),hA(this,"ctx"),hA(this,"_canvas2d")}get canvas(){return this._canvas2d||this._canvas}create(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(this._canvas||(this._canvas=document.createElement("canvas"),this._canvas.id="trtc_".concat(this.name,"_").concat(yP._ids++)),e&&(this._canvas2d=document.createElement("canvas")),this.ctx=this._canvas.getContext("webgl2",EP),!this.ctx)throw new PR({code:LR.VIDEO_MANAGER_ERROR,extraCode:2,message:"webgl2 not supported"});this.defaultVShader=this.createShader(this.ctx.VERTEX_SHADER,"\n// 顶点着色器\nattribute vec4 a_position;\nattribute vec2 a_texCoord;\nvarying vec2 v_texCoord;\n\nvoid main() {\n gl_Position = a_position;\n v_texCoord = a_texCoord;\n}\n"),this.defaultFShader=this.createShader(this.ctx.FRAGMENT_SHADER,"\n// 片元着色器\nprecision mediump float;\nvarying vec2 v_texCoord;\nuniform sampler2D u_texture;\n\nvoid main() {\n gl_FragColor = texture2D(u_texture, v_texCoord);\n} "),this.defaultProgam=this.createProgram(this.defaultVShader,this.defaultFShader),this._canvas.addEventListener("webglcontextlost",(()=>{this.destroy(new PR({code:LR.VIDEO_MANAGER_ERROR,extraCode:4,message:"webgl context lost"}))}))}destroy(e){let t="";return e&&(t=e.message,this.error=e,wO.addFailedEvent({key:512702,error:e})),this.disconnect(),this.log.info("video context destroy".concat(t)?": ".concat(t):""),this.ctx&&(this.ctx.deleteShader(this.defaultVShader),this.ctx.deleteShader(this.defaultFShader),this.ctx.deleteProgram(this.defaultProgam),delete this.ctx),e}set width(e){var t;null==(t=this.ctx)||t.viewport(0,0,e,this.height),super.width=e,this._canvas2d&&(this._canvas2d.width=e)}set height(e){var t;null==(t=this.ctx)||t.viewport(0,0,this.width,e),super.height=e,this._canvas2d&&(this._canvas2d.height=e)}setSize(e,t){var i;null==(i=this.ctx)||i.viewport(0,0,e,t),super.setSize(e,t),this._canvas2d&&(this._canvas2d.width=e,this._canvas2d.height=t)}createShader(e,t){let i=this.ctx,r=i.createShader(e);return i.shaderSource(r,t),i.compileShader(r),r}createProgram(e,t){let i=this.ctx,r=i.createProgram();return i.attachShader(r,e),i.attachShader(r,t),i.linkProgram(r),i.getProgramParameter(r,i.LINK_STATUS)||this.log.error(i.getProgramInfoLog(r)),r}};hA(bP,"UNAVAILABLE","unavailable"),uA([MN(BN.INIT,"created",{sync:!0,fail(e){this.log.error("video gl context create failed",e.cause),wO.addFailedEvent({key:512700,error:e.cause||e})},success(){this.log.info("video context created use webgl"),wO.addSuccessEvent({key:512700})}})],bP.prototype,"create",1),uA([MN("created",BN.INIT,{ignoreError:!0,sync:!0,success(e){e&&this.emit(bP.UNAVAILABLE,e),this.removeAllListeners()}})],bP.prototype,"destroy",1);var wP=bP,IP=class extends yP{constructor(){super(...arguments),hA(this,"ctx")}create(e){if(this.hasAlpha=e.alpha,this._canvas=document.createElement("canvas"),this._canvas.id="trtc_".concat(this.name,"_").concat(yP._ids++),this.ctx=this._canvas.getContext("2d",{alpha:e.alpha,willReadFrequently:e.willReadFrequently}),!this.ctx)throw new PR({code:LR.VIDEO_MANAGER_ERROR,extraCode:2,message:"2d context not supported"});this._canvas.addEventListener("contextlost",(()=>{this.log.error("2d context lost")})),this._canvas.addEventListener("contextrestored",(()=>{this.log.warn("2d context restored")}))}destroy(e){let t="";e&&(t=e.message,this.error=e,wO.addFailedEvent({key:512703,error:e})),this.disconnect(),this.log.info("video context destroy ".concat(t?": ".concat(t):"")),delete this.ctx,this._canvas&&(this._canvas.remove(),this._canvas.width=0,this._canvas.height=0,delete this._canvas),this.removeAllListeners(),wO.addSuccessEvent({key:512703})}};uA([MN(BN.INIT,"created",{sync:!0,fail(e){this.log.error("video 2d context create failed",e.cause),wO.addFailedEvent({key:512701,error:e.cause||e})},success(){this.log.info("video context created use 2d"),wO.addSuccessEvent({key:512701})}})],IP.prototype,"create",1),uA([MN("created",BN.INIT,{ignoreError:!0,sync:!0})],IP.prototype,"destroy",1);var TP=dO();if("undefined"!=typeof navigator&&navigator.mediaDevices&&"setCaptureHandleConfig"in navigator.mediaDevices)try{navigator.mediaDevices.setCaptureHandleConfig({handle:TP,exposeOrigin:!0,permittedOrigins:["*"]})}catch(KS){}var SP=async function(e){let t=null,i=function(e){let t={preferCurrentTab:"current-tab"===e.preferDisplaySurface||!!e.captureElement,systemAudio:"include",selfBrowserSurface:"include",surfaceSwitching:"include"},i={width:jD?{max:e.width}:{ideal:e.width,max:e.width},height:jD?{max:e.height}:{ideal:e.height,max:e.height},frameRate:e.frameRate,displaySurface:e.preferDisplaySurface||"monitor"};if(t.video=i,e.systemAudio){let{echoCancellation:i=!0,noiseSuppression:r=!1,autoGainControl:n=!1}=e;t.audio={echoCancellation:i,noiseSuppression:r,autoGainControl:n,sampleRate:48e3}}return t}(e);lO.info("getDisplayMedia with constraints: ".concat(JSON.stringify(i)));let r=await navigator.mediaDevices.getDisplayMedia(i);e.systemAudio&&0===r.getAudioTracks().length&&(BD&&HD<74||jD||WC)&&lO.warn("Your browser not support capture system audio");let n=r.getVideoTracks()[0];if(n){if(e.frameRate)try{await n.applyConstraints({frameRate:{min:e.frameRate,ideal:e.frameRate},width:e.width,height:e.height})}catch(a){lO.warn("screen applyConstraints failed: ".concat(a))}e.captureElement&&await async function(e,t){var i;if("CropTarget"in window&&"fromElement"in CropTarget&&Sk(e.cropTo))try{if((null==(i=e.getCaptureHandle())?void 0:i.handle)!==TP)return;let r=await CropTarget.fromElement(t);await e.cropTo(r)}catch(r){lO.warn("cropTo target failed ".concat(r))}}(n,e.captureElement)}if(e.audio){let i=function(e){let t={echoCancellation:e.echoCancellation,autoGainControl:e.autoGainControl,noiseSuppression:e.noiseSuppression,sampleRate:e.sampleRate,channelCount:e.channelCount};return Ak(e.microphoneId)||(t.deviceId=e.microphoneId),{audio:t,video:!1}}(e);lO.info("getUserMedia with constraints: ".concat(JSON.stringify(i))),t=await navigator.mediaDevices.getUserMedia(i),r.addTrack(t.getAudioTracks()[0])}return r};uA([EA((function(e){this.setContentHint(e.contentHint||"detail")}))],class extends oP{constructor(e){super(e,2),hA(this,"profile",{width:1920,height:1080,frameRate:5,bitrate:1600}),hA(this,"objectFit","contain"),hA(this,"isScreen",!0),this._log.id="s-".concat(this._log.id)}get isShareCurrentTab(){var e,t;try{return TP===(null==(t=null==(e=this.mediaTrack)?void 0:e.getCaptureHandle())?void 0:t.handle)}catch(i){return}}async capture(e){let{systemAudio:t=!1,autoGainControl:i,echoCancellation:r,noiseSuppression:n,audioTrack:a,videoTrack:o,captureElement:s,preferDisplaySurface:c}=e;try{let e;return o||a?(e=new MediaStream,o&&e.addTrack(o),a&&e.addTrack(a)):(e=await SP({audio:!1,systemAudio:t,width:this.profile.width,height:this.profile.height,frameRate:this.profile.frameRate,autoGainControl:i,echoCancellation:r,noiseSuppression:n,captureElement:s,preferDisplaySurface:c}),this.sourceTrack=e.getVideoTracks()[0]),await this.setInputMediaStreamTrack(e.getVideoTracks()[0]),e}catch(l){throw this.log.error("getDisplayMedia error observed ".concat(l)),l instanceof PR?l:new PR({code:LR.INITIALIZE_FAILED,name:l.name,message:l.message})}}async switchDevice(e){throw new Error("Method not implemented.")}}.prototype,"capture",1);var AP=class e extends cx{constructor(t,i,r){super({userId:i.userId,sdkAppId:t.sdkAppId,mediaType:r,room:t}),this.room=t,this.user=i,hA(this,"tinyId"),hA(this,"isRemote",!0),hA(this,"jitterBufferDelay",0),hA(this,"availableState"),hA(this,"remotePublishState"),hA(this,"_triggerCheckDecodeSubject",Fx(Vx(this,e.STATE_SUBSCRIBE))),hA(this,"ignoreUpdatePlayingState"),this.tinyId=i.tinyId,this.availableState=new BN("".concat(i.userId,"-").concat(this.mediaType,"-available"),"remote-track-available"),this.remotePublishState=new BN("".concat(i.userId,"-").concat(this.mediaType,"-remote-publish"),"remote-track-publish"),Cx(Ux(Vx(this,BN.STATECHANGED),Vx(this.remotePublishState,BN.STATECHANGED)),Gx((()=>this.isRemotePublished&&(this.isSubscribed||this.isSubscribing))),$x((e=>{this.availableState.state!==(e?BN.ON:BN.OFF)&&(this.availableState.state=e?BN.ON:BN.OFF),(!this.isRemotePublished||!this.ignoreUpdatePlayingState)&&this.updatePlayingState(e)})));let n=Cx(Vx(this.player,qN.ERROR),Hx((e=>e.code===MediaError.MEDIA_ERR_DECODE))),a=Cx(function(e,t){return Dx((i=>{let r=0,n=setTimeout((()=>{if(i.removeDefer(a),i.next(r++),t){let e=setInterval((()=>i.next(r++)),t);i.defer((()=>{clearInterval(e)}))}else i.complete()}),e),a=()=>clearTimeout(n);i.defer(a)}),"timer",arguments)}(5e3),Hx((()=>!(this.ignoreDecodeError||!this.isSubscribed||!this.isPlayCalled||!this.stat.bytesReceived)&&(!this.player.isPlaying&&!(this.kind===BA?this.getAudioLevel()>0:this.stat.framesDecoded>0)||(this.reportDecodeResult(!0),!1))))),o=Cx(function(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];return Dx((e=>{let i=new Map;t.forEach((t=>{let r=new Rx(e);i.set(t,r),r.complete=()=>{i.delete(t),0===i.size?e.complete():r.dispose()},r.next=e=>{i.delete(t),i.forEach((e=>e.dispose())),r.resetNext(),r.resetComplete(),r.next(e)}})),t.forEach((e=>i.get(e).subscribe(e)))}),"race",arguments)}(n,a),jx(Vx(this,BN.INIT)));Cx(this._triggerCheckDecodeSubject,Hx((()=>!this.ignoreDecodeError)),Qx(o),$x((e=>{this.reportDecodeResult(!1,e)})))}setMute(e){this.isRemotePublished&&super.setMute(e)}setInputMediaStreamTrack(e){super.setInputMediaStreamTrack(e),this.isRemotePublished&&this.isSubscribed&&this.player.setTrack(this.outMediaTrack)}checkDecodeResult(){this._triggerCheckDecodeSubject.next(!0)}waitHasMediaTrack(){return new Promise((e=>{this.mediaTrack?e():this.once("input-media-track-changed",e)}))}get ignoreDecodeError(){var e,t;return((null==(t=null==(e=this.room)?void 0:e.networkQuality)?void 0:t.downlinkNetworkQuality)||0)>3||this.player.isInAutoPlayFailedState}get isSubscribing(){return"subscribeing"===this.state.toString()}get isSubscribed(){return this.state===e.STATE_SUBSCRIBE}get isAvailable(){return this.availableState.state===BN.ON}get isNeedPlay(){return this.isAvailable&&this.isPlayCalled}subscribe(e){return e}unsubscribe(){"main"===this.streamType&&"video"===this.kind&&this.room.changeType(!1,this.user)}reportDecodeResult(e,t){var i,r;let n=this.kind===BA;if(wO[e?"addSuccessEvent":"addFailedEvent"]({key:n?504700:514702}),!n){let t=(null==(i=this.room)?void 0:i.downlinkVideoCodec.toUpperCase())||"H264";wO[e?"addSuccessEvent":"addFailedEvent"]({key:EO["DECODE_".concat(t,"_RESULT")]}),e||this.log.warn("".concat(null==(r=this.room)?void 0:r.downlinkVideoCodec," decode failed"))}e||(wO.addEnum({key:n?504701:514703,value:rO()}),JN.uploadEvent({log:"stat-decode-failed-".concat(this.kind,"-").concat(eO()||nO()),userId:this.room.userId}),this._log.warn("decode failed: isPlaying: ".concat(this.player.isPlaying," ").concat(this.kind===BA?"audioLevel: ".concat(this.getAudioLevel()):"framesDecoded: ".concat(this.stat.framesDecoded>0))),this.emit("decode-failed",{error:t}))}updatePlayingState(e){if(this.player.isPlayCalled&&this.player.setTrack(this.playerMediaTrack),this.isPlayCalled&&this.player.isStopped===e){if(e&&(!this.isSubscribed||!this.isRemotePublished||!this.outMediaTrack))return void this.log.info("abort play, isSubscribed: ".concat(this.isSubscribed," isAvailable: ").concat(this.isRemotePublished," hasTrack: ").concat(!!this.outMediaTrack," "));super.updatePlayingState(e)}}close(){super.close(),this.outMediaTrack&&this.uninstallTrackEvent(this.outMediaTrack)}onFlagChanged(){this.remotePublishState.state=this.isRemotePublished?BN.ON:BN.OFF,this.emit("remote-publish-changed",this.isRemotePublished)}onTrackMuted(){this.isNeedPlay&&super.onTrackMuted()}onTrackUnmuted(){this.isNeedPlay&&super.onTrackUnmuted()}onTrackEnded(){this.isNeedPlay&&super.onTrackEnded()}};hA(AP,"STATE_SUBSCRIBE","subscribe"),uA([function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:30,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:2;return bA(((i,r)=>function(){for(var n=arguments.length,a=new Array(n),o=0;o<n;o++)a[o]=arguments[o];return new Promise(((n,o)=>{let s=setTimeout((()=>{let i=new PR({code:LR.API_CALL_TIMEOUT,message:"checkPendingPromise ".concat(r,"() timeout ").concat(e,"s")});(this.log||this._log||lO).warn(i),2===t?o(i):1===t&&n()}),1e3*e);this._checkPendingPromiseSet||(this._checkPendingPromiseSet=new Set),this._checkPendingPromiseSet.add(s),i.apply(this,a).then(n,o).finally((()=>{clearTimeout(s),this._checkPendingPromiseSet&&s&&this._checkPendingPromiseSet.delete(s)}))}))}))}(5,1)],AP.prototype,"waitHasMediaTrack",1),uA([MN(BN.INIT,AP.STATE_SUBSCRIBE,{success(){this.log.info("subscribed"),aO.emit(oO.REMOTE_TRACK_SUBSCRIBED,{track:this})},ignoreError:!0}),Ex(521716,!1)],AP.prototype,"subscribe",1),uA([MN(AP.STATE_SUBSCRIBE,BN.INIT,{sync:!0,success(){this.log.info("unsubscribed"),aO.emit(oO.REMOTE_TRACK_UNSUBSCRIBED,{track:this})}})],AP.prototype,"unsubscribe",1);var RP=AP,kP=class extends dP{constructor(e,t,i,r,n){super(e,{useDefaultProgram:!0,useFbo:!0,name:"alpha",create2d:!0,logger:t}),this.setContainer=r,hA(this,"initStat",{alphaStitchingType:1}),hA(this,"end",Fx()),hA(this,"minSize",320),hA(this,"maxSize",1280),hA(this,"draggable",!1),hA(this,"startDragX",0),hA(this,"startDragY",0),hA(this,"left",0),hA(this,"top",0),hA(this,"baseWidth",320),hA(this,"baseRatio"),hA(this,"container"),this.initStat=n,this.draggable=i,this.bindDragEvents()}bindDragEvents(){let e=this.context._canvas;if(e)if(this.draggable){let t=jx(this.end);Cx(Vx(e,"mousedown"),eP(this.startDrag.bind(this)),Zx((()=>Cx(Vx(window,"mousemove"),jx(Vx(window,"mouseup"))))),t,$x(this.doDrag.bind(this))),Cx(Vx(e,"dblclick"),t,$x(this.resetPosition.bind(this))),Cx(Vx(e,"wheel"),t,$x(this.handleZoom.bind(this))),this.renderCanvas()}else{if(!this.container)return;this.container.style.removeProperty("left"),this.container.style.removeProperty("top"),this.end.next()}}render(e){var t;return!(null==(t=this.input)||!t.requestFrame(e))&&(this.useProgram(),this.useBufferFrame(),this.useInputTexture(),this.draw(),!0)}startDrag(e){e.preventDefault(),0===e.button&&(this.startDragX=e.clientX-this.left,this.startDragY=e.clientY-this.top)}renderCanvas(){let{container:e}=this;e||this.setContainer(),e&&this.baseRatio&&this.draggable&&(e.style.setProperty("width","".concat(this.baseWidth,"px")),e.style.setProperty("height","".concat(this.baseWidth/this.baseRatio,"px")),e.style.setProperty("position","fixed"),e.style.setProperty("left","".concat(this.left,"px")),e.style.setProperty("top","".concat(this.top,"px")))}doDrag(e){e.preventDefault(),this.left=e.clientX-this.startDragX,this.top=e.clientY-this.startDragY,this.renderCanvas()}handleZoom(e){e.preventDefault();let t=e.deltaY,i=this.context._canvas;i&&(this.baseWidth||(this.baseWidth=i.offsetWidth),this.baseWidth=t<0?Math.min(1.1*this.baseWidth,this.maxSize):Math.max(.9*this.baseWidth,this.minSize),this.renderCanvas())}resetPosition(){this.left=0,this.top=0,this.renderCanvas()}onRatioReset(){this.renderCanvas()}draw2d(e,t,i,r,n){var a;let{ctx2d:o}=this,s=this.context._canvas;if(!o||!s)return!1;let c=super.draw2d(e,t,i,r,n),l=o.getImageData(0,0,r,n),{data:d}=l,u=!1;if(1===this.initStat.alphaStitchingType){let e=Math.floor(r/2);for(let t=0;t<n;t++)for(let i=0;i<e;i++){let n=4*(t*r+i),a=4*(t*r+(i+e)),o=d[a];d[a+3]=0;let s=o>=100;d[n+3]=s?255:0}u=super.draw2d(l,0,0,0,0,e,n),s.width=e}else if(2===this.initStat.alphaStitchingType){let e=Math.floor(n/2);for(let t=0;t<e;t++)for(let i=0;i<r;i++){let n=4*(t*r+i),a=4*((t+e)*r+i),o=d[a];d[a+3]=0;let s=o>=100;d[n+3]=s?255:0}u=super.draw2d(l,0,0,0,0,r,e),s.height=e}return null==(a=this.context.ctx)||a.clearRect(0,0,r,n),c&&u}close(){this.baseRatio=void 0,this.end.next(),this.end.complete()}};var CP=class extends RP{constructor(e,t){super(e,t,arguments.length>2&&void 0!==arguments[2]?arguments[2]:4),hA(this,"mediaType",4),hA(this,"source"),hA(this,"shouldRenderAlpha",!1),hA(this,"alphaNode"),hA(this,"shouldBeDraggable",!0),hA(this,"stat",{bytesReceived:0,packetsReceived:0,packetsLost:0,framesReceived:0,framesDecoded:0,frameWidth:0,frameHeight:0,end2EndDelay:0,jitterBufferDelay:0}),this.manager=e.videoManager,this.on("first-video-frame",(e=>{this.room.emit("first-video-frame",e)}))}isAlphaSei(e){if(this.userId!==e.userId||50!==e.seiPayloadType)return!1;let t=new Uint8Array(e.data);return t.length%3==0&&0===t[0]&&1===t[1]&&t}play(e,t){return(Ck(null==t?void 0:t.canvasRender)?t.canvasRender:17===KD)&&!this.source&&this.useCanvasPlayer(),super.play(e,t).then((()=>{this.player.calculateStat(),aO.emit("156",{track:this,player:this.player})}))}updateAlphaRenderInfo(e){let t=this.isAlphaSei(e);if(t)if(this.alphaNode){let e=t[2];if(this.alphaNode.baseRatio&&this.alphaNode.initStat.alphaStitchingType===e)return;this.alphaNode.initStat={alphaStitchingType:e};let i=this.player.getElement();if(i){let t=i.videoWidth/i.videoHeight;t&&(this.alphaNode.baseRatio=t*(1===e?.5:2),this.alphaNode.onRatioReset())}this.player.canvas&&(this.player.canvas.id=this.generateAlphaCanvasName(e))}else this.shouldRenderAlpha=!0,this.player.shouldRenderAlpha=!0,this.useCanvasPlayer(t[2])}generateAlphaCanvasName(e){let t=AA[e];return"".concat("alpha","_").concat(t,"_").concat(this.userId)}useCanvasPlayer(e){if(this.log.info("useCanvasPlayer(), has element:".concat(!!this.player.element)),!this.player.element)return;let t=new IP({frameRate:15,logger:this.log,name:this.shouldRenderAlpha&&e?this.generateAlphaCanvasName(e):this.userId});t.create({alpha:this.shouldRenderAlpha,willReadFrequently:this.shouldRenderAlpha});let i=new pP(t,{name:"remotePlayer",logger:this.log});if(this.source=t.createVideoPlayerSource(this.player),this.player.setCanvas(t._canvas),this.shouldRenderAlpha&&e){let r=()=>{!this.player.container||!this.alphaNode||(this.alphaNode.container=this.player.container,this.alphaNode.renderCanvas())},n=new kP(t,this.log,this.shouldBeDraggable,r,{alphaStitchingType:e});this.source.connect(n),n.connect(i),this.alphaNode=n}else this.source.connect(i);wN()||(this.updateCanvasPlayerFPS=this.updateCanvasPlayerFPS.bind(this,t),this.room.on("heartbeat-report",this.updateCanvasPlayerFPS,this))}updateCanvasPlayerFPS(e){let t=this.decodeFPS,i=function(e){return[15,30,45,60].reduce(((t,i)=>Math.abs(i-e)<Math.abs(t-e)?i:t))}(t);!kk(t)||t<=0?this.log.debug("updateCanvasPlayerFPS() ignore decoder: ".concat(t," ")):i!==e.frameRate?(this.log.info("updateCanvasPlayerFPS() decoder: ".concat(t,", closest: ").concat(i,", current: ").concat(e.frameRate)),e.frameRate=i):this.log.debug("updateCanvasPlayerFPS() ignore ClosestFPS ".concat(i," == ").concat(e.frameRate))}get decodeFPS(){var e;let{msg_video_status:t}=(null==(e=this.room.heartbeatReport)?void 0:e.msg_down_stream_info.find((e=>e.msg_user_info.str_identifier===this.userId)))||{},i=2===this.mediaType?7:this.isSmall?3:2;if(!t||0===t.length)return 0;let r=t.find((e=>e.uint32_video_stream_type===i));return(null==r?void 0:r.uint32_video_dec_fps)||0}stop(){return this.room.off("heartbeat-report",this.updateCanvasPlayerFPS,this),aO.emit("157",{track:this,player:this.player}),this.alphaNode&&this.alphaNode.close(),super.stop()}decodeFrame(e){if(!this.manager)return e;for(let t of this.manager.decodePipeline)if(t&&!(e=t({frame:e,track:this})))return;return e}get isBig(){return 4===this.mediaType}get isSmall(){return 8===this.mediaType}changeType(e){this.room.changeType(e,this.user)}get isRemotePublished(){return this.user.muteState.videoAvailable}setMirror(e){"publish"===e||"both"===e||super.setMirror(e)}setDraggable(e){this.shouldBeDraggable=e,this.alphaNode&&(this.alphaNode.draggable=e,this.alphaNode.bindDragEvents())}onDecodeDowngradeStateChanged(e){this.emit("decode-downgrade-state-changed",e)}},DP=new Map;function OP(e,t){let i=oA(aA({},t),{timestamp:MR()});DP.has(e)?DP.get(e).push(i):DP.set(e,[i])}aO.on(oO.JOIN_SUCCESS,(e=>{let{room:t}=e;OP(t.userId,{eventId:32788})})),aO.on(oO.LEAVE_START,(e=>{let{room:t}=e;OP(t.userId,{eventId:32789})})),aO.on(oO.LOCAL_TRACK_PUBLISHED,(e=>{let{track:t}=e;if(t.room){let e=32769;4===t.mediaType?e=32768:2===t.mediaType&&(e=32805),OP(t.room.userId,{eventId:e})}})),aO.on(oO.LOCAL_TRACK_UNPUBLISHED,(e=>{let{track:t}=e;if(t.room){let e=32771;4===t.mediaType?e=32770:2===t.mediaType&&(e=32806),OP(t.room.userId,{eventId:e})}})),aO.on(oO.TRACK_MUTED,(e=>{let{track:t}=e;t.room&&(t.kind===BA?OP(t.room.userId,{eventId:t.isRemote?32785:32772,remoteUserId:t.isRemote?t.userId:void 0}):OP(t.room.userId,{eventId:t.isRemote?32784:32773,remoteUserId:t.isRemote?t.userId:void 0}))})),aO.on(oO.TRACK_UNMUTED,(e=>{let{track:t}=e;t.room&&(t.kind===BA?OP(t.room.userId,{eventId:t.isRemote?32787:32774,remoteUserId:t.isRemote?t.userId:void 0}):OP(t.room.userId,{eventId:t.isRemote?32786:32775,remoteUserId:t.isRemote?t.userId:void 0}))})),aO.on(oO.REMOTE_TRACK_SUBSCRIBED,(e=>{let{track:t}=e;t.room&&(1===t.mediaType&&OP(t.room.userId,{eventId:32777,remoteUserId:t.userId}),4===t.mediaType&&OP(t.room.userId,{eventId:32776,remoteUserId:t.userId}),8===t.mediaType&&OP(t.room.userId,{eventId:32803,remoteUserId:t.userId}))})),aO.on(oO.REMOTE_TRACK_UNSUBSCRIBED,(e=>{let{track:t}=e;t.room&&(1===t.mediaType&&OP(t.room.userId,{eventId:32779,remoteUserId:t.userId}),4===t.mediaType&&OP(t.room.userId,{eventId:32778,remoteUserId:t.userId}),8===t.mediaType&&OP(t.room.userId,{eventId:32804,remoteUserId:t.userId}))})),aO.on(oO.SWITCH_DEVICE_SUCCESS,(e=>{let{track:t}=e;t.room&&OP(t.room.userId,{eventId:t.kind===VA?32780:32781})})),aO.on(oO.LOCAL_TRACK_REPLACED,(e=>{let{track:t}=e;t.room&&OP(t.room.userId,{eventId:t.kind===VA?32782:32783})})),aO.on(oO.SIGNAL_CONNECTION_STATE_CHANGED,(e=>{let t,{room:i,prevState:r,state:n}=e;switch(n){case"CONNECTED":t="RECONNECTING"===r?32795:32791;break;case"DISCONNECTED":t="RECONNECTING"===r?32796:32790;break;case"RECONNECTING":t=32794}t&&OP(i.userId,{eventId:t})})),aO.on(oO.PEER_CONNECTION_STATE_CHANGED,(e=>{let t,{room:i,prevState:r,state:n,remoteUserId:a}=e,o=!!a;switch(n){case"CONNECTED":t="RECONNECTING"===r?o?32801:32798:o?32793:32792;break;case"DISCONNECTED":"RECONNECTING"===r&&(t=o?32802:32799);break;case"RECONNECTING":t=o?32800:32797}t&&OP(i.userId,{eventId:t,remoteUserId:a})})),aO.on(oO.VIDEO_CODEC_IMPLEMENTATION_CHANGED,(e=>{let{implementation:t,userId:i,remoteUserId:r,codec:n,isHWCodec:a,prevImplementation:o,streamType:s}=e,c=a?1:0;o||(c=a?3:2);let l={H264:0,H265:1,VP8:2}[n.toUpperCase()],d={eventId:4004,param1:c,param2:l,streamType:s||2};r&&(d.remoteUserId=r,d.eventId=4005),OP(i,d),wO.addEnum({key:r?514701:513701,value:c}),wO.addEnum({key:r?514700:513700,value:l})})),aO.on(oO.LOCAL_TRACK_RECAPTURE,(e=>{let{track:t,error:i}=e;if(t.userId){let e={eventId:2003,param1:0};t.kind===BA?(e.streamType=1,i&&(e.param1=2)):(e.streamType="auxiliary"===t.streamType?7:2,i&&(e.param1=8)),OP(t.userId,e)}})),dA(fA(),1);var NP="trtc_debug_dialog",LP="".concat(NP,"_activated"),xP="".concat(NP,"_switch"),PP="".concat(NP,"_mask"),MP="".concat(NP,"_panel"),UP="".concat(NP,"_tabber"),FP="".concat(NP,"_tab"),BP="".concat(NP,"_topbar"),VP="".concat(NP,"_toptab"),HP="".concat(NP,"_content"),zP="".concat(NP,"_has_topbar"),jP="".concat(HP,"_log"),WP="".concat(HP,"_network"),GP="".concat(NP,"_dump"),qP="".concat(WP,"_title"),KP="".concat(WP,"_basic"),YP="".concat(WP,"_local"),XP="".concat(WP,"_remote"),ZP="".concat(GP,"_title"),JP="".concat(GP,"_local"),QP="".concat(GP,"_remote"),$P="".concat(QP,"_hook"),eM="".concat(NP,"_banner"),tM="".concat(eM,"_item"),iM="".concat(NP,"_toolbar"),rM="".concat(NP,"_tool"),nM="".concat(NP,"_item"),aM="".concat(nM,"_debug"),oM="".concat(nM,"_info"),sM="".concat(nM,"_warn"),cM="".concat(nM,"_error"),lM="".concat(NP,"_back_top"),dM="".concat(NP,"_go_bottom"),uM="".concat(GP,"_local_audio"),hM="".concat(GP,"_local_video_main"),pM="".concat(GP,"_local_video_aux"),fM="".concat(NP,"_tooltip"),mM="".concat(KP,"_network_info"),gM="".concat(KP,"_room_info"),vM="".concat(jP,"_controller"),_M="success",yM="warning",EM="failed",bM=0,wM=class extends HTMLElement{constructor(){super(),this.attachShadow({mode:"open"}),this.addStyle(),this.addDialog()}addDialog(){var e;let t=document.createElement("template");t.innerHTML='<div id="'.concat(NP,'" class="').concat(NP,'"><div class="').concat(xP,'">Debug#').concat(++bM,'</div><div class="').concat(PP,'"></div><div class="').concat(MP,'"><div class="').concat(UP,'"><a class="').concat(FP," ").concat(LP,'" data-tab="log">').concat(lR,'</a><a class="').concat(FP,'" data-tab="network">').concat(dR,'</a><a class="').concat(FP,'" data-tab="dump">').concat(uR,'</a></div><div class="').concat(vM,'"><div data-type="back_top">').concat(_R,'</div><div data-type="go_bottom">').concat(vR,'</div><div data-type="clear_log">').concat(yR,'</div></div><div class="').concat(BP,'"><a class="').concat(VP," ").concat(LP,'" data-type="all">All</a><a class="').concat(VP,'" data-type="debug">Debug</a><a class="').concat(VP,'" data-type="info">Info</a><a class="').concat(VP,'" data-type="warn">Warn</a><a class="').concat(VP,'" data-type="error">Error</a></div><div class="').concat(HP," ").concat(zP,'"><div class="').concat(jP,'"></div><div class="').concat(WP,'"><div class="').concat(qP,'">').concat(IR,'</div><div class="').concat(KP,'"><div class="').concat(gM,'"></div><div class="').concat(mM,'">').concat(wR,'</div></div><div class="').concat(qP,'">').concat(ER,'</div><div class="').concat(YP,'">').concat(wR,'</div><div class="').concat(qP,'">').concat(bR,'</div><div class="').concat(XP,'">').concat(wR,'</div></div><div class="').concat(GP,'"><div class="').concat(ZP,'">').concat(ER,'</div><div class="').concat(JP,'"><div id="').concat(uM,'"><span>').concat(AR," - ").concat(TR,'(s):</span><input type="number" min=0 value=0></input><button class="dump">').concat(uR,'</button><button class="end-dump" disabled>').concat(pR,'</button></div><div id="').concat(hM,'"><span>').concat(SR," - ").concat(TR,'(s):</span><input type="number" min=0 value=10></input><button class="dump">').concat(uR,'</button><button class="end-dump" disabled>').concat(pR,'</button></div><div id="').concat(pM,'"><span>').concat(RR," - ").concat(TR,'(s):</span><input type="number" min=0 value=10></input><button class="dump">').concat(uR,'</button><button class="end-dump" disabled>').concat(pR,'</button></div></div><div class="').concat(ZP,'">').concat(bR,'</div><div class="').concat(QP,'"><div class="').concat($P,"\">userId:<input id=\"dump-remote-video-hook-userid\" value='*' />duration:<input id=\"dump-remote-video-hook-duration\" min='1' value='10' type='number' />mediaType:<select id=\"dump-remote-video-hook-mediaType\" value='main' ><option value='main' checked>Video</option><option value='sub'>Screen</option></select><button id=\"dump-remote-video-hook-button\">dump if video is available</button></div></div></div></div><div class=\"").concat(eM,'"></div><div class="').concat(iM,'"><a id="trtc_upload" class="').concat(rM,'">').concat(fR,'</a><a id="trtc_export" class="').concat(rM,'">').concat(mR,'</a><a id="trtc_hide" class="').concat(rM,'">').concat(gR,"</a></div></div></div>"),null==(e=this.shadowRoot)||e.appendChild(t.content.firstChild)}addStyle(){var e;let t=document.createElement("style");t.textContent="#".concat(NP,"{font-size:14px;--DD-BG-0:#ededed;--DD-BG-1:#f7f7f7;--DD-BG-2:#fff;--DD-BORDER:rgba(0,0,0,0.1);--DD-ERROR:red;--DD-WARN:#fa9d3b;--DD-INFO:#000;--DD-DEBUG:#10aeff;--DD-WARN-BG:#fff3cc;--DD-ERROR-BG:#ffe6e6;}#").concat(NP," a,.").concat(xP,"{cursor:pointer;}.").concat(NP,"{color:black;}.").concat(xP,"{display:block;position:fixed;right:50px;bottom:").concat(150+50*bM,"px;border-radius:5px;background-color:#07c160;color:#fff;padding:5px 10px;z-index:10000;}.").concat(PP,"{display:none;position:fixed;left:0;top:0;right:0;bottom:0;z-index:10001;background-color:rgb(0,0,0,0.6);}.").concat(MP,"{background-color:#ededed;display:none;position:fixed;min-height:85%;left:60%;right:0;bottom:0;z-index:10002;border:1px solid var(--DD-BG-0);}@media (max-width:768px) {.").concat(MP,"{left:0;}}.").concat(UP,"{display:flex;height:2em;border-bottom:1px solid var(--DD-BORDER);}.").concat(FP,"{padding:0 20px;border-right:1px solid rgba(0,0,0,0.1);line-height:2em;color:black;}.").concat(FP,".").concat(LP,"{background-color:var(--DD-BG-2);}.").concat(FP,".disabled{cursor:not-allowed;background-color:#ededed;color:#999;}.").concat(BP,"{height:2em;display:flex;flex-direction:row;}.").concat(VP,"{width:20%;text-align:center;line-height:2em;border-right:1px solid var(--DD-BORDER);border-bottom:1px solid var(--DD-BORDER);color:black;}.").concat(VP,".").concat(LP,"{border-bottom:1px solid #1485ee;background-color:var(--DD-BG-2);}.").concat(HP,"{background-color:#fff;position:absolute;left:0;right:0;top:2em;bottom:8em;overflow-y:scroll;overflow-x:hidden;}.").concat(HP,".").concat(zP,"{top:4em;bottom:10em}.").concat(WP,"{display:none;}.").concat(GP,"{display:none;}.").concat(qP,",.").concat(ZP,"{line-height:2em;text-align:center;background-color:var(--DD-BG-0);border-bottom:1px solid var(--DD-BORDER);}.").concat(KP,",.").concat(YP,",.").concat(XP,"{text-align:center;border-bottom:1px solid var(--DD-BORDER);}.").concat(JP,",.").concat(QP,"{display:flex;flex-direction:column;padding:0.5em 0;justify-content:center;align-items:center;}.").concat(JP," div input{margin:0 10px;height:1.5em;width:4em;}.").concat(JP," div {padding:10px 0;border-radius:5px;}.").concat(JP," div button,.").concat(QP," div button {cursor:pointer;height:1.8em;border-radius:5px;margin-right:5px;}.").concat(JP," div button[disabled],.").concat(QP," div button[disabled]{cursor:not-allowed;}.").concat(QP," select {height:1.8em;margin:0 10px;}.").concat(QP," div input{margin:0 10px;height:1.5em;width:4em;}.").concat($P," {line-height:3em;padding:0.5em;}.").concat(qP,"{text-align:center;background-color:var(--DD-BG-0);border-bottom:1px solid var(--DD-BORDER);}.").concat(KP,",.").concat(YP,",.").concat(XP,"{text-align:center;border-bottom:1px solid var(--DD-BORDER);}.").concat(nM,"{border-bottom:1px solid var(--DD-BG-0);padding:5px 10px;overflow-wrap: break-word;}.").concat(cM,"{color:var(--DD-ERROR);background-color:var(--DD-ERROR-BG);}.").concat(sM,"{color:var(--DD-WARN);background-color:var(--DD-WARN-BG);}div .").concat(oM,"{color:var(--DD-INFO);}.").concat(aM,"{color:var(--DD-DEBUG);}.").concat(eM,"{position:absolute;left:0;right:0;bottom:2em;height:6em;border-bottom:1px solid var(--DD-BORDER);display:flex;flex-direction:column;overflow-y:scroll;background-color:var(--DD-BG-1);}.").concat(tM,"{border-bottom:1px solid var(--DD-BORDER);padding:5px 10px;overflow-wrap: break-word;}.").concat(iM,"{position:absolute;line-height:2em;display:flex;flex-direction:row;left:0;right:0;bottom:0;}.").concat(rM,"{flex:1;color:black;text-align:center;background-color:#ededed;border-right:1px solid var(--DD-BORDER);}#").concat(NP," .").concat(lM,",#").concat(NP," .").concat(dM,"{position:absolute;height:2em;width:6em;right:2em;border-radius:5px;background-color:rgba(30,136,229,0.8);z-index:10003;cursor:pointer;padding:0 5px;line-height:2em;color:white;text-align:center;}.").concat(dM,"{bottom:9em;}.").concat(lM,"{bottom:11.5em;}#").concat(NP," .").concat(rM,".disable{cursor:not-allowed;background-color:#ededed;color:#999;}.").concat(fM," {position:relative;display:inline-block;}.").concat(fM," .tooltiptext{visibility:hidden;width:180px;background-color:black;color:#fff;text-align:center;padding:5px 0;border-radius:6px;position:absolute;}.").concat(fM," .tooltip-top {bottom:125%;left:50%;margin-left:-90px;}.").concat(fM,":hover .tooltiptext{visibility:visible;}.").concat(vM,"{position:absolute;left:0;right:0;bottom:8em;height:2em;display:flex;align-items:center;}.").concat(vM," div{flex:1;cursor:pointer;border-right:1px solid var(--DD-BORDER);text-align: center;}"),null==(e=this.shadowRoot)||e.appendChild(t)}};customElements.define("trtc-basic-debug-dialog",wM);var IM=class{constructor(e,t,i,r){hA(this,"_dialogNode",null),hA(this,"_switchNode",null),hA(this,"_maskNode",null),hA(this,"_panelNode",null),hA(this,"_logContentNode",null),hA(this,"_networkContentNode",null),hA(this,"_dumpContentNode",null),hA(this,"_tabNodes",[]),hA(this,"_toptabNodes",[]),hA(this,"_hasMove",!1),hA(this,"_showDialog",!1),hA(this,"_isMobile",!1),hA(this,"_showLogType","all"),hA(this,"prevBytesSent",0),hA(this,"prevBytesReceived",0),hA(this,"_core"),hA(this,"_log"),hA(this,"_logList",[]),hA(this,"isUploading",!1),hA(this,"publishMap",new Map),hA(this,"dumpLocalVideoMap"),hA(this,"dumpRemoteVideoMap"),hA(this,"eventMap",new Map),hA(this,"switchPos",{x:0,y:0,startX:0,startY:0,endX:0,endY:0,isTouchEnd:!1}),hA(this,"handleLeaveSuccess",(e=>{let{room:t}=e;var i,r;if(!this.hitTest(t))return;let n=null==(r=null==(i=this._dialogNode)?void 0:i.shadowRoot)?void 0:r.querySelector(".".concat(QP));for(let a of this.publishMap.values())null==n||n.removeChild(a);this.publishMap.clear()})),hA(this,"handleJoinSuccess",(e=>{let{room:t}=e;var i,r;if(!this.hitTest(t))return;(null==(r=null==(i=this._dialogNode)?void 0:i.shadowRoot)?void 0:r.querySelector(".".concat(gM))).innerHTML="sdkAppId: ".concat(t.sdkAppId,"<br/>roomId: ").concat(t.roomId,"<br/>userId: ").concat(t.userId,"<br/>")})),hA(this,"handleRemoteVideoAvailable",(e=>{let t="sub"===e.streamType?"auxiliary":"main";this.renderDumpTab(e.userId,"remote",t,"publish")})),hA(this,"handleRemoteVideoUnavailable",(e=>{let t="sub"===e.streamType?"auxiliary":"main";this.renderDumpTab(e.userId,"remote",t,"unpublish")})),hA(this,"handleRemoteAudioAvailable",(e=>{this.renderDumpTab(e.userId,"remote","audio","publish")})),hA(this,"handleRemoteAudioUnavailable",(e=>{this.renderDumpTab(e.userId,"remote","audio","unpublish")})),hA(this,"renderDumpTab",((e,t,i,r)=>{var n,a,o;let s={main:"video",auxiliary:"screen",audio:"audio"},c=(e,t)=>{var i,r,n;let a=document.createElement("div");a.innerText="".concat(e," - ").concat(s[t]," - ").concat(TR,"(s):");let o=document.createElement("input");o.type="number",o.min="0",o.value="10",o.id="dump_remote_".concat(t,"_").concat(e);let c=document.createElement("button");c.innerText=pR,c.disabled=!0;let l,d=document.createElement("button");if(d.innerText=uR,d.onclick=()=>{let i,r,n=Number(o.value);if("audio"===t)({download:i,onDumpEnd:r}=this.dumpAudio("remote",n,e));else{if(!this.isSupportDumpVideo())return;({download:i,onDumpEnd:r}=this.dumpVideo(t,"remote",n,e))}i&&(this.inactiveButton(d,hR),n>0?setTimeout((()=>{null==i||i(),this.activeButton(d,uR)}),1e3*n):(this.activeButton(c),c.onclick=()=>{c.onclick=null,null==i||i(),null==r||r(),this.activeButton(d,uR),this.inactiveButton(c)}))},"audio"!==t){l=document.createElement("button"),l.innerText="preview",l.style.whiteSpace="pre";let i=document.createElement("video");document.body.appendChild(i),i.id="".concat(NP,"_preview_remote_").concat(t,"_").concat(e),i.style.cssText="\n width: 320px;\n height: 240px;\n display: none;\n position: absolute;\n top: 50%;\n left: 50%;\n border: 3px solid #cccccc;\n transform: translate(-50%, -50%);\n z-index: 10004;\n ",l.onclick=async()=>{var r;if(i.style.display="none"===i.style.display?"":"none",l&&(l.innerText="none"===i.style.display?"preview":" hide "),!i.srcObject){let n=this._core.room.remotePublishedUserMap.get(e);if(n){let e=null==(r=n["main"===t?"remoteVideoTrack":"remoteAuxiliaryTrack"])?void 0:r.mediaTrack;e?(i.srcObject=new MediaStream([e]),await i.play()):this.addInfoToBanner(EM,"failed to preview, remote video track is not available")}}}}a.appendChild(o),a.appendChild(d),a.appendChild(c),l&&a.appendChild(l),a.style.cssText="padding:10px;";let u=document.createElement("div");return u.style.cssText="width:100%;display:flex;justify-content:center;border-top: 1px solid var(--DD-BORDER);",u.appendChild(a),null==(n=null==(r=null==(i=this._dialogNode)?void 0:i.shadowRoot)?void 0:r.querySelector(".".concat(QP)))||n.appendChild(u),u};if("remote"===t)if("publish"===r){let r=c(e,i);this.publishMap.set("".concat(e,"-").concat(t,"-").concat(i),r)}else{let r=this.publishMap.get("".concat(e,"-").concat(t,"-").concat(i));if(!r)return;null==(o=null==(a=null==(n=this._dialogNode)?void 0:n.shadowRoot)?void 0:a.querySelector(".".concat(QP)))||o.removeChild(r);let s=document.querySelector("#".concat(NP,"_preview_remote_").concat(i,"_").concat(e));s&&document.body.removeChild(s),this.publishMap.delete("".concat(e,"-").concat(t,"-").concat(i))}})),hA(this,"handleStatistics",(e=>{var t,i,r,n,a,o;let s=(e.bytesSent-this.prevBytesSent)/2,c=(e.bytesReceived-this.prevBytesReceived)/2;this.prevBytesSent=e.bytesSent,this.prevBytesReceived=e.bytesReceived,(null==(i=null==(t=this._dialogNode)?void 0:t.shadowRoot)?void 0:i.querySelector(".".concat(mM))).innerHTML="rtt: ".concat(e.rtt," ms upLoss: ").concat(e.upLoss,"% downLoss: ").concat(e.downLoss,"% <br>\n ↑ ").concat(s/1e3," KB/s (").concat(8*s/1e3," Kb/s) <br>\n ↓ ").concat(c/1e3," KB/s (").concat(8*c/1e3," Kb/s) <br>\n ");let l=null==(n=null==(r=this._dialogNode)?void 0:r.shadowRoot)?void 0:n.querySelector(".".concat(YP)),d="";e.localStatistics.audio.bitrate&&(d="<li>local audio: ".concat(e.localStatistics.audio.bitrate," Kb/s audioLevel: ").concat(e.localStatistics.audio.audioLevel.toFixed(5),"</li>")),e.localStatistics.video.length>0&&(d+="".concat(e.localStatistics.video.map((e=>"<li>local ".concat(e.videoType," video: ").concat(e.bitrate," Kb/s ").concat(e.width,"*").concat(e.height," ").concat(e.frameRate,"fps</li>"))).join(""))),l.innerHTML=""===d?"".concat(wR):d;let u=null==(o=null==(a=this._dialogNode)?void 0:a.shadowRoot)?void 0:o.querySelector(".".concat(XP)),h="";e.remoteStatistics.length>0&&e.remoteStatistics.forEach((e=>{let t="remote ".concat(e.userId,":");e.audio.bitrate>0&&(t+="<li>audio: ".concat(e.audio.bitrate," Kb/s audioLevel: ").concat(e.audio.audioLevel.toFixed(5),"</li>")),e.video.length>0&&e.video.forEach((e=>{t+="<li>".concat(e.videoType," video: ").concat(e.bitrate," Kb/s ").concat(e.width,"*").concat(e.height," ").concat(e.frameRate,"fps</li>")})),h+=t})),u.innerHTML=""===h?"".concat(wR):h})),hA(this,"pad",(e=>e<10?"0".concat(e):"".concat(e))),this._core=e,this._log=t,this.dumpLocalVideoMap=i,this.dumpRemoteVideoMap=r,this.initCustomElements(),this.synchronizeLog(),this.installEvents(),window["__trtc_instance_".concat(bM,"__")]=this._core.trtc}initCustomElements(){this._isMobile=(()=>{let e=window.navigator&&window.navigator.userAgent||"",t=/iPad/i.test(e)||/iPhone/i.test(e),i=/Android/i.test(e);return t||i})();let e=document.createElement("trtc-basic-debug-dialog");document.body.appendChild(e);let t=e.shadowRoot;if(this._dialogNode=e,!t)return;this._switchNode=t.querySelector(".".concat(xP)),this._addEventListener(this._switchNode,"click",this.onSwitchClick.bind(this));let i=getComputedStyle(this._switchNode);this.switchPos.x=parseInt(i.right,10)||50,this.switchPos.y=parseInt(i.bottom,10)||100+50*bM,this._isMobile?(this._switchNode.ontouchstart=this.onTouchStart.bind(this),this._switchNode.ontouchend=this.onTouchEnd.bind(this),this._switchNode.ontouchmove=this.onTouchMove.bind(this)):this._switchNode.onmousedown=this.onMouseDown.bind(this),this._maskNode=t.querySelector(".".concat(PP)),this._addEventListener(this._maskNode,"click",this.onMaskClick.bind(this)),this._panelNode=t.querySelector(".".concat(MP)),t.querySelector(".".concat(vM)).childNodes.forEach((e=>{switch(e.getAttribute("data-type")){case"go_bottom":this._addEventListener(e,"click",this.onGoBottomClick.bind(this));break;case"back_top":this._addEventListener(e,"click",this.onBackTopClick.bind(this));break;case"clear_log":this._addEventListener(e,"click",this.onClearLogClick.bind(this))}})),this._logContentNode=t.querySelector(".".concat(jP)),this._networkContentNode=t.querySelector(".".concat(WP)),this._dumpContentNode=t.querySelector(".".concat(GP)),this._tabNodes=Array.from(t.querySelector(".".concat(UP)).children),this._tabNodes.forEach((e=>{this._addEventListener(e,"click",this.onTabClick.bind(this))})),this._toptabNodes=Array.from(t.querySelector(".".concat(BP)).children),this._toptabNodes.forEach((e=>{this._addEventListener(e,"click",this.onToptabClick.bind(this))}));let r=t.querySelector("#trtc_upload");this._addEventListener(r,"click",this.onUploadClick.bind(this));let n=t.querySelector("#trtc_export");this._addEventListener(n,"click",this.onExportClick.bind(this));let a=t.querySelector("#trtc_hide");this._addEventListener(a,"click",this.onHideClick.bind(this));let o=t.querySelector("#".concat(hM," .dump")),s=t.querySelector("#".concat(hM," .end-dump")),c=Number(t.querySelector("#".concat(hM," input")).value);this._addEventListener(o,"click",this.getDumpButtonClickHandler.bind(this,o,s,c,"main","local"));let l=t.querySelector("#".concat(pM," .dump")),d=t.querySelector("#".concat(pM," .end-dump")),u=Number(t.querySelector("#".concat(pM," input")).value);this._addEventListener(l,"click",this.getDumpButtonClickHandler.bind(this,l,d,u,"auxiliary","local"));let h=t.querySelector("#".concat(uM," button"));this._addEventListener(h,"click",(()=>{let e=Number(t.querySelector("#".concat(uM," input")).value),{download:i,onDumpEnd:r}=this.dumpAudio("local",e);if(i)if(this.inactiveButton(h,hR),e>0)setTimeout((()=>{i(),this.activeButton(h,uR)}),1e3*e);else{let e=t.querySelector("#".concat(uM," .end-dump"));this.activeButton(e),e.onclick=()=>{e.onclick=null,i(),null==r||r(),this.activeButton(h,uR),this.inactiveButton(e)}}else this.addInfoToBanner(EM,"Failed to dump, please check if the current user has started the audio")}));let p=t.querySelector("#dump-remote-video-hook-userid"),f=t.querySelector("#dump-remote-video-hook-duration"),m=t.querySelector("#dump-remote-video-hook-mediaType"),g=t.querySelector("#dump-remote-video-hook-button");g.onclick=()=>{let e=Number(f.value);if(e<1)return void this.addInfoToBanner(EM,"duration at least 1s");let t=p.value;if(!t)return void this.addInfoToBanner(EM,"please input user id");"*"===t&&this.inactiveButton(g);let i,r,n=m.value,a="remote_".concat(t,"_").concat("sub"===n?"auxiliary":n),o=a=>{if((a.userId===t||"*"===t)&&a.streamType===n){if(this.addInfoToBanner(_M,"[".concat(a.userId,"_").concat(n,"] starting to dump video, duration: ").concat(e,"s")),({download:i,onDumpEnd:r}=this.dumpVideo("sub"===a.streamType?"auxiliary":a.streamType,"remote",e,a.userId)),!i)return;setTimeout((()=>{null==i||i(),null==r||r(),"*"!==t&&this._core.trtc.off(this._core.TRTC.EVENT.REMOTE_VIDEO_AVAILABLE,o)}),1e3*e)}};this._core.trtc.on(this._core.TRTC.EVENT.REMOTE_VIDEO_AVAILABLE,o),this.addInfoToBanner(_M,"[".concat(a,"] waiting to dump video from ").concat("*"===t?"all remote users":"user ".concat(t),", duration: ").concat(e,"s"))}}synchronizeLog(){this._core.loggerManager.getQueue().forEach((e=>{this.updateLog(e)}))}isSupportDumpVideo(){return!(!this._core.rtcDectection.IS_INSERTABLE_STREAM_SUPPORTED&&!this._core.rtcDectection.IS_SCRIPT_TRANSFORM_SUPPORTED)||(this.addInfoToBanner(EM,"Current browser does not support dumping video"),!1)}_addEventListener(e,t,i,r){e&&(e.addEventListener(t,i,r),this.eventMap.set(e,{type:t,listener:i}))}_removeEventListener(){this.eventMap.forEach(((e,t)=>{let{type:i,listener:r}=e;t&&t.removeEventListener(i,r)})),this.eventMap.clear(),this._switchNode&&(this._switchNode.onmousedown=null,this._switchNode.ontouchmove=null,this._switchNode.ontouchstart=null,this._switchNode.ontouchend=null)}closeDialog(){this.uninstallEvents(),this._removeEventListener(),this._dialogNode&&(document.body.removeChild(this._dialogNode),this._dialogNode=null)}updateLog(e){var t;this._logList.push(e);let i=document.createElement("div");switch(i.classList.add(nM),e.level){case 4:i.classList.add(cM);break;case 2:i.classList.add(oM);break;case 3:i.classList.add(sM);break;case 1:i.classList.add(aM)}i.textContent=e.log,"all"!==this._showLogType&&!i.classList.contains("".concat(nM,"_").concat(this._showLogType))&&(i.style.display="none"),null==(t=this._logContentNode)||t.appendChild(i),this.addHelper(i)}getDumpButtonClickHandler(e,t,i,r,n){if(!this.isSupportDumpVideo())return;let{download:a,onDumpEnd:o}=this.dumpVideo(r,n,i);if(a)return this.addInfoToBanner(_M,"[".concat(n,"_").concat(r,"] starting to dump...")),this.inactiveButton(e,hR),void(i>0?setTimeout((()=>{a(),this.activeButton(e,uR)}),1e3*i):(this.activeButton(t),t.onclick=()=>{t.onclick=null,null==o||o(),a(),this.activeButton(e,uR),this.inactiveButton(t)}));this.addInfoToBanner(_M,"[".concat(n,"_").concat(r,"] waiting to dump..."));let s=a=>{let{track:o}=a;if(o.room===this._core.room&&o.streamType===r){this.addInfoToBanner(_M,"[".concat(n,"_").concat(r,"] starting to dump")),"local"===n&&this._core.innerEmitter.off("104",s);let{download:a,onDumpEnd:o}=this.dumpVideo(r,n,i);if(!a)return;i>0?setTimeout((()=>{a(),this.activeButton(e,uR)}),1e3*i):(this.activeButton(t),t.onclick=()=>{t.onclick=null,null==o||o(),a(),this.activeButton(e,uR),this.inactiveButton(t)})}};s.bind(this),"local"===n&&this._core.innerEmitter.on("104",s),this.inactiveButton(e,hR)}onSwitchClick(){this._hasMove?this._hasMove=!1:this._showDialog?this.hideDialog():(this._isMobile&&(this._maskNode.style.display="block"),this._panelNode.style.display="block",this._switchNode.style.display="none",this._showDialog=!0,this.logContentGoBottom())}onTabClick(e){var t,i,r,n,a,o,s;let c=e.target;null==(t=this._tabNodes)||t.forEach((e=>{e.classList.remove(LP)})),c.classList.add(LP);let l=c.getAttribute("data-tab");"log"===l?(null==(n=null==(r=null==(i=this._dialogNode)?void 0:i.shadowRoot)?void 0:r.querySelector(".".concat(HP)))||n.classList.add(zP),this._logContentNode.style.display="block",this._networkContentNode.style.display="none",this._dumpContentNode.style.display="none",this.logContentGoBottom()):(null==(s=null==(o=null==(a=this._dialogNode)?void 0:a.shadowRoot)?void 0:o.querySelector(".".concat(HP)))||s.classList.remove(zP),"network"===l?(this._networkContentNode.style.display="block",this._logContentNode.style.display="none",this._dumpContentNode.style.display="none"):"dump"===l&&(this._dumpContentNode.style.display="block",this._networkContentNode.style.display="none",this._logContentNode.style.display="none"))}onToptabClick(e){var t,i;let r=e.target;null==(t=this._toptabNodes)||t.forEach((e=>{e.classList.remove(LP)})),r.classList.add(LP),this._showLogType=r.getAttribute("data-type");let n=null==(i=this._logContentNode)?void 0:i.querySelectorAll(".".concat(nM)),a="".concat(nM,"_").concat(this._showLogType);n.forEach((e=>{e.classList.contains(a)||"all"===this._showLogType?e.style.display="block":e.style.display="none"})),this.logContentGoBottom()}onExportClick(){let e=this._logList.reduce(((e,t)=>"".concat(e+t.log,"\n")),""),t=new Blob([e],{type:"text/plain"}),i=document.createElement("a"),r=URL.createObjectURL(t);i.href=r;let n="trtc_".concat(void 0===this._core.room.sdkAppId?"EmptySdkAppId":this._core.room.sdkAppId,"_").concat(void 0===this._core.room.userId?"EmptyUserId":this._core.room.userId,"_").concat(this.formatStartDumpTime(+new Date),".log");i.download=n,i.style.display="none",document.body.appendChild(i),i.click(),URL.revokeObjectURL(r),document.body.removeChild(i),this.addInfoToBanner(_M,"Export success: The log file name is ".concat(n)),this._core.kvStatManager.addSuccessEvent({key:592703})}addInfoToBanner(e,t){var i,r;let n=null==(r=null==(i=this._dialogNode)?void 0:i.shadowRoot)?void 0:r.querySelector(".".concat(eM)),a=document.createElement("div");a.classList.add(tM);let o=e===_M?"🟩":e===yM?"🟧":"🟥";a.innerText="".concat(o," [").concat(this.getCurrentTime(),"] ").concat(t),n.appendChild(a),n.scrollTop=n.scrollHeight}async onUploadClick(){var e,t;if(this.isUploading)return;this.isUploading=!0;let i=null==(t=null==(e=this._dialogNode)?void 0:e.shadowRoot)?void 0:t.querySelector("#trtc_upload");i.innerText="Uploading...",null==i||i.classList.add(".disable");let r=this._logList.reduce(((e,t)=>"".concat(e+t.log,"\n")),""),n=new Blob([r],{type:"text/plain"}),a=new FormData;a.append("file",n,"trtc.log"),a.append("sdkAppId","".concat(this._core.room.sdkAppId||"EmptySdkAppId")),a.append("userId","".concat(this._core.room.userId||"EmptyUserId")),fetch("https://service.trtc.qcloud.com/api/uploadLogFile",{method:"POST",body:a}).then((e=>e.json())).then((e=>{this.addInfoToBanner(e.type,e.message_en||"Upload Failed: Please use local export"),this.isUploading=!1,this._log.info(e.message_en),this._core.kvStatManager.addSuccessEvent({key:592704})})).catch((()=>{this.addInfoToBanner(EM,"Upload Failed: Please use local export"),this._log.info("Upload Failed: Please use local export"),this._core.kvStatManager.addFailedEvent({key:592704})})).finally((()=>{i.innerText=fR,null==i||i.classList.remove(".disable"),this.isUploading=!1}))}onHideClick(){this.hideDialog()}onMaskClick(){this.hideDialog()}hideDialog(){this._isMobile&&(this._maskNode.style.display="none"),this._panelNode.style.display="none",this._switchNode.style.display="block",this._showDialog=!1}onBackTopClick(){var e,t,i;null==(i=null==(t=null==(e=this._dialogNode)?void 0:e.shadowRoot)?void 0:t.querySelector(".".concat(HP)))||i.scrollTo(0,0)}onGoBottomClick(){this.logContentGoBottom()}onClearLogClick(){this._logList=[],this._logContentNode&&(this._logContentNode.innerHTML="")}logContentGoBottom(){var e,t;let i=null==(t=null==(e=this._dialogNode)?void 0:e.shadowRoot)?void 0:t.querySelector(".".concat(HP));null==i||i.scrollTo(0,null==i?void 0:i.scrollHeight)}onMouseDown(e){e.preventDefault(),this.switchPos.startX=e.pageX,this.switchPos.startY=e.pageY,document.onmousemove=this.onMouseMove.bind(this),document.onmouseup=this.onMouseUp.bind(this)}onMouseMove(e){e.cancelable&&e.preventDefault(),this._hasMove=!0;let t=this.switchPos.x-(e.pageX-this.switchPos.startX),i=this.switchPos.y-(e.pageY-this.switchPos.startY);[t,i]=this.getSafeAreaXY(t,i),this._switchNode.style.right="".concat(t,"px"),this._switchNode.style.bottom="".concat(i,"px"),this.switchPos.endX=t,this.switchPos.endY=i}onMouseUp(){this.switchPos.startX=0,this.switchPos.startY=0,this.switchPos.x=this.switchPos.endX,this.switchPos.y=this.switchPos.endY,document.onmousemove=null,document.onmouseup=null}onTouchStart(e){this.switchPos.startX=e.touches[0].pageX,this.switchPos.startY=e.touches[0].pageY,this.switchPos.isTouchEnd=!1}onTouchEnd(){this.switchPos.isTouchEnd&&(this.switchPos.startX=0,this.switchPos.startY=0,this.switchPos.isTouchEnd=!1,this.switchPos.x=this.switchPos.endX,this.switchPos.y=this.switchPos.endY)}onTouchMove(e){if(e.touches.length<=0)return;let t=e.touches[0].pageX-this.switchPos.startX,i=e.touches[0].pageY-this.switchPos.startY,r=Math.floor(this.switchPos.x-t),n=Math.floor(this.switchPos.y-i);[r,n]=this.getSafeAreaXY(r,n),this._switchNode.style.right="".concat(r,"px"),this._switchNode.style.bottom="".concat(n,"px"),this.switchPos.endX=r,this.switchPos.endY=n,this.switchPos.isTouchEnd=!0,e.cancelable&&e.preventDefault()}getSafeAreaXY(e,t){let i=Math.max(document.documentElement.offsetWidth,window.innerWidth),r=Math.max(document.documentElement.offsetHeight,window.innerHeight);return e+this._switchNode.offsetWidth>i&&(e=i-this._switchNode.offsetWidth),t+this._switchNode.offsetHeight>r&&(t=r-this._switchNode.offsetHeight),e<0&&(e=0),t<20&&(t=20),[e,t]}hitTest(e){return e===this._core.room}installEvents(){this._core.innerEmitter.on("264",this.handleLog,this),this._core.innerEmitter.on("53",this.handleLeaveSuccess,this),this._core.innerEmitter.on("27",this.handleJoinSuccess,this),this._core.trtc.on(this._core.TRTC.EVENT.STATISTICS,this.handleStatistics,this),this._core.trtc.on(this._core.TRTC.EVENT.REMOTE_AUDIO_AVAILABLE,this.handleRemoteAudioAvailable),this._core.trtc.on(this._core.TRTC.EVENT.REMOTE_AUDIO_UNAVAILABLE,this.handleRemoteAudioUnavailable),this._core.trtc.on(this._core.TRTC.EVENT.REMOTE_VIDEO_AVAILABLE,this.handleRemoteVideoAvailable),this._core.trtc.on(this._core.TRTC.EVENT.REMOTE_VIDEO_UNAVAILABLE,this.handleRemoteVideoUnavailable),this._core.room.on("dump",this.handleDumpFromScriptTransform,this)}uninstallEvents(){this._core.innerEmitter.off("264",this.handleLog,this),this._core.innerEmitter.off("53",this.handleLeaveSuccess,this),this._core.innerEmitter.off("27",this.handleJoinSuccess,this),this._core.trtc.off(this._core.TRTC.EVENT.STATISTICS,this.handleStatistics,this),this._core.trtc.off(this._core.TRTC.EVENT.REMOTE_AUDIO_AVAILABLE,this.handleRemoteAudioAvailable),this._core.trtc.off(this._core.TRTC.EVENT.REMOTE_AUDIO_UNAVAILABLE,this.handleRemoteAudioUnavailable),this._core.trtc.off(this._core.TRTC.EVENT.REMOTE_VIDEO_AVAILABLE,this.handleRemoteVideoAvailable),this._core.trtc.off(this._core.TRTC.EVENT.REMOTE_VIDEO_UNAVAILABLE,this.handleRemoteVideoUnavailable),this._core.room.off("dump",this.handleDumpFromScriptTransform,this)}handleDumpFromScriptTransform(e){if(!e.isAudio)if(e.userId){let t=this.dumpRemoteVideoMap["".concat(e.userId,"-").concat(e.streamType)];t&&(t.data.push(e.data),t.duration>0&&Date.now()-t.startTimestamp>1e3*t.duration&&t.onDumpEnd())}else{let t="main"===e.streamType?"main":"sub",i=this.dumpLocalVideoMap[t];i&&(i.data.push(e.data),i.duration>0&&Date.now()-i.startTimestamp>1e3*i.duration&&i.onDumpEnd())}}inactiveButton(e,t){e.disabled=!0,t&&(e.innerText=t)}activeButton(e,t){e.disabled=!1,t&&(e.innerText=t)}handleLog(e){this.updateLog(e.log)}addHelper(e){let t=/((2(5[0-5]|[0-4]\d))|[0-1]?\d{1,2})(\.((2(5[0-5]|[0-4]\d))|[0-1]?\d{1,2})){3}/g,i=DR,r=e.innerText;r=r.split("\n").map((e=>{if((e=e.replace(/</g,"&lt;").replace(/>/g,"&gt;")).includes("failed"))return e.includes("on autoplay-failed")?e:"<span class='red' style=\"background:red; color:#fff;\">".concat(e,"</span>");if(e.includes("clientIp:")){let i=e.match(t);return null==i||i.forEach((t=>{e=e.replace(t,'<a href="javascript:void(0);" target=""><span class=\'ip\' style="background:#e1dfdf">'.concat(t,"</span></a>"))})),e}return e.includes("URL of current page")&&(e=e.replace(/URL of current page: (.+)/,'URL of current page: <a href="$1">$1</a>')),e})).join("\n"),i.forEach((t=>{if(e.innerText.includes(t)){let i="";i="function"==typeof kR[t].tips?kR[t].tips(e.innerText):kR[t].tips,r=r.replace(new RegExp("".concat((e=>e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d").replace(">","&gt;").replace(">","&lt;"))(t)),"gi"),'<span class="'.concat(fM,'" style="background:').concat(kR[t].color||"#e1dfdf","; color: ").concat(kR[t].textColor||"#000",'">').concat(t,'\n <span class="tooltiptext tooltip-top">').concat(i,"</span>\n </span>"))}})),e.innerHTML=r}getCurrentTime(){let e=new Date,t=this.pad(e.getHours()),i=this.pad(e.getMinutes()),r=this.pad(e.getSeconds());return"".concat(t,":").concat(i,":").concat(r)}dumpVideo(e,t,i,r){let n,a=Date.now(),o=this.formatStartDumpTime(a),s=[],c="".concat(t,"_").concat(r,"_").concat(e);if("local"===t)n="main"===e?this._core.trtc._localVideoTrack:this._core.trtc._localScreenTrack;else if(r){let t=this._core.room.remotePublishedUserMap.get(r);t&&(n="main"===e?t.remoteVideoTrack:t.remoteAuxiliaryTrack)}let l;if("local"===t){if(!this.hasLocalTrack(e,"video"))return{};l=()=>{delete this.dumpLocalVideoMap["auxiliary"===e?"sub":"main"]},this.dumpLocalVideoMap["auxiliary"===e?"sub":"main"]={startTimestamp:a,data:s,duration:i,onDumpEnd:l}}if("remote"===t&&r){if(l=()=>{delete this.dumpRemoteVideoMap["".concat(r,"-").concat(e)]},this.dumpRemoteVideoMap["".concat(r,"-").concat(e)])return this.addInfoToBanner(yM,"[".concat(c,"] dump already exists.")),{};this.dumpRemoteVideoMap["".concat(r,"-").concat(e)]={startTimestamp:a,data:s,duration:i,onDumpEnd:l}}return{download:()=>{var i,a;if(0===s.length)return void this.addInfoToBanner(EM,"[".concat(c,"] dump failed. Reason: data is empty"));let l,d;"main"===e?l="video":"auxiliary"===e&&(l="screen"),"vp8"===this.getVideoCodec(r||"")?(this.addInfoToBanner(yM,"[".concat(c,"] package vp8 into ivf format")),d=this.convertVP8ToIVF(s,n)):d=new Blob(s);let u=URL.createObjectURL(d),h=document.createElement("a"),p="local"===t?"local_".concat(l,"_").concat(o,".").concat((null==(i=this._core.room.singlePC)?void 0:i.videoCodec)||"h264"):"remote-".concat(r,"_").concat(l,"_").concat(o,".").concat((null==(a=this._core.room.userManager)?void 0:a.getPublishedUser(r).videoCodec)||"h264");h.href=u,h.download=p,h.style.display="none",document.body.appendChild(h),h.click(),URL.revokeObjectURL(u),h.remove(),this.addInfoToBanner(_M,"[".concat(c,"] dump success. File name is: ").concat(p))},onDumpEnd:l}}convertVP8ToIVF(e,t){var i,r,n;function a(e,t,i){for(let r=0;r<i.length;r++)e.setUint8(t+r,i.charCodeAt(r))}let o=e.reduce(((e,t)=>e+12+t.byteLength),32),s=new ArrayBuffer(o),c=new DataView(s),l=new Uint8Array(s),d=0;a(c,d,"DKIF"),d+=4,c.setUint16(d,0,!0),d+=2,c.setUint16(d,32,!0),d+=2,a(c,d,"VP80"),d+=4,c.setUint16(d,(null==(i=null==t?void 0:t._inputTrack)?void 0:i.getSettings().width)||0,!0),d+=2,c.setUint16(d,(null==(r=null==t?void 0:t._inputTrack)?void 0:r.getSettings().height)||0,!0),d+=2;let u=(t instanceof CP?null==t?void 0:t.decodeFPS:null==(n=null==t?void 0:t.mediaTrack)?void 0:n.getSettings().frameRate)||15;return c.setUint32(d,u,!0),d+=4,c.setUint32(d,1,!0),d+=4,c.setUint32(d,e.length,!0),d+=4,c.setUint32(d,0,!0),d+=4,e.forEach(((e,t)=>{let i=e.byteLength,r=Math.floor(1e6*t/u);c.setUint32(d,i,!0),d+=4,c.setFloat64(d,r,!0),d+=8,l.set(new Uint8Array(e),d),d+=i})),new Blob([s],{type:"application/octet-stream"})}getVideoCodec(e){var t,i;return""===e?null==(t=this._core.room.singlePC)?void 0:t.videoCodec:null==(i=this._core.room.remotePublishedUserMap.get(e))?void 0:i.videoCodec}hasLocalTrack(e,t){for(let i of this._core.room.localTracks)if(i.streamType===e&&i.kind===t)return!0;return!1}dumpAudio(e,t,i){var r,n,a;let o,s,c=null,l=[],d=[],u=[],h=[],p=[],f=[],m=[],g=new AbortController,v=Date.now(),_=this.formatStartDumpTime(v),y=this._core.room.audioManager._localAudioPipline,E=this._core.room.audioManager._localScreenAudioPipeline,b=e=>{let{room:t,data:i,type:r}=e;if(this.hitTest(t)){if("dump"===r){if(h[0]=h[0]?h[0].concat(i.captureInput):i.captureInput,h[1]=h[1]?h[1].concat(i.playInput):i.playInput,o){let e=i.startTime-o,t=i.endTime-i.startTime;if(e>30||t>30){let r=function(e){if("number"!=typeof e||e<0)return"0毫秒";let t=[],i=Math.floor(e/6e4),r=e%6e4;i>0&&t.push("".concat(i,"分"));let n=Math.floor(r/1e3);return r%=1e3,(n>0||t.length)&&t.push("".concat(n,"秒")),(r>0||!t.length)&&t.push("".concat(r,"毫秒")),t.join("")},n=i.startTime-s,a=o-s;m.push("".concat(i.startTime,"\t").concat(r(n),"~").concat(r(a),"\t").concat(e,"\t").concat(t))}o=i.startTime}else o=i.startTime,s=i.startTime;f.push(i.startTime)}"dump-screen-audio"===r&&(p[0]=p[0]?p[0].concat(i.captureInput):i.captureInput,p[1]=p[1]?p[1].concat(i.playInput):i.playInput)}};if("local"===e){let{sampleRate:e}=this._core.room.audioManager.audioContext;if(!this._core.room.audioManager.hasAudioTrack&&!this._core.room.audioManager.hasScreenAudioTrack)return{};if(null!=y&&y.source.node&&(l.push(y.source.node),d.push("local_audio_raw_capture-".concat(e,"-").concat(y.source.node.channelCount))),(null!=(r=null==y?void 0:y.aec)&&r.node||null!=E&&E.aec.node)&&(this._core.trtc.updatePlugin("AudioProcessor",{enableDump:!0}),this._core.innerEmitter.on("265",b),null!=(n=null==y?void 0:y.aec)&&n.node&&(l.push(y.aec.node),d.push("local_audio_audioProcessor_processed-".concat(e,"-").concat(y.aec.node.channelCount))),null!=E&&E.aec.node&&(l.push(E.aec.node),d.push("screen_audio_audioProcessor_processed-".concat(e,"-").concat(E.aec.node.channelCount)))),null!=y&&y.denoiser.node&&(l.push(y.denoiser.node),d.push("local_audio_denoiser_processed-".concat(e,"-").concat(y.denoiser.node.channelCount))),this._core.room.audioManager.mixWeight>1&&null!=y&&y.stream){let t=this._core.room.audioManager.audioContext.createMediaStreamSource(y.stream);t.channelCount=1,l.push(t),d.push("local_audio_destination-".concat(e,"-").concat(t.channelCount))}}else if("remote"===e&&void 0!==i){let e=null==(a=this._core.room.remotePublishedUserMap.get(i))?void 0:a.remoteAudioTrack;if(null==e||!e.mediaTrack)return{};let t=this._core.createAudioNode(e.mediaTrack);l.push(t),d.push("remote_".concat(i))}let w=async()=>{var t,i,r,n,a;let o=new OR.default;for(let e=0;e<d.length;e++)o.file("".concat(d[e],".pcm"),new Blob(u[e]));if(null!=(t=null==h?void 0:h[0])&&t.length&&o.file("audioProcessor_input_capture.pcm",new Blob(h[0])),null!=(i=null==h?void 0:h[1])&&i.length&&o.file("audioProcessor_input_playback.pcm",new Blob(h[1])),null!=(r=null==p?void 0:p[0])&&r.length&&o.file("audioProcessor_screen_audio_input_capture.pcm",new Blob(p[0])),null!=(n=null==p?void 0:p[1])&&n.length&&o.file("audioProcessor_screen_audio_input_playback.pcm",new Blob(p[1])),null!=f&&f.length){let e=f.reduce(((e,t)=>"".concat(e,"\n").concat(t)));o.file("audioProcessor_handle_timestamp.txt",new Blob([e]))}if(null!=m&&m.length){let e=m.reduce(((e,t)=>"".concat(e,"\n").concat(t)));o.file("audioProcessor_big_gap_data.txt",new Blob([e]))}let s=await o.generateAsync({type:"blob"}),l=URL.createObjectURL(s),v=document.createElement("a");v.href=l,v.download="".concat(e,"-audio-").concat(_,".zip"),v.style.display="none",document.body.appendChild(v),v.click(),URL.revokeObjectURL(l),v.remove(),this.addInfoToBanner(_M,"Dump success, file name is: ".concat(e,"-").concat(_,".zip")),this._core.innerEmitter.off("265",b),(null!=(a=null==y?void 0:y.aec)&&a.node||null!=E&&E.aec.node)&&this._core.trtc.updatePlugin("AudioProcessor",{enableDump:!1}),c&&clearTimeout(c),g.abort("download")};return t>0&&(c=Number(setTimeout((()=>{g.abort("timeout")}),1e3*t))),l.length>0&&this._core.startGetPCM(l).then((e=>e.pipeTo(new WritableStream({write(e){e.forEach(((e,t)=>{u[t]=u[t]?u[t].concat(e[0]):[e[0]]}))}}),g).catch((()=>w)))),{download:w,onDumpEnd:()=>{g.abort("timeout")}}}formatStartDumpTime(e){let t=new Date(e),i=t.getFullYear(),r=this.pad(t.getMonth()+1),n=this.pad(t.getDate()),a=this.pad(t.getHours()),o=this.pad(t.getMinutes()),s=this.pad(t.getSeconds()),c=-t.getTimezoneOffset(),l=Math.floor(Math.abs(c)/60),d=Math.abs(c)%60,u=c>=0?"+":"-";return"".concat(i,"-").concat(r,"-").concat(n,"T").concat(a,"-").concat(o,"-").concat(s).concat(u).concat(this.pad(l),"-").concat(this.pad(d))}};
1
+ !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).TRTCDebugDialog=t()}(this,(function(){var e="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},t=function(e){return e&&e.Math===Math&&e},i=t("object"==typeof globalThis&&globalThis)||t("object"==typeof window&&window)||t("object"==typeof self&&self)||t("object"==typeof e&&e)||t("object"==typeof e&&e)||function(){return this}()||Function("return this")(),r={},n=function(e){try{return!!e()}catch(t){return!0}},a=!n((function(){return 7!==Object.defineProperty({},1,{get:function(){return 7}})[1]})),o=!n((function(){var e=function(){}.bind();return"function"!=typeof e||e.hasOwnProperty("prototype")})),s=o,c=Function.prototype.call,l=s?c.bind(c):function(){return c.apply(c,arguments)},d={},u={}.propertyIsEnumerable,h=Object.getOwnPropertyDescriptor,p=h&&!u.call({1:2},1);d.f=p?function(e){var t=h(this,e);return!!t&&t.enumerable}:u;var f,m,g=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}},v=o,_=Function.prototype,y=_.call,E=v&&_.bind.bind(y,y),b=v?E:function(e){return function(){return y.apply(e,arguments)}},w=b,I=w({}.toString),T=w("".slice),S=function(e){return T(I(e),8,-1)},A=n,R=S,k=Object,C=b("".split),D=A((function(){return!k("z").propertyIsEnumerable(0)}))?function(e){return"String"===R(e)?C(e,""):k(e)}:k,O=function(e){return null==e},L=O,N=TypeError,x=function(e){if(L(e))throw new N("Can't call method on "+e);return e},P=D,M=x,U=function(e){return P(M(e))},B="object"==typeof document&&document.all,F=void 0===B&&void 0!==B?function(e){return"function"==typeof e||e===B}:function(e){return"function"==typeof e},V=F,H=function(e){return"object"==typeof e?null!==e:V(e)},j=i,z=F,W=function(e,t){return arguments.length<2?(i=j[e],z(i)?i:void 0):j[e]&&j[e][t];var i},G=b({}.isPrototypeOf),q=i.navigator,K=q&&q.userAgent,Y=K?String(K):"",X=i,Z=Y,J=X.process,Q=X.Deno,$=J&&J.versions||Q&&Q.version,ee=$&&$.v8;ee&&(m=(f=ee.split("."))[0]>0&&f[0]<4?1:+(f[0]+f[1])),!m&&Z&&(!(f=Z.match(/Edge\/(\d+)/))||f[1]>=74)&&(f=Z.match(/Chrome\/(\d+)/))&&(m=+f[1]);var te=m,ie=te,re=n,ne=i.String,ae=!!Object.getOwnPropertySymbols&&!re((function(){var e=Symbol("symbol detection");return!ne(e)||!(Object(e)instanceof Symbol)||!Symbol.sham&&ie&&ie<41})),oe=ae&&!Symbol.sham&&"symbol"==typeof Symbol.iterator,se=W,ce=F,le=G,de=Object,ue=oe?function(e){return"symbol"==typeof e}:function(e){var t=se("Symbol");return ce(t)&&le(t.prototype,de(e))},he=String,pe=function(e){try{return he(e)}catch(t){return"Object"}},fe=F,me=pe,ge=TypeError,ve=function(e){if(fe(e))return e;throw new ge(me(e)+" is not a function")},_e=ve,ye=O,Ee=function(e,t){var i=e[t];return ye(i)?void 0:_e(i)},be=l,we=F,Ie=H,Te=TypeError,Se={exports:{}},Ae=i,Re=Object.defineProperty,ke=function(e,t){try{Re(Ae,e,{value:t,configurable:!0,writable:!0})}catch(i){Ae[e]=t}return t},Ce=i,De=ke,Oe="__core-js_shared__",Le=Se.exports=Ce[Oe]||De(Oe,{});(Le.versions||(Le.versions=[])).push({version:"3.40.0",mode:"global",copyright:"© 2014-2025 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.40.0/LICENSE",source:"https://github.com/zloirock/core-js"});var Ne=Se.exports,xe=Ne,Pe=function(e,t){return xe[e]||(xe[e]=t||{})},Me=x,Ue=Object,Be=function(e){return Ue(Me(e))},Fe=Be,Ve=b({}.hasOwnProperty),He=Object.hasOwn||function(e,t){return Ve(Fe(e),t)},je=b,ze=0,We=Math.random(),Ge=je(1..toString),qe=function(e){return"Symbol("+(void 0===e?"":e)+")_"+Ge(++ze+We,36)},Ke=Pe,Ye=He,Xe=qe,Ze=ae,Je=oe,Qe=i.Symbol,$e=Ke("wks"),et=Je?Qe.for||Qe:Qe&&Qe.withoutSetter||Xe,tt=function(e){return Ye($e,e)||($e[e]=Ze&&Ye(Qe,e)?Qe[e]:et("Symbol."+e)),$e[e]},it=l,rt=H,nt=ue,at=Ee,ot=function(e,t){var i,r;if("string"===t&&we(i=e.toString)&&!Ie(r=be(i,e)))return r;if(we(i=e.valueOf)&&!Ie(r=be(i,e)))return r;if("string"!==t&&we(i=e.toString)&&!Ie(r=be(i,e)))return r;throw new Te("Can't convert object to primitive value")},st=TypeError,ct=tt("toPrimitive"),lt=function(e,t){if(!rt(e)||nt(e))return e;var i,r=at(e,ct);if(r){if(void 0===t&&(t="default"),i=it(r,e,t),!rt(i)||nt(i))return i;throw new st("Can't convert object to primitive value")}return void 0===t&&(t="number"),ot(e,t)},dt=lt,ut=ue,ht=function(e){var t=dt(e,"string");return ut(t)?t:t+""},pt=H,ft=i.document,mt=pt(ft)&&pt(ft.createElement),gt=function(e){return mt?ft.createElement(e):{}},vt=gt,_t=!a&&!n((function(){return 7!==Object.defineProperty(vt("div"),"a",{get:function(){return 7}}).a})),yt=a,Et=l,bt=d,wt=g,It=U,Tt=ht,St=He,At=_t,Rt=Object.getOwnPropertyDescriptor;r.f=yt?Rt:function(e,t){if(e=It(e),t=Tt(t),At)try{return Rt(e,t)}catch(i){}if(St(e,t))return wt(!Et(bt.f,e,t),e[t])};var kt={},Ct=a&&n((function(){return 42!==Object.defineProperty((function(){}),"prototype",{value:42,writable:!1}).prototype})),Dt=H,Ot=String,Lt=TypeError,Nt=function(e){if(Dt(e))return e;throw new Lt(Ot(e)+" is not an object")},xt=a,Pt=_t,Mt=Ct,Ut=Nt,Bt=ht,Ft=TypeError,Vt=Object.defineProperty,Ht=Object.getOwnPropertyDescriptor,jt="enumerable",zt="configurable",Wt="writable";kt.f=xt?Mt?function(e,t,i){if(Ut(e),t=Bt(t),Ut(i),"function"==typeof e&&"prototype"===t&&"value"in i&&Wt in i&&!i[Wt]){var r=Ht(e,t);r&&r[Wt]&&(e[t]=i.value,i={configurable:zt in i?i[zt]:r[zt],enumerable:jt in i?i[jt]:r[jt],writable:!1})}return Vt(e,t,i)}:Vt:function(e,t,i){if(Ut(e),t=Bt(t),Ut(i),Pt)try{return Vt(e,t,i)}catch(r){}if("get"in i||"set"in i)throw new Ft("Accessors not supported");return"value"in i&&(e[t]=i.value),e};var Gt=kt,qt=g,Kt=a?function(e,t,i){return Gt.f(e,t,qt(1,i))}:function(e,t,i){return e[t]=i,e},Yt={exports:{}},Xt=a,Zt=He,Jt=Function.prototype,Qt=Xt&&Object.getOwnPropertyDescriptor,$t=Zt(Jt,"name"),ei={EXISTS:$t,PROPER:$t&&"something"===function(){}.name,CONFIGURABLE:$t&&(!Xt||Xt&&Qt(Jt,"name").configurable)},ti=F,ii=Ne,ri=b(Function.toString);ti(ii.inspectSource)||(ii.inspectSource=function(e){return ri(e)});var ni,ai,oi,si=ii.inspectSource,ci=F,li=i.WeakMap,di=ci(li)&&/native code/.test(String(li)),ui=qe,hi=Pe("keys"),pi=function(e){return hi[e]||(hi[e]=ui(e))},fi={},mi=di,gi=i,vi=H,_i=Kt,yi=He,Ei=Ne,bi=pi,wi=fi,Ii="Object already initialized",Ti=gi.TypeError,Si=gi.WeakMap;if(mi||Ei.state){var Ai=Ei.state||(Ei.state=new Si);Ai.get=Ai.get,Ai.has=Ai.has,Ai.set=Ai.set,ni=function(e,t){if(Ai.has(e))throw new Ti(Ii);return t.facade=e,Ai.set(e,t),t},ai=function(e){return Ai.get(e)||{}},oi=function(e){return Ai.has(e)}}else{var Ri=bi("state");wi[Ri]=!0,ni=function(e,t){if(yi(e,Ri))throw new Ti(Ii);return t.facade=e,_i(e,Ri,t),t},ai=function(e){return yi(e,Ri)?e[Ri]:{}},oi=function(e){return yi(e,Ri)}}var ki={set:ni,get:ai,has:oi,enforce:function(e){return oi(e)?ai(e):ni(e,{})},getterFor:function(e){return function(t){var i;if(!vi(t)||(i=ai(t)).type!==e)throw new Ti("Incompatible receiver, "+e+" required");return i}}},Ci=b,Di=n,Oi=F,Li=He,Ni=a,xi=ei.CONFIGURABLE,Pi=si,Mi=ki.enforce,Ui=ki.get,Bi=String,Fi=Object.defineProperty,Vi=Ci("".slice),Hi=Ci("".replace),ji=Ci([].join),zi=Ni&&!Di((function(){return 8!==Fi((function(){}),"length",{value:8}).length})),Wi=String(String).split("String"),Gi=Yt.exports=function(e,t,i){"Symbol("===Vi(Bi(t),0,7)&&(t="["+Hi(Bi(t),/^Symbol\(([^)]*)\).*$/,"$1")+"]"),i&&i.getter&&(t="get "+t),i&&i.setter&&(t="set "+t),(!Li(e,"name")||xi&&e.name!==t)&&(Ni?Fi(e,"name",{value:t,configurable:!0}):e.name=t),zi&&i&&Li(i,"arity")&&e.length!==i.arity&&Fi(e,"length",{value:i.arity});try{i&&Li(i,"constructor")&&i.constructor?Ni&&Fi(e,"prototype",{writable:!1}):e.prototype&&(e.prototype=void 0)}catch(n){}var r=Mi(e);return Li(r,"source")||(r.source=ji(Wi,"string"==typeof t?t:"")),e};Function.prototype.toString=Gi((function(){return Oi(this)&&Ui(this).source||Pi(this)}),"toString");var qi=Yt.exports,Ki=F,Yi=kt,Xi=qi,Zi=ke,Ji=function(e,t,i,r){r||(r={});var n=r.enumerable,a=void 0!==r.name?r.name:t;if(Ki(i)&&Xi(i,a,r),r.global)n?e[t]=i:Zi(t,i);else{try{r.unsafe?e[t]&&(n=!0):delete e[t]}catch(o){}n?e[t]=i:Yi.f(e,t,{value:i,enumerable:!1,configurable:!r.nonConfigurable,writable:!r.nonWritable})}return e},Qi={},$i=Math.ceil,er=Math.floor,tr=Math.trunc||function(e){var t=+e;return(t>0?er:$i)(t)},ir=function(e){var t=+e;return t!=t||0===t?0:tr(t)},rr=ir,nr=Math.max,ar=Math.min,or=function(e,t){var i=rr(e);return i<0?nr(i+t,0):ar(i,t)},sr=ir,cr=Math.min,lr=function(e){var t=sr(e);return t>0?cr(t,9007199254740991):0},dr=lr,ur=function(e){return dr(e.length)},hr=U,pr=or,fr=ur,mr=function(e){return function(t,i,r){var n=hr(t),a=fr(n);if(0===a)return!e&&-1;var o,s=pr(r,a);if(e&&i!=i){for(;a>s;)if((o=n[s++])!=o)return!0}else for(;a>s;s++)if((e||s in n)&&n[s]===i)return e||s||0;return!e&&-1}},gr={includes:mr(!0),indexOf:mr(!1)},vr=He,_r=U,yr=gr.indexOf,Er=fi,br=b([].push),wr=function(e,t){var i,r=_r(e),n=0,a=[];for(i in r)!vr(Er,i)&&vr(r,i)&&br(a,i);for(;t.length>n;)vr(r,i=t[n++])&&(~yr(a,i)||br(a,i));return a},Ir=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],Tr=wr,Sr=Ir.concat("length","prototype");Qi.f=Object.getOwnPropertyNames||function(e){return Tr(e,Sr)};var Ar={};Ar.f=Object.getOwnPropertySymbols;var Rr=W,kr=Qi,Cr=Ar,Dr=Nt,Or=b([].concat),Lr=Rr("Reflect","ownKeys")||function(e){var t=kr.f(Dr(e)),i=Cr.f;return i?Or(t,i(e)):t},Nr=He,xr=Lr,Pr=r,Mr=kt,Ur=function(e,t,i){for(var r=xr(t),n=Mr.f,a=Pr.f,o=0;o<r.length;o++){var s=r[o];Nr(e,s)||i&&Nr(i,s)||n(e,s,a(t,s))}},Br=n,Fr=F,Vr=/#|\.prototype\./,Hr=function(e,t){var i=zr[jr(e)];return i===Gr||i!==Wr&&(Fr(t)?Br(t):!!t)},jr=Hr.normalize=function(e){return String(e).replace(Vr,".").toLowerCase()},zr=Hr.data={},Wr=Hr.NATIVE="N",Gr=Hr.POLYFILL="P",qr=Hr,Kr=i,Yr=r.f,Xr=Kt,Zr=Ji,Jr=ke,Qr=Ur,$r=qr,en=function(e,t){var i,r,n,a,o,s=e.target,c=e.global,l=e.stat;if(i=c?Kr:l?Kr[s]||Jr(s,{}):Kr[s]&&Kr[s].prototype)for(r in t){if(a=t[r],n=e.dontCallGetSet?(o=Yr(i,r))&&o.value:i[r],!$r(c?r:s+(l?".":"#")+r,e.forced)&&void 0!==n){if(typeof a==typeof n)continue;Qr(a,n)}(e.sham||n&&n.sham)&&Xr(a,"sham",!0),Zr(i,r,a,e)}},tn={};tn[tt("toStringTag")]="z";var rn="[object z]"===String(tn),nn=F,an=S,on=tt("toStringTag"),sn=Object,cn="Arguments"===an(function(){return arguments}()),ln=rn?an:function(e){var t,i,r;return void 0===e?"Undefined":null===e?"Null":"string"==typeof(i=function(e,t){try{return e[t]}catch(i){}}(t=sn(e),on))?i:cn?an(t):"Object"===(r=an(t))&&nn(t.callee)?"Arguments":r},dn=ln,un=String,hn=function(e){if("Symbol"===dn(e))throw new TypeError("Cannot convert a Symbol value to a string");return un(e)},pn=qi,fn=kt,mn=function(e,t,i){return i.get&&pn(i.get,t,{getter:!0}),i.set&&pn(i.set,t,{setter:!0}),fn.f(e,t,i)},gn=en,vn=a,_n=b,yn=He,En=F,bn=G,wn=hn,In=mn,Tn=Ur,Sn=i.Symbol,An=Sn&&Sn.prototype;if(vn&&En(Sn)&&(!("description"in An)||void 0!==Sn().description)){var Rn={},kn=function(){var e=arguments.length<1||void 0===arguments[0]?void 0:wn(arguments[0]),t=bn(An,this)?new Sn(e):void 0===e?Sn():Sn(e);return""===e&&(Rn[t]=!0),t};Tn(kn,Sn),kn.prototype=An,An.constructor=kn;var Cn="Symbol(description detection)"===String(Sn("description detection")),Dn=_n(An.valueOf),On=_n(An.toString),Ln=/^Symbol\((.*)\)[^)]+$/,Nn=_n("".replace),xn=_n("".slice);In(An,"description",{configurable:!0,get:function(){var e=Dn(this);if(yn(Rn,e))return"";var t=On(e),i=Cn?xn(t,7,-1):Nn(t,Ln,"$1");return""===i?void 0:i}}),gn({global:!0,constructor:!0,forced:!0},{Symbol:kn})}var Pn={},Mn=wr,Un=Ir,Bn=Object.keys||function(e){return Mn(e,Un)},Fn=a,Vn=Ct,Hn=kt,jn=Nt,zn=U,Wn=Bn;Pn.f=Fn&&!Vn?Object.defineProperties:function(e,t){jn(e);for(var i,r=zn(t),n=Wn(t),a=n.length,o=0;a>o;)Hn.f(e,i=n[o++],r[i]);return e};var Gn,qn=W("document","documentElement"),Kn=Nt,Yn=Pn,Xn=Ir,Zn=fi,Jn=qn,Qn=gt,$n="prototype",ea="script",ta=pi("IE_PROTO"),ia=function(){},ra=function(e){return"<"+ea+">"+e+"</"+ea+">"},na=function(e){e.write(ra("")),e.close();var t=e.parentWindow.Object;return e=null,t},aa=function(){try{Gn=new ActiveXObject("htmlfile")}catch(n){}var e,t,i;aa="undefined"!=typeof document?document.domain&&Gn?na(Gn):(t=Qn("iframe"),i="java"+ea+":",t.style.display="none",Jn.appendChild(t),t.src=String(i),(e=t.contentWindow.document).open(),e.write(ra("document.F=Object")),e.close(),e.F):na(Gn);for(var r=Xn.length;r--;)delete aa[$n][Xn[r]];return aa()};Zn[ta]=!0;var oa=Object.create||function(e,t){var i;return null!==e?(ia[$n]=Kn(e),i=new ia,ia[$n]=null,i[ta]=e):i=aa(),void 0===t?i:Yn.f(i,t)},sa=tt,ca=oa,la=kt.f,da=sa("unscopables"),ua=Array.prototype;void 0===ua[da]&&la(ua,da,{configurable:!0,value:ca(null)});var ha=function(e){ua[da][e]=!0},pa=gr.includes,fa=ha;en({target:"Array",proto:!0,forced:n((function(){return!Array(1).includes()}))},{includes:function(e){return pa(this,e,arguments.length>1?arguments[1]:void 0)}}),fa("includes");var ma,ga,va,_a={},ya=!n((function(){function e(){}return e.prototype.constructor=null,Object.getPrototypeOf(new e)!==e.prototype})),Ea=He,ba=F,wa=Be,Ia=ya,Ta=pi("IE_PROTO"),Sa=Object,Aa=Sa.prototype,Ra=Ia?Sa.getPrototypeOf:function(e){var t=wa(e);if(Ea(t,Ta))return t[Ta];var i=t.constructor;return ba(i)&&t instanceof i?i.prototype:t instanceof Sa?Aa:null},ka=n,Ca=F,Da=H,Oa=Ra,La=Ji,Na=tt("iterator"),xa=!1;[].keys&&("next"in(va=[].keys())?(ga=Oa(Oa(va)))!==Object.prototype&&(ma=ga):xa=!0);var Pa=!Da(ma)||ka((function(){var e={};return ma[Na].call(e)!==e}));Pa&&(ma={}),Ca(ma[Na])||La(ma,Na,(function(){return this}));var Ma={IteratorPrototype:ma,BUGGY_SAFARI_ITERATORS:xa},Ua=kt.f,Ba=He,Fa=tt("toStringTag"),Va=function(e,t,i){e&&!i&&(e=e.prototype),e&&!Ba(e,Fa)&&Ua(e,Fa,{configurable:!0,value:t})},Ha=Ma.IteratorPrototype,ja=oa,za=g,Wa=Va,Ga=_a,qa=function(){return this},Ka=function(e,t,i,r){var n=t+" Iterator";return e.prototype=ja(Ha,{next:za(+!r,i)}),Wa(e,n,!1),Ga[n]=qa,e},Ya=b,Xa=ve,Za=H,Ja=function(e){return Za(e)||null===e},Qa=String,$a=TypeError,eo=function(e,t,i){try{return Ya(Xa(Object.getOwnPropertyDescriptor(e,t)[i]))}catch(r){}},to=H,io=x,ro=function(e){if(Ja(e))return e;throw new $a("Can't set "+Qa(e)+" as a prototype")},no=Object.setPrototypeOf||("__proto__"in{}?function(){var e,t=!1,i={};try{(e=eo(Object.prototype,"__proto__","set"))(i,[]),t=i instanceof Array}catch(r){}return function(i,r){return io(i),ro(r),to(i)?(t?e(i,r):i.__proto__=r,i):i}}():void 0),ao=en,oo=l,so=F,co=Ka,lo=Ra,uo=no,ho=Va,po=Kt,fo=Ji,mo=_a,go=ei.PROPER,vo=ei.CONFIGURABLE,_o=Ma.IteratorPrototype,yo=Ma.BUGGY_SAFARI_ITERATORS,Eo=tt("iterator"),bo="keys",wo="values",Io="entries",To=function(){return this},So=function(e,t,i,r,n,a,o){co(i,t,r);var s,c,l,d=function(e){if(e===n&&m)return m;if(!yo&&e&&e in p)return p[e];switch(e){case bo:case wo:case Io:return function(){return new i(this,e)}}return function(){return new i(this)}},u=t+" Iterator",h=!1,p=e.prototype,f=p[Eo]||p["@@iterator"]||n&&p[n],m=!yo&&f||d(n),g="Array"===t&&p.entries||f;if(g&&(s=lo(g.call(new e)))!==Object.prototype&&s.next&&(lo(s)!==_o&&(uo?uo(s,_o):so(s[Eo])||fo(s,Eo,To)),ho(s,u,!0)),go&&n===wo&&f&&f.name!==wo&&(vo?po(p,"name",wo):(h=!0,m=function(){return oo(f,this)})),n)if(c={values:d(wo),keys:a?m:d(bo),entries:d(Io)},o)for(l in c)(yo||h||!(l in p))&&fo(p,l,c[l]);else ao({target:t,proto:!0,forced:yo||h},c);return p[Eo]!==m&&fo(p,Eo,m,{name:n}),mo[t]=m,c},Ao=function(e,t){return{value:e,done:t}},Ro=U,ko=ha,Co=_a,Do=ki,Oo=kt.f,Lo=So,No=Ao,xo=a,Po="Array Iterator",Mo=Do.set,Uo=Do.getterFor(Po),Bo=Lo(Array,"Array",(function(e,t){Mo(this,{type:Po,target:Ro(e),index:0,kind:t})}),(function(){var e=Uo(this),t=e.target,i=e.index++;if(!t||i>=t.length)return e.target=null,No(void 0,!0);switch(e.kind){case"keys":return No(i,!1);case"values":return No(t[i],!1)}return No([i,t[i]],!1)}),"values"),Fo=Co.Arguments=Co.Array;if(ko("keys"),ko("values"),ko("entries"),xo&&"values"!==Fo.name)try{Oo(Fo,"name",{value:"values"})}catch(RM){}var Vo=ve,Ho=Be,jo=D,zo=ur,Wo=TypeError,Go="Reduce of empty array with no initial value",qo=function(e){return function(t,i,r,n){var a=Ho(t),o=jo(a),s=zo(a);if(Vo(i),0===s&&r<2)throw new Wo(Go);var c=e?s-1:0,l=e?-1:1;if(r<2)for(;;){if(c in o){n=o[c],c+=l;break}if(c+=l,e?c<0:s<=c)throw new Wo(Go)}for(;e?c>=0:s>c;c+=l)c in o&&(n=i(n,o[c],c,a));return n}},Ko={left:qo(!1),right:qo(!0)},Yo=n,Xo=function(e,t){var i=[][e];return!!i&&Yo((function(){i.call(null,t||function(){return 1},1)}))},Zo=i,Jo=Y,Qo=S,$o=function(e){return Jo.slice(0,e.length)===e},es=$o("Bun/")?"BUN":$o("Cloudflare-Workers")?"CLOUDFLARE":$o("Deno/")?"DENO":$o("Node.js/")?"NODE":Zo.Bun&&"string"==typeof Bun.version?"BUN":Zo.Deno&&"object"==typeof Deno.version?"DENO":"process"===Qo(Zo.process)?"NODE":Zo.window&&Zo.document?"BROWSER":"REST",ts="NODE"===es,is=Ko.left;en({target:"Array",proto:!0,forced:!ts&&te>79&&te<83||!Xo("reduce")},{reduce:function(e){var t=arguments.length;return is(this,e,t,t>1?arguments[1]:void 0)}});var rs=Ko.right;en({target:"Array",proto:!0,forced:!ts&&te>79&&te<83||!Xo("reduceRight")},{reduceRight:function(e){return rs(this,e,arguments.length,arguments.length>1?arguments[1]:void 0)}});var ns=S,as=Array.isArray||function(e){return"Array"===ns(e)},os=en,ss=as,cs=b([].reverse),ls=[1,2];os({target:"Array",proto:!0,forced:String(ls)===String(ls.reverse())},{reverse:function(){return ss(this)&&(this.length=this.length),cs(this)}});var ds="undefined"!=typeof ArrayBuffer&&"undefined"!=typeof DataView,us=Ji,hs=function(e,t,i){for(var r in t)us(e,r,t[r],i);return e},ps=G,fs=TypeError,ms=function(e,t){if(ps(t,e))return e;throw new fs("Incorrect invocation")},gs=ir,vs=lr,_s=RangeError,ys=function(e){if(void 0===e)return 0;var t=gs(e),i=vs(t);if(t!==i)throw new _s("Wrong length or index");return i},Es=Math.sign||function(e){var t=+e;return 0===t||t!=t?t:t<0?-1:1},bs=4503599627370496,ws=Es,Is=function(e){return e+bs-bs},Ts=Math.abs,Ss=function(e,t,i,r){var n=+e,a=Ts(n),o=ws(n);if(a<r)return o*Is(a/r/t)*r*t;var s=(1+t/2220446049250313e-31)*a,c=s-(s-a);return c>i||c!=c?Infinity*o:o*c},As=Math.fround||function(e){return Ss(e,1.1920928955078125e-7,34028234663852886e22,11754943508222875e-54)},Rs=Array,ks=Math.abs,Cs=Math.pow,Ds=Math.floor,Os=Math.log,Ls=Math.LN2,Ns={pack:function(e,t,i){var r,n,a,o=Rs(i),s=8*i-t-1,c=(1<<s)-1,l=c>>1,d=23===t?Cs(2,-24)-Cs(2,-77):0,u=e<0||0===e&&1/e<0?1:0,h=0;for((e=ks(e))!=e||Infinity===e?(n=e!=e?1:0,r=c):(r=Ds(Os(e)/Ls),e*(a=Cs(2,-r))<1&&(r--,a*=2),(e+=r+l>=1?d/a:d*Cs(2,1-l))*a>=2&&(r++,a/=2),r+l>=c?(n=0,r=c):r+l>=1?(n=(e*a-1)*Cs(2,t),r+=l):(n=e*Cs(2,l-1)*Cs(2,t),r=0));t>=8;)o[h++]=255&n,n/=256,t-=8;for(r=r<<t|n,s+=t;s>0;)o[h++]=255&r,r/=256,s-=8;return o[h-1]|=128*u,o},unpack:function(e,t){var i,r=e.length,n=8*r-t-1,a=(1<<n)-1,o=a>>1,s=n-7,c=r-1,l=e[c--],d=127&l;for(l>>=7;s>0;)d=256*d+e[c--],s-=8;for(i=d&(1<<-s)-1,d>>=-s,s+=t;s>0;)i=256*i+e[c--],s-=8;if(0===d)d=1-o;else{if(d===a)return i?NaN:l?-Infinity:Infinity;i+=Cs(2,t),d-=o}return(l?-1:1)*i*Cs(2,d-t)}},xs=Be,Ps=or,Ms=ur,Us=function(e){for(var t=xs(this),i=Ms(t),r=arguments.length,n=Ps(r>1?arguments[1]:void 0,i),a=r>2?arguments[2]:void 0,o=void 0===a?i:Ps(a,i);o>n;)t[n++]=e;return t},Bs=b([].slice),Fs=F,Vs=H,Hs=no,js=function(e,t,i){var r,n;return Hs&&Fs(r=t.constructor)&&r!==i&&Vs(n=r.prototype)&&n!==i.prototype&&Hs(e,n),e},zs=i,Ws=b,Gs=a,qs=ds,Ks=Kt,Ys=mn,Xs=hs,Zs=n,Js=ms,Qs=ir,$s=lr,ec=ys,tc=As,ic=Ns,rc=Ra,nc=no,ac=Us,oc=Bs,sc=js,cc=Ur,lc=Va,dc=ki,uc=ei.PROPER,hc=ei.CONFIGURABLE,pc="ArrayBuffer",fc="DataView",mc="prototype",gc="Wrong index",vc=dc.getterFor(pc),_c=dc.getterFor(fc),yc=dc.set,Ec=zs[pc],bc=Ec,wc=bc&&bc[mc],Ic=zs[fc],Tc=Ic&&Ic[mc],Sc=Object.prototype,Ac=zs.Array,Rc=zs.RangeError,kc=Ws(ac),Cc=Ws([].reverse),Dc=ic.pack,Oc=ic.unpack,Lc=function(e){return[255&e]},Nc=function(e){return[255&e,e>>8&255]},xc=function(e){return[255&e,e>>8&255,e>>16&255,e>>24&255]},Pc=function(e){return e[3]<<24|e[2]<<16|e[1]<<8|e[0]},Mc=function(e){return Dc(tc(e),23,4)},Uc=function(e){return Dc(e,52,8)},Bc=function(e,t,i){Ys(e[mc],t,{configurable:!0,get:function(){return i(this)[t]}})},Fc=function(e,t,i,r){var n=_c(e),a=ec(i),o=!!r;if(a+t>n.byteLength)throw new Rc(gc);var s=n.bytes,c=a+n.byteOffset,l=oc(s,c,c+t);return o?l:Cc(l)},Vc=function(e,t,i,r,n,a){var o=_c(e),s=ec(i),c=r(+n),l=!!a;if(s+t>o.byteLength)throw new Rc(gc);for(var d=o.bytes,u=s+o.byteOffset,h=0;h<t;h++)d[u+h]=c[l?h:t-h-1]};if(qs){var Hc=uc&&Ec.name!==pc;Zs((function(){Ec(1)}))&&Zs((function(){new Ec(-1)}))&&!Zs((function(){return new Ec,new Ec(1.5),new Ec(NaN),1!==Ec.length||Hc&&!hc}))?Hc&&hc&&Ks(Ec,"name",pc):((bc=function(e){return Js(this,wc),sc(new Ec(ec(e)),this,bc)})[mc]=wc,wc.constructor=bc,cc(bc,Ec)),nc&&rc(Tc)!==Sc&&nc(Tc,Sc);var jc=new Ic(new bc(2)),zc=Ws(Tc.setInt8);jc.setInt8(0,2147483648),jc.setInt8(1,2147483649),!jc.getInt8(0)&&jc.getInt8(1)||Xs(Tc,{setInt8:function(e,t){zc(this,e,t<<24>>24)},setUint8:function(e,t){zc(this,e,t<<24>>24)}},{unsafe:!0})}else wc=(bc=function(e){Js(this,wc);var t=ec(e);yc(this,{type:pc,bytes:kc(Ac(t),0),byteLength:t}),Gs||(this.byteLength=t,this.detached=!1)})[mc],Tc=(Ic=function(e,t,i){Js(this,Tc),Js(e,wc);var r=vc(e),n=r.byteLength,a=Qs(t);if(a<0||a>n)throw new Rc("Wrong offset");if(a+(i=void 0===i?n-a:$s(i))>n)throw new Rc("Wrong length");yc(this,{type:fc,buffer:e,byteLength:i,byteOffset:a,bytes:r.bytes}),Gs||(this.buffer=e,this.byteLength=i,this.byteOffset=a)})[mc],Gs&&(Bc(bc,"byteLength",vc),Bc(Ic,"buffer",_c),Bc(Ic,"byteLength",_c),Bc(Ic,"byteOffset",_c)),Xs(Tc,{getInt8:function(e){return Fc(this,1,e)[0]<<24>>24},getUint8:function(e){return Fc(this,1,e)[0]},getInt16:function(e){var t=Fc(this,2,e,arguments.length>1&&arguments[1]);return(t[1]<<8|t[0])<<16>>16},getUint16:function(e){var t=Fc(this,2,e,arguments.length>1&&arguments[1]);return t[1]<<8|t[0]},getInt32:function(e){return Pc(Fc(this,4,e,arguments.length>1&&arguments[1]))},getUint32:function(e){return Pc(Fc(this,4,e,arguments.length>1&&arguments[1]))>>>0},getFloat32:function(e){return Oc(Fc(this,4,e,arguments.length>1&&arguments[1]),23)},getFloat64:function(e){return Oc(Fc(this,8,e,arguments.length>1&&arguments[1]),52)},setInt8:function(e,t){Vc(this,1,e,Lc,t)},setUint8:function(e,t){Vc(this,1,e,Lc,t)},setInt16:function(e,t){Vc(this,2,e,Nc,t,arguments.length>2&&arguments[2])},setUint16:function(e,t){Vc(this,2,e,Nc,t,arguments.length>2&&arguments[2])},setInt32:function(e,t){Vc(this,4,e,xc,t,arguments.length>2&&arguments[2])},setUint32:function(e,t){Vc(this,4,e,xc,t,arguments.length>2&&arguments[2])},setFloat32:function(e,t){Vc(this,4,e,Mc,t,arguments.length>2&&arguments[2])},setFloat64:function(e,t){Vc(this,8,e,Uc,t,arguments.length>2&&arguments[2])}});lc(bc,pc),lc(Ic,fc);var Wc={ArrayBuffer:bc,DataView:Ic},Gc=W,qc=mn,Kc=a,Yc=tt("species"),Xc=function(e){var t=Gc(e);Kc&&t&&!t[Yc]&&qc(t,Yc,{configurable:!0,get:function(){return this}})},Zc=Xc,Jc="ArrayBuffer",Qc=Wc[Jc];en({global:!0,constructor:!0,forced:i[Jc]!==Qc},{ArrayBuffer:Qc}),Zc(Jc);var $c=S,el=b,tl=function(e){if("Function"===$c(e))return el(e)},il=en,rl=tl,nl=n,al=Nt,ol=or,sl=lr,cl=Wc.ArrayBuffer,ll=Wc.DataView,dl=ll.prototype,ul=rl(cl.prototype.slice),hl=rl(dl.getUint8),pl=rl(dl.setUint8);il({target:"ArrayBuffer",proto:!0,unsafe:!0,forced:nl((function(){return!new cl(2).slice(1,void 0).byteLength}))},{slice:function(e,t){if(ul&&void 0===t)return ul(al(this),e);for(var i=al(this).byteLength,r=ol(e,i),n=ol(void 0===t?i:t,i),a=new cl(sl(n-r)),o=new ll(this),s=new ll(a),c=0;r<n;)pl(s,c++,hl(o,r++));return a}});var fl=b,ml=n,gl=F,vl=ln,_l=si,yl=function(){},El=W("Reflect","construct"),bl=/^\s*(?:class|function)\b/,wl=fl(bl.exec),Il=!bl.test(yl),Tl=function(e){if(!gl(e))return!1;try{return El(yl,[],e),!0}catch(RM){return!1}},Sl=function(e){if(!gl(e))return!1;switch(vl(e)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return Il||!!wl(bl,_l(e))}catch(RM){return!0}};Sl.sham=!0;var Al,Rl,kl,Cl,Dl=!El||ml((function(){var e;return Tl(Tl.call)||!Tl(Object)||!Tl((function(){e=!0}))||e}))?Sl:Tl,Ol=Dl,Ll=pe,Nl=TypeError,xl=function(e){if(Ol(e))return e;throw new Nl(Ll(e)+" is not a constructor")},Pl=Nt,Ml=xl,Ul=O,Bl=tt("species"),Fl=function(e,t){var i,r=Pl(e).constructor;return void 0===r||Ul(i=Pl(r)[Bl])?t:Ml(i)},Vl=o,Hl=Function.prototype,jl=Hl.apply,zl=Hl.call,Wl="object"==typeof Reflect&&Reflect.apply||(Vl?zl.bind(jl):function(){return zl.apply(jl,arguments)}),Gl=ve,ql=o,Kl=tl(tl.bind),Yl=function(e,t){return Gl(e),void 0===t?e:ql?Kl(e,t):function(){return e.apply(t,arguments)}},Xl=TypeError,Zl=function(e,t){if(e<t)throw new Xl("Not enough arguments");return e},Jl=/(?:ipad|iphone|ipod).*applewebkit/i.test(Y),Ql=i,$l=Wl,ed=Yl,td=F,id=He,rd=n,nd=qn,ad=Bs,od=gt,sd=Zl,cd=Jl,ld=ts,dd=Ql.setImmediate,ud=Ql.clearImmediate,hd=Ql.process,pd=Ql.Dispatch,fd=Ql.Function,md=Ql.MessageChannel,gd=Ql.String,vd=0,_d={},yd="onreadystatechange";rd((function(){Al=Ql.location}));var Ed=function(e){if(id(_d,e)){var t=_d[e];delete _d[e],t()}},bd=function(e){return function(){Ed(e)}},wd=function(e){Ed(e.data)},Id=function(e){Ql.postMessage(gd(e),Al.protocol+"//"+Al.host)};dd&&ud||(dd=function(e){sd(arguments.length,1);var t=td(e)?e:fd(e),i=ad(arguments,1);return _d[++vd]=function(){$l(t,void 0,i)},Rl(vd),vd},ud=function(e){delete _d[e]},ld?Rl=function(e){hd.nextTick(bd(e))}:pd&&pd.now?Rl=function(e){pd.now(bd(e))}:md&&!cd?(Cl=(kl=new md).port2,kl.port1.onmessage=wd,Rl=ed(Cl.postMessage,Cl)):Ql.addEventListener&&td(Ql.postMessage)&&!Ql.importScripts&&Al&&"file:"!==Al.protocol&&!rd(Id)?(Rl=Id,Ql.addEventListener("message",wd,!1)):Rl=yd in od("script")?function(e){nd.appendChild(od("script"))[yd]=function(){nd.removeChild(this),Ed(e)}}:function(e){setTimeout(bd(e),0)});var Td={set:dd,clear:ud},Sd=i,Ad=a,Rd=Object.getOwnPropertyDescriptor,kd=function(e){if(!Ad)return Sd[e];var t=Rd(Sd,e);return t&&t.value},Cd=function(){this.head=null,this.tail=null};Cd.prototype={add:function(e){var t={item:e,next:null},i=this.tail;i?i.next=t:this.head=t,this.tail=t},get:function(){var e=this.head;if(e)return null===(this.head=e.next)&&(this.tail=null),e.item}};var Dd,Od,Ld,Nd,xd,Pd=Cd,Md=/ipad|iphone|ipod/i.test(Y)&&"undefined"!=typeof Pebble,Ud=/web0s(?!.*chrome)/i.test(Y),Bd=i,Fd=kd,Vd=Yl,Hd=Td.set,jd=Pd,zd=Jl,Wd=Md,Gd=Ud,qd=ts,Kd=Bd.MutationObserver||Bd.WebKitMutationObserver,Yd=Bd.document,Xd=Bd.process,Zd=Bd.Promise,Jd=Fd("queueMicrotask");if(!Jd){var Qd=new jd,$d=function(){var e,t;for(qd&&(e=Xd.domain)&&e.exit();t=Qd.get();)try{t()}catch(RM){throw Qd.head&&Dd(),RM}e&&e.enter()};zd||qd||Gd||!Kd||!Yd?!Wd&&Zd&&Zd.resolve?((Nd=Zd.resolve(void 0)).constructor=Zd,xd=Vd(Nd.then,Nd),Dd=function(){xd($d)}):qd?Dd=function(){Xd.nextTick($d)}:(Hd=Vd(Hd,Bd),Dd=function(){Hd($d)}):(Od=!0,Ld=Yd.createTextNode(""),new Kd($d).observe(Ld,{characterData:!0}),Dd=function(){Ld.data=Od=!Od}),Jd=function(e){Qd.head||Dd(),Qd.add(e)}}var eu=Jd,tu=function(e){try{return{error:!1,value:e()}}catch(RM){return{error:!0,value:RM}}},iu=i.Promise,ru=i,nu=iu,au=F,ou=qr,su=si,cu=tt,lu=es,du=te;nu&&nu.prototype;var uu=cu("species"),hu=!1,pu=au(ru.PromiseRejectionEvent),fu=ou("Promise",(function(){var e=su(nu),t=e!==String(nu);if(!t&&66===du)return!0;if(!du||du<51||!/native code/.test(e)){var i=new nu((function(e){e(1)})),r=function(e){e((function(){}),(function(){}))};if((i.constructor={})[uu]=r,!(hu=i.then((function(){}))instanceof r))return!0}return!(t||"BROWSER"!==lu&&"DENO"!==lu||pu)})),mu={CONSTRUCTOR:fu,REJECTION_EVENT:pu,SUBCLASSING:hu},gu={},vu=ve,_u=TypeError,yu=function(e){var t,i;this.promise=new e((function(e,r){if(void 0!==t||void 0!==i)throw new _u("Bad Promise constructor");t=e,i=r})),this.resolve=vu(t),this.reject=vu(i)};gu.f=function(e){return new yu(e)};var Eu,bu,wu,Iu=en,Tu=ts,Su=i,Au=l,Ru=Ji,ku=no,Cu=Va,Du=Xc,Ou=ve,Lu=F,Nu=H,xu=ms,Pu=Fl,Mu=Td.set,Uu=eu,Bu=function(e,t){try{1===arguments.length?console.error(e):console.error(e,t)}catch(RM){}},Fu=tu,Vu=Pd,Hu=ki,ju=iu,zu=gu,Wu="Promise",Gu=mu.CONSTRUCTOR,qu=mu.REJECTION_EVENT,Ku=mu.SUBCLASSING,Yu=Hu.getterFor(Wu),Xu=Hu.set,Zu=ju&&ju.prototype,Ju=ju,Qu=Zu,$u=Su.TypeError,eh=Su.document,th=Su.process,ih=zu.f,rh=ih,nh=!!(eh&&eh.createEvent&&Su.dispatchEvent),ah="unhandledrejection",oh=function(e){var t;return!(!Nu(e)||!Lu(t=e.then))&&t},sh=function(e,t){var i,r,n,a=t.value,o=1===t.state,s=o?e.ok:e.fail,c=e.resolve,l=e.reject,d=e.domain;try{s?(o||(2===t.rejection&&hh(t),t.rejection=1),!0===s?i=a:(d&&d.enter(),i=s(a),d&&(d.exit(),n=!0)),i===e.promise?l(new $u("Promise-chain cycle")):(r=oh(i))?Au(r,i,c,l):c(i)):l(a)}catch(RM){d&&!n&&d.exit(),l(RM)}},ch=function(e,t){e.notified||(e.notified=!0,Uu((function(){for(var i,r=e.reactions;i=r.get();)sh(i,e);e.notified=!1,t&&!e.rejection&&dh(e)})))},lh=function(e,t,i){var r,n;nh?((r=eh.createEvent("Event")).promise=t,r.reason=i,r.initEvent(e,!1,!0),Su.dispatchEvent(r)):r={promise:t,reason:i},!qu&&(n=Su["on"+e])?n(r):e===ah&&Bu("Unhandled promise rejection",i)},dh=function(e){Au(Mu,Su,(function(){var t,i=e.facade,r=e.value;if(uh(e)&&(t=Fu((function(){Tu?th.emit("unhandledRejection",r,i):lh(ah,i,r)})),e.rejection=Tu||uh(e)?2:1,t.error))throw t.value}))},uh=function(e){return 1!==e.rejection&&!e.parent},hh=function(e){Au(Mu,Su,(function(){var t=e.facade;Tu?th.emit("rejectionHandled",t):lh("rejectionhandled",t,e.value)}))},ph=function(e,t,i){return function(r){e(t,r,i)}},fh=function(e,t,i){e.done||(e.done=!0,i&&(e=i),e.value=t,e.state=2,ch(e,!0))},mh=function(e,t,i){if(!e.done){e.done=!0,i&&(e=i);try{if(e.facade===t)throw new $u("Promise can't be resolved itself");var r=oh(t);r?Uu((function(){var i={done:!1};try{Au(r,t,ph(mh,i,e),ph(fh,i,e))}catch(RM){fh(i,RM,e)}})):(e.value=t,e.state=1,ch(e,!1))}catch(RM){fh({done:!1},RM,e)}}};if(Gu&&(Qu=(Ju=function(e){xu(this,Qu),Ou(e),Au(Eu,this);var t=Yu(this);try{e(ph(mh,t),ph(fh,t))}catch(RM){fh(t,RM)}}).prototype,(Eu=function(e){Xu(this,{type:Wu,done:!1,notified:!1,parent:!1,reactions:new Vu,rejection:!1,state:0,value:null})}).prototype=Ru(Qu,"then",(function(e,t){var i=Yu(this),r=ih(Pu(this,Ju));return i.parent=!0,r.ok=!Lu(e)||e,r.fail=Lu(t)&&t,r.domain=Tu?th.domain:void 0,0===i.state?i.reactions.add(r):Uu((function(){sh(r,i)})),r.promise})),bu=function(){var e=new Eu,t=Yu(e);this.promise=e,this.resolve=ph(mh,t),this.reject=ph(fh,t)},zu.f=ih=function(e){return e===Ju||undefined===e?new bu(e):rh(e)},Lu(ju)&&Zu!==Object.prototype)){wu=Zu.then,Ku||Ru(Zu,"then",(function(e,t){var i=this;return new Ju((function(e,t){Au(wu,i,e,t)})).then(e,t)}),{unsafe:!0});try{delete Zu.constructor}catch(RM){}ku&&ku(Zu,Qu)}Iu({global:!0,constructor:!0,wrap:!0,forced:Gu},{Promise:Ju}),Cu(Ju,Wu,!1),Du(Wu);var gh=_a,vh=tt("iterator"),_h=Array.prototype,yh=function(e){return void 0!==e&&(gh.Array===e||_h[vh]===e)},Eh=ln,bh=Ee,wh=O,Ih=_a,Th=tt("iterator"),Sh=function(e){if(!wh(e))return bh(e,Th)||bh(e,"@@iterator")||Ih[Eh(e)]},Ah=l,Rh=ve,kh=Nt,Ch=pe,Dh=Sh,Oh=TypeError,Lh=function(e,t){var i=arguments.length<2?Dh(e):t;if(Rh(i))return kh(Ah(i,e));throw new Oh(Ch(e)+" is not iterable")},Nh=l,xh=Nt,Ph=Ee,Mh=function(e,t,i){var r,n;xh(e);try{if(!(r=Ph(e,"return"))){if("throw"===t)throw i;return i}r=Nh(r,e)}catch(RM){n=!0,r=RM}if("throw"===t)throw i;if(n)throw r;return xh(r),i},Uh=Yl,Bh=l,Fh=Nt,Vh=pe,Hh=yh,jh=ur,zh=G,Wh=Lh,Gh=Sh,qh=Mh,Kh=TypeError,Yh=function(e,t){this.stopped=e,this.result=t},Xh=Yh.prototype,Zh=function(e,t,i){var r,n,a,o,s,c,l,d=i&&i.that,u=!(!i||!i.AS_ENTRIES),h=!(!i||!i.IS_RECORD),p=!(!i||!i.IS_ITERATOR),f=!(!i||!i.INTERRUPTED),m=Uh(t,d),g=function(e){return r&&qh(r,"normal",e),new Yh(!0,e)},v=function(e){return u?(Fh(e),f?m(e[0],e[1],g):m(e[0],e[1])):f?m(e,g):m(e)};if(h)r=e.iterator;else if(p)r=e;else{if(!(n=Gh(e)))throw new Kh(Vh(e)+" is not iterable");if(Hh(n)){for(a=0,o=jh(e);o>a;a++)if((s=v(e[a]))&&zh(Xh,s))return s;return new Yh(!1)}r=Wh(e,n)}for(c=h?e.next:r.next;!(l=Bh(c,r)).done;){try{s=v(l.value)}catch(RM){qh(r,"throw",RM)}if("object"==typeof s&&s&&zh(Xh,s))return s}return new Yh(!1)},Jh=tt("iterator"),Qh=!1;try{var $h=0,ep={next:function(){return{done:!!$h++}},return:function(){Qh=!0}};ep[Jh]=function(){return this},Array.from(ep,(function(){throw 2}))}catch(RM){}var tp=function(e,t){try{if(!t&&!Qh)return!1}catch(RM){return!1}var i=!1;try{var r={};r[Jh]=function(){return{next:function(){return{done:i=!0}}}},e(r)}catch(RM){}return i},ip=iu,rp=mu.CONSTRUCTOR||!tp((function(e){ip.all(e).then(void 0,(function(){}))})),np=l,ap=ve,op=gu,sp=tu,cp=Zh;en({target:"Promise",stat:!0,forced:rp},{all:function(e){var t=this,i=op.f(t),r=i.resolve,n=i.reject,a=sp((function(){var i=ap(t.resolve),a=[],o=0,s=1;cp(e,(function(e){var c=o++,l=!1;s++,np(i,t,e).then((function(e){l||(l=!0,a[c]=e,--s||r(a))}),n)})),--s||r(a)}));return a.error&&n(a.value),i.promise}});var lp=en,dp=mu.CONSTRUCTOR,up=iu,hp=W,pp=F,fp=Ji,mp=up&&up.prototype;if(lp({target:"Promise",proto:!0,forced:dp,real:!0},{catch:function(e){return this.then(void 0,e)}}),pp(up)){var gp=hp("Promise").prototype.catch;mp.catch!==gp&&fp(mp,"catch",gp,{unsafe:!0})}var vp=l,_p=ve,yp=gu,Ep=tu,bp=Zh;en({target:"Promise",stat:!0,forced:rp},{race:function(e){var t=this,i=yp.f(t),r=i.reject,n=Ep((function(){var n=_p(t.resolve);bp(e,(function(e){vp(n,t,e).then(i.resolve,r)}))}));return n.error&&r(n.value),i.promise}});var wp=gu;en({target:"Promise",stat:!0,forced:mu.CONSTRUCTOR},{reject:function(e){var t=wp.f(this);return(0,t.reject)(e),t.promise}});var Ip=Nt,Tp=H,Sp=gu,Ap=function(e,t){if(Ip(e),Tp(t)&&t.constructor===e)return t;var i=Sp.f(e);return(0,i.resolve)(t),i.promise},Rp=en,kp=mu.CONSTRUCTOR,Cp=Ap;W("Promise"),Rp({target:"Promise",stat:!0,forced:kp},{resolve:function(e){return Cp(this,e)}});var Dp=en,Op=iu,Lp=n,Np=W,xp=F,Pp=Fl,Mp=Ap,Up=Ji,Bp=Op&&Op.prototype;if(Dp({target:"Promise",proto:!0,real:!0,forced:!!Op&&Lp((function(){Bp.finally.call({then:function(){}},(function(){}))}))},{finally:function(e){var t=Pp(this,Np("Promise")),i=xp(e);return this.then(i?function(i){return Mp(t,e()).then((function(){return i}))}:e,i?function(i){return Mp(t,e()).then((function(){throw i}))}:e)}}),xp(Op)){var Fp=Np("Promise").prototype.finally;Bp.finally!==Fp&&Up(Bp,"finally",Fp,{unsafe:!0})}var Vp=H,Hp=S,jp=tt("match"),zp=function(e){var t;return Vp(e)&&(void 0!==(t=e[jp])?!!t:"RegExp"===Hp(e))},Wp=Nt,Gp=function(){var e=Wp(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},qp=l,Kp=He,Yp=G,Xp=Gp,Zp=RegExp.prototype,Jp=function(e){var t=e.flags;return void 0!==t||"flags"in Zp||Kp(e,"flags")||!Yp(Zp,e)?t:qp(Xp,e)},Qp=n,$p=i.RegExp,ef=Qp((function(){var e=$p("a","y");return e.lastIndex=2,null!==e.exec("abcd")})),tf=ef||Qp((function(){return!$p("a","y").sticky})),rf={BROKEN_CARET:ef||Qp((function(){var e=$p("^r","gy");return e.lastIndex=2,null!==e.exec("str")})),MISSED_STICKY:tf,UNSUPPORTED_Y:ef},nf=kt.f,af=n,of=i.RegExp,sf=af((function(){var e=of(".","s");return!(e.dotAll&&e.test("\n")&&"s"===e.flags)})),cf=n,lf=i.RegExp,df=cf((function(){var e=lf("(?<a>b)","g");return"b"!==e.exec("b").groups.a||"bc"!=="b".replace(e,"$<a>c")})),uf=a,hf=i,pf=b,ff=qr,mf=js,gf=Kt,vf=oa,_f=Qi.f,yf=G,Ef=zp,bf=hn,wf=Jp,If=rf,Tf=function(e,t,i){i in e||nf(e,i,{configurable:!0,get:function(){return t[i]},set:function(e){t[i]=e}})},Sf=Ji,Af=n,Rf=He,kf=ki.enforce,Cf=Xc,Df=sf,Of=df,Lf=tt("match"),Nf=hf.RegExp,xf=Nf.prototype,Pf=hf.SyntaxError,Mf=pf(xf.exec),Uf=pf("".charAt),Bf=pf("".replace),Ff=pf("".indexOf),Vf=pf("".slice),Hf=/^\?<[^\s\d!#%&*+<=>@^][^\s!#%&*+<=>@^]*>/,jf=/a/g,zf=/a/g,Wf=new Nf(jf)!==jf,Gf=If.MISSED_STICKY,qf=If.UNSUPPORTED_Y,Kf=uf&&(!Wf||Gf||Df||Of||Af((function(){return zf[Lf]=!1,Nf(jf)!==jf||Nf(zf)===zf||"/a/i"!==String(Nf(jf,"i"))})));if(ff("RegExp",Kf)){for(var Yf=function(e,t){var i,r,n,a,o,s,c=yf(xf,this),l=Ef(e),d=void 0===t,u=[],h=e;if(!c&&l&&d&&e.constructor===Yf)return e;if((l||yf(xf,e))&&(e=e.source,d&&(t=wf(h))),e=void 0===e?"":bf(e),t=void 0===t?"":bf(t),h=e,Df&&"dotAll"in jf&&(r=!!t&&Ff(t,"s")>-1)&&(t=Bf(t,/s/g,"")),i=t,Gf&&"sticky"in jf&&(n=!!t&&Ff(t,"y")>-1)&&qf&&(t=Bf(t,/y/g,"")),Of&&(a=function(e){for(var t,i=e.length,r=0,n="",a=[],o=vf(null),s=!1,c=!1,l=0,d="";r<=i;r++){if("\\"===(t=Uf(e,r)))t+=Uf(e,++r);else if("]"===t)s=!1;else if(!s)switch(!0){case"["===t:s=!0;break;case"("===t:if(n+=t,"?:"===Vf(e,r+1,r+3))continue;Mf(Hf,Vf(e,r+1))&&(r+=2,c=!0),l++;continue;case">"===t&&c:if(""===d||Rf(o,d))throw new Pf("Invalid capture group name");o[d]=!0,a[a.length]=[d,l],c=!1,d="";continue}c?d+=t:n+=t}return[n,a]}(e),e=a[0],u=a[1]),o=mf(Nf(e,t),c?this:xf,Yf),(r||n||u.length)&&(s=kf(o),r&&(s.dotAll=!0,s.raw=Yf(function(e){for(var t,i=e.length,r=0,n="",a=!1;r<=i;r++)"\\"!==(t=Uf(e,r))?a||"."!==t?("["===t?a=!0:"]"===t&&(a=!1),n+=t):n+="[\\s\\S]":n+=t+Uf(e,++r);return n}(e),i)),n&&(s.sticky=!0),u.length&&(s.groups=u)),e!==h)try{gf(o,"source",""===h?"(?:)":h)}catch(RM){}return o},Xf=_f(Nf),Zf=0;Xf.length>Zf;)Tf(Yf,Nf,Xf[Zf++]);xf.constructor=Yf,Yf.prototype=xf,Sf(hf,"RegExp",Yf,{constructor:!0})}Cf("RegExp");var Jf=l,Qf=b,$f=hn,em=Gp,tm=rf,im=oa,rm=ki.get,nm=sf,am=df,om=Pe("native-string-replace",String.prototype.replace),sm=RegExp.prototype.exec,cm=sm,lm=Qf("".charAt),dm=Qf("".indexOf),um=Qf("".replace),hm=Qf("".slice),pm=function(){var e=/a/,t=/b*/g;return Jf(sm,e,"a"),Jf(sm,t,"a"),0!==e.lastIndex||0!==t.lastIndex}(),fm=tm.BROKEN_CARET,mm=void 0!==/()??/.exec("")[1];(pm||mm||fm||nm||am)&&(cm=function(e){var t,i,r,n,a,o,s,c=this,l=rm(c),d=$f(e),u=l.raw;if(u)return u.lastIndex=c.lastIndex,t=Jf(cm,u,d),c.lastIndex=u.lastIndex,t;var h=l.groups,p=fm&&c.sticky,f=Jf(em,c),m=c.source,g=0,v=d;if(p&&(f=um(f,"y",""),-1===dm(f,"g")&&(f+="g"),v=hm(d,c.lastIndex),c.lastIndex>0&&(!c.multiline||c.multiline&&"\n"!==lm(d,c.lastIndex-1))&&(m="(?: "+m+")",v=" "+v,g++),i=new RegExp("^(?:"+m+")",f)),mm&&(i=new RegExp("^"+m+"$(?!\\s)",f)),pm&&(r=c.lastIndex),n=Jf(sm,p?i:c,v),p?n?(n.input=hm(n.input,g),n[0]=hm(n[0],g),n.index=c.lastIndex,c.lastIndex+=n[0].length):c.lastIndex=0:pm&&n&&(c.lastIndex=c.global?n.index+n[0].length:r),mm&&n&&n.length>1&&Jf(om,n[0],i,(function(){for(a=1;a<arguments.length-2;a++)void 0===arguments[a]&&(n[a]=void 0)})),n&&h)for(n.groups=o=im(null),a=0;a<h.length;a++)o[(s=h[a])[0]]=n[s[1]];return n});var gm=cm;en({target:"RegExp",proto:!0,forced:/./.exec!==gm},{exec:gm});var vm=a,_m=mn,ym=Gp,Em=n,bm=i.RegExp,wm=bm.prototype,Im=vm&&Em((function(){var e=!0;try{bm(".","d")}catch(RM){e=!1}var t={},i="",r=e?"dgimsy":"gimsy",n=function(e,r){Object.defineProperty(t,e,{get:function(){return i+=r,!0}})},a={dotAll:"s",global:"g",ignoreCase:"i",multiline:"m",sticky:"y"};for(var o in e&&(a.hasIndices="d"),a)n(o,a[o]);return Object.getOwnPropertyDescriptor(wm,"flags").get.call(t)!==r||i!==r}));Im&&_m(wm,"flags",{configurable:!0,get:ym});var Tm=ir,Sm=hn,Am=x,Rm=RangeError,km=b,Cm=lr,Dm=hn,Om=x,Lm=km((function(e){var t=Sm(Am(this)),i="",r=Tm(e);if(r<0||Infinity===r)throw new Rm("Wrong number of repetitions");for(;r>0;(r>>>=1)&&(t+=t))1&r&&(i+=t);return i})),Nm=km("".slice),xm=Math.ceil,Pm=function(e){return function(t,i,r){var n,a,o=Dm(Om(t)),s=Cm(i),c=o.length,l=void 0===r?" ":Dm(r);return s<=c||""===l?o:((a=Lm(l,xm((n=s-c)/l.length))).length>n&&(a=Nm(a,0,n)),e?o+a:a+o)}},Mm={start:Pm(!1),end:Pm(!0)},Um=/Version\/10(?:\.\d+){1,2}(?: [\w./]+)?(?: Mobile\/\w+)? Safari\//.test(Y),Bm=Mm.start;en({target:"String",proto:!0,forced:Um},{padStart:function(e){return Bm(this,e,arguments.length>1?arguments[1]:void 0)}});var Fm=l,Vm=Ji,Hm=gm,jm=n,zm=tt,Wm=Kt,Gm=zm("species"),qm=RegExp.prototype,Km=b,Ym=ir,Xm=hn,Zm=x,Jm=Km("".charAt),Qm=Km("".charCodeAt),$m=Km("".slice),eg=function(e){return function(t,i){var r,n,a=Xm(Zm(t)),o=Ym(i),s=a.length;return o<0||o>=s?e?"":void 0:(r=Qm(a,o))<55296||r>56319||o+1===s||(n=Qm(a,o+1))<56320||n>57343?e?Jm(a,o):r:e?$m(a,o,o+2):n-56320+(r-55296<<10)+65536}},tg={codeAt:eg(!1),charAt:eg(!0)},ig=tg.charAt,rg=b,ng=Be,ag=Math.floor,og=rg("".charAt),sg=rg("".replace),cg=rg("".slice),lg=/\$([$&'`]|\d{1,2}|<[^>]*>)/g,dg=/\$([$&'`]|\d{1,2})/g,ug=function(e,t,i,r,n,a){var o=i+e.length,s=r.length,c=dg;return void 0!==n&&(n=ng(n),c=lg),sg(a,c,(function(a,c){var l;switch(og(c,0)){case"$":return"$";case"&":return e;case"`":return cg(t,0,i);case"'":return cg(t,o);case"<":l=n[cg(c,1,-1)];break;default:var d=+c;if(0===d)return a;if(d>s){var u=ag(d/10);return 0===u?a:u<=s?void 0===r[u-1]?og(c,1):r[u-1]+og(c,1):a}l=r[d-1]}return void 0===l?"":l}))},hg=l,pg=Nt,fg=F,mg=S,gg=gm,vg=TypeError,_g=Wl,yg=l,Eg=b,bg=function(e,t,i,r){var n=zm(e),a=!jm((function(){var t={};return t[n]=function(){return 7},7!==""[e](t)})),o=a&&!jm((function(){var t=!1,i=/a/;return"split"===e&&((i={}).constructor={},i.constructor[Gm]=function(){return i},i.flags="",i[n]=/./[n]),i.exec=function(){return t=!0,null},i[n](""),!t}));if(!a||!o||i){var s=/./[n],c=t(n,""[e],(function(e,t,i,r,n){var o=t.exec;return o===Hm||o===qm.exec?a&&!n?{done:!0,value:Fm(s,t,i,r)}:{done:!0,value:Fm(e,i,t,r)}:{done:!1}}));Vm(String.prototype,e,c[0]),Vm(qm,n,c[1])}r&&Wm(qm[n],"sham",!0)},wg=n,Ig=Nt,Tg=F,Sg=O,Ag=ir,Rg=lr,kg=hn,Cg=x,Dg=function(e,t,i){return t+(i?ig(e,t).length:1)},Og=Ee,Lg=ug,Ng=function(e,t){var i=e.exec;if(fg(i)){var r=hg(i,e,t);return null!==r&&pg(r),r}if("RegExp"===mg(e))return hg(gg,e,t);throw new vg("RegExp#exec called on incompatible receiver")},xg=tt("replace"),Pg=Math.max,Mg=Math.min,Ug=Eg([].concat),Bg=Eg([].push),Fg=Eg("".indexOf),Vg=Eg("".slice),Hg=function(e){return void 0===e?e:String(e)},jg="$0"==="a".replace(/./,"$0"),zg=!!/./[xg]&&""===/./[xg]("a","$0");bg("replace",(function(e,t,i){var r=zg?"$":"$0";return[function(e,i){var r=Cg(this),n=Sg(e)?void 0:Og(e,xg);return n?yg(n,e,r,i):yg(t,kg(r),e,i)},function(e,n){var a=Ig(this),o=kg(e);if("string"==typeof n&&-1===Fg(n,r)&&-1===Fg(n,"$<")){var s=i(t,a,o,n);if(s.done)return s.value}var c=Tg(n);c||(n=kg(n));var l,d=a.global;d&&(l=a.unicode,a.lastIndex=0);for(var u,h=[];null!==(u=Ng(a,o))&&(Bg(h,u),d);){""===kg(u[0])&&(a.lastIndex=Dg(o,Rg(a.lastIndex),l))}for(var p="",f=0,m=0;m<h.length;m++){for(var g,v=kg((u=h[m])[0]),_=Pg(Mg(Ag(u.index),o.length),0),y=[],E=1;E<u.length;E++)Bg(y,Hg(u[E]));var b=u.groups;if(c){var w=Ug([v],y,_,o);void 0!==b&&Bg(w,b),g=kg(_g(n,void 0,w))}else g=Lg(v,o,_,y,b,n);_>=f&&(p+=Vg(o,f,_)+g,f=_+v.length)}return p+Vg(o,f)}]}),!!wg((function(){var e=/./;return e.exec=function(){var e=[];return e.groups={a:"7"},e},"7"!=="".replace(e,"$<a>")}))||!jg||zg);var Wg="\t\n\v\f\r                 \u2028\u2029\ufeff",Gg=x,qg=hn,Kg=Wg,Yg=b("".replace),Xg=RegExp("^["+Kg+"]+"),Zg=RegExp("(^|[^"+Kg+"])["+Kg+"]+$"),Jg=function(e){return function(t){var i=qg(Gg(t));return 1&e&&(i=Yg(i,Xg,"")),2&e&&(i=Yg(i,Zg,"$1")),i}},Qg={start:Jg(1),end:Jg(2),trim:Jg(3)},$g=ei.PROPER,ev=n,tv=Wg,iv=Qg.trim;en({target:"String",proto:!0,forced:function(e){return ev((function(){return!!tv[e]()||"​…᠎"!=="​…᠎"[e]()||$g&&tv[e].name!==e}))}("trim")},{trim:function(){return iv(this)}});var rv,nv,av,ov={exports:{}},sv=ds,cv=a,lv=i,dv=F,uv=H,hv=He,pv=ln,fv=pe,mv=Kt,gv=Ji,vv=mn,_v=G,yv=Ra,Ev=no,bv=tt,wv=qe,Iv=ki.enforce,Tv=ki.get,Sv=lv.Int8Array,Av=Sv&&Sv.prototype,Rv=lv.Uint8ClampedArray,kv=Rv&&Rv.prototype,Cv=Sv&&yv(Sv),Dv=Av&&yv(Av),Ov=Object.prototype,Lv=lv.TypeError,Nv=bv("toStringTag"),xv=wv("TYPED_ARRAY_TAG"),Pv="TypedArrayConstructor",Mv=sv&&!!Ev&&"Opera"!==pv(lv.opera),Uv=!1,Bv={Int8Array:1,Uint8Array:1,Uint8ClampedArray:1,Int16Array:2,Uint16Array:2,Int32Array:4,Uint32Array:4,Float32Array:4,Float64Array:8},Fv={BigInt64Array:8,BigUint64Array:8},Vv=function(e){var t=yv(e);if(uv(t)){var i=Tv(t);return i&&hv(i,Pv)?i[Pv]:Vv(t)}},Hv=function(e){if(!uv(e))return!1;var t=pv(e);return hv(Bv,t)||hv(Fv,t)};for(rv in Bv)(av=(nv=lv[rv])&&nv.prototype)?Iv(av)[Pv]=nv:Mv=!1;for(rv in Fv)(av=(nv=lv[rv])&&nv.prototype)&&(Iv(av)[Pv]=nv);if((!Mv||!dv(Cv)||Cv===Function.prototype)&&(Cv=function(){throw new Lv("Incorrect invocation")},Mv))for(rv in Bv)lv[rv]&&Ev(lv[rv],Cv);if((!Mv||!Dv||Dv===Ov)&&(Dv=Cv.prototype,Mv))for(rv in Bv)lv[rv]&&Ev(lv[rv].prototype,Dv);if(Mv&&yv(kv)!==Dv&&Ev(kv,Dv),cv&&!hv(Dv,Nv))for(rv in Uv=!0,vv(Dv,Nv,{configurable:!0,get:function(){return uv(this)?this[xv]:void 0}}),Bv)lv[rv]&&mv(lv[rv],xv,rv);var jv={NATIVE_ARRAY_BUFFER_VIEWS:Mv,TYPED_ARRAY_TAG:Uv&&xv,aTypedArray:function(e){if(Hv(e))return e;throw new Lv("Target is not a typed array")},aTypedArrayConstructor:function(e){if(dv(e)&&(!Ev||_v(Cv,e)))return e;throw new Lv(fv(e)+" is not a typed array constructor")},exportTypedArrayMethod:function(e,t,i,r){if(cv){if(i)for(var n in Bv){var a=lv[n];if(a&&hv(a.prototype,e))try{delete a.prototype[e]}catch(RM){try{a.prototype[e]=t}catch(o){}}}Dv[e]&&!i||gv(Dv,e,i?t:Mv&&Av[e]||t,r)}},exportTypedArrayStaticMethod:function(e,t,i){var r,n;if(cv){if(Ev){if(i)for(r in Bv)if((n=lv[r])&&hv(n,e))try{delete n[e]}catch(RM){}if(Cv[e]&&!i)return;try{return gv(Cv,e,i?t:Mv&&Cv[e]||t)}catch(RM){}}for(r in Bv)!(n=lv[r])||n[e]&&!i||gv(n,e,t)}},getTypedArrayConstructor:Vv,isView:function(e){if(!uv(e))return!1;var t=pv(e);return"DataView"===t||hv(Bv,t)||hv(Fv,t)},isTypedArray:Hv,TypedArray:Cv,TypedArrayPrototype:Dv},zv=i,Wv=n,Gv=tp,qv=jv.NATIVE_ARRAY_BUFFER_VIEWS,Kv=zv.ArrayBuffer,Yv=zv.Int8Array,Xv=!qv||!Wv((function(){Yv(1)}))||!Wv((function(){new Yv(-1)}))||!Gv((function(e){new Yv,new Yv(null),new Yv(1.5),new Yv(e)}),!0)||Wv((function(){return 1!==new Yv(new Kv(2),1,void 0).length})),Zv=H,Jv=Math.floor,Qv=Number.isInteger||function(e){return!Zv(e)&&isFinite(e)&&Jv(e)===e},$v=ir,e_=RangeError,t_=function(e){var t=$v(e);if(t<0)throw new e_("The argument can't be less than 0");return t},i_=RangeError,r_=function(e,t){var i=t_(e);if(i%t)throw new i_("Wrong offset");return i},n_=Math.round,a_=ln,o_=lt,s_=TypeError,c_=function(e){var t=o_(e,"number");if("number"==typeof t)throw new s_("Can't convert number to bigint");return BigInt(t)},l_=Yl,d_=l,u_=xl,h_=Be,p_=ur,f_=Lh,m_=Sh,g_=yh,v_=function(e){var t=a_(e);return"BigInt64Array"===t||"BigUint64Array"===t},__=jv.aTypedArrayConstructor,y_=c_,E_=function(e){var t,i,r,n,a,o,s,c,l=u_(this),d=h_(e),u=arguments.length,h=u>1?arguments[1]:void 0,p=void 0!==h,f=m_(d);if(f&&!g_(f))for(c=(s=f_(d,f)).next,d=[];!(o=d_(c,s)).done;)d.push(o.value);for(p&&u>2&&(h=l_(h,arguments[2])),i=p_(d),r=new(__(l))(i),n=v_(r),t=0;i>t;t++)a=p?h(d[t],t):d[t],r[t]=n?y_(a):+a;return r},b_=as,w_=Dl,I_=H,T_=tt("species"),S_=Array,A_=function(e){var t;return b_(e)&&(t=e.constructor,(w_(t)&&(t===S_||b_(t.prototype))||I_(t)&&null===(t=t[T_]))&&(t=void 0)),void 0===t?S_:t},R_=Yl,k_=D,C_=Be,D_=ur,O_=function(e,t){return new(A_(e))(0===t?0:t)},L_=b([].push),N_=function(e){var t=1===e,i=2===e,r=3===e,n=4===e,a=6===e,o=7===e,s=5===e||a;return function(c,l,d,u){for(var h,p,f=C_(c),m=k_(f),g=D_(m),v=R_(l,d),_=0,y=u||O_,E=t?y(c,g):i||o?y(c,0):void 0;g>_;_++)if((s||_ in m)&&(p=v(h=m[_],_,f),e))if(t)E[_]=p;else if(p)switch(e){case 3:return!0;case 5:return h;case 6:return _;case 2:L_(E,h)}else switch(e){case 4:return!1;case 7:L_(E,h)}return a?-1:r||n?n:E}},x_={forEach:N_(0),map:N_(1),filter:N_(2),some:N_(3),every:N_(4),find:N_(5),findIndex:N_(6),filterReject:N_(7)},P_=ur,M_=en,U_=i,B_=l,F_=a,V_=Xv,H_=jv,j_=Wc,z_=ms,W_=g,G_=Kt,q_=Qv,K_=lr,Y_=ys,X_=r_,Z_=function(e){var t=n_(e);return t<0?0:t>255?255:255&t},J_=ht,Q_=He,$_=ln,ey=H,ty=ue,iy=oa,ry=G,ny=no,ay=Qi.f,oy=E_,sy=x_.forEach,cy=Xc,ly=mn,dy=kt,uy=r,hy=function(e,t,i){for(var r=0,n=arguments.length>2?i:P_(t),a=new e(n);n>r;)a[r]=t[r++];return a},py=js,fy=ki.get,my=ki.set,gy=ki.enforce,vy=dy.f,_y=uy.f,yy=U_.RangeError,Ey=j_.ArrayBuffer,by=Ey.prototype,wy=j_.DataView,Iy=H_.NATIVE_ARRAY_BUFFER_VIEWS,Ty=H_.TYPED_ARRAY_TAG,Sy=H_.TypedArray,Ay=H_.TypedArrayPrototype,Ry=H_.isTypedArray,ky="BYTES_PER_ELEMENT",Cy="Wrong length",Dy=function(e,t){ly(e,t,{configurable:!0,get:function(){return fy(this)[t]}})},Oy=function(e){var t;return ry(by,e)||"ArrayBuffer"===(t=$_(e))||"SharedArrayBuffer"===t},Ly=function(e,t){return Ry(e)&&!ty(t)&&t in e&&q_(+t)&&t>=0},Ny=function(e,t){return t=J_(t),Ly(e,t)?W_(2,e[t]):_y(e,t)},xy=function(e,t,i){return t=J_(t),!(Ly(e,t)&&ey(i)&&Q_(i,"value"))||Q_(i,"get")||Q_(i,"set")||i.configurable||Q_(i,"writable")&&!i.writable||Q_(i,"enumerable")&&!i.enumerable?vy(e,t,i):(e[t]=i.value,e)};F_?(Iy||(uy.f=Ny,dy.f=xy,Dy(Ay,"buffer"),Dy(Ay,"byteOffset"),Dy(Ay,"byteLength"),Dy(Ay,"length")),M_({target:"Object",stat:!0,forced:!Iy},{getOwnPropertyDescriptor:Ny,defineProperty:xy}),ov.exports=function(e,t,i){var r=e.match(/\d+/)[0]/8,n=e+(i?"Clamped":"")+"Array",a="get"+e,o="set"+e,s=U_[n],c=s,l=c&&c.prototype,d={},u=function(e,t){vy(e,t,{get:function(){return function(e,t){var i=fy(e);return i.view[a](t*r+i.byteOffset,!0)}(this,t)},set:function(e){return function(e,t,n){var a=fy(e);a.view[o](t*r+a.byteOffset,i?Z_(n):n,!0)}(this,t,e)},enumerable:!0})};Iy?V_&&(c=t((function(e,t,i,n){return z_(e,l),py(ey(t)?Oy(t)?void 0!==n?new s(t,X_(i,r),n):void 0!==i?new s(t,X_(i,r)):new s(t):Ry(t)?hy(c,t):B_(oy,c,t):new s(Y_(t)),e,c)})),ny&&ny(c,Sy),sy(ay(s),(function(e){e in c||G_(c,e,s[e])})),c.prototype=l):(c=t((function(e,t,i,n){z_(e,l);var a,o,s,d=0,h=0;if(ey(t)){if(!Oy(t))return Ry(t)?hy(c,t):B_(oy,c,t);a=t,h=X_(i,r);var p=t.byteLength;if(void 0===n){if(p%r)throw new yy(Cy);if((o=p-h)<0)throw new yy(Cy)}else if((o=K_(n)*r)+h>p)throw new yy(Cy);s=o/r}else s=Y_(t),a=new Ey(o=s*r);for(my(e,{buffer:a,byteOffset:h,byteLength:o,length:s,view:new wy(a)});d<s;)u(e,d++)})),ny&&ny(c,Sy),l=c.prototype=iy(Ay)),l.constructor!==c&&G_(l,"constructor",c),gy(l).TypedArrayConstructor=c,Ty&&G_(l,Ty,n);var h=c!==s;d[n]=c,M_({global:!0,constructor:!0,forced:h,sham:!Iy},d),ky in c||G_(c,ky,r),ky in l||G_(l,ky,r),cy(n)}):ov.exports=function(){};var Py=ov.exports;Py("Float32",(function(e){return function(t,i,r){return e(this,t,i,r)}})),Py("Int32",(function(e){return function(t,i,r){return e(this,t,i,r)}})),Py("Uint8",(function(e){return function(t,i,r){return e(this,t,i,r)}})),Py("Uint16",(function(e){return function(t,i,r){return e(this,t,i,r)}})),Py("Uint32",(function(e){return function(t,i,r){return e(this,t,i,r)}}));var My=Us,Uy=c_,By=ln,Fy=l,Vy=n,Hy=jv.aTypedArray,jy=jv.exportTypedArrayMethod,zy=b("".slice);jy("fill",(function(e){var t=arguments.length;Hy(this);var i="Big"===zy(By(this),0,3)?Uy(e):+e;return Fy(My,this,i,t>1?arguments[1]:void 0,t>2?arguments[2]:void 0)}),Vy((function(){var e=0;return new Int8Array(2).fill({valueOf:function(){return e++}}),1!==e}))),(0,jv.exportTypedArrayStaticMethod)("from",E_,Xv);var Wy=i,Gy=l,qy=jv,Ky=ur,Yy=r_,Xy=Be,Zy=n,Jy=Wy.RangeError,Qy=Wy.Int8Array,$y=Qy&&Qy.prototype,eE=$y&&$y.set,tE=qy.aTypedArray,iE=qy.exportTypedArrayMethod,rE=!Zy((function(){var e=new Uint8ClampedArray(2);return Gy(eE,e,{length:1,0:3},1),3!==e[1]})),nE=rE&&qy.NATIVE_ARRAY_BUFFER_VIEWS&&Zy((function(){var e=new Qy(2);return e.set(1),e.set("2",1),0!==e[0]||2!==e[1]}));iE("set",(function(e){tE(this);var t=Yy(arguments.length>1?arguments[1]:void 0,1),i=Xy(e);if(rE)return Gy(eE,this,i,t);var r=this.length,n=Ky(i),a=0;if(n+t>r)throw new Jy("Wrong length");for(;a<n;)this[t+a]=i[a++]}),!rE||nE);var aE=Bs,oE=Math.floor,sE=function(e,t){var i=e.length;if(i<8)for(var r,n,a=1;a<i;){for(n=a,r=e[a];n&&t(e[n-1],r)>0;)e[n]=e[--n];n!==a++&&(e[n]=r)}else for(var o=oE(i/2),s=sE(aE(e,0,o),t),c=sE(aE(e,o),t),l=s.length,d=c.length,u=0,h=0;u<l||h<d;)e[u+h]=u<l&&h<d?t(s[u],c[h])<=0?s[u++]:c[h++]:u<l?s[u++]:c[h++];return e},cE=sE,lE=Y.match(/firefox\/(\d+)/i),dE=!!lE&&+lE[1],uE=/MSIE|Trident/.test(Y),hE=Y.match(/AppleWebKit\/(\d+)\./),pE=!!hE&&+hE[1],fE=tl,mE=n,gE=ve,vE=cE,_E=dE,yE=uE,EE=te,bE=pE,wE=jv.aTypedArray,IE=jv.exportTypedArrayMethod,TE=i.Uint16Array,SE=TE&&fE(TE.prototype.sort),AE=!(!SE||mE((function(){SE(new TE(2),null)}))&&mE((function(){SE(new TE(2),{})}))),RE=!!SE&&!mE((function(){if(EE)return EE<74;if(_E)return _E<67;if(yE)return!0;if(bE)return bE<602;var e,t,i=new TE(516),r=Array(516);for(e=0;e<516;e++)t=e%4,i[e]=515-e,r[e]=e-2*t+3;for(SE(i,(function(e,t){return(e/4|0)-(t/4|0)})),e=0;e<516;e++)if(i[e]!==r[e])return!0}));IE("sort",(function(e){return void 0!==e&&gE(e),RE?SE(this,e):vE(wE(this),function(e){return function(t,i){return void 0!==e?+e(t,i)||0:i!=i?-1:t!=t?1:0===t&&0===i?1/t>0&&1/i<0?1:-1:t>i}}(e))}),!RE||AE);var kE=en,CE=l,DE=b,OE=x,LE=F,NE=O,xE=zp,PE=hn,ME=Ee,UE=Jp,BE=ug,FE=tt("replace"),VE=TypeError,HE=DE("".indexOf);DE("".replace);var jE=DE("".slice),zE=Math.max;kE({target:"String",proto:!0},{replaceAll:function(e,t){var i,r,n,a,o,s,c,l,d,u=OE(this),h=0,p="";if(!NE(e)){if(xE(e)&&(i=PE(OE(UE(e))),!~HE(i,"g")))throw new VE("`.replaceAll` does not allow non-global regexes");if(r=ME(e,FE))return CE(r,e,u,t)}for(n=PE(u),a=PE(e),(o=LE(t))||(t=PE(t)),s=a.length,c=zE(1,s),l=HE(n,a);-1!==l;)d=o?PE(t(a,l,n)):BE(a,n,l,[],void 0,t),p+=jE(n,h,l)+d,h=l+s,l=l+c>n.length?-1:HE(n,a,l+c);return h<n.length&&(p+=jE(n,h)),p}});var WE={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},GE=gt("span").classList,qE=GE&&GE.constructor&&GE.constructor.prototype,KE=qE===Object.prototype?void 0:qE,YE=x_.forEach,XE=Xo("forEach")?[].forEach:function(e){return YE(this,e,arguments.length>1?arguments[1]:void 0)},ZE=i,JE=WE,QE=KE,$E=XE,eb=Kt,tb=function(e){if(e&&e.forEach!==$E)try{eb(e,"forEach",$E)}catch(RM){e.forEach=$E}};for(var ib in JE)JE[ib]&&tb(ZE[ib]&&ZE[ib].prototype);tb(QE);var rb=i,nb=WE,ab=KE,ob=Bo,sb=Kt,cb=Va,lb=tt("iterator"),db=ob.values,ub=function(e,t){if(e){if(e[lb]!==db)try{sb(e,lb,db)}catch(RM){e[lb]=db}if(cb(e,t,!0),nb[t])for(var i in ob)if(e[i]!==ob[i])try{sb(e,i,ob[i])}catch(RM){e[i]=ob[i]}}};for(var hb in nb)ub(rb[hb]&&rb[hb].prototype,hb);ub(ab,"DOMTokenList");var pb=Td.clear;en({global:!0,bind:!0,enumerable:!0,forced:i.clearImmediate!==pb},{clearImmediate:pb});var fb=i,mb=Wl,gb=F,vb=es,_b=Y,yb=Bs,Eb=Zl,bb=fb.Function,wb=/MSIE .\./.test(_b)||"BUN"===vb&&function(){var e=fb.Bun.version.split(".");return e.length<3||"0"===e[0]&&(e[1]<3||"3"===e[1]&&"0"===e[2])}(),Ib=en,Tb=i,Sb=Td.set,Ab=function(e,t){var i=t?2:1;return wb?function(r,n){var a=Eb(arguments.length,1)>i,o=gb(r)?r:bb(r),s=a?yb(arguments,i):[],c=a?function(){mb(o,this,s)}:o;return t?e(c,n):e(c)}:e},Rb=Tb.setImmediate?Ab(Sb,!1):Sb;Ib({global:!0,bind:!0,enumerable:!0,forced:Tb.setImmediate!==Rb},{setImmediate:Rb});var kb=tg.charAt,Cb=hn,Db=ki,Ob=So,Lb=Ao,Nb="String Iterator",xb=Db.set,Pb=Db.getterFor(Nb);Ob(String,"String",(function(e){xb(this,{type:Nb,string:Cb(e),index:0})}),(function(){var e,t=Pb(this),i=t.string,r=t.index;return r>=i.length?Lb(void 0,!0):(e=kb(i,r),t.index+=e.length,Lb(e,!1))}));var Mb=n,Ub=a,Bb=tt("iterator"),Fb=!Mb((function(){var e=new URL("b?a=1&b=2&c=3","https://a"),t=e.searchParams,i=new URLSearchParams("a=1&a=2&b=3"),r="";return e.pathname="c%20d",t.forEach((function(e,i){t.delete("b"),r+=i+e})),i.delete("a",2),i.delete("b",void 0),!t.size&&!Ub||!t.sort||"https://a/c%20d?a=1&c=3"!==e.href||"3"!==t.get("c")||"a=1"!==String(new URLSearchParams("?a=1"))||!t[Bb]||"a"!==new URL("https://a@b").username||"b"!==new URLSearchParams(new URLSearchParams("a=b")).get("a")||"xn--e1aybc"!==new URL("https://тест").host||"#%D0%B1"!==new URL("https://a#б").hash||"a1c3"!==r||"x"!==new URL("https://x",void 0).host})),Vb=a,Hb=b,jb=l,zb=n,Wb=Bn,Gb=Ar,qb=d,Kb=Be,Yb=D,Xb=Object.assign,Zb=Object.defineProperty,Jb=Hb([].concat),Qb=!Xb||zb((function(){if(Vb&&1!==Xb({b:1},Xb(Zb({},"a",{enumerable:!0,get:function(){Zb(this,"b",{value:3,enumerable:!1})}}),{b:2})).b)return!0;var e={},t={},i=Symbol("assign detection"),r="abcdefghijklmnopqrst";return e[i]=7,r.split("").forEach((function(e){t[e]=e})),7!==Xb({},e)[i]||Wb(Xb({},t)).join("")!==r}))?function(e,t){for(var i=Kb(e),r=arguments.length,n=1,a=Gb.f,o=qb.f;r>n;)for(var s,c=Yb(arguments[n++]),l=a?Jb(Wb(c),a(c)):Wb(c),d=l.length,u=0;d>u;)s=l[u++],Vb&&!jb(o,c,s)||(i[s]=c[s]);return i}:Xb,$b=Nt,ew=Mh,tw=a,iw=kt,rw=g,nw=Yl,aw=l,ow=Be,sw=function(e,t,i,r){try{return r?t($b(i)[0],i[1]):t(i)}catch(RM){ew(e,"throw",RM)}},cw=yh,lw=Dl,dw=ur,uw=function(e,t,i){tw?iw.f(e,t,rw(0,i)):e[t]=i},hw=Lh,pw=Sh,fw=Array,mw=b,gw=2147483647,vw=/[^\0-\u007E]/,_w=/[.\u3002\uFF0E\uFF61]/g,yw="Overflow: input needs wider integers to process",Ew=RangeError,bw=mw(_w.exec),ww=Math.floor,Iw=String.fromCharCode,Tw=mw("".charCodeAt),Sw=mw([].join),Aw=mw([].push),Rw=mw("".replace),kw=mw("".split),Cw=mw("".toLowerCase),Dw=function(e){return e+22+75*(e<26)},Ow=function(e,t,i){var r=0;for(e=i?ww(e/700):e>>1,e+=ww(e/t);e>455;)e=ww(e/35),r+=36;return ww(r+36*e/(e+38))},Lw=function(e){var t=[];e=function(e){for(var t=[],i=0,r=e.length;i<r;){var n=Tw(e,i++);if(n>=55296&&n<=56319&&i<r){var a=Tw(e,i++);56320==(64512&a)?Aw(t,((1023&n)<<10)+(1023&a)+65536):(Aw(t,n),i--)}else Aw(t,n)}return t}(e);var i,r,n=e.length,a=128,o=0,s=72;for(i=0;i<e.length;i++)(r=e[i])<128&&Aw(t,Iw(r));var c=t.length,l=c;for(c&&Aw(t,"-");l<n;){var d=gw;for(i=0;i<e.length;i++)(r=e[i])>=a&&r<d&&(d=r);var u=l+1;if(d-a>ww((gw-o)/u))throw new Ew(yw);for(o+=(d-a)*u,a=d,i=0;i<e.length;i++){if((r=e[i])<a&&++o>gw)throw new Ew(yw);if(r===a){for(var h=o,p=36;;){var f=p<=s?1:p>=s+26?26:p-s;if(h<f)break;var m=h-f,g=36-f;Aw(t,Iw(Dw(f+m%g))),h=ww(m/g),p+=36}Aw(t,Iw(Dw(h))),s=Ow(o,u,l===c),o=0,l++}}o++,a++}return Sw(t,"")},Nw=en,xw=b,Pw=or,Mw=RangeError,Uw=String.fromCharCode,Bw=String.fromCodePoint,Fw=xw([].join);Nw({target:"String",stat:!0,arity:1,forced:!!Bw&&1!==Bw.length},{fromCodePoint:function(e){for(var t,i=[],r=arguments.length,n=0;r>n;){if(t=+arguments[n++],Pw(t,1114111)!==t)throw new Mw(t+" is not a valid code point");i[n]=t<65536?Uw(t):Uw(55296+((t-=65536)>>10),t%1024+56320)}return Fw(i,"")}});var Vw=en,Hw=i,jw=kd,zw=W,Ww=l,Gw=b,qw=a,Kw=Fb,Yw=Ji,Xw=mn,Zw=hs,Jw=Va,Qw=Ka,$w=ki,eI=ms,tI=F,iI=He,rI=Yl,nI=ln,aI=Nt,oI=H,sI=hn,cI=oa,lI=g,dI=Lh,uI=Sh,hI=Ao,pI=Zl,fI=cE,mI=tt("iterator"),gI="URLSearchParams",vI=gI+"Iterator",_I=$w.set,yI=$w.getterFor(gI),EI=$w.getterFor(vI),bI=jw("fetch"),wI=jw("Request"),II=jw("Headers"),TI=wI&&wI.prototype,SI=II&&II.prototype,AI=Hw.TypeError,RI=Hw.encodeURIComponent,kI=String.fromCharCode,CI=zw("String","fromCodePoint"),DI=parseInt,OI=Gw("".charAt),LI=Gw([].join),NI=Gw([].push),xI=Gw("".replace),PI=Gw([].shift),MI=Gw([].splice),UI=Gw("".split),BI=Gw("".slice),FI=Gw(/./.exec),VI=/\+/g,HI=/^[0-9a-f]+$/i,jI=function(e,t){var i=BI(e,t,t+2);return FI(HI,i)?DI(i,16):NaN},zI=function(e){for(var t=0,i=128;i>0&&e&i;i>>=1)t++;return t},WI=function(e){var t=null;switch(e.length){case 1:t=e[0];break;case 2:t=(31&e[0])<<6|63&e[1];break;case 3:t=(15&e[0])<<12|(63&e[1])<<6|63&e[2];break;case 4:t=(7&e[0])<<18|(63&e[1])<<12|(63&e[2])<<6|63&e[3]}return t>1114111?null:t},GI=function(e){for(var t=(e=xI(e,VI," ")).length,i="",r=0;r<t;){var n=OI(e,r);if("%"===n){if("%"===OI(e,r+1)||r+3>t){i+="%",r++;continue}var a=jI(e,r+1);if(a!=a){i+=n,r++;continue}r+=2;var o=zI(a);if(0===o)n=kI(a);else{if(1===o||o>4){i+="�",r++;continue}for(var s=[a],c=1;c<o&&!(++r+3>t||"%"!==OI(e,r));){var l=jI(e,r+1);if(l!=l){r+=3;break}if(l>191||l<128)break;NI(s,l),r+=2,c++}if(s.length!==o){i+="�";continue}var d=WI(s);null===d?i+="�":n=CI(d)}}i+=n,r++}return i},qI=/[!'()~]|%20/g,KI={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+"},YI=function(e){return KI[e]},XI=function(e){return xI(RI(e),qI,YI)},ZI=Qw((function(e,t){_I(this,{type:vI,target:yI(e).entries,index:0,kind:t})}),gI,(function(){var e=EI(this),t=e.target,i=e.index++;if(!t||i>=t.length)return e.target=null,hI(void 0,!0);var r=t[i];switch(e.kind){case"keys":return hI(r.key,!1);case"values":return hI(r.value,!1)}return hI([r.key,r.value],!1)}),!0),JI=function(e){this.entries=[],this.url=null,void 0!==e&&(oI(e)?this.parseObject(e):this.parseQuery("string"==typeof e?"?"===OI(e,0)?BI(e,1):e:sI(e)))};JI.prototype={type:gI,bindURL:function(e){this.url=e,this.update()},parseObject:function(e){var t,i,r,n,a,o,s,c=this.entries,l=uI(e);if(l)for(i=(t=dI(e,l)).next;!(r=Ww(i,t)).done;){if(a=(n=dI(aI(r.value))).next,(o=Ww(a,n)).done||(s=Ww(a,n)).done||!Ww(a,n).done)throw new AI("Expected sequence with length 2");NI(c,{key:sI(o.value),value:sI(s.value)})}else for(var d in e)iI(e,d)&&NI(c,{key:d,value:sI(e[d])})},parseQuery:function(e){if(e)for(var t,i,r=this.entries,n=UI(e,"&"),a=0;a<n.length;)(t=n[a++]).length&&(i=UI(t,"="),NI(r,{key:GI(PI(i)),value:GI(LI(i,"="))}))},serialize:function(){for(var e,t=this.entries,i=[],r=0;r<t.length;)e=t[r++],NI(i,XI(e.key)+"="+XI(e.value));return LI(i,"&")},update:function(){this.entries.length=0,this.parseQuery(this.url.query)},updateURL:function(){this.url&&this.url.update()}};var QI=function(){eI(this,$I);var e=_I(this,new JI(arguments.length>0?arguments[0]:void 0));qw||(this.size=e.entries.length)},$I=QI.prototype;if(Zw($I,{append:function(e,t){var i=yI(this);pI(arguments.length,2),NI(i.entries,{key:sI(e),value:sI(t)}),qw||this.length++,i.updateURL()},delete:function(e){for(var t=yI(this),i=pI(arguments.length,1),r=t.entries,n=sI(e),a=i<2?void 0:arguments[1],o=void 0===a?a:sI(a),s=0;s<r.length;){var c=r[s];if(c.key!==n||void 0!==o&&c.value!==o)s++;else if(MI(r,s,1),void 0!==o)break}qw||(this.size=r.length),t.updateURL()},get:function(e){var t=yI(this).entries;pI(arguments.length,1);for(var i=sI(e),r=0;r<t.length;r++)if(t[r].key===i)return t[r].value;return null},getAll:function(e){var t=yI(this).entries;pI(arguments.length,1);for(var i=sI(e),r=[],n=0;n<t.length;n++)t[n].key===i&&NI(r,t[n].value);return r},has:function(e){for(var t=yI(this).entries,i=pI(arguments.length,1),r=sI(e),n=i<2?void 0:arguments[1],a=void 0===n?n:sI(n),o=0;o<t.length;){var s=t[o++];if(s.key===r&&(void 0===a||s.value===a))return!0}return!1},set:function(e,t){var i=yI(this);pI(arguments.length,1);for(var r,n=i.entries,a=!1,o=sI(e),s=sI(t),c=0;c<n.length;c++)(r=n[c]).key===o&&(a?MI(n,c--,1):(a=!0,r.value=s));a||NI(n,{key:o,value:s}),qw||(this.size=n.length),i.updateURL()},sort:function(){var e=yI(this);fI(e.entries,(function(e,t){return e.key>t.key?1:-1})),e.updateURL()},forEach:function(e){for(var t,i=yI(this).entries,r=rI(e,arguments.length>1?arguments[1]:void 0),n=0;n<i.length;)r((t=i[n++]).value,t.key,this)},keys:function(){return new ZI(this,"keys")},values:function(){return new ZI(this,"values")},entries:function(){return new ZI(this,"entries")}},{enumerable:!0}),Yw($I,mI,$I.entries,{name:"entries"}),Yw($I,"toString",(function(){return yI(this).serialize()}),{enumerable:!0}),qw&&Xw($I,"size",{get:function(){return yI(this).entries.length},configurable:!0,enumerable:!0}),Jw(QI,gI),Vw({global:!0,constructor:!0,forced:!Kw},{URLSearchParams:QI}),!Kw&&tI(II)){var eT=Gw(SI.has),tT=Gw(SI.set),iT=function(e){if(oI(e)){var t,i=e.body;if(nI(i)===gI)return t=e.headers?new II(e.headers):new II,eT(t,"content-type")||tT(t,"content-type","application/x-www-form-urlencoded;charset=UTF-8"),cI(e,{body:lI(0,sI(i)),headers:lI(0,t)})}return e};if(tI(bI)&&Vw({global:!0,enumerable:!0,dontCallGetSet:!0,forced:!0},{fetch:function(e){return bI(e,arguments.length>1?iT(arguments[1]):{})}}),tI(wI)){var rT=function(e){return eI(this,TI),new wI(e,arguments.length>1?iT(arguments[1]):{})};TI.constructor=rT,rT.prototype=TI,Vw({global:!0,constructor:!0,dontCallGetSet:!0,forced:!0},{Request:rT})}}var nT,aT=en,oT=a,sT=Fb,cT=i,lT=Yl,dT=b,uT=Ji,hT=mn,pT=ms,fT=He,mT=Qb,gT=function(e){var t=ow(e),i=lw(this),r=arguments.length,n=r>1?arguments[1]:void 0,a=void 0!==n;a&&(n=nw(n,r>2?arguments[2]:void 0));var o,s,c,l,d,u,h=pw(t),p=0;if(!h||this===fw&&cw(h))for(o=dw(t),s=i?new this(o):fw(o);o>p;p++)u=a?n(t[p],p):t[p],uw(s,p,u);else for(s=i?new this:[],d=(l=hw(t,h)).next;!(c=aw(d,l)).done;p++)u=a?sw(l,n,[c.value,p],!0):c.value,uw(s,p,u);return s.length=p,s},vT=Bs,_T=tg.codeAt,yT=function(e){var t,i,r=[],n=kw(Rw(Cw(e),_w,"."),".");for(t=0;t<n.length;t++)i=n[t],Aw(r,bw(vw,i)?"xn--"+Lw(i):i);return Sw(r,".")},ET=hn,bT=Va,wT=Zl,IT={URLSearchParams:QI,getState:yI},TT=ki,ST=TT.set,AT=TT.getterFor("URL"),RT=IT.URLSearchParams,kT=IT.getState,CT=cT.URL,DT=cT.TypeError,OT=cT.parseInt,LT=Math.floor,NT=Math.pow,xT=dT("".charAt),PT=dT(/./.exec),MT=dT([].join),UT=dT(1..toString),BT=dT([].pop),FT=dT([].push),VT=dT("".replace),HT=dT([].shift),jT=dT("".split),zT=dT("".slice),WT=dT("".toLowerCase),GT=dT([].unshift),qT="Invalid scheme",KT="Invalid host",YT="Invalid port",XT=/[a-z]/i,ZT=/[\d+-.a-z]/i,JT=/\d/,QT=/^0x/i,$T=/^[0-7]+$/,eS=/^\d+$/,tS=/^[\da-f]+$/i,iS=/[\0\t\n\r #%/:<>?@[\\\]^|]/,rS=/[\0\t\n\r #/:<>?@[\\\]^|]/,nS=/^[\u0000-\u0020]+/,aS=/(^|[^\u0000-\u0020])[\u0000-\u0020]+$/,oS=/[\t\n\r]/g,sS=function(e){var t,i,r,n;if("number"==typeof e){for(t=[],i=0;i<4;i++)GT(t,e%256),e=LT(e/256);return MT(t,".")}if("object"==typeof e){for(t="",r=function(e){for(var t=null,i=1,r=null,n=0,a=0;a<8;a++)0!==e[a]?(n>i&&(t=r,i=n),r=null,n=0):(null===r&&(r=a),++n);return n>i?r:t}(e),i=0;i<8;i++)n&&0===e[i]||(n&&(n=!1),r===i?(t+=i?":":"::",n=!0):(t+=UT(e[i],16),i<7&&(t+=":")));return"["+t+"]"}return e},cS={},lS=mT({},cS,{" ":1,'"':1,"<":1,">":1,"`":1}),dS=mT({},lS,{"#":1,"?":1,"{":1,"}":1}),uS=mT({},dS,{"/":1,":":1,";":1,"=":1,"@":1,"[":1,"\\":1,"]":1,"^":1,"|":1}),hS=function(e,t){var i=_T(e,0);return i>32&&i<127&&!fT(t,e)?e:encodeURIComponent(e)},pS={ftp:21,file:null,http:80,https:443,ws:80,wss:443},fS=function(e,t){var i;return 2===e.length&&PT(XT,xT(e,0))&&(":"===(i=xT(e,1))||!t&&"|"===i)},mS=function(e){var t;return e.length>1&&fS(zT(e,0,2))&&(2===e.length||"/"===(t=xT(e,2))||"\\"===t||"?"===t||"#"===t)},gS=function(e){return"."===e||"%2e"===WT(e)},vS={},_S={},yS={},ES={},bS={},wS={},IS={},TS={},SS={},AS={},RS={},kS={},CS={},DS={},OS={},LS={},NS={},xS={},PS={},MS={},US={},BS=function(e,t,i){var r,n,a,o=ET(e);if(t){if(n=this.parse(o))throw new DT(n);this.searchParams=null}else{if(void 0!==i&&(r=new BS(i,!0)),n=this.parse(o,null,r))throw new DT(n);(a=kT(new RT)).bindURL(this),this.searchParams=a}};BS.prototype={type:"URL",parse:function(e,t,i){var r,n,a,o,s,c=this,l=t||vS,d=0,u="",h=!1,p=!1,f=!1;for(e=ET(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=VT(e,nS,""),e=VT(e,aS,"$1")),e=VT(e,oS,""),r=gT(e);d<=r.length;){switch(n=r[d],l){case vS:if(!n||!PT(XT,n)){if(t)return qT;l=yS;continue}u+=WT(n),l=_S;break;case _S:if(n&&(PT(ZT,n)||"+"===n||"-"===n||"."===n))u+=WT(n);else{if(":"!==n){if(t)return qT;u="",l=yS,d=0;continue}if(t&&(c.isSpecial()!==fT(pS,u)||"file"===u&&(c.includesCredentials()||null!==c.port)||"file"===c.scheme&&!c.host))return;if(c.scheme=u,t)return void(c.isSpecial()&&pS[c.scheme]===c.port&&(c.port=null));u="","file"===c.scheme?l=DS:c.isSpecial()&&i&&i.scheme===c.scheme?l=ES:c.isSpecial()?l=TS:"/"===r[d+1]?(l=bS,d++):(c.cannotBeABaseURL=!0,FT(c.path,""),l=PS)}break;case yS:if(!i||i.cannotBeABaseURL&&"#"!==n)return qT;if(i.cannotBeABaseURL&&"#"===n){c.scheme=i.scheme,c.path=vT(i.path),c.query=i.query,c.fragment="",c.cannotBeABaseURL=!0,l=US;break}l="file"===i.scheme?DS:wS;continue;case ES:if("/"!==n||"/"!==r[d+1]){l=wS;continue}l=SS,d++;break;case bS:if("/"===n){l=AS;break}l=xS;continue;case wS:if(c.scheme=i.scheme,n===nT)c.username=i.username,c.password=i.password,c.host=i.host,c.port=i.port,c.path=vT(i.path),c.query=i.query;else if("/"===n||"\\"===n&&c.isSpecial())l=IS;else if("?"===n)c.username=i.username,c.password=i.password,c.host=i.host,c.port=i.port,c.path=vT(i.path),c.query="",l=MS;else{if("#"!==n){c.username=i.username,c.password=i.password,c.host=i.host,c.port=i.port,c.path=vT(i.path),c.path.length--,l=xS;continue}c.username=i.username,c.password=i.password,c.host=i.host,c.port=i.port,c.path=vT(i.path),c.query=i.query,c.fragment="",l=US}break;case IS:if(!c.isSpecial()||"/"!==n&&"\\"!==n){if("/"!==n){c.username=i.username,c.password=i.password,c.host=i.host,c.port=i.port,l=xS;continue}l=AS}else l=SS;break;case TS:if(l=SS,"/"!==n||"/"!==xT(u,d+1))continue;d++;break;case SS:if("/"!==n&&"\\"!==n){l=AS;continue}break;case AS:if("@"===n){h&&(u="%40"+u),h=!0,a=gT(u);for(var m=0;m<a.length;m++){var g=a[m];if(":"!==g||f){var v=hS(g,uS);f?c.password+=v:c.username+=v}else f=!0}u=""}else if(n===nT||"/"===n||"?"===n||"#"===n||"\\"===n&&c.isSpecial()){if(h&&""===u)return"Invalid authority";d-=gT(u).length+1,u="",l=RS}else u+=n;break;case RS:case kS:if(t&&"file"===c.scheme){l=LS;continue}if(":"!==n||p){if(n===nT||"/"===n||"?"===n||"#"===n||"\\"===n&&c.isSpecial()){if(c.isSpecial()&&""===u)return KT;if(t&&""===u&&(c.includesCredentials()||null!==c.port))return;if(o=c.parseHost(u))return o;if(u="",l=NS,t)return;continue}"["===n?p=!0:"]"===n&&(p=!1),u+=n}else{if(""===u)return KT;if(o=c.parseHost(u))return o;if(u="",l=CS,t===kS)return}break;case CS:if(!PT(JT,n)){if(n===nT||"/"===n||"?"===n||"#"===n||"\\"===n&&c.isSpecial()||t){if(""!==u){var _=OT(u,10);if(_>65535)return YT;c.port=c.isSpecial()&&_===pS[c.scheme]?null:_,u=""}if(t)return;l=NS;continue}return YT}u+=n;break;case DS:if(c.scheme="file","/"===n||"\\"===n)l=OS;else{if(!i||"file"!==i.scheme){l=xS;continue}switch(n){case nT:c.host=i.host,c.path=vT(i.path),c.query=i.query;break;case"?":c.host=i.host,c.path=vT(i.path),c.query="",l=MS;break;case"#":c.host=i.host,c.path=vT(i.path),c.query=i.query,c.fragment="",l=US;break;default:mS(MT(vT(r,d),""))||(c.host=i.host,c.path=vT(i.path),c.shortenPath()),l=xS;continue}}break;case OS:if("/"===n||"\\"===n){l=LS;break}i&&"file"===i.scheme&&!mS(MT(vT(r,d),""))&&(fS(i.path[0],!0)?FT(c.path,i.path[0]):c.host=i.host),l=xS;continue;case LS:if(n===nT||"/"===n||"\\"===n||"?"===n||"#"===n){if(!t&&fS(u))l=xS;else if(""===u){if(c.host="",t)return;l=NS}else{if(o=c.parseHost(u))return o;if("localhost"===c.host&&(c.host=""),t)return;u="",l=NS}continue}u+=n;break;case NS:if(c.isSpecial()){if(l=xS,"/"!==n&&"\\"!==n)continue}else if(t||"?"!==n)if(t||"#"!==n){if(n!==nT&&(l=xS,"/"!==n))continue}else c.fragment="",l=US;else c.query="",l=MS;break;case xS:if(n===nT||"/"===n||"\\"===n&&c.isSpecial()||!t&&("?"===n||"#"===n)){if(".."===(s=WT(s=u))||"%2e."===s||".%2e"===s||"%2e%2e"===s?(c.shortenPath(),"/"===n||"\\"===n&&c.isSpecial()||FT(c.path,"")):gS(u)?"/"===n||"\\"===n&&c.isSpecial()||FT(c.path,""):("file"===c.scheme&&!c.path.length&&fS(u)&&(c.host&&(c.host=""),u=xT(u,0)+":"),FT(c.path,u)),u="","file"===c.scheme&&(n===nT||"?"===n||"#"===n))for(;c.path.length>1&&""===c.path[0];)HT(c.path);"?"===n?(c.query="",l=MS):"#"===n&&(c.fragment="",l=US)}else u+=hS(n,dS);break;case PS:"?"===n?(c.query="",l=MS):"#"===n?(c.fragment="",l=US):n!==nT&&(c.path[0]+=hS(n,cS));break;case MS:t||"#"!==n?n!==nT&&("'"===n&&c.isSpecial()?c.query+="%27":c.query+="#"===n?"%23":hS(n,cS)):(c.fragment="",l=US);break;case US:n!==nT&&(c.fragment+=hS(n,lS))}d++}},parseHost:function(e){var t,i,r;if("["===xT(e,0)){if("]"!==xT(e,e.length-1))return KT;if(t=function(e){var t,i,r,n,a,o,s,c=[0,0,0,0,0,0,0,0],l=0,d=null,u=0,h=function(){return xT(e,u)};if(":"===h()){if(":"!==xT(e,1))return;u+=2,d=++l}for(;h();){if(8===l)return;if(":"!==h()){for(t=i=0;i<4&&PT(tS,h());)t=16*t+OT(h(),16),u++,i++;if("."===h()){if(0===i)return;if(u-=i,l>6)return;for(r=0;h();){if(n=null,r>0){if(!("."===h()&&r<4))return;u++}if(!PT(JT,h()))return;for(;PT(JT,h());){if(a=OT(h(),10),null===n)n=a;else{if(0===n)return;n=10*n+a}if(n>255)return;u++}c[l]=256*c[l]+n,2!=++r&&4!==r||l++}if(4!==r)return;break}if(":"===h()){if(u++,!h())return}else if(h())return;c[l++]=t}else{if(null!==d)return;u++,d=++l}}if(null!==d)for(o=l-d,l=7;0!==l&&o>0;)s=c[l],c[l--]=c[d+o-1],c[d+--o]=s;else if(8!==l)return;return c}(zT(e,1,-1)),!t)return KT;this.host=t}else if(this.isSpecial()){if(e=yT(e),PT(iS,e))return KT;if(t=function(e){var t,i,r,n,a,o,s,c=jT(e,".");if(c.length&&""===c[c.length-1]&&c.length--,(t=c.length)>4)return e;for(i=[],r=0;r<t;r++){if(""===(n=c[r]))return e;if(a=10,n.length>1&&"0"===xT(n,0)&&(a=PT(QT,n)?16:8,n=zT(n,8===a?1:2)),""===n)o=0;else{if(!PT(10===a?eS:8===a?$T:tS,n))return e;o=OT(n,a)}FT(i,o)}for(r=0;r<t;r++)if(o=i[r],r===t-1){if(o>=NT(256,5-t))return null}else if(o>255)return null;for(s=BT(i),r=0;r<i.length;r++)s+=i[r]*NT(256,3-r);return s}(e),null===t)return KT;this.host=t}else{if(PT(rS,e))return KT;for(t="",i=gT(e),r=0;r<i.length;r++)t+=hS(i[r],cS);this.host=t}},cannotHaveUsernamePasswordPort:function(){return!this.host||this.cannotBeABaseURL||"file"===this.scheme},includesCredentials:function(){return""!==this.username||""!==this.password},isSpecial:function(){return fT(pS,this.scheme)},shortenPath:function(){var e=this.path,t=e.length;!t||"file"===this.scheme&&1===t&&fS(e[0],!0)||e.length--},serialize:function(){var e=this,t=e.scheme,i=e.username,r=e.password,n=e.host,a=e.port,o=e.path,s=e.query,c=e.fragment,l=t+":";return null!==n?(l+="//",e.includesCredentials()&&(l+=i+(r?":"+r:"")+"@"),l+=sS(n),null!==a&&(l+=":"+a)):"file"===t&&(l+="//"),l+=e.cannotBeABaseURL?o[0]:o.length?"/"+MT(o,"/"):"",null!==s&&(l+="?"+s),null!==c&&(l+="#"+c),l},setHref:function(e){var t=this.parse(e);if(t)throw new DT(t);this.searchParams.update()},getOrigin:function(){var e=this.scheme,t=this.port;if("blob"===e)try{return new FS(e.path[0]).origin}catch(RM){return"null"}return"file"!==e&&this.isSpecial()?e+"://"+sS(this.host)+(null!==t?":"+t:""):"null"},getProtocol:function(){return this.scheme+":"},setProtocol:function(e){this.parse(ET(e)+":",vS)},getUsername:function(){return this.username},setUsername:function(e){var t=gT(ET(e));if(!this.cannotHaveUsernamePasswordPort()){this.username="";for(var i=0;i<t.length;i++)this.username+=hS(t[i],uS)}},getPassword:function(){return this.password},setPassword:function(e){var t=gT(ET(e));if(!this.cannotHaveUsernamePasswordPort()){this.password="";for(var i=0;i<t.length;i++)this.password+=hS(t[i],uS)}},getHost:function(){var e=this.host,t=this.port;return null===e?"":null===t?sS(e):sS(e)+":"+t},setHost:function(e){this.cannotBeABaseURL||this.parse(e,RS)},getHostname:function(){var e=this.host;return null===e?"":sS(e)},setHostname:function(e){this.cannotBeABaseURL||this.parse(e,kS)},getPort:function(){var e=this.port;return null===e?"":ET(e)},setPort:function(e){this.cannotHaveUsernamePasswordPort()||(""===(e=ET(e))?this.port=null:this.parse(e,CS))},getPathname:function(){var e=this.path;return this.cannotBeABaseURL?e[0]:e.length?"/"+MT(e,"/"):""},setPathname:function(e){this.cannotBeABaseURL||(this.path=[],this.parse(e,NS))},getSearch:function(){var e=this.query;return e?"?"+e:""},setSearch:function(e){""===(e=ET(e))?this.query=null:("?"===xT(e,0)&&(e=zT(e,1)),this.query="",this.parse(e,MS)),this.searchParams.update()},getSearchParams:function(){return this.searchParams.facade},getHash:function(){var e=this.fragment;return e?"#"+e:""},setHash:function(e){""!==(e=ET(e))?("#"===xT(e,0)&&(e=zT(e,1)),this.fragment="",this.parse(e,US)):this.fragment=null},update:function(){this.query=this.searchParams.serialize()||null}};var FS=function(e){var t=pT(this,VS),i=wT(arguments.length,1)>1?arguments[1]:void 0,r=ST(t,new BS(e,!1,i));oT||(t.href=r.serialize(),t.origin=r.getOrigin(),t.protocol=r.getProtocol(),t.username=r.getUsername(),t.password=r.getPassword(),t.host=r.getHost(),t.hostname=r.getHostname(),t.port=r.getPort(),t.pathname=r.getPathname(),t.search=r.getSearch(),t.searchParams=r.getSearchParams(),t.hash=r.getHash())},VS=FS.prototype,HS=function(e,t){return{get:function(){return AT(this)[e]()},set:t&&function(e){return AT(this)[t](e)},configurable:!0,enumerable:!0}};if(oT&&(hT(VS,"href",HS("serialize","setHref")),hT(VS,"origin",HS("getOrigin")),hT(VS,"protocol",HS("getProtocol","setProtocol")),hT(VS,"username",HS("getUsername","setUsername")),hT(VS,"password",HS("getPassword","setPassword")),hT(VS,"host",HS("getHost","setHost")),hT(VS,"hostname",HS("getHostname","setHostname")),hT(VS,"port",HS("getPort","setPort")),hT(VS,"pathname",HS("getPathname","setPathname")),hT(VS,"search",HS("getSearch","setSearch")),hT(VS,"searchParams",HS("getSearchParams")),hT(VS,"hash",HS("getHash","setHash"))),uT(VS,"toJSON",(function(){return AT(this).serialize()}),{enumerable:!0}),uT(VS,"toString",(function(){return AT(this).serialize()}),{enumerable:!0}),CT){var jS=CT.createObjectURL,zS=CT.revokeObjectURL;jS&&uT(FS,"createObjectURL",lT(jS,CT)),zS&&uT(FS,"revokeObjectURL",lT(zS,CT))}bT(FS,"URL"),aT({global:!0,constructor:!0,forced:!sT,sham:!oT},{URL:FS});var WS=l;en({target:"URL",proto:!0,enumerable:!0},{toJSON:function(){return WS(URL.prototype.toString,this)}});var GS,qS,KS=Object.create,YS=Object.defineProperty,XS=Object.defineProperties,ZS=Object.getOwnPropertyDescriptor,JS=Object.getOwnPropertyDescriptors,QS=Object.getOwnPropertyNames,$S=Object.getOwnPropertySymbols,eA=Object.getPrototypeOf,tA=Object.prototype.hasOwnProperty,iA=Object.prototype.propertyIsEnumerable,rA=(e,t,i)=>t in e?YS(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i,nA=(e,t)=>{for(var i in t||(t={}))tA.call(t,i)&&rA(e,i,t[i]);if($S)for(var i of $S(t))iA.call(t,i)&&rA(e,i,t[i]);return e},aA=(e,t)=>XS(e,JS(t)),oA=(GS=function(e){if("undefined"!=typeof require)return require.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')},"undefined"!=typeof require?require:"undefined"!=typeof Proxy?new Proxy(GS,{get:(e,t)=>("undefined"!=typeof require?require:e)[t]}):GS),sA=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),cA=(e,t)=>{for(var i in t)YS(e,i,{get:t[i],enumerable:!0})},lA=(e,t,i)=>(i=null!=e?KS(eA(e)):{},((e,t,i,r)=>{if(t&&"object"==typeof t||"function"==typeof t)for(let n of QS(t))!tA.call(e,n)&&n!==i&&YS(e,n,{get:()=>t[n],enumerable:!(r=ZS(t,n))||r.enumerable});return e})(!t&&e&&e.__esModule?i:YS(i,"default",{value:e,enumerable:!0}),e)),dA=(e,t,i,r)=>{for(var n,a=r>1?void 0:r?ZS(t,i):t,o=e.length-1;o>=0;o--)(n=e[o])&&(a=(r?n(t,i,a):n(a))||a);return r&&a&&YS(t,i,a),a},uA=(e,t,i)=>rA(e,"symbol"!=typeof t?t+"":t,i),hA=sA(((e,t)=>{!function(i){"object"==typeof e&&void 0!==t?t.exports=i():"function"==typeof define&&define.amd?define([],i):("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).JSZip=i()}((function(){return function e(t,i,r){function n(o,s){if(!i[o]){if(!t[o]){var c="function"==typeof oA&&oA;if(!s&&c)return c(o,!0);if(a)return a(o,!0);var l=new Error("Cannot find module '"+o+"'");throw l.code="MODULE_NOT_FOUND",l}var d=i[o]={exports:{}};t[o][0].call(d.exports,(function(e){return n(t[o][1][e]||e)}),d,d.exports,e,t,i,r)}return i[o].exports}for(var a="function"==typeof oA&&oA,o=0;o<r.length;o++)n(r[o]);return n}({1:[function(e,t,i){var r=e("./utils"),n=e("./support"),a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";i.encode=function(e){for(var t,i,n,o,s,c,l,d=[],u=0,h=e.length,p=h,f="string"!==r.getTypeOf(e);u<e.length;)p=h-u,n=f?(t=e[u++],i=u<h?e[u++]:0,u<h?e[u++]:0):(t=e.charCodeAt(u++),i=u<h?e.charCodeAt(u++):0,u<h?e.charCodeAt(u++):0),o=t>>2,s=(3&t)<<4|i>>4,c=1<p?(15&i)<<2|n>>6:64,l=2<p?63&n:64,d.push(a.charAt(o)+a.charAt(s)+a.charAt(c)+a.charAt(l));return d.join("")},i.decode=function(e){var t,i,r,o,s,c,l=0,d=0,u="data:";if(e.substr(0,5)===u)throw new Error("Invalid base64 input, it looks like a data url.");var h,p=3*(e=e.replace(/[^A-Za-z0-9+/=]/g,"")).length/4;if(e.charAt(e.length-1)===a.charAt(64)&&p--,e.charAt(e.length-2)===a.charAt(64)&&p--,p%1!=0)throw new Error("Invalid base64 input, bad content length.");for(h=n.uint8array?new Uint8Array(0|p):new Array(0|p);l<e.length;)t=a.indexOf(e.charAt(l++))<<2|(o=a.indexOf(e.charAt(l++)))>>4,i=(15&o)<<4|(s=a.indexOf(e.charAt(l++)))>>2,r=(3&s)<<6|(c=a.indexOf(e.charAt(l++))),h[d++]=t,64!==s&&(h[d++]=i),64!==c&&(h[d++]=r);return h}},{"./support":30,"./utils":32}],2:[function(e,t,i){var r=e("./external"),n=e("./stream/DataWorker"),a=e("./stream/Crc32Probe"),o=e("./stream/DataLengthProbe");function s(e,t,i,r,n){this.compressedSize=e,this.uncompressedSize=t,this.crc32=i,this.compression=r,this.compressedContent=n}s.prototype={getContentWorker:function(){var e=new n(r.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new o("data_length")),t=this;return e.on("end",(function(){if(this.streamInfo.data_length!==t.uncompressedSize)throw new Error("Bug : uncompressed data size mismatch")})),e},getCompressedWorker:function(){return new n(r.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize",this.compressedSize).withStreamInfo("uncompressedSize",this.uncompressedSize).withStreamInfo("crc32",this.crc32).withStreamInfo("compression",this.compression)}},s.createWorkerFrom=function(e,t,i){return e.pipe(new a).pipe(new o("uncompressedSize")).pipe(t.compressWorker(i)).pipe(new o("compressedSize")).withStreamInfo("compression",t)},t.exports=s},{"./external":6,"./stream/Crc32Probe":25,"./stream/DataLengthProbe":26,"./stream/DataWorker":27}],3:[function(e,t,i){var r=e("./stream/GenericWorker");i.STORE={magic:"\0\0",compressWorker:function(){return new r("STORE compression")},uncompressWorker:function(){return new r("STORE decompression")}},i.DEFLATE=e("./flate")},{"./flate":7,"./stream/GenericWorker":28}],4:[function(e,t,i){var r=e("./utils"),n=function(){for(var e,t=[],i=0;i<256;i++){e=i;for(var r=0;r<8;r++)e=1&e?3988292384^e>>>1:e>>>1;t[i]=e}return t}();t.exports=function(e,t){return void 0!==e&&e.length?"string"!==r.getTypeOf(e)?function(e,t,i){var r=n,a=0+i;e^=-1;for(var o=0;o<a;o++)e=e>>>8^r[255&(e^t[o])];return~e}(0|t,e,e.length):function(e,t,i){var r=n,a=0+i;e^=-1;for(var o=0;o<a;o++)e=e>>>8^r[255&(e^t.charCodeAt(o))];return~e}(0|t,e,e.length):0}},{"./utils":32}],5:[function(e,t,i){i.base64=!1,i.binary=!1,i.dir=!1,i.createFolders=!0,i.date=null,i.compression=null,i.compressionOptions=null,i.comment=null,i.unixPermissions=null,i.dosPermissions=null},{}],6:[function(e,t,i){var r;r="undefined"!=typeof Promise?Promise:e("lie"),t.exports={Promise:r}},{lie:37}],7:[function(e,t,i){var r="undefined"!=typeof Uint8Array&&"undefined"!=typeof Uint16Array&&"undefined"!=typeof Uint32Array,n=e("pako"),a=e("./utils"),o=e("./stream/GenericWorker"),s=r?"uint8array":"array";function c(e,t){o.call(this,"FlateWorker/"+e),this._pako=null,this._pakoAction=e,this._pakoOptions=t,this.meta={}}i.magic="\b\0",a.inherits(c,o),c.prototype.processChunk=function(e){this.meta=e.meta,null===this._pako&&this._createPako(),this._pako.push(a.transformTo(s,e.data),!1)},c.prototype.flush=function(){o.prototype.flush.call(this),null===this._pako&&this._createPako(),this._pako.push([],!0)},c.prototype.cleanUp=function(){o.prototype.cleanUp.call(this),this._pako=null},c.prototype._createPako=function(){this._pako=new n[this._pakoAction]({raw:!0,level:this._pakoOptions.level||-1});var e=this;this._pako.onData=function(t){e.push({data:t,meta:e.meta})}},i.compressWorker=function(e){return new c("Deflate",e)},i.uncompressWorker=function(){return new c("Inflate",{})}},{"./stream/GenericWorker":28,"./utils":32,pako:38}],8:[function(e,t,i){function r(e,t){var i,r="";for(i=0;i<t;i++)r+=String.fromCharCode(255&e),e>>>=8;return r}function n(e,t,i,n,o,d){var u,h,p=e.file,f=e.compression,m=d!==s.utf8encode,g=a.transformTo("string",d(p.name)),v=a.transformTo("string",s.utf8encode(p.name)),_=p.comment,y=a.transformTo("string",d(_)),E=a.transformTo("string",s.utf8encode(_)),b=v.length!==p.name.length,w=E.length!==_.length,I="",T="",S="",A=p.dir,R=p.date,k={crc32:0,compressedSize:0,uncompressedSize:0};t&&!i||(k.crc32=e.crc32,k.compressedSize=e.compressedSize,k.uncompressedSize=e.uncompressedSize);var C=0;t&&(C|=8),m||!b&&!w||(C|=2048);var D,O,L,N=0,x=0;A&&(N|=16),"UNIX"===o?(x=798,N|=(D=p.unixPermissions,O=A,L=D,D||(L=O?16893:33204),(65535&L)<<16)):(x=20,N|=function(e){return 63&(e||0)}(p.dosPermissions)),u=R.getUTCHours(),u<<=6,u|=R.getUTCMinutes(),u<<=5,u|=R.getUTCSeconds()/2,h=R.getUTCFullYear()-1980,h<<=4,h|=R.getUTCMonth()+1,h<<=5,h|=R.getUTCDate(),b&&(T=r(1,1)+r(c(g),4)+v,I+="up"+r(T.length,2)+T),w&&(S=r(1,1)+r(c(y),4)+E,I+="uc"+r(S.length,2)+S);var P="";return P+="\n\0",P+=r(C,2),P+=f.magic,P+=r(u,2),P+=r(h,2),P+=r(k.crc32,4),P+=r(k.compressedSize,4),P+=r(k.uncompressedSize,4),P+=r(g.length,2),P+=r(I.length,2),{fileRecord:l.LOCAL_FILE_HEADER+P+g+I,dirRecord:l.CENTRAL_FILE_HEADER+r(x,2)+P+r(y.length,2)+"\0\0\0\0"+r(N,4)+r(n,4)+g+I+y}}var a=e("../utils"),o=e("../stream/GenericWorker"),s=e("../utf8"),c=e("../crc32"),l=e("../signature");function d(e,t,i,r){o.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=t,this.zipPlatform=i,this.encodeFileName=r,this.streamFiles=e,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}a.inherits(d,o),d.prototype.push=function(e){var t=e.meta.percent||0,i=this.entriesCount,r=this._sources.length;this.accumulate?this.contentBuffer.push(e):(this.bytesWritten+=e.data.length,o.prototype.push.call(this,{data:e.data,meta:{currentFile:this.currentFile,percent:i?(t+100*(i-r-1))/i:100}}))},d.prototype.openedSource=function(e){this.currentSourceOffset=this.bytesWritten,this.currentFile=e.file.name;var t=this.streamFiles&&!e.file.dir;if(t){var i=n(e,t,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:i.fileRecord,meta:{percent:0}})}else this.accumulate=!0},d.prototype.closedSource=function(e){this.accumulate=!1;var t,i=this.streamFiles&&!e.file.dir,a=n(e,i,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(a.dirRecord),i)this.push({data:(t=e,l.DATA_DESCRIPTOR+r(t.crc32,4)+r(t.compressedSize,4)+r(t.uncompressedSize,4)),meta:{percent:100}});else for(this.push({data:a.fileRecord,meta:{percent:0}});this.contentBuffer.length;)this.push(this.contentBuffer.shift());this.currentFile=null},d.prototype.flush=function(){for(var e=this.bytesWritten,t=0;t<this.dirRecords.length;t++)this.push({data:this.dirRecords[t],meta:{percent:100}});var i,n,o,s,c,d,u=this.bytesWritten-e,h=(i=this.dirRecords.length,n=u,o=e,s=this.zipComment,c=this.encodeFileName,d=a.transformTo("string",c(s)),l.CENTRAL_DIRECTORY_END+"\0\0\0\0"+r(i,2)+r(i,2)+r(n,4)+r(o,4)+r(d.length,2)+d);this.push({data:h,meta:{percent:100}})},d.prototype.prepareNextSource=function(){this.previous=this._sources.shift(),this.openedSource(this.previous.streamInfo),this.isPaused?this.previous.pause():this.previous.resume()},d.prototype.registerPrevious=function(e){this._sources.push(e);var t=this;return e.on("data",(function(e){t.processChunk(e)})),e.on("end",(function(){t.closedSource(t.previous.streamInfo),t._sources.length?t.prepareNextSource():t.end()})),e.on("error",(function(e){t.error(e)})),this},d.prototype.resume=function(){return!!o.prototype.resume.call(this)&&(!this.previous&&this._sources.length?(this.prepareNextSource(),!0):this.previous||this._sources.length||this.generatedError?void 0:(this.end(),!0))},d.prototype.error=function(e){var t=this._sources;if(!o.prototype.error.call(this,e))return!1;for(var i=0;i<t.length;i++)try{t[i].error(e)}catch(r){}return!0},d.prototype.lock=function(){o.prototype.lock.call(this);for(var e=this._sources,t=0;t<e.length;t++)e[t].lock()},t.exports=d},{"../crc32":4,"../signature":23,"../stream/GenericWorker":28,"../utf8":31,"../utils":32}],9:[function(e,t,i){var r=e("../compressions"),n=e("./ZipFileWorker");i.generateWorker=function(e,t,i){var a=new n(t.streamFiles,i,t.platform,t.encodeFileName),o=0;try{e.forEach((function(e,i){o++;var n=function(e,t){var i=e||t,n=r[i];if(!n)throw new Error(i+" is not a valid compression method !");return n}(i.options.compression,t.compression),s=i.options.compressionOptions||t.compressionOptions||{},c=i.dir,l=i.date;i._compressWorker(n,s).withStreamInfo("file",{name:e,dir:c,date:l,comment:i.comment||"",unixPermissions:i.unixPermissions,dosPermissions:i.dosPermissions}).pipe(a)})),a.entriesCount=o}catch(s){a.error(s)}return a}},{"../compressions":3,"./ZipFileWorker":8}],10:[function(e,t,i){function r(){if(!(this instanceof r))return new r;if(arguments.length)throw new Error("The constructor with parameters has been removed in JSZip 3.0, please check the upgrade guide.");this.files=Object.create(null),this.comment=null,this.root="",this.clone=function(){var e=new r;for(var t in this)"function"!=typeof this[t]&&(e[t]=this[t]);return e}}(r.prototype=e("./object")).loadAsync=e("./load"),r.support=e("./support"),r.defaults=e("./defaults"),r.version="3.10.1",r.loadAsync=function(e,t){return(new r).loadAsync(e,t)},r.external=e("./external"),t.exports=r},{"./defaults":5,"./external":6,"./load":11,"./object":15,"./support":30}],11:[function(e,t,i){var r=e("./utils"),n=e("./external"),a=e("./utf8"),o=e("./zipEntries"),s=e("./stream/Crc32Probe"),c=e("./nodejsUtils");function l(e){return new n.Promise((function(t,i){var r=e.decompressed.getContentWorker().pipe(new s);r.on("error",(function(e){i(e)})).on("end",(function(){r.streamInfo.crc32!==e.decompressed.crc32?i(new Error("Corrupted zip : CRC32 mismatch")):t()})).resume()}))}t.exports=function(e,t){var i=this;return t=r.extend(t||{},{base64:!1,checkCRC32:!1,optimizedBinaryString:!1,createFolders:!1,decodeFileName:a.utf8decode}),c.isNode&&c.isStream(e)?n.Promise.reject(new Error("JSZip can't accept a stream when loading a zip file.")):r.prepareContent("the loaded zip file",e,!0,t.optimizedBinaryString,t.base64).then((function(e){var i=new o(t);return i.load(e),i})).then((function(e){var i=[n.Promise.resolve(e)],r=e.files;if(t.checkCRC32)for(var a=0;a<r.length;a++)i.push(l(r[a]));return n.Promise.all(i)})).then((function(e){for(var n=e.shift(),a=n.files,o=0;o<a.length;o++){var s=a[o],c=s.fileNameStr,l=r.resolve(s.fileNameStr);i.file(l,s.decompressed,{binary:!0,optimizedBinaryString:!0,date:s.date,dir:s.dir,comment:s.fileCommentStr.length?s.fileCommentStr:null,unixPermissions:s.unixPermissions,dosPermissions:s.dosPermissions,createFolders:t.createFolders}),s.dir||(i.file(l).unsafeOriginalName=c)}return n.zipComment.length&&(i.comment=n.zipComment),i}))}},{"./external":6,"./nodejsUtils":14,"./stream/Crc32Probe":25,"./utf8":31,"./utils":32,"./zipEntries":33}],12:[function(e,t,i){var r=e("../utils"),n=e("../stream/GenericWorker");function a(e,t){n.call(this,"Nodejs stream input adapter for "+e),this._upstreamEnded=!1,this._bindStream(t)}r.inherits(a,n),a.prototype._bindStream=function(e){var t=this;(this._stream=e).pause(),e.on("data",(function(e){t.push({data:e,meta:{percent:0}})})).on("error",(function(e){t.isPaused?this.generatedError=e:t.error(e)})).on("end",(function(){t.isPaused?t._upstreamEnded=!0:t.end()}))},a.prototype.pause=function(){return!!n.prototype.pause.call(this)&&(this._stream.pause(),!0)},a.prototype.resume=function(){return!!n.prototype.resume.call(this)&&(this._upstreamEnded?this.end():this._stream.resume(),!0)},t.exports=a},{"../stream/GenericWorker":28,"../utils":32}],13:[function(e,t,i){var r=e("readable-stream").Readable;function n(e,t,i){r.call(this,t),this._helper=e;var n=this;e.on("data",(function(e,t){n.push(e)||n._helper.pause(),i&&i(t)})).on("error",(function(e){n.emit("error",e)})).on("end",(function(){n.push(null)}))}e("../utils").inherits(n,r),n.prototype._read=function(){this._helper.resume()},t.exports=n},{"../utils":32,"readable-stream":16}],14:[function(e,t,i){t.exports={isNode:"undefined"!=typeof Buffer,newBufferFrom:function(e,t){if(Buffer.from&&Buffer.from!==Uint8Array.from)return Buffer.from(e,t);if("number"==typeof e)throw new Error('The "data" argument must not be a number');return new Buffer(e,t)},allocBuffer:function(e){if(Buffer.alloc)return Buffer.alloc(e);var t=new Buffer(e);return t.fill(0),t},isBuffer:function(e){return Buffer.isBuffer(e)},isStream:function(e){return e&&"function"==typeof e.on&&"function"==typeof e.pause&&"function"==typeof e.resume}}},{}],15:[function(e,t,i){function r(e,t,i){var r,n=a.getTypeOf(t),s=a.extend(i||{},c);s.date=s.date||new Date,null!==s.compression&&(s.compression=s.compression.toUpperCase()),"string"==typeof s.unixPermissions&&(s.unixPermissions=parseInt(s.unixPermissions,8)),s.unixPermissions&&16384&s.unixPermissions&&(s.dir=!0),s.dosPermissions&&16&s.dosPermissions&&(s.dir=!0),s.dir&&(e=m(e)),s.createFolders&&(r=f(e))&&g.call(this,r,!0);var u="string"===n&&!1===s.binary&&!1===s.base64;i&&void 0!==i.binary||(s.binary=!u),(t instanceof l&&0===t.uncompressedSize||s.dir||!t||0===t.length)&&(s.base64=!1,s.binary=!0,t="",s.compression="STORE",n="string");var v;v=t instanceof l||t instanceof o?t:h.isNode&&h.isStream(t)?new p(e,t):a.prepareContent(e,t,s.binary,s.optimizedBinaryString,s.base64);var _=new d(e,v,s);this.files[e]=_}var n=e("./utf8"),a=e("./utils"),o=e("./stream/GenericWorker"),s=e("./stream/StreamHelper"),c=e("./defaults"),l=e("./compressedObject"),d=e("./zipObject"),u=e("./generate"),h=e("./nodejsUtils"),p=e("./nodejs/NodejsStreamInputAdapter"),f=function(e){"/"===e.slice(-1)&&(e=e.substring(0,e.length-1));var t=e.lastIndexOf("/");return 0<t?e.substring(0,t):""},m=function(e){return"/"!==e.slice(-1)&&(e+="/"),e},g=function(e,t){return t=void 0!==t?t:c.createFolders,e=m(e),this.files[e]||r.call(this,e,null,{dir:!0,createFolders:t}),this.files[e]};function v(e){return"[object RegExp]"===Object.prototype.toString.call(e)}var _={load:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},forEach:function(e){var t,i,r;for(t in this.files)r=this.files[t],(i=t.slice(this.root.length,t.length))&&t.slice(0,this.root.length)===this.root&&e(i,r)},filter:function(e){var t=[];return this.forEach((function(i,r){e(i,r)&&t.push(r)})),t},file:function(e,t,i){if(1!==arguments.length)return e=this.root+e,r.call(this,e,t,i),this;if(v(e)){var n=e;return this.filter((function(e,t){return!t.dir&&n.test(e)}))}var a=this.files[this.root+e];return a&&!a.dir?a:null},folder:function(e){if(!e)return this;if(v(e))return this.filter((function(t,i){return i.dir&&e.test(t)}));var t=this.root+e,i=g.call(this,t),r=this.clone();return r.root=i.name,r},remove:function(e){e=this.root+e;var t=this.files[e];if(t||("/"!==e.slice(-1)&&(e+="/"),t=this.files[e]),t&&!t.dir)delete this.files[e];else for(var i=this.filter((function(t,i){return i.name.slice(0,e.length)===e})),r=0;r<i.length;r++)delete this.files[i[r].name];return this},generate:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},generateInternalStream:function(e){var t,i={};try{if((i=a.extend(e||{},{streamFiles:!1,compression:"STORE",compressionOptions:null,type:"",platform:"DOS",comment:null,mimeType:"application/zip",encodeFileName:n.utf8encode})).type=i.type.toLowerCase(),i.compression=i.compression.toUpperCase(),"binarystring"===i.type&&(i.type="string"),!i.type)throw new Error("No output type specified.");a.checkSupport(i.type),"darwin"!==i.platform&&"freebsd"!==i.platform&&"linux"!==i.platform&&"sunos"!==i.platform||(i.platform="UNIX"),"win32"===i.platform&&(i.platform="DOS");var r=i.comment||this.comment||"";t=u.generateWorker(this,i,r)}catch(c){(t=new o("error")).error(c)}return new s(t,i.type||"string",i.mimeType)},generateAsync:function(e,t){return this.generateInternalStream(e).accumulate(t)},generateNodeStream:function(e,t){return(e=e||{}).type||(e.type="nodebuffer"),this.generateInternalStream(e).toNodejsStream(t)}};t.exports=_},{"./compressedObject":2,"./defaults":5,"./generate":9,"./nodejs/NodejsStreamInputAdapter":12,"./nodejsUtils":14,"./stream/GenericWorker":28,"./stream/StreamHelper":29,"./utf8":31,"./utils":32,"./zipObject":35}],16:[function(e,t,i){t.exports=e("stream")},{stream:void 0}],17:[function(e,t,i){var r=e("./DataReader");function n(e){r.call(this,e);for(var t=0;t<this.data.length;t++)e[t]=255&e[t]}e("../utils").inherits(n,r),n.prototype.byteAt=function(e){return this.data[this.zero+e]},n.prototype.lastIndexOfSignature=function(e){for(var t=e.charCodeAt(0),i=e.charCodeAt(1),r=e.charCodeAt(2),n=e.charCodeAt(3),a=this.length-4;0<=a;--a)if(this.data[a]===t&&this.data[a+1]===i&&this.data[a+2]===r&&this.data[a+3]===n)return a-this.zero;return-1},n.prototype.readAndCheckSignature=function(e){var t=e.charCodeAt(0),i=e.charCodeAt(1),r=e.charCodeAt(2),n=e.charCodeAt(3),a=this.readData(4);return t===a[0]&&i===a[1]&&r===a[2]&&n===a[3]},n.prototype.readData=function(e){if(this.checkOffset(e),0===e)return[];var t=this.data.slice(this.zero+this.index,this.zero+this.index+e);return this.index+=e,t},t.exports=n},{"../utils":32,"./DataReader":18}],18:[function(e,t,i){var r=e("../utils");function n(e){this.data=e,this.length=e.length,this.index=0,this.zero=0}n.prototype={checkOffset:function(e){this.checkIndex(this.index+e)},checkIndex:function(e){if(this.length<this.zero+e||e<0)throw new Error("End of data reached (data length = "+this.length+", asked index = "+e+"). Corrupted zip ?")},setIndex:function(e){this.checkIndex(e),this.index=e},skip:function(e){this.setIndex(this.index+e)},byteAt:function(){},readInt:function(e){var t,i=0;for(this.checkOffset(e),t=this.index+e-1;t>=this.index;t--)i=(i<<8)+this.byteAt(t);return this.index+=e,i},readString:function(e){return r.transformTo("string",this.readData(e))},readData:function(){},lastIndexOfSignature:function(){},readAndCheckSignature:function(){},readDate:function(){var e=this.readInt(4);return new Date(Date.UTC(1980+(e>>25&127),(e>>21&15)-1,e>>16&31,e>>11&31,e>>5&63,(31&e)<<1))}},t.exports=n},{"../utils":32}],19:[function(e,t,i){var r=e("./Uint8ArrayReader");function n(e){r.call(this,e)}e("../utils").inherits(n,r),n.prototype.readData=function(e){this.checkOffset(e);var t=this.data.slice(this.zero+this.index,this.zero+this.index+e);return this.index+=e,t},t.exports=n},{"../utils":32,"./Uint8ArrayReader":21}],20:[function(e,t,i){var r=e("./DataReader");function n(e){r.call(this,e)}e("../utils").inherits(n,r),n.prototype.byteAt=function(e){return this.data.charCodeAt(this.zero+e)},n.prototype.lastIndexOfSignature=function(e){return this.data.lastIndexOf(e)-this.zero},n.prototype.readAndCheckSignature=function(e){return e===this.readData(4)},n.prototype.readData=function(e){this.checkOffset(e);var t=this.data.slice(this.zero+this.index,this.zero+this.index+e);return this.index+=e,t},t.exports=n},{"../utils":32,"./DataReader":18}],21:[function(e,t,i){var r=e("./ArrayReader");function n(e){r.call(this,e)}e("../utils").inherits(n,r),n.prototype.readData=function(e){if(this.checkOffset(e),0===e)return new Uint8Array(0);var t=this.data.subarray(this.zero+this.index,this.zero+this.index+e);return this.index+=e,t},t.exports=n},{"../utils":32,"./ArrayReader":17}],22:[function(e,t,i){var r=e("../utils"),n=e("../support"),a=e("./ArrayReader"),o=e("./StringReader"),s=e("./NodeBufferReader"),c=e("./Uint8ArrayReader");t.exports=function(e){var t=r.getTypeOf(e);return r.checkSupport(t),"string"!==t||n.uint8array?"nodebuffer"===t?new s(e):n.uint8array?new c(r.transformTo("uint8array",e)):new a(r.transformTo("array",e)):new o(e)}},{"../support":30,"../utils":32,"./ArrayReader":17,"./NodeBufferReader":19,"./StringReader":20,"./Uint8ArrayReader":21}],23:[function(e,t,i){i.LOCAL_FILE_HEADER="PK",i.CENTRAL_FILE_HEADER="PK",i.CENTRAL_DIRECTORY_END="PK",i.ZIP64_CENTRAL_DIRECTORY_LOCATOR="PK",i.ZIP64_CENTRAL_DIRECTORY_END="PK",i.DATA_DESCRIPTOR="PK\b"},{}],24:[function(e,t,i){var r=e("./GenericWorker"),n=e("../utils");function a(e){r.call(this,"ConvertWorker to "+e),this.destType=e}n.inherits(a,r),a.prototype.processChunk=function(e){this.push({data:n.transformTo(this.destType,e.data),meta:e.meta})},t.exports=a},{"../utils":32,"./GenericWorker":28}],25:[function(e,t,i){var r=e("./GenericWorker"),n=e("../crc32");function a(){r.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}e("../utils").inherits(a,r),a.prototype.processChunk=function(e){this.streamInfo.crc32=n(e.data,this.streamInfo.crc32||0),this.push(e)},t.exports=a},{"../crc32":4,"../utils":32,"./GenericWorker":28}],26:[function(e,t,i){var r=e("../utils"),n=e("./GenericWorker");function a(e){n.call(this,"DataLengthProbe for "+e),this.propName=e,this.withStreamInfo(e,0)}r.inherits(a,n),a.prototype.processChunk=function(e){if(e){var t=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=t+e.data.length}n.prototype.processChunk.call(this,e)},t.exports=a},{"../utils":32,"./GenericWorker":28}],27:[function(e,t,i){var r=e("../utils"),n=e("./GenericWorker");function a(e){n.call(this,"DataWorker");var t=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type="",this._tickScheduled=!1,e.then((function(e){t.dataIsReady=!0,t.data=e,t.max=e&&e.length||0,t.type=r.getTypeOf(e),t.isPaused||t._tickAndRepeat()}),(function(e){t.error(e)}))}r.inherits(a,n),a.prototype.cleanUp=function(){n.prototype.cleanUp.call(this),this.data=null},a.prototype.resume=function(){return!!n.prototype.resume.call(this)&&(!this._tickScheduled&&this.dataIsReady&&(this._tickScheduled=!0,r.delay(this._tickAndRepeat,[],this)),!0)},a.prototype._tickAndRepeat=function(){this._tickScheduled=!1,this.isPaused||this.isFinished||(this._tick(),this.isFinished||(r.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0))},a.prototype._tick=function(){if(this.isPaused||this.isFinished)return!1;var e=null,t=Math.min(this.max,this.index+16384);if(this.index>=this.max)return this.end();switch(this.type){case"string":e=this.data.substring(this.index,t);break;case"uint8array":e=this.data.subarray(this.index,t);break;case"array":case"nodebuffer":e=this.data.slice(this.index,t)}return this.index=t,this.push({data:e,meta:{percent:this.max?this.index/this.max*100:0}})},t.exports=a},{"../utils":32,"./GenericWorker":28}],28:[function(e,t,i){function r(e){this.name=e||"default",this.streamInfo={},this.generatedError=null,this.extraStreamInfo={},this.isPaused=!0,this.isFinished=!1,this.isLocked=!1,this._listeners={data:[],end:[],error:[]},this.previous=null}r.prototype={push:function(e){this.emit("data",e)},end:function(){if(this.isFinished)return!1;this.flush();try{this.emit("end"),this.cleanUp(),this.isFinished=!0}catch(e){this.emit("error",e)}return!0},error:function(e){return!this.isFinished&&(this.isPaused?this.generatedError=e:(this.isFinished=!0,this.emit("error",e),this.previous&&this.previous.error(e),this.cleanUp()),!0)},on:function(e,t){return this._listeners[e].push(t),this},cleanUp:function(){this.streamInfo=this.generatedError=this.extraStreamInfo=null,this._listeners=[]},emit:function(e,t){if(this._listeners[e])for(var i=0;i<this._listeners[e].length;i++)this._listeners[e][i].call(this,t)},pipe:function(e){return e.registerPrevious(this)},registerPrevious:function(e){if(this.isLocked)throw new Error("The stream '"+this+"' has already been used.");this.streamInfo=e.streamInfo,this.mergeStreamInfo(),this.previous=e;var t=this;return e.on("data",(function(e){t.processChunk(e)})),e.on("end",(function(){t.end()})),e.on("error",(function(e){t.error(e)})),this},pause:function(){return!this.isPaused&&!this.isFinished&&(this.isPaused=!0,this.previous&&this.previous.pause(),!0)},resume:function(){if(!this.isPaused||this.isFinished)return!1;var e=this.isPaused=!1;return this.generatedError&&(this.error(this.generatedError),e=!0),this.previous&&this.previous.resume(),!e},flush:function(){},processChunk:function(e){this.push(e)},withStreamInfo:function(e,t){return this.extraStreamInfo[e]=t,this.mergeStreamInfo(),this},mergeStreamInfo:function(){for(var e in this.extraStreamInfo)Object.prototype.hasOwnProperty.call(this.extraStreamInfo,e)&&(this.streamInfo[e]=this.extraStreamInfo[e])},lock:function(){if(this.isLocked)throw new Error("The stream '"+this+"' has already been used.");this.isLocked=!0,this.previous&&this.previous.lock()},toString:function(){var e="Worker "+this.name;return this.previous?this.previous+" -> "+e:e}},t.exports=r},{}],29:[function(e,t,i){var r=e("../utils"),n=e("./ConvertWorker"),a=e("./GenericWorker"),o=e("../base64"),s=e("../support"),c=e("../external"),l=null;if(s.nodestream)try{l=e("../nodejs/NodejsStreamOutputAdapter")}catch(u){}function d(e,t,i){var o=t;switch(t){case"blob":case"arraybuffer":o="uint8array";break;case"base64":o="string"}try{this._internalType=o,this._outputType=t,this._mimeType=i,r.checkSupport(o),this._worker=e.pipe(new n(o)),e.lock()}catch(s){this._worker=new a("error"),this._worker.error(s)}}d.prototype={accumulate:function(e){return function(e,t){return new c.Promise((function(i,n){var a=[],s=e._internalType,c=e._outputType,l=e._mimeType;e.on("data",(function(e,i){a.push(e),t&&t(i)})).on("error",(function(e){a=[],n(e)})).on("end",(function(){try{var e=function(e,t,i){switch(e){case"blob":return r.newBlob(r.transformTo("arraybuffer",t),i);case"base64":return o.encode(t);default:return r.transformTo(e,t)}}(c,function(e,t){var i,r=0,n=null,a=0;for(i=0;i<t.length;i++)a+=t[i].length;switch(e){case"string":return t.join("");case"array":return Array.prototype.concat.apply([],t);case"uint8array":for(n=new Uint8Array(a),i=0;i<t.length;i++)n.set(t[i],r),r+=t[i].length;return n;case"nodebuffer":return Buffer.concat(t);default:throw new Error("concat : unsupported type '"+e+"'")}}(s,a),l);i(e)}catch(t){n(t)}a=[]})).resume()}))}(this,e)},on:function(e,t){var i=this;return"data"===e?this._worker.on(e,(function(e){t.call(i,e.data,e.meta)})):this._worker.on(e,(function(){r.delay(t,arguments,i)})),this},resume:function(){return r.delay(this._worker.resume,[],this._worker),this},pause:function(){return this._worker.pause(),this},toNodejsStream:function(e){if(r.checkSupport("nodestream"),"nodebuffer"!==this._outputType)throw new Error(this._outputType+" is not supported by this method");return new l(this,{objectMode:"nodebuffer"!==this._outputType},e)}},t.exports=d},{"../base64":1,"../external":6,"../nodejs/NodejsStreamOutputAdapter":13,"../support":30,"../utils":32,"./ConvertWorker":24,"./GenericWorker":28}],30:[function(e,t,i){if(i.base64=!0,i.array=!0,i.string=!0,i.arraybuffer="undefined"!=typeof ArrayBuffer&&"undefined"!=typeof Uint8Array,i.nodebuffer="undefined"!=typeof Buffer,i.uint8array="undefined"!=typeof Uint8Array,"undefined"==typeof ArrayBuffer)i.blob=!1;else{var r=new ArrayBuffer(0);try{i.blob=0===new Blob([r],{type:"application/zip"}).size}catch(a){try{var n=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);n.append(r),i.blob=0===n.getBlob("application/zip").size}catch(TA){i.blob=!1}}}try{i.nodestream=!!e("readable-stream").Readable}catch(a){i.nodestream=!1}},{"readable-stream":16}],31:[function(e,t,i){for(var r=e("./utils"),n=e("./support"),a=e("./nodejsUtils"),o=e("./stream/GenericWorker"),s=new Array(256),c=0;c<256;c++)s[c]=252<=c?6:248<=c?5:240<=c?4:224<=c?3:192<=c?2:1;function l(){o.call(this,"utf-8 decode"),this.leftOver=null}function d(){o.call(this,"utf-8 encode")}s[254]=s[254]=1,i.utf8encode=function(e){return n.nodebuffer?a.newBufferFrom(e,"utf-8"):function(e){var t,i,r,a,o,s=e.length,c=0;for(a=0;a<s;a++)55296==(64512&(i=e.charCodeAt(a)))&&a+1<s&&56320==(64512&(r=e.charCodeAt(a+1)))&&(i=65536+(i-55296<<10)+(r-56320),a++),c+=i<128?1:i<2048?2:i<65536?3:4;for(t=n.uint8array?new Uint8Array(c):new Array(c),a=o=0;o<c;a++)55296==(64512&(i=e.charCodeAt(a)))&&a+1<s&&56320==(64512&(r=e.charCodeAt(a+1)))&&(i=65536+(i-55296<<10)+(r-56320),a++),i<128?t[o++]=i:(i<2048?t[o++]=192|i>>>6:(i<65536?t[o++]=224|i>>>12:(t[o++]=240|i>>>18,t[o++]=128|i>>>12&63),t[o++]=128|i>>>6&63),t[o++]=128|63&i);return t}(e)},i.utf8decode=function(e){return n.nodebuffer?r.transformTo("nodebuffer",e).toString("utf-8"):function(e){var t,i,n,a,o=e.length,c=new Array(2*o);for(t=i=0;t<o;)if((n=e[t++])<128)c[i++]=n;else if(4<(a=s[n]))c[i++]=65533,t+=a-1;else{for(n&=2===a?31:3===a?15:7;1<a&&t<o;)n=n<<6|63&e[t++],a--;1<a?c[i++]=65533:n<65536?c[i++]=n:(n-=65536,c[i++]=55296|n>>10&1023,c[i++]=56320|1023&n)}return c.length!==i&&(c.subarray?c=c.subarray(0,i):c.length=i),r.applyFromCharCode(c)}(e=r.transformTo(n.uint8array?"uint8array":"array",e))},r.inherits(l,o),l.prototype.processChunk=function(e){var t=r.transformTo(n.uint8array?"uint8array":"array",e.data);if(this.leftOver&&this.leftOver.length){if(n.uint8array){var a=t;(t=new Uint8Array(a.length+this.leftOver.length)).set(this.leftOver,0),t.set(a,this.leftOver.length)}else t=this.leftOver.concat(t);this.leftOver=null}var o=function(e,t){var i;for((t=t||e.length)>e.length&&(t=e.length),i=t-1;0<=i&&128==(192&e[i]);)i--;return i<0||0===i?t:i+s[e[i]]>t?i:t}(t),c=t;o!==t.length&&(n.uint8array?(c=t.subarray(0,o),this.leftOver=t.subarray(o,t.length)):(c=t.slice(0,o),this.leftOver=t.slice(o,t.length))),this.push({data:i.utf8decode(c),meta:e.meta})},l.prototype.flush=function(){this.leftOver&&this.leftOver.length&&(this.push({data:i.utf8decode(this.leftOver),meta:{}}),this.leftOver=null)},i.Utf8DecodeWorker=l,r.inherits(d,o),d.prototype.processChunk=function(e){this.push({data:i.utf8encode(e.data),meta:e.meta})},i.Utf8EncodeWorker=d},{"./nodejsUtils":14,"./stream/GenericWorker":28,"./support":30,"./utils":32}],32:[function(e,t,i){var r=e("./support"),n=e("./base64"),a=e("./nodejsUtils"),o=e("./external");function s(e){return e}function c(e,t){for(var i=0;i<e.length;++i)t[i]=255&e.charCodeAt(i);return t}e("setimmediate"),i.newBlob=function(e,t){i.checkSupport("blob");try{return new Blob([e],{type:t})}catch(n){try{var r=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);return r.append(e),r.getBlob(t)}catch(a){throw new Error("Bug : can't construct the Blob.")}}};var l={stringifyByChunk:function(e,t,i){var r=[],n=0,a=e.length;if(a<=i)return String.fromCharCode.apply(null,e);for(;n<a;)"array"===t||"nodebuffer"===t?r.push(String.fromCharCode.apply(null,e.slice(n,Math.min(n+i,a)))):r.push(String.fromCharCode.apply(null,e.subarray(n,Math.min(n+i,a)))),n+=i;return r.join("")},stringifyByChar:function(e){for(var t="",i=0;i<e.length;i++)t+=String.fromCharCode(e[i]);return t},applyCanBeUsed:{uint8array:function(){try{return r.uint8array&&1===String.fromCharCode.apply(null,new Uint8Array(1)).length}catch(e){return!1}}(),nodebuffer:function(){try{return r.nodebuffer&&1===String.fromCharCode.apply(null,a.allocBuffer(1)).length}catch(e){return!1}}()}};function d(e){var t=65536,r=i.getTypeOf(e),n=!0;if("uint8array"===r?n=l.applyCanBeUsed.uint8array:"nodebuffer"===r&&(n=l.applyCanBeUsed.nodebuffer),n)for(;1<t;)try{return l.stringifyByChunk(e,r,t)}catch(a){t=Math.floor(t/2)}return l.stringifyByChar(e)}function u(e,t){for(var i=0;i<e.length;i++)t[i]=e[i];return t}i.applyFromCharCode=d;var h={};h.string={string:s,array:function(e){return c(e,new Array(e.length))},arraybuffer:function(e){return h.string.uint8array(e).buffer},uint8array:function(e){return c(e,new Uint8Array(e.length))},nodebuffer:function(e){return c(e,a.allocBuffer(e.length))}},h.array={string:d,array:s,arraybuffer:function(e){return new Uint8Array(e).buffer},uint8array:function(e){return new Uint8Array(e)},nodebuffer:function(e){return a.newBufferFrom(e)}},h.arraybuffer={string:function(e){return d(new Uint8Array(e))},array:function(e){return u(new Uint8Array(e),new Array(e.byteLength))},arraybuffer:s,uint8array:function(e){return new Uint8Array(e)},nodebuffer:function(e){return a.newBufferFrom(new Uint8Array(e))}},h.uint8array={string:d,array:function(e){return u(e,new Array(e.length))},arraybuffer:function(e){return e.buffer},uint8array:s,nodebuffer:function(e){return a.newBufferFrom(e)}},h.nodebuffer={string:d,array:function(e){return u(e,new Array(e.length))},arraybuffer:function(e){return h.nodebuffer.uint8array(e).buffer},uint8array:function(e){return u(e,new Uint8Array(e.length))},nodebuffer:s},i.transformTo=function(e,t){if(t=t||"",!e)return t;i.checkSupport(e);var r=i.getTypeOf(t);return h[r][e](t)},i.resolve=function(e){for(var t=e.split("/"),i=[],r=0;r<t.length;r++){var n=t[r];"."===n||""===n&&0!==r&&r!==t.length-1||(".."===n?i.pop():i.push(n))}return i.join("/")},i.getTypeOf=function(e){return"string"==typeof e?"string":"[object Array]"===Object.prototype.toString.call(e)?"array":r.nodebuffer&&a.isBuffer(e)?"nodebuffer":r.uint8array&&e instanceof Uint8Array?"uint8array":r.arraybuffer&&e instanceof ArrayBuffer?"arraybuffer":void 0},i.checkSupport=function(e){if(!r[e.toLowerCase()])throw new Error(e+" is not supported by this platform")},i.MAX_VALUE_16BITS=65535,i.MAX_VALUE_32BITS=-1,i.pretty=function(e){var t,i,r="";for(i=0;i<(e||"").length;i++)r+="\\x"+((t=e.charCodeAt(i))<16?"0":"")+t.toString(16).toUpperCase();return r},i.delay=function(e,t,i){setImmediate((function(){e.apply(i||null,t||[])}))},i.inherits=function(e,t){function i(){}i.prototype=t.prototype,e.prototype=new i},i.extend=function(){var e,t,i={};for(e=0;e<arguments.length;e++)for(t in arguments[e])Object.prototype.hasOwnProperty.call(arguments[e],t)&&void 0===i[t]&&(i[t]=arguments[e][t]);return i},i.prepareContent=function(e,t,a,s,l){return o.Promise.resolve(t).then((function(e){return r.blob&&(e instanceof Blob||-1!==["[object File]","[object Blob]"].indexOf(Object.prototype.toString.call(e)))&&"undefined"!=typeof FileReader?new o.Promise((function(t,i){var r=new FileReader;r.onload=function(e){t(e.target.result)},r.onerror=function(e){i(e.target.error)},r.readAsArrayBuffer(e)})):e})).then((function(t){var d,u=i.getTypeOf(t);return u?("arraybuffer"===u?t=i.transformTo("uint8array",t):"string"===u&&(l?t=n.decode(t):a&&!0!==s&&(t=c(d=t,r.uint8array?new Uint8Array(d.length):new Array(d.length)))),t):o.Promise.reject(new Error("Can't read the data of '"+e+"'. Is it in a supported JavaScript type (String, Blob, ArrayBuffer, etc) ?"))}))}},{"./base64":1,"./external":6,"./nodejsUtils":14,"./support":30,setimmediate:54}],33:[function(e,t,i){var r=e("./reader/readerFor"),n=e("./utils"),a=e("./signature"),o=e("./zipEntry"),s=e("./support");function c(e){this.files=[],this.loadOptions=e}c.prototype={checkSignature:function(e){if(!this.reader.readAndCheckSignature(e)){this.reader.index-=4;var t=this.reader.readString(4);throw new Error("Corrupted zip or bug: unexpected signature ("+n.pretty(t)+", expected "+n.pretty(e)+")")}},isSignature:function(e,t){var i=this.reader.index;this.reader.setIndex(e);var r=this.reader.readString(4)===t;return this.reader.setIndex(i),r},readBlockEndOfCentral:function(){this.diskNumber=this.reader.readInt(2),this.diskWithCentralDirStart=this.reader.readInt(2),this.centralDirRecordsOnThisDisk=this.reader.readInt(2),this.centralDirRecords=this.reader.readInt(2),this.centralDirSize=this.reader.readInt(4),this.centralDirOffset=this.reader.readInt(4),this.zipCommentLength=this.reader.readInt(2);var e=this.reader.readData(this.zipCommentLength),t=s.uint8array?"uint8array":"array",i=n.transformTo(t,e);this.zipComment=this.loadOptions.decodeFileName(i)},readBlockZip64EndOfCentral:function(){this.zip64EndOfCentralSize=this.reader.readInt(8),this.reader.skip(4),this.diskNumber=this.reader.readInt(4),this.diskWithCentralDirStart=this.reader.readInt(4),this.centralDirRecordsOnThisDisk=this.reader.readInt(8),this.centralDirRecords=this.reader.readInt(8),this.centralDirSize=this.reader.readInt(8),this.centralDirOffset=this.reader.readInt(8),this.zip64ExtensibleData={};for(var e,t,i,r=this.zip64EndOfCentralSize-44;0<r;)e=this.reader.readInt(2),t=this.reader.readInt(4),i=this.reader.readData(t),this.zip64ExtensibleData[e]={id:e,length:t,value:i}},readBlockZip64EndOfCentralLocator:function(){if(this.diskWithZip64CentralDirStart=this.reader.readInt(4),this.relativeOffsetEndOfZip64CentralDir=this.reader.readInt(8),this.disksCount=this.reader.readInt(4),1<this.disksCount)throw new Error("Multi-volumes zip are not supported")},readLocalFiles:function(){var e,t;for(e=0;e<this.files.length;e++)t=this.files[e],this.reader.setIndex(t.localHeaderOffset),this.checkSignature(a.LOCAL_FILE_HEADER),t.readLocalPart(this.reader),t.handleUTF8(),t.processAttributes()},readCentralDir:function(){var e;for(this.reader.setIndex(this.centralDirOffset);this.reader.readAndCheckSignature(a.CENTRAL_FILE_HEADER);)(e=new o({zip64:this.zip64},this.loadOptions)).readCentralPart(this.reader),this.files.push(e);if(this.centralDirRecords!==this.files.length&&0!==this.centralDirRecords&&0===this.files.length)throw new Error("Corrupted zip or bug: expected "+this.centralDirRecords+" records in central dir, got "+this.files.length)},readEndOfCentral:function(){var e=this.reader.lastIndexOfSignature(a.CENTRAL_DIRECTORY_END);if(e<0)throw this.isSignature(0,a.LOCAL_FILE_HEADER)?new Error("Corrupted zip: can't find end of central directory"):new Error("Can't find end of central directory : is this a zip file ? If it is, see https://stuk.github.io/jszip/documentation/howto/read_zip.html");this.reader.setIndex(e);var t=e;if(this.checkSignature(a.CENTRAL_DIRECTORY_END),this.readBlockEndOfCentral(),this.diskNumber===n.MAX_VALUE_16BITS||this.diskWithCentralDirStart===n.MAX_VALUE_16BITS||this.centralDirRecordsOnThisDisk===n.MAX_VALUE_16BITS||this.centralDirRecords===n.MAX_VALUE_16BITS||this.centralDirSize===n.MAX_VALUE_32BITS||this.centralDirOffset===n.MAX_VALUE_32BITS){if(this.zip64=!0,(e=this.reader.lastIndexOfSignature(a.ZIP64_CENTRAL_DIRECTORY_LOCATOR))<0)throw new Error("Corrupted zip: can't find the ZIP64 end of central directory locator");if(this.reader.setIndex(e),this.checkSignature(a.ZIP64_CENTRAL_DIRECTORY_LOCATOR),this.readBlockZip64EndOfCentralLocator(),!this.isSignature(this.relativeOffsetEndOfZip64CentralDir,a.ZIP64_CENTRAL_DIRECTORY_END)&&(this.relativeOffsetEndOfZip64CentralDir=this.reader.lastIndexOfSignature(a.ZIP64_CENTRAL_DIRECTORY_END),this.relativeOffsetEndOfZip64CentralDir<0))throw new Error("Corrupted zip: can't find the ZIP64 end of central directory");this.reader.setIndex(this.relativeOffsetEndOfZip64CentralDir),this.checkSignature(a.ZIP64_CENTRAL_DIRECTORY_END),this.readBlockZip64EndOfCentral()}var i=this.centralDirOffset+this.centralDirSize;this.zip64&&(i+=20,i+=12+this.zip64EndOfCentralSize);var r=t-i;if(0<r)this.isSignature(t,a.CENTRAL_FILE_HEADER)||(this.reader.zero=r);else if(r<0)throw new Error("Corrupted zip: missing "+Math.abs(r)+" bytes.")},prepareReader:function(e){this.reader=r(e)},load:function(e){this.prepareReader(e),this.readEndOfCentral(),this.readCentralDir(),this.readLocalFiles()}},t.exports=c},{"./reader/readerFor":22,"./signature":23,"./support":30,"./utils":32,"./zipEntry":34}],34:[function(e,t,i){var r=e("./reader/readerFor"),n=e("./utils"),a=e("./compressedObject"),o=e("./crc32"),s=e("./utf8"),c=e("./compressions"),l=e("./support");function d(e,t){this.options=e,this.loadOptions=t}d.prototype={isEncrypted:function(){return!(1&~this.bitFlag)},useUTF8:function(){return!(2048&~this.bitFlag)},readLocalPart:function(e){var t,i;if(e.skip(22),this.fileNameLength=e.readInt(2),i=e.readInt(2),this.fileName=e.readData(this.fileNameLength),e.skip(i),-1===this.compressedSize||-1===this.uncompressedSize)throw new Error("Bug or corrupted zip : didn't get enough information from the central directory (compressedSize === -1 || uncompressedSize === -1)");if(null===(t=function(e){for(var t in c)if(Object.prototype.hasOwnProperty.call(c,t)&&c[t].magic===e)return c[t];return null}(this.compressionMethod)))throw new Error("Corrupted zip : compression "+n.pretty(this.compressionMethod)+" unknown (inner file : "+n.transformTo("string",this.fileName)+")");this.decompressed=new a(this.compressedSize,this.uncompressedSize,this.crc32,t,e.readData(this.compressedSize))},readCentralPart:function(e){this.versionMadeBy=e.readInt(2),e.skip(2),this.bitFlag=e.readInt(2),this.compressionMethod=e.readString(2),this.date=e.readDate(),this.crc32=e.readInt(4),this.compressedSize=e.readInt(4),this.uncompressedSize=e.readInt(4);var t=e.readInt(2);if(this.extraFieldsLength=e.readInt(2),this.fileCommentLength=e.readInt(2),this.diskNumberStart=e.readInt(2),this.internalFileAttributes=e.readInt(2),this.externalFileAttributes=e.readInt(4),this.localHeaderOffset=e.readInt(4),this.isEncrypted())throw new Error("Encrypted zip are not supported");e.skip(t),this.readExtraFields(e),this.parseZIP64ExtraField(e),this.fileComment=e.readData(this.fileCommentLength)},processAttributes:function(){this.unixPermissions=null,this.dosPermissions=null;var e=this.versionMadeBy>>8;this.dir=!!(16&this.externalFileAttributes),0==e&&(this.dosPermissions=63&this.externalFileAttributes),3==e&&(this.unixPermissions=this.externalFileAttributes>>16&65535),this.dir||"/"!==this.fileNameStr.slice(-1)||(this.dir=!0)},parseZIP64ExtraField:function(){if(this.extraFields[1]){var e=r(this.extraFields[1].value);this.uncompressedSize===n.MAX_VALUE_32BITS&&(this.uncompressedSize=e.readInt(8)),this.compressedSize===n.MAX_VALUE_32BITS&&(this.compressedSize=e.readInt(8)),this.localHeaderOffset===n.MAX_VALUE_32BITS&&(this.localHeaderOffset=e.readInt(8)),this.diskNumberStart===n.MAX_VALUE_32BITS&&(this.diskNumberStart=e.readInt(4))}},readExtraFields:function(e){var t,i,r,n=e.index+this.extraFieldsLength;for(this.extraFields||(this.extraFields={});e.index+4<n;)t=e.readInt(2),i=e.readInt(2),r=e.readData(i),this.extraFields[t]={id:t,length:i,value:r};e.setIndex(n)},handleUTF8:function(){var e=l.uint8array?"uint8array":"array";if(this.useUTF8())this.fileNameStr=s.utf8decode(this.fileName),this.fileCommentStr=s.utf8decode(this.fileComment);else{var t=this.findExtraFieldUnicodePath();if(null!==t)this.fileNameStr=t;else{var i=n.transformTo(e,this.fileName);this.fileNameStr=this.loadOptions.decodeFileName(i)}var r=this.findExtraFieldUnicodeComment();if(null!==r)this.fileCommentStr=r;else{var a=n.transformTo(e,this.fileComment);this.fileCommentStr=this.loadOptions.decodeFileName(a)}}},findExtraFieldUnicodePath:function(){var e=this.extraFields[28789];if(e){var t=r(e.value);return 1!==t.readInt(1)||o(this.fileName)!==t.readInt(4)?null:s.utf8decode(t.readData(e.length-5))}return null},findExtraFieldUnicodeComment:function(){var e=this.extraFields[25461];if(e){var t=r(e.value);return 1!==t.readInt(1)||o(this.fileComment)!==t.readInt(4)?null:s.utf8decode(t.readData(e.length-5))}return null}},t.exports=d},{"./compressedObject":2,"./compressions":3,"./crc32":4,"./reader/readerFor":22,"./support":30,"./utf8":31,"./utils":32}],35:[function(e,t,i){function r(e,t,i){this.name=e,this.dir=i.dir,this.date=i.date,this.comment=i.comment,this.unixPermissions=i.unixPermissions,this.dosPermissions=i.dosPermissions,this._data=t,this._dataBinary=i.binary,this.options={compression:i.compression,compressionOptions:i.compressionOptions}}var n=e("./stream/StreamHelper"),a=e("./stream/DataWorker"),o=e("./utf8"),s=e("./compressedObject"),c=e("./stream/GenericWorker");r.prototype={internalStream:function(e){var t=null,i="string";try{if(!e)throw new Error("No output type specified.");var r="string"===(i=e.toLowerCase())||"text"===i;"binarystring"!==i&&"text"!==i||(i="string"),t=this._decompressWorker();var a=!this._dataBinary;a&&!r&&(t=t.pipe(new o.Utf8EncodeWorker)),!a&&r&&(t=t.pipe(new o.Utf8DecodeWorker))}catch(s){(t=new c("error")).error(s)}return new n(t,i,"")},async:function(e,t){return this.internalStream(e).accumulate(t)},nodeStream:function(e,t){return this.internalStream(e||"nodebuffer").toNodejsStream(t)},_compressWorker:function(e,t){if(this._data instanceof s&&this._data.compression.magic===e.magic)return this._data.getCompressedWorker();var i=this._decompressWorker();return this._dataBinary||(i=i.pipe(new o.Utf8EncodeWorker)),s.createWorkerFrom(i,e,t)},_decompressWorker:function(){return this._data instanceof s?this._data.getContentWorker():this._data instanceof c?this._data:new a(this._data)}};for(var l=["asText","asBinary","asNodeBuffer","asUint8Array","asArrayBuffer"],d=function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},u=0;u<l.length;u++)r.prototype[l[u]]=d;t.exports=r},{"./compressedObject":2,"./stream/DataWorker":27,"./stream/GenericWorker":28,"./stream/StreamHelper":29,"./utf8":31}],36:[function(e,t,i){(function(e){var i,r,n=e.MutationObserver||e.WebKitMutationObserver;if(n){var a=0,o=new n(d),s=e.document.createTextNode("");o.observe(s,{characterData:!0}),i=function(){s.data=a=++a%2}}else if(e.setImmediate||void 0===e.MessageChannel)i="document"in e&&"onreadystatechange"in e.document.createElement("script")?function(){var t=e.document.createElement("script");t.onreadystatechange=function(){d(),t.onreadystatechange=null,t.parentNode.removeChild(t),t=null},e.document.documentElement.appendChild(t)}:function(){setTimeout(d,0)};else{var c=new e.MessageChannel;c.port1.onmessage=d,i=function(){c.port2.postMessage(0)}}var l=[];function d(){var e,t;r=!0;for(var i=l.length;i;){for(t=l,l=[],e=-1;++e<i;)t[e]();i=l.length}r=!1}t.exports=function(e){1!==l.push(e)||r||i()}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],37:[function(e,t,i){var r=e("immediate");function n(){}var a={},o=["REJECTED"],s=["FULFILLED"],c=["PENDING"];function l(e){if("function"!=typeof e)throw new TypeError("resolver must be a function");this.state=c,this.queue=[],this.outcome=void 0,e!==n&&p(this,e)}function d(e,t,i){this.promise=e,"function"==typeof t&&(this.onFulfilled=t,this.callFulfilled=this.otherCallFulfilled),"function"==typeof i&&(this.onRejected=i,this.callRejected=this.otherCallRejected)}function u(e,t,i){r((function(){var r;try{r=t(i)}catch(EO){return a.reject(e,EO)}r===e?a.reject(e,new TypeError("Cannot resolve promise with itself")):a.resolve(e,r)}))}function h(e){var t=e&&e.then;if(e&&("object"==typeof e||"function"==typeof e)&&"function"==typeof t)return function(){t.apply(e,arguments)}}function p(e,t){var i=!1;function r(t){i||(i=!0,a.reject(e,t))}function n(t){i||(i=!0,a.resolve(e,t))}var o=f((function(){t(n,r)}));"error"===o.status&&r(o.value)}function f(e,t){var i={};try{i.value=e(t),i.status="success"}catch(r){i.status="error",i.value=r}return i}(t.exports=l).prototype.finally=function(e){if("function"!=typeof e)return this;var t=this.constructor;return this.then((function(i){return t.resolve(e()).then((function(){return i}))}),(function(i){return t.resolve(e()).then((function(){throw i}))}))},l.prototype.catch=function(e){return this.then(null,e)},l.prototype.then=function(e,t){if("function"!=typeof e&&this.state===s||"function"!=typeof t&&this.state===o)return this;var i=new this.constructor(n);return this.state!==c?u(i,this.state===s?e:t,this.outcome):this.queue.push(new d(i,e,t)),i},d.prototype.callFulfilled=function(e){a.resolve(this.promise,e)},d.prototype.otherCallFulfilled=function(e){u(this.promise,this.onFulfilled,e)},d.prototype.callRejected=function(e){a.reject(this.promise,e)},d.prototype.otherCallRejected=function(e){u(this.promise,this.onRejected,e)},a.resolve=function(e,t){var i=f(h,t);if("error"===i.status)return a.reject(e,i.value);var r=i.value;if(r)p(e,r);else{e.state=s,e.outcome=t;for(var n=-1,o=e.queue.length;++n<o;)e.queue[n].callFulfilled(t)}return e},a.reject=function(e,t){e.state=o,e.outcome=t;for(var i=-1,r=e.queue.length;++i<r;)e.queue[i].callRejected(t);return e},l.resolve=function(e){return e instanceof this?e:a.resolve(new this(n),e)},l.reject=function(e){var t=new this(n);return a.reject(t,e)},l.all=function(e){var t=this;if("[object Array]"!==Object.prototype.toString.call(e))return this.reject(new TypeError("must be an array"));var i=e.length,r=!1;if(!i)return this.resolve([]);for(var o=new Array(i),s=0,c=-1,l=new this(n);++c<i;)d(e[c],c);return l;function d(e,n){t.resolve(e).then((function(e){o[n]=e,++s!==i||r||(r=!0,a.resolve(l,o))}),(function(e){r||(r=!0,a.reject(l,e))}))}},l.race=function(e){if("[object Array]"!==Object.prototype.toString.call(e))return this.reject(new TypeError("must be an array"));var t,i=e.length,r=!1;if(!i)return this.resolve([]);for(var o=-1,s=new this(n);++o<i;)t=e[o],this.resolve(t).then((function(e){r||(r=!0,a.resolve(s,e))}),(function(e){r||(r=!0,a.reject(s,e))}));return s}},{immediate:36}],38:[function(e,t,i){var r={};(0,e("./lib/utils/common").assign)(r,e("./lib/deflate"),e("./lib/inflate"),e("./lib/zlib/constants")),t.exports=r},{"./lib/deflate":39,"./lib/inflate":40,"./lib/utils/common":41,"./lib/zlib/constants":44}],39:[function(e,t,i){var r=e("./zlib/deflate"),n=e("./utils/common"),a=e("./utils/strings"),o=e("./zlib/messages"),s=e("./zlib/zstream"),c=Object.prototype.toString;function l(e){if(!(this instanceof l))return new l(e);this.options=n.assign({level:-1,method:8,chunkSize:16384,windowBits:15,memLevel:8,strategy:0,to:""},e||{});var t=this.options;t.raw&&0<t.windowBits?t.windowBits=-t.windowBits:t.gzip&&0<t.windowBits&&t.windowBits<16&&(t.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new s,this.strm.avail_out=0;var i=r.deflateInit2(this.strm,t.level,t.method,t.windowBits,t.memLevel,t.strategy);if(0!==i)throw new Error(o[i]);if(t.header&&r.deflateSetHeader(this.strm,t.header),t.dictionary){var d;if(d="string"==typeof t.dictionary?a.string2buf(t.dictionary):"[object ArrayBuffer]"===c.call(t.dictionary)?new Uint8Array(t.dictionary):t.dictionary,0!==(i=r.deflateSetDictionary(this.strm,d)))throw new Error(o[i]);this._dict_set=!0}}function d(e,t){var i=new l(t);if(i.push(e,!0),i.err)throw i.msg||o[i.err];return i.result}l.prototype.push=function(e,t){var i,o,s=this.strm,l=this.options.chunkSize;if(this.ended)return!1;o=t===~~t?t:!0===t?4:0,"string"==typeof e?s.input=a.string2buf(e):"[object ArrayBuffer]"===c.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 n.Buf8(l),s.next_out=0,s.avail_out=l),1!==(i=r.deflate(s,o))&&0!==i)return this.onEnd(i),!(this.ended=!0);0!==s.avail_out&&(0!==s.avail_in||4!==o&&2!==o)||("string"===this.options.to?this.onData(a.buf2binstring(n.shrinkBuf(s.output,s.next_out))):this.onData(n.shrinkBuf(s.output,s.next_out)))}while((0<s.avail_in||0===s.avail_out)&&1!==i);return 4===o?(i=r.deflateEnd(this.strm),this.onEnd(i),this.ended=!0,0===i):2!==o||(this.onEnd(0),!(s.avail_out=0))},l.prototype.onData=function(e){this.chunks.push(e)},l.prototype.onEnd=function(e){0===e&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=n.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg},i.Deflate=l,i.deflate=d,i.deflateRaw=function(e,t){return(t=t||{}).raw=!0,d(e,t)},i.gzip=function(e,t){return(t=t||{}).gzip=!0,d(e,t)}},{"./utils/common":41,"./utils/strings":42,"./zlib/deflate":46,"./zlib/messages":51,"./zlib/zstream":53}],40:[function(e,t,i){var r=e("./zlib/inflate"),n=e("./utils/common"),a=e("./utils/strings"),o=e("./zlib/constants"),s=e("./zlib/messages"),c=e("./zlib/zstream"),l=e("./zlib/gzheader"),d=Object.prototype.toString;function u(e){if(!(this instanceof u))return new u(e);this.options=n.assign({chunkSize:16384,windowBits:0,to:""},e||{});var t=this.options;t.raw&&0<=t.windowBits&&t.windowBits<16&&(t.windowBits=-t.windowBits,0===t.windowBits&&(t.windowBits=-15)),!(0<=t.windowBits&&t.windowBits<16)||e&&e.windowBits||(t.windowBits+=32),15<t.windowBits&&t.windowBits<48&&!(15&t.windowBits)&&(t.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new c,this.strm.avail_out=0;var i=r.inflateInit2(this.strm,t.windowBits);if(i!==o.Z_OK)throw new Error(s[i]);this.header=new l,r.inflateGetHeader(this.strm,this.header)}function h(e,t){var i=new u(t);if(i.push(e,!0),i.err)throw i.msg||s[i.err];return i.result}u.prototype.push=function(e,t){var i,s,c,l,u,h,p=this.strm,f=this.options.chunkSize,m=this.options.dictionary,g=!1;if(this.ended)return!1;s=t===~~t?t:!0===t?o.Z_FINISH:o.Z_NO_FLUSH,"string"==typeof e?p.input=a.binstring2buf(e):"[object ArrayBuffer]"===d.call(e)?p.input=new Uint8Array(e):p.input=e,p.next_in=0,p.avail_in=p.input.length;do{if(0===p.avail_out&&(p.output=new n.Buf8(f),p.next_out=0,p.avail_out=f),(i=r.inflate(p,o.Z_NO_FLUSH))===o.Z_NEED_DICT&&m&&(h="string"==typeof m?a.string2buf(m):"[object ArrayBuffer]"===d.call(m)?new Uint8Array(m):m,i=r.inflateSetDictionary(this.strm,h)),i===o.Z_BUF_ERROR&&!0===g&&(i=o.Z_OK,g=!1),i!==o.Z_STREAM_END&&i!==o.Z_OK)return this.onEnd(i),!(this.ended=!0);p.next_out&&(0!==p.avail_out&&i!==o.Z_STREAM_END&&(0!==p.avail_in||s!==o.Z_FINISH&&s!==o.Z_SYNC_FLUSH)||("string"===this.options.to?(c=a.utf8border(p.output,p.next_out),l=p.next_out-c,u=a.buf2string(p.output,c),p.next_out=l,p.avail_out=f-l,l&&n.arraySet(p.output,p.output,c,l,0),this.onData(u)):this.onData(n.shrinkBuf(p.output,p.next_out)))),0===p.avail_in&&0===p.avail_out&&(g=!0)}while((0<p.avail_in||0===p.avail_out)&&i!==o.Z_STREAM_END);return i===o.Z_STREAM_END&&(s=o.Z_FINISH),s===o.Z_FINISH?(i=r.inflateEnd(this.strm),this.onEnd(i),this.ended=!0,i===o.Z_OK):s!==o.Z_SYNC_FLUSH||(this.onEnd(o.Z_OK),!(p.avail_out=0))},u.prototype.onData=function(e){this.chunks.push(e)},u.prototype.onEnd=function(e){e===o.Z_OK&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=n.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg},i.Inflate=u,i.inflate=h,i.inflateRaw=function(e,t){return(t=t||{}).raw=!0,h(e,t)},i.ungzip=h},{"./utils/common":41,"./utils/strings":42,"./zlib/constants":44,"./zlib/gzheader":47,"./zlib/inflate":49,"./zlib/messages":51,"./zlib/zstream":53}],41:[function(e,t,i){var r="undefined"!=typeof Uint8Array&&"undefined"!=typeof Uint16Array&&"undefined"!=typeof Int32Array;i.assign=function(e){for(var t=Array.prototype.slice.call(arguments,1);t.length;){var i=t.shift();if(i){if("object"!=typeof i)throw new TypeError(i+"must be non-object");for(var r in i)i.hasOwnProperty(r)&&(e[r]=i[r])}}return e},i.shrinkBuf=function(e,t){return e.length===t?e:e.subarray?e.subarray(0,t):(e.length=t,e)};var n={arraySet:function(e,t,i,r,n){if(t.subarray&&e.subarray)e.set(t.subarray(i,i+r),n);else for(var a=0;a<r;a++)e[n+a]=t[i+a]},flattenChunks:function(e){var t,i,r,n,a,o;for(t=r=0,i=e.length;t<i;t++)r+=e[t].length;for(o=new Uint8Array(r),t=n=0,i=e.length;t<i;t++)a=e[t],o.set(a,n),n+=a.length;return o}},a={arraySet:function(e,t,i,r,n){for(var a=0;a<r;a++)e[n+a]=t[i+a]},flattenChunks:function(e){return[].concat.apply([],e)}};i.setTyped=function(e){e?(i.Buf8=Uint8Array,i.Buf16=Uint16Array,i.Buf32=Int32Array,i.assign(i,n)):(i.Buf8=Array,i.Buf16=Array,i.Buf32=Array,i.assign(i,a))},i.setTyped(r)},{}],42:[function(e,t,i){var r=e("./common"),n=!0,a=!0;try{String.fromCharCode.apply(null,[0])}catch(l){n=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(l){a=!1}for(var o=new r.Buf8(256),s=0;s<256;s++)o[s]=252<=s?6:248<=s?5:240<=s?4:224<=s?3:192<=s?2:1;function c(e,t){if(t<65537&&(e.subarray&&a||!e.subarray&&n))return String.fromCharCode.apply(null,r.shrinkBuf(e,t));for(var i="",o=0;o<t;o++)i+=String.fromCharCode(e[o]);return i}o[254]=o[254]=1,i.string2buf=function(e){var t,i,n,a,o,s=e.length,c=0;for(a=0;a<s;a++)55296==(64512&(i=e.charCodeAt(a)))&&a+1<s&&56320==(64512&(n=e.charCodeAt(a+1)))&&(i=65536+(i-55296<<10)+(n-56320),a++),c+=i<128?1:i<2048?2:i<65536?3:4;for(t=new r.Buf8(c),a=o=0;o<c;a++)55296==(64512&(i=e.charCodeAt(a)))&&a+1<s&&56320==(64512&(n=e.charCodeAt(a+1)))&&(i=65536+(i-55296<<10)+(n-56320),a++),i<128?t[o++]=i:(i<2048?t[o++]=192|i>>>6:(i<65536?t[o++]=224|i>>>12:(t[o++]=240|i>>>18,t[o++]=128|i>>>12&63),t[o++]=128|i>>>6&63),t[o++]=128|63&i);return t},i.buf2binstring=function(e){return c(e,e.length)},i.binstring2buf=function(e){for(var t=new r.Buf8(e.length),i=0,n=t.length;i<n;i++)t[i]=e.charCodeAt(i);return t},i.buf2string=function(e,t){var i,r,n,a,s=t||e.length,l=new Array(2*s);for(i=r=0;i<s;)if((n=e[i++])<128)l[r++]=n;else if(4<(a=o[n]))l[r++]=65533,i+=a-1;else{for(n&=2===a?31:3===a?15:7;1<a&&i<s;)n=n<<6|63&e[i++],a--;1<a?l[r++]=65533:n<65536?l[r++]=n:(n-=65536,l[r++]=55296|n>>10&1023,l[r++]=56320|1023&n)}return c(l,r)},i.utf8border=function(e,t){var i;for((t=t||e.length)>e.length&&(t=e.length),i=t-1;0<=i&&128==(192&e[i]);)i--;return i<0||0===i?t:i+o[e[i]]>t?i:t}},{"./common":41}],43:[function(e,t,i){t.exports=function(e,t,i,r){for(var n=65535&e,a=e>>>16&65535,o=0;0!==i;){for(i-=o=2e3<i?2e3:i;a=a+(n=n+t[r++]|0)|0,--o;);n%=65521,a%=65521}return n|a<<16}},{}],44:[function(e,t,i){t.exports={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}},{}],45:[function(e,t,i){var r=function(){for(var e,t=[],i=0;i<256;i++){e=i;for(var r=0;r<8;r++)e=1&e?3988292384^e>>>1:e>>>1;t[i]=e}return t}();t.exports=function(e,t,i,n){var a=r,o=n+i;e^=-1;for(var s=n;s<o;s++)e=e>>>8^a[255&(e^t[s])];return~e}},{}],46:[function(e,t,i){var r,n=e("../utils/common"),a=e("./trees"),o=e("./adler32"),s=e("./crc32"),c=e("./messages"),l=-2,d=258,u=262,h=113;function p(e,t){return e.msg=c[t],t}function f(e){return(e<<1)-(4<e?9:0)}function m(e){for(var t=e.length;0<=--t;)e[t]=0}function g(e){var t=e.state,i=t.pending;i>e.avail_out&&(i=e.avail_out),0!==i&&(n.arraySet(e.output,t.pending_buf,t.pending_out,i,e.next_out),e.next_out+=i,t.pending_out+=i,e.total_out+=i,e.avail_out-=i,t.pending-=i,0===t.pending&&(t.pending_out=0))}function v(e,t){a._tr_flush_block(e,0<=e.block_start?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,g(e.strm)}function _(e,t){e.pending_buf[e.pending++]=t}function y(e,t){e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=255&t}function E(e,t){var i,r,n=e.max_chain_length,a=e.strstart,o=e.prev_length,s=e.nice_match,c=e.strstart>e.w_size-u?e.strstart-(e.w_size-u):0,l=e.window,h=e.w_mask,p=e.prev,f=e.strstart+d,m=l[a+o-1],g=l[a+o];e.prev_length>=e.good_match&&(n>>=2),s>e.lookahead&&(s=e.lookahead);do{if(l[(i=t)+o]===g&&l[i+o-1]===m&&l[i]===l[a]&&l[++i]===l[a+1]){a+=2,i++;do{}while(l[++a]===l[++i]&&l[++a]===l[++i]&&l[++a]===l[++i]&&l[++a]===l[++i]&&l[++a]===l[++i]&&l[++a]===l[++i]&&l[++a]===l[++i]&&l[++a]===l[++i]&&a<f);if(r=d-(f-a),a=f-d,o<r){if(e.match_start=t,s<=(o=r))break;m=l[a+o-1],g=l[a+o]}}}while((t=p[t&h])>c&&0!=--n);return o<=e.lookahead?o:e.lookahead}function b(e){var t,i,r,a,c,l,d,h,p,f,m=e.w_size;do{if(a=e.window_size-e.lookahead-e.strstart,e.strstart>=m+(m-u)){for(n.arraySet(e.window,e.window,m,m,0),e.match_start-=m,e.strstart-=m,e.block_start-=m,t=i=e.hash_size;r=e.head[--t],e.head[t]=m<=r?r-m:0,--i;);for(t=i=m;r=e.prev[--t],e.prev[t]=m<=r?r-m:0,--i;);a+=m}if(0===e.strm.avail_in)break;if(l=e.strm,d=e.window,h=e.strstart+e.lookahead,f=void 0,(p=a)<(f=l.avail_in)&&(f=p),i=0===f?0:(l.avail_in-=f,n.arraySet(d,l.input,l.next_in,f,h),1===l.state.wrap?l.adler=o(l.adler,d,f,h):2===l.state.wrap&&(l.adler=s(l.adler,d,f,h)),l.next_in+=f,l.total_in+=f,f),e.lookahead+=i,e.lookahead+e.insert>=3)for(c=e.strstart-e.insert,e.ins_h=e.window[c],e.ins_h=(e.ins_h<<e.hash_shift^e.window[c+1])&e.hash_mask;e.insert&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[c+3-1])&e.hash_mask,e.prev[c&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=c,c++,e.insert--,!(e.lookahead+e.insert<3)););}while(e.lookahead<u&&0!==e.strm.avail_in)}function w(e,t){for(var i,r;;){if(e.lookahead<u){if(b(e),e.lookahead<u&&0===t)return 1;if(0===e.lookahead)break}if(i=0,e.lookahead>=3&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+3-1])&e.hash_mask,i=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),0!==i&&e.strstart-i<=e.w_size-u&&(e.match_length=E(e,i)),e.match_length>=3)if(r=a._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){for(e.match_length--;e.strstart++,e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+3-1])&e.hash_mask,i=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart,0!=--e.match_length;);e.strstart++}else e.strstart+=e.match_length,e.match_length=0,e.ins_h=e.window[e.strstart],e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+1])&e.hash_mask;else r=a._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++;if(r&&(v(e,!1),0===e.strm.avail_out))return 1}return e.insert=e.strstart<2?e.strstart:2,4===t?(v(e,!0),0===e.strm.avail_out?3:4):e.last_lit&&(v(e,!1),0===e.strm.avail_out)?1:2}function I(e,t){for(var i,r,n;;){if(e.lookahead<u){if(b(e),e.lookahead<u&&0===t)return 1;if(0===e.lookahead)break}if(i=0,e.lookahead>=3&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+3-1])&e.hash_mask,i=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),e.prev_length=e.match_length,e.prev_match=e.match_start,e.match_length=2,0!==i&&e.prev_length<e.max_lazy_match&&e.strstart-i<=e.w_size-u&&(e.match_length=E(e,i),e.match_length<=5&&(1===e.strategy||3===e.match_length&&4096<e.strstart-e.match_start)&&(e.match_length=2)),e.prev_length>=3&&e.match_length<=e.prev_length){for(n=e.strstart+e.lookahead-3,r=a._tr_tally(e,e.strstart-1-e.prev_match,e.prev_length-3),e.lookahead-=e.prev_length-1,e.prev_length-=2;++e.strstart<=n&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+3-1])&e.hash_mask,i=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),0!=--e.prev_length;);if(e.match_available=0,e.match_length=2,e.strstart++,r&&(v(e,!1),0===e.strm.avail_out))return 1}else if(e.match_available){if((r=a._tr_tally(e,0,e.window[e.strstart-1]))&&v(e,!1),e.strstart++,e.lookahead--,0===e.strm.avail_out)return 1}else e.match_available=1,e.strstart++,e.lookahead--}return e.match_available&&(r=a._tr_tally(e,0,e.window[e.strstart-1]),e.match_available=0),e.insert=e.strstart<2?e.strstart:2,4===t?(v(e,!0),0===e.strm.avail_out?3:4):e.last_lit&&(v(e,!1),0===e.strm.avail_out)?1:2}function T(e,t,i,r,n){this.good_length=e,this.max_lazy=t,this.nice_length=i,this.max_chain=r,this.func=n}function S(){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 n.Buf16(1146),this.dyn_dtree=new n.Buf16(122),this.bl_tree=new n.Buf16(78),m(this.dyn_ltree),m(this.dyn_dtree),m(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new n.Buf16(16),this.heap=new n.Buf16(573),m(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new n.Buf16(573),m(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 A(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:h,e.adler=2===t.wrap?0:1,t.last_flush=0,a._tr_init(t),0):p(e,l)}function R(e){var t,i=A(e);return 0===i&&((t=e.state).window_size=2*t.w_size,m(t.head),t.max_lazy_match=r[t.level].max_lazy,t.good_match=r[t.level].good_length,t.nice_match=r[t.level].nice_length,t.max_chain_length=r[t.level].max_chain,t.strstart=0,t.block_start=0,t.lookahead=0,t.insert=0,t.match_length=t.prev_length=2,t.match_available=0,t.ins_h=0),i}function k(e,t,i,r,a,o){if(!e)return l;var s=1;if(-1===t&&(t=6),r<0?(s=0,r=-r):15<r&&(s=2,r-=16),a<1||9<a||8!==i||r<8||15<r||t<0||9<t||o<0||4<o)return p(e,l);8===r&&(r=9);var c=new S;return(e.state=c).strm=e,c.wrap=s,c.gzhead=null,c.w_bits=r,c.w_size=1<<c.w_bits,c.w_mask=c.w_size-1,c.hash_bits=a+7,c.hash_size=1<<c.hash_bits,c.hash_mask=c.hash_size-1,c.hash_shift=~~((c.hash_bits+3-1)/3),c.window=new n.Buf8(2*c.w_size),c.head=new n.Buf16(c.hash_size),c.prev=new n.Buf16(c.w_size),c.lit_bufsize=1<<a+6,c.pending_buf_size=4*c.lit_bufsize,c.pending_buf=new n.Buf8(c.pending_buf_size),c.d_buf=1*c.lit_bufsize,c.l_buf=3*c.lit_bufsize,c.level=t,c.strategy=o,c.method=i,R(e)}r=[new T(0,0,0,0,(function(e,t){var i=65535;for(i>e.pending_buf_size-5&&(i=e.pending_buf_size-5);;){if(e.lookahead<=1){if(b(e),0===e.lookahead&&0===t)return 1;if(0===e.lookahead)break}e.strstart+=e.lookahead,e.lookahead=0;var r=e.block_start+i;if((0===e.strstart||e.strstart>=r)&&(e.lookahead=e.strstart-r,e.strstart=r,v(e,!1),0===e.strm.avail_out)||e.strstart-e.block_start>=e.w_size-u&&(v(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,4===t?(v(e,!0),0===e.strm.avail_out?3:4):(e.strstart>e.block_start&&(v(e,!1),e.strm.avail_out),1)})),new T(4,4,8,4,w),new T(4,5,16,8,w),new T(4,6,32,32,w),new T(4,4,16,16,I),new T(8,16,32,32,I),new T(8,16,128,128,I),new T(8,32,128,256,I),new T(32,128,258,1024,I),new T(32,258,258,4096,I)],i.deflateInit=function(e,t){return k(e,t,8,15,8,0)},i.deflateInit2=k,i.deflateReset=R,i.deflateResetKeep=A,i.deflateSetHeader=function(e,t){return e&&e.state?2!==e.state.wrap?l:(e.state.gzhead=t,0):l},i.deflate=function(e,t){var i,n,o,c;if(!e||!e.state||5<t||t<0)return e?p(e,l):l;if(n=e.state,!e.output||!e.input&&0!==e.avail_in||666===n.status&&4!==t)return p(e,0===e.avail_out?-5:l);if(n.strm=e,i=n.last_flush,n.last_flush=t,42===n.status)if(2===n.wrap)e.adler=0,_(n,31),_(n,139),_(n,8),n.gzhead?(_(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)),_(n,255&n.gzhead.time),_(n,n.gzhead.time>>8&255),_(n,n.gzhead.time>>16&255),_(n,n.gzhead.time>>24&255),_(n,9===n.level?2:2<=n.strategy||n.level<2?4:0),_(n,255&n.gzhead.os),n.gzhead.extra&&n.gzhead.extra.length&&(_(n,255&n.gzhead.extra.length),_(n,n.gzhead.extra.length>>8&255)),n.gzhead.hcrc&&(e.adler=s(e.adler,n.pending_buf,n.pending,0)),n.gzindex=0,n.status=69):(_(n,0),_(n,0),_(n,0),_(n,0),_(n,0),_(n,9===n.level?2:2<=n.strategy||n.level<2?4:0),_(n,3),n.status=h);else{var u=8+(n.w_bits-8<<4)<<8;u|=(2<=n.strategy||n.level<2?0:n.level<6?1:6===n.level?2:3)<<6,0!==n.strstart&&(u|=32),u+=31-u%31,n.status=h,y(n,u),0!==n.strstart&&(y(n,e.adler>>>16),y(n,65535&e.adler)),e.adler=1}if(69===n.status)if(n.gzhead.extra){for(o=n.pending;n.gzindex<(65535&n.gzhead.extra.length)&&(n.pending!==n.pending_buf_size||(n.gzhead.hcrc&&n.pending>o&&(e.adler=s(e.adler,n.pending_buf,n.pending-o,o)),g(e),o=n.pending,n.pending!==n.pending_buf_size));)_(n,255&n.gzhead.extra[n.gzindex]),n.gzindex++;n.gzhead.hcrc&&n.pending>o&&(e.adler=s(e.adler,n.pending_buf,n.pending-o,o)),n.gzindex===n.gzhead.extra.length&&(n.gzindex=0,n.status=73)}else n.status=73;if(73===n.status)if(n.gzhead.name){o=n.pending;do{if(n.pending===n.pending_buf_size&&(n.gzhead.hcrc&&n.pending>o&&(e.adler=s(e.adler,n.pending_buf,n.pending-o,o)),g(e),o=n.pending,n.pending===n.pending_buf_size)){c=1;break}c=n.gzindex<n.gzhead.name.length?255&n.gzhead.name.charCodeAt(n.gzindex++):0,_(n,c)}while(0!==c);n.gzhead.hcrc&&n.pending>o&&(e.adler=s(e.adler,n.pending_buf,n.pending-o,o)),0===c&&(n.gzindex=0,n.status=91)}else n.status=91;if(91===n.status)if(n.gzhead.comment){o=n.pending;do{if(n.pending===n.pending_buf_size&&(n.gzhead.hcrc&&n.pending>o&&(e.adler=s(e.adler,n.pending_buf,n.pending-o,o)),g(e),o=n.pending,n.pending===n.pending_buf_size)){c=1;break}c=n.gzindex<n.gzhead.comment.length?255&n.gzhead.comment.charCodeAt(n.gzindex++):0,_(n,c)}while(0!==c);n.gzhead.hcrc&&n.pending>o&&(e.adler=s(e.adler,n.pending_buf,n.pending-o,o)),0===c&&(n.status=103)}else n.status=103;if(103===n.status&&(n.gzhead.hcrc?(n.pending+2>n.pending_buf_size&&g(e),n.pending+2<=n.pending_buf_size&&(_(n,255&e.adler),_(n,e.adler>>8&255),e.adler=0,n.status=h)):n.status=h),0!==n.pending){if(g(e),0===e.avail_out)return n.last_flush=-1,0}else if(0===e.avail_in&&f(t)<=f(i)&&4!==t)return p(e,-5);if(666===n.status&&0!==e.avail_in)return p(e,-5);if(0!==e.avail_in||0!==n.lookahead||0!==t&&666!==n.status){var E=2===n.strategy?function(e,t){for(var i;;){if(0===e.lookahead&&(b(e),0===e.lookahead)){if(0===t)return 1;break}if(e.match_length=0,i=a._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,i&&(v(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,4===t?(v(e,!0),0===e.strm.avail_out?3:4):e.last_lit&&(v(e,!1),0===e.strm.avail_out)?1:2}(n,t):3===n.strategy?function(e,t){for(var i,r,n,o,s=e.window;;){if(e.lookahead<=d){if(b(e),e.lookahead<=d&&0===t)return 1;if(0===e.lookahead)break}if(e.match_length=0,e.lookahead>=3&&0<e.strstart&&(r=s[n=e.strstart-1])===s[++n]&&r===s[++n]&&r===s[++n]){o=e.strstart+d;do{}while(r===s[++n]&&r===s[++n]&&r===s[++n]&&r===s[++n]&&r===s[++n]&&r===s[++n]&&r===s[++n]&&r===s[++n]&&n<o);e.match_length=d-(o-n),e.match_length>e.lookahead&&(e.match_length=e.lookahead)}if(e.match_length>=3?(i=a._tr_tally(e,1,e.match_length-3),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(i=a._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),i&&(v(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,4===t?(v(e,!0),0===e.strm.avail_out?3:4):e.last_lit&&(v(e,!1),0===e.strm.avail_out)?1:2}(n,t):r[n.level].func(n,t);if(3!==E&&4!==E||(n.status=666),1===E||3===E)return 0===e.avail_out&&(n.last_flush=-1),0;if(2===E&&(1===t?a._tr_align(n):5!==t&&(a._tr_stored_block(n,0,0,!1),3===t&&(m(n.head),0===n.lookahead&&(n.strstart=0,n.block_start=0,n.insert=0))),g(e),0===e.avail_out))return n.last_flush=-1,0}return 4!==t?0:n.wrap<=0?1:(2===n.wrap?(_(n,255&e.adler),_(n,e.adler>>8&255),_(n,e.adler>>16&255),_(n,e.adler>>24&255),_(n,255&e.total_in),_(n,e.total_in>>8&255),_(n,e.total_in>>16&255),_(n,e.total_in>>24&255)):(y(n,e.adler>>>16),y(n,65535&e.adler)),g(e),0<n.wrap&&(n.wrap=-n.wrap),0!==n.pending?0:1)},i.deflateEnd=function(e){var t;return e&&e.state?42!==(t=e.state.status)&&69!==t&&73!==t&&91!==t&&103!==t&&t!==h&&666!==t?p(e,l):(e.state=null,t===h?p(e,-3):0):l},i.deflateSetDictionary=function(e,t){var i,r,a,s,c,d,u,h,p=t.length;if(!e||!e.state||2===(s=(i=e.state).wrap)||1===s&&42!==i.status||i.lookahead)return l;for(1===s&&(e.adler=o(e.adler,t,p,0)),i.wrap=0,p>=i.w_size&&(0===s&&(m(i.head),i.strstart=0,i.block_start=0,i.insert=0),h=new n.Buf8(i.w_size),n.arraySet(h,t,p-i.w_size,i.w_size,0),t=h,p=i.w_size),c=e.avail_in,d=e.next_in,u=e.input,e.avail_in=p,e.next_in=0,e.input=t,b(i);i.lookahead>=3;){for(r=i.strstart,a=i.lookahead-2;i.ins_h=(i.ins_h<<i.hash_shift^i.window[r+3-1])&i.hash_mask,i.prev[r&i.w_mask]=i.head[i.ins_h],i.head[i.ins_h]=r,r++,--a;);i.strstart=r,i.lookahead=2,b(i)}return i.strstart+=i.lookahead,i.block_start=i.strstart,i.insert=i.lookahead,i.lookahead=0,i.match_length=i.prev_length=2,i.match_available=0,e.next_in=d,e.input=u,e.avail_in=c,i.wrap=s,0},i.deflateInfo="pako deflate (from Nodeca project)"},{"../utils/common":41,"./adler32":43,"./crc32":45,"./messages":51,"./trees":52}],47:[function(e,t,i){t.exports=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}},{}],48:[function(e,t,i){t.exports=function(e,t){var i,r,n,a,o,s,c,l,d,u,h,p,f,m,g,v,_,y,E,b,w,I,T,S,A;i=e.state,r=e.next_in,S=e.input,n=r+(e.avail_in-5),a=e.next_out,A=e.output,o=a-(t-e.avail_out),s=a+(e.avail_out-257),c=i.dmax,l=i.wsize,d=i.whave,u=i.wnext,h=i.window,p=i.hold,f=i.bits,m=i.lencode,g=i.distcode,v=(1<<i.lenbits)-1,_=(1<<i.distbits)-1;e:do{f<15&&(p+=S[r++]<<f,f+=8,p+=S[r++]<<f,f+=8),y=m[p&v];t:for(;;){if(p>>>=E=y>>>24,f-=E,0==(E=y>>>16&255))A[a++]=65535&y;else{if(!(16&E)){if(!(64&E)){y=m[(65535&y)+(p&(1<<E)-1)];continue t}if(32&E){i.mode=12;break e}e.msg="invalid literal/length code",i.mode=30;break e}b=65535&y,(E&=15)&&(f<E&&(p+=S[r++]<<f,f+=8),b+=p&(1<<E)-1,p>>>=E,f-=E),f<15&&(p+=S[r++]<<f,f+=8,p+=S[r++]<<f,f+=8),y=g[p&_];i:for(;;){if(p>>>=E=y>>>24,f-=E,!(16&(E=y>>>16&255))){if(!(64&E)){y=g[(65535&y)+(p&(1<<E)-1)];continue i}e.msg="invalid distance code",i.mode=30;break e}if(w=65535&y,f<(E&=15)&&(p+=S[r++]<<f,(f+=8)<E&&(p+=S[r++]<<f,f+=8)),c<(w+=p&(1<<E)-1)){e.msg="invalid distance too far back",i.mode=30;break e}if(p>>>=E,f-=E,(E=a-o)<w){if(d<(E=w-E)&&i.sane){e.msg="invalid distance too far back",i.mode=30;break e}if(T=h,(I=0)===u){if(I+=l-E,E<b){for(b-=E;A[a++]=h[I++],--E;);I=a-w,T=A}}else if(u<E){if(I+=l+u-E,(E-=u)<b){for(b-=E;A[a++]=h[I++],--E;);if(I=0,u<b){for(b-=E=u;A[a++]=h[I++],--E;);I=a-w,T=A}}}else if(I+=u-E,E<b){for(b-=E;A[a++]=h[I++],--E;);I=a-w,T=A}for(;2<b;)A[a++]=T[I++],A[a++]=T[I++],A[a++]=T[I++],b-=3;b&&(A[a++]=T[I++],1<b&&(A[a++]=T[I++]))}else{for(I=a-w;A[a++]=A[I++],A[a++]=A[I++],A[a++]=A[I++],2<(b-=3););b&&(A[a++]=A[I++],1<b&&(A[a++]=A[I++]))}break}}break}}while(r<n&&a<s);r-=b=f>>3,p&=(1<<(f-=b<<3))-1,e.next_in=r,e.next_out=a,e.avail_in=r<n?n-r+5:5-(r-n),e.avail_out=a<s?s-a+257:257-(a-s),i.hold=p,i.bits=f}},{}],49:[function(e,t,i){var r=e("../utils/common"),n=e("./adler32"),a=e("./crc32"),o=e("./inffast"),s=e("./inftrees"),c=-2;function l(e){return(e>>>24&255)+(e>>>8&65280)+((65280&e)<<8)+((255&e)<<24)}function d(){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 r.Buf16(320),this.work=new r.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function u(e){var t;return e&&e.state?(t=e.state,e.total_in=e.total_out=t.total=0,e.msg="",t.wrap&&(e.adler=1&t.wrap),t.mode=1,t.last=0,t.havedict=0,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new r.Buf32(852),t.distcode=t.distdyn=new r.Buf32(592),t.sane=1,t.back=-1,0):c}function h(e){var t;return e&&e.state?((t=e.state).wsize=0,t.whave=0,t.wnext=0,u(e)):c}function p(e,t){var i,r;return e&&e.state?(r=e.state,t<0?(i=0,t=-t):(i=1+(t>>4),t<48&&(t&=15)),t&&(t<8||15<t)?c:(null!==r.window&&r.wbits!==t&&(r.window=null),r.wrap=i,r.wbits=t,h(e))):c}function f(e,t){var i,r;return e?(r=new d,(e.state=r).window=null,0!==(i=p(e,t))&&(e.state=null),i):c}var m,g,v=!0;function _(e){if(v){var t;for(m=new r.Buf32(512),g=new r.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(s(1,e.lens,0,288,m,0,e.work,{bits:9}),t=0;t<32;)e.lens[t++]=5;s(2,e.lens,0,32,g,0,e.work,{bits:5}),v=!1}e.lencode=m,e.lenbits=9,e.distcode=g,e.distbits=5}function y(e,t,i,n){var a,o=e.state;return null===o.window&&(o.wsize=1<<o.wbits,o.wnext=0,o.whave=0,o.window=new r.Buf8(o.wsize)),n>=o.wsize?(r.arraySet(o.window,t,i-o.wsize,o.wsize,0),o.wnext=0,o.whave=o.wsize):(n<(a=o.wsize-o.wnext)&&(a=n),r.arraySet(o.window,t,i-n,a,o.wnext),(n-=a)?(r.arraySet(o.window,t,i-n,n,0),o.wnext=n,o.whave=o.wsize):(o.wnext+=a,o.wnext===o.wsize&&(o.wnext=0),o.whave<o.wsize&&(o.whave+=a))),0}i.inflateReset=h,i.inflateReset2=p,i.inflateResetKeep=u,i.inflateInit=function(e){return f(e,15)},i.inflateInit2=f,i.inflate=function(e,t){var i,d,u,h,p,f,m,g,v,E,b,w,I,T,S,A,R,k,C,D,O,L,N,x,P=0,M=new r.Buf8(4),U=[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 c;12===(i=e.state).mode&&(i.mode=13),p=e.next_out,u=e.output,m=e.avail_out,h=e.next_in,d=e.input,f=e.avail_in,g=i.hold,v=i.bits,E=f,b=m,L=0;e:for(;;)switch(i.mode){case 1:if(0===i.wrap){i.mode=13;break}for(;v<16;){if(0===f)break e;f--,g+=d[h++]<<v,v+=8}if(2&i.wrap&&35615===g){M[i.check=0]=255&g,M[1]=g>>>8&255,i.check=a(i.check,M,2,0),v=g=0,i.mode=2;break}if(i.flags=0,i.head&&(i.head.done=!1),!(1&i.wrap)||(((255&g)<<8)+(g>>8))%31){e.msg="incorrect header check",i.mode=30;break}if(8!=(15&g)){e.msg="unknown compression method",i.mode=30;break}if(v-=4,O=8+(15&(g>>>=4)),0===i.wbits)i.wbits=O;else if(O>i.wbits){e.msg="invalid window size",i.mode=30;break}i.dmax=1<<O,e.adler=i.check=1,i.mode=512&g?10:12,v=g=0;break;case 2:for(;v<16;){if(0===f)break e;f--,g+=d[h++]<<v,v+=8}if(i.flags=g,8!=(255&i.flags)){e.msg="unknown compression method",i.mode=30;break}if(57344&i.flags){e.msg="unknown header flags set",i.mode=30;break}i.head&&(i.head.text=g>>8&1),512&i.flags&&(M[0]=255&g,M[1]=g>>>8&255,i.check=a(i.check,M,2,0)),v=g=0,i.mode=3;case 3:for(;v<32;){if(0===f)break e;f--,g+=d[h++]<<v,v+=8}i.head&&(i.head.time=g),512&i.flags&&(M[0]=255&g,M[1]=g>>>8&255,M[2]=g>>>16&255,M[3]=g>>>24&255,i.check=a(i.check,M,4,0)),v=g=0,i.mode=4;case 4:for(;v<16;){if(0===f)break e;f--,g+=d[h++]<<v,v+=8}i.head&&(i.head.xflags=255&g,i.head.os=g>>8),512&i.flags&&(M[0]=255&g,M[1]=g>>>8&255,i.check=a(i.check,M,2,0)),v=g=0,i.mode=5;case 5:if(1024&i.flags){for(;v<16;){if(0===f)break e;f--,g+=d[h++]<<v,v+=8}i.length=g,i.head&&(i.head.extra_len=g),512&i.flags&&(M[0]=255&g,M[1]=g>>>8&255,i.check=a(i.check,M,2,0)),v=g=0}else i.head&&(i.head.extra=null);i.mode=6;case 6:if(1024&i.flags&&(f<(w=i.length)&&(w=f),w&&(i.head&&(O=i.head.extra_len-i.length,i.head.extra||(i.head.extra=new Array(i.head.extra_len)),r.arraySet(i.head.extra,d,h,w,O)),512&i.flags&&(i.check=a(i.check,d,w,h)),f-=w,h+=w,i.length-=w),i.length))break e;i.length=0,i.mode=7;case 7:if(2048&i.flags){if(0===f)break e;for(w=0;O=d[h+w++],i.head&&O&&i.length<65536&&(i.head.name+=String.fromCharCode(O)),O&&w<f;);if(512&i.flags&&(i.check=a(i.check,d,w,h)),f-=w,h+=w,O)break e}else i.head&&(i.head.name=null);i.length=0,i.mode=8;case 8:if(4096&i.flags){if(0===f)break e;for(w=0;O=d[h+w++],i.head&&O&&i.length<65536&&(i.head.comment+=String.fromCharCode(O)),O&&w<f;);if(512&i.flags&&(i.check=a(i.check,d,w,h)),f-=w,h+=w,O)break e}else i.head&&(i.head.comment=null);i.mode=9;case 9:if(512&i.flags){for(;v<16;){if(0===f)break e;f--,g+=d[h++]<<v,v+=8}if(g!==(65535&i.check)){e.msg="header crc mismatch",i.mode=30;break}v=g=0}i.head&&(i.head.hcrc=i.flags>>9&1,i.head.done=!0),e.adler=i.check=0,i.mode=12;break;case 10:for(;v<32;){if(0===f)break e;f--,g+=d[h++]<<v,v+=8}e.adler=i.check=l(g),v=g=0,i.mode=11;case 11:if(0===i.havedict)return e.next_out=p,e.avail_out=m,e.next_in=h,e.avail_in=f,i.hold=g,i.bits=v,2;e.adler=i.check=1,i.mode=12;case 12:if(5===t||6===t)break e;case 13:if(i.last){g>>>=7&v,v-=7&v,i.mode=27;break}for(;v<3;){if(0===f)break e;f--,g+=d[h++]<<v,v+=8}switch(i.last=1&g,v-=1,3&(g>>>=1)){case 0:i.mode=14;break;case 1:if(_(i),i.mode=20,6!==t)break;g>>>=2,v-=2;break e;case 2:i.mode=17;break;case 3:e.msg="invalid block type",i.mode=30}g>>>=2,v-=2;break;case 14:for(g>>>=7&v,v-=7&v;v<32;){if(0===f)break e;f--,g+=d[h++]<<v,v+=8}if((65535&g)!=(g>>>16^65535)){e.msg="invalid stored block lengths",i.mode=30;break}if(i.length=65535&g,v=g=0,i.mode=15,6===t)break e;case 15:i.mode=16;case 16:if(w=i.length){if(f<w&&(w=f),m<w&&(w=m),0===w)break e;r.arraySet(u,d,h,w,p),f-=w,h+=w,m-=w,p+=w,i.length-=w;break}i.mode=12;break;case 17:for(;v<14;){if(0===f)break e;f--,g+=d[h++]<<v,v+=8}if(i.nlen=257+(31&g),g>>>=5,v-=5,i.ndist=1+(31&g),g>>>=5,v-=5,i.ncode=4+(15&g),g>>>=4,v-=4,286<i.nlen||30<i.ndist){e.msg="too many length or distance symbols",i.mode=30;break}i.have=0,i.mode=18;case 18:for(;i.have<i.ncode;){for(;v<3;){if(0===f)break e;f--,g+=d[h++]<<v,v+=8}i.lens[U[i.have++]]=7&g,g>>>=3,v-=3}for(;i.have<19;)i.lens[U[i.have++]]=0;if(i.lencode=i.lendyn,i.lenbits=7,N={bits:i.lenbits},L=s(0,i.lens,0,19,i.lencode,0,i.work,N),i.lenbits=N.bits,L){e.msg="invalid code lengths set",i.mode=30;break}i.have=0,i.mode=19;case 19:for(;i.have<i.nlen+i.ndist;){for(;A=(P=i.lencode[g&(1<<i.lenbits)-1])>>>16&255,R=65535&P,!((S=P>>>24)<=v);){if(0===f)break e;f--,g+=d[h++]<<v,v+=8}if(R<16)g>>>=S,v-=S,i.lens[i.have++]=R;else{if(16===R){for(x=S+2;v<x;){if(0===f)break e;f--,g+=d[h++]<<v,v+=8}if(g>>>=S,v-=S,0===i.have){e.msg="invalid bit length repeat",i.mode=30;break}O=i.lens[i.have-1],w=3+(3&g),g>>>=2,v-=2}else if(17===R){for(x=S+3;v<x;){if(0===f)break e;f--,g+=d[h++]<<v,v+=8}v-=S,O=0,w=3+(7&(g>>>=S)),g>>>=3,v-=3}else{for(x=S+7;v<x;){if(0===f)break e;f--,g+=d[h++]<<v,v+=8}v-=S,O=0,w=11+(127&(g>>>=S)),g>>>=7,v-=7}if(i.have+w>i.nlen+i.ndist){e.msg="invalid bit length repeat",i.mode=30;break}for(;w--;)i.lens[i.have++]=O}}if(30===i.mode)break;if(0===i.lens[256]){e.msg="invalid code -- missing end-of-block",i.mode=30;break}if(i.lenbits=9,N={bits:i.lenbits},L=s(1,i.lens,0,i.nlen,i.lencode,0,i.work,N),i.lenbits=N.bits,L){e.msg="invalid literal/lengths set",i.mode=30;break}if(i.distbits=6,i.distcode=i.distdyn,N={bits:i.distbits},L=s(2,i.lens,i.nlen,i.ndist,i.distcode,0,i.work,N),i.distbits=N.bits,L){e.msg="invalid distances set",i.mode=30;break}if(i.mode=20,6===t)break e;case 20:i.mode=21;case 21:if(6<=f&&258<=m){e.next_out=p,e.avail_out=m,e.next_in=h,e.avail_in=f,i.hold=g,i.bits=v,o(e,b),p=e.next_out,u=e.output,m=e.avail_out,h=e.next_in,d=e.input,f=e.avail_in,g=i.hold,v=i.bits,12===i.mode&&(i.back=-1);break}for(i.back=0;A=(P=i.lencode[g&(1<<i.lenbits)-1])>>>16&255,R=65535&P,!((S=P>>>24)<=v);){if(0===f)break e;f--,g+=d[h++]<<v,v+=8}if(A&&!(240&A)){for(k=S,C=A,D=R;A=(P=i.lencode[D+((g&(1<<k+C)-1)>>k)])>>>16&255,R=65535&P,!(k+(S=P>>>24)<=v);){if(0===f)break e;f--,g+=d[h++]<<v,v+=8}g>>>=k,v-=k,i.back+=k}if(g>>>=S,v-=S,i.back+=S,i.length=R,0===A){i.mode=26;break}if(32&A){i.back=-1,i.mode=12;break}if(64&A){e.msg="invalid literal/length code",i.mode=30;break}i.extra=15&A,i.mode=22;case 22:if(i.extra){for(x=i.extra;v<x;){if(0===f)break e;f--,g+=d[h++]<<v,v+=8}i.length+=g&(1<<i.extra)-1,g>>>=i.extra,v-=i.extra,i.back+=i.extra}i.was=i.length,i.mode=23;case 23:for(;A=(P=i.distcode[g&(1<<i.distbits)-1])>>>16&255,R=65535&P,!((S=P>>>24)<=v);){if(0===f)break e;f--,g+=d[h++]<<v,v+=8}if(!(240&A)){for(k=S,C=A,D=R;A=(P=i.distcode[D+((g&(1<<k+C)-1)>>k)])>>>16&255,R=65535&P,!(k+(S=P>>>24)<=v);){if(0===f)break e;f--,g+=d[h++]<<v,v+=8}g>>>=k,v-=k,i.back+=k}if(g>>>=S,v-=S,i.back+=S,64&A){e.msg="invalid distance code",i.mode=30;break}i.offset=R,i.extra=15&A,i.mode=24;case 24:if(i.extra){for(x=i.extra;v<x;){if(0===f)break e;f--,g+=d[h++]<<v,v+=8}i.offset+=g&(1<<i.extra)-1,g>>>=i.extra,v-=i.extra,i.back+=i.extra}if(i.offset>i.dmax){e.msg="invalid distance too far back",i.mode=30;break}i.mode=25;case 25:if(0===m)break e;if(w=b-m,i.offset>w){if((w=i.offset-w)>i.whave&&i.sane){e.msg="invalid distance too far back",i.mode=30;break}I=w>i.wnext?(w-=i.wnext,i.wsize-w):i.wnext-w,w>i.length&&(w=i.length),T=i.window}else T=u,I=p-i.offset,w=i.length;for(m<w&&(w=m),m-=w,i.length-=w;u[p++]=T[I++],--w;);0===i.length&&(i.mode=21);break;case 26:if(0===m)break e;u[p++]=i.length,m--,i.mode=21;break;case 27:if(i.wrap){for(;v<32;){if(0===f)break e;f--,g|=d[h++]<<v,v+=8}if(b-=m,e.total_out+=b,i.total+=b,b&&(e.adler=i.check=i.flags?a(i.check,u,b,p-b):n(i.check,u,b,p-b)),b=m,(i.flags?g:l(g))!==i.check){e.msg="incorrect data check",i.mode=30;break}v=g=0}i.mode=28;case 28:if(i.wrap&&i.flags){for(;v<32;){if(0===f)break e;f--,g+=d[h++]<<v,v+=8}if(g!==(4294967295&i.total)){e.msg="incorrect length check",i.mode=30;break}v=g=0}i.mode=29;case 29:L=1;break e;case 30:L=-3;break e;case 31:return-4;default:return c}return e.next_out=p,e.avail_out=m,e.next_in=h,e.avail_in=f,i.hold=g,i.bits=v,(i.wsize||b!==e.avail_out&&i.mode<30&&(i.mode<27||4!==t))&&y(e,e.output,e.next_out,b-e.avail_out)?(i.mode=31,-4):(E-=e.avail_in,b-=e.avail_out,e.total_in+=E,e.total_out+=b,i.total+=b,i.wrap&&b&&(e.adler=i.check=i.flags?a(i.check,u,b,e.next_out-b):n(i.check,u,b,e.next_out-b)),e.data_type=i.bits+(i.last?64:0)+(12===i.mode?128:0)+(20===i.mode||15===i.mode?256:0),(0==E&&0===b||4===t)&&0===L&&(L=-5),L)},i.inflateEnd=function(e){if(!e||!e.state)return c;var t=e.state;return t.window&&(t.window=null),e.state=null,0},i.inflateGetHeader=function(e,t){var i;return e&&e.state&&2&(i=e.state).wrap?((i.head=t).done=!1,0):c},i.inflateSetDictionary=function(e,t){var i,r=t.length;return e&&e.state?0!==(i=e.state).wrap&&11!==i.mode?c:11===i.mode&&n(1,t,r,0)!==i.check?-3:y(e,t,r,r)?(i.mode=31,-4):(i.havedict=1,0):c},i.inflateInfo="pako inflate (from Nodeca project)"},{"../utils/common":41,"./adler32":43,"./crc32":45,"./inffast":48,"./inftrees":50}],50:[function(e,t,i){var r=e("../utils/common"),n=[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],a=[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],o=[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],s=[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];t.exports=function(e,t,i,c,l,d,u,h){var p,f,m,g,v,_,y,E,b,w=h.bits,I=0,T=0,S=0,A=0,R=0,k=0,C=0,D=0,O=0,L=0,N=null,x=0,P=new r.Buf16(16),M=new r.Buf16(16),U=null,B=0;for(I=0;I<=15;I++)P[I]=0;for(T=0;T<c;T++)P[t[i+T]]++;for(R=w,A=15;1<=A&&0===P[A];A--);if(A<R&&(R=A),0===A)return l[d++]=20971520,l[d++]=20971520,h.bits=1,0;for(S=1;S<A&&0===P[S];S++);for(R<S&&(R=S),I=D=1;I<=15;I++)if(D<<=1,(D-=P[I])<0)return-1;if(0<D&&(0===e||1!==A))return-1;for(M[1]=0,I=1;I<15;I++)M[I+1]=M[I]+P[I];for(T=0;T<c;T++)0!==t[i+T]&&(u[M[t[i+T]]++]=T);if(_=0===e?(N=U=u,19):1===e?(N=n,x-=257,U=a,B-=257,256):(N=o,U=s,-1),I=S,v=d,C=T=L=0,m=-1,g=(O=1<<(k=R))-1,1===e&&852<O||2===e&&592<O)return 1;for(;;){for(y=I-C,b=u[T]<_?(E=0,u[T]):u[T]>_?(E=U[B+u[T]],N[x+u[T]]):(E=96,0),p=1<<I-C,S=f=1<<k;l[v+(L>>C)+(f-=p)]=y<<24|E<<16|b,0!==f;);for(p=1<<I-1;L&p;)p>>=1;if(0!==p?(L&=p-1,L+=p):L=0,T++,0==--P[I]){if(I===A)break;I=t[i+u[T]]}if(R<I&&(L&g)!==m){for(0===C&&(C=R),v+=S,D=1<<(k=I-C);k+C<A&&!((D-=P[k+C])<=0);)k++,D<<=1;if(O+=1<<k,1===e&&852<O||2===e&&592<O)return 1;l[m=L&g]=R<<24|k<<16|v-d}}return 0!==L&&(l[v+L]=I-C<<24|64<<16),h.bits=R,0}},{"../utils/common":41}],51:[function(e,t,i){t.exports={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"}},{}],52:[function(e,t,i){var r=e("../utils/common");function n(e){for(var t=e.length;0<=--t;)e[t]=0}var a=256,o=286,s=30,c=15,l=[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],d=[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],u=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],h=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],p=new Array(576);n(p);var f=new Array(60);n(f);var m=new Array(512);n(m);var g=new Array(256);n(g);var v=new Array(29);n(v);var _,y,E,b=new Array(s);function w(e,t,i,r,n){this.static_tree=e,this.extra_bits=t,this.extra_base=i,this.elems=r,this.max_length=n,this.has_stree=e&&e.length}function I(e,t){this.dyn_tree=e,this.max_code=0,this.stat_desc=t}function T(e){return e<256?m[e]:m[256+(e>>>7)]}function S(e,t){e.pending_buf[e.pending++]=255&t,e.pending_buf[e.pending++]=t>>>8&255}function A(e,t,i){e.bi_valid>16-i?(e.bi_buf|=t<<e.bi_valid&65535,S(e,e.bi_buf),e.bi_buf=t>>16-e.bi_valid,e.bi_valid+=i-16):(e.bi_buf|=t<<e.bi_valid&65535,e.bi_valid+=i)}function R(e,t,i){A(e,i[2*t],i[2*t+1])}function k(e,t){for(var i=0;i|=1&e,e>>>=1,i<<=1,0<--t;);return i>>>1}function C(e,t,i){var r,n,a=new Array(16),o=0;for(r=1;r<=c;r++)a[r]=o=o+i[r-1]<<1;for(n=0;n<=t;n++){var s=e[2*n+1];0!==s&&(e[2*n]=k(a[s]++,s))}}function D(e){var t;for(t=0;t<o;t++)e.dyn_ltree[2*t]=0;for(t=0;t<s;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 O(e){8<e.bi_valid?S(e,e.bi_buf):0<e.bi_valid&&(e.pending_buf[e.pending++]=e.bi_buf),e.bi_buf=0,e.bi_valid=0}function L(e,t,i,r){var n=2*t,a=2*i;return e[n]<e[a]||e[n]===e[a]&&r[t]<=r[i]}function N(e,t,i){for(var r=e.heap[i],n=i<<1;n<=e.heap_len&&(n<e.heap_len&&L(t,e.heap[n+1],e.heap[n],e.depth)&&n++,!L(t,r,e.heap[n],e.depth));)e.heap[i]=e.heap[n],i=n,n<<=1;e.heap[i]=r}function x(e,t,i){var r,n,o,s,c=0;if(0!==e.last_lit)for(;r=e.pending_buf[e.d_buf+2*c]<<8|e.pending_buf[e.d_buf+2*c+1],n=e.pending_buf[e.l_buf+c],c++,0===r?R(e,n,t):(R(e,(o=g[n])+a+1,t),0!==(s=l[o])&&A(e,n-=v[o],s),R(e,o=T(--r),i),0!==(s=d[o])&&A(e,r-=b[o],s)),c<e.last_lit;);R(e,256,t)}function P(e,t){var i,r,n,a=t.dyn_tree,o=t.stat_desc.static_tree,s=t.stat_desc.has_stree,l=t.stat_desc.elems,d=-1;for(e.heap_len=0,e.heap_max=573,i=0;i<l;i++)0!==a[2*i]?(e.heap[++e.heap_len]=d=i,e.depth[i]=0):a[2*i+1]=0;for(;e.heap_len<2;)a[2*(n=e.heap[++e.heap_len]=d<2?++d:0)]=1,e.depth[n]=0,e.opt_len--,s&&(e.static_len-=o[2*n+1]);for(t.max_code=d,i=e.heap_len>>1;1<=i;i--)N(e,a,i);for(n=l;i=e.heap[1],e.heap[1]=e.heap[e.heap_len--],N(e,a,1),r=e.heap[1],e.heap[--e.heap_max]=i,e.heap[--e.heap_max]=r,a[2*n]=a[2*i]+a[2*r],e.depth[n]=(e.depth[i]>=e.depth[r]?e.depth[i]:e.depth[r])+1,a[2*i+1]=a[2*r+1]=n,e.heap[1]=n++,N(e,a,1),2<=e.heap_len;);e.heap[--e.heap_max]=e.heap[1],function(e,t){var i,r,n,a,o,s,l=t.dyn_tree,d=t.max_code,u=t.stat_desc.static_tree,h=t.stat_desc.has_stree,p=t.stat_desc.extra_bits,f=t.stat_desc.extra_base,m=t.stat_desc.max_length,g=0;for(a=0;a<=c;a++)e.bl_count[a]=0;for(l[2*e.heap[e.heap_max]+1]=0,i=e.heap_max+1;i<573;i++)m<(a=l[2*l[2*(r=e.heap[i])+1]+1]+1)&&(a=m,g++),l[2*r+1]=a,d<r||(e.bl_count[a]++,o=0,f<=r&&(o=p[r-f]),s=l[2*r],e.opt_len+=s*(a+o),h&&(e.static_len+=s*(u[2*r+1]+o)));if(0!==g){do{for(a=m-1;0===e.bl_count[a];)a--;e.bl_count[a]--,e.bl_count[a+1]+=2,e.bl_count[m]--,g-=2}while(0<g);for(a=m;0!==a;a--)for(r=e.bl_count[a];0!==r;)d<(n=e.heap[--i])||(l[2*n+1]!==a&&(e.opt_len+=(a-l[2*n+1])*l[2*n],l[2*n+1]=a),r--)}}(e,t),C(a,d,e.bl_count)}function M(e,t,i){var r,n,a=-1,o=t[1],s=0,c=7,l=4;for(0===o&&(c=138,l=3),t[2*(i+1)+1]=65535,r=0;r<=i;r++)n=o,o=t[2*(r+1)+1],++s<c&&n===o||(s<l?e.bl_tree[2*n]+=s:0!==n?(n!==a&&e.bl_tree[2*n]++,e.bl_tree[32]++):s<=10?e.bl_tree[34]++:e.bl_tree[36]++,a=n,l=(s=0)===o?(c=138,3):n===o?(c=6,3):(c=7,4))}function U(e,t,i){var r,n,a=-1,o=t[1],s=0,c=7,l=4;for(0===o&&(c=138,l=3),r=0;r<=i;r++)if(n=o,o=t[2*(r+1)+1],!(++s<c&&n===o)){if(s<l)for(;R(e,n,e.bl_tree),0!=--s;);else 0!==n?(n!==a&&(R(e,n,e.bl_tree),s--),R(e,16,e.bl_tree),A(e,s-3,2)):s<=10?(R(e,17,e.bl_tree),A(e,s-3,3)):(R(e,18,e.bl_tree),A(e,s-11,7));a=n,l=(s=0)===o?(c=138,3):n===o?(c=6,3):(c=7,4)}}n(b);var B=!1;function F(e,t,i,n){var a,o,s;A(e,0+(n?1:0),3),o=t,s=i,O(a=e),S(a,s),S(a,~s),r.arraySet(a.pending_buf,a.window,o,s,a.pending),a.pending+=s}i._tr_init=function(e){B||(function(){var e,t,i,r,n,a=new Array(16);for(r=i=0;r<28;r++)for(v[r]=i,e=0;e<1<<l[r];e++)g[i++]=r;for(g[i-1]=r,r=n=0;r<16;r++)for(b[r]=n,e=0;e<1<<d[r];e++)m[n++]=r;for(n>>=7;r<s;r++)for(b[r]=n<<7,e=0;e<1<<d[r]-7;e++)m[256+n++]=r;for(t=0;t<=c;t++)a[t]=0;for(e=0;e<=143;)p[2*e+1]=8,e++,a[8]++;for(;e<=255;)p[2*e+1]=9,e++,a[9]++;for(;e<=279;)p[2*e+1]=7,e++,a[7]++;for(;e<=287;)p[2*e+1]=8,e++,a[8]++;for(C(p,287,a),e=0;e<s;e++)f[2*e+1]=5,f[2*e]=k(e,5);_=new w(p,l,257,o,c),y=new w(f,d,0,s,c),E=new w(new Array(0),u,0,19,7)}(),B=!0),e.l_desc=new I(e.dyn_ltree,_),e.d_desc=new I(e.dyn_dtree,y),e.bl_desc=new I(e.bl_tree,E),e.bi_buf=0,e.bi_valid=0,D(e)},i._tr_stored_block=F,i._tr_flush_block=function(e,t,i,r){var n,o,s=0;0<e.level?(2===e.strm.data_type&&(e.strm.data_type=function(e){var t,i=4093624447;for(t=0;t<=31;t++,i>>>=1)if(1&i&&0!==e.dyn_ltree[2*t])return 0;if(0!==e.dyn_ltree[18]||0!==e.dyn_ltree[20]||0!==e.dyn_ltree[26])return 1;for(t=32;t<a;t++)if(0!==e.dyn_ltree[2*t])return 1;return 0}(e)),P(e,e.l_desc),P(e,e.d_desc),s=function(e){var t;for(M(e,e.dyn_ltree,e.l_desc.max_code),M(e,e.dyn_dtree,e.d_desc.max_code),P(e,e.bl_desc),t=18;3<=t&&0===e.bl_tree[2*h[t]+1];t--);return e.opt_len+=3*(t+1)+5+5+4,t}(e),n=e.opt_len+3+7>>>3,(o=e.static_len+3+7>>>3)<=n&&(n=o)):n=o=i+5,i+4<=n&&-1!==t?F(e,t,i,r):4===e.strategy||o===n?(A(e,2+(r?1:0),3),x(e,p,f)):(A(e,4+(r?1:0),3),function(e,t,i,r){var n;for(A(e,t-257,5),A(e,i-1,5),A(e,r-4,4),n=0;n<r;n++)A(e,e.bl_tree[2*h[n]+1],3);U(e,e.dyn_ltree,t-1),U(e,e.dyn_dtree,i-1)}(e,e.l_desc.max_code+1,e.d_desc.max_code+1,s+1),x(e,e.dyn_ltree,e.dyn_dtree)),D(e),r&&O(e)},i._tr_tally=function(e,t,i){return e.pending_buf[e.d_buf+2*e.last_lit]=t>>>8&255,e.pending_buf[e.d_buf+2*e.last_lit+1]=255&t,e.pending_buf[e.l_buf+e.last_lit]=255&i,e.last_lit++,0===t?e.dyn_ltree[2*i]++:(e.matches++,t--,e.dyn_ltree[2*(g[i]+a+1)]++,e.dyn_dtree[2*T(t)]++),e.last_lit===e.lit_bufsize-1},i._tr_align=function(e){var t;A(e,2,3),R(e,256,p),16===(t=e).bi_valid?(S(t,t.bi_buf),t.bi_buf=0,t.bi_valid=0):8<=t.bi_valid&&(t.pending_buf[t.pending++]=255&t.bi_buf,t.bi_buf>>=8,t.bi_valid-=8)}},{"../utils/common":41}],53:[function(e,t,i){t.exports=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}},{}],54:[function(e,t,i){(function(e){!function(e){if(!e.setImmediate){var t,i,r,n,a=1,o={},s=!1,c=e.document,l=Object.getPrototypeOf&&Object.getPrototypeOf(e);l=l&&l.setTimeout?l:e,t="[object process]"==={}.toString.call(e.process)?function(e){process.nextTick((function(){u(e)}))}:function(){if(e.postMessage&&!e.importScripts){var t=!0,i=e.onmessage;return e.onmessage=function(){t=!1},e.postMessage("","*"),e.onmessage=i,t}}()?(n="setImmediate$"+Math.random()+"$",e.addEventListener?e.addEventListener("message",h,!1):e.attachEvent("onmessage",h),function(t){e.postMessage(n+t,"*")}):e.MessageChannel?((r=new MessageChannel).port1.onmessage=function(e){u(e.data)},function(e){r.port2.postMessage(e)}):c&&"onreadystatechange"in c.createElement("script")?(i=c.documentElement,function(e){var t=c.createElement("script");t.onreadystatechange=function(){u(e),t.onreadystatechange=null,i.removeChild(t),t=null},i.appendChild(t)}):function(e){setTimeout(u,0,e)},l.setImmediate=function(e){"function"!=typeof e&&(e=new Function(""+e));for(var i=new Array(arguments.length-1),r=0;r<i.length;r++)i[r]=arguments[r+1];var n={callback:e,args:i};return o[a]=n,t(a),a++},l.clearImmediate=d}function d(e){delete o[e]}function u(e){if(s)setTimeout(u,0,e);else{var t=o[e];if(t){s=!0;try{!function(e){var t=e.callback,i=e.args;switch(i.length){case 0:t();break;case 1:t(i[0]);break;case 2:t(i[0],i[1]);break;case 3:t(i[0],i[1],i[2]);break;default:t.apply(undefined,i)}}(t)}finally{d(e),s=!1}}}}function h(t){t.source===e&&"string"==typeof t.data&&0===t.data.indexOf(n)&&u(+t.data.slice(n.length))}}("undefined"==typeof self?void 0===e?this:e:self)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}]},{},[10])(10)}))})),pA=sA(((e,t)=>{var i=Object.prototype.hasOwnProperty,r="~";function n(){}function a(e,t,i){this.fn=e,this.context=t,this.once=i||!1}function o(e,t,i,n,o){if("function"!=typeof i)throw new TypeError("The listener must be a function");var s=new a(i,n||e,o),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 s(e,t){0==--e._eventsCount?e._events=new n:delete e._events[t]}function c(){this._events=new n,this._eventsCount=0}Object.create&&(n.prototype=Object.create(null),(new n).__proto__||(r=!1)),c.prototype.eventNames=function(){var e,t,n=[];if(0===this._eventsCount)return n;for(t in e=this._events)i.call(e,t)&&n.push(r?t.slice(1):t);return Object.getOwnPropertySymbols?n.concat(Object.getOwnPropertySymbols(e)):n},c.prototype.listeners=function(e){var t=r?r+e:e,i=this._events[t];if(!i)return[];if(i.fn)return[i.fn];for(var n=0,a=i.length,o=new Array(a);n<a;n++)o[n]=i[n].fn;return o},c.prototype.listenerCount=function(e){var t=r?r+e:e,i=this._events[t];return i?i.fn?1:i.length:0},c.prototype.emit=function(e,t,i,n,a,o){var s=r?r+e:e;if(!this._events[s])return!1;var c,l,d=this._events[s],u=arguments.length;if(d.fn){switch(d.once&&this.removeListener(e,d.fn,void 0,!0),u){case 1:return d.fn.call(d.context),!0;case 2:return d.fn.call(d.context,t),!0;case 3:return d.fn.call(d.context,t,i),!0;case 4:return d.fn.call(d.context,t,i,n),!0;case 5:return d.fn.call(d.context,t,i,n,a),!0;case 6:return d.fn.call(d.context,t,i,n,a,o),!0}for(l=1,c=new Array(u-1);l<u;l++)c[l-1]=arguments[l];d.fn.apply(d.context,c)}else{var h,p=d.length;for(l=0;l<p;l++)switch(d[l].once&&this.removeListener(e,d[l].fn,void 0,!0),u){case 1:d[l].fn.call(d[l].context);break;case 2:d[l].fn.call(d[l].context,t);break;case 3:d[l].fn.call(d[l].context,t,i);break;case 4:d[l].fn.call(d[l].context,t,i,n);break;default:if(!c)for(h=1,c=new Array(u-1);h<u;h++)c[h-1]=arguments[h];d[l].fn.apply(d[l].context,c)}}return!0},c.prototype.on=function(e,t,i){return o(this,e,t,i,!1)},c.prototype.once=function(e,t,i){return o(this,e,t,i,!0)},c.prototype.removeListener=function(e,t,i,n){var a=r?r+e:e;if(!this._events[a])return this;if(!t)return s(this,a),this;var o=this._events[a];if(o.fn)o.fn===t&&(!n||o.once)&&(!i||o.context===i)&&s(this,a);else{for(var c=0,l=[],d=o.length;c<d;c++)(o[c].fn!==t||n&&!o[c].once||i&&o[c].context!==i)&&l.push(o[c]);l.length?this._events[a]=1===l.length?l[0]:l:s(this,a)}return this},c.prototype.removeAllListeners=function(e){var t;return e?(t=r?r+e:e,this._events[t]&&s(this,t)):(this._events=new n,this._eventsCount=0),this},c.prototype.off=c.prototype.removeListener,c.prototype.addListener=c.prototype.on,c.prefixed=r,c.EventEmitter=c,void 0!==t&&(t.exports=c)})),fA=sA(((e,t)=>{var i=t.exports={v:[{name:"version",reg:/^(\d*)$/}],o:[{name:"origin",reg:/^(\S*) (\d*) (\d*) (\S*) IP(\d) (\S*)/,names:["username","sessionId","sessionVersion","netType","ipVer","address"],format:"%s %s %d %s IP%d %s"}],s:[{name:"name"}],i:[{name:"description"}],u:[{name:"uri"}],e:[{name:"email"}],p:[{name:"phone"}],z:[{name:"timezones"}],r:[{name:"repeats"}],t:[{name:"timing",reg:/^(\d*) (\d*)/,names:["start","stop"],format:"%d %d"}],c:[{name:"connection",reg:/^IN IP(\d) (\S*)/,names:["version","ip"],format:"IN IP%d %s"}],b:[{push:"bandwidth",reg:/^(TIAS|AS|CT|RR|RS):(\d*)/,names:["type","limit"],format:"%s:%s"}],m:[{reg:/^(\w*) (\d*) ([\w/]*)(?: (.*))?/,names:["type","port","protocol","payloads"],format:"%s %d %s %s"}],a:[{push:"rtp",reg:/^rtpmap:(\d*) ([\w\-.]*)(?:\s*\/(\d*)(?:\s*\/(\S*))?)?/,names:["payload","codec","rate","encoding"],format:function(e){return e.encoding?"rtpmap:%d %s/%s/%s":e.rate?"rtpmap:%d %s/%s":"rtpmap:%d %s"}},{push:"fmtp",reg:/^fmtp:(\d*) ([\S| ]*)/,names:["payload","config"],format:"fmtp:%d %s"},{name:"control",reg:/^control:(.*)/,format:"control:%s"},{name:"rtcp",reg:/^rtcp:(\d*)(?: (\S*) IP(\d) (\S*))?/,names:["port","netType","ipVer","address"],format:function(e){return null!=e.address?"rtcp:%d %s IP%d %s":"rtcp:%d"}},{push:"rtcpFbTrrInt",reg:/^rtcp-fb:(\*|\d*) trr-int (\d*)/,names:["payload","value"],format:"rtcp-fb:%s trr-int %d"},{push:"rtcpFb",reg:/^rtcp-fb:(\*|\d*) ([\w-_]*)(?: ([\w-_]*))?/,names:["payload","type","subtype"],format:function(e){return null!=e.subtype?"rtcp-fb:%s %s %s":"rtcp-fb:%s %s"}},{push:"ext",reg:/^extmap:(\d+)(?:\/(\w+))?(?: (urn:ietf:params:rtp-hdrext:encrypt))? (\S*)(?: (\S*))?/,names:["value","direction","encrypt-uri","uri","config"],format:function(e){return"extmap:%d"+(e.direction?"/%s":"%v")+(e["encrypt-uri"]?" %s":"%v")+" %s"+(e.config?" %s":"")}},{name:"extmapAllowMixed",reg:/^(extmap-allow-mixed)/},{push:"crypto",reg:/^crypto:(\d*) ([\w_]*) (\S*)(?: (\S*))?/,names:["id","suite","config","sessionConfig"],format:function(e){return null!=e.sessionConfig?"crypto:%d %s %s %s":"crypto:%d %s %s"}},{name:"setup",reg:/^setup:(\w*)/,format:"setup:%s"},{name:"connectionType",reg:/^connection:(new|existing)/,format:"connection:%s"},{name:"mid",reg:/^mid:([^\s]*)/,format:"mid:%s"},{name:"msid",reg:/^msid:(.*)/,format:"msid:%s"},{name:"ptime",reg:/^ptime:(\d*(?:\.\d*)*)/,format:"ptime:%d"},{name:"maxptime",reg:/^maxptime:(\d*(?:\.\d*)*)/,format:"maxptime:%d"},{name:"direction",reg:/^(sendrecv|recvonly|sendonly|inactive)/},{name:"icelite",reg:/^(ice-lite)/},{name:"iceUfrag",reg:/^ice-ufrag:(\S*)/,format:"ice-ufrag:%s"},{name:"icePwd",reg:/^ice-pwd:(\S*)/,format:"ice-pwd:%s"},{name:"fingerprint",reg:/^fingerprint:(\S*) (\S*)/,names:["type","hash"],format:"fingerprint:%s %s"},{push:"candidates",reg:/^candidate:(\S*) (\d*) (\S*) (\d*) (\S*) (\d*) typ (\S*)(?: raddr (\S*) rport (\d*))?(?: tcptype (\S*))?(?: generation (\d*))?(?: network-id (\d*))?(?: network-cost (\d*))?/,names:["foundation","component","transport","priority","ip","port","type","raddr","rport","tcptype","generation","network-id","network-cost"],format:function(e){var t="candidate:%s %d %s %d %s %d typ %s";return t+=null!=e.raddr?" raddr %s rport %d":"%v%v",t+=null!=e.tcptype?" tcptype %s":"%v",null!=e.generation&&(t+=" generation %d"),t+=null!=e["network-id"]?" network-id %d":"%v",t+=null!=e["network-cost"]?" network-cost %d":"%v"}},{name:"endOfCandidates",reg:/^(end-of-candidates)/},{name:"remoteCandidates",reg:/^remote-candidates:(.*)/,format:"remote-candidates:%s"},{name:"iceOptions",reg:/^ice-options:(\S*)/,format:"ice-options:%s"},{push:"ssrcs",reg:/^ssrc:(\d*) ([\w_-]*)(?::(.*))?/,names:["id","attribute","value"],format:function(e){var t="ssrc:%d";return null!=e.attribute&&(t+=" %s",null!=e.value&&(t+=":%s")),t}},{push:"ssrcGroups",reg:/^ssrc-group:([\x21\x23\x24\x25\x26\x27\x2A\x2B\x2D\x2E\w]*) (.*)/,names:["semantics","ssrcs"],format:"ssrc-group:%s %s"},{name:"msidSemantic",reg:/^msid-semantic:\s?(\w*) (\S*)/,names:["semantic","token"],format:"msid-semantic: %s %s"},{push:"groups",reg:/^group:(\w*) (.*)/,names:["type","mids"],format:"group:%s %s"},{name:"rtcpMux",reg:/^(rtcp-mux)/},{name:"rtcpRsize",reg:/^(rtcp-rsize)/},{name:"sctpmap",reg:/^sctpmap:([\w_/]*) (\S*)(?: (\S*))?/,names:["sctpmapNumber","app","maxMessageSize"],format:function(e){return null!=e.maxMessageSize?"sctpmap:%s %s %s":"sctpmap:%s %s"}},{name:"xGoogleFlag",reg:/^x-google-flag:([^\s]*)/,format:"x-google-flag:%s"},{push:"rids",reg:/^rid:([\d\w]+) (\w+)(?: ([\S| ]*))?/,names:["id","direction","params"],format:function(e){return e.params?"rid:%s %s %s":"rid:%s %s"}},{push:"imageattrs",reg:new RegExp("^imageattr:(\\d+|\\*)[\\s\\t]+(send|recv)[\\s\\t]+(\\*|\\[\\S+\\](?:[\\s\\t]+\\[\\S+\\])*)(?:[\\s\\t]+(recv|send)[\\s\\t]+(\\*|\\[\\S+\\](?:[\\s\\t]+\\[\\S+\\])*))?"),names:["pt","dir1","attrs1","dir2","attrs2"],format:function(e){return"imageattr:%s %s %s"+(e.dir2?" %s %s":"")}},{name:"simulcast",reg:new RegExp("^simulcast:(send|recv) ([a-zA-Z0-9\\-_~;,]+)(?:\\s?(send|recv) ([a-zA-Z0-9\\-_~;,]+))?$"),names:["dir1","list1","dir2","list2"],format:function(e){return"simulcast:%s %s"+(e.dir2?" %s %s":"")}},{name:"simulcast_03",reg:/^simulcast:[\s\t]+([\S+\s\t]+)$/,names:["value"],format:"simulcast: %s"},{name:"framerate",reg:/^framerate:(\d+(?:$|\.\d+))/,format:"framerate:%s"},{name:"sourceFilter",reg:/^source-filter: *(excl|incl) (\S*) (IP4|IP6|\*) (\S*) (.*)/,names:["filterMode","netType","addressTypes","destAddress","srcList"],format:"source-filter: %s %s %s %s %s"},{name:"bundleOnly",reg:/^(bundle-only)/},{name:"label",reg:/^label:(.+)/,format:"label:%s"},{name:"sctpPort",reg:/^sctp-port:(\d+)$/,format:"sctp-port:%s"},{name:"maxMessageSize",reg:/^max-message-size:(\d+)$/,format:"max-message-size:%s"},{push:"tsRefClocks",reg:/^ts-refclk:([^\s=]*)(?:=(\S*))?/,names:["clksrc","clksrcExt"],format:function(e){return"ts-refclk:%s"+(null!=e.clksrcExt?"=%s":"")}},{name:"mediaClk",reg:/^mediaclk:(?:id=(\S*))? *([^\s=]*)(?:=(\S*))?(?: *rate=(\d+)\/(\d+))?/,names:["id","mediaClockName","mediaClockValue","rateNumerator","rateDenominator"],format:function(e){var t="mediaclk:";return t+=null!=e.id?"id=%s %s":"%v%s",t+=null!=e.mediaClockValue?"=%s":"",t+=null!=e.rateNumerator?" rate=%s":"",t+=null!=e.rateDenominator?"/%s":""}},{name:"keywords",reg:/^keywds:(.+)$/,format:"keywds:%s"},{name:"content",reg:/^content:(.+)/,format:"content:%s"},{name:"bfcpFloorCtrl",reg:/^floorctrl:(c-only|s-only|c-s)/,format:"floorctrl:%s"},{name:"bfcpConfId",reg:/^confid:(\d+)/,format:"confid:%s"},{name:"bfcpUserId",reg:/^userid:(\d+)/,format:"userid:%s"},{name:"bfcpFloorId",reg:/^floorid:(.+) (?:m-stream|mstrm):(.+)/,names:["id","mStream"],format:"floorid:%s mstrm:%s"},{push:"invalid",names:["value"]}]};Object.keys(i).forEach((function(e){i[e].forEach((function(e){e.reg||(e.reg=/(.*)/),e.format||(e.format="%s")}))}))})),mA=sA((e=>{var t=function(e){return String(Number(e))===e?Number(e):e},i=function(e,i,r){var n=e.name&&e.names;e.push&&!i[e.push]?i[e.push]=[]:n&&!i[e.name]&&(i[e.name]={});var a=e.push?{}:n?i[e.name]:i;(function(e,i,r,n){if(n&&!r)i[n]=t(e[1]);else for(var a=0;a<r.length;a+=1)null!=e[a+1]&&(i[r[a]]=t(e[a+1]))})(r.match(e.reg),a,e.names,e.name),e.push&&i[e.push].push(a)},r=fA(),n=RegExp.prototype.test.bind(/^([a-z])=(.*)/);e.parse=function(e){var t={},a=[],o=t;return e.split(/(\r\n|\r|\n)/).filter(n).forEach((function(e){var t=e[0],n=e.slice(2);"m"===t&&(a.push({rtp:[],fmtp:[]}),o=a[a.length-1]);for(var s=0;s<(r[t]||[]).length;s+=1){var c=r[t][s];if(c.reg.test(n))return i(c,o,n)}})),t.media=a,t};var a=function(e,i){var r=i.split(/=(.+)/,2);return 2===r.length?e[r[0]]=t(r[1]):1===r.length&&i.length>1&&(e[r[0]]=void 0),e};e.parseParams=function(e){return e.split(/;\s?/).reduce(a,{})},e.parseFmtpConfig=e.parseParams,e.parsePayloads=function(e){return e.toString().split(" ").map(Number)},e.parseRemoteCandidates=function(e){for(var i=[],r=e.split(" ").map(t),n=0;n<r.length;n+=3)i.push({component:r[n],ip:r[n+1],port:r[n+2]});return i},e.parseImageAttributes=function(e){return e.split(" ").map((function(e){return e.substring(1,e.length-1).split(",").reduce(a,{})}))},e.parseSimulcastStreamList=function(e){return e.split(";").map((function(e){return e.split(",").map((function(e){var i,r=!1;return"~"!==e[0]?i=t(e):(i=t(e.substring(1,e.length)),r=!0),{scid:i,paused:r}}))}))}})),gA=sA(((e,t)=>{var i=fA(),r=/%[sdv%]/g,n=function(e){var t=1,i=arguments,n=i.length;return e.replace(r,(function(e){if(t>=n)return e;var r=i[t];switch(t+=1,e){case"%%":return"%";case"%s":return String(r);case"%d":return Number(r);case"%v":return""}}))},a=function(e,t,i){var r=[e+"="+(t.format instanceof Function?t.format(t.push?i:i[t.name]):t.format)];if(t.names)for(var a=0;a<t.names.length;a+=1){var o=t.names[a];t.name?r.push(i[t.name][o]):r.push(i[t.names[a]])}else r.push(i[t.name]);return n.apply(null,r)},o=["v","o","s","i","u","e","p","c","b","t","r","z","a"],s=["i","c","b","a"];t.exports=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||o,n=t.innerOrder||s,c=[];return r.forEach((function(t){i[t].forEach((function(i){i.name in e&&null!=e[i.name]?c.push(a(t,i,e)):i.push in e&&null!=e[i.push]&&e[i.push].forEach((function(e){c.push(a(t,i,e))}))}))})),e.media.forEach((function(e){c.push(a("m",i.m[0],e)),n.forEach((function(t){i[t].forEach((function(i){i.name in e&&null!=e[i.name]?c.push(a(t,i,e)):i.push in e&&null!=e[i.push]&&e[i.push].forEach((function(e){c.push(a(t,i,e))}))}))}))})),c.join("\r\n")+"\r\n"}})),vA=sA((e=>{var t=mA(),i=gA(),r=fA();e.grammar=r,e.write=i,e.parse=t.parse,e.parseParams=t.parseParams,e.parseFmtpConfig=t.parseFmtpConfig,e.parsePayloads=t.parsePayloads,e.parseRemoteCandidates=t.parseRemoteCandidates,e.parseImageAttributes=t.parseImageAttributes,e.parseSimulcastStreamList=t.parseSimulcastStreamList})),_A=((qS=_A||{}).ROOM_DESTROY="1",qS.JOIN_START="21",qS.JOIN_SCHEDULE_SUCCESS="22",qS.JOIN_SIGNAL_CONNECTION_START="23",qS.JOIN_SIGNAL_CONNECTION_END="24",qS.JOIN_SEND_CMD="25",qS.JOIN_RECEIVED_CMD_RES="26",qS.JOIN_SUCCESS="27",qS.JOIN_FAILED="28",qS.LEAVE_START="51",qS.LEAVE_SEND_CMD="52",qS.LEAVE_SUCCESS="53",qS.PUBLISH_START="61",qS.SEND_FIRST_VIDEO_FRAME="62",qS.PUBLISH_FAILED="63",qS.SUBSCRIBE_START="81",qS.SUBSCRIBE_SUCCESS="82",qS.SUBSCRIBE_FAILED="84",qS.UNSUBSCRIBE_SUCCESS="83",qS.LOCAL_TRACK_CAPTURE_START="101",qS.LOCAL_TRACK_CAPTURE_SUCCESS="102",qS.LOCAL_TRACK_CAPTURE_FAILED="103",qS.LOCAL_TRACK_PUBLISHED="104",qS.LOCAL_TRACK_UNPUBLISHED="105",qS.LOCAL_TRACK_REPLACED="106",qS.SWITCH_DEVICE_SUCCESS="107",qS.TRACK_MUTED="108",qS.TRACK_UNMUTED="109",qS.REMOTE_TRACK_SUBSCRIBED="110",qS.REMOTE_TRACK_UNSUBSCRIBED="111",qS.LOCAL_TRACK_RECAPTURE="112",qS.LOCAL_AUDIO_STARTED="113",qS.LOCAL_AUDIO_STOPPED="114",qS.REMOTE_AUDIO_STARTED="115",qS.REMOTE_AUDIO_STOPPED="116",qS.PLAY_TRACK_START="151",qS.PLAYER_STATE_CHANGED="152",qS.VIDEO_LOADED_DATA="153",qS.AUTOPLAY_DIALOG_CLICK_CONFIRM="154",qS.AUDIO_CONTEXT_LONG_SUSPENDED="155",qS.REMOTE_VIDEO_PLAY_START="156",qS.REMOTE_VIDEO_PLAY_FINISH="157",qS.SIGNAL_CONNECTION_STATE_CHANGED="201",qS.PEER_CONNECTION_STATE_CHANGED="202",qS.SINGLE_CONNECTION_STAT="203",qS.SPC_RECONNECTED="204",qS.HEARTBEAT_REPORT="251",qS.RECEIVED_PUBLISHED_USER_LIST="252",qS.REMOTE_PUBLISH_STATE_CHANGED="253",qS.AUDIO_LEVEL_INTERVAL="260",qS.NETWORK_QUALITY="261",qS.VIDEO_CODEC_IMPLEMENTATION_CHANGED="262",qS.QUALITY_LIMITATION_CHANGED="263",qS.LOG="264",qS.AUDIO_PROCESSOR_DEBUG="265",qS.SSO_SWITCH="266",qS.SWITCH_ROOM_START="401",qS.SWITCH_ROOM_SUCCESS="407",qS.SWITCH_ROOM_FAILED="408",qS);function yA(e){return EA(((t,i)=>async function(){for(var i=arguments.length,r=new Array(i),n=0;n<i;n++)r[n]=arguments[n];let a=await t.apply(this,r);return await e.call(this,...r),a}))}function EA(e){return function(t,i,r){return r.value=e(r.value,i),r}}var bA=new WeakMap;function wA(e,t){return EA(((i,r)=>function(){for(var r=arguments.length,n=new Array(r),a=0;a<r;a++)n[a]=arguments[a];let o=bA.get(this);o||(o=new Map,bA.set(this,o));let s=t(...n),c=o.get(s);if(!c||c<=0){i.apply(this,n);let t=setTimeout((()=>{var e;null==(e=bA.get(this))||e.delete(s)}),e);o.set(s,t)}else{clearTimeout(c);let t=window.setTimeout((()=>{var e;i.apply(this,n),null==(e=bA.get(this))||e.delete(s)}),e);o.set(s,t)}}))}var IA,TA,SA=((IA=SA||{})[IA.none=0]="none",IA[IA.horizontal=1]="horizontal",IA[IA.vertical=2]="vertical",IA),AA="5.0.0",RA="undefined"!=typeof importScripts,kA="undefined"!=typeof registerProcessor,CA="https://".concat("web.sdk.qcloud.com","/trtc/webrtc/doc"),DA="https://cloud.tencent.com/document/product/647/85386",OA="https://trtc.io/document/56025",LA="jssdk_log",NA="qcloud",xA=((TA=xA||{})[TA.TRACE=0]="TRACE",TA[TA.DEBUG=1]="DEBUG",TA[TA.INFO=2]="INFO",TA[TA.WARN=3]="WARN",TA[TA.ERROR=4]="ERROR",TA[TA.NONE=5]="NONE",TA),PA={unknown:0,wifi:1,"4g":2,"3g":3,"2g":4,wired:5,"5g":6},MA={width:640,height:480,frameRate:15,bitrate:500},UA="canvas",BA="audio",FA="video",VA="screen",HA="big",jA="mute",zA="unmute",WA="ended",GA="playing",qA="pause",KA="error",YA="loadeddata",XA="loadedmetadata",ZA="audioinput",JA="videoinput",QA="enterpictureinpicture",$A="leavepictureinpicture",eR="resize",tR="player-error",iR="load-worklet",rR="getUserMedia-retry",nR="default",aR=2e3,oR=["width","height","frameRate","facingMode","sampleRate","sampleSize","channelCount","deviceId","min","max"];function sR(e){let{frame:t,onDump:i}=e;return null==i||i(),t}function cR(e){let{frame:t,onDump:i}=e;return null==i||i(),t}function lR(e){let{frame:t,onDump:i}=e;return null==i||i(),t}function dR(e){let{frame:t,onDump:i}=e;return null==i||i(),t}var uR="Log",hR="Network",pR="Dump",fR="Dump (PCM)",mR="Dump (Opus)",gR="Dumping",vR="End",_R="Upload Log",yR="Export Log",ER="Hide",bR="goBottom",wR="backTop",IR="Clear Log",TR="Uplink",SR="Downlink",AR="No Data",RR="Basic",kR="Duration",CR="Video",DR="Audio",OR="Screen",LR={"play() error: NotAllowedError:":{tips:e=>e.includes("main <video>")||e.includes("main <audio>")?"Remote stream auto play is restricted and playback fails":"Local stream playback failure, generally only occurs in Android WeChat devices, no need to handle",color:"red",class:"red"},"updateStream() try to recover local stream":{tips:"Device acquisition exception, automatic recovery is in progress"},"updateStream() recover local stream successfully":{tips:"Device acquisition exception, automatic recovery is successful"},"updateStream() failed to recover local stream":{tips:"Device acquisition exception, automatic recovery failed"},"main stream - video track is muted":{tips:"Indicates that the received video data is not enough for playback. This is usually caused by network reasons. When enough data is received for playback, the state will change to unmuted."},"main stream - audio track is muted":{tips:"Indicates that the received audio data is not enough for playback. This is usually caused by network reasons. When enough data is received for playback, the state will change to unmuted."},"auxiliary stream - video track is muted":{tips:"Indicates that the received screen sharing data is not enough for playback. This is usually caused by network reasons. When enough data is received for playback, the state will change to unmuted."},"main stream - video track is unable to provide media output":{tips:"Indicates that the received video data is not enough for playback. This is usually caused by network reasons. When enough data is received for playback, the state will change to unmuted."},"main stream - audio track is unable to provide media output":{tips:"Indicates that the received audio data is not enough for playback. This is usually caused by network reasons. When enough data is received for playback, the state will change to unmuted."},"auxiliary stream - video track is unable to provide media output":{tips:"Indicates that the received screen sharing data is not enough for playback. This is usually caused by network reasons. When enough data is received for playback, the state will change to unmuted."},"main stream - video track is unmuted":{tips:"Received enough playback video data"},"main stream - audio track is unmuted":{tips:"Received enough playback audio data"},"auxiliary stream - video track is unmuted":{tips:"Received enough playback screen sharing data"},"main stream - audio player track is ended":{tips:"Remote audio track stopped"},"main stream - video player track is ended":{tips:"Remote video track stopped"},"auxiliary stream - video player track is ended":{tips:"Received enough playback screen sharing data"},"stream - video track is muted":{tips:"Camera capture is paused, usually due to the device being occupied by other applications or the browser media permission being revoked. The client needs to re-capture.",color:"orange"},"stream - video track is unable to provide media output":{tips:"The camera acquisition is paused, usually because the device is occupied by other applications or the browser media permissions are revoked, and the customer needs to re-acquire. SDK v4.11.4+ will automatically resume acquisition without customer intervention",color:"orange"},"video track is unable to provide media output":{tips:e=>e.includes("↓")?"The remote track is temporarily unable to decode data, which may be caused by network fluctuations":"The camera acquisition is paused, usually because the device is occupied by other applications or the browser media permissions are revoked. The SDK will automatically resume the acquisition.",color:"orange"},"stream - video player track is ended":{tips:"The camera acquisition stops, usually because the device is unplugged. In this case, the SDK will automatically resume acquisition, and the access side does not need to handle it. It may also be caused by the device being occupied by other applications or the browser media permissions being reclaimed. It is recommended to remind the user to re-acquire on the page."},"video player track is ended":{tips:"The camera acquisition stops, usually because the device is unplugged. In this case, the SDK will automatically resume acquisition, and the access side does not need to handle it. It may also be caused by the device being occupied by other applications or the browser media permissions being reclaimed. It is recommended to remind the user to re-acquire on the page."},"stream - audio track is muted":{tips:"Microphone capture is paused, usually due to the device being occupied by other applications or the browser media permission being revoked. The client needs to re-capture.",color:"orange"},"audio track is unable to provide media output":{tips:e=>e.includes("↓")?"The remote track is temporarily unable to decode data, which may be caused by network fluctuations":"Microphone acquisition is paused, usually because the device is occupied by other applications or the browser media permissions are revoked. The SDK will automatically resume the acquisition.",color:"orange"},"stream - audio track is unable to provide media output":{tips:"The microphone acquisition is paused, usually because the device is occupied by other applications or the browser media permissions are revoked. The SDK will automatically resume the acquisition.",color:"orange"},"stream - audio player track is ended":{tips:"The microphone acquisition stops, usually because the device is unplugged. In this case, the SDK will automatically resume acquisition, and the access side does not need to handle it. It may also be caused by the device being occupied by other applications or the browser media permissions being reclaimed. It is recommended to remind the user to re-acquire on the page."},"audio player track is ended":{tips:"The microphone acquisition stops, usually because the device is unplugged. In this case, the SDK will automatically resume acquisition, and the access side does not need to handle it. It may also be caused by the device being occupied by other applications or the browser media permissions being reclaimed. It is recommended to remind the user to re-acquire on the page."},"is adding audio track to current published local stream":{tips:"add audio track",color:"orange"},"is removing audio track from current published local stream":{tips:"remove audio track",color:"orange"},"is removing video track from current published local stream":{tips:"remove video track",color:"orange"},"is adding video track to current published local stream":{tips:"add video track",color:"orange"},"is replacing audio track to current published local main stream":{tips:"replace audio track",color:"orange"},"is replacing video track to current published local main stream":{tips:"replace video track",color:"orange"},"downlink network quality change":{tips:"Downstream network quality change: 1: excellent, 2: good, 3: average, 4: poor, 5: extremely poor"},"uplink network quality change":{tips:"Upstream network quality change: 1: excellent, 2: good, 3: average, 4: poor, 5: extremely poor"},"localStream mute video":{tips:"mute upstream video stream",color:"orange"},"localStream unmute video":{tips:"unmute upstream video stream",color:"orange"},"localStream mute audio":{tips:"mute upstream audio stream",color:"orange"},"localStream unmute audio":{tips:"unmute upstream audio stream",color:"orange"},"black detected":{tips:"Detect black screen, which means fps = 0. It is usually caused by network, and the network will be recovered after a while. If the network is normal but has not been restored, it is an abnormal situation."},'main stream start to play with options: {"muted":true}':{tips:"Play the remote stream in silent mode. Generally, the remote stream does not need to be played in silent mode. You need to confirm whether the parameters passed in the client stream.play API call are correct.",color:"orange"},"main stream - audio player is starting playing":{tips:"Remote stream audio playback success",color:"#0dd90d",class:"success"},"main stream - video player is starting playing":{tips:"Remote stream video playback success",color:"#0dd90d",class:"success"},"video player is playing":{tips:"Local video playback success",color:"#0dd90d",class:"success"},"audio player is playing":{tips:"Local audio playback success",color:"#0dd90d",class:"success"},"stream - video player is starting playing":{tips:"Local video playback success",color:"#0dd90d",class:"success"},"stream - audio player is starting playing":{tips:"Local audio playback success",color:"#0dd90d",class:"success"},"switch camera success":{tips:"Switch camera success",color:"#0dd90d",class:"success"},"switch microphone success":{tips:"Switch microphone success",color:"#0dd90d",class:"success"},gotStream:{tips:"Local stream capture success"},"local stream is published successfully":{tips:"Publish success",color:"#0dd90d",class:"success"},"encoderImplementation change to OpenH264":{tips:"Use software encoding"},"encoderImplementation change to ExternalEncoder":{tips:"Use hardware encoding"},"getUserMedia with constraints":{tips:"Start media (camera/microphone) capture"},"getDisplayMedia with constraints":{tips:"Start screen sharing capture"},"client-banned":{tips:"Kicked out of the room",color:"red",class:"red",textColor:"#fff"},user_timeout:{tips:"The backend is too long without receiving SDK heartbeat, which is usually caused by the JS thread being blocked for a long time. If the reproduction probability is high, the application browser Performance tool analyzes where the JS thread is blocked.",color:"red",class:"red",textColor:"#fff"},"schedule failed":{tips:"Signaling request failed, does not affect the normal room entry process, SDK will connect to the default signaling domain."},"updateStream() video flag is true, but no camera detected, set video to false":{tips:"When trying to resume camera acquisition, the camera acquisition is not resumed because it is detected that there is no camera.",color:"orange",class:"orange",textColor:"#fff"},"qualityLimitationReason change to bandwidth":{tips:"bandwidth estimation is not enough to limit the quality of the encoding, which may cause the code rate, frame rate, and resolution to be lowered.",color:"orange",class:"orange",textColor:"#fff"},"qualityLimitationReason change to cpu":{tips:"cpu load is too high to limit the quality of the encoding, which may cause the code rate, frame rate, and resolution to be lowered.",color:"orange",class:"orange",textColor:"#fff"},"visibility change: hidden":{tips:"User page switched to backend, in mobile devices, this will cause the device to pause the capture, and it will be restored when the user switches backend to the frontend.",color:"orange",class:"orange",textColor:"#fff"},"visibility change: visible":{tips:"User page switched to frontend",color:"orange",class:"orange",textColor:"#fff"},"main stream - audio player is paused":{tips:"The remote stream audio playback is paused, which usually has two possibilities:\n 1. The business side passes in the div tag container for playing audio and video to be removed by the business side from the DOM.\n 2. If the user is in Chrome 70 and below, when the div container is moved, the playback will be paused.",color:"orange",class:"orange",textColor:"#fff"},"main stream - video player is paused":{tips:"The remote stream video playback is paused, which usually has two possibilities:\n 1. The business side passes in the div tag container for playing audio and video to be removed by the business side from the DOM.\n 2. If the user is in Chrome 70 and below, when the div container is moved, the playback will be paused.",color:"orange",class:"orange",textColor:"#fff"},'"displaySurface":"window"':{tips:"Screen sharing captures the application window",color:"blue",class:"blue",textColor:"#fff"},'"displaySurface":"monitor"':{tips:"Screen sharing captures the entire screen",color:"blue",class:"blue",textColor:"#fff"},'"displaySurface":"browser"':{tips:"Screen sharing captures a certain tab page",color:"blue",class:"blue",textColor:"#fff"},updateMediaSettings:{tips:"The resolution and frame rate below are the actual resolution and frame rate captured",color:"blue",class:"blue",textColor:"#fff"},"main stream start to play with":{tips:"Call remoteStream.play interface",color:"blue",class:"blue",textColor:"#fff"},"stream start to play with":{tips:"Call localStream.play interface",color:"blue",class:"blue",textColor:"#fff"},"main setAudioVolume to 0":{tips:"Business side calls remoteStream.setAudioVolume(0) interface to set the playback volume to 0, which will cause the playback to be silent",color:"orange",class:"orange",textColor:"#fff"},"screen sharing was stopped because the video track is ended":{tips:"Screen sharing capture stopped, possible reasons: user clicks the stop button, the window/page shared by the user is closed, etc.",color:"orange",class:"orange",textColor:"#fff"},"Join() => joining room":{tips:"Call client.join interface",color:"blue",class:"blue",textColor:"#fff"},"publish() => publishing local stream":{tips:"Call client.publish interface",color:"blue",class:"blue",textColor:"#fff"},"subscribe() => subscribe to":{tips:"Call client.subscribe interface",color:"blue",class:"blue",textColor:"#fff"},"switchRole() => switch role":{tips:"Call client.switchRole interface",color:"blue",class:"blue",textColor:"#fff"}};["enterRoom","exitRoom","switchRole","destroy","startLocalAudio","updateLocalAudio","stopLocalAudio","startLocalVideo","updateLocalVideo","stopLocalVideo","startScreenShare","updateScreenShare","stopScreenShare","startRemoteVideo","updateRemoteVideo","stopRemoteVideo","muteRemoteAudio","setRemoteAudioVolume"].forEach((e=>{LR["".concat(e,"()")]={tips:"Call trtc.".concat(e),color:"blue",class:"blue",textColor:"#fff"}}));var NR,xR=Object.keys(LR),PR=lA(hA()),MR=((NR=MR||{})[NR.INVALID_PARAMETER=4096]="INVALID_PARAMETER",NR[NR.INVALID_OPERATION=4097]="INVALID_OPERATION",NR[NR.NOT_SUPPORTED=4098]="NOT_SUPPORTED",NR[NR.DEVICE_NOT_FOUND=4099]="DEVICE_NOT_FOUND",NR[NR.INITIALIZE_FAILED=4100]="INITIALIZE_FAILED",NR[NR.SIGNAL_CHANNEL_SETUP_FAILED=16385]="SIGNAL_CHANNEL_SETUP_FAILED",NR[NR.SIGNAL_CHANNEL_ERROR=16386]="SIGNAL_CHANNEL_ERROR",NR[NR.ICE_TRANSPORT_ERROR=16387]="ICE_TRANSPORT_ERROR",NR[NR.JOIN_ROOM_FAILED=16388]="JOIN_ROOM_FAILED",NR[NR.CREATE_OFFER_FAILED=16389]="CREATE_OFFER_FAILED",NR[NR.SIGNAL_CHANNEL_RECONNECTION_FAILED=16390]="SIGNAL_CHANNEL_RECONNECTION_FAILED",NR[NR.UPLINK_RECONNECTION_FAILED=16391]="UPLINK_RECONNECTION_FAILED",NR[NR.DOWNLINK_RECONNECTION_FAILED=16392]="DOWNLINK_RECONNECTION_FAILED",NR[NR.REMOTE_STREAM_NOT_EXIST=16400]="REMOTE_STREAM_NOT_EXIST",NR[NR.CLIENT_BANNED=16448]="CLIENT_BANNED",NR[NR.SERVER_TIMEOUT=16449]="SERVER_TIMEOUT",NR[NR.SUBSCRIPTION_TIMEOUT=16450]="SUBSCRIPTION_TIMEOUT",NR[NR.PLAY_NOT_ALLOWED=16451]="PLAY_NOT_ALLOWED",NR[NR.DEVICE_AUTO_RECOVER_FAILED=16452]="DEVICE_AUTO_RECOVER_FAILED",NR[NR.START_PUBLISH_CDN_FAILED=16453]="START_PUBLISH_CDN_FAILED",NR[NR.STOP_PUBLISH_CDN_FAILED=16454]="STOP_PUBLISH_CDN_FAILED",NR[NR.START_MIX_TRANSCODE_FAILED=16455]="START_MIX_TRANSCODE_FAILED",NR[NR.STOP_MIX_TRANSCODE_FAILED=16456]="STOP_MIX_TRANSCODE_FAILED",NR[NR.NOT_SUPPORTED_H264=16457]="NOT_SUPPORTED_H264",NR[NR.SWITCH_ROLE_FAILED=16458]="SWITCH_ROLE_FAILED",NR[NR.API_CALL_TIMEOUT=16459]="API_CALL_TIMEOUT",NR[NR.SCHEDULE_FAILED=16460]="SCHEDULE_FAILED",NR[NR.API_CALL_ABORTED=16461]="API_CALL_ABORTED",NR[NR.SPC_INITIALIZED_FAILED=16462]="SPC_INITIALIZED_FAILED",NR[NR.VIDEO_MANAGER_ERROR=16463]="VIDEO_MANAGER_ERROR",NR[NR.SWITCH_ROOM_FAILED=16464]="SWITCH_ROOM_FAILED",NR[NR.VIDEO_ENCODE_FAILED=16465]="VIDEO_ENCODE_FAILED",NR[NR.AUDIO_ENCODE_FAILED=16466]="AUDIO_ENCODE_FAILED",NR[NR.UNKNOWN=65535]="UNKNOWN",NR),UR=MR,BR=class extends Error{constructor(e){let{name:t="RtcError",message:i,code:r=UR.UNKNOWN,extraCode:n=0,constraint:a}=e,o="<".concat(function(e){for(let t in UR)if(UR[t]===e)return t;return"UNKNOWN"}(r)," 0x").concat(r.toString(16),">"),s="".concat(i).concat(a?" constraint: ".concat(a):"").concat(null!=i&&i.includes(o)?"":" ".concat(o));super(s),uA(this,"code"),uA(this,"extraCode"),uA(this,"message"),uA(this,"originMessage"),uA(this,"name"),uA(this,"constraint"),this.code=r,this.extraCode=n,this.name=t,this.message=s,this.constraint=a,this.originMessage=i}getCode(){return this.code}getExtraCode(){return this.extraCode}toString(){return this.originMessage}},FR=BR,VR=function(){return Date.now()+0},HR=function(){let e=new Date;return e.setTime(VR()),e.toLocaleString()};cA({},{REPORT_TYPE:()=>_C,buildSSOPackage:()=>yC,bytes2ms:()=>yk,calculateScaleResolutionDownNumber:()=>fC,concatArrayBuffers:()=>EC,convertObjectNumberToInt:()=>lC,copyProperties:()=>_k,deepClone:()=>$k,deepCloneBasic:()=>vC,deepMerge:()=>Qk,delay:()=>dC,fibonacci:()=>Ak,formatedTime:()=>iC,getConstructorName:()=>Vk,getContainerFromElement:()=>tC,getEnv:()=>ck,getFirst16Bits:()=>wC,getInternalVersion:()=>qk,getLast16Bits:()=>bC,getLoggerUrl:()=>dk,getMediaStreamTrackInfo:()=>pC,getMuteStateFromFlag:()=>Xk,getNetworkType:()=>hk,getNumNetworkType:()=>vk,getReconnectionTimeout:()=>Rk,getStringByteLength:()=>aC,getTurnServer:()=>Zk,getUint32Version:()=>cC,getValueType:()=>kk,getViewListFromView:()=>eC,glog:()=>Ik,ipv4ToUint32:()=>Jk,isArray:()=>Pk,isAudioWorkletSupported:()=>Hk,isBoolean:()=>Nk,isConstructor:()=>Fk,isEmpty:()=>Yk,isFunction:()=>Ck,isLangChinese:()=>Tk,isMediaStreamTrack:()=>Mk,isNumber:()=>Lk,isObject:()=>xk,isOverseaSdkAppId:()=>lk,isPlainObject:()=>Sk,isPortrait:()=>oC,isPromise:()=>Bk,isRemoteTrack:()=>Uk,isRotate90Or270:()=>mC,isSetSinkIdSupported:()=>jk,isString:()=>Ok,isUndefined:()=>Dk,loadImage:()=>sC,loadVideo:()=>gC,ms2bytes:()=>bk,ms2samples:()=>wk,normalizeUrl:()=>hC,performanceNow:()=>Wk,promiseAny:()=>zk,samples2ms:()=>Ek,setNetworkTypeFromWebRTC:()=>gk,stringify:()=>rC,stringifyIncludeValue:()=>nC,throttlePromise:()=>uC});var jR=function(e,t,i,r){return new(i||(i=Promise))((function(n,a){function o(e){try{c(r.next(e))}catch(t){a(t)}}function s(e){try{c(r.throw(e))}catch(t){a(t)}}function c(e){e.done?n(e.value):function(e){return e instanceof i?e:new i((function(t){t(e)}))}(e.value).then(o,s)}c((r=r.apply(e,t||[])).next())}))},zR=Symbol(32),WR=Symbol(16),GR=Symbol(8),qR=class{constructor(e){this.g=e,this.consumed=0,e&&(this.need=e.next().value)}setG(e){this.g=e,this.demand(e.next().value,!0)}consume(){this.buffer&&this.consumed&&(this.buffer.copyWithin(0,this.consumed),this.buffer=this.buffer.subarray(0,this.buffer.length-this.consumed),this.consumed=0)}demand(e,t){return t&&this.consume(),this.need=e,this.flush()}read(e){return jR(this,void 0,void 0,(function*(){return this.lastReadPromise&&(yield this.lastReadPromise),this.lastReadPromise=new Promise(((t,i)=>{var r;this.reject=i,this.resolve=e=>{delete this.lastReadPromise,delete this.resolve,delete this.need,t(e)},this.demand(e,!0)||null===(r=this.pull)||void 0===r||r.call(this,e)}))}))}readU32(){return this.read(zR)}readU16(){return this.read(WR)}readU8(){return this.read(GR)}close(){var e;this.g&&this.g.return(),this.buffer&&this.buffer.subarray(0,0),null===(e=this.reject)||void 0===e||e.call(this,new Error("EOF")),delete this.lastReadPromise}flush(){if(!this.buffer||!this.need)return;let e=null,t=this.buffer.subarray(this.consumed),i=0,r=e=>t.length<(i=e);if("number"==typeof this.need){if(r(this.need))return;e=t.subarray(0,i)}else if(this.need===zR){if(r(4))return;e=t[0]<<24|t[1]<<16|t[2]<<8|t[3]}else if(this.need===WR){if(r(2))return;e=t[0]<<8|t[1]}else if(this.need===GR){if(r(1))return;e=t[0]}else if("buffer"in this.need){if("byteOffset"in this.need){if(r(this.need.byteLength-this.need.byteOffset))return;new Uint8Array(this.need.buffer,this.need.byteOffset).set(t.subarray(0,i)),e=this.need}else if(this.g)return void this.g.throw(new Error("Unsupported type"))}else{if(r(this.need.byteLength))return;new Uint8Array(this.need).set(t.subarray(0,i)),e=this.need}return this.consumed+=i,this.g?this.demand(this.g.next(e).value,!0):this.resolve&&this.resolve(e),e}write(e){if(e instanceof Uint8Array?this.malloc(e.length).set(e):"buffer"in e?this.malloc(e.byteLength).set(new Uint8Array(e.buffer,e.byteOffset,e.byteLength)):this.malloc(e.byteLength).set(new Uint8Array(e)),!this.g&&!this.resolve)return new Promise((e=>this.pull=e));this.flush()}writeU32(e){this.malloc(4).set([e>>24&255,e>>16&255,e>>8&255,255&e]),this.flush()}writeU16(e){this.malloc(2).set([e>>8&255,255&e]),this.flush()}writeU8(e){this.malloc(1)[0]=e,this.flush()}malloc(e){if(this.buffer){let t=this.buffer.length,i=t+e;if(i<=this.buffer.buffer.byteLength-this.buffer.byteOffset)this.buffer=new Uint8Array(this.buffer.buffer,this.buffer.byteOffset,i);else{let e=new Uint8Array(i);e.set(this.buffer),this.buffer=e}return this.buffer.subarray(t,i)}return this.buffer=new Uint8Array(e),this.buffer}};qR.U32=zR,qR.U16=WR,qR.U8=GR;var KR=128;function YR(e){let t=new qR;for(;e>=128;)t.malloc(1)[0]=255&e|KR,e>>>=7;return t.malloc(1)[0]=255&e,t.buffer||new Uint8Array(0)}function XR(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=new qR,r=t<<3;switch(typeof e){case"boolean":let n=i.malloc(2);n[0]=r,n[1]=e?1:0;break;case"number":i.malloc(1)[0]=r,i.write(YR(e));break;case"string":i.malloc(1)[0]=2|r;let a=(new TextEncoder).encode(e);i.write(YR(a.length));let o=i.malloc(a.length);for(let e=0;e<a.length;e++)o[e]=a[e];break;case"object":let s=new qR;if(Array.isArray(e))for(let t=0;t<e.length;t++){let i=XR(e[t],t+1);i&&s.write(i)}else{let t=1;for(let i in e){let r=XR(e[i],t++);r&&s.write(r)}}0===t?s.buffer&&i.write(s.buffer):(i.malloc(1)[0]=2|r,s.buffer&&(i.write(YR(s.buffer.length)),i.write(s.buffer)))}return i.buffer||new Uint8Array(0)}var ZR=class{constructor(){uA(this,"buffer"),this.buffer=[]}get data(){return this.buffer}get length(){return this.buffer.length}writeInt32(e){this.buffer.push(e>>>24&255),this.buffer.push(e>>>16&255),this.buffer.push(e>>>8&255),this.buffer.push(255&e)}writeInt16(e){this.buffer.push(e>>>8&255),this.buffer.push(255&e)}writeByte(e){this.buffer.push(255&e)}writeBytes(e){for(let t=0;t<e.length;t++)this.buffer.push(e[t])}};function JR(e,t,i){e[i]=t>>>24&255,e[i+1]=t>>>16&255,e[i+2]=t>>>8&255,e[i+3]=255&t}function QR(e,t){return e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3]}function $R(e,t){return e[t]}function ek(e,t,i){return(new TextDecoder).decode(function(e,t,i){return e.slice(t,t+i)}(e,t,i))}var tk=0,ik=2654435769,rk=16,nk=2,ak=7;function ok(e,t){let i=new ZR,r=function(e,t,i){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"AVQualityReportSvc.C2S";return{version:arguments.length>4&&void 0!==arguments[4]?arguments[4]:2e3,encryption:arguments.length>5&&void 0!==arguments[5]?arguments[5]:2,d2:"",d2Len:0,uinType:arguments.length>6&&void 0!==arguments[6]?arguments[6]:30,uin:"",uinLen:0,reqHead:{seqNumber:i,appId:e,appidAtThird:new Uint8Array(0),a2:"",a2Len:0,serviceCmd:r,serviceCmdLen:0,cookie:"",cookieLen:0,imei:"",imeiLen:0,ksid:"",ksidLen:0,clientVersionInfo:"",clientVersionInfoLen:0},busiBuff:t}}(t,e,tk);tk=tk+1&2147483647,i.writeInt32(0),i.writeInt32(r.version),i.writeByte(r.encryption);let n=(new TextEncoder).encode(r.d2);i.writeInt32(n.length+4),n&&i.writeBytes(n),i.writeByte(r.uinType);let a=(new TextEncoder).encode(r.uin);i.writeInt32(a.length+4),a.length&&i.writeBytes(a);let o=new ZR;o.writeInt32(0),o.writeInt32(r.reqHead.seqNumber),o.writeInt32(r.reqHead.appId),o.writeByte(r.reqHead.appId>>>24&255),o.writeByte(r.reqHead.appId>>>16&255),o.writeByte(r.reqHead.appId>>>8&255),o.writeByte(255&r.reqHead.appId);for(let _=4;_<16;_++)o.writeByte(0);let s=(new TextEncoder).encode(r.reqHead.a2);o.writeInt32(s.length+4),s.length&&o.writeBytes(s);let c=(new TextEncoder).encode(r.reqHead.serviceCmd);o.writeInt32(c.length+4),c.length&&o.writeBytes(c);let l=(new TextEncoder).encode(r.reqHead.cookie);o.writeInt32(l.length+4),l.length&&o.writeBytes(l);let d=(new TextEncoder).encode(r.reqHead.imei);o.writeInt32(d.length+4),d.length&&o.writeBytes(d);let u=(new TextEncoder).encode(r.reqHead.ksid);o.writeInt32(u.length+4),u.length&&o.writeBytes(u);let h=(new TextEncoder).encode(r.reqHead.clientVersionInfo);o.writeInt16(h.length+2),h.length&&o.writeBytes(h);let p=o.length;o.data[0]=p>>>24&255,o.data[1]=p>>>16&255,o.data[2]=p>>>8&255,o.data[3]=255&p,Ok(e)&&(e=(new TextEncoder).encode(e)),o.writeInt32(e.length+4),e.length&&o.writeBytes(e);let f=new Uint8Array(o.data),m=null;1===r.encryption?m=(new TextEncoder).encode(r.uin):2===r.encryption&&(m=new Uint8Array(16)),m&&(f=function(e,t){let i=e.length,r=(i+1+nk+ak)%8;r&&(r=8-r);let n=i+1+nk+ak+r,a=new Uint8Array(n),o=0,s=new Uint8Array(8),c=new Uint8Array(8),l=new Uint8Array(8),d=0;s[0]=248&Math.floor(256*Math.random())|r,d=1;for(let h=0;h<r;h++)s[d]=255&Math.floor(256*Math.random()),d+=1;for(let h=0;h<nk;)if(d<8&&(s[d]=255&Math.floor(256*Math.random()),d+=1,h+=1),8===d){sk(s,t,c,l,a,o),o+=8,d=0;for(let e=0;e<8;e++)l[e]=a[o-8+e]}let u=0;for(;u<i;)if(d<8&&(s[d]=e[u],d+=1,u+=1),8===d){sk(s,t,c,l,a,o),o+=8,d=0;for(let e=0;e<8;e++)l[e]=a[o-8+e]}for(let h=0;h<ak;)if(d<8&&(s[d]=0,d+=1,h+=1),8===d){sk(s,t,c,l,a,o),o+=8,d=0;for(let e=0;e<8;e++)l[e]=a[o-8+e]}return a}(f,m)),i.writeBytes(f);let g=new Uint8Array(i.data),v=g.length;return g[0]=v>>>24&255,g[1]=v>>>16&255,g[2]=v>>>8&255,g[3]=255&v,g}function sk(e,t,i,r,n,a){for(let o=0;o<8;o++)e[o]^=r[o];!function(e,t,i,r){let n=QR(e,0),a=QR(e,4),o=[];for(let c=0;c<4;c++)o[c]=QR(t,4*c);let s=0;for(let c=0;c<rk;c++)s+=ik,s>>>=0,n+=(a<<4)+o[0]^a+s^(a>>>5)+o[1],n>>>=0,a+=(n<<4)+o[2]^n+s^(n>>>5)+o[3],a>>>=0;JR(i,n,r),JR(i,a,r+4)}(e,t,n,a);for(let o=0;o<8;o++)n[a+o]^=i[o];for(let o=0;o<8;o++)i[o]=e[o]}var ck=function(){return new URLSearchParams(location.search).get("trtc_env")||""},lk=e=>Number(e)<14e8,dk=function(e,t){let i;i=lk(e)?"https://apisgp.my-imcloud.com":"https://yun.tim.qq.com";let r=Math.floor(Math.random()*2**31);return"".concat(i,"/v5/AVQualityReportSvc/C2S?random=").concat(r,"&sdkappid=").concat(e,"&cmdtype=").concat(t)},uk="unknown";function hk(){!function(){var e;fk||(fk=!0,null==(e=navigator.connection)||e.addEventListener("typechange",pk))}();let{userAgent:e,connection:t}=navigator,i=(e.match(/NetType\/\S+/)||[])[0]||"";i=i.toLowerCase().replace("nettype/",""),"3gnet"===i&&(i="3g");let r=t&&t.type&&t.type.toLowerCase(),n=t&&t.effectiveType&&t.effectiveType.toLowerCase();return"slow-2"===n&&(n="2g"),r?mk(r,n):uk}function pk(){hO.warn("netType changed",hk())}var fk=!1;function mk(e,t){if(PA[e])return e;switch(e){case"cellular":case"wimax":return t||"unknown";case"ethernet":return"wired";default:return"unknown"}}function gk(e){uk=mk(e)}function vk(){return PA[hk()]}function _k(e,t){for(let i of Reflect.ownKeys(t))if("constructor"!==i&&"prototype"!==i&&"name"!==i){let r=Object.getOwnPropertyDescriptor(t,i)||"";Object.defineProperty(e,i,r)}return e}function yk(e){return Ek(e/4,arguments.length>1&&void 0!==arguments[1]?arguments[1]:48e3)}function Ek(e){return 1e3*e/(arguments.length>1&&void 0!==arguments[1]?arguments[1]:48e3)}function bk(e){return 4*wk(e,arguments.length>1&&void 0!==arguments[1]?arguments[1]:48e3)}function wk(e){return e*(arguments.length>1&&void 0!==arguments[1]?arguments[1]:48e3)/1e3}var Ik="undefined"!=typeof window&&"function"==typeof window.glog?window.glog:()=>{},Tk=()=>{let e=navigator.language;return e=e.substring(0,2),"zh"===e},Sk=function(e){if(!e||"object"!=typeof e||"[object Object]"!=Object.prototype.toString.call(e))return!1;let t=Object.getPrototypeOf(e);if(null===t)return!0;let i=Object.prototype.hasOwnProperty.call(t,"constructor")&&t.constructor;return"function"==typeof i&&i instanceof i&&Function.prototype.toString.call(i)===Function.prototype.toString.call(Object)};function Ak(e){let t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;return e<=1?t:Ak(e-1,t,(arguments.length>1&&void 0!==arguments[1]?arguments[1]:1)+t)}function Rk(e){return e>8?3e4:1e3*Ak(e)}function kk(e){return Reflect.apply(Object.prototype.toString,e,[]).replace(/^\[object\s(\w+)\]$/,"$1").toLowerCase()}var Ck=e=>"function"==typeof e,Dk=e=>void 0===e,Ok=e=>"string"==typeof e,Lk=e=>"number"==typeof e,Nk=e=>"boolean"==typeof e,xk=e=>"object"===kk(e),Pk=e=>"array"===kk(e),Mk=e=>kk(e)==="MediaStreamTrack".toLowerCase(),Uk=e=>e.isRemote,Bk=e=>"promise"===kk(e),Fk=e=>Ck(e)&&e.prototype.constructor===e,Vk=e=>Fk(e)?e.prototype.constructor.name:"",Hk="undefined"!=typeof AudioWorkletNode,jk="undefined"!=typeof HTMLMediaElement&&"setSinkId"in HTMLMediaElement.prototype;function zk(e){return new Promise(((t,i)=>{let r=[];e.forEach((n=>{n.then(t).catch((t=>{r.push(t),r.length===e.length&&i(r)}))}))}))}function Wk(){return performance&&performance.now?Math.floor(performance.now()):Date.now()}var Gk=e=>+e<10?"0".concat(e):e,qk=e=>{let t=e.match(/^\d+\.\d+\.\d+/)[0];if(!t)return e;let i=t.split("."),r=Gk(i[1])+Gk(i[2]);return i[1]-15>0&&(i[1]="15"),i[2]-15>0&&(i[2]="15"),"".concat(i.join("."),".").concat(r)},Kk=Object.prototype.hasOwnProperty;function Yk(e){if(null==e)return!0;if("boolean"==typeof e)return!1;if("number"==typeof e)return 0===e;if("string"==typeof e||"function"==typeof e||Array.isArray(e))return 0===e.length;if(e instanceof Error)return""===e.message;if(Sk(e))switch(Object.prototype.toString.call(e)){case"[object File]":case"[object Map]":case"[object Set]":return 0===e.size;case"[object Object]":for(let t in e)if(Kk.call(e,t))return!1;return!0}return!1}function Xk(e,t){return{userId:t,hasAudio:!!(8&e),hasVideo:!!(1&e),hasAuxiliary:!!(4&e),hasSmall:!!(2&e),audioMuted:!!(64&e),videoMuted:!!(16&e),audioAvailable:!(!(8&e)||64&e),videoAvailable:!(!(1&e)||16&e)}}function Zk(e){let t={urls:e.url.startsWith("turn:")||e.url.startsWith("turns:")?e.url:"turn:".concat(e.url)};return!Dk(e.username)&&!Dk(e.credential)&&(t.username=e.username,t.credential=e.credential,t.credentialType="password",Dk(e.credentialType)||(t.credentialType=e.credentialType)),t}function Jk(e){let t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(!Ok(e))return 0;let i=e.split(".");return t?(Number(i[0])<<24|Number(i[1])<<16|Number(i[2])<<8|Number(i[3]))>>>0:(Number(i[3])<<24|Number(i[2])<<16|Number(i[1])<<8|Number(i[0]))>>>0}var Qk=function(e,t,i,r){if(!xk(e)||!xk(t))return 0;let n,a=0,o=Object.keys(t);for(let s=0,c=o.length;s<c;s++)if(n=o[s],!(Dk(t[n])||i&&i.includes(n)))if(xk(e[n])&&xk(t[n]))a+=Qk(e[n],t[n],i,r);else{if(r&&r.includes(t[n]))continue;e[n]!==t[n]&&(e[n]=$k(t[n]),a+=1)}return a};function $k(e){if(Pk(e)){let t=[];return e.forEach(((e,i)=>{t[i]=$k(e)})),t}if(xk(e)){let t={};return Object.keys(e).forEach((i=>{t[i]=$k(e[i])})),t}return e}var eC=e=>{let t=[];if(Pk(e))t=[...e];else if(Ok(e)){let i=document.getElementById(e);i&&t.push(i)}else e&&t.push(e);return t},tC=e=>Ok(e)?document.getElementById(e):e,iC=()=>(e=>{let t=e=>e<10?"0".concat(e):"".concat(e),i=e.getFullYear(),r=e.getMonth()+1,n=e.getDate(),a=t(e.getHours()),o=t(e.getMinutes()),s=t(e.getSeconds());return"".concat(i,"/").concat(r,"/").concat(n," ").concat(a,":").concat(o,":").concat(s)})(new Date);function rC(e,t){let{keysToInclude:i,keysToExclude:r}=t;try{if(Pk(e))return"[".concat(e.map((e=>rC(e,{keysToInclude:i,keysToExclude:r}))).join(","),"]");if(!Sk(e)||!Pk(i)&&!Pk(r))return JSON.stringify(e);let t={},n=new Set(i),a=new Set(r);return Object.keys(e).forEach((o=>{(0===a.size&&n.has(o)||0===n.size&&!a.has(o))&&(t[o]=Sk(e[o])||Pk(e[o])?JSON.parse(rC(e[o],{keysToExclude:r,keysToInclude:i})):e[o])})),JSON.stringify(t)}catch(IA){return"{}"}}function nC(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=[];return Object.keys(e).forEach((r=>{t===e[r]&&i.push(r)})),rC(e,{keysToInclude:i})}function aC(e){return e.replace(/[\u4e00-\u9fa5]/g,"aa").length}var oC=()=>{var e,t,i,r;return null!=(e=window.screen)&&e.orientation?!(null==(r=null==(i=null==(t=window.screen)?void 0:t.orientation)?void 0:i.type)||!r.includes("portrait")):0===window.orientation||180===window.orientation},sC=async e=>new Promise(((t,i)=>{let r;if(Ok(e))r=new Image,r.crossOrigin="anonymous",r.src=e;else if(r=e,r.complete)return void t(r);r.onload=()=>t(r),r.onerror=()=>{i(new FR({code:UR.INVALID_PARAMETER,message:"load image failed, url: ".concat(e)}))}})),cC=e=>{let t=e.split(".");return+t[0]<<24|+t[1]<<16|+t[2]<<8|+t[3]},lC=e=>(Object.keys(e).forEach((t=>{Lk(e[t])&&(t.startsWith("uint")||t.startsWith("int"))?e[t]=Math.floor(e[t]):(Sk(e[t])||Pk(e[t]))&&lC(e[t])})),e);function dC(e,t){return new Promise((i=>{let r=setTimeout(i,e);t&&t(r)}))}function uC(e,t){let i=null;return function(){for(var r=arguments.length,n=new Array(r),a=0;a<r;a++)n[a]=arguments[a];return i||(i=e.apply(t||this,n),i.finally((()=>i=null)),i)}}function hC(e){return e.replace(/(^|[^:])\/{2,}/g,"$1/")}function pC(e){var t;try{let{width:i,height:r,frameRate:n,sampleRate:a,sampleSize:o,channelCount:s}=null==(t=e.getSettings)?void 0:t.call(e),c=e.kind===BA?"".concat(a,"x").concat(o,"@").concat(s):"".concat(i,"x").concat(r,"@").concat(n),l=e.stats?" stats: ".concat(JSON.stringify(e.stats).replaceAll('"',"")):"";return"".concat(e.id," ").concat(e.readyState," muted:").concat(e.muted," ").concat(e.kind," ").concat(e.label," ").concat(c).concat(l)}catch(eP){return""}}function fC(e,t){return e.width*e.height==t.width*t.height?1:oC()&&t.width>t.height&&e.height>t.width?Math.max(e.width/t.height,e.height/t.width,1):Math.max(e.width/t.width,e.height/t.height,1)}function mC(e){return 90===e||270===e}async function gC(e){return new Promise(((t,i)=>{let r=document.createElement("video");r.crossOrigin="anonymous",r.src=e,r.muted=!0,r.loop=!0,r.playsInline=!0,r.play().then((()=>t(r))),r.onerror=()=>{i(r.error)}}))}function vC(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new WeakMap;if("object"!=typeof e||null===e)return e;if(t.has(e))return t.get(e);if(Array.isArray(e)){let i=[];return t.set(e,i),e.forEach(((e,r)=>{i[r]=vC(e,t)})),i}if("[object Object]"===Object.prototype.toString.call(e)){let i={};return t.set(e,i),Reflect.ownKeys(e).forEach((r=>{i[r]=vC(e[r],t)})),i}return e}var _C=(e=>(e[e.END_REPORT=2001]="END_REPORT",e[e.LOG=2002]="LOG",e[e.KEY_METRIC_REPORT=2003]="KEY_METRIC_REPORT",e))(_C||{});function yC(e,t,i,r){try{let n=function(e,t,i,r){let n={data:e,random:Math.floor(2147483648*Math.random()),sdkAppId:i};return Dk(r)||(n=aA(nA({},n),{gzip:+r})),{uint32_sdkappid:0,uint64_from_uin:0,uint32_timestamp:0,uint32_seq:0,msg_common_info:{msg_device_info:{enum_device_type:0,str_device_brand:"",str_device_model:"",str_device_board:"",str_device_cpu_abi:""},msg_system_info:{enum_os_type:0,str_os_version:"",msg_network_info:0},msg_network_info:{enum_network_type:0}},msg_report_content:{uint32_type:t,bytes_report_data:JSON.stringify(n)}}}(e,t,i,r);return ok(XR(n),i)}catch(n){return JSON.stringify(e)}}function EC(e,t){let i=new Uint8Array(e.byteLength+t.byteLength);return i.set(new Uint8Array(e),0),i.set(new Uint8Array(t),e.byteLength),i.buffer}function bC(e){return(65535&e)>>>0}function wC(e){return(4294901760&e)>>>0}function IC(e){let t=function(e){try{let t={},i=0;t.totalLength=QR(e,i),i+=4,t.version=QR(e,i),i+=4,t.encryption=$R(e,i),i+=1,t.uinType=$R(e,i),i+=1,t.uinLength=QR(e,i),i+=4,t.uin=t.uinLength>4?ek(e,i,t.uinLength-4):"",i+=t.uinLength-4;let r=e.slice(i);if(2===t.encryption){e=function(e,t){let i=0,r=new Uint8Array(8).fill(0),n=new Uint8Array(e.slice(0,8)),a=TC(n,t),o=7&a[0],s=e.length-1-o-nk-ak,c=new Uint8Array(s),l=0,d=r,u=e.slice(0,8);i=8;let h=1;h+=o;for(let f=1;f<=nk;)if(h<8)h++,f++;else if(8===h){let r=SC(e,i,d,u,a,t);d=r.ivPreCrypt,u=r.ivCurCrypt,a=r.debiBuf,i=r.bufPos,h=0}let p=s;for(;p>0;)if(h<8)c[l++]=a[h]^d[h],h++,p--;else if(8===h){let r=SC(e,i,d,u,a,t);d=r.ivPreCrypt,u=r.ivCurCrypt,a=r.debiBuf,i=r.bufPos,h=0}for(let f=1;f<=ak;)if(h<8)a[h],d[h],h++,f++;else if(8===h){if(i>=e.length)break;let r=SC(e,i,d,u,a,t);if(!r.success)break;d=r.ivPreCrypt,u=r.ivCurCrypt,a=r.debiBuf,i=r.bufPos,h=0}return c}(r,new Uint8Array(16).fill(0)),t.decrypted=!0,i=0}else e=r,i=0;return t.rspHeadLength=QR(e,i),i+=4,t.seqNo=QR(e,i),i+=4,t.retCode=QR(e,i),i+=4,t.retStrLength=QR(e,i),i+=4,t.retStr=t.retStrLength?ek(e,i,t.retStrLength-4):"",i+=t.retStrLength-4,t.serviceCmdLength=QR(e,i),i+=4,t.serviceCmd=t.serviceCmdLength?ek(e,i,t.serviceCmdLength-4):"",i+=t.serviceCmdLength-4,t.cookieLength=QR(e,i),i+=4,t.cookie=t.cookieLength?ek(e,i,t.cookieLength-4):"",i+=t.cookieLength-4,t.flag=QR(e,i),i+=4,t.busiBuffLength=QR(e,i),i+=4,t.busiBuff=t.busiBuffLength?ek(e,i,t.busiBuffLength-4):"",i+=t.busiBuffLength-4,t}catch(t){}}(e);return null==t?void 0:t.busiBuff}function TC(e,t){let i=e[0]<<24|e[1]<<16|e[2]<<8|e[3],r=e[4]<<24|e[5]<<16|e[6]<<8|e[7];i>>>=0,r>>>=0;let n=ik*rk>>>0;for(let a=0;a<rk;a++)r-=(i<<4)+t[2]^i+n^(i>>>5)+t[3],r>>>=0,i-=(r<<4)+t[0]^r+n^(r>>>5)+t[1],i>>>=0,n-=ik,n>>>=0;return new Uint8Array([i>>>24&255,i>>>16&255,i>>>8&255,255&i,r>>>24&255,r>>>16&255,r>>>8&255,255&r])}function SC(e,t,i,r,n,a){if(t+8>e.length)return{success:!1};let o=new Uint8Array(r),s=e.slice(t,t+8),c=new Uint8Array(8);for(let l=0;l<8;l++)c[l]=n[l]^s[l];return{success:!0,ivPreCrypt:o,ivCurCrypt:s,debiBuf:TC(c,a),bufPos:t+8}}var AC="undefined"!=typeof TextDecoder?new TextDecoder:void 0;function RC(e){let{url:t,body:i,method:r="POST",timeout:n,priority:a}=e;return new Promise(((e,o)=>{if("fetch"in window)return fetch(t,{method:r,body:i,priority:a}).then((e=>e.clone().json().then((e=>({data:e})),(()=>e.arrayBuffer().then((e=>({data:IC(new Uint8Array(e))||(AC?AC.decode(e):e)}))))))).then(e,o);let s=new XMLHttpRequest;s.onreadystatechange=()=>{if(4===s.readyState)if(s.status>=200&&s.status<300)try{let t=JSON.parse(s.response);e({data:t})}catch(t){e({data:s.response})}else o({status:s.status,statusText:s.statusText||"request failed!"})},s.timeout=n||5e3,s.open(r,t,!0),s.send(i)}))}var kC=Object.prototype.hasOwnProperty,CC=e=>"function"==typeof e,DC=e=>void 0===e,OC=e=>e.isRemote;function LC(e){if(null==e)return!0;if("boolean"==typeof e)return!1;if("number"==typeof e)return 0===e;if("string"==typeof e||"function"==typeof e||Array.isArray(e))return 0===e.length;if(e instanceof Error)return""===e.message;if(function(e){if(!e||"object"!=typeof e||"[object Object]"!=Object.prototype.toString.call(e))return!1;let t=Object.getPrototypeOf(e);if(null===t)return!0;let i=Object.prototype.hasOwnProperty.call(t,"constructor")&&t.constructor;return"function"==typeof i&&i instanceof i&&Function.prototype.toString.call(i)===Function.prototype.toString.call(Object)}(e))switch(Object.prototype.toString.call(e)){case"[object File]":case"[object Map]":case"[object Set]":return 0===e.size;case"[object Object]":for(let t in e)if(kC.call(e,t))return!1;return!0}return!1}var NC=function(e){let{retryFunction:t,settings:i,onError:r,onRetrying:n,onRetryFailed:a,onRetrySuccess:o,context:s}=e;return function(){for(var e=arguments.length,c=new Array(e),l=0;l<e;l++)c[l]=arguments[l];let{retries:d=5,timeout:u=1e3}=i,h=0,p=-1,f=0,m=async(e,i)=>{let l=s||this;try{let i=await t.apply(l,c);h>0&&o&&o.call(this,h),h=0,e(i)}catch(g){let t=()=>{clearTimeout(p),h=0,f=2,i(g)},o=()=>{2!==f&&h<(CC(d)?d():d)?(h++,f=1,CC(n)&&n.call(this,h,t),p=window.setTimeout((()=>{p=-1,m(e,i)}),CC(u)?u(h):u)):(t(),CC(a)&&a.call(this,g))};CC(r)?r.call(this,{error:g,retry:o,reject:i,retryFuncArgs:c,retriedCount:h}):o()}};return new Promise(m)}},xC=class e{constructor(e){uA(this,"_parentPath"),uA(this,"userId"),uA(this,"remoteUserId"),uA(this,"id"),uA(this,"sdkAppId"),uA(this,"type"),uA(this,"isLocal"),this.id=e.id,this.userId=e.userId,this.sdkAppId=e.sdkAppId,this.remoteUserId=e.remoteUserId,this.isLocal=!(e=>"boolean"==typeof e)(e.isLocal)||e.isLocal,this.type=this.isLocal?"":e.type}getFullId(){return this._parentPath&&this.id?"".concat(this._parentPath,"-").concat(this.id):this._parentPath?this._parentPath:this.id}createChild(t){let i=new e({id:t.id,userId:DC(t.userId)?this.userId:t.userId,sdkAppId:DC(t.sdkAppId)?this.sdkAppId:t.sdkAppId,type:DC(t.type)?this.type:t.type,isLocal:DC(t.isLocal)?this.isLocal:t.isLocal,remoteUserId:DC(t.remoteUserId)?this.remoteUserId:t.remoteUserId});return i.bindParent(this),i}bindParent(e){let t=e.getFullId();this._parentPath!==t&&(this.debug("bind logger parent: ".concat(e.id)),this._parentPath=t,this.userId=e.userId||this.userId,this.sdkAppId=e.sdkAppId||this.sdkAppId)}setUserId(e){this.userId=e}setSdkAppId(e){this.sdkAppId=e}log(e,t){let i=this.isLocal?this.userId:this.remoteUserId,r=this.getFullId();t.unshift("[".concat(this.isLocal?"↑":"↓").concat(this.type&&"main"!==this.type?"*":"").concat(r).concat(i?"|".concat(i):"","]")),hO.log(e,t,DC(this.userId)||LC(this.userId),this.userId,this.sdkAppId)}info(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];this.log(2,t)}debug(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];this.log(1,t)}warn(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];this.log(3,t)}error(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];this.log(4,t)}},PC="undefined"==typeof navigator?"":navigator.userAgent,MC=e=>new RegExp(e,"i").test(PC),UC=e=>{if(MC(e)){let t=new RegExp("".concat(e,"\\/([\\d.]+)")),i=PC.match(t);if(i&&i[1])return i[1]}return""},BC=e=>{if(MC(e)){let t=new RegExp("".concat(e,"\\/(\\d+)")),i=PC.match(t);if(i&&i[1])return parseFloat(i[1])}return NaN},FC=/AppleWebKit\/([\d.]+)/i.exec(PC);FC&&parseFloat(FC[1]);var VC=MC("iPad"),HC="undefined"!=typeof navigator&&navigator.maxTouchPoints&&navigator.maxTouchPoints>2&&MC("Macintosh"),jC=MC("iPhone")&&!VC,zC=MC("iPod"),WC=jC||VC||zC||HC,GC=MC("Android"),qC=function(){if(GC){let e=PC.match(/Android (\d+)(?:\.(\d+))?(?:\.(\d+))*/i);if(e){let t=e[1]&&parseFloat(e[1]),i=e[2]&&parseFloat(e[2]);if(t&&i)return parseFloat("".concat(e[1],".").concat(e[2]));if(t)return t}}return NaN}();GC&&MC("webkit");var KC=MC("Firefox"),YC=UC("Firefox"),XC=BC("Firefox"),ZC=MC("Edge"),JC=UC("Edge"),QC=MC("Edg"),$C=UC("Edg"),eD=BC("Edg"),tD=MC("SogouMobileBrowser"),iD=UC("SogouMobileBrowser"),rD=MC("MetaSr\\s"),nD=UC("MetaSr\\s"),aD=MC("TBS"),oD=UC("TBS"),sD=MC("XWEB"),cD=UC("XWEB");MC("MSIE\\s8\\.0");var lD=MC("MSIE\\/\\d+");!function(){if(lD){let e=/MSIE\s(\d+)\.\d/.exec(PC),t=e&&parseFloat(e[1]);return!t&&/Trident\/7.0/i.test(PC)&&/rv:11.0/.test(PC)&&(t=11),t}}();var dD=MC("(micromessenger|webbrowser)"),uD=UC("MicroMessenger"),hD=!aD&&MC("MQQBrowser")&&MC("COVC"),pD=!aD&&MC("MQQBrowser")&&!MC("COVC"),fD=pD||hD?UC("MQQBrowser"):"",mD=!aD&&MC(" QQBrowser"),gD=UC(" QQBrowser"),vD=!aD&&MC("QQBrowserLite"),_D=UC("QQBrowserLite"),yD=!aD&&MC("MQBHD"),ED=UC("MQBHD"),bD=MC("Windows"),wD=!WC&&MC("MAC OS X"),ID=!GC&&MC("Linux"),TD=MC("CrOS");MC("MicroMessenger");var SD=MC("UCBrowser");MC("Electron");var AD=MC("MiuiBrowser"),RD=UC("MiuiBrowser"),kD=MC("HuaweiBrowser"),CD=MC("Huawei")||MC("HUAWEI"),DD=MC("Honor")||MC("HONOR"),OD=UC("HuaweiBrowser"),LD=MC("SamsungBrowser"),ND=UC("SamsungBrowser"),xD=MC("HeyTapBrowser"),PD=UC("HeyTapBrowser"),MD=MC("VivoBrowser"),UD=UC("VivoBrowser"),BD=MC("OpenHarmony");UC("OpenHarmony");var FD=()=>BC("Chrome"),VD=MC("CriOS"),HD=MC("Chrome"),jD=!ZC&&!rD&&!tD&&!aD&&!sD&&!QC&&!mD&&!AD&&!kD&&!LD&&!xD&&!MD&&HD,zD=MC("HeadlessChrome"),WD=FD(),GD=UC("Chrome");BC("Electron");var qD=!HD&&!pD&&!hD&&!vD&&!yD&&MC("Safari"),KD=qD||WC,YD=UC("Version");/Android.*(wv|.0.0.0)/.test(PC);var XD=(()=>{if(HC)return YD;if(WC){let e=PC.match(/OS (\d+)_(\d+)/i);if(e&&e[1]){let t=e[1];return e[2]&&(t+=".".concat(e[2])),t}}return""})();var ZD=Number(XD.split(".")[0]),JD="15.1"===XD,QD=(()=>{let e=Number(XD.split(".")[0]);return 14===e||13===e})(),$D=VD&&"11.1.1"===YD,eO="undefined"!=typeof location&&("file:"===location.protocol||"localhost"===location.hostname||"127.0.0.1"===location.hostname),tO=(()=>{let e;return()=>{if(void 0===e)try{e=!!window.localStorage}catch(t){e=!1}return e}})(),iO=function(){let e=new Map([[KC,["Firefox",YC]],[QC,["Edg",$C]],[jD,["Chrome",GD]],[VD,["ChiOS",UC("CriOS")]],[qD&&!VD,["Safari",YD]],[aD,["TBS",oD]],[sD,["XWEB",cD]],[dD&&jC,["WeChat",uD]],[mD,["QQ(Win)",gD]],[pD,["QQ(Mobile)",fD]],[hD,["QQ(Mobile X5)",fD]],[vD,["QQ(Mac)",_D]],[yD,["QQ(iPad)",ED]],[AD,["MI",RD]],[kD,["HW",OD]],[LD,["Samsung",ND]],[xD,["OPPO",PD]],[MD,["VIVO",UD]],[ZC,["EDGE",JC]],[tD,["SogouMobile",iD]],[rD,["Sogou",nD]]]),t="unknown",i="unknown";return e.has(!0)&&([t,i]=e.get(!0)),{name:t,version:i}}();function rO(){return function(){let e=/;\s*([^;)]+)\s+Build\//,t=PC.match(e);return null!=t&&t[1]?t[1].trim():null}()||""}var nO=new Map([[GC,"Android"],[WC,"iOS"],[bD,"Windows"],[wD,"MacOS"],[ID,"Linux"],[TD,"ChromeOS"]]),aO=function(){return nO.get(!0)?nO.get(!0):"unknown"};function oO(){return bD?1:GC?2:wD?3:WC?4:ID?5:TD?6:BD?7:0}var sO=()=>{let e=aO();return WC?e+="/".concat(XD):GC&&(e+="/".concat(qC)),e+="/".concat(iO.name,"/").concat(qD&&!VD?iO.version:iO.version.split(".")[0]),e},cO=new(lA(pA(),1).default),lO=_A,dO=new class{constructor(){uA(this,"enable",!1),uA(this,"ssoFailCount",0),cO.on("22",(e=>{let{schedule:t}=e;var i;null!=(i=null==t?void 0:t.config)&&i.sso&&cO.emit("266",{enable:!0})})),cO.on("266",(e=>{let{enable:t}=e;this.enable=t}))}handleUploadFailed(){this.ssoFailCount++,this.ssoFailCount>3&&cO.emit("266",{enable:!1})}},uO=class e{constructor(){uA(this,"_isEnableUploadLog",!0),uA(this,"_localJoinedUser",new Map),uA(this,"_queue",[]),uA(this,"_timeoutId",-1),uA(this,"_logLevel",1),uA(this,"_logLevelToUpload",2),!RA&&!kA&&(this.checkURLParam(),this.installEvents())}get isAbleToUpload(){return this._isEnableUploadLog&&-1!==this._timeoutId}installEvents(){cO.on(lO.JOIN_SCHEDULE_SUCCESS,(e=>{let{schedule:t}=e;var i;null!=(i=null==t?void 0:t.config)&&i.logLevelToUpload&&xA[t.config.logLevelToUpload]&&(this._logLevelToUpload=t.config.logLevelToUpload)})),cO.on(lO.JOIN_START,(e=>{let{params:t}=e;this.addJoinedUser({userId:t.userId,sdkAppId:t.sdkAppId}),this.startUpload()})),cO.on(lO.LEAVE_SUCCESS,(e=>{let{room:t}=e;this.deleteJoinedUser(t.userId)}))}startUpload(){-1===this._timeoutId&&this.uploadInterval()}addJoinedUser(e){this._localJoinedUser.set(e.userId,e),this.startUpload()}deleteJoinedUser(e){this._localJoinedUser.delete(e)}uploadInterval(){this.upload().catch((()=>{})),this._timeoutId=window.setTimeout((()=>this.uploadInterval()),5e3)}getLogsToUpload(){let e={map:new Map,splicedQueue:[]};if(this._queue[0].forAllJoinedClients&&0===this._localJoinedUser.size)return e;let t=0;for(;t<this._queue.length&&50!==t;t++){let i=this._queue[t];if(i.forAllJoinedClients)this._localJoinedUser.forEach((t=>{let{userId:r,sdkAppId:n}=t;e.map.has(r)?e.map.get(r).logs.push(i):e.map.set(r,{userId:r,sdkAppId:n,logs:[i]})}));else if(Ok(i.userId)&&Lk(i.sdkAppId)){let{userId:t,sdkAppId:r}=i;e.map.has(t)?e.map.get(t).logs.push(i):e.map.set(t,{userId:t,sdkAppId:r,logs:[i]})}}return e.map.size>0&&(e.splicedQueue=this._queue.splice(0,t)),e}async upload(){if(0===this._queue.length||!this._isEnableUploadLog)return;let{map:e,splicedQueue:t}=this.getLogsToUpload();if(0===e.size)return;try{let t=[...e.values()];for(let e=0;e<t.length;e++){let{userId:i,sdkAppId:r,logs:n}=t[e],a={timestamp:HR(),sdkAppId:String(r),userId:i,version:AA,log:n.map((e=>e.log)).join("\n")},o=JSON.stringify(a),s=dO.enable?yC(a,2002,r):o;await this.uploadLogWithRetry(s,r,s instanceof Uint8Array,o),n.forEach((e=>e.uploaded=!0))}}catch(r){}let i=t.filter((e=>!e.uploaded));i.length>0&&(this._queue=i.concat(this._queue))}uploadLogWithRetry(e,t,i,r){return NC({retryFunction:()=>RC({url:dk(t,LA),body:e,timeout:5e3,priority:"low"}).then((e=>{i&&"ok"!==e.data&&(dO.handleUploadFailed(),this.uploadLogWithRetry(r,t,!1,r))})),settings:{retries:3,timeout:2e3},onError:e=>{let{retry:t}=e;t()}})()}getPrefix(e){let t=new Date;return t.setTime(VR()),"[".concat(function(e){let t=String(e.getMilliseconds());return"padStart"in String.prototype&&(t=t.toString().padStart(3,"0")),"".concat(e.toTimeString().replace(/.*(\d{2}:\d{2}:\d{2}).*/,"$1"),":").concat(t)}(t),"] <").concat(xA[e],">")}getLogLevel(){return this._logLevel}setLogLevel(e){Dk(xA[e])||(this._logLevel!==e&&this.info("setLogLevel",e),this._logLevel=e)}enableUploadLog(){this._isEnableUploadLog=!0}disableUploadLog(){this.warn("disableUploadLog"),this._isEnableUploadLog=!1}logChunkToString(e){if(Ok(e))return e;try{return e instanceof Error?e.toString():JSON.stringify(e)}catch(eP){return""}}addLogToQueue(e,t){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],r=arguments.length>3?arguments[3]:void 0,n=arguments.length>4?arguments[4]:void 0,a={log:t.reduce(((e,t)=>"".concat(e," ").concat(this.logChunkToString(t)).trim()),""),level:e,userId:r,sdkAppId:n,forAllJoinedClients:i};cO.emit(lO.LOG,{log:a}),this._isEnableUploadLog&&e>=this._logLevelToUpload&&this._queue.push(a)}log(t,i){let r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],n=arguments.length>3?arguments[3]:void 0,a=arguments.length>4?arguments[4]:void 0;var o;if(i.unshift(this.getPrefix(t)),this.addLogToQueue(t,i,r,n,a),t<this._logLevel)return;let s=(null==(o=xA[t])?void 0:o.toLowerCase())||"info";e.PRINT_LOG_TAG?console[s]("%cTRTC%c%s","padding: 1px 4px;border-radius: 3px;color: #fff;background: #1E88E5;","display: inline",...i):console[s](...i)}debug(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];this.log(1,t)}info(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];this.log(2,t)}warn(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];this.log(3,t)}error(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];this.log(4,t)}createLogger(e){if(e.parent instanceof xC){let t=e,{parent:i}=t,r=((e,t)=>{var i={};for(var r in e)tA.call(e,r)&&t.indexOf(r)<0&&(i[r]=e[r]);if(null!=e&&$S)for(var r of $S(e))t.indexOf(r)<0&&iA.call(e,r)&&(i[r]=e[r]);return i})(t,["parent"]),n=new xC(r);return n.bindParent(i),n}return new xC(e)}checkURLParam(){let e=new URLSearchParams(location.search).get("logLevelToUpload"),t=e?Number(e):-1;xA[t]&&(this._logLevelToUpload=t)}getQueue(){return this._queue}};uA(uO,"PRINT_LOG_TAG",!(WC||GC||zD));var hO=new uO,pO=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(e=>{let t=16*Math.random()|0;return("x"==e?t:3&t|8).toString(16)}))},fO=new class{constructor(){uA(this,"_prefix","TRTC"),uA(this,"_queue",new Map)}getRealKey(e){return"".concat(this._prefix,"_").concat(e)}checkStorage(){tO()&&(setInterval(this.doFlush.bind(this),2e4),Object.keys(localStorage).filter((e=>{if(e.startsWith(this._prefix))try{let t=localStorage.getItem(e);if(!t)return!1;let i=JSON.parse(t);if(i&&i.expiresIn<Date.now())return!0}catch(t){return!1}return!1})).forEach((e=>localStorage.removeItem(e))))}doFlush(){if(tO())try{for(let[e,t]of this._queue)localStorage.setItem(e,JSON.stringify(t))}catch(e){hO.warn(e)}}getItem(e){if(!tO())return null;try{let t=localStorage.getItem(this.getRealKey(e));if(!t)return null;let i=JSON.parse(t);return i&&i.expiresIn>=Date.now()?i.value:null}catch(eP){hO.warn(eP)}}setItem(e,t){if(tO())try{let i={expiresIn:Date.now()+6048e5,value:t};this._queue.set(this.getRealKey(e),i)}catch(IA){hO.warn(IA)}}deleteItem(e){if(!tO())return!1;try{return e=this.getRealKey(e),this._queue.delete(e),localStorage.removeItem(e),!0}catch(eP){return hO.warn(eP),!1}}clear(){if(tO())try{localStorage.clear()}catch(e){hO.warn(e)}}};cA({},{HTTPS_API:()=>WO,IS_GET_CAPABILITIES_FROM_INPUTDEVICE_SUPPORTED:()=>hL,IS_GET_CAPABILITIES_SUPPORTED:()=>uL,IS_GET_SETTINGS_SUPPORTED:()=>dL,IS_GET_SYNCHRONIZATION_SOURCES_SUPPORTED:()=>lL,IS_INSERTABLE_STREAM_SUPPORTED:()=>pL,IS_JITTER_BUFFER_TARGET_SUPPORTED:()=>AL,IS_RTC_RTP_SENDER_SUPPORTED:()=>oL,IS_SCRIPT_TRANSFORM_SUPPORTED:()=>fL,IS_SEI_SUPPORTED:()=>mL,IS_SPC_SUPPORTED:()=>nL,basis:()=>bL,capabilityCheck:()=>TL,checkSystemRequirementsInternal:()=>BO,decodeSupportStatus:()=>UO,detectVideoCodecCapabilities:()=>CL,detectVideoDecoderCapabilities:()=>OL,detectVideoEncoderCapabilities:()=>DL,encodeSupportStatus:()=>MO,getBrowserInfo:()=>kO,getDisplayResolution:()=>qO,getH264ProfileLevelIds:()=>LL,isAddTransceiverSupported:()=>rL,isBrowserSupported:()=>CO,isCanvasCaptureStreamAPISupported:()=>XO,isCanvasSmallStreamSupported:()=>ZO,isGetReceiversSupported:()=>eL,isGetSendersSupported:()=>tL,isGetTransceiversSupported:()=>iL,isGetUserMediaSupported:()=>KO,isMediaDevicesSupported:()=>OO,isMediaSessionSupported:()=>_L,isMediaStreamTrackGeneratorSupported:()=>PO,isMediaStreamTrackProcessorSupported:()=>xO,isReplaceTrackSupported:()=>sL,isRequestVideoFrameCallbackSupported:()=>SL,isSIMDSupported:()=>EL,isScaleResolutionDownBySupported:()=>JO,isScreenCaptureApiAvailable:()=>VO,isSelectedCandidatePair:()=>GO,isSetParametersSupported:()=>cL,isSetSinkIdSupported:()=>HO,isSmallStreamSupported:()=>QO,isStopTransceiverSupported:()=>aL,isTRTCSupported:()=>FO,isUnifiedPlanDefault:()=>$O,isUsedInHttpProtocol:()=>NO,isWebAudioSupported:()=>YO,isWebCodecSupported:()=>vL,isWebCodecsSupported:()=>DO,isWebRTCSupported:()=>gL,isWebTransportSupported:()=>yL});var mO={AVOID_REPEATED_CALL:"AVOID_REPEATED_CALL",INVALID_PARAMETER_REQUIRED:"INVALID_PARAMETER_REQUIRED",INVALID_PARAMETER_TYPE:"INVALID_PARAMETER_TYPE",INVALID_PARAMETER_EMPTY:"INVALID_PARAMETER_EMPTY",INVALID_PARAMETER_INSTANCE:"INVALID_PARAMETER_INSTANCE",INVALID_PARAMETER_RANGE:"INVALID_PARAMETER_RANGE",INVALID_PARAMETER_MIN:"INVALID_PARAMETER_MIN",INVALID_PARAMETER_MAX:"INVALID_PARAMETER_MAX",INVALID_PARAMETER_STREAMTYPE:"INVALID_PARAMETER_STREAMTYPE",API_CALL_TIMEOUT:"API_CALL_TIMEOUT",SIGNAL_CHANNEL_RECONNECTION_FAILED:"SIGNAL_CHANNEL_RECONNECTION_FAILED",SIGNAL_CHANNEL_SETUP_FAILED:"SIGNAL_CHANNEL_SETUP_FAILED",ERROR_MESSAGE:"ERROR_MESSAGE",EXCHANGE_SDP_TIMEOUT:"EXCHANGE_SDP_TIMEOUT",DOWNLINK_RECONNECTION_FAILED:"DOWNLINK_RECONNECTION_FAILED",EXCHANGE_SDP_FAILED:"EXCHANGE_SDP_FAILED",UPDATE_OFFER_TIMEOUT:"UPDATE_OFFER_TIMEOUT",UPLINK_RECONNECTION_FAILED:"UPLINK_RECONNECTION_FAILED",INVALID_RECORDID:"INVALID_RECORDID",INVALID_PURE_AUDIO:"INVALID_PURE_AUDIO",INVALID_STREAMID:"INVALID_STREAMID",INVALID_USER_DEFINE_RECORDID:"INVALID_USER_DEFINE_RECORDID",INVALID_USER_DEFINE_PUSH_ARGS:"INVALID_USER_DEFINE_PUSH_ARGS",INVALID_PROXY:"INVALID_PROXY",INVALID_JOIN:"INVALID_JOIN",INVALID_ROOMID_STRING:"INVALID_ROOMID_STRING",INVALID_ROOMID_INTEGER:"INVALID_ROOMID_INTEGER",INVALID_SIGNAL_CHANNEL:"INVALID_SIGNAL_CHANNEL",JOIN_ROOM_TIMEOUT:"JOIN_ROOM_TIMEOUT",JOIN_ROOM_FAILED:"JOIN_ROOM_FAILED",REJOIN_ROOM_FAILED:"REJOIN_ROOM_FAILED",INVALID_DESTROY:"INVALID_DESTROY",INVALID_PUBLISH:"INVALID_PUBLISH",INVALID_UNPUBLISH:"INVALID_UNPUBLISH",INVALID_AUDIENCE:"INVALID_AUDIENCE",INVALID_INITIALIZE:"INVALID_INITIALIZE",INVALID_DUPLICATE_PUBLISHING:"INVALID_DUPLICATE_PUBLISHING",INVALID_SUBSCRIBE_UNDEFINED:"INVALID_SUBSCRIBE_UNDEFINED",INVALID_SUBSCRIBE_LOCAL:"INVALID_SUBSCRIBE_LOCAL",INVALID_REMOTE_STREAM:"INVALID_REMOTE_STREAM",SUBSCRIBE_FAILED:"SUBSCRIBE_FAILED",INVALID_ROLE:"INVALID_ROLE",INVALID_PARAMETER_SWITCH_ROLE:"INVALID_PARAMETER_SWITCH_ROLE",INVALID_OPERATION_SWITCH_ROLE:"INVALID_OPERATION_SWITCH_ROLE",SWITCH_ROLE_TIMEOUT:"SWITCH_ROLE_TIMEOUT",SWITCH_ROLE_FAILED:"SWITCH_ROLE_FAILED",CLIENT_BANNED:"CLIENT_BANNED",INVALID_OPERATION_START_PUBLISH_CDN:"INVALID_OPERATION_START_PUBLISH_CDN",INVALID_OPERATION_STOP_PUBLISH_CDN:"INVALID_OPERATION_STOP_PUBLISH_CDN",INVALID_STREAM_ID:"INVALID_STREAM_ID",START_PUBLISH_CDN_FAILED:"START_PUBLISH_CDN_FAILED",STOP_PUBLISH_CDN_FAILED:"STOP_PUBLISH_CDN_FAILED",START_MIX_TRANSCODE:"START_MIX_TRANSCODE",STOP_MIX_TRANSCODE:"STOP_MIX_TRANSCODE",INVALID_AUDIO_VOLUME:"INVALID_AUDIO_VOLUME",ENABLE_SMALL_STREAM_PUBLISHED:"ENABLE_SMALL_STREAM_PUBLISHED",DISABLE_SMALL_STREAM_PUBLISHED:"DISABLE_SMALL_STREAM_PUBLISHED",NOT_SUPPORTED_SMALL_STREAM:"NOT_SUPPORTED_SMALL_STREAM",INVALID_SMALL_STREAM_PROFILE:"INVALID_SMALL_STREAM_PROFILE",INVALID_PARAMETER_REMOTE_STREAM:"INVALID_PARAMETER_REMOTE_STREAM",INVALID_OPERATION_CHANGE_SMALL:"INVALID_OPERATION_CHANGE_SMALL",REMOTE_NOT_PUBLISH_SMALL_STREAM:"REMOTE_NOT_PUBLISH_SMALL_STREAM",INVALID_SWITCH_DEVICE:"INVALID_SWITCH_DEVICE",INVALID_SWITCH_DEVICE_PUBLISHING:"INVALID_SWITCH_DEVICE_PUBLISHING",INVALID_REPLACE_TRACK:"INVALID_REPLACE_TRACK",INVALID_INITIALIZE_LOCAL_STREAM:"INVALID_INITIALIZE_LOCAL_STREAM",INVALID_ADD_TRACK_REPETITIVE:"INVALID_ADD_TRACK_REPETITIVE",INVALID_ADD_TRACK_REMOVING:"INVALID_ADD_TRACK_REMOVING",INVALID_ADD_TRACK_PUBLISHING:"INVALID_ADD_TRACK_PUBLISHING",INVALID_STREAM_INITIALIZED:"INVALID_STREAM_INITIALIZED",INVALID_ADD_TRACK_NUMBER:"INVALID_ADD_TRACK_NUMBER",INVALID_REMOVE_AUDIO_TRACK:"INVALID_REMOVE_AUDIO_TRACK",INVALID_REMOVE_AUDIO_ADDING:"INVALID_REMOVE_AUDIO_ADDING",INVALID_REMOVE_AUDIO_ON:"INVALID_REMOVE_AUDIO_ON",INVALID_REMOVE_TRACK_PUBLISHING:"INVALID_REMOVE_TRACK_PUBLISHING",INVALID_REMOVE_TRACK_NOT_TRACK:"INVALID_REMOVE_TRACK_NOT_TRACK",INVALID_REMOVE_TRACK_NUMBER:"INVALID_REMOVE_TRACK_NUMBER",INVALID_REPLACE_TRACK_NO_TRACK:"INVALID_REPLACE_TRACK_NO_TRACK",REPEAT_JOIN:"REPEAT_JOIN",CLIENT_DESTROYED:"CLIENT_DESTROYED",NOT_BUG_PACKAGE:"NOT_BUG_PACKAGE",START_MIX_TRANSCODE_FAILED:"START_MIX_TRANSCODE_FAILED",STOP_MIX_TRANSCODE_FAILED:"STOP_MIX_TRANSCODE_FAILED",MIX_TRANSCODE_NOT_STARTED:"MIX_TRANSCODE_NOT_STARTED",CANNOT_LESS_THAN_ZERO:"CANNOT_LESS_THAN_ZERO",MIX_PARAMS_VIDEO_FRAMERATE:"MIX_PARAMS_VIDEO_FRAMERATE",MIX_PARAMS_VIDEO_GOP:"MIX_PARAMS_VIDEO_GOP",MIX_PARAMS_AUDIO_BITRATE:"MIX_PARAMS_AUDIO_BITRATE",MIX_PARAMS_USER_Z_ORDER:"MIX_PARAMS_USER_Z_ORDER",MIX_PARAMS_NOT_SELF:"MIX_PARAMS_NOT_SELF",MIX_PARAMS_USER_STREAM:"MIX_PARAMS_USER_STREAM",INVALID_PLAY:"INVALID_PLAY",INVALID_ELEMENT_ID:"INVALID_ELEMENT_ID",INVALID_ELEMENT_ID_TYPE:"INVALID_ELEMENT_ID_TYPE",PLAY_FAILED:"PLAY_FAILED",INVALID_USERID:"INVALID_USERID",INVALID_CREATE_STREAM_SOURCE:"INVALID_CREATE_STREAM_SOURCE",INVALID_CREATE_STREAM_SCREEN:"INVALID_CREATE_STREAM_SCREEN",INVALID_CREATE_STREAM_AUDIO:"INVALID_CREATE_STREAM_AUDIO",INVALID_CREATE_STREAM_SCREEN_AUDIO:"INVALID_CREATE_STREAM_SCREEN_AUDIO",NOT_SUPPORTED_HTTP:"NOT_SUPPORTED_HTTP",NOT_SUPPORTED_WEBRTC:"NOT_SUPPORTED_WEBRTC",NOT_SUPPORTED_PROFILE:"NOT_SUPPORTED_PROFILE",NOT_SUPPORTED_MEDIA:"NOT_SUPPORTED_MEDIA",NOT_SUPPORTED_H264ENCODE:"NOT_SUPPORTED_H264ENCODE",NOT_SUPPORTED_H264DECODE:"NOT_SUPPORTED_H264DECODE",NOT_SUPPORTED_TRACK:"NOT_SUPPORTED_TRACK",NOT_SUPPORTED_SWITCH_DEVICE:"NOT_SUPPORTED_SWITCH_DEVICE",NOT_SUPPORTED_CAPTURE:"NOT_SUPPORTED_CAPTURE",NOT_SUPPORTED_AUX:"NOT_SUPPORTED_AUX",MICROPHONE_NOT_FOUND:"MICROPHONE_NOT_FOUND",CAMERA_NOT_FOUND:"CAMERA_NOT_FOUND",SIGNAL_RESPONSE_FAILED:"SIGNAL_RESPONSE_FAILED",CATCH_HANDLER_ERROR:"CATCH_HANDLER_ERROR",API_NOT_EXIST:"API_NOT_EXIST",CONNECTION_CLOSED:"CONNECTION_CLOSED",SUBSCRIBE_ALL_FALSE:"SUBSCRIBE_ALL_FALSE",SEI_NOT_SUPPORT:"SEI_NOT_SUPPORT",SEI_DISABLED:"SEI_DISABLED",SEI_BEFORE_PUBLISH:"SEI_BEFORE_PUBLISH",SEI_NOT_VIDEO:"SEI_NOT_VIDEO",CALL_FREQUENCY_LIMIT:"CALL_FREQUENCY_LIMIT",CONNECTION_ABORTED:"CONNECTION_ABORTED",API_CALL_ABORTED:"API_CALL_ABORTED",DUPLICATE_AUX:"DUPLICATE_AUX"},gO={AVOID_REPEATED_CALL:e=>"previous ".concat(e.name,"() is ongoing, please avoid repeated calls."),INVALID_PARAMETER_REQUIRED(e){let{key:t,rule:i,fnName:r,value:n}=e;return"'".concat(t||i.name,"' is a required param when calling ").concat(r,"(), received: ").concat(n,".")},INVALID_PARAMETER_TYPE(e){let{key:t,rule:i,fnName:r,value:n}=e,a="".concat(t||i.name),o="";return o=Array.isArray(i.type)?i.type.join("|"):i.type,"'".concat(a,"' must be type of ").concat(o," when calling ").concat(r,"(), received type: ").concat(kk(n),".")},INVALID_PARAMETER_EMPTY(e){let{key:t,rule:i,fnName:r,value:n}=e;return"'".concat(t||i.name,"' cannot be '").concat(n,"' when calling ").concat(r,"().")},INVALID_PARAMETER_INSTANCE(e){let{key:t,rule:i,fnName:r,value:n}=e,a="".concat(t||i.name),o="".concat(i.instanceOf.name||i.instanceOf);return"'".concat(a,"' must be instanceof ").concat(o," when calling ").concat(r,"(), received type: ").concat(kk(n),".")},INVALID_PARAMETER_RANGE(e){let{key:t,rule:i,fnName:r,value:n}=e;return"'".concat(t||i.name,"' must be one of ").concat(i.values.join("|")," when calling ").concat(r,"(), received: ").concat(n,".")},INVALID_PARAMETER_MIN(e){let{key:t,rule:i,fnName:r,value:n}=e;return"the min value of ".concat(t||i.name," is ").concat(i.min,", received: ").concat(n,".")},INVALID_PARAMETER_MAX(e){let{key:t,rule:i,fnName:r,value:n}=e;return"the max value of ".concat(t||i.name," is ").concat(i.max,", received: ").concat(n,".")},API_CALL_TIMEOUT:e=>"".concat(e.commandDesc||e.command," timeout observed."),SIGNAL_CHANNEL_RECONNECTION_FAILED:"signal channel reconnection failed, please check your network.",SIGNAL_CHANNEL_SETUP_FAILED:e=>"SignalChannel setup failure: (errorCode: ".concat(e.errorCode,", errorMsg: ").concat(e.errorMsg," })."),ERROR_MESSAGE(e){let t="".concat(e.type," failed");return e.message&&(t="".concat(t,": ").concat(e.message,".")),t},EXCHANGE_SDP_TIMEOUT:"exchange sdp timeout.",DOWNLINK_RECONNECTION_FAILED:"downlink reconnection failed, please check your network and re-join room.",EXCHANGE_SDP_FAILED:e=>"exchange sdp failed ".concat(e.errMsg,"."),UPDATE_OFFER_TIMEOUT:"update offer timeout observed.",UPLINK_RECONNECTION_FAILED:"uplink reconnection failed, please check your network and publish again.",INVALID_RECORDID:"recordId must be an integer number.",INVALID_PURE_AUDIO:"pureAudioPushMode must be 1 or 2.",INVALID_STREAMID:"streamId must be a sting literal within 64 bytes, and not be empty.",INVALID_USER_DEFINE_RECORDID:"userDefineRecordId must be a sting literal contains (a-zA-Z),(0-9), underline and hyphen, within 64 bytes, and not be empty.",INVALID_USER_DEFINE_PUSH_ARGS:"userDefinePushArgs must be a sting literal within 256 bytes, and not be empty.",INVALID_PROXY:'proxy server url must start with "wss://".',INVALID_JOIN:"duplicate join() called.",INVALID_ROOMID_STRING:e=>"'".concat(e,"' must be validate string when useStringRoomId is true."),INVALID_ROOMID_INTEGER:e=>"'".concat(e,"' must be an integer between [1, 4294967294] when useStringRoomId is false."),INVALID_SIGNAL_CHANNEL:"SignalChannel is not ready yet.",JOIN_ROOM_TIMEOUT:"join room timeout.",JOIN_ROOM_FAILED(e){let{error:t,code:i}=e;return"Failed to join room - ".concat(t," code: ").concat(i)},REJOIN_ROOM_FAILED:e=>"reJoin room: ".concat(e.roomId," failed, please check your network."),INVALID_DESTROY:"please call leave() before destroy().",INVALID_PUBLISH:"please call join() before publish().",INVALID_UNPUBLISH:"stream has not been published yet.",INVALID_AUDIENCE:'no permission to publish() under live/audience, please call switchRole("anchor") firstly before publish().',INVALID_INITIALIZE:"cannot publish stream because stream is not initialized, is switching device, or has been closed.",INVALID_DUPLICATE_PUBLISHING:e=>"duplicate ".concat(e," stream publishing, please unpublish your prev ").concat(e," stream and then re-publish."),INVALID_SUBSCRIBE_UNDEFINED:"stream is undefined or null.",INVALID_SUBSCRIBE_LOCAL:"stream cannot be LocalStream.",INVALID_REMOTE_STREAM:"remoteStream does not exist because it has been unpublished by remote peer.",SUBSCRIBE_FAILED(e){let{message:t,userId:i,streamType:r}=e;return"failed to subscribe ".concat(i," ").concat(r," stream, reason: ").concat(t,".")},INVALID_ROLE:"switchRole can only be called in live mode.",INVALID_PARAMETER_SWITCH_ROLE:"role could only be set to a value as anchor or audience.",INVALID_OPERATION_SWITCH_ROLE:"please call join() before switchRole().",SWITCH_ROLE_TIMEOUT:"switchRole timeout.",SWITCH_ROLE_FAILED:e=>"switchRole failed, errCode: ".concat(e.code," errMsg: ").concat(e.message,"."),CLIENT_BANNED:e=>"client was banned because of ".concat(e.message,"."),INVALID_OPERATION_START_PUBLISH_CDN:"please call startPublishCDNStream() after join room and publish the local stream.",INVALID_OPERATION_STOP_PUBLISH_CDN:"please call startPublishCDNStream() before stopPublishCDNStream().",START_PUBLISH_CDN_FAILED:e=>"startPublishCDNStream failed, errMsg: ".concat(e.message,"."),STOP_PUBLISH_CDN_FAILED:e=>"stopPublishCDNStream failed, errMsg: ".concat(e.message,"."),INVALID_STREAM_ID:e=>"'".concat(e,"' can only consist of uppercase and lowercase english letters (a-zA-Z), numbers (0-9), hyphens and underscores."),START_MIX_TRANSCODE:"please call startMixTranscode() after join().",STOP_MIX_TRANSCODE:"please call stopMixTranscode() after startMixTranscode().",INVALID_AUDIO_VOLUME:"interval must be a number.",ENABLE_SMALL_STREAM_PUBLISHED:"Cannot enable small stream after localStream published.",DISABLE_SMALL_STREAM_PUBLISHED:"Cannot disable small stream after localStream published.",NOT_SUPPORTED_SMALL_STREAM:"your browser does not support opening small stream.",INVALID_SMALL_STREAM_PROFILE:"small stream profile is invalid.",INVALID_PARAMETER_REMOTE_STREAM:"remoteStream is invalid.",INVALID_OPERATION_CHANGE_SMALL:"cannot switch to the small stream without subscribing to the video of remoteStream.",REMOTE_NOT_PUBLISH_SMALL_STREAM:"remote peer does not publish small stream.",INVALID_SWITCH_DEVICE:"cannot switch device on current stream.",INVALID_SWITCH_DEVICE_PUBLISHING:"cannot switch device when publishing localStream.",INVALID_REPLACE_TRACK:"cannot replace track when publishing localStream.",INVALID_INITIALIZE_LOCAL_STREAM:"local stream has not initialized yet.",INVALID_ADD_TRACK_REPETITIVE:"previous addTrack is ongoing, please avoid repetitive execution.",INVALID_ADD_TRACK_REMOVING:"cannot add track when a track is removing.",INVALID_ADD_TRACK_PUBLISHING:"cannot add track when publishing localStream.",INVALID_STREAM_INITIALIZED:"your local stream haven't been initialized yet.",INVALID_ADD_TRACK_NUMBER:"a Stream has at most one audio track and one video track.",INVALID_REMOVE_AUDIO_TRACK:"remove audio track is not supported on your browser.",INVALID_REMOVE_AUDIO_ADDING:"cannot remove track when a track is adding.",INVALID_REMOVE_AUDIO_ON:"previous removeTrack is ongoing, please avoid repetitive execution.",INVALID_REMOVE_TRACK_PUBLISHING:"cannot remove track when publishing localStream.",INVALID_REMOVE_TRACK_NOT_TRACK:"localStream has not this track.",INVALID_REMOVE_TRACK_NUMBER:"remove the only video track is not supported, please use replaceTrack or muteVideo.",INVALID_REPLACE_TRACK_NO_TRACK:e=>"cannot replace ".concat(e.kind," track because stream has not ").concat(e.kind," track"),NOT_BUG_PACKAGE:"You need to buy packages, refer to tencent console.",START_MIX_TRANSCODE_FAILED:e=>"startMixTranscode failed, errMsg: ".concat(e.message,"."),STOP_MIX_TRANSCODE_FAILED:e=>"stopMixTranscode failed, errMsg: ".concat(e.message,"."),MIX_TRANSCODE_NOT_STARTED:"mixTranscode has not been started.",CANNOT_LESS_THAN_ZERO(e){let{key:t,rule:i,fnName:r,value:n}=e;return"'".concat(t||i.name,"' cannot be less than 0 when calling ").concat(r,"().")},MIX_PARAMS_VIDEO_FRAMERATE:"'config.videoFramerate' should be an integer between 0 and 30, excluding 0.",MIX_PARAMS_VIDEO_GOP:"'config.videoGOP' should be an integer between 1 and 8.",MIX_PARAMS_AUDIO_BITRATE:"'config.audioBitrate' should be an integer between 32 and 192.",MIX_PARAMS_USER_Z_ORDER:e=>"'".concat(e,"' is required and must be between 1 and 15."),MIX_PARAMS_NOT_SELF:"'config.mixUsers' must contain self.",MIX_PARAMS_USER_STREAM:"'config.videoWidth' and 'config.videoHeight' of output stream should be contain all mix stream.",INVALID_PLAY:"duplicate play() call observed, please stop() firstly.",INVALID_ELEMENT_ID:e=>{let{key:t,fnName:i}=e;return"'".concat(t,"' is not found in the document object when calling ").concat(i,"().")},INVALID_ELEMENT_ID_TYPE:e=>{let{key:t,fnName:i,type:r}=e;return"the element corresponding to '".concat(t,"' must be instanceof HTMLElement when calling ").concat(i,"(), received: ").concat(r,".")},PLAY_FAILED:e=>"".concat(e.media," play failed, browser exception: ").concat(e.error.toString()),INVALID_USERID:"userId cannot be all spaces.",INVALID_CREATE_STREAM_SOURCE:"LocalStream must be created by createStream() with either audio/video or audioSource/videoSource, but can not be mixed with audio/video and audioSource/videoSource.",INVALID_CREATE_STREAM_SCREEN:"screen/video cannot be both true.",INVALID_CREATE_STREAM_AUDIO:"audio/screenAudio cannot be both true.",INVALID_CREATE_STREAM_SCREEN_AUDIO:"when screen is true, screenAudio can be configured.",NOT_SUPPORTED_HTTP:"http protocol does not support the ability to capture microphone, camera and screen. please use https to deploy your page.",NOT_SUPPORTED_WEBRTC:"your browser or environment does not support full WebRTC capabilities.",NOT_SUPPORTED_PROFILE:"your browser does not support setVideoProfile.",NOT_SUPPORTED_MEDIA:"your browser or environment does not support navigator.mediaDevices.",NOT_SUPPORTED_H264ENCODE:"your device does not support H.264 encoding.",NOT_SUPPORTED_H264DECODE:"your device does not support H.264 decoding.",NOT_SUPPORTED_TRACK:e=>"".concat(e,"Track is not supported on your browser."),NOT_SUPPORTED_SWITCH_DEVICE:"switchDevice is not supported on your browser.",NOT_SUPPORTED_CAPTURE:"Your browser or environment does not support screen sharing, please check whether the browser version.",MICROPHONE_NOT_FOUND:"no microphone detected, please check your microphone.",CAMERA_NOT_FOUND:"no camera detected, please check your camera.",SIGNAL_RESPONSE_FAILED:e=>"".concat(e.signalResponse," failed, response code is ").concat(e.code," , errMsg: ").concat(e.message,"."),CATCH_HANDLER_ERROR(e){let{name:t,event:i}=e;return"an error was caught in ".concat(t,".on('").concat(i,"', handler), please check your code in 'handler'.")},API_NOT_EXIST(e){let{name:t}=e;return"experimental api ".concat(t," does not exist.")},REPEAT_JOIN:e=>"please avoid repeated join.",CONNECTION_CLOSED:"remoteStream has been unsubscribed or unpublished by remote user.",SUBSCRIBE_ALL_FALSE:"cannot subscribe when both audio & video are false, use client.unsubscribe() instead",CLIENT_DESTROYED(e){let{funName:t}=e;return"failed to call ".concat(t,"() because client was destroyed.")},SEI_NOT_SUPPORT:e=>"not support to sendSEIMessage".concat(!1===e?" without using h264 codec":""),SEI_DISABLED:"SEI is disabled",SEI_BEFORE_PUBLISH:"please call sendSEIMessage() after publish() success",SEI_NOT_VIDEO:"cannot send sei when localStream has not video.",CALL_FREQUENCY_LIMIT:e=>{let{isSize:t,name:i,timesInSecond:r,maxSizeInSecond:n}=e;return"api ".concat(i," call ").concat(t?"size":"times"," is over ").concat(t?"".concat(n," bytes"):r," in a second.")},CONNECTION_ABORTED:e=>"connection aborted due to: ".concat(e),API_CALL_ABORTED(e){let t;return t=e.message.includes("REMOTE_STREAM_NOT_EXIST")?"Subscribe ".concat(e.userId," ").concat(e.streamType," stream aborted, reason: remote user ").concat(e.userId," unpublished stream."):"API aborted, reason: ".concat(e.message),t},DUPLICATE_AUX:"only one auxiliary stream can be published in a room.",NOT_SUPPORTED_AUX:"publish auxiliary stream is not supported on your browser.",INVALID_PARAMETER_STREAMTYPE:e=>"'streamType' is required when 'userId' is not '*', calling ".concat(e,"()")},vO=(e,t)=>t?"".concat(CA,"/").concat(e,"/").concat(t):"".concat(CA,"/").concat(e,"/index.html"),_O=()=>{if(window.TRTC_ERROR_INFO&&window.TRTC_ERROR_LINK)return{TRTC_ERROR_INFO:window.TRTC_ERROR_INFO,TRTC_ERROR_LINK:window.TRTC_ERROR_LINK};let e=null==localStorage?void 0:localStorage.getItem("trtc_error_assistance");if(e){e=JSON.parse(e);let t=document.createElement("script");t.type="text/javascript",t.text=e.message,document.body.appendChild(t);let i=window.TRTC_ERROR_INFO,r=window.TRTC_ERROR_LINK;return document.body.removeChild(t),{TRTC_ERROR_INFO:i,TRTC_ERROR_LINK:r}}return{}};function yO(e){let{key:t,data:i,link:r,addDocLink:n=!0}=e,a="",o="",s="";Ck(gO[t])?a=gO[t](i):Ok(gO[t])&&(a=gO[t]);let{TRTC_ERROR_INFO:c,TRTC_ERROR_LINK:l}=_O();r?s="".concat(r.className,".html#").concat(r.fnName):l&&l[t]&&(Ck(l[t])?s=l[t](i):Ok(l[t])&&(s=l[t]));let d=a;return Tk()&&(c&&c[t]&&(Ck(c[t])?o=c[t](i):Ok(c[t])&&(o=c[t])),o&&(d=n?"".concat(o,"\n请查看文档: ").concat(vO("zh-cn",s),"\n\n"):"".concat(o,"\n\n"),d+=a)),n&&(d+=" \nRefer to: ".concat(vO("en",s),"\n")),d}var EO,bO=lA(vA(),1),wO=class{constructor(){let e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];uA(this,"countMap",new Map),uA(this,"distributionMap",new Map),uA(this,"version"),uA(this,"log",hO.createLogger({id:"kv"})),e&&(cO.on("102",(e=>{let{track:t,cost:i}=e;this.addSuccessEvent({key:t.kind===BA?501700:511700,cost:i})})),cO.on("103",(e=>{let{track:t,error:i}=e;this.addFailedEvent({key:t.kind===BA?501700:511700,error:i})})),cO.on("266",(e=>{let{enable:t}=e;this.log.info("".concat(t?"enable":"disable"," sso")),t?this.addSuccessEvent({key:525701}):this.addFailedEvent({key:525701})})))}getReportData(e,t){let i={msg_sdk_basic_info:{uint32_sdk_version:cC(this.version||AA),uint32_terminal_type:15,bytes_device_name:"",bytes_os_version:"",uint32_framework:30,uint32_network_type:0},stats_count:[...this.countMap.entries()].map((e=>{let[t,i]=e;return{uint32_key:t,uint32_count:i}})),stats_distribution:[...this.distributionMap.entries()].map((e=>{let[t,i]=e;return{uint32_key:t,distribution_items:[...i.entries()].map((e=>{let[t,i]=e;return{uint32_item_key:t,uint32_item_value:i}}))}})),str_user_sig:e,bytes_report_token:t};return this.countMap.clear(),this.distributionMap.clear(),i}clear(){this.countMap.clear(),this.distributionMap.clear()}isEnumKey(e){let t=+String(e).slice(-3);return t>=700&&t<799}isErrorCodeKey(e){let t=+String(e).slice(-3);return t>=600&&t<699}isCountKey(e){let t=+String(e).slice(-3);return t>=0&&t<599}isNumberKey(e){let t=+String(e).slice(-3);return t>=800&&t<899}addCount(e){let{key:t,useUV:i=!1}=e;this.isCountKey(t)?i&&this.countMap.has(t)||this.countMap.set(t,(this.countMap.get(t)||0)+1):this.log.debug("".concat(t," is not count key, last 3 number should be 0~599"))}addEnum(e){let{key:t,value:i,useUV:r=!0}=e;var n;if(!this.isEnumKey(t))return this.log.debug("".concat(t," is not enum key, last 3 number should be 700~799"));if(r&&this.countMap.has(t))return;this.countMap.set(t,(this.countMap.get(t)||0)+1);let a=(null==(n=this.distributionMap)?void 0:n.get(t))||new Map;a.set(i,(a.get(i)||0)+1),this.distributionMap.set(t,a)}addNumber(e){let{key:t,value:i,split:r=100,useUV:n=!1,max:a=5e3}=e;var o;if(!this.isNumberKey(t))return this.log.debug("".concat(t," is not number key, last 3 number should be 800~899"));if(n&&this.countMap.has(t))return;i>a&&(i=a),this.countMap.set(t,(this.countMap.get(t)||0)+1);let s=(null==(o=this.distributionMap)?void 0:o.get(t))||new Map,c=0;if(Lk(r))c=Math.floor(i/r);else for(let l=r.length-1;l>0;l--)if(i>r[l]){c=l;break}s.set(c,(s.get(c)||0)+1),this.distributionMap.set(t,s)}addSuccessEvent(e){let{key:t,cost:i,timeKey:r,split:n}=e;if(t&&(this.addEnum({key:t,value:1,useUV:!1}),i)){let e=+String(t).slice(-3);e<800&&e>=700?this.addNumber({key:r||t+100,value:i,split:n}):r||this.log.debug("time stat ignored, ".concat(t))}}addFailedEvent(e){let{key:t,error:i}=e;if(!t)return;let r=UR.UNKNOWN;i&&(Lk(i)?r=i:(!Dk(i.extraCode)||!Dk(i.code))&&(r=i.extraCode||i.code)),this.addEnum({key:t,value:0,useUV:!1}),this.addEnum({key:t,value:Math.abs(r),useUV:!1})}},IO=((EO=IO||{})[EO.DECODER_TYPE=514700]="DECODER_TYPE",EO[EO.DECODER_HW_SW=514701]="DECODER_HW_SW",EO[EO.DECODE_RESULT=514702]="DECODE_RESULT",EO[EO.DECODE_FAILED_OS=514703]="DECODE_FAILED_OS",EO[EO.DOWNGRADE_RESULT=514704]="DOWNGRADE_RESULT",EO[EO.DOWNGRADE_WEBCODECS_VIDEO=514705]="DOWNGRADE_WEBCODECS_VIDEO",EO[EO.DOWNGRADE_WEBCODECS_2D=514706]="DOWNGRADE_WEBCODECS_2D",EO[EO.DOWNGRADE_WASM_WEGBL=514707]="DOWNGRADE_WASM_WEGBL",EO[EO.DOWNGRADE_WASM_VIDEO=514708]="DOWNGRADE_WASM_VIDEO",EO[EO.DOWNGRADE_WASM_2D=514709]="DOWNGRADE_WASM_2D",EO[EO.DECODE_H264_RESULT=514710]="DECODE_H264_RESULT",EO[EO.DECODE_H265_RESULT=514711]="DECODE_H265_RESULT",EO[EO.DECODE_VP8_RESULT=514712]="DECODE_VP8_RESULT",EO[EO.DECODE_CAPABILITIES=514713]="DECODE_CAPABILITIES",EO[EO.H264_PROFILE_LEVEL_ID_HIGH=514714]="H264_PROFILE_LEVEL_ID_HIGH",EO[EO.H264_PROFILE_LEVEL_ID_MAIN=514715]="H264_PROFILE_LEVEL_ID_MAIN",EO[EO.RENDER_FREEZE_RATE=514850]="RENDER_FREEZE_RATE",EO[EO.DATA_FREEZE_RATE=514851]="DATA_FREEZE_RATE",EO[EO.VIDEO_CONSUME_RENDER_RATE=514852]="VIDEO_CONSUME_RENDER_RATE",EO),TO=new wO(!0);new wO(!1);var SO=TO,AO={result:!1,detail:{isBrowserSupported:!1,isWebRTCSupported:!1,isWebCodecsSupported:!1,isMediaDevicesSupported:!1,isScreenShareSupported:!1,isSmallStreamSupported:!1,isH264EncodeSupported:!1,isVp8EncodeSupported:!1,isH265EncodeSupported:!1,isH264DecodeSupported:!1,isVp8DecodeSupported:!1,isH265DecodeSupported:!1}},RO=new Map([[KC,["Firefox",YC]],[QC,["Edg",$C]],[jD,["Chrome",GD]],[qD,["Safari",YD]],[aD,["TBS",oD]],[sD,["XWEB",cD]],[dD&&jC,["WeChat",uD]],[mD,["QQ(Win)",gD]],[pD,["QQ(Mobile)",fD]],[hD,["QQ(Mobile X5)",fD]],[vD,["QQ(Mac)",_D]],[yD,["QQ(iPad)",ED]],[AD,["MI",RD]],[kD,["HW",OD]],[LD,["Samsung",ND]],[xD,["OPPO",PD]],[MD,["VIVO",UD]],[ZC,["EDGE",JC]],[tD,["SogouMobile",iD]],[rD,["Sogou",nD]]]);function kO(){let e=RO.get(!0);return{browserName:e?e[0]:"unknown",browserVersion:e?e[1]:"unknown"}}var CO=function(){return!(SD||ZC||QC&&eD<80||KC&&XC<56)},DO=function(){return["VideoDecoder","VideoEncoder","AudioEncoder","AudioDecoder"].every((e=>e in window))},OO=function(){if(!navigator.mediaDevices)return NO()||hO.error(gO.NOT_SUPPORTED_MEDIA),!1;let e=["getUserMedia","enumerateDevices"];return e.filter((e=>e in navigator.mediaDevices)).length===e.length},LO=!1;function NO(){return"http:"===location.protocol&&!eO&&(LO||hO.error(yO({key:mO.NOT_SUPPORTED_HTTP})),LO=!0,!0)}var xO=function(){return(null==window?void 0:window.OffscreenCanvas)&&(null==window?void 0:window.MediaStreamTrackProcessor)&&(null==window?void 0:window.MediaStreamTrackGenerator)},PO=function(){return!(null==window||!window.MediaStreamTrackGenerator)},MO=async function(){var e,t,i;if(AO.detail.isH264EncodeSupported&&AO.detail.isVp8EncodeSupported)return{isH264EncodeSupported:AO.detail.isH264EncodeSupported,isVp8EncodeSupported:AO.detail.isVp8EncodeSupported,isH265EncodeSupported:AO.detail.isH265EncodeSupported};let r,n=!1,a=!1,o=!1;try{let s=new RTCPeerConnection,c=document.createElement(UA);c.getContext("2d");let l=c.captureStream(0);return s.addTrack(l.getVideoTracks()[0],l),r=await s.createOffer(),n=-1!==(null==(e=r.sdp)?void 0:e.toLowerCase().indexOf("h264")),a=-1!==(null==(t=r.sdp)?void 0:t.toLowerCase().indexOf("vp8")),o=-1!==(null==(i=r.sdp)?void 0:i.toLowerCase().indexOf("h265")),s.close(),{isH264EncodeSupported:n,isVp8EncodeSupported:a,isH265EncodeSupported:o}}catch(s){return{isH264EncodeSupported:!1,isVp8EncodeSupported:!1,isH265EncodeSupported:!1}}},UO=async function(){var e;if(AO.detail.isH264DecodeSupported&&AO.detail.isVp8DecodeSupported)return{isH264DecodeSupported:AO.detail.isH264DecodeSupported,isVp8DecodeSupported:AO.detail.isVp8DecodeSupported,isH265DecodeSupported:AO.detail.isH265DecodeSupported};let t,i=!1,r=!1;try{let n=new RTCPeerConnection;rL()?(n.addTransceiver(FA,{direction:"recvonly"}),t=await n.createOffer()):t=await n.createOffer({offerToReceiveVideo:!0}),-1!==t.sdp.toLowerCase().indexOf("h264")&&(i=!0),-1!==t.sdp.toLowerCase().indexOf("vp8")&&(r=!0);let a=-1!==(null==(e=t.sdp)?void 0:e.toLowerCase().indexOf("h265"));return n.close(),{isH264DecodeSupported:i,isVp8DecodeSupported:r,isH265DecodeSupported:a}}catch(n){return{isH264DecodeSupported:!1,isVp8DecodeSupported:!1,isH265DecodeSupported:!1}}};var BO=uC((async e=>{let t=Date.now(),i=gL(),r=OO(),n=DO();if(AO.detail.isWebRTCSupported=i,AO.detail.isMediaDevicesSupported=r,AO.detail.isWebCodecsSupported=n,AO.detail.isScreenShareSupported=VO(),AO.detail.isSmallStreamSupported=QO(),37===e)return Object.assign(AO.detail,await async function(){return zO||(zO=new Promise((async e=>{let t={isH264EncodeSupported:!1,isH264DecodeSupported:!1,isVp8EncodeSupported:!1,isVp8DecodeSupported:!1};if(!DO())return void e(t);let i=null,r=null,n=null,a=()=>{n&&clearTimeout(n),i=null,r=null};try{i=document.createElement("canvas"),r=i.getContext("2d"),i.width=320,i.height=240;let o=0,s=()=>{!r||!i||(r.fillStyle="hsl(".concat(o%360,", 50%, 50%)"),r.fillRect(0,0,i.width,i.height),r.fillStyle="white",r.font="20px Arial",r.fillText("Frame ".concat(o),10,30),o++)};n=setTimeout((()=>{a(),e(t)}),5e3);let c=[{type:"h264",encodeConfig:{codec:"avc1.42E01E",avc:{format:"annexb"},width:320,height:240,bitrate:1e6},decodeConfig:{codec:"avc1.42E01E",avc:{format:"annexb"}}},{type:"vp8",encodeConfig:{codec:"vp8",width:320,height:240,bitrate:1e6},decodeConfig:{codec:"vp8"}}];(await Promise.all(c.map((async e=>{let t,r={type:e.type,encodeSupported:!1,decodeSupported:!1};try{t=await new Promise((async(t,n)=>{try{let a=new VideoEncoder({output:e=>{t(e),r.encodeSupported=!0},error:n});a.configure(e.encodeConfig),s();let o=new VideoFrame(i,{timestamp:0});a.encode(o,{keyFrame:!0}),o.close(),await a.flush(),a.close()}catch(a){n(a)}}))}catch(p){return hO.warn("".concat(e.type," encoder error:"),p),r}try{await new Promise((async(i,n)=>{try{let a=new VideoDecoder({output:e=>{r.decodeSupported=!0,i(0),e.close()},error:n});a.configure(e.decodeConfig),a.decode(t),await a.flush(),a.close()}catch(a){n(a)}}))}catch(p){hO.warn("".concat(e.type," decoder error:"),p)}return r})))).forEach((e=>{"h264"===e.type?(t.isH264EncodeSupported=e.encodeSupported,t.isH264DecodeSupported=e.decodeSupported):"vp8"===e.type&&(t.isVp8EncodeSupported=e.encodeSupported,t.isVp8DecodeSupported=e.decodeSupported)})),a(),e(t)}catch(o){a(),hO.warn("detectWebCodecsSupported failed:",o),e(t)}})),zO)}()),AO.detail.isBrowserSupported=n,AO.result=r&&n,AO.result||hO.error("".concat(navigator.userAgent," ").concat(nC(AO.detail,!1))),IL(e),SO.addNumber({key:523800,value:Date.now()-t}),AO;if(AO.result&&AO.detail.isH264EncodeSupported&&AO.detail.isVp8EncodeSupported&&AO.detail.isH265EncodeSupported&&AO.detail.isH264DecodeSupported&&AO.detail.isVp8DecodeSupported&&AO.detail.isH265DecodeSupported)return AO;let a=CO(),{encode:o,decode:s}=await async function(){let[e,t]=await Promise.all([MO(),UO()]);return{encode:{h264:e.isH264EncodeSupported,vp8:e.isVp8EncodeSupported,h265:e.isH265EncodeSupported},decode:{h264:t.isH264DecodeSupported,vp8:t.isVp8DecodeSupported,h265:t.isH265DecodeSupported}}}(),{h264:c,vp8:l}=o,{h264:d}=s,{h265:u}=o,{vp8:h,h265:p}=s;if(!c||!l){let e=await MO();hO.warn("detect encode again h264:".concat(c," vp8:").concat(l," result: ").concat(JSON.stringify(e))),c=e.isH264EncodeSupported,l=e.isVp8EncodeSupported}if(c&&d&&GC&&HD&&!sD&&!aD&&(!xD||115!==WD)){let{encode:e,decode:t}=await async function(){return jO||(jO=new Promise((async e=>{let t={encode:!1,decode:!1},i=()=>{};try{let r=document.createElement("canvas"),n=r.getContext("2d");r.width=640,r.height=480;let a=setInterval((()=>{n.fillText("test",Math.floor(640*Math.random()),Math.floor(480*Math.random()))}),66),o=-1,s=-1;i=()=>{clearInterval(o),clearInterval(a),clearTimeout(s),l.close(),d.close(),c.getTracks().forEach((e=>e.stop()))},s=setTimeout((()=>{i(),e(t)}),2e3);let c=r.captureStream(),l=new RTCPeerConnection({}),d=new RTCPeerConnection({offerToReceiveAudio:!0,offerToReceiveVideo:!0});l.addEventListener("icecandidate",(e=>d.addIceCandidate(e.candidate))),d.addEventListener("icecandidate",(e=>l.addIceCandidate(e.candidate))),l.addTrack(c.getVideoTracks()[0],c);let u=await l.createOffer();await l.setLocalDescription(u),await d.setRemoteDescription(u);let h=await d.createAnswer(),p=bO.default.parse(h.sdp),f=p.media[0].rtp.findIndex((e=>"H264"===e.codec));p.media[0].rtp=[p.media[0].rtp[f]],p.media[0].fmtp=p.media[0].fmtp.filter((e=>e.payload===p.media[0].rtp[0].payload)),p.media[0].rtcpFb&&(p.media[0].rtcpFb=p.media[0].rtcpFb.filter((e=>e.payload===p.media[0].rtp[0].payload))),h.sdp=bO.default.write(p),await d.setLocalDescription(h),await l.setRemoteDescription(h),o=setInterval((async()=>{t.encode&&t.decode&&(i(),e(t));let[r,n]=await Promise.all([l.getSenders()[0].getStats(),d.getReceivers()[0].getStats()]);t.encode||r.forEach((e=>{"outbound-rtp"===e.type&&e.mediaType===FA&&e.bytesSent>0&&(t.encode=!0)})),t.decode||n.forEach((e=>{"inbound-rtp"===e.type&&e.mediaType===FA&&e.bytesReceived>0&&(t.decode=!0)}))}),100)}catch(r){i(),hO.warn("detectH264Supported failed",r),e({encode:!0,decode:!0})}})).then((e=>(e.encode||(e.decode=!0),(!e.encode||!e.decode)&&hO.warn("detectH264Supported encode: ".concat(e.encode," decode: ").concat(e.decode," ").concat("")),e))),jO)}();c=e,d=t}return AO.result=a&&i&&r&&(c||l)&&(d||h),AO.detail.isBrowserSupported=a,AO.detail.isWebRTCSupported=i,AO.detail.isH264EncodeSupported=c,AO.detail.isVp8EncodeSupported=l,AO.detail.isH265EncodeSupported=u,AO.detail.isH264DecodeSupported=d,AO.detail.isVp8DecodeSupported=h,AO.detail.isH265DecodeSupported=p,AO.result||hO.error("".concat(navigator.userAgent," ").concat(nC(AO.detail,!1))),IL(),SO.addNumber({key:523800,value:Date.now()-t}),AO})),FO=function(){return AO.result},VO=function(){return!(!navigator.mediaDevices||!navigator.mediaDevices.getDisplayMedia)},HO="undefined"!=typeof HTMLMediaElement&&"setSinkId"in HTMLMediaElement.prototype,jO=null;var zO=null;var WO=(e,t,i)=>{"http:"===location.protocol&&!eO&&(e[t]=()=>{throw new FR({code:UR.INVALID_OPERATION,message:gO.NOT_SUPPORTED_HTTP})})},GO=function(e){return!("candidate-pair"!==e.type||!e.nominated||"in-progress"!==e.state&&"succeeded"!==e.state)&&!(Nk(e.selected)&&!e.selected)};function qO(){let e="";if(screen.width){let t=screen.width?screen.width*window.devicePixelRatio:"",i=screen.height?screen.height*window.devicePixelRatio:"";e+="".concat(t," * ").concat(i)}return e}function KO(){return navigator.getUserMedia||navigator.mediaDevices&&navigator.mediaDevices.getUserMedia}function YO(){let e={isSupported:!1},t=["AudioContext","webkitAudioContext","mozAudioContext","msAudioContext"];for(let i=0;i<t.length;i++)if(t[i]in window){e.isSupported=!0;break}return e.isSupported}function XO(){return"captureStream"in HTMLCanvasElement.prototype}function ZO(){return!(dD||WC||WD&&WD<63)&&!(!CO()||!XO())}function JO(){return!(WD<74||ZC||ZD<11||XC<46)}function QO(){return ZO()||JO()}var $O=function(){if(Dk(window.RTCRtpTransceiver)||!rL()||!("currentDirection"in RTCRtpTransceiver.prototype))return!1;let e=null,t=!1;try{e=new RTCPeerConnection({sdpSemantics:"unified-plan"}),e.addTransceiver(BA),t=!0}catch(eP){}return null==e||e.close(),t};function eL(){return"RTCPeerConnection"in window&&"getReceivers"in window.RTCPeerConnection.prototype}function tL(){return"RTCPeerConnection"in window&&"getSenders"in window.RTCPeerConnection.prototype}function iL(){return"RTCPeerConnection"in window&&"getTransceivers"in window.RTCPeerConnection.prototype}function rL(){return!(11===ZD&&!$D)&&("RTCPeerConnection"in window&&"addTransceiver"in window.RTCPeerConnection.prototype)}var nL=!(!rL()||HD&&WD<86);function aL(){return"RTCRtpTransceiver"in window&&"stop"in window.RTCRtpTransceiver.prototype}var oL="RTCRtpSender"in window;function sL(){return oL&&"replaceTrack"in window.RTCRtpSender.prototype}function cL(){return oL&&"setParameters"in window.RTCRtpSender.prototype&&tL()}var lL="RTCRtpReceiver"in window&&"getSynchronizationSources"in window.RTCRtpReceiver.prototype,dL=window.MediaStreamTrack&&"getSettings"in MediaStreamTrack.prototype,uL=window.MediaStreamTrack&&"getCapabilities"in MediaStreamTrack.prototype,hL="undefined"!=typeof InputDeviceInfo&&"getCapabilities"in InputDeviceInfo.prototype,pL=oL&&"createEncodedStreams"in window.RTCRtpSender.prototype&&FD()>=86,fL="RTCRtpScriptTransform"in window,mL=oL&&(pL||fL),gL=function(){return["RTCPeerConnection","webkitRTCPeerConnection","RTCIceGatherer"].filter((e=>e in window)).length>0};function vL(){let e={AudioDecoder:!1,AudioEncoder:!1,VideoDecoder:!1,VideoEncoder:!1,ImageDecoder:!1};return Dk(window.AudioDecoder)||(e.AudioDecoder=!0),Dk(window.AudioEncoder)||(e.AudioEncoder=!0),Dk(window.VideoDecoder)||(e.VideoDecoder=!0),Dk(window.VideoEncoder)||(e.VideoEncoder=!0),Dk(window.ImageDecoder)||(e.ImageDecoder=!0),e}function _L(){return"mediaSession"in navigator&&!Dk(navigator.mediaSession.setActionHandler)}function yL(){return!Dk(window.WebTransport)}function EL(){return"undefined"!=typeof WebAssembly&&WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,1,5,1,96,0,1,123,3,2,1,0,10,10,1,8,0,65,0,253,15,253,98,11]))}function bL(){let e={browser:"".concat(iO.name,"/").concat(iO.version),os:aO(),displayResolution:qO(),isScreenShareSupported:VO(),isWebRTCSupported:gL(),isGetUserMediaSupported:KO(),isWebAudioSupported:YO(),isWebSocketsSupported:"WebSocket"in window&&2===window.WebSocket.CLOSING,isWebCodecSupported:vL(),isMediaSessionSupported:_L(),isWebTransportSupported:yL()};return navigator.userAgent.includes("miniProgram")&&(e.browser="mini/".concat(e.browser)),e}var wL="checkResult";function IL(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:30;fO.setItem(wL+e,{ua:navigator.userAgent,checkResult:AO})}function TL(e){NO();let t=fO.getItem(wL+e);t&&t.ua===navigator.userAgent&&t.checkResult&&function(e,t){return!!xk(e)&&Object.keys(t).every((t=>t in e))}(t.checkResult.detail,AO.detail)&&(AO=t.checkResult),BO(e)}function SL(){return"requestVideoFrameCallback"in HTMLVideoElement.prototype}var AL="RTCRtpReceiver"in window&&"jitterBufferTarget"in window.RTCRtpReceiver.prototype;function RL(e){return{h264:1,h265:2,vp8:3,vp9:4,av1:5}[e]}var kL=!1;async function CL(){var e;try{if(kL||null==(e=null==navigator?void 0:navigator.mediaCapabilities)||!e.encodingInfo)return;let t=oO(),i=dD||sD?4:HD?1:qD?2:KC?3:0;if(0===t||0===i)return;kL=!0;let r=["H264","VP8","VP9","AV1","H265"],[n,a]=await Promise.all([DL(r),OL(r)]);n&&Object.keys(n).forEach((e=>{let r=RL(e.toLowerCase());SO.addEnum({key:513707,value:+"".concat(r).concat(+n[e].supported).concat(+n[e].powerEfficient).concat(t).concat(i),useUV:!1})})),a&&Object.keys(a).forEach((e=>{let r=RL(e.toLowerCase());SO.addEnum({key:514713,value:+"".concat(r).concat(+a[e].supported).concat(+a[e].powerEfficient).concat(t).concat(i),useUV:!1})}));let{sender:o,receiver:s}=LL();SO.addEnum({key:513708,value:+"".concat(t).concat(i).concat(+o.high),useUV:!1}),SO.addEnum({key:513709,value:+"".concat(t).concat(i).concat(+o.main),useUV:!1}),SO.addEnum({key:514714,value:+"".concat(t).concat(i).concat(+s.high),useUV:!1}),SO.addEnum({key:514715,value:+"".concat(t).concat(i).concat(+s.main),useUV:!1})}catch(t){hO.info("detectVideoCodecCapabilities failed",t)}}async function DL(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1920,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1080,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:30,n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:3e3,a={};try{for(let o of e){let e=await navigator.mediaCapabilities.encodingInfo({type:"webrtc",video:{contentType:"video/".concat(o),width:t,height:i,bitrate:n,framerate:r}});a[o]=e}}catch(TA){}return a}async function OL(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1920,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1080,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:30,n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:3e3,a={};try{for(let o of e){let e=await navigator.mediaCapabilities.decodingInfo({type:"webrtc",video:{contentType:"video/".concat(o),width:t,height:i,bitrate:n,framerate:r}});a[o]=e}}catch(TA){}return a}function LL(){let e={sender:{base:!1,main:!1,high:!1},receiver:{base:!1,main:!1,high:!1}};try{if(RTCRtpSender&&"function"==typeof RTCRtpSender.getCapabilities){let t=RTCRtpSender.getCapabilities("video");t&&t.codecs&&t.codecs.filter((e=>"video/h264"===e.mimeType.toLowerCase())).forEach((t=>{if(t.sdpFmtpLine){let i=t.sdpFmtpLine.match(/profile-level-id=([0-9a-fA-F]+)/);if(i&&i[1])switch(i[1].slice(0,2)){case"42":e.sender.base=!0;break;case"4d":e.sender.main=!0;break;case"64":e.sender.high=!0}}}))}if(RTCRtpReceiver&&"function"==typeof RTCRtpReceiver.getCapabilities){let t=RTCRtpReceiver.getCapabilities("video");t&&t.codecs&&t.codecs.filter((e=>"video/h264"===e.mimeType.toLowerCase())).forEach((t=>{if(t.sdpFmtpLine){let i=t.sdpFmtpLine.match(/profile-level-id=([0-9a-fA-F]+)/);if(i&&i[1])switch(i[1].slice(0,2)){case"42":e.receiver.base=!0;break;case"4d":e.receiver.main=!0;break;case"64":e.receiver.high=!0}}}))}}catch(t){hO.warn("get H264 profile levelId failed",t)}return e}var NL=lA(pA(),1),xL=Symbol("instance"),PL=Symbol("cacheResult"),ML=class{constructor(e,t,i){this.oldState=e,this.newState=t,this.action=i,this.aborted=!1}abort(e){this.aborted=!0,HL.call(e,this.oldState,new Error("action '".concat(this.action,"' aborted")))}toString(){return"".concat(this.action,"ing")}},UL=class extends Error{constructor(e,t,i){super(t),this.state=e,this.message=t,this.cause=i}};var BL=new Map;function FL(e,t){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return(r,n,a)=>{let o=i.action||n;if(!i.context){let i=BL.get(r)||[];BL.has(r)||BL.set(r,i),i.push({from:e,to:t,action:o})}let s=a.value;a.value=function(){let r=this;for(var n=arguments.length,a=new Array(n),c=0;c<n;c++)a[c]=arguments[c];if(i.context&&(r=jL.get("function"==typeof i.context?i.context.call(this,...a):i.context)),r.state===t)return i.sync?r[PL]:Promise.resolve(r[PL]);r.state instanceof ML&&r.state.action==i.abortAction&&r.state.abort(r);let l=null;Array.isArray(e)?0==e.length?r.state instanceof ML&&r.state.abort(r):("string"!=typeof r.state||!e.includes(r.state))&&(l=new UL(r._state,"".concat(r.name," ").concat(o," to ").concat(t," failed: current state ").concat(r._state," not from ").concat(e.join("|")))):e!==r.state&&(l=new UL(r._state,"".concat(r.name," ").concat(o," to ").concat(t," failed: current state ").concat(r._state," not from ").concat(e)));let d=e=>{if(i.fail&&i.fail.call(this,e),i.sync){if(i.ignoreError)return e;throw e}return i.ignoreError?Promise.resolve(e):Promise.reject(e)};if(l)return d(l);let u=r.state,h=new ML(u,t,o);HL.call(r,h);let p=e=>{var n;return r[PL]=e,h.aborted||(HL.call(r,t),null===(n=i.success)||void 0===n||n.call(this,r[PL])),e},f=e=>(HL.call(r,u,e),d(e));try{let e=s.apply(this,a);return function(e){return"object"==typeof e&&e&&"then"in e}(e)?e.then(p).catch(f):i.sync?p(e):Promise.resolve(p(e))}catch(m){return f(new UL(r._state,"".concat(r.name," ").concat(o," from ").concat(e," to ").concat(t," failed: ").concat(m),m instanceof Error?m:new Error(String(m))))}}}}var VL="undefined"!=typeof window&&window.__AFSM__?(e,t)=>{window.dispatchEvent(new CustomEvent(e,{detail:t}))}:"undefined"!=typeof importScripts?(e,t)=>{postMessage({type:e,payload:t})}:()=>{};function HL(e,t){let i=this._state;this._state=e;let r=e.toString();e&&this.emit(r,i),this.emit(jL.STATECHANGED,e,i,t),this.updateDevTools({value:e,old:i,err:t instanceof Error?t.message:String(t)})}var jL=class e extends NL.default{constructor(t,i,r){super(),this.name=t,this.groupName=i,this._state=e.INIT,t||(t=Date.now().toString(36)),r?Object.setPrototypeOf(this,r):r=Object.getPrototypeOf(this),i||(this.groupName=this.constructor.name);let n=r[xL];n?this.name=n.name+"-"+n.count++:r[xL]={name:this.name,count:0},this.updateDevTools({diagram:this.stateDiagram})}get stateDiagram(){let e=Object.getPrototypeOf(this),t=BL.get(e)||[],i=new Set,r=[],n=[],a=new Set,o=Object.getPrototypeOf(e);BL.has(o)&&(o.stateDiagram.forEach((e=>i.add(e))),o.allStates.forEach((e=>a.add(e)))),t.forEach((e=>{let{from:t,to:i,action:a}=e;"string"==typeof t?r.push({from:t,to:i,action:a}):t.length?t.forEach((e=>{r.push({from:e,to:i,action:a})})):n.push({to:i,action:a})})),r.forEach((e=>{let{from:t,to:r,action:n}=e;a.add(t),a.add(r),a.add(n+"ing"),i.add("".concat(t," --\x3e ").concat(n,"ing : ").concat(n)),i.add("".concat(n,"ing --\x3e ").concat(r," : ").concat(n," 🟢")),i.add("".concat(n,"ing --\x3e ").concat(t," : ").concat(n," 🔴"))})),n.forEach((e=>{let{to:t,action:r}=e;i.add("".concat(r,"ing --\x3e ").concat(t," : ").concat(r," 🟢")),a.forEach((e=>{e!==t&&i.add("".concat(e," --\x3e ").concat(r,"ing : ").concat(r))}))}));let s=[...i];return Object.defineProperties(e,{stateDiagram:{value:s},allStates:{value:a}}),s}static get(t){let i;return"string"==typeof t?(i=e.instances.get(t),i||e.instances.set(t,i=new e(t,void 0,Object.create(e.prototype)))):(i=e.instances2.get(t),i||e.instances2.set(t,i=new e(t.constructor.name,void 0,Object.create(e.prototype)))),i}static getState(t){var i;return null===(i=e.get(t))||void 0===i?void 0:i.state}updateDevTools(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};VL(e.UPDATEAFSM,Object.assign({name:this.name,group:this.groupName},t))}get state(){return this._state}set state(e){HL.call(this,e)}};jL.STATECHANGED="stateChanged",jL.UPDATEAFSM="updateAFSM",jL.INIT="[*]",jL.ON="on",jL.OFF="off",jL.instances=new Map,jL.instances2=new WeakMap;var zL="undefined"!=typeof window,WL=zL&&window.requestIdleCallback||function(e){let t=Date.now();return setTimeout((()=>{e({didTimeout:!1,timeRemaining:()=>Math.max(0,50-(Date.now()-t))})}),1e3)},GL=zL&&window.cancelIdleCallback||function(e){clearTimeout(e)},qL=zL&&(window.cancelAnimationFrame||window.mozCancelAnimationFrame),KL=class e{static generateTaskID(){return this.currentTaskID++}static run(e,t,i){null!=i&&i.fps&&(i.delay=i.delay||Number((1e3/i.fps).toFixed(2))),i=nA("interval"===e?{delay:2e3,count:0,backgroundTask:!0}:"ric"===e?{delay:1e4,count:0}:"raf"===e?{fps:60,delay:16.6,count:0,backgroundTask:!0}:{delay:2e3,count:0,backgroundTask:!0},i);let r=aA(nA({taskID:this.generateTaskID(),loopCount:0,intervalID:null,timeoutID:null,rafID:null,ricID:null,taskName:e,callback:t},i),{delay:i.delay});return this.taskMap.set(r.taskID,r),this[e](r),r.taskID}static interval(t){return t.intervalID=setInterval((()=>{t.callback(),t.loopCount+=1,e.isBreakLoop(t)}),t.delay)}static intervalInWorker(t){e.sharedWorker||(e.sharedWorker=new Worker(URL.createObjectURL(new Blob(["\n const timers = new Map();\n self.onmessage = function(e) {\n const { taskId, delay, type } = e.data;\n if (type === 'start') {\n timers.set(taskId, setInterval(() => {\n self.postMessage({ type: 'tick', taskId });\n }, delay));\n } else if (type === 'stop') {\n clearInterval(timers.get(taskId));\n timers.delete(taskId);\n }\n };\n "],{type:"application/javascript"}))),e.sharedWorker.onmessage=t=>{var i;if("tick"===t.data.type){let r=e.workerTasks.get(t.data.taskId);r&&(e.isBreakLoop(r)?(null==(i=e.sharedWorker)||i.postMessage({type:"stop",taskId:r.taskID}),e.workerTasks.delete(r.taskID)):(r.callback(),r.loopCount+=1))}}),e.workerTasks.set(t.taskID,t),e.sharedWorker.postMessage({taskId:t.taskID,delay:t.delay,type:"start"})}static timeout(t){let i=()=>{if(t.callback(),t.loopCount+=1,!e.isBreakLoop(t))return t.timeoutID=setTimeout(i,t.delay)};return t.timeoutID=setTimeout(i,t.delay)}static ric(t){let i,r=Wk(),n=()=>{if(i=Wk()-r,i>=t.delay&&(r=Wk()-Math.floor(i%t.delay),t.callback(),t.loopCount+=1),!e.isBreakLoop(t))return t.ricID=WL(n,{timeout:t.delay})};return t.ricID=WL(n,{timeout:t.delay})}static raf(t){let i,r=Wk(),n=()=>document.hidden&&t.backgroundTask?(i=Wk()-r,r=Wk(),t.callback(),t.loopCount+=1,e.isBreakLoop(t)?void 0:t.timeoutID=setTimeout(n,t.delay-Math.floor(i%t.delay))):(i=Wk()-r,i>=t.delay&&(r=Wk()-Math.floor(i%t.delay),t.callback(),t.loopCount+=1),e.isBreakLoop(t)?void 0:t.rafID=requestAnimationFrame(n));if(t.rafID=requestAnimationFrame(n),t.backgroundTask){let e=()=>{if(document.hidden){let e=Wk()-r;e>=t.delay?n():t.timeoutID=setTimeout(n,t.delay-e)}};document.addEventListener("visibilitychange",e),t.onVisibilitychange=e,document.hidden&&e()}return t.taskID}static hasTask(e){return this.taskMap.has(e)}static clearTask(e){if(!this.taskMap.has(e))return!0;let{intervalID:t,timeoutID:i,rafID:r,ricID:n,onVisibilitychange:a}=this.taskMap.get(e);return t&&clearInterval(t),i&&clearTimeout(i),r&&qL&&qL(r),n&&GL(n),a&&document.removeEventListener("visibilitychange",a),this.taskMap.delete(e),!0}static isBreakLoop(e){return!this.hasTask(e.taskID)||0!==e.count&&e.loopCount>=e.count&&(this.clearTask(e.taskID),!0)}};uA(KL,"taskMap",new Map),uA(KL,"currentTaskID",1),uA(KL,"sharedWorker",null),uA(KL,"workerTasks",new Map);var YL=KL,XL={LOADED_DATA:YA,LOADED_META_DATA:XA,MEDIA_TRACK_CHANGED:"media-track-changed",PLAYER_STATE_CHANGED:"player-state-changed",ERROR:"error",RESIZE:eR,TIME_UPDATE:"time-update"},ZL={};cA(ZL,{create:()=>QL,remove:()=>$L});var JL=new WeakMap;function QL(e,t){JL.has(e)||JL.set(e,[]);let i=JL.get(e),r={add:(e,n)=>("addEventListener"in t?(i.push(t.removeEventListener.bind(t,e,n)),t.addEventListener(e,n)):(i.push(t.off.bind(t,e,n)),t.on(e,n)),r)};return r}function $L(e){let t=JL.get(e);t&&(t.forEach((e=>e())),JL.delete(e))}var eN=new class{constructor(){uA(this,"_roomIdMap",new Map),uA(this,"_configs"),"undefined"==typeof registerProcessor&&(this._configs={sdkAppId:"",userId:"",version:AA,env:NA,browserVersion:iO.name+iO.version,ua:navigator.userAgent})}setConfig(e){let{sdkAppId:t,env:i,userId:r,roomId:n}=e;t!==this._configs.sdkAppId&&(this._configs.sdkAppId=String(t)),this._configs.env=i,this._configs.userId=r,this._roomIdMap.set(r,String(n))}logSuccessEvent(e){eO||!hO.isAbleToUpload||this._configs.env===NA&&this.uploadEventToKibana(aA(nA({},e),{result:"success"}))}logFailedEvent(e){if(eO||!hO.isAbleToUpload)return;let{eventType:t,code:i,error:r,userId:n}=e,a={roomId:this._roomIdMap.get(n||this._configs.userId),userId:n,eventType:t,result:"failed",code:i||(null==r?void 0:r.extraCode)||(null==r?void 0:r.code)||UR.UNKNOWN};this._configs.env===NA&&this.uploadEventToKibana(aA(nA({},a),{error:r}))}uploadEventToKibana(e){let t="stat-".concat(e.eventType,"-").concat(e.result);("delta-join"===e.eventType||"delta-leave"===e.eventType||"delta-publish"===e.eventType)&&(t="".concat(e.eventType,":").concat(e.delta)),this.uploadEvent({log:t,userId:e.userId}),"failed"===e.result&&(t="stat-".concat(e.eventType,"-").concat(e.result,"-").concat(e.code),this.uploadEvent({log:t,userId:e.userId,error:e.error}))}uploadEvent(e){let{log:t,userId:i,error:r}=e,n={timestamp:HR(),sdkAppId:this._configs.sdkAppId,userId:i||this._configs.userId,version:AA,log:t};r&&(n.errorInfo=r.message,r.stack&&(n.errorInfo+="\n".concat(r.stack)));let a=dO.enable?yC(n,2002,Number(this._configs.sdkAppId)):JSON.stringify(n);this.sendRequest(dk(this._configs.sdkAppId,LA),a)}sendRequest(e,t){setTimeout((()=>RC({url:e,body:t,priority:"low"}).catch((()=>{}))),2e3)}},tN=new WeakMap;var iN=class extends jL{constructor(e,t){super(e.id,"".concat(t,"-player")),this.options=e,this.kind=t,uA(this,"id"),uA(this,"element",null),uA(this,"track"),uA(this,"url"),uA(this,"attr"),uA(this,"mode"),uA(this,"muted"),uA(this,"_log"),uA(this,"_isPausedByUserCall",!1),uA(this,"_pausedRetryCount"),uA(this,"_isElementPlayingFired",!1),uA(this,"_interval"),uA(this,"_delayDestroyTimeoutId",0),uA(this,"_playSuccessResolve"),uA(this,"_isReplayByRecreateMediaStreamCalled",!1),uA(this,"isPlayCalled",!1),uA(this,"isInAutoPlayFailedState",!1),this.id=e.id,this._log=e.log,this.track=e.track,this.muted=e.muted,this._pausedRetryCount=5,this._state="STOPPED",this.bindTrackEvents(),this._log.info("create ".concat(t,"-player ").concat(this.id))}get isPlaying(){var e;return"PLAYING"===this._state&&!1===(null==(e=this.element)?void 0:e.paused)}get isPaused(){var e;return"PAUSED"===this._state||!0===(null==(e=this.element)?void 0:e.paused)}get isStopped(){return"STOPPED"===this._state}setAttr(e){this.attr=e}setUrl(e){this.track&&(this.unbindTrackEvents(),this.element&&(this.element.srcObject=null),this.track=null),e!==this.url&&(this.url=e,null!==e&&this.element&&(this.element.crossOrigin="anonymous",this.element.src=e))}async play(){if(!this.isPlaying)try{this.isPlayCalled=!0,this._delayDestroyTimeoutId&&(clearTimeout(this._delayDestroyTimeoutId),this._delayDestroyTimeoutId=0,this.bindTrackEvents(),this.bindElementEvents()),this.bindAutoPlayEvent(),await new Promise(((e,t)=>{this._playSuccessResolve=e,this.element.play().then(e,t)}))}catch(eP){let t=yO({key:mO.PLAY_FAILED,data:{media:this.kind,error:eP}});if(this._log.warn(eP),t.includes("NotAllowedError"))throw this.isInAutoPlayFailedState=!0,new FR({code:UR.PLAY_NOT_ALLOWED,message:t})}}stop(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;var t;this.isPlayCalled=!1,this._isElementPlayingFired=!1,this.unbindEvents(),e>0&&!KD?this._delayDestroyTimeoutId||(null==(t=this.element)||t.remove(),this._log.info("destroy element after 3 * ".concat(e)),this._delayDestroyTimeoutId=setTimeout((()=>this.destroyElement()),3*e)):this.destroyElement(),this.handleStopped(WA),this._interval>0&&YL.clearTask(this._interval)}destroyElement(){this.element&&(this._log.debug("destroy element"),this.element.remove(),this.element.src="",this.element.srcObject=null,this.element=null),clearTimeout(this._delayDestroyTimeoutId),this._delayDestroyTimeoutId=0}pause(){var e;this._log.info("pause"),this._isPausedByUserCall=!0,null==(e=this.element)||e.pause()}resume(){return this._isPausedByUserCall=!1,this.doResume()}doResume(){return this._log.info("resume"),this._isPausedByUserCall||this.isPlaying?Promise.resolve():JD?this.replay():(this.element&&this.track&&HD&&WD>=128&&(this.element.srcObject=new MediaStream([this.track])),this.play().catch((()=>{})))}setMuted(e){this.element&&(this.element.muted=e),this.muted=e}replay(){return this.stop(),this.play().catch((()=>{}))}bindElementEvents(){if(this.element){let e=this.handleElementEvent.bind(this);return QL(this.element,this.element).add(GA,e).add(WA,e).add(qA,e).add(KA,e).add(YA,e).add(XA,e)}}bindTrackEvents(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.track;if(e){let t=this.handleTrackEvent.bind(this);null==ZL||ZL.create(e,e).add(WA,t).add(jA,t).add(zA,t),e.readyState===WA&&this.handleTrackEvent({type:WA}),e.muted&&this.handleTrackEvent({type:jA})}}bindAutoPlayEvent(){cO.on(lO.AUTOPLAY_DIALOG_CLICK_CONFIRM,this.resume,this)}unbindTrackEvents(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.track;e&&$L(e)}unbindEvents(){this.element&&$L(this.element),this.unbindTrackEvents(),cO.off(lO.AUTOPLAY_DIALOG_CLICK_CONFIRM,this.resume,this)}handleElementEvent(e){switch(e.type){case GA:EN()||(this.isInAutoPlayFailedState=!1),this._isElementPlayingFired=!0,this._log.info("".concat(this.kind," player is playing")),this.handlePlaying(GA),this._interval&&(YL.clearTask(this._interval),this._interval=-1);break;case WA:this._log.info("".concat(this.kind," player is ended")),this.handleStopped(WA);break;case qA:this._log.info("".concat(this.kind," player is paused")),this.handlePaused(qA),WC&&(this._interval=YL.run("timeout",(()=>{this.element&&"PAUSED"===this._state&&this.doResume()}),{delay:3e3}));break;case KA:if(this.element&&this.element.error){this.handlePaused(KA);let{code:e,message:t}=this.element.error;this._log.error("".concat(this.kind," ").concat(this._log.isLocal?"local":"remote"," MediaError code: ").concat(e," message: ").concat(t," userAgent: ").concat(navigator.userAgent)),eN.uploadEvent({log:"stat-".concat(this.kind,"-").concat(tR,"-").concat(e,"-").concat(navigator.userAgent),error:this.element.error}),DD||CD?this.emit(XL.ERROR,this.element.error):this.replayByRecreateMediaStream(this.element.error)}break;case YA:this.kind===FA&&this.emit(XL.LOADED_DATA);break;case XA:this.kind===FA&&this.emit(XL.LOADED_META_DATA)}}replayByRecreateMediaStream(e){if(!this._isReplayByRecreateMediaStreamCalled)return this._isReplayByRecreateMediaStreamCalled=!0,this.doReplayByRecreateMediaStream(1e3).then((()=>{this._log.warn("replayByRecreateMediaStream success"),eN.uploadEvent({log:"stat-replayByRecreateMediaStream-success"}),SO.addSuccessEvent({key:this.kind===BA?506700:516700})})).catch((()=>{var t;this._log.error("replayByRecreateMediaStream failed"),eN.uploadEvent({log:"stat-replayByRecreateMediaStream-failed"}),SO.addFailedEvent({key:this.kind===BA?506700:516700,error:null==(t=this.element)?void 0:t.error}),this.emit(XL.ERROR,e)}))}doReplayByRecreateMediaStream(e){return this._log.warn("delay ".concat(e,"ms to recreate mediaStream")),new Promise(((t,i)=>{dC(e).then((()=>{this.element&&(this.element.srcObject=null,this.element.srcObject=new MediaStream([this.track]),this._log.warn("recreated mediaStream"),this.element.onerror=()=>{var e,t,r;this._log.warn("element onerror ".concat(null==(t=null==(e=this.element)?void 0:e.error)?void 0:t.code," fired after recreated mediaStream")),i(null==(r=this.element)?void 0:r.error)}),dC(5e3).then((()=>{var e,r;(!this.isPlaying||null!=(e=this.element)&&e.error)&&i(null==(r=this.element)?void 0:r.error),t()}))}))})).finally((()=>{this.element&&(this.element.onerror=null)}))}async handleTrackEvent(e){switch(e.type){case WA:this.handleStopped(WA);break;case jA:this.handlePaused(jA);break;case zA:this.mode>0?this.handlePlaying(this.mode.toString()):this.element&&(this.element.paused&&(this._log.warn("track unmuted and element is paused, resume"),await this.doResume()),this.element&&!this.element.paused&&this._isElementPlayingFired&&this.handlePlaying(zA))}}handlePlaying(e){var t;return this._log.debug("handlePlaying",e),null==(t=this._playSuccessResolve)||t.call(this,e),e}handlePaused(e){return this._log.debug("handlePaused",e),e}handleStopped(e){return this._log.debug("handleStopped",e),e}getElement(){return this.element}};uA(iN,"PlayerEvent",XL),dA([function(e){let{settings:t={retries:5,timeout:2e3},onError:i,onRetrying:r,onRetryFailed:n}=e;return function(e,a,o){let s=NC({retryFunction:o.value,settings:t,onError(t){let{error:r,retry:n,reject:o,retryFuncArgs:s}=t;var c;i?i.call(this,r,(()=>{var t;null!=(t=tN.get(e))&&t.has(a)?n():o(r)}),o,s):null!=(c=tN.get(e))&&c.has(a)?n():o(r)},onRetrying(t,i){var n;CC(r)&&r.call(this,t,i),null!=(n=tN.get(e))&&n.has(a)&&(tN.get(e).get(a).stopRetry=i)},onRetryFailed:n});return o.value=function(){let t=tN.get(e);for(var i=arguments.length,r=new Array(i),n=0;n<i;n++)r[n]=arguments[n];return t?t.set(a,{args:r}):tN.set(e,new Map([[a,{args:r}]])),s.apply(this,r).finally((()=>{var t;return null==(t=tN.get(e))?void 0:t.delete(a)}))},o}}({settings:{retries:2,timeout:0},onError(e,t,i,r){r[0]=(r[0]||1e3)+1e3,t()}})],iN.prototype,"doReplayByRecreateMediaStream",1),dA([FL([],"PLAYING",{sync:!0,success(e){this.emit(XL.PLAYER_STATE_CHANGED,{type:this.kind,state:"PLAYING",reason:e})}})],iN.prototype,"handlePlaying",1),dA([FL("PLAYING","PAUSED",{ignoreError:!0,sync:!0,success(e){this.emit(XL.PLAYER_STATE_CHANGED,{type:this.kind,state:"PAUSED",reason:e})}})],iN.prototype,"handlePaused",1),dA([FL([],"STOPPED",{sync:!0,success(e){this.emit(XL.PLAYER_STATE_CHANGED,{type:this.kind,state:"STOPPED",reason:e})}})],iN.prototype,"handleStopped",1);var rN="trtc_autoplay",nN="".concat(rN,"_mask"),aN="".concat(rN,"_wrapper"),oN="".concat(rN,"_header"),sN="".concat(rN,"_content"),cN="".concat(rN,"_action_wrapper"),lN="".concat(rN,"_question"),dN="".concat(rN,"_collapse"),uN="".concat(rN,"_action_confirm"),hN="".concat(rN,"_detail"),pN="#2473E8",fN="dialog",mN="".concat(fN,"-show"),gN="".concat(fN,"-1"),vN="".concat(fN,"-2"),_N=!1,yN=!1,EN=()=>yN,bN="".concat(CA,"/").concat(Tk()?"zh-cn":"en","/tutorial-21-advanced-auto-play-policy.html"),wN="<br><a href='".concat(bN,"' target='_blank'>").concat(Tk()?"其他方案?":"Any other solution?","</a>"),IN="".concat(Tk()?"浏览器自动播放策略:在用户与页面产生交互(点击、触摸)之前,浏览器禁止播放有声媒体。该弹窗用于帮助用户恢复音视频播放。".concat(wN):"Autoplay Policy: Before user interacts with the web page (clicking, touching), page will not be allowed to play media with sound. This Dialog is used to help users resume playback. ".concat(wN)),TN=class{constructor(){if(uA(this,"content","音视频播放被浏览器拦截,请点击“恢复播放”。"),uA(this,"_dialogNode",null),uA(this,"_bodyPosition",""),uA(this,"_showDetail",!1),uA(this,"_isCollapseClicked",!1),uA(this,"_isQuestionClicked",!1),Tk()||(this.content='Media playback failed. Click the "Resume" to resume playback.'),!_N){let e=document.createElement("style");e.innerHTML=".".concat(nN,"{position:fixed;top:0;left:0;right:0;bottom:0;width:100vw;height:100vh;display:flex;justify-content:center;align-items:center;background:rgba(0,0,0,0.5);z-index:1500;}.").concat(nN," div:not(.").concat(cN,"){display:block !important;}.").concat(aN,"{padding:14px;background:#fff;border-radius:3px;box-shadow:0px 3px 15px #434343;border:1px solid #d1cfcf;max-width:500px;}.").concat(aN," a{color:").concat(pN,";}.").concat(oN,"{overflow:hidden;text-overflow:ellipsis;font-size:16px;font-weight:600;}.").concat(sN,"{margin:8px 0;}.").concat(cN,"{width:100%;display:flex !important;align-items:center;justify-content:right;float:right;}.").concat(dN,"{margin-right:auto;cursor:pointer}.").concat(lN,"{height:100%;line-height:16px;cursor:pointer;}.").concat(uN,"{margin-left:8px;color:#fff;background:").concat(pN,";padding:4px 12px;outline:none;border:1px solid;border-radius:3px;font-weight:bold;}.").concat(uN,":hover{opacity:0.9;}.").concat(dN,",.").concat(uN,",.").concat(sN,",.").concat(lN,"{font-size:14px;}@media screen and (max-width:750px){.").concat(aN,"{width:80vw;}}"),document.head.appendChild(e),_N=!0}this.addDiaLog()}createDiaLog(){let e=document.createElement("template");e.innerHTML='<div class="'.concat(nN,"\"><div class='").concat(aN,"'><div class='").concat(oN,"'>").concat(location.host,"</div><div class='").concat(sN,"'>").concat(this.content,"</div><div class='").concat(hN,'\' style="visibility:hidden;width:100%;height:0;font-size:12px;color:gray;">').concat(IN,"</div><div class='").concat(cN,"'></div></div></div>").trim();let t=document.createElement("button");t.className=uN,t.innerText=Tk()?"恢复播放":"Resume",t.onclick=this.onConfirm.bind(this);let i=document.createElement("div");i.className=lN,i.innerHTML='<?xml version="1.0" encoding="UTF-8"?>\n <svg class="icon" width="18" height="18" p-id="2030" t="1639646523624" version="1.1" viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg">\n <path d="m464 784.35c0 26.51 21.49 48 48 48s48-21.49 48-48-21.49-48-48-48-48 21.49-48 48z" p-id="2031"/>\n <path d="m512 960c-247.04 0-448-200.96-448-448s200.96-448 448-448 448 200.96 448 448-200.96 448-448 448zm0-831.71c-211.58 0-383.71 172.13-383.71 383.71 0 211.55 172.13 383.71 383.71 383.71 211.55 0 383.71-172.16 383.71-383.71 0-211.58-172.16-383.71-383.71-383.71z" p-id="2032"/>\n <path d="m512 673.7c-17.665 0-32.001-14.336-32.001-31.999v-54.112c0-52.353 40-92.352 75.328-127.65 25.887-25.92 52.672-52.672 52.672-74.017 0-53.343-43.072-96.735-95.999-96.735-53.823 0-95.999 41.536-95.999 94.559 0 17.665-14.336 31.999-32.001 31.999s-32.001-14.336-32.001-31.999c0-87.424 71.775-158.56 160-158.56s160 72.095 160 160.74c0 47.904-36.32 84.192-71.424 119.3-27.84 27.776-56.576 56.512-56.576 82.336v54.112c0 17.665-14.336 32.032-32.001 32.032z" p-id="2033"/>\n </svg>\n ',i.onclick=this.onQuestionClick.bind(this);let r=document.createElement("div");r.className=dN,r.innerText="".concat(Tk()?"详情 >":"Detail >"),r.onclick=this.onCollapseClick.bind(this);let n=e.content.firstChild,a=n.querySelector(".".concat(cN));return a.appendChild(r),a.appendChild(i),a.appendChild(t),n}addDiaLog(){EN()||(yN=!0,this._dialogNode=this.createDiaLog(),document.body.appendChild(this._dialogNode),this._dialogNode.onclick=this.onConfirm.bind(this),this._dialogNode.querySelector(".".concat(aN)).onclick=e=>e.stopPropagation(),this._bodyPosition=document.body.style.position,document.body.style.position="fixed",hO.info("show autoplay dialog"),eN.uploadEvent({log:mN}))}deleteDialog(){this._dialogNode&&(document.body.removeChild(this._dialogNode),document.body.style.position=this._bodyPosition,this._dialogNode=null,yN=!1)}onConfirm(){hO.warn("confirm clicked, try resume stream"),cO.emit(lO.AUTOPLAY_DIALOG_CLICK_CONFIRM),this.deleteDialog()}onCollapseClick(){let e=this._dialogNode.querySelector(".".concat(hN));e.style.visibility="".concat(this._showDetail?"hidden":"visible"),e.style.height="".concat(this._showDetail?0:"fit-content"),this._showDetail=!this._showDetail,this._isCollapseClicked||eN.uploadEvent({log:gN}),this._isCollapseClicked=!0}onQuestionClick(){window.open(bN,"_blank"),this._isQuestionClicked||eN.uploadEvent({log:vN}),this._isQuestionClicked=!0}},SN=null;var AN,RN=class extends iN{constructor(e){super(e,FA),uA(this,"stat",{}),uA(this,"_calculateTimeout",-1),uA(this,"viewMirror",!1),uA(this,"objectFit"),uA(this,"container"),uA(this,"canvas"),uA(this,"shouldRenderAlpha",!1),uA(this,"_preSize",{width:0,height:0}),uA(this,"posterImg"),this.mode=e.canvas?1:0,this.container=e.container,this.canvas=e.canvas,Dk(e.viewMirror)||(this.viewMirror=e.viewMirror),Dk(e.objectFit)||(this.objectFit=e.objectFit),this.initializeElement()}get isPlaying(){var e;return!("PLAYING"!==this._state||this.element&&this.element.paused)&&("live"===(null==(e=this.track)?void 0:e.readyState)&&!this.track.muted)}initializeElement(){var e;let t=document.createElement(FA);this.track&&2!==this.mode&&(t.srcObject=new MediaStream([this.track])),t.muted=!0,t.setAttribute("id","video_".concat(this.id)),t.setAttribute("style",this.styleAttribute),this.canvas&&this.canvas.setAttribute("style",this.styleAttribute),t.setAttribute("autoplay","autoplay"),t.setAttribute("playsinline","playsinline"),this.element=t,GC&&(t.poster="noposter"),null==(e=this.container)||e.appendChild(this.elementToRender),this.bindElementEvents(),this.calculateStat()}get styleAttribute(){let e="width: 100%; height: 100%; object-fit: ".concat(this.objectFit,";").concat(this.shouldRenderAlpha?"":"background-color: black",";");return this.viewMirror&&(e+="transform: scaleX(-1);"),e}setContainer(e){var t;this.container=e,this.track&&this.elementToRender&&(null==(t=this.container)||t.appendChild(this.elementToRender))}bindElementEvents(){let e=super.bindElementEvents();this.handleElementEvent=this.handleElementEvent.bind(this),e&&e.add(QA,this.handleElementEvent).add($A,this.handleElementEvent).add(eR,this.handleElementEvent)}handleTrackEvent(e){var t;return e.type===jA&&null!=(t=this.stat)&&t.fps&&(this.stat.fps=0),super.handleTrackEvent(e)}handleElementEvent(e){var t,i,r,n,a,o;if(2===this.mode)return;super.handleElementEvent(e);let s=e.type;if(s===qA&&(this.container&&!this.container.isConnected&&(this._log.warn("".concat(this.kind," player has been remove, element ID: ").concat(this.container.id)),dC(500).then((()=>{var e;null!=(e=this.container)&&e.isConnected&&(this._pausedRetryCount=5,this._log.info("view container ".concat(this.container.id," is in dom, reset pausedRetryCount")))}))),this._pausedRetryCount>0&&!EN()&&!this._isPausedByUserCall&&(this._log.info("[".concat(5-this._pausedRetryCount+1,"/").concat(5,"] ").concat(this.kind," player auto resume when paused")),this.doResume(),this._pausedRetryCount--),this.stat.fps&&(this.stat.fps=0)),this.viewMirror&&this.element){let e=this.element.style.transform;s===QA?this.element.style.transform=e.replace("scaleX(-1)",""):s===$A&&!e.includes("scaleX")&&(this.element.style.transform="".concat(e," scaleX(-1)"))}s===eR&&(this._preSize.height!==(null==(t=this.element)?void 0:t.videoHeight)||this._preSize.width!==(null==(i=this.element)?void 0:i.videoWidth))&&(this._log.info("video size changed to ".concat(null==(r=this.element)?void 0:r.videoWidth,"x").concat(null==(n=this.element)?void 0:n.videoHeight)),this._preSize.height=(null==(a=this.element)?void 0:a.videoHeight)||0,this._preSize.width=(null==(o=this.element)?void 0:o.videoWidth)||0,this.emit(XL.RESIZE,{newWidth:this._preSize.width,newHeight:this._preSize.height}))}setCanvas(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;var i,r,n,a;this.canvas!==e&&(null==(i=this.canvas)||i.remove(),null==e||e.setAttribute("style",this.styleAttribute),this.canvas=e,this.mode=e?t:0,2===this.mode&&this.setTrack(e.captureStream().getVideoTracks()[0]),e?(null==(r=this.element)||r.remove(),null==(n=this.container)||n.appendChild(e)):this.element&&(null==(a=this.container)||a.appendChild(this.element)))}setAttr(e){let t=Object.assign({autoplay:"autoplay",playsinline:"playsinline",muted:!0},e);t.style=Object.assign({width:"100%",height:"100%"},t.style),super.setAttr(t)}get mirror(){return this.viewMirror}setRect(e,t){this.elementToRender&&(this.elementToRender.style.width="".concat(e,"px"),this.elementToRender.style.height="".concat(t,"px"))}setViewMirror(e){this.elementToRender&&(this.elementToRender.style.transform=e?"scaleX(-1)":""),this.viewMirror=e}setObjectFit(e){this.elementToRender&&(this.elementToRender.style.objectFit="".concat(e)),this.objectFit=e}setPoster(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return new Promise((i=>{if(this.element)if(this._log.info("setPoster",e.slice(0,10)),this.element.poster=e,t&&(qD||KC)){if(""===e)this.removePosterImg();else if(!this.posterImg){let t=document.createElement("img");t.src=e,t.style="position:absolute;top:0;left:0;".concat(this.styleAttribute),t.onload=async()=>{var e;t.decode&&await t.decode(),this.posterImg=t,null==(e=this.container)||e.appendChild(t),i()}}}else i()}))}removePosterImg(){this.posterImg&&(this.posterImg.remove(),URL.revokeObjectURL(this.posterImg.src),delete this.posterImg)}async pause(){return(HD&&WD>=128||KC||qD)&&await this.setPoster(this.getVideoFrame(),!0),super.pause()}resume(){return this.posterImg&&this.setPoster("",!0),super.resume()}stop(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;var t;super.stop(e),null==(t=this.canvas)||t.remove(),this.removePosterImg()}play(){return this.element?this.elementToRender&&this.elementToRender.parentElement!==this.container&&this.container&&this.container.append(this.elementToRender):this.initializeElement(),2===this.mode?Promise.resolve():super.play()}get elementToRender(){return this.canvas||this.element}setTrack(e){e!==this.track&&(this.unbindTrackEvents(),this.track=e,this.emit(XL.MEDIA_TRACK_CHANGED,e),null!==e&&(this.bindTrackEvents(),this.element&&2!==this.mode&&(this.element.srcObject=new MediaStream([e]),this.element.remove()),this.elementToRender&&this.elementToRender.parentElement!==this.container&&this.container&&this.container.append(this.elementToRender)))}getVideoFrame(){if(this.canvas)return this.canvas.toDataURL("image/png");if(!this.element)return"";let e=document.createElement("canvas");return e.width=this.element.videoWidth,e.height=this.element.videoHeight,e.getContext("2d").drawImage(this.element,0,0),e.toDataURL("image/png")}getElement(){return this.element}calculateStat(){try{if(SL()&&this.element&&this._calculateTimeout<0){let e=0,t=null,i=(r,n)=>{this.stat.width=n.width,this.stat.height=n.height,t&&(this.stat.fps=Math.round((n.presentedFrames-t.presentedFrames)/(r-e)*1e3)),e=r,t=n,this._calculateTimeout=-1,this.element&&(this._calculateTimeout=setTimeout((()=>{var e;return null==(e=this.element)?void 0:e.requestVideoFrameCallback(i)}),2e3))};this.element.requestVideoFrameCallback(i)}}catch(eP){this._log.warn("init stat failed",eP)}}};"undefined"!=typeof AudioContext?AN=AudioContext:"undefined"!=typeof webkitAudioContext?AN=webkitAudioContext:"undefined"!=typeof mozAudioContext&&(AN=mozAudioContext);var kN,CN=-1,DN=0,ON=-1,LN=!1,NN=0,xN=-1,PN=-1;!function e(){try{if(kN)return;(kN=new AN({sampleRate:48e3})).onstatechange=()=>{hO.info("context state: ".concat(kN.state).concat("running"!==kN.state?" visibilityState: ".concat(document.visibilityState):"")),MN()},clearTimeout(CN)}catch(GS){hO.error("initAudioContext failed: ".concat(GS," typeof AudioContextClass: ").concat(typeof AN)),CN=setTimeout(e,1e3)}}();var MN=()=>{"suspended"===kN.state?(DN=Wk(),-1===ON&&(ON=setTimeout((()=>{"suspended"===kN.state&&(LN=!0,cO.emit("155",{isSuspended:!0}))}),1500)),FN(),document.addEventListener("click",MN)):"interrupted"===kN.state?FN():(DN&&(SO.addNumber({key:507800,value:Wk()-DN,split:[0,500,1e3,1500,2e3,3e3,4e3,5e3,1e4,3e4],max:6e4}),DN=0),-1!==ON&&(clearTimeout(ON),ON=-1,LN&&(LN=!1,cO.emit("155",{isSuspended:!1}))),document.removeEventListener("visibilitychange",MN),document.removeEventListener("click",MN))},UN=0,BN=-1;function FN(){return new Promise(((e,t)=>{if("running"===kN.state)return e();Date.now()-UN<1e3?(clearTimeout(BN),BN=setTimeout((()=>{UN=Date.now(),kN.resume().then(e,t)}),1e3)):(clearTimeout(BN),UN=Date.now(),kN.resume().then(e,t))})).catch((e=>{hO.warn("context resume failed: ".concat(e)),document.addEventListener("visibilitychange",MN)}))}document.addEventListener("click",MN);var VN=e=>kN,HN=class{constructor(e){this.name=e,uA(this,"node"),uA(this,"node2"),uA(this,"pre",new Set),uA(this,"next",new Set),uA(this,"context"),uA(this,"connectedNodes",new Set),uA(this,"nextInputChannelMap",new Map),uA(this,"_channelCount",1)}get channelCount(){return this._channelCount}set channelCount(e){this._channelCount=e,this.setChannelCount(this.node,e),this.setChannelCount(this.node2,e),this.next.forEach((t=>t.channelCount=e))}setChannelCount(e,t){!e||e instanceof ScriptProcessorNode||(e.channelCountMode="explicit",e.channelCount=t||this.channelCount||1)}setContext(e){this.context=e,this.node&&e.addMixWeight()}removeContext(){var e;this.node&&(null==(e=this.context)||e.reduceMixWeight()),delete this.context}replaceNode(e){var t;if(e!==this.node)try{this.node?this._disconnect():null==(t=this.context)||t.addMixWeight(),this.node=e,this.setChannelCount(this.node),this.preNodeReconnect(),this.reconnect()}catch(IA){hO.error(IA)}}setNode(e,t){var i;if(!this.node)try{null==(i=this.context)||i.addMixWeight(),this.node=e,this.setChannelCount(this.node),t&&(this.node2=t,this.setChannelCount(this.node2)),this.preNodeReconnect(),this.reconnect(),SO.addSuccessEvent({key:502701})}catch(r){hO.error(r),SO.addFailedEvent({key:502701,error:r})}}deleteNode(){var e;if(this.node)try{this._disconnect(),delete this.node,delete this.node2,null==(e=this.context)||e.reduceMixWeight(),this.preNodeReconnect(),SO.addSuccessEvent({key:502702})}catch(eP){hO.error(eP),SO.addFailedEvent({key:502702,error:eP})}}preNodeReconnect(){this.pre.forEach((e=>{e.node?e.reconnect():e.preNodeReconnect()}))}connectNext(e){this.next.forEach((t=>{let i=this.nextInputChannelMap.get(t);e._connect(t.node,i)||t.connectNext(e)}))}_connect(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return!(!this.node||!e)&&((this.node2||this.node).connect(e,0,t),this.connectedNodes.add(e),!0)}_disconnect(){this.connectedNodes.forEach((e=>{var t;return null==(t=this.node2||this.node)?void 0:t.disconnect(e)})),this.connectedNodes.clear()}reconnect(){this._disconnect(),this.connectNext(this)}pipeTo(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return this.next.add(e),e.pre.add(this),this.nextInputChannelMap.set(e,t),e}},jN=class extends HN{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:256;super(),this.fftSize=e,uA(this,"dataArray",new Uint8Array(0))}setNode(e){e.fftSize=this.fftSize,this.dataArray=new Uint8Array(e.frequencyBinCount),super.setNode(e)}getByteTimeDomainData(){var e;return null==(e=this.node)||e.getByteTimeDomainData(this.dataArray),this.dataArray}get level(){var e;return null==(e=this.node)||e.getByteTimeDomainData(this.dataArray),Math.max(...this.dataArray)/128-1}get timeDomainPathData(){let e=this.getByteTimeDomainData(),t=0,i=0,r="M".concat(t,",").concat(i);for(let n=0;n<e.length;n++)i=e[n]/128*100/2,r+="L".concat(t,",").concat(i),t+=1;return r}},zN=class{constructor(){uA(this,"source",new HN),uA(this,"gain",new HN),uA(this,"destination",new HN)}get volume(){var e;return(null==(e=this.gain.node)?void 0:e.gain.value)||1}setVolume(e){1!==e?(this.gain.node||this.gain.setNode(VN().createGain()),this.gain.node.gain.value=e):this.gain.node&&this.gain.deleteNode()}replaceSource(e){let t=function(t){try{let e=WN.get(t);if(e)return e;let i=VN();if(t instanceof HTMLAudioElement)e=i.createMediaElementSource(t);else{if(!(t instanceof MediaStreamTrack))return t;e=i.createMediaStreamSource(new MediaStream([t]))}return WN.set(t,e),e}catch(e){if(!(KC&&e instanceof Error&&"NotSupportedError"===e.name))throw e;hO.warn(e)}}(e);t&&this.source.replaceNode(t)}get track(){var e;return null==(e=this.stream)?void 0:e.getAudioTracks()[0]}get stream(){var e;return null==(e=this.destination.node)?void 0:e.stream}},WN=new WeakMap;var GN=class e{constructor(e){uA(this,"_volume",0),uA(this,"_volumeDb",0),uA(this,"_log"),uA(this,"_scriptProcessorNode",null),uA(this,"_audioWorkletNode",null),uA(this,"_interval",200),uA(this,"ready",this.preload());let{log:t}=e;this._log=t,cO.on(lO.AUDIO_LEVEL_INTERVAL,this.handleAudioLevelInterval,this)}static get isRunning(){return Date.now()-e.lastMessageTime<2e3}get node(){return this._audioWorkletNode||this._scriptProcessorNode}preload(){if(!e.workletReady){let t='class VolumeMeterWorklet extends AudioWorkletProcessor{constructor(){super(),this.volume=0,this.intervalTime=200,this.tick=200,this.isStop=!1,this.cache=[],this.sentFirstInfo1=!1,this.unmute=!1,this.port.onmessage=t=>{var e=t.data;switch(e.name){case"chunk":this.cache.push(...e.data),this.sentFirstInfo1||(this.port.postMessage({cl:e.data.length}),this.sentFirstInfo1=!0);break;case"setIntervalTime":this.intervalTime=e.intervalTime;break;case"unmute":this.unmute=!0;break;case"stop":this.isStop=!0}}}process(t,s){t=t[0],s=s[0];if(t||s){if(this.isStop)return!1;var i=s&&s[0]?s[0].length:0,h=this.cache.length,a=(i<h?(s[0].set(this.cache.slice(0,i)),this.cache=this.cache.slice(i)):this.unmute&&s[0].set(t[0]),(i<h?s:t)[0]);if(a){let e=0;for(let t=0;t<a.length;++t)e=Math.max(Math.abs(a[t]),e);s=a.reduce((t,e)=>t+e*e,0)/a.length;this.volume=e,this.tick-=a.length,this.tick<0&&(this.tick+=this.intervalTime/1e3*sampleRate,this.port.postMessage({volume:this.volume,volumeDb:Math.max(10*Math.log10(s)+100,0)/100,cacheLen:h,outputLen:i}))}}return!0}}registerProcessor("volume-meter",VolumeMeterWorklet);';e.workletReady=async function(e,t){if(!e.audioWorklet)return Promise.reject("audioWorklet is not supported");try{await e.audioWorklet.addModule(t),hO.info("worklet addModule success")}catch(eP){throw hO.info("worklet addModule catch error. ".concat(eP.message)),eP}}(e.audioContext,URL.createObjectURL(new Blob([t],{type:"application/javascript"})))}return e.workletReady.then((()=>this.initAudioWorklet())).catch((e=>(this._log.error("volumeMeter preload error: ".concat(e)),this.initScriptProcessor())))}initAudioWorklet(){if(!this._audioWorkletNode)try{this._audioWorkletNode=new AudioWorkletNode(e.audioContext,"volume-meter");let t=!1;this._audioWorkletNode.port.onmessage=i=>{e.lastMessageTime=Date.now(),this._volume=i.data.volume||0,this._volumeDb=i.data.volumeDb||0,!t&&i.data.cacheLen&&i.data.outputLen&&(this._log.warn("worklet play success"),t=!0)},this.handleAudioLevelInterval({interval:this._interval})}catch(t){this._log.error("volumeMeter init audio worklet error: ".concat(t)),eN.logFailedEvent({userId:this._log.userId,eventType:iR,error:t}),this.initScriptProcessor()}}initScriptProcessor(){if(!this._scriptProcessorNode)try{this._scriptProcessorNode=VN().createScriptProcessor(2048,1,1),this._scriptProcessorNode.onaudioprocess=t=>{e.lastMessageTime=Date.now();let i=t.inputBuffer.getChannelData(0),r=0;for(let e=0;e<i.length;++e)r+=i[e]*i[e];this._volume=Math.sqrt(r/i.length)||0}}catch(t){this._log.error("volumeMeter init script processor error: ".concat(t))}}destroy(){this._scriptProcessorNode&&(this._scriptProcessorNode.onaudioprocess=null),this._audioWorkletNode&&(this._audioWorkletNode.port.postMessage({name:"stop"}),this._audioWorkletNode.port.onmessage=null),this._audioWorkletNode=null,this._scriptProcessorNode=null,cO.off(lO.AUDIO_LEVEL_INTERVAL,this.handleAudioLevelInterval,this)}getInternalAudioLevel(){return this._volume}getCalculatedVolume(){return parseFloat(this._volume.toFixed(2))}getVolumeDb(){return Math.floor(100*this._volumeDb)}handleAudioLevelInterval(e){var t;let{interval:i}=e;this._interval=i,null==(t=this._audioWorkletNode)||t.port.postMessage({name:"setIntervalTime",intervalTime:i})}};uA(GN,"lastMessageTime",0),uA(GN,"audioContext",VN()),uA(GN,"workletReady");var qN=GN,KN=class extends HN{constructor(e){super(),uA(this,"_volumeMeter"),this._volumeMeter=new qN(e)}deleteNode(){super.deleteNode(),this._volumeMeter.destroy()}async init(){await this._volumeMeter.preload(),this.setNode(this._volumeMeter.node)}getCalculatedVolume(){return this._volumeMeter.getCalculatedVolume()}getInternalAudioLevel(){return this._volumeMeter.getInternalAudioLevel()}getVolumeDb(){return this._volumeMeter.getVolumeDb()}write(e){if(this.node){let t=e.allocationSize({planeIndex:0}),i=new Float32Array(t>>2);e.copyTo(i,{planeIndex:0}),this.node.port.postMessage({name:"chunk",data:i},[i.buffer]),e.close()}}},YN=lA(pA(),1),XN=e=>t=>t.deviceId===e,ZN=class{constructor(e,t){uA(this,"kind"),uA(this,"type"),uA(this,"devices",[]),this.kind=e,this.type=t}update(e,t){let i=e.filter((e=>e.kind==="".concat(this.kind).concat(this.type.toLocaleLowerCase())));1===this.devices.length&&$N(this.devices[0])||t&&(i.forEach((e=>{if(e.deviceId&&!this.devices.find(XN(e.deviceId))){let i="".concat(this.kind).concat(this.type,"Added");hO.warn("".concat(i,": ").concat(JSON.stringify(e))),t.emit(i,e)}})),this.devices.forEach((e=>{if(e.deviceId&&!i.find(XN(e.deviceId))){let i="".concat(this.kind).concat(this.type,"Removed");hO.warn("".concat(i,": ").concat(JSON.stringify(e))),t.emit(i,e)}}))),this.devices=i}hasDevice(e){return!!this.devices.find((t=>t.deviceId===e))}},JN=class extends YN.EventEmitter{constructor(){super(),uA(this,"audioInputs",new ZN(BA,"Input")),uA(this,"videoInputs",new ZN(FA,"Input")),uA(this,"audioOutputs",new ZN(BA,"Output")),this.init(),navigator.mediaDevices&&(navigator.mediaDevices.addEventListener&&navigator.mediaDevices.addEventListener("devicechange",(()=>this.update())),"ondevicechange"in navigator.mediaDevices||YL.run("interval",(()=>{this.update()}),{delay:1e4}))}init(){ex().then((e=>{this.audioInputs.update(e),this.videoInputs.update(e),this.audioOutputs.update(e)}))}async update(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=await ex(e);return this.audioInputs.update(t,this),this.videoInputs.update(t,this),this.audioOutputs.update(t,this),this}hasBlueTooth(){var e;if(1e3*(null==(e=VN())?void 0:e.outputLatency)>150)return!0;let t=["bluetooth","air","wireless","bt","tws","buds","headset","headphone"];return this.audioOutputs.devices.some((e=>t.some((t=>e.label.toLowerCase().includes(t)))))||this.audioInputs.devices.some((e=>t.some((t=>e.label.toLowerCase().includes(t)))))}},QN=kA||RA?null:new JN;function $N(e){return e.deviceId===e.groupId&&""===e.groupId}async function ex(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;if(NO()||!OO())return[];let t=await navigator.mediaDevices.enumerateDevices();if(0!==e){let r={audio:!1,video:!1};if(t.forEach((e=>{$N(e)&&(e.kind===ZA?r.audio=!0:e.kind===JA&&(r.video=!0))})),2===e&&(r.audio=!1),1===e&&(r.video=!1),r.audio||r.video){let e;try{e=await navigator.mediaDevices.getUserMedia(r),r.audio&&FN()}catch(i){hO.debug("capture before getDevices failed: ",i)}t=await navigator.mediaDevices.enumerateDevices(),null==e||e.getTracks().forEach((e=>e.stop()))}}return t.map(((e,t)=>{let i={kind:e.kind,deviceId:e.deviceId,groupId:e.groupId,label:e.label||"".concat(e.kind,"_").concat(t)};return e.deviceId.length>0&&ax.add("".concat(e.deviceId,"_").concat(e.kind)),e.getCapabilities&&(i.getCapabilities=()=>e.getCapabilities()),i}))}function tx(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return QN.update(e?1:0).then((e=>e.audioInputs.devices))}function ix(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return QN.update(e?2:0).then((e=>e.videoInputs.devices))}var rx=!1;async function nx(){try{rx||(rx=!0,hO.info("speakers:".concat((await async function(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return(WC||qD)&&(e=!1),QN.update(e?1:0).then((e=>e.audioOutputs.devices))}()).map((e=>" ".concat(e.deviceId.slice(0,8),": ").concat(e.label))))))}catch(GS){}}var ax=new Set;async function ox(e){let{newDeviceId:t,oldDeviceId:i,oldGroupId:r,oldLabel:n,kind:a}=e;return t===i&&(a!==BA||t!==nR||await async function(e,t){let i=(await tx()).find((e=>e.deviceId===nR));return!t&&(null==i?void 0:i.groupId)===e||(null==i?void 0:i.groupId)===e&&i.label===t}(r,n))}var sx,cx=class extends zN{constructor(e){super(),this.log=e,uA(this,"volumeMeter"),uA(this,"volumeMeterAfter3A"),uA(this,"volumeDestination"),uA(this,"analyser",new jN),this.volumeMeter=new KN({log:this.log}),this.volumeMeterAfter3A=new KN({log:this.log}),this.volumeDestination=new HN,this.volumeMeter.pipeTo(this.volumeDestination)}destroy(){this.gain.deleteNode(),this.volumeMeter.deleteNode(),this.analyser.deleteNode(),this.source.deleteNode(),this.destination.deleteNode(),this.volumeDestination.deleteNode()}},lx=class extends iN{constructor(e){super(e,BA),uA(this,"_outputDeviceId"),uA(this,"_volume",1),uA(this,"_destination",VN().createMediaStreamDestination()),uA(this,"pipeline"),uA(this,"volumeMeterMode","worklet"),uA(this,"enableVolumeControlInIOS"),this.enableVolumeControlInIOS=e.enableVolumeControlInIOS,this.mode=0,e.url&&(this.url=e.url),this.pipeline=new cx(this._log)}setTrack(e){}get duration(){var e;return Math.floor(1e3*((null==(e=this.element)?void 0:e.duration)||0))}get currentTime(){var e;return Math.floor(1e3*((null==(e=this.element)?void 0:e.currentTime)||0))}set currentTime(e){this.element&&(this.element.currentTime=e/1e3)}getMediaStream(){return this.pipeline.stream||(this.track?new MediaStream([this.track]):null)}initializeElement(e){if(("15.2"===XD||"15.3"===XD||"15.4"===XD)&&this.muted)return void this._log.info("audioElement is muted.");let t=sx||new Audio;t.setAttribute("autoplay","autoplay"),t.srcObject=this.getMediaStream(),t.muted=this.muted,this.url&&(t.crossOrigin="anonymous",t.src=this.url),this.element=t,Lk(e)&&(this.element.volume=Math.min(Math.max(e,0),1)),t===sx&&(sx=void 0),this.options.enableTimeupdateEvent&&(this.element.ontimeupdate=()=>this.emit(XL.TIME_UPDATE,this.currentTime)),this.bindElementEvents()}async play(e){if(this.track||this.url)return!this.pipeline.source.node&&this.track&&this.pipeline.replaceSource(this.track),this.element||this.initializeElement(null==e?void 0:e.volume),this._outputDeviceId&&await this.setSinkId(this._outputDeviceId),"worklet"===this.volumeMeterMode?(this.pipeline.volumeMeter.init(),this.pipeline.volumeMeterAfter3A.init()):"analyser"===this.volumeMeterMode&&this.pipeline.analyser.setNode(VN().createAnalyser()),nx(),super.play()}stop(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;this.pipeline.destroy(),super.stop(e)}setVolume(e){this._volume=e,this.element&&(this.element.volume=e)}async setSinkId(e){var t,i;this._outputDeviceId!==e&&(this._outputDeviceId=e),this.element&&this.element.sinkId!==e&&await(null==(i=(t=this.element).setSinkId)?void 0:i.call(t,e))}get useDestination(){return!!this.pipeline.stream}setLoop(e){this.element&&(this.element.loop=e)}getAudioLevel(){return this.pipeline.volumeMeter.getCalculatedVolume()}getInternalAudioLevel(){return this.pipeline.volumeMeter.getInternalAudioLevel()}getInternalAudioLevelAfter3A(){return this.pipeline.volumeMeterAfter3A.getInternalAudioLevel()}},dx=class extends lx{constructor(e){super(e),uA(this,"_sourceElement"),uA(this,"_output",new HN),this.pipeline.source.pipeTo(this.pipeline.gain),this.pipeline.gain.pipeTo(this.pipeline.volumeMeter).pipeTo(this._output),this.pipeline.gain.pipeTo(this.pipeline.destination)}setOutput(){this.mode=1,this._output.setNode(VN().destination)}write(e){this.pipeline.volumeMeter.write(e)}setTrack(e){var t,i,r;this._log.info("RemoteAudioPlayer set Track",e),(null==(i=null==(t=this.element)?void 0:t.error)?void 0:i.code)!==MediaError.MEDIA_ERR_DECODE&&this.track!==e&&(this.unbindTrackEvents(),this.track=e,this.emit(XL.MEDIA_TRACK_CHANGED,e.kind),e?(this.bindTrackEvents(),(sD||dD)&&this.bindAutoPlayEvent(),this._sourceElement?(this._log.info("RemoteAudioPlayer set Track for _sourceElement"),this._sourceElement.srcObject=new MediaStream([e])):!this.useDestination&&this.element&&(this._log.info("RemoteAudioPlayer set Track for element"),this.element.srcObject=new MediaStream([e])),this.pipeline.source.channelCount=(null==(r=e.getSettings())?void 0:r.channelCount)||1,this._log.info("RemoteAudioPlayer set channelCount end"),this.pipeline.replaceSource(e),this._log.info("RemoteAudioPlayer this.pipeline.replaceSource end")):this.pipeline.source.deleteNode())}setVolume(e){if(this._volume=e,this.useDestination)this.pipeline.setVolume(e),this._log.info("set pipeline volume: ".concat(e));else if(e<=1&&!WC)this.element?(this._log.info("set element volume: ".concat(e)),this.element.volume=e):this._log.info("set element volume: no element");else{if(WC){if(!this.enableVolumeControlInIOS)return;!function(){if(!WC||-1!==PN)return;let e=()=>{Wk()-NN<500||(kN&&"running"===kN.state&&kN.currentTime===xN&&(hO.warn("context is fake running, auto resume"),kN.suspend().catch((e=>{hO.warn("context suspend failed: ".concat(e))}))),xN=kN.currentTime,NN=Wk())};PN=setInterval((()=>{e()}),2e3),document.addEventListener("visibilitychange",(()=>{"visible"===document.visibilityState&&e()}))}()}if(KC&&!this.pipeline.source.node)return void this._log.warn("set pipeline volume failed: no source node");this._log.info("start set pipeline volume: ".concat(e)),this.pipeline.setVolume(e),this.element&&!this._sourceElement&&(this.pipeline.destination.setNode(this._destination),$L(this.element),this._sourceElement=this.element,this._sourceElement.muted=!0,this.element=null,this.play())}}stop(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;this.pipeline.destroy();let t=this._sourceElement||this.element;t&&KD&&(sx=t),this._sourceElement&&(this._sourceElement.srcObject=null,delete this._sourceElement),super.stop(e)}},ux=class extends jL{constructor(e){let{userId:t,sdkAppId:i,mediaType:r,room:n,PlayerClass:a=(1===r?dx:RN)}=e;var o;super(),uA(this,"id",pO()),uA(this,"userId",""),uA(this,"isRemote"),uA(this,"mediaType"),uA(this,"room"),uA(this,"user"),uA(this,"_log"),uA(this,"_inputTrack"),uA(this,"_outputTrack"),uA(this,"isPlayCalled"),uA(this,"container",null),uA(this,"player"),uA(this,"subVideoPlayerMap"),uA(this,"muted",!1),uA(this,"abortCtrl"),uA(this,"objectFit","cover"),uA(this,"mirror"),uA(this,"rotation"),uA(this,"isScreen",!1),uA(this,"manager"),uA(this,"trackSettings"),uA(this,"isFirstVideoFrameEmitted",!1),this.userId=t||"",this.mediaType=r,this._log=hO.createLogger({parent:null==n?void 0:n.getLogger(),id:"".concat(this.kind[0],"t"),userId:null==(o=n||this.room)?void 0:o.userId,remoteUserId:this instanceof aP?void 0:this.userId,sdkAppId:i,type:2===this.mediaType?"auxiliary":"main",isLocal:this instanceof aP}),this.player=new a({id:this.userId||this.id,track:null,muted:!1,container:null,log:this._log,enableVolumeControlInIOS:null==n?void 0:n.enableVolumeControlInIOS}),this.player.on(XL.PLAYER_STATE_CHANGED,(e=>{if(cO.emit(lO.PLAYER_STATE_CHANGED,nA({track:this},e)),this.emit("player-state-changed",e),"PLAYING"===e.state&&this.room){let e=!0;for(let{remoteAudioTrack:t,remoteVideoTrack:i,remoteAuxiliaryTrack:r}of[...this.room.remotePublishedUserMap.values()])if(t.isAvailable&&!t.player.isPlaying||i.isAvailable&&!i.player.isPlaying||r.isAvailable&&!r.player.isPlaying){e=!1;break}e&&EN()&&SN&&(SN.deleteDialog(),SN=null)}})),this.kind===FA&&(this.player.on(XL.LOADED_DATA,(()=>{this.emitFirstVideoFrameEvent(XL.LOADED_DATA),cO.emit(lO.VIDEO_LOADED_DATA,{track:this})})),this.player.on(XL.LOADED_META_DATA,(()=>{this.emitFirstVideoFrameEvent(XL.LOADED_META_DATA)})),this.player.on(XL.MEDIA_TRACK_CHANGED,(e=>{var t;null==(t=this.subVideoPlayerMap)||t.forEach((t=>t.setTrack(e)))})),this.player.on(XL.RESIZE,(e=>{this.emitFirstVideoFrameEvent(XL.RESIZE),this.emit("video-size-changed",nA({userId:this.userId,streamType:2===this.mediaType?"auxiliary":"main"},e))}))),this.onTrackMuted=this.onTrackMuted.bind(this),this.onTrackUnmuted=this.onTrackUnmuted.bind(this),this.onTrackEnded=this.onTrackEnded.bind(this),this.onPlayerError&&this.player.on(XL.ERROR,this.onPlayerError.bind(this))}get log(){return this._log||hO}get kind(){return 1===this.mediaType?BA:FA}get isAudio(){return this.kind===BA}get strMediaType(){return 4===this.mediaType?FA:2===this.mediaType?VA:BA}get streamType(){return 2&this.mediaType?"auxiliary":"main"}get isMediaTrackActive(){return!!this.mediaTrack&&(!this.mediaTrack.muted&&"live"===this.mediaTrack.readyState&&this.mediaTrack.enabled)}async play(e,t){let i=Pk(e)?e[0]:e;if(this.isPlayCalled)return this.log.info("play update options: ".concat(JSON.stringify(t))),t&&!Dk(t.muted)&&this.setPlayerMute(t.muted),t&&!Dk(t.objectFit)&&(this.objectFit=t.objectFit),void(this.player instanceof RN&&(this.player.setObjectFit(this.objectFit),this.container!==i&&i&&(this.container=i,this.player.setContainer(i)),Pk(e)&&e.length>=1&&await this.playSubContainer(e.slice(1),t)));if(t&&!Dk(t.muted)?this.setPlayerMute(t.muted):(!this.isRemote||this.kind===FA)&&this.setPlayerMute(!0),t&&!Dk(t.objectFit)&&(this.objectFit=t.objectFit),this.player instanceof RN&&(this.player.setObjectFit(this.objectFit),t&&!Dk(t.poster)&&this.player.setPoster(t.poster)),this.isPlayCalled=!0,i&&(this.container=i,this.player instanceof RN&&this.player.setContainer(i)),cO.emit(lO.PLAY_TRACK_START,{track:this}),this._outputTrack){this._log.info("play with options: ".concat(JSON.stringify(t)));try{this.player.setTrack(this.playerMediaTrack),await this.player.play(t),Pk(e)&&e.length>1&&await this.playSubContainer(e.slice(1),t)}catch(r){throw this.handleAutoPlayFailed(r),r}}else this.log.info("play has not mediaTrack, abort")}setMirror(e,t){if(this.isScreen||this.kind!==FA||Dk(e)||e===this.mirror)return;this.mirror=e;let i=this.player;t&&(i=t);let r=this.manager;if(Nk(this.mirror))return i.setViewMirror(this.mirror),void(!this.isRemote&&r&&(r.mirror=!1));switch(this.mirror){case"view":r&&(r.mirror=!1),i.setViewMirror(!0);break;case"publish":r&&(r.mirror=!0),i.setViewMirror(!0);break;case"both":r&&(r.mirror=!0),i.setViewMirror(!1)}}async playSubContainer(e,t){if(!this._outputTrack||this.kind===BA)return;this.subVideoPlayerMap||(this.subVideoPlayerMap=new Map),this.subVideoPlayerMap.forEach(((t,i)=>{var r;e.find((e=>i===e))||(t.stop(),null==(r=this.subVideoPlayerMap)||r.delete(i))}));for(let[r,n]of e.entries()){let e=this.subVideoPlayerMap.get(n);e?t&&(Dk(t.objectFit)||e.setObjectFit(t.objectFit)):this.subVideoPlayerMap.set(n,new RN({id:this.userId||this.id,track:this.playerMediaTrack,container:n,muted:this.player.muted,objectFit:this.objectFit,log:this.log.createChild({id:"vp-sub".concat(r+1)})}))}let i=[...this.subVideoPlayerMap.values()];for(let r of i)r.setViewMirror(this.player.mirror),await r.play()}setAudioOutput(e){return this.player.setSinkId(e)}setAudioVolume(e){this.player.setVolume(e)}getAudioLevel(){return this.player.getAudioLevel()||0}getInternalAudioLevel(){var e;return(null==(e=this.player)?void 0:e.getInternalAudioLevel())||0}stop(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this.isPlayCalled&&(this.isPlayCalled=!1,this.isFirstVideoFrameEmitted=!1,this.player&&(this.log.info("stop ".concat(this.kind," player")),this.player.stop(OC(this)&&!e?this.jitterBufferDelay:0)),this.subVideoPlayerMap&&this.subVideoPlayerMap.size>0&&this.subVideoPlayerMap.forEach((e=>{e.stop()})),this.container=null)}async resume(){var e;this.isPlayCalled&&await(null==(e=this.player)?void 0:e.resume())}close(){this.log.info("close"),this.isPlayCalled&&this.stop(!0)}setMute(e){this.muted=e,this._inputTrack&&(this._inputTrack.enabled=!e),this._outputTrack&&(this._outputTrack.enabled=!e),this.emit(e?"mute":"unmute",this),cO.emit(e?lO.TRACK_MUTED:lO.TRACK_UNMUTED,{track:this})}setPlayerMute(e){this.player.setMuted(e)}get mediaTrack(){return this._inputTrack||null}get outMediaTrack(){return this._outputTrack||null}get playerMediaTrack(){return this.outMediaTrack}installTrackEvent(e){QL(e,e).add(jA,this.onTrackMuted).add(zA,this.onTrackUnmuted).add(WA,this.onTrackEnded),e.muted&&this.onTrackMuted(),e.readyState===WA&&this.onTrackEnded()}uninstallTrackEvent(e){$L(e)}setInputMediaStreamTrack(e){var t;let i=this._inputTrack;if(e!==i)return this._inputTrack=e,this.trackSettings=null==(t=e.getSettings)?void 0:t.call(e),e.enabled=!this.muted,i&&this.uninstallTrackEvent(i),this.installTrackEvent(e),this.emit("input-media-track-changed",e||null,i||null),this.manager?this.manager.changeInput(this):this.setOutputMediaStreamTrack(e)}setOutputMediaStreamTrack(e){var t;e!==this._outputTrack&&(this.isRemote?this.log.debug("setOutputMediaStreamTrack",e.label):this.log.info("setOutputMediaStreamTrack",null==(t=e.getSettings)?void 0:t.call(e).deviceId,e.label),this._outputTrack=e,this._inputTrack&&(this._outputTrack.contentHint=this._inputTrack.contentHint,this._outputTrack.enabled=this._inputTrack.enabled),this.updatePlayingState(!!e),this.emit("output-media-track-changed",e))}setMediaType(e){this.mediaType=e}updatePlayingState(e){var t,i;if(this.isPlayCalled)if(e){if(this.player.setTrack(this.playerMediaTrack),this.player.isStopped)return this.player.play().catch((e=>this.handleAutoPlayFailed(e))),void this.log.info("playing state updated, play ".concat(this.kind))}else if(!this.player.isStopped){if(OC(this)&&this.isAudio&&null!=(t=this.user)&&t.muteState.hasAudio&&null!=(i=this.user)&&i.muteState.audioMuted)return;return this.player.stop(OC(this)?this.jitterBufferDelay:0),void this.log.info("playing state updated, stop ".concat(this.kind))}this.log.debug("updatePlayingState abort ".concat(this.isPlayCalled," ").concat(e," ").concat(this.player.isStopped))}async handleAutoPlayFailed(e){var t;this.log.warn("handleAutoPlayFailed",e);let i=()=>{this.resume().then((()=>{document.removeEventListener("click",i,!0)}))};if(this.room&&this.room.enableAutoPlayDialog){if((sD||dD)&&(await dC(100),null!=(t=this.player)&&t.isPlaying))return;SN||(SN=new TN)}else document.addEventListener("click",i,!0);cO.once(lO.LOCAL_TRACK_CAPTURE_SUCCESS,(e=>{let{track:t}=e;"audio"===t.kind&&EN()&&!this.player.isPlaying&&this.isRemote&&this.isAvailable&&i()})),this.emit("error",e)}getVideoFrame(){return this.player instanceof RN?this.player.getVideoFrame():""}emitFirstVideoFrameEvent(e){var t,i,r;if(this.isFirstVideoFrameEmitted)return;let n=null==(t=this.mediaTrack)?void 0:t.getSettings(),a=(null==n?void 0:n.width)||(null==(i=this.player.element)?void 0:i.videoWidth)||0,o=(null==n?void 0:n.height)||(null==(r=this.player.element)?void 0:r.videoHeight)||0;e===XL.RESIZE&&!a&&!o||e===XL.LOADED_META_DATA&&!a&&!o||(e===XL.LOADED_DATA&&!a&&!o&&this._log.warn("the dimension of video is 0x0 in first-video-frame event"),this.isFirstVideoFrameEmitted=!0,mC(this.rotation)&&([a,o]=[o,a]),this.emit("first-video-frame",{width:a,height:o,streamType:this.streamType,userId:this.isRemote?this.userId:""}))}onTrackMuted(){this._log.warn("".concat(this.kind," track is unable to provide media output"))}onTrackUnmuted(){this._log.info("".concat(this.kind," track is able to provide media output"))}onTrackEnded(){this._log.warn("".concat(this.kind," track ended"))}};dA([FL([],jL.INIT,{sync:!0})],ux.prototype,"close",1);var hx=Object.prototype.hasOwnProperty;var px=function(e){if(null==e)return!0;if("boolean"==typeof e)return!1;if("number"==typeof e)return 0===e;if("string"==typeof e||"function"==typeof e||Array.isArray(e))return 0===e.length;if(e instanceof Error)return""===e.message;if(Sk(e))switch(Object.prototype.toString.call(e)){case"[object File]":case"[object Map]":case"[object Set]":return 0===e.size;case"[object Object]":for(let t in e)if(hx.call(e,t))return!1;return!0}return!1},fx=NC({retryFunction:async function(e){let t=function(e){return{audio:gx(e),video:vx(e)}}(e);hO.info("getUserMedia with constraints: ".concat(JSON.stringify(t)));let i=[],r=[],n=["label","deviceId","groupId"];if(t.audio&&(i=await tx(),hO.info("microphones: ".concat(rC(i.map((e=>aA(nA({},e),{groupId:e.groupId.substring(0,8)}))),{keysToInclude:n})))),t.video&&(r=await ix(),hO.info("cameras: ".concat(rC(r,{keysToInclude:n}))),!Nk(t.video)&&"user"===t.video.facingMode&&!t.video.deviceId)){let e=r.filter((e=>!e.label.includes("infrared"))).find((e=>e.label.includes("facing front")));e&&(t.video.deviceId=e.deviceId,hO.info("exclude infrared camera: ".concat(JSON.stringify(t))))}try{let i=await navigator.mediaDevices.getUserMedia(t);return uL&&i.getTracks().forEach((t=>{var i;let r=t.getCapabilities();hO.info("".concat(t.kind," capabilities: ").concat(rC(r,{keysToInclude:oR}))),!Dk(e.echoCancellation)&&-1===(null==(i=r.echoCancellation)?void 0:i.indexOf(e.echoCancellation))&&hO.warn("Invalid argument for 'echoCancellation'. Expected one of [".concat(JSON.stringify(r.echoCancellation),"], but received '").concat(e.echoCancellation,"'"))})),t.audio&&FN(),i}catch(a){let{message:t}=a;throw"NotFoundError"===a.name&&(e.video&&r&&0===r.length&&(t=yO({key:mO.CAMERA_NOT_FOUND})),e.audio&&i&&0===i.length&&(t=yO({key:mO.MICROPHONE_NOT_FOUND}))),new FR({code:UR.INITIALIZE_FAILED,name:a.name,message:t,constraint:a.constraint})}},settings:{retries:3,timeout:500},onError:e=>{let{error:t,retry:i,reject:r,retryFuncArgs:n,retriedCount:a}=e,o=a+1;"NotReadableError"===t.name||"OverconstrainedError"===t.name||"AbortError"===t.name?(1===o?(n[0].video&&(n[0].maxResolution=!1,(!qD||n[0].width*n[0].height<=2073600)&&n[0].frameRate&&(n[0].frameRate=n[0].frameRate>10?10:5)),n[0].retryWhenExactFailed&&n[0].useExactDeviceId&&(n[0].useExactDeviceId=!1)):2===o?n[0].useDeviceIdOnly=!0:3===o&&!n[0].useExactDeviceId&&(n[0].useTrueAsConstraint=!0),i()):r(t),n[0].microphoneId&&mx(n[0].microphoneId,!1),n[0].cameraId&&mx(n[0].cameraId,!0)},onRetrying:e=>{hO.warn("getUserMedia NotReadableError observed, retrying [".concat(e,"/3]"))},onRetryFailed:e=>{eN.logFailedEvent({eventType:rR,error:e})},onRetrySuccess:e=>{eN.logSuccessEvent({eventType:rR}),eN.uploadEvent({log:"stat-".concat(rR,"-success-").concat(e)})}});async function mx(e,t){let i=(t?await ix():await tx()).find((t=>t.deviceId===e));i&&Ck(i.getCapabilities)&&hO.warn(rC(i.getCapabilities(),{keysToInclude:oR}))}function gx(e){if(!e.audio)return!1;if(e.useTrueAsConstraint)return!0;let t={echoCancellation:!0,noiseSuppression:!0,autoGainControl:!0,sampleRate:e.sampleRate};return!px(e.microphoneId)&&(t.deviceId=e.useExactDeviceId?{exact:e.microphoneId}:e.microphoneId,e.useDeviceIdOnly)?t:(Lk(e.channelCount)&&(t.channelCount=e.channelCount),(Nk(e.echoCancellation)||"remote-only"===e.echoCancellation||"all"===e.echoCancellation)&&(t.echoCancellation=e.echoCancellation),Nk(e.noiseSuppression)&&!e.noiseSuppression&&(t.noiseSuppression=!1),Nk(e.autoGainControl)&&!e.autoGainControl&&(t.autoGainControl=!1),!!px(t)||t)}function vx(e){if(!e.video)return!1;if(e.useTrueAsConstraint)return!0;let{maxResolution:t=!0}=e,i={};return e.cameraId?i.deviceId=e.useExactDeviceId?{exact:e.cameraId}:e.cameraId:e.facingMode&&(i.facingMode=e.facingMode),e.useDeviceIdOnly&&!px(i)?i:(e.width&&(i.width={ideal:e.width},t&&!KC&&(i.width.max=e.width)),e.height&&(i.height={ideal:e.height},t&&!KC&&(i.height.max=e.height)),KC&&wD&&e.width&&e.height&&e.width*e.height<101376&&(i.width=e.width,i.height=e.height),e.frameRate&&(i.frameRate=e.frameRate),!!px(i)||i)}var _x=fx,yx=(()=>{let e=!1,t=document.visibilityState;return()=>{document.visibilityState!==t&&hO.info("visibility change: ".concat(document.visibilityState)),!e&&(document.addEventListener("visibilitychange",(()=>{hO.info("visibility change: ".concat(document.visibilityState)),t=document.visibilityState})),e=!0)}})(),Ex=0,bx=class{constructor(){uA(this,"log",hO.createLogger({id:"fq".concat(++Ex)})),uA(this,"isRunning",!1),uA(this,"queue",[])}get length(){return this.queue.length}get lastQueueItem(){return 0===this.length?null:this.queue[this.length-1]}push(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];var i,r;let n=nA({},e),a=new Promise(((e,t)=>{n.resolve=e,n.reject=t}));return n.promise=a,t?this.length<=1?this.queue.push(n):null==(r=null==(i=this.lastQueueItem)?void 0:i.promise)||r.then(n.resolve,n.reject):this.queue.push(n),this.log.debug("push ".concat(this.length)),this.isRunning||this.callNext(),a}shift(){let e=this.queue.shift();return this.log.debug("shift ".concat(this.length)),e}callNext(){if(this.isRunning||0===this.length)return;this.log.debug("callNext ",this.length);let{fn:e,args:t,context:i,resolve:r,reject:n}=this.queue[0];this.isRunning=!0,e.apply(i,t).then(r,n).finally((()=>{this.isRunning=!1,this.shift(),this.callNext()}))}},wx=new WeakMap;function Ix(e,t){return EA(((i,r)=>function(){let r=e;try{for(var n=arguments.length,a=new Array(n),o=0;o<n;o++)a[o]=arguments[o];let e=i.apply(this,a),s=Wk();return Bk(e)?e.then((e=>(t?SO.addSuccessEvent({key:r,cost:Wk()-s}):SO.addSuccessEvent({key:r}),e))).catch((e=>{throw SO.addFailedEvent({key:r,error:e}),e})):(SO.addSuccessEvent({key:r}),e)}catch(TA){throw SO.addFailedEvent({key:r,error:TA}),TA}}))}function Tx(){}var Sx=e=>e();function Ax(){this.dispose()}var Rx=1,kx=class extends Function{toString(){return"".concat(this.name,"(").concat(this.args.length?[...this.args].join(", "):"",")")}subscribe(e){let t=new Mx(e,this,this.streamId++);return Ux.subscribe({id:this.id,end:!1},{nodeId:t.sourceId,streamId:t.id}),this(t),t}},Cx=class{constructor(){this.defers=new Set,this.disposed=!1}next(e){}complete(){this.dispose()}error(e){this.dispose()}get bindDispose(){return()=>this.dispose()}dispose(){this.disposed=!0,this.complete=Tx,this.error=Tx,this.next=Tx,this.dispose=Tx,this.subscribe=Tx,this.doDefer()}subscribe(e){return e instanceof kx?e.subscribe(this):e(this),this}get bindSubscribe(){return e=>this.subscribe(e)}doDefer(){this.defers.forEach(Sx),this.defers.clear()}defer(e){this.defers.add(e)}removeDefer(e){this.defers.delete(e)}reset(){this.disposed=!1,delete this.complete,delete this.next,delete this.dispose,delete this.next,delete this.subscribe}resetNext(){delete this.next}resetComplete(){delete this.complete}resetError(){delete this.error}},Dx=class extends Cx{constructor(e){super(),this.sink=e,e.defer(this.bindDispose)}next(e){this.sink.next(e)}complete(){this.sink.complete()}error(e){this.sink.error(e)}},Ox=class extends Cx{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Tx,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:Tx,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:Tx;if(super(),this._next=t,this._error=i,this._complete=r,this.then=Tx,e instanceof kx){let n={toString:()=>"subscribe",id:0,source:e};this.defer((()=>{Ux.defer(n,0)})),Ux.create(n),Ux.pipe(n),this.sourceId=n.id,this.subscribe(e),Ux.subscribe({id:n.id,end:!0}),t==Tx?this._next=e=>Ux.next(n,0,e):this.next=e=>{Ux.next(n,0,e),t(e)},r==Tx?this._complete=()=>Ux.complete(n,0):this.complete=()=>{this.dispose(),Ux.complete(n,0),r()},i==Tx?this._error=e=>Ux.complete(n,0,e):this.error=e=>{this.dispose(),Ux.complete(n,0,e),i(e)}}else this.subscribe(e)}next(e){this._next(e)}complete(){this.dispose(),this._complete()}error(e){this.dispose(),this._error(e)}};function Lx(e){for(var t=arguments.length,i=new Array(t>1?t-1:0),r=1;r<t;r++)i[r-1]=arguments[r];return i.reduce(((e,t)=>t(e)),e)}function Nx(e,t,i){if("undefined"!=typeof __FASTRX_DEVTOOLS__){let r=Object.defineProperties(Object.setPrototypeOf(e,kx.prototype),{streamId:{value:0,writable:!0,configurable:!0},name:{value:t,writable:!0,configurable:!0},args:{value:i,writable:!0,configurable:!0},id:{value:0,writable:!0,configurable:!0}});Ux.create(r);for(let e=0;e<i.length;e++){let t=i[e];"function"==typeof t&&t instanceof kx&&Ux.addSource(r,t)}return r}return e}function xx(e,t){return function(){for(var i=arguments.length,r=new Array(i),n=0;n<i;n++)r[n]=arguments[n];return i=>{if(i instanceof kx){let n=Nx((t=>{let a=new e(t,...r);a.sourceId=n.id,a.subscribe(i)}),t,arguments);return n.source=i,Ux.pipe(n),n}return t=>i(new e(t,...r))}}}function Px(e,t){window.postMessage({source:"fastrx-devtools-backend",payload:{event:e,payload:t}})}var Mx=class extends Dx{constructor(e,t,i){super(e),this.source=t,this.id=i,this.sourceId=e.sourceId,this.defer((()=>{Ux.defer(this.source,this.id)}))}next(e){Ux.next(this.source,this.id,e),this.sink.next(e)}complete(){Ux.complete(this.source,this.id),this.sink.complete()}error(e){Ux.complete(this.source,this.id,e),this.sink.error(e)}},Ux={addSource(e,t){Px("addSource",{id:e.id,name:e.toString(),source:{id:t.id,name:t.toString()}})},next(e,t,i){Px("next",{id:e.id,streamId:t,data:i&&i.toString()})},subscribe(e,t){let{id:i,end:r}=e;Px("subscribe",{id:i,end:r,sink:{nodeId:t&&t.nodeId,streamId:t&&t.streamId}})},complete(e,t,i){Px("complete",{id:e.id,streamId:t,err:i?i.toString():null})},defer(e,t){Px("defer",{id:e.id,streamId:t})},pipe(e){Px("pipe",{name:e.toString(),id:e.id,source:{id:e.source.id,name:e.source.toString()}})},update(e){Px("update",{id:e.id,name:e.toString()})},create(e){e.id||(e.id=Rx++),Px("create",{name:e.toString(),id:e.id})}},Bx=class extends Cx{constructor(e){super(),this.source=e,this.sinks=new Set}add(e){e.defer((()=>this.remove(e))),1===this.sinks.add(e).size&&(this.reset(),this.subscribe(this.source))}remove(e){this.sinks.delete(e),0===this.sinks.size&&this.dispose()}next(e){this.sinks.forEach((t=>t.next(e)))}complete(){this.sinks.forEach((e=>e.complete())),this.sinks.clear()}error(e){this.sinks.forEach((t=>t.error(e))),this.sinks.clear()}};function Fx(){return e=>{let t=new Bx(e);if(e instanceof kx){let i=Nx((e=>{t.add(e)}),"share",arguments);return t.sourceId=i.id,i.source=e,Ux.pipe(i),i}return Nx(t.add.bind(t),"share",arguments)}}function Vx(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];return Nx((e=>{let i=new Dx(e),r=t.length;i.complete=()=>{0==--r&&e.complete()},t.forEach(i.bindSubscribe)}),"merge",arguments)}function Hx(e){let t=arguments,i=Fx()(Nx((t=>{i.next=e=>t.next(e),i.complete=()=>t.complete(),i.error=e=>t.error(e),e&&t.subscribe(e)}),"subject",t));return i.next=Tx,i.complete=Tx,i.error=Tx,i}function jx(e,t){return i=>{let r=e=>i.next(e);i.defer((()=>t(r))),e(r)}}function zx(e,t){if("on"in e&&"off"in e)return Nx(jx((i=>e.on(t,i)),(i=>e.off(t,i))),"fromEvent",arguments);if("addListener"in e&&"removeListener"in e)return Nx(jx((i=>e.addListener(t,i)),(i=>e.removeListener(t,i))),"fromEvent",arguments);if("addEventListener"in e)return Nx(jx((i=>e.addEventListener(t,i)),(i=>e.removeEventListener(t,i))),"fromEvent",arguments);throw"target is not a EventDispachter"}var Wx=xx(class extends Dx{constructor(e,t,i){super(e),this.filter=t,this.thisArg=i}next(e){this.filter.call(this.thisArg,e)&&this.sink.next(e)}},"filter"),Gx=xx(class extends Dx{constructor(e,t){super(e),this.count=t}next(e){this.sink.next(e),0==--this.count&&(this.doDefer(),this.complete())}},"take"),qx=xx(class extends Dx{constructor(e,t){super(e);let i=new Dx(e);i.next=()=>{i.doDefer(),e.complete()},i.complete=Ax,i.subscribe(t)}},"takeUntil"),Kx=xx(class extends Dx{constructor(e,t){super(e),this.f=t}next(e){this.f(e)||(this.next=super.next,this.next(e))}},"skipWhile"),Yx=xx(class extends Dx{constructor(e,t,i){super(e),this.mapper=t,this.thisArg=i}next(e){super.next(this.mapper.call(this.thisArg,e))}},"map"),Xx=class extends Dx{constructor(e,t,i){super(e),this.data=t,this.context=i}next(e){let t=this.context.combineResults;t?this.sink.next(t(this.data,e)):this.sink.next(e)}tryComplete(){this.context.resetComplete(),this.dispose()}},Zx=class e extends Dx{constructor(e,t,i){super(e),this.makeSource=t,this.combineResults=i,this.index=0}subInner(t,i){let r=this.currentSink=new i(this.sink,t,this);this.complete===e.prototype.complete&&(this.complete=this.tryComplete),r.complete=r.tryComplete,r.subscribe(this.makeSource(t,this.index++))}complete(){this.sink.complete()}tryComplete(){this.currentSink.resetComplete(),this.dispose()}},Jx=class extends Xx{},Qx=class extends Zx{next(e){this.subInner(e,Jx),this.next=e=>{this.currentSink.dispose(),this.subInner(e,Jx)}}},$x=xx(Qx,"switchMap");var eP,tP=function(e){return(t,i)=>e((()=>t),i)}(xx(Qx,"switchMapTo")),iP=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Tx,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Tx,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:Tx;return r=>new Ox(r,e,t,i)},rP=xx(class extends Dx{constructor(e,t){super(e),t instanceof Function?this.next=i=>{t(i),e.next(i)}:(t.next&&(this.next=i=>{t.next(i),e.next(i)}),t.complete&&(this.complete=()=>{t.complete(),e.complete()}),t.error&&(this.error=i=>{t.error(i),e.error(i)}))}},"tap"),nP=((eP=nP||{})[eP.AUTO_SWITCH_NEW_DEVICE=0]="AUTO_SWITCH_NEW_DEVICE",eP[eP.WAIT_CURRENT_DEVICE=1]="WAIT_CURRENT_DEVICE",eP),aP=class extends ux{constructor(e,t){super({mediaType:e,PlayerClass:t}),uA(this,"isRemote",!1),uA(this,"deviceId"),uA(this,"groupId",""),uA(this,"label",""),uA(this,"sourceTrack"),uA(this,"enableAutoSwitchWhenRecapturing",!0),uA(this,"_isRecapturing",!1),uA(this,"_lastRecaptureTime",0),uA(this,"_onMuteTimeoutId",-1),uA(this,"_encodeCheckTimeoutId",-1),uA(this,"recaptureMode",0),uA(this,"profile"),uA(this,"retryEncodeFailed")}get enableEncodeFrame(){return!1}get isPublishing(){return"publishing"===this.state.toString()}get isPublished(){return"publish"===this.state}get isUseCustomSource(){return this.sourceTrack&&this.mediaTrack&&this.sourceTrack!==this.mediaTrack}encodeFrame(e,t){throw new Error("Method not implemented.")}installTrackEvent(e){e.addEventListener(jA,this.onTrackMuted),e.addEventListener(zA,this.onTrackUnmuted),e.addEventListener(WA,this.onTrackEnded),e.muted&&this.onTrackMuted(),e.readyState===WA&&this.onTrackEnded()}uninstallTrackEvent(e){e.removeEventListener(jA,this.onTrackMuted),e.removeEventListener(zA,this.onTrackUnmuted),e.removeEventListener(WA,this.onTrackEnded)}setStateToReady(){}async capture(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];var i;let r=this.sourceTrack;try{let r,n=Wk();cO.emit(lO.LOCAL_TRACK_CAPTURE_START,{track:this}),e.customSource?(r=new MediaStream,r.addTrack(e.customSource)):(t||null==(i=this.sourceTrack)||i.stop(),r=await _x(e));let a=r.getTracks()[0];return await this.setInputMediaStreamTrack(a),e.customSource||(this.sourceTrack=a,this.updateDeviceIdInUse(),this.listenDeviceChange()),cO.emit(lO.LOCAL_TRACK_CAPTURE_SUCCESS,{track:this,cost:Wk()-n}),r}catch(TA){throw cO.emit(lO.LOCAL_TRACK_CAPTURE_FAILED,{track:this,error:TA}),this.log.error("getUserMedia error observed ".concat(TA)),TA}finally{t&&(null==r||r.stop())}}setOutputMediaStreamTrack(e){var t;if(super.setOutputMediaStreamTrack(e),this.setStateToReady(),this.isPublishing||this.isPublished)return null==(t=this.room)?void 0:t.replaceTrack(this)}get hasFlag(){var e,t;let i=Xk((null==(e=this.room)?void 0:e.localPublishFlag)||0,(null==(t=this.room)?void 0:t.userId)||"");return 4===this.mediaType&&i.hasVideo||1===this.mediaType&&i.hasAudio||2===this.mediaType&&i.hasAuxiliary}async publish(e,t){return this.room=e,this.room.localTracks.add(this),this.emit("4",{mediaType:this.strMediaType,state:"starting",prevState:"stopped"}),this.userId=e.userId,this._log.bindParent(e.getLogger()),await t,this._checkPublishFlag(e)}_checkPublishFlag(e){return new Promise((async(t,i)=>{var r,n,a,o;let s=()=>i(new FR({code:UR.API_CALL_ABORTED,message:"publish aborted"}));if(this.hasFlag||this.muted?t():((this.state===jL.INIT||"ready"===this.state)&&s(),Lx(zx(e,"local-publish-flag-changed"),Wx((()=>this.hasFlag)),qx(Vx(zx(this,jL.INIT),zx(this,"ready"))),iP(t,i,s))),((null==(n=null==(r=this.room)?void 0:r.networkQuality)?void 0:n.uplinkNetworkQuality)||0)>3)return t();let c=e.heartbeatCount,l=(null==(o=null==(a=this.mediaTrack)?void 0:a.stats)?void 0:o.totalFrames)||0;this._encodeCheckTimeoutId=setTimeout((async()=>{var r,n,a,o,s,d,u;if(((null==(n=null==(r=this.room)?void 0:r.networkQuality)?void 0:n.uplinkNetworkQuality)||0)>3||e.heartbeatCount-c<3)return t();if((this.isPublished||this.isPublishing)&&this.isMediaTrackActive){if(null!=(a=this.mediaTrack)&&a.stats){let e=this.mediaTrack.stats.totalFrames||0;e-l==0&&this.log.warn("capture totalFrames is 0 during encode check, totalFrames",e)}let e=this.kind===BA,r=this.stat.bytesSent>0;if(SO[r?"addSuccessEvent":"addFailedEvent"]({key:e?503700:513702}),!e){let e={H264:513704,H265:513705,VP8:513706}[(null==(s=null==(o=this.room)?void 0:o.videoCodec)?void 0:s.toUpperCase())||"H264"];e&&SO[r?"addSuccessEvent":"addFailedEvent"]({key:e})}if(!r){if(SO.addEnum({key:e?503701:513703,value:oO()}),eN.uploadEvent({log:"stat-encode-failed-".concat(this.kind,"-").concat(rO()||sO()),userId:this.userId}),this.log.warn(e?"encode failed":"".concat(null==(u=null==(d=this.room)?void 0:d.videoCodec)?void 0:u.toUpperCase()," encode failed")),this.retryEncodeFailed&&(this.log.warn("retry encode"),await this.retryEncodeFailed(this),this.stat.bytesSent>0||this.hasFlag||(await dC(5e3),this.stat.bytesSent>0||this.hasFlag)))return t();this.emit("6",this),i(new FR({message:"".concat(this.strMediaType," encode failed"),code:e?UR.AUDIO_ENCODE_FAILED:UR.VIDEO_ENCODE_FAILED}))}}}),1e4)}))}unpublish(){this.room&&this.room.localTracks.delete(this),this.log.info("unpublish"),cO.emit(lO.LOCAL_TRACK_UNPUBLISHED,{track:this})}async updateDeviceIdInUse(){if(this.sourceTrack&&dL){let{deviceId:e,groupId:t}=this.sourceTrack.getSettings(),{label:i}=this.sourceTrack;await ox({newDeviceId:e,oldDeviceId:this.deviceId,oldGroupId:this.groupId,oldLabel:this.label,kind:this.kind})||(this.deviceId=e,this.label=i,t&&(this.groupId=t),ex().then((i=>{let r=i.find((i=>{let r=i.deviceId===e;return t&&(r=r&&i.groupId===t),r}));r&&this.emit("2",r)})))}}setProfile(e){this.log.info("setProfile",e),Object.assign(this.profile,e)}isNeedToRecapture(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return!(!this.deviceId||!this.sourceTrack||this.kind===BA&&!function(e){if(e instanceof CanvasCaptureMediaStreamTrack||!(e instanceof MediaStreamTrack))return!1;let t=e.label.toLocaleLowerCase();if(t.includes("mic")||t.includes("麦克风"))return!0;let i="".concat(((null==e?void 0:e.getSettings())||{}).deviceId,"_").concat(ZA);return!!ax.has(i)}(this.sourceTrack)||this.kind===FA&&!function(e){if(e instanceof CanvasCaptureMediaStreamTrack||!(e instanceof MediaStreamTrack))return!1;let t=e.label.toLocaleLowerCase();if(t.includes("camera")||t.includes("webcam"))return!0;let i="".concat(((null==e?void 0:e.getSettings())||{}).deviceId,"_").concat(JA);return!!ax.has(i)}(this.sourceTrack)||this._isRecapturing||e&&wD&&qD)}onTrackMuted(){if(super.onTrackMuted(),yx(),this.isNeedToRecapture(!0)){if(Date.now()-this._lastRecaptureTime<aR)return void setTimeout((()=>this.onTrackMuted()),aR);this._onMuteTimeoutId=setTimeout((async()=>{var e;if(null!=(e=this.sourceTrack)&&e.muted){if((WC||GC)&&"visible"!==document.visibilityState)return;this.recapture(await this.getRecoverCaptureDeviceId())}}),5e3)}}onTrackUnmuted(){super.onTrackUnmuted(),this._onMuteTimeoutId>0&&clearTimeout(this._onMuteTimeoutId)}async onTrackEnded(){if(super.onTrackEnded(),this.isNeedToRecapture()&&0===this.recaptureMode){if(Date.now()-this._lastRecaptureTime<aR)return void setTimeout((()=>this.onTrackEnded()),aR);this.emit("7"),this.recapture(await this.getRecoverCaptureDeviceId())}}async recapture(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];var i;if(this._isRecapturing||!this.sourceTrack)return;this.log.warn("recapture trying");let r=this.sourceTrack;t||null==(i=this.sourceTrack)||i.stop(),this._isRecapturing=!0,this._lastRecaptureTime=Date.now();let n={useExactDeviceId:!0};if("user"===e||"environment"===e)n.facingMode=e;else{let t;("audio"===this.kind?await tx():await ix()).find((t=>t.deviceId===e))&&(t=e),n.deviceId=t}return this.capture(n,t).then((()=>{this._isRecapturing=!1,this.log.warn("recapture success"),this.emit("1",{deviceId:this.deviceId}),cO.emit(lO.LOCAL_TRACK_RECAPTURE,{track:this})})).catch((e=>{this._isRecapturing=!1,this.log.warn("recapture failed ".concat(e.message)),this.emit("5",e),cO.emit(lO.LOCAL_TRACK_RECAPTURE,{track:this,error:e})})).finally((()=>{t&&(null==r||r.stop())}))}async getRecoverCaptureDeviceId(){let e=this instanceof lP;if(e&&this.facingMode)return this.facingMode;let{deviceId:t}=this;if(t){let i=(oP.get(t)||0)+1;if(oP.set(t,i),i>=3&&this.enableAutoSwitchWhenRecapturing){let r=e?(await ix()).find((e=>!oP.has(e.deviceId))):(await tx()).find((e=>!oP.has(e.deviceId)));r&&(this.log.warn("".concat(t," capture fail ").concat(i," times, change new ").concat(r.deviceId)),t=r.deviceId)}}return t}stopCapture(){var e;this.sourceTrack&&(this.sourceTrack.stop(),this.uninstallTrackEvent(this.sourceTrack)),this._inputTrack&&this.uninstallTrackEvent(this._inputTrack),null==(e=this.manager)||e.removeInput(this)}close(){super.close(),this.stopCapture()}};dA([FL(jL.INIT,"ready",{ignoreError:!0,sync:!0})],aP.prototype,"setStateToReady",1),dA([function(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return function(t,i,r){let n=r.value;return r.value=function(){let t=wx.get(this)||new bx;for(var i=arguments.length,r=new Array(i),a=0;a<i;a++)r[a]=arguments[a];return wx.set(this,t),t.push({fn:n,args:r,context:this},e)},r}}()],aP.prototype,"capture",1),dA([FL("ready","publish",{ignoreError:!0,success(){cO.emit(lO.LOCAL_TRACK_PUBLISHED,{track:this,room:this.room}),this.emit("4",{mediaType:this.strMediaType,state:"started",prevState:"starting"}),this.log.info("published")},fail(e){var t;null==(t=this.room)||t.localTracks.delete(this);let i="error",r=e instanceof FR?e:e.cause instanceof FR?e.cause:e,n=!1;r instanceof FR&&(r.message.includes("timeout")?i="timeout":r.code===UR.API_CALL_ABORTED&&(n=!0,i="api-call")),this.emit("4",{mediaType:this.strMediaType,state:"stopped",prevState:"starting",reason:i,error:r}),this.log[n?"info":"error"]("publish failed",r)}}),Ix(521714,!1)],aP.prototype,"publish",1),dA([EA((e=>async function(){let t="publish"===this.state?"started":"starting";e.call(this),this.emit("4",{mediaType:this.strMediaType,state:"stopped",prevState:t,reason:"api-call"}),clearTimeout(this._encodeCheckTimeoutId)})),FL([],"ready",{sync:!0})],aP.prototype,"unpublish",1);var oP=new Map;cO.on(lO.SWITCH_DEVICE_SUCCESS,(e=>{e.track.deviceId&&oP.delete(e.track.deviceId)}));var sP=class{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];this.dataView=e,this.isSEI&&(t?this.addPreventionByte():this.removePreventionByte())}addPreventionByte(){let e=this.seiPayloadStartIndex,t=this.dataView.byteLength-2,i=[],r=0;for(let a=e;a<=t;a++){let e=this.dataView.getInt8(a);switch(e){case 0:case 1:case 2:case 3:2===r&&(i.push(3),r=0),0==e?r++:r=0,i.push(e);break;default:r=0,i.push(e)}}i.push(this.dataView.getInt8(this.dataView.byteLength-1));let n=new DataView(new Uint8Array([...new Uint8Array(this.dataView.buffer).slice(0,e),...i]).buffer);this.dataView=n}removePreventionByte(){let e=this.seiPayloadStartIndex,t=this.dataView.byteLength-1,i=[],r=0;for(let a=e;a<=t;a++)switch(this.dataView.getInt8(a)){case 0:r++,i.push(this.dataView.getInt8(a));break;case 3:2!==r&&i.push(this.dataView.getInt8(a)),r=0;break;default:i.push(this.dataView.getInt8(a)),r=0}let n=new DataView(new Uint8Array([...new Uint8Array(this.dataView.buffer).slice(0,e),...i]).buffer);this.dataView=n}get isSEI(){return 6===this.dataView.getUint8(4)}get seiPayloadStartIndex(){let e=6;for(let t=6;t<this.dataView.buffer.byteLength&&(e++,255===this.dataView.getUint8(t));t++);return e}get seiPayloadType(){return this.isSEI?this.dataView.getUint8(5):null}get seiPayload(){if(!this.isSEI)return null;let e=0,t=6;for(let n=6;n<this.dataView.buffer.byteLength;n++){let i=this.dataView.getUint8(n);if(t++,255!==i){e+=i;break}e+=255}let i=new ArrayBuffer(e),r=new DataView(i);for(let n=0;n<i.byteLength;n++,t++)r.setInt8(n,this.dataView.getInt8(t));return r}},cP=class{constructor(){uA(this,"_seiMessageList",[]),uA(this,"_smallSeiMessageList",[]),uA(this,"_seiPayloadType",243)}encodeSEINalu(e){let t=e.byteLength,i=parseInt(String(t/255),10),r=t%255,n=[];n.push(0,0,0,1,6,this._seiPayloadType);for(let o=0;o<i;o++)n.push(255);n.push(r);let a=new DataView(e);return n.push(...new Uint8Array(a.buffer)),n.push(128),new sP(new DataView(new Uint8Array(n).buffer),!0)}sendSEI(e,t){null!=t&&t.seiPayloadType&&(this._seiPayloadType=t.seiPayloadType),this._seiMessageList.push(e),null!=t&&t.small&&this._smallSeiMessageList.push(e)}isEmpty(){return!this._seiMessageList.length}getNaluCount(e){let t=0,i=0,r=new DataView(e);for(let n=0;n<e.byteLength;n++)switch(r.getUint8(n)){case 0:t++;break;case 1:(2===t||3===t)&&i++,t=0;break;default:t=0}return i}encode(e,t){let i=t?this._smallSeiMessageList:this._seiMessageList;if(i.length>0&&e.data.byteLength>0){let t=9-this.getNaluCount(e.data);if(t<=0)return 0;let r=i.splice(0,t).reverse().map(this.encodeSEINalu.bind(this)),n=r.reduce(((e,t)=>e+t.dataView.byteLength),0),a=new ArrayBuffer(n+e.data.byteLength),o=new DataView(a),s=new DataView(e.data),c=0;for(let e=0;e<r.length;e++)for(let t=0;t<r[e].dataView.byteLength;t++)o.setInt8(c++,r[e].dataView.getInt8(t));for(let i=0;i<e.data.byteLength;i++)o.setInt8(c++,s.getInt8(i));return e.data=a,r.length}return 0}},lP=class extends aP{constructor(e){super(arguments.length>1&&void 0!==arguments[1]?arguments[1]:4,RN),uA(this,"profile",nA({},MA)),uA(this,"avoidCropping",!1),uA(this,"_scaleResolutionDownBy"),uA(this,"stat",{bytesSent:0,packetsSent:0,framesEncoded:0,framesSent:0,frameWidth:0,frameHeight:0,fpsCapture:0,framesCaptured:0}),uA(this,"small"),uA(this,"isNeedToSetBandwidth"),uA(this,"muteImage"),uA(this,"manager"),uA(this,"_seiCodec",new cP),this.manager=e;let t=()=>{var e;if(this.isAllowed2k4k(this.profile))this.room&&this.settings.height>=1440&&"publish"===this.state&&this.room.sendAbilityStatus({"2k4k":1});else{let t=lk((null==(e=this.room)?void 0:e.sdkAppId)||0)?OA:DA;this.log.warn("Resolution is reset to 1080p, need to upgrade ability here ".concat(t)),this.setProfile(aA(nA({},this.profile),{width:1920,height:1080})),this.applyProfile()}};this.on("input-media-track-changed",t),this.on("publish",t),this.handleCameraAdded=this.handleCameraAdded.bind(this),this.handleCameraRemoved=this.handleCameraRemoved.bind(this)}get facingMode(){if(dL&&this.mediaTrack)return this.mediaTrack.getSettings().facingMode}get contentHint(){var e;return(null==(e=this._inputTrack)?void 0:e.contentHint)||""}get isQosClearFirst(){var e;return"detail"===(null==(e=this._inputTrack)?void 0:e.contentHint)}get hasSmall(){var e;return!(null==(e=this.manager)||!e.hasSmall)}async setMute(e){var t,i,r;if(Ok(e)){if(this.muteImage===e)return;await(null==(t=this.manager)?void 0:t.deleteWatermark("mute")),await(null==(i=this.manager)?void 0:i.setWatermark({x:0,y:0,width:this.settings.width,height:this.settings.height,type:"mute",zIndex:999,imageUrl:e,fillVideo:!0})),this.muteImage=e,super.setMute(!1)}else this.muteImage&&(await(null==(r=this.manager)?void 0:r.deleteWatermark("mute")),this.muteImage=void 0),super.setMute(e)}async capture(e){let{deviceId:t,facingMode:i,useExactDeviceId:r=!0,customSource:n,retryWhenExactFailed:a=!0}=e,o={audio:!1,video:!0,facingMode:i||this.facingMode,cameraId:t,width:this.profile.width,height:this.profile.height,frameRate:this.profile.frameRate,useExactDeviceId:r,retryWhenExactFailed:a,customSource:n};if("environment"===o.facingMode){let e=await this.getDeviceIdWhenUsingBackCamera();e&&(o.cameraId=e)}return super.capture(o)}setProfile(e){var t;let i=this.fallbackProfile(e);if(i.bitrate&&(this.isNeedToSetBandwidth=i.bitrate!==this.profile.bitrate),this.isAllowed2k4k(this.profile))super.setProfile(i);else{let e=lk((null==(t=this.room)?void 0:t.sdkAppId)||0)?OA:DA;this.log.warn("Resolution is reset to 1080p, need to upgrade ability here ".concat(e)),super.setProfile(aA(nA({},this.profile),{width:1920,height:1080}))}}async applyProfile(){var e;if(!this.mediaTrack)return;let{width:t=0,height:i=0}=(this.sourceTrack||this.mediaTrack).getSettings(),r=t*i,n=this.settings,a=n.height!==this.profile.height||n.width!==this.profile.width||n.frameRate!==this.profile.frameRate;if(a&&(16===ZD&&this.deviceId?await this.recapture(this.deviceId):(await(null==(e=this.sourceTrack||this.mediaTrack)?void 0:e.applyConstraints({width:this.profile.width,height:this.profile.height,frameRate:this.profile.frameRate})),this.manager&&this.manager.changeInput(this)),this.room&&this.settings.height>=1440&&"publish"===this.state&&this.room.sendAbilityStatus({"2k4k":1})),this.isNeedToSetBandwidth&&this.room&&this.room.setBandWidth){this.isNeedToSetBandwidth=!1;let{width:e=0,height:t=0}=(this.sourceTrack||this.mediaTrack).getSettings(),i=e*t;return a&&i&&r&&i===r?void this.log.warn("set bandwidth failed: resolution is not changed"):this.room.setBandWidth({bandwidth:this.profile.bitrate,type:FA,videoType:HA})}}get settings(){let e={width:this.profile.width,height:this.profile.height,frameRate:this.profile.frameRate},t=this.sourceTrack||this.mediaTrack;return dL&&t&&Object.assign(e,t.getSettings()),e}get scaleResolutionDownBy(){return this._scaleResolutionDownBy?this._scaleResolutionDownBy:fC(this.settings,this.profile)}isAllowed2k4k(e){var t;return!(this.room&&this.room.scheduleResult&&!this.isScreen&&!(e.height*e.width<3686400))||1===(null==(t=this.room.scheduleResult.trtcAutoConf)?void 0:t["2k4k"])}isNeedToSwitchDevice(e){return!(!this.mediaTrack||this.deviceId===e||this.facingMode===e)}async switchDevice(e){try{if(!this.isNeedToSwitchDevice(e)&&!this.isUseCustomSource)return;let t={useExactDeviceId:!0,retryWhenExactFailed:!1};"user"===e||"environment"===e?t.facingMode=e:t.deviceId=e,this.sourceTrack&&this.sourceTrack.stop(),await this.capture(t),cO.emit(lO.SWITCH_DEVICE_SUCCESS,{track:this}),this.log.info("switch camera success")}catch(IA){throw this.log.error("switch camera failed ".concat(IA)),this.deviceId&&this.recapture(this.deviceId),IA}}async getDeviceIdWhenUsingBackCamera(){let e;try{if(CD&&!BD&&hL){let t=(await ix(!0)).map((e=>{var t;return aA(nA({},e),{capabilities:null==(t=e.getCapabilities)?void 0:t.call(e)})})).filter((e=>{var t,i;return null==(i=null==(t=e.capabilities)?void 0:t.facingMode)?void 0:i.includes("environment")})),i=t[0];t.forEach((e=>{var t,r,n,a;let{capabilities:o}=e;(null!=(t=o.width)&&t.max&&null!=(r=o.height)&&r.max?o.width.max*o.height.max:0)>(null!=(n=i.capabilities.width)&&n.max&&null!=(a=i.capabilities.height)&&a.max?i.capabilities.width.max*i.capabilities.height.max:0)&&(i=e)})),null!=i&&i.capabilities&&(this._log.info("use max resolution back camera",i),e=i.deviceId)}}catch(IA){this._log.warn("get max res camera failed",IA)}return e}updateSmallConfig(e){var t,i;this._log.info("update small stream config: ".concat(JSON.stringify(e)));let r=!this.small;this.small=this.fallbackProfile(e,!0),null==(t=this.manager)||t.update(),r&&(null==(i=this.room)||i.enableSmall(!0)),this.log.info("update small stream config success")}fallbackProfile(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=e.width>e.height,r=nA({},e);return e.width*e.height<=19200&&GC&&HD&&(this.log.warn("".concat(t?"small ":"","resolution is ").concat(e.width,"*").concat(e.height,", fallback to 240*180 for android chrome")),r.width=i?240:180,r.height=i?180:240,r.bitrate=Math.max(e.bitrate,150)),e.width*e.height>921600&&QD&&(r.width=i?1280:720,r.height=i?720:1280,this.log.warn("reset to 1280 * 720 on iOS 13~14")),function(e,t){let i=e.split(".").map((e=>Number(e))),r=t.split(".").map((e=>Number(e)));for(let n=0;n<Math.max(i.length,r.length);n++){let e=i[n]||0,t=r[n]||0;if(e<t)return!0;if(e>t)return!1}return!1}(XD,"14.3")&&function(e,t){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=e.split(".").map((e=>Number(e))),n=t.split(".").map((e=>Number(e)));for(let a=0;a<Math.max(r.length,n.length);a++){let e=r[a]||0,t=n[a]||0;if(e>t)return!0;if(e<t)return!1}return i}(XD,"14.0",!0)&&this.on("7",(()=>{let e=this.profile.width>this.profile.height;this.profile.width*this.profile.height>307200?(this.profile.width=e?640:480,this.profile.height=e?480:640,this.log.warn("reduce the resolution to 480p on iOS 14.0 ~ 14.2")):this.profile.width*this.profile.height>230400&&(this.profile.width=e?640:360,this.profile.height=e?360:640,this.log.warn("reduce the resolution to 360p on iOS 14.0 ~ 14.2"))})),!t&&this.avoidCropping&&(HD||KC)&&!(GC||WC||jC||VC||BD)&&e.width*e.height<=230400&&e.width/e.height==16/9&&(this._scaleResolutionDownBy=1280/e.width,e.width=1280,e.height=720,this.log.warn("capture 720p, scale: ".concat(this._scaleResolutionDownBy))),r}stopSmall(){var e,t;this.small&&(delete this.small,null==(e=this.manager)||e.update(),null==(t=this.room)||t.enableSmall(!1))}listenDeviceChange(){QN&&!QN.listeners("videoInputRemoved").includes(this.handleCameraRemoved)&&QN.on("videoInputRemoved",this.handleCameraRemoved,this)}async handleCameraRemoved(e){if(e.deviceId===this.deviceId){let t=1===this.recaptureMode;if(this.log.warn("RecaptureMode: ".concat(nP[this.recaptureMode],". Current camera is lost: ").concat(JSON.stringify(e))),0===this.recaptureMode){xP(this.userId,{eventId:2003,param1:7,streamType:2});let e=await ix();e[0]?this.recapture(e[0].deviceId):t=!0}t&&QN.on("videoInputAdded",this.handleCameraAdded,this)}}async handleCameraAdded(e){1===this.recaptureMode&&e.deviceId!==this.deviceId||(QN.off("videoInputAdded",this.handleCameraAdded,this),this.log.warn("camera added: ".concat(JSON.stringify(e))),this.recapture(e.deviceId))}encodeFrame(e,t){if(!this.manager)return e;let i=t?8:this.mediaType;return this.manager.encodePipeline.reduceRight(((e,t)=>t?t({frame:e,mediaType:i}):e),e)}get enableEncodeFrame(){return!!this.manager&&this.manager.encodePipeline.some((e=>e))}play(e,t){return Dk(this.mirror)&&!this.isScreen&&this.setMirror("view"),super.play(e,t)}close(){QN.off("videoInputAdded",this.handleCameraAdded,this),QN.off("videoInputRemoved",this.handleCameraRemoved,this),super.close()}async recapture(e){try{await super.recapture(e)}catch(IA){let i=(await ix()).find((t=>t.deviceId!==e));if(!i)throw IA;await super.recapture(i.deviceId)}}setContentHint(e){this.mediaTrack&&"contentHint"in this.mediaTrack&&(this.mediaTrack.contentHint!==e&&(this.log.info("setContentHint ".concat(e)),this.mediaTrack.contentHint=e),this.outMediaTrack&&this.outMediaTrack.contentHint!==e&&(this.outMediaTrack.contentHint=e))}setRotation(e){this.manager&&(this.isScreen||Dk(e)||e!==this.rotation&&(this.rotation=e,this.manager.rotation=e))}};dA([yA((function(e){this.setContentHint(e.contentHint||"motion")}))],lP.prototype,"capture",1);var dP=[-1,-1,1,-1,-1,1,1,1],uP=[0,0,1,0,0,1,1,1],hP=class e extends jL{constructor(e,t){if(super(),this.context=e,uA(this,"name"),uA(this,"input"),uA(this,"output"),uA(this,"texture"),uA(this,"ctx2d",null),uA(this,"fbo"),uA(this,"width",0),uA(this,"height",0),uA(this,"x",0),uA(this,"y",0),uA(this,"program"),uA(this,"vertexShader"),uA(this,"fragmentShader"),uA(this,"totalFrames",0),uA(this,"dropFrames",0),uA(this,"matchInputSize",!0),uA(this,"texCoordBuffer"),uA(this,"positionBuffer"),uA(this,"lastInfo",{name:"",timestamp:0,totalFrames:0,x:0,y:0,width:0,height:0,fps:0}),uA(this,"cost",0),uA(this,"_canvas",null),uA(this,"_image"),uA(this,"log"),this.context.on("disconnect",this.close,this),this.name=t.name,this.log=t.logger,this.matchInputSize=!1!==t.matchInputSize,this.width=t.width||e.width,this.height=t.height||e.height,this._image=t.image,e instanceof AP)e.ctx&&t.create2d&&("function"==typeof OffscreenCanvas&&16!==ZD?this._canvas=new OffscreenCanvas(this.width,this.height):(this._canvas=document.createElement("canvas"),this._canvas.width=this.width,this._canvas.height=this.height),this.ctx2d=this._canvas.getContext("2d"),this._image=this._canvas);else try{let i=e.ctx;this.texCoordBuffer=this.createBuffer(uP),this.positionBuffer=this.createBuffer(dP),!1!==t.createTexture&&(this.texture=i.createTexture(),this.useTexture(),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MIN_FILTER,i.LINEAR),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MAG_FILTER,i.LINEAR),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_S,i.CLAMP_TO_EDGE),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_T,i.CLAMP_TO_EDGE),i.pixelStorei(i.UNPACK_ALIGNMENT,1)),t.useFbo&&(this.fbo=i.createFramebuffer(),this.useBufferFrame(),this.useTexture(),i.texImage2D(i.TEXTURE_2D,0,i.RGBA,this.width,this.height,0,i.RGBA,i.UNSIGNED_BYTE,null),i.framebufferTexture2D(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0,i.TEXTURE_2D,this.texture,0)),t.useDefaultProgram?this.program=e.defaultProgam:(t.vertexShaderSource||t.fragmentShaderSource)&&(this.vertexShader=t.vertexShaderSource?e.createShader(i.VERTEX_SHADER,t.vertexShaderSource):e.defaultVShader,this.fragmentShader=t.fragmentShaderSource?e.createShader(i.FRAGMENT_SHADER,t.fragmentShaderSource):e.defaultFShader,this.program=e.createProgram(this.vertexShader,this.fragmentShader))}catch(i){this.context.destroy(new FR({code:UR.VIDEO_MANAGER_ERROR,extraCode:3,message:"create video node ".concat(this.name," error ").concat(i.message||i)}))}}get image(){return this._image}set image(e){this._image=e}createFramebuffer(e){let t=this.context.ctx,i=t.createFramebuffer();return t.bindFramebuffer(t.FRAMEBUFFER,i),t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,e,0),i}connect(e){for(var t=arguments.length,i=new Array(t>1?t-1:0),r=1;r<t;r++)i[r-1]=arguments[r];return e.addInput(this,...i),this.output=e,e}addInput(e){this.input=e,this.matchInputSize&&e.width&&e.height&&this.resize(e.width,e.height)}requestFrame(e){let t=Date.now();return!!(this.context instanceof SP&&this.render(e)||this.context instanceof AP&&this.render2d(e))&&(this.totalFrames++,this.cost=Date.now()-t,!0)}render2d(e){var t;return!(null==(t=this.input)||!t.requestFrame(e))&&this.draw2d(this.input.image,0,0,this.width,this.height)}update(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;var t;null==(t=this.output)||t.update(e)}disconnect(){for(var e,t=arguments.length,i=new Array(t),r=0;r<t;r++)i[r]=arguments[r];null==(e=this.output)||e.removeInput(this,...i),delete this.output}removeInput(e){delete this.input}close(){var e,t;if(this.context.off("disconnect",this.close,this),null==(e=this.output)||e.removeInput(this),delete this.output,null==(t=this.input)||t.disconnect(),this.context instanceof SP){let e=this.context.ctx;e.deleteBuffer(this.texCoordBuffer),e.deleteBuffer(this.positionBuffer),this.fbo&&e.deleteFramebuffer(this.fbo),this.texture&&e.deleteTexture(this.texture),this.vertexShader&&this.vertexShader!==this.context.defaultVShader&&e.deleteShader(this.vertexShader),this.fragmentShader&&this.fragmentShader!==this.context.defaultFShader&&e.deleteShader(this.fragmentShader),this.program&&this.program!==this.context.defaultProgam&&e.deleteProgram(this.program)}this._canvas&&(this._canvas.width=0,this._canvas.height=0,this.ctx2d=null),this.removeAllListeners()}useTexture(){this.useTextures(this.texture)}useInputTexture(){var e;this.useTextures(null==(e=this.input)?void 0:e.texture)}useTextures(){let e=this.context.ctx;for(var t=arguments.length,i=new Array(t),r=0;r<t;r++)i[r]=arguments[r];i.forEach(((t,i)=>{t&&(e.activeTexture(e.TEXTURE0+i),e.bindTexture(e.TEXTURE_2D,t))}))}useProgram(){this.context.ctx.useProgram(this.program)}useBufferFrame(){let e=this.context.ctx;e.bindFramebuffer(e.FRAMEBUFFER,this.fbo||null)}createBuffer(e){let t=this.context.ctx,i=t.createBuffer();return t.bindBuffer(t.ARRAY_BUFFER,i),t.bufferData(t.ARRAY_BUFFER,new Float32Array(e),t.STATIC_DRAW),i}setTexBuffer(e){let t=this.context.ctx;t.bindBuffer(t.ARRAY_BUFFER,this.texCoordBuffer),t.bufferData(t.ARRAY_BUFFER,new Float32Array(e),t.STATIC_DRAW)}setPosBuffer(e){let t=this.context.ctx;t.bindBuffer(t.ARRAY_BUFFER,this.positionBuffer),t.bufferData(t.ARRAY_BUFFER,new Float32Array(e),t.STATIC_DRAW)}changeBufferData(e,t){let i=this.context.ctx;i.bindBuffer(i.ARRAY_BUFFER,e),i.bufferData(i.ARRAY_BUFFER,new Float32Array(t),i.STATIC_DRAW)}setAttributes(){let e=this.context.ctx;for(var t=arguments.length,i=new Array(t),r=0;r<t;r++)i[r]=arguments[r];i.forEach(((t,i)=>{e.enableVertexAttribArray(i),e.bindBuffer(e.ARRAY_BUFFER,t),e.vertexAttribPointer(i,2,e.FLOAT,!1,0,0)}))}getVertexPoint(e,t){return[e/this.width*2-1,t/this.height*2-1]}layout2texCoords(e){return[...this.getVertexPoint(e.x,e.y),...this.getVertexPoint(e.x+e.width,e.y),...this.getVertexPoint(e.x,e.y+e.height),...this.getVertexPoint(e.x+e.width,e.y+e.height)]}resize(e,t){if(this.width!==e||this.height!==t){if(this.width=e,this.height=t,this._canvas&&(this._canvas.width=e,this._canvas.height=t),this.texture&&this.fbo){this.useTexture();let i=this.context.ctx;i.texImage2D(i.TEXTURE_2D,0,i.RGBA,e,t,0,i.RGBA,i.UNSIGNED_BYTE,null)}this.output&&this.output.matchInputSize&&this.output.resize(e,t)}}draw(e,t){this.setAttributes(e||this.positionBuffer,t||this.texCoordBuffer);let i=this.context.ctx;i.drawArrays(i.TRIANGLE_STRIP,0,4)}draw2d(t,i,r,n,a,o,s,c,l){let d=!(Dk(o)||Dk(s)||Dk(c)||Dk(l));return!(!this.ctx2d||!t)&&(t instanceof ImageData?(d?this.ctx2d.putImageData(t,i,r,o,s,c,l):this.ctx2d.putImageData(t,i,r),this.emit(e.RENDER,this.ctx2d.canvas)):(d?this.ctx2d.drawImage(t,o,s,c,l,i,r,n,a):this.ctx2d.drawImage(t,i,r,n,a),this.emit(e.RENDER,t)),"undefined"!=typeof VideoFrame&&t instanceof VideoFrame&&t.close(),!0)}drawBackGround2d(e){this.ctx2d&&(this.ctx2d.save(),this.ctx2d.fillStyle=e,this.ctx2d.fillRect(0,0,this.width,this.height),this.ctx2d.restore())}getInfo(){var e;let{totalFrames:t,x:i,y:r,width:n,height:a,name:o,cost:s}=this,c=Date.now(),l=(t-this.lastInfo.totalFrames)/((c-this.lastInfo.timestamp)/1e3)|0;return this.lastInfo={totalFrames:t,x:i,y:r,width:n,height:a,timestamp:c,fps:l,name:o,cost:s},nA({parent:null==(e=this.input)?void 0:e.getInfo()},this.lastInfo)}createTexture(e){let t=this.context.ctx,i=t.createTexture();return this.useTextures(i),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.LINEAR),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.LINEAR),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),t.pixelStorei(t.UNPACK_ALIGNMENT,1),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,t.RGBA,t.UNSIGNED_BYTE,e),i}};uA(hP,"RENDER","render"),dA([FL(jL.INIT,"connected",{sync:!0})],hP.prototype,"connect",1),dA([FL("connected",jL.INIT,{ignoreError:!0,sync:!0})],hP.prototype,"disconnect",1),dA([FL([],"closed",{sync:!0})],hP.prototype,"close",1);var pP=hP,fP=Lx(function(e){return Nx((t=>{let i=0,r=setInterval((()=>t.next(i++)),e);return t.defer((()=>{clearInterval(r)})),"interval"}),"interval",arguments)}(250),Yx((()=>performance.now())),Fx()),mP=[0,1,1,1,0,0,1,0],gP=class extends pP{constructor(e,t){super(e,Object.assign({useDefaultProgram:!0,createTexture:!1,name:"destination"},t)),uA(this,"_intervalId",0),uA(this,"_sequence",0),uA(this,"checkGLError",!1),uA(this,"checkVisibilityChange"),e instanceof AP?this.ctx2d=e.ctx||null:e.available&&null!=t&&t.mirrorUpAndDown&&this.setTexBuffer(mP)}start(e){this.log.info("".concat(this.name," start render ").concat(e," fps")),YL.clearTask(this._intervalId),this._intervalId=YL.run("intervalInWorker",(()=>{if(e!==this.context.frameRate&&(YL.clearTask(this._intervalId),this.start(this.context.frameRate)),this.requestFrame(this._sequence++),this.checkGLError&&this.context instanceof SP){let e=this.context.ctx.getError();e&&this.context.destroy(new FR({code:UR.VIDEO_MANAGER_ERROR,extraCode:5,message:"".concat(this.name," req ").concat(this._sequence," render ").concat(this.totalFrames," faild ").concat(e)}))}}),{fps:this.context.frameRate})}render(e){var t;return!(null==(t=this.input)||!t.requestFrame(e))&&(this.useProgram(),this.useBufferFrame(),this.useInputTexture(),this.draw(),this.emit(pP.RENDER,this.context._canvas),!0)}addInput(e){for(var t=arguments.length,i=new Array(t>1?t-1:0),r=1;r<t;r++)i[r-1]=arguments[r];super.addInput(e,...i),this.start(this.context.frameRate)}update(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;"closed"!==this.state&&(this._intervalId&&(YL.clearTask(this._intervalId),this._intervalId=0,1===e&&(this.log.info("".concat(this.name," use requestVideoFrameCallback")),this.checkVisibilityChange=()=>{document.hidden&&(this.start(this.context.frameRate),this.log.info("".concat(this.name," use timer")),document.removeEventListener("visibilitychange",this.checkVisibilityChange))},document.addEventListener("visibilitychange",this.checkVisibilityChange))),this.requestFrame(this._sequence++))}removeInput(e){super.removeInput(e),YL.clearTask(this._intervalId)}resize(e,t){super.resize(e,t),this.context.setSize(e,t)}close(){super.close(),YL.clearTask(this._intervalId),document.removeEventListener("visibilitychange",this.checkVisibilityChange)}},vP=class extends gP{constructor(e,t){super(e,t),uA(this,"_videoTrack"),uA(this,"_muteOb"),uA(this,"_closedOb",zx(this,"closed")),uA(this,"_subscription"),uA(this,"_canvasContainer"),Number(YD)<17&&(this._canvasContainer=document.createElement("div"),this._canvasContainer.style.display="none"),[this._videoTrack]=e.canvas.captureStream().getVideoTracks(),this._muteOb=zx(this._videoTrack,"mute"),Lx(zx(this._videoTrack,"ended"),qx(this._closedOb),iP((()=>{this.context.destroy(new FR({code:UR.VIDEO_MANAGER_ERROR,extraCode:8,message:"video track ended"}))})))}enableCheckMute(){this._subscription=Lx(this._muteOb,qx(this._closedOb),tP((e=>t=>{let i=performance.now();Lx(fP,Kx((t=>t-i<e)),Gx(1))(t)})(5e3)),Wx((()=>{var e;return!(null==(e=this._videoTrack)||!e.muted||document.hidden)})),iP((()=>{this.context.destroy(new FR({code:UR.VIDEO_MANAGER_ERROR,extraCode:7,message:"video track muted"}))})))}disableCheckMute(){var e;null==(e=this._subscription)||e.dispose()}get videoTrack(){return this._videoTrack}putCanvasIntoDom(){!this.context._canvas||!this._canvasContainer||document.getElementById(this.context._canvas.id)||(this.log.info("".concat(this.name," put canvas to body")),document.body.appendChild(this._canvasContainer),this._canvasContainer.appendChild(this.context._canvas))}render(e){return this.putCanvasIntoDom(),super.render(e)}render2d(e){return this.putCanvasIntoDom(),super.render2d(e)}close(){var e,t;super.close(),null==(e=this._videoTrack)||e.stop(),delete this._videoTrack,null==(t=this._canvasContainer)||t.remove()}},_P=class extends pP{constructor(e,t){super(e,nA({name:"imageSource"},t)),uA(this,"_lastImage"),uA(this,"_totalFrames",0),uA(this,"_autoResize",!1),uA(this,"_canvasRendered"),uA(this,"videoCallbackId",0),uA(this,"waitingFirstFrame",!0),uA(this,"shouldUpdate",!0),this._autoResize=!1!==(null==t?void 0:t.autoResize),16===ZD&&(this._canvasRendered=Hx(),Lx(this._canvasRendered,function(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];return e=>Nx((function(i){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:t.length;for(;r<n&&!i.disposed;)i.next(t[r++]);i.disposed||i.subscribe(e)}),"startWith",arguments)}(this._image),$x((e=>e instanceof HTMLCanvasElement?zx(e,"rendered"):function(){return Nx((e=>e.complete()),"empty",arguments)}())),qx(zx(this,"closed")),iP((()=>{this.update()}))))}onFirstFrame(){this.waitingFirstFrame=!1}tryVideoFrameCallback(){if(!this.shouldUpdate)return;let e=this.image;this.videoCallbackId&&e.cancelVideoFrameCallback(this.videoCallbackId),SL()&&!document.hidden&&(this.videoCallbackId=e.requestVideoFrameCallback(((e,t)=>{this.waitingFirstFrame&&this.onFirstFrame(),document.hidden||(this._totalFrames=t.presentedFrames,this.update(1))})))}_render(e,t){var i;let{width:r,height:n}=this,{image:a}=this;if(a instanceof HTMLVideoElement){if(this.tryVideoFrameCallback(),({videoWidth:r,videoHeight:n}=a),!r||!n)return!1;a.width=r,a.height=n}else if(a instanceof HTMLImageElement||a instanceof ImageData||a instanceof ImageBitmap){if(({width:r,height:n}=a),a!==this._lastImage)this._lastImage=a;else if(r===this.width&&n===this.height)return!0}else a instanceof HTMLCanvasElement||a instanceof OffscreenCanvas?(({width:r,height:n}=a),this._lastImage=a):"undefined"!=typeof VideoFrame&&a instanceof VideoFrame&&(({displayWidth:r,displayHeight:n}=a),null==(i=this._lastImage)||i.close(),this._lastImage=a);if(!this._autoResize)return!0;if(this.width===r&&this.height===n&&this.totalFrames){if(t){this.useTexture();let e=this.context.ctx;e.texSubImage2D(e.TEXTURE_2D,0,0,0,e.RGBA,e.UNSIGNED_BYTE,a)}}else{if(t){this.useTexture();let e=this.context.ctx;e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,a)}this.resize(r,n)}return!0}get image(){return this._image}set image(e){var t;null==(t=this._canvasRendered)||t.next(e),this._image=e}render(e){return this._render(e,!0)}render2d(e){return this._render(e,!1)}},yP=class extends _P{constructor(e,t,i){super(e,i),this._player=t,this.name="videoPlayerSource",Lx(zx(this._player,XL.PLAYER_STATE_CHANGED),qx(zx(this,"closed")),Wx((e=>{let{state:t}=e;return"PLAYING"===t})),iP((()=>{this.tryVideoFrameCallback()})))}get image(){return this._player.element}},EP=class extends yP{get available(){return this._player.isPlaying&&!this.waitingFirstFrame}constructor(e,t,i){super(e,new RN({id:i.name,track:t,muted:!0,container:null,objectFit:"contain",log:i.logger}),i),this.name="videoTrackSource",this._player.play()}replaceTrack(e){this.waitingFirstFrame=!0,this._player.setTrack(e),this._player.play()}close(){super.close(),this._player.stop()}},bP=class extends pP{constructor(e,t,i){super(e,aA(nA({name:"textSource"},i),{create2d:!0})),uA(this,"hasChange",!0),uA(this,"content",""),this.ctx2d.textBaseline="top",this.content=t.content||"",t.font&&(this.font=t.font),t.color&&(this.color=t.color)}set font(e){this.ctx2d&&(this.ctx2d.font=e,this.hasChange=!0)}get font(){var e;return(null==(e=this.ctx2d)?void 0:e.font)||""}set color(e){this.ctx2d&&(this.ctx2d.fillStyle=e,this.hasChange=!0)}get color(){var e;return(null==(e=this.ctx2d)?void 0:e.fillStyle)||""}render2d(e){return!(!this.ctx2d||!this.hasChange)&&(this.ctx2d.clearRect(0,0,this.width,this.height),this.drawMultilineText(0,0),this.hasChange=!1,!0)}render(e){return!1}resize(e,t){if(!this.ctx2d)return;let{color:i,font:r}=this;super.resize(e,t),this.color=i,this.font=r}drawMultilineText(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1.2;if(!this.ctx2d)return;let r=this.ctx2d.measureText(this.content);t+=r.fontBoundingBoxAscent||r.actualBoundingBoxAscent||0;let n=this.font.match(/(\d+)px/),a=(n?parseInt(n[1],10):16)*i,o=this.content.split("\n");for(let s=0;s<o.length;s++)this.ctx2d.fillText(o[s],e,t+s*a)}},wP=class extends jL{constructor(e){super(),uA(this,"frameRate"),uA(this,"_canvas"),uA(this,"log"),uA(this,"hasAlpha",!1),uA(this,"name"),uA(this,"error"),this.name=e.name,this.log=e.logger.createChild({id:"vc-".concat(this.name)}),this.frameRate=e.frameRate}get canvas(){return this._canvas}set width(e){this._canvas&&(this._canvas.width=e)}get width(){var e;return(null==(e=this._canvas)?void 0:e.width)||0}set height(e){this._canvas&&(this._canvas.height=e)}get height(){var e;return(null==(e=this._canvas)?void 0:e.height)||0}setSize(e,t){this._canvas&&(this._canvas.width=e,this._canvas.height=t)}createVideoTrackSource(e,t){return new EP(this,e,{logger:this.log,name:t})}createVideoTrackDestination(e){return new vP(this,e)}createVideoImageSource(e,t){return new _P(this,t?Object.assign(t,{logger:this.log,image:e}):{logger:this.log,image:e})}createVideoPlayerSource(e,t){return new yP(this,e,t?Object.assign(t,{logger:this.log}):{logger:this.log})}createTextSource(e,t){return new bP(this,e,t?Object.assign(t,{logger:this.log}):{logger:this.log})}get available(){return"created"===this.state}disconnect(){this.emit("disconnect")}};uA(wP,"_ids",0);var IP={alpha:!0,antialias:!1,premultipliedAlpha:!1,preserveDrawingBuffer:!1,depth:!1,stencil:!1,failIfMajorPerformanceCaveat:!0,powerPreference:"low-power"},TP=class extends wP{constructor(){super(...arguments),uA(this,"defaultProgam"),uA(this,"defaultVShader"),uA(this,"defaultFShader"),uA(this,"ctx"),uA(this,"_canvas2d")}get canvas(){return this._canvas2d||this._canvas}create(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(this._canvas||(this._canvas=document.createElement("canvas"),this._canvas.id="trtc_".concat(this.name,"_").concat(wP._ids++)),e&&(this._canvas2d=document.createElement("canvas")),this.ctx=this._canvas.getContext("webgl2",IP),!this.ctx)throw new FR({code:UR.VIDEO_MANAGER_ERROR,extraCode:2,message:"webgl2 not supported"});this.defaultVShader=this.createShader(this.ctx.VERTEX_SHADER,"\n// 顶点着色器\nattribute vec4 a_position;\nattribute vec2 a_texCoord;\nvarying vec2 v_texCoord;\n\nvoid main() {\n gl_Position = a_position;\n v_texCoord = a_texCoord;\n}\n"),this.defaultFShader=this.createShader(this.ctx.FRAGMENT_SHADER,"\n// 片元着色器\nprecision mediump float;\nvarying vec2 v_texCoord;\nuniform sampler2D u_texture;\n\nvoid main() {\n gl_FragColor = texture2D(u_texture, v_texCoord);\n} "),this.defaultProgam=this.createProgram(this.defaultVShader,this.defaultFShader),this._canvas.addEventListener("webglcontextlost",(()=>{this.destroy(new FR({code:UR.VIDEO_MANAGER_ERROR,extraCode:4,message:"webgl context lost"}))}))}destroy(e){let t="";return e&&(t=e.message,this.error=e,SO.addFailedEvent({key:512702,error:e})),this.disconnect(),this.log.info("video context destroy".concat(t)?": ".concat(t):""),this.ctx&&(this.ctx.deleteShader(this.defaultVShader),this.ctx.deleteShader(this.defaultFShader),this.ctx.deleteProgram(this.defaultProgam),delete this.ctx),e}set width(e){var t;null==(t=this.ctx)||t.viewport(0,0,e,this.height),super.width=e,this._canvas2d&&(this._canvas2d.width=e)}set height(e){var t;null==(t=this.ctx)||t.viewport(0,0,this.width,e),super.height=e,this._canvas2d&&(this._canvas2d.height=e)}setSize(e,t){var i;null==(i=this.ctx)||i.viewport(0,0,e,t),super.setSize(e,t),this._canvas2d&&(this._canvas2d.width=e,this._canvas2d.height=t)}createShader(e,t){let i=this.ctx,r=i.createShader(e);return i.shaderSource(r,t),i.compileShader(r),r}createProgram(e,t){let i=this.ctx,r=i.createProgram();return i.attachShader(r,e),i.attachShader(r,t),i.linkProgram(r),i.getProgramParameter(r,i.LINK_STATUS)||this.log.error(i.getProgramInfoLog(r)),r}};uA(TP,"UNAVAILABLE","unavailable"),dA([FL(jL.INIT,"created",{sync:!0,fail(e){this.log.error("video gl context create failed",e.cause),SO.addFailedEvent({key:512700,error:e.cause||e})},success(){this.log.info("video context created use webgl"),SO.addSuccessEvent({key:512700})}})],TP.prototype,"create",1),dA([FL("created",jL.INIT,{ignoreError:!0,sync:!0,success(e){e&&this.emit(TP.UNAVAILABLE,e),this.removeAllListeners()}})],TP.prototype,"destroy",1);var SP=TP,AP=class extends wP{constructor(){super(...arguments),uA(this,"ctx")}create(e){if(this.hasAlpha=e.alpha,this._canvas=document.createElement("canvas"),this._canvas.id="trtc_".concat(this.name,"_").concat(wP._ids++),this.ctx=this._canvas.getContext("2d",{alpha:e.alpha,willReadFrequently:e.willReadFrequently}),!this.ctx)throw new FR({code:UR.VIDEO_MANAGER_ERROR,extraCode:2,message:"2d context not supported"});this._canvas.addEventListener("contextlost",(()=>{this.log.error("2d context lost")})),this._canvas.addEventListener("contextrestored",(()=>{this.log.warn("2d context restored")}))}destroy(e){let t="";e&&(t=e.message,this.error=e,SO.addFailedEvent({key:512703,error:e})),this.disconnect(),this.log.info("video context destroy ".concat(t?": ".concat(t):"")),delete this.ctx,this._canvas&&(this._canvas.remove(),this._canvas.width=0,this._canvas.height=0,delete this._canvas),this.removeAllListeners(),SO.addSuccessEvent({key:512703})}};dA([FL(jL.INIT,"created",{sync:!0,fail(e){this.log.error("video 2d context create failed",e.cause),SO.addFailedEvent({key:512701,error:e.cause||e})},success(){this.log.info("video context created use 2d"),SO.addSuccessEvent({key:512701})}})],AP.prototype,"create",1),dA([FL("created",jL.INIT,{ignoreError:!0,sync:!0})],AP.prototype,"destroy",1);var RP=pO();if("undefined"!=typeof navigator&&navigator.mediaDevices&&"setCaptureHandleConfig"in navigator.mediaDevices)try{navigator.mediaDevices.setCaptureHandleConfig({handle:RP,exposeOrigin:!0,permittedOrigins:["*"]})}catch(GS){}var kP=async function(e){let t=null,i=function(e){let t={preferCurrentTab:"current-tab"===e.preferDisplaySurface||!!e.captureElement,systemAudio:"include",selfBrowserSurface:"include",surfaceSwitching:"include"},i={width:qD?{max:e.width}:{ideal:e.width,max:e.width},height:qD?{max:e.height}:{ideal:e.height,max:e.height},frameRate:e.frameRate,displaySurface:e.preferDisplaySurface||"monitor"};if(t.video=i,e.systemAudio){let{echoCancellation:i=!0,noiseSuppression:r=!1,autoGainControl:n=!1}=e;t.audio={echoCancellation:i,noiseSuppression:r,autoGainControl:n,sampleRate:48e3}}return t}(e);hO.info("getDisplayMedia with constraints: ".concat(JSON.stringify(i)));let r=await navigator.mediaDevices.getDisplayMedia(i);e.systemAudio&&0===r.getAudioTracks().length&&(jD&&WD<74||qD||KC)&&hO.warn("Your browser not support capture system audio");let n=r.getVideoTracks()[0];if(n){if(e.frameRate)try{await n.applyConstraints({frameRate:{min:e.frameRate,ideal:e.frameRate},width:e.width,height:e.height})}catch(a){hO.warn("screen applyConstraints failed: ".concat(a))}e.captureElement&&await async function(e,t){var i;if("CropTarget"in window&&"fromElement"in CropTarget&&Ck(e.cropTo))try{if((null==(i=e.getCaptureHandle())?void 0:i.handle)!==RP)return;let r=await CropTarget.fromElement(t);await e.cropTo(r)}catch(r){hO.warn("cropTo target failed ".concat(r))}}(n,e.captureElement)}if(e.audio){let i=function(e){let t={echoCancellation:e.echoCancellation,autoGainControl:e.autoGainControl,noiseSuppression:e.noiseSuppression,sampleRate:e.sampleRate,channelCount:e.channelCount};return Dk(e.microphoneId)||(t.deviceId=e.microphoneId),{audio:t,video:!1}}(e);hO.info("getUserMedia with constraints: ".concat(JSON.stringify(i))),t=await navigator.mediaDevices.getUserMedia(i),r.addTrack(t.getAudioTracks()[0])}return r};dA([yA((function(e){this.setContentHint(e.contentHint||"detail")}))],class extends lP{constructor(e){super(e,2),uA(this,"profile",{width:1920,height:1080,frameRate:5,bitrate:1600}),uA(this,"objectFit","contain"),uA(this,"isScreen",!0),this._log.id="s-".concat(this._log.id)}get isShareCurrentTab(){var e,t;try{return RP===(null==(t=null==(e=this.mediaTrack)?void 0:e.getCaptureHandle())?void 0:t.handle)}catch(i){return}}async capture(e){let{systemAudio:t=!1,autoGainControl:i,echoCancellation:r,noiseSuppression:n,audioTrack:a,videoTrack:o,captureElement:s,preferDisplaySurface:c}=e;try{let e;return o||a?(e=new MediaStream,o&&e.addTrack(o),a&&e.addTrack(a)):(e=await kP({audio:!1,systemAudio:t,width:this.profile.width,height:this.profile.height,frameRate:this.profile.frameRate,autoGainControl:i,echoCancellation:r,noiseSuppression:n,captureElement:s,preferDisplaySurface:c}),this.sourceTrack=e.getVideoTracks()[0]),await this.setInputMediaStreamTrack(e.getVideoTracks()[0]),e}catch(l){throw this.log.error("getDisplayMedia error observed ".concat(l)),l instanceof FR?l:new FR({code:UR.INITIALIZE_FAILED,name:l.name,message:l.message})}}async switchDevice(e){throw new Error("Method not implemented.")}}.prototype,"capture",1);var CP=class e extends ux{constructor(t,i,r){super({userId:i.userId,sdkAppId:t.sdkAppId,mediaType:r,room:t}),this.room=t,this.user=i,uA(this,"tinyId"),uA(this,"isRemote",!0),uA(this,"jitterBufferDelay",0),uA(this,"availableState"),uA(this,"remotePublishState"),uA(this,"_triggerCheckDecodeSubject",Hx(zx(this,e.STATE_SUBSCRIBE))),uA(this,"ignoreUpdatePlayingState"),this.tinyId=i.tinyId,this.availableState=new jL("".concat(i.userId,"-").concat(this.mediaType,"-available"),"remote-track-available"),this.remotePublishState=new jL("".concat(i.userId,"-").concat(this.mediaType,"-remote-publish"),"remote-track-publish"),Lx(Vx(zx(this,jL.STATECHANGED),zx(this.remotePublishState,jL.STATECHANGED)),Yx((()=>this.isRemotePublished&&(this.isSubscribed||this.isSubscribing))),iP((e=>{this.availableState.state!==(e?jL.ON:jL.OFF)&&(this.availableState.state=e?jL.ON:jL.OFF),(!this.isRemotePublished||!this.ignoreUpdatePlayingState)&&this.updatePlayingState(e)})));let n=Lx(zx(this.player,XL.ERROR),Wx((e=>e.code===MediaError.MEDIA_ERR_DECODE))),a=Lx(function(e,t){return Nx((i=>{let r=0,n=setTimeout((()=>{if(i.removeDefer(a),i.next(r++),t){let e=setInterval((()=>i.next(r++)),t);i.defer((()=>{clearInterval(e)}))}else i.complete()}),e),a=()=>clearTimeout(n);i.defer(a)}),"timer",arguments)}(5e3),Wx((()=>!(this.ignoreDecodeError||!this.isSubscribed||!this.isPlayCalled||!this.stat.bytesReceived)&&(!this.player.isPlaying&&!(this.kind===BA?this.getAudioLevel()>0:this.stat.framesDecoded>0)||(this.reportDecodeResult(!0),!1))))),o=Lx(function(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];return Nx((e=>{let i=new Map;t.forEach((t=>{let r=new Dx(e);i.set(t,r),r.complete=()=>{i.delete(t),0===i.size?e.complete():r.dispose()},r.next=e=>{i.delete(t),i.forEach((e=>e.dispose())),r.resetNext(),r.resetComplete(),r.next(e)}})),t.forEach((e=>i.get(e).subscribe(e)))}),"race",arguments)}(n,a),qx(zx(this,jL.INIT)));Lx(this._triggerCheckDecodeSubject,Wx((()=>!this.ignoreDecodeError)),tP(o),iP((e=>{this.reportDecodeResult(!1,e)})))}setMute(e){this.isRemotePublished&&super.setMute(e)}setInputMediaStreamTrack(e){super.setInputMediaStreamTrack(e),this.isRemotePublished&&this.isSubscribed&&this.player.setTrack(this.outMediaTrack)}checkDecodeResult(){this._triggerCheckDecodeSubject.next(!0)}waitHasMediaTrack(){return new Promise((e=>{this.mediaTrack?e():this.once("input-media-track-changed",e)}))}get ignoreDecodeError(){var e,t;return((null==(t=null==(e=this.room)?void 0:e.networkQuality)?void 0:t.downlinkNetworkQuality)||0)>3||this.player.isInAutoPlayFailedState}get isSubscribing(){return"subscribeing"===this.state.toString()}get isSubscribed(){return this.state===e.STATE_SUBSCRIBE}get isAvailable(){return this.availableState.state===jL.ON}get isNeedPlay(){return this.isAvailable&&this.isPlayCalled}subscribe(e){return e}unsubscribe(){this.player.setTrack(null),"main"===this.streamType&&"video"===this.kind&&this.room.changeType(!1,this.user)}reportDecodeResult(e,t){var i,r;let n=this.kind===BA;if(SO[e?"addSuccessEvent":"addFailedEvent"]({key:n?504700:514702}),!n){let t=(null==(i=this.room)?void 0:i.downlinkVideoCodec.toUpperCase())||"H264";SO[e?"addSuccessEvent":"addFailedEvent"]({key:IO["DECODE_".concat(t,"_RESULT")]}),e||this.log.warn("".concat(null==(r=this.room)?void 0:r.downlinkVideoCodec," decode failed"))}e||(SO.addEnum({key:n?504701:514703,value:oO()}),eN.uploadEvent({log:"stat-decode-failed-".concat(this.kind,"-").concat(rO()||sO()),userId:this.room.userId}),this._log.warn("decode failed: isPlaying: ".concat(this.player.isPlaying," ").concat(this.kind===BA?"audioLevel: ".concat(this.getAudioLevel()):"framesDecoded: ".concat(this.stat.framesDecoded>0))),this.emit("decode-failed",{error:t}))}updatePlayingState(e){if(this.player.isPlayCalled&&this.player.setTrack(this.playerMediaTrack),this.isPlayCalled&&this.player.isStopped===e){if(e&&(!this.isSubscribed||!this.isRemotePublished||!this.outMediaTrack))return void this.log.info("abort play, isSubscribed: ".concat(this.isSubscribed," isAvailable: ").concat(this.isRemotePublished," hasTrack: ").concat(!!this.outMediaTrack," "));super.updatePlayingState(e)}}close(){super.close(),this.outMediaTrack&&this.uninstallTrackEvent(this.outMediaTrack)}onFlagChanged(){this.remotePublishState.state=this.isRemotePublished?jL.ON:jL.OFF,this.emit("remote-publish-changed",this.isRemotePublished)}onTrackMuted(){this.isNeedPlay&&super.onTrackMuted()}onTrackUnmuted(){this.isNeedPlay&&super.onTrackUnmuted()}onTrackEnded(){this.isNeedPlay&&super.onTrackEnded()}};uA(CP,"STATE_SUBSCRIBE","subscribe"),dA([function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:30,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:2;return EA(((i,r)=>function(){for(var n=arguments.length,a=new Array(n),o=0;o<n;o++)a[o]=arguments[o];return new Promise(((n,o)=>{let s=setTimeout((()=>{let i=new FR({code:UR.API_CALL_TIMEOUT,message:"checkPendingPromise ".concat(r,"() timeout ").concat(e,"s")});(this.log||this._log||hO).warn(i),2===t?o(i):1===t&&n()}),1e3*e);this._checkPendingPromiseSet||(this._checkPendingPromiseSet=new Set),this._checkPendingPromiseSet.add(s),i.apply(this,a).then(n,o).finally((()=>{clearTimeout(s),this._checkPendingPromiseSet&&s&&this._checkPendingPromiseSet.delete(s)}))}))}))}(5,1)],CP.prototype,"waitHasMediaTrack",1),dA([FL(jL.INIT,CP.STATE_SUBSCRIBE,{success(){this.log.info("subscribed"),cO.emit(lO.REMOTE_TRACK_SUBSCRIBED,{track:this})},ignoreError:!0}),Ix(521716,!1)],CP.prototype,"subscribe",1),dA([FL(CP.STATE_SUBSCRIBE,jL.INIT,{sync:!0,success(){this.log.info("unsubscribed"),cO.emit(lO.REMOTE_TRACK_UNSUBSCRIBED,{track:this})}})],CP.prototype,"unsubscribe",1);var DP=CP,OP=class extends pP{constructor(e,t,i,r,n){super(e,{useDefaultProgram:!0,useFbo:!0,name:"alpha",create2d:!0,logger:t}),this.setContainer=r,uA(this,"initStat",{alphaStitchingType:1}),uA(this,"end",Hx()),uA(this,"minSize",320),uA(this,"maxSize",1280),uA(this,"draggable",!1),uA(this,"startDragX",0),uA(this,"startDragY",0),uA(this,"left",0),uA(this,"top",0),uA(this,"baseWidth",320),uA(this,"baseRatio"),uA(this,"container"),this.initStat=n,this.draggable=i,this.bindDragEvents(),SO.addEnum({key:515700,value:1}),this.draggable&&SO.addEnum({key:515700,value:11})}bindDragEvents(){let e=this.context._canvas;if(e)if(this.draggable){let t=qx(this.end);Lx(zx(e,"mousedown"),rP(this.startDrag.bind(this)),$x((()=>Lx(zx(window,"mousemove"),qx(zx(window,"mouseup"))))),t,iP(this.doDrag.bind(this))),Lx(zx(e,"dblclick"),t,iP(this.resetPosition.bind(this))),Lx(zx(e,"wheel"),t,iP(this.handleZoom.bind(this))),this.renderCanvas()}else{if(!this.container)return;this.container.style.removeProperty("left"),this.container.style.removeProperty("top"),this.end.next()}}render(e){var t;return!(null==(t=this.input)||!t.requestFrame(e))&&(this.useProgram(),this.useBufferFrame(),this.useInputTexture(),this.draw(),!0)}startDrag(e){e.preventDefault(),0===e.button&&(this.startDragX=e.clientX-this.left,this.startDragY=e.clientY-this.top)}renderCanvas(){let{container:e}=this;e||this.setContainer(),e&&this.baseRatio&&this.draggable&&(e.style.setProperty("width","".concat(this.baseWidth,"px")),e.style.setProperty("height","".concat(this.baseWidth/this.baseRatio,"px")),e.style.setProperty("position","fixed"),e.style.setProperty("left","".concat(this.left,"px")),e.style.setProperty("top","".concat(this.top,"px")))}doDrag(e){e.preventDefault(),this.left=e.clientX-this.startDragX,this.top=e.clientY-this.startDragY,this.renderCanvas()}handleZoom(e){e.preventDefault();let t=e.deltaY,i=this.context._canvas;i&&(this.baseWidth||(this.baseWidth=i.offsetWidth),this.baseWidth=t<0?Math.min(1.1*this.baseWidth,this.maxSize):Math.max(.9*this.baseWidth,this.minSize),this.renderCanvas())}resetPosition(){this.left=0,this.top=0,this.renderCanvas()}onRatioReset(){this.renderCanvas()}draw2d(e,t,i,r,n){var a;let{ctx2d:o}=this,s=this.context._canvas;if(!o||!s)return!1;let c=super.draw2d(e,t,i,r,n),l=o.getImageData(0,0,r,n),{data:d}=l,u=!1;if(1===this.initStat.alphaStitchingType){let e=Math.floor(r/2);for(let t=0;t<n;t++)for(let i=0;i<e;i++){let n=4*(t*r+i),a=4*(t*r+(i+e)),o=d[a];d[a+3]=0;let s=o>=100;d[n+3]=s?255:0}u=super.draw2d(l,0,0,0,0,e,n),s.width=e}else if(2===this.initStat.alphaStitchingType){let e=Math.floor(n/2);for(let t=0;t<e;t++)for(let i=0;i<r;i++){let n=4*(t*r+i),a=4*((t+e)*r+i),o=d[a];d[a+3]=0;let s=o>=100;d[n+3]=s?255:0}u=super.draw2d(l,0,0,0,0,r,e),s.height=e}return null==(a=this.context.ctx)||a.clearRect(0,0,r,n),c&&u}close(){this.baseRatio=void 0,this.end.next(),this.end.complete()}};var LP=class extends DP{constructor(e,t){super(e,t,arguments.length>2&&void 0!==arguments[2]?arguments[2]:4),uA(this,"mediaType",4),uA(this,"source"),uA(this,"shouldRenderAlpha",!1),uA(this,"alphaNode"),uA(this,"shouldBeDraggable",!0),uA(this,"stat",{bytesReceived:0,packetsReceived:0,packetsLost:0,framesReceived:0,framesDecoded:0,frameWidth:0,frameHeight:0,end2EndDelay:0,jitterBufferDelay:0}),this.manager=e.videoManager,this.on("first-video-frame",(e=>{this.room.emit("first-video-frame",e)}))}isAlphaSei(e){if(this.userId!==e.userId||50!==e.seiPayloadType)return!1;let t=new Uint8Array(e.data);return t.length%3==0&&0===t[0]&&1===t[1]&&t}play(e,t){return(Nk(null==t?void 0:t.canvasRender)?t.canvasRender:17===ZD)&&!this.source&&this.useCanvasPlayer(),super.play(e,t).then((()=>{this.player.calculateStat(),cO.emit("156",{track:this,player:this.player})}))}updateAlphaRenderInfo(e){let t=this.isAlphaSei(e);if(t)if(this.alphaNode){let e=t[2];if(this.alphaNode.baseRatio&&this.alphaNode.initStat.alphaStitchingType===e)return;this.alphaNode.initStat={alphaStitchingType:e};let i=this.player.getElement();if(i){let t=i.videoWidth/i.videoHeight;t&&(this.alphaNode.baseRatio=t*(1===e?.5:2),this.alphaNode.onRatioReset())}this.player.canvas&&(this.player.canvas.id=this.generateAlphaCanvasName(e))}else this.shouldRenderAlpha=!0,this.player.shouldRenderAlpha=!0,this.useCanvasPlayer(t[2])}generateAlphaCanvasName(e){let t=SA[e];return"".concat("alpha","_").concat(t,"_").concat(this.userId)}useCanvasPlayer(e){if(this.log.info("useCanvasPlayer(), has element:".concat(!!this.player.element)),!this.player.element)return;let t=new AP({frameRate:15,logger:this.log,name:this.shouldRenderAlpha&&e?this.generateAlphaCanvasName(e):this.userId});t.create({alpha:this.shouldRenderAlpha,willReadFrequently:this.shouldRenderAlpha});let i=new gP(t,{name:"remotePlayer",logger:this.log});if(this.source=t.createVideoPlayerSource(this.player),this.player.setCanvas(t._canvas),this.shouldRenderAlpha&&e){let r=()=>{!this.player.container||!this.alphaNode||(this.alphaNode.container=this.player.container,this.alphaNode.renderCanvas())},n=new OP(t,this.log,this.shouldBeDraggable,r,{alphaStitchingType:e});this.source.connect(n),n.connect(i),this.alphaNode=n}else this.source.connect(i);SL()||(this.updateCanvasPlayerFPS=this.updateCanvasPlayerFPS.bind(this,t),this.room.on("heartbeat-report",this.updateCanvasPlayerFPS,this))}updateCanvasPlayerFPS(e){let t=this.decodeFPS,i=function(e){return[15,30,45,60].reduce(((t,i)=>Math.abs(i-e)<Math.abs(t-e)?i:t))}(t);!Lk(t)||t<=0?this.log.debug("updateCanvasPlayerFPS() ignore decoder: ".concat(t," ")):i!==e.frameRate?(this.log.info("updateCanvasPlayerFPS() decoder: ".concat(t,", closest: ").concat(i,", current: ").concat(e.frameRate)),e.frameRate=i):this.log.debug("updateCanvasPlayerFPS() ignore ClosestFPS ".concat(i," == ").concat(e.frameRate))}get decodeFPS(){var e;let{msg_video_status:t}=(null==(e=this.room.heartbeatReport)?void 0:e.msg_down_stream_info.find((e=>e.msg_user_info.str_identifier===this.userId)))||{},i=2===this.mediaType?7:this.isSmall?3:2;if(!t||0===t.length)return 0;let r=t.find((e=>e.uint32_video_stream_type===i));return(null==r?void 0:r.uint32_video_dec_fps)||0}stop(){return this.room.off("heartbeat-report",this.updateCanvasPlayerFPS,this),cO.emit("157",{track:this,player:this.player}),this.alphaNode&&this.alphaNode.close(),super.stop()}decodeFrame(e){if(!this.manager)return e;for(let t of this.manager.decodePipeline)if(t&&!(e=t({frame:e,track:this})))return;return e}get isBig(){return 4===this.mediaType}get isSmall(){return 8===this.mediaType}changeType(e){this.room.changeType(e,this.user)}get isRemotePublished(){return this.user.muteState.videoAvailable}setMirror(e){"publish"===e||"both"===e||super.setMirror(e)}setDraggable(e){this.shouldBeDraggable=e,this.alphaNode&&(this.alphaNode.draggable=e,this.alphaNode.bindDragEvents())}onDecodeDowngradeStateChanged(e){this.emit("decode-downgrade-state-changed",e)}},NP=new Map;function xP(e,t){let i=aA(nA({},t),{timestamp:VR()});NP.has(e)?NP.get(e).push(i):NP.set(e,[i])}cO.on(lO.JOIN_SUCCESS,(e=>{let{room:t}=e;xP(t.userId,{eventId:32788})})),cO.on(lO.LEAVE_START,(e=>{let{room:t}=e;xP(t.userId,{eventId:32789})})),cO.on(lO.LOCAL_TRACK_PUBLISHED,(e=>{let{track:t}=e;if(t.room){let e=32769;4===t.mediaType?e=32768:2===t.mediaType&&(e=32805),xP(t.room.userId,{eventId:e})}})),cO.on(lO.LOCAL_TRACK_UNPUBLISHED,(e=>{let{track:t}=e;if(t.room){let e=32771;4===t.mediaType?e=32770:2===t.mediaType&&(e=32806),xP(t.room.userId,{eventId:e})}})),cO.on(lO.TRACK_MUTED,(e=>{let{track:t}=e;t.room&&(t.kind===BA?xP(t.room.userId,{eventId:t.isRemote?32785:32772,remoteUserId:t.isRemote?t.userId:void 0}):xP(t.room.userId,{eventId:t.isRemote?32784:32773,remoteUserId:t.isRemote?t.userId:void 0}))})),cO.on(lO.TRACK_UNMUTED,(e=>{let{track:t}=e;t.room&&(t.kind===BA?xP(t.room.userId,{eventId:t.isRemote?32787:32774,remoteUserId:t.isRemote?t.userId:void 0}):xP(t.room.userId,{eventId:t.isRemote?32786:32775,remoteUserId:t.isRemote?t.userId:void 0}))})),cO.on(lO.REMOTE_TRACK_SUBSCRIBED,(e=>{let{track:t}=e;t.room&&(1===t.mediaType&&xP(t.room.userId,{eventId:32777,remoteUserId:t.userId}),4===t.mediaType&&xP(t.room.userId,{eventId:32776,remoteUserId:t.userId}),8===t.mediaType&&xP(t.room.userId,{eventId:32803,remoteUserId:t.userId}))})),cO.on(lO.REMOTE_TRACK_UNSUBSCRIBED,(e=>{let{track:t}=e;t.room&&(1===t.mediaType&&xP(t.room.userId,{eventId:32779,remoteUserId:t.userId}),4===t.mediaType&&xP(t.room.userId,{eventId:32778,remoteUserId:t.userId}),8===t.mediaType&&xP(t.room.userId,{eventId:32804,remoteUserId:t.userId}))})),cO.on(lO.SWITCH_DEVICE_SUCCESS,(e=>{let{track:t}=e;t.room&&xP(t.room.userId,{eventId:t.kind===FA?32780:32781})})),cO.on(lO.LOCAL_TRACK_REPLACED,(e=>{let{track:t}=e;t.room&&xP(t.room.userId,{eventId:t.kind===FA?32782:32783})})),cO.on(lO.SIGNAL_CONNECTION_STATE_CHANGED,(e=>{let t,{room:i,prevState:r,state:n}=e;switch(n){case"CONNECTED":t="RECONNECTING"===r?32795:32791;break;case"DISCONNECTED":t="RECONNECTING"===r?32796:32790;break;case"RECONNECTING":t=32794}t&&xP(i.userId,{eventId:t})})),cO.on(lO.PEER_CONNECTION_STATE_CHANGED,(e=>{let t,{room:i,prevState:r,state:n,remoteUserId:a}=e,o=!!a;switch(n){case"CONNECTED":t="RECONNECTING"===r?o?32801:32798:o?32793:32792;break;case"DISCONNECTED":"RECONNECTING"===r&&(t=o?32802:32799);break;case"RECONNECTING":t=o?32800:32797}t&&xP(i.userId,{eventId:t,remoteUserId:a})})),cO.on(lO.VIDEO_CODEC_IMPLEMENTATION_CHANGED,(e=>{let{implementation:t,userId:i,remoteUserId:r,codec:n,isHWCodec:a,prevImplementation:o,streamType:s}=e,c=a?1:0;o||(c=a?3:2);let l={H264:0,H265:1,VP8:2}[n.toUpperCase()],d={eventId:4004,param1:c,param2:l,streamType:s||2};r&&(d.remoteUserId=r,d.eventId=4005),xP(i,d),SO.addEnum({key:r?514701:513701,value:c}),SO.addEnum({key:r?514700:513700,value:l})})),cO.on(lO.LOCAL_TRACK_RECAPTURE,(e=>{let{track:t,error:i}=e;if(t.userId){let e={eventId:2003,param1:0};t.kind===BA?(e.streamType=1,i&&(e.param1=2)):(e.streamType="auxiliary"===t.streamType?7:2,i&&(e.param1=8)),xP(t.userId,e)}})),lA(pA(),1);var PP="trtc_debug_dialog",MP="".concat(PP,"_activated"),UP="".concat(PP,"_switch"),BP="".concat(PP,"_mask"),FP="".concat(PP,"_panel"),VP="".concat(PP,"_tabber"),HP="".concat(PP,"_tab"),jP="".concat(PP,"_topbar"),zP="".concat(PP,"_toptab"),WP="".concat(PP,"_content"),GP="".concat(PP,"_has_topbar"),qP="".concat(WP,"_log"),KP="".concat(WP,"_network"),YP="".concat(PP,"_dump"),XP="".concat(KP,"_title"),ZP="".concat(KP,"_basic"),JP="".concat(KP,"_local"),QP="".concat(KP,"_remote"),$P="".concat(YP,"_title"),eM="".concat(YP,"_local"),tM="".concat(YP,"_remote"),iM="".concat(tM,"_hook"),rM="".concat(PP,"_banner"),nM="".concat(rM,"_item"),aM="".concat(PP,"_toolbar"),oM="".concat(PP,"_tool"),sM="".concat(PP,"_item"),cM="".concat(sM,"_debug"),lM="".concat(sM,"_info"),dM="".concat(sM,"_warn"),uM="".concat(sM,"_error"),hM="".concat(PP,"_back_top"),pM="".concat(PP,"_go_bottom"),fM="".concat(YP,"_local_audio"),mM="".concat(YP,"_local_video_main"),gM="".concat(YP,"_local_video_aux"),vM="".concat(PP,"_tooltip"),_M="".concat(ZP,"_network_info"),yM="".concat(ZP,"_room_info"),EM="".concat(qP,"_controller"),bM="success",wM="warning",IM="failed",TM=0,SM=class extends HTMLElement{constructor(){super(),this.attachShadow({mode:"open"}),this.addStyle(),this.addDialog()}addDialog(){var e;let t=document.createElement("template");t.innerHTML='<div id="'.concat(PP,'" class="').concat(PP,'"><div class="').concat(UP,'">Debug#').concat(++TM,'</div><div class="').concat(BP,'"></div><div class="').concat(FP,'"><div class="').concat(VP,'"><a class="').concat(HP," ").concat(MP,'" data-tab="log">').concat(uR,'</a><a class="').concat(HP,'" data-tab="network">').concat(hR,'</a><a class="').concat(HP,'" data-tab="dump">').concat(pR,'</a></div><div class="').concat(EM,'"><div data-type="back_top">').concat(wR,'</div><div data-type="go_bottom">').concat(bR,'</div><div data-type="clear_log">').concat(IR,'</div></div><div class="').concat(jP,'"><a class="').concat(zP," ").concat(MP,'" data-type="all">All</a><a class="').concat(zP,'" data-type="debug">Debug</a><a class="').concat(zP,'" data-type="info">Info</a><a class="').concat(zP,'" data-type="warn">Warn</a><a class="').concat(zP,'" data-type="error">Error</a></div><div class="').concat(WP," ").concat(GP,'"><div class="').concat(qP,'"></div><div class="').concat(KP,'"><div class="').concat(XP,'">').concat(RR,'</div><div class="').concat(ZP,'"><div class="').concat(yM,'"></div><div class="').concat(_M,'">').concat(AR,'</div></div><div class="').concat(XP,'">').concat(TR,'</div><div class="').concat(JP,'">').concat(AR,'</div><div class="').concat(XP,'">').concat(SR,'</div><div class="').concat(QP,'">').concat(AR,'</div></div><div class="').concat(YP,'"><div class="').concat($P,'">').concat(TR,'</div><div class="').concat(eM,'"><div id="').concat(fM,'"><span>').concat(DR," - ").concat(kR,'(s):</span><input type="number" min=0 value=0></input><button class="dump">').concat(fR,'</button><button class="dump-opus">').concat(mR,'</button><button class="end-dump" disabled>').concat(vR,'</button></div><div id="').concat(mM,'"><span>').concat(CR," - ").concat(kR,'(s):</span><input type="number" min=0 value=0></input><button class="dump">').concat(pR,'</button><button class="end-dump" disabled>').concat(vR,'</button></div><div id="').concat(gM,'"><span>').concat(OR," - ").concat(kR,'(s):</span><input type="number" min=0 value=0></input><button class="dump">').concat(pR,'</button><button class="end-dump" disabled>').concat(vR,'</button></div></div><div class="').concat($P,'">').concat(SR,'</div><div class="').concat(tM,'"><div class="').concat(iM,"\">userId:<input id=\"dump-remote-video-hook-userid\" value='*' />duration:<input id=\"dump-remote-video-hook-duration\" min='1' value='0' type='number' />mediaType:<select id=\"dump-remote-video-hook-mediaType\" value='main' ><option value='main' checked>Video</option><option value='sub'>Screen</option></select><button id=\"dump-remote-video-hook-button\">dump if video is available</button></div></div></div></div><div class=\"").concat(rM,'"></div><div class="').concat(aM,'"><a id="trtc_upload" class="').concat(oM,'">').concat(_R,'</a><a id="trtc_export" class="').concat(oM,'">').concat(yR,'</a><a id="trtc_hide" class="').concat(oM,'">').concat(ER,"</a></div></div></div>"),null==(e=this.shadowRoot)||e.appendChild(t.content.firstChild)}addStyle(){var e;let t=document.createElement("style");t.textContent="#".concat(PP,"{font-size:14px;--DD-BG-0:#ededed;--DD-BG-1:#f7f7f7;--DD-BG-2:#fff;--DD-BORDER:rgba(0,0,0,0.1);--DD-ERROR:red;--DD-WARN:#fa9d3b;--DD-INFO:#000;--DD-DEBUG:#10aeff;--DD-WARN-BG:#fff3cc;--DD-ERROR-BG:#ffe6e6;}#").concat(PP," a,.").concat(UP,"{cursor:pointer;}.").concat(PP,"{color:black;}.").concat(UP,"{display:block;position:fixed;right:50px;bottom:").concat(150+50*TM,"px;border-radius:5px;background-color:#07c160;color:#fff;padding:5px 10px;z-index:10000;}.").concat(BP,"{display:none;position:fixed;left:0;top:0;right:0;bottom:0;z-index:10001;background-color:rgb(0,0,0,0.6);}.").concat(FP,"{background-color:#ededed;display:none;position:fixed;min-height:85%;left:60%;right:0;bottom:0;z-index:10002;border:1px solid var(--DD-BG-0);}@media (max-width:768px) {.").concat(FP,"{left:0;}}.").concat(VP,"{display:flex;height:2em;border-bottom:1px solid var(--DD-BORDER);}.").concat(HP,"{padding:0 20px;border-right:1px solid rgba(0,0,0,0.1);line-height:2em;color:black;}.").concat(HP,".").concat(MP,"{background-color:var(--DD-BG-2);}.").concat(HP,".disabled{cursor:not-allowed;background-color:#ededed;color:#999;}.").concat(jP,"{height:2em;display:flex;flex-direction:row;}.").concat(zP,"{width:20%;text-align:center;line-height:2em;border-right:1px solid var(--DD-BORDER);border-bottom:1px solid var(--DD-BORDER);color:black;}.").concat(zP,".").concat(MP,"{border-bottom:1px solid #1485ee;background-color:var(--DD-BG-2);}.").concat(WP,"{background-color:#fff;position:absolute;left:0;right:0;top:2em;bottom:8em;overflow-y:scroll;overflow-x:hidden;}.").concat(WP,".").concat(GP,"{top:4em;bottom:10em}.").concat(KP,"{display:none;}.").concat(YP,"{display:none;}.").concat(XP,",.").concat($P,"{line-height:2em;text-align:center;background-color:var(--DD-BG-0);border-bottom:1px solid var(--DD-BORDER);}.").concat(ZP,",.").concat(JP,",.").concat(QP,"{text-align:center;border-bottom:1px solid var(--DD-BORDER);}.").concat(eM,",.").concat(tM,"{display:flex;flex-direction:column;padding:0.5em 0;justify-content:center;align-items:center;}.").concat(eM," div input{margin:0 10px;height:1.5em;width:4em;}.").concat(eM," div {padding:10px 0;border-radius:5px;}.").concat(eM," div button,.").concat(tM," div button {cursor:pointer;height:1.8em;border-radius:5px;margin-right:5px;}.").concat(eM," div button[disabled],.").concat(tM," div button[disabled]{cursor:not-allowed;}.").concat(tM," select {height:1.8em;margin:0 10px;}.").concat(tM," div input{margin:0 10px;height:1.5em;width:4em;}.").concat(iM," {line-height:3em;padding:0.5em;}.").concat(XP,"{text-align:center;background-color:var(--DD-BG-0);border-bottom:1px solid var(--DD-BORDER);}.").concat(ZP,",.").concat(JP,",.").concat(QP,"{text-align:center;border-bottom:1px solid var(--DD-BORDER);}.").concat(sM,"{border-bottom:1px solid var(--DD-BG-0);padding:5px 10px;overflow-wrap: break-word;}.").concat(uM,"{color:var(--DD-ERROR);background-color:var(--DD-ERROR-BG);}.").concat(dM,"{color:var(--DD-WARN);background-color:var(--DD-WARN-BG);}div .").concat(lM,"{color:var(--DD-INFO);}.").concat(cM,"{color:var(--DD-DEBUG);}.").concat(rM,"{position:absolute;left:0;right:0;bottom:2em;height:6em;border-bottom:1px solid var(--DD-BORDER);display:flex;flex-direction:column;overflow-y:scroll;background-color:var(--DD-BG-1);}.").concat(nM,"{border-bottom:1px solid var(--DD-BORDER);padding:5px 10px;overflow-wrap: break-word;}.").concat(aM,"{position:absolute;line-height:2em;display:flex;flex-direction:row;left:0;right:0;bottom:0;}.").concat(oM,"{flex:1;color:black;text-align:center;background-color:#ededed;border-right:1px solid var(--DD-BORDER);}#").concat(PP," .").concat(hM,",#").concat(PP," .").concat(pM,"{position:absolute;height:2em;width:6em;right:2em;border-radius:5px;background-color:rgba(30,136,229,0.8);z-index:10003;cursor:pointer;padding:0 5px;line-height:2em;color:white;text-align:center;}.").concat(pM,"{bottom:9em;}.").concat(hM,"{bottom:11.5em;}#").concat(PP," .").concat(oM,".disable{cursor:not-allowed;background-color:#ededed;color:#999;}.").concat(vM," {position:relative;display:inline-block;}.").concat(vM," .tooltiptext{visibility:hidden;width:180px;background-color:black;color:#fff;text-align:center;padding:5px 0;border-radius:6px;position:absolute;}.").concat(vM," .tooltip-top {bottom:125%;left:50%;margin-left:-90px;}.").concat(vM,":hover .tooltiptext{visibility:visible;}.").concat(EM,"{position:absolute;left:0;right:0;bottom:8em;height:2em;display:flex;align-items:center;}.").concat(EM," div{flex:1;cursor:pointer;border-right:1px solid var(--DD-BORDER);text-align: center;}"),null==(e=this.shadowRoot)||e.appendChild(t)}};customElements.define("trtc-basic-debug-dialog",SM);var AM=class{constructor(e,t){uA(this,"_dialogNode",null),uA(this,"_switchNode",null),uA(this,"_maskNode",null),uA(this,"_panelNode",null),uA(this,"_logContentNode",null),uA(this,"_networkContentNode",null),uA(this,"_dumpContentNode",null),uA(this,"_tabNodes",[]),uA(this,"_toptabNodes",[]),uA(this,"_hasMove",!1),uA(this,"_showDialog",!1),uA(this,"_isMobile",!1),uA(this,"_showLogType","all"),uA(this,"prevBytesSent",0),uA(this,"prevBytesReceived",0),uA(this,"_core"),uA(this,"_log"),uA(this,"_logList",[]),uA(this,"isUploading",!1),uA(this,"publishMap",new Map),uA(this,"dumpLocalVideoMap",{}),uA(this,"dumpRemoteVideoMap",{}),uA(this,"dumpLocalAudioMap",{}),uA(this,"dumpRemoteAudioMap",{}),uA(this,"eventMap",new Map),uA(this,"switchPos",{x:0,y:0,startX:0,startY:0,endX:0,endY:0,isTouchEnd:!1}),uA(this,"handleLeaveSuccess",(e=>{let{room:t}=e;var i,r;if(!this.hitTest(t))return;let n=null==(r=null==(i=this._dialogNode)?void 0:i.shadowRoot)?void 0:r.querySelector(".".concat(tM));for(let a of this.publishMap.values())null==n||n.removeChild(a);this.publishMap.clear()})),uA(this,"handleJoinSuccess",(e=>{let{room:t}=e;var i,r;if(!this.hitTest(t))return;(null==(r=null==(i=this._dialogNode)?void 0:i.shadowRoot)?void 0:r.querySelector(".".concat(yM))).innerHTML="sdkAppId: ".concat(t.sdkAppId,"<br/>roomId: ").concat(t.roomId,"<br/>userId: ").concat(t.userId,"<br/>")})),uA(this,"handleRemoteVideoAvailable",(e=>{let t="sub"===e.streamType?"auxiliary":"main";this.renderDumpTab(e.userId,"remote",t,"publish")})),uA(this,"handleRemoteVideoUnavailable",(e=>{let t="sub"===e.streamType?"auxiliary":"main";this.renderDumpTab(e.userId,"remote",t,"unpublish")})),uA(this,"handleRemoteAudioAvailable",(e=>{this.renderDumpTab(e.userId,"remote","audio","publish")})),uA(this,"handleRemoteAudioUnavailable",(e=>{this.renderDumpTab(e.userId,"remote","audio","unpublish")})),uA(this,"renderDumpTab",((e,t,i,r)=>{var n,a,o;let s={main:"video",auxiliary:"screen",audio:"audio"},c=(e,t)=>{var i,r,n;let a=document.createElement("div");a.innerText="".concat(e," - ").concat(s[t]," - ").concat(kR,"(s):");let o=document.createElement("input");o.type="number",o.min="0",o.value="10",o.id="dump_remote_".concat(t,"_").concat(e);let c,l=document.createElement("button");l.innerText=vR,l.disabled=!0,"audio"===t&&(c=document.createElement("button"),c.innerText=mR,c.style.marginLeft="5px");let d,u,h=document.createElement("button");if(h.innerText="audio"===t?fR:pR,h.onclick=()=>{let i,r,n=Number(o.value);if("audio"===t)({download:i,onDumpEnd:r}=this.dumpAudio("remote",n,e));else{if(!this.isSupportDumpVideo())return;({download:i,onDumpEnd:r}=this.dumpVideo(t,"remote",n,e))}i&&(this.inactiveButton(h,gR),c&&this.inactiveButton(c),n>0?setTimeout((()=>{null==i||i(),this.activeButton(h,pR),c&&this.activeButton(c,mR)}),1e3*n):(this.activeButton(l),l.onclick=()=>{l.onclick=null,null==i||i(),null==r||r(),this.activeButton(h,pR),c&&this.activeButton(c,mR),this.inactiveButton(l)}))},c&&(c.onclick=()=>{let t=Number(o.value),{download:i,onDumpEnd:r}=this.dumpAudioFromPipeline("remote",t,e);i&&(this.inactiveButton(c,gR),this.inactiveButton(h),t>0?setTimeout((()=>{null==i||i(),this.activeButton(c,mR),this.activeButton(h,pR)}),1e3*t):(this.activeButton(l),l.onclick=()=>{l.onclick=null,null==i||i(),null==r||r(),this.activeButton(c,mR),this.activeButton(h,pR),this.inactiveButton(l)}))}),"audio"!==t&&(d=document.createElement("button"),d.innerText="Dump w/ Audio",d.style.marginLeft="5px",d.onclick=()=>{if(!this.isSupportDumpVideo())return;let i=Number(o.value),r=this.dumpVideo(t,"remote",i,e),n=this.dumpAudioFromPipeline("remote",i,e);if(!r.download&&!n.download)return;let a=async()=>{var i,a,o,s;let c=new PR.default,l=this.dumpRemoteVideoMap["".concat(e,"-").concat(t)];if(l&&l.data.length>0){let i,r="h264",n=this.getVideoCodec(e);if("vp8"===n){let n=this._core.room.remotePublishedUserMap.get(e),a="main"===t?null==n?void 0:n.remoteVideoTrack:null==n?void 0:n.remoteAuxiliaryTrack;this.addInfoToBanner(wM,"package vp8 into ivf format"),i=this.convertVP8ToIVF(l.data,a),r="ivf"}else i=new Blob(l.data),r=n||"h264";let a="remote-".concat(e,"_").concat(t,"_").concat(this.formatStartDumpTime(l.startTimestamp),".").concat(r);c.file(a,i)}let d=this.dumpRemoteAudioMap["".concat(e)];if(d&&d.data.length>0){let t,r=(null==(a=null==(i=this._core.room.userManager)?void 0:i.getPublishedUser(e))?void 0:a.audioCodec)||"opus",n=r;"opus"===r?(this.addInfoToBanner(wM,"package opus to ogg"),t=this.convertOpusToOgg(d.data),n="ogg"):t=new Blob(d.data);let o="remote-".concat(e,"_audio_").concat(this.formatStartDumpTime(d.startTimestamp),".").concat(n);c.file(o,t)}let u=await c.generateAsync({type:"blob"}),h=URL.createObjectURL(u),p=document.createElement("a");p.href=h,p.download="dump_".concat(e,"_").concat(this.formatStartDumpTime(Date.now()),".zip"),p.style.display="none",document.body.appendChild(p),p.click(),URL.revokeObjectURL(h),document.body.removeChild(p),null==(o=r.onDumpEnd)||o.call(r),null==(s=n.onDumpEnd)||s.call(n),this.addInfoToBanner(bM,"Dump success, file name is: ".concat(p.download))};this.inactiveButton(d,gR),this.inactiveButton(h),i>0?setTimeout((()=>{a(),this.activeButton(d,"Dump w/ Audio"),this.activeButton(h,pR)}),1e3*i):(this.activeButton(l),l.onclick=()=>{l.onclick=null,a(),this.activeButton(d,"Dump w/ Audio"),this.activeButton(h,pR),this.inactiveButton(l)})}),"audio"!==t){u=document.createElement("button"),u.innerText="Preview",u.style.whiteSpace="Pre";let i=document.createElement("video");document.body.appendChild(i),i.id="".concat(PP,"_preview_remote_").concat(t,"_").concat(e),i.style.cssText="\n width: 320px;\n height: 240px;\n display: none;\n position: absolute;\n top: 50%;\n left: 50%;\n border: 3px solid #cccccc;\n transform: translate(-50%, -50%);\n z-index: 10004;\n ",u.onclick=async()=>{var r;if(i.style.display="none"===i.style.display?"":"none",u&&(u.innerText="none"===i.style.display?"Preview":" Hide "),!i.srcObject){let n=this._core.room.remotePublishedUserMap.get(e);if(n){let e=null==(r=n["main"===t?"remoteVideoTrack":"remoteAuxiliaryTrack"])?void 0:r.mediaTrack;e?(i.srcObject=new MediaStream([e]),await i.play()):this.addInfoToBanner(IM,"failed to preview, remote video track is not available")}}}}a.appendChild(o),a.appendChild(h),c&&a.appendChild(c),d&&a.appendChild(d),a.appendChild(l),u&&a.appendChild(u),a.style.cssText="padding:10px;";let p=document.createElement("div");return p.style.cssText="width:100%;display:flex;justify-content:center;border-top: 1px solid var(--DD-BORDER);",p.appendChild(a),null==(n=null==(r=null==(i=this._dialogNode)?void 0:i.shadowRoot)?void 0:r.querySelector(".".concat(tM)))||n.appendChild(p),p};if("remote"===t)if("publish"===r){let r=c(e,i);this.publishMap.set("".concat(e,"-").concat(t,"-").concat(i),r)}else{let r=this.publishMap.get("".concat(e,"-").concat(t,"-").concat(i));if(!r)return;null==(o=null==(a=null==(n=this._dialogNode)?void 0:n.shadowRoot)?void 0:a.querySelector(".".concat(tM)))||o.removeChild(r);let s=document.querySelector("#".concat(PP,"_preview_remote_").concat(i,"_").concat(e));s&&document.body.removeChild(s),this.publishMap.delete("".concat(e,"-").concat(t,"-").concat(i))}})),uA(this,"handleStatistics",(e=>{var t,i,r,n,a,o;let s=(e.bytesSent-this.prevBytesSent)/2,c=(e.bytesReceived-this.prevBytesReceived)/2;this.prevBytesSent=e.bytesSent,this.prevBytesReceived=e.bytesReceived,(null==(i=null==(t=this._dialogNode)?void 0:t.shadowRoot)?void 0:i.querySelector(".".concat(_M))).innerHTML="rtt: ".concat(e.rtt," ms upLoss: ").concat(e.upLoss,"% downLoss: ").concat(e.downLoss,"% <br>\n ↑ ").concat(s/1e3," KB/s (").concat(8*s/1e3," Kb/s) <br>\n ↓ ").concat(c/1e3," KB/s (").concat(8*c/1e3," Kb/s) <br>\n ");let l=null==(n=null==(r=this._dialogNode)?void 0:r.shadowRoot)?void 0:n.querySelector(".".concat(JP)),d="";e.localStatistics.audio.bitrate&&(d="<li>local audio: ".concat(e.localStatistics.audio.bitrate," Kb/s audioLevel: ").concat(e.localStatistics.audio.audioLevel.toFixed(5),"</li>")),e.localStatistics.video.length>0&&(d+="".concat(e.localStatistics.video.map((e=>"<li>local ".concat(e.videoType," video: ").concat(e.bitrate," Kb/s ").concat(e.width,"*").concat(e.height," ").concat(e.frameRate,"fps</li>"))).join(""))),l.innerHTML=""===d?"".concat(AR):d;let u=null==(o=null==(a=this._dialogNode)?void 0:a.shadowRoot)?void 0:o.querySelector(".".concat(QP)),h="";e.remoteStatistics.length>0&&e.remoteStatistics.forEach((e=>{let t="remote ".concat(e.userId,":");e.audio.bitrate>0&&(t+="<li>audio: ".concat(e.audio.bitrate," Kb/s audioLevel: ").concat(e.audio.audioLevel.toFixed(5),"</li>")),e.video.length>0&&e.video.forEach((e=>{t+="<li>".concat(e.videoType," video: ").concat(e.bitrate," Kb/s ").concat(e.width,"*").concat(e.height," ").concat(e.frameRate,"fps</li>")})),h+=t})),u.innerHTML=""===h?"".concat(AR):h})),uA(this,"pad",(e=>e<10?"0".concat(e):"".concat(e))),this._core=e,this._log=t,this.initCustomElements(),this.synchronizeLog(),this.installEvents(),this.addVideoProcessor(),this.addAudioProcessor(),window["__trtc_instance_".concat(TM,"__")]=this._core.trtc}initCustomElements(){this._isMobile=(()=>{let e=window.navigator&&window.navigator.userAgent||"",t=/iPad/i.test(e)||/iPhone/i.test(e),i=/Android/i.test(e);return t||i})();let e=document.createElement("trtc-basic-debug-dialog");document.body.appendChild(e);let t=e.shadowRoot;if(this._dialogNode=e,!t)return;this._switchNode=t.querySelector(".".concat(UP)),this._addEventListener(this._switchNode,"click",this.onSwitchClick.bind(this));let i=getComputedStyle(this._switchNode);this.switchPos.x=parseInt(i.right,10)||50,this.switchPos.y=parseInt(i.bottom,10)||100+50*TM,this._isMobile?(this._switchNode.ontouchstart=this.onTouchStart.bind(this),this._switchNode.ontouchend=this.onTouchEnd.bind(this),this._switchNode.ontouchmove=this.onTouchMove.bind(this)):this._switchNode.onmousedown=this.onMouseDown.bind(this),this._maskNode=t.querySelector(".".concat(BP)),this._addEventListener(this._maskNode,"click",this.onMaskClick.bind(this)),this._panelNode=t.querySelector(".".concat(FP)),t.querySelector(".".concat(EM)).childNodes.forEach((e=>{switch(e.getAttribute("data-type")){case"go_bottom":this._addEventListener(e,"click",this.onGoBottomClick.bind(this));break;case"back_top":this._addEventListener(e,"click",this.onBackTopClick.bind(this));break;case"clear_log":this._addEventListener(e,"click",this.onClearLogClick.bind(this))}})),this._logContentNode=t.querySelector(".".concat(qP)),this._networkContentNode=t.querySelector(".".concat(KP)),this._dumpContentNode=t.querySelector(".".concat(YP)),this._tabNodes=Array.from(t.querySelector(".".concat(VP)).children),this._tabNodes.forEach((e=>{this._addEventListener(e,"click",this.onTabClick.bind(this))})),this._toptabNodes=Array.from(t.querySelector(".".concat(jP)).children),this._toptabNodes.forEach((e=>{this._addEventListener(e,"click",this.onToptabClick.bind(this))}));let r=t.querySelector("#trtc_upload");this._addEventListener(r,"click",this.onUploadClick.bind(this));let n=t.querySelector("#trtc_export");this._addEventListener(n,"click",this.onExportClick.bind(this));let a=t.querySelector("#trtc_hide");this._addEventListener(a,"click",this.onHideClick.bind(this));let o=t.querySelector("#".concat(mM," .dump")),s=t.querySelector("#".concat(mM," .end-dump")),c=Number(t.querySelector("#".concat(mM," input")).value);this._addEventListener(o,"click",this.getDumpButtonClickHandler.bind(this,o,s,c,"main","local"));let l=t.querySelector("#".concat(gM," .dump")),d=t.querySelector("#".concat(gM," .end-dump")),u=Number(t.querySelector("#".concat(gM," input")).value);this._addEventListener(l,"click",this.getDumpButtonClickHandler.bind(this,l,d,u,"auxiliary","local"));let h=t.querySelector("#".concat(fM," .dump")),p=t.querySelector("#".concat(fM," .dump-opus")),f=t.querySelector("#".concat(fM," .end-dump"));this._addEventListener(h,"click",(()=>{let e=Number(t.querySelector("#".concat(fM," input")).value),{download:i,onDumpEnd:r}=this.dumpAudio("local",e);i?(this.inactiveButton(h,gR),this.inactiveButton(p),e>0?setTimeout((()=>{i(),this.activeButton(h,fR),this.activeButton(p,mR)}),1e3*e):(this.activeButton(f),f.onclick=()=>{f.onclick=null,i(),null==r||r(),this.activeButton(h,fR),this.activeButton(p,mR),this.inactiveButton(f)})):this.addInfoToBanner(IM,"Failed to dump, please check if the current user has started the audio")})),this._addEventListener(p,"click",(()=>{let e=Number(t.querySelector("#".concat(fM," input")).value),{download:i,onDumpEnd:r}=this.dumpAudioFromPipeline("local",e);i?(this.inactiveButton(p,gR),this.inactiveButton(h),e>0?setTimeout((()=>{i(),this.activeButton(p,mR),this.activeButton(h,fR)}),1e3*e):(this.activeButton(f),f.onclick=()=>{f.onclick=null,i(),null==r||r(),this.activeButton(p,mR),this.activeButton(h,fR),this.inactiveButton(f)})):this.addInfoToBanner(IM,"Failed to dump opus, please check if the current user has started the audio")}));let m=t.querySelector("#dump-remote-video-hook-userid"),g=t.querySelector("#dump-remote-video-hook-duration"),v=t.querySelector("#dump-remote-video-hook-mediaType"),_=t.querySelector("#dump-remote-video-hook-button");_.onclick=()=>{let e=Number(g.value);if(e<1)return void this.addInfoToBanner(IM,"duration at least 1s");let t=m.value;if(!t)return void this.addInfoToBanner(IM,"please input user id");"*"===t&&this.inactiveButton(_);let i,r,n=v.value,a="remote_".concat(t,"_").concat("sub"===n?"auxiliary":n),o=a=>{if((a.userId===t||"*"===t)&&a.streamType===n){if(this.addInfoToBanner(bM,"[".concat(a.userId,"_").concat(n,"] starting to dump video, duration: ").concat(e,"s")),({download:i,onDumpEnd:r}=this.dumpVideo("sub"===a.streamType?"auxiliary":a.streamType,"remote",e,a.userId)),!i)return;setTimeout((()=>{null==i||i(),null==r||r(),"*"!==t&&this._core.trtc.off(this._core.TRTC.EVENT.REMOTE_VIDEO_AVAILABLE,o)}),1e3*e)}};this._core.trtc.on(this._core.TRTC.EVENT.REMOTE_VIDEO_AVAILABLE,o),this.addInfoToBanner(bM,"[".concat(a,"] waiting to dump video from ").concat("*"===t?"all remote users":"user ".concat(t),", duration: ").concat(e,"s"))}}synchronizeLog(){this._core.loggerManager.getQueue().forEach((e=>{this.updateLog(e)}))}isSupportDumpVideo(){return!(!this._core.rtcDectection.IS_INSERTABLE_STREAM_SUPPORTED&&!this._core.rtcDectection.IS_SCRIPT_TRANSFORM_SUPPORTED)||(this.addInfoToBanner(IM,"Current browser does not support dumping video"),!1)}_addEventListener(e,t,i,r){e&&(e.addEventListener(t,i,r),this.eventMap.set(e,{type:t,listener:i}))}_removeEventListener(){this.eventMap.forEach(((e,t)=>{let{type:i,listener:r}=e;t&&t.removeEventListener(i,r)})),this.eventMap.clear(),this._switchNode&&(this._switchNode.onmousedown=null,this._switchNode.ontouchmove=null,this._switchNode.ontouchstart=null,this._switchNode.ontouchend=null)}closeDialog(){this.uninstallEvents(),this._removeEventListener(),this.removeVideoProcessor(),this.removeAudioProcessor(),this._dialogNode&&(document.body.removeChild(this._dialogNode),this._dialogNode=null)}updateLog(e){var t;this._logList.push(e);let i=document.createElement("div");switch(i.classList.add(sM),e.level){case 4:i.classList.add(uM);break;case 2:i.classList.add(lM);break;case 3:i.classList.add(dM);break;case 1:i.classList.add(cM)}i.textContent=e.log,"all"!==this._showLogType&&!i.classList.contains("".concat(sM,"_").concat(this._showLogType))&&(i.style.display="none"),null==(t=this._logContentNode)||t.appendChild(i),this.addHelper(i)}getDumpButtonClickHandler(e,t,i,r,n){if(!this.isSupportDumpVideo())return;let{download:a,onDumpEnd:o}=this.dumpVideo(r,n,i);if(a)return this.addInfoToBanner(bM,"[".concat(n,"_").concat(r,"] starting to dump...")),this.inactiveButton(e,gR),void(i>0?setTimeout((()=>{a(),this.activeButton(e,pR)}),1e3*i):(this.activeButton(t),t.onclick=()=>{t.onclick=null,null==o||o(),a(),this.activeButton(e,pR),this.inactiveButton(t)}));this.addInfoToBanner(bM,"[".concat(n,"_").concat(r,"] waiting to dump..."));let s=a=>{let{track:o}=a;if(o.room===this._core.room&&o.streamType===r){this.addInfoToBanner(bM,"[".concat(n,"_").concat(r,"] starting to dump")),"local"===n&&this._core.innerEmitter.off("104",s);let{download:a,onDumpEnd:o}=this.dumpVideo(r,n,i);if(!a)return;i>0?setTimeout((()=>{a(),this.activeButton(e,pR)}),1e3*i):(this.activeButton(t),t.onclick=()=>{t.onclick=null,null==o||o(),a(),this.activeButton(e,pR),this.inactiveButton(t)})}};s.bind(this),"local"===n&&this._core.innerEmitter.on("104",s),this.inactiveButton(e,gR)}onSwitchClick(){this._hasMove?this._hasMove=!1:this._showDialog?this.hideDialog():(this._isMobile&&(this._maskNode.style.display="block"),this._panelNode.style.display="block",this._switchNode.style.display="none",this._showDialog=!0,this.logContentGoBottom())}onTabClick(e){var t,i,r,n,a,o,s;let c=e.target;null==(t=this._tabNodes)||t.forEach((e=>{e.classList.remove(MP)})),c.classList.add(MP);let l=c.getAttribute("data-tab");"log"===l?(null==(n=null==(r=null==(i=this._dialogNode)?void 0:i.shadowRoot)?void 0:r.querySelector(".".concat(WP)))||n.classList.add(GP),this._logContentNode.style.display="block",this._networkContentNode.style.display="none",this._dumpContentNode.style.display="none",this.logContentGoBottom()):(null==(s=null==(o=null==(a=this._dialogNode)?void 0:a.shadowRoot)?void 0:o.querySelector(".".concat(WP)))||s.classList.remove(GP),"network"===l?(this._networkContentNode.style.display="block",this._logContentNode.style.display="none",this._dumpContentNode.style.display="none"):"dump"===l&&(this._dumpContentNode.style.display="block",this._networkContentNode.style.display="none",this._logContentNode.style.display="none"))}onToptabClick(e){var t,i;let r=e.target;null==(t=this._toptabNodes)||t.forEach((e=>{e.classList.remove(MP)})),r.classList.add(MP),this._showLogType=r.getAttribute("data-type");let n=null==(i=this._logContentNode)?void 0:i.querySelectorAll(".".concat(sM)),a="".concat(sM,"_").concat(this._showLogType);n.forEach((e=>{e.classList.contains(a)||"all"===this._showLogType?e.style.display="block":e.style.display="none"})),this.logContentGoBottom()}onExportClick(){let e=this._logList.reduce(((e,t)=>"".concat(e+t.log,"\n")),""),t=new Blob([e],{type:"text/plain"}),i=document.createElement("a"),r=URL.createObjectURL(t);i.href=r;let n="trtc_".concat(void 0===this._core.room.sdkAppId?"EmptySdkAppId":this._core.room.sdkAppId,"_").concat(void 0===this._core.room.userId?"EmptyUserId":this._core.room.userId,"_").concat(this.formatStartDumpTime(+new Date),".log");i.download=n,i.style.display="none",document.body.appendChild(i),i.click(),URL.revokeObjectURL(r),document.body.removeChild(i),this.addInfoToBanner(bM,"Export success: The log file name is ".concat(n)),this._core.kvStatManager.addSuccessEvent({key:592703})}addInfoToBanner(e,t){var i,r;let n=null==(r=null==(i=this._dialogNode)?void 0:i.shadowRoot)?void 0:r.querySelector(".".concat(rM)),a=document.createElement("div");a.classList.add(nM);let o=e===bM?"🟩":e===wM?"🟧":"🟥";a.innerText="".concat(o," [").concat(this.getCurrentTime(),"] ").concat(t),n.appendChild(a),n.scrollTop=n.scrollHeight}async onUploadClick(){var e,t;if(this.isUploading)return;this.isUploading=!0;let i=null==(t=null==(e=this._dialogNode)?void 0:e.shadowRoot)?void 0:t.querySelector("#trtc_upload");i.innerText="Uploading...",null==i||i.classList.add(".disable");let r=this._logList.reduce(((e,t)=>"".concat(e+t.log,"\n")),""),n=new Blob([r],{type:"text/plain"}),a=new FormData;a.append("file",n,"trtc.log"),a.append("sdkAppId","".concat(this._core.room.sdkAppId||"EmptySdkAppId")),a.append("userId","".concat(this._core.room.userId||"EmptyUserId")),fetch("https://service.trtc.qcloud.com/api/uploadLogFile",{method:"POST",body:a}).then((e=>e.json())).then((e=>{this.addInfoToBanner(e.type,e.message_en||"Upload Failed: Please use local export"),this.isUploading=!1,this._log.info(e.message_en),this._core.kvStatManager.addSuccessEvent({key:592704})})).catch((()=>{this.addInfoToBanner(IM,"Upload Failed: Please use local export"),this._log.info("Upload Failed: Please use local export"),this._core.kvStatManager.addFailedEvent({key:592704})})).finally((()=>{i.innerText=_R,null==i||i.classList.remove(".disable"),this.isUploading=!1}))}onHideClick(){this.hideDialog()}onMaskClick(){this.hideDialog()}hideDialog(){this._isMobile&&(this._maskNode.style.display="none"),this._panelNode.style.display="none",this._switchNode.style.display="block",this._showDialog=!1}onBackTopClick(){var e,t,i;null==(i=null==(t=null==(e=this._dialogNode)?void 0:e.shadowRoot)?void 0:t.querySelector(".".concat(WP)))||i.scrollTo(0,0)}onGoBottomClick(){this.logContentGoBottom()}onClearLogClick(){this._logList=[],this._logContentNode&&(this._logContentNode.innerHTML="")}logContentGoBottom(){var e,t;let i=null==(t=null==(e=this._dialogNode)?void 0:e.shadowRoot)?void 0:t.querySelector(".".concat(WP));null==i||i.scrollTo(0,null==i?void 0:i.scrollHeight)}onMouseDown(e){e.preventDefault(),this.switchPos.startX=e.pageX,this.switchPos.startY=e.pageY,document.onmousemove=this.onMouseMove.bind(this),document.onmouseup=this.onMouseUp.bind(this)}onMouseMove(e){e.cancelable&&e.preventDefault(),this._hasMove=!0;let t=this.switchPos.x-(e.pageX-this.switchPos.startX),i=this.switchPos.y-(e.pageY-this.switchPos.startY);[t,i]=this.getSafeAreaXY(t,i),this._switchNode.style.right="".concat(t,"px"),this._switchNode.style.bottom="".concat(i,"px"),this.switchPos.endX=t,this.switchPos.endY=i}onMouseUp(){this.switchPos.startX=0,this.switchPos.startY=0,this.switchPos.x=this.switchPos.endX,this.switchPos.y=this.switchPos.endY,document.onmousemove=null,document.onmouseup=null}onTouchStart(e){this.switchPos.startX=e.touches[0].pageX,this.switchPos.startY=e.touches[0].pageY,this.switchPos.isTouchEnd=!1}onTouchEnd(){this.switchPos.isTouchEnd&&(this.switchPos.startX=0,this.switchPos.startY=0,this.switchPos.isTouchEnd=!1,this.switchPos.x=this.switchPos.endX,this.switchPos.y=this.switchPos.endY)}onTouchMove(e){if(e.touches.length<=0)return;let t=e.touches[0].pageX-this.switchPos.startX,i=e.touches[0].pageY-this.switchPos.startY,r=Math.floor(this.switchPos.x-t),n=Math.floor(this.switchPos.y-i);[r,n]=this.getSafeAreaXY(r,n),this._switchNode.style.right="".concat(r,"px"),this._switchNode.style.bottom="".concat(n,"px"),this.switchPos.endX=r,this.switchPos.endY=n,this.switchPos.isTouchEnd=!0,e.cancelable&&e.preventDefault()}getSafeAreaXY(e,t){let i=Math.max(document.documentElement.offsetWidth,window.innerWidth),r=Math.max(document.documentElement.offsetHeight,window.innerHeight);return e+this._switchNode.offsetWidth>i&&(e=i-this._switchNode.offsetWidth),t+this._switchNode.offsetHeight>r&&(t=r-this._switchNode.offsetHeight),e<0&&(e=0),t<20&&(t=20),[e,t]}hitTest(e){return e===this._core.room}installEvents(){this._core.innerEmitter.on("264",this.handleLog,this),this._core.innerEmitter.on("53",this.handleLeaveSuccess,this),this._core.innerEmitter.on("27",this.handleJoinSuccess,this),this._core.trtc.on(this._core.TRTC.EVENT.STATISTICS,this.handleStatistics,this),this._core.trtc.on(this._core.TRTC.EVENT.REMOTE_AUDIO_AVAILABLE,this.handleRemoteAudioAvailable),this._core.trtc.on(this._core.TRTC.EVENT.REMOTE_AUDIO_UNAVAILABLE,this.handleRemoteAudioUnavailable),this._core.trtc.on(this._core.TRTC.EVENT.REMOTE_VIDEO_AVAILABLE,this.handleRemoteVideoAvailable),this._core.trtc.on(this._core.TRTC.EVENT.REMOTE_VIDEO_UNAVAILABLE,this.handleRemoteVideoUnavailable),this._core.room.on("dump",this.handleDumpFromScriptTransform,this)}uninstallEvents(){this._core.innerEmitter.off("264",this.handleLog,this),this._core.innerEmitter.off("53",this.handleLeaveSuccess,this),this._core.innerEmitter.off("27",this.handleJoinSuccess,this),this._core.trtc.off(this._core.TRTC.EVENT.STATISTICS,this.handleStatistics,this),this._core.trtc.off(this._core.TRTC.EVENT.REMOTE_AUDIO_AVAILABLE,this.handleRemoteAudioAvailable),this._core.trtc.off(this._core.TRTC.EVENT.REMOTE_AUDIO_UNAVAILABLE,this.handleRemoteAudioUnavailable),this._core.trtc.off(this._core.TRTC.EVENT.REMOTE_VIDEO_AVAILABLE,this.handleRemoteVideoAvailable),this._core.trtc.off(this._core.TRTC.EVENT.REMOTE_VIDEO_UNAVAILABLE,this.handleRemoteVideoUnavailable),this._core.room.off("dump",this.handleDumpFromScriptTransform,this)}handleDumpFromScriptTransform(e){if(!e.isAudio)if(e.userId){let t=this.dumpRemoteVideoMap["".concat(e.userId,"-").concat(e.streamType)];t&&(t.data.push(e.data),t.duration>0&&Date.now()-t.startTimestamp>1e3*t.duration&&t.onDumpEnd())}else{let t="main"===e.streamType?"main":"sub",i=this.dumpLocalVideoMap[t];i&&(i.data.push(e.data),i.duration>0&&Date.now()-i.startTimestamp>1e3*i.duration&&i.onDumpEnd())}}inactiveButton(e,t){e.disabled=!0,t&&(e.innerText=t)}activeButton(e,t){e.disabled=!1,t&&(e.innerText=t)}handleLog(e){this.updateLog(e.log)}addHelper(e){let t=/((2(5[0-5]|[0-4]\d))|[0-1]?\d{1,2})(\.((2(5[0-5]|[0-4]\d))|[0-1]?\d{1,2})){3}/g,i=xR,r=e.innerText;r=r.split("\n").map((e=>{if((e=e.replace(/</g,"&lt;").replace(/>/g,"&gt;")).includes("failed"))return e.includes("on autoplay-failed")?e:"<span class='red' style=\"background:red; color:#fff;\">".concat(e,"</span>");if(e.includes("clientIp:")){let i=e.match(t);return null==i||i.forEach((t=>{e=e.replace(t,'<a href="javascript:void(0);" target=""><span class=\'ip\' style="background:#e1dfdf">'.concat(t,"</span></a>"))})),e}return e.includes("URL of current page")&&(e=e.replace(/URL of current page: (.+)/,'URL of current page: <a href="$1">$1</a>')),e})).join("\n"),i.forEach((t=>{if(e.innerText.includes(t)){let i="";i="function"==typeof LR[t].tips?LR[t].tips(e.innerText):LR[t].tips,r=r.replace(new RegExp("".concat((e=>e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d").replace(">","&gt;").replace(">","&lt;"))(t)),"gi"),'<span class="'.concat(vM,'" style="background:').concat(LR[t].color||"#e1dfdf","; color: ").concat(LR[t].textColor||"#000",'">').concat(t,'\n <span class="tooltiptext tooltip-top">').concat(i,"</span>\n </span>"))}})),e.innerHTML=r}getCurrentTime(){let e=new Date,t=this.pad(e.getHours()),i=this.pad(e.getMinutes()),r=this.pad(e.getSeconds());return"".concat(t,":").concat(i,":").concat(r)}dumpAudioFromPipeline(e,t,i){this.addInfoToBanner(wM,"dump audio from pipeline");let r=Date.now(),n=this.formatStartDumpTime(r),a=[],o="".concat(e,"_").concat(i);if("local"===e)this._core.trtc._localAudioTrack;else if(i){let e=this._core.room.remotePublishedUserMap.get(i);e&&e.remoteAudioTrack}let s;if("local"===e){if(!this.hasLocalTrack("main","audio"))return{};s=()=>{delete this.dumpLocalAudioMap.main},this.dumpLocalAudioMap.main={startTimestamp:r,data:a,duration:t,onDumpEnd:s}}if("remote"===e&&i){if(s=()=>{delete this.dumpRemoteAudioMap["".concat(i)]},this.dumpRemoteAudioMap["".concat(i)])return this.addInfoToBanner(wM,"[".concat(o,"] dump already exists.")),{};this.dumpRemoteAudioMap["".concat(i)]={startTimestamp:r,data:a,duration:t,onDumpEnd:s}}return{download:()=>{var t,r;if(0===a.length)return void this.addInfoToBanner(IM,"[".concat(o,"] dump failed. Reason: data is empty"));let s,c=("local"===e?null==(t=this._core.room.singlePC)?void 0:t.audioCodec:null==(r=this._core.room.userManager)?void 0:r.getPublishedUser(i).audioCodec)||"opus",l=c;"opus"===c?(this.addInfoToBanner(wM,"[".concat(o,"] package opus to ogg")),s=this.convertOpusToOgg(a),l="ogg"):s=new Blob(a);let d=URL.createObjectURL(s),u=document.createElement("a"),h="local"===e?"local_".concat(n,".").concat(l):"remote-".concat(i,"_").concat(n,".").concat(l);u.href=d,u.download=h,u.style.display="none",document.body.appendChild(u),u.click(),URL.revokeObjectURL(d),u.remove(),this.addInfoToBanner(bM,"[".concat(o,"] dump success. File name is: ").concat(h))},onDumpEnd:s}}dumpVideo(e,t,i,r){let n,a=Date.now(),o=this.formatStartDumpTime(a),s=[],c="".concat(t,"_").concat(r,"_").concat(e);if("local"===t)n="main"===e?this._core.trtc._localVideoTrack:this._core.trtc._localScreenTrack;else if(r){let t=this._core.room.remotePublishedUserMap.get(r);t&&(n="main"===e?t.remoteVideoTrack:t.remoteAuxiliaryTrack)}let l;if("local"===t){if(!this.hasLocalTrack(e,"video"))return{};l=()=>{delete this.dumpLocalVideoMap["auxiliary"===e?"sub":"main"]},this.dumpLocalVideoMap["auxiliary"===e?"sub":"main"]={startTimestamp:a,data:s,duration:i,onDumpEnd:l}}if("remote"===t&&r){if(l=()=>{delete this.dumpRemoteVideoMap["".concat(r,"-").concat(e)]},this.dumpRemoteVideoMap["".concat(r,"-").concat(e)])return this.addInfoToBanner(wM,"[".concat(c,"] dump already exists.")),{};this.dumpRemoteVideoMap["".concat(r,"-").concat(e)]={startTimestamp:a,data:s,duration:i,onDumpEnd:l}}return{download:()=>{var i,a;if(0===s.length)return void this.addInfoToBanner(IM,"[".concat(c,"] dump failed. Reason: data is empty"));let l,d;"main"===e?l="video":"auxiliary"===e&&(l="screen"),"vp8"===this.getVideoCodec(r||"")?(this.addInfoToBanner(wM,"[".concat(c,"] package vp8 into ivf format")),d=this.convertVP8ToIVF(s,n)):d=new Blob(s);let u=URL.createObjectURL(d),h=document.createElement("a"),p="local"===t?"local_".concat(l,"_").concat(o,".").concat((null==(i=this._core.room.singlePC)?void 0:i.videoCodec)||"h264"):"remote-".concat(r,"_").concat(l,"_").concat(o,".").concat((null==(a=this._core.room.userManager)?void 0:a.getPublishedUser(r).videoCodec)||"h264");h.href=u,h.download=p,h.style.display="none",document.body.appendChild(h),h.click(),URL.revokeObjectURL(u),h.remove(),this.addInfoToBanner(bM,"[".concat(c,"] dump success. File name is: ").concat(p))},onDumpEnd:l}}convertVP8ToIVF(e,t){var i,r,n;function a(e,t,i){for(let r=0;r<i.length;r++)e.setUint8(t+r,i.charCodeAt(r))}let o=e.reduce(((e,t)=>e+12+t.byteLength),32),s=new ArrayBuffer(o),c=new DataView(s),l=new Uint8Array(s),d=0;a(c,d,"DKIF"),d+=4,c.setUint16(d,0,!0),d+=2,c.setUint16(d,32,!0),d+=2,a(c,d,"VP80"),d+=4,c.setUint16(d,(null==(i=null==t?void 0:t._inputTrack)?void 0:i.getSettings().width)||0,!0),d+=2,c.setUint16(d,(null==(r=null==t?void 0:t._inputTrack)?void 0:r.getSettings().height)||0,!0),d+=2;let u=(t instanceof LP?null==t?void 0:t.decodeFPS:null==(n=null==t?void 0:t.mediaTrack)?void 0:n.getSettings().frameRate)||15;return c.setUint32(d,u,!0),d+=4,c.setUint32(d,1,!0),d+=4,c.setUint32(d,e.length,!0),d+=4,c.setUint32(d,0,!0),d+=4,e.forEach(((e,t)=>{let i=e.byteLength,r=Math.floor(1e6*t/u);c.setUint32(d,i,!0),d+=4,c.setFloat64(d,r,!0),d+=8,l.set(new Uint8Array(e),d),d+=i})),new Blob([s],{type:"application/octet-stream"})}getVideoCodec(e){var t,i;return""===e?null==(t=this._core.room.singlePC)?void 0:t.videoCodec:null==(i=this._core.room.remotePublishedUserMap.get(e))?void 0:i.videoCodec}hasLocalTrack(e,t){for(let i of this._core.room.localTracks)if(i.streamType===e&&i.kind===t)return!0;return!1}dumpAudio(e,t,i){var r,n,a;let o,s,c=null,l=[],d=[],u=[],h=[],p=[],f=[],m=[],g=new AbortController,v=Date.now(),_=this.formatStartDumpTime(v),y=this._core.room.audioManager._localAudioPipline,E=this._core.room.audioManager._localScreenAudioPipeline,b=e=>{let{room:t,data:i,type:r}=e;if(this.hitTest(t)){if("dump"===r){if(h[0]=h[0]?h[0].concat(i.captureInput):i.captureInput,h[1]=h[1]?h[1].concat(i.playInput):i.playInput,o){let e=i.startTime-o,t=i.endTime-i.startTime;if(e>30||t>30){let r=function(e){if("number"!=typeof e||e<0)return"0毫秒";let t=[],i=Math.floor(e/6e4),r=e%6e4;i>0&&t.push("".concat(i,"分"));let n=Math.floor(r/1e3);return r%=1e3,(n>0||t.length)&&t.push("".concat(n,"秒")),(r>0||!t.length)&&t.push("".concat(r,"毫秒")),t.join("")},n=i.startTime-s,a=o-s;m.push("".concat(i.startTime,"\t").concat(r(n),"~").concat(r(a),"\t").concat(e,"\t").concat(t))}o=i.startTime}else o=i.startTime,s=i.startTime;f.push(i.startTime)}"dump-screen-audio"===r&&(p[0]=p[0]?p[0].concat(i.captureInput):i.captureInput,p[1]=p[1]?p[1].concat(i.playInput):i.playInput)}};if("local"===e){let{sampleRate:e}=this._core.room.audioManager.audioContext;if(!this._core.room.audioManager.hasAudioTrack&&!this._core.room.audioManager.hasScreenAudioTrack)return{};if(null!=y&&y.source.node&&(l.push(y.source.node),d.push("local_audio_raw_capture-".concat(e,"-").concat(y.source.node.channelCount))),(null!=(r=null==y?void 0:y.aec)&&r.node||null!=E&&E.aec.node)&&(this._core.trtc.updatePlugin("AudioProcessor",{enableDump:!0}),this._core.innerEmitter.on("265",b),null!=(n=null==y?void 0:y.aec)&&n.node&&(l.push(y.aec.node),d.push("local_audio_audioProcessor_processed-".concat(e,"-").concat(y.aec.node.channelCount))),null!=E&&E.aec.node&&(l.push(E.aec.node),d.push("screen_audio_audioProcessor_processed-".concat(e,"-").concat(E.aec.node.channelCount)))),null!=y&&y.denoiser.node&&(l.push(y.denoiser.node),d.push("local_audio_denoiser_processed-".concat(e,"-").concat(y.denoiser.node.channelCount))),this._core.room.audioManager.mixWeight>1&&null!=y&&y.stream){let t=this._core.room.audioManager.audioContext.createMediaStreamSource(y.stream);t.channelCount=1,l.push(t),d.push("local_audio_destination-".concat(e,"-").concat(t.channelCount))}}else if("remote"===e&&void 0!==i){let e=null==(a=this._core.room.remotePublishedUserMap.get(i))?void 0:a.remoteAudioTrack;if(null==e||!e.mediaTrack)return{};let t=this._core.createAudioNode(e.mediaTrack);l.push(t),d.push("remote_".concat(i))}let w=async()=>{var t,i,r,n,a;let o=new PR.default;for(let e=0;e<d.length;e++)o.file("".concat(d[e],".pcm"),new Blob(u[e]));if(null!=(t=null==h?void 0:h[0])&&t.length&&o.file("audioProcessor_input_capture.pcm",new Blob(h[0])),null!=(i=null==h?void 0:h[1])&&i.length&&o.file("audioProcessor_input_playback.pcm",new Blob(h[1])),null!=(r=null==p?void 0:p[0])&&r.length&&o.file("audioProcessor_screen_audio_input_capture.pcm",new Blob(p[0])),null!=(n=null==p?void 0:p[1])&&n.length&&o.file("audioProcessor_screen_audio_input_playback.pcm",new Blob(p[1])),null!=f&&f.length){let e=f.reduce(((e,t)=>"".concat(e,"\n").concat(t)));o.file("audioProcessor_handle_timestamp.txt",new Blob([e]))}if(null!=m&&m.length){let e=m.reduce(((e,t)=>"".concat(e,"\n").concat(t)));o.file("audioProcessor_big_gap_data.txt",new Blob([e]))}let s=await o.generateAsync({type:"blob"}),l=URL.createObjectURL(s),v=document.createElement("a");v.href=l,v.download="".concat(e,"-audio-").concat(_,".zip"),v.style.display="none",document.body.appendChild(v),v.click(),URL.revokeObjectURL(l),v.remove(),this.addInfoToBanner(bM,"Dump success, file name is: ".concat(e,"-").concat(_,".zip")),this._core.innerEmitter.off("265",b),(null!=(a=null==y?void 0:y.aec)&&a.node||null!=E&&E.aec.node)&&this._core.trtc.updatePlugin("AudioProcessor",{enableDump:!1}),c&&clearTimeout(c),g.abort("download")};return t>0&&(c=Number(setTimeout((()=>{g.abort("timeout")}),1e3*t))),l.length>0&&this._core.startGetPCM(l).then((e=>e.pipeTo(new WritableStream({write(e){e.forEach(((e,t)=>{u[t]=u[t]?u[t].concat(e[0]):[e[0]]}))}}),g).catch((()=>w)))),{download:w,onDumpEnd:()=>{g.abort("timeout")}}}formatStartDumpTime(e){let t=new Date(e),i=t.getFullYear(),r=this.pad(t.getMonth()+1),n=this.pad(t.getDate()),a=this.pad(t.getHours()),o=this.pad(t.getMinutes()),s=this.pad(t.getSeconds()),c=-t.getTimezoneOffset(),l=Math.floor(Math.abs(c)/60),d=Math.abs(c)%60,u=c>=0?"+":"-";return"".concat(i,"-").concat(r,"-").concat(n,"T").concat(a,"-").concat(o,"-").concat(s).concat(u).concat(this.pad(l),"-").concat(this.pad(d))}convertOpusToOgg(e){let t=Math.floor(4294967295*Math.random()),i=0,r=0,n=[],a=this.createOpusHead(48e3,2);n.push(this.createOggPage(2,0,t,i++,[a]));let o=this.createOpusTags();n.push(this.createOggPage(0,0,t,i++,[o]));let s=[],c=0;return e.forEach(((a,o)=>{let l=this.getOpusPacketDuration(a);s.push(a),c+=a.byteLength,r+=l;let d=o===e.length-1;if(c>6e4||s.length>=50||d){let e=d?4:0;n.push(this.createOggPage(e,r,t,i++,s)),s=[],c=0}})),new Blob(n,{type:"audio/ogg"})}createOpusHead(e,t){let i=new ArrayBuffer(19),r=new DataView(i);return this.writeString(r,0,"OpusHead"),r.setUint8(8,1),r.setUint8(9,t),r.setUint16(10,0,!0),r.setUint32(12,e,!0),r.setUint16(16,0,!0),r.setUint8(18,0),i}createOpusTags(){let e="TRTC Debugger",t=new ArrayBuffer(29),i=new DataView(t);return this.writeString(i,0,"OpusTags"),i.setUint32(8,13,!0),this.writeString(i,12,e),i.setUint32(25,0,!0),t}createOggPage(e,t,i,r,n){let a=0;n.forEach((e=>{let t=e.byteLength;for(;t>=255;)a++,t-=255;a++}));let o=27+a,s=n.reduce(((e,t)=>e+t.byteLength),0),c=new ArrayBuffer(o+s),l=new DataView(c),d=new Uint8Array(c);this.writeString(l,0,"OggS"),l.setUint8(4,0),l.setUint8(5,e),l.setUint32(6,4294967295&t,!0),l.setUint32(10,Math.floor(t/4294967295),!0),l.setUint32(14,i,!0),l.setUint32(18,r,!0),l.setUint32(22,0,!0),l.setUint8(26,a);let u=27;n.forEach((e=>{let t=e.byteLength;for(;t>=255;)d[u++]=255,t-=255;d[u++]=t}));let h=o;n.forEach((e=>{d.set(new Uint8Array(e),h),h+=e.byteLength}));let p=this.crc32(d);return l.setUint32(22,p,!0),d}writeString(e,t,i){for(let r=0;r<i.length;r++)e.setUint8(t+r,i.charCodeAt(r))}getOpusPacketDuration(e){if(0===e.byteLength)return 0;let t=new Uint8Array(e),i=t[0],r=i>>3&31,n=3&i,a=1;if(1===n||2===n)a=2;else if(3===n){if(e.byteLength<2)return 0;a=63&t[1]}return([480,480,480,480,960,960,960,960,1920,1920,1920,1920,2880,2880,480,480,120,120,120,120,240,240,240,240,480,480,480,480,960,960,960,960][r]||960)*a}crc32(e){let t=new Uint32Array(256);for(let r=0;r<256;r++){let e=r<<24;for(let t=0;t<8;t++)2147483648&e?e=e<<1^79764919:e<<=1;t[r]=e>>>0}let i=0;for(let r=0;r<e.length;r++){i=(i<<8^t[255&(i>>>24^e[r])])>>>0}return i}addVideoProcessor(){this._core.room.videoManager.addEncodeProcessor({processor:this._core.rtcDectection.IS_INSERTABLE_STREAM_SUPPORTED?this.encodeVideo.bind(this):sR,type:1}),this._core.room.videoManager.addDecodeProcessor({processor:this._core.rtcDectection.IS_INSERTABLE_STREAM_SUPPORTED?this.decodeVideo.bind(this):cR,type:1})}removeVideoProcessor(){this._core.room.videoManager.removeEncodeProcessor({type:1}),this._core.room.videoManager.removeDecodeProcessor({type:1})}addAudioProcessor(){this._core.room.audioManager.addEncodeProcessor({processor:this._core.rtcDectection.IS_INSERTABLE_STREAM_SUPPORTED?this.encodeAudio.bind(this):lR,type:2}),this._core.room.audioManager.addDecodeProcessor({processor:this._core.rtcDectection.IS_INSERTABLE_STREAM_SUPPORTED?this.decodeAudio.bind(this):dR,type:2})}removeAudioProcessor(){this._core.room.audioManager.removeEncodeProcessor({type:2}),this._core.room.audioManager.removeDecodeProcessor({type:2})}encodeVideo(e){let{frame:t,mediaType:i}=e;return sR({frame:t,onDump:()=>{if(!i)return;let e=2===i?"sub":"main",r=this.dumpLocalVideoMap[e];r&&(r.data.push(t.data.slice(0)),r.duration>0&&Date.now()-r.startTimestamp>1e3*r.duration&&r.onDumpEnd())}})}decodeVideo(e){let{frame:t,track:i}=e;return cR({frame:t,onDump:()=>{if(!i)return;let e=this.dumpRemoteVideoMap["".concat(i.userId,"-").concat(i.streamType)];e&&(e.data.push(t.data.slice(0)),e.duration>0&&Date.now()-e.startTimestamp>1e3*e.duration&&e.onDumpEnd())}})}encodeAudio(e){let{frame:t}=e;return lR({frame:t,onDump:()=>{let e=this.dumpLocalAudioMap.main;e&&(e.data.push(t.data.slice(0)),e.duration>0&&Date.now()-e.startTimestamp>1e3*e.duration&&e.onDumpEnd())}})}decodeAudio(e){let{frame:t,track:i}=e;return dR({frame:t,onDump:()=>{if(!i)return;let e=this.dumpRemoteAudioMap[i.userId];e&&(e.data.push(t.data.slice(0)),e.duration>0&&Date.now()-e.startTimestamp>1e3*e.duration&&e.onDumpEnd())}})}};
2
2
  /*! Bundled license information:
3
3
 
4
4
  jszip/dist/jszip.min.js:
@@ -14,4 +14,4 @@
14
14
  https://github.com/nodeca/pako/blob/main/LICENSE
15
15
  *)
16
16
  */
17
- return uA([IA(300,(()=>"export"))],IM.prototype,"onExportClick",1),uA([IA(300,(()=>"upload"))],IM.prototype,"onUploadClick",1),IM}));
17
+ return dA([wA(300,(()=>"export"))],AM.prototype,"onExportClick",1),dA([wA(300,(()=>"upload"))],AM.prototype,"onUploadClick",1),AM}));