!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).TXLivePusher=e()}(this,(function(){"use strict";function t(t,e){return e.forEach((function(e){e&&"string"!=typeof e&&!Array.isArray(e)&&Object.keys(e).forEach((function(r){if("default"!==r&&!(r in t)){var i=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,i.get?i:{enumerable:!0,get:function(){return e[r]}})}}))})),Object.freeze(t)}var e="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function r(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function i(t){if(t.__esModule)return t;var e=Object.defineProperty({},"__esModule",{value:!0});return Object.keys(t).forEach((function(r){var i=Object.getOwnPropertyDescriptor(t,r);Object.defineProperty(e,r,i.get?i:{enumerable:!0,get:function(){return t[r]}})})),e}var n=function(t){return t&&t.Math==Math&&t},s=n("object"==typeof globalThis&&globalThis)||n("object"==typeof window&&window)||n("object"==typeof self&&self)||n("object"==typeof e&&e)||function(){return this}()||Function("return this")(),o=function(t){try{return!!t()}catch(t){return!0}},a=!o((function(){var t=function(){}.bind();return"function"!=typeof t||t.hasOwnProperty("prototype")})),h=a,l=Function.prototype,c=l.apply,u=l.call,d="object"==typeof Reflect&&Reflect.apply||(h?u.bind(c):function(){return u.apply(c,arguments)}),p=a,f=Function.prototype,m=f.call,g=p&&f.bind.bind(m,m),v=p?g:function(t){return function(){return m.apply(t,arguments)}},y=v,b=y({}.toString),_=y("".slice),x=function(t){return _(b(t),8,-1)},T=x,w=v,S=function(t){if("Function"===T(t))return w(t)},E="object"==typeof document&&document.all,C={all:E,IS_HTMLDDA:void 0===E&&void 0!==E},A=C.all,R=C.IS_HTMLDDA?function(t){return"function"==typeof t||t===A}:function(t){return"function"==typeof t},P={},I=!o((function(){return 7!=Object.defineProperty({},1,{get:function(){return 7}})[1]})),M=a,O=Function.prototype.call,k=M?O.bind(O):function(){return O.apply(O,arguments)},D={},L={}.propertyIsEnumerable,N=Object.getOwnPropertyDescriptor,F=N&&!L.call({1:2},1);D.f=F?function(t){var e=N(this,t);return!!e&&e.enumerable}:L;var B,U,G=function(t,e){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:e}},j=o,V=x,H=Object,W=S("".split),X=j((function(){return!H("z").propertyIsEnumerable(0)}))?function(t){return"String"==V(t)?W(t,""):H(t)}:H,z=function(t){return null==t},Y=z,Z=TypeError,$=function(t){if(Y(t))throw Z("Can't call method on "+t);return t},K=X,J=$,q=function(t){return K(J(t))},Q=R,tt=C.all,et=C.IS_HTMLDDA?function(t){return"object"==typeof t?null!==t:Q(t)||t===tt}:function(t){return"object"==typeof t?null!==t:Q(t)},rt={},it=rt,nt=s,st=R,ot=function(t){return st(t)?t:void 0},at=function(t,e){return arguments.length<2?ot(it[t])||ot(nt[t]):it[t]&&it[t][e]||nt[t]&&nt[t][e]},ht=S({}.isPrototypeOf),lt=at("navigator","userAgent")||"",ct=s,ut=lt,dt=ct.process,pt=ct.Deno,ft=dt&&dt.versions||pt&&pt.version,mt=ft&&ft.v8;mt&&(U=(B=mt.split("."))[0]>0&&B[0]<4?1:+(B[0]+B[1])),!U&&ut&&(!(B=ut.match(/Edge\/(\d+)/))||B[1]>=74)&&(B=ut.match(/Chrome\/(\d+)/))&&(U=+B[1]);var gt=U,vt=gt,yt=o,bt=!!Object.getOwnPropertySymbols&&!yt((function(){var t=Symbol();return!String(t)||!(Object(t)instanceof Symbol)||!Symbol.sham&&vt&&vt<41})),_t=bt&&!Symbol.sham&&"symbol"==typeof Symbol.iterator,xt=at,Tt=R,wt=ht,St=Object,Et=_t?function(t){return"symbol"==typeof t}:function(t){var e=xt("Symbol");return Tt(e)&&wt(e.prototype,St(t))},Ct=String,At=function(t){try{return Ct(t)}catch(t){return"Object"}},Rt=R,Pt=At,It=TypeError,Mt=function(t){if(Rt(t))return t;throw It(Pt(t)+" is not a function")},Ot=Mt,kt=z,Dt=function(t,e){var r=t[e];return kt(r)?void 0:Ot(r)},Lt=k,Nt=R,Ft=et,Bt=TypeError,Ut={exports:{}},Gt=s,jt=Object.defineProperty,Vt=function(t,e){try{jt(Gt,t,{value:e,configurable:!0,writable:!0})}catch(r){Gt[t]=e}return e},Ht="__core-js_shared__",Wt=s[Ht]||Vt(Ht,{}),Xt=Wt;(Ut.exports=function(t,e){return Xt[t]||(Xt[t]=void 0!==e?e:{})})("versions",[]).push({version:"3.26.0",mode:"pure",copyright:"© 2014-2022 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.26.0/LICENSE",source:"https://github.com/zloirock/core-js"});var zt=$,Yt=Object,Zt=function(t){return Yt(zt(t))},$t=Zt,Kt=S({}.hasOwnProperty),Jt=Object.hasOwn||function(t,e){return Kt($t(t),e)},qt=S,Qt=0,te=Math.random(),ee=qt(1..toString),re=function(t){return"Symbol("+(void 0===t?"":t)+")_"+ee(++Qt+te,36)},ie=s,ne=Ut.exports,se=Jt,oe=re,ae=bt,he=_t,le=ne("wks"),ce=ie.Symbol,ue=ce&&ce.for,de=he?ce:ce&&ce.withoutSetter||oe,pe=function(t){if(!se(le,t)||!ae&&"string"!=typeof le[t]){var e="Symbol."+t;ae&&se(ce,t)?le[t]=ce[t]:le[t]=he&&ue?ue(e):de(e)}return le[t]},fe=k,me=et,ge=Et,ve=Dt,ye=function(t,e){var r,i;if("string"===e&&Nt(r=t.toString)&&!Ft(i=Lt(r,t)))return i;if(Nt(r=t.valueOf)&&!Ft(i=Lt(r,t)))return i;if("string"!==e&&Nt(r=t.toString)&&!Ft(i=Lt(r,t)))return i;throw Bt("Can't convert object to primitive value")},be=TypeError,_e=pe("toPrimitive"),xe=function(t,e){if(!me(t)||ge(t))return t;var r,i=ve(t,_e);if(i){if(void 0===e&&(e="default"),r=fe(i,t,e),!me(r)||ge(r))return r;throw be("Can't convert object to primitive value")}return void 0===e&&(e="number"),ye(t,e)},Te=Et,we=function(t){var e=xe(t,"string");return Te(e)?e:e+""},Se=et,Ee=s.document,Ce=Se(Ee)&&Se(Ee.createElement),Ae=function(t){return Ce?Ee.createElement(t):{}},Re=Ae,Pe=!I&&!o((function(){return 7!=Object.defineProperty(Re("div"),"a",{get:function(){return 7}}).a})),Ie=I,Me=k,Oe=D,ke=G,De=q,Le=we,Ne=Jt,Fe=Pe,Be=Object.getOwnPropertyDescriptor;P.f=Ie?Be:function(t,e){if(t=De(t),e=Le(e),Fe)try{return Be(t,e)}catch(t){}if(Ne(t,e))return ke(!Me(Oe.f,t,e),t[e])};var Ue=o,Ge=R,je=/#|\.prototype\./,Ve=function(t,e){var r=We[He(t)];return r==ze||r!=Xe&&(Ge(e)?Ue(e):!!e)},He=Ve.normalize=function(t){return String(t).replace(je,".").toLowerCase()},We=Ve.data={},Xe=Ve.NATIVE="N",ze=Ve.POLYFILL="P",Ye=Ve,Ze=Mt,$e=a,Ke=S(S.bind),Je=function(t,e){return Ze(t),void 0===e?t:$e?Ke(t,e):function(){return t.apply(e,arguments)}},qe={},Qe=I&&o((function(){return 42!=Object.defineProperty((function(){}),"prototype",{value:42,writable:!1}).prototype})),tr=et,er=String,rr=TypeError,ir=function(t){if(tr(t))return t;throw rr(er(t)+" is not an object")},nr=I,sr=Pe,or=Qe,ar=ir,hr=we,lr=TypeError,cr=Object.defineProperty,ur=Object.getOwnPropertyDescriptor,dr="enumerable",pr="configurable",fr="writable";qe.f=nr?or?function(t,e,r){if(ar(t),e=hr(e),ar(r),"function"==typeof t&&"prototype"===e&&"value"in r&&fr in r&&!r.writable){var i=ur(t,e);i&&i.writable&&(t[e]=r.value,r={configurable:pr in r?r.configurable:i.configurable,enumerable:dr in r?r.enumerable:i.enumerable,writable:!1})}return cr(t,e,r)}:cr:function(t,e,r){if(ar(t),e=hr(e),ar(r),sr)try{return cr(t,e,r)}catch(t){}if("get"in r||"set"in r)throw lr("Accessors not supported");return"value"in r&&(t[e]=r.value),t};var mr=qe,gr=G,vr=I?function(t,e,r){return mr.f(t,e,gr(1,r))}:function(t,e,r){return t[e]=r,t},yr=s,br=d,_r=S,xr=R,Tr=P.f,wr=Ye,Sr=rt,Er=Je,Cr=vr,Ar=Jt,Rr=function(t){var e=function(r,i,n){if(this instanceof e){switch(arguments.length){case 0:return new t;case 1:return new t(r);case 2:return new t(r,i)}return new t(r,i,n)}return br(t,this,arguments)};return e.prototype=t.prototype,e},Pr=function(t,e){var r,i,n,s,o,a,h,l,c=t.target,u=t.global,d=t.stat,p=t.proto,f=u?yr:d?yr[c]:(yr[c]||{}).prototype,m=u?Sr:Sr[c]||Cr(Sr,c,{})[c],g=m.prototype;for(n in e)r=!wr(u?n:c+(d?".":"#")+n,t.forced)&&f&&Ar(f,n),o=m[n],r&&(a=t.dontCallGetSet?(l=Tr(f,n))&&l.value:f[n]),s=r&&a?a:e[n],r&&typeof o==typeof s||(h=t.bind&&r?Er(s,yr):t.wrap&&r?Rr(s):p&&xr(s)?_r(s):s,(t.sham||s&&s.sham||o&&o.sham)&&Cr(h,"sham",!0),Cr(m,n,h),p&&(Ar(Sr,i=c+"Prototype")||Cr(Sr,i,{}),Cr(Sr[i],n,s),t.real&&g&&!g[n]&&Cr(g,n,s)))},Ir=x,Mr=Array.isArray||function(t){return"Array"==Ir(t)},Or=Math.ceil,kr=Math.floor,Dr=Math.trunc||function(t){var e=+t;return(e>0?kr:Or)(e)},Lr=Dr,Nr=function(t){var e=+t;return e!=e||0===e?0:Lr(e)},Fr=Nr,Br=Math.min,Ur=function(t){return t>0?Br(Fr(t),9007199254740991):0},Gr=Ur,jr=function(t){return Gr(t.length)},Vr=TypeError,Hr=function(t){if(t>9007199254740991)throw Vr("Maximum allowed index exceeded");return t},Wr=we,Xr=qe,zr=G,Yr=function(t,e,r){var i=Wr(e);i in t?Xr.f(t,i,zr(0,r)):t[i]=r},Zr={};Zr[pe("toStringTag")]="z";var $r="[object z]"===String(Zr),Kr=$r,Jr=R,qr=x,Qr=pe("toStringTag"),ti=Object,ei="Arguments"==qr(function(){return arguments}()),ri=Kr?qr:function(t){var e,r,i;return void 0===t?"Undefined":null===t?"Null":"string"==typeof(r=function(t,e){try{return t[e]}catch(t){}}(e=ti(t),Qr))?r:ei?qr(e):"Object"==(i=qr(e))&&Jr(e.callee)?"Arguments":i},ii=R,ni=Wt,si=S(Function.toString);ii(ni.inspectSource)||(ni.inspectSource=function(t){return si(t)});var oi=ni.inspectSource,ai=S,hi=o,li=R,ci=ri,ui=oi,di=function(){},pi=[],fi=at("Reflect","construct"),mi=/^\s*(?:class|function)\b/,gi=ai(mi.exec),vi=!mi.exec(di),yi=function(t){if(!li(t))return!1;try{return fi(di,pi,t),!0}catch(t){return!1}},bi=function(t){if(!li(t))return!1;switch(ci(t)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return vi||!!gi(mi,ui(t))}catch(t){return!0}};bi.sham=!0;var _i=!fi||hi((function(){var t;return yi(yi.call)||!yi(Object)||!yi((function(){t=!0}))||t}))?bi:yi,xi=Mr,Ti=_i,wi=et,Si=pe("species"),Ei=Array,Ci=function(t){var e;return xi(t)&&(e=t.constructor,(Ti(e)&&(e===Ei||xi(e.prototype))||wi(e)&&null===(e=e[Si]))&&(e=void 0)),void 0===e?Ei:e},Ai=function(t,e){return new(Ci(t))(0===e?0:e)},Ri=o,Pi=gt,Ii=pe("species"),Mi=function(t){return Pi>=51||!Ri((function(){var e=[];return(e.constructor={})[Ii]=function(){return{foo:1}},1!==e[t](Boolean).foo}))},Oi=Pr,ki=o,Di=Mr,Li=et,Ni=Zt,Fi=jr,Bi=Hr,Ui=Yr,Gi=Ai,ji=Mi,Vi=gt,Hi=pe("isConcatSpreadable"),Wi=Vi>=51||!ki((function(){var t=[];return t[Hi]=!1,t.concat()[0]!==t})),Xi=ji("concat"),zi=function(t){if(!Li(t))return!1;var e=t[Hi];return void 0!==e?!!e:Di(t)};Oi({target:"Array",proto:!0,arity:1,forced:!Wi||!Xi},{concat:function(t){var e,r,i,n,s,o=Ni(this),a=Gi(o,0),h=0;for(e=-1,i=arguments.length;e<i;e++)if(zi(s=-1===e?o:arguments[e]))for(n=Fi(s),Bi(h+n),r=0;r<n;r++,h++)r in s&&Ui(a,h,s[r]);else Bi(h+1),Ui(a,h++,s);return a.length=h,a}});var Yi=ri,Zi=String,$i=function(t){if("Symbol"===Yi(t))throw TypeError("Cannot convert a Symbol value to a string");return Zi(t)},Ki={},Ji=Nr,qi=Math.max,Qi=Math.min,tn=function(t,e){var r=Ji(t);return r<0?qi(r+e,0):Qi(r,e)},en=q,rn=tn,nn=jr,sn=function(t){return function(e,r,i){var n,s=en(e),o=nn(s),a=rn(i,o);if(t&&r!=r){for(;o>a;)if((n=s[a++])!=n)return!0}else for(;o>a;a++)if((t||a in s)&&s[a]===r)return t||a||0;return!t&&-1}},on={includes:sn(!0),indexOf:sn(!1)},an={},hn=Jt,ln=q,cn=on.indexOf,un=an,dn=S([].push),pn=function(t,e){var r,i=ln(t),n=0,s=[];for(r in i)!hn(un,r)&&hn(i,r)&&dn(s,r);for(;e.length>n;)hn(i,r=e[n++])&&(~cn(s,r)||dn(s,r));return s},fn=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],mn=pn,gn=fn,vn=Object.keys||function(t){return mn(t,gn)},yn=I,bn=Qe,_n=qe,xn=ir,Tn=q,wn=vn;Ki.f=yn&&!bn?Object.defineProperties:function(t,e){xn(t);for(var r,i=Tn(e),n=wn(e),s=n.length,o=0;s>o;)_n.f(t,r=n[o++],i[r]);return t};var Sn,En=at("document","documentElement"),Cn=Ut.exports,An=re,Rn=Cn("keys"),Pn=function(t){return Rn[t]||(Rn[t]=An(t))},In=ir,Mn=Ki,On=fn,kn=an,Dn=En,Ln=Ae,Nn=Pn("IE_PROTO"),Fn=function(){},Bn=function(t){return"<script>"+t+"</"+"script>"},Un=function(t){t.write(Bn("")),t.close();var e=t.parentWindow.Object;return t=null,e},Gn=function(){try{Sn=new ActiveXObject("htmlfile")}catch(t){}var t,e;Gn="undefined"!=typeof document?document.domain&&Sn?Un(Sn):((e=Ln("iframe")).style.display="none",Dn.appendChild(e),e.src=String("javascript:"),(t=e.contentWindow.document).open(),t.write(Bn("document.F=Object")),t.close(),t.F):Un(Sn);for(var r=On.length;r--;)delete Gn.prototype[On[r]];return Gn()};kn[Nn]=!0;var jn=Object.create||function(t,e){var r;return null!==t?(Fn.prototype=In(t),r=new Fn,Fn.prototype=null,r[Nn]=t):r=Gn(),void 0===e?r:Mn.f(r,e)},Vn={},Hn=pn,Wn=fn.concat("length","prototype");Vn.f=Object.getOwnPropertyNames||function(t){return Hn(t,Wn)};var Xn={},zn=tn,Yn=jr,Zn=Yr,$n=Array,Kn=Math.max,Jn=function(t,e,r){for(var i=Yn(t),n=zn(e,i),s=zn(void 0===r?i:r,i),o=$n(Kn(s-n,0)),a=0;n<s;n++,a++)Zn(o,a,t[n]);return o.length=a,o},qn=x,Qn=q,ts=Vn.f,es=Jn,rs="object"==typeof window&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[];Xn.f=function(t){return rs&&"Window"==qn(t)?function(t){try{return ts(t)}catch(t){return es(rs)}}(t):ts(Qn(t))};var is={};is.f=Object.getOwnPropertySymbols;var ns=vr,ss=function(t,e,r,i){return i&&i.enumerable?t[e]=r:ns(t,e,r),t},os={},as=pe;os.f=as;var hs,ls,cs,us=rt,ds=Jt,ps=os,fs=qe.f,ms=function(t){var e=us.Symbol||(us.Symbol={});ds(e,t)||fs(e,t,{value:ps.f(t)})},gs=k,vs=at,ys=pe,bs=ss,_s=function(){var t=vs("Symbol"),e=t&&t.prototype,r=e&&e.valueOf,i=ys("toPrimitive");e&&!e[i]&&bs(e,i,(function(t){return gs(r,this)}),{arity:1})},xs=ri,Ts=$r?{}.toString:function(){return"[object "+xs(this)+"]"},ws=$r,Ss=qe.f,Es=vr,Cs=Jt,As=Ts,Rs=pe("toStringTag"),Ps=function(t,e,r,i){if(t){var n=r?t:t.prototype;Cs(n,Rs)||Ss(n,Rs,{configurable:!0,value:e}),i&&!ws&&Es(n,"toString",As)}},Is=R,Ms=s.WeakMap,Os=Is(Ms)&&/native code/.test(String(Ms)),ks=s,Ds=et,Ls=vr,Ns=Jt,Fs=Wt,Bs=Pn,Us=an,Gs="Object already initialized",js=ks.TypeError,Vs=ks.WeakMap;if(Os||Fs.state){var Hs=Fs.state||(Fs.state=new Vs);Hs.get=Hs.get,Hs.has=Hs.has,Hs.set=Hs.set,hs=function(t,e){if(Hs.has(t))throw js(Gs);return e.facade=t,Hs.set(t,e),e},ls=function(t){return Hs.get(t)||{}},cs=function(t){return Hs.has(t)}}else{var Ws=Bs("state");Us[Ws]=!0,hs=function(t,e){if(Ns(t,Ws))throw js(Gs);return e.facade=t,Ls(t,Ws,e),e},ls=function(t){return Ns(t,Ws)?t[Ws]:{}},cs=function(t){return Ns(t,Ws)}}var Xs={set:hs,get:ls,has:cs,enforce:function(t){return cs(t)?ls(t):hs(t,{})},getterFor:function(t){return function(e){var r;if(!Ds(e)||(r=ls(e)).type!==t)throw js("Incompatible receiver, "+t+" required");return r}}},zs=Je,Ys=X,Zs=Zt,$s=jr,Ks=Ai,Js=S([].push),qs=function(t){var e=1==t,r=2==t,i=3==t,n=4==t,s=6==t,o=7==t,a=5==t||s;return function(h,l,c,u){for(var d,p,f=Zs(h),m=Ys(f),g=zs(l,c),v=$s(m),y=0,b=u||Ks,_=e?b(h,v):r||o?b(h,0):void 0;v>y;y++)if((a||y in m)&&(p=g(d=m[y],y,f),t))if(e)_[y]=p;else if(p)switch(t){case 3:return!0;case 5:return d;case 6:return y;case 2:Js(_,d)}else switch(t){case 4:return!1;case 7:Js(_,d)}return s?-1:i||n?n:_}},Qs={forEach:qs(0),map:qs(1),filter:qs(2),some:qs(3),every:qs(4),find:qs(5),findIndex:qs(6),filterReject:qs(7)},to=Pr,eo=s,ro=k,io=S,no=I,so=bt,oo=o,ao=Jt,ho=ht,lo=ir,co=q,uo=we,po=$i,fo=G,mo=jn,go=vn,vo=Vn,yo=Xn,bo=is,_o=P,xo=qe,To=Ki,wo=D,So=ss,Eo=Ut.exports,Co=an,Ao=re,Ro=pe,Po=os,Io=ms,Mo=_s,Oo=Ps,ko=Xs,Do=Qs.forEach,Lo=Pn("hidden"),No="Symbol",Fo=ko.set,Bo=ko.getterFor(No),Uo=Object.prototype,Go=eo.Symbol,jo=Go&&Go.prototype,Vo=eo.TypeError,Ho=eo.QObject,Wo=_o.f,Xo=xo.f,zo=yo.f,Yo=wo.f,Zo=io([].push),$o=Eo("symbols"),Ko=Eo("op-symbols"),Jo=Eo("wks"),qo=!Ho||!Ho.prototype||!Ho.prototype.findChild,Qo=no&&oo((function(){return 7!=mo(Xo({},"a",{get:function(){return Xo(this,"a",{value:7}).a}})).a}))?function(t,e,r){var i=Wo(Uo,e);i&&delete Uo[e],Xo(t,e,r),i&&t!==Uo&&Xo(Uo,e,i)}:Xo,ta=function(t,e){var r=$o[t]=mo(jo);return Fo(r,{type:No,tag:t,description:e}),no||(r.description=e),r},ea=function(t,e,r){t===Uo&&ea(Ko,e,r),lo(t);var i=uo(e);return lo(r),ao($o,i)?(r.enumerable?(ao(t,Lo)&&t[Lo][i]&&(t[Lo][i]=!1),r=mo(r,{enumerable:fo(0,!1)})):(ao(t,Lo)||Xo(t,Lo,fo(1,{})),t[Lo][i]=!0),Qo(t,i,r)):Xo(t,i,r)},ra=function(t,e){lo(t);var r=co(e),i=go(r).concat(oa(r));return Do(i,(function(e){no&&!ro(ia,r,e)||ea(t,e,r[e])})),t},ia=function(t){var e=uo(t),r=ro(Yo,this,e);return!(this===Uo&&ao($o,e)&&!ao(Ko,e))&&(!(r||!ao(this,e)||!ao($o,e)||ao(this,Lo)&&this[Lo][e])||r)},na=function(t,e){var r=co(t),i=uo(e);if(r!==Uo||!ao($o,i)||ao(Ko,i)){var n=Wo(r,i);return!n||!ao($o,i)||ao(r,Lo)&&r[Lo][i]||(n.enumerable=!0),n}},sa=function(t){var e=zo(co(t)),r=[];return Do(e,(function(t){ao($o,t)||ao(Co,t)||Zo(r,t)})),r},oa=function(t){var e=t===Uo,r=zo(e?Ko:co(t)),i=[];return Do(r,(function(t){!ao($o,t)||e&&!ao(Uo,t)||Zo(i,$o[t])})),i};so||(Go=function(){if(ho(jo,this))throw Vo("Symbol is not a constructor");var t=arguments.length&&void 0!==arguments[0]?po(arguments[0]):void 0,e=Ao(t),r=function(t){this===Uo&&ro(r,Ko,t),ao(this,Lo)&&ao(this[Lo],e)&&(this[Lo][e]=!1),Qo(this,e,fo(1,t))};return no&&qo&&Qo(Uo,e,{configurable:!0,set:r}),ta(e,t)},So(jo=Go.prototype,"toString",(function(){return Bo(this).tag})),So(Go,"withoutSetter",(function(t){return ta(Ao(t),t)})),wo.f=ia,xo.f=ea,To.f=ra,_o.f=na,vo.f=yo.f=sa,bo.f=oa,Po.f=function(t){return ta(Ro(t),t)},no&&Xo(jo,"description",{configurable:!0,get:function(){return Bo(this).description}})),to({global:!0,constructor:!0,wrap:!0,forced:!so,sham:!so},{Symbol:Go}),Do(go(Jo),(function(t){Io(t)})),to({target:No,stat:!0,forced:!so},{useSetter:function(){qo=!0},useSimple:function(){qo=!1}}),to({target:"Object",stat:!0,forced:!so,sham:!no},{create:function(t,e){return void 0===e?mo(t):ra(mo(t),e)},defineProperty:ea,defineProperties:ra,getOwnPropertyDescriptor:na}),to({target:"Object",stat:!0,forced:!so},{getOwnPropertyNames:sa}),Mo(),Oo(Go,No),Co[Lo]=!0;var aa=bt&&!!Symbol.for&&!!Symbol.keyFor,ha=Pr,la=at,ca=Jt,ua=$i,da=Ut.exports,pa=aa,fa=da("string-to-symbol-registry"),ma=da("symbol-to-string-registry");ha({target:"Symbol",stat:!0,forced:!pa},{for:function(t){var e=ua(t);if(ca(fa,e))return fa[e];var r=la("Symbol")(e);return fa[e]=r,ma[r]=e,r}});var ga=Pr,va=Jt,ya=Et,ba=At,_a=aa,xa=(0,Ut.exports)("symbol-to-string-registry");ga({target:"Symbol",stat:!0,forced:!_a},{keyFor:function(t){if(!ya(t))throw TypeError(ba(t)+" is not a symbol");if(va(xa,t))return xa[t]}});var Ta=S([].slice),wa=Pr,Sa=at,Ea=d,Ca=k,Aa=S,Ra=o,Pa=Mr,Ia=R,Ma=et,Oa=Et,ka=Ta,Da=bt,La=Sa("JSON","stringify"),Na=Aa(/./.exec),Fa=Aa("".charAt),Ba=Aa("".charCodeAt),Ua=Aa("".replace),Ga=Aa(1..toString),ja=/[\uD800-\uDFFF]/g,Va=/^[\uD800-\uDBFF]$/,Ha=/^[\uDC00-\uDFFF]$/,Wa=!Da||Ra((function(){var t=Sa("Symbol")();return"[null]"!=La([t])||"{}"!=La({a:t})||"{}"!=La(Object(t))})),Xa=Ra((function(){return'"\\udf06\\ud834"'!==La("\udf06\ud834")||'"\\udead"'!==La("\udead")})),za=function(t,e){var r=ka(arguments),i=e;if((Ma(e)||void 0!==t)&&!Oa(t))return Pa(e)||(e=function(t,e){if(Ia(i)&&(e=Ca(i,this,t,e)),!Oa(e))return e}),r[1]=e,Ea(La,null,r)},Ya=function(t,e,r){var i=Fa(r,e-1),n=Fa(r,e+1);return Na(Va,t)&&!Na(Ha,n)||Na(Ha,t)&&!Na(Va,i)?"\\u"+Ga(Ba(t,0),16):t};La&&wa({target:"JSON",stat:!0,arity:3,forced:Wa||Xa},{stringify:function(t,e,r){var i=ka(arguments),n=Ea(Wa?za:La,null,i);return Xa&&"string"==typeof n?Ua(n,ja,Ya):n}});var Za=is,$a=Zt;Pr({target:"Object",stat:!0,forced:!bt||o((function(){Za.f(1)}))},{getOwnPropertySymbols:function(t){var e=Za.f;return e?e($a(t)):[]}}),ms("asyncIterator"),ms("hasInstance"),ms("isConcatSpreadable"),ms("iterator"),ms("match"),ms("matchAll"),ms("replace"),ms("search"),ms("species"),ms("split");var Ka=_s;ms("toPrimitive"),Ka();var Ja=at,qa=Ps;ms("toStringTag"),qa(Ja("Symbol"),"Symbol"),ms("unscopables"),Ps(s.JSON,"JSON",!0);var Qa,th,eh,rh=rt.Symbol,ih={},nh=I,sh=Jt,oh=Function.prototype,ah=nh&&Object.getOwnPropertyDescriptor,hh=sh(oh,"name"),lh={EXISTS:hh,PROPER:hh&&"something"===function(){}.name,CONFIGURABLE:hh&&(!nh||nh&&ah(oh,"name").configurable)},ch=!o((function(){function t(){}return t.prototype.constructor=null,Object.getPrototypeOf(new t)!==t.prototype})),uh=Jt,dh=R,ph=Zt,fh=ch,mh=Pn("IE_PROTO"),gh=Object,vh=gh.prototype,yh=fh?gh.getPrototypeOf:function(t){var e=ph(t);if(uh(e,mh))return e[mh];var r=e.constructor;return dh(r)&&e instanceof r?r.prototype:e instanceof gh?vh:null},bh=o,_h=R,xh=et,Th=jn,wh=yh,Sh=ss,Eh=pe("iterator"),Ch=!1;[].keys&&("next"in(eh=[].keys())?(th=wh(wh(eh)))!==Object.prototype&&(Qa=th):Ch=!0);var Ah=!xh(Qa)||bh((function(){var t={};return Qa[Eh].call(t)!==t}));_h((Qa=Ah?{}:Th(Qa))[Eh])||Sh(Qa,Eh,(function(){return this}));var Rh={IteratorPrototype:Qa,BUGGY_SAFARI_ITERATORS:Ch},Ph=Rh.IteratorPrototype,Ih=jn,Mh=G,Oh=Ps,kh=ih,Dh=function(){return this},Lh=function(t,e,r,i){var n=e+" Iterator";return t.prototype=Ih(Ph,{next:Mh(+!i,r)}),Oh(t,n,!1,!0),kh[n]=Dh,t},Nh=R,Fh=String,Bh=TypeError,Uh=S,Gh=ir,jh=function(t){if("object"==typeof t||Nh(t))return t;throw Bh("Can't set "+Fh(t)+" as a prototype")},Vh=Object.setPrototypeOf||("__proto__"in{}?function(){var t,e=!1,r={};try{(t=Uh(Object.getOwnPropertyDescriptor(Object.prototype,"__proto__").set))(r,[]),e=r instanceof Array}catch(t){}return function(r,i){return Gh(r),jh(i),e?t(r,i):r.__proto__=i,r}}():void 0),Hh=Pr,Wh=k,Xh=lh,zh=Lh,Yh=yh,Zh=Ps,$h=ss,Kh=ih,Jh=Rh,qh=Xh.PROPER,Qh=Jh.BUGGY_SAFARI_ITERATORS,tl=pe("iterator"),el="keys",rl="values",il="entries",nl=function(){return this},sl=function(t,e,r,i,n,s,o){zh(r,e,i);var a,h,l,c=function(t){if(t===n&&m)return m;if(!Qh&&t in p)return p[t];switch(t){case el:case rl:case il:return function(){return new r(this,t)}}return function(){return new r(this)}},u=e+" Iterator",d=!1,p=t.prototype,f=p[tl]||p["@@iterator"]||n&&p[n],m=!Qh&&f||c(n),g="Array"==e&&p.entries||f;if(g&&(a=Yh(g.call(new t)))!==Object.prototype&&a.next&&(Zh(a,u,!0,!0),Kh[u]=nl),qh&&n==rl&&f&&f.name!==rl&&(d=!0,m=function(){return Wh(f,this)}),n)if(h={values:c(rl),keys:s?m:c(el),entries:c(il)},o)for(l in h)(Qh||d||!(l in p))&&$h(p,l,h[l]);else Hh({target:e,proto:!0,forced:Qh||d},h);return o&&p[tl]!==m&&$h(p,tl,m,{name:n}),Kh[e]=m,h},ol=function(t,e){return{value:t,done:e}},al=q,hl=function(){},ll=ih,cl=Xs,ul=(qe.f,sl),dl=ol,pl="Array Iterator",fl=cl.set,ml=cl.getterFor(pl);ul(Array,"Array",(function(t,e){fl(this,{type:pl,target:al(t),index:0,kind:e})}),(function(){var t=ml(this),e=t.target,r=t.kind,i=t.index++;return!e||i>=e.length?(t.target=void 0,dl(void 0,!0)):dl("keys"==r?i:"values"==r?e[i]:[i,e[i]],!1)}),"values");ll.Arguments=ll.Array;hl(),hl(),hl();var gl={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},vl=s,yl=ri,bl=vr,_l=ih,xl=pe("toStringTag");for(var Tl in gl){var wl=vl[Tl],Sl=wl&&wl.prototype;Sl&&yl(Sl)!==xl&&bl(Sl,xl,Tl),_l[Tl]=_l.Array}var El=rh;ms("asyncDispose"),ms("dispose"),ms("matcher"),ms("metadataKey"),ms("observable"),ms("metadata"),ms("patternMatch"),ms("replaceAll");var Cl=El,Al=S,Rl=Nr,Pl=$i,Il=$,Ml=Al("".charAt),Ol=Al("".charCodeAt),kl=Al("".slice),Dl=function(t){return function(e,r){var i,n,s=Pl(Il(e)),o=Rl(r),a=s.length;return o<0||o>=a?t?"":void 0:(i=Ol(s,o))<55296||i>56319||o+1===a||(n=Ol(s,o+1))<56320||n>57343?t?Ml(s,o):i:t?kl(s,o,o+2):n-56320+(i-55296<<10)+65536}},Ll={codeAt:Dl(!1),charAt:Dl(!0)},Nl=Ll.charAt,Fl=$i,Bl=Xs,Ul=sl,Gl=ol,jl="String Iterator",Vl=Bl.set,Hl=Bl.getterFor(jl);Ul(String,"String",(function(t){Vl(this,{type:jl,string:Fl(t),index:0})}),(function(){var t,e=Hl(this),r=e.string,i=e.index;return i>=r.length?Gl(void 0,!0):(t=Nl(r,i),e.index+=t.length,Gl(t,!1))}));var Wl=os.f("iterator");function Xl(t){return Xl="function"==typeof Cl&&"symbol"==typeof Wl?function(t){return typeof t}:function(t){return t&&"function"==typeof Cl&&t.constructor===Cl&&t!==Cl.prototype?"symbol":typeof t},Xl(t)}var zl=S,Yl=Mt,Zl=et,$l=Jt,Kl=Ta,Jl=a,ql=Function,Ql=zl([].concat),tc=zl([].join),ec={},rc=function(t,e,r){if(!$l(ec,e)){for(var i=[],n=0;n<e;n++)i[n]="a["+n+"]";ec[e]=ql("C,a","return new C("+tc(i,",")+")")}return ec[e](t,r)},ic=Jl?ql.bind:function(t){var e=Yl(this),r=e.prototype,i=Kl(arguments,1),n=function(){var r=Ql(i,Kl(arguments));return this instanceof n?rc(e,r.length,r):e.apply(t,r)};return Zl(r)&&(n.prototype=r),n},nc=ic;Pr({target:"Function",proto:!0,forced:Function.bind!==nc},{bind:nc});var sc=rt,oc=function(t){return sc[t+"Prototype"]},ac=oc("Function").bind,hc=ht,lc=ac,cc=Function.prototype,uc=function(t){var e=t.bind;return t===cc||hc(cc,t)&&e===cc.bind?lc:e},dc=oc("Array").concat,pc=ht,fc=dc,mc=Array.prototype,gc=function(t){var e=t.concat;return t===mc||pc(mc,t)&&e===mc.concat?fc:e},vc=o,yc=function(t,e){var r=[][t];return!!r&&vc((function(){r.call(null,e||function(){return 1},1)}))},bc=Qs.forEach,_c=yc("forEach")?[].forEach:function(t){return bc(this,t,arguments.length>1?arguments[1]:void 0)};Pr({target:"Array",proto:!0,forced:[].forEach!=_c},{forEach:_c});var xc=oc("Array").forEach,Tc=ri,wc=Jt,Sc=ht,Ec=xc,Cc=Array.prototype,Ac={DOMTokenList:!0,NodeList:!0},Rc=function(t){var e=t.forEach;return t===Cc||Sc(Cc,t)&&e===Cc.forEach||wc(Ac,Tc(t))?Ec:e},Pc=Qs.filter;Pr({target:"Array",proto:!0,forced:!Mi("filter")},{filter:function(t){return Pc(this,t,arguments.length>1?arguments[1]:void 0)}});var Ic=oc("Array").filter,Mc=ht,Oc=Ic,kc=Array.prototype,Dc=function(t){var e=t.filter;return t===kc||Mc(kc,t)&&e===kc.filter?Oc:e},Lc=Pr,Nc=Qs.findIndex,Fc="findIndex",Bc=!0;Fc in[]&&Array(1).findIndex((function(){Bc=!1})),Lc({target:"Array",proto:!0,forced:Bc},{findIndex:function(t){return Nc(this,t,arguments.length>1?arguments[1]:void 0)}});var Uc=oc("Array").findIndex,Gc=ht,jc=Uc,Vc=Array.prototype,Hc=function(t){var e=t.findIndex;return t===Vc||Gc(Vc,t)&&e===Vc.findIndex?jc:e},Wc=I,Xc=Mr,zc=TypeError,Yc=Object.getOwnPropertyDescriptor,Zc=Wc&&!function(){if(void 0!==this)return!0;try{Object.defineProperty([],"length",{writable:!1}).length=1}catch(t){return t instanceof TypeError}}(),$c=At,Kc=TypeError,Jc=Pr,qc=Zt,Qc=tn,tu=Nr,eu=jr,ru=Zc?function(t,e){if(Xc(t)&&!Yc(t,"length").writable)throw zc("Cannot set read only .length");return t.length=e}:function(t,e){return t.length=e},iu=Hr,nu=Ai,su=Yr,ou=function(t,e){if(!delete t[e])throw Kc("Cannot delete property "+$c(e)+" of "+$c(t))},au=Mi("splice"),hu=Math.max,lu=Math.min;Jc({target:"Array",proto:!0,forced:!au},{splice:function(t,e){var r,i,n,s,o,a,h=qc(this),l=eu(h),c=Qc(t,l),u=arguments.length;for(0===u?r=i=0:1===u?(r=0,i=l-c):(r=u-2,i=lu(hu(tu(e),0),l-c)),iu(l+r-i),n=nu(h,i),s=0;s<i;s++)(o=c+s)in h&&su(n,s,h[o]);if(n.length=i,r<i){for(s=c;s<l-i;s++)a=s+r,(o=s+i)in h?h[a]=h[o]:ou(h,a);for(s=l;s>l-i+r;s--)ou(h,s-1)}else if(r>i)for(s=l-i;s>c;s--)a=s+r-1,(o=s+i-1)in h?h[a]=h[o]:ou(h,a);for(s=0;s<r;s++)h[s+c]=arguments[s+2];return ru(h,l-i+r),n}});var cu=oc("Array").splice,uu=ht,du=cu,pu=Array.prototype,fu=function(t){var e=t.splice;return t===pu||uu(pu,t)&&e===pu.splice?du:e},mu=Pr,gu=Qs.find,vu="find",yu=!0;vu in[]&&Array(1).find((function(){yu=!1})),mu({target:"Array",proto:!0,forced:yu},{find:function(t){return gu(this,t,arguments.length>1?arguments[1]:void 0)}});var bu=oc("Array").find,_u=ht,xu=bu,Tu=Array.prototype,wu=function(t){var e=t.find;return t===Tu||_u(Tu,t)&&e===Tu.find?xu:e},Su=Zt,Eu=vn;Pr({target:"Object",stat:!0,forced:o((function(){Eu(1)}))},{keys:function(t){return Eu(Su(t))}});var Cu=rt.Object.keys,Au=on.includes;Pr({target:"Array",proto:!0,forced:o((function(){return!Array(1).includes()}))},{includes:function(t){return Au(this,t,arguments.length>1?arguments[1]:void 0)}});var Ru=oc("Array").includes,Pu=et,Iu=x,Mu=pe("match"),Ou=function(t){var e;return Pu(t)&&(void 0!==(e=t[Mu])?!!e:"RegExp"==Iu(t))},ku=TypeError,Du=function(t){if(Ou(t))throw ku("The method doesn't accept regular expressions");return t},Lu=pe("match"),Nu=function(t){var e=/./;try{"/./"[t](e)}catch(r){try{return e[Lu]=!1,"/./"[t](e)}catch(t){}}return!1},Fu=Pr,Bu=Du,Uu=$,Gu=$i,ju=Nu,Vu=S("".indexOf);Fu({target:"String",proto:!0,forced:!ju("includes")},{includes:function(t){return!!~Vu(Gu(Uu(this)),Gu(Bu(t)),arguments.length>1?arguments[1]:void 0)}});var Hu=oc("String").includes,Wu=ht,Xu=Ru,zu=Hu,Yu=Array.prototype,Zu=String.prototype,$u=function(t){var e=t.includes;return t===Yu||Wu(Yu,t)&&e===Yu.includes?Xu:"string"==typeof t||t===Zu||Wu(Zu,t)&&e===Zu.includes?zu:e},Ku=TypeError,Ju=function(t,e){if(t<e)throw Ku("Not enough arguments");return t},qu=s,Qu=d,td=R,ed=Ta,rd=Ju,id=/MSIE .\./.test(lt),nd=qu.Function,sd=function(t){return id?function(e,r){var i=rd(arguments.length,1)>2,n=td(e)?e:nd(e),s=i?ed(arguments,2):void 0;return t(i?function(){Qu(n,this,s)}:n,r)}:t},od={setTimeout:sd(qu.setTimeout),setInterval:sd(qu.setInterval)},ad=od.setInterval;Pr({global:!0,bind:!0,forced:s.setInterval!==ad},{setInterval:ad});var hd=od.setTimeout;Pr({global:!0,bind:!0,forced:s.setTimeout!==hd},{setTimeout:hd});var ld=rt.setTimeout,cd=Qs.map;Pr({target:"Array",proto:!0,forced:!Mi("map")},{map:function(t){return cd(this,t,arguments.length>1?arguments[1]:void 0)}});var ud=oc("Array").map,dd=ht,pd=ud,fd=Array.prototype,md=function(t){var e=t.map;return t===fd||dd(fd,t)&&e===fd.map?pd:e},gd=Qs.some;Pr({target:"Array",proto:!0,forced:!yc("some")},{some:function(t){return gd(this,t,arguments.length>1?arguments[1]:void 0)}});var vd=oc("Array").some,yd=ht,bd=vd,_d=Array.prototype,xd=function(t){var e=t.some;return t===_d||yd(_d,t)&&e===_d.some?bd:e},Td=function(){return Td=Object.assign||function(t){for(var e,r=1,i=arguments.length;r<i;r++)for(var n in e=arguments[r])Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t},Td.apply(this,arguments)};function wd(t,e,r,i){return new(r||(r=Promise))((function(n,s){function o(t){try{h(i.next(t))}catch(t){s(t)}}function a(t){try{h(i.throw(t))}catch(t){s(t)}}function h(t){var e;t.done?n(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(o,a)}h((i=i.apply(t,e||[])).next())}))}function Sd(t,e){var r,i,n,s,o={label:0,sent:function(){if(1&n[0])throw n[1];return n[1]},trys:[],ops:[]};return s={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s;function a(s){return function(a){return function(s){if(r)throw new TypeError("Generator is already executing.");for(;o;)try{if(r=1,i&&(n=2&s[0]?i.return:s[0]?i.throw||((n=i.return)&&n.call(i),0):i.next)&&!(n=n.call(i,s[1])).done)return n;switch(i=0,n&&(s=[2&s[0],n.value]),s[0]){case 0:case 1:n=s;break;case 4:return o.label++,{value:s[1],done:!1};case 5:o.label++,i=s[1],s=[0];continue;case 7:s=o.ops.pop(),o.trys.pop();continue;default:if(!(n=o.trys,(n=n.length>0&&n[n.length-1])||6!==s[0]&&2!==s[0])){o=0;continue}if(3===s[0]&&(!n||s[1]>n[0]&&s[1]<n[3])){o.label=s[1];break}if(6===s[0]&&o.label<n[1]){o.label=n[1],n=s;break}if(n&&o.label<n[2]){o.label=n[2],o.ops.push(s);break}n[2]&&o.ops.pop(),o.trys.pop();continue}s=e.call(t,o)}catch(t){s=[6,t],i=0}finally{r=n=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,a])}}}function Ed(t){var e="function"==typeof Symbol&&Symbol.iterator,r=e&&t[e],i=0;if(r)return r.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&i>=t.length&&(t=void 0),{value:t&&t[i++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function Cd(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var i,n,s=r.call(t),o=[];try{for(;(void 0===e||e-- >0)&&!(i=s.next()).done;)o.push(i.value)}catch(t){n={error:t}}finally{try{i&&!i.done&&(r=s.return)&&r.call(s)}finally{if(n)throw n.error}}return o}let Ad=!0,Rd=!0;function Pd(t,e,r){const i=t.match(e);return i&&i.length>=r&&parseInt(i[r],10)}function Id(t,e,r){if(!t.RTCPeerConnection)return;const i=t.RTCPeerConnection.prototype,n=i.addEventListener;i.addEventListener=function(t,i){if(t!==e)return n.apply(this,arguments);const s=t=>{const e=r(t);e&&(i.handleEvent?i.handleEvent(e):i(e))};return this._eventMap=this._eventMap||{},this._eventMap[e]||(this._eventMap[e]=new Map),this._eventMap[e].set(i,s),n.apply(this,[t,s])};const s=i.removeEventListener;i.removeEventListener=function(t,r){if(t!==e||!this._eventMap||!this._eventMap[e])return s.apply(this,arguments);if(!this._eventMap[e].has(r))return s.apply(this,arguments);const i=this._eventMap[e].get(r);return this._eventMap[e].delete(r),0===this._eventMap[e].size&&delete this._eventMap[e],0===Object.keys(this._eventMap).length&&delete this._eventMap,s.apply(this,[t,i])},Object.defineProperty(i,"on"+e,{get(){return this["_on"+e]},set(t){this["_on"+e]&&(this.removeEventListener(e,this["_on"+e]),delete this["_on"+e]),t&&this.addEventListener(e,this["_on"+e]=t)},enumerable:!0,configurable:!0})}function Md(t){return"boolean"!=typeof t?new Error("Argument type: "+typeof t+". Please use a boolean."):(Ad=t,t?"adapter.js logging disabled":"adapter.js logging enabled")}function Od(t){return"boolean"!=typeof t?new Error("Argument type: "+typeof t+". Please use a boolean."):(Rd=!t,"adapter.js deprecation warnings "+(t?"disabled":"enabled"))}function kd(){if("object"==typeof window){if(Ad)return;"undefined"!=typeof console&&"function"==typeof console.log&&console.log.apply(console,arguments)}}function Dd(t,e){Rd&&console.warn(t+" is deprecated, please use "+e+" instead.")}function Ld(t){return"[object Object]"===Object.prototype.toString.call(t)}function Nd(t){return Ld(t)?Object.keys(t).reduce((function(e,r){const i=Ld(t[r]),n=i?Nd(t[r]):t[r],s=i&&!Object.keys(n).length;return void 0===n||s?e:Object.assign(e,{[r]:n})}),{}):t}function Fd(t,e,r){e&&!r.has(e.id)&&(r.set(e.id,e),Object.keys(e).forEach((i=>{i.endsWith("Id")?Fd(t,t.get(e[i]),r):i.endsWith("Ids")&&e[i].forEach((e=>{Fd(t,t.get(e),r)}))})))}function Bd(t,e,r){const i=r?"outbound-rtp":"inbound-rtp",n=new Map;if(null===e)return n;const s=[];return t.forEach((t=>{"track"===t.type&&t.trackIdentifier===e.id&&s.push(t)})),s.forEach((e=>{t.forEach((r=>{r.type===i&&r.trackId===e.id&&Fd(t,r,n)}))})),n}const Ud=kd;function Gd(t,e){const r=t&&t.navigator;if(!r.mediaDevices)return;const i=function(t){if("object"!=typeof t||t.mandatory||t.optional)return t;const e={};return Object.keys(t).forEach((r=>{if("require"===r||"advanced"===r||"mediaSource"===r)return;const i="object"==typeof t[r]?t[r]:{ideal:t[r]};void 0!==i.exact&&"number"==typeof i.exact&&(i.min=i.max=i.exact);const n=function(t,e){return t?t+e.charAt(0).toUpperCase()+e.slice(1):"deviceId"===e?"sourceId":e};if(void 0!==i.ideal){e.optional=e.optional||[];let t={};"number"==typeof i.ideal?(t[n("min",r)]=i.ideal,e.optional.push(t),t={},t[n("max",r)]=i.ideal,e.optional.push(t)):(t[n("",r)]=i.ideal,e.optional.push(t))}void 0!==i.exact&&"number"!=typeof i.exact?(e.mandatory=e.mandatory||{},e.mandatory[n("",r)]=i.exact):["min","max"].forEach((t=>{void 0!==i[t]&&(e.mandatory=e.mandatory||{},e.mandatory[n(t,r)]=i[t])}))})),t.advanced&&(e.optional=(e.optional||[]).concat(t.advanced)),e},n=function(t,n){if(e.version>=61)return n(t);if((t=JSON.parse(JSON.stringify(t)))&&"object"==typeof t.audio){const e=function(t,e,r){e in t&&!(r in t)&&(t[r]=t[e],delete t[e])};e((t=JSON.parse(JSON.stringify(t))).audio,"autoGainControl","googAutoGainControl"),e(t.audio,"noiseSuppression","googNoiseSuppression"),t.audio=i(t.audio)}if(t&&"object"==typeof t.video){let s=t.video.facingMode;s=s&&("object"==typeof s?s:{ideal:s});const o=e.version<66;if(s&&("user"===s.exact||"environment"===s.exact||"user"===s.ideal||"environment"===s.ideal)&&(!r.mediaDevices.getSupportedConstraints||!r.mediaDevices.getSupportedConstraints().facingMode||o)){let e;if(delete t.video.facingMode,"environment"===s.exact||"environment"===s.ideal?e=["back","rear"]:"user"!==s.exact&&"user"!==s.ideal||(e=["front"]),e)return r.mediaDevices.enumerateDevices().then((r=>{r=r.filter((t=>"videoinput"===t.kind));let o=r.find((t=>e.some((e=>t.label.toLowerCase().includes(e)))));return!o&&r.length&&e.includes("back")&&(o=r[r.length-1]),o&&(t.video.deviceId=s.exact?{exact:o.deviceId}:{ideal:o.deviceId}),t.video=i(t.video),Ud("chrome: "+JSON.stringify(t)),n(t)}))}t.video=i(t.video)}return Ud("chrome: "+JSON.stringify(t)),n(t)},s=function(t){return e.version>=64?t:{name:{PermissionDeniedError:"NotAllowedError",PermissionDismissedError:"NotAllowedError",InvalidStateError:"NotAllowedError",DevicesNotFoundError:"NotFoundError",ConstraintNotSatisfiedError:"OverconstrainedError",TrackStartError:"NotReadableError",MediaDeviceFailedDueToShutdown:"NotAllowedError",MediaDeviceKillSwitchOn:"NotAllowedError",TabCaptureError:"AbortError",ScreenCaptureError:"AbortError",DeviceCaptureError:"AbortError"}[t.name]||t.name,message:t.message,constraint:t.constraint||t.constraintName,toString(){return this.name+(this.message&&": ")+this.message}}};if(r.getUserMedia=function(t,e,i){n(t,(t=>{r.webkitGetUserMedia(t,e,(t=>{i&&i(s(t))}))}))}.bind(r),r.mediaDevices.getUserMedia){const t=r.mediaDevices.getUserMedia.bind(r.mediaDevices);r.mediaDevices.getUserMedia=function(e){return n(e,(e=>t(e).then((t=>{if(e.audio&&!t.getAudioTracks().length||e.video&&!t.getVideoTracks().length)throw t.getTracks().forEach((t=>{t.stop()})),new DOMException("","NotFoundError");return t}),(t=>Promise.reject(s(t))))))}}}function jd(t){t.MediaStream=t.MediaStream||t.webkitMediaStream}function Vd(t){if("object"==typeof t&&t.RTCPeerConnection&&!("ontrack"in t.RTCPeerConnection.prototype)){Object.defineProperty(t.RTCPeerConnection.prototype,"ontrack",{get(){return this._ontrack},set(t){this._ontrack&&this.removeEventListener("track",this._ontrack),this.addEventListener("track",this._ontrack=t)},enumerable:!0,configurable:!0});const e=t.RTCPeerConnection.prototype.setRemoteDescription;t.RTCPeerConnection.prototype.setRemoteDescription=function(){return this._ontrackpoly||(this._ontrackpoly=e=>{e.stream.addEventListener("addtrack",(r=>{let i;i=t.RTCPeerConnection.prototype.getReceivers?this.getReceivers().find((t=>t.track&&t.track.id===r.track.id)):{track:r.track};const n=new Event("track");n.track=r.track,n.receiver=i,n.transceiver={receiver:i},n.streams=[e.stream],this.dispatchEvent(n)})),e.stream.getTracks().forEach((r=>{let i;i=t.RTCPeerConnection.prototype.getReceivers?this.getReceivers().find((t=>t.track&&t.track.id===r.id)):{track:r};const n=new Event("track");n.track=r,n.receiver=i,n.transceiver={receiver:i},n.streams=[e.stream],this.dispatchEvent(n)}))},this.addEventListener("addstream",this._ontrackpoly)),e.apply(this,arguments)}}else Id(t,"track",(t=>(t.transceiver||Object.defineProperty(t,"transceiver",{value:{receiver:t.receiver}}),t)))}function Hd(t){if("object"==typeof t&&t.RTCPeerConnection&&!("getSenders"in t.RTCPeerConnection.prototype)&&"createDTMFSender"in t.RTCPeerConnection.prototype){const e=function(t,e){return{track:e,get dtmf(){return void 0===this._dtmf&&("audio"===e.kind?this._dtmf=t.createDTMFSender(e):this._dtmf=null),this._dtmf},_pc:t}};if(!t.RTCPeerConnection.prototype.getSenders){t.RTCPeerConnection.prototype.getSenders=function(){return this._senders=this._senders||[],this._senders.slice()};const r=t.RTCPeerConnection.prototype.addTrack;t.RTCPeerConnection.prototype.addTrack=function(t,i){let n=r.apply(this,arguments);return n||(n=e(this,t),this._senders.push(n)),n};const i=t.RTCPeerConnection.prototype.removeTrack;t.RTCPeerConnection.prototype.removeTrack=function(t){i.apply(this,arguments);const e=this._senders.indexOf(t);-1!==e&&this._senders.splice(e,1)}}const r=t.RTCPeerConnection.prototype.addStream;t.RTCPeerConnection.prototype.addStream=function(t){this._senders=this._senders||[],r.apply(this,[t]),t.getTracks().forEach((t=>{this._senders.push(e(this,t))}))};const i=t.RTCPeerConnection.prototype.removeStream;t.RTCPeerConnection.prototype.removeStream=function(t){this._senders=this._senders||[],i.apply(this,[t]),t.getTracks().forEach((t=>{const e=this._senders.find((e=>e.track===t));e&&this._senders.splice(this._senders.indexOf(e),1)}))}}else if("object"==typeof t&&t.RTCPeerConnection&&"getSenders"in t.RTCPeerConnection.prototype&&"createDTMFSender"in t.RTCPeerConnection.prototype&&t.RTCRtpSender&&!("dtmf"in t.RTCRtpSender.prototype)){const e=t.RTCPeerConnection.prototype.getSenders;t.RTCPeerConnection.prototype.getSenders=function(){const t=e.apply(this,[]);return t.forEach((t=>t._pc=this)),t},Object.defineProperty(t.RTCRtpSender.prototype,"dtmf",{get(){return void 0===this._dtmf&&("audio"===this.track.kind?this._dtmf=this._pc.createDTMFSender(this.track):this._dtmf=null),this._dtmf}})}}function Wd(t){if(!t.RTCPeerConnection)return;const e=t.RTCPeerConnection.prototype.getStats;t.RTCPeerConnection.prototype.getStats=function(){const[t,r,i]=arguments;if(arguments.length>0&&"function"==typeof t)return e.apply(this,arguments);if(0===e.length&&(0===arguments.length||"function"!=typeof t))return e.apply(this,[]);const n=function(t){const e={};return t.result().forEach((t=>{const r={id:t.id,timestamp:t.timestamp,type:{localcandidate:"local-candidate",remotecandidate:"remote-candidate"}[t.type]||t.type};t.names().forEach((e=>{r[e]=t.stat(e)})),e[r.id]=r})),e},s=function(t){return new Map(Object.keys(t).map((e=>[e,t[e]])))};if(arguments.length>=2){const i=function(t){r(s(n(t)))};return e.apply(this,[i,t])}return new Promise(((t,r)=>{e.apply(this,[function(e){t(s(n(e)))},r])})).then(r,i)}}function Xd(t){if(!("object"==typeof t&&t.RTCPeerConnection&&t.RTCRtpSender&&t.RTCRtpReceiver))return;if(!("getStats"in t.RTCRtpSender.prototype)){const e=t.RTCPeerConnection.prototype.getSenders;e&&(t.RTCPeerConnection.prototype.getSenders=function(){const t=e.apply(this,[]);return t.forEach((t=>t._pc=this)),t});const r=t.RTCPeerConnection.prototype.addTrack;r&&(t.RTCPeerConnection.prototype.addTrack=function(){const t=r.apply(this,arguments);return t._pc=this,t}),t.RTCRtpSender.prototype.getStats=function(){const t=this;return this._pc.getStats().then((e=>Bd(e,t.track,!0)))}}if(!("getStats"in t.RTCRtpReceiver.prototype)){const e=t.RTCPeerConnection.prototype.getReceivers;e&&(t.RTCPeerConnection.prototype.getReceivers=function(){const t=e.apply(this,[]);return t.forEach((t=>t._pc=this)),t}),Id(t,"track",(t=>(t.receiver._pc=t.srcElement,t))),t.RTCRtpReceiver.prototype.getStats=function(){const t=this;return this._pc.getStats().then((e=>Bd(e,t.track,!1)))}}if(!("getStats"in t.RTCRtpSender.prototype)||!("getStats"in t.RTCRtpReceiver.prototype))return;const e=t.RTCPeerConnection.prototype.getStats;t.RTCPeerConnection.prototype.getStats=function(){if(arguments.length>0&&arguments[0]instanceof t.MediaStreamTrack){const t=arguments[0];let e,r,i;return this.getSenders().forEach((r=>{r.track===t&&(e?i=!0:e=r)})),this.getReceivers().forEach((e=>(e.track===t&&(r?i=!0:r=e),e.track===t))),i||e&&r?Promise.reject(new DOMException("There are more than one sender or receiver for the track.","InvalidAccessError")):e?e.getStats():r?r.getStats():Promise.reject(new DOMException("There is no sender or receiver for the track.","InvalidAccessError"))}return e.apply(this,arguments)}}function zd(t){t.RTCPeerConnection.prototype.getLocalStreams=function(){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},Object.keys(this._shimmedLocalStreams).map((t=>this._shimmedLocalStreams[t][0]))};const e=t.RTCPeerConnection.prototype.addTrack;t.RTCPeerConnection.prototype.addTrack=function(t,r){if(!r)return e.apply(this,arguments);this._shimmedLocalStreams=this._shimmedLocalStreams||{};const i=e.apply(this,arguments);return this._shimmedLocalStreams[r.id]?-1===this._shimmedLocalStreams[r.id].indexOf(i)&&this._shimmedLocalStreams[r.id].push(i):this._shimmedLocalStreams[r.id]=[r,i],i};const r=t.RTCPeerConnection.prototype.addStream;t.RTCPeerConnection.prototype.addStream=function(t){this._shimmedLocalStreams=this._shimmedLocalStreams||{},t.getTracks().forEach((t=>{const e=this.getSenders().find((e=>e.track===t));if(e)throw new DOMException("Track already exists.","InvalidAccessError")}));const e=this.getSenders();r.apply(this,arguments);const i=this.getSenders().filter((t=>-1===e.indexOf(t)));this._shimmedLocalStreams[t.id]=[t].concat(i)};const i=t.RTCPeerConnection.prototype.removeStream;t.RTCPeerConnection.prototype.removeStream=function(t){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},delete this._shimmedLocalStreams[t.id],i.apply(this,arguments)};const n=t.RTCPeerConnection.prototype.removeTrack;t.RTCPeerConnection.prototype.removeTrack=function(t){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},t&&Object.keys(this._shimmedLocalStreams).forEach((e=>{const r=this._shimmedLocalStreams[e].indexOf(t);-1!==r&&this._shimmedLocalStreams[e].splice(r,1),1===this._shimmedLocalStreams[e].length&&delete this._shimmedLocalStreams[e]})),n.apply(this,arguments)}}function Yd(t,e){if(!t.RTCPeerConnection)return;if(t.RTCPeerConnection.prototype.addTrack&&e.version>=65)return zd(t);const r=t.RTCPeerConnection.prototype.getLocalStreams;t.RTCPeerConnection.prototype.getLocalStreams=function(){const t=r.apply(this);return this._reverseStreams=this._reverseStreams||{},t.map((t=>this._reverseStreams[t.id]))};const i=t.RTCPeerConnection.prototype.addStream;t.RTCPeerConnection.prototype.addStream=function(e){if(this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{},e.getTracks().forEach((t=>{const e=this.getSenders().find((e=>e.track===t));if(e)throw new DOMException("Track already exists.","InvalidAccessError")})),!this._reverseStreams[e.id]){const r=new t.MediaStream(e.getTracks());this._streams[e.id]=r,this._reverseStreams[r.id]=e,e=r}i.apply(this,[e])};const n=t.RTCPeerConnection.prototype.removeStream;function s(t,e){let r=e.sdp;return Object.keys(t._reverseStreams||[]).forEach((e=>{const i=t._reverseStreams[e],n=t._streams[i.id];r=r.replace(new RegExp(n.id,"g"),i.id)})),new RTCSessionDescription({type:e.type,sdp:r})}function o(t,e){let r=e.sdp;return Object.keys(t._reverseStreams||[]).forEach((e=>{const i=t._reverseStreams[e],n=t._streams[i.id];r=r.replace(new RegExp(i.id,"g"),n.id)})),new RTCSessionDescription({type:e.type,sdp:r})}t.RTCPeerConnection.prototype.removeStream=function(t){this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{},n.apply(this,[this._streams[t.id]||t]),delete this._reverseStreams[this._streams[t.id]?this._streams[t.id].id:t.id],delete this._streams[t.id]},t.RTCPeerConnection.prototype.addTrack=function(e,r){if("closed"===this.signalingState)throw new DOMException("The RTCPeerConnection's signalingState is 'closed'.","InvalidStateError");const i=[].slice.call(arguments,1);if(1!==i.length||!i[0].getTracks().find((t=>t===e)))throw new DOMException("The adapter.js addTrack polyfill only supports a single  stream which is associated with the specified track.","NotSupportedError");const n=this.getSenders().find((t=>t.track===e));if(n)throw new DOMException("Track already exists.","InvalidAccessError");this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{};const s=this._streams[r.id];if(s)s.addTrack(e),Promise.resolve().then((()=>{this.dispatchEvent(new Event("negotiationneeded"))}));else{const i=new t.MediaStream([e]);this._streams[r.id]=i,this._reverseStreams[i.id]=r,this.addStream(i)}return this.getSenders().find((t=>t.track===e))},["createOffer","createAnswer"].forEach((function(e){const r=t.RTCPeerConnection.prototype[e],i={[e](){const t=arguments;return arguments.length&&"function"==typeof arguments[0]?r.apply(this,[e=>{const r=s(this,e);t[0].apply(null,[r])},e=>{t[1]&&t[1].apply(null,e)},arguments[2]]):r.apply(this,arguments).then((t=>s(this,t)))}};t.RTCPeerConnection.prototype[e]=i[e]}));const a=t.RTCPeerConnection.prototype.setLocalDescription;t.RTCPeerConnection.prototype.setLocalDescription=function(){return arguments.length&&arguments[0].type?(arguments[0]=o(this,arguments[0]),a.apply(this,arguments)):a.apply(this,arguments)};const h=Object.getOwnPropertyDescriptor(t.RTCPeerConnection.prototype,"localDescription");Object.defineProperty(t.RTCPeerConnection.prototype,"localDescription",{get(){const t=h.get.apply(this);return""===t.type?t:s(this,t)}}),t.RTCPeerConnection.prototype.removeTrack=function(t){if("closed"===this.signalingState)throw new DOMException("The RTCPeerConnection's signalingState is 'closed'.","InvalidStateError");if(!t._pc)throw new DOMException("Argument 1 of RTCPeerConnection.removeTrack does not implement interface RTCRtpSender.","TypeError");if(!(t._pc===this))throw new DOMException("Sender was not created by this connection.","InvalidAccessError");let e;this._streams=this._streams||{},Object.keys(this._streams).forEach((r=>{this._streams[r].getTracks().find((e=>t.track===e))&&(e=this._streams[r])})),e&&(1===e.getTracks().length?this.removeStream(this._reverseStreams[e.id]):e.removeTrack(t.track),this.dispatchEvent(new Event("negotiationneeded")))}}function Zd(t,e){!t.RTCPeerConnection&&t.webkitRTCPeerConnection&&(t.RTCPeerConnection=t.webkitRTCPeerConnection),t.RTCPeerConnection&&e.version<53&&["setLocalDescription","setRemoteDescription","addIceCandidate"].forEach((function(e){const r=t.RTCPeerConnection.prototype[e],i={[e](){return arguments[0]=new("addIceCandidate"===e?t.RTCIceCandidate:t.RTCSessionDescription)(arguments[0]),r.apply(this,arguments)}};t.RTCPeerConnection.prototype[e]=i[e]}))}function $d(t,e){Id(t,"negotiationneeded",(t=>{const r=t.target;if(!(e.version<72||r.getConfiguration&&"plan-b"===r.getConfiguration().sdpSemantics)||"stable"===r.signalingState)return t}))}var Kd=Object.freeze({__proto__:null,shimMediaStream:jd,shimOnTrack:Vd,shimGetSendersWithDtmf:Hd,shimGetStats:Wd,shimSenderReceiverGetStats:Xd,shimAddTrackRemoveTrackWithNative:zd,shimAddTrackRemoveTrack:Yd,shimPeerConnection:Zd,fixNegotiationNeeded:$d,shimGetUserMedia:Gd,shimGetDisplayMedia:function(t,e){t.navigator.mediaDevices&&"getDisplayMedia"in t.navigator.mediaDevices||t.navigator.mediaDevices&&("function"==typeof e?t.navigator.mediaDevices.getDisplayMedia=function(r){return e(r).then((e=>{const i=r.video&&r.video.width,n=r.video&&r.video.height,s=r.video&&r.video.frameRate;return r.video={mandatory:{chromeMediaSource:"desktop",chromeMediaSourceId:e,maxFrameRate:s||3}},i&&(r.video.mandatory.maxWidth=i),n&&(r.video.mandatory.maxHeight=n),t.navigator.mediaDevices.getUserMedia(r)}))}:console.error("shimGetDisplayMedia: getSourceId argument is not a function"))}});function Jd(t,e){const r=t&&t.navigator,i=t&&t.MediaStreamTrack;if(r.getUserMedia=function(t,e,i){Dd("navigator.getUserMedia","navigator.mediaDevices.getUserMedia"),r.mediaDevices.getUserMedia(t).then(e,i)},!(e.version>55&&"autoGainControl"in r.mediaDevices.getSupportedConstraints())){const t=function(t,e,r){e in t&&!(r in t)&&(t[r]=t[e],delete t[e])},e=r.mediaDevices.getUserMedia.bind(r.mediaDevices);if(r.mediaDevices.getUserMedia=function(r){return"object"==typeof r&&"object"==typeof r.audio&&(r=JSON.parse(JSON.stringify(r)),t(r.audio,"autoGainControl","mozAutoGainControl"),t(r.audio,"noiseSuppression","mozNoiseSuppression")),e(r)},i&&i.prototype.getSettings){const e=i.prototype.getSettings;i.prototype.getSettings=function(){const r=e.apply(this,arguments);return t(r,"mozAutoGainControl","autoGainControl"),t(r,"mozNoiseSuppression","noiseSuppression"),r}}if(i&&i.prototype.applyConstraints){const e=i.prototype.applyConstraints;i.prototype.applyConstraints=function(r){return"audio"===this.kind&&"object"==typeof r&&(r=JSON.parse(JSON.stringify(r)),t(r,"autoGainControl","mozAutoGainControl"),t(r,"noiseSuppression","mozNoiseSuppression")),e.apply(this,[r])}}}}function qd(t){"object"==typeof t&&t.RTCTrackEvent&&"receiver"in t.RTCTrackEvent.prototype&&!("transceiver"in t.RTCTrackEvent.prototype)&&Object.defineProperty(t.RTCTrackEvent.prototype,"transceiver",{get(){return{receiver:this.receiver}}})}function Qd(t,e){if("object"!=typeof t||!t.RTCPeerConnection&&!t.mozRTCPeerConnection)return;!t.RTCPeerConnection&&t.mozRTCPeerConnection&&(t.RTCPeerConnection=t.mozRTCPeerConnection),e.version<53&&["setLocalDescription","setRemoteDescription","addIceCandidate"].forEach((function(e){const r=t.RTCPeerConnection.prototype[e],i={[e](){return arguments[0]=new("addIceCandidate"===e?t.RTCIceCandidate:t.RTCSessionDescription)(arguments[0]),r.apply(this,arguments)}};t.RTCPeerConnection.prototype[e]=i[e]}));const r={inboundrtp:"inbound-rtp",outboundrtp:"outbound-rtp",candidatepair:"candidate-pair",localcandidate:"local-candidate",remotecandidate:"remote-candidate"},i=t.RTCPeerConnection.prototype.getStats;t.RTCPeerConnection.prototype.getStats=function(){const[t,n,s]=arguments;return i.apply(this,[t||null]).then((t=>{if(e.version<53&&!n)try{t.forEach((t=>{t.type=r[t.type]||t.type}))}catch(e){if("TypeError"!==e.name)throw e;t.forEach(((e,i)=>{t.set(i,Object.assign({},e,{type:r[e.type]||e.type}))}))}return t})).then(n,s)}}function tp(t){if("object"!=typeof t||!t.RTCPeerConnection||!t.RTCRtpSender)return;if(t.RTCRtpSender&&"getStats"in t.RTCRtpSender.prototype)return;const e=t.RTCPeerConnection.prototype.getSenders;e&&(t.RTCPeerConnection.prototype.getSenders=function(){const t=e.apply(this,[]);return t.forEach((t=>t._pc=this)),t});const r=t.RTCPeerConnection.prototype.addTrack;r&&(t.RTCPeerConnection.prototype.addTrack=function(){const t=r.apply(this,arguments);return t._pc=this,t}),t.RTCRtpSender.prototype.getStats=function(){return this.track?this._pc.getStats(this.track):Promise.resolve(new Map)}}function ep(t){if("object"!=typeof t||!t.RTCPeerConnection||!t.RTCRtpSender)return;if(t.RTCRtpSender&&"getStats"in t.RTCRtpReceiver.prototype)return;const e=t.RTCPeerConnection.prototype.getReceivers;e&&(t.RTCPeerConnection.prototype.getReceivers=function(){const t=e.apply(this,[]);return t.forEach((t=>t._pc=this)),t}),Id(t,"track",(t=>(t.receiver._pc=t.srcElement,t))),t.RTCRtpReceiver.prototype.getStats=function(){return this._pc.getStats(this.track)}}function rp(t){t.RTCPeerConnection&&!("removeStream"in t.RTCPeerConnection.prototype)&&(t.RTCPeerConnection.prototype.removeStream=function(t){Dd("removeStream","removeTrack"),this.getSenders().forEach((e=>{e.track&&t.getTracks().includes(e.track)&&this.removeTrack(e)}))})}function ip(t){t.DataChannel&&!t.RTCDataChannel&&(t.RTCDataChannel=t.DataChannel)}function np(t){if("object"!=typeof t||!t.RTCPeerConnection)return;const e=t.RTCPeerConnection.prototype.addTransceiver;e&&(t.RTCPeerConnection.prototype.addTransceiver=function(){this.setParametersPromises=[];let t=arguments[1]&&arguments[1].sendEncodings;void 0===t&&(t=[]),t=[...t];const r=t.length>0;r&&t.forEach((t=>{if("rid"in t){if(!/^[a-z0-9]{0,16}$/i.test(t.rid))throw new TypeError("Invalid RID value provided.")}if("scaleResolutionDownBy"in t&&!(parseFloat(t.scaleResolutionDownBy)>=1))throw new RangeError("scale_resolution_down_by must be >= 1.0");if("maxFramerate"in t&&!(parseFloat(t.maxFramerate)>=0))throw new RangeError("max_framerate must be >= 0.0")}));const i=e.apply(this,arguments);if(r){const{sender:e}=i,r=e.getParameters();(!("encodings"in r)||1===r.encodings.length&&0===Object.keys(r.encodings[0]).length)&&(r.encodings=t,e.sendEncodings=t,this.setParametersPromises.push(e.setParameters(r).then((()=>{delete e.sendEncodings})).catch((()=>{delete e.sendEncodings}))))}return i})}function sp(t){if("object"!=typeof t||!t.RTCRtpSender)return;const e=t.RTCRtpSender.prototype.getParameters;e&&(t.RTCRtpSender.prototype.getParameters=function(){const t=e.apply(this,arguments);return"encodings"in t||(t.encodings=[].concat(this.sendEncodings||[{}])),t})}function op(t){if("object"!=typeof t||!t.RTCPeerConnection)return;const e=t.RTCPeerConnection.prototype.createOffer;t.RTCPeerConnection.prototype.createOffer=function(){return this.setParametersPromises&&this.setParametersPromises.length?Promise.all(this.setParametersPromises).then((()=>e.apply(this,arguments))).finally((()=>{this.setParametersPromises=[]})):e.apply(this,arguments)}}function ap(t){if("object"!=typeof t||!t.RTCPeerConnection)return;const e=t.RTCPeerConnection.prototype.createAnswer;t.RTCPeerConnection.prototype.createAnswer=function(){return this.setParametersPromises&&this.setParametersPromises.length?Promise.all(this.setParametersPromises).then((()=>e.apply(this,arguments))).finally((()=>{this.setParametersPromises=[]})):e.apply(this,arguments)}}var hp=Object.freeze({__proto__:null,shimOnTrack:qd,shimPeerConnection:Qd,shimSenderGetStats:tp,shimReceiverGetStats:ep,shimRemoveStream:rp,shimRTCDataChannel:ip,shimAddTransceiver:np,shimGetParameters:sp,shimCreateOffer:op,shimCreateAnswer:ap,shimGetUserMedia:Jd,shimGetDisplayMedia:function(t,e){t.navigator.mediaDevices&&"getDisplayMedia"in t.navigator.mediaDevices||t.navigator.mediaDevices&&(t.navigator.mediaDevices.getDisplayMedia=function(r){if(!r||!r.video){const t=new DOMException("getDisplayMedia without video constraints is undefined");return t.name="NotFoundError",t.code=8,Promise.reject(t)}return!0===r.video?r.video={mediaSource:e}:r.video.mediaSource=e,t.navigator.mediaDevices.getUserMedia(r)})}});function lp(t){if("object"==typeof t&&t.RTCPeerConnection){if("getLocalStreams"in t.RTCPeerConnection.prototype||(t.RTCPeerConnection.prototype.getLocalStreams=function(){return this._localStreams||(this._localStreams=[]),this._localStreams}),!("addStream"in t.RTCPeerConnection.prototype)){const e=t.RTCPeerConnection.prototype.addTrack;t.RTCPeerConnection.prototype.addStream=function(t){this._localStreams||(this._localStreams=[]),this._localStreams.includes(t)||this._localStreams.push(t),t.getAudioTracks().forEach((r=>e.call(this,r,t))),t.getVideoTracks().forEach((r=>e.call(this,r,t)))},t.RTCPeerConnection.prototype.addTrack=function(t,...r){return r&&r.forEach((t=>{this._localStreams?this._localStreams.includes(t)||this._localStreams.push(t):this._localStreams=[t]})),e.apply(this,arguments)}}"removeStream"in t.RTCPeerConnection.prototype||(t.RTCPeerConnection.prototype.removeStream=function(t){this._localStreams||(this._localStreams=[]);const e=this._localStreams.indexOf(t);if(-1===e)return;this._localStreams.splice(e,1);const r=t.getTracks();this.getSenders().forEach((t=>{r.includes(t.track)&&this.removeTrack(t)}))})}}function cp(t){if("object"==typeof t&&t.RTCPeerConnection&&("getRemoteStreams"in t.RTCPeerConnection.prototype||(t.RTCPeerConnection.prototype.getRemoteStreams=function(){return this._remoteStreams?this._remoteStreams:[]}),!("onaddstream"in t.RTCPeerConnection.prototype))){Object.defineProperty(t.RTCPeerConnection.prototype,"onaddstream",{get(){return this._onaddstream},set(t){this._onaddstream&&(this.removeEventListener("addstream",this._onaddstream),this.removeEventListener("track",this._onaddstreampoly)),this.addEventListener("addstream",this._onaddstream=t),this.addEventListener("track",this._onaddstreampoly=t=>{t.streams.forEach((t=>{if(this._remoteStreams||(this._remoteStreams=[]),this._remoteStreams.includes(t))return;this._remoteStreams.push(t);const e=new Event("addstream");e.stream=t,this.dispatchEvent(e)}))})}});const e=t.RTCPeerConnection.prototype.setRemoteDescription;t.RTCPeerConnection.prototype.setRemoteDescription=function(){const t=this;return this._onaddstreampoly||this.addEventListener("track",this._onaddstreampoly=function(e){e.streams.forEach((e=>{if(t._remoteStreams||(t._remoteStreams=[]),t._remoteStreams.indexOf(e)>=0)return;t._remoteStreams.push(e);const r=new Event("addstream");r.stream=e,t.dispatchEvent(r)}))}),e.apply(t,arguments)}}}function up(t){if("object"!=typeof t||!t.RTCPeerConnection)return;const e=t.RTCPeerConnection.prototype,r=e.createOffer,i=e.createAnswer,n=e.setLocalDescription,s=e.setRemoteDescription,o=e.addIceCandidate;e.createOffer=function(t,e){const i=arguments.length>=2?arguments[2]:arguments[0],n=r.apply(this,[i]);return e?(n.then(t,e),Promise.resolve()):n},e.createAnswer=function(t,e){const r=arguments.length>=2?arguments[2]:arguments[0],n=i.apply(this,[r]);return e?(n.then(t,e),Promise.resolve()):n};let a=function(t,e,r){const i=n.apply(this,[t]);return r?(i.then(e,r),Promise.resolve()):i};e.setLocalDescription=a,a=function(t,e,r){const i=s.apply(this,[t]);return r?(i.then(e,r),Promise.resolve()):i},e.setRemoteDescription=a,a=function(t,e,r){const i=o.apply(this,[t]);return r?(i.then(e,r),Promise.resolve()):i},e.addIceCandidate=a}function dp(t){const e=t&&t.navigator;if(e.mediaDevices&&e.mediaDevices.getUserMedia){const t=e.mediaDevices,r=t.getUserMedia.bind(t);e.mediaDevices.getUserMedia=t=>r(pp(t))}!e.getUserMedia&&e.mediaDevices&&e.mediaDevices.getUserMedia&&(e.getUserMedia=function(t,r,i){e.mediaDevices.getUserMedia(t).then(r,i)}.bind(e))}function pp(t){return t&&void 0!==t.video?Object.assign({},t,{video:Nd(t.video)}):t}function fp(t){if(!t.RTCPeerConnection)return;const e=t.RTCPeerConnection;t.RTCPeerConnection=function(t,r){if(t&&t.iceServers){const e=[];for(let r=0;r<t.iceServers.length;r++){let i=t.iceServers[r];void 0===i.urls&&i.url?(Dd("RTCIceServer.url","RTCIceServer.urls"),i=JSON.parse(JSON.stringify(i)),i.urls=i.url,delete i.url,e.push(i)):e.push(t.iceServers[r])}t.iceServers=e}return new e(t,r)},t.RTCPeerConnection.prototype=e.prototype,"generateCertificate"in e&&Object.defineProperty(t.RTCPeerConnection,"generateCertificate",{get:()=>e.generateCertificate})}function mp(t){"object"==typeof t&&t.RTCTrackEvent&&"receiver"in t.RTCTrackEvent.prototype&&!("transceiver"in t.RTCTrackEvent.prototype)&&Object.defineProperty(t.RTCTrackEvent.prototype,"transceiver",{get(){return{receiver:this.receiver}}})}function gp(t){const e=t.RTCPeerConnection.prototype.createOffer;t.RTCPeerConnection.prototype.createOffer=function(t){if(t){void 0!==t.offerToReceiveAudio&&(t.offerToReceiveAudio=!!t.offerToReceiveAudio);const e=this.getTransceivers().find((t=>"audio"===t.receiver.track.kind));!1===t.offerToReceiveAudio&&e?"sendrecv"===e.direction?e.setDirection?e.setDirection("sendonly"):e.direction="sendonly":"recvonly"===e.direction&&(e.setDirection?e.setDirection("inactive"):e.direction="inactive"):!0!==t.offerToReceiveAudio||e||this.addTransceiver("audio",{direction:"recvonly"}),void 0!==t.offerToReceiveVideo&&(t.offerToReceiveVideo=!!t.offerToReceiveVideo);const r=this.getTransceivers().find((t=>"video"===t.receiver.track.kind));!1===t.offerToReceiveVideo&&r?"sendrecv"===r.direction?r.setDirection?r.setDirection("sendonly"):r.direction="sendonly":"recvonly"===r.direction&&(r.setDirection?r.setDirection("inactive"):r.direction="inactive"):!0!==t.offerToReceiveVideo||r||this.addTransceiver("video",{direction:"recvonly"})}return e.apply(this,arguments)}}function vp(t){"object"!=typeof t||t.AudioContext||(t.AudioContext=t.webkitAudioContext)}var yp=Object.freeze({__proto__:null,shimLocalStreamsAPI:lp,shimRemoteStreamsAPI:cp,shimCallbacksAPI:up,shimGetUserMedia:dp,shimConstraints:pp,shimRTCIceServerUrls:fp,shimTrackEventTransceiver:mp,shimCreateOfferLegacy:gp,shimAudioContext:vp}),bp={exports:{}};!function(t){const e={generateIdentifier:function(){return Math.random().toString(36).substring(2,12)}};e.localCName=e.generateIdentifier(),e.splitLines=function(t){return t.trim().split("\n").map((t=>t.trim()))},e.splitSections=function(t){return t.split("\nm=").map(((t,e)=>(e>0?"m="+t:t).trim()+"\r\n"))},e.getDescription=function(t){const r=e.splitSections(t);return r&&r[0]},e.getMediaSections=function(t){const r=e.splitSections(t);return r.shift(),r},e.matchPrefix=function(t,r){return e.splitLines(t).filter((t=>0===t.indexOf(r)))},e.parseCandidate=function(t){let e;e=0===t.indexOf("a=candidate:")?t.substring(12).split(" "):t.substring(10).split(" ");const r={foundation:e[0],component:{1:"rtp",2:"rtcp"}[e[1]]||e[1],protocol:e[2].toLowerCase(),priority:parseInt(e[3],10),ip:e[4],address:e[4],port:parseInt(e[5],10),type:e[7]};for(let t=8;t<e.length;t+=2)switch(e[t]){case"raddr":r.relatedAddress=e[t+1];break;case"rport":r.relatedPort=parseInt(e[t+1],10);break;case"tcptype":r.tcpType=e[t+1];break;case"ufrag":r.ufrag=e[t+1],r.usernameFragment=e[t+1];break;default:void 0===r[e[t]]&&(r[e[t]]=e[t+1])}return r},e.writeCandidate=function(t){const e=[];e.push(t.foundation);const r=t.component;"rtp"===r?e.push(1):"rtcp"===r?e.push(2):e.push(r),e.push(t.protocol.toUpperCase()),e.push(t.priority),e.push(t.address||t.ip),e.push(t.port);const i=t.type;return e.push("typ"),e.push(i),"host"!==i&&t.relatedAddress&&t.relatedPort&&(e.push("raddr"),e.push(t.relatedAddress),e.push("rport"),e.push(t.relatedPort)),t.tcpType&&"tcp"===t.protocol.toLowerCase()&&(e.push("tcptype"),e.push(t.tcpType)),(t.usernameFragment||t.ufrag)&&(e.push("ufrag"),e.push(t.usernameFragment||t.ufrag)),"candidate:"+e.join(" ")},e.parseIceOptions=function(t){return t.substring(14).split(" ")},e.parseRtpMap=function(t){let e=t.substring(9).split(" ");const r={payloadType:parseInt(e.shift(),10)};return e=e[0].split("/"),r.name=e[0],r.clockRate=parseInt(e[1],10),r.channels=3===e.length?parseInt(e[2],10):1,r.numChannels=r.channels,r},e.writeRtpMap=function(t){let e=t.payloadType;void 0!==t.preferredPayloadType&&(e=t.preferredPayloadType);const r=t.channels||t.numChannels||1;return"a=rtpmap:"+e+" "+t.name+"/"+t.clockRate+(1!==r?"/"+r:"")+"\r\n"},e.parseExtmap=function(t){const e=t.substring(9).split(" ");return{id:parseInt(e[0],10),direction:e[0].indexOf("/")>0?e[0].split("/")[1]:"sendrecv",uri:e[1],attributes:e.slice(2).join(" ")}},e.writeExtmap=function(t){return"a=extmap:"+(t.id||t.preferredId)+(t.direction&&"sendrecv"!==t.direction?"/"+t.direction:"")+" "+t.uri+(t.attributes?" "+t.attributes:"")+"\r\n"},e.parseFmtp=function(t){const e={};let r;const i=t.substring(t.indexOf(" ")+1).split(";");for(let t=0;t<i.length;t++)r=i[t].trim().split("="),e[r[0].trim()]=r[1];return e},e.writeFmtp=function(t){let e="",r=t.payloadType;if(void 0!==t.preferredPayloadType&&(r=t.preferredPayloadType),t.parameters&&Object.keys(t.parameters).length){const i=[];Object.keys(t.parameters).forEach((e=>{void 0!==t.parameters[e]?i.push(e+"="+t.parameters[e]):i.push(e)})),e+="a=fmtp:"+r+" "+i.join(";")+"\r\n"}return e},e.parseRtcpFb=function(t){const e=t.substring(t.indexOf(" ")+1).split(" ");return{type:e.shift(),parameter:e.join(" ")}},e.writeRtcpFb=function(t){let e="",r=t.payloadType;return void 0!==t.preferredPayloadType&&(r=t.preferredPayloadType),t.rtcpFeedback&&t.rtcpFeedback.length&&t.rtcpFeedback.forEach((t=>{e+="a=rtcp-fb:"+r+" "+t.type+(t.parameter&&t.parameter.length?" "+t.parameter:"")+"\r\n"})),e},e.parseSsrcMedia=function(t){const e=t.indexOf(" "),r={ssrc:parseInt(t.substring(7,e),10)},i=t.indexOf(":",e);return i>-1?(r.attribute=t.substring(e+1,i),r.value=t.substring(i+1)):r.attribute=t.substring(e+1),r},e.parseSsrcGroup=function(t){const e=t.substring(13).split(" ");return{semantics:e.shift(),ssrcs:e.map((t=>parseInt(t,10)))}},e.getMid=function(t){const r=e.matchPrefix(t,"a=mid:")[0];if(r)return r.substring(6)},e.parseFingerprint=function(t){const e=t.substring(14).split(" ");return{algorithm:e[0].toLowerCase(),value:e[1].toUpperCase()}},e.getDtlsParameters=function(t,r){return{role:"auto",fingerprints:e.matchPrefix(t+r,"a=fingerprint:").map(e.parseFingerprint)}},e.writeDtlsParameters=function(t,e){let r="a=setup:"+e+"\r\n";return t.fingerprints.forEach((t=>{r+="a=fingerprint:"+t.algorithm+" "+t.value+"\r\n"})),r},e.parseCryptoLine=function(t){const e=t.substring(9).split(" ");return{tag:parseInt(e[0],10),cryptoSuite:e[1],keyParams:e[2],sessionParams:e.slice(3)}},e.writeCryptoLine=function(t){return"a=crypto:"+t.tag+" "+t.cryptoSuite+" "+("object"==typeof t.keyParams?e.writeCryptoKeyParams(t.keyParams):t.keyParams)+(t.sessionParams?" "+t.sessionParams.join(" "):"")+"\r\n"},e.parseCryptoKeyParams=function(t){if(0!==t.indexOf("inline:"))return null;const e=t.substring(7).split("|");return{keyMethod:"inline",keySalt:e[0],lifeTime:e[1],mkiValue:e[2]?e[2].split(":")[0]:void 0,mkiLength:e[2]?e[2].split(":")[1]:void 0}},e.writeCryptoKeyParams=function(t){return t.keyMethod+":"+t.keySalt+(t.lifeTime?"|"+t.lifeTime:"")+(t.mkiValue&&t.mkiLength?"|"+t.mkiValue+":"+t.mkiLength:"")},e.getCryptoParameters=function(t,r){return e.matchPrefix(t+r,"a=crypto:").map(e.parseCryptoLine)},e.getIceParameters=function(t,r){const i=e.matchPrefix(t+r,"a=ice-ufrag:")[0],n=e.matchPrefix(t+r,"a=ice-pwd:")[0];return i&&n?{usernameFragment:i.substring(12),password:n.substring(10)}:null},e.writeIceParameters=function(t){let e="a=ice-ufrag:"+t.usernameFragment+"\r\na=ice-pwd:"+t.password+"\r\n";return t.iceLite&&(e+="a=ice-lite\r\n"),e},e.parseRtpParameters=function(t){const r={codecs:[],headerExtensions:[],fecMechanisms:[],rtcp:[]},i=e.splitLines(t)[0].split(" ");r.profile=i[2];for(let n=3;n<i.length;n++){const s=i[n],o=e.matchPrefix(t,"a=rtpmap:"+s+" ")[0];if(o){const i=e.parseRtpMap(o),n=e.matchPrefix(t,"a=fmtp:"+s+" ");switch(i.parameters=n.length?e.parseFmtp(n[0]):{},i.rtcpFeedback=e.matchPrefix(t,"a=rtcp-fb:"+s+" ").map(e.parseRtcpFb),r.codecs.push(i),i.name.toUpperCase()){case"RED":case"ULPFEC":r.fecMechanisms.push(i.name.toUpperCase())}}}e.matchPrefix(t,"a=extmap:").forEach((t=>{r.headerExtensions.push(e.parseExtmap(t))}));const n=e.matchPrefix(t,"a=rtcp-fb:* ").map(e.parseRtcpFb);return r.codecs.forEach((t=>{n.forEach((e=>{t.rtcpFeedback.find((t=>t.type===e.type&&t.parameter===e.parameter))||t.rtcpFeedback.push(e)}))})),r},e.writeRtpDescription=function(t,r){let i="";i+="m="+t+" ",i+=r.codecs.length>0?"9":"0",i+=" "+(r.profile||"UDP/TLS/RTP/SAVPF")+" ",i+=r.codecs.map((t=>void 0!==t.preferredPayloadType?t.preferredPayloadType:t.payloadType)).join(" ")+"\r\n",i+="c=IN IP4 0.0.0.0\r\n",i+="a=rtcp:9 IN IP4 0.0.0.0\r\n",r.codecs.forEach((t=>{i+=e.writeRtpMap(t),i+=e.writeFmtp(t),i+=e.writeRtcpFb(t)}));let n=0;return r.codecs.forEach((t=>{t.maxptime>n&&(n=t.maxptime)})),n>0&&(i+="a=maxptime:"+n+"\r\n"),r.headerExtensions&&r.headerExtensions.forEach((t=>{i+=e.writeExtmap(t)})),i},e.parseRtpEncodingParameters=function(t){const r=[],i=e.parseRtpParameters(t),n=-1!==i.fecMechanisms.indexOf("RED"),s=-1!==i.fecMechanisms.indexOf("ULPFEC"),o=e.matchPrefix(t,"a=ssrc:").map((t=>e.parseSsrcMedia(t))).filter((t=>"cname"===t.attribute)),a=o.length>0&&o[0].ssrc;let h;const l=e.matchPrefix(t,"a=ssrc-group:FID").map((t=>t.substring(17).split(" ").map((t=>parseInt(t,10)))));l.length>0&&l[0].length>1&&l[0][0]===a&&(h=l[0][1]),i.codecs.forEach((t=>{if("RTX"===t.name.toUpperCase()&&t.parameters.apt){let e={ssrc:a,codecPayloadType:parseInt(t.parameters.apt,10)};a&&h&&(e.rtx={ssrc:h}),r.push(e),n&&(e=JSON.parse(JSON.stringify(e)),e.fec={ssrc:a,mechanism:s?"red+ulpfec":"red"},r.push(e))}})),0===r.length&&a&&r.push({ssrc:a});let c=e.matchPrefix(t,"b=");return c.length&&(c=0===c[0].indexOf("b=TIAS:")?parseInt(c[0].substring(7),10):0===c[0].indexOf("b=AS:")?1e3*parseInt(c[0].substring(5),10)*.95-16e3:void 0,r.forEach((t=>{t.maxBitrate=c}))),r},e.parseRtcpParameters=function(t){const r={},i=e.matchPrefix(t,"a=ssrc:").map((t=>e.parseSsrcMedia(t))).filter((t=>"cname"===t.attribute))[0];i&&(r.cname=i.value,r.ssrc=i.ssrc);const n=e.matchPrefix(t,"a=rtcp-rsize");r.reducedSize=n.length>0,r.compound=0===n.length;const s=e.matchPrefix(t,"a=rtcp-mux");return r.mux=s.length>0,r},e.writeRtcpParameters=function(t){let e="";return t.reducedSize&&(e+="a=rtcp-rsize\r\n"),t.mux&&(e+="a=rtcp-mux\r\n"),void 0!==t.ssrc&&t.cname&&(e+="a=ssrc:"+t.ssrc+" cname:"+t.cname+"\r\n"),e},e.parseMsid=function(t){let r;const i=e.matchPrefix(t,"a=msid:");if(1===i.length)return r=i[0].substring(7).split(" "),{stream:r[0],track:r[1]};const n=e.matchPrefix(t,"a=ssrc:").map((t=>e.parseSsrcMedia(t))).filter((t=>"msid"===t.attribute));return n.length>0?(r=n[0].value.split(" "),{stream:r[0],track:r[1]}):void 0},e.parseSctpDescription=function(t){const r=e.parseMLine(t),i=e.matchPrefix(t,"a=max-message-size:");let n;i.length>0&&(n=parseInt(i[0].substring(19),10)),isNaN(n)&&(n=65536);const s=e.matchPrefix(t,"a=sctp-port:");if(s.length>0)return{port:parseInt(s[0].substring(12),10),protocol:r.fmt,maxMessageSize:n};const o=e.matchPrefix(t,"a=sctpmap:");if(o.length>0){const t=o[0].substring(10).split(" ");return{port:parseInt(t[0],10),protocol:t[1],maxMessageSize:n}}},e.writeSctpDescription=function(t,e){let r=[];return r="DTLS/SCTP"!==t.protocol?["m="+t.kind+" 9 "+t.protocol+" "+e.protocol+"\r\n","c=IN IP4 0.0.0.0\r\n","a=sctp-port:"+e.port+"\r\n"]:["m="+t.kind+" 9 "+t.protocol+" "+e.port+"\r\n","c=IN IP4 0.0.0.0\r\n","a=sctpmap:"+e.port+" "+e.protocol+" 65535\r\n"],void 0!==e.maxMessageSize&&r.push("a=max-message-size:"+e.maxMessageSize+"\r\n"),r.join("")},e.generateSessionId=function(){return Math.random().toString().substr(2,22)},e.writeSessionBoilerplate=function(t,r,i){let n;const s=void 0!==r?r:2;n=t||e.generateSessionId();return"v=0\r\no="+(i||"thisisadapterortc")+" "+n+" "+s+" IN IP4 127.0.0.1\r\ns=-\r\nt=0 0\r\n"},e.getDirection=function(t,r){const i=e.splitLines(t);for(let t=0;t<i.length;t++)switch(i[t]){case"a=sendrecv":case"a=sendonly":case"a=recvonly":case"a=inactive":return i[t].substring(2)}return r?e.getDirection(r):"sendrecv"},e.getKind=function(t){return e.splitLines(t)[0].split(" ")[0].substring(2)},e.isRejected=function(t){return"0"===t.split(" ",2)[1]},e.parseMLine=function(t){const r=e.splitLines(t)[0].substring(2).split(" ");return{kind:r[0],port:parseInt(r[1],10),protocol:r[2],fmt:r.slice(3).join(" ")}},e.parseOLine=function(t){const r=e.matchPrefix(t,"o=")[0].substring(2).split(" ");return{username:r[0],sessionId:r[1],sessionVersion:parseInt(r[2],10),netType:r[3],addressType:r[4],address:r[5]}},e.isValidSDP=function(t){if("string"!=typeof t||0===t.length)return!1;const r=e.splitLines(t);for(let t=0;t<r.length;t++)if(r[t].length<2||"="!==r[t].charAt(1))return!1;return!0},t.exports=e}(bp);var _p=bp.exports,xp=t({__proto__:null,default:_p},[bp.exports]);function Tp(t){if(!t.RTCIceCandidate||t.RTCIceCandidate&&"foundation"in t.RTCIceCandidate.prototype)return;const e=t.RTCIceCandidate;t.RTCIceCandidate=function(t){if("object"==typeof t&&t.candidate&&0===t.candidate.indexOf("a=")&&((t=JSON.parse(JSON.stringify(t))).candidate=t.candidate.substring(2)),t.candidate&&t.candidate.length){const r=new e(t),i=_p.parseCandidate(t.candidate);for(const t in i)t in r||Object.defineProperty(r,t,{value:i[t]});return r.toJSON=function(){return{candidate:r.candidate,sdpMid:r.sdpMid,sdpMLineIndex:r.sdpMLineIndex,usernameFragment:r.usernameFragment}},r}return new e(t)},t.RTCIceCandidate.prototype=e.prototype,Id(t,"icecandidate",(e=>(e.candidate&&Object.defineProperty(e,"candidate",{value:new t.RTCIceCandidate(e.candidate),writable:"false"}),e)))}function wp(t){!t.RTCIceCandidate||t.RTCIceCandidate&&"relayProtocol"in t.RTCIceCandidate.prototype||Id(t,"icecandidate",(t=>{if(t.candidate){const e=_p.parseCandidate(t.candidate.candidate);"relay"===e.type&&(t.candidate.relayProtocol={0:"tls",1:"tcp",2:"udp"}[e.priority>>24])}return t}))}function Sp(t,e){if(!t.RTCPeerConnection)return;"sctp"in t.RTCPeerConnection.prototype||Object.defineProperty(t.RTCPeerConnection.prototype,"sctp",{get(){return void 0===this._sctp?null:this._sctp}});const r=function(t){if(!t||!t.sdp)return!1;const e=_p.splitSections(t.sdp);return e.shift(),e.some((t=>{const e=_p.parseMLine(t);return e&&"application"===e.kind&&-1!==e.protocol.indexOf("SCTP")}))},i=function(t){const e=t.sdp.match(/mozilla...THIS_IS_SDPARTA-(\d+)/);if(null===e||e.length<2)return-1;const r=parseInt(e[1],10);return r!=r?-1:r},n=function(t){let r=65536;return"firefox"===e.browser&&(r=e.version<57?-1===t?16384:2147483637:e.version<60?57===e.version?65535:65536:2147483637),r},s=function(t,r){let i=65536;"firefox"===e.browser&&57===e.version&&(i=65535);const n=_p.matchPrefix(t.sdp,"a=max-message-size:");return n.length>0?i=parseInt(n[0].substring(19),10):"firefox"===e.browser&&-1!==r&&(i=2147483637),i},o=t.RTCPeerConnection.prototype.setRemoteDescription;t.RTCPeerConnection.prototype.setRemoteDescription=function(){if(this._sctp=null,"chrome"===e.browser&&e.version>=76){const{sdpSemantics:t}=this.getConfiguration();"plan-b"===t&&Object.defineProperty(this,"sctp",{get(){return void 0===this._sctp?null:this._sctp},enumerable:!0,configurable:!0})}if(r(arguments[0])){const t=i(arguments[0]),e=n(t),r=s(arguments[0],t);let o;o=0===e&&0===r?Number.POSITIVE_INFINITY:0===e||0===r?Math.max(e,r):Math.min(e,r);const a={};Object.defineProperty(a,"maxMessageSize",{get:()=>o}),this._sctp=a}return o.apply(this,arguments)}}function Ep(t){if(!t.RTCPeerConnection||!("createDataChannel"in t.RTCPeerConnection.prototype))return;function e(t,e){const r=t.send;t.send=function(){const i=arguments[0],n=i.length||i.size||i.byteLength;if("open"===t.readyState&&e.sctp&&n>e.sctp.maxMessageSize)throw new TypeError("Message too large (can send a maximum of "+e.sctp.maxMessageSize+" bytes)");return r.apply(t,arguments)}}const r=t.RTCPeerConnection.prototype.createDataChannel;t.RTCPeerConnection.prototype.createDataChannel=function(){const t=r.apply(this,arguments);return e(t,this),t},Id(t,"datachannel",(t=>(e(t.channel,t.target),t)))}function Cp(t){if(!t.RTCPeerConnection||"connectionState"in t.RTCPeerConnection.prototype)return;const e=t.RTCPeerConnection.prototype;Object.defineProperty(e,"connectionState",{get(){return{completed:"connected",checking:"connecting"}[this.iceConnectionState]||this.iceConnectionState},enumerable:!0,configurable:!0}),Object.defineProperty(e,"onconnectionstatechange",{get(){return this._onconnectionstatechange||null},set(t){this._onconnectionstatechange&&(this.removeEventListener("connectionstatechange",this._onconnectionstatechange),delete this._onconnectionstatechange),t&&this.addEventListener("connectionstatechange",this._onconnectionstatechange=t)},enumerable:!0,configurable:!0}),["setLocalDescription","setRemoteDescription"].forEach((t=>{const r=e[t];e[t]=function(){return this._connectionstatechangepoly||(this._connectionstatechangepoly=t=>{const e=t.target;if(e._lastConnectionState!==e.connectionState){e._lastConnectionState=e.connectionState;const r=new Event("connectionstatechange",t);e.dispatchEvent(r)}return t},this.addEventListener("iceconnectionstatechange",this._connectionstatechangepoly)),r.apply(this,arguments)}}))}function Ap(t,e){if(!t.RTCPeerConnection)return;if("chrome"===e.browser&&e.version>=71)return;if("safari"===e.browser&&e.version>=605)return;const r=t.RTCPeerConnection.prototype.setRemoteDescription;t.RTCPeerConnection.prototype.setRemoteDescription=function(e){if(e&&e.sdp&&-1!==e.sdp.indexOf("\na=extmap-allow-mixed")){const r=e.sdp.split("\n").filter((t=>"a=extmap-allow-mixed"!==t.trim())).join("\n");t.RTCSessionDescription&&e instanceof t.RTCSessionDescription?arguments[0]=new t.RTCSessionDescription({type:e.type,sdp:r}):e.sdp=r}return r.apply(this,arguments)}}function Rp(t,e){if(!t.RTCPeerConnection||!t.RTCPeerConnection.prototype)return;const r=t.RTCPeerConnection.prototype.addIceCandidate;r&&0!==r.length&&(t.RTCPeerConnection.prototype.addIceCandidate=function(){return arguments[0]?("chrome"===e.browser&&e.version<78||"firefox"===e.browser&&e.version<68||"safari"===e.browser)&&arguments[0]&&""===arguments[0].candidate?Promise.resolve():r.apply(this,arguments):(arguments[1]&&arguments[1].apply(null),Promise.resolve())})}function Pp(t,e){if(!t.RTCPeerConnection||!t.RTCPeerConnection.prototype)return;const r=t.RTCPeerConnection.prototype.setLocalDescription;r&&0!==r.length&&(t.RTCPeerConnection.prototype.setLocalDescription=function(){let t=arguments[0]||{};if("object"!=typeof t||t.type&&t.sdp)return r.apply(this,arguments);if(t={type:t.type,sdp:t.sdp},!t.type)switch(this.signalingState){case"stable":case"have-local-offer":case"have-remote-pranswer":t.type="offer";break;default:t.type="answer"}if(t.sdp||"offer"!==t.type&&"answer"!==t.type)return r.apply(this,[t]);const e="offer"===t.type?this.createOffer:this.createAnswer;return e.apply(this).then((t=>r.apply(this,[t])))})}var Ip=Object.freeze({__proto__:null,shimRTCIceCandidate:Tp,shimRTCIceCandidateRelayProtocol:wp,shimMaxMessageSize:Sp,shimSendThrowTypeError:Ep,shimConnectionState:Cp,removeExtmapAllowMixed:Ap,shimAddIceCandidateNullOrEmpty:Rp,shimParameterlessSetLocalDescription:Pp});const Mp=function({window:t}={},e={shimChrome:!0,shimFirefox:!0,shimSafari:!0}){const r=kd,i=function(t){const e={browser:null,version:null};if(void 0===t||!t.navigator||!t.navigator.userAgent)return e.browser="Not a browser.",e;const{navigator:r}=t;if(r.mozGetUserMedia)e.browser="firefox",e.version=Pd(r.userAgent,/Firefox\/(\d+)\./,1);else if(r.webkitGetUserMedia||!1===t.isSecureContext&&t.webkitRTCPeerConnection)e.browser="chrome",e.version=Pd(r.userAgent,/Chrom(e|ium)\/(\d+)\./,2);else{if(!t.RTCPeerConnection||!r.userAgent.match(/AppleWebKit\/(\d+)\./))return e.browser="Not a supported browser.",e;e.browser="safari",e.version=Pd(r.userAgent,/AppleWebKit\/(\d+)\./,1),e.supportsUnifiedPlan=t.RTCRtpTransceiver&&"currentDirection"in t.RTCRtpTransceiver.prototype}return e}(t),n={browserDetails:i,commonShim:Ip,extractVersion:Pd,disableLog:Md,disableWarnings:Od,sdp:xp};switch(i.browser){case"chrome":if(!Kd||!Zd||!e.shimChrome)return r("Chrome shim is not included in this adapter release."),n;if(null===i.version)return r("Chrome shim can not determine version, not shimming."),n;r("adapter.js shimming chrome."),n.browserShim=Kd,Rp(t,i),Pp(t),Gd(t,i),jd(t),Zd(t,i),Vd(t),Yd(t,i),Hd(t),Wd(t),Xd(t),$d(t,i),Tp(t),wp(t),Cp(t),Sp(t,i),Ep(t),Ap(t,i);break;case"firefox":if(!hp||!Qd||!e.shimFirefox)return r("Firefox shim is not included in this adapter release."),n;r("adapter.js shimming firefox."),n.browserShim=hp,Rp(t,i),Pp(t),Jd(t,i),Qd(t,i),qd(t),rp(t),tp(t),ep(t),ip(t),np(t),sp(t),op(t),ap(t),Tp(t),Cp(t),Sp(t,i),Ep(t);break;case"safari":if(!yp||!e.shimSafari)return r("Safari shim is not included in this adapter release."),n;r("adapter.js shimming safari."),n.browserShim=yp,Rp(t,i),Pp(t),fp(t),gp(t),up(t),lp(t),cp(t),mp(t),dp(t),vp(t),Tp(t),wp(t),Sp(t,i),Ep(t),Ap(t,i);break;default:r("Unsupported browser!")}return n}({window:"undefined"==typeof window?void 0:window});let Op=(t=21)=>crypto.getRandomValues(new Uint8Array(t)).reduce(((t,e)=>t+=(e&=63)<36?e.toString(36):e<62?(e-26).toString(36).toUpperCase():e>62?"-":"_"),"");var kp={exports:{}},Dp=1e3,Lp=6e4,Np=60*Lp,Fp=24*Np,Bp=7*Fp,Up=365.25*Fp,Gp=function(t,e){e=e||{};var r=typeof t;if("string"===r&&t.length>0)return function(t){if((t=String(t)).length>100)return;var e=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(t);if(!e)return;var r=parseFloat(e[1]);switch((e[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return r*Up;case"weeks":case"week":case"w":return r*Bp;case"days":case"day":case"d":return r*Fp;case"hours":case"hour":case"hrs":case"hr":case"h":return r*Np;case"minutes":case"minute":case"mins":case"min":case"m":return r*Lp;case"seconds":case"second":case"secs":case"sec":case"s":return r*Dp;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return r;default:return}}(t);if("number"===r&&isFinite(t))return e.long?function(t){var e=Math.abs(t);if(e>=Fp)return jp(t,e,Fp,"day");if(e>=Np)return jp(t,e,Np,"hour");if(e>=Lp)return jp(t,e,Lp,"minute");if(e>=Dp)return jp(t,e,Dp,"second");return t+" ms"}(t):function(t){var e=Math.abs(t);if(e>=Fp)return Math.round(t/Fp)+"d";if(e>=Np)return Math.round(t/Np)+"h";if(e>=Lp)return Math.round(t/Lp)+"m";if(e>=Dp)return Math.round(t/Dp)+"s";return t+"ms"}(t);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(t))};function jp(t,e,r,i){var n=e>=1.5*r;return Math.round(t/r)+" "+i+(n?"s":"")}var Vp=function(t){function e(t){let i,n,s,o=null;function a(...t){if(!a.enabled)return;const r=a,n=Number(new Date),s=n-(i||n);r.diff=s,r.prev=i,r.curr=n,i=n,t[0]=e.coerce(t[0]),"string"!=typeof t[0]&&t.unshift("%O");let o=0;t[0]=t[0].replace(/%([a-zA-Z%])/g,((i,n)=>{if("%%"===i)return"%";o++;const s=e.formatters[n];if("function"==typeof s){const e=t[o];i=s.call(r,e),t.splice(o,1),o--}return i})),e.formatArgs.call(r,t);(r.log||e.log).apply(r,t)}return a.namespace=t,a.useColors=e.useColors(),a.color=e.selectColor(t),a.extend=r,a.destroy=e.destroy,Object.defineProperty(a,"enabled",{enumerable:!0,configurable:!1,get:()=>null!==o?o:(n!==e.namespaces&&(n=e.namespaces,s=e.enabled(t)),s),set:t=>{o=t}}),"function"==typeof e.init&&e.init(a),a}function r(t,r){const i=e(this.namespace+(void 0===r?":":r)+t);return i.log=this.log,i}function i(t){return t.toString().substring(2,t.toString().length-2).replace(/\.\*\?$/,"*")}return e.debug=e,e.default=e,e.coerce=function(t){if(t instanceof Error)return t.stack||t.message;return t},e.disable=function(){const t=[...e.names.map(i),...e.skips.map(i).map((t=>"-"+t))].join(",");return e.enable(""),t},e.enable=function(t){let r;e.save(t),e.namespaces=t,e.names=[],e.skips=[];const i=("string"==typeof t?t:"").split(/[\s,]+/),n=i.length;for(r=0;r<n;r++)i[r]&&("-"===(t=i[r].replace(/\*/g,".*?"))[0]?e.skips.push(new RegExp("^"+t.slice(1)+"$")):e.names.push(new RegExp("^"+t+"$")))},e.enabled=function(t){if("*"===t[t.length-1])return!0;let r,i;for(r=0,i=e.skips.length;r<i;r++)if(e.skips[r].test(t))return!1;for(r=0,i=e.names.length;r<i;r++)if(e.names[r].test(t))return!0;return!1},e.humanize=Gp,e.destroy=function(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")},Object.keys(t).forEach((r=>{e[r]=t[r]})),e.names=[],e.skips=[],e.formatters={},e.selectColor=function(t){let r=0;for(let e=0;e<t.length;e++)r=(r<<5)-r+t.charCodeAt(e),r|=0;return e.colors[Math.abs(r)%e.colors.length]},e.enable(e.load()),e};!function(t,e){e.formatArgs=function(e){if(e[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+e[0]+(this.useColors?"%c ":" ")+"+"+t.exports.humanize(this.diff),!this.useColors)return;const r="color: "+this.color;e.splice(1,0,r,"color: inherit");let i=0,n=0;e[0].replace(/%[a-zA-Z%]/g,(t=>{"%%"!==t&&(i++,"%c"===t&&(n=i))})),e.splice(n,0,r)},e.save=function(t){try{t?e.storage.setItem("debug",t):e.storage.removeItem("debug")}catch(t){}},e.load=function(){let t;try{t=e.storage.getItem("debug")}catch(t){}!t&&"undefined"!=typeof process&&"env"in process&&(t=process.env.DEBUG);return t},e.useColors=function(){if("undefined"!=typeof window&&window.process&&("renderer"===window.process.type||window.process.__nwjs))return!0;if("undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;return"undefined"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)},e.storage=function(){try{return localStorage}catch(t){}}(),e.destroy=(()=>{let t=!1;return()=>{t||(t=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})(),e.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],e.log=console.debug||console.log||(()=>{}),t.exports=Vp(e);const{formatters:r}=t.exports;r.j=function(t){try{return JSON.stringify(t)}catch(t){return"[UnexpectedJSONParseError]: "+t.message}}}(kp,kp.exports);var Hp,Wp,Xp=kp.exports,zp="max-width:100%;max-height:100%;object-fit:contain;display:block;margin:0 auto;",Yp={"120p":{width:160,height:120,frameRate:15,bitrate:200},"180p":{width:320,height:180,frameRate:15,bitrate:350},"240p":{width:320,height:240,frameRate:15,bitrate:400},"360p":{width:640,height:360,frameRate:15,bitrate:800},"480p":{width:640,height:480,frameRate:15,bitrate:900},"720p":{width:1280,height:720,frameRate:15,bitrate:1500},"1080p":{width:1920,height:1080,frameRate:15,bitrate:2e3},"2K":{width:2560,height:1440,frameRate:30,bitrate:4860},"4K":{width:3840,height:2160,frameRate:30,bitrate:9e3}},Zp={standard:{sampleRate:48e3,bitrate:40},high:{sampleRate:48e3,bitrate:128}};!function(t){t[t.TXLIVE_ERROR_WEBRTC_FAILED=-1]="TXLIVE_ERROR_WEBRTC_FAILED",t[t.TXLIVE_ERROR_REQUEST_FAILED=-2]="TXLIVE_ERROR_REQUEST_FAILED",t[t.TXLIVE_WARNING_CAMERA_START_FAILED=-1001]="TXLIVE_WARNING_CAMERA_START_FAILED",t[t.TXLIVE_WARNING_MICROPHONE_START_FAILED=-1002]="TXLIVE_WARNING_MICROPHONE_START_FAILED",t[t.TXLIVE_WARNING_SCREEN_CAPTURE_START_FAILED=-1003]="TXLIVE_WARNING_SCREEN_CAPTURE_START_FAILED",t[t.TXLIVE_WARNING_VIRTUAL_CAMERA_START_FAILED=-1004]="TXLIVE_WARNING_VIRTUAL_CAMERA_START_FAILED",t[t.TXLIVE_WARNING_CAMERA_INTERRUPTED=-1005]="TXLIVE_WARNING_CAMERA_INTERRUPTED",t[t.TXLIVE_WARNING_MICROPHONE_INTERRUPTED=-1006]="TXLIVE_WARNING_MICROPHONE_INTERRUPTED",t[t.TXLIVE_WARNING_SCREEN_CAPTURE_INTERRUPTED=-1007]="TXLIVE_WARNING_SCREEN_CAPTURE_INTERRUPTED"}(Hp||(Hp={})),function(t){t[t.TXLIVE_PUSH_STATUS_DISCONNECTED=0]="TXLIVE_PUSH_STATUS_DISCONNECTED",t[t.TXLIVE_PUSH_STATUS_CONNECTING=1]="TXLIVE_PUSH_STATUS_CONNECTING",t[t.TXLIVE_PUSH_STATUS_CONNECTED=2]="TXLIVE_PUSH_STATUS_CONNECTED",t[t.TXLIVE_PUSH_STATUS_RECONNECTING=3]="TXLIVE_PUSH_STATUS_RECONNECTING"}(Wp||(Wp={}));var $p,Kp,Jp="disconnected",qp="connecting",Qp="connected",tf="request_push_start",ef="request_push_success",rf=["device","screen","file"],nf={deviceId:"",frameRate:15,resolution:{width:1280,height:720}},sf={deviceId:"",sampleRate:48e3,echoCancellation:!0,noiseSuppression:!0,autoGainControl:!0},of=["image/bmp","image/jpeg","image/png"],af=[".bmp",".jpeg",".jpg",".png"],hf={type:gc($p=["video/mp4","video/webm","video/ogg","audio/mpeg","audio/ogg","audio/wav"]).call($p,of),extension:gc(Kp=[".mp4",".webm",".ogg",".mp3",".wav"]).call(Kp,af)},lf="track_stop",cf="stream_stop",uf=["user","environment"],df="object"==typeof global&&global&&global.Object===Object&&global,pf="object"==typeof self&&self&&self.Object===Object&&self,ff=df||pf||Function("return this")(),mf=ff.Symbol,gf=Object.prototype,vf=gf.hasOwnProperty,yf=gf.toString,bf=mf?mf.toStringTag:void 0;var _f=Object.prototype.toString;var xf=mf?mf.toStringTag:void 0;function Tf(t){return null==t?void 0===t?"[object Undefined]":"[object Null]":xf&&xf in Object(t)?function(t){var e=vf.call(t,bf),r=t[bf];try{t[bf]=void 0;var i=!0}catch(t){}var n=yf.call(t);return i&&(e?t[bf]=r:delete t[bf]),n}(t):function(t){return _f.call(t)}(t)}function wf(t){return null!=t&&"object"==typeof t}var Sf=Array.isArray;function Ef(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)}function Cf(t){return t}function Af(t){if(!Ef(t))return!1;var e=Tf(t);return"[object Function]"==e||"[object GeneratorFunction]"==e||"[object AsyncFunction]"==e||"[object Proxy]"==e}var Rf=ff["__core-js_shared__"],Pf=function(){var t=/[^.]+$/.exec(Rf&&Rf.keys&&Rf.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""}();var If=Function.prototype.toString;function Mf(t){if(null!=t){try{return If.call(t)}catch(t){}try{return t+""}catch(t){}}return""}var Of=/^\[object .+?Constructor\]$/,kf=Function.prototype,Df=Object.prototype,Lf=kf.toString,Nf=Df.hasOwnProperty,Ff=RegExp("^"+Lf.call(Nf).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function Bf(t){return!(!Ef(t)||(e=t,Pf&&Pf in e))&&(Af(t)?Ff:Of).test(Mf(t));var e}function Uf(t,e){var r=function(t,e){return null==t?void 0:t[e]}(t,e);return Bf(r)?r:void 0}var Gf=Uf(ff,"WeakMap"),jf=Object.create,Vf=function(){function t(){}return function(e){if(!Ef(e))return{};if(jf)return jf(e);t.prototype=e;var r=new t;return t.prototype=void 0,r}}();function Hf(t,e,r){switch(r.length){case 0:return t.call(e);case 1:return t.call(e,r[0]);case 2:return t.call(e,r[0],r[1]);case 3:return t.call(e,r[0],r[1],r[2])}return t.apply(e,r)}var Wf=Date.now;var Xf,zf,Yf,Zf=function(){try{var t=Uf(Object,"defineProperty");return t({},"",{}),t}catch(t){}}(),$f=Zf,Kf=$f?function(t,e){return $f(t,"toString",{configurable:!0,enumerable:!1,value:(r=e,function(){return r}),writable:!0});var r}:Cf,Jf=(Xf=Kf,zf=0,Yf=0,function(){var t=Wf(),e=16-(t-Yf);if(Yf=t,e>0){if(++zf>=800)return arguments[0]}else zf=0;return Xf.apply(void 0,arguments)}),qf=Jf;function Qf(t){return t!=t}function tm(t,e){return!!(null==t?0:t.length)&&function(t,e,r){return e==e?function(t,e,r){for(var i=r-1,n=t.length;++i<n;)if(t[i]===e)return i;return-1}(t,e,r):function(t,e,r,i){for(var n=t.length,s=r+(i?1:-1);i?s--:++s<n;)if(e(t[s],s,t))return s;return-1}(t,Qf,r)}(t,e,0)>-1}var em=/^(?:0|[1-9]\d*)$/;function rm(t,e){var r=typeof t;return!!(e=null==e?9007199254740991:e)&&("number"==r||"symbol"!=r&&em.test(t))&&t>-1&&t%1==0&&t<e}function im(t,e,r){"__proto__"==e&&$f?$f(t,e,{configurable:!0,enumerable:!0,value:r,writable:!0}):t[e]=r}function nm(t,e){return t===e||t!=t&&e!=e}var sm=Object.prototype.hasOwnProperty;function om(t,e,r){var i=t[e];sm.call(t,e)&&nm(i,r)&&(void 0!==r||e in t)||im(t,e,r)}function am(t,e,r,i){var n=!r;r||(r={});for(var s=-1,o=e.length;++s<o;){var a=e[s],h=i?i(r[a],t[a],a,r,t):void 0;void 0===h&&(h=t[a]),n?im(r,a,h):om(r,a,h)}return r}var hm=Math.max;function lm(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=9007199254740991}function cm(t){return null!=t&&lm(t.length)&&!Af(t)}var um=Object.prototype;function dm(t){var e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||um)}function pm(t){return wf(t)&&"[object Arguments]"==Tf(t)}var fm=Object.prototype,mm=fm.hasOwnProperty,gm=fm.propertyIsEnumerable,vm=pm(function(){return arguments}())?pm:function(t){return wf(t)&&mm.call(t,"callee")&&!gm.call(t,"callee")},ym=vm;var bm="object"==typeof exports&&exports&&!exports.nodeType&&exports,_m=bm&&"object"==typeof module&&module&&!module.nodeType&&module,xm=_m&&_m.exports===bm?ff.Buffer:void 0,Tm=(xm?xm.isBuffer:void 0)||function(){return!1},wm={};function Sm(t){return function(e){return t(e)}}wm["[object Float32Array]"]=wm["[object Float64Array]"]=wm["[object Int8Array]"]=wm["[object Int16Array]"]=wm["[object Int32Array]"]=wm["[object Uint8Array]"]=wm["[object Uint8ClampedArray]"]=wm["[object Uint16Array]"]=wm["[object Uint32Array]"]=!0,wm["[object Arguments]"]=wm["[object Array]"]=wm["[object ArrayBuffer]"]=wm["[object Boolean]"]=wm["[object DataView]"]=wm["[object Date]"]=wm["[object Error]"]=wm["[object Function]"]=wm["[object Map]"]=wm["[object Number]"]=wm["[object Object]"]=wm["[object RegExp]"]=wm["[object Set]"]=wm["[object String]"]=wm["[object WeakMap]"]=!1;var Em="object"==typeof exports&&exports&&!exports.nodeType&&exports,Cm=Em&&"object"==typeof module&&module&&!module.nodeType&&module,Am=Cm&&Cm.exports===Em&&df.process,Rm=function(){try{var t=Cm&&Cm.require&&Cm.require("util").types;return t||Am&&Am.binding&&Am.binding("util")}catch(t){}}(),Pm=Rm&&Rm.isTypedArray,Im=Pm?Sm(Pm):function(t){return wf(t)&&lm(t.length)&&!!wm[Tf(t)]},Mm=Object.prototype.hasOwnProperty;function Om(t,e){var r=Sf(t),i=!r&&ym(t),n=!r&&!i&&Tm(t),s=!r&&!i&&!n&&Im(t),o=r||i||n||s,a=o?function(t,e){for(var r=-1,i=Array(t);++r<t;)i[r]=e(r);return i}(t.length,String):[],h=a.length;for(var l in t)!e&&!Mm.call(t,l)||o&&("length"==l||n&&("offset"==l||"parent"==l)||s&&("buffer"==l||"byteLength"==l||"byteOffset"==l)||rm(l,h))||a.push(l);return a}function km(t,e){return function(r){return t(e(r))}}var Dm=km(Object.keys,Object),Lm=Object.prototype.hasOwnProperty;function Nm(t){return cm(t)?Om(t):function(t){if(!dm(t))return Dm(t);var e=[];for(var r in Object(t))Lm.call(t,r)&&"constructor"!=r&&e.push(r);return e}(t)}var Fm=Object.prototype.hasOwnProperty;function Bm(t){if(!Ef(t))return function(t){var e=[];if(null!=t)for(var r in Object(t))e.push(r);return e}(t);var e=dm(t),r=[];for(var i in t)("constructor"!=i||!e&&Fm.call(t,i))&&r.push(i);return r}function Um(t){return cm(t)?Om(t,!0):Bm(t)}var Gm=Uf(Object,"create");var jm=Object.prototype.hasOwnProperty;var Vm=Object.prototype.hasOwnProperty;function Hm(t){var e=-1,r=null==t?0:t.length;for(this.clear();++e<r;){var i=t[e];this.set(i[0],i[1])}}function Wm(t,e){for(var r=t.length;r--;)if(nm(t[r][0],e))return r;return-1}Hm.prototype.clear=function(){this.__data__=Gm?Gm(null):{},this.size=0},Hm.prototype.delete=function(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e},Hm.prototype.get=function(t){var e=this.__data__;if(Gm){var r=e[t];return"__lodash_hash_undefined__"===r?void 0:r}return jm.call(e,t)?e[t]:void 0},Hm.prototype.has=function(t){var e=this.__data__;return Gm?void 0!==e[t]:Vm.call(e,t)},Hm.prototype.set=function(t,e){var r=this.__data__;return this.size+=this.has(t)?0:1,r[t]=Gm&&void 0===e?"__lodash_hash_undefined__":e,this};var Xm=Array.prototype.splice;function zm(t){var e=-1,r=null==t?0:t.length;for(this.clear();++e<r;){var i=t[e];this.set(i[0],i[1])}}zm.prototype.clear=function(){this.__data__=[],this.size=0},zm.prototype.delete=function(t){var e=this.__data__,r=Wm(e,t);return!(r<0)&&(r==e.length-1?e.pop():Xm.call(e,r,1),--this.size,!0)},zm.prototype.get=function(t){var e=this.__data__,r=Wm(e,t);return r<0?void 0:e[r][1]},zm.prototype.has=function(t){return Wm(this.__data__,t)>-1},zm.prototype.set=function(t,e){var r=this.__data__,i=Wm(r,t);return i<0?(++this.size,r.push([t,e])):r[i][1]=e,this};var Ym=Uf(ff,"Map");function Zm(t,e){var r,i,n=t.__data__;return("string"==(i=typeof(r=e))||"number"==i||"symbol"==i||"boolean"==i?"__proto__"!==r:null===r)?n["string"==typeof e?"string":"hash"]:n.map}function $m(t){var e=-1,r=null==t?0:t.length;for(this.clear();++e<r;){var i=t[e];this.set(i[0],i[1])}}function Km(t,e){for(var r=-1,i=e.length,n=t.length;++r<i;)t[n+r]=e[r];return t}$m.prototype.clear=function(){this.size=0,this.__data__={hash:new Hm,map:new(Ym||zm),string:new Hm}},$m.prototype.delete=function(t){var e=Zm(this,t).delete(t);return this.size-=e?1:0,e},$m.prototype.get=function(t){return Zm(this,t).get(t)},$m.prototype.has=function(t){return Zm(this,t).has(t)},$m.prototype.set=function(t,e){var r=Zm(this,t),i=r.size;return r.set(t,e),this.size+=r.size==i?0:1,this};var Jm=mf?mf.isConcatSpreadable:void 0;function qm(t){return Sf(t)||ym(t)||!!(Jm&&t&&t[Jm])}function Qm(t,e,r,i,n){var s=-1,o=t.length;for(r||(r=qm),n||(n=[]);++s<o;){var a=t[s];e>0&&r(a)?e>1?Qm(a,e-1,r,i,n):Km(n,a):i||(n[n.length]=a)}return n}var tg=km(Object.getPrototypeOf,Object);function eg(t){var e=this.__data__=new zm(t);this.size=e.size}eg.prototype.clear=function(){this.__data__=new zm,this.size=0},eg.prototype.delete=function(t){var e=this.__data__,r=e.delete(t);return this.size=e.size,r},eg.prototype.get=function(t){return this.__data__.get(t)},eg.prototype.has=function(t){return this.__data__.has(t)},eg.prototype.set=function(t,e){var r=this.__data__;if(r instanceof zm){var i=r.__data__;if(!Ym||i.length<199)return i.push([t,e]),this.size=++r.size,this;r=this.__data__=new $m(i)}return r.set(t,e),this.size=r.size,this};var rg="object"==typeof exports&&exports&&!exports.nodeType&&exports,ig=rg&&"object"==typeof module&&module&&!module.nodeType&&module,ng=ig&&ig.exports===rg?ff.Buffer:void 0,sg=ng?ng.allocUnsafe:void 0;function og(){return[]}var ag=Object.prototype.propertyIsEnumerable,hg=Object.getOwnPropertySymbols,lg=hg?function(t){return null==t?[]:(t=Object(t),function(t,e){for(var r=-1,i=null==t?0:t.length,n=0,s=[];++r<i;){var o=t[r];e(o,r,t)&&(s[n++]=o)}return s}(hg(t),(function(e){return ag.call(t,e)})))}:og,cg=lg;var ug=Object.getOwnPropertySymbols?function(t){for(var e=[];t;)Km(e,cg(t)),t=tg(t);return e}:og;function dg(t,e,r){var i=e(t);return Sf(t)?i:Km(i,r(t))}function pg(t){return dg(t,Nm,cg)}function fg(t){return dg(t,Um,ug)}var mg=Uf(ff,"DataView"),gg=Uf(ff,"Promise"),vg=Uf(ff,"Set"),yg="[object Map]",bg="[object Promise]",_g="[object Set]",xg="[object WeakMap]",Tg="[object DataView]",wg=Mf(mg),Sg=Mf(Ym),Eg=Mf(gg),Cg=Mf(vg),Ag=Mf(Gf),Rg=Tf;(mg&&Rg(new mg(new ArrayBuffer(1)))!=Tg||Ym&&Rg(new Ym)!=yg||gg&&Rg(gg.resolve())!=bg||vg&&Rg(new vg)!=_g||Gf&&Rg(new Gf)!=xg)&&(Rg=function(t){var e=Tf(t),r="[object Object]"==e?t.constructor:void 0,i=r?Mf(r):"";if(i)switch(i){case wg:return Tg;case Sg:return yg;case Eg:return bg;case Cg:return _g;case Ag:return xg}return e});var Pg=Rg,Ig=Object.prototype.hasOwnProperty;var Mg=ff.Uint8Array;function Og(t){var e=new t.constructor(t.byteLength);return new Mg(e).set(new Mg(t)),e}var kg=/\w*$/;var Dg=mf?mf.prototype:void 0,Lg=Dg?Dg.valueOf:void 0;function Ng(t,e,r){var i,n,s=t.constructor;switch(e){case"[object ArrayBuffer]":return Og(t);case"[object Boolean]":case"[object Date]":return new s(+t);case"[object DataView]":return function(t,e){var r=e?Og(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.byteLength)}(t,r);case"[object Float32Array]":case"[object Float64Array]":case"[object Int8Array]":case"[object Int16Array]":case"[object Int32Array]":case"[object Uint8Array]":case"[object Uint8ClampedArray]":case"[object Uint16Array]":case"[object Uint32Array]":return function(t,e){var r=e?Og(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.length)}(t,r);case"[object Map]":case"[object Set]":return new s;case"[object Number]":case"[object String]":return new s(t);case"[object RegExp]":return(n=new(i=t).constructor(i.source,kg.exec(i))).lastIndex=i.lastIndex,n;case"[object Symbol]":return function(t){return Lg?Object(Lg.call(t)):{}}(t)}}var Fg=Rm&&Rm.isMap,Bg=Fg?Sm(Fg):function(t){return wf(t)&&"[object Map]"==Pg(t)};var Ug=Rm&&Rm.isSet,Gg=Ug?Sm(Ug):function(t){return wf(t)&&"[object Set]"==Pg(t)},jg="[object Arguments]",Vg="[object Function]",Hg="[object Object]",Wg={};function Xg(t,e,r,i,n,s){var o,a=1&e,h=2&e,l=4&e;if(r&&(o=n?r(t,i,n,s):r(t)),void 0!==o)return o;if(!Ef(t))return t;var c=Sf(t);if(c){if(o=function(t){var e=t.length,r=new t.constructor(e);return e&&"string"==typeof t[0]&&Ig.call(t,"index")&&(r.index=t.index,r.input=t.input),r}(t),!a)return function(t,e){var r=-1,i=t.length;for(e||(e=Array(i));++r<i;)e[r]=t[r];return e}(t,o)}else{var u=Pg(t),d=u==Vg||"[object GeneratorFunction]"==u;if(Tm(t))return function(t,e){if(e)return t.slice();var r=t.length,i=sg?sg(r):new t.constructor(r);return t.copy(i),i}(t,a);if(u==Hg||u==jg||d&&!n){if(o=h||d?{}:function(t){return"function"!=typeof t.constructor||dm(t)?{}:Vf(tg(t))}(t),!a)return h?function(t,e){return am(t,ug(t),e)}(t,function(t,e){return t&&am(e,Um(e),t)}(o,t)):function(t,e){return am(t,cg(t),e)}(t,function(t,e){return t&&am(e,Nm(e),t)}(o,t))}else{if(!Wg[u])return n?t:{};o=Ng(t,u,a)}}s||(s=new eg);var p=s.get(t);if(p)return p;s.set(t,o),Gg(t)?t.forEach((function(i){o.add(Xg(i,e,r,i,t,s))})):Bg(t)&&t.forEach((function(i,n){o.set(n,Xg(i,e,r,n,t,s))}));var f=c?void 0:(l?h?fg:pg:h?Um:Nm)(t);return function(t,e){for(var r=-1,i=null==t?0:t.length;++r<i&&!1!==e(t[r],r,t););}(f||t,(function(i,n){f&&(i=t[n=i]),om(o,n,Xg(i,e,r,n,t,s))})),o}Wg[jg]=Wg["[object Array]"]=Wg["[object ArrayBuffer]"]=Wg["[object DataView]"]=Wg["[object Boolean]"]=Wg["[object Date]"]=Wg["[object Float32Array]"]=Wg["[object Float64Array]"]=Wg["[object Int8Array]"]=Wg["[object Int16Array]"]=Wg["[object Int32Array]"]=Wg["[object Map]"]=Wg["[object Number]"]=Wg[Hg]=Wg["[object RegExp]"]=Wg["[object Set]"]=Wg["[object String]"]=Wg["[object Symbol]"]=Wg["[object Uint8Array]"]=Wg["[object Uint8ClampedArray]"]=Wg["[object Uint16Array]"]=Wg["[object Uint32Array]"]=!0,Wg["[object Error]"]=Wg[Vg]=Wg["[object WeakMap]"]=!1;function zg(t){return Xg(t,5)}function Yg(t){var e=-1,r=null==t?0:t.length;for(this.__data__=new $m;++e<r;)this.add(t[e])}function Zg(t,e){for(var r=-1,i=null==t?0:t.length;++r<i;)if(e(t[r],r,t))return!0;return!1}function $g(t,e){return t.has(e)}Yg.prototype.add=Yg.prototype.push=function(t){return this.__data__.set(t,"__lodash_hash_undefined__"),this},Yg.prototype.has=function(t){return this.__data__.has(t)};function Kg(t,e,r,i,n,s){var o=1&r,a=t.length,h=e.length;if(a!=h&&!(o&&h>a))return!1;var l=s.get(t),c=s.get(e);if(l&&c)return l==e&&c==t;var u=-1,d=!0,p=2&r?new Yg:void 0;for(s.set(t,e),s.set(e,t);++u<a;){var f=t[u],m=e[u];if(i)var g=o?i(m,f,u,e,t,s):i(f,m,u,t,e,s);if(void 0!==g){if(g)continue;d=!1;break}if(p){if(!Zg(e,(function(t,e){if(!$g(p,e)&&(f===t||n(f,t,r,i,s)))return p.push(e)}))){d=!1;break}}else if(f!==m&&!n(f,m,r,i,s)){d=!1;break}}return s.delete(t),s.delete(e),d}function Jg(t){var e=-1,r=Array(t.size);return t.forEach((function(t,i){r[++e]=[i,t]})),r}function qg(t){var e=-1,r=Array(t.size);return t.forEach((function(t){r[++e]=t})),r}var Qg=mf?mf.prototype:void 0,tv=Qg?Qg.valueOf:void 0;var ev=Object.prototype.hasOwnProperty;var rv="[object Arguments]",iv="[object Array]",nv="[object Object]",sv=Object.prototype.hasOwnProperty;function ov(t,e,r,i,n,s){var o=Sf(t),a=Sf(e),h=o?iv:Pg(t),l=a?iv:Pg(e),c=(h=h==rv?nv:h)==nv,u=(l=l==rv?nv:l)==nv,d=h==l;if(d&&Tm(t)){if(!Tm(e))return!1;o=!0,c=!1}if(d&&!c)return s||(s=new eg),o||Im(t)?Kg(t,e,r,i,n,s):function(t,e,r,i,n,s,o){switch(r){case"[object DataView]":if(t.byteLength!=e.byteLength||t.byteOffset!=e.byteOffset)return!1;t=t.buffer,e=e.buffer;case"[object ArrayBuffer]":return!(t.byteLength!=e.byteLength||!s(new Mg(t),new Mg(e)));case"[object Boolean]":case"[object Date]":case"[object Number]":return nm(+t,+e);case"[object Error]":return t.name==e.name&&t.message==e.message;case"[object RegExp]":case"[object String]":return t==e+"";case"[object Map]":var a=Jg;case"[object Set]":var h=1&i;if(a||(a=qg),t.size!=e.size&&!h)return!1;var l=o.get(t);if(l)return l==e;i|=2,o.set(t,e);var c=Kg(a(t),a(e),i,n,s,o);return o.delete(t),c;case"[object Symbol]":if(tv)return tv.call(t)==tv.call(e)}return!1}(t,e,h,r,i,n,s);if(!(1&r)){var p=c&&sv.call(t,"__wrapped__"),f=u&&sv.call(e,"__wrapped__");if(p||f){var m=p?t.value():t,g=f?e.value():e;return s||(s=new eg),n(m,g,r,i,s)}}return!!d&&(s||(s=new eg),function(t,e,r,i,n,s){var o=1&r,a=pg(t),h=a.length;if(h!=pg(e).length&&!o)return!1;for(var l=h;l--;){var c=a[l];if(!(o?c in e:ev.call(e,c)))return!1}var u=s.get(t),d=s.get(e);if(u&&d)return u==e&&d==t;var p=!0;s.set(t,e),s.set(e,t);for(var f=o;++l<h;){var m=t[c=a[l]],g=e[c];if(i)var v=o?i(g,m,c,e,t,s):i(m,g,c,t,e,s);if(!(void 0===v?m===g||n(m,g,r,i,s):v)){p=!1;break}f||(f="constructor"==c)}if(p&&!f){var y=t.constructor,b=e.constructor;y==b||!("constructor"in t)||!("constructor"in e)||"function"==typeof y&&y instanceof y&&"function"==typeof b&&b instanceof b||(p=!1)}return s.delete(t),s.delete(e),p}(t,e,r,i,n,s))}function av(t,e,r,i,n){return t===e||(null==t||null==e||!wf(t)&&!wf(e)?t!=t&&e!=e:ov(t,e,r,i,av,n))}function hv(t){return wf(t)&&cm(t)}function lv(t,e,r){for(var i=-1,n=null==t?0:t.length;++i<n;)if(r(e,t[i]))return!0;return!1}function cv(t,e,r,i){var n=-1,s=tm,o=!0,a=t.length,h=[],l=e.length;if(!a)return h;r&&(e=function(t,e){for(var r=-1,i=null==t?0:t.length,n=Array(i);++r<i;)n[r]=e(t[r],r,t);return n}(e,Sm(r))),i?(s=lv,o=!1):e.length>=200&&(s=$g,o=!1,e=new Yg(e));t:for(;++n<a;){var c=t[n],u=null==r?c:r(c);if(c=i||0!==c?c:0,o&&u==u){for(var d=l;d--;)if(e[d]===u)continue t;h.push(c)}else s(e,u,i)||h.push(c)}return h}var uv=function(t,e){return qf(function(t,e,r){return e=hm(void 0===e?t.length-1:e,0),function(){for(var i=arguments,n=-1,s=hm(i.length-e,0),o=Array(s);++n<s;)o[n]=i[e+n];n=-1;for(var a=Array(e+1);++n<e;)a[n]=i[n];return a[e]=r(o),Hf(t,this,a)}}(t,e,Cf),t+"")}((function(t,e){var r=function(t){var e=null==t?0:t.length;return e?t[e-1]:void 0}(e);return hv(r)&&(r=void 0),hv(t)?cv(t,Qm(e,1,hv,!0),void 0,r):[]})),dv=uv;function pv(t,e){return av(t,e)}var fv="position:fixed;left:0;top:0;pointer-events:none;opacity:0;z-index:-1;",mv=function(t){if("suspended"===t.state||"interrupted"===t.state){var e=document.body,r=["touchstart","touchend","mouseup","click"];Rc(r).call(r,(function(t){return e.addEventListener(t,i,!1)})),i()}function i(){t.resume().then(n).catch(null)}function n(){Rc(r).call(r,(function(t){return e.removeEventListener(t,i,!1)}))}},gv=function(){var t=null;return window.TXLiveAudioContext?t=window.TXLiveAudioContext:(t=new(window.AudioContext||window.webkitAudioContext),mv(t),window.TXLiveAudioContext=t),t},vv=function(t){void 0===t&&(t={});var e=t.parentEl,r=void 0===e?document.body:e,i=t.style,n=void 0===i?fv:i,s=t.crossOrigin,o=void 0===s||s,a=t.loop,h=void 0===a||a,l=document.createElement("video");return l.autoplay=!0,l.controls=!1,l.preload="auto",l.playsInline=!0,l.setAttribute("webkit-playsinline",""),l.setAttribute("x5-playsinline",""),l.loop=h,o&&(l.crossOrigin="anonymous"),l.setAttribute("style",n),r.appendChild(l),l},yv=function(t){return t instanceof HTMLVideoElement?{width:t.videoWidth,height:t.videoHeight}:t instanceof HTMLImageElement?{width:t.naturalWidth,height:t.naturalHeight}:{width:t.width,height:t.height}},bv="\t\n\v\f\r                　\u2028\u2029\ufeff",_v=$,xv=$i,Tv=S("".replace),wv="[\t\n\v\f\r                　\u2028\u2029\ufeff]",Sv=RegExp("^"+wv+wv+"*"),Ev=RegExp(wv+wv+"*$"),Cv=function(t){return function(e){var r=xv(_v(e));return 1&t&&(r=Tv(r,Sv,"")),2&t&&(r=Tv(r,Ev,"")),r}},Av={start:Cv(1),end:Cv(2),trim:Cv(3)},Rv=s,Pv=o,Iv=S,Mv=$i,Ov=Av.trim,kv=bv,Dv=Rv.parseInt,Lv=Rv.Symbol,Nv=Lv&&Lv.iterator,Fv=/^[+-]?0x/i,Bv=Iv(Fv.exec),Uv=8!==Dv(kv+"08")||22!==Dv(kv+"0x16")||Nv&&!Pv((function(){Dv(Object(Nv))}))?function(t,e){var r=Ov(Mv(t));return Dv(r,e>>>0||(Bv(Fv,r)?16:10))}:Dv;Pr({global:!0,forced:parseInt!=Uv},{parseInt:Uv});var Gv=rt.parseInt,jv=at,Vv=Vn,Hv=is,Wv=ir,Xv=S([].concat),zv=jv("Reflect","ownKeys")||function(t){var e=Vv.f(Wv(t)),r=Hv.f;return r?Xv(e,r(t)):e},Yv=Jt,Zv=zv,$v=P,Kv=qe,Jv=Error,qv=S("".replace),Qv=String(Jv("zxcasd").stack),ty=/\n\s*at [^:]*:[^\n]*/,ey=ty.test(Qv),ry=et,iy=vr,ny=ih,sy=pe("iterator"),oy=Array.prototype,ay=function(t){return void 0!==t&&(ny.Array===t||oy[sy]===t)},hy=ri,ly=Dt,cy=z,uy=ih,dy=pe("iterator"),py=function(t){if(!cy(t))return ly(t,dy)||ly(t,"@@iterator")||uy[hy(t)]},fy=k,my=Mt,gy=ir,vy=At,yy=py,by=TypeError,_y=function(t,e){var r=arguments.length<2?yy(t):e;if(my(r))return gy(fy(r,t));throw by(vy(t)+" is not iterable")},xy=k,Ty=ir,wy=Dt,Sy=function(t,e,r){var i,n;Ty(t);try{if(!(i=wy(t,"return"))){if("throw"===e)throw r;return r}i=xy(i,t)}catch(t){n=!0,i=t}if("throw"===e)throw r;if(n)throw i;return Ty(i),r},Ey=Je,Cy=k,Ay=ir,Ry=At,Py=ay,Iy=jr,My=ht,Oy=_y,ky=py,Dy=Sy,Ly=TypeError,Ny=function(t,e){this.stopped=t,this.result=e},Fy=Ny.prototype,By=function(t,e,r){var i,n,s,o,a,h,l,c=r&&r.that,u=!(!r||!r.AS_ENTRIES),d=!(!r||!r.IS_RECORD),p=!(!r||!r.IS_ITERATOR),f=!(!r||!r.INTERRUPTED),m=Ey(e,c),g=function(t){return i&&Dy(i,"normal",t),new Ny(!0,t)},v=function(t){return u?(Ay(t),f?m(t[0],t[1],g):m(t[0],t[1])):f?m(t,g):m(t)};if(d)i=t.iterator;else if(p)i=t;else{if(!(n=ky(t)))throw Ly(Ry(t)+" is not iterable");if(Py(n)){for(s=0,o=Iy(t);o>s;s++)if((a=v(t[s]))&&My(Fy,a))return a;return new Ny(!1)}i=Oy(t,n)}for(h=d?t.next:i.next;!(l=Cy(h,i)).done;){try{a=v(l.value)}catch(t){Dy(i,"throw",t)}if("object"==typeof a&&a&&My(Fy,a))return a}return new Ny(!1)},Uy=$i,Gy=G,jy=!o((function(){var t=Error("a");return!("stack"in t)||(Object.defineProperty(t,"stack",Gy(1,7)),7!==t.stack)})),Vy=Pr,Hy=ht,Wy=yh,Xy=Vh,zy=function(t,e,r){for(var i=Zv(e),n=Kv.f,s=$v.f,o=0;o<i.length;o++){var a=i[o];Yv(t,a)||r&&Yv(r,a)||n(t,a,s(e,a))}},Yy=jn,Zy=vr,$y=G,Ky=function(t,e){if(ey&&"string"==typeof t&&!Jv.prepareStackTrace)for(;e--;)t=qv(t,ty,"");return t},Jy=function(t,e){ry(e)&&"cause"in e&&iy(t,"cause",e.cause)},qy=By,Qy=function(t,e){return void 0===t?arguments.length<2?"":e:Uy(t)},tb=jy,eb=pe("toStringTag"),rb=Error,ib=[].push,nb=function(t,e){var r,i=arguments.length>2?arguments[2]:void 0,n=Hy(sb,this);Xy?r=Xy(rb(),n?Wy(this):sb):(r=n?this:Yy(sb),Zy(r,eb,"Error")),void 0!==e&&Zy(r,"message",Qy(e)),tb&&Zy(r,"stack",Ky(r.stack,1)),Jy(r,i);var s=[];return qy(t,ib,{that:s}),Zy(r,"errors",s),r};Xy?Xy(nb,rb):zy(nb,rb,{name:!0});var sb=nb.prototype=Yy(rb.prototype,{constructor:$y(1,nb),message:$y(1,""),name:$y(1,"AggregateError")});Vy({global:!0,constructor:!0,arity:2},{AggregateError:nb});var ob,ab,hb,lb,cb="process"==x(s.process),ub=at,db=qe,pb=I,fb=pe("species"),mb=ht,gb=TypeError,vb=function(t,e){if(mb(e,t))return t;throw gb("Incorrect invocation")},yb=_i,bb=At,_b=TypeError,xb=ir,Tb=function(t){if(yb(t))return t;throw _b(bb(t)+" is not a constructor")},wb=z,Sb=pe("species"),Eb=function(t,e){var r,i=xb(t).constructor;return void 0===i||wb(r=xb(i)[Sb])?e:Tb(r)},Cb=/(?:ipad|iphone|ipod).*applewebkit/i.test(lt),Ab=s,Rb=d,Pb=Je,Ib=R,Mb=Jt,Ob=o,kb=En,Db=Ta,Lb=Ae,Nb=Ju,Fb=Cb,Bb=cb,Ub=Ab.setImmediate,Gb=Ab.clearImmediate,jb=Ab.process,Vb=Ab.Dispatch,Hb=Ab.Function,Wb=Ab.MessageChannel,Xb=Ab.String,zb=0,Yb={},Zb="onreadystatechange";try{ob=Ab.location}catch(t){}var $b=function(t){if(Mb(Yb,t)){var e=Yb[t];delete Yb[t],e()}},Kb=function(t){return function(){$b(t)}},Jb=function(t){$b(t.data)},qb=function(t){Ab.postMessage(Xb(t),ob.protocol+"//"+ob.host)};Ub&&Gb||(Ub=function(t){Nb(arguments.length,1);var e=Ib(t)?t:Hb(t),r=Db(arguments,1);return Yb[++zb]=function(){Rb(e,void 0,r)},ab(zb),zb},Gb=function(t){delete Yb[t]},Bb?ab=function(t){jb.nextTick(Kb(t))}:Vb&&Vb.now?ab=function(t){Vb.now(Kb(t))}:Wb&&!Fb?(lb=(hb=new Wb).port2,hb.port1.onmessage=Jb,ab=Pb(lb.postMessage,lb)):Ab.addEventListener&&Ib(Ab.postMessage)&&!Ab.importScripts&&ob&&"file:"!==ob.protocol&&!Ob(qb)?(ab=qb,Ab.addEventListener("message",Jb,!1)):ab=Zb in Lb("script")?function(t){kb.appendChild(Lb("script")).onreadystatechange=function(){kb.removeChild(this),$b(t)}}:function(t){setTimeout(Kb(t),0)});var Qb,t_,e_,r_,i_,n_,s_,o_,a_={set:Ub,clear:Gb},h_=s,l_=/ipad|iphone|ipod/i.test(lt)&&void 0!==h_.Pebble,c_=/web0s(?!.*chrome)/i.test(lt),u_=s,d_=Je,p_=P.f,f_=a_.set,m_=Cb,g_=l_,v_=c_,y_=cb,b_=u_.MutationObserver||u_.WebKitMutationObserver,__=u_.document,x_=u_.process,T_=u_.Promise,w_=p_(u_,"queueMicrotask"),S_=w_&&w_.value;S_||(Qb=function(){var t,e;for(y_&&(t=x_.domain)&&t.exit();t_;){e=t_.fn,t_=t_.next;try{e()}catch(t){throw t_?r_():e_=void 0,t}}e_=void 0,t&&t.enter()},m_||y_||v_||!b_||!__?!g_&&T_&&T_.resolve?((s_=T_.resolve(void 0)).constructor=T_,o_=d_(s_.then,s_),r_=function(){o_(Qb)}):y_?r_=function(){x_.nextTick(Qb)}:(f_=d_(f_,u_),r_=function(){f_(Qb)}):(i_=!0,n_=__.createTextNode(""),new b_(Qb).observe(n_,{characterData:!0}),r_=function(){n_.data=i_=!i_}));var E_=S_||function(t){var e={fn:t,next:void 0};e_&&(e_.next=e),t_||(t_=e,r_()),e_=e},C_=s,A_=function(t){try{return{error:!1,value:t()}}catch(t){return{error:!0,value:t}}},R_=function(){this.head=null,this.tail=null};R_.prototype={add:function(t){var e={item:t,next:null};this.head?this.tail.next=e:this.head=e,this.tail=e},get:function(){var t=this.head;if(t)return this.head=t.next,this.tail===t&&(this.tail=null),t.item}};var P_=R_,I_=s.Promise,M_="object"==typeof Deno&&Deno&&"object"==typeof Deno.version,O_=!M_&&!cb&&"object"==typeof window&&"object"==typeof document,k_=s,D_=I_,L_=R,N_=Ye,F_=oi,B_=pe,U_=O_,G_=M_,j_=gt,V_=D_&&D_.prototype,H_=B_("species"),W_=!1,X_=L_(k_.PromiseRejectionEvent),z_=N_("Promise",(function(){var t=F_(D_),e=t!==String(D_);if(!e&&66===j_)return!0;if(!V_.catch||!V_.finally)return!0;if(!j_||j_<51||!/native code/.test(t)){var r=new D_((function(t){t(1)})),i=function(t){t((function(){}),(function(){}))};if((r.constructor={})[H_]=i,!(W_=r.then((function(){}))instanceof i))return!0}return!e&&(U_||G_)&&!X_})),Y_={CONSTRUCTOR:z_,REJECTION_EVENT:X_,SUBCLASSING:W_},Z_={},$_=Mt,K_=TypeError,J_=function(t){var e,r;this.promise=new t((function(t,i){if(void 0!==e||void 0!==r)throw K_("Bad Promise constructor");e=t,r=i})),this.resolve=$_(e),this.reject=$_(r)};Z_.f=function(t){return new J_(t)};var q_,Q_,tx=Pr,ex=cb,rx=s,ix=k,nx=ss,sx=Ps,ox=function(t){var e=ub(t),r=db.f;pb&&e&&!e[fb]&&r(e,fb,{configurable:!0,get:function(){return this}})},ax=Mt,hx=R,lx=et,cx=vb,ux=Eb,dx=a_.set,px=E_,fx=function(t,e){var r=C_.console;r&&r.error&&(1==arguments.length?r.error(t):r.error(t,e))},mx=A_,gx=P_,vx=Xs,yx=I_,bx=Y_,_x=Z_,xx="Promise",Tx=bx.CONSTRUCTOR,wx=bx.REJECTION_EVENT,Sx=vx.getterFor(xx),Ex=vx.set,Cx=yx&&yx.prototype,Ax=yx,Rx=Cx,Px=rx.TypeError,Ix=rx.document,Mx=rx.process,Ox=_x.f,kx=Ox,Dx=!!(Ix&&Ix.createEvent&&rx.dispatchEvent),Lx="unhandledrejection",Nx=function(t){var e;return!(!lx(t)||!hx(e=t.then))&&e},Fx=function(t,e){var r,i,n,s=e.value,o=1==e.state,a=o?t.ok:t.fail,h=t.resolve,l=t.reject,c=t.domain;try{a?(o||(2===e.rejection&&Vx(e),e.rejection=1),!0===a?r=s:(c&&c.enter(),r=a(s),c&&(c.exit(),n=!0)),r===t.promise?l(Px("Promise-chain cycle")):(i=Nx(r))?ix(i,r,h,l):h(r)):l(s)}catch(t){c&&!n&&c.exit(),l(t)}},Bx=function(t,e){t.notified||(t.notified=!0,px((function(){for(var r,i=t.reactions;r=i.get();)Fx(r,t);t.notified=!1,e&&!t.rejection&&Gx(t)})))},Ux=function(t,e,r){var i,n;Dx?((i=Ix.createEvent("Event")).promise=e,i.reason=r,i.initEvent(t,!1,!0),rx.dispatchEvent(i)):i={promise:e,reason:r},!wx&&(n=rx["on"+t])?n(i):t===Lx&&fx("Unhandled promise rejection",r)},Gx=function(t){ix(dx,rx,(function(){var e,r=t.facade,i=t.value;if(jx(t)&&(e=mx((function(){ex?Mx.emit("unhandledRejection",i,r):Ux(Lx,r,i)})),t.rejection=ex||jx(t)?2:1,e.error))throw e.value}))},jx=function(t){return 1!==t.rejection&&!t.parent},Vx=function(t){ix(dx,rx,(function(){var e=t.facade;ex?Mx.emit("rejectionHandled",e):Ux("rejectionhandled",e,t.value)}))},Hx=function(t,e,r){return function(i){t(e,i,r)}},Wx=function(t,e,r){t.done||(t.done=!0,r&&(t=r),t.value=e,t.state=2,Bx(t,!0))},Xx=function(t,e,r){if(!t.done){t.done=!0,r&&(t=r);try{if(t.facade===e)throw Px("Promise can't be resolved itself");var i=Nx(e);i?px((function(){var r={done:!1};try{ix(i,e,Hx(Xx,r,t),Hx(Wx,r,t))}catch(e){Wx(r,e,t)}})):(t.value=e,t.state=1,Bx(t,!1))}catch(e){Wx({done:!1},e,t)}}};Tx&&(Rx=(Ax=function(t){cx(this,Rx),ax(t),ix(q_,this);var e=Sx(this);try{t(Hx(Xx,e),Hx(Wx,e))}catch(t){Wx(e,t)}}).prototype,(q_=function(t){Ex(this,{type:xx,done:!1,notified:!1,parent:!1,reactions:new gx,rejection:!1,state:0,value:void 0})}).prototype=nx(Rx,"then",(function(t,e){var r=Sx(this),i=Ox(ux(this,Ax));return r.parent=!0,i.ok=!hx(t)||t,i.fail=hx(e)&&e,i.domain=ex?Mx.domain:void 0,0==r.state?r.reactions.add(i):px((function(){Fx(i,r)})),i.promise})),Q_=function(){var t=new q_,e=Sx(t);this.promise=t,this.resolve=Hx(Xx,e),this.reject=Hx(Wx,e)},_x.f=Ox=function(t){return t===Ax||undefined===t?new Q_(t):kx(t)}),tx({global:!0,constructor:!0,wrap:!0,forced:Tx},{Promise:Ax}),sx(Ax,xx,!1,!0),ox(xx);var zx=pe("iterator"),Yx=!1;try{var Zx=0,$x={next:function(){return{done:!!Zx++}},return:function(){Yx=!0}};$x[zx]=function(){return this},Array.from($x,(function(){throw 2}))}catch(t){}var Kx=I_,Jx=function(t,e){if(!e&&!Yx)return!1;var r=!1;try{var i={};i[zx]=function(){return{next:function(){return{done:r=!0}}}},t(i)}catch(t){}return r},qx=Y_.CONSTRUCTOR||!Jx((function(t){Kx.all(t).then(void 0,(function(){}))})),Qx=k,tT=Mt,eT=Z_,rT=A_,iT=By;Pr({target:"Promise",stat:!0,forced:qx},{all:function(t){var e=this,r=eT.f(e),i=r.resolve,n=r.reject,s=rT((function(){var r=tT(e.resolve),s=[],o=0,a=1;iT(t,(function(t){var h=o++,l=!1;a++,Qx(r,e,t).then((function(t){l||(l=!0,s[h]=t,--a||i(s))}),n)})),--a||i(s)}));return s.error&&n(s.value),r.promise}});var nT=Pr,sT=Y_.CONSTRUCTOR;I_&&I_.prototype,nT({target:"Promise",proto:!0,forced:sT,real:!0},{catch:function(t){return this.then(void 0,t)}});var oT=k,aT=Mt,hT=Z_,lT=A_,cT=By;Pr({target:"Promise",stat:!0,forced:qx},{race:function(t){var e=this,r=hT.f(e),i=r.reject,n=lT((function(){var n=aT(e.resolve);cT(t,(function(t){oT(n,e,t).then(r.resolve,i)}))}));return n.error&&i(n.value),r.promise}});var uT=k,dT=Z_;Pr({target:"Promise",stat:!0,forced:Y_.CONSTRUCTOR},{reject:function(t){var e=dT.f(this);return uT(e.reject,void 0,t),e.promise}});var pT=ir,fT=et,mT=Z_,gT=function(t,e){if(pT(t),fT(e)&&e.constructor===t)return e;var r=mT.f(t);return(0,r.resolve)(e),r.promise},vT=Pr,yT=I_,bT=Y_.CONSTRUCTOR,_T=gT,xT=at("Promise"),TT=!bT;vT({target:"Promise",stat:!0,forced:true},{resolve:function(t){return _T(TT&&this===xT?yT:this,t)}});var wT=k,ST=Mt,ET=Z_,CT=A_,AT=By;Pr({target:"Promise",stat:!0},{allSettled:function(t){var e=this,r=ET.f(e),i=r.resolve,n=r.reject,s=CT((function(){var r=ST(e.resolve),n=[],s=0,o=1;AT(t,(function(t){var a=s++,h=!1;o++,wT(r,e,t).then((function(t){h||(h=!0,n[a]={status:"fulfilled",value:t},--o||i(n))}),(function(t){h||(h=!0,n[a]={status:"rejected",reason:t},--o||i(n))}))})),--o||i(n)}));return s.error&&n(s.value),r.promise}});var RT=k,PT=Mt,IT=at,MT=Z_,OT=A_,kT=By,DT="No one promise resolved";Pr({target:"Promise",stat:!0},{any:function(t){var e=this,r=IT("AggregateError"),i=MT.f(e),n=i.resolve,s=i.reject,o=OT((function(){var i=PT(e.resolve),o=[],a=0,h=1,l=!1;kT(t,(function(t){var c=a++,u=!1;h++,RT(i,e,t).then((function(t){u||l||(l=!0,n(t))}),(function(t){u||l||(u=!0,o[c]=t,--h||s(new r(o,DT)))}))})),--h||s(new r(o,DT))}));return o.error&&s(o.value),i.promise}});var LT=Pr,NT=I_,FT=o,BT=at,UT=R,GT=Eb,jT=gT,VT=NT&&NT.prototype;LT({target:"Promise",proto:!0,real:!0,forced:!!NT&&FT((function(){VT.finally.call({then:function(){}},(function(){}))}))},{finally:function(t){var e=GT(this,BT("Promise")),r=UT(t);return this.then(r?function(r){return jT(e,t()).then((function(){return r}))}:t,r?function(r){return jT(e,t()).then((function(){throw r}))}:t)}});var HT=rt.Promise,WT=Z_,XT=A_;Pr({target:"Promise",stat:!0,forced:!0},{try:function(t){var e=WT.f(this),r=XT(t);return(r.error?e.reject:e.resolve)(r.value),e.promise}});var zT=HT,YT=/Version\/(\d+)\.(\d+)/i,ZT=/OS (\d+)_(\d+)_?(\d+)?/i;/firefox\/(\d+)\./i.test(navigator.userAgent);var $T=/safari\/(\d+)\./i.test(navigator.userAgent)&&!/chrome\/(\d+)\./i.test(navigator.userAgent),KT=/iPhone|iPad|iOS/i.test(navigator.userAgent),JT=function(){var t=navigator.userAgent.match(YT);return t?[Gv(t[1],10),Gv(t[2],10)]:[]}(),qT=$T&&15===JT[0]||KT&&15===function(){var t=navigator.userAgent.match(ZT);return t?Gv(t[1],10):null}(),QT=$T&&16===JT[0]&&JT[1]<4,tw=function(){var t,e;return!(!(null===(t=navigator.mediaDevices)||void 0===t?void 0:t.enumerateDevices)||!(null===(e=navigator.mediaDevices)||void 0===e?void 0:e.getUserMedia))},ew=function(){var t;return!!(null===(t=navigator.mediaDevices)||void 0===t?void 0:t.getDisplayMedia)},rw=rt,iw=d;rw.JSON||(rw.JSON={stringify:JSON.stringify});var nw=function(t,e,r){return iw(rw.JSON.stringify,null,arguments)},sw=nw,ow=function(t,e){return fetch(t,{body:sw(e),cache:"no-cache",credentials:"same-origin",headers:{"content-type":"application/json"},method:"POST",mode:"cors"}).then((function(t){if(200!==t.status)throw new Error("status Code:".concat(t.status));return t.json()}))},aw=Pr,hw=S,lw=Ur,cw=$i,uw=Du,dw=$,pw=Nu,fw=hw("".endsWith),mw=hw("".slice),gw=Math.min;aw({target:"String",proto:!0,forced:!pw("endsWith")},{endsWith:function(t){var e=cw(dw(this));uw(t);var r=arguments.length>1?arguments[1]:void 0,i=e.length,n=void 0===r?i:gw(lw(r),i),s=cw(t);return fw?fw(e,s,n):mw(e,n-s.length,n)===s}});var vw=oc("String").endsWith,yw=ht,bw=vw,_w=String.prototype,xw=function(t){var e=t.endsWith;return"string"==typeof t||t===_w||yw(_w,t)&&e===_w.endsWith?bw:e},Tw=Qs.every;Pr({target:"Array",proto:!0,forced:!yc("every")},{every:function(t){return Tw(this,t,arguments.length>1?arguments[1]:void 0)}});var ww=oc("Array").every,Sw=ht,Ew=ww,Cw=Array.prototype,Aw=function(t){var e=t.every;return t===Cw||Sw(Cw,t)&&e===Cw.every?Ew:e},Rw=Xp("stream:device"),Pw=function(){function t(){this.mediaStream=null}return t.prototype.start=function(t){var e=t.video,r=t.audio;return wd(this,void 0,void 0,(function(){var t,i,n,s,o,a,h,l,c,u,d,p,f;return Sd(this,(function(m){switch(m.label){case 0:if(this.mediaStream)return Rw("stream is existed"),[2,this.mediaStream];t={},e&&(o=e.deviceId,i=e.frameRate,n=e.resolution,s={frameRate:{ideal:i},width:{ideal:n.width},height:{ideal:n.height}},o&&($u(uf).call(uf,o)?s.facingMode={exact:o}:s.deviceId={exact:o}),t.video=s),r&&(o=r.deviceId,a=r.sampleRate,h=r.echoCancellation,l=r.noiseSuppression,c=r.autoGainControl,u={sampleRate:a,echoCancellation:h,noiseSuppression:l,autoGainControl:c},o&&(u.deviceId={exact:o}),t.audio=u),m.label=1;case 1:return m.trys.push([1,3,,4]),d=this,[4,navigator.mediaDevices.getUserMedia(t)];case 2:return d.mediaStream=m.sent(),[2,this.mediaStream];case 3:switch(p=m.sent(),Rw("start error, ".concat(p.toString())),f="",p.name){case"NotFoundError":case"DevicesNotFoundError":f="NotFoundError";break;case"NotAllowedError":case"PermissionDeniedError":f="NotAllowedError";break;default:f=p.name}throw p.name!==f&&(p.name=f),p;case 4:return[2]}}))}))},t.prototype.stop=function(){var t,e;null===(e=this.mediaStream)||void 0===e||Rc(t=e.getTracks()).call(t,(function(t){"ended"!==t.readyState&&t.stop()})),this.mediaStream=null},t.prototype.getResolution=function(){if(!this.mediaStream)return null;var t=this.mediaStream.getVideoTracks();if(0===t.length)return null;var e=t[0].getSettings();return{width:e.width,height:e.height}},t}(),Iw=Xp("stream:screen"),Mw=function(){function t(){this.mediaStream=null}return t.prototype.start=function(t){var e=t.video,r=t.audio;return wd(this,void 0,void 0,(function(){var t,i,n,s,o,a,h,l,c,u;return Sd(this,(function(d){var p;switch(d.label){case 0:if(this.mediaStream)return Iw("stream is existed"),[2,this.mediaStream];t={},e&&(i=e.frameRate,n=e.resolution,s={frameRate:{ideal:i},width:QT?{max:n.width}:{ideal:n.width},height:QT?{max:n.height}:{ideal:n.height}},t.video=s),r&&(o=r.echoCancellation,a=r.noiseSuppression,h=r.autoGainControl,l={echoCancellation:o,noiseSuppression:a,autoGainControl:h},t.audio=l),d.label=1;case 1:return d.trys.push([1,3,,4]),c=this,[4,navigator.mediaDevices.getDisplayMedia(t)];case 2:return c.mediaStream=d.sent(),Rc(p=this.mediaStream.getVideoTracks()).call(p,(function(r){var i;null===(i=r.applyConstraints)||void 0===i||i.call(r,Td(Td({},t.video),{frameRate:{min:e.frameRate,ideal:e.frameRate}})).catch((function(t){Iw("video track applyConstraints error, ".concat(t.toString()))})),r.contentHint="detail"})),[2,this.mediaStream];case 3:throw u=d.sent(),Iw("start error, ".concat(u.toString())),u;case 4:return[2]}}))}))},t.prototype.stop=function(){var t,e;null===(e=this.mediaStream)||void 0===e||Rc(t=e.getTracks()).call(t,(function(t){"ended"!==t.readyState&&t.stop()})),this.mediaStream=null},t.prototype.getResolution=function(){if(!this.mediaStream)return null;var t=this.mediaStream.getVideoTracks();if(0===t.length)return null;var e=t[0].getSettings();return{width:e.width,height:e.height}},t}(),Ow=o,kw=pe("iterator"),Dw=!Ow((function(){var t=new URL("b?a=1&b=2&c=3","http://a"),e=t.searchParams,r="";return t.pathname="c%20d",e.forEach((function(t,i){e.delete("b"),r+=i+t})),!t.toJSON||!e.sort||"http://a/c%20d?a=1&c=3"!==t.href||"3"!==e.get("c")||"a=1"!==String(new URLSearchParams("?a=1"))||!e[kw]||"a"!==new URL("https://a@b").username||"b"!==new URLSearchParams(new URLSearchParams("a=b")).get("a")||"xn--e1aybc"!==new URL("http://тест").host||"#%D0%B1"!==new URL("http://a#б").hash||"a1c3"!==r||"x"!==new URL("http://x",void 0).host})),Lw=qe,Nw=I,Fw=S,Bw=k,Uw=o,Gw=vn,jw=is,Vw=D,Hw=Zt,Ww=X,Xw=Object.assign,zw=Object.defineProperty,Yw=Fw([].concat),Zw=!Xw||Uw((function(){if(Nw&&1!==Xw({b:1},Xw(zw({},"a",{enumerable:!0,get:function(){zw(this,"b",{value:3,enumerable:!1})}}),{b:2})).b)return!0;var t={},e={},r=Symbol(),i="abcdefghijklmnopqrst";return t[r]=7,i.split("").forEach((function(t){e[t]=t})),7!=Xw({},t)[r]||Gw(Xw({},e)).join("")!=i}))?function(t,e){for(var r=Hw(t),i=arguments.length,n=1,s=jw.f,o=Vw.f;i>n;)for(var a,h=Ww(arguments[n++]),l=s?Yw(Gw(h),s(h)):Gw(h),c=l.length,u=0;c>u;)a=l[u++],Nw&&!Bw(o,h,a)||(r[a]=h[a]);return r}:Xw,$w=ir,Kw=Sy,Jw=Je,qw=k,Qw=Zt,tS=function(t,e,r,i){try{return i?e($w(r)[0],r[1]):e(r)}catch(e){Kw(t,"throw",e)}},eS=ay,rS=_i,iS=jr,nS=Yr,sS=_y,oS=py,aS=Array,hS=S,lS=2147483647,cS=/[^\0-\u007E]/,uS=/[.\u3002\uFF0E\uFF61]/g,dS="Overflow: input needs wider integers to process",pS=RangeError,fS=hS(uS.exec),mS=Math.floor,gS=String.fromCharCode,vS=hS("".charCodeAt),yS=hS([].join),bS=hS([].push),_S=hS("".replace),xS=hS("".split),TS=hS("".toLowerCase),wS=function(t){return t+22+75*(t<26)},SS=function(t,e,r){var i=0;for(t=r?mS(t/700):t>>1,t+=mS(t/e);t>455;)t=mS(t/35),i+=36;return mS(i+36*t/(t+38))},ES=function(t){var e=[];t=function(t){for(var e=[],r=0,i=t.length;r<i;){var n=vS(t,r++);if(n>=55296&&n<=56319&&r<i){var s=vS(t,r++);56320==(64512&s)?bS(e,((1023&n)<<10)+(1023&s)+65536):(bS(e,n),r--)}else bS(e,n)}return e}(t);var r,i,n=t.length,s=128,o=0,a=72;for(r=0;r<t.length;r++)(i=t[r])<128&&bS(e,gS(i));var h=e.length,l=h;for(h&&bS(e,"-");l<n;){var c=lS;for(r=0;r<t.length;r++)(i=t[r])>=s&&i<c&&(c=i);var u=l+1;if(c-s>mS((lS-o)/u))throw pS(dS);for(o+=(c-s)*u,s=c,r=0;r<t.length;r++){if((i=t[r])<s&&++o>lS)throw pS(dS);if(i==s){for(var d=o,p=36;;){var f=p<=a?1:p>=a+26?26:p-a;if(d<f)break;var m=d-f,g=36-f;bS(e,gS(wS(f+m%g))),d=mS(m/g),p+=36}bS(e,gS(wS(d))),a=SS(o,u,l==h),o=0,l++}}o++,s++}return yS(e,"")},CS=ss,AS=Jn,RS=Math.floor,PS=function(t,e){var r=t.length,i=RS(r/2);return r<8?IS(t,e):MS(t,PS(AS(t,0,i),e),PS(AS(t,i),e),e)},IS=function(t,e){for(var r,i,n=t.length,s=1;s<n;){for(i=s,r=t[s];i&&e(t[i-1],r)>0;)t[i]=t[--i];i!==s++&&(t[i]=r)}return t},MS=function(t,e,r,i){for(var n=e.length,s=r.length,o=0,a=0;o<n||a<s;)t[o+a]=o<n&&a<s?i(e[o],r[a])<=0?e[o++]:r[a++]:o<n?e[o++]:r[a++];return t},OS=Pr,kS=s,DS=k,LS=S,NS=I,FS=Dw,BS=ss,US=function(t,e,r){for(var i in e)r&&r.unsafe&&t[i]?t[i]=e[i]:CS(t,i,e[i],r);return t},GS=Ps,jS=Lh,VS=Xs,HS=vb,WS=R,XS=Jt,zS=Je,YS=ri,ZS=ir,$S=et,KS=$i,JS=jn,qS=G,QS=_y,tE=py,eE=Ju,rE=PS,iE=pe("iterator"),nE="URLSearchParams",sE="URLSearchParamsIterator",oE=VS.set,aE=VS.getterFor(nE),hE=VS.getterFor(sE),lE=Object.getOwnPropertyDescriptor,cE=function(t){if(!NS)return kS[t];var e=lE(kS,t);return e&&e.value},uE=cE("fetch"),dE=cE("Request"),pE=cE("Headers"),fE=dE&&dE.prototype,mE=pE&&pE.prototype,gE=kS.RegExp,vE=kS.TypeError,yE=kS.decodeURIComponent,bE=kS.encodeURIComponent,_E=LS("".charAt),xE=LS([].join),TE=LS([].push),wE=LS("".replace),SE=LS([].shift),EE=LS([].splice),CE=LS("".split),AE=LS("".slice),RE=/\+/g,PE=Array(4),IE=function(t){return PE[t-1]||(PE[t-1]=gE("((?:%[\\da-f]{2}){"+t+"})","gi"))},ME=function(t){try{return yE(t)}catch(e){return t}},OE=function(t){var e=wE(t,RE," "),r=4;try{return yE(e)}catch(t){for(;r;)e=wE(e,IE(r--),ME);return e}},kE=/[!'()~]|%20/g,DE={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+"},LE=function(t){return DE[t]},NE=function(t){return wE(bE(t),kE,LE)},FE=jS((function(t,e){oE(this,{type:sE,iterator:QS(aE(t).entries),kind:e})}),"Iterator",(function(){var t=hE(this),e=t.kind,r=t.iterator.next(),i=r.value;return r.done||(r.value="keys"===e?i.key:"values"===e?i.value:[i.key,i.value]),r}),!0),BE=function(t){this.entries=[],this.url=null,void 0!==t&&($S(t)?this.parseObject(t):this.parseQuery("string"==typeof t?"?"===_E(t,0)?AE(t,1):t:KS(t)))};BE.prototype={type:nE,bindURL:function(t){this.url=t,this.update()},parseObject:function(t){var e,r,i,n,s,o,a,h=tE(t);if(h)for(r=(e=QS(t,h)).next;!(i=DS(r,e)).done;){if(s=(n=QS(ZS(i.value))).next,(o=DS(s,n)).done||(a=DS(s,n)).done||!DS(s,n).done)throw vE("Expected sequence with length 2");TE(this.entries,{key:KS(o.value),value:KS(a.value)})}else for(var l in t)XS(t,l)&&TE(this.entries,{key:l,value:KS(t[l])})},parseQuery:function(t){if(t)for(var e,r,i=CE(t,"&"),n=0;n<i.length;)(e=i[n++]).length&&(r=CE(e,"="),TE(this.entries,{key:OE(SE(r)),value:OE(xE(r,"="))}))},serialize:function(){for(var t,e=this.entries,r=[],i=0;i<e.length;)t=e[i++],TE(r,NE(t.key)+"="+NE(t.value));return xE(r,"&")},update:function(){this.entries.length=0,this.parseQuery(this.url.query)},updateURL:function(){this.url&&this.url.update()}};var UE=function(){HS(this,GE);var t=arguments.length>0?arguments[0]:void 0;oE(this,new BE(t))},GE=UE.prototype;if(US(GE,{append:function(t,e){eE(arguments.length,2);var r=aE(this);TE(r.entries,{key:KS(t),value:KS(e)}),r.updateURL()},delete:function(t){eE(arguments.length,1);for(var e=aE(this),r=e.entries,i=KS(t),n=0;n<r.length;)r[n].key===i?EE(r,n,1):n++;e.updateURL()},get:function(t){eE(arguments.length,1);for(var e=aE(this).entries,r=KS(t),i=0;i<e.length;i++)if(e[i].key===r)return e[i].value;return null},getAll:function(t){eE(arguments.length,1);for(var e=aE(this).entries,r=KS(t),i=[],n=0;n<e.length;n++)e[n].key===r&&TE(i,e[n].value);return i},has:function(t){eE(arguments.length,1);for(var e=aE(this).entries,r=KS(t),i=0;i<e.length;)if(e[i++].key===r)return!0;return!1},set:function(t,e){eE(arguments.length,1);for(var r,i=aE(this),n=i.entries,s=!1,o=KS(t),a=KS(e),h=0;h<n.length;h++)(r=n[h]).key===o&&(s?EE(n,h--,1):(s=!0,r.value=a));s||TE(n,{key:o,value:a}),i.updateURL()},sort:function(){var t=aE(this);rE(t.entries,(function(t,e){return t.key>e.key?1:-1})),t.updateURL()},forEach:function(t){for(var e,r=aE(this).entries,i=zS(t,arguments.length>1?arguments[1]:void 0),n=0;n<r.length;)i((e=r[n++]).value,e.key,this)},keys:function(){return new FE(this,"keys")},values:function(){return new FE(this,"values")},entries:function(){return new FE(this,"entries")}},{enumerable:!0}),BS(GE,iE,GE.entries,{name:"entries"}),BS(GE,"toString",(function(){return aE(this).serialize()}),{enumerable:!0}),GS(UE,nE),OS({global:!0,constructor:!0,forced:!FS},{URLSearchParams:UE}),!FS&&WS(pE)){var jE=LS(mE.has),VE=LS(mE.set),HE=function(t){if($S(t)){var e,r=t.body;if(YS(r)===nE)return e=t.headers?new pE(t.headers):new pE,jE(e,"content-type")||VE(e,"content-type","application/x-www-form-urlencoded;charset=UTF-8"),JS(t,{body:qS(0,KS(r)),headers:qS(0,e)})}return t};if(WS(uE)&&OS({global:!0,enumerable:!0,dontCallGetSet:!0,forced:!0},{fetch:function(t){return uE(t,arguments.length>1?HE(arguments[1]):{})}}),WS(dE)){var WE=function(t){return HS(this,fE),new dE(t,arguments.length>1?HE(arguments[1]):{})};fE.constructor=WE,WE.prototype=fE,OS({global:!0,constructor:!0,dontCallGetSet:!0,forced:!0},{Request:WE})}}var XE,zE=Pr,YE=I,ZE=Dw,$E=s,KE=Je,JE=S,qE=ss,QE=function(t,e,r){return Lw.f(t,e,r)},tC=vb,eC=Jt,rC=Zw,iC=function(t){var e=Qw(t),r=rS(this),i=arguments.length,n=i>1?arguments[1]:void 0,s=void 0!==n;s&&(n=Jw(n,i>2?arguments[2]:void 0));var o,a,h,l,c,u,d=oS(e),p=0;if(!d||this===aS&&eS(d))for(o=iS(e),a=r?new this(o):aS(o);o>p;p++)u=s?n(e[p],p):e[p],nS(a,p,u);else for(c=(l=sS(e,d)).next,a=r?new this:[];!(h=qw(c,l)).done;p++)u=s?tS(l,n,[h.value,p],!0):h.value,nS(a,p,u);return a.length=p,a},nC=Jn,sC=Ll.codeAt,oC=function(t){var e,r,i=[],n=xS(_S(TS(t),uS,"."),".");for(e=0;e<n.length;e++)r=n[e],bS(i,fS(cS,r)?"xn--"+ES(r):r);return yS(i,".")},aC=$i,hC=Ps,lC=Ju,cC={URLSearchParams:UE,getState:aE},uC=Xs,dC=uC.set,pC=uC.getterFor("URL"),fC=cC.URLSearchParams,mC=cC.getState,gC=$E.URL,vC=$E.TypeError,yC=$E.parseInt,bC=Math.floor,_C=Math.pow,xC=JE("".charAt),TC=JE(/./.exec),wC=JE([].join),SC=JE(1..toString),EC=JE([].pop),CC=JE([].push),AC=JE("".replace),RC=JE([].shift),PC=JE("".split),IC=JE("".slice),MC=JE("".toLowerCase),OC=JE([].unshift),kC="Invalid scheme",DC="Invalid host",LC="Invalid port",NC=/[a-z]/i,FC=/[\d+-.a-z]/i,BC=/\d/,UC=/^0x/i,GC=/^[0-7]+$/,jC=/^\d+$/,VC=/^[\da-f]+$/i,HC=/[\0\t\n\r #%/:<>?@[\\\]^|]/,WC=/[\0\t\n\r #/:<>?@[\\\]^|]/,XC=/^[\u0000-\u0020]+|[\u0000-\u0020]+$/g,zC=/[\t\n\r]/g,YC=function(t){var e,r,i,n;if("number"==typeof t){for(e=[],r=0;r<4;r++)OC(e,t%256),t=bC(t/256);return wC(e,".")}if("object"==typeof t){for(e="",i=function(t){for(var e=null,r=1,i=null,n=0,s=0;s<8;s++)0!==t[s]?(n>r&&(e=i,r=n),i=null,n=0):(null===i&&(i=s),++n);return n>r&&(e=i,r=n),e}(t),r=0;r<8;r++)n&&0===t[r]||(n&&(n=!1),i===r?(e+=r?":":"::",n=!0):(e+=SC(t[r],16),r<7&&(e+=":")));return"["+e+"]"}return t},ZC={},$C=rC({},ZC,{" ":1,'"':1,"<":1,">":1,"`":1}),KC=rC({},$C,{"#":1,"?":1,"{":1,"}":1}),JC=rC({},KC,{"/":1,":":1,";":1,"=":1,"@":1,"[":1,"\\":1,"]":1,"^":1,"|":1}),qC=function(t,e){var r=sC(t,0);return r>32&&r<127&&!eC(e,t)?t:encodeURIComponent(t)},QC={ftp:21,file:null,http:80,https:443,ws:80,wss:443},tA=function(t,e){var r;return 2==t.length&&TC(NC,xC(t,0))&&(":"==(r=xC(t,1))||!e&&"|"==r)},eA=function(t){var e;return t.length>1&&tA(IC(t,0,2))&&(2==t.length||"/"===(e=xC(t,2))||"\\"===e||"?"===e||"#"===e)},rA=function(t){return"."===t||"%2e"===MC(t)},iA={},nA={},sA={},oA={},aA={},hA={},lA={},cA={},uA={},dA={},pA={},fA={},mA={},gA={},vA={},yA={},bA={},_A={},xA={},TA={},wA={},SA=function(t,e,r){var i,n,s,o=aC(t);if(e){if(n=this.parse(o))throw vC(n);this.searchParams=null}else{if(void 0!==r&&(i=new SA(r,!0)),n=this.parse(o,null,i))throw vC(n);(s=mC(new fC)).bindURL(this),this.searchParams=s}};SA.prototype={type:"URL",parse:function(t,e,r){var i,n,s,o,a,h=this,l=e||iA,c=0,u="",d=!1,p=!1,f=!1;for(t=aC(t),e||(h.scheme="",h.username="",h.password="",h.host=null,h.port=null,h.path=[],h.query=null,h.fragment=null,h.cannotBeABaseURL=!1,t=AC(t,XC,"")),t=AC(t,zC,""),i=iC(t);c<=i.length;){switch(n=i[c],l){case iA:if(!n||!TC(NC,n)){if(e)return kC;l=sA;continue}u+=MC(n),l=nA;break;case nA:if(n&&(TC(FC,n)||"+"==n||"-"==n||"."==n))u+=MC(n);else{if(":"!=n){if(e)return kC;u="",l=sA,c=0;continue}if(e&&(h.isSpecial()!=eC(QC,u)||"file"==u&&(h.includesCredentials()||null!==h.port)||"file"==h.scheme&&!h.host))return;if(h.scheme=u,e)return void(h.isSpecial()&&QC[h.scheme]==h.port&&(h.port=null));u="","file"==h.scheme?l=gA:h.isSpecial()&&r&&r.scheme==h.scheme?l=oA:h.isSpecial()?l=cA:"/"==i[c+1]?(l=aA,c++):(h.cannotBeABaseURL=!0,CC(h.path,""),l=xA)}break;case sA:if(!r||r.cannotBeABaseURL&&"#"!=n)return kC;if(r.cannotBeABaseURL&&"#"==n){h.scheme=r.scheme,h.path=nC(r.path),h.query=r.query,h.fragment="",h.cannotBeABaseURL=!0,l=wA;break}l="file"==r.scheme?gA:hA;continue;case oA:if("/"!=n||"/"!=i[c+1]){l=hA;continue}l=uA,c++;break;case aA:if("/"==n){l=dA;break}l=_A;continue;case hA:if(h.scheme=r.scheme,n==XE)h.username=r.username,h.password=r.password,h.host=r.host,h.port=r.port,h.path=nC(r.path),h.query=r.query;else if("/"==n||"\\"==n&&h.isSpecial())l=lA;else if("?"==n)h.username=r.username,h.password=r.password,h.host=r.host,h.port=r.port,h.path=nC(r.path),h.query="",l=TA;else{if("#"!=n){h.username=r.username,h.password=r.password,h.host=r.host,h.port=r.port,h.path=nC(r.path),h.path.length--,l=_A;continue}h.username=r.username,h.password=r.password,h.host=r.host,h.port=r.port,h.path=nC(r.path),h.query=r.query,h.fragment="",l=wA}break;case lA:if(!h.isSpecial()||"/"!=n&&"\\"!=n){if("/"!=n){h.username=r.username,h.password=r.password,h.host=r.host,h.port=r.port,l=_A;continue}l=dA}else l=uA;break;case cA:if(l=uA,"/"!=n||"/"!=xC(u,c+1))continue;c++;break;case uA:if("/"!=n&&"\\"!=n){l=dA;continue}break;case dA:if("@"==n){d&&(u="%40"+u),d=!0,s=iC(u);for(var m=0;m<s.length;m++){var g=s[m];if(":"!=g||f){var v=qC(g,JC);f?h.password+=v:h.username+=v}else f=!0}u=""}else if(n==XE||"/"==n||"?"==n||"#"==n||"\\"==n&&h.isSpecial()){if(d&&""==u)return"Invalid authority";c-=iC(u).length+1,u="",l=pA}else u+=n;break;case pA:case fA:if(e&&"file"==h.scheme){l=yA;continue}if(":"!=n||p){if(n==XE||"/"==n||"?"==n||"#"==n||"\\"==n&&h.isSpecial()){if(h.isSpecial()&&""==u)return DC;if(e&&""==u&&(h.includesCredentials()||null!==h.port))return;if(o=h.parseHost(u))return o;if(u="",l=bA,e)return;continue}"["==n?p=!0:"]"==n&&(p=!1),u+=n}else{if(""==u)return DC;if(o=h.parseHost(u))return o;if(u="",l=mA,e==fA)return}break;case mA:if(!TC(BC,n)){if(n==XE||"/"==n||"?"==n||"#"==n||"\\"==n&&h.isSpecial()||e){if(""!=u){var y=yC(u,10);if(y>65535)return LC;h.port=h.isSpecial()&&y===QC[h.scheme]?null:y,u=""}if(e)return;l=bA;continue}return LC}u+=n;break;case gA:if(h.scheme="file","/"==n||"\\"==n)l=vA;else{if(!r||"file"!=r.scheme){l=_A;continue}if(n==XE)h.host=r.host,h.path=nC(r.path),h.query=r.query;else if("?"==n)h.host=r.host,h.path=nC(r.path),h.query="",l=TA;else{if("#"!=n){eA(wC(nC(i,c),""))||(h.host=r.host,h.path=nC(r.path),h.shortenPath()),l=_A;continue}h.host=r.host,h.path=nC(r.path),h.query=r.query,h.fragment="",l=wA}}break;case vA:if("/"==n||"\\"==n){l=yA;break}r&&"file"==r.scheme&&!eA(wC(nC(i,c),""))&&(tA(r.path[0],!0)?CC(h.path,r.path[0]):h.host=r.host),l=_A;continue;case yA:if(n==XE||"/"==n||"\\"==n||"?"==n||"#"==n){if(!e&&tA(u))l=_A;else if(""==u){if(h.host="",e)return;l=bA}else{if(o=h.parseHost(u))return o;if("localhost"==h.host&&(h.host=""),e)return;u="",l=bA}continue}u+=n;break;case bA:if(h.isSpecial()){if(l=_A,"/"!=n&&"\\"!=n)continue}else if(e||"?"!=n)if(e||"#"!=n){if(n!=XE&&(l=_A,"/"!=n))continue}else h.fragment="",l=wA;else h.query="",l=TA;break;case _A:if(n==XE||"/"==n||"\\"==n&&h.isSpecial()||!e&&("?"==n||"#"==n)){if(".."===(a=MC(a=u))||"%2e."===a||".%2e"===a||"%2e%2e"===a?(h.shortenPath(),"/"==n||"\\"==n&&h.isSpecial()||CC(h.path,"")):rA(u)?"/"==n||"\\"==n&&h.isSpecial()||CC(h.path,""):("file"==h.scheme&&!h.path.length&&tA(u)&&(h.host&&(h.host=""),u=xC(u,0)+":"),CC(h.path,u)),u="","file"==h.scheme&&(n==XE||"?"==n||"#"==n))for(;h.path.length>1&&""===h.path[0];)RC(h.path);"?"==n?(h.query="",l=TA):"#"==n&&(h.fragment="",l=wA)}else u+=qC(n,KC);break;case xA:"?"==n?(h.query="",l=TA):"#"==n?(h.fragment="",l=wA):n!=XE&&(h.path[0]+=qC(n,ZC));break;case TA:e||"#"!=n?n!=XE&&("'"==n&&h.isSpecial()?h.query+="%27":h.query+="#"==n?"%23":qC(n,ZC)):(h.fragment="",l=wA);break;case wA:n!=XE&&(h.fragment+=qC(n,$C))}c++}},parseHost:function(t){var e,r,i;if("["==xC(t,0)){if("]"!=xC(t,t.length-1))return DC;if(e=function(t){var e,r,i,n,s,o,a,h=[0,0,0,0,0,0,0,0],l=0,c=null,u=0,d=function(){return xC(t,u)};if(":"==d()){if(":"!=xC(t,1))return;u+=2,c=++l}for(;d();){if(8==l)return;if(":"!=d()){for(e=r=0;r<4&&TC(VC,d());)e=16*e+yC(d(),16),u++,r++;if("."==d()){if(0==r)return;if(u-=r,l>6)return;for(i=0;d();){if(n=null,i>0){if(!("."==d()&&i<4))return;u++}if(!TC(BC,d()))return;for(;TC(BC,d());){if(s=yC(d(),10),null===n)n=s;else{if(0==n)return;n=10*n+s}if(n>255)return;u++}h[l]=256*h[l]+n,2!=++i&&4!=i||l++}if(4!=i)return;break}if(":"==d()){if(u++,!d())return}else if(d())return;h[l++]=e}else{if(null!==c)return;u++,c=++l}}if(null!==c)for(o=l-c,l=7;0!=l&&o>0;)a=h[l],h[l--]=h[c+o-1],h[c+--o]=a;else if(8!=l)return;return h}(IC(t,1,-1)),!e)return DC;this.host=e}else if(this.isSpecial()){if(t=oC(t),TC(HC,t))return DC;if(e=function(t){var e,r,i,n,s,o,a,h=PC(t,".");if(h.length&&""==h[h.length-1]&&h.length--,(e=h.length)>4)return t;for(r=[],i=0;i<e;i++){if(""==(n=h[i]))return t;if(s=10,n.length>1&&"0"==xC(n,0)&&(s=TC(UC,n)?16:8,n=IC(n,8==s?1:2)),""===n)o=0;else{if(!TC(10==s?jC:8==s?GC:VC,n))return t;o=yC(n,s)}CC(r,o)}for(i=0;i<e;i++)if(o=r[i],i==e-1){if(o>=_C(256,5-e))return null}else if(o>255)return null;for(a=EC(r),i=0;i<r.length;i++)a+=r[i]*_C(256,3-i);return a}(t),null===e)return DC;this.host=e}else{if(TC(WC,t))return DC;for(e="",r=iC(t),i=0;i<r.length;i++)e+=qC(r[i],ZC);this.host=e}},cannotHaveUsernamePasswordPort:function(){return!this.host||this.cannotBeABaseURL||"file"==this.scheme},includesCredentials:function(){return""!=this.username||""!=this.password},isSpecial:function(){return eC(QC,this.scheme)},shortenPath:function(){var t=this.path,e=t.length;!e||"file"==this.scheme&&1==e&&tA(t[0],!0)||t.length--},serialize:function(){var t=this,e=t.scheme,r=t.username,i=t.password,n=t.host,s=t.port,o=t.path,a=t.query,h=t.fragment,l=e+":";return null!==n?(l+="//",t.includesCredentials()&&(l+=r+(i?":"+i:"")+"@"),l+=YC(n),null!==s&&(l+=":"+s)):"file"==e&&(l+="//"),l+=t.cannotBeABaseURL?o[0]:o.length?"/"+wC(o,"/"):"",null!==a&&(l+="?"+a),null!==h&&(l+="#"+h),l},setHref:function(t){var e=this.parse(t);if(e)throw vC(e);this.searchParams.update()},getOrigin:function(){var t=this.scheme,e=this.port;if("blob"==t)try{return new EA(t.path[0]).origin}catch(t){return"null"}return"file"!=t&&this.isSpecial()?t+"://"+YC(this.host)+(null!==e?":"+e:""):"null"},getProtocol:function(){return this.scheme+":"},setProtocol:function(t){this.parse(aC(t)+":",iA)},getUsername:function(){return this.username},setUsername:function(t){var e=iC(aC(t));if(!this.cannotHaveUsernamePasswordPort()){this.username="";for(var r=0;r<e.length;r++)this.username+=qC(e[r],JC)}},getPassword:function(){return this.password},setPassword:function(t){var e=iC(aC(t));if(!this.cannotHaveUsernamePasswordPort()){this.password="";for(var r=0;r<e.length;r++)this.password+=qC(e[r],JC)}},getHost:function(){var t=this.host,e=this.port;return null===t?"":null===e?YC(t):YC(t)+":"+e},setHost:function(t){this.cannotBeABaseURL||this.parse(t,pA)},getHostname:function(){var t=this.host;return null===t?"":YC(t)},setHostname:function(t){this.cannotBeABaseURL||this.parse(t,fA)},getPort:function(){var t=this.port;return null===t?"":aC(t)},setPort:function(t){this.cannotHaveUsernamePasswordPort()||(""==(t=aC(t))?this.port=null:this.parse(t,mA))},getPathname:function(){var t=this.path;return this.cannotBeABaseURL?t[0]:t.length?"/"+wC(t,"/"):""},setPathname:function(t){this.cannotBeABaseURL||(this.path=[],this.parse(t,bA))},getSearch:function(){var t=this.query;return t?"?"+t:""},setSearch:function(t){""==(t=aC(t))?this.query=null:("?"==xC(t,0)&&(t=IC(t,1)),this.query="",this.parse(t,TA)),this.searchParams.update()},getSearchParams:function(){return this.searchParams.facade},getHash:function(){var t=this.fragment;return t?"#"+t:""},setHash:function(t){""!=(t=aC(t))?("#"==xC(t,0)&&(t=IC(t,1)),this.fragment="",this.parse(t,wA)):this.fragment=null},update:function(){this.query=this.searchParams.serialize()||null}};var EA=function(t){var e=tC(this,CA),r=lC(arguments.length,1)>1?arguments[1]:void 0,i=dC(e,new SA(t,!1,r));YE||(e.href=i.serialize(),e.origin=i.getOrigin(),e.protocol=i.getProtocol(),e.username=i.getUsername(),e.password=i.getPassword(),e.host=i.getHost(),e.hostname=i.getHostname(),e.port=i.getPort(),e.pathname=i.getPathname(),e.search=i.getSearch(),e.searchParams=i.getSearchParams(),e.hash=i.getHash())},CA=EA.prototype,AA=function(t,e){return{get:function(){return pC(this)[t]()},set:e&&function(t){return pC(this)[e](t)},configurable:!0,enumerable:!0}};if(YE&&(QE(CA,"href",AA("serialize","setHref")),QE(CA,"origin",AA("getOrigin")),QE(CA,"protocol",AA("getProtocol","setProtocol")),QE(CA,"username",AA("getUsername","setUsername")),QE(CA,"password",AA("getPassword","setPassword")),QE(CA,"host",AA("getHost","setHost")),QE(CA,"hostname",AA("getHostname","setHostname")),QE(CA,"port",AA("getPort","setPort")),QE(CA,"pathname",AA("getPathname","setPathname")),QE(CA,"search",AA("getSearch","setSearch")),QE(CA,"searchParams",AA("getSearchParams")),QE(CA,"hash",AA("getHash","setHash"))),qE(CA,"toJSON",(function(){return pC(this).serialize()}),{enumerable:!0}),qE(CA,"toString",(function(){return pC(this).serialize()}),{enumerable:!0}),gC){var RA=gC.createObjectURL,PA=gC.revokeObjectURL;RA&&qE(EA,"createObjectURL",KE(RA,gC)),PA&&qE(EA,"revokeObjectURL",KE(PA,gC))}hC(EA,"URL"),zE({global:!0,constructor:!0,forced:!ZE,sham:!YE},{URL:EA});var IA=rt.URL;function MA(t,e,r){var i=void 0===e?null:e,n=function(t,e){var r=atob(t);if(e){for(var i=new Uint8Array(r.length),n=0,s=r.length;n<s;++n)i[n]=r.charCodeAt(n);return String.fromCharCode.apply(null,new Uint16Array(i.buffer))}return r}(t,void 0!==r&&r),s=n.indexOf("\n",10)+1,o=n.substring(s)+(i?"//# sourceMappingURL="+i:""),a=new Blob([o],{type:"application/javascript"});return URL.createObjectURL(a)}var OA=function(t,e,r){var i;return function(n){return i=i||MA(t,e,r),new Worker(i,n)}}("Lyogcm9sbHVwLXBsdWdpbi13ZWItd29ya2VyLWxvYWRlciAqLwp2YXIgd29ya2VyX2NvZGU9ZnVuY3Rpb24oKXsidXNlIHN0cmljdCI7dmFyIHQ9InVuZGVmaW5lZCIhPXR5cGVvZiBnbG9iYWxUaGlzP2dsb2JhbFRoaXM6InVuZGVmaW5lZCIhPXR5cGVvZiB3aW5kb3c/d2luZG93OiJ1bmRlZmluZWQiIT10eXBlb2YgZ2xvYmFsP2dsb2JhbDoidW5kZWZpbmVkIiE9dHlwZW9mIHNlbGY/c2VsZjp7fSxlPWZ1bmN0aW9uKHQpe3JldHVybiB0JiZ0Lk1hdGg9PU1hdGgmJnR9LG49ZSgib2JqZWN0Ij09dHlwZW9mIGdsb2JhbFRoaXMmJmdsb2JhbFRoaXMpfHxlKCJvYmplY3QiPT10eXBlb2Ygd2luZG93JiZ3aW5kb3cpfHxlKCJvYmplY3QiPT10eXBlb2Ygc2VsZiYmc2VsZil8fGUoIm9iamVjdCI9PXR5cGVvZiB0JiZ0KXx8ZnVuY3Rpb24oKXtyZXR1cm4gdGhpc30oKXx8RnVuY3Rpb24oInJldHVybiB0aGlzIikoKSxyPWZ1bmN0aW9uKHQpe3RyeXtyZXR1cm4hIXQoKX1jYXRjaCh0KXtyZXR1cm4hMH19LG89IXIoKGZ1bmN0aW9uKCl7dmFyIHQ9ZnVuY3Rpb24oKXt9LmJpbmQoKTtyZXR1cm4iZnVuY3Rpb24iIT10eXBlb2YgdHx8dC5oYXNPd25Qcm9wZXJ0eSgicHJvdG90eXBlIil9KSksaT1vLHU9RnVuY3Rpb24ucHJvdG90eXBlLGM9dS5hcHBseSxhPXUuY2FsbCxmPSJvYmplY3QiPT10eXBlb2YgUmVmbGVjdCYmUmVmbGVjdC5hcHBseXx8KGk/YS5iaW5kKGMpOmZ1bmN0aW9uKCl7cmV0dXJuIGEuYXBwbHkoYyxhcmd1bWVudHMpfSksbD1vLHA9RnVuY3Rpb24ucHJvdG90eXBlLHM9cC5jYWxsLGI9bCYmcC5iaW5kLmJpbmQocyxzKSx5PWw/YjpmdW5jdGlvbih0KXtyZXR1cm4gZnVuY3Rpb24oKXtyZXR1cm4gcy5hcHBseSh0LGFyZ3VtZW50cyl9fSx2PXksZD12KHt9LnRvU3RyaW5nKSxoPXYoIiIuc2xpY2UpLG09ZnVuY3Rpb24odCl7cmV0dXJuIGgoZCh0KSw4LC0xKX0sZz1tLHc9eSxqPWZ1bmN0aW9uKHQpe2lmKCJGdW5jdGlvbiI9PT1nKHQpKXJldHVybiB3KHQpfSxTPSJvYmplY3QiPT10eXBlb2YgZG9jdW1lbnQmJmRvY3VtZW50LmFsbCxPPXthbGw6UyxJU19IVE1MRERBOnZvaWQgMD09PVMmJnZvaWQgMCE9PVN9LFQ9Ty5hbGwsRT1PLklTX0hUTUxEREE/ZnVuY3Rpb24odCl7cmV0dXJuImZ1bmN0aW9uIj09dHlwZW9mIHR8fHQ9PT1UfTpmdW5jdGlvbih0KXtyZXR1cm4iZnVuY3Rpb24iPT10eXBlb2YgdH0sUD17fSxJPSFyKChmdW5jdGlvbigpe3JldHVybiA3IT1PYmplY3QuZGVmaW5lUHJvcGVydHkoe30sMSx7Z2V0OmZ1bmN0aW9uKCl7cmV0dXJuIDd9fSlbMV19KSksRD1vLF89RnVuY3Rpb24ucHJvdG90eXBlLmNhbGwsTD1EP18uYmluZChfKTpmdW5jdGlvbigpe3JldHVybiBfLmFwcGx5KF8sYXJndW1lbnRzKX0saz17fSxNPXt9LnByb3BlcnR5SXNFbnVtZXJhYmxlLEM9T2JqZWN0LmdldE93blByb3BlcnR5RGVzY3JpcHRvcixGPUMmJiFNLmNhbGwoezE6Mn0sMSk7ay5mPUY/ZnVuY3Rpb24odCl7dmFyIGU9Qyh0aGlzLHQpO3JldHVybiEhZSYmZS5lbnVtZXJhYmxlfTpNO3ZhciBBLHosTj1mdW5jdGlvbih0LGUpe3JldHVybntlbnVtZXJhYmxlOiEoMSZ0KSxjb25maWd1cmFibGU6ISgyJnQpLHdyaXRhYmxlOiEoNCZ0KSx2YWx1ZTplfX0seD1yLEg9bSxSPU9iamVjdCxHPWooIiIuc3BsaXQpLFY9eCgoZnVuY3Rpb24oKXtyZXR1cm4hUigieiIpLnByb3BlcnR5SXNFbnVtZXJhYmxlKDApfSkpP2Z1bmN0aW9uKHQpe3JldHVybiJTdHJpbmciPT1IKHQpP0codCwiIik6Uih0KX06UixZPWZ1bmN0aW9uKHQpe3JldHVybiBudWxsPT10fSxxPVksQj1UeXBlRXJyb3IsSj1mdW5jdGlvbih0KXtpZihxKHQpKXRocm93IEIoIkNhbid0IGNhbGwgbWV0aG9kIG9uICIrdCk7cmV0dXJuIHR9LEs9VixRPUosVT1FLFc9Ty5hbGwsWD1PLklTX0hUTUxEREE/ZnVuY3Rpb24odCl7cmV0dXJuIm9iamVjdCI9PXR5cGVvZiB0P251bGwhPT10OlUodCl8fHQ9PT1XfTpmdW5jdGlvbih0KXtyZXR1cm4ib2JqZWN0Ij09dHlwZW9mIHQ/bnVsbCE9PXQ6VSh0KX0sWj17fSwkPVosdHQ9bixldD1FLG50PWZ1bmN0aW9uKHQpe3JldHVybiBldCh0KT90OnZvaWQgMH0scnQ9ZnVuY3Rpb24odCxlKXtyZXR1cm4gYXJndW1lbnRzLmxlbmd0aDwyP250KCRbdF0pfHxudCh0dFt0XSk6JFt0XSYmJFt0XVtlXXx8dHRbdF0mJnR0W3RdW2VdfSxvdD1qKHt9LmlzUHJvdG90eXBlT2YpLGl0PXJ0KCJuYXZpZ2F0b3IiLCJ1c2VyQWdlbnQiKXx8IiIsdXQ9bixjdD1pdCxhdD11dC5wcm9jZXNzLGZ0PXV0LkRlbm8sbHQ9YXQmJmF0LnZlcnNpb25zfHxmdCYmZnQudmVyc2lvbixwdD1sdCYmbHQudjg7cHQmJih6PShBPXB0LnNwbGl0KCIuIikpWzBdPjAmJkFbMF08ND8xOisoQVswXStBWzFdKSksIXomJmN0JiYoIShBPWN0Lm1hdGNoKC9FZGdlXC8oXGQrKS8pKXx8QVsxXT49NzQpJiYoQT1jdC5tYXRjaCgvQ2hyb21lXC8oXGQrKS8pKSYmKHo9K0FbMV0pO3ZhciBzdD16LGJ0PXIseXQ9ISFPYmplY3QuZ2V0T3duUHJvcGVydHlTeW1ib2xzJiYhYnQoKGZ1bmN0aW9uKCl7dmFyIHQ9U3ltYm9sKCk7cmV0dXJuIVN0cmluZyh0KXx8IShPYmplY3QodClpbnN0YW5jZW9mIFN5bWJvbCl8fCFTeW1ib2wuc2hhbSYmc3QmJnN0PDQxfSkpLHZ0PXl0JiYhU3ltYm9sLnNoYW0mJiJzeW1ib2wiPT10eXBlb2YgU3ltYm9sLml0ZXJhdG9yLGR0PXJ0LGh0PUUsbXQ9b3QsZ3Q9T2JqZWN0LHd0PXZ0P2Z1bmN0aW9uKHQpe3JldHVybiJzeW1ib2wiPT10eXBlb2YgdH06ZnVuY3Rpb24odCl7dmFyIGU9ZHQoIlN5bWJvbCIpO3JldHVybiBodChlKSYmbXQoZS5wcm90b3R5cGUsZ3QodCkpfSxqdD1TdHJpbmcsU3Q9RSxPdD1mdW5jdGlvbih0KXt0cnl7cmV0dXJuIGp0KHQpfWNhdGNoKHQpe3JldHVybiJPYmplY3QifX0sVHQ9VHlwZUVycm9yLEV0PWZ1bmN0aW9uKHQpe2lmKFN0KHQpKXJldHVybiB0O3Rocm93IFR0KE90KHQpKyIgaXMgbm90IGEgZnVuY3Rpb24iKX0sUHQ9RXQsSXQ9WSxEdD1MLF90PUUsTHQ9WCxrdD1UeXBlRXJyb3IsTXQ9e2V4cG9ydHM6e319LEN0PW4sRnQ9T2JqZWN0LmRlZmluZVByb3BlcnR5LEF0PWZ1bmN0aW9uKHQsZSl7dHJ5e0Z0KEN0LHQse3ZhbHVlOmUsY29uZmlndXJhYmxlOiEwLHdyaXRhYmxlOiEwfSl9Y2F0Y2gobil7Q3RbdF09ZX1yZXR1cm4gZX0senQ9Il9fY29yZS1qc19zaGFyZWRfXyIsTnQ9blt6dF18fEF0KHp0LHt9KTsoTXQuZXhwb3J0cz1mdW5jdGlvbih0LGUpe3JldHVybiBOdFt0XXx8KE50W3RdPXZvaWQgMCE9PWU/ZTp7fSl9KSgidmVyc2lvbnMiLFtdKS5wdXNoKHt2ZXJzaW9uOiIzLjI2LjAiLG1vZGU6InB1cmUiLGNvcHlyaWdodDoiwqkgMjAxNC0yMDIyIERlbmlzIFB1c2hrYXJldiAoemxvaXJvY2sucnUpIixsaWNlbnNlOiJodHRwczovL2dpdGh1Yi5jb20vemxvaXJvY2svY29yZS1qcy9ibG9iL3YzLjI2LjAvTElDRU5TRSIsc291cmNlOiJodHRwczovL2dpdGh1Yi5jb20vemxvaXJvY2svY29yZS1qcyJ9KTt2YXIgeHQ9SixIdD1PYmplY3QsUnQ9ZnVuY3Rpb24odCl7cmV0dXJuIEh0KHh0KHQpKX0sR3Q9aih7fS5oYXNPd25Qcm9wZXJ0eSksVnQ9T2JqZWN0Lmhhc093bnx8ZnVuY3Rpb24odCxlKXtyZXR1cm4gR3QoUnQodCksZSl9LFl0PWoscXQ9MCxCdD1NYXRoLnJhbmRvbSgpLEp0PVl0KDEuLnRvU3RyaW5nKSxLdD1uLFF0PU10LmV4cG9ydHMsVXQ9VnQsV3Q9ZnVuY3Rpb24odCl7cmV0dXJuIlN5bWJvbCgiKyh2b2lkIDA9PT10PyIiOnQpKyIpXyIrSnQoKytxdCtCdCwzNil9LFh0PXl0LFp0PXZ0LCR0PVF0KCJ3a3MiKSx0ZT1LdC5TeW1ib2wsZWU9dGUmJnRlLmZvcixuZT1adD90ZTp0ZSYmdGUud2l0aG91dFNldHRlcnx8V3QscmU9TCxvZT1YLGllPXd0LHVlPWZ1bmN0aW9uKHQsZSl7dmFyIG49dFtlXTtyZXR1cm4gSXQobik/dm9pZCAwOlB0KG4pfSxjZT1mdW5jdGlvbih0LGUpe3ZhciBuLHI7aWYoInN0cmluZyI9PT1lJiZfdChuPXQudG9TdHJpbmcpJiYhTHQocj1EdChuLHQpKSlyZXR1cm4gcjtpZihfdChuPXQudmFsdWVPZikmJiFMdChyPUR0KG4sdCkpKXJldHVybiByO2lmKCJzdHJpbmciIT09ZSYmX3Qobj10LnRvU3RyaW5nKSYmIUx0KHI9RHQobix0KSkpcmV0dXJuIHI7dGhyb3cga3QoIkNhbid0IGNvbnZlcnQgb2JqZWN0IHRvIHByaW1pdGl2ZSB2YWx1ZSIpfSxhZT1UeXBlRXJyb3IsZmU9ZnVuY3Rpb24odCl7aWYoIVV0KCR0LHQpfHwhWHQmJiJzdHJpbmciIT10eXBlb2YgJHRbdF0pe3ZhciBlPSJTeW1ib2wuIit0O1h0JiZVdCh0ZSx0KT8kdFt0XT10ZVt0XTokdFt0XT1adCYmZWU/ZWUoZSk6bmUoZSl9cmV0dXJuICR0W3RdfSgidG9QcmltaXRpdmUiKSxsZT1mdW5jdGlvbih0LGUpe2lmKCFvZSh0KXx8aWUodCkpcmV0dXJuIHQ7dmFyIG4scj11ZSh0LGZlKTtpZihyKXtpZih2b2lkIDA9PT1lJiYoZT0iZGVmYXVsdCIpLG49cmUocix0LGUpLCFvZShuKXx8aWUobikpcmV0dXJuIG47dGhyb3cgYWUoIkNhbid0IGNvbnZlcnQgb2JqZWN0IHRvIHByaW1pdGl2ZSB2YWx1ZSIpfXJldHVybiB2b2lkIDA9PT1lJiYoZT0ibnVtYmVyIiksY2UodCxlKX0scGU9d3Qsc2U9ZnVuY3Rpb24odCl7dmFyIGU9bGUodCwic3RyaW5nIik7cmV0dXJuIHBlKGUpP2U6ZSsiIn0sYmU9WCx5ZT1uLmRvY3VtZW50LHZlPWJlKHllKSYmYmUoeWUuY3JlYXRlRWxlbWVudCksZGU9ZnVuY3Rpb24odCl7cmV0dXJuIHZlP3llLmNyZWF0ZUVsZW1lbnQodCk6e319LGhlPSFJJiYhcigoZnVuY3Rpb24oKXtyZXR1cm4gNyE9T2JqZWN0LmRlZmluZVByb3BlcnR5KGRlKCJkaXYiKSwiYSIse2dldDpmdW5jdGlvbigpe3JldHVybiA3fX0pLmF9KSksbWU9SSxnZT1MLHdlPWssamU9TixTZT1mdW5jdGlvbih0KXtyZXR1cm4gSyhRKHQpKX0sT2U9c2UsVGU9VnQsRWU9aGUsUGU9T2JqZWN0LmdldE93blByb3BlcnR5RGVzY3JpcHRvcjtQLmY9bWU/UGU6ZnVuY3Rpb24odCxlKXtpZih0PVNlKHQpLGU9T2UoZSksRWUpdHJ5e3JldHVybiBQZSh0LGUpfWNhdGNoKHQpe31pZihUZSh0LGUpKXJldHVybiBqZSghZ2Uod2UuZix0LGUpLHRbZV0pfTt2YXIgSWU9cixEZT1FLF9lPS8jfFwucHJvdG90eXBlXC4vLExlPWZ1bmN0aW9uKHQsZSl7dmFyIG49TWVba2UodCldO3JldHVybiBuPT1GZXx8biE9Q2UmJihEZShlKT9JZShlKTohIWUpfSxrZT1MZS5ub3JtYWxpemU9ZnVuY3Rpb24odCl7cmV0dXJuIFN0cmluZyh0KS5yZXBsYWNlKF9lLCIuIikudG9Mb3dlckNhc2UoKX0sTWU9TGUuZGF0YT17fSxDZT1MZS5OQVRJVkU9Ik4iLEZlPUxlLlBPTFlGSUxMPSJQIixBZT1MZSx6ZT1FdCxOZT1vLHhlPWooai5iaW5kKSxIZT17fSxSZT1JJiZyKChmdW5jdGlvbigpe3JldHVybiA0MiE9T2JqZWN0LmRlZmluZVByb3BlcnR5KChmdW5jdGlvbigpe30pLCJwcm90b3R5cGUiLHt2YWx1ZTo0Mix3cml0YWJsZTohMX0pLnByb3RvdHlwZX0pKSxHZT1YLFZlPVN0cmluZyxZZT1UeXBlRXJyb3IscWU9SSxCZT1oZSxKZT1SZSxLZT1mdW5jdGlvbih0KXtpZihHZSh0KSlyZXR1cm4gdDt0aHJvdyBZZShWZSh0KSsiIGlzIG5vdCBhbiBvYmplY3QiKX0sUWU9c2UsVWU9VHlwZUVycm9yLFdlPU9iamVjdC5kZWZpbmVQcm9wZXJ0eSxYZT1PYmplY3QuZ2V0T3duUHJvcGVydHlEZXNjcmlwdG9yLFplPSJlbnVtZXJhYmxlIiwkZT0iY29uZmlndXJhYmxlIix0bj0id3JpdGFibGUiO0hlLmY9cWU/SmU/ZnVuY3Rpb24odCxlLG4pe2lmKEtlKHQpLGU9UWUoZSksS2UobiksImZ1bmN0aW9uIj09dHlwZW9mIHQmJiJwcm90b3R5cGUiPT09ZSYmInZhbHVlImluIG4mJnRuIGluIG4mJiFuLndyaXRhYmxlKXt2YXIgcj1YZSh0LGUpO3ImJnIud3JpdGFibGUmJih0W2VdPW4udmFsdWUsbj17Y29uZmlndXJhYmxlOiRlIGluIG4/bi5jb25maWd1cmFibGU6ci5jb25maWd1cmFibGUsZW51bWVyYWJsZTpaZSBpbiBuP24uZW51bWVyYWJsZTpyLmVudW1lcmFibGUsd3JpdGFibGU6ITF9KX1yZXR1cm4gV2UodCxlLG4pfTpXZTpmdW5jdGlvbih0LGUsbil7aWYoS2UodCksZT1RZShlKSxLZShuKSxCZSl0cnl7cmV0dXJuIFdlKHQsZSxuKX1jYXRjaCh0KXt9aWYoImdldCJpbiBufHwic2V0ImluIG4pdGhyb3cgVWUoIkFjY2Vzc29ycyBub3Qgc3VwcG9ydGVkIik7cmV0dXJuInZhbHVlImluIG4mJih0W2VdPW4udmFsdWUpLHR9O3ZhciBlbj1IZSxubj1OLHJuPUk/ZnVuY3Rpb24odCxlLG4pe3JldHVybiBlbi5mKHQsZSxubigxLG4pKX06ZnVuY3Rpb24odCxlLG4pe3JldHVybiB0W2VdPW4sdH0sb249bix1bj1mLGNuPWosYW49RSxmbj1QLmYsbG49QWUscG49Wixzbj1mdW5jdGlvbih0LGUpe3JldHVybiB6ZSh0KSx2b2lkIDA9PT1lP3Q6TmU/eGUodCxlKTpmdW5jdGlvbigpe3JldHVybiB0LmFwcGx5KGUsYXJndW1lbnRzKX19LGJuPXJuLHluPVZ0LHZuPWZ1bmN0aW9uKHQpe3ZhciBlPWZ1bmN0aW9uKG4scixvKXtpZih0aGlzIGluc3RhbmNlb2YgZSl7c3dpdGNoKGFyZ3VtZW50cy5sZW5ndGgpe2Nhc2UgMDpyZXR1cm4gbmV3IHQ7Y2FzZSAxOnJldHVybiBuZXcgdChuKTtjYXNlIDI6cmV0dXJuIG5ldyB0KG4scil9cmV0dXJuIG5ldyB0KG4scixvKX1yZXR1cm4gdW4odCx0aGlzLGFyZ3VtZW50cyl9O3JldHVybiBlLnByb3RvdHlwZT10LnByb3RvdHlwZSxlfSxkbj1mdW5jdGlvbih0LGUpe3ZhciBuLHIsbyxpLHUsYyxhLGYsbD10LnRhcmdldCxwPXQuZ2xvYmFsLHM9dC5zdGF0LGI9dC5wcm90byx5PXA/b246cz9vbltsXToob25bbF18fHt9KS5wcm90b3R5cGUsdj1wP3BuOnBuW2xdfHxibihwbixsLHt9KVtsXSxkPXYucHJvdG90eXBlO2ZvcihvIGluIGUpbj0hbG4ocD9vOmwrKHM/Ii4iOiIjIikrbyx0LmZvcmNlZCkmJnkmJnluKHksbyksdT12W29dLG4mJihjPXQuZG9udENhbGxHZXRTZXQ/KGY9Zm4oeSxvKSkmJmYudmFsdWU6eVtvXSksaT1uJiZjP2M6ZVtvXSxuJiZ0eXBlb2YgdT09dHlwZW9mIGl8fChhPXQuYmluZCYmbj9zbihpLG9uKTp0LndyYXAmJm4/dm4oaSk6YiYmYW4oaSk/Y24oaSk6aSwodC5zaGFtfHxpJiZpLnNoYW18fHUmJnUuc2hhbSkmJmJuKGEsInNoYW0iLCEwKSxibih2LG8sYSksYiYmKHluKHBuLHI9bCsiUHJvdG90eXBlIil8fGJuKHBuLHIse30pLGJuKHBuW3JdLG8saSksdC5yZWFsJiZkJiYhZFtvXSYmYm4oZCxvLGkpKSl9LGhuPWooW10uc2xpY2UpLG1uPVR5cGVFcnJvcixnbj1uLHduPWYsam49RSxTbj1obixPbj1mdW5jdGlvbih0LGUpe2lmKHQ8ZSl0aHJvdyBtbigiTm90IGVub3VnaCBhcmd1bWVudHMiKTtyZXR1cm4gdH0sVG49L01TSUUgLlwuLy50ZXN0KGl0KSxFbj1nbi5GdW5jdGlvbixQbj1mdW5jdGlvbih0KXtyZXR1cm4gVG4/ZnVuY3Rpb24oZSxuKXt2YXIgcj1Pbihhcmd1bWVudHMubGVuZ3RoLDEpPjIsbz1qbihlKT9lOkVuKGUpLGk9cj9Tbihhcmd1bWVudHMsMik6dm9pZCAwO3JldHVybiB0KHI/ZnVuY3Rpb24oKXt3bihvLHRoaXMsaSl9Om8sbil9OnR9LEluPXtzZXRUaW1lb3V0OlBuKGduLnNldFRpbWVvdXQpLHNldEludGVydmFsOlBuKGduLnNldEludGVydmFsKX0sRG49SW4uc2V0SW50ZXJ2YWw7ZG4oe2dsb2JhbDohMCxiaW5kOiEwLGZvcmNlZDpuLnNldEludGVydmFsIT09RG59LHtzZXRJbnRlcnZhbDpEbn0pO3ZhciBfbj1Jbi5zZXRUaW1lb3V0O2RuKHtnbG9iYWw6ITAsYmluZDohMCxmb3JjZWQ6bi5zZXRUaW1lb3V0IT09X259LHtzZXRUaW1lb3V0Ol9ufSk7dmFyIExuPVouc2V0SW50ZXJ2YWwsa249ITEsTW49bnVsbDtzZWxmLmFkZEV2ZW50TGlzdGVuZXIoIm1lc3NhZ2UiLChmdW5jdGlvbih0KXt2YXIgZT10LmRhdGEsbj1lLnR5cGUscj1lLmRhdGE7c3dpdGNoKG4pe2Nhc2Uic3RhcnQiOmtufHwoa249ITAsTW49TG4oKGZ1bmN0aW9uKCl7a249ITEsc2VsZi5wb3N0TWVzc2FnZSgidGljayIpfSksci50aW1lKSk7YnJlYWs7Y2FzZSJzdG9wIjpjbGVhckludGVydmFsKE1uKSxrbj0hMX19KSwhMSk7cmV0dXJue319KCk7Cgo=",null,!1),kA=function(){return new OA},DA=Xp("stream:media"),LA=function(){function t(){var t,e,r,i;this.mediaStream=null,this.videoEl=null,this.canvasEl=null,this.canvasContext=null,this.audioContext=null,this.audioSource=null,this.worker=null,this.config=null,this.promise=null,this.onVideoError=uc(t=this.onVideoError).call(t,this),this.onPause=uc(e=this.onPause).call(e,this),this.onVideoPlay=uc(r=this.onVideoPlay).call(r,this),this.renderCanvas=uc(i=this.renderCanvas).call(i,this)}return t.prototype.start=function(t){var e=this,r=t.video,i=t.audio,n=t.fileSource;return this.config=t,new zT((function(t,s){if(e.promise={resolve:t,reject:s},e.mediaStream)return DA("stream is existed"),void t(e.mediaStream);e.videoEl||(e.videoEl=vv()),e.videoEl.muted=!i,r&&!e.canvasEl&&(e.canvasEl=document.createElement("canvas"),e.canvasContext=e.canvasEl.getContext("2d",{desynchronized:!0,willReadFrequently:!0})),r&&!e.worker&&(e.worker=kA()),i&&!e.audioContext&&(e.audioContext=gv());var o=n instanceof File?IA.createObjectURL(n):n;e.playVideo(o)}))},t.prototype.stop=function(){var t;this.mediaStream?(this.destroy(),Rc(t=this.mediaStream.getTracks()).call(t,(function(t){t.stop()})),this.mediaStream=null):DA("stream is not existed")},t.prototype.getResolution=function(){if(!this.mediaStream)return null;var t=this.mediaStream.getVideoTracks();if(0===t.length)return null;var e=t[0].getSettings(),r=e.width,i=e.height;return{width:null!=r?r:this.canvasEl.width,height:null!=i?i:this.canvasEl.height}},t.prototype.getRenderView=function(){return this.canvasEl},t.prototype.getRenderElement=function(){return this.videoEl},t.prototype.onVideoError=function(){this.videoEl.error&&(DA("play video error",this.videoEl.error),this.promise.reject(this.videoEl.error))},t.prototype.onPause=function(){var t=this;DA("video is paused, try to resume"),ld((function(){t.videoEl.play()}),50)},t.prototype.onVideoPlay=function(){if(!this.mediaStream){this.videoEl.removeEventListener("timeupdate",this.onVideoPlay);var t=this.config,e=t.video,r=t.audio,i=null,n=null;if(e){var s=e.frameRate;this.renderCanvas(),DA("start render canvas");try{i=this.canvasEl.captureStream(s)}catch(t){return DA("get video stream error, ".concat(t.toString())),void this.promise.reject(t)}}if(r)try{this.audioSource||(this.audioSource=this.audioContext.createMediaElementSource(this.videoEl));var o=this.audioContext.createMediaStreamDestination();this.audioSource.connect(o),n=o.stream}catch(t){return DA("get audio stream error, ".concat(t.toString())),void this.promise.reject(t)}if(i||n){var a,h=new MediaStream;Rc(a=[i,n]).call(a,(function(t){var e,r,i=null===(r=null===(e=null==t?void 0:t.getTracks)||void 0===e?void 0:e.call(t))||void 0===r?void 0:r[0];i&&h.addTrack(i)})),this.mediaStream=h,this.promise.resolve(h)}}},t.prototype.renderCanvas=function(){if(this.canvasEl){var t=this.config.video.resolution,e=this.videoEl,r=t.width,i=t.height,n=e.videoWidth,s=e.videoHeight,o=null,a=null;0===n||0===s?(o=r,a=i):r/i<n/s?(o=r,a=r*s/n):(o=i*n/s,a=i),this.canvasEl.width=o,this.canvasEl.height=a;var h=this.canvasContext;null==h||h.clearRect(0,0,o,a),null==h||h.fillRect(0,0,o,a),null==h||h.drawImage(e,0,0,n,s,0,0,o,a),this.requestAnimationFrameWrapper(this.renderCanvas)}else DA("canvas destroy, render canvas stop")},t.prototype.setWorkerInterval=function(t,e){var r,i,n=this;null===(r=this.worker)||void 0===r||r.addEventListener("message",t),null===(i=this.worker)||void 0===i||i.postMessage({type:"start",data:{time:e}});return function(){var e,r;null===(e=n.worker)||void 0===e||e.postMessage({type:"stop"}),null===(r=n.worker)||void 0===r||r.removeEventListener("message",t)}},t.prototype.requestAnimationFrameWrapper=function(t){var e=this.config.video.frameRate,r=!1,i=this.setWorkerInterval((function(){!r&&document.hidden&&(r=!0,i(),t())}),1e3/e);requestAnimationFrame((function(){r||(r=!0,i(),t())}))},t.prototype.playVideo=function(t){return wd(this,void 0,void 0,(function(){var e,r;return Sd(this,(function(i){switch(i.label){case 0:(e=this.videoEl).addEventListener("error",this.onVideoError),e.addEventListener("pause",this.onPause),e.addEventListener("timeupdate",this.onVideoPlay),e.src=t,i.label=1;case 1:return i.trys.push([1,3,,4]),[4,e.play()];case 2:return i.sent(),DA("play ok"),[3,4];case 3:return r=i.sent(),DA("play failed, ".concat(r.toString())),this.promise.reject(r),this.destroy(),[3,4];case 4:return[2]}}))}))},t.prototype.destroy=function(){var t,e=this.videoEl;e.removeEventListener("error",this.onVideoError),e.removeEventListener("pause",this.onPause),e.removeEventListener("timeupdate",this.onVideoPlay),this.canvasEl&&(this.canvasContext=null,this.canvasEl=null);var r=e.src;e.pause(),e.src="",e.removeAttribute("src"),e.load(),r&&this.config.fileSource instanceof File&&IA.revokeObjectURL(r),this.config=null,this.promise=null,this.audioSource&&(this.audioSource.disconnect(),this.audioSource=null),window.TXLiveAudioContext||(null===(t=this.audioContext)||void 0===t||t.close(),this.audioContext=null),this.worker&&(this.worker.terminate(),this.worker=null),this.videoEl&&(this.videoEl.remove(),this.videoEl=null)},t}(),NA=Xp("stream:image"),FA=function(){function t(){var t,e;this.mediaStream=null,this.imageEl=null,this.canvasEl=null,this.canvasContext=null,this.worker=null,this.config=null,this.promise=null,this.onLoad=uc(t=this.onLoad).call(t,this),this.renderCanvas=uc(e=this.renderCanvas).call(e,this)}return t.prototype.start=function(t){var e=this,r=t.fileSource;return this.config=t,new zT((function(t,i){if(e.promise={resolve:t,reject:i},e.mediaStream)return NA("stream is existed"),void t(e.mediaStream);e.imageEl||(e.imageEl=new Image),e.canvasEl||(e.canvasEl=document.createElement("canvas"),e.canvasContext=e.canvasEl.getContext("2d",{desynchronized:!0})),e.worker||(e.worker=kA());var n=r instanceof File?IA.createObjectURL(r):r;e.loadImage(n)}))},t.prototype.stop=function(){var t;if(this.mediaStream){var e=this.imageEl.src;this.imageEl.removeEventListener("load",this.onLoad),this.imageEl.src="",this.imageEl=null,e&&this.config.fileSource instanceof File&&IA.revokeObjectURL(e),this.canvasContext=null,this.canvasEl=null,this.config=null,this.promise=null,this.worker&&(this.worker.terminate(),this.worker=null),Rc(t=this.mediaStream.getTracks()).call(t,(function(t){t.stop()})),this.mediaStream=null}else NA("stream is not existed")},t.prototype.getResolution=function(){if(!this.mediaStream)return null;var t=this.mediaStream.getVideoTracks();if(0===t.length)return null;var e=t[0].getSettings(),r=e.width,i=e.height;return{width:null!=r?r:this.canvasEl.width,height:null!=i?i:this.canvasEl.height}},t.prototype.getRenderView=function(){return this.canvasEl},t.prototype.getRenderElement=function(){return this.imageEl},t.prototype.onLoad=function(){var t=this.config.video.frameRate;this.renderCanvas(),NA("start render canvas");try{var e=this.canvasEl.captureStream(t),r=e.getAudioTracks();Rc(r).call(r,(function(t){e.removeTrack(t)})),this.mediaStream=e,this.promise.resolve(e)}catch(t){NA("get image stream error, ".concat(t.toString())),this.promise.reject(t)}},t.prototype.renderCanvas=function(){if(this.imageEl&&this.canvasEl){var t=this.config.video.resolution,e=t.width,r=t.height,i=this.imageEl.naturalWidth,n=this.imageEl.naturalHeight,s=null,o=null;0===i||0===n?(s=e,o=r):e/r<i/n?(s=e,o=e*n/i):(s=r*i/n,o=r),this.canvasEl.width=s,this.canvasEl.height=o;var a=this.canvasContext;null==a||a.clearRect(0,0,s,o),null==a||a.fillRect(0,0,s,o),null==a||a.drawImage(this.imageEl,0,0,i,n,0,0,s,o),this.requestAnimationFrameWrapper(this.renderCanvas)}else NA("render canvas stop")},t.prototype.loadImage=function(t){this.imageEl.addEventListener("load",this.onLoad),this.imageEl.src=t},t.prototype.setWorkerInterval=function(t,e){var r,i,n=this;null===(r=this.worker)||void 0===r||r.addEventListener("message",t),null===(i=this.worker)||void 0===i||i.postMessage({type:"start",data:{time:e}});return function(){var e,r;null===(e=n.worker)||void 0===e||e.postMessage({type:"stop"}),null===(r=n.worker)||void 0===r||r.removeEventListener("message",t)}},t.prototype.requestAnimationFrameWrapper=function(t){var e=this.config.video.frameRate,r=!1,i=this.setWorkerInterval((function(){!r&&document.hidden&&(r=!0,i(),t())}),1e3/e);requestAnimationFrame((function(){r||(r=!0,i(),t())}))},t}(),BA=Xp("stream"),UA=function(){function t(t){this.type=null,this.videoConfig=null,this.audioConfig=null,this.fileSource=null,this.onEvent=null,this.instance=null,this.needStopListener=!1;var e=t.type,r=t.video,i=t.audio,n=t.fileSource,s=t.onEvent;e&&$u(rf).call(rf,e)?(this.type=e,"file"===e&&this.setFileSource(n),r||i?((r||"screen"===e)&&(this.videoConfig=zg(nf)),i&&(this.audioConfig=zg(sf)),s&&"function"==typeof s&&(this.onEvent=s)):BA("video or audio must be existed")):BA("stream type(".concat(e,") is invalid"))}return t.prototype.setFileSource=function(t){var e,r;if("file"===this.type)if(t)if("string"==typeof t||t instanceof File){var i="string"==typeof t?xd(e=hf.extension).call(e,(function(e){var r;return xw(r=t.toLowerCase()).call(r,e)})):xd(r=hf.type).call(r,(function(e){return t.type===e}));i?this.fileSource=t:BA("File format is not supported")}else BA("fileSource must be string or file object");else BA("fileSource must be existed");else BA("stream type must be file")},t.prototype.setVideoConfig=function(t){if(this.videoConfig){var e=t.deviceId,r=t.frameRate,i=t.resolution;void 0!==e&&("string"==typeof e?this.videoConfig.deviceId=e:BA("deviceId must be string")),void 0!==r&&"number"==typeof r&&r>0?this.videoConfig.frameRate=r:BA("frameRate must be a number greater than 0"),void 0!==i&&"object"===Xl(i)&&"number"==typeof i.width&&"number"==typeof i.height&&i.width>0&&i.height>0?this.videoConfig.resolution=i:BA("resolution width and height must be a number greater than 0")}},t.prototype.setAudioConfig=function(t){if(this.audioConfig){var e=t.deviceId,r=t.sampleRate,i=t.echoCancellation,n=t.noiseSuppression,s=t.autoGainControl;void 0!==e&&("string"==typeof e?this.audioConfig.deviceId=e:BA("deviceId must be string")),void 0!==r&&"number"==typeof r&&r>0?this.audioConfig.sampleRate=r:BA("sampleRate must be a number greater than 0"),void 0!==i&&(this.audioConfig.echoCancellation=!!i),void 0!==n&&(this.audioConfig.noiseSuppression=!!n),void 0!==s&&(this.audioConfig.autoGainControl=!!s)}},t.prototype.start=function(){return wd(this,void 0,void 0,(function(){var t,e,r,i,n,s,o;return Sd(this,(function(a){switch(a.label){case 0:if(!this.type)throw BA("start failed, init param type is invalid"),(i=new Error("init param type is invalid")).name="InitializedError",i;if(!this.videoConfig&&!this.audioConfig)throw BA("start failed, init param video or audio must be existed"),(i=new Error("init param video or audio must be existed")).name="InitializedError",i;if("file"===this.type&&!this.fileSource)throw BA("start failed, file source is not existed"),(i=new Error("file source is not existed")).name="NotFoundError",i;var h,l;if(t="media","file"===this.type)if(e=this.fileSource,r="string"==typeof e?xd(h=af).call(h,(function(t){var r;return xw(r=e.toLowerCase()).call(r,t)})):xd(l=of).call(l,(function(t){return e.type===t})),"image"===(t=r?"image":"media")&&!this.videoConfig)throw BA("start failed, init param video must be existed"),(i=new Error("init param video must be existed")).name="InitializedError",i;if(!this.instance){switch(n=null,this.type){case"device":n=new Pw;break;case"screen":n=new Mw;break;case"file":n="media"===t?new LA:new FA}this.instance=n}if(this.instance.mediaStream)return BA("stream is existed"),[2,this.instance.mediaStream];s=void 0,"file"!==this.type?s={video:this.videoConfig,audio:this.audioConfig}:"media"===t?s={video:this.videoConfig,audio:!!this.audioConfig,fileSource:this.fileSource}:"image"===t&&(s={video:this.videoConfig,fileSource:this.fileSource}),a.label=1;case 1:return a.trys.push([1,3,,4]),[4,this.instance.start(s)];case 2:return o=a.sent(),this.needStopListener=!1,this.addStopListener(o),[2,o];case 3:throw a.sent();case 4:return[2]}}))}))},t.prototype.stop=function(){var t,e;this.needStopListener=!0,null===(t=this.instance)||void 0===t||t.stop(),null===(e=this.onEvent)||void 0===e||e.call(this,{type:cf,data:{message:"manual stop"}})},t.prototype.getMediaStream=function(){var t;return null===(t=this.instance)||void 0===t?void 0:t.mediaStream},t.prototype.getVideoTrack=function(){var t,e,r,i;return null===(i=null===(r=null===(e=null===(t=this.instance)||void 0===t?void 0:t.mediaStream)||void 0===e?void 0:e.getVideoTracks)||void 0===r?void 0:r.call(e))||void 0===i?void 0:i[0]},t.prototype.getAudioTrack=function(){var t,e,r,i;return null===(i=null===(r=null===(e=null===(t=this.instance)||void 0===t?void 0:t.mediaStream)||void 0===e?void 0:e.getAudioTracks)||void 0===r?void 0:r.call(e))||void 0===i?void 0:i[0]},t.prototype.getResolution=function(){var t;return null===(t=this.instance)||void 0===t?void 0:t.getResolution()},t.prototype.getRenderView=function(){return this.instance&&(this.instance instanceof FA||this.instance instanceof LA)?this.instance.getRenderView():null},t.prototype.getRenderElement=function(){return this.instance&&(this.instance instanceof FA||this.instance instanceof LA)?this.instance.getRenderElement():null},t.prototype.addStopListener=function(t){var e,r=this;"file"!==this.type&&Rc(e=t.getTracks()).call(e,(function(e){e.addEventListener("ended",(function i(){var n,s,o,a;if(!r.needStopListener){BA("".concat(e.kind," track is ended")),e.stop(),null===(s=r.onEvent)||void 0===s||s.call(r,{type:lf,data:{message:"track ended",kind:e.kind}});var h=Aw(n=t.getTracks()).call(n,(function(t){return"ended"===t.readyState}));h&&(BA("stream is ended"),null===(o=r.instance)||void 0===o||o.stop(),null===(a=r.onEvent)||void 0===a||a.call(r,{type:cf,data:{message:"stream ended"}})),e.removeEventListener("ended",i,!1)}}),!1)}))},t}(),GA=Xp("manager:device"),jA=function(){function t(t){this.getCommonData=null;var e=t.getCommonData;this.getCommonData=e}return t.prototype.getDevicesList=function(t){return wd(this,void 0,void 0,(function(){var e,r,i,n;return Sd(this,(function(s){switch(s.label){case 0:return s.trys.push([0,2,,3]),[4,navigator.mediaDevices.enumerateDevices()];case 1:var o;return e=s.sent(),r=[],i=[],Rc(e).call(e,(function(t){var e=t.kind,n=t.deviceId,s=t.label;"videoinput"===e?r.push({type:"video",deviceId:n,deviceName:s}):"audioinput"===e&&"default"!==n&&i.push({type:"audio",deviceId:n,deviceName:s})})),t?"video"===t?[2,r]:"audio"===t?[2,i]:[2,[]]:[2,gc(o=[]).call(o,r,i)];case 2:throw n=s.sent(),GA("enumerateDevices error: ",n),n;case 3:return[2]}}))}))},t.prototype.getCurrentDevice=function(t,e){return wd(this,void 0,void 0,(function(){var r,i,n,s,o,a,h,l,c,u,d,p,f;return Sd(this,(function(m){var g;switch(m.label){case 0:if(r=this.getCommonData(),i=r.streamList,n=r.videoEffectManager,!$u(g=["video","audio"]).call(g,t))throw GA("type is invalid"),new Error("type is invalid");if(n.enabled&&!e)throw GA("streamId is not existed"),new Error("streamId is not existed");if(s="video"===t?"camera":"microphone",!((o=wu(i).call(i,(function(t){return t.type===s&&(!e||t.id===e)})))&&o.source instanceof UA))return[3,5];if(!(a="video"===t?o.source.getVideoTrack():o.source.getAudioTrack()))return[3,5];h=a.getSettings().deviceId,l={type:t,deviceId:h,deviceName:""},m.label=1;case 1:return m.trys.push([1,3,,4]),[4,navigator.mediaDevices.enumerateDevices()];case 2:return c=m.sent(),u="".concat(t,"input"),(d=wu(c).call(c,(function(t){return t.kind===u&&t.deviceId===h})))&&("default"===h?(p=wu(c).call(c,(function(t){return t.kind===u&&"default"!==t.deviceId&&t.groupId===d.groupId})))&&(l.deviceId=p.deviceId,l.deviceName=p.label):l.deviceName=d.label),[3,4];case 3:return f=m.sent(),GA("enumerateDevices error: ",f),[3,4];case 4:return[2,l];case 5:return[2,null]}}))}))},t.prototype.switchDevice=function(t,e,r){var i;return wd(this,void 0,void 0,(function(){var n,s,o,a,h,l,c,u,d,p,f,m,g,v,y,b,_,x,T,w,S,E,C,A,R,P,I=this;return Sd(this,(function(M){var O;switch(M.label){case 0:if(n=this.getCommonData(),s=n.streamList,o=n.videoEffectManager,a=n.observer,h=n.videoQuality,l=n.audioQuality,c=n.streamOutput,u=n.isStreamPushing,d=n.connection,p=n.setProcessData,!$u(O=["video","audio"]).call(O,t))throw GA("type is invalid"),new Error("type is invalid");if(!e)throw GA("deviceId is not existed"),new Error("deviceId is not existed");if(o.enabled&&!r)throw GA("streamId is not existed"),new Error("streamId is not existed");if(f="video"===t?"camera":"microphone",!((m=wu(s).call(s,(function(t){return t.type===f&&(!r||t.id===r)})))&&m.source instanceof UA))return[3,9];g=null,"video"===t?(g=new UA({type:"device",video:!0,audio:!1,onEvent:function(t){var e,r;t.type===cf&&"stream ended"===(null===(e=t.data)||void 0===e?void 0:e.message)&&(null===(r=a.onWarning)||void 0===r||r.call(a,Hp.TXLIVE_WARNING_CAMERA_INTERRUPTED,"interrupted",{streamId:m.id}))}}),v=h.frameRate,y=h.width,b=h.height,g.setVideoConfig({deviceId:e,frameRate:v,resolution:{width:y,height:b}})):(g=new UA({type:"device",video:!1,audio:!0,onEvent:function(t){var e,r;t.type===cf&&"stream ended"===(null===(e=t.data)||void 0===e?void 0:e.message)&&(null===(r=a.onWarning)||void 0===r||r.call(a,Hp.TXLIVE_WARNING_MICROPHONE_INTERRUPTED,"interrupted",{streamId:m.id}))}}),_=l.sampleRate,x=l.echoCancellation,T=l.noiseSuppression,w=l.autoGainControl,g.setAudioConfig({deviceId:e,sampleRate:_,echoCancellation:x,noiseSuppression:T,autoGainControl:w})),S=m.source,m.source=g,E=function(){return wd(I,void 0,void 0,(function(){return Sd(this,(function(e){switch(e.label){case 0:ld((function(){S.getMediaStream()&&S.stop()}),1500),e.label=1;case 1:return e.trys.push([1,3,,5]),[4,g.start()];case 2:return e.sent(),[3,5];case 3:return e.sent(),GA("switch ".concat("video"===t?"camera":"microphone"," failed, try to switch again")),S.getMediaStream()&&S.stop(),[4,g.start()];case 4:return e.sent(),[3,5];case 5:return[2]}}))}))},M.label=1;case 1:return M.trys.push([1,7,,8]),[4,E()];case 2:return M.sent(),o.enabled||"video"!==t?[3,5]:(C=S.getVideoTrack(),A=g.getVideoTrack(),c&&(C?c.removeTrack(C):(R=c.getTracks(),Rc(R).call(R,(function(e){e.kind===t&&"ended"===e.readyState&&c.removeTrack(e)}))),c.addTrack(A)),u&&d?[4,d.replaceStreamTrack(A)]:[3,4]);case 3:M.sent(),M.label=4;case 4:return[3,6];case 5:m.track.setSource(g),p(),M.label=6;case 6:return S.getMediaStream()&&S.stop(),GA("switch ".concat("video"===t?"camera":"microphone"," successfully")),[3,8];case 7:throw P=M.sent(),null===(i=a.onWarning)||void 0===i||i.call(a,"video"===t?Hp.TXLIVE_WARNING_CAMERA_START_FAILED:Hp.TXLIVE_WARNING_MICROPHONE_START_FAILED,P.toString(),null),P;case 8:return[3,10];case 9:GA("stream is not existed"),M.label=10;case 10:return[2]}}))}))},t.prototype.switchCamera=function(t,e){return this.switchDevice("video",t,e)},t.prototype.switchMicrophone=function(t,e){return this.switchDevice("audio",t,e)},t}();Pr({target:"Array",stat:!0},{isArray:Mr});var VA,HA=rt.Array.isArray,WA={width:1280,height:720},XA={video:["video","image"],audio:["audio"],text:["text"]};!function(t){t[t.NONE=0]="NONE",t[t.LEFT_RIGHT=1]="LEFT_RIGHT",t[t.UP_DOWN=2]="UP_DOWN",t[t.ALL=3]="ALL"}(VA||(VA={}));var zA={font:"fontFamily",font_size:"fontSize",font_color:"fill",bold:"fontWeight",italic:"fontStyle",shadow_color:"dropShadowColor",shadow_alpha:"dropShadowAlpha",stroke_color:"stroke",stroke_thickness:"strokeThickness"},YA={threshold:{value:-24,min:-100,max:0},ratio:{value:12,min:1,max:20},knee:{value:30,min:0,max:40},attack:{value:3,min:0,max:1e3},release:{value:250,min:0,max:1e3}},ZA=Xp("process:helper"),$A=function(){function t(t,e){this.data={},this.data.id=Op(),this.data.type=t,this.data.order=0;var r={};r.id=Op(8),r.type=t,e&&(r.source=e,e instanceof HTMLImageElement&&(r.type="image")),this.data.items=[r]}return t.prototype.setSource=function(t){var e=this.data,r=e.type,i=e.items[0];"video"===r||"audio"===r?t?"video"!==r||t instanceof UA||t instanceof MediaStream||t instanceof HTMLVideoElement||t instanceof HTMLImageElement?"audio"!==r||t instanceof UA||t instanceof MediaStream||t instanceof HTMLVideoElement||t instanceof HTMLAudioElement?(i.source=t,t instanceof HTMLImageElement&&(i.type="image"),this.data.items[0]=Td({},i)):ZA("audio source is invalid"):ZA("video source is invalid"):ZA("source must be existed"):ZA("type(".concat(r,") is invalid"))},t.prototype.setOrder=function(t){"number"==typeof t?this.data.order=t:ZA("order must be a number")},t.prototype.setLayout=function(t){var e;if("video"===this.data.type){var r=t.width,i=t.height,n=t.x,s=t.y,o=Aw(e=[r,i,n,s]).call(e,(function(t){return"number"==typeof t}));if(o)if(r<0||i<0)ZA("width or height must be a number greater than or equal to 0");else{var a=this.data.items[0];this.data.items[0]=Td(Td({},a),{width:r,height:i,position:{x:n,y:s}})}else ZA("layout params must be number")}else ZA("type is ".concat(this.data.type,", setLayout is not working"))},t.prototype.setPosition=function(t,e){var r;if("video"===this.data.type||"text"===this.data.type){var i=Aw(r=[t,e]).call(r,(function(t){return"number"==typeof t}));if(i){var n=this.data.items[0];this.data.items[0]=Td(Td({},n),{position:{x:t,y:e}})}else ZA("position params must be number")}else ZA("type is ".concat(this.data.type,", setPosition is not working"))},t.prototype.setSize=function(t,e){var r;if("video"===this.data.type){var i=Aw(r=[t,e]).call(r,(function(t){return"number"==typeof t}));if(i)if(t<0||e<0)ZA("width or height must be a number greater than or equal to 0");else{var n=this.data.items[0];this.data.items[0]=Td(Td({},n),{width:t,height:e})}else ZA("size params must be number")}else ZA("type is ".concat(this.data.type,", setSize is not working"))},t.prototype.setMirror=function(t){if("video"===this.data.type)if("number"!=typeof t||t<VA.NONE||t>VA.ALL)ZA("mirror type must be a number between 0 and 3");else{var e=this.data.items[0],r=e.operations;if(void 0!==r||t!==VA.NONE){var i=Hc(r=r||[]).call(r,(function(t){return"image_mirror"===t.type})),n=function(t){-1!==i?r[i]=t:r.push(t)};switch(t){case VA.NONE:-1!==i&&fu(r).call(r,i,1);break;case VA.LEFT_RIGHT:n({type:"image_mirror",params:{left_right:1}});break;case VA.UP_DOWN:n({type:"image_mirror",params:{up_down:1}});break;case VA.ALL:n({type:"image_mirror",params:{left_right:1,up_down:1}})}this.data.items[0]=Td(Td({},e),{operations:r})}}else ZA("type is ".concat(this.data.type,", setMirror is not working"))},t.prototype.setVolume=function(t){if("video"===this.data.type||"audio"===this.data.type){var e=this.data.items[0];if("image"!==e.type)if("number"==typeof t){var r=e.operations,i=void 0===r?[]:r,n=Hc(i).call(i,(function(t){return"audio_volumes"===t.type})),s={type:"audio_volumes",params:{all:t}};-1!==n?i[n]=s:i.push(s),this.data.items[0]=Td(Td({},e),{operations:i})}else ZA("volume must be a number");else ZA("type is image, setVolume is not working")}else ZA("type is ".concat(this.data.type,", setVolume is not working"))},t.prototype.setCompressor=function(t){var e;if("video"===this.data.type||"audio"===this.data.type){var r=this.data.items[0];if("image"!==r.type){var i=r.operations,n=void 0===i?[]:i,s=Hc(n).call(n,(function(t){return"audio_compressor"===t.type}));if(t){if(Aw(e=Cu(t)).call(e,(function(e){var r=YA[e];if(!r)return ZA("param ".concat(e," is invalid")),!1;var i,n,s=t[e];return!("number"!=typeof s||s<r.min||s>r.max)||(ZA(gc(i=gc(n="param ".concat(e," must be a number between ")).call(n,r.min," and ")).call(i,r.max)),!1)}))){var o={type:"audio_compressor",params:Td({},t)};-1!==s?n[s]=o:n.push(o),this.data.items[0]=Td(Td({},r),{operations:n})}}else-1!==s&&(fu(n).call(n,s,1),this.data.items[0]=Td(Td({},r),{operations:n}))}else ZA("type is image, setCompressor is not working")}else ZA("type is ".concat(this.data.type,", setCompressor is not working"))},t.prototype.setNormalFilter=function(t){var e;if("video"===this.data.type){var r=this.data.items[0],i=r.operations,n=void 0===i?[]:i,s=Hc(n).call(n,(function(t){return"image_filter_normal"===t.type}));if(t){if(Aw(e=Cu(t)).call(e,(function(e){var r=t[e];return!("number"!=typeof r||r<-100||r>100)||(ZA("param ".concat(e," must be a number between -100 and 100")),!1)}))){var o={type:"image_filter_normal",params:Td({},t)};-1!==s?n[s]=o:n.push(o),this.data.items[0]=Td(Td({},r),{operations:n})}}else-1!==s&&(fu(n).call(n,s,1),this.data.items[0]=Td(Td({},r),{operations:n}))}else ZA("type is ".concat(this.data.type,", setNormalFilter is not working"))},t.prototype.setText=function(t,e){if("text"===this.data.type)if(t)if("object"!==Xl(e)||HA(e)||null===e)ZA("style is invalid");else{var r=this.data.items[0];this.data.items[0]=Td(Td({},r),{content:{text:t,text_style:e}})}else ZA("text content is not existed");else ZA("type is ".concat(this.data.type,", setText is not working"))},t}(),KA=function(t,e){var r;if($u(r=Cu(XA)).call(r,t)){if("video"===t||"audio"===t){if(!e)return void ZA("source must be existed");if(!("video"!==t||e instanceof UA||e instanceof MediaStream||e instanceof HTMLVideoElement||e instanceof HTMLImageElement))return void ZA("video source is invalid");if(!("audio"!==t||e instanceof UA||e instanceof MediaStream||e instanceof HTMLVideoElement||e instanceof HTMLAudioElement))return void ZA("audio source is invalid")}return new $A(t,e)}ZA("type(".concat(t,") is invalid"))},JA=Xp("manager:video"),qA=function(){function t(t){this.enabled=!1,this.getCommonData=null,this.config={videoWidth:null,videoHeight:null,videoFramerate:null,backgroundColor:null};var e=t.getCommonData;this.getCommonData=e}return t.prototype.enableMixing=function(t){var e=this.getCommonData(),r=e.streamList,i=e.streamOutput;r.length>0||i?JA("stream is existed, please stop streaming first"):this.enabled=!!t},t.prototype.setMixingConfig=function(t){if(t){var e=t.videoWidth,r=t.videoHeight,i=t.videoFramerate,n=t.backgroundColor;void 0!==e&&("number"==typeof e&&e>0?this.config.videoWidth=e:JA("videoWidth must be a number greater than 0")),void 0!==r&&("number"==typeof r&&r>0?this.config.videoHeight=r:JA("videoHeight must be a number greater than 0")),void 0!==i&&("number"==typeof i&&i>0?this.config.videoFramerate=i:JA("videoFramerate must be a number greater than 0")),void 0!==n&&("number"==typeof n&&n>=0&&n<=16777215?this.config.backgroundColor=n:JA("backgroundColor must be a valid color number"));var s=this.getCommonData().effectProcess;if(s){var o=this.getMixingConfig(),a=o.videoWidth,h=o.videoHeight,l=o.videoFramerate,c=o.backgroundColor;s.setResolution({width:a,height:h}),s.setFrameRate(l),s.setBackgroundColor(c)}}},t.prototype.getMixingConfig=function(){var t=this.getCommonData().videoQuality,e=t.frameRate,r=t.width,i=t.height,n=this.config,s=n.videoWidth,o=n.videoHeight,a=n.videoFramerate,h=n.backgroundColor;return{videoWidth:null!=s?s:r,videoHeight:null!=o?o:i,videoFramerate:null!=a?a:e,backgroundColor:null!=h?h:0}},t.prototype.setLayout=function(t){var e,r;if(t){var i=this.getCommonData(),n=i.streamList,s=i.setProcessData,o=HA(t)?t:[t],a=function(t){var e=t.streamId,r=t.x,i=t.y,s=t.width,o=t.height,a=t.zOrder,h=wu(n).call(n,(function(t){var r,i=t.source,n=i instanceof UA?i.getMediaStream():i;return(null===(r=null==n?void 0:n.getVideoTracks())||void 0===r?void 0:r.length)&&t.id===e}));h?(h.track.setOrder(a),h.track.setSize(s,o),h.track.setPosition(r,i)):JA("stream ".concat(e," is not existed"))};try{for(var h=Ed(o),l=h.next();!l.done;l=h.next()){a(l.value)}}catch(t){e={error:t}}finally{try{l&&!l.done&&(r=h.return)&&r.call(h)}finally{if(e)throw e.error}}s()}},t.prototype.getLayout=function(t){var e,r;if(!t)return JA("streamId is not existed"),null;var i=this.getCommonData().streamList,n=wu(i).call(i,(function(e){return e.id===t}));if(!n)return JA("stream ".concat(t," is not existed")),null;var s=n.track.data,o=s.items[0];return{streamId:t,zOrder:s.order,x:null===(e=o.position)||void 0===e?void 0:e.x,y:null===(r=o.position)||void 0===r?void 0:r.y,width:o.width,height:o.height}},t.prototype.setMirror=function(t){var e,r;if(t){var i=this.getCommonData(),n=i.streamList,s=i.setProcessData,o=HA(t)?t:[t],a=function(t){var e=t.streamId,r=t.mirrorType,i=wu(n).call(n,(function(t){var r,i=t.source,n=i instanceof UA?i.getMediaStream():i;return(null===(r=null==n?void 0:n.getVideoTracks())||void 0===r?void 0:r.length)&&t.id===e}));i?i.track.setMirror(r):JA("stream ".concat(e," is not existed"))};try{for(var h=Ed(o),l=h.next();!l.done;l=h.next()){a(l.value)}}catch(t){e={error:t}}finally{try{l&&!l.done&&(r=h.return)&&r.call(h)}finally{if(e)throw e.error}}s()}},t.prototype.setNormalFilter=function(t){var e,r;if(t){var i=this.getCommonData(),n=i.streamList,s=i.setProcessData,o=HA(t)?t:[t],a=function(t){var e=t.streamId,r=t.contrast,i=void 0===r?0:r,s=t.brightness,o=void 0===s?0:s,a=t.saturation,h=void 0===a?0:a,l=wu(n).call(n,(function(t){var r,i=t.source,n=i instanceof UA?i.getMediaStream():i;return(null===(r=null==n?void 0:n.getVideoTracks())||void 0===r?void 0:r.length)&&t.id===e}));l?l.track.setNormalFilter(0===i&&0===o&&0===h?null:{contrast:i,brightness:o,saturation:h}):JA("stream ".concat(e," is not existed"))};try{for(var h=Ed(o),l=h.next();!l.done;l=h.next()){a(l.value)}}catch(t){e={error:t}}finally{try{l&&!l.done&&(r=h.return)&&r.call(h)}finally{if(e)throw e.error}}s()}},t.prototype.setWatermark=function(t){var e,r,i,n,s=this.getCommonData(),o=s.effectTrackList,a=s.setProcessData,h=Dc(o).call(o,(function(t){return"video"===t.data.type})),l=function(t){var e=Hc(o).call(o,(function(e){return e===t}));fu(o).call(o,e,1)};try{for(var c=Ed(h),u=c.next();!u.done;u=c.next()){l(u.value)}}catch(t){e={error:t}}finally{try{u&&!u.done&&(r=c.return)&&r.call(c)}finally{if(e)throw e.error}}if(t){var d=HA(t)?t:[t];try{for(var p=Ed(d),f=p.next();!f.done;f=p.next()){var m=f.value,g=m.image,v=m.x,y=m.y,b=m.width,_=m.height,x=m.zOrder;if(g&&g instanceof HTMLImageElement){var T=KA("video",g);T.setOrder(x),T.setSize(b,_),T.setPosition(v,y),o.push(T)}else JA("image is invalid")}}catch(t){i={error:t}}finally{try{f&&!f.done&&(n=p.return)&&n.call(p)}finally{if(i)throw i.error}}a()}else a()},t.prototype.setText=function(t){var e,r,i,n,s=this.getCommonData(),o=s.effectTrackList,a=s.setProcessData,h=Dc(o).call(o,(function(t){return"text"===t.data.type})),l=function(t){var e=Hc(o).call(o,(function(e){return e===t}));fu(o).call(o,e,1)};try{for(var c=Ed(h),u=c.next();!u.done;u=c.next()){l(u.value)}}catch(t){e={error:t}}finally{try{u&&!u.done&&(r=c.return)&&r.call(c)}finally{if(e)throw e.error}}if(t){var d=HA(t)?t:[t];try{for(var p=Ed(d),f=p.next();!f.done;f=p.next()){var m=f.value,g=m.text,v=m.style,y=m.x,b=m.y,_=m.zOrder;if(g&&"string"==typeof g){var x=KA("text");x.setText(g,v),x.setOrder(_),x.setPosition(y,b),o.push(x)}else JA("text is invalid")}}catch(t){i={error:t}}finally{try{f&&!f.done&&(n=p.return)&&n.call(p)}finally{if(i)throw i.error}}a()}else a()},t}(),QA=Xp("manager:audio"),tR=function(){function t(t){this.getCommonData=null;var e=t.getCommonData;this.getCommonData=e}return t.prototype.setVolume=function(t,e){var r=this.getCommonData(),i=r.videoEffectManager,n=r.streamList,s=r.setProcessData;if("number"==typeof t)if(!i.enabled||e){var o=wu(n).call(n,(function(t){var r,i=t.source,n=i instanceof UA?i.getMediaStream():i;return(null===(r=null==n?void 0:n.getAudioTracks())||void 0===r?void 0:r.length)&&(!e||t.id===e)}));o?(o.track.setVolume(t),s()):QA("stream is not existed")}else QA("streamId is not existed");else QA("volume must be a number")},t}(),eR=rt.setInterval,rR={exports:{}};!function(t,e){t.exports=function(t){var e={};function r(i){if(e[i])return e[i].exports;var n=e[i]={i:i,l:!1,exports:{}};return t[i].call(n.exports,n,n.exports,r),n.l=!0,n.exports}return r.m=t,r.c=e,r.d=function(t,e,i){r.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:i})},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.t=function(t,e){if(1&e&&(t=r(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var i=Object.create(null);if(r.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var n in t)r.d(i,n,function(e){return t[e]}.bind(null,n));return i},r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,"a",e),e},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.p="",r(r.s=90)}({17:function(t,e,r){e.__esModule=!0,e.default=void 0;var i=r(18),n=function(){function t(){}return t.getFirstMatch=function(t,e){var r=e.match(t);return r&&r.length>0&&r[1]||""},t.getSecondMatch=function(t,e){var r=e.match(t);return r&&r.length>1&&r[2]||""},t.matchAndReturnConst=function(t,e,r){if(t.test(e))return r},t.getWindowsVersionName=function(t){switch(t){case"NT":return"NT";case"XP":case"NT 5.1":return"XP";case"NT 5.0":return"2000";case"NT 5.2":return"2003";case"NT 6.0":return"Vista";case"NT 6.1":return"7";case"NT 6.2":return"8";case"NT 6.3":return"8.1";case"NT 10.0":return"10";default:return}},t.getMacOSVersionName=function(t){var e=t.split(".").splice(0,2).map((function(t){return parseInt(t,10)||0}));if(e.push(0),10===e[0])switch(e[1]){case 5:return"Leopard";case 6:return"Snow Leopard";case 7:return"Lion";case 8:return"Mountain Lion";case 9:return"Mavericks";case 10:return"Yosemite";case 11:return"El Capitan";case 12:return"Sierra";case 13:return"High Sierra";case 14:return"Mojave";case 15:return"Catalina";default:return}},t.getAndroidVersionName=function(t){var e=t.split(".").splice(0,2).map((function(t){return parseInt(t,10)||0}));if(e.push(0),!(1===e[0]&&e[1]<5))return 1===e[0]&&e[1]<6?"Cupcake":1===e[0]&&e[1]>=6?"Donut":2===e[0]&&e[1]<2?"Eclair":2===e[0]&&2===e[1]?"Froyo":2===e[0]&&e[1]>2?"Gingerbread":3===e[0]?"Honeycomb":4===e[0]&&e[1]<1?"Ice Cream Sandwich":4===e[0]&&e[1]<4?"Jelly Bean":4===e[0]&&e[1]>=4?"KitKat":5===e[0]?"Lollipop":6===e[0]?"Marshmallow":7===e[0]?"Nougat":8===e[0]?"Oreo":9===e[0]?"Pie":void 0},t.getVersionPrecision=function(t){return t.split(".").length},t.compareVersions=function(e,r,i){void 0===i&&(i=!1);var n=t.getVersionPrecision(e),s=t.getVersionPrecision(r),o=Math.max(n,s),a=0,h=t.map([e,r],(function(e){var r=o-t.getVersionPrecision(e),i=e+new Array(r+1).join(".0");return t.map(i.split("."),(function(t){return new Array(20-t.length).join("0")+t})).reverse()}));for(i&&(a=o-Math.min(n,s)),o-=1;o>=a;){if(h[0][o]>h[1][o])return 1;if(h[0][o]===h[1][o]){if(o===a)return 0;o-=1}else if(h[0][o]<h[1][o])return-1}},t.map=function(t,e){var r,i=[];if(Array.prototype.map)return Array.prototype.map.call(t,e);for(r=0;r<t.length;r+=1)i.push(e(t[r]));return i},t.find=function(t,e){var r,i;if(Array.prototype.find)return Array.prototype.find.call(t,e);for(r=0,i=t.length;r<i;r+=1){var n=t[r];if(e(n,r))return n}},t.assign=function(t){for(var e,r,i=t,n=arguments.length,s=new Array(n>1?n-1:0),o=1;o<n;o++)s[o-1]=arguments[o];if(Object.assign)return Object.assign.apply(Object,[t].concat(s));var a=function(){var t=s[e];"object"==typeof t&&null!==t&&Object.keys(t).forEach((function(e){i[e]=t[e]}))};for(e=0,r=s.length;e<r;e+=1)a();return t},t.getBrowserAlias=function(t){return i.BROWSER_ALIASES_MAP[t]},t.getBrowserTypeByAlias=function(t){return i.BROWSER_MAP[t]||""},t}();e.default=n,t.exports=e.default},18:function(t,e,r){e.__esModule=!0,e.ENGINE_MAP=e.OS_MAP=e.PLATFORMS_MAP=e.BROWSER_MAP=e.BROWSER_ALIASES_MAP=void 0,e.BROWSER_ALIASES_MAP={"Amazon Silk":"amazon_silk","Android Browser":"android",Bada:"bada",BlackBerry:"blackberry",Chrome:"chrome",Chromium:"chromium",Electron:"electron",Epiphany:"epiphany",Firefox:"firefox",Focus:"focus",Generic:"generic","Google Search":"google_search",Googlebot:"googlebot","Internet Explorer":"ie","K-Meleon":"k_meleon",Maxthon:"maxthon","Microsoft Edge":"edge","MZ Browser":"mz","NAVER Whale Browser":"naver",Opera:"opera","Opera Coast":"opera_coast",PhantomJS:"phantomjs",Puffin:"puffin",QupZilla:"qupzilla",QQ:"qq",QQLite:"qqlite",Safari:"safari",Sailfish:"sailfish","Samsung Internet for Android":"samsung_internet",SeaMonkey:"seamonkey",Sleipnir:"sleipnir",Swing:"swing",Tizen:"tizen","UC Browser":"uc",Vivaldi:"vivaldi","WebOS Browser":"webos",WeChat:"wechat","Yandex Browser":"yandex",Roku:"roku"},e.BROWSER_MAP={amazon_silk:"Amazon Silk",android:"Android Browser",bada:"Bada",blackberry:"BlackBerry",chrome:"Chrome",chromium:"Chromium",electron:"Electron",epiphany:"Epiphany",firefox:"Firefox",focus:"Focus",generic:"Generic",googlebot:"Googlebot",google_search:"Google Search",ie:"Internet Explorer",k_meleon:"K-Meleon",maxthon:"Maxthon",edge:"Microsoft Edge",mz:"MZ Browser",naver:"NAVER Whale Browser",opera:"Opera",opera_coast:"Opera Coast",phantomjs:"PhantomJS",puffin:"Puffin",qupzilla:"QupZilla",qq:"QQ Browser",qqlite:"QQ Browser Lite",safari:"Safari",sailfish:"Sailfish",samsung_internet:"Samsung Internet for Android",seamonkey:"SeaMonkey",sleipnir:"Sleipnir",swing:"Swing",tizen:"Tizen",uc:"UC Browser",vivaldi:"Vivaldi",webos:"WebOS Browser",wechat:"WeChat",yandex:"Yandex Browser"},e.PLATFORMS_MAP={tablet:"tablet",mobile:"mobile",desktop:"desktop",tv:"tv"},e.OS_MAP={WindowsPhone:"Windows Phone",Windows:"Windows",MacOS:"macOS",iOS:"iOS",Android:"Android",WebOS:"WebOS",BlackBerry:"BlackBerry",Bada:"Bada",Tizen:"Tizen",Linux:"Linux",ChromeOS:"Chrome OS",PlayStation4:"PlayStation 4",Roku:"Roku"},e.ENGINE_MAP={EdgeHTML:"EdgeHTML",Blink:"Blink",Trident:"Trident",Presto:"Presto",Gecko:"Gecko",WebKit:"WebKit"}},90:function(t,e,r){e.__esModule=!0,e.default=void 0;var i,n=(i=r(91))&&i.__esModule?i:{default:i},s=r(18);function o(t,e){for(var r=0;r<e.length;r++){var i=e[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}var a=function(){function t(){}var e,r,i;return t.getParser=function(t,e){if(void 0===e&&(e=!1),"string"!=typeof t)throw new Error("UserAgent should be a string");return new n.default(t,e)},t.parse=function(t){return new n.default(t).getResult()},e=t,i=[{key:"BROWSER_MAP",get:function(){return s.BROWSER_MAP}},{key:"ENGINE_MAP",get:function(){return s.ENGINE_MAP}},{key:"OS_MAP",get:function(){return s.OS_MAP}},{key:"PLATFORMS_MAP",get:function(){return s.PLATFORMS_MAP}}],(r=null)&&o(e.prototype,r),i&&o(e,i),t}();e.default=a,t.exports=e.default},91:function(t,e,r){e.__esModule=!0,e.default=void 0;var i=h(r(92)),n=h(r(93)),s=h(r(94)),o=h(r(95)),a=h(r(17));function h(t){return t&&t.__esModule?t:{default:t}}var l=function(){function t(t,e){if(void 0===e&&(e=!1),null==t||""===t)throw new Error("UserAgent parameter can't be empty");this._ua=t,this.parsedResult={},!0!==e&&this.parse()}var e=t.prototype;return e.getUA=function(){return this._ua},e.test=function(t){return t.test(this._ua)},e.parseBrowser=function(){var t=this;this.parsedResult.browser={};var e=a.default.find(i.default,(function(e){if("function"==typeof e.test)return e.test(t);if(e.test instanceof Array)return e.test.some((function(e){return t.test(e)}));throw new Error("Browser's test function is not valid")}));return e&&(this.parsedResult.browser=e.describe(this.getUA())),this.parsedResult.browser},e.getBrowser=function(){return this.parsedResult.browser?this.parsedResult.browser:this.parseBrowser()},e.getBrowserName=function(t){return t?String(this.getBrowser().name).toLowerCase()||"":this.getBrowser().name||""},e.getBrowserVersion=function(){return this.getBrowser().version},e.getOS=function(){return this.parsedResult.os?this.parsedResult.os:this.parseOS()},e.parseOS=function(){var t=this;this.parsedResult.os={};var e=a.default.find(n.default,(function(e){if("function"==typeof e.test)return e.test(t);if(e.test instanceof Array)return e.test.some((function(e){return t.test(e)}));throw new Error("Browser's test function is not valid")}));return e&&(this.parsedResult.os=e.describe(this.getUA())),this.parsedResult.os},e.getOSName=function(t){var e=this.getOS().name;return t?String(e).toLowerCase()||"":e||""},e.getOSVersion=function(){return this.getOS().version},e.getPlatform=function(){return this.parsedResult.platform?this.parsedResult.platform:this.parsePlatform()},e.getPlatformType=function(t){void 0===t&&(t=!1);var e=this.getPlatform().type;return t?String(e).toLowerCase()||"":e||""},e.parsePlatform=function(){var t=this;this.parsedResult.platform={};var e=a.default.find(s.default,(function(e){if("function"==typeof e.test)return e.test(t);if(e.test instanceof Array)return e.test.some((function(e){return t.test(e)}));throw new Error("Browser's test function is not valid")}));return e&&(this.parsedResult.platform=e.describe(this.getUA())),this.parsedResult.platform},e.getEngine=function(){return this.parsedResult.engine?this.parsedResult.engine:this.parseEngine()},e.getEngineName=function(t){return t?String(this.getEngine().name).toLowerCase()||"":this.getEngine().name||""},e.parseEngine=function(){var t=this;this.parsedResult.engine={};var e=a.default.find(o.default,(function(e){if("function"==typeof e.test)return e.test(t);if(e.test instanceof Array)return e.test.some((function(e){return t.test(e)}));throw new Error("Browser's test function is not valid")}));return e&&(this.parsedResult.engine=e.describe(this.getUA())),this.parsedResult.engine},e.parse=function(){return this.parseBrowser(),this.parseOS(),this.parsePlatform(),this.parseEngine(),this},e.getResult=function(){return a.default.assign({},this.parsedResult)},e.satisfies=function(t){var e=this,r={},i=0,n={},s=0;if(Object.keys(t).forEach((function(e){var o=t[e];"string"==typeof o?(n[e]=o,s+=1):"object"==typeof o&&(r[e]=o,i+=1)})),i>0){var o=Object.keys(r),h=a.default.find(o,(function(t){return e.isOS(t)}));if(h){var l=this.satisfies(r[h]);if(void 0!==l)return l}var c=a.default.find(o,(function(t){return e.isPlatform(t)}));if(c){var u=this.satisfies(r[c]);if(void 0!==u)return u}}if(s>0){var d=Object.keys(n),p=a.default.find(d,(function(t){return e.isBrowser(t,!0)}));if(void 0!==p)return this.compareVersion(n[p])}},e.isBrowser=function(t,e){void 0===e&&(e=!1);var r=this.getBrowserName().toLowerCase(),i=t.toLowerCase(),n=a.default.getBrowserTypeByAlias(i);return e&&n&&(i=n.toLowerCase()),i===r},e.compareVersion=function(t){var e=[0],r=t,i=!1,n=this.getBrowserVersion();if("string"==typeof n)return">"===t[0]||"<"===t[0]?(r=t.substr(1),"="===t[1]?(i=!0,r=t.substr(2)):e=[],">"===t[0]?e.push(1):e.push(-1)):"="===t[0]?r=t.substr(1):"~"===t[0]&&(i=!0,r=t.substr(1)),e.indexOf(a.default.compareVersions(n,r,i))>-1},e.isOS=function(t){return this.getOSName(!0)===String(t).toLowerCase()},e.isPlatform=function(t){return this.getPlatformType(!0)===String(t).toLowerCase()},e.isEngine=function(t){return this.getEngineName(!0)===String(t).toLowerCase()},e.is=function(t,e){return void 0===e&&(e=!1),this.isBrowser(t,e)||this.isOS(t)||this.isPlatform(t)},e.some=function(t){var e=this;return void 0===t&&(t=[]),t.some((function(t){return e.is(t)}))},t}();e.default=l,t.exports=e.default},92:function(t,e,r){e.__esModule=!0,e.default=void 0;var i,n=(i=r(17))&&i.__esModule?i:{default:i},s=/version\/(\d+(\.?_?\d+)+)/i,o=[{test:[/googlebot/i],describe:function(t){var e={name:"Googlebot"},r=n.default.getFirstMatch(/googlebot\/(\d+(\.\d+))/i,t)||n.default.getFirstMatch(s,t);return r&&(e.version=r),e}},{test:[/opera/i],describe:function(t){var e={name:"Opera"},r=n.default.getFirstMatch(s,t)||n.default.getFirstMatch(/(?:opera)[\s/](\d+(\.?_?\d+)+)/i,t);return r&&(e.version=r),e}},{test:[/opr\/|opios/i],describe:function(t){var e={name:"Opera"},r=n.default.getFirstMatch(/(?:opr|opios)[\s/](\S+)/i,t)||n.default.getFirstMatch(s,t);return r&&(e.version=r),e}},{test:[/SamsungBrowser/i],describe:function(t){var e={name:"Samsung Internet for Android"},r=n.default.getFirstMatch(s,t)||n.default.getFirstMatch(/(?:SamsungBrowser)[\s/](\d+(\.?_?\d+)+)/i,t);return r&&(e.version=r),e}},{test:[/Whale/i],describe:function(t){var e={name:"NAVER Whale Browser"},r=n.default.getFirstMatch(s,t)||n.default.getFirstMatch(/(?:whale)[\s/](\d+(?:\.\d+)+)/i,t);return r&&(e.version=r),e}},{test:[/MZBrowser/i],describe:function(t){var e={name:"MZ Browser"},r=n.default.getFirstMatch(/(?:MZBrowser)[\s/](\d+(?:\.\d+)+)/i,t)||n.default.getFirstMatch(s,t);return r&&(e.version=r),e}},{test:[/focus/i],describe:function(t){var e={name:"Focus"},r=n.default.getFirstMatch(/(?:focus)[\s/](\d+(?:\.\d+)+)/i,t)||n.default.getFirstMatch(s,t);return r&&(e.version=r),e}},{test:[/swing/i],describe:function(t){var e={name:"Swing"},r=n.default.getFirstMatch(/(?:swing)[\s/](\d+(?:\.\d+)+)/i,t)||n.default.getFirstMatch(s,t);return r&&(e.version=r),e}},{test:[/coast/i],describe:function(t){var e={name:"Opera Coast"},r=n.default.getFirstMatch(s,t)||n.default.getFirstMatch(/(?:coast)[\s/](\d+(\.?_?\d+)+)/i,t);return r&&(e.version=r),e}},{test:[/opt\/\d+(?:.?_?\d+)+/i],describe:function(t){var e={name:"Opera Touch"},r=n.default.getFirstMatch(/(?:opt)[\s/](\d+(\.?_?\d+)+)/i,t)||n.default.getFirstMatch(s,t);return r&&(e.version=r),e}},{test:[/yabrowser/i],describe:function(t){var e={name:"Yandex Browser"},r=n.default.getFirstMatch(/(?:yabrowser)[\s/](\d+(\.?_?\d+)+)/i,t)||n.default.getFirstMatch(s,t);return r&&(e.version=r),e}},{test:[/ucbrowser/i],describe:function(t){var e={name:"UC Browser"},r=n.default.getFirstMatch(s,t)||n.default.getFirstMatch(/(?:ucbrowser)[\s/](\d+(\.?_?\d+)+)/i,t);return r&&(e.version=r),e}},{test:[/Maxthon|mxios/i],describe:function(t){var e={name:"Maxthon"},r=n.default.getFirstMatch(s,t)||n.default.getFirstMatch(/(?:Maxthon|mxios)[\s/](\d+(\.?_?\d+)+)/i,t);return r&&(e.version=r),e}},{test:[/epiphany/i],describe:function(t){var e={name:"Epiphany"},r=n.default.getFirstMatch(s,t)||n.default.getFirstMatch(/(?:epiphany)[\s/](\d+(\.?_?\d+)+)/i,t);return r&&(e.version=r),e}},{test:[/puffin/i],describe:function(t){var e={name:"Puffin"},r=n.default.getFirstMatch(s,t)||n.default.getFirstMatch(/(?:puffin)[\s/](\d+(\.?_?\d+)+)/i,t);return r&&(e.version=r),e}},{test:[/sleipnir/i],describe:function(t){var e={name:"Sleipnir"},r=n.default.getFirstMatch(s,t)||n.default.getFirstMatch(/(?:sleipnir)[\s/](\d+(\.?_?\d+)+)/i,t);return r&&(e.version=r),e}},{test:[/k-meleon/i],describe:function(t){var e={name:"K-Meleon"},r=n.default.getFirstMatch(s,t)||n.default.getFirstMatch(/(?:k-meleon)[\s/](\d+(\.?_?\d+)+)/i,t);return r&&(e.version=r),e}},{test:[/micromessenger/i],describe:function(t){var e={name:"WeChat"},r=n.default.getFirstMatch(/(?:micromessenger)[\s/](\d+(\.?_?\d+)+)/i,t)||n.default.getFirstMatch(s,t);return r&&(e.version=r),e}},{test:[/qqbrowser/i],describe:function(t){var e={name:/qqbrowserlite/i.test(t)?"QQ Browser Lite":"QQ Browser"},r=n.default.getFirstMatch(/(?:qqbrowserlite|qqbrowser)[/](\d+(\.?_?\d+)+)/i,t)||n.default.getFirstMatch(s,t);return r&&(e.version=r),e}},{test:[/msie|trident/i],describe:function(t){var e={name:"Internet Explorer"},r=n.default.getFirstMatch(/(?:msie |rv:)(\d+(\.?_?\d+)+)/i,t);return r&&(e.version=r),e}},{test:[/\sedg\//i],describe:function(t){var e={name:"Microsoft Edge"},r=n.default.getFirstMatch(/\sedg\/(\d+(\.?_?\d+)+)/i,t);return r&&(e.version=r),e}},{test:[/edg([ea]|ios)/i],describe:function(t){var e={name:"Microsoft Edge"},r=n.default.getSecondMatch(/edg([ea]|ios)\/(\d+(\.?_?\d+)+)/i,t);return r&&(e.version=r),e}},{test:[/vivaldi/i],describe:function(t){var e={name:"Vivaldi"},r=n.default.getFirstMatch(/vivaldi\/(\d+(\.?_?\d+)+)/i,t);return r&&(e.version=r),e}},{test:[/seamonkey/i],describe:function(t){var e={name:"SeaMonkey"},r=n.default.getFirstMatch(/seamonkey\/(\d+(\.?_?\d+)+)/i,t);return r&&(e.version=r),e}},{test:[/sailfish/i],describe:function(t){var e={name:"Sailfish"},r=n.default.getFirstMatch(/sailfish\s?browser\/(\d+(\.\d+)?)/i,t);return r&&(e.version=r),e}},{test:[/silk/i],describe:function(t){var e={name:"Amazon Silk"},r=n.default.getFirstMatch(/silk\/(\d+(\.?_?\d+)+)/i,t);return r&&(e.version=r),e}},{test:[/phantom/i],describe:function(t){var e={name:"PhantomJS"},r=n.default.getFirstMatch(/phantomjs\/(\d+(\.?_?\d+)+)/i,t);return r&&(e.version=r),e}},{test:[/slimerjs/i],describe:function(t){var e={name:"SlimerJS"},r=n.default.getFirstMatch(/slimerjs\/(\d+(\.?_?\d+)+)/i,t);return r&&(e.version=r),e}},{test:[/blackberry|\bbb\d+/i,/rim\stablet/i],describe:function(t){var e={name:"BlackBerry"},r=n.default.getFirstMatch(s,t)||n.default.getFirstMatch(/blackberry[\d]+\/(\d+(\.?_?\d+)+)/i,t);return r&&(e.version=r),e}},{test:[/(web|hpw)[o0]s/i],describe:function(t){var e={name:"WebOS Browser"},r=n.default.getFirstMatch(s,t)||n.default.getFirstMatch(/w(?:eb)?[o0]sbrowser\/(\d+(\.?_?\d+)+)/i,t);return r&&(e.version=r),e}},{test:[/bada/i],describe:function(t){var e={name:"Bada"},r=n.default.getFirstMatch(/dolfin\/(\d+(\.?_?\d+)+)/i,t);return r&&(e.version=r),e}},{test:[/tizen/i],describe:function(t){var e={name:"Tizen"},r=n.default.getFirstMatch(/(?:tizen\s?)?browser\/(\d+(\.?_?\d+)+)/i,t)||n.default.getFirstMatch(s,t);return r&&(e.version=r),e}},{test:[/qupzilla/i],describe:function(t){var e={name:"QupZilla"},r=n.default.getFirstMatch(/(?:qupzilla)[\s/](\d+(\.?_?\d+)+)/i,t)||n.default.getFirstMatch(s,t);return r&&(e.version=r),e}},{test:[/firefox|iceweasel|fxios/i],describe:function(t){var e={name:"Firefox"},r=n.default.getFirstMatch(/(?:firefox|iceweasel|fxios)[\s/](\d+(\.?_?\d+)+)/i,t);return r&&(e.version=r),e}},{test:[/electron/i],describe:function(t){var e={name:"Electron"},r=n.default.getFirstMatch(/(?:electron)\/(\d+(\.?_?\d+)+)/i,t);return r&&(e.version=r),e}},{test:[/MiuiBrowser/i],describe:function(t){var e={name:"Miui"},r=n.default.getFirstMatch(/(?:MiuiBrowser)[\s/](\d+(\.?_?\d+)+)/i,t);return r&&(e.version=r),e}},{test:[/chromium/i],describe:function(t){var e={name:"Chromium"},r=n.default.getFirstMatch(/(?:chromium)[\s/](\d+(\.?_?\d+)+)/i,t)||n.default.getFirstMatch(s,t);return r&&(e.version=r),e}},{test:[/chrome|crios|crmo/i],describe:function(t){var e={name:"Chrome"},r=n.default.getFirstMatch(/(?:chrome|crios|crmo)\/(\d+(\.?_?\d+)+)/i,t);return r&&(e.version=r),e}},{test:[/GSA/i],describe:function(t){var e={name:"Google Search"},r=n.default.getFirstMatch(/(?:GSA)\/(\d+(\.?_?\d+)+)/i,t);return r&&(e.version=r),e}},{test:function(t){var e=!t.test(/like android/i),r=t.test(/android/i);return e&&r},describe:function(t){var e={name:"Android Browser"},r=n.default.getFirstMatch(s,t);return r&&(e.version=r),e}},{test:[/playstation 4/i],describe:function(t){var e={name:"PlayStation 4"},r=n.default.getFirstMatch(s,t);return r&&(e.version=r),e}},{test:[/safari|applewebkit/i],describe:function(t){var e={name:"Safari"},r=n.default.getFirstMatch(s,t);return r&&(e.version=r),e}},{test:[/.*/i],describe:function(t){var e=-1!==t.search("\\(")?/^(.*)\/(.*)[ \t]\((.*)/:/^(.*)\/(.*) /;return{name:n.default.getFirstMatch(e,t),version:n.default.getSecondMatch(e,t)}}}];e.default=o,t.exports=e.default},93:function(t,e,r){e.__esModule=!0,e.default=void 0;var i,n=(i=r(17))&&i.__esModule?i:{default:i},s=r(18),o=[{test:[/Roku\/DVP/],describe:function(t){var e=n.default.getFirstMatch(/Roku\/DVP-(\d+\.\d+)/i,t);return{name:s.OS_MAP.Roku,version:e}}},{test:[/windows phone/i],describe:function(t){var e=n.default.getFirstMatch(/windows phone (?:os)?\s?(\d+(\.\d+)*)/i,t);return{name:s.OS_MAP.WindowsPhone,version:e}}},{test:[/windows /i],describe:function(t){var e=n.default.getFirstMatch(/Windows ((NT|XP)( \d\d?.\d)?)/i,t),r=n.default.getWindowsVersionName(e);return{name:s.OS_MAP.Windows,version:e,versionName:r}}},{test:[/Macintosh(.*?) FxiOS(.*?)\//],describe:function(t){var e={name:s.OS_MAP.iOS},r=n.default.getSecondMatch(/(Version\/)(\d[\d.]+)/,t);return r&&(e.version=r),e}},{test:[/macintosh/i],describe:function(t){var e=n.default.getFirstMatch(/mac os x (\d+(\.?_?\d+)+)/i,t).replace(/[_\s]/g,"."),r=n.default.getMacOSVersionName(e),i={name:s.OS_MAP.MacOS,version:e};return r&&(i.versionName=r),i}},{test:[/(ipod|iphone|ipad)/i],describe:function(t){var e=n.default.getFirstMatch(/os (\d+([_\s]\d+)*) like mac os x/i,t).replace(/[_\s]/g,".");return{name:s.OS_MAP.iOS,version:e}}},{test:function(t){var e=!t.test(/like android/i),r=t.test(/android/i);return e&&r},describe:function(t){var e=n.default.getFirstMatch(/android[\s/-](\d+(\.\d+)*)/i,t),r=n.default.getAndroidVersionName(e),i={name:s.OS_MAP.Android,version:e};return r&&(i.versionName=r),i}},{test:[/(web|hpw)[o0]s/i],describe:function(t){var e=n.default.getFirstMatch(/(?:web|hpw)[o0]s\/(\d+(\.\d+)*)/i,t),r={name:s.OS_MAP.WebOS};return e&&e.length&&(r.version=e),r}},{test:[/blackberry|\bbb\d+/i,/rim\stablet/i],describe:function(t){var e=n.default.getFirstMatch(/rim\stablet\sos\s(\d+(\.\d+)*)/i,t)||n.default.getFirstMatch(/blackberry\d+\/(\d+([_\s]\d+)*)/i,t)||n.default.getFirstMatch(/\bbb(\d+)/i,t);return{name:s.OS_MAP.BlackBerry,version:e}}},{test:[/bada/i],describe:function(t){var e=n.default.getFirstMatch(/bada\/(\d+(\.\d+)*)/i,t);return{name:s.OS_MAP.Bada,version:e}}},{test:[/tizen/i],describe:function(t){var e=n.default.getFirstMatch(/tizen[/\s](\d+(\.\d+)*)/i,t);return{name:s.OS_MAP.Tizen,version:e}}},{test:[/linux/i],describe:function(){return{name:s.OS_MAP.Linux}}},{test:[/CrOS/],describe:function(){return{name:s.OS_MAP.ChromeOS}}},{test:[/PlayStation 4/],describe:function(t){var e=n.default.getFirstMatch(/PlayStation 4[/\s](\d+(\.\d+)*)/i,t);return{name:s.OS_MAP.PlayStation4,version:e}}}];e.default=o,t.exports=e.default},94:function(t,e,r){e.__esModule=!0,e.default=void 0;var i,n=(i=r(17))&&i.__esModule?i:{default:i},s=r(18),o=[{test:[/googlebot/i],describe:function(){return{type:"bot",vendor:"Google"}}},{test:[/huawei/i],describe:function(t){var e=n.default.getFirstMatch(/(can-l01)/i,t)&&"Nova",r={type:s.PLATFORMS_MAP.mobile,vendor:"Huawei"};return e&&(r.model=e),r}},{test:[/nexus\s*(?:7|8|9|10).*/i],describe:function(){return{type:s.PLATFORMS_MAP.tablet,vendor:"Nexus"}}},{test:[/ipad/i],describe:function(){return{type:s.PLATFORMS_MAP.tablet,vendor:"Apple",model:"iPad"}}},{test:[/Macintosh(.*?) FxiOS(.*?)\//],describe:function(){return{type:s.PLATFORMS_MAP.tablet,vendor:"Apple",model:"iPad"}}},{test:[/kftt build/i],describe:function(){return{type:s.PLATFORMS_MAP.tablet,vendor:"Amazon",model:"Kindle Fire HD 7"}}},{test:[/silk/i],describe:function(){return{type:s.PLATFORMS_MAP.tablet,vendor:"Amazon"}}},{test:[/tablet(?! pc)/i],describe:function(){return{type:s.PLATFORMS_MAP.tablet}}},{test:function(t){var e=t.test(/ipod|iphone/i),r=t.test(/like (ipod|iphone)/i);return e&&!r},describe:function(t){var e=n.default.getFirstMatch(/(ipod|iphone)/i,t);return{type:s.PLATFORMS_MAP.mobile,vendor:"Apple",model:e}}},{test:[/nexus\s*[0-6].*/i,/galaxy nexus/i],describe:function(){return{type:s.PLATFORMS_MAP.mobile,vendor:"Nexus"}}},{test:[/[^-]mobi/i],describe:function(){return{type:s.PLATFORMS_MAP.mobile}}},{test:function(t){return"blackberry"===t.getBrowserName(!0)},describe:function(){return{type:s.PLATFORMS_MAP.mobile,vendor:"BlackBerry"}}},{test:function(t){return"bada"===t.getBrowserName(!0)},describe:function(){return{type:s.PLATFORMS_MAP.mobile}}},{test:function(t){return"windows phone"===t.getBrowserName()},describe:function(){return{type:s.PLATFORMS_MAP.mobile,vendor:"Microsoft"}}},{test:function(t){var e=Number(String(t.getOSVersion()).split(".")[0]);return"android"===t.getOSName(!0)&&e>=3},describe:function(){return{type:s.PLATFORMS_MAP.tablet}}},{test:function(t){return"android"===t.getOSName(!0)},describe:function(){return{type:s.PLATFORMS_MAP.mobile}}},{test:function(t){return"macos"===t.getOSName(!0)},describe:function(){return{type:s.PLATFORMS_MAP.desktop,vendor:"Apple"}}},{test:function(t){return"windows"===t.getOSName(!0)},describe:function(){return{type:s.PLATFORMS_MAP.desktop}}},{test:function(t){return"linux"===t.getOSName(!0)},describe:function(){return{type:s.PLATFORMS_MAP.desktop}}},{test:function(t){return"playstation 4"===t.getOSName(!0)},describe:function(){return{type:s.PLATFORMS_MAP.tv}}},{test:function(t){return"roku"===t.getOSName(!0)},describe:function(){return{type:s.PLATFORMS_MAP.tv}}}];e.default=o,t.exports=e.default},95:function(t,e,r){e.__esModule=!0,e.default=void 0;var i,n=(i=r(17))&&i.__esModule?i:{default:i},s=r(18),o=[{test:function(t){return"microsoft edge"===t.getBrowserName(!0)},describe:function(t){if(/\sedg\//i.test(t))return{name:s.ENGINE_MAP.Blink};var e=n.default.getFirstMatch(/edge\/(\d+(\.?_?\d+)+)/i,t);return{name:s.ENGINE_MAP.EdgeHTML,version:e}}},{test:[/trident/i],describe:function(t){var e={name:s.ENGINE_MAP.Trident},r=n.default.getFirstMatch(/trident\/(\d+(\.?_?\d+)+)/i,t);return r&&(e.version=r),e}},{test:function(t){return t.test(/presto/i)},describe:function(t){var e={name:s.ENGINE_MAP.Presto},r=n.default.getFirstMatch(/presto\/(\d+(\.?_?\d+)+)/i,t);return r&&(e.version=r),e}},{test:function(t){var e=t.test(/gecko/i),r=t.test(/like gecko/i);return e&&!r},describe:function(t){var e={name:s.ENGINE_MAP.Gecko},r=n.default.getFirstMatch(/gecko\/(\d+(\.?_?\d+)+)/i,t);return r&&(e.version=r),e}},{test:[/(apple)?webkit\/537\.36/i],describe:function(){return{name:s.ENGINE_MAP.Blink}}},{test:[/(apple)?webkit/i],describe:function(t){var e={name:s.ENGINE_MAP.WebKit},r=n.default.getFirstMatch(/webkit\/(\d+(\.?_?\d+)+)/i,t);return r&&(e.version=r),e}}];e.default=o,t.exports=e.default}})}(rR);var iR=r(rR.exports),nR=function(){function t(){this.baseUrl="",this.setSignalingServer("webrtcpush.myqcloud.com")}return t.prototype.setSignalingServer=function(t){this.baseUrl="https://".concat(t)},t.prototype.fetchPushStream=function(t){return wd(this,void 0,void 0,(function(){var e,r,i,n,s;return Sd(this,(function(o){switch(o.label){case 0:e="".concat(this.baseUrl,"/webrtc/v1/pushstream"),o.label=1;case 1:return o.trys.push([1,3,,4]),[4,ow(e,t)];case 2:var a;if(r=o.sent(),i=r.errcode,n=r.errmsg,s=r.remotesdp,0!==i)throw new Error(gc(a="push stream failed, errCode:".concat(i,", errMsg:")).call(a,n));return[2,{remoteSdp:s,sessionId:t.sessionid}];case 3:throw o.sent();case 4:return[2]}}))}))},t.prototype.fetchStopStream=function(t){return wd(this,void 0,void 0,(function(){var e,r,i,n;return Sd(this,(function(s){switch(s.label){case 0:e="".concat(this.baseUrl,"/webrtc/v1/stopstream"),s.label=1;case 1:return s.trys.push([1,3,,4]),[4,ow(e,t)];case 2:var o;if(r=s.sent(),i=r.errcode,n=r.errmsg,0!==i)throw new Error(gc(o="stop stream failed, errCode:".concat(i,", errmsg:")).call(o,n));return[2,r];case 3:throw s.sent();case 4:return[2]}}))}))},t}(),sR=function(t,e,r){var i,n,s,o="AS";"firefox"===Mp.browserDetails.browser&&(e*=1e3,o="TIAS");var a=new RegExp(gc(i="m=".concat(t," (.*)\r\nc=IN (.*)\r\nb=")).call(i,o,":(.*)\r\n")),h=new RegExp("m=".concat(t," (.*)\r\nc=IN (.*)\r\n")),l=gc(n=gc(s="m=".concat(t," $1\r\nc=IN $2\r\nb=")).call(s,o,":")).call(n,e,"\r\n");return r=a.test(r)?r.replace(a,l):r.replace(h,l)},oR=function(t){var e=t.split("\r\n"),r=[];return Rc(e).call(e,(function(t){var e=t;$u(t).call(t,"a=fmtp:111")&&(e="".concat(t,";stereo=1"));var i,n=/a=rtpmap:(\d+) (opus|vp8|vp9|h264|h265|av1)/i.exec(t);n&&(e=gc(i="".concat(t,"\r\na=rtcp-fb:")).call(i,n[1]," rrtr"));r.push(e)})),r.join("\r\n")},aR=Xp("connection"),hR=function(){function t(t){var e,r,i;void 0===t&&(t={}),this.status=Jp,this.url=null,this.stream=null,this.bitrate={video:null,audio:null},this.signaling=null,this.signalingConfig={},this.listener={onEvent:null,onStatusUpdate:null,onStatisticsUpdate:null},this.promise=null,this.peerConnection=null,this.negotiating=!1,this.intervalId=null,this.lastStatsReport=null,this.sessionId=null;var n=t.url,s=t.streamSource,o=t.videoBitrate,a=t.audioBitrate,h=t.signalingConfig,l=t.onEvent,c=t.onStatusUpdate,u=t.onStatisticsUpdate;n&&this.setUrl(n),s&&this.setStreamSource(s),o&&this.setVideoBitrate(o),a&&this.setAudioBitrate(a),h&&this.setSignalingConfig(h),this.signaling=new nR,l&&"function"==typeof l&&(this.listener.onEvent=l),c&&"function"==typeof c&&(this.listener.onStatusUpdate=c),u&&"function"==typeof u&&(this.listener.onStatisticsUpdate=u),this.onIceConnectionStateChange=uc(e=this.onIceConnectionStateChange).call(e,this),this.onConnectionStateChange=uc(r=this.onConnectionStateChange).call(r,this),this.onNegotiationNeeded=uc(i=this.onNegotiationNeeded).call(i,this)}return t.prototype.setUrl=function(t){if(t){var e=function(t){var e=/^(?:webrtc:\/\/)(?:[0-9.\-A-Za-z_]+)(?:\/)(?:[0-9.\-A-Za-z_]+)(?:\/)([^?#]*)(?:\?*)(?:[^?#]*)/.exec(t);return e?e[1]:null}(t);null!==e?this.url=t:aR("url is invalid")}else aR("url is not existed")},t.prototype.setStreamSource=function(t){t?t instanceof MediaStream||t instanceof UA?this.stream=t instanceof MediaStream?t:t.getMediaStream():aR("streamSource is invalid"):aR("streamSource is not existed")},t.prototype.setVideoBitrate=function(t){"number"==typeof t&&t>0?this.setBitrate("video",t):aR("videoBitrate must be a number greater than 0")},t.prototype.setAudioBitrate=function(t){"number"==typeof t&&t>0?this.setBitrate("audio",t):aR("audioBitrate must be a number greater than 0")},t.prototype.setSignalingConfig=function(t){if(t){var e=t.domainName,r=t.extraParams;e&&"string"==typeof e&&(this.signalingConfig.domainName=e,this.signaling.setSignalingServer(e)),r&&"object"===Xl(r)&&(this.signalingConfig.extraParams=r)}else aR("signalingConfig is not existed")},t.prototype.start=function(){var t=this,e=this,r=e.status,i=e.url,n=e.stream;return new zT((function(e,s){t.promise={resolve:e,reject:s};var o=function(t){var e=new Error(t);return e.name="CheckError",e};return i?n?r!==Jp?(aR("stream is pushing"),void s(o("stream is pushing"))):void t.startConnect():(aR("stream is invalid"),void s(o("stream is invalid"))):(aR("url is invalid"),void s(o("url is invalid")))}))},t.prototype.stop=function(){this.url&&this.sessionId&&(this.signaling.fetchStopStream({streamurl:this.url,sessionid:this.sessionId}).catch((function(t){aR("request stop error, ".concat(t.toString()))})),this.sessionId=null),this.stopConnect()},t.prototype.replaceStreamTrack=function(t){return wd(this,void 0,void 0,(function(){var e,r;return Sd(this,(function(i){var n;switch(i.label){case 0:if(this.status!==Qp)throw aR("no stream is pushing"),new Error("no stream is pushing");if(!(t instanceof MediaStreamTrack))throw aR("newTrack must be MediaStreamTrack"),new Error("newTrack must be MediaStreamTrack");i.label=1;case 1:return i.trys.push([1,4,,5]),(e=wu(n=this.peerConnection.getSenders()).call(n,(function(e){return e.track&&e.track.kind===t.kind})))?[4,e.replaceTrack(t)]:[3,3];case 2:i.sent(),i.label=3;case 3:return[3,5];case 4:throw r=i.sent(),aR("sender replaceTrack failed"),r;case 5:return[2]}}))}))},t.prototype.getLocalDescription=function(){var t;return null===(t=this.peerConnection)||void 0===t?void 0:t.localDescription},t.prototype.getRemoteDescription=function(){var t;return null===(t=this.peerConnection)||void 0===t?void 0:t.remoteDescription},t.prototype.startConnect=function(){var t,e,r,i=this;try{this.peerConnection=new RTCPeerConnection({iceServers:[],bundlePolicy:"max-bundle",rtcpMuxPolicy:"require"})}catch(t){return aR("create connection error, ".concat(t.toString())),void this.promise.reject(t)}this.status=qp,null===(r=(e=this.listener).onStatusUpdate)||void 0===r||r.call(e,{type:qp,data:{message:"connecting"}}),this.negotiating=!1,this.peerConnection.addEventListener("iceconnectionstatechange",this.onIceConnectionStateChange),this.peerConnection.addEventListener("connectionstatechange",this.onConnectionStateChange),this.peerConnection.addEventListener("negotiationneeded",this.onNegotiationNeeded),Rc(t=this.stream.getTracks()).call(t,(function(t){i.peerConnection.addTrack(t,i.stream)}))},t.prototype.stopConnect=function(t){var e,r;void 0===t&&(t="manual stop"),this.status!==Jp&&(this.destroyConnect(),null===(r=(e=this.listener).onStatusUpdate)||void 0===r||r.call(e,{type:Jp,data:{message:t}}))},t.prototype.destroyConnect=function(){this.status=Jp,this.negotiating=!1,this.lastStatsReport=null,this.promise=null,this.intervalId&&(window.clearInterval(this.intervalId),this.intervalId=null),this.peerConnection&&(this.peerConnection.removeEventListener("iceconnectionstatechange",this.onIceConnectionStateChange),this.peerConnection.removeEventListener("connectionstatechange",this.onConnectionStateChange),this.peerConnection.removeEventListener("negotiationneeded",this.onNegotiationNeeded),this.peerConnection.close(),this.peerConnection=null)},t.prototype.onIceConnectionStateChange=function(){switch(aR("onIceConnectionStateChange: ".concat(this.peerConnection.iceConnectionState)),this.peerConnection.iceConnectionState){case"failed":case"disconnected":aR("iceConnection disconnected, please try again"),this.promise.reject(new Error("connection disconnected")),this.stopConnect("connection disconnected")}},t.prototype.onConnectionStateChange=function(){var t,e;switch(aR("onConnectionStateChange: ".concat(this.peerConnection.connectionState)),this.peerConnection.connectionState){case"failed":case"disconnected":aR("connection disconnected, please try again"),this.promise.reject(new Error("connection disconnected")),this.stopConnect("connection disconnected");break;case"connected":aR("connection connected"),this.status=Qp,null===(e=(t=this.listener).onStatusUpdate)||void 0===e||e.call(t,{type:Qp,data:{message:"connected"}});var r=this.bitrate,i=r.video,n=r.audio;i&&this.setBitrate("video",i),n&&this.setBitrate("audio",n),this.startStatReport(),this.promise.resolve()}},t.prototype.onNegotiationNeeded=function(){aR("onNegotiationNeeded"),this.createOffer()},t.prototype.createOffer=function(){return wd(this,void 0,void 0,(function(){var t,e;return Sd(this,(function(r){switch(r.label){case 0:if(this.negotiating||"stable"!==this.peerConnection.signalingState)return[2];this.negotiating=!0,r.label=1;case 1:return r.trys.push([1,4,5,6]),[4,this.peerConnection.createOffer()];case 2:return(t=r.sent()).sdp=oR(t.sdp),[4,this.peerConnection.setLocalDescription(t)];case 3:return r.sent(),this.sendOffer(t),[3,6];case 4:return e=r.sent(),aR("setLocalDescription error, ".concat(e.toString())),this.promise.reject(e),this.destroyConnect(),[3,6];case 5:return this.negotiating=!1,[7];case 6:return[2]}}))}))},t.prototype.sendOffer=function(t){var e,r,i,n,s;return wd(this,void 0,void 0,(function(){var o,a,h,l,c,u,d,p,f;return Sd(this,(function(m){var g,v,y;switch(m.label){case 0:null===(r=(e=this.listener).onEvent)||void 0===r||r.call(e,{type:tf,data:{message:"request push start"}}),m.label=1;case 1:return m.trys.push([1,3,,4]),o=iR.parse(window.navigator.userAgent),a=o.browser,h=o.os,l=gc(g=gc(v=gc(y="".concat(h.name||"other"," ")).call(y,h.version,";")).call(v,a.name||"other"," ")).call(g,a.version),c=null!==(i=this.signalingConfig.extraParams)&&void 0!==i?i:{},[4,this.signaling.fetchPushStream(Td({streamurl:this.url,sessionid:Op(),clientinfo:l,localsdp:t},c))];case 2:return u=m.sent(),d=u.remoteSdp,p=u.sessionId,null===(s=(n=this.listener).onEvent)||void 0===s||s.call(n,{type:ef,data:{message:"request push success"}}),this.sessionId=p,this.handleAnswer(d),[3,4];case 3:return f=m.sent(),aR("request push error, ".concat(f.toString())),f.name="RequestError",this.promise.reject(f),this.stopConnect("connection disconnected"),[3,4];case 4:return[2]}}))}))},t.prototype.handleAnswer=function(t){return wd(this,void 0,void 0,(function(){var e;return Sd(this,(function(r){switch(r.label){case 0:return r.trys.push([0,2,,3]),[4,this.peerConnection.setRemoteDescription(new RTCSessionDescription(t))];case 1:return r.sent(),[3,3];case 2:return e=r.sent(),aR("setRemoteDescription error, ".concat(e.toString())),this.promise.reject(e),this.destroyConnect(),[3,3];case 3:return[2]}}))}))},t.prototype.setBitrate=function(t,e){return wd(this,void 0,void 0,(function(){var r,i,n,s,o,a,h,l,c,u;return Sd(this,(function(d){var p,f;switch(d.label){case 0:if(this.bitrate[t]=e,this.status!==Qp)return[2];if(r=Mp.browserDetails,i=r.browser,n=r.version,!(("chrome"===i||"safari"===i||"firefox"===i&&n>=64)&&"RTCRtpSender"in window&&"setParameters"in window.RTCRtpSender.prototype))return[3,5];if(!(s=wu(p=this.peerConnection.getSenders()).call(p,(function(e){return e.track&&e.track.kind===t}))))return[3,4];(o=s.getParameters()).encodings&&0!==o.encodings.length||(o.encodings=[{}]),o.encodings[0].maxBitrate=1e3*e,d.label=1;case 1:return d.trys.push([1,3,,4]),[4,s.setParameters(o)];case 2:return d.sent(),aR(gc(f="".concat(t," bandwidth is set to ")).call(f,e," kbps")),[3,4];case 3:return d.sent(),aR("failed to set bandwidth by setting maxBitrate"),[3,4];case 4:return[2];case 5:return d.trys.push([5,9,,10]),[4,this.peerConnection.createOffer()];case 6:return(a=d.sent()).sdp=oR(a.sdp),[4,this.peerConnection.setLocalDescription(a)];case 7:return d.sent(),h=this.peerConnection.remoteDescription,l=h.type,c=h.sdp,u={type:l,sdp:sR(t,e,c)},aR("applying bandwidth restriction to setRemoteDescription"),[4,this.peerConnection.setRemoteDescription(u)];case 8:return d.sent(),[3,10];case 9:return d.sent(),aR("failed to setRemoteDescription with bandwidth restriction"),[3,10];case 10:return[2]}}))}))},t.prototype.startStatReport=function(){var t=this;this.intervalId&&(window.clearInterval(this.intervalId),this.intervalId=null),this.intervalId=eR((function(){return wd(t,void 0,void 0,(function(){var t,e,r,i;return Sd(this,(function(n){switch(n.label){case 0:return this.peerConnection?[4,this.peerConnection.getStats(null)]:[2];case 1:return t=n.sent(),e=function(t,e){var r,i,n,s;if(void 0===e&&(e=null),e){var o=null,a=null,h=null;Rc(t).call(t,(function(t){"track"===t.type&&("video"===t.kind||t.frameWidth)&&(o=t.id),"outbound-rtp"===t.type&&("video"===t.kind||"video"===t.mediaType?a=t.id:"audio"!==t.kind&&"audio"!==t.mediaType||(h=t.id))}));var l=t.get(o),c=t.get(a),u=e.get(o),d=e.get(a),p=void 0;void 0!==(null==c?void 0:c.timestamp)&&void 0!==(null==d?void 0:d.timestamp)&&(p=(c.timestamp-d.timestamp)/1e3);var f=void 0;void 0!==(null==c?void 0:c.framesPerSecond)?f=c.framesPerSecond:void 0!==(null==c?void 0:c.framerateMean)?f=c.framerateMean:void 0!==(null==c?void 0:c.framesSent)&&void 0!==(null==d?void 0:d.framesSent)&&p?f=(c.framesSent-d.framesSent)/p:void 0!==(null==l?void 0:l.framesSent)&&void 0!==(null==u?void 0:u.framesSent)&&p&&(f=(l.framesSent-u.framesSent)/p);var m=void 0;void 0!==(null==c?void 0:c.bytesSent)&&void 0!==(null==d?void 0:d.bytesSent)&&p&&(m=8*(c.bytesSent-d.bytesSent)/p);var g=void 0;void 0!==(null==c?void 0:c.totalEncodeTime)&&void 0!==(null==c?void 0:c.framesEncoded)&&void 0!==(null==d?void 0:d.totalEncodeTime)&&void 0!==(null==d?void 0:d.framesEncoded)&&(g=c.framesEncoded-d.framesEncoded?(c.totalEncodeTime-d.totalEncodeTime)/(c.framesEncoded-d.framesEncoded)*1e3:c.totalEncodeTime/c.framesEncoded*1e3);var v=void 0;void 0!==(null==c?void 0:c.totalPacketSendDelay)&&void 0!==(null==c?void 0:c.packetsSent)&&void 0!==(null==d?void 0:d.totalPacketSendDelay)&&void 0!==(null==d?void 0:d.packetsSent)&&(v=c.packetsSent-d.packetsSent?(c.totalPacketSendDelay-d.totalPacketSendDelay)/(c.packetsSent-d.packetsSent)*1e3:c.totalPacketSendDelay/c.packetsSent*1e3);var y=t.get(h),b=e.get(h);void 0!==(null==y?void 0:y.timestamp)&&void 0!==(null==b?void 0:b.timestamp)&&(p=(y.timestamp-b.timestamp)/1e3);var _=void 0;return void 0!==(null==y?void 0:y.bytesSent)&&void 0!==(null==b?void 0:b.bytesSent)&&p&&(_=8*(y.bytesSent-b.bytesSent)/p),{timestamp:null!==(r=null==c?void 0:c.timestamp)&&void 0!==r?r:null==y?void 0:y.timestamp,video:{bitrate:m&&Number(m.toFixed(2)),framesPerSecond:f&&Gv(f.toString(),10),frameWidth:null!==(i=null==c?void 0:c.frameWidth)&&void 0!==i?i:null==l?void 0:l.frameWidth,frameHeight:null!==(n=null==c?void 0:c.frameHeight)&&void 0!==n?n:null==l?void 0:l.frameHeight,framesEncoded:null==c?void 0:c.framesEncoded,framesSent:null!==(s=null==c?void 0:c.framesSent)&&void 0!==s?s:null==l?void 0:l.framesSent,packetsSent:null==c?void 0:c.packetsSent,nackCount:null==c?void 0:c.nackCount,firCount:null==c?void 0:c.firCount,pliCount:null==c?void 0:c.pliCount,frameEncodeAvgTime:g&&Number(g.toFixed(2)),packetSendDelay:v&&Number(v.toFixed(2))},audio:{bitrate:_&&Number(_.toFixed(2)),packetsSent:null==y?void 0:y.packetsSent}}}}(t,this.lastStatsReport),this.lastStatsReport=t,e&&(null===(i=(r=this.listener).onStatisticsUpdate)||void 0===i||i.call(r,e)),[2]}}))}))}),1e3)},t}(),lR=(t=>(t[t.WEBGL_LEGACY=0]="WEBGL_LEGACY",t[t.WEBGL=1]="WEBGL",t[t.WEBGL2=2]="WEBGL2",t))(lR||{}),cR=(t=>(t[t.UNKNOWN=0]="UNKNOWN",t[t.WEBGL=1]="WEBGL",t[t.CANVAS=2]="CANVAS",t))(cR||{}),uR=(t=>(t[t.COLOR=16384]="COLOR",t[t.DEPTH=256]="DEPTH",t[t.STENCIL=1024]="STENCIL",t))(uR||{}),dR=(t=>(t[t.NORMAL=0]="NORMAL",t[t.ADD=1]="ADD",t[t.MULTIPLY=2]="MULTIPLY",t[t.SCREEN=3]="SCREEN",t[t.OVERLAY=4]="OVERLAY",t[t.DARKEN=5]="DARKEN",t[t.LIGHTEN=6]="LIGHTEN",t[t.COLOR_DODGE=7]="COLOR_DODGE",t[t.COLOR_BURN=8]="COLOR_BURN",t[t.HARD_LIGHT=9]="HARD_LIGHT",t[t.SOFT_LIGHT=10]="SOFT_LIGHT",t[t.DIFFERENCE=11]="DIFFERENCE",t[t.EXCLUSION=12]="EXCLUSION",t[t.HUE=13]="HUE",t[t.SATURATION=14]="SATURATION",t[t.COLOR=15]="COLOR",t[t.LUMINOSITY=16]="LUMINOSITY",t[t.NORMAL_NPM=17]="NORMAL_NPM",t[t.ADD_NPM=18]="ADD_NPM",t[t.SCREEN_NPM=19]="SCREEN_NPM",t[t.NONE=20]="NONE",t[t.SRC_OVER=0]="SRC_OVER",t[t.SRC_IN=21]="SRC_IN",t[t.SRC_OUT=22]="SRC_OUT",t[t.SRC_ATOP=23]="SRC_ATOP",t[t.DST_OVER=24]="DST_OVER",t[t.DST_IN=25]="DST_IN",t[t.DST_OUT=26]="DST_OUT",t[t.DST_ATOP=27]="DST_ATOP",t[t.ERASE=26]="ERASE",t[t.SUBTRACT=28]="SUBTRACT",t[t.XOR=29]="XOR",t))(dR||{}),pR=(t=>(t[t.POINTS=0]="POINTS",t[t.LINES=1]="LINES",t[t.LINE_LOOP=2]="LINE_LOOP",t[t.LINE_STRIP=3]="LINE_STRIP",t[t.TRIANGLES=4]="TRIANGLES",t[t.TRIANGLE_STRIP=5]="TRIANGLE_STRIP",t[t.TRIANGLE_FAN=6]="TRIANGLE_FAN",t))(pR||{}),fR=(t=>(t[t.RGBA=6408]="RGBA",t[t.RGB=6407]="RGB",t[t.RG=33319]="RG",t[t.RED=6403]="RED",t[t.RGBA_INTEGER=36249]="RGBA_INTEGER",t[t.RGB_INTEGER=36248]="RGB_INTEGER",t[t.RG_INTEGER=33320]="RG_INTEGER",t[t.RED_INTEGER=36244]="RED_INTEGER",t[t.ALPHA=6406]="ALPHA",t[t.LUMINANCE=6409]="LUMINANCE",t[t.LUMINANCE_ALPHA=6410]="LUMINANCE_ALPHA",t[t.DEPTH_COMPONENT=6402]="DEPTH_COMPONENT",t[t.DEPTH_STENCIL=34041]="DEPTH_STENCIL",t))(fR||{}),mR=(t=>(t[t.TEXTURE_2D=3553]="TEXTURE_2D",t[t.TEXTURE_CUBE_MAP=34067]="TEXTURE_CUBE_MAP",t[t.TEXTURE_2D_ARRAY=35866]="TEXTURE_2D_ARRAY",t[t.TEXTURE_CUBE_MAP_POSITIVE_X=34069]="TEXTURE_CUBE_MAP_POSITIVE_X",t[t.TEXTURE_CUBE_MAP_NEGATIVE_X=34070]="TEXTURE_CUBE_MAP_NEGATIVE_X",t[t.TEXTURE_CUBE_MAP_POSITIVE_Y=34071]="TEXTURE_CUBE_MAP_POSITIVE_Y",t[t.TEXTURE_CUBE_MAP_NEGATIVE_Y=34072]="TEXTURE_CUBE_MAP_NEGATIVE_Y",t[t.TEXTURE_CUBE_MAP_POSITIVE_Z=34073]="TEXTURE_CUBE_MAP_POSITIVE_Z",t[t.TEXTURE_CUBE_MAP_NEGATIVE_Z=34074]="TEXTURE_CUBE_MAP_NEGATIVE_Z",t))(mR||{}),gR=(t=>(t[t.UNSIGNED_BYTE=5121]="UNSIGNED_BYTE",t[t.UNSIGNED_SHORT=5123]="UNSIGNED_SHORT",t[t.UNSIGNED_SHORT_5_6_5=33635]="UNSIGNED_SHORT_5_6_5",t[t.UNSIGNED_SHORT_4_4_4_4=32819]="UNSIGNED_SHORT_4_4_4_4",t[t.UNSIGNED_SHORT_5_5_5_1=32820]="UNSIGNED_SHORT_5_5_5_1",t[t.UNSIGNED_INT=5125]="UNSIGNED_INT",t[t.UNSIGNED_INT_10F_11F_11F_REV=35899]="UNSIGNED_INT_10F_11F_11F_REV",t[t.UNSIGNED_INT_2_10_10_10_REV=33640]="UNSIGNED_INT_2_10_10_10_REV",t[t.UNSIGNED_INT_24_8=34042]="UNSIGNED_INT_24_8",t[t.UNSIGNED_INT_5_9_9_9_REV=35902]="UNSIGNED_INT_5_9_9_9_REV",t[t.BYTE=5120]="BYTE",t[t.SHORT=5122]="SHORT",t[t.INT=5124]="INT",t[t.FLOAT=5126]="FLOAT",t[t.FLOAT_32_UNSIGNED_INT_24_8_REV=36269]="FLOAT_32_UNSIGNED_INT_24_8_REV",t[t.HALF_FLOAT=36193]="HALF_FLOAT",t))(gR||{}),vR=(t=>(t[t.FLOAT=0]="FLOAT",t[t.INT=1]="INT",t[t.UINT=2]="UINT",t))(vR||{}),yR=(t=>(t[t.NEAREST=0]="NEAREST",t[t.LINEAR=1]="LINEAR",t))(yR||{}),bR=(t=>(t[t.CLAMP=33071]="CLAMP",t[t.REPEAT=10497]="REPEAT",t[t.MIRRORED_REPEAT=33648]="MIRRORED_REPEAT",t))(bR||{}),_R=(t=>(t[t.OFF=0]="OFF",t[t.POW2=1]="POW2",t[t.ON=2]="ON",t[t.ON_MANUAL=3]="ON_MANUAL",t))(_R||{}),xR=(t=>(t[t.NPM=0]="NPM",t[t.UNPACK=1]="UNPACK",t[t.PMA=2]="PMA",t[t.NO_PREMULTIPLIED_ALPHA=0]="NO_PREMULTIPLIED_ALPHA",t[t.PREMULTIPLY_ON_UPLOAD=1]="PREMULTIPLY_ON_UPLOAD",t[t.PREMULTIPLIED_ALPHA=2]="PREMULTIPLIED_ALPHA",t))(xR||{}),TR=(t=>(t[t.NO=0]="NO",t[t.YES=1]="YES",t[t.AUTO=2]="AUTO",t[t.BLEND=0]="BLEND",t[t.CLEAR=1]="CLEAR",t[t.BLIT=2]="BLIT",t))(TR||{}),wR=(t=>(t[t.AUTO=0]="AUTO",t[t.MANUAL=1]="MANUAL",t))(wR||{}),SR=(t=>(t.LOW="lowp",t.MEDIUM="mediump",t.HIGH="highp",t))(SR||{}),ER=(t=>(t[t.NONE=0]="NONE",t[t.SCISSOR=1]="SCISSOR",t[t.STENCIL=2]="STENCIL",t[t.SPRITE=3]="SPRITE",t[t.COLOR=4]="COLOR",t))(ER||{}),CR=(t=>(t[t.NONE=0]="NONE",t[t.LOW=2]="LOW",t[t.MEDIUM=4]="MEDIUM",t[t.HIGH=8]="HIGH",t))(CR||{}),AR=(t=>(t[t.ELEMENT_ARRAY_BUFFER=34963]="ELEMENT_ARRAY_BUFFER",t[t.ARRAY_BUFFER=34962]="ARRAY_BUFFER",t[t.UNIFORM_BUFFER=35345]="UNIFORM_BUFFER",t))(AR||{});const RR={createCanvas:(t,e)=>{const r=document.createElement("canvas");return r.width=t,r.height=e,r},getCanvasRenderingContext2D:()=>CanvasRenderingContext2D,getWebGLRenderingContext:()=>WebGLRenderingContext,getNavigator:()=>navigator,getBaseUrl:()=>document.baseURI??window.location.href,getFontFaceSet:()=>document.fonts,fetch:(t,e)=>fetch(t,e),parseXML:t=>(new DOMParser).parseFromString(t,"text/xml")},PR={ADAPTER:RR,RESOLUTION:1,CREATE_IMAGE_BITMAP:!1,ROUND_PIXELS:!1};var IR=/iPhone/i,MR=/iPod/i,OR=/iPad/i,kR=/\biOS-universal(?:.+)Mac\b/i,DR=/\bAndroid(?:.+)Mobile\b/i,LR=/Android/i,NR=/(?:SD4930UR|\bSilk(?:.+)Mobile\b)/i,FR=/Silk/i,BR=/Windows Phone/i,UR=/\bWindows(?:.+)ARM\b/i,GR=/BlackBerry/i,jR=/BB10/i,VR=/Opera Mini/i,HR=/\b(CriOS|Chrome)(?:.+)Mobile/i,WR=/Mobile(?:.+)Firefox\b/i,XR=function(t){return void 0!==t&&"MacIntel"===t.platform&&"number"==typeof t.maxTouchPoints&&t.maxTouchPoints>1&&"undefined"==typeof MSStream};function zR(t){var e={userAgent:"",platform:"",maxTouchPoints:0};t||"undefined"==typeof navigator?"string"==typeof t?e.userAgent=t:t&&t.userAgent&&(e={userAgent:t.userAgent,platform:t.platform,maxTouchPoints:t.maxTouchPoints||0}):e={userAgent:navigator.userAgent,platform:navigator.platform,maxTouchPoints:navigator.maxTouchPoints||0};var r=e.userAgent,i=r.split("[FBAN");void 0!==i[1]&&(r=i[0]),void 0!==(i=r.split("Twitter"))[1]&&(r=i[0]);var n=function(t){return function(e){return e.test(t)}}(r),s={apple:{phone:n(IR)&&!n(BR),ipod:n(MR),tablet:!n(IR)&&(n(OR)||XR(e))&&!n(BR),universal:n(kR),device:(n(IR)||n(MR)||n(OR)||n(kR)||XR(e))&&!n(BR)},amazon:{phone:n(NR),tablet:!n(NR)&&n(FR),device:n(NR)||n(FR)},android:{phone:!n(BR)&&n(NR)||!n(BR)&&n(DR),tablet:!n(BR)&&!n(NR)&&!n(DR)&&(n(FR)||n(LR)),device:!n(BR)&&(n(NR)||n(FR)||n(DR)||n(LR))||n(/\bokhttp\b/i)},windows:{phone:n(BR),tablet:n(UR),device:n(BR)||n(UR)},other:{blackberry:n(GR),blackberry10:n(jR),opera:n(VR),firefox:n(WR),chrome:n(HR),device:n(GR)||n(jR)||n(VR)||n(WR)||n(HR)},any:!1,phone:!1,tablet:!1};return s.any=s.apple.device||s.android.device||s.windows.device||s.other.device,s.phone=s.apple.phone||s.android.phone||s.windows.phone,s.tablet=s.apple.tablet||s.android.tablet||s.windows.tablet,s}const YR=(zR.default??zR)(globalThis.navigator);PR.RETINA_PREFIX=/@([0-9\.]+)x/,PR.FAIL_IF_MAJOR_PERFORMANCE_CAVEAT=!1;var ZR={exports:{}};!function(t){var e=Object.prototype.hasOwnProperty,r="~";function i(){}function n(t,e,r){this.fn=t,this.context=e,this.once=r||!1}function s(t,e,i,s,o){if("function"!=typeof i)throw new TypeError("The listener must be a function");var a=new n(i,s||t,o),h=r?r+e:e;return t._events[h]?t._events[h].fn?t._events[h]=[t._events[h],a]:t._events[h].push(a):(t._events[h]=a,t._eventsCount++),t}function o(t,e){0==--t._eventsCount?t._events=new i:delete t._events[e]}function a(){this._events=new i,this._eventsCount=0}Object.create&&(i.prototype=Object.create(null),(new i).__proto__||(r=!1)),a.prototype.eventNames=function(){var t,i,n=[];if(0===this._eventsCount)return n;for(i in t=this._events)e.call(t,i)&&n.push(r?i.slice(1):i);return Object.getOwnPropertySymbols?n.concat(Object.getOwnPropertySymbols(t)):n},a.prototype.listeners=function(t){var e=r?r+t:t,i=this._events[e];if(!i)return[];if(i.fn)return[i.fn];for(var n=0,s=i.length,o=new Array(s);n<s;n++)o[n]=i[n].fn;return o},a.prototype.listenerCount=function(t){var e=r?r+t:t,i=this._events[e];return i?i.fn?1:i.length:0},a.prototype.emit=function(t,e,i,n,s,o){var a=r?r+t:t;if(!this._events[a])return!1;var h,l,c=this._events[a],u=arguments.length;if(c.fn){switch(c.once&&this.removeListener(t,c.fn,void 0,!0),u){case 1:return c.fn.call(c.context),!0;case 2:return c.fn.call(c.context,e),!0;case 3:return c.fn.call(c.context,e,i),!0;case 4:return c.fn.call(c.context,e,i,n),!0;case 5:return c.fn.call(c.context,e,i,n,s),!0;case 6:return c.fn.call(c.context,e,i,n,s,o),!0}for(l=1,h=new Array(u-1);l<u;l++)h[l-1]=arguments[l];c.fn.apply(c.context,h)}else{var d,p=c.length;for(l=0;l<p;l++)switch(c[l].once&&this.removeListener(t,c[l].fn,void 0,!0),u){case 1:c[l].fn.call(c[l].context);break;case 2:c[l].fn.call(c[l].context,e);break;case 3:c[l].fn.call(c[l].context,e,i);break;case 4:c[l].fn.call(c[l].context,e,i,n);break;default:if(!h)for(d=1,h=new Array(u-1);d<u;d++)h[d-1]=arguments[d];c[l].fn.apply(c[l].context,h)}}return!0},a.prototype.on=function(t,e,r){return s(this,t,e,r,!1)},a.prototype.once=function(t,e,r){return s(this,t,e,r,!0)},a.prototype.removeListener=function(t,e,i,n){var s=r?r+t:t;if(!this._events[s])return this;if(!e)return o(this,s),this;var a=this._events[s];if(a.fn)a.fn!==e||n&&!a.once||i&&a.context!==i||o(this,s);else{for(var h=0,l=[],c=a.length;h<c;h++)(a[h].fn!==e||n&&!a[h].once||i&&a[h].context!==i)&&l.push(a[h]);l.length?this._events[s]=1===l.length?l[0]:l:o(this,s)}return this},a.prototype.removeAllListeners=function(t){var e;return t?(e=r?r+t:t,this._events[e]&&o(this,e)):(this._events=new i,this._eventsCount=0),this},a.prototype.off=a.prototype.removeListener,a.prototype.addListener=a.prototype.on,a.prefixed=r,a.EventEmitter=a,t.exports=a}(ZR);var $R=ZR.exports,KR={exports:{}};function JR(t,e,r){r=r||2;var i,n,s,o,a,h,l,c=e&&e.length,u=c?e[0]*r:t.length,d=qR(t,0,u,r,!0),p=[];if(!d||d.next===d.prev)return p;if(c&&(d=function(t,e,r,i){var n,s,o,a=[];for(n=0,s=e.length;n<s;n++)(o=qR(t,e[n]*i,n<s-1?e[n+1]*i:t.length,i,!1))===o.next&&(o.steiner=!0),a.push(lP(o));for(a.sort(sP),n=0;n<a.length;n++)r=oP(a[n],r);return r}(t,e,d,r)),t.length>80*r){i=s=t[0],n=o=t[1];for(var f=r;f<u;f+=r)(a=t[f])<i&&(i=a),(h=t[f+1])<n&&(n=h),a>s&&(s=a),h>o&&(o=h);l=0!==(l=Math.max(s-i,o-n))?32767/l:0}return tP(d,p,r,i,n,l,0),p}function qR(t,e,r,i,n){var s,o;if(n===TP(t,e,r,i)>0)for(s=e;s<r;s+=i)o=bP(s,t[s],t[s+1],o);else for(s=r-i;s>=e;s-=i)o=bP(s,t[s],t[s+1],o);return o&&pP(o,o.next)&&(_P(o),o=o.next),o}function QR(t,e){if(!t)return t;e||(e=t);var r,i=t;do{if(r=!1,i.steiner||!pP(i,i.next)&&0!==dP(i.prev,i,i.next))i=i.next;else{if(_P(i),(i=e=i.prev)===i.next)break;r=!0}}while(r||i!==e);return e}function tP(t,e,r,i,n,s,o){if(t){!o&&s&&function(t,e,r,i){var n=t;do{0===n.z&&(n.z=hP(n.x,n.y,e,r,i)),n.prevZ=n.prev,n.nextZ=n.next,n=n.next}while(n!==t);n.prevZ.nextZ=null,n.prevZ=null,function(t){var e,r,i,n,s,o,a,h,l=1;do{for(r=t,t=null,s=null,o=0;r;){for(o++,i=r,a=0,e=0;e<l&&(a++,i=i.nextZ);e++);for(h=l;a>0||h>0&&i;)0!==a&&(0===h||!i||r.z<=i.z)?(n=r,r=r.nextZ,a--):(n=i,i=i.nextZ,h--),s?s.nextZ=n:t=n,n.prevZ=s,s=n;r=i}s.nextZ=null,l*=2}while(o>1)}(n)}(t,i,n,s);for(var a,h,l=t;t.prev!==t.next;)if(a=t.prev,h=t.next,s?rP(t,i,n,s):eP(t))e.push(a.i/r|0),e.push(t.i/r|0),e.push(h.i/r|0),_P(t),t=h.next,l=h.next;else if((t=h)===l){o?1===o?tP(t=iP(QR(t),e,r),e,r,i,n,s,2):2===o&&nP(t,e,r,i,n,s):tP(QR(t),e,r,i,n,s,1);break}}}function eP(t){var e=t.prev,r=t,i=t.next;if(dP(e,r,i)>=0)return!1;for(var n=e.x,s=r.x,o=i.x,a=e.y,h=r.y,l=i.y,c=n<s?n<o?n:o:s<o?s:o,u=a<h?a<l?a:l:h<l?h:l,d=n>s?n>o?n:o:s>o?s:o,p=a>h?a>l?a:l:h>l?h:l,f=i.next;f!==e;){if(f.x>=c&&f.x<=d&&f.y>=u&&f.y<=p&&cP(n,a,s,h,o,l,f.x,f.y)&&dP(f.prev,f,f.next)>=0)return!1;f=f.next}return!0}function rP(t,e,r,i){var n=t.prev,s=t,o=t.next;if(dP(n,s,o)>=0)return!1;for(var a=n.x,h=s.x,l=o.x,c=n.y,u=s.y,d=o.y,p=a<h?a<l?a:l:h<l?h:l,f=c<u?c<d?c:d:u<d?u:d,m=a>h?a>l?a:l:h>l?h:l,g=c>u?c>d?c:d:u>d?u:d,v=hP(p,f,e,r,i),y=hP(m,g,e,r,i),b=t.prevZ,_=t.nextZ;b&&b.z>=v&&_&&_.z<=y;){if(b.x>=p&&b.x<=m&&b.y>=f&&b.y<=g&&b!==n&&b!==o&&cP(a,c,h,u,l,d,b.x,b.y)&&dP(b.prev,b,b.next)>=0)return!1;if(b=b.prevZ,_.x>=p&&_.x<=m&&_.y>=f&&_.y<=g&&_!==n&&_!==o&&cP(a,c,h,u,l,d,_.x,_.y)&&dP(_.prev,_,_.next)>=0)return!1;_=_.nextZ}for(;b&&b.z>=v;){if(b.x>=p&&b.x<=m&&b.y>=f&&b.y<=g&&b!==n&&b!==o&&cP(a,c,h,u,l,d,b.x,b.y)&&dP(b.prev,b,b.next)>=0)return!1;b=b.prevZ}for(;_&&_.z<=y;){if(_.x>=p&&_.x<=m&&_.y>=f&&_.y<=g&&_!==n&&_!==o&&cP(a,c,h,u,l,d,_.x,_.y)&&dP(_.prev,_,_.next)>=0)return!1;_=_.nextZ}return!0}function iP(t,e,r){var i=t;do{var n=i.prev,s=i.next.next;!pP(n,s)&&fP(n,i,i.next,s)&&vP(n,s)&&vP(s,n)&&(e.push(n.i/r|0),e.push(i.i/r|0),e.push(s.i/r|0),_P(i),_P(i.next),i=t=s),i=i.next}while(i!==t);return QR(i)}function nP(t,e,r,i,n,s){var o=t;do{for(var a=o.next.next;a!==o.prev;){if(o.i!==a.i&&uP(o,a)){var h=yP(o,a);return o=QR(o,o.next),h=QR(h,h.next),tP(o,e,r,i,n,s,0),void tP(h,e,r,i,n,s,0)}a=a.next}o=o.next}while(o!==t)}function sP(t,e){return t.x-e.x}function oP(t,e){var r=function(t,e){var r,i=e,n=t.x,s=t.y,o=-1/0;do{if(s<=i.y&&s>=i.next.y&&i.next.y!==i.y){var a=i.x+(s-i.y)*(i.next.x-i.x)/(i.next.y-i.y);if(a<=n&&a>o&&(o=a,r=i.x<i.next.x?i:i.next,a===n))return r}i=i.next}while(i!==e);if(!r)return null;var h,l=r,c=r.x,u=r.y,d=1/0;i=r;do{n>=i.x&&i.x>=c&&n!==i.x&&cP(s<u?n:o,s,c,u,s<u?o:n,s,i.x,i.y)&&(h=Math.abs(s-i.y)/(n-i.x),vP(i,t)&&(h<d||h===d&&(i.x>r.x||i.x===r.x&&aP(r,i)))&&(r=i,d=h)),i=i.next}while(i!==l);return r}(t,e);if(!r)return e;var i=yP(r,t);return QR(i,i.next),QR(r,r.next)}function aP(t,e){return dP(t.prev,t,e.prev)<0&&dP(e.next,t,t.next)<0}function hP(t,e,r,i,n){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=(t-r)*n|0)|t<<8))|t<<4))|t<<2))|t<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=(e-i)*n|0)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function lP(t){var e=t,r=t;do{(e.x<r.x||e.x===r.x&&e.y<r.y)&&(r=e),e=e.next}while(e!==t);return r}function cP(t,e,r,i,n,s,o,a){return(n-o)*(e-a)>=(t-o)*(s-a)&&(t-o)*(i-a)>=(r-o)*(e-a)&&(r-o)*(s-a)>=(n-o)*(i-a)}function uP(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!function(t,e){var r=t;do{if(r.i!==t.i&&r.next.i!==t.i&&r.i!==e.i&&r.next.i!==e.i&&fP(r,r.next,t,e))return!0;r=r.next}while(r!==t);return!1}(t,e)&&(vP(t,e)&&vP(e,t)&&function(t,e){var r=t,i=!1,n=(t.x+e.x)/2,s=(t.y+e.y)/2;do{r.y>s!=r.next.y>s&&r.next.y!==r.y&&n<(r.next.x-r.x)*(s-r.y)/(r.next.y-r.y)+r.x&&(i=!i),r=r.next}while(r!==t);return i}(t,e)&&(dP(t.prev,t,e.prev)||dP(t,e.prev,e))||pP(t,e)&&dP(t.prev,t,t.next)>0&&dP(e.prev,e,e.next)>0)}function dP(t,e,r){return(e.y-t.y)*(r.x-e.x)-(e.x-t.x)*(r.y-e.y)}function pP(t,e){return t.x===e.x&&t.y===e.y}function fP(t,e,r,i){var n=gP(dP(t,e,r)),s=gP(dP(t,e,i)),o=gP(dP(r,i,t)),a=gP(dP(r,i,e));return n!==s&&o!==a||(!(0!==n||!mP(t,r,e))||(!(0!==s||!mP(t,i,e))||(!(0!==o||!mP(r,t,i))||!(0!==a||!mP(r,e,i)))))}function mP(t,e,r){return e.x<=Math.max(t.x,r.x)&&e.x>=Math.min(t.x,r.x)&&e.y<=Math.max(t.y,r.y)&&e.y>=Math.min(t.y,r.y)}function gP(t){return t>0?1:t<0?-1:0}function vP(t,e){return dP(t.prev,t,t.next)<0?dP(t,e,t.next)>=0&&dP(t,t.prev,e)>=0:dP(t,e,t.prev)<0||dP(t,t.next,e)<0}function yP(t,e){var r=new xP(t.i,t.x,t.y),i=new xP(e.i,e.x,e.y),n=t.next,s=e.prev;return t.next=e,e.prev=t,r.next=n,n.prev=r,i.next=r,r.prev=i,s.next=i,i.prev=s,i}function bP(t,e,r,i){var n=new xP(t,e,r);return i?(n.next=i.next,n.prev=i,i.next.prev=n,i.next=n):(n.prev=n,n.next=n),n}function _P(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ)}function xP(t,e,r){this.i=t,this.x=e,this.y=r,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}function TP(t,e,r,i){for(var n=0,s=e,o=r-i;s<r;s+=i)n+=(t[o]-t[s])*(t[s+1]+t[o+1]),o=s;return n}KR.exports=JR,KR.exports.default=JR,JR.deviation=function(t,e,r,i){var n=e&&e.length,s=n?e[0]*r:t.length,o=Math.abs(TP(t,0,s,r));if(n)for(var a=0,h=e.length;a<h;a++){var l=e[a]*r,c=a<h-1?e[a+1]*r:t.length;o-=Math.abs(TP(t,l,c,r))}var u=0;for(a=0;a<i.length;a+=3){var d=i[a]*r,p=i[a+1]*r,f=i[a+2]*r;u+=Math.abs((t[d]-t[f])*(t[p+1]-t[d+1])-(t[d]-t[p])*(t[f+1]-t[d+1]))}return 0===o&&0===u?0:Math.abs((u-o)/o)},JR.flatten=function(t){for(var e=t[0][0].length,r={vertices:[],holes:[],dimensions:e},i=0,n=0;n<t.length;n++){for(var s=0;s<t[n].length;s++)for(var o=0;o<e;o++)r.vertices.push(t[n][s][o]);n>0&&(i+=t[n-1].length,r.holes.push(i))}return r};var wP=KR.exports,SP={exports:{}};!function(t,r){!function(i){var n=r&&!r.nodeType&&r,s=t&&!t.nodeType&&t,o="object"==typeof e&&e;o.global!==o&&o.window!==o&&o.self!==o||(i=o);var a,h,l=2147483647,c=36,u=/^xn--/,d=/[^\x20-\x7E]/,p=/[\x2E\u3002\uFF0E\uFF61]/g,f={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},m=Math.floor,g=String.fromCharCode;function v(t){throw new RangeError(f[t])}function y(t,e){for(var r=t.length,i=[];r--;)i[r]=e(t[r]);return i}function b(t,e){var r=t.split("@"),i="";return r.length>1&&(i=r[0]+"@",t=r[1]),i+y((t=t.replace(p,".")).split("."),e).join(".")}function _(t){for(var e,r,i=[],n=0,s=t.length;n<s;)(e=t.charCodeAt(n++))>=55296&&e<=56319&&n<s?56320==(64512&(r=t.charCodeAt(n++)))?i.push(((1023&e)<<10)+(1023&r)+65536):(i.push(e),n--):i.push(e);return i}function x(t){return y(t,(function(t){var e="";return t>65535&&(e+=g((t-=65536)>>>10&1023|55296),t=56320|1023&t),e+=g(t)})).join("")}function T(t,e){return t+22+75*(t<26)-((0!=e)<<5)}function w(t,e,r){var i=0;for(t=r?m(t/700):t>>1,t+=m(t/e);t>455;i+=c)t=m(t/35);return m(i+36*t/(t+38))}function S(t){var e,r,i,n,s,o,a,h,u,d,p,f=[],g=t.length,y=0,b=128,_=72;for((r=t.lastIndexOf("-"))<0&&(r=0),i=0;i<r;++i)t.charCodeAt(i)>=128&&v("not-basic"),f.push(t.charCodeAt(i));for(n=r>0?r+1:0;n<g;){for(s=y,o=1,a=c;n>=g&&v("invalid-input"),((h=(p=t.charCodeAt(n++))-48<10?p-22:p-65<26?p-65:p-97<26?p-97:c)>=c||h>m((l-y)/o))&&v("overflow"),y+=h*o,!(h<(u=a<=_?1:a>=_+26?26:a-_));a+=c)o>m(l/(d=c-u))&&v("overflow"),o*=d;_=w(y-s,e=f.length+1,0==s),m(y/e)>l-b&&v("overflow"),b+=m(y/e),y%=e,f.splice(y++,0,b)}return x(f)}function E(t){var e,r,i,n,s,o,a,h,u,d,p,f,y,b,x,S=[];for(f=(t=_(t)).length,e=128,r=0,s=72,o=0;o<f;++o)(p=t[o])<128&&S.push(g(p));for(i=n=S.length,n&&S.push("-");i<f;){for(a=l,o=0;o<f;++o)(p=t[o])>=e&&p<a&&(a=p);for(a-e>m((l-r)/(y=i+1))&&v("overflow"),r+=(a-e)*y,e=a,o=0;o<f;++o)if((p=t[o])<e&&++r>l&&v("overflow"),p==e){for(h=r,u=c;!(h<(d=u<=s?1:u>=s+26?26:u-s));u+=c)x=h-d,b=c-d,S.push(g(T(d+x%b,0))),h=m(x/b);S.push(g(T(h,0))),s=w(r,y,i==n),r=0,++i}++r,++e}return S.join("")}if(a={version:"1.4.1",ucs2:{decode:_,encode:x},decode:S,encode:E,toASCII:function(t){return b(t,(function(t){return d.test(t)?"xn--"+E(t):t}))},toUnicode:function(t){return b(t,(function(t){return u.test(t)?S(t.slice(4).toLowerCase()):t}))}},n&&s)if(t.exports==n)s.exports=a;else for(h in a)a.hasOwnProperty(h)&&(n[h]=a[h]);else i.punycode=a}(e)}(SP,SP.exports);var EP,CP="undefined"!=typeof Symbol&&Symbol,AP=function(){if("function"!=typeof Symbol||"function"!=typeof Object.getOwnPropertySymbols)return!1;if("symbol"==typeof Symbol.iterator)return!0;var t={},e=Symbol("test"),r=Object(e);if("string"==typeof e)return!1;if("[object Symbol]"!==Object.prototype.toString.call(e))return!1;if("[object Symbol]"!==Object.prototype.toString.call(r))return!1;for(e in t[e]=42,t)return!1;if("function"==typeof Object.keys&&0!==Object.keys(t).length)return!1;if("function"==typeof Object.getOwnPropertyNames&&0!==Object.getOwnPropertyNames(t).length)return!1;var i=Object.getOwnPropertySymbols(t);if(1!==i.length||i[0]!==e)return!1;if(!Object.prototype.propertyIsEnumerable.call(t,e))return!1;if("function"==typeof Object.getOwnPropertyDescriptor){var n=Object.getOwnPropertyDescriptor(t,e);if(42!==n.value||!0!==n.enumerable)return!1}return!0},RP="Function.prototype.bind called on incompatible ",PP=Array.prototype.slice,IP=Object.prototype.toString,MP="[object Function]",OP=function(t){var e=this;if("function"!=typeof e||IP.call(e)!==MP)throw new TypeError(RP+e);for(var r,i=PP.call(arguments,1),n=function(){if(this instanceof r){var n=e.apply(this,i.concat(PP.call(arguments)));return Object(n)===n?n:this}return e.apply(t,i.concat(PP.call(arguments)))},s=Math.max(0,e.length-i.length),o=[],a=0;a<s;a++)o.push("$"+a);if(r=Function("binder","return function ("+o.join(",")+"){ return binder.apply(this,arguments); }")(n),e.prototype){var h=function(){};h.prototype=e.prototype,r.prototype=new h,h.prototype=null}return r},kP=Function.prototype.bind||OP,DP=kP.call(Function.call,Object.prototype.hasOwnProperty),LP=SyntaxError,NP=Function,FP=TypeError,BP=function(t){try{return NP('"use strict"; return ('+t+").constructor;")()}catch(t){}},UP=Object.getOwnPropertyDescriptor;if(UP)try{UP({},"")}catch(t){UP=null}var GP=function(){throw new FP},jP=UP?function(){try{return GP}catch(t){try{return UP(arguments,"callee").get}catch(t){return GP}}}():GP,VP="function"==typeof CP&&"function"==typeof Symbol&&"symbol"==typeof CP("foo")&&"symbol"==typeof Symbol("bar")&&AP(),HP=Object.getPrototypeOf||function(t){return t.__proto__},WP={},XP="undefined"==typeof Uint8Array?EP:HP(Uint8Array),zP={"%AggregateError%":"undefined"==typeof AggregateError?EP:AggregateError,"%Array%":Array,"%ArrayBuffer%":"undefined"==typeof ArrayBuffer?EP:ArrayBuffer,"%ArrayIteratorPrototype%":VP?HP([][Symbol.iterator]()):EP,"%AsyncFromSyncIteratorPrototype%":EP,"%AsyncFunction%":WP,"%AsyncGenerator%":WP,"%AsyncGeneratorFunction%":WP,"%AsyncIteratorPrototype%":WP,"%Atomics%":"undefined"==typeof Atomics?EP:Atomics,"%BigInt%":"undefined"==typeof BigInt?EP:BigInt,"%Boolean%":Boolean,"%DataView%":"undefined"==typeof DataView?EP:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":Error,"%eval%":eval,"%EvalError%":EvalError,"%Float32Array%":"undefined"==typeof Float32Array?EP:Float32Array,"%Float64Array%":"undefined"==typeof Float64Array?EP:Float64Array,"%FinalizationRegistry%":"undefined"==typeof FinalizationRegistry?EP:FinalizationRegistry,"%Function%":NP,"%GeneratorFunction%":WP,"%Int8Array%":"undefined"==typeof Int8Array?EP:Int8Array,"%Int16Array%":"undefined"==typeof Int16Array?EP:Int16Array,"%Int32Array%":"undefined"==typeof Int32Array?EP:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":VP?HP(HP([][Symbol.iterator]())):EP,"%JSON%":"object"==typeof JSON?JSON:EP,"%Map%":"undefined"==typeof Map?EP:Map,"%MapIteratorPrototype%":"undefined"!=typeof Map&&VP?HP((new Map)[Symbol.iterator]()):EP,"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":"undefined"==typeof Promise?EP:Promise,"%Proxy%":"undefined"==typeof Proxy?EP:Proxy,"%RangeError%":RangeError,"%ReferenceError%":ReferenceError,"%Reflect%":"undefined"==typeof Reflect?EP:Reflect,"%RegExp%":RegExp,"%Set%":"undefined"==typeof Set?EP:Set,"%SetIteratorPrototype%":"undefined"!=typeof Set&&VP?HP((new Set)[Symbol.iterator]()):EP,"%SharedArrayBuffer%":"undefined"==typeof SharedArrayBuffer?EP:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":VP?HP(""[Symbol.iterator]()):EP,"%Symbol%":VP?Symbol:EP,"%SyntaxError%":LP,"%ThrowTypeError%":jP,"%TypedArray%":XP,"%TypeError%":FP,"%Uint8Array%":"undefined"==typeof Uint8Array?EP:Uint8Array,"%Uint8ClampedArray%":"undefined"==typeof Uint8ClampedArray?EP:Uint8ClampedArray,"%Uint16Array%":"undefined"==typeof Uint16Array?EP:Uint16Array,"%Uint32Array%":"undefined"==typeof Uint32Array?EP:Uint32Array,"%URIError%":URIError,"%WeakMap%":"undefined"==typeof WeakMap?EP:WeakMap,"%WeakRef%":"undefined"==typeof WeakRef?EP:WeakRef,"%WeakSet%":"undefined"==typeof WeakSet?EP:WeakSet},YP=function t(e){var r;if("%AsyncFunction%"===e)r=BP("async function () {}");else if("%GeneratorFunction%"===e)r=BP("function* () {}");else if("%AsyncGeneratorFunction%"===e)r=BP("async function* () {}");else if("%AsyncGenerator%"===e){var i=t("%AsyncGeneratorFunction%");i&&(r=i.prototype)}else if("%AsyncIteratorPrototype%"===e){var n=t("%AsyncGenerator%");n&&(r=HP(n.prototype))}return zP[e]=r,r},ZP={"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},$P=kP,KP=DP,JP=$P.call(Function.call,Array.prototype.concat),qP=$P.call(Function.apply,Array.prototype.splice),QP=$P.call(Function.call,String.prototype.replace),tI=$P.call(Function.call,String.prototype.slice),eI=$P.call(Function.call,RegExp.prototype.exec),rI=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,iI=/\\(\\)?/g,nI=function(t){var e=tI(t,0,1),r=tI(t,-1);if("%"===e&&"%"!==r)throw new LP("invalid intrinsic syntax, expected closing `%`");if("%"===r&&"%"!==e)throw new LP("invalid intrinsic syntax, expected opening `%`");var i=[];return QP(t,rI,(function(t,e,r,n){i[i.length]=r?QP(n,iI,"$1"):e||t})),i},sI=function(t,e){var r,i=t;if(KP(ZP,i)&&(i="%"+(r=ZP[i])[0]+"%"),KP(zP,i)){var n=zP[i];if(n===WP&&(n=YP(i)),void 0===n&&!e)throw new FP("intrinsic "+t+" exists, but is not available. Please file an issue!");return{alias:r,name:i,value:n}}throw new LP("intrinsic "+t+" does not exist!")},oI=function(t,e){if("string"!=typeof t||0===t.length)throw new FP("intrinsic name must be a non-empty string");if(arguments.length>1&&"boolean"!=typeof e)throw new FP('"allowMissing" argument must be a boolean');if(null===eI(/^%?[^%]*%?$/,t))throw new LP("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var r=nI(t),i=r.length>0?r[0]:"",n=sI("%"+i+"%",e),s=n.name,o=n.value,a=!1,h=n.alias;h&&(i=h[0],qP(r,JP([0,1],h)));for(var l=1,c=!0;l<r.length;l+=1){var u=r[l],d=tI(u,0,1),p=tI(u,-1);if(('"'===d||"'"===d||"`"===d||'"'===p||"'"===p||"`"===p)&&d!==p)throw new LP("property names with quotes must have matching quotes");if("constructor"!==u&&c||(a=!0),KP(zP,s="%"+(i+="."+u)+"%"))o=zP[s];else if(null!=o){if(!(u in o)){if(!e)throw new FP("base intrinsic for "+t+" exists, but the property is not available.");return}if(UP&&l+1>=r.length){var f=UP(o,u);o=(c=!!f)&&"get"in f&&!("originalValue"in f.get)?f.get:o[u]}else c=KP(o,u),o=o[u];c&&!a&&(zP[s]=o)}}return o},aI={exports:{}};!function(t){var e=kP,r=oI,i=r("%Function.prototype.apply%"),n=r("%Function.prototype.call%"),s=r("%Reflect.apply%",!0)||e.call(n,i),o=r("%Object.getOwnPropertyDescriptor%",!0),a=r("%Object.defineProperty%",!0),h=r("%Math.max%");if(a)try{a({},"a",{value:1})}catch(t){a=null}t.exports=function(t){var r=s(e,n,arguments);if(o&&a){var i=o(r,"length");i.configurable&&a(r,"length",{value:1+h(0,t.length-(arguments.length-1))})}return r};var l=function(){return s(e,i,arguments)};a?a(t.exports,"apply",{value:l}):t.exports.apply=l}(aI);var hI=oI,lI=aI.exports,cI=lI(hI("String.prototype.indexOf")),uI=i(Object.freeze({__proto__:null,default:{}})),dI="function"==typeof Map&&Map.prototype,pI=Object.getOwnPropertyDescriptor&&dI?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,fI=dI&&pI&&"function"==typeof pI.get?pI.get:null,mI=dI&&Map.prototype.forEach,gI="function"==typeof Set&&Set.prototype,vI=Object.getOwnPropertyDescriptor&&gI?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,yI=gI&&vI&&"function"==typeof vI.get?vI.get:null,bI=gI&&Set.prototype.forEach,_I="function"==typeof WeakMap&&WeakMap.prototype?WeakMap.prototype.has:null,xI="function"==typeof WeakSet&&WeakSet.prototype?WeakSet.prototype.has:null,TI="function"==typeof WeakRef&&WeakRef.prototype?WeakRef.prototype.deref:null,wI=Boolean.prototype.valueOf,SI=Object.prototype.toString,EI=Function.prototype.toString,CI=String.prototype.match,AI=String.prototype.slice,RI=String.prototype.replace,PI=String.prototype.toUpperCase,II=String.prototype.toLowerCase,MI=RegExp.prototype.test,OI=Array.prototype.concat,kI=Array.prototype.join,DI=Array.prototype.slice,LI=Math.floor,NI="function"==typeof BigInt?BigInt.prototype.valueOf:null,FI=Object.getOwnPropertySymbols,BI="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?Symbol.prototype.toString:null,UI="function"==typeof Symbol&&"object"==typeof Symbol.iterator,GI="function"==typeof Symbol&&Symbol.toStringTag&&(typeof Symbol.toStringTag===UI||"symbol")?Symbol.toStringTag:null,jI=Object.prototype.propertyIsEnumerable,VI=("function"==typeof Reflect?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(t){return t.__proto__}:null);function HI(t,e){if(t===1/0||t===-1/0||t!=t||t&&t>-1e3&&t<1e3||MI.call(/e/,e))return e;var r=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if("number"==typeof t){var i=t<0?-LI(-t):LI(t);if(i!==t){var n=String(i),s=AI.call(e,n.length+1);return RI.call(n,r,"$&_")+"."+RI.call(RI.call(s,/([0-9]{3})/g,"$&_"),/_$/,"")}}return RI.call(e,r,"$&_")}var WI=uI,XI=WI.custom,zI=JI(XI)?XI:null;function YI(t,e,r){var i="double"===(r.quoteStyle||e)?'"':"'";return i+t+i}function ZI(t){return RI.call(String(t),/"/g,"&quot;")}function $I(t){return!("[object Array]"!==tM(t)||GI&&"object"==typeof t&&GI in t)}function KI(t){return!("[object RegExp]"!==tM(t)||GI&&"object"==typeof t&&GI in t)}function JI(t){if(UI)return t&&"object"==typeof t&&t instanceof Symbol;if("symbol"==typeof t)return!0;if(!t||"object"!=typeof t||!BI)return!1;try{return BI.call(t),!0}catch(t){}return!1}var qI=Object.prototype.hasOwnProperty||function(t){return t in this};function QI(t,e){return qI.call(t,e)}function tM(t){return SI.call(t)}function eM(t,e){if(t.indexOf)return t.indexOf(e);for(var r=0,i=t.length;r<i;r++)if(t[r]===e)return r;return-1}function rM(t,e){if(t.length>e.maxStringLength){var r=t.length-e.maxStringLength,i="... "+r+" more character"+(r>1?"s":"");return rM(AI.call(t,0,e.maxStringLength),e)+i}return YI(RI.call(RI.call(t,/(['\\])/g,"\\$1"),/[\x00-\x1f]/g,iM),"single",e)}function iM(t){var e=t.charCodeAt(0),r={8:"b",9:"t",10:"n",12:"f",13:"r"}[e];return r?"\\"+r:"\\x"+(e<16?"0":"")+PI.call(e.toString(16))}function nM(t){return"Object("+t+")"}function sM(t){return t+" { ? }"}function oM(t,e,r,i){return t+" ("+e+") {"+(i?aM(r,i):kI.call(r,", "))+"}"}function aM(t,e){if(0===t.length)return"";var r="\n"+e.prev+e.base;return r+kI.call(t,","+r)+"\n"+e.prev}function hM(t,e){var r=$I(t),i=[];if(r){i.length=t.length;for(var n=0;n<t.length;n++)i[n]=QI(t,n)?e(t[n],t):""}var s,o="function"==typeof FI?FI(t):[];if(UI){s={};for(var a=0;a<o.length;a++)s["$"+o[a]]=o[a]}for(var h in t)QI(t,h)&&(r&&String(Number(h))===h&&h<t.length||UI&&s["$"+h]instanceof Symbol||(MI.call(/[^\w$]/,h)?i.push(e(h,t)+": "+e(t[h],t)):i.push(h+": "+e(t[h],t))));if("function"==typeof FI)for(var l=0;l<o.length;l++)jI.call(t,o[l])&&i.push("["+e(o[l])+"]: "+e(t[o[l]],t));return i}var lM=oI,cM=function(t,e){var r=hI(t,!!e);return"function"==typeof r&&cI(t,".prototype.")>-1?lI(r):r},uM=function t(e,r,i,n){var s=r||{};if(QI(s,"quoteStyle")&&"single"!==s.quoteStyle&&"double"!==s.quoteStyle)throw new TypeError('option "quoteStyle" must be "single" or "double"');if(QI(s,"maxStringLength")&&("number"==typeof s.maxStringLength?s.maxStringLength<0&&s.maxStringLength!==1/0:null!==s.maxStringLength))throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`');var o=!QI(s,"customInspect")||s.customInspect;if("boolean"!=typeof o&&"symbol"!==o)throw new TypeError("option \"customInspect\", if provided, must be `true`, `false`, or `'symbol'`");if(QI(s,"indent")&&null!==s.indent&&"\t"!==s.indent&&!(parseInt(s.indent,10)===s.indent&&s.indent>0))throw new TypeError('option "indent" must be "\\t", an integer > 0, or `null`');if(QI(s,"numericSeparator")&&"boolean"!=typeof s.numericSeparator)throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`');var a=s.numericSeparator;if(void 0===e)return"undefined";if(null===e)return"null";if("boolean"==typeof e)return e?"true":"false";if("string"==typeof e)return rM(e,s);if("number"==typeof e){if(0===e)return 1/0/e>0?"0":"-0";var h=String(e);return a?HI(e,h):h}if("bigint"==typeof e){var l=String(e)+"n";return a?HI(e,l):l}var c=void 0===s.depth?5:s.depth;if(void 0===i&&(i=0),i>=c&&c>0&&"object"==typeof e)return $I(e)?"[Array]":"[Object]";var u=function(t,e){var r;if("\t"===t.indent)r="\t";else{if(!("number"==typeof t.indent&&t.indent>0))return null;r=kI.call(Array(t.indent+1)," ")}return{base:r,prev:kI.call(Array(e+1),r)}}(s,i);if(void 0===n)n=[];else if(eM(n,e)>=0)return"[Circular]";function d(e,r,o){if(r&&(n=DI.call(n)).push(r),o){var a={depth:s.depth};return QI(s,"quoteStyle")&&(a.quoteStyle=s.quoteStyle),t(e,a,i+1,n)}return t(e,s,i+1,n)}if("function"==typeof e&&!KI(e)){var p=function(t){if(t.name)return t.name;var e=CI.call(EI.call(t),/^function\s*([\w$]+)/);if(e)return e[1];return null}(e),f=hM(e,d);return"[Function"+(p?": "+p:" (anonymous)")+"]"+(f.length>0?" { "+kI.call(f,", ")+" }":"")}if(JI(e)){var m=UI?RI.call(String(e),/^(Symbol\(.*\))_[^)]*$/,"$1"):BI.call(e);return"object"!=typeof e||UI?m:nM(m)}if(function(t){if(!t||"object"!=typeof t)return!1;if("undefined"!=typeof HTMLElement&&t instanceof HTMLElement)return!0;return"string"==typeof t.nodeName&&"function"==typeof t.getAttribute}(e)){for(var g="<"+II.call(String(e.nodeName)),v=e.attributes||[],y=0;y<v.length;y++)g+=" "+v[y].name+"="+YI(ZI(v[y].value),"double",s);return g+=">",e.childNodes&&e.childNodes.length&&(g+="..."),g+="</"+II.call(String(e.nodeName))+">"}if($I(e)){if(0===e.length)return"[]";var b=hM(e,d);return u&&!function(t){for(var e=0;e<t.length;e++)if(eM(t[e],"\n")>=0)return!1;return!0}(b)?"["+aM(b,u)+"]":"[ "+kI.call(b,", ")+" ]"}if(function(t){return!("[object Error]"!==tM(t)||GI&&"object"==typeof t&&GI in t)}(e)){var _=hM(e,d);return"cause"in Error.prototype||!("cause"in e)||jI.call(e,"cause")?0===_.length?"["+String(e)+"]":"{ ["+String(e)+"] "+kI.call(_,", ")+" }":"{ ["+String(e)+"] "+kI.call(OI.call("[cause]: "+d(e.cause),_),", ")+" }"}if("object"==typeof e&&o){if(zI&&"function"==typeof e[zI]&&WI)return WI(e,{depth:c-i});if("symbol"!==o&&"function"==typeof e.inspect)return e.inspect()}if(function(t){if(!fI||!t||"object"!=typeof t)return!1;try{fI.call(t);try{yI.call(t)}catch(t){return!0}return t instanceof Map}catch(t){}return!1}(e)){var x=[];return mI.call(e,(function(t,r){x.push(d(r,e,!0)+" => "+d(t,e))})),oM("Map",fI.call(e),x,u)}if(function(t){if(!yI||!t||"object"!=typeof t)return!1;try{yI.call(t);try{fI.call(t)}catch(t){return!0}return t instanceof Set}catch(t){}return!1}(e)){var T=[];return bI.call(e,(function(t){T.push(d(t,e))})),oM("Set",yI.call(e),T,u)}if(function(t){if(!_I||!t||"object"!=typeof t)return!1;try{_I.call(t,_I);try{xI.call(t,xI)}catch(t){return!0}return t instanceof WeakMap}catch(t){}return!1}(e))return sM("WeakMap");if(function(t){if(!xI||!t||"object"!=typeof t)return!1;try{xI.call(t,xI);try{_I.call(t,_I)}catch(t){return!0}return t instanceof WeakSet}catch(t){}return!1}(e))return sM("WeakSet");if(function(t){if(!TI||!t||"object"!=typeof t)return!1;try{return TI.call(t),!0}catch(t){}return!1}(e))return sM("WeakRef");if(function(t){return!("[object Number]"!==tM(t)||GI&&"object"==typeof t&&GI in t)}(e))return nM(d(Number(e)));if(function(t){if(!t||"object"!=typeof t||!NI)return!1;try{return NI.call(t),!0}catch(t){}return!1}(e))return nM(d(NI.call(e)));if(function(t){return!("[object Boolean]"!==tM(t)||GI&&"object"==typeof t&&GI in t)}(e))return nM(wI.call(e));if(function(t){return!("[object String]"!==tM(t)||GI&&"object"==typeof t&&GI in t)}(e))return nM(d(String(e)));if(!function(t){return!("[object Date]"!==tM(t)||GI&&"object"==typeof t&&GI in t)}(e)&&!KI(e)){var w=hM(e,d),S=VI?VI(e)===Object.prototype:e instanceof Object||e.constructor===Object,E=e instanceof Object?"":"null prototype",C=!S&&GI&&Object(e)===e&&GI in e?AI.call(tM(e),8,-1):E?"Object":"",A=(S||"function"!=typeof e.constructor?"":e.constructor.name?e.constructor.name+" ":"")+(C||E?"["+kI.call(OI.call([],C||[],E||[]),": ")+"] ":"");return 0===w.length?A+"{}":u?A+"{"+aM(w,u)+"}":A+"{ "+kI.call(w,", ")+" }"}return String(e)},dM=lM("%TypeError%"),pM=lM("%WeakMap%",!0),fM=lM("%Map%",!0),mM=cM("WeakMap.prototype.get",!0),gM=cM("WeakMap.prototype.set",!0),vM=cM("WeakMap.prototype.has",!0),yM=cM("Map.prototype.get",!0),bM=cM("Map.prototype.set",!0),_M=cM("Map.prototype.has",!0),xM=function(t,e){for(var r,i=t;null!==(r=i.next);i=r)if(r.key===e)return i.next=r.next,r.next=t.next,t.next=r,r},TM=String.prototype.replace,wM=/%20/g,SM="RFC3986",EM={default:SM,formatters:{RFC1738:function(t){return TM.call(t,wM,"+")},RFC3986:function(t){return String(t)}},RFC1738:"RFC1738",RFC3986:SM},CM=EM,AM=Object.prototype.hasOwnProperty,RM=Array.isArray,PM=function(){for(var t=[],e=0;e<256;++e)t.push("%"+((e<16?"0":"")+e.toString(16)).toUpperCase());return t}(),IM=function(t,e){for(var r=e&&e.plainObjects?Object.create(null):{},i=0;i<t.length;++i)void 0!==t[i]&&(r[i]=t[i]);return r},MM={arrayToObject:IM,assign:function(t,e){return Object.keys(e).reduce((function(t,r){return t[r]=e[r],t}),t)},combine:function(t,e){return[].concat(t,e)},compact:function(t){for(var e=[{obj:{o:t},prop:"o"}],r=[],i=0;i<e.length;++i)for(var n=e[i],s=n.obj[n.prop],o=Object.keys(s),a=0;a<o.length;++a){var h=o[a],l=s[h];"object"==typeof l&&null!==l&&-1===r.indexOf(l)&&(e.push({obj:s,prop:h}),r.push(l))}return function(t){for(;t.length>1;){var e=t.pop(),r=e.obj[e.prop];if(RM(r)){for(var i=[],n=0;n<r.length;++n)void 0!==r[n]&&i.push(r[n]);e.obj[e.prop]=i}}}(e),t},decode:function(t,e,r){var i=t.replace(/\+/g," ");if("iso-8859-1"===r)return i.replace(/%[0-9a-f]{2}/gi,unescape);try{return decodeURIComponent(i)}catch(t){return i}},encode:function(t,e,r,i,n){if(0===t.length)return t;var s=t;if("symbol"==typeof t?s=Symbol.prototype.toString.call(t):"string"!=typeof t&&(s=String(t)),"iso-8859-1"===r)return escape(s).replace(/%u[0-9a-f]{4}/gi,(function(t){return"%26%23"+parseInt(t.slice(2),16)+"%3B"}));for(var o="",a=0;a<s.length;++a){var h=s.charCodeAt(a);45===h||46===h||95===h||126===h||h>=48&&h<=57||h>=65&&h<=90||h>=97&&h<=122||n===CM.RFC1738&&(40===h||41===h)?o+=s.charAt(a):h<128?o+=PM[h]:h<2048?o+=PM[192|h>>6]+PM[128|63&h]:h<55296||h>=57344?o+=PM[224|h>>12]+PM[128|h>>6&63]+PM[128|63&h]:(a+=1,h=65536+((1023&h)<<10|1023&s.charCodeAt(a)),o+=PM[240|h>>18]+PM[128|h>>12&63]+PM[128|h>>6&63]+PM[128|63&h])}return o},isBuffer:function(t){return!(!t||"object"!=typeof t)&&!!(t.constructor&&t.constructor.isBuffer&&t.constructor.isBuffer(t))},isRegExp:function(t){return"[object RegExp]"===Object.prototype.toString.call(t)},maybeMap:function(t,e){if(RM(t)){for(var r=[],i=0;i<t.length;i+=1)r.push(e(t[i]));return r}return e(t)},merge:function t(e,r,i){if(!r)return e;if("object"!=typeof r){if(RM(e))e.push(r);else{if(!e||"object"!=typeof e)return[e,r];(i&&(i.plainObjects||i.allowPrototypes)||!AM.call(Object.prototype,r))&&(e[r]=!0)}return e}if(!e||"object"!=typeof e)return[e].concat(r);var n=e;return RM(e)&&!RM(r)&&(n=IM(e,i)),RM(e)&&RM(r)?(r.forEach((function(r,n){if(AM.call(e,n)){var s=e[n];s&&"object"==typeof s&&r&&"object"==typeof r?e[n]=t(s,r,i):e.push(r)}else e[n]=r})),e):Object.keys(r).reduce((function(e,n){var s=r[n];return AM.call(e,n)?e[n]=t(e[n],s,i):e[n]=s,e}),n)}},OM=function(){var t,e,r,i={assert:function(t){if(!i.has(t))throw new dM("Side channel does not contain "+uM(t))},get:function(i){if(pM&&i&&("object"==typeof i||"function"==typeof i)){if(t)return mM(t,i)}else if(fM){if(e)return yM(e,i)}else if(r)return function(t,e){var r=xM(t,e);return r&&r.value}(r,i)},has:function(i){if(pM&&i&&("object"==typeof i||"function"==typeof i)){if(t)return vM(t,i)}else if(fM){if(e)return _M(e,i)}else if(r)return function(t,e){return!!xM(t,e)}(r,i);return!1},set:function(i,n){pM&&i&&("object"==typeof i||"function"==typeof i)?(t||(t=new pM),gM(t,i,n)):fM?(e||(e=new fM),bM(e,i,n)):(r||(r={key:{},next:null}),function(t,e,r){var i=xM(t,e);i?i.value=r:t.next={key:e,next:t.next,value:r}}(r,i,n))}};return i},kM=MM,DM=EM,LM=Object.prototype.hasOwnProperty,NM={brackets:function(t){return t+"[]"},comma:"comma",indices:function(t,e){return t+"["+e+"]"},repeat:function(t){return t}},FM=Array.isArray,BM=Array.prototype.push,UM=function(t,e){BM.apply(t,FM(e)?e:[e])},GM=Date.prototype.toISOString,jM=DM.default,VM={addQueryPrefix:!1,allowDots:!1,charset:"utf-8",charsetSentinel:!1,delimiter:"&",encode:!0,encoder:kM.encode,encodeValuesOnly:!1,format:jM,formatter:DM.formatters[jM],indices:!1,serializeDate:function(t){return GM.call(t)},skipNulls:!1,strictNullHandling:!1},HM={},WM=function t(e,r,i,n,s,o,a,h,l,c,u,d,p,f,m,g){for(var v=e,y=g,b=0,_=!1;void 0!==(y=y.get(HM))&&!_;){var x=y.get(e);if(b+=1,void 0!==x){if(x===b)throw new RangeError("Cyclic object value");_=!0}void 0===y.get(HM)&&(b=0)}if("function"==typeof h?v=h(r,v):v instanceof Date?v=u(v):"comma"===i&&FM(v)&&(v=kM.maybeMap(v,(function(t){return t instanceof Date?u(t):t}))),null===v){if(s)return a&&!f?a(r,VM.encoder,m,"key",d):r;v=""}if(function(t){return"string"==typeof t||"number"==typeof t||"boolean"==typeof t||"symbol"==typeof t||"bigint"==typeof t}(v)||kM.isBuffer(v))return a?[p(f?r:a(r,VM.encoder,m,"key",d))+"="+p(a(v,VM.encoder,m,"value",d))]:[p(r)+"="+p(String(v))];var T,w=[];if(void 0===v)return w;if("comma"===i&&FM(v))f&&a&&(v=kM.maybeMap(v,a)),T=[{value:v.length>0?v.join(",")||null:void 0}];else if(FM(h))T=h;else{var S=Object.keys(v);T=l?S.sort(l):S}for(var E=n&&FM(v)&&1===v.length?r+"[]":r,C=0;C<T.length;++C){var A=T[C],R="object"==typeof A&&void 0!==A.value?A.value:v[A];if(!o||null!==R){var P=FM(v)?"function"==typeof i?i(E,A):E:E+(c?"."+A:"["+A+"]");g.set(e,b);var I=OM();I.set(HM,g),UM(w,t(R,P,i,n,s,o,"comma"===i&&f&&FM(v)?null:a,h,l,c,u,d,p,f,m,I))}}return w},XM=MM,zM=Object.prototype.hasOwnProperty,YM=Array.isArray,ZM={allowDots:!1,allowPrototypes:!1,allowSparse:!1,arrayLimit:20,charset:"utf-8",charsetSentinel:!1,comma:!1,decoder:XM.decode,delimiter:"&",depth:5,ignoreQueryPrefix:!1,interpretNumericEntities:!1,parameterLimit:1e3,parseArrays:!0,plainObjects:!1,strictNullHandling:!1},$M=function(t){return t.replace(/&#(\d+);/g,(function(t,e){return String.fromCharCode(parseInt(e,10))}))},KM=function(t,e){return t&&"string"==typeof t&&e.comma&&t.indexOf(",")>-1?t.split(","):t},JM=function(t,e,r,i){if(t){var n=r.allowDots?t.replace(/\.([^.[]+)/g,"[$1]"):t,s=/(\[[^[\]]*])/g,o=r.depth>0&&/(\[[^[\]]*])/.exec(n),a=o?n.slice(0,o.index):n,h=[];if(a){if(!r.plainObjects&&zM.call(Object.prototype,a)&&!r.allowPrototypes)return;h.push(a)}for(var l=0;r.depth>0&&null!==(o=s.exec(n))&&l<r.depth;){if(l+=1,!r.plainObjects&&zM.call(Object.prototype,o[1].slice(1,-1))&&!r.allowPrototypes)return;h.push(o[1])}return o&&h.push("["+n.slice(o.index)+"]"),function(t,e,r,i){for(var n=i?e:KM(e,r),s=t.length-1;s>=0;--s){var o,a=t[s];if("[]"===a&&r.parseArrays)o=[].concat(n);else{o=r.plainObjects?Object.create(null):{};var h="["===a.charAt(0)&&"]"===a.charAt(a.length-1)?a.slice(1,-1):a,l=parseInt(h,10);r.parseArrays||""!==h?!isNaN(l)&&a!==h&&String(l)===h&&l>=0&&r.parseArrays&&l<=r.arrayLimit?(o=[])[l]=n:"__proto__"!==h&&(o[h]=n):o={0:n}}n=o}return n}(h,e,r,i)}},qM=function(t,e){var r,i=t,n=function(t){if(!t)return VM;if(null!==t.encoder&&void 0!==t.encoder&&"function"!=typeof t.encoder)throw new TypeError("Encoder has to be a function.");var e=t.charset||VM.charset;if(void 0!==t.charset&&"utf-8"!==t.charset&&"iso-8859-1"!==t.charset)throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");var r=DM.default;if(void 0!==t.format){if(!LM.call(DM.formatters,t.format))throw new TypeError("Unknown format option provided.");r=t.format}var i=DM.formatters[r],n=VM.filter;return("function"==typeof t.filter||FM(t.filter))&&(n=t.filter),{addQueryPrefix:"boolean"==typeof t.addQueryPrefix?t.addQueryPrefix:VM.addQueryPrefix,allowDots:void 0===t.allowDots?VM.allowDots:!!t.allowDots,charset:e,charsetSentinel:"boolean"==typeof t.charsetSentinel?t.charsetSentinel:VM.charsetSentinel,delimiter:void 0===t.delimiter?VM.delimiter:t.delimiter,encode:"boolean"==typeof t.encode?t.encode:VM.encode,encoder:"function"==typeof t.encoder?t.encoder:VM.encoder,encodeValuesOnly:"boolean"==typeof t.encodeValuesOnly?t.encodeValuesOnly:VM.encodeValuesOnly,filter:n,format:r,formatter:i,serializeDate:"function"==typeof t.serializeDate?t.serializeDate:VM.serializeDate,skipNulls:"boolean"==typeof t.skipNulls?t.skipNulls:VM.skipNulls,sort:"function"==typeof t.sort?t.sort:null,strictNullHandling:"boolean"==typeof t.strictNullHandling?t.strictNullHandling:VM.strictNullHandling}}(e);"function"==typeof n.filter?i=(0,n.filter)("",i):FM(n.filter)&&(r=n.filter);var s,o=[];if("object"!=typeof i||null===i)return"";s=e&&e.arrayFormat in NM?e.arrayFormat:e&&"indices"in e?e.indices?"indices":"repeat":"indices";var a=NM[s];if(e&&"commaRoundTrip"in e&&"boolean"!=typeof e.commaRoundTrip)throw new TypeError("`commaRoundTrip` must be a boolean, or absent");var h="comma"===a&&e&&e.commaRoundTrip;r||(r=Object.keys(i)),n.sort&&r.sort(n.sort);for(var l=OM(),c=0;c<r.length;++c){var u=r[c];n.skipNulls&&null===i[u]||UM(o,WM(i[u],u,a,h,n.strictNullHandling,n.skipNulls,n.encode?n.encoder:null,n.filter,n.sort,n.allowDots,n.serializeDate,n.format,n.formatter,n.encodeValuesOnly,n.charset,l))}var d=o.join(n.delimiter),p=!0===n.addQueryPrefix?"?":"";return n.charsetSentinel&&("iso-8859-1"===n.charset?p+="utf8=%26%2310003%3B&":p+="utf8=%E2%9C%93&"),d.length>0?p+d:""},QM=function(t,e){var r=function(t){if(!t)return ZM;if(null!==t.decoder&&void 0!==t.decoder&&"function"!=typeof t.decoder)throw new TypeError("Decoder has to be a function.");if(void 0!==t.charset&&"utf-8"!==t.charset&&"iso-8859-1"!==t.charset)throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");var e=void 0===t.charset?ZM.charset:t.charset;return{allowDots:void 0===t.allowDots?ZM.allowDots:!!t.allowDots,allowPrototypes:"boolean"==typeof t.allowPrototypes?t.allowPrototypes:ZM.allowPrototypes,allowSparse:"boolean"==typeof t.allowSparse?t.allowSparse:ZM.allowSparse,arrayLimit:"number"==typeof t.arrayLimit?t.arrayLimit:ZM.arrayLimit,charset:e,charsetSentinel:"boolean"==typeof t.charsetSentinel?t.charsetSentinel:ZM.charsetSentinel,comma:"boolean"==typeof t.comma?t.comma:ZM.comma,decoder:"function"==typeof t.decoder?t.decoder:ZM.decoder,delimiter:"string"==typeof t.delimiter||XM.isRegExp(t.delimiter)?t.delimiter:ZM.delimiter,depth:"number"==typeof t.depth||!1===t.depth?+t.depth:ZM.depth,ignoreQueryPrefix:!0===t.ignoreQueryPrefix,interpretNumericEntities:"boolean"==typeof t.interpretNumericEntities?t.interpretNumericEntities:ZM.interpretNumericEntities,parameterLimit:"number"==typeof t.parameterLimit?t.parameterLimit:ZM.parameterLimit,parseArrays:!1!==t.parseArrays,plainObjects:"boolean"==typeof t.plainObjects?t.plainObjects:ZM.plainObjects,strictNullHandling:"boolean"==typeof t.strictNullHandling?t.strictNullHandling:ZM.strictNullHandling}}(e);if(""===t||null==t)return r.plainObjects?Object.create(null):{};for(var i="string"==typeof t?function(t,e){var r,i={__proto__:null},n=e.ignoreQueryPrefix?t.replace(/^\?/,""):t,s=e.parameterLimit===1/0?void 0:e.parameterLimit,o=n.split(e.delimiter,s),a=-1,h=e.charset;if(e.charsetSentinel)for(r=0;r<o.length;++r)0===o[r].indexOf("utf8=")&&("utf8=%E2%9C%93"===o[r]?h="utf-8":"utf8=%26%2310003%3B"===o[r]&&(h="iso-8859-1"),a=r,r=o.length);for(r=0;r<o.length;++r)if(r!==a){var l,c,u=o[r],d=u.indexOf("]="),p=-1===d?u.indexOf("="):d+1;-1===p?(l=e.decoder(u,ZM.decoder,h,"key"),c=e.strictNullHandling?null:""):(l=e.decoder(u.slice(0,p),ZM.decoder,h,"key"),c=XM.maybeMap(KM(u.slice(p+1),e),(function(t){return e.decoder(t,ZM.decoder,h,"value")}))),c&&e.interpretNumericEntities&&"iso-8859-1"===h&&(c=$M(c)),u.indexOf("[]=")>-1&&(c=YM(c)?[c]:c),zM.call(i,l)?i[l]=XM.combine(i[l],c):i[l]=c}return i}(t,r):t,n=r.plainObjects?Object.create(null):{},s=Object.keys(i),o=0;o<s.length;++o){var a=s[o],h=JM(a,i[a],r,"string"==typeof t);n=XM.merge(n,h,r)}return!0===r.allowSparse?n:XM.compact(n)},tO={formats:EM,parse:QM,stringify:qM},eO=SP.exports;function rO(){this.protocol=null,this.slashes=null,this.auth=null,this.host=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.query=null,this.pathname=null,this.path=null,this.href=null}var iO=/^([a-z0-9.+-]+:)/i,nO=/:[0-9]*$/,sO=/^(\/\/?(?!\/)[^?\s]*)(\?[^\s]*)?$/,oO=["{","}","|","\\","^","`"].concat(["<",">",'"',"`"," ","\r","\n","\t"]),aO=["'"].concat(oO),hO=["%","/","?",";","#"].concat(aO),lO=["/","?","#"],cO=/^[+a-z0-9A-Z_-]{0,63}$/,uO=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,dO={javascript:!0,"javascript:":!0},pO={javascript:!0,"javascript:":!0},fO={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},mO=tO;function gO(t,e,r){if(t&&"object"==typeof t&&t instanceof rO)return t;var i=new rO;return i.parse(t,e,r),i}rO.prototype.parse=function(t,e,r){if("string"!=typeof t)throw new TypeError("Parameter 'url' must be a string, not "+typeof t);var i=t.indexOf("?"),n=-1!==i&&i<t.indexOf("#")?"?":"#",s=t.split(n);s[0]=s[0].replace(/\\/g,"/");var o=t=s.join(n);if(o=o.trim(),!r&&1===t.split("#").length){var a=sO.exec(o);if(a)return this.path=o,this.href=o,this.pathname=a[1],a[2]?(this.search=a[2],this.query=e?mO.parse(this.search.substr(1)):this.search.substr(1)):e&&(this.search="",this.query={}),this}var h=iO.exec(o);if(h){var l=(h=h[0]).toLowerCase();this.protocol=l,o=o.substr(h.length)}if(r||h||o.match(/^\/\/[^@/]+@[^@/]+/)){var c="//"===o.substr(0,2);!c||h&&pO[h]||(o=o.substr(2),this.slashes=!0)}if(!pO[h]&&(c||h&&!fO[h])){for(var u,d,p=-1,f=0;f<lO.length;f++){-1!==(m=o.indexOf(lO[f]))&&(-1===p||m<p)&&(p=m)}-1!==(d=-1===p?o.lastIndexOf("@"):o.lastIndexOf("@",p))&&(u=o.slice(0,d),o=o.slice(d+1),this.auth=decodeURIComponent(u)),p=-1;for(f=0;f<hO.length;f++){var m;-1!==(m=o.indexOf(hO[f]))&&(-1===p||m<p)&&(p=m)}-1===p&&(p=o.length),this.host=o.slice(0,p),o=o.slice(p),this.parseHost(),this.hostname=this.hostname||"";var g="["===this.hostname[0]&&"]"===this.hostname[this.hostname.length-1];if(!g)for(var v=this.hostname.split(/\./),y=(f=0,v.length);f<y;f++){var b=v[f];if(b&&!b.match(cO)){for(var _="",x=0,T=b.length;x<T;x++)b.charCodeAt(x)>127?_+="x":_+=b[x];if(!_.match(cO)){var w=v.slice(0,f),S=v.slice(f+1),E=b.match(uO);E&&(w.push(E[1]),S.unshift(E[2])),S.length&&(o="/"+S.join(".")+o),this.hostname=w.join(".");break}}}this.hostname.length>255?this.hostname="":this.hostname=this.hostname.toLowerCase(),g||(this.hostname=eO.toASCII(this.hostname));var C=this.port?":"+this.port:"",A=this.hostname||"";this.host=A+C,this.href+=this.host,g&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),"/"!==o[0]&&(o="/"+o))}if(!dO[l])for(f=0,y=aO.length;f<y;f++){var R=aO[f];if(-1!==o.indexOf(R)){var P=encodeURIComponent(R);P===R&&(P=escape(R)),o=o.split(R).join(P)}}var I=o.indexOf("#");-1!==I&&(this.hash=o.substr(I),o=o.slice(0,I));var M=o.indexOf("?");if(-1!==M?(this.search=o.substr(M),this.query=o.substr(M+1),e&&(this.query=mO.parse(this.query)),o=o.slice(0,M)):e&&(this.search="",this.query={}),o&&(this.pathname=o),fO[l]&&this.hostname&&!this.pathname&&(this.pathname="/"),this.pathname||this.search){C=this.pathname||"";var O=this.search||"";this.path=C+O}return this.href=this.format(),this},rO.prototype.format=function(){var t=this.auth||"";t&&(t=(t=encodeURIComponent(t)).replace(/%3A/i,":"),t+="@");var e=this.protocol||"",r=this.pathname||"",i=this.hash||"",n=!1,s="";this.host?n=t+this.host:this.hostname&&(n=t+(-1===this.hostname.indexOf(":")?this.hostname:"["+this.hostname+"]"),this.port&&(n+=":"+this.port)),this.query&&"object"==typeof this.query&&Object.keys(this.query).length&&(s=mO.stringify(this.query));var o=this.search||s&&"?"+s||"";return e&&":"!==e.substr(-1)&&(e+=":"),this.slashes||(!e||fO[e])&&!1!==n?(n="//"+(n||""),r&&"/"!==r.charAt(0)&&(r="/"+r)):n||(n=""),i&&"#"!==i.charAt(0)&&(i="#"+i),o&&"?"!==o.charAt(0)&&(o="?"+o),r=r.replace(/[?#]/g,(function(t){return encodeURIComponent(t)})),e+n+r+(o=o.replace("#","%23"))+i},rO.prototype.resolve=function(t){return this.resolveObject(gO(t,!1,!0)).format()},rO.prototype.resolveObject=function(t){if("string"==typeof t){var e=new rO;e.parse(t,!1,!0),t=e}for(var r=new rO,i=Object.keys(this),n=0;n<i.length;n++){var s=i[n];r[s]=this[s]}if(r.hash=t.hash,""===t.href)return r.href=r.format(),r;if(t.slashes&&!t.protocol){for(var o=Object.keys(t),a=0;a<o.length;a++){var h=o[a];"protocol"!==h&&(r[h]=t[h])}return fO[r.protocol]&&r.hostname&&!r.pathname&&(r.pathname="/",r.path=r.pathname),r.href=r.format(),r}if(t.protocol&&t.protocol!==r.protocol){if(!fO[t.protocol]){for(var l=Object.keys(t),c=0;c<l.length;c++){var u=l[c];r[u]=t[u]}return r.href=r.format(),r}if(r.protocol=t.protocol,t.host||pO[t.protocol])r.pathname=t.pathname;else{for(var d=(t.pathname||"").split("/");d.length&&!(t.host=d.shift()););t.host||(t.host=""),t.hostname||(t.hostname=""),""!==d[0]&&d.unshift(""),d.length<2&&d.unshift(""),r.pathname=d.join("/")}if(r.search=t.search,r.query=t.query,r.host=t.host||"",r.auth=t.auth,r.hostname=t.hostname||t.host,r.port=t.port,r.pathname||r.search){var p=r.pathname||"",f=r.search||"";r.path=p+f}return r.slashes=r.slashes||t.slashes,r.href=r.format(),r}var m=r.pathname&&"/"===r.pathname.charAt(0),g=t.host||t.pathname&&"/"===t.pathname.charAt(0),v=g||m||r.host&&t.pathname,y=v,b=r.pathname&&r.pathname.split("/")||[],_=(d=t.pathname&&t.pathname.split("/")||[],r.protocol&&!fO[r.protocol]);if(_&&(r.hostname="",r.port=null,r.host&&(""===b[0]?b[0]=r.host:b.unshift(r.host)),r.host="",t.protocol&&(t.hostname=null,t.port=null,t.host&&(""===d[0]?d[0]=t.host:d.unshift(t.host)),t.host=null),v=v&&(""===d[0]||""===b[0])),g)r.host=t.host||""===t.host?t.host:r.host,r.hostname=t.hostname||""===t.hostname?t.hostname:r.hostname,r.search=t.search,r.query=t.query,b=d;else if(d.length)b||(b=[]),b.pop(),b=b.concat(d),r.search=t.search,r.query=t.query;else if(null!=t.search){if(_)r.host=b.shift(),r.hostname=r.host,(E=!!(r.host&&r.host.indexOf("@")>0)&&r.host.split("@"))&&(r.auth=E.shift(),r.hostname=E.shift(),r.host=r.hostname);return r.search=t.search,r.query=t.query,null===r.pathname&&null===r.search||(r.path=(r.pathname?r.pathname:"")+(r.search?r.search:"")),r.href=r.format(),r}if(!b.length)return r.pathname=null,r.search?r.path="/"+r.search:r.path=null,r.href=r.format(),r;for(var x=b.slice(-1)[0],T=(r.host||t.host||b.length>1)&&("."===x||".."===x)||""===x,w=0,S=b.length;S>=0;S--)"."===(x=b[S])?b.splice(S,1):".."===x?(b.splice(S,1),w++):w&&(b.splice(S,1),w--);if(!v&&!y)for(;w--;w)b.unshift("..");!v||""===b[0]||b[0]&&"/"===b[0].charAt(0)||b.unshift(""),T&&"/"!==b.join("/").substr(-1)&&b.push("");var E,C=""===b[0]||b[0]&&"/"===b[0].charAt(0);_&&(r.hostname=C?"":b.length?b.shift():"",r.host=r.hostname,(E=!!(r.host&&r.host.indexOf("@")>0)&&r.host.split("@"))&&(r.auth=E.shift(),r.hostname=E.shift(),r.host=r.hostname));return(v=v||r.host&&b.length)&&!C&&b.unshift(""),b.length>0?r.pathname=b.join("/"):(r.pathname=null,r.path=null),null===r.pathname&&null===r.search||(r.path=(r.pathname?r.pathname:"")+(r.search?r.search:"")),r.auth=t.auth||r.auth,r.slashes=r.slashes||t.slashes,r.href=r.format(),r},rO.prototype.parseHost=function(){var t=this.host,e=nO.exec(t);e&&(":"!==(e=e[0])&&(this.port=e.substr(1)),t=t.substr(0,t.length-e.length)),t&&(this.hostname=t)};const vO={parse:gO,format:function(t){return"string"==typeof t&&(t=gO(t)),t instanceof rO?t.format():rO.prototype.format.call(t)},resolve:function(t,e){return gO(t,!1,!0).resolve(e)}};function yO(t){if("string"!=typeof t)throw new TypeError(`Path must be a string. Received ${JSON.stringify(t)}`)}function bO(t){return t.split("?")[0].split("#")[0]}const _O={toPosix:t=>function(t,e,r){return t.replace(new RegExp(e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),"g"),r)}(t,"\\","/"),isUrl(t){return/^https?:/.test(this.toPosix(t))},isDataUrl:t=>/^data:([a-z]+\/[a-z0-9-+.]+(;[a-z0-9-.!#$%*+.{}|~`]+=[a-z0-9-.!#$%*+.{}()_|~`]+)*)?(;base64)?,([a-z0-9!$&',()*+;=\-._~:@\/?%\s<>]*?)$/i.test(t),hasProtocol(t){return/^[^/:]+:\//.test(this.toPosix(t))},getProtocol(t){yO(t),t=this.toPosix(t);let e="";const r=/^file:\/\/\//.exec(t),i=/^[^/:]+:\/\//.exec(t),n=/^[^/:]+:\//.exec(t);if(r||i||n){const s=r?.[0]||i?.[0]||n?.[0];e=s,t=t.slice(s.length)}return e},toAbsolute(t,e,r){if(this.isDataUrl(t))return t;const i=bO(this.toPosix(e??PR.ADAPTER.getBaseUrl())),n=bO(this.toPosix(r??this.rootname(i)));if(yO(t),(t=this.toPosix(t)).startsWith("/"))return _O.join(n,t.slice(1));return this.isAbsolute(t)?t:this.join(i,t)},normalize(t){if(yO(t=this.toPosix(t)),0===t.length)return".";let e="";const r=t.startsWith("/");this.hasProtocol(t)&&(e=this.rootname(t),t=t.slice(e.length));const i=t.endsWith("/");return t=function(t,e){let r="",i=0,n=-1,s=0,o=-1;for(let a=0;a<=t.length;++a){if(a<t.length)o=t.charCodeAt(a);else{if(47===o)break;o=47}if(47===o){if(n===a-1||1===s);else if(n!==a-1&&2===s){if(r.length<2||2!==i||46!==r.charCodeAt(r.length-1)||46!==r.charCodeAt(r.length-2))if(r.length>2){const t=r.lastIndexOf("/");if(t!==r.length-1){-1===t?(r="",i=0):(r=r.slice(0,t),i=r.length-1-r.lastIndexOf("/")),n=a,s=0;continue}}else if(2===r.length||1===r.length){r="",i=0,n=a,s=0;continue}e&&(r.length>0?r+="/..":r="..",i=2)}else r.length>0?r+=`/${t.slice(n+1,a)}`:r=t.slice(n+1,a),i=a-n-1;n=a,s=0}else 46===o&&-1!==s?++s:s=-1}return r}(t,!1),t.length>0&&i&&(t+="/"),r?`/${t}`:e+t},isAbsolute(t){return yO(t),t=this.toPosix(t),!!this.hasProtocol(t)||t.startsWith("/")},join(...t){if(0===t.length)return".";let e;for(let r=0;r<t.length;++r){const i=t[r];if(yO(i),i.length>0)if(void 0===e)e=i;else{const n=t[r-1]??"";this.extname(n)?e+=`/../${i}`:e+=`/${i}`}}return void 0===e?".":this.normalize(e)},dirname(t){if(yO(t),0===t.length)return".";let e=(t=this.toPosix(t)).charCodeAt(0);const r=47===e;let i=-1,n=!0;const s=this.getProtocol(t),o=t;for(let r=(t=t.slice(s.length)).length-1;r>=1;--r)if(e=t.charCodeAt(r),47===e){if(!n){i=r;break}}else n=!1;return-1===i?r?"/":this.isUrl(o)?s+t:s:r&&1===i?"//":s+t.slice(0,i)},rootname(t){yO(t);let e="";if(e=(t=this.toPosix(t)).startsWith("/")?"/":this.getProtocol(t),this.isUrl(t)){const r=t.indexOf("/",e.length);e=-1!==r?t.slice(0,r):t,e.endsWith("/")||(e+="/")}return e},basename(t,e){yO(t),e&&yO(e),t=bO(this.toPosix(t));let r,i=0,n=-1,s=!0;if(void 0!==e&&e.length>0&&e.length<=t.length){if(e.length===t.length&&e===t)return"";let o=e.length-1,a=-1;for(r=t.length-1;r>=0;--r){const h=t.charCodeAt(r);if(47===h){if(!s){i=r+1;break}}else-1===a&&(s=!1,a=r+1),o>=0&&(h===e.charCodeAt(o)?-1==--o&&(n=r):(o=-1,n=a))}return i===n?n=a:-1===n&&(n=t.length),t.slice(i,n)}for(r=t.length-1;r>=0;--r)if(47===t.charCodeAt(r)){if(!s){i=r+1;break}}else-1===n&&(s=!1,n=r+1);return-1===n?"":t.slice(i,n)},extname(t){yO(t);let e=-1,r=0,i=-1,n=!0,s=0;for(let o=(t=bO(this.toPosix(t))).length-1;o>=0;--o){const a=t.charCodeAt(o);if(47!==a)-1===i&&(n=!1,i=o+1),46===a?-1===e?e=o:1!==s&&(s=1):-1!==e&&(s=-1);else if(!n){r=o+1;break}}return-1===e||-1===i||0===s||1===s&&e===i-1&&e===r+1?"":t.slice(e,i)},parse(t){yO(t);const e={root:"",dir:"",base:"",ext:"",name:""};if(0===t.length)return e;let r=(t=bO(this.toPosix(t))).charCodeAt(0);const i=this.isAbsolute(t);let n;e.root=this.rootname(t),n=i||this.hasProtocol(t)?1:0;let s=-1,o=0,a=-1,h=!0,l=t.length-1,c=0;for(;l>=n;--l)if(r=t.charCodeAt(l),47!==r)-1===a&&(h=!1,a=l+1),46===r?-1===s?s=l:1!==c&&(c=1):-1!==s&&(c=-1);else if(!h){o=l+1;break}return-1===s||-1===a||0===c||1===c&&s===a-1&&s===o+1?-1!==a&&(e.base=e.name=0===o&&i?t.slice(1,a):t.slice(o,a)):(0===o&&i?(e.name=t.slice(1,s),e.base=t.slice(1,a)):(e.name=t.slice(o,s),e.base=t.slice(o,a)),e.ext=t.slice(s,a)),e.dir=this.dirname(t),e},sep:"/",delimiter:":"},xO={};function TO(t,e,r=3){if(xO[e])return;let i=(new Error).stack;void 0===i?console.warn("PixiJS Deprecation Warning: ",`${e}\nDeprecated since v${t}`):(i=i.split("\n").splice(r).join("\n"),console.groupCollapsed?(console.groupCollapsed("%cPixiJS Deprecation Warning: %c%s","color:#614108;background:#fffbe6","font-weight:normal;color:#614108;background:#fffbe6",`${e}\nDeprecated since v${t}`),console.warn(i),console.groupEnd()):(console.warn("PixiJS Deprecation Warning: ",`${e}\nDeprecated since v${t}`),console.warn(i))),xO[e]=!0}let wO;function SO(){return void 0===wO&&(wO=function(){const t={stencil:!0,failIfMajorPerformanceCaveat:PR.FAIL_IF_MAJOR_PERFORMANCE_CAVEAT};try{if(!PR.ADAPTER.getWebGLRenderingContext())return!1;const e=PR.ADAPTER.createCanvas();let r=e.getContext("webgl",t)||e.getContext("experimental-webgl",t);const i=!!r?.getContextAttributes()?.stencil;if(r){const t=r.getExtension("WEBGL_lose_context");t&&t.loseContext()}return r=null,i}catch(t){return!1}}()),wO}var EO={grad:.9,turn:360,rad:360/(2*Math.PI)},CO=function(t){return"string"==typeof t?t.length>0:"number"==typeof t},AO=function(t,e,r){return void 0===e&&(e=0),void 0===r&&(r=Math.pow(10,e)),Math.round(r*t)/r+0},RO=function(t,e,r){return void 0===e&&(e=0),void 0===r&&(r=1),t>r?r:t>e?t:e},PO=function(t){return(t=isFinite(t)?t%360:0)>0?t:t+360},IO=function(t){return{r:RO(t.r,0,255),g:RO(t.g,0,255),b:RO(t.b,0,255),a:RO(t.a)}},MO=function(t){return{r:AO(t.r),g:AO(t.g),b:AO(t.b),a:AO(t.a,3)}},OO=/^#([0-9a-f]{3,8})$/i,kO=function(t){var e=t.toString(16);return e.length<2?"0"+e:e},DO=function(t){var e=t.r,r=t.g,i=t.b,n=t.a,s=Math.max(e,r,i),o=s-Math.min(e,r,i),a=o?s===e?(r-i)/o:s===r?2+(i-e)/o:4+(e-r)/o:0;return{h:60*(a<0?a+6:a),s:s?o/s*100:0,v:s/255*100,a:n}},LO=function(t){var e=t.h,r=t.s,i=t.v,n=t.a;e=e/360*6,r/=100,i/=100;var s=Math.floor(e),o=i*(1-r),a=i*(1-(e-s)*r),h=i*(1-(1-e+s)*r),l=s%6;return{r:255*[i,a,o,o,h,i][l],g:255*[h,i,i,a,o,o][l],b:255*[o,o,h,i,i,a][l],a:n}},NO=function(t){return{h:PO(t.h),s:RO(t.s,0,100),l:RO(t.l,0,100),a:RO(t.a)}},FO=function(t){return{h:AO(t.h),s:AO(t.s),l:AO(t.l),a:AO(t.a,3)}},BO=function(t){return LO((r=(e=t).s,{h:e.h,s:(r*=((i=e.l)<50?i:100-i)/100)>0?2*r/(i+r)*100:0,v:i+r,a:e.a}));var e,r,i},UO=function(t){return{h:(e=DO(t)).h,s:(n=(200-(r=e.s))*(i=e.v)/100)>0&&n<200?r*i/100/(n<=100?n:200-n)*100:0,l:n/2,a:e.a};var e,r,i,n},GO=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,jO=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,VO=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,HO=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,WO={string:[[function(t){var e=OO.exec(t);return e?(t=e[1]).length<=4?{r:parseInt(t[0]+t[0],16),g:parseInt(t[1]+t[1],16),b:parseInt(t[2]+t[2],16),a:4===t.length?AO(parseInt(t[3]+t[3],16)/255,2):1}:6===t.length||8===t.length?{r:parseInt(t.substr(0,2),16),g:parseInt(t.substr(2,2),16),b:parseInt(t.substr(4,2),16),a:8===t.length?AO(parseInt(t.substr(6,2),16)/255,2):1}:null:null},"hex"],[function(t){var e=VO.exec(t)||HO.exec(t);return e?e[2]!==e[4]||e[4]!==e[6]?null:IO({r:Number(e[1])/(e[2]?100/255:1),g:Number(e[3])/(e[4]?100/255:1),b:Number(e[5])/(e[6]?100/255:1),a:void 0===e[7]?1:Number(e[7])/(e[8]?100:1)}):null},"rgb"],[function(t){var e=GO.exec(t)||jO.exec(t);if(!e)return null;var r,i,n=NO({h:(r=e[1],i=e[2],void 0===i&&(i="deg"),Number(r)*(EO[i]||1)),s:Number(e[3]),l:Number(e[4]),a:void 0===e[5]?1:Number(e[5])/(e[6]?100:1)});return BO(n)},"hsl"]],object:[[function(t){var e=t.r,r=t.g,i=t.b,n=t.a,s=void 0===n?1:n;return CO(e)&&CO(r)&&CO(i)?IO({r:Number(e),g:Number(r),b:Number(i),a:Number(s)}):null},"rgb"],[function(t){var e=t.h,r=t.s,i=t.l,n=t.a,s=void 0===n?1:n;if(!CO(e)||!CO(r)||!CO(i))return null;var o=NO({h:Number(e),s:Number(r),l:Number(i),a:Number(s)});return BO(o)},"hsl"],[function(t){var e=t.h,r=t.s,i=t.v,n=t.a,s=void 0===n?1:n;if(!CO(e)||!CO(r)||!CO(i))return null;var o=function(t){return{h:PO(t.h),s:RO(t.s,0,100),v:RO(t.v,0,100),a:RO(t.a)}}({h:Number(e),s:Number(r),v:Number(i),a:Number(s)});return LO(o)},"hsv"]]},XO=function(t,e){for(var r=0;r<e.length;r++){var i=e[r][0](t);if(i)return[i,e[r][1]]}return[null,void 0]},zO=function(t,e){var r=UO(t);return{h:r.h,s:RO(r.s+100*e,0,100),l:r.l,a:r.a}},YO=function(t){return(299*t.r+587*t.g+114*t.b)/1e3/255},ZO=function(t,e){var r=UO(t);return{h:r.h,s:r.s,l:RO(r.l+100*e,0,100),a:r.a}},$O=function(){function t(t){this.parsed=function(t){return"string"==typeof t?XO(t.trim(),WO.string):"object"==typeof t&&null!==t?XO(t,WO.object):[null,void 0]}(t)[0],this.rgba=this.parsed||{r:0,g:0,b:0,a:1}}return t.prototype.isValid=function(){return null!==this.parsed},t.prototype.brightness=function(){return AO(YO(this.rgba),2)},t.prototype.isDark=function(){return YO(this.rgba)<.5},t.prototype.isLight=function(){return YO(this.rgba)>=.5},t.prototype.toHex=function(){return e=(t=MO(this.rgba)).r,r=t.g,i=t.b,s=(n=t.a)<1?kO(AO(255*n)):"","#"+kO(e)+kO(r)+kO(i)+s;var t,e,r,i,n,s},t.prototype.toRgb=function(){return MO(this.rgba)},t.prototype.toRgbString=function(){return e=(t=MO(this.rgba)).r,r=t.g,i=t.b,(n=t.a)<1?"rgba("+e+", "+r+", "+i+", "+n+")":"rgb("+e+", "+r+", "+i+")";var t,e,r,i,n},t.prototype.toHsl=function(){return FO(UO(this.rgba))},t.prototype.toHslString=function(){return e=(t=FO(UO(this.rgba))).h,r=t.s,i=t.l,(n=t.a)<1?"hsla("+e+", "+r+"%, "+i+"%, "+n+")":"hsl("+e+", "+r+"%, "+i+"%)";var t,e,r,i,n},t.prototype.toHsv=function(){return t=DO(this.rgba),{h:AO(t.h),s:AO(t.s),v:AO(t.v),a:AO(t.a,3)};var t},t.prototype.invert=function(){return KO({r:255-(t=this.rgba).r,g:255-t.g,b:255-t.b,a:t.a});var t},t.prototype.saturate=function(t){return void 0===t&&(t=.1),KO(zO(this.rgba,t))},t.prototype.desaturate=function(t){return void 0===t&&(t=.1),KO(zO(this.rgba,-t))},t.prototype.grayscale=function(){return KO(zO(this.rgba,-1))},t.prototype.lighten=function(t){return void 0===t&&(t=.1),KO(ZO(this.rgba,t))},t.prototype.darken=function(t){return void 0===t&&(t=.1),KO(ZO(this.rgba,-t))},t.prototype.rotate=function(t){return void 0===t&&(t=15),this.hue(this.hue()+t)},t.prototype.alpha=function(t){return"number"==typeof t?KO({r:(e=this.rgba).r,g:e.g,b:e.b,a:t}):AO(this.rgba.a,3);var e},t.prototype.hue=function(t){var e=UO(this.rgba);return"number"==typeof t?KO({h:t,s:e.s,l:e.l,a:e.a}):AO(e.h)},t.prototype.isEqual=function(t){return this.toHex()===KO(t).toHex()},t}(),KO=function(t){return t instanceof $O?t:new $O(t)},JO=[];!function(t){t.forEach((function(t){JO.indexOf(t)<0&&(t($O,WO),JO.push(t))}))}([function(t,e){var r={white:"#ffffff",bisque:"#ffe4c4",blue:"#0000ff",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",antiquewhite:"#faebd7",aqua:"#00ffff",azure:"#f0ffff",whitesmoke:"#f5f5f5",papayawhip:"#ffefd5",plum:"#dda0dd",blanchedalmond:"#ffebcd",black:"#000000",gold:"#ffd700",goldenrod:"#daa520",gainsboro:"#dcdcdc",cornsilk:"#fff8dc",cornflowerblue:"#6495ed",burlywood:"#deb887",aquamarine:"#7fffd4",beige:"#f5f5dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkkhaki:"#bdb76b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",peachpuff:"#ffdab9",darkmagenta:"#8b008b",darkred:"#8b0000",darkorchid:"#9932cc",darkorange:"#ff8c00",darkslateblue:"#483d8b",gray:"#808080",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",deeppink:"#ff1493",deepskyblue:"#00bfff",wheat:"#f5deb3",firebrick:"#b22222",floralwhite:"#fffaf0",ghostwhite:"#f8f8ff",darkviolet:"#9400d3",magenta:"#ff00ff",green:"#008000",dodgerblue:"#1e90ff",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",blueviolet:"#8a2be2",forestgreen:"#228b22",lawngreen:"#7cfc00",indianred:"#cd5c5c",indigo:"#4b0082",fuchsia:"#ff00ff",brown:"#a52a2a",maroon:"#800000",mediumblue:"#0000cd",lightcoral:"#f08080",darkturquoise:"#00ced1",lightcyan:"#e0ffff",ivory:"#fffff0",lightyellow:"#ffffe0",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",linen:"#faf0e6",mediumaquamarine:"#66cdaa",lemonchiffon:"#fffacd",lime:"#00ff00",khaki:"#f0e68c",mediumseagreen:"#3cb371",limegreen:"#32cd32",mediumspringgreen:"#00fa9a",lightskyblue:"#87cefa",lightblue:"#add8e6",midnightblue:"#191970",lightpink:"#ffb6c1",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",mintcream:"#f5fffa",lightslategray:"#778899",lightslategrey:"#778899",navajowhite:"#ffdead",navy:"#000080",mediumvioletred:"#c71585",powderblue:"#b0e0e6",palegoldenrod:"#eee8aa",oldlace:"#fdf5e6",paleturquoise:"#afeeee",mediumturquoise:"#48d1cc",mediumorchid:"#ba55d3",rebeccapurple:"#663399",lightsteelblue:"#b0c4de",mediumslateblue:"#7b68ee",thistle:"#d8bfd8",tan:"#d2b48c",orchid:"#da70d6",mediumpurple:"#9370db",purple:"#800080",pink:"#ffc0cb",skyblue:"#87ceeb",springgreen:"#00ff7f",palegreen:"#98fb98",red:"#ff0000",yellow:"#ffff00",slateblue:"#6a5acd",lavenderblush:"#fff0f5",peru:"#cd853f",palevioletred:"#db7093",violet:"#ee82ee",teal:"#008080",slategray:"#708090",slategrey:"#708090",aliceblue:"#f0f8ff",darkseagreen:"#8fbc8f",darkolivegreen:"#556b2f",greenyellow:"#adff2f",seagreen:"#2e8b57",seashell:"#fff5ee",tomato:"#ff6347",silver:"#c0c0c0",sienna:"#a0522d",lavender:"#e6e6fa",lightgreen:"#90ee90",orange:"#ffa500",orangered:"#ff4500",steelblue:"#4682b4",royalblue:"#4169e1",turquoise:"#40e0d0",yellowgreen:"#9acd32",salmon:"#fa8072",saddlebrown:"#8b4513",sandybrown:"#f4a460",rosybrown:"#bc8f8f",darksalmon:"#e9967a",lightgoldenrodyellow:"#fafad2",snow:"#fffafa",lightgrey:"#d3d3d3",lightgray:"#d3d3d3",dimgray:"#696969",dimgrey:"#696969",olivedrab:"#6b8e23",olive:"#808000"},i={};for(var n in r)i[r[n]]=n;var s={};t.prototype.toName=function(e){if(!(this.rgba.a||this.rgba.r||this.rgba.g||this.rgba.b))return"transparent";var n,o,a=i[this.toHex()];if(a)return a;if(null==e?void 0:e.closest){var h=this.toRgb(),l=1/0,c="black";if(!s.length)for(var u in r)s[u]=new t(r[u]).toRgb();for(var d in r){var p=(n=h,o=s[d],Math.pow(n.r-o.r,2)+Math.pow(n.g-o.g,2)+Math.pow(n.b-o.b,2));p<l&&(l=p,c=d)}return c}},e.string.push([function(e){var i=e.toLowerCase(),n="transparent"===i?"#0000":r[i];return n?new t(n).toRgb():null},"name"])}]);const qO=class{constructor(t=16777215){this._value=null,this._components=new Float32Array(4),this._components.fill(1),this._int=16777215,this.value=t}get red(){return this._components[0]}get green(){return this._components[1]}get blue(){return this._components[2]}get alpha(){return this._components[3]}setValue(t){return this.value=t,this}set value(t){if(t instanceof qO)this._value=this.cloneSource(t._value),this._int=t._int,this._components.set(t._components);else{if(null===t)throw new Error("Cannot set PIXI.Color#value to null");null!==this._value&&this.isSourceEqual(this._value,t)||(this.normalize(t),this._value=this.cloneSource(t))}}get value(){return this._value}cloneSource(t){return"string"==typeof t||"number"==typeof t||t instanceof Number||null===t?t:Array.isArray(t)||ArrayBuffer.isView(t)?t.slice(0):"object"==typeof t&&null!==t?{...t}:t}isSourceEqual(t,e){const r=typeof t;if(r!==typeof e)return!1;if("number"===r||"string"===r||t instanceof Number)return t===e;if(Array.isArray(t)&&Array.isArray(e)||ArrayBuffer.isView(t)&&ArrayBuffer.isView(e))return t.length===e.length&&t.every(((t,r)=>t===e[r]));if(null!==t&&null!==e){const r=Object.keys(t),i=Object.keys(e);return r.length===i.length&&r.every((r=>t[r]===e[r]))}return t===e}toRgba(){const[t,e,r,i]=this._components;return{r:t,g:e,b:r,a:i}}toRgb(){const[t,e,r]=this._components;return{r:t,g:e,b:r}}toRgbaString(){const[t,e,r]=this.toUint8RgbArray();return`rgba(${t},${e},${r},${this.alpha})`}toUint8RgbArray(t){const[e,r,i]=this._components;return(t=t??[])[0]=Math.round(255*e),t[1]=Math.round(255*r),t[2]=Math.round(255*i),t}toRgbArray(t){t=t??[];const[e,r,i]=this._components;return t[0]=e,t[1]=r,t[2]=i,t}toNumber(){return this._int}toLittleEndianNumber(){const t=this._int;return(t>>16)+(65280&t)+((255&t)<<16)}multiply(t){const[e,r,i,n]=qO.temp.setValue(t)._components;return this._components[0]*=e,this._components[1]*=r,this._components[2]*=i,this._components[3]*=n,this.refreshInt(),this._value=null,this}premultiply(t,e=!0){return e&&(this._components[0]*=t,this._components[1]*=t,this._components[2]*=t),this._components[3]=t,this.refreshInt(),this._value=null,this}toPremultiplied(t,e=!0){if(1===t)return(255<<24)+this._int;if(0===t)return e?0:this._int;let r=this._int>>16&255,i=this._int>>8&255,n=255&this._int;return e&&(r=r*t+.5|0,i=i*t+.5|0,n=n*t+.5|0),(255*t<<24)+(r<<16)+(i<<8)+n}toHex(){const t=this._int.toString(16);return`#${"000000".substring(0,6-t.length)+t}`}toHexa(){const t=Math.round(255*this._components[3]).toString(16);return this.toHex()+"00".substring(0,2-t.length)+t}setAlpha(t){return this._components[3]=this._clamp(t),this}round(t){const[e,r,i]=this._components;return this._components[0]=Math.round(e*t)/t,this._components[1]=Math.round(r*t)/t,this._components[2]=Math.round(i*t)/t,this.refreshInt(),this._value=null,this}toArray(t){t=t??[];const[e,r,i,n]=this._components;return t[0]=e,t[1]=r,t[2]=i,t[3]=n,t}normalize(t){let e,r,i,n;if(("number"==typeof t||t instanceof Number)&&t>=0&&t<=16777215){e=(t>>16&255)/255,r=(t>>8&255)/255,i=(255&t)/255,n=1}else if((Array.isArray(t)||t instanceof Float32Array)&&t.length>=3&&t.length<=4)t=this._clamp(t),[e,r,i,n=1]=t;else if((t instanceof Uint8Array||t instanceof Uint8ClampedArray)&&t.length>=3&&t.length<=4)t=this._clamp(t,0,255),[e,r,i,n=255]=t,e/=255,r/=255,i/=255,n/=255;else if("string"==typeof t||"object"==typeof t){if("string"==typeof t){const e=qO.HEX_PATTERN.exec(t);e&&(t=`#${e[2]}`)}const s=KO(t);s.isValid()&&(({r:e,g:r,b:i,a:n}=s.rgba),e/=255,r/=255,i/=255)}if(void 0===e)throw new Error(`Unable to convert color ${t}`);this._components[0]=e,this._components[1]=r,this._components[2]=i,this._components[3]=n,this.refreshInt()}refreshInt(){this._clamp(this._components);const[t,e,r]=this._components;this._int=(255*t<<16)+(255*e<<8)+(255*r|0)}_clamp(t,e=0,r=1){return"number"==typeof t?Math.min(Math.max(t,e),r):(t.forEach(((i,n)=>{t[n]=Math.min(Math.max(i,e),r)})),t)}};let QO=qO;function tk(t){return TO("7.2.0","utils.hex2string is deprecated, use Color#toHex instead"),QO.shared.setValue(t).toHex()}function ek(t){return TO("7.2.0","utils.string2hex is deprecated, use Color#toNumber instead"),QO.shared.setValue(t).toNumber()}function rk(t){return TO("7.2.0","utils.rgb2hex is deprecated, use Color#toNumber instead"),QO.shared.setValue(t).toNumber()}QO.shared=new qO,QO.temp=new qO,QO.HEX_PATTERN=/^(#|0x)?(([a-f0-9]{3}){1,2}([a-f0-9]{2})?)$/i;const ik=function(){const t=[],e=[];for(let r=0;r<32;r++)t[r]=r,e[r]=r;t[dR.NORMAL_NPM]=dR.NORMAL,t[dR.ADD_NPM]=dR.ADD,t[dR.SCREEN_NPM]=dR.SCREEN,e[dR.NORMAL]=dR.NORMAL_NPM,e[dR.ADD]=dR.ADD_NPM,e[dR.SCREEN]=dR.SCREEN_NPM;const r=[];return r.push(e),r.push(t),r}();function nk(t,e){return ik[e?1:0][t]}const sk=/^\s*data:(?:([\w-]+)\/([\w+.-]+))?(?:;charset=([\w-]+))?(?:;(base64))?,(.*)/i;function ok(t,e=null){const r=6*t;if((e=e||new Uint16Array(r)).length!==r)throw new Error(`Out buffer length is incorrect, got ${e.length} and expected ${r}`);for(let t=0,i=0;t<r;t+=6,i+=4)e[t+0]=i+0,e[t+1]=i+1,e[t+2]=i+2,e[t+3]=i+0,e[t+4]=i+2,e[t+5]=i+3;return e}function ak(t){if(4===t.BYTES_PER_ELEMENT)return t instanceof Float32Array?"Float32Array":t instanceof Uint32Array?"Uint32Array":"Int32Array";if(2===t.BYTES_PER_ELEMENT){if(t instanceof Uint16Array)return"Uint16Array"}else if(1===t.BYTES_PER_ELEMENT&&t instanceof Uint8Array)return"Uint8Array";return null}const hk={Float32Array:Float32Array,Uint32Array:Uint32Array,Int32Array:Int32Array,Uint8Array:Uint8Array};function lk(t){return t+=0===t?1:0,--t,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,(t|=t>>>16)+1}function ck(t){return!(t&t-1||!t)}function uk(t){let e=(t>65535?1:0)<<4,r=((t>>>=e)>255?1:0)<<3;return e|=r,r=((t>>>=r)>15?1:0)<<2,e|=r,r=((t>>>=r)>3?1:0)<<1,e|=r,e|(t>>>=r)>>1}function dk(t,e,r){const i=t.length;let n;if(e>=i||0===r)return;const s=i-(r=e+r>i?i-e:r);for(n=e;n<s;++n)t[n]=t[n+r];t.length=s}function pk(t){return 0===t?0:t<0?-1:1}let fk=0;function mk(){return++fk}const gk=class{constructor(t,e,r,i){this.left=t,this.top=e,this.right=r,this.bottom=i}get width(){return this.right-this.left}get height(){return this.bottom-this.top}isEmpty(){return this.left===this.right||this.top===this.bottom}};let vk=gk;vk.EMPTY=new gk(0,0,0,0);const yk={},bk=Object.create(null),_k=Object.create(null);class xk{constructor(t,e,r){this._canvas=PR.ADAPTER.createCanvas(),this._context=this._canvas.getContext("2d"),this.resolution=r||PR.RESOLUTION,this.resize(t,e)}clear(){this._checkDestroyed(),this._context.setTransform(1,0,0,1,0,0),this._context.clearRect(0,0,this._canvas.width,this._canvas.height)}resize(t,e){this._checkDestroyed(),this._canvas.width=Math.round(t*this.resolution),this._canvas.height=Math.round(e*this.resolution)}destroy(){this._context=null,this._canvas=null}get width(){return this._checkDestroyed(),this._canvas.width}set width(t){this._checkDestroyed(),this._canvas.width=Math.round(t)}get height(){return this._checkDestroyed(),this._canvas.height}set height(t){this._checkDestroyed(),this._canvas.height=Math.round(t)}get canvas(){return this._checkDestroyed(),this._canvas}get context(){return this._checkDestroyed(),this._context}_checkDestroyed(){if(null===this._canvas)throw new TypeError("The CanvasRenderTarget has already been destroyed")}}function Tk(t,e,r){for(let i=0,n=4*r*e;i<e;++i,n+=4)if(0!==t[n+3])return!1;return!0}function wk(t,e,r,i,n){const s=4*e;for(let e=i,o=i*s+4*r;e<=n;++e,o+=s)if(0!==t[o+3])return!1;return!0}function Sk(t){const{width:e,height:r}=t,i=t.getContext("2d",{willReadFrequently:!0});if(null===i)throw new TypeError("Failed to get canvas 2D context");const n=i.getImageData(0,0,e,r).data;let s=0,o=0,a=e-1,h=r-1;for(;o<r&&Tk(n,e,o);)++o;if(o===r)return vk.EMPTY;for(;Tk(n,e,h);)--h;for(;wk(n,e,s,o,h);)++s;for(;wk(n,e,a,o,h);)--a;return++a,++h,new vk(s,o,a,h)}function Ek(t){const e=Sk(t),{width:r,height:i}=e;let n=null;if(!e.isEmpty()){const s=t.getContext("2d");if(null===s)throw new TypeError("Failed to get canvas 2D context");n=s.getImageData(e.left,e.top,r,i)}return{width:r,height:i,data:n}}let Ck;function Ak(t,e=globalThis.location){if(t.startsWith("data:"))return"";e=e||globalThis.location,Ck||(Ck=document.createElement("a")),Ck.href=t;const r=vO.parse(Ck.href),i=!r.port&&""===e.port||r.port===e.port;return r.hostname===e.hostname&&i&&r.protocol===e.protocol?"":"anonymous"}function Rk(t,e=1){const r=PR.RETINA_PREFIX?.exec(t);return r?parseFloat(r[1]):e}var Pk=Object.freeze({__proto__:null,isMobile:YR,EventEmitter:$R,earcut:wP,url:vO,path:_O,sayHello:function(){TO("7.0.0",'sayHello is deprecated, please use Renderer\'s "hello" option')},skipHello:function(){TO("7.0.0","skipHello is deprecated, please use settings.RENDER_OPTIONS.hello")},isWebGLSupported:SO,hex2rgb:function(t,e=[]){return TO("7.2.0","utils.hex2rgb is deprecated, use Color#toRgbArray instead"),QO.shared.setValue(t).toRgbArray(e)},hex2string:tk,rgb2hex:rk,string2hex:ek,correctBlendMode:nk,premultiplyBlendMode:ik,premultiplyRgba:function(t,e,r,i=!0){return TO("7.2.0","utils.premultiplyRgba has moved to Color.premultiply"),QO.shared.setValue(t).premultiply(e,i).toArray(r??new Float32Array(4))},premultiplyTint:function(t,e){return TO("7.2.0","utils.premultiplyTint has moved to Color.toPremultiplied"),QO.shared.setValue(t).toPremultiplied(e)},premultiplyTintToRgba:function(t,e,r,i=!0){return TO("7.2.0","utils.premultiplyTintToRgba has moved to Color.premultiply"),QO.shared.setValue(t).premultiply(e,i).toArray(r??new Float32Array(4))},DATA_URI:sk,createIndicesForQuads:ok,getBufferType:ak,interleaveTypedArrays:function(t,e){let r=0,i=0;const n={};for(let n=0;n<t.length;n++)i+=e[n],r+=t[n].length;const s=new ArrayBuffer(4*r);let o=null,a=0;for(let r=0;r<t.length;r++){const h=e[r],l=t[r],c=ak(l);n[c]||(n[c]=new hk[c](s)),o=n[c];for(let t=0;t<l.length;t++){o[(t/h|0)*i+a+t%h]=l[t]}a+=h}return new Float32Array(s)},isPow2:ck,log2:uk,nextPow2:lk,removeItems:dk,sign:pk,uid:mk,deprecation:TO,BoundingBox:vk,BaseTextureCache:_k,ProgramCache:yk,TextureCache:bk,clearTextureCache:function(){let t;for(t in bk)delete bk[t];for(t in _k)delete _k[t]},destroyTextureCache:function(){let t;for(t in bk)bk[t].destroy();for(t in _k)_k[t].destroy()},CanvasRenderTarget:xk,getCanvasBoundingBox:Sk,trimCanvas:Ek,decomposeDataUri:function(t){const e=sk.exec(t);if(e)return{mediaType:e[1]?e[1].toLowerCase():void 0,subType:e[2]?e[2].toLowerCase():void 0,charset:e[3]?e[3].toLowerCase():void 0,encoding:e[4]?e[4].toLowerCase():void 0,data:e[5]}},determineCrossOrigin:Ak,getResolutionOfUrl:Rk}),Ik=(t=>(t.Renderer="renderer",t.Application="application",t.RendererSystem="renderer-webgl-system",t.RendererPlugin="renderer-webgl-plugin",t.CanvasRendererSystem="renderer-canvas-system",t.CanvasRendererPlugin="renderer-canvas-plugin",t.Asset="asset",t.LoadParser="load-parser",t.ResolveParser="resolve-parser",t.CacheParser="cache-parser",t.DetectionParser="detection-parser",t))(Ik||{});const Mk=t=>{if("function"==typeof t||"object"==typeof t&&t.extension){if(!t.extension)throw new Error("Extension class must have an extension object");t={..."object"!=typeof t.extension?{type:t.extension}:t.extension,ref:t}}if("object"!=typeof t)throw new Error("Invalid extension type");return"string"==typeof(t={...t}).type&&(t.type=[t.type]),t},Ok=(t,e)=>Mk(t).priority??e,kk={_addHandlers:{},_removeHandlers:{},_queue:{},remove(...t){return t.map(Mk).forEach((t=>{t.type.forEach((e=>this._removeHandlers[e]?.(t)))})),this},add(...t){return t.map(Mk).forEach((t=>{t.type.forEach((e=>{const r=this._addHandlers,i=this._queue;r[e]?r[e](t):(i[e]=i[e]||[],i[e].push(t))}))})),this},handle(t,e,r){const i=this._addHandlers,n=this._removeHandlers;if(i[t]||n[t])throw new Error(`Extension type ${t} already has a handler`);i[t]=e,n[t]=r;const s=this._queue;return s[t]&&(s[t].forEach((t=>e(t))),delete s[t]),this},handleByMap(t,e){return this.handle(t,(t=>{e[t.name]=t.ref}),(t=>{delete e[t.name]}))},handleByList(t,e,r=-1){return this.handle(t,(t=>{e.includes(t.ref)||(e.push(t.ref),e.sort(((t,e)=>Ok(e,r)-Ok(t,r))))}),(t=>{const r=e.indexOf(t.ref);-1!==r&&e.splice(r,1)}))}};class Dk{constructor(t){"number"==typeof t?this.rawBinaryData=new ArrayBuffer(t):t instanceof Uint8Array?this.rawBinaryData=t.buffer:this.rawBinaryData=t,this.uint32View=new Uint32Array(this.rawBinaryData),this.float32View=new Float32Array(this.rawBinaryData)}get int8View(){return this._int8View||(this._int8View=new Int8Array(this.rawBinaryData)),this._int8View}get uint8View(){return this._uint8View||(this._uint8View=new Uint8Array(this.rawBinaryData)),this._uint8View}get int16View(){return this._int16View||(this._int16View=new Int16Array(this.rawBinaryData)),this._int16View}get uint16View(){return this._uint16View||(this._uint16View=new Uint16Array(this.rawBinaryData)),this._uint16View}get int32View(){return this._int32View||(this._int32View=new Int32Array(this.rawBinaryData)),this._int32View}view(t){return this[`${t}View`]}destroy(){this.rawBinaryData=null,this._int8View=null,this._uint8View=null,this._int16View=null,this._uint16View=null,this._int32View=null,this.uint32View=null,this.float32View=null}static sizeOf(t){switch(t){case"int8":case"uint8":return 1;case"int16":case"uint16":return 2;case"int32":case"uint32":case"float32":return 4;default:throw new Error(`${t} isn't a valid view type`)}}}const Lk=["precision mediump float;","void main(void){","float test = 0.1;","%forloop%","gl_FragColor = vec4(0.0);","}"].join("\n");function Nk(t){let e="";for(let r=0;r<t;++r)r>0&&(e+="\nelse "),r<t-1&&(e+=`if(test == ${r}.0){}`);return e}class Fk{constructor(){this.data=0,this.blendMode=dR.NORMAL,this.polygonOffset=0,this.blend=!0,this.depthMask=!0}get blend(){return!!(1&this.data)}set blend(t){!!(1&this.data)!==t&&(this.data^=1)}get offsets(){return!!(2&this.data)}set offsets(t){!!(2&this.data)!==t&&(this.data^=2)}get culling(){return!!(4&this.data)}set culling(t){!!(4&this.data)!==t&&(this.data^=4)}get depthTest(){return!!(8&this.data)}set depthTest(t){!!(8&this.data)!==t&&(this.data^=8)}get depthMask(){return!!(32&this.data)}set depthMask(t){!!(32&this.data)!==t&&(this.data^=32)}get clockwiseFrontFace(){return!!(16&this.data)}set clockwiseFrontFace(t){!!(16&this.data)!==t&&(this.data^=16)}get blendMode(){return this._blendMode}set blendMode(t){this.blend=t!==dR.NONE,this._blendMode=t}get polygonOffset(){return this._polygonOffset}set polygonOffset(t){this.offsets=!!t,this._polygonOffset=t}toString(){return`[@pixi/core:State blendMode=${this.blendMode} clockwiseFrontFace=${this.clockwiseFrontFace} culling=${this.culling} depthMask=${this.depthMask} polygonOffset=${this.polygonOffset}]`}static for2d(){const t=new Fk;return t.depthTest=!1,t.blend=!0,t}}const Bk=[];function Uk(t,e){if(!t)return null;let r="";if("string"==typeof t){const e=/\.(\w{3,4})(?:$|\?|#)/i.exec(t);e&&(r=e[1].toLowerCase())}for(let i=Bk.length-1;i>=0;--i){const n=Bk[i];if(n.test&&n.test(t,r))return new n(t,e)}throw new Error("Unrecognized source type to auto-detect Resource")}class Gk{constructor(t){this.items=[],this._name=t,this._aliasCount=0}emit(t,e,r,i,n,s,o,a){if(arguments.length>8)throw new Error("max arguments reached");const{name:h,items:l}=this;this._aliasCount++;for(let c=0,u=l.length;c<u;c++)l[c][h](t,e,r,i,n,s,o,a);return l===this.items&&this._aliasCount--,this}ensureNonAliasedItems(){this._aliasCount>0&&this.items.length>1&&(this._aliasCount=0,this.items=this.items.slice(0))}add(t){return t[this._name]&&(this.ensureNonAliasedItems(),this.remove(t),this.items.push(t)),this}remove(t){const e=this.items.indexOf(t);return-1!==e&&(this.ensureNonAliasedItems(),this.items.splice(e,1)),this}contains(t){return this.items.includes(t)}removeAll(){return this.ensureNonAliasedItems(),this.items.length=0,this}destroy(){this.removeAll(),this.items=null,this._name=null}get empty(){return 0===this.items.length}get name(){return this._name}}Object.defineProperties(Gk.prototype,{dispatch:{value:Gk.prototype.emit},run:{value:Gk.prototype.emit}});class jk{constructor(t=0,e=0){this._width=t,this._height=e,this.destroyed=!1,this.internal=!1,this.onResize=new Gk("setRealSize"),this.onUpdate=new Gk("update"),this.onError=new Gk("onError")}bind(t){this.onResize.add(t),this.onUpdate.add(t),this.onError.add(t),(this._width||this._height)&&this.onResize.emit(this._width,this._height)}unbind(t){this.onResize.remove(t),this.onUpdate.remove(t),this.onError.remove(t)}resize(t,e){t===this._width&&e===this._height||(this._width=t,this._height=e,this.onResize.emit(t,e))}get valid(){return!!this._width&&!!this._height}update(){this.destroyed||this.onUpdate.emit()}load(){return Promise.resolve(this)}get width(){return this._width}get height(){return this._height}style(t,e,r){return!1}dispose(){}destroy(){this.destroyed||(this.destroyed=!0,this.dispose(),this.onError.removeAll(),this.onError=null,this.onResize.removeAll(),this.onResize=null,this.onUpdate.removeAll(),this.onUpdate=null)}static test(t,e){return!1}}class Vk extends jk{constructor(t,e){const{width:r,height:i}=e||{};if(!r||!i)throw new Error("BufferResource width or height invalid");super(r,i),this.data=t}upload(t,e,r){const i=t.gl;i.pixelStorei(i.UNPACK_PREMULTIPLY_ALPHA_WEBGL,e.alphaMode===xR.UNPACK);const n=e.realWidth,s=e.realHeight;return r.width===n&&r.height===s?i.texSubImage2D(e.target,0,0,0,n,s,e.format,r.type,this.data):(r.width=n,r.height=s,i.texImage2D(e.target,0,r.internalFormat,n,s,0,e.format,r.type,this.data)),!0}dispose(){this.data=null}static test(t){return t instanceof Float32Array||t instanceof Uint8Array||t instanceof Uint32Array}}const Hk={scaleMode:yR.NEAREST,format:fR.RGBA,alphaMode:xR.NPM},Wk=class extends $R{constructor(t=null,e=null){super(),e=Object.assign({},Wk.defaultOptions,e);const{alphaMode:r,mipmap:i,anisotropicLevel:n,scaleMode:s,width:o,height:a,wrapMode:h,format:l,type:c,target:u,resolution:d,resourceOptions:p}=e;!t||t instanceof jk||((t=Uk(t,p)).internal=!0),this.resolution=d||PR.RESOLUTION,this.width=Math.round((o||0)*this.resolution)/this.resolution,this.height=Math.round((a||0)*this.resolution)/this.resolution,this._mipmap=i,this.anisotropicLevel=n,this._wrapMode=h,this._scaleMode=s,this.format=l,this.type=c,this.target=u,this.alphaMode=r,this.uid=mk(),this.touched=0,this.isPowerOfTwo=!1,this._refreshPOT(),this._glTextures={},this.dirtyId=0,this.dirtyStyleId=0,this.cacheId=null,this.valid=o>0&&a>0,this.textureCacheIds=[],this.destroyed=!1,this.resource=null,this._batchEnabled=0,this._batchLocation=0,this.parentTextureArray=null,this.setResource(t)}get realWidth(){return Math.round(this.width*this.resolution)}get realHeight(){return Math.round(this.height*this.resolution)}get mipmap(){return this._mipmap}set mipmap(t){this._mipmap!==t&&(this._mipmap=t,this.dirtyStyleId++)}get scaleMode(){return this._scaleMode}set scaleMode(t){this._scaleMode!==t&&(this._scaleMode=t,this.dirtyStyleId++)}get wrapMode(){return this._wrapMode}set wrapMode(t){this._wrapMode!==t&&(this._wrapMode=t,this.dirtyStyleId++)}setStyle(t,e){let r;return void 0!==t&&t!==this.scaleMode&&(this.scaleMode=t,r=!0),void 0!==e&&e!==this.mipmap&&(this.mipmap=e,r=!0),r&&this.dirtyStyleId++,this}setSize(t,e,r){return r=r||this.resolution,this.setRealSize(t*r,e*r,r)}setRealSize(t,e,r){return this.resolution=r||this.resolution,this.width=Math.round(t)/this.resolution,this.height=Math.round(e)/this.resolution,this._refreshPOT(),this.update(),this}_refreshPOT(){this.isPowerOfTwo=ck(this.realWidth)&&ck(this.realHeight)}setResolution(t){const e=this.resolution;return e===t||(this.resolution=t,this.valid&&(this.width=Math.round(this.width*e)/t,this.height=Math.round(this.height*e)/t,this.emit("update",this)),this._refreshPOT()),this}setResource(t){if(this.resource===t)return this;if(this.resource)throw new Error("Resource can be set only once");return t.bind(this),this.resource=t,this}update(){this.valid?(this.dirtyId++,this.dirtyStyleId++,this.emit("update",this)):this.width>0&&this.height>0&&(this.valid=!0,this.emit("loaded",this),this.emit("update",this))}onError(t){this.emit("error",this,t)}destroy(){this.resource&&(this.resource.unbind(this),this.resource.internal&&this.resource.destroy(),this.resource=null),this.cacheId&&(delete _k[this.cacheId],delete bk[this.cacheId],this.cacheId=null),this.dispose(),Wk.removeFromCache(this),this.textureCacheIds=null,this.destroyed=!0}dispose(){this.emit("dispose",this)}castToBaseTexture(){return this}static from(t,e,r=PR.STRICT_TEXTURE_CACHE){const i="string"==typeof t;let n=null;if(i)n=t;else{if(!t._pixiId){const r=e?.pixiIdPrefix||"pixiid";t._pixiId=`${r}_${mk()}`}n=t._pixiId}let s=_k[n];if(i&&r&&!s)throw new Error(`The cacheId "${n}" does not exist in BaseTextureCache.`);return s||(s=new Wk(t,e),s.cacheId=n,Wk.addToCache(s,n)),s}static fromBuffer(t,e,r,i){t=t||new Float32Array(e*r*4);const n=new Vk(t,{width:e,height:r}),s=t instanceof Float32Array?gR.FLOAT:gR.UNSIGNED_BYTE;return new Wk(n,Object.assign({},Hk,{type:s},i))}static addToCache(t,e){e&&(t.textureCacheIds.includes(e)||t.textureCacheIds.push(e),_k[e]&&_k[e]!==t&&console.warn(`BaseTexture added to the cache with an id [${e}] that already had an entry`),_k[e]=t)}static removeFromCache(t){if("string"==typeof t){const e=_k[t];if(e){const r=e.textureCacheIds.indexOf(t);return r>-1&&e.textureCacheIds.splice(r,1),delete _k[t],e}}else if(t?.textureCacheIds){for(let e=0;e<t.textureCacheIds.length;++e)delete _k[t.textureCacheIds[e]];return t.textureCacheIds.length=0,t}return null}};let Xk=Wk;Xk.defaultOptions={mipmap:_R.POW2,anisotropicLevel:0,scaleMode:yR.LINEAR,wrapMode:bR.CLAMP,alphaMode:xR.UNPACK,target:mR.TEXTURE_2D,format:fR.RGBA,type:gR.UNSIGNED_BYTE},Xk._globalBatch=0;class zk{constructor(){this.texArray=null,this.blend=0,this.type=pR.TRIANGLES,this.start=0,this.size=0,this.data=null}}let Yk=0;class Zk{constructor(t,e=!0,r=!1){this.data=t||new Float32Array(1),this._glBuffers={},this._updateID=0,this.index=r,this.static=e,this.id=Yk++,this.disposeRunner=new Gk("disposeBuffer")}update(t){t instanceof Array&&(t=new Float32Array(t)),this.data=t||this.data,this._updateID++}dispose(){this.disposeRunner.emit(this,!1)}destroy(){this.dispose(),this.data=null}set index(t){this.type=t?AR.ELEMENT_ARRAY_BUFFER:AR.ARRAY_BUFFER}get index(){return this.type===AR.ELEMENT_ARRAY_BUFFER}static from(t){return t instanceof Array&&(t=new Float32Array(t)),new Zk(t)}}class $k{constructor(t,e=0,r=!1,i=gR.FLOAT,n,s,o,a=1){this.buffer=t,this.size=e,this.normalized=r,this.type=i,this.stride=n,this.start=s,this.instance=o,this.divisor=a}destroy(){this.buffer=null}static from(t,e,r,i,n){return new $k(t,e,r,i,n)}}const Kk={Float32Array:Float32Array,Uint32Array:Uint32Array,Int32Array:Int32Array,Uint8Array:Uint8Array};const Jk={5126:4,5123:2,5121:1};let qk=0;const Qk={Float32Array:Float32Array,Uint32Array:Uint32Array,Int32Array:Int32Array,Uint8Array:Uint8Array,Uint16Array:Uint16Array};class tD{constructor(t=[],e={}){this.buffers=t,this.indexBuffer=null,this.attributes=e,this.glVertexArrayObjects={},this.id=qk++,this.instanced=!1,this.instanceCount=1,this.disposeRunner=new Gk("disposeGeometry"),this.refCount=0}addAttribute(t,e,r=0,i=!1,n,s,o,a=!1){if(!e)throw new Error("You must pass a buffer when creating an attribute");e instanceof Zk||(e instanceof Array&&(e=new Float32Array(e)),e=new Zk(e));const h=t.split("|");if(h.length>1){for(let t=0;t<h.length;t++)this.addAttribute(h[t],e,r,i,n);return this}let l=this.buffers.indexOf(e);return-1===l&&(this.buffers.push(e),l=this.buffers.length-1),this.attributes[t]=new $k(l,r,i,n,s,o,a),this.instanced=this.instanced||a,this}getAttribute(t){return this.attributes[t]}getBuffer(t){return this.buffers[this.getAttribute(t).buffer]}addIndex(t){return t instanceof Zk||(t instanceof Array&&(t=new Uint16Array(t)),t=new Zk(t)),t.type=AR.ELEMENT_ARRAY_BUFFER,this.indexBuffer=t,this.buffers.includes(t)||this.buffers.push(t),this}getIndex(){return this.indexBuffer}interleave(){if(1===this.buffers.length||2===this.buffers.length&&this.indexBuffer)return this;const t=[],e=[],r=new Zk;let i;for(i in this.attributes){const r=this.attributes[i],n=this.buffers[r.buffer];t.push(n.data),e.push(r.size*Jk[r.type]/4),r.buffer=0}for(r.data=function(t,e){let r=0,i=0;const n={};for(let n=0;n<t.length;n++)i+=e[n],r+=t[n].length;const s=new ArrayBuffer(4*r);let o=null,a=0;for(let r=0;r<t.length;r++){const h=e[r],l=t[r],c=ak(l);n[c]||(n[c]=new Kk[c](s)),o=n[c];for(let t=0;t<l.length;t++)o[(t/h|0)*i+a+t%h]=l[t];a+=h}return new Float32Array(s)}(t,e),i=0;i<this.buffers.length;i++)this.buffers[i]!==this.indexBuffer&&this.buffers[i].destroy();return this.buffers=[r],this.indexBuffer&&this.buffers.push(this.indexBuffer),this}getSize(){for(const t in this.attributes){const e=this.attributes[t];return this.buffers[e.buffer].data.length/(e.stride/4||e.size)}return 0}dispose(){this.disposeRunner.emit(this,!1)}destroy(){this.dispose(),this.buffers=null,this.indexBuffer=null,this.attributes=null}clone(){const t=new tD;for(let e=0;e<this.buffers.length;e++)t.buffers[e]=new Zk(this.buffers[e].data.slice(0));for(const e in this.attributes){const r=this.attributes[e];t.attributes[e]=new $k(r.buffer,r.size,r.normalized,r.type,r.stride,r.start,r.instance)}return this.indexBuffer&&(t.indexBuffer=t.buffers[this.buffers.indexOf(this.indexBuffer)],t.indexBuffer.type=AR.ELEMENT_ARRAY_BUFFER),t}static merge(t){const e=new tD,r=[],i=[],n=[];let s;for(let e=0;e<t.length;e++){s=t[e];for(let t=0;t<s.buffers.length;t++)i[t]=i[t]||0,i[t]+=s.buffers[t].data.length,n[t]=0}for(let t=0;t<s.buffers.length;t++)r[t]=new(Qk[ak(s.buffers[t].data)])(i[t]),e.buffers[t]=new Zk(r[t]);for(let e=0;e<t.length;e++){s=t[e];for(let t=0;t<s.buffers.length;t++)r[t].set(s.buffers[t].data,n[t]),n[t]+=s.buffers[t].data.length}if(e.attributes=s.attributes,s.indexBuffer){e.indexBuffer=e.buffers[s.buffers.indexOf(s.indexBuffer)],e.indexBuffer.type=AR.ELEMENT_ARRAY_BUFFER;let r=0,i=0,n=0,o=0;for(let t=0;t<s.buffers.length;t++)if(s.buffers[t]!==s.indexBuffer){o=t;break}for(const t in s.attributes){const e=s.attributes[t];(0|e.buffer)===o&&(i+=e.size*Jk[e.type]/4)}for(let s=0;s<t.length;s++){const a=t[s].indexBuffer.data;for(let t=0;t<a.length;t++)e.indexBuffer.data[t+n]+=r;r+=t[s].buffers[o].data.length/i,n+=a.length}}return e}}class eD extends tD{constructor(t=!1){super(),this._buffer=new Zk(null,t,!1),this._indexBuffer=new Zk(null,t,!0),this.addAttribute("aVertexPosition",this._buffer,2,!1,gR.FLOAT).addAttribute("aTextureCoord",this._buffer,2,!1,gR.FLOAT).addAttribute("aColor",this._buffer,4,!0,gR.UNSIGNED_BYTE).addAttribute("aTextureId",this._buffer,1,!0,gR.FLOAT).addIndex(this._indexBuffer)}}const rD=2*Math.PI,iD=180/Math.PI,nD=Math.PI/180;var sD=(t=>(t[t.POLY=0]="POLY",t[t.RECT=1]="RECT",t[t.CIRC=2]="CIRC",t[t.ELIP=3]="ELIP",t[t.RREC=4]="RREC",t))(sD||{});class oD{constructor(t=0,e=0){this.x=0,this.y=0,this.x=t,this.y=e}clone(){return new oD(this.x,this.y)}copyFrom(t){return this.set(t.x,t.y),this}copyTo(t){return t.set(this.x,this.y),t}equals(t){return t.x===this.x&&t.y===this.y}set(t=0,e=t){return this.x=t,this.y=e,this}toString(){return`[@pixi/math:Point x=${this.x} y=${this.y}]`}}const aD=[new oD,new oD,new oD,new oD];class hD{constructor(t=0,e=0,r=0,i=0){this.x=Number(t),this.y=Number(e),this.width=Number(r),this.height=Number(i),this.type=sD.RECT}get left(){return this.x}get right(){return this.x+this.width}get top(){return this.y}get bottom(){return this.y+this.height}static get EMPTY(){return new hD(0,0,0,0)}clone(){return new hD(this.x,this.y,this.width,this.height)}copyFrom(t){return this.x=t.x,this.y=t.y,this.width=t.width,this.height=t.height,this}copyTo(t){return t.x=this.x,t.y=this.y,t.width=this.width,t.height=this.height,t}contains(t,e){return!(this.width<=0||this.height<=0)&&(t>=this.x&&t<this.x+this.width&&e>=this.y&&e<this.y+this.height)}intersects(t,e){if(!e){const e=this.x<t.x?t.x:this.x;if((this.right>t.right?t.right:this.right)<=e)return!1;const r=this.y<t.y?t.y:this.y;return(this.bottom>t.bottom?t.bottom:this.bottom)>r}const r=this.left,i=this.right,n=this.top,s=this.bottom;if(i<=r||s<=n)return!1;const o=aD[0].set(t.left,t.top),a=aD[1].set(t.left,t.bottom),h=aD[2].set(t.right,t.top),l=aD[3].set(t.right,t.bottom);if(h.x<=o.x||a.y<=o.y)return!1;const c=Math.sign(e.a*e.d-e.b*e.c);if(0===c)return!1;if(e.apply(o,o),e.apply(a,a),e.apply(h,h),e.apply(l,l),Math.max(o.x,a.x,h.x,l.x)<=r||Math.min(o.x,a.x,h.x,l.x)>=i||Math.max(o.y,a.y,h.y,l.y)<=n||Math.min(o.y,a.y,h.y,l.y)>=s)return!1;const u=c*(a.y-o.y),d=c*(o.x-a.x),p=u*r+d*n,f=u*i+d*n,m=u*r+d*s,g=u*i+d*s;if(Math.max(p,f,m,g)<=u*o.x+d*o.y||Math.min(p,f,m,g)>=u*l.x+d*l.y)return!1;const v=c*(o.y-h.y),y=c*(h.x-o.x),b=v*r+y*n,_=v*i+y*n,x=v*r+y*s,T=v*i+y*s;return!(Math.max(b,_,x,T)<=v*o.x+y*o.y||Math.min(b,_,x,T)>=v*l.x+y*l.y)}pad(t=0,e=t){return this.x-=t,this.y-=e,this.width+=2*t,this.height+=2*e,this}fit(t){const e=Math.max(this.x,t.x),r=Math.min(this.x+this.width,t.x+t.width),i=Math.max(this.y,t.y),n=Math.min(this.y+this.height,t.y+t.height);return this.x=e,this.width=Math.max(r-e,0),this.y=i,this.height=Math.max(n-i,0),this}ceil(t=1,e=.001){const r=Math.ceil((this.x+this.width-e)*t)/t,i=Math.ceil((this.y+this.height-e)*t)/t;return this.x=Math.floor((this.x+e)*t)/t,this.y=Math.floor((this.y+e)*t)/t,this.width=r-this.x,this.height=i-this.y,this}enlarge(t){const e=Math.min(this.x,t.x),r=Math.max(this.x+this.width,t.x+t.width),i=Math.min(this.y,t.y),n=Math.max(this.y+this.height,t.y+t.height);return this.x=e,this.width=r-e,this.y=i,this.height=n-i,this}toString(){return`[@pixi/math:Rectangle x=${this.x} y=${this.y} width=${this.width} height=${this.height}]`}}class lD{constructor(t=0,e=0,r=0){this.x=t,this.y=e,this.radius=r,this.type=sD.CIRC}clone(){return new lD(this.x,this.y,this.radius)}contains(t,e){if(this.radius<=0)return!1;const r=this.radius*this.radius;let i=this.x-t,n=this.y-e;return i*=i,n*=n,i+n<=r}getBounds(){return new hD(this.x-this.radius,this.y-this.radius,2*this.radius,2*this.radius)}toString(){return`[@pixi/math:Circle x=${this.x} y=${this.y} radius=${this.radius}]`}}class cD{constructor(t=0,e=0,r=0,i=0){this.x=t,this.y=e,this.width=r,this.height=i,this.type=sD.ELIP}clone(){return new cD(this.x,this.y,this.width,this.height)}contains(t,e){if(this.width<=0||this.height<=0)return!1;let r=(t-this.x)/this.width,i=(e-this.y)/this.height;return r*=r,i*=i,r+i<=1}getBounds(){return new hD(this.x-this.width,this.y-this.height,this.width,this.height)}toString(){return`[@pixi/math:Ellipse x=${this.x} y=${this.y} width=${this.width} height=${this.height}]`}}class uD{constructor(...t){let e=Array.isArray(t[0])?t[0]:t;if("number"!=typeof e[0]){const t=[];for(let r=0,i=e.length;r<i;r++)t.push(e[r].x,e[r].y);e=t}this.points=e,this.type=sD.POLY,this.closeStroke=!0}clone(){const t=this.points.slice(),e=new uD(t);return e.closeStroke=this.closeStroke,e}contains(t,e){let r=!1;const i=this.points.length/2;for(let n=0,s=i-1;n<i;s=n++){const i=this.points[2*n],o=this.points[2*n+1],a=this.points[2*s],h=this.points[2*s+1];o>e!=h>e&&t<(e-o)/(h-o)*(a-i)+i&&(r=!r)}return r}toString(){return`[@pixi/math:PolygoncloseStroke=${this.closeStroke}points=${this.points.reduce(((t,e)=>`${t}, ${e}`),"")}]`}}class dD{constructor(t=0,e=0,r=0,i=0,n=20){this.x=t,this.y=e,this.width=r,this.height=i,this.radius=n,this.type=sD.RREC}clone(){return new dD(this.x,this.y,this.width,this.height,this.radius)}contains(t,e){if(this.width<=0||this.height<=0)return!1;if(t>=this.x&&t<=this.x+this.width&&e>=this.y&&e<=this.y+this.height){const r=Math.max(0,Math.min(this.radius,Math.min(this.width,this.height)/2));if(e>=this.y+r&&e<=this.y+this.height-r||t>=this.x+r&&t<=this.x+this.width-r)return!0;let i=t-(this.x+r),n=e-(this.y+r);const s=r*r;if(i*i+n*n<=s)return!0;if(i=t-(this.x+this.width-r),i*i+n*n<=s)return!0;if(n=e-(this.y+this.height-r),i*i+n*n<=s)return!0;if(i=t-(this.x+r),i*i+n*n<=s)return!0}return!1}toString(){return`[@pixi/math:RoundedRectangle x=${this.x} y=${this.y}width=${this.width} height=${this.height} radius=${this.radius}]`}}class pD{constructor(t=1,e=0,r=0,i=1,n=0,s=0){this.array=null,this.a=t,this.b=e,this.c=r,this.d=i,this.tx=n,this.ty=s}fromArray(t){this.a=t[0],this.b=t[1],this.c=t[3],this.d=t[4],this.tx=t[2],this.ty=t[5]}set(t,e,r,i,n,s){return this.a=t,this.b=e,this.c=r,this.d=i,this.tx=n,this.ty=s,this}toArray(t,e){this.array||(this.array=new Float32Array(9));const r=e||this.array;return t?(r[0]=this.a,r[1]=this.b,r[2]=0,r[3]=this.c,r[4]=this.d,r[5]=0,r[6]=this.tx,r[7]=this.ty,r[8]=1):(r[0]=this.a,r[1]=this.c,r[2]=this.tx,r[3]=this.b,r[4]=this.d,r[5]=this.ty,r[6]=0,r[7]=0,r[8]=1),r}apply(t,e){e=e||new oD;const r=t.x,i=t.y;return e.x=this.a*r+this.c*i+this.tx,e.y=this.b*r+this.d*i+this.ty,e}applyInverse(t,e){e=e||new oD;const r=1/(this.a*this.d+this.c*-this.b),i=t.x,n=t.y;return e.x=this.d*r*i+-this.c*r*n+(this.ty*this.c-this.tx*this.d)*r,e.y=this.a*r*n+-this.b*r*i+(-this.ty*this.a+this.tx*this.b)*r,e}translate(t,e){return this.tx+=t,this.ty+=e,this}scale(t,e){return this.a*=t,this.d*=e,this.c*=t,this.b*=e,this.tx*=t,this.ty*=e,this}rotate(t){const e=Math.cos(t),r=Math.sin(t),i=this.a,n=this.c,s=this.tx;return this.a=i*e-this.b*r,this.b=i*r+this.b*e,this.c=n*e-this.d*r,this.d=n*r+this.d*e,this.tx=s*e-this.ty*r,this.ty=s*r+this.ty*e,this}append(t){const e=this.a,r=this.b,i=this.c,n=this.d;return this.a=t.a*e+t.b*i,this.b=t.a*r+t.b*n,this.c=t.c*e+t.d*i,this.d=t.c*r+t.d*n,this.tx=t.tx*e+t.ty*i+this.tx,this.ty=t.tx*r+t.ty*n+this.ty,this}setTransform(t,e,r,i,n,s,o,a,h){return this.a=Math.cos(o+h)*n,this.b=Math.sin(o+h)*n,this.c=-Math.sin(o-a)*s,this.d=Math.cos(o-a)*s,this.tx=t-(r*this.a+i*this.c),this.ty=e-(r*this.b+i*this.d),this}prepend(t){const e=this.tx;if(1!==t.a||0!==t.b||0!==t.c||1!==t.d){const e=this.a,r=this.c;this.a=e*t.a+this.b*t.c,this.b=e*t.b+this.b*t.d,this.c=r*t.a+this.d*t.c,this.d=r*t.b+this.d*t.d}return this.tx=e*t.a+this.ty*t.c+t.tx,this.ty=e*t.b+this.ty*t.d+t.ty,this}decompose(t){const e=this.a,r=this.b,i=this.c,n=this.d,s=t.pivot,o=-Math.atan2(-i,n),a=Math.atan2(r,e),h=Math.abs(o+a);return h<1e-5||Math.abs(rD-h)<1e-5?(t.rotation=a,t.skew.x=t.skew.y=0):(t.rotation=0,t.skew.x=o,t.skew.y=a),t.scale.x=Math.sqrt(e*e+r*r),t.scale.y=Math.sqrt(i*i+n*n),t.position.x=this.tx+(s.x*e+s.y*i),t.position.y=this.ty+(s.x*r+s.y*n),t}invert(){const t=this.a,e=this.b,r=this.c,i=this.d,n=this.tx,s=t*i-e*r;return this.a=i/s,this.b=-e/s,this.c=-r/s,this.d=t/s,this.tx=(r*this.ty-i*n)/s,this.ty=-(t*this.ty-e*n)/s,this}identity(){return this.a=1,this.b=0,this.c=0,this.d=1,this.tx=0,this.ty=0,this}clone(){const t=new pD;return t.a=this.a,t.b=this.b,t.c=this.c,t.d=this.d,t.tx=this.tx,t.ty=this.ty,t}copyTo(t){return t.a=this.a,t.b=this.b,t.c=this.c,t.d=this.d,t.tx=this.tx,t.ty=this.ty,t}copyFrom(t){return this.a=t.a,this.b=t.b,this.c=t.c,this.d=t.d,this.tx=t.tx,this.ty=t.ty,this}toString(){return`[@pixi/math:Matrix a=${this.a} b=${this.b} c=${this.c} d=${this.d} tx=${this.tx} ty=${this.ty}]`}static get IDENTITY(){return new pD}static get TEMP_MATRIX(){return new pD}}const fD=[1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1,0,1],mD=[0,1,1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1],gD=[0,-1,-1,-1,0,1,1,1,0,1,1,1,0,-1,-1,-1],vD=[1,1,0,-1,-1,-1,0,1,-1,-1,0,1,1,1,0,-1],yD=[],bD=[],_D=Math.sign;!function(){for(let t=0;t<16;t++){const e=[];yD.push(e);for(let r=0;r<16;r++){const i=_D(fD[t]*fD[r]+gD[t]*mD[r]),n=_D(mD[t]*fD[r]+vD[t]*mD[r]),s=_D(fD[t]*gD[r]+gD[t]*vD[r]),o=_D(mD[t]*gD[r]+vD[t]*vD[r]);for(let t=0;t<16;t++)if(fD[t]===i&&mD[t]===n&&gD[t]===s&&vD[t]===o){e.push(t);break}}}for(let t=0;t<16;t++){const e=new pD;e.set(fD[t],mD[t],gD[t],vD[t],0,0),bD.push(e)}}();const xD={E:0,SE:1,S:2,SW:3,W:4,NW:5,N:6,NE:7,MIRROR_VERTICAL:8,MAIN_DIAGONAL:10,MIRROR_HORIZONTAL:12,REVERSE_DIAGONAL:14,uX:t=>fD[t],uY:t=>mD[t],vX:t=>gD[t],vY:t=>vD[t],inv:t=>8&t?15&t:7&-t,add:(t,e)=>yD[t][e],sub:(t,e)=>yD[t][xD.inv(e)],rotate180:t=>4^t,isVertical:t=>2==(3&t),byDirection:(t,e)=>2*Math.abs(t)<=Math.abs(e)?e>=0?xD.S:xD.N:2*Math.abs(e)<=Math.abs(t)?t>0?xD.E:xD.W:e>0?t>0?xD.SE:xD.SW:t>0?xD.NE:xD.NW,matrixAppendRotationInv:(t,e,r=0,i=0)=>{const n=bD[xD.inv(e)];n.tx=r,n.ty=i,t.append(n)}};class TD{constructor(t,e,r=0,i=0){this._x=r,this._y=i,this.cb=t,this.scope=e}clone(t=this.cb,e=this.scope){return new TD(t,e,this._x,this._y)}set(t=0,e=t){return this._x===t&&this._y===e||(this._x=t,this._y=e,this.cb.call(this.scope)),this}copyFrom(t){return this._x===t.x&&this._y===t.y||(this._x=t.x,this._y=t.y,this.cb.call(this.scope)),this}copyTo(t){return t.set(this._x,this._y),t}equals(t){return t.x===this._x&&t.y===this._y}toString(){return`[@pixi/math:ObservablePoint x=0 y=0 scope=${this.scope}]`}get x(){return this._x}set x(t){this._x!==t&&(this._x=t,this.cb.call(this.scope))}get y(){return this._y}set y(t){this._y!==t&&(this._y=t,this.cb.call(this.scope))}}const wD=class{constructor(){this.worldTransform=new pD,this.localTransform=new pD,this.position=new TD(this.onChange,this,0,0),this.scale=new TD(this.onChange,this,1,1),this.pivot=new TD(this.onChange,this,0,0),this.skew=new TD(this.updateSkew,this,0,0),this._rotation=0,this._cx=1,this._sx=0,this._cy=0,this._sy=1,this._localID=0,this._currentLocalID=0,this._worldID=0,this._parentID=0}onChange(){this._localID++}updateSkew(){this._cx=Math.cos(this._rotation+this.skew.y),this._sx=Math.sin(this._rotation+this.skew.y),this._cy=-Math.sin(this._rotation-this.skew.x),this._sy=Math.cos(this._rotation-this.skew.x),this._localID++}toString(){return`[@pixi/math:Transform position=(${this.position.x}, ${this.position.y}) rotation=${this.rotation} scale=(${this.scale.x}, ${this.scale.y}) skew=(${this.skew.x}, ${this.skew.y}) ]`}updateLocalTransform(){const t=this.localTransform;this._localID!==this._currentLocalID&&(t.a=this._cx*this.scale.x,t.b=this._sx*this.scale.x,t.c=this._cy*this.scale.y,t.d=this._sy*this.scale.y,t.tx=this.position.x-(this.pivot.x*t.a+this.pivot.y*t.c),t.ty=this.position.y-(this.pivot.x*t.b+this.pivot.y*t.d),this._currentLocalID=this._localID,this._parentID=-1)}updateTransform(t){const e=this.localTransform;if(this._localID!==this._currentLocalID&&(e.a=this._cx*this.scale.x,e.b=this._sx*this.scale.x,e.c=this._cy*this.scale.y,e.d=this._sy*this.scale.y,e.tx=this.position.x-(this.pivot.x*e.a+this.pivot.y*e.c),e.ty=this.position.y-(this.pivot.x*e.b+this.pivot.y*e.d),this._currentLocalID=this._localID,this._parentID=-1),this._parentID!==t._worldID){const r=t.worldTransform,i=this.worldTransform;i.a=e.a*r.a+e.b*r.c,i.b=e.a*r.b+e.b*r.d,i.c=e.c*r.a+e.d*r.c,i.d=e.c*r.b+e.d*r.d,i.tx=e.tx*r.a+e.ty*r.c+r.tx,i.ty=e.tx*r.b+e.ty*r.d+r.ty,this._parentID=t._worldID,this._worldID++}}setFromMatrix(t){t.decompose(this),this._localID++}get rotation(){return this._rotation}set rotation(t){this._rotation!==t&&(this._rotation=t,this.updateSkew())}};let SD=wD;SD.IDENTITY=new wD;function ED(t,e,r){const i=t.createShader(e);return t.shaderSource(i,r),t.compileShader(i),i}function CD(t){const e=new Array(t);for(let t=0;t<e.length;t++)e[t]=!1;return e}function AD(t,e){switch(t){case"float":case"int":case"uint":case"sampler2D":case"sampler2DArray":return 0;case"vec2":return new Float32Array(2*e);case"vec3":return new Float32Array(3*e);case"vec4":return new Float32Array(4*e);case"ivec2":return new Int32Array(2*e);case"ivec3":return new Int32Array(3*e);case"ivec4":return new Int32Array(4*e);case"uvec2":return new Uint32Array(2*e);case"uvec3":return new Uint32Array(3*e);case"uvec4":return new Uint32Array(4*e);case"bool":return!1;case"bvec2":return CD(2*e);case"bvec3":return CD(3*e);case"bvec4":return CD(4*e);case"mat2":return new Float32Array([1,0,0,1]);case"mat3":return new Float32Array([1,0,0,0,1,0,0,0,1]);case"mat4":return new Float32Array([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])}return null}const RD=[{test:t=>"float"===t.type&&1===t.size&&!t.isArray,code:t=>`\n            if(uv["${t}"] !== ud["${t}"].value)\n            {\n                ud["${t}"].value = uv["${t}"]\n                gl.uniform1f(ud["${t}"].location, uv["${t}"])\n            }\n            `},{test:(t,e)=>!("sampler2D"!==t.type&&"samplerCube"!==t.type&&"sampler2DArray"!==t.type||1!==t.size||t.isArray||null!=e&&void 0===e.castToBaseTexture),code:t=>`t = syncData.textureCount++;\n\n            renderer.texture.bind(uv["${t}"], t);\n\n            if(ud["${t}"].value !== t)\n            {\n                ud["${t}"].value = t;\n                gl.uniform1i(ud["${t}"].location, t);\n; // eslint-disable-line max-len\n            }`},{test:(t,e)=>"mat3"===t.type&&1===t.size&&!t.isArray&&void 0!==e.a,code:t=>`\n            gl.uniformMatrix3fv(ud["${t}"].location, false, uv["${t}"].toArray(true));\n            `,codeUbo:t=>`\n                var ${t}_matrix = uv.${t}.toArray(true);\n\n                data[offset] = ${t}_matrix[0];\n                data[offset+1] = ${t}_matrix[1];\n                data[offset+2] = ${t}_matrix[2];\n        \n                data[offset + 4] = ${t}_matrix[3];\n                data[offset + 5] = ${t}_matrix[4];\n                data[offset + 6] = ${t}_matrix[5];\n        \n                data[offset + 8] = ${t}_matrix[6];\n                data[offset + 9] = ${t}_matrix[7];\n                data[offset + 10] = ${t}_matrix[8];\n            `},{test:(t,e)=>"vec2"===t.type&&1===t.size&&!t.isArray&&void 0!==e.x,code:t=>`\n                cv = ud["${t}"].value;\n                v = uv["${t}"];\n\n                if(cv[0] !== v.x || cv[1] !== v.y)\n                {\n                    cv[0] = v.x;\n                    cv[1] = v.y;\n                    gl.uniform2f(ud["${t}"].location, v.x, v.y);\n                }`,codeUbo:t=>`\n                v = uv.${t};\n\n                data[offset] = v.x;\n                data[offset+1] = v.y;\n            `},{test:t=>"vec2"===t.type&&1===t.size&&!t.isArray,code:t=>`\n                cv = ud["${t}"].value;\n                v = uv["${t}"];\n\n                if(cv[0] !== v[0] || cv[1] !== v[1])\n                {\n                    cv[0] = v[0];\n                    cv[1] = v[1];\n                    gl.uniform2f(ud["${t}"].location, v[0], v[1]);\n                }\n            `},{test:(t,e)=>"vec4"===t.type&&1===t.size&&!t.isArray&&void 0!==e.width,code:t=>`\n                cv = ud["${t}"].value;\n                v = uv["${t}"];\n\n                if(cv[0] !== v.x || cv[1] !== v.y || cv[2] !== v.width || cv[3] !== v.height)\n                {\n                    cv[0] = v.x;\n                    cv[1] = v.y;\n                    cv[2] = v.width;\n                    cv[3] = v.height;\n                    gl.uniform4f(ud["${t}"].location, v.x, v.y, v.width, v.height)\n                }`,codeUbo:t=>`\n                    v = uv.${t};\n\n                    data[offset] = v.x;\n                    data[offset+1] = v.y;\n                    data[offset+2] = v.width;\n                    data[offset+3] = v.height;\n                `},{test:(t,e)=>"vec4"===t.type&&1===t.size&&!t.isArray&&void 0!==e.red,code:t=>`\n                cv = ud["${t}"].value;\n                v = uv["${t}"];\n\n                if(cv[0] !== v.red || cv[1] !== v.green || cv[2] !== v.blue || cv[3] !== v.alpha)\n                {\n                    cv[0] = v.red;\n                    cv[1] = v.green;\n                    cv[2] = v.blue;\n                    cv[3] = v.alpha;\n                    gl.uniform4f(ud["${t}"].location, v.red, v.green, v.blue, v.alpha)\n                }`,codeUbo:t=>`\n                    v = uv.${t};\n\n                    data[offset] = v.red;\n                    data[offset+1] = v.green;\n                    data[offset+2] = v.blue;\n                    data[offset+3] = v.alpha;\n                `},{test:(t,e)=>"vec3"===t.type&&1===t.size&&!t.isArray&&void 0!==e.red,code:t=>`\n                cv = ud["${t}"].value;\n                v = uv["${t}"];\n\n                if(cv[0] !== v.red || cv[1] !== v.green || cv[2] !== v.blue || cv[3] !== v.a)\n                {\n                    cv[0] = v.red;\n                    cv[1] = v.green;\n                    cv[2] = v.blue;\n    \n                    gl.uniform3f(ud["${t}"].location, v.red, v.green, v.blue)\n                }`,codeUbo:t=>`\n                    v = uv.${t};\n\n                    data[offset] = v.red;\n                    data[offset+1] = v.green;\n                    data[offset+2] = v.blue;\n                `},{test:t=>"vec4"===t.type&&1===t.size&&!t.isArray,code:t=>`\n                cv = ud["${t}"].value;\n                v = uv["${t}"];\n\n                if(cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3])\n                {\n                    cv[0] = v[0];\n                    cv[1] = v[1];\n                    cv[2] = v[2];\n                    cv[3] = v[3];\n\n                    gl.uniform4f(ud["${t}"].location, v[0], v[1], v[2], v[3])\n                }`}],PD={float:"\n    if (cv !== v)\n    {\n        cu.value = v;\n        gl.uniform1f(location, v);\n    }",vec2:"\n    if (cv[0] !== v[0] || cv[1] !== v[1])\n    {\n        cv[0] = v[0];\n        cv[1] = v[1];\n\n        gl.uniform2f(location, v[0], v[1])\n    }",vec3:"\n    if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2])\n    {\n        cv[0] = v[0];\n        cv[1] = v[1];\n        cv[2] = v[2];\n\n        gl.uniform3f(location, v[0], v[1], v[2])\n    }",vec4:"\n    if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3])\n    {\n        cv[0] = v[0];\n        cv[1] = v[1];\n        cv[2] = v[2];\n        cv[3] = v[3];\n\n        gl.uniform4f(location, v[0], v[1], v[2], v[3]);\n    }",int:"\n    if (cv !== v)\n    {\n        cu.value = v;\n\n        gl.uniform1i(location, v);\n    }",ivec2:"\n    if (cv[0] !== v[0] || cv[1] !== v[1])\n    {\n        cv[0] = v[0];\n        cv[1] = v[1];\n\n        gl.uniform2i(location, v[0], v[1]);\n    }",ivec3:"\n    if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2])\n    {\n        cv[0] = v[0];\n        cv[1] = v[1];\n        cv[2] = v[2];\n\n        gl.uniform3i(location, v[0], v[1], v[2]);\n    }",ivec4:"\n    if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3])\n    {\n        cv[0] = v[0];\n        cv[1] = v[1];\n        cv[2] = v[2];\n        cv[3] = v[3];\n\n        gl.uniform4i(location, v[0], v[1], v[2], v[3]);\n    }",uint:"\n    if (cv !== v)\n    {\n        cu.value = v;\n\n        gl.uniform1ui(location, v);\n    }",uvec2:"\n    if (cv[0] !== v[0] || cv[1] !== v[1])\n    {\n        cv[0] = v[0];\n        cv[1] = v[1];\n\n        gl.uniform2ui(location, v[0], v[1]);\n    }",uvec3:"\n    if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2])\n    {\n        cv[0] = v[0];\n        cv[1] = v[1];\n        cv[2] = v[2];\n\n        gl.uniform3ui(location, v[0], v[1], v[2]);\n    }",uvec4:"\n    if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3])\n    {\n        cv[0] = v[0];\n        cv[1] = v[1];\n        cv[2] = v[2];\n        cv[3] = v[3];\n\n        gl.uniform4ui(location, v[0], v[1], v[2], v[3]);\n    }",bool:"\n    if (cv !== v)\n    {\n        cu.value = v;\n        gl.uniform1i(location, v);\n    }",bvec2:"\n    if (cv[0] != v[0] || cv[1] != v[1])\n    {\n        cv[0] = v[0];\n        cv[1] = v[1];\n\n        gl.uniform2i(location, v[0], v[1]);\n    }",bvec3:"\n    if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2])\n    {\n        cv[0] = v[0];\n        cv[1] = v[1];\n        cv[2] = v[2];\n\n        gl.uniform3i(location, v[0], v[1], v[2]);\n    }",bvec4:"\n    if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3])\n    {\n        cv[0] = v[0];\n        cv[1] = v[1];\n        cv[2] = v[2];\n        cv[3] = v[3];\n\n        gl.uniform4i(location, v[0], v[1], v[2], v[3]);\n    }",mat2:"gl.uniformMatrix2fv(location, false, v)",mat3:"gl.uniformMatrix3fv(location, false, v)",mat4:"gl.uniformMatrix4fv(location, false, v)",sampler2D:"\n    if (cv !== v)\n    {\n        cu.value = v;\n\n        gl.uniform1i(location, v);\n    }",samplerCube:"\n    if (cv !== v)\n    {\n        cu.value = v;\n\n        gl.uniform1i(location, v);\n    }",sampler2DArray:"\n    if (cv !== v)\n    {\n        cu.value = v;\n\n        gl.uniform1i(location, v);\n    }"},ID={float:"gl.uniform1fv(location, v)",vec2:"gl.uniform2fv(location, v)",vec3:"gl.uniform3fv(location, v)",vec4:"gl.uniform4fv(location, v)",mat4:"gl.uniformMatrix4fv(location, false, v)",mat3:"gl.uniformMatrix3fv(location, false, v)",mat2:"gl.uniformMatrix2fv(location, false, v)",int:"gl.uniform1iv(location, v)",ivec2:"gl.uniform2iv(location, v)",ivec3:"gl.uniform3iv(location, v)",ivec4:"gl.uniform4iv(location, v)",uint:"gl.uniform1uiv(location, v)",uvec2:"gl.uniform2uiv(location, v)",uvec3:"gl.uniform3uiv(location, v)",uvec4:"gl.uniform4uiv(location, v)",bool:"gl.uniform1iv(location, v)",bvec2:"gl.uniform2iv(location, v)",bvec3:"gl.uniform3iv(location, v)",bvec4:"gl.uniform4iv(location, v)",sampler2D:"gl.uniform1iv(location, v)",samplerCube:"gl.uniform1iv(location, v)",sampler2DArray:"gl.uniform1iv(location, v)"};const MD={};let OD,kD=MD;function DD(){if(!OD){OD=SR.MEDIUM;const t=function(){if(kD===MD||kD?.isContextLost()){const t=PR.ADAPTER.createCanvas();let e;PR.PREFER_ENV>=lR.WEBGL2&&(e=t.getContext("webgl2",{})),e||(e=t.getContext("webgl",{})||t.getContext("experimental-webgl",{}),e?e.getExtension("WEBGL_draw_buffers"):e=null),kD=e}return kD}();if(t&&t.getShaderPrecisionFormat){const e=t.getShaderPrecisionFormat(t.FRAGMENT_SHADER,t.HIGH_FLOAT);OD=e.precision?SR.HIGH:SR.MEDIUM}}return OD}function LD(t,e){const r=t.getShaderSource(e).split("\n").map(((t,e)=>`${e}: ${t}`)),i=t.getShaderInfoLog(e),n=i.split("\n"),s={},o=n.map((t=>parseFloat(t.replace(/^ERROR\: 0\:([\d]+)\:.*$/,"$1")))).filter((t=>!(!t||s[t])&&(s[t]=!0,!0))),a=[""];o.forEach((t=>{r[t-1]=`%c${r[t-1]}%c`,a.push("background: #FF0000; color:#FFFFFF; font-size: 10px","font-size: 10px")}));const h=r.join("\n");a[0]=h,console.error(i),console.groupCollapsed("click to view full shader code"),console.warn(...a),console.groupEnd()}const ND={float:1,vec2:2,vec3:3,vec4:4,int:1,ivec2:2,ivec3:3,ivec4:4,uint:1,uvec2:2,uvec3:3,uvec4:4,bool:1,bvec2:2,bvec3:3,bvec4:4,mat2:4,mat3:9,mat4:16,sampler2D:1};function FD(t){return ND[t]}let BD=null;const UD={FLOAT:"float",FLOAT_VEC2:"vec2",FLOAT_VEC3:"vec3",FLOAT_VEC4:"vec4",INT:"int",INT_VEC2:"ivec2",INT_VEC3:"ivec3",INT_VEC4:"ivec4",UNSIGNED_INT:"uint",UNSIGNED_INT_VEC2:"uvec2",UNSIGNED_INT_VEC3:"uvec3",UNSIGNED_INT_VEC4:"uvec4",BOOL:"bool",BOOL_VEC2:"bvec2",BOOL_VEC3:"bvec3",BOOL_VEC4:"bvec4",FLOAT_MAT2:"mat2",FLOAT_MAT3:"mat3",FLOAT_MAT4:"mat4",SAMPLER_2D:"sampler2D",INT_SAMPLER_2D:"sampler2D",UNSIGNED_INT_SAMPLER_2D:"sampler2D",SAMPLER_CUBE:"samplerCube",INT_SAMPLER_CUBE:"samplerCube",UNSIGNED_INT_SAMPLER_CUBE:"samplerCube",SAMPLER_2D_ARRAY:"sampler2DArray",INT_SAMPLER_2D_ARRAY:"sampler2DArray",UNSIGNED_INT_SAMPLER_2D_ARRAY:"sampler2DArray"};function GD(t,e){if(!BD){const e=Object.keys(UD);BD={};for(let r=0;r<e.length;++r){const i=e[r];BD[t[i]]=UD[i]}}return BD[e]}function jD(t,e,r){if("precision"!==t.substring(0,9)){let i=e;return e===SR.HIGH&&r!==SR.HIGH&&(i=SR.MEDIUM),`precision ${i} float;\n${t}`}return r!==SR.HIGH&&"precision highp"===t.substring(0,15)?t.replace("precision highp","precision mediump"):t}let VD;let HD=0;const WD={},XD=class{constructor(t,e,r="pixi-shader",i={}){this.extra={},this.id=HD++,this.vertexSrc=t||XD.defaultVertexSrc,this.fragmentSrc=e||XD.defaultFragmentSrc,this.vertexSrc=this.vertexSrc.trim(),this.fragmentSrc=this.fragmentSrc.trim(),this.extra=i,"#version"!==this.vertexSrc.substring(0,8)&&(r=r.replace(/\s+/g,"-"),WD[r]?(WD[r]++,r+=`-${WD[r]}`):WD[r]=1,this.vertexSrc=`#define SHADER_NAME ${r}\n${this.vertexSrc}`,this.fragmentSrc=`#define SHADER_NAME ${r}\n${this.fragmentSrc}`,this.vertexSrc=jD(this.vertexSrc,XD.defaultVertexPrecision,SR.HIGH),this.fragmentSrc=jD(this.fragmentSrc,XD.defaultFragmentPrecision,DD())),this.glPrograms={},this.syncUniforms=null}static get defaultVertexSrc(){return"attribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\n\nuniform mat3 projectionMatrix;\n\nvarying vec2 vTextureCoord;\n\nvoid main(void){\n   gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n   vTextureCoord = aTextureCoord;\n}\n"}static get defaultFragmentSrc(){return"varying vec2 vTextureCoord;\n\nuniform sampler2D uSampler;\n\nvoid main(void){\n   gl_FragColor *= texture2D(uSampler, vTextureCoord);\n}"}static from(t,e,r){const i=t+e;let n=yk[i];return n||(yk[i]=n=new XD(t,e,r)),n}};let zD=XD;zD.defaultVertexPrecision=SR.HIGH,zD.defaultFragmentPrecision=YR.apple.device?SR.HIGH:SR.MEDIUM;let YD=0;class ZD{constructor(t,e,r){this.group=!0,this.syncUniforms={},this.dirtyId=0,this.id=YD++,this.static=!!e,this.ubo=!!r,t instanceof Zk?(this.buffer=t,this.buffer.type=AR.UNIFORM_BUFFER,this.autoManage=!1,this.ubo=!0):(this.uniforms=t,this.ubo&&(this.buffer=new Zk(new Float32Array(1)),this.buffer.type=AR.UNIFORM_BUFFER,this.autoManage=!0))}update(){this.dirtyId++,!this.autoManage&&this.buffer&&this.buffer.update()}add(t,e,r){if(this.ubo)throw new Error("[UniformGroup] uniform groups in ubo mode cannot be modified, or have uniform groups nested in them");this.uniforms[t]=new ZD(e,r)}static from(t,e,r){return new ZD(t,e,r)}static uboFrom(t,e){return new ZD(t,e??!0,!0)}}class $D{constructor(t,e){this.uniformBindCount=0,this.program=t,this.uniformGroup=e?e instanceof ZD?e:new ZD(e):new ZD({}),this.disposeRunner=new Gk("disposeShader")}checkUniformExists(t,e){if(e.uniforms[t])return!0;for(const r in e.uniforms){const i=e.uniforms[r];if(i.group&&this.checkUniformExists(t,i))return!0}return!1}destroy(){this.uniformGroup=null,this.disposeRunner.emit(this),this.disposeRunner.destroy()}get uniforms(){return this.uniformGroup.uniforms}static from(t,e,r){const i=zD.from(t,e);return new $D(i,r)}}class KD{constructor(t,e){if(this.vertexSrc=t,this.fragTemplate=e,this.programCache={},this.defaultGroupCache={},!e.includes("%count%"))throw new Error('Fragment template must contain "%count%".');if(!e.includes("%forloop%"))throw new Error('Fragment template must contain "%forloop%".')}generateShader(t){if(!this.programCache[t]){const e=new Int32Array(t);for(let r=0;r<t;r++)e[r]=r;this.defaultGroupCache[t]=ZD.from({uSamplers:e},!0);let r=this.fragTemplate;r=r.replace(/%count%/gi,`${t}`),r=r.replace(/%forloop%/gi,this.generateSampleSrc(t)),this.programCache[t]=new zD(this.vertexSrc,r)}const e={tint:new Float32Array([1,1,1,1]),translationMatrix:new pD,default:this.defaultGroupCache[t]};return new $D(this.programCache[t],e)}generateSampleSrc(t){let e="";e+="\n",e+="\n";for(let r=0;r<t;r++)r>0&&(e+="\nelse "),r<t-1&&(e+=`if(vTextureId < ${r}.5)`),e+="\n{",e+=`\n\tcolor = texture2D(uSamplers[${r}], vTextureCoord);`,e+="\n}";return e+="\n",e+="\n",e}}class JD{constructor(){this.elements=[],this.ids=[],this.count=0}clear(){for(let t=0;t<this.count;t++)this.elements[t]=null;this.count=0}}class qD{constructor(t){this.renderer=t}flush(){}destroy(){this.renderer=null}start(){}stop(){this.flush()}render(t){}}const QD=class extends qD{constructor(t){super(t),this.setShaderGenerator(),this.geometryClass=eD,this.vertexSize=6,this.state=Fk.for2d(),this.size=4*QD.defaultBatchSize,this._vertexCount=0,this._indexCount=0,this._bufferedElements=[],this._bufferedTextures=[],this._bufferSize=0,this._shader=null,this._packedGeometries=[],this._packedGeometryPoolSize=2,this._flushId=0,this._aBuffers={},this._iBuffers={},this.maxTextures=1,this.renderer.on("prerender",this.onPrerender,this),t.runners.contextChange.add(this),this._dcIndex=0,this._aIndex=0,this._iIndex=0,this._attributeBuffer=null,this._indexBuffer=null,this._tempBoundTextures=[]}static get defaultMaxTextures(){return this._defaultMaxTextures=this._defaultMaxTextures??function(t){let e=!0;const r=PR.ADAPTER.getNavigator();if(YR.tablet||YR.phone){if(YR.apple.device){const t=r.userAgent.match(/OS (\d+)_(\d+)?/);t&&parseInt(t[1],10)<11&&(e=!1)}if(YR.android.device){const t=r.userAgent.match(/Android\s([0-9.]*)/);t&&parseInt(t[1],10)<7&&(e=!1)}}return e?t:4}(32),this._defaultMaxTextures}static set defaultMaxTextures(t){this._defaultMaxTextures=t}static get canUploadSameBuffer(){return this._canUploadSameBuffer=this._canUploadSameBuffer??!YR.apple.device,this._canUploadSameBuffer}static set canUploadSameBuffer(t){this._canUploadSameBuffer=t}get MAX_TEXTURES(){return TO("7.1.0","BatchRenderer#MAX_TEXTURES renamed to BatchRenderer#maxTextures"),this.maxTextures}static get defaultVertexSrc(){return"precision highp float;\nattribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\nattribute vec4 aColor;\nattribute float aTextureId;\n\nuniform mat3 projectionMatrix;\nuniform mat3 translationMatrix;\nuniform vec4 tint;\n\nvarying vec2 vTextureCoord;\nvarying vec4 vColor;\nvarying float vTextureId;\n\nvoid main(void){\n    gl_Position = vec4((projectionMatrix * translationMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n\n    vTextureCoord = aTextureCoord;\n    vTextureId = aTextureId;\n    vColor = aColor * tint;\n}\n"}static get defaultFragmentTemplate(){return"varying vec2 vTextureCoord;\nvarying vec4 vColor;\nvarying float vTextureId;\nuniform sampler2D uSamplers[%count%];\n\nvoid main(void){\n    vec4 color;\n    %forloop%\n    gl_FragColor = color * vColor;\n}\n"}setShaderGenerator({vertex:t=QD.defaultVertexSrc,fragment:e=QD.defaultFragmentTemplate}={}){this.shaderGenerator=new KD(t,e)}contextChange(){const t=this.renderer.gl;PR.PREFER_ENV===lR.WEBGL_LEGACY?this.maxTextures=1:(this.maxTextures=Math.min(t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS),QD.defaultMaxTextures),this.maxTextures=function(t,e){if(0===t)throw new Error("Invalid value of `0` passed to `checkMaxIfStatementsInShader`");const r=e.createShader(e.FRAGMENT_SHADER);for(;;){const i=Lk.replace(/%forloop%/gi,Nk(t));if(e.shaderSource(r,i),e.compileShader(r),e.getShaderParameter(r,e.COMPILE_STATUS))break;t=t/2|0}return t}(this.maxTextures,t)),this._shader=this.shaderGenerator.generateShader(this.maxTextures);for(let t=0;t<this._packedGeometryPoolSize;t++)this._packedGeometries[t]=new this.geometryClass;this.initFlushBuffers()}initFlushBuffers(){const{_drawCallPool:t,_textureArrayPool:e}=QD,r=this.size/4,i=Math.floor(r/this.maxTextures)+1;for(;t.length<r;)t.push(new zk);for(;e.length<i;)e.push(new JD);for(let t=0;t<this.maxTextures;t++)this._tempBoundTextures[t]=null}onPrerender(){this._flushId=0}render(t){t._texture.valid&&(this._vertexCount+t.vertexData.length/2>this.size&&this.flush(),this._vertexCount+=t.vertexData.length/2,this._indexCount+=t.indices.length,this._bufferedTextures[this._bufferSize]=t._texture.baseTexture,this._bufferedElements[this._bufferSize++]=t)}buildTexturesAndDrawCalls(){const{_bufferedTextures:t,maxTextures:e}=this,r=QD._textureArrayPool,i=this.renderer.batch,n=this._tempBoundTextures,s=this.renderer.textureGC.count;let o=++Xk._globalBatch,a=0,h=r[0],l=0;i.copyBoundTextures(n,e);for(let c=0;c<this._bufferSize;++c){const u=t[c];t[c]=null,u._batchEnabled!==o&&(h.count>=e&&(i.boundArray(h,n,o,e),this.buildDrawCalls(h,l,c),l=c,h=r[++a],++o),u._batchEnabled=o,u.touched=s,h.elements[h.count++]=u)}h.count>0&&(i.boundArray(h,n,o,e),this.buildDrawCalls(h,l,this._bufferSize),++a,++o);for(let t=0;t<n.length;t++)n[t]=null;Xk._globalBatch=o}buildDrawCalls(t,e,r){const{_bufferedElements:i,_attributeBuffer:n,_indexBuffer:s,vertexSize:o}=this,a=QD._drawCallPool;let h=this._dcIndex,l=this._aIndex,c=this._iIndex,u=a[h];u.start=this._iIndex,u.texArray=t;for(let d=e;d<r;++d){const r=i[d],p=r._texture.baseTexture,f=ik[p.alphaMode?1:0][r.blendMode];i[d]=null,e<d&&u.blend!==f&&(u.size=c-u.start,e=d,u=a[++h],u.texArray=t,u.start=c),this.packInterleavedGeometry(r,n,s,l,c),l+=r.vertexData.length/2*o,c+=r.indices.length,u.blend=f}e<r&&(u.size=c-u.start,++h),this._dcIndex=h,this._aIndex=l,this._iIndex=c}bindAndClearTexArray(t){const e=this.renderer.texture;for(let r=0;r<t.count;r++)e.bind(t.elements[r],t.ids[r]),t.elements[r]=null;t.count=0}updateGeometry(){const{_packedGeometries:t,_attributeBuffer:e,_indexBuffer:r}=this;QD.canUploadSameBuffer?(t[this._flushId]._buffer.update(e.rawBinaryData),t[this._flushId]._indexBuffer.update(r),this.renderer.geometry.updateBuffers()):(this._packedGeometryPoolSize<=this._flushId&&(this._packedGeometryPoolSize++,t[this._flushId]=new this.geometryClass),t[this._flushId]._buffer.update(e.rawBinaryData),t[this._flushId]._indexBuffer.update(r),this.renderer.geometry.bind(t[this._flushId]),this.renderer.geometry.updateBuffers(),this._flushId++)}drawBatches(){const t=this._dcIndex,{gl:e,state:r}=this.renderer,i=QD._drawCallPool;let n=null;for(let s=0;s<t;s++){const{texArray:t,type:o,size:a,start:h,blend:l}=i[s];n!==t&&(n=t,this.bindAndClearTexArray(t)),this.state.blendMode=l,r.set(this.state),e.drawElements(o,a,e.UNSIGNED_SHORT,2*h)}}flush(){0!==this._vertexCount&&(this._attributeBuffer=this.getAttributeBuffer(this._vertexCount),this._indexBuffer=this.getIndexBuffer(this._indexCount),this._aIndex=0,this._iIndex=0,this._dcIndex=0,this.buildTexturesAndDrawCalls(),this.updateGeometry(),this.drawBatches(),this._bufferSize=0,this._vertexCount=0,this._indexCount=0)}start(){this.renderer.state.set(this.state),this.renderer.texture.ensureSamplerType(this.maxTextures),this.renderer.shader.bind(this._shader),QD.canUploadSameBuffer&&this.renderer.geometry.bind(this._packedGeometries[this._flushId])}stop(){this.flush()}destroy(){for(let t=0;t<this._packedGeometryPoolSize;t++)this._packedGeometries[t]&&this._packedGeometries[t].destroy();this.renderer.off("prerender",this.onPrerender,this),this._aBuffers=null,this._iBuffers=null,this._packedGeometries=null,this._attributeBuffer=null,this._indexBuffer=null,this._shader&&(this._shader.destroy(),this._shader=null),super.destroy()}getAttributeBuffer(t){const e=lk(Math.ceil(t/8)),r=uk(e),i=8*e;this._aBuffers.length<=r&&(this._iBuffers.length=r+1);let n=this._aBuffers[i];return n||(this._aBuffers[i]=n=new Dk(i*this.vertexSize*4)),n}getIndexBuffer(t){const e=lk(Math.ceil(t/12)),r=uk(e),i=12*e;this._iBuffers.length<=r&&(this._iBuffers.length=r+1);let n=this._iBuffers[r];return n||(this._iBuffers[r]=n=new Uint16Array(i)),n}packInterleavedGeometry(t,e,r,i,n){const{uint32View:s,float32View:o}=e,a=i/this.vertexSize,h=t.uvs,l=t.indices,c=t.vertexData,u=t._texture.baseTexture._batchLocation,d=Math.min(t.worldAlpha,1),p=QO.shared.setValue(t._tintRGB).toPremultiplied(d,t._texture.baseTexture.alphaMode>0);for(let t=0;t<c.length;t+=2)o[i++]=c[t],o[i++]=c[t+1],o[i++]=h[t],o[i++]=h[t+1],s[i++]=p,o[i++]=u;for(let t=0;t<l.length;t++)r[n++]=a+l[t]}};let tL=QD;tL.defaultBatchSize=4096,tL.extension={name:"batch",type:Ik.RendererPlugin},tL._drawCallPool=[],tL._textureArrayPool=[],kk.add(tL);const eL=class extends $D{constructor(t,e,r){super(zD.from(t||eL.defaultVertexSrc,e||eL.defaultFragmentSrc),r),this.padding=0,this.resolution=eL.defaultResolution,this.multisample=eL.defaultMultisample,this.enabled=!0,this.autoFit=!0,this.state=new Fk}apply(t,e,r,i,n){t.applyFilter(this,e,r,i)}get blendMode(){return this.state.blendMode}set blendMode(t){this.state.blendMode=t}get resolution(){return this._resolution}set resolution(t){this._resolution=t}static get defaultVertexSrc(){return"attribute vec2 aVertexPosition;\n\nuniform mat3 projectionMatrix;\n\nvarying vec2 vTextureCoord;\n\nuniform vec4 inputSize;\nuniform vec4 outputFrame;\n\nvec4 filterVertexPosition( void )\n{\n    vec2 position = aVertexPosition * max(outputFrame.zw, vec2(0.)) + outputFrame.xy;\n\n    return vec4((projectionMatrix * vec3(position, 1.0)).xy, 0.0, 1.0);\n}\n\nvec2 filterTextureCoord( void )\n{\n    return aVertexPosition * (outputFrame.zw * inputSize.zw);\n}\n\nvoid main(void)\n{\n    gl_Position = filterVertexPosition();\n    vTextureCoord = filterTextureCoord();\n}\n"}static get defaultFragmentSrc(){return"varying vec2 vTextureCoord;\n\nuniform sampler2D uSampler;\n\nvoid main(void){\n   gl_FragColor = texture2D(uSampler, vTextureCoord);\n}\n"}};let rL=eL;rL.defaultResolution=1,rL.defaultMultisample=CR.NONE;class iL{constructor(){this.clearBeforeRender=!0,this._backgroundColor=new QO(0),this.alpha=1}init(t){this.clearBeforeRender=t.clearBeforeRender;const{backgroundColor:e,background:r,backgroundAlpha:i}=t,n=r??e;void 0!==n&&(this.color=n),this.alpha=i}get color(){return this._backgroundColor.value}set color(t){this._backgroundColor.setValue(t)}get alpha(){return this._backgroundColor.alpha}set alpha(t){this._backgroundColor.setAlpha(t)}get backgroundColor(){return this._backgroundColor}destroy(){}}iL.defaultOptions={backgroundAlpha:1,backgroundColor:0,clearBeforeRender:!0},iL.extension={type:[Ik.RendererSystem,Ik.CanvasRendererSystem],name:"background"},kk.add(iL);class nL{constructor(t){this.renderer=t,this.emptyRenderer=new qD(t),this.currentRenderer=this.emptyRenderer}setObjectRenderer(t){this.currentRenderer!==t&&(this.currentRenderer.stop(),this.currentRenderer=t,this.currentRenderer.start())}flush(){this.setObjectRenderer(this.emptyRenderer)}reset(){this.setObjectRenderer(this.emptyRenderer)}copyBoundTextures(t,e){const{boundTextures:r}=this.renderer.texture;for(let i=e-1;i>=0;--i)t[i]=r[i]||null,t[i]&&(t[i]._batchLocation=i)}boundArray(t,e,r,i){const{elements:n,ids:s,count:o}=t;let a=0;for(let t=0;t<o;t++){const o=n[t],h=o._batchLocation;if(h>=0&&h<i&&e[h]===o)s[t]=h;else for(;a<i;){const i=e[a];if(!i||i._batchEnabled!==r||i._batchLocation!==a){s[t]=a,o._batchLocation=a,e[a]=o;break}a++}}}destroy(){this.renderer=null}}nL.extension={type:Ik.RendererSystem,name:"batch"},kk.add(nL);let sL=0;class oL{constructor(t){this.renderer=t,this.webGLVersion=1,this.extensions={},this.supports={uint32Indices:!1},this.handleContextLost=this.handleContextLost.bind(this),this.handleContextRestored=this.handleContextRestored.bind(this)}get isLost(){return!this.gl||this.gl.isContextLost()}contextChange(t){this.gl=t,this.renderer.gl=t,this.renderer.CONTEXT_UID=sL++}init(t){if(t.context)this.initFromContext(t.context);else{const e=this.renderer.background.alpha<1,r=t.premultipliedAlpha;this.preserveDrawingBuffer=t.preserveDrawingBuffer,this.useContextAlpha=t.useContextAlpha,this.powerPreference=t.powerPreference,this.initFromOptions({alpha:e,premultipliedAlpha:r,antialias:t.antialias,stencil:!0,preserveDrawingBuffer:t.preserveDrawingBuffer,powerPreference:t.powerPreference})}}initFromContext(t){this.gl=t,this.validateContext(t),this.renderer.gl=t,this.renderer.CONTEXT_UID=sL++,this.renderer.runners.contextChange.emit(t);const e=this.renderer.view;void 0!==e.addEventListener&&(e.addEventListener("webglcontextlost",this.handleContextLost,!1),e.addEventListener("webglcontextrestored",this.handleContextRestored,!1))}initFromOptions(t){const e=this.createContext(this.renderer.view,t);this.initFromContext(e)}createContext(t,e){let r;if(PR.PREFER_ENV>=lR.WEBGL2&&(r=t.getContext("webgl2",e)),r)this.webGLVersion=2;else if(this.webGLVersion=1,r=t.getContext("webgl",e)||t.getContext("experimental-webgl",e),!r)throw new Error("This browser does not support WebGL. Try using the canvas renderer");return this.gl=r,this.getExtensions(),this.gl}getExtensions(){const{gl:t}=this,e={loseContext:t.getExtension("WEBGL_lose_context"),anisotropicFiltering:t.getExtension("EXT_texture_filter_anisotropic"),floatTextureLinear:t.getExtension("OES_texture_float_linear"),s3tc:t.getExtension("WEBGL_compressed_texture_s3tc"),s3tc_sRGB:t.getExtension("WEBGL_compressed_texture_s3tc_srgb"),etc:t.getExtension("WEBGL_compressed_texture_etc"),etc1:t.getExtension("WEBGL_compressed_texture_etc1"),pvrtc:t.getExtension("WEBGL_compressed_texture_pvrtc")||t.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc"),atc:t.getExtension("WEBGL_compressed_texture_atc"),astc:t.getExtension("WEBGL_compressed_texture_astc")};1===this.webGLVersion?Object.assign(this.extensions,e,{drawBuffers:t.getExtension("WEBGL_draw_buffers"),depthTexture:t.getExtension("WEBGL_depth_texture"),vertexArrayObject:t.getExtension("OES_vertex_array_object")||t.getExtension("MOZ_OES_vertex_array_object")||t.getExtension("WEBKIT_OES_vertex_array_object"),uint32ElementIndex:t.getExtension("OES_element_index_uint"),floatTexture:t.getExtension("OES_texture_float"),floatTextureLinear:t.getExtension("OES_texture_float_linear"),textureHalfFloat:t.getExtension("OES_texture_half_float"),textureHalfFloatLinear:t.getExtension("OES_texture_half_float_linear")}):2===this.webGLVersion&&Object.assign(this.extensions,e,{colorBufferFloat:t.getExtension("EXT_color_buffer_float")})}handleContextLost(t){t.preventDefault(),setTimeout((()=>{this.gl.isContextLost()&&this.extensions.loseContext&&this.extensions.loseContext.restoreContext()}),0)}handleContextRestored(){this.renderer.runners.contextChange.emit(this.gl)}destroy(){const t=this.renderer.view;this.renderer=null,void 0!==t.removeEventListener&&(t.removeEventListener("webglcontextlost",this.handleContextLost),t.removeEventListener("webglcontextrestored",this.handleContextRestored)),this.gl.useProgram(null),this.extensions.loseContext&&this.extensions.loseContext.loseContext()}postrender(){this.renderer.objectRenderer.renderingToScreen&&this.gl.flush()}validateContext(t){const e=t.getContextAttributes(),r="WebGL2RenderingContext"in globalThis&&t instanceof globalThis.WebGL2RenderingContext;r&&(this.webGLVersion=2),e&&!e.stencil&&console.warn("Provided WebGL context does not have a stencil buffer, masks may not render correctly");const i=r||!!t.getExtension("OES_element_index_uint");this.supports.uint32Indices=i,i||console.warn("Provided WebGL context does not support 32 index buffer, complex graphics may not render correctly")}}oL.defaultOptions={context:null,antialias:!1,premultipliedAlpha:!0,preserveDrawingBuffer:!1,powerPreference:"default"},oL.extension={type:Ik.RendererSystem,name:"context"},kk.add(oL);class aL extends Vk{upload(t,e,r){const i=t.gl;i.pixelStorei(i.UNPACK_PREMULTIPLY_ALPHA_WEBGL,e.alphaMode===xR.UNPACK);const n=e.realWidth,s=e.realHeight;return r.width===n&&r.height===s?i.texSubImage2D(e.target,0,0,0,n,s,e.format,r.type,this.data):(r.width=n,r.height=s,i.texImage2D(e.target,0,r.internalFormat,n,s,0,e.format,r.type,this.data)),!0}}class hL{constructor(t,e){this.width=Math.round(t||100),this.height=Math.round(e||100),this.stencil=!1,this.depth=!1,this.dirtyId=0,this.dirtyFormat=0,this.dirtySize=0,this.depthTexture=null,this.colorTextures=[],this.glFramebuffers={},this.disposeRunner=new Gk("disposeFramebuffer"),this.multisample=CR.NONE}get colorTexture(){return this.colorTextures[0]}addColorTexture(t=0,e){return this.colorTextures[t]=e||new Xk(null,{scaleMode:yR.NEAREST,resolution:1,mipmap:_R.OFF,width:this.width,height:this.height}),this.dirtyId++,this.dirtyFormat++,this}addDepthTexture(t){return this.depthTexture=t||new Xk(new aL(null,{width:this.width,height:this.height}),{scaleMode:yR.NEAREST,resolution:1,width:this.width,height:this.height,mipmap:_R.OFF,format:fR.DEPTH_COMPONENT,type:gR.UNSIGNED_SHORT}),this.dirtyId++,this.dirtyFormat++,this}enableDepth(){return this.depth=!0,this.dirtyId++,this.dirtyFormat++,this}enableStencil(){return this.stencil=!0,this.dirtyId++,this.dirtyFormat++,this}resize(t,e){if(t=Math.round(t),e=Math.round(e),t!==this.width||e!==this.height){this.width=t,this.height=e,this.dirtyId++,this.dirtySize++;for(let r=0;r<this.colorTextures.length;r++){const i=this.colorTextures[r],n=i.resolution;i.setSize(t/n,e/n)}if(this.depthTexture){const r=this.depthTexture.resolution;this.depthTexture.setSize(t/r,e/r)}}}dispose(){this.disposeRunner.emit(this,!1)}destroyDepthTexture(){this.depthTexture&&(this.depthTexture.destroy(),this.depthTexture=null,++this.dirtyId,++this.dirtyFormat)}}class lL extends Xk{constructor(t={}){if("number"==typeof t){t={width:arguments[0],height:arguments[1],scaleMode:arguments[2],resolution:arguments[3]}}t.width=t.width||100,t.height=t.height||100,t.multisample??(t.multisample=CR.NONE),super(null,t),this.mipmap=_R.OFF,this.valid=!0,this._clear=new QO([0,0,0,0]),this.framebuffer=new hL(this.realWidth,this.realHeight).addColorTexture(0,this),this.framebuffer.multisample=t.multisample,this.maskStack=[],this.filterStack=[{}]}set clearColor(t){this._clear.setValue(t)}get clearColor(){return this._clear.value}get clear(){return this._clear}resize(t,e){this.framebuffer.resize(t*this.resolution,e*this.resolution),this.setRealSize(this.framebuffer.width,this.framebuffer.height)}dispose(){this.framebuffer.dispose(),super.dispose()}destroy(){super.destroy(),this.framebuffer.destroyDepthTexture(),this.framebuffer=null}}class cL extends jk{constructor(t){const e=t;super(e.naturalWidth||e.videoWidth||e.width,e.naturalHeight||e.videoHeight||e.height),this.source=t,this.noSubImage=!1}static crossOrigin(t,e,r){void 0!==r||e.startsWith("data:")?!1!==r&&(t.crossOrigin="string"==typeof r?r:"anonymous"):t.crossOrigin=Ak(e)}upload(t,e,r,i){const n=t.gl,s=e.realWidth,o=e.realHeight;if(i=i||this.source,"undefined"!=typeof HTMLImageElement&&i instanceof HTMLImageElement){if(!i.complete||0===i.naturalWidth)return!1}else if("undefined"!=typeof HTMLVideoElement&&i instanceof HTMLVideoElement&&i.readyState<=1&&0===i.buffered.length)return!1;return n.pixelStorei(n.UNPACK_PREMULTIPLY_ALPHA_WEBGL,e.alphaMode===xR.UNPACK),this.noSubImage||e.target!==n.TEXTURE_2D||r.width!==s||r.height!==o?(r.width=s,r.height=o,n.texImage2D(e.target,0,r.internalFormat,e.format,r.type,i)):n.texSubImage2D(n.TEXTURE_2D,0,0,0,e.format,r.type,i),!0}update(){if(this.destroyed)return;const t=this.source,e=t.naturalWidth||t.videoWidth||t.width,r=t.naturalHeight||t.videoHeight||t.height;this.resize(e,r),super.update()}dispose(){this.source=null}}class uL extends cL{constructor(t,e){if(e=e||{},"string"==typeof t){const r=new Image;cL.crossOrigin(r,t,e.crossorigin),r.src=t,t=r}super(t),!t.complete&&this._width&&this._height&&(this._width=0,this._height=0),this.url=t.src,this._process=null,this.preserveBitmap=!1,this.createBitmap=(e.createBitmap??PR.CREATE_IMAGE_BITMAP)&&!!globalThis.createImageBitmap,this.alphaMode="number"==typeof e.alphaMode?e.alphaMode:null,this.bitmap=null,this._load=null,!1!==e.autoLoad&&this.load()}load(t){return this._load||(void 0!==t&&(this.createBitmap=t),this._load=new Promise(((t,e)=>{const r=this.source;this.url=r.src;const i=()=>{this.destroyed||(r.onload=null,r.onerror=null,this.resize(r.width,r.height),this._load=null,this.createBitmap?t(this.process()):t(this))};r.complete&&r.src?i():(r.onload=i,r.onerror=t=>{e(t),this.onError.emit(t)})}))),this._load}process(){const t=this.source;if(null!==this._process)return this._process;if(null!==this.bitmap||!globalThis.createImageBitmap)return Promise.resolve(this);const e=globalThis.createImageBitmap,r=!t.crossOrigin||"anonymous"===t.crossOrigin;return this._process=fetch(t.src,{mode:r?"cors":"no-cors"}).then((t=>t.blob())).then((r=>e(r,0,0,t.width,t.height,{premultiplyAlpha:null===this.alphaMode||this.alphaMode===xR.UNPACK?"premultiply":"none"}))).then((t=>this.destroyed?Promise.reject():(this.bitmap=t,this.update(),this._process=null,Promise.resolve(this)))),this._process}upload(t,e,r){if("number"==typeof this.alphaMode&&(e.alphaMode=this.alphaMode),!this.createBitmap)return super.upload(t,e,r);if(!this.bitmap&&(this.process(),!this.bitmap))return!1;if(super.upload(t,e,r,this.bitmap),!this.preserveBitmap){let t=!0;const i=e._glTextures;for(const n in i){const s=i[n];if(s!==r&&s.dirtyId!==e.dirtyId){t=!1;break}}t&&(this.bitmap.close&&this.bitmap.close(),this.bitmap=null)}return!0}dispose(){this.source.onload=null,this.source.onerror=null,super.dispose(),this.bitmap&&(this.bitmap.close(),this.bitmap=null),this._process=null,this._load=null}static test(t){return"undefined"!=typeof HTMLImageElement&&("string"==typeof t||t instanceof HTMLImageElement)}}class dL{constructor(){this.x0=0,this.y0=0,this.x1=1,this.y1=0,this.x2=1,this.y2=1,this.x3=0,this.y3=1,this.uvsFloat32=new Float32Array(8)}set(t,e,r){const i=e.width,n=e.height;if(r){const e=t.width/2/i,s=t.height/2/n,o=t.x/i+e,a=t.y/n+s;r=xD.add(r,xD.NW),this.x0=o+e*xD.uX(r),this.y0=a+s*xD.uY(r),r=xD.add(r,2),this.x1=o+e*xD.uX(r),this.y1=a+s*xD.uY(r),r=xD.add(r,2),this.x2=o+e*xD.uX(r),this.y2=a+s*xD.uY(r),r=xD.add(r,2),this.x3=o+e*xD.uX(r),this.y3=a+s*xD.uY(r)}else this.x0=t.x/i,this.y0=t.y/n,this.x1=(t.x+t.width)/i,this.y1=t.y/n,this.x2=(t.x+t.width)/i,this.y2=(t.y+t.height)/n,this.x3=t.x/i,this.y3=(t.y+t.height)/n;this.uvsFloat32[0]=this.x0,this.uvsFloat32[1]=this.y0,this.uvsFloat32[2]=this.x1,this.uvsFloat32[3]=this.y1,this.uvsFloat32[4]=this.x2,this.uvsFloat32[5]=this.y2,this.uvsFloat32[6]=this.x3,this.uvsFloat32[7]=this.y3}toString(){return`[@pixi/core:TextureUvs x0=${this.x0} y0=${this.y0} x1=${this.x1} y1=${this.y1} x2=${this.x2} y2=${this.y2} x3=${this.x3} y3=${this.y3}]`}}const pL=new dL;function fL(t){t.destroy=function(){},t.on=function(){},t.once=function(){},t.emit=function(){}}class mL extends $R{constructor(t,e,r,i,n,s,o){if(super(),this.noFrame=!1,e||(this.noFrame=!0,e=new hD(0,0,1,1)),t instanceof mL&&(t=t.baseTexture),this.baseTexture=t,this._frame=e,this.trim=i,this.valid=!1,this._uvs=pL,this.uvMatrix=null,this.orig=r||e,this._rotate=Number(n||0),!0===n)this._rotate=2;else if(this._rotate%2!=0)throw new Error("attempt to use diamond-shaped UVs. If you are sure, set rotation manually");this.defaultAnchor=s?new oD(s.x,s.y):new oD(0,0),this.defaultBorders=o,this._updateID=0,this.textureCacheIds=[],t.valid?this.noFrame?t.valid&&this.onBaseTextureUpdated(t):this.frame=e:t.once("loaded",this.onBaseTextureUpdated,this),this.noFrame&&t.on("update",this.onBaseTextureUpdated,this)}update(){this.baseTexture.resource&&this.baseTexture.resource.update()}onBaseTextureUpdated(t){if(this.noFrame){if(!this.baseTexture.valid)return;this._frame.width=t.width,this._frame.height=t.height,this.valid=!0,this.updateUvs()}else this.frame=this._frame;this.emit("update",this)}destroy(t){if(this.baseTexture){if(t){const{resource:t}=this.baseTexture;t?.url&&bk[t.url]&&mL.removeFromCache(t.url),this.baseTexture.destroy()}this.baseTexture.off("loaded",this.onBaseTextureUpdated,this),this.baseTexture.off("update",this.onBaseTextureUpdated,this),this.baseTexture=null}this._frame=null,this._uvs=null,this.trim=null,this.orig=null,this.valid=!1,mL.removeFromCache(this),this.textureCacheIds=null}clone(){const t=this._frame.clone(),e=this._frame===this.orig?t:this.orig.clone(),r=new mL(this.baseTexture,!this.noFrame&&t,e,this.trim?.clone(),this.rotate,this.defaultAnchor,this.defaultBorders);return this.noFrame&&(r._frame=t),r}updateUvs(){this._uvs===pL&&(this._uvs=new dL),this._uvs.set(this._frame,this.baseTexture,this.rotate),this._updateID++}static from(t,e={},r=PR.STRICT_TEXTURE_CACHE){const i="string"==typeof t;let n=null;if(i)n=t;else if(t instanceof Xk){if(!t.cacheId){const r=e?.pixiIdPrefix||"pixiid";t.cacheId=`${r}-${mk()}`,Xk.addToCache(t,t.cacheId)}n=t.cacheId}else{if(!t._pixiId){const r=e?.pixiIdPrefix||"pixiid";t._pixiId=`${r}_${mk()}`}n=t._pixiId}let s=bk[n];if(i&&r&&!s)throw new Error(`The cacheId "${n}" does not exist in TextureCache.`);return s||t instanceof Xk?!s&&t instanceof Xk&&(s=new mL(t),mL.addToCache(s,n)):(e.resolution||(e.resolution=Rk(t)),s=new mL(new Xk(t,e)),s.baseTexture.cacheId=n,Xk.addToCache(s.baseTexture,n),mL.addToCache(s,n)),s}static fromURL(t,e){const r=Object.assign({autoLoad:!1},e?.resourceOptions),i=mL.from(t,Object.assign({resourceOptions:r},e),!1),n=i.baseTexture.resource;return i.baseTexture.valid?Promise.resolve(i):n.load().then((()=>Promise.resolve(i)))}static fromBuffer(t,e,r,i){return new mL(Xk.fromBuffer(t,e,r,i))}static fromLoader(t,e,r,i){const n=new Xk(t,Object.assign({scaleMode:Xk.defaultOptions.scaleMode,resolution:Rk(e)},i)),{resource:s}=n;s instanceof uL&&(s.url=e);const o=new mL(n);return r||(r=e),Xk.addToCache(o.baseTexture,r),mL.addToCache(o,r),r!==e&&(Xk.addToCache(o.baseTexture,e),mL.addToCache(o,e)),o.baseTexture.valid?Promise.resolve(o):new Promise((t=>{o.baseTexture.once("loaded",(()=>t(o)))}))}static addToCache(t,e){e&&(t.textureCacheIds.includes(e)||t.textureCacheIds.push(e),bk[e]&&bk[e]!==t&&console.warn(`Texture added to the cache with an id [${e}] that already had an entry`),bk[e]=t)}static removeFromCache(t){if("string"==typeof t){const e=bk[t];if(e){const r=e.textureCacheIds.indexOf(t);return r>-1&&e.textureCacheIds.splice(r,1),delete bk[t],e}}else if(t?.textureCacheIds){for(let e=0;e<t.textureCacheIds.length;++e)bk[t.textureCacheIds[e]]===t&&delete bk[t.textureCacheIds[e]];return t.textureCacheIds.length=0,t}return null}get resolution(){return this.baseTexture.resolution}get frame(){return this._frame}set frame(t){this._frame=t,this.noFrame=!1;const{x:e,y:r,width:i,height:n}=t,s=e+i>this.baseTexture.width,o=r+n>this.baseTexture.height;if(s||o){const t=s&&o?"and":"or",a=`X: ${e} + ${i} = ${e+i} > ${this.baseTexture.width}`,h=`Y: ${r} + ${n} = ${r+n} > ${this.baseTexture.height}`;throw new Error(`Texture Error: frame does not fit inside the base Texture dimensions: ${a} ${t} ${h}`)}this.valid=i&&n&&this.baseTexture.valid,this.trim||this.rotate||(this.orig=t),this.valid&&this.updateUvs()}get rotate(){return this._rotate}set rotate(t){this._rotate=t,this.valid&&this.updateUvs()}get width(){return this.orig.width}get height(){return this.orig.height}castToBaseTexture(){return this.baseTexture}static get EMPTY(){return mL._EMPTY||(mL._EMPTY=new mL(new Xk),fL(mL._EMPTY),fL(mL._EMPTY.baseTexture)),mL._EMPTY}static get WHITE(){if(!mL._WHITE){const t=PR.ADAPTER.createCanvas(16,16),e=t.getContext("2d");t.width=16,t.height=16,e.fillStyle="white",e.fillRect(0,0,16,16),mL._WHITE=new mL(Xk.from(t)),fL(mL._WHITE),fL(mL._WHITE.baseTexture)}return mL._WHITE}}class gL extends mL{constructor(t,e){super(t,e),this.valid=!0,this.filterFrame=null,this.filterPoolKey=null,this.updateUvs()}get framebuffer(){return this.baseTexture.framebuffer}get multisample(){return this.framebuffer.multisample}set multisample(t){this.framebuffer.multisample=t}resize(t,e,r=!0){const i=this.baseTexture.resolution,n=Math.round(t*i)/i,s=Math.round(e*i)/i;this.valid=n>0&&s>0,this._frame.width=this.orig.width=n,this._frame.height=this.orig.height=s,r&&this.baseTexture.resize(n,s),this.updateUvs()}setResolution(t){const{baseTexture:e}=this;e.resolution!==t&&(e.setResolution(t),this.resize(e.width,e.height,!1))}static create(t){return new gL(new lL(t))}}class vL{constructor(t){this.texturePool={},this.textureOptions=t||{},this.enableFullScreen=!1,this._pixelsWidth=0,this._pixelsHeight=0}createTexture(t,e,r=CR.NONE){const i=new lL(Object.assign({width:t,height:e,resolution:1,multisample:r},this.textureOptions));return new gL(i)}getOptimalTexture(t,e,r=1,i=CR.NONE){let n;t=Math.ceil(t*r-1e-6),e=Math.ceil(e*r-1e-6),this.enableFullScreen&&t===this._pixelsWidth&&e===this._pixelsHeight?n=i>1?-i:-1:(n=((65535&(t=lk(t)))<<16|65535&(e=lk(e)))>>>0,i>1&&(n+=4294967296*i)),this.texturePool[n]||(this.texturePool[n]=[]);let s=this.texturePool[n].pop();return s||(s=this.createTexture(t,e,i)),s.filterPoolKey=n,s.setResolution(r),s}getFilterTexture(t,e,r){const i=this.getOptimalTexture(t.width,t.height,e||t.resolution,r||CR.NONE);return i.filterFrame=t.filterFrame,i}returnTexture(t){const e=t.filterPoolKey;t.filterFrame=null,this.texturePool[e].push(t)}returnFilterTexture(t){this.returnTexture(t)}clear(t){if(t=!1!==t)for(const t in this.texturePool){const e=this.texturePool[t];if(e)for(let t=0;t<e.length;t++)e[t].destroy(!0)}this.texturePool={}}setScreenSize(t){if(t.width!==this._pixelsWidth||t.height!==this._pixelsHeight){this.enableFullScreen=t.width>0&&t.height>0;for(const t in this.texturePool){if(!(Number(t)<0))continue;const e=this.texturePool[t];if(e)for(let t=0;t<e.length;t++)e[t].destroy(!0);this.texturePool[t]=[]}this._pixelsWidth=t.width,this._pixelsHeight=t.height}}}vL.SCREEN_KEY=-1;class yL extends tD{constructor(){super(),this.addAttribute("aVertexPosition",new Float32Array([0,0,1,0,1,1,0,1])).addIndex([0,1,3,2])}}class bL extends tD{constructor(){super(),this.vertices=new Float32Array([-1,-1,1,-1,1,1,-1,1]),this.uvs=new Float32Array([0,0,1,0,1,1,0,1]),this.vertexBuffer=new Zk(this.vertices),this.uvBuffer=new Zk(this.uvs),this.addAttribute("aVertexPosition",this.vertexBuffer).addAttribute("aTextureCoord",this.uvBuffer).addIndex([0,1,2,0,2,3])}map(t,e){let r=0,i=0;return this.uvs[0]=r,this.uvs[1]=i,this.uvs[2]=r+e.width/t.width,this.uvs[3]=i,this.uvs[4]=r+e.width/t.width,this.uvs[5]=i+e.height/t.height,this.uvs[6]=r,this.uvs[7]=i+e.height/t.height,r=e.x,i=e.y,this.vertices[0]=r,this.vertices[1]=i,this.vertices[2]=r+e.width,this.vertices[3]=i,this.vertices[4]=r+e.width,this.vertices[5]=i+e.height,this.vertices[6]=r,this.vertices[7]=i+e.height,this.invalidate(),this}invalidate(){return this.vertexBuffer._updateID++,this.uvBuffer._updateID++,this}}class _L{constructor(){this.renderTexture=null,this.target=null,this.legacy=!1,this.resolution=1,this.multisample=CR.NONE,this.sourceFrame=new hD,this.destinationFrame=new hD,this.bindingSourceFrame=new hD,this.bindingDestinationFrame=new hD,this.filters=[],this.transform=null}clear(){this.target=null,this.filters=null,this.renderTexture=null}}const xL=[new oD,new oD,new oD,new oD],TL=new pD;class wL{constructor(t){this.renderer=t,this.defaultFilterStack=[{}],this.texturePool=new vL,this.statePool=[],this.quad=new yL,this.quadUv=new bL,this.tempRect=new hD,this.activeState={},this.globalUniforms=new ZD({outputFrame:new hD,inputSize:new Float32Array(4),inputPixel:new Float32Array(4),inputClamp:new Float32Array(4),resolution:1,filterArea:new Float32Array(4),filterClamp:new Float32Array(4)},!0),this.forceClear=!1,this.useMaxPadding=!1}init(){this.texturePool.setScreenSize(this.renderer.view)}push(t,e){const r=this.renderer,i=this.defaultFilterStack,n=this.statePool.pop()||new _L,s=this.renderer.renderTexture;let o=e[0].resolution,a=e[0].multisample,h=e[0].padding,l=e[0].autoFit,c=e[0].legacy??!0;for(let t=1;t<e.length;t++){const r=e[t];o=Math.min(o,r.resolution),a=Math.min(a,r.multisample),h=this.useMaxPadding?Math.max(h,r.padding):h+r.padding,l=l&&r.autoFit,c=c||(r.legacy??!0)}1===i.length&&(this.defaultFilterStack[0].renderTexture=s.current),i.push(n),n.resolution=o,n.multisample=a,n.legacy=c,n.target=t,n.sourceFrame.copyFrom(t.filterArea||t.getBounds(!0)),n.sourceFrame.pad(h);const u=this.tempRect.copyFrom(s.sourceFrame);r.projection.transform&&this.transformAABB(TL.copyFrom(r.projection.transform).invert(),u),l?(n.sourceFrame.fit(u),(n.sourceFrame.width<=0||n.sourceFrame.height<=0)&&(n.sourceFrame.width=0,n.sourceFrame.height=0)):n.sourceFrame.intersects(u)||(n.sourceFrame.width=0,n.sourceFrame.height=0),this.roundFrame(n.sourceFrame,s.current?s.current.resolution:r.resolution,s.sourceFrame,s.destinationFrame,r.projection.transform),n.renderTexture=this.getOptimalFilterTexture(n.sourceFrame.width,n.sourceFrame.height,o,a),n.filters=e,n.destinationFrame.width=n.renderTexture.width,n.destinationFrame.height=n.renderTexture.height;const d=this.tempRect;d.x=0,d.y=0,d.width=n.sourceFrame.width,d.height=n.sourceFrame.height,n.renderTexture.filterFrame=n.sourceFrame,n.bindingSourceFrame.copyFrom(s.sourceFrame),n.bindingDestinationFrame.copyFrom(s.destinationFrame),n.transform=r.projection.transform,r.projection.transform=null,s.bind(n.renderTexture,n.sourceFrame,d),r.framebuffer.clear(0,0,0,0)}pop(){const t=this.defaultFilterStack,e=t.pop(),r=e.filters;this.activeState=e;const i=this.globalUniforms.uniforms;i.outputFrame=e.sourceFrame,i.resolution=e.resolution;const n=i.inputSize,s=i.inputPixel,o=i.inputClamp;if(n[0]=e.destinationFrame.width,n[1]=e.destinationFrame.height,n[2]=1/n[0],n[3]=1/n[1],s[0]=Math.round(n[0]*e.resolution),s[1]=Math.round(n[1]*e.resolution),s[2]=1/s[0],s[3]=1/s[1],o[0]=.5*s[2],o[1]=.5*s[3],o[2]=e.sourceFrame.width*n[2]-.5*s[2],o[3]=e.sourceFrame.height*n[3]-.5*s[3],e.legacy){const t=i.filterArea;t[0]=e.destinationFrame.width,t[1]=e.destinationFrame.height,t[2]=e.sourceFrame.x,t[3]=e.sourceFrame.y,i.filterClamp=i.inputClamp}this.globalUniforms.update();const a=t[t.length-1];if(this.renderer.framebuffer.blit(),1===r.length)r[0].apply(this,e.renderTexture,a.renderTexture,TR.BLEND,e),this.returnFilterTexture(e.renderTexture);else{let t=e.renderTexture,i=this.getOptimalFilterTexture(t.width,t.height,e.resolution);i.filterFrame=t.filterFrame;let n=0;for(n=0;n<r.length-1;++n){1===n&&e.multisample>1&&(i=this.getOptimalFilterTexture(t.width,t.height,e.resolution),i.filterFrame=t.filterFrame),r[n].apply(this,t,i,TR.CLEAR,e);const s=t;t=i,i=s}r[n].apply(this,t,a.renderTexture,TR.BLEND,e),n>1&&e.multisample>1&&this.returnFilterTexture(e.renderTexture),this.returnFilterTexture(t),this.returnFilterTexture(i)}e.clear(),this.statePool.push(e)}bindAndClear(t,e=TR.CLEAR){const{renderTexture:r,state:i}=this.renderer;if(t===this.defaultFilterStack[this.defaultFilterStack.length-1].renderTexture?this.renderer.projection.transform=this.activeState.transform:this.renderer.projection.transform=null,t?.filterFrame){const e=this.tempRect;e.x=0,e.y=0,e.width=t.filterFrame.width,e.height=t.filterFrame.height,r.bind(t,t.filterFrame,e)}else t!==this.defaultFilterStack[this.defaultFilterStack.length-1].renderTexture?r.bind(t):this.renderer.renderTexture.bind(t,this.activeState.bindingSourceFrame,this.activeState.bindingDestinationFrame);const n=1&i.stateId||this.forceClear;(e===TR.CLEAR||e===TR.BLIT&&n)&&this.renderer.framebuffer.clear(0,0,0,0)}applyFilter(t,e,r,i){const n=this.renderer;n.state.set(t.state),this.bindAndClear(r,i),t.uniforms.uSampler=e,t.uniforms.filterGlobals=this.globalUniforms,n.shader.bind(t),t.legacy=!!t.program.attributeData.aTextureCoord,t.legacy?(this.quadUv.map(e._frame,e.filterFrame),n.geometry.bind(this.quadUv),n.geometry.draw(pR.TRIANGLES)):(n.geometry.bind(this.quad),n.geometry.draw(pR.TRIANGLE_STRIP))}calculateSpriteMatrix(t,e){const{sourceFrame:r,destinationFrame:i}=this.activeState,{orig:n}=e._texture,s=t.set(i.width,0,0,i.height,r.x,r.y),o=e.worldTransform.copyTo(pD.TEMP_MATRIX);return o.invert(),s.prepend(o),s.scale(1/n.width,1/n.height),s.translate(e.anchor.x,e.anchor.y),s}destroy(){this.renderer=null,this.texturePool.clear(!1)}getOptimalFilterTexture(t,e,r=1,i=CR.NONE){return this.texturePool.getOptimalTexture(t,e,r,i)}getFilterTexture(t,e,r){if("number"==typeof t){const r=t;t=e,e=r}t=t||this.activeState.renderTexture;const i=this.texturePool.getOptimalTexture(t.width,t.height,e||t.resolution,r||CR.NONE);return i.filterFrame=t.filterFrame,i}returnFilterTexture(t){this.texturePool.returnTexture(t)}emptyPool(){this.texturePool.clear(!0)}resize(){this.texturePool.setScreenSize(this.renderer.view)}transformAABB(t,e){const r=xL[0],i=xL[1],n=xL[2],s=xL[3];r.set(e.left,e.top),i.set(e.left,e.bottom),n.set(e.right,e.top),s.set(e.right,e.bottom),t.apply(r,r),t.apply(i,i),t.apply(n,n),t.apply(s,s);const o=Math.min(r.x,i.x,n.x,s.x),a=Math.min(r.y,i.y,n.y,s.y),h=Math.max(r.x,i.x,n.x,s.x),l=Math.max(r.y,i.y,n.y,s.y);e.x=o,e.y=a,e.width=h-o,e.height=l-a}roundFrame(t,e,r,i,n){if(!(t.width<=0||t.height<=0||r.width<=0||r.height<=0)){if(n){const{a:t,b:e,c:r,d:i}=n;if((Math.abs(e)>1e-4||Math.abs(r)>1e-4)&&(Math.abs(t)>1e-4||Math.abs(i)>1e-4))return}(n=n?TL.copyFrom(n):TL.identity()).translate(-r.x,-r.y).scale(i.width/r.width,i.height/r.height).translate(i.x,i.y),this.transformAABB(n,t),t.ceil(e),this.transformAABB(n.invert(),t)}}}wL.extension={type:Ik.RendererSystem,name:"filter"},kk.add(wL);class SL{constructor(t){this.framebuffer=t,this.stencil=null,this.dirtyId=-1,this.dirtyFormat=-1,this.dirtySize=-1,this.multisample=CR.NONE,this.msaaBuffer=null,this.blitFramebuffer=null,this.mipLevel=0}}const EL=new hD;class CL{constructor(t){this.renderer=t,this.managedFramebuffers=[],this.unknownFramebuffer=new hL(10,10),this.msaaSamples=null}contextChange(){this.disposeAll(!0);const t=this.gl=this.renderer.gl;if(this.CONTEXT_UID=this.renderer.CONTEXT_UID,this.current=this.unknownFramebuffer,this.viewport=new hD,this.hasMRT=!0,this.writeDepthTexture=!0,1===this.renderer.context.webGLVersion){let e=this.renderer.context.extensions.drawBuffers,r=this.renderer.context.extensions.depthTexture;PR.PREFER_ENV===lR.WEBGL_LEGACY&&(e=null,r=null),e?t.drawBuffers=t=>e.drawBuffersWEBGL(t):(this.hasMRT=!1,t.drawBuffers=()=>{}),r||(this.writeDepthTexture=!1)}else this.msaaSamples=t.getInternalformatParameter(t.RENDERBUFFER,t.RGBA8,t.SAMPLES)}bind(t,e,r=0){const{gl:i}=this;if(t){const n=t.glFramebuffers[this.CONTEXT_UID]||this.initFramebuffer(t);this.current!==t&&(this.current=t,i.bindFramebuffer(i.FRAMEBUFFER,n.framebuffer)),n.mipLevel!==r&&(t.dirtyId++,t.dirtyFormat++,n.mipLevel=r),n.dirtyId!==t.dirtyId&&(n.dirtyId=t.dirtyId,n.dirtyFormat!==t.dirtyFormat?(n.dirtyFormat=t.dirtyFormat,n.dirtySize=t.dirtySize,this.updateFramebuffer(t,r)):n.dirtySize!==t.dirtySize&&(n.dirtySize=t.dirtySize,this.resizeFramebuffer(t)));for(let e=0;e<t.colorTextures.length;e++){const r=t.colorTextures[e];this.renderer.texture.unbind(r.parentTextureArray||r)}if(t.depthTexture&&this.renderer.texture.unbind(t.depthTexture),e){const t=e.width>>r,i=e.height>>r,n=t/e.width;this.setViewport(e.x*n,e.y*n,t,i)}else{const e=t.width>>r,i=t.height>>r;this.setViewport(0,0,e,i)}}else this.current&&(this.current=null,i.bindFramebuffer(i.FRAMEBUFFER,null)),e?this.setViewport(e.x,e.y,e.width,e.height):this.setViewport(0,0,this.renderer.width,this.renderer.height)}setViewport(t,e,r,i){const n=this.viewport;t=Math.round(t),e=Math.round(e),r=Math.round(r),i=Math.round(i),n.width===r&&n.height===i&&n.x===t&&n.y===e||(n.x=t,n.y=e,n.width=r,n.height=i,this.gl.viewport(t,e,r,i))}get size(){return this.current?{x:0,y:0,width:this.current.width,height:this.current.height}:{x:0,y:0,width:this.renderer.width,height:this.renderer.height}}clear(t,e,r,i,n=uR.COLOR|uR.DEPTH){const{gl:s}=this;s.clearColor(t,e,r,i),s.clear(n)}initFramebuffer(t){const{gl:e}=this,r=new SL(e.createFramebuffer());return r.multisample=this.detectSamples(t.multisample),t.glFramebuffers[this.CONTEXT_UID]=r,this.managedFramebuffers.push(t),t.disposeRunner.add(this),r}resizeFramebuffer(t){const{gl:e}=this,r=t.glFramebuffers[this.CONTEXT_UID];r.stencil&&(e.bindRenderbuffer(e.RENDERBUFFER,r.stencil),r.msaaBuffer?e.renderbufferStorageMultisample(e.RENDERBUFFER,r.multisample,e.DEPTH24_STENCIL8,t.width,t.height):e.renderbufferStorage(e.RENDERBUFFER,e.DEPTH_STENCIL,t.width,t.height));const i=t.colorTextures;let n=i.length;e.drawBuffers||(n=Math.min(n,1));for(let s=0;s<n;s++){const n=i[s],o=n.parentTextureArray||n;this.renderer.texture.bind(o,0),0===s&&r.msaaBuffer&&(e.bindRenderbuffer(e.RENDERBUFFER,r.msaaBuffer),e.renderbufferStorageMultisample(e.RENDERBUFFER,r.multisample,o._glTextures[this.CONTEXT_UID].internalFormat,t.width,t.height))}t.depthTexture&&this.writeDepthTexture&&this.renderer.texture.bind(t.depthTexture,0)}updateFramebuffer(t,e){const{gl:r}=this,i=t.glFramebuffers[this.CONTEXT_UID],n=t.colorTextures;let s=n.length;r.drawBuffers||(s=Math.min(s,1)),i.multisample>1&&this.canMultisampleFramebuffer(t)?i.msaaBuffer=i.msaaBuffer||r.createRenderbuffer():i.msaaBuffer&&(r.deleteRenderbuffer(i.msaaBuffer),i.msaaBuffer=null,i.blitFramebuffer&&(i.blitFramebuffer.dispose(),i.blitFramebuffer=null));const o=[];for(let a=0;a<s;a++){const s=n[a],h=s.parentTextureArray||s;this.renderer.texture.bind(h,0),0===a&&i.msaaBuffer?(r.bindRenderbuffer(r.RENDERBUFFER,i.msaaBuffer),r.renderbufferStorageMultisample(r.RENDERBUFFER,i.multisample,h._glTextures[this.CONTEXT_UID].internalFormat,t.width,t.height),r.framebufferRenderbuffer(r.FRAMEBUFFER,r.COLOR_ATTACHMENT0,r.RENDERBUFFER,i.msaaBuffer)):(r.framebufferTexture2D(r.FRAMEBUFFER,r.COLOR_ATTACHMENT0+a,s.target,h._glTextures[this.CONTEXT_UID].texture,e),o.push(r.COLOR_ATTACHMENT0+a))}if(o.length>1&&r.drawBuffers(o),t.depthTexture){if(this.writeDepthTexture){const i=t.depthTexture;this.renderer.texture.bind(i,0),r.framebufferTexture2D(r.FRAMEBUFFER,r.DEPTH_ATTACHMENT,r.TEXTURE_2D,i._glTextures[this.CONTEXT_UID].texture,e)}}!t.stencil&&!t.depth||t.depthTexture&&this.writeDepthTexture?i.stencil&&(r.deleteRenderbuffer(i.stencil),i.stencil=null):(i.stencil=i.stencil||r.createRenderbuffer(),r.bindRenderbuffer(r.RENDERBUFFER,i.stencil),i.msaaBuffer?r.renderbufferStorageMultisample(r.RENDERBUFFER,i.multisample,r.DEPTH24_STENCIL8,t.width,t.height):r.renderbufferStorage(r.RENDERBUFFER,r.DEPTH_STENCIL,t.width,t.height),r.framebufferRenderbuffer(r.FRAMEBUFFER,r.DEPTH_STENCIL_ATTACHMENT,r.RENDERBUFFER,i.stencil))}canMultisampleFramebuffer(t){return 1!==this.renderer.context.webGLVersion&&t.colorTextures.length<=1&&!t.depthTexture}detectSamples(t){const{msaaSamples:e}=this;let r=CR.NONE;if(t<=1||null===e)return r;for(let i=0;i<e.length;i++)if(e[i]<=t){r=e[i];break}return 1===r&&(r=CR.NONE),r}blit(t,e,r){const{current:i,renderer:n,gl:s,CONTEXT_UID:o}=this;if(2!==n.context.webGLVersion)return;if(!i)return;const a=i.glFramebuffers[o];if(!a)return;if(!t){if(!a.msaaBuffer)return;const e=i.colorTextures[0];if(!e)return;a.blitFramebuffer||(a.blitFramebuffer=new hL(i.width,i.height),a.blitFramebuffer.addColorTexture(0,e)),(t=a.blitFramebuffer).colorTextures[0]!==e&&(t.colorTextures[0]=e,t.dirtyId++,t.dirtyFormat++),t.width===i.width&&t.height===i.height||(t.width=i.width,t.height=i.height,t.dirtyId++,t.dirtySize++)}e||((e=EL).width=i.width,e.height=i.height),r||(r=e);const h=e.width===r.width&&e.height===r.height;this.bind(t),s.bindFramebuffer(s.READ_FRAMEBUFFER,a.framebuffer),s.blitFramebuffer(e.left,e.top,e.right,e.bottom,r.left,r.top,r.right,r.bottom,s.COLOR_BUFFER_BIT,h?s.NEAREST:s.LINEAR),s.bindFramebuffer(s.READ_FRAMEBUFFER,t.glFramebuffers[this.CONTEXT_UID].framebuffer)}disposeFramebuffer(t,e){const r=t.glFramebuffers[this.CONTEXT_UID],i=this.gl;if(!r)return;delete t.glFramebuffers[this.CONTEXT_UID];const n=this.managedFramebuffers.indexOf(t);n>=0&&this.managedFramebuffers.splice(n,1),t.disposeRunner.remove(this),e||(i.deleteFramebuffer(r.framebuffer),r.msaaBuffer&&i.deleteRenderbuffer(r.msaaBuffer),r.stencil&&i.deleteRenderbuffer(r.stencil)),r.blitFramebuffer&&this.disposeFramebuffer(r.blitFramebuffer,e)}disposeAll(t){const e=this.managedFramebuffers;this.managedFramebuffers=[];for(let r=0;r<e.length;r++)this.disposeFramebuffer(e[r],t)}forceStencil(){const t=this.current;if(!t)return;const e=t.glFramebuffers[this.CONTEXT_UID];if(!e||e.stencil)return;t.stencil=!0;const r=t.width,i=t.height,n=this.gl,s=n.createRenderbuffer();n.bindRenderbuffer(n.RENDERBUFFER,s),e.msaaBuffer?n.renderbufferStorageMultisample(n.RENDERBUFFER,e.multisample,n.DEPTH24_STENCIL8,r,i):n.renderbufferStorage(n.RENDERBUFFER,n.DEPTH_STENCIL,r,i),e.stencil=s,n.framebufferRenderbuffer(n.FRAMEBUFFER,n.DEPTH_STENCIL_ATTACHMENT,n.RENDERBUFFER,s)}reset(){this.current=this.unknownFramebuffer,this.viewport=new hD}destroy(){this.renderer=null}}CL.extension={type:Ik.RendererSystem,name:"framebuffer"},kk.add(CL);const AL={5126:4,5123:2,5121:1};class RL{constructor(t){this.renderer=t,this._activeGeometry=null,this._activeVao=null,this.hasVao=!0,this.hasInstance=!0,this.canUseUInt32ElementIndex=!1,this.managedGeometries={}}contextChange(){this.disposeAll(!0);const t=this.gl=this.renderer.gl,e=this.renderer.context;if(this.CONTEXT_UID=this.renderer.CONTEXT_UID,2!==e.webGLVersion){let e=this.renderer.context.extensions.vertexArrayObject;PR.PREFER_ENV===lR.WEBGL_LEGACY&&(e=null),e?(t.createVertexArray=()=>e.createVertexArrayOES(),t.bindVertexArray=t=>e.bindVertexArrayOES(t),t.deleteVertexArray=t=>e.deleteVertexArrayOES(t)):(this.hasVao=!1,t.createVertexArray=()=>null,t.bindVertexArray=()=>null,t.deleteVertexArray=()=>null)}if(2!==e.webGLVersion){const e=t.getExtension("ANGLE_instanced_arrays");e?(t.vertexAttribDivisor=(t,r)=>e.vertexAttribDivisorANGLE(t,r),t.drawElementsInstanced=(t,r,i,n,s)=>e.drawElementsInstancedANGLE(t,r,i,n,s),t.drawArraysInstanced=(t,r,i,n)=>e.drawArraysInstancedANGLE(t,r,i,n)):this.hasInstance=!1}this.canUseUInt32ElementIndex=2===e.webGLVersion||!!e.extensions.uint32ElementIndex}bind(t,e){e=e||this.renderer.shader.shader;const{gl:r}=this;let i=t.glVertexArrayObjects[this.CONTEXT_UID],n=!1;i||(this.managedGeometries[t.id]=t,t.disposeRunner.add(this),t.glVertexArrayObjects[this.CONTEXT_UID]=i={},n=!0);const s=i[e.program.id]||this.initGeometryVao(t,e,n);this._activeGeometry=t,this._activeVao!==s&&(this._activeVao=s,this.hasVao?r.bindVertexArray(s):this.activateVao(t,e.program)),this.updateBuffers()}reset(){this.unbind()}updateBuffers(){const t=this._activeGeometry,e=this.renderer.buffer;for(let r=0;r<t.buffers.length;r++){const i=t.buffers[r];e.update(i)}}checkCompatibility(t,e){const r=t.attributes,i=e.attributeData;for(const t in i)if(!r[t])throw new Error(`shader and geometry incompatible, geometry missing the "${t}" attribute`)}getSignature(t,e){const r=t.attributes,i=e.attributeData,n=["g",t.id];for(const t in r)i[t]&&n.push(t,i[t].location);return n.join("-")}initGeometryVao(t,e,r=!0){const i=this.gl,n=this.CONTEXT_UID,s=this.renderer.buffer,o=e.program;o.glPrograms[n]||this.renderer.shader.generateProgram(e),this.checkCompatibility(t,o);const a=this.getSignature(t,o),h=t.glVertexArrayObjects[this.CONTEXT_UID];let l=h[a];if(l)return h[o.id]=l,l;const c=t.buffers,u=t.attributes,d={},p={};for(const t in c)d[t]=0,p[t]=0;for(const t in u)!u[t].size&&o.attributeData[t]?u[t].size=o.attributeData[t].size:u[t].size||console.warn(`PIXI Geometry attribute '${t}' size cannot be determined (likely the bound shader does not have the attribute)`),d[u[t].buffer]+=u[t].size*AL[u[t].type];for(const t in u){const e=u[t],r=e.size;void 0===e.stride&&(d[e.buffer]===r*AL[e.type]?e.stride=0:e.stride=d[e.buffer]),void 0===e.start&&(e.start=p[e.buffer],p[e.buffer]+=r*AL[e.type])}l=i.createVertexArray(),i.bindVertexArray(l);for(let t=0;t<c.length;t++){const e=c[t];s.bind(e),r&&e._glBuffers[n].refCount++}return this.activateVao(t,o),h[o.id]=l,h[a]=l,i.bindVertexArray(null),s.unbind(AR.ARRAY_BUFFER),l}disposeGeometry(t,e){if(!this.managedGeometries[t.id])return;delete this.managedGeometries[t.id];const r=t.glVertexArrayObjects[this.CONTEXT_UID],i=this.gl,n=t.buffers,s=this.renderer?.buffer;if(t.disposeRunner.remove(this),r){if(s)for(let t=0;t<n.length;t++){const r=n[t]._glBuffers[this.CONTEXT_UID];r&&(r.refCount--,0!==r.refCount||e||s.dispose(n[t],e))}if(!e)for(const t in r)if("g"===t[0]){const e=r[t];this._activeVao===e&&this.unbind(),i.deleteVertexArray(e)}delete t.glVertexArrayObjects[this.CONTEXT_UID]}}disposeAll(t){const e=Object.keys(this.managedGeometries);for(let r=0;r<e.length;r++)this.disposeGeometry(this.managedGeometries[e[r]],t)}activateVao(t,e){const r=this.gl,i=this.CONTEXT_UID,n=this.renderer.buffer,s=t.buffers,o=t.attributes;t.indexBuffer&&n.bind(t.indexBuffer);let a=null;for(const t in o){const h=o[t],l=s[h.buffer],c=l._glBuffers[i];if(e.attributeData[t]){a!==c&&(n.bind(l),a=c);const i=e.attributeData[t].location;if(r.enableVertexAttribArray(i),r.vertexAttribPointer(i,h.size,h.type||r.FLOAT,h.normalized,h.stride,h.start),h.instance){if(!this.hasInstance)throw new Error("geometry error, GPU Instancing is not supported on this device");r.vertexAttribDivisor(i,h.divisor)}}}}draw(t,e,r,i){const{gl:n}=this,s=this._activeGeometry;if(s.indexBuffer){const o=s.indexBuffer.data.BYTES_PER_ELEMENT,a=2===o?n.UNSIGNED_SHORT:n.UNSIGNED_INT;2===o||4===o&&this.canUseUInt32ElementIndex?s.instanced?n.drawElementsInstanced(t,e||s.indexBuffer.data.length,a,(r||0)*o,i||1):n.drawElements(t,e||s.indexBuffer.data.length,a,(r||0)*o):console.warn("unsupported index buffer type: uint32")}else s.instanced?n.drawArraysInstanced(t,r,e||s.getSize(),i||1):n.drawArrays(t,r,e||s.getSize());return this}unbind(){this.gl.bindVertexArray(null),this._activeVao=null,this._activeGeometry=null}destroy(){this.renderer=null}}RL.extension={type:Ik.RendererSystem,name:"geometry"},kk.add(RL);const PL=new pD;class IL{constructor(t,e){this._texture=t,this.mapCoord=new pD,this.uClampFrame=new Float32Array(4),this.uClampOffset=new Float32Array(2),this._textureID=-1,this._updateID=0,this.clampOffset=0,this.clampMargin=void 0===e?.5:e,this.isSimple=!1}get texture(){return this._texture}set texture(t){this._texture=t,this._textureID=-1}multiplyUvs(t,e){void 0===e&&(e=t);const r=this.mapCoord;for(let i=0;i<t.length;i+=2){const n=t[i],s=t[i+1];e[i]=n*r.a+s*r.c+r.tx,e[i+1]=n*r.b+s*r.d+r.ty}return e}update(t){const e=this._texture;if(!e||!e.valid)return!1;if(!t&&this._textureID===e._updateID)return!1;this._textureID=e._updateID,this._updateID++;const r=e._uvs;this.mapCoord.set(r.x1-r.x0,r.y1-r.y0,r.x3-r.x0,r.y3-r.y0,r.x0,r.y0);const i=e.orig,n=e.trim;n&&(PL.set(i.width/n.width,0,0,i.height/n.height,-n.x/n.width,-n.y/n.height),this.mapCoord.append(PL));const s=e.baseTexture,o=this.uClampFrame,a=this.clampMargin/s.resolution,h=this.clampOffset;return o[0]=(e._frame.x+a+h)/s.width,o[1]=(e._frame.y+a+h)/s.height,o[2]=(e._frame.x+e._frame.width-a+h)/s.width,o[3]=(e._frame.y+e._frame.height-a+h)/s.height,this.uClampOffset[0]=h/s.realWidth,this.uClampOffset[1]=h/s.realHeight,this.isSimple=e._frame.width===s.width&&e._frame.height===s.height&&0===e.rotate,!0}}class ML extends rL{constructor(t,e,r){let i=null;"string"!=typeof t&&void 0===e&&void 0===r&&(i=t,t=void 0,e=void 0,r=void 0),super(t||"attribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\n\nuniform mat3 projectionMatrix;\nuniform mat3 otherMatrix;\n\nvarying vec2 vMaskCoord;\nvarying vec2 vTextureCoord;\n\nvoid main(void)\n{\n    gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n\n    vTextureCoord = aTextureCoord;\n    vMaskCoord = ( otherMatrix * vec3( aTextureCoord, 1.0)  ).xy;\n}\n",e||"varying vec2 vMaskCoord;\nvarying vec2 vTextureCoord;\n\nuniform sampler2D uSampler;\nuniform sampler2D mask;\nuniform float alpha;\nuniform float npmAlpha;\nuniform vec4 maskClamp;\n\nvoid main(void)\n{\n    float clip = step(3.5,\n        step(maskClamp.x, vMaskCoord.x) +\n        step(maskClamp.y, vMaskCoord.y) +\n        step(vMaskCoord.x, maskClamp.z) +\n        step(vMaskCoord.y, maskClamp.w));\n\n    vec4 original = texture2D(uSampler, vTextureCoord);\n    vec4 masky = texture2D(mask, vMaskCoord);\n    float alphaMul = 1.0 - npmAlpha * (1.0 - masky.a);\n\n    original *= (alphaMul * masky.r * alpha * clip);\n\n    gl_FragColor = original;\n}\n",r),this.maskSprite=i,this.maskMatrix=new pD}get maskSprite(){return this._maskSprite}set maskSprite(t){this._maskSprite=t,this._maskSprite&&(this._maskSprite.renderable=!1)}apply(t,e,r,i){const n=this._maskSprite,s=n._texture;s.valid&&(s.uvMatrix||(s.uvMatrix=new IL(s,0)),s.uvMatrix.update(),this.uniforms.npmAlpha=s.baseTexture.alphaMode?0:1,this.uniforms.mask=s,this.uniforms.otherMatrix=t.calculateSpriteMatrix(this.maskMatrix,n).prepend(s.uvMatrix.mapCoord),this.uniforms.alpha=n.worldAlpha,this.uniforms.maskClamp=s.uvMatrix.uClampFrame,t.applyFilter(this,e,r,i))}}class OL{constructor(t=null){this.type=ER.NONE,this.autoDetect=!0,this.maskObject=t||null,this.pooled=!1,this.isMaskData=!0,this.resolution=null,this.multisample=rL.defaultMultisample,this.enabled=!0,this.colorMask=15,this._filters=null,this._stencilCounter=0,this._scissorCounter=0,this._scissorRect=null,this._scissorRectLocal=null,this._colorMask=15,this._target=null}get filter(){return this._filters?this._filters[0]:null}set filter(t){t?this._filters?this._filters[0]=t:this._filters=[t]:this._filters=null}reset(){this.pooled&&(this.maskObject=null,this.type=ER.NONE,this.autoDetect=!0),this._target=null,this._scissorRectLocal=null}copyCountersOrReset(t){t?(this._stencilCounter=t._stencilCounter,this._scissorCounter=t._scissorCounter,this._scissorRect=t._scissorRect):(this._stencilCounter=0,this._scissorCounter=0,this._scissorRect=null)}}class kL{constructor(t){this.renderer=t,this.enableScissor=!0,this.alphaMaskPool=[],this.maskDataPool=[],this.maskStack=[],this.alphaMaskIndex=0}setMaskStack(t){this.maskStack=t,this.renderer.scissor.setMaskStack(t),this.renderer.stencil.setMaskStack(t)}push(t,e){let r=e;if(!r.isMaskData){const t=this.maskDataPool.pop()||new OL;t.pooled=!0,t.maskObject=e,r=t}const i=0!==this.maskStack.length?this.maskStack[this.maskStack.length-1]:null;if(r.copyCountersOrReset(i),r._colorMask=i?i._colorMask:15,r.autoDetect&&this.detect(r),r._target=t,r.type!==ER.SPRITE&&this.maskStack.push(r),r.enabled)switch(r.type){case ER.SCISSOR:this.renderer.scissor.push(r);break;case ER.STENCIL:this.renderer.stencil.push(r);break;case ER.SPRITE:r.copyCountersOrReset(null),this.pushSpriteMask(r);break;case ER.COLOR:this.pushColorMask(r)}r.type===ER.SPRITE&&this.maskStack.push(r)}pop(t){const e=this.maskStack.pop();if(e&&e._target===t){if(e.enabled)switch(e.type){case ER.SCISSOR:this.renderer.scissor.pop(e);break;case ER.STENCIL:this.renderer.stencil.pop(e.maskObject);break;case ER.SPRITE:this.popSpriteMask(e);break;case ER.COLOR:this.popColorMask(e)}if(e.reset(),e.pooled&&this.maskDataPool.push(e),0!==this.maskStack.length){const t=this.maskStack[this.maskStack.length-1];t.type===ER.SPRITE&&t._filters&&(t._filters[0].maskSprite=t.maskObject)}}}detect(t){const e=t.maskObject;e?e.isSprite?t.type=ER.SPRITE:this.enableScissor&&this.renderer.scissor.testScissor(t)?t.type=ER.SCISSOR:t.type=ER.STENCIL:t.type=ER.COLOR}pushSpriteMask(t){const{maskObject:e}=t,r=t._target;let i=t._filters;i||(i=this.alphaMaskPool[this.alphaMaskIndex],i||(i=this.alphaMaskPool[this.alphaMaskIndex]=[new ML]));const n=this.renderer,s=n.renderTexture;let o,a;if(s.current){const e=s.current;o=t.resolution||e.resolution,a=t.multisample??e.multisample}else o=t.resolution||n.resolution,a=t.multisample??n.multisample;i[0].resolution=o,i[0].multisample=a,i[0].maskSprite=e;const h=r.filterArea;r.filterArea=e.getBounds(!0),n.filter.push(r,i),r.filterArea=h,t._filters||this.alphaMaskIndex++}popSpriteMask(t){this.renderer.filter.pop(),t._filters?t._filters[0].maskSprite=null:(this.alphaMaskIndex--,this.alphaMaskPool[this.alphaMaskIndex][0].maskSprite=null)}pushColorMask(t){const e=t._colorMask,r=t._colorMask=e&t.colorMask;r!==e&&this.renderer.gl.colorMask(0!=(1&r),0!=(2&r),0!=(4&r),0!=(8&r))}popColorMask(t){const e=t._colorMask,r=this.maskStack.length>0?this.maskStack[this.maskStack.length-1]._colorMask:15;r!==e&&this.renderer.gl.colorMask(0!=(1&r),0!=(2&r),0!=(4&r),0!=(8&r))}destroy(){this.renderer=null}}kL.extension={type:Ik.RendererSystem,name:"mask"},kk.add(kL);class DL{constructor(t){this.renderer=t,this.maskStack=[],this.glConst=0}getStackLength(){return this.maskStack.length}setMaskStack(t){const{gl:e}=this.renderer,r=this.getStackLength();this.maskStack=t;const i=this.getStackLength();i!==r&&(0===i?e.disable(this.glConst):(e.enable(this.glConst),this._useCurrent()))}_useCurrent(){}destroy(){this.renderer=null,this.maskStack=null}}const LL=new pD,NL=[],FL=class extends DL{constructor(t){super(t),this.glConst=PR.ADAPTER.getWebGLRenderingContext().SCISSOR_TEST}getStackLength(){const t=this.maskStack[this.maskStack.length-1];return t?t._scissorCounter:0}calcScissorRect(t){if(t._scissorRectLocal)return;const e=t._scissorRect,{maskObject:r}=t,{renderer:i}=this,n=i.renderTexture,s=r.getBounds(!0,NL.pop()??new hD);this.roundFrameToPixels(s,n.current?n.current.resolution:i.resolution,n.sourceFrame,n.destinationFrame,i.projection.transform),e&&s.fit(e),t._scissorRectLocal=s}static isMatrixRotated(t){if(!t)return!1;const{a:e,b:r,c:i,d:n}=t;return(Math.abs(r)>1e-4||Math.abs(i)>1e-4)&&(Math.abs(e)>1e-4||Math.abs(n)>1e-4)}testScissor(t){const{maskObject:e}=t;if(!e.isFastRect||!e.isFastRect())return!1;if(FL.isMatrixRotated(e.worldTransform))return!1;if(FL.isMatrixRotated(this.renderer.projection.transform))return!1;this.calcScissorRect(t);const r=t._scissorRectLocal;return r.width>0&&r.height>0}roundFrameToPixels(t,e,r,i,n){FL.isMatrixRotated(n)||((n=n?LL.copyFrom(n):LL.identity()).translate(-r.x,-r.y).scale(i.width/r.width,i.height/r.height).translate(i.x,i.y),this.renderer.filter.transformAABB(n,t),t.fit(i),t.x=Math.round(t.x*e),t.y=Math.round(t.y*e),t.width=Math.round(t.width*e),t.height=Math.round(t.height*e))}push(t){t._scissorRectLocal||this.calcScissorRect(t);const{gl:e}=this.renderer;t._scissorRect||e.enable(e.SCISSOR_TEST),t._scissorCounter++,t._scissorRect=t._scissorRectLocal,this._useCurrent()}pop(t){const{gl:e}=this.renderer;t&&NL.push(t._scissorRectLocal),this.getStackLength()>0?this._useCurrent():e.disable(e.SCISSOR_TEST)}_useCurrent(){const t=this.maskStack[this.maskStack.length-1]._scissorRect;let e;e=this.renderer.renderTexture.current?t.y:this.renderer.height-t.height-t.y,this.renderer.gl.scissor(t.x,e,t.width,t.height)}};let BL=FL;BL.extension={type:Ik.RendererSystem,name:"scissor"},kk.add(BL);class UL extends DL{constructor(t){super(t),this.glConst=PR.ADAPTER.getWebGLRenderingContext().STENCIL_TEST}getStackLength(){const t=this.maskStack[this.maskStack.length-1];return t?t._stencilCounter:0}push(t){const e=t.maskObject,{gl:r}=this.renderer,i=t._stencilCounter;0===i&&(this.renderer.framebuffer.forceStencil(),r.clearStencil(0),r.clear(r.STENCIL_BUFFER_BIT),r.enable(r.STENCIL_TEST)),t._stencilCounter++;const n=t._colorMask;0!==n&&(t._colorMask=0,r.colorMask(!1,!1,!1,!1)),r.stencilFunc(r.EQUAL,i,4294967295),r.stencilOp(r.KEEP,r.KEEP,r.INCR),e.renderable=!0,e.render(this.renderer),this.renderer.batch.flush(),e.renderable=!1,0!==n&&(t._colorMask=n,r.colorMask(0!=(1&n),0!=(2&n),0!=(4&n),0!=(8&n))),this._useCurrent()}pop(t){const e=this.renderer.gl;if(0===this.getStackLength())e.disable(e.STENCIL_TEST);else{const r=0!==this.maskStack.length?this.maskStack[this.maskStack.length-1]:null,i=r?r._colorMask:15;0!==i&&(r._colorMask=0,e.colorMask(!1,!1,!1,!1)),e.stencilOp(e.KEEP,e.KEEP,e.DECR),t.renderable=!0,t.render(this.renderer),this.renderer.batch.flush(),t.renderable=!1,0!==i&&(r._colorMask=i,e.colorMask(0!=(1&i),0!=(2&i),0!=(4&i),0!=(8&i))),this._useCurrent()}}_useCurrent(){const t=this.renderer.gl;t.stencilFunc(t.EQUAL,this.getStackLength(),4294967295),t.stencilOp(t.KEEP,t.KEEP,t.KEEP)}}UL.extension={type:Ik.RendererSystem,name:"stencil"},kk.add(UL);class GL{constructor(t){this.renderer=t,this.plugins={},Object.defineProperties(this.plugins,{extract:{enumerable:!1,get:()=>(TO("7.0.0","renderer.plugins.extract has moved to renderer.extract"),t.extract)},prepare:{enumerable:!1,get:()=>(TO("7.0.0","renderer.plugins.prepare has moved to renderer.prepare"),t.prepare)},interaction:{enumerable:!1,get:()=>(TO("7.0.0","renderer.plugins.interaction has been deprecated, use renderer.events"),t.events)}})}init(){const t=this.rendererPlugins;for(const e in t)this.plugins[e]=new t[e](this.renderer)}destroy(){for(const t in this.plugins)this.plugins[t].destroy(),this.plugins[t]=null}}GL.extension={type:[Ik.RendererSystem,Ik.CanvasRendererSystem],name:"_plugin"},kk.add(GL);class jL{constructor(t){this.renderer=t,this.destinationFrame=null,this.sourceFrame=null,this.defaultFrame=null,this.projectionMatrix=new pD,this.transform=null}update(t,e,r,i){this.destinationFrame=t||this.destinationFrame||this.defaultFrame,this.sourceFrame=e||this.sourceFrame||t,this.calculateProjection(this.destinationFrame,this.sourceFrame,r,i),this.transform&&this.projectionMatrix.append(this.transform);const n=this.renderer;n.globalUniforms.uniforms.projectionMatrix=this.projectionMatrix,n.globalUniforms.update(),n.shader.shader&&n.shader.syncUniformGroup(n.shader.shader.uniforms.globals)}calculateProjection(t,e,r,i){const n=this.projectionMatrix,s=i?-1:1;n.identity(),n.a=1/e.width*2,n.d=s*(1/e.height*2),n.tx=-1-e.x*n.a,n.ty=-s-e.y*n.d}setTransform(t){}destroy(){this.renderer=null}}jL.extension={type:Ik.RendererSystem,name:"projection"},kk.add(jL);const VL=new SD;class HL{constructor(t){this.renderer=t,this._tempMatrix=new pD}generateTexture(t,e){const{region:r,...i}=e||{},n=r||t.getLocalBounds(null,!0);0===n.width&&(n.width=1),0===n.height&&(n.height=1);const s=gL.create({width:n.width,height:n.height,...i});this._tempMatrix.tx=-n.x,this._tempMatrix.ty=-n.y;const o=t.transform;return t.transform=VL,this.renderer.render(t,{renderTexture:s,transform:this._tempMatrix,skipUpdateTransform:!!t.parent,blit:!0}),t.transform=o,s}destroy(){}}HL.extension={type:[Ik.RendererSystem,Ik.CanvasRendererSystem],name:"textureGenerator"},kk.add(HL);const WL=new hD,XL=new hD;class zL{constructor(t){this.renderer=t,this.defaultMaskStack=[],this.current=null,this.sourceFrame=new hD,this.destinationFrame=new hD,this.viewportFrame=new hD}contextChange(){const t=this.renderer?.gl.getContextAttributes();this._rendererPremultipliedAlpha=!!(t&&t.alpha&&t.premultipliedAlpha)}bind(t=null,e,r){const i=this.renderer;let n,s,o;this.current=t,t?(n=t.baseTexture,o=n.resolution,e||(WL.width=t.frame.width,WL.height=t.frame.height,e=WL),r||(XL.x=t.frame.x,XL.y=t.frame.y,XL.width=e.width,XL.height=e.height,r=XL),s=n.framebuffer):(o=i.resolution,e||(WL.width=i._view.screen.width,WL.height=i._view.screen.height,e=WL),r||((r=WL).width=e.width,r.height=e.height));const a=this.viewportFrame;a.x=r.x*o,a.y=r.y*o,a.width=r.width*o,a.height=r.height*o,t||(a.y=i.view.height-(a.y+a.height)),a.ceil(),this.renderer.framebuffer.bind(s,a),this.renderer.projection.update(r,e,o,!s),t?this.renderer.mask.setMaskStack(n.maskStack):this.renderer.mask.setMaskStack(this.defaultMaskStack),this.sourceFrame.copyFrom(e),this.destinationFrame.copyFrom(r)}clear(t,e){const r=this.current?this.current.baseTexture.clear:this.renderer.background.backgroundColor,i=QO.shared.setValue(t||r);(this.current&&this.current.baseTexture.alphaMode>0||!this.current&&this._rendererPremultipliedAlpha)&&i.premultiply(i.alpha);const n=this.destinationFrame,s=this.current?this.current.baseTexture:this.renderer._view.screen,o=n.width!==s.width||n.height!==s.height;if(o){let{x:t,y:e,width:r,height:i}=this.viewportFrame;t=Math.round(t),e=Math.round(e),r=Math.round(r),i=Math.round(i),this.renderer.gl.enable(this.renderer.gl.SCISSOR_TEST),this.renderer.gl.scissor(t,e,r,i)}this.renderer.framebuffer.clear(i.red,i.green,i.blue,i.alpha,e),o&&this.renderer.scissor.pop()}resize(){this.bind(null)}reset(){this.bind(null)}destroy(){this.renderer=null}}zL.extension={type:Ik.RendererSystem,name:"renderTexture"},kk.add(zL);class YL{constructor(t,e){this.program=t,this.uniformData=e,this.uniformGroups={},this.uniformDirtyGroups={},this.uniformBufferBindings={}}destroy(){this.uniformData=null,this.uniformGroups=null,this.uniformDirtyGroups=null,this.uniformBufferBindings=null,this.program=null}}function ZL(t,e){const r=ED(t,t.VERTEX_SHADER,e.vertexSrc),i=ED(t,t.FRAGMENT_SHADER,e.fragmentSrc),n=t.createProgram();t.attachShader(n,r),t.attachShader(n,i);const s=e.extra?.transformFeedbackVaryings;if(s&&("function"!=typeof t.transformFeedbackVaryings?console.warn("TransformFeedback is not supported but TransformFeedbackVaryings are given."):t.transformFeedbackVaryings(n,s.names,"separate"===s.bufferMode?t.SEPARATE_ATTRIBS:t.INTERLEAVED_ATTRIBS)),t.linkProgram(n),t.getProgramParameter(n,t.LINK_STATUS)||function(t,e,r,i){t.getProgramParameter(e,t.LINK_STATUS)||(t.getShaderParameter(r,t.COMPILE_STATUS)||LD(t,r),t.getShaderParameter(i,t.COMPILE_STATUS)||LD(t,i),console.error("PixiJS Error: Could not initialize shader."),""!==t.getProgramInfoLog(e)&&console.warn("PixiJS Warning: gl.getProgramInfoLog()",t.getProgramInfoLog(e)))}(t,n,r,i),e.attributeData=function(t,e){const r={},i=e.getProgramParameter(t,e.ACTIVE_ATTRIBUTES);for(let n=0;n<i;n++){const i=e.getActiveAttrib(t,n);if(i.name.startsWith("gl_"))continue;const s=GD(e,i.type),o={type:s,name:i.name,size:FD(s),location:e.getAttribLocation(t,i.name)};r[i.name]=o}return r}(n,t),e.uniformData=function(t,e){const r={},i=e.getProgramParameter(t,e.ACTIVE_UNIFORMS);for(let n=0;n<i;n++){const i=e.getActiveUniform(t,n),s=i.name.replace(/\[.*?\]$/,""),o=!!i.name.match(/\[.*?\]$/),a=GD(e,i.type);r[s]={name:s,index:n,type:a,size:i.size,isArray:o,value:AD(a,i.size)}}return r}(n,t),!/^[ \t]*#[ \t]*version[ \t]+300[ \t]+es[ \t]*$/m.test(e.vertexSrc)){const r=Object.keys(e.attributeData);r.sort(((t,e)=>t>e?1:-1));for(let i=0;i<r.length;i++)e.attributeData[r[i]].location=i,t.bindAttribLocation(n,i,r[i]);t.linkProgram(n)}t.deleteShader(r),t.deleteShader(i);const o={};for(const r in e.uniformData){const i=e.uniformData[r];o[r]={location:t.getUniformLocation(n,r),value:AD(i.type,i.size)}}return new YL(n,o)}function $L(t,e,r,i,n){r.buffer.update(n)}const KL={float:"\n        data[offset] = v;\n    ",vec2:"\n        data[offset] = v[0];\n        data[offset+1] = v[1];\n    ",vec3:"\n        data[offset] = v[0];\n        data[offset+1] = v[1];\n        data[offset+2] = v[2];\n\n    ",vec4:"\n        data[offset] = v[0];\n        data[offset+1] = v[1];\n        data[offset+2] = v[2];\n        data[offset+3] = v[3];\n    ",mat2:"\n        data[offset] = v[0];\n        data[offset+1] = v[1];\n\n        data[offset+4] = v[2];\n        data[offset+5] = v[3];\n    ",mat3:"\n        data[offset] = v[0];\n        data[offset+1] = v[1];\n        data[offset+2] = v[2];\n\n        data[offset + 4] = v[3];\n        data[offset + 5] = v[4];\n        data[offset + 6] = v[5];\n\n        data[offset + 8] = v[6];\n        data[offset + 9] = v[7];\n        data[offset + 10] = v[8];\n    ",mat4:"\n        for(var i = 0; i < 16; i++)\n        {\n            data[offset + i] = v[i];\n        }\n    "},JL={float:4,vec2:8,vec3:12,vec4:16,int:4,ivec2:8,ivec3:12,ivec4:16,uint:4,uvec2:8,uvec3:12,uvec4:16,bool:4,bvec2:8,bvec3:12,bvec4:16,mat2:32,mat3:48,mat4:64};function qL(t,e){if(!t.autoManage)return{size:0,syncFunc:$L};const r=function(t,e){const r=[];for(const i in t)e[i]&&r.push(e[i]);return r.sort(((t,e)=>t.index-e.index)),r}(t.uniforms,e),{uboElements:i,size:n}=function(t){const e=t.map((t=>({data:t,offset:0,dataLen:0,dirty:0})));let r=0,i=0,n=0;for(let t=0;t<e.length;t++){const s=e[t];if(r=JL[s.data.type],s.data.size>1&&(r=Math.max(r,16)*s.data.size),s.dataLen=r,i%r!=0&&i<16){const t=i%r%16;i+=t,n+=t}i+r>16?(n=16*Math.ceil(n/16),s.offset=n,n+=r,i=r):(s.offset=n,i+=r,n+=r)}return n=16*Math.ceil(n/16),{uboElements:e,size:n}}(r),s=["\n    var v = null;\n    var v2 = null;\n    var cv = null;\n    var t = 0;\n    var gl = renderer.gl\n    var index = 0;\n    var data = buffer.data;\n    "];for(let e=0;e<i.length;e++){const r=i[e],n=t.uniforms[r.data.name],o=r.data.name;let a=!1;for(let t=0;t<RD.length;t++){const e=RD[t];if(e.codeUbo&&e.test(r.data,n)){s.push(`offset = ${r.offset/4};`,RD[t].codeUbo(r.data.name,n)),a=!0;break}}if(!a)if(r.data.size>1){const t=FD(r.data.type),e=Math.max(JL[r.data.type]/16,1),i=t/e,n=(4-i%4)%4;s.push(`\n                cv = ud.${o}.value;\n                v = uv.${o};\n                offset = ${r.offset/4};\n\n                t = 0;\n\n                for(var i=0; i < ${r.data.size*e}; i++)\n                {\n                    for(var j = 0; j < ${i}; j++)\n                    {\n                        data[offset++] = v[t++];\n                    }\n                    offset += ${n};\n                }\n\n                `)}else{const t=KL[r.data.type];s.push(`\n                cv = ud.${o}.value;\n                v = uv.${o};\n                offset = ${r.offset/4};\n                ${t};\n                `)}}return s.push("\n       renderer.buffer.update(buffer);\n    "),{size:n,syncFunc:new Function("ud","uv","renderer","syncData","buffer",s.join("\n"))}}let QL=0;const tN={textureCount:0,uboCount:0};class eN{constructor(t){this.destroyed=!1,this.renderer=t,this.systemCheck(),this.gl=null,this.shader=null,this.program=null,this.cache={},this._uboCache={},this.id=QL++}systemCheck(){if(!function(){if("boolean"==typeof VD)return VD;try{const t=new Function("param1","param2","param3","return param1[param2] === param3;");VD=!0===t({a:"b"},"a","b")}catch(t){VD=!1}return VD}())throw new Error("Current environment does not allow unsafe-eval, please use @pixi/unsafe-eval module to enable support.")}contextChange(t){this.gl=t,this.reset()}bind(t,e){t.disposeRunner.add(this),t.uniforms.globals=this.renderer.globalUniforms;const r=t.program,i=r.glPrograms[this.renderer.CONTEXT_UID]||this.generateProgram(t);return this.shader=t,this.program!==r&&(this.program=r,this.gl.useProgram(i.program)),e||(tN.textureCount=0,tN.uboCount=0,this.syncUniformGroup(t.uniformGroup,tN)),i}setUniforms(t){const e=this.shader.program,r=e.glPrograms[this.renderer.CONTEXT_UID];e.syncUniforms(r.uniformData,t,this.renderer)}syncUniformGroup(t,e){const r=this.getGlProgram();t.static&&t.dirtyId===r.uniformDirtyGroups[t.id]||(r.uniformDirtyGroups[t.id]=t.dirtyId,this.syncUniforms(t,r,e))}syncUniforms(t,e,r){(t.syncUniforms[this.shader.program.id]||this.createSyncGroups(t))(e.uniformData,t.uniforms,this.renderer,r)}createSyncGroups(t){const e=this.getSignature(t,this.shader.program.uniformData,"u");return this.cache[e]||(this.cache[e]=function(t,e){const r=["\n        var v = null;\n        var cv = null;\n        var cu = null;\n        var t = 0;\n        var gl = renderer.gl;\n    "];for(const i in t.uniforms){const n=e[i];if(!n){t.uniforms[i]?.group&&(t.uniforms[i].ubo?r.push(`\n                        renderer.shader.syncUniformBufferGroup(uv.${i}, '${i}');\n                    `):r.push(`\n                        renderer.shader.syncUniformGroup(uv.${i}, syncData);\n                    `));continue}const s=t.uniforms[i];let o=!1;for(let t=0;t<RD.length;t++)if(RD[t].test(n,s)){r.push(RD[t].code(i,s)),o=!0;break}if(!o){const t=(1!==n.size||n.isArray?ID:PD)[n.type].replace("location",`ud["${i}"].location`);r.push(`\n            cu = ud["${i}"];\n            cv = cu.value;\n            v = uv["${i}"];\n            ${t};`)}}return new Function("ud","uv","renderer","syncData",r.join("\n"))}(t,this.shader.program.uniformData)),t.syncUniforms[this.shader.program.id]=this.cache[e],t.syncUniforms[this.shader.program.id]}syncUniformBufferGroup(t,e){const r=this.getGlProgram();if(!t.static||0!==t.dirtyId||!r.uniformGroups[t.id]){t.dirtyId=0;const i=r.uniformGroups[t.id]||this.createSyncBufferGroup(t,r,e);t.buffer.update(),i(r.uniformData,t.uniforms,this.renderer,tN,t.buffer)}this.renderer.buffer.bindBufferBase(t.buffer,r.uniformBufferBindings[e])}createSyncBufferGroup(t,e,r){const{gl:i}=this.renderer;this.renderer.buffer.bind(t.buffer);const n=this.gl.getUniformBlockIndex(e.program,r);e.uniformBufferBindings[r]=this.shader.uniformBindCount,i.uniformBlockBinding(e.program,n,this.shader.uniformBindCount),this.shader.uniformBindCount++;const s=this.getSignature(t,this.shader.program.uniformData,"ubo");let o=this._uboCache[s];if(o||(o=this._uboCache[s]=qL(t,this.shader.program.uniformData)),t.autoManage){const e=new Float32Array(o.size/4);t.buffer.update(e)}return e.uniformGroups[t.id]=o.syncFunc,e.uniformGroups[t.id]}getSignature(t,e,r){const i=t.uniforms,n=[`${r}-`];for(const t in i)n.push(t),e[t]&&n.push(e[t].type);return n.join("-")}getGlProgram(){return this.shader?this.shader.program.glPrograms[this.renderer.CONTEXT_UID]:null}generateProgram(t){const e=this.gl,r=t.program,i=ZL(e,r);return r.glPrograms[this.renderer.CONTEXT_UID]=i,i}reset(){this.program=null,this.shader=null}disposeShader(t){this.shader===t&&(this.shader=null)}destroy(){this.renderer=null,this.destroyed=!0}}eN.extension={type:Ik.RendererSystem,name:"shader"},kk.add(eN);class rN{constructor(t){this.renderer=t}run(t){const{renderer:e}=this;e.runners.init.emit(e.options),t.hello&&console.log(`PixiJS 7.2.4 - ${e.rendererLogId} - https://pixijs.com`),e.resize(e.screen.width,e.screen.height)}destroy(){}}rN.defaultOptions={hello:!1},rN.extension={type:[Ik.RendererSystem,Ik.CanvasRendererSystem],name:"startup"},kk.add(rN);const iN=class{constructor(){this.gl=null,this.stateId=0,this.polygonOffset=0,this.blendMode=dR.NONE,this._blendEq=!1,this.map=[],this.map[0]=this.setBlend,this.map[1]=this.setOffset,this.map[2]=this.setCullFace,this.map[3]=this.setDepthTest,this.map[4]=this.setFrontFace,this.map[5]=this.setDepthMask,this.checks=[],this.defaultState=new Fk,this.defaultState.blend=!0}contextChange(t){this.gl=t,this.blendModes=function(t,e=[]){return e[dR.NORMAL]=[t.ONE,t.ONE_MINUS_SRC_ALPHA],e[dR.ADD]=[t.ONE,t.ONE],e[dR.MULTIPLY]=[t.DST_COLOR,t.ONE_MINUS_SRC_ALPHA,t.ONE,t.ONE_MINUS_SRC_ALPHA],e[dR.SCREEN]=[t.ONE,t.ONE_MINUS_SRC_COLOR,t.ONE,t.ONE_MINUS_SRC_ALPHA],e[dR.OVERLAY]=[t.ONE,t.ONE_MINUS_SRC_ALPHA],e[dR.DARKEN]=[t.ONE,t.ONE_MINUS_SRC_ALPHA],e[dR.LIGHTEN]=[t.ONE,t.ONE_MINUS_SRC_ALPHA],e[dR.COLOR_DODGE]=[t.ONE,t.ONE_MINUS_SRC_ALPHA],e[dR.COLOR_BURN]=[t.ONE,t.ONE_MINUS_SRC_ALPHA],e[dR.HARD_LIGHT]=[t.ONE,t.ONE_MINUS_SRC_ALPHA],e[dR.SOFT_LIGHT]=[t.ONE,t.ONE_MINUS_SRC_ALPHA],e[dR.DIFFERENCE]=[t.ONE,t.ONE_MINUS_SRC_ALPHA],e[dR.EXCLUSION]=[t.ONE,t.ONE_MINUS_SRC_ALPHA],e[dR.HUE]=[t.ONE,t.ONE_MINUS_SRC_ALPHA],e[dR.SATURATION]=[t.ONE,t.ONE_MINUS_SRC_ALPHA],e[dR.COLOR]=[t.ONE,t.ONE_MINUS_SRC_ALPHA],e[dR.LUMINOSITY]=[t.ONE,t.ONE_MINUS_SRC_ALPHA],e[dR.NONE]=[0,0],e[dR.NORMAL_NPM]=[t.SRC_ALPHA,t.ONE_MINUS_SRC_ALPHA,t.ONE,t.ONE_MINUS_SRC_ALPHA],e[dR.ADD_NPM]=[t.SRC_ALPHA,t.ONE,t.ONE,t.ONE],e[dR.SCREEN_NPM]=[t.SRC_ALPHA,t.ONE_MINUS_SRC_COLOR,t.ONE,t.ONE_MINUS_SRC_ALPHA],e[dR.SRC_IN]=[t.DST_ALPHA,t.ZERO],e[dR.SRC_OUT]=[t.ONE_MINUS_DST_ALPHA,t.ZERO],e[dR.SRC_ATOP]=[t.DST_ALPHA,t.ONE_MINUS_SRC_ALPHA],e[dR.DST_OVER]=[t.ONE_MINUS_DST_ALPHA,t.ONE],e[dR.DST_IN]=[t.ZERO,t.SRC_ALPHA],e[dR.DST_OUT]=[t.ZERO,t.ONE_MINUS_SRC_ALPHA],e[dR.DST_ATOP]=[t.ONE_MINUS_DST_ALPHA,t.SRC_ALPHA],e[dR.XOR]=[t.ONE_MINUS_DST_ALPHA,t.ONE_MINUS_SRC_ALPHA],e[dR.SUBTRACT]=[t.ONE,t.ONE,t.ONE,t.ONE,t.FUNC_REVERSE_SUBTRACT,t.FUNC_ADD],e}(t),this.set(this.defaultState),this.reset()}set(t){if(t=t||this.defaultState,this.stateId!==t.data){let e=this.stateId^t.data,r=0;for(;e;)1&e&&this.map[r].call(this,!!(t.data&1<<r)),e>>=1,r++;this.stateId=t.data}for(let e=0;e<this.checks.length;e++)this.checks[e](this,t)}forceState(t){t=t||this.defaultState;for(let e=0;e<this.map.length;e++)this.map[e].call(this,!!(t.data&1<<e));for(let e=0;e<this.checks.length;e++)this.checks[e](this,t);this.stateId=t.data}setBlend(t){this.updateCheck(iN.checkBlendMode,t),this.gl[t?"enable":"disable"](this.gl.BLEND)}setOffset(t){this.updateCheck(iN.checkPolygonOffset,t),this.gl[t?"enable":"disable"](this.gl.POLYGON_OFFSET_FILL)}setDepthTest(t){this.gl[t?"enable":"disable"](this.gl.DEPTH_TEST)}setDepthMask(t){this.gl.depthMask(t)}setCullFace(t){this.gl[t?"enable":"disable"](this.gl.CULL_FACE)}setFrontFace(t){this.gl.frontFace(this.gl[t?"CW":"CCW"])}setBlendMode(t){if(t===this.blendMode)return;this.blendMode=t;const e=this.blendModes[t],r=this.gl;2===e.length?r.blendFunc(e[0],e[1]):r.blendFuncSeparate(e[0],e[1],e[2],e[3]),6===e.length?(this._blendEq=!0,r.blendEquationSeparate(e[4],e[5])):this._blendEq&&(this._blendEq=!1,r.blendEquationSeparate(r.FUNC_ADD,r.FUNC_ADD))}setPolygonOffset(t,e){this.gl.polygonOffset(t,e)}reset(){this.gl.pixelStorei(this.gl.UNPACK_FLIP_Y_WEBGL,!1),this.forceState(this.defaultState),this._blendEq=!0,this.blendMode=-1,this.setBlendMode(0)}updateCheck(t,e){const r=this.checks.indexOf(t);e&&-1===r?this.checks.push(t):e||-1===r||this.checks.splice(r,1)}static checkBlendMode(t,e){t.setBlendMode(e.blendMode)}static checkPolygonOffset(t,e){t.setPolygonOffset(1,e.polygonOffset)}destroy(){this.gl=null}};let nN=iN;nN.extension={type:Ik.RendererSystem,name:"state"},kk.add(nN);class sN extends $R{constructor(){super(...arguments),this.runners={},this._systemsHash={}}setup(t){this.addRunners(...t.runners);const e=(t.priority??[]).filter((e=>t.systems[e])),r=[...e,...Object.keys(t.systems).filter((t=>!e.includes(t)))];for(const e of r)this.addSystem(t.systems[e],e)}addRunners(...t){t.forEach((t=>{this.runners[t]=new Gk(t)}))}addSystem(t,e){const r=new t(this);if(this[e])throw new Error(`Whoops! The name "${e}" is already in use`);this[e]=r,this._systemsHash[e]=r;for(const t in this.runners)this.runners[t].add(r);return this}emitWithCustomOptions(t,e){const r=Object.keys(this._systemsHash);t.items.forEach((i=>{const n=r.find((t=>this._systemsHash[t]===i));i[t.name](e[n])}))}destroy(){Object.values(this.runners).forEach((t=>{t.destroy()})),this._systemsHash={}}}const oN=class{constructor(t){this.renderer=t,this.count=0,this.checkCount=0,this.maxIdle=oN.defaultMaxIdle,this.checkCountMax=oN.defaultCheckCountMax,this.mode=oN.defaultMode}postrender(){this.renderer.objectRenderer.renderingToScreen&&(this.count++,this.mode!==wR.MANUAL&&(this.checkCount++,this.checkCount>this.checkCountMax&&(this.checkCount=0,this.run())))}run(){const t=this.renderer.texture,e=t.managedTextures;let r=!1;for(let i=0;i<e.length;i++){const n=e[i];!n.framebuffer&&this.count-n.touched>this.maxIdle&&(t.destroyTexture(n,!0),e[i]=null,r=!0)}if(r){let t=0;for(let r=0;r<e.length;r++)null!==e[r]&&(e[t++]=e[r]);e.length=t}}unload(t){const e=this.renderer.texture,r=t._texture;r&&!r.framebuffer&&e.destroyTexture(r);for(let e=t.children.length-1;e>=0;e--)this.unload(t.children[e])}destroy(){this.renderer=null}};let aN=oN;aN.defaultMode=wR.AUTO,aN.defaultMaxIdle=3600,aN.defaultCheckCountMax=600,aN.extension={type:Ik.RendererSystem,name:"textureGC"},kk.add(aN);class hN{constructor(t){this.texture=t,this.width=-1,this.height=-1,this.dirtyId=-1,this.dirtyStyleId=-1,this.mipmap=!1,this.wrapMode=33071,this.type=gR.UNSIGNED_BYTE,this.internalFormat=fR.RGBA,this.samplerType=0}}class lN{constructor(t){this.renderer=t,this.boundTextures=[],this.currentLocation=-1,this.managedTextures=[],this._unknownBoundTextures=!1,this.unknownTexture=new Xk,this.hasIntegerTextures=!1}contextChange(){const t=this.gl=this.renderer.gl;this.CONTEXT_UID=this.renderer.CONTEXT_UID,this.webGLVersion=this.renderer.context.webGLVersion,this.internalFormats=function(t){let e;return e="WebGL2RenderingContext"in globalThis&&t instanceof globalThis.WebGL2RenderingContext?{[gR.UNSIGNED_BYTE]:{[fR.RGBA]:t.RGBA8,[fR.RGB]:t.RGB8,[fR.RG]:t.RG8,[fR.RED]:t.R8,[fR.RGBA_INTEGER]:t.RGBA8UI,[fR.RGB_INTEGER]:t.RGB8UI,[fR.RG_INTEGER]:t.RG8UI,[fR.RED_INTEGER]:t.R8UI,[fR.ALPHA]:t.ALPHA,[fR.LUMINANCE]:t.LUMINANCE,[fR.LUMINANCE_ALPHA]:t.LUMINANCE_ALPHA},[gR.BYTE]:{[fR.RGBA]:t.RGBA8_SNORM,[fR.RGB]:t.RGB8_SNORM,[fR.RG]:t.RG8_SNORM,[fR.RED]:t.R8_SNORM,[fR.RGBA_INTEGER]:t.RGBA8I,[fR.RGB_INTEGER]:t.RGB8I,[fR.RG_INTEGER]:t.RG8I,[fR.RED_INTEGER]:t.R8I},[gR.UNSIGNED_SHORT]:{[fR.RGBA_INTEGER]:t.RGBA16UI,[fR.RGB_INTEGER]:t.RGB16UI,[fR.RG_INTEGER]:t.RG16UI,[fR.RED_INTEGER]:t.R16UI,[fR.DEPTH_COMPONENT]:t.DEPTH_COMPONENT16},[gR.SHORT]:{[fR.RGBA_INTEGER]:t.RGBA16I,[fR.RGB_INTEGER]:t.RGB16I,[fR.RG_INTEGER]:t.RG16I,[fR.RED_INTEGER]:t.R16I},[gR.UNSIGNED_INT]:{[fR.RGBA_INTEGER]:t.RGBA32UI,[fR.RGB_INTEGER]:t.RGB32UI,[fR.RG_INTEGER]:t.RG32UI,[fR.RED_INTEGER]:t.R32UI,[fR.DEPTH_COMPONENT]:t.DEPTH_COMPONENT24},[gR.INT]:{[fR.RGBA_INTEGER]:t.RGBA32I,[fR.RGB_INTEGER]:t.RGB32I,[fR.RG_INTEGER]:t.RG32I,[fR.RED_INTEGER]:t.R32I},[gR.FLOAT]:{[fR.RGBA]:t.RGBA32F,[fR.RGB]:t.RGB32F,[fR.RG]:t.RG32F,[fR.RED]:t.R32F,[fR.DEPTH_COMPONENT]:t.DEPTH_COMPONENT32F},[gR.HALF_FLOAT]:{[fR.RGBA]:t.RGBA16F,[fR.RGB]:t.RGB16F,[fR.RG]:t.RG16F,[fR.RED]:t.R16F},[gR.UNSIGNED_SHORT_5_6_5]:{[fR.RGB]:t.RGB565},[gR.UNSIGNED_SHORT_4_4_4_4]:{[fR.RGBA]:t.RGBA4},[gR.UNSIGNED_SHORT_5_5_5_1]:{[fR.RGBA]:t.RGB5_A1},[gR.UNSIGNED_INT_2_10_10_10_REV]:{[fR.RGBA]:t.RGB10_A2,[fR.RGBA_INTEGER]:t.RGB10_A2UI},[gR.UNSIGNED_INT_10F_11F_11F_REV]:{[fR.RGB]:t.R11F_G11F_B10F},[gR.UNSIGNED_INT_5_9_9_9_REV]:{[fR.RGB]:t.RGB9_E5},[gR.UNSIGNED_INT_24_8]:{[fR.DEPTH_STENCIL]:t.DEPTH24_STENCIL8},[gR.FLOAT_32_UNSIGNED_INT_24_8_REV]:{[fR.DEPTH_STENCIL]:t.DEPTH32F_STENCIL8}}:{[gR.UNSIGNED_BYTE]:{[fR.RGBA]:t.RGBA,[fR.RGB]:t.RGB,[fR.ALPHA]:t.ALPHA,[fR.LUMINANCE]:t.LUMINANCE,[fR.LUMINANCE_ALPHA]:t.LUMINANCE_ALPHA},[gR.UNSIGNED_SHORT_5_6_5]:{[fR.RGB]:t.RGB},[gR.UNSIGNED_SHORT_4_4_4_4]:{[fR.RGBA]:t.RGBA},[gR.UNSIGNED_SHORT_5_5_5_1]:{[fR.RGBA]:t.RGBA}},e}(t);const e=t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS);this.boundTextures.length=e;for(let t=0;t<e;t++)this.boundTextures[t]=null;this.emptyTextures={};const r=new hN(t.createTexture());t.bindTexture(t.TEXTURE_2D,r.texture),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,1,1,0,t.RGBA,t.UNSIGNED_BYTE,new Uint8Array(4)),this.emptyTextures[t.TEXTURE_2D]=r,this.emptyTextures[t.TEXTURE_CUBE_MAP]=new hN(t.createTexture()),t.bindTexture(t.TEXTURE_CUBE_MAP,this.emptyTextures[t.TEXTURE_CUBE_MAP].texture);for(let e=0;e<6;e++)t.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+e,0,t.RGBA,1,1,0,t.RGBA,t.UNSIGNED_BYTE,null);t.texParameteri(t.TEXTURE_CUBE_MAP,t.TEXTURE_MAG_FILTER,t.LINEAR),t.texParameteri(t.TEXTURE_CUBE_MAP,t.TEXTURE_MIN_FILTER,t.LINEAR);for(let t=0;t<this.boundTextures.length;t++)this.bind(null,t)}bind(t,e=0){const{gl:r}=this;if(t=t?.castToBaseTexture(),t?.valid&&!t.parentTextureArray){t.touched=this.renderer.textureGC.count;const i=t._glTextures[this.CONTEXT_UID]||this.initTexture(t);this.boundTextures[e]!==t&&(this.currentLocation!==e&&(this.currentLocation=e,r.activeTexture(r.TEXTURE0+e)),r.bindTexture(t.target,i.texture)),i.dirtyId!==t.dirtyId?(this.currentLocation!==e&&(this.currentLocation=e,r.activeTexture(r.TEXTURE0+e)),this.updateTexture(t)):i.dirtyStyleId!==t.dirtyStyleId&&this.updateTextureStyle(t),this.boundTextures[e]=t}else this.currentLocation!==e&&(this.currentLocation=e,r.activeTexture(r.TEXTURE0+e)),r.bindTexture(r.TEXTURE_2D,this.emptyTextures[r.TEXTURE_2D].texture),this.boundTextures[e]=null}reset(){this._unknownBoundTextures=!0,this.hasIntegerTextures=!1,this.currentLocation=-1;for(let t=0;t<this.boundTextures.length;t++)this.boundTextures[t]=this.unknownTexture}unbind(t){const{gl:e,boundTextures:r}=this;if(this._unknownBoundTextures){this._unknownBoundTextures=!1;for(let t=0;t<r.length;t++)r[t]===this.unknownTexture&&this.bind(null,t)}for(let i=0;i<r.length;i++)r[i]===t&&(this.currentLocation!==i&&(e.activeTexture(e.TEXTURE0+i),this.currentLocation=i),e.bindTexture(t.target,this.emptyTextures[t.target].texture),r[i]=null)}ensureSamplerType(t){const{boundTextures:e,hasIntegerTextures:r,CONTEXT_UID:i}=this;if(r)for(let r=t-1;r>=0;--r){const t=e[r];if(t){t._glTextures[i].samplerType!==vR.FLOAT&&this.renderer.texture.unbind(t)}}}initTexture(t){const e=new hN(this.gl.createTexture());return e.dirtyId=-1,t._glTextures[this.CONTEXT_UID]=e,this.managedTextures.push(t),t.on("dispose",this.destroyTexture,this),e}initTextureType(t,e){e.internalFormat=this.internalFormats[t.type]?.[t.format]??t.format,2===this.webGLVersion&&t.type===gR.HALF_FLOAT?e.type=this.gl.HALF_FLOAT:e.type=t.type}updateTexture(t){const e=t._glTextures[this.CONTEXT_UID];if(!e)return;const r=this.renderer;if(this.initTextureType(t,e),t.resource?.upload(r,t,e))e.samplerType!==vR.FLOAT&&(this.hasIntegerTextures=!0);else{const i=t.realWidth,n=t.realHeight,s=r.gl;(e.width!==i||e.height!==n||e.dirtyId<0)&&(e.width=i,e.height=n,s.texImage2D(t.target,0,e.internalFormat,i,n,0,t.format,e.type,null))}t.dirtyStyleId!==e.dirtyStyleId&&this.updateTextureStyle(t),e.dirtyId=t.dirtyId}destroyTexture(t,e){const{gl:r}=this;if((t=t.castToBaseTexture())._glTextures[this.CONTEXT_UID]&&(this.unbind(t),r.deleteTexture(t._glTextures[this.CONTEXT_UID].texture),t.off("dispose",this.destroyTexture,this),delete t._glTextures[this.CONTEXT_UID],!e)){const e=this.managedTextures.indexOf(t);-1!==e&&dk(this.managedTextures,e,1)}}updateTextureStyle(t){const e=t._glTextures[this.CONTEXT_UID];e&&(t.mipmap!==_R.POW2&&2===this.webGLVersion||t.isPowerOfTwo?e.mipmap=t.mipmap>=1:e.mipmap=!1,2===this.webGLVersion||t.isPowerOfTwo?e.wrapMode=t.wrapMode:e.wrapMode=bR.CLAMP,t.resource?.style(this.renderer,t,e)||this.setStyle(t,e),e.dirtyStyleId=t.dirtyStyleId)}setStyle(t,e){const r=this.gl;if(e.mipmap&&t.mipmap!==_R.ON_MANUAL&&r.generateMipmap(t.target),r.texParameteri(t.target,r.TEXTURE_WRAP_S,e.wrapMode),r.texParameteri(t.target,r.TEXTURE_WRAP_T,e.wrapMode),e.mipmap){r.texParameteri(t.target,r.TEXTURE_MIN_FILTER,t.scaleMode===yR.LINEAR?r.LINEAR_MIPMAP_LINEAR:r.NEAREST_MIPMAP_NEAREST);const e=this.renderer.context.extensions.anisotropicFiltering;if(e&&t.anisotropicLevel>0&&t.scaleMode===yR.LINEAR){const i=Math.min(t.anisotropicLevel,r.getParameter(e.MAX_TEXTURE_MAX_ANISOTROPY_EXT));r.texParameterf(t.target,e.TEXTURE_MAX_ANISOTROPY_EXT,i)}}else r.texParameteri(t.target,r.TEXTURE_MIN_FILTER,t.scaleMode===yR.LINEAR?r.LINEAR:r.NEAREST);r.texParameteri(t.target,r.TEXTURE_MAG_FILTER,t.scaleMode===yR.LINEAR?r.LINEAR:r.NEAREST)}destroy(){this.renderer=null}}lN.extension={type:Ik.RendererSystem,name:"texture"},kk.add(lN);class cN{constructor(t){this.renderer=t}contextChange(){this.gl=this.renderer.gl,this.CONTEXT_UID=this.renderer.CONTEXT_UID}bind(t){const{gl:e,CONTEXT_UID:r}=this,i=t._glTransformFeedbacks[r]||this.createGLTransformFeedback(t);e.bindTransformFeedback(e.TRANSFORM_FEEDBACK,i)}unbind(){const{gl:t}=this;t.bindTransformFeedback(t.TRANSFORM_FEEDBACK,null)}beginTransformFeedback(t,e){const{gl:r,renderer:i}=this;e&&i.shader.bind(e),r.beginTransformFeedback(t)}endTransformFeedback(){const{gl:t}=this;t.endTransformFeedback()}createGLTransformFeedback(t){const{gl:e,renderer:r,CONTEXT_UID:i}=this,n=e.createTransformFeedback();t._glTransformFeedbacks[i]=n,e.bindTransformFeedback(e.TRANSFORM_FEEDBACK,n);for(let n=0;n<t.buffers.length;n++){const s=t.buffers[n];s&&(r.buffer.update(s),s._glBuffers[i].refCount++,e.bindBufferBase(e.TRANSFORM_FEEDBACK_BUFFER,n,s._glBuffers[i].buffer||null))}return e.bindTransformFeedback(e.TRANSFORM_FEEDBACK,null),t.disposeRunner.add(this),n}disposeTransformFeedback(t,e){const r=t._glTransformFeedbacks[this.CONTEXT_UID],i=this.gl;t.disposeRunner.remove(this);const n=this.renderer.buffer;if(n)for(let r=0;r<t.buffers.length;r++){const i=t.buffers[r];if(!i)continue;const s=i._glBuffers[this.CONTEXT_UID];s&&(s.refCount--,0!==s.refCount||e||n.dispose(i,e))}r&&(e||i.deleteTransformFeedback(r),delete t._glTransformFeedbacks[this.CONTEXT_UID])}destroy(){this.renderer=null}}cN.extension={type:Ik.RendererSystem,name:"transformFeedback"},kk.add(cN);class uN{constructor(t){this.renderer=t}init(t){this.screen=new hD(0,0,t.width,t.height),this.element=t.view||PR.ADAPTER.createCanvas(),this.resolution=t.resolution||PR.RESOLUTION,this.autoDensity=!!t.autoDensity}resizeView(t,e){this.element.width=Math.round(t*this.resolution),this.element.height=Math.round(e*this.resolution);const r=this.element.width/this.resolution,i=this.element.height/this.resolution;this.screen.width=r,this.screen.height=i,this.autoDensity&&(this.element.style.width=`${r}px`,this.element.style.height=`${i}px`),this.renderer.emit("resize",r,i),this.renderer.runners.resize.emit(this.screen.width,this.screen.height)}destroy(t){t&&this.element.parentNode?.removeChild(this.element),this.renderer=null,this.element=null,this.screen=null}}uN.defaultOptions={width:800,height:600,resolution:PR.RESOLUTION,autoDensity:!1},uN.extension={type:[Ik.RendererSystem,Ik.CanvasRendererSystem],name:"_view"},kk.add(uN),PR.PREFER_ENV=lR.WEBGL2,PR.STRICT_TEXTURE_CACHE=!1,PR.RENDER_OPTIONS={...oL.defaultOptions,...iL.defaultOptions,...uN.defaultOptions,...rN.defaultOptions},Object.defineProperties(PR,{WRAP_MODE:{get:()=>Xk.defaultOptions.wrapMode,set(t){TO("7.1.0","settings.WRAP_MODE is deprecated, use BaseTexture.defaultOptions.wrapMode"),Xk.defaultOptions.wrapMode=t}},SCALE_MODE:{get:()=>Xk.defaultOptions.scaleMode,set(t){TO("7.1.0","settings.SCALE_MODE is deprecated, use BaseTexture.defaultOptions.scaleMode"),Xk.defaultOptions.scaleMode=t}},MIPMAP_TEXTURES:{get:()=>Xk.defaultOptions.mipmap,set(t){TO("7.1.0","settings.MIPMAP_TEXTURES is deprecated, use BaseTexture.defaultOptions.mipmap"),Xk.defaultOptions.mipmap=t}},ANISOTROPIC_LEVEL:{get:()=>Xk.defaultOptions.anisotropicLevel,set(t){TO("7.1.0","settings.ANISOTROPIC_LEVEL is deprecated, use BaseTexture.defaultOptions.anisotropicLevel"),Xk.defaultOptions.anisotropicLevel=t}},FILTER_RESOLUTION:{get:()=>(TO("7.1.0","settings.FILTER_RESOLUTION is deprecated, use Filter.defaultResolution"),rL.defaultResolution),set(t){rL.defaultResolution=t}},FILTER_MULTISAMPLE:{get:()=>(TO("7.1.0","settings.FILTER_MULTISAMPLE is deprecated, use Filter.defaultMultisample"),rL.defaultMultisample),set(t){rL.defaultMultisample=t}},SPRITE_MAX_TEXTURES:{get:()=>tL.defaultMaxTextures,set(t){TO("7.1.0","settings.SPRITE_MAX_TEXTURES is deprecated, use BatchRenderer.defaultMaxTextures"),tL.defaultMaxTextures=t}},SPRITE_BATCH_SIZE:{get:()=>tL.defaultBatchSize,set(t){TO("7.1.0","settings.SPRITE_BATCH_SIZE is deprecated, use BatchRenderer.defaultBatchSize"),tL.defaultBatchSize=t}},CAN_UPLOAD_SAME_BUFFER:{get:()=>tL.canUploadSameBuffer,set(t){TO("7.1.0","settings.CAN_UPLOAD_SAME_BUFFER is deprecated, use BatchRenderer.canUploadSameBuffer"),tL.canUploadSameBuffer=t}},GC_MODE:{get:()=>aN.defaultMode,set(t){TO("7.1.0","settings.GC_MODE is deprecated, use TextureGCSystem.defaultMode"),aN.defaultMode=t}},GC_MAX_IDLE:{get:()=>aN.defaultMaxIdle,set(t){TO("7.1.0","settings.GC_MAX_IDLE is deprecated, use TextureGCSystem.defaultMaxIdle"),aN.defaultMaxIdle=t}},GC_MAX_CHECK_COUNT:{get:()=>aN.defaultCheckCountMax,set(t){TO("7.1.0","settings.GC_MAX_CHECK_COUNT is deprecated, use TextureGCSystem.defaultCheckCountMax"),aN.defaultCheckCountMax=t}},PRECISION_VERTEX:{get:()=>zD.defaultVertexPrecision,set(t){TO("7.1.0","settings.PRECISION_VERTEX is deprecated, use Program.defaultVertexPrecision"),zD.defaultVertexPrecision=t}},PRECISION_FRAGMENT:{get:()=>zD.defaultFragmentPrecision,set(t){TO("7.1.0","settings.PRECISION_FRAGMENT is deprecated, use Program.defaultFragmentPrecision"),zD.defaultFragmentPrecision=t}}});var dN=(t=>(t[t.INTERACTION=50]="INTERACTION",t[t.HIGH=25]="HIGH",t[t.NORMAL=0]="NORMAL",t[t.LOW=-25]="LOW",t[t.UTILITY=-50]="UTILITY",t))(dN||{});class pN{constructor(t,e=null,r=0,i=!1){this.next=null,this.previous=null,this._destroyed=!1,this.fn=t,this.context=e,this.priority=r,this.once=i}match(t,e=null){return this.fn===t&&this.context===e}emit(t){this.fn&&(this.context?this.fn.call(this.context,t):this.fn(t));const e=this.next;return this.once&&this.destroy(!0),this._destroyed&&(this.next=null),e}connect(t){this.previous=t,t.next&&(t.next.previous=this),this.next=t.next,t.next=this}destroy(t=!1){this._destroyed=!0,this.fn=null,this.context=null,this.previous&&(this.previous.next=this.next),this.next&&(this.next.previous=this.previous);const e=this.next;return this.next=t?null:e,this.previous=null,e}}const fN=class{constructor(){this.autoStart=!1,this.deltaTime=1,this.lastTime=-1,this.speed=1,this.started=!1,this._requestId=null,this._maxElapsedMS=100,this._minElapsedMS=0,this._protected=!1,this._lastFrame=-1,this._head=new pN(null,null,1/0),this.deltaMS=1/fN.targetFPMS,this.elapsedMS=1/fN.targetFPMS,this._tick=t=>{this._requestId=null,this.started&&(this.update(t),this.started&&null===this._requestId&&this._head.next&&(this._requestId=requestAnimationFrame(this._tick)))}}_requestIfNeeded(){null===this._requestId&&this._head.next&&(this.lastTime=performance.now(),this._lastFrame=this.lastTime,this._requestId=requestAnimationFrame(this._tick))}_cancelIfNeeded(){null!==this._requestId&&(cancelAnimationFrame(this._requestId),this._requestId=null)}_startIfPossible(){this.started?this._requestIfNeeded():this.autoStart&&this.start()}add(t,e,r=dN.NORMAL){return this._addListener(new pN(t,e,r))}addOnce(t,e,r=dN.NORMAL){return this._addListener(new pN(t,e,r,!0))}_addListener(t){let e=this._head.next,r=this._head;if(e){for(;e;){if(t.priority>e.priority){t.connect(r);break}r=e,e=e.next}t.previous||t.connect(r)}else t.connect(r);return this._startIfPossible(),this}remove(t,e){let r=this._head.next;for(;r;)r=r.match(t,e)?r.destroy():r.next;return this._head.next||this._cancelIfNeeded(),this}get count(){if(!this._head)return 0;let t=0,e=this._head;for(;e=e.next;)t++;return t}start(){this.started||(this.started=!0,this._requestIfNeeded())}stop(){this.started&&(this.started=!1,this._cancelIfNeeded())}destroy(){if(!this._protected){this.stop();let t=this._head.next;for(;t;)t=t.destroy(!0);this._head.destroy(),this._head=null}}update(t=performance.now()){let e;if(t>this.lastTime){if(e=this.elapsedMS=t-this.lastTime,e>this._maxElapsedMS&&(e=this._maxElapsedMS),e*=this.speed,this._minElapsedMS){const e=t-this._lastFrame|0;if(e<this._minElapsedMS)return;this._lastFrame=t-e%this._minElapsedMS}this.deltaMS=e,this.deltaTime=this.deltaMS*fN.targetFPMS;const r=this._head;let i=r.next;for(;i;)i=i.emit(this.deltaTime);r.next||this._cancelIfNeeded()}else this.deltaTime=this.deltaMS=this.elapsedMS=0;this.lastTime=t}get FPS(){return 1e3/this.elapsedMS}get minFPS(){return 1e3/this._maxElapsedMS}set minFPS(t){const e=Math.min(this.maxFPS,t),r=Math.min(Math.max(0,e)/1e3,fN.targetFPMS);this._maxElapsedMS=1/r}get maxFPS(){return this._minElapsedMS?Math.round(1e3/this._minElapsedMS):0}set maxFPS(t){if(0===t)this._minElapsedMS=0;else{const e=Math.max(this.minFPS,t);this._minElapsedMS=1/(e/1e3)}}static get shared(){if(!fN._shared){const t=fN._shared=new fN;t.autoStart=!0,t._protected=!0}return fN._shared}static get system(){if(!fN._system){const t=fN._system=new fN;t.autoStart=!0,t._protected=!0}return fN._system}};let mN=fN;mN.targetFPMS=.06,Object.defineProperties(PR,{TARGET_FPMS:{get:()=>mN.targetFPMS,set(t){TO("7.1.0","settings.TARGET_FPMS is deprecated, use Ticker.targetFPMS"),mN.targetFPMS=t}}});class gN{static init(t){t=Object.assign({autoStart:!0,sharedTicker:!1},t),Object.defineProperty(this,"ticker",{set(t){this._ticker&&this._ticker.remove(this.render,this),this._ticker=t,t&&t.add(this.render,this,dN.LOW)},get(){return this._ticker}}),this.stop=()=>{this._ticker.stop()},this.start=()=>{this._ticker.start()},this._ticker=null,this.ticker=t.sharedTicker?mN.shared:new mN,t.autoStart&&this.start()}static destroy(){if(this._ticker){const t=this._ticker;this.ticker=null,t.destroy()}}}gN.extension=Ik.Application,kk.add(gN);const vN=[];function yN(t){for(const e of vN)if(e.test(t))return new e(t);throw new Error("Unable to auto-detect a suitable renderer.")}kk.handleByList(Ik.Renderer,vN);const bN="attribute vec2 aVertexPosition;\n\nuniform mat3 projectionMatrix;\n\nvarying vec2 vTextureCoord;\n\nuniform vec4 inputSize;\nuniform vec4 outputFrame;\n\nvec4 filterVertexPosition( void )\n{\n    vec2 position = aVertexPosition * max(outputFrame.zw, vec2(0.)) + outputFrame.xy;\n\n    return vec4((projectionMatrix * vec3(position, 1.0)).xy, 0.0, 1.0);\n}\n\nvec2 filterTextureCoord( void )\n{\n    return aVertexPosition * (outputFrame.zw * inputSize.zw);\n}\n\nvoid main(void)\n{\n    gl_Position = filterVertexPosition();\n    vTextureCoord = filterTextureCoord();\n}\n";class _N{constructor(t){this.renderer=t}contextChange(t){let e;if(1===this.renderer.context.webGLVersion){const r=t.getParameter(t.FRAMEBUFFER_BINDING);t.bindFramebuffer(t.FRAMEBUFFER,null),e=t.getParameter(t.SAMPLES),t.bindFramebuffer(t.FRAMEBUFFER,r)}else{const r=t.getParameter(t.DRAW_FRAMEBUFFER_BINDING);t.bindFramebuffer(t.DRAW_FRAMEBUFFER,null),e=t.getParameter(t.SAMPLES),t.bindFramebuffer(t.DRAW_FRAMEBUFFER,r)}e>=CR.HIGH?this.multisample=CR.HIGH:e>=CR.MEDIUM?this.multisample=CR.MEDIUM:e>=CR.LOW?this.multisample=CR.LOW:this.multisample=CR.NONE}destroy(){}}_N.extension={type:Ik.RendererSystem,name:"_multisample"},kk.add(_N);class xN{constructor(t){this.buffer=t||null,this.updateID=-1,this.byteLength=-1,this.refCount=0}}class TN{constructor(t){this.renderer=t,this.managedBuffers={},this.boundBufferBases={}}destroy(){this.renderer=null}contextChange(){this.disposeAll(!0),this.gl=this.renderer.gl,this.CONTEXT_UID=this.renderer.CONTEXT_UID}bind(t){const{gl:e,CONTEXT_UID:r}=this,i=t._glBuffers[r]||this.createGLBuffer(t);e.bindBuffer(t.type,i.buffer)}unbind(t){const{gl:e}=this;e.bindBuffer(t,null)}bindBufferBase(t,e){const{gl:r,CONTEXT_UID:i}=this;if(this.boundBufferBases[e]!==t){const n=t._glBuffers[i]||this.createGLBuffer(t);this.boundBufferBases[e]=t,r.bindBufferBase(r.UNIFORM_BUFFER,e,n.buffer)}}bindBufferRange(t,e,r){const{gl:i,CONTEXT_UID:n}=this;r=r||0;const s=t._glBuffers[n]||this.createGLBuffer(t);i.bindBufferRange(i.UNIFORM_BUFFER,e||0,s.buffer,256*r,256)}update(t){const{gl:e,CONTEXT_UID:r}=this,i=t._glBuffers[r]||this.createGLBuffer(t);if(t._updateID!==i.updateID)if(i.updateID=t._updateID,e.bindBuffer(t.type,i.buffer),i.byteLength>=t.data.byteLength)e.bufferSubData(t.type,0,t.data);else{const r=t.static?e.STATIC_DRAW:e.DYNAMIC_DRAW;i.byteLength=t.data.byteLength,e.bufferData(t.type,t.data,r)}}dispose(t,e){if(!this.managedBuffers[t.id])return;delete this.managedBuffers[t.id];const r=t._glBuffers[this.CONTEXT_UID],i=this.gl;t.disposeRunner.remove(this),r&&(e||i.deleteBuffer(r.buffer),delete t._glBuffers[this.CONTEXT_UID])}disposeAll(t){const e=Object.keys(this.managedBuffers);for(let r=0;r<e.length;r++)this.dispose(this.managedBuffers[e[r]],t)}createGLBuffer(t){const{CONTEXT_UID:e,gl:r}=this;return t._glBuffers[e]=new xN(r.createBuffer()),this.managedBuffers[t.id]=t,t.disposeRunner.add(this),t._glBuffers[e]}}TN.extension={type:Ik.RendererSystem,name:"buffer"},kk.add(TN);class wN{constructor(t){this.renderer=t}render(t,e){const r=this.renderer;let i,n,s,o;if(e&&(i=e.renderTexture,n=e.clear,s=e.transform,o=e.skipUpdateTransform),this.renderingToScreen=!i,r.runners.prerender.emit(),r.emit("prerender"),r.projection.transform=s,!r.context.isLost){if(i||(this.lastObjectRendered=t),!o){const e=t.enableTempParent();t.updateTransform(),t.disableTempParent(e)}r.renderTexture.bind(i),r.batch.currentRenderer.start(),(n??r.background.clearBeforeRender)&&r.renderTexture.clear(),t.render(r),r.batch.currentRenderer.flush(),i&&(e.blit&&r.framebuffer.blit(),i.baseTexture.update()),r.runners.postrender.emit(),r.projection.transform=null,r.emit("postrender")}}destroy(){this.renderer=null,this.lastObjectRendered=null}}wN.extension={type:Ik.RendererSystem,name:"objectRenderer"},kk.add(wN);const SN=class extends sN{constructor(t){super(),this.type=cR.WEBGL,t=Object.assign({},PR.RENDER_OPTIONS,t),this.gl=null,this.CONTEXT_UID=0,this.globalUniforms=new ZD({projectionMatrix:new pD},!0);const e={runners:["init","destroy","contextChange","resolutionChange","reset","update","postrender","prerender","resize"],systems:SN.__systems,priority:["_view","textureGenerator","background","_plugin","startup","context","state","texture","buffer","geometry","framebuffer","transformFeedback","mask","scissor","stencil","projection","textureGC","filter","renderTexture","batch","objectRenderer","_multisample"]};this.setup(e),"useContextAlpha"in t&&(TO("7.0.0","options.useContextAlpha is deprecated, use options.premultipliedAlpha and options.backgroundAlpha instead"),t.premultipliedAlpha=t.useContextAlpha&&"notMultiplied"!==t.useContextAlpha,t.backgroundAlpha=!1===t.useContextAlpha?1:t.backgroundAlpha),this._plugin.rendererPlugins=SN.__plugins,this.options=t,this.startup.run(this.options)}static test(t){return!t?.forceCanvas&&SO()}render(t,e){this.objectRenderer.render(t,e)}resize(t,e){this._view.resizeView(t,e)}reset(){return this.runners.reset.emit(),this}clear(){this.renderTexture.bind(),this.renderTexture.clear()}destroy(t=!1){this.runners.destroy.items.reverse(),this.emitWithCustomOptions(this.runners.destroy,{_view:t}),super.destroy()}get plugins(){return this._plugin.plugins}get multisample(){return this._multisample.multisample}get width(){return this._view.element.width}get height(){return this._view.element.height}get resolution(){return this._view.resolution}set resolution(t){this._view.resolution=t,this.runners.resolutionChange.emit(t)}get autoDensity(){return this._view.autoDensity}get view(){return this._view.element}get screen(){return this._view.screen}get lastObjectRendered(){return this.objectRenderer.lastObjectRendered}get renderingToScreen(){return this.objectRenderer.renderingToScreen}get rendererLogId(){return`WebGL ${this.context.webGLVersion}`}get clearBeforeRender(){return TO("7.0.0","renderer.clearBeforeRender has been deprecated, please use renderer.background.clearBeforeRender instead."),this.background.clearBeforeRender}get useContextAlpha(){return TO("7.0.0","renderer.useContextAlpha has been deprecated, please use renderer.context.premultipliedAlpha instead."),this.context.useContextAlpha}get preserveDrawingBuffer(){return TO("7.0.0","renderer.preserveDrawingBuffer has been deprecated, we cannot truly know this unless pixi created the context"),this.context.preserveDrawingBuffer}get backgroundColor(){return TO("7.0.0","renderer.backgroundColor has been deprecated, use renderer.background.color instead."),this.background.color}set backgroundColor(t){TO("7.0.0","renderer.backgroundColor has been deprecated, use renderer.background.color instead."),this.background.color=t}get backgroundAlpha(){return TO("7.0.0","renderer.backgroundAlpha has been deprecated, use renderer.background.alpha instead."),this.background.alpha}set backgroundAlpha(t){TO("7.0.0","renderer.backgroundAlpha has been deprecated, use renderer.background.alpha instead."),this.background.alpha=t}get powerPreference(){return TO("7.0.0","renderer.powerPreference has been deprecated, we can only know this if pixi creates the context"),this.context.powerPreference}generateTexture(t,e){return this.textureGenerator.generateTexture(t,e)}};let EN=SN;EN.extension={type:Ik.Renderer,priority:1},EN.__plugins={},EN.__systems={},kk.handleByMap(Ik.RendererPlugin,EN.__plugins),kk.handleByMap(Ik.RendererSystem,EN.__systems),kk.add(EN);class CN extends jk{constructor(t,e){const{width:r,height:i}=e||{};super(r,i),this.items=[],this.itemDirtyIds=[];for(let e=0;e<t;e++){const t=new Xk;this.items.push(t),this.itemDirtyIds.push(-2)}this.length=t,this._load=null,this.baseTexture=null}initFromArray(t,e){for(let r=0;r<this.length;r++)t[r]&&(t[r].castToBaseTexture?this.addBaseTextureAt(t[r].castToBaseTexture(),r):t[r]instanceof jk?this.addResourceAt(t[r],r):this.addResourceAt(Uk(t[r],e),r))}dispose(){for(let t=0,e=this.length;t<e;t++)this.items[t].destroy();this.items=null,this.itemDirtyIds=null,this._load=null}addResourceAt(t,e){if(!this.items[e])throw new Error(`Index ${e} is out of bounds`);return t.valid&&!this.valid&&this.resize(t.width,t.height),this.items[e].setResource(t),this}bind(t){if(null!==this.baseTexture)throw new Error("Only one base texture per TextureArray is allowed");super.bind(t);for(let e=0;e<this.length;e++)this.items[e].parentTextureArray=t,this.items[e].on("update",t.update,t)}unbind(t){super.unbind(t);for(let e=0;e<this.length;e++)this.items[e].parentTextureArray=null,this.items[e].off("update",t.update,t)}load(){if(this._load)return this._load;const t=this.items.map((t=>t.resource)).filter((t=>t)).map((t=>t.load()));return this._load=Promise.all(t).then((()=>{const{realWidth:t,realHeight:e}=this.items[0];return this.resize(t,e),Promise.resolve(this)})),this._load}}class AN extends cL{constructor(t){super(t)}static test(t){const{OffscreenCanvas:e}=globalThis;return!!(e&&t instanceof e)||globalThis.HTMLCanvasElement&&t instanceof HTMLCanvasElement}}const RN=class extends CN{constructor(t,e){const{width:r,height:i,autoLoad:n,linkBaseTexture:s}=e||{};if(t&&t.length!==RN.SIDES)throw new Error(`Invalid length. Got ${t.length}, expected 6`);super(6,{width:r,height:i});for(let t=0;t<RN.SIDES;t++)this.items[t].target=mR.TEXTURE_CUBE_MAP_POSITIVE_X+t;this.linkBaseTexture=!1!==s,t&&this.initFromArray(t,e),!1!==n&&this.load()}bind(t){super.bind(t),t.target=mR.TEXTURE_CUBE_MAP}addBaseTextureAt(t,e,r){if(void 0===r&&(r=this.linkBaseTexture),!this.items[e])throw new Error(`Index ${e} is out of bounds`);if(!this.linkBaseTexture||t.parentTextureArray||Object.keys(t._glTextures).length>0){if(!t.resource)throw new Error("CubeResource does not support copying of renderTexture.");this.addResourceAt(t.resource,e)}else t.target=mR.TEXTURE_CUBE_MAP_POSITIVE_X+e,t.parentTextureArray=this.baseTexture,this.items[e]=t;return t.valid&&!this.valid&&this.resize(t.realWidth,t.realHeight),this.items[e]=t,this}upload(t,e,r){const i=this.itemDirtyIds;for(let n=0;n<RN.SIDES;n++){const s=this.items[n];(i[n]<s.dirtyId||r.dirtyId<e.dirtyId)&&(s.valid&&s.resource?(s.resource.upload(t,s,r),i[n]=s.dirtyId):i[n]<-1&&(t.gl.texImage2D(s.target,0,r.internalFormat,e.realWidth,e.realHeight,0,e.format,r.type,null),i[n]=-1))}return!0}static test(t){return Array.isArray(t)&&t.length===RN.SIDES}};let PN=RN;PN.SIDES=6;class IN extends cL{constructor(t,e){let r,i;e=e||{},"string"==typeof t?(r=IN.EMPTY,i=t):(r=t,i=null),super(r),this.url=i,this.crossOrigin=e.crossOrigin??!0,this.alphaMode="number"==typeof e.alphaMode?e.alphaMode:null,this._load=null,!1!==e.autoLoad&&this.load()}load(){return this._load||(this._load=new Promise((async(t,e)=>{if(null!==this.url)try{const e=await PR.ADAPTER.fetch(this.url,{mode:this.crossOrigin?"cors":"no-cors"});if(this.destroyed)return;const r=await e.blob();if(this.destroyed)return;const i=await createImageBitmap(r,{premultiplyAlpha:null===this.alphaMode||this.alphaMode===xR.UNPACK?"premultiply":"none"});if(this.destroyed)return;this.source=i,this.update(),t(this)}catch(t){if(this.destroyed)return;e(t),this.onError.emit(t)}else t(this)}))),this._load}upload(t,e,r){return this.source instanceof ImageBitmap?("number"==typeof this.alphaMode&&(e.alphaMode=this.alphaMode),super.upload(t,e,r)):(this.load(),!1)}dispose(){this.source instanceof ImageBitmap&&this.source.close(),super.dispose(),this._load=null}static test(t){return!!globalThis.createImageBitmap&&"undefined"!=typeof ImageBitmap&&("string"==typeof t||t instanceof ImageBitmap)}static get EMPTY(){return IN._EMPTY=IN._EMPTY??PR.ADAPTER.createCanvas(0,0),IN._EMPTY}}const MN=class extends cL{constructor(t,e){e=e||{},super(PR.ADAPTER.createCanvas()),this._width=0,this._height=0,this.svg=t,this.scale=e.scale||1,this._overrideWidth=e.width,this._overrideHeight=e.height,this._resolve=null,this._crossorigin=e.crossorigin,this._load=null,!1!==e.autoLoad&&this.load()}load(){return this._load||(this._load=new Promise((t=>{if(this._resolve=()=>{this.resize(this.source.width,this.source.height),t(this)},MN.SVG_XML.test(this.svg.trim())){if(!btoa)throw new Error("Your browser doesn't support base64 conversions.");this.svg=`data:image/svg+xml;base64,${btoa(unescape(encodeURIComponent(this.svg)))}`}this._loadSvg()}))),this._load}_loadSvg(){const t=new Image;cL.crossOrigin(t,this.svg,this._crossorigin),t.src=this.svg,t.onerror=e=>{this._resolve&&(t.onerror=null,this.onError.emit(e))},t.onload=()=>{if(!this._resolve)return;const e=t.width,r=t.height;if(!e||!r)throw new Error("The SVG image must have width and height defined (in pixels), canvas API needs them.");let i=e*this.scale,n=r*this.scale;(this._overrideWidth||this._overrideHeight)&&(i=this._overrideWidth||this._overrideHeight/r*e,n=this._overrideHeight||this._overrideWidth/e*r),i=Math.round(i),n=Math.round(n);const s=this.source;s.width=i,s.height=n,s._pixiId=`canvas_${mk()}`,s.getContext("2d").drawImage(t,0,0,e,r,0,0,i,n),this._resolve(),this._resolve=null}}static getSize(t){const e=MN.SVG_SIZE.exec(t),r={};return e&&(r[e[1]]=Math.round(parseFloat(e[3])),r[e[5]]=Math.round(parseFloat(e[7]))),r}dispose(){super.dispose(),this._resolve=null,this._crossorigin=null}static test(t,e){return"svg"===e||"string"==typeof t&&t.startsWith("data:image/svg+xml")||"string"==typeof t&&MN.SVG_XML.test(t)}};let ON=MN;ON.SVG_XML=/^(<\?xml[^?]+\?>)?\s*(<!--[^(-->)]*-->)?\s*\<svg/m,ON.SVG_SIZE=/<svg[^>]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*>/i;const kN=class extends cL{constructor(t,e){if(e=e||{},!(t instanceof HTMLVideoElement)){const r=document.createElement("video");r.setAttribute("preload","auto"),r.setAttribute("webkit-playsinline",""),r.setAttribute("playsinline",""),"string"==typeof t&&(t=[t]);const i=t[0].src||t[0];cL.crossOrigin(r,i,e.crossorigin);for(let e=0;e<t.length;++e){const i=document.createElement("source");let{src:n,mime:s}=t[e];n=n||t[e];const o=n.split("?").shift().toLowerCase(),a=o.slice(o.lastIndexOf(".")+1);s=s||kN.MIME_TYPES[a]||`video/${a}`,i.src=n,i.type=s,r.appendChild(i)}t=r}super(t),this.noSubImage=!0,this._autoUpdate=!0,this._isConnectedToTicker=!1,this._updateFPS=e.updateFPS||0,this._msToNextUpdate=0,this.autoPlay=!1!==e.autoPlay,this._load=null,this._resolve=null,this._onCanPlay=this._onCanPlay.bind(this),this._onError=this._onError.bind(this),!1!==e.autoLoad&&this.load()}update(t=0){if(!this.destroyed){const t=mN.shared.elapsedMS*this.source.playbackRate;this._msToNextUpdate=Math.floor(this._msToNextUpdate-t),(!this._updateFPS||this._msToNextUpdate<=0)&&(super.update(),this._msToNextUpdate=this._updateFPS?Math.floor(1e3/this._updateFPS):0)}}load(){if(this._load)return this._load;const t=this.source;return(t.readyState===t.HAVE_ENOUGH_DATA||t.readyState===t.HAVE_FUTURE_DATA)&&t.width&&t.height&&(t.complete=!0),t.addEventListener("play",this._onPlayStart.bind(this)),t.addEventListener("pause",this._onPlayStop.bind(this)),this._isSourceReady()?this._onCanPlay():(t.addEventListener("canplay",this._onCanPlay),t.addEventListener("canplaythrough",this._onCanPlay),t.addEventListener("error",this._onError,!0)),this._load=new Promise((e=>{this.valid?e(this):(this._resolve=e,t.load())})),this._load}_onError(t){this.source.removeEventListener("error",this._onError,!0),this.onError.emit(t)}_isSourcePlaying(){const t=this.source;return!t.paused&&!t.ended&&this._isSourceReady()}_isSourceReady(){return this.source.readyState>2}_onPlayStart(){this.valid||this._onCanPlay(),this.autoUpdate&&!this._isConnectedToTicker&&(mN.shared.add(this.update,this),this._isConnectedToTicker=!0)}_onPlayStop(){this._isConnectedToTicker&&(mN.shared.remove(this.update,this),this._isConnectedToTicker=!1)}_onCanPlay(){const t=this.source;t.removeEventListener("canplay",this._onCanPlay),t.removeEventListener("canplaythrough",this._onCanPlay);const e=this.valid;this.resize(t.videoWidth,t.videoHeight),!e&&this._resolve&&(this._resolve(this),this._resolve=null),this._isSourcePlaying()?this._onPlayStart():this.autoPlay&&t.play()}dispose(){this._isConnectedToTicker&&(mN.shared.remove(this.update,this),this._isConnectedToTicker=!1);const t=this.source;t&&(t.removeEventListener("error",this._onError,!0),t.pause(),t.src="",t.load()),super.dispose()}get autoUpdate(){return this._autoUpdate}set autoUpdate(t){t!==this._autoUpdate&&(this._autoUpdate=t,!this._autoUpdate&&this._isConnectedToTicker?(mN.shared.remove(this.update,this),this._isConnectedToTicker=!1):this._autoUpdate&&!this._isConnectedToTicker&&this._isSourcePlaying()&&(mN.shared.add(this.update,this),this._isConnectedToTicker=!0))}get updateFPS(){return this._updateFPS}set updateFPS(t){t!==this._updateFPS&&(this._updateFPS=t)}static test(t,e){return globalThis.HTMLVideoElement&&t instanceof HTMLVideoElement||kN.TYPES.includes(e)}};let DN,LN=kN;function NN(t){const e=PR.ADAPTER.createCanvas(6,1),r=e.getContext("2d");return r.fillStyle=t,r.fillRect(0,0,6,1),e}function FN(){if("undefined"==typeof document)return!1;if(void 0!==DN)return DN;const t=NN("#ff00ff"),e=NN("#ffff00"),r=PR.ADAPTER.createCanvas(6,1).getContext("2d");r.globalCompositeOperation="multiply",r.drawImage(t,0,0),r.drawImage(e,2,0);const i=r.getImageData(2,0,1,1);if(i){const t=i.data;DN=255===t[0]&&0===t[1]&&0===t[2]}else DN=!1;return DN}LN.TYPES=["mp4","m4v","webm","ogg","ogv","h264","avi","mov"],LN.MIME_TYPES={ogv:"video/ogg",mov:"video/quicktime",m4v:"video/mp4"},Bk.push(IN,uL,AN,LN,ON,Vk,PN,class extends CN{constructor(t,e){const{width:r,height:i}=e||{};let n,s;Array.isArray(t)?(n=t,s=t.length):s=t,super(s,{width:r,height:i}),n&&this.initFromArray(n,e)}addBaseTextureAt(t,e){if(!t.resource)throw new Error("ArrayResource does not support RenderTexture");return this.addResourceAt(t.resource,e),this}bind(t){super.bind(t),t.target=mR.TEXTURE_2D_ARRAY}upload(t,e,r){const{length:i,itemDirtyIds:n,items:s}=this,{gl:o}=t;r.dirtyId<0&&o.texImage3D(o.TEXTURE_2D_ARRAY,0,r.internalFormat,this._width,this._height,i,0,e.format,r.type,null);for(let t=0;t<i;t++){const i=s[t];n[t]<i.dirtyId&&(n[t]=i.dirtyId,i.valid&&o.texSubImage3D(o.TEXTURE_2D_ARRAY,0,0,0,t,i.resource.width,i.resource.height,1,e.format,r.type,i.resource.source))}return!0}}),Xk.prototype.getDrawableSource=function(){const t=this.resource;return t?t.bitmap||t.source:null},lL.prototype._canvasRenderTarget=null,mL.prototype.patternCache=null,mL.prototype.tintCache=null;const BN=new pD;class UN{constructor(t){this.activeResolution=1,this.smoothProperty="imageSmoothingEnabled",this.blendModes=function(t=[]){return FN()?(t[dR.NORMAL]="source-over",t[dR.ADD]="lighter",t[dR.MULTIPLY]="multiply",t[dR.SCREEN]="screen",t[dR.OVERLAY]="overlay",t[dR.DARKEN]="darken",t[dR.LIGHTEN]="lighten",t[dR.COLOR_DODGE]="color-dodge",t[dR.COLOR_BURN]="color-burn",t[dR.HARD_LIGHT]="hard-light",t[dR.SOFT_LIGHT]="soft-light",t[dR.DIFFERENCE]="difference",t[dR.EXCLUSION]="exclusion",t[dR.HUE]="hue",t[dR.SATURATION]="saturation",t[dR.COLOR]="color",t[dR.LUMINOSITY]="luminosity"):(t[dR.NORMAL]="source-over",t[dR.ADD]="lighter",t[dR.MULTIPLY]="source-over",t[dR.SCREEN]="source-over",t[dR.OVERLAY]="source-over",t[dR.DARKEN]="source-over",t[dR.LIGHTEN]="source-over",t[dR.COLOR_DODGE]="source-over",t[dR.COLOR_BURN]="source-over",t[dR.HARD_LIGHT]="source-over",t[dR.SOFT_LIGHT]="source-over",t[dR.DIFFERENCE]="source-over",t[dR.EXCLUSION]="source-over",t[dR.HUE]="source-over",t[dR.SATURATION]="source-over",t[dR.COLOR]="source-over",t[dR.LUMINOSITY]="source-over"),t[dR.NORMAL_NPM]=t[dR.NORMAL],t[dR.ADD_NPM]=t[dR.ADD],t[dR.SCREEN_NPM]=t[dR.SCREEN],t[dR.SRC_IN]="source-in",t[dR.SRC_OUT]="source-out",t[dR.SRC_ATOP]="source-atop",t[dR.DST_OVER]="destination-over",t[dR.DST_IN]="destination-in",t[dR.DST_OUT]="destination-out",t[dR.DST_ATOP]="destination-atop",t[dR.XOR]="xor",t[dR.SUBTRACT]="source-over",t}(),this._activeBlendMode=null,this._projTransform=null,this._outerBlend=!1,this.renderer=t}init(){const t=this.renderer.background.alpha<1;if(this.rootContext=this.renderer.view.getContext("2d",{alpha:t}),this.activeContext=this.rootContext,!this.rootContext.imageSmoothingEnabled){const t=this.rootContext;t.webkitImageSmoothingEnabled?this.smoothProperty="webkitImageSmoothingEnabled":t.mozImageSmoothingEnabled?this.smoothProperty="mozImageSmoothingEnabled":t.oImageSmoothingEnabled?this.smoothProperty="oImageSmoothingEnabled":t.msImageSmoothingEnabled&&(this.smoothProperty="msImageSmoothingEnabled")}}setContextTransform(t,e,r){let i=t;const n=this._projTransform,s=this.activeResolution;r=r||s,n&&(i=BN,i.copyFrom(t),i.prepend(n)),e?this.activeContext.setTransform(i.a*r,i.b*r,i.c*r,i.d*r,i.tx*s|0,i.ty*s|0):this.activeContext.setTransform(i.a*r,i.b*r,i.c*r,i.d*r,i.tx*s,i.ty*s)}clear(t,e){const{activeContext:r,renderer:i}=this,n=t?QO.shared.setValue(t):this.renderer.background.backgroundColor;r.clearRect(0,0,i.width,i.height),t&&(r.globalAlpha=e??this.renderer.background.alpha,r.fillStyle=n.toHex(),r.fillRect(0,0,i.width,i.height),r.globalAlpha=1)}setBlendMode(t,e){const r=t===dR.SRC_IN||t===dR.SRC_OUT||t===dR.DST_IN||t===dR.DST_ATOP;!e&&r&&(t=dR.NORMAL),this._activeBlendMode!==t&&(this._activeBlendMode=t,this._outerBlend=r,this.activeContext.globalCompositeOperation=this.blendModes[t])}resize(){this.smoothProperty&&(this.rootContext[this.smoothProperty]=Xk.defaultOptions.scaleMode===yR.LINEAR)}invalidateBlendMode(){this._activeBlendMode=this.blendModes.indexOf(this.activeContext.globalCompositeOperation)}destroy(){this.renderer=null,this.rootContext=null,this.activeContext=null,this.smoothProperty=null}}UN.extension={type:Ik.CanvasRendererSystem,name:"canvasContext"},kk.add(UN);class GN{constructor(t){this._foundShapes=[],this.renderer=t}pushMask(t){const e=this.renderer,r=t.maskObject||t;e.canvasContext.activeContext.save();const i=this._foundShapes;if(this.recursiveFindShapes(r,i),i.length>0){const t=e.canvasContext.activeContext;t.beginPath();for(let t=0;t<i.length;t++){const e=i[t],r=e.transform.worldTransform;this.renderer.canvasContext.setContextTransform(r),this.renderGraphicsShape(e)}i.length=0,t.clip()}}recursiveFindShapes(t,e){t.geometry&&t.geometry.graphicsData&&e.push(t);const{children:r}=t;if(r)for(let t=0;t<r.length;t++)this.recursiveFindShapes(r[t],e)}renderGraphicsShape(t){t.finishPoly();const e=this.renderer.canvasContext.activeContext,r=t.geometry.graphicsData,i=r.length;if(0!==i)for(let t=0;t<i;t++){const i=r[t],n=i.shape;if(n.type===sD.POLY){let t=n.points;const r=i.holes;let s,o,a,h;e.moveTo(t[0],t[1]);for(let r=1;r<t.length/2;r++)e.lineTo(t[2*r],t[2*r+1]);if(r.length>0){s=0,a=t[0],h=t[1];for(let e=2;e+2<t.length;e+=2)s+=(t[e]-a)*(t[e+3]-h)-(t[e+2]-a)*(t[e+1]-h);for(let i=0;i<r.length;i++)if(t=r[i].shape.points,t){o=0,a=t[0],h=t[1];for(let e=2;e+2<t.length;e+=2)o+=(t[e]-a)*(t[e+3]-h)-(t[e+2]-a)*(t[e+1]-h);if(o*s<0){e.moveTo(t[0],t[1]);for(let r=2;r<t.length;r+=2)e.lineTo(t[r],t[r+1])}else{e.moveTo(t[t.length-2],t[t.length-1]);for(let r=t.length-4;r>=0;r-=2)e.lineTo(t[r],t[r+1])}r[i].shape.closeStroke&&e.closePath()}}t[0]===t[t.length-2]&&t[1]===t[t.length-1]&&e.closePath()}else if(n.type===sD.RECT)e.rect(n.x,n.y,n.width,n.height),e.closePath();else if(n.type===sD.CIRC)e.arc(n.x,n.y,n.radius,0,2*Math.PI),e.closePath();else if(n.type===sD.ELIP){const t=2*n.width,r=2*n.height,i=n.x-t/2,s=n.y-r/2,o=.5522848,a=t/2*o,h=r/2*o,l=i+t,c=s+r,u=i+t/2,d=s+r/2;e.moveTo(i,d),e.bezierCurveTo(i,d-h,u-a,s,u,s),e.bezierCurveTo(u+a,s,l,d-h,l,d),e.bezierCurveTo(l,d+h,u+a,c,u,c),e.bezierCurveTo(u-a,c,i,d+h,i,d),e.closePath()}else if(n.type===sD.RREC){const t=n.x,r=n.y,i=n.width,s=n.height;let o=n.radius;const a=Math.min(i,s)/2;o=o>a?a:o,e.moveTo(t,r+o),e.lineTo(t,r+s-o),e.quadraticCurveTo(t,r+s,t+o,r+s),e.lineTo(t+i-o,r+s),e.quadraticCurveTo(t+i,r+s,t+i,r+s-o),e.lineTo(t+i,r+o),e.quadraticCurveTo(t+i,r,t+i-o,r),e.lineTo(t+o,r),e.quadraticCurveTo(t,r,t,r+o),e.closePath()}}}popMask(t){t.canvasContext.activeContext.restore(),t.canvasContext.invalidateBlendMode()}destroy(){}}GN.extension={type:Ik.CanvasRendererSystem,name:"mask"},kk.add(GN);class jN{constructor(t){this.renderer=t}render(t,e){const r=this.renderer;if(!r.view)return;const i=r.canvasContext;let n,s,o,a;e&&(n=e.renderTexture,s=e.clear,o=e.transform,a=e.skipUpdateTransform),this.renderingToScreen=!n,r.emit("prerender");const h=r.resolution;n?(n=n.castToBaseTexture(),n._canvasRenderTarget||(n._canvasRenderTarget=new xk(n.width,n.height,n.resolution),n.resource=new AN(n._canvasRenderTarget.canvas),n.valid=!0),i.activeContext=n._canvasRenderTarget.context,r.canvasContext.activeResolution=n._canvasRenderTarget.resolution):(i.activeContext=i.rootContext,i.activeResolution=h);const l=i.activeContext;if(i._projTransform=o||null,n||(this.lastObjectRendered=t),!a){const e=t.enableTempParent();t.updateTransform(),t.disableTempParent(e)}if(l.save(),l.setTransform(1,0,0,1,0,0),l.globalAlpha=1,i._activeBlendMode=dR.NORMAL,i._outerBlend=!1,l.globalCompositeOperation=i.blendModes[dR.NORMAL],s??r.background.clearBeforeRender)if(this.renderingToScreen){l.clearRect(0,0,r.width,r.height);const t=r.background;t.alpha>0&&(l.globalAlpha=t.backgroundColor.alpha,l.fillStyle=t.backgroundColor.toHex(),l.fillRect(0,0,r.width,r.height),l.globalAlpha=1)}else n._canvasRenderTarget.clear(),n.clear.alpha>0&&(l.globalAlpha=n.clear.alpha,l.fillStyle=n.clear.toHex(),l.fillRect(0,0,n.realWidth,n.realHeight),l.globalAlpha=1);const c=i.activeContext;i.activeContext=l,t.renderCanvas(r),i.activeContext=c,l.restore(),i.activeResolution=h,i._projTransform=null,r.emit("postrender")}destroy(){this.lastObjectRendered=null,this.render=null}}jN.extension={type:Ik.CanvasRendererSystem,name:"objectRenderer"},kk.add(jN);const{deprecation:VN}=Pk,HN=class extends sN{constructor(t){super(),this.type=cR.CANVAS,this.rendererLogId="Canvas",t=Object.assign({},PR.RENDER_OPTIONS,t);const e={runners:["init","destroy","contextChange","resolutionChange","reset","update","postrender","prerender","resize"],systems:HN.__systems,priority:["textureGenerator","background","_view","_plugin","startup","mask","canvasContext","objectRenderer"]};this.setup(e),"useContextAlpha"in t&&(VN("7.0.0","options.useContextAlpha is deprecated, use options.backgroundAlpha instead"),t.backgroundAlpha=!1===t.useContextAlpha?1:t.backgroundAlpha),this._plugin.rendererPlugins=HN.__plugins,this.options=t,this.startup.run(this.options)}static test(){return!0}generateTexture(t,e){return this.textureGenerator.generateTexture(t,e)}reset(){}render(t,e){this.objectRenderer.render(t,e)}clear(){this.canvasContext.clear()}destroy(t){this.runners.destroy.items.reverse(),this.emitWithCustomOptions(this.runners.destroy,{_view:t}),super.destroy()}get plugins(){return this._plugin.plugins}resize(t,e){this._view.resizeView(t,e)}get width(){return this._view.element.width}get height(){return this._view.element.height}get resolution(){return this._view.resolution}set resolution(t){this._view.resolution=t,this.runners.resolutionChange.emit(t)}get autoDensity(){return this._view.autoDensity}get view(){return this._view.element}get screen(){return this._view.screen}get lastObjectRendered(){return this.objectRenderer.lastObjectRendered}get renderingToScreen(){return this.objectRenderer.renderingToScreen}get clearBeforeRender(){return this.background.clearBeforeRender}get blendModes(){return VN("7.0.0","renderer.blendModes has been deprecated, please use renderer.canvasContext.blendModes instead"),this.canvasContext.blendModes}get maskManager(){return VN("7.0.0","renderer.maskManager has been deprecated, please use renderer.mask instead"),this.mask}get refresh(){return VN("7.0.0","renderer.refresh has been deprecated"),!0}get rootContext(){return VN("7.0.0","renderer.rootContext has been deprecated, please use renderer.canvasContext.rootContext instead"),this.canvasContext.rootContext}get context(){return VN("7.0.0","renderer.context has been deprecated, please use renderer.canvasContext.activeContext instead"),this.canvasContext.activeContext}get smoothProperty(){return VN("7.0.0","renderer.smoothProperty has been deprecated, please use renderer.canvasContext.smoothProperty instead"),this.canvasContext.smoothProperty}setBlendMode(t,e){VN("7.0.0","renderer.setBlendMode has been deprecated, use renderer.canvasContext.setBlendMode instead"),this.canvasContext.setBlendMode(t,e)}invalidateBlendMode(){VN("7.0.0","renderer.invalidateBlendMode has been deprecated, use renderer.canvasContext.invalidateBlendMode instead"),this.canvasContext.invalidateBlendMode()}setContextTransform(t,e,r){VN("7.0.0","renderer.setContextTransform has been deprecated, use renderer.canvasContext.setContextTransform instead"),this.canvasContext.setContextTransform(t,e,r)}get backgroundColor(){return VN("7.0.0","renderer.backgroundColor has been deprecated, use renderer.background.color instead."),this.background.color}set backgroundColor(t){VN("7.0.0","renderer.backgroundColor has been deprecated, use renderer.background.color instead."),this.background.color=t}get backgroundAlpha(){return VN("7.0.0","renderer.backgroundAlpha has been deprecated, use renderer.background.alpha instead."),this.background.alpha}set backgroundAlpha(t){VN("7.0.0","renderer.backgroundAlpha has been deprecated, use renderer.background.alpha instead."),this.background.alpha=t}get preserveDrawingBuffer(){return VN("7.0.0","renderer.preserveDrawingBuffer has been deprecated"),!1}get useContextAlpha(){return VN("7.0.0","renderer.useContextAlpha has been deprecated"),!1}};let WN=HN;WN.extension={type:Ik.Renderer,priority:0},WN.__plugins={},WN.__systems={},kk.handleByMap(Ik.CanvasRendererPlugin,WN.__plugins),kk.handleByMap(Ik.CanvasRendererSystem,WN.__systems),kk.add(WN);const XN={canvas:null,getTintedCanvas:(t,e)=>{const r=t.texture,i=`#${`00000${(0|(e=XN.roundColor(e))).toString(16)}`.slice(-6)}`;r.tintCache=r.tintCache||{};const n=r.tintCache[i];let s;if(n){if(n.tintId===r._updateID)return r.tintCache[i];s=r.tintCache[i]}else s=PR.ADAPTER.createCanvas();return XN.tintMethod(r,e,s),s.tintId=r._updateID,r.tintCache[i]=s,s},getTintedPattern:(t,e)=>{const r=`#${`00000${(0|(e=XN.roundColor(e))).toString(16)}`.slice(-6)}`;t.patternCache=t.patternCache||{};let i=t.patternCache[r];return i?.tintId===t._updateID||(XN.canvas||(XN.canvas=PR.ADAPTER.createCanvas()),XN.tintMethod(t,e,XN.canvas),i=XN.canvas.getContext("2d").createPattern(XN.canvas,"repeat"),i.tintId=t._updateID,t.patternCache[r]=i),i},tintWithMultiply:(t,e,r)=>{const i=r.getContext("2d"),n=t._frame.clone(),s=t.baseTexture.resolution;n.x*=s,n.y*=s,n.width*=s,n.height*=s,r.width=Math.ceil(n.width),r.height=Math.ceil(n.height),i.save(),i.fillStyle=`#${`00000${(0|e).toString(16)}`.slice(-6)}`,i.fillRect(0,0,n.width,n.height),i.globalCompositeOperation="multiply";const o=t.baseTexture.getDrawableSource();i.drawImage(o,n.x,n.y,n.width,n.height,0,0,n.width,n.height),i.globalCompositeOperation="destination-atop",i.drawImage(o,n.x,n.y,n.width,n.height,0,0,n.width,n.height),i.restore()},tintWithOverlay:(t,e,r)=>{const i=r.getContext("2d"),n=t._frame.clone(),s=t.baseTexture.resolution;n.x*=s,n.y*=s,n.width*=s,n.height*=s,r.width=Math.ceil(n.width),r.height=Math.ceil(n.height),i.save(),i.globalCompositeOperation="copy",i.fillStyle=`#${`00000${(0|e).toString(16)}`.slice(-6)}`,i.fillRect(0,0,n.width,n.height),i.globalCompositeOperation="destination-atop",i.drawImage(t.baseTexture.getDrawableSource(),n.x,n.y,n.width,n.height,0,0,n.width,n.height),i.restore()},tintWithPerPixel:(t,e,r)=>{const i=r.getContext("2d"),n=t._frame.clone(),s=t.baseTexture.resolution;n.x*=s,n.y*=s,n.width*=s,n.height*=s,r.width=Math.ceil(n.width),r.height=Math.ceil(n.height),i.save(),i.globalCompositeOperation="copy",i.drawImage(t.baseTexture.getDrawableSource(),n.x,n.y,n.width,n.height,0,0,n.width,n.height),i.restore();const[o,a,h]=QO.shared.setValue(e).toArray(),l=i.getImageData(0,0,n.width,n.height),c=l.data;for(let t=0;t<c.length;t+=4)c[t+0]*=o,c[t+1]*=a,c[t+2]*=h;i.putImageData(l,0,0)},roundColor:t=>QO.shared.setValue(t).round(XN.cacheStepsPerColorChannel).toNumber(),cacheStepsPerColorChannel:8,convertTintToImage:!1,canUseMultiply:FN(),tintMethod:null};XN.tintMethod=XN.canUseMultiply?XN.tintWithMultiply:XN.tintWithPerPixel;class zN{constructor(){this.minX=1/0,this.minY=1/0,this.maxX=-1/0,this.maxY=-1/0,this.rect=null,this.updateID=-1}isEmpty(){return this.minX>this.maxX||this.minY>this.maxY}clear(){this.minX=1/0,this.minY=1/0,this.maxX=-1/0,this.maxY=-1/0}getRectangle(t){return this.minX>this.maxX||this.minY>this.maxY?hD.EMPTY:((t=t||new hD(0,0,1,1)).x=this.minX,t.y=this.minY,t.width=this.maxX-this.minX,t.height=this.maxY-this.minY,t)}addPoint(t){this.minX=Math.min(this.minX,t.x),this.maxX=Math.max(this.maxX,t.x),this.minY=Math.min(this.minY,t.y),this.maxY=Math.max(this.maxY,t.y)}addPointMatrix(t,e){const{a:r,b:i,c:n,d:s,tx:o,ty:a}=t,h=r*e.x+n*e.y+o,l=i*e.x+s*e.y+a;this.minX=Math.min(this.minX,h),this.maxX=Math.max(this.maxX,h),this.minY=Math.min(this.minY,l),this.maxY=Math.max(this.maxY,l)}addQuad(t){let e=this.minX,r=this.minY,i=this.maxX,n=this.maxY,s=t[0],o=t[1];e=s<e?s:e,r=o<r?o:r,i=s>i?s:i,n=o>n?o:n,s=t[2],o=t[3],e=s<e?s:e,r=o<r?o:r,i=s>i?s:i,n=o>n?o:n,s=t[4],o=t[5],e=s<e?s:e,r=o<r?o:r,i=s>i?s:i,n=o>n?o:n,s=t[6],o=t[7],e=s<e?s:e,r=o<r?o:r,i=s>i?s:i,n=o>n?o:n,this.minX=e,this.minY=r,this.maxX=i,this.maxY=n}addFrame(t,e,r,i,n){this.addFrameMatrix(t.worldTransform,e,r,i,n)}addFrameMatrix(t,e,r,i,n){const s=t.a,o=t.b,a=t.c,h=t.d,l=t.tx,c=t.ty;let u=this.minX,d=this.minY,p=this.maxX,f=this.maxY,m=s*e+a*r+l,g=o*e+h*r+c;u=m<u?m:u,d=g<d?g:d,p=m>p?m:p,f=g>f?g:f,m=s*i+a*r+l,g=o*i+h*r+c,u=m<u?m:u,d=g<d?g:d,p=m>p?m:p,f=g>f?g:f,m=s*e+a*n+l,g=o*e+h*n+c,u=m<u?m:u,d=g<d?g:d,p=m>p?m:p,f=g>f?g:f,m=s*i+a*n+l,g=o*i+h*n+c,u=m<u?m:u,d=g<d?g:d,p=m>p?m:p,f=g>f?g:f,this.minX=u,this.minY=d,this.maxX=p,this.maxY=f}addVertexData(t,e,r){let i=this.minX,n=this.minY,s=this.maxX,o=this.maxY;for(let a=e;a<r;a+=2){const e=t[a],r=t[a+1];i=e<i?e:i,n=r<n?r:n,s=e>s?e:s,o=r>o?r:o}this.minX=i,this.minY=n,this.maxX=s,this.maxY=o}addVertices(t,e,r,i){this.addVerticesMatrix(t.worldTransform,e,r,i)}addVerticesMatrix(t,e,r,i,n=0,s=n){const o=t.a,a=t.b,h=t.c,l=t.d,c=t.tx,u=t.ty;let d=this.minX,p=this.minY,f=this.maxX,m=this.maxY;for(let t=r;t<i;t+=2){const r=e[t],i=e[t+1],g=o*r+h*i+c,v=l*i+a*r+u;d=Math.min(d,g-n),f=Math.max(f,g+n),p=Math.min(p,v-s),m=Math.max(m,v+s)}this.minX=d,this.minY=p,this.maxX=f,this.maxY=m}addBounds(t){const e=this.minX,r=this.minY,i=this.maxX,n=this.maxY;this.minX=t.minX<e?t.minX:e,this.minY=t.minY<r?t.minY:r,this.maxX=t.maxX>i?t.maxX:i,this.maxY=t.maxY>n?t.maxY:n}addBoundsMask(t,e){const r=t.minX>e.minX?t.minX:e.minX,i=t.minY>e.minY?t.minY:e.minY,n=t.maxX<e.maxX?t.maxX:e.maxX,s=t.maxY<e.maxY?t.maxY:e.maxY;if(r<=n&&i<=s){const t=this.minX,e=this.minY,o=this.maxX,a=this.maxY;this.minX=r<t?r:t,this.minY=i<e?i:e,this.maxX=n>o?n:o,this.maxY=s>a?s:a}}addBoundsMatrix(t,e){this.addFrameMatrix(e,t.minX,t.minY,t.maxX,t.maxY)}addBoundsArea(t,e){const r=t.minX>e.x?t.minX:e.x,i=t.minY>e.y?t.minY:e.y,n=t.maxX<e.x+e.width?t.maxX:e.x+e.width,s=t.maxY<e.y+e.height?t.maxY:e.y+e.height;if(r<=n&&i<=s){const t=this.minX,e=this.minY,o=this.maxX,a=this.maxY;this.minX=r<t?r:t,this.minY=i<e?i:e,this.maxX=n>o?n:o,this.maxY=s>a?s:a}}pad(t=0,e=t){this.isEmpty()||(this.minX-=t,this.maxX+=t,this.minY-=e,this.maxY+=e)}addFramePad(t,e,r,i,n,s){t-=n,e-=s,r+=n,i+=s,this.minX=this.minX<t?this.minX:t,this.maxX=this.maxX>r?this.maxX:r,this.minY=this.minY<e?this.minY:e,this.maxY=this.maxY>i?this.maxY:i}}class YN extends $R{constructor(){super(),this.tempDisplayObjectParent=null,this.transform=new SD,this.alpha=1,this.visible=!0,this.renderable=!0,this.cullable=!1,this.cullArea=null,this.parent=null,this.worldAlpha=1,this._lastSortedIndex=0,this._zIndex=0,this.filterArea=null,this.filters=null,this._enabledFilters=null,this._bounds=new zN,this._localBounds=null,this._boundsID=0,this._boundsRect=null,this._localBoundsRect=null,this._mask=null,this._maskRefCount=0,this._destroyed=!1,this.isSprite=!1,this.isMask=!1}static mixin(t){const e=Object.keys(t);for(let r=0;r<e.length;++r){const i=e[r];Object.defineProperty(YN.prototype,i,Object.getOwnPropertyDescriptor(t,i))}}get destroyed(){return this._destroyed}_recursivePostUpdateTransform(){this.parent?(this.parent._recursivePostUpdateTransform(),this.transform.updateTransform(this.parent.transform)):this.transform.updateTransform(this._tempDisplayObjectParent.transform)}updateTransform(){this._boundsID++,this.transform.updateTransform(this.parent.transform),this.worldAlpha=this.alpha*this.parent.worldAlpha}getBounds(t,e){return t||(this.parent?(this._recursivePostUpdateTransform(),this.updateTransform()):(this.parent=this._tempDisplayObjectParent,this.updateTransform(),this.parent=null)),this._bounds.updateID!==this._boundsID&&(this.calculateBounds(),this._bounds.updateID=this._boundsID),e||(this._boundsRect||(this._boundsRect=new hD),e=this._boundsRect),this._bounds.getRectangle(e)}getLocalBounds(t){t||(this._localBoundsRect||(this._localBoundsRect=new hD),t=this._localBoundsRect),this._localBounds||(this._localBounds=new zN);const e=this.transform,r=this.parent;this.parent=null,this.transform=this._tempDisplayObjectParent.transform;const i=this._bounds,n=this._boundsID;this._bounds=this._localBounds;const s=this.getBounds(!1,t);return this.parent=r,this.transform=e,this._bounds=i,this._bounds.updateID+=this._boundsID-n,s}toGlobal(t,e,r=!1){return r||(this._recursivePostUpdateTransform(),this.parent?this.displayObjectUpdateTransform():(this.parent=this._tempDisplayObjectParent,this.displayObjectUpdateTransform(),this.parent=null)),this.worldTransform.apply(t,e)}toLocal(t,e,r,i){return e&&(t=e.toGlobal(t,r,i)),i||(this._recursivePostUpdateTransform(),this.parent?this.displayObjectUpdateTransform():(this.parent=this._tempDisplayObjectParent,this.displayObjectUpdateTransform(),this.parent=null)),this.worldTransform.applyInverse(t,r)}setParent(t){if(!t||!t.addChild)throw new Error("setParent: Argument must be a Container");return t.addChild(this),t}removeFromParent(){this.parent?.removeChild(this)}setTransform(t=0,e=0,r=1,i=1,n=0,s=0,o=0,a=0,h=0){return this.position.x=t,this.position.y=e,this.scale.x=r||1,this.scale.y=i||1,this.rotation=n,this.skew.x=s,this.skew.y=o,this.pivot.x=a,this.pivot.y=h,this}destroy(t){this.removeFromParent(),this._destroyed=!0,this.transform=null,this.parent=null,this._bounds=null,this.mask=null,this.cullArea=null,this.filters=null,this.filterArea=null,this.hitArea=null,this.eventMode="auto",this.interactiveChildren=!1,this.emit("destroyed"),this.removeAllListeners()}get _tempDisplayObjectParent(){return null===this.tempDisplayObjectParent&&(this.tempDisplayObjectParent=new ZN),this.tempDisplayObjectParent}enableTempParent(){const t=this.parent;return this.parent=this._tempDisplayObjectParent,t}disableTempParent(t){this.parent=t}get x(){return this.position.x}set x(t){this.transform.position.x=t}get y(){return this.position.y}set y(t){this.transform.position.y=t}get worldTransform(){return this.transform.worldTransform}get localTransform(){return this.transform.localTransform}get position(){return this.transform.position}set position(t){this.transform.position.copyFrom(t)}get scale(){return this.transform.scale}set scale(t){this.transform.scale.copyFrom(t)}get pivot(){return this.transform.pivot}set pivot(t){this.transform.pivot.copyFrom(t)}get skew(){return this.transform.skew}set skew(t){this.transform.skew.copyFrom(t)}get rotation(){return this.transform.rotation}set rotation(t){this.transform.rotation=t}get angle(){return this.transform.rotation*iD}set angle(t){this.transform.rotation=t*nD}get zIndex(){return this._zIndex}set zIndex(t){this._zIndex=t,this.parent&&(this.parent.sortDirty=!0)}get worldVisible(){let t=this;do{if(!t.visible)return!1;t=t.parent}while(t);return!0}get mask(){return this._mask}set mask(t){if(this._mask!==t){if(this._mask){const t=this._mask.isMaskData?this._mask.maskObject:this._mask;t&&(t._maskRefCount--,0===t._maskRefCount&&(t.renderable=!0,t.isMask=!1))}if(this._mask=t,this._mask){const t=this._mask.isMaskData?this._mask.maskObject:this._mask;t&&(0===t._maskRefCount&&(t.renderable=!1,t.isMask=!0),t._maskRefCount++)}}}}class ZN extends YN{constructor(){super(...arguments),this.sortDirty=null}}YN.prototype.displayObjectUpdateTransform=YN.prototype.updateTransform;const $N=new pD;function KN(t,e){return t.zIndex===e.zIndex?t._lastSortedIndex-e._lastSortedIndex:t.zIndex-e.zIndex}const JN=class extends YN{constructor(){super(),this.children=[],this.sortableChildren=JN.defaultSortableChildren,this.sortDirty=!1}onChildrenChange(t){}addChild(...t){if(t.length>1)for(let e=0;e<t.length;e++)this.addChild(t[e]);else{const e=t[0];e.parent&&e.parent.removeChild(e),e.parent=this,this.sortDirty=!0,e.transform._parentID=-1,this.children.push(e),this._boundsID++,this.onChildrenChange(this.children.length-1),this.emit("childAdded",e,this,this.children.length-1),e.emit("added",this)}return t[0]}addChildAt(t,e){if(e<0||e>this.children.length)throw new Error(`${t}addChildAt: The index ${e} supplied is out of bounds ${this.children.length}`);return t.parent&&t.parent.removeChild(t),t.parent=this,this.sortDirty=!0,t.transform._parentID=-1,this.children.splice(e,0,t),this._boundsID++,this.onChildrenChange(e),t.emit("added",this),this.emit("childAdded",t,this,e),t}swapChildren(t,e){if(t===e)return;const r=this.getChildIndex(t),i=this.getChildIndex(e);this.children[r]=e,this.children[i]=t,this.onChildrenChange(r<i?r:i)}getChildIndex(t){const e=this.children.indexOf(t);if(-1===e)throw new Error("The supplied DisplayObject must be a child of the caller");return e}setChildIndex(t,e){if(e<0||e>=this.children.length)throw new Error(`The index ${e} supplied is out of bounds ${this.children.length}`);const r=this.getChildIndex(t);dk(this.children,r,1),this.children.splice(e,0,t),this.onChildrenChange(e)}getChildAt(t){if(t<0||t>=this.children.length)throw new Error(`getChildAt: Index (${t}) does not exist.`);return this.children[t]}removeChild(...t){if(t.length>1)for(let e=0;e<t.length;e++)this.removeChild(t[e]);else{const e=t[0],r=this.children.indexOf(e);if(-1===r)return null;e.parent=null,e.transform._parentID=-1,dk(this.children,r,1),this._boundsID++,this.onChildrenChange(r),e.emit("removed",this),this.emit("childRemoved",e,this,r)}return t[0]}removeChildAt(t){const e=this.getChildAt(t);return e.parent=null,e.transform._parentID=-1,dk(this.children,t,1),this._boundsID++,this.onChildrenChange(t),e.emit("removed",this),this.emit("childRemoved",e,this,t),e}removeChildren(t=0,e=this.children.length){const r=t,i=e-r;let n;if(i>0&&i<=e){n=this.children.splice(r,i);for(let t=0;t<n.length;++t)n[t].parent=null,n[t].transform&&(n[t].transform._parentID=-1);this._boundsID++,this.onChildrenChange(t);for(let t=0;t<n.length;++t)n[t].emit("removed",this),this.emit("childRemoved",n[t],this,t);return n}if(0===i&&0===this.children.length)return[];throw new RangeError("removeChildren: numeric values are outside the acceptable range.")}sortChildren(){let t=!1;for(let e=0,r=this.children.length;e<r;++e){const r=this.children[e];r._lastSortedIndex=e,t||0===r.zIndex||(t=!0)}t&&this.children.length>1&&this.children.sort(KN),this.sortDirty=!1}updateTransform(){this.sortableChildren&&this.sortDirty&&this.sortChildren(),this._boundsID++,this.transform.updateTransform(this.parent.transform),this.worldAlpha=this.alpha*this.parent.worldAlpha;for(let t=0,e=this.children.length;t<e;++t){const e=this.children[t];e.visible&&e.updateTransform()}}calculateBounds(){this._bounds.clear(),this._calculateBounds();for(let t=0;t<this.children.length;t++){const e=this.children[t];if(e.visible&&e.renderable)if(e.calculateBounds(),e._mask){const t=e._mask.isMaskData?e._mask.maskObject:e._mask;t?(t.calculateBounds(),this._bounds.addBoundsMask(e._bounds,t._bounds)):this._bounds.addBounds(e._bounds)}else e.filterArea?this._bounds.addBoundsArea(e._bounds,e.filterArea):this._bounds.addBounds(e._bounds)}this._bounds.updateID=this._boundsID}getLocalBounds(t,e=!1){const r=super.getLocalBounds(t);if(!e)for(let t=0,e=this.children.length;t<e;++t){const e=this.children[t];e.visible&&e.updateTransform()}return r}_calculateBounds(){}_renderWithCulling(t){const e=t.renderTexture.sourceFrame;if(!(e.width>0&&e.height>0))return;let r,i;this.cullArea?(r=this.cullArea,i=this.worldTransform):this._render!==JN.prototype._render&&(r=this.getBounds(!0));const n=t.projection.transform;if(n&&(i?(i=$N.copyFrom(i),i.prepend(n)):i=n),r&&e.intersects(r,i))this._render(t);else if(this.cullArea)return;for(let e=0,r=this.children.length;e<r;++e){const r=this.children[e],i=r.cullable;r.cullable=i||!this.cullArea,r.render(t),r.cullable=i}}render(t){if(this.visible&&!(this.worldAlpha<=0)&&this.renderable)if(this._mask||this.filters?.length)this.renderAdvanced(t);else if(this.cullable)this._renderWithCulling(t);else{this._render(t);for(let e=0,r=this.children.length;e<r;++e)this.children[e].render(t)}}renderAdvanced(t){const e=this.filters,r=this._mask;if(e){this._enabledFilters||(this._enabledFilters=[]),this._enabledFilters.length=0;for(let t=0;t<e.length;t++)e[t].enabled&&this._enabledFilters.push(e[t])}const i=e&&this._enabledFilters?.length||r&&(!r.isMaskData||r.enabled&&(r.autoDetect||r.type!==ER.NONE));if(i&&t.batch.flush(),e&&this._enabledFilters?.length&&t.filter.push(this,this._enabledFilters),r&&t.mask.push(this,this._mask),this.cullable)this._renderWithCulling(t);else{this._render(t);for(let e=0,r=this.children.length;e<r;++e)this.children[e].render(t)}i&&t.batch.flush(),r&&t.mask.pop(this),e&&this._enabledFilters?.length&&t.filter.pop()}_render(t){}destroy(t){super.destroy(),this.sortDirty=!1;const e="boolean"==typeof t?t:t?.children,r=this.removeChildren(0,this.children.length);if(e)for(let e=0;e<r.length;++e)r[e].destroy(t)}get width(){return this.scale.x*this.getLocalBounds().width}set width(t){const e=this.getLocalBounds().width;this.scale.x=0!==e?t/e:1,this._width=t}get height(){return this.scale.y*this.getLocalBounds().height}set height(t){const e=this.getLocalBounds().height;this.scale.y=0!==e?t/e:1,this._height=t}};let qN=JN;qN.defaultSortableChildren=!1,qN.prototype.containerUpdateTransform=qN.prototype.updateTransform,Object.defineProperties(PR,{SORTABLE_CHILDREN:{get:()=>qN.defaultSortableChildren,set(t){TO("7.1.0","settings.SORTABLE_CHILDREN is deprecated, use Container.defaultSortableChildren"),qN.defaultSortableChildren=t}}});const QN=new oD,tF=new Uint16Array([0,1,2,0,2,3]);class eF extends qN{constructor(t){super(),this._anchor=new TD(this._onAnchorUpdate,this,t?t.defaultAnchor.x:0,t?t.defaultAnchor.y:0),this._texture=null,this._width=0,this._height=0,this._tintColor=new QO(16777215),this._tintRGB=null,this.tint=16777215,this.blendMode=dR.NORMAL,this._cachedTint=16777215,this.uvs=null,this.texture=t||mL.EMPTY,this.vertexData=new Float32Array(8),this.vertexTrimmedData=null,this._transformID=-1,this._textureID=-1,this._transformTrimmedID=-1,this._textureTrimmedID=-1,this.indices=tF,this.pluginName="batch",this.isSprite=!0,this._roundPixels=PR.ROUND_PIXELS}_onTextureUpdate(){this._textureID=-1,this._textureTrimmedID=-1,this._cachedTint=16777215,this._width&&(this.scale.x=pk(this.scale.x)*this._width/this._texture.orig.width),this._height&&(this.scale.y=pk(this.scale.y)*this._height/this._texture.orig.height)}_onAnchorUpdate(){this._transformID=-1,this._transformTrimmedID=-1}calculateVertices(){const t=this._texture;if(this._transformID===this.transform._worldID&&this._textureID===t._updateID)return;this._textureID!==t._updateID&&(this.uvs=this._texture._uvs.uvsFloat32),this._transformID=this.transform._worldID,this._textureID=t._updateID;const e=this.transform.worldTransform,r=e.a,i=e.b,n=e.c,s=e.d,o=e.tx,a=e.ty,h=this.vertexData,l=t.trim,c=t.orig,u=this._anchor;let d=0,p=0,f=0,m=0;if(l?(p=l.x-u._x*c.width,d=p+l.width,m=l.y-u._y*c.height,f=m+l.height):(p=-u._x*c.width,d=p+c.width,m=-u._y*c.height,f=m+c.height),h[0]=r*p+n*m+o,h[1]=s*m+i*p+a,h[2]=r*d+n*m+o,h[3]=s*m+i*d+a,h[4]=r*d+n*f+o,h[5]=s*f+i*d+a,h[6]=r*p+n*f+o,h[7]=s*f+i*p+a,this._roundPixels){const t=PR.RESOLUTION;for(let e=0;e<h.length;++e)h[e]=Math.round(h[e]*t)/t}}calculateTrimmedVertices(){if(this.vertexTrimmedData){if(this._transformTrimmedID===this.transform._worldID&&this._textureTrimmedID===this._texture._updateID)return}else this.vertexTrimmedData=new Float32Array(8);this._transformTrimmedID=this.transform._worldID,this._textureTrimmedID=this._texture._updateID;const t=this._texture,e=this.vertexTrimmedData,r=t.orig,i=this._anchor,n=this.transform.worldTransform,s=n.a,o=n.b,a=n.c,h=n.d,l=n.tx,c=n.ty,u=-i._x*r.width,d=u+r.width,p=-i._y*r.height,f=p+r.height;e[0]=s*u+a*p+l,e[1]=h*p+o*u+c,e[2]=s*d+a*p+l,e[3]=h*p+o*d+c,e[4]=s*d+a*f+l,e[5]=h*f+o*d+c,e[6]=s*u+a*f+l,e[7]=h*f+o*u+c}_render(t){this.calculateVertices(),t.batch.setObjectRenderer(t.plugins[this.pluginName]),t.plugins[this.pluginName].render(this)}_calculateBounds(){const t=this._texture.trim,e=this._texture.orig;!t||t.width===e.width&&t.height===e.height?(this.calculateVertices(),this._bounds.addQuad(this.vertexData)):(this.calculateTrimmedVertices(),this._bounds.addQuad(this.vertexTrimmedData))}getLocalBounds(t){return 0===this.children.length?(this._localBounds||(this._localBounds=new zN),this._localBounds.minX=this._texture.orig.width*-this._anchor._x,this._localBounds.minY=this._texture.orig.height*-this._anchor._y,this._localBounds.maxX=this._texture.orig.width*(1-this._anchor._x),this._localBounds.maxY=this._texture.orig.height*(1-this._anchor._y),t||(this._localBoundsRect||(this._localBoundsRect=new hD),t=this._localBoundsRect),this._localBounds.getRectangle(t)):super.getLocalBounds.call(this,t)}containsPoint(t){this.worldTransform.applyInverse(t,QN);const e=this._texture.orig.width,r=this._texture.orig.height,i=-e*this.anchor.x;let n=0;return QN.x>=i&&QN.x<i+e&&(n=-r*this.anchor.y,QN.y>=n&&QN.y<n+r)}destroy(t){super.destroy(t),this._texture.off("update",this._onTextureUpdate,this),this._anchor=null;if("boolean"==typeof t?t:t?.texture){const e="boolean"==typeof t?t:t?.baseTexture;this._texture.destroy(!!e)}this._texture=null}static from(t,e){const r=t instanceof mL?t:mL.from(t,e);return new eF(r)}set roundPixels(t){this._roundPixels!==t&&(this._transformID=-1),this._roundPixels=t}get roundPixels(){return this._roundPixels}get width(){return Math.abs(this.scale.x)*this._texture.orig.width}set width(t){const e=pk(this.scale.x)||1;this.scale.x=e*t/this._texture.orig.width,this._width=t}get height(){return Math.abs(this.scale.y)*this._texture.orig.height}set height(t){const e=pk(this.scale.y)||1;this.scale.y=e*t/this._texture.orig.height,this._height=t}get anchor(){return this._anchor}set anchor(t){this._anchor.copyFrom(t)}get tint(){return this._tintColor.value}set tint(t){this._tintColor.setValue(t),this._tintRGB=this._tintColor.toLittleEndianNumber()}get tintValue(){return this._tintColor.toNumber()}get texture(){return this._texture}set texture(t){this._texture!==t&&(this._texture&&this._texture.off("update",this._onTextureUpdate,this),this._texture=t||mL.EMPTY,this._cachedTint=16777215,this._textureID=-1,this._textureTrimmedID=-1,t&&(t.baseTexture.valid?this._onTextureUpdate():t.once("update",this._onTextureUpdate,this)))}}const rF=new oD;class iF extends eF{constructor(t,e=100,r=100){super(t),this.tileTransform=new SD,this._width=e,this._height=r,this.uvMatrix=this.texture.uvMatrix||new IL(t),this.pluginName="tilingSprite",this.uvRespectAnchor=!1}get clampMargin(){return this.uvMatrix.clampMargin}set clampMargin(t){this.uvMatrix.clampMargin=t,this.uvMatrix.update(!0)}get tileScale(){return this.tileTransform.scale}set tileScale(t){this.tileTransform.scale.copyFrom(t)}get tilePosition(){return this.tileTransform.position}set tilePosition(t){this.tileTransform.position.copyFrom(t)}_onTextureUpdate(){this.uvMatrix&&(this.uvMatrix.texture=this._texture),this._cachedTint=16777215}_render(t){const e=this._texture;e&&e.valid&&(this.tileTransform.updateLocalTransform(),this.uvMatrix.update(),t.batch.setObjectRenderer(t.plugins[this.pluginName]),t.plugins[this.pluginName].render(this))}_calculateBounds(){const t=this._width*-this._anchor._x,e=this._height*-this._anchor._y,r=this._width*(1-this._anchor._x),i=this._height*(1-this._anchor._y);this._bounds.addFrame(this.transform,t,e,r,i)}getLocalBounds(t){return 0===this.children.length?(this._bounds.minX=this._width*-this._anchor._x,this._bounds.minY=this._height*-this._anchor._y,this._bounds.maxX=this._width*(1-this._anchor._x),this._bounds.maxY=this._height*(1-this._anchor._y),t||(this._localBoundsRect||(this._localBoundsRect=new hD),t=this._localBoundsRect),this._bounds.getRectangle(t)):super.getLocalBounds.call(this,t)}containsPoint(t){this.worldTransform.applyInverse(t,rF);const e=this._width,r=this._height,i=-e*this.anchor._x;if(rF.x>=i&&rF.x<i+e){const t=-r*this.anchor._y;if(rF.y>=t&&rF.y<t+r)return!0}return!1}destroy(t){super.destroy(t),this.tileTransform=null,this.uvMatrix=null}static from(t,e){const r=t instanceof mL?t:mL.from(t,e);return new iF(r,e.width,e.height)}get width(){return this._width}set width(t){this._width=t}get height(){return this._height}set height(t){this._height=t}}var nF="#version 100\n#define SHADER_NAME Tiling-Sprite-100\n\nprecision lowp float;\n\nattribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\n\nuniform mat3 projectionMatrix;\nuniform mat3 translationMatrix;\nuniform mat3 uTransform;\n\nvarying vec2 vTextureCoord;\n\nvoid main(void)\n{\n    gl_Position = vec4((projectionMatrix * translationMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n\n    vTextureCoord = (uTransform * vec3(aTextureCoord, 1.0)).xy;\n}\n";const sF=new pD;class oF extends qD{constructor(t){super(t),t.runners.contextChange.add(this),this.quad=new bL,this.state=Fk.for2d()}contextChange(){const t=this.renderer,e={globals:t.globalUniforms};this.simpleShader=$D.from(nF,"#version 100\n#define SHADER_NAME Tiling-Sprite-Simple-100\n\nprecision lowp float;\n\nvarying vec2 vTextureCoord;\n\nuniform sampler2D uSampler;\nuniform vec4 uColor;\n\nvoid main(void)\n{\n    vec4 texSample = texture2D(uSampler, vTextureCoord);\n    gl_FragColor = texSample * uColor;\n}\n",e),this.shader=t.context.webGLVersion>1?$D.from("#version 300 es\n#define SHADER_NAME Tiling-Sprite-300\n\nprecision lowp float;\n\nin vec2 aVertexPosition;\nin vec2 aTextureCoord;\n\nuniform mat3 projectionMatrix;\nuniform mat3 translationMatrix;\nuniform mat3 uTransform;\n\nout vec2 vTextureCoord;\n\nvoid main(void)\n{\n    gl_Position = vec4((projectionMatrix * translationMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n\n    vTextureCoord = (uTransform * vec3(aTextureCoord, 1.0)).xy;\n}\n","#version 300 es\n#define SHADER_NAME Tiling-Sprite-100\n\nprecision lowp float;\n\nin vec2 vTextureCoord;\n\nout vec4 fragmentColor;\n\nuniform sampler2D uSampler;\nuniform vec4 uColor;\nuniform mat3 uMapCoord;\nuniform vec4 uClampFrame;\nuniform vec2 uClampOffset;\n\nvoid main(void)\n{\n    vec2 coord = vTextureCoord + ceil(uClampOffset - vTextureCoord);\n    coord = (uMapCoord * vec3(coord, 1.0)).xy;\n    vec2 unclamped = coord;\n    coord = clamp(coord, uClampFrame.xy, uClampFrame.zw);\n\n    vec4 texSample = texture(uSampler, coord, unclamped == coord ? 0.0f : -32.0f);// lod-bias very negative to force lod 0\n\n    fragmentColor = texSample * uColor;\n}\n",e):$D.from(nF,"#version 100\n#ifdef GL_EXT_shader_texture_lod\n    #extension GL_EXT_shader_texture_lod : enable\n#endif\n#define SHADER_NAME Tiling-Sprite-100\n\nprecision lowp float;\n\nvarying vec2 vTextureCoord;\n\nuniform sampler2D uSampler;\nuniform vec4 uColor;\nuniform mat3 uMapCoord;\nuniform vec4 uClampFrame;\nuniform vec2 uClampOffset;\n\nvoid main(void)\n{\n    vec2 coord = vTextureCoord + ceil(uClampOffset - vTextureCoord);\n    coord = (uMapCoord * vec3(coord, 1.0)).xy;\n    vec2 unclamped = coord;\n    coord = clamp(coord, uClampFrame.xy, uClampFrame.zw);\n\n    #ifdef GL_EXT_shader_texture_lod\n        vec4 texSample = unclamped == coord\n            ? texture2D(uSampler, coord) \n            : texture2DLodEXT(uSampler, coord, 0);\n    #else\n        vec4 texSample = texture2D(uSampler, coord);\n    #endif\n\n    gl_FragColor = texSample * uColor;\n}\n",e)}render(t){const e=this.renderer,r=this.quad;let i=r.vertices;i[0]=i[6]=t._width*-t.anchor.x,i[1]=i[3]=t._height*-t.anchor.y,i[2]=i[4]=t._width*(1-t.anchor.x),i[5]=i[7]=t._height*(1-t.anchor.y);const n=t.uvRespectAnchor?t.anchor.x:0,s=t.uvRespectAnchor?t.anchor.y:0;i=r.uvs,i[0]=i[6]=-n,i[1]=i[3]=-s,i[2]=i[4]=1-n,i[5]=i[7]=1-s,r.invalidate();const o=t._texture,a=o.baseTexture,h=a.alphaMode>0,l=t.tileTransform.localTransform,c=t.uvMatrix;let u=a.isPowerOfTwo&&o.frame.width===a.width&&o.frame.height===a.height;u&&(a._glTextures[e.CONTEXT_UID]?u=a.wrapMode!==bR.CLAMP:a.wrapMode===bR.CLAMP&&(a.wrapMode=bR.REPEAT));const d=u?this.simpleShader:this.shader,p=o.width,f=o.height,m=t._width,g=t._height;sF.set(l.a*p/m,l.b*p/g,l.c*f/m,l.d*f/g,l.tx/m,l.ty/g),sF.invert(),u?sF.prepend(c.mapCoord):(d.uniforms.uMapCoord=c.mapCoord.toArray(!0),d.uniforms.uClampFrame=c.uClampFrame,d.uniforms.uClampOffset=c.uClampOffset),d.uniforms.uTransform=sF.toArray(!0),d.uniforms.uColor=QO.shared.setValue(t.tint).premultiply(t.worldAlpha,h).toArray(d.uniforms.uColor),d.uniforms.translationMatrix=t.transform.worldTransform.toArray(!0),d.uniforms.uSampler=o,e.shader.bind(d),e.geometry.bind(r),this.state.blendMode=nk(t.blendMode,h),e.state.set(this.state),e.geometry.draw(this.renderer.gl.TRIANGLES,6,0)}}oF.extension={name:"tilingSprite",type:Ik.RendererPlugin},kk.add(oF);const aF=new pD,hF=new pD,lF=[new oD,new oD,new oD,new oD];iF.prototype._renderCanvas=function(t){const e=this._texture;if(!e.baseTexture.valid)return;const r=t.canvasContext.activeContext,i=this.worldTransform,n=e.baseTexture,s=n.getDrawableSource(),o=n.resolution;if(this._textureID!==this._texture._updateID||this._cachedTint!==this.tintValue){this._textureID=this._texture._updateID;const t=new xk(e._frame.width,e._frame.height,o);16777215!==this.tintValue?(this._tintedCanvas=XN.getTintedCanvas(this,this.tintValue),t.context.drawImage(this._tintedCanvas,0,0)):t.context.drawImage(s,-e._frame.x*o,-e._frame.y*o),this._cachedTint=this.tintValue,this._canvasPattern=t.context.createPattern(t.canvas,"repeat")}r.globalAlpha=this.worldAlpha,t.canvasContext.setBlendMode(this.blendMode),this.tileTransform.updateLocalTransform();const a=this.tileTransform.localTransform,h=this._width,l=this._height;aF.identity(),hF.copyFrom(a),this.uvRespectAnchor||hF.translate(-this.anchor.x*h,-this.anchor.y*l),hF.scale(1/o,1/o),aF.prepend(hF),aF.prepend(i),t.canvasContext.setContextTransform(aF),r.fillStyle=this._canvasPattern;const c=this.anchor.x*-h,u=this.anchor.y*-l;lF[0].set(c,u),lF[1].set(c+h,u),lF[2].set(c+h,u+l),lF[3].set(c,u+l);for(let t=0;t<4;t++)hF.applyInverse(lF[t],lF[t]);r.beginPath(),r.moveTo(lF[0].x,lF[0].y);for(let t=1;t<4;t++)r.lineTo(lF[t].x,lF[t].y);r.closePath(),r.fill()};class cF{constructor(t,e,r){this.geometry=new tD,this.indexBuffer=null,this.size=r,this.dynamicProperties=[],this.staticProperties=[];for(let r=0;r<t.length;++r){let i=t[r];i={attributeName:i.attributeName,size:i.size,uploadFunction:i.uploadFunction,type:i.type||gR.FLOAT,offset:i.offset},e[r]?this.dynamicProperties.push(i):this.staticProperties.push(i)}this.staticStride=0,this.staticBuffer=null,this.staticData=null,this.staticDataUint32=null,this.dynamicStride=0,this.dynamicBuffer=null,this.dynamicData=null,this.dynamicDataUint32=null,this._updateID=0,this.initBuffers()}initBuffers(){const t=this.geometry;let e=0;this.indexBuffer=new Zk(ok(this.size),!0,!0),t.addIndex(this.indexBuffer),this.dynamicStride=0;for(let t=0;t<this.dynamicProperties.length;++t){const r=this.dynamicProperties[t];r.offset=e,e+=r.size,this.dynamicStride+=r.size}const r=new ArrayBuffer(this.size*this.dynamicStride*4*4);this.dynamicData=new Float32Array(r),this.dynamicDataUint32=new Uint32Array(r),this.dynamicBuffer=new Zk(this.dynamicData,!1,!1);let i=0;this.staticStride=0;for(let t=0;t<this.staticProperties.length;++t){const e=this.staticProperties[t];e.offset=i,i+=e.size,this.staticStride+=e.size}const n=new ArrayBuffer(this.size*this.staticStride*4*4);this.staticData=new Float32Array(n),this.staticDataUint32=new Uint32Array(n),this.staticBuffer=new Zk(this.staticData,!0,!1);for(let e=0;e<this.dynamicProperties.length;++e){const r=this.dynamicProperties[e];t.addAttribute(r.attributeName,this.dynamicBuffer,0,r.type===gR.UNSIGNED_BYTE,r.type,4*this.dynamicStride,4*r.offset)}for(let e=0;e<this.staticProperties.length;++e){const r=this.staticProperties[e];t.addAttribute(r.attributeName,this.staticBuffer,0,r.type===gR.UNSIGNED_BYTE,r.type,4*this.staticStride,4*r.offset)}}uploadDynamic(t,e,r){for(let i=0;i<this.dynamicProperties.length;i++){const n=this.dynamicProperties[i];n.uploadFunction(t,e,r,n.type===gR.UNSIGNED_BYTE?this.dynamicDataUint32:this.dynamicData,this.dynamicStride,n.offset)}this.dynamicBuffer._updateID++}uploadStatic(t,e,r){for(let i=0;i<this.staticProperties.length;i++){const n=this.staticProperties[i];n.uploadFunction(t,e,r,n.type===gR.UNSIGNED_BYTE?this.staticDataUint32:this.staticData,this.staticStride,n.offset)}this.staticBuffer._updateID++}destroy(){this.indexBuffer=null,this.dynamicProperties=null,this.dynamicBuffer=null,this.dynamicData=null,this.dynamicDataUint32=null,this.staticProperties=null,this.staticBuffer=null,this.staticData=null,this.staticDataUint32=null,this.geometry.destroy()}}class uF extends qD{constructor(t){super(t),this.shader=null,this.properties=null,this.tempMatrix=new pD,this.properties=[{attributeName:"aVertexPosition",size:2,uploadFunction:this.uploadVertices,offset:0},{attributeName:"aPositionCoord",size:2,uploadFunction:this.uploadPosition,offset:0},{attributeName:"aRotation",size:1,uploadFunction:this.uploadRotation,offset:0},{attributeName:"aTextureCoord",size:2,uploadFunction:this.uploadUvs,offset:0},{attributeName:"aColor",size:1,type:gR.UNSIGNED_BYTE,uploadFunction:this.uploadTint,offset:0}],this.shader=$D.from("attribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\nattribute vec4 aColor;\n\nattribute vec2 aPositionCoord;\nattribute float aRotation;\n\nuniform mat3 translationMatrix;\nuniform vec4 uColor;\n\nvarying vec2 vTextureCoord;\nvarying vec4 vColor;\n\nvoid main(void){\n    float x = (aVertexPosition.x) * cos(aRotation) - (aVertexPosition.y) * sin(aRotation);\n    float y = (aVertexPosition.x) * sin(aRotation) + (aVertexPosition.y) * cos(aRotation);\n\n    vec2 v = vec2(x, y);\n    v = v + aPositionCoord;\n\n    gl_Position = vec4((translationMatrix * vec3(v, 1.0)).xy, 0.0, 1.0);\n\n    vTextureCoord = aTextureCoord;\n    vColor = aColor * uColor;\n}\n","varying vec2 vTextureCoord;\nvarying vec4 vColor;\n\nuniform sampler2D uSampler;\n\nvoid main(void){\n    vec4 color = texture2D(uSampler, vTextureCoord) * vColor;\n    gl_FragColor = color;\n}",{}),this.state=Fk.for2d()}render(t){const e=t.children,r=t._maxSize,i=t._batchSize,n=this.renderer;let s=e.length;if(0===s)return;s>r&&!t.autoResize&&(s=r);let o=t._buffers;o||(o=t._buffers=this.generateBuffers(t));const a=e[0]._texture.baseTexture,h=a.alphaMode>0;this.state.blendMode=nk(t.blendMode,h),n.state.set(this.state);const l=n.gl,c=t.worldTransform.copyTo(this.tempMatrix);c.prepend(n.globalUniforms.uniforms.projectionMatrix),this.shader.uniforms.translationMatrix=c.toArray(!0),this.shader.uniforms.uColor=QO.shared.setValue(t.tintRgb).premultiply(t.worldAlpha,h).toArray(this.shader.uniforms.uColor),this.shader.uniforms.uSampler=a,this.renderer.shader.bind(this.shader);let u=!1;for(let r=0,a=0;r<s;r+=i,a+=1){let h=s-r;h>i&&(h=i),a>=o.length&&o.push(this._generateOneMoreBuffer(t));const c=o[a];c.uploadDynamic(e,r,h);const d=t._bufferUpdateIDs[a]||0;u=u||c._updateID<d,u&&(c._updateID=t._updateID,c.uploadStatic(e,r,h)),n.geometry.bind(c.geometry),l.drawElements(l.TRIANGLES,6*h,l.UNSIGNED_SHORT,0)}}generateBuffers(t){const e=[],r=t._maxSize,i=t._batchSize,n=t._properties;for(let t=0;t<r;t+=i)e.push(new cF(this.properties,n,i));return e}_generateOneMoreBuffer(t){const e=t._batchSize,r=t._properties;return new cF(this.properties,r,e)}uploadVertices(t,e,r,i,n,s){let o=0,a=0,h=0,l=0;for(let c=0;c<r;++c){const r=t[e+c],u=r._texture,d=r.scale.x,p=r.scale.y,f=u.trim,m=u.orig;f?(a=f.x-r.anchor.x*m.width,o=a+f.width,l=f.y-r.anchor.y*m.height,h=l+f.height):(o=m.width*(1-r.anchor.x),a=m.width*-r.anchor.x,h=m.height*(1-r.anchor.y),l=m.height*-r.anchor.y),i[s]=a*d,i[s+1]=l*p,i[s+n]=o*d,i[s+n+1]=l*p,i[s+2*n]=o*d,i[s+2*n+1]=h*p,i[s+3*n]=a*d,i[s+3*n+1]=h*p,s+=4*n}}uploadPosition(t,e,r,i,n,s){for(let o=0;o<r;o++){const r=t[e+o].position;i[s]=r.x,i[s+1]=r.y,i[s+n]=r.x,i[s+n+1]=r.y,i[s+2*n]=r.x,i[s+2*n+1]=r.y,i[s+3*n]=r.x,i[s+3*n+1]=r.y,s+=4*n}}uploadRotation(t,e,r,i,n,s){for(let o=0;o<r;o++){const r=t[e+o].rotation;i[s]=r,i[s+n]=r,i[s+2*n]=r,i[s+3*n]=r,s+=4*n}}uploadUvs(t,e,r,i,n,s){for(let o=0;o<r;++o){const r=t[e+o]._texture._uvs;r?(i[s]=r.x0,i[s+1]=r.y0,i[s+n]=r.x1,i[s+n+1]=r.y1,i[s+2*n]=r.x2,i[s+2*n+1]=r.y2,i[s+3*n]=r.x3,i[s+3*n+1]=r.y3,s+=4*n):(i[s]=0,i[s+1]=0,i[s+n]=0,i[s+n+1]=0,i[s+2*n]=0,i[s+2*n+1]=0,i[s+3*n]=0,i[s+3*n+1]=0,s+=4*n)}}uploadTint(t,e,r,i,n,s){for(let o=0;o<r;++o){const r=t[e+o],a=QO.shared.setValue(r._tintRGB).toPremultiplied(r.alpha,r.texture.baseTexture.alphaMode>0);i[s]=a,i[s+n]=a,i[s+2*n]=a,i[s+3*n]=a,s+=4*n}}destroy(){super.destroy(),this.shader&&(this.shader.destroy(),this.shader=null),this.tempMatrix=null}}uF.extension={name:"particle",type:Ik.RendererPlugin},kk.add(uF),class extends qN{constructor(t=1500,e,r=16384,i=!1){super();r>16384&&(r=16384),this._properties=[!1,!0,!1,!1,!1],this._maxSize=t,this._batchSize=r,this._buffers=null,this._bufferUpdateIDs=[],this._updateID=0,this.interactiveChildren=!1,this.blendMode=dR.NORMAL,this.autoResize=i,this.roundPixels=!0,this.baseTexture=null,this.setProperties(e),this._tintColor=new QO(0),this.tintRgb=new Float32Array(3),this.tint=16777215}setProperties(t){t&&(this._properties[0]="vertices"in t||"scale"in t?!!t.vertices||!!t.scale:this._properties[0],this._properties[1]="position"in t?!!t.position:this._properties[1],this._properties[2]="rotation"in t?!!t.rotation:this._properties[2],this._properties[3]="uvs"in t?!!t.uvs:this._properties[3],this._properties[4]="tint"in t||"alpha"in t?!!t.tint||!!t.alpha:this._properties[4])}updateTransform(){this.displayObjectUpdateTransform()}get tint(){return this._tintColor.value}set tint(t){this._tintColor.setValue(t),this._tintColor.toRgbArray(this.tintRgb)}render(t){this.visible&&!(this.worldAlpha<=0)&&this.children.length&&this.renderable&&(this.baseTexture||(this.baseTexture=this.children[0]._texture.baseTexture,this.baseTexture.valid||this.baseTexture.once("update",(()=>this.onChildrenChange(0)))),t.batch.setObjectRenderer(t.plugins.particle),t.plugins.particle.render(this))}onChildrenChange(t){const e=Math.floor(t/this._batchSize);for(;this._bufferUpdateIDs.length<e;)this._bufferUpdateIDs.push(0);this._bufferUpdateIDs[e]=++this._updateID}dispose(){if(this._buffers){for(let t=0;t<this._buffers.length;++t)this._buffers[t].destroy();this._buffers=null}}destroy(t){super.destroy(t),this.dispose(),this._properties=null,this._buffers=null,this._bufferUpdateIDs=null}}.prototype.renderCanvas=function(t){if(!this.visible||this.worldAlpha<=0||!this.children.length||!this.renderable)return;const e=t.canvasContext.activeContext,r=this.worldTransform;let i=!0,n=0,s=0,o=0,a=0;t.canvasContext.setBlendMode(this.blendMode),e.globalAlpha=this.worldAlpha,this.displayObjectUpdateTransform();for(let h=0;h<this.children.length;++h){const l=this.children[h];if(!l.visible)continue;if(!l._texture.valid)continue;const c=l._texture.frame;if(e.globalAlpha=this.worldAlpha*l.alpha,l.rotation%(2*Math.PI)==0)i&&(t.canvasContext.setContextTransform(r,!1,1),i=!1),n=l.anchor.x*(-c.width*l.scale.x)+l.position.x+.5,s=l.anchor.y*(-c.height*l.scale.y)+l.position.y+.5,o=c.width*l.scale.x,a=c.height*l.scale.y;else{i||(i=!0),l.displayObjectUpdateTransform();const e=l.worldTransform;t.canvasContext.setContextTransform(e,this.roundPixels,1),n=l.anchor.x*-c.width+.5,s=l.anchor.y*-c.height+.5,o=c.width,a=c.height}const u=l._texture.baseTexture.resolution,d=t.canvasContext.activeResolution;e.drawImage(l._texture.baseTexture.getDrawableSource(),c.x*u,c.y*u,c.width*u,c.height*u,n*d,s*d,o*d,a*d)}},qN.prototype._renderCanvas=function(t){},qN.prototype.renderCanvas=function(t){if(this.visible&&!(this.worldAlpha<=0)&&this.renderable){this._mask&&t.mask.pushMask(this._mask),this._renderCanvas(t);for(let e=0,r=this.children.length;e<r;++e)this.children[e].renderCanvas(t);this._mask&&t.mask.popMask(t)}},YN.prototype.renderCanvas=function(t){};var dF=(t=>(t[t.LINEAR_VERTICAL=0]="LINEAR_VERTICAL",t[t.LINEAR_HORIZONTAL=1]="LINEAR_HORIZONTAL",t))(dF||{});const pF={willReadFrequently:!0},fF=class{static get experimentalLetterSpacingSupported(){let t=fF._experimentalLetterSpacingSupported;if(void 0!==t){const e=PR.ADAPTER.getCanvasRenderingContext2D().prototype;t=fF._experimentalLetterSpacingSupported="letterSpacing"in e||"textLetterSpacing"in e}return t}constructor(t,e,r,i,n,s,o,a,h){this.text=t,this.style=e,this.width=r,this.height=i,this.lines=n,this.lineWidths=s,this.lineHeight=o,this.maxLineWidth=a,this.fontProperties=h}static measureText(t,e,r,i=fF._canvas){r=null==r?e.wordWrap:r;const n=e.toFontString(),s=fF.measureFont(n);0===s.fontSize&&(s.fontSize=e.fontSize,s.ascent=e.fontSize);const o=i.getContext("2d",pF);o.font=n;const a=(r?fF.wordWrap(t,e,i):t).split(/(?:\r\n|\r|\n)/),h=new Array(a.length);let l=0;for(let t=0;t<a.length;t++){const r=fF._measureText(a[t],e.letterSpacing,o);h[t]=r,l=Math.max(l,r)}let c=l+e.strokeThickness;e.dropShadow&&(c+=e.dropShadowDistance);const u=e.lineHeight||s.fontSize+e.strokeThickness;let d=Math.max(u,s.fontSize+2*e.strokeThickness)+(a.length-1)*(u+e.leading);return e.dropShadow&&(d+=e.dropShadowDistance),new fF(t,e,c,d,a,h,u+e.leading,l,s)}static _measureText(t,e,r){let i=!1;fF.experimentalLetterSpacingSupported&&(fF.experimentalLetterSpacing?(r.letterSpacing=`${e}px`,r.textLetterSpacing=`${e}px`,i=!0):(r.letterSpacing="0px",r.textLetterSpacing="0px"));let n=r.measureText(t).width;return n>0&&(i?n-=e:n+=(fF.graphemeSegmenter(t).length-1)*e),n}static wordWrap(t,e,r=fF._canvas){const i=r.getContext("2d",pF);let n=0,s="",o="";const a=Object.create(null),{letterSpacing:h,whiteSpace:l}=e,c=fF.collapseSpaces(l),u=fF.collapseNewlines(l);let d=!c;const p=e.wordWrapWidth+h,f=fF.tokenize(t);for(let t=0;t<f.length;t++){let r=f[t];if(fF.isNewline(r)){if(!u){o+=fF.addLine(s),d=!c,s="",n=0;continue}r=" "}if(c){const t=fF.isBreakingSpace(r),e=fF.isBreakingSpace(s[s.length-1]);if(t&&e)continue}const l=fF.getFromCache(r,h,a,i);if(l>p)if(""!==s&&(o+=fF.addLine(s),s="",n=0),fF.canBreakWords(r,e.breakWords)){const t=fF.wordWrapSplit(r);for(let l=0;l<t.length;l++){let c=t[l],u=c,f=1;for(;t[l+f];){const i=t[l+f];if(fF.canBreakChars(u,i,r,l,e.breakWords))break;c+=i,u=i,f++}l+=f-1;const m=fF.getFromCache(c,h,a,i);m+n>p&&(o+=fF.addLine(s),d=!1,s="",n=0),s+=c,n+=m}}else{s.length>0&&(o+=fF.addLine(s),s="",n=0);const e=t===f.length-1;o+=fF.addLine(r,!e),d=!1,s="",n=0}else l+n>p&&(d=!1,o+=fF.addLine(s),s="",n=0),(s.length>0||!fF.isBreakingSpace(r)||d)&&(s+=r,n+=l)}return o+=fF.addLine(s,!1),o}static addLine(t,e=!0){return t=fF.trimRight(t),t=e?`${t}\n`:t}static getFromCache(t,e,r,i){let n=r[t];return"number"!=typeof n&&(n=fF._measureText(t,e,i)+e,r[t]=n),n}static collapseSpaces(t){return"normal"===t||"pre-line"===t}static collapseNewlines(t){return"normal"===t}static trimRight(t){if("string"!=typeof t)return"";for(let e=t.length-1;e>=0;e--){const r=t[e];if(!fF.isBreakingSpace(r))break;t=t.slice(0,-1)}return t}static isNewline(t){return"string"==typeof t&&fF._newlines.includes(t.charCodeAt(0))}static isBreakingSpace(t,e){return"string"==typeof t&&fF._breakingSpaces.includes(t.charCodeAt(0))}static tokenize(t){const e=[];let r="";if("string"!=typeof t)return e;for(let i=0;i<t.length;i++){const n=t[i],s=t[i+1];fF.isBreakingSpace(n,s)||fF.isNewline(n)?(""!==r&&(e.push(r),r=""),e.push(n)):r+=n}return""!==r&&e.push(r),e}static canBreakWords(t,e){return e}static canBreakChars(t,e,r,i,n){return!0}static wordWrapSplit(t){return fF.graphemeSegmenter(t)}static measureFont(t){if(fF._fonts[t])return fF._fonts[t];const e={ascent:0,descent:0,fontSize:0},r=fF._canvas,i=fF._context;i.font=t;const n=fF.METRICS_STRING+fF.BASELINE_SYMBOL,s=Math.ceil(i.measureText(n).width);let o=Math.ceil(i.measureText(fF.BASELINE_SYMBOL).width);const a=Math.ceil(fF.HEIGHT_MULTIPLIER*o);if(o=o*fF.BASELINE_MULTIPLIER|0,0===s||0===a)return fF._fonts[t]=e,e;r.width=s,r.height=a,i.fillStyle="#f00",i.fillRect(0,0,s,a),i.font=t,i.textBaseline="alphabetic",i.fillStyle="#000",i.fillText(n,0,o);const h=i.getImageData(0,0,s,a).data,l=h.length,c=4*s;let u=0,d=0,p=!1;for(u=0;u<o;++u){for(let t=0;t<c;t+=4)if(255!==h[d+t]){p=!0;break}if(p)break;d+=c}for(e.ascent=o-u,d=l-c,p=!1,u=a;u>o;--u){for(let t=0;t<c;t+=4)if(255!==h[d+t]){p=!0;break}if(p)break;d-=c}return e.descent=u-o,e.fontSize=e.ascent+e.descent,fF._fonts[t]=e,e}static clearMetrics(t=""){t?delete fF._fonts[t]:fF._fonts={}}static get _canvas(){if(!fF.__canvas){let t;try{const e=new OffscreenCanvas(0,0);if(e.getContext("2d",pF)?.measureText)return fF.__canvas=e,e;t=PR.ADAPTER.createCanvas()}catch(e){t=PR.ADAPTER.createCanvas()}t.width=t.height=10,fF.__canvas=t}return fF.__canvas}static get _context(){return fF.__context||(fF.__context=fF._canvas.getContext("2d",pF)),fF.__context}};let mF=fF;mF.METRICS_STRING="|ÉqÅ",mF.BASELINE_SYMBOL="M",mF.BASELINE_MULTIPLIER=1.4,mF.HEIGHT_MULTIPLIER=2,mF.graphemeSegmenter=(()=>{if("function"==typeof Intl?.Segmenter){const t=new Intl.Segmenter;return e=>[...t.segment(e)].map((t=>t.segment))}return t=>[...t]})(),mF.experimentalLetterSpacing=!1,mF._fonts={},mF._newlines=[10,13],mF._breakingSpaces=[9,32,8192,8193,8194,8195,8196,8197,8198,8200,8201,8202,8287,12288];const gF=["serif","sans-serif","monospace","cursive","fantasy","system-ui"],vF=class{constructor(t){this.styleID=0,this.reset(),_F(this,t,t)}clone(){const t={};return _F(t,this,vF.defaultStyle),new vF(t)}reset(){_F(this,vF.defaultStyle,vF.defaultStyle)}get align(){return this._align}set align(t){this._align!==t&&(this._align=t,this.styleID++)}get breakWords(){return this._breakWords}set breakWords(t){this._breakWords!==t&&(this._breakWords=t,this.styleID++)}get dropShadow(){return this._dropShadow}set dropShadow(t){this._dropShadow!==t&&(this._dropShadow=t,this.styleID++)}get dropShadowAlpha(){return this._dropShadowAlpha}set dropShadowAlpha(t){this._dropShadowAlpha!==t&&(this._dropShadowAlpha=t,this.styleID++)}get dropShadowAngle(){return this._dropShadowAngle}set dropShadowAngle(t){this._dropShadowAngle!==t&&(this._dropShadowAngle=t,this.styleID++)}get dropShadowBlur(){return this._dropShadowBlur}set dropShadowBlur(t){this._dropShadowBlur!==t&&(this._dropShadowBlur=t,this.styleID++)}get dropShadowColor(){return this._dropShadowColor}set dropShadowColor(t){const e=bF(t);this._dropShadowColor!==e&&(this._dropShadowColor=e,this.styleID++)}get dropShadowDistance(){return this._dropShadowDistance}set dropShadowDistance(t){this._dropShadowDistance!==t&&(this._dropShadowDistance=t,this.styleID++)}get fill(){return this._fill}set fill(t){const e=bF(t);this._fill!==e&&(this._fill=e,this.styleID++)}get fillGradientType(){return this._fillGradientType}set fillGradientType(t){this._fillGradientType!==t&&(this._fillGradientType=t,this.styleID++)}get fillGradientStops(){return this._fillGradientStops}set fillGradientStops(t){(function(t,e){if(!Array.isArray(t)||!Array.isArray(e))return!1;if(t.length!==e.length)return!1;for(let r=0;r<t.length;++r)if(t[r]!==e[r])return!1;return!0})(this._fillGradientStops,t)||(this._fillGradientStops=t,this.styleID++)}get fontFamily(){return this._fontFamily}set fontFamily(t){this.fontFamily!==t&&(this._fontFamily=t,this.styleID++)}get fontSize(){return this._fontSize}set fontSize(t){this._fontSize!==t&&(this._fontSize=t,this.styleID++)}get fontStyle(){return this._fontStyle}set fontStyle(t){this._fontStyle!==t&&(this._fontStyle=t,this.styleID++)}get fontVariant(){return this._fontVariant}set fontVariant(t){this._fontVariant!==t&&(this._fontVariant=t,this.styleID++)}get fontWeight(){return this._fontWeight}set fontWeight(t){this._fontWeight!==t&&(this._fontWeight=t,this.styleID++)}get letterSpacing(){return this._letterSpacing}set letterSpacing(t){this._letterSpacing!==t&&(this._letterSpacing=t,this.styleID++)}get lineHeight(){return this._lineHeight}set lineHeight(t){this._lineHeight!==t&&(this._lineHeight=t,this.styleID++)}get leading(){return this._leading}set leading(t){this._leading!==t&&(this._leading=t,this.styleID++)}get lineJoin(){return this._lineJoin}set lineJoin(t){this._lineJoin!==t&&(this._lineJoin=t,this.styleID++)}get miterLimit(){return this._miterLimit}set miterLimit(t){this._miterLimit!==t&&(this._miterLimit=t,this.styleID++)}get padding(){return this._padding}set padding(t){this._padding!==t&&(this._padding=t,this.styleID++)}get stroke(){return this._stroke}set stroke(t){const e=bF(t);this._stroke!==e&&(this._stroke=e,this.styleID++)}get strokeThickness(){return this._strokeThickness}set strokeThickness(t){this._strokeThickness!==t&&(this._strokeThickness=t,this.styleID++)}get textBaseline(){return this._textBaseline}set textBaseline(t){this._textBaseline!==t&&(this._textBaseline=t,this.styleID++)}get trim(){return this._trim}set trim(t){this._trim!==t&&(this._trim=t,this.styleID++)}get whiteSpace(){return this._whiteSpace}set whiteSpace(t){this._whiteSpace!==t&&(this._whiteSpace=t,this.styleID++)}get wordWrap(){return this._wordWrap}set wordWrap(t){this._wordWrap!==t&&(this._wordWrap=t,this.styleID++)}get wordWrapWidth(){return this._wordWrapWidth}set wordWrapWidth(t){this._wordWrapWidth!==t&&(this._wordWrapWidth=t,this.styleID++)}toFontString(){const t="number"==typeof this.fontSize?`${this.fontSize}px`:this.fontSize;let e=this.fontFamily;Array.isArray(this.fontFamily)||(e=this.fontFamily.split(","));for(let t=e.length-1;t>=0;t--){let r=e[t].trim();/([\"\'])[^\'\"]+\1/.test(r)||gF.includes(r)||(r=`"${r}"`),e[t]=r}return`${this.fontStyle} ${this.fontVariant} ${this.fontWeight} ${t} ${e.join(",")}`}};let yF=vF;function bF(t){const e=QO.shared;return Array.isArray(t)?t.map((t=>e.setValue(t).toHex())):e.setValue(t).toHex()}function _F(t,e,r){for(const i in r)Array.isArray(e[i])?t[i]=e[i].slice():t[i]=e[i]}yF.defaultStyle={align:"left",breakWords:!1,dropShadow:!1,dropShadowAlpha:1,dropShadowAngle:Math.PI/6,dropShadowBlur:0,dropShadowColor:"black",dropShadowDistance:5,fill:"black",fillGradientType:dF.LINEAR_VERTICAL,fillGradientStops:[],fontFamily:"Arial",fontSize:26,fontStyle:"normal",fontVariant:"normal",fontWeight:"normal",leading:0,letterSpacing:0,lineHeight:0,lineJoin:"miter",miterLimit:10,padding:0,stroke:"black",strokeThickness:0,textBaseline:"alphabetic",trim:!1,whiteSpace:"pre",wordWrap:!1,wordWrapWidth:100};const xF={texture:!0,children:!1,baseTexture:!0},TF=class extends eF{constructor(t,e,r){let i=!1;r||(r=PR.ADAPTER.createCanvas(),i=!0),r.width=3,r.height=3;const n=mL.from(r);n.orig=new hD,n.trim=new hD,super(n),this._ownCanvas=i,this.canvas=r,this.context=r.getContext("2d",{willReadFrequently:!0}),this._resolution=TF.defaultResolution??PR.RESOLUTION,this._autoResolution=TF.defaultAutoResolution,this._text=null,this._style=null,this._styleListener=null,this._font="",this.text=t,this.style=e,this.localStyleID=-1}static get experimentalLetterSpacing(){return mF.experimentalLetterSpacing}static set experimentalLetterSpacing(t){TO("7.1.0","Text.experimentalLetterSpacing is deprecated, use TextMetrics.experimentalLetterSpacing"),mF.experimentalLetterSpacing=t}updateText(t){const e=this._style;if(this.localStyleID!==e.styleID&&(this.dirty=!0,this.localStyleID=e.styleID),!this.dirty&&t)return;this._font=this._style.toFontString();const r=this.context,i=mF.measureText(this._text||" ",this._style,this._style.wordWrap,this.canvas),n=i.width,s=i.height,o=i.lines,a=i.lineHeight,h=i.lineWidths,l=i.maxLineWidth,c=i.fontProperties;let u,d;this.canvas.width=Math.ceil(Math.ceil(Math.max(1,n)+2*e.padding)*this._resolution),this.canvas.height=Math.ceil(Math.ceil(Math.max(1,s)+2*e.padding)*this._resolution),r.scale(this._resolution,this._resolution),r.clearRect(0,0,this.canvas.width,this.canvas.height),r.font=this._font,r.lineWidth=e.strokeThickness,r.textBaseline=e.textBaseline,r.lineJoin=e.lineJoin,r.miterLimit=e.miterLimit;const p=e.dropShadow?2:1;for(let t=0;t<p;++t){const n=e.dropShadow&&0===t,p=n?Math.ceil(Math.max(1,s)+2*e.padding):0,f=p*this._resolution;if(n){r.fillStyle="black",r.strokeStyle="black";const t=e.dropShadowColor,i=e.dropShadowBlur*this._resolution,n=e.dropShadowDistance*this._resolution;r.shadowColor=QO.shared.setValue(t).setAlpha(e.dropShadowAlpha).toRgbaString(),r.shadowBlur=i,r.shadowOffsetX=Math.cos(e.dropShadowAngle)*n,r.shadowOffsetY=Math.sin(e.dropShadowAngle)*n+f}else r.fillStyle=this._generateFillStyle(e,o,i),r.strokeStyle=e.stroke,r.shadowColor="black",r.shadowBlur=0,r.shadowOffsetX=0,r.shadowOffsetY=0;let m=(a-c.fontSize)/2;a-c.fontSize<0&&(m=0);for(let t=0;t<o.length;t++)u=e.strokeThickness/2,d=e.strokeThickness/2+t*a+c.ascent+m,"right"===e.align?u+=l-h[t]:"center"===e.align&&(u+=(l-h[t])/2),e.stroke&&e.strokeThickness&&this.drawLetterSpacing(o[t],u+e.padding,d+e.padding-p,!0),e.fill&&this.drawLetterSpacing(o[t],u+e.padding,d+e.padding-p)}this.updateTexture()}drawLetterSpacing(t,e,r,i=!1){const n=this._style.letterSpacing;let s=!1;if(mF.experimentalLetterSpacingSupported&&(mF.experimentalLetterSpacing?(this.context.letterSpacing=`${n}px`,this.context.textLetterSpacing=`${n}px`,s=!0):(this.context.letterSpacing="0px",this.context.textLetterSpacing="0px")),0===n||s)return void(i?this.context.strokeText(t,e,r):this.context.fillText(t,e,r));let o=e;const a=mF.graphemeSegmenter(t);let h=this.context.measureText(t).width,l=0;for(let t=0;t<a.length;++t){const e=a[t];i?this.context.strokeText(e,o,r):this.context.fillText(e,o,r);let s="";for(let e=t+1;e<a.length;++e)s+=a[e];l=this.context.measureText(s).width,o+=h-l+n,h=l}}updateTexture(){const t=this.canvas;if(this._style.trim){const e=Ek(t);e.data&&(t.width=e.width,t.height=e.height,this.context.putImageData(e.data,0,0))}const e=this._texture,r=this._style,i=r.trim?0:r.padding,n=e.baseTexture;e.trim.width=e._frame.width=t.width/this._resolution,e.trim.height=e._frame.height=t.height/this._resolution,e.trim.x=-i,e.trim.y=-i,e.orig.width=e._frame.width-2*i,e.orig.height=e._frame.height-2*i,this._onTextureUpdate(),n.setRealSize(t.width,t.height,this._resolution),e.updateUvs(),this.dirty=!1}_render(t){this._autoResolution&&this._resolution!==t.resolution&&(this._resolution=t.resolution,this.dirty=!0),this.updateText(!0),super._render(t)}updateTransform(){this.updateText(!0),super.updateTransform()}getBounds(t,e){return this.updateText(!0),-1===this._textureID&&(t=!1),super.getBounds(t,e)}getLocalBounds(t){return this.updateText(!0),super.getLocalBounds.call(this,t)}_calculateBounds(){this.calculateVertices(),this._bounds.addQuad(this.vertexData)}_generateFillStyle(t,e,r){const i=t.fill;if(!Array.isArray(i))return i;if(1===i.length)return i[0];let n;const s=t.dropShadow?t.dropShadowDistance:0,o=t.padding||0,a=this.canvas.width/this._resolution-s-2*o,h=this.canvas.height/this._resolution-s-2*o,l=i.slice(),c=t.fillGradientStops.slice();if(!c.length){const t=l.length+1;for(let e=1;e<t;++e)c.push(e/t)}if(l.unshift(i[0]),c.unshift(0),l.push(i[i.length-1]),c.push(1),t.fillGradientType===dF.LINEAR_VERTICAL){n=this.context.createLinearGradient(a/2,o,a/2,h+o);const i=r.fontProperties.fontSize+t.strokeThickness;for(let t=0;t<e.length;t++){const s=r.lineHeight*(t-1)+i,o=r.lineHeight*t;let a=o;t>0&&s>o&&(a=(o+s)/2);const u=o+i,d=r.lineHeight*(t+1);let p=u;t+1<e.length&&d<u&&(p=(u+d)/2);const f=(p-a)/h;for(let t=0;t<l.length;t++){let e=0;e="number"==typeof c[t]?c[t]:t/l.length;let r=Math.min(1,Math.max(0,a/h+e*f));r=Number(r.toFixed(5)),n.addColorStop(r,l[t])}}}else{n=this.context.createLinearGradient(o,h/2,a+o,h/2);const t=l.length+1;let e=1;for(let r=0;r<l.length;r++){let i;i="number"==typeof c[r]?c[r]:e/t,n.addColorStop(i,l[r]),e++}}return n}destroy(t){"boolean"==typeof t&&(t={children:t}),t=Object.assign({},xF,t),super.destroy(t),this._ownCanvas&&(this.canvas.height=this.canvas.width=0),this.context=null,this.canvas=null,this._style=null}get width(){return this.updateText(!0),Math.abs(this.scale.x)*this._texture.orig.width}set width(t){this.updateText(!0);const e=pk(this.scale.x)||1;this.scale.x=e*t/this._texture.orig.width,this._width=t}get height(){return this.updateText(!0),Math.abs(this.scale.y)*this._texture.orig.height}set height(t){this.updateText(!0);const e=pk(this.scale.y)||1;this.scale.y=e*t/this._texture.orig.height,this._height=t}get style(){return this._style}set style(t){t=t||{},this._style=t instanceof yF?t:new yF(t),this.localStyleID=-1,this.dirty=!0}get text(){return this._text}set text(t){t=String(null==t?"":t),this._text!==t&&(this._text=t,this.dirty=!0)}get resolution(){return this._resolution}set resolution(t){this._autoResolution=!1,this._resolution!==t&&(this._resolution=t,this.dirty=!0)}};let wF=TF;wF.defaultAutoResolution=!0,wF.prototype._renderCanvas=function(t){this._autoResolution&&this._resolution!==t.resolution&&(this._resolution=t.resolution,this.dirty=!0),this.updateText(!0),eF.prototype._renderCanvas.call(this,t)};const SF=new pD;YN.prototype._cacheAsBitmap=!1,YN.prototype._cacheData=null,YN.prototype._cacheAsBitmapResolution=null,YN.prototype._cacheAsBitmapMultisample=null;class EF{constructor(){this.textureCacheId=null,this.originalRender=null,this.originalRenderCanvas=null,this.originalCalculateBounds=null,this.originalGetLocalBounds=null,this.originalUpdateTransform=null,this.originalDestroy=null,this.originalMask=null,this.originalFilterArea=null,this.originalContainsPoint=null,this.sprite=null}}Object.defineProperties(YN.prototype,{cacheAsBitmapResolution:{get(){return this._cacheAsBitmapResolution},set(t){t!==this._cacheAsBitmapResolution&&(this._cacheAsBitmapResolution=t,this.cacheAsBitmap&&(this.cacheAsBitmap=!1,this.cacheAsBitmap=!0))}},cacheAsBitmapMultisample:{get(){return this._cacheAsBitmapMultisample},set(t){t!==this._cacheAsBitmapMultisample&&(this._cacheAsBitmapMultisample=t,this.cacheAsBitmap&&(this.cacheAsBitmap=!1,this.cacheAsBitmap=!0))}},cacheAsBitmap:{get(){return this._cacheAsBitmap},set(t){if(this._cacheAsBitmap===t)return;let e;this._cacheAsBitmap=t,t?(this._cacheData||(this._cacheData=new EF),e=this._cacheData,e.originalRender=this.render,e.originalRenderCanvas=this.renderCanvas,e.originalUpdateTransform=this.updateTransform,e.originalCalculateBounds=this.calculateBounds,e.originalGetLocalBounds=this.getLocalBounds,e.originalDestroy=this.destroy,e.originalContainsPoint=this.containsPoint,e.originalMask=this._mask,e.originalFilterArea=this.filterArea,this.render=this._renderCached,this.renderCanvas=this._renderCachedCanvas,this.destroy=this._cacheAsBitmapDestroy):(e=this._cacheData,e.sprite&&this._destroyCachedDisplayObject(),this.render=e.originalRender,this.renderCanvas=e.originalRenderCanvas,this.calculateBounds=e.originalCalculateBounds,this.getLocalBounds=e.originalGetLocalBounds,this.destroy=e.originalDestroy,this.updateTransform=e.originalUpdateTransform,this.containsPoint=e.originalContainsPoint,this._mask=e.originalMask,this.filterArea=e.originalFilterArea)}}}),YN.prototype._renderCached=function(t){!this.visible||this.worldAlpha<=0||!this.renderable||(this._initCachedDisplayObject(t),this._cacheData.sprite.transform._worldID=this.transform._worldID,this._cacheData.sprite.worldAlpha=this.worldAlpha,this._cacheData.sprite._render(t))},YN.prototype._initCachedDisplayObject=function(t){if(this._cacheData?.sprite)return;const e=this.alpha;this.alpha=1,t.batch.flush();const r=this.getLocalBounds(null,!0).clone();if(this.filters?.length){const t=this.filters[0].padding;r.pad(t)}r.ceil(PR.RESOLUTION);const i=t.renderTexture.current,n=t.renderTexture.sourceFrame.clone(),s=t.renderTexture.destinationFrame.clone(),o=t.projection.transform,a=gL.create({width:r.width,height:r.height,resolution:this.cacheAsBitmapResolution||t.resolution,multisample:this.cacheAsBitmapMultisample??t.multisample}),h=`cacheAsBitmap_${mk()}`;this._cacheData.textureCacheId=h,Xk.addToCache(a.baseTexture,h),mL.addToCache(a,h);const l=this.transform.localTransform.copyTo(SF).invert().translate(-r.x,-r.y);this.render=this._cacheData.originalRender,t.render(this,{renderTexture:a,clear:!0,transform:l,skipUpdateTransform:!1}),t.framebuffer.blit(),t.projection.transform=o,t.renderTexture.bind(i,n,s),this.render=this._renderCached,this.updateTransform=this.displayObjectUpdateTransform,this.calculateBounds=this._calculateCachedBounds,this.getLocalBounds=this._getCachedLocalBounds,this._mask=null,this.filterArea=null,this.alpha=e;const c=new eF(a);c.transform.worldTransform=this.transform.worldTransform,c.anchor.x=-r.x/r.width,c.anchor.y=-r.y/r.height,c.alpha=e,c._bounds=this._bounds,this._cacheData.sprite=c,this.transform._parentID=-1,this.parent?this.updateTransform():(this.enableTempParent(),this.updateTransform(),this.disableTempParent(null)),this.containsPoint=c.containsPoint.bind(c)},YN.prototype._renderCachedCanvas=function(t){!this.visible||this.worldAlpha<=0||!this.renderable||(this._initCachedDisplayObjectCanvas(t),this._cacheData.sprite.worldAlpha=this.worldAlpha,this._cacheData.sprite._renderCanvas(t))},YN.prototype._initCachedDisplayObjectCanvas=function(t){if(this._cacheData?.sprite)return;const e=this.getLocalBounds(null,!0),r=this.alpha;this.alpha=1;const i=t.canvasContext.activeContext,n=t._projTransform;e.ceil(PR.RESOLUTION);const s=gL.create({width:e.width,height:e.height}),o=`cacheAsBitmap_${mk()}`;this._cacheData.textureCacheId=o,Xk.addToCache(s.baseTexture,o),mL.addToCache(s,o);const a=SF;this.transform.localTransform.copyTo(a),a.invert(),a.tx-=e.x,a.ty-=e.y,this.renderCanvas=this._cacheData.originalRenderCanvas,t.render(this,{renderTexture:s,clear:!0,transform:a,skipUpdateTransform:!1}),t.canvasContext.activeContext=i,t._projTransform=n,this.renderCanvas=this._renderCachedCanvas,this.updateTransform=this.displayObjectUpdateTransform,this.calculateBounds=this._calculateCachedBounds,this.getLocalBounds=this._getCachedLocalBounds,this._mask=null,this.filterArea=null,this.alpha=r;const h=new eF(s);h.transform.worldTransform=this.transform.worldTransform,h.anchor.x=-e.x/e.width,h.anchor.y=-e.y/e.height,h.alpha=r,h._bounds=this._bounds,this._cacheData.sprite=h,this.transform._parentID=-1,this.parent?this.updateTransform():(this.parent=t._tempDisplayObjectParent,this.updateTransform(),this.parent=null),this.containsPoint=h.containsPoint.bind(h)},YN.prototype._calculateCachedBounds=function(){this._bounds.clear(),this._cacheData.sprite.transform._worldID=this.transform._worldID,this._cacheData.sprite._calculateBounds(),this._bounds.updateID=this._boundsID},YN.prototype._getCachedLocalBounds=function(){return this._cacheData.sprite.getLocalBounds(null)},YN.prototype._destroyCachedDisplayObject=function(){this._cacheData.sprite._texture.destroy(!0),this._cacheData.sprite=null,Xk.removeFromCache(this._cacheData.textureCacheId),mL.removeFromCache(this._cacheData.textureCacheId),this._cacheData.textureCacheId=null},YN.prototype._cacheAsBitmapDestroy=function(t){this.cacheAsBitmap=!1,this.destroy(t)},YN.prototype.name=null,qN.prototype.getChildByName=function(t,e){for(let e=0,r=this.children.length;e<r;e++)if(this.children[e].name===t)return this.children[e];if(e)for(let e=0,r=this.children.length;e<r;e++){const r=this.children[e];if(!r.getChildByName)continue;const i=r.getChildByName(t,!0);if(i)return i}return null},YN.prototype.getGlobalPosition=function(t=new oD,e=!1){return this.parent?this.parent.toGlobal(this.position,t,e):(t.x=this.position.x,t.y=this.position.y),t};const CF={5:[.153388,.221461,.250301],7:[.071303,.131514,.189879,.214607],9:[.028532,.067234,.124009,.179044,.20236],11:[.0093,.028002,.065984,.121703,.175713,.198596],13:[.002406,.009255,.027867,.065666,.121117,.174868,.197641],15:[489e-6,.002403,.009246,.02784,.065602,.120999,.174697,.197448]},AF=["varying vec2 vBlurTexCoords[%size%];","uniform sampler2D uSampler;","void main(void)","{","    gl_FragColor = vec4(0.0);","    %blur%","}"].join("\n");class RF extends rL{constructor(t,e=8,r=4,i=rL.defaultResolution,n=5){const s=function(t,e){const r=Math.ceil(t/2);let i,n="\n    attribute vec2 aVertexPosition;\n\n    uniform mat3 projectionMatrix;\n\n    uniform float strength;\n\n    varying vec2 vBlurTexCoords[%size%];\n\n    uniform vec4 inputSize;\n    uniform vec4 outputFrame;\n\n    vec4 filterVertexPosition( void )\n    {\n        vec2 position = aVertexPosition * max(outputFrame.zw, vec2(0.)) + outputFrame.xy;\n\n        return vec4((projectionMatrix * vec3(position, 1.0)).xy, 0.0, 1.0);\n    }\n\n    vec2 filterTextureCoord( void )\n    {\n        return aVertexPosition * (outputFrame.zw * inputSize.zw);\n    }\n\n    void main(void)\n    {\n        gl_Position = filterVertexPosition();\n\n        vec2 textureCoord = filterTextureCoord();\n        %blur%\n    }",s="";i=e?"vBlurTexCoords[%index%] =  textureCoord + vec2(%sampleIndex% * strength, 0.0);":"vBlurTexCoords[%index%] =  textureCoord + vec2(0.0, %sampleIndex% * strength);";for(let e=0;e<t;e++){let t=i.replace("%index%",e.toString());t=t.replace("%sampleIndex%",e-(r-1)+".0"),s+=t,s+="\n"}return n=n.replace("%blur%",s),n=n.replace("%size%",t.toString()),n}(n,t),o=function(t){const e=CF[t],r=e.length;let i,n=AF,s="";for(let n=0;n<t;n++){let o="gl_FragColor += texture2D(uSampler, vBlurTexCoords[%index%]) * %value%;".replace("%index%",n.toString());i=n,n>=r&&(i=t-n-1),o=o.replace("%value%",e[i].toString()),s+=o,s+="\n"}return n=n.replace("%blur%",s),n=n.replace("%size%",t.toString()),n}(n);super(s,o),this.horizontal=t,this.resolution=i,this._quality=0,this.quality=r,this.blur=e}apply(t,e,r,i){if(r?this.horizontal?this.uniforms.strength=1/r.width*(r.width/e.width):this.uniforms.strength=1/r.height*(r.height/e.height):this.horizontal?this.uniforms.strength=1/t.renderer.width*(t.renderer.width/e.width):this.uniforms.strength=1/t.renderer.height*(t.renderer.height/e.height),this.uniforms.strength*=this.strength,this.uniforms.strength/=this.passes,1===this.passes)t.applyFilter(this,e,r,i);else{const n=t.getFilterTexture(),s=t.renderer;let o=e,a=n;this.state.blend=!1,t.applyFilter(this,o,a,TR.CLEAR);for(let e=1;e<this.passes-1;e++){t.bindAndClear(o,TR.BLIT),this.uniforms.uSampler=a;const e=a;a=o,o=e,s.shader.bind(this),s.geometry.draw(5)}this.state.blend=!0,t.applyFilter(this,a,r,i),t.returnFilterTexture(n)}}get blur(){return this.strength}set blur(t){this.padding=1+2*Math.abs(t),this.strength=t}get quality(){return this._quality}set quality(t){this._quality=t,this.passes=t}}class PF extends rL{constructor(){const t={m:new Float32Array([1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0]),uAlpha:1};super(bN,"varying vec2 vTextureCoord;\nuniform sampler2D uSampler;\nuniform float m[20];\nuniform float uAlpha;\n\nvoid main(void)\n{\n    vec4 c = texture2D(uSampler, vTextureCoord);\n\n    if (uAlpha == 0.0) {\n        gl_FragColor = c;\n        return;\n    }\n\n    // Un-premultiply alpha before applying the color matrix. See issue #3539.\n    if (c.a > 0.0) {\n      c.rgb /= c.a;\n    }\n\n    vec4 result;\n\n    result.r = (m[0] * c.r);\n        result.r += (m[1] * c.g);\n        result.r += (m[2] * c.b);\n        result.r += (m[3] * c.a);\n        result.r += m[4];\n\n    result.g = (m[5] * c.r);\n        result.g += (m[6] * c.g);\n        result.g += (m[7] * c.b);\n        result.g += (m[8] * c.a);\n        result.g += m[9];\n\n    result.b = (m[10] * c.r);\n       result.b += (m[11] * c.g);\n       result.b += (m[12] * c.b);\n       result.b += (m[13] * c.a);\n       result.b += m[14];\n\n    result.a = (m[15] * c.r);\n       result.a += (m[16] * c.g);\n       result.a += (m[17] * c.b);\n       result.a += (m[18] * c.a);\n       result.a += m[19];\n\n    vec3 rgb = mix(c.rgb, result.rgb, uAlpha);\n\n    // Premultiply alpha again.\n    rgb *= result.a;\n\n    gl_FragColor = vec4(rgb, result.a);\n}\n",t),this.alpha=1}_loadMatrix(t,e=!1){let r=t;e&&(this._multiply(r,this.uniforms.m,t),r=this._colorMatrix(r)),this.uniforms.m=r}_multiply(t,e,r){return t[0]=e[0]*r[0]+e[1]*r[5]+e[2]*r[10]+e[3]*r[15],t[1]=e[0]*r[1]+e[1]*r[6]+e[2]*r[11]+e[3]*r[16],t[2]=e[0]*r[2]+e[1]*r[7]+e[2]*r[12]+e[3]*r[17],t[3]=e[0]*r[3]+e[1]*r[8]+e[2]*r[13]+e[3]*r[18],t[4]=e[0]*r[4]+e[1]*r[9]+e[2]*r[14]+e[3]*r[19]+e[4],t[5]=e[5]*r[0]+e[6]*r[5]+e[7]*r[10]+e[8]*r[15],t[6]=e[5]*r[1]+e[6]*r[6]+e[7]*r[11]+e[8]*r[16],t[7]=e[5]*r[2]+e[6]*r[7]+e[7]*r[12]+e[8]*r[17],t[8]=e[5]*r[3]+e[6]*r[8]+e[7]*r[13]+e[8]*r[18],t[9]=e[5]*r[4]+e[6]*r[9]+e[7]*r[14]+e[8]*r[19]+e[9],t[10]=e[10]*r[0]+e[11]*r[5]+e[12]*r[10]+e[13]*r[15],t[11]=e[10]*r[1]+e[11]*r[6]+e[12]*r[11]+e[13]*r[16],t[12]=e[10]*r[2]+e[11]*r[7]+e[12]*r[12]+e[13]*r[17],t[13]=e[10]*r[3]+e[11]*r[8]+e[12]*r[13]+e[13]*r[18],t[14]=e[10]*r[4]+e[11]*r[9]+e[12]*r[14]+e[13]*r[19]+e[14],t[15]=e[15]*r[0]+e[16]*r[5]+e[17]*r[10]+e[18]*r[15],t[16]=e[15]*r[1]+e[16]*r[6]+e[17]*r[11]+e[18]*r[16],t[17]=e[15]*r[2]+e[16]*r[7]+e[17]*r[12]+e[18]*r[17],t[18]=e[15]*r[3]+e[16]*r[8]+e[17]*r[13]+e[18]*r[18],t[19]=e[15]*r[4]+e[16]*r[9]+e[17]*r[14]+e[18]*r[19]+e[19],t}_colorMatrix(t){const e=new Float32Array(t);return e[4]/=255,e[9]/=255,e[14]/=255,e[19]/=255,e}brightness(t,e){const r=[t,0,0,0,0,0,t,0,0,0,0,0,t,0,0,0,0,0,1,0];this._loadMatrix(r,e)}tint(t,e){const[r,i,n]=QO.shared.setValue(t).toArray(),s=[r,0,0,0,0,0,i,0,0,0,0,0,n,0,0,0,0,0,1,0];this._loadMatrix(s,e)}greyscale(t,e){const r=[t,t,t,0,0,t,t,t,0,0,t,t,t,0,0,0,0,0,1,0];this._loadMatrix(r,e)}blackAndWhite(t){this._loadMatrix([.3,.6,.1,0,0,.3,.6,.1,0,0,.3,.6,.1,0,0,0,0,0,1,0],t)}hue(t,e){t=(t||0)/180*Math.PI;const r=Math.cos(t),i=Math.sin(t),n=1/3,s=(0,Math.sqrt)(n),o=[r+(1-r)*n,n*(1-r)-s*i,n*(1-r)+s*i,0,0,n*(1-r)+s*i,r+n*(1-r),n*(1-r)-s*i,0,0,n*(1-r)-s*i,n*(1-r)+s*i,r+n*(1-r),0,0,0,0,0,1,0];this._loadMatrix(o,e)}contrast(t,e){const r=(t||0)+1,i=-.5*(r-1),n=[r,0,0,0,i,0,r,0,0,i,0,0,r,0,i,0,0,0,1,0];this._loadMatrix(n,e)}saturate(t=0,e){const r=2*t/3+1,i=-.5*(r-1),n=[r,i,i,0,0,i,r,i,0,0,i,i,r,0,0,0,0,0,1,0];this._loadMatrix(n,e)}desaturate(){this.saturate(-1)}negative(t){this._loadMatrix([-1,0,0,1,0,0,-1,0,1,0,0,0,-1,1,0,0,0,0,1,0],t)}sepia(t){this._loadMatrix([.393,.7689999,.18899999,0,0,.349,.6859999,.16799999,0,0,.272,.5339999,.13099999,0,0,0,0,0,1,0],t)}technicolor(t){this._loadMatrix([1.9125277891456083,-.8545344976951645,-.09155508482755585,0,11.793603434377337,-.3087833385928097,1.7658908555458428,-.10601743074722245,0,-70.35205161461398,-.231103377548616,-.7501899197440212,1.847597816108189,0,30.950940869491138,0,0,0,1,0],t)}polaroid(t){this._loadMatrix([1.438,-.062,-.062,0,0,-.122,1.378,-.122,0,0,-.016,-.016,1.483,0,0,0,0,0,1,0],t)}toBGR(t){this._loadMatrix([0,0,1,0,0,0,1,0,0,0,1,0,0,0,0,0,0,0,1,0],t)}kodachrome(t){this._loadMatrix([1.1285582396593525,-.3967382283601348,-.03992559172921793,0,63.72958762196502,-.16404339962244616,1.0835251566291304,-.05498805115633132,0,24.732407896706203,-.16786010706155763,-.5603416277695248,1.6014850761964943,0,35.62982807460946,0,0,0,1,0],t)}browni(t){this._loadMatrix([.5997023498159715,.34553243048391263,-.2708298674538042,0,47.43192855600873,-.037703249837783157,.8609577587992641,.15059552388459913,0,-36.96841498319127,.24113635128153335,-.07441037908422492,.44972182064877153,0,-7.562075277591283,0,0,0,1,0],t)}vintage(t){this._loadMatrix([.6279345635605994,.3202183420819367,-.03965408211312453,0,9.651285835294123,.02578397704808868,.6441188644374771,.03259127616149294,0,7.462829176470591,.0466055556782719,-.0851232987247891,.5241648018700465,0,5.159190588235296,0,0,0,1,0],t)}colorTone(t,e,r,i,n){t=t||.2,e=e||.15,r=r||16770432,i=i||3375104;const s=QO.shared,[o,a,h]=s.setValue(r).toArray(),[l,c,u]=s.setValue(i).toArray(),d=[.3,.59,.11,0,0,o,a,h,t,0,l,c,u,e,0,o-l,a-c,h-u,0,0];this._loadMatrix(d,n)}night(t,e){const r=[-2*(t=t||.1),-t,0,0,0,-t,0,t,0,0,0,t,2*t,0,0,0,0,0,1,0];this._loadMatrix(r,e)}predator(t,e){const r=[11.224130630493164*t,-4.794486999511719*t,-2.8746118545532227*t,0*t,.40342438220977783*t,-3.6330697536468506*t,9.193157196044922*t,-2.951810836791992*t,0*t,-1.316135048866272*t,-3.2184197902679443*t,-4.2375030517578125*t,7.476448059082031*t,0*t,.8044459223747253*t,0,0,0,1,0];this._loadMatrix(r,e)}lsd(t){this._loadMatrix([2,-.4,.5,0,0,-.5,2,-.4,0,0,-.4,-.5,3,0,0,0,0,0,1,0],t)}reset(){this._loadMatrix([1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0],!1)}get matrix(){return this.uniforms.m}set matrix(t){this.uniforms.m=t}get alpha(){return this.uniforms.uAlpha}set alpha(t){this.uniforms.uAlpha=t}}PF.prototype.grayscale=PF.prototype.greyscale;const IF={AlphaFilter:class extends rL{constructor(t=1){super("attribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\n\nuniform mat3 projectionMatrix;\n\nvarying vec2 vTextureCoord;\n\nvoid main(void)\n{\n    gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n    vTextureCoord = aTextureCoord;\n}","varying vec2 vTextureCoord;\n\nuniform sampler2D uSampler;\nuniform float uAlpha;\n\nvoid main(void)\n{\n   gl_FragColor = texture2D(uSampler, vTextureCoord) * uAlpha;\n}\n",{uAlpha:1}),this.alpha=t}get alpha(){return this.uniforms.uAlpha}set alpha(t){this.uniforms.uAlpha=t}},BlurFilter:class extends rL{constructor(t=8,e=4,r=rL.defaultResolution,i=5){super(),this._repeatEdgePixels=!1,this.blurXFilter=new RF(!0,t,e,r,i),this.blurYFilter=new RF(!1,t,e,r,i),this.resolution=r,this.quality=e,this.blur=t,this.repeatEdgePixels=!1}apply(t,e,r,i){const n=Math.abs(this.blurXFilter.strength),s=Math.abs(this.blurYFilter.strength);if(n&&s){const n=t.getFilterTexture();this.blurXFilter.apply(t,e,n,TR.CLEAR),this.blurYFilter.apply(t,n,r,i),t.returnFilterTexture(n)}else s?this.blurYFilter.apply(t,e,r,i):this.blurXFilter.apply(t,e,r,i)}updatePadding(){this._repeatEdgePixels?this.padding=0:this.padding=2*Math.max(Math.abs(this.blurXFilter.strength),Math.abs(this.blurYFilter.strength))}get blur(){return this.blurXFilter.blur}set blur(t){this.blurXFilter.blur=this.blurYFilter.blur=t,this.updatePadding()}get quality(){return this.blurXFilter.quality}set quality(t){this.blurXFilter.quality=this.blurYFilter.quality=t}get blurX(){return this.blurXFilter.blur}set blurX(t){this.blurXFilter.blur=t,this.updatePadding()}get blurY(){return this.blurYFilter.blur}set blurY(t){this.blurYFilter.blur=t,this.updatePadding()}get blendMode(){return this.blurYFilter.blendMode}set blendMode(t){this.blurYFilter.blendMode=t}get repeatEdgePixels(){return this._repeatEdgePixels}set repeatEdgePixels(t){this._repeatEdgePixels=t,this.updatePadding()}},BlurFilterPass:RF,ColorMatrixFilter:PF,DisplacementFilter:class extends rL{constructor(t,e){const r=new pD;t.renderable=!1,super("attribute vec2 aVertexPosition;\n\nuniform mat3 projectionMatrix;\nuniform mat3 filterMatrix;\n\nvarying vec2 vTextureCoord;\nvarying vec2 vFilterCoord;\n\nuniform vec4 inputSize;\nuniform vec4 outputFrame;\n\nvec4 filterVertexPosition( void )\n{\n    vec2 position = aVertexPosition * max(outputFrame.zw, vec2(0.)) + outputFrame.xy;\n\n    return vec4((projectionMatrix * vec3(position, 1.0)).xy, 0.0, 1.0);\n}\n\nvec2 filterTextureCoord( void )\n{\n    return aVertexPosition * (outputFrame.zw * inputSize.zw);\n}\n\nvoid main(void)\n{\n\tgl_Position = filterVertexPosition();\n\tvTextureCoord = filterTextureCoord();\n\tvFilterCoord = ( filterMatrix * vec3( vTextureCoord, 1.0)  ).xy;\n}\n","varying vec2 vFilterCoord;\nvarying vec2 vTextureCoord;\n\nuniform vec2 scale;\nuniform mat2 rotation;\nuniform sampler2D uSampler;\nuniform sampler2D mapSampler;\n\nuniform highp vec4 inputSize;\nuniform vec4 inputClamp;\n\nvoid main(void)\n{\n  vec4 map =  texture2D(mapSampler, vFilterCoord);\n\n  map -= 0.5;\n  map.xy = scale * inputSize.zw * (rotation * map.xy);\n\n  gl_FragColor = texture2D(uSampler, clamp(vec2(vTextureCoord.x + map.x, vTextureCoord.y + map.y), inputClamp.xy, inputClamp.zw));\n}\n",{mapSampler:t._texture,filterMatrix:r,scale:{x:1,y:1},rotation:new Float32Array([1,0,0,1])}),this.maskSprite=t,this.maskMatrix=r,null==e&&(e=20),this.scale=new oD(e,e)}apply(t,e,r,i){this.uniforms.filterMatrix=t.calculateSpriteMatrix(this.maskMatrix,this.maskSprite),this.uniforms.scale.x=this.scale.x,this.uniforms.scale.y=this.scale.y;const n=this.maskSprite.worldTransform,s=Math.sqrt(n.a*n.a+n.b*n.b),o=Math.sqrt(n.c*n.c+n.d*n.d);0!==s&&0!==o&&(this.uniforms.rotation[0]=n.a/s,this.uniforms.rotation[1]=n.b/s,this.uniforms.rotation[2]=n.c/o,this.uniforms.rotation[3]=n.d/o),t.applyFilter(this,e,r,i)}get map(){return this.uniforms.mapSampler}set map(t){this.uniforms.mapSampler=t}},FXAAFilter:class extends rL{constructor(){super("\nattribute vec2 aVertexPosition;\n\nuniform mat3 projectionMatrix;\n\nvarying vec2 v_rgbNW;\nvarying vec2 v_rgbNE;\nvarying vec2 v_rgbSW;\nvarying vec2 v_rgbSE;\nvarying vec2 v_rgbM;\n\nvarying vec2 vFragCoord;\n\nuniform vec4 inputSize;\nuniform vec4 outputFrame;\n\nvec4 filterVertexPosition( void )\n{\n    vec2 position = aVertexPosition * max(outputFrame.zw, vec2(0.)) + outputFrame.xy;\n\n    return vec4((projectionMatrix * vec3(position, 1.0)).xy, 0.0, 1.0);\n}\n\nvoid texcoords(vec2 fragCoord, vec2 inverseVP,\n               out vec2 v_rgbNW, out vec2 v_rgbNE,\n               out vec2 v_rgbSW, out vec2 v_rgbSE,\n               out vec2 v_rgbM) {\n    v_rgbNW = (fragCoord + vec2(-1.0, -1.0)) * inverseVP;\n    v_rgbNE = (fragCoord + vec2(1.0, -1.0)) * inverseVP;\n    v_rgbSW = (fragCoord + vec2(-1.0, 1.0)) * inverseVP;\n    v_rgbSE = (fragCoord + vec2(1.0, 1.0)) * inverseVP;\n    v_rgbM = vec2(fragCoord * inverseVP);\n}\n\nvoid main(void) {\n\n   gl_Position = filterVertexPosition();\n\n   vFragCoord = aVertexPosition * outputFrame.zw;\n\n   texcoords(vFragCoord, inputSize.zw, v_rgbNW, v_rgbNE, v_rgbSW, v_rgbSE, v_rgbM);\n}\n",'varying vec2 v_rgbNW;\nvarying vec2 v_rgbNE;\nvarying vec2 v_rgbSW;\nvarying vec2 v_rgbSE;\nvarying vec2 v_rgbM;\n\nvarying vec2 vFragCoord;\nuniform sampler2D uSampler;\nuniform highp vec4 inputSize;\n\n\n/**\n Basic FXAA implementation based on the code on geeks3d.com with the\n modification that the texture2DLod stuff was removed since it\'s\n unsupported by WebGL.\n\n --\n\n From:\n https://github.com/mitsuhiko/webgl-meincraft\n\n Copyright (c) 2011 by Armin Ronacher.\n\n Some rights reserved.\n\n Redistribution and use in source and binary forms, with or without\n modification, are permitted provided that the following conditions are\n met:\n\n * Redistributions of source code must retain the above copyright\n notice, this list of conditions and the following disclaimer.\n\n * Redistributions in binary form must reproduce the above\n copyright notice, this list of conditions and the following\n disclaimer in the documentation and/or other materials provided\n with the distribution.\n\n * The names of the contributors may not be used to endorse or\n promote products derived from this software without specific\n prior written permission.\n\n THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n */\n\n#ifndef FXAA_REDUCE_MIN\n#define FXAA_REDUCE_MIN   (1.0/ 128.0)\n#endif\n#ifndef FXAA_REDUCE_MUL\n#define FXAA_REDUCE_MUL   (1.0 / 8.0)\n#endif\n#ifndef FXAA_SPAN_MAX\n#define FXAA_SPAN_MAX     8.0\n#endif\n\n//optimized version for mobile, where dependent\n//texture reads can be a bottleneck\nvec4 fxaa(sampler2D tex, vec2 fragCoord, vec2 inverseVP,\n          vec2 v_rgbNW, vec2 v_rgbNE,\n          vec2 v_rgbSW, vec2 v_rgbSE,\n          vec2 v_rgbM) {\n    vec4 color;\n    vec3 rgbNW = texture2D(tex, v_rgbNW).xyz;\n    vec3 rgbNE = texture2D(tex, v_rgbNE).xyz;\n    vec3 rgbSW = texture2D(tex, v_rgbSW).xyz;\n    vec3 rgbSE = texture2D(tex, v_rgbSE).xyz;\n    vec4 texColor = texture2D(tex, v_rgbM);\n    vec3 rgbM  = texColor.xyz;\n    vec3 luma = vec3(0.299, 0.587, 0.114);\n    float lumaNW = dot(rgbNW, luma);\n    float lumaNE = dot(rgbNE, luma);\n    float lumaSW = dot(rgbSW, luma);\n    float lumaSE = dot(rgbSE, luma);\n    float lumaM  = dot(rgbM,  luma);\n    float lumaMin = min(lumaM, min(min(lumaNW, lumaNE), min(lumaSW, lumaSE)));\n    float lumaMax = max(lumaM, max(max(lumaNW, lumaNE), max(lumaSW, lumaSE)));\n\n    mediump vec2 dir;\n    dir.x = -((lumaNW + lumaNE) - (lumaSW + lumaSE));\n    dir.y =  ((lumaNW + lumaSW) - (lumaNE + lumaSE));\n\n    float dirReduce = max((lumaNW + lumaNE + lumaSW + lumaSE) *\n                          (0.25 * FXAA_REDUCE_MUL), FXAA_REDUCE_MIN);\n\n    float rcpDirMin = 1.0 / (min(abs(dir.x), abs(dir.y)) + dirReduce);\n    dir = min(vec2(FXAA_SPAN_MAX, FXAA_SPAN_MAX),\n              max(vec2(-FXAA_SPAN_MAX, -FXAA_SPAN_MAX),\n                  dir * rcpDirMin)) * inverseVP;\n\n    vec3 rgbA = 0.5 * (\n                       texture2D(tex, fragCoord * inverseVP + dir * (1.0 / 3.0 - 0.5)).xyz +\n                       texture2D(tex, fragCoord * inverseVP + dir * (2.0 / 3.0 - 0.5)).xyz);\n    vec3 rgbB = rgbA * 0.5 + 0.25 * (\n                                     texture2D(tex, fragCoord * inverseVP + dir * -0.5).xyz +\n                                     texture2D(tex, fragCoord * inverseVP + dir * 0.5).xyz);\n\n    float lumaB = dot(rgbB, luma);\n    if ((lumaB < lumaMin) || (lumaB > lumaMax))\n        color = vec4(rgbA, texColor.a);\n    else\n        color = vec4(rgbB, texColor.a);\n    return color;\n}\n\nvoid main() {\n\n      vec4 color;\n\n      color = fxaa(uSampler, vFragCoord, inputSize.zw, v_rgbNW, v_rgbNE, v_rgbSW, v_rgbSE, v_rgbM);\n\n      gl_FragColor = color;\n}\n')}},NoiseFilter:class extends rL{constructor(t=.5,e=Math.random()){super(bN,"precision highp float;\n\nvarying vec2 vTextureCoord;\nvarying vec4 vColor;\n\nuniform float uNoise;\nuniform float uSeed;\nuniform sampler2D uSampler;\n\nfloat rand(vec2 co)\n{\n    return fract(sin(dot(co.xy, vec2(12.9898, 78.233))) * 43758.5453);\n}\n\nvoid main()\n{\n    vec4 color = texture2D(uSampler, vTextureCoord);\n    float randomValue = rand(gl_FragCoord.xy * uSeed);\n    float diff = (randomValue - 0.5) * uNoise;\n\n    // Un-premultiply alpha before applying the color matrix. See issue #3539.\n    if (color.a > 0.0) {\n        color.rgb /= color.a;\n    }\n\n    color.r += diff;\n    color.g += diff;\n    color.b += diff;\n\n    // Premultiply alpha again.\n    color.rgb *= color.a;\n\n    gl_FragColor = color;\n}\n",{uNoise:0,uSeed:0}),this.noise=t,this.seed=e}get noise(){return this.uniforms.uNoise}set noise(t){this.uniforms.uNoise=t}get seed(){return this.uniforms.uSeed}set seed(t){this.uniforms.uSeed=t}}};Object.entries(IF).forEach((([t,e])=>{Object.defineProperty(IF,t,{get:()=>(TO("7.1.0",`filters.${t} has moved to ${t}`),e)})}));const MF=new class{constructor(){this.interactionFrequency=10,this._deltaTime=0,this._didMove=!1,this.tickerAdded=!1,this._pauseUpdate=!0}init(t){this.removeTickerListener(),this.events=t,this.interactionFrequency=10,this._deltaTime=0,this._didMove=!1,this.tickerAdded=!1,this._pauseUpdate=!0}get pauseUpdate(){return this._pauseUpdate}set pauseUpdate(t){this._pauseUpdate=t}addTickerListener(){!this.tickerAdded&&this.domElement&&(mN.system.add(this.tickerUpdate,this,dN.INTERACTION),this.tickerAdded=!0)}removeTickerListener(){this.tickerAdded&&(mN.system.remove(this.tickerUpdate,this),this.tickerAdded=!1)}pointerMoved(){this._didMove=!0}update(){if(!this.domElement||this._pauseUpdate)return;if(this._didMove)return void(this._didMove=!1);const t=this.events.rootPointerEvent;this.events.supportsTouchEvents&&"touch"===t.pointerType||globalThis.document.dispatchEvent(new PointerEvent("pointermove",{clientX:t.clientX,clientY:t.clientY}))}tickerUpdate(t){this._deltaTime+=t,this._deltaTime<this.interactionFrequency||(this._deltaTime=0,this.update())}};class OF{constructor(t){this.bubbles=!0,this.cancelBubble=!0,this.cancelable=!1,this.composed=!1,this.defaultPrevented=!1,this.eventPhase=OF.prototype.NONE,this.propagationStopped=!1,this.propagationImmediatelyStopped=!1,this.layer=new oD,this.page=new oD,this.NONE=0,this.CAPTURING_PHASE=1,this.AT_TARGET=2,this.BUBBLING_PHASE=3,this.manager=t}get layerX(){return this.layer.x}get layerY(){return this.layer.y}get pageX(){return this.page.x}get pageY(){return this.page.y}get data(){return this}composedPath(){return!this.manager||this.path&&this.path[this.path.length-1]===this.target||(this.path=this.target?this.manager.propagationPath(this.target):[]),this.path}initEvent(t,e,r){throw new Error("initEvent() is a legacy DOM API. It is not implemented in the Federated Events API.")}initUIEvent(t,e,r,i,n){throw new Error("initUIEvent() is a legacy DOM API. It is not implemented in the Federated Events API.")}preventDefault(){this.nativeEvent instanceof Event&&this.nativeEvent.cancelable&&this.nativeEvent.preventDefault(),this.defaultPrevented=!0}stopImmediatePropagation(){this.propagationImmediatelyStopped=!0}stopPropagation(){this.propagationStopped=!0}}class kF extends OF{constructor(){super(...arguments),this.client=new oD,this.movement=new oD,this.offset=new oD,this.global=new oD,this.screen=new oD}get clientX(){return this.client.x}get clientY(){return this.client.y}get x(){return this.clientX}get y(){return this.clientY}get movementX(){return this.movement.x}get movementY(){return this.movement.y}get offsetX(){return this.offset.x}get offsetY(){return this.offset.y}get globalX(){return this.global.x}get globalY(){return this.global.y}get screenX(){return this.screen.x}get screenY(){return this.screen.y}getLocalPosition(t,e,r){return t.worldTransform.applyInverse(r||this.global,e)}getModifierState(t){return"getModifierState"in this.nativeEvent&&this.nativeEvent.getModifierState(t)}initMouseEvent(t,e,r,i,n,s,o,a,h,l,c,u,d,p,f){throw new Error("Method not implemented.")}}class DF extends kF{constructor(){super(...arguments),this.width=0,this.height=0,this.isPrimary=!1}getCoalescedEvents(){return"pointermove"===this.type||"mousemove"===this.type||"touchmove"===this.type?[this]:[]}getPredictedEvents(){throw new Error("getPredictedEvents is not supported!")}}class LF extends kF{constructor(){super(...arguments),this.DOM_DELTA_PIXEL=0,this.DOM_DELTA_LINE=1,this.DOM_DELTA_PAGE=2}}LF.DOM_DELTA_PIXEL=0,LF.DOM_DELTA_LINE=1,LF.DOM_DELTA_PAGE=2;const NF=new oD,FF=new oD;class BF{constructor(t){this.dispatch=new $R,this.moveOnAll=!1,this.enableGlobalMoveEvents=!0,this.mappingState={trackingData:{}},this.eventPool=new Map,this._allInteractiveElements=[],this._hitElements=[],this._isPointerMoveEvent=!1,this.rootTarget=t,this.hitPruneFn=this.hitPruneFn.bind(this),this.hitTestFn=this.hitTestFn.bind(this),this.mapPointerDown=this.mapPointerDown.bind(this),this.mapPointerMove=this.mapPointerMove.bind(this),this.mapPointerOut=this.mapPointerOut.bind(this),this.mapPointerOver=this.mapPointerOver.bind(this),this.mapPointerUp=this.mapPointerUp.bind(this),this.mapPointerUpOutside=this.mapPointerUpOutside.bind(this),this.mapWheel=this.mapWheel.bind(this),this.mappingTable={},this.addEventMapping("pointerdown",this.mapPointerDown),this.addEventMapping("pointermove",this.mapPointerMove),this.addEventMapping("pointerout",this.mapPointerOut),this.addEventMapping("pointerleave",this.mapPointerOut),this.addEventMapping("pointerover",this.mapPointerOver),this.addEventMapping("pointerup",this.mapPointerUp),this.addEventMapping("pointerupoutside",this.mapPointerUpOutside),this.addEventMapping("wheel",this.mapWheel)}addEventMapping(t,e){this.mappingTable[t]||(this.mappingTable[t]=[]),this.mappingTable[t].push({fn:e,priority:0}),this.mappingTable[t].sort(((t,e)=>t.priority-e.priority))}dispatchEvent(t,e){t.propagationStopped=!1,t.propagationImmediatelyStopped=!1,this.propagate(t,e),this.dispatch.emit(e||t.type,t)}mapEvent(t){if(!this.rootTarget)return;const e=this.mappingTable[t.type];if(e)for(let r=0,i=e.length;r<i;r++)e[r].fn(t);else console.warn(`[EventBoundary]: Event mapping not defined for ${t.type}`)}hitTest(t,e){MF.pauseUpdate=!0;const r=this[this._isPointerMoveEvent&&this.enableGlobalMoveEvents?"hitTestMoveRecursive":"hitTestRecursive"](this.rootTarget,this.rootTarget.eventMode,NF.set(t,e),this.hitTestFn,this.hitPruneFn);return r&&r[0]}propagate(t,e){if(!t.target)return;const r=t.composedPath();t.eventPhase=t.CAPTURING_PHASE;for(let i=0,n=r.length-1;i<n;i++)if(t.currentTarget=r[i],this.notifyTarget(t,e),t.propagationStopped||t.propagationImmediatelyStopped)return;if(t.eventPhase=t.AT_TARGET,t.currentTarget=t.target,this.notifyTarget(t,e),!t.propagationStopped&&!t.propagationImmediatelyStopped){t.eventPhase=t.BUBBLING_PHASE;for(let i=r.length-2;i>=0;i--)if(t.currentTarget=r[i],this.notifyTarget(t,e),t.propagationStopped||t.propagationImmediatelyStopped)return}}all(t,e,r=this._allInteractiveElements){if(0===r.length)return;t.eventPhase=t.BUBBLING_PHASE;const i=Array.isArray(e)?e:[e];for(let e=r.length-1;e>=0;e--)i.forEach((i=>{t.currentTarget=r[e],this.notifyTarget(t,i)}))}propagationPath(t){const e=[t];for(let r=0;r<2048&&t!==this.rootTarget;r++){if(!t.parent)throw new Error("Cannot find propagation path to disconnected target");e.push(t.parent),t=t.parent}return e.reverse(),e}hitTestMoveRecursive(t,e,r,i,n,s=!1){let o=!1;if(this._interactivePrune(t))return null;if("dynamic"!==t.eventMode&&"dynamic"!==e||(MF.pauseUpdate=!1),t.interactiveChildren&&t.children){const a=t.children;for(let h=a.length-1;h>=0;h--){const l=a[h],c=this.hitTestMoveRecursive(l,this._isInteractive(e)?e:l.eventMode,r,i,n,s||n(t,r));if(c){if(c.length>0&&!c[c.length-1].parent)continue;const e=t.isInteractive();(c.length>0||e)&&(e&&this._allInteractiveElements.push(t),c.push(t)),0===this._hitElements.length&&(this._hitElements=c),o=!0}}}const a=this._isInteractive(e),h=t.isInteractive();return h&&h&&this._allInteractiveElements.push(t),s||this._hitElements.length>0?null:o?this._hitElements:a&&!n(t,r)&&i(t,r)?h?[t]:[]:null}hitTestRecursive(t,e,r,i,n){if(this._interactivePrune(t)||n(t,r))return null;if("dynamic"!==t.eventMode&&"dynamic"!==e||(MF.pauseUpdate=!1),t.interactiveChildren&&t.children){const s=t.children;for(let o=s.length-1;o>=0;o--){const a=s[o],h=this.hitTestRecursive(a,this._isInteractive(e)?e:a.eventMode,r,i,n);if(h){if(h.length>0&&!h[h.length-1].parent)continue;const e=t.isInteractive();return(h.length>0||e)&&h.push(t),h}}}const s=this._isInteractive(e),o=t.isInteractive();return s&&i(t,r)?o?[t]:[]:null}_isInteractive(t){return"static"===t||"dynamic"===t}_interactivePrune(t){return!(t&&!t.isMask&&t.visible&&t.renderable)||("none"===t.eventMode||("passive"===t.eventMode&&!t.interactiveChildren||!!t.isMask))}hitPruneFn(t,e){if(t.hitArea&&(t.worldTransform.applyInverse(e,FF),!t.hitArea.contains(FF.x,FF.y)))return!0;if(t._mask){const r=t._mask.isMaskData?t._mask.maskObject:t._mask;if(r&&!r.containsPoint?.(e))return!0}return!1}hitTestFn(t,e){return"passive"!==t.eventMode&&(!!t.hitArea||!!t.containsPoint&&t.containsPoint(e))}notifyTarget(t,e){const r=`on${e=e??t.type}`;t.currentTarget[r]?.(t);const i=t.eventPhase===t.CAPTURING_PHASE||t.eventPhase===t.AT_TARGET?`${e}capture`:e;this.notifyListeners(t,i),t.eventPhase===t.AT_TARGET&&this.notifyListeners(t,e)}mapPointerDown(t){if(!(t instanceof DF))return void console.warn("EventBoundary cannot map a non-pointer event as a pointer event");const e=this.createPointerEvent(t);if(this.dispatchEvent(e,"pointerdown"),"touch"===e.pointerType)this.dispatchEvent(e,"touchstart");else if("mouse"===e.pointerType||"pen"===e.pointerType){const t=2===e.button;this.dispatchEvent(e,t?"rightdown":"mousedown")}this.trackingData(t.pointerId).pressTargetsByButton[t.button]=e.composedPath(),this.freeEvent(e)}mapPointerMove(t){if(!(t instanceof DF))return void console.warn("EventBoundary cannot map a non-pointer event as a pointer event");this._allInteractiveElements.length=0,this._hitElements.length=0,this._isPointerMoveEvent=!0;const e=this.createPointerEvent(t);this._isPointerMoveEvent=!1;const r="mouse"===e.pointerType||"pen"===e.pointerType,i=this.trackingData(t.pointerId),n=this.findMountedTarget(i.overTargets);if(i.overTargets?.length>0&&n!==e.target){const i="mousemove"===t.type?"mouseout":"pointerout",s=this.createPointerEvent(t,i,n);if(this.dispatchEvent(s,"pointerout"),r&&this.dispatchEvent(s,"mouseout"),!e.composedPath().includes(n)){const i=this.createPointerEvent(t,"pointerleave",n);for(i.eventPhase=i.AT_TARGET;i.target&&!e.composedPath().includes(i.target);)i.currentTarget=i.target,this.notifyTarget(i),r&&this.notifyTarget(i,"mouseleave"),i.target=i.target.parent;this.freeEvent(i)}this.freeEvent(s)}if(n!==e.target){const i="mousemove"===t.type?"mouseover":"pointerover",s=this.clonePointerEvent(e,i);this.dispatchEvent(s,"pointerover"),r&&this.dispatchEvent(s,"mouseover");let o=n?.parent;for(;o&&o!==this.rootTarget.parent&&o!==e.target;)o=o.parent;if(!o||o===this.rootTarget.parent){const t=this.clonePointerEvent(e,"pointerenter");for(t.eventPhase=t.AT_TARGET;t.target&&t.target!==n&&t.target!==this.rootTarget.parent;)t.currentTarget=t.target,this.notifyTarget(t),r&&this.notifyTarget(t,"mouseenter"),t.target=t.target.parent;this.freeEvent(t)}this.freeEvent(s)}const s=[],o=this.enableGlobalMoveEvents??!0;this.moveOnAll?s.push("pointermove"):this.dispatchEvent(e,"pointermove"),o&&s.push("globalpointermove"),"touch"===e.pointerType&&(this.moveOnAll?s.splice(1,0,"touchmove"):this.dispatchEvent(e,"touchmove"),o&&s.push("globaltouchmove")),r&&(this.moveOnAll?s.splice(1,0,"mousemove"):this.dispatchEvent(e,"mousemove"),o&&s.push("globalmousemove"),this.cursor=e.target?.cursor),s.length>0&&this.all(e,s),this._allInteractiveElements.length=0,this._hitElements.length=0,i.overTargets=e.composedPath(),this.freeEvent(e)}mapPointerOver(t){if(!(t instanceof DF))return void console.warn("EventBoundary cannot map a non-pointer event as a pointer event");const e=this.trackingData(t.pointerId),r=this.createPointerEvent(t),i="mouse"===r.pointerType||"pen"===r.pointerType;this.dispatchEvent(r,"pointerover"),i&&this.dispatchEvent(r,"mouseover"),"mouse"===r.pointerType&&(this.cursor=r.target?.cursor);const n=this.clonePointerEvent(r,"pointerenter");for(n.eventPhase=n.AT_TARGET;n.target&&n.target!==this.rootTarget.parent;)n.currentTarget=n.target,this.notifyTarget(n),i&&this.notifyTarget(n,"mouseenter"),n.target=n.target.parent;e.overTargets=r.composedPath(),this.freeEvent(r),this.freeEvent(n)}mapPointerOut(t){if(!(t instanceof DF))return void console.warn("EventBoundary cannot map a non-pointer event as a pointer event");const e=this.trackingData(t.pointerId);if(e.overTargets){const r="mouse"===t.pointerType||"pen"===t.pointerType,i=this.findMountedTarget(e.overTargets),n=this.createPointerEvent(t,"pointerout",i);this.dispatchEvent(n),r&&this.dispatchEvent(n,"mouseout");const s=this.createPointerEvent(t,"pointerleave",i);for(s.eventPhase=s.AT_TARGET;s.target&&s.target!==this.rootTarget.parent;)s.currentTarget=s.target,this.notifyTarget(s),r&&this.notifyTarget(s,"mouseleave"),s.target=s.target.parent;e.overTargets=null,this.freeEvent(n),this.freeEvent(s)}this.cursor=null}mapPointerUp(t){if(!(t instanceof DF))return void console.warn("EventBoundary cannot map a non-pointer event as a pointer event");const e=performance.now(),r=this.createPointerEvent(t);if(this.dispatchEvent(r,"pointerup"),"touch"===r.pointerType)this.dispatchEvent(r,"touchend");else if("mouse"===r.pointerType||"pen"===r.pointerType){const t=2===r.button;this.dispatchEvent(r,t?"rightup":"mouseup")}const i=this.trackingData(t.pointerId),n=this.findMountedTarget(i.pressTargetsByButton[t.button]);let s=n;if(n&&!r.composedPath().includes(n)){let e=n;for(;e&&!r.composedPath().includes(e);){if(r.currentTarget=e,this.notifyTarget(r,"pointerupoutside"),"touch"===r.pointerType)this.notifyTarget(r,"touchendoutside");else if("mouse"===r.pointerType||"pen"===r.pointerType){const t=2===r.button;this.notifyTarget(r,t?"rightupoutside":"mouseupoutside")}e=e.parent}delete i.pressTargetsByButton[t.button],s=e}if(s){const n=this.clonePointerEvent(r,"click");n.target=s,n.path=null,i.clicksByButton[t.button]||(i.clicksByButton[t.button]={clickCount:0,target:n.target,timeStamp:e});const o=i.clicksByButton[t.button];if(o.target===n.target&&e-o.timeStamp<200?++o.clickCount:o.clickCount=1,o.target=n.target,o.timeStamp=e,n.detail=o.clickCount,"mouse"===n.pointerType){const t=2===n.button;this.dispatchEvent(n,t?"rightclick":"click")}else"touch"===n.pointerType&&this.dispatchEvent(n,"tap");this.dispatchEvent(n,"pointertap"),this.freeEvent(n)}this.freeEvent(r)}mapPointerUpOutside(t){if(!(t instanceof DF))return void console.warn("EventBoundary cannot map a non-pointer event as a pointer event");const e=this.trackingData(t.pointerId),r=this.findMountedTarget(e.pressTargetsByButton[t.button]),i=this.createPointerEvent(t);if(r){let n=r;for(;n;)i.currentTarget=n,this.notifyTarget(i,"pointerupoutside"),"touch"===i.pointerType?this.notifyTarget(i,"touchendoutside"):"mouse"!==i.pointerType&&"pen"!==i.pointerType||this.notifyTarget(i,2===i.button?"rightupoutside":"mouseupoutside"),n=n.parent;delete e.pressTargetsByButton[t.button]}this.freeEvent(i)}mapWheel(t){if(!(t instanceof LF))return void console.warn("EventBoundary cannot map a non-wheel event as a wheel event");const e=this.createWheelEvent(t);this.dispatchEvent(e),this.freeEvent(e)}findMountedTarget(t){if(!t)return null;let e=t[0];for(let r=1;r<t.length&&t[r].parent===e;r++)e=t[r];return e}createPointerEvent(t,e,r){const i=this.allocateEvent(DF);return this.copyPointerData(t,i),this.copyMouseData(t,i),this.copyData(t,i),i.nativeEvent=t.nativeEvent,i.originalEvent=t,i.target=r??this.hitTest(i.global.x,i.global.y)??this._hitElements[0],"string"==typeof e&&(i.type=e),i}createWheelEvent(t){const e=this.allocateEvent(LF);return this.copyWheelData(t,e),this.copyMouseData(t,e),this.copyData(t,e),e.nativeEvent=t.nativeEvent,e.originalEvent=t,e.target=this.hitTest(e.global.x,e.global.y),e}clonePointerEvent(t,e){const r=this.allocateEvent(DF);return r.nativeEvent=t.nativeEvent,r.originalEvent=t.originalEvent,this.copyPointerData(t,r),this.copyMouseData(t,r),this.copyData(t,r),r.target=t.target,r.path=t.composedPath().slice(),r.type=e??r.type,r}copyWheelData(t,e){e.deltaMode=t.deltaMode,e.deltaX=t.deltaX,e.deltaY=t.deltaY,e.deltaZ=t.deltaZ}copyPointerData(t,e){t instanceof DF&&e instanceof DF&&(e.pointerId=t.pointerId,e.width=t.width,e.height=t.height,e.isPrimary=t.isPrimary,e.pointerType=t.pointerType,e.pressure=t.pressure,e.tangentialPressure=t.tangentialPressure,e.tiltX=t.tiltX,e.tiltY=t.tiltY,e.twist=t.twist)}copyMouseData(t,e){t instanceof kF&&e instanceof kF&&(e.altKey=t.altKey,e.button=t.button,e.buttons=t.buttons,e.client.copyFrom(t.client),e.ctrlKey=t.ctrlKey,e.metaKey=t.metaKey,e.movement.copyFrom(t.movement),e.screen.copyFrom(t.screen),e.shiftKey=t.shiftKey,e.global.copyFrom(t.global))}copyData(t,e){e.isTrusted=t.isTrusted,e.srcElement=t.srcElement,e.timeStamp=performance.now(),e.type=t.type,e.detail=t.detail,e.view=t.view,e.which=t.which,e.layer.copyFrom(t.layer),e.page.copyFrom(t.page)}trackingData(t){return this.mappingState.trackingData[t]||(this.mappingState.trackingData[t]={pressTargetsByButton:{},clicksByButton:{},overTarget:null}),this.mappingState.trackingData[t]}allocateEvent(t){this.eventPool.has(t)||this.eventPool.set(t,[]);const e=this.eventPool.get(t).pop()||new t(this);return e.eventPhase=e.NONE,e.currentTarget=null,e.path=null,e.target=null,e}freeEvent(t){if(t.manager!==this)throw new Error("It is illegal to free an event not managed by this EventBoundary!");const e=t.constructor;this.eventPool.has(e)||this.eventPool.set(e,[]),this.eventPool.get(e).push(t)}notifyListeners(t,e){const r=t.currentTarget._events[e];if(r&&t.currentTarget.isInteractive())if("fn"in r)r.once&&t.currentTarget.removeListener(e,r.fn,void 0,!0),r.fn.call(r.context,t);else for(let i=0,n=r.length;i<n&&!t.propagationImmediatelyStopped;i++)r[i].once&&t.currentTarget.removeListener(e,r[i].fn,void 0,!0),r[i].fn.call(r[i].context,t)}}const UF={touchstart:"pointerdown",touchend:"pointerup",touchendoutside:"pointerupoutside",touchmove:"pointermove",touchcancel:"pointercancel"},GF=class{constructor(t){this.supportsTouchEvents="ontouchstart"in globalThis,this.supportsPointerEvents=!!globalThis.PointerEvent,this.domElement=null,this.resolution=1,this.renderer=t,this.rootBoundary=new BF(null),MF.init(this),this.autoPreventDefault=!0,this.eventsAdded=!1,this.rootPointerEvent=new DF(null),this.rootWheelEvent=new LF(null),this.cursorStyles={default:"inherit",pointer:"pointer"},this.features=new Proxy({...GF.defaultEventFeatures},{set:(t,e,r)=>("globalMove"===e&&(this.rootBoundary.enableGlobalMoveEvents=r),t[e]=r,!0)}),this.onPointerDown=this.onPointerDown.bind(this),this.onPointerMove=this.onPointerMove.bind(this),this.onPointerUp=this.onPointerUp.bind(this),this.onPointerOverOut=this.onPointerOverOut.bind(this),this.onWheel=this.onWheel.bind(this)}static get defaultEventMode(){return this._defaultEventMode}init(t){const{view:e,resolution:r}=this.renderer;this.setTargetElement(e),this.resolution=r,GF._defaultEventMode=t.eventMode??"auto",Object.assign(this.features,t.eventFeatures??{}),this.rootBoundary.enableGlobalMoveEvents=this.features.globalMove}resolutionChange(t){this.resolution=t}destroy(){this.setTargetElement(null),this.renderer=null}setCursor(t){t=t||"default";let e=!0;if(globalThis.OffscreenCanvas&&this.domElement instanceof OffscreenCanvas&&(e=!1),this.currentCursor===t)return;this.currentCursor=t;const r=this.cursorStyles[t];if(r)switch(typeof r){case"string":e&&(this.domElement.style.cursor=r);break;case"function":r(t);break;case"object":e&&Object.assign(this.domElement.style,r)}else e&&"string"==typeof t&&!Object.prototype.hasOwnProperty.call(this.cursorStyles,t)&&(this.domElement.style.cursor=t)}get pointer(){return this.rootPointerEvent}onPointerDown(t){if(!this.features.click)return;if(this.rootBoundary.rootTarget=this.renderer.lastObjectRendered,this.supportsTouchEvents&&"touch"===t.pointerType)return;const e=this.normalizeToPointerData(t);if(this.autoPreventDefault&&e[0].isNormalized){(t.cancelable||!("cancelable"in t))&&t.preventDefault()}for(let t=0,r=e.length;t<r;t++){const r=e[t],i=this.bootstrapEvent(this.rootPointerEvent,r);this.rootBoundary.mapEvent(i)}this.setCursor(this.rootBoundary.cursor)}onPointerMove(t){if(!this.features.move)return;if(this.rootBoundary.rootTarget=this.renderer.lastObjectRendered,this.supportsTouchEvents&&"touch"===t.pointerType)return;MF.pointerMoved();const e=this.normalizeToPointerData(t);for(let t=0,r=e.length;t<r;t++){const r=this.bootstrapEvent(this.rootPointerEvent,e[t]);this.rootBoundary.mapEvent(r)}this.setCursor(this.rootBoundary.cursor)}onPointerUp(t){if(!this.features.click)return;if(this.rootBoundary.rootTarget=this.renderer.lastObjectRendered,this.supportsTouchEvents&&"touch"===t.pointerType)return;let e=t.target;t.composedPath&&t.composedPath().length>0&&(e=t.composedPath()[0]);const r=e!==this.domElement?"outside":"",i=this.normalizeToPointerData(t);for(let t=0,e=i.length;t<e;t++){const e=this.bootstrapEvent(this.rootPointerEvent,i[t]);e.type+=r,this.rootBoundary.mapEvent(e)}this.setCursor(this.rootBoundary.cursor)}onPointerOverOut(t){if(!this.features.click)return;if(this.rootBoundary.rootTarget=this.renderer.lastObjectRendered,this.supportsTouchEvents&&"touch"===t.pointerType)return;const e=this.normalizeToPointerData(t);for(let t=0,r=e.length;t<r;t++){const r=this.bootstrapEvent(this.rootPointerEvent,e[t]);this.rootBoundary.mapEvent(r)}this.setCursor(this.rootBoundary.cursor)}onWheel(t){if(!this.features.wheel)return;const e=this.normalizeWheelEvent(t);this.rootBoundary.rootTarget=this.renderer.lastObjectRendered,this.rootBoundary.mapEvent(e)}setTargetElement(t){this.removeEvents(),this.domElement=t,MF.domElement=t,this.addEvents()}addEvents(){if(this.eventsAdded||!this.domElement)return;MF.addTickerListener();const t=this.domElement.style;t&&(globalThis.navigator.msPointerEnabled?(t.msContentZooming="none",t.msTouchAction="none"):this.supportsPointerEvents&&(t.touchAction="none")),this.supportsPointerEvents?(globalThis.document.addEventListener("pointermove",this.onPointerMove,!0),this.domElement.addEventListener("pointerdown",this.onPointerDown,!0),this.domElement.addEventListener("pointerleave",this.onPointerOverOut,!0),this.domElement.addEventListener("pointerover",this.onPointerOverOut,!0),globalThis.addEventListener("pointerup",this.onPointerUp,!0)):(globalThis.document.addEventListener("mousemove",this.onPointerMove,!0),this.domElement.addEventListener("mousedown",this.onPointerDown,!0),this.domElement.addEventListener("mouseout",this.onPointerOverOut,!0),this.domElement.addEventListener("mouseover",this.onPointerOverOut,!0),globalThis.addEventListener("mouseup",this.onPointerUp,!0)),this.supportsTouchEvents&&(this.domElement.addEventListener("touchstart",this.onPointerDown,!0),this.domElement.addEventListener("touchend",this.onPointerUp,!0),this.domElement.addEventListener("touchmove",this.onPointerMove,!0)),this.domElement.addEventListener("wheel",this.onWheel,{passive:!0,capture:!0}),this.eventsAdded=!0}removeEvents(){if(!this.eventsAdded||!this.domElement)return;MF.removeTickerListener();const t=this.domElement.style;globalThis.navigator.msPointerEnabled?(t.msContentZooming="",t.msTouchAction=""):this.supportsPointerEvents&&(t.touchAction=""),this.supportsPointerEvents?(globalThis.document.removeEventListener("pointermove",this.onPointerMove,!0),this.domElement.removeEventListener("pointerdown",this.onPointerDown,!0),this.domElement.removeEventListener("pointerleave",this.onPointerOverOut,!0),this.domElement.removeEventListener("pointerover",this.onPointerOverOut,!0),globalThis.removeEventListener("pointerup",this.onPointerUp,!0)):(globalThis.document.removeEventListener("mousemove",this.onPointerMove,!0),this.domElement.removeEventListener("mousedown",this.onPointerDown,!0),this.domElement.removeEventListener("mouseout",this.onPointerOverOut,!0),this.domElement.removeEventListener("mouseover",this.onPointerOverOut,!0),globalThis.removeEventListener("mouseup",this.onPointerUp,!0)),this.supportsTouchEvents&&(this.domElement.removeEventListener("touchstart",this.onPointerDown,!0),this.domElement.removeEventListener("touchend",this.onPointerUp,!0),this.domElement.removeEventListener("touchmove",this.onPointerMove,!0)),this.domElement.removeEventListener("wheel",this.onWheel,!0),this.domElement=null,this.eventsAdded=!1}mapPositionToPoint(t,e,r){let i;i=this.domElement.parentElement?this.domElement.getBoundingClientRect():{x:0,y:0,width:this.domElement.width,height:this.domElement.height,left:0,top:0};const n=1/this.resolution;t.x=(e-i.left)*(this.domElement.width/i.width)*n,t.y=(r-i.top)*(this.domElement.height/i.height)*n}normalizeToPointerData(t){const e=[];if(this.supportsTouchEvents&&t instanceof TouchEvent)for(let r=0,i=t.changedTouches.length;r<i;r++){const i=t.changedTouches[r];void 0===i.button&&(i.button=0),void 0===i.buttons&&(i.buttons=1),void 0===i.isPrimary&&(i.isPrimary=1===t.touches.length&&"touchstart"===t.type),void 0===i.width&&(i.width=i.radiusX||1),void 0===i.height&&(i.height=i.radiusY||1),void 0===i.tiltX&&(i.tiltX=0),void 0===i.tiltY&&(i.tiltY=0),void 0===i.pointerType&&(i.pointerType="touch"),void 0===i.pointerId&&(i.pointerId=i.identifier||0),void 0===i.pressure&&(i.pressure=i.force||.5),void 0===i.twist&&(i.twist=0),void 0===i.tangentialPressure&&(i.tangentialPressure=0),void 0===i.layerX&&(i.layerX=i.offsetX=i.clientX),void 0===i.layerY&&(i.layerY=i.offsetY=i.clientY),i.isNormalized=!0,i.type=t.type,e.push(i)}else if(globalThis.MouseEvent&&(!(t instanceof MouseEvent)||this.supportsPointerEvents&&t instanceof globalThis.PointerEvent))e.push(t);else{const r=t;void 0===r.isPrimary&&(r.isPrimary=!0),void 0===r.width&&(r.width=1),void 0===r.height&&(r.height=1),void 0===r.tiltX&&(r.tiltX=0),void 0===r.tiltY&&(r.tiltY=0),void 0===r.pointerType&&(r.pointerType="mouse"),void 0===r.pointerId&&(r.pointerId=1),void 0===r.pressure&&(r.pressure=.5),void 0===r.twist&&(r.twist=0),void 0===r.tangentialPressure&&(r.tangentialPressure=0),r.isNormalized=!0,e.push(r)}return e}normalizeWheelEvent(t){const e=this.rootWheelEvent;return this.transferMouseData(e,t),e.deltaX=t.deltaX,e.deltaY=t.deltaY,e.deltaZ=t.deltaZ,e.deltaMode=t.deltaMode,this.mapPositionToPoint(e.screen,t.clientX,t.clientY),e.global.copyFrom(e.screen),e.offset.copyFrom(e.screen),e.nativeEvent=t,e.type=t.type,e}bootstrapEvent(t,e){return t.originalEvent=null,t.nativeEvent=e,t.pointerId=e.pointerId,t.width=e.width,t.height=e.height,t.isPrimary=e.isPrimary,t.pointerType=e.pointerType,t.pressure=e.pressure,t.tangentialPressure=e.tangentialPressure,t.tiltX=e.tiltX,t.tiltY=e.tiltY,t.twist=e.twist,this.transferMouseData(t,e),this.mapPositionToPoint(t.screen,e.clientX,e.clientY),t.global.copyFrom(t.screen),t.offset.copyFrom(t.screen),t.isTrusted=e.isTrusted,"pointerleave"===t.type&&(t.type="pointerout"),t.type.startsWith("mouse")&&(t.type=t.type.replace("mouse","pointer")),t.type.startsWith("touch")&&(t.type=UF[t.type]||t.type),t}transferMouseData(t,e){t.isTrusted=e.isTrusted,t.srcElement=e.srcElement,t.timeStamp=performance.now(),t.type=e.type,t.altKey=e.altKey,t.button=e.button,t.buttons=e.buttons,t.client.x=e.clientX,t.client.y=e.clientY,t.ctrlKey=e.ctrlKey,t.metaKey=e.metaKey,t.movement.x=e.movementX,t.movement.y=e.movementY,t.page.x=e.pageX,t.page.y=e.pageY,t.relatedTarget=null,t.shiftKey=e.shiftKey}};let jF=GF;function VF(t){return"dynamic"===t||"static"===t}jF.extension={name:"events",type:[Ik.RendererSystem,Ik.CanvasRendererSystem]},jF.defaultEventFeatures={move:!0,globalMove:!0,click:!0,wheel:!0},kk.add(jF);const HF={onclick:null,onmousedown:null,onmouseenter:null,onmouseleave:null,onmousemove:null,onglobalmousemove:null,onmouseout:null,onmouseover:null,onmouseup:null,onmouseupoutside:null,onpointercancel:null,onpointerdown:null,onpointerenter:null,onpointerleave:null,onpointermove:null,onglobalpointermove:null,onpointerout:null,onpointerover:null,onpointertap:null,onpointerup:null,onpointerupoutside:null,onrightclick:null,onrightdown:null,onrightup:null,onrightupoutside:null,ontap:null,ontouchcancel:null,ontouchend:null,ontouchendoutside:null,ontouchmove:null,onglobaltouchmove:null,ontouchstart:null,onwheel:null,_internalInteractive:void 0,get interactive(){return this._internalInteractive??VF(jF.defaultEventMode)},set interactive(t){TO("7.2.0","Setting interactive is deprecated, use eventMode = 'none'/'passive'/'auto'/'static'/'dynamic' instead."),this._internalInteractive=t,this.eventMode=t?"static":"auto"},_internalEventMode:void 0,get eventMode(){return this._internalEventMode??jF.defaultEventMode},set eventMode(t){this._internalInteractive=VF(t),this._internalEventMode=t},isInteractive(){return"static"===this.eventMode||"dynamic"===this.eventMode},interactiveChildren:!0,hitArea:null,addEventListener(t,e,r){const i="function"==typeof e?void 0:e;t="boolean"==typeof r&&r||"object"==typeof r&&r.capture?`${t}capture`:t,e="function"==typeof e?e:e.handleEvent,this.on(t,e,i)},removeEventListener(t,e,r){const i="function"==typeof e?void 0:e;t="boolean"==typeof r&&r||"object"==typeof r&&r.capture?`${t}capture`:t,e="function"==typeof e?e:e.handleEvent,this.off(t,e,i)},dispatchEvent(t){if(!(t instanceof OF))throw new Error("DisplayObject cannot propagate events outside of the Federated Events API");return t.defaultPrevented=!1,t.path=null,t.target=this,t.manager.dispatchEvent(t),!t.defaultPrevented}};YN.mixin(HF);YN.mixin({accessible:!1,accessibleTitle:null,accessibleHint:null,tabIndex:0,_accessibleActive:!1,_accessibleDiv:null,accessibleType:"button",accessiblePointerEvents:"auto",accessibleChildren:!0,renderId:-1});class WF{constructor(t){this.debug=!1,this._isActive=!1,this._isMobileAccessibility=!1,this.pool=[],this.renderId=0,this.children=[],this.androidUpdateCount=0,this.androidUpdateFrequency=500,this._hookDiv=null,(YR.tablet||YR.phone)&&this.createTouchHook();const e=document.createElement("div");e.style.width="100px",e.style.height="100px",e.style.position="absolute",e.style.top="0px",e.style.left="0px",e.style.zIndex=2..toString(),this.div=e,this.renderer=t,this._onKeyDown=this._onKeyDown.bind(this),this._onMouseMove=this._onMouseMove.bind(this),globalThis.addEventListener("keydown",this._onKeyDown,!1)}get isActive(){return this._isActive}get isMobileAccessibility(){return this._isMobileAccessibility}createTouchHook(){const t=document.createElement("button");t.style.width="1px",t.style.height="1px",t.style.position="absolute",t.style.top="-1000px",t.style.left="-1000px",t.style.zIndex=2..toString(),t.style.backgroundColor="#FF0000",t.title="select to enable accessibility for this content",t.addEventListener("focus",(()=>{this._isMobileAccessibility=!0,this.activate(),this.destroyTouchHook()})),document.body.appendChild(t),this._hookDiv=t}destroyTouchHook(){this._hookDiv&&(document.body.removeChild(this._hookDiv),this._hookDiv=null)}activate(){this._isActive||(this._isActive=!0,globalThis.document.addEventListener("mousemove",this._onMouseMove,!0),globalThis.removeEventListener("keydown",this._onKeyDown,!1),this.renderer.on("postrender",this.update,this),this.renderer.view.parentNode?.appendChild(this.div))}deactivate(){this._isActive&&!this._isMobileAccessibility&&(this._isActive=!1,globalThis.document.removeEventListener("mousemove",this._onMouseMove,!0),globalThis.addEventListener("keydown",this._onKeyDown,!1),this.renderer.off("postrender",this.update),this.div.parentNode?.removeChild(this.div))}updateAccessibleObjects(t){if(!t.visible||!t.accessibleChildren)return;t.accessible&&t.isInteractive()&&(t._accessibleActive||this.addChild(t),t.renderId=this.renderId);const e=t.children;if(e)for(let t=0;t<e.length;t++)this.updateAccessibleObjects(e[t])}update(){const t=performance.now();if(YR.android.device&&t<this.androidUpdateCount)return;if(this.androidUpdateCount=t+this.androidUpdateFrequency,!this.renderer.renderingToScreen)return;this.renderer.lastObjectRendered&&this.updateAccessibleObjects(this.renderer.lastObjectRendered);const{x:e,y:r,width:i,height:n}=this.renderer.view.getBoundingClientRect(),{width:s,height:o,resolution:a}=this.renderer,h=i/s*a,l=n/o*a;let c=this.div;c.style.left=`${e}px`,c.style.top=`${r}px`,c.style.width=`${s}px`,c.style.height=`${o}px`;for(let t=0;t<this.children.length;t++){const e=this.children[t];if(e.renderId!==this.renderId)e._accessibleActive=!1,dk(this.children,t,1),this.div.removeChild(e._accessibleDiv),this.pool.push(e._accessibleDiv),e._accessibleDiv=null,t--;else{c=e._accessibleDiv;let t=e.hitArea;const r=e.worldTransform;e.hitArea?(c.style.left=(r.tx+t.x*r.a)*h+"px",c.style.top=(r.ty+t.y*r.d)*l+"px",c.style.width=t.width*r.a*h+"px",c.style.height=t.height*r.d*l+"px"):(t=e.getBounds(),this.capHitArea(t),c.style.left=t.x*h+"px",c.style.top=t.y*l+"px",c.style.width=t.width*h+"px",c.style.height=t.height*l+"px",c.title!==e.accessibleTitle&&null!==e.accessibleTitle&&(c.title=e.accessibleTitle),c.getAttribute("aria-label")!==e.accessibleHint&&null!==e.accessibleHint&&c.setAttribute("aria-label",e.accessibleHint)),e.accessibleTitle===c.title&&e.tabIndex===c.tabIndex||(c.title=e.accessibleTitle,c.tabIndex=e.tabIndex,this.debug&&this.updateDebugHTML(c))}}this.renderId++}updateDebugHTML(t){t.innerHTML=`type: ${t.type}</br> title : ${t.title}</br> tabIndex: ${t.tabIndex}`}capHitArea(t){t.x<0&&(t.width+=t.x,t.x=0),t.y<0&&(t.height+=t.y,t.y=0);const{width:e,height:r}=this.renderer;t.x+t.width>e&&(t.width=e-t.x),t.y+t.height>r&&(t.height=r-t.y)}addChild(t){let e=this.pool.pop();e||(e=document.createElement("button"),e.style.width="100px",e.style.height="100px",e.style.backgroundColor=this.debug?"rgba(255,255,255,0.5)":"transparent",e.style.position="absolute",e.style.zIndex=2..toString(),e.style.borderStyle="none",navigator.userAgent.toLowerCase().includes("chrome")?e.setAttribute("aria-live","off"):e.setAttribute("aria-live","polite"),navigator.userAgent.match(/rv:.*Gecko\//)?e.setAttribute("aria-relevant","additions"):e.setAttribute("aria-relevant","text"),e.addEventListener("click",this._onClick.bind(this)),e.addEventListener("focus",this._onFocus.bind(this)),e.addEventListener("focusout",this._onFocusOut.bind(this))),e.style.pointerEvents=t.accessiblePointerEvents,e.type=t.accessibleType,t.accessibleTitle&&null!==t.accessibleTitle?e.title=t.accessibleTitle:t.accessibleHint&&null!==t.accessibleHint||(e.title=`displayObject ${t.tabIndex}`),t.accessibleHint&&null!==t.accessibleHint&&e.setAttribute("aria-label",t.accessibleHint),this.debug&&this.updateDebugHTML(e),t._accessibleActive=!0,t._accessibleDiv=e,e.displayObject=t,this.children.push(t),this.div.appendChild(t._accessibleDiv),t._accessibleDiv.tabIndex=t.tabIndex}_dispatchEvent(t,e){const{displayObject:r}=t.target,i=this.renderer.events.rootBoundary,n=Object.assign(new OF(i),{target:r});i.rootTarget=this.renderer.lastObjectRendered,e.forEach((t=>i.dispatchEvent(n,t)))}_onClick(t){this._dispatchEvent(t,["click","pointertap","tap"])}_onFocus(t){t.target.getAttribute("aria-live")||t.target.setAttribute("aria-live","assertive"),this._dispatchEvent(t,["mouseover"])}_onFocusOut(t){t.target.getAttribute("aria-live")||t.target.setAttribute("aria-live","polite"),this._dispatchEvent(t,["mouseout"])}_onKeyDown(t){9===t.keyCode&&this.activate()}_onMouseMove(t){0===t.movementX&&0===t.movementY||this.deactivate()}destroy(){this.destroyTouchHook(),this.div=null,globalThis.document.removeEventListener("mousemove",this._onMouseMove,!0),globalThis.removeEventListener("keydown",this._onKeyDown),this.pool=null,this.children=null,this.renderer=null}}WF.extension={name:"accessibility",type:[Ik.RendererPlugin,Ik.CanvasRendererPlugin]},kk.add(WF);const XF=class{constructor(t){this.stage=new qN,t=Object.assign({forceCanvas:!1},t),this.renderer=yN(t),XF._plugins.forEach((e=>{e.init.call(this,t)}))}render(){this.renderer.render(this.stage)}get view(){return this.renderer.view}get screen(){return this.renderer.screen}destroy(t,e){const r=XF._plugins.slice(0);r.reverse(),r.forEach((t=>{t.destroy.call(this)})),this.stage.destroy(e),this.stage=null,this.renderer.destroy(t),this.renderer=null}};let zF=XF;zF._plugins=[],kk.handleByList(Ik.Application,zF._plugins);class YF{static init(t){Object.defineProperty(this,"resizeTo",{set(t){globalThis.removeEventListener("resize",this.queueResize),this._resizeTo=t,t&&(globalThis.addEventListener("resize",this.queueResize),this.resize())},get(){return this._resizeTo}}),this.queueResize=()=>{this._resizeTo&&(this.cancelResize(),this._resizeId=requestAnimationFrame((()=>this.resize())))},this.cancelResize=()=>{this._resizeId&&(cancelAnimationFrame(this._resizeId),this._resizeId=null)},this.resize=()=>{if(!this._resizeTo)return;let t,e;if(this.cancelResize(),this._resizeTo===globalThis.window)t=globalThis.innerWidth,e=globalThis.innerHeight;else{const{clientWidth:r,clientHeight:i}=this._resizeTo;t=r,e=i}this.renderer.resize(t,e),this.render()},this._resizeId=null,this._resizeTo=null,this.resizeTo=t.resizeTo||null}static destroy(){globalThis.removeEventListener("resize",this.queueResize),this.cancelResize(),this.cancelResize=null,this.queueResize=null,this.resizeTo=null,this.resize=null}}YF.extension=Ik.Application,kk.add(YF);const ZF={loader:Ik.LoadParser,resolver:Ik.ResolveParser,cache:Ik.CacheParser,detection:Ik.DetectionParser};kk.handle(Ik.Asset,(t=>{const e=t.ref;Object.entries(ZF).filter((([t])=>!!e[t])).forEach((([t,r])=>kk.add(Object.assign(e[t],{extension:e[t].extension??r}))))}),(t=>{const e=t.ref;Object.keys(ZF).filter((t=>!!e[t])).forEach((t=>kk.remove(e[t])))}));class $F{constructor(t,e=!1){this._loader=t,this._assetList=[],this._isLoading=!1,this._maxConcurrent=1,this.verbose=e}add(t){t.forEach((t=>{this._assetList.push(t)})),this.verbose&&console.log("[BackgroundLoader] assets: ",this._assetList),this._isActive&&!this._isLoading&&this._next()}async _next(){if(this._assetList.length&&this._isActive){this._isLoading=!0;const t=[],e=Math.min(this._assetList.length,this._maxConcurrent);for(let r=0;r<e;r++)t.push(this._assetList.pop());await this._loader.load(t),this._isLoading=!1,this._next()}}get active(){return this._isActive}set active(t){this._isActive!==t&&(this._isActive=t,t&&!this._isLoading&&this._next())}}function KF(t,e){if(Array.isArray(e)){for(const r of e)if(t.startsWith(`data:${r}`))return!0;return!1}return t.startsWith(`data:${e}`)}function JF(t,e){const r=t.split("?")[0],i=_O.extname(r).toLowerCase();return Array.isArray(e)?e.includes(i):i===e}const qF=(t,e)=>(Array.isArray(t)||(t=[t]),e?t.map((t=>"string"==typeof t?e(t):t)):t),QF=(t,e)=>{const r=e.split("?")[1];return r&&(t+=`?${r}`),t};function tB(t,e,r,i,n){const s=e[r];for(let o=0;o<s.length;o++){const a=s[o];r<e.length-1?tB(t.replace(i[r],a),e,r+1,i,n):n.push(t.replace(i[r],a))}}function eB(t){const e=t.match(/\{(.*?)\}/g),r=[];if(e){const i=[];e.forEach((t=>{const e=t.substring(1,t.length-1).split(",");i.push(e)})),tB(t,i,0,e,r)}else r.push(t);return r}const rB=t=>!Array.isArray(t);const iB=new class{constructor(){this._parsers=[],this._cache=new Map,this._cacheMap=new Map}reset(){this._cacheMap.clear(),this._cache.clear()}has(t){return this._cache.has(t)}get(t){const e=this._cache.get(t);return e||console.warn(`[Assets] Asset id ${t} was not found in the Cache`),e}set(t,e){const r=qF(t);let i;for(let t=0;t<this.parsers.length;t++){const n=this.parsers[t];if(n.test(e)){i=n.getCacheableAssets(r,e);break}}i||(i={},r.forEach((t=>{i[t]=e})));const n=Object.keys(i),s={cacheKeys:n,keys:r};if(r.forEach((t=>{this._cacheMap.set(t,s)})),n.forEach((t=>{this._cache.has(t)&&this._cache.get(t)!==e&&console.warn("[Cache] already has key:",t),this._cache.set(t,i[t])})),e instanceof mL){const t=e;r.forEach((e=>{t.baseTexture!==mL.EMPTY.baseTexture&&Xk.addToCache(t.baseTexture,e),mL.addToCache(t,e)}))}}remove(t){if(this._cacheMap.get(t),!this._cacheMap.has(t))return void console.warn(`[Assets] Asset id ${t} was not found in the Cache`);const e=this._cacheMap.get(t);e.cacheKeys.forEach((t=>{this._cache.delete(t)})),e.keys.forEach((t=>{this._cacheMap.delete(t)}))}get parsers(){return this._parsers}};class nB{constructor(){this._parsers=[],this._parsersValidated=!1,this.parsers=new Proxy(this._parsers,{set:(t,e,r)=>(this._parsersValidated=!1,t[e]=r,!0)}),this.promiseCache={}}reset(){this._parsersValidated=!1,this.promiseCache={}}_getLoadPromiseAndParser(t,e){const r={promise:null,parser:null};return r.promise=(async()=>{let i=null,n=null;if(e.loadParser&&(n=this._parserHash[e.loadParser],n||console.warn(`[Assets] specified load parser "${e.loadParser}" not found while loading ${t}`)),!n){for(let r=0;r<this.parsers.length;r++){const i=this.parsers[r];if(i.load&&i.test?.(t,e,this)){n=i;break}}if(!n)return console.warn(`[Assets] ${t} could not be loaded as we don't know how to parse it, ensure the correct parser has been added`),null}i=await n.load(t,e,this),r.parser=n;for(let t=0;t<this.parsers.length;t++){const n=this.parsers[t];n.parse&&n.parse&&await(n.testParse?.(i,e,this))&&(i=await n.parse(i,e,this)||i,r.parser=n)}return i})(),r}async load(t,e){this._parsersValidated||this._validateParsers();let r=0;const i={},n=rB(t),s=qF(t,(t=>({src:t}))),o=s.length,a=s.map((async t=>{const n=_O.toAbsolute(t.src);if(!i[t.src])try{this.promiseCache[n]||(this.promiseCache[n]=this._getLoadPromiseAndParser(n,t)),i[t.src]=await this.promiseCache[n].promise,e&&e(++r/o)}catch(e){throw delete this.promiseCache[n],delete i[t.src],new Error(`[Loader.load] Failed to load ${n}.\n${e}`)}}));return await Promise.all(a),n?i[s[0].src]:i}async unload(t){const e=qF(t,(t=>({src:t}))).map((async t=>{const e=_O.toAbsolute(t.src),r=this.promiseCache[e];if(r){const i=await r.promise;r.parser?.unload?.(i,t,this),delete this.promiseCache[e]}}));await Promise.all(e)}_validateParsers(){this._parsersValidated=!0,this._parserHash=this._parsers.filter((t=>t.name)).reduce(((t,e)=>(t[e.name]&&console.warn(`[Assets] loadParser name conflict "${e.name}"`),{...t,[e.name]:e})),{})}}var sB=(t=>(t[t.Low=0]="Low",t[t.Normal=1]="Normal",t[t.High=2]="High",t))(sB||{});const oB={extension:{type:Ik.LoadParser,priority:sB.Low},name:"loadJson",test:t=>KF(t,"application/json")||JF(t,".json"),async load(t){const e=await PR.ADAPTER.fetch(t);return await e.json()}};kk.add(oB);const aB={name:"loadTxt",extension:{type:Ik.LoadParser,priority:sB.Low},test:t=>KF(t,"text/plain")||JF(t,".txt"),async load(t){const e=await PR.ADAPTER.fetch(t);return await e.text()}};kk.add(aB);const hB=["normal","bold","100","200","300","400","500","600","700","800","900"],lB=[".ttf",".otf",".woff",".woff2"],cB=["font/ttf","font/otf","font/woff","font/woff2"],uB=/^(--|-?[A-Z_])[0-9A-Z_-]*$/i;const dB={extension:{type:Ik.LoadParser,priority:sB.Low},name:"loadWebFont",test:t=>KF(t,cB)||JF(t,lB),async load(t,e){const r=PR.ADAPTER.getFontFaceSet();if(r){const i=[],n=e.data?.family??function(t){const e=_O.extname(t),r=_O.basename(t,e).replace(/(-|_)/g," ").toLowerCase().split(" ").map((t=>t.charAt(0).toUpperCase()+t.slice(1)));let i=r.length>0;for(const t of r)if(!t.match(uB)){i=!1;break}let n=r.join(" ");return i||(n=`"${n.replace(/[\\"]/g,"\\$&")}"`),n}(t),s=e.data?.weights?.filter((t=>hB.includes(t)))??["normal"],o=e.data??{};for(let e=0;e<s.length;e++){const a=s[e],h=new FontFace(n,`url(${encodeURI(t)})`,{...o,weight:a});await h.load(),r.add(h),i.push(h)}return 1===i.length?i[0]:i}return console.warn("[loadWebFont] FontFace API is not supported. Skipping loading font"),null},unload(t){(Array.isArray(t)?t:[t]).forEach((t=>PR.ADAPTER.getFontFaceSet().delete(t)))}};kk.add(dB);let pB,fB=0;const mB={id:"checkImageBitmap",code:"\n    async function checkImageBitmap()\n    {\n        try\n        {\n            if (typeof createImageBitmap !== 'function') return false;\n\n            const response = await fetch('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mP8/x8AAwMCAO+ip1sAAAAASUVORK5CYII=');\n            const imageBlob =  await response.blob();\n            const imageBitmap = await createImageBitmap(imageBlob);\n\n            return imageBitmap.width === 1 && imageBitmap.height === 1;\n        }\n        catch (e)\n        {\n            return false;\n        }\n    }\n    checkImageBitmap().then((result) => { self.postMessage(result); });\n    "},gB={id:"loadImageBitmap",code:"\n    async function loadImageBitmap(url)\n    {\n        const response = await fetch(url);\n\n        if (!response.ok)\n        {\n            throw new Error(`[WorkerManager.loadImageBitmap] Failed to fetch ${url}: `\n                + `${response.status} ${response.statusText}`);\n        }\n\n        const imageBlob =  await response.blob();\n        const imageBitmap = await createImageBitmap(imageBlob);\n\n        return imageBitmap;\n    }\n    self.onmessage = async (event) =>\n    {\n        try\n        {\n            const imageBitmap = await loadImageBitmap(event.data.data[0]);\n\n            self.postMessage({\n                data: imageBitmap,\n                uuid: event.data.uuid,\n                id: event.data.id,\n            }, [imageBitmap]);\n        }\n        catch(e)\n        {\n            self.postMessage({\n                error: e,\n                uuid: event.data.uuid,\n                id: event.data.id,\n            });\n        }\n    };"};let vB;const yB=new class{constructor(){this._initialized=!1,this._createdWorkers=0,this.workerPool=[],this.queue=[],this.resolveHash={}}isImageBitmapSupported(){return void 0!==this._isImageBitmapSupported||(this._isImageBitmapSupported=new Promise((t=>{const e=URL.createObjectURL(new Blob([mB.code],{type:"application/javascript"})),r=new Worker(e);r.addEventListener("message",(i=>{r.terminate(),URL.revokeObjectURL(e),t(i.data)}))}))),this._isImageBitmapSupported}loadImageBitmap(t){return this._run("loadImageBitmap",[t])}async _initWorkers(){this._initialized||(this._initialized=!0)}getWorker(){void 0===pB&&(pB=navigator.hardwareConcurrency||4);let t=this.workerPool.pop();return!t&&this._createdWorkers<pB&&(vB||(vB=URL.createObjectURL(new Blob([gB.code],{type:"application/javascript"}))),this._createdWorkers++,t=new Worker(vB),t.addEventListener("message",(t=>{this.complete(t.data),this.returnWorker(t.target),this.next()}))),t}returnWorker(t){this.workerPool.push(t)}complete(t){void 0!==t.error?this.resolveHash[t.uuid].reject(t.error):this.resolveHash[t.uuid].resolve(t.data),this.resolveHash[t.uuid]=null}async _run(t,e){await this._initWorkers();const r=new Promise(((r,i)=>{this.queue.push({id:t,arguments:e,resolve:r,reject:i})}));return this.next(),r}next(){if(!this.queue.length)return;const t=this.getWorker();if(!t)return;const e=this.queue.pop(),r=e.id;this.resolveHash[fB]={resolve:e.resolve,reject:e.reject},t.postMessage({data:e.arguments,uuid:fB++,id:r})}};function bB(t,e,r){const i=new mL(t);return i.baseTexture.on("dispose",(()=>{delete e.promiseCache[r]})),i}const _B=[".jpeg",".jpg",".png",".webp",".avif"],xB=["image/jpeg","image/png","image/webp","image/avif"];const TB={name:"loadTextures",extension:{type:Ik.LoadParser,priority:sB.High},config:{preferWorkers:!0,preferCreateImageBitmap:!0,crossOrigin:"anonymous"},test:t=>KF(t,xB)||JF(t,_B),async load(t,e,r){let i=null;i=globalThis.createImageBitmap&&this.config.preferCreateImageBitmap?this.config.preferWorkers&&await yB.isImageBitmapSupported()?await yB.loadImageBitmap(t):await async function(t){const e=await PR.ADAPTER.fetch(t);if(!e.ok)throw new Error(`[loadImageBitmap] Failed to fetch ${t}: ${e.status} ${e.statusText}`);const r=await e.blob();return await createImageBitmap(r)}(t):await new Promise((e=>{i=new Image,i.crossOrigin=this.config.crossOrigin,i.src=t,i.complete?e(i):i.onload=()=>{e(i)}}));const n=new Xk(i,{resolution:Rk(t),...e.data});return n.resource.src=t,bB(n,r,t)},unload(t){t.destroy(!0)}};kk.add(TB);const wB={extension:{type:Ik.LoadParser,priority:sB.High},name:"loadSVG",test:t=>KF(t,"image/svg+xml")||JF(t,".svg"),testParse:async t=>ON.test(t),async parse(t,e,r){const i=new ON(t,e?.data?.resourceOptions);await i.load();const n=new Xk(i,{resolution:Rk(t),...e?.data});n.resource.src=t;return bB(n,r,t)},load:async(t,e)=>(await PR.ADAPTER.fetch(t)).text(),unload:TB.unload};kk.add(wB);class SB{constructor(){this._defaultBundleIdentifierOptions={connector:"-",createBundleAssetId:(t,e)=>`${t}${this._bundleIdConnector}${e}`,extractAssetIdFromBundle:(t,e)=>e.replace(`${t}${this._bundleIdConnector}`,"")},this._bundleIdConnector=this._defaultBundleIdentifierOptions.connector,this._createBundleAssetId=this._defaultBundleIdentifierOptions.createBundleAssetId,this._extractAssetIdFromBundle=this._defaultBundleIdentifierOptions.extractAssetIdFromBundle,this._assetMap={},this._preferredOrder=[],this._parsers=[],this._resolverHash={},this._bundles={}}setBundleIdentifier(t){if(this._bundleIdConnector=t.connector??this._bundleIdConnector,this._createBundleAssetId=t.createBundleAssetId??this._createBundleAssetId,this._extractAssetIdFromBundle=t.extractAssetIdFromBundle??this._extractAssetIdFromBundle,"bar"!==this._extractAssetIdFromBundle("foo",this._createBundleAssetId("foo","bar")))throw new Error("[Resolver] GenerateBundleAssetId are not working correctly")}prefer(...t){t.forEach((t=>{this._preferredOrder.push(t),t.priority||(t.priority=Object.keys(t.params))})),this._resolverHash={}}set basePath(t){this._basePath=t}get basePath(){return this._basePath}set rootPath(t){this._rootPath=t}get rootPath(){return this._rootPath}get parsers(){return this._parsers}reset(){this.setBundleIdentifier(this._defaultBundleIdentifierOptions),this._assetMap={},this._preferredOrder=[],this._resolverHash={},this._rootPath=null,this._basePath=null,this._manifest=null,this._bundles={},this._defaultSearchParams=null}setDefaultSearchParams(t){if("string"==typeof t)this._defaultSearchParams=t;else{const e=t;this._defaultSearchParams=Object.keys(e).map((t=>`${encodeURIComponent(t)}=${encodeURIComponent(e[t])}`)).join("&")}}addManifest(t){this._manifest&&console.warn("[Resolver] Manifest already exists, this will be overwritten"),this._manifest=t,t.bundles.forEach((t=>{this.addBundle(t.name,t.assets)}))}addBundle(t,e){const r=[];Array.isArray(e)?e.forEach((e=>{if("string"==typeof e.name){const i=this._createBundleAssetId(t,e.name);r.push(i),this.add([e.name,i],e.srcs,e.data)}else{const i=e.name.map((e=>this._createBundleAssetId(t,e)));i.forEach((t=>{r.push(t)})),this.add([...e.name,...i],e.srcs)}})):Object.keys(e).forEach((i=>{r.push(this._createBundleAssetId(t,i)),this.add([i,this._createBundleAssetId(t,i)],e[i])})),this._bundles[t]=r}add(t,e,r){const i=qF(t);i.forEach((t=>{this.hasKey(t)&&console.warn(`[Resolver] already has key: ${t} overwriting`)})),Array.isArray(e)||(e="string"==typeof e?eB(e):[e]);const n=e.map((t=>{let e=t;if("string"==typeof t){let r=!1;for(let i=0;i<this._parsers.length;i++){const n=this._parsers[i];if(n.test(t)){e=n.parse(t),r=!0;break}}r||(e={src:t})}return e.format||(e.format=e.src.split(".").pop()),e.alias||(e.alias=i),(this._basePath||this._rootPath)&&(e.src=_O.toAbsolute(e.src,this._basePath,this._rootPath)),e.src=this._appendDefaultSearchParams(e.src),e.data=e.data??r,e}));i.forEach((t=>{this._assetMap[t]=n}))}resolveBundle(t){const e=rB(t);t=qF(t);const r={};return t.forEach((t=>{const e=this._bundles[t];if(e){const i=this.resolve(e),n={};for(const e in i){const r=i[e];n[this._extractAssetIdFromBundle(t,e)]=r}r[t]=n}})),e?r[t[0]]:r}resolveUrl(t){const e=this.resolve(t);if("string"!=typeof t){const t={};for(const r in e)t[r]=e[r].src;return t}return e.src}resolve(t){const e=rB(t);t=qF(t);const r={};return t.forEach((t=>{if(!this._resolverHash[t])if(this._assetMap[t]){let e=this._assetMap[t];const r=this._getPreferredOrder(e),i=e[0];r?.priority.forEach((t=>{r.params[t].forEach((r=>{const i=e.filter((e=>!!e[t]&&e[t]===r));i.length&&(e=i)}))})),this._resolverHash[t]=e[0]??i}else{let e=t;(this._basePath||this._rootPath)&&(e=_O.toAbsolute(e,this._basePath,this._rootPath)),e=this._appendDefaultSearchParams(e),this._resolverHash[t]={src:e}}r[t]=this._resolverHash[t]})),e?r[t[0]]:r}hasKey(t){return!!this._assetMap[t]}hasBundle(t){return!!this._bundles[t]}_getPreferredOrder(t){for(let e=0;e<t.length;e++){const e=t[0],r=this._preferredOrder.find((t=>t.params.format.includes(e.format)));if(r)return r}return this._preferredOrder[0]}_appendDefaultSearchParams(t){if(!this._defaultSearchParams)return t;return`${t}${/\?/.test(t)?"&":"?"}${this._defaultSearchParams}`}}const EB=new class{constructor(){this._detections=[],this._initialized=!1,this.resolver=new SB,this.loader=new nB,this.cache=iB,this._backgroundLoader=new $F(this.loader),this._backgroundLoader.active=!0,this.reset()}async init(t={}){if(this._initialized)return void console.warn("[Assets]AssetManager already initialized, did you load before calling this Asset.init()?");if(this._initialized=!0,t.defaultSearchParams&&this.resolver.setDefaultSearchParams(t.defaultSearchParams),t.basePath&&(this.resolver.basePath=t.basePath),t.bundleIdentifier&&this.resolver.setBundleIdentifier(t.bundleIdentifier),t.manifest){let e=t.manifest;"string"==typeof e&&(e=await this.load(e)),this.resolver.addManifest(e)}const e=t.texturePreference?.resolution??1,r="number"==typeof e?[e]:e;let i=[];if(t.texturePreference?.format){const e=t.texturePreference?.format;i="string"==typeof e?[e]:e;for(const t of this._detections)await t.test()||(i=await t.remove(i))}else for(const t of this._detections)await t.test()&&(i=await t.add(i));this.resolver.prefer({params:{format:i,resolution:r}}),t.preferences&&this.setPreferences(t.preferences)}add(t,e,r){this.resolver.add(t,e,r)}async load(t,e){this._initialized||await this.init();const r=rB(t),i=qF(t).map((t=>"string"!=typeof t?(this.resolver.add(t.src,t),t.src):(this.resolver.hasKey(t)||this.resolver.add(t,t),t))),n=this.resolver.resolve(i),s=await this._mapLoadToResolve(n,e);return r?s[i[0]]:s}addBundle(t,e){this.resolver.addBundle(t,e)}async loadBundle(t,e){this._initialized||await this.init();let r=!1;"string"==typeof t&&(r=!0,t=[t]);const i=this.resolver.resolveBundle(t),n={},s=Object.keys(i);let o=0,a=0;const h=()=>{e?.(++o/a)},l=s.map((t=>{const e=i[t];return a+=Object.keys(e).length,this._mapLoadToResolve(e,h).then((e=>{n[t]=e}))}));return await Promise.all(l),r?n[t[0]]:n}async backgroundLoad(t){this._initialized||await this.init(),"string"==typeof t&&(t=[t]);const e=this.resolver.resolve(t);this._backgroundLoader.add(Object.values(e))}async backgroundLoadBundle(t){this._initialized||await this.init(),"string"==typeof t&&(t=[t]);const e=this.resolver.resolveBundle(t);Object.values(e).forEach((t=>{this._backgroundLoader.add(Object.values(t))}))}reset(){this.resolver.reset(),this.loader.reset(),this.cache.reset(),this._initialized=!1}get(t){if("string"==typeof t)return iB.get(t);const e={};for(let r=0;r<t.length;r++)e[r]=iB.get(t[r]);return e}async _mapLoadToResolve(t,e){const r=Object.values(t),i=Object.keys(t);this._backgroundLoader.active=!1;const n=await this.loader.load(r,e);this._backgroundLoader.active=!0;const s={};return r.forEach(((t,e)=>{const r=n[t.src],o=[t.src];t.alias&&o.push(...t.alias),s[i[e]]=r,iB.set(o,r)})),s}async unload(t){this._initialized||await this.init();const e=qF(t).map((t=>"string"!=typeof t?t.src:t)),r=this.resolver.resolve(e);await this._unloadFromResolved(r)}async unloadBundle(t){this._initialized||await this.init(),t=qF(t);const e=this.resolver.resolveBundle(t),r=Object.keys(e).map((t=>this._unloadFromResolved(e[t])));await Promise.all(r)}async _unloadFromResolved(t){const e=Object.values(t);e.forEach((t=>{iB.remove(t.src)})),await this.loader.unload(e)}get detections(){return this._detections}get preferWorkers(){return TB.config.preferWorkers}set preferWorkers(t){TO("7.2.0","Assets.prefersWorkers is deprecated, use Assets.setPreferences({ preferWorkers: true }) instead."),this.setPreferences({preferWorkers:t})}setPreferences(t){this.loader.parsers.forEach((e=>{e.config&&Object.keys(e.config).filter((e=>e in t)).forEach((r=>{e.config[r]=t[r]}))}))}};kk.handleByList(Ik.LoadParser,EB.loader.parsers).handleByList(Ik.ResolveParser,EB.resolver.parsers).handleByList(Ik.CacheParser,EB.cache.parsers).handleByList(Ik.DetectionParser,EB.detections);const CB={extension:Ik.CacheParser,test:t=>Array.isArray(t)&&t.every((t=>t instanceof mL)),getCacheableAssets:(t,e)=>{const r={};return t.forEach((t=>{e.forEach(((e,i)=>{r[t+(0===i?"":i+1)]=e}))})),r}};kk.add(CB);const AB={extension:{type:Ik.DetectionParser,priority:1},test:async()=>{if(!globalThis.createImageBitmap)return!1;const t=await PR.ADAPTER.fetch("data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAAB0AAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAIAAAACAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQ0MAAAAABNjb2xybmNseAACAAIAAYAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAACVtZGF0EgAKCBgANogQEAwgMg8f8D///8WfhwB8+ErK42A=").then((t=>t.blob()));return createImageBitmap(t).then((()=>!0),(()=>!1))},add:async t=>[...t,"avif"],remove:async t=>t.filter((t=>"avif"!==t))};kk.add(AB);const RB={extension:{type:Ik.DetectionParser,priority:0},test:async()=>{if(!globalThis.createImageBitmap)return!1;const t=await PR.ADAPTER.fetch("data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAAAAAAfQ//73v/+BiOh/AAA=").then((t=>t.blob()));return createImageBitmap(t).then((()=>!0),(()=>!1))},add:async t=>[...t,"webp"],remove:async t=>t.filter((t=>"webp"!==t))};kk.add(RB);const PB=["png","jpg","jpeg"],IB={extension:{type:Ik.DetectionParser,priority:-1},test:()=>Promise.resolve(!0),add:async t=>[...t,...PB],remove:async t=>t.filter((t=>!PB.includes(t)))};kk.add(IB);const MB={extension:Ik.ResolveParser,test:TB.test,parse:t=>({resolution:parseFloat(PR.RETINA_PREFIX.exec(t)?.[1]??"1"),format:t.split(".").pop(),src:t})};kk.add(MB);var OB=(t=>(t[t.COMPRESSED_RGB_S3TC_DXT1_EXT=33776]="COMPRESSED_RGB_S3TC_DXT1_EXT",t[t.COMPRESSED_RGBA_S3TC_DXT1_EXT=33777]="COMPRESSED_RGBA_S3TC_DXT1_EXT",t[t.COMPRESSED_RGBA_S3TC_DXT3_EXT=33778]="COMPRESSED_RGBA_S3TC_DXT3_EXT",t[t.COMPRESSED_RGBA_S3TC_DXT5_EXT=33779]="COMPRESSED_RGBA_S3TC_DXT5_EXT",t[t.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT=35917]="COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT",t[t.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT=35918]="COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT",t[t.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT=35919]="COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT",t[t.COMPRESSED_SRGB_S3TC_DXT1_EXT=35916]="COMPRESSED_SRGB_S3TC_DXT1_EXT",t[t.COMPRESSED_R11_EAC=37488]="COMPRESSED_R11_EAC",t[t.COMPRESSED_SIGNED_R11_EAC=37489]="COMPRESSED_SIGNED_R11_EAC",t[t.COMPRESSED_RG11_EAC=37490]="COMPRESSED_RG11_EAC",t[t.COMPRESSED_SIGNED_RG11_EAC=37491]="COMPRESSED_SIGNED_RG11_EAC",t[t.COMPRESSED_RGB8_ETC2=37492]="COMPRESSED_RGB8_ETC2",t[t.COMPRESSED_RGBA8_ETC2_EAC=37496]="COMPRESSED_RGBA8_ETC2_EAC",t[t.COMPRESSED_SRGB8_ETC2=37493]="COMPRESSED_SRGB8_ETC2",t[t.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC=37497]="COMPRESSED_SRGB8_ALPHA8_ETC2_EAC",t[t.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2=37494]="COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2",t[t.COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2=37495]="COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2",t[t.COMPRESSED_RGB_PVRTC_4BPPV1_IMG=35840]="COMPRESSED_RGB_PVRTC_4BPPV1_IMG",t[t.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG=35842]="COMPRESSED_RGBA_PVRTC_4BPPV1_IMG",t[t.COMPRESSED_RGB_PVRTC_2BPPV1_IMG=35841]="COMPRESSED_RGB_PVRTC_2BPPV1_IMG",t[t.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG=35843]="COMPRESSED_RGBA_PVRTC_2BPPV1_IMG",t[t.COMPRESSED_RGB_ETC1_WEBGL=36196]="COMPRESSED_RGB_ETC1_WEBGL",t[t.COMPRESSED_RGB_ATC_WEBGL=35986]="COMPRESSED_RGB_ATC_WEBGL",t[t.COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL=35986]="COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL",t[t.COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL=34798]="COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL",t[t.COMPRESSED_RGBA_ASTC_4x4_KHR=37808]="COMPRESSED_RGBA_ASTC_4x4_KHR",t))(OB||{});const kB={33776:.5,33777:.5,33778:1,33779:1,35916:.5,35917:.5,35918:1,35919:1,37488:.5,37489:.5,37490:1,37491:1,37492:.5,37496:1,37493:.5,37497:1,37494:.5,37495:.5,35840:.5,35842:.5,35841:.25,35843:.25,36196:.5,35986:.5,35986:1,34798:1,37808:1};let DB,LB;function NB(){LB={s3tc:DB.getExtension("WEBGL_compressed_texture_s3tc"),s3tc_sRGB:DB.getExtension("WEBGL_compressed_texture_s3tc_srgb"),etc:DB.getExtension("WEBGL_compressed_texture_etc"),etc1:DB.getExtension("WEBGL_compressed_texture_etc1"),pvrtc:DB.getExtension("WEBGL_compressed_texture_pvrtc")||DB.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc"),atc:DB.getExtension("WEBGL_compressed_texture_atc"),astc:DB.getExtension("WEBGL_compressed_texture_astc")}}const FB={extension:{type:Ik.DetectionParser,priority:2},test:async()=>{const t=PR.ADAPTER.createCanvas().getContext("webgl");return t?(DB=t,!0):(console.warn("WebGL not available for compressed textures."),!1)},add:async t=>{LB||NB();const e=[];for(const t in LB){LB[t]&&e.push(t)}return[...e,...t]},remove:async t=>(LB||NB(),t.filter((t=>!(t in LB))))};kk.add(FB);class BB extends Vk{constructor(t,e={width:1,height:1,autoLoad:!0}){let r,i;"string"==typeof t?(r=t,i=new Uint8Array):(r=null,i=t),super(i,e),this.origin=r,this.buffer=i?new Dk(i):null,this._load=null,this.loaded=!1,null!==this.origin&&!1!==e.autoLoad&&this.load(),null===this.origin&&this.buffer&&(this._load=Promise.resolve(this),this.loaded=!0,this.onBlobLoaded(this.buffer.rawBinaryData))}onBlobLoaded(t){}load(){return this._load||(this._load=fetch(this.origin).then((t=>t.blob())).then((t=>t.arrayBuffer())).then((t=>(this.data=new Uint32Array(t),this.buffer=new Dk(t),this.loaded=!0,this.onBlobLoaded(t),this.update(),this)))),this._load}}class UB extends BB{constructor(t,e){super(t,e),this.format=e.format,this.levels=e.levels||1,this._width=e.width,this._height=e.height,this._extension=UB._formatToExtension(this.format),(e.levelBuffers||this.buffer)&&(this._levelBuffers=e.levelBuffers||UB._createLevelBuffers(t instanceof Uint8Array?t:this.buffer.uint8View,this.format,this.levels,4,4,this.width,this.height))}upload(t,e,r){const i=t.gl;if(!t.context.extensions[this._extension])throw new Error(`${this._extension} textures are not supported on the current machine`);if(!this._levelBuffers)return!1;for(let t=0,e=this.levels;t<e;t++){const{levelID:e,levelWidth:r,levelHeight:n,levelBuffer:s}=this._levelBuffers[t];i.compressedTexImage2D(i.TEXTURE_2D,e,this.format,r,n,0,s)}return!0}onBlobLoaded(){this._levelBuffers=UB._createLevelBuffers(this.buffer.uint8View,this.format,this.levels,4,4,this.width,this.height)}static _formatToExtension(t){if(t>=33776&&t<=33779)return"s3tc";if(t>=37488&&t<=37497)return"etc";if(t>=35840&&t<=35843)return"pvrtc";if(t>=36196)return"etc1";if(t>=35986&&t<=34798)return"atc";throw new Error("Invalid (compressed) texture format given!")}static _createLevelBuffers(t,e,r,i,n,s,o){const a=new Array(r);let h=t.byteOffset,l=s,c=o,u=l+i-1&~(i-1),d=c+n-1&~(n-1),p=u*d*kB[e];for(let s=0;s<r;s++)a[s]={levelID:s,levelWidth:r>1?l:u,levelHeight:r>1?c:d,levelBuffer:new Uint8Array(t.buffer,h,p)},h+=p,l=l>>1||1,c=c>>1||1,u=l+i-1&~(i-1),d=c+n-1&~(n-1),p=u*d*kB[e];return a}}const GB=124,jB=3,VB=4,HB=7,WB=19,XB=2,zB=0,YB=1,ZB=2,$B=3,KB={827611204:OB.COMPRESSED_RGBA_S3TC_DXT1_EXT,861165636:OB.COMPRESSED_RGBA_S3TC_DXT3_EXT,894720068:OB.COMPRESSED_RGBA_S3TC_DXT5_EXT},JB={70:OB.COMPRESSED_RGBA_S3TC_DXT1_EXT,71:OB.COMPRESSED_RGBA_S3TC_DXT1_EXT,73:OB.COMPRESSED_RGBA_S3TC_DXT3_EXT,74:OB.COMPRESSED_RGBA_S3TC_DXT3_EXT,76:OB.COMPRESSED_RGBA_S3TC_DXT5_EXT,77:OB.COMPRESSED_RGBA_S3TC_DXT5_EXT,72:OB.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT,75:OB.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT,78:OB.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT};const qB=[171,75,84,88,32,49,49,187,13,10,26,10],QB=12,tU=16,eU=24,rU=28,iU=36,nU=40,sU=44,oU=48,aU=52,hU=56,lU=60,cU={[gR.UNSIGNED_BYTE]:1,[gR.UNSIGNED_SHORT]:2,[gR.INT]:4,[gR.UNSIGNED_INT]:4,[gR.FLOAT]:4,[gR.HALF_FLOAT]:8},uU={[fR.RGBA]:4,[fR.RGB]:3,[fR.RG]:2,[fR.RED]:1,[fR.LUMINANCE]:1,[fR.LUMINANCE_ALPHA]:2,[fR.ALPHA]:1},dU={[gR.UNSIGNED_SHORT_4_4_4_4]:2,[gR.UNSIGNED_SHORT_5_5_5_1]:2,[gR.UNSIGNED_SHORT_5_6_5]:2};function pU(t,e,r=!1){const i=new DataView(e);if(!function(t,e){for(let r=0;r<qB.length;r++)if(e.getUint8(r)!==qB[r])return console.error(`${t} is not a valid *.ktx file!`),!1;return!0}(t,i))return null;const n=67305985===i.getUint32(QB,!0),s=i.getUint32(tU,n),o=i.getUint32(eU,n),a=i.getUint32(rU,n),h=i.getUint32(iU,n),l=i.getUint32(nU,n)||1,c=i.getUint32(sU,n)||1,u=i.getUint32(oU,n)||1,d=i.getUint32(aU,n),p=i.getUint32(hU,n),f=i.getUint32(lU,n);if(0===l||1!==c)throw new Error("Only 2D textures are supported");if(1!==d)throw new Error("CubeTextures are not supported by KTXLoader yet!");if(1!==u)throw new Error("WebGL does not support array textures");const m=h+3&-4,g=l+3&-4,v=new Array(u);let y,b=h*l;if(0===s&&(b=m*g),y=0!==s?cU[s]?cU[s]*uU[o]:dU[s]:kB[a],void 0===y)throw new Error("Unable to resolve the pixel format stored in the *.ktx file!");const _=r?function(t,e,r){const i=new Map;let n=0;for(;n<e;){const s=t.getUint32(64+n,r),o=64+n+4,a=3-(s+3)%4;if(0===s||s>e-n){console.error("KTXLoader: keyAndValueByteSize out of bounds");break}let h=0;for(;h<s&&0!==t.getUint8(o+h);h++);if(-1===h){console.error("KTXLoader: Failed to find null byte terminating kvData key");break}const l=(new TextDecoder).decode(new Uint8Array(t.buffer,o,h)),c=new DataView(t.buffer,o+h+1,s-h-1);i.set(l,c),n+=4+s+a}return i}(i,f,n):null;let x=b*y,T=h,w=l,S=m,E=g,C=64+f;for(let t=0;t<p;t++){const r=i.getUint32(C,n);let o=C+4;for(let r=0;r<u;r++){let i=v[r];i||(i=v[r]=new Array(p)),i[t]={levelID:t,levelWidth:p>1||0!==s?T:S,levelHeight:p>1||0!==s?w:E,levelBuffer:new Uint8Array(e,o,x)},o+=x}C+=r+4,C=C%4!=0?C+4-C%4:C,T=T>>1||1,w=w>>1||1,S=T+4-1&-4,E=w+4-1&-4,x=S*E*y}return 0!==s?{uncompressed:v.map((t=>{let e=t[0].levelBuffer,r=!1;return s===gR.FLOAT?e=new Float32Array(t[0].levelBuffer.buffer,t[0].levelBuffer.byteOffset,t[0].levelBuffer.byteLength/4):s===gR.UNSIGNED_INT?(r=!0,e=new Uint32Array(t[0].levelBuffer.buffer,t[0].levelBuffer.byteOffset,t[0].levelBuffer.byteLength/4)):s===gR.INT&&(r=!0,e=new Int32Array(t[0].levelBuffer.buffer,t[0].levelBuffer.byteOffset,t[0].levelBuffer.byteLength/4)),{resource:new Vk(e,{width:t[0].levelWidth,height:t[0].levelHeight}),type:s,format:r?fU(o):o}})),kvData:_}:{compressed:v.map((t=>new UB(null,{format:a,width:h,height:l,levels:p,levelBuffers:t}))),kvData:_}}function fU(t){switch(t){case fR.RGBA:return fR.RGBA_INTEGER;case fR.RGB:return fR.RGB_INTEGER;case fR.RG:return fR.RG_INTEGER;case fR.RED:return fR.RED_INTEGER;default:return t}}const mU={extension:{type:Ik.LoadParser,priority:sB.High},name:"loadDDS",test:t=>JF(t,".dds"),async load(t,e,r){const i=await PR.ADAPTER.fetch(t),n=function(t){const e=new Uint32Array(t);if(542327876!==e[0])throw new Error("Invalid DDS file magic word");const r=new Uint32Array(t,0,GB/Uint32Array.BYTES_PER_ELEMENT),i=r[jB],n=r[VB],s=r[HB],o=new Uint32Array(t,WB*Uint32Array.BYTES_PER_ELEMENT,32/Uint32Array.BYTES_PER_ELEMENT),a=o[1];if(4&a){const r=o[XB];if(808540228!==r){const e=KB[r],o=new Uint8Array(t,128);return[new UB(o,{format:e,width:n,height:i,levels:s})]}const a=128,h=new Uint32Array(e.buffer,a,20/Uint32Array.BYTES_PER_ELEMENT),l=h[zB],c=h[YB],u=h[ZB],d=h[$B],p=JB[l];if(void 0===p)throw new Error(`DDSParser cannot parse texture data with DXGI format ${l}`);if(4===u)throw new Error("DDSParser does not support cubemap textures");if(6===c)throw new Error("DDSParser does not supported 3D texture data");const f=new Array,m=148;if(1===d)f.push(new Uint8Array(t,m));else{const e=kB[p];let r=0,o=n,a=i;for(let t=0;t<s;t++)r+=Math.max(1,o+3&-4)*Math.max(1,a+3&-4)*e,o>>>=1,a>>>=1;let h=m;for(let e=0;e<d;e++)f.push(new Uint8Array(t,h,r)),h+=r}return f.map((t=>new UB(t,{format:p,width:n,height:i,levels:s})))}if(64&a)throw new Error("DDSParser does not support uncompressed texture data.");if(512&a)throw new Error("DDSParser does not supported YUV uncompressed texture data.");if(131072&a)throw new Error("DDSParser does not support single-channel (lumninance) texture data!");if(2&a)throw new Error("DDSParser does not support single-channel (alpha) texture data!");throw new Error("DDSParser failed to load a texture file due to an unknown reason!")}(await i.arrayBuffer()),s=n.map((i=>bB(new Xk(i,{mipmap:_R.OFF,alphaMode:xR.NO_PREMULTIPLIED_ALPHA,resolution:Rk(t),...e.data}),r,t)));return 1===s.length?s[0]:s},unload(t){Array.isArray(t)?t.forEach((t=>t.destroy(!0))):t.destroy(!0)}};kk.add(mU);const gU={extension:{type:Ik.LoadParser,priority:sB.High},name:"loadKTX",test:t=>JF(t,".ktx"),async load(t,e,r){const i=await PR.ADAPTER.fetch(t),n=await i.arrayBuffer(),{compressed:s,uncompressed:o,kvData:a}=pU(t,n),h=s??o,l={mipmap:_R.OFF,alphaMode:xR.NO_PREMULTIPLIED_ALPHA,resolution:Rk(t),...e.data},c=h.map((e=>{h===o&&Object.assign(l,{type:e.type,format:e.format});const i=new Xk(e,l);return i.ktxKeyValueData=a,bB(i,r,t)}));return 1===c.length?c[0]:c},unload(t){Array.isArray(t)?t.forEach((t=>t.destroy(!0))):t.destroy(!0)}};kk.add(gU);const vU={extension:Ik.ResolveParser,test:t=>{const e=t.split("?")[0].split(".").pop();return["basis","ktx","dds"].includes(e)},parse:t=>{if("ktx"===t.split("?")[0].split(".").pop()){const e=[".s3tc.ktx",".s3tc_sRGB.ktx",".etc.ktx",".etc1.ktx",".pvrt.ktx",".atc.ktx",".astc.ktx"];if(e.some((e=>t.endsWith(e))))return{resolution:parseFloat(PR.RETINA_PREFIX.exec(t)?.[1]??"1"),format:e.find((e=>t.endsWith(e))),src:t}}return{resolution:parseFloat(PR.RETINA_PREFIX.exec(t)?.[1]??"1"),format:t.split(".").pop(),src:t}}};kk.add(vU);const yU=new hD,bU=class{constructor(t){this.renderer=t}async image(t,e,r){const i=new Image;return i.src=await this.base64(t,e,r),i}async base64(t,e,r){const i=this.canvas(t);if(void 0!==i.toBlob)return new Promise(((t,n)=>{i.toBlob((e=>{if(!e)return void n(new Error("ICanvas.toBlob failed!"));const r=new FileReader;r.onload=()=>t(r.result),r.onerror=n,r.readAsDataURL(e)}),e,r)}));if(void 0!==i.toDataURL)return i.toDataURL(e,r);if(void 0!==i.convertToBlob){const t=await i.convertToBlob({type:e,quality:r});return new Promise(((e,r)=>{const i=new FileReader;i.onload=()=>e(i.result),i.onerror=r,i.readAsDataURL(t)}))}throw new Error("Extract.base64() requires ICanvas.toDataURL, ICanvas.toBlob, or ICanvas.convertToBlob to be implemented")}canvas(t,e){const{pixels:r,width:i,height:n,flipY:s}=this._rawPixels(t,e);s&&bU._flipY(r,i,n),bU._unpremultiplyAlpha(r);const o=new xk(i,n,1),a=new ImageData(new Uint8ClampedArray(r.buffer),i,n);return o.context.putImageData(a,0,0),o.canvas}pixels(t,e){const{pixels:r,width:i,height:n,flipY:s}=this._rawPixels(t,e);return s&&bU._flipY(r,i,n),bU._unpremultiplyAlpha(r),r}_rawPixels(t,e){const r=this.renderer;if(!r)throw new Error("The Extract has already been destroyed");let i,n,s=!1,o=!1;if(t&&(t instanceof gL?n=t:(n=r.generateTexture(t,{resolution:r.resolution,multisample:r.multisample}),o=!0)),n){if(i=n.baseTexture.resolution,e=e??n.frame,s=!1,!o){r.renderTexture.bind(n);const t=n.framebuffer.glFramebuffers[r.CONTEXT_UID];t.blitFramebuffer&&r.framebuffer.bind(t.blitFramebuffer)}}else i=r.resolution,e||((e=yU).width=r.width/i,e.height=r.height/i),s=!0,r.renderTexture.bind();const a=Math.round(e.width*i),h=Math.round(e.height*i),l=new Uint8Array(4*a*h),c=r.gl;return c.readPixels(Math.round(e.x*i),Math.round(e.y*i),a,h,c.RGBA,c.UNSIGNED_BYTE,l),o&&n?.destroy(!0),{pixels:l,width:a,height:h,flipY:s}}destroy(){this.renderer=null}static _flipY(t,e,r){const i=e<<2,n=r>>1,s=new Uint8Array(i);for(let e=0;e<n;e++){const n=e*i,o=(r-e-1)*i;s.set(t.subarray(n,n+i)),t.copyWithin(n,o,o+i),t.set(s,o)}}static _unpremultiplyAlpha(t){t instanceof Uint8ClampedArray&&(t=new Uint8Array(t.buffer));const e=t.length;for(let r=0;r<e;r+=4){const e=t[r+3];if(0!==e){const i=255.001/e;t[r]=t[r]*i+.5,t[r+1]=t[r+1]*i+.5,t[r+2]=t[r+2]*i+.5}}}};let _U=bU;_U.extension={name:"extract",type:Ik.RendererSystem},kk.add(_U);const xU={build(t){const e=t.points;let r,i,n,s,o,a;if(t.type===sD.CIRC){const e=t.shape;r=e.x,i=e.y,o=a=e.radius,n=s=0}else if(t.type===sD.ELIP){const e=t.shape;r=e.x,i=e.y,o=e.width,a=e.height,n=s=0}else{const e=t.shape,h=e.width/2,l=e.height/2;r=e.x+h,i=e.y+l,o=a=Math.max(0,Math.min(e.radius,Math.min(h,l))),n=h-o,s=l-a}if(!(o>=0&&a>=0&&n>=0&&s>=0))return void(e.length=0);const h=Math.ceil(2.3*Math.sqrt(o+a)),l=8*h+(n?4:0)+(s?4:0);if(e.length=l,0===l)return;if(0===h)return e.length=8,e[0]=e[6]=r+n,e[1]=e[3]=i+s,e[2]=e[4]=r-n,void(e[5]=e[7]=i-s);let c=0,u=4*h+(n?2:0)+2,d=u,p=l;{const t=n+o,a=s,h=r+t,l=r-t,f=i+a;if(e[c++]=h,e[c++]=f,e[--u]=f,e[--u]=l,s){const t=i-a;e[d++]=l,e[d++]=t,e[--p]=t,e[--p]=h}}for(let t=1;t<h;t++){const l=Math.PI/2*(t/h),f=n+Math.cos(l)*o,m=s+Math.sin(l)*a,g=r+f,v=r-f,y=i+m,b=i-m;e[c++]=g,e[c++]=y,e[--u]=y,e[--u]=v,e[d++]=v,e[d++]=b,e[--p]=b,e[--p]=g}{const t=s+a,o=r+n,h=r-n,l=i+t,u=i-t;e[c++]=o,e[c++]=l,e[--p]=u,e[--p]=o,n&&(e[c++]=h,e[c++]=l,e[--p]=u,e[--p]=h)}},triangulate(t,e){const r=t.points,i=e.points,n=e.indices;if(0===r.length)return;let s=i.length/2;const o=s;let a,h;if(t.type!==sD.RREC){const e=t.shape;a=e.x,h=e.y}else{const e=t.shape;a=e.x+e.width/2,h=e.y+e.height/2}const l=t.matrix;i.push(t.matrix?l.a*a+l.c*h+l.tx:a,t.matrix?l.b*a+l.d*h+l.ty:h),s++,i.push(r[0],r[1]);for(let t=2;t<r.length;t+=2)i.push(r[t],r[t+1]),n.push(s++,o,s);n.push(o+1,o,s)}};function TU(t,e=!1){const r=t.length;if(r<6)return;let i=0;for(let e=0,n=t[r-2],s=t[r-1];e<r;e+=2){const r=t[e],o=t[e+1];i+=(r-n)*(o+s),n=r,s=o}if(!e&&i>0||e&&i<=0){const e=r/2;for(let i=e+e%2;i<r;i+=2){const e=r-i-2,n=r-i-1,s=i,o=i+1;[t[e],t[s]]=[t[s],t[e]],[t[n],t[o]]=[t[o],t[n]]}}}const wU={build(t){t.points=t.shape.points.slice()},triangulate(t,e){let r=t.points;const i=t.holes,n=e.points,s=e.indices;if(r.length>=6){TU(r,!1);const t=[];for(let e=0;e<i.length;e++){const n=i[e];TU(n.points,!0),t.push(r.length/2),r=r.concat(n.points)}const e=wP(r,t,2);if(!e)return;const o=n.length/2;for(let t=0;t<e.length;t+=3)s.push(e[t]+o),s.push(e[t+1]+o),s.push(e[t+2]+o);for(let t=0;t<r.length;t++)n.push(r[t])}}},SU={build(t){const e=t.shape,r=e.x,i=e.y,n=e.width,s=e.height,o=t.points;o.length=0,n>=0&&s>=0&&o.push(r,i,r+n,i,r+n,i+s,r,i+s)},triangulate(t,e){const r=t.points,i=e.points;if(0===r.length)return;const n=i.length/2;i.push(r[0],r[1],r[2],r[3],r[6],r[7],r[4],r[5]),e.indices.push(n,n+1,n+2,n+1,n+2,n+3)}},EU={build(t){xU.build(t)},triangulate(t,e){xU.triangulate(t,e)}};var CU=(t=>(t.MITER="miter",t.BEVEL="bevel",t.ROUND="round",t))(CU||{}),AU=(t=>(t.BUTT="butt",t.ROUND="round",t.SQUARE="square",t))(AU||{});const RU={adaptive:!0,maxLength:10,minSegments:8,maxSegments:2048,epsilon:1e-4,_segmentsCount(t,e=20){if(!this.adaptive||!t||isNaN(t))return e;let r=Math.ceil(t/this.maxLength);return r<this.minSegments?r=this.minSegments:r>this.maxSegments&&(r=this.maxSegments),r}};class PU{static curveTo(t,e,r,i,n,s){const o=s[s.length-2],a=s[s.length-1]-e,h=o-t,l=i-e,c=r-t,u=Math.abs(a*c-h*l);if(u<1e-8||0===n)return s[s.length-2]===t&&s[s.length-1]===e||s.push(t,e),null;const d=a*a+h*h,p=l*l+c*c,f=a*l+h*c,m=n*Math.sqrt(d)/u,g=n*Math.sqrt(p)/u,v=m*f/d,y=g*f/p,b=m*c+g*h,_=m*l+g*a,x=h*(g+v),T=a*(g+v),w=c*(m+y),S=l*(m+y);return{cx:b+t,cy:_+e,radius:n,startAngle:Math.atan2(T-_,x-b),endAngle:Math.atan2(S-_,w-b),anticlockwise:h*l>c*a}}static arc(t,e,r,i,n,s,o,a,h){const l=o-s,c=RU._segmentsCount(Math.abs(l)*n,40*Math.ceil(Math.abs(l)/rD)),u=l/(2*c),d=2*u,p=Math.cos(u),f=Math.sin(u),m=c-1,g=m%1/m;for(let t=0;t<=m;++t){const e=u+s+d*(t+g*t),o=Math.cos(e),a=-Math.sin(e);h.push((p*o+f*a)*n+r,(p*-a+f*o)*n+i)}}}class IU{constructor(){this.reset()}begin(t,e,r){this.reset(),this.style=t,this.start=e,this.attribStart=r}end(t,e){this.attribSize=e-this.attribStart,this.size=t-this.start}reset(){this.style=null,this.size=0,this.start=0,this.attribStart=0,this.attribSize=0}}class MU{static curveLength(t,e,r,i,n,s,o,a){let h=0,l=0,c=0,u=0,d=0,p=0,f=0,m=0,g=0,v=0,y=0,b=t,_=e;for(let x=1;x<=10;++x)l=x/10,c=l*l,u=c*l,d=1-l,p=d*d,f=p*d,m=f*t+3*p*l*r+3*d*c*n+u*o,g=f*e+3*p*l*i+3*d*c*s+u*a,v=b-m,y=_-g,b=m,_=g,h+=Math.sqrt(v*v+y*y);return h}static curveTo(t,e,r,i,n,s,o){const a=o[o.length-2],h=o[o.length-1];o.length-=2;const l=RU._segmentsCount(MU.curveLength(a,h,t,e,r,i,n,s));let c=0,u=0,d=0,p=0,f=0;o.push(a,h);for(let m=1,g=0;m<=l;++m)g=m/l,c=1-g,u=c*c,d=u*c,p=g*g,f=p*g,o.push(d*a+3*u*g*t+3*c*p*r+f*n,d*h+3*u*g*e+3*c*p*i+f*s)}}function OU(t,e,r,i,n,s,o,a){let h,l;o?(h=i,l=-r):(h=-i,l=r);const c=t-r*n+h,u=e-i*n+l,d=t+r*s+h,p=e+i*s+l;return a.push(c,u,d,p),2}function kU(t,e,r,i,n,s,o,a){const h=r-t,l=i-e;let c=Math.atan2(h,l),u=Math.atan2(n-t,s-e);a&&c<u?c+=2*Math.PI:!a&&c>u&&(u+=2*Math.PI);let d=c;const p=u-c,f=Math.abs(p),m=Math.sqrt(h*h+l*l),g=1+(15*f*Math.sqrt(m)/Math.PI>>0),v=p/g;if(d+=v,a){o.push(t,e,r,i);for(let r=1,i=d;r<g;r++,i+=v)o.push(t,e,t+Math.sin(i)*m,e+Math.cos(i)*m);o.push(t,e,n,s)}else{o.push(r,i,t,e);for(let r=1,i=d;r<g;r++,i+=v)o.push(t+Math.sin(i)*m,e+Math.cos(i)*m,t,e);o.push(n,s,t,e)}return 2*g}function DU(t,e){t.lineStyle.native?function(t,e){let r=0;const i=t.shape,n=t.points||i.points,s=i.type!==sD.POLY||i.closeStroke;if(0===n.length)return;const o=e.points,a=e.indices,h=n.length/2,l=o.length/2;let c=l;for(o.push(n[0],n[1]),r=1;r<h;r++)o.push(n[2*r],n[2*r+1]),a.push(c,c+1),c++;s&&a.push(c,l)}(t,e):function(t,e){const r=t.shape;let i=t.points||r.points.slice();const n=e.closePointEps;if(0===i.length)return;const s=t.lineStyle,o=new oD(i[0],i[1]),a=new oD(i[i.length-2],i[i.length-1]),h=r.type!==sD.POLY||r.closeStroke,l=Math.abs(o.x-a.x)<n&&Math.abs(o.y-a.y)<n;if(h){i=i.slice(),l&&(i.pop(),i.pop(),a.set(i[i.length-2],i[i.length-1]));const t=.5*(o.x+a.x),e=.5*(a.y+o.y);i.unshift(t,e),i.push(t,e)}const c=e.points,u=i.length/2;let d=i.length;const p=c.length/2,f=s.width/2,m=f*f,g=s.miterLimit*s.miterLimit;let v=i[0],y=i[1],b=i[2],_=i[3],x=0,T=0,w=-(y-_),S=v-b,E=0,C=0,A=Math.sqrt(w*w+S*S);w/=A,S/=A,w*=f,S*=f;const R=s.alignment,P=2*(1-R),I=2*R;h||(s.cap===AU.ROUND?d+=kU(v-w*(P-I)*.5,y-S*(P-I)*.5,v-w*P,y-S*P,v+w*I,y+S*I,c,!0)+2:s.cap===AU.SQUARE&&(d+=OU(v,y,w,S,P,I,!0,c))),c.push(v-w*P,y-S*P,v+w*I,y+S*I);for(let t=1;t<u-1;++t){v=i[2*(t-1)],y=i[2*(t-1)+1],b=i[2*t],_=i[2*t+1],x=i[2*(t+1)],T=i[2*(t+1)+1],w=-(y-_),S=v-b,A=Math.sqrt(w*w+S*S),w/=A,S/=A,w*=f,S*=f,E=-(_-T),C=b-x,A=Math.sqrt(E*E+C*C),E/=A,C/=A,E*=f,C*=f;const e=b-v,r=y-_,n=b-x,o=T-_,a=e*n+r*o,h=r*n-o*e,l=h<0;if(Math.abs(h)<.001*Math.abs(a)){c.push(b-w*P,_-S*P,b+w*I,_+S*I),a>=0&&(s.join===CU.ROUND?d+=kU(b,_,b-w*P,_-S*P,b-E*P,_-C*P,c,!1)+4:d+=2,c.push(b-E*I,_-C*I,b+E*P,_+C*P));continue}const u=(-w+v)*(-S+_)-(-w+b)*(-S+y),p=(-E+x)*(-C+_)-(-E+b)*(-C+T),R=(e*p-n*u)/h,M=(o*u-r*p)/h,O=(R-b)*(R-b)+(M-_)*(M-_),k=b+(R-b)*P,D=_+(M-_)*P,L=b-(R-b)*I,N=_-(M-_)*I,F=l?P:I,B=O<=Math.min(e*e+r*r,n*n+o*o)+F*F*m;let U=s.join;if(U===CU.MITER&&O/m>g&&(U=CU.BEVEL),B)switch(U){case CU.MITER:c.push(k,D,L,N);break;case CU.BEVEL:l?c.push(k,D,b+w*I,_+S*I,k,D,b+E*I,_+C*I):c.push(b-w*P,_-S*P,L,N,b-E*P,_-C*P,L,N),d+=2;break;case CU.ROUND:l?(c.push(k,D,b+w*I,_+S*I),d+=kU(b,_,b+w*I,_+S*I,b+E*I,_+C*I,c,!0)+4,c.push(k,D,b+E*I,_+C*I)):(c.push(b-w*P,_-S*P,L,N),d+=kU(b,_,b-w*P,_-S*P,b-E*P,_-C*P,c,!1)+4,c.push(b-E*P,_-C*P,L,N))}else{switch(c.push(b-w*P,_-S*P,b+w*I,_+S*I),U){case CU.MITER:l?c.push(L,N,L,N):c.push(k,D,k,D),d+=2;break;case CU.ROUND:d+=l?kU(b,_,b+w*I,_+S*I,b+E*I,_+C*I,c,!0)+2:kU(b,_,b-w*P,_-S*P,b-E*P,_-C*P,c,!1)+2}c.push(b-E*P,_-C*P,b+E*I,_+C*I),d+=2}}v=i[2*(u-2)],y=i[2*(u-2)+1],b=i[2*(u-1)],_=i[2*(u-1)+1],w=-(y-_),S=v-b,A=Math.sqrt(w*w+S*S),w/=A,S/=A,w*=f,S*=f,c.push(b-w*P,_-S*P,b+w*I,_+S*I),h||(s.cap===AU.ROUND?d+=kU(b-w*(P-I)*.5,_-S*(P-I)*.5,b-w*P,_-S*P,b+w*I,_+S*I,c,!1)+2:s.cap===AU.SQUARE&&(d+=OU(b,_,w,S,P,I,!1,c)));const M=e.indices,O=RU.epsilon*RU.epsilon;for(let t=p;t<d+p-2;++t)v=c[2*t],y=c[2*t+1],b=c[2*(t+1)],_=c[2*(t+1)+1],x=c[2*(t+2)],T=c[2*(t+2)+1],Math.abs(v*(_-T)+b*(T-y)+x*(y-_))<O||M.push(t,t+1,t+2)}(t,e)}class LU{static curveLength(t,e,r,i,n,s){const o=t-2*r+n,a=e-2*i+s,h=2*r-2*t,l=2*i-2*e,c=4*(o*o+a*a),u=4*(o*h+a*l),d=h*h+l*l,p=2*Math.sqrt(c+u+d),f=Math.sqrt(c),m=2*c*f,g=2*Math.sqrt(d),v=u/f;return(m*p+f*u*(p-g)+(4*d*c-u*u)*Math.log((2*f+v+p)/(v+g)))/(4*m)}static curveTo(t,e,r,i,n){const s=n[n.length-2],o=n[n.length-1],a=RU._segmentsCount(LU.curveLength(s,o,t,e,r,i));let h=0,l=0;for(let c=1;c<=a;++c){const u=c/a;h=s+(t-s)*u,l=o+(e-o)*u,n.push(h+(t+(r-t)*u-h)*u,l+(e+(i-e)*u-l)*u)}}}const NU={[sD.POLY]:wU,[sD.CIRC]:xU,[sD.ELIP]:xU,[sD.RECT]:SU,[sD.RREC]:EU},FU=[],BU=[];class UU{constructor(t,e=null,r=null,i=null){this.points=[],this.holes=[],this.shape=t,this.lineStyle=r,this.fillStyle=e,this.matrix=i,this.type=t.type}clone(){return new UU(this.shape,this.fillStyle,this.lineStyle,this.matrix)}destroy(){this.shape=null,this.holes.length=0,this.holes=null,this.points.length=0,this.points=null,this.lineStyle=null,this.fillStyle=null}}const GU=new oD,jU=class extends eD{constructor(){super(),this.closePointEps=1e-4,this.boundsPadding=0,this.uvsFloat32=null,this.indicesUint16=null,this.batchable=!1,this.points=[],this.colors=[],this.uvs=[],this.indices=[],this.textureIds=[],this.graphicsData=[],this.drawCalls=[],this.batchDirty=-1,this.batches=[],this.dirty=0,this.cacheDirty=-1,this.clearDirty=0,this.shapeIndex=0,this._bounds=new zN,this.boundsDirty=-1}get bounds(){return this.updateBatches(),this.boundsDirty!==this.dirty&&(this.boundsDirty=this.dirty,this.calculateBounds()),this._bounds}invalidate(){this.boundsDirty=-1,this.dirty++,this.batchDirty++,this.shapeIndex=0,this.points.length=0,this.colors.length=0,this.uvs.length=0,this.indices.length=0,this.textureIds.length=0;for(let t=0;t<this.drawCalls.length;t++)this.drawCalls[t].texArray.clear(),BU.push(this.drawCalls[t]);this.drawCalls.length=0;for(let t=0;t<this.batches.length;t++){const e=this.batches[t];e.reset(),FU.push(e)}this.batches.length=0}clear(){return this.graphicsData.length>0&&(this.invalidate(),this.clearDirty++,this.graphicsData.length=0),this}drawShape(t,e=null,r=null,i=null){const n=new UU(t,e,r,i);return this.graphicsData.push(n),this.dirty++,this}drawHole(t,e=null){if(!this.graphicsData.length)return null;const r=new UU(t,null,null,e),i=this.graphicsData[this.graphicsData.length-1];return r.lineStyle=i.lineStyle,i.holes.push(r),this.dirty++,this}destroy(){super.destroy();for(let t=0;t<this.graphicsData.length;++t)this.graphicsData[t].destroy();this.points.length=0,this.points=null,this.colors.length=0,this.colors=null,this.uvs.length=0,this.uvs=null,this.indices.length=0,this.indices=null,this.indexBuffer.destroy(),this.indexBuffer=null,this.graphicsData.length=0,this.graphicsData=null,this.drawCalls.length=0,this.drawCalls=null,this.batches.length=0,this.batches=null,this._bounds=null}containsPoint(t){const e=this.graphicsData;for(let r=0;r<e.length;++r){const i=e[r];if(i.fillStyle.visible&&(i.shape&&(i.matrix?i.matrix.applyInverse(t,GU):GU.copyFrom(t),i.shape.contains(GU.x,GU.y)))){let t=!1;if(i.holes)for(let e=0;e<i.holes.length;e++){if(i.holes[e].shape.contains(GU.x,GU.y)){t=!0;break}}if(!t)return!0}}return!1}updateBatches(){if(!this.graphicsData.length)return void(this.batchable=!0);if(!this.validateBatching())return;this.cacheDirty=this.dirty;const t=this.uvs,e=this.graphicsData;let r=null,i=null;this.batches.length>0&&(r=this.batches[this.batches.length-1],i=r.style);for(let n=this.shapeIndex;n<e.length;n++){this.shapeIndex++;const s=e[n],o=s.fillStyle,a=s.lineStyle;NU[s.type].build(s),s.matrix&&this.transformPoints(s.points,s.matrix),(o.visible||a.visible)&&this.processHoles(s.holes);for(let e=0;e<2;e++){const n=0===e?o:a;if(!n.visible)continue;const h=n.texture.baseTexture,l=this.indices.length,c=this.points.length/2;h.wrapMode=bR.REPEAT,0===e?this.processFill(s):this.processLine(s);const u=this.points.length/2-c;0!==u&&(r&&!this._compareStyles(i,n)&&(r.end(l,c),r=null),r||(r=FU.pop()||new IU,r.begin(n,l,c),this.batches.push(r),i=n),this.addUvs(this.points,t,n.texture,c,u,n.matrix))}}const n=this.indices.length,s=this.points.length/2;if(r&&r.end(n,s),0===this.batches.length)return void(this.batchable=!0);const o=s>65535;this.indicesUint16&&this.indices.length===this.indicesUint16.length&&o===this.indicesUint16.BYTES_PER_ELEMENT>2?this.indicesUint16.set(this.indices):this.indicesUint16=o?new Uint32Array(this.indices):new Uint16Array(this.indices),this.batchable=this.isBatchable(),this.batchable?this.packBatches():this.buildDrawCalls()}_compareStyles(t,e){return!(!t||!e)&&(t.texture.baseTexture===e.texture.baseTexture&&(t.color+t.alpha===e.color+e.alpha&&!!t.native==!!e.native))}validateBatching(){if(this.dirty===this.cacheDirty||!this.graphicsData.length)return!1;for(let t=0,e=this.graphicsData.length;t<e;t++){const e=this.graphicsData[t],r=e.fillStyle,i=e.lineStyle;if(r&&!r.texture.baseTexture.valid)return!1;if(i&&!i.texture.baseTexture.valid)return!1}return!0}packBatches(){this.batchDirty++,this.uvsFloat32=new Float32Array(this.uvs);const t=this.batches;for(let e=0,r=t.length;e<r;e++){const r=t[e];for(let t=0;t<r.size;t++){const e=r.start+t;this.indicesUint16[e]=this.indicesUint16[e]-r.attribStart}}}isBatchable(){if(this.points.length>131070)return!1;const t=this.batches;for(let e=0;e<t.length;e++)if(t[e].style.native)return!1;return this.points.length<2*jU.BATCHABLE_SIZE}buildDrawCalls(){let t=++Xk._globalBatch;for(let t=0;t<this.drawCalls.length;t++)this.drawCalls[t].texArray.clear(),BU.push(this.drawCalls[t]);this.drawCalls.length=0;const e=this.colors,r=this.textureIds;let i=BU.pop();i||(i=new zk,i.texArray=new JD),i.texArray.count=0,i.start=0,i.size=0,i.type=pR.TRIANGLES;let n=0,s=null,o=0,a=!1,h=pR.TRIANGLES,l=0;this.drawCalls.push(i);for(let c=0;c<this.batches.length;c++){const u=this.batches[c],d=8,p=u.style,f=p.texture.baseTexture;a!==!!p.native&&(a=!!p.native,h=a?pR.LINES:pR.TRIANGLES,s=null,n=d,t++),s!==f&&(s=f,f._batchEnabled!==t&&(n===d&&(t++,n=0,i.size>0&&(i=BU.pop(),i||(i=new zk,i.texArray=new JD),this.drawCalls.push(i)),i.start=l,i.size=0,i.texArray.count=0,i.type=h),f.touched=1,f._batchEnabled=t,f._batchLocation=n,f.wrapMode=bR.REPEAT,i.texArray.elements[i.texArray.count++]=f,n++)),i.size+=u.size,l+=u.size,o=f._batchLocation,this.addColors(e,p.color,p.alpha,u.attribSize,u.attribStart),this.addTextureIds(r,o,u.attribSize,u.attribStart)}Xk._globalBatch=t,this.packAttributes()}packAttributes(){const t=this.points,e=this.uvs,r=this.colors,i=this.textureIds,n=new ArrayBuffer(3*t.length*4),s=new Float32Array(n),o=new Uint32Array(n);let a=0;for(let n=0;n<t.length/2;n++)s[a++]=t[2*n],s[a++]=t[2*n+1],s[a++]=e[2*n],s[a++]=e[2*n+1],o[a++]=r[n],s[a++]=i[n];this._buffer.update(n),this._indexBuffer.update(this.indicesUint16)}processFill(t){if(t.holes.length)wU.triangulate(t,this);else{NU[t.type].triangulate(t,this)}}processLine(t){DU(t,this);for(let e=0;e<t.holes.length;e++)DU(t.holes[e],this)}processHoles(t){for(let e=0;e<t.length;e++){const r=t[e];NU[r.type].build(r),r.matrix&&this.transformPoints(r.points,r.matrix)}}calculateBounds(){const t=this._bounds;t.clear(),t.addVertexData(this.points,0,this.points.length),t.pad(this.boundsPadding,this.boundsPadding)}transformPoints(t,e){for(let r=0;r<t.length/2;r++){const i=t[2*r],n=t[2*r+1];t[2*r]=e.a*i+e.c*n+e.tx,t[2*r+1]=e.b*i+e.d*n+e.ty}}addColors(t,e,r,i,n=0){const s=QO.shared.setValue(e).toLittleEndianNumber(),o=QO.shared.setValue(s).toPremultiplied(r);t.length=Math.max(t.length,n+i);for(let e=0;e<i;e++)t[n+e]=o}addTextureIds(t,e,r,i=0){t.length=Math.max(t.length,i+r);for(let n=0;n<r;n++)t[i+n]=e}addUvs(t,e,r,i,n,s=null){let o=0;const a=e.length,h=r.frame;for(;o<n;){let r=t[2*(i+o)],n=t[2*(i+o)+1];if(s){const t=s.a*r+s.c*n+s.tx;n=s.b*r+s.d*n+s.ty,r=t}o++,e.push(r/h.width,n/h.height)}const l=r.baseTexture;(h.width<l.width||h.height<l.height)&&this.adjustUvs(e,r,a,n)}adjustUvs(t,e,r,i){const n=e.baseTexture,s=1e-6,o=r+2*i,a=e.frame,h=a.width/n.width,l=a.height/n.height;let c=a.x/a.width,u=a.y/a.height,d=Math.floor(t[r]+s),p=Math.floor(t[r+1]+s);for(let e=r+2;e<o;e+=2)d=Math.min(d,Math.floor(t[e]+s)),p=Math.min(p,Math.floor(t[e+1]+s));c-=d,u-=p;for(let e=r;e<o;e+=2)t[e]=(t[e]+c)*h,t[e+1]=(t[e+1]+u)*l}};let VU=jU;VU.BATCHABLE_SIZE=100;class HU{constructor(){this.color=16777215,this.alpha=1,this.texture=mL.WHITE,this.matrix=null,this.visible=!1,this.reset()}clone(){const t=new HU;return t.color=this.color,t.alpha=this.alpha,t.texture=this.texture,t.matrix=this.matrix,t.visible=this.visible,t}reset(){this.color=16777215,this.alpha=1,this.texture=mL.WHITE,this.matrix=null,this.visible=!1}destroy(){this.texture=null,this.matrix=null}}class WU extends HU{constructor(){super(...arguments),this.width=0,this.alignment=.5,this.native=!1,this.cap=AU.BUTT,this.join=CU.MITER,this.miterLimit=10}clone(){const t=new WU;return t.color=this.color,t.alpha=this.alpha,t.texture=this.texture,t.matrix=this.matrix,t.visible=this.visible,t.width=this.width,t.alignment=this.alignment,t.native=this.native,t.cap=this.cap,t.join=this.join,t.miterLimit=this.miterLimit,t}reset(){super.reset(),this.color=0,this.alignment=.5,this.width=0,this.native=!1}}const XU={},zU=class extends qN{constructor(t=null){super(),this.shader=null,this.pluginName="batch",this.currentPath=null,this.batches=[],this.batchTint=-1,this.batchDirty=-1,this.vertexData=null,this._fillStyle=new HU,this._lineStyle=new WU,this._matrix=null,this._holeMode=!1,this.state=Fk.for2d(),this._geometry=t||new VU,this._geometry.refCount++,this._transformID=-1,this._tintColor=new QO(16777215),this.blendMode=dR.NORMAL}get geometry(){return this._geometry}clone(){return this.finishPoly(),new zU(this._geometry)}set blendMode(t){this.state.blendMode=t}get blendMode(){return this.state.blendMode}get tint(){return this._tintColor.value}set tint(t){this._tintColor.setValue(t)}get fill(){return this._fillStyle}get line(){return this._lineStyle}lineStyle(t=null,e=0,r,i=.5,n=!1){return"number"==typeof t&&(t={width:t,color:e,alpha:r,alignment:i,native:n}),this.lineTextureStyle(t)}lineTextureStyle(t){const e={width:0,texture:mL.WHITE,color:t?.texture?16777215:0,matrix:null,alignment:.5,native:!1,cap:AU.BUTT,join:CU.MITER,miterLimit:10};t=Object.assign(e,t),this.normalizeColor(t),this.currentPath&&this.startPoly();const r=t.width>0&&t.alpha>0;return r?(t.matrix&&(t.matrix=t.matrix.clone(),t.matrix.invert()),Object.assign(this._lineStyle,{visible:r},t)):this._lineStyle.reset(),this}startPoly(){if(this.currentPath){const t=this.currentPath.points,e=this.currentPath.points.length;e>2&&(this.drawShape(this.currentPath),this.currentPath=new uD,this.currentPath.closeStroke=!1,this.currentPath.points.push(t[e-2],t[e-1]))}else this.currentPath=new uD,this.currentPath.closeStroke=!1}finishPoly(){this.currentPath&&(this.currentPath.points.length>2?(this.drawShape(this.currentPath),this.currentPath=null):this.currentPath.points.length=0)}moveTo(t,e){return this.startPoly(),this.currentPath.points[0]=t,this.currentPath.points[1]=e,this}lineTo(t,e){this.currentPath||this.moveTo(0,0);const r=this.currentPath.points,i=r[r.length-2],n=r[r.length-1];return i===t&&n===e||r.push(t,e),this}_initCurve(t=0,e=0){this.currentPath?0===this.currentPath.points.length&&(this.currentPath.points=[t,e]):this.moveTo(t,e)}quadraticCurveTo(t,e,r,i){this._initCurve();const n=this.currentPath.points;return 0===n.length&&this.moveTo(0,0),LU.curveTo(t,e,r,i,n),this}bezierCurveTo(t,e,r,i,n,s){return this._initCurve(),MU.curveTo(t,e,r,i,n,s,this.currentPath.points),this}arcTo(t,e,r,i,n){this._initCurve(t,e);const s=this.currentPath.points,o=PU.curveTo(t,e,r,i,n,s);if(o){const{cx:t,cy:e,radius:r,startAngle:i,endAngle:n,anticlockwise:s}=o;this.arc(t,e,r,i,n,s)}return this}arc(t,e,r,i,n,s=!1){if(i===n)return this;!s&&n<=i?n+=rD:s&&i<=n&&(i+=rD);if(0===n-i)return this;const o=t+Math.cos(i)*r,a=e+Math.sin(i)*r,h=this._geometry.closePointEps;let l=this.currentPath?this.currentPath.points:null;if(l){const t=Math.abs(l[l.length-2]-o),e=Math.abs(l[l.length-1]-a);t<h&&e<h||l.push(o,a)}else this.moveTo(o,a),l=this.currentPath.points;return PU.arc(o,a,t,e,r,i,n,s,l),this}beginFill(t=0,e){return this.beginTextureFill({texture:mL.WHITE,color:t,alpha:e})}normalizeColor(t){const e=QO.shared.setValue(t.color??0);t.color=e.toNumber(),t.alpha??(t.alpha=e.alpha)}beginTextureFill(t){const e={texture:mL.WHITE,color:16777215,matrix:null};t=Object.assign(e,t),this.normalizeColor(t),this.currentPath&&this.startPoly();const r=t.alpha>0;return r?(t.matrix&&(t.matrix=t.matrix.clone(),t.matrix.invert()),Object.assign(this._fillStyle,{visible:r},t)):this._fillStyle.reset(),this}endFill(){return this.finishPoly(),this._fillStyle.reset(),this}drawRect(t,e,r,i){return this.drawShape(new hD(t,e,r,i))}drawRoundedRect(t,e,r,i,n){return this.drawShape(new dD(t,e,r,i,n))}drawCircle(t,e,r){return this.drawShape(new lD(t,e,r))}drawEllipse(t,e,r,i){return this.drawShape(new cD(t,e,r,i))}drawPolygon(...t){let e,r=!0;const i=t[0];i.points?(r=i.closeStroke,e=i.points):e=Array.isArray(t[0])?t[0]:t;const n=new uD(e);return n.closeStroke=r,this.drawShape(n),this}drawShape(t){return this._holeMode?this._geometry.drawHole(t,this._matrix):this._geometry.drawShape(t,this._fillStyle.clone(),this._lineStyle.clone(),this._matrix),this}clear(){return this._geometry.clear(),this._lineStyle.reset(),this._fillStyle.reset(),this._boundsID++,this._matrix=null,this._holeMode=!1,this.currentPath=null,this}isFastRect(){const t=this._geometry.graphicsData;return!(1!==t.length||t[0].shape.type!==sD.RECT||t[0].matrix||t[0].holes.length||t[0].lineStyle.visible&&t[0].lineStyle.width)}_render(t){this.finishPoly();const e=this._geometry;e.updateBatches(),e.batchable?(this.batchDirty!==e.batchDirty&&this._populateBatches(),this._renderBatched(t)):(t.batch.flush(),this._renderDirect(t))}_populateBatches(){const t=this._geometry,e=this.blendMode,r=t.batches.length;this.batchTint=-1,this._transformID=-1,this.batchDirty=t.batchDirty,this.batches.length=r,this.vertexData=new Float32Array(t.points);for(let i=0;i<r;i++){const r=t.batches[i],n=r.style.color,s=new Float32Array(this.vertexData.buffer,4*r.attribStart*2,2*r.attribSize),o=new Float32Array(t.uvsFloat32.buffer,4*r.attribStart*2,2*r.attribSize),a={vertexData:s,blendMode:e,indices:new Uint16Array(t.indicesUint16.buffer,2*r.start,r.size),uvs:o,_batchRGB:QO.shared.setValue(n).toRgbArray(),_tintRGB:n,_texture:r.style.texture,alpha:r.style.alpha,worldAlpha:1};this.batches[i]=a}}_renderBatched(t){if(this.batches.length){t.batch.setObjectRenderer(t.plugins[this.pluginName]),this.calculateVertices(),this.calculateTints();for(let e=0,r=this.batches.length;e<r;e++){const r=this.batches[e];r.worldAlpha=this.worldAlpha*r.alpha,t.plugins[this.pluginName].render(r)}}}_renderDirect(t){const e=this._resolveDirectShader(t),r=this._geometry,i=this.worldAlpha,n=e.uniforms,s=r.drawCalls;n.translationMatrix=this.transform.worldTransform,QO.shared.setValue(this._tintColor).premultiply(i).toArray(n.tint),t.shader.bind(e),t.geometry.bind(r,e),t.state.set(this.state);for(let e=0,i=s.length;e<i;e++)this._renderDrawCallDirect(t,r.drawCalls[e])}_renderDrawCallDirect(t,e){const{texArray:r,type:i,size:n,start:s}=e,o=r.count;for(let e=0;e<o;e++)t.texture.bind(r.elements[e],e);t.geometry.draw(i,n,s)}_resolveDirectShader(t){let e=this.shader;const r=this.pluginName;if(!e){if(!XU[r]){const{maxTextures:e}=t.plugins[r],i=new Int32Array(e);for(let t=0;t<e;t++)i[t]=t;const n={tint:new Float32Array([1,1,1,1]),translationMatrix:new pD,default:ZD.from({uSamplers:i},!0)},s=t.plugins[r]._shader.program;XU[r]=new $D(s,n)}e=XU[r]}return e}_calculateBounds(){this.finishPoly();const t=this._geometry;if(!t.graphicsData.length)return;const{minX:e,minY:r,maxX:i,maxY:n}=t.bounds;this._bounds.addFrame(this.transform,e,r,i,n)}containsPoint(t){return this.worldTransform.applyInverse(t,zU._TEMP_POINT),this._geometry.containsPoint(zU._TEMP_POINT)}calculateTints(){if(this.batchTint!==this.tint){this.batchTint=this._tintColor.toNumber();for(let t=0;t<this.batches.length;t++){const e=this.batches[t];e._tintRGB=QO.shared.setValue(this._tintColor).multiply(e._batchRGB).toLittleEndianNumber()}}}calculateVertices(){const t=this.transform._worldID;if(this._transformID===t)return;this._transformID=t;const e=this.transform.worldTransform,r=e.a,i=e.b,n=e.c,s=e.d,o=e.tx,a=e.ty,h=this._geometry.points,l=this.vertexData;let c=0;for(let t=0;t<h.length;t+=2){const e=h[t],u=h[t+1];l[c++]=r*e+n*u+o,l[c++]=s*u+i*e+a}}closePath(){const t=this.currentPath;return t&&(t.closeStroke=!0,this.finishPoly()),this}setMatrix(t){return this._matrix=t,this}beginHole(){return this.finishPoly(),this._holeMode=!0,this}endHole(){return this.finishPoly(),this._holeMode=!1,this}destroy(t){this._geometry.refCount--,0===this._geometry.refCount&&this._geometry.dispose(),this._matrix=null,this.currentPath=null,this._lineStyle.destroy(),this._lineStyle=null,this._fillStyle.destroy(),this._fillStyle=null,this._geometry=null,this.shader=null,this.vertexData=null,this.batches.length=0,this.batches=null,super.destroy(t)}};let YU=zU;YU.curves=RU,YU._TEMP_POINT=new oD;class ZU{constructor(t,e){this.uvBuffer=t,this.uvMatrix=e,this.data=null,this._bufferUpdateId=-1,this._textureUpdateId=-1,this._updateID=0}update(t){if(!t&&this._bufferUpdateId===this.uvBuffer._updateID&&this._textureUpdateId===this.uvMatrix._updateID)return;this._bufferUpdateId=this.uvBuffer._updateID,this._textureUpdateId=this.uvMatrix._updateID;const e=this.uvBuffer.data;this.data&&this.data.length===e.length||(this.data=new Float32Array(e.length)),this.uvMatrix.multiplyUvs(e,this.data),this._updateID++}}const $U=new oD,KU=new uD,JU=class extends qN{constructor(t,e,r,i=pR.TRIANGLES){super(),this.geometry=t,this.shader=e,this.state=r||Fk.for2d(),this.drawMode=i,this.start=0,this.size=0,this.uvs=null,this.indices=null,this.vertexData=new Float32Array(1),this.vertexDirty=-1,this._transformID=-1,this._roundPixels=PR.ROUND_PIXELS,this.batchUvs=null}get geometry(){return this._geometry}set geometry(t){this._geometry!==t&&(this._geometry&&(this._geometry.refCount--,0===this._geometry.refCount&&this._geometry.dispose()),this._geometry=t,this._geometry&&this._geometry.refCount++,this.vertexDirty=-1)}get uvBuffer(){return this.geometry.buffers[1]}get verticesBuffer(){return this.geometry.buffers[0]}set material(t){this.shader=t}get material(){return this.shader}set blendMode(t){this.state.blendMode=t}get blendMode(){return this.state.blendMode}set roundPixels(t){this._roundPixels!==t&&(this._transformID=-1),this._roundPixels=t}get roundPixels(){return this._roundPixels}get tint(){return"tint"in this.shader?this.shader.tint:null}set tint(t){this.shader.tint=t}get tintValue(){return this.shader.tintValue}get texture(){return"texture"in this.shader?this.shader.texture:null}set texture(t){this.shader.texture=t}_render(t){const e=this.geometry.buffers[0].data;this.shader.batchable&&this.drawMode===pR.TRIANGLES&&e.length<2*JU.BATCHABLE_SIZE?this._renderToBatch(t):this._renderDefault(t)}_renderDefault(t){const e=this.shader;e.alpha=this.worldAlpha,e.update&&e.update(),t.batch.flush(),e.uniforms.translationMatrix=this.transform.worldTransform.toArray(!0),t.shader.bind(e),t.state.set(this.state),t.geometry.bind(this.geometry,e),t.geometry.draw(this.drawMode,this.size,this.start,this.geometry.instanceCount)}_renderToBatch(t){const e=this.geometry,r=this.shader;r.uvMatrix&&(r.uvMatrix.update(),this.calculateUvs()),this.calculateVertices(),this.indices=e.indexBuffer.data,this._tintRGB=r._tintRGB,this._texture=r.texture;const i=this.material.pluginName;t.batch.setObjectRenderer(t.plugins[i]),t.plugins[i].render(this)}calculateVertices(){const t=this.geometry.buffers[0],e=t.data,r=t._updateID;if(r===this.vertexDirty&&this._transformID===this.transform._worldID)return;this._transformID=this.transform._worldID,this.vertexData.length!==e.length&&(this.vertexData=new Float32Array(e.length));const i=this.transform.worldTransform,n=i.a,s=i.b,o=i.c,a=i.d,h=i.tx,l=i.ty,c=this.vertexData;for(let t=0;t<c.length/2;t++){const r=e[2*t],i=e[2*t+1];c[2*t]=n*r+o*i+h,c[2*t+1]=s*r+a*i+l}if(this._roundPixels){const t=PR.RESOLUTION;for(let e=0;e<c.length;++e)c[e]=Math.round(c[e]*t)/t}this.vertexDirty=r}calculateUvs(){const t=this.geometry.buffers[1],e=this.shader;e.uvMatrix.isSimple?this.uvs=t.data:(this.batchUvs||(this.batchUvs=new ZU(t,e.uvMatrix)),this.batchUvs.update(),this.uvs=this.batchUvs.data)}_calculateBounds(){this.calculateVertices(),this._bounds.addVertexData(this.vertexData,0,this.vertexData.length)}containsPoint(t){if(!this.getBounds().contains(t.x,t.y))return!1;this.worldTransform.applyInverse(t,$U);const e=this.geometry.getBuffer("aVertexPosition").data,r=KU.points,i=this.geometry.getIndex().data,n=i.length,s=4===this.drawMode?3:1;for(let t=0;t+2<n;t+=s){const n=2*i[t],s=2*i[t+1],o=2*i[t+2];if(r[0]=e[n],r[1]=e[n+1],r[2]=e[s],r[3]=e[s+1],r[4]=e[o],r[5]=e[o+1],KU.contains($U.x,$U.y))return!0}return!1}destroy(t){super.destroy(t),this._cachedTexture&&(this._cachedTexture.destroy(),this._cachedTexture=null),this.geometry=null,this.shader=null,this.state=null,this.uvs=null,this.indices=null,this.vertexData=null}};let qU=JU;qU.BATCHABLE_SIZE=100;class QU extends tD{constructor(t,e,r){super();const i=new Zk(t),n=new Zk(e,!0),s=new Zk(r,!0,!0);this.addAttribute("aVertexPosition",i,2,!1,gR.FLOAT).addAttribute("aTextureCoord",n,2,!1,gR.FLOAT).addIndex(s),this._updateId=-1}get vertexDirtyId(){return this.buffers[0]._updateID}}class tG extends $D{constructor(t,e){const r={uSampler:t,alpha:1,uTextureMatrix:pD.IDENTITY,uColor:new Float32Array([1,1,1,1])};(e=Object.assign({tint:16777215,alpha:1,pluginName:"batch"},e)).uniforms&&Object.assign(r,e.uniforms),super(e.program||zD.from("attribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\n\nuniform mat3 projectionMatrix;\nuniform mat3 translationMatrix;\nuniform mat3 uTextureMatrix;\n\nvarying vec2 vTextureCoord;\n\nvoid main(void)\n{\n    gl_Position = vec4((projectionMatrix * translationMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n\n    vTextureCoord = (uTextureMatrix * vec3(aTextureCoord, 1.0)).xy;\n}\n","varying vec2 vTextureCoord;\nuniform vec4 uColor;\n\nuniform sampler2D uSampler;\n\nvoid main(void)\n{\n    gl_FragColor = texture2D(uSampler, vTextureCoord) * uColor;\n}\n"),r),this._colorDirty=!1,this.uvMatrix=new IL(t),this.batchable=void 0===e.program,this.pluginName=e.pluginName,this._tintColor=new QO(e.tint),this._tintRGB=this._tintColor.toLittleEndianNumber(),this._colorDirty=!0,this.alpha=e.alpha}get texture(){return this.uniforms.uSampler}set texture(t){this.uniforms.uSampler!==t&&(!this.uniforms.uSampler.baseTexture.alphaMode!=!t.baseTexture.alphaMode&&(this._colorDirty=!0),this.uniforms.uSampler=t,this.uvMatrix.texture=t)}set alpha(t){t!==this._alpha&&(this._alpha=t,this._colorDirty=!0)}get alpha(){return this._alpha}set tint(t){t!==this.tint&&(this._tintColor.setValue(t),this._tintRGB=this._tintColor.toLittleEndianNumber(),this._colorDirty=!0)}get tint(){return this._tintColor.value}get tintValue(){return this._tintColor.toNumber()}update(){if(this._colorDirty){this._colorDirty=!1;const t=this.texture.baseTexture.alphaMode;QO.shared.setValue(this._tintColor).premultiply(this._alpha,t).toArray(this.uniforms.uColor)}this.uvMatrix.update()&&(this.uniforms.uTextureMatrix=this.uvMatrix.mapCoord)}}class eG extends QU{constructor(t=100,e=100,r=10,i=10){super(),this.segWidth=r,this.segHeight=i,this.width=t,this.height=e,this.build()}build(){const t=this.segWidth*this.segHeight,e=[],r=[],i=[],n=this.segWidth-1,s=this.segHeight-1,o=this.width/n,a=this.height/s;for(let i=0;i<t;i++){const t=i%this.segWidth,h=i/this.segWidth|0;e.push(t*o,h*a),r.push(t/n,h/s)}const h=n*s;for(let t=0;t<h;t++){const e=t%n,r=t/n|0,s=r*this.segWidth+e,o=r*this.segWidth+e+1,a=(r+1)*this.segWidth+e,h=(r+1)*this.segWidth+e+1;i.push(s,o,a,o,h,a)}this.buffers[0].data=new Float32Array(e),this.buffers[1].data=new Float32Array(r),this.indexBuffer.data=new Uint16Array(i),this.buffers[0].update(),this.buffers[1].update(),this.indexBuffer.update()}}class rG extends QU{constructor(t=200,e,r=0){super(new Float32Array(4*e.length),new Float32Array(4*e.length),new Uint16Array(6*(e.length-1))),this.points=e,this._width=t,this.textureScale=r,this.build()}get width(){return this._width}build(){const t=this.points;if(!t)return;const e=this.getBuffer("aVertexPosition"),r=this.getBuffer("aTextureCoord"),i=this.getIndex();if(t.length<1)return;e.data.length/4!==t.length&&(e.data=new Float32Array(4*t.length),r.data=new Float32Array(4*t.length),i.data=new Uint16Array(6*(t.length-1)));const n=r.data,s=i.data;n[0]=0,n[1]=0,n[2]=0,n[3]=1;let o=0,a=t[0];const h=this._width*this.textureScale,l=t.length;for(let e=0;e<l;e++){const r=4*e;if(this.textureScale>0){const r=a.x-t[e].x,i=a.y-t[e].y,n=Math.sqrt(r*r+i*i);a=t[e],o+=n/h}else o=e/(l-1);n[r]=o,n[r+1]=0,n[r+2]=o,n[r+3]=1}let c=0;for(let t=0;t<l-1;t++){const e=2*t;s[c++]=e,s[c++]=e+1,s[c++]=e+2,s[c++]=e+2,s[c++]=e+1,s[c++]=e+3}r.update(),i.update(),this.updateVertices()}updateVertices(){const t=this.points;if(t.length<1)return;let e,r=t[0],i=0,n=0;const s=this.buffers[0].data,o=t.length,a=this.textureScale>0?this.textureScale*this._width/2:this._width/2;for(let h=0;h<o;h++){const o=t[h],l=4*h;e=h<t.length-1?t[h+1]:o,n=-(e.x-r.x),i=e.y-r.y;const c=Math.sqrt(i*i+n*n);c<1e-6?(i=0,n=0):(i/=c,n/=c,i*=a,n*=a),s[l]=o.x+i,s[l+1]=o.y+n,s[l+2]=o.x-i,s[l+3]=o.y-n,r=o}this.buffers[0].update()}update(){this.textureScale>0?this.build():this.updateVertices()}}class iG extends qU{constructor(t,e,r){super(new eG(t.width,t.height,e,r),new tG(mL.WHITE)),this.texture=t,this.autoResize=!0}textureUpdated(){this._textureID=this.shader.texture._updateID;const t=this.geometry,{width:e,height:r}=this.shader.texture;!this.autoResize||t.width===e&&t.height===r||(t.width=this.shader.texture.width,t.height=this.shader.texture.height,t.build())}set texture(t){this.shader.texture!==t&&(this.shader.texture=t,this._textureID=-1,t.baseTexture.valid?this.textureUpdated():t.once("update",this.textureUpdated,this))}get texture(){return this.shader.texture}_render(t){this._textureID!==this.shader.texture._updateID&&this.textureUpdated(),super._render(t)}destroy(t){this.shader.texture.off("update",this.textureUpdated,this),super.destroy(t)}}class nG extends iG{constructor(t,e,r,i,n){super(mL.WHITE,4,4),this._origWidth=t.orig.width,this._origHeight=t.orig.height,this._width=this._origWidth,this._height=this._origHeight,this._leftWidth=e??t.defaultBorders?.left??10,this._rightWidth=i??t.defaultBorders?.right??10,this._topHeight=r??t.defaultBorders?.top??10,this._bottomHeight=n??t.defaultBorders?.bottom??10,this.texture=t}textureUpdated(){this._textureID=this.shader.texture._updateID,this._refresh()}get vertices(){return this.geometry.getBuffer("aVertexPosition").data}set vertices(t){this.geometry.getBuffer("aVertexPosition").data=t}updateHorizontalVertices(){const t=this.vertices,e=this._getMinScale();t[9]=t[11]=t[13]=t[15]=this._topHeight*e,t[17]=t[19]=t[21]=t[23]=this._height-this._bottomHeight*e,t[25]=t[27]=t[29]=t[31]=this._height}updateVerticalVertices(){const t=this.vertices,e=this._getMinScale();t[2]=t[10]=t[18]=t[26]=this._leftWidth*e,t[4]=t[12]=t[20]=t[28]=this._width-this._rightWidth*e,t[6]=t[14]=t[22]=t[30]=this._width}_getMinScale(){const t=this._leftWidth+this._rightWidth,e=this._width>t?1:this._width/t,r=this._topHeight+this._bottomHeight,i=this._height>r?1:this._height/r;return Math.min(e,i)}get width(){return this._width}set width(t){this._width=t,this._refresh()}get height(){return this._height}set height(t){this._height=t,this._refresh()}get leftWidth(){return this._leftWidth}set leftWidth(t){this._leftWidth=t,this._refresh()}get rightWidth(){return this._rightWidth}set rightWidth(t){this._rightWidth=t,this._refresh()}get topHeight(){return this._topHeight}set topHeight(t){this._topHeight=t,this._refresh()}get bottomHeight(){return this._bottomHeight}set bottomHeight(t){this._bottomHeight=t,this._refresh()}_refresh(){const t=this.texture,e=this.geometry.buffers[1].data;this._origWidth=t.orig.width,this._origHeight=t.orig.height;const r=1/this._origWidth,i=1/this._origHeight;e[0]=e[8]=e[16]=e[24]=0,e[1]=e[3]=e[5]=e[7]=0,e[6]=e[14]=e[22]=e[30]=1,e[25]=e[27]=e[29]=e[31]=1,e[2]=e[10]=e[18]=e[26]=r*this._leftWidth,e[4]=e[12]=e[20]=e[28]=1-r*this._rightWidth,e[9]=e[11]=e[13]=e[15]=i*this._topHeight,e[17]=e[19]=e[21]=e[23]=1-i*this._bottomHeight,this.updateHorizontalVertices(),this.updateVerticalVertices(),this.geometry.buffers[0].update(),this.geometry.buffers[1].update()}}class sG{constructor(t){this.maxItemsPerFrame=t,this.itemsLeft=0}beginFrame(){this.itemsLeft=this.maxItemsPerFrame}allowedToUpload(){return this.itemsLeft-- >0}}function oG(t,e){let r=!1;if(t?._textures?.length)for(let i=0;i<t._textures.length;i++)if(t._textures[i]instanceof mL){const n=t._textures[i].baseTexture;e.includes(n)||(e.push(n),r=!0)}return r}function aG(t,e){if(t.baseTexture instanceof Xk){const r=t.baseTexture;return e.includes(r)||e.push(r),!0}return!1}function hG(t,e){if(t._texture&&t._texture instanceof mL){const r=t._texture.baseTexture;return e.includes(r)||e.push(r),!0}return!1}function lG(t,e){return e instanceof wF&&(e.updateText(!0),!0)}function cG(t,e){if(e instanceof yF){const t=e.toFontString();return mF.measureFont(t),!0}return!1}function uG(t,e){if(t instanceof wF){e.includes(t.style)||e.push(t.style),e.includes(t)||e.push(t);const r=t._texture.baseTexture;return e.includes(r)||e.push(r),!0}return!1}function dG(t,e){return t instanceof yF&&(e.includes(t)||e.push(t),!0)}const pG=class{constructor(t){this.limiter=new sG(pG.uploadsPerFrame),this.renderer=t,this.uploadHookHelper=null,this.queue=[],this.addHooks=[],this.uploadHooks=[],this.completes=[],this.ticking=!1,this.delayedTick=()=>{this.queue&&this.prepareItems()},this.registerFindHook(uG),this.registerFindHook(dG),this.registerFindHook(oG),this.registerFindHook(aG),this.registerFindHook(hG),this.registerUploadHook(lG),this.registerUploadHook(cG)}upload(t){return new Promise((e=>{t&&this.add(t),this.queue.length?(this.completes.push(e),this.ticking||(this.ticking=!0,mN.system.addOnce(this.tick,this,dN.UTILITY))):e()}))}tick(){setTimeout(this.delayedTick,0)}prepareItems(){for(this.limiter.beginFrame();this.queue.length&&this.limiter.allowedToUpload();){const t=this.queue[0];let e=!1;if(t&&!t._destroyed)for(let r=0,i=this.uploadHooks.length;r<i;r++)if(this.uploadHooks[r](this.uploadHookHelper,t)){this.queue.shift(),e=!0;break}e||this.queue.shift()}if(this.queue.length)mN.system.addOnce(this.tick,this,dN.UTILITY);else{this.ticking=!1;const t=this.completes.slice(0);this.completes.length=0;for(let e=0,r=t.length;e<r;e++)t[e]()}}registerFindHook(t){return t&&this.addHooks.push(t),this}registerUploadHook(t){return t&&this.uploadHooks.push(t),this}add(t){for(let e=0,r=this.addHooks.length;e<r&&!this.addHooks[e](t,this.queue);e++);if(t instanceof qN)for(let e=t.children.length-1;e>=0;e--)this.add(t.children[e]);return this}destroy(){this.ticking&&mN.system.remove(this.tick,this),this.ticking=!1,this.addHooks=null,this.uploadHooks=null,this.renderer=null,this.completes=null,this.queue=null,this.limiter=null,this.uploadHookHelper=null}};let fG=pG;function mG(t,e){return e instanceof Xk&&(e._glTextures[t.CONTEXT_UID]||t.texture.bind(e),!0)}function gG(t,e){if(!(e instanceof YU))return!1;const{geometry:r}=e;e.finishPoly(),r.updateBatches();const{batches:i}=r;for(let e=0;e<i.length;e++){const{texture:r}=i[e].style;r&&mG(t,r.baseTexture)}return r.batchable||t.geometry.bind(r,e._resolveDirectShader(t)),!0}function vG(t,e){return t instanceof YU&&(e.push(t),!0)}fG.uploadsPerFrame=4,Object.defineProperties(PR,{UPLOADS_PER_FRAME:{get:()=>fG.uploadsPerFrame,set(t){TO("7.1.0","settings.UPLOADS_PER_FRAME is deprecated, use prepare.BasePrepare.uploadsPerFrame"),fG.uploadsPerFrame=t}}});class yG extends fG{constructor(t){super(t),this.uploadHookHelper=this.renderer,this.registerFindHook(vG),this.registerUploadHook(mG),this.registerUploadHook(gG)}}yG.extension={name:"prepare",type:Ik.RendererSystem},kk.add(yG);const bG=class{constructor(t,e,r=null){this.linkedSheets=[],this._texture=t instanceof mL?t:null,this.baseTexture=t instanceof Xk?t:this._texture.baseTexture,this.textures={},this.animations={},this.data=e;const i=this.baseTexture.resource;this.resolution=this._updateResolution(r||(i?i.url:null)),this._frames=this.data.frames,this._frameKeys=Object.keys(this._frames),this._batchIndex=0,this._callback=null}_updateResolution(t=null){const{scale:e}=this.data.meta;let r=Rk(t,null);return null===r&&(r=parseFloat(e??"1")),1!==r&&this.baseTexture.setResolution(r),r}parse(){return new Promise((t=>{this._callback=t,this._batchIndex=0,this._frameKeys.length<=bG.BATCH_SIZE?(this._processFrames(0),this._processAnimations(),this._parseComplete()):this._nextBatch()}))}_processFrames(t){let e=t;const r=bG.BATCH_SIZE;for(;e-t<r&&e<this._frameKeys.length;){const t=this._frameKeys[e],r=this._frames[t],i=r.frame;if(i){let e=null,n=null;const s=!1!==r.trimmed&&r.sourceSize?r.sourceSize:r.frame,o=new hD(0,0,Math.floor(s.w)/this.resolution,Math.floor(s.h)/this.resolution);e=r.rotated?new hD(Math.floor(i.x)/this.resolution,Math.floor(i.y)/this.resolution,Math.floor(i.h)/this.resolution,Math.floor(i.w)/this.resolution):new hD(Math.floor(i.x)/this.resolution,Math.floor(i.y)/this.resolution,Math.floor(i.w)/this.resolution,Math.floor(i.h)/this.resolution),!1!==r.trimmed&&r.spriteSourceSize&&(n=new hD(Math.floor(r.spriteSourceSize.x)/this.resolution,Math.floor(r.spriteSourceSize.y)/this.resolution,Math.floor(i.w)/this.resolution,Math.floor(i.h)/this.resolution)),this.textures[t]=new mL(this.baseTexture,e,o,n,r.rotated?2:0,r.anchor,r.borders),mL.addToCache(this.textures[t],t)}e++}}_processAnimations(){const t=this.data.animations||{};for(const e in t){this.animations[e]=[];for(let r=0;r<t[e].length;r++){const i=t[e][r];this.animations[e].push(this.textures[i])}}}_parseComplete(){const t=this._callback;this._callback=null,this._batchIndex=0,t.call(this,this.textures)}_nextBatch(){this._processFrames(this._batchIndex*bG.BATCH_SIZE),this._batchIndex++,setTimeout((()=>{this._batchIndex*bG.BATCH_SIZE<this._frameKeys.length?this._nextBatch():(this._processAnimations(),this._parseComplete())}),0)}destroy(t=!1){for(const t in this.textures)this.textures[t].destroy();this._frames=null,this._frameKeys=null,this.data=null,this.textures=null,t&&(this._texture?.destroy(),this.baseTexture.destroy()),this._texture=null,this.baseTexture=null,this.linkedSheets=[]}};let _G=bG;_G.BATCH_SIZE=1e3;const xG=["jpg","png","jpeg","avif","webp"];function TG(t,e,r){const i={};if(t.forEach((t=>{i[t]=e})),Object.keys(e.textures).forEach((t=>{i[t]=e.textures[t]})),!r){const r=_O.dirname(t[0]);e.linkedSheets.forEach(((t,n)=>{const s=TG([`${r}/${e.data.meta.related_multi_packs[n]}`],t,!0);Object.assign(i,s)}))}return i}const wG={extension:Ik.Asset,cache:{test:t=>t instanceof _G,getCacheableAssets:(t,e)=>TG(t,e,!1)},resolver:{test:t=>{const e=t.split("?")[0].split("."),r=e.pop(),i=e.pop();return"json"===r&&xG.includes(i)},parse:t=>{const e=t.split(".");return{resolution:parseFloat(PR.RETINA_PREFIX.exec(t)?.[1]??"1"),format:e[e.length-2],src:t}}},loader:{name:"spritesheetLoader",extension:{type:Ik.LoadParser,priority:sB.Normal},testParse:async(t,e)=>".json"===_O.extname(e.src).toLowerCase()&&!!t.frames,async parse(t,e,r){let i=_O.dirname(e.src);i&&i.lastIndexOf("/")!==i.length-1&&(i+="/");let n=i+t.meta.image;n=QF(n,e.src);const s=(await r.load([n]))[n],o=new _G(s.baseTexture,t,e.src);await o.parse();const a=t?.meta?.related_multi_packs;if(Array.isArray(a)){const t=[];for(const n of a){if("string"!=typeof n)continue;let s=i+n;e.data?.ignoreMultiPack||(s=QF(s,e.src),t.push(r.load({src:s,data:{ignoreMultiPack:!0}})))}const n=await Promise.all(t);o.linkedSheets=n,n.forEach((t=>{t.linkedSheets=[o].concat(o.linkedSheets.filter((e=>e!==t)))}))}return o},unload(t){t.destroy(!0)}}};kk.add(wG);class SG{constructor(){this.info=[],this.common=[],this.page=[],this.char=[],this.kerning=[],this.distanceField=[]}}class EG{static test(t){return"string"==typeof t&&t.startsWith("info face=")}static parse(t){const e=t.match(/^[a-z]+\s+.+$/gm),r={info:[],common:[],page:[],char:[],chars:[],kerning:[],kernings:[],distanceField:[]};for(const t in e){const i=e[t].match(/^[a-z]+/gm)[0],n=e[t].match(/[a-zA-Z]+=([^\s"']+|"([^"]*)")/gm),s={};for(const t in n){const e=n[t].split("="),r=e[0],i=e[1].replace(/"/gm,""),o=parseFloat(i),a=isNaN(o)?i:o;s[r]=a}r[i].push(s)}const i=new SG;return r.info.forEach((t=>i.info.push({face:t.face,size:parseInt(t.size,10)}))),r.common.forEach((t=>i.common.push({lineHeight:parseInt(t.lineHeight,10)}))),r.page.forEach((t=>i.page.push({id:parseInt(t.id,10),file:t.file}))),r.char.forEach((t=>i.char.push({id:parseInt(t.id,10),page:parseInt(t.page,10),x:parseInt(t.x,10),y:parseInt(t.y,10),width:parseInt(t.width,10),height:parseInt(t.height,10),xoffset:parseInt(t.xoffset,10),yoffset:parseInt(t.yoffset,10),xadvance:parseInt(t.xadvance,10)}))),r.kerning.forEach((t=>i.kerning.push({first:parseInt(t.first,10),second:parseInt(t.second,10),amount:parseInt(t.amount,10)}))),r.distanceField.forEach((t=>i.distanceField.push({distanceRange:parseInt(t.distanceRange,10),fieldType:t.fieldType}))),i}}class CG{static test(t){const e=t;return"getElementsByTagName"in e&&e.getElementsByTagName("page").length&&null!==e.getElementsByTagName("info")[0].getAttribute("face")}static parse(t){const e=new SG,r=t.getElementsByTagName("info"),i=t.getElementsByTagName("common"),n=t.getElementsByTagName("page"),s=t.getElementsByTagName("char"),o=t.getElementsByTagName("kerning"),a=t.getElementsByTagName("distanceField");for(let t=0;t<r.length;t++)e.info.push({face:r[t].getAttribute("face"),size:parseInt(r[t].getAttribute("size"),10)});for(let t=0;t<i.length;t++)e.common.push({lineHeight:parseInt(i[t].getAttribute("lineHeight"),10)});for(let t=0;t<n.length;t++)e.page.push({id:parseInt(n[t].getAttribute("id"),10)||0,file:n[t].getAttribute("file")});for(let t=0;t<s.length;t++){const r=s[t];e.char.push({id:parseInt(r.getAttribute("id"),10),page:parseInt(r.getAttribute("page"),10)||0,x:parseInt(r.getAttribute("x"),10),y:parseInt(r.getAttribute("y"),10),width:parseInt(r.getAttribute("width"),10),height:parseInt(r.getAttribute("height"),10),xoffset:parseInt(r.getAttribute("xoffset"),10),yoffset:parseInt(r.getAttribute("yoffset"),10),xadvance:parseInt(r.getAttribute("xadvance"),10)})}for(let t=0;t<o.length;t++)e.kerning.push({first:parseInt(o[t].getAttribute("first"),10),second:parseInt(o[t].getAttribute("second"),10),amount:parseInt(o[t].getAttribute("amount"),10)});for(let t=0;t<a.length;t++)e.distanceField.push({fieldType:a[t].getAttribute("fieldType"),distanceRange:parseInt(a[t].getAttribute("distanceRange"),10)});return e}}class AG{static test(t){return!("string"!=typeof t||!t.includes("<font>"))&&CG.test(PR.ADAPTER.parseXML(t))}static parse(t){return CG.parse(PR.ADAPTER.parseXML(t))}}const RG=[EG,CG,AG];function PG(t,e,r,i,n,s,o){const a=r.text,h=r.fontProperties;e.translate(i,n),e.scale(s,s);const l=o.strokeThickness/2,c=-o.strokeThickness/2;if(e.font=o.toFontString(),e.lineWidth=o.strokeThickness,e.textBaseline=o.textBaseline,e.lineJoin=o.lineJoin,e.miterLimit=o.miterLimit,e.fillStyle=function(t,e,r,i,n,s){const o=r.fill;if(!Array.isArray(o))return o;if(1===o.length)return o[0];let a;const h=r.dropShadow?r.dropShadowDistance:0,l=r.padding||0,c=t.width/i-h-2*l,u=t.height/i-h-2*l,d=o.slice(),p=r.fillGradientStops.slice();if(!p.length){const t=d.length+1;for(let e=1;e<t;++e)p.push(e/t)}if(d.unshift(o[0]),p.unshift(0),d.push(o[o.length-1]),p.push(1),r.fillGradientType===dF.LINEAR_VERTICAL){a=e.createLinearGradient(c/2,l,c/2,u+l);let t=0;const i=(s.fontProperties.fontSize+r.strokeThickness)/u;for(let e=0;e<n.length;e++){const r=s.lineHeight*e;for(let e=0;e<d.length;e++){let n=0;n="number"==typeof p[e]?p[e]:e/d.length;const s=r/u+n*i;let o=Math.max(t,s);o=Math.min(o,1),a.addColorStop(o,d[e]),t=o}}}else{a=e.createLinearGradient(l,u/2,c+l,u/2);const t=d.length+1;let r=1;for(let e=0;e<d.length;e++){let i;i="number"==typeof p[e]?p[e]:r/t,a.addColorStop(i,d[e]),r++}}return a}(t,e,o,s,[a],r),e.strokeStyle=o.stroke,o.dropShadow){const t=o.dropShadowColor,r=o.dropShadowBlur*s,i=o.dropShadowDistance*s;e.shadowColor=QO.shared.setValue(t).setAlpha(o.dropShadowAlpha).toRgbaString(),e.shadowBlur=r,e.shadowOffsetX=Math.cos(o.dropShadowAngle)*i,e.shadowOffsetY=Math.sin(o.dropShadowAngle)*i}else e.shadowColor="black",e.shadowBlur=0,e.shadowOffsetX=0,e.shadowOffsetY=0;o.stroke&&o.strokeThickness&&e.strokeText(a,l,c+r.lineHeight-h.descent),o.fill&&e.fillText(a,l,c+r.lineHeight-h.descent),e.setTransform(1,0,0,1,0,0),e.fillStyle="rgba(0, 0, 0, 0)"}function IG(t){return t.codePointAt?t.codePointAt(0):t.charCodeAt(0)}function MG(t){return Array.from?Array.from(t):t.split("")}const OG=class{constructor(t,e,r){const[i]=t.info,[n]=t.common,[s]=t.page,[o]=t.distanceField,a=Rk(s.file),h={};this._ownsTextures=r,this.font=i.face,this.size=i.size,this.lineHeight=n.lineHeight/a,this.chars={},this.pageTextures=h;for(let r=0;r<t.page.length;r++){const{id:i,file:n}=t.page[r];h[i]=e instanceof Array?e[r]:e[n],o?.fieldType&&"none"!==o.fieldType&&(h[i].baseTexture.alphaMode=xR.NO_PREMULTIPLIED_ALPHA,h[i].baseTexture.mipmap=_R.OFF)}for(let e=0;e<t.char.length;e++){const{id:r,page:i}=t.char[e];let{x:n,y:s,width:o,height:l,xoffset:c,yoffset:u,xadvance:d}=t.char[e];n/=a,s/=a,o/=a,l/=a,c/=a,u/=a,d/=a;const p=new hD(n+h[i].frame.x/a,s+h[i].frame.y/a,o,l);this.chars[r]={xOffset:c,yOffset:u,xAdvance:d,kerning:{},texture:new mL(h[i].baseTexture,p),page:i}}for(let e=0;e<t.kerning.length;e++){let{first:r,second:i,amount:n}=t.kerning[e];r/=a,i/=a,n/=a,this.chars[i]&&(this.chars[i].kerning[r]=n)}this.distanceFieldRange=o?.distanceRange,this.distanceFieldType=o?.fieldType?.toLowerCase()??"none"}destroy(){for(const t in this.chars)this.chars[t].texture.destroy(),this.chars[t].texture=null;for(const t in this.pageTextures)this._ownsTextures&&this.pageTextures[t].destroy(!0),this.pageTextures[t]=null;this.chars=null,this.pageTextures=null}static install(t,e,r){let i;if(t instanceof SG)i=t;else{const e=function(t){for(let e=0;e<RG.length;e++)if(RG[e].test(t))return RG[e];return null}(t);if(!e)throw new Error("Unrecognized data format for font.");i=e.parse(t)}e instanceof mL&&(e=[e]);const n=new OG(i,e,r);return OG.available[n.font]=n,n}static uninstall(t){const e=OG.available[t];if(!e)throw new Error(`No font found named '${t}'`);e.destroy(),delete OG.available[t]}static from(t,e,r){if(!t)throw new Error("[BitmapFont] Property `name` is required.");const{chars:i,padding:n,resolution:s,textureWidth:o,textureHeight:a,...h}=Object.assign({},OG.defaultOptions,r),l=function(t){"string"==typeof t&&(t=[t]);const e=[];for(let r=0,i=t.length;r<i;r++){const i=t[r];if(Array.isArray(i)){if(2!==i.length)throw new Error(`[BitmapFont]: Invalid character range length, expecting 2 got ${i.length}.`);const t=i[0].charCodeAt(0),r=i[1].charCodeAt(0);if(r<t)throw new Error("[BitmapFont]: Invalid character range.");for(let i=t,n=r;i<=n;i++)e.push(String.fromCharCode(i))}else e.push(...MG(i))}if(0===e.length)throw new Error("[BitmapFont]: Empty set when resolving characters.");return e}(i),c=e instanceof yF?e:new yF(e),u=o,d=new SG;d.info[0]={face:c.fontFamily,size:c.fontSize},d.common[0]={lineHeight:c.fontSize};let p,f,m,g=0,v=0,y=0;const b=[];for(let t=0;t<l.length;t++){p||(p=PR.ADAPTER.createCanvas(),p.width=o,p.height=a,f=p.getContext("2d"),m=new Xk(p,{resolution:s,...h}),b.push(new mL(m)),d.page.push({id:b.length-1,file:""}));const e=l[t],r=mF.measureText(e,c,!1,p),i=r.width,_=Math.ceil(r.height),x=Math.ceil(("italic"===c.fontStyle?2:1)*i);if(v>=a-_*s){if(0===v)throw new Error(`[BitmapFont] textureHeight ${a}px is too small (fontFamily: '${c.fontFamily}', fontSize: ${c.fontSize}px, char: '${e}')`);--t,p=null,f=null,m=null,v=0,g=0,y=0;continue}if(y=Math.max(_+r.fontProperties.descent,y),x*s+g>=u){if(0===g)throw new Error(`[BitmapFont] textureWidth ${o}px is too small (fontFamily: '${c.fontFamily}', fontSize: ${c.fontSize}px, char: '${e}')`);--t,v+=y*s,v=Math.ceil(v),g=0,y=0;continue}PG(p,f,r,g,v,s,c);const T=IG(r.text);d.char.push({id:T,page:b.length-1,x:g/s,y:v/s,width:x,height:_,xoffset:0,yoffset:0,xadvance:i-(c.dropShadow?c.dropShadowDistance:0)-(c.stroke?c.strokeThickness:0)}),g+=(x+2*n)*s,g=Math.ceil(g)}for(let t=0,e=l.length;t<e;t++){const r=l[t];for(let t=0;t<e;t++){const e=l[t],i=f.measureText(r).width,n=f.measureText(e).width,s=f.measureText(r+e).width-(i+n);s&&d.kerning.push({first:IG(r),second:IG(e),amount:s})}}const _=new OG(d,b,!0);return void 0!==OG.available[t]&&OG.uninstall(t),OG.available[t]=_,_}};let kG=OG;kG.ALPHA=[["a","z"],["A","Z"]," "],kG.NUMERIC=[["0","9"]],kG.ALPHANUMERIC=[["a","z"],["A","Z"],["0","9"]," "],kG.ASCII=[[" ","~"]],kG.defaultOptions={resolution:1,textureWidth:512,textureHeight:512,padding:4,chars:OG.ALPHANUMERIC},kG.available={};const DG=[],LG=[],NG=[],FG=class extends qN{constructor(t,e={}){super();const{align:r,tint:i,maxWidth:n,letterSpacing:s,fontName:o,fontSize:a}=Object.assign({},FG.styleDefaults,e);if(!kG.available[o])throw new Error(`Missing BitmapFont "${o}"`);this._activePagesMeshData=[],this._textWidth=0,this._textHeight=0,this._align=r,this._tintColor=new QO(i),this._font=void 0,this._fontName=o,this._fontSize=a,this.text=t,this._maxWidth=n,this._maxLineHeight=0,this._letterSpacing=s,this._anchor=new TD((()=>{this.dirty=!0}),this,0,0),this._roundPixels=PR.ROUND_PIXELS,this.dirty=!0,this._resolution=PR.RESOLUTION,this._autoResolution=!0,this._textureCache={}}updateText(){const t=kG.available[this._fontName],e=this.fontSize,r=e/t.size,i=new oD,n=[],s=[],o=[],a=MG(this._text.replace(/(?:\r\n|\r)/g,"\n")||" "),h=this._maxWidth*t.size/e,l="none"===t.distanceFieldType?DG:LG;let c=null,u=0,d=0,p=0,f=-1,m=0,g=0,v=0,y=0;for(let e=0;e<a.length;e++){const r=a[e],l=IG(r);if(/(?:\s)/.test(r)&&(f=e,m=u,y++),"\r"===r||"\n"===r){s.push(u),o.push(-1),d=Math.max(d,u),++p,++g,i.x=0,i.y+=t.lineHeight,c=null,y=0;continue}const b=t.chars[l];if(!b)continue;c&&b.kerning[c]&&(i.x+=b.kerning[c]);const _=NG.pop()||{texture:mL.EMPTY,line:0,charCode:0,prevSpaces:0,position:new oD};_.texture=b.texture,_.line=p,_.charCode=l,_.position.x=Math.round(i.x+b.xOffset+this._letterSpacing/2),_.position.y=Math.round(i.y+b.yOffset),_.prevSpaces=y,n.push(_),u=_.position.x+Math.max(b.xAdvance-b.xOffset,b.texture.orig.width),i.x+=b.xAdvance+this._letterSpacing,v=Math.max(v,b.yOffset+b.texture.height),c=l,-1!==f&&h>0&&i.x>h&&(++g,dk(n,1+f-g,1+e-f),e=f,f=-1,s.push(m),o.push(n.length>0?n[n.length-1].prevSpaces:0),d=Math.max(d,m),p++,i.x=0,i.y+=t.lineHeight,c=null,y=0)}const b=a[a.length-1];"\r"!==b&&"\n"!==b&&(/(?:\s)/.test(b)&&(u=m),s.push(u),d=Math.max(d,u),o.push(-1));const _=[];for(let t=0;t<=p;t++){let e=0;"right"===this._align?e=d-s[t]:"center"===this._align?e=(d-s[t])/2:"justify"===this._align&&(e=o[t]<0?0:(d-s[t])/o[t]),_.push(e)}const x=n.length,T={},w=[],S=this._activePagesMeshData;l.push(...S);for(let e=0;e<x;e++){const r=n[e].texture,i=r.baseTexture.uid;if(!T[i]){let e=l.pop();if(!e){const r=new QU;let i,n;"none"===t.distanceFieldType?(i=new tG(mL.EMPTY),n=dR.NORMAL):(i=new tG(mL.EMPTY,{program:zD.from("// Mesh material default fragment\r\nattribute vec2 aVertexPosition;\r\nattribute vec2 aTextureCoord;\r\n\r\nuniform mat3 projectionMatrix;\r\nuniform mat3 translationMatrix;\r\nuniform mat3 uTextureMatrix;\r\n\r\nvarying vec2 vTextureCoord;\r\n\r\nvoid main(void)\r\n{\r\n    gl_Position = vec4((projectionMatrix * translationMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\r\n\r\n    vTextureCoord = (uTextureMatrix * vec3(aTextureCoord, 1.0)).xy;\r\n}\r\n","// Pixi texture info\r\nvarying vec2 vTextureCoord;\r\nuniform sampler2D uSampler;\r\n\r\n// Tint\r\nuniform vec4 uColor;\r\n\r\n// on 2D applications fwidth is screenScale / glyphAtlasScale * distanceFieldRange\r\nuniform float uFWidth;\r\n\r\nvoid main(void) {\r\n\r\n  // To stack MSDF and SDF we need a non-pre-multiplied-alpha texture.\r\n  vec4 texColor = texture2D(uSampler, vTextureCoord);\r\n\r\n  // MSDF\r\n  float median = texColor.r + texColor.g + texColor.b -\r\n                  min(texColor.r, min(texColor.g, texColor.b)) -\r\n                  max(texColor.r, max(texColor.g, texColor.b));\r\n  // SDF\r\n  median = min(median, texColor.a);\r\n\r\n  float screenPxDistance = uFWidth * (median - 0.5);\r\n  float alpha = clamp(screenPxDistance + 0.5, 0.0, 1.0);\r\n  if (median < 0.01) {\r\n    alpha = 0.0;\r\n  } else if (median > 0.99) {\r\n    alpha = 1.0;\r\n  }\r\n\r\n  // Gamma correction for coverage-like alpha\r\n  float luma = dot(uColor.rgb, vec3(0.299, 0.587, 0.114));\r\n  float gamma = mix(1.0, 1.0 / 2.2, luma);\r\n  float coverage = pow(uColor.a * alpha, gamma);  \r\n\r\n  // NPM Textures, NPM outputs\r\n  gl_FragColor = vec4(uColor.rgb, coverage);\r\n}\r\n"),uniforms:{uFWidth:0}}),n=dR.NORMAL_NPM);const s=new qU(r,i);s.blendMode=n,e={index:0,indexCount:0,vertexCount:0,uvsCount:0,total:0,mesh:s,vertices:null,uvs:null,indices:null}}e.index=0,e.indexCount=0,e.vertexCount=0,e.uvsCount=0,e.total=0;const{_textureCache:n}=this;n[i]=n[i]||new mL(r.baseTexture),e.mesh.texture=n[i],e.mesh.tint=this._tintColor.value,w.push(e),T[i]=e}T[i].total++}for(let t=0;t<S.length;t++)w.includes(S[t])||this.removeChild(S[t].mesh);for(let t=0;t<w.length;t++)w[t].mesh.parent!==this&&this.addChild(w[t].mesh);this._activePagesMeshData=w;for(const t in T){const e=T[t],r=e.total;if(!(e.indices?.length>6*r)||e.vertices.length<2*qU.BATCHABLE_SIZE)e.vertices=new Float32Array(8*r),e.uvs=new Float32Array(8*r),e.indices=new Uint16Array(6*r);else{const t=e.total,r=e.vertices;for(let e=4*t*2;e<r.length;e++)r[e]=0}e.mesh.size=6*r}for(let t=0;t<x;t++){const e=n[t];let i=e.position.x+_[e.line]*("justify"===this._align?e.prevSpaces:1);this._roundPixels&&(i=Math.round(i));const s=i*r,o=e.position.y*r,a=e.texture,h=T[a.baseTexture.uid],l=a.frame,c=a._uvs,u=h.index++;h.indices[6*u+0]=0+4*u,h.indices[6*u+1]=1+4*u,h.indices[6*u+2]=2+4*u,h.indices[6*u+3]=0+4*u,h.indices[6*u+4]=2+4*u,h.indices[6*u+5]=3+4*u,h.vertices[8*u+0]=s,h.vertices[8*u+1]=o,h.vertices[8*u+2]=s+l.width*r,h.vertices[8*u+3]=o,h.vertices[8*u+4]=s+l.width*r,h.vertices[8*u+5]=o+l.height*r,h.vertices[8*u+6]=s,h.vertices[8*u+7]=o+l.height*r,h.uvs[8*u+0]=c.x0,h.uvs[8*u+1]=c.y0,h.uvs[8*u+2]=c.x1,h.uvs[8*u+3]=c.y1,h.uvs[8*u+4]=c.x2,h.uvs[8*u+5]=c.y2,h.uvs[8*u+6]=c.x3,h.uvs[8*u+7]=c.y3}this._textWidth=d*r,this._textHeight=(i.y+t.lineHeight)*r;for(const t in T){const e=T[t];if(0!==this.anchor.x||0!==this.anchor.y){let t=0;const r=this._textWidth*this.anchor.x,i=this._textHeight*this.anchor.y;for(let n=0;n<e.total;n++)e.vertices[t++]-=r,e.vertices[t++]-=i,e.vertices[t++]-=r,e.vertices[t++]-=i,e.vertices[t++]-=r,e.vertices[t++]-=i,e.vertices[t++]-=r,e.vertices[t++]-=i}this._maxLineHeight=v*r;const i=e.mesh.geometry.getBuffer("aVertexPosition"),n=e.mesh.geometry.getBuffer("aTextureCoord"),s=e.mesh.geometry.getIndex();i.data=e.vertices,n.data=e.uvs,s.data=e.indices,i.update(),n.update(),s.update()}for(let t=0;t<n.length;t++)NG.push(n[t]);this._font=t,this.dirty=!1}updateTransform(){this.validate(),this.containerUpdateTransform()}_render(t){this._autoResolution&&this._resolution!==t.resolution&&(this._resolution=t.resolution,this.dirty=!0);const{distanceFieldRange:e,distanceFieldType:r,size:i}=kG.available[this._fontName];if("none"!==r){const{a:r,b:n,c:s,d:o}=this.worldTransform,a=Math.sqrt(r*r+n*n),h=Math.sqrt(s*s+o*o),l=(Math.abs(a)+Math.abs(h))/2,c=this.fontSize/i,u=t._view.resolution;for(const t of this._activePagesMeshData)t.mesh.shader.uniforms.uFWidth=l*e*c*u}super._render(t)}getLocalBounds(){return this.validate(),super.getLocalBounds()}validate(){const t=kG.available[this._fontName];if(!t)throw new Error(`Missing BitmapFont "${this._fontName}"`);this._font!==t&&(this.dirty=!0),this.dirty&&this.updateText()}get tint(){return this._tintColor.value}set tint(t){if(this.tint!==t){this._tintColor.setValue(t);for(let e=0;e<this._activePagesMeshData.length;e++)this._activePagesMeshData[e].mesh.tint=t}}get align(){return this._align}set align(t){this._align!==t&&(this._align=t,this.dirty=!0)}get fontName(){return this._fontName}set fontName(t){if(!kG.available[t])throw new Error(`Missing BitmapFont "${t}"`);this._fontName!==t&&(this._fontName=t,this.dirty=!0)}get fontSize(){return this._fontSize??kG.available[this._fontName].size}set fontSize(t){this._fontSize!==t&&(this._fontSize=t,this.dirty=!0)}get anchor(){return this._anchor}set anchor(t){"number"==typeof t?this._anchor.set(t):this._anchor.copyFrom(t)}get text(){return this._text}set text(t){t=String(null==t?"":t),this._text!==t&&(this._text=t,this.dirty=!0)}get maxWidth(){return this._maxWidth}set maxWidth(t){this._maxWidth!==t&&(this._maxWidth=t,this.dirty=!0)}get maxLineHeight(){return this.validate(),this._maxLineHeight}get textWidth(){return this.validate(),this._textWidth}get letterSpacing(){return this._letterSpacing}set letterSpacing(t){this._letterSpacing!==t&&(this._letterSpacing=t,this.dirty=!0)}get roundPixels(){return this._roundPixels}set roundPixels(t){t!==this._roundPixels&&(this._roundPixels=t,this.dirty=!0)}get textHeight(){return this.validate(),this._textHeight}get resolution(){return this._resolution}set resolution(t){this._autoResolution=!1,this._resolution!==t&&(this._resolution=t,this.dirty=!0)}destroy(t){const{_textureCache:e}=this,r="none"===kG.available[this._fontName].distanceFieldType?DG:LG;r.push(...this._activePagesMeshData);for(const t of this._activePagesMeshData)this.removeChild(t.mesh);this._activePagesMeshData=[],r.filter((t=>e[t.mesh.texture.baseTexture.uid])).forEach((t=>{t.mesh.texture=mL.EMPTY}));for(const t in e){e[t].destroy(),delete e[t]}this._font=null,this._tintColor=null,this._textureCache=null,super.destroy(t)}};FG.styleDefaults={align:"left",tint:16777215,maxWidth:0,letterSpacing:0};const BG=[".xml",".fnt"],UG={extension:{type:Ik.LoadParser,priority:sB.Normal},name:"loadBitmapFont",test:t=>BG.includes(_O.extname(t).toLowerCase()),testParse:async t=>EG.test(t)||AG.test(t),async parse(t,e,r){const i=EG.test(t)?EG.parse(t):AG.parse(t),{src:n}=e,{page:s}=i,o=[];for(let t=0;t<s.length;++t){const e=s[t].file;let r=_O.join(_O.dirname(n),e);r=QF(r,n),o.push(r)}const a=await r.load(o),h=o.map((t=>a[t]));return kG.install(i,h,!0)},load:async(t,e)=>(await PR.ADAPTER.fetch(t)).text(),unload(t){t.destroy()}};kk.add(UG);const GG=class extends yF{constructor(){super(...arguments),this._fonts=[],this._overrides=[],this._stylesheet="",this.fontsDirty=!1}static from(t){return new GG(Object.keys(GG.defaultOptions).reduce(((e,r)=>({...e,[r]:t[r]})),{}))}cleanFonts(){this._fonts.length>0&&(this._fonts.forEach((t=>{URL.revokeObjectURL(t.src),t.refs--,0===t.refs&&(t.fontFace&&document.fonts.delete(t.fontFace),delete GG.availableFonts[t.originalUrl])})),this.fontFamily="Arial",this._fonts.length=0,this.styleID++,this.fontsDirty=!0)}loadFont(t,e={}){const{availableFonts:r}=GG;if(r[t]){const e=r[t];return this._fonts.push(e),e.refs++,this.styleID++,this.fontsDirty=!0,Promise.resolve()}return PR.ADAPTER.fetch(t).then((t=>t.blob())).then((async t=>new Promise(((e,r)=>{const i=URL.createObjectURL(t),n=new FileReader;n.onload=()=>e([i,n.result]),n.onerror=r,n.readAsDataURL(t)})))).then((async([i,n])=>{const s=Object.assign({family:_O.basename(t,_O.extname(t)),weight:"normal",style:"normal",src:i,dataSrc:n,refs:1,originalUrl:t,fontFace:null},e);r[t]=s,this._fonts.push(s),this.styleID++;const o=new FontFace(s.family,`url(${s.src})`,{weight:s.weight,style:s.style});s.fontFace=o,await o.load(),document.fonts.add(o),await document.fonts.ready,this.styleID++,this.fontsDirty=!0}))}addOverride(...t){const e=t.filter((t=>!this._overrides.includes(t)));e.length>0&&(this._overrides.push(...e),this.styleID++)}removeOverride(...t){const e=t.filter((t=>this._overrides.includes(t)));e.length>0&&(this._overrides=this._overrides.filter((t=>!e.includes(t))),this.styleID++)}toCSS(t){return[`transform: scale(${t})`,"transform-origin: top left","display: inline-block",`color: ${this.normalizeColor(this.fill)}`,`font-size: ${this.fontSize}px`,`font-family: ${this.fontFamily}`,`font-weight: ${this.fontWeight}`,`font-style: ${this.fontStyle}`,`font-variant: ${this.fontVariant}`,`letter-spacing: ${this.letterSpacing}px`,`text-align: ${this.align}`,`padding: ${this.padding}px`,`white-space: ${this.whiteSpace}`,...this.lineHeight?[`line-height: ${this.lineHeight}px`]:[],...this.wordWrap?["word-wrap: "+(this.breakWords?"break-all":"break-word"),`max-width: ${this.wordWrapWidth}px`]:[],...this.strokeThickness?[`-webkit-text-stroke-width: ${this.strokeThickness}px`,`-webkit-text-stroke-color: ${this.normalizeColor(this.stroke)}`,`text-stroke-width: ${this.strokeThickness}px`,`text-stroke-color: ${this.normalizeColor(this.stroke)}`,"paint-order: stroke"]:[],...this.dropShadow?[this.dropShadowToCSS()]:[],...this._overrides].join(";")}toGlobalCSS(){return this._fonts.reduce(((t,e)=>`${t}\n            @font-face {\n                font-family: "${e.family}";\n                src: url('${e.dataSrc}');\n                font-weight: ${e.weight};\n                font-style: ${e.style}; \n            }`),this._stylesheet)}get stylesheet(){return this._stylesheet}set stylesheet(t){this._stylesheet!==t&&(this._stylesheet=t,this.styleID++)}normalizeColor(t){return Array.isArray(t)&&(t=rk(t)),"number"==typeof t?tk(t):t}dropShadowToCSS(){let t=this.normalizeColor(this.dropShadowColor);const e=this.dropShadowAlpha,r=Math.round(Math.cos(this.dropShadowAngle)*this.dropShadowDistance),i=Math.round(Math.sin(this.dropShadowAngle)*this.dropShadowDistance);t.startsWith("#")&&e<1&&(t+=(255*e|0).toString(16).padStart(2,"0"));const n=`${r}px ${i}px`;return this.dropShadowBlur>0?`text-shadow: ${n} ${this.dropShadowBlur}px ${t}`:`text-shadow: ${n} ${t}`}reset(){Object.assign(this,GG.defaultOptions)}onBeforeDraw(){const{fontsDirty:t}=this;return this.fontsDirty=!1,this.isSafari&&this._fonts.length>0&&t?new Promise((t=>setTimeout(t,100))):Promise.resolve()}get isSafari(){const{userAgent:t}=PR.ADAPTER.getNavigator();return/^((?!chrome|android).)*safari/i.test(t)}set fillGradientStops(t){console.warn("[HTMLTextStyle] fillGradientStops is not supported by HTMLText")}get fillGradientStops(){return super.fillGradientStops}set fillGradientType(t){console.warn("[HTMLTextStyle] fillGradientType is not supported by HTMLText")}get fillGradientType(){return super.fillGradientType}set miterLimit(t){console.warn("[HTMLTextStyle] miterLimit is not supported by HTMLText")}get miterLimit(){return super.miterLimit}set trim(t){console.warn("[HTMLTextStyle] trim is not supported by HTMLText")}get trim(){return super.trim}set textBaseline(t){console.warn("[HTMLTextStyle] textBaseline is not supported by HTMLText")}get textBaseline(){return super.textBaseline}set leading(t){console.warn("[HTMLTextStyle] leading is not supported by HTMLText")}get leading(){return super.leading}set lineJoin(t){console.warn("[HTMLTextStyle] lineJoin is not supported by HTMLText")}get lineJoin(){return super.lineJoin}};let jG=GG;jG.availableFonts={},jG.defaultOptions={align:"left",breakWords:!1,dropShadow:!1,dropShadowAlpha:1,dropShadowAngle:Math.PI/6,dropShadowBlur:0,dropShadowColor:"black",dropShadowDistance:5,fill:"black",fontFamily:"Arial",fontSize:26,fontStyle:"normal",fontVariant:"normal",fontWeight:"normal",letterSpacing:0,lineHeight:0,padding:0,stroke:"black",strokeThickness:0,whiteSpace:"normal",wordWrap:!1,wordWrapWidth:100};const VG=class extends eF{constructor(t="",e={}){super(mL.EMPTY),this._text=null,this._style=null,this._autoResolution=!0,this._loading=!1,this.localStyleID=-1,this.dirty=!1,this.ownsStyle=!1;const r=new Image,i=mL.from(r,{scaleMode:PR.SCALE_MODE,resourceOptions:{autoLoad:!1}});i.orig=new hD,i.trim=new hD,this.texture=i;const n="http://www.w3.org/2000/svg",s="http://www.w3.org/1999/xhtml",o=document.createElementNS(n,"svg"),a=document.createElementNS(n,"foreignObject"),h=document.createElementNS(s,"div"),l=document.createElementNS(s,"style");a.setAttribute("width","10000"),a.setAttribute("height","10000"),a.style.overflow="hidden",o.appendChild(a),this.maxWidth=VG.defaultMaxWidth,this.maxHeight=VG.defaultMaxHeight,this._domElement=h,this._styleElement=l,this._svgRoot=o,this._foreignObject=a,this._foreignObject.appendChild(l),this._foreignObject.appendChild(h),this._image=r,this._loadImage=new Image,this._autoResolution=VG.defaultAutoResolution,this._resolution=VG.defaultResolution??PR.RESOLUTION,this.text=t,this.style=e}measureText(t){const{text:e,style:r,resolution:i}=Object.assign({text:this._text,style:this._style,resolution:this._resolution},t);Object.assign(this._domElement,{innerHTML:e,style:r.toCSS(i)}),this._styleElement.textContent=r.toGlobalCSS(),document.body.appendChild(this._svgRoot);const n=this._domElement.getBoundingClientRect();this._svgRoot.remove();const s=Math.min(this.maxWidth,Math.ceil(n.width)),o=Math.min(this.maxHeight,Math.ceil(n.height));return this._svgRoot.setAttribute("width",s.toString()),this._svgRoot.setAttribute("height",o.toString()),e!==this._text&&(this._domElement.innerHTML=this._text),r!==this._style&&(Object.assign(this._domElement,{style:this._style?.toCSS(i)}),this._styleElement.textContent=this._style?.toGlobalCSS()),{width:s+2*r.padding,height:o+2*r.padding}}async updateText(t=!0){const{style:e,_image:r,_loadImage:i}=this;if(this.localStyleID!==e.styleID&&(this.dirty=!0,this.localStyleID=e.styleID),!this.dirty&&t)return;const{width:n,height:s}=this.measureText();r.width=i.width=Math.ceil(Math.max(1,n)),r.height=i.height=Math.ceil(Math.max(1,s)),this._loading||(this._loading=!0,await new Promise((t=>{i.onload=async()=>{await e.onBeforeDraw(),this._loading=!1,r.src=i.src,i.onload=null,i.src="",this.updateTexture(),t()};const n=(new XMLSerializer).serializeToString(this._svgRoot);i.src=`data:image/svg+xml;charset=utf8,${encodeURIComponent(n)}`})))}get source(){return this._image}updateTexture(){const{style:t,texture:e,_image:r,resolution:i}=this,{padding:n}=t,{baseTexture:s}=e;e.trim.width=e._frame.width=r.width/i,e.trim.height=e._frame.height=r.height/i,e.trim.x=-n,e.trim.y=-n,e.orig.width=e._frame.width-2*n,e.orig.height=e._frame.height-2*n,this._onTextureUpdate(),s.setRealSize(r.width,r.height,i),this.dirty=!1}_render(t){this._autoResolution&&this._resolution!==t.resolution&&(this._resolution=t.resolution,this.dirty=!0),this.updateText(!0),super._render(t)}_renderCanvas(t){this._autoResolution&&this._resolution!==t.resolution&&(this._resolution=t.resolution,this.dirty=!0),this.updateText(!0),super._renderCanvas(t)}getLocalBounds(t){return this.updateText(!0),super.getLocalBounds(t)}_calculateBounds(){this.updateText(!0),this.calculateVertices(),this._bounds.addQuad(this.vertexData)}_onStyleChange(){this.dirty=!0}destroy(t){"boolean"==typeof t&&(t={children:t}),t=Object.assign({},VG.defaultDestroyOptions,t),super.destroy(t);const e=null;this.ownsStyle&&this._style?.cleanFonts(),this._style=e,this._svgRoot?.remove(),this._svgRoot=e,this._domElement?.remove(),this._domElement=e,this._foreignObject?.remove(),this._foreignObject=e,this._styleElement?.remove(),this._styleElement=e,this._loadImage.src="",this._loadImage.onload=null,this._loadImage=e,this._image.src="",this._image=e}get width(){return this.updateText(!0),Math.abs(this.scale.x)*this._image.width/this.resolution}set width(t){this.updateText(!0);const e=pk(this.scale.x)||1;this.scale.x=e*t/this._image.width/this.resolution,this._width=t}get height(){return this.updateText(!0),Math.abs(this.scale.y)*this._image.height/this.resolution}set height(t){this.updateText(!0);const e=pk(this.scale.y)||1;this.scale.y=e*t/this._image.height/this.resolution,this._height=t}get style(){return this._style}set style(t){this._style!==t&&((t=t||{})instanceof jG?(this.ownsStyle=!1,this._style=t):t instanceof yF?(console.warn("[HTMLText] Cloning TextStyle, if this is not what you want, use HTMLTextStyle"),this.ownsStyle=!0,this._style=jG.from(t)):(this.ownsStyle=!0,this._style=new jG(t)),this.localStyleID=-1,this.dirty=!0)}get text(){return this._text}set text(t){t=String(""===t||null==t?" ":t),t=this.sanitiseText(t),this._text!==t&&(this._text=t,this.dirty=!0)}get resolution(){return this._resolution}set resolution(t){this._autoResolution=!1,this._resolution!==t&&(this._resolution=t,this.dirty=!0)}sanitiseText(t){return t.replace(/<br>/gi,"<br/>").replace(/<hr>/gi,"<hr/>").replace(/&nbsp;/gi,"&#160;")}};let HG=VG;HG.defaultDestroyOptions={texture:!0,children:!1,baseTexture:!0},HG.defaultMaxWidth=2024,HG.defaultMaxHeight=2024,HG.defaultAutoResolution=!0;const WG=new hD;class XG{constructor(t){this.renderer=t}async image(t,e,r){const i=new Image;return i.src=await this.base64(t,e,r),i}async base64(t,e,r){const i=this.canvas(t);if(void 0!==i.toBlob)return new Promise(((t,n)=>{i.toBlob((e=>{if(!e)return void n(new Error("ICanvas.toBlob failed!"));const r=new FileReader;r.onload=()=>t(r.result),r.onerror=n,r.readAsDataURL(e)}),e,r)}));if(void 0!==i.toDataURL)return i.toDataURL(e,r);if(void 0!==i.convertToBlob){const t=await i.convertToBlob({type:e,quality:r});return new Promise(((e,r)=>{const i=new FileReader;i.onload=()=>e(i.result),i.onerror=r,i.readAsDataURL(t)}))}throw new Error("CanvasExtract.base64() requires ICanvas.toDataURL, ICanvas.toBlob, or ICanvas.convertToBlob to be implemented")}canvas(t,e){const r=this.renderer;if(!r)throw new Error("The CanvasExtract has already been destroyed");let i,n,s;t&&(s=t instanceof gL?t:r.generateTexture(t,{resolution:r.resolution})),s?(i=s.baseTexture._canvasRenderTarget.context,n=s.baseTexture._canvasRenderTarget.resolution,e=e??s.frame):(i=r.canvasContext.rootContext,n=r._view.resolution,e||((e=WG).width=r.width/n,e.height=r.height/n));const o=Math.round(e.x*n),a=Math.round(e.y*n),h=Math.round(e.width*n),l=Math.round(e.height*n),c=new xk(h,l,1),u=i.getImageData(o,a,h,l);return c.context.putImageData(u,0,0),c.canvas}pixels(t,e){const r=this.renderer;if(!r)throw new Error("The CanvasExtract has already been destroyed");let i,n,s;t&&(s=t instanceof gL?t:r.generateTexture(t,{resolution:r.resolution})),s?(i=s.baseTexture._canvasRenderTarget.context,n=s.baseTexture._canvasRenderTarget.resolution,e=e??s.frame):(i=r.canvasContext.rootContext,n=r.resolution,e||((e=WG).width=r.width/n,e.height=r.height/n));const o=Math.round(e.x*n),a=Math.round(e.y*n),h=Math.round(e.width*n),l=Math.round(e.height*n);return i.getImageData(o,a,h,l).data}destroy(){this.renderer=null}}let zG;XG.extension={name:"extract",type:Ik.CanvasRendererSystem},kk.add(XG);const YG=new pD;YU.prototype.generateCanvasTexture=function(t,e=1){const r=this.getLocalBounds(),i=gL.create({width:r.width,height:r.height,scaleMode:t,resolution:e});zG||(zG=new WN),this.transform.updateLocalTransform(),this.transform.localTransform.copyTo(YG),YG.invert(),YG.tx-=r.x,YG.ty-=r.y,zG.render(this,{renderTexture:i,clear:!0,transform:YG});const n=mL.from(i.baseTexture._canvasRenderTarget.canvas,{scaleMode:t});return n.baseTexture.setResolution(e),n},YU.prototype.cachedGraphicsData=[],YU.prototype._renderCanvas=function(t){!0!==this.isMask&&(this.finishPoly(),t.plugins.graphics.render(this))};class ZG{static offsetPolygon(t,e){const r=[],i=t.length;e=ZG.isPolygonClockwise(t)?e:-1*e;for(let n=0;n<i;n+=2){let s=n-2;s<0&&(s+=i);const o=(n+2)%i;let a=t[n]-t[s],h=t[n+1]-t[s+1],l=Math.sqrt(a*a+h*h);a/=l,h/=l,a*=e,h*=e;const c=-h,u=a,d=[t[s]+c,t[s+1]+u],p=[t[n]+c,t[n+1]+u];let f=t[o]-t[n],m=t[o+1]-t[n+1];l=Math.sqrt(f*f+m*m),f/=l,m/=l,f*=e,m*=e;const g=-m,v=f,y=[t[n]+g,t[n+1]+v],b=[t[o]+g,t[o+1]+v],_=ZG.findIntersection(d[0],d[1],p[0],p[1],y[0],y[1],b[0],b[1]);_&&r.push(..._)}return r}static findIntersection(t,e,r,i,n,s,o,a){const h=(a-s)*(r-t)-(o-n)*(i-e),l=(o-n)*(e-s)-(a-s)*(t-n);if(0===h)return 0===l&&0===(r-t)*(e-s)-(i-e)*(t-n)?[(t+r)/2,(e+i)/2]:null;const c=l/h;return[t+c*(r-t),e+c*(i-e)]}static isPolygonClockwise(t){let e=0;for(let r=0,i=t.length-2;r<t.length;i=r,r+=2)e+=(t[r]-t[i])*(t[r+1]+t[i+1]);return e>0}}class $G{constructor(t){this._svgMatrix=null,this._tempMatrix=new pD,this.renderer=t}_calcCanvasStyle(t,e){let r;return t.texture&&t.texture.baseTexture!==mL.WHITE.baseTexture?t.texture.valid?(r=XN.getTintedPattern(t.texture,e),this.setPatternTransform(r,t.matrix||pD.IDENTITY)):r="#808080":r=`#${`00000${(0|e).toString(16)}`.slice(-6)}`,r}render(t){const e=this.renderer,r=e.canvasContext.activeContext,i=t.worldAlpha,n=t.transform.worldTransform;e.canvasContext.setContextTransform(n),e.canvasContext.setBlendMode(t.blendMode);const s=t.geometry.graphicsData;let o,a;const h=QO.shared.setValue(t.tint).toArray();for(let t=0;t<s.length;t++){const l=s[t],c=l.shape,u=l.fillStyle,d=l.lineStyle,p=0|l.fillStyle.color,f=0|l.lineStyle.color;if(l.matrix&&e.canvasContext.setContextTransform(n.copyTo(this._tempMatrix).append(l.matrix)),u.visible&&(o=this._calcCanvasStyle(u,QO.shared.setValue(p).multiply(h).toNumber())),d.visible&&(a=this._calcCanvasStyle(d,QO.shared.setValue(f).multiply(h).toNumber())),r.lineWidth=d.width,r.lineCap=d.cap,r.lineJoin=d.join,r.miterLimit=d.miterLimit,l.type===sD.POLY){r.beginPath();const t=c;let e=t.points;const n=l.holes;let s,h,p,f,m;r.moveTo(e[0],e[1]);for(let t=2;t<e.length;t+=2)r.lineTo(e[t],e[t+1]);if(t.closeStroke&&r.closePath(),n.length>0){m=[],s=0,p=e[0],f=e[1];for(let t=2;t+2<e.length;t+=2)s+=(e[t]-p)*(e[t+3]-f)-(e[t+2]-p)*(e[t+1]-f);for(let t=0;t<n.length;t++)if(e=n[t].shape.points,e){h=0,p=e[0],f=e[1];for(let t=2;t+2<e.length;t+=2)h+=(e[t]-p)*(e[t+3]-f)-(e[t+2]-p)*(e[t+1]-f);if(h*s<0){r.moveTo(e[0],e[1]);for(let t=2;t<e.length;t+=2)r.lineTo(e[t],e[t+1])}else{r.moveTo(e[e.length-2],e[e.length-1]);for(let t=e.length-4;t>=0;t-=2)r.lineTo(e[t],e[t+1])}n[t].shape.closeStroke&&r.closePath(),m[t]=h*s<0}}u.visible&&(r.globalAlpha=u.alpha*i,r.fillStyle=o,r.fill()),d.visible&&this.paintPolygonStroke(t,d,a,n,m,i,r)}else if(l.type===sD.RECT){const t=c;if(u.visible&&(r.globalAlpha=u.alpha*i,r.fillStyle=o,r.fillRect(t.x,t.y,t.width,t.height)),d.visible){const e=d.width*(.5-(1-d.alignment)),n=t.width+2*e,s=t.height+2*e;r.globalAlpha=d.alpha*i,r.strokeStyle=a,r.strokeRect(t.x-e,t.y-e,n,s)}}else if(l.type===sD.CIRC){const t=c;if(r.beginPath(),r.arc(t.x,t.y,t.radius,0,2*Math.PI),r.closePath(),u.visible&&(r.globalAlpha=u.alpha*i,r.fillStyle=o,r.fill()),d.visible){if(.5!==d.alignment){const e=d.width*(.5-(1-d.alignment));r.beginPath(),r.arc(t.x,t.y,t.radius+e,0,2*Math.PI),r.closePath()}r.globalAlpha=d.alpha*i,r.strokeStyle=a,r.stroke()}}else if(l.type===sD.ELIP){const t=c,e=1===d.alignment;if(e||this.paintEllipse(t,u,d,o,i,r),d.visible){if(.5!==d.alignment){const e=.5522848,i=d.width*(.5-(1-d.alignment)),n=2*(t.width+i),s=2*(t.height+i),o=t.x-n/2,a=t.y-s/2,h=n/2*e,l=s/2*e,c=o+n,u=a+s,p=o+n/2,f=a+s/2;r.beginPath(),r.moveTo(o,f),r.bezierCurveTo(o,f-l,p-h,a,p,a),r.bezierCurveTo(p+h,a,c,f-l,c,f),r.bezierCurveTo(c,f+l,p+h,u,p,u),r.bezierCurveTo(p-h,u,o,f+l,o,f),r.closePath()}r.globalAlpha=d.alpha*i,r.strokeStyle=a,r.stroke()}e&&this.paintEllipse(t,u,d,o,i,r)}else if(l.type===sD.RREC){const t=c,e=1===d.alignment;if(e||this.paintRoundedRectangle(t,u,d,o,i,r),d.visible){if(.5!==d.alignment){const e=t.width,i=t.height,n=d.width*(.5-(1-d.alignment)),s=t.x-n,o=t.y-n,a=t.width+2*n,h=t.height+2*n,l=n*(d.alignment>=1?Math.min(a/e,h/i):Math.min(e/a,i/h));let c=t.radius+l;const u=Math.min(a,h)/2;c=c>u?u:c,r.beginPath(),r.moveTo(s,o+c),r.lineTo(s,o+h-c),r.quadraticCurveTo(s,o+h,s+c,o+h),r.lineTo(s+a-c,o+h),r.quadraticCurveTo(s+a,o+h,s+a,o+h-c),r.lineTo(s+a,o+c),r.quadraticCurveTo(s+a,o,s+a-c,o),r.lineTo(s+c,o),r.quadraticCurveTo(s,o,s,o+c),r.closePath()}r.globalAlpha=d.alpha*i,r.strokeStyle=a,r.stroke()}e&&this.paintRoundedRectangle(t,u,d,o,i,r)}}}paintPolygonStroke(t,e,r,i,n,s,o){if(.5!==e.alignment){const r=e.width*(.5-(1-e.alignment));let s,a=ZG.offsetPolygon(t.points,r);o.beginPath(),o.moveTo(a[0],a[1]);for(let t=2;t<a.length;t+=2)o.lineTo(a[t],a[t+1]);t.closeStroke&&o.closePath();for(let t=0;t<i.length;t++){if(s=i[t].shape.points,a=ZG.offsetPolygon(s,r),n[t]){o.moveTo(a[0],a[1]);for(let t=2;t<a.length;t+=2)o.lineTo(a[t],a[t+1])}else{o.moveTo(a[a.length-2],a[a.length-1]);for(let t=a.length-4;t>=0;t-=2)o.lineTo(a[t],a[t+1])}i[t].shape.closeStroke&&o.closePath()}}o.globalAlpha=e.alpha*s,o.strokeStyle=r,o.stroke()}paintEllipse(t,e,r,i,n,s){const o=2*t.width,a=2*t.height,h=t.x-o/2,l=t.y-a/2,c=.5522848,u=o/2*c,d=a/2*c,p=h+o,f=l+a,m=h+o/2,g=l+a/2;0===r.alignment&&s.save(),s.beginPath(),s.moveTo(h,g),s.bezierCurveTo(h,g-d,m-u,l,m,l),s.bezierCurveTo(m+u,l,p,g-d,p,g),s.bezierCurveTo(p,g+d,m+u,f,m,f),s.bezierCurveTo(m-u,f,h,g+d,h,g),s.closePath(),0===r.alignment&&s.clip(),e.visible&&(s.globalAlpha=e.alpha*n,s.fillStyle=i,s.fill()),0===r.alignment&&s.restore()}paintRoundedRectangle(t,e,r,i,n,s){const o=t.x,a=t.y,h=t.width,l=t.height;let c=t.radius;const u=Math.min(h,l)/2;c=c>u?u:c,0===r.alignment&&s.save(),s.beginPath(),s.moveTo(o,a+c),s.lineTo(o,a+l-c),s.quadraticCurveTo(o,a+l,o+c,a+l),s.lineTo(o+h-c,a+l),s.quadraticCurveTo(o+h,a+l,o+h,a+l-c),s.lineTo(o+h,a+c),s.quadraticCurveTo(o+h,a,o+h-c,a),s.lineTo(o+c,a),s.quadraticCurveTo(o,a,o,a+c),s.closePath(),0===r.alignment&&s.clip(),e.visible&&(s.globalAlpha=e.alpha*n,s.fillStyle=i,s.fill()),0===r.alignment&&s.restore()}setPatternTransform(t,e){if(!1!==this._svgMatrix){if(!this._svgMatrix){const e=document.createElementNS("http://www.w3.org/2000/svg","svg");if(e?.createSVGMatrix&&(this._svgMatrix=e.createSVGMatrix()),!this._svgMatrix||!t.setTransform)return void(this._svgMatrix=!1)}this._svgMatrix.a=e.a,this._svgMatrix.b=e.b,this._svgMatrix.c=e.c,this._svgMatrix.d=e.d,this._svgMatrix.e=e.tx,this._svgMatrix.f=e.ty,t.setTransform(this._svgMatrix.inverse())}}destroy(){this.renderer=null,this._svgMatrix=null,this._tempMatrix=null}}$G.extension={name:"graphics",type:Ik.CanvasRendererPlugin},kk.add($G),Object.defineProperties(PR,{MESH_CANVAS_PADDING:{get:()=>qU.defaultCanvasPadding,set(t){TO("7.1.0","settings.MESH_CANVAS_PADDING is deprecated, use Mesh.defaultCanvasPadding"),qU.defaultCanvasPadding=t}}}),tG.prototype._renderCanvas=function(t,e){t.plugins.mesh.render(e)},nG.prototype._cachedTint=16777215,nG.prototype._tintedCanvas=null,nG.prototype._canvasUvs=null,nG.prototype._renderCanvas=function(t){const e=t.canvasContext.activeContext,r=this.worldTransform,i=16777215!==this.tintValue,n=this.texture;if(!n.valid)return;i&&this._cachedTint!==this.tintValue&&(this._cachedTint=this.tintValue,this._tintedCanvas=XN.getTintedCanvas(this,this.tintValue));const s=i?this._tintedCanvas:n.baseTexture.getDrawableSource();this._canvasUvs||(this._canvasUvs=[0,0,0,0,0,0,0,0]);const o=this.vertices,a=this._canvasUvs,h=i?0:n.frame.x,l=i?0:n.frame.y,c=h+n.frame.width,u=l+n.frame.height;a[0]=h,a[1]=h+this._leftWidth,a[2]=c-this._rightWidth,a[3]=c,a[4]=l,a[5]=l+this._topHeight,a[6]=u-this._bottomHeight,a[7]=u;for(let t=0;t<8;t++)a[t]*=n.baseTexture.resolution;e.globalAlpha=this.worldAlpha,t.canvasContext.setBlendMode(this.blendMode),t.canvasContext.setContextTransform(r,this.roundPixels);for(let t=0;t<3;t++)for(let r=0;r<3;r++){const i=2*r+8*t,n=Math.max(1,a[r+1]-a[r]),h=Math.max(1,a[t+5]-a[t+4]),l=Math.max(1,o[i+10]-o[i]),c=Math.max(1,o[i+11]-o[i+1]);e.drawImage(s,a[r],a[t+4],n,h,o[i],o[i+1],l,c)}};let KG=!1;qU.prototype._cachedTint=16777215,qU.prototype._tintedCanvas=null,qU.prototype._cachedTexture=null,qU.prototype._renderCanvas=function(t){this.shader.uvMatrix&&(this.shader.uvMatrix.update(),this.calculateUvs()),this.material._renderCanvas?this.material._renderCanvas(t,this):KG||(KG=!0,globalThis.console.warn("Mesh with custom shaders are not supported in CanvasRenderer."))},qU.prototype._canvasPadding=null,qU.defaultCanvasPadding=0,Object.defineProperty(qU.prototype,"canvasPadding",{get(){return this._canvasPadding??qU.defaultCanvasPadding},set(t){this._canvasPadding=t}}),class extends qU{constructor(t=mL.EMPTY,e,r,i,n){const s=new QU(e,r,i);s.getBuffer("aVertexPosition").static=!1;super(s,new tG(t),null,n),this.autoUpdate=!0}get vertices(){return this.geometry.getBuffer("aVertexPosition").data}set vertices(t){this.geometry.getBuffer("aVertexPosition").data=t}_render(t){this.autoUpdate&&this.geometry.getBuffer("aVertexPosition").update(),super._render(t)}}.prototype._renderCanvas=function(t){this.autoUpdate&&this.geometry.getBuffer("aVertexPosition").update(),this.shader.update&&this.shader.update(),this.calculateUvs(),this.material._renderCanvas(t,this)},class extends qU{constructor(t,e,r=0){const i=new rG(t.height,e,r),n=new tG(t);r>0&&(t.baseTexture.wrapMode=bR.REPEAT),super(i,n),this.autoUpdate=!0}_render(t){const e=this.geometry;(this.autoUpdate||e._width!==this.shader.texture.height)&&(e._width=this.shader.texture.height,e.update()),super._render(t)}}.prototype._renderCanvas=function(t){(this.autoUpdate||this.geometry._width!==this.shader.texture.height)&&(this.geometry._width=this.shader.texture.height,this.geometry.update()),this.shader.update&&this.shader.update(),this.calculateUvs(),this.material._renderCanvas(t,this)};class JG{constructor(t){this.renderer=t}render(t){const e=this.renderer,r=t.worldTransform;e.canvasContext.activeContext.globalAlpha=t.worldAlpha,e.canvasContext.setBlendMode(t.blendMode),e.canvasContext.setContextTransform(r,t.roundPixels),t.drawMode!==pR.TRIANGLES?this._renderTriangleMesh(t):this._renderTriangles(t)}_renderTriangleMesh(t){const e=t.geometry.buffers[0].data.length;for(let r=0;r<e-2;r++){const e=2*r;this._renderDrawTriangle(t,e,e+2,e+4)}}_renderTriangles(t){const e=t.geometry.getIndex().data,r=e.length;for(let i=0;i<r;i+=3){const r=2*e[i],n=2*e[i+1],s=2*e[i+2];this._renderDrawTriangle(t,r,n,s)}}_renderDrawTriangle(t,e,r,i){const n=this.renderer.canvasContext.activeContext,s=t.geometry.buffers[0].data,{uvs:o,texture:a}=t;if(!a.valid)return;const h=16777215!==t.tintValue,l=a.baseTexture,c=l.width,u=l.height;t._cachedTexture&&t._cachedTexture.baseTexture!==l&&(t._cachedTint=16777215,t._cachedTexture?.destroy(),t._cachedTexture=null,t._tintedCanvas=null),h&&t._cachedTint!==t.tintValue&&(t._cachedTint=t.tintValue,t._cachedTexture=t._cachedTexture||new mL(l),t._tintedCanvas=XN.getTintedCanvas({texture:t._cachedTexture},t.tintValue));const d=h?t._tintedCanvas:l.getDrawableSource(),p=o[e]*l.width,f=o[r]*l.width,m=o[i]*l.width,g=o[e+1]*l.height,v=o[r+1]*l.height,y=o[i+1]*l.height;let b=s[e],_=s[r],x=s[i],T=s[e+1],w=s[r+1],S=s[i+1];const E=t.canvasPadding/this.renderer.canvasContext.activeResolution;if(E>0){const{a:e,b:r,c:i,d:n}=t.worldTransform,s=(b+_+x)/3,o=(T+w+S)/3;let a=b-s,h=T-o,l=e*a+i*h,c=r*a+n*h,u=Math.sqrt(l*l+c*c),d=1+E/u;b=s+a*d,T=o+h*d,a=_-s,h=w-o,l=e*a+i*h,c=r*a+n*h,u=Math.sqrt(l*l+c*c),d=1+E/u,_=s+a*d,w=o+h*d,a=x-s,h=S-o,l=e*a+i*h,c=r*a+n*h,u=Math.sqrt(l*l+c*c),d=1+E/u,x=s+a*d,S=o+h*d}n.save(),n.beginPath(),n.moveTo(b,T),n.lineTo(_,w),n.lineTo(x,S),n.closePath(),n.clip();const C=p*v+g*m+f*y-v*m-g*f-p*y,A=b*v+g*x+_*y-v*x-g*_-b*y,R=p*_+b*m+f*x-_*m-b*f-p*x,P=p*v*x+g*_*m+b*f*y-b*v*m-g*f*x-p*_*y,I=T*v+g*S+w*y-v*S-g*w-T*y,M=p*w+T*m+f*S-w*m-T*f-p*S,O=p*v*S+g*w*m+T*f*y-T*v*m-g*f*S-p*w*y;n.transform(A/C,I/C,R/C,M/C,P/C,O/C),n.drawImage(d,0,0,c*l.resolution,u*l.resolution,0,0,c,u),n.restore(),this.renderer.canvasContext.invalidateBlendMode()}renderMeshFlat(t){const e=this.renderer.canvasContext.activeContext,r=t.geometry.getBuffer("aVertexPosition").data,i=r.length/2;e.beginPath();for(let t=1;t<i-2;++t){const i=2*t,n=r[i],s=r[i+1],o=r[i+2],a=r[i+3],h=r[i+4],l=r[i+5];e.moveTo(n,s),e.lineTo(o,a),e.lineTo(h,l)}e.fillStyle="#FF0000",e.fill(),e.closePath()}destroy(){this.renderer=null}}JG.extension={name:"mesh",type:Ik.CanvasRendererPlugin},kk.add(JG);function qG(t,e){const r=t;if(e instanceof Xk){const t=e.source,i=0===t.width?r.canvas.width:Math.min(r.canvas.width,t.width),n=0===t.height?r.canvas.height:Math.min(r.canvas.height,t.height);return r.ctx.drawImage(t,0,0,i,n,0,0,r.canvas.width,r.canvas.height),!0}return!1}class QG extends fG{constructor(t){super(t),this.uploadHookHelper=this,this.canvas=PR.ADAPTER.createCanvas(16,16),this.ctx=this.canvas.getContext("2d"),this.registerUploadHook(qG)}destroy(){super.destroy(),this.ctx=null,this.canvas=null}}QG.extension={name:"prepare",type:Ik.CanvasRendererSystem},kk.add(QG),eF.prototype._tintedCanvas=null,eF.prototype._renderCanvas=function(t){t.plugins.sprite.render(this)};const tj=new pD;class ej{constructor(t){this.renderer=t}render(t){const e=t._texture,r=this.renderer,i=r.canvasContext.activeContext,n=r.canvasContext.activeResolution;if(!e.valid)return;const s=e._frame.width,o=e._frame.height;let a=e._frame.width,h=e._frame.height;e.trim&&(a=e.trim.width,h=e.trim.height);let l=t.transform.worldTransform,c=0,u=0;const d=e.baseTexture.getDrawableSource();if(e.orig.width<=0||e.orig.height<=0||!e.valid||!d)return;r.canvasContext.setBlendMode(t.blendMode,!0),i.globalAlpha=t.worldAlpha;const p=e.baseTexture.scaleMode===yR.LINEAR,f=r.canvasContext.smoothProperty;f&&i[f]!==p&&(i[f]=p),e.trim?(c=e.trim.width/2+e.trim.x-t.anchor.x*e.orig.width,u=e.trim.height/2+e.trim.y-t.anchor.y*e.orig.height):(c=(.5-t.anchor.x)*e.orig.width,u=(.5-t.anchor.y)*e.orig.height),e.rotate&&(l.copyTo(tj),l=tj,xD.matrixAppendRotationInv(l,e.rotate,c,u),c=0,u=0),c-=a/2,u-=h/2,r.canvasContext.setContextTransform(l,t.roundPixels,1),t.roundPixels&&(c|=0,u|=0);const m=e.baseTexture.resolution,g=r.canvasContext._outerBlend;g&&(i.save(),i.beginPath(),i.rect(c*n,u*n,a*n,h*n),i.clip()),16777215!==t.tint?(t._cachedTint===t.tintValue&&t._tintedCanvas.tintId===t._texture._updateID||(t._cachedTint=t.tintValue,t._tintedCanvas=XN.getTintedCanvas(t,t.tintValue)),i.drawImage(t._tintedCanvas,0,0,Math.floor(s*m),Math.floor(o*m),Math.floor(c*n),Math.floor(u*n),Math.floor(a*n),Math.floor(h*n))):i.drawImage(d,e._frame.x*m,e._frame.y*m,Math.floor(s*m),Math.floor(o*m),Math.floor(c*n),Math.floor(u*n),Math.floor(a*n),Math.floor(h*n)),g&&i.restore(),r.canvasContext.setBlendMode(dR.NORMAL)}destroy(){this.renderer=null}}ej.extension={name:"sprite",type:Ik.CanvasRendererPlugin},kk.add(ej);class rj extends rL{constructor(t){super("attribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\n\nuniform mat3 projectionMatrix;\n\nvarying vec2 vTextureCoord;\n\nvoid main(void)\n{\n    gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n    vTextureCoord = aTextureCoord;\n}","varying vec2 vTextureCoord;\nuniform sampler2D uSampler;\n\nuniform float gamma;\nuniform float contrast;\nuniform float saturation;\nuniform float brightness;\nuniform float red;\nuniform float green;\nuniform float blue;\nuniform float alpha;\n\nvoid main(void)\n{\n    vec4 c = texture2D(uSampler, vTextureCoord);\n\n    if (c.a > 0.0) {\n        c.rgb /= c.a;\n\n        vec3 rgb = pow(c.rgb, vec3(1. / gamma));\n        rgb = mix(vec3(.5), mix(vec3(dot(vec3(.2125, .7154, .0721), rgb)), rgb, saturation), contrast);\n        rgb.r *= red;\n        rgb.g *= green;\n        rgb.b *= blue;\n        c.rgb = rgb * brightness;\n\n        c.rgb *= c.a;\n    }\n\n    gl_FragColor = c * alpha;\n}\n"),this.gamma=1,this.saturation=1,this.contrast=1,this.brightness=1,this.red=1,this.green=1,this.blue=1,this.alpha=1,Object.assign(this,t)}apply(t,e,r,i){this.uniforms.gamma=Math.max(this.gamma,1e-4),this.uniforms.saturation=this.saturation,this.uniforms.contrast=this.contrast,this.uniforms.brightness=this.brightness,this.uniforms.red=this.red,this.uniforms.green=this.green,this.uniforms.blue=this.blue,this.uniforms.alpha=this.alpha,t.applyFilter(this,e,r,i)}}var ij=Xp("process:video"),nj=function(){function t(t){var e,r;this.frameRate=null,this.resolution=null,this.backgroundColor=null,this.streamList=[],this.textList=[],this.isStart=!1,this.output=null,this.worker=null,this.renderer=null,this.stage=null,this.ticker=mN.shared,this.isPaused=!1;var i=t.frameRate,n=t.resolution,s=t.backgroundColor;this.frameRate=i,this.resolution=n,this.backgroundColor=s,this.worker=kA(),this.renderer=yN({width:n.width,height:n.height,backgroundColor:s,antialias:!0,resolution:1,forceCanvas:qT}),this.stage=new qN,this.stage.sortableChildren=!0,this.ticker.autoStart=!1,this.ticker.stop(),this.draw=uc(e=this.draw).call(e,this),this.setStreamParams=uc(r=this.setStreamParams).call(r,this)}return t.prototype.setResolution=function(t){var e;this.resolution=t,null===(e=this.renderer)||void 0===e||e.resize(t.width,t.height)},t.prototype.setBackgroundColor=function(t){this.backgroundColor=t,this.renderer&&(this.renderer.backgroundColor=t)},t.prototype.addStream=function(t){var e,r=this,i=t.source,n=t.order,s=null,o=null;if(i instanceof MediaStream){var a,h=wu(a=this.streamList).call(a,(function(t){return t.source===i}));h?s=h.element:((s=vv()).onpause=function(){ij("video is paused, try to resume"),ld((function(){var t;null===(t=null==s?void 0:s.play)||void 0===t||t.call(s)}),50)},s.muted=!0,s.srcObject=i,s.load())}else s=i;var l=wu(e=this.streamList).call(e,(function(t){return t.element===s}));o=l?l.texture:mL.from(s);var c=new eF(o),u=yv(s),d=u.width,p=u.height;if(0===d||0===p){var f=s instanceof HTMLVideoElement?"loadedmetadata":"load";s.addEventListener(f,(function e(){s.removeEventListener(f,e,!1),r.setStreamParams(c,s,t)}),!1)}else this.setStreamParams(c,s,t);c.zIndex=n,this.stage.addChild(c),this.streamList.push(Td(Td({},t),{element:s,texture:o,sprite:c}))},t.prototype.removeStream=function(t){var e,r,i,n=Hc(e=this.streamList).call(e,(function(e){return e.id===t}));if(-1!==n){var s,o=Cd(fu(r=this.streamList).call(r,n,1),1)[0];if(this.stage.removeChild(o.sprite),o.sprite.filters=null,o.sprite.destroy(),o.sprite=null,!wu(i=this.streamList).call(i,(function(t){return t.element===o.element}))){if(o.source instanceof HTMLVideoElement){var a=o.texture.baseTexture.resource,h=a.source,l=a._onError;h&&h.removeEventListener("error",l,!0),a.source=null}o.texture.destroy(!0)}if(o.texture=null,o.source instanceof MediaStream)if(!wu(s=this.streamList).call(s,(function(t){return t.source===o.source}))&&o.element instanceof HTMLVideoElement){var c=o.element;c.onpause=null,c.pause(),c.srcObject=null,c.load(),c.remove()}o.element=null}else ij("remove failed, stream ".concat(t," is not existed"))},t.prototype.addText=function(t){var e=t.x,r=t.y,i=t.order,n=t.content,s=t.style,o=s.font_alpha,a=void 0===o?100:o,h=s.background_color,l=s.background_alpha,c=void 0===l?100:l,u=new qN;u.sortableChildren=!0;var d=this.transformTextStyle(s),p=new wF(n,d);if(p.alpha=Number(a)/100,p.zIndex=1,u.addChild(p),h){var f=new YU;f.beginFill("number"==typeof h?h:ek(h),Number(c)/100),f.drawRect(0,0,u.width,u.height),f.endFill(),f.zIndex=0,u.addChild(f)}u.pivot.x=u.width/2,u.pivot.y=u.height/2,u.x=e,u.y=r,u.zIndex=i,this.stage.addChild(u),this.textList.push(Td(Td({},t),{container:u}))},t.prototype.removeText=function(t){var e,r,i=Hc(e=this.textList).call(e,(function(e){return e.id===t}));if(-1!==i){var n=Cd(fu(r=this.textList).call(r,i,1),1)[0];this.stage.removeChild(n.container),n.container.destroy(!0),n.container=null}else ij("remove failed, text ".concat(t," is not existed"))},t.prototype.start=function(){var t;this.isStart?ij("rendering has started"):this.renderer?(this.isStart=!0,this.isPaused=!1,this.draw(),this.output=null===(t=this.getRenderView())||void 0===t?void 0:t.captureStream(this.frameRate)):ij("renderer is not existed")},t.prototype.stop=function(){this.isStart?(this.isStart=!1,this.isPaused=!1,this.destroy()):ij("rendering has stopped")},t.prototype.getOutput=function(){return this.output},t.prototype.getRenderView=function(){var t;return null===(t=this.renderer)||void 0===t?void 0:t.view},t.prototype.pause=function(){this.isPaused=!0},t.prototype.resume=function(){this.isPaused=!1},t.prototype.setStreamParams=function(t,e,r){var i=r.x,n=r.y,s=r.width,o=r.height,a=r.operations,h=yv(e),l=h.width,c=h.height,u={width:s,height:o};0!==l&&0!==c&&(u=s/o<l/c?{width:s,height:s*c/l}:{width:o*l/c,height:o}),t.anchor.set(.5,.5),t.width=u.width,t.height=u.height,t.x=i,t.y=n,Rc(a).call(a,(function(e){var r,i,n,s=e.type,o=e.params,a=void 0===o?{}:o;if("image_mirror"===s&&(a.left_right&&(t.scale.x*=-1),a.up_down&&(t.scale.y*=-1)),"image_filter_normal"===s){t.filters||(t.filters=[]);var h=function(t){return 1+t/100},l={contrast:h(null!==(r=a.contrast)&&void 0!==r?r:0),brightness:h(null!==(i=a.brightness)&&void 0!==i?i:0),saturation:h(null!==(n=a.saturation)&&void 0!==n?n:0)};t.filters.push(new rj(l))}}))},t.prototype.transformTextStyle=function(t){var e,r={};return Rc(e=Cu(t)).call(e,(function(e){var i=zA[e];if(i)switch(i){case"fontWeight":r[i]=t[e]?"bold":"normal";break;case"fontStyle":r[i]=t[e]?"italic":"normal";break;case"dropShadowColor":t[e]&&(r.dropShadow=!0,r[i]=t[e]);break;case"dropShadowAlpha":r[i]=Number(t[e])/100;break;default:r[i]=t[e]}})),new yF(r)},t.prototype.draw=function(){this.isStart&&this.renderer&&this.stage?(this.isPaused||(this.ticker.update(),this.renderer.render(this.stage)),this.requestAnimationFrameWrapper(this.draw)):ij("render stop")},t.prototype.destroy=function(){var t,e,r,i,n,s,o,a=this;null===(i=this.worker)||void 0===i||i.terminate(),this.worker=null;var h=md(t=this.streamList).call(t,(function(t){return t.id}));Rc(h).call(h,(function(t){a.removeStream(t)})),this.streamList=[];var l=md(e=this.textList).call(e,(function(t){return t.id}));Rc(l).call(l,(function(t){a.removeText(t)})),this.textList=[],null===(n=this.stage)||void 0===n||n.destroy({children:!0,texture:!0,baseTexture:!0}),this.stage=null,null===(s=this.renderer)||void 0===s||s.destroy(!0),this.renderer=null,null===(o=this.output)||void 0===o||Rc(r=o.getTracks()).call(r,(function(t){t.stop()})),this.output=null},t.prototype.setWorkerInterval=function(t,e){var r,i,n=this;null===(r=this.worker)||void 0===r||r.addEventListener("message",t),null===(i=this.worker)||void 0===i||i.postMessage({type:"start",data:{time:e}});return function(){var e,r;null===(e=n.worker)||void 0===e||e.postMessage({type:"stop"}),null===(r=n.worker)||void 0===r||r.removeEventListener("message",t)}},t.prototype.requestAnimationFrameWrapper=function(t){var e=!1,r=this.setWorkerInterval((function(){!e&&document.hidden&&(e=!0,r(),t())}),1e3/this.frameRate);requestAnimationFrame((function(){e||(e=!0,r(),t())}))},t}(),sj=oc("Array").entries,oj=ri,aj=Jt,hj=ht,lj=sj,cj=Array.prototype,uj={DOMTokenList:!0,NodeList:!0},dj=function(t){var e=t.entries;return t===cj||hj(cj,t)&&e===cj.entries||aj(uj,oj(t))?lj:e},pj=Xp("process:audio"),fj=function(){function t(){this.streamList=[],this.isStart=!1,this.output=null,this.audioContext=null,this.audioDestination=null,this.audioConstantSource=null;var t=gv(),e=t.createGain();if(e.gain.value=1,t.createConstantSource){var r=t.createConstantSource();r.start();var i=t.createGain();i.gain.value=0,r.connect(i),i.connect(e),this.audioConstantSource=r}this.audioContext=t,this.audioDestination=e}return t.prototype.addStream=function(t){var e,r,i,n=this,s=t.source,o=t.operations,a=null,h=wu(e=this.streamList).call(e,(function(t){return t.source===s}));h?a=h.audioSource:s instanceof MediaStream?s.getAudioTracks().length>0&&(a=this.audioContext.createMediaStreamSource(s)):(a=s._audioSource||this.audioContext.createMediaElementSource(s),s._audioSource=a,a.connect(this.audioContext.destination));var l=[];if(a){Rc(o).call(o,(function(t){var e,r,i,s,o,a,h=t.type,c=t.params,u=void 0===c?{}:c;if("audio_volumes"===h){var d=n.audioContext.createGain();d.gain.value=(null!==(e=u.all)&&void 0!==e?e:100)/100,l.push(d)}if("audio_compressor"===h){var p=n.audioContext.createDynamicsCompressor();p.threshold.value=null!==(r=u.threshold)&&void 0!==r?r:YA.threshold.value,p.ratio.value=null!==(i=u.ratio)&&void 0!==i?i:YA.ratio.value,p.knee.value=null!==(s=u.knee)&&void 0!==s?s:YA.knee.value,p.attack.value=(null!==(o=u.attack)&&void 0!==o?o:YA.attack.value)/1e3,p.release.value=(null!==(a=u.release)&&void 0!==a?a:YA.release.value)/1e3,l.push(p)}}));var c=l.length;if(c>0)try{for(var u=Ed(dj(l).call(l)),d=u.next();!d.done;d=u.next()){var p=Cd(d.value,2),f=p[0],m=p[1];0===f&&a.connect(m),f===c-1&&m.connect(this.audioDestination),f<c-1&&m.connect(l[f+1])}}catch(t){r={error:t}}finally{try{d&&!d.done&&(i=u.return)&&i.call(u)}finally{if(r)throw r.error}}else a.connect(this.audioDestination)}this.streamList.push(Td(Td({},t),{audioSource:a,audioNodeList:l}))},t.prototype.removeStream=function(t){var e,r,i,n,s=Hc(e=this.streamList).call(e,(function(e){return e.id===t}));if(-1!==s){var o=Cd(fu(r=this.streamList).call(r,s,1),1)[0];if(o.audioSource){var a=o.audioSource,h=o.audioNodeList,l=h.length;if(l>0)try{for(var c=Ed(dj(h).call(h)),u=c.next();!u.done;u=c.next()){var d=Cd(u.value,2),p=d[0],f=d[1];0===p&&a.disconnect(f),p===l-1&&f.disconnect(this.audioDestination),p<l-1&&f.disconnect(h[p+1])}}catch(t){i={error:t}}finally{try{u&&!u.done&&(n=c.return)&&n.call(c)}finally{if(i)throw i.error}}else a.disconnect(this.audioDestination)}o.audioSource=null,o.audioNodeList=null}else pj("remove failed, stream ".concat(t," is not existed"))},t.prototype.start=function(){if(this.isStart)pj("process has started");else if(this.audioContext&&this.audioDestination){this.isStart=!0;var t=this.audioContext.createMediaStreamDestination();this.audioDestination.connect(t),this.output=t.stream}else pj("audio context is not existed")},t.prototype.stop=function(){this.isStart?(this.isStart=!1,this.destroy()):pj("process has stopped")},t.prototype.getOutput=function(){return this.output},t.prototype.destroy=function(){var t,e,r,i,n,s,o,a=this,h=md(t=this.streamList).call(t,(function(t){return t.id}));Rc(h).call(h,(function(t){a.removeStream(t)})),this.streamList=[],null===(r=this.audioConstantSource)||void 0===r||r.stop(),null===(i=this.audioConstantSource)||void 0===i||i.disconnect(),this.audioConstantSource=null,null===(n=this.audioDestination)||void 0===n||n.disconnect(),this.audioDestination=null,window.TXLiveAudioContext||(null===(s=this.audioContext)||void 0===s||s.close(),this.audioContext=null),null===(o=this.output)||void 0===o||Rc(e=o.getTracks()).call(e,(function(t){t.stop()})),this.output=null},t}(),mj=Xp("process"),gj=function(){function t(t){void 0===t&&(t={}),this.frameRate=15,this.resolution=WA,this.backgroundColor=0,this.lastData=null,this.curData=null,this.isProcessStart=!1,this.output=null,this.videoProcess=null,this.audioProcess=null;var e=t.frameRate,r=t.resolution,i=t.backgroundColor,n=t.data;e&&this.setFrameRate(e),r&&this.setResolution(r),i&&this.setBackgroundColor(i),n&&this.setData(n)}return t.prototype.setFrameRate=function(t){t?"number"!=typeof t||t<=0?mj("frameRate must be a number greater than 0"):this.frameRate=t:mj("frameRate must be existed")},t.prototype.setResolution=function(t){var e;t?"object"===Xl(t)&&"number"==typeof t.width&&"number"==typeof t.height&&(t.width>0&&t.height>0||0===t.width&&0===t.height)?(this.resolution=t,t.width>0&&t.height>0&&(null===(e=this.videoProcess)||void 0===e||e.setResolution(t))):mj("resolution width and height must be a number greater than or equal to 0"):mj("resolution must be existed")},t.prototype.setBackgroundColor=function(t){var e;null!=t?"number"!=typeof t||t<0||t>16777215?mj("backgroundColor must be a valid color number"):(this.backgroundColor=t,null===(e=this.videoProcess)||void 0===e||e.setBackgroundColor(t)):mj("backgroundColor must be existed")},t.prototype.setData=function(t){var e,r,i,n,s,o,a=this;if(HA(t)){try{for(var h=Ed(t),l=h.next();!l.done;l=h.next()){var c,u=l.value,d=u.id,p=u.type,f=u.order,m=u.items;if(!d)return void mj("data.id is not existed");if(!$u(c=Cu(XA)).call(c,p))return void mj("data.type(".concat(p,") is invalid"));if(void 0!==f&&"number"!=typeof f)return void mj("data.order must be a number");if(!HA(m))return void mj("data.items must be an array");try{for(var g=(i=void 0,Ed(m)),v=g.next();!v.done;v=g.next()){var y,b=v.value,_=b.id,x=b.type,T=b.source,w=b.content,S=b.operations;if(!_)return void mj("data.items.id is not existed");if(!$u(y=XA[p]).call(y,x))return void mj("data.items.type(".concat(x,") is invalid"));if("video"===p){if(!("video"!==x||T instanceof UA||T instanceof MediaStream||T instanceof HTMLVideoElement))return void mj("data.items.source(".concat(x,") is invalid"));if("image"===x&&!(T instanceof HTMLImageElement))return void mj("data.items.source(".concat(x,") is invalid"))}else if("audio"===p){if(!(T instanceof UA||T instanceof MediaStream||T instanceof HTMLVideoElement||T instanceof HTMLAudioElement))return void mj("data.items.source(".concat(x,") is invalid"))}else if("text"===p){if(!w)return void mj("data.items.content is not existed");var E=w.text,C=w.text_style;if(!E)return void mj("data.items.content.text is not existed");if("object"!==Xl(C)||HA(C)||null===C)return void mj("data.items.content.text_style is invalid")}if(void 0!==S){if(!HA(S))return void mj("data.items.operations must be an array");var A=function(t){var e,r,i=t.type,n=t.params,s=void 0===n?{}:n;if("audio_volumes"===i&&void 0!==s.all&&"number"!=typeof s.all)return mj("audio_volumes param must be a number"),{value:void 0};if("audio_compressor"===i&&Cu(s).length>0&&!Aw(e=Cu(s)).call(e,(function(t){var e=YA[t];if(!e)return mj("audio_compressor param ".concat(t," is invalid")),!1;var r,i,n=s[t];return!("number"!=typeof n||n<e.min||n>e.max)||(mj(gc(r=gc(i="audio_compressor param ".concat(t," must be a number between ")).call(i,e.min," and ")).call(r,e.max)),!1)})))return{value:void 0};if("image_filter_normal"===i&&Cu(s).length>0&&!Aw(r=Cu(s)).call(r,(function(t){var e=s[t];return!("number"!=typeof e||e<-100||e>100)||(mj("image_filter_normal param ".concat(t," must be a number between -100 and 100")),!1)})))return{value:void 0}};try{for(var R=(s=void 0,Ed(S)),P=R.next();!P.done;P=R.next()){var I=A(P.value);if("object"===Xl(I))return I.value}}catch(t){s={error:t}}finally{try{P&&!P.done&&(o=R.return)&&o.call(R)}finally{if(s)throw s.error}}}}}catch(t){i={error:t}}finally{try{v&&!v.done&&(n=g.return)&&n.call(g)}finally{if(i)throw i.error}}}}catch(t){e={error:t}}finally{try{l&&!l.done&&(r=h.return)&&r.call(h)}finally{if(e)throw e.error}}if(this.lastData=this.curData,this.curData=zg(t),this.isProcessStart){var M=Cd((D=this.curData,L=this.lastData,[dv(L,D,pv),dv(D,L,pv)]),2),O=M[0],k=M[1];this.videoProcess&&(this.videoProcess.pause(),this.removeVideoData(O),this.addVideoData(k),ld((function(){var t;null===(t=a.videoProcess)||void 0===t||t.resume()}),1500/this.frameRate)),this.removeAudioData(O),this.addAudioData(k)}var D,L}else mj("data must be an array")},t.prototype.start=function(){var t=this;return new zT((function(e,r){var i;if(t.isProcessStart)return mj("processing has started"),void r(new Error("processing has started"));if(!t.curData||0===t.curData.length)return mj("data is empty"),void r(new Error("data is empty"));t.isProcessStart=!0;var n=t,s=n.frameRate,o=n.resolution,a=n.backgroundColor;o.width>0&&o.height>0&&(t.videoProcess=new nj({frameRate:s,resolution:o,backgroundColor:a}),t.addVideoData(t.curData)),t.audioProcess=new fj,t.addAudioData(t.curData),null===(i=t.videoProcess)||void 0===i||i.start(),t.audioProcess.start(),e()}))},t.prototype.stop=function(){var t,e,r;this.isProcessStart?(this.isProcessStart=!1,null===(e=this.videoProcess)||void 0===e||e.stop(),this.audioProcess.stop(),this.lastData=null,this.videoProcess=null,this.audioProcess=null,null===(r=this.output)||void 0===r||Rc(t=r.getTracks()).call(t,(function(t){t.stop()})),this.output=null):mj("processing has stopped")},t.prototype.isStart=function(){return this.isProcessStart},t.prototype.getOutput=function(){var t,e,r,i;if(!this.isProcessStart)return null;var n=this.output||new MediaStream,s=n.getVideoTracks().length>0,o=n.getAudioTracks().length>0,a=null===(e=null===(t=this.videoProcess)||void 0===t?void 0:t.getOutput())||void 0===e?void 0:e.getVideoTracks();!s&&(null==a?void 0:a.length)?n.addTrack(a[0]):s&&!(null==a?void 0:a.length)&&n.removeTrack(n.getVideoTracks()[0]);var h=null===(i=null===(r=this.audioProcess)||void 0===r?void 0:r.getOutput())||void 0===i?void 0:i.getAudioTracks();return!o&&(null==h?void 0:h.length)?n.addTrack(h[0]):o&&!(null==h?void 0:h.length)&&n.removeTrack(n.getAudioTracks()[0]),this.output=n,n},t.prototype.getRenderView=function(){var t;return null===(t=this.videoProcess)||void 0===t?void 0:t.getRenderView()},t.prototype.addVideoData=function(t){var e=this;if(this.videoProcess){var r=Dc(t).call(t,(function(t){return"video"===t.type||"text"===t.type}));Rc(r).call(r,(function(t){var r=t.id,i=t.order,n=void 0===i?0:i,s=t.items;Rc(s).call(s,(function(t){var i,s=t.id,o=t.type,a=t.source,h=t.width,l=void 0===h?e.resolution.width:h,c=t.height,u=void 0===c?e.resolution.height:c,d=t.position,p=void 0===d?{}:d,f=t.content,m=void 0===f?{}:f,g=t.operations,v=void 0===g?[]:g,y=p.x,b=void 0===y?0:y,_=p.y,x=void 0===_?0:_,T=m.text,w=void 0===T?"":T,S=m.text_style,E=void 0===S?{}:S,C=gc(i="".concat(r,"-")).call(i,s);if("video"===o||"image"===o){if(0===l||0===u)return;var A=a instanceof UA?a.getMediaStream():a,R=a instanceof UA?a.getRenderElement():null;if(!A)return;e.videoProcess.addStream({id:C,width:l,height:u,x:b,y:x,order:n,source:null!=R?R:A,operations:v})}else"text"===o&&e.videoProcess.addText({id:C,x:b,y:x,order:n,operations:v,content:w,style:E})}))}))}},t.prototype.removeVideoData=function(t){var e=this;if(this.videoProcess){var r=Dc(t).call(t,(function(t){return"video"===t.type||"text"===t.type}));Rc(r).call(r,(function(t){var r=t.id,i=t.items;Rc(i).call(i,(function(t){var i,n=t.id,s=t.type,o=gc(i="".concat(r,"-")).call(i,n);"video"===s||"image"===s?e.videoProcess.removeStream(o):"text"===s&&e.videoProcess.removeText(o)}))}))}},t.prototype.addAudioData=function(t){var e=this,r=Dc(t).call(t,(function(t){return"video"===t.type||"audio"===t.type}));Rc(r).call(r,(function(t){var r=t.id,i=t.items;Rc(i).call(i,(function(t){var i=t.id,n=t.type,s=t.source,o=t.operations,a=void 0===o?[]:o;if("video"===n||"audio"===n){var h,l=s instanceof UA?s.getMediaStream():s;if(!l)return;e.audioProcess.addStream({id:gc(h="".concat(r,"-")).call(h,i),source:l,operations:a})}}))}))},t.prototype.removeAudioData=function(t){var e=this,r=Dc(t).call(t,(function(t){return"video"===t.type||"audio"===t.type}));Rc(r).call(r,(function(t){var r=t.id,i=t.items;Rc(i).call(i,(function(t){var i,n=t.id,s=t.type;"video"!==s&&"audio"!==s||e.audioProcess.removeStream(gc(i="".concat(r,"-")).call(i,n))}))}))},t}();Xp.disable();var vj=Xp("app"),yj=function(){function t(){var t,e,r;this.videoView=null,this.canvasView=null,this.videoQuality=Td({},Yp["720p"]),this.audioQuality=Td(Td({},Zp.standard),{echoCancellation:!0,noiseSuppression:!0,autoGainControl:!0}),this.connectRetry={maxCount:3,curCount:0,delay:1,timeoutId:0},this.connection=null,this.isStreamPushing=!1,this.streamList=[],this.streamOutput=null,this.deviceManager=null,this.videoEffectManager=null,this.audioEffectManager=null,this.effectProcess=null,this.effectTrackList=[],this.observer={onError:null,onWarning:null,onCaptureFirstAudioFrame:null,onCaptureFirstVideoFrame:null,onPushStatusUpdate:null,onStatisticsUpdate:null},this.advancedSettings={signalingServer:null,metadata:null},this.onConnectionStatusUpdate=uc(t=this.onConnectionStatusUpdate).call(t,this),this.setProcessData=uc(e=this.setProcessData).call(e,this),this.getCommonData=uc(r=this.getCommonData).call(r,this),this.deviceManager=new jA({getCommonData:this.getCommonData}),this.videoEffectManager=new qA({getCommonData:this.getCommonData}),this.audioEffectManager=new tR({getCommonData:this.getCommonData})}return t.checkSupport=function(){return wd(void 0,void 0,void 0,(function(){var t;return Sd(this,(function(e){switch(e.label){case 0:return t={isWebRTCSupported:!(!window.RTCPeerConnection&&!window.webkitRTCPeerConnection)},[4,new zT((function(t){try{var e,r=new RTCPeerConnection({iceServers:[]});r.addEventListener("negotiationneeded",(function e(){r.createOffer().then((function(i){var n,s=$u(n=i.sdp.toLowerCase()).call(n,"h264");r.removeEventListener("negotiationneeded",e),r.close(),t(s)}))}));var i=document.createElement("canvas");i.getContext("2d");var n=i.captureStream(0);Rc(e=n.getTracks()).call(e,(function(t){r.addTrack(t,n)}))}catch(e){t(!1)}}))];case 1:return t.isH264EncodeSupported=e.sent(),[4,wd(void 0,void 0,void 0,(function(){var t,e,r,i;return Sd(this,(function(n){var s;switch(n.label){case 0:return n.trys.push([0,2,,3]),t=new RTCPeerConnection({iceServers:[],sdpSemantics:"unified-plan"}),e={},t.addTransceiver?(t.addTransceiver("audio",{direction:"recvonly"}),t.addTransceiver("video",{direction:"recvonly"})):e={offerToReceiveVideo:!0,offerToReceiveAudio:!0},[4,t.createOffer(e)];case 1:return r=n.sent(),i=$u(s=r.sdp.toLowerCase()).call(s,"h264"),t.close(),[2,i];case 2:return n.sent(),[2,!1];case 3:return[2]}}))}))];case 2:return[2,(t.isH264DecodeSupported=e.sent(),t.isMediaDevicesSupported=tw(),t.isScreenCaptureSupported=ew(),t.isMediaFileSupported=!(!document.createElement("canvas").captureStream||!window.AudioContext&&!window.webkitAudioContext),t)]}}))}))},t.init=function(){var t,e=Mp.browserDetails,r=e.browser,i=e.version;vj(gc(t="browser is ".concat(r,", version is ")).call(t,i));var n=document.body;if(n)if(window.TXLiveAudioContext)vj("TXLiveAudioContext is existed");else{var s=["touchstart","touchend","mouseup","click"],o=function t(){Rc(s).call(s,(function(e){return n.removeEventListener(e,t,!1)}));var e=new(window.AudioContext||window.webkitAudioContext);mv(e),window.TXLiveAudioContext=e};Rc(s).call(s,(function(t){return n.addEventListener(t,o,!1)}))}else vj("document.body is not existed")},t.prototype.setRenderView=function(t){if(this.videoView)vj("render view is existed");else{var e="string"==typeof t?document.getElementById(t):t;e&&e instanceof HTMLDivElement?this.videoView=vv({parentEl:e,style:zp,crossOrigin:!1,loop:!1}):vj("require container element id or HTMLDivElement")}},t.prototype.setVideoQuality=function(t){Yp[t]?this.videoQuality=Td(Td({},this.videoQuality),Yp[t]):vj("video quality ".concat(t," is not existed"))},t.prototype.setAudioQuality=function(t){Zp[t]?this.audioQuality=Td(Td({},this.audioQuality),Zp[t]):vj("audio quality ".concat(t," is not existed"))},t.prototype.setProperty=function(t,e){var r,i;switch(t){case"setVideoResolution":"object"===Xl(e)&&"number"==typeof e.width&&"number"==typeof e.height&&e.width>0&&e.height>0?(this.videoQuality.width=e.width,this.videoQuality.height=e.height):vj("videoResolution width and height must be a number greater than 0");break;case"setVideoFPS":"number"==typeof e&&e>0?this.videoQuality.frameRate=e:vj("videoFPS must be a number greater than 0");break;case"setVideoBitrate":"number"==typeof e&&e>0?(this.videoQuality.bitrate=e,null===(r=this.connection)||void 0===r||r.setVideoBitrate(e)):vj("videoBitrate must be a number greater than 0");break;case"setAudioSampleRate":"number"==typeof e&&e>0?this.audioQuality.sampleRate=e:vj("audioSampleRate must be a number greater than 0");break;case"setAudioBitrate":"number"==typeof e&&e>0?(this.audioQuality.bitrate=e,null===(i=this.connection)||void 0===i||i.setAudioBitrate(e)):vj("audioBitrate must be a number greater than 0");break;case"enableAudioAEC":this.audioQuality.echoCancellation=!!e;break;case"enableAudioAGC":this.audioQuality.autoGainControl=!!e;break;case"enableAudioANS":this.audioQuality.noiseSuppression=!!e;break;case"setConnectRetryCount":"number"==typeof e&&e>=0&&e<=10?this.connectRetry.maxCount=e:vj("connectRetryCount must be a number between 0 and ".concat(10));break;case"setConnectRetryDelay":"number"==typeof e&&e>=0&&e<=10?this.connectRetry.delay=e:vj("connectRetryDelay must be a number between 0 and ".concat(10));break;case"setMetadata":"object"===Xl(e)?this.advancedSettings.metadata=e?Td({},e):null:vj("metadata must be an object");break;case"setSignalingServer":"string"==typeof e?this.advancedSettings.signalingServer=e:vj("signalingServer must be string");break;case"enableLog":e?Xp.enable("*"):Xp.disable();break;default:vj("".concat(t," is not existed"))}},t.prototype.startCamera=function(t){var e,r,i;return wd(this,void 0,void 0,(function(){var n,s,o,a,h,l,c,u,d,p=this;return Sd(this,(function(f){switch(f.label){case 0:if(!this.videoEffectManager.enabled){if(this.isStreamPushing)throw vj("stream is pushing, please stop pushing first"),new Error("stream is pushing");if((null===(e=this.streamOutput)||void 0===e?void 0:e.getVideoTracks().length)>0)throw vj("video track is existed"),new Error("video track is existed")}n=Op(),s=new UA({type:"device",video:!0,audio:!1,onEvent:function(t){var e,r,i;t.type===cf&&"stream ended"===(null===(e=t.data)||void 0===e?void 0:e.message)&&(null===(i=(r=p.observer).onWarning)||void 0===i||i.call(r,Hp.TXLIVE_WARNING_CAMERA_INTERRUPTED,"interrupted",{streamId:n}))}}),o=this.videoQuality,a=o.frameRate,h=o.width,l=o.height,s.setVideoConfig({deviceId:t||"",frameRate:a,resolution:{width:h,height:l}}),f.label=1;case 1:return f.trys.push([1,3,,4]),[4,s.start()];case 2:return c=f.sent(),u=KA("video",s),this.initTrackData(u,c),this.streamList.push({id:n,type:"camera",source:s,track:u}),this.videoEffectManager.enabled?this.startVideoProcess():this.startVideoPlay(),[2,n];case 3:throw d=f.sent(),null===(i=(r=this.observer).onWarning)||void 0===i||i.call(r,Hp.TXLIVE_WARNING_CAMERA_START_FAILED,d.toString(),null),d;case 4:return[2]}}))}))},t.prototype.stopCamera=function(t){var e,r,i;if(this.videoEffectManager.enabled||!this.isStreamPushing){var n=Dc(e=this.streamList).call(e,(function(e){return"camera"===e.type&&(void 0===t||e.id===t)}));if(0!==n.length){var s=function(t,e){var r;e instanceof UA&&e.stop();var i,n=Hc(r=o.streamList).call(r,(function(e){return e.id===t}));-1!==n&&fu(i=o.streamList).call(i,n,1);o.videoEffectManager.enabled?o.updateVideoProcess():o.stopVideoPlay()},o=this;try{for(var a=Ed(n),h=a.next();!h.done;h=a.next()){var l=h.value;s(l.id,l.source)}}catch(t){r={error:t}}finally{try{h&&!h.done&&(i=a.return)&&i.call(a)}finally{if(r)throw r.error}}}else vj("camera stream is not existed")}else vj("stream is pushing, please stop pushing first")},t.prototype.startMicrophone=function(t){var e,r,i;return wd(this,void 0,void 0,(function(){var n,s,o,a,h,l,c,u,d,p,f=this;return Sd(this,(function(m){switch(m.label){case 0:if(!this.videoEffectManager.enabled){if(this.isStreamPushing)throw vj("stream is pushing, please stop pushing first"),new Error("stream is pushing");if((null===(e=this.streamOutput)||void 0===e?void 0:e.getAudioTracks().length)>0)throw vj("audio track is existed"),new Error("audio track is existed")}n=Op(),s=new UA({type:"device",video:!1,audio:!0,onEvent:function(t){var e,r,i;t.type===cf&&"stream ended"===(null===(e=t.data)||void 0===e?void 0:e.message)&&(null===(i=(r=f.observer).onWarning)||void 0===i||i.call(r,Hp.TXLIVE_WARNING_MICROPHONE_INTERRUPTED,"interrupted",{streamId:n}))}}),o=this.audioQuality,a=o.sampleRate,h=o.echoCancellation,l=o.noiseSuppression,c=o.autoGainControl,s.setAudioConfig({deviceId:t||"",sampleRate:a,echoCancellation:h,noiseSuppression:l,autoGainControl:c}),m.label=1;case 1:return m.trys.push([1,3,,4]),[4,s.start()];case 2:return u=m.sent(),d=KA("audio",s),this.initTrackData(d,u),this.streamList.push({id:n,type:"microphone",source:s,track:d}),this.videoEffectManager.enabled?this.startVideoProcess():this.startVideoPlay(),[2,n];case 3:throw p=m.sent(),null===(i=(r=this.observer).onWarning)||void 0===i||i.call(r,Hp.TXLIVE_WARNING_MICROPHONE_START_FAILED,p.toString(),null),p;case 4:return[2]}}))}))},t.prototype.stopMicrophone=function(t){var e,r,i;if(this.videoEffectManager.enabled||!this.isStreamPushing){var n=Dc(e=this.streamList).call(e,(function(e){return"microphone"===e.type&&(void 0===t||e.id===t)}));if(0!==n.length){var s=function(t,e){var r;e instanceof UA&&e.stop();var i,n=Hc(r=o.streamList).call(r,(function(e){return e.id===t}));-1!==n&&fu(i=o.streamList).call(i,n,1);o.videoEffectManager.enabled?o.updateVideoProcess():o.stopVideoPlay()},o=this;try{for(var a=Ed(n),h=a.next();!h.done;h=a.next()){var l=h.value;s(l.id,l.source)}}catch(t){r={error:t}}finally{try{h&&!h.done&&(i=a.return)&&i.call(a)}finally{if(r)throw r.error}}}else vj("microphone stream is not existed")}else vj("stream is pushing, please stop pushing first")},t.prototype.startScreenCapture=function(t){var e,r,i,n;return void 0===t&&(t=!1),wd(this,void 0,void 0,(function(){var s,o,a,h,l,c,u,d,p,f,m,g,v,y,b=this;return Sd(this,(function(_){switch(_.label){case 0:if(!this.videoEffectManager.enabled){if(this.isStreamPushing)throw vj("stream is pushing, please stop pushing first"),new Error("stream is pushing");if((null===(e=this.streamOutput)||void 0===e?void 0:e.getVideoTracks().length)>0)throw vj("video track is existed"),new Error("video track is existed");if(t&&(null===(r=this.streamOutput)||void 0===r?void 0:r.getAudioTracks().length)>0)throw vj("audio track is existed"),new Error("audio track is existed")}s=Op(),o=new UA({type:"screen",video:!0,audio:t,onEvent:function(t){var e,r,i;t.type===cf&&"stream ended"===(null===(e=t.data)||void 0===e?void 0:e.message)&&(null===(i=(r=b.observer).onWarning)||void 0===i||i.call(r,Hp.TXLIVE_WARNING_SCREEN_CAPTURE_INTERRUPTED,"interrupted",{streamId:s}))}}),a=this.videoQuality,h=a.frameRate,l=a.width,c=a.height,o.setVideoConfig({frameRate:h,resolution:{width:l,height:c}}),t&&(u=this.audioQuality,d=u.sampleRate,p=u.echoCancellation,f=u.noiseSuppression,m=u.autoGainControl,o.setAudioConfig({sampleRate:d,echoCancellation:p,noiseSuppression:f,autoGainControl:m})),_.label=1;case 1:return _.trys.push([1,3,,4]),[4,o.start()];case 2:return g=_.sent(),v=KA("video",o),this.initTrackData(v,g),this.streamList.push({id:s,type:"screen",source:o,track:v}),this.videoEffectManager.enabled?this.startVideoProcess():this.startVideoPlay(),[2,s];case 3:throw y=_.sent(),null===(n=(i=this.observer).onWarning)||void 0===n||n.call(i,Hp.TXLIVE_WARNING_SCREEN_CAPTURE_START_FAILED,y.toString(),null),y;case 4:return[2]}}))}))},t.prototype.stopScreenCapture=function(t){var e,r,i;if(this.videoEffectManager.enabled||!this.isStreamPushing){var n=Dc(e=this.streamList).call(e,(function(e){return"screen"===e.type&&(void 0===t||e.id===t)}));if(0!==n.length){var s=function(t,e){var r;e instanceof UA&&e.stop();var i,n=Hc(r=o.streamList).call(r,(function(e){return e.id===t}));-1!==n&&fu(i=o.streamList).call(i,n,1);o.videoEffectManager.enabled?o.updateVideoProcess():o.stopVideoPlay()},o=this;try{for(var a=Ed(n),h=a.next();!h.done;h=a.next()){var l=h.value;s(l.id,l.source)}}catch(t){r={error:t}}finally{try{h&&!h.done&&(i=a.return)&&i.call(a)}finally{if(r)throw r.error}}}else vj("screen stream is not existed")}else vj("stream is pushing, please stop pushing first")},t.prototype.startVirtualCamera=function(t){var e,r,i,n;return wd(this,void 0,void 0,(function(){var s,o,a,h,l,c,u,d,p,f;return Sd(this,(function(m){switch(m.label){case 0:if(!(t&&t instanceof File))throw vj("file is invalid"),new Error("file is invalid");if(s=function(t){var e="";switch(t.type){case"video/mp4":e="video";break;case"audio/mpeg":e="audio";break;case"image/jpeg":case"image/png":case"image/bmp":e="image";break;default:e=""}return e}(t),!s)throw vj("file type is invalid"),new Error("file type is invalid");if(!this.videoEffectManager.enabled){if(this.isStreamPushing)throw vj("stream is pushing, please stop pushing first"),new Error("stream is pushing");if(("video"===s||"image"===s)&&(null===(e=this.streamOutput)||void 0===e?void 0:e.getVideoTracks().length)>0)throw vj("video track is existed"),new Error("video track is existed");if(("video"===s||"audio"===s)&&(null===(r=this.streamOutput)||void 0===r?void 0:r.getAudioTracks().length)>0)throw vj("audio track is existed"),new Error("audio track is existed")}o=Op(),a=new UA({type:"file",video:"audio"!==s,audio:"image"!==s,fileSource:t}),h=this.videoQuality,l=h.frameRate,c=h.width,u=h.height,a.setVideoConfig({frameRate:l,resolution:{width:c,height:u}}),m.label=1;case 1:return m.trys.push([1,3,,4]),[4,a.start()];case 2:return d=m.sent(),p=KA("audio"!==s?"video":"audio",a),this.initTrackData(p,d),this.streamList.push({id:o,type:"file",source:a,track:p}),this.videoEffectManager.enabled?this.startVideoProcess():this.startVideoPlay(),[2,o];case 3:throw f=m.sent(),null===(n=(i=this.observer).onWarning)||void 0===n||n.call(i,Hp.TXLIVE_WARNING_VIRTUAL_CAMERA_START_FAILED,f.toString(),null),f;case 4:return[2]}}))}))},t.prototype.stopVirtualCamera=function(t){var e,r,i;if(this.videoEffectManager.enabled||!this.isStreamPushing){var n=Dc(e=this.streamList).call(e,(function(e){return"file"===e.type&&(void 0===t||e.id===t)}));if(0!==n.length){var s=function(t,e){var r;e instanceof UA&&e.stop();var i,n=Hc(r=o.streamList).call(r,(function(e){return e.id===t}));-1!==n&&fu(i=o.streamList).call(i,n,1);o.videoEffectManager.enabled?o.updateVideoProcess():o.stopVideoPlay()},o=this;try{for(var a=Ed(n),h=a.next();!h.done;h=a.next()){var l=h.value;s(l.id,l.source)}}catch(t){r={error:t}}finally{try{h&&!h.done&&(i=a.return)&&i.call(a)}finally{if(r)throw r.error}}}else vj("file stream is not existed")}else vj("stream is pushing, please stop pushing first")},t.prototype.startMediaFile=function(t){return this.startVirtualCamera(t)},t.prototype.stopMediaFile=function(t){return this.stopVirtualCamera(t)},t.prototype.startCustomCapture=function(t){var e,r;return wd(this,void 0,void 0,(function(){var i,n,s,o;return Sd(this,(function(a){if(!(t&&t instanceof MediaStream))throw vj("stream is invalid"),new Error("stream is invalid");if(i=t.getVideoTracks().length,n=t.getAudioTracks().length,0===i&&0===n)throw vj("stream is empty"),new Error("stream is empty");if(i>1||n>1)throw vj("the number of ".concat(i>1?"video":"audio"," tracks is greater than 1")),new Error("the number of ".concat(i>1?"video":"audio"," tracks is greater than 1"));if(!this.videoEffectManager.enabled){if(this.isStreamPushing)throw vj("stream is pushing, please stop pushing first"),new Error("stream is pushing");if(i>0&&(null===(e=this.streamOutput)||void 0===e?void 0:e.getVideoTracks().length)>0)throw vj("video track is existed"),new Error("video track is existed");if(n>0&&(null===(r=this.streamOutput)||void 0===r?void 0:r.getAudioTracks().length)>0)throw vj("audio track is existed"),new Error("audio track is existed")}return s=Op(),o=KA(i>0?"video":"audio",t),this.initTrackData(o,t),this.streamList.push({id:s,type:"custom",source:t,track:o}),this.videoEffectManager.enabled?this.startVideoProcess():this.startVideoPlay(),[2,s]}))}))},t.prototype.stopCustomCapture=function(t){var e,r,i;if(this.videoEffectManager.enabled||!this.isStreamPushing){var n=Dc(e=this.streamList).call(e,(function(e){return"custom"===e.type&&(void 0===t||e.id===t)}));if(0!==n.length){var s=function(t,e){var r,i,n=Hc(r=o.streamList).call(r,(function(e){return e.id===t}));-1!==n&&fu(i=o.streamList).call(i,n,1);o.videoEffectManager.enabled?o.updateVideoProcess():o.stopVideoPlay(e)},o=this;try{for(var a=Ed(n),h=a.next();!h.done;h=a.next()){var l=h.value;s(l.id,l.source)}}catch(t){r={error:t}}finally{try{h&&!h.done&&(i=a.return)&&i.call(a)}finally{if(r)throw r.error}}}else vj("custom stream is not existed")}else vj("stream is pushing, please stop pushing first")},t.prototype.startPush=function(t){var e,r;return wd(this,void 0,void 0,(function(){var i,n,s,o,a,h,l,c=this;return Sd(this,(function(u){switch(u.label){case 0:if(!t)throw vj("push url is not existed"),new Error("push url is not existed");if(this.isStreamPushing)throw vj("stream is pushing, please stop pushing first"),new Error("stream is pushing");if(!this.streamOutput)throw vj("no stream for pushing"),new Error("no stream for pushing");this.connection||(this.connection=new hR({onStatusUpdate:this.onConnectionStatusUpdate,onStatisticsUpdate:function(t){var e,r;null===(r=(e=c.observer).onStatisticsUpdate)||void 0===r||r.call(e,t)}})),this.connection.setUrl(t),this.connection.setStreamSource(this.streamOutput),this.connection.setVideoBitrate(this.videoQuality.bitrate),this.connection.setAudioBitrate(this.audioQuality.bitrate),i=this.advancedSettings,n=i.metadata,s=i.signalingServer,o=s?{domainName:s}:{},a=n||{videodatarate:this.videoQuality.bitrate,audiodatarate:this.audioQuality.bitrate},this.connection.setSignalingConfig(Td(Td({},o),{extraParams:{metadata:a}})),u.label=1;case 1:return u.trys.push([1,3,,4]),[4,this.connection.start()];case 2:return u.sent(),[3,4];case 3:throw h=u.sent(),l="RequestError"===h.name?Hp.TXLIVE_ERROR_REQUEST_FAILED:Hp.TXLIVE_ERROR_WEBRTC_FAILED,null===(r=(e=this.observer).onError)||void 0===r||r.call(e,l,h.toString(),null),h;case 4:return[2]}}))}))},t.prototype.stopPush=function(){var t;this.isStreamPushing?(this.connectRetry.timeoutId&&(window.clearTimeout(this.connectRetry.timeoutId),this.connectRetry.timeoutId=null,this.connectRetry.curCount=0),null===(t=this.connection)||void 0===t||t.stop()):vj("no stream is pushing")},t.prototype.isPushing=function(){return!(!this.streamOutput||!this.isStreamPushing)},t.prototype.getRenderView=function(){return this.videoView},t.prototype.getMediaStream=function(t){var e;if(!t)return vj("streamId is not existed"),null;var r=wu(e=this.streamList).call(e,(function(e){return e.id===t}));return r?r.source instanceof UA?r.source.getMediaStream():r.source:(vj("stream is not existed"),null)},t.prototype.getDeviceManager=function(){return this.deviceManager},t.prototype.getVideoEffectManager=function(){return this.videoEffectManager},t.prototype.getAudioEffectManager=function(){return this.audioEffectManager},t.prototype.setVideoMute=function(t){var e,r;null===(r=this.streamOutput)||void 0===r||Rc(e=r.getVideoTracks()).call(e,(function(e){e.enabled=!t})),this.canvasView&&(t?this.canvasView.style.filter="brightness(0%)":this.canvasView.style.removeProperty("filter"))},t.prototype.setAudioMute=function(t){var e,r;null===(r=this.streamOutput)||void 0===r||Rc(e=r.getAudioTracks()).call(e,(function(e){e.enabled=!t}))},t.prototype.pauseVideo=function(){this.setVideoMute(!0)},t.prototype.pauseAudio=function(){this.setAudioMute(!0)},t.prototype.resumeVideo=function(){this.setVideoMute(!1)},t.prototype.resumeAudio=function(){this.setAudioMute(!1)},t.prototype.setVideoContentHint=function(t){var e,r;null===(r=this.streamOutput)||void 0===r||Rc(e=r.getVideoTracks()).call(e,(function(e){e.contentHint=t}))},t.prototype.setObserver=function(t){var e,r=this,i=Cu(this.observer);Rc(e=Cu(t)).call(e,(function(e){var n=t[e];$u(i).call(i,e)&&"function"==typeof n&&(r.observer[e]=n)}))},t.prototype.destroy=function(){var t,e;(this.connectRetry.timeoutId&&(window.clearTimeout(this.connectRetry.timeoutId),this.connectRetry.timeoutId=null),this.connection&&(this.connection.stop(),this.connection=null),this.effectProcess&&(this.effectProcess.stop(),this.effectProcess=null),this.streamList)&&(Rc(t=this.streamList).call(t,(function(t){t.source instanceof UA&&t.source.stop()})),this.streamList=null);this.streamOutput&&(Rc(e=this.streamOutput.getTracks()).call(e,(function(t){"ended"!==t.readyState&&t.stop()})),this.streamOutput=null);this.videoView&&(this.videoView.pause(),this.videoView.srcObject=null,this.videoView.load(),this.videoView.remove(),this.videoView=null),this.canvasView&&(this.canvasView.remove(),this.canvasView=null),this.observer=null,this.deviceManager=null,this.videoEffectManager=null,this.audioEffectManager=null},t.prototype.onConnectionStatusUpdate=function(t){var e,r,i,n,s,o,a,h=this;t.type===Qp?(this.isStreamPushing=!0,this.connectRetry.curCount=0,null===(r=(e=this.observer).onPushStatusUpdate)||void 0===r||r.call(e,Wp.TXLIVE_PUSH_STATUS_CONNECTED,"connected",null)):t.type===Jp?(this.isStreamPushing=!1,"connection disconnected"===(null===(i=t.data)||void 0===i?void 0:i.message)?(this.connection.stop(),this.connectRetry.timeoutId&&(window.clearTimeout(this.connectRetry.timeoutId),this.connectRetry.timeoutId=null),this.connectRetry.timeoutId=ld((function(){var t,e,r,i;h.connectRetry.curCount+=1;var n,s=h.connectRetry,o=s.curCount,a=s.maxCount;o<=a?(vj(gc(n="current retry count: ".concat(o,", max retry count: ")).call(n,a)),null===(e=(t=h.observer).onPushStatusUpdate)||void 0===e||e.call(t,Wp.TXLIVE_PUSH_STATUS_RECONNECTING,"reconnecting",null),h.connection.start().catch((function(t){var e,r;vj("reconnect error, ".concat(t.toString())),"RequestError"===t.name&&(null===(r=(e=h.observer).onError)||void 0===r||r.call(e,Hp.TXLIVE_ERROR_REQUEST_FAILED,t.toString(),null))}))):(null===(i=(r=h.observer).onPushStatusUpdate)||void 0===i||i.call(r,Wp.TXLIVE_PUSH_STATUS_DISCONNECTED,"disconnected",null),h.connectRetry.curCount=0,h.stopVideoProcess());h.connectRetry.timeoutId=null}),1e3*this.connectRetry.delay)):(null===(s=(n=this.observer).onPushStatusUpdate)||void 0===s||s.call(n,Wp.TXLIVE_PUSH_STATUS_DISCONNECTED,"disconnected",null),this.stopVideoProcess())):t.type===qp&&(null===(a=(o=this.observer).onPushStatusUpdate)||void 0===a||a.call(o,Wp.TXLIVE_PUSH_STATUS_CONNECTING,"connecting",null))},t.prototype.initTrackData=function(t,e){if(e.getVideoTracks().length>0){var r,i=Dc(r=this.streamList).call(r,(function(t){var e,r=t.source,i=r instanceof UA?r.getMediaStream():r;return null===(e=null==i?void 0:i.getVideoTracks())||void 0===e?void 0:e.length}));t.setOrder(i.length)}e.getAudioTracks().length>0&&t.setVolume(100)},t.prototype.setProcessData=function(){var t,e,r,i,n,s,o=null;this.videoEffectManager.enabled?o=md(e=gc(r=md(i=this.streamList).call(i,(function(t){return t.track}))).call(r,this.effectTrackList)).call(e,(function(t){return t.data})):o=md(n=Dc(s=this.streamList).call(s,(function(t){var e,r=t.source,i=r instanceof UA?r.getMediaStream():r;return null===(e=null==i?void 0:i.getAudioTracks())||void 0===e?void 0:e.length}))).call(n,(function(t){return t.track.data}));null===(t=this.effectProcess)||void 0===t||t.setData(o)},t.prototype.startVideoPlay=function(){var t,e,r,i,n;return wd(this,void 0,void 0,(function(){var s,o,a,h,l,c,u,d;return Sd(this,(function(p){switch(p.label){case 0:return this.streamOutput||(this.streamOutput=new MediaStream),this.effectProcess||(this.effectProcess=new gj),s=this.streamList[this.streamList.length-1],o=s.source,a=o instanceof UA?o.getMediaStream():o,h=null,a.getAudioTracks().length>0?(this.setProcessData(),this.effectProcess.isStart()?[3,2]:(this.effectProcess.setResolution({width:0,height:0}),[4,this.effectProcess.start()])):[3,3];case 1:p.sent(),p.label=2;case 2:h=this.effectProcess.getOutput(),p.label=3;case 3:if(l=a.getVideoTracks(),0===this.streamOutput.getVideoTracks().length&&l.length>0&&(this.streamOutput.addTrack(l[0]),null===(e=(t=this.observer).onCaptureFirstVideoFrame)||void 0===e||e.call(t)),c=null==h?void 0:h.getAudioTracks(),0===this.streamOutput.getAudioTracks().length&&(null==c?void 0:c.length)>0&&(this.streamOutput.addTrack(c[0]),null===(i=(r=this.observer).onCaptureFirstAudioFrame)||void 0===i||i.call(r)),!this.videoView)return[2];var f;if(!this.canvasView)if(u=qT&&o instanceof UA?o.getRenderView():null)u.setAttribute("style",zp),this.canvasView=u,this.videoView.setAttribute("style",gc(f="".concat(zp)).call(f,fv)),null===(n=this.videoView.parentElement)||void 0===n||n.insertBefore(u,this.videoView);if(this.videoView.srcObject)return[2];if(this.videoView.srcObject=this.streamOutput,this.videoView.load(),!this.videoView.autoplay)return[2];p.label=4;case 4:return p.trys.push([4,6,,7]),[4,this.videoView.play()];case 5:return p.sent(),vj("play ok"),[3,7];case 6:return d=p.sent(),vj("play failed",d),[3,7];case 7:return[2]}}))}))},t.prototype.stopVideoPlay=function(t){var e,r,i=this;if(this.streamOutput){var n,s=null===(e=this.effectProcess)||void 0===e?void 0:e.getOutput();if(null===(r=null==s?void 0:s.getAudioTracks())||void 0===r?void 0:r.length)xd(n=this.streamList).call(n,(function(t){var e=t.source;return e instanceof UA?!!e.getAudioTrack():e.getAudioTracks().length>0}))||(this.streamOutput.removeTrack(s.getAudioTracks()[0]),this.effectProcess.stop());var o,a=this.streamOutput.getTracks();if(Rc(a).call(a,(function(t){"ended"===t.readyState&&i.streamOutput.removeTrack(t)})),t&&t instanceof MediaStream)Rc(o=t.getTracks()).call(o,(function(t){i.streamOutput.removeTrack(t)}));this.canvasView&&0===this.streamOutput.getVideoTracks().length&&(this.canvasView.remove(),this.canvasView=null,this.videoView.setAttribute("style",zp)),this.streamOutput.getTracks().length>0||(this.streamOutput=null,this.videoView&&(this.videoView.pause(),this.videoView.srcObject=null,this.videoView.load()))}},t.prototype.startVideoProcess=function(){var t,e,r,i,n,s,o;return wd(this,void 0,void 0,(function(){var a,h,l,c,u,d,p,f,m,g,v,y,b,_,x,T,w,S,E;return Sd(this,(function(C){switch(C.label){case 0:var A;if(this.streamOutput||(this.streamOutput=new MediaStream),this.effectProcess||(this.effectProcess=new gj),a=this.videoEffectManager.getMixingConfig(),h=a.videoWidth,l=a.videoHeight,c=a.videoFramerate,u=a.backgroundColor,d=this.streamList[this.streamList.length-1],p=d.source,f=p instanceof UA?p.getMediaStream():p,null===(t=null==f?void 0:f.getVideoTracks())||void 0===t?void 0:t.length)m=null!==(e=p instanceof UA?p.getResolution():f.getVideoTracks()[0].getSettings())&&void 0!==e?e:{},g=Dc(A=this.streamList).call(A,(function(t){var e,r=t.source,i=r instanceof UA?r.getMediaStream():r;return null===(e=null==i?void 0:i.getVideoTracks())||void 0===e?void 0:e.length})),1===g.length?d.track.setLayout({width:h,height:l,x:h/2,y:l/2}):(v=m.width,y=m.height,b=null!=v?v:h,_=null!=y?y:l,d.track.setLayout({width:b/2,height:_/2,x:b/4,y:_/4}));return this.setProcessData(),this.effectProcess.isStart()?[3,2]:(this.effectProcess.setResolution({width:h,height:l}),this.effectProcess.setFrameRate(c),this.effectProcess.setBackgroundColor(u),[4,this.effectProcess.start()]);case 1:C.sent(),C.label=2;case 2:if(x=this.effectProcess.getOutput(),T=x.getVideoTracks(),0===this.streamOutput.getVideoTracks().length&&T.length>0&&(this.streamOutput.addTrack(T[0]),null===(i=(r=this.observer).onCaptureFirstVideoFrame)||void 0===i||i.call(r)),w=x.getAudioTracks(),0===this.streamOutput.getAudioTracks().length&&w.length>0&&(this.streamOutput.addTrack(w[0]),null===(s=(n=this.observer).onCaptureFirstAudioFrame)||void 0===s||s.call(n)),!this.videoView)return[2];var R;if(!this.canvasView)if(S=qT?this.effectProcess.getRenderView():null)S.setAttribute("style",zp),this.canvasView=S,this.videoView.setAttribute("style",gc(R="".concat(zp)).call(R,fv)),null===(o=this.videoView.parentElement)||void 0===o||o.insertBefore(S,this.videoView);if(this.videoView.srcObject)return[2];if(this.videoView.srcObject=this.streamOutput,this.videoView.load(),!this.videoView.autoplay)return[2];C.label=3;case 3:return C.trys.push([3,5,,6]),[4,this.videoView.play()];case 4:return C.sent(),vj("play ok"),[3,6];case 5:return E=C.sent(),vj("play failed",E),[3,6];case 6:return[2]}}))}))},t.prototype.updateVideoProcess=function(){0!==this.streamList.length||this.isStreamPushing?this.setProcessData():this.stopVideoProcess()},t.prototype.stopVideoProcess=function(){var t,e=this;if(this.videoEffectManager.enabled&&this.streamOutput&&0===this.streamList.length){var r,i=null===(t=this.effectProcess)||void 0===t?void 0:t.getOutput();if(i)Rc(r=i.getTracks()).call(r,(function(t){e.streamOutput.removeTrack(t)})),this.effectProcess.stop();this.streamOutput=null,this.canvasView&&(this.canvasView.remove(),this.canvasView=null,this.videoView.setAttribute("style",zp)),this.videoView&&(this.videoView.pause(),this.videoView.srcObject=null,this.videoView.load())}},t.prototype.getCommonData=function(){return{streamList:this.streamList,videoEffectManager:this.videoEffectManager,observer:this.observer,videoQuality:this.videoQuality,audioQuality:this.audioQuality,streamOutput:this.streamOutput,isStreamPushing:this.isStreamPushing,connection:this.connection,setProcessData:this.setProcessData,effectTrackList:this.effectTrackList,effectProcess:this.effectProcess}},t}();return yj.init(),yj}));
