@prefecthq/graphs 2.1.0 → 2.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/graphs.mjs +5405 -5286
- package/dist/graphs.mjs.map +1 -1
- package/dist/graphs.umd.js +65 -65
- package/dist/graphs.umd.js.map +1 -1
- package/dist/types/src/factories/label.d.ts +1 -2
- package/dist/types/src/factories/playhead.d.ts +4 -0
- package/dist/types/src/models/RunGraph.d.ts +9 -3
- package/dist/types/src/objects/cache.d.ts +4 -0
- package/dist/types/src/objects/playhead.d.ts +2 -0
- package/dist/types/src/objects/selection.d.ts +1 -0
- package/package.json +1 -1
package/dist/graphs.umd.js
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
(function(oe,H){typeof exports=="object"&&typeof module<"u"?H(exports,require("vue"),require("@prefecthq/vue-compositions"),require("@prefecthq/prefect-design")):typeof define=="function"&&define.amd?define(["exports","vue","@prefecthq/vue-compositions","@prefecthq/prefect-design"],H):(oe=typeof globalThis<"u"?globalThis:oe||self,H(oe["prefect-graphs"]={},oe.Vue,oe.vueCompositions,oe.prefectDesign))})(this,function(oe,H,gi,Zi){"use strict";var yR=Object.defineProperty;var bR=(oe,H,gi)=>H in oe?yR(oe,H,{enumerable:!0,configurable:!0,writable:!0,value:gi}):oe[H]=gi;var op=(oe,H,gi)=>(bR(oe,typeof H!="symbol"?H+"":H,gi),gi);const fp="nodes-container",wb="node-container",Sb="edge-container";function ll(r){"@babel/helpers - typeof";return ll=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ll(r)}function mp(r){if(r===null||r===!0||r===!1)return NaN;var t=Number(r);return isNaN(t)?t:t<0?Math.ceil(t):Math.floor(t)}function Pn(r,t){if(t.length<r)throw new TypeError(r+" argument"+(r>1?"s":"")+" required, but only "+t.length+" present")}function ul(r){Pn(1,arguments);var t=Object.prototype.toString.call(r);return r instanceof Date||ll(r)==="object"&&t==="[object Date]"?new Date(r.getTime()):typeof r=="number"||t==="[object Number]"?new Date(r):((typeof r=="string"||t==="[object String]")&&typeof console<"u"&&(console.warn("Starting with v2.0.0-beta.1 date-fns doesn't accept strings as date arguments. Please use `parseISO` to parse strings. See: https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#string-arguments"),console.warn(new Error().stack)),new Date(NaN))}function Eb(r,t){Pn(2,arguments);var e=ul(r).getTime(),i=mp(t);return new Date(e+i)}function Cb(r,t){Pn(2,arguments);var e=mp(t);return Eb(r,e*1e3)}var Ib=1e3,gp=3600;function yp(r,t){return Pn(2,arguments),ul(r).getTime()-ul(t).getTime()}var bp={ceil:Math.ceil,round:Math.round,floor:Math.floor,trunc:function(t){return t<0?Math.ceil(t):Math.floor(t)}},Ab="trunc";function Mb(r){return r?bp[r]:bp[Ab]}function Rb(r,t,e){Pn(2,arguments);var i=yp(r,t)/1e3;return Mb(e==null?void 0:e.roundingMethod)(i)}var qe=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Ln(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}function Pb(r){if(r.__esModule)return r;var t=r.default;if(typeof t=="function"){var e=function i(){return this instanceof i?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};e.prototype=t.prototype}else e={};return Object.defineProperty(e,"__esModule",{value:!0}),Object.keys(r).forEach(function(i){var s=Object.getOwnPropertyDescriptor(r,i);Object.defineProperty(e,i,s.get?s:{enumerable:!0,get:function(){return r[i]}})}),e}var Ko={exports:{}};Ko.exports,function(r,t){var e=200,i="__lodash_hash_undefined__",s=800,n=16,o=9007199254740991,a="[object Arguments]",h="[object Array]",l="[object AsyncFunction]",u="[object Boolean]",c="[object Date]",d="[object Error]",p="[object Function]",m="[object GeneratorFunction]",f="[object Map]",g="[object Number]",y="[object Null]",_="[object Object]",x="[object Proxy]",v="[object RegExp]",S="[object Set]",C="[object String]",A="[object Undefined]",I="[object WeakMap]",L="[object ArrayBuffer]",k="[object DataView]",M="[object Float32Array]",G="[object Float64Array]",E="[object Int8Array]",N="[object Int16Array]",O="[object Int32Array]",Z="[object Uint8Array]",U="[object Uint8ClampedArray]",K="[object Uint16Array]",ht="[object Uint32Array]",X=/[\\^$.*+?()[\]{}|]/g,W=/^\[object .+?Constructor\]$/,j=/^(?:0|[1-9]\d*)$/,q={};q[M]=q[G]=q[E]=q[N]=q[O]=q[Z]=q[U]=q[K]=q[ht]=!0,q[a]=q[h]=q[L]=q[u]=q[k]=q[c]=q[d]=q[p]=q[f]=q[g]=q[_]=q[v]=q[S]=q[C]=q[I]=!1;var pt=typeof qe=="object"&&qe&&qe.Object===Object&&qe,at=typeof self=="object"&&self&&self.Object===Object&&self,It=pt||at||Function("return this")(),Nt=t&&!t.nodeType&&t,wt=Nt&&!0&&r&&!r.nodeType&&r,Y=wt&&wt.exports===Nt,et=Y&&pt.process,Q=function(){try{var b=wt&&wt.require&&wt.require("util").types;return b||et&&et.binding&&et.binding("util")}catch{}}(),F=Q&&Q.isTypedArray;function yt(b,w,P){switch(P.length){case 0:return b.call(w);case 1:return b.call(w,P[0]);case 2:return b.call(w,P[0],P[1]);case 3:return b.call(w,P[0],P[1],P[2])}return b.apply(w,P)}function mt(b,w){for(var P=-1,B=Array(b);++P<b;)B[P]=w(P);return B}function Mt(b){return function(w){return b(w)}}function Ut(b,w){return b==null?void 0:b[w]}function Fe(b,w){return function(P){return b(w(P))}}var ci=Array.prototype,Sd=Function.prototype,gn=Object.prototype,Io=It["__core-js_shared__"],yn=Sd.toString,di=gn.hasOwnProperty,kh=function(){var b=/[^.]+$/.exec(Io&&Io.keys&&Io.keys.IE_PROTO||"");return b?"Symbol(src)_1."+b:""}(),Oh=gn.toString,Ed=yn.call(Object),bn=RegExp("^"+yn.call(di).replace(X,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Nr=Y?It.Buffer:void 0,Ao=It.Symbol,De=It.Uint8Array,Mo=Nr?Nr.allocUnsafe:void 0,Ro=Fe(Object.getPrototypeOf,Object),Bh=Object.create,Wh=gn.propertyIsEnumerable,xn=ci.splice,ki=Ao?Ao.toStringTag:void 0,vs=function(){try{var b=Oo(Object,"defineProperty");return b({},"",{}),b}catch{}}(),Cd=Nr?Nr.isBuffer:void 0,Oi=Math.max,Uh=Date.now,Xh=Oo(It,"Map"),Ts=Oo(Object,"create"),Po=function(){function b(){}return function(w){if(!Ui(w))return{};if(Bh)return Bh(w);b.prototype=w;var P=new b;return b.prototype=void 0,P}}();function ke(b){var w=-1,P=b==null?0:b.length;for(this.clear();++w<P;){var B=b[w];this.set(B[0],B[1])}}function Lo(){this.__data__=Ts?Ts(null):{},this.size=0}function Go(b){var w=this.has(b)&&delete this.__data__[b];return this.size-=w?1:0,w}function No(b){var w=this.__data__;if(Ts){var P=w[b];return P===i?void 0:P}return di.call(w,b)?w[b]:void 0}function ws(b){var w=this.__data__;return Ts?w[b]!==void 0:di.call(w,b)}function Id(b,w){var P=this.__data__;return this.size+=this.has(b)?0:1,P[b]=Ts&&w===void 0?i:w,this}ke.prototype.clear=Lo,ke.prototype.delete=Go,ke.prototype.get=No,ke.prototype.has=ws,ke.prototype.set=Id;function pi(b){var w=-1,P=b==null?0:b.length;for(this.clear();++w<P;){var B=b[w];this.set(B[0],B[1])}}function Ad(){this.__data__=[],this.size=0}function Md(b){var w=this.__data__,P=_n(w,b);if(P<0)return!1;var B=w.length-1;return P==B?w.pop():xn.call(w,P,1),--this.size,!0}function Rd(b){var w=this.__data__,P=_n(w,b);return P<0?void 0:w[P][1]}function Zh(b){return _n(this.__data__,b)>-1}function Fo(b,w){var P=this.__data__,B=_n(P,b);return B<0?(++this.size,P.push([b,w])):P[B][1]=w,this}pi.prototype.clear=Ad,pi.prototype.delete=Md,pi.prototype.get=Rd,pi.prototype.has=Zh,pi.prototype.set=Fo;function Ee(b){var w=-1,P=b==null?0:b.length;for(this.clear();++w<P;){var B=b[w];this.set(B[0],B[1])}}function Pd(){this.size=0,this.__data__={hash:new ke,map:new(Xh||pi),string:new ke}}function Ld(b){var w=Tn(this,b).delete(b);return this.size-=w?1:0,w}function Gd(b){return Tn(this,b).get(b)}function Nd(b){return Tn(this,b).has(b)}function Fd(b,w){var P=Tn(this,b),B=P.size;return P.set(b,w),this.size+=P.size==B?0:1,this}Ee.prototype.clear=Pd,Ee.prototype.delete=Ld,Ee.prototype.get=Gd,Ee.prototype.has=Nd,Ee.prototype.set=Fd;function fe(b){var w=this.__data__=new pi(b);this.size=w.size}function Dd(){this.__data__=new pi,this.size=0}function kd(b){var w=this.__data__,P=w.delete(b);return this.size=w.size,P}function Od(b){return this.__data__.get(b)}function Bd(b){return this.__data__.has(b)}function Wd(b,w){var P=this.__data__;if(P instanceof pi){var B=P.__data__;if(!Xh||B.length<e-1)return B.push([b,w]),this.size=++P.size,this;P=this.__data__=new Ee(B)}return P.set(b,w),this.size=P.size,this}fe.prototype.clear=Dd,fe.prototype.delete=kd,fe.prototype.get=Od,fe.prototype.has=Bd,fe.prototype.set=Wd;function lr(b,w){var P=En(b),B=!P&&fi(b),ot=!P&&!B&&$h(b),dt=!P&&!B&&!ot&&Dr(b),gt=P||B||ot||dt,st=gt?mt(b.length,String):[],bt=st.length;for(var Ft in b)(w||di.call(b,Ft))&&!(gt&&(Ft=="length"||ot&&(Ft=="offset"||Ft=="parent")||dt&&(Ft=="buffer"||Ft=="byteLength"||Ft=="byteOffset")||jh(Ft,bt)))&&st.push(Ft);return st}function Do(b,w,P){(P!==void 0&&!Sn(b[w],P)||P===void 0&&!(w in b))&&ko(b,w,P)}function Ud(b,w,P){var B=b[w];(!(di.call(b,w)&&Sn(B,P))||P===void 0&&!(w in b))&&ko(b,w,P)}function _n(b,w){for(var P=b.length;P--;)if(Sn(b[P][0],w))return P;return-1}function ko(b,w,P){w=="__proto__"&&vs?vs(b,w,{configurable:!0,enumerable:!0,value:P,writable:!0}):b[w]=P}var Xd=Jd();function ur(b){return b==null?b===void 0?A:y:ki&&ki in Object(b)?$d(b):tp(b)}function Vh(b){return Fr(b)&&ur(b)==a}function Zd(b){if(!Ui(b)||wn(b))return!1;var w=Es(b)?bn:W;return w.test(rp(b))}function Bi(b){return Fr(b)&&Qh(b.length)&&!!q[ur(b)]}function Vd(b){if(!Ui(b))return qd(b);var w=cr(b),P=[];for(var B in b)B=="constructor"&&(w||!di.call(b,B))||P.push(B);return P}function Hh(b,w,P,B,ot){b!==w&&Xd(w,function(dt,gt){if(ot||(ot=new fe),Ui(dt))Hd(b,w,gt,P,Hh,B,ot);else{var st=B?B(Bo(b,gt),dt,gt+"",b,w,ot):void 0;st===void 0&&(st=dt),Do(b,gt,st)}},el)}function Hd(b,w,P,B,ot,dt,gt){var st=Bo(b,P),bt=Bo(w,P),Ft=gt.get(bt);if(Ft){Do(b,P,Ft);return}var At=dt?dt(st,bt,P+"",b,w,gt):void 0,ne=At===void 0;if(ne){var me=En(bt),$e=!me&&$h(bt),Qe=!me&&!$e&&Dr(bt);At=bt,me||$e||Qe?En(st)?At=st:Cn(st)?At=Ss(st):$e?(ne=!1,At=zd(bt,!0)):Qe?(ne=!1,At=jd(bt,!0)):At=[]:qh(bt)||fi(bt)?(At=st,fi(st)?At=tl(st):(!Ui(st)||Es(st))&&(At=zh(bt))):ne=!1}ne&&(gt.set(bt,At),ot(At,bt,B,dt,gt),gt.delete(bt)),Do(b,P,At)}function Kd(b,w){return ep(Wi(b,w,T),b+"")}var Yd=vs?function(b,w){return vs(b,"toString",{configurable:!0,enumerable:!1,value:np(w),writable:!0})}:T;function zd(b,w){if(w)return b.slice();var P=b.length,B=Mo?Mo(P):new b.constructor(P);return b.copy(B),B}function vn(b){var w=new b.constructor(b.byteLength);return new De(w).set(new De(b)),w}function jd(b,w){var P=w?vn(b.buffer):b.buffer;return new b.constructor(P,b.byteOffset,b.length)}function Ss(b,w){var P=-1,B=b.length;for(w||(w=Array(B));++P<B;)w[P]=b[P];return w}function Kh(b,w,P,B){var ot=!P;P||(P={});for(var dt=-1,gt=w.length;++dt<gt;){var st=w[dt],bt=B?B(P[st],b[st],st,P,b):void 0;bt===void 0&&(bt=b[st]),ot?ko(P,st,bt):Ud(P,st,bt)}return P}function Yh(b){return Kd(function(w,P){var B=-1,ot=P.length,dt=ot>1?P[ot-1]:void 0,gt=ot>2?P[2]:void 0;for(dt=b.length>3&&typeof dt=="function"?(ot--,dt):void 0,gt&&Qd(P[0],P[1],gt)&&(dt=ot<3?void 0:dt,ot=1),w=Object(w);++B<ot;){var st=P[B];st&&b(w,st,B,dt)}return w})}function Jd(b){return function(w,P,B){for(var ot=-1,dt=Object(w),gt=B(w),st=gt.length;st--;){var bt=gt[b?st:++ot];if(P(dt[bt],bt,dt)===!1)break}return w}}function Tn(b,w){var P=b.__data__;return Jh(w)?P[typeof w=="string"?"string":"hash"]:P.map}function Oo(b,w){var P=Ut(b,w);return Zd(P)?P:void 0}function $d(b){var w=di.call(b,ki),P=b[ki];try{b[ki]=void 0;var B=!0}catch{}var ot=Oh.call(b);return B&&(w?b[ki]=P:delete b[ki]),ot}function zh(b){return typeof b.constructor=="function"&&!cr(b)?Po(Ro(b)):{}}function jh(b,w){var P=typeof b;return w=w??o,!!w&&(P=="number"||P!="symbol"&&j.test(b))&&b>-1&&b%1==0&&b<w}function Qd(b,w,P){if(!Ui(P))return!1;var B=typeof w;return(B=="number"?Wo(P)&&jh(w,P.length):B=="string"&&w in P)?Sn(P[w],b):!1}function Jh(b){var w=typeof b;return w=="string"||w=="number"||w=="symbol"||w=="boolean"?b!=="__proto__":b===null}function wn(b){return!!kh&&kh in b}function cr(b){var w=b&&b.constructor,P=typeof w=="function"&&w.prototype||gn;return b===P}function qd(b){var w=[];if(b!=null)for(var P in Object(b))w.push(P);return w}function tp(b){return Oh.call(b)}function Wi(b,w,P){return w=Oi(w===void 0?b.length-1:w,0),function(){for(var B=arguments,ot=-1,dt=Oi(B.length-w,0),gt=Array(dt);++ot<dt;)gt[ot]=B[w+ot];ot=-1;for(var st=Array(w+1);++ot<w;)st[ot]=B[ot];return st[w]=P(gt),yt(b,this,st)}}function Bo(b,w){if(!(w==="constructor"&&typeof b[w]=="function")&&w!="__proto__")return b[w]}var ep=ip(Yd);function ip(b){var w=0,P=0;return function(){var B=Uh(),ot=n-(B-P);if(P=B,ot>0){if(++w>=s)return arguments[0]}else w=0;return b.apply(void 0,arguments)}}function rp(b){if(b!=null){try{return yn.call(b)}catch{}try{return b+""}catch{}}return""}function Sn(b,w){return b===w||b!==b&&w!==w}var fi=Vh(function(){return arguments}())?Vh:function(b){return Fr(b)&&di.call(b,"callee")&&!Wh.call(b,"callee")},En=Array.isArray;function Wo(b){return b!=null&&Qh(b.length)&&!Es(b)}function Cn(b){return Fr(b)&&Wo(b)}var $h=Cd||R;function Es(b){if(!Ui(b))return!1;var w=ur(b);return w==p||w==m||w==l||w==x}function Qh(b){return typeof b=="number"&&b>-1&&b%1==0&&b<=o}function Ui(b){var w=typeof b;return b!=null&&(w=="object"||w=="function")}function Fr(b){return b!=null&&typeof b=="object"}function qh(b){if(!Fr(b)||ur(b)!=_)return!1;var w=Ro(b);if(w===null)return!0;var P=di.call(w,"constructor")&&w.constructor;return typeof P=="function"&&P instanceof P&&yn.call(P)==Ed}var Dr=F?Mt(F):Bi;function tl(b){return Kh(b,el(b))}function el(b){return Wo(b)?lr(b,!0):Vd(b)}var sp=Yh(function(b,w,P){Hh(b,w,P)});function np(b){return function(){return b}}function T(b){return b}function R(){return!1}r.exports=sp}(Ko,Ko.exports);var Lb=Ko.exports;const Gb=Ln(Lb);function Nb(){const r=new Map;function t(o,a){const h=r.get(o);return h?h.add(a):r.set(o,new Set([a])),()=>i(o,a)}function e(o,a){const h=l=>{i(o,h),a(l)};t(o,h)}function i(o,a){var h;(h=r.get(o))==null||h.delete(a)}function s(o,a){var h;(h=r.get(o))==null||h.forEach(l=>l(a))}function n(){r.clear()}return{on:t,off:i,once:e,emit:s,clear:n}}const Ct=Nb();function Be(r){let t;return new Promise(e=>{t=e,Ct.on(r,t)}).then(e=>(Ct.off(r,t),e))}let kr=null;function Fb(){kr=H.effectScope()}function Db(){kr==null||kr.stop(),kr=null}async function kb(){return kr||await Be("scopeCreated")}let Is=null;const xp={animationDuration:500,disableAnimationsThreshold:500,disableEdgesThreshold:100,styles:{rowGap:16,columnGap:32,nodesPadding:16,nodeHeight:32,nodePadding:4,nodeRadius:6,nodeBorderRadius:9,nodeToggleSize:28,nodeToggleBorderRadius:6,nodeToggleBorderColor:"#51525C",nodeSelectedBorderColor:"#3fa2c3",edgeColor:"#51525C",guideLineWidth:1,guideLineColor:"#51525C",guideTextTopPadding:8,guideTextLeftPadding:8,guideTextSize:12,guideTextColor:"#ADADAD",node:()=>({background:"#ffffff"})}};function Ob(r){const t=Gb({},xp,r);return t.styles.node=e=>{var i,s;return{...xp.styles.node(e),...(s=(i=r.styles)==null?void 0:i.node)==null?void 0:s.call(i,e)}},t}async function Bb(r){(await kb()).run(()=>{H.watch(()=>r.config,e=>{const i=Is?"configUpdated":"configCreated";Is=Ob(e),Ct.emit(i,Is)},{immediate:!0})})}function Wb(){Is=null}async function Ce(){return Is||await Be("configCreated")}var Or=(r=>(r[r.WEBGL_LEGACY=0]="WEBGL_LEGACY",r[r.WEBGL=1]="WEBGL",r[r.WEBGL2=2]="WEBGL2",r))(Or||{}),_p=(r=>(r[r.UNKNOWN=0]="UNKNOWN",r[r.WEBGL=1]="WEBGL",r[r.CANVAS=2]="CANVAS",r))(_p||{}),cl=(r=>(r[r.COLOR=16384]="COLOR",r[r.DEPTH=256]="DEPTH",r[r.STENCIL=1024]="STENCIL",r))(cl||{}),ut=(r=>(r[r.NORMAL=0]="NORMAL",r[r.ADD=1]="ADD",r[r.MULTIPLY=2]="MULTIPLY",r[r.SCREEN=3]="SCREEN",r[r.OVERLAY=4]="OVERLAY",r[r.DARKEN=5]="DARKEN",r[r.LIGHTEN=6]="LIGHTEN",r[r.COLOR_DODGE=7]="COLOR_DODGE",r[r.COLOR_BURN=8]="COLOR_BURN",r[r.HARD_LIGHT=9]="HARD_LIGHT",r[r.SOFT_LIGHT=10]="SOFT_LIGHT",r[r.DIFFERENCE=11]="DIFFERENCE",r[r.EXCLUSION=12]="EXCLUSION",r[r.HUE=13]="HUE",r[r.SATURATION=14]="SATURATION",r[r.COLOR=15]="COLOR",r[r.LUMINOSITY=16]="LUMINOSITY",r[r.NORMAL_NPM=17]="NORMAL_NPM",r[r.ADD_NPM=18]="ADD_NPM",r[r.SCREEN_NPM=19]="SCREEN_NPM",r[r.NONE=20]="NONE",r[r.SRC_OVER=0]="SRC_OVER",r[r.SRC_IN=21]="SRC_IN",r[r.SRC_OUT=22]="SRC_OUT",r[r.SRC_ATOP=23]="SRC_ATOP",r[r.DST_OVER=24]="DST_OVER",r[r.DST_IN=25]="DST_IN",r[r.DST_OUT=26]="DST_OUT",r[r.DST_ATOP=27]="DST_ATOP",r[r.ERASE=26]="ERASE",r[r.SUBTRACT=28]="SUBTRACT",r[r.XOR=29]="XOR",r))(ut||{}),yi=(r=>(r[r.POINTS=0]="POINTS",r[r.LINES=1]="LINES",r[r.LINE_LOOP=2]="LINE_LOOP",r[r.LINE_STRIP=3]="LINE_STRIP",r[r.TRIANGLES=4]="TRIANGLES",r[r.TRIANGLE_STRIP=5]="TRIANGLE_STRIP",r[r.TRIANGLE_FAN=6]="TRIANGLE_FAN",r))(yi||{}),V=(r=>(r[r.RGBA=6408]="RGBA",r[r.RGB=6407]="RGB",r[r.RG=33319]="RG",r[r.RED=6403]="RED",r[r.RGBA_INTEGER=36249]="RGBA_INTEGER",r[r.RGB_INTEGER=36248]="RGB_INTEGER",r[r.RG_INTEGER=33320]="RG_INTEGER",r[r.RED_INTEGER=36244]="RED_INTEGER",r[r.ALPHA=6406]="ALPHA",r[r.LUMINANCE=6409]="LUMINANCE",r[r.LUMINANCE_ALPHA=6410]="LUMINANCE_ALPHA",r[r.DEPTH_COMPONENT=6402]="DEPTH_COMPONENT",r[r.DEPTH_STENCIL=34041]="DEPTH_STENCIL",r))(V||{}),As=(r=>(r[r.TEXTURE_2D=3553]="TEXTURE_2D",r[r.TEXTURE_CUBE_MAP=34067]="TEXTURE_CUBE_MAP",r[r.TEXTURE_2D_ARRAY=35866]="TEXTURE_2D_ARRAY",r[r.TEXTURE_CUBE_MAP_POSITIVE_X=34069]="TEXTURE_CUBE_MAP_POSITIVE_X",r[r.TEXTURE_CUBE_MAP_NEGATIVE_X=34070]="TEXTURE_CUBE_MAP_NEGATIVE_X",r[r.TEXTURE_CUBE_MAP_POSITIVE_Y=34071]="TEXTURE_CUBE_MAP_POSITIVE_Y",r[r.TEXTURE_CUBE_MAP_NEGATIVE_Y=34072]="TEXTURE_CUBE_MAP_NEGATIVE_Y",r[r.TEXTURE_CUBE_MAP_POSITIVE_Z=34073]="TEXTURE_CUBE_MAP_POSITIVE_Z",r[r.TEXTURE_CUBE_MAP_NEGATIVE_Z=34074]="TEXTURE_CUBE_MAP_NEGATIVE_Z",r))(As||{}),nt=(r=>(r[r.UNSIGNED_BYTE=5121]="UNSIGNED_BYTE",r[r.UNSIGNED_SHORT=5123]="UNSIGNED_SHORT",r[r.UNSIGNED_SHORT_5_6_5=33635]="UNSIGNED_SHORT_5_6_5",r[r.UNSIGNED_SHORT_4_4_4_4=32819]="UNSIGNED_SHORT_4_4_4_4",r[r.UNSIGNED_SHORT_5_5_5_1=32820]="UNSIGNED_SHORT_5_5_5_1",r[r.UNSIGNED_INT=5125]="UNSIGNED_INT",r[r.UNSIGNED_INT_10F_11F_11F_REV=35899]="UNSIGNED_INT_10F_11F_11F_REV",r[r.UNSIGNED_INT_2_10_10_10_REV=33640]="UNSIGNED_INT_2_10_10_10_REV",r[r.UNSIGNED_INT_24_8=34042]="UNSIGNED_INT_24_8",r[r.UNSIGNED_INT_5_9_9_9_REV=35902]="UNSIGNED_INT_5_9_9_9_REV",r[r.BYTE=5120]="BYTE",r[r.SHORT=5122]="SHORT",r[r.INT=5124]="INT",r[r.FLOAT=5126]="FLOAT",r[r.FLOAT_32_UNSIGNED_INT_24_8_REV=36269]="FLOAT_32_UNSIGNED_INT_24_8_REV",r[r.HALF_FLOAT=36193]="HALF_FLOAT",r))(nt||{}),J=(r=>(r[r.FLOAT=0]="FLOAT",r[r.INT=1]="INT",r[r.UINT=2]="UINT",r))(J||{}),Vi=(r=>(r[r.NEAREST=0]="NEAREST",r[r.LINEAR=1]="LINEAR",r))(Vi||{}),Hi=(r=>(r[r.CLAMP=33071]="CLAMP",r[r.REPEAT=10497]="REPEAT",r[r.MIRRORED_REPEAT=33648]="MIRRORED_REPEAT",r))(Hi||{}),bi=(r=>(r[r.OFF=0]="OFF",r[r.POW2=1]="POW2",r[r.ON=2]="ON",r[r.ON_MANUAL=3]="ON_MANUAL",r))(bi||{}),be=(r=>(r[r.NPM=0]="NPM",r[r.UNPACK=1]="UNPACK",r[r.PMA=2]="PMA",r[r.NO_PREMULTIPLIED_ALPHA=0]="NO_PREMULTIPLIED_ALPHA",r[r.PREMULTIPLY_ON_UPLOAD=1]="PREMULTIPLY_ON_UPLOAD",r[r.PREMULTIPLIED_ALPHA=2]="PREMULTIPLIED_ALPHA",r))(be||{}),xi=(r=>(r[r.NO=0]="NO",r[r.YES=1]="YES",r[r.AUTO=2]="AUTO",r[r.BLEND=0]="BLEND",r[r.CLEAR=1]="CLEAR",r[r.BLIT=2]="BLIT",r))(xi||{}),dl=(r=>(r[r.AUTO=0]="AUTO",r[r.MANUAL=1]="MANUAL",r))(dl||{}),We=(r=>(r.LOW="lowp",r.MEDIUM="mediump",r.HIGH="highp",r))(We||{}),jt=(r=>(r[r.NONE=0]="NONE",r[r.SCISSOR=1]="SCISSOR",r[r.STENCIL=2]="STENCIL",r[r.SPRITE=3]="SPRITE",r[r.COLOR=4]="COLOR",r))(jt||{}),Yt=(r=>(r[r.NONE=0]="NONE",r[r.LOW=2]="LOW",r[r.MEDIUM=4]="MEDIUM",r[r.HIGH=8]="HIGH",r))(Yt||{}),_i=(r=>(r[r.ELEMENT_ARRAY_BUFFER=34963]="ELEMENT_ARRAY_BUFFER",r[r.ARRAY_BUFFER=34962]="ARRAY_BUFFER",r[r.UNIFORM_BUFFER=35345]="UNIFORM_BUFFER",r))(_i||{});const $={ADAPTER:{createCanvas:(r,t)=>{const e=document.createElement("canvas");return e.width=r,e.height=t,e},getCanvasRenderingContext2D:()=>CanvasRenderingContext2D,getWebGLRenderingContext:()=>WebGLRenderingContext,getNavigator:()=>navigator,getBaseUrl:()=>document.baseURI??window.location.href,getFontFaceSet:()=>document.fonts,fetch:(r,t)=>fetch(r,t),parseXML:r=>new DOMParser().parseFromString(r,"text/xml")},RESOLUTION:1,CREATE_IMAGE_BITMAP:!1,ROUND_PIXELS:!1};var pl=/iPhone/i,vp=/iPod/i,Tp=/iPad/i,wp=/\biOS-universal(?:.+)Mac\b/i,fl=/\bAndroid(?:.+)Mobile\b/i,Sp=/Android/i,Ms=/(?:SD4930UR|\bSilk(?:.+)Mobile\b)/i,Yo=/Silk/i,Ki=/Windows Phone/i,Ep=/\bWindows(?:.+)ARM\b/i,Cp=/BlackBerry/i,Ip=/BB10/i,Ap=/Opera Mini/i,Mp=/\b(CriOS|Chrome)(?:.+)Mobile/i,Rp=/Mobile(?:.+)Firefox\b/i,Pp=function(r){return typeof r<"u"&&r.platform==="MacIntel"&&typeof r.maxTouchPoints=="number"&&r.maxTouchPoints>1&&typeof MSStream>"u"};function Ub(r){return function(t){return t.test(r)}}function Lp(r){var t={userAgent:"",platform:"",maxTouchPoints:0};!r&&typeof navigator<"u"?t={userAgent:navigator.userAgent,platform:navigator.platform,maxTouchPoints:navigator.maxTouchPoints||0}:typeof r=="string"?t.userAgent=r:r&&r.userAgent&&(t={userAgent:r.userAgent,platform:r.platform,maxTouchPoints:r.maxTouchPoints||0});var e=t.userAgent,i=e.split("[FBAN");typeof i[1]<"u"&&(e=i[0]),i=e.split("Twitter"),typeof i[1]<"u"&&(e=i[0]);var s=Ub(e),n={apple:{phone:s(pl)&&!s(Ki),ipod:s(vp),tablet:!s(pl)&&(s(Tp)||Pp(t))&&!s(Ki),universal:s(wp),device:(s(pl)||s(vp)||s(Tp)||s(wp)||Pp(t))&&!s(Ki)},amazon:{phone:s(Ms),tablet:!s(Ms)&&s(Yo),device:s(Ms)||s(Yo)},android:{phone:!s(Ki)&&s(Ms)||!s(Ki)&&s(fl),tablet:!s(Ki)&&!s(Ms)&&!s(fl)&&(s(Yo)||s(Sp)),device:!s(Ki)&&(s(Ms)||s(Yo)||s(fl)||s(Sp))||s(/\bokhttp\b/i)},windows:{phone:s(Ki),tablet:s(Ep),device:s(Ki)||s(Ep)},other:{blackberry:s(Cp),blackberry10:s(Ip),opera:s(Ap),firefox:s(Rp),chrome:s(Mp),device:s(Cp)||s(Ip)||s(Ap)||s(Rp)||s(Mp)},any:!1,phone:!1,tablet:!1};return n.any=n.apple.device||n.android.device||n.windows.device||n.other.device,n.phone=n.apple.phone||n.android.phone||n.windows.phone,n.tablet=n.apple.tablet||n.android.tablet||n.windows.tablet,n}const Xb=Lp.default??Lp,Yi=Xb(globalThis.navigator);$.RETINA_PREFIX=/@([0-9\.]+)x/,$.FAIL_IF_MAJOR_PERFORMANCE_CAVEAT=!1;var Gp={exports:{}};(function(r){var t=Object.prototype.hasOwnProperty,e="~";function i(){}Object.create&&(i.prototype=Object.create(null),new i().__proto__||(e=!1));function s(h,l,u){this.fn=h,this.context=l,this.once=u||!1}function n(h,l,u,c,d){if(typeof u!="function")throw new TypeError("The listener must be a function");var p=new s(u,c||h,d),m=e?e+l:l;return h._events[m]?h._events[m].fn?h._events[m]=[h._events[m],p]:h._events[m].push(p):(h._events[m]=p,h._eventsCount++),h}function o(h,l){--h._eventsCount===0?h._events=new i:delete h._events[l]}function a(){this._events=new i,this._eventsCount=0}a.prototype.eventNames=function(){var l=[],u,c;if(this._eventsCount===0)return l;for(c in u=this._events)t.call(u,c)&&l.push(e?c.slice(1):c);return Object.getOwnPropertySymbols?l.concat(Object.getOwnPropertySymbols(u)):l},a.prototype.listeners=function(l){var u=e?e+l:l,c=this._events[u];if(!c)return[];if(c.fn)return[c.fn];for(var d=0,p=c.length,m=new Array(p);d<p;d++)m[d]=c[d].fn;return m},a.prototype.listenerCount=function(l){var u=e?e+l:l,c=this._events[u];return c?c.fn?1:c.length:0},a.prototype.emit=function(l,u,c,d,p,m){var f=e?e+l:l;if(!this._events[f])return!1;var g=this._events[f],y=arguments.length,_,x;if(g.fn){switch(g.once&&this.removeListener(l,g.fn,void 0,!0),y){case 1:return g.fn.call(g.context),!0;case 2:return g.fn.call(g.context,u),!0;case 3:return g.fn.call(g.context,u,c),!0;case 4:return g.fn.call(g.context,u,c,d),!0;case 5:return g.fn.call(g.context,u,c,d,p),!0;case 6:return g.fn.call(g.context,u,c,d,p,m),!0}for(x=1,_=new Array(y-1);x<y;x++)_[x-1]=arguments[x];g.fn.apply(g.context,_)}else{var v=g.length,S;for(x=0;x<v;x++)switch(g[x].once&&this.removeListener(l,g[x].fn,void 0,!0),y){case 1:g[x].fn.call(g[x].context);break;case 2:g[x].fn.call(g[x].context,u);break;case 3:g[x].fn.call(g[x].context,u,c);break;case 4:g[x].fn.call(g[x].context,u,c,d);break;default:if(!_)for(S=1,_=new Array(y-1);S<y;S++)_[S-1]=arguments[S];g[x].fn.apply(g[x].context,_)}}return!0},a.prototype.on=function(l,u,c){return n(this,l,u,c,!1)},a.prototype.once=function(l,u,c){return n(this,l,u,c,!0)},a.prototype.removeListener=function(l,u,c,d){var p=e?e+l:l;if(!this._events[p])return this;if(!u)return o(this,p),this;var m=this._events[p];if(m.fn)m.fn===u&&(!d||m.once)&&(!c||m.context===c)&&o(this,p);else{for(var f=0,g=[],y=m.length;f<y;f++)(m[f].fn!==u||d&&!m[f].once||c&&m[f].context!==c)&&g.push(m[f]);g.length?this._events[p]=g.length===1?g[0]:g:o(this,p)}return this},a.prototype.removeAllListeners=function(l){var u;return l?(u=e?e+l:l,this._events[u]&&o(this,u)):(this._events=new i,this._eventsCount=0),this},a.prototype.off=a.prototype.removeListener,a.prototype.addListener=a.prototype.on,a.prefixed=e,a.EventEmitter=a,r.exports=a})(Gp);var Zb=Gp.exports;const Gn=Ln(Zb);var ml={exports:{}};ml.exports=zo,ml.exports.default=zo;function zo(r,t,e){e=e||2;var i=t&&t.length,s=i?t[0]*e:r.length,n=Np(r,0,s,e,!0),o=[];if(!n||n.next===n.prev)return o;var a,h,l,u,c,d,p;if(i&&(n=zb(r,t,n,e)),r.length>80*e){a=l=r[0],h=u=r[1];for(var m=e;m<s;m+=e)c=r[m],d=r[m+1],c<a&&(a=c),d<h&&(h=d),c>l&&(l=c),d>u&&(u=d);p=Math.max(l-a,u-h),p=p!==0?32767/p:0}return Nn(n,o,e,a,h,p,0),o}function Np(r,t,e,i,s){var n,o;if(s===bl(r,t,e,i)>0)for(n=t;n<e;n+=i)o=kp(n,r[n],r[n+1],o);else for(n=e-i;n>=t;n-=i)o=kp(n,r[n],r[n+1],o);return o&&jo(o,o.next)&&(Dn(o),o=o.next),o}function Br(r,t){if(!r)return r;t||(t=r);var e=r,i;do if(i=!1,!e.steiner&&(jo(e,e.next)||Dt(e.prev,e,e.next)===0)){if(Dn(e),e=t=e.prev,e===e.next)break;i=!0}else e=e.next;while(i||e!==t);return t}function Nn(r,t,e,i,s,n,o){if(r){!o&&n&&qb(r,i,s,n);for(var a=r,h,l;r.prev!==r.next;){if(h=r.prev,l=r.next,n?Hb(r,i,s,n):Vb(r)){t.push(h.i/e|0),t.push(r.i/e|0),t.push(l.i/e|0),Dn(r),r=l.next,a=l.next;continue}if(r=l,r===a){o?o===1?(r=Kb(Br(r),t,e),Nn(r,t,e,i,s,n,2)):o===2&&Yb(r,t,e,i,s,n):Nn(Br(r),t,e,i,s,n,1);break}}}}function Vb(r){var t=r.prev,e=r,i=r.next;if(Dt(t,e,i)>=0)return!1;for(var s=t.x,n=e.x,o=i.x,a=t.y,h=e.y,l=i.y,u=s<n?s<o?s:o:n<o?n:o,c=a<h?a<l?a:l:h<l?h:l,d=s>n?s>o?s:o:n>o?n:o,p=a>h?a>l?a:l:h>l?h:l,m=i.next;m!==t;){if(m.x>=u&&m.x<=d&&m.y>=c&&m.y<=p&&Rs(s,a,n,h,o,l,m.x,m.y)&&Dt(m.prev,m,m.next)>=0)return!1;m=m.next}return!0}function Hb(r,t,e,i){var s=r.prev,n=r,o=r.next;if(Dt(s,n,o)>=0)return!1;for(var a=s.x,h=n.x,l=o.x,u=s.y,c=n.y,d=o.y,p=a<h?a<l?a:l:h<l?h:l,m=u<c?u<d?u:d:c<d?c:d,f=a>h?a>l?a:l:h>l?h:l,g=u>c?u>d?u:d:c>d?c:d,y=gl(p,m,t,e,i),_=gl(f,g,t,e,i),x=r.prevZ,v=r.nextZ;x&&x.z>=y&&v&&v.z<=_;){if(x.x>=p&&x.x<=f&&x.y>=m&&x.y<=g&&x!==s&&x!==o&&Rs(a,u,h,c,l,d,x.x,x.y)&&Dt(x.prev,x,x.next)>=0||(x=x.prevZ,v.x>=p&&v.x<=f&&v.y>=m&&v.y<=g&&v!==s&&v!==o&&Rs(a,u,h,c,l,d,v.x,v.y)&&Dt(v.prev,v,v.next)>=0))return!1;v=v.nextZ}for(;x&&x.z>=y;){if(x.x>=p&&x.x<=f&&x.y>=m&&x.y<=g&&x!==s&&x!==o&&Rs(a,u,h,c,l,d,x.x,x.y)&&Dt(x.prev,x,x.next)>=0)return!1;x=x.prevZ}for(;v&&v.z<=_;){if(v.x>=p&&v.x<=f&&v.y>=m&&v.y<=g&&v!==s&&v!==o&&Rs(a,u,h,c,l,d,v.x,v.y)&&Dt(v.prev,v,v.next)>=0)return!1;v=v.nextZ}return!0}function Kb(r,t,e){var i=r;do{var s=i.prev,n=i.next.next;!jo(s,n)&&Fp(s,i,i.next,n)&&Fn(s,n)&&Fn(n,s)&&(t.push(s.i/e|0),t.push(i.i/e|0),t.push(n.i/e|0),Dn(i),Dn(i.next),i=r=n),i=i.next}while(i!==r);return Br(i)}function Yb(r,t,e,i,s,n){var o=r;do{for(var a=o.next.next;a!==o.prev;){if(o.i!==a.i&&ix(o,a)){var h=Dp(o,a);o=Br(o,o.next),h=Br(h,h.next),Nn(o,t,e,i,s,n,0),Nn(h,t,e,i,s,n,0);return}a=a.next}o=o.next}while(o!==r)}function zb(r,t,e,i){var s=[],n,o,a,h,l;for(n=0,o=t.length;n<o;n++)a=t[n]*i,h=n<o-1?t[n+1]*i:r.length,l=Np(r,a,h,i,!1),l===l.next&&(l.steiner=!0),s.push(ex(l));for(s.sort(jb),n=0;n<s.length;n++)e=Jb(s[n],e);return e}function jb(r,t){return r.x-t.x}function Jb(r,t){var e=$b(r,t);if(!e)return t;var i=Dp(e,r);return Br(i,i.next),Br(e,e.next)}function $b(r,t){var e=t,i=r.x,s=r.y,n=-1/0,o;do{if(s<=e.y&&s>=e.next.y&&e.next.y!==e.y){var a=e.x+(s-e.y)*(e.next.x-e.x)/(e.next.y-e.y);if(a<=i&&a>n&&(n=a,o=e.x<e.next.x?e:e.next,a===i))return o}e=e.next}while(e!==t);if(!o)return null;var h=o,l=o.x,u=o.y,c=1/0,d;e=o;do i>=e.x&&e.x>=l&&i!==e.x&&Rs(s<u?i:n,s,l,u,s<u?n:i,s,e.x,e.y)&&(d=Math.abs(s-e.y)/(i-e.x),Fn(e,r)&&(d<c||d===c&&(e.x>o.x||e.x===o.x&&Qb(o,e)))&&(o=e,c=d)),e=e.next;while(e!==h);return o}function Qb(r,t){return Dt(r.prev,r,t.prev)<0&&Dt(t.next,r,r.next)<0}function qb(r,t,e,i){var s=r;do s.z===0&&(s.z=gl(s.x,s.y,t,e,i)),s.prevZ=s.prev,s.nextZ=s.next,s=s.next;while(s!==r);s.prevZ.nextZ=null,s.prevZ=null,tx(s)}function tx(r){var t,e,i,s,n,o,a,h,l=1;do{for(e=r,r=null,n=null,o=0;e;){for(o++,i=e,a=0,t=0;t<l&&(a++,i=i.nextZ,!!i);t++);for(h=l;a>0||h>0&&i;)a!==0&&(h===0||!i||e.z<=i.z)?(s=e,e=e.nextZ,a--):(s=i,i=i.nextZ,h--),n?n.nextZ=s:r=s,s.prevZ=n,n=s;e=i}n.nextZ=null,l*=2}while(o>1);return r}function gl(r,t,e,i,s){return r=(r-e)*s|0,t=(t-i)*s|0,r=(r|r<<8)&16711935,r=(r|r<<4)&252645135,r=(r|r<<2)&858993459,r=(r|r<<1)&1431655765,t=(t|t<<8)&16711935,t=(t|t<<4)&252645135,t=(t|t<<2)&858993459,t=(t|t<<1)&1431655765,r|t<<1}function ex(r){var t=r,e=r;do(t.x<e.x||t.x===e.x&&t.y<e.y)&&(e=t),t=t.next;while(t!==r);return e}function Rs(r,t,e,i,s,n,o,a){return(s-o)*(t-a)>=(r-o)*(n-a)&&(r-o)*(i-a)>=(e-o)*(t-a)&&(e-o)*(n-a)>=(s-o)*(i-a)}function ix(r,t){return r.next.i!==t.i&&r.prev.i!==t.i&&!rx(r,t)&&(Fn(r,t)&&Fn(t,r)&&sx(r,t)&&(Dt(r.prev,r,t.prev)||Dt(r,t.prev,t))||jo(r,t)&&Dt(r.prev,r,r.next)>0&&Dt(t.prev,t,t.next)>0)}function Dt(r,t,e){return(t.y-r.y)*(e.x-t.x)-(t.x-r.x)*(e.y-t.y)}function jo(r,t){return r.x===t.x&&r.y===t.y}function Fp(r,t,e,i){var s=$o(Dt(r,t,e)),n=$o(Dt(r,t,i)),o=$o(Dt(e,i,r)),a=$o(Dt(e,i,t));return!!(s!==n&&o!==a||s===0&&Jo(r,e,t)||n===0&&Jo(r,i,t)||o===0&&Jo(e,r,i)||a===0&&Jo(e,t,i))}function Jo(r,t,e){return t.x<=Math.max(r.x,e.x)&&t.x>=Math.min(r.x,e.x)&&t.y<=Math.max(r.y,e.y)&&t.y>=Math.min(r.y,e.y)}function $o(r){return r>0?1:r<0?-1:0}function rx(r,t){var e=r;do{if(e.i!==r.i&&e.next.i!==r.i&&e.i!==t.i&&e.next.i!==t.i&&Fp(e,e.next,r,t))return!0;e=e.next}while(e!==r);return!1}function Fn(r,t){return Dt(r.prev,r,r.next)<0?Dt(r,t,r.next)>=0&&Dt(r,r.prev,t)>=0:Dt(r,t,r.prev)<0||Dt(r,r.next,t)<0}function sx(r,t){var e=r,i=!1,s=(r.x+t.x)/2,n=(r.y+t.y)/2;do e.y>n!=e.next.y>n&&e.next.y!==e.y&&s<(e.next.x-e.x)*(n-e.y)/(e.next.y-e.y)+e.x&&(i=!i),e=e.next;while(e!==r);return i}function Dp(r,t){var e=new yl(r.i,r.x,r.y),i=new yl(t.i,t.x,t.y),s=r.next,n=t.prev;return r.next=t,t.prev=r,e.next=s,s.prev=e,i.next=e,e.prev=i,n.next=i,i.prev=n,i}function kp(r,t,e,i){var s=new yl(r,t,e);return i?(s.next=i.next,s.prev=i,i.next.prev=s,i.next=s):(s.prev=s,s.next=s),s}function Dn(r){r.next.prev=r.prev,r.prev.next=r.next,r.prevZ&&(r.prevZ.nextZ=r.nextZ),r.nextZ&&(r.nextZ.prevZ=r.prevZ)}function yl(r,t,e){this.i=r,this.x=t,this.y=e,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}zo.deviation=function(r,t,e,i){var s=t&&t.length,n=s?t[0]*e:r.length,o=Math.abs(bl(r,0,n,e));if(s)for(var a=0,h=t.length;a<h;a++){var l=t[a]*e,u=a<h-1?t[a+1]*e:r.length;o-=Math.abs(bl(r,l,u,e))}var c=0;for(a=0;a<i.length;a+=3){var d=i[a]*e,p=i[a+1]*e,m=i[a+2]*e;c+=Math.abs((r[d]-r[m])*(r[p+1]-r[d+1])-(r[d]-r[p])*(r[m+1]-r[d+1]))}return o===0&&c===0?0:Math.abs((c-o)/o)};function bl(r,t,e,i){for(var s=0,n=t,o=e-i;n<e;n+=i)s+=(r[o]-r[n])*(r[n+1]+r[o+1]),o=n;return s}zo.flatten=function(r){for(var t=r[0][0].length,e={vertices:[],holes:[],dimensions:t},i=0,s=0;s<r.length;s++){for(var n=0;n<r[s].length;n++)for(var o=0;o<t;o++)e.vertices.push(r[s][n][o]);s>0&&(i+=r[s-1].length,e.holes.push(i))}return e};var nx=ml.exports;const ox=Ln(nx);var Qo={exports:{}};/*! https://mths.be/punycode v1.4.1 by @mathias */Qo.exports,function(r,t){(function(e){var i=t&&!t.nodeType&&t,s=r&&!r.nodeType&&r,n=typeof qe=="object"&&qe;(n.global===n||n.window===n||n.self===n)&&(e=n);var o,a=2147483647,h=36,l=1,u=26,c=38,d=700,p=72,m=128,f="-",g=/^xn--/,y=/[^\x20-\x7E]/,_=/[\x2E\u3002\uFF0E\uFF61]/g,x={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},v=h-l,S=Math.floor,C=String.fromCharCode,A;function I(X){throw new RangeError(x[X])}function L(X,W){for(var j=X.length,q=[];j--;)q[j]=W(X[j]);return q}function k(X,W){var j=X.split("@"),q="";j.length>1&&(q=j[0]+"@",X=j[1]),X=X.replace(_,".");var pt=X.split("."),at=L(pt,W).join(".");return q+at}function M(X){for(var W=[],j=0,q=X.length,pt,at;j<q;)pt=X.charCodeAt(j++),pt>=55296&&pt<=56319&&j<q?(at=X.charCodeAt(j++),(at&64512)==56320?W.push(((pt&1023)<<10)+(at&1023)+65536):(W.push(pt),j--)):W.push(pt);return W}function G(X){return L(X,function(W){var j="";return W>65535&&(W-=65536,j+=C(W>>>10&1023|55296),W=56320|W&1023),j+=C(W),j}).join("")}function E(X){return X-48<10?X-22:X-65<26?X-65:X-97<26?X-97:h}function N(X,W){return X+22+75*(X<26)-((W!=0)<<5)}function O(X,W,j){var q=0;for(X=j?S(X/d):X>>1,X+=S(X/W);X>v*u>>1;q+=h)X=S(X/v);return S(q+(v+1)*X/(X+c))}function Z(X){var W=[],j=X.length,q,pt=0,at=m,It=p,Nt,wt,Y,et,Q,F,yt,mt,Mt;for(Nt=X.lastIndexOf(f),Nt<0&&(Nt=0),wt=0;wt<Nt;++wt)X.charCodeAt(wt)>=128&&I("not-basic"),W.push(X.charCodeAt(wt));for(Y=Nt>0?Nt+1:0;Y<j;){for(et=pt,Q=1,F=h;Y>=j&&I("invalid-input"),yt=E(X.charCodeAt(Y++)),(yt>=h||yt>S((a-pt)/Q))&&I("overflow"),pt+=yt*Q,mt=F<=It?l:F>=It+u?u:F-It,!(yt<mt);F+=h)Mt=h-mt,Q>S(a/Mt)&&I("overflow"),Q*=Mt;q=W.length+1,It=O(pt-et,q,et==0),S(pt/q)>a-at&&I("overflow"),at+=S(pt/q),pt%=q,W.splice(pt++,0,at)}return G(W)}function U(X){var W,j,q,pt,at,It,Nt,wt,Y,et,Q,F=[],yt,mt,Mt,Ut;for(X=M(X),yt=X.length,W=m,j=0,at=p,It=0;It<yt;++It)Q=X[It],Q<128&&F.push(C(Q));for(q=pt=F.length,pt&&F.push(f);q<yt;){for(Nt=a,It=0;It<yt;++It)Q=X[It],Q>=W&&Q<Nt&&(Nt=Q);for(mt=q+1,Nt-W>S((a-j)/mt)&&I("overflow"),j+=(Nt-W)*mt,W=Nt,It=0;It<yt;++It)if(Q=X[It],Q<W&&++j>a&&I("overflow"),Q==W){for(wt=j,Y=h;et=Y<=at?l:Y>=at+u?u:Y-at,!(wt<et);Y+=h)Ut=wt-et,Mt=h-et,F.push(C(N(et+Ut%Mt,0))),wt=S(Ut/Mt);F.push(C(N(wt,0))),at=O(j,mt,q==pt),j=0,++q}++j,++W}return F.join("")}function K(X){return k(X,function(W){return g.test(W)?Z(W.slice(4).toLowerCase()):W})}function ht(X){return k(X,function(W){return y.test(W)?"xn--"+U(W):W})}if(o={version:"1.4.1",ucs2:{decode:M,encode:G},decode:Z,encode:U,toASCII:ht,toUnicode:K},i&&s)if(r.exports==i)s.exports=o;else for(A in o)o.hasOwnProperty(A)&&(i[A]=o[A]);else e.punycode=o})(qe)}(Qo,Qo.exports);var ax=Qo.exports,hx=function(){if(typeof Symbol!="function"||typeof Object.getOwnPropertySymbols!="function")return!1;if(typeof Symbol.iterator=="symbol")return!0;var t={},e=Symbol("test"),i=Object(e);if(typeof e=="string"||Object.prototype.toString.call(e)!=="[object Symbol]"||Object.prototype.toString.call(i)!=="[object Symbol]")return!1;var s=42;t[e]=s;for(e in t)return!1;if(typeof Object.keys=="function"&&Object.keys(t).length!==0||typeof Object.getOwnPropertyNames=="function"&&Object.getOwnPropertyNames(t).length!==0)return!1;var n=Object.getOwnPropertySymbols(t);if(n.length!==1||n[0]!==e||!Object.prototype.propertyIsEnumerable.call(t,e))return!1;if(typeof Object.getOwnPropertyDescriptor=="function"){var o=Object.getOwnPropertyDescriptor(t,e);if(o.value!==s||o.enumerable!==!0)return!1}return!0},Op=typeof Symbol<"u"&&Symbol,lx=hx,ux=function(){return typeof Op!="function"||typeof Symbol!="function"||typeof Op("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:lx()},Bp={foo:{}},cx=Object,dx=function(){return{__proto__:Bp}.foo===Bp.foo&&!({__proto__:null}instanceof cx)},px="Function.prototype.bind called on incompatible ",xl=Array.prototype.slice,fx=Object.prototype.toString,mx="[object Function]",gx=function(t){var e=this;if(typeof e!="function"||fx.call(e)!==mx)throw new TypeError(px+e);for(var i=xl.call(arguments,1),s,n=function(){if(this instanceof s){var u=e.apply(this,i.concat(xl.call(arguments)));return Object(u)===u?u:this}else return e.apply(t,i.concat(xl.call(arguments)))},o=Math.max(0,e.length-i.length),a=[],h=0;h<o;h++)a.push("$"+h);if(s=Function("binder","return function ("+a.join(",")+"){ return binder.apply(this,arguments); }")(n),e.prototype){var l=function(){};l.prototype=e.prototype,s.prototype=new l,l.prototype=null}return s},yx=gx,_l=Function.prototype.bind||yx,bx=_l,xx=bx.call(Function.call,Object.prototype.hasOwnProperty),vt,Ps=SyntaxError,Wp=Function,Ls=TypeError,vl=function(r){try{return Wp('"use strict"; return ('+r+").constructor;")()}catch{}},Wr=Object.getOwnPropertyDescriptor;if(Wr)try{Wr({},"")}catch{Wr=null}var Tl=function(){throw new Ls},_x=Wr?function(){try{return arguments.callee,Tl}catch{try{return Wr(arguments,"callee").get}catch{return Tl}}}():Tl,Gs=ux(),vx=dx(),qt=Object.getPrototypeOf||(vx?function(r){return r.__proto__}:null),Ns={},Tx=typeof Uint8Array>"u"||!qt?vt:qt(Uint8Array),Ur={"%AggregateError%":typeof AggregateError>"u"?vt:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?vt:ArrayBuffer,"%ArrayIteratorPrototype%":Gs&&qt?qt([][Symbol.iterator]()):vt,"%AsyncFromSyncIteratorPrototype%":vt,"%AsyncFunction%":Ns,"%AsyncGenerator%":Ns,"%AsyncGeneratorFunction%":Ns,"%AsyncIteratorPrototype%":Ns,"%Atomics%":typeof Atomics>"u"?vt:Atomics,"%BigInt%":typeof BigInt>"u"?vt:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?vt:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?vt:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?vt:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":Error,"%eval%":eval,"%EvalError%":EvalError,"%Float32Array%":typeof Float32Array>"u"?vt:Float32Array,"%Float64Array%":typeof Float64Array>"u"?vt:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?vt:FinalizationRegistry,"%Function%":Wp,"%GeneratorFunction%":Ns,"%Int8Array%":typeof Int8Array>"u"?vt:Int8Array,"%Int16Array%":typeof Int16Array>"u"?vt:Int16Array,"%Int32Array%":typeof Int32Array>"u"?vt:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":Gs&&qt?qt(qt([][Symbol.iterator]())):vt,"%JSON%":typeof JSON=="object"?JSON:vt,"%Map%":typeof Map>"u"?vt:Map,"%MapIteratorPrototype%":typeof Map>"u"||!Gs||!qt?vt:qt(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?vt:Promise,"%Proxy%":typeof Proxy>"u"?vt:Proxy,"%RangeError%":RangeError,"%ReferenceError%":ReferenceError,"%Reflect%":typeof Reflect>"u"?vt:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?vt:Set,"%SetIteratorPrototype%":typeof Set>"u"||!Gs||!qt?vt:qt(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?vt:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":Gs&&qt?qt(""[Symbol.iterator]()):vt,"%Symbol%":Gs?Symbol:vt,"%SyntaxError%":Ps,"%ThrowTypeError%":_x,"%TypedArray%":Tx,"%TypeError%":Ls,"%Uint8Array%":typeof Uint8Array>"u"?vt:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?vt:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?vt:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?vt:Uint32Array,"%URIError%":URIError,"%WeakMap%":typeof WeakMap>"u"?vt:WeakMap,"%WeakRef%":typeof WeakRef>"u"?vt:WeakRef,"%WeakSet%":typeof WeakSet>"u"?vt:WeakSet};if(qt)try{null.error}catch(r){var wx=qt(qt(r));Ur["%Error.prototype%"]=wx}var Sx=function r(t){var e;if(t==="%AsyncFunction%")e=vl("async function () {}");else if(t==="%GeneratorFunction%")e=vl("function* () {}");else if(t==="%AsyncGeneratorFunction%")e=vl("async function* () {}");else if(t==="%AsyncGenerator%"){var i=r("%AsyncGeneratorFunction%");i&&(e=i.prototype)}else if(t==="%AsyncIteratorPrototype%"){var s=r("%AsyncGenerator%");s&&qt&&(e=qt(s.prototype))}return Ur[t]=e,e},Up={"%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"]},kn=_l,qo=xx,Ex=kn.call(Function.call,Array.prototype.concat),Cx=kn.call(Function.apply,Array.prototype.splice),Xp=kn.call(Function.call,String.prototype.replace),ta=kn.call(Function.call,String.prototype.slice),Ix=kn.call(Function.call,RegExp.prototype.exec),Ax=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,Mx=/\\(\\)?/g,Rx=function(t){var e=ta(t,0,1),i=ta(t,-1);if(e==="%"&&i!=="%")throw new Ps("invalid intrinsic syntax, expected closing `%`");if(i==="%"&&e!=="%")throw new Ps("invalid intrinsic syntax, expected opening `%`");var s=[];return Xp(t,Ax,function(n,o,a,h){s[s.length]=a?Xp(h,Mx,"$1"):o||n}),s},Px=function(t,e){var i=t,s;if(qo(Up,i)&&(s=Up[i],i="%"+s[0]+"%"),qo(Ur,i)){var n=Ur[i];if(n===Ns&&(n=Sx(i)),typeof n>"u"&&!e)throw new Ls("intrinsic "+t+" exists, but is not available. Please file an issue!");return{alias:s,name:i,value:n}}throw new Ps("intrinsic "+t+" does not exist!")},wl=function(t,e){if(typeof t!="string"||t.length===0)throw new Ls("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof e!="boolean")throw new Ls('"allowMissing" argument must be a boolean');if(Ix(/^%?[^%]*%?$/,t)===null)throw new Ps("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var i=Rx(t),s=i.length>0?i[0]:"",n=Px("%"+s+"%",e),o=n.name,a=n.value,h=!1,l=n.alias;l&&(s=l[0],Cx(i,Ex([0,1],l)));for(var u=1,c=!0;u<i.length;u+=1){var d=i[u],p=ta(d,0,1),m=ta(d,-1);if((p==='"'||p==="'"||p==="`"||m==='"'||m==="'"||m==="`")&&p!==m)throw new Ps("property names with quotes must have matching quotes");if((d==="constructor"||!c)&&(h=!0),s+="."+d,o="%"+s+"%",qo(Ur,o))a=Ur[o];else if(a!=null){if(!(d in a)){if(!e)throw new Ls("base intrinsic for "+t+" exists, but the property is not available.");return}if(Wr&&u+1>=i.length){var f=Wr(a,d);c=!!f,c&&"get"in f&&!("originalValue"in f.get)?a=f.get:a=a[d]}else c=qo(a,d),a=a[d];c&&!h&&(Ur[o]=a)}}return a},Zp={exports:{}};(function(r){var t=_l,e=wl,i=e("%Function.prototype.apply%"),s=e("%Function.prototype.call%"),n=e("%Reflect.apply%",!0)||t.call(s,i),o=e("%Object.getOwnPropertyDescriptor%",!0),a=e("%Object.defineProperty%",!0),h=e("%Math.max%");if(a)try{a({},"a",{value:1})}catch{a=null}r.exports=function(c){var d=n(t,s,arguments);if(o&&a){var p=o(d,"length");p.configurable&&a(d,"length",{value:1+h(0,c.length-(arguments.length-1))})}return d};var l=function(){return n(t,i,arguments)};a?a(r.exports,"apply",{value:l}):r.exports.apply=l})(Zp);var Lx=Zp.exports,Vp=wl,Hp=Lx,Gx=Hp(Vp("String.prototype.indexOf")),Nx=function(t,e){var i=Vp(t,!!e);return typeof i=="function"&&Gx(t,".prototype.")>-1?Hp(i):i};const Fx=Pb(Object.freeze(Object.defineProperty({__proto__:null,default:{}},Symbol.toStringTag,{value:"Module"})));var Sl=typeof Map=="function"&&Map.prototype,El=Object.getOwnPropertyDescriptor&&Sl?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,ea=Sl&&El&&typeof El.get=="function"?El.get:null,Kp=Sl&&Map.prototype.forEach,Cl=typeof Set=="function"&&Set.prototype,Il=Object.getOwnPropertyDescriptor&&Cl?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,ia=Cl&&Il&&typeof Il.get=="function"?Il.get:null,Yp=Cl&&Set.prototype.forEach,Dx=typeof WeakMap=="function"&&WeakMap.prototype,On=Dx?WeakMap.prototype.has:null,kx=typeof WeakSet=="function"&&WeakSet.prototype,Bn=kx?WeakSet.prototype.has:null,Ox=typeof WeakRef=="function"&&WeakRef.prototype,zp=Ox?WeakRef.prototype.deref:null,Bx=Boolean.prototype.valueOf,Wx=Object.prototype.toString,Ux=Function.prototype.toString,Xx=String.prototype.match,Al=String.prototype.slice,dr=String.prototype.replace,Zx=String.prototype.toUpperCase,jp=String.prototype.toLowerCase,Jp=RegExp.prototype.test,$p=Array.prototype.concat,vi=Array.prototype.join,Vx=Array.prototype.slice,Qp=Math.floor,Ml=typeof BigInt=="function"?BigInt.prototype.valueOf:null,Rl=Object.getOwnPropertySymbols,Pl=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Symbol.prototype.toString:null,Fs=typeof Symbol=="function"&&typeof Symbol.iterator=="object",le=typeof Symbol=="function"&&Symbol.toStringTag&&(typeof Symbol.toStringTag===Fs||"symbol")?Symbol.toStringTag:null,qp=Object.prototype.propertyIsEnumerable,tf=(typeof Reflect=="function"?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(r){return r.__proto__}:null);function ef(r,t){if(r===1/0||r===-1/0||r!==r||r&&r>-1e3&&r<1e3||Jp.call(/e/,t))return t;var e=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if(typeof r=="number"){var i=r<0?-Qp(-r):Qp(r);if(i!==r){var s=String(i),n=Al.call(t,s.length+1);return dr.call(s,e,"$&_")+"."+dr.call(dr.call(n,/([0-9]{3})/g,"$&_"),/_$/,"")}}return dr.call(t,e,"$&_")}var Ll=Fx,rf=Ll.custom,sf=af(rf)?rf:null,Hx=function r(t,e,i,s){var n=e||{};if(pr(n,"quoteStyle")&&n.quoteStyle!=="single"&&n.quoteStyle!=="double")throw new TypeError('option "quoteStyle" must be "single" or "double"');if(pr(n,"maxStringLength")&&(typeof n.maxStringLength=="number"?n.maxStringLength<0&&n.maxStringLength!==1/0:n.maxStringLength!==null))throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`');var o=pr(n,"customInspect")?n.customInspect:!0;if(typeof o!="boolean"&&o!=="symbol")throw new TypeError("option \"customInspect\", if provided, must be `true`, `false`, or `'symbol'`");if(pr(n,"indent")&&n.indent!==null&&n.indent!==" "&&!(parseInt(n.indent,10)===n.indent&&n.indent>0))throw new TypeError('option "indent" must be "\\t", an integer > 0, or `null`');if(pr(n,"numericSeparator")&&typeof n.numericSeparator!="boolean")throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`');var a=n.numericSeparator;if(typeof t>"u")return"undefined";if(t===null)return"null";if(typeof t=="boolean")return t?"true":"false";if(typeof t=="string")return lf(t,n);if(typeof t=="number"){if(t===0)return 1/0/t>0?"0":"-0";var h=String(t);return a?ef(t,h):h}if(typeof t=="bigint"){var l=String(t)+"n";return a?ef(t,l):l}var u=typeof n.depth>"u"?5:n.depth;if(typeof i>"u"&&(i=0),i>=u&&u>0&&typeof t=="object")return Gl(t)?"[Array]":"[Object]";var c=l_(n,i);if(typeof s>"u")s=[];else if(hf(s,t)>=0)return"[Circular]";function d(E,N,O){if(N&&(s=Vx.call(s),s.push(N)),O){var Z={depth:n.depth};return pr(n,"quoteStyle")&&(Z.quoteStyle=n.quoteStyle),r(E,Z,i+1,s)}return r(E,n,i+1,s)}if(typeof t=="function"&&!of(t)){var p=t_(t),m=ra(t,d);return"[Function"+(p?": "+p:" (anonymous)")+"]"+(m.length>0?" { "+vi.call(m,", ")+" }":"")}if(af(t)){var f=Fs?dr.call(String(t),/^(Symbol\(.*\))_[^)]*$/,"$1"):Pl.call(t);return typeof t=="object"&&!Fs?Wn(f):f}if(o_(t)){for(var g="<"+jp.call(String(t.nodeName)),y=t.attributes||[],_=0;_<y.length;_++)g+=" "+y[_].name+"="+nf(Kx(y[_].value),"double",n);return g+=">",t.childNodes&&t.childNodes.length&&(g+="..."),g+="</"+jp.call(String(t.nodeName))+">",g}if(Gl(t)){if(t.length===0)return"[]";var x=ra(t,d);return c&&!h_(x)?"["+Fl(x,c)+"]":"[ "+vi.call(x,", ")+" ]"}if(zx(t)){var v=ra(t,d);return!("cause"in Error.prototype)&&"cause"in t&&!qp.call(t,"cause")?"{ ["+String(t)+"] "+vi.call($p.call("[cause]: "+d(t.cause),v),", ")+" }":v.length===0?"["+String(t)+"]":"{ ["+String(t)+"] "+vi.call(v,", ")+" }"}if(typeof t=="object"&&o){if(sf&&typeof t[sf]=="function"&&Ll)return Ll(t,{depth:u-i});if(o!=="symbol"&&typeof t.inspect=="function")return t.inspect()}if(e_(t)){var S=[];return Kp&&Kp.call(t,function(E,N){S.push(d(N,t,!0)+" => "+d(E,t))}),uf("Map",ea.call(t),S,c)}if(s_(t)){var C=[];return Yp&&Yp.call(t,function(E){C.push(d(E,t))}),uf("Set",ia.call(t),C,c)}if(i_(t))return Nl("WeakMap");if(n_(t))return Nl("WeakSet");if(r_(t))return Nl("WeakRef");if(Jx(t))return Wn(d(Number(t)));if(Qx(t))return Wn(d(Ml.call(t)));if($x(t))return Wn(Bx.call(t));if(jx(t))return Wn(d(String(t)));if(!Yx(t)&&!of(t)){var A=ra(t,d),I=tf?tf(t)===Object.prototype:t instanceof Object||t.constructor===Object,L=t instanceof Object?"":"null prototype",k=!I&&le&&Object(t)===t&&le in t?Al.call(fr(t),8,-1):L?"Object":"",M=I||typeof t.constructor!="function"?"":t.constructor.name?t.constructor.name+" ":"",G=M+(k||L?"["+vi.call($p.call([],k||[],L||[]),": ")+"] ":"");return A.length===0?G+"{}":c?G+"{"+Fl(A,c)+"}":G+"{ "+vi.call(A,", ")+" }"}return String(t)};function nf(r,t,e){var i=(e.quoteStyle||t)==="double"?'"':"'";return i+r+i}function Kx(r){return dr.call(String(r),/"/g,""")}function Gl(r){return fr(r)==="[object Array]"&&(!le||!(typeof r=="object"&&le in r))}function Yx(r){return fr(r)==="[object Date]"&&(!le||!(typeof r=="object"&&le in r))}function of(r){return fr(r)==="[object RegExp]"&&(!le||!(typeof r=="object"&&le in r))}function zx(r){return fr(r)==="[object Error]"&&(!le||!(typeof r=="object"&&le in r))}function jx(r){return fr(r)==="[object String]"&&(!le||!(typeof r=="object"&&le in r))}function Jx(r){return fr(r)==="[object Number]"&&(!le||!(typeof r=="object"&&le in r))}function $x(r){return fr(r)==="[object Boolean]"&&(!le||!(typeof r=="object"&&le in r))}function af(r){if(Fs)return r&&typeof r=="object"&&r instanceof Symbol;if(typeof r=="symbol")return!0;if(!r||typeof r!="object"||!Pl)return!1;try{return Pl.call(r),!0}catch{}return!1}function Qx(r){if(!r||typeof r!="object"||!Ml)return!1;try{return Ml.call(r),!0}catch{}return!1}var qx=Object.prototype.hasOwnProperty||function(r){return r in this};function pr(r,t){return qx.call(r,t)}function fr(r){return Wx.call(r)}function t_(r){if(r.name)return r.name;var t=Xx.call(Ux.call(r),/^function\s*([\w$]+)/);return t?t[1]:null}function hf(r,t){if(r.indexOf)return r.indexOf(t);for(var e=0,i=r.length;e<i;e++)if(r[e]===t)return e;return-1}function e_(r){if(!ea||!r||typeof r!="object")return!1;try{ea.call(r);try{ia.call(r)}catch{return!0}return r instanceof Map}catch{}return!1}function i_(r){if(!On||!r||typeof r!="object")return!1;try{On.call(r,On);try{Bn.call(r,Bn)}catch{return!0}return r instanceof WeakMap}catch{}return!1}function r_(r){if(!zp||!r||typeof r!="object")return!1;try{return zp.call(r),!0}catch{}return!1}function s_(r){if(!ia||!r||typeof r!="object")return!1;try{ia.call(r);try{ea.call(r)}catch{return!0}return r instanceof Set}catch{}return!1}function n_(r){if(!Bn||!r||typeof r!="object")return!1;try{Bn.call(r,Bn);try{On.call(r,On)}catch{return!0}return r instanceof WeakSet}catch{}return!1}function o_(r){return!r||typeof r!="object"?!1:typeof HTMLElement<"u"&&r instanceof HTMLElement?!0:typeof r.nodeName=="string"&&typeof r.getAttribute=="function"}function lf(r,t){if(r.length>t.maxStringLength){var e=r.length-t.maxStringLength,i="... "+e+" more character"+(e>1?"s":"");return lf(Al.call(r,0,t.maxStringLength),t)+i}var s=dr.call(dr.call(r,/(['\\])/g,"\\$1"),/[\x00-\x1f]/g,a_);return nf(s,"single",t)}function a_(r){var t=r.charCodeAt(0),e={8:"b",9:"t",10:"n",12:"f",13:"r"}[t];return e?"\\"+e:"\\x"+(t<16?"0":"")+Zx.call(t.toString(16))}function Wn(r){return"Object("+r+")"}function Nl(r){return r+" { ? }"}function uf(r,t,e,i){var s=i?Fl(e,i):vi.call(e,", ");return r+" ("+t+") {"+s+"}"}function h_(r){for(var t=0;t<r.length;t++)if(hf(r[t],`
|
|
2
|
-
`)>=0)return!1;return!0}function
|
|
3
|
-
`+t.prev+t.base;return e+
|
|
4
|
-
`+t.prev}function ra(r,t){var e=Gl(r),i=[];if(e){i.length=r.length;for(var s=0;s<r.length;s++)i[s]=pr(r,s)?t(r[s],r):""}var n=typeof Rl=="function"?Rl(r):[],o;if(Fs){o={};for(var a=0;a<n.length;a++)o["$"+n[a]]=n[a]}for(var h in r)pr(r,h)&&(e&&String(Number(h))===h&&h<r.length||Fs&&o["$"+h]instanceof Symbol||(Jp.call(/[^\w$]/,h)?i.push(t(h,r)+": "+t(r[h],r)):i.push(h+": "+t(r[h],r))));if(typeof Rl=="function")for(var l=0;l<n.length;l++)qp.call(r,n[l])&&i.push("["+t(n[l])+"]: "+t(r[n[l]],r));return i}var Dl=wl,Ds=Nx,u_=Hx,c_=Dl("%TypeError%"),sa=Dl("%WeakMap%",!0),na=Dl("%Map%",!0),d_=Ds("WeakMap.prototype.get",!0),p_=Ds("WeakMap.prototype.set",!0),f_=Ds("WeakMap.prototype.has",!0),m_=Ds("Map.prototype.get",!0),g_=Ds("Map.prototype.set",!0),y_=Ds("Map.prototype.has",!0),kl=function(r,t){for(var e=r,i;(i=e.next)!==null;e=i)if(i.key===t)return e.next=i.next,i.next=r.next,r.next=i,i},b_=function(r,t){var e=kl(r,t);return e&&e.value},x_=function(r,t,e){var i=kl(r,t);i?i.value=e:r.next={key:t,next:r.next,value:e}},__=function(r,t){return!!kl(r,t)},v_=function(){var t,e,i,s={assert:function(n){if(!s.has(n))throw new c_("Side channel does not contain "+u_(n))},get:function(n){if(sa&&n&&(typeof n=="object"||typeof n=="function")){if(t)return d_(t,n)}else if(na){if(e)return m_(e,n)}else if(i)return b_(i,n)},has:function(n){if(sa&&n&&(typeof n=="object"||typeof n=="function")){if(t)return f_(t,n)}else if(na){if(e)return y_(e,n)}else if(i)return __(i,n);return!1},set:function(n,o){sa&&n&&(typeof n=="object"||typeof n=="function")?(t||(t=new sa),p_(t,n,o)):na?(e||(e=new na),g_(e,n,o)):(i||(i={key:{},next:null}),x_(i,n,o))}};return s},T_=String.prototype.replace,w_=/%20/g,Ol={RFC1738:"RFC1738",RFC3986:"RFC3986"},Bl={default:Ol.RFC3986,formatters:{RFC1738:function(r){return T_.call(r,w_,"+")},RFC3986:function(r){return String(r)}},RFC1738:Ol.RFC1738,RFC3986:Ol.RFC3986},S_=Bl,Wl=Object.prototype.hasOwnProperty,Xr=Array.isArray,Ti=function(){for(var r=[],t=0;t<256;++t)r.push("%"+((t<16?"0":"")+t.toString(16)).toUpperCase());return r}(),E_=function(t){for(;t.length>1;){var e=t.pop(),i=e.obj[e.prop];if(Xr(i)){for(var s=[],n=0;n<i.length;++n)typeof i[n]<"u"&&s.push(i[n]);e.obj[e.prop]=s}}},cf=function(t,e){for(var i=e&&e.plainObjects?Object.create(null):{},s=0;s<t.length;++s)typeof t[s]<"u"&&(i[s]=t[s]);return i},C_=function r(t,e,i){if(!e)return t;if(typeof e!="object"){if(Xr(t))t.push(e);else if(t&&typeof t=="object")(i&&(i.plainObjects||i.allowPrototypes)||!Wl.call(Object.prototype,e))&&(t[e]=!0);else return[t,e];return t}if(!t||typeof t!="object")return[t].concat(e);var s=t;return Xr(t)&&!Xr(e)&&(s=cf(t,i)),Xr(t)&&Xr(e)?(e.forEach(function(n,o){if(Wl.call(t,o)){var a=t[o];a&&typeof a=="object"&&n&&typeof n=="object"?t[o]=r(a,n,i):t.push(n)}else t[o]=n}),t):Object.keys(e).reduce(function(n,o){var a=e[o];return Wl.call(n,o)?n[o]=r(n[o],a,i):n[o]=a,n},s)},I_=function(t,e){return Object.keys(e).reduce(function(i,s){return i[s]=e[s],i},t)},A_=function(r,t,e){var i=r.replace(/\+/g," ");if(e==="iso-8859-1")return i.replace(/%[0-9a-f]{2}/gi,unescape);try{return decodeURIComponent(i)}catch{return i}},M_=function(t,e,i,s,n){if(t.length===0)return t;var o=t;if(typeof t=="symbol"?o=Symbol.prototype.toString.call(t):typeof t!="string"&&(o=String(t)),i==="iso-8859-1")return escape(o).replace(/%u[0-9a-f]{4}/gi,function(u){return"%26%23"+parseInt(u.slice(2),16)+"%3B"});for(var a="",h=0;h<o.length;++h){var l=o.charCodeAt(h);if(l===45||l===46||l===95||l===126||l>=48&&l<=57||l>=65&&l<=90||l>=97&&l<=122||n===S_.RFC1738&&(l===40||l===41)){a+=o.charAt(h);continue}if(l<128){a=a+Ti[l];continue}if(l<2048){a=a+(Ti[192|l>>6]+Ti[128|l&63]);continue}if(l<55296||l>=57344){a=a+(Ti[224|l>>12]+Ti[128|l>>6&63]+Ti[128|l&63]);continue}h+=1,l=65536+((l&1023)<<10|o.charCodeAt(h)&1023),a+=Ti[240|l>>18]+Ti[128|l>>12&63]+Ti[128|l>>6&63]+Ti[128|l&63]}return a},R_=function(t){for(var e=[{obj:{o:t},prop:"o"}],i=[],s=0;s<e.length;++s)for(var n=e[s],o=n.obj[n.prop],a=Object.keys(o),h=0;h<a.length;++h){var l=a[h],u=o[l];typeof u=="object"&&u!==null&&i.indexOf(u)===-1&&(e.push({obj:o,prop:l}),i.push(u))}return E_(e),t},P_=function(t){return Object.prototype.toString.call(t)==="[object RegExp]"},L_=function(t){return!t||typeof t!="object"?!1:!!(t.constructor&&t.constructor.isBuffer&&t.constructor.isBuffer(t))},G_=function(t,e){return[].concat(t,e)},N_=function(t,e){if(Xr(t)){for(var i=[],s=0;s<t.length;s+=1)i.push(e(t[s]));return i}return e(t)},df={arrayToObject:cf,assign:I_,combine:G_,compact:R_,decode:A_,encode:M_,isBuffer:L_,isRegExp:P_,maybeMap:N_,merge:C_},pf=v_,oa=df,Un=Bl,F_=Object.prototype.hasOwnProperty,ff={brackets:function(t){return t+"[]"},comma:"comma",indices:function(t,e){return t+"["+e+"]"},repeat:function(t){return t}},zi=Array.isArray,D_=Array.prototype.push,mf=function(r,t){D_.apply(r,zi(t)?t:[t])},k_=Date.prototype.toISOString,gf=Un.default,ue={addQueryPrefix:!1,allowDots:!1,charset:"utf-8",charsetSentinel:!1,delimiter:"&",encode:!0,encoder:oa.encode,encodeValuesOnly:!1,format:gf,formatter:Un.formatters[gf],indices:!1,serializeDate:function(t){return k_.call(t)},skipNulls:!1,strictNullHandling:!1},O_=function(t){return typeof t=="string"||typeof t=="number"||typeof t=="boolean"||typeof t=="symbol"||typeof t=="bigint"},Ul={},B_=function r(t,e,i,s,n,o,a,h,l,u,c,d,p,m,f,g){for(var y=t,_=g,x=0,v=!1;(_=_.get(Ul))!==void 0&&!v;){var S=_.get(t);if(x+=1,typeof S<"u"){if(S===x)throw new RangeError("Cyclic object value");v=!0}typeof _.get(Ul)>"u"&&(x=0)}if(typeof h=="function"?y=h(e,y):y instanceof Date?y=c(y):i==="comma"&&zi(y)&&(y=oa.maybeMap(y,function(Z){return Z instanceof Date?c(Z):Z})),y===null){if(n)return a&&!m?a(e,ue.encoder,f,"key",d):e;y=""}if(O_(y)||oa.isBuffer(y)){if(a){var C=m?e:a(e,ue.encoder,f,"key",d);return[p(C)+"="+p(a(y,ue.encoder,f,"value",d))]}return[p(e)+"="+p(String(y))]}var A=[];if(typeof y>"u")return A;var I;if(i==="comma"&&zi(y))m&&a&&(y=oa.maybeMap(y,a)),I=[{value:y.length>0?y.join(",")||null:void 0}];else if(zi(h))I=h;else{var L=Object.keys(y);I=l?L.sort(l):L}for(var k=s&&zi(y)&&y.length===1?e+"[]":e,M=0;M<I.length;++M){var G=I[M],E=typeof G=="object"&&typeof G.value<"u"?G.value:y[G];if(!(o&&E===null)){var N=zi(y)?typeof i=="function"?i(k,G):k:k+(u?"."+G:"["+G+"]");g.set(t,x);var O=pf();O.set(Ul,g),mf(A,r(E,N,i,s,n,o,i==="comma"&&m&&zi(y)?null:a,h,l,u,c,d,p,m,f,O))}}return A},W_=function(t){if(!t)return ue;if(t.encoder!==null&&typeof t.encoder<"u"&&typeof t.encoder!="function")throw new TypeError("Encoder has to be a function.");var e=t.charset||ue.charset;if(typeof t.charset<"u"&&t.charset!=="utf-8"&&t.charset!=="iso-8859-1")throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");var i=Un.default;if(typeof t.format<"u"){if(!F_.call(Un.formatters,t.format))throw new TypeError("Unknown format option provided.");i=t.format}var s=Un.formatters[i],n=ue.filter;return(typeof t.filter=="function"||zi(t.filter))&&(n=t.filter),{addQueryPrefix:typeof t.addQueryPrefix=="boolean"?t.addQueryPrefix:ue.addQueryPrefix,allowDots:typeof t.allowDots>"u"?ue.allowDots:!!t.allowDots,charset:e,charsetSentinel:typeof t.charsetSentinel=="boolean"?t.charsetSentinel:ue.charsetSentinel,delimiter:typeof t.delimiter>"u"?ue.delimiter:t.delimiter,encode:typeof t.encode=="boolean"?t.encode:ue.encode,encoder:typeof t.encoder=="function"?t.encoder:ue.encoder,encodeValuesOnly:typeof t.encodeValuesOnly=="boolean"?t.encodeValuesOnly:ue.encodeValuesOnly,filter:n,format:i,formatter:s,serializeDate:typeof t.serializeDate=="function"?t.serializeDate:ue.serializeDate,skipNulls:typeof t.skipNulls=="boolean"?t.skipNulls:ue.skipNulls,sort:typeof t.sort=="function"?t.sort:null,strictNullHandling:typeof t.strictNullHandling=="boolean"?t.strictNullHandling:ue.strictNullHandling}},U_=function(r,t){var e=r,i=W_(t),s,n;typeof i.filter=="function"?(n=i.filter,e=n("",e)):zi(i.filter)&&(n=i.filter,s=n);var o=[];if(typeof e!="object"||e===null)return"";var a;t&&t.arrayFormat in ff?a=t.arrayFormat:t&&"indices"in t?a=t.indices?"indices":"repeat":a="indices";var h=ff[a];if(t&&"commaRoundTrip"in t&&typeof t.commaRoundTrip!="boolean")throw new TypeError("`commaRoundTrip` must be a boolean, or absent");var l=h==="comma"&&t&&t.commaRoundTrip;s||(s=Object.keys(e)),i.sort&&s.sort(i.sort);for(var u=pf(),c=0;c<s.length;++c){var d=s[c];i.skipNulls&&e[d]===null||mf(o,B_(e[d],d,h,l,i.strictNullHandling,i.skipNulls,i.encode?i.encoder:null,i.filter,i.sort,i.allowDots,i.serializeDate,i.format,i.formatter,i.encodeValuesOnly,i.charset,u))}var p=o.join(i.delimiter),m=i.addQueryPrefix===!0?"?":"";return i.charsetSentinel&&(i.charset==="iso-8859-1"?m+="utf8=%26%2310003%3B&":m+="utf8=%E2%9C%93&"),p.length>0?m+p:""},ks=df,Xl=Object.prototype.hasOwnProperty,X_=Array.isArray,te={allowDots:!1,allowPrototypes:!1,allowSparse:!1,arrayLimit:20,charset:"utf-8",charsetSentinel:!1,comma:!1,decoder:ks.decode,delimiter:"&",depth:5,ignoreQueryPrefix:!1,interpretNumericEntities:!1,parameterLimit:1e3,parseArrays:!0,plainObjects:!1,strictNullHandling:!1},Z_=function(r){return r.replace(/&#(\d+);/g,function(t,e){return String.fromCharCode(parseInt(e,10))})},yf=function(r,t){return r&&typeof r=="string"&&t.comma&&r.indexOf(",")>-1?r.split(","):r},V_="utf8=%26%2310003%3B",H_="utf8=%E2%9C%93",K_=function(t,e){var i={__proto__:null},s=e.ignoreQueryPrefix?t.replace(/^\?/,""):t,n=e.parameterLimit===1/0?void 0:e.parameterLimit,o=s.split(e.delimiter,n),a=-1,h,l=e.charset;if(e.charsetSentinel)for(h=0;h<o.length;++h)o[h].indexOf("utf8=")===0&&(o[h]===H_?l="utf-8":o[h]===V_&&(l="iso-8859-1"),a=h,h=o.length);for(h=0;h<o.length;++h)if(h!==a){var u=o[h],c=u.indexOf("]="),d=c===-1?u.indexOf("="):c+1,p,m;d===-1?(p=e.decoder(u,te.decoder,l,"key"),m=e.strictNullHandling?null:""):(p=e.decoder(u.slice(0,d),te.decoder,l,"key"),m=ks.maybeMap(yf(u.slice(d+1),e),function(f){return e.decoder(f,te.decoder,l,"value")})),m&&e.interpretNumericEntities&&l==="iso-8859-1"&&(m=Z_(m)),u.indexOf("[]=")>-1&&(m=X_(m)?[m]:m),Xl.call(i,p)?i[p]=ks.combine(i[p],m):i[p]=m}return i},Y_=function(r,t,e,i){for(var s=i?t:yf(t,e),n=r.length-1;n>=0;--n){var o,a=r[n];if(a==="[]"&&e.parseArrays)o=[].concat(s);else{o=e.plainObjects?Object.create(null):{};var h=a.charAt(0)==="["&&a.charAt(a.length-1)==="]"?a.slice(1,-1):a,l=parseInt(h,10);!e.parseArrays&&h===""?o={0:s}:!isNaN(l)&&a!==h&&String(l)===h&&l>=0&&e.parseArrays&&l<=e.arrayLimit?(o=[],o[l]=s):h!=="__proto__"&&(o[h]=s)}s=o}return s},z_=function(t,e,i,s){if(t){var n=i.allowDots?t.replace(/\.([^.[]+)/g,"[$1]"):t,o=/(\[[^[\]]*])/,a=/(\[[^[\]]*])/g,h=i.depth>0&&o.exec(n),l=h?n.slice(0,h.index):n,u=[];if(l){if(!i.plainObjects&&Xl.call(Object.prototype,l)&&!i.allowPrototypes)return;u.push(l)}for(var c=0;i.depth>0&&(h=a.exec(n))!==null&&c<i.depth;){if(c+=1,!i.plainObjects&&Xl.call(Object.prototype,h[1].slice(1,-1))&&!i.allowPrototypes)return;u.push(h[1])}return h&&u.push("["+n.slice(h.index)+"]"),Y_(u,e,i,s)}},j_=function(t){if(!t)return te;if(t.decoder!==null&&t.decoder!==void 0&&typeof t.decoder!="function")throw new TypeError("Decoder has to be a function.");if(typeof t.charset<"u"&&t.charset!=="utf-8"&&t.charset!=="iso-8859-1")throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");var e=typeof t.charset>"u"?te.charset:t.charset;return{allowDots:typeof t.allowDots>"u"?te.allowDots:!!t.allowDots,allowPrototypes:typeof t.allowPrototypes=="boolean"?t.allowPrototypes:te.allowPrototypes,allowSparse:typeof t.allowSparse=="boolean"?t.allowSparse:te.allowSparse,arrayLimit:typeof t.arrayLimit=="number"?t.arrayLimit:te.arrayLimit,charset:e,charsetSentinel:typeof t.charsetSentinel=="boolean"?t.charsetSentinel:te.charsetSentinel,comma:typeof t.comma=="boolean"?t.comma:te.comma,decoder:typeof t.decoder=="function"?t.decoder:te.decoder,delimiter:typeof t.delimiter=="string"||ks.isRegExp(t.delimiter)?t.delimiter:te.delimiter,depth:typeof t.depth=="number"||t.depth===!1?+t.depth:te.depth,ignoreQueryPrefix:t.ignoreQueryPrefix===!0,interpretNumericEntities:typeof t.interpretNumericEntities=="boolean"?t.interpretNumericEntities:te.interpretNumericEntities,parameterLimit:typeof t.parameterLimit=="number"?t.parameterLimit:te.parameterLimit,parseArrays:t.parseArrays!==!1,plainObjects:typeof t.plainObjects=="boolean"?t.plainObjects:te.plainObjects,strictNullHandling:typeof t.strictNullHandling=="boolean"?t.strictNullHandling:te.strictNullHandling}},J_=function(r,t){var e=j_(t);if(r===""||r===null||typeof r>"u")return e.plainObjects?Object.create(null):{};for(var i=typeof r=="string"?K_(r,e):r,s=e.plainObjects?Object.create(null):{},n=Object.keys(i),o=0;o<n.length;++o){var a=n[o],h=z_(a,i[a],e,typeof r=="string");s=ks.merge(s,h,e)}return e.allowSparse===!0?s:ks.compact(s)},$_=U_,Q_=J_,q_=Bl,t1={formats:q_,parse:Q_,stringify:$_},e1=ax;function ji(){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 i1=/^([a-z0-9.+-]+:)/i,r1=/:[0-9]*$/,s1=/^(\/\/?(?!\/)[^?\s]*)(\?[^\s]*)?$/,n1=["<",">",'"',"`"," ","\r",`
|
|
5
|
-
`," "],
|
|
1
|
+
(function(oe,Y){typeof exports=="object"&&typeof module<"u"?Y(exports,require("vue"),require("@prefecthq/vue-compositions"),require("@prefecthq/prefect-design")):typeof define=="function"&&define.amd?define(["exports","vue","@prefecthq/vue-compositions","@prefecthq/prefect-design"],Y):(oe=typeof globalThis<"u"?globalThis:oe||self,Y(oe["prefect-graphs"]={},oe.Vue,oe.vueCompositions,oe.prefectDesign))})(this,function(oe,Y,Zi,Vi){"use strict";var SR=Object.defineProperty;var ER=(oe,Y,Zi)=>Y in oe?SR(oe,Y,{enumerable:!0,configurable:!0,writable:!0,value:Zi}):oe[Y]=Zi;var lp=(oe,Y,Zi)=>(ER(oe,typeof Y!="symbol"?Y+"":Y,Zi),Zi);const yp="nodes-container",Cb="node-container",Ib="edge-container";function ll(r){"@babel/helpers - typeof";return ll=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ll(r)}function bp(r){if(r===null||r===!0||r===!1)return NaN;var t=Number(r);return isNaN(t)?t:t<0?Math.ceil(t):Math.floor(t)}function Ln(r,t){if(t.length<r)throw new TypeError(r+" argument"+(r>1?"s":"")+" required, but only "+t.length+" present")}function ul(r){Ln(1,arguments);var t=Object.prototype.toString.call(r);return r instanceof Date||ll(r)==="object"&&t==="[object Date]"?new Date(r.getTime()):typeof r=="number"||t==="[object Number]"?new Date(r):((typeof r=="string"||t==="[object String]")&&typeof console<"u"&&(console.warn("Starting with v2.0.0-beta.1 date-fns doesn't accept strings as date arguments. Please use `parseISO` to parse strings. See: https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#string-arguments"),console.warn(new Error().stack)),new Date(NaN))}function Ab(r,t){Ln(2,arguments);var e=ul(r).getTime(),i=bp(t);return new Date(e+i)}function Mb(r,t){Ln(2,arguments);var e=bp(t);return Ab(r,e*1e3)}var Rb=1e3,xp=3600;function _p(r,t){return Ln(2,arguments),ul(r).getTime()-ul(t).getTime()}var vp={ceil:Math.ceil,round:Math.round,floor:Math.floor,trunc:function(t){return t<0?Math.ceil(t):Math.floor(t)}},Pb="trunc";function Lb(r){return r?vp[r]:vp[Pb]}function Gb(r,t,e){Ln(2,arguments);var i=_p(r,t)/1e3;return Lb(e==null?void 0:e.roundingMethod)(i)}var ti=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Gn(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}function Nb(r){if(r.__esModule)return r;var t=r.default;if(typeof t=="function"){var e=function i(){return this instanceof i?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};e.prototype=t.prototype}else e={};return Object.defineProperty(e,"__esModule",{value:!0}),Object.keys(r).forEach(function(i){var s=Object.getOwnPropertyDescriptor(r,i);Object.defineProperty(e,i,s.get?s:{enumerable:!0,get:function(){return r[i]}})}),e}var Yo={exports:{}};Yo.exports,function(r,t){var e=200,i="__lodash_hash_undefined__",s=800,n=16,o=9007199254740991,a="[object Arguments]",h="[object Array]",l="[object AsyncFunction]",u="[object Boolean]",c="[object Date]",d="[object Error]",p="[object Function]",m="[object GeneratorFunction]",f="[object Map]",g="[object Number]",y="[object Null]",_="[object Object]",b="[object Proxy]",v="[object RegExp]",S="[object Set]",E="[object String]",A="[object Undefined]",I="[object WeakMap]",P="[object ArrayBuffer]",W="[object DataView]",G="[object Float32Array]",N="[object Float64Array]",C="[object Int8Array]",F="[object Int16Array]",X="[object Int32Array]",V="[object Uint8Array]",L="[object Uint8ClampedArray]",k="[object Uint16Array]",H="[object Uint32Array]",D=/[\\^$.*+?()[\]{}|]/g,U=/^\[object .+?Constructor\]$/,j=/^(?:0|[1-9]\d*)$/,q={};q[G]=q[N]=q[C]=q[F]=q[X]=q[V]=q[L]=q[k]=q[H]=!0,q[a]=q[h]=q[P]=q[u]=q[W]=q[c]=q[d]=q[p]=q[f]=q[g]=q[_]=q[v]=q[S]=q[E]=q[I]=!1;var dt=typeof ti=="object"&&ti&&ti.Object===Object&&ti,nt=typeof self=="object"&&self&&self.Object===Object&&self,Et=dt||nt||Function("return this")(),Mt=t&&!t.nodeType&&t,wt=Mt&&!0&&r&&!r.nodeType&&r,z=wt&&wt.exports===Mt,it=z&&dt.process,tt=function(){try{var x=wt&&wt.require&&wt.require("util").types;return x||it&&it.binding&&it.binding("util")}catch{}}(),O=tt&&tt.isTypedArray;function yt(x,w,R){switch(R.length){case 0:return x.call(w);case 1:return x.call(w,R[0]);case 2:return x.call(w,R[0],R[1]);case 3:return x.call(w,R[0],R[1],R[2])}return x.apply(w,R)}function mt(x,w){for(var R=-1,Z=Array(x);++R<x;)Z[R]=w(R);return Z}function Rt(x){return function(w){return x(w)}}function Ut(x,w){return x==null?void 0:x[w]}function De(x,w){return function(R){return x(w(R))}}var ci=Array.prototype,Id=Function.prototype,yn=Object.prototype,Ao=Et["__core-js_shared__"],bn=Id.toString,di=yn.hasOwnProperty,kh=function(){var x=/[^.]+$/.exec(Ao&&Ao.keys&&Ao.keys.IE_PROTO||"");return x?"Symbol(src)_1."+x:""}(),Oh=yn.toString,Ad=bn.call(Object),xn=RegExp("^"+bn.call(di).replace(D,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),kr=z?Et.Buffer:void 0,Mo=Et.Symbol,ke=Et.Uint8Array,Ro=kr?kr.allocUnsafe:void 0,Po=De(Object.getPrototypeOf,Object),Bh=Object.create,Wh=yn.propertyIsEnumerable,_n=ci.splice,ki=Mo?Mo.toStringTag:void 0,ws=function(){try{var x=Bo(Object,"defineProperty");return x({},"",{}),x}catch{}}(),Md=kr?kr.isBuffer:void 0,Oi=Math.max,Uh=Date.now,Xh=Bo(Et,"Map"),Ss=Bo(Object,"create"),Lo=function(){function x(){}return function(w){if(!Ui(w))return{};if(Bh)return Bh(w);x.prototype=w;var R=new x;return x.prototype=void 0,R}}();function Oe(x){var w=-1,R=x==null?0:x.length;for(this.clear();++w<R;){var Z=x[w];this.set(Z[0],Z[1])}}function Go(){this.__data__=Ss?Ss(null):{},this.size=0}function No(x){var w=this.has(x)&&delete this.__data__[x];return this.size-=w?1:0,w}function Fo(x){var w=this.__data__;if(Ss){var R=w[x];return R===i?void 0:R}return di.call(w,x)?w[x]:void 0}function Es(x){var w=this.__data__;return Ss?w[x]!==void 0:di.call(w,x)}function Rd(x,w){var R=this.__data__;return this.size+=this.has(x)?0:1,R[x]=Ss&&w===void 0?i:w,this}Oe.prototype.clear=Go,Oe.prototype.delete=No,Oe.prototype.get=Fo,Oe.prototype.has=Es,Oe.prototype.set=Rd;function pi(x){var w=-1,R=x==null?0:x.length;for(this.clear();++w<R;){var Z=x[w];this.set(Z[0],Z[1])}}function Pd(){this.__data__=[],this.size=0}function Ld(x){var w=this.__data__,R=vn(w,x);if(R<0)return!1;var Z=w.length-1;return R==Z?w.pop():_n.call(w,R,1),--this.size,!0}function Gd(x){var w=this.__data__,R=vn(w,x);return R<0?void 0:w[R][1]}function Zh(x){return vn(this.__data__,x)>-1}function Do(x,w){var R=this.__data__,Z=vn(R,x);return Z<0?(++this.size,R.push([x,w])):R[Z][1]=w,this}pi.prototype.clear=Pd,pi.prototype.delete=Ld,pi.prototype.get=Gd,pi.prototype.has=Zh,pi.prototype.set=Do;function Ie(x){var w=-1,R=x==null?0:x.length;for(this.clear();++w<R;){var Z=x[w];this.set(Z[0],Z[1])}}function Nd(){this.size=0,this.__data__={hash:new Oe,map:new(Xh||pi),string:new Oe}}function Fd(x){var w=wn(this,x).delete(x);return this.size-=w?1:0,w}function Dd(x){return wn(this,x).get(x)}function kd(x){return wn(this,x).has(x)}function Od(x,w){var R=wn(this,x),Z=R.size;return R.set(x,w),this.size+=R.size==Z?0:1,this}Ie.prototype.clear=Nd,Ie.prototype.delete=Fd,Ie.prototype.get=Dd,Ie.prototype.has=kd,Ie.prototype.set=Od;function fe(x){var w=this.__data__=new pi(x);this.size=w.size}function Bd(){this.__data__=new pi,this.size=0}function Wd(x){var w=this.__data__,R=w.delete(x);return this.size=w.size,R}function Ud(x){return this.__data__.get(x)}function Xd(x){return this.__data__.has(x)}function Zd(x,w){var R=this.__data__;if(R instanceof pi){var Z=R.__data__;if(!Xh||Z.length<e-1)return Z.push([x,w]),this.size=++R.size,this;R=this.__data__=new Ie(Z)}return R.set(x,w),this.size=R.size,this}fe.prototype.clear=Bd,fe.prototype.delete=Wd,fe.prototype.get=Ud,fe.prototype.has=Xd,fe.prototype.set=Zd;function ur(x,w){var R=Cn(x),Z=!R&&fi(x),ht=!R&&!Z&&$h(x),pt=!R&&!Z&&!ht&&Br(x),gt=R||Z||ht||pt,ot=gt?mt(x.length,String):[],xt=ot.length;for(var Ft in x)(w||di.call(x,Ft))&&!(gt&&(Ft=="length"||ht&&(Ft=="offset"||Ft=="parent")||pt&&(Ft=="buffer"||Ft=="byteLength"||Ft=="byteOffset")||jh(Ft,xt)))&&ot.push(Ft);return ot}function ko(x,w,R){(R!==void 0&&!En(x[w],R)||R===void 0&&!(w in x))&&Oo(x,w,R)}function Vd(x,w,R){var Z=x[w];(!(di.call(x,w)&&En(Z,R))||R===void 0&&!(w in x))&&Oo(x,w,R)}function vn(x,w){for(var R=x.length;R--;)if(En(x[R][0],w))return R;return-1}function Oo(x,w,R){w=="__proto__"&&ws?ws(x,w,{configurable:!0,enumerable:!0,value:R,writable:!0}):x[w]=R}var Hd=qd();function cr(x){return x==null?x===void 0?A:y:ki&&ki in Object(x)?tp(x):rp(x)}function Vh(x){return Or(x)&&cr(x)==a}function Kd(x){if(!Ui(x)||Sn(x))return!1;var w=Is(x)?xn:U;return w.test(op(x))}function Bi(x){return Or(x)&&Qh(x.length)&&!!q[cr(x)]}function Yd(x){if(!Ui(x))return ip(x);var w=dr(x),R=[];for(var Z in x)Z=="constructor"&&(w||!di.call(x,Z))||R.push(Z);return R}function Hh(x,w,R,Z,ht){x!==w&&Hd(w,function(pt,gt){if(ht||(ht=new fe),Ui(pt))zd(x,w,gt,R,Hh,Z,ht);else{var ot=Z?Z(Wo(x,gt),pt,gt+"",x,w,ht):void 0;ot===void 0&&(ot=pt),ko(x,gt,ot)}},el)}function zd(x,w,R,Z,ht,pt,gt){var ot=Wo(x,R),xt=Wo(w,R),Ft=gt.get(xt);if(Ft){ko(x,R,Ft);return}var At=pt?pt(ot,xt,R+"",x,w,gt):void 0,ne=At===void 0;if(ne){var me=Cn(xt),Qe=!me&&$h(xt),qe=!me&&!Qe&&Br(xt);At=xt,me||Qe||qe?Cn(ot)?At=ot:In(ot)?At=Cs(ot):Qe?(ne=!1,At=$d(xt,!0)):qe?(ne=!1,At=Qd(xt,!0)):At=[]:qh(xt)||fi(xt)?(At=ot,fi(ot)?At=tl(ot):(!Ui(ot)||Is(ot))&&(At=zh(xt))):ne=!1}ne&&(gt.set(xt,At),ht(At,xt,Z,pt,gt),gt.delete(xt)),ko(x,R,At)}function jd(x,w){return sp(Wi(x,w,T),x+"")}var Jd=ws?function(x,w){return ws(x,"toString",{configurable:!0,enumerable:!1,value:hp(w),writable:!0})}:T;function $d(x,w){if(w)return x.slice();var R=x.length,Z=Ro?Ro(R):new x.constructor(R);return x.copy(Z),Z}function Tn(x){var w=new x.constructor(x.byteLength);return new ke(w).set(new ke(x)),w}function Qd(x,w){var R=w?Tn(x.buffer):x.buffer;return new x.constructor(R,x.byteOffset,x.length)}function Cs(x,w){var R=-1,Z=x.length;for(w||(w=Array(Z));++R<Z;)w[R]=x[R];return w}function Kh(x,w,R,Z){var ht=!R;R||(R={});for(var pt=-1,gt=w.length;++pt<gt;){var ot=w[pt],xt=Z?Z(R[ot],x[ot],ot,R,x):void 0;xt===void 0&&(xt=x[ot]),ht?Oo(R,ot,xt):Vd(R,ot,xt)}return R}function Yh(x){return jd(function(w,R){var Z=-1,ht=R.length,pt=ht>1?R[ht-1]:void 0,gt=ht>2?R[2]:void 0;for(pt=x.length>3&&typeof pt=="function"?(ht--,pt):void 0,gt&&ep(R[0],R[1],gt)&&(pt=ht<3?void 0:pt,ht=1),w=Object(w);++Z<ht;){var ot=R[Z];ot&&x(w,ot,Z,pt)}return w})}function qd(x){return function(w,R,Z){for(var ht=-1,pt=Object(w),gt=Z(w),ot=gt.length;ot--;){var xt=gt[x?ot:++ht];if(R(pt[xt],xt,pt)===!1)break}return w}}function wn(x,w){var R=x.__data__;return Jh(w)?R[typeof w=="string"?"string":"hash"]:R.map}function Bo(x,w){var R=Ut(x,w);return Kd(R)?R:void 0}function tp(x){var w=di.call(x,ki),R=x[ki];try{x[ki]=void 0;var Z=!0}catch{}var ht=Oh.call(x);return Z&&(w?x[ki]=R:delete x[ki]),ht}function zh(x){return typeof x.constructor=="function"&&!dr(x)?Lo(Po(x)):{}}function jh(x,w){var R=typeof x;return w=w??o,!!w&&(R=="number"||R!="symbol"&&j.test(x))&&x>-1&&x%1==0&&x<w}function ep(x,w,R){if(!Ui(R))return!1;var Z=typeof w;return(Z=="number"?Uo(R)&&jh(w,R.length):Z=="string"&&w in R)?En(R[w],x):!1}function Jh(x){var w=typeof x;return w=="string"||w=="number"||w=="symbol"||w=="boolean"?x!=="__proto__":x===null}function Sn(x){return!!kh&&kh in x}function dr(x){var w=x&&x.constructor,R=typeof w=="function"&&w.prototype||yn;return x===R}function ip(x){var w=[];if(x!=null)for(var R in Object(x))w.push(R);return w}function rp(x){return Oh.call(x)}function Wi(x,w,R){return w=Oi(w===void 0?x.length-1:w,0),function(){for(var Z=arguments,ht=-1,pt=Oi(Z.length-w,0),gt=Array(pt);++ht<pt;)gt[ht]=Z[w+ht];ht=-1;for(var ot=Array(w+1);++ht<w;)ot[ht]=Z[ht];return ot[w]=R(gt),yt(x,this,ot)}}function Wo(x,w){if(!(w==="constructor"&&typeof x[w]=="function")&&w!="__proto__")return x[w]}var sp=np(Jd);function np(x){var w=0,R=0;return function(){var Z=Uh(),ht=n-(Z-R);if(R=Z,ht>0){if(++w>=s)return arguments[0]}else w=0;return x.apply(void 0,arguments)}}function op(x){if(x!=null){try{return bn.call(x)}catch{}try{return x+""}catch{}}return""}function En(x,w){return x===w||x!==x&&w!==w}var fi=Vh(function(){return arguments}())?Vh:function(x){return Or(x)&&di.call(x,"callee")&&!Wh.call(x,"callee")},Cn=Array.isArray;function Uo(x){return x!=null&&Qh(x.length)&&!Is(x)}function In(x){return Or(x)&&Uo(x)}var $h=Md||M;function Is(x){if(!Ui(x))return!1;var w=cr(x);return w==p||w==m||w==l||w==b}function Qh(x){return typeof x=="number"&&x>-1&&x%1==0&&x<=o}function Ui(x){var w=typeof x;return x!=null&&(w=="object"||w=="function")}function Or(x){return x!=null&&typeof x=="object"}function qh(x){if(!Or(x)||cr(x)!=_)return!1;var w=Po(x);if(w===null)return!0;var R=di.call(w,"constructor")&&w.constructor;return typeof R=="function"&&R instanceof R&&bn.call(R)==Ad}var Br=O?Rt(O):Bi;function tl(x){return Kh(x,el(x))}function el(x){return Uo(x)?ur(x,!0):Yd(x)}var ap=Yh(function(x,w,R){Hh(x,w,R)});function hp(x){return function(){return x}}function T(x){return x}function M(){return!1}r.exports=ap}(Yo,Yo.exports);var Fb=Yo.exports;const Db=Gn(Fb);function kb(){const r=new Map;function t(o,a){const h=r.get(o);return h?h.add(a):r.set(o,new Set([a])),()=>i(o,a)}function e(o,a){const h=l=>{i(o,h),a(l)};t(o,h)}function i(o,a){var h;(h=r.get(o))==null||h.delete(a)}function s(o,a){var h;(h=r.get(o))==null||h.forEach(l=>l(a))}function n(){r.clear()}return{on:t,off:i,once:e,emit:s,clear:n}}const _t=kb();function We(r){let t;return new Promise(e=>{t=e,_t.on(r,t)}).then(e=>(_t.off(r,t),e))}let Wr=null;function Ob(){Wr=Y.effectScope()}function Bb(){Wr==null||Wr.stop(),Wr=null}async function Wb(){return Wr||await We("scopeCreated")}let pr=null;const Tp={animationDuration:500,disableAnimationsThreshold:500,disableEdgesThreshold:500,styles:{colorMode:"dark",rowGap:16,columnGap:32,textDefault:"#ffffff",textInverse:"#000000",nodesPadding:16,nodeHeight:32,nodePadding:4,nodeRadius:6,nodeBorderRadius:9,nodeToggleSize:28,nodeToggleBorderRadius:6,nodeToggleBorderColor:"#51525C",nodeSelectedBorderColor:"#3fa2c3",nodeUnselectedAlpha:.2,edgeColor:"#51525C",guideLineWidth:1,guideLineColor:"#51525C",guideTextTopPadding:8,guideTextLeftPadding:8,guideTextSize:12,guideTextColor:"#ADADAD",playheadWidth:2,playheadColor:"#6272FF",node:()=>({background:"#ffffff"})}};function Ub(r){const t=Db({},Tp,r);return t.styles.node=e=>{var i,s;return{...Tp.styles.node(e),...(s=(i=r.styles)==null?void 0:i.node)==null?void 0:s.call(i,e)}},t}async function Xb(r){(await Wb()).run(()=>{Y.watch(()=>r.config,e=>{const i=Ub(e);if(!pr){pr=i,_t.emit("configCreated",pr);return}Object.assign(pr,i),_t.emit("configUpdated",pr)},{immediate:!0})})}function Zb(){pr=null}async function ge(){return pr||await We("configCreated")}var Ur=(r=>(r[r.WEBGL_LEGACY=0]="WEBGL_LEGACY",r[r.WEBGL=1]="WEBGL",r[r.WEBGL2=2]="WEBGL2",r))(Ur||{}),wp=(r=>(r[r.UNKNOWN=0]="UNKNOWN",r[r.WEBGL=1]="WEBGL",r[r.CANVAS=2]="CANVAS",r))(wp||{}),cl=(r=>(r[r.COLOR=16384]="COLOR",r[r.DEPTH=256]="DEPTH",r[r.STENCIL=1024]="STENCIL",r))(cl||{}),ut=(r=>(r[r.NORMAL=0]="NORMAL",r[r.ADD=1]="ADD",r[r.MULTIPLY=2]="MULTIPLY",r[r.SCREEN=3]="SCREEN",r[r.OVERLAY=4]="OVERLAY",r[r.DARKEN=5]="DARKEN",r[r.LIGHTEN=6]="LIGHTEN",r[r.COLOR_DODGE=7]="COLOR_DODGE",r[r.COLOR_BURN=8]="COLOR_BURN",r[r.HARD_LIGHT=9]="HARD_LIGHT",r[r.SOFT_LIGHT=10]="SOFT_LIGHT",r[r.DIFFERENCE=11]="DIFFERENCE",r[r.EXCLUSION=12]="EXCLUSION",r[r.HUE=13]="HUE",r[r.SATURATION=14]="SATURATION",r[r.COLOR=15]="COLOR",r[r.LUMINOSITY=16]="LUMINOSITY",r[r.NORMAL_NPM=17]="NORMAL_NPM",r[r.ADD_NPM=18]="ADD_NPM",r[r.SCREEN_NPM=19]="SCREEN_NPM",r[r.NONE=20]="NONE",r[r.SRC_OVER=0]="SRC_OVER",r[r.SRC_IN=21]="SRC_IN",r[r.SRC_OUT=22]="SRC_OUT",r[r.SRC_ATOP=23]="SRC_ATOP",r[r.DST_OVER=24]="DST_OVER",r[r.DST_IN=25]="DST_IN",r[r.DST_OUT=26]="DST_OUT",r[r.DST_ATOP=27]="DST_ATOP",r[r.ERASE=26]="ERASE",r[r.SUBTRACT=28]="SUBTRACT",r[r.XOR=29]="XOR",r))(ut||{}),gi=(r=>(r[r.POINTS=0]="POINTS",r[r.LINES=1]="LINES",r[r.LINE_LOOP=2]="LINE_LOOP",r[r.LINE_STRIP=3]="LINE_STRIP",r[r.TRIANGLES=4]="TRIANGLES",r[r.TRIANGLE_STRIP=5]="TRIANGLE_STRIP",r[r.TRIANGLE_FAN=6]="TRIANGLE_FAN",r))(gi||{}),K=(r=>(r[r.RGBA=6408]="RGBA",r[r.RGB=6407]="RGB",r[r.RG=33319]="RG",r[r.RED=6403]="RED",r[r.RGBA_INTEGER=36249]="RGBA_INTEGER",r[r.RGB_INTEGER=36248]="RGB_INTEGER",r[r.RG_INTEGER=33320]="RG_INTEGER",r[r.RED_INTEGER=36244]="RED_INTEGER",r[r.ALPHA=6406]="ALPHA",r[r.LUMINANCE=6409]="LUMINANCE",r[r.LUMINANCE_ALPHA=6410]="LUMINANCE_ALPHA",r[r.DEPTH_COMPONENT=6402]="DEPTH_COMPONENT",r[r.DEPTH_STENCIL=34041]="DEPTH_STENCIL",r))(K||{}),Ms=(r=>(r[r.TEXTURE_2D=3553]="TEXTURE_2D",r[r.TEXTURE_CUBE_MAP=34067]="TEXTURE_CUBE_MAP",r[r.TEXTURE_2D_ARRAY=35866]="TEXTURE_2D_ARRAY",r[r.TEXTURE_CUBE_MAP_POSITIVE_X=34069]="TEXTURE_CUBE_MAP_POSITIVE_X",r[r.TEXTURE_CUBE_MAP_NEGATIVE_X=34070]="TEXTURE_CUBE_MAP_NEGATIVE_X",r[r.TEXTURE_CUBE_MAP_POSITIVE_Y=34071]="TEXTURE_CUBE_MAP_POSITIVE_Y",r[r.TEXTURE_CUBE_MAP_NEGATIVE_Y=34072]="TEXTURE_CUBE_MAP_NEGATIVE_Y",r[r.TEXTURE_CUBE_MAP_POSITIVE_Z=34073]="TEXTURE_CUBE_MAP_POSITIVE_Z",r[r.TEXTURE_CUBE_MAP_NEGATIVE_Z=34074]="TEXTURE_CUBE_MAP_NEGATIVE_Z",r))(Ms||{}),at=(r=>(r[r.UNSIGNED_BYTE=5121]="UNSIGNED_BYTE",r[r.UNSIGNED_SHORT=5123]="UNSIGNED_SHORT",r[r.UNSIGNED_SHORT_5_6_5=33635]="UNSIGNED_SHORT_5_6_5",r[r.UNSIGNED_SHORT_4_4_4_4=32819]="UNSIGNED_SHORT_4_4_4_4",r[r.UNSIGNED_SHORT_5_5_5_1=32820]="UNSIGNED_SHORT_5_5_5_1",r[r.UNSIGNED_INT=5125]="UNSIGNED_INT",r[r.UNSIGNED_INT_10F_11F_11F_REV=35899]="UNSIGNED_INT_10F_11F_11F_REV",r[r.UNSIGNED_INT_2_10_10_10_REV=33640]="UNSIGNED_INT_2_10_10_10_REV",r[r.UNSIGNED_INT_24_8=34042]="UNSIGNED_INT_24_8",r[r.UNSIGNED_INT_5_9_9_9_REV=35902]="UNSIGNED_INT_5_9_9_9_REV",r[r.BYTE=5120]="BYTE",r[r.SHORT=5122]="SHORT",r[r.INT=5124]="INT",r[r.FLOAT=5126]="FLOAT",r[r.FLOAT_32_UNSIGNED_INT_24_8_REV=36269]="FLOAT_32_UNSIGNED_INT_24_8_REV",r[r.HALF_FLOAT=36193]="HALF_FLOAT",r))(at||{}),$=(r=>(r[r.FLOAT=0]="FLOAT",r[r.INT=1]="INT",r[r.UINT=2]="UINT",r))($||{}),Hi=(r=>(r[r.NEAREST=0]="NEAREST",r[r.LINEAR=1]="LINEAR",r))(Hi||{}),Ki=(r=>(r[r.CLAMP=33071]="CLAMP",r[r.REPEAT=10497]="REPEAT",r[r.MIRRORED_REPEAT=33648]="MIRRORED_REPEAT",r))(Ki||{}),yi=(r=>(r[r.OFF=0]="OFF",r[r.POW2=1]="POW2",r[r.ON=2]="ON",r[r.ON_MANUAL=3]="ON_MANUAL",r))(yi||{}),xe=(r=>(r[r.NPM=0]="NPM",r[r.UNPACK=1]="UNPACK",r[r.PMA=2]="PMA",r[r.NO_PREMULTIPLIED_ALPHA=0]="NO_PREMULTIPLIED_ALPHA",r[r.PREMULTIPLY_ON_UPLOAD=1]="PREMULTIPLY_ON_UPLOAD",r[r.PREMULTIPLIED_ALPHA=2]="PREMULTIPLIED_ALPHA",r))(xe||{}),bi=(r=>(r[r.NO=0]="NO",r[r.YES=1]="YES",r[r.AUTO=2]="AUTO",r[r.BLEND=0]="BLEND",r[r.CLEAR=1]="CLEAR",r[r.BLIT=2]="BLIT",r))(bi||{}),dl=(r=>(r[r.AUTO=0]="AUTO",r[r.MANUAL=1]="MANUAL",r))(dl||{}),Ue=(r=>(r.LOW="lowp",r.MEDIUM="mediump",r.HIGH="highp",r))(Ue||{}),jt=(r=>(r[r.NONE=0]="NONE",r[r.SCISSOR=1]="SCISSOR",r[r.STENCIL=2]="STENCIL",r[r.SPRITE=3]="SPRITE",r[r.COLOR=4]="COLOR",r))(jt||{}),Yt=(r=>(r[r.NONE=0]="NONE",r[r.LOW=2]="LOW",r[r.MEDIUM=4]="MEDIUM",r[r.HIGH=8]="HIGH",r))(Yt||{}),xi=(r=>(r[r.ELEMENT_ARRAY_BUFFER=34963]="ELEMENT_ARRAY_BUFFER",r[r.ARRAY_BUFFER=34962]="ARRAY_BUFFER",r[r.UNIFORM_BUFFER=35345]="UNIFORM_BUFFER",r))(xi||{});const Q={ADAPTER:{createCanvas:(r,t)=>{const e=document.createElement("canvas");return e.width=r,e.height=t,e},getCanvasRenderingContext2D:()=>CanvasRenderingContext2D,getWebGLRenderingContext:()=>WebGLRenderingContext,getNavigator:()=>navigator,getBaseUrl:()=>document.baseURI??window.location.href,getFontFaceSet:()=>document.fonts,fetch:(r,t)=>fetch(r,t),parseXML:r=>new DOMParser().parseFromString(r,"text/xml")},RESOLUTION:1,CREATE_IMAGE_BITMAP:!1,ROUND_PIXELS:!1};var pl=/iPhone/i,Sp=/iPod/i,Ep=/iPad/i,Cp=/\biOS-universal(?:.+)Mac\b/i,fl=/\bAndroid(?:.+)Mobile\b/i,Ip=/Android/i,Rs=/(?:SD4930UR|\bSilk(?:.+)Mobile\b)/i,zo=/Silk/i,Yi=/Windows Phone/i,Ap=/\bWindows(?:.+)ARM\b/i,Mp=/BlackBerry/i,Rp=/BB10/i,Pp=/Opera Mini/i,Lp=/\b(CriOS|Chrome)(?:.+)Mobile/i,Gp=/Mobile(?:.+)Firefox\b/i,Np=function(r){return typeof r<"u"&&r.platform==="MacIntel"&&typeof r.maxTouchPoints=="number"&&r.maxTouchPoints>1&&typeof MSStream>"u"};function Vb(r){return function(t){return t.test(r)}}function Fp(r){var t={userAgent:"",platform:"",maxTouchPoints:0};!r&&typeof navigator<"u"?t={userAgent:navigator.userAgent,platform:navigator.platform,maxTouchPoints:navigator.maxTouchPoints||0}:typeof r=="string"?t.userAgent=r:r&&r.userAgent&&(t={userAgent:r.userAgent,platform:r.platform,maxTouchPoints:r.maxTouchPoints||0});var e=t.userAgent,i=e.split("[FBAN");typeof i[1]<"u"&&(e=i[0]),i=e.split("Twitter"),typeof i[1]<"u"&&(e=i[0]);var s=Vb(e),n={apple:{phone:s(pl)&&!s(Yi),ipod:s(Sp),tablet:!s(pl)&&(s(Ep)||Np(t))&&!s(Yi),universal:s(Cp),device:(s(pl)||s(Sp)||s(Ep)||s(Cp)||Np(t))&&!s(Yi)},amazon:{phone:s(Rs),tablet:!s(Rs)&&s(zo),device:s(Rs)||s(zo)},android:{phone:!s(Yi)&&s(Rs)||!s(Yi)&&s(fl),tablet:!s(Yi)&&!s(Rs)&&!s(fl)&&(s(zo)||s(Ip)),device:!s(Yi)&&(s(Rs)||s(zo)||s(fl)||s(Ip))||s(/\bokhttp\b/i)},windows:{phone:s(Yi),tablet:s(Ap),device:s(Yi)||s(Ap)},other:{blackberry:s(Mp),blackberry10:s(Rp),opera:s(Pp),firefox:s(Gp),chrome:s(Lp),device:s(Mp)||s(Rp)||s(Pp)||s(Gp)||s(Lp)},any:!1,phone:!1,tablet:!1};return n.any=n.apple.device||n.android.device||n.windows.device||n.other.device,n.phone=n.apple.phone||n.android.phone||n.windows.phone,n.tablet=n.apple.tablet||n.android.tablet||n.windows.tablet,n}const Hb=Fp.default??Fp,zi=Hb(globalThis.navigator);Q.RETINA_PREFIX=/@([0-9\.]+)x/,Q.FAIL_IF_MAJOR_PERFORMANCE_CAVEAT=!1;var Dp={exports:{}};(function(r){var t=Object.prototype.hasOwnProperty,e="~";function i(){}Object.create&&(i.prototype=Object.create(null),new i().__proto__||(e=!1));function s(h,l,u){this.fn=h,this.context=l,this.once=u||!1}function n(h,l,u,c,d){if(typeof u!="function")throw new TypeError("The listener must be a function");var p=new s(u,c||h,d),m=e?e+l:l;return h._events[m]?h._events[m].fn?h._events[m]=[h._events[m],p]:h._events[m].push(p):(h._events[m]=p,h._eventsCount++),h}function o(h,l){--h._eventsCount===0?h._events=new i:delete h._events[l]}function a(){this._events=new i,this._eventsCount=0}a.prototype.eventNames=function(){var l=[],u,c;if(this._eventsCount===0)return l;for(c in u=this._events)t.call(u,c)&&l.push(e?c.slice(1):c);return Object.getOwnPropertySymbols?l.concat(Object.getOwnPropertySymbols(u)):l},a.prototype.listeners=function(l){var u=e?e+l:l,c=this._events[u];if(!c)return[];if(c.fn)return[c.fn];for(var d=0,p=c.length,m=new Array(p);d<p;d++)m[d]=c[d].fn;return m},a.prototype.listenerCount=function(l){var u=e?e+l:l,c=this._events[u];return c?c.fn?1:c.length:0},a.prototype.emit=function(l,u,c,d,p,m){var f=e?e+l:l;if(!this._events[f])return!1;var g=this._events[f],y=arguments.length,_,b;if(g.fn){switch(g.once&&this.removeListener(l,g.fn,void 0,!0),y){case 1:return g.fn.call(g.context),!0;case 2:return g.fn.call(g.context,u),!0;case 3:return g.fn.call(g.context,u,c),!0;case 4:return g.fn.call(g.context,u,c,d),!0;case 5:return g.fn.call(g.context,u,c,d,p),!0;case 6:return g.fn.call(g.context,u,c,d,p,m),!0}for(b=1,_=new Array(y-1);b<y;b++)_[b-1]=arguments[b];g.fn.apply(g.context,_)}else{var v=g.length,S;for(b=0;b<v;b++)switch(g[b].once&&this.removeListener(l,g[b].fn,void 0,!0),y){case 1:g[b].fn.call(g[b].context);break;case 2:g[b].fn.call(g[b].context,u);break;case 3:g[b].fn.call(g[b].context,u,c);break;case 4:g[b].fn.call(g[b].context,u,c,d);break;default:if(!_)for(S=1,_=new Array(y-1);S<y;S++)_[S-1]=arguments[S];g[b].fn.apply(g[b].context,_)}}return!0},a.prototype.on=function(l,u,c){return n(this,l,u,c,!1)},a.prototype.once=function(l,u,c){return n(this,l,u,c,!0)},a.prototype.removeListener=function(l,u,c,d){var p=e?e+l:l;if(!this._events[p])return this;if(!u)return o(this,p),this;var m=this._events[p];if(m.fn)m.fn===u&&(!d||m.once)&&(!c||m.context===c)&&o(this,p);else{for(var f=0,g=[],y=m.length;f<y;f++)(m[f].fn!==u||d&&!m[f].once||c&&m[f].context!==c)&&g.push(m[f]);g.length?this._events[p]=g.length===1?g[0]:g:o(this,p)}return this},a.prototype.removeAllListeners=function(l){var u;return l?(u=e?e+l:l,this._events[u]&&o(this,u)):(this._events=new i,this._eventsCount=0),this},a.prototype.off=a.prototype.removeListener,a.prototype.addListener=a.prototype.on,a.prefixed=e,a.EventEmitter=a,r.exports=a})(Dp);var Kb=Dp.exports;const Nn=Gn(Kb);var ml={exports:{}};ml.exports=jo,ml.exports.default=jo;function jo(r,t,e){e=e||2;var i=t&&t.length,s=i?t[0]*e:r.length,n=kp(r,0,s,e,!0),o=[];if(!n||n.next===n.prev)return o;var a,h,l,u,c,d,p;if(i&&(n=$b(r,t,n,e)),r.length>80*e){a=l=r[0],h=u=r[1];for(var m=e;m<s;m+=e)c=r[m],d=r[m+1],c<a&&(a=c),d<h&&(h=d),c>l&&(l=c),d>u&&(u=d);p=Math.max(l-a,u-h),p=p!==0?32767/p:0}return Fn(n,o,e,a,h,p,0),o}function kp(r,t,e,i,s){var n,o;if(s===bl(r,t,e,i)>0)for(n=t;n<e;n+=i)o=Wp(n,r[n],r[n+1],o);else for(n=e-i;n>=t;n-=i)o=Wp(n,r[n],r[n+1],o);return o&&Jo(o,o.next)&&(kn(o),o=o.next),o}function Xr(r,t){if(!r)return r;t||(t=r);var e=r,i;do if(i=!1,!e.steiner&&(Jo(e,e.next)||Dt(e.prev,e,e.next)===0)){if(kn(e),e=t=e.prev,e===e.next)break;i=!0}else e=e.next;while(i||e!==t);return t}function Fn(r,t,e,i,s,n,o){if(r){!o&&n&&ix(r,i,s,n);for(var a=r,h,l;r.prev!==r.next;){if(h=r.prev,l=r.next,n?zb(r,i,s,n):Yb(r)){t.push(h.i/e|0),t.push(r.i/e|0),t.push(l.i/e|0),kn(r),r=l.next,a=l.next;continue}if(r=l,r===a){o?o===1?(r=jb(Xr(r),t,e),Fn(r,t,e,i,s,n,2)):o===2&&Jb(r,t,e,i,s,n):Fn(Xr(r),t,e,i,s,n,1);break}}}}function Yb(r){var t=r.prev,e=r,i=r.next;if(Dt(t,e,i)>=0)return!1;for(var s=t.x,n=e.x,o=i.x,a=t.y,h=e.y,l=i.y,u=s<n?s<o?s:o:n<o?n:o,c=a<h?a<l?a:l:h<l?h:l,d=s>n?s>o?s:o:n>o?n:o,p=a>h?a>l?a:l:h>l?h:l,m=i.next;m!==t;){if(m.x>=u&&m.x<=d&&m.y>=c&&m.y<=p&&Ps(s,a,n,h,o,l,m.x,m.y)&&Dt(m.prev,m,m.next)>=0)return!1;m=m.next}return!0}function zb(r,t,e,i){var s=r.prev,n=r,o=r.next;if(Dt(s,n,o)>=0)return!1;for(var a=s.x,h=n.x,l=o.x,u=s.y,c=n.y,d=o.y,p=a<h?a<l?a:l:h<l?h:l,m=u<c?u<d?u:d:c<d?c:d,f=a>h?a>l?a:l:h>l?h:l,g=u>c?u>d?u:d:c>d?c:d,y=gl(p,m,t,e,i),_=gl(f,g,t,e,i),b=r.prevZ,v=r.nextZ;b&&b.z>=y&&v&&v.z<=_;){if(b.x>=p&&b.x<=f&&b.y>=m&&b.y<=g&&b!==s&&b!==o&&Ps(a,u,h,c,l,d,b.x,b.y)&&Dt(b.prev,b,b.next)>=0||(b=b.prevZ,v.x>=p&&v.x<=f&&v.y>=m&&v.y<=g&&v!==s&&v!==o&&Ps(a,u,h,c,l,d,v.x,v.y)&&Dt(v.prev,v,v.next)>=0))return!1;v=v.nextZ}for(;b&&b.z>=y;){if(b.x>=p&&b.x<=f&&b.y>=m&&b.y<=g&&b!==s&&b!==o&&Ps(a,u,h,c,l,d,b.x,b.y)&&Dt(b.prev,b,b.next)>=0)return!1;b=b.prevZ}for(;v&&v.z<=_;){if(v.x>=p&&v.x<=f&&v.y>=m&&v.y<=g&&v!==s&&v!==o&&Ps(a,u,h,c,l,d,v.x,v.y)&&Dt(v.prev,v,v.next)>=0)return!1;v=v.nextZ}return!0}function jb(r,t,e){var i=r;do{var s=i.prev,n=i.next.next;!Jo(s,n)&&Op(s,i,i.next,n)&&Dn(s,n)&&Dn(n,s)&&(t.push(s.i/e|0),t.push(i.i/e|0),t.push(n.i/e|0),kn(i),kn(i.next),i=r=n),i=i.next}while(i!==r);return Xr(i)}function Jb(r,t,e,i,s,n){var o=r;do{for(var a=o.next.next;a!==o.prev;){if(o.i!==a.i&&nx(o,a)){var h=Bp(o,a);o=Xr(o,o.next),h=Xr(h,h.next),Fn(o,t,e,i,s,n,0),Fn(h,t,e,i,s,n,0);return}a=a.next}o=o.next}while(o!==r)}function $b(r,t,e,i){var s=[],n,o,a,h,l;for(n=0,o=t.length;n<o;n++)a=t[n]*i,h=n<o-1?t[n+1]*i:r.length,l=kp(r,a,h,i,!1),l===l.next&&(l.steiner=!0),s.push(sx(l));for(s.sort(Qb),n=0;n<s.length;n++)e=qb(s[n],e);return e}function Qb(r,t){return r.x-t.x}function qb(r,t){var e=tx(r,t);if(!e)return t;var i=Bp(e,r);return Xr(i,i.next),Xr(e,e.next)}function tx(r,t){var e=t,i=r.x,s=r.y,n=-1/0,o;do{if(s<=e.y&&s>=e.next.y&&e.next.y!==e.y){var a=e.x+(s-e.y)*(e.next.x-e.x)/(e.next.y-e.y);if(a<=i&&a>n&&(n=a,o=e.x<e.next.x?e:e.next,a===i))return o}e=e.next}while(e!==t);if(!o)return null;var h=o,l=o.x,u=o.y,c=1/0,d;e=o;do i>=e.x&&e.x>=l&&i!==e.x&&Ps(s<u?i:n,s,l,u,s<u?n:i,s,e.x,e.y)&&(d=Math.abs(s-e.y)/(i-e.x),Dn(e,r)&&(d<c||d===c&&(e.x>o.x||e.x===o.x&&ex(o,e)))&&(o=e,c=d)),e=e.next;while(e!==h);return o}function ex(r,t){return Dt(r.prev,r,t.prev)<0&&Dt(t.next,r,r.next)<0}function ix(r,t,e,i){var s=r;do s.z===0&&(s.z=gl(s.x,s.y,t,e,i)),s.prevZ=s.prev,s.nextZ=s.next,s=s.next;while(s!==r);s.prevZ.nextZ=null,s.prevZ=null,rx(s)}function rx(r){var t,e,i,s,n,o,a,h,l=1;do{for(e=r,r=null,n=null,o=0;e;){for(o++,i=e,a=0,t=0;t<l&&(a++,i=i.nextZ,!!i);t++);for(h=l;a>0||h>0&&i;)a!==0&&(h===0||!i||e.z<=i.z)?(s=e,e=e.nextZ,a--):(s=i,i=i.nextZ,h--),n?n.nextZ=s:r=s,s.prevZ=n,n=s;e=i}n.nextZ=null,l*=2}while(o>1);return r}function gl(r,t,e,i,s){return r=(r-e)*s|0,t=(t-i)*s|0,r=(r|r<<8)&16711935,r=(r|r<<4)&252645135,r=(r|r<<2)&858993459,r=(r|r<<1)&1431655765,t=(t|t<<8)&16711935,t=(t|t<<4)&252645135,t=(t|t<<2)&858993459,t=(t|t<<1)&1431655765,r|t<<1}function sx(r){var t=r,e=r;do(t.x<e.x||t.x===e.x&&t.y<e.y)&&(e=t),t=t.next;while(t!==r);return e}function Ps(r,t,e,i,s,n,o,a){return(s-o)*(t-a)>=(r-o)*(n-a)&&(r-o)*(i-a)>=(e-o)*(t-a)&&(e-o)*(n-a)>=(s-o)*(i-a)}function nx(r,t){return r.next.i!==t.i&&r.prev.i!==t.i&&!ox(r,t)&&(Dn(r,t)&&Dn(t,r)&&ax(r,t)&&(Dt(r.prev,r,t.prev)||Dt(r,t.prev,t))||Jo(r,t)&&Dt(r.prev,r,r.next)>0&&Dt(t.prev,t,t.next)>0)}function Dt(r,t,e){return(t.y-r.y)*(e.x-t.x)-(t.x-r.x)*(e.y-t.y)}function Jo(r,t){return r.x===t.x&&r.y===t.y}function Op(r,t,e,i){var s=Qo(Dt(r,t,e)),n=Qo(Dt(r,t,i)),o=Qo(Dt(e,i,r)),a=Qo(Dt(e,i,t));return!!(s!==n&&o!==a||s===0&&$o(r,e,t)||n===0&&$o(r,i,t)||o===0&&$o(e,r,i)||a===0&&$o(e,t,i))}function $o(r,t,e){return t.x<=Math.max(r.x,e.x)&&t.x>=Math.min(r.x,e.x)&&t.y<=Math.max(r.y,e.y)&&t.y>=Math.min(r.y,e.y)}function Qo(r){return r>0?1:r<0?-1:0}function ox(r,t){var e=r;do{if(e.i!==r.i&&e.next.i!==r.i&&e.i!==t.i&&e.next.i!==t.i&&Op(e,e.next,r,t))return!0;e=e.next}while(e!==r);return!1}function Dn(r,t){return Dt(r.prev,r,r.next)<0?Dt(r,t,r.next)>=0&&Dt(r,r.prev,t)>=0:Dt(r,t,r.prev)<0||Dt(r,r.next,t)<0}function ax(r,t){var e=r,i=!1,s=(r.x+t.x)/2,n=(r.y+t.y)/2;do e.y>n!=e.next.y>n&&e.next.y!==e.y&&s<(e.next.x-e.x)*(n-e.y)/(e.next.y-e.y)+e.x&&(i=!i),e=e.next;while(e!==r);return i}function Bp(r,t){var e=new yl(r.i,r.x,r.y),i=new yl(t.i,t.x,t.y),s=r.next,n=t.prev;return r.next=t,t.prev=r,e.next=s,s.prev=e,i.next=e,e.prev=i,n.next=i,i.prev=n,i}function Wp(r,t,e,i){var s=new yl(r,t,e);return i?(s.next=i.next,s.prev=i,i.next.prev=s,i.next=s):(s.prev=s,s.next=s),s}function kn(r){r.next.prev=r.prev,r.prev.next=r.next,r.prevZ&&(r.prevZ.nextZ=r.nextZ),r.nextZ&&(r.nextZ.prevZ=r.prevZ)}function yl(r,t,e){this.i=r,this.x=t,this.y=e,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}jo.deviation=function(r,t,e,i){var s=t&&t.length,n=s?t[0]*e:r.length,o=Math.abs(bl(r,0,n,e));if(s)for(var a=0,h=t.length;a<h;a++){var l=t[a]*e,u=a<h-1?t[a+1]*e:r.length;o-=Math.abs(bl(r,l,u,e))}var c=0;for(a=0;a<i.length;a+=3){var d=i[a]*e,p=i[a+1]*e,m=i[a+2]*e;c+=Math.abs((r[d]-r[m])*(r[p+1]-r[d+1])-(r[d]-r[p])*(r[m+1]-r[d+1]))}return o===0&&c===0?0:Math.abs((c-o)/o)};function bl(r,t,e,i){for(var s=0,n=t,o=e-i;n<e;n+=i)s+=(r[o]-r[n])*(r[n+1]+r[o+1]),o=n;return s}jo.flatten=function(r){for(var t=r[0][0].length,e={vertices:[],holes:[],dimensions:t},i=0,s=0;s<r.length;s++){for(var n=0;n<r[s].length;n++)for(var o=0;o<t;o++)e.vertices.push(r[s][n][o]);s>0&&(i+=r[s-1].length,e.holes.push(i))}return e};var hx=ml.exports;const lx=Gn(hx);var qo={exports:{}};/*! https://mths.be/punycode v1.4.1 by @mathias */qo.exports,function(r,t){(function(e){var i=t&&!t.nodeType&&t,s=r&&!r.nodeType&&r,n=typeof ti=="object"&&ti;(n.global===n||n.window===n||n.self===n)&&(e=n);var o,a=2147483647,h=36,l=1,u=26,c=38,d=700,p=72,m=128,f="-",g=/^xn--/,y=/[^\x20-\x7E]/,_=/[\x2E\u3002\uFF0E\uFF61]/g,b={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},v=h-l,S=Math.floor,E=String.fromCharCode,A;function I(D){throw new RangeError(b[D])}function P(D,U){for(var j=D.length,q=[];j--;)q[j]=U(D[j]);return q}function W(D,U){var j=D.split("@"),q="";j.length>1&&(q=j[0]+"@",D=j[1]),D=D.replace(_,".");var dt=D.split("."),nt=P(dt,U).join(".");return q+nt}function G(D){for(var U=[],j=0,q=D.length,dt,nt;j<q;)dt=D.charCodeAt(j++),dt>=55296&&dt<=56319&&j<q?(nt=D.charCodeAt(j++),(nt&64512)==56320?U.push(((dt&1023)<<10)+(nt&1023)+65536):(U.push(dt),j--)):U.push(dt);return U}function N(D){return P(D,function(U){var j="";return U>65535&&(U-=65536,j+=E(U>>>10&1023|55296),U=56320|U&1023),j+=E(U),j}).join("")}function C(D){return D-48<10?D-22:D-65<26?D-65:D-97<26?D-97:h}function F(D,U){return D+22+75*(D<26)-((U!=0)<<5)}function X(D,U,j){var q=0;for(D=j?S(D/d):D>>1,D+=S(D/U);D>v*u>>1;q+=h)D=S(D/v);return S(q+(v+1)*D/(D+c))}function V(D){var U=[],j=D.length,q,dt=0,nt=m,Et=p,Mt,wt,z,it,tt,O,yt,mt,Rt;for(Mt=D.lastIndexOf(f),Mt<0&&(Mt=0),wt=0;wt<Mt;++wt)D.charCodeAt(wt)>=128&&I("not-basic"),U.push(D.charCodeAt(wt));for(z=Mt>0?Mt+1:0;z<j;){for(it=dt,tt=1,O=h;z>=j&&I("invalid-input"),yt=C(D.charCodeAt(z++)),(yt>=h||yt>S((a-dt)/tt))&&I("overflow"),dt+=yt*tt,mt=O<=Et?l:O>=Et+u?u:O-Et,!(yt<mt);O+=h)Rt=h-mt,tt>S(a/Rt)&&I("overflow"),tt*=Rt;q=U.length+1,Et=X(dt-it,q,it==0),S(dt/q)>a-nt&&I("overflow"),nt+=S(dt/q),dt%=q,U.splice(dt++,0,nt)}return N(U)}function L(D){var U,j,q,dt,nt,Et,Mt,wt,z,it,tt,O=[],yt,mt,Rt,Ut;for(D=G(D),yt=D.length,U=m,j=0,nt=p,Et=0;Et<yt;++Et)tt=D[Et],tt<128&&O.push(E(tt));for(q=dt=O.length,dt&&O.push(f);q<yt;){for(Mt=a,Et=0;Et<yt;++Et)tt=D[Et],tt>=U&&tt<Mt&&(Mt=tt);for(mt=q+1,Mt-U>S((a-j)/mt)&&I("overflow"),j+=(Mt-U)*mt,U=Mt,Et=0;Et<yt;++Et)if(tt=D[Et],tt<U&&++j>a&&I("overflow"),tt==U){for(wt=j,z=h;it=z<=nt?l:z>=nt+u?u:z-nt,!(wt<it);z+=h)Ut=wt-it,Rt=h-it,O.push(E(F(it+Ut%Rt,0))),wt=S(Ut/Rt);O.push(E(F(wt,0))),nt=X(j,mt,q==dt),j=0,++q}++j,++U}return O.join("")}function k(D){return W(D,function(U){return g.test(U)?V(U.slice(4).toLowerCase()):U})}function H(D){return W(D,function(U){return y.test(U)?"xn--"+L(U):U})}if(o={version:"1.4.1",ucs2:{decode:G,encode:N},decode:V,encode:L,toASCII:H,toUnicode:k},i&&s)if(r.exports==i)s.exports=o;else for(A in o)o.hasOwnProperty(A)&&(i[A]=o[A]);else e.punycode=o})(ti)}(qo,qo.exports);var ux=qo.exports,cx=function(){if(typeof Symbol!="function"||typeof Object.getOwnPropertySymbols!="function")return!1;if(typeof Symbol.iterator=="symbol")return!0;var t={},e=Symbol("test"),i=Object(e);if(typeof e=="string"||Object.prototype.toString.call(e)!=="[object Symbol]"||Object.prototype.toString.call(i)!=="[object Symbol]")return!1;var s=42;t[e]=s;for(e in t)return!1;if(typeof Object.keys=="function"&&Object.keys(t).length!==0||typeof Object.getOwnPropertyNames=="function"&&Object.getOwnPropertyNames(t).length!==0)return!1;var n=Object.getOwnPropertySymbols(t);if(n.length!==1||n[0]!==e||!Object.prototype.propertyIsEnumerable.call(t,e))return!1;if(typeof Object.getOwnPropertyDescriptor=="function"){var o=Object.getOwnPropertyDescriptor(t,e);if(o.value!==s||o.enumerable!==!0)return!1}return!0},Up=typeof Symbol<"u"&&Symbol,dx=cx,px=function(){return typeof Up!="function"||typeof Symbol!="function"||typeof Up("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:dx()},Xp={foo:{}},fx=Object,mx=function(){return{__proto__:Xp}.foo===Xp.foo&&!({__proto__:null}instanceof fx)},gx="Function.prototype.bind called on incompatible ",xl=Array.prototype.slice,yx=Object.prototype.toString,bx="[object Function]",xx=function(t){var e=this;if(typeof e!="function"||yx.call(e)!==bx)throw new TypeError(gx+e);for(var i=xl.call(arguments,1),s,n=function(){if(this instanceof s){var u=e.apply(this,i.concat(xl.call(arguments)));return Object(u)===u?u:this}else return e.apply(t,i.concat(xl.call(arguments)))},o=Math.max(0,e.length-i.length),a=[],h=0;h<o;h++)a.push("$"+h);if(s=Function("binder","return function ("+a.join(",")+"){ return binder.apply(this,arguments); }")(n),e.prototype){var l=function(){};l.prototype=e.prototype,s.prototype=new l,l.prototype=null}return s},_x=xx,_l=Function.prototype.bind||_x,vx=_l,Tx=vx.call(Function.call,Object.prototype.hasOwnProperty),Tt,Ls=SyntaxError,Zp=Function,Gs=TypeError,vl=function(r){try{return Zp('"use strict"; return ('+r+").constructor;")()}catch{}},Zr=Object.getOwnPropertyDescriptor;if(Zr)try{Zr({},"")}catch{Zr=null}var Tl=function(){throw new Gs},wx=Zr?function(){try{return arguments.callee,Tl}catch{try{return Zr(arguments,"callee").get}catch{return Tl}}}():Tl,Ns=px(),Sx=mx(),qt=Object.getPrototypeOf||(Sx?function(r){return r.__proto__}:null),Fs={},Ex=typeof Uint8Array>"u"||!qt?Tt:qt(Uint8Array),Vr={"%AggregateError%":typeof AggregateError>"u"?Tt:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?Tt:ArrayBuffer,"%ArrayIteratorPrototype%":Ns&&qt?qt([][Symbol.iterator]()):Tt,"%AsyncFromSyncIteratorPrototype%":Tt,"%AsyncFunction%":Fs,"%AsyncGenerator%":Fs,"%AsyncGeneratorFunction%":Fs,"%AsyncIteratorPrototype%":Fs,"%Atomics%":typeof Atomics>"u"?Tt:Atomics,"%BigInt%":typeof BigInt>"u"?Tt:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?Tt:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?Tt:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?Tt:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":Error,"%eval%":eval,"%EvalError%":EvalError,"%Float32Array%":typeof Float32Array>"u"?Tt:Float32Array,"%Float64Array%":typeof Float64Array>"u"?Tt:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?Tt:FinalizationRegistry,"%Function%":Zp,"%GeneratorFunction%":Fs,"%Int8Array%":typeof Int8Array>"u"?Tt:Int8Array,"%Int16Array%":typeof Int16Array>"u"?Tt:Int16Array,"%Int32Array%":typeof Int32Array>"u"?Tt:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":Ns&&qt?qt(qt([][Symbol.iterator]())):Tt,"%JSON%":typeof JSON=="object"?JSON:Tt,"%Map%":typeof Map>"u"?Tt:Map,"%MapIteratorPrototype%":typeof Map>"u"||!Ns||!qt?Tt:qt(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?Tt:Promise,"%Proxy%":typeof Proxy>"u"?Tt:Proxy,"%RangeError%":RangeError,"%ReferenceError%":ReferenceError,"%Reflect%":typeof Reflect>"u"?Tt:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?Tt:Set,"%SetIteratorPrototype%":typeof Set>"u"||!Ns||!qt?Tt:qt(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?Tt:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":Ns&&qt?qt(""[Symbol.iterator]()):Tt,"%Symbol%":Ns?Symbol:Tt,"%SyntaxError%":Ls,"%ThrowTypeError%":wx,"%TypedArray%":Ex,"%TypeError%":Gs,"%Uint8Array%":typeof Uint8Array>"u"?Tt:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?Tt:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?Tt:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?Tt:Uint32Array,"%URIError%":URIError,"%WeakMap%":typeof WeakMap>"u"?Tt:WeakMap,"%WeakRef%":typeof WeakRef>"u"?Tt:WeakRef,"%WeakSet%":typeof WeakSet>"u"?Tt:WeakSet};if(qt)try{null.error}catch(r){var Cx=qt(qt(r));Vr["%Error.prototype%"]=Cx}var Ix=function r(t){var e;if(t==="%AsyncFunction%")e=vl("async function () {}");else if(t==="%GeneratorFunction%")e=vl("function* () {}");else if(t==="%AsyncGeneratorFunction%")e=vl("async function* () {}");else if(t==="%AsyncGenerator%"){var i=r("%AsyncGeneratorFunction%");i&&(e=i.prototype)}else if(t==="%AsyncIteratorPrototype%"){var s=r("%AsyncGenerator%");s&&qt&&(e=qt(s.prototype))}return Vr[t]=e,e},Vp={"%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"]},On=_l,ta=Tx,Ax=On.call(Function.call,Array.prototype.concat),Mx=On.call(Function.apply,Array.prototype.splice),Hp=On.call(Function.call,String.prototype.replace),ea=On.call(Function.call,String.prototype.slice),Rx=On.call(Function.call,RegExp.prototype.exec),Px=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,Lx=/\\(\\)?/g,Gx=function(t){var e=ea(t,0,1),i=ea(t,-1);if(e==="%"&&i!=="%")throw new Ls("invalid intrinsic syntax, expected closing `%`");if(i==="%"&&e!=="%")throw new Ls("invalid intrinsic syntax, expected opening `%`");var s=[];return Hp(t,Px,function(n,o,a,h){s[s.length]=a?Hp(h,Lx,"$1"):o||n}),s},Nx=function(t,e){var i=t,s;if(ta(Vp,i)&&(s=Vp[i],i="%"+s[0]+"%"),ta(Vr,i)){var n=Vr[i];if(n===Fs&&(n=Ix(i)),typeof n>"u"&&!e)throw new Gs("intrinsic "+t+" exists, but is not available. Please file an issue!");return{alias:s,name:i,value:n}}throw new Ls("intrinsic "+t+" does not exist!")},wl=function(t,e){if(typeof t!="string"||t.length===0)throw new Gs("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof e!="boolean")throw new Gs('"allowMissing" argument must be a boolean');if(Rx(/^%?[^%]*%?$/,t)===null)throw new Ls("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var i=Gx(t),s=i.length>0?i[0]:"",n=Nx("%"+s+"%",e),o=n.name,a=n.value,h=!1,l=n.alias;l&&(s=l[0],Mx(i,Ax([0,1],l)));for(var u=1,c=!0;u<i.length;u+=1){var d=i[u],p=ea(d,0,1),m=ea(d,-1);if((p==='"'||p==="'"||p==="`"||m==='"'||m==="'"||m==="`")&&p!==m)throw new Ls("property names with quotes must have matching quotes");if((d==="constructor"||!c)&&(h=!0),s+="."+d,o="%"+s+"%",ta(Vr,o))a=Vr[o];else if(a!=null){if(!(d in a)){if(!e)throw new Gs("base intrinsic for "+t+" exists, but the property is not available.");return}if(Zr&&u+1>=i.length){var f=Zr(a,d);c=!!f,c&&"get"in f&&!("originalValue"in f.get)?a=f.get:a=a[d]}else c=ta(a,d),a=a[d];c&&!h&&(Vr[o]=a)}}return a},Kp={exports:{}};(function(r){var t=_l,e=wl,i=e("%Function.prototype.apply%"),s=e("%Function.prototype.call%"),n=e("%Reflect.apply%",!0)||t.call(s,i),o=e("%Object.getOwnPropertyDescriptor%",!0),a=e("%Object.defineProperty%",!0),h=e("%Math.max%");if(a)try{a({},"a",{value:1})}catch{a=null}r.exports=function(c){var d=n(t,s,arguments);if(o&&a){var p=o(d,"length");p.configurable&&a(d,"length",{value:1+h(0,c.length-(arguments.length-1))})}return d};var l=function(){return n(t,i,arguments)};a?a(r.exports,"apply",{value:l}):r.exports.apply=l})(Kp);var Fx=Kp.exports,Yp=wl,zp=Fx,Dx=zp(Yp("String.prototype.indexOf")),kx=function(t,e){var i=Yp(t,!!e);return typeof i=="function"&&Dx(t,".prototype.")>-1?zp(i):i};const Ox=Nb(Object.freeze(Object.defineProperty({__proto__:null,default:{}},Symbol.toStringTag,{value:"Module"})));var Sl=typeof Map=="function"&&Map.prototype,El=Object.getOwnPropertyDescriptor&&Sl?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,ia=Sl&&El&&typeof El.get=="function"?El.get:null,jp=Sl&&Map.prototype.forEach,Cl=typeof Set=="function"&&Set.prototype,Il=Object.getOwnPropertyDescriptor&&Cl?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,ra=Cl&&Il&&typeof Il.get=="function"?Il.get:null,Jp=Cl&&Set.prototype.forEach,Bx=typeof WeakMap=="function"&&WeakMap.prototype,Bn=Bx?WeakMap.prototype.has:null,Wx=typeof WeakSet=="function"&&WeakSet.prototype,Wn=Wx?WeakSet.prototype.has:null,Ux=typeof WeakRef=="function"&&WeakRef.prototype,$p=Ux?WeakRef.prototype.deref:null,Xx=Boolean.prototype.valueOf,Zx=Object.prototype.toString,Vx=Function.prototype.toString,Hx=String.prototype.match,Al=String.prototype.slice,fr=String.prototype.replace,Kx=String.prototype.toUpperCase,Qp=String.prototype.toLowerCase,qp=RegExp.prototype.test,tf=Array.prototype.concat,_i=Array.prototype.join,Yx=Array.prototype.slice,ef=Math.floor,Ml=typeof BigInt=="function"?BigInt.prototype.valueOf:null,Rl=Object.getOwnPropertySymbols,Pl=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Symbol.prototype.toString:null,Ds=typeof Symbol=="function"&&typeof Symbol.iterator=="object",le=typeof Symbol=="function"&&Symbol.toStringTag&&(typeof Symbol.toStringTag===Ds||"symbol")?Symbol.toStringTag:null,rf=Object.prototype.propertyIsEnumerable,sf=(typeof Reflect=="function"?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(r){return r.__proto__}:null);function nf(r,t){if(r===1/0||r===-1/0||r!==r||r&&r>-1e3&&r<1e3||qp.call(/e/,t))return t;var e=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if(typeof r=="number"){var i=r<0?-ef(-r):ef(r);if(i!==r){var s=String(i),n=Al.call(t,s.length+1);return fr.call(s,e,"$&_")+"."+fr.call(fr.call(n,/([0-9]{3})/g,"$&_"),/_$/,"")}}return fr.call(t,e,"$&_")}var Ll=Ox,of=Ll.custom,af=uf(of)?of:null,zx=function r(t,e,i,s){var n=e||{};if(mr(n,"quoteStyle")&&n.quoteStyle!=="single"&&n.quoteStyle!=="double")throw new TypeError('option "quoteStyle" must be "single" or "double"');if(mr(n,"maxStringLength")&&(typeof n.maxStringLength=="number"?n.maxStringLength<0&&n.maxStringLength!==1/0:n.maxStringLength!==null))throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`');var o=mr(n,"customInspect")?n.customInspect:!0;if(typeof o!="boolean"&&o!=="symbol")throw new TypeError("option \"customInspect\", if provided, must be `true`, `false`, or `'symbol'`");if(mr(n,"indent")&&n.indent!==null&&n.indent!==" "&&!(parseInt(n.indent,10)===n.indent&&n.indent>0))throw new TypeError('option "indent" must be "\\t", an integer > 0, or `null`');if(mr(n,"numericSeparator")&&typeof n.numericSeparator!="boolean")throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`');var a=n.numericSeparator;if(typeof t>"u")return"undefined";if(t===null)return"null";if(typeof t=="boolean")return t?"true":"false";if(typeof t=="string")return df(t,n);if(typeof t=="number"){if(t===0)return 1/0/t>0?"0":"-0";var h=String(t);return a?nf(t,h):h}if(typeof t=="bigint"){var l=String(t)+"n";return a?nf(t,l):l}var u=typeof n.depth>"u"?5:n.depth;if(typeof i>"u"&&(i=0),i>=u&&u>0&&typeof t=="object")return Gl(t)?"[Array]":"[Object]";var c=d_(n,i);if(typeof s>"u")s=[];else if(cf(s,t)>=0)return"[Circular]";function d(C,F,X){if(F&&(s=Yx.call(s),s.push(F)),X){var V={depth:n.depth};return mr(n,"quoteStyle")&&(V.quoteStyle=n.quoteStyle),r(C,V,i+1,s)}return r(C,n,i+1,s)}if(typeof t=="function"&&!lf(t)){var p=r_(t),m=sa(t,d);return"[Function"+(p?": "+p:" (anonymous)")+"]"+(m.length>0?" { "+_i.call(m,", ")+" }":"")}if(uf(t)){var f=Ds?fr.call(String(t),/^(Symbol\(.*\))_[^)]*$/,"$1"):Pl.call(t);return typeof t=="object"&&!Ds?Un(f):f}if(l_(t)){for(var g="<"+Qp.call(String(t.nodeName)),y=t.attributes||[],_=0;_<y.length;_++)g+=" "+y[_].name+"="+hf(jx(y[_].value),"double",n);return g+=">",t.childNodes&&t.childNodes.length&&(g+="..."),g+="</"+Qp.call(String(t.nodeName))+">",g}if(Gl(t)){if(t.length===0)return"[]";var b=sa(t,d);return c&&!c_(b)?"["+Fl(b,c)+"]":"[ "+_i.call(b,", ")+" ]"}if($x(t)){var v=sa(t,d);return!("cause"in Error.prototype)&&"cause"in t&&!rf.call(t,"cause")?"{ ["+String(t)+"] "+_i.call(tf.call("[cause]: "+d(t.cause),v),", ")+" }":v.length===0?"["+String(t)+"]":"{ ["+String(t)+"] "+_i.call(v,", ")+" }"}if(typeof t=="object"&&o){if(af&&typeof t[af]=="function"&&Ll)return Ll(t,{depth:u-i});if(o!=="symbol"&&typeof t.inspect=="function")return t.inspect()}if(s_(t)){var S=[];return jp&&jp.call(t,function(C,F){S.push(d(F,t,!0)+" => "+d(C,t))}),pf("Map",ia.call(t),S,c)}if(a_(t)){var E=[];return Jp&&Jp.call(t,function(C){E.push(d(C,t))}),pf("Set",ra.call(t),E,c)}if(n_(t))return Nl("WeakMap");if(h_(t))return Nl("WeakSet");if(o_(t))return Nl("WeakRef");if(qx(t))return Un(d(Number(t)));if(e_(t))return Un(d(Ml.call(t)));if(t_(t))return Un(Xx.call(t));if(Qx(t))return Un(d(String(t)));if(!Jx(t)&&!lf(t)){var A=sa(t,d),I=sf?sf(t)===Object.prototype:t instanceof Object||t.constructor===Object,P=t instanceof Object?"":"null prototype",W=!I&&le&&Object(t)===t&&le in t?Al.call(gr(t),8,-1):P?"Object":"",G=I||typeof t.constructor!="function"?"":t.constructor.name?t.constructor.name+" ":"",N=G+(W||P?"["+_i.call(tf.call([],W||[],P||[]),": ")+"] ":"");return A.length===0?N+"{}":c?N+"{"+Fl(A,c)+"}":N+"{ "+_i.call(A,", ")+" }"}return String(t)};function hf(r,t,e){var i=(e.quoteStyle||t)==="double"?'"':"'";return i+r+i}function jx(r){return fr.call(String(r),/"/g,""")}function Gl(r){return gr(r)==="[object Array]"&&(!le||!(typeof r=="object"&&le in r))}function Jx(r){return gr(r)==="[object Date]"&&(!le||!(typeof r=="object"&&le in r))}function lf(r){return gr(r)==="[object RegExp]"&&(!le||!(typeof r=="object"&&le in r))}function $x(r){return gr(r)==="[object Error]"&&(!le||!(typeof r=="object"&&le in r))}function Qx(r){return gr(r)==="[object String]"&&(!le||!(typeof r=="object"&&le in r))}function qx(r){return gr(r)==="[object Number]"&&(!le||!(typeof r=="object"&&le in r))}function t_(r){return gr(r)==="[object Boolean]"&&(!le||!(typeof r=="object"&&le in r))}function uf(r){if(Ds)return r&&typeof r=="object"&&r instanceof Symbol;if(typeof r=="symbol")return!0;if(!r||typeof r!="object"||!Pl)return!1;try{return Pl.call(r),!0}catch{}return!1}function e_(r){if(!r||typeof r!="object"||!Ml)return!1;try{return Ml.call(r),!0}catch{}return!1}var i_=Object.prototype.hasOwnProperty||function(r){return r in this};function mr(r,t){return i_.call(r,t)}function gr(r){return Zx.call(r)}function r_(r){if(r.name)return r.name;var t=Hx.call(Vx.call(r),/^function\s*([\w$]+)/);return t?t[1]:null}function cf(r,t){if(r.indexOf)return r.indexOf(t);for(var e=0,i=r.length;e<i;e++)if(r[e]===t)return e;return-1}function s_(r){if(!ia||!r||typeof r!="object")return!1;try{ia.call(r);try{ra.call(r)}catch{return!0}return r instanceof Map}catch{}return!1}function n_(r){if(!Bn||!r||typeof r!="object")return!1;try{Bn.call(r,Bn);try{Wn.call(r,Wn)}catch{return!0}return r instanceof WeakMap}catch{}return!1}function o_(r){if(!$p||!r||typeof r!="object")return!1;try{return $p.call(r),!0}catch{}return!1}function a_(r){if(!ra||!r||typeof r!="object")return!1;try{ra.call(r);try{ia.call(r)}catch{return!0}return r instanceof Set}catch{}return!1}function h_(r){if(!Wn||!r||typeof r!="object")return!1;try{Wn.call(r,Wn);try{Bn.call(r,Bn)}catch{return!0}return r instanceof WeakSet}catch{}return!1}function l_(r){return!r||typeof r!="object"?!1:typeof HTMLElement<"u"&&r instanceof HTMLElement?!0:typeof r.nodeName=="string"&&typeof r.getAttribute=="function"}function df(r,t){if(r.length>t.maxStringLength){var e=r.length-t.maxStringLength,i="... "+e+" more character"+(e>1?"s":"");return df(Al.call(r,0,t.maxStringLength),t)+i}var s=fr.call(fr.call(r,/(['\\])/g,"\\$1"),/[\x00-\x1f]/g,u_);return hf(s,"single",t)}function u_(r){var t=r.charCodeAt(0),e={8:"b",9:"t",10:"n",12:"f",13:"r"}[t];return e?"\\"+e:"\\x"+(t<16?"0":"")+Kx.call(t.toString(16))}function Un(r){return"Object("+r+")"}function Nl(r){return r+" { ? }"}function pf(r,t,e,i){var s=i?Fl(e,i):_i.call(e,", ");return r+" ("+t+") {"+s+"}"}function c_(r){for(var t=0;t<r.length;t++)if(cf(r[t],`
|
|
2
|
+
`)>=0)return!1;return!0}function d_(r,t){var e;if(r.indent===" ")e=" ";else if(typeof r.indent=="number"&&r.indent>0)e=_i.call(Array(r.indent+1)," ");else return null;return{base:e,prev:_i.call(Array(t+1),e)}}function Fl(r,t){if(r.length===0)return"";var e=`
|
|
3
|
+
`+t.prev+t.base;return e+_i.call(r,","+e)+`
|
|
4
|
+
`+t.prev}function sa(r,t){var e=Gl(r),i=[];if(e){i.length=r.length;for(var s=0;s<r.length;s++)i[s]=mr(r,s)?t(r[s],r):""}var n=typeof Rl=="function"?Rl(r):[],o;if(Ds){o={};for(var a=0;a<n.length;a++)o["$"+n[a]]=n[a]}for(var h in r)mr(r,h)&&(e&&String(Number(h))===h&&h<r.length||Ds&&o["$"+h]instanceof Symbol||(qp.call(/[^\w$]/,h)?i.push(t(h,r)+": "+t(r[h],r)):i.push(h+": "+t(r[h],r))));if(typeof Rl=="function")for(var l=0;l<n.length;l++)rf.call(r,n[l])&&i.push("["+t(n[l])+"]: "+t(r[n[l]],r));return i}var Dl=wl,ks=kx,p_=zx,f_=Dl("%TypeError%"),na=Dl("%WeakMap%",!0),oa=Dl("%Map%",!0),m_=ks("WeakMap.prototype.get",!0),g_=ks("WeakMap.prototype.set",!0),y_=ks("WeakMap.prototype.has",!0),b_=ks("Map.prototype.get",!0),x_=ks("Map.prototype.set",!0),__=ks("Map.prototype.has",!0),kl=function(r,t){for(var e=r,i;(i=e.next)!==null;e=i)if(i.key===t)return e.next=i.next,i.next=r.next,r.next=i,i},v_=function(r,t){var e=kl(r,t);return e&&e.value},T_=function(r,t,e){var i=kl(r,t);i?i.value=e:r.next={key:t,next:r.next,value:e}},w_=function(r,t){return!!kl(r,t)},S_=function(){var t,e,i,s={assert:function(n){if(!s.has(n))throw new f_("Side channel does not contain "+p_(n))},get:function(n){if(na&&n&&(typeof n=="object"||typeof n=="function")){if(t)return m_(t,n)}else if(oa){if(e)return b_(e,n)}else if(i)return v_(i,n)},has:function(n){if(na&&n&&(typeof n=="object"||typeof n=="function")){if(t)return y_(t,n)}else if(oa){if(e)return __(e,n)}else if(i)return w_(i,n);return!1},set:function(n,o){na&&n&&(typeof n=="object"||typeof n=="function")?(t||(t=new na),g_(t,n,o)):oa?(e||(e=new oa),x_(e,n,o)):(i||(i={key:{},next:null}),T_(i,n,o))}};return s},E_=String.prototype.replace,C_=/%20/g,Ol={RFC1738:"RFC1738",RFC3986:"RFC3986"},Bl={default:Ol.RFC3986,formatters:{RFC1738:function(r){return E_.call(r,C_,"+")},RFC3986:function(r){return String(r)}},RFC1738:Ol.RFC1738,RFC3986:Ol.RFC3986},I_=Bl,Wl=Object.prototype.hasOwnProperty,Hr=Array.isArray,vi=function(){for(var r=[],t=0;t<256;++t)r.push("%"+((t<16?"0":"")+t.toString(16)).toUpperCase());return r}(),A_=function(t){for(;t.length>1;){var e=t.pop(),i=e.obj[e.prop];if(Hr(i)){for(var s=[],n=0;n<i.length;++n)typeof i[n]<"u"&&s.push(i[n]);e.obj[e.prop]=s}}},ff=function(t,e){for(var i=e&&e.plainObjects?Object.create(null):{},s=0;s<t.length;++s)typeof t[s]<"u"&&(i[s]=t[s]);return i},M_=function r(t,e,i){if(!e)return t;if(typeof e!="object"){if(Hr(t))t.push(e);else if(t&&typeof t=="object")(i&&(i.plainObjects||i.allowPrototypes)||!Wl.call(Object.prototype,e))&&(t[e]=!0);else return[t,e];return t}if(!t||typeof t!="object")return[t].concat(e);var s=t;return Hr(t)&&!Hr(e)&&(s=ff(t,i)),Hr(t)&&Hr(e)?(e.forEach(function(n,o){if(Wl.call(t,o)){var a=t[o];a&&typeof a=="object"&&n&&typeof n=="object"?t[o]=r(a,n,i):t.push(n)}else t[o]=n}),t):Object.keys(e).reduce(function(n,o){var a=e[o];return Wl.call(n,o)?n[o]=r(n[o],a,i):n[o]=a,n},s)},R_=function(t,e){return Object.keys(e).reduce(function(i,s){return i[s]=e[s],i},t)},P_=function(r,t,e){var i=r.replace(/\+/g," ");if(e==="iso-8859-1")return i.replace(/%[0-9a-f]{2}/gi,unescape);try{return decodeURIComponent(i)}catch{return i}},L_=function(t,e,i,s,n){if(t.length===0)return t;var o=t;if(typeof t=="symbol"?o=Symbol.prototype.toString.call(t):typeof t!="string"&&(o=String(t)),i==="iso-8859-1")return escape(o).replace(/%u[0-9a-f]{4}/gi,function(u){return"%26%23"+parseInt(u.slice(2),16)+"%3B"});for(var a="",h=0;h<o.length;++h){var l=o.charCodeAt(h);if(l===45||l===46||l===95||l===126||l>=48&&l<=57||l>=65&&l<=90||l>=97&&l<=122||n===I_.RFC1738&&(l===40||l===41)){a+=o.charAt(h);continue}if(l<128){a=a+vi[l];continue}if(l<2048){a=a+(vi[192|l>>6]+vi[128|l&63]);continue}if(l<55296||l>=57344){a=a+(vi[224|l>>12]+vi[128|l>>6&63]+vi[128|l&63]);continue}h+=1,l=65536+((l&1023)<<10|o.charCodeAt(h)&1023),a+=vi[240|l>>18]+vi[128|l>>12&63]+vi[128|l>>6&63]+vi[128|l&63]}return a},G_=function(t){for(var e=[{obj:{o:t},prop:"o"}],i=[],s=0;s<e.length;++s)for(var n=e[s],o=n.obj[n.prop],a=Object.keys(o),h=0;h<a.length;++h){var l=a[h],u=o[l];typeof u=="object"&&u!==null&&i.indexOf(u)===-1&&(e.push({obj:o,prop:l}),i.push(u))}return A_(e),t},N_=function(t){return Object.prototype.toString.call(t)==="[object RegExp]"},F_=function(t){return!t||typeof t!="object"?!1:!!(t.constructor&&t.constructor.isBuffer&&t.constructor.isBuffer(t))},D_=function(t,e){return[].concat(t,e)},k_=function(t,e){if(Hr(t)){for(var i=[],s=0;s<t.length;s+=1)i.push(e(t[s]));return i}return e(t)},mf={arrayToObject:ff,assign:R_,combine:D_,compact:G_,decode:P_,encode:L_,isBuffer:F_,isRegExp:N_,maybeMap:k_,merge:M_},gf=S_,aa=mf,Xn=Bl,O_=Object.prototype.hasOwnProperty,yf={brackets:function(t){return t+"[]"},comma:"comma",indices:function(t,e){return t+"["+e+"]"},repeat:function(t){return t}},ji=Array.isArray,B_=Array.prototype.push,bf=function(r,t){B_.apply(r,ji(t)?t:[t])},W_=Date.prototype.toISOString,xf=Xn.default,ue={addQueryPrefix:!1,allowDots:!1,charset:"utf-8",charsetSentinel:!1,delimiter:"&",encode:!0,encoder:aa.encode,encodeValuesOnly:!1,format:xf,formatter:Xn.formatters[xf],indices:!1,serializeDate:function(t){return W_.call(t)},skipNulls:!1,strictNullHandling:!1},U_=function(t){return typeof t=="string"||typeof t=="number"||typeof t=="boolean"||typeof t=="symbol"||typeof t=="bigint"},Ul={},X_=function r(t,e,i,s,n,o,a,h,l,u,c,d,p,m,f,g){for(var y=t,_=g,b=0,v=!1;(_=_.get(Ul))!==void 0&&!v;){var S=_.get(t);if(b+=1,typeof S<"u"){if(S===b)throw new RangeError("Cyclic object value");v=!0}typeof _.get(Ul)>"u"&&(b=0)}if(typeof h=="function"?y=h(e,y):y instanceof Date?y=c(y):i==="comma"&&ji(y)&&(y=aa.maybeMap(y,function(V){return V instanceof Date?c(V):V})),y===null){if(n)return a&&!m?a(e,ue.encoder,f,"key",d):e;y=""}if(U_(y)||aa.isBuffer(y)){if(a){var E=m?e:a(e,ue.encoder,f,"key",d);return[p(E)+"="+p(a(y,ue.encoder,f,"value",d))]}return[p(e)+"="+p(String(y))]}var A=[];if(typeof y>"u")return A;var I;if(i==="comma"&&ji(y))m&&a&&(y=aa.maybeMap(y,a)),I=[{value:y.length>0?y.join(",")||null:void 0}];else if(ji(h))I=h;else{var P=Object.keys(y);I=l?P.sort(l):P}for(var W=s&&ji(y)&&y.length===1?e+"[]":e,G=0;G<I.length;++G){var N=I[G],C=typeof N=="object"&&typeof N.value<"u"?N.value:y[N];if(!(o&&C===null)){var F=ji(y)?typeof i=="function"?i(W,N):W:W+(u?"."+N:"["+N+"]");g.set(t,b);var X=gf();X.set(Ul,g),bf(A,r(C,F,i,s,n,o,i==="comma"&&m&&ji(y)?null:a,h,l,u,c,d,p,m,f,X))}}return A},Z_=function(t){if(!t)return ue;if(t.encoder!==null&&typeof t.encoder<"u"&&typeof t.encoder!="function")throw new TypeError("Encoder has to be a function.");var e=t.charset||ue.charset;if(typeof t.charset<"u"&&t.charset!=="utf-8"&&t.charset!=="iso-8859-1")throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");var i=Xn.default;if(typeof t.format<"u"){if(!O_.call(Xn.formatters,t.format))throw new TypeError("Unknown format option provided.");i=t.format}var s=Xn.formatters[i],n=ue.filter;return(typeof t.filter=="function"||ji(t.filter))&&(n=t.filter),{addQueryPrefix:typeof t.addQueryPrefix=="boolean"?t.addQueryPrefix:ue.addQueryPrefix,allowDots:typeof t.allowDots>"u"?ue.allowDots:!!t.allowDots,charset:e,charsetSentinel:typeof t.charsetSentinel=="boolean"?t.charsetSentinel:ue.charsetSentinel,delimiter:typeof t.delimiter>"u"?ue.delimiter:t.delimiter,encode:typeof t.encode=="boolean"?t.encode:ue.encode,encoder:typeof t.encoder=="function"?t.encoder:ue.encoder,encodeValuesOnly:typeof t.encodeValuesOnly=="boolean"?t.encodeValuesOnly:ue.encodeValuesOnly,filter:n,format:i,formatter:s,serializeDate:typeof t.serializeDate=="function"?t.serializeDate:ue.serializeDate,skipNulls:typeof t.skipNulls=="boolean"?t.skipNulls:ue.skipNulls,sort:typeof t.sort=="function"?t.sort:null,strictNullHandling:typeof t.strictNullHandling=="boolean"?t.strictNullHandling:ue.strictNullHandling}},V_=function(r,t){var e=r,i=Z_(t),s,n;typeof i.filter=="function"?(n=i.filter,e=n("",e)):ji(i.filter)&&(n=i.filter,s=n);var o=[];if(typeof e!="object"||e===null)return"";var a;t&&t.arrayFormat in yf?a=t.arrayFormat:t&&"indices"in t?a=t.indices?"indices":"repeat":a="indices";var h=yf[a];if(t&&"commaRoundTrip"in t&&typeof t.commaRoundTrip!="boolean")throw new TypeError("`commaRoundTrip` must be a boolean, or absent");var l=h==="comma"&&t&&t.commaRoundTrip;s||(s=Object.keys(e)),i.sort&&s.sort(i.sort);for(var u=gf(),c=0;c<s.length;++c){var d=s[c];i.skipNulls&&e[d]===null||bf(o,X_(e[d],d,h,l,i.strictNullHandling,i.skipNulls,i.encode?i.encoder:null,i.filter,i.sort,i.allowDots,i.serializeDate,i.format,i.formatter,i.encodeValuesOnly,i.charset,u))}var p=o.join(i.delimiter),m=i.addQueryPrefix===!0?"?":"";return i.charsetSentinel&&(i.charset==="iso-8859-1"?m+="utf8=%26%2310003%3B&":m+="utf8=%E2%9C%93&"),p.length>0?m+p:""},Os=mf,Xl=Object.prototype.hasOwnProperty,H_=Array.isArray,te={allowDots:!1,allowPrototypes:!1,allowSparse:!1,arrayLimit:20,charset:"utf-8",charsetSentinel:!1,comma:!1,decoder:Os.decode,delimiter:"&",depth:5,ignoreQueryPrefix:!1,interpretNumericEntities:!1,parameterLimit:1e3,parseArrays:!0,plainObjects:!1,strictNullHandling:!1},K_=function(r){return r.replace(/&#(\d+);/g,function(t,e){return String.fromCharCode(parseInt(e,10))})},_f=function(r,t){return r&&typeof r=="string"&&t.comma&&r.indexOf(",")>-1?r.split(","):r},Y_="utf8=%26%2310003%3B",z_="utf8=%E2%9C%93",j_=function(t,e){var i={__proto__:null},s=e.ignoreQueryPrefix?t.replace(/^\?/,""):t,n=e.parameterLimit===1/0?void 0:e.parameterLimit,o=s.split(e.delimiter,n),a=-1,h,l=e.charset;if(e.charsetSentinel)for(h=0;h<o.length;++h)o[h].indexOf("utf8=")===0&&(o[h]===z_?l="utf-8":o[h]===Y_&&(l="iso-8859-1"),a=h,h=o.length);for(h=0;h<o.length;++h)if(h!==a){var u=o[h],c=u.indexOf("]="),d=c===-1?u.indexOf("="):c+1,p,m;d===-1?(p=e.decoder(u,te.decoder,l,"key"),m=e.strictNullHandling?null:""):(p=e.decoder(u.slice(0,d),te.decoder,l,"key"),m=Os.maybeMap(_f(u.slice(d+1),e),function(f){return e.decoder(f,te.decoder,l,"value")})),m&&e.interpretNumericEntities&&l==="iso-8859-1"&&(m=K_(m)),u.indexOf("[]=")>-1&&(m=H_(m)?[m]:m),Xl.call(i,p)?i[p]=Os.combine(i[p],m):i[p]=m}return i},J_=function(r,t,e,i){for(var s=i?t:_f(t,e),n=r.length-1;n>=0;--n){var o,a=r[n];if(a==="[]"&&e.parseArrays)o=[].concat(s);else{o=e.plainObjects?Object.create(null):{};var h=a.charAt(0)==="["&&a.charAt(a.length-1)==="]"?a.slice(1,-1):a,l=parseInt(h,10);!e.parseArrays&&h===""?o={0:s}:!isNaN(l)&&a!==h&&String(l)===h&&l>=0&&e.parseArrays&&l<=e.arrayLimit?(o=[],o[l]=s):h!=="__proto__"&&(o[h]=s)}s=o}return s},$_=function(t,e,i,s){if(t){var n=i.allowDots?t.replace(/\.([^.[]+)/g,"[$1]"):t,o=/(\[[^[\]]*])/,a=/(\[[^[\]]*])/g,h=i.depth>0&&o.exec(n),l=h?n.slice(0,h.index):n,u=[];if(l){if(!i.plainObjects&&Xl.call(Object.prototype,l)&&!i.allowPrototypes)return;u.push(l)}for(var c=0;i.depth>0&&(h=a.exec(n))!==null&&c<i.depth;){if(c+=1,!i.plainObjects&&Xl.call(Object.prototype,h[1].slice(1,-1))&&!i.allowPrototypes)return;u.push(h[1])}return h&&u.push("["+n.slice(h.index)+"]"),J_(u,e,i,s)}},Q_=function(t){if(!t)return te;if(t.decoder!==null&&t.decoder!==void 0&&typeof t.decoder!="function")throw new TypeError("Decoder has to be a function.");if(typeof t.charset<"u"&&t.charset!=="utf-8"&&t.charset!=="iso-8859-1")throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");var e=typeof t.charset>"u"?te.charset:t.charset;return{allowDots:typeof t.allowDots>"u"?te.allowDots:!!t.allowDots,allowPrototypes:typeof t.allowPrototypes=="boolean"?t.allowPrototypes:te.allowPrototypes,allowSparse:typeof t.allowSparse=="boolean"?t.allowSparse:te.allowSparse,arrayLimit:typeof t.arrayLimit=="number"?t.arrayLimit:te.arrayLimit,charset:e,charsetSentinel:typeof t.charsetSentinel=="boolean"?t.charsetSentinel:te.charsetSentinel,comma:typeof t.comma=="boolean"?t.comma:te.comma,decoder:typeof t.decoder=="function"?t.decoder:te.decoder,delimiter:typeof t.delimiter=="string"||Os.isRegExp(t.delimiter)?t.delimiter:te.delimiter,depth:typeof t.depth=="number"||t.depth===!1?+t.depth:te.depth,ignoreQueryPrefix:t.ignoreQueryPrefix===!0,interpretNumericEntities:typeof t.interpretNumericEntities=="boolean"?t.interpretNumericEntities:te.interpretNumericEntities,parameterLimit:typeof t.parameterLimit=="number"?t.parameterLimit:te.parameterLimit,parseArrays:t.parseArrays!==!1,plainObjects:typeof t.plainObjects=="boolean"?t.plainObjects:te.plainObjects,strictNullHandling:typeof t.strictNullHandling=="boolean"?t.strictNullHandling:te.strictNullHandling}},q_=function(r,t){var e=Q_(t);if(r===""||r===null||typeof r>"u")return e.plainObjects?Object.create(null):{};for(var i=typeof r=="string"?j_(r,e):r,s=e.plainObjects?Object.create(null):{},n=Object.keys(i),o=0;o<n.length;++o){var a=n[o],h=$_(a,i[a],e,typeof r=="string");s=Os.merge(s,h,e)}return e.allowSparse===!0?s:Os.compact(s)},t1=V_,e1=q_,i1=Bl,r1={formats:i1,parse:e1,stringify:t1},s1=ux;function Ji(){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 n1=/^([a-z0-9.+-]+:)/i,o1=/:[0-9]*$/,a1=/^(\/\/?(?!\/)[^?\s]*)(\?[^\s]*)?$/,h1=["<",">",'"',"`"," ","\r",`
|
|
5
|
+
`," "],l1=["{","}","|","\\","^","`"].concat(h1),Zl=["'"].concat(l1),vf=["%","/","?",";","#"].concat(Zl),Tf=["/","?","#"],u1=255,wf=/^[+a-z0-9A-Z_-]{0,63}$/,c1=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,d1={javascript:!0,"javascript:":!0},Vl={javascript:!0,"javascript:":!0},Bs={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},Hl=r1;function p1(r,t,e){if(r&&typeof r=="object"&&r instanceof Ji)return r;var i=new Ji;return i.parse(r,t,e),i}Ji.prototype.parse=function(r,t,e){if(typeof r!="string")throw new TypeError("Parameter 'url' must be a string, not "+typeof r);var i=r.indexOf("?"),s=i!==-1&&i<r.indexOf("#")?"?":"#",n=r.split(s),o=/\\/g;n[0]=n[0].replace(o,"/"),r=n.join(s);var a=r;if(a=a.trim(),!e&&r.split("#").length===1){var h=a1.exec(a);if(h)return this.path=a,this.href=a,this.pathname=h[1],h[2]?(this.search=h[2],t?this.query=Hl.parse(this.search.substr(1)):this.query=this.search.substr(1)):t&&(this.search="",this.query={}),this}var l=n1.exec(a);if(l){l=l[0];var u=l.toLowerCase();this.protocol=u,a=a.substr(l.length)}if(e||l||a.match(/^\/\/[^@/]+@[^@/]+/)){var c=a.substr(0,2)==="//";c&&!(l&&Vl[l])&&(a=a.substr(2),this.slashes=!0)}if(!Vl[l]&&(c||l&&!Bs[l])){for(var d=-1,p=0;p<Tf.length;p++){var m=a.indexOf(Tf[p]);m!==-1&&(d===-1||m<d)&&(d=m)}var f,g;d===-1?g=a.lastIndexOf("@"):g=a.lastIndexOf("@",d),g!==-1&&(f=a.slice(0,g),a=a.slice(g+1),this.auth=decodeURIComponent(f)),d=-1;for(var p=0;p<vf.length;p++){var m=a.indexOf(vf[p]);m!==-1&&(d===-1||m<d)&&(d=m)}d===-1&&(d=a.length),this.host=a.slice(0,d),a=a.slice(d),this.parseHost(),this.hostname=this.hostname||"";var y=this.hostname[0]==="["&&this.hostname[this.hostname.length-1]==="]";if(!y)for(var _=this.hostname.split(/\./),p=0,b=_.length;p<b;p++){var v=_[p];if(v&&!v.match(wf)){for(var S="",E=0,A=v.length;E<A;E++)v.charCodeAt(E)>127?S+="x":S+=v[E];if(!S.match(wf)){var I=_.slice(0,p),P=_.slice(p+1),W=v.match(c1);W&&(I.push(W[1]),P.unshift(W[2])),P.length&&(a="/"+P.join(".")+a),this.hostname=I.join(".");break}}}this.hostname.length>u1?this.hostname="":this.hostname=this.hostname.toLowerCase(),y||(this.hostname=s1.toASCII(this.hostname));var G=this.port?":"+this.port:"",N=this.hostname||"";this.host=N+G,this.href+=this.host,y&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),a[0]!=="/"&&(a="/"+a))}if(!d1[u])for(var p=0,b=Zl.length;p<b;p++){var C=Zl[p];if(a.indexOf(C)!==-1){var F=encodeURIComponent(C);F===C&&(F=escape(C)),a=a.split(C).join(F)}}var X=a.indexOf("#");X!==-1&&(this.hash=a.substr(X),a=a.slice(0,X));var V=a.indexOf("?");if(V!==-1?(this.search=a.substr(V),this.query=a.substr(V+1),t&&(this.query=Hl.parse(this.query)),a=a.slice(0,V)):t&&(this.search="",this.query={}),a&&(this.pathname=a),Bs[u]&&this.hostname&&!this.pathname&&(this.pathname="/"),this.pathname||this.search){var G=this.pathname||"",L=this.search||"";this.path=G+L}return this.href=this.format(),this},Ji.prototype.format=function(){var r=this.auth||"";r&&(r=encodeURIComponent(r),r=r.replace(/%3A/i,":"),r+="@");var t=this.protocol||"",e=this.pathname||"",i=this.hash||"",s=!1,n="";this.host?s=r+this.host:this.hostname&&(s=r+(this.hostname.indexOf(":")===-1?this.hostname:"["+this.hostname+"]"),this.port&&(s+=":"+this.port)),this.query&&typeof this.query=="object"&&Object.keys(this.query).length&&(n=Hl.stringify(this.query,{arrayFormat:"repeat",addQueryPrefix:!1}));var o=this.search||n&&"?"+n||"";return t&&t.substr(-1)!==":"&&(t+=":"),this.slashes||(!t||Bs[t])&&s!==!1?(s="//"+(s||""),e&&e.charAt(0)!=="/"&&(e="/"+e)):s||(s=""),i&&i.charAt(0)!=="#"&&(i="#"+i),o&&o.charAt(0)!=="?"&&(o="?"+o),e=e.replace(/[?#]/g,function(a){return encodeURIComponent(a)}),o=o.replace("#","%23"),t+s+e+o+i},Ji.prototype.resolve=function(r){return this.resolveObject(p1(r,!1,!0)).format()},Ji.prototype.resolveObject=function(r){if(typeof r=="string"){var t=new Ji;t.parse(r,!1,!0),r=t}for(var e=new Ji,i=Object.keys(this),s=0;s<i.length;s++){var n=i[s];e[n]=this[n]}if(e.hash=r.hash,r.href==="")return e.href=e.format(),e;if(r.slashes&&!r.protocol){for(var o=Object.keys(r),a=0;a<o.length;a++){var h=o[a];h!=="protocol"&&(e[h]=r[h])}return Bs[e.protocol]&&e.hostname&&!e.pathname&&(e.pathname="/",e.path=e.pathname),e.href=e.format(),e}if(r.protocol&&r.protocol!==e.protocol){if(!Bs[r.protocol]){for(var l=Object.keys(r),u=0;u<l.length;u++){var c=l[u];e[c]=r[c]}return e.href=e.format(),e}if(e.protocol=r.protocol,!r.host&&!Vl[r.protocol]){for(var b=(r.pathname||"").split("/");b.length&&!(r.host=b.shift()););r.host||(r.host=""),r.hostname||(r.hostname=""),b[0]!==""&&b.unshift(""),b.length<2&&b.unshift(""),e.pathname=b.join("/")}else e.pathname=r.pathname;if(e.search=r.search,e.query=r.query,e.host=r.host||"",e.auth=r.auth,e.hostname=r.hostname||r.host,e.port=r.port,e.pathname||e.search){var d=e.pathname||"",p=e.search||"";e.path=d+p}return e.slashes=e.slashes||r.slashes,e.href=e.format(),e}var m=e.pathname&&e.pathname.charAt(0)==="/",f=r.host||r.pathname&&r.pathname.charAt(0)==="/",g=f||m||e.host&&r.pathname,y=g,_=e.pathname&&e.pathname.split("/")||[],b=r.pathname&&r.pathname.split("/")||[],v=e.protocol&&!Bs[e.protocol];if(v&&(e.hostname="",e.port=null,e.host&&(_[0]===""?_[0]=e.host:_.unshift(e.host)),e.host="",r.protocol&&(r.hostname=null,r.port=null,r.host&&(b[0]===""?b[0]=r.host:b.unshift(r.host)),r.host=null),g=g&&(b[0]===""||_[0]==="")),f)e.host=r.host||r.host===""?r.host:e.host,e.hostname=r.hostname||r.hostname===""?r.hostname:e.hostname,e.search=r.search,e.query=r.query,_=b;else if(b.length)_||(_=[]),_.pop(),_=_.concat(b),e.search=r.search,e.query=r.query;else if(r.search!=null){if(v){e.host=_.shift(),e.hostname=e.host;var S=e.host&&e.host.indexOf("@")>0?e.host.split("@"):!1;S&&(e.auth=S.shift(),e.hostname=S.shift(),e.host=e.hostname)}return e.search=r.search,e.query=r.query,(e.pathname!==null||e.search!==null)&&(e.path=(e.pathname?e.pathname:"")+(e.search?e.search:"")),e.href=e.format(),e}if(!_.length)return e.pathname=null,e.search?e.path="/"+e.search:e.path=null,e.href=e.format(),e;for(var E=_.slice(-1)[0],A=(e.host||r.host||_.length>1)&&(E==="."||E==="..")||E==="",I=0,P=_.length;P>=0;P--)E=_[P],E==="."?_.splice(P,1):E===".."?(_.splice(P,1),I++):I&&(_.splice(P,1),I--);if(!g&&!y)for(;I--;I)_.unshift("..");g&&_[0]!==""&&(!_[0]||_[0].charAt(0)!=="/")&&_.unshift(""),A&&_.join("/").substr(-1)!=="/"&&_.push("");var W=_[0]===""||_[0]&&_[0].charAt(0)==="/";if(v){e.hostname=W?"":_.length?_.shift():"",e.host=e.hostname;var S=e.host&&e.host.indexOf("@")>0?e.host.split("@"):!1;S&&(e.auth=S.shift(),e.hostname=S.shift(),e.host=e.hostname)}return g=g||e.host&&_.length,g&&!W&&_.unshift(""),_.length>0?e.pathname=_.join("/"):(e.pathname=null,e.path=null),(e.pathname!==null||e.search!==null)&&(e.path=(e.pathname?e.pathname:"")+(e.search?e.search:"")),e.auth=r.auth||e.auth,e.slashes=e.slashes||r.slashes,e.href=e.format(),e},Ji.prototype.parseHost=function(){var r=this.host,t=o1.exec(r);t&&(t=t[0],t!==":"&&(this.port=t.substr(1)),r=r.substr(0,r.length-t.length)),r&&(this.hostname=r)};const Sf={};function vt(r,t,e=3){if(Sf[t])return;let i=new Error().stack;typeof i>"u"?console.warn("PixiJS Deprecation Warning: ",`${t}
|
|
6
6
|
Deprecated since v${r}`):(i=i.split(`
|
|
7
7
|
`).splice(e).join(`
|
|
8
8
|
`),console.groupCollapsed?(console.groupCollapsed("%cPixiJS Deprecation Warning: %c%s","color:#614108;background:#fffbe6","font-weight:normal;color:#614108;background:#fffbe6",`${t}
|
|
9
9
|
Deprecated since v${r}`),console.warn(i),console.groupEnd()):(console.warn("PixiJS Deprecation Warning: ",`${t}
|
|
10
|
-
Deprecated since v${r}`),console.warn(i))),vf[t]=!0}function ti(r){if(typeof r!="string")throw new TypeError(`Path must be a string. Received ${JSON.stringify(r)}`)}function Xn(r){return r.split("?")[0].split("#")[0]}function c1(r){return r.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function d1(r,t,e){return r.replace(new RegExp(c1(t),"g"),e)}function p1(r,t){let e="",i=0,s=-1,n=0,o=-1;for(let a=0;a<=r.length;++a){if(a<r.length)o=r.charCodeAt(a);else{if(o===47)break;o=47}if(o===47){if(!(s===a-1||n===1))if(s!==a-1&&n===2){if(e.length<2||i!==2||e.charCodeAt(e.length-1)!==46||e.charCodeAt(e.length-2)!==46){if(e.length>2){const h=e.lastIndexOf("/");if(h!==e.length-1){h===-1?(e="",i=0):(e=e.slice(0,h),i=e.length-1-e.lastIndexOf("/")),s=a,n=0;continue}}else if(e.length===2||e.length===1){e="",i=0,s=a,n=0;continue}}t&&(e.length>0?e+="/..":e="..",i=2)}else e.length>0?e+=`/${r.slice(s+1,a)}`:e=r.slice(s+1,a),i=a-s-1;s=a,n=0}else o===46&&n!==-1?++n:n=-1}return e}const Jt={toPosix(r){return d1(r,"\\","/")},isUrl(r){return/^https?:/.test(this.toPosix(r))},isDataUrl(r){return/^data:([a-z]+\/[a-z0-9-+.]+(;[a-z0-9-.!#$%*+.{}|~`]+=[a-z0-9-.!#$%*+.{}()_|~`]+)*)?(;base64)?,([a-z0-9!$&',()*+;=\-._~:@\/?%\s<>]*?)$/i.test(r)},isBlobUrl(r){return r.startsWith("blob:")},hasProtocol(r){return/^[^/:]+:/.test(this.toPosix(r))},getProtocol(r){ti(r),r=this.toPosix(r);const t=/^file:\/\/\//.exec(r);if(t)return t[0];const e=/^[^/:]+:\/{0,2}/.exec(r);return e?e[0]:""},toAbsolute(r,t,e){if(ti(r),this.isDataUrl(r)||this.isBlobUrl(r))return r;const i=Xn(this.toPosix(t??$.ADAPTER.getBaseUrl())),s=Xn(this.toPosix(e??this.rootname(i)));return r=this.toPosix(r),r.startsWith("/")?Jt.join(s,r.slice(1)):this.isAbsolute(r)?r:this.join(i,r)},normalize(r){if(ti(r),r.length===0)return".";if(this.isDataUrl(r)||this.isBlobUrl(r))return r;r=this.toPosix(r);let t="";const e=r.startsWith("/");this.hasProtocol(r)&&(t=this.rootname(r),r=r.slice(t.length));const i=r.endsWith("/");return r=p1(r,!1),r.length>0&&i&&(r+="/"),e?`/${r}`:t+r},isAbsolute(r){return ti(r),r=this.toPosix(r),this.hasProtocol(r)?!0:r.startsWith("/")},join(...r){if(r.length===0)return".";let t;for(let e=0;e<r.length;++e){const i=r[e];if(ti(i),i.length>0)if(t===void 0)t=i;else{const s=r[e-1]??"";this.extname(s)?t+=`/../${i}`:t+=`/${i}`}}return t===void 0?".":this.normalize(t)},dirname(r){if(ti(r),r.length===0)return".";r=this.toPosix(r);let t=r.charCodeAt(0);const e=t===47;let i=-1,s=!0;const n=this.getProtocol(r),o=r;r=r.slice(n.length);for(let a=r.length-1;a>=1;--a)if(t=r.charCodeAt(a),t===47){if(!s){i=a;break}}else s=!1;return i===-1?e?"/":this.isUrl(o)?n+r:n:e&&i===1?"//":n+r.slice(0,i)},rootname(r){ti(r),r=this.toPosix(r);let t="";if(r.startsWith("/")?t="/":t=this.getProtocol(r),this.isUrl(r)){const e=r.indexOf("/",t.length);e!==-1?t=r.slice(0,e):t=r,t.endsWith("/")||(t+="/")}return t},basename(r,t){ti(r),t&&ti(t),r=Xn(this.toPosix(r));let e=0,i=-1,s=!0,n;if(t!==void 0&&t.length>0&&t.length<=r.length){if(t.length===r.length&&t===r)return"";let o=t.length-1,a=-1;for(n=r.length-1;n>=0;--n){const h=r.charCodeAt(n);if(h===47){if(!s){e=n+1;break}}else a===-1&&(s=!1,a=n+1),o>=0&&(h===t.charCodeAt(o)?--o===-1&&(i=n):(o=-1,i=a))}return e===i?i=a:i===-1&&(i=r.length),r.slice(e,i)}for(n=r.length-1;n>=0;--n)if(r.charCodeAt(n)===47){if(!s){e=n+1;break}}else i===-1&&(s=!1,i=n+1);return i===-1?"":r.slice(e,i)},extname(r){ti(r),r=Xn(this.toPosix(r));let t=-1,e=0,i=-1,s=!0,n=0;for(let o=r.length-1;o>=0;--o){const a=r.charCodeAt(o);if(a===47){if(!s){e=o+1;break}continue}i===-1&&(s=!1,i=o+1),a===46?t===-1?t=o:n!==1&&(n=1):t!==-1&&(n=-1)}return t===-1||i===-1||n===0||n===1&&t===i-1&&t===e+1?"":r.slice(t,i)},parse(r){ti(r);const t={root:"",dir:"",base:"",ext:"",name:""};if(r.length===0)return t;r=Xn(this.toPosix(r));let e=r.charCodeAt(0);const i=this.isAbsolute(r);let s;t.root=this.rootname(r),i||this.hasProtocol(r)?s=1:s=0;let n=-1,o=0,a=-1,h=!0,l=r.length-1,u=0;for(;l>=s;--l){if(e=r.charCodeAt(l),e===47){if(!h){o=l+1;break}continue}a===-1&&(h=!1,a=l+1),e===46?n===-1?n=l:u!==1&&(u=1):n!==-1&&(u=-1)}return n===-1||a===-1||u===0||u===1&&n===a-1&&n===o+1?a!==-1&&(o===0&&i?t.base=t.name=r.slice(1,a):t.base=t.name=r.slice(o,a)):(o===0&&i?(t.name=r.slice(1,n),t.base=r.slice(1,a)):(t.name=r.slice(o,n),t.base=r.slice(o,a)),t.ext=r.slice(n,a)),t.dir=this.dirname(r),t},sep:"/",delimiter:":"};let Kl;async function f1(){return Kl??(Kl=(async()=>{var n;const r=document.createElement("canvas").getContext("webgl");if(!r)return be.UNPACK;const t=await new Promise(o=>{const a=document.createElement("video");a.onloadeddata=()=>o(a),a.onerror=()=>o(null),a.autoplay=!1,a.crossOrigin="anonymous",a.preload="auto",a.src="data:video/webm;base64,GkXfo59ChoEBQveBAULygQRC84EIQoKEd2VibUKHgQJChYECGFOAZwEAAAAAAAHTEU2bdLpNu4tTq4QVSalmU6yBoU27i1OrhBZUrmtTrIHGTbuMU6uEElTDZ1OsggEXTbuMU6uEHFO7a1OsggG97AEAAAAAAABZAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAVSalmoCrXsYMPQkBNgIRMYXZmV0GETGF2ZkSJiEBEAAAAAAAAFlSua8yuAQAAAAAAAEPXgQFzxYgAAAAAAAAAAZyBACK1nIN1bmSIgQCGhVZfVlA5g4EBI+ODhAJiWgDglLCBArqBApqBAlPAgQFVsIRVuYEBElTDZ9Vzc9JjwItjxYgAAAAAAAAAAWfInEWjh0VOQ09ERVJEh49MYXZjIGxpYnZweC12cDlnyKJFo4hEVVJBVElPTkSHlDAwOjAwOjAwLjA0MDAwMDAwMAAAH0O2dcfngQCgwqGggQAAAIJJg0IAABAAFgA4JBwYSgAAICAAEb///4r+AAB1oZ2mm+6BAaWWgkmDQgAAEAAWADgkHBhKAAAgIABIQBxTu2uRu4+zgQC3iveBAfGCAXHwgQM=",a.load()});if(!t)return be.UNPACK;const e=r.createTexture();r.bindTexture(r.TEXTURE_2D,e);const i=r.createFramebuffer();r.bindFramebuffer(r.FRAMEBUFFER,i),r.framebufferTexture2D(r.FRAMEBUFFER,r.COLOR_ATTACHMENT0,r.TEXTURE_2D,e,0),r.pixelStorei(r.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),r.pixelStorei(r.UNPACK_COLORSPACE_CONVERSION_WEBGL,r.NONE),r.texImage2D(r.TEXTURE_2D,0,r.RGBA,r.RGBA,r.UNSIGNED_BYTE,t);const s=new Uint8Array(4);return r.readPixels(0,0,1,1,r.RGBA,r.UNSIGNED_BYTE,s),r.deleteFramebuffer(i),r.deleteTexture(e),(n=r.getExtension("WEBGL_lose_context"))==null||n.loseContext(),s[0]<=s[3]?be.PMA:be.UNPACK})()),Kl}let Yl;function m1(){return typeof Yl>"u"&&(Yl=function(){var t;const r={stencil:!0,failIfMajorPerformanceCaveat:$.FAIL_IF_MAJOR_PERFORMANCE_CAVEAT};try{if(!$.ADAPTER.getWebGLRenderingContext())return!1;const e=$.ADAPTER.createCanvas();let i=e.getContext("webgl",r)||e.getContext("experimental-webgl",r);const s=!!((t=i==null?void 0:i.getContextAttributes())!=null&&t.stencil);if(i){const n=i.getExtension("WEBGL_lose_context");n&&n.loseContext()}return i=null,s}catch{return!1}}()),Yl}var g1={grad:.9,turn:360,rad:360/(2*Math.PI)},Ji=function(r){return typeof r=="string"?r.length>0:typeof r=="number"},ee=function(r,t,e){return t===void 0&&(t=0),e===void 0&&(e=Math.pow(10,t)),Math.round(e*r)/e+0},Ue=function(r,t,e){return t===void 0&&(t=0),e===void 0&&(e=1),r>e?e:r>t?r:t},Tf=function(r){return(r=isFinite(r)?r%360:0)>0?r:r+360},wf=function(r){return{r:Ue(r.r,0,255),g:Ue(r.g,0,255),b:Ue(r.b,0,255),a:Ue(r.a)}},zl=function(r){return{r:ee(r.r),g:ee(r.g),b:ee(r.b),a:ee(r.a,3)}},y1=/^#([0-9a-f]{3,8})$/i,aa=function(r){var t=r.toString(16);return t.length<2?"0"+t:t},Sf=function(r){var t=r.r,e=r.g,i=r.b,s=r.a,n=Math.max(t,e,i),o=n-Math.min(t,e,i),a=o?n===t?(e-i)/o:n===e?2+(i-t)/o:4+(t-e)/o:0;return{h:60*(a<0?a+6:a),s:n?o/n*100:0,v:n/255*100,a:s}},Ef=function(r){var t=r.h,e=r.s,i=r.v,s=r.a;t=t/360*6,e/=100,i/=100;var n=Math.floor(t),o=i*(1-e),a=i*(1-(t-n)*e),h=i*(1-(1-t+n)*e),l=n%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:s}},Cf=function(r){return{h:Tf(r.h),s:Ue(r.s,0,100),l:Ue(r.l,0,100),a:Ue(r.a)}},If=function(r){return{h:ee(r.h),s:ee(r.s),l:ee(r.l),a:ee(r.a,3)}},Af=function(r){return Ef((e=(t=r).s,{h:t.h,s:(e*=((i=t.l)<50?i:100-i)/100)>0?2*e/(i+e)*100:0,v:i+e,a:t.a}));var t,e,i},Zn=function(r){return{h:(t=Sf(r)).h,s:(s=(200-(e=t.s))*(i=t.v)/100)>0&&s<200?e*i/100/(s<=100?s:200-s)*100:0,l:s/2,a:t.a};var t,e,i,s},b1=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,x1=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,_1=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,v1=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,jl={string:[[function(r){var t=y1.exec(r);return t?(r=t[1]).length<=4?{r:parseInt(r[0]+r[0],16),g:parseInt(r[1]+r[1],16),b:parseInt(r[2]+r[2],16),a:r.length===4?ee(parseInt(r[3]+r[3],16)/255,2):1}:r.length===6||r.length===8?{r:parseInt(r.substr(0,2),16),g:parseInt(r.substr(2,2),16),b:parseInt(r.substr(4,2),16),a:r.length===8?ee(parseInt(r.substr(6,2),16)/255,2):1}:null:null},"hex"],[function(r){var t=_1.exec(r)||v1.exec(r);return t?t[2]!==t[4]||t[4]!==t[6]?null:wf({r:Number(t[1])/(t[2]?100/255:1),g:Number(t[3])/(t[4]?100/255:1),b:Number(t[5])/(t[6]?100/255:1),a:t[7]===void 0?1:Number(t[7])/(t[8]?100:1)}):null},"rgb"],[function(r){var t=b1.exec(r)||x1.exec(r);if(!t)return null;var e,i,s=Cf({h:(e=t[1],i=t[2],i===void 0&&(i="deg"),Number(e)*(g1[i]||1)),s:Number(t[3]),l:Number(t[4]),a:t[5]===void 0?1:Number(t[5])/(t[6]?100:1)});return Af(s)},"hsl"]],object:[[function(r){var t=r.r,e=r.g,i=r.b,s=r.a,n=s===void 0?1:s;return Ji(t)&&Ji(e)&&Ji(i)?wf({r:Number(t),g:Number(e),b:Number(i),a:Number(n)}):null},"rgb"],[function(r){var t=r.h,e=r.s,i=r.l,s=r.a,n=s===void 0?1:s;if(!Ji(t)||!Ji(e)||!Ji(i))return null;var o=Cf({h:Number(t),s:Number(e),l:Number(i),a:Number(n)});return Af(o)},"hsl"],[function(r){var t=r.h,e=r.s,i=r.v,s=r.a,n=s===void 0?1:s;if(!Ji(t)||!Ji(e)||!Ji(i))return null;var o=function(a){return{h:Tf(a.h),s:Ue(a.s,0,100),v:Ue(a.v,0,100),a:Ue(a.a)}}({h:Number(t),s:Number(e),v:Number(i),a:Number(n)});return Ef(o)},"hsv"]]},Mf=function(r,t){for(var e=0;e<t.length;e++){var i=t[e][0](r);if(i)return[i,t[e][1]]}return[null,void 0]},T1=function(r){return typeof r=="string"?Mf(r.trim(),jl.string):typeof r=="object"&&r!==null?Mf(r,jl.object):[null,void 0]},Jl=function(r,t){var e=Zn(r);return{h:e.h,s:Ue(e.s+100*t,0,100),l:e.l,a:e.a}},$l=function(r){return(299*r.r+587*r.g+114*r.b)/1e3/255},Rf=function(r,t){var e=Zn(r);return{h:e.h,s:e.s,l:Ue(e.l+100*t,0,100),a:e.a}},Ql=function(){function r(t){this.parsed=T1(t)[0],this.rgba=this.parsed||{r:0,g:0,b:0,a:1}}return r.prototype.isValid=function(){return this.parsed!==null},r.prototype.brightness=function(){return ee($l(this.rgba),2)},r.prototype.isDark=function(){return $l(this.rgba)<.5},r.prototype.isLight=function(){return $l(this.rgba)>=.5},r.prototype.toHex=function(){return t=zl(this.rgba),e=t.r,i=t.g,s=t.b,o=(n=t.a)<1?aa(ee(255*n)):"","#"+aa(e)+aa(i)+aa(s)+o;var t,e,i,s,n,o},r.prototype.toRgb=function(){return zl(this.rgba)},r.prototype.toRgbString=function(){return t=zl(this.rgba),e=t.r,i=t.g,s=t.b,(n=t.a)<1?"rgba("+e+", "+i+", "+s+", "+n+")":"rgb("+e+", "+i+", "+s+")";var t,e,i,s,n},r.prototype.toHsl=function(){return If(Zn(this.rgba))},r.prototype.toHslString=function(){return t=If(Zn(this.rgba)),e=t.h,i=t.s,s=t.l,(n=t.a)<1?"hsla("+e+", "+i+"%, "+s+"%, "+n+")":"hsl("+e+", "+i+"%, "+s+"%)";var t,e,i,s,n},r.prototype.toHsv=function(){return t=Sf(this.rgba),{h:ee(t.h),s:ee(t.s),v:ee(t.v),a:ee(t.a,3)};var t},r.prototype.invert=function(){return wi({r:255-(t=this.rgba).r,g:255-t.g,b:255-t.b,a:t.a});var t},r.prototype.saturate=function(t){return t===void 0&&(t=.1),wi(Jl(this.rgba,t))},r.prototype.desaturate=function(t){return t===void 0&&(t=.1),wi(Jl(this.rgba,-t))},r.prototype.grayscale=function(){return wi(Jl(this.rgba,-1))},r.prototype.lighten=function(t){return t===void 0&&(t=.1),wi(Rf(this.rgba,t))},r.prototype.darken=function(t){return t===void 0&&(t=.1),wi(Rf(this.rgba,-t))},r.prototype.rotate=function(t){return t===void 0&&(t=15),this.hue(this.hue()+t)},r.prototype.alpha=function(t){return typeof t=="number"?wi({r:(e=this.rgba).r,g:e.g,b:e.b,a:t}):ee(this.rgba.a,3);var e},r.prototype.hue=function(t){var e=Zn(this.rgba);return typeof t=="number"?wi({h:t,s:e.s,l:e.l,a:e.a}):ee(e.h)},r.prototype.isEqual=function(t){return this.toHex()===wi(t).toHex()},r}(),wi=function(r){return r instanceof Ql?r:new Ql(r)},Pf=[],w1=function(r){r.forEach(function(t){Pf.indexOf(t)<0&&(t(Ql,jl),Pf.push(t))})};function S1(r,t){var e={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 s in e)i[e[s]]=s;var n={};r.prototype.toName=function(o){if(!(this.rgba.a||this.rgba.r||this.rgba.g||this.rgba.b))return"transparent";var a,h,l=i[this.toHex()];if(l)return l;if(o!=null&&o.closest){var u=this.toRgb(),c=1/0,d="black";if(!n.length)for(var p in e)n[p]=new r(e[p]).toRgb();for(var m in e){var f=(a=u,h=n[m],Math.pow(a.r-h.r,2)+Math.pow(a.g-h.g,2)+Math.pow(a.b-h.b,2));f<c&&(c=f,d=m)}return d}},t.string.push([function(o){var a=o.toLowerCase(),h=a==="transparent"?"#0000":e[a];return h?new r(h).toRgb():null},"name"])}w1([S1]);const Bs=class sl{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 sl)this._value=this.cloneSource(t._value),this._int=t._int,this._components.set(t._components);else{if(t===null)throw new Error("Cannot set PIXI.Color#value to null");(this._value===null||!this.isSourceEqual(this._value,t))&&(this.normalize(t),this._value=this.cloneSource(t))}}get value(){return this._value}cloneSource(t){return typeof t=="string"||typeof t=="number"||t instanceof Number||t===null?t:Array.isArray(t)||ArrayBuffer.isView(t)?t.slice(0):typeof t=="object"&&t!==null?{...t}:t}isSourceEqual(t,e){const i=typeof t;if(i!==typeof e)return!1;if(i==="number"||i==="string"||t instanceof Number)return t===e;if(Array.isArray(t)&&Array.isArray(e)||ArrayBuffer.isView(t)&&ArrayBuffer.isView(e))return t.length!==e.length?!1:t.every((s,n)=>s===e[n]);if(t!==null&&e!==null){const s=Object.keys(t),n=Object.keys(e);return s.length!==n.length?!1:s.every(o=>t[o]===e[o])}return t===e}toRgba(){const[t,e,i,s]=this._components;return{r:t,g:e,b:i,a:s}}toRgb(){const[t,e,i]=this._components;return{r:t,g:e,b:i}}toRgbaString(){const[t,e,i]=this.toUint8RgbArray();return`rgba(${t},${e},${i},${this.alpha})`}toUint8RgbArray(t){const[e,i,s]=this._components;return t=t??[],t[0]=Math.round(e*255),t[1]=Math.round(i*255),t[2]=Math.round(s*255),t}toRgbArray(t){t=t??[];const[e,i,s]=this._components;return t[0]=e,t[1]=i,t[2]=s,t}toNumber(){return this._int}toLittleEndianNumber(){const t=this._int;return(t>>16)+(t&65280)+((t&255)<<16)}multiply(t){const[e,i,s,n]=sl.temp.setValue(t)._components;return this._components[0]*=e,this._components[1]*=i,this._components[2]*=s,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(t===1)return(255<<24)+this._int;if(t===0)return e?0:this._int;let i=this._int>>16&255,s=this._int>>8&255,n=this._int&255;return e&&(i=i*t+.5|0,s=s*t+.5|0,n=n*t+.5|0),(t*255<<24)+(i<<16)+(s<<8)+n}toHex(){const t=this._int.toString(16);return`#${"000000".substring(0,6-t.length)+t}`}toHexa(){const t=Math.round(this._components[3]*255).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,i,s]=this._components;return this._components[0]=Math.round(e*t)/t,this._components[1]=Math.round(i*t)/t,this._components[2]=Math.round(s*t)/t,this.refreshInt(),this._value=null,this}toArray(t){t=t??[];const[e,i,s,n]=this._components;return t[0]=e,t[1]=i,t[2]=s,t[3]=n,t}normalize(t){let e,i,s,n;if((typeof t=="number"||t instanceof Number)&&t>=0&&t<=16777215){const o=t;e=(o>>16&255)/255,i=(o>>8&255)/255,s=(o&255)/255,n=1}else if((Array.isArray(t)||t instanceof Float32Array)&&t.length>=3&&t.length<=4)t=this._clamp(t),[e,i,s,n=1]=t;else if((t instanceof Uint8Array||t instanceof Uint8ClampedArray)&&t.length>=3&&t.length<=4)t=this._clamp(t,0,255),[e,i,s,n=255]=t,e/=255,i/=255,s/=255,n/=255;else if(typeof t=="string"||typeof t=="object"){if(typeof t=="string"){const a=sl.HEX_PATTERN.exec(t);a&&(t=`#${a[2]}`)}const o=wi(t);o.isValid()&&({r:e,g:i,b:s,a:n}=o.rgba,e/=255,i/=255,s/=255)}if(e!==void 0)this._components[0]=e,this._components[1]=i,this._components[2]=s,this._components[3]=n,this.refreshInt();else throw new Error(`Unable to convert color ${t}`)}refreshInt(){this._clamp(this._components);const[t,e,i]=this._components;this._int=(t*255<<16)+(e*255<<8)+(i*255|0)}_clamp(t,e=0,i=1){return typeof t=="number"?Math.min(Math.max(t,e),i):(t.forEach((s,n)=>{t[n]=Math.min(Math.max(s,e),i)}),t)}};Bs.shared=new Bs,Bs.temp=new Bs,Bs.HEX_PATTERN=/^(#|0x)?(([a-f0-9]{3}){1,2}([a-f0-9]{2})?)$/i;let Lt=Bs;function E1(r){return xt("7.2.0","utils.hex2string is deprecated, use Color#toHex instead"),Lt.shared.setValue(r).toHex()}function C1(r){return xt("7.2.0","utils.rgb2hex is deprecated, use Color#toNumber instead"),Lt.shared.setValue(r).toNumber()}function I1(){const r=[],t=[];for(let i=0;i<32;i++)r[i]=i,t[i]=i;r[ut.NORMAL_NPM]=ut.NORMAL,r[ut.ADD_NPM]=ut.ADD,r[ut.SCREEN_NPM]=ut.SCREEN,t[ut.NORMAL]=ut.NORMAL_NPM,t[ut.ADD]=ut.ADD_NPM,t[ut.SCREEN]=ut.SCREEN_NPM;const e=[];return e.push(t),e.push(r),e}const Lf=I1();function Gf(r,t){return Lf[t?1:0][r]}function A1(r,t=null){const e=r*6;if(t=t||new Uint16Array(e),t.length!==e)throw new Error(`Out buffer length is incorrect, got ${t.length} and expected ${e}`);for(let i=0,s=0;i<e;i+=6,s+=4)t[i+0]=s+0,t[i+1]=s+1,t[i+2]=s+2,t[i+3]=s+0,t[i+4]=s+2,t[i+5]=s+3;return t}function Nf(r){if(r.BYTES_PER_ELEMENT===4)return r instanceof Float32Array?"Float32Array":r instanceof Uint32Array?"Uint32Array":"Int32Array";if(r.BYTES_PER_ELEMENT===2){if(r instanceof Uint16Array)return"Uint16Array"}else if(r.BYTES_PER_ELEMENT===1&&r instanceof Uint8Array)return"Uint8Array";return null}function ha(r){return r+=r===0?1:0,--r,r|=r>>>1,r|=r>>>2,r|=r>>>4,r|=r>>>8,r|=r>>>16,r+1}function Ff(r){return!(r&r-1)&&!!r}function Df(r){let t=(r>65535?1:0)<<4;r>>>=t;let e=(r>255?1:0)<<3;return r>>>=e,t|=e,e=(r>15?1:0)<<2,r>>>=e,t|=e,e=(r>3?1:0)<<1,r>>>=e,t|=e,t|r>>1}function Ws(r,t,e){const i=r.length;let s;if(t>=i||e===0)return;e=t+e>i?i-t:e;const n=i-e;for(s=t;s<n;++s)r[s]=r[s+e];r.length=n}function mr(r){return r===0?0:r<0?-1:1}let M1=0;function Zr(){return++M1}const ql=class{constructor(r,t,e,i){this.left=r,this.top=t,this.right=e,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}};ql.EMPTY=new ql(0,0,0,0);let kf=ql;const Of={},Si=Object.create(null),gr=Object.create(null);class R1{constructor(t,e,i){this._canvas=$.ADAPTER.createCanvas(),this._context=this._canvas.getContext("2d"),this.resolution=i||$.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(this._canvas===null)throw new TypeError("The CanvasRenderTarget has already been destroyed")}}function Bf(r,t,e){for(let i=0,s=4*e*t;i<t;++i,s+=4)if(r[s+3]!==0)return!1;return!0}function Wf(r,t,e,i,s){const n=4*t;for(let o=i,a=i*n+4*e;o<=s;++o,a+=n)if(r[a+3]!==0)return!1;return!0}function P1(r){const{width:t,height:e}=r,i=r.getContext("2d",{willReadFrequently:!0});if(i===null)throw new TypeError("Failed to get canvas 2D context");const s=i.getImageData(0,0,t,e).data;let n=0,o=0,a=t-1,h=e-1;for(;o<e&&Bf(s,t,o);)++o;if(o===e)return kf.EMPTY;for(;Bf(s,t,h);)--h;for(;Wf(s,t,n,o,h);)++n;for(;Wf(s,t,a,o,h);)--a;return++a,++h,new kf(n,o,a,h)}function L1(r){const t=P1(r),{width:e,height:i}=t;let s=null;if(!t.isEmpty()){const n=r.getContext("2d");if(n===null)throw new TypeError("Failed to get canvas 2D context");s=n.getImageData(t.left,t.top,e,i)}return{width:e,height:i,data:s}}function G1(r,t=globalThis.location){if(r.startsWith("data:"))return"";t=t||globalThis.location;const e=new URL(r,document.baseURI);return e.hostname!==t.hostname||e.port!==t.port||e.protocol!==t.protocol?"anonymous":""}function $i(r,t=1){var i;const e=(i=$.RETINA_PREFIX)==null?void 0:i.exec(r);return e?parseFloat(e[1]):t}var z=(r=>(r.Renderer="renderer",r.Application="application",r.RendererSystem="renderer-webgl-system",r.RendererPlugin="renderer-webgl-plugin",r.CanvasRendererSystem="renderer-canvas-system",r.CanvasRendererPlugin="renderer-canvas-plugin",r.Asset="asset",r.LoadParser="load-parser",r.ResolveParser="resolve-parser",r.CacheParser="cache-parser",r.DetectionParser="detection-parser",r))(z||{});const tu=r=>{if(typeof r=="function"||typeof r=="object"&&r.extension){if(!r.extension)throw new Error("Extension class must have an extension object");r={...typeof r.extension!="object"?{type:r.extension}:r.extension,ref:r}}if(typeof r=="object")r={...r};else throw new Error("Invalid extension type");return typeof r.type=="string"&&(r.type=[r.type]),r},Uf=(r,t)=>tu(r).priority??t,tt={_addHandlers:{},_removeHandlers:{},_queue:{},remove(...r){return r.map(tu).forEach(t=>{t.type.forEach(e=>{var i,s;return(s=(i=this._removeHandlers)[e])==null?void 0:s.call(i,t)})}),this},add(...r){return r.map(tu).forEach(t=>{t.type.forEach(e=>{const i=this._addHandlers,s=this._queue;i[e]?i[e](t):(s[e]=s[e]||[],s[e].push(t))})}),this},handle(r,t,e){const i=this._addHandlers,s=this._removeHandlers;if(i[r]||s[r])throw new Error(`Extension type ${r} already has a handler`);i[r]=t,s[r]=e;const n=this._queue;return n[r]&&(n[r].forEach(o=>t(o)),delete n[r]),this},handleByMap(r,t){return this.handle(r,e=>{t[e.name]=e.ref},e=>{delete t[e.name]})},handleByList(r,t,e=-1){return this.handle(r,i=>{t.includes(i.ref)||(t.push(i.ref),t.sort((s,n)=>Uf(n,e)-Uf(s,e)))},i=>{const s=t.indexOf(i.ref);s!==-1&&t.splice(s,1)})}};class eu{constructor(t){typeof t=="number"?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 N1=["precision mediump float;","void main(void){","float test = 0.1;","%forloop%","gl_FragColor = vec4(0.0);","}"].join(`
|
|
11
|
-
`);function
|
|
12
|
-
else `),e<r-1&&(t+=`if(test == ${e}.0){}`);return t}function D1(r,t){if(r===0)throw new Error("Invalid value of `0` passed to `checkMaxIfStatementsInShader`");const e=t.createShader(t.FRAGMENT_SHADER);for(;;){const i=N1.replace(/%forloop%/gi,F1(r));if(t.shaderSource(e,i),t.compileShader(e),!t.getShaderParameter(e,t.COMPILE_STATUS))r=r/2|0;else break}return r}const iu=0,ru=1,su=2,nu=3,ou=4,au=5;class Ei{constructor(){this.data=0,this.blendMode=ut.NORMAL,this.polygonOffset=0,this.blend=!0,this.depthMask=!0}get blend(){return!!(this.data&1<<iu)}set blend(t){!!(this.data&1<<iu)!==t&&(this.data^=1<<iu)}get offsets(){return!!(this.data&1<<ru)}set offsets(t){!!(this.data&1<<ru)!==t&&(this.data^=1<<ru)}get culling(){return!!(this.data&1<<su)}set culling(t){!!(this.data&1<<su)!==t&&(this.data^=1<<su)}get depthTest(){return!!(this.data&1<<nu)}set depthTest(t){!!(this.data&1<<nu)!==t&&(this.data^=1<<nu)}get depthMask(){return!!(this.data&1<<au)}set depthMask(t){!!(this.data&1<<au)!==t&&(this.data^=1<<au)}get clockwiseFrontFace(){return!!(this.data&1<<ou)}set clockwiseFrontFace(t){!!(this.data&1<<ou)!==t&&(this.data^=1<<ou)}get blendMode(){return this._blendMode}set blendMode(t){this.blend=t!==ut.NONE,this._blendMode=t}get polygonOffset(){return this._polygonOffset}set polygonOffset(t){this.offsets=!!t,this._polygonOffset=t}static for2d(){const t=new Ei;return t.depthTest=!1,t.blend=!0,t}}Ei.prototype.toString=function(){return`[@pixi/core:State blendMode=${this.blendMode} clockwiseFrontFace=${this.clockwiseFrontFace} culling=${this.culling} depthMask=${this.depthMask} polygonOffset=${this.polygonOffset}]`};const hu=[];function Xf(r,t){if(!r)return null;let e="";if(typeof r=="string"){const i=/\.(\w{3,4})(?:$|\?|#)/i.exec(r);i&&(e=i[1].toLowerCase())}for(let i=hu.length-1;i>=0;--i){const s=hu[i];if(s.test&&s.test(r,e))return new s(r,t)}throw new Error("Unrecognized source type to auto-detect Resource")}class ei{constructor(t){this.items=[],this._name=t,this._aliasCount=0}emit(t,e,i,s,n,o,a,h){if(arguments.length>8)throw new Error("max arguments reached");const{name:l,items:u}=this;this._aliasCount++;for(let c=0,d=u.length;c<d;c++)u[c][l](t,e,i,s,n,o,a,h);return u===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 e!==-1&&(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 this.items.length===0}get name(){return this._name}}Object.defineProperties(ei.prototype,{dispatch:{value:ei.prototype.emit},run:{value:ei.prototype.emit}});class Vn{constructor(t=0,e=0){this._width=t,this._height=e,this.destroyed=!1,this.internal=!1,this.onResize=new ei("setRealSize"),this.onUpdate=new ei("update"),this.onError=new ei("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,i){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 la extends Vn{constructor(t,e){const{width:i,height:s}=e||{};if(!i||!s)throw new Error("BufferResource width or height invalid");super(i,s),this.data=t,this.unpackAlignment=e.unpackAlignment??4}upload(t,e,i){const s=t.gl;s.pixelStorei(s.UNPACK_ALIGNMENT,this.unpackAlignment),s.pixelStorei(s.UNPACK_PREMULTIPLY_ALPHA_WEBGL,e.alphaMode===be.UNPACK);const n=e.realWidth,o=e.realHeight;return i.width===n&&i.height===o?s.texSubImage2D(e.target,0,0,0,n,o,e.format,i.type,this.data):(i.width=n,i.height=o,s.texImage2D(e.target,0,i.internalFormat,n,o,0,e.format,i.type,this.data)),!0}dispose(){this.data=null}static test(t){return t===null||t instanceof Int8Array||t instanceof Uint8Array||t instanceof Uint8ClampedArray||t instanceof Int16Array||t instanceof Uint16Array||t instanceof Int32Array||t instanceof Uint32Array||t instanceof Float32Array}}const k1={scaleMode:Vi.NEAREST,alphaMode:be.NPM},lu=class In extends Gn{constructor(t=null,e=null){super(),e=Object.assign({},In.defaultOptions,e);const{alphaMode:i,mipmap:s,anisotropicLevel:n,scaleMode:o,width:a,height:h,wrapMode:l,format:u,type:c,target:d,resolution:p,resourceOptions:m}=e;t&&!(t instanceof Vn)&&(t=Xf(t,m),t.internal=!0),this.resolution=p||$.RESOLUTION,this.width=Math.round((a||0)*this.resolution)/this.resolution,this.height=Math.round((h||0)*this.resolution)/this.resolution,this._mipmap=s,this.anisotropicLevel=n,this._wrapMode=l,this._scaleMode=o,this.format=u,this.type=c,this.target=d,this.alphaMode=i,this.uid=Zr(),this.touched=0,this.isPowerOfTwo=!1,this._refreshPOT(),this._glTextures={},this.dirtyId=0,this.dirtyStyleId=0,this.cacheId=null,this.valid=a>0&&h>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 i;return t!==void 0&&t!==this.scaleMode&&(this.scaleMode=t,i=!0),e!==void 0&&e!==this.mipmap&&(this.mipmap=e,i=!0),i&&this.dirtyStyleId++,this}setSize(t,e,i){return i=i||this.resolution,this.setRealSize(t*i,e*i,i)}setRealSize(t,e,i){return this.resolution=i||this.resolution,this.width=Math.round(t)/this.resolution,this.height=Math.round(e)/this.resolution,this._refreshPOT(),this.update(),this}_refreshPOT(){this.isPowerOfTwo=Ff(this.realWidth)&&Ff(this.realHeight)}setResolution(t){const e=this.resolution;return e===t?this:(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 gr[this.cacheId],delete Si[this.cacheId],this.cacheId=null),this.valid=!1,this.dispose(),In.removeFromCache(this),this.textureCacheIds=null,this.destroyed=!0,this.emit("destroyed",this),this.removeAllListeners()}dispose(){this.emit("dispose",this)}castToBaseTexture(){return this}static from(t,e,i=$.STRICT_TEXTURE_CACHE){const s=typeof t=="string";let n=null;if(s)n=t;else{if(!t._pixiId){const a=(e==null?void 0:e.pixiIdPrefix)||"pixiid";t._pixiId=`${a}_${Zr()}`}n=t._pixiId}let o=gr[n];if(s&&i&&!o)throw new Error(`The cacheId "${n}" does not exist in BaseTextureCache.`);return o||(o=new In(t,e),o.cacheId=n,In.addToCache(o,n)),o}static fromBuffer(t,e,i,s){t=t||new Float32Array(e*i*4);const n=new la(t,{width:e,height:i,...s==null?void 0:s.resourceOptions});let o,a;return t instanceof Float32Array?(o=V.RGBA,a=nt.FLOAT):t instanceof Int32Array?(o=V.RGBA_INTEGER,a=nt.INT):t instanceof Uint32Array?(o=V.RGBA_INTEGER,a=nt.UNSIGNED_INT):t instanceof Int16Array?(o=V.RGBA_INTEGER,a=nt.SHORT):t instanceof Uint16Array?(o=V.RGBA_INTEGER,a=nt.UNSIGNED_SHORT):t instanceof Int8Array?(o=V.RGBA,a=nt.BYTE):(o=V.RGBA,a=nt.UNSIGNED_BYTE),n.internal=!0,new In(n,Object.assign({},k1,{type:a,format:o},s))}static addToCache(t,e){e&&(t.textureCacheIds.includes(e)||t.textureCacheIds.push(e),gr[e]&&gr[e]!==t&&console.warn(`BaseTexture added to the cache with an id [${e}] that already had an entry`),gr[e]=t)}static removeFromCache(t){if(typeof t=="string"){const e=gr[t];if(e){const i=e.textureCacheIds.indexOf(t);return i>-1&&e.textureCacheIds.splice(i,1),delete gr[t],e}}else if(t!=null&&t.textureCacheIds){for(let e=0;e<t.textureCacheIds.length;++e)delete gr[t.textureCacheIds[e]];return t.textureCacheIds.length=0,t}return null}};lu.defaultOptions={mipmap:bi.POW2,anisotropicLevel:0,scaleMode:Vi.LINEAR,wrapMode:Hi.CLAMP,alphaMode:be.UNPACK,target:As.TEXTURE_2D,format:V.RGBA,type:nt.UNSIGNED_BYTE},lu._globalBatch=0;let ft=lu;class uu{constructor(){this.texArray=null,this.blend=0,this.type=yi.TRIANGLES,this.start=0,this.size=0,this.data=null}}let O1=0;class Ht{constructor(t,e=!0,i=!1){this.data=t||new Float32Array(1),this._glBuffers={},this._updateID=0,this.index=i,this.static=e,this.id=O1++,this.disposeRunner=new ei("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?_i.ELEMENT_ARRAY_BUFFER:_i.ARRAY_BUFFER}get index(){return this.type===_i.ELEMENT_ARRAY_BUFFER}static from(t){return t instanceof Array&&(t=new Float32Array(t)),new Ht(t)}}class ua{constructor(t,e=0,i=!1,s=nt.FLOAT,n,o,a,h=1){this.buffer=t,this.size=e,this.normalized=i,this.type=s,this.stride=n,this.start=o,this.instance=a,this.divisor=h}destroy(){this.buffer=null}static from(t,e,i,s,n){return new ua(t,e,i,s,n)}}const B1={Float32Array,Uint32Array,Int32Array,Uint8Array};function W1(r,t){let e=0,i=0;const s={};for(let h=0;h<r.length;h++)i+=t[h],e+=r[h].length;const n=new ArrayBuffer(e*4);let o=null,a=0;for(let h=0;h<r.length;h++){const l=t[h],u=r[h],c=Nf(u);s[c]||(s[c]=new B1[c](n)),o=s[c];for(let d=0;d<u.length;d++){const p=(d/l|0)*i+a,m=d%l;o[p+m]=u[d]}a+=l}return new Float32Array(n)}const Zf={5126:4,5123:2,5121:1};let U1=0;const X1={Float32Array,Uint32Array,Int32Array,Uint8Array,Uint16Array};class yr{constructor(t=[],e={}){this.buffers=t,this.indexBuffer=null,this.attributes=e,this.glVertexArrayObjects={},this.id=U1++,this.instanced=!1,this.instanceCount=1,this.disposeRunner=new ei("disposeGeometry"),this.refCount=0}addAttribute(t,e,i=0,s=!1,n,o,a,h=!1){if(!e)throw new Error("You must pass a buffer when creating an attribute");e instanceof Ht||(e instanceof Array&&(e=new Float32Array(e)),e=new Ht(e));const l=t.split("|");if(l.length>1){for(let c=0;c<l.length;c++)this.addAttribute(l[c],e,i,s,n);return this}let u=this.buffers.indexOf(e);return u===-1&&(this.buffers.push(e),u=this.buffers.length-1),this.attributes[t]=new ua(u,i,s,n,o,a,h),this.instanced=this.instanced||h,this}getAttribute(t){return this.attributes[t]}getBuffer(t){return this.buffers[this.getAttribute(t).buffer]}addIndex(t){return t instanceof Ht||(t instanceof Array&&(t=new Uint16Array(t)),t=new Ht(t)),t.type=_i.ELEMENT_ARRAY_BUFFER,this.indexBuffer=t,this.buffers.includes(t)||this.buffers.push(t),this}getIndex(){return this.indexBuffer}interleave(){if(this.buffers.length===1||this.buffers.length===2&&this.indexBuffer)return this;const t=[],e=[],i=new Ht;let s;for(s in this.attributes){const n=this.attributes[s],o=this.buffers[n.buffer];t.push(o.data),e.push(n.size*Zf[n.type]/4),n.buffer=0}for(i.data=W1(t,e),s=0;s<this.buffers.length;s++)this.buffers[s]!==this.indexBuffer&&this.buffers[s].destroy();return this.buffers=[i],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 yr;for(let e=0;e<this.buffers.length;e++)t.buffers[e]=new Ht(this.buffers[e].data.slice(0));for(const e in this.attributes){const i=this.attributes[e];t.attributes[e]=new ua(i.buffer,i.size,i.normalized,i.type,i.stride,i.start,i.instance)}return this.indexBuffer&&(t.indexBuffer=t.buffers[this.buffers.indexOf(this.indexBuffer)],t.indexBuffer.type=_i.ELEMENT_ARRAY_BUFFER),t}static merge(t){const e=new yr,i=[],s=[],n=[];let o;for(let a=0;a<t.length;a++){o=t[a];for(let h=0;h<o.buffers.length;h++)s[h]=s[h]||0,s[h]+=o.buffers[h].data.length,n[h]=0}for(let a=0;a<o.buffers.length;a++)i[a]=new X1[Nf(o.buffers[a].data)](s[a]),e.buffers[a]=new Ht(i[a]);for(let a=0;a<t.length;a++){o=t[a];for(let h=0;h<o.buffers.length;h++)i[h].set(o.buffers[h].data,n[h]),n[h]+=o.buffers[h].data.length}if(e.attributes=o.attributes,o.indexBuffer){e.indexBuffer=e.buffers[o.buffers.indexOf(o.indexBuffer)],e.indexBuffer.type=_i.ELEMENT_ARRAY_BUFFER;let a=0,h=0,l=0,u=0;for(let c=0;c<o.buffers.length;c++)if(o.buffers[c]!==o.indexBuffer){u=c;break}for(const c in o.attributes){const d=o.attributes[c];(d.buffer|0)===u&&(h+=d.size*Zf[d.type]/4)}for(let c=0;c<t.length;c++){const d=t[c].indexBuffer.data;for(let p=0;p<d.length;p++)e.indexBuffer.data[p+l]+=a;a+=t[c].buffers[u].data.length/h,l+=d.length}}return e}}class Vf extends yr{constructor(t=!1){super(),this._buffer=new Ht(null,t,!1),this._indexBuffer=new Ht(null,t,!0),this.addAttribute("aVertexPosition",this._buffer,2,!1,nt.FLOAT).addAttribute("aTextureCoord",this._buffer,2,!1,nt.FLOAT).addAttribute("aColor",this._buffer,4,!0,nt.UNSIGNED_BYTE).addAttribute("aTextureId",this._buffer,1,!0,nt.FLOAT).addIndex(this._indexBuffer)}}const ca=Math.PI*2,Z1=180/Math.PI,V1=Math.PI/180;var ae=(r=>(r[r.POLY=0]="POLY",r[r.RECT=1]="RECT",r[r.CIRC=2]="CIRC",r[r.ELIP=3]="ELIP",r[r.RREC=4]="RREC",r))(ae||{});class lt{constructor(t=0,e=0){this.x=0,this.y=0,this.x=t,this.y=e}clone(){return new lt(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}}lt.prototype.toString=function(){return`[@pixi/math:Point x=${this.x} y=${this.y}]`};const da=[new lt,new lt,new lt,new lt];class ct{constructor(t=0,e=0,i=0,s=0){this.x=Number(t),this.y=Number(e),this.width=Number(i),this.height=Number(s),this.type=ae.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 ct(0,0,0,0)}clone(){return new ct(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?!1:t>=this.x&&t<this.x+this.width&&e>=this.y&&e<this.y+this.height}intersects(t,e){if(!e){const I=this.x<t.x?t.x:this.x;if((this.right>t.right?t.right:this.right)<=I)return!1;const L=this.y<t.y?t.y:this.y;return(this.bottom>t.bottom?t.bottom:this.bottom)>L}const i=this.left,s=this.right,n=this.top,o=this.bottom;if(s<=i||o<=n)return!1;const a=da[0].set(t.left,t.top),h=da[1].set(t.left,t.bottom),l=da[2].set(t.right,t.top),u=da[3].set(t.right,t.bottom);if(l.x<=a.x||h.y<=a.y)return!1;const c=Math.sign(e.a*e.d-e.b*e.c);if(c===0||(e.apply(a,a),e.apply(h,h),e.apply(l,l),e.apply(u,u),Math.max(a.x,h.x,l.x,u.x)<=i||Math.min(a.x,h.x,l.x,u.x)>=s||Math.max(a.y,h.y,l.y,u.y)<=n||Math.min(a.y,h.y,l.y,u.y)>=o))return!1;const d=c*(h.y-a.y),p=c*(a.x-h.x),m=d*i+p*n,f=d*s+p*n,g=d*i+p*o,y=d*s+p*o;if(Math.max(m,f,g,y)<=d*a.x+p*a.y||Math.min(m,f,g,y)>=d*u.x+p*u.y)return!1;const _=c*(a.y-l.y),x=c*(l.x-a.x),v=_*i+x*n,S=_*s+x*n,C=_*i+x*o,A=_*s+x*o;return!(Math.max(v,S,C,A)<=_*a.x+x*a.y||Math.min(v,S,C,A)>=_*u.x+x*u.y)}pad(t=0,e=t){return this.x-=t,this.y-=e,this.width+=t*2,this.height+=e*2,this}fit(t){const e=Math.max(this.x,t.x),i=Math.min(this.x+this.width,t.x+t.width),s=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(i-e,0),this.y=s,this.height=Math.max(n-s,0),this}ceil(t=1,e=.001){const i=Math.ceil((this.x+this.width-e)*t)/t,s=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=i-this.x,this.height=s-this.y,this}enlarge(t){const e=Math.min(this.x,t.x),i=Math.max(this.x+this.width,t.x+t.width),s=Math.min(this.y,t.y),n=Math.max(this.y+this.height,t.y+t.height);return this.x=e,this.width=i-e,this.y=s,this.height=n-s,this}}ct.prototype.toString=function(){return`[@pixi/math:Rectangle x=${this.x} y=${this.y} width=${this.width} height=${this.height}]`};class pa{constructor(t=0,e=0,i=0){this.x=t,this.y=e,this.radius=i,this.type=ae.CIRC}clone(){return new pa(this.x,this.y,this.radius)}contains(t,e){if(this.radius<=0)return!1;const i=this.radius*this.radius;let s=this.x-t,n=this.y-e;return s*=s,n*=n,s+n<=i}getBounds(){return new ct(this.x-this.radius,this.y-this.radius,this.radius*2,this.radius*2)}}pa.prototype.toString=function(){return`[@pixi/math:Circle x=${this.x} y=${this.y} radius=${this.radius}]`};class fa{constructor(t=0,e=0,i=0,s=0){this.x=t,this.y=e,this.width=i,this.height=s,this.type=ae.ELIP}clone(){return new fa(this.x,this.y,this.width,this.height)}contains(t,e){if(this.width<=0||this.height<=0)return!1;let i=(t-this.x)/this.width,s=(e-this.y)/this.height;return i*=i,s*=s,i+s<=1}getBounds(){return new ct(this.x-this.width,this.y-this.height,this.width,this.height)}}fa.prototype.toString=function(){return`[@pixi/math:Ellipse x=${this.x} y=${this.y} width=${this.width} height=${this.height}]`};class Vr{constructor(...t){let e=Array.isArray(t[0])?t[0]:t;if(typeof e[0]!="number"){const i=[];for(let s=0,n=e.length;s<n;s++)i.push(e[s].x,e[s].y);e=i}this.points=e,this.type=ae.POLY,this.closeStroke=!0}clone(){const t=this.points.slice(),e=new Vr(t);return e.closeStroke=this.closeStroke,e}contains(t,e){let i=!1;const s=this.points.length/2;for(let n=0,o=s-1;n<s;o=n++){const a=this.points[n*2],h=this.points[n*2+1],l=this.points[o*2],u=this.points[o*2+1];h>e!=u>e&&t<(l-a)*((e-h)/(u-h))+a&&(i=!i)}return i}}Vr.prototype.toString=function(){return`[@pixi/math:PolygoncloseStroke=${this.closeStroke}points=${this.points.reduce((r,t)=>`${r}, ${t}`,"")}]`};class ma{constructor(t=0,e=0,i=0,s=0,n=20){this.x=t,this.y=e,this.width=i,this.height=s,this.radius=n,this.type=ae.RREC}clone(){return new ma(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 i=Math.max(0,Math.min(this.radius,Math.min(this.width,this.height)/2));if(e>=this.y+i&&e<=this.y+this.height-i||t>=this.x+i&&t<=this.x+this.width-i)return!0;let s=t-(this.x+i),n=e-(this.y+i);const o=i*i;if(s*s+n*n<=o||(s=t-(this.x+this.width-i),s*s+n*n<=o)||(n=e-(this.y+this.height-i),s*s+n*n<=o)||(s=t-(this.x+i),s*s+n*n<=o))return!0}return!1}}ma.prototype.toString=function(){return`[@pixi/math:RoundedRectangle x=${this.x} y=${this.y}width=${this.width} height=${this.height} radius=${this.radius}]`};class Gt{constructor(t=1,e=0,i=0,s=1,n=0,o=0){this.array=null,this.a=t,this.b=e,this.c=i,this.d=s,this.tx=n,this.ty=o}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,i,s,n,o){return this.a=t,this.b=e,this.c=i,this.d=s,this.tx=n,this.ty=o,this}toArray(t,e){this.array||(this.array=new Float32Array(9));const i=e||this.array;return t?(i[0]=this.a,i[1]=this.b,i[2]=0,i[3]=this.c,i[4]=this.d,i[5]=0,i[6]=this.tx,i[7]=this.ty,i[8]=1):(i[0]=this.a,i[1]=this.c,i[2]=this.tx,i[3]=this.b,i[4]=this.d,i[5]=this.ty,i[6]=0,i[7]=0,i[8]=1),i}apply(t,e){e=e||new lt;const i=t.x,s=t.y;return e.x=this.a*i+this.c*s+this.tx,e.y=this.b*i+this.d*s+this.ty,e}applyInverse(t,e){e=e||new lt;const i=1/(this.a*this.d+this.c*-this.b),s=t.x,n=t.y;return e.x=this.d*i*s+-this.c*i*n+(this.ty*this.c-this.tx*this.d)*i,e.y=this.a*i*n+-this.b*i*s+(-this.ty*this.a+this.tx*this.b)*i,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),i=Math.sin(t),s=this.a,n=this.c,o=this.tx;return this.a=s*e-this.b*i,this.b=s*i+this.b*e,this.c=n*e-this.d*i,this.d=n*i+this.d*e,this.tx=o*e-this.ty*i,this.ty=o*i+this.ty*e,this}append(t){const e=this.a,i=this.b,s=this.c,n=this.d;return this.a=t.a*e+t.b*s,this.b=t.a*i+t.b*n,this.c=t.c*e+t.d*s,this.d=t.c*i+t.d*n,this.tx=t.tx*e+t.ty*s+this.tx,this.ty=t.tx*i+t.ty*n+this.ty,this}setTransform(t,e,i,s,n,o,a,h,l){return this.a=Math.cos(a+l)*n,this.b=Math.sin(a+l)*n,this.c=-Math.sin(a-h)*o,this.d=Math.cos(a-h)*o,this.tx=t-(i*this.a+s*this.c),this.ty=e-(i*this.b+s*this.d),this}prepend(t){const e=this.tx;if(t.a!==1||t.b!==0||t.c!==0||t.d!==1){const i=this.a,s=this.c;this.a=i*t.a+this.b*t.c,this.b=i*t.b+this.b*t.d,this.c=s*t.a+this.d*t.c,this.d=s*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,i=this.b,s=this.c,n=this.d,o=t.pivot,a=-Math.atan2(-s,n),h=Math.atan2(i,e),l=Math.abs(a+h);return l<1e-5||Math.abs(ca-l)<1e-5?(t.rotation=h,t.skew.x=t.skew.y=0):(t.rotation=0,t.skew.x=a,t.skew.y=h),t.scale.x=Math.sqrt(e*e+i*i),t.scale.y=Math.sqrt(s*s+n*n),t.position.x=this.tx+(o.x*e+o.y*s),t.position.y=this.ty+(o.x*i+o.y*n),t}invert(){const t=this.a,e=this.b,i=this.c,s=this.d,n=this.tx,o=t*s-e*i;return this.a=s/o,this.b=-e/o,this.c=-i/o,this.d=t/o,this.tx=(i*this.ty-s*n)/o,this.ty=-(t*this.ty-e*n)/o,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 Gt;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}static get IDENTITY(){return new Gt}static get TEMP_MATRIX(){return new Gt}}Gt.prototype.toString=function(){return`[@pixi/math:Matrix a=${this.a} b=${this.b} c=${this.c} d=${this.d} tx=${this.tx} ty=${this.ty}]`};const Hr=[1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1,0,1],Kr=[0,1,1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1],Yr=[0,-1,-1,-1,0,1,1,1,0,1,1,1,0,-1,-1,-1],zr=[1,1,0,-1,-1,-1,0,1,-1,-1,0,1,1,1,0,-1],cu=[],Hf=[],ga=Math.sign;function H1(){for(let r=0;r<16;r++){const t=[];cu.push(t);for(let e=0;e<16;e++){const i=ga(Hr[r]*Hr[e]+Yr[r]*Kr[e]),s=ga(Kr[r]*Hr[e]+zr[r]*Kr[e]),n=ga(Hr[r]*Yr[e]+Yr[r]*zr[e]),o=ga(Kr[r]*Yr[e]+zr[r]*zr[e]);for(let a=0;a<16;a++)if(Hr[a]===i&&Kr[a]===s&&Yr[a]===n&&zr[a]===o){t.push(a);break}}}for(let r=0;r<16;r++){const t=new Gt;t.set(Hr[r],Kr[r],Yr[r],zr[r],0,0),Hf.push(t)}}H1();const kt={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:r=>Hr[r],uY:r=>Kr[r],vX:r=>Yr[r],vY:r=>zr[r],inv:r=>r&8?r&15:-r&7,add:(r,t)=>cu[r][t],sub:(r,t)=>cu[r][kt.inv(t)],rotate180:r=>r^4,isVertical:r=>(r&3)===2,byDirection:(r,t)=>Math.abs(r)*2<=Math.abs(t)?t>=0?kt.S:kt.N:Math.abs(t)*2<=Math.abs(r)?r>0?kt.E:kt.W:t>0?r>0?kt.SE:kt.SW:r>0?kt.NE:kt.NW,matrixAppendRotationInv:(r,t,e=0,i=0)=>{const s=Hf[kt.inv(t)];s.tx=e,s.ty=i,r.append(s)}};class Qi{constructor(t,e,i=0,s=0){this._x=i,this._y=s,this.cb=t,this.scope=e}clone(t=this.cb,e=this.scope){return new Qi(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}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))}}Qi.prototype.toString=function(){return`[@pixi/math:ObservablePoint x=${this.x} y=${this.y} scope=${this.scope}]`};const du=class{constructor(){this.worldTransform=new Gt,this.localTransform=new Gt,this.position=new Qi(this.onChange,this,0,0),this.scale=new Qi(this.onChange,this,1,1),this.pivot=new Qi(this.onChange,this,0,0),this.skew=new Qi(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++}updateLocalTransform(){const r=this.localTransform;this._localID!==this._currentLocalID&&(r.a=this._cx*this.scale.x,r.b=this._sx*this.scale.x,r.c=this._cy*this.scale.y,r.d=this._sy*this.scale.y,r.tx=this.position.x-(this.pivot.x*r.a+this.pivot.y*r.c),r.ty=this.position.y-(this.pivot.x*r.b+this.pivot.y*r.d),this._currentLocalID=this._localID,this._parentID=-1)}updateTransform(r){const t=this.localTransform;if(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),this._parentID!==r._worldID){const e=r.worldTransform,i=this.worldTransform;i.a=t.a*e.a+t.b*e.c,i.b=t.a*e.b+t.b*e.d,i.c=t.c*e.a+t.d*e.c,i.d=t.c*e.b+t.d*e.d,i.tx=t.tx*e.a+t.ty*e.c+e.tx,i.ty=t.tx*e.b+t.ty*e.d+e.ty,this._parentID=r._worldID,this._worldID++}}setFromMatrix(r){r.decompose(this),this._localID++}get rotation(){return this._rotation}set rotation(r){this._rotation!==r&&(this._rotation=r,this.updateSkew())}};du.IDENTITY=new du;let pu=du;pu.prototype.toString=function(){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}) ]`};var K1=`varying vec2 vTextureCoord;
|
|
10
|
+
Deprecated since v${r}`),console.warn(i))),Sf[t]=!0}function ei(r){if(typeof r!="string")throw new TypeError(`Path must be a string. Received ${JSON.stringify(r)}`)}function Zn(r){return r.split("?")[0].split("#")[0]}function f1(r){return r.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function m1(r,t,e){return r.replace(new RegExp(f1(t),"g"),e)}function g1(r,t){let e="",i=0,s=-1,n=0,o=-1;for(let a=0;a<=r.length;++a){if(a<r.length)o=r.charCodeAt(a);else{if(o===47)break;o=47}if(o===47){if(!(s===a-1||n===1))if(s!==a-1&&n===2){if(e.length<2||i!==2||e.charCodeAt(e.length-1)!==46||e.charCodeAt(e.length-2)!==46){if(e.length>2){const h=e.lastIndexOf("/");if(h!==e.length-1){h===-1?(e="",i=0):(e=e.slice(0,h),i=e.length-1-e.lastIndexOf("/")),s=a,n=0;continue}}else if(e.length===2||e.length===1){e="",i=0,s=a,n=0;continue}}t&&(e.length>0?e+="/..":e="..",i=2)}else e.length>0?e+=`/${r.slice(s+1,a)}`:e=r.slice(s+1,a),i=a-s-1;s=a,n=0}else o===46&&n!==-1?++n:n=-1}return e}const Jt={toPosix(r){return m1(r,"\\","/")},isUrl(r){return/^https?:/.test(this.toPosix(r))},isDataUrl(r){return/^data:([a-z]+\/[a-z0-9-+.]+(;[a-z0-9-.!#$%*+.{}|~`]+=[a-z0-9-.!#$%*+.{}()_|~`]+)*)?(;base64)?,([a-z0-9!$&',()*+;=\-._~:@\/?%\s<>]*?)$/i.test(r)},isBlobUrl(r){return r.startsWith("blob:")},hasProtocol(r){return/^[^/:]+:/.test(this.toPosix(r))},getProtocol(r){ei(r),r=this.toPosix(r);const t=/^file:\/\/\//.exec(r);if(t)return t[0];const e=/^[^/:]+:\/{0,2}/.exec(r);return e?e[0]:""},toAbsolute(r,t,e){if(ei(r),this.isDataUrl(r)||this.isBlobUrl(r))return r;const i=Zn(this.toPosix(t??Q.ADAPTER.getBaseUrl())),s=Zn(this.toPosix(e??this.rootname(i)));return r=this.toPosix(r),r.startsWith("/")?Jt.join(s,r.slice(1)):this.isAbsolute(r)?r:this.join(i,r)},normalize(r){if(ei(r),r.length===0)return".";if(this.isDataUrl(r)||this.isBlobUrl(r))return r;r=this.toPosix(r);let t="";const e=r.startsWith("/");this.hasProtocol(r)&&(t=this.rootname(r),r=r.slice(t.length));const i=r.endsWith("/");return r=g1(r,!1),r.length>0&&i&&(r+="/"),e?`/${r}`:t+r},isAbsolute(r){return ei(r),r=this.toPosix(r),this.hasProtocol(r)?!0:r.startsWith("/")},join(...r){if(r.length===0)return".";let t;for(let e=0;e<r.length;++e){const i=r[e];if(ei(i),i.length>0)if(t===void 0)t=i;else{const s=r[e-1]??"";this.extname(s)?t+=`/../${i}`:t+=`/${i}`}}return t===void 0?".":this.normalize(t)},dirname(r){if(ei(r),r.length===0)return".";r=this.toPosix(r);let t=r.charCodeAt(0);const e=t===47;let i=-1,s=!0;const n=this.getProtocol(r),o=r;r=r.slice(n.length);for(let a=r.length-1;a>=1;--a)if(t=r.charCodeAt(a),t===47){if(!s){i=a;break}}else s=!1;return i===-1?e?"/":this.isUrl(o)?n+r:n:e&&i===1?"//":n+r.slice(0,i)},rootname(r){ei(r),r=this.toPosix(r);let t="";if(r.startsWith("/")?t="/":t=this.getProtocol(r),this.isUrl(r)){const e=r.indexOf("/",t.length);e!==-1?t=r.slice(0,e):t=r,t.endsWith("/")||(t+="/")}return t},basename(r,t){ei(r),t&&ei(t),r=Zn(this.toPosix(r));let e=0,i=-1,s=!0,n;if(t!==void 0&&t.length>0&&t.length<=r.length){if(t.length===r.length&&t===r)return"";let o=t.length-1,a=-1;for(n=r.length-1;n>=0;--n){const h=r.charCodeAt(n);if(h===47){if(!s){e=n+1;break}}else a===-1&&(s=!1,a=n+1),o>=0&&(h===t.charCodeAt(o)?--o===-1&&(i=n):(o=-1,i=a))}return e===i?i=a:i===-1&&(i=r.length),r.slice(e,i)}for(n=r.length-1;n>=0;--n)if(r.charCodeAt(n)===47){if(!s){e=n+1;break}}else i===-1&&(s=!1,i=n+1);return i===-1?"":r.slice(e,i)},extname(r){ei(r),r=Zn(this.toPosix(r));let t=-1,e=0,i=-1,s=!0,n=0;for(let o=r.length-1;o>=0;--o){const a=r.charCodeAt(o);if(a===47){if(!s){e=o+1;break}continue}i===-1&&(s=!1,i=o+1),a===46?t===-1?t=o:n!==1&&(n=1):t!==-1&&(n=-1)}return t===-1||i===-1||n===0||n===1&&t===i-1&&t===e+1?"":r.slice(t,i)},parse(r){ei(r);const t={root:"",dir:"",base:"",ext:"",name:""};if(r.length===0)return t;r=Zn(this.toPosix(r));let e=r.charCodeAt(0);const i=this.isAbsolute(r);let s;t.root=this.rootname(r),i||this.hasProtocol(r)?s=1:s=0;let n=-1,o=0,a=-1,h=!0,l=r.length-1,u=0;for(;l>=s;--l){if(e=r.charCodeAt(l),e===47){if(!h){o=l+1;break}continue}a===-1&&(h=!1,a=l+1),e===46?n===-1?n=l:u!==1&&(u=1):n!==-1&&(u=-1)}return n===-1||a===-1||u===0||u===1&&n===a-1&&n===o+1?a!==-1&&(o===0&&i?t.base=t.name=r.slice(1,a):t.base=t.name=r.slice(o,a)):(o===0&&i?(t.name=r.slice(1,n),t.base=r.slice(1,a)):(t.name=r.slice(o,n),t.base=r.slice(o,a)),t.ext=r.slice(n,a)),t.dir=this.dirname(r),t},sep:"/",delimiter:":"};let Kl;async function y1(){return Kl??(Kl=(async()=>{var n;const r=document.createElement("canvas").getContext("webgl");if(!r)return xe.UNPACK;const t=await new Promise(o=>{const a=document.createElement("video");a.onloadeddata=()=>o(a),a.onerror=()=>o(null),a.autoplay=!1,a.crossOrigin="anonymous",a.preload="auto",a.src="data:video/webm;base64,GkXfo59ChoEBQveBAULygQRC84EIQoKEd2VibUKHgQJChYECGFOAZwEAAAAAAAHTEU2bdLpNu4tTq4QVSalmU6yBoU27i1OrhBZUrmtTrIHGTbuMU6uEElTDZ1OsggEXTbuMU6uEHFO7a1OsggG97AEAAAAAAABZAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAVSalmoCrXsYMPQkBNgIRMYXZmV0GETGF2ZkSJiEBEAAAAAAAAFlSua8yuAQAAAAAAAEPXgQFzxYgAAAAAAAAAAZyBACK1nIN1bmSIgQCGhVZfVlA5g4EBI+ODhAJiWgDglLCBArqBApqBAlPAgQFVsIRVuYEBElTDZ9Vzc9JjwItjxYgAAAAAAAAAAWfInEWjh0VOQ09ERVJEh49MYXZjIGxpYnZweC12cDlnyKJFo4hEVVJBVElPTkSHlDAwOjAwOjAwLjA0MDAwMDAwMAAAH0O2dcfngQCgwqGggQAAAIJJg0IAABAAFgA4JBwYSgAAICAAEb///4r+AAB1oZ2mm+6BAaWWgkmDQgAAEAAWADgkHBhKAAAgIABIQBxTu2uRu4+zgQC3iveBAfGCAXHwgQM=",a.load()});if(!t)return xe.UNPACK;const e=r.createTexture();r.bindTexture(r.TEXTURE_2D,e);const i=r.createFramebuffer();r.bindFramebuffer(r.FRAMEBUFFER,i),r.framebufferTexture2D(r.FRAMEBUFFER,r.COLOR_ATTACHMENT0,r.TEXTURE_2D,e,0),r.pixelStorei(r.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),r.pixelStorei(r.UNPACK_COLORSPACE_CONVERSION_WEBGL,r.NONE),r.texImage2D(r.TEXTURE_2D,0,r.RGBA,r.RGBA,r.UNSIGNED_BYTE,t);const s=new Uint8Array(4);return r.readPixels(0,0,1,1,r.RGBA,r.UNSIGNED_BYTE,s),r.deleteFramebuffer(i),r.deleteTexture(e),(n=r.getExtension("WEBGL_lose_context"))==null||n.loseContext(),s[0]<=s[3]?xe.PMA:xe.UNPACK})()),Kl}let Yl;function b1(){return typeof Yl>"u"&&(Yl=function(){var t;const r={stencil:!0,failIfMajorPerformanceCaveat:Q.FAIL_IF_MAJOR_PERFORMANCE_CAVEAT};try{if(!Q.ADAPTER.getWebGLRenderingContext())return!1;const e=Q.ADAPTER.createCanvas();let i=e.getContext("webgl",r)||e.getContext("experimental-webgl",r);const s=!!((t=i==null?void 0:i.getContextAttributes())!=null&&t.stencil);if(i){const n=i.getExtension("WEBGL_lose_context");n&&n.loseContext()}return i=null,s}catch{return!1}}()),Yl}var x1={grad:.9,turn:360,rad:360/(2*Math.PI)},$i=function(r){return typeof r=="string"?r.length>0:typeof r=="number"},ee=function(r,t,e){return t===void 0&&(t=0),e===void 0&&(e=Math.pow(10,t)),Math.round(e*r)/e+0},Xe=function(r,t,e){return t===void 0&&(t=0),e===void 0&&(e=1),r>e?e:r>t?r:t},Ef=function(r){return(r=isFinite(r)?r%360:0)>0?r:r+360},Cf=function(r){return{r:Xe(r.r,0,255),g:Xe(r.g,0,255),b:Xe(r.b,0,255),a:Xe(r.a)}},zl=function(r){return{r:ee(r.r),g:ee(r.g),b:ee(r.b),a:ee(r.a,3)}},_1=/^#([0-9a-f]{3,8})$/i,ha=function(r){var t=r.toString(16);return t.length<2?"0"+t:t},If=function(r){var t=r.r,e=r.g,i=r.b,s=r.a,n=Math.max(t,e,i),o=n-Math.min(t,e,i),a=o?n===t?(e-i)/o:n===e?2+(i-t)/o:4+(t-e)/o:0;return{h:60*(a<0?a+6:a),s:n?o/n*100:0,v:n/255*100,a:s}},Af=function(r){var t=r.h,e=r.s,i=r.v,s=r.a;t=t/360*6,e/=100,i/=100;var n=Math.floor(t),o=i*(1-e),a=i*(1-(t-n)*e),h=i*(1-(1-t+n)*e),l=n%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:s}},Mf=function(r){return{h:Ef(r.h),s:Xe(r.s,0,100),l:Xe(r.l,0,100),a:Xe(r.a)}},Rf=function(r){return{h:ee(r.h),s:ee(r.s),l:ee(r.l),a:ee(r.a,3)}},Pf=function(r){return Af((e=(t=r).s,{h:t.h,s:(e*=((i=t.l)<50?i:100-i)/100)>0?2*e/(i+e)*100:0,v:i+e,a:t.a}));var t,e,i},Vn=function(r){return{h:(t=If(r)).h,s:(s=(200-(e=t.s))*(i=t.v)/100)>0&&s<200?e*i/100/(s<=100?s:200-s)*100:0,l:s/2,a:t.a};var t,e,i,s},v1=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,T1=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,w1=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,S1=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,jl={string:[[function(r){var t=_1.exec(r);return t?(r=t[1]).length<=4?{r:parseInt(r[0]+r[0],16),g:parseInt(r[1]+r[1],16),b:parseInt(r[2]+r[2],16),a:r.length===4?ee(parseInt(r[3]+r[3],16)/255,2):1}:r.length===6||r.length===8?{r:parseInt(r.substr(0,2),16),g:parseInt(r.substr(2,2),16),b:parseInt(r.substr(4,2),16),a:r.length===8?ee(parseInt(r.substr(6,2),16)/255,2):1}:null:null},"hex"],[function(r){var t=w1.exec(r)||S1.exec(r);return t?t[2]!==t[4]||t[4]!==t[6]?null:Cf({r:Number(t[1])/(t[2]?100/255:1),g:Number(t[3])/(t[4]?100/255:1),b:Number(t[5])/(t[6]?100/255:1),a:t[7]===void 0?1:Number(t[7])/(t[8]?100:1)}):null},"rgb"],[function(r){var t=v1.exec(r)||T1.exec(r);if(!t)return null;var e,i,s=Mf({h:(e=t[1],i=t[2],i===void 0&&(i="deg"),Number(e)*(x1[i]||1)),s:Number(t[3]),l:Number(t[4]),a:t[5]===void 0?1:Number(t[5])/(t[6]?100:1)});return Pf(s)},"hsl"]],object:[[function(r){var t=r.r,e=r.g,i=r.b,s=r.a,n=s===void 0?1:s;return $i(t)&&$i(e)&&$i(i)?Cf({r:Number(t),g:Number(e),b:Number(i),a:Number(n)}):null},"rgb"],[function(r){var t=r.h,e=r.s,i=r.l,s=r.a,n=s===void 0?1:s;if(!$i(t)||!$i(e)||!$i(i))return null;var o=Mf({h:Number(t),s:Number(e),l:Number(i),a:Number(n)});return Pf(o)},"hsl"],[function(r){var t=r.h,e=r.s,i=r.v,s=r.a,n=s===void 0?1:s;if(!$i(t)||!$i(e)||!$i(i))return null;var o=function(a){return{h:Ef(a.h),s:Xe(a.s,0,100),v:Xe(a.v,0,100),a:Xe(a.a)}}({h:Number(t),s:Number(e),v:Number(i),a:Number(n)});return Af(o)},"hsv"]]},Lf=function(r,t){for(var e=0;e<t.length;e++){var i=t[e][0](r);if(i)return[i,t[e][1]]}return[null,void 0]},E1=function(r){return typeof r=="string"?Lf(r.trim(),jl.string):typeof r=="object"&&r!==null?Lf(r,jl.object):[null,void 0]},Jl=function(r,t){var e=Vn(r);return{h:e.h,s:Xe(e.s+100*t,0,100),l:e.l,a:e.a}},$l=function(r){return(299*r.r+587*r.g+114*r.b)/1e3/255},Gf=function(r,t){var e=Vn(r);return{h:e.h,s:e.s,l:Xe(e.l+100*t,0,100),a:e.a}},Ql=function(){function r(t){this.parsed=E1(t)[0],this.rgba=this.parsed||{r:0,g:0,b:0,a:1}}return r.prototype.isValid=function(){return this.parsed!==null},r.prototype.brightness=function(){return ee($l(this.rgba),2)},r.prototype.isDark=function(){return $l(this.rgba)<.5},r.prototype.isLight=function(){return $l(this.rgba)>=.5},r.prototype.toHex=function(){return t=zl(this.rgba),e=t.r,i=t.g,s=t.b,o=(n=t.a)<1?ha(ee(255*n)):"","#"+ha(e)+ha(i)+ha(s)+o;var t,e,i,s,n,o},r.prototype.toRgb=function(){return zl(this.rgba)},r.prototype.toRgbString=function(){return t=zl(this.rgba),e=t.r,i=t.g,s=t.b,(n=t.a)<1?"rgba("+e+", "+i+", "+s+", "+n+")":"rgb("+e+", "+i+", "+s+")";var t,e,i,s,n},r.prototype.toHsl=function(){return Rf(Vn(this.rgba))},r.prototype.toHslString=function(){return t=Rf(Vn(this.rgba)),e=t.h,i=t.s,s=t.l,(n=t.a)<1?"hsla("+e+", "+i+"%, "+s+"%, "+n+")":"hsl("+e+", "+i+"%, "+s+"%)";var t,e,i,s,n},r.prototype.toHsv=function(){return t=If(this.rgba),{h:ee(t.h),s:ee(t.s),v:ee(t.v),a:ee(t.a,3)};var t},r.prototype.invert=function(){return Ti({r:255-(t=this.rgba).r,g:255-t.g,b:255-t.b,a:t.a});var t},r.prototype.saturate=function(t){return t===void 0&&(t=.1),Ti(Jl(this.rgba,t))},r.prototype.desaturate=function(t){return t===void 0&&(t=.1),Ti(Jl(this.rgba,-t))},r.prototype.grayscale=function(){return Ti(Jl(this.rgba,-1))},r.prototype.lighten=function(t){return t===void 0&&(t=.1),Ti(Gf(this.rgba,t))},r.prototype.darken=function(t){return t===void 0&&(t=.1),Ti(Gf(this.rgba,-t))},r.prototype.rotate=function(t){return t===void 0&&(t=15),this.hue(this.hue()+t)},r.prototype.alpha=function(t){return typeof t=="number"?Ti({r:(e=this.rgba).r,g:e.g,b:e.b,a:t}):ee(this.rgba.a,3);var e},r.prototype.hue=function(t){var e=Vn(this.rgba);return typeof t=="number"?Ti({h:t,s:e.s,l:e.l,a:e.a}):ee(e.h)},r.prototype.isEqual=function(t){return this.toHex()===Ti(t).toHex()},r}(),Ti=function(r){return r instanceof Ql?r:new Ql(r)},Nf=[],C1=function(r){r.forEach(function(t){Nf.indexOf(t)<0&&(t(Ql,jl),Nf.push(t))})};function I1(r,t){var e={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 s in e)i[e[s]]=s;var n={};r.prototype.toName=function(o){if(!(this.rgba.a||this.rgba.r||this.rgba.g||this.rgba.b))return"transparent";var a,h,l=i[this.toHex()];if(l)return l;if(o!=null&&o.closest){var u=this.toRgb(),c=1/0,d="black";if(!n.length)for(var p in e)n[p]=new r(e[p]).toRgb();for(var m in e){var f=(a=u,h=n[m],Math.pow(a.r-h.r,2)+Math.pow(a.g-h.g,2)+Math.pow(a.b-h.b,2));f<c&&(c=f,d=m)}return d}},t.string.push([function(o){var a=o.toLowerCase(),h=a==="transparent"?"#0000":e[a];return h?new r(h).toRgb():null},"name"])}C1([I1]);const Ws=class sl{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 sl)this._value=this.cloneSource(t._value),this._int=t._int,this._components.set(t._components);else{if(t===null)throw new Error("Cannot set PIXI.Color#value to null");(this._value===null||!this.isSourceEqual(this._value,t))&&(this.normalize(t),this._value=this.cloneSource(t))}}get value(){return this._value}cloneSource(t){return typeof t=="string"||typeof t=="number"||t instanceof Number||t===null?t:Array.isArray(t)||ArrayBuffer.isView(t)?t.slice(0):typeof t=="object"&&t!==null?{...t}:t}isSourceEqual(t,e){const i=typeof t;if(i!==typeof e)return!1;if(i==="number"||i==="string"||t instanceof Number)return t===e;if(Array.isArray(t)&&Array.isArray(e)||ArrayBuffer.isView(t)&&ArrayBuffer.isView(e))return t.length!==e.length?!1:t.every((s,n)=>s===e[n]);if(t!==null&&e!==null){const s=Object.keys(t),n=Object.keys(e);return s.length!==n.length?!1:s.every(o=>t[o]===e[o])}return t===e}toRgba(){const[t,e,i,s]=this._components;return{r:t,g:e,b:i,a:s}}toRgb(){const[t,e,i]=this._components;return{r:t,g:e,b:i}}toRgbaString(){const[t,e,i]=this.toUint8RgbArray();return`rgba(${t},${e},${i},${this.alpha})`}toUint8RgbArray(t){const[e,i,s]=this._components;return t=t??[],t[0]=Math.round(e*255),t[1]=Math.round(i*255),t[2]=Math.round(s*255),t}toRgbArray(t){t=t??[];const[e,i,s]=this._components;return t[0]=e,t[1]=i,t[2]=s,t}toNumber(){return this._int}toLittleEndianNumber(){const t=this._int;return(t>>16)+(t&65280)+((t&255)<<16)}multiply(t){const[e,i,s,n]=sl.temp.setValue(t)._components;return this._components[0]*=e,this._components[1]*=i,this._components[2]*=s,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(t===1)return(255<<24)+this._int;if(t===0)return e?0:this._int;let i=this._int>>16&255,s=this._int>>8&255,n=this._int&255;return e&&(i=i*t+.5|0,s=s*t+.5|0,n=n*t+.5|0),(t*255<<24)+(i<<16)+(s<<8)+n}toHex(){const t=this._int.toString(16);return`#${"000000".substring(0,6-t.length)+t}`}toHexa(){const t=Math.round(this._components[3]*255).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,i,s]=this._components;return this._components[0]=Math.round(e*t)/t,this._components[1]=Math.round(i*t)/t,this._components[2]=Math.round(s*t)/t,this.refreshInt(),this._value=null,this}toArray(t){t=t??[];const[e,i,s,n]=this._components;return t[0]=e,t[1]=i,t[2]=s,t[3]=n,t}normalize(t){let e,i,s,n;if((typeof t=="number"||t instanceof Number)&&t>=0&&t<=16777215){const o=t;e=(o>>16&255)/255,i=(o>>8&255)/255,s=(o&255)/255,n=1}else if((Array.isArray(t)||t instanceof Float32Array)&&t.length>=3&&t.length<=4)t=this._clamp(t),[e,i,s,n=1]=t;else if((t instanceof Uint8Array||t instanceof Uint8ClampedArray)&&t.length>=3&&t.length<=4)t=this._clamp(t,0,255),[e,i,s,n=255]=t,e/=255,i/=255,s/=255,n/=255;else if(typeof t=="string"||typeof t=="object"){if(typeof t=="string"){const a=sl.HEX_PATTERN.exec(t);a&&(t=`#${a[2]}`)}const o=Ti(t);o.isValid()&&({r:e,g:i,b:s,a:n}=o.rgba,e/=255,i/=255,s/=255)}if(e!==void 0)this._components[0]=e,this._components[1]=i,this._components[2]=s,this._components[3]=n,this.refreshInt();else throw new Error(`Unable to convert color ${t}`)}refreshInt(){this._clamp(this._components);const[t,e,i]=this._components;this._int=(t*255<<16)+(e*255<<8)+(i*255|0)}_clamp(t,e=0,i=1){return typeof t=="number"?Math.min(Math.max(t,e),i):(t.forEach((s,n)=>{t[n]=Math.min(Math.max(s,e),i)}),t)}};Ws.shared=new Ws,Ws.temp=new Ws,Ws.HEX_PATTERN=/^(#|0x)?(([a-f0-9]{3}){1,2}([a-f0-9]{2})?)$/i;let Gt=Ws;function A1(r){return vt("7.2.0","utils.hex2string is deprecated, use Color#toHex instead"),Gt.shared.setValue(r).toHex()}function M1(r){return vt("7.2.0","utils.rgb2hex is deprecated, use Color#toNumber instead"),Gt.shared.setValue(r).toNumber()}function R1(){const r=[],t=[];for(let i=0;i<32;i++)r[i]=i,t[i]=i;r[ut.NORMAL_NPM]=ut.NORMAL,r[ut.ADD_NPM]=ut.ADD,r[ut.SCREEN_NPM]=ut.SCREEN,t[ut.NORMAL]=ut.NORMAL_NPM,t[ut.ADD]=ut.ADD_NPM,t[ut.SCREEN]=ut.SCREEN_NPM;const e=[];return e.push(t),e.push(r),e}const Ff=R1();function Df(r,t){return Ff[t?1:0][r]}function P1(r,t=null){const e=r*6;if(t=t||new Uint16Array(e),t.length!==e)throw new Error(`Out buffer length is incorrect, got ${t.length} and expected ${e}`);for(let i=0,s=0;i<e;i+=6,s+=4)t[i+0]=s+0,t[i+1]=s+1,t[i+2]=s+2,t[i+3]=s+0,t[i+4]=s+2,t[i+5]=s+3;return t}function kf(r){if(r.BYTES_PER_ELEMENT===4)return r instanceof Float32Array?"Float32Array":r instanceof Uint32Array?"Uint32Array":"Int32Array";if(r.BYTES_PER_ELEMENT===2){if(r instanceof Uint16Array)return"Uint16Array"}else if(r.BYTES_PER_ELEMENT===1&&r instanceof Uint8Array)return"Uint8Array";return null}function la(r){return r+=r===0?1:0,--r,r|=r>>>1,r|=r>>>2,r|=r>>>4,r|=r>>>8,r|=r>>>16,r+1}function Of(r){return!(r&r-1)&&!!r}function Bf(r){let t=(r>65535?1:0)<<4;r>>>=t;let e=(r>255?1:0)<<3;return r>>>=e,t|=e,e=(r>15?1:0)<<2,r>>>=e,t|=e,e=(r>3?1:0)<<1,r>>>=e,t|=e,t|r>>1}function Us(r,t,e){const i=r.length;let s;if(t>=i||e===0)return;e=t+e>i?i-t:e;const n=i-e;for(s=t;s<n;++s)r[s]=r[s+e];r.length=n}function yr(r){return r===0?0:r<0?-1:1}let L1=0;function Kr(){return++L1}const ql=class{constructor(r,t,e,i){this.left=r,this.top=t,this.right=e,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}};ql.EMPTY=new ql(0,0,0,0);let Wf=ql;const Uf={},wi=Object.create(null),br=Object.create(null);class G1{constructor(t,e,i){this._canvas=Q.ADAPTER.createCanvas(),this._context=this._canvas.getContext("2d"),this.resolution=i||Q.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(this._canvas===null)throw new TypeError("The CanvasRenderTarget has already been destroyed")}}function Xf(r,t,e){for(let i=0,s=4*e*t;i<t;++i,s+=4)if(r[s+3]!==0)return!1;return!0}function Zf(r,t,e,i,s){const n=4*t;for(let o=i,a=i*n+4*e;o<=s;++o,a+=n)if(r[a+3]!==0)return!1;return!0}function N1(r){const{width:t,height:e}=r,i=r.getContext("2d",{willReadFrequently:!0});if(i===null)throw new TypeError("Failed to get canvas 2D context");const s=i.getImageData(0,0,t,e).data;let n=0,o=0,a=t-1,h=e-1;for(;o<e&&Xf(s,t,o);)++o;if(o===e)return Wf.EMPTY;for(;Xf(s,t,h);)--h;for(;Zf(s,t,n,o,h);)++n;for(;Zf(s,t,a,o,h);)--a;return++a,++h,new Wf(n,o,a,h)}function F1(r){const t=N1(r),{width:e,height:i}=t;let s=null;if(!t.isEmpty()){const n=r.getContext("2d");if(n===null)throw new TypeError("Failed to get canvas 2D context");s=n.getImageData(t.left,t.top,e,i)}return{width:e,height:i,data:s}}function D1(r,t=globalThis.location){if(r.startsWith("data:"))return"";t=t||globalThis.location;const e=new URL(r,document.baseURI);return e.hostname!==t.hostname||e.port!==t.port||e.protocol!==t.protocol?"anonymous":""}function Qi(r,t=1){var i;const e=(i=Q.RETINA_PREFIX)==null?void 0:i.exec(r);return e?parseFloat(e[1]):t}var J=(r=>(r.Renderer="renderer",r.Application="application",r.RendererSystem="renderer-webgl-system",r.RendererPlugin="renderer-webgl-plugin",r.CanvasRendererSystem="renderer-canvas-system",r.CanvasRendererPlugin="renderer-canvas-plugin",r.Asset="asset",r.LoadParser="load-parser",r.ResolveParser="resolve-parser",r.CacheParser="cache-parser",r.DetectionParser="detection-parser",r))(J||{});const tu=r=>{if(typeof r=="function"||typeof r=="object"&&r.extension){if(!r.extension)throw new Error("Extension class must have an extension object");r={...typeof r.extension!="object"?{type:r.extension}:r.extension,ref:r}}if(typeof r=="object")r={...r};else throw new Error("Invalid extension type");return typeof r.type=="string"&&(r.type=[r.type]),r},Vf=(r,t)=>tu(r).priority??t,et={_addHandlers:{},_removeHandlers:{},_queue:{},remove(...r){return r.map(tu).forEach(t=>{t.type.forEach(e=>{var i,s;return(s=(i=this._removeHandlers)[e])==null?void 0:s.call(i,t)})}),this},add(...r){return r.map(tu).forEach(t=>{t.type.forEach(e=>{const i=this._addHandlers,s=this._queue;i[e]?i[e](t):(s[e]=s[e]||[],s[e].push(t))})}),this},handle(r,t,e){const i=this._addHandlers,s=this._removeHandlers;if(i[r]||s[r])throw new Error(`Extension type ${r} already has a handler`);i[r]=t,s[r]=e;const n=this._queue;return n[r]&&(n[r].forEach(o=>t(o)),delete n[r]),this},handleByMap(r,t){return this.handle(r,e=>{t[e.name]=e.ref},e=>{delete t[e.name]})},handleByList(r,t,e=-1){return this.handle(r,i=>{t.includes(i.ref)||(t.push(i.ref),t.sort((s,n)=>Vf(n,e)-Vf(s,e)))},i=>{const s=t.indexOf(i.ref);s!==-1&&t.splice(s,1)})}};class eu{constructor(t){typeof t=="number"?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 k1=["precision mediump float;","void main(void){","float test = 0.1;","%forloop%","gl_FragColor = vec4(0.0);","}"].join(`
|
|
11
|
+
`);function O1(r){let t="";for(let e=0;e<r;++e)e>0&&(t+=`
|
|
12
|
+
else `),e<r-1&&(t+=`if(test == ${e}.0){}`);return t}function B1(r,t){if(r===0)throw new Error("Invalid value of `0` passed to `checkMaxIfStatementsInShader`");const e=t.createShader(t.FRAGMENT_SHADER);for(;;){const i=k1.replace(/%forloop%/gi,O1(r));if(t.shaderSource(e,i),t.compileShader(e),!t.getShaderParameter(e,t.COMPILE_STATUS))r=r/2|0;else break}return r}const iu=0,ru=1,su=2,nu=3,ou=4,au=5;class Si{constructor(){this.data=0,this.blendMode=ut.NORMAL,this.polygonOffset=0,this.blend=!0,this.depthMask=!0}get blend(){return!!(this.data&1<<iu)}set blend(t){!!(this.data&1<<iu)!==t&&(this.data^=1<<iu)}get offsets(){return!!(this.data&1<<ru)}set offsets(t){!!(this.data&1<<ru)!==t&&(this.data^=1<<ru)}get culling(){return!!(this.data&1<<su)}set culling(t){!!(this.data&1<<su)!==t&&(this.data^=1<<su)}get depthTest(){return!!(this.data&1<<nu)}set depthTest(t){!!(this.data&1<<nu)!==t&&(this.data^=1<<nu)}get depthMask(){return!!(this.data&1<<au)}set depthMask(t){!!(this.data&1<<au)!==t&&(this.data^=1<<au)}get clockwiseFrontFace(){return!!(this.data&1<<ou)}set clockwiseFrontFace(t){!!(this.data&1<<ou)!==t&&(this.data^=1<<ou)}get blendMode(){return this._blendMode}set blendMode(t){this.blend=t!==ut.NONE,this._blendMode=t}get polygonOffset(){return this._polygonOffset}set polygonOffset(t){this.offsets=!!t,this._polygonOffset=t}static for2d(){const t=new Si;return t.depthTest=!1,t.blend=!0,t}}Si.prototype.toString=function(){return`[@pixi/core:State blendMode=${this.blendMode} clockwiseFrontFace=${this.clockwiseFrontFace} culling=${this.culling} depthMask=${this.depthMask} polygonOffset=${this.polygonOffset}]`};const hu=[];function Hf(r,t){if(!r)return null;let e="";if(typeof r=="string"){const i=/\.(\w{3,4})(?:$|\?|#)/i.exec(r);i&&(e=i[1].toLowerCase())}for(let i=hu.length-1;i>=0;--i){const s=hu[i];if(s.test&&s.test(r,e))return new s(r,t)}throw new Error("Unrecognized source type to auto-detect Resource")}class ii{constructor(t){this.items=[],this._name=t,this._aliasCount=0}emit(t,e,i,s,n,o,a,h){if(arguments.length>8)throw new Error("max arguments reached");const{name:l,items:u}=this;this._aliasCount++;for(let c=0,d=u.length;c<d;c++)u[c][l](t,e,i,s,n,o,a,h);return u===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 e!==-1&&(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 this.items.length===0}get name(){return this._name}}Object.defineProperties(ii.prototype,{dispatch:{value:ii.prototype.emit},run:{value:ii.prototype.emit}});class Hn{constructor(t=0,e=0){this._width=t,this._height=e,this.destroyed=!1,this.internal=!1,this.onResize=new ii("setRealSize"),this.onUpdate=new ii("update"),this.onError=new ii("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,i){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 ua extends Hn{constructor(t,e){const{width:i,height:s}=e||{};if(!i||!s)throw new Error("BufferResource width or height invalid");super(i,s),this.data=t,this.unpackAlignment=e.unpackAlignment??4}upload(t,e,i){const s=t.gl;s.pixelStorei(s.UNPACK_ALIGNMENT,this.unpackAlignment),s.pixelStorei(s.UNPACK_PREMULTIPLY_ALPHA_WEBGL,e.alphaMode===xe.UNPACK);const n=e.realWidth,o=e.realHeight;return i.width===n&&i.height===o?s.texSubImage2D(e.target,0,0,0,n,o,e.format,i.type,this.data):(i.width=n,i.height=o,s.texImage2D(e.target,0,i.internalFormat,n,o,0,e.format,i.type,this.data)),!0}dispose(){this.data=null}static test(t){return t===null||t instanceof Int8Array||t instanceof Uint8Array||t instanceof Uint8ClampedArray||t instanceof Int16Array||t instanceof Uint16Array||t instanceof Int32Array||t instanceof Uint32Array||t instanceof Float32Array}}const W1={scaleMode:Hi.NEAREST,alphaMode:xe.NPM},lu=class An extends Nn{constructor(t=null,e=null){super(),e=Object.assign({},An.defaultOptions,e);const{alphaMode:i,mipmap:s,anisotropicLevel:n,scaleMode:o,width:a,height:h,wrapMode:l,format:u,type:c,target:d,resolution:p,resourceOptions:m}=e;t&&!(t instanceof Hn)&&(t=Hf(t,m),t.internal=!0),this.resolution=p||Q.RESOLUTION,this.width=Math.round((a||0)*this.resolution)/this.resolution,this.height=Math.round((h||0)*this.resolution)/this.resolution,this._mipmap=s,this.anisotropicLevel=n,this._wrapMode=l,this._scaleMode=o,this.format=u,this.type=c,this.target=d,this.alphaMode=i,this.uid=Kr(),this.touched=0,this.isPowerOfTwo=!1,this._refreshPOT(),this._glTextures={},this.dirtyId=0,this.dirtyStyleId=0,this.cacheId=null,this.valid=a>0&&h>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 i;return t!==void 0&&t!==this.scaleMode&&(this.scaleMode=t,i=!0),e!==void 0&&e!==this.mipmap&&(this.mipmap=e,i=!0),i&&this.dirtyStyleId++,this}setSize(t,e,i){return i=i||this.resolution,this.setRealSize(t*i,e*i,i)}setRealSize(t,e,i){return this.resolution=i||this.resolution,this.width=Math.round(t)/this.resolution,this.height=Math.round(e)/this.resolution,this._refreshPOT(),this.update(),this}_refreshPOT(){this.isPowerOfTwo=Of(this.realWidth)&&Of(this.realHeight)}setResolution(t){const e=this.resolution;return e===t?this:(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 br[this.cacheId],delete wi[this.cacheId],this.cacheId=null),this.valid=!1,this.dispose(),An.removeFromCache(this),this.textureCacheIds=null,this.destroyed=!0,this.emit("destroyed",this),this.removeAllListeners()}dispose(){this.emit("dispose",this)}castToBaseTexture(){return this}static from(t,e,i=Q.STRICT_TEXTURE_CACHE){const s=typeof t=="string";let n=null;if(s)n=t;else{if(!t._pixiId){const a=(e==null?void 0:e.pixiIdPrefix)||"pixiid";t._pixiId=`${a}_${Kr()}`}n=t._pixiId}let o=br[n];if(s&&i&&!o)throw new Error(`The cacheId "${n}" does not exist in BaseTextureCache.`);return o||(o=new An(t,e),o.cacheId=n,An.addToCache(o,n)),o}static fromBuffer(t,e,i,s){t=t||new Float32Array(e*i*4);const n=new ua(t,{width:e,height:i,...s==null?void 0:s.resourceOptions});let o,a;return t instanceof Float32Array?(o=K.RGBA,a=at.FLOAT):t instanceof Int32Array?(o=K.RGBA_INTEGER,a=at.INT):t instanceof Uint32Array?(o=K.RGBA_INTEGER,a=at.UNSIGNED_INT):t instanceof Int16Array?(o=K.RGBA_INTEGER,a=at.SHORT):t instanceof Uint16Array?(o=K.RGBA_INTEGER,a=at.UNSIGNED_SHORT):t instanceof Int8Array?(o=K.RGBA,a=at.BYTE):(o=K.RGBA,a=at.UNSIGNED_BYTE),n.internal=!0,new An(n,Object.assign({},W1,{type:a,format:o},s))}static addToCache(t,e){e&&(t.textureCacheIds.includes(e)||t.textureCacheIds.push(e),br[e]&&br[e]!==t&&console.warn(`BaseTexture added to the cache with an id [${e}] that already had an entry`),br[e]=t)}static removeFromCache(t){if(typeof t=="string"){const e=br[t];if(e){const i=e.textureCacheIds.indexOf(t);return i>-1&&e.textureCacheIds.splice(i,1),delete br[t],e}}else if(t!=null&&t.textureCacheIds){for(let e=0;e<t.textureCacheIds.length;++e)delete br[t.textureCacheIds[e]];return t.textureCacheIds.length=0,t}return null}};lu.defaultOptions={mipmap:yi.POW2,anisotropicLevel:0,scaleMode:Hi.LINEAR,wrapMode:Ki.CLAMP,alphaMode:xe.UNPACK,target:Ms.TEXTURE_2D,format:K.RGBA,type:at.UNSIGNED_BYTE},lu._globalBatch=0;let ft=lu;class uu{constructor(){this.texArray=null,this.blend=0,this.type=gi.TRIANGLES,this.start=0,this.size=0,this.data=null}}let U1=0;class Ht{constructor(t,e=!0,i=!1){this.data=t||new Float32Array(1),this._glBuffers={},this._updateID=0,this.index=i,this.static=e,this.id=U1++,this.disposeRunner=new ii("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?xi.ELEMENT_ARRAY_BUFFER:xi.ARRAY_BUFFER}get index(){return this.type===xi.ELEMENT_ARRAY_BUFFER}static from(t){return t instanceof Array&&(t=new Float32Array(t)),new Ht(t)}}class ca{constructor(t,e=0,i=!1,s=at.FLOAT,n,o,a,h=1){this.buffer=t,this.size=e,this.normalized=i,this.type=s,this.stride=n,this.start=o,this.instance=a,this.divisor=h}destroy(){this.buffer=null}static from(t,e,i,s,n){return new ca(t,e,i,s,n)}}const X1={Float32Array,Uint32Array,Int32Array,Uint8Array};function Z1(r,t){let e=0,i=0;const s={};for(let h=0;h<r.length;h++)i+=t[h],e+=r[h].length;const n=new ArrayBuffer(e*4);let o=null,a=0;for(let h=0;h<r.length;h++){const l=t[h],u=r[h],c=kf(u);s[c]||(s[c]=new X1[c](n)),o=s[c];for(let d=0;d<u.length;d++){const p=(d/l|0)*i+a,m=d%l;o[p+m]=u[d]}a+=l}return new Float32Array(n)}const Kf={5126:4,5123:2,5121:1};let V1=0;const H1={Float32Array,Uint32Array,Int32Array,Uint8Array,Uint16Array};class xr{constructor(t=[],e={}){this.buffers=t,this.indexBuffer=null,this.attributes=e,this.glVertexArrayObjects={},this.id=V1++,this.instanced=!1,this.instanceCount=1,this.disposeRunner=new ii("disposeGeometry"),this.refCount=0}addAttribute(t,e,i=0,s=!1,n,o,a,h=!1){if(!e)throw new Error("You must pass a buffer when creating an attribute");e instanceof Ht||(e instanceof Array&&(e=new Float32Array(e)),e=new Ht(e));const l=t.split("|");if(l.length>1){for(let c=0;c<l.length;c++)this.addAttribute(l[c],e,i,s,n);return this}let u=this.buffers.indexOf(e);return u===-1&&(this.buffers.push(e),u=this.buffers.length-1),this.attributes[t]=new ca(u,i,s,n,o,a,h),this.instanced=this.instanced||h,this}getAttribute(t){return this.attributes[t]}getBuffer(t){return this.buffers[this.getAttribute(t).buffer]}addIndex(t){return t instanceof Ht||(t instanceof Array&&(t=new Uint16Array(t)),t=new Ht(t)),t.type=xi.ELEMENT_ARRAY_BUFFER,this.indexBuffer=t,this.buffers.includes(t)||this.buffers.push(t),this}getIndex(){return this.indexBuffer}interleave(){if(this.buffers.length===1||this.buffers.length===2&&this.indexBuffer)return this;const t=[],e=[],i=new Ht;let s;for(s in this.attributes){const n=this.attributes[s],o=this.buffers[n.buffer];t.push(o.data),e.push(n.size*Kf[n.type]/4),n.buffer=0}for(i.data=Z1(t,e),s=0;s<this.buffers.length;s++)this.buffers[s]!==this.indexBuffer&&this.buffers[s].destroy();return this.buffers=[i],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 xr;for(let e=0;e<this.buffers.length;e++)t.buffers[e]=new Ht(this.buffers[e].data.slice(0));for(const e in this.attributes){const i=this.attributes[e];t.attributes[e]=new ca(i.buffer,i.size,i.normalized,i.type,i.stride,i.start,i.instance)}return this.indexBuffer&&(t.indexBuffer=t.buffers[this.buffers.indexOf(this.indexBuffer)],t.indexBuffer.type=xi.ELEMENT_ARRAY_BUFFER),t}static merge(t){const e=new xr,i=[],s=[],n=[];let o;for(let a=0;a<t.length;a++){o=t[a];for(let h=0;h<o.buffers.length;h++)s[h]=s[h]||0,s[h]+=o.buffers[h].data.length,n[h]=0}for(let a=0;a<o.buffers.length;a++)i[a]=new H1[kf(o.buffers[a].data)](s[a]),e.buffers[a]=new Ht(i[a]);for(let a=0;a<t.length;a++){o=t[a];for(let h=0;h<o.buffers.length;h++)i[h].set(o.buffers[h].data,n[h]),n[h]+=o.buffers[h].data.length}if(e.attributes=o.attributes,o.indexBuffer){e.indexBuffer=e.buffers[o.buffers.indexOf(o.indexBuffer)],e.indexBuffer.type=xi.ELEMENT_ARRAY_BUFFER;let a=0,h=0,l=0,u=0;for(let c=0;c<o.buffers.length;c++)if(o.buffers[c]!==o.indexBuffer){u=c;break}for(const c in o.attributes){const d=o.attributes[c];(d.buffer|0)===u&&(h+=d.size*Kf[d.type]/4)}for(let c=0;c<t.length;c++){const d=t[c].indexBuffer.data;for(let p=0;p<d.length;p++)e.indexBuffer.data[p+l]+=a;a+=t[c].buffers[u].data.length/h,l+=d.length}}return e}}class Yf extends xr{constructor(t=!1){super(),this._buffer=new Ht(null,t,!1),this._indexBuffer=new Ht(null,t,!0),this.addAttribute("aVertexPosition",this._buffer,2,!1,at.FLOAT).addAttribute("aTextureCoord",this._buffer,2,!1,at.FLOAT).addAttribute("aColor",this._buffer,4,!0,at.UNSIGNED_BYTE).addAttribute("aTextureId",this._buffer,1,!0,at.FLOAT).addIndex(this._indexBuffer)}}const da=Math.PI*2,K1=180/Math.PI,Y1=Math.PI/180;var ae=(r=>(r[r.POLY=0]="POLY",r[r.RECT=1]="RECT",r[r.CIRC=2]="CIRC",r[r.ELIP=3]="ELIP",r[r.RREC=4]="RREC",r))(ae||{});class lt{constructor(t=0,e=0){this.x=0,this.y=0,this.x=t,this.y=e}clone(){return new lt(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}}lt.prototype.toString=function(){return`[@pixi/math:Point x=${this.x} y=${this.y}]`};const pa=[new lt,new lt,new lt,new lt];class ct{constructor(t=0,e=0,i=0,s=0){this.x=Number(t),this.y=Number(e),this.width=Number(i),this.height=Number(s),this.type=ae.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 ct(0,0,0,0)}clone(){return new ct(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?!1:t>=this.x&&t<this.x+this.width&&e>=this.y&&e<this.y+this.height}intersects(t,e){if(!e){const I=this.x<t.x?t.x:this.x;if((this.right>t.right?t.right:this.right)<=I)return!1;const P=this.y<t.y?t.y:this.y;return(this.bottom>t.bottom?t.bottom:this.bottom)>P}const i=this.left,s=this.right,n=this.top,o=this.bottom;if(s<=i||o<=n)return!1;const a=pa[0].set(t.left,t.top),h=pa[1].set(t.left,t.bottom),l=pa[2].set(t.right,t.top),u=pa[3].set(t.right,t.bottom);if(l.x<=a.x||h.y<=a.y)return!1;const c=Math.sign(e.a*e.d-e.b*e.c);if(c===0||(e.apply(a,a),e.apply(h,h),e.apply(l,l),e.apply(u,u),Math.max(a.x,h.x,l.x,u.x)<=i||Math.min(a.x,h.x,l.x,u.x)>=s||Math.max(a.y,h.y,l.y,u.y)<=n||Math.min(a.y,h.y,l.y,u.y)>=o))return!1;const d=c*(h.y-a.y),p=c*(a.x-h.x),m=d*i+p*n,f=d*s+p*n,g=d*i+p*o,y=d*s+p*o;if(Math.max(m,f,g,y)<=d*a.x+p*a.y||Math.min(m,f,g,y)>=d*u.x+p*u.y)return!1;const _=c*(a.y-l.y),b=c*(l.x-a.x),v=_*i+b*n,S=_*s+b*n,E=_*i+b*o,A=_*s+b*o;return!(Math.max(v,S,E,A)<=_*a.x+b*a.y||Math.min(v,S,E,A)>=_*u.x+b*u.y)}pad(t=0,e=t){return this.x-=t,this.y-=e,this.width+=t*2,this.height+=e*2,this}fit(t){const e=Math.max(this.x,t.x),i=Math.min(this.x+this.width,t.x+t.width),s=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(i-e,0),this.y=s,this.height=Math.max(n-s,0),this}ceil(t=1,e=.001){const i=Math.ceil((this.x+this.width-e)*t)/t,s=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=i-this.x,this.height=s-this.y,this}enlarge(t){const e=Math.min(this.x,t.x),i=Math.max(this.x+this.width,t.x+t.width),s=Math.min(this.y,t.y),n=Math.max(this.y+this.height,t.y+t.height);return this.x=e,this.width=i-e,this.y=s,this.height=n-s,this}}ct.prototype.toString=function(){return`[@pixi/math:Rectangle x=${this.x} y=${this.y} width=${this.width} height=${this.height}]`};class fa{constructor(t=0,e=0,i=0){this.x=t,this.y=e,this.radius=i,this.type=ae.CIRC}clone(){return new fa(this.x,this.y,this.radius)}contains(t,e){if(this.radius<=0)return!1;const i=this.radius*this.radius;let s=this.x-t,n=this.y-e;return s*=s,n*=n,s+n<=i}getBounds(){return new ct(this.x-this.radius,this.y-this.radius,this.radius*2,this.radius*2)}}fa.prototype.toString=function(){return`[@pixi/math:Circle x=${this.x} y=${this.y} radius=${this.radius}]`};class ma{constructor(t=0,e=0,i=0,s=0){this.x=t,this.y=e,this.width=i,this.height=s,this.type=ae.ELIP}clone(){return new ma(this.x,this.y,this.width,this.height)}contains(t,e){if(this.width<=0||this.height<=0)return!1;let i=(t-this.x)/this.width,s=(e-this.y)/this.height;return i*=i,s*=s,i+s<=1}getBounds(){return new ct(this.x-this.width,this.y-this.height,this.width,this.height)}}ma.prototype.toString=function(){return`[@pixi/math:Ellipse x=${this.x} y=${this.y} width=${this.width} height=${this.height}]`};class Yr{constructor(...t){let e=Array.isArray(t[0])?t[0]:t;if(typeof e[0]!="number"){const i=[];for(let s=0,n=e.length;s<n;s++)i.push(e[s].x,e[s].y);e=i}this.points=e,this.type=ae.POLY,this.closeStroke=!0}clone(){const t=this.points.slice(),e=new Yr(t);return e.closeStroke=this.closeStroke,e}contains(t,e){let i=!1;const s=this.points.length/2;for(let n=0,o=s-1;n<s;o=n++){const a=this.points[n*2],h=this.points[n*2+1],l=this.points[o*2],u=this.points[o*2+1];h>e!=u>e&&t<(l-a)*((e-h)/(u-h))+a&&(i=!i)}return i}}Yr.prototype.toString=function(){return`[@pixi/math:PolygoncloseStroke=${this.closeStroke}points=${this.points.reduce((r,t)=>`${r}, ${t}`,"")}]`};class ga{constructor(t=0,e=0,i=0,s=0,n=20){this.x=t,this.y=e,this.width=i,this.height=s,this.radius=n,this.type=ae.RREC}clone(){return new ga(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 i=Math.max(0,Math.min(this.radius,Math.min(this.width,this.height)/2));if(e>=this.y+i&&e<=this.y+this.height-i||t>=this.x+i&&t<=this.x+this.width-i)return!0;let s=t-(this.x+i),n=e-(this.y+i);const o=i*i;if(s*s+n*n<=o||(s=t-(this.x+this.width-i),s*s+n*n<=o)||(n=e-(this.y+this.height-i),s*s+n*n<=o)||(s=t-(this.x+i),s*s+n*n<=o))return!0}return!1}}ga.prototype.toString=function(){return`[@pixi/math:RoundedRectangle x=${this.x} y=${this.y}width=${this.width} height=${this.height} radius=${this.radius}]`};class Nt{constructor(t=1,e=0,i=0,s=1,n=0,o=0){this.array=null,this.a=t,this.b=e,this.c=i,this.d=s,this.tx=n,this.ty=o}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,i,s,n,o){return this.a=t,this.b=e,this.c=i,this.d=s,this.tx=n,this.ty=o,this}toArray(t,e){this.array||(this.array=new Float32Array(9));const i=e||this.array;return t?(i[0]=this.a,i[1]=this.b,i[2]=0,i[3]=this.c,i[4]=this.d,i[5]=0,i[6]=this.tx,i[7]=this.ty,i[8]=1):(i[0]=this.a,i[1]=this.c,i[2]=this.tx,i[3]=this.b,i[4]=this.d,i[5]=this.ty,i[6]=0,i[7]=0,i[8]=1),i}apply(t,e){e=e||new lt;const i=t.x,s=t.y;return e.x=this.a*i+this.c*s+this.tx,e.y=this.b*i+this.d*s+this.ty,e}applyInverse(t,e){e=e||new lt;const i=1/(this.a*this.d+this.c*-this.b),s=t.x,n=t.y;return e.x=this.d*i*s+-this.c*i*n+(this.ty*this.c-this.tx*this.d)*i,e.y=this.a*i*n+-this.b*i*s+(-this.ty*this.a+this.tx*this.b)*i,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),i=Math.sin(t),s=this.a,n=this.c,o=this.tx;return this.a=s*e-this.b*i,this.b=s*i+this.b*e,this.c=n*e-this.d*i,this.d=n*i+this.d*e,this.tx=o*e-this.ty*i,this.ty=o*i+this.ty*e,this}append(t){const e=this.a,i=this.b,s=this.c,n=this.d;return this.a=t.a*e+t.b*s,this.b=t.a*i+t.b*n,this.c=t.c*e+t.d*s,this.d=t.c*i+t.d*n,this.tx=t.tx*e+t.ty*s+this.tx,this.ty=t.tx*i+t.ty*n+this.ty,this}setTransform(t,e,i,s,n,o,a,h,l){return this.a=Math.cos(a+l)*n,this.b=Math.sin(a+l)*n,this.c=-Math.sin(a-h)*o,this.d=Math.cos(a-h)*o,this.tx=t-(i*this.a+s*this.c),this.ty=e-(i*this.b+s*this.d),this}prepend(t){const e=this.tx;if(t.a!==1||t.b!==0||t.c!==0||t.d!==1){const i=this.a,s=this.c;this.a=i*t.a+this.b*t.c,this.b=i*t.b+this.b*t.d,this.c=s*t.a+this.d*t.c,this.d=s*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,i=this.b,s=this.c,n=this.d,o=t.pivot,a=-Math.atan2(-s,n),h=Math.atan2(i,e),l=Math.abs(a+h);return l<1e-5||Math.abs(da-l)<1e-5?(t.rotation=h,t.skew.x=t.skew.y=0):(t.rotation=0,t.skew.x=a,t.skew.y=h),t.scale.x=Math.sqrt(e*e+i*i),t.scale.y=Math.sqrt(s*s+n*n),t.position.x=this.tx+(o.x*e+o.y*s),t.position.y=this.ty+(o.x*i+o.y*n),t}invert(){const t=this.a,e=this.b,i=this.c,s=this.d,n=this.tx,o=t*s-e*i;return this.a=s/o,this.b=-e/o,this.c=-i/o,this.d=t/o,this.tx=(i*this.ty-s*n)/o,this.ty=-(t*this.ty-e*n)/o,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 Nt;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}static get IDENTITY(){return new Nt}static get TEMP_MATRIX(){return new Nt}}Nt.prototype.toString=function(){return`[@pixi/math:Matrix a=${this.a} b=${this.b} c=${this.c} d=${this.d} tx=${this.tx} ty=${this.ty}]`};const zr=[1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1,0,1],jr=[0,1,1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1],Jr=[0,-1,-1,-1,0,1,1,1,0,1,1,1,0,-1,-1,-1],$r=[1,1,0,-1,-1,-1,0,1,-1,-1,0,1,1,1,0,-1],cu=[],zf=[],ya=Math.sign;function z1(){for(let r=0;r<16;r++){const t=[];cu.push(t);for(let e=0;e<16;e++){const i=ya(zr[r]*zr[e]+Jr[r]*jr[e]),s=ya(jr[r]*zr[e]+$r[r]*jr[e]),n=ya(zr[r]*Jr[e]+Jr[r]*$r[e]),o=ya(jr[r]*Jr[e]+$r[r]*$r[e]);for(let a=0;a<16;a++)if(zr[a]===i&&jr[a]===s&&Jr[a]===n&&$r[a]===o){t.push(a);break}}}for(let r=0;r<16;r++){const t=new Nt;t.set(zr[r],jr[r],Jr[r],$r[r],0,0),zf.push(t)}}z1();const kt={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:r=>zr[r],uY:r=>jr[r],vX:r=>Jr[r],vY:r=>$r[r],inv:r=>r&8?r&15:-r&7,add:(r,t)=>cu[r][t],sub:(r,t)=>cu[r][kt.inv(t)],rotate180:r=>r^4,isVertical:r=>(r&3)===2,byDirection:(r,t)=>Math.abs(r)*2<=Math.abs(t)?t>=0?kt.S:kt.N:Math.abs(t)*2<=Math.abs(r)?r>0?kt.E:kt.W:t>0?r>0?kt.SE:kt.SW:r>0?kt.NE:kt.NW,matrixAppendRotationInv:(r,t,e=0,i=0)=>{const s=zf[kt.inv(t)];s.tx=e,s.ty=i,r.append(s)}};class qi{constructor(t,e,i=0,s=0){this._x=i,this._y=s,this.cb=t,this.scope=e}clone(t=this.cb,e=this.scope){return new qi(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}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))}}qi.prototype.toString=function(){return`[@pixi/math:ObservablePoint x=${this.x} y=${this.y} scope=${this.scope}]`};const du=class{constructor(){this.worldTransform=new Nt,this.localTransform=new Nt,this.position=new qi(this.onChange,this,0,0),this.scale=new qi(this.onChange,this,1,1),this.pivot=new qi(this.onChange,this,0,0),this.skew=new qi(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++}updateLocalTransform(){const r=this.localTransform;this._localID!==this._currentLocalID&&(r.a=this._cx*this.scale.x,r.b=this._sx*this.scale.x,r.c=this._cy*this.scale.y,r.d=this._sy*this.scale.y,r.tx=this.position.x-(this.pivot.x*r.a+this.pivot.y*r.c),r.ty=this.position.y-(this.pivot.x*r.b+this.pivot.y*r.d),this._currentLocalID=this._localID,this._parentID=-1)}updateTransform(r){const t=this.localTransform;if(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),this._parentID!==r._worldID){const e=r.worldTransform,i=this.worldTransform;i.a=t.a*e.a+t.b*e.c,i.b=t.a*e.b+t.b*e.d,i.c=t.c*e.a+t.d*e.c,i.d=t.c*e.b+t.d*e.d,i.tx=t.tx*e.a+t.ty*e.c+e.tx,i.ty=t.tx*e.b+t.ty*e.d+e.ty,this._parentID=r._worldID,this._worldID++}}setFromMatrix(r){r.decompose(this),this._localID++}get rotation(){return this._rotation}set rotation(r){this._rotation!==r&&(this._rotation=r,this.updateSkew())}};du.IDENTITY=new du;let pu=du;pu.prototype.toString=function(){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}) ]`};var j1=`varying vec2 vTextureCoord;
|
|
13
13
|
|
|
14
14
|
uniform sampler2D uSampler;
|
|
15
15
|
|
|
16
16
|
void main(void){
|
|
17
17
|
gl_FragColor *= texture2D(uSampler, vTextureCoord);
|
|
18
|
-
}`,
|
|
18
|
+
}`,J1=`attribute vec2 aVertexPosition;
|
|
19
19
|
attribute vec2 aTextureCoord;
|
|
20
20
|
|
|
21
21
|
uniform mat3 projectionMatrix;
|
|
@@ -26,7 +26,7 @@ void main(void){
|
|
|
26
26
|
gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);
|
|
27
27
|
vTextureCoord = aTextureCoord;
|
|
28
28
|
}
|
|
29
|
-
`;function
|
|
29
|
+
`;function jf(r,t,e){const i=r.createShader(t);return r.shaderSource(i,e),r.compileShader(i),i}function fu(r){const t=new Array(r);for(let e=0;e<t.length;e++)t[e]=!1;return t}function Jf(r,t){switch(r){case"float":return 0;case"vec2":return new Float32Array(2*t);case"vec3":return new Float32Array(3*t);case"vec4":return new Float32Array(4*t);case"int":case"uint":case"sampler2D":case"sampler2DArray":return 0;case"ivec2":return new Int32Array(2*t);case"ivec3":return new Int32Array(3*t);case"ivec4":return new Int32Array(4*t);case"uvec2":return new Uint32Array(2*t);case"uvec3":return new Uint32Array(3*t);case"uvec4":return new Uint32Array(4*t);case"bool":return!1;case"bvec2":return fu(2*t);case"bvec3":return fu(3*t);case"bvec4":return fu(4*t);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 Xs=[{test:r=>r.type==="float"&&r.size===1&&!r.isArray,code:r=>`
|
|
30
30
|
if(uv["${r}"] !== ud["${r}"].value)
|
|
31
31
|
{
|
|
32
32
|
ud["${r}"].value = uv["${r}"]
|
|
@@ -146,7 +146,7 @@ void main(void){
|
|
|
146
146
|
cv[3] = v[3];
|
|
147
147
|
|
|
148
148
|
gl.uniform4f(ud["${r}"].location, v[0], v[1], v[2], v[3])
|
|
149
|
-
}`}]
|
|
149
|
+
}`}],$1={float:`
|
|
150
150
|
if (cv !== v)
|
|
151
151
|
{
|
|
152
152
|
cu.value = v;
|
|
@@ -282,7 +282,7 @@ void main(void){
|
|
|
282
282
|
cu.value = v;
|
|
283
283
|
|
|
284
284
|
gl.uniform1i(location, v);
|
|
285
|
-
}`},
|
|
285
|
+
}`},Q1={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)"};function q1(r,t){var i;const e=[`
|
|
286
286
|
var v = null;
|
|
287
287
|
var cv = null;
|
|
288
288
|
var cu = null;
|
|
@@ -292,18 +292,18 @@ void main(void){
|
|
|
292
292
|
renderer.shader.syncUniformBufferGroup(uv.${s}, '${s}');
|
|
293
293
|
`):e.push(`
|
|
294
294
|
renderer.shader.syncUniformGroup(uv.${s}, syncData);
|
|
295
|
-
`));continue}const o=r.uniforms[s];let a=!1;for(let h=0;h<
|
|
295
|
+
`));continue}const o=r.uniforms[s];let a=!1;for(let h=0;h<Xs.length;h++)if(Xs[h].test(n,o)){e.push(Xs[h].code(s,o)),a=!0;break}if(!a){const h=(n.size===1&&!n.isArray?$1:Q1)[n.type].replace("location",`ud["${s}"].location`);e.push(`
|
|
296
296
|
cu = ud["${s}"];
|
|
297
297
|
cv = cu.value;
|
|
298
298
|
v = uv["${s}"];
|
|
299
299
|
${h};`)}}return new Function("ud","uv","renderer","syncData",e.join(`
|
|
300
|
-
`))}const
|
|
300
|
+
`))}const $f={};let Zs=$f;function tv(){if(Zs===$f||Zs!=null&&Zs.isContextLost()){const r=Q.ADAPTER.createCanvas();let t;Q.PREFER_ENV>=Ur.WEBGL2&&(t=r.getContext("webgl2",{})),t||(t=r.getContext("webgl",{})||r.getContext("experimental-webgl",{}),t?t.getExtension("WEBGL_draw_buffers"):t=null),Zs=t}return Zs}let ba;function ev(){if(!ba){ba=Ue.MEDIUM;const r=tv();if(r&&r.getShaderPrecisionFormat){const t=r.getShaderPrecisionFormat(r.FRAGMENT_SHADER,r.HIGH_FLOAT);t&&(ba=t.precision?Ue.HIGH:Ue.MEDIUM)}}return ba}function Qf(r,t){const e=r.getShaderSource(t).split(`
|
|
301
301
|
`).map((l,u)=>`${u}: ${l}`),i=r.getShaderInfoLog(t),s=i.split(`
|
|
302
302
|
`),n={},o=s.map(l=>parseFloat(l.replace(/^ERROR\: 0\:([\d]+)\:.*$/,"$1"))).filter(l=>l&&!n[l]?(n[l]=!0,!0):!1),a=[""];o.forEach(l=>{e[l-1]=`%c${e[l-1]}%c`,a.push("background: #FF0000; color:#FFFFFF; font-size: 10px","font-size: 10px")});const h=e.join(`
|
|
303
|
-
`);a[0]=h,console.error(i),console.groupCollapsed("click to view full shader code"),console.warn(...a),console.groupEnd()}function
|
|
304
|
-
${r}`}else if(e!==
|
|
303
|
+
`);a[0]=h,console.error(i),console.groupCollapsed("click to view full shader code"),console.warn(...a),console.groupEnd()}function iv(r,t,e,i){r.getProgramParameter(t,r.LINK_STATUS)||(r.getShaderParameter(e,r.COMPILE_STATUS)||Qf(r,e),r.getShaderParameter(i,r.COMPILE_STATUS)||Qf(r,i),console.error("PixiJS Error: Could not initialize shader."),r.getProgramInfoLog(t)!==""&&console.warn("PixiJS Warning: gl.getProgramInfoLog()",r.getProgramInfoLog(t)))}const rv={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 qf(r){return rv[r]}let xa=null;const tm={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 em(r,t){if(!xa){const e=Object.keys(tm);xa={};for(let i=0;i<e.length;++i){const s=e[i];xa[r[s]]=tm[s]}}return xa[t]}function im(r,t,e){if(r.substring(0,9)!=="precision"){let i=t;return t===Ue.HIGH&&e!==Ue.HIGH&&(i=Ue.MEDIUM),`precision ${i} float;
|
|
304
|
+
${r}`}else if(e!==Ue.HIGH&&r.substring(0,15)==="precision highp")return r.replace("precision highp","precision mediump");return r}let Kn;function sv(){if(typeof Kn=="boolean")return Kn;try{Kn=new Function("param1","param2","param3","return param1[param2] === param3;")({a:"b"},"a","b")===!0}catch{Kn=!1}return Kn}let nv=0;const _a={},mu=class Mn{constructor(t,e,i="pixi-shader",s={}){this.extra={},this.id=nv++,this.vertexSrc=t||Mn.defaultVertexSrc,this.fragmentSrc=e||Mn.defaultFragmentSrc,this.vertexSrc=this.vertexSrc.trim(),this.fragmentSrc=this.fragmentSrc.trim(),this.extra=s,this.vertexSrc.substring(0,8)!=="#version"&&(i=i.replace(/\s+/g,"-"),_a[i]?(_a[i]++,i+=`-${_a[i]}`):_a[i]=1,this.vertexSrc=`#define SHADER_NAME ${i}
|
|
305
305
|
${this.vertexSrc}`,this.fragmentSrc=`#define SHADER_NAME ${i}
|
|
306
|
-
${this.fragmentSrc}`,this.vertexSrc=
|
|
306
|
+
${this.fragmentSrc}`,this.vertexSrc=im(this.vertexSrc,Mn.defaultVertexPrecision,Ue.HIGH),this.fragmentSrc=im(this.fragmentSrc,Mn.defaultFragmentPrecision,ev())),this.glPrograms={},this.syncUniforms=null}static get defaultVertexSrc(){return J1}static get defaultFragmentSrc(){return j1}static from(t,e,i){const s=t+e;let n=Uf[s];return n||(Uf[s]=n=new Mn(t,e,i)),n}};mu.defaultVertexPrecision=Ue.HIGH,mu.defaultFragmentPrecision=zi.apple.device?Ue.HIGH:Ue.MEDIUM;let tr=mu,ov=0;class ri{constructor(t,e,i){this.group=!0,this.syncUniforms={},this.dirtyId=0,this.id=ov++,this.static=!!e,this.ubo=!!i,t instanceof Ht?(this.buffer=t,this.buffer.type=xi.UNIFORM_BUFFER,this.autoManage=!1,this.ubo=!0):(this.uniforms=t,this.ubo&&(this.buffer=new Ht(new Float32Array(1)),this.buffer.type=xi.UNIFORM_BUFFER,this.autoManage=!0))}update(){this.dirtyId++,!this.autoManage&&this.buffer&&this.buffer.update()}add(t,e,i){if(!this.ubo)this.uniforms[t]=new ri(e,i);else throw new Error("[UniformGroup] uniform groups in ubo mode cannot be modified, or have uniform groups nested in them")}static from(t,e,i){return new ri(t,e,i)}static uboFrom(t,e){return new ri(t,e??!0,!0)}}class Ei{constructor(t,e){this.uniformBindCount=0,this.program=t,e?e instanceof ri?this.uniformGroup=e:this.uniformGroup=new ri(e):this.uniformGroup=new ri({}),this.disposeRunner=new ii("disposeShader")}checkUniformExists(t,e){if(e.uniforms[t])return!0;for(const i in e.uniforms){const s=e.uniforms[i];if(s.group===!0&&this.checkUniformExists(t,s))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,i){const s=tr.from(t,e);return new Ei(s,i)}}class av{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 i=new Int32Array(t);for(let n=0;n<t;n++)i[n]=n;this.defaultGroupCache[t]=ri.from({uSamplers:i},!0);let s=this.fragTemplate;s=s.replace(/%count%/gi,`${t}`),s=s.replace(/%forloop%/gi,this.generateSampleSrc(t)),this.programCache[t]=new tr(this.vertexSrc,s)}const e={tint:new Float32Array([1,1,1,1]),translationMatrix:new Nt,default:this.defaultGroupCache[t]};return new Ei(this.programCache[t],e)}generateSampleSrc(t){let e="";e+=`
|
|
307
307
|
`,e+=`
|
|
308
308
|
`;for(let i=0;i<t;i++)i>0&&(e+=`
|
|
309
309
|
else `),i<t-1&&(e+=`if(vTextureId < ${i}.5)`),e+=`
|
|
@@ -311,7 +311,7 @@ else `),i<t-1&&(e+=`if(vTextureId < ${i}.5)`),e+=`
|
|
|
311
311
|
color = texture2D(uSamplers[${i}], vTextureCoord);`,e+=`
|
|
312
312
|
}`;return e+=`
|
|
313
313
|
`,e+=`
|
|
314
|
-
`,e}}class gu{constructor(){this.elements=[],this.ids=[],this.count=0}clear(){for(let t=0;t<this.count;t++)this.elements[t]=null;this.count=0}}function
|
|
314
|
+
`,e}}class gu{constructor(){this.elements=[],this.ids=[],this.count=0}clear(){for(let t=0;t<this.count;t++)this.elements[t]=null;this.count=0}}function hv(){return!zi.apple.device}function lv(r){let t=!0;const e=Q.ADAPTER.getNavigator();if(zi.tablet||zi.phone){if(zi.apple.device){const i=e.userAgent.match(/OS (\d+)_(\d+)?/);i&&parseInt(i[1],10)<11&&(t=!1)}if(zi.android.device){const i=e.userAgent.match(/Android\s([0-9.]*)/);i&&parseInt(i[1],10)<7&&(t=!1)}}return t?r:4}class va{constructor(t){this.renderer=t}flush(){}destroy(){this.renderer=null}start(){}stop(){this.flush()}render(t){}}var uv=`varying vec2 vTextureCoord;
|
|
315
315
|
varying vec4 vColor;
|
|
316
316
|
varying float vTextureId;
|
|
317
317
|
uniform sampler2D uSamplers[%count%];
|
|
@@ -321,7 +321,7 @@ void main(void){
|
|
|
321
321
|
%forloop%
|
|
322
322
|
gl_FragColor = color * vColor;
|
|
323
323
|
}
|
|
324
|
-
`,
|
|
324
|
+
`,cv=`precision highp float;
|
|
325
325
|
attribute vec2 aVertexPosition;
|
|
326
326
|
attribute vec2 aTextureCoord;
|
|
327
327
|
attribute vec4 aColor;
|
|
@@ -342,14 +342,14 @@ void main(void){
|
|
|
342
342
|
vTextureId = aTextureId;
|
|
343
343
|
vColor = aColor * tint;
|
|
344
344
|
}
|
|
345
|
-
`;const
|
|
345
|
+
`;const Yn=class mi extends va{constructor(t){super(t),this.setShaderGenerator(),this.geometryClass=Yf,this.vertexSize=6,this.state=Si.for2d(),this.size=mi.defaultBatchSize*4,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??lv(32),this._defaultMaxTextures}static set defaultMaxTextures(t){this._defaultMaxTextures=t}static get canUploadSameBuffer(){return this._canUploadSameBuffer=this._canUploadSameBuffer??hv(),this._canUploadSameBuffer}static set canUploadSameBuffer(t){this._canUploadSameBuffer=t}get MAX_TEXTURES(){return vt("7.1.0","BatchRenderer#MAX_TEXTURES renamed to BatchRenderer#maxTextures"),this.maxTextures}static get defaultVertexSrc(){return cv}static get defaultFragmentTemplate(){return uv}setShaderGenerator({vertex:t=mi.defaultVertexSrc,fragment:e=mi.defaultFragmentTemplate}={}){this.shaderGenerator=new av(t,e)}contextChange(){const t=this.renderer.gl;Q.PREFER_ENV===Ur.WEBGL_LEGACY?this.maxTextures=1:(this.maxTextures=Math.min(t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS),mi.defaultMaxTextures),this.maxTextures=B1(this.maxTextures,t)),this._shader=this.shaderGenerator.generateShader(this.maxTextures);for(let e=0;e<this._packedGeometryPoolSize;e++)this._packedGeometries[e]=new this.geometryClass;this.initFlushBuffers()}initFlushBuffers(){const{_drawCallPool:t,_textureArrayPool:e}=mi,i=this.size/4,s=Math.floor(i/this.maxTextures)+1;for(;t.length<i;)t.push(new uu);for(;e.length<s;)e.push(new gu);for(let n=0;n<this.maxTextures;n++)this._tempBoundTextures[n]=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,i=mi._textureArrayPool,s=this.renderer.batch,n=this._tempBoundTextures,o=this.renderer.textureGC.count;let a=++ft._globalBatch,h=0,l=i[0],u=0;s.copyBoundTextures(n,e);for(let c=0;c<this._bufferSize;++c){const d=t[c];t[c]=null,d._batchEnabled!==a&&(l.count>=e&&(s.boundArray(l,n,a,e),this.buildDrawCalls(l,u,c),u=c,l=i[++h],++a),d._batchEnabled=a,d.touched=o,l.elements[l.count++]=d)}l.count>0&&(s.boundArray(l,n,a,e),this.buildDrawCalls(l,u,this._bufferSize),++h,++a);for(let c=0;c<n.length;c++)n[c]=null;ft._globalBatch=a}buildDrawCalls(t,e,i){const{_bufferedElements:s,_attributeBuffer:n,_indexBuffer:o,vertexSize:a}=this,h=mi._drawCallPool;let l=this._dcIndex,u=this._aIndex,c=this._iIndex,d=h[l];d.start=this._iIndex,d.texArray=t;for(let p=e;p<i;++p){const m=s[p],f=m._texture.baseTexture,g=Ff[f.alphaMode?1:0][m.blendMode];s[p]=null,e<p&&d.blend!==g&&(d.size=c-d.start,e=p,d=h[++l],d.texArray=t,d.start=c),this.packInterleavedGeometry(m,n,o,u,c),u+=m.vertexData.length/2*a,c+=m.indices.length,d.blend=g}e<i&&(d.size=c-d.start,++l),this._dcIndex=l,this._aIndex=u,this._iIndex=c}bindAndClearTexArray(t){const e=this.renderer.texture;for(let i=0;i<t.count;i++)e.bind(t.elements[i],t.ids[i]),t.elements[i]=null;t.count=0}updateGeometry(){const{_packedGeometries:t,_attributeBuffer:e,_indexBuffer:i}=this;mi.canUploadSameBuffer?(t[this._flushId]._buffer.update(e.rawBinaryData),t[this._flushId]._indexBuffer.update(i),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(i),this.renderer.geometry.bind(t[this._flushId]),this.renderer.geometry.updateBuffers(),this._flushId++)}drawBatches(){const t=this._dcIndex,{gl:e,state:i}=this.renderer,s=mi._drawCallPool;let n=null;for(let o=0;o<t;o++){const{texArray:a,type:h,size:l,start:u,blend:c}=s[o];n!==a&&(n=a,this.bindAndClearTexArray(a)),this.state.blendMode=c,i.set(this.state),e.drawElements(h,l,e.UNSIGNED_SHORT,u*2)}}flush(){this._vertexCount!==0&&(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),mi.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=la(Math.ceil(t/8)),i=Bf(e),s=e*8;this._aBuffers.length<=i&&(this._iBuffers.length=i+1);let n=this._aBuffers[s];return n||(this._aBuffers[s]=n=new eu(s*this.vertexSize*4)),n}getIndexBuffer(t){const e=la(Math.ceil(t/12)),i=Bf(e),s=e*12;this._iBuffers.length<=i&&(this._iBuffers.length=i+1);let n=this._iBuffers[i];return n||(this._iBuffers[i]=n=new Uint16Array(s)),n}packInterleavedGeometry(t,e,i,s,n){const{uint32View:o,float32View:a}=e,h=s/this.vertexSize,l=t.uvs,u=t.indices,c=t.vertexData,d=t._texture.baseTexture._batchLocation,p=Math.min(t.worldAlpha,1),m=Gt.shared.setValue(t._tintRGB).toPremultiplied(p,t._texture.baseTexture.alphaMode>0);for(let f=0;f<c.length;f+=2)a[s++]=c[f],a[s++]=c[f+1],a[s++]=l[f],a[s++]=l[f+1],o[s++]=m,a[s++]=d;for(let f=0;f<u.length;f++)i[n++]=h+u[f]}};Yn.defaultBatchSize=4096,Yn.extension={name:"batch",type:J.RendererPlugin},Yn._drawCallPool=[],Yn._textureArrayPool=[];let Qr=Yn;et.add(Qr);var dv=`varying vec2 vTextureCoord;
|
|
346
346
|
|
|
347
347
|
uniform sampler2D uSampler;
|
|
348
348
|
|
|
349
349
|
void main(void){
|
|
350
350
|
gl_FragColor = texture2D(uSampler, vTextureCoord);
|
|
351
351
|
}
|
|
352
|
-
`,
|
|
352
|
+
`,pv=`attribute vec2 aVertexPosition;
|
|
353
353
|
|
|
354
354
|
uniform mat3 projectionMatrix;
|
|
355
355
|
|
|
@@ -375,7 +375,7 @@ void main(void)
|
|
|
375
375
|
gl_Position = filterVertexPosition();
|
|
376
376
|
vTextureCoord = filterTextureCoord();
|
|
377
377
|
}
|
|
378
|
-
`;const yu=class Uo extends Ci{constructor(t,e,i){const s=qi.from(t||Uo.defaultVertexSrc,e||Uo.defaultFragmentSrc);super(s,i),this.padding=0,this.resolution=Uo.defaultResolution,this.multisample=Uo.defaultMultisample,this.enabled=!0,this.autoFit=!0,this.state=new Ei}apply(t,e,i,s,n){t.applyFilter(this,e,i,s)}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 uv}static get defaultFragmentSrc(){return lv}};yu.defaultResolution=1,yu.defaultMultisample=Yt.NONE;let ge=yu;class va{constructor(){this.clearBeforeRender=!0,this._backgroundColor=new Lt(0),this.alpha=1}init(t){this.clearBeforeRender=t.clearBeforeRender;const{backgroundColor:e,background:i,backgroundAlpha:s}=t,n=i??e;n!==void 0&&(this.color=n),this.alpha=s}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(){}}va.defaultOptions={backgroundAlpha:1,backgroundColor:0,clearBeforeRender:!0},va.extension={type:[z.RendererSystem,z.CanvasRendererSystem],name:"background"},tt.add(va);class tm{constructor(t){this.renderer=t,this.emptyRenderer=new _a(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:i}=this.renderer.texture;for(let s=e-1;s>=0;--s)t[s]=i[s]||null,t[s]&&(t[s]._batchLocation=s)}boundArray(t,e,i,s){const{elements:n,ids:o,count:a}=t;let h=0;for(let l=0;l<a;l++){const u=n[l],c=u._batchLocation;if(c>=0&&c<s&&e[c]===u){o[l]=c;continue}for(;h<s;){const d=e[h];if(d&&d._batchEnabled===i&&d._batchLocation===h){h++;continue}o[l]=h,u._batchLocation=h,e[h]=u;break}}}destroy(){this.renderer=null}}tm.extension={type:z.RendererSystem,name:"batch"},tt.add(tm);let em=0;class Ta{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=em++}init(t){if(t.context)this.initFromContext(t.context);else{const e=this.renderer.background.alpha<1,i=t.premultipliedAlpha;this.preserveDrawingBuffer=t.preserveDrawingBuffer,this.useContextAlpha=t.useContextAlpha,this.powerPreference=t.powerPreference,this.initFromOptions({alpha:e,premultipliedAlpha:i,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=em++,this.renderer.runners.contextChange.emit(t);const e=this.renderer.view;e.addEventListener!==void 0&&(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 i;if($.PREFER_ENV>=Or.WEBGL2&&(i=t.getContext("webgl2",e)),i)this.webGLVersion=2;else if(this.webGLVersion=1,i=t.getContext("webgl",e)||t.getContext("experimental-webgl",e),!i)throw new Error("This browser does not support WebGL. Try using the canvas renderer");return this.gl=i,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")};this.webGLVersion===1?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")}):this.webGLVersion===2&&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,t.removeEventListener!==void 0&&(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(),i="WebGL2RenderingContext"in globalThis&&t instanceof globalThis.WebGL2RenderingContext;i&&(this.webGLVersion=2),e&&!e.stencil&&console.warn("Provided WebGL context does not have a stencil buffer, masks may not render correctly");const s=i||!!t.getExtension("OES_element_index_uint");this.supports.uint32Indices=s,s||console.warn("Provided WebGL context does not support 32 index buffer, complex graphics may not render correctly")}}Ta.defaultOptions={context:null,antialias:!1,premultipliedAlpha:!0,preserveDrawingBuffer:!1,powerPreference:"default"},Ta.extension={type:z.RendererSystem,name:"context"},tt.add(Ta);class bu{constructor(t,e){if(this.width=Math.round(t),this.height=Math.round(e),!this.width||!this.height)throw new Error("Framebuffer width or height is zero");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 ei("disposeFramebuffer"),this.multisample=Yt.NONE}get colorTexture(){return this.colorTextures[0]}addColorTexture(t=0,e){return this.colorTextures[t]=e||new ft(null,{scaleMode:Vi.NEAREST,resolution:1,mipmap:bi.OFF,width:this.width,height:this.height}),this.dirtyId++,this.dirtyFormat++,this}addDepthTexture(t){return this.depthTexture=t||new ft(null,{scaleMode:Vi.NEAREST,resolution:1,width:this.width,height:this.height,mipmap:bi.OFF,format:V.DEPTH_COMPONENT,type:nt.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||!e)throw new Error("Framebuffer width and height must not be zero");if(!(t===this.width&&e===this.height)){this.width=t,this.height=e,this.dirtyId++,this.dirtySize++;for(let i=0;i<this.colorTextures.length;i++){const s=this.colorTextures[i],n=s.resolution;s.setSize(t/n,e/n)}if(this.depthTexture){const i=this.depthTexture.resolution;this.depthTexture.setSize(t/i,e/i)}}}dispose(){this.disposeRunner.emit(this,!1)}destroyDepthTexture(){this.depthTexture&&(this.depthTexture.destroy(),this.depthTexture=null,++this.dirtyId,++this.dirtyFormat)}}class im extends ft{constructor(t={}){if(typeof t=="number"){const e=arguments[0],i=arguments[1],s=arguments[2],n=arguments[3];t={width:e,height:i,scaleMode:s,resolution:n}}t.width=t.width??100,t.height=t.height??100,t.multisample??(t.multisample=Yt.NONE),super(null,t),this.mipmap=bi.OFF,this.valid=!0,this._clear=new Lt([0,0,0,0]),this.framebuffer=new bu(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}get multisample(){return this.framebuffer.multisample}set multisample(t){this.framebuffer.multisample=t}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 br extends Vn{constructor(t){const e=t,i=e.naturalWidth||e.videoWidth||e.width,s=e.naturalHeight||e.videoHeight||e.height;super(i,s),this.source=t,this.noSubImage=!1}static crossOrigin(t,e,i){i===void 0&&!e.startsWith("data:")?t.crossOrigin=G1(e):i!==!1&&(t.crossOrigin=typeof i=="string"?i:"anonymous")}upload(t,e,i,s){const n=t.gl,o=e.realWidth,a=e.realHeight;if(s=s||this.source,typeof HTMLImageElement<"u"&&s instanceof HTMLImageElement){if(!s.complete||s.naturalWidth===0)return!1}else if(typeof HTMLVideoElement<"u"&&s instanceof HTMLVideoElement&&s.readyState<=1)return!1;return n.pixelStorei(n.UNPACK_PREMULTIPLY_ALPHA_WEBGL,e.alphaMode===be.UNPACK),!this.noSubImage&&e.target===n.TEXTURE_2D&&i.width===o&&i.height===a?n.texSubImage2D(n.TEXTURE_2D,0,0,0,e.format,i.type,s):(i.width=o,i.height=a,n.texImage2D(e.target,0,i.internalFormat,e.format,i.type,s)),!0}update(){if(this.destroyed)return;const t=this.source,e=t.naturalWidth||t.videoWidth||t.width,i=t.naturalHeight||t.videoHeight||t.height;this.resize(e,i),super.update()}dispose(){this.source=null}}class rm extends br{constructor(t,e){if(e=e||{},typeof t=="string"){const i=new Image;br.crossOrigin(i,t,e.crossorigin),i.src=t,t=i}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??$.CREATE_IMAGE_BITMAP)&&!!globalThis.createImageBitmap,this.alphaMode=typeof e.alphaMode=="number"?e.alphaMode:null,this.bitmap=null,this._load=null,e.autoLoad!==!1&&this.load()}load(t){return this._load?this._load:(t!==void 0&&(this.createBitmap=t),this._load=new Promise((e,i)=>{const s=this.source;this.url=s.src;const n=()=>{this.destroyed||(s.onload=null,s.onerror=null,this.update(),this._load=null,this.createBitmap?e(this.process()):e(this))};s.complete&&s.src?n():(s.onload=n,s.onerror=o=>{i(o),this.onError.emit(o)})}),this._load)}process(){const t=this.source;if(this._process!==null)return this._process;if(this.bitmap!==null||!globalThis.createImageBitmap)return Promise.resolve(this);const e=globalThis.createImageBitmap,i=!t.crossOrigin||t.crossOrigin==="anonymous";return this._process=fetch(t.src,{mode:i?"cors":"no-cors"}).then(s=>s.blob()).then(s=>e(s,0,0,t.width,t.height,{premultiplyAlpha:this.alphaMode===null||this.alphaMode===be.UNPACK?"premultiply":"none"})).then(s=>this.destroyed?Promise.reject():(this.bitmap=s,this.update(),this._process=null,Promise.resolve(this))),this._process}upload(t,e,i){if(typeof this.alphaMode=="number"&&(e.alphaMode=this.alphaMode),!this.createBitmap)return super.upload(t,e,i);if(!this.bitmap&&(this.process(),!this.bitmap))return!1;if(super.upload(t,e,i,this.bitmap),!this.preserveBitmap){let s=!0;const n=e._glTextures;for(const o in n){const a=n[o];if(a!==i&&a.dirtyId!==e.dirtyId){s=!1;break}}s&&(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 typeof HTMLImageElement<"u"&&(typeof t=="string"||t instanceof HTMLImageElement)}}class xu{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,i){const s=e.width,n=e.height;if(i){const o=t.width/2/s,a=t.height/2/n,h=t.x/s+o,l=t.y/n+a;i=kt.add(i,kt.NW),this.x0=h+o*kt.uX(i),this.y0=l+a*kt.uY(i),i=kt.add(i,2),this.x1=h+o*kt.uX(i),this.y1=l+a*kt.uY(i),i=kt.add(i,2),this.x2=h+o*kt.uX(i),this.y2=l+a*kt.uY(i),i=kt.add(i,2),this.x3=h+o*kt.uX(i),this.y3=l+a*kt.uY(i)}else this.x0=t.x/s,this.y0=t.y/n,this.x1=(t.x+t.width)/s,this.y1=t.y/n,this.x2=(t.x+t.width)/s,this.y2=(t.y+t.height)/n,this.x3=t.x/s,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}}xu.prototype.toString=function(){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 sm=new xu;function wa(r){r.destroy=function(){},r.on=function(){},r.once=function(){},r.emit=function(){}}class it extends Gn{constructor(t,e,i,s,n,o,a){if(super(),this.noFrame=!1,e||(this.noFrame=!0,e=new ct(0,0,1,1)),t instanceof it&&(t=t.baseTexture),this.baseTexture=t,this._frame=e,this.trim=s,this.valid=!1,this.destroyed=!1,this._uvs=sm,this.uvMatrix=null,this.orig=i||e,this._rotate=Number(n||0),n===!0)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=o?new lt(o.x,o.y):new lt(0,0),this.defaultBorders=a,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:e}=this.baseTexture;e!=null&&e.url&&Si[e.url]&&it.removeFromCache(e.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,it.removeFromCache(this),this.textureCacheIds=null,this.destroyed=!0,this.emit("destroyed",this),this.removeAllListeners()}clone(){var s;const t=this._frame.clone(),e=this._frame===this.orig?t:this.orig.clone(),i=new it(this.baseTexture,!this.noFrame&&t,e,(s=this.trim)==null?void 0:s.clone(),this.rotate,this.defaultAnchor,this.defaultBorders);return this.noFrame&&(i._frame=t),i}updateUvs(){this._uvs===sm&&(this._uvs=new xu),this._uvs.set(this._frame,this.baseTexture,this.rotate),this._updateID++}static from(t,e={},i=$.STRICT_TEXTURE_CACHE){const s=typeof t=="string";let n=null;if(s)n=t;else if(t instanceof ft){if(!t.cacheId){const a=(e==null?void 0:e.pixiIdPrefix)||"pixiid";t.cacheId=`${a}-${Zr()}`,ft.addToCache(t,t.cacheId)}n=t.cacheId}else{if(!t._pixiId){const a=(e==null?void 0:e.pixiIdPrefix)||"pixiid";t._pixiId=`${a}_${Zr()}`}n=t._pixiId}let o=Si[n];if(s&&i&&!o)throw new Error(`The cacheId "${n}" does not exist in TextureCache.`);return!o&&!(t instanceof ft)?(e.resolution||(e.resolution=$i(t)),o=new it(new ft(t,e)),o.baseTexture.cacheId=n,ft.addToCache(o.baseTexture,n),it.addToCache(o,n)):!o&&t instanceof ft&&(o=new it(t),it.addToCache(o,n)),o}static fromURL(t,e){const i=Object.assign({autoLoad:!1},e==null?void 0:e.resourceOptions),s=it.from(t,Object.assign({resourceOptions:i},e),!1),n=s.baseTexture.resource;return s.baseTexture.valid?Promise.resolve(s):n.load().then(()=>Promise.resolve(s))}static fromBuffer(t,e,i,s){return new it(ft.fromBuffer(t,e,i,s))}static fromLoader(t,e,i,s){const n=new ft(t,Object.assign({scaleMode:ft.defaultOptions.scaleMode,resolution:$i(e)},s)),{resource:o}=n;o instanceof rm&&(o.url=e);const a=new it(n);return i||(i=e),ft.addToCache(a.baseTexture,i),it.addToCache(a,i),i!==e&&(ft.addToCache(a.baseTexture,e),it.addToCache(a,e)),a.baseTexture.valid?Promise.resolve(a):new Promise(h=>{a.baseTexture.once("loaded",()=>h(a))})}static addToCache(t,e){e&&(t.textureCacheIds.includes(e)||t.textureCacheIds.push(e),Si[e]&&Si[e]!==t&&console.warn(`Texture added to the cache with an id [${e}] that already had an entry`),Si[e]=t)}static removeFromCache(t){if(typeof t=="string"){const e=Si[t];if(e){const i=e.textureCacheIds.indexOf(t);return i>-1&&e.textureCacheIds.splice(i,1),delete Si[t],e}}else if(t!=null&&t.textureCacheIds){for(let e=0;e<t.textureCacheIds.length;++e)Si[t.textureCacheIds[e]]===t&&delete Si[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:i,width:s,height:n}=t,o=e+s>this.baseTexture.width,a=i+n>this.baseTexture.height;if(o||a){const h=o&&a?"and":"or",l=`X: ${e} + ${s} = ${e+s} > ${this.baseTexture.width}`,u=`Y: ${i} + ${n} = ${i+n} > ${this.baseTexture.height}`;throw new Error(`Texture Error: frame does not fit inside the base Texture dimensions: ${l} ${h} ${u}`)}this.valid=s&&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 it._EMPTY||(it._EMPTY=new it(new ft),wa(it._EMPTY),wa(it._EMPTY.baseTexture)),it._EMPTY}static get WHITE(){if(!it._WHITE){const t=$.ADAPTER.createCanvas(16,16),e=t.getContext("2d");t.width=16,t.height=16,e.fillStyle="white",e.fillRect(0,0,16,16),it._WHITE=new it(ft.from(t)),wa(it._WHITE),wa(it._WHITE.baseTexture)}return it._WHITE}}class Jr extends it{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,i=!0){const s=this.baseTexture.resolution,n=Math.round(t*s)/s,o=Math.round(e*s)/s;this.valid=n>0&&o>0,this._frame.width=this.orig.width=n,this._frame.height=this.orig.height=o,i&&this.baseTexture.resize(n,o),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 Jr(new im(t))}}class nm{constructor(t){this.texturePool={},this.textureOptions=t||{},this.enableFullScreen=!1,this._pixelsWidth=0,this._pixelsHeight=0}createTexture(t,e,i=Yt.NONE){const s=new im(Object.assign({width:t,height:e,resolution:1,multisample:i},this.textureOptions));return new Jr(s)}getOptimalTexture(t,e,i=1,s=Yt.NONE){let n;t=Math.max(Math.ceil(t*i-1e-6),1),e=Math.max(Math.ceil(e*i-1e-6),1),!this.enableFullScreen||t!==this._pixelsWidth||e!==this._pixelsHeight?(t=ha(t),e=ha(e),n=((t&65535)<<16|e&65535)>>>0,s>1&&(n+=s*4294967296)):n=s>1?-s:-1,this.texturePool[n]||(this.texturePool[n]=[]);let o=this.texturePool[n].pop();return o||(o=this.createTexture(t,e,s)),o.filterPoolKey=n,o.setResolution(i),o}getFilterTexture(t,e,i){const s=this.getOptimalTexture(t.width,t.height,e||t.resolution,i||Yt.NONE);return s.filterFrame=t.filterFrame,s}returnTexture(t){const e=t.filterPoolKey;t.filterFrame=null,this.texturePool[e].push(t)}returnFilterTexture(t){this.returnTexture(t)}clear(t){if(t=t!==!1,t)for(const e in this.texturePool){const i=this.texturePool[e];if(i)for(let s=0;s<i.length;s++)i[s].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 e in this.texturePool){if(!(Number(e)<0))continue;const i=this.texturePool[e];if(i)for(let s=0;s<i.length;s++)i[s].destroy(!0);this.texturePool[e]=[]}this._pixelsWidth=t.width,this._pixelsHeight=t.height}}}nm.SCREEN_KEY=-1;class cv extends yr{constructor(){super(),this.addAttribute("aVertexPosition",new Float32Array([0,0,1,0,1,1,0,1])).addIndex([0,1,3,2])}}class om extends yr{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 Ht(this.vertices),this.uvBuffer=new Ht(this.uvs),this.addAttribute("aVertexPosition",this.vertexBuffer).addAttribute("aTextureCoord",this.uvBuffer).addIndex([0,1,2,0,2,3])}map(t,e){let i=0,s=0;return this.uvs[0]=i,this.uvs[1]=s,this.uvs[2]=i+e.width/t.width,this.uvs[3]=s,this.uvs[4]=i+e.width/t.width,this.uvs[5]=s+e.height/t.height,this.uvs[6]=i,this.uvs[7]=s+e.height/t.height,i=e.x,s=e.y,this.vertices[0]=i,this.vertices[1]=s,this.vertices[2]=i+e.width,this.vertices[3]=s,this.vertices[4]=i+e.width,this.vertices[5]=s+e.height,this.vertices[6]=i,this.vertices[7]=s+e.height,this.invalidate(),this}invalidate(){return this.vertexBuffer._updateID++,this.uvBuffer._updateID++,this}}class dv{constructor(){this.renderTexture=null,this.target=null,this.legacy=!1,this.resolution=1,this.multisample=Yt.NONE,this.sourceFrame=new ct,this.destinationFrame=new ct,this.bindingSourceFrame=new ct,this.bindingDestinationFrame=new ct,this.filters=[],this.transform=null}clear(){this.target=null,this.filters=null,this.renderTexture=null}}const Sa=[new lt,new lt,new lt,new lt],_u=new Gt;class am{constructor(t){this.renderer=t,this.defaultFilterStack=[{}],this.texturePool=new nm,this.statePool=[],this.quad=new cv,this.quadUv=new om,this.tempRect=new ct,this.activeState={},this.globalUniforms=new ii({outputFrame:new ct,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 i=this.renderer,s=this.defaultFilterStack,n=this.statePool.pop()||new dv,o=i.renderTexture;let a,h;if(o.current){const g=o.current;a=g.resolution,h=g.multisample}else a=i.resolution,h=i.multisample;let l=e[0].resolution||a,u=e[0].multisample??h,c=e[0].padding,d=e[0].autoFit,p=e[0].legacy??!0;for(let g=1;g<e.length;g++){const y=e[g];l=Math.min(l,y.resolution||a),u=Math.min(u,y.multisample??h),c=this.useMaxPadding?Math.max(c,y.padding):c+y.padding,d=d&&y.autoFit,p=p||(y.legacy??!0)}s.length===1&&(this.defaultFilterStack[0].renderTexture=o.current),s.push(n),n.resolution=l,n.multisample=u,n.legacy=p,n.target=t,n.sourceFrame.copyFrom(t.filterArea||t.getBounds(!0)),n.sourceFrame.pad(c);const m=this.tempRect.copyFrom(o.sourceFrame);i.projection.transform&&this.transformAABB(_u.copyFrom(i.projection.transform).invert(),m),d?(n.sourceFrame.fit(m),(n.sourceFrame.width<=0||n.sourceFrame.height<=0)&&(n.sourceFrame.width=0,n.sourceFrame.height=0)):n.sourceFrame.intersects(m)||(n.sourceFrame.width=0,n.sourceFrame.height=0),this.roundFrame(n.sourceFrame,o.current?o.current.resolution:i.resolution,o.sourceFrame,o.destinationFrame,i.projection.transform),n.renderTexture=this.getOptimalFilterTexture(n.sourceFrame.width,n.sourceFrame.height,l,u),n.filters=e,n.destinationFrame.width=n.renderTexture.width,n.destinationFrame.height=n.renderTexture.height;const f=this.tempRect;f.x=0,f.y=0,f.width=n.sourceFrame.width,f.height=n.sourceFrame.height,n.renderTexture.filterFrame=n.sourceFrame,n.bindingSourceFrame.copyFrom(o.sourceFrame),n.bindingDestinationFrame.copyFrom(o.destinationFrame),n.transform=i.projection.transform,i.projection.transform=null,o.bind(n.renderTexture,n.sourceFrame,f),i.framebuffer.clear(0,0,0,0)}pop(){const t=this.defaultFilterStack,e=t.pop(),i=e.filters;this.activeState=e;const s=this.globalUniforms.uniforms;s.outputFrame=e.sourceFrame,s.resolution=e.resolution;const n=s.inputSize,o=s.inputPixel,a=s.inputClamp;if(n[0]=e.destinationFrame.width,n[1]=e.destinationFrame.height,n[2]=1/n[0],n[3]=1/n[1],o[0]=Math.round(n[0]*e.resolution),o[1]=Math.round(n[1]*e.resolution),o[2]=1/o[0],o[3]=1/o[1],a[0]=.5*o[2],a[1]=.5*o[3],a[2]=e.sourceFrame.width*n[2]-.5*o[2],a[3]=e.sourceFrame.height*n[3]-.5*o[3],e.legacy){const l=s.filterArea;l[0]=e.destinationFrame.width,l[1]=e.destinationFrame.height,l[2]=e.sourceFrame.x,l[3]=e.sourceFrame.y,s.filterClamp=s.inputClamp}this.globalUniforms.update();const h=t[t.length-1];if(this.renderer.framebuffer.blit(),i.length===1)i[0].apply(this,e.renderTexture,h.renderTexture,xi.BLEND,e),this.returnFilterTexture(e.renderTexture);else{let l=e.renderTexture,u=this.getOptimalFilterTexture(l.width,l.height,e.resolution);u.filterFrame=l.filterFrame;let c=0;for(c=0;c<i.length-1;++c){c===1&&e.multisample>1&&(u=this.getOptimalFilterTexture(l.width,l.height,e.resolution),u.filterFrame=l.filterFrame),i[c].apply(this,l,u,xi.CLEAR,e);const d=l;l=u,u=d}i[c].apply(this,l,h.renderTexture,xi.BLEND,e),c>1&&e.multisample>1&&this.returnFilterTexture(e.renderTexture),this.returnFilterTexture(l),this.returnFilterTexture(u)}e.clear(),this.statePool.push(e)}bindAndClear(t,e=xi.CLEAR){const{renderTexture:i,state:s}=this.renderer;if(t===this.defaultFilterStack[this.defaultFilterStack.length-1].renderTexture?this.renderer.projection.transform=this.activeState.transform:this.renderer.projection.transform=null,t==null?void 0:t.filterFrame){const o=this.tempRect;o.x=0,o.y=0,o.width=t.filterFrame.width,o.height=t.filterFrame.height,i.bind(t,t.filterFrame,o)}else t!==this.defaultFilterStack[this.defaultFilterStack.length-1].renderTexture?i.bind(t):this.renderer.renderTexture.bind(t,this.activeState.bindingSourceFrame,this.activeState.bindingDestinationFrame);const n=s.stateId&1||this.forceClear;(e===xi.CLEAR||e===xi.BLIT&&n)&&this.renderer.framebuffer.clear(0,0,0,0)}applyFilter(t,e,i,s){const n=this.renderer;n.state.set(t.state),this.bindAndClear(i,s),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(yi.TRIANGLES)):(n.geometry.bind(this.quad),n.geometry.draw(yi.TRIANGLE_STRIP))}calculateSpriteMatrix(t,e){const{sourceFrame:i,destinationFrame:s}=this.activeState,{orig:n}=e._texture,o=t.set(s.width,0,0,s.height,i.x,i.y),a=e.worldTransform.copyTo(Gt.TEMP_MATRIX);return a.invert(),o.prepend(a),o.scale(1/n.width,1/n.height),o.translate(e.anchor.x,e.anchor.y),o}destroy(){this.renderer=null,this.texturePool.clear(!1)}getOptimalFilterTexture(t,e,i=1,s=Yt.NONE){return this.texturePool.getOptimalTexture(t,e,i,s)}getFilterTexture(t,e,i){if(typeof t=="number"){const n=t;t=e,e=n}t=t||this.activeState.renderTexture;const s=this.texturePool.getOptimalTexture(t.width,t.height,e||t.resolution,i||Yt.NONE);return s.filterFrame=t.filterFrame,s}returnFilterTexture(t){this.texturePool.returnTexture(t)}emptyPool(){this.texturePool.clear(!0)}resize(){this.texturePool.setScreenSize(this.renderer.view)}transformAABB(t,e){const i=Sa[0],s=Sa[1],n=Sa[2],o=Sa[3];i.set(e.left,e.top),s.set(e.left,e.bottom),n.set(e.right,e.top),o.set(e.right,e.bottom),t.apply(i,i),t.apply(s,s),t.apply(n,n),t.apply(o,o);const a=Math.min(i.x,s.x,n.x,o.x),h=Math.min(i.y,s.y,n.y,o.y),l=Math.max(i.x,s.x,n.x,o.x),u=Math.max(i.y,s.y,n.y,o.y);e.x=a,e.y=h,e.width=l-a,e.height=u-h}roundFrame(t,e,i,s,n){if(!(t.width<=0||t.height<=0||i.width<=0||i.height<=0)){if(n){const{a:o,b:a,c:h,d:l}=n;if((Math.abs(a)>1e-4||Math.abs(h)>1e-4)&&(Math.abs(o)>1e-4||Math.abs(l)>1e-4))return}n=n?_u.copyFrom(n):_u.identity(),n.translate(-i.x,-i.y).scale(s.width/i.width,s.height/i.height).translate(s.x,s.y),this.transformAABB(n,t),t.ceil(e),this.transformAABB(n.invert(),t)}}}am.extension={type:z.RendererSystem,name:"filter"},tt.add(am);class pv{constructor(t){this.framebuffer=t,this.stencil=null,this.dirtyId=-1,this.dirtyFormat=-1,this.dirtySize=-1,this.multisample=Yt.NONE,this.msaaBuffer=null,this.blitFramebuffer=null,this.mipLevel=0}}const fv=new ct;class hm{constructor(t){this.renderer=t,this.managedFramebuffers=[],this.unknownFramebuffer=new bu(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 ct,this.hasMRT=!0,this.writeDepthTexture=!0,this.renderer.context.webGLVersion===1){let e=this.renderer.context.extensions.drawBuffers,i=this.renderer.context.extensions.depthTexture;$.PREFER_ENV===Or.WEBGL_LEGACY&&(e=null,i=null),e?t.drawBuffers=s=>e.drawBuffersWEBGL(s):(this.hasMRT=!1,t.drawBuffers=()=>{}),i||(this.writeDepthTexture=!1)}else this.msaaSamples=t.getInternalformatParameter(t.RENDERBUFFER,t.RGBA8,t.SAMPLES)}bind(t,e,i=0){const{gl:s}=this;if(t){const n=t.glFramebuffers[this.CONTEXT_UID]||this.initFramebuffer(t);this.current!==t&&(this.current=t,s.bindFramebuffer(s.FRAMEBUFFER,n.framebuffer)),n.mipLevel!==i&&(t.dirtyId++,t.dirtyFormat++,n.mipLevel=i),n.dirtyId!==t.dirtyId&&(n.dirtyId=t.dirtyId,n.dirtyFormat!==t.dirtyFormat?(n.dirtyFormat=t.dirtyFormat,n.dirtySize=t.dirtySize,this.updateFramebuffer(t,i)):n.dirtySize!==t.dirtySize&&(n.dirtySize=t.dirtySize,this.resizeFramebuffer(t)));for(let o=0;o<t.colorTextures.length;o++){const a=t.colorTextures[o];this.renderer.texture.unbind(a.parentTextureArray||a)}if(t.depthTexture&&this.renderer.texture.unbind(t.depthTexture),e){const o=e.width>>i,a=e.height>>i,h=o/e.width;this.setViewport(e.x*h,e.y*h,o,a)}else{const o=t.width>>i,a=t.height>>i;this.setViewport(0,0,o,a)}}else this.current&&(this.current=null,s.bindFramebuffer(s.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,i,s){const n=this.viewport;t=Math.round(t),e=Math.round(e),i=Math.round(i),s=Math.round(s),(n.width!==i||n.height!==s||n.x!==t||n.y!==e)&&(n.x=t,n.y=e,n.width=i,n.height=s,this.gl.viewport(t,e,i,s))}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,i,s,n=cl.COLOR|cl.DEPTH){const{gl:o}=this;o.clearColor(t,e,i,s),o.clear(n)}initFramebuffer(t){const{gl:e}=this,i=new pv(e.createFramebuffer());return i.multisample=this.detectSamples(t.multisample),t.glFramebuffers[this.CONTEXT_UID]=i,this.managedFramebuffers.push(t),t.disposeRunner.add(this),i}resizeFramebuffer(t){const{gl:e}=this,i=t.glFramebuffers[this.CONTEXT_UID];if(i.stencil){e.bindRenderbuffer(e.RENDERBUFFER,i.stencil);let o;this.renderer.context.webGLVersion===1?o=e.DEPTH_STENCIL:t.depth&&t.stencil?o=e.DEPTH24_STENCIL8:t.depth?o=e.DEPTH_COMPONENT24:o=e.STENCIL_INDEX8,i.msaaBuffer?e.renderbufferStorageMultisample(e.RENDERBUFFER,i.multisample,o,t.width,t.height):e.renderbufferStorage(e.RENDERBUFFER,o,t.width,t.height)}const s=t.colorTextures;let n=s.length;e.drawBuffers||(n=Math.min(n,1));for(let o=0;o<n;o++){const a=s[o],h=a.parentTextureArray||a;this.renderer.texture.bind(h,0),o===0&&i.msaaBuffer&&(e.bindRenderbuffer(e.RENDERBUFFER,i.msaaBuffer),e.renderbufferStorageMultisample(e.RENDERBUFFER,i.multisample,h._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:i}=this,s=t.glFramebuffers[this.CONTEXT_UID],n=t.colorTextures;let o=n.length;i.drawBuffers||(o=Math.min(o,1)),s.multisample>1&&this.canMultisampleFramebuffer(t)?s.msaaBuffer=s.msaaBuffer||i.createRenderbuffer():s.msaaBuffer&&(i.deleteRenderbuffer(s.msaaBuffer),s.msaaBuffer=null,s.blitFramebuffer&&(s.blitFramebuffer.dispose(),s.blitFramebuffer=null));const a=[];for(let h=0;h<o;h++){const l=n[h],u=l.parentTextureArray||l;this.renderer.texture.bind(u,0),h===0&&s.msaaBuffer?(i.bindRenderbuffer(i.RENDERBUFFER,s.msaaBuffer),i.renderbufferStorageMultisample(i.RENDERBUFFER,s.multisample,u._glTextures[this.CONTEXT_UID].internalFormat,t.width,t.height),i.framebufferRenderbuffer(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0,i.RENDERBUFFER,s.msaaBuffer)):(i.framebufferTexture2D(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0+h,l.target,u._glTextures[this.CONTEXT_UID].texture,e),a.push(i.COLOR_ATTACHMENT0+h))}if(a.length>1&&i.drawBuffers(a),t.depthTexture&&this.writeDepthTexture){const h=t.depthTexture;this.renderer.texture.bind(h,0),i.framebufferTexture2D(i.FRAMEBUFFER,i.DEPTH_ATTACHMENT,i.TEXTURE_2D,h._glTextures[this.CONTEXT_UID].texture,e)}if((t.stencil||t.depth)&&!(t.depthTexture&&this.writeDepthTexture)){s.stencil=s.stencil||i.createRenderbuffer();let h,l;this.renderer.context.webGLVersion===1?(h=i.DEPTH_STENCIL_ATTACHMENT,l=i.DEPTH_STENCIL):t.depth&&t.stencil?(h=i.DEPTH_STENCIL_ATTACHMENT,l=i.DEPTH24_STENCIL8):t.depth?(h=i.DEPTH_ATTACHMENT,l=i.DEPTH_COMPONENT24):(h=i.STENCIL_ATTACHMENT,l=i.STENCIL_INDEX8),i.bindRenderbuffer(i.RENDERBUFFER,s.stencil),s.msaaBuffer?i.renderbufferStorageMultisample(i.RENDERBUFFER,s.multisample,l,t.width,t.height):i.renderbufferStorage(i.RENDERBUFFER,l,t.width,t.height),i.framebufferRenderbuffer(i.FRAMEBUFFER,h,i.RENDERBUFFER,s.stencil)}else s.stencil&&(i.deleteRenderbuffer(s.stencil),s.stencil=null)}canMultisampleFramebuffer(t){return this.renderer.context.webGLVersion!==1&&t.colorTextures.length<=1&&!t.depthTexture}detectSamples(t){const{msaaSamples:e}=this;let i=Yt.NONE;if(t<=1||e===null)return i;for(let s=0;s<e.length;s++)if(e[s]<=t){i=e[s];break}return i===1&&(i=Yt.NONE),i}blit(t,e,i){const{current:s,renderer:n,gl:o,CONTEXT_UID:a}=this;if(n.context.webGLVersion!==2||!s)return;const h=s.glFramebuffers[a];if(!h)return;if(!t){if(!h.msaaBuffer)return;const u=s.colorTextures[0];if(!u)return;h.blitFramebuffer||(h.blitFramebuffer=new bu(s.width,s.height),h.blitFramebuffer.addColorTexture(0,u)),t=h.blitFramebuffer,t.colorTextures[0]!==u&&(t.colorTextures[0]=u,t.dirtyId++,t.dirtyFormat++),(t.width!==s.width||t.height!==s.height)&&(t.width=s.width,t.height=s.height,t.dirtyId++,t.dirtySize++)}e||(e=fv,e.width=s.width,e.height=s.height),i||(i=e);const l=e.width===i.width&&e.height===i.height;this.bind(t),o.bindFramebuffer(o.READ_FRAMEBUFFER,h.framebuffer),o.blitFramebuffer(e.left,e.top,e.right,e.bottom,i.left,i.top,i.right,i.bottom,o.COLOR_BUFFER_BIT,l?o.NEAREST:o.LINEAR),o.bindFramebuffer(o.READ_FRAMEBUFFER,t.glFramebuffers[this.CONTEXT_UID].framebuffer)}disposeFramebuffer(t,e){const i=t.glFramebuffers[this.CONTEXT_UID],s=this.gl;if(!i)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||(s.deleteFramebuffer(i.framebuffer),i.msaaBuffer&&s.deleteRenderbuffer(i.msaaBuffer),i.stencil&&s.deleteRenderbuffer(i.stencil)),i.blitFramebuffer&&this.disposeFramebuffer(i.blitFramebuffer,e)}disposeAll(t){const e=this.managedFramebuffers;this.managedFramebuffers=[];for(let i=0;i<e.length;i++)this.disposeFramebuffer(e[i],t)}forceStencil(){const t=this.current;if(!t)return;const e=t.glFramebuffers[this.CONTEXT_UID];if(!e||e.stencil&&t.stencil)return;t.stencil=!0;const i=t.width,s=t.height,n=this.gl,o=e.stencil=n.createRenderbuffer();n.bindRenderbuffer(n.RENDERBUFFER,o);let a,h;this.renderer.context.webGLVersion===1?(a=n.DEPTH_STENCIL_ATTACHMENT,h=n.DEPTH_STENCIL):t.depth?(a=n.DEPTH_STENCIL_ATTACHMENT,h=n.DEPTH24_STENCIL8):(a=n.STENCIL_ATTACHMENT,h=n.STENCIL_INDEX8),e.msaaBuffer?n.renderbufferStorageMultisample(n.RENDERBUFFER,e.multisample,h,i,s):n.renderbufferStorage(n.RENDERBUFFER,h,i,s),n.framebufferRenderbuffer(n.FRAMEBUFFER,a,n.RENDERBUFFER,o)}reset(){this.current=this.unknownFramebuffer,this.viewport=new ct}destroy(){this.renderer=null}}hm.extension={type:z.RendererSystem,name:"framebuffer"},tt.add(hm);const vu={5126:4,5123:2,5121:1};class lm{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,e.webGLVersion!==2){let i=this.renderer.context.extensions.vertexArrayObject;$.PREFER_ENV===Or.WEBGL_LEGACY&&(i=null),i?(t.createVertexArray=()=>i.createVertexArrayOES(),t.bindVertexArray=s=>i.bindVertexArrayOES(s),t.deleteVertexArray=s=>i.deleteVertexArrayOES(s)):(this.hasVao=!1,t.createVertexArray=()=>null,t.bindVertexArray=()=>null,t.deleteVertexArray=()=>null)}if(e.webGLVersion!==2){const i=t.getExtension("ANGLE_instanced_arrays");i?(t.vertexAttribDivisor=(s,n)=>i.vertexAttribDivisorANGLE(s,n),t.drawElementsInstanced=(s,n,o,a,h)=>i.drawElementsInstancedANGLE(s,n,o,a,h),t.drawArraysInstanced=(s,n,o,a)=>i.drawArraysInstancedANGLE(s,n,o,a)):this.hasInstance=!1}this.canUseUInt32ElementIndex=e.webGLVersion===2||!!e.extensions.uint32ElementIndex}bind(t,e){e=e||this.renderer.shader.shader;const{gl:i}=this;let s=t.glVertexArrayObjects[this.CONTEXT_UID],n=!1;s||(this.managedGeometries[t.id]=t,t.disposeRunner.add(this),t.glVertexArrayObjects[this.CONTEXT_UID]=s={},n=!0);const o=s[e.program.id]||this.initGeometryVao(t,e,n);this._activeGeometry=t,this._activeVao!==o&&(this._activeVao=o,this.hasVao?i.bindVertexArray(o):this.activateVao(t,e.program)),this.updateBuffers()}reset(){this.unbind()}updateBuffers(){const t=this._activeGeometry,e=this.renderer.buffer;for(let i=0;i<t.buffers.length;i++){const s=t.buffers[i];e.update(s)}}checkCompatibility(t,e){const i=t.attributes,s=e.attributeData;for(const n in s)if(!i[n])throw new Error(`shader and geometry incompatible, geometry missing the "${n}" attribute`)}getSignature(t,e){const i=t.attributes,s=e.attributeData,n=["g",t.id];for(const o in i)s[o]&&n.push(o,s[o].location);return n.join("-")}initGeometryVao(t,e,i=!0){const s=this.gl,n=this.CONTEXT_UID,o=this.renderer.buffer,a=e.program;a.glPrograms[n]||this.renderer.shader.generateProgram(e),this.checkCompatibility(t,a);const h=this.getSignature(t,a),l=t.glVertexArrayObjects[this.CONTEXT_UID];let u=l[h];if(u)return l[a.id]=u,u;const c=t.buffers,d=t.attributes,p={},m={};for(const f in c)p[f]=0,m[f]=0;for(const f in d)!d[f].size&&a.attributeData[f]?d[f].size=a.attributeData[f].size:d[f].size||console.warn(`PIXI Geometry attribute '${f}' size cannot be determined (likely the bound shader does not have the attribute)`),p[d[f].buffer]+=d[f].size*vu[d[f].type];for(const f in d){const g=d[f],y=g.size;g.stride===void 0&&(p[g.buffer]===y*vu[g.type]?g.stride=0:g.stride=p[g.buffer]),g.start===void 0&&(g.start=m[g.buffer],m[g.buffer]+=y*vu[g.type])}u=s.createVertexArray(),s.bindVertexArray(u);for(let f=0;f<c.length;f++){const g=c[f];o.bind(g),i&&g._glBuffers[n].refCount++}return this.activateVao(t,a),l[a.id]=u,l[h]=u,s.bindVertexArray(null),o.unbind(_i.ARRAY_BUFFER),u}disposeGeometry(t,e){var a;if(!this.managedGeometries[t.id])return;delete this.managedGeometries[t.id];const i=t.glVertexArrayObjects[this.CONTEXT_UID],s=this.gl,n=t.buffers,o=(a=this.renderer)==null?void 0:a.buffer;if(t.disposeRunner.remove(this),!!i){if(o)for(let h=0;h<n.length;h++){const l=n[h]._glBuffers[this.CONTEXT_UID];l&&(l.refCount--,l.refCount===0&&!e&&o.dispose(n[h],e))}if(!e){for(const h in i)if(h[0]==="g"){const l=i[h];this._activeVao===l&&this.unbind(),s.deleteVertexArray(l)}}delete t.glVertexArrayObjects[this.CONTEXT_UID]}}disposeAll(t){const e=Object.keys(this.managedGeometries);for(let i=0;i<e.length;i++)this.disposeGeometry(this.managedGeometries[e[i]],t)}activateVao(t,e){const i=this.gl,s=this.CONTEXT_UID,n=this.renderer.buffer,o=t.buffers,a=t.attributes;t.indexBuffer&&n.bind(t.indexBuffer);let h=null;for(const l in a){const u=a[l],c=o[u.buffer],d=c._glBuffers[s];if(e.attributeData[l]){h!==d&&(n.bind(c),h=d);const p=e.attributeData[l].location;if(i.enableVertexAttribArray(p),i.vertexAttribPointer(p,u.size,u.type||i.FLOAT,u.normalized,u.stride,u.start),u.instance)if(this.hasInstance)i.vertexAttribDivisor(p,u.divisor);else throw new Error("geometry error, GPU Instancing is not supported on this device")}}}draw(t,e,i,s){const{gl:n}=this,o=this._activeGeometry;if(o.indexBuffer){const a=o.indexBuffer.data.BYTES_PER_ELEMENT,h=a===2?n.UNSIGNED_SHORT:n.UNSIGNED_INT;a===2||a===4&&this.canUseUInt32ElementIndex?o.instanced?n.drawElementsInstanced(t,e||o.indexBuffer.data.length,h,(i||0)*a,s||1):n.drawElements(t,e||o.indexBuffer.data.length,h,(i||0)*a):console.warn("unsupported index buffer type: uint32")}else o.instanced?n.drawArraysInstanced(t,i,e||o.getSize(),s||1):n.drawArrays(t,i,e||o.getSize());return this}unbind(){this.gl.bindVertexArray(null),this._activeVao=null,this._activeGeometry=null}destroy(){this.renderer=null}}lm.extension={type:z.RendererSystem,name:"geometry"},tt.add(lm);const um=new Gt;class cm{constructor(t,e){this._texture=t,this.mapCoord=new Gt,this.uClampFrame=new Float32Array(4),this.uClampOffset=new Float32Array(2),this._textureID=-1,this._updateID=0,this.clampOffset=0,this.clampMargin=typeof e>"u"?.5:e,this.isSimple=!1}get texture(){return this._texture}set texture(t){this._texture=t,this._textureID=-1}multiplyUvs(t,e){e===void 0&&(e=t);const i=this.mapCoord;for(let s=0;s<t.length;s+=2){const n=t[s],o=t[s+1];e[s]=n*i.a+o*i.c+i.tx,e[s+1]=n*i.b+o*i.d+i.ty}return e}update(t){const e=this._texture;if(!e||!e.valid||!t&&this._textureID===e._updateID)return!1;this._textureID=e._updateID,this._updateID++;const i=e._uvs;this.mapCoord.set(i.x1-i.x0,i.y1-i.y0,i.x3-i.x0,i.y3-i.y0,i.x0,i.y0);const s=e.orig,n=e.trim;n&&(um.set(s.width/n.width,0,0,s.height/n.height,-n.x/n.width,-n.y/n.height),this.mapCoord.append(um));const o=e.baseTexture,a=this.uClampFrame,h=this.clampMargin/o.resolution,l=this.clampOffset;return a[0]=(e._frame.x+h+l)/o.width,a[1]=(e._frame.y+h+l)/o.height,a[2]=(e._frame.x+e._frame.width-h+l)/o.width,a[3]=(e._frame.y+e._frame.height-h+l)/o.height,this.uClampOffset[0]=l/o.realWidth,this.uClampOffset[1]=l/o.realHeight,this.isSimple=e._frame.width===o.width&&e._frame.height===o.height&&e.rotate===0,!0}}var mv=`varying vec2 vMaskCoord;
|
|
378
|
+
`;const yu=class Xo extends Ei{constructor(t,e,i){const s=tr.from(t||Xo.defaultVertexSrc,e||Xo.defaultFragmentSrc);super(s,i),this.padding=0,this.resolution=Xo.defaultResolution,this.multisample=Xo.defaultMultisample,this.enabled=!0,this.autoFit=!0,this.state=new Si}apply(t,e,i,s,n){t.applyFilter(this,e,i,s)}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 pv}static get defaultFragmentSrc(){return dv}};yu.defaultResolution=1,yu.defaultMultisample=Yt.NONE;let ye=yu;class Ta{constructor(){this.clearBeforeRender=!0,this._backgroundColor=new Gt(0),this.alpha=1}init(t){this.clearBeforeRender=t.clearBeforeRender;const{backgroundColor:e,background:i,backgroundAlpha:s}=t,n=i??e;n!==void 0&&(this.color=n),this.alpha=s}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(){}}Ta.defaultOptions={backgroundAlpha:1,backgroundColor:0,clearBeforeRender:!0},Ta.extension={type:[J.RendererSystem,J.CanvasRendererSystem],name:"background"},et.add(Ta);class rm{constructor(t){this.renderer=t,this.emptyRenderer=new va(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:i}=this.renderer.texture;for(let s=e-1;s>=0;--s)t[s]=i[s]||null,t[s]&&(t[s]._batchLocation=s)}boundArray(t,e,i,s){const{elements:n,ids:o,count:a}=t;let h=0;for(let l=0;l<a;l++){const u=n[l],c=u._batchLocation;if(c>=0&&c<s&&e[c]===u){o[l]=c;continue}for(;h<s;){const d=e[h];if(d&&d._batchEnabled===i&&d._batchLocation===h){h++;continue}o[l]=h,u._batchLocation=h,e[h]=u;break}}}destroy(){this.renderer=null}}rm.extension={type:J.RendererSystem,name:"batch"},et.add(rm);let sm=0;class wa{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=sm++}init(t){if(t.context)this.initFromContext(t.context);else{const e=this.renderer.background.alpha<1,i=t.premultipliedAlpha;this.preserveDrawingBuffer=t.preserveDrawingBuffer,this.useContextAlpha=t.useContextAlpha,this.powerPreference=t.powerPreference,this.initFromOptions({alpha:e,premultipliedAlpha:i,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=sm++,this.renderer.runners.contextChange.emit(t);const e=this.renderer.view;e.addEventListener!==void 0&&(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 i;if(Q.PREFER_ENV>=Ur.WEBGL2&&(i=t.getContext("webgl2",e)),i)this.webGLVersion=2;else if(this.webGLVersion=1,i=t.getContext("webgl",e)||t.getContext("experimental-webgl",e),!i)throw new Error("This browser does not support WebGL. Try using the canvas renderer");return this.gl=i,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")};this.webGLVersion===1?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")}):this.webGLVersion===2&&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,t.removeEventListener!==void 0&&(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(),i="WebGL2RenderingContext"in globalThis&&t instanceof globalThis.WebGL2RenderingContext;i&&(this.webGLVersion=2),e&&!e.stencil&&console.warn("Provided WebGL context does not have a stencil buffer, masks may not render correctly");const s=i||!!t.getExtension("OES_element_index_uint");this.supports.uint32Indices=s,s||console.warn("Provided WebGL context does not support 32 index buffer, complex graphics may not render correctly")}}wa.defaultOptions={context:null,antialias:!1,premultipliedAlpha:!0,preserveDrawingBuffer:!1,powerPreference:"default"},wa.extension={type:J.RendererSystem,name:"context"},et.add(wa);class bu{constructor(t,e){if(this.width=Math.round(t),this.height=Math.round(e),!this.width||!this.height)throw new Error("Framebuffer width or height is zero");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 ii("disposeFramebuffer"),this.multisample=Yt.NONE}get colorTexture(){return this.colorTextures[0]}addColorTexture(t=0,e){return this.colorTextures[t]=e||new ft(null,{scaleMode:Hi.NEAREST,resolution:1,mipmap:yi.OFF,width:this.width,height:this.height}),this.dirtyId++,this.dirtyFormat++,this}addDepthTexture(t){return this.depthTexture=t||new ft(null,{scaleMode:Hi.NEAREST,resolution:1,width:this.width,height:this.height,mipmap:yi.OFF,format:K.DEPTH_COMPONENT,type:at.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||!e)throw new Error("Framebuffer width and height must not be zero");if(!(t===this.width&&e===this.height)){this.width=t,this.height=e,this.dirtyId++,this.dirtySize++;for(let i=0;i<this.colorTextures.length;i++){const s=this.colorTextures[i],n=s.resolution;s.setSize(t/n,e/n)}if(this.depthTexture){const i=this.depthTexture.resolution;this.depthTexture.setSize(t/i,e/i)}}}dispose(){this.disposeRunner.emit(this,!1)}destroyDepthTexture(){this.depthTexture&&(this.depthTexture.destroy(),this.depthTexture=null,++this.dirtyId,++this.dirtyFormat)}}class nm extends ft{constructor(t={}){if(typeof t=="number"){const e=arguments[0],i=arguments[1],s=arguments[2],n=arguments[3];t={width:e,height:i,scaleMode:s,resolution:n}}t.width=t.width??100,t.height=t.height??100,t.multisample??(t.multisample=Yt.NONE),super(null,t),this.mipmap=yi.OFF,this.valid=!0,this._clear=new Gt([0,0,0,0]),this.framebuffer=new bu(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}get multisample(){return this.framebuffer.multisample}set multisample(t){this.framebuffer.multisample=t}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 _r extends Hn{constructor(t){const e=t,i=e.naturalWidth||e.videoWidth||e.width,s=e.naturalHeight||e.videoHeight||e.height;super(i,s),this.source=t,this.noSubImage=!1}static crossOrigin(t,e,i){i===void 0&&!e.startsWith("data:")?t.crossOrigin=D1(e):i!==!1&&(t.crossOrigin=typeof i=="string"?i:"anonymous")}upload(t,e,i,s){const n=t.gl,o=e.realWidth,a=e.realHeight;if(s=s||this.source,typeof HTMLImageElement<"u"&&s instanceof HTMLImageElement){if(!s.complete||s.naturalWidth===0)return!1}else if(typeof HTMLVideoElement<"u"&&s instanceof HTMLVideoElement&&s.readyState<=1)return!1;return n.pixelStorei(n.UNPACK_PREMULTIPLY_ALPHA_WEBGL,e.alphaMode===xe.UNPACK),!this.noSubImage&&e.target===n.TEXTURE_2D&&i.width===o&&i.height===a?n.texSubImage2D(n.TEXTURE_2D,0,0,0,e.format,i.type,s):(i.width=o,i.height=a,n.texImage2D(e.target,0,i.internalFormat,e.format,i.type,s)),!0}update(){if(this.destroyed)return;const t=this.source,e=t.naturalWidth||t.videoWidth||t.width,i=t.naturalHeight||t.videoHeight||t.height;this.resize(e,i),super.update()}dispose(){this.source=null}}class om extends _r{constructor(t,e){if(e=e||{},typeof t=="string"){const i=new Image;_r.crossOrigin(i,t,e.crossorigin),i.src=t,t=i}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??Q.CREATE_IMAGE_BITMAP)&&!!globalThis.createImageBitmap,this.alphaMode=typeof e.alphaMode=="number"?e.alphaMode:null,this.bitmap=null,this._load=null,e.autoLoad!==!1&&this.load()}load(t){return this._load?this._load:(t!==void 0&&(this.createBitmap=t),this._load=new Promise((e,i)=>{const s=this.source;this.url=s.src;const n=()=>{this.destroyed||(s.onload=null,s.onerror=null,this.update(),this._load=null,this.createBitmap?e(this.process()):e(this))};s.complete&&s.src?n():(s.onload=n,s.onerror=o=>{i(o),this.onError.emit(o)})}),this._load)}process(){const t=this.source;if(this._process!==null)return this._process;if(this.bitmap!==null||!globalThis.createImageBitmap)return Promise.resolve(this);const e=globalThis.createImageBitmap,i=!t.crossOrigin||t.crossOrigin==="anonymous";return this._process=fetch(t.src,{mode:i?"cors":"no-cors"}).then(s=>s.blob()).then(s=>e(s,0,0,t.width,t.height,{premultiplyAlpha:this.alphaMode===null||this.alphaMode===xe.UNPACK?"premultiply":"none"})).then(s=>this.destroyed?Promise.reject():(this.bitmap=s,this.update(),this._process=null,Promise.resolve(this))),this._process}upload(t,e,i){if(typeof this.alphaMode=="number"&&(e.alphaMode=this.alphaMode),!this.createBitmap)return super.upload(t,e,i);if(!this.bitmap&&(this.process(),!this.bitmap))return!1;if(super.upload(t,e,i,this.bitmap),!this.preserveBitmap){let s=!0;const n=e._glTextures;for(const o in n){const a=n[o];if(a!==i&&a.dirtyId!==e.dirtyId){s=!1;break}}s&&(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 typeof HTMLImageElement<"u"&&(typeof t=="string"||t instanceof HTMLImageElement)}}class xu{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,i){const s=e.width,n=e.height;if(i){const o=t.width/2/s,a=t.height/2/n,h=t.x/s+o,l=t.y/n+a;i=kt.add(i,kt.NW),this.x0=h+o*kt.uX(i),this.y0=l+a*kt.uY(i),i=kt.add(i,2),this.x1=h+o*kt.uX(i),this.y1=l+a*kt.uY(i),i=kt.add(i,2),this.x2=h+o*kt.uX(i),this.y2=l+a*kt.uY(i),i=kt.add(i,2),this.x3=h+o*kt.uX(i),this.y3=l+a*kt.uY(i)}else this.x0=t.x/s,this.y0=t.y/n,this.x1=(t.x+t.width)/s,this.y1=t.y/n,this.x2=(t.x+t.width)/s,this.y2=(t.y+t.height)/n,this.x3=t.x/s,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}}xu.prototype.toString=function(){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 am=new xu;function Sa(r){r.destroy=function(){},r.on=function(){},r.once=function(){},r.emit=function(){}}class rt extends Nn{constructor(t,e,i,s,n,o,a){if(super(),this.noFrame=!1,e||(this.noFrame=!0,e=new ct(0,0,1,1)),t instanceof rt&&(t=t.baseTexture),this.baseTexture=t,this._frame=e,this.trim=s,this.valid=!1,this.destroyed=!1,this._uvs=am,this.uvMatrix=null,this.orig=i||e,this._rotate=Number(n||0),n===!0)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=o?new lt(o.x,o.y):new lt(0,0),this.defaultBorders=a,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:e}=this.baseTexture;e!=null&&e.url&&wi[e.url]&&rt.removeFromCache(e.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,rt.removeFromCache(this),this.textureCacheIds=null,this.destroyed=!0,this.emit("destroyed",this),this.removeAllListeners()}clone(){var s;const t=this._frame.clone(),e=this._frame===this.orig?t:this.orig.clone(),i=new rt(this.baseTexture,!this.noFrame&&t,e,(s=this.trim)==null?void 0:s.clone(),this.rotate,this.defaultAnchor,this.defaultBorders);return this.noFrame&&(i._frame=t),i}updateUvs(){this._uvs===am&&(this._uvs=new xu),this._uvs.set(this._frame,this.baseTexture,this.rotate),this._updateID++}static from(t,e={},i=Q.STRICT_TEXTURE_CACHE){const s=typeof t=="string";let n=null;if(s)n=t;else if(t instanceof ft){if(!t.cacheId){const a=(e==null?void 0:e.pixiIdPrefix)||"pixiid";t.cacheId=`${a}-${Kr()}`,ft.addToCache(t,t.cacheId)}n=t.cacheId}else{if(!t._pixiId){const a=(e==null?void 0:e.pixiIdPrefix)||"pixiid";t._pixiId=`${a}_${Kr()}`}n=t._pixiId}let o=wi[n];if(s&&i&&!o)throw new Error(`The cacheId "${n}" does not exist in TextureCache.`);return!o&&!(t instanceof ft)?(e.resolution||(e.resolution=Qi(t)),o=new rt(new ft(t,e)),o.baseTexture.cacheId=n,ft.addToCache(o.baseTexture,n),rt.addToCache(o,n)):!o&&t instanceof ft&&(o=new rt(t),rt.addToCache(o,n)),o}static fromURL(t,e){const i=Object.assign({autoLoad:!1},e==null?void 0:e.resourceOptions),s=rt.from(t,Object.assign({resourceOptions:i},e),!1),n=s.baseTexture.resource;return s.baseTexture.valid?Promise.resolve(s):n.load().then(()=>Promise.resolve(s))}static fromBuffer(t,e,i,s){return new rt(ft.fromBuffer(t,e,i,s))}static fromLoader(t,e,i,s){const n=new ft(t,Object.assign({scaleMode:ft.defaultOptions.scaleMode,resolution:Qi(e)},s)),{resource:o}=n;o instanceof om&&(o.url=e);const a=new rt(n);return i||(i=e),ft.addToCache(a.baseTexture,i),rt.addToCache(a,i),i!==e&&(ft.addToCache(a.baseTexture,e),rt.addToCache(a,e)),a.baseTexture.valid?Promise.resolve(a):new Promise(h=>{a.baseTexture.once("loaded",()=>h(a))})}static addToCache(t,e){e&&(t.textureCacheIds.includes(e)||t.textureCacheIds.push(e),wi[e]&&wi[e]!==t&&console.warn(`Texture added to the cache with an id [${e}] that already had an entry`),wi[e]=t)}static removeFromCache(t){if(typeof t=="string"){const e=wi[t];if(e){const i=e.textureCacheIds.indexOf(t);return i>-1&&e.textureCacheIds.splice(i,1),delete wi[t],e}}else if(t!=null&&t.textureCacheIds){for(let e=0;e<t.textureCacheIds.length;++e)wi[t.textureCacheIds[e]]===t&&delete wi[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:i,width:s,height:n}=t,o=e+s>this.baseTexture.width,a=i+n>this.baseTexture.height;if(o||a){const h=o&&a?"and":"or",l=`X: ${e} + ${s} = ${e+s} > ${this.baseTexture.width}`,u=`Y: ${i} + ${n} = ${i+n} > ${this.baseTexture.height}`;throw new Error(`Texture Error: frame does not fit inside the base Texture dimensions: ${l} ${h} ${u}`)}this.valid=s&&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 rt._EMPTY||(rt._EMPTY=new rt(new ft),Sa(rt._EMPTY),Sa(rt._EMPTY.baseTexture)),rt._EMPTY}static get WHITE(){if(!rt._WHITE){const t=Q.ADAPTER.createCanvas(16,16),e=t.getContext("2d");t.width=16,t.height=16,e.fillStyle="white",e.fillRect(0,0,16,16),rt._WHITE=new rt(ft.from(t)),Sa(rt._WHITE),Sa(rt._WHITE.baseTexture)}return rt._WHITE}}class qr extends rt{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,i=!0){const s=this.baseTexture.resolution,n=Math.round(t*s)/s,o=Math.round(e*s)/s;this.valid=n>0&&o>0,this._frame.width=this.orig.width=n,this._frame.height=this.orig.height=o,i&&this.baseTexture.resize(n,o),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 qr(new nm(t))}}class hm{constructor(t){this.texturePool={},this.textureOptions=t||{},this.enableFullScreen=!1,this._pixelsWidth=0,this._pixelsHeight=0}createTexture(t,e,i=Yt.NONE){const s=new nm(Object.assign({width:t,height:e,resolution:1,multisample:i},this.textureOptions));return new qr(s)}getOptimalTexture(t,e,i=1,s=Yt.NONE){let n;t=Math.max(Math.ceil(t*i-1e-6),1),e=Math.max(Math.ceil(e*i-1e-6),1),!this.enableFullScreen||t!==this._pixelsWidth||e!==this._pixelsHeight?(t=la(t),e=la(e),n=((t&65535)<<16|e&65535)>>>0,s>1&&(n+=s*4294967296)):n=s>1?-s:-1,this.texturePool[n]||(this.texturePool[n]=[]);let o=this.texturePool[n].pop();return o||(o=this.createTexture(t,e,s)),o.filterPoolKey=n,o.setResolution(i),o}getFilterTexture(t,e,i){const s=this.getOptimalTexture(t.width,t.height,e||t.resolution,i||Yt.NONE);return s.filterFrame=t.filterFrame,s}returnTexture(t){const e=t.filterPoolKey;t.filterFrame=null,this.texturePool[e].push(t)}returnFilterTexture(t){this.returnTexture(t)}clear(t){if(t=t!==!1,t)for(const e in this.texturePool){const i=this.texturePool[e];if(i)for(let s=0;s<i.length;s++)i[s].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 e in this.texturePool){if(!(Number(e)<0))continue;const i=this.texturePool[e];if(i)for(let s=0;s<i.length;s++)i[s].destroy(!0);this.texturePool[e]=[]}this._pixelsWidth=t.width,this._pixelsHeight=t.height}}}hm.SCREEN_KEY=-1;class fv extends xr{constructor(){super(),this.addAttribute("aVertexPosition",new Float32Array([0,0,1,0,1,1,0,1])).addIndex([0,1,3,2])}}class lm extends xr{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 Ht(this.vertices),this.uvBuffer=new Ht(this.uvs),this.addAttribute("aVertexPosition",this.vertexBuffer).addAttribute("aTextureCoord",this.uvBuffer).addIndex([0,1,2,0,2,3])}map(t,e){let i=0,s=0;return this.uvs[0]=i,this.uvs[1]=s,this.uvs[2]=i+e.width/t.width,this.uvs[3]=s,this.uvs[4]=i+e.width/t.width,this.uvs[5]=s+e.height/t.height,this.uvs[6]=i,this.uvs[7]=s+e.height/t.height,i=e.x,s=e.y,this.vertices[0]=i,this.vertices[1]=s,this.vertices[2]=i+e.width,this.vertices[3]=s,this.vertices[4]=i+e.width,this.vertices[5]=s+e.height,this.vertices[6]=i,this.vertices[7]=s+e.height,this.invalidate(),this}invalidate(){return this.vertexBuffer._updateID++,this.uvBuffer._updateID++,this}}class mv{constructor(){this.renderTexture=null,this.target=null,this.legacy=!1,this.resolution=1,this.multisample=Yt.NONE,this.sourceFrame=new ct,this.destinationFrame=new ct,this.bindingSourceFrame=new ct,this.bindingDestinationFrame=new ct,this.filters=[],this.transform=null}clear(){this.target=null,this.filters=null,this.renderTexture=null}}const Ea=[new lt,new lt,new lt,new lt],_u=new Nt;class um{constructor(t){this.renderer=t,this.defaultFilterStack=[{}],this.texturePool=new hm,this.statePool=[],this.quad=new fv,this.quadUv=new lm,this.tempRect=new ct,this.activeState={},this.globalUniforms=new ri({outputFrame:new ct,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 i=this.renderer,s=this.defaultFilterStack,n=this.statePool.pop()||new mv,o=i.renderTexture;let a,h;if(o.current){const g=o.current;a=g.resolution,h=g.multisample}else a=i.resolution,h=i.multisample;let l=e[0].resolution||a,u=e[0].multisample??h,c=e[0].padding,d=e[0].autoFit,p=e[0].legacy??!0;for(let g=1;g<e.length;g++){const y=e[g];l=Math.min(l,y.resolution||a),u=Math.min(u,y.multisample??h),c=this.useMaxPadding?Math.max(c,y.padding):c+y.padding,d=d&&y.autoFit,p=p||(y.legacy??!0)}s.length===1&&(this.defaultFilterStack[0].renderTexture=o.current),s.push(n),n.resolution=l,n.multisample=u,n.legacy=p,n.target=t,n.sourceFrame.copyFrom(t.filterArea||t.getBounds(!0)),n.sourceFrame.pad(c);const m=this.tempRect.copyFrom(o.sourceFrame);i.projection.transform&&this.transformAABB(_u.copyFrom(i.projection.transform).invert(),m),d?(n.sourceFrame.fit(m),(n.sourceFrame.width<=0||n.sourceFrame.height<=0)&&(n.sourceFrame.width=0,n.sourceFrame.height=0)):n.sourceFrame.intersects(m)||(n.sourceFrame.width=0,n.sourceFrame.height=0),this.roundFrame(n.sourceFrame,o.current?o.current.resolution:i.resolution,o.sourceFrame,o.destinationFrame,i.projection.transform),n.renderTexture=this.getOptimalFilterTexture(n.sourceFrame.width,n.sourceFrame.height,l,u),n.filters=e,n.destinationFrame.width=n.renderTexture.width,n.destinationFrame.height=n.renderTexture.height;const f=this.tempRect;f.x=0,f.y=0,f.width=n.sourceFrame.width,f.height=n.sourceFrame.height,n.renderTexture.filterFrame=n.sourceFrame,n.bindingSourceFrame.copyFrom(o.sourceFrame),n.bindingDestinationFrame.copyFrom(o.destinationFrame),n.transform=i.projection.transform,i.projection.transform=null,o.bind(n.renderTexture,n.sourceFrame,f),i.framebuffer.clear(0,0,0,0)}pop(){const t=this.defaultFilterStack,e=t.pop(),i=e.filters;this.activeState=e;const s=this.globalUniforms.uniforms;s.outputFrame=e.sourceFrame,s.resolution=e.resolution;const n=s.inputSize,o=s.inputPixel,a=s.inputClamp;if(n[0]=e.destinationFrame.width,n[1]=e.destinationFrame.height,n[2]=1/n[0],n[3]=1/n[1],o[0]=Math.round(n[0]*e.resolution),o[1]=Math.round(n[1]*e.resolution),o[2]=1/o[0],o[3]=1/o[1],a[0]=.5*o[2],a[1]=.5*o[3],a[2]=e.sourceFrame.width*n[2]-.5*o[2],a[3]=e.sourceFrame.height*n[3]-.5*o[3],e.legacy){const l=s.filterArea;l[0]=e.destinationFrame.width,l[1]=e.destinationFrame.height,l[2]=e.sourceFrame.x,l[3]=e.sourceFrame.y,s.filterClamp=s.inputClamp}this.globalUniforms.update();const h=t[t.length-1];if(this.renderer.framebuffer.blit(),i.length===1)i[0].apply(this,e.renderTexture,h.renderTexture,bi.BLEND,e),this.returnFilterTexture(e.renderTexture);else{let l=e.renderTexture,u=this.getOptimalFilterTexture(l.width,l.height,e.resolution);u.filterFrame=l.filterFrame;let c=0;for(c=0;c<i.length-1;++c){c===1&&e.multisample>1&&(u=this.getOptimalFilterTexture(l.width,l.height,e.resolution),u.filterFrame=l.filterFrame),i[c].apply(this,l,u,bi.CLEAR,e);const d=l;l=u,u=d}i[c].apply(this,l,h.renderTexture,bi.BLEND,e),c>1&&e.multisample>1&&this.returnFilterTexture(e.renderTexture),this.returnFilterTexture(l),this.returnFilterTexture(u)}e.clear(),this.statePool.push(e)}bindAndClear(t,e=bi.CLEAR){const{renderTexture:i,state:s}=this.renderer;if(t===this.defaultFilterStack[this.defaultFilterStack.length-1].renderTexture?this.renderer.projection.transform=this.activeState.transform:this.renderer.projection.transform=null,t==null?void 0:t.filterFrame){const o=this.tempRect;o.x=0,o.y=0,o.width=t.filterFrame.width,o.height=t.filterFrame.height,i.bind(t,t.filterFrame,o)}else t!==this.defaultFilterStack[this.defaultFilterStack.length-1].renderTexture?i.bind(t):this.renderer.renderTexture.bind(t,this.activeState.bindingSourceFrame,this.activeState.bindingDestinationFrame);const n=s.stateId&1||this.forceClear;(e===bi.CLEAR||e===bi.BLIT&&n)&&this.renderer.framebuffer.clear(0,0,0,0)}applyFilter(t,e,i,s){const n=this.renderer;n.state.set(t.state),this.bindAndClear(i,s),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(gi.TRIANGLES)):(n.geometry.bind(this.quad),n.geometry.draw(gi.TRIANGLE_STRIP))}calculateSpriteMatrix(t,e){const{sourceFrame:i,destinationFrame:s}=this.activeState,{orig:n}=e._texture,o=t.set(s.width,0,0,s.height,i.x,i.y),a=e.worldTransform.copyTo(Nt.TEMP_MATRIX);return a.invert(),o.prepend(a),o.scale(1/n.width,1/n.height),o.translate(e.anchor.x,e.anchor.y),o}destroy(){this.renderer=null,this.texturePool.clear(!1)}getOptimalFilterTexture(t,e,i=1,s=Yt.NONE){return this.texturePool.getOptimalTexture(t,e,i,s)}getFilterTexture(t,e,i){if(typeof t=="number"){const n=t;t=e,e=n}t=t||this.activeState.renderTexture;const s=this.texturePool.getOptimalTexture(t.width,t.height,e||t.resolution,i||Yt.NONE);return s.filterFrame=t.filterFrame,s}returnFilterTexture(t){this.texturePool.returnTexture(t)}emptyPool(){this.texturePool.clear(!0)}resize(){this.texturePool.setScreenSize(this.renderer.view)}transformAABB(t,e){const i=Ea[0],s=Ea[1],n=Ea[2],o=Ea[3];i.set(e.left,e.top),s.set(e.left,e.bottom),n.set(e.right,e.top),o.set(e.right,e.bottom),t.apply(i,i),t.apply(s,s),t.apply(n,n),t.apply(o,o);const a=Math.min(i.x,s.x,n.x,o.x),h=Math.min(i.y,s.y,n.y,o.y),l=Math.max(i.x,s.x,n.x,o.x),u=Math.max(i.y,s.y,n.y,o.y);e.x=a,e.y=h,e.width=l-a,e.height=u-h}roundFrame(t,e,i,s,n){if(!(t.width<=0||t.height<=0||i.width<=0||i.height<=0)){if(n){const{a:o,b:a,c:h,d:l}=n;if((Math.abs(a)>1e-4||Math.abs(h)>1e-4)&&(Math.abs(o)>1e-4||Math.abs(l)>1e-4))return}n=n?_u.copyFrom(n):_u.identity(),n.translate(-i.x,-i.y).scale(s.width/i.width,s.height/i.height).translate(s.x,s.y),this.transformAABB(n,t),t.ceil(e),this.transformAABB(n.invert(),t)}}}um.extension={type:J.RendererSystem,name:"filter"},et.add(um);class gv{constructor(t){this.framebuffer=t,this.stencil=null,this.dirtyId=-1,this.dirtyFormat=-1,this.dirtySize=-1,this.multisample=Yt.NONE,this.msaaBuffer=null,this.blitFramebuffer=null,this.mipLevel=0}}const yv=new ct;class cm{constructor(t){this.renderer=t,this.managedFramebuffers=[],this.unknownFramebuffer=new bu(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 ct,this.hasMRT=!0,this.writeDepthTexture=!0,this.renderer.context.webGLVersion===1){let e=this.renderer.context.extensions.drawBuffers,i=this.renderer.context.extensions.depthTexture;Q.PREFER_ENV===Ur.WEBGL_LEGACY&&(e=null,i=null),e?t.drawBuffers=s=>e.drawBuffersWEBGL(s):(this.hasMRT=!1,t.drawBuffers=()=>{}),i||(this.writeDepthTexture=!1)}else this.msaaSamples=t.getInternalformatParameter(t.RENDERBUFFER,t.RGBA8,t.SAMPLES)}bind(t,e,i=0){const{gl:s}=this;if(t){const n=t.glFramebuffers[this.CONTEXT_UID]||this.initFramebuffer(t);this.current!==t&&(this.current=t,s.bindFramebuffer(s.FRAMEBUFFER,n.framebuffer)),n.mipLevel!==i&&(t.dirtyId++,t.dirtyFormat++,n.mipLevel=i),n.dirtyId!==t.dirtyId&&(n.dirtyId=t.dirtyId,n.dirtyFormat!==t.dirtyFormat?(n.dirtyFormat=t.dirtyFormat,n.dirtySize=t.dirtySize,this.updateFramebuffer(t,i)):n.dirtySize!==t.dirtySize&&(n.dirtySize=t.dirtySize,this.resizeFramebuffer(t)));for(let o=0;o<t.colorTextures.length;o++){const a=t.colorTextures[o];this.renderer.texture.unbind(a.parentTextureArray||a)}if(t.depthTexture&&this.renderer.texture.unbind(t.depthTexture),e){const o=e.width>>i,a=e.height>>i,h=o/e.width;this.setViewport(e.x*h,e.y*h,o,a)}else{const o=t.width>>i,a=t.height>>i;this.setViewport(0,0,o,a)}}else this.current&&(this.current=null,s.bindFramebuffer(s.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,i,s){const n=this.viewport;t=Math.round(t),e=Math.round(e),i=Math.round(i),s=Math.round(s),(n.width!==i||n.height!==s||n.x!==t||n.y!==e)&&(n.x=t,n.y=e,n.width=i,n.height=s,this.gl.viewport(t,e,i,s))}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,i,s,n=cl.COLOR|cl.DEPTH){const{gl:o}=this;o.clearColor(t,e,i,s),o.clear(n)}initFramebuffer(t){const{gl:e}=this,i=new gv(e.createFramebuffer());return i.multisample=this.detectSamples(t.multisample),t.glFramebuffers[this.CONTEXT_UID]=i,this.managedFramebuffers.push(t),t.disposeRunner.add(this),i}resizeFramebuffer(t){const{gl:e}=this,i=t.glFramebuffers[this.CONTEXT_UID];if(i.stencil){e.bindRenderbuffer(e.RENDERBUFFER,i.stencil);let o;this.renderer.context.webGLVersion===1?o=e.DEPTH_STENCIL:t.depth&&t.stencil?o=e.DEPTH24_STENCIL8:t.depth?o=e.DEPTH_COMPONENT24:o=e.STENCIL_INDEX8,i.msaaBuffer?e.renderbufferStorageMultisample(e.RENDERBUFFER,i.multisample,o,t.width,t.height):e.renderbufferStorage(e.RENDERBUFFER,o,t.width,t.height)}const s=t.colorTextures;let n=s.length;e.drawBuffers||(n=Math.min(n,1));for(let o=0;o<n;o++){const a=s[o],h=a.parentTextureArray||a;this.renderer.texture.bind(h,0),o===0&&i.msaaBuffer&&(e.bindRenderbuffer(e.RENDERBUFFER,i.msaaBuffer),e.renderbufferStorageMultisample(e.RENDERBUFFER,i.multisample,h._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:i}=this,s=t.glFramebuffers[this.CONTEXT_UID],n=t.colorTextures;let o=n.length;i.drawBuffers||(o=Math.min(o,1)),s.multisample>1&&this.canMultisampleFramebuffer(t)?s.msaaBuffer=s.msaaBuffer||i.createRenderbuffer():s.msaaBuffer&&(i.deleteRenderbuffer(s.msaaBuffer),s.msaaBuffer=null,s.blitFramebuffer&&(s.blitFramebuffer.dispose(),s.blitFramebuffer=null));const a=[];for(let h=0;h<o;h++){const l=n[h],u=l.parentTextureArray||l;this.renderer.texture.bind(u,0),h===0&&s.msaaBuffer?(i.bindRenderbuffer(i.RENDERBUFFER,s.msaaBuffer),i.renderbufferStorageMultisample(i.RENDERBUFFER,s.multisample,u._glTextures[this.CONTEXT_UID].internalFormat,t.width,t.height),i.framebufferRenderbuffer(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0,i.RENDERBUFFER,s.msaaBuffer)):(i.framebufferTexture2D(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0+h,l.target,u._glTextures[this.CONTEXT_UID].texture,e),a.push(i.COLOR_ATTACHMENT0+h))}if(a.length>1&&i.drawBuffers(a),t.depthTexture&&this.writeDepthTexture){const h=t.depthTexture;this.renderer.texture.bind(h,0),i.framebufferTexture2D(i.FRAMEBUFFER,i.DEPTH_ATTACHMENT,i.TEXTURE_2D,h._glTextures[this.CONTEXT_UID].texture,e)}if((t.stencil||t.depth)&&!(t.depthTexture&&this.writeDepthTexture)){s.stencil=s.stencil||i.createRenderbuffer();let h,l;this.renderer.context.webGLVersion===1?(h=i.DEPTH_STENCIL_ATTACHMENT,l=i.DEPTH_STENCIL):t.depth&&t.stencil?(h=i.DEPTH_STENCIL_ATTACHMENT,l=i.DEPTH24_STENCIL8):t.depth?(h=i.DEPTH_ATTACHMENT,l=i.DEPTH_COMPONENT24):(h=i.STENCIL_ATTACHMENT,l=i.STENCIL_INDEX8),i.bindRenderbuffer(i.RENDERBUFFER,s.stencil),s.msaaBuffer?i.renderbufferStorageMultisample(i.RENDERBUFFER,s.multisample,l,t.width,t.height):i.renderbufferStorage(i.RENDERBUFFER,l,t.width,t.height),i.framebufferRenderbuffer(i.FRAMEBUFFER,h,i.RENDERBUFFER,s.stencil)}else s.stencil&&(i.deleteRenderbuffer(s.stencil),s.stencil=null)}canMultisampleFramebuffer(t){return this.renderer.context.webGLVersion!==1&&t.colorTextures.length<=1&&!t.depthTexture}detectSamples(t){const{msaaSamples:e}=this;let i=Yt.NONE;if(t<=1||e===null)return i;for(let s=0;s<e.length;s++)if(e[s]<=t){i=e[s];break}return i===1&&(i=Yt.NONE),i}blit(t,e,i){const{current:s,renderer:n,gl:o,CONTEXT_UID:a}=this;if(n.context.webGLVersion!==2||!s)return;const h=s.glFramebuffers[a];if(!h)return;if(!t){if(!h.msaaBuffer)return;const u=s.colorTextures[0];if(!u)return;h.blitFramebuffer||(h.blitFramebuffer=new bu(s.width,s.height),h.blitFramebuffer.addColorTexture(0,u)),t=h.blitFramebuffer,t.colorTextures[0]!==u&&(t.colorTextures[0]=u,t.dirtyId++,t.dirtyFormat++),(t.width!==s.width||t.height!==s.height)&&(t.width=s.width,t.height=s.height,t.dirtyId++,t.dirtySize++)}e||(e=yv,e.width=s.width,e.height=s.height),i||(i=e);const l=e.width===i.width&&e.height===i.height;this.bind(t),o.bindFramebuffer(o.READ_FRAMEBUFFER,h.framebuffer),o.blitFramebuffer(e.left,e.top,e.right,e.bottom,i.left,i.top,i.right,i.bottom,o.COLOR_BUFFER_BIT,l?o.NEAREST:o.LINEAR),o.bindFramebuffer(o.READ_FRAMEBUFFER,t.glFramebuffers[this.CONTEXT_UID].framebuffer)}disposeFramebuffer(t,e){const i=t.glFramebuffers[this.CONTEXT_UID],s=this.gl;if(!i)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||(s.deleteFramebuffer(i.framebuffer),i.msaaBuffer&&s.deleteRenderbuffer(i.msaaBuffer),i.stencil&&s.deleteRenderbuffer(i.stencil)),i.blitFramebuffer&&this.disposeFramebuffer(i.blitFramebuffer,e)}disposeAll(t){const e=this.managedFramebuffers;this.managedFramebuffers=[];for(let i=0;i<e.length;i++)this.disposeFramebuffer(e[i],t)}forceStencil(){const t=this.current;if(!t)return;const e=t.glFramebuffers[this.CONTEXT_UID];if(!e||e.stencil&&t.stencil)return;t.stencil=!0;const i=t.width,s=t.height,n=this.gl,o=e.stencil=n.createRenderbuffer();n.bindRenderbuffer(n.RENDERBUFFER,o);let a,h;this.renderer.context.webGLVersion===1?(a=n.DEPTH_STENCIL_ATTACHMENT,h=n.DEPTH_STENCIL):t.depth?(a=n.DEPTH_STENCIL_ATTACHMENT,h=n.DEPTH24_STENCIL8):(a=n.STENCIL_ATTACHMENT,h=n.STENCIL_INDEX8),e.msaaBuffer?n.renderbufferStorageMultisample(n.RENDERBUFFER,e.multisample,h,i,s):n.renderbufferStorage(n.RENDERBUFFER,h,i,s),n.framebufferRenderbuffer(n.FRAMEBUFFER,a,n.RENDERBUFFER,o)}reset(){this.current=this.unknownFramebuffer,this.viewport=new ct}destroy(){this.renderer=null}}cm.extension={type:J.RendererSystem,name:"framebuffer"},et.add(cm);const vu={5126:4,5123:2,5121:1};class dm{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,e.webGLVersion!==2){let i=this.renderer.context.extensions.vertexArrayObject;Q.PREFER_ENV===Ur.WEBGL_LEGACY&&(i=null),i?(t.createVertexArray=()=>i.createVertexArrayOES(),t.bindVertexArray=s=>i.bindVertexArrayOES(s),t.deleteVertexArray=s=>i.deleteVertexArrayOES(s)):(this.hasVao=!1,t.createVertexArray=()=>null,t.bindVertexArray=()=>null,t.deleteVertexArray=()=>null)}if(e.webGLVersion!==2){const i=t.getExtension("ANGLE_instanced_arrays");i?(t.vertexAttribDivisor=(s,n)=>i.vertexAttribDivisorANGLE(s,n),t.drawElementsInstanced=(s,n,o,a,h)=>i.drawElementsInstancedANGLE(s,n,o,a,h),t.drawArraysInstanced=(s,n,o,a)=>i.drawArraysInstancedANGLE(s,n,o,a)):this.hasInstance=!1}this.canUseUInt32ElementIndex=e.webGLVersion===2||!!e.extensions.uint32ElementIndex}bind(t,e){e=e||this.renderer.shader.shader;const{gl:i}=this;let s=t.glVertexArrayObjects[this.CONTEXT_UID],n=!1;s||(this.managedGeometries[t.id]=t,t.disposeRunner.add(this),t.glVertexArrayObjects[this.CONTEXT_UID]=s={},n=!0);const o=s[e.program.id]||this.initGeometryVao(t,e,n);this._activeGeometry=t,this._activeVao!==o&&(this._activeVao=o,this.hasVao?i.bindVertexArray(o):this.activateVao(t,e.program)),this.updateBuffers()}reset(){this.unbind()}updateBuffers(){const t=this._activeGeometry,e=this.renderer.buffer;for(let i=0;i<t.buffers.length;i++){const s=t.buffers[i];e.update(s)}}checkCompatibility(t,e){const i=t.attributes,s=e.attributeData;for(const n in s)if(!i[n])throw new Error(`shader and geometry incompatible, geometry missing the "${n}" attribute`)}getSignature(t,e){const i=t.attributes,s=e.attributeData,n=["g",t.id];for(const o in i)s[o]&&n.push(o,s[o].location);return n.join("-")}initGeometryVao(t,e,i=!0){const s=this.gl,n=this.CONTEXT_UID,o=this.renderer.buffer,a=e.program;a.glPrograms[n]||this.renderer.shader.generateProgram(e),this.checkCompatibility(t,a);const h=this.getSignature(t,a),l=t.glVertexArrayObjects[this.CONTEXT_UID];let u=l[h];if(u)return l[a.id]=u,u;const c=t.buffers,d=t.attributes,p={},m={};for(const f in c)p[f]=0,m[f]=0;for(const f in d)!d[f].size&&a.attributeData[f]?d[f].size=a.attributeData[f].size:d[f].size||console.warn(`PIXI Geometry attribute '${f}' size cannot be determined (likely the bound shader does not have the attribute)`),p[d[f].buffer]+=d[f].size*vu[d[f].type];for(const f in d){const g=d[f],y=g.size;g.stride===void 0&&(p[g.buffer]===y*vu[g.type]?g.stride=0:g.stride=p[g.buffer]),g.start===void 0&&(g.start=m[g.buffer],m[g.buffer]+=y*vu[g.type])}u=s.createVertexArray(),s.bindVertexArray(u);for(let f=0;f<c.length;f++){const g=c[f];o.bind(g),i&&g._glBuffers[n].refCount++}return this.activateVao(t,a),l[a.id]=u,l[h]=u,s.bindVertexArray(null),o.unbind(xi.ARRAY_BUFFER),u}disposeGeometry(t,e){var a;if(!this.managedGeometries[t.id])return;delete this.managedGeometries[t.id];const i=t.glVertexArrayObjects[this.CONTEXT_UID],s=this.gl,n=t.buffers,o=(a=this.renderer)==null?void 0:a.buffer;if(t.disposeRunner.remove(this),!!i){if(o)for(let h=0;h<n.length;h++){const l=n[h]._glBuffers[this.CONTEXT_UID];l&&(l.refCount--,l.refCount===0&&!e&&o.dispose(n[h],e))}if(!e){for(const h in i)if(h[0]==="g"){const l=i[h];this._activeVao===l&&this.unbind(),s.deleteVertexArray(l)}}delete t.glVertexArrayObjects[this.CONTEXT_UID]}}disposeAll(t){const e=Object.keys(this.managedGeometries);for(let i=0;i<e.length;i++)this.disposeGeometry(this.managedGeometries[e[i]],t)}activateVao(t,e){const i=this.gl,s=this.CONTEXT_UID,n=this.renderer.buffer,o=t.buffers,a=t.attributes;t.indexBuffer&&n.bind(t.indexBuffer);let h=null;for(const l in a){const u=a[l],c=o[u.buffer],d=c._glBuffers[s];if(e.attributeData[l]){h!==d&&(n.bind(c),h=d);const p=e.attributeData[l].location;if(i.enableVertexAttribArray(p),i.vertexAttribPointer(p,u.size,u.type||i.FLOAT,u.normalized,u.stride,u.start),u.instance)if(this.hasInstance)i.vertexAttribDivisor(p,u.divisor);else throw new Error("geometry error, GPU Instancing is not supported on this device")}}}draw(t,e,i,s){const{gl:n}=this,o=this._activeGeometry;if(o.indexBuffer){const a=o.indexBuffer.data.BYTES_PER_ELEMENT,h=a===2?n.UNSIGNED_SHORT:n.UNSIGNED_INT;a===2||a===4&&this.canUseUInt32ElementIndex?o.instanced?n.drawElementsInstanced(t,e||o.indexBuffer.data.length,h,(i||0)*a,s||1):n.drawElements(t,e||o.indexBuffer.data.length,h,(i||0)*a):console.warn("unsupported index buffer type: uint32")}else o.instanced?n.drawArraysInstanced(t,i,e||o.getSize(),s||1):n.drawArrays(t,i,e||o.getSize());return this}unbind(){this.gl.bindVertexArray(null),this._activeVao=null,this._activeGeometry=null}destroy(){this.renderer=null}}dm.extension={type:J.RendererSystem,name:"geometry"},et.add(dm);const pm=new Nt;class fm{constructor(t,e){this._texture=t,this.mapCoord=new Nt,this.uClampFrame=new Float32Array(4),this.uClampOffset=new Float32Array(2),this._textureID=-1,this._updateID=0,this.clampOffset=0,this.clampMargin=typeof e>"u"?.5:e,this.isSimple=!1}get texture(){return this._texture}set texture(t){this._texture=t,this._textureID=-1}multiplyUvs(t,e){e===void 0&&(e=t);const i=this.mapCoord;for(let s=0;s<t.length;s+=2){const n=t[s],o=t[s+1];e[s]=n*i.a+o*i.c+i.tx,e[s+1]=n*i.b+o*i.d+i.ty}return e}update(t){const e=this._texture;if(!e||!e.valid||!t&&this._textureID===e._updateID)return!1;this._textureID=e._updateID,this._updateID++;const i=e._uvs;this.mapCoord.set(i.x1-i.x0,i.y1-i.y0,i.x3-i.x0,i.y3-i.y0,i.x0,i.y0);const s=e.orig,n=e.trim;n&&(pm.set(s.width/n.width,0,0,s.height/n.height,-n.x/n.width,-n.y/n.height),this.mapCoord.append(pm));const o=e.baseTexture,a=this.uClampFrame,h=this.clampMargin/o.resolution,l=this.clampOffset;return a[0]=(e._frame.x+h+l)/o.width,a[1]=(e._frame.y+h+l)/o.height,a[2]=(e._frame.x+e._frame.width-h+l)/o.width,a[3]=(e._frame.y+e._frame.height-h+l)/o.height,this.uClampOffset[0]=l/o.realWidth,this.uClampOffset[1]=l/o.realHeight,this.isSimple=e._frame.width===o.width&&e._frame.height===o.height&&e.rotate===0,!0}}var bv=`varying vec2 vMaskCoord;
|
|
379
379
|
varying vec2 vTextureCoord;
|
|
380
380
|
|
|
381
381
|
uniform sampler2D uSampler;
|
|
@@ -400,7 +400,7 @@ void main(void)
|
|
|
400
400
|
|
|
401
401
|
gl_FragColor = original;
|
|
402
402
|
}
|
|
403
|
-
`,
|
|
403
|
+
`,xv=`attribute vec2 aVertexPosition;
|
|
404
404
|
attribute vec2 aTextureCoord;
|
|
405
405
|
|
|
406
406
|
uniform mat3 projectionMatrix;
|
|
@@ -416,7 +416,7 @@ void main(void)
|
|
|
416
416
|
vTextureCoord = aTextureCoord;
|
|
417
417
|
vMaskCoord = ( otherMatrix * vec3( aTextureCoord, 1.0) ).xy;
|
|
418
418
|
}
|
|
419
|
-
`;class yv extends ge{constructor(t,e,i){let s=null;typeof t!="string"&&e===void 0&&i===void 0&&(s=t,t=void 0,e=void 0,i=void 0),super(t||gv,e||mv,i),this.maskSprite=s,this.maskMatrix=new Gt}get maskSprite(){return this._maskSprite}set maskSprite(t){this._maskSprite=t,this._maskSprite&&(this._maskSprite.renderable=!1)}apply(t,e,i,s){const n=this._maskSprite,o=n._texture;o.valid&&(o.uvMatrix||(o.uvMatrix=new cm(o,0)),o.uvMatrix.update(),this.uniforms.npmAlpha=o.baseTexture.alphaMode?0:1,this.uniforms.mask=o,this.uniforms.otherMatrix=t.calculateSpriteMatrix(this.maskMatrix,n).prepend(o.uvMatrix.mapCoord),this.uniforms.alpha=n.worldAlpha,this.uniforms.maskClamp=o.uvMatrix.uClampFrame,t.applyFilter(this,e,i,s))}}class bv{constructor(t=null){this.type=jt.NONE,this.autoDetect=!0,this.maskObject=t||null,this.pooled=!1,this.isMaskData=!0,this.resolution=null,this.multisample=ge.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=jt.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 dm{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 i=e;if(!i.isMaskData){const n=this.maskDataPool.pop()||new bv;n.pooled=!0,n.maskObject=e,i=n}const s=this.maskStack.length!==0?this.maskStack[this.maskStack.length-1]:null;if(i.copyCountersOrReset(s),i._colorMask=s?s._colorMask:15,i.autoDetect&&this.detect(i),i._target=t,i.type!==jt.SPRITE&&this.maskStack.push(i),i.enabled)switch(i.type){case jt.SCISSOR:this.renderer.scissor.push(i);break;case jt.STENCIL:this.renderer.stencil.push(i);break;case jt.SPRITE:i.copyCountersOrReset(null),this.pushSpriteMask(i);break;case jt.COLOR:this.pushColorMask(i);break}i.type===jt.SPRITE&&this.maskStack.push(i)}pop(t){const e=this.maskStack.pop();if(!(!e||e._target!==t)){if(e.enabled)switch(e.type){case jt.SCISSOR:this.renderer.scissor.pop(e);break;case jt.STENCIL:this.renderer.stencil.pop(e.maskObject);break;case jt.SPRITE:this.popSpriteMask(e);break;case jt.COLOR:this.popColorMask(e);break}if(e.reset(),e.pooled&&this.maskDataPool.push(e),this.maskStack.length!==0){const i=this.maskStack[this.maskStack.length-1];i.type===jt.SPRITE&&i._filters&&(i._filters[0].maskSprite=i.maskObject)}}}detect(t){const e=t.maskObject;e?e.isSprite?t.type=jt.SPRITE:this.enableScissor&&this.renderer.scissor.testScissor(t)?t.type=jt.SCISSOR:t.type=jt.STENCIL:t.type=jt.COLOR}pushSpriteMask(t){const{maskObject:e}=t,i=t._target;let s=t._filters;s||(s=this.alphaMaskPool[this.alphaMaskIndex],s||(s=this.alphaMaskPool[this.alphaMaskIndex]=[new yv])),s[0].resolution=t.resolution,s[0].multisample=t.multisample,s[0].maskSprite=e;const n=i.filterArea;i.filterArea=e.getBounds(!0),this.renderer.filter.push(i,s),i.filterArea=n,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,i=t._colorMask=e&t.colorMask;i!==e&&this.renderer.gl.colorMask((i&1)!==0,(i&2)!==0,(i&4)!==0,(i&8)!==0)}popColorMask(t){const e=t._colorMask,i=this.maskStack.length>0?this.maskStack[this.maskStack.length-1]._colorMask:15;i!==e&&this.renderer.gl.colorMask((i&1)!==0,(i&2)!==0,(i&4)!==0,(i&8)!==0)}destroy(){this.renderer=null}}dm.extension={type:z.RendererSystem,name:"mask"},tt.add(dm);class pm{constructor(t){this.renderer=t,this.maskStack=[],this.glConst=0}getStackLength(){return this.maskStack.length}setMaskStack(t){const{gl:e}=this.renderer,i=this.getStackLength();this.maskStack=t;const s=this.getStackLength();s!==i&&(s===0?e.disable(this.glConst):(e.enable(this.glConst),this._useCurrent()))}_useCurrent(){}destroy(){this.renderer=null,this.maskStack=null}}const fm=new Gt,mm=[],gm=class nl extends pm{constructor(t){super(t),this.glConst=$.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:i}=t,{renderer:s}=this,n=s.renderTexture,o=i.getBounds(!0,mm.pop()??new ct);this.roundFrameToPixels(o,n.current?n.current.resolution:s.resolution,n.sourceFrame,n.destinationFrame,s.projection.transform),e&&o.fit(e),t._scissorRectLocal=o}static isMatrixRotated(t){if(!t)return!1;const{a:e,b:i,c:s,d:n}=t;return(Math.abs(i)>1e-4||Math.abs(s)>1e-4)&&(Math.abs(e)>1e-4||Math.abs(n)>1e-4)}testScissor(t){const{maskObject:e}=t;if(!e.isFastRect||!e.isFastRect()||nl.isMatrixRotated(e.worldTransform)||nl.isMatrixRotated(this.renderer.projection.transform))return!1;this.calcScissorRect(t);const i=t._scissorRectLocal;return i.width>0&&i.height>0}roundFrameToPixels(t,e,i,s,n){nl.isMatrixRotated(n)||(n=n?fm.copyFrom(n):fm.identity(),n.translate(-i.x,-i.y).scale(s.width/i.width,s.height/i.height).translate(s.x,s.y),this.renderer.filter.transformAABB(n,t),t.fit(s),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&&mm.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;this.renderer.renderTexture.current?e=t.y:e=this.renderer.height-t.height-t.y,this.renderer.gl.scissor(t.x,e,t.width,t.height)}};gm.extension={type:z.RendererSystem,name:"scissor"};let xv=gm;tt.add(xv);class ym extends pm{constructor(t){super(t),this.glConst=$.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:i}=this.renderer,s=t._stencilCounter;s===0&&(this.renderer.framebuffer.forceStencil(),i.clearStencil(0),i.clear(i.STENCIL_BUFFER_BIT),i.enable(i.STENCIL_TEST)),t._stencilCounter++;const n=t._colorMask;n!==0&&(t._colorMask=0,i.colorMask(!1,!1,!1,!1)),i.stencilFunc(i.EQUAL,s,4294967295),i.stencilOp(i.KEEP,i.KEEP,i.INCR),e.renderable=!0,e.render(this.renderer),this.renderer.batch.flush(),e.renderable=!1,n!==0&&(t._colorMask=n,i.colorMask((n&1)!==0,(n&2)!==0,(n&4)!==0,(n&8)!==0)),this._useCurrent()}pop(t){const e=this.renderer.gl;if(this.getStackLength()===0)e.disable(e.STENCIL_TEST);else{const i=this.maskStack.length!==0?this.maskStack[this.maskStack.length-1]:null,s=i?i._colorMask:15;s!==0&&(i._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,s!==0&&(i._colorMask=s,e.colorMask((s&1)!==0,(s&2)!==0,(s&4)!==0,(s&8)!==0)),this._useCurrent()}}_useCurrent(){const t=this.renderer.gl;t.stencilFunc(t.EQUAL,this.getStackLength(),4294967295),t.stencilOp(t.KEEP,t.KEEP,t.KEEP)}}ym.extension={type:z.RendererSystem,name:"stencil"},tt.add(ym);class bm{constructor(t){this.renderer=t,this.plugins={},Object.defineProperties(this.plugins,{extract:{enumerable:!1,get(){return xt("7.0.0","renderer.plugins.extract has moved to renderer.extract"),t.extract}},prepare:{enumerable:!1,get(){return xt("7.0.0","renderer.plugins.prepare has moved to renderer.prepare"),t.prepare}},interaction:{enumerable:!1,get(){return xt("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}}bm.extension={type:[z.RendererSystem,z.CanvasRendererSystem],name:"_plugin"},tt.add(bm);class xm{constructor(t){this.renderer=t,this.destinationFrame=null,this.sourceFrame=null,this.defaultFrame=null,this.projectionMatrix=new Gt,this.transform=null}update(t,e,i,s){this.destinationFrame=t||this.destinationFrame||this.defaultFrame,this.sourceFrame=e||this.sourceFrame||t,this.calculateProjection(this.destinationFrame,this.sourceFrame,i,s),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,i,s){const n=this.projectionMatrix,o=s?-1:1;n.identity(),n.a=1/e.width*2,n.d=o*(1/e.height*2),n.tx=-1-e.x*n.a,n.ty=-o-e.y*n.d}setTransform(t){}destroy(){this.renderer=null}}xm.extension={type:z.RendererSystem,name:"projection"},tt.add(xm);const _v=new pu,_m=new ct;class vm{constructor(t){this.renderer=t,this._tempMatrix=new Gt}generateTexture(t,e){const{region:i,...s}=e||{},n=(i==null?void 0:i.copyTo(_m))||t.getLocalBounds(_m,!0),o=s.resolution||this.renderer.resolution;n.width=Math.max(n.width,1/o),n.height=Math.max(n.height,1/o),s.width=n.width,s.height=n.height,s.resolution=o,s.multisample??(s.multisample=this.renderer.multisample);const a=Jr.create(s);this._tempMatrix.tx=-n.x,this._tempMatrix.ty=-n.y;const h=t.transform;return t.transform=_v,this.renderer.render(t,{renderTexture:a,transform:this._tempMatrix,skipUpdateTransform:!!t.parent,blit:!0}),t.transform=h,a}destroy(){}}vm.extension={type:[z.RendererSystem,z.CanvasRendererSystem],name:"textureGenerator"},tt.add(vm);const $r=new ct,Yn=new ct;class Tm{constructor(t){this.renderer=t,this.defaultMaskStack=[],this.current=null,this.sourceFrame=new ct,this.destinationFrame=new ct,this.viewportFrame=new ct}contextChange(){var e;const t=(e=this.renderer)==null?void 0:e.gl.getContextAttributes();this._rendererPremultipliedAlpha=!!(t&&t.alpha&&t.premultipliedAlpha)}bind(t=null,e,i){const s=this.renderer;this.current=t;let n,o,a;t?(n=t.baseTexture,a=n.resolution,e||($r.width=t.frame.width,$r.height=t.frame.height,e=$r),i||(Yn.x=t.frame.x,Yn.y=t.frame.y,Yn.width=e.width,Yn.height=e.height,i=Yn),o=n.framebuffer):(a=s.resolution,e||($r.width=s._view.screen.width,$r.height=s._view.screen.height,e=$r),i||(i=$r,i.width=e.width,i.height=e.height));const h=this.viewportFrame;h.x=i.x*a,h.y=i.y*a,h.width=i.width*a,h.height=i.height*a,t||(h.y=s.view.height-(h.y+h.height)),h.ceil(),this.renderer.framebuffer.bind(o,h),this.renderer.projection.update(i,e,a,!o),t?this.renderer.mask.setMaskStack(n.maskStack):this.renderer.mask.setMaskStack(this.defaultMaskStack),this.sourceFrame.copyFrom(e),this.destinationFrame.copyFrom(i)}clear(t,e){const i=this.current?this.current.baseTexture.clear:this.renderer.background.backgroundColor,s=Lt.shared.setValue(t||i);(this.current&&this.current.baseTexture.alphaMode>0||!this.current&&this._rendererPremultipliedAlpha)&&s.premultiply(s.alpha);const n=this.destinationFrame,o=this.current?this.current.baseTexture:this.renderer._view.screen,a=n.width!==o.width||n.height!==o.height;if(a){let{x:h,y:l,width:u,height:c}=this.viewportFrame;h=Math.round(h),l=Math.round(l),u=Math.round(u),c=Math.round(c),this.renderer.gl.enable(this.renderer.gl.SCISSOR_TEST),this.renderer.gl.scissor(h,l,u,c)}this.renderer.framebuffer.clear(s.red,s.green,s.blue,s.alpha,e),a&&this.renderer.scissor.pop()}resize(){this.bind(null)}reset(){this.bind(null)}destroy(){this.renderer=null}}Tm.extension={type:z.RendererSystem,name:"renderTexture"},tt.add(Tm);class vv{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 Tv(r,t){const e={},i=t.getProgramParameter(r,t.ACTIVE_ATTRIBUTES);for(let s=0;s<i;s++){const n=t.getActiveAttrib(r,s);if(n.name.startsWith("gl_"))continue;const o=Qf(t,n.type),a={type:o,name:n.name,size:Jf(o),location:t.getAttribLocation(r,n.name)};e[n.name]=a}return e}function wv(r,t){const e={},i=t.getProgramParameter(r,t.ACTIVE_UNIFORMS);for(let s=0;s<i;s++){const n=t.getActiveUniform(r,s),o=n.name.replace(/\[.*?\]$/,""),a=!!n.name.match(/\[.*?\]$/),h=Qf(t,n.type);e[o]={name:o,index:s,type:h,size:n.size,isArray:a,value:Yf(h,n.size)}}return e}function Sv(r,t){var a;const e=Kf(r,r.VERTEX_SHADER,t.vertexSrc),i=Kf(r,r.FRAGMENT_SHADER,t.fragmentSrc),s=r.createProgram();r.attachShader(s,e),r.attachShader(s,i);const n=(a=t.extra)==null?void 0:a.transformFeedbackVaryings;if(n&&(typeof r.transformFeedbackVaryings!="function"?console.warn("TransformFeedback is not supported but TransformFeedbackVaryings are given."):r.transformFeedbackVaryings(s,n.names,n.bufferMode==="separate"?r.SEPARATE_ATTRIBS:r.INTERLEAVED_ATTRIBS)),r.linkProgram(s),r.getProgramParameter(s,r.LINK_STATUS)||q1(r,s,e,i),t.attributeData=Tv(s,r),t.uniformData=wv(s,r),!/^[ \t]*#[ \t]*version[ \t]+300[ \t]+es[ \t]*$/m.test(t.vertexSrc)){const h=Object.keys(t.attributeData);h.sort((l,u)=>l>u?1:-1);for(let l=0;l<h.length;l++)t.attributeData[h[l]].location=l,r.bindAttribLocation(s,l,h[l]);r.linkProgram(s)}r.deleteShader(e),r.deleteShader(i);const o={};for(const h in t.uniformData){const l=t.uniformData[h];o[h]={location:r.getUniformLocation(s,h),value:Yf(l.type,l.size)}}return new vv(s,o)}function Ev(r,t,e,i,s){e.buffer.update(s)}const Cv={float:`
|
|
419
|
+
`;class _v extends ye{constructor(t,e,i){let s=null;typeof t!="string"&&e===void 0&&i===void 0&&(s=t,t=void 0,e=void 0,i=void 0),super(t||xv,e||bv,i),this.maskSprite=s,this.maskMatrix=new Nt}get maskSprite(){return this._maskSprite}set maskSprite(t){this._maskSprite=t,this._maskSprite&&(this._maskSprite.renderable=!1)}apply(t,e,i,s){const n=this._maskSprite,o=n._texture;o.valid&&(o.uvMatrix||(o.uvMatrix=new fm(o,0)),o.uvMatrix.update(),this.uniforms.npmAlpha=o.baseTexture.alphaMode?0:1,this.uniforms.mask=o,this.uniforms.otherMatrix=t.calculateSpriteMatrix(this.maskMatrix,n).prepend(o.uvMatrix.mapCoord),this.uniforms.alpha=n.worldAlpha,this.uniforms.maskClamp=o.uvMatrix.uClampFrame,t.applyFilter(this,e,i,s))}}class vv{constructor(t=null){this.type=jt.NONE,this.autoDetect=!0,this.maskObject=t||null,this.pooled=!1,this.isMaskData=!0,this.resolution=null,this.multisample=ye.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=jt.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 mm{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 i=e;if(!i.isMaskData){const n=this.maskDataPool.pop()||new vv;n.pooled=!0,n.maskObject=e,i=n}const s=this.maskStack.length!==0?this.maskStack[this.maskStack.length-1]:null;if(i.copyCountersOrReset(s),i._colorMask=s?s._colorMask:15,i.autoDetect&&this.detect(i),i._target=t,i.type!==jt.SPRITE&&this.maskStack.push(i),i.enabled)switch(i.type){case jt.SCISSOR:this.renderer.scissor.push(i);break;case jt.STENCIL:this.renderer.stencil.push(i);break;case jt.SPRITE:i.copyCountersOrReset(null),this.pushSpriteMask(i);break;case jt.COLOR:this.pushColorMask(i);break}i.type===jt.SPRITE&&this.maskStack.push(i)}pop(t){const e=this.maskStack.pop();if(!(!e||e._target!==t)){if(e.enabled)switch(e.type){case jt.SCISSOR:this.renderer.scissor.pop(e);break;case jt.STENCIL:this.renderer.stencil.pop(e.maskObject);break;case jt.SPRITE:this.popSpriteMask(e);break;case jt.COLOR:this.popColorMask(e);break}if(e.reset(),e.pooled&&this.maskDataPool.push(e),this.maskStack.length!==0){const i=this.maskStack[this.maskStack.length-1];i.type===jt.SPRITE&&i._filters&&(i._filters[0].maskSprite=i.maskObject)}}}detect(t){const e=t.maskObject;e?e.isSprite?t.type=jt.SPRITE:this.enableScissor&&this.renderer.scissor.testScissor(t)?t.type=jt.SCISSOR:t.type=jt.STENCIL:t.type=jt.COLOR}pushSpriteMask(t){const{maskObject:e}=t,i=t._target;let s=t._filters;s||(s=this.alphaMaskPool[this.alphaMaskIndex],s||(s=this.alphaMaskPool[this.alphaMaskIndex]=[new _v])),s[0].resolution=t.resolution,s[0].multisample=t.multisample,s[0].maskSprite=e;const n=i.filterArea;i.filterArea=e.getBounds(!0),this.renderer.filter.push(i,s),i.filterArea=n,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,i=t._colorMask=e&t.colorMask;i!==e&&this.renderer.gl.colorMask((i&1)!==0,(i&2)!==0,(i&4)!==0,(i&8)!==0)}popColorMask(t){const e=t._colorMask,i=this.maskStack.length>0?this.maskStack[this.maskStack.length-1]._colorMask:15;i!==e&&this.renderer.gl.colorMask((i&1)!==0,(i&2)!==0,(i&4)!==0,(i&8)!==0)}destroy(){this.renderer=null}}mm.extension={type:J.RendererSystem,name:"mask"},et.add(mm);class gm{constructor(t){this.renderer=t,this.maskStack=[],this.glConst=0}getStackLength(){return this.maskStack.length}setMaskStack(t){const{gl:e}=this.renderer,i=this.getStackLength();this.maskStack=t;const s=this.getStackLength();s!==i&&(s===0?e.disable(this.glConst):(e.enable(this.glConst),this._useCurrent()))}_useCurrent(){}destroy(){this.renderer=null,this.maskStack=null}}const ym=new Nt,bm=[],xm=class nl extends gm{constructor(t){super(t),this.glConst=Q.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:i}=t,{renderer:s}=this,n=s.renderTexture,o=i.getBounds(!0,bm.pop()??new ct);this.roundFrameToPixels(o,n.current?n.current.resolution:s.resolution,n.sourceFrame,n.destinationFrame,s.projection.transform),e&&o.fit(e),t._scissorRectLocal=o}static isMatrixRotated(t){if(!t)return!1;const{a:e,b:i,c:s,d:n}=t;return(Math.abs(i)>1e-4||Math.abs(s)>1e-4)&&(Math.abs(e)>1e-4||Math.abs(n)>1e-4)}testScissor(t){const{maskObject:e}=t;if(!e.isFastRect||!e.isFastRect()||nl.isMatrixRotated(e.worldTransform)||nl.isMatrixRotated(this.renderer.projection.transform))return!1;this.calcScissorRect(t);const i=t._scissorRectLocal;return i.width>0&&i.height>0}roundFrameToPixels(t,e,i,s,n){nl.isMatrixRotated(n)||(n=n?ym.copyFrom(n):ym.identity(),n.translate(-i.x,-i.y).scale(s.width/i.width,s.height/i.height).translate(s.x,s.y),this.renderer.filter.transformAABB(n,t),t.fit(s),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&&bm.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;this.renderer.renderTexture.current?e=t.y:e=this.renderer.height-t.height-t.y,this.renderer.gl.scissor(t.x,e,t.width,t.height)}};xm.extension={type:J.RendererSystem,name:"scissor"};let Tv=xm;et.add(Tv);class _m extends gm{constructor(t){super(t),this.glConst=Q.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:i}=this.renderer,s=t._stencilCounter;s===0&&(this.renderer.framebuffer.forceStencil(),i.clearStencil(0),i.clear(i.STENCIL_BUFFER_BIT),i.enable(i.STENCIL_TEST)),t._stencilCounter++;const n=t._colorMask;n!==0&&(t._colorMask=0,i.colorMask(!1,!1,!1,!1)),i.stencilFunc(i.EQUAL,s,4294967295),i.stencilOp(i.KEEP,i.KEEP,i.INCR),e.renderable=!0,e.render(this.renderer),this.renderer.batch.flush(),e.renderable=!1,n!==0&&(t._colorMask=n,i.colorMask((n&1)!==0,(n&2)!==0,(n&4)!==0,(n&8)!==0)),this._useCurrent()}pop(t){const e=this.renderer.gl;if(this.getStackLength()===0)e.disable(e.STENCIL_TEST);else{const i=this.maskStack.length!==0?this.maskStack[this.maskStack.length-1]:null,s=i?i._colorMask:15;s!==0&&(i._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,s!==0&&(i._colorMask=s,e.colorMask((s&1)!==0,(s&2)!==0,(s&4)!==0,(s&8)!==0)),this._useCurrent()}}_useCurrent(){const t=this.renderer.gl;t.stencilFunc(t.EQUAL,this.getStackLength(),4294967295),t.stencilOp(t.KEEP,t.KEEP,t.KEEP)}}_m.extension={type:J.RendererSystem,name:"stencil"},et.add(_m);class vm{constructor(t){this.renderer=t,this.plugins={},Object.defineProperties(this.plugins,{extract:{enumerable:!1,get(){return vt("7.0.0","renderer.plugins.extract has moved to renderer.extract"),t.extract}},prepare:{enumerable:!1,get(){return vt("7.0.0","renderer.plugins.prepare has moved to renderer.prepare"),t.prepare}},interaction:{enumerable:!1,get(){return vt("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}}vm.extension={type:[J.RendererSystem,J.CanvasRendererSystem],name:"_plugin"},et.add(vm);class Tm{constructor(t){this.renderer=t,this.destinationFrame=null,this.sourceFrame=null,this.defaultFrame=null,this.projectionMatrix=new Nt,this.transform=null}update(t,e,i,s){this.destinationFrame=t||this.destinationFrame||this.defaultFrame,this.sourceFrame=e||this.sourceFrame||t,this.calculateProjection(this.destinationFrame,this.sourceFrame,i,s),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,i,s){const n=this.projectionMatrix,o=s?-1:1;n.identity(),n.a=1/e.width*2,n.d=o*(1/e.height*2),n.tx=-1-e.x*n.a,n.ty=-o-e.y*n.d}setTransform(t){}destroy(){this.renderer=null}}Tm.extension={type:J.RendererSystem,name:"projection"},et.add(Tm);const wv=new pu,wm=new ct;class Sm{constructor(t){this.renderer=t,this._tempMatrix=new Nt}generateTexture(t,e){const{region:i,...s}=e||{},n=(i==null?void 0:i.copyTo(wm))||t.getLocalBounds(wm,!0),o=s.resolution||this.renderer.resolution;n.width=Math.max(n.width,1/o),n.height=Math.max(n.height,1/o),s.width=n.width,s.height=n.height,s.resolution=o,s.multisample??(s.multisample=this.renderer.multisample);const a=qr.create(s);this._tempMatrix.tx=-n.x,this._tempMatrix.ty=-n.y;const h=t.transform;return t.transform=wv,this.renderer.render(t,{renderTexture:a,transform:this._tempMatrix,skipUpdateTransform:!!t.parent,blit:!0}),t.transform=h,a}destroy(){}}Sm.extension={type:[J.RendererSystem,J.CanvasRendererSystem],name:"textureGenerator"},et.add(Sm);const ts=new ct,zn=new ct;class Em{constructor(t){this.renderer=t,this.defaultMaskStack=[],this.current=null,this.sourceFrame=new ct,this.destinationFrame=new ct,this.viewportFrame=new ct}contextChange(){var e;const t=(e=this.renderer)==null?void 0:e.gl.getContextAttributes();this._rendererPremultipliedAlpha=!!(t&&t.alpha&&t.premultipliedAlpha)}bind(t=null,e,i){const s=this.renderer;this.current=t;let n,o,a;t?(n=t.baseTexture,a=n.resolution,e||(ts.width=t.frame.width,ts.height=t.frame.height,e=ts),i||(zn.x=t.frame.x,zn.y=t.frame.y,zn.width=e.width,zn.height=e.height,i=zn),o=n.framebuffer):(a=s.resolution,e||(ts.width=s._view.screen.width,ts.height=s._view.screen.height,e=ts),i||(i=ts,i.width=e.width,i.height=e.height));const h=this.viewportFrame;h.x=i.x*a,h.y=i.y*a,h.width=i.width*a,h.height=i.height*a,t||(h.y=s.view.height-(h.y+h.height)),h.ceil(),this.renderer.framebuffer.bind(o,h),this.renderer.projection.update(i,e,a,!o),t?this.renderer.mask.setMaskStack(n.maskStack):this.renderer.mask.setMaskStack(this.defaultMaskStack),this.sourceFrame.copyFrom(e),this.destinationFrame.copyFrom(i)}clear(t,e){const i=this.current?this.current.baseTexture.clear:this.renderer.background.backgroundColor,s=Gt.shared.setValue(t||i);(this.current&&this.current.baseTexture.alphaMode>0||!this.current&&this._rendererPremultipliedAlpha)&&s.premultiply(s.alpha);const n=this.destinationFrame,o=this.current?this.current.baseTexture:this.renderer._view.screen,a=n.width!==o.width||n.height!==o.height;if(a){let{x:h,y:l,width:u,height:c}=this.viewportFrame;h=Math.round(h),l=Math.round(l),u=Math.round(u),c=Math.round(c),this.renderer.gl.enable(this.renderer.gl.SCISSOR_TEST),this.renderer.gl.scissor(h,l,u,c)}this.renderer.framebuffer.clear(s.red,s.green,s.blue,s.alpha,e),a&&this.renderer.scissor.pop()}resize(){this.bind(null)}reset(){this.bind(null)}destroy(){this.renderer=null}}Em.extension={type:J.RendererSystem,name:"renderTexture"},et.add(Em);class Sv{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 Ev(r,t){const e={},i=t.getProgramParameter(r,t.ACTIVE_ATTRIBUTES);for(let s=0;s<i;s++){const n=t.getActiveAttrib(r,s);if(n.name.startsWith("gl_"))continue;const o=em(t,n.type),a={type:o,name:n.name,size:qf(o),location:t.getAttribLocation(r,n.name)};e[n.name]=a}return e}function Cv(r,t){const e={},i=t.getProgramParameter(r,t.ACTIVE_UNIFORMS);for(let s=0;s<i;s++){const n=t.getActiveUniform(r,s),o=n.name.replace(/\[.*?\]$/,""),a=!!n.name.match(/\[.*?\]$/),h=em(t,n.type);e[o]={name:o,index:s,type:h,size:n.size,isArray:a,value:Jf(h,n.size)}}return e}function Iv(r,t){var a;const e=jf(r,r.VERTEX_SHADER,t.vertexSrc),i=jf(r,r.FRAGMENT_SHADER,t.fragmentSrc),s=r.createProgram();r.attachShader(s,e),r.attachShader(s,i);const n=(a=t.extra)==null?void 0:a.transformFeedbackVaryings;if(n&&(typeof r.transformFeedbackVaryings!="function"?console.warn("TransformFeedback is not supported but TransformFeedbackVaryings are given."):r.transformFeedbackVaryings(s,n.names,n.bufferMode==="separate"?r.SEPARATE_ATTRIBS:r.INTERLEAVED_ATTRIBS)),r.linkProgram(s),r.getProgramParameter(s,r.LINK_STATUS)||iv(r,s,e,i),t.attributeData=Ev(s,r),t.uniformData=Cv(s,r),!/^[ \t]*#[ \t]*version[ \t]+300[ \t]+es[ \t]*$/m.test(t.vertexSrc)){const h=Object.keys(t.attributeData);h.sort((l,u)=>l>u?1:-1);for(let l=0;l<h.length;l++)t.attributeData[h[l]].location=l,r.bindAttribLocation(s,l,h[l]);r.linkProgram(s)}r.deleteShader(e),r.deleteShader(i);const o={};for(const h in t.uniformData){const l=t.uniformData[h];o[h]={location:r.getUniformLocation(s,h),value:Jf(l.type,l.size)}}return new Sv(s,o)}function Av(r,t,e,i,s){e.buffer.update(s)}const Mv={float:`
|
|
420
420
|
data[offset] = v;
|
|
421
421
|
`,vec2:`
|
|
422
422
|
data[offset] = v[0];
|
|
@@ -454,7 +454,7 @@ void main(void)
|
|
|
454
454
|
{
|
|
455
455
|
data[offset + i] = v[i];
|
|
456
456
|
}
|
|
457
|
-
`},
|
|
457
|
+
`},Cm={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:16*2,mat3:16*3,mat4:16*4};function Rv(r){const t=r.map(n=>({data:n,offset:0,dataLen:0,dirty:0}));let e=0,i=0,s=0;for(let n=0;n<t.length;n++){const o=t[n];if(e=Cm[o.data.type],o.data.size>1&&(e=Math.max(e,16)*o.data.size),o.dataLen=e,i%e!==0&&i<16){const a=i%e%16;i+=a,s+=a}i+e>16?(s=Math.ceil(s/16)*16,o.offset=s,s+=e,i=e):(o.offset=s,i+=e,s+=e)}return s=Math.ceil(s/16)*16,{uboElements:t,size:s}}function Pv(r,t){const e=[];for(const i in r)t[i]&&e.push(t[i]);return e.sort((i,s)=>i.index-s.index),e}function Lv(r,t){if(!r.autoManage)return{size:0,syncFunc:Av};const e=Pv(r.uniforms,t),{uboElements:i,size:s}=Rv(e),n=[`
|
|
458
458
|
var v = null;
|
|
459
459
|
var v2 = null;
|
|
460
460
|
var cv = null;
|
|
@@ -462,7 +462,7 @@ void main(void)
|
|
|
462
462
|
var gl = renderer.gl
|
|
463
463
|
var index = 0;
|
|
464
464
|
var data = buffer.data;
|
|
465
|
-
`];for(let o=0;o<i.length;o++){const a=i[o],h=r.uniforms[a.data.name],l=a.data.name;let u=!1;for(let c=0;c<
|
|
465
|
+
`];for(let o=0;o<i.length;o++){const a=i[o],h=r.uniforms[a.data.name],l=a.data.name;let u=!1;for(let c=0;c<Xs.length;c++){const d=Xs[c];if(d.codeUbo&&d.test(a.data,h)){n.push(`offset = ${a.offset/4};`,Xs[c].codeUbo(a.data.name,h)),u=!0;break}}if(!u)if(a.data.size>1){const c=qf(a.data.type),d=Math.max(Cm[a.data.type]/16,1),p=c/d,m=(4-p%4)%4;n.push(`
|
|
466
466
|
cv = ud.${l}.value;
|
|
467
467
|
v = uv.${l};
|
|
468
468
|
offset = ${a.offset/4};
|
|
@@ -478,7 +478,7 @@ void main(void)
|
|
|
478
478
|
offset += ${m};
|
|
479
479
|
}
|
|
480
480
|
|
|
481
|
-
`)}else{const c=
|
|
481
|
+
`)}else{const c=Mv[a.data.type];n.push(`
|
|
482
482
|
cv = ud.${l}.value;
|
|
483
483
|
v = uv.${l};
|
|
484
484
|
offset = ${a.offset/4};
|
|
@@ -486,7 +486,7 @@ void main(void)
|
|
|
486
486
|
`)}}return n.push(`
|
|
487
487
|
renderer.buffer.update(buffer);
|
|
488
488
|
`),{size:s,syncFunc:new Function("ud","uv","renderer","syncData","buffer",n.join(`
|
|
489
|
-
`))}}let Rv=0;const Ea={textureCount:0,uboCount:0};class Sm{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=Rv++}systemCheck(){if(!ev())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 i=t.program,s=i.glPrograms[this.renderer.CONTEXT_UID]||this.generateProgram(t);return this.shader=t,this.program!==i&&(this.program=i,this.gl.useProgram(s.program)),e||(Ea.textureCount=0,Ea.uboCount=0,this.syncUniformGroup(t.uniformGroup,Ea)),s}setUniforms(t){const e=this.shader.program,i=e.glPrograms[this.renderer.CONTEXT_UID];e.syncUniforms(i.uniformData,t,this.renderer)}syncUniformGroup(t,e){const i=this.getGlProgram();(!t.static||t.dirtyId!==i.uniformDirtyGroups[t.id])&&(i.uniformDirtyGroups[t.id]=t.dirtyId,this.syncUniforms(t,i,e))}syncUniforms(t,e,i){(t.syncUniforms[this.shader.program.id]||this.createSyncGroups(t))(e.uniformData,t.uniforms,this.renderer,i)}createSyncGroups(t){const e=this.getSignature(t,this.shader.program.uniformData,"u");return this.cache[e]||(this.cache[e]=J1(t,this.shader.program.uniformData)),t.syncUniforms[this.shader.program.id]=this.cache[e],t.syncUniforms[this.shader.program.id]}syncUniformBufferGroup(t,e){const i=this.getGlProgram();if(!t.static||t.dirtyId!==0||!i.uniformGroups[t.id]){t.dirtyId=0;const s=i.uniformGroups[t.id]||this.createSyncBufferGroup(t,i,e);t.buffer.update(),s(i.uniformData,t.uniforms,this.renderer,Ea,t.buffer)}this.renderer.buffer.bindBufferBase(t.buffer,i.uniformBufferBindings[e])}createSyncBufferGroup(t,e,i){const{gl:s}=this.renderer;this.renderer.buffer.bind(t.buffer);const n=this.gl.getUniformBlockIndex(e.program,i);e.uniformBufferBindings[i]=this.shader.uniformBindCount,s.uniformBlockBinding(e.program,n,this.shader.uniformBindCount),this.shader.uniformBindCount++;const o=this.getSignature(t,this.shader.program.uniformData,"ubo");let a=this._uboCache[o];if(a||(a=this._uboCache[o]=Mv(t,this.shader.program.uniformData)),t.autoManage){const h=new Float32Array(a.size/4);t.buffer.update(h)}return e.uniformGroups[t.id]=a.syncFunc,e.uniformGroups[t.id]}getSignature(t,e,i){const s=t.uniforms,n=[`${i}-`];for(const o in s)n.push(o),e[o]&&n.push(e[o].type);return n.join("-")}getGlProgram(){return this.shader?this.shader.program.glPrograms[this.renderer.CONTEXT_UID]:null}generateProgram(t){const e=this.gl,i=t.program,s=Sv(e,i);return i.glPrograms[this.renderer.CONTEXT_UID]=s,s}reset(){this.program=null,this.shader=null}disposeShader(t){this.shader===t&&(this.shader=null)}destroy(){this.renderer=null,this.destroyed=!0}}Sm.extension={type:z.RendererSystem,name:"shader"},tt.add(Sm);class Ca{constructor(t){this.renderer=t}run(t){const{renderer:e}=this;e.runners.init.emit(e.options),t.hello&&console.log(`PixiJS 7.3.2 - ${e.rendererLogId} - https://pixijs.com`),e.resize(e.screen.width,e.screen.height)}destroy(){}}Ca.defaultOptions={hello:!1},Ca.extension={type:[z.RendererSystem,z.CanvasRendererSystem],name:"startup"},tt.add(Ca);function Pv(r,t=[]){return t[ut.NORMAL]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[ut.ADD]=[r.ONE,r.ONE],t[ut.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]=[r.ONE_MINUS_DST_ALPHA,r.ONE],t[ut.DST_IN]=[r.ZERO,r.SRC_ALPHA],t[ut.DST_OUT]=[r.ZERO,r.ONE_MINUS_SRC_ALPHA],t[ut.DST_ATOP]=[r.ONE_MINUS_DST_ALPHA,r.SRC_ALPHA],t[ut.XOR]=[r.ONE_MINUS_DST_ALPHA,r.ONE_MINUS_SRC_ALPHA],t[ut.SUBTRACT]=[r.ONE,r.ONE,r.ONE,r.ONE,r.FUNC_REVERSE_SUBTRACT,r.FUNC_ADD],t}const Lv=0,Gv=1,Nv=2,Fv=3,Dv=4,kv=5,Em=class ap{constructor(){this.gl=null,this.stateId=0,this.polygonOffset=0,this.blendMode=ut.NONE,this._blendEq=!1,this.map=[],this.map[Lv]=this.setBlend,this.map[Gv]=this.setOffset,this.map[Nv]=this.setCullFace,this.map[Fv]=this.setDepthTest,this.map[Dv]=this.setFrontFace,this.map[kv]=this.setDepthMask,this.checks=[],this.defaultState=new Ei,this.defaultState.blend=!0}contextChange(t){this.gl=t,this.blendModes=Pv(t),this.set(this.defaultState),this.reset()}set(t){if(t=t||this.defaultState,this.stateId!==t.data){let e=this.stateId^t.data,i=0;for(;e;)e&1&&this.map[i].call(this,!!(t.data&1<<i)),e=e>>1,i++;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(ap.checkBlendMode,t),this.gl[t?"enable":"disable"](this.gl.BLEND)}setOffset(t){this.updateCheck(ap.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],i=this.gl;e.length===2?i.blendFunc(e[0],e[1]):i.blendFuncSeparate(e[0],e[1],e[2],e[3]),e.length===6?(this._blendEq=!0,i.blendEquationSeparate(e[4],e[5])):this._blendEq&&(this._blendEq=!1,i.blendEquationSeparate(i.FUNC_ADD,i.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 i=this.checks.indexOf(t);e&&i===-1?this.checks.push(t):!e&&i!==-1&&this.checks.splice(i,1)}static checkBlendMode(t,e){t.setBlendMode(e.blendMode)}static checkPolygonOffset(t,e){t.setPolygonOffset(1,e.polygonOffset)}destroy(){this.gl=null}};Em.extension={type:z.RendererSystem,name:"state"};let Ov=Em;tt.add(Ov);class Bv extends Gn{constructor(){super(...arguments),this.runners={},this._systemsHash={}}setup(t){this.addRunners(...t.runners);const e=(t.priority??[]).filter(s=>t.systems[s]),i=[...e,...Object.keys(t.systems).filter(s=>!e.includes(s))];for(const s of i)this.addSystem(t.systems[s],s)}addRunners(...t){t.forEach(e=>{this.runners[e]=new ei(e)})}addSystem(t,e){const i=new t(this);if(this[e])throw new Error(`Whoops! The name "${e}" is already in use`);this[e]=i,this._systemsHash[e]=i;for(const s in this.runners)this.runners[s].add(i);return this}emitWithCustomOptions(t,e){const i=Object.keys(this._systemsHash);t.items.forEach(s=>{const n=i.find(o=>this._systemsHash[o]===s);s[t.name](e[n])})}destroy(){Object.values(this.runners).forEach(t=>{t.destroy()}),this._systemsHash={}}}const zn=class ol{constructor(t){this.renderer=t,this.count=0,this.checkCount=0,this.maxIdle=ol.defaultMaxIdle,this.checkCountMax=ol.defaultCheckCountMax,this.mode=ol.defaultMode}postrender(){this.renderer.objectRenderer.renderingToScreen&&(this.count++,this.mode!==dl.MANUAL&&(this.checkCount++,this.checkCount>this.checkCountMax&&(this.checkCount=0,this.run())))}run(){const t=this.renderer.texture,e=t.managedTextures;let i=!1;for(let s=0;s<e.length;s++){const n=e[s];n.resource&&this.count-n.touched>this.maxIdle&&(t.destroyTexture(n,!0),e[s]=null,i=!0)}if(i){let s=0;for(let n=0;n<e.length;n++)e[n]!==null&&(e[s++]=e[n]);e.length=s}}unload(t){const e=this.renderer.texture,i=t._texture;i&&!i.framebuffer&&e.destroyTexture(i);for(let s=t.children.length-1;s>=0;s--)this.unload(t.children[s])}destroy(){this.renderer=null}};zn.defaultMode=dl.AUTO,zn.defaultMaxIdle=60*60,zn.defaultCheckCountMax=60*10,zn.extension={type:z.RendererSystem,name:"textureGC"};let Qr=zn;tt.add(Qr);class Tu{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=nt.UNSIGNED_BYTE,this.internalFormat=V.RGBA,this.samplerType=0}}function Wv(r){let t;return"WebGL2RenderingContext"in globalThis&&r instanceof globalThis.WebGL2RenderingContext?t={[r.RGB]:J.FLOAT,[r.RGBA]:J.FLOAT,[r.ALPHA]:J.FLOAT,[r.LUMINANCE]:J.FLOAT,[r.LUMINANCE_ALPHA]:J.FLOAT,[r.R8]:J.FLOAT,[r.R8_SNORM]:J.FLOAT,[r.RG8]:J.FLOAT,[r.RG8_SNORM]:J.FLOAT,[r.RGB8]:J.FLOAT,[r.RGB8_SNORM]:J.FLOAT,[r.RGB565]:J.FLOAT,[r.RGBA4]:J.FLOAT,[r.RGB5_A1]:J.FLOAT,[r.RGBA8]:J.FLOAT,[r.RGBA8_SNORM]:J.FLOAT,[r.RGB10_A2]:J.FLOAT,[r.RGB10_A2UI]:J.FLOAT,[r.SRGB8]:J.FLOAT,[r.SRGB8_ALPHA8]:J.FLOAT,[r.R16F]:J.FLOAT,[r.RG16F]:J.FLOAT,[r.RGB16F]:J.FLOAT,[r.RGBA16F]:J.FLOAT,[r.R32F]:J.FLOAT,[r.RG32F]:J.FLOAT,[r.RGB32F]:J.FLOAT,[r.RGBA32F]:J.FLOAT,[r.R11F_G11F_B10F]:J.FLOAT,[r.RGB9_E5]:J.FLOAT,[r.R8I]:J.INT,[r.R8UI]:J.UINT,[r.R16I]:J.INT,[r.R16UI]:J.UINT,[r.R32I]:J.INT,[r.R32UI]:J.UINT,[r.RG8I]:J.INT,[r.RG8UI]:J.UINT,[r.RG16I]:J.INT,[r.RG16UI]:J.UINT,[r.RG32I]:J.INT,[r.RG32UI]:J.UINT,[r.RGB8I]:J.INT,[r.RGB8UI]:J.UINT,[r.RGB16I]:J.INT,[r.RGB16UI]:J.UINT,[r.RGB32I]:J.INT,[r.RGB32UI]:J.UINT,[r.RGBA8I]:J.INT,[r.RGBA8UI]:J.UINT,[r.RGBA16I]:J.INT,[r.RGBA16UI]:J.UINT,[r.RGBA32I]:J.INT,[r.RGBA32UI]:J.UINT,[r.DEPTH_COMPONENT16]:J.FLOAT,[r.DEPTH_COMPONENT24]:J.FLOAT,[r.DEPTH_COMPONENT32F]:J.FLOAT,[r.DEPTH_STENCIL]:J.FLOAT,[r.DEPTH24_STENCIL8]:J.FLOAT,[r.DEPTH32F_STENCIL8]:J.FLOAT}:t={[r.RGB]:J.FLOAT,[r.RGBA]:J.FLOAT,[r.ALPHA]:J.FLOAT,[r.LUMINANCE]:J.FLOAT,[r.LUMINANCE_ALPHA]:J.FLOAT,[r.DEPTH_STENCIL]:J.FLOAT},t}function Uv(r){let t;return"WebGL2RenderingContext"in globalThis&&r instanceof globalThis.WebGL2RenderingContext?t={[nt.UNSIGNED_BYTE]:{[V.RGBA]:r.RGBA8,[V.RGB]:r.RGB8,[V.RG]:r.RG8,[V.RED]:r.R8,[V.RGBA_INTEGER]:r.RGBA8UI,[V.RGB_INTEGER]:r.RGB8UI,[V.RG_INTEGER]:r.RG8UI,[V.RED_INTEGER]:r.R8UI,[V.ALPHA]:r.ALPHA,[V.LUMINANCE]:r.LUMINANCE,[V.LUMINANCE_ALPHA]:r.LUMINANCE_ALPHA},[nt.BYTE]:{[V.RGBA]:r.RGBA8_SNORM,[V.RGB]:r.RGB8_SNORM,[V.RG]:r.RG8_SNORM,[V.RED]:r.R8_SNORM,[V.RGBA_INTEGER]:r.RGBA8I,[V.RGB_INTEGER]:r.RGB8I,[V.RG_INTEGER]:r.RG8I,[V.RED_INTEGER]:r.R8I},[nt.UNSIGNED_SHORT]:{[V.RGBA_INTEGER]:r.RGBA16UI,[V.RGB_INTEGER]:r.RGB16UI,[V.RG_INTEGER]:r.RG16UI,[V.RED_INTEGER]:r.R16UI,[V.DEPTH_COMPONENT]:r.DEPTH_COMPONENT16},[nt.SHORT]:{[V.RGBA_INTEGER]:r.RGBA16I,[V.RGB_INTEGER]:r.RGB16I,[V.RG_INTEGER]:r.RG16I,[V.RED_INTEGER]:r.R16I},[nt.UNSIGNED_INT]:{[V.RGBA_INTEGER]:r.RGBA32UI,[V.RGB_INTEGER]:r.RGB32UI,[V.RG_INTEGER]:r.RG32UI,[V.RED_INTEGER]:r.R32UI,[V.DEPTH_COMPONENT]:r.DEPTH_COMPONENT24},[nt.INT]:{[V.RGBA_INTEGER]:r.RGBA32I,[V.RGB_INTEGER]:r.RGB32I,[V.RG_INTEGER]:r.RG32I,[V.RED_INTEGER]:r.R32I},[nt.FLOAT]:{[V.RGBA]:r.RGBA32F,[V.RGB]:r.RGB32F,[V.RG]:r.RG32F,[V.RED]:r.R32F,[V.DEPTH_COMPONENT]:r.DEPTH_COMPONENT32F},[nt.HALF_FLOAT]:{[V.RGBA]:r.RGBA16F,[V.RGB]:r.RGB16F,[V.RG]:r.RG16F,[V.RED]:r.R16F},[nt.UNSIGNED_SHORT_5_6_5]:{[V.RGB]:r.RGB565},[nt.UNSIGNED_SHORT_4_4_4_4]:{[V.RGBA]:r.RGBA4},[nt.UNSIGNED_SHORT_5_5_5_1]:{[V.RGBA]:r.RGB5_A1},[nt.UNSIGNED_INT_2_10_10_10_REV]:{[V.RGBA]:r.RGB10_A2,[V.RGBA_INTEGER]:r.RGB10_A2UI},[nt.UNSIGNED_INT_10F_11F_11F_REV]:{[V.RGB]:r.R11F_G11F_B10F},[nt.UNSIGNED_INT_5_9_9_9_REV]:{[V.RGB]:r.RGB9_E5},[nt.UNSIGNED_INT_24_8]:{[V.DEPTH_STENCIL]:r.DEPTH24_STENCIL8},[nt.FLOAT_32_UNSIGNED_INT_24_8_REV]:{[V.DEPTH_STENCIL]:r.DEPTH32F_STENCIL8}}:t={[nt.UNSIGNED_BYTE]:{[V.RGBA]:r.RGBA,[V.RGB]:r.RGB,[V.ALPHA]:r.ALPHA,[V.LUMINANCE]:r.LUMINANCE,[V.LUMINANCE_ALPHA]:r.LUMINANCE_ALPHA},[nt.UNSIGNED_SHORT_5_6_5]:{[V.RGB]:r.RGB},[nt.UNSIGNED_SHORT_4_4_4_4]:{[V.RGBA]:r.RGBA},[nt.UNSIGNED_SHORT_5_5_5_1]:{[V.RGBA]:r.RGBA}},t}class Cm{constructor(t){this.renderer=t,this.boundTextures=[],this.currentLocation=-1,this.managedTextures=[],this._unknownBoundTextures=!1,this.unknownTexture=new ft,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=Uv(t),this.samplerTypes=Wv(t);const e=t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS);this.boundTextures.length=e;for(let s=0;s<e;s++)this.boundTextures[s]=null;this.emptyTextures={};const i=new Tu(t.createTexture());t.bindTexture(t.TEXTURE_2D,i.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]=i,this.emptyTextures[t.TEXTURE_CUBE_MAP]=new Tu(t.createTexture()),t.bindTexture(t.TEXTURE_CUBE_MAP,this.emptyTextures[t.TEXTURE_CUBE_MAP].texture);for(let s=0;s<6;s++)t.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+s,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 s=0;s<this.boundTextures.length;s++)this.bind(null,s)}bind(t,e=0){const{gl:i}=this;if(t=t==null?void 0:t.castToBaseTexture(),(t==null?void 0:t.valid)&&!t.parentTextureArray){t.touched=this.renderer.textureGC.count;const s=t._glTextures[this.CONTEXT_UID]||this.initTexture(t);this.boundTextures[e]!==t&&(this.currentLocation!==e&&(this.currentLocation=e,i.activeTexture(i.TEXTURE0+e)),i.bindTexture(t.target,s.texture)),s.dirtyId!==t.dirtyId?(this.currentLocation!==e&&(this.currentLocation=e,i.activeTexture(i.TEXTURE0+e)),this.updateTexture(t)):s.dirtyStyleId!==t.dirtyStyleId&&this.updateTextureStyle(t),this.boundTextures[e]=t}else this.currentLocation!==e&&(this.currentLocation=e,i.activeTexture(i.TEXTURE0+e)),i.bindTexture(i.TEXTURE_2D,this.emptyTextures[i.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:i}=this;if(this._unknownBoundTextures){this._unknownBoundTextures=!1;for(let s=0;s<i.length;s++)i[s]===this.unknownTexture&&this.bind(null,s)}for(let s=0;s<i.length;s++)i[s]===t&&(this.currentLocation!==s&&(e.activeTexture(e.TEXTURE0+s),this.currentLocation=s),e.bindTexture(t.target,this.emptyTextures[t.target].texture),i[s]=null)}ensureSamplerType(t){const{boundTextures:e,hasIntegerTextures:i,CONTEXT_UID:s}=this;if(i)for(let n=t-1;n>=0;--n){const o=e[n];o&&o._glTextures[s].samplerType!==J.FLOAT&&this.renderer.texture.unbind(o)}}initTexture(t){const e=new Tu(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){var i;e.internalFormat=((i=this.internalFormats[t.type])==null?void 0:i[t.format])??t.format,e.samplerType=this.samplerTypes[e.internalFormat]??J.FLOAT,this.webGLVersion===2&&t.type===nt.HALF_FLOAT?e.type=this.gl.HALF_FLOAT:e.type=t.type}updateTexture(t){var s;const e=t._glTextures[this.CONTEXT_UID];if(!e)return;const i=this.renderer;if(this.initTextureType(t,e),(s=t.resource)==null?void 0:s.upload(i,t,e))e.samplerType!==J.FLOAT&&(this.hasIntegerTextures=!0);else{const n=t.realWidth,o=t.realHeight,a=i.gl;(e.width!==n||e.height!==o||e.dirtyId<0)&&(e.width=n,e.height=o,a.texImage2D(t.target,0,e.internalFormat,n,o,0,t.format,e.type,null))}t.dirtyStyleId!==e.dirtyStyleId&&this.updateTextureStyle(t),e.dirtyId=t.dirtyId}destroyTexture(t,e){const{gl:i}=this;if(t=t.castToBaseTexture(),t._glTextures[this.CONTEXT_UID]&&(this.unbind(t),i.deleteTexture(t._glTextures[this.CONTEXT_UID].texture),t.off("dispose",this.destroyTexture,this),delete t._glTextures[this.CONTEXT_UID],!e)){const s=this.managedTextures.indexOf(t);s!==-1&&Ws(this.managedTextures,s,1)}}updateTextureStyle(t){var i;const e=t._glTextures[this.CONTEXT_UID];e&&((t.mipmap===bi.POW2||this.webGLVersion!==2)&&!t.isPowerOfTwo?e.mipmap=!1:e.mipmap=t.mipmap>=1,this.webGLVersion!==2&&!t.isPowerOfTwo?e.wrapMode=Hi.CLAMP:e.wrapMode=t.wrapMode,(i=t.resource)!=null&&i.style(this.renderer,t,e)||this.setStyle(t,e),e.dirtyStyleId=t.dirtyStyleId)}setStyle(t,e){const i=this.gl;if(e.mipmap&&t.mipmap!==bi.ON_MANUAL&&i.generateMipmap(t.target),i.texParameteri(t.target,i.TEXTURE_WRAP_S,e.wrapMode),i.texParameteri(t.target,i.TEXTURE_WRAP_T,e.wrapMode),e.mipmap){i.texParameteri(t.target,i.TEXTURE_MIN_FILTER,t.scaleMode===Vi.LINEAR?i.LINEAR_MIPMAP_LINEAR:i.NEAREST_MIPMAP_NEAREST);const s=this.renderer.context.extensions.anisotropicFiltering;if(s&&t.anisotropicLevel>0&&t.scaleMode===Vi.LINEAR){const n=Math.min(t.anisotropicLevel,i.getParameter(s.MAX_TEXTURE_MAX_ANISOTROPY_EXT));i.texParameterf(t.target,s.TEXTURE_MAX_ANISOTROPY_EXT,n)}}else i.texParameteri(t.target,i.TEXTURE_MIN_FILTER,t.scaleMode===Vi.LINEAR?i.LINEAR:i.NEAREST);i.texParameteri(t.target,i.TEXTURE_MAG_FILTER,t.scaleMode===Vi.LINEAR?i.LINEAR:i.NEAREST)}destroy(){this.renderer=null}}Cm.extension={type:z.RendererSystem,name:"texture"},tt.add(Cm);class Im{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:i}=this,s=t._glTransformFeedbacks[i]||this.createGLTransformFeedback(t);e.bindTransformFeedback(e.TRANSFORM_FEEDBACK,s)}unbind(){const{gl:t}=this;t.bindTransformFeedback(t.TRANSFORM_FEEDBACK,null)}beginTransformFeedback(t,e){const{gl:i,renderer:s}=this;e&&s.shader.bind(e),i.beginTransformFeedback(t)}endTransformFeedback(){const{gl:t}=this;t.endTransformFeedback()}createGLTransformFeedback(t){const{gl:e,renderer:i,CONTEXT_UID:s}=this,n=e.createTransformFeedback();t._glTransformFeedbacks[s]=n,e.bindTransformFeedback(e.TRANSFORM_FEEDBACK,n);for(let o=0;o<t.buffers.length;o++){const a=t.buffers[o];a&&(i.buffer.update(a),a._glBuffers[s].refCount++,e.bindBufferBase(e.TRANSFORM_FEEDBACK_BUFFER,o,a._glBuffers[s].buffer||null))}return e.bindTransformFeedback(e.TRANSFORM_FEEDBACK,null),t.disposeRunner.add(this),n}disposeTransformFeedback(t,e){const i=t._glTransformFeedbacks[this.CONTEXT_UID],s=this.gl;t.disposeRunner.remove(this);const n=this.renderer.buffer;if(n)for(let o=0;o<t.buffers.length;o++){const a=t.buffers[o];if(!a)continue;const h=a._glBuffers[this.CONTEXT_UID];h&&(h.refCount--,h.refCount===0&&!e&&n.dispose(a,e))}i&&(e||s.deleteTransformFeedback(i),delete t._glTransformFeedbacks[this.CONTEXT_UID])}destroy(){this.renderer=null}}Im.extension={type:z.RendererSystem,name:"transformFeedback"},tt.add(Im);class Ia{constructor(t){this.renderer=t}init(t){this.screen=new ct(0,0,t.width,t.height),this.element=t.view||$.ADAPTER.createCanvas(),this.resolution=t.resolution||$.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 i=this.element.width/this.resolution,s=this.element.height/this.resolution;this.screen.width=i,this.screen.height=s,this.autoDensity&&(this.element.style.width=`${i}px`,this.element.style.height=`${s}px`),this.renderer.emit("resize",i,s),this.renderer.runners.resize.emit(this.screen.width,this.screen.height)}destroy(t){var e;t&&((e=this.element.parentNode)==null||e.removeChild(this.element)),this.renderer=null,this.element=null,this.screen=null}}Ia.defaultOptions={width:800,height:600,resolution:void 0,autoDensity:!1},Ia.extension={type:[z.RendererSystem,z.CanvasRendererSystem],name:"_view"},tt.add(Ia),$.PREFER_ENV=Or.WEBGL2,$.STRICT_TEXTURE_CACHE=!1,$.RENDER_OPTIONS={...Ta.defaultOptions,...va.defaultOptions,...Ia.defaultOptions,...Ca.defaultOptions},Object.defineProperties($,{WRAP_MODE:{get(){return ft.defaultOptions.wrapMode},set(r){xt("7.1.0","settings.WRAP_MODE is deprecated, use BaseTexture.defaultOptions.wrapMode"),ft.defaultOptions.wrapMode=r}},SCALE_MODE:{get(){return ft.defaultOptions.scaleMode},set(r){xt("7.1.0","settings.SCALE_MODE is deprecated, use BaseTexture.defaultOptions.scaleMode"),ft.defaultOptions.scaleMode=r}},MIPMAP_TEXTURES:{get(){return ft.defaultOptions.mipmap},set(r){xt("7.1.0","settings.MIPMAP_TEXTURES is deprecated, use BaseTexture.defaultOptions.mipmap"),ft.defaultOptions.mipmap=r}},ANISOTROPIC_LEVEL:{get(){return ft.defaultOptions.anisotropicLevel},set(r){xt("7.1.0","settings.ANISOTROPIC_LEVEL is deprecated, use BaseTexture.defaultOptions.anisotropicLevel"),ft.defaultOptions.anisotropicLevel=r}},FILTER_RESOLUTION:{get(){return xt("7.1.0","settings.FILTER_RESOLUTION is deprecated, use Filter.defaultResolution"),ge.defaultResolution},set(r){ge.defaultResolution=r}},FILTER_MULTISAMPLE:{get(){return xt("7.1.0","settings.FILTER_MULTISAMPLE is deprecated, use Filter.defaultMultisample"),ge.defaultMultisample},set(r){ge.defaultMultisample=r}},SPRITE_MAX_TEXTURES:{get(){return jr.defaultMaxTextures},set(r){xt("7.1.0","settings.SPRITE_MAX_TEXTURES is deprecated, use BatchRenderer.defaultMaxTextures"),jr.defaultMaxTextures=r}},SPRITE_BATCH_SIZE:{get(){return jr.defaultBatchSize},set(r){xt("7.1.0","settings.SPRITE_BATCH_SIZE is deprecated, use BatchRenderer.defaultBatchSize"),jr.defaultBatchSize=r}},CAN_UPLOAD_SAME_BUFFER:{get(){return jr.canUploadSameBuffer},set(r){xt("7.1.0","settings.CAN_UPLOAD_SAME_BUFFER is deprecated, use BatchRenderer.canUploadSameBuffer"),jr.canUploadSameBuffer=r}},GC_MODE:{get(){return Qr.defaultMode},set(r){xt("7.1.0","settings.GC_MODE is deprecated, use TextureGCSystem.defaultMode"),Qr.defaultMode=r}},GC_MAX_IDLE:{get(){return Qr.defaultMaxIdle},set(r){xt("7.1.0","settings.GC_MAX_IDLE is deprecated, use TextureGCSystem.defaultMaxIdle"),Qr.defaultMaxIdle=r}},GC_MAX_CHECK_COUNT:{get(){return Qr.defaultCheckCountMax},set(r){xt("7.1.0","settings.GC_MAX_CHECK_COUNT is deprecated, use TextureGCSystem.defaultCheckCountMax"),Qr.defaultCheckCountMax=r}},PRECISION_VERTEX:{get(){return qi.defaultVertexPrecision},set(r){xt("7.1.0","settings.PRECISION_VERTEX is deprecated, use Program.defaultVertexPrecision"),qi.defaultVertexPrecision=r}},PRECISION_FRAGMENT:{get(){return qi.defaultFragmentPrecision},set(r){xt("7.1.0","settings.PRECISION_FRAGMENT is deprecated, use Program.defaultFragmentPrecision"),qi.defaultFragmentPrecision=r}}});var qr=(r=>(r[r.INTERACTION=50]="INTERACTION",r[r.HIGH=25]="HIGH",r[r.NORMAL=0]="NORMAL",r[r.LOW=-25]="LOW",r[r.UTILITY=-50]="UTILITY",r))(qr||{});class wu{constructor(t,e=null,i=0,s=!1){this.next=null,this.previous=null,this._destroyed=!1,this.fn=t,this.context=e,this.priority=i,this.once=s}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 Am=class Oe{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 wu(null,null,1/0),this.deltaMS=1/Oe.targetFPMS,this.elapsedMS=1/Oe.targetFPMS,this._tick=t=>{this._requestId=null,this.started&&(this.update(t),this.started&&this._requestId===null&&this._head.next&&(this._requestId=requestAnimationFrame(this._tick)))}}_requestIfNeeded(){this._requestId===null&&this._head.next&&(this.lastTime=performance.now(),this._lastFrame=this.lastTime,this._requestId=requestAnimationFrame(this._tick))}_cancelIfNeeded(){this._requestId!==null&&(cancelAnimationFrame(this._requestId),this._requestId=null)}_startIfPossible(){this.started?this._requestIfNeeded():this.autoStart&&this.start()}add(t,e,i=qr.NORMAL){return this._addListener(new wu(t,e,i))}addOnce(t,e,i=qr.NORMAL){return this._addListener(new wu(t,e,i,!0))}_addListener(t){let e=this._head.next,i=this._head;if(!e)t.connect(i);else{for(;e;){if(t.priority>e.priority){t.connect(i);break}i=e,e=e.next}t.previous||t.connect(i)}return this._startIfPossible(),this}remove(t,e){let i=this._head.next;for(;i;)i.match(t,e)?i=i.destroy():i=i.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 n=t-this._lastFrame|0;if(n<this._minElapsedMS)return;this._lastFrame=t-n%this._minElapsedMS}this.deltaMS=e,this.deltaTime=this.deltaMS*Oe.targetFPMS;const i=this._head;let s=i.next;for(;s;)s=s.emit(this.deltaTime);i.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),i=Math.min(Math.max(0,e)/1e3,Oe.targetFPMS);this._maxElapsedMS=1/i}get maxFPS(){return this._minElapsedMS?Math.round(1e3/this._minElapsedMS):0}set maxFPS(t){if(t===0)this._minElapsedMS=0;else{const e=Math.max(this.minFPS,t);this._minElapsedMS=1/(e/1e3)}}static get shared(){if(!Oe._shared){const t=Oe._shared=new Oe;t.autoStart=!0,t._protected=!0}return Oe._shared}static get system(){if(!Oe._system){const t=Oe._system=new Oe;t.autoStart=!0,t._protected=!0}return Oe._system}};Am.targetFPMS=.06;let ye=Am;Object.defineProperties($,{TARGET_FPMS:{get(){return ye.targetFPMS},set(r){xt("7.1.0","settings.TARGET_FPMS is deprecated, use Ticker.targetFPMS"),ye.targetFPMS=r}}});class Mm{static init(t){t=Object.assign({autoStart:!0,sharedTicker:!1},t),Object.defineProperty(this,"ticker",{set(e){this._ticker&&this._ticker.remove(this.render,this),this._ticker=e,e&&e.add(this.render,this,qr.LOW)},get(){return this._ticker}}),this.stop=()=>{this._ticker.stop()},this.start=()=>{this._ticker.start()},this._ticker=null,this.ticker=t.sharedTicker?ye.shared:new ye,t.autoStart&&this.start()}static destroy(){if(this._ticker){const t=this._ticker;this.ticker=null,t.destroy()}}}Mm.extension=z.Application,tt.add(Mm);const Rm=[];tt.handleByList(z.Renderer,Rm);function Xv(r){for(const t of Rm)if(t.test(r))return new t(r);throw new Error("Unable to auto-detect a suitable renderer.")}var Zv=`attribute vec2 aVertexPosition;
|
|
489
|
+
`))}}let Gv=0;const Ca={textureCount:0,uboCount:0};class Im{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=Gv++}systemCheck(){if(!sv())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 i=t.program,s=i.glPrograms[this.renderer.CONTEXT_UID]||this.generateProgram(t);return this.shader=t,this.program!==i&&(this.program=i,this.gl.useProgram(s.program)),e||(Ca.textureCount=0,Ca.uboCount=0,this.syncUniformGroup(t.uniformGroup,Ca)),s}setUniforms(t){const e=this.shader.program,i=e.glPrograms[this.renderer.CONTEXT_UID];e.syncUniforms(i.uniformData,t,this.renderer)}syncUniformGroup(t,e){const i=this.getGlProgram();(!t.static||t.dirtyId!==i.uniformDirtyGroups[t.id])&&(i.uniformDirtyGroups[t.id]=t.dirtyId,this.syncUniforms(t,i,e))}syncUniforms(t,e,i){(t.syncUniforms[this.shader.program.id]||this.createSyncGroups(t))(e.uniformData,t.uniforms,this.renderer,i)}createSyncGroups(t){const e=this.getSignature(t,this.shader.program.uniformData,"u");return this.cache[e]||(this.cache[e]=q1(t,this.shader.program.uniformData)),t.syncUniforms[this.shader.program.id]=this.cache[e],t.syncUniforms[this.shader.program.id]}syncUniformBufferGroup(t,e){const i=this.getGlProgram();if(!t.static||t.dirtyId!==0||!i.uniformGroups[t.id]){t.dirtyId=0;const s=i.uniformGroups[t.id]||this.createSyncBufferGroup(t,i,e);t.buffer.update(),s(i.uniformData,t.uniforms,this.renderer,Ca,t.buffer)}this.renderer.buffer.bindBufferBase(t.buffer,i.uniformBufferBindings[e])}createSyncBufferGroup(t,e,i){const{gl:s}=this.renderer;this.renderer.buffer.bind(t.buffer);const n=this.gl.getUniformBlockIndex(e.program,i);e.uniformBufferBindings[i]=this.shader.uniformBindCount,s.uniformBlockBinding(e.program,n,this.shader.uniformBindCount),this.shader.uniformBindCount++;const o=this.getSignature(t,this.shader.program.uniformData,"ubo");let a=this._uboCache[o];if(a||(a=this._uboCache[o]=Lv(t,this.shader.program.uniformData)),t.autoManage){const h=new Float32Array(a.size/4);t.buffer.update(h)}return e.uniformGroups[t.id]=a.syncFunc,e.uniformGroups[t.id]}getSignature(t,e,i){const s=t.uniforms,n=[`${i}-`];for(const o in s)n.push(o),e[o]&&n.push(e[o].type);return n.join("-")}getGlProgram(){return this.shader?this.shader.program.glPrograms[this.renderer.CONTEXT_UID]:null}generateProgram(t){const e=this.gl,i=t.program,s=Iv(e,i);return i.glPrograms[this.renderer.CONTEXT_UID]=s,s}reset(){this.program=null,this.shader=null}disposeShader(t){this.shader===t&&(this.shader=null)}destroy(){this.renderer=null,this.destroyed=!0}}Im.extension={type:J.RendererSystem,name:"shader"},et.add(Im);class Ia{constructor(t){this.renderer=t}run(t){const{renderer:e}=this;e.runners.init.emit(e.options),t.hello&&console.log(`PixiJS 7.3.2 - ${e.rendererLogId} - https://pixijs.com`),e.resize(e.screen.width,e.screen.height)}destroy(){}}Ia.defaultOptions={hello:!1},Ia.extension={type:[J.RendererSystem,J.CanvasRendererSystem],name:"startup"},et.add(Ia);function Nv(r,t=[]){return t[ut.NORMAL]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[ut.ADD]=[r.ONE,r.ONE],t[ut.MULTIPLY]=[r.DST_COLOR,r.ONE_MINUS_SRC_ALPHA,r.ONE,r.ONE_MINUS_SRC_ALPHA],t[ut.SCREEN]=[r.ONE,r.ONE_MINUS_SRC_COLOR,r.ONE,r.ONE_MINUS_SRC_ALPHA],t[ut.OVERLAY]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[ut.DARKEN]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[ut.LIGHTEN]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[ut.COLOR_DODGE]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[ut.COLOR_BURN]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[ut.HARD_LIGHT]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[ut.SOFT_LIGHT]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[ut.DIFFERENCE]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[ut.EXCLUSION]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[ut.HUE]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[ut.SATURATION]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[ut.COLOR]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[ut.LUMINOSITY]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[ut.NONE]=[0,0],t[ut.NORMAL_NPM]=[r.SRC_ALPHA,r.ONE_MINUS_SRC_ALPHA,r.ONE,r.ONE_MINUS_SRC_ALPHA],t[ut.ADD_NPM]=[r.SRC_ALPHA,r.ONE,r.ONE,r.ONE],t[ut.SCREEN_NPM]=[r.SRC_ALPHA,r.ONE_MINUS_SRC_COLOR,r.ONE,r.ONE_MINUS_SRC_ALPHA],t[ut.SRC_IN]=[r.DST_ALPHA,r.ZERO],t[ut.SRC_OUT]=[r.ONE_MINUS_DST_ALPHA,r.ZERO],t[ut.SRC_ATOP]=[r.DST_ALPHA,r.ONE_MINUS_SRC_ALPHA],t[ut.DST_OVER]=[r.ONE_MINUS_DST_ALPHA,r.ONE],t[ut.DST_IN]=[r.ZERO,r.SRC_ALPHA],t[ut.DST_OUT]=[r.ZERO,r.ONE_MINUS_SRC_ALPHA],t[ut.DST_ATOP]=[r.ONE_MINUS_DST_ALPHA,r.SRC_ALPHA],t[ut.XOR]=[r.ONE_MINUS_DST_ALPHA,r.ONE_MINUS_SRC_ALPHA],t[ut.SUBTRACT]=[r.ONE,r.ONE,r.ONE,r.ONE,r.FUNC_REVERSE_SUBTRACT,r.FUNC_ADD],t}const Fv=0,Dv=1,kv=2,Ov=3,Bv=4,Wv=5,Am=class up{constructor(){this.gl=null,this.stateId=0,this.polygonOffset=0,this.blendMode=ut.NONE,this._blendEq=!1,this.map=[],this.map[Fv]=this.setBlend,this.map[Dv]=this.setOffset,this.map[kv]=this.setCullFace,this.map[Ov]=this.setDepthTest,this.map[Bv]=this.setFrontFace,this.map[Wv]=this.setDepthMask,this.checks=[],this.defaultState=new Si,this.defaultState.blend=!0}contextChange(t){this.gl=t,this.blendModes=Nv(t),this.set(this.defaultState),this.reset()}set(t){if(t=t||this.defaultState,this.stateId!==t.data){let e=this.stateId^t.data,i=0;for(;e;)e&1&&this.map[i].call(this,!!(t.data&1<<i)),e=e>>1,i++;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(up.checkBlendMode,t),this.gl[t?"enable":"disable"](this.gl.BLEND)}setOffset(t){this.updateCheck(up.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],i=this.gl;e.length===2?i.blendFunc(e[0],e[1]):i.blendFuncSeparate(e[0],e[1],e[2],e[3]),e.length===6?(this._blendEq=!0,i.blendEquationSeparate(e[4],e[5])):this._blendEq&&(this._blendEq=!1,i.blendEquationSeparate(i.FUNC_ADD,i.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 i=this.checks.indexOf(t);e&&i===-1?this.checks.push(t):!e&&i!==-1&&this.checks.splice(i,1)}static checkBlendMode(t,e){t.setBlendMode(e.blendMode)}static checkPolygonOffset(t,e){t.setPolygonOffset(1,e.polygonOffset)}destroy(){this.gl=null}};Am.extension={type:J.RendererSystem,name:"state"};let Uv=Am;et.add(Uv);class Xv extends Nn{constructor(){super(...arguments),this.runners={},this._systemsHash={}}setup(t){this.addRunners(...t.runners);const e=(t.priority??[]).filter(s=>t.systems[s]),i=[...e,...Object.keys(t.systems).filter(s=>!e.includes(s))];for(const s of i)this.addSystem(t.systems[s],s)}addRunners(...t){t.forEach(e=>{this.runners[e]=new ii(e)})}addSystem(t,e){const i=new t(this);if(this[e])throw new Error(`Whoops! The name "${e}" is already in use`);this[e]=i,this._systemsHash[e]=i;for(const s in this.runners)this.runners[s].add(i);return this}emitWithCustomOptions(t,e){const i=Object.keys(this._systemsHash);t.items.forEach(s=>{const n=i.find(o=>this._systemsHash[o]===s);s[t.name](e[n])})}destroy(){Object.values(this.runners).forEach(t=>{t.destroy()}),this._systemsHash={}}}const jn=class ol{constructor(t){this.renderer=t,this.count=0,this.checkCount=0,this.maxIdle=ol.defaultMaxIdle,this.checkCountMax=ol.defaultCheckCountMax,this.mode=ol.defaultMode}postrender(){this.renderer.objectRenderer.renderingToScreen&&(this.count++,this.mode!==dl.MANUAL&&(this.checkCount++,this.checkCount>this.checkCountMax&&(this.checkCount=0,this.run())))}run(){const t=this.renderer.texture,e=t.managedTextures;let i=!1;for(let s=0;s<e.length;s++){const n=e[s];n.resource&&this.count-n.touched>this.maxIdle&&(t.destroyTexture(n,!0),e[s]=null,i=!0)}if(i){let s=0;for(let n=0;n<e.length;n++)e[n]!==null&&(e[s++]=e[n]);e.length=s}}unload(t){const e=this.renderer.texture,i=t._texture;i&&!i.framebuffer&&e.destroyTexture(i);for(let s=t.children.length-1;s>=0;s--)this.unload(t.children[s])}destroy(){this.renderer=null}};jn.defaultMode=dl.AUTO,jn.defaultMaxIdle=60*60,jn.defaultCheckCountMax=60*10,jn.extension={type:J.RendererSystem,name:"textureGC"};let es=jn;et.add(es);class Tu{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=at.UNSIGNED_BYTE,this.internalFormat=K.RGBA,this.samplerType=0}}function Zv(r){let t;return"WebGL2RenderingContext"in globalThis&&r instanceof globalThis.WebGL2RenderingContext?t={[r.RGB]:$.FLOAT,[r.RGBA]:$.FLOAT,[r.ALPHA]:$.FLOAT,[r.LUMINANCE]:$.FLOAT,[r.LUMINANCE_ALPHA]:$.FLOAT,[r.R8]:$.FLOAT,[r.R8_SNORM]:$.FLOAT,[r.RG8]:$.FLOAT,[r.RG8_SNORM]:$.F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PHA]:$.FLOAT,[r.DEPTH_STENCIL]:$.FLOAT},t}function Vv(r){let t;return"WebGL2RenderingContext"in globalThis&&r instanceof globalThis.WebGL2RenderingContext?t={[at.UNSIGNED_BYTE]:{[K.RGBA]:r.RGBA8,[K.RGB]:r.RGB8,[K.RG]:r.RG8,[K.RED]:r.R8,[K.RGBA_INTEGER]:r.RGBA8UI,[K.RGB_INTEGER]:r.RGB8UI,[K.RG_INTEGER]:r.RG8UI,[K.RED_INTEGER]:r.R8UI,[K.ALPHA]:r.ALPHA,[K.LUMINANCE]:r.LUMINANCE,[K.LUMINANCE_ALPHA]:r.LUMINANCE_ALPHA},[at.BYTE]:{[K.RGBA]:r.RGBA8_SNORM,[K.RGB]:r.RGB8_SNORM,[K.RG]:r.RG8_SNORM,[K.RED]:r.R8_SNORM,[K.RGBA_INTEGER]:r.RGBA8I,[K.RGB_INTEGER]:r.RGB8I,[K.RG_INTEGER]:r.RG8I,[K.RED_INTEGER]:r.R8I},[at.UNSIGNED_SHORT]:{[K.RGBA_INTEGER]:r.RGBA16UI,[K.RGB_INTEGER]:r.RGB16UI,[K.RG_INTEGER]:r.RG16UI,[K.RED_INTEGER]:r.R16UI,[K.DEPTH_COMPONENT]:r.DEPTH_COMPONENT16},[at.SHORT]:{[K.RGBA_INTEGER]:r.RGBA16I,[K.RGB_INTEGER]:r.RGB16I,[K.RG_INTEGER]:r.RG16I,[K.RED_INTEGER]:r.R16I},[at.UNSIGNED_INT]:{[K.RGBA_INTEGER]:r.RGBA32UI,[K.RGB_INTEGER]:r.RGB32UI,[K.RG_INTEGER]:r.RG32UI,[K.RED_INTEGER]:r.R32UI,[K.DEPTH_COMPONENT]:r.DEPTH_COMPONENT24},[at.INT]:{[K.RGBA_INTEGER]:r.RGBA32I,[K.RGB_INTEGER]:r.RGB32I,[K.RG_INTEGER]:r.RG32I,[K.RED_INTEGER]:r.R32I},[at.FLOAT]:{[K.RGBA]:r.RGBA32F,[K.RGB]:r.RGB32F,[K.RG]:r.RG32F,[K.RED]:r.R32F,[K.DEPTH_COMPONENT]:r.DEPTH_COMPONENT32F},[at.HALF_FLOAT]:{[K.RGBA]:r.RGBA16F,[K.RGB]:r.RGB16F,[K.RG]:r.RG16F,[K.RED]:r.R16F},[at.UNSIGNED_SHORT_5_6_5]:{[K.RGB]:r.RGB565},[at.UNSIGNED_SHORT_4_4_4_4]:{[K.RGBA]:r.RGBA4},[at.UNSIGNED_SHORT_5_5_5_1]:{[K.RGBA]:r.RGB5_A1},[at.UNSIGNED_INT_2_10_10_10_REV]:{[K.RGBA]:r.RGB10_A2,[K.RGBA_INTEGER]:r.RGB10_A2UI},[at.UNSIGNED_INT_10F_11F_11F_REV]:{[K.RGB]:r.R11F_G11F_B10F},[at.UNSIGNED_INT_5_9_9_9_REV]:{[K.RGB]:r.RGB9_E5},[at.UNSIGNED_INT_24_8]:{[K.DEPTH_STENCIL]:r.DEPTH24_STENCIL8},[at.FLOAT_32_UNSIGNED_INT_24_8_REV]:{[K.DEPTH_STENCIL]:r.DEPTH32F_STENCIL8}}:t={[at.UNSIGNED_BYTE]:{[K.RGBA]:r.RGBA,[K.RGB]:r.RGB,[K.ALPHA]:r.ALPHA,[K.LUMINANCE]:r.LUMINANCE,[K.LUMINANCE_ALPHA]:r.LUMINANCE_ALPHA},[at.UNSIGNED_SHORT_5_6_5]:{[K.RGB]:r.RGB},[at.UNSIGNED_SHORT_4_4_4_4]:{[K.RGBA]:r.RGBA},[at.UNSIGNED_SHORT_5_5_5_1]:{[K.RGBA]:r.RGBA}},t}class Mm{constructor(t){this.renderer=t,this.boundTextures=[],this.currentLocation=-1,this.managedTextures=[],this._unknownBoundTextures=!1,this.unknownTexture=new ft,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=Vv(t),this.samplerTypes=Zv(t);const e=t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS);this.boundTextures.length=e;for(let s=0;s<e;s++)this.boundTextures[s]=null;this.emptyTextures={};const i=new Tu(t.createTexture());t.bindTexture(t.TEXTURE_2D,i.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]=i,this.emptyTextures[t.TEXTURE_CUBE_MAP]=new Tu(t.createTexture()),t.bindTexture(t.TEXTURE_CUBE_MAP,this.emptyTextures[t.TEXTURE_CUBE_MAP].texture);for(let s=0;s<6;s++)t.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+s,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 s=0;s<this.boundTextures.length;s++)this.bind(null,s)}bind(t,e=0){const{gl:i}=this;if(t=t==null?void 0:t.castToBaseTexture(),(t==null?void 0:t.valid)&&!t.parentTextureArray){t.touched=this.renderer.textureGC.count;const s=t._glTextures[this.CONTEXT_UID]||this.initTexture(t);this.boundTextures[e]!==t&&(this.currentLocation!==e&&(this.currentLocation=e,i.activeTexture(i.TEXTURE0+e)),i.bindTexture(t.target,s.texture)),s.dirtyId!==t.dirtyId?(this.currentLocation!==e&&(this.currentLocation=e,i.activeTexture(i.TEXTURE0+e)),this.updateTexture(t)):s.dirtyStyleId!==t.dirtyStyleId&&this.updateTextureStyle(t),this.boundTextures[e]=t}else this.currentLocation!==e&&(this.currentLocation=e,i.activeTexture(i.TEXTURE0+e)),i.bindTexture(i.TEXTURE_2D,this.emptyTextures[i.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:i}=this;if(this._unknownBoundTextures){this._unknownBoundTextures=!1;for(let s=0;s<i.length;s++)i[s]===this.unknownTexture&&this.bind(null,s)}for(let s=0;s<i.length;s++)i[s]===t&&(this.currentLocation!==s&&(e.activeTexture(e.TEXTURE0+s),this.currentLocation=s),e.bindTexture(t.target,this.emptyTextures[t.target].texture),i[s]=null)}ensureSamplerType(t){const{boundTextures:e,hasIntegerTextures:i,CONTEXT_UID:s}=this;if(i)for(let n=t-1;n>=0;--n){const o=e[n];o&&o._glTextures[s].samplerType!==$.FLOAT&&this.renderer.texture.unbind(o)}}initTexture(t){const e=new Tu(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){var i;e.internalFormat=((i=this.internalFormats[t.type])==null?void 0:i[t.format])??t.format,e.samplerType=this.samplerTypes[e.internalFormat]??$.FLOAT,this.webGLVersion===2&&t.type===at.HALF_FLOAT?e.type=this.gl.HALF_FLOAT:e.type=t.type}updateTexture(t){var s;const e=t._glTextures[this.CONTEXT_UID];if(!e)return;const i=this.renderer;if(this.initTextureType(t,e),(s=t.resource)==null?void 0:s.upload(i,t,e))e.samplerType!==$.FLOAT&&(this.hasIntegerTextures=!0);else{const n=t.realWidth,o=t.realHeight,a=i.gl;(e.width!==n||e.height!==o||e.dirtyId<0)&&(e.width=n,e.height=o,a.texImage2D(t.target,0,e.internalFormat,n,o,0,t.format,e.type,null))}t.dirtyStyleId!==e.dirtyStyleId&&this.updateTextureStyle(t),e.dirtyId=t.dirtyId}destroyTexture(t,e){const{gl:i}=this;if(t=t.castToBaseTexture(),t._glTextures[this.CONTEXT_UID]&&(this.unbind(t),i.deleteTexture(t._glTextures[this.CONTEXT_UID].texture),t.off("dispose",this.destroyTexture,this),delete t._glTextures[this.CONTEXT_UID],!e)){const s=this.managedTextures.indexOf(t);s!==-1&&Us(this.managedTextures,s,1)}}updateTextureStyle(t){var i;const e=t._glTextures[this.CONTEXT_UID];e&&((t.mipmap===yi.POW2||this.webGLVersion!==2)&&!t.isPowerOfTwo?e.mipmap=!1:e.mipmap=t.mipmap>=1,this.webGLVersion!==2&&!t.isPowerOfTwo?e.wrapMode=Ki.CLAMP:e.wrapMode=t.wrapMode,(i=t.resource)!=null&&i.style(this.renderer,t,e)||this.setStyle(t,e),e.dirtyStyleId=t.dirtyStyleId)}setStyle(t,e){const i=this.gl;if(e.mipmap&&t.mipmap!==yi.ON_MANUAL&&i.generateMipmap(t.target),i.texParameteri(t.target,i.TEXTURE_WRAP_S,e.wrapMode),i.texParameteri(t.target,i.TEXTURE_WRAP_T,e.wrapMode),e.mipmap){i.texParameteri(t.target,i.TEXTURE_MIN_FILTER,t.scaleMode===Hi.LINEAR?i.LINEAR_MIPMAP_LINEAR:i.NEAREST_MIPMAP_NEAREST);const s=this.renderer.context.extensions.anisotropicFiltering;if(s&&t.anisotropicLevel>0&&t.scaleMode===Hi.LINEAR){const n=Math.min(t.anisotropicLevel,i.getParameter(s.MAX_TEXTURE_MAX_ANISOTROPY_EXT));i.texParameterf(t.target,s.TEXTURE_MAX_ANISOTROPY_EXT,n)}}else i.texParameteri(t.target,i.TEXTURE_MIN_FILTER,t.scaleMode===Hi.LINEAR?i.LINEAR:i.NEAREST);i.texParameteri(t.target,i.TEXTURE_MAG_FILTER,t.scaleMode===Hi.LINEAR?i.LINEAR:i.NEAREST)}destroy(){this.renderer=null}}Mm.extension={type:J.RendererSystem,name:"texture"},et.add(Mm);class Rm{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:i}=this,s=t._glTransformFeedbacks[i]||this.createGLTransformFeedback(t);e.bindTransformFeedback(e.TRANSFORM_FEEDBACK,s)}unbind(){const{gl:t}=this;t.bindTransformFeedback(t.TRANSFORM_FEEDBACK,null)}beginTransformFeedback(t,e){const{gl:i,renderer:s}=this;e&&s.shader.bind(e),i.beginTransformFeedback(t)}endTransformFeedback(){const{gl:t}=this;t.endTransformFeedback()}createGLTransformFeedback(t){const{gl:e,renderer:i,CONTEXT_UID:s}=this,n=e.createTransformFeedback();t._glTransformFeedbacks[s]=n,e.bindTransformFeedback(e.TRANSFORM_FEEDBACK,n);for(let o=0;o<t.buffers.length;o++){const a=t.buffers[o];a&&(i.buffer.update(a),a._glBuffers[s].refCount++,e.bindBufferBase(e.TRANSFORM_FEEDBACK_BUFFER,o,a._glBuffers[s].buffer||null))}return e.bindTransformFeedback(e.TRANSFORM_FEEDBACK,null),t.disposeRunner.add(this),n}disposeTransformFeedback(t,e){const i=t._glTransformFeedbacks[this.CONTEXT_UID],s=this.gl;t.disposeRunner.remove(this);const n=this.renderer.buffer;if(n)for(let o=0;o<t.buffers.length;o++){const a=t.buffers[o];if(!a)continue;const h=a._glBuffers[this.CONTEXT_UID];h&&(h.refCount--,h.refCount===0&&!e&&n.dispose(a,e))}i&&(e||s.deleteTransformFeedback(i),delete t._glTransformFeedbacks[this.CONTEXT_UID])}destroy(){this.renderer=null}}Rm.extension={type:J.RendererSystem,name:"transformFeedback"},et.add(Rm);class Aa{constructor(t){this.renderer=t}init(t){this.screen=new ct(0,0,t.width,t.height),this.element=t.view||Q.ADAPTER.createCanvas(),this.resolution=t.resolution||Q.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 i=this.element.width/this.resolution,s=this.element.height/this.resolution;this.screen.width=i,this.screen.height=s,this.autoDensity&&(this.element.style.width=`${i}px`,this.element.style.height=`${s}px`),this.renderer.emit("resize",i,s),this.renderer.runners.resize.emit(this.screen.width,this.screen.height)}destroy(t){var e;t&&((e=this.element.parentNode)==null||e.removeChild(this.element)),this.renderer=null,this.element=null,this.screen=null}}Aa.defaultOptions={width:800,height:600,resolution:void 0,autoDensity:!1},Aa.extension={type:[J.RendererSystem,J.CanvasRendererSystem],name:"_view"},et.add(Aa),Q.PREFER_ENV=Ur.WEBGL2,Q.STRICT_TEXTURE_CACHE=!1,Q.RENDER_OPTIONS={...wa.defaultOptions,...Ta.defaultOptions,...Aa.defaultOptions,...Ia.defaultOptions},Object.defineProperties(Q,{WRAP_MODE:{get(){return ft.defaultOptions.wrapMode},set(r){vt("7.1.0","settings.WRAP_MODE is deprecated, use BaseTexture.defaultOptions.wrapMode"),ft.defaultOptions.wrapMode=r}},SCALE_MODE:{get(){return ft.defaultOptions.scaleMode},set(r){vt("7.1.0","settings.SCALE_MODE is deprecated, use BaseTexture.defaultOptions.scaleMode"),ft.defaultOptions.scaleMode=r}},MIPMAP_TEXTURES:{get(){return ft.defaultOptions.mipmap},set(r){vt("7.1.0","settings.MIPMAP_TEXTURES is deprecated, use BaseTexture.defaultOptions.mipmap"),ft.defaultOptions.mipmap=r}},ANISOTROPIC_LEVEL:{get(){return ft.defaultOptions.anisotropicLevel},set(r){vt("7.1.0","settings.ANISOTROPIC_LEVEL is deprecated, use BaseTexture.defaultOptions.anisotropicLevel"),ft.defaultOptions.anisotropicLevel=r}},FILTER_RESOLUTION:{get(){return vt("7.1.0","settings.FILTER_RESOLUTION is deprecated, use Filter.defaultResolution"),ye.defaultResolution},set(r){ye.defaultResolution=r}},FILTER_MULTISAMPLE:{get(){return vt("7.1.0","settings.FILTER_MULTISAMPLE is deprecated, use Filter.defaultMultisample"),ye.defaultMultisample},set(r){ye.defaultMultisample=r}},SPRITE_MAX_TEXTURES:{get(){return Qr.defaultMaxTextures},set(r){vt("7.1.0","settings.SPRITE_MAX_TEXTURES is deprecated, use BatchRenderer.defaultMaxTextures"),Qr.defaultMaxTextures=r}},SPRITE_BATCH_SIZE:{get(){return Qr.defaultBatchSize},set(r){vt("7.1.0","settings.SPRITE_BATCH_SIZE is deprecated, use BatchRenderer.defaultBatchSize"),Qr.defaultBatchSize=r}},CAN_UPLOAD_SAME_BUFFER:{get(){return Qr.canUploadSameBuffer},set(r){vt("7.1.0","settings.CAN_UPLOAD_SAME_BUFFER is deprecated, use BatchRenderer.canUploadSameBuffer"),Qr.canUploadSameBuffer=r}},GC_MODE:{get(){return es.defaultMode},set(r){vt("7.1.0","settings.GC_MODE is deprecated, use TextureGCSystem.defaultMode"),es.defaultMode=r}},GC_MAX_IDLE:{get(){return es.defaultMaxIdle},set(r){vt("7.1.0","settings.GC_MAX_IDLE is deprecated, use TextureGCSystem.defaultMaxIdle"),es.defaultMaxIdle=r}},GC_MAX_CHECK_COUNT:{get(){return es.defaultCheckCountMax},set(r){vt("7.1.0","settings.GC_MAX_CHECK_COUNT is deprecated, use TextureGCSystem.defaultCheckCountMax"),es.defaultCheckCountMax=r}},PRECISION_VERTEX:{get(){return tr.defaultVertexPrecision},set(r){vt("7.1.0","settings.PRECISION_VERTEX is deprecated, use Program.defaultVertexPrecision"),tr.defaultVertexPrecision=r}},PRECISION_FRAGMENT:{get(){return tr.defaultFragmentPrecision},set(r){vt("7.1.0","settings.PRECISION_FRAGMENT is deprecated, use Program.defaultFragmentPrecision"),tr.defaultFragmentPrecision=r}}});var is=(r=>(r[r.INTERACTION=50]="INTERACTION",r[r.HIGH=25]="HIGH",r[r.NORMAL=0]="NORMAL",r[r.LOW=-25]="LOW",r[r.UTILITY=-50]="UTILITY",r))(is||{});class wu{constructor(t,e=null,i=0,s=!1){this.next=null,this.previous=null,this._destroyed=!1,this.fn=t,this.context=e,this.priority=i,this.once=s}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 Pm=class Be{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 wu(null,null,1/0),this.deltaMS=1/Be.targetFPMS,this.elapsedMS=1/Be.targetFPMS,this._tick=t=>{this._requestId=null,this.started&&(this.update(t),this.started&&this._requestId===null&&this._head.next&&(this._requestId=requestAnimationFrame(this._tick)))}}_requestIfNeeded(){this._requestId===null&&this._head.next&&(this.lastTime=performance.now(),this._lastFrame=this.lastTime,this._requestId=requestAnimationFrame(this._tick))}_cancelIfNeeded(){this._requestId!==null&&(cancelAnimationFrame(this._requestId),this._requestId=null)}_startIfPossible(){this.started?this._requestIfNeeded():this.autoStart&&this.start()}add(t,e,i=is.NORMAL){return this._addListener(new wu(t,e,i))}addOnce(t,e,i=is.NORMAL){return this._addListener(new wu(t,e,i,!0))}_addListener(t){let e=this._head.next,i=this._head;if(!e)t.connect(i);else{for(;e;){if(t.priority>e.priority){t.connect(i);break}i=e,e=e.next}t.previous||t.connect(i)}return this._startIfPossible(),this}remove(t,e){let i=this._head.next;for(;i;)i.match(t,e)?i=i.destroy():i=i.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 n=t-this._lastFrame|0;if(n<this._minElapsedMS)return;this._lastFrame=t-n%this._minElapsedMS}this.deltaMS=e,this.deltaTime=this.deltaMS*Be.targetFPMS;const i=this._head;let s=i.next;for(;s;)s=s.emit(this.deltaTime);i.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),i=Math.min(Math.max(0,e)/1e3,Be.targetFPMS);this._maxElapsedMS=1/i}get maxFPS(){return this._minElapsedMS?Math.round(1e3/this._minElapsedMS):0}set maxFPS(t){if(t===0)this._minElapsedMS=0;else{const e=Math.max(this.minFPS,t);this._minElapsedMS=1/(e/1e3)}}static get shared(){if(!Be._shared){const t=Be._shared=new Be;t.autoStart=!0,t._protected=!0}return Be._shared}static get system(){if(!Be._system){const t=Be._system=new Be;t.autoStart=!0,t._protected=!0}return Be._system}};Pm.targetFPMS=.06;let be=Pm;Object.defineProperties(Q,{TARGET_FPMS:{get(){return be.targetFPMS},set(r){vt("7.1.0","settings.TARGET_FPMS is deprecated, use Ticker.targetFPMS"),be.targetFPMS=r}}});class Lm{static init(t){t=Object.assign({autoStart:!0,sharedTicker:!1},t),Object.defineProperty(this,"ticker",{set(e){this._ticker&&this._ticker.remove(this.render,this),this._ticker=e,e&&e.add(this.render,this,is.LOW)},get(){return this._ticker}}),this.stop=()=>{this._ticker.stop()},this.start=()=>{this._ticker.start()},this._ticker=null,this.ticker=t.sharedTicker?be.shared:new be,t.autoStart&&this.start()}static destroy(){if(this._ticker){const t=this._ticker;this.ticker=null,t.destroy()}}}Lm.extension=J.Application,et.add(Lm);const Gm=[];et.handleByList(J.Renderer,Gm);function Hv(r){for(const t of Gm)if(t.test(r))return new t(r);throw new Error("Unable to auto-detect a suitable renderer.")}var Kv=`attribute vec2 aVertexPosition;
|
|
490
490
|
attribute vec2 aTextureCoord;
|
|
491
491
|
|
|
492
492
|
uniform mat3 projectionMatrix;
|
|
@@ -497,7 +497,7 @@ void main(void)
|
|
|
497
497
|
{
|
|
498
498
|
gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);
|
|
499
499
|
vTextureCoord = aTextureCoord;
|
|
500
|
-
}`,
|
|
500
|
+
}`,Yv=`attribute vec2 aVertexPosition;
|
|
501
501
|
|
|
502
502
|
uniform mat3 projectionMatrix;
|
|
503
503
|
|
|
@@ -523,7 +523,7 @@ void main(void)
|
|
|
523
523
|
gl_Position = filterVertexPosition();
|
|
524
524
|
vTextureCoord = filterTextureCoord();
|
|
525
525
|
}
|
|
526
|
-
`;const Hv=Zv,Pm=Vv;class Lm{constructor(t){this.renderer=t}contextChange(t){let e;if(this.renderer.context.webGLVersion===1){const i=t.getParameter(t.FRAMEBUFFER_BINDING);t.bindFramebuffer(t.FRAMEBUFFER,null),e=t.getParameter(t.SAMPLES),t.bindFramebuffer(t.FRAMEBUFFER,i)}else{const i=t.getParameter(t.DRAW_FRAMEBUFFER_BINDING);t.bindFramebuffer(t.DRAW_FRAMEBUFFER,null),e=t.getParameter(t.SAMPLES),t.bindFramebuffer(t.DRAW_FRAMEBUFFER,i)}e>=Yt.HIGH?this.multisample=Yt.HIGH:e>=Yt.MEDIUM?this.multisample=Yt.MEDIUM:e>=Yt.LOW?this.multisample=Yt.LOW:this.multisample=Yt.NONE}destroy(){}}Lm.extension={type:z.RendererSystem,name:"_multisample"},tt.add(Lm);class Kv{constructor(t){this.buffer=t||null,this.updateID=-1,this.byteLength=-1,this.refCount=0}}class Gm{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:i}=this,s=t._glBuffers[i]||this.createGLBuffer(t);e.bindBuffer(t.type,s.buffer)}unbind(t){const{gl:e}=this;e.bindBuffer(t,null)}bindBufferBase(t,e){const{gl:i,CONTEXT_UID:s}=this;if(this.boundBufferBases[e]!==t){const n=t._glBuffers[s]||this.createGLBuffer(t);this.boundBufferBases[e]=t,i.bindBufferBase(i.UNIFORM_BUFFER,e,n.buffer)}}bindBufferRange(t,e,i){const{gl:s,CONTEXT_UID:n}=this;i=i||0;const o=t._glBuffers[n]||this.createGLBuffer(t);s.bindBufferRange(s.UNIFORM_BUFFER,e||0,o.buffer,i*256,256)}update(t){const{gl:e,CONTEXT_UID:i}=this,s=t._glBuffers[i]||this.createGLBuffer(t);if(t._updateID!==s.updateID)if(s.updateID=t._updateID,e.bindBuffer(t.type,s.buffer),s.byteLength>=t.data.byteLength)e.bufferSubData(t.type,0,t.data);else{const n=t.static?e.STATIC_DRAW:e.DYNAMIC_DRAW;s.byteLength=t.data.byteLength,e.bufferData(t.type,t.data,n)}}dispose(t,e){if(!this.managedBuffers[t.id])return;delete this.managedBuffers[t.id];const i=t._glBuffers[this.CONTEXT_UID],s=this.gl;t.disposeRunner.remove(this),i&&(e||s.deleteBuffer(i.buffer),delete t._glBuffers[this.CONTEXT_UID])}disposeAll(t){const e=Object.keys(this.managedBuffers);for(let i=0;i<e.length;i++)this.dispose(this.managedBuffers[e[i]],t)}createGLBuffer(t){const{CONTEXT_UID:e,gl:i}=this;return t._glBuffers[e]=new Kv(i.createBuffer()),this.managedBuffers[t.id]=t,t.disposeRunner.add(this),t._glBuffers[e]}}Gm.extension={type:z.RendererSystem,name:"buffer"},tt.add(Gm);class Nm{constructor(t){this.renderer=t}render(t,e){const i=this.renderer;let s,n,o,a;if(e&&(s=e.renderTexture,n=e.clear,o=e.transform,a=e.skipUpdateTransform),this.renderingToScreen=!s,i.runners.prerender.emit(),i.emit("prerender"),i.projection.transform=o,!i.context.isLost){if(s||(this.lastObjectRendered=t),!a){const h=t.enableTempParent();t.updateTransform(),t.disableTempParent(h)}i.renderTexture.bind(s),i.batch.currentRenderer.start(),(n??i.background.clearBeforeRender)&&i.renderTexture.clear(),t.render(i),i.batch.currentRenderer.flush(),s&&(e.blit&&i.framebuffer.blit(),s.baseTexture.update()),i.runners.postrender.emit(),i.projection.transform=null,i.emit("postrender")}}destroy(){this.renderer=null,this.lastObjectRendered=null}}Nm.extension={type:z.RendererSystem,name:"objectRenderer"},tt.add(Nm);const Aa=class hp extends Bv{constructor(t){super(),this.type=_p.WEBGL,t=Object.assign({},$.RENDER_OPTIONS,t),this.gl=null,this.CONTEXT_UID=0,this.globalUniforms=new ii({projectionMatrix:new Gt},!0);const e={runners:["init","destroy","contextChange","resolutionChange","reset","update","postrender","prerender","resize"],systems:hp.__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&&(xt("7.0.0","options.useContextAlpha is deprecated, use options.premultipliedAlpha and options.backgroundAlpha instead"),t.premultipliedAlpha=t.useContextAlpha&&t.useContextAlpha!=="notMultiplied",t.backgroundAlpha=t.useContextAlpha===!1?1:t.backgroundAlpha),this._plugin.rendererPlugins=hp.__plugins,this.options=t,this.startup.run(this.options)}static test(t){return t!=null&&t.forceCanvas?!1:m1()}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 xt("7.0.0","renderer.clearBeforeRender has been deprecated, please use renderer.background.clearBeforeRender instead."),this.background.clearBeforeRender}get useContextAlpha(){return xt("7.0.0","renderer.useContextAlpha has been deprecated, please use renderer.context.premultipliedAlpha instead."),this.context.useContextAlpha}get preserveDrawingBuffer(){return xt("7.0.0","renderer.preserveDrawingBuffer has been deprecated, we cannot truly know this unless pixi created the context"),this.context.preserveDrawingBuffer}get backgroundColor(){return xt("7.0.0","renderer.backgroundColor has been deprecated, use renderer.background.color instead."),this.background.color}set backgroundColor(t){xt("7.0.0","renderer.backgroundColor has been deprecated, use renderer.background.color instead."),this.background.color=t}get backgroundAlpha(){return xt("7.0.0","renderer.backgroundAlpha has been deprecated, use renderer.background.alpha instead."),this.background.alpha}set backgroundAlpha(t){xt("7.0.0","renderer.backgroundAlpha has been deprecated, use renderer.background.alpha instead."),this.background.alpha=t}get powerPreference(){return xt("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)}};Aa.extension={type:z.Renderer,priority:1},Aa.__plugins={},Aa.__systems={};let Su=Aa;tt.handleByMap(z.RendererPlugin,Su.__plugins),tt.handleByMap(z.RendererSystem,Su.__systems),tt.add(Su);class Fm extends Vn{constructor(t,e){const{width:i,height:s}=e||{};super(i,s),this.items=[],this.itemDirtyIds=[];for(let n=0;n<t;n++){const o=new ft;this.items.push(o),this.itemDirtyIds.push(-2)}this.length=t,this._load=null,this.baseTexture=null}initFromArray(t,e){for(let i=0;i<this.length;i++)t[i]&&(t[i].castToBaseTexture?this.addBaseTextureAt(t[i].castToBaseTexture(),i):t[i]instanceof Vn?this.addResourceAt(t[i],i):this.addResourceAt(Xf(t[i],e),i))}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(this.baseTexture!==null)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(e=>e.resource).filter(e=>e).map(e=>e.load());return this._load=Promise.all(t).then(()=>{const{realWidth:e,realHeight:i}=this.items[0];return this.resize(e,i),this.update(),Promise.resolve(this)}),this._load}}class Yv extends Fm{constructor(t,e){const{width:i,height:s}=e||{};let n,o;Array.isArray(t)?(n=t,o=t.length):o=t,super(o,{width:i,height:s}),n&&this.initFromArray(n,e)}addBaseTextureAt(t,e){if(t.resource)this.addResourceAt(t.resource,e);else throw new Error("ArrayResource does not support RenderTexture");return this}bind(t){super.bind(t),t.target=As.TEXTURE_2D_ARRAY}upload(t,e,i){const{length:s,itemDirtyIds:n,items:o}=this,{gl:a}=t;i.dirtyId<0&&a.texImage3D(a.TEXTURE_2D_ARRAY,0,i.internalFormat,this._width,this._height,s,0,e.format,i.type,null);for(let h=0;h<s;h++){const l=o[h];n[h]<l.dirtyId&&(n[h]=l.dirtyId,l.valid&&a.texSubImage3D(a.TEXTURE_2D_ARRAY,0,0,0,h,l.resource.width,l.resource.height,1,e.format,i.type,l.resource.source))}return!0}}class zv extends br{constructor(t){super(t)}static test(t){const{OffscreenCanvas:e}=globalThis;return e&&t instanceof e?!0:globalThis.HTMLCanvasElement&&t instanceof HTMLCanvasElement}}const Dm=class Xo extends Fm{constructor(t,e){const{width:i,height:s,autoLoad:n,linkBaseTexture:o}=e||{};if(t&&t.length!==Xo.SIDES)throw new Error(`Invalid length. Got ${t.length}, expected 6`);super(6,{width:i,height:s});for(let a=0;a<Xo.SIDES;a++)this.items[a].target=As.TEXTURE_CUBE_MAP_POSITIVE_X+a;this.linkBaseTexture=o!==!1,t&&this.initFromArray(t,e),n!==!1&&this.load()}bind(t){super.bind(t),t.target=As.TEXTURE_CUBE_MAP}addBaseTextureAt(t,e,i){if(i===void 0&&(i=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)this.addResourceAt(t.resource,e);else throw new Error("CubeResource does not support copying of renderTexture.");else t.target=As.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,i){const s=this.itemDirtyIds;for(let n=0;n<Xo.SIDES;n++){const o=this.items[n];(s[n]<o.dirtyId||i.dirtyId<e.dirtyId)&&(o.valid&&o.resource?(o.resource.upload(t,o,i),s[n]=o.dirtyId):s[n]<-1&&(t.gl.texImage2D(o.target,0,i.internalFormat,e.realWidth,e.realHeight,0,e.format,i.type,null),s[n]=-1))}return!0}static test(t){return Array.isArray(t)&&t.length===Xo.SIDES}};Dm.SIDES=6;let jv=Dm;class Zs extends br{constructor(t,e){e=e||{};let i,s,n;typeof t=="string"?(i=Zs.EMPTY,s=t,n=!0):(i=t,s=null,n=!1),super(i),this.url=s,this.crossOrigin=e.crossOrigin??!0,this.alphaMode=typeof e.alphaMode=="number"?e.alphaMode:null,this.ownsImageBitmap=e.ownsImageBitmap??n,this._load=null,e.autoLoad!==!1&&this.load()}load(){return this._load?this._load:(this._load=new Promise(async(t,e)=>{if(this.url===null){t(this);return}try{const i=await $.ADAPTER.fetch(this.url,{mode:this.crossOrigin?"cors":"no-cors"});if(this.destroyed)return;const s=await i.blob();if(this.destroyed)return;const n=await createImageBitmap(s,{premultiplyAlpha:this.alphaMode===null||this.alphaMode===be.UNPACK?"premultiply":"none"});if(this.destroyed){n.close();return}this.source=n,this.update(),t(this)}catch(i){if(this.destroyed)return;e(i),this.onError.emit(i)}}),this._load)}upload(t,e,i){return this.source instanceof ImageBitmap?(typeof this.alphaMode=="number"&&(e.alphaMode=this.alphaMode),super.upload(t,e,i)):(this.load(),!1)}dispose(){this.ownsImageBitmap&&this.source instanceof ImageBitmap&&this.source.close(),super.dispose(),this._load=null}static test(t){return!!globalThis.createImageBitmap&&typeof ImageBitmap<"u"&&(typeof t=="string"||t instanceof ImageBitmap)}static get EMPTY(){return Zs._EMPTY=Zs._EMPTY??$.ADAPTER.createCanvas(0,0),Zs._EMPTY}}const Eu=class al extends br{constructor(t,e){e=e||{},super($.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,e.autoLoad!==!1&&this.load()}load(){return this._load?this._load:(this._load=new Promise(t=>{if(this._resolve=()=>{this.update(),t(this)},al.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;br.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,i=t.height;if(!e||!i)throw new Error("The SVG image must have width and height defined (in pixels), canvas API needs them.");let s=e*this.scale,n=i*this.scale;(this._overrideWidth||this._overrideHeight)&&(s=this._overrideWidth||this._overrideHeight/i*e,n=this._overrideHeight||this._overrideWidth/e*i),s=Math.round(s),n=Math.round(n);const o=this.source;o.width=s,o.height=n,o._pixiId=`canvas_${Zr()}`,o.getContext("2d").drawImage(t,0,0,e,i,0,0,s,n),this._resolve(),this._resolve=null}}static getSize(t){const e=al.SVG_SIZE.exec(t),i={};return e&&(i[e[1]]=Math.round(parseFloat(e[3])),i[e[5]]=Math.round(parseFloat(e[7]))),i}dispose(){super.dispose(),this._resolve=null,this._crossorigin=null}static test(t,e){return e==="svg"||typeof t=="string"&&t.startsWith("data:image/svg+xml")||typeof t=="string"&&al.SVG_XML.test(t)}};Eu.SVG_XML=/^(<\?xml[^?]+\?>)?\s*(<!--[^(-->)]*-->)?\s*\<svg/m,Eu.SVG_SIZE=/<svg[^>]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*>/i;let Cu=Eu;const Iu=class lp extends br{constructor(t,e){if(e=e||{},!(t instanceof HTMLVideoElement)){const i=document.createElement("video");e.autoLoad!==!1&&i.setAttribute("preload","auto"),e.playsinline!==!1&&(i.setAttribute("webkit-playsinline",""),i.setAttribute("playsinline","")),e.muted===!0&&(i.setAttribute("muted",""),i.muted=!0),e.loop===!0&&i.setAttribute("loop",""),e.autoPlay!==!1&&i.setAttribute("autoplay",""),typeof t=="string"&&(t=[t]);const s=t[0].src||t[0];br.crossOrigin(i,s,e.crossorigin);for(let n=0;n<t.length;++n){const o=document.createElement("source");let{src:a,mime:h}=t[n];if(a=a||t[n],a.startsWith("data:"))h=a.slice(5,a.indexOf(";"));else if(!a.startsWith("blob:")){const l=a.split("?").shift().toLowerCase(),u=l.slice(l.lastIndexOf(".")+1);h=h||lp.MIME_TYPES[u]||`video/${u}`}o.src=a,h&&(o.type=h),i.appendChild(o)}t=i}super(t),this.noSubImage=!0,this._autoUpdate=!0,this._isConnectedToTicker=!1,this._updateFPS=e.updateFPS||0,this._msToNextUpdate=0,this.autoPlay=e.autoPlay!==!1,this._videoFrameRequestCallback=this._videoFrameRequestCallback.bind(this),this._videoFrameRequestCallbackHandle=null,this._load=null,this._resolve=null,this._reject=null,this._onCanPlay=this._onCanPlay.bind(this),this._onError=this._onError.bind(this),this._onPlayStart=this._onPlayStart.bind(this),this._onPlayStop=this._onPlayStop.bind(this),this._onSeeked=this._onSeeked.bind(this),e.autoLoad!==!1&&this.load()}update(t=0){if(!this.destroyed){if(this._updateFPS){const e=ye.shared.elapsedMS*this.source.playbackRate;this._msToNextUpdate=Math.floor(this._msToNextUpdate-e)}(!this._updateFPS||this._msToNextUpdate<=0)&&(super.update(),this._msToNextUpdate=this._updateFPS?Math.floor(1e3/this._updateFPS):0)}}_videoFrameRequestCallback(){this.update(),this.destroyed?this._videoFrameRequestCallbackHandle=null:this._videoFrameRequestCallbackHandle=this.source.requestVideoFrameCallback(this._videoFrameRequestCallback)}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),t.addEventListener("pause",this._onPlayStop),t.addEventListener("seeked",this._onSeeked),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,i)=>{this.valid?e(this):(this._resolve=e,this._reject=i,t.load())}),this._load}_onError(t){this.source.removeEventListener("error",this._onError,!0),this.onError.emit(t),this._reject&&(this._reject(t),this._reject=null,this._resolve=null)}_isSourcePlaying(){const t=this.source;return!t.paused&&!t.ended}_isSourceReady(){return this.source.readyState>2}_onPlayStart(){this.valid||this._onCanPlay(),this._configureAutoUpdate()}_onPlayStop(){this._configureAutoUpdate()}_onSeeked(){this._autoUpdate&&!this._isSourcePlaying()&&(this._msToNextUpdate=0,this.update(),this._msToNextUpdate=0)}_onCanPlay(){const t=this.source;t.removeEventListener("canplay",this._onCanPlay),t.removeEventListener("canplaythrough",this._onCanPlay);const e=this.valid;this._msToNextUpdate=0,this.update(),this._msToNextUpdate=0,!e&&this._resolve&&(this._resolve(this),this._resolve=null,this._reject=null),this._isSourcePlaying()?this._onPlayStart():this.autoPlay&&t.play()}dispose(){this._configureAutoUpdate();const t=this.source;t&&(t.removeEventListener("play",this._onPlayStart),t.removeEventListener("pause",this._onPlayStop),t.removeEventListener("seeked",this._onSeeked),t.removeEventListener("canplay",this._onCanPlay),t.removeEventListener("canplaythrough",this._onCanPlay),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._configureAutoUpdate())}get updateFPS(){return this._updateFPS}set updateFPS(t){t!==this._updateFPS&&(this._updateFPS=t,this._configureAutoUpdate())}_configureAutoUpdate(){this._autoUpdate&&this._isSourcePlaying()?!this._updateFPS&&this.source.requestVideoFrameCallback?(this._isConnectedToTicker&&(ye.shared.remove(this.update,this),this._isConnectedToTicker=!1,this._msToNextUpdate=0),this._videoFrameRequestCallbackHandle===null&&(this._videoFrameRequestCallbackHandle=this.source.requestVideoFrameCallback(this._videoFrameRequestCallback))):(this._videoFrameRequestCallbackHandle!==null&&(this.source.cancelVideoFrameCallback(this._videoFrameRequestCallbackHandle),this._videoFrameRequestCallbackHandle=null),this._isConnectedToTicker||(ye.shared.add(this.update,this),this._isConnectedToTicker=!0,this._msToNextUpdate=0)):(this._videoFrameRequestCallbackHandle!==null&&(this.source.cancelVideoFrameCallback(this._videoFrameRequestCallbackHandle),this._videoFrameRequestCallbackHandle=null),this._isConnectedToTicker&&(ye.shared.remove(this.update,this),this._isConnectedToTicker=!1,this._msToNextUpdate=0))}static test(t,e){return globalThis.HTMLVideoElement&&t instanceof HTMLVideoElement||lp.TYPES.includes(e)}};Iu.TYPES=["mp4","m4v","webm","ogg","ogv","h264","avi","mov"],Iu.MIME_TYPES={ogv:"video/ogg",mov:"video/quicktime",m4v:"video/mp4"};let km=Iu;hu.push(Zs,rm,zv,km,Cu,la,jv,Yv);class Ma{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?ct.EMPTY:(t=t||new ct(0,0,1,1),t.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:i,b:s,c:n,d:o,tx:a,ty:h}=t,l=i*e.x+n*e.y+a,u=s*e.x+o*e.y+h;this.minX=Math.min(this.minX,l),this.maxX=Math.max(this.maxX,l),this.minY=Math.min(this.minY,u),this.maxY=Math.max(this.maxY,u)}addQuad(t){let e=this.minX,i=this.minY,s=this.maxX,n=this.maxY,o=t[0],a=t[1];e=o<e?o:e,i=a<i?a:i,s=o>s?o:s,n=a>n?a:n,o=t[2],a=t[3],e=o<e?o:e,i=a<i?a:i,s=o>s?o:s,n=a>n?a:n,o=t[4],a=t[5],e=o<e?o:e,i=a<i?a:i,s=o>s?o:s,n=a>n?a:n,o=t[6],a=t[7],e=o<e?o:e,i=a<i?a:i,s=o>s?o:s,n=a>n?a:n,this.minX=e,this.minY=i,this.maxX=s,this.maxY=n}addFrame(t,e,i,s,n){this.addFrameMatrix(t.worldTransform,e,i,s,n)}addFrameMatrix(t,e,i,s,n){const o=t.a,a=t.b,h=t.c,l=t.d,u=t.tx,c=t.ty;let d=this.minX,p=this.minY,m=this.maxX,f=this.maxY,g=o*e+h*i+u,y=a*e+l*i+c;d=g<d?g:d,p=y<p?y:p,m=g>m?g:m,f=y>f?y:f,g=o*s+h*i+u,y=a*s+l*i+c,d=g<d?g:d,p=y<p?y:p,m=g>m?g:m,f=y>f?y:f,g=o*e+h*n+u,y=a*e+l*n+c,d=g<d?g:d,p=y<p?y:p,m=g>m?g:m,f=y>f?y:f,g=o*s+h*n+u,y=a*s+l*n+c,d=g<d?g:d,p=y<p?y:p,m=g>m?g:m,f=y>f?y:f,this.minX=d,this.minY=p,this.maxX=m,this.maxY=f}addVertexData(t,e,i){let s=this.minX,n=this.minY,o=this.maxX,a=this.maxY;for(let h=e;h<i;h+=2){const l=t[h],u=t[h+1];s=l<s?l:s,n=u<n?u:n,o=l>o?l:o,a=u>a?u:a}this.minX=s,this.minY=n,this.maxX=o,this.maxY=a}addVertices(t,e,i,s){this.addVerticesMatrix(t.worldTransform,e,i,s)}addVerticesMatrix(t,e,i,s,n=0,o=n){const a=t.a,h=t.b,l=t.c,u=t.d,c=t.tx,d=t.ty;let p=this.minX,m=this.minY,f=this.maxX,g=this.maxY;for(let y=i;y<s;y+=2){const _=e[y],x=e[y+1],v=a*_+l*x+c,S=u*x+h*_+d;p=Math.min(p,v-n),f=Math.max(f,v+n),m=Math.min(m,S-o),g=Math.max(g,S+o)}this.minX=p,this.minY=m,this.maxX=f,this.maxY=g}addBounds(t){const e=this.minX,i=this.minY,s=this.maxX,n=this.maxY;this.minX=t.minX<e?t.minX:e,this.minY=t.minY<i?t.minY:i,this.maxX=t.maxX>s?t.maxX:s,this.maxY=t.maxY>n?t.maxY:n}addBoundsMask(t,e){const i=t.minX>e.minX?t.minX:e.minX,s=t.minY>e.minY?t.minY:e.minY,n=t.maxX<e.maxX?t.maxX:e.maxX,o=t.maxY<e.maxY?t.maxY:e.maxY;if(i<=n&&s<=o){const a=this.minX,h=this.minY,l=this.maxX,u=this.maxY;this.minX=i<a?i:a,this.minY=s<h?s:h,this.maxX=n>l?n:l,this.maxY=o>u?o:u}}addBoundsMatrix(t,e){this.addFrameMatrix(e,t.minX,t.minY,t.maxX,t.maxY)}addBoundsArea(t,e){const i=t.minX>e.x?t.minX:e.x,s=t.minY>e.y?t.minY:e.y,n=t.maxX<e.x+e.width?t.maxX:e.x+e.width,o=t.maxY<e.y+e.height?t.maxY:e.y+e.height;if(i<=n&&s<=o){const a=this.minX,h=this.minY,l=this.maxX,u=this.maxY;this.minX=i<a?i:a,this.minY=s<h?s:h,this.maxX=n>l?n:l,this.maxY=o>u?o:u}}pad(t=0,e=t){this.isEmpty()||(this.minX-=t,this.maxX+=t,this.minY-=e,this.maxY+=e)}addFramePad(t,e,i,s,n,o){t-=n,e-=o,i+=n,s+=o,this.minX=this.minX<t?this.minX:t,this.maxX=this.maxX>i?this.maxX:i,this.minY=this.minY<e?this.minY:e,this.maxY=this.maxY>s?this.maxY:s}}class Ot extends Gn{constructor(){super(),this.tempDisplayObjectParent=null,this.transform=new pu,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 Ma,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 i=0;i<e.length;++i){const s=e[i];Object.defineProperty(Ot.prototype,s,Object.getOwnPropertyDescriptor(t,s))}}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 ct),e=this._boundsRect),this._bounds.getRectangle(e)}getLocalBounds(t){t||(this._localBoundsRect||(this._localBoundsRect=new ct),t=this._localBoundsRect),this._localBounds||(this._localBounds=new Ma);const e=this.transform,i=this.parent;this.parent=null,this._tempDisplayObjectParent.worldAlpha=(i==null?void 0:i.worldAlpha)??1,this.transform=this._tempDisplayObjectParent.transform;const s=this._bounds,n=this._boundsID;this._bounds=this._localBounds;const o=this.getBounds(!1,t);return this.parent=i,this.transform=e,this._bounds=s,this._bounds.updateID+=this._boundsID-n,o}toGlobal(t,e,i=!1){return i||(this._recursivePostUpdateTransform(),this.parent?this.displayObjectUpdateTransform():(this.parent=this._tempDisplayObjectParent,this.displayObjectUpdateTransform(),this.parent=null)),this.worldTransform.apply(t,e)}toLocal(t,e,i,s){return e&&(t=e.toGlobal(t,i,s)),s||(this._recursivePostUpdateTransform(),this.parent?this.displayObjectUpdateTransform():(this.parent=this._tempDisplayObjectParent,this.displayObjectUpdateTransform(),this.parent=null)),this.worldTransform.applyInverse(t,i)}setParent(t){if(!t||!t.addChild)throw new Error("setParent: Argument must be a Container");return t.addChild(this),t}removeFromParent(){var t;(t=this.parent)==null||t.removeChild(this)}setTransform(t=0,e=0,i=1,s=1,n=0,o=0,a=0,h=0,l=0){return this.position.x=t,this.position.y=e,this.scale.x=i||1,this.scale.y=s||1,this.rotation=n,this.skew.x=o,this.skew.y=a,this.pivot.x=h,this.pivot.y=l,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 this.tempDisplayObjectParent===null&&(this.tempDisplayObjectParent=new Jv),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*Z1}set angle(t){this.transform.rotation=t*V1}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 e=this._mask.isMaskData?this._mask.maskObject:this._mask;e&&(e._maskRefCount--,e._maskRefCount===0&&(e.renderable=!0,e.isMask=!1))}if(this._mask=t,this._mask){const e=this._mask.isMaskData?this._mask.maskObject:this._mask;e&&(e._maskRefCount===0&&(e.renderable=!1,e.isMask=!0),e._maskRefCount++)}}}}class Jv extends Ot{constructor(){super(...arguments),this.sortDirty=null}}Ot.prototype.displayObjectUpdateTransform=Ot.prototype.updateTransform;const $v=new Gt;function Qv(r,t){return r.zIndex===t.zIndex?r._lastSortedIndex-t._lastSortedIndex:r.zIndex-t.zIndex}const Om=class up extends Ot{constructor(){super(),this.children=[],this.sortableChildren=up.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 i=this.getChildIndex(t),s=this.getChildIndex(e);this.children[i]=e,this.children[s]=t,this.onChildrenChange(i<s?i:s)}getChildIndex(t){const e=this.children.indexOf(t);if(e===-1)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 i=this.getChildIndex(t);Ws(this.children,i,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],i=this.children.indexOf(e);if(i===-1)return null;e.parent=null,e.transform._parentID=-1,Ws(this.children,i,1),this._boundsID++,this.onChildrenChange(i),e.emit("removed",this),this.emit("childRemoved",e,this,i)}return t[0]}removeChildAt(t){const e=this.getChildAt(t);return e.parent=null,e.transform._parentID=-1,Ws(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 i=t,s=e,n=s-i;let o;if(n>0&&n<=s){o=this.children.splice(i,n);for(let a=0;a<o.length;++a)o[a].parent=null,o[a].transform&&(o[a].transform._parentID=-1);this._boundsID++,this.onChildrenChange(t);for(let a=0;a<o.length;++a)o[a].emit("removed",this),this.emit("childRemoved",o[a],this,a);return o}else if(n===0&&this.children.length===0)return[];throw new RangeError("removeChildren: numeric values are outside the acceptable range.")}sortChildren(){let t=!1;for(let e=0,i=this.children.length;e<i;++e){const s=this.children[e];s._lastSortedIndex=e,!t&&s.zIndex!==0&&(t=!0)}t&&this.children.length>1&&this.children.sort(Qv),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 i=this.children[t];i.visible&&i.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 i=e._mask.isMaskData?e._mask.maskObject:e._mask;i?(i.calculateBounds(),this._bounds.addBoundsMask(e._bounds,i._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 i=super.getLocalBounds(t);if(!e)for(let s=0,n=this.children.length;s<n;++s){const o=this.children[s];o.visible&&o.updateTransform()}return i}_calculateBounds(){}_renderWithCulling(t){const e=t.renderTexture.sourceFrame;if(!(e.width>0&&e.height>0))return;let i,s;this.cullArea?(i=this.cullArea,s=this.worldTransform):this._render!==up.prototype._render&&(i=this.getBounds(!0));const n=t.projection.transform;if(n&&(s?(s=$v.copyFrom(s),s.prepend(n)):s=n),i&&e.intersects(i,s))this._render(t);else if(this.cullArea)return;for(let o=0,a=this.children.length;o<a;++o){const h=this.children[o],l=h.cullable;h.cullable=l||!this.cullArea,h.render(t),h.cullable=l}}render(t){var e;if(!(!this.visible||this.worldAlpha<=0||!this.renderable))if(this._mask||(e=this.filters)!=null&&e.length)this.renderAdvanced(t);else if(this.cullable)this._renderWithCulling(t);else{this._render(t);for(let i=0,s=this.children.length;i<s;++i)this.children[i].render(t)}}renderAdvanced(t){var n,o,a;const e=this.filters,i=this._mask;if(e){this._enabledFilters||(this._enabledFilters=[]),this._enabledFilters.length=0;for(let h=0;h<e.length;h++)e[h].enabled&&this._enabledFilters.push(e[h])}const s=e&&((n=this._enabledFilters)==null?void 0:n.length)||i&&(!i.isMaskData||i.enabled&&(i.autoDetect||i.type!==jt.NONE));if(s&&t.batch.flush(),e&&((o=this._enabledFilters)!=null&&o.length)&&t.filter.push(this,this._enabledFilters),i&&t.mask.push(this,this._mask),this.cullable)this._renderWithCulling(t);else{this._render(t);for(let h=0,l=this.children.length;h<l;++h)this.children[h].render(t)}s&&t.batch.flush(),i&&t.mask.pop(this),e&&((a=this._enabledFilters)!=null&&a.length)&&t.filter.pop()}_render(t){}destroy(t){super.destroy(),this.sortDirty=!1;const e=typeof t=="boolean"?t:t==null?void 0:t.children,i=this.removeChildren(0,this.children.length);if(e)for(let s=0;s<i.length;++s)i[s].destroy(t)}get width(){return this.scale.x*this.getLocalBounds().width}set width(t){const e=this.getLocalBounds().width;e!==0?this.scale.x=t/e:this.scale.x=1,this._width=t}get height(){return this.scale.y*this.getLocalBounds().height}set height(t){const e=this.getLocalBounds().height;e!==0?this.scale.y=t/e:this.scale.y=1,this._height=t}};Om.defaultSortableChildren=!1;let Xt=Om;Xt.prototype.containerUpdateTransform=Xt.prototype.updateTransform,Object.defineProperties($,{SORTABLE_CHILDREN:{get(){return Xt.defaultSortableChildren},set(r){xt("7.1.0","settings.SORTABLE_CHILDREN is deprecated, use Container.defaultSortableChildren"),Xt.defaultSortableChildren=r}}});const jn=new lt,qv=new Uint16Array([0,1,2,0,2,3]);class ie extends Xt{constructor(t){super(),this._anchor=new Qi(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 Lt(16777215),this._tintRGB=null,this.tint=16777215,this.blendMode=ut.NORMAL,this._cachedTint=16777215,this.uvs=null,this.texture=t||it.EMPTY,this.vertexData=new Float32Array(8),this.vertexTrimmedData=null,this._transformID=-1,this._textureID=-1,this._transformTrimmedID=-1,this._textureTrimmedID=-1,this.indices=qv,this.pluginName="batch",this.isSprite=!0,this._roundPixels=$.ROUND_PIXELS}_onTextureUpdate(){this._textureID=-1,this._textureTrimmedID=-1,this._cachedTint=16777215,this._width&&(this.scale.x=mr(this.scale.x)*this._width/this._texture.orig.width),this._height&&(this.scale.y=mr(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,i=e.a,s=e.b,n=e.c,o=e.d,a=e.tx,h=e.ty,l=this.vertexData,u=t.trim,c=t.orig,d=this._anchor;let p=0,m=0,f=0,g=0;if(u?(m=u.x-d._x*c.width,p=m+u.width,g=u.y-d._y*c.height,f=g+u.height):(m=-d._x*c.width,p=m+c.width,g=-d._y*c.height,f=g+c.height),l[0]=i*m+n*g+a,l[1]=o*g+s*m+h,l[2]=i*p+n*g+a,l[3]=o*g+s*p+h,l[4]=i*p+n*f+a,l[5]=o*f+s*p+h,l[6]=i*m+n*f+a,l[7]=o*f+s*m+h,this._roundPixels){const y=$.RESOLUTION;for(let _=0;_<l.length;++_)l[_]=Math.round(l[_]*y)/y}}calculateTrimmedVertices(){if(!this.vertexTrimmedData)this.vertexTrimmedData=new Float32Array(8);else if(this._transformTrimmedID===this.transform._worldID&&this._textureTrimmedID===this._texture._updateID)return;this._transformTrimmedID=this.transform._worldID,this._textureTrimmedID=this._texture._updateID;const t=this._texture,e=this.vertexTrimmedData,i=t.orig,s=this._anchor,n=this.transform.worldTransform,o=n.a,a=n.b,h=n.c,l=n.d,u=n.tx,c=n.ty,d=-s._x*i.width,p=d+i.width,m=-s._y*i.height,f=m+i.height;if(e[0]=o*d+h*m+u,e[1]=l*m+a*d+c,e[2]=o*p+h*m+u,e[3]=l*m+a*p+c,e[4]=o*p+h*f+u,e[5]=l*f+a*p+c,e[6]=o*d+h*f+u,e[7]=l*f+a*d+c,this._roundPixels){const g=$.RESOLUTION;for(let y=0;y<e.length;++y)e[y]=Math.round(e[y]*g)/g}}_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 this.children.length===0?(this._localBounds||(this._localBounds=new Ma),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 ct),t=this._localBoundsRect),this._localBounds.getRectangle(t)):super.getLocalBounds.call(this,t)}containsPoint(t){this.worldTransform.applyInverse(t,jn);const e=this._texture.orig.width,i=this._texture.orig.height,s=-e*this.anchor.x;let n=0;return jn.x>=s&&jn.x<s+e&&(n=-i*this.anchor.y,jn.y>=n&&jn.y<n+i)}destroy(t){if(super.destroy(t),this._texture.off("update",this._onTextureUpdate,this),this._anchor=null,typeof t=="boolean"?t:t==null?void 0:t.texture){const e=typeof t=="boolean"?t:t==null?void 0:t.baseTexture;this._texture.destroy(!!e)}this._texture=null}static from(t,e){const i=t instanceof it?t:it.from(t,e);return new ie(i)}set roundPixels(t){this._roundPixels!==t&&(this._transformID=-1,this._transformTrimmedID=-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=mr(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=mr(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||it.EMPTY,this._cachedTint=16777215,this._textureID=-1,this._textureTrimmedID=-1,t&&(t.baseTexture.valid?this._onTextureUpdate():t.once("update",this._onTextureUpdate,this)))}}const Bm=new Gt;Ot.prototype._cacheAsBitmap=!1,Ot.prototype._cacheData=null,Ot.prototype._cacheAsBitmapResolution=null,Ot.prototype._cacheAsBitmapMultisample=null;class tT{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(Ot.prototype,{cacheAsBitmapResolution:{get(){return this._cacheAsBitmapResolution},set(r){r!==this._cacheAsBitmapResolution&&(this._cacheAsBitmapResolution=r,this.cacheAsBitmap&&(this.cacheAsBitmap=!1,this.cacheAsBitmap=!0))}},cacheAsBitmapMultisample:{get(){return this._cacheAsBitmapMultisample},set(r){r!==this._cacheAsBitmapMultisample&&(this._cacheAsBitmapMultisample=r,this.cacheAsBitmap&&(this.cacheAsBitmap=!1,this.cacheAsBitmap=!0))}},cacheAsBitmap:{get(){return this._cacheAsBitmap},set(r){if(this._cacheAsBitmap===r)return;this._cacheAsBitmap=r;let t;r?(this._cacheData||(this._cacheData=new tT),t=this._cacheData,t.originalRender=this.render,t.originalRenderCanvas=this.renderCanvas,t.originalUpdateTransform=this.updateTransform,t.originalCalculateBounds=this.calculateBounds,t.originalGetLocalBounds=this.getLocalBounds,t.originalDestroy=this.destroy,t.originalContainsPoint=this.containsPoint,t.originalMask=this._mask,t.originalFilterArea=this.filterArea,this.render=this._renderCached,this.renderCanvas=this._renderCachedCanvas,this.destroy=this._cacheAsBitmapDestroy):(t=this._cacheData,t.sprite&&this._destroyCachedDisplayObject(),this.render=t.originalRender,this.renderCanvas=t.originalRenderCanvas,this.calculateBounds=t.originalCalculateBounds,this.getLocalBounds=t.originalGetLocalBounds,this.destroy=t.originalDestroy,this.updateTransform=t.originalUpdateTransform,this.containsPoint=t.originalContainsPoint,this._mask=t.originalMask,this.filterArea=t.originalFilterArea)}}}),Ot.prototype._renderCached=function(r){!this.visible||this.worldAlpha<=0||!this.renderable||(this._initCachedDisplayObject(r),this._cacheData.sprite.transform._worldID=this.transform._worldID,this._cacheData.sprite.worldAlpha=this.worldAlpha,this._cacheData.sprite._render(r))},Ot.prototype._initCachedDisplayObject=function(r){var d,p;if((d=this._cacheData)!=null&&d.sprite)return;const t=this.alpha;this.alpha=1,r.batch.flush();const e=this.getLocalBounds(new ct,!0);if((p=this.filters)!=null&&p.length){const m=this.filters[0].padding;e.pad(m)}const i=this.cacheAsBitmapResolution||r.resolution;e.ceil(i),e.width=Math.max(e.width,1/i),e.height=Math.max(e.height,1/i);const s=r.renderTexture.current,n=r.renderTexture.sourceFrame.clone(),o=r.renderTexture.destinationFrame.clone(),a=r.projection.transform,h=Jr.create({width:e.width,height:e.height,resolution:i,multisample:this.cacheAsBitmapMultisample??r.multisample}),l=`cacheAsBitmap_${Zr()}`;this._cacheData.textureCacheId=l,ft.addToCache(h.baseTexture,l),it.addToCache(h,l);const u=this.transform.localTransform.copyTo(Bm).invert().translate(-e.x,-e.y);this.render=this._cacheData.originalRender,r.render(this,{renderTexture:h,clear:!0,transform:u,skipUpdateTransform:!1}),r.framebuffer.blit(),r.projection.transform=a,r.renderTexture.bind(s,n,o),this.render=this._renderCached,this.updateTransform=this.displayObjectUpdateTransform,this.calculateBounds=this._calculateCachedBounds,this.getLocalBounds=this._getCachedLocalBounds,this._mask=null,this.filterArea=null,this.alpha=t;const c=new ie(h);c.transform.worldTransform=this.transform.worldTransform,c.anchor.x=-(e.x/e.width),c.anchor.y=-(e.y/e.height),c.alpha=t,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)},Ot.prototype._renderCachedCanvas=function(r){!this.visible||this.worldAlpha<=0||!this.renderable||(this._initCachedDisplayObjectCanvas(r),this._cacheData.sprite.worldAlpha=this.worldAlpha,this._cacheData.sprite._renderCanvas(r))},Ot.prototype._initCachedDisplayObjectCanvas=function(r){var u;if((u=this._cacheData)!=null&&u.sprite)return;const t=this.getLocalBounds(new ct,!0),e=this.alpha;this.alpha=1;const i=r.canvasContext.activeContext,s=r._projTransform,n=this.cacheAsBitmapResolution||r.resolution;t.ceil(n),t.width=Math.max(t.width,1/n),t.height=Math.max(t.height,1/n);const o=Jr.create({width:t.width,height:t.height,resolution:n}),a=`cacheAsBitmap_${Zr()}`;this._cacheData.textureCacheId=a,ft.addToCache(o.baseTexture,a),it.addToCache(o,a);const h=Bm;this.transform.localTransform.copyTo(h),h.invert(),h.tx-=t.x,h.ty-=t.y,this.renderCanvas=this._cacheData.originalRenderCanvas,r.render(this,{renderTexture:o,clear:!0,transform:h,skipUpdateTransform:!1}),r.canvasContext.activeContext=i,r._projTransform=s,this.renderCanvas=this._renderCachedCanvas,this.updateTransform=this.displayObjectUpdateTransform,this.calculateBounds=this._calculateCachedBounds,this.getLocalBounds=this._getCachedLocalBounds,this._mask=null,this.filterArea=null,this.alpha=e;const l=new ie(o);l.transform.worldTransform=this.transform.worldTransform,l.anchor.x=-(t.x/t.width),l.anchor.y=-(t.y/t.height),l.alpha=e,l._bounds=this._bounds,this._cacheData.sprite=l,this.transform._parentID=-1,this.parent?this.updateTransform():(this.parent=r._tempDisplayObjectParent,this.updateTransform(),this.parent=null),this.containsPoint=l.containsPoint.bind(l)},Ot.prototype._calculateCachedBounds=function(){this._bounds.clear(),this._cacheData.sprite.transform._worldID=this.transform._worldID,this._cacheData.sprite._calculateBounds(),this._bounds.updateID=this._boundsID},Ot.prototype._getCachedLocalBounds=function(){return this._cacheData.sprite.getLocalBounds(null)},Ot.prototype._destroyCachedDisplayObject=function(){this._cacheData.sprite._texture.destroy(!0),this._cacheData.sprite=null,ft.removeFromCache(this._cacheData.textureCacheId),it.removeFromCache(this._cacheData.textureCacheId),this._cacheData.textureCacheId=null},Ot.prototype._cacheAsBitmapDestroy=function(r){this.cacheAsBitmap=!1,this.destroy(r)},Ot.prototype.name=null,Xt.prototype.getChildByName=function(r,t){for(let e=0,i=this.children.length;e<i;e++)if(this.children[e].name===r)return this.children[e];if(t)for(let e=0,i=this.children.length;e<i;e++){const s=this.children[e];if(!s.getChildByName)continue;const n=s.getChildByName(r,!0);if(n)return n}return null},Ot.prototype.getGlobalPosition=function(r=new lt,t=!1){return this.parent?this.parent.toGlobal(this.position,r,t):(r.x=this.position.x,r.y=this.position.y),r};var eT=`varying vec2 vTextureCoord;
|
|
526
|
+
`;const zv=Kv,Nm=Yv;class Fm{constructor(t){this.renderer=t}contextChange(t){let e;if(this.renderer.context.webGLVersion===1){const i=t.getParameter(t.FRAMEBUFFER_BINDING);t.bindFramebuffer(t.FRAMEBUFFER,null),e=t.getParameter(t.SAMPLES),t.bindFramebuffer(t.FRAMEBUFFER,i)}else{const i=t.getParameter(t.DRAW_FRAMEBUFFER_BINDING);t.bindFramebuffer(t.DRAW_FRAMEBUFFER,null),e=t.getParameter(t.SAMPLES),t.bindFramebuffer(t.DRAW_FRAMEBUFFER,i)}e>=Yt.HIGH?this.multisample=Yt.HIGH:e>=Yt.MEDIUM?this.multisample=Yt.MEDIUM:e>=Yt.LOW?this.multisample=Yt.LOW:this.multisample=Yt.NONE}destroy(){}}Fm.extension={type:J.RendererSystem,name:"_multisample"},et.add(Fm);class jv{constructor(t){this.buffer=t||null,this.updateID=-1,this.byteLength=-1,this.refCount=0}}class Dm{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:i}=this,s=t._glBuffers[i]||this.createGLBuffer(t);e.bindBuffer(t.type,s.buffer)}unbind(t){const{gl:e}=this;e.bindBuffer(t,null)}bindBufferBase(t,e){const{gl:i,CONTEXT_UID:s}=this;if(this.boundBufferBases[e]!==t){const n=t._glBuffers[s]||this.createGLBuffer(t);this.boundBufferBases[e]=t,i.bindBufferBase(i.UNIFORM_BUFFER,e,n.buffer)}}bindBufferRange(t,e,i){const{gl:s,CONTEXT_UID:n}=this;i=i||0;const o=t._glBuffers[n]||this.createGLBuffer(t);s.bindBufferRange(s.UNIFORM_BUFFER,e||0,o.buffer,i*256,256)}update(t){const{gl:e,CONTEXT_UID:i}=this,s=t._glBuffers[i]||this.createGLBuffer(t);if(t._updateID!==s.updateID)if(s.updateID=t._updateID,e.bindBuffer(t.type,s.buffer),s.byteLength>=t.data.byteLength)e.bufferSubData(t.type,0,t.data);else{const n=t.static?e.STATIC_DRAW:e.DYNAMIC_DRAW;s.byteLength=t.data.byteLength,e.bufferData(t.type,t.data,n)}}dispose(t,e){if(!this.managedBuffers[t.id])return;delete this.managedBuffers[t.id];const i=t._glBuffers[this.CONTEXT_UID],s=this.gl;t.disposeRunner.remove(this),i&&(e||s.deleteBuffer(i.buffer),delete t._glBuffers[this.CONTEXT_UID])}disposeAll(t){const e=Object.keys(this.managedBuffers);for(let i=0;i<e.length;i++)this.dispose(this.managedBuffers[e[i]],t)}createGLBuffer(t){const{CONTEXT_UID:e,gl:i}=this;return t._glBuffers[e]=new jv(i.createBuffer()),this.managedBuffers[t.id]=t,t.disposeRunner.add(this),t._glBuffers[e]}}Dm.extension={type:J.RendererSystem,name:"buffer"},et.add(Dm);class km{constructor(t){this.renderer=t}render(t,e){const i=this.renderer;let s,n,o,a;if(e&&(s=e.renderTexture,n=e.clear,o=e.transform,a=e.skipUpdateTransform),this.renderingToScreen=!s,i.runners.prerender.emit(),i.emit("prerender"),i.projection.transform=o,!i.context.isLost){if(s||(this.lastObjectRendered=t),!a){const h=t.enableTempParent();t.updateTransform(),t.disableTempParent(h)}i.renderTexture.bind(s),i.batch.currentRenderer.start(),(n??i.background.clearBeforeRender)&&i.renderTexture.clear(),t.render(i),i.batch.currentRenderer.flush(),s&&(e.blit&&i.framebuffer.blit(),s.baseTexture.update()),i.runners.postrender.emit(),i.projection.transform=null,i.emit("postrender")}}destroy(){this.renderer=null,this.lastObjectRendered=null}}km.extension={type:J.RendererSystem,name:"objectRenderer"},et.add(km);const Ma=class cp extends Xv{constructor(t){super(),this.type=wp.WEBGL,t=Object.assign({},Q.RENDER_OPTIONS,t),this.gl=null,this.CONTEXT_UID=0,this.globalUniforms=new ri({projectionMatrix:new Nt},!0);const e={runners:["init","destroy","contextChange","resolutionChange","reset","update","postrender","prerender","resize"],systems:cp.__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&&(vt("7.0.0","options.useContextAlpha is deprecated, use options.premultipliedAlpha and options.backgroundAlpha instead"),t.premultipliedAlpha=t.useContextAlpha&&t.useContextAlpha!=="notMultiplied",t.backgroundAlpha=t.useContextAlpha===!1?1:t.backgroundAlpha),this._plugin.rendererPlugins=cp.__plugins,this.options=t,this.startup.run(this.options)}static test(t){return t!=null&&t.forceCanvas?!1:b1()}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 vt("7.0.0","renderer.clearBeforeRender has been deprecated, please use renderer.background.clearBeforeRender instead."),this.background.clearBeforeRender}get useContextAlpha(){return vt("7.0.0","renderer.useContextAlpha has been deprecated, please use renderer.context.premultipliedAlpha instead."),this.context.useContextAlpha}get preserveDrawingBuffer(){return vt("7.0.0","renderer.preserveDrawingBuffer has been deprecated, we cannot truly know this unless pixi created the context"),this.context.preserveDrawingBuffer}get backgroundColor(){return vt("7.0.0","renderer.backgroundColor has been deprecated, use renderer.background.color instead."),this.background.color}set backgroundColor(t){vt("7.0.0","renderer.backgroundColor has been deprecated, use renderer.background.color instead."),this.background.color=t}get backgroundAlpha(){return vt("7.0.0","renderer.backgroundAlpha has been deprecated, use renderer.background.alpha instead."),this.background.alpha}set backgroundAlpha(t){vt("7.0.0","renderer.backgroundAlpha has been deprecated, use renderer.background.alpha instead."),this.background.alpha=t}get powerPreference(){return vt("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)}};Ma.extension={type:J.Renderer,priority:1},Ma.__plugins={},Ma.__systems={};let Su=Ma;et.handleByMap(J.RendererPlugin,Su.__plugins),et.handleByMap(J.RendererSystem,Su.__systems),et.add(Su);class Om extends Hn{constructor(t,e){const{width:i,height:s}=e||{};super(i,s),this.items=[],this.itemDirtyIds=[];for(let n=0;n<t;n++){const o=new ft;this.items.push(o),this.itemDirtyIds.push(-2)}this.length=t,this._load=null,this.baseTexture=null}initFromArray(t,e){for(let i=0;i<this.length;i++)t[i]&&(t[i].castToBaseTexture?this.addBaseTextureAt(t[i].castToBaseTexture(),i):t[i]instanceof Hn?this.addResourceAt(t[i],i):this.addResourceAt(Hf(t[i],e),i))}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(this.baseTexture!==null)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(e=>e.resource).filter(e=>e).map(e=>e.load());return this._load=Promise.all(t).then(()=>{const{realWidth:e,realHeight:i}=this.items[0];return this.resize(e,i),this.update(),Promise.resolve(this)}),this._load}}class Jv extends Om{constructor(t,e){const{width:i,height:s}=e||{};let n,o;Array.isArray(t)?(n=t,o=t.length):o=t,super(o,{width:i,height:s}),n&&this.initFromArray(n,e)}addBaseTextureAt(t,e){if(t.resource)this.addResourceAt(t.resource,e);else throw new Error("ArrayResource does not support RenderTexture");return this}bind(t){super.bind(t),t.target=Ms.TEXTURE_2D_ARRAY}upload(t,e,i){const{length:s,itemDirtyIds:n,items:o}=this,{gl:a}=t;i.dirtyId<0&&a.texImage3D(a.TEXTURE_2D_ARRAY,0,i.internalFormat,this._width,this._height,s,0,e.format,i.type,null);for(let h=0;h<s;h++){const l=o[h];n[h]<l.dirtyId&&(n[h]=l.dirtyId,l.valid&&a.texSubImage3D(a.TEXTURE_2D_ARRAY,0,0,0,h,l.resource.width,l.resource.height,1,e.format,i.type,l.resource.source))}return!0}}class $v extends _r{constructor(t){super(t)}static test(t){const{OffscreenCanvas:e}=globalThis;return e&&t instanceof e?!0:globalThis.HTMLCanvasElement&&t instanceof HTMLCanvasElement}}const Bm=class Zo extends Om{constructor(t,e){const{width:i,height:s,autoLoad:n,linkBaseTexture:o}=e||{};if(t&&t.length!==Zo.SIDES)throw new Error(`Invalid length. Got ${t.length}, expected 6`);super(6,{width:i,height:s});for(let a=0;a<Zo.SIDES;a++)this.items[a].target=Ms.TEXTURE_CUBE_MAP_POSITIVE_X+a;this.linkBaseTexture=o!==!1,t&&this.initFromArray(t,e),n!==!1&&this.load()}bind(t){super.bind(t),t.target=Ms.TEXTURE_CUBE_MAP}addBaseTextureAt(t,e,i){if(i===void 0&&(i=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)this.addResourceAt(t.resource,e);else throw new Error("CubeResource does not support copying of renderTexture.");else t.target=Ms.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,i){const s=this.itemDirtyIds;for(let n=0;n<Zo.SIDES;n++){const o=this.items[n];(s[n]<o.dirtyId||i.dirtyId<e.dirtyId)&&(o.valid&&o.resource?(o.resource.upload(t,o,i),s[n]=o.dirtyId):s[n]<-1&&(t.gl.texImage2D(o.target,0,i.internalFormat,e.realWidth,e.realHeight,0,e.format,i.type,null),s[n]=-1))}return!0}static test(t){return Array.isArray(t)&&t.length===Zo.SIDES}};Bm.SIDES=6;let Qv=Bm;class Vs extends _r{constructor(t,e){e=e||{};let i,s,n;typeof t=="string"?(i=Vs.EMPTY,s=t,n=!0):(i=t,s=null,n=!1),super(i),this.url=s,this.crossOrigin=e.crossOrigin??!0,this.alphaMode=typeof e.alphaMode=="number"?e.alphaMode:null,this.ownsImageBitmap=e.ownsImageBitmap??n,this._load=null,e.autoLoad!==!1&&this.load()}load(){return this._load?this._load:(this._load=new Promise(async(t,e)=>{if(this.url===null){t(this);return}try{const i=await Q.ADAPTER.fetch(this.url,{mode:this.crossOrigin?"cors":"no-cors"});if(this.destroyed)return;const s=await i.blob();if(this.destroyed)return;const n=await createImageBitmap(s,{premultiplyAlpha:this.alphaMode===null||this.alphaMode===xe.UNPACK?"premultiply":"none"});if(this.destroyed){n.close();return}this.source=n,this.update(),t(this)}catch(i){if(this.destroyed)return;e(i),this.onError.emit(i)}}),this._load)}upload(t,e,i){return this.source instanceof ImageBitmap?(typeof this.alphaMode=="number"&&(e.alphaMode=this.alphaMode),super.upload(t,e,i)):(this.load(),!1)}dispose(){this.ownsImageBitmap&&this.source instanceof ImageBitmap&&this.source.close(),super.dispose(),this._load=null}static test(t){return!!globalThis.createImageBitmap&&typeof ImageBitmap<"u"&&(typeof t=="string"||t instanceof ImageBitmap)}static get EMPTY(){return Vs._EMPTY=Vs._EMPTY??Q.ADAPTER.createCanvas(0,0),Vs._EMPTY}}const Eu=class al extends _r{constructor(t,e){e=e||{},super(Q.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,e.autoLoad!==!1&&this.load()}load(){return this._load?this._load:(this._load=new Promise(t=>{if(this._resolve=()=>{this.update(),t(this)},al.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;_r.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,i=t.height;if(!e||!i)throw new Error("The SVG image must have width and height defined (in pixels), canvas API needs them.");let s=e*this.scale,n=i*this.scale;(this._overrideWidth||this._overrideHeight)&&(s=this._overrideWidth||this._overrideHeight/i*e,n=this._overrideHeight||this._overrideWidth/e*i),s=Math.round(s),n=Math.round(n);const o=this.source;o.width=s,o.height=n,o._pixiId=`canvas_${Kr()}`,o.getContext("2d").drawImage(t,0,0,e,i,0,0,s,n),this._resolve(),this._resolve=null}}static getSize(t){const e=al.SVG_SIZE.exec(t),i={};return e&&(i[e[1]]=Math.round(parseFloat(e[3])),i[e[5]]=Math.round(parseFloat(e[7]))),i}dispose(){super.dispose(),this._resolve=null,this._crossorigin=null}static test(t,e){return e==="svg"||typeof t=="string"&&t.startsWith("data:image/svg+xml")||typeof t=="string"&&al.SVG_XML.test(t)}};Eu.SVG_XML=/^(<\?xml[^?]+\?>)?\s*(<!--[^(-->)]*-->)?\s*\<svg/m,Eu.SVG_SIZE=/<svg[^>]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*>/i;let Cu=Eu;const Iu=class dp extends _r{constructor(t,e){if(e=e||{},!(t instanceof HTMLVideoElement)){const i=document.createElement("video");e.autoLoad!==!1&&i.setAttribute("preload","auto"),e.playsinline!==!1&&(i.setAttribute("webkit-playsinline",""),i.setAttribute("playsinline","")),e.muted===!0&&(i.setAttribute("muted",""),i.muted=!0),e.loop===!0&&i.setAttribute("loop",""),e.autoPlay!==!1&&i.setAttribute("autoplay",""),typeof t=="string"&&(t=[t]);const s=t[0].src||t[0];_r.crossOrigin(i,s,e.crossorigin);for(let n=0;n<t.length;++n){const o=document.createElement("source");let{src:a,mime:h}=t[n];if(a=a||t[n],a.startsWith("data:"))h=a.slice(5,a.indexOf(";"));else if(!a.startsWith("blob:")){const l=a.split("?").shift().toLowerCase(),u=l.slice(l.lastIndexOf(".")+1);h=h||dp.MIME_TYPES[u]||`video/${u}`}o.src=a,h&&(o.type=h),i.appendChild(o)}t=i}super(t),this.noSubImage=!0,this._autoUpdate=!0,this._isConnectedToTicker=!1,this._updateFPS=e.updateFPS||0,this._msToNextUpdate=0,this.autoPlay=e.autoPlay!==!1,this._videoFrameRequestCallback=this._videoFrameRequestCallback.bind(this),this._videoFrameRequestCallbackHandle=null,this._load=null,this._resolve=null,this._reject=null,this._onCanPlay=this._onCanPlay.bind(this),this._onError=this._onError.bind(this),this._onPlayStart=this._onPlayStart.bind(this),this._onPlayStop=this._onPlayStop.bind(this),this._onSeeked=this._onSeeked.bind(this),e.autoLoad!==!1&&this.load()}update(t=0){if(!this.destroyed){if(this._updateFPS){const e=be.shared.elapsedMS*this.source.playbackRate;this._msToNextUpdate=Math.floor(this._msToNextUpdate-e)}(!this._updateFPS||this._msToNextUpdate<=0)&&(super.update(),this._msToNextUpdate=this._updateFPS?Math.floor(1e3/this._updateFPS):0)}}_videoFrameRequestCallback(){this.update(),this.destroyed?this._videoFrameRequestCallbackHandle=null:this._videoFrameRequestCallbackHandle=this.source.requestVideoFrameCallback(this._videoFrameRequestCallback)}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),t.addEventListener("pause",this._onPlayStop),t.addEventListener("seeked",this._onSeeked),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,i)=>{this.valid?e(this):(this._resolve=e,this._reject=i,t.load())}),this._load}_onError(t){this.source.removeEventListener("error",this._onError,!0),this.onError.emit(t),this._reject&&(this._reject(t),this._reject=null,this._resolve=null)}_isSourcePlaying(){const t=this.source;return!t.paused&&!t.ended}_isSourceReady(){return this.source.readyState>2}_onPlayStart(){this.valid||this._onCanPlay(),this._configureAutoUpdate()}_onPlayStop(){this._configureAutoUpdate()}_onSeeked(){this._autoUpdate&&!this._isSourcePlaying()&&(this._msToNextUpdate=0,this.update(),this._msToNextUpdate=0)}_onCanPlay(){const t=this.source;t.removeEventListener("canplay",this._onCanPlay),t.removeEventListener("canplaythrough",this._onCanPlay);const e=this.valid;this._msToNextUpdate=0,this.update(),this._msToNextUpdate=0,!e&&this._resolve&&(this._resolve(this),this._resolve=null,this._reject=null),this._isSourcePlaying()?this._onPlayStart():this.autoPlay&&t.play()}dispose(){this._configureAutoUpdate();const t=this.source;t&&(t.removeEventListener("play",this._onPlayStart),t.removeEventListener("pause",this._onPlayStop),t.removeEventListener("seeked",this._onSeeked),t.removeEventListener("canplay",this._onCanPlay),t.removeEventListener("canplaythrough",this._onCanPlay),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._configureAutoUpdate())}get updateFPS(){return this._updateFPS}set updateFPS(t){t!==this._updateFPS&&(this._updateFPS=t,this._configureAutoUpdate())}_configureAutoUpdate(){this._autoUpdate&&this._isSourcePlaying()?!this._updateFPS&&this.source.requestVideoFrameCallback?(this._isConnectedToTicker&&(be.shared.remove(this.update,this),this._isConnectedToTicker=!1,this._msToNextUpdate=0),this._videoFrameRequestCallbackHandle===null&&(this._videoFrameRequestCallbackHandle=this.source.requestVideoFrameCallback(this._videoFrameRequestCallback))):(this._videoFrameRequestCallbackHandle!==null&&(this.source.cancelVideoFrameCallback(this._videoFrameRequestCallbackHandle),this._videoFrameRequestCallbackHandle=null),this._isConnectedToTicker||(be.shared.add(this.update,this),this._isConnectedToTicker=!0,this._msToNextUpdate=0)):(this._videoFrameRequestCallbackHandle!==null&&(this.source.cancelVideoFrameCallback(this._videoFrameRequestCallbackHandle),this._videoFrameRequestCallbackHandle=null),this._isConnectedToTicker&&(be.shared.remove(this.update,this),this._isConnectedToTicker=!1,this._msToNextUpdate=0))}static test(t,e){return globalThis.HTMLVideoElement&&t instanceof HTMLVideoElement||dp.TYPES.includes(e)}};Iu.TYPES=["mp4","m4v","webm","ogg","ogv","h264","avi","mov"],Iu.MIME_TYPES={ogv:"video/ogg",mov:"video/quicktime",m4v:"video/mp4"};let Wm=Iu;hu.push(Vs,om,$v,Wm,Cu,ua,Qv,Jv);class Ra{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?ct.EMPTY:(t=t||new ct(0,0,1,1),t.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:i,b:s,c:n,d:o,tx:a,ty:h}=t,l=i*e.x+n*e.y+a,u=s*e.x+o*e.y+h;this.minX=Math.min(this.minX,l),this.maxX=Math.max(this.maxX,l),this.minY=Math.min(this.minY,u),this.maxY=Math.max(this.maxY,u)}addQuad(t){let e=this.minX,i=this.minY,s=this.maxX,n=this.maxY,o=t[0],a=t[1];e=o<e?o:e,i=a<i?a:i,s=o>s?o:s,n=a>n?a:n,o=t[2],a=t[3],e=o<e?o:e,i=a<i?a:i,s=o>s?o:s,n=a>n?a:n,o=t[4],a=t[5],e=o<e?o:e,i=a<i?a:i,s=o>s?o:s,n=a>n?a:n,o=t[6],a=t[7],e=o<e?o:e,i=a<i?a:i,s=o>s?o:s,n=a>n?a:n,this.minX=e,this.minY=i,this.maxX=s,this.maxY=n}addFrame(t,e,i,s,n){this.addFrameMatrix(t.worldTransform,e,i,s,n)}addFrameMatrix(t,e,i,s,n){const o=t.a,a=t.b,h=t.c,l=t.d,u=t.tx,c=t.ty;let d=this.minX,p=this.minY,m=this.maxX,f=this.maxY,g=o*e+h*i+u,y=a*e+l*i+c;d=g<d?g:d,p=y<p?y:p,m=g>m?g:m,f=y>f?y:f,g=o*s+h*i+u,y=a*s+l*i+c,d=g<d?g:d,p=y<p?y:p,m=g>m?g:m,f=y>f?y:f,g=o*e+h*n+u,y=a*e+l*n+c,d=g<d?g:d,p=y<p?y:p,m=g>m?g:m,f=y>f?y:f,g=o*s+h*n+u,y=a*s+l*n+c,d=g<d?g:d,p=y<p?y:p,m=g>m?g:m,f=y>f?y:f,this.minX=d,this.minY=p,this.maxX=m,this.maxY=f}addVertexData(t,e,i){let s=this.minX,n=this.minY,o=this.maxX,a=this.maxY;for(let h=e;h<i;h+=2){const l=t[h],u=t[h+1];s=l<s?l:s,n=u<n?u:n,o=l>o?l:o,a=u>a?u:a}this.minX=s,this.minY=n,this.maxX=o,this.maxY=a}addVertices(t,e,i,s){this.addVerticesMatrix(t.worldTransform,e,i,s)}addVerticesMatrix(t,e,i,s,n=0,o=n){const a=t.a,h=t.b,l=t.c,u=t.d,c=t.tx,d=t.ty;let p=this.minX,m=this.minY,f=this.maxX,g=this.maxY;for(let y=i;y<s;y+=2){const _=e[y],b=e[y+1],v=a*_+l*b+c,S=u*b+h*_+d;p=Math.min(p,v-n),f=Math.max(f,v+n),m=Math.min(m,S-o),g=Math.max(g,S+o)}this.minX=p,this.minY=m,this.maxX=f,this.maxY=g}addBounds(t){const e=this.minX,i=this.minY,s=this.maxX,n=this.maxY;this.minX=t.minX<e?t.minX:e,this.minY=t.minY<i?t.minY:i,this.maxX=t.maxX>s?t.maxX:s,this.maxY=t.maxY>n?t.maxY:n}addBoundsMask(t,e){const i=t.minX>e.minX?t.minX:e.minX,s=t.minY>e.minY?t.minY:e.minY,n=t.maxX<e.maxX?t.maxX:e.maxX,o=t.maxY<e.maxY?t.maxY:e.maxY;if(i<=n&&s<=o){const a=this.minX,h=this.minY,l=this.maxX,u=this.maxY;this.minX=i<a?i:a,this.minY=s<h?s:h,this.maxX=n>l?n:l,this.maxY=o>u?o:u}}addBoundsMatrix(t,e){this.addFrameMatrix(e,t.minX,t.minY,t.maxX,t.maxY)}addBoundsArea(t,e){const i=t.minX>e.x?t.minX:e.x,s=t.minY>e.y?t.minY:e.y,n=t.maxX<e.x+e.width?t.maxX:e.x+e.width,o=t.maxY<e.y+e.height?t.maxY:e.y+e.height;if(i<=n&&s<=o){const a=this.minX,h=this.minY,l=this.maxX,u=this.maxY;this.minX=i<a?i:a,this.minY=s<h?s:h,this.maxX=n>l?n:l,this.maxY=o>u?o:u}}pad(t=0,e=t){this.isEmpty()||(this.minX-=t,this.maxX+=t,this.minY-=e,this.maxY+=e)}addFramePad(t,e,i,s,n,o){t-=n,e-=o,i+=n,s+=o,this.minX=this.minX<t?this.minX:t,this.maxX=this.maxX>i?this.maxX:i,this.minY=this.minY<e?this.minY:e,this.maxY=this.maxY>s?this.maxY:s}}class Ot extends Nn{constructor(){super(),this.tempDisplayObjectParent=null,this.transform=new pu,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 Ra,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 i=0;i<e.length;++i){const s=e[i];Object.defineProperty(Ot.prototype,s,Object.getOwnPropertyDescriptor(t,s))}}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 ct),e=this._boundsRect),this._bounds.getRectangle(e)}getLocalBounds(t){t||(this._localBoundsRect||(this._localBoundsRect=new ct),t=this._localBoundsRect),this._localBounds||(this._localBounds=new Ra);const e=this.transform,i=this.parent;this.parent=null,this._tempDisplayObjectParent.worldAlpha=(i==null?void 0:i.worldAlpha)??1,this.transform=this._tempDisplayObjectParent.transform;const s=this._bounds,n=this._boundsID;this._bounds=this._localBounds;const o=this.getBounds(!1,t);return this.parent=i,this.transform=e,this._bounds=s,this._bounds.updateID+=this._boundsID-n,o}toGlobal(t,e,i=!1){return i||(this._recursivePostUpdateTransform(),this.parent?this.displayObjectUpdateTransform():(this.parent=this._tempDisplayObjectParent,this.displayObjectUpdateTransform(),this.parent=null)),this.worldTransform.apply(t,e)}toLocal(t,e,i,s){return e&&(t=e.toGlobal(t,i,s)),s||(this._recursivePostUpdateTransform(),this.parent?this.displayObjectUpdateTransform():(this.parent=this._tempDisplayObjectParent,this.displayObjectUpdateTransform(),this.parent=null)),this.worldTransform.applyInverse(t,i)}setParent(t){if(!t||!t.addChild)throw new Error("setParent: Argument must be a Container");return t.addChild(this),t}removeFromParent(){var t;(t=this.parent)==null||t.removeChild(this)}setTransform(t=0,e=0,i=1,s=1,n=0,o=0,a=0,h=0,l=0){return this.position.x=t,this.position.y=e,this.scale.x=i||1,this.scale.y=s||1,this.rotation=n,this.skew.x=o,this.skew.y=a,this.pivot.x=h,this.pivot.y=l,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 this.tempDisplayObjectParent===null&&(this.tempDisplayObjectParent=new qv),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*K1}set angle(t){this.transform.rotation=t*Y1}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 e=this._mask.isMaskData?this._mask.maskObject:this._mask;e&&(e._maskRefCount--,e._maskRefCount===0&&(e.renderable=!0,e.isMask=!1))}if(this._mask=t,this._mask){const e=this._mask.isMaskData?this._mask.maskObject:this._mask;e&&(e._maskRefCount===0&&(e.renderable=!1,e.isMask=!0),e._maskRefCount++)}}}}class qv extends Ot{constructor(){super(...arguments),this.sortDirty=null}}Ot.prototype.displayObjectUpdateTransform=Ot.prototype.updateTransform;const tT=new Nt;function eT(r,t){return r.zIndex===t.zIndex?r._lastSortedIndex-t._lastSortedIndex:r.zIndex-t.zIndex}const Um=class pp extends Ot{constructor(){super(),this.children=[],this.sortableChildren=pp.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 i=this.getChildIndex(t),s=this.getChildIndex(e);this.children[i]=e,this.children[s]=t,this.onChildrenChange(i<s?i:s)}getChildIndex(t){const e=this.children.indexOf(t);if(e===-1)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 i=this.getChildIndex(t);Us(this.children,i,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],i=this.children.indexOf(e);if(i===-1)return null;e.parent=null,e.transform._parentID=-1,Us(this.children,i,1),this._boundsID++,this.onChildrenChange(i),e.emit("removed",this),this.emit("childRemoved",e,this,i)}return t[0]}removeChildAt(t){const e=this.getChildAt(t);return e.parent=null,e.transform._parentID=-1,Us(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 i=t,s=e,n=s-i;let o;if(n>0&&n<=s){o=this.children.splice(i,n);for(let a=0;a<o.length;++a)o[a].parent=null,o[a].transform&&(o[a].transform._parentID=-1);this._boundsID++,this.onChildrenChange(t);for(let a=0;a<o.length;++a)o[a].emit("removed",this),this.emit("childRemoved",o[a],this,a);return o}else if(n===0&&this.children.length===0)return[];throw new RangeError("removeChildren: numeric values are outside the acceptable range.")}sortChildren(){let t=!1;for(let e=0,i=this.children.length;e<i;++e){const s=this.children[e];s._lastSortedIndex=e,!t&&s.zIndex!==0&&(t=!0)}t&&this.children.length>1&&this.children.sort(eT),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 i=this.children[t];i.visible&&i.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 i=e._mask.isMaskData?e._mask.maskObject:e._mask;i?(i.calculateBounds(),this._bounds.addBoundsMask(e._bounds,i._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 i=super.getLocalBounds(t);if(!e)for(let s=0,n=this.children.length;s<n;++s){const o=this.children[s];o.visible&&o.updateTransform()}return i}_calculateBounds(){}_renderWithCulling(t){const e=t.renderTexture.sourceFrame;if(!(e.width>0&&e.height>0))return;let i,s;this.cullArea?(i=this.cullArea,s=this.worldTransform):this._render!==pp.prototype._render&&(i=this.getBounds(!0));const n=t.projection.transform;if(n&&(s?(s=tT.copyFrom(s),s.prepend(n)):s=n),i&&e.intersects(i,s))this._render(t);else if(this.cullArea)return;for(let o=0,a=this.children.length;o<a;++o){const h=this.children[o],l=h.cullable;h.cullable=l||!this.cullArea,h.render(t),h.cullable=l}}render(t){var e;if(!(!this.visible||this.worldAlpha<=0||!this.renderable))if(this._mask||(e=this.filters)!=null&&e.length)this.renderAdvanced(t);else if(this.cullable)this._renderWithCulling(t);else{this._render(t);for(let i=0,s=this.children.length;i<s;++i)this.children[i].render(t)}}renderAdvanced(t){var n,o,a;const e=this.filters,i=this._mask;if(e){this._enabledFilters||(this._enabledFilters=[]),this._enabledFilters.length=0;for(let h=0;h<e.length;h++)e[h].enabled&&this._enabledFilters.push(e[h])}const s=e&&((n=this._enabledFilters)==null?void 0:n.length)||i&&(!i.isMaskData||i.enabled&&(i.autoDetect||i.type!==jt.NONE));if(s&&t.batch.flush(),e&&((o=this._enabledFilters)!=null&&o.length)&&t.filter.push(this,this._enabledFilters),i&&t.mask.push(this,this._mask),this.cullable)this._renderWithCulling(t);else{this._render(t);for(let h=0,l=this.children.length;h<l;++h)this.children[h].render(t)}s&&t.batch.flush(),i&&t.mask.pop(this),e&&((a=this._enabledFilters)!=null&&a.length)&&t.filter.pop()}_render(t){}destroy(t){super.destroy(),this.sortDirty=!1;const e=typeof t=="boolean"?t:t==null?void 0:t.children,i=this.removeChildren(0,this.children.length);if(e)for(let s=0;s<i.length;++s)i[s].destroy(t)}get width(){return this.scale.x*this.getLocalBounds().width}set width(t){const e=this.getLocalBounds().width;e!==0?this.scale.x=t/e:this.scale.x=1,this._width=t}get height(){return this.scale.y*this.getLocalBounds().height}set height(t){const e=this.getLocalBounds().height;e!==0?this.scale.y=t/e:this.scale.y=1,this._height=t}};Um.defaultSortableChildren=!1;let Xt=Um;Xt.prototype.containerUpdateTransform=Xt.prototype.updateTransform,Object.defineProperties(Q,{SORTABLE_CHILDREN:{get(){return Xt.defaultSortableChildren},set(r){vt("7.1.0","settings.SORTABLE_CHILDREN is deprecated, use Container.defaultSortableChildren"),Xt.defaultSortableChildren=r}}});const Jn=new lt,iT=new Uint16Array([0,1,2,0,2,3]);class ie extends Xt{constructor(t){super(),this._anchor=new qi(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 Gt(16777215),this._tintRGB=null,this.tint=16777215,this.blendMode=ut.NORMAL,this._cachedTint=16777215,this.uvs=null,this.texture=t||rt.EMPTY,this.vertexData=new Float32Array(8),this.vertexTrimmedData=null,this._transformID=-1,this._textureID=-1,this._transformTrimmedID=-1,this._textureTrimmedID=-1,this.indices=iT,this.pluginName="batch",this.isSprite=!0,this._roundPixels=Q.ROUND_PIXELS}_onTextureUpdate(){this._textureID=-1,this._textureTrimmedID=-1,this._cachedTint=16777215,this._width&&(this.scale.x=yr(this.scale.x)*this._width/this._texture.orig.width),this._height&&(this.scale.y=yr(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,i=e.a,s=e.b,n=e.c,o=e.d,a=e.tx,h=e.ty,l=this.vertexData,u=t.trim,c=t.orig,d=this._anchor;let p=0,m=0,f=0,g=0;if(u?(m=u.x-d._x*c.width,p=m+u.width,g=u.y-d._y*c.height,f=g+u.height):(m=-d._x*c.width,p=m+c.width,g=-d._y*c.height,f=g+c.height),l[0]=i*m+n*g+a,l[1]=o*g+s*m+h,l[2]=i*p+n*g+a,l[3]=o*g+s*p+h,l[4]=i*p+n*f+a,l[5]=o*f+s*p+h,l[6]=i*m+n*f+a,l[7]=o*f+s*m+h,this._roundPixels){const y=Q.RESOLUTION;for(let _=0;_<l.length;++_)l[_]=Math.round(l[_]*y)/y}}calculateTrimmedVertices(){if(!this.vertexTrimmedData)this.vertexTrimmedData=new Float32Array(8);else if(this._transformTrimmedID===this.transform._worldID&&this._textureTrimmedID===this._texture._updateID)return;this._transformTrimmedID=this.transform._worldID,this._textureTrimmedID=this._texture._updateID;const t=this._texture,e=this.vertexTrimmedData,i=t.orig,s=this._anchor,n=this.transform.worldTransform,o=n.a,a=n.b,h=n.c,l=n.d,u=n.tx,c=n.ty,d=-s._x*i.width,p=d+i.width,m=-s._y*i.height,f=m+i.height;if(e[0]=o*d+h*m+u,e[1]=l*m+a*d+c,e[2]=o*p+h*m+u,e[3]=l*m+a*p+c,e[4]=o*p+h*f+u,e[5]=l*f+a*p+c,e[6]=o*d+h*f+u,e[7]=l*f+a*d+c,this._roundPixels){const g=Q.RESOLUTION;for(let y=0;y<e.length;++y)e[y]=Math.round(e[y]*g)/g}}_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 this.children.length===0?(this._localBounds||(this._localBounds=new Ra),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 ct),t=this._localBoundsRect),this._localBounds.getRectangle(t)):super.getLocalBounds.call(this,t)}containsPoint(t){this.worldTransform.applyInverse(t,Jn);const e=this._texture.orig.width,i=this._texture.orig.height,s=-e*this.anchor.x;let n=0;return Jn.x>=s&&Jn.x<s+e&&(n=-i*this.anchor.y,Jn.y>=n&&Jn.y<n+i)}destroy(t){if(super.destroy(t),this._texture.off("update",this._onTextureUpdate,this),this._anchor=null,typeof t=="boolean"?t:t==null?void 0:t.texture){const e=typeof t=="boolean"?t:t==null?void 0:t.baseTexture;this._texture.destroy(!!e)}this._texture=null}static from(t,e){const i=t instanceof rt?t:rt.from(t,e);return new ie(i)}set roundPixels(t){this._roundPixels!==t&&(this._transformID=-1,this._transformTrimmedID=-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=yr(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=yr(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||rt.EMPTY,this._cachedTint=16777215,this._textureID=-1,this._textureTrimmedID=-1,t&&(t.baseTexture.valid?this._onTextureUpdate():t.once("update",this._onTextureUpdate,this)))}}const Xm=new Nt;Ot.prototype._cacheAsBitmap=!1,Ot.prototype._cacheData=null,Ot.prototype._cacheAsBitmapResolution=null,Ot.prototype._cacheAsBitmapMultisample=null;class rT{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(Ot.prototype,{cacheAsBitmapResolution:{get(){return this._cacheAsBitmapResolution},set(r){r!==this._cacheAsBitmapResolution&&(this._cacheAsBitmapResolution=r,this.cacheAsBitmap&&(this.cacheAsBitmap=!1,this.cacheAsBitmap=!0))}},cacheAsBitmapMultisample:{get(){return this._cacheAsBitmapMultisample},set(r){r!==this._cacheAsBitmapMultisample&&(this._cacheAsBitmapMultisample=r,this.cacheAsBitmap&&(this.cacheAsBitmap=!1,this.cacheAsBitmap=!0))}},cacheAsBitmap:{get(){return this._cacheAsBitmap},set(r){if(this._cacheAsBitmap===r)return;this._cacheAsBitmap=r;let t;r?(this._cacheData||(this._cacheData=new rT),t=this._cacheData,t.originalRender=this.render,t.originalRenderCanvas=this.renderCanvas,t.originalUpdateTransform=this.updateTransform,t.originalCalculateBounds=this.calculateBounds,t.originalGetLocalBounds=this.getLocalBounds,t.originalDestroy=this.destroy,t.originalContainsPoint=this.containsPoint,t.originalMask=this._mask,t.originalFilterArea=this.filterArea,this.render=this._renderCached,this.renderCanvas=this._renderCachedCanvas,this.destroy=this._cacheAsBitmapDestroy):(t=this._cacheData,t.sprite&&this._destroyCachedDisplayObject(),this.render=t.originalRender,this.renderCanvas=t.originalRenderCanvas,this.calculateBounds=t.originalCalculateBounds,this.getLocalBounds=t.originalGetLocalBounds,this.destroy=t.originalDestroy,this.updateTransform=t.originalUpdateTransform,this.containsPoint=t.originalContainsPoint,this._mask=t.originalMask,this.filterArea=t.originalFilterArea)}}}),Ot.prototype._renderCached=function(r){!this.visible||this.worldAlpha<=0||!this.renderable||(this._initCachedDisplayObject(r),this._cacheData.sprite.transform._worldID=this.transform._worldID,this._cacheData.sprite.worldAlpha=this.worldAlpha,this._cacheData.sprite._render(r))},Ot.prototype._initCachedDisplayObject=function(r){var d,p;if((d=this._cacheData)!=null&&d.sprite)return;const t=this.alpha;this.alpha=1,r.batch.flush();const e=this.getLocalBounds(new ct,!0);if((p=this.filters)!=null&&p.length){const m=this.filters[0].padding;e.pad(m)}const i=this.cacheAsBitmapResolution||r.resolution;e.ceil(i),e.width=Math.max(e.width,1/i),e.height=Math.max(e.height,1/i);const s=r.renderTexture.current,n=r.renderTexture.sourceFrame.clone(),o=r.renderTexture.destinationFrame.clone(),a=r.projection.transform,h=qr.create({width:e.width,height:e.height,resolution:i,multisample:this.cacheAsBitmapMultisample??r.multisample}),l=`cacheAsBitmap_${Kr()}`;this._cacheData.textureCacheId=l,ft.addToCache(h.baseTexture,l),rt.addToCache(h,l);const u=this.transform.localTransform.copyTo(Xm).invert().translate(-e.x,-e.y);this.render=this._cacheData.originalRender,r.render(this,{renderTexture:h,clear:!0,transform:u,skipUpdateTransform:!1}),r.framebuffer.blit(),r.projection.transform=a,r.renderTexture.bind(s,n,o),this.render=this._renderCached,this.updateTransform=this.displayObjectUpdateTransform,this.calculateBounds=this._calculateCachedBounds,this.getLocalBounds=this._getCachedLocalBounds,this._mask=null,this.filterArea=null,this.alpha=t;const c=new ie(h);c.transform.worldTransform=this.transform.worldTransform,c.anchor.x=-(e.x/e.width),c.anchor.y=-(e.y/e.height),c.alpha=t,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)},Ot.prototype._renderCachedCanvas=function(r){!this.visible||this.worldAlpha<=0||!this.renderable||(this._initCachedDisplayObjectCanvas(r),this._cacheData.sprite.worldAlpha=this.worldAlpha,this._cacheData.sprite._renderCanvas(r))},Ot.prototype._initCachedDisplayObjectCanvas=function(r){var u;if((u=this._cacheData)!=null&&u.sprite)return;const t=this.getLocalBounds(new ct,!0),e=this.alpha;this.alpha=1;const i=r.canvasContext.activeContext,s=r._projTransform,n=this.cacheAsBitmapResolution||r.resolution;t.ceil(n),t.width=Math.max(t.width,1/n),t.height=Math.max(t.height,1/n);const o=qr.create({width:t.width,height:t.height,resolution:n}),a=`cacheAsBitmap_${Kr()}`;this._cacheData.textureCacheId=a,ft.addToCache(o.baseTexture,a),rt.addToCache(o,a);const h=Xm;this.transform.localTransform.copyTo(h),h.invert(),h.tx-=t.x,h.ty-=t.y,this.renderCanvas=this._cacheData.originalRenderCanvas,r.render(this,{renderTexture:o,clear:!0,transform:h,skipUpdateTransform:!1}),r.canvasContext.activeContext=i,r._projTransform=s,this.renderCanvas=this._renderCachedCanvas,this.updateTransform=this.displayObjectUpdateTransform,this.calculateBounds=this._calculateCachedBounds,this.getLocalBounds=this._getCachedLocalBounds,this._mask=null,this.filterArea=null,this.alpha=e;const l=new ie(o);l.transform.worldTransform=this.transform.worldTransform,l.anchor.x=-(t.x/t.width),l.anchor.y=-(t.y/t.height),l.alpha=e,l._bounds=this._bounds,this._cacheData.sprite=l,this.transform._parentID=-1,this.parent?this.updateTransform():(this.parent=r._tempDisplayObjectParent,this.updateTransform(),this.parent=null),this.containsPoint=l.containsPoint.bind(l)},Ot.prototype._calculateCachedBounds=function(){this._bounds.clear(),this._cacheData.sprite.transform._worldID=this.transform._worldID,this._cacheData.sprite._calculateBounds(),this._bounds.updateID=this._boundsID},Ot.prototype._getCachedLocalBounds=function(){return this._cacheData.sprite.getLocalBounds(null)},Ot.prototype._destroyCachedDisplayObject=function(){this._cacheData.sprite._texture.destroy(!0),this._cacheData.sprite=null,ft.removeFromCache(this._cacheData.textureCacheId),rt.removeFromCache(this._cacheData.textureCacheId),this._cacheData.textureCacheId=null},Ot.prototype._cacheAsBitmapDestroy=function(r){this.cacheAsBitmap=!1,this.destroy(r)},Ot.prototype.name=null,Xt.prototype.getChildByName=function(r,t){for(let e=0,i=this.children.length;e<i;e++)if(this.children[e].name===r)return this.children[e];if(t)for(let e=0,i=this.children.length;e<i;e++){const s=this.children[e];if(!s.getChildByName)continue;const n=s.getChildByName(r,!0);if(n)return n}return null},Ot.prototype.getGlobalPosition=function(r=new lt,t=!1){return this.parent?this.parent.toGlobal(this.position,r,t):(r.x=this.position.x,r.y=this.position.y),r};var sT=`varying vec2 vTextureCoord;
|
|
527
527
|
|
|
528
528
|
uniform sampler2D uSampler;
|
|
529
529
|
uniform float uAlpha;
|
|
@@ -532,9 +532,9 @@ void main(void)
|
|
|
532
532
|
{
|
|
533
533
|
gl_FragColor = texture2D(uSampler, vTextureCoord) * uAlpha;
|
|
534
534
|
}
|
|
535
|
-
`;class
|
|
536
|
-
`);function
|
|
537
|
-
`}return i=i.replace("%blur%",s),i=i.replace("%size%",r.toString()),i}const
|
|
535
|
+
`;class nT extends ye{constructor(t=1){super(zv,sT,{uAlpha:1}),this.alpha=t}get alpha(){return this.uniforms.uAlpha}set alpha(t){this.uniforms.uAlpha=t}}const oT={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]},aT=["varying vec2 vBlurTexCoords[%size%];","uniform sampler2D uSampler;","void main(void)","{"," gl_FragColor = vec4(0.0);"," %blur%","}"].join(`
|
|
536
|
+
`);function hT(r){const t=oT[r],e=t.length;let i=aT,s="";const n="gl_FragColor += texture2D(uSampler, vBlurTexCoords[%index%]) * %value%;";let o;for(let a=0;a<r;a++){let h=n.replace("%index%",a.toString());o=a,a>=e&&(o=r-a-1),h=h.replace("%value%",t[o].toString()),s+=h,s+=`
|
|
537
|
+
`}return i=i.replace("%blur%",s),i=i.replace("%size%",r.toString()),i}const lT=`
|
|
538
538
|
attribute vec2 aVertexPosition;
|
|
539
539
|
|
|
540
540
|
uniform mat3 projectionMatrix;
|
|
@@ -564,8 +564,8 @@ void main(void)
|
|
|
564
564
|
|
|
565
565
|
vec2 textureCoord = filterTextureCoord();
|
|
566
566
|
%blur%
|
|
567
|
-
}`;function
|
|
568
|
-
`}return i=i.replace("%blur%",s),i=i.replace("%size%",r.toString()),i}class Au extends
|
|
567
|
+
}`;function uT(r,t){const e=Math.ceil(r/2);let i=lT,s="",n;t?n="vBlurTexCoords[%index%] = textureCoord + vec2(%sampleIndex% * strength, 0.0);":n="vBlurTexCoords[%index%] = textureCoord + vec2(0.0, %sampleIndex% * strength);";for(let o=0;o<r;o++){let a=n.replace("%index%",o.toString());a=a.replace("%sampleIndex%",`${o-(e-1)}.0`),s+=a,s+=`
|
|
568
|
+
`}return i=i.replace("%blur%",s),i=i.replace("%size%",r.toString()),i}class Au extends ye{constructor(t,e=8,i=4,s=ye.defaultResolution,n=5){const o=uT(n,t),a=hT(n);super(o,a),this.horizontal=t,this.resolution=s,this._quality=0,this.quality=i,this.blur=e}apply(t,e,i,s){if(i?this.horizontal?this.uniforms.strength=1/i.width*(i.width/e.width):this.uniforms.strength=1/i.height*(i.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,this.passes===1)t.applyFilter(this,e,i,s);else{const n=t.getFilterTexture(),o=t.renderer;let a=e,h=n;this.state.blend=!1,t.applyFilter(this,a,h,bi.CLEAR);for(let l=1;l<this.passes-1;l++){t.bindAndClear(a,bi.BLIT),this.uniforms.uSampler=h;const u=h;h=a,a=u,o.shader.bind(this),o.geometry.draw(5)}this.state.blend=!0,t.applyFilter(this,h,i,s),t.returnFilterTexture(n)}}get blur(){return this.strength}set blur(t){this.padding=1+Math.abs(t)*2,this.strength=t}get quality(){return this._quality}set quality(t){this._quality=t,this.passes=t}}class cT extends ye{constructor(t=8,e=4,i=ye.defaultResolution,s=5){super(),this._repeatEdgePixels=!1,this.blurXFilter=new Au(!0,t,e,i,s),this.blurYFilter=new Au(!1,t,e,i,s),this.resolution=i,this.quality=e,this.blur=t,this.repeatEdgePixels=!1}apply(t,e,i,s){const n=Math.abs(this.blurXFilter.strength),o=Math.abs(this.blurYFilter.strength);if(n&&o){const a=t.getFilterTexture();this.blurXFilter.apply(t,e,a,bi.CLEAR),this.blurYFilter.apply(t,a,i,s),t.returnFilterTexture(a)}else o?this.blurYFilter.apply(t,e,i,s):this.blurXFilter.apply(t,e,i,s)}updatePadding(){this._repeatEdgePixels?this.padding=0:this.padding=Math.max(Math.abs(this.blurXFilter.strength),Math.abs(this.blurYFilter.strength))*2}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()}}var dT=`varying vec2 vTextureCoord;
|
|
569
569
|
uniform sampler2D uSampler;
|
|
570
570
|
uniform float m[20];
|
|
571
571
|
uniform float uAlpha;
|
|
@@ -617,7 +617,7 @@ void main(void)
|
|
|
617
617
|
|
|
618
618
|
gl_FragColor = vec4(rgb, result.a);
|
|
619
619
|
}
|
|
620
|
-
`;class
|
|
620
|
+
`;class Pa extends ye{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(Nm,dT,t),this.alpha=1}_loadMatrix(t,e=!1){let i=t;e&&(this._multiply(i,this.uniforms.m,t),i=this._colorMatrix(i)),this.uniforms.m=i}_multiply(t,e,i){return t[0]=e[0]*i[0]+e[1]*i[5]+e[2]*i[10]+e[3]*i[15],t[1]=e[0]*i[1]+e[1]*i[6]+e[2]*i[11]+e[3]*i[16],t[2]=e[0]*i[2]+e[1]*i[7]+e[2]*i[12]+e[3]*i[17],t[3]=e[0]*i[3]+e[1]*i[8]+e[2]*i[13]+e[3]*i[18],t[4]=e[0]*i[4]+e[1]*i[9]+e[2]*i[14]+e[3]*i[19]+e[4],t[5]=e[5]*i[0]+e[6]*i[5]+e[7]*i[10]+e[8]*i[15],t[6]=e[5]*i[1]+e[6]*i[6]+e[7]*i[11]+e[8]*i[16],t[7]=e[5]*i[2]+e[6]*i[7]+e[7]*i[12]+e[8]*i[17],t[8]=e[5]*i[3]+e[6]*i[8]+e[7]*i[13]+e[8]*i[18],t[9]=e[5]*i[4]+e[6]*i[9]+e[7]*i[14]+e[8]*i[19]+e[9],t[10]=e[10]*i[0]+e[11]*i[5]+e[12]*i[10]+e[13]*i[15],t[11]=e[10]*i[1]+e[11]*i[6]+e[12]*i[11]+e[13]*i[16],t[12]=e[10]*i[2]+e[11]*i[7]+e[12]*i[12]+e[13]*i[17],t[13]=e[10]*i[3]+e[11]*i[8]+e[12]*i[13]+e[13]*i[18],t[14]=e[10]*i[4]+e[11]*i[9]+e[12]*i[14]+e[13]*i[19]+e[14],t[15]=e[15]*i[0]+e[16]*i[5]+e[17]*i[10]+e[18]*i[15],t[16]=e[15]*i[1]+e[16]*i[6]+e[17]*i[11]+e[18]*i[16],t[17]=e[15]*i[2]+e[16]*i[7]+e[17]*i[12]+e[18]*i[17],t[18]=e[15]*i[3]+e[16]*i[8]+e[17]*i[13]+e[18]*i[18],t[19]=e[15]*i[4]+e[16]*i[9]+e[17]*i[14]+e[18]*i[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 i=[t,0,0,0,0,0,t,0,0,0,0,0,t,0,0,0,0,0,1,0];this._loadMatrix(i,e)}tint(t,e){const[i,s,n]=Gt.shared.setValue(t).toArray(),o=[i,0,0,0,0,0,s,0,0,0,0,0,n,0,0,0,0,0,1,0];this._loadMatrix(o,e)}greyscale(t,e){const i=[t,t,t,0,0,t,t,t,0,0,t,t,t,0,0,0,0,0,1,0];this._loadMatrix(i,e)}blackAndWhite(t){const e=[.3,.6,.1,0,0,.3,.6,.1,0,0,.3,.6,.1,0,0,0,0,0,1,0];this._loadMatrix(e,t)}hue(t,e){t=(t||0)/180*Math.PI;const i=Math.cos(t),s=Math.sin(t),n=Math.sqrt,o=1/3,a=n(o),h=i+(1-i)*o,l=o*(1-i)-a*s,u=o*(1-i)+a*s,c=o*(1-i)+a*s,d=i+o*(1-i),p=o*(1-i)-a*s,m=o*(1-i)-a*s,f=o*(1-i)+a*s,g=i+o*(1-i),y=[h,l,u,0,0,c,d,p,0,0,m,f,g,0,0,0,0,0,1,0];this._loadMatrix(y,e)}contrast(t,e){const i=(t||0)+1,s=-.5*(i-1),n=[i,0,0,0,s,0,i,0,0,s,0,0,i,0,s,0,0,0,1,0];this._loadMatrix(n,e)}saturate(t=0,e){const i=t*2/3+1,s=(i-1)*-.5,n=[i,s,s,0,0,s,i,s,0,0,s,s,i,0,0,0,0,0,1,0];this._loadMatrix(n,e)}desaturate(){this.saturate(-1)}negative(t){const e=[-1,0,0,1,0,0,-1,0,1,0,0,0,-1,1,0,0,0,0,1,0];this._loadMatrix(e,t)}sepia(t){const e=[.393,.7689999,.18899999,0,0,.349,.6859999,.16799999,0,0,.272,.5339999,.13099999,0,0,0,0,0,1,0];this._loadMatrix(e,t)}technicolor(t){const e=[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];this._loadMatrix(e,t)}polaroid(t){const e=[1.438,-.062,-.062,0,0,-.122,1.378,-.122,0,0,-.016,-.016,1.483,0,0,0,0,0,1,0];this._loadMatrix(e,t)}toBGR(t){const e=[0,0,1,0,0,0,1,0,0,0,1,0,0,0,0,0,0,0,1,0];this._loadMatrix(e,t)}kodachrome(t){const e=[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];this._loadMatrix(e,t)}browni(t){const e=[.5997023498159715,.34553243048391263,-.2708298674538042,0,47.43192855600873,-.037703249837783157,.8609577587992641,.15059552388459913,0,-36.96841498319127,.24113635128153335,-.07441037908422492,.44972182064877153,0,-7.562075277591283,0,0,0,1,0];this._loadMatrix(e,t)}vintage(t){const e=[.6279345635605994,.3202183420819367,-.03965408211312453,0,9.651285835294123,.02578397704808868,.6441188644374771,.03259127616149294,0,7.462829176470591,.0466055556782719,-.0851232987247891,.5241648018700465,0,5.159190588235296,0,0,0,1,0];this._loadMatrix(e,t)}colorTone(t,e,i,s,n){t=t||.2,e=e||.15,i=i||16770432,s=s||3375104;const o=Gt.shared,[a,h,l]=o.setValue(i).toArray(),[u,c,d]=o.setValue(s).toArray(),p=[.3,.59,.11,0,0,a,h,l,t,0,u,c,d,e,0,a-u,h-c,l-d,0,0];this._loadMatrix(p,n)}night(t,e){t=t||.1;const i=[t*-2,-t,0,0,0,-t,0,t,0,0,0,t,t*2,0,0,0,0,0,1,0];this._loadMatrix(i,e)}predator(t,e){const i=[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(i,e)}lsd(t){const e=[2,-.4,.5,0,0,-.5,2,-.4,0,0,-.4,-.5,3,0,0,0,0,0,1,0];this._loadMatrix(e,t)}reset(){const t=[1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0];this._loadMatrix(t,!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}}Pa.prototype.grayscale=Pa.prototype.greyscale;var pT=`varying vec2 vFilterCoord;
|
|
621
621
|
varying vec2 vTextureCoord;
|
|
622
622
|
|
|
623
623
|
uniform vec2 scale;
|
|
@@ -637,7 +637,7 @@ void main(void)
|
|
|
637
637
|
|
|
638
638
|
gl_FragColor = texture2D(uSampler, clamp(vec2(vTextureCoord.x + map.x, vTextureCoord.y + map.y), inputClamp.xy, inputClamp.zw));
|
|
639
639
|
}
|
|
640
|
-
`,
|
|
640
|
+
`,fT=`attribute vec2 aVertexPosition;
|
|
641
641
|
|
|
642
642
|
uniform mat3 projectionMatrix;
|
|
643
643
|
uniform mat3 filterMatrix;
|
|
@@ -666,7 +666,7 @@ void main(void)
|
|
|
666
666
|
vTextureCoord = filterTextureCoord();
|
|
667
667
|
vFilterCoord = ( filterMatrix * vec3( vTextureCoord, 1.0) ).xy;
|
|
668
668
|
}
|
|
669
|
-
`;class
|
|
669
|
+
`;class mT extends ye{constructor(t,e){const i=new Nt;t.renderable=!1,super(fT,pT,{mapSampler:t._texture,filterMatrix:i,scale:{x:1,y:1},rotation:new Float32Array([1,0,0,1])}),this.maskSprite=t,this.maskMatrix=i,e==null&&(e=20),this.scale=new lt(e,e)}apply(t,e,i,s){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,o=Math.sqrt(n.a*n.a+n.b*n.b),a=Math.sqrt(n.c*n.c+n.d*n.d);o!==0&&a!==0&&(this.uniforms.rotation[0]=n.a/o,this.uniforms.rotation[1]=n.b/o,this.uniforms.rotation[2]=n.c/a,this.uniforms.rotation[3]=n.d/a),t.applyFilter(this,e,i,s)}get map(){return this.uniforms.mapSampler}set map(t){this.uniforms.mapSampler=t}}var gT=`varying vec2 v_rgbNW;
|
|
670
670
|
varying vec2 v_rgbNE;
|
|
671
671
|
varying vec2 v_rgbSW;
|
|
672
672
|
varying vec2 v_rgbSE;
|
|
@@ -787,7 +787,7 @@ void main() {
|
|
|
787
787
|
|
|
788
788
|
gl_FragColor = color;
|
|
789
789
|
}
|
|
790
|
-
`,
|
|
790
|
+
`,yT=`
|
|
791
791
|
attribute vec2 aVertexPosition;
|
|
792
792
|
|
|
793
793
|
uniform mat3 projectionMatrix;
|
|
@@ -829,7 +829,7 @@ void main(void) {
|
|
|
829
829
|
|
|
830
830
|
texcoords(vFragCoord, inputSize.zw, v_rgbNW, v_rgbNE, v_rgbSW, v_rgbSE, v_rgbM);
|
|
831
831
|
}
|
|
832
|
-
`;class
|
|
832
|
+
`;class bT extends ye{constructor(){super(yT,gT)}}var xT=`precision highp float;
|
|
833
833
|
|
|
834
834
|
varying vec2 vTextureCoord;
|
|
835
835
|
varying vec4 vColor;
|
|
@@ -863,15 +863,15 @@ void main()
|
|
|
863
863
|
|
|
864
864
|
gl_FragColor = color;
|
|
865
865
|
}
|
|
866
|
-
`;class yT extends ge{constructor(t=.5,e=Math.random()){super(Pm,gT,{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}}const Wm={AlphaFilter:iT,BlurFilter:hT,BlurFilterPass:Au,ColorMatrixFilter:Ra,DisplacementFilter:dT,FXAAFilter:mT,NoiseFilter:yT};Object.entries(Wm).forEach(([r,t])=>{Object.defineProperty(Wm,r,{get(){return xt("7.1.0",`filters.${r} has moved to ${r}`),t}})});class bT{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||(ye.system.add(this.tickerUpdate,this,qr.INTERACTION),this.tickerAdded=!0)}removeTickerListener(){this.tickerAdded&&(ye.system.remove(this.tickerUpdate,this),this.tickerAdded=!1)}pointerMoved(){this._didMove=!0}update(){if(!this.domElement||this._pauseUpdate)return;if(this._didMove){this._didMove=!1;return}const t=this.events.rootPointerEvent;this.events.supportsTouchEvents&&t.pointerType==="touch"||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())}}const xr=new bT;class Jn{constructor(t){this.bubbles=!0,this.cancelBubble=!0,this.cancelable=!1,this.composed=!1,this.defaultPrevented=!1,this.eventPhase=Jn.prototype.NONE,this.propagationStopped=!1,this.propagationImmediatelyStopped=!1,this.layer=new lt,this.page=new lt,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,i){throw new Error("initEvent() is a legacy DOM API. It is not implemented in the Federated Events API.")}initUIEvent(t,e,i,s,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 Pa extends Jn{constructor(){super(...arguments),this.client=new lt,this.movement=new lt,this.offset=new lt,this.global=new lt,this.screen=new lt}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,i){return t.worldTransform.applyInverse(i||this.global,e)}getModifierState(t){return"getModifierState"in this.nativeEvent&&this.nativeEvent.getModifierState(t)}initMouseEvent(t,e,i,s,n,o,a,h,l,u,c,d,p,m,f){throw new Error("Method not implemented.")}}class ri extends Pa{constructor(){super(...arguments),this.width=0,this.height=0,this.isPrimary=!1}getCoalescedEvents(){return this.type==="pointermove"||this.type==="mousemove"||this.type==="touchmove"?[this]:[]}getPredictedEvents(){throw new Error("getPredictedEvents is not supported!")}}class Vs extends Pa{constructor(){super(...arguments),this.DOM_DELTA_PIXEL=0,this.DOM_DELTA_LINE=1,this.DOM_DELTA_PAGE=2}}Vs.DOM_DELTA_PIXEL=0,Vs.DOM_DELTA_LINE=1,Vs.DOM_DELTA_PAGE=2;const xT=2048,_T=new lt,Mu=new lt;class vT{constructor(t){this.dispatch=new Gn,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((i,s)=>i.priority-s.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 i=0,s=e.length;i<s;i++)e[i].fn(t);else console.warn(`[EventBoundary]: Event mapping not defined for ${t.type}`)}hitTest(t,e){xr.pauseUpdate=!0;const i=this._isPointerMoveEvent&&this.enableGlobalMoveEvents?"hitTestMoveRecursive":"hitTestRecursive",s=this[i](this.rootTarget,this.rootTarget.eventMode,_T.set(t,e),this.hitTestFn,this.hitPruneFn);return s&&s[0]}propagate(t,e){if(!t.target)return;const i=t.composedPath();t.eventPhase=t.CAPTURING_PHASE;for(let s=0,n=i.length-1;s<n;s++)if(t.currentTarget=i[s],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 s=i.length-2;s>=0;s--)if(t.currentTarget=i[s],this.notifyTarget(t,e),t.propagationStopped||t.propagationImmediatelyStopped)return}}all(t,e,i=this._allInteractiveElements){if(i.length===0)return;t.eventPhase=t.BUBBLING_PHASE;const s=Array.isArray(e)?e:[e];for(let n=i.length-1;n>=0;n--)s.forEach(o=>{t.currentTarget=i[n],this.notifyTarget(t,o)})}propagationPath(t){const e=[t];for(let i=0;i<xT&&t!==this.rootTarget;i++){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,i,s,n,o=!1){let a=!1;if(this._interactivePrune(t))return null;if((t.eventMode==="dynamic"||e==="dynamic")&&(xr.pauseUpdate=!1),t.interactiveChildren&&t.children){const u=t.children;for(let c=u.length-1;c>=0;c--){const d=u[c],p=this.hitTestMoveRecursive(d,this._isInteractive(e)?e:d.eventMode,i,s,n,o||n(t,i));if(p){if(p.length>0&&!p[p.length-1].parent)continue;const m=t.isInteractive();(p.length>0||m)&&(m&&this._allInteractiveElements.push(t),p.push(t)),this._hitElements.length===0&&(this._hitElements=p),a=!0}}}const h=this._isInteractive(e),l=t.isInteractive();return h&&l&&this._allInteractiveElements.push(t),o||this._hitElements.length>0?null:a?this._hitElements:h&&!n(t,i)&&s(t,i)?l?[t]:[]:null}hitTestRecursive(t,e,i,s,n){if(this._interactivePrune(t)||n(t,i))return null;if((t.eventMode==="dynamic"||e==="dynamic")&&(xr.pauseUpdate=!1),t.interactiveChildren&&t.children){const h=t.children;for(let l=h.length-1;l>=0;l--){const u=h[l],c=this.hitTestRecursive(u,this._isInteractive(e)?e:u.eventMode,i,s,n);if(c){if(c.length>0&&!c[c.length-1].parent)continue;const d=t.isInteractive();return(c.length>0||d)&&c.push(t),c}}}const o=this._isInteractive(e),a=t.isInteractive();return o&&s(t,i)?a?[t]:[]:null}_isInteractive(t){return t==="static"||t==="dynamic"}_interactivePrune(t){return!!(!t||t.isMask||!t.visible||!t.renderable||t.eventMode==="none"||t.eventMode==="passive"&&!t.interactiveChildren||t.isMask)}hitPruneFn(t,e){var i;if(t.hitArea&&(t.worldTransform.applyInverse(e,Mu),!t.hitArea.contains(Mu.x,Mu.y)))return!0;if(t._mask){const s=t._mask.isMaskData?t._mask.maskObject:t._mask;if(s&&!((i=s.containsPoint)!=null&&i.call(s,e)))return!0}return!1}hitTestFn(t,e){return t.eventMode==="passive"?!1:t.hitArea?!0:t.containsPoint?t.containsPoint(e):!1}notifyTarget(t,e){var n,o;e=e??t.type;const i=`on${e}`;(o=(n=t.currentTarget)[i])==null||o.call(n,t);const s=t.eventPhase===t.CAPTURING_PHASE||t.eventPhase===t.AT_TARGET?`${e}capture`:e;this.notifyListeners(t,s),t.eventPhase===t.AT_TARGET&&this.notifyListeners(t,e)}mapPointerDown(t){if(!(t instanceof ri)){console.warn("EventBoundary cannot map a non-pointer event as a pointer event");return}const e=this.createPointerEvent(t);if(this.dispatchEvent(e,"pointerdown"),e.pointerType==="touch")this.dispatchEvent(e,"touchstart");else if(e.pointerType==="mouse"||e.pointerType==="pen"){const s=e.button===2;this.dispatchEvent(e,s?"rightdown":"mousedown")}const i=this.trackingData(t.pointerId);i.pressTargetsByButton[t.button]=e.composedPath(),this.freeEvent(e)}mapPointerMove(t){var h,l;if(!(t instanceof ri)){console.warn("EventBoundary cannot map a non-pointer event as a pointer event");return}this._allInteractiveElements.length=0,this._hitElements.length=0,this._isPointerMoveEvent=!0;const e=this.createPointerEvent(t);this._isPointerMoveEvent=!1;const i=e.pointerType==="mouse"||e.pointerType==="pen",s=this.trackingData(t.pointerId),n=this.findMountedTarget(s.overTargets);if(((h=s.overTargets)==null?void 0:h.length)>0&&n!==e.target){const u=t.type==="mousemove"?"mouseout":"pointerout",c=this.createPointerEvent(t,u,n);if(this.dispatchEvent(c,"pointerout"),i&&this.dispatchEvent(c,"mouseout"),!e.composedPath().includes(n)){const d=this.createPointerEvent(t,"pointerleave",n);for(d.eventPhase=d.AT_TARGET;d.target&&!e.composedPath().includes(d.target);)d.currentTarget=d.target,this.notifyTarget(d),i&&this.notifyTarget(d,"mouseleave"),d.target=d.target.parent;this.freeEvent(d)}this.freeEvent(c)}if(n!==e.target){const u=t.type==="mousemove"?"mouseover":"pointerover",c=this.clonePointerEvent(e,u);this.dispatchEvent(c,"pointerover"),i&&this.dispatchEvent(c,"mouseover");let d=n==null?void 0:n.parent;for(;d&&d!==this.rootTarget.parent&&d!==e.target;)d=d.parent;if(!d||d===this.rootTarget.parent){const p=this.clonePointerEvent(e,"pointerenter");for(p.eventPhase=p.AT_TARGET;p.target&&p.target!==n&&p.target!==this.rootTarget.parent;)p.currentTarget=p.target,this.notifyTarget(p),i&&this.notifyTarget(p,"mouseenter"),p.target=p.target.parent;this.freeEvent(p)}this.freeEvent(c)}const o=[],a=this.enableGlobalMoveEvents??!0;this.moveOnAll?o.push("pointermove"):this.dispatchEvent(e,"pointermove"),a&&o.push("globalpointermove"),e.pointerType==="touch"&&(this.moveOnAll?o.splice(1,0,"touchmove"):this.dispatchEvent(e,"touchmove"),a&&o.push("globaltouchmove")),i&&(this.moveOnAll?o.splice(1,0,"mousemove"):this.dispatchEvent(e,"mousemove"),a&&o.push("globalmousemove"),this.cursor=(l=e.target)==null?void 0:l.cursor),o.length>0&&this.all(e,o),this._allInteractiveElements.length=0,this._hitElements.length=0,s.overTargets=e.composedPath(),this.freeEvent(e)}mapPointerOver(t){var o;if(!(t instanceof ri)){console.warn("EventBoundary cannot map a non-pointer event as a pointer event");return}const e=this.trackingData(t.pointerId),i=this.createPointerEvent(t),s=i.pointerType==="mouse"||i.pointerType==="pen";this.dispatchEvent(i,"pointerover"),s&&this.dispatchEvent(i,"mouseover"),i.pointerType==="mouse"&&(this.cursor=(o=i.target)==null?void 0:o.cursor);const n=this.clonePointerEvent(i,"pointerenter");for(n.eventPhase=n.AT_TARGET;n.target&&n.target!==this.rootTarget.parent;)n.currentTarget=n.target,this.notifyTarget(n),s&&this.notifyTarget(n,"mouseenter"),n.target=n.target.parent;e.overTargets=i.composedPath(),this.freeEvent(i),this.freeEvent(n)}mapPointerOut(t){if(!(t instanceof ri)){console.warn("EventBoundary cannot map a non-pointer event as a pointer event");return}const e=this.trackingData(t.pointerId);if(e.overTargets){const i=t.pointerType==="mouse"||t.pointerType==="pen",s=this.findMountedTarget(e.overTargets),n=this.createPointerEvent(t,"pointerout",s);this.dispatchEvent(n),i&&this.dispatchEvent(n,"mouseout");const o=this.createPointerEvent(t,"pointerleave",s);for(o.eventPhase=o.AT_TARGET;o.target&&o.target!==this.rootTarget.parent;)o.currentTarget=o.target,this.notifyTarget(o),i&&this.notifyTarget(o,"mouseleave"),o.target=o.target.parent;e.overTargets=null,this.freeEvent(n),this.freeEvent(o)}this.cursor=null}mapPointerUp(t){if(!(t instanceof ri)){console.warn("EventBoundary cannot map a non-pointer event as a pointer event");return}const e=performance.now(),i=this.createPointerEvent(t);if(this.dispatchEvent(i,"pointerup"),i.pointerType==="touch")this.dispatchEvent(i,"touchend");else if(i.pointerType==="mouse"||i.pointerType==="pen"){const a=i.button===2;this.dispatchEvent(i,a?"rightup":"mouseup")}const s=this.trackingData(t.pointerId),n=this.findMountedTarget(s.pressTargetsByButton[t.button]);let o=n;if(n&&!i.composedPath().includes(n)){let a=n;for(;a&&!i.composedPath().includes(a);){if(i.currentTarget=a,this.notifyTarget(i,"pointerupoutside"),i.pointerType==="touch")this.notifyTarget(i,"touchendoutside");else if(i.pointerType==="mouse"||i.pointerType==="pen"){const h=i.button===2;this.notifyTarget(i,h?"rightupoutside":"mouseupoutside")}a=a.parent}delete s.pressTargetsByButton[t.button],o=a}if(o){const a=this.clonePointerEvent(i,"click");a.target=o,a.path=null,s.clicksByButton[t.button]||(s.clicksByButton[t.button]={clickCount:0,target:a.target,timeStamp:e});const h=s.clicksByButton[t.button];if(h.target===a.target&&e-h.timeStamp<200?++h.clickCount:h.clickCount=1,h.target=a.target,h.timeStamp=e,a.detail=h.clickCount,a.pointerType==="mouse"){const l=a.button===2;this.dispatchEvent(a,l?"rightclick":"click")}else a.pointerType==="touch"&&this.dispatchEvent(a,"tap");this.dispatchEvent(a,"pointertap"),this.freeEvent(a)}this.freeEvent(i)}mapPointerUpOutside(t){if(!(t instanceof ri)){console.warn("EventBoundary cannot map a non-pointer event as a pointer event");return}const e=this.trackingData(t.pointerId),i=this.findMountedTarget(e.pressTargetsByButton[t.button]),s=this.createPointerEvent(t);if(i){let n=i;for(;n;)s.currentTarget=n,this.notifyTarget(s,"pointerupoutside"),s.pointerType==="touch"?this.notifyTarget(s,"touchendoutside"):(s.pointerType==="mouse"||s.pointerType==="pen")&&this.notifyTarget(s,s.button===2?"rightupoutside":"mouseupoutside"),n=n.parent;delete e.pressTargetsByButton[t.button]}this.freeEvent(s)}mapWheel(t){if(!(t instanceof Vs)){console.warn("EventBoundary cannot map a non-wheel event as a wheel event");return}const e=this.createWheelEvent(t);this.dispatchEvent(e),this.freeEvent(e)}findMountedTarget(t){if(!t)return null;let e=t[0];for(let i=1;i<t.length&&t[i].parent===e;i++)e=t[i];return e}createPointerEvent(t,e,i){const s=this.allocateEvent(ri);return this.copyPointerData(t,s),this.copyMouseData(t,s),this.copyData(t,s),s.nativeEvent=t.nativeEvent,s.originalEvent=t,s.target=i??this.hitTest(s.global.x,s.global.y)??this._hitElements[0],typeof e=="string"&&(s.type=e),s}createWheelEvent(t){const e=this.allocateEvent(Vs);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 i=this.allocateEvent(ri);return i.nativeEvent=t.nativeEvent,i.originalEvent=t.originalEvent,this.copyPointerData(t,i),this.copyMouseData(t,i),this.copyData(t,i),i.target=t.target,i.path=t.composedPath().slice(),i.type=e??i.type,i}copyWheelData(t,e){e.deltaMode=t.deltaMode,e.deltaX=t.deltaX,e.deltaY=t.deltaY,e.deltaZ=t.deltaZ}copyPointerData(t,e){t instanceof ri&&e instanceof ri&&(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 Pa&&e instanceof Pa&&(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 i=t.currentTarget._events[e];if(i&&t.currentTarget.isInteractive())if("fn"in i)i.once&&t.currentTarget.removeListener(e,i.fn,void 0,!0),i.fn.call(i.context,t);else for(let s=0,n=i.length;s<n&&!t.propagationImmediatelyStopped;s++)i[s].once&&t.currentTarget.removeListener(e,i[s].fn,void 0,!0),i[s].fn.call(i[s].context,t)}}const TT=1,wT={touchstart:"pointerdown",touchend:"pointerup",touchendoutside:"pointerupoutside",touchmove:"pointermove",touchcancel:"pointercancel"},Ru=class cp{constructor(t){this.supportsTouchEvents="ontouchstart"in globalThis,this.supportsPointerEvents=!!globalThis.PointerEvent,this.domElement=null,this.resolution=1,this.renderer=t,this.rootBoundary=new vT(null),xr.init(this),this.autoPreventDefault=!0,this.eventsAdded=!1,this.rootPointerEvent=new ri(null),this.rootWheelEvent=new Vs(null),this.cursorStyles={default:"inherit",pointer:"pointer"},this.features=new Proxy({...cp.defaultEventFeatures},{set:(e,i,s)=>(i==="globalMove"&&(this.rootBoundary.enableGlobalMoveEvents=s),e[i]=s,!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:i}=this.renderer;this.setTargetElement(e),this.resolution=i,cp._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 i=this.cursorStyles[t];if(i)switch(typeof i){case"string":e&&(this.domElement.style.cursor=i);break;case"function":i(t);break;case"object":e&&Object.assign(this.domElement.style,i);break}else e&&typeof t=="string"&&!Object.prototype.hasOwnProperty.call(this.cursorStyles,t)&&(this.domElement.style.cursor=t)}get pointer(){return this.rootPointerEvent}onPointerDown(t){if(!this.features.click)return;this.rootBoundary.rootTarget=this.renderer.lastObjectRendered;const e=this.normalizeToPointerData(t);this.autoPreventDefault&&e[0].isNormalized&&(t.cancelable||!("cancelable"in t))&&t.preventDefault();for(let i=0,s=e.length;i<s;i++){const n=e[i],o=this.bootstrapEvent(this.rootPointerEvent,n);this.rootBoundary.mapEvent(o)}this.setCursor(this.rootBoundary.cursor)}onPointerMove(t){if(!this.features.move)return;this.rootBoundary.rootTarget=this.renderer.lastObjectRendered,xr.pointerMoved();const e=this.normalizeToPointerData(t);for(let i=0,s=e.length;i<s;i++){const n=this.bootstrapEvent(this.rootPointerEvent,e[i]);this.rootBoundary.mapEvent(n)}this.setCursor(this.rootBoundary.cursor)}onPointerUp(t){if(!this.features.click)return;this.rootBoundary.rootTarget=this.renderer.lastObjectRendered;let e=t.target;t.composedPath&&t.composedPath().length>0&&(e=t.composedPath()[0]);const i=e!==this.domElement?"outside":"",s=this.normalizeToPointerData(t);for(let n=0,o=s.length;n<o;n++){const a=this.bootstrapEvent(this.rootPointerEvent,s[n]);a.type+=i,this.rootBoundary.mapEvent(a)}this.setCursor(this.rootBoundary.cursor)}onPointerOverOut(t){if(!this.features.click)return;this.rootBoundary.rootTarget=this.renderer.lastObjectRendered;const e=this.normalizeToPointerData(t);for(let i=0,s=e.length;i<s;i++){const n=this.bootstrapEvent(this.rootPointerEvent,e[i]);this.rootBoundary.mapEvent(n)}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,xr.domElement=t,this.addEvents()}addEvents(){if(this.eventsAdded||!this.domElement)return;xr.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;xr.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,i){const s=this.domElement.isConnected?this.domElement.getBoundingClientRect():{x:0,y:0,width:this.domElement.width,height:this.domElement.height,left:0,top:0},n=1/this.resolution;t.x=(e-s.left)*(this.domElement.width/s.width)*n,t.y=(i-s.top)*(this.domElement.height/s.height)*n}normalizeToPointerData(t){const e=[];if(this.supportsTouchEvents&&t instanceof TouchEvent)for(let i=0,s=t.changedTouches.length;i<s;i++){const n=t.changedTouches[i];typeof n.button>"u"&&(n.button=0),typeof n.buttons>"u"&&(n.buttons=1),typeof n.isPrimary>"u"&&(n.isPrimary=t.touches.length===1&&t.type==="touchstart"),typeof n.width>"u"&&(n.width=n.radiusX||1),typeof n.height>"u"&&(n.height=n.radiusY||1),typeof n.tiltX>"u"&&(n.tiltX=0),typeof n.tiltY>"u"&&(n.tiltY=0),typeof n.pointerType>"u"&&(n.pointerType="touch"),typeof n.pointerId>"u"&&(n.pointerId=n.identifier||0),typeof n.pressure>"u"&&(n.pressure=n.force||.5),typeof n.twist>"u"&&(n.twist=0),typeof n.tangentialPressure>"u"&&(n.tangentialPressure=0),typeof n.layerX>"u"&&(n.layerX=n.offsetX=n.clientX),typeof n.layerY>"u"&&(n.layerY=n.offsetY=n.clientY),n.isNormalized=!0,n.type=t.type,e.push(n)}else if(!globalThis.MouseEvent||t instanceof MouseEvent&&(!this.supportsPointerEvents||!(t instanceof globalThis.PointerEvent))){const i=t;typeof i.isPrimary>"u"&&(i.isPrimary=!0),typeof i.width>"u"&&(i.width=1),typeof i.height>"u"&&(i.height=1),typeof i.tiltX>"u"&&(i.tiltX=0),typeof i.tiltY>"u"&&(i.tiltY=0),typeof i.pointerType>"u"&&(i.pointerType="mouse"),typeof i.pointerId>"u"&&(i.pointerId=TT),typeof i.pressure>"u"&&(i.pressure=.5),typeof i.twist>"u"&&(i.twist=0),typeof i.tangentialPressure>"u"&&(i.tangentialPressure=0),i.isNormalized=!0,e.push(i)}else e.push(t);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,t.type==="pointerleave"&&(t.type="pointerout"),t.type.startsWith("mouse")&&(t.type=t.type.replace("mouse","pointer")),t.type.startsWith("touch")&&(t.type=wT[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}};Ru.extension={name:"events",type:[z.RendererSystem,z.CanvasRendererSystem]},Ru.defaultEventFeatures={move:!0,globalMove:!0,click:!0,wheel:!0};let Pu=Ru;tt.add(Pu);function Um(r){return r==="dynamic"||r==="static"}const ST={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??Um(Pu.defaultEventMode)},set interactive(r){xt("7.2.0","Setting interactive is deprecated, use eventMode = 'none'/'passive'/'auto'/'static'/'dynamic' instead."),this._internalInteractive=r,this.eventMode=r?"static":"auto"},_internalEventMode:void 0,get eventMode(){return this._internalEventMode??Pu.defaultEventMode},set eventMode(r){this._internalInteractive=Um(r),this._internalEventMode=r},isInteractive(){return this.eventMode==="static"||this.eventMode==="dynamic"},interactiveChildren:!0,hitArea:null,addEventListener(r,t,e){const i=typeof e=="boolean"&&e||typeof e=="object"&&e.capture,s=typeof t=="function"?void 0:t;r=i?`${r}capture`:r,t=typeof t=="function"?t:t.handleEvent,this.on(r,t,s)},removeEventListener(r,t,e){const i=typeof e=="boolean"&&e||typeof e=="object"&&e.capture,s=typeof t=="function"?void 0:t;r=i?`${r}capture`:r,t=typeof t=="function"?t:t.handleEvent,this.off(r,t,s)},dispatchEvent(r){if(!(r instanceof Jn))throw new Error("DisplayObject cannot propagate events outside of the Federated Events API");return r.defaultPrevented=!1,r.path=null,r.target=this,r.manager.dispatchEvent(r),!r.defaultPrevented}};Ot.mixin(ST);const ET={accessible:!1,accessibleTitle:null,accessibleHint:null,tabIndex:0,_accessibleActive:!1,_accessibleDiv:null,accessibleType:"button",accessiblePointerEvents:"auto",accessibleChildren:!0,renderId:-1};Ot.mixin(ET);const CT=9,La=100,IT=0,AT=0,Xm=2,Zm=1,MT=-1e3,RT=-1e3,PT=2;class Vm{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,(Yi.tablet||Yi.phone)&&this.createTouchHook();const e=document.createElement("div");e.style.width=`${La}px`,e.style.height=`${La}px`,e.style.position="absolute",e.style.top=`${IT}px`,e.style.left=`${AT}px`,e.style.zIndex=Xm.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=`${Zm}px`,t.style.height=`${Zm}px`,t.style.position="absolute",t.style.top=`${MT}px`,t.style.left=`${RT}px`,t.style.zIndex=PT.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(){var t;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),(t=this.renderer.view.parentNode)==null||t.appendChild(this.div))}deactivate(){var t;!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),(t=this.div.parentNode)==null||t.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 i=0;i<e.length;i++)this.updateAccessibleObjects(e[i])}update(){const t=performance.now();if(Yi.android.device&&t<this.androidUpdateCount||(this.androidUpdateCount=t+this.androidUpdateFrequency,!this.renderer.renderingToScreen))return;this.renderer.lastObjectRendered&&this.updateAccessibleObjects(this.renderer.lastObjectRendered);const{x:e,y:i,width:s,height:n}=this.renderer.view.getBoundingClientRect(),{width:o,height:a,resolution:h}=this.renderer,l=s/o*h,u=n/a*h;let c=this.div;c.style.left=`${e}px`,c.style.top=`${i}px`,c.style.width=`${o}px`,c.style.height=`${a}px`;for(let d=0;d<this.children.length;d++){const p=this.children[d];if(p.renderId!==this.renderId)p._accessibleActive=!1,Ws(this.children,d,1),this.div.removeChild(p._accessibleDiv),this.pool.push(p._accessibleDiv),p._accessibleDiv=null,d--;else{c=p._accessibleDiv;let m=p.hitArea;const f=p.worldTransform;p.hitArea?(c.style.left=`${(f.tx+m.x*f.a)*l}px`,c.style.top=`${(f.ty+m.y*f.d)*u}px`,c.style.width=`${m.width*f.a*l}px`,c.style.height=`${m.height*f.d*u}px`):(m=p.getBounds(),this.capHitArea(m),c.style.left=`${m.x*l}px`,c.style.top=`${m.y*u}px`,c.style.width=`${m.width*l}px`,c.style.height=`${m.height*u}px`,c.title!==p.accessibleTitle&&p.accessibleTitle!==null&&(c.title=p.accessibleTitle),c.getAttribute("aria-label")!==p.accessibleHint&&p.accessibleHint!==null&&c.setAttribute("aria-label",p.accessibleHint)),(p.accessibleTitle!==c.title||p.tabIndex!==c.tabIndex)&&(c.title=p.accessibleTitle,c.tabIndex=p.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:i}=this.renderer;t.x+t.width>e&&(t.width=e-t.x),t.y+t.height>i&&(t.height=i-t.y)}addChild(t){let e=this.pool.pop();e||(e=document.createElement("button"),e.style.width=`${La}px`,e.style.height=`${La}px`,e.style.backgroundColor=this.debug?"rgba(255,255,255,0.5)":"transparent",e.style.position="absolute",e.style.zIndex=Xm.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&&t.accessibleTitle!==null?e.title=t.accessibleTitle:(!t.accessibleHint||t.accessibleHint===null)&&(e.title=`displayObject ${t.tabIndex}`),t.accessibleHint&&t.accessibleHint!==null&&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:i}=t.target,s=this.renderer.events.rootBoundary,n=Object.assign(new Jn(s),{target:i});s.rootTarget=this.renderer.lastObjectRendered,e.forEach(o=>s.dispatchEvent(n,o))}_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){t.keyCode===CT&&this.activate()}_onMouseMove(t){t.movementX===0&&t.movementY===0||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}}Vm.extension={name:"accessibility",type:[z.RendererPlugin,z.CanvasRendererPlugin]},tt.add(Vm);const Hm=class dp{constructor(t){this.stage=new Xt,t=Object.assign({forceCanvas:!1},t),this.renderer=Xv(t),dp._plugins.forEach(e=>{e.init.call(this,t)})}render(){this.renderer.render(this.stage)}get view(){var t;return(t=this.renderer)==null?void 0:t.view}get screen(){var t;return(t=this.renderer)==null?void 0:t.screen}destroy(t,e){const i=dp._plugins.slice(0);i.reverse(),i.forEach(s=>{s.destroy.call(this)}),this.stage.destroy(e),this.stage=null,this.renderer.destroy(t),this.renderer=null}};Hm._plugins=[];let Km=Hm;tt.handleByList(z.Application,Km._plugins);class Ym{static init(t){Object.defineProperty(this,"resizeTo",{set(e){globalThis.removeEventListener("resize",this.queueResize),this._resizeTo=e,e&&(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;this.cancelResize();let e,i;if(this._resizeTo===globalThis.window)e=globalThis.innerWidth,i=globalThis.innerHeight;else{const{clientWidth:s,clientHeight:n}=this._resizeTo;e=s,i=n}this.renderer.resize(e,i),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}}Ym.extension=z.Application,tt.add(Ym);const zm={loader:z.LoadParser,resolver:z.ResolveParser,cache:z.CacheParser,detection:z.DetectionParser};tt.handle(z.Asset,r=>{const t=r.ref;Object.entries(zm).filter(([e])=>!!t[e]).forEach(([e,i])=>tt.add(Object.assign(t[e],{extension:t[e].extension??i})))},r=>{const t=r.ref;Object.keys(zm).filter(e=>!!t[e]).forEach(e=>tt.remove(t[e]))});class LT{constructor(t,e=!1){this._loader=t,this._assetList=[],this._isLoading=!1,this._maxConcurrent=1,this.verbose=e}add(t){t.forEach(e=>{this._assetList.push(e)}),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 i=0;i<e;i++)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 Hs(r,t){if(Array.isArray(t)){for(const e of t)if(r.startsWith(`data:${e}`))return!0;return!1}return r.startsWith(`data:${t}`)}function _r(r,t){const e=r.split("?")[0],i=Jt.extname(e).toLowerCase();return Array.isArray(t)?t.includes(i):i===t}const si=(r,t,e=!1)=>(Array.isArray(r)||(r=[r]),t?r.map(i=>typeof i=="string"||e?t(i):i):r),Lu=(r,t)=>{const e=t.split("?")[1];return e&&(r+=`?${e}`),r};function jm(r,t,e,i,s){const n=t[e];for(let o=0;o<n.length;o++){const a=n[o];e<t.length-1?jm(r.replace(i[e],a),t,e+1,i,s):s.push(r.replace(i[e],a))}}function GT(r){const t=/\{(.*?)\}/g,e=r.match(t),i=[];if(e){const s=[];e.forEach(n=>{const o=n.substring(1,n.length-1).split(",");s.push(o)}),jm(r,s,0,e,i)}else i.push(r);return i}const Ga=r=>!Array.isArray(r);class NT{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 i=si(t);let s;for(let a=0;a<this.parsers.length;a++){const h=this.parsers[a];if(h.test(e)){s=h.getCacheableAssets(i,e);break}}s||(s={},i.forEach(a=>{s[a]=e}));const n=Object.keys(s),o={cacheKeys:n,keys:i};if(i.forEach(a=>{this._cacheMap.set(a,o)}),n.forEach(a=>{this._cache.has(a)&&this._cache.get(a)!==e&&console.warn("[Cache] already has key:",a),this._cache.set(a,s[a])}),e instanceof it){const a=e;i.forEach(h=>{a.baseTexture!==it.EMPTY.baseTexture&&ft.addToCache(a.baseTexture,h),it.addToCache(a,h)})}}remove(t){if(!this._cacheMap.has(t)){console.warn(`[Assets] Asset id ${t} was not found in the Cache`);return}const e=this._cacheMap.get(t);e.cacheKeys.forEach(i=>{this._cache.delete(i)}),e.keys.forEach(i=>{this._cacheMap.delete(i)})}get parsers(){return this._parsers}}const ts=new NT;class FT{constructor(){this._parsers=[],this._parsersValidated=!1,this.parsers=new Proxy(this._parsers,{set:(t,e,i)=>(this._parsersValidated=!1,t[e]=i,!0)}),this.promiseCache={}}reset(){this._parsersValidated=!1,this.promiseCache={}}_getLoadPromiseAndParser(t,e){const i={promise:null,parser:null};return i.promise=(async()=>{var o,a;let s=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 h=0;h<this.parsers.length;h++){const l=this.parsers[h];if(l.load&&((o=l.test)!=null&&o.call(l,t,e,this))){n=l;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}s=await n.load(t,e,this),i.parser=n;for(let h=0;h<this.parsers.length;h++){const l=this.parsers[h];l.parse&&l.parse&&await((a=l.testParse)==null?void 0:a.call(l,s,e,this))&&(s=await l.parse(s,e,this)||s,i.parser=l)}return s})(),i}async load(t,e){this._parsersValidated||this._validateParsers();let i=0;const s={},n=Ga(t),o=si(t,l=>({alias:[l],src:l})),a=o.length,h=o.map(async l=>{const u=Jt.toAbsolute(l.src);if(!s[l.src])try{this.promiseCache[u]||(this.promiseCache[u]=this._getLoadPromiseAndParser(u,l)),s[l.src]=await this.promiseCache[u].promise,e&&e(++i/a)}catch(c){throw delete this.promiseCache[u],delete s[l.src],new Error(`[Loader.load] Failed to load ${u}.
|
|
867
|
-
${c}`)}});return await Promise.all(h),n?s[o[0].src]:s}async unload(t){const e=
|
|
866
|
+
`;class _T extends ye{constructor(t=.5,e=Math.random()){super(Nm,xT,{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}}const Zm={AlphaFilter:nT,BlurFilter:cT,BlurFilterPass:Au,ColorMatrixFilter:Pa,DisplacementFilter:mT,FXAAFilter:bT,NoiseFilter:_T};Object.entries(Zm).forEach(([r,t])=>{Object.defineProperty(Zm,r,{get(){return vt("7.1.0",`filters.${r} has moved to ${r}`),t}})});class vT{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||(be.system.add(this.tickerUpdate,this,is.INTERACTION),this.tickerAdded=!0)}removeTickerListener(){this.tickerAdded&&(be.system.remove(this.tickerUpdate,this),this.tickerAdded=!1)}pointerMoved(){this._didMove=!0}update(){if(!this.domElement||this._pauseUpdate)return;if(this._didMove){this._didMove=!1;return}const t=this.events.rootPointerEvent;this.events.supportsTouchEvents&&t.pointerType==="touch"||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())}}const vr=new vT;class $n{constructor(t){this.bubbles=!0,this.cancelBubble=!0,this.cancelable=!1,this.composed=!1,this.defaultPrevented=!1,this.eventPhase=$n.prototype.NONE,this.propagationStopped=!1,this.propagationImmediatelyStopped=!1,this.layer=new lt,this.page=new lt,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,i){throw new Error("initEvent() is a legacy DOM API. It is not implemented in the Federated Events API.")}initUIEvent(t,e,i,s,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 La extends $n{constructor(){super(...arguments),this.client=new lt,this.movement=new lt,this.offset=new lt,this.global=new lt,this.screen=new lt}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,i){return t.worldTransform.applyInverse(i||this.global,e)}getModifierState(t){return"getModifierState"in this.nativeEvent&&this.nativeEvent.getModifierState(t)}initMouseEvent(t,e,i,s,n,o,a,h,l,u,c,d,p,m,f){throw new Error("Method not implemented.")}}class si extends La{constructor(){super(...arguments),this.width=0,this.height=0,this.isPrimary=!1}getCoalescedEvents(){return this.type==="pointermove"||this.type==="mousemove"||this.type==="touchmove"?[this]:[]}getPredictedEvents(){throw new Error("getPredictedEvents is not supported!")}}class Hs extends La{constructor(){super(...arguments),this.DOM_DELTA_PIXEL=0,this.DOM_DELTA_LINE=1,this.DOM_DELTA_PAGE=2}}Hs.DOM_DELTA_PIXEL=0,Hs.DOM_DELTA_LINE=1,Hs.DOM_DELTA_PAGE=2;const TT=2048,wT=new lt,Mu=new lt;class ST{constructor(t){this.dispatch=new Nn,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((i,s)=>i.priority-s.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 i=0,s=e.length;i<s;i++)e[i].fn(t);else console.warn(`[EventBoundary]: Event mapping not defined for ${t.type}`)}hitTest(t,e){vr.pauseUpdate=!0;const i=this._isPointerMoveEvent&&this.enableGlobalMoveEvents?"hitTestMoveRecursive":"hitTestRecursive",s=this[i](this.rootTarget,this.rootTarget.eventMode,wT.set(t,e),this.hitTestFn,this.hitPruneFn);return s&&s[0]}propagate(t,e){if(!t.target)return;const i=t.composedPath();t.eventPhase=t.CAPTURING_PHASE;for(let s=0,n=i.length-1;s<n;s++)if(t.currentTarget=i[s],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 s=i.length-2;s>=0;s--)if(t.currentTarget=i[s],this.notifyTarget(t,e),t.propagationStopped||t.propagationImmediatelyStopped)return}}all(t,e,i=this._allInteractiveElements){if(i.length===0)return;t.eventPhase=t.BUBBLING_PHASE;const s=Array.isArray(e)?e:[e];for(let n=i.length-1;n>=0;n--)s.forEach(o=>{t.currentTarget=i[n],this.notifyTarget(t,o)})}propagationPath(t){const e=[t];for(let i=0;i<TT&&t!==this.rootTarget;i++){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,i,s,n,o=!1){let a=!1;if(this._interactivePrune(t))return null;if((t.eventMode==="dynamic"||e==="dynamic")&&(vr.pauseUpdate=!1),t.interactiveChildren&&t.children){const u=t.children;for(let c=u.length-1;c>=0;c--){const d=u[c],p=this.hitTestMoveRecursive(d,this._isInteractive(e)?e:d.eventMode,i,s,n,o||n(t,i));if(p){if(p.length>0&&!p[p.length-1].parent)continue;const m=t.isInteractive();(p.length>0||m)&&(m&&this._allInteractiveElements.push(t),p.push(t)),this._hitElements.length===0&&(this._hitElements=p),a=!0}}}const h=this._isInteractive(e),l=t.isInteractive();return h&&l&&this._allInteractiveElements.push(t),o||this._hitElements.length>0?null:a?this._hitElements:h&&!n(t,i)&&s(t,i)?l?[t]:[]:null}hitTestRecursive(t,e,i,s,n){if(this._interactivePrune(t)||n(t,i))return null;if((t.eventMode==="dynamic"||e==="dynamic")&&(vr.pauseUpdate=!1),t.interactiveChildren&&t.children){const h=t.children;for(let l=h.length-1;l>=0;l--){const u=h[l],c=this.hitTestRecursive(u,this._isInteractive(e)?e:u.eventMode,i,s,n);if(c){if(c.length>0&&!c[c.length-1].parent)continue;const d=t.isInteractive();return(c.length>0||d)&&c.push(t),c}}}const o=this._isInteractive(e),a=t.isInteractive();return o&&s(t,i)?a?[t]:[]:null}_isInteractive(t){return t==="static"||t==="dynamic"}_interactivePrune(t){return!!(!t||t.isMask||!t.visible||!t.renderable||t.eventMode==="none"||t.eventMode==="passive"&&!t.interactiveChildren||t.isMask)}hitPruneFn(t,e){var i;if(t.hitArea&&(t.worldTransform.applyInverse(e,Mu),!t.hitArea.contains(Mu.x,Mu.y)))return!0;if(t._mask){const s=t._mask.isMaskData?t._mask.maskObject:t._mask;if(s&&!((i=s.containsPoint)!=null&&i.call(s,e)))return!0}return!1}hitTestFn(t,e){return t.eventMode==="passive"?!1:t.hitArea?!0:t.containsPoint?t.containsPoint(e):!1}notifyTarget(t,e){var n,o;e=e??t.type;const i=`on${e}`;(o=(n=t.currentTarget)[i])==null||o.call(n,t);const s=t.eventPhase===t.CAPTURING_PHASE||t.eventPhase===t.AT_TARGET?`${e}capture`:e;this.notifyListeners(t,s),t.eventPhase===t.AT_TARGET&&this.notifyListeners(t,e)}mapPointerDown(t){if(!(t instanceof si)){console.warn("EventBoundary cannot map a non-pointer event as a pointer event");return}const e=this.createPointerEvent(t);if(this.dispatchEvent(e,"pointerdown"),e.pointerType==="touch")this.dispatchEvent(e,"touchstart");else if(e.pointerType==="mouse"||e.pointerType==="pen"){const s=e.button===2;this.dispatchEvent(e,s?"rightdown":"mousedown")}const i=this.trackingData(t.pointerId);i.pressTargetsByButton[t.button]=e.composedPath(),this.freeEvent(e)}mapPointerMove(t){var h,l;if(!(t instanceof si)){console.warn("EventBoundary cannot map a non-pointer event as a pointer event");return}this._allInteractiveElements.length=0,this._hitElements.length=0,this._isPointerMoveEvent=!0;const e=this.createPointerEvent(t);this._isPointerMoveEvent=!1;const i=e.pointerType==="mouse"||e.pointerType==="pen",s=this.trackingData(t.pointerId),n=this.findMountedTarget(s.overTargets);if(((h=s.overTargets)==null?void 0:h.length)>0&&n!==e.target){const u=t.type==="mousemove"?"mouseout":"pointerout",c=this.createPointerEvent(t,u,n);if(this.dispatchEvent(c,"pointerout"),i&&this.dispatchEvent(c,"mouseout"),!e.composedPath().includes(n)){const d=this.createPointerEvent(t,"pointerleave",n);for(d.eventPhase=d.AT_TARGET;d.target&&!e.composedPath().includes(d.target);)d.currentTarget=d.target,this.notifyTarget(d),i&&this.notifyTarget(d,"mouseleave"),d.target=d.target.parent;this.freeEvent(d)}this.freeEvent(c)}if(n!==e.target){const u=t.type==="mousemove"?"mouseover":"pointerover",c=this.clonePointerEvent(e,u);this.dispatchEvent(c,"pointerover"),i&&this.dispatchEvent(c,"mouseover");let d=n==null?void 0:n.parent;for(;d&&d!==this.rootTarget.parent&&d!==e.target;)d=d.parent;if(!d||d===this.rootTarget.parent){const p=this.clonePointerEvent(e,"pointerenter");for(p.eventPhase=p.AT_TARGET;p.target&&p.target!==n&&p.target!==this.rootTarget.parent;)p.currentTarget=p.target,this.notifyTarget(p),i&&this.notifyTarget(p,"mouseenter"),p.target=p.target.parent;this.freeEvent(p)}this.freeEvent(c)}const o=[],a=this.enableGlobalMoveEvents??!0;this.moveOnAll?o.push("pointermove"):this.dispatchEvent(e,"pointermove"),a&&o.push("globalpointermove"),e.pointerType==="touch"&&(this.moveOnAll?o.splice(1,0,"touchmove"):this.dispatchEvent(e,"touchmove"),a&&o.push("globaltouchmove")),i&&(this.moveOnAll?o.splice(1,0,"mousemove"):this.dispatchEvent(e,"mousemove"),a&&o.push("globalmousemove"),this.cursor=(l=e.target)==null?void 0:l.cursor),o.length>0&&this.all(e,o),this._allInteractiveElements.length=0,this._hitElements.length=0,s.overTargets=e.composedPath(),this.freeEvent(e)}mapPointerOver(t){var o;if(!(t instanceof si)){console.warn("EventBoundary cannot map a non-pointer event as a pointer event");return}const e=this.trackingData(t.pointerId),i=this.createPointerEvent(t),s=i.pointerType==="mouse"||i.pointerType==="pen";this.dispatchEvent(i,"pointerover"),s&&this.dispatchEvent(i,"mouseover"),i.pointerType==="mouse"&&(this.cursor=(o=i.target)==null?void 0:o.cursor);const n=this.clonePointerEvent(i,"pointerenter");for(n.eventPhase=n.AT_TARGET;n.target&&n.target!==this.rootTarget.parent;)n.currentTarget=n.target,this.notifyTarget(n),s&&this.notifyTarget(n,"mouseenter"),n.target=n.target.parent;e.overTargets=i.composedPath(),this.freeEvent(i),this.freeEvent(n)}mapPointerOut(t){if(!(t instanceof si)){console.warn("EventBoundary cannot map a non-pointer event as a pointer event");return}const e=this.trackingData(t.pointerId);if(e.overTargets){const i=t.pointerType==="mouse"||t.pointerType==="pen",s=this.findMountedTarget(e.overTargets),n=this.createPointerEvent(t,"pointerout",s);this.dispatchEvent(n),i&&this.dispatchEvent(n,"mouseout");const o=this.createPointerEvent(t,"pointerleave",s);for(o.eventPhase=o.AT_TARGET;o.target&&o.target!==this.rootTarget.parent;)o.currentTarget=o.target,this.notifyTarget(o),i&&this.notifyTarget(o,"mouseleave"),o.target=o.target.parent;e.overTargets=null,this.freeEvent(n),this.freeEvent(o)}this.cursor=null}mapPointerUp(t){if(!(t instanceof si)){console.warn("EventBoundary cannot map a non-pointer event as a pointer event");return}const e=performance.now(),i=this.createPointerEvent(t);if(this.dispatchEvent(i,"pointerup"),i.pointerType==="touch")this.dispatchEvent(i,"touchend");else if(i.pointerType==="mouse"||i.pointerType==="pen"){const a=i.button===2;this.dispatchEvent(i,a?"rightup":"mouseup")}const s=this.trackingData(t.pointerId),n=this.findMountedTarget(s.pressTargetsByButton[t.button]);let o=n;if(n&&!i.composedPath().includes(n)){let a=n;for(;a&&!i.composedPath().includes(a);){if(i.currentTarget=a,this.notifyTarget(i,"pointerupoutside"),i.pointerType==="touch")this.notifyTarget(i,"touchendoutside");else if(i.pointerType==="mouse"||i.pointerType==="pen"){const h=i.button===2;this.notifyTarget(i,h?"rightupoutside":"mouseupoutside")}a=a.parent}delete s.pressTargetsByButton[t.button],o=a}if(o){const a=this.clonePointerEvent(i,"click");a.target=o,a.path=null,s.clicksByButton[t.button]||(s.clicksByButton[t.button]={clickCount:0,target:a.target,timeStamp:e});const h=s.clicksByButton[t.button];if(h.target===a.target&&e-h.timeStamp<200?++h.clickCount:h.clickCount=1,h.target=a.target,h.timeStamp=e,a.detail=h.clickCount,a.pointerType==="mouse"){const l=a.button===2;this.dispatchEvent(a,l?"rightclick":"click")}else a.pointerType==="touch"&&this.dispatchEvent(a,"tap");this.dispatchEvent(a,"pointertap"),this.freeEvent(a)}this.freeEvent(i)}mapPointerUpOutside(t){if(!(t instanceof si)){console.warn("EventBoundary cannot map a non-pointer event as a pointer event");return}const e=this.trackingData(t.pointerId),i=this.findMountedTarget(e.pressTargetsByButton[t.button]),s=this.createPointerEvent(t);if(i){let n=i;for(;n;)s.currentTarget=n,this.notifyTarget(s,"pointerupoutside"),s.pointerType==="touch"?this.notifyTarget(s,"touchendoutside"):(s.pointerType==="mouse"||s.pointerType==="pen")&&this.notifyTarget(s,s.button===2?"rightupoutside":"mouseupoutside"),n=n.parent;delete e.pressTargetsByButton[t.button]}this.freeEvent(s)}mapWheel(t){if(!(t instanceof Hs)){console.warn("EventBoundary cannot map a non-wheel event as a wheel event");return}const e=this.createWheelEvent(t);this.dispatchEvent(e),this.freeEvent(e)}findMountedTarget(t){if(!t)return null;let e=t[0];for(let i=1;i<t.length&&t[i].parent===e;i++)e=t[i];return e}createPointerEvent(t,e,i){const s=this.allocateEvent(si);return this.copyPointerData(t,s),this.copyMouseData(t,s),this.copyData(t,s),s.nativeEvent=t.nativeEvent,s.originalEvent=t,s.target=i??this.hitTest(s.global.x,s.global.y)??this._hitElements[0],typeof e=="string"&&(s.type=e),s}createWheelEvent(t){const e=this.allocateEvent(Hs);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 i=this.allocateEvent(si);return i.nativeEvent=t.nativeEvent,i.originalEvent=t.originalEvent,this.copyPointerData(t,i),this.copyMouseData(t,i),this.copyData(t,i),i.target=t.target,i.path=t.composedPath().slice(),i.type=e??i.type,i}copyWheelData(t,e){e.deltaMode=t.deltaMode,e.deltaX=t.deltaX,e.deltaY=t.deltaY,e.deltaZ=t.deltaZ}copyPointerData(t,e){t instanceof si&&e instanceof si&&(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 La&&e instanceof La&&(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 i=t.currentTarget._events[e];if(i&&t.currentTarget.isInteractive())if("fn"in i)i.once&&t.currentTarget.removeListener(e,i.fn,void 0,!0),i.fn.call(i.context,t);else for(let s=0,n=i.length;s<n&&!t.propagationImmediatelyStopped;s++)i[s].once&&t.currentTarget.removeListener(e,i[s].fn,void 0,!0),i[s].fn.call(i[s].context,t)}}const ET=1,CT={touchstart:"pointerdown",touchend:"pointerup",touchendoutside:"pointerupoutside",touchmove:"pointermove",touchcancel:"pointercancel"},Ru=class fp{constructor(t){this.supportsTouchEvents="ontouchstart"in globalThis,this.supportsPointerEvents=!!globalThis.PointerEvent,this.domElement=null,this.resolution=1,this.renderer=t,this.rootBoundary=new ST(null),vr.init(this),this.autoPreventDefault=!0,this.eventsAdded=!1,this.rootPointerEvent=new si(null),this.rootWheelEvent=new Hs(null),this.cursorStyles={default:"inherit",pointer:"pointer"},this.features=new Proxy({...fp.defaultEventFeatures},{set:(e,i,s)=>(i==="globalMove"&&(this.rootBoundary.enableGlobalMoveEvents=s),e[i]=s,!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:i}=this.renderer;this.setTargetElement(e),this.resolution=i,fp._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 i=this.cursorStyles[t];if(i)switch(typeof i){case"string":e&&(this.domElement.style.cursor=i);break;case"function":i(t);break;case"object":e&&Object.assign(this.domElement.style,i);break}else e&&typeof t=="string"&&!Object.prototype.hasOwnProperty.call(this.cursorStyles,t)&&(this.domElement.style.cursor=t)}get pointer(){return this.rootPointerEvent}onPointerDown(t){if(!this.features.click)return;this.rootBoundary.rootTarget=this.renderer.lastObjectRendered;const e=this.normalizeToPointerData(t);this.autoPreventDefault&&e[0].isNormalized&&(t.cancelable||!("cancelable"in t))&&t.preventDefault();for(let i=0,s=e.length;i<s;i++){const n=e[i],o=this.bootstrapEvent(this.rootPointerEvent,n);this.rootBoundary.mapEvent(o)}this.setCursor(this.rootBoundary.cursor)}onPointerMove(t){if(!this.features.move)return;this.rootBoundary.rootTarget=this.renderer.lastObjectRendered,vr.pointerMoved();const e=this.normalizeToPointerData(t);for(let i=0,s=e.length;i<s;i++){const n=this.bootstrapEvent(this.rootPointerEvent,e[i]);this.rootBoundary.mapEvent(n)}this.setCursor(this.rootBoundary.cursor)}onPointerUp(t){if(!this.features.click)return;this.rootBoundary.rootTarget=this.renderer.lastObjectRendered;let e=t.target;t.composedPath&&t.composedPath().length>0&&(e=t.composedPath()[0]);const i=e!==this.domElement?"outside":"",s=this.normalizeToPointerData(t);for(let n=0,o=s.length;n<o;n++){const a=this.bootstrapEvent(this.rootPointerEvent,s[n]);a.type+=i,this.rootBoundary.mapEvent(a)}this.setCursor(this.rootBoundary.cursor)}onPointerOverOut(t){if(!this.features.click)return;this.rootBoundary.rootTarget=this.renderer.lastObjectRendered;const e=this.normalizeToPointerData(t);for(let i=0,s=e.length;i<s;i++){const n=this.bootstrapEvent(this.rootPointerEvent,e[i]);this.rootBoundary.mapEvent(n)}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,vr.domElement=t,this.addEvents()}addEvents(){if(this.eventsAdded||!this.domElement)return;vr.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;vr.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,i){const s=this.domElement.isConnected?this.domElement.getBoundingClientRect():{x:0,y:0,width:this.domElement.width,height:this.domElement.height,left:0,top:0},n=1/this.resolution;t.x=(e-s.left)*(this.domElement.width/s.width)*n,t.y=(i-s.top)*(this.domElement.height/s.height)*n}normalizeToPointerData(t){const e=[];if(this.supportsTouchEvents&&t instanceof TouchEvent)for(let i=0,s=t.changedTouches.length;i<s;i++){const n=t.changedTouches[i];typeof n.button>"u"&&(n.button=0),typeof n.buttons>"u"&&(n.buttons=1),typeof n.isPrimary>"u"&&(n.isPrimary=t.touches.length===1&&t.type==="touchstart"),typeof n.width>"u"&&(n.width=n.radiusX||1),typeof n.height>"u"&&(n.height=n.radiusY||1),typeof n.tiltX>"u"&&(n.tiltX=0),typeof n.tiltY>"u"&&(n.tiltY=0),typeof n.pointerType>"u"&&(n.pointerType="touch"),typeof n.pointerId>"u"&&(n.pointerId=n.identifier||0),typeof n.pressure>"u"&&(n.pressure=n.force||.5),typeof n.twist>"u"&&(n.twist=0),typeof n.tangentialPressure>"u"&&(n.tangentialPressure=0),typeof n.layerX>"u"&&(n.layerX=n.offsetX=n.clientX),typeof n.layerY>"u"&&(n.layerY=n.offsetY=n.clientY),n.isNormalized=!0,n.type=t.type,e.push(n)}else if(!globalThis.MouseEvent||t instanceof MouseEvent&&(!this.supportsPointerEvents||!(t instanceof globalThis.PointerEvent))){const i=t;typeof i.isPrimary>"u"&&(i.isPrimary=!0),typeof i.width>"u"&&(i.width=1),typeof i.height>"u"&&(i.height=1),typeof i.tiltX>"u"&&(i.tiltX=0),typeof i.tiltY>"u"&&(i.tiltY=0),typeof i.pointerType>"u"&&(i.pointerType="mouse"),typeof i.pointerId>"u"&&(i.pointerId=ET),typeof i.pressure>"u"&&(i.pressure=.5),typeof i.twist>"u"&&(i.twist=0),typeof i.tangentialPressure>"u"&&(i.tangentialPressure=0),i.isNormalized=!0,e.push(i)}else e.push(t);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,t.type==="pointerleave"&&(t.type="pointerout"),t.type.startsWith("mouse")&&(t.type=t.type.replace("mouse","pointer")),t.type.startsWith("touch")&&(t.type=CT[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}};Ru.extension={name:"events",type:[J.RendererSystem,J.CanvasRendererSystem]},Ru.defaultEventFeatures={move:!0,globalMove:!0,click:!0,wheel:!0};let Pu=Ru;et.add(Pu);function Vm(r){return r==="dynamic"||r==="static"}const IT={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??Vm(Pu.defaultEventMode)},set interactive(r){vt("7.2.0","Setting interactive is deprecated, use eventMode = 'none'/'passive'/'auto'/'static'/'dynamic' instead."),this._internalInteractive=r,this.eventMode=r?"static":"auto"},_internalEventMode:void 0,get eventMode(){return this._internalEventMode??Pu.defaultEventMode},set eventMode(r){this._internalInteractive=Vm(r),this._internalEventMode=r},isInteractive(){return this.eventMode==="static"||this.eventMode==="dynamic"},interactiveChildren:!0,hitArea:null,addEventListener(r,t,e){const i=typeof e=="boolean"&&e||typeof e=="object"&&e.capture,s=typeof t=="function"?void 0:t;r=i?`${r}capture`:r,t=typeof t=="function"?t:t.handleEvent,this.on(r,t,s)},removeEventListener(r,t,e){const i=typeof e=="boolean"&&e||typeof e=="object"&&e.capture,s=typeof t=="function"?void 0:t;r=i?`${r}capture`:r,t=typeof t=="function"?t:t.handleEvent,this.off(r,t,s)},dispatchEvent(r){if(!(r instanceof $n))throw new Error("DisplayObject cannot propagate events outside of the Federated Events API");return r.defaultPrevented=!1,r.path=null,r.target=this,r.manager.dispatchEvent(r),!r.defaultPrevented}};Ot.mixin(IT);const AT={accessible:!1,accessibleTitle:null,accessibleHint:null,tabIndex:0,_accessibleActive:!1,_accessibleDiv:null,accessibleType:"button",accessiblePointerEvents:"auto",accessibleChildren:!0,renderId:-1};Ot.mixin(AT);const MT=9,Ga=100,RT=0,PT=0,Hm=2,Km=1,LT=-1e3,GT=-1e3,NT=2;class Ym{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,(zi.tablet||zi.phone)&&this.createTouchHook();const e=document.createElement("div");e.style.width=`${Ga}px`,e.style.height=`${Ga}px`,e.style.position="absolute",e.style.top=`${RT}px`,e.style.left=`${PT}px`,e.style.zIndex=Hm.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=`${Km}px`,t.style.height=`${Km}px`,t.style.position="absolute",t.style.top=`${LT}px`,t.style.left=`${GT}px`,t.style.zIndex=NT.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(){var t;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),(t=this.renderer.view.parentNode)==null||t.appendChild(this.div))}deactivate(){var t;!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),(t=this.div.parentNode)==null||t.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 i=0;i<e.length;i++)this.updateAccessibleObjects(e[i])}update(){const t=performance.now();if(zi.android.device&&t<this.androidUpdateCount||(this.androidUpdateCount=t+this.androidUpdateFrequency,!this.renderer.renderingToScreen))return;this.renderer.lastObjectRendered&&this.updateAccessibleObjects(this.renderer.lastObjectRendered);const{x:e,y:i,width:s,height:n}=this.renderer.view.getBoundingClientRect(),{width:o,height:a,resolution:h}=this.renderer,l=s/o*h,u=n/a*h;let c=this.div;c.style.left=`${e}px`,c.style.top=`${i}px`,c.style.width=`${o}px`,c.style.height=`${a}px`;for(let d=0;d<this.children.length;d++){const p=this.children[d];if(p.renderId!==this.renderId)p._accessibleActive=!1,Us(this.children,d,1),this.div.removeChild(p._accessibleDiv),this.pool.push(p._accessibleDiv),p._accessibleDiv=null,d--;else{c=p._accessibleDiv;let m=p.hitArea;const f=p.worldTransform;p.hitArea?(c.style.left=`${(f.tx+m.x*f.a)*l}px`,c.style.top=`${(f.ty+m.y*f.d)*u}px`,c.style.width=`${m.width*f.a*l}px`,c.style.height=`${m.height*f.d*u}px`):(m=p.getBounds(),this.capHitArea(m),c.style.left=`${m.x*l}px`,c.style.top=`${m.y*u}px`,c.style.width=`${m.width*l}px`,c.style.height=`${m.height*u}px`,c.title!==p.accessibleTitle&&p.accessibleTitle!==null&&(c.title=p.accessibleTitle),c.getAttribute("aria-label")!==p.accessibleHint&&p.accessibleHint!==null&&c.setAttribute("aria-label",p.accessibleHint)),(p.accessibleTitle!==c.title||p.tabIndex!==c.tabIndex)&&(c.title=p.accessibleTitle,c.tabIndex=p.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:i}=this.renderer;t.x+t.width>e&&(t.width=e-t.x),t.y+t.height>i&&(t.height=i-t.y)}addChild(t){let e=this.pool.pop();e||(e=document.createElement("button"),e.style.width=`${Ga}px`,e.style.height=`${Ga}px`,e.style.backgroundColor=this.debug?"rgba(255,255,255,0.5)":"transparent",e.style.position="absolute",e.style.zIndex=Hm.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&&t.accessibleTitle!==null?e.title=t.accessibleTitle:(!t.accessibleHint||t.accessibleHint===null)&&(e.title=`displayObject ${t.tabIndex}`),t.accessibleHint&&t.accessibleHint!==null&&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:i}=t.target,s=this.renderer.events.rootBoundary,n=Object.assign(new $n(s),{target:i});s.rootTarget=this.renderer.lastObjectRendered,e.forEach(o=>s.dispatchEvent(n,o))}_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){t.keyCode===MT&&this.activate()}_onMouseMove(t){t.movementX===0&&t.movementY===0||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}}Ym.extension={name:"accessibility",type:[J.RendererPlugin,J.CanvasRendererPlugin]},et.add(Ym);const zm=class mp{constructor(t){this.stage=new Xt,t=Object.assign({forceCanvas:!1},t),this.renderer=Hv(t),mp._plugins.forEach(e=>{e.init.call(this,t)})}render(){this.renderer.render(this.stage)}get view(){var t;return(t=this.renderer)==null?void 0:t.view}get screen(){var t;return(t=this.renderer)==null?void 0:t.screen}destroy(t,e){const i=mp._plugins.slice(0);i.reverse(),i.forEach(s=>{s.destroy.call(this)}),this.stage.destroy(e),this.stage=null,this.renderer.destroy(t),this.renderer=null}};zm._plugins=[];let jm=zm;et.handleByList(J.Application,jm._plugins);class Jm{static init(t){Object.defineProperty(this,"resizeTo",{set(e){globalThis.removeEventListener("resize",this.queueResize),this._resizeTo=e,e&&(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;this.cancelResize();let e,i;if(this._resizeTo===globalThis.window)e=globalThis.innerWidth,i=globalThis.innerHeight;else{const{clientWidth:s,clientHeight:n}=this._resizeTo;e=s,i=n}this.renderer.resize(e,i),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}}Jm.extension=J.Application,et.add(Jm);const $m={loader:J.LoadParser,resolver:J.ResolveParser,cache:J.CacheParser,detection:J.DetectionParser};et.handle(J.Asset,r=>{const t=r.ref;Object.entries($m).filter(([e])=>!!t[e]).forEach(([e,i])=>et.add(Object.assign(t[e],{extension:t[e].extension??i})))},r=>{const t=r.ref;Object.keys($m).filter(e=>!!t[e]).forEach(e=>et.remove(t[e]))});class FT{constructor(t,e=!1){this._loader=t,this._assetList=[],this._isLoading=!1,this._maxConcurrent=1,this.verbose=e}add(t){t.forEach(e=>{this._assetList.push(e)}),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 i=0;i<e;i++)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 Ks(r,t){if(Array.isArray(t)){for(const e of t)if(r.startsWith(`data:${e}`))return!0;return!1}return r.startsWith(`data:${t}`)}function Tr(r,t){const e=r.split("?")[0],i=Jt.extname(e).toLowerCase();return Array.isArray(t)?t.includes(i):i===t}const ni=(r,t,e=!1)=>(Array.isArray(r)||(r=[r]),t?r.map(i=>typeof i=="string"||e?t(i):i):r),Lu=(r,t)=>{const e=t.split("?")[1];return e&&(r+=`?${e}`),r};function Qm(r,t,e,i,s){const n=t[e];for(let o=0;o<n.length;o++){const a=n[o];e<t.length-1?Qm(r.replace(i[e],a),t,e+1,i,s):s.push(r.replace(i[e],a))}}function DT(r){const t=/\{(.*?)\}/g,e=r.match(t),i=[];if(e){const s=[];e.forEach(n=>{const o=n.substring(1,n.length-1).split(",");s.push(o)}),Qm(r,s,0,e,i)}else i.push(r);return i}const Na=r=>!Array.isArray(r);class kT{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 i=ni(t);let s;for(let a=0;a<this.parsers.length;a++){const h=this.parsers[a];if(h.test(e)){s=h.getCacheableAssets(i,e);break}}s||(s={},i.forEach(a=>{s[a]=e}));const n=Object.keys(s),o={cacheKeys:n,keys:i};if(i.forEach(a=>{this._cacheMap.set(a,o)}),n.forEach(a=>{this._cache.has(a)&&this._cache.get(a)!==e&&console.warn("[Cache] already has key:",a),this._cache.set(a,s[a])}),e instanceof rt){const a=e;i.forEach(h=>{a.baseTexture!==rt.EMPTY.baseTexture&&ft.addToCache(a.baseTexture,h),rt.addToCache(a,h)})}}remove(t){if(!this._cacheMap.has(t)){console.warn(`[Assets] Asset id ${t} was not found in the Cache`);return}const e=this._cacheMap.get(t);e.cacheKeys.forEach(i=>{this._cache.delete(i)}),e.keys.forEach(i=>{this._cacheMap.delete(i)})}get parsers(){return this._parsers}}const rs=new kT;class OT{constructor(){this._parsers=[],this._parsersValidated=!1,this.parsers=new Proxy(this._parsers,{set:(t,e,i)=>(this._parsersValidated=!1,t[e]=i,!0)}),this.promiseCache={}}reset(){this._parsersValidated=!1,this.promiseCache={}}_getLoadPromiseAndParser(t,e){const i={promise:null,parser:null};return i.promise=(async()=>{var o,a;let s=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 h=0;h<this.parsers.length;h++){const l=this.parsers[h];if(l.load&&((o=l.test)!=null&&o.call(l,t,e,this))){n=l;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}s=await n.load(t,e,this),i.parser=n;for(let h=0;h<this.parsers.length;h++){const l=this.parsers[h];l.parse&&l.parse&&await((a=l.testParse)==null?void 0:a.call(l,s,e,this))&&(s=await l.parse(s,e,this)||s,i.parser=l)}return s})(),i}async load(t,e){this._parsersValidated||this._validateParsers();let i=0;const s={},n=Na(t),o=ni(t,l=>({alias:[l],src:l})),a=o.length,h=o.map(async l=>{const u=Jt.toAbsolute(l.src);if(!s[l.src])try{this.promiseCache[u]||(this.promiseCache[u]=this._getLoadPromiseAndParser(u,l)),s[l.src]=await this.promiseCache[u].promise,e&&e(++i/a)}catch(c){throw delete this.promiseCache[u],delete s[l.src],new Error(`[Loader.load] Failed to load ${u}.
|
|
867
|
+
${c}`)}});return await Promise.all(h),n?s[o[0].src]:s}async unload(t){const e=ni(t,i=>({alias:[i],src:i})).map(async i=>{var o,a;const s=Jt.toAbsolute(i.src),n=this.promiseCache[s];if(n){const h=await n.promise;delete this.promiseCache[s],(a=(o=n.parser)==null?void 0:o.unload)==null||a.call(o,h,i,this)}});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 oi=(r=>(r[r.Low=0]="Low",r[r.Normal=1]="Normal",r[r.High=2]="High",r))(oi||{});const BT=".json",WT="application/json",UT={extension:{type:J.LoadParser,priority:oi.Low},name:"loadJson",test(r){return Ks(r,WT)||Tr(r,BT)},async load(r){return await(await Q.ADAPTER.fetch(r)).json()}};et.add(UT);const XT=".txt",ZT="text/plain",VT={name:"loadTxt",extension:{type:J.LoadParser,priority:oi.Low},test(r){return Ks(r,ZT)||Tr(r,XT)},async load(r){return await(await Q.ADAPTER.fetch(r)).text()}};et.add(VT);const HT=["normal","bold","100","200","300","400","500","600","700","800","900"],KT=[".ttf",".otf",".woff",".woff2"],YT=["font/ttf","font/otf","font/woff","font/woff2"],zT=/^(--|-?[A-Z_])[0-9A-Z_-]*$/i;function jT(r){const t=Jt.extname(r),e=Jt.basename(r,t).replace(/(-|_)/g," ").toLowerCase().split(" ").map(n=>n.charAt(0).toUpperCase()+n.slice(1));let i=e.length>0;for(const n of e)if(!n.match(zT)){i=!1;break}let s=e.join(" ");return i||(s=`"${s.replace(/[\\"]/g,"\\$&")}"`),s}const JT=/^[0-9A-Za-z%:/?#\[\]@!\$&'()\*\+,;=\-._~]*$/;function $T(r){return JT.test(r)?r:encodeURI(r)}const QT={extension:{type:J.LoadParser,priority:oi.Low},name:"loadWebFont",test(r){return Ks(r,YT)||Tr(r,KT)},async load(r,t){var i,s,n;const e=Q.ADAPTER.getFontFaceSet();if(e){const o=[],a=((i=t.data)==null?void 0:i.family)??jT(r),h=((n=(s=t.data)==null?void 0:s.weights)==null?void 0:n.filter(u=>HT.includes(u)))??["normal"],l=t.data??{};for(let u=0;u<h.length;u++){const c=h[u],d=new FontFace(a,`url(${$T(r)})`,{...l,weight:c});await d.load(),e.add(d),o.push(d)}return o.length===1?o[0]:o}return console.warn("[loadWebFont] FontFace API is not supported. Skipping loading font"),null},unload(r){(Array.isArray(r)?r:[r]).forEach(t=>Q.ADAPTER.getFontFaceSet().delete(t))}};et.add(QT);let qm=0,Gu;const qT="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mP8/x8AAwMCAO+ip1sAAAAASUVORK5CYII=",tw={id:"checkImageBitmap",code:`
|
|
868
868
|
async function checkImageBitmap()
|
|
869
869
|
{
|
|
870
870
|
try
|
|
871
871
|
{
|
|
872
872
|
if (typeof createImageBitmap !== 'function') return false;
|
|
873
873
|
|
|
874
|
-
const response = await fetch('${
|
|
874
|
+
const response = await fetch('${qT}');
|
|
875
875
|
const imageBlob = await response.blob();
|
|
876
876
|
const imageBitmap = await createImageBitmap(imageBlob);
|
|
877
877
|
|
|
@@ -883,7 +883,7 @@ ${c}`)}});return await Promise.all(h),n?s[o[0].src]:s}async unload(t){const e=si
|
|
|
883
883
|
}
|
|
884
884
|
}
|
|
885
885
|
checkImageBitmap().then((result) => { self.postMessage(result); });
|
|
886
|
-
`},
|
|
886
|
+
`},ew={id:"loadImageBitmap",code:`
|
|
887
887
|
async function loadImageBitmap(url)
|
|
888
888
|
{
|
|
889
889
|
const response = await fetch(url);
|
|
@@ -919,8 +919,8 @@ ${c}`)}});return await Promise.all(h),n?s[o[0].src]:s}async unload(t){const e=si
|
|
|
919
919
|
id: event.data.id,
|
|
920
920
|
});
|
|
921
921
|
}
|
|
922
|
-
};`};let Nu;class
|
|
923
|
-
Please use Assets.add({ alias, src, data, format, loadParser }) instead.`),o.push({alias:t,src:e,data:i,format:s,loadParser:n})):Array.isArray(t)?o.push(...t):o.push(t);let a;a=h=>{this.hasKey(h)&&console.warn(`[Resolver] already has key: ${h} overwriting`)},si(o).forEach(h=>{const{src:l,srcs:u}=h;let{data:c,format:d,loadParser:p}=h;const m=si(l||u).map(y=>typeof y=="string"?GT(y):Array.isArray(y)?y:[y]),f=this.getAlias(h);Array.isArray(f)?f.forEach(a):a(f);const g=[];m.forEach(y=>{y.forEach(_=>{let x={};if(typeof _!="object"){x.src=_;for(let v=0;v<this._parsers.length;v++){const S=this._parsers[v];if(S.test(_)){x=S.parse(_);break}}}else c=_.data??c,d=_.format??d,p=_.loadParser??p,x={...x,..._};if(!f)throw new Error(`[Resolver] alias is undefined for this asset: ${x.src}`);x=this.buildResolvedAsset(x,{aliases:f,data:c,format:d,loadParser:p}),g.push(x)})}),f.forEach(y=>{this._assetMap[y]=g})})}resolveBundle(t){const e=Ga(t);t=si(t);const i={};return t.forEach(s=>{const n=this._bundles[s];if(n){const o=this.resolve(n),a={};for(const h in o){const l=o[h];a[this._extractAssetIdFromBundle(s,h)]=l}i[s]=a}}),e?i[t[0]]:i}resolveUrl(t){const e=this.resolve(t);if(typeof t!="string"){const i={};for(const s in e)i[s]=e[s].src;return i}return e.src}resolve(t){const e=Ga(t);t=si(t);const i={};return t.forEach(s=>{if(!this._resolverHash[s])if(this._assetMap[s]){let n=this._assetMap[s];const o=n[0],a=this._getPreferredOrder(n);a==null||a.priority.forEach(h=>{a.params[h].forEach(l=>{const u=n.filter(c=>c[h]?c[h]===l:!1);u.length&&(n=u)})}),this._resolverHash[s]=n[0]??o}else this._resolverHash[s]=this.buildResolvedAsset({alias:[s],src:s},{});i[s]=this._resolverHash[s]}),e?i[t[0]]:i}hasKey(t){return!!this._assetMap[t]}hasBundle(t){return!!this._bundles[t]}_getPreferredOrder(t){for(let e=0;e<t.length;e++){const i=t[0],s=this._preferredOrder.find(n=>n.params.format.includes(i.format));if(s)return s}return this._preferredOrder[0]}_appendDefaultSearchParams(t){if(!this._defaultSearchParams)return t;const e=/\?/.test(t)?"&":"?";return`${t}${e}${this._defaultSearchParams}`}buildResolvedAsset(t,e){const{aliases:i,data:s,loadParser:n,format:o}=e;return(this._basePath||this._rootPath)&&(t.src=Jt.toAbsolute(t.src,this._basePath,this._rootPath)),t.alias=i??t.alias??[t.src],t.src=this._appendDefaultSearchParams(t.src),t.data={...s||{},...t.data},t.loadParser=n??t.loadParser,t.format=o??Jt.extname(t.src).slice(1),t.srcs=t.src,t.name=t.alias,t}}class uw{constructor(){this._detections=[],this._initialized=!1,this.resolver=new lw,this.loader=new FT,this.cache=ts,this._backgroundLoader=new LT(this.loader),this._backgroundLoader.active=!0,this.reset()}async init(t={}){var n,o;if(this._initialized){console.warn("[Assets]AssetManager already initialized, did you load before calling this Asset.init()?");return}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 a=t.manifest;typeof a=="string"&&(a=await this.load(a)),this.resolver.addManifest(a)}const e=((n=t.texturePreference)==null?void 0:n.resolution)??1,i=typeof e=="number"?[e]:e,s=await this._detectFormats({preferredFormats:(o=t.texturePreference)==null?void 0:o.format,skipDetections:t.skipDetections,detections:this._detections});this.resolver.prefer({params:{format:s,resolution:i}}),t.preferences&&this.setPreferences(t.preferences)}add(t,e,i,s,n){this.resolver.add(t,e,i,s,n)}async load(t,e){this._initialized||await this.init();const i=Ga(t),s=si(t).map(a=>{if(typeof a!="string"){const h=this.resolver.getAlias(a);return h.some(l=>!this.resolver.hasKey(l))&&this.add(a),Array.isArray(h)?h[0]:h}return this.resolver.hasKey(a)||this.add({alias:a,src:a}),a}),n=this.resolver.resolve(s),o=await this._mapLoadToResolve(n,e);return i?o[s[0]]:o}addBundle(t,e){this.resolver.addBundle(t,e)}async loadBundle(t,e){this._initialized||await this.init();let i=!1;typeof t=="string"&&(i=!0,t=[t]);const s=this.resolver.resolveBundle(t),n={},o=Object.keys(s);let a=0,h=0;const l=()=>{e==null||e(++a/h)},u=o.map(c=>{const d=s[c];return h+=Object.keys(d).length,this._mapLoadToResolve(d,l).then(p=>{n[c]=p})});return await Promise.all(u),i?n[t[0]]:n}async backgroundLoad(t){this._initialized||await this.init(),typeof t=="string"&&(t=[t]);const e=this.resolver.resolve(t);this._backgroundLoader.add(Object.values(e))}async backgroundLoadBundle(t){this._initialized||await this.init(),typeof t=="string"&&(t=[t]);const e=this.resolver.resolveBundle(t);Object.values(e).forEach(i=>{this._backgroundLoader.add(Object.values(i))})}reset(){this.resolver.reset(),this.loader.reset(),this.cache.reset(),this._initialized=!1}get(t){if(typeof t=="string")return ts.get(t);const e={};for(let i=0;i<t.length;i++)e[i]=ts.get(t[i]);return e}async _mapLoadToResolve(t,e){const i=Object.values(t),s=Object.keys(t);this._backgroundLoader.active=!1;const n=await this.loader.load(i,e);this._backgroundLoader.active=!0;const o={};return i.forEach((a,h)=>{const l=n[a.src],u=[a.src];a.alias&&u.push(...a.alias),o[s[h]]=l,ts.set(u,l)}),o}async unload(t){this._initialized||await this.init();const e=si(t).map(s=>typeof s!="string"?s.src:s),i=this.resolver.resolve(e);await this._unloadFromResolved(i)}async unloadBundle(t){this._initialized||await this.init(),t=si(t);const e=this.resolver.resolveBundle(t),i=Object.keys(e).map(s=>this._unloadFromResolved(e[s]));await Promise.all(i)}async _unloadFromResolved(t){const e=Object.values(t);e.forEach(i=>{ts.remove(i.src)}),await this.loader.unload(e)}async _detectFormats(t){let e=[];t.preferredFormats&&(e=Array.isArray(t.preferredFormats)?t.preferredFormats:[t.preferredFormats]);for(const i of t.detections)t.skipDetections||await i.test()?e=await i.add(e):t.skipDetections||(e=await i.remove(e));return e=e.filter((i,s)=>e.indexOf(i)===s),e}get detections(){return this._detections}get preferWorkers(){return Na.config.preferWorkers}set preferWorkers(t){xt("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(i=>i in t).forEach(i=>{e.config[i]=t[i]})})}}const Fa=new uw;tt.handleByList(z.LoadParser,Fa.loader.parsers).handleByList(z.ResolveParser,Fa.resolver.parsers).handleByList(z.CacheParser,Fa.cache.parsers).handleByList(z.DetectionParser,Fa.detections);const cw={extension:z.CacheParser,test:r=>Array.isArray(r)&&r.every(t=>t instanceof it),getCacheableAssets:(r,t)=>{const e={};return r.forEach(i=>{t.forEach((s,n)=>{e[i+(n===0?"":n+1)]=s})}),e}};tt.add(cw);async function Qm(r){if("Image"in globalThis)return new Promise(t=>{const e=new Image;e.onload=()=>{t(!0)},e.onerror=()=>{t(!1)},e.src=r});if("createImageBitmap"in globalThis&&"fetch"in globalThis){try{const t=await(await fetch(r)).blob();await createImageBitmap(t)}catch{return!1}return!0}return!1}const dw={extension:{type:z.DetectionParser,priority:1},test:async()=>Qm("data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAAB0AAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAIAAAACAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQ0MAAAAABNjb2xybmNseAACAAIAAYAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAACVtZGF0EgAKCBgANogQEAwgMg8f8D///8WfhwB8+ErK42A="),add:async r=>[...r,"avif"],remove:async r=>r.filter(t=>t!=="avif")};tt.add(dw);const pw={extension:{type:z.DetectionParser,priority:0},test:async()=>Qm("data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAAAAAAfQ//73v/+BiOh/AAA="),add:async r=>[...r,"webp"],remove:async r=>r.filter(t=>t!=="webp")};tt.add(pw);const qm=["png","jpg","jpeg"],fw={extension:{type:z.DetectionParser,priority:-1},test:()=>Promise.resolve(!0),add:async r=>[...r,...qm],remove:async r=>r.filter(t=>!qm.includes(t))};tt.add(fw);const mw="WorkerGlobalScope"in globalThis&&globalThis instanceof globalThis.WorkerGlobalScope;function Fu(r){return mw?!1:document.createElement("video").canPlayType(r)!==""}const gw={extension:{type:z.DetectionParser,priority:0},test:async()=>Fu("video/webm"),add:async r=>[...r,"webm"],remove:async r=>r.filter(t=>t!=="webm")};tt.add(gw);const yw={extension:{type:z.DetectionParser,priority:0},test:async()=>Fu("video/mp4"),add:async r=>[...r,"mp4","m4v"],remove:async r=>r.filter(t=>t!=="mp4"&&t!=="m4v")};tt.add(yw);const bw={extension:{type:z.DetectionParser,priority:0},test:async()=>Fu("video/ogg"),add:async r=>[...r,"ogv"],remove:async r=>r.filter(t=>t!=="ogv")};tt.add(bw);const xw={extension:z.ResolveParser,test:Na.test,parse:r=>{var t;return{resolution:parseFloat(((t=$.RETINA_PREFIX.exec(r))==null?void 0:t[1])??"1"),format:Jt.extname(r).slice(1),src:r}}};tt.add(xw);var Ie=(r=>(r[r.COMPRESSED_RGB_S3TC_DXT1_EXT=33776]="COMPRESSED_RGB_S3TC_DXT1_EXT",r[r.COMPRESSED_RGBA_S3TC_DXT1_EXT=33777]="COMPRESSED_RGBA_S3TC_DXT1_EXT",r[r.COMPRESSED_RGBA_S3TC_DXT3_EXT=33778]="COMPRESSED_RGBA_S3TC_DXT3_EXT",r[r.COMPRESSED_RGBA_S3TC_DXT5_EXT=33779]="COMPRESSED_RGBA_S3TC_DXT5_EXT",r[r.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT=35917]="COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT",r[r.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT=35918]="COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT",r[r.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT=35919]="COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT",r[r.COMPRESSED_SRGB_S3TC_DXT1_EXT=35916]="COMPRESSED_SRGB_S3TC_DXT1_EXT",r[r.COMPRESSED_R11_EAC=37488]="COMPRESSED_R11_EAC",r[r.COMPRESSED_SIGNED_R11_EAC=37489]="COMPRESSED_SIGNED_R11_EAC",r[r.COMPRESSED_RG11_EAC=37490]="COMPRESSED_RG11_EAC",r[r.COMPRESSED_SIGNED_RG11_EAC=37491]="COMPRESSED_SIGNED_RG11_EAC",r[r.COMPRESSED_RGB8_ETC2=37492]="COMPRESSED_RGB8_ETC2",r[r.COMPRESSED_RGBA8_ETC2_EAC=37496]="COMPRESSED_RGBA8_ETC2_EAC",r[r.COMPRESSED_SRGB8_ETC2=37493]="COMPRESSED_SRGB8_ETC2",r[r.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC=37497]="COMPRESSED_SRGB8_ALPHA8_ETC2_EAC",r[r.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2=37494]="COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2",r[r.COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2=37495]="COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2",r[r.COMPRESSED_RGB_PVRTC_4BPPV1_IMG=35840]="COMPRESSED_RGB_PVRTC_4BPPV1_IMG",r[r.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG=35842]="COMPRESSED_RGBA_PVRTC_4BPPV1_IMG",r[r.COMPRESSED_RGB_PVRTC_2BPPV1_IMG=35841]="COMPRESSED_RGB_PVRTC_2BPPV1_IMG",r[r.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG=35843]="COMPRESSED_RGBA_PVRTC_2BPPV1_IMG",r[r.COMPRESSED_RGB_ETC1_WEBGL=36196]="COMPRESSED_RGB_ETC1_WEBGL",r[r.COMPRESSED_RGB_ATC_WEBGL=35986]="COMPRESSED_RGB_ATC_WEBGL",r[r.COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL=35986]="COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL",r[r.COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL=34798]="COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL",r[r.COMPRESSED_RGBA_ASTC_4x4_KHR=37808]="COMPRESSED_RGBA_ASTC_4x4_KHR",r))(Ie||{});const Da={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 tr,Ks;function tg(){Ks={s3tc:tr.getExtension("WEBGL_compressed_texture_s3tc"),s3tc_sRGB:tr.getExtension("WEBGL_compressed_texture_s3tc_srgb"),etc:tr.getExtension("WEBGL_compressed_texture_etc"),etc1:tr.getExtension("WEBGL_compressed_texture_etc1"),pvrtc:tr.getExtension("WEBGL_compressed_texture_pvrtc")||tr.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc"),atc:tr.getExtension("WEBGL_compressed_texture_atc"),astc:tr.getExtension("WEBGL_compressed_texture_astc")}}const _w={extension:{type:z.DetectionParser,priority:2},test:async()=>{const r=$.ADAPTER.createCanvas().getContext("webgl");return r?(tr=r,!0):(console.warn("WebGL not available for compressed textures."),!1)},add:async r=>{Ks||tg();const t=[];for(const e in Ks)Ks[e]&&t.push(e);return[...t,...r]},remove:async r=>(Ks||tg(),r.filter(t=>!(t in Ks)))};tt.add(_w);class vw extends la{constructor(t,e={width:1,height:1,autoLoad:!0}){let i,s;typeof t=="string"?(i=t,s=new Uint8Array):(i=null,s=t),super(s,e),this.origin=i,this.buffer=s?new eu(s):null,this._load=null,this.loaded=!1,this.origin!==null&&e.autoLoad!==!1&&this.load(),this.origin===null&&this.buffer&&(this._load=Promise.resolve(this),this.loaded=!0,this.onBlobLoaded(this.buffer.rawBinaryData))}onBlobLoaded(t){}load(){return this._load?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 eu(t),this.loaded=!0,this.onBlobLoaded(t),this.update(),this)),this._load)}}class es extends vw{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=es._formatToExtension(this.format),(e.levelBuffers||this.buffer)&&(this._levelBuffers=e.levelBuffers||es._createLevelBuffers(t instanceof Uint8Array?t:this.buffer.uint8View,this.format,this.levels,4,4,this.width,this.height))}upload(t,e,i){const s=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;s.pixelStorei(s.UNPACK_ALIGNMENT,4);for(let n=0,o=this.levels;n<o;n++){const{levelID:a,levelWidth:h,levelHeight:l,levelBuffer:u}=this._levelBuffers[n];s.compressedTexImage2D(s.TEXTURE_2D,a,this.format,h,l,0,u)}return!0}onBlobLoaded(){this._levelBuffers=es._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,i,s,n,o,a){const h=new Array(i);let l=t.byteOffset,u=o,c=a,d=u+s-1&~(s-1),p=c+n-1&~(n-1),m=d*p*Da[e];for(let f=0;f<i;f++)h[f]={levelID:f,levelWidth:i>1?u:d,levelHeight:i>1?c:p,levelBuffer:new Uint8Array(t.buffer,l,m)},l+=m,u=u>>1||1,c=c>>1||1,d=u+s-1&~(s-1),p=c+n-1&~(n-1),m=d*p*Da[e];return h}}const Du=4,ka=124,Tw=32,eg=20,ww=542327876,Oa={SIZE:1,FLAGS:2,HEIGHT:3,WIDTH:4,MIPMAP_COUNT:7,PIXEL_FORMAT:19},Sw={SIZE:0,FLAGS:1,FOURCC:2,RGB_BITCOUNT:3,R_BIT_MASK:4,G_BIT_MASK:5,B_BIT_MASK:6,A_BIT_MASK:7},Ba={DXGI_FORMAT:0,RESOURCE_DIMENSION:1,MISC_FLAG:2,ARRAY_SIZE:3,MISC_FLAGS2:4},Ew=1,Cw=2,Iw=4,Aw=64,Mw=512,Rw=131072,Pw=827611204,Lw=861165636,Gw=894720068,Nw=808540228,Fw=4,Dw={[Pw]:Ie.COMPRESSED_RGBA_S3TC_DXT1_EXT,[Lw]:Ie.COMPRESSED_RGBA_S3TC_DXT3_EXT,[Gw]:Ie.COMPRESSED_RGBA_S3TC_DXT5_EXT},kw={70:Ie.COMPRESSED_RGBA_S3TC_DXT1_EXT,71:Ie.COMPRESSED_RGBA_S3TC_DXT1_EXT,73:Ie.COMPRESSED_RGBA_S3TC_DXT3_EXT,74:Ie.COMPRESSED_RGBA_S3TC_DXT3_EXT,76:Ie.COMPRESSED_RGBA_S3TC_DXT5_EXT,77:Ie.COMPRESSED_RGBA_S3TC_DXT5_EXT,72:Ie.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT,75:Ie.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT,78:Ie.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT};function Ow(r){const t=new Uint32Array(r);if(t[0]!==ww)throw new Error("Invalid DDS file magic word");const e=new Uint32Array(r,0,ka/Uint32Array.BYTES_PER_ELEMENT),i=e[Oa.HEIGHT],s=e[Oa.WIDTH],n=e[Oa.MIPMAP_COUNT],o=new Uint32Array(r,Oa.PIXEL_FORMAT*Uint32Array.BYTES_PER_ELEMENT,Tw/Uint32Array.BYTES_PER_ELEMENT),a=o[Ew];if(a&Iw){const h=o[Sw.FOURCC];if(h!==Nw){const _=Dw[h],x=Du+ka,v=new Uint8Array(r,x);return[new es(v,{format:_,width:s,height:i,levels:n})]}const l=Du+ka,u=new Uint32Array(t.buffer,l,eg/Uint32Array.BYTES_PER_ELEMENT),c=u[Ba.DXGI_FORMAT],d=u[Ba.RESOURCE_DIMENSION],p=u[Ba.MISC_FLAG],m=u[Ba.ARRAY_SIZE],f=kw[c];if(f===void 0)throw new Error(`DDSParser cannot parse texture data with DXGI format ${c}`);if(p===Fw)throw new Error("DDSParser does not support cubemap textures");if(d===6)throw new Error("DDSParser does not supported 3D texture data");const g=new Array,y=Du+ka+eg;if(m===1)g.push(new Uint8Array(r,y));else{const _=Da[f];let x=0,v=s,S=i;for(let A=0;A<n;A++){const I=Math.max(1,v+3&-4),L=Math.max(1,S+3&-4),k=I*L*_;x+=k,v=v>>>1,S=S>>>1}let C=y;for(let A=0;A<m;A++)g.push(new Uint8Array(r,C,x)),C+=x}return g.map(_=>new es(_,{format:f,width:s,height:i,levels:n}))}throw a&Aw?new Error("DDSParser does not support uncompressed texture data."):a&Mw?new Error("DDSParser does not supported YUV uncompressed texture data."):a&Rw?new Error("DDSParser does not support single-channel (lumninance) texture data!"):a&Cw?new Error("DDSParser does not support single-channel (alpha) texture data!"):new Error("DDSParser failed to load a texture file due to an unknown reason!")}const ig=[171,75,84,88,32,49,49,187,13,10,26,10],Bw=67305985,oi={FILE_IDENTIFIER:0,ENDIANNESS:12,GL_TYPE:16,GL_TYPE_SIZE:20,GL_FORMAT:24,GL_INTERNAL_FORMAT:28,GL_BASE_INTERNAL_FORMAT:32,PIXEL_WIDTH:36,PIXEL_HEIGHT:40,PIXEL_DEPTH:44,NUMBER_OF_ARRAY_ELEMENTS:48,NUMBER_OF_FACES:52,NUMBER_OF_MIPMAP_LEVELS:56,BYTES_OF_KEY_VALUE_DATA:60},ku=64,rg={[nt.UNSIGNED_BYTE]:1,[nt.UNSIGNED_SHORT]:2,[nt.INT]:4,[nt.UNSIGNED_INT]:4,[nt.FLOAT]:4,[nt.HALF_FLOAT]:8},Ww={[V.RGBA]:4,[V.RGB]:3,[V.RG]:2,[V.RED]:1,[V.LUMINANCE]:1,[V.LUMINANCE_ALPHA]:2,[V.ALPHA]:1},Uw={[nt.UNSIGNED_SHORT_4_4_4_4]:2,[nt.UNSIGNED_SHORT_5_5_5_1]:2,[nt.UNSIGNED_SHORT_5_6_5]:2};function Xw(r,t,e=!1){const i=new DataView(t);if(!Zw(r,i))return null;const s=i.getUint32(oi.ENDIANNESS,!0)===Bw,n=i.getUint32(oi.GL_TYPE,s),o=i.getUint32(oi.GL_FORMAT,s),a=i.getUint32(oi.GL_INTERNAL_FORMAT,s),h=i.getUint32(oi.PIXEL_WIDTH,s),l=i.getUint32(oi.PIXEL_HEIGHT,s)||1,u=i.getUint32(oi.PIXEL_DEPTH,s)||1,c=i.getUint32(oi.NUMBER_OF_ARRAY_ELEMENTS,s)||1,d=i.getUint32(oi.NUMBER_OF_FACES,s),p=i.getUint32(oi.NUMBER_OF_MIPMAP_LEVELS,s),m=i.getUint32(oi.BYTES_OF_KEY_VALUE_DATA,s);if(l===0||u!==1)throw new Error("Only 2D textures are supported");if(d!==1)throw new Error("CubeTextures are not supported by KTXLoader yet!");if(c!==1)throw new Error("WebGL does not support array textures");const f=4,g=4,y=h+3&-4,_=l+3&-4,x=new Array(c);let v=h*l;n===0&&(v=y*_);let S;if(n!==0?rg[n]?S=rg[n]*Ww[o]:S=Uw[n]:S=Da[a],S===void 0)throw new Error("Unable to resolve the pixel format stored in the *.ktx file!");const C=e?Hw(i,m,s):null;let A=v*S,I=h,L=l,k=y,M=_,G=ku+m;for(let E=0;E<p;E++){const N=i.getUint32(G,s);let O=G+4;for(let Z=0;Z<c;Z++){let U=x[Z];U||(U=x[Z]=new Array(p)),U[E]={levelID:E,levelWidth:p>1||n!==0?I:k,levelHeight:p>1||n!==0?L:M,levelBuffer:new Uint8Array(t,O,A)},O+=A}G+=N+4,G=G%4!==0?G+4-G%4:G,I=I>>1||1,L=L>>1||1,k=I+f-1&~(f-1),M=L+g-1&~(g-1),A=k*M*S}return n!==0?{uncompressed:x.map(E=>{let N=E[0].levelBuffer,O=!1;return n===nt.FLOAT?N=new Float32Array(E[0].levelBuffer.buffer,E[0].levelBuffer.byteOffset,E[0].levelBuffer.byteLength/4):n===nt.UNSIGNED_INT?(O=!0,N=new Uint32Array(E[0].levelBuffer.buffer,E[0].levelBuffer.byteOffset,E[0].levelBuffer.byteLength/4)):n===nt.INT&&(O=!0,N=new Int32Array(E[0].levelBuffer.buffer,E[0].levelBuffer.byteOffset,E[0].levelBuffer.byteLength/4)),{resource:new la(N,{width:E[0].levelWidth,height:E[0].levelHeight}),type:n,format:O?Vw(o):o}}),kvData:C}:{compressed:x.map(E=>new es(null,{format:a,width:h,height:l,levels:p,levelBuffers:E})),kvData:C}}function Zw(r,t){for(let e=0;e<ig.length;e++)if(t.getUint8(e)!==ig[e])return console.error(`${r} is not a valid *.ktx file!`),!1;return!0}function Vw(r){switch(r){case V.RGBA:return V.RGBA_INTEGER;case V.RGB:return V.RGB_INTEGER;case V.RG:return V.RG_INTEGER;case V.RED:return V.RED_INTEGER;default:return r}}function Hw(r,t,e){const i=new Map;let s=0;for(;s<t;){const n=r.getUint32(ku+s,e),o=ku+s+4,a=3-(n+3)%4;if(n===0||n>t-s){console.error("KTXLoader: keyAndValueByteSize out of bounds");break}let h=0;for(;h<n&&r.getUint8(o+h)!==0;h++);if(h===-1){console.error("KTXLoader: Failed to find null byte terminating kvData key");break}const l=new TextDecoder().decode(new Uint8Array(r.buffer,o,h)),u=new DataView(r.buffer,o+h+1,n-h-1);i.set(l,u),s+=4+n+a}return i}const Kw={extension:{type:z.LoadParser,priority:ni.High},name:"loadDDS",test(r){return _r(r,".dds")},async load(r,t,e){const i=await(await $.ADAPTER.fetch(r)).arrayBuffer(),s=Ow(i).map(n=>{const o=new ft(n,{mipmap:bi.OFF,alphaMode:be.NO_PREMULTIPLIED_ALPHA,resolution:$i(r),...t.data});return $n(o,e,r)});return s.length===1?s[0]:s},unload(r){Array.isArray(r)?r.forEach(t=>t.destroy(!0)):r.destroy(!0)}};tt.add(Kw);const Yw={extension:{type:z.LoadParser,priority:ni.High},name:"loadKTX",test(r){return _r(r,".ktx")},async load(r,t,e){const i=await(await $.ADAPTER.fetch(r)).arrayBuffer(),{compressed:s,uncompressed:n,kvData:o}=Xw(r,i),a=s??n,h={mipmap:bi.OFF,alphaMode:be.NO_PREMULTIPLIED_ALPHA,resolution:$i(r),...t.data},l=a.map(u=>{a===n&&Object.assign(h,{type:u.type,format:u.format});const c=u.resource??u,d=new ft(c,h);return d.ktxKeyValueData=o,$n(d,e,r)});return l.length===1?l[0]:l},unload(r){Array.isArray(r)?r.forEach(t=>t.destroy(!0)):r.destroy(!0)}};tt.add(Yw);const zw={extension:z.ResolveParser,test:r=>{const t=Jt.extname(r).slice(1);return["basis","ktx","dds"].includes(t)},parse:r=>{var e,i;const t=Jt.extname(r).slice(1);if(t==="ktx"){const s=[".s3tc.ktx",".s3tc_sRGB.ktx",".etc.ktx",".etc1.ktx",".pvrt.ktx",".atc.ktx",".astc.ktx"];if(s.some(n=>r.endsWith(n)))return{resolution:parseFloat(((e=$.RETINA_PREFIX.exec(r))==null?void 0:e[1])??"1"),format:s.find(n=>r.endsWith(n)),src:r}}return{resolution:parseFloat(((i=$.RETINA_PREFIX.exec(r))==null?void 0:i[1])??"1"),format:t,src:r}}};tt.add(zw);const Wa=new ct,jw=4,sg=class Zo{constructor(t){this.renderer=t,this._rendererPremultipliedAlpha=!1}contextChange(){var e;const t=(e=this.renderer)==null?void 0:e.gl.getContextAttributes();this._rendererPremultipliedAlpha=!!(t&&t.alpha&&t.premultipliedAlpha)}async image(t,e,i,s){const n=new Image;return n.src=await this.base64(t,e,i,s),n}async base64(t,e,i,s){const n=this.canvas(t,s);if(n.toBlob!==void 0)return new Promise((o,a)=>{n.toBlob(h=>{if(!h){a(new Error("ICanvas.toBlob failed!"));return}const l=new FileReader;l.onload=()=>o(l.result),l.onerror=a,l.readAsDataURL(h)},e,i)});if(n.toDataURL!==void 0)return n.toDataURL(e,i);if(n.convertToBlob!==void 0){const o=await n.convertToBlob({type:e,quality:i});return new Promise((a,h)=>{const l=new FileReader;l.onload=()=>a(l.result),l.onerror=h,l.readAsDataURL(o)})}throw new Error("Extract.base64() requires ICanvas.toDataURL, ICanvas.toBlob, or ICanvas.convertToBlob to be implemented")}canvas(t,e){const{pixels:i,width:s,height:n,flipY:o,premultipliedAlpha:a}=this._rawPixels(t,e);o&&Zo._flipY(i,s,n),a&&Zo._unpremultiplyAlpha(i);const h=new R1(s,n,1),l=new ImageData(new Uint8ClampedArray(i.buffer),s,n);return h.context.putImageData(l,0,0),h.canvas}pixels(t,e){const{pixels:i,width:s,height:n,flipY:o,premultipliedAlpha:a}=this._rawPixels(t,e);return o&&Zo._flipY(i,s,n),a&&Zo._unpremultiplyAlpha(i),i}_rawPixels(t,e){const i=this.renderer;if(!i)throw new Error("The Extract has already been destroyed");let s,n=!1,o=!1,a,h=!1;t&&(t instanceof Jr?a=t:(a=i.generateTexture(t,{region:e,resolution:i.resolution,multisample:i.multisample}),h=!0,e&&(Wa.width=e.width,Wa.height=e.height,e=Wa)));const l=i.gl;if(a){if(s=a.baseTexture.resolution,e=e??a.frame,n=!1,o=a.baseTexture.alphaMode>0&&a.baseTexture.format===V.RGBA,!h){i.renderTexture.bind(a);const p=a.framebuffer.glFramebuffers[i.CONTEXT_UID];p.blitFramebuffer&&i.framebuffer.bind(p.blitFramebuffer)}}else s=i.resolution,e||(e=Wa,e.width=i.width/s,e.height=i.height/s),n=!0,o=this._rendererPremultipliedAlpha,i.renderTexture.bind();const u=Math.max(Math.round(e.width*s),1),c=Math.max(Math.round(e.height*s),1),d=new Uint8Array(jw*u*c);return l.readPixels(Math.round(e.x*s),Math.round(e.y*s),u,c,l.RGBA,l.UNSIGNED_BYTE,d),h&&(a==null||a.destroy(!0)),{pixels:d,width:u,height:c,flipY:n,premultipliedAlpha:o}}destroy(){this.renderer=null}static _flipY(t,e,i){const s=e<<2,n=i>>1,o=new Uint8Array(s);for(let a=0;a<n;a++){const h=a*s,l=(i-a-1)*s;o.set(t.subarray(h,h+s)),t.copyWithin(h,l,l+s),t.set(o,l)}}static _unpremultiplyAlpha(t){t instanceof Uint8ClampedArray&&(t=new Uint8Array(t.buffer));const e=t.length;for(let i=0;i<e;i+=4){const s=t[i+3];if(s!==0){const n=255.001/s;t[i]=t[i]*n+.5,t[i+1]=t[i+1]*n+.5,t[i+2]=t[i+2]*n+.5}}}};sg.extension={name:"extract",type:z.RendererSystem};let Jw=sg;tt.add(Jw);const Ua={build(r){const t=r.points;let e,i,s,n,o,a;if(r.type===ae.CIRC){const m=r.shape;e=m.x,i=m.y,o=a=m.radius,s=n=0}else if(r.type===ae.ELIP){const m=r.shape;e=m.x,i=m.y,o=m.width,a=m.height,s=n=0}else{const m=r.shape,f=m.width/2,g=m.height/2;e=m.x+f,i=m.y+g,o=a=Math.max(0,Math.min(m.radius,Math.min(f,g))),s=f-o,n=g-a}if(!(o>=0&&a>=0&&s>=0&&n>=0)){t.length=0;return}const h=Math.ceil(2.3*Math.sqrt(o+a)),l=h*8+(s?4:0)+(n?4:0);if(t.length=l,l===0)return;if(h===0){t.length=8,t[0]=t[6]=e+s,t[1]=t[3]=i+n,t[2]=t[4]=e-s,t[5]=t[7]=i-n;return}let u=0,c=h*4+(s?2:0)+2,d=c,p=l;{const m=s+o,f=n,g=e+m,y=e-m,_=i+f;if(t[u++]=g,t[u++]=_,t[--c]=_,t[--c]=y,n){const x=i-f;t[d++]=y,t[d++]=x,t[--p]=x,t[--p]=g}}for(let m=1;m<h;m++){const f=Math.PI/2*(m/h),g=s+Math.cos(f)*o,y=n+Math.sin(f)*a,_=e+g,x=e-g,v=i+y,S=i-y;t[u++]=_,t[u++]=v,t[--c]=v,t[--c]=x,t[d++]=x,t[d++]=S,t[--p]=S,t[--p]=_}{const m=s,f=n+a,g=e+m,y=e-m,_=i+f,x=i-f;t[u++]=g,t[u++]=_,t[--p]=x,t[--p]=g,s&&(t[u++]=y,t[u++]=_,t[--p]=x,t[--p]=y)}},triangulate(r,t){const e=r.points,i=t.points,s=t.indices;if(e.length===0)return;let n=i.length/2;const o=n;let a,h;if(r.type!==ae.RREC){const u=r.shape;a=u.x,h=u.y}else{const u=r.shape;a=u.x+u.width/2,h=u.y+u.height/2}const l=r.matrix;i.push(r.matrix?l.a*a+l.c*h+l.tx:a,r.matrix?l.b*a+l.d*h+l.ty:h),n++,i.push(e[0],e[1]);for(let u=2;u<e.length;u+=2)i.push(e[u],e[u+1]),s.push(n++,o,n);s.push(o+1,o,n)}};function ng(r,t=!1){const e=r.length;if(e<6)return;let i=0;for(let s=0,n=r[e-2],o=r[e-1];s<e;s+=2){const a=r[s],h=r[s+1];i+=(a-n)*(h+o),n=a,o=h}if(!t&&i>0||t&&i<=0){const s=e/2;for(let n=s+s%2;n<e;n+=2){const o=e-n-2,a=e-n-1,h=n,l=n+1;[r[o],r[h]]=[r[h],r[o]],[r[a],r[l]]=[r[l],r[a]]}}}const og={build(r){r.points=r.shape.points.slice()},triangulate(r,t){let e=r.points;const i=r.holes,s=t.points,n=t.indices;if(e.length>=6){ng(e,!1);const o=[];for(let l=0;l<i.length;l++){const u=i[l];ng(u.points,!0),o.push(e.length/2),e=e.concat(u.points)}const a=ox(e,o,2);if(!a)return;const h=s.length/2;for(let l=0;l<a.length;l+=3)n.push(a[l]+h),n.push(a[l+1]+h),n.push(a[l+2]+h);for(let l=0;l<e.length;l++)s.push(e[l])}}},$w={build(r){const t=r.shape,e=t.x,i=t.y,s=t.width,n=t.height,o=r.points;o.length=0,s>=0&&n>=0&&o.push(e,i,e+s,i,e+s,i+n,e,i+n)},triangulate(r,t){const e=r.points,i=t.points;if(e.length===0)return;const s=i.length/2;i.push(e[0],e[1],e[2],e[3],e[6],e[7],e[4],e[5]),t.indices.push(s,s+1,s+2,s+1,s+2,s+3)}},Qw={build(r){Ua.build(r)},triangulate(r,t){Ua.triangulate(r,t)}};var Xe=(r=>(r.MITER="miter",r.BEVEL="bevel",r.ROUND="round",r))(Xe||{}),vr=(r=>(r.BUTT="butt",r.ROUND="round",r.SQUARE="square",r))(vr||{});const Ys={adaptive:!0,maxLength:10,minSegments:8,maxSegments:2048,epsilon:1e-4,_segmentsCount(r,t=20){if(!this.adaptive||!r||isNaN(r))return t;let e=Math.ceil(r/this.maxLength);return e<this.minSegments?e=this.minSegments:e>this.maxSegments&&(e=this.maxSegments),e}};class ag{static curveTo(t,e,i,s,n,o){const a=o[o.length-2],h=o[o.length-1]-e,l=a-t,u=s-e,c=i-t,d=Math.abs(h*c-l*u);if(d<1e-8||n===0)return(o[o.length-2]!==t||o[o.length-1]!==e)&&o.push(t,e),null;const p=h*h+l*l,m=u*u+c*c,f=h*u+l*c,g=n*Math.sqrt(p)/d,y=n*Math.sqrt(m)/d,_=g*f/p,x=y*f/m,v=g*c+y*l,S=g*u+y*h,C=l*(y+_),A=h*(y+_),I=c*(g+x),L=u*(g+x),k=Math.atan2(A-S,C-v),M=Math.atan2(L-S,I-v);return{cx:v+t,cy:S+e,radius:n,startAngle:k,endAngle:M,anticlockwise:l*u>c*h}}static arc(t,e,i,s,n,o,a,h,l){const u=a-o,c=Ys._segmentsCount(Math.abs(u)*n,Math.ceil(Math.abs(u)/ca)*40),d=u/(c*2),p=d*2,m=Math.cos(d),f=Math.sin(d),g=c-1,y=g%1/g;for(let _=0;_<=g;++_){const x=_+y*_,v=d+o+p*x,S=Math.cos(v),C=-Math.sin(v);l.push((m*S+f*C)*n+i,(m*-C+f*S)*n+s)}}}class qw{constructor(){this.reset()}begin(t,e,i){this.reset(),this.style=t,this.start=e,this.attribStart=i}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 Ou{static curveLength(t,e,i,s,n,o,a,h){let l=0,u=0,c=0,d=0,p=0,m=0,f=0,g=0,y=0,_=0,x=0,v=t,S=e;for(let C=1;C<=10;++C)u=C/10,c=u*u,d=c*u,p=1-u,m=p*p,f=m*p,g=f*t+3*m*u*i+3*p*c*n+d*a,y=f*e+3*m*u*s+3*p*c*o+d*h,_=v-g,x=S-y,v=g,S=y,l+=Math.sqrt(_*_+x*x);return l}static curveTo(t,e,i,s,n,o,a){const h=a[a.length-2],l=a[a.length-1];a.length-=2;const u=Ys._segmentsCount(Ou.curveLength(h,l,t,e,i,s,n,o));let c=0,d=0,p=0,m=0,f=0;a.push(h,l);for(let g=1,y=0;g<=u;++g)y=g/u,c=1-y,d=c*c,p=d*c,m=y*y,f=m*y,a.push(p*h+3*d*y*t+3*c*m*i+f*n,p*l+3*d*y*e+3*c*m*s+f*o)}}function hg(r,t,e,i,s,n,o,a){const h=r-e*s,l=t-i*s,u=r+e*n,c=t+i*n;let d,p;o?(d=i,p=-e):(d=-i,p=e);const m=h+d,f=l+p,g=u+d,y=c+p;return a.push(m,f,g,y),2}function is(r,t,e,i,s,n,o,a){const h=e-r,l=i-t;let u=Math.atan2(h,l),c=Math.atan2(s-r,n-t);a&&u<c?u+=Math.PI*2:!a&&u>c&&(c+=Math.PI*2);let d=u;const p=c-u,m=Math.abs(p),f=Math.sqrt(h*h+l*l),g=(15*m*Math.sqrt(f)/Math.PI>>0)+1,y=p/g;if(d+=y,a){o.push(r,t,e,i);for(let _=1,x=d;_<g;_++,x+=y)o.push(r,t,r+Math.sin(x)*f,t+Math.cos(x)*f);o.push(r,t,s,n)}else{o.push(e,i,r,t);for(let _=1,x=d;_<g;_++,x+=y)o.push(r+Math.sin(x)*f,t+Math.cos(x)*f,r,t);o.push(s,n,r,t)}return g*2}function tS(r,t){const e=r.shape;let i=r.points||e.points.slice();const s=t.closePointEps;if(i.length===0)return;const n=r.lineStyle,o=new lt(i[0],i[1]),a=new lt(i[i.length-2],i[i.length-1]),h=e.type!==ae.POLY||e.closeStroke,l=Math.abs(o.x-a.x)<s&&Math.abs(o.y-a.y)<s;if(h){i=i.slice(),l&&(i.pop(),i.pop(),a.set(i[i.length-2],i[i.length-1]));const U=(o.x+a.x)*.5,K=(a.y+o.y)*.5;i.unshift(U,K),i.push(U,K)}const u=t.points,c=i.length/2;let d=i.length;const p=u.length/2,m=n.width/2,f=m*m,g=n.miterLimit*n.miterLimit;let y=i[0],_=i[1],x=i[2],v=i[3],S=0,C=0,A=-(_-v),I=y-x,L=0,k=0,M=Math.sqrt(A*A+I*I);A/=M,I/=M,A*=m,I*=m;const G=n.alignment,E=(1-G)*2,N=G*2;h||(n.cap===vr.ROUND?d+=is(y-A*(E-N)*.5,_-I*(E-N)*.5,y-A*E,_-I*E,y+A*N,_+I*N,u,!0)+2:n.cap===vr.SQUARE&&(d+=hg(y,_,A,I,E,N,!0,u))),u.push(y-A*E,_-I*E,y+A*N,_+I*N);for(let U=1;U<c-1;++U){y=i[(U-1)*2],_=i[(U-1)*2+1],x=i[U*2],v=i[U*2+1],S=i[(U+1)*2],C=i[(U+1)*2+1],A=-(_-v),I=y-x,M=Math.sqrt(A*A+I*I),A/=M,I/=M,A*=m,I*=m,L=-(v-C),k=x-S,M=Math.sqrt(L*L+k*k),L/=M,k/=M,L*=m,k*=m;const K=x-y,ht=_-v,X=x-S,W=C-v,j=K*X+ht*W,q=ht*X-W*K,pt=q<0;if(Math.abs(q)<.001*Math.abs(j)){u.push(x-A*E,v-I*E,x+A*N,v+I*N),j>=0&&(n.join===Xe.ROUND?d+=is(x,v,x-A*E,v-I*E,x-L*E,v-k*E,u,!1)+4:d+=2,u.push(x-L*N,v-k*N,x+L*E,v+k*E));continue}const at=(-A+y)*(-I+v)-(-A+x)*(-I+_),It=(-L+S)*(-k+v)-(-L+x)*(-k+C),Nt=(K*It-X*at)/q,wt=(W*at-ht*It)/q,Y=(Nt-x)*(Nt-x)+(wt-v)*(wt-v),et=x+(Nt-x)*E,Q=v+(wt-v)*E,F=x-(Nt-x)*N,yt=v-(wt-v)*N,mt=Math.min(K*K+ht*ht,X*X+W*W),Mt=pt?E:N,Ut=mt+Mt*Mt*f,Fe=Y<=Ut;let ci=n.join;if(ci===Xe.MITER&&Y/f>g&&(ci=Xe.BEVEL),Fe)switch(ci){case Xe.MITER:{u.push(et,Q,F,yt);break}case Xe.BEVEL:{pt?u.push(et,Q,x+A*N,v+I*N,et,Q,x+L*N,v+k*N):u.push(x-A*E,v-I*E,F,yt,x-L*E,v-k*E,F,yt),d+=2;break}case Xe.ROUND:{pt?(u.push(et,Q,x+A*N,v+I*N),d+=is(x,v,x+A*N,v+I*N,x+L*N,v+k*N,u,!0)+4,u.push(et,Q,x+L*N,v+k*N)):(u.push(x-A*E,v-I*E,F,yt),d+=is(x,v,x-A*E,v-I*E,x-L*E,v-k*E,u,!1)+4,u.push(x-L*E,v-k*E,F,yt));break}}else{switch(u.push(x-A*E,v-I*E,x+A*N,v+I*N),ci){case Xe.MITER:{pt?u.push(F,yt,F,yt):u.push(et,Q,et,Q),d+=2;break}case Xe.ROUND:{pt?d+=is(x,v,x+A*N,v+I*N,x+L*N,v+k*N,u,!0)+2:d+=is(x,v,x-A*E,v-I*E,x-L*E,v-k*E,u,!1)+2;break}}u.push(x-L*E,v-k*E,x+L*N,v+k*N),d+=2}}y=i[(c-2)*2],_=i[(c-2)*2+1],x=i[(c-1)*2],v=i[(c-1)*2+1],A=-(_-v),I=y-x,M=Math.sqrt(A*A+I*I),A/=M,I/=M,A*=m,I*=m,u.push(x-A*E,v-I*E,x+A*N,v+I*N),h||(n.cap===vr.ROUND?d+=is(x-A*(E-N)*.5,v-I*(E-N)*.5,x-A*E,v-I*E,x+A*N,v+I*N,u,!1)+2:n.cap===vr.SQUARE&&(d+=hg(x,v,A,I,E,N,!1,u)));const O=t.indices,Z=Ys.epsilon*Ys.epsilon;for(let U=p;U<d+p-2;++U)y=u[U*2],_=u[U*2+1],x=u[(U+1)*2],v=u[(U+1)*2+1],S=u[(U+2)*2],C=u[(U+2)*2+1],!(Math.abs(y*(v-C)+x*(C-_)+S*(_-v))<Z)&&O.push(U,U+1,U+2)}function eS(r,t){let e=0;const i=r.shape,s=r.points||i.points,n=i.type!==ae.POLY||i.closeStroke;if(s.length===0)return;const o=t.points,a=t.indices,h=s.length/2,l=o.length/2;let u=l;for(o.push(s[0],s[1]),e=1;e<h;e++)o.push(s[e*2],s[e*2+1]),a.push(u,u+1),u++;n&&a.push(u,l)}function lg(r,t){r.lineStyle.native?eS(r,t):tS(r,t)}class Bu{static curveLength(t,e,i,s,n,o){const a=t-2*i+n,h=e-2*s+o,l=2*i-2*t,u=2*s-2*e,c=4*(a*a+h*h),d=4*(a*l+h*u),p=l*l+u*u,m=2*Math.sqrt(c+d+p),f=Math.sqrt(c),g=2*c*f,y=2*Math.sqrt(p),_=d/f;return(g*m+f*d*(m-y)+(4*p*c-d*d)*Math.log((2*f+_+m)/(_+y)))/(4*g)}static curveTo(t,e,i,s,n){const o=n[n.length-2],a=n[n.length-1],h=Ys._segmentsCount(Bu.curveLength(o,a,t,e,i,s));let l=0,u=0;for(let c=1;c<=h;++c){const d=c/h;l=o+(t-o)*d,u=a+(e-a)*d,n.push(l+(t+(i-t)*d-l)*d,u+(e+(s-e)*d-u)*d)}}}const Wu={[ae.POLY]:og,[ae.CIRC]:Ua,[ae.ELIP]:Ua,[ae.RECT]:$w,[ae.RREC]:Qw},ug=[],Xa=[];class Za{constructor(t,e=null,i=null,s=null){this.points=[],this.holes=[],this.shape=t,this.lineStyle=i,this.fillStyle=e,this.matrix=s,this.type=t.type}clone(){return new Za(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 zs=new lt,cg=class xb extends Vf{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 Ma,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(),Xa.push(this.drawCalls[t]);this.drawCalls.length=0;for(let t=0;t<this.batches.length;t++){const e=this.batches[t];e.reset(),ug.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,i=null,s=null){const n=new Za(t,e,i,s);return this.graphicsData.push(n),this.dirty++,this}drawHole(t,e=null){if(!this.graphicsData.length)return null;const i=new Za(t,null,null,e),s=this.graphicsData[this.graphicsData.length-1];return i.lineStyle=s.lineStyle,s.holes.push(i),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 i=0;i<e.length;++i){const s=e[i];if(s.fillStyle.visible&&s.shape&&(s.matrix?s.matrix.applyInverse(t,zs):zs.copyFrom(t),s.shape.contains(zs.x,zs.y))){let n=!1;if(s.holes){for(let o=0;o<s.holes.length;o++)if(s.holes[o].shape.contains(zs.x,zs.y)){n=!0;break}}if(!n)return!0}}return!1}updateBatches(){if(!this.graphicsData.length){this.batchable=!0;return}if(!this.validateBatching())return;this.cacheDirty=this.dirty;const t=this.uvs,e=this.graphicsData;let i=null,s=null;this.batches.length>0&&(i=this.batches[this.batches.length-1],s=i.style);for(let h=this.shapeIndex;h<e.length;h++){this.shapeIndex++;const l=e[h],u=l.fillStyle,c=l.lineStyle;Wu[l.type].build(l),l.matrix&&this.transformPoints(l.points,l.matrix),(u.visible||c.visible)&&this.processHoles(l.holes);for(let d=0;d<2;d++){const p=d===0?u:c;if(!p.visible)continue;const m=p.texture.baseTexture,f=this.indices.length,g=this.points.length/2;m.wrapMode=Hi.REPEAT,d===0?this.processFill(l):this.processLine(l);const y=this.points.length/2-g;y!==0&&(i&&!this._compareStyles(s,p)&&(i.end(f,g),i=null),i||(i=ug.pop()||new qw,i.begin(p,f,g),this.batches.push(i),s=p),this.addUvs(this.points,t,p.texture,g,y,p.matrix))}}const n=this.indices.length,o=this.points.length/2;if(i&&i.end(n,o),this.batches.length===0){this.batchable=!0;return}const a=o>65535;this.indicesUint16&&this.indices.length===this.indicesUint16.length&&a===this.indicesUint16.BYTES_PER_ELEMENT>2?this.indicesUint16.set(this.indices):this.indicesUint16=a?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 i=this.graphicsData[t],s=i.fillStyle,n=i.lineStyle;if(s&&!s.texture.baseTexture.valid||n&&!n.texture.baseTexture.valid)return!1}return!0}packBatches(){this.batchDirty++,this.uvsFloat32=new Float32Array(this.uvs);const t=this.batches;for(let e=0,i=t.length;e<i;e++){const s=t[e];for(let n=0;n<s.size;n++){const o=s.start+n;this.indicesUint16[o]=this.indicesUint16[o]-s.attribStart}}}isBatchable(){if(this.points.length>65535*2)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<xb.BATCHABLE_SIZE*2}buildDrawCalls(){let t=++ft._globalBatch;for(let c=0;c<this.drawCalls.length;c++)this.drawCalls[c].texArray.clear(),Xa.push(this.drawCalls[c]);this.drawCalls.length=0;const e=this.colors,i=this.textureIds;let s=Xa.pop();s||(s=new uu,s.texArray=new gu),s.texArray.count=0,s.start=0,s.size=0,s.type=yi.TRIANGLES;let n=0,o=null,a=0,h=!1,l=yi.TRIANGLES,u=0;this.drawCalls.push(s);for(let c=0;c<this.batches.length;c++){const d=this.batches[c],p=8,m=d.style,f=m.texture.baseTexture;h!==!!m.native&&(h=!!m.native,l=h?yi.LINES:yi.TRIANGLES,o=null,n=p,t++),o!==f&&(o=f,f._batchEnabled!==t&&(n===p&&(t++,n=0,s.size>0&&(s=Xa.pop(),s||(s=new uu,s.texArray=new gu),this.drawCalls.push(s)),s.start=u,s.size=0,s.texArray.count=0,s.type=l),f.touched=1,f._batchEnabled=t,f._batchLocation=n,f.wrapMode=Hi.REPEAT,s.texArray.elements[s.texArray.count++]=f,n++)),s.size+=d.size,u+=d.size,a=f._batchLocation,this.addColors(e,m.color,m.alpha,d.attribSize,d.attribStart),this.addTextureIds(i,a,d.attribSize,d.attribStart)}ft._globalBatch=t,this.packAttributes()}packAttributes(){const t=this.points,e=this.uvs,i=this.colors,s=this.textureIds,n=new ArrayBuffer(t.length*3*4),o=new Float32Array(n),a=new Uint32Array(n);let h=0;for(let l=0;l<t.length/2;l++)o[h++]=t[l*2],o[h++]=t[l*2+1],o[h++]=e[l*2],o[h++]=e[l*2+1],a[h++]=i[l],o[h++]=s[l];this._buffer.update(n),this._indexBuffer.update(this.indicesUint16)}processFill(t){t.holes.length?og.triangulate(t,this):Wu[t.type].triangulate(t,this)}processLine(t){lg(t,this);for(let e=0;e<t.holes.length;e++)lg(t.holes[e],this)}processHoles(t){for(let e=0;e<t.length;e++){const i=t[e];Wu[i.type].build(i),i.matrix&&this.transformPoints(i.points,i.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 i=0;i<t.length/2;i++){const s=t[i*2],n=t[i*2+1];t[i*2]=e.a*s+e.c*n+e.tx,t[i*2+1]=e.b*s+e.d*n+e.ty}}addColors(t,e,i,s,n=0){const o=Lt.shared.setValue(e).toLittleEndianNumber(),a=Lt.shared.setValue(o).toPremultiplied(i);t.length=Math.max(t.length,n+s);for(let h=0;h<s;h++)t[n+h]=a}addTextureIds(t,e,i,s=0){t.length=Math.max(t.length,s+i);for(let n=0;n<i;n++)t[s+n]=e}addUvs(t,e,i,s,n,o=null){let a=0;const h=e.length,l=i.frame;for(;a<n;){let c=t[(s+a)*2],d=t[(s+a)*2+1];if(o){const p=o.a*c+o.c*d+o.tx;d=o.b*c+o.d*d+o.ty,c=p}a++,e.push(c/l.width,d/l.height)}const u=i.baseTexture;(l.width<u.width||l.height<u.height)&&this.adjustUvs(e,i,h,n)}adjustUvs(t,e,i,s){const n=e.baseTexture,o=1e-6,a=i+s*2,h=e.frame,l=h.width/n.width,u=h.height/n.height;let c=h.x/h.width,d=h.y/h.height,p=Math.floor(t[i]+o),m=Math.floor(t[i+1]+o);for(let f=i+2;f<a;f+=2)p=Math.min(p,Math.floor(t[f]+o)),m=Math.min(m,Math.floor(t[f+1]+o));c-=p,d-=m;for(let f=i;f<a;f+=2)t[f]=(t[f]+c)*l,t[f+1]=(t[f+1]+d)*u}};cg.BATCHABLE_SIZE=100;let iS=cg;class Va{constructor(){this.color=16777215,this.alpha=1,this.texture=it.WHITE,this.matrix=null,this.visible=!1,this.reset()}clone(){const t=new Va;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=it.WHITE,this.matrix=null,this.visible=!1}destroy(){this.texture=null,this.matrix=null}}class Uu extends Va{constructor(){super(...arguments),this.width=0,this.alignment=.5,this.native=!1,this.cap=vr.BUTT,this.join=Xe.MITER,this.miterLimit=10}clone(){const t=new Uu;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,this.cap=vr.BUTT,this.join=Xe.MITER,this.miterLimit=10}}const Xu={},Zu=class hl extends Xt{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 Va,this._lineStyle=new Uu,this._matrix=null,this._holeMode=!1,this.state=Ei.for2d(),this._geometry=t||new iS,this._geometry.refCount++,this._transformID=-1,this._tintColor=new Lt(16777215),this.blendMode=ut.NORMAL}get geometry(){return this._geometry}clone(){return this.finishPoly(),new hl(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,i,s=.5,n=!1){return typeof t=="number"&&(t={width:t,color:e,alpha:i,alignment:s,native:n}),this.lineTextureStyle(t)}lineTextureStyle(t){const e={width:0,texture:it.WHITE,color:t!=null&&t.texture?16777215:0,matrix:null,alignment:.5,native:!1,cap:vr.BUTT,join:Xe.MITER,miterLimit:10};t=Object.assign(e,t),this.normalizeColor(t),this.currentPath&&this.startPoly();const i=t.width>0&&t.alpha>0;return i?(t.matrix&&(t.matrix=t.matrix.clone(),t.matrix.invert()),Object.assign(this._lineStyle,{visible:i},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 Vr,this.currentPath.closeStroke=!1,this.currentPath.points.push(t[e-2],t[e-1]))}else this.currentPath=new Vr,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 i=this.currentPath.points,s=i[i.length-2],n=i[i.length-1];return(s!==t||n!==e)&&i.push(t,e),this}_initCurve(t=0,e=0){this.currentPath?this.currentPath.points.length===0&&(this.currentPath.points=[t,e]):this.moveTo(t,e)}quadraticCurveTo(t,e,i,s){this._initCurve();const n=this.currentPath.points;return n.length===0&&this.moveTo(0,0),Bu.curveTo(t,e,i,s,n),this}bezierCurveTo(t,e,i,s,n,o){return this._initCurve(),Ou.curveTo(t,e,i,s,n,o,this.currentPath.points),this}arcTo(t,e,i,s,n){this._initCurve(t,e);const o=this.currentPath.points,a=ag.curveTo(t,e,i,s,n,o);if(a){const{cx:h,cy:l,radius:u,startAngle:c,endAngle:d,anticlockwise:p}=a;this.arc(h,l,u,c,d,p)}return this}arc(t,e,i,s,n,o=!1){if(s===n)return this;if(!o&&n<=s?n+=ca:o&&s<=n&&(s+=ca),n-s===0)return this;const a=t+Math.cos(s)*i,h=e+Math.sin(s)*i,l=this._geometry.closePointEps;let u=this.currentPath?this.currentPath.points:null;if(u){const c=Math.abs(u[u.length-2]-a),d=Math.abs(u[u.length-1]-h);c<l&&d<l||u.push(a,h)}else this.moveTo(a,h),u=this.currentPath.points;return ag.arc(a,h,t,e,i,s,n,o,u),this}beginFill(t=0,e){return this.beginTextureFill({texture:it.WHITE,color:t,alpha:e})}normalizeColor(t){const e=Lt.shared.setValue(t.color??0);t.color=e.toNumber(),t.alpha??(t.alpha=e.alpha)}beginTextureFill(t){const e={texture:it.WHITE,color:16777215,matrix:null};t=Object.assign(e,t),this.normalizeColor(t),this.currentPath&&this.startPoly();const i=t.alpha>0;return i?(t.matrix&&(t.matrix=t.matrix.clone(),t.matrix.invert()),Object.assign(this._fillStyle,{visible:i},t)):this._fillStyle.reset(),this}endFill(){return this.finishPoly(),this._fillStyle.reset(),this}drawRect(t,e,i,s){return this.drawShape(new ct(t,e,i,s))}drawRoundedRect(t,e,i,s,n){return this.drawShape(new ma(t,e,i,s,n))}drawCircle(t,e,i){return this.drawShape(new pa(t,e,i))}drawEllipse(t,e,i,s){return this.drawShape(new fa(t,e,i,s))}drawPolygon(...t){let e,i=!0;const s=t[0];s.points?(i=s.closeStroke,e=s.points):Array.isArray(t[0])?e=t[0]:e=t;const n=new Vr(e);return n.closeStroke=i,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 t.length===1&&t[0].shape.type===ae.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,i=t.batches.length;this.batchTint=-1,this._transformID=-1,this.batchDirty=t.batchDirty,this.batches.length=i,this.vertexData=new Float32Array(t.points);for(let s=0;s<i;s++){const n=t.batches[s],o=n.style.color,a=new Float32Array(this.vertexData.buffer,n.attribStart*4*2,n.attribSize*2),h=new Float32Array(t.uvsFloat32.buffer,n.attribStart*4*2,n.attribSize*2),l=new Uint16Array(t.indicesUint16.buffer,n.start*2,n.size),u={vertexData:a,blendMode:e,indices:l,uvs:h,_batchRGB:Lt.shared.setValue(o).toRgbArray(),_tintRGB:o,_texture:n.style.texture,alpha:n.style.alpha,worldAlpha:1};this.batches[s]=u}}_renderBatched(t){if(this.batches.length){t.batch.setObjectRenderer(t.plugins[this.pluginName]),this.calculateVertices(),this.calculateTints();for(let e=0,i=this.batches.length;e<i;e++){const s=this.batches[e];s.worldAlpha=this.worldAlpha*s.alpha,t.plugins[this.pluginName].render(s)}}}_renderDirect(t){const e=this._resolveDirectShader(t),i=this._geometry,s=this.worldAlpha,n=e.uniforms,o=i.drawCalls;n.translationMatrix=this.transform.worldTransform,Lt.shared.setValue(this._tintColor).premultiply(s).toArray(n.tint),t.shader.bind(e),t.geometry.bind(i,e),t.state.set(this.state);for(let a=0,h=o.length;a<h;a++)this._renderDrawCallDirect(t,i.drawCalls[a])}_renderDrawCallDirect(t,e){const{texArray:i,type:s,size:n,start:o}=e,a=i.count;for(let h=0;h<a;h++)t.texture.bind(i.elements[h],h);t.geometry.draw(s,n,o)}_resolveDirectShader(t){let e=this.shader;const i=this.pluginName;if(!e){if(!Xu[i]){const{maxTextures:s}=t.plugins[i],n=new Int32Array(s);for(let h=0;h<s;h++)n[h]=h;const o={tint:new Float32Array([1,1,1,1]),translationMatrix:new Gt,default:ii.from({uSamplers:n},!0)},a=t.plugins[i]._shader.program;Xu[i]=new Ci(a,o)}e=Xu[i]}return e}_calculateBounds(){this.finishPoly();const t=this._geometry;if(!t.graphicsData.length)return;const{minX:e,minY:i,maxX:s,maxY:n}=t.bounds;this._bounds.addFrame(this.transform,e,i,s,n)}containsPoint(t){return this.worldTransform.applyInverse(t,hl._TEMP_POINT),this._geometry.containsPoint(hl._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=Lt.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,i=e.a,s=e.b,n=e.c,o=e.d,a=e.tx,h=e.ty,l=this._geometry.points,u=this.vertexData;let c=0;for(let d=0;d<l.length;d+=2){const p=l[d],m=l[d+1];u[c++]=i*p+n*m+a,u[c++]=o*m+s*p+h}}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--,this._geometry.refCount===0&&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)}};Zu.curves=Ys,Zu._TEMP_POINT=new lt;let Qn=Zu;class rS{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 Vu=new lt,dg=new Vr,pg=class _b extends Xt{constructor(t,e,i,s=yi.TRIANGLES){super(),this.geometry=t,this.shader=e,this.state=i||Ei.for2d(),this.drawMode=s,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=$.ROUND_PIXELS,this.batchUvs=null}get geometry(){return this._geometry}set geometry(t){this._geometry!==t&&(this._geometry&&(this._geometry.refCount--,this._geometry.refCount===0&&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===yi.TRIANGLES&&e.length<_b.BATCHABLE_SIZE*2?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,i=this.shader;i.uvMatrix&&(i.uvMatrix.update(),this.calculateUvs()),this.calculateVertices(),this.indices=e.indexBuffer.data,this._tintRGB=i._tintRGB,this._texture=i.texture;const s=this.material.pluginName;t.batch.setObjectRenderer(t.plugins[s]),t.plugins[s].render(this)}calculateVertices(){const t=this.geometry.buffers[0],e=t.data,i=t._updateID;if(i===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 s=this.transform.worldTransform,n=s.a,o=s.b,a=s.c,h=s.d,l=s.tx,u=s.ty,c=this.vertexData;for(let d=0;d<c.length/2;d++){const p=e[d*2],m=e[d*2+1];c[d*2]=n*p+a*m+l,c[d*2+1]=o*p+h*m+u}if(this._roundPixels){const d=$.RESOLUTION;for(let p=0;p<c.length;++p)c[p]=Math.round(c[p]*d)/d}this.vertexDirty=i}calculateUvs(){const t=this.geometry.buffers[1],e=this.shader;e.uvMatrix.isSimple?this.uvs=t.data:(this.batchUvs||(this.batchUvs=new rS(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,Vu);const e=this.geometry.getBuffer("aVertexPosition").data,i=dg.points,s=this.geometry.getIndex().data,n=s.length,o=this.drawMode===4?3:1;for(let a=0;a+2<n;a+=o){const h=s[a]*2,l=s[a+1]*2,u=s[a+2]*2;if(i[0]=e[h],i[1]=e[h+1],i[2]=e[l],i[3]=e[l+1],i[4]=e[u],i[5]=e[u+1],dg.contains(Vu.x,Vu.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}};pg.BATCHABLE_SIZE=100;let Hu=pg;class fg extends yr{constructor(t,e,i){super();const s=new Ht(t),n=new Ht(e,!0),o=new Ht(i,!0,!0);this.addAttribute("aVertexPosition",s,2,!1,nt.FLOAT).addAttribute("aTextureCoord",n,2,!1,nt.FLOAT).addIndex(o),this._updateId=-1}get vertexDirtyId(){return this.buffers[0]._updateID}}var sS=`varying vec2 vTextureCoord;
|
|
922
|
+
};`};let Nu;class iw{constructor(){this._initialized=!1,this._createdWorkers=0,this.workerPool=[],this.queue=[],this.resolveHash={}}isImageBitmapSupported(){return this._isImageBitmapSupported!==void 0?this._isImageBitmapSupported:(this._isImageBitmapSupported=new Promise(t=>{const e=URL.createObjectURL(new Blob([tw.code],{type:"application/javascript"})),i=new Worker(e);i.addEventListener("message",s=>{i.terminate(),URL.revokeObjectURL(e),t(s.data)})}),this._isImageBitmapSupported)}loadImageBitmap(t){return this._run("loadImageBitmap",[t])}async _initWorkers(){this._initialized||(this._initialized=!0)}getWorker(){Gu===void 0&&(Gu=navigator.hardwareConcurrency||4);let t=this.workerPool.pop();return!t&&this._createdWorkers<Gu&&(Nu||(Nu=URL.createObjectURL(new Blob([ew.code],{type:"application/javascript"}))),this._createdWorkers++,t=new Worker(Nu),t.addEventListener("message",e=>{this.complete(e.data),this.returnWorker(e.target),this.next()})),t}returnWorker(t){this.workerPool.push(t)}complete(t){t.error!==void 0?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 i=new Promise((s,n)=>{this.queue.push({id:t,arguments:e,resolve:s,reject:n})});return this.next(),i}next(){if(!this.queue.length)return;const t=this.getWorker();if(!t)return;const e=this.queue.pop(),i=e.id;this.resolveHash[qm]={resolve:e.resolve,reject:e.reject},t.postMessage({data:e.arguments,uuid:qm++,id:i})}}const tg=new iw;function Qn(r,t,e){r.resource.internal=!0;const i=new rt(r),s=()=>{delete t.promiseCache[e],rs.has(e)&&rs.remove(e)};return i.baseTexture.once("destroyed",()=>{e in t.promiseCache&&(console.warn("[Assets] A BaseTexture managed by Assets was destroyed instead of unloaded! Use Assets.unload() instead of destroying the BaseTexture."),s())}),i.once("destroyed",()=>{r.destroyed||(console.warn("[Assets] A Texture managed by Assets was destroyed instead of unloaded! Use Assets.unload() instead of destroying the Texture."),s())}),i}const rw=[".jpeg",".jpg",".png",".webp",".avif"],sw=["image/jpeg","image/png","image/webp","image/avif"];async function nw(r){const t=await Q.ADAPTER.fetch(r);if(!t.ok)throw new Error(`[loadImageBitmap] Failed to fetch ${r}: ${t.status} ${t.statusText}`);const e=await t.blob();return await createImageBitmap(e)}const Fa={name:"loadTextures",extension:{type:J.LoadParser,priority:oi.High},config:{preferWorkers:!0,preferCreateImageBitmap:!0,crossOrigin:"anonymous"},test(r){return Ks(r,sw)||Tr(r,rw)},async load(r,t,e){var a;const i=globalThis.createImageBitmap&&this.config.preferCreateImageBitmap;let s;i?this.config.preferWorkers&&await tg.isImageBitmapSupported()?s=await tg.loadImageBitmap(r):s=await nw(r):s=await new Promise((h,l)=>{const u=new Image;u.crossOrigin=this.config.crossOrigin,u.src=r,u.complete?h(u):(u.onload=()=>h(u),u.onerror=c=>l(c))});const n={...t.data};n.resolution??(n.resolution=Qi(r)),i&&((a=n.resourceOptions)==null?void 0:a.ownsImageBitmap)===void 0&&(n.resourceOptions={...n.resourceOptions},n.resourceOptions.ownsImageBitmap=!0);const o=new ft(s,n);return o.resource.src=r,Qn(o,e,r)},unload(r){r.destroy(!0)}};et.add(Fa);const ow=".svg",aw="image/svg+xml",hw={extension:{type:J.LoadParser,priority:oi.High},name:"loadSVG",test(r){return Ks(r,aw)||Tr(r,ow)},async testParse(r){return Cu.test(r)},async parse(r,t,e){var n;const i=new Cu(r,(n=t==null?void 0:t.data)==null?void 0:n.resourceOptions);await i.load();const s=new ft(i,{resolution:Qi(r),...t==null?void 0:t.data});return s.resource.src=t.src,Qn(s,e,t.src)},async load(r,t){return(await Q.ADAPTER.fetch(r)).text()},unload:Fa.unload};et.add(hw);const lw=[".mp4",".m4v",".webm",".ogv"],uw=["video/mp4","video/webm","video/ogg"],cw={name:"loadVideo",extension:{type:J.LoadParser,priority:oi.High},config:{defaultAutoPlay:!0},test(r){return Ks(r,uw)||Tr(r,lw)},async load(r,t,e){var o;let i;const s=await(await Q.ADAPTER.fetch(r)).blob(),n=URL.createObjectURL(s);try{const a={autoPlay:this.config.defaultAutoPlay,...(o=t==null?void 0:t.data)==null?void 0:o.resourceOptions},h=new Wm(n,a);await h.load();const l=new ft(h,{alphaMode:await y1(),resolution:Qi(r),...t==null?void 0:t.data});l.resource.src=r,i=Qn(l,e,r),i.baseTexture.once("destroyed",()=>{URL.revokeObjectURL(n)})}catch(a){throw URL.revokeObjectURL(n),a}return i},unload(r){r.destroy(!0)}};et.add(cw);class dw{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,this._extractAssetIdFromBundle("foo",this._createBundleAssetId("foo","bar"))!=="bar")throw new Error("[Resolver] GenerateBundleAssetId are not working correctly")}prefer(...t){t.forEach(e=>{this._preferredOrder.push(e),e.priority||(e.priority=Object.keys(e.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(typeof t=="string")this._defaultSearchParams=t;else{const e=t;this._defaultSearchParams=Object.keys(e).map(i=>`${encodeURIComponent(i)}=${encodeURIComponent(e[i])}`).join("&")}}getAlias(t){const{alias:e,name:i,src:s,srcs:n}=t;return ni(e||i||s||n,o=>typeof o=="string"?o:Array.isArray(o)?o.map(a=>(a==null?void 0:a.src)??(a==null?void 0:a.srcs)??a):o!=null&&o.src||o!=null&&o.srcs?o.src??o.srcs:o,!0)}addManifest(t){this._manifest&&console.warn("[Resolver] Manifest already exists, this will be overwritten"),this._manifest=t,t.bundles.forEach(e=>{this.addBundle(e.name,e.assets)})}addBundle(t,e){const i=[];Array.isArray(e)?e.forEach(s=>{const n=s.src??s.srcs,o=s.alias??s.name;let a;if(typeof o=="string"){const h=this._createBundleAssetId(t,o);i.push(h),a=[o,h]}else{const h=o.map(l=>this._createBundleAssetId(t,l));i.push(...h),a=[...o,...h]}this.add({...s,alias:a,src:n})}):Object.keys(e).forEach(s=>{const n=[s,this._createBundleAssetId(t,s)];if(typeof e[s]=="string")this.add({alias:n,src:e[s]});else if(Array.isArray(e[s]))this.add({alias:n,src:e[s]});else{const o=e[s],a=o.src??o.srcs;this.add({...o,alias:n,src:Array.isArray(a)?a:[a]})}i.push(...n)}),this._bundles[t]=i}add(t,e,i,s,n){const o=[];typeof t=="string"||Array.isArray(t)&&typeof t[0]=="string"?(vt("7.2.0",`Assets.add now uses an object instead of individual parameters.
|
|
923
|
+
Please use Assets.add({ alias, src, data, format, loadParser }) instead.`),o.push({alias:t,src:e,data:i,format:s,loadParser:n})):Array.isArray(t)?o.push(...t):o.push(t);let a;a=h=>{this.hasKey(h)&&console.warn(`[Resolver] already has key: ${h} overwriting`)},ni(o).forEach(h=>{const{src:l,srcs:u}=h;let{data:c,format:d,loadParser:p}=h;const m=ni(l||u).map(y=>typeof y=="string"?DT(y):Array.isArray(y)?y:[y]),f=this.getAlias(h);Array.isArray(f)?f.forEach(a):a(f);const g=[];m.forEach(y=>{y.forEach(_=>{let b={};if(typeof _!="object"){b.src=_;for(let v=0;v<this._parsers.length;v++){const S=this._parsers[v];if(S.test(_)){b=S.parse(_);break}}}else c=_.data??c,d=_.format??d,p=_.loadParser??p,b={...b,..._};if(!f)throw new Error(`[Resolver] alias is undefined for this asset: ${b.src}`);b=this.buildResolvedAsset(b,{aliases:f,data:c,format:d,loadParser:p}),g.push(b)})}),f.forEach(y=>{this._assetMap[y]=g})})}resolveBundle(t){const e=Na(t);t=ni(t);const i={};return t.forEach(s=>{const n=this._bundles[s];if(n){const o=this.resolve(n),a={};for(const h in o){const l=o[h];a[this._extractAssetIdFromBundle(s,h)]=l}i[s]=a}}),e?i[t[0]]:i}resolveUrl(t){const e=this.resolve(t);if(typeof t!="string"){const i={};for(const s in e)i[s]=e[s].src;return i}return e.src}resolve(t){const e=Na(t);t=ni(t);const i={};return t.forEach(s=>{if(!this._resolverHash[s])if(this._assetMap[s]){let n=this._assetMap[s];const o=n[0],a=this._getPreferredOrder(n);a==null||a.priority.forEach(h=>{a.params[h].forEach(l=>{const u=n.filter(c=>c[h]?c[h]===l:!1);u.length&&(n=u)})}),this._resolverHash[s]=n[0]??o}else this._resolverHash[s]=this.buildResolvedAsset({alias:[s],src:s},{});i[s]=this._resolverHash[s]}),e?i[t[0]]:i}hasKey(t){return!!this._assetMap[t]}hasBundle(t){return!!this._bundles[t]}_getPreferredOrder(t){for(let e=0;e<t.length;e++){const i=t[0],s=this._preferredOrder.find(n=>n.params.format.includes(i.format));if(s)return s}return this._preferredOrder[0]}_appendDefaultSearchParams(t){if(!this._defaultSearchParams)return t;const e=/\?/.test(t)?"&":"?";return`${t}${e}${this._defaultSearchParams}`}buildResolvedAsset(t,e){const{aliases:i,data:s,loadParser:n,format:o}=e;return(this._basePath||this._rootPath)&&(t.src=Jt.toAbsolute(t.src,this._basePath,this._rootPath)),t.alias=i??t.alias??[t.src],t.src=this._appendDefaultSearchParams(t.src),t.data={...s||{},...t.data},t.loadParser=n??t.loadParser,t.format=o??Jt.extname(t.src).slice(1),t.srcs=t.src,t.name=t.alias,t}}class pw{constructor(){this._detections=[],this._initialized=!1,this.resolver=new dw,this.loader=new OT,this.cache=rs,this._backgroundLoader=new FT(this.loader),this._backgroundLoader.active=!0,this.reset()}async init(t={}){var n,o;if(this._initialized){console.warn("[Assets]AssetManager already initialized, did you load before calling this Asset.init()?");return}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 a=t.manifest;typeof a=="string"&&(a=await this.load(a)),this.resolver.addManifest(a)}const e=((n=t.texturePreference)==null?void 0:n.resolution)??1,i=typeof e=="number"?[e]:e,s=await this._detectFormats({preferredFormats:(o=t.texturePreference)==null?void 0:o.format,skipDetections:t.skipDetections,detections:this._detections});this.resolver.prefer({params:{format:s,resolution:i}}),t.preferences&&this.setPreferences(t.preferences)}add(t,e,i,s,n){this.resolver.add(t,e,i,s,n)}async load(t,e){this._initialized||await this.init();const i=Na(t),s=ni(t).map(a=>{if(typeof a!="string"){const h=this.resolver.getAlias(a);return h.some(l=>!this.resolver.hasKey(l))&&this.add(a),Array.isArray(h)?h[0]:h}return this.resolver.hasKey(a)||this.add({alias:a,src:a}),a}),n=this.resolver.resolve(s),o=await this._mapLoadToResolve(n,e);return i?o[s[0]]:o}addBundle(t,e){this.resolver.addBundle(t,e)}async loadBundle(t,e){this._initialized||await this.init();let i=!1;typeof t=="string"&&(i=!0,t=[t]);const s=this.resolver.resolveBundle(t),n={},o=Object.keys(s);let a=0,h=0;const l=()=>{e==null||e(++a/h)},u=o.map(c=>{const d=s[c];return h+=Object.keys(d).length,this._mapLoadToResolve(d,l).then(p=>{n[c]=p})});return await Promise.all(u),i?n[t[0]]:n}async backgroundLoad(t){this._initialized||await this.init(),typeof t=="string"&&(t=[t]);const e=this.resolver.resolve(t);this._backgroundLoader.add(Object.values(e))}async backgroundLoadBundle(t){this._initialized||await this.init(),typeof t=="string"&&(t=[t]);const e=this.resolver.resolveBundle(t);Object.values(e).forEach(i=>{this._backgroundLoader.add(Object.values(i))})}reset(){this.resolver.reset(),this.loader.reset(),this.cache.reset(),this._initialized=!1}get(t){if(typeof t=="string")return rs.get(t);const e={};for(let i=0;i<t.length;i++)e[i]=rs.get(t[i]);return e}async _mapLoadToResolve(t,e){const i=Object.values(t),s=Object.keys(t);this._backgroundLoader.active=!1;const n=await this.loader.load(i,e);this._backgroundLoader.active=!0;const o={};return i.forEach((a,h)=>{const l=n[a.src],u=[a.src];a.alias&&u.push(...a.alias),o[s[h]]=l,rs.set(u,l)}),o}async unload(t){this._initialized||await this.init();const e=ni(t).map(s=>typeof s!="string"?s.src:s),i=this.resolver.resolve(e);await this._unloadFromResolved(i)}async unloadBundle(t){this._initialized||await this.init(),t=ni(t);const e=this.resolver.resolveBundle(t),i=Object.keys(e).map(s=>this._unloadFromResolved(e[s]));await Promise.all(i)}async _unloadFromResolved(t){const e=Object.values(t);e.forEach(i=>{rs.remove(i.src)}),await this.loader.unload(e)}async _detectFormats(t){let e=[];t.preferredFormats&&(e=Array.isArray(t.preferredFormats)?t.preferredFormats:[t.preferredFormats]);for(const i of t.detections)t.skipDetections||await i.test()?e=await i.add(e):t.skipDetections||(e=await i.remove(e));return e=e.filter((i,s)=>e.indexOf(i)===s),e}get detections(){return this._detections}get preferWorkers(){return Fa.config.preferWorkers}set preferWorkers(t){vt("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(i=>i in t).forEach(i=>{e.config[i]=t[i]})})}}const Da=new pw;et.handleByList(J.LoadParser,Da.loader.parsers).handleByList(J.ResolveParser,Da.resolver.parsers).handleByList(J.CacheParser,Da.cache.parsers).handleByList(J.DetectionParser,Da.detections);const fw={extension:J.CacheParser,test:r=>Array.isArray(r)&&r.every(t=>t instanceof rt),getCacheableAssets:(r,t)=>{const e={};return r.forEach(i=>{t.forEach((s,n)=>{e[i+(n===0?"":n+1)]=s})}),e}};et.add(fw);async function eg(r){if("Image"in globalThis)return new Promise(t=>{const e=new Image;e.onload=()=>{t(!0)},e.onerror=()=>{t(!1)},e.src=r});if("createImageBitmap"in globalThis&&"fetch"in globalThis){try{const t=await(await fetch(r)).blob();await createImageBitmap(t)}catch{return!1}return!0}return!1}const mw={extension:{type:J.DetectionParser,priority:1},test:async()=>eg("data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAAB0AAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAIAAAACAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQ0MAAAAABNjb2xybmNseAACAAIAAYAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAACVtZGF0EgAKCBgANogQEAwgMg8f8D///8WfhwB8+ErK42A="),add:async r=>[...r,"avif"],remove:async r=>r.filter(t=>t!=="avif")};et.add(mw);const gw={extension:{type:J.DetectionParser,priority:0},test:async()=>eg("data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAAAAAAfQ//73v/+BiOh/AAA="),add:async r=>[...r,"webp"],remove:async r=>r.filter(t=>t!=="webp")};et.add(gw);const ig=["png","jpg","jpeg"],yw={extension:{type:J.DetectionParser,priority:-1},test:()=>Promise.resolve(!0),add:async r=>[...r,...ig],remove:async r=>r.filter(t=>!ig.includes(t))};et.add(yw);const bw="WorkerGlobalScope"in globalThis&&globalThis instanceof globalThis.WorkerGlobalScope;function Fu(r){return bw?!1:document.createElement("video").canPlayType(r)!==""}const xw={extension:{type:J.DetectionParser,priority:0},test:async()=>Fu("video/webm"),add:async r=>[...r,"webm"],remove:async r=>r.filter(t=>t!=="webm")};et.add(xw);const _w={extension:{type:J.DetectionParser,priority:0},test:async()=>Fu("video/mp4"),add:async r=>[...r,"mp4","m4v"],remove:async r=>r.filter(t=>t!=="mp4"&&t!=="m4v")};et.add(_w);const vw={extension:{type:J.DetectionParser,priority:0},test:async()=>Fu("video/ogg"),add:async r=>[...r,"ogv"],remove:async r=>r.filter(t=>t!=="ogv")};et.add(vw);const Tw={extension:J.ResolveParser,test:Fa.test,parse:r=>{var t;return{resolution:parseFloat(((t=Q.RETINA_PREFIX.exec(r))==null?void 0:t[1])??"1"),format:Jt.extname(r).slice(1),src:r}}};et.add(Tw);var Ae=(r=>(r[r.COMPRESSED_RGB_S3TC_DXT1_EXT=33776]="COMPRESSED_RGB_S3TC_DXT1_EXT",r[r.COMPRESSED_RGBA_S3TC_DXT1_EXT=33777]="COMPRESSED_RGBA_S3TC_DXT1_EXT",r[r.COMPRESSED_RGBA_S3TC_DXT3_EXT=33778]="COMPRESSED_RGBA_S3TC_DXT3_EXT",r[r.COMPRESSED_RGBA_S3TC_DXT5_EXT=33779]="COMPRESSED_RGBA_S3TC_DXT5_EXT",r[r.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT=35917]="COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT",r[r.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT=35918]="COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT",r[r.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT=35919]="COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT",r[r.COMPRESSED_SRGB_S3TC_DXT1_EXT=35916]="COMPRESSED_SRGB_S3TC_DXT1_EXT",r[r.COMPRESSED_R11_EAC=37488]="COMPRESSED_R11_EAC",r[r.COMPRESSED_SIGNED_R11_EAC=37489]="COMPRESSED_SIGNED_R11_EAC",r[r.COMPRESSED_RG11_EAC=37490]="COMPRESSED_RG11_EAC",r[r.COMPRESSED_SIGNED_RG11_EAC=37491]="COMPRESSED_SIGNED_RG11_EAC",r[r.COMPRESSED_RGB8_ETC2=37492]="COMPRESSED_RGB8_ETC2",r[r.COMPRESSED_RGBA8_ETC2_EAC=37496]="COMPRESSED_RGBA8_ETC2_EAC",r[r.COMPRESSED_SRGB8_ETC2=37493]="COMPRESSED_SRGB8_ETC2",r[r.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC=37497]="COMPRESSED_SRGB8_ALPHA8_ETC2_EAC",r[r.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2=37494]="COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2",r[r.COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2=37495]="COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2",r[r.COMPRESSED_RGB_PVRTC_4BPPV1_IMG=35840]="COMPRESSED_RGB_PVRTC_4BPPV1_IMG",r[r.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG=35842]="COMPRESSED_RGBA_PVRTC_4BPPV1_IMG",r[r.COMPRESSED_RGB_PVRTC_2BPPV1_IMG=35841]="COMPRESSED_RGB_PVRTC_2BPPV1_IMG",r[r.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG=35843]="COMPRESSED_RGBA_PVRTC_2BPPV1_IMG",r[r.COMPRESSED_RGB_ETC1_WEBGL=36196]="COMPRESSED_RGB_ETC1_WEBGL",r[r.COMPRESSED_RGB_ATC_WEBGL=35986]="COMPRESSED_RGB_ATC_WEBGL",r[r.COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL=35986]="COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL",r[r.COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL=34798]="COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL",r[r.COMPRESSED_RGBA_ASTC_4x4_KHR=37808]="COMPRESSED_RGBA_ASTC_4x4_KHR",r))(Ae||{});const ka={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 er,Ys;function rg(){Ys={s3tc:er.getExtension("WEBGL_compressed_texture_s3tc"),s3tc_sRGB:er.getExtension("WEBGL_compressed_texture_s3tc_srgb"),etc:er.getExtension("WEBGL_compressed_texture_etc"),etc1:er.getExtension("WEBGL_compressed_texture_etc1"),pvrtc:er.getExtension("WEBGL_compressed_texture_pvrtc")||er.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc"),atc:er.getExtension("WEBGL_compressed_texture_atc"),astc:er.getExtension("WEBGL_compressed_texture_astc")}}const ww={extension:{type:J.DetectionParser,priority:2},test:async()=>{const r=Q.ADAPTER.createCanvas().getContext("webgl");return r?(er=r,!0):(console.warn("WebGL not available for compressed textures."),!1)},add:async r=>{Ys||rg();const t=[];for(const e in Ys)Ys[e]&&t.push(e);return[...t,...r]},remove:async r=>(Ys||rg(),r.filter(t=>!(t in Ys)))};et.add(ww);class Sw extends ua{constructor(t,e={width:1,height:1,autoLoad:!0}){let i,s;typeof t=="string"?(i=t,s=new Uint8Array):(i=null,s=t),super(s,e),this.origin=i,this.buffer=s?new eu(s):null,this._load=null,this.loaded=!1,this.origin!==null&&e.autoLoad!==!1&&this.load(),this.origin===null&&this.buffer&&(this._load=Promise.resolve(this),this.loaded=!0,this.onBlobLoaded(this.buffer.rawBinaryData))}onBlobLoaded(t){}load(){return this._load?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 eu(t),this.loaded=!0,this.onBlobLoaded(t),this.update(),this)),this._load)}}class ss extends Sw{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=ss._formatToExtension(this.format),(e.levelBuffers||this.buffer)&&(this._levelBuffers=e.levelBuffers||ss._createLevelBuffers(t instanceof Uint8Array?t:this.buffer.uint8View,this.format,this.levels,4,4,this.width,this.height))}upload(t,e,i){const s=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;s.pixelStorei(s.UNPACK_ALIGNMENT,4);for(let n=0,o=this.levels;n<o;n++){const{levelID:a,levelWidth:h,levelHeight:l,levelBuffer:u}=this._levelBuffers[n];s.compressedTexImage2D(s.TEXTURE_2D,a,this.format,h,l,0,u)}return!0}onBlobLoaded(){this._levelBuffers=ss._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,i,s,n,o,a){const h=new Array(i);let l=t.byteOffset,u=o,c=a,d=u+s-1&~(s-1),p=c+n-1&~(n-1),m=d*p*ka[e];for(let f=0;f<i;f++)h[f]={levelID:f,levelWidth:i>1?u:d,levelHeight:i>1?c:p,levelBuffer:new Uint8Array(t.buffer,l,m)},l+=m,u=u>>1||1,c=c>>1||1,d=u+s-1&~(s-1),p=c+n-1&~(n-1),m=d*p*ka[e];return h}}const Du=4,Oa=124,Ew=32,sg=20,Cw=542327876,Ba={SIZE:1,FLAGS:2,HEIGHT:3,WIDTH:4,MIPMAP_COUNT:7,PIXEL_FORMAT:19},Iw={SIZE:0,FLAGS:1,FOURCC:2,RGB_BITCOUNT:3,R_BIT_MASK:4,G_BIT_MASK:5,B_BIT_MASK:6,A_BIT_MASK:7},Wa={DXGI_FORMAT:0,RESOURCE_DIMENSION:1,MISC_FLAG:2,ARRAY_SIZE:3,MISC_FLAGS2:4},Aw=1,Mw=2,Rw=4,Pw=64,Lw=512,Gw=131072,Nw=827611204,Fw=861165636,Dw=894720068,kw=808540228,Ow=4,Bw={[Nw]:Ae.COMPRESSED_RGBA_S3TC_DXT1_EXT,[Fw]:Ae.COMPRESSED_RGBA_S3TC_DXT3_EXT,[Dw]:Ae.COMPRESSED_RGBA_S3TC_DXT5_EXT},Ww={70:Ae.COMPRESSED_RGBA_S3TC_DXT1_EXT,71:Ae.COMPRESSED_RGBA_S3TC_DXT1_EXT,73:Ae.COMPRESSED_RGBA_S3TC_DXT3_EXT,74:Ae.COMPRESSED_RGBA_S3TC_DXT3_EXT,76:Ae.COMPRESSED_RGBA_S3TC_DXT5_EXT,77:Ae.COMPRESSED_RGBA_S3TC_DXT5_EXT,72:Ae.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT,75:Ae.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT,78:Ae.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT};function Uw(r){const t=new Uint32Array(r);if(t[0]!==Cw)throw new Error("Invalid DDS file magic word");const e=new Uint32Array(r,0,Oa/Uint32Array.BYTES_PER_ELEMENT),i=e[Ba.HEIGHT],s=e[Ba.WIDTH],n=e[Ba.MIPMAP_COUNT],o=new Uint32Array(r,Ba.PIXEL_FORMAT*Uint32Array.BYTES_PER_ELEMENT,Ew/Uint32Array.BYTES_PER_ELEMENT),a=o[Aw];if(a&Rw){const h=o[Iw.FOURCC];if(h!==kw){const _=Bw[h],b=Du+Oa,v=new Uint8Array(r,b);return[new ss(v,{format:_,width:s,height:i,levels:n})]}const l=Du+Oa,u=new Uint32Array(t.buffer,l,sg/Uint32Array.BYTES_PER_ELEMENT),c=u[Wa.DXGI_FORMAT],d=u[Wa.RESOURCE_DIMENSION],p=u[Wa.MISC_FLAG],m=u[Wa.ARRAY_SIZE],f=Ww[c];if(f===void 0)throw new Error(`DDSParser cannot parse texture data with DXGI format ${c}`);if(p===Ow)throw new Error("DDSParser does not support cubemap textures");if(d===6)throw new Error("DDSParser does not supported 3D texture data");const g=new Array,y=Du+Oa+sg;if(m===1)g.push(new Uint8Array(r,y));else{const _=ka[f];let b=0,v=s,S=i;for(let A=0;A<n;A++){const I=Math.max(1,v+3&-4),P=Math.max(1,S+3&-4),W=I*P*_;b+=W,v=v>>>1,S=S>>>1}let E=y;for(let A=0;A<m;A++)g.push(new Uint8Array(r,E,b)),E+=b}return g.map(_=>new ss(_,{format:f,width:s,height:i,levels:n}))}throw a&Pw?new Error("DDSParser does not support uncompressed texture data."):a&Lw?new Error("DDSParser does not supported YUV uncompressed texture data."):a&Gw?new Error("DDSParser does not support single-channel (lumninance) texture data!"):a&Mw?new Error("DDSParser does not support single-channel (alpha) texture data!"):new Error("DDSParser failed to load a texture file due to an unknown reason!")}const ng=[171,75,84,88,32,49,49,187,13,10,26,10],Xw=67305985,ai={FILE_IDENTIFIER:0,ENDIANNESS:12,GL_TYPE:16,GL_TYPE_SIZE:20,GL_FORMAT:24,GL_INTERNAL_FORMAT:28,GL_BASE_INTERNAL_FORMAT:32,PIXEL_WIDTH:36,PIXEL_HEIGHT:40,PIXEL_DEPTH:44,NUMBER_OF_ARRAY_ELEMENTS:48,NUMBER_OF_FACES:52,NUMBER_OF_MIPMAP_LEVELS:56,BYTES_OF_KEY_VALUE_DATA:60},ku=64,og={[at.UNSIGNED_BYTE]:1,[at.UNSIGNED_SHORT]:2,[at.INT]:4,[at.UNSIGNED_INT]:4,[at.FLOAT]:4,[at.HALF_FLOAT]:8},Zw={[K.RGBA]:4,[K.RGB]:3,[K.RG]:2,[K.RED]:1,[K.LUMINANCE]:1,[K.LUMINANCE_ALPHA]:2,[K.ALPHA]:1},Vw={[at.UNSIGNED_SHORT_4_4_4_4]:2,[at.UNSIGNED_SHORT_5_5_5_1]:2,[at.UNSIGNED_SHORT_5_6_5]:2};function Hw(r,t,e=!1){const i=new DataView(t);if(!Kw(r,i))return null;const s=i.getUint32(ai.ENDIANNESS,!0)===Xw,n=i.getUint32(ai.GL_TYPE,s),o=i.getUint32(ai.GL_FORMAT,s),a=i.getUint32(ai.GL_INTERNAL_FORMAT,s),h=i.getUint32(ai.PIXEL_WIDTH,s),l=i.getUint32(ai.PIXEL_HEIGHT,s)||1,u=i.getUint32(ai.PIXEL_DEPTH,s)||1,c=i.getUint32(ai.NUMBER_OF_ARRAY_ELEMENTS,s)||1,d=i.getUint32(ai.NUMBER_OF_FACES,s),p=i.getUint32(ai.NUMBER_OF_MIPMAP_LEVELS,s),m=i.getUint32(ai.BYTES_OF_KEY_VALUE_DATA,s);if(l===0||u!==1)throw new Error("Only 2D textures are supported");if(d!==1)throw new Error("CubeTextures are not supported by KTXLoader yet!");if(c!==1)throw new Error("WebGL does not support array textures");const f=4,g=4,y=h+3&-4,_=l+3&-4,b=new Array(c);let v=h*l;n===0&&(v=y*_);let S;if(n!==0?og[n]?S=og[n]*Zw[o]:S=Vw[n]:S=ka[a],S===void 0)throw new Error("Unable to resolve the pixel format stored in the *.ktx file!");const E=e?zw(i,m,s):null;let A=v*S,I=h,P=l,W=y,G=_,N=ku+m;for(let C=0;C<p;C++){const F=i.getUint32(N,s);let X=N+4;for(let V=0;V<c;V++){let L=b[V];L||(L=b[V]=new Array(p)),L[C]={levelID:C,levelWidth:p>1||n!==0?I:W,levelHeight:p>1||n!==0?P:G,levelBuffer:new Uint8Array(t,X,A)},X+=A}N+=F+4,N=N%4!==0?N+4-N%4:N,I=I>>1||1,P=P>>1||1,W=I+f-1&~(f-1),G=P+g-1&~(g-1),A=W*G*S}return n!==0?{uncompressed:b.map(C=>{let F=C[0].levelBuffer,X=!1;return n===at.FLOAT?F=new Float32Array(C[0].levelBuffer.buffer,C[0].levelBuffer.byteOffset,C[0].levelBuffer.byteLength/4):n===at.UNSIGNED_INT?(X=!0,F=new Uint32Array(C[0].levelBuffer.buffer,C[0].levelBuffer.byteOffset,C[0].levelBuffer.byteLength/4)):n===at.INT&&(X=!0,F=new Int32Array(C[0].levelBuffer.buffer,C[0].levelBuffer.byteOffset,C[0].levelBuffer.byteLength/4)),{resource:new ua(F,{width:C[0].levelWidth,height:C[0].levelHeight}),type:n,format:X?Yw(o):o}}),kvData:E}:{compressed:b.map(C=>new ss(null,{format:a,width:h,height:l,levels:p,levelBuffers:C})),kvData:E}}function Kw(r,t){for(let e=0;e<ng.length;e++)if(t.getUint8(e)!==ng[e])return console.error(`${r} is not a valid *.ktx file!`),!1;return!0}function Yw(r){switch(r){case K.RGBA:return K.RGBA_INTEGER;case K.RGB:return K.RGB_INTEGER;case K.RG:return K.RG_INTEGER;case K.RED:return K.RED_INTEGER;default:return r}}function zw(r,t,e){const i=new Map;let s=0;for(;s<t;){const n=r.getUint32(ku+s,e),o=ku+s+4,a=3-(n+3)%4;if(n===0||n>t-s){console.error("KTXLoader: keyAndValueByteSize out of bounds");break}let h=0;for(;h<n&&r.getUint8(o+h)!==0;h++);if(h===-1){console.error("KTXLoader: Failed to find null byte terminating kvData key");break}const l=new TextDecoder().decode(new Uint8Array(r.buffer,o,h)),u=new DataView(r.buffer,o+h+1,n-h-1);i.set(l,u),s+=4+n+a}return i}const jw={extension:{type:J.LoadParser,priority:oi.High},name:"loadDDS",test(r){return Tr(r,".dds")},async load(r,t,e){const i=await(await Q.ADAPTER.fetch(r)).arrayBuffer(),s=Uw(i).map(n=>{const o=new ft(n,{mipmap:yi.OFF,alphaMode:xe.NO_PREMULTIPLIED_ALPHA,resolution:Qi(r),...t.data});return Qn(o,e,r)});return s.length===1?s[0]:s},unload(r){Array.isArray(r)?r.forEach(t=>t.destroy(!0)):r.destroy(!0)}};et.add(jw);const Jw={extension:{type:J.LoadParser,priority:oi.High},name:"loadKTX",test(r){return Tr(r,".ktx")},async load(r,t,e){const i=await(await Q.ADAPTER.fetch(r)).arrayBuffer(),{compressed:s,uncompressed:n,kvData:o}=Hw(r,i),a=s??n,h={mipmap:yi.OFF,alphaMode:xe.NO_PREMULTIPLIED_ALPHA,resolution:Qi(r),...t.data},l=a.map(u=>{a===n&&Object.assign(h,{type:u.type,format:u.format});const c=u.resource??u,d=new ft(c,h);return d.ktxKeyValueData=o,Qn(d,e,r)});return l.length===1?l[0]:l},unload(r){Array.isArray(r)?r.forEach(t=>t.destroy(!0)):r.destroy(!0)}};et.add(Jw);const $w={extension:J.ResolveParser,test:r=>{const t=Jt.extname(r).slice(1);return["basis","ktx","dds"].includes(t)},parse:r=>{var e,i;const t=Jt.extname(r).slice(1);if(t==="ktx"){const s=[".s3tc.ktx",".s3tc_sRGB.ktx",".etc.ktx",".etc1.ktx",".pvrt.ktx",".atc.ktx",".astc.ktx"];if(s.some(n=>r.endsWith(n)))return{resolution:parseFloat(((e=Q.RETINA_PREFIX.exec(r))==null?void 0:e[1])??"1"),format:s.find(n=>r.endsWith(n)),src:r}}return{resolution:parseFloat(((i=Q.RETINA_PREFIX.exec(r))==null?void 0:i[1])??"1"),format:t,src:r}}};et.add($w);const Ua=new ct,Qw=4,ag=class Vo{constructor(t){this.renderer=t,this._rendererPremultipliedAlpha=!1}contextChange(){var e;const t=(e=this.renderer)==null?void 0:e.gl.getContextAttributes();this._rendererPremultipliedAlpha=!!(t&&t.alpha&&t.premultipliedAlpha)}async image(t,e,i,s){const n=new Image;return n.src=await this.base64(t,e,i,s),n}async base64(t,e,i,s){const n=this.canvas(t,s);if(n.toBlob!==void 0)return new Promise((o,a)=>{n.toBlob(h=>{if(!h){a(new Error("ICanvas.toBlob failed!"));return}const l=new FileReader;l.onload=()=>o(l.result),l.onerror=a,l.readAsDataURL(h)},e,i)});if(n.toDataURL!==void 0)return n.toDataURL(e,i);if(n.convertToBlob!==void 0){const o=await n.convertToBlob({type:e,quality:i});return new Promise((a,h)=>{const l=new FileReader;l.onload=()=>a(l.result),l.onerror=h,l.readAsDataURL(o)})}throw new Error("Extract.base64() requires ICanvas.toDataURL, ICanvas.toBlob, or ICanvas.convertToBlob to be implemented")}canvas(t,e){const{pixels:i,width:s,height:n,flipY:o,premultipliedAlpha:a}=this._rawPixels(t,e);o&&Vo._flipY(i,s,n),a&&Vo._unpremultiplyAlpha(i);const h=new G1(s,n,1),l=new ImageData(new Uint8ClampedArray(i.buffer),s,n);return h.context.putImageData(l,0,0),h.canvas}pixels(t,e){const{pixels:i,width:s,height:n,flipY:o,premultipliedAlpha:a}=this._rawPixels(t,e);return o&&Vo._flipY(i,s,n),a&&Vo._unpremultiplyAlpha(i),i}_rawPixels(t,e){const i=this.renderer;if(!i)throw new Error("The Extract has already been destroyed");let s,n=!1,o=!1,a,h=!1;t&&(t instanceof qr?a=t:(a=i.generateTexture(t,{region:e,resolution:i.resolution,multisample:i.multisample}),h=!0,e&&(Ua.width=e.width,Ua.height=e.height,e=Ua)));const l=i.gl;if(a){if(s=a.baseTexture.resolution,e=e??a.frame,n=!1,o=a.baseTexture.alphaMode>0&&a.baseTexture.format===K.RGBA,!h){i.renderTexture.bind(a);const p=a.framebuffer.glFramebuffers[i.CONTEXT_UID];p.blitFramebuffer&&i.framebuffer.bind(p.blitFramebuffer)}}else s=i.resolution,e||(e=Ua,e.width=i.width/s,e.height=i.height/s),n=!0,o=this._rendererPremultipliedAlpha,i.renderTexture.bind();const u=Math.max(Math.round(e.width*s),1),c=Math.max(Math.round(e.height*s),1),d=new Uint8Array(Qw*u*c);return l.readPixels(Math.round(e.x*s),Math.round(e.y*s),u,c,l.RGBA,l.UNSIGNED_BYTE,d),h&&(a==null||a.destroy(!0)),{pixels:d,width:u,height:c,flipY:n,premultipliedAlpha:o}}destroy(){this.renderer=null}static _flipY(t,e,i){const s=e<<2,n=i>>1,o=new Uint8Array(s);for(let a=0;a<n;a++){const h=a*s,l=(i-a-1)*s;o.set(t.subarray(h,h+s)),t.copyWithin(h,l,l+s),t.set(o,l)}}static _unpremultiplyAlpha(t){t instanceof Uint8ClampedArray&&(t=new Uint8Array(t.buffer));const e=t.length;for(let i=0;i<e;i+=4){const s=t[i+3];if(s!==0){const n=255.001/s;t[i]=t[i]*n+.5,t[i+1]=t[i+1]*n+.5,t[i+2]=t[i+2]*n+.5}}}};ag.extension={name:"extract",type:J.RendererSystem};let qw=ag;et.add(qw);const Xa={build(r){const t=r.points;let e,i,s,n,o,a;if(r.type===ae.CIRC){const m=r.shape;e=m.x,i=m.y,o=a=m.radius,s=n=0}else if(r.type===ae.ELIP){const m=r.shape;e=m.x,i=m.y,o=m.width,a=m.height,s=n=0}else{const m=r.shape,f=m.width/2,g=m.height/2;e=m.x+f,i=m.y+g,o=a=Math.max(0,Math.min(m.radius,Math.min(f,g))),s=f-o,n=g-a}if(!(o>=0&&a>=0&&s>=0&&n>=0)){t.length=0;return}const h=Math.ceil(2.3*Math.sqrt(o+a)),l=h*8+(s?4:0)+(n?4:0);if(t.length=l,l===0)return;if(h===0){t.length=8,t[0]=t[6]=e+s,t[1]=t[3]=i+n,t[2]=t[4]=e-s,t[5]=t[7]=i-n;return}let u=0,c=h*4+(s?2:0)+2,d=c,p=l;{const m=s+o,f=n,g=e+m,y=e-m,_=i+f;if(t[u++]=g,t[u++]=_,t[--c]=_,t[--c]=y,n){const b=i-f;t[d++]=y,t[d++]=b,t[--p]=b,t[--p]=g}}for(let m=1;m<h;m++){const f=Math.PI/2*(m/h),g=s+Math.cos(f)*o,y=n+Math.sin(f)*a,_=e+g,b=e-g,v=i+y,S=i-y;t[u++]=_,t[u++]=v,t[--c]=v,t[--c]=b,t[d++]=b,t[d++]=S,t[--p]=S,t[--p]=_}{const m=s,f=n+a,g=e+m,y=e-m,_=i+f,b=i-f;t[u++]=g,t[u++]=_,t[--p]=b,t[--p]=g,s&&(t[u++]=y,t[u++]=_,t[--p]=b,t[--p]=y)}},triangulate(r,t){const e=r.points,i=t.points,s=t.indices;if(e.length===0)return;let n=i.length/2;const o=n;let a,h;if(r.type!==ae.RREC){const u=r.shape;a=u.x,h=u.y}else{const u=r.shape;a=u.x+u.width/2,h=u.y+u.height/2}const l=r.matrix;i.push(r.matrix?l.a*a+l.c*h+l.tx:a,r.matrix?l.b*a+l.d*h+l.ty:h),n++,i.push(e[0],e[1]);for(let u=2;u<e.length;u+=2)i.push(e[u],e[u+1]),s.push(n++,o,n);s.push(o+1,o,n)}};function hg(r,t=!1){const e=r.length;if(e<6)return;let i=0;for(let s=0,n=r[e-2],o=r[e-1];s<e;s+=2){const a=r[s],h=r[s+1];i+=(a-n)*(h+o),n=a,o=h}if(!t&&i>0||t&&i<=0){const s=e/2;for(let n=s+s%2;n<e;n+=2){const o=e-n-2,a=e-n-1,h=n,l=n+1;[r[o],r[h]]=[r[h],r[o]],[r[a],r[l]]=[r[l],r[a]]}}}const lg={build(r){r.points=r.shape.points.slice()},triangulate(r,t){let e=r.points;const i=r.holes,s=t.points,n=t.indices;if(e.length>=6){hg(e,!1);const o=[];for(let l=0;l<i.length;l++){const u=i[l];hg(u.points,!0),o.push(e.length/2),e=e.concat(u.points)}const a=lx(e,o,2);if(!a)return;const h=s.length/2;for(let l=0;l<a.length;l+=3)n.push(a[l]+h),n.push(a[l+1]+h),n.push(a[l+2]+h);for(let l=0;l<e.length;l++)s.push(e[l])}}},tS={build(r){const t=r.shape,e=t.x,i=t.y,s=t.width,n=t.height,o=r.points;o.length=0,s>=0&&n>=0&&o.push(e,i,e+s,i,e+s,i+n,e,i+n)},triangulate(r,t){const e=r.points,i=t.points;if(e.length===0)return;const s=i.length/2;i.push(e[0],e[1],e[2],e[3],e[6],e[7],e[4],e[5]),t.indices.push(s,s+1,s+2,s+1,s+2,s+3)}},eS={build(r){Xa.build(r)},triangulate(r,t){Xa.triangulate(r,t)}};var Ze=(r=>(r.MITER="miter",r.BEVEL="bevel",r.ROUND="round",r))(Ze||{}),wr=(r=>(r.BUTT="butt",r.ROUND="round",r.SQUARE="square",r))(wr||{});const zs={adaptive:!0,maxLength:10,minSegments:8,maxSegments:2048,epsilon:1e-4,_segmentsCount(r,t=20){if(!this.adaptive||!r||isNaN(r))return t;let e=Math.ceil(r/this.maxLength);return e<this.minSegments?e=this.minSegments:e>this.maxSegments&&(e=this.maxSegments),e}};class ug{static curveTo(t,e,i,s,n,o){const a=o[o.length-2],h=o[o.length-1]-e,l=a-t,u=s-e,c=i-t,d=Math.abs(h*c-l*u);if(d<1e-8||n===0)return(o[o.length-2]!==t||o[o.length-1]!==e)&&o.push(t,e),null;const p=h*h+l*l,m=u*u+c*c,f=h*u+l*c,g=n*Math.sqrt(p)/d,y=n*Math.sqrt(m)/d,_=g*f/p,b=y*f/m,v=g*c+y*l,S=g*u+y*h,E=l*(y+_),A=h*(y+_),I=c*(g+b),P=u*(g+b),W=Math.atan2(A-S,E-v),G=Math.atan2(P-S,I-v);return{cx:v+t,cy:S+e,radius:n,startAngle:W,endAngle:G,anticlockwise:l*u>c*h}}static arc(t,e,i,s,n,o,a,h,l){const u=a-o,c=zs._segmentsCount(Math.abs(u)*n,Math.ceil(Math.abs(u)/da)*40),d=u/(c*2),p=d*2,m=Math.cos(d),f=Math.sin(d),g=c-1,y=g%1/g;for(let _=0;_<=g;++_){const b=_+y*_,v=d+o+p*b,S=Math.cos(v),E=-Math.sin(v);l.push((m*S+f*E)*n+i,(m*-E+f*S)*n+s)}}}class iS{constructor(){this.reset()}begin(t,e,i){this.reset(),this.style=t,this.start=e,this.attribStart=i}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 Ou{static curveLength(t,e,i,s,n,o,a,h){let l=0,u=0,c=0,d=0,p=0,m=0,f=0,g=0,y=0,_=0,b=0,v=t,S=e;for(let E=1;E<=10;++E)u=E/10,c=u*u,d=c*u,p=1-u,m=p*p,f=m*p,g=f*t+3*m*u*i+3*p*c*n+d*a,y=f*e+3*m*u*s+3*p*c*o+d*h,_=v-g,b=S-y,v=g,S=y,l+=Math.sqrt(_*_+b*b);return l}static curveTo(t,e,i,s,n,o,a){const h=a[a.length-2],l=a[a.length-1];a.length-=2;const u=zs._segmentsCount(Ou.curveLength(h,l,t,e,i,s,n,o));let c=0,d=0,p=0,m=0,f=0;a.push(h,l);for(let g=1,y=0;g<=u;++g)y=g/u,c=1-y,d=c*c,p=d*c,m=y*y,f=m*y,a.push(p*h+3*d*y*t+3*c*m*i+f*n,p*l+3*d*y*e+3*c*m*s+f*o)}}function cg(r,t,e,i,s,n,o,a){const h=r-e*s,l=t-i*s,u=r+e*n,c=t+i*n;let d,p;o?(d=i,p=-e):(d=-i,p=e);const m=h+d,f=l+p,g=u+d,y=c+p;return a.push(m,f,g,y),2}function ns(r,t,e,i,s,n,o,a){const h=e-r,l=i-t;let u=Math.atan2(h,l),c=Math.atan2(s-r,n-t);a&&u<c?u+=Math.PI*2:!a&&u>c&&(c+=Math.PI*2);let d=u;const p=c-u,m=Math.abs(p),f=Math.sqrt(h*h+l*l),g=(15*m*Math.sqrt(f)/Math.PI>>0)+1,y=p/g;if(d+=y,a){o.push(r,t,e,i);for(let _=1,b=d;_<g;_++,b+=y)o.push(r,t,r+Math.sin(b)*f,t+Math.cos(b)*f);o.push(r,t,s,n)}else{o.push(e,i,r,t);for(let _=1,b=d;_<g;_++,b+=y)o.push(r+Math.sin(b)*f,t+Math.cos(b)*f,r,t);o.push(s,n,r,t)}return g*2}function rS(r,t){const e=r.shape;let i=r.points||e.points.slice();const s=t.closePointEps;if(i.length===0)return;const n=r.lineStyle,o=new lt(i[0],i[1]),a=new lt(i[i.length-2],i[i.length-1]),h=e.type!==ae.POLY||e.closeStroke,l=Math.abs(o.x-a.x)<s&&Math.abs(o.y-a.y)<s;if(h){i=i.slice(),l&&(i.pop(),i.pop(),a.set(i[i.length-2],i[i.length-1]));const L=(o.x+a.x)*.5,k=(a.y+o.y)*.5;i.unshift(L,k),i.push(L,k)}const u=t.points,c=i.length/2;let d=i.length;const p=u.length/2,m=n.width/2,f=m*m,g=n.miterLimit*n.miterLimit;let y=i[0],_=i[1],b=i[2],v=i[3],S=0,E=0,A=-(_-v),I=y-b,P=0,W=0,G=Math.sqrt(A*A+I*I);A/=G,I/=G,A*=m,I*=m;const N=n.alignment,C=(1-N)*2,F=N*2;h||(n.cap===wr.ROUND?d+=ns(y-A*(C-F)*.5,_-I*(C-F)*.5,y-A*C,_-I*C,y+A*F,_+I*F,u,!0)+2:n.cap===wr.SQUARE&&(d+=cg(y,_,A,I,C,F,!0,u))),u.push(y-A*C,_-I*C,y+A*F,_+I*F);for(let L=1;L<c-1;++L){y=i[(L-1)*2],_=i[(L-1)*2+1],b=i[L*2],v=i[L*2+1],S=i[(L+1)*2],E=i[(L+1)*2+1],A=-(_-v),I=y-b,G=Math.sqrt(A*A+I*I),A/=G,I/=G,A*=m,I*=m,P=-(v-E),W=b-S,G=Math.sqrt(P*P+W*W),P/=G,W/=G,P*=m,W*=m;const k=b-y,H=_-v,D=b-S,U=E-v,j=k*D+H*U,q=H*D-U*k,dt=q<0;if(Math.abs(q)<.001*Math.abs(j)){u.push(b-A*C,v-I*C,b+A*F,v+I*F),j>=0&&(n.join===Ze.ROUND?d+=ns(b,v,b-A*C,v-I*C,b-P*C,v-W*C,u,!1)+4:d+=2,u.push(b-P*F,v-W*F,b+P*C,v+W*C));continue}const nt=(-A+y)*(-I+v)-(-A+b)*(-I+_),Et=(-P+S)*(-W+v)-(-P+b)*(-W+E),Mt=(k*Et-D*nt)/q,wt=(U*nt-H*Et)/q,z=(Mt-b)*(Mt-b)+(wt-v)*(wt-v),it=b+(Mt-b)*C,tt=v+(wt-v)*C,O=b-(Mt-b)*F,yt=v-(wt-v)*F,mt=Math.min(k*k+H*H,D*D+U*U),Rt=dt?C:F,Ut=mt+Rt*Rt*f,De=z<=Ut;let ci=n.join;if(ci===Ze.MITER&&z/f>g&&(ci=Ze.BEVEL),De)switch(ci){case Ze.MITER:{u.push(it,tt,O,yt);break}case Ze.BEVEL:{dt?u.push(it,tt,b+A*F,v+I*F,it,tt,b+P*F,v+W*F):u.push(b-A*C,v-I*C,O,yt,b-P*C,v-W*C,O,yt),d+=2;break}case Ze.ROUND:{dt?(u.push(it,tt,b+A*F,v+I*F),d+=ns(b,v,b+A*F,v+I*F,b+P*F,v+W*F,u,!0)+4,u.push(it,tt,b+P*F,v+W*F)):(u.push(b-A*C,v-I*C,O,yt),d+=ns(b,v,b-A*C,v-I*C,b-P*C,v-W*C,u,!1)+4,u.push(b-P*C,v-W*C,O,yt));break}}else{switch(u.push(b-A*C,v-I*C,b+A*F,v+I*F),ci){case Ze.MITER:{dt?u.push(O,yt,O,yt):u.push(it,tt,it,tt),d+=2;break}case Ze.ROUND:{dt?d+=ns(b,v,b+A*F,v+I*F,b+P*F,v+W*F,u,!0)+2:d+=ns(b,v,b-A*C,v-I*C,b-P*C,v-W*C,u,!1)+2;break}}u.push(b-P*C,v-W*C,b+P*F,v+W*F),d+=2}}y=i[(c-2)*2],_=i[(c-2)*2+1],b=i[(c-1)*2],v=i[(c-1)*2+1],A=-(_-v),I=y-b,G=Math.sqrt(A*A+I*I),A/=G,I/=G,A*=m,I*=m,u.push(b-A*C,v-I*C,b+A*F,v+I*F),h||(n.cap===wr.ROUND?d+=ns(b-A*(C-F)*.5,v-I*(C-F)*.5,b-A*C,v-I*C,b+A*F,v+I*F,u,!1)+2:n.cap===wr.SQUARE&&(d+=cg(b,v,A,I,C,F,!1,u)));const X=t.indices,V=zs.epsilon*zs.epsilon;for(let L=p;L<d+p-2;++L)y=u[L*2],_=u[L*2+1],b=u[(L+1)*2],v=u[(L+1)*2+1],S=u[(L+2)*2],E=u[(L+2)*2+1],!(Math.abs(y*(v-E)+b*(E-_)+S*(_-v))<V)&&X.push(L,L+1,L+2)}function sS(r,t){let e=0;const i=r.shape,s=r.points||i.points,n=i.type!==ae.POLY||i.closeStroke;if(s.length===0)return;const o=t.points,a=t.indices,h=s.length/2,l=o.length/2;let u=l;for(o.push(s[0],s[1]),e=1;e<h;e++)o.push(s[e*2],s[e*2+1]),a.push(u,u+1),u++;n&&a.push(u,l)}function dg(r,t){r.lineStyle.native?sS(r,t):rS(r,t)}class Bu{static curveLength(t,e,i,s,n,o){const a=t-2*i+n,h=e-2*s+o,l=2*i-2*t,u=2*s-2*e,c=4*(a*a+h*h),d=4*(a*l+h*u),p=l*l+u*u,m=2*Math.sqrt(c+d+p),f=Math.sqrt(c),g=2*c*f,y=2*Math.sqrt(p),_=d/f;return(g*m+f*d*(m-y)+(4*p*c-d*d)*Math.log((2*f+_+m)/(_+y)))/(4*g)}static curveTo(t,e,i,s,n){const o=n[n.length-2],a=n[n.length-1],h=zs._segmentsCount(Bu.curveLength(o,a,t,e,i,s));let l=0,u=0;for(let c=1;c<=h;++c){const d=c/h;l=o+(t-o)*d,u=a+(e-a)*d,n.push(l+(t+(i-t)*d-l)*d,u+(e+(s-e)*d-u)*d)}}}const Wu={[ae.POLY]:lg,[ae.CIRC]:Xa,[ae.ELIP]:Xa,[ae.RECT]:tS,[ae.RREC]:eS},pg=[],Za=[];class Va{constructor(t,e=null,i=null,s=null){this.points=[],this.holes=[],this.shape=t,this.lineStyle=i,this.fillStyle=e,this.matrix=s,this.type=t.type}clone(){return new Va(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 js=new lt,fg=class Tb extends Yf{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 Ra,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(),Za.push(this.drawCalls[t]);this.drawCalls.length=0;for(let t=0;t<this.batches.length;t++){const e=this.batches[t];e.reset(),pg.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,i=null,s=null){const n=new Va(t,e,i,s);return this.graphicsData.push(n),this.dirty++,this}drawHole(t,e=null){if(!this.graphicsData.length)return null;const i=new Va(t,null,null,e),s=this.graphicsData[this.graphicsData.length-1];return i.lineStyle=s.lineStyle,s.holes.push(i),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 i=0;i<e.length;++i){const s=e[i];if(s.fillStyle.visible&&s.shape&&(s.matrix?s.matrix.applyInverse(t,js):js.copyFrom(t),s.shape.contains(js.x,js.y))){let n=!1;if(s.holes){for(let o=0;o<s.holes.length;o++)if(s.holes[o].shape.contains(js.x,js.y)){n=!0;break}}if(!n)return!0}}return!1}updateBatches(){if(!this.graphicsData.length){this.batchable=!0;return}if(!this.validateBatching())return;this.cacheDirty=this.dirty;const t=this.uvs,e=this.graphicsData;let i=null,s=null;this.batches.length>0&&(i=this.batches[this.batches.length-1],s=i.style);for(let h=this.shapeIndex;h<e.length;h++){this.shapeIndex++;const l=e[h],u=l.fillStyle,c=l.lineStyle;Wu[l.type].build(l),l.matrix&&this.transformPoints(l.points,l.matrix),(u.visible||c.visible)&&this.processHoles(l.holes);for(let d=0;d<2;d++){const p=d===0?u:c;if(!p.visible)continue;const m=p.texture.baseTexture,f=this.indices.length,g=this.points.length/2;m.wrapMode=Ki.REPEAT,d===0?this.processFill(l):this.processLine(l);const y=this.points.length/2-g;y!==0&&(i&&!this._compareStyles(s,p)&&(i.end(f,g),i=null),i||(i=pg.pop()||new iS,i.begin(p,f,g),this.batches.push(i),s=p),this.addUvs(this.points,t,p.texture,g,y,p.matrix))}}const n=this.indices.length,o=this.points.length/2;if(i&&i.end(n,o),this.batches.length===0){this.batchable=!0;return}const a=o>65535;this.indicesUint16&&this.indices.length===this.indicesUint16.length&&a===this.indicesUint16.BYTES_PER_ELEMENT>2?this.indicesUint16.set(this.indices):this.indicesUint16=a?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 i=this.graphicsData[t],s=i.fillStyle,n=i.lineStyle;if(s&&!s.texture.baseTexture.valid||n&&!n.texture.baseTexture.valid)return!1}return!0}packBatches(){this.batchDirty++,this.uvsFloat32=new Float32Array(this.uvs);const t=this.batches;for(let e=0,i=t.length;e<i;e++){const s=t[e];for(let n=0;n<s.size;n++){const o=s.start+n;this.indicesUint16[o]=this.indicesUint16[o]-s.attribStart}}}isBatchable(){if(this.points.length>65535*2)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<Tb.BATCHABLE_SIZE*2}buildDrawCalls(){let t=++ft._globalBatch;for(let c=0;c<this.drawCalls.length;c++)this.drawCalls[c].texArray.clear(),Za.push(this.drawCalls[c]);this.drawCalls.length=0;const e=this.colors,i=this.textureIds;let s=Za.pop();s||(s=new uu,s.texArray=new gu),s.texArray.count=0,s.start=0,s.size=0,s.type=gi.TRIANGLES;let n=0,o=null,a=0,h=!1,l=gi.TRIANGLES,u=0;this.drawCalls.push(s);for(let c=0;c<this.batches.length;c++){const d=this.batches[c],p=8,m=d.style,f=m.texture.baseTexture;h!==!!m.native&&(h=!!m.native,l=h?gi.LINES:gi.TRIANGLES,o=null,n=p,t++),o!==f&&(o=f,f._batchEnabled!==t&&(n===p&&(t++,n=0,s.size>0&&(s=Za.pop(),s||(s=new uu,s.texArray=new gu),this.drawCalls.push(s)),s.start=u,s.size=0,s.texArray.count=0,s.type=l),f.touched=1,f._batchEnabled=t,f._batchLocation=n,f.wrapMode=Ki.REPEAT,s.texArray.elements[s.texArray.count++]=f,n++)),s.size+=d.size,u+=d.size,a=f._batchLocation,this.addColors(e,m.color,m.alpha,d.attribSize,d.attribStart),this.addTextureIds(i,a,d.attribSize,d.attribStart)}ft._globalBatch=t,this.packAttributes()}packAttributes(){const t=this.points,e=this.uvs,i=this.colors,s=this.textureIds,n=new ArrayBuffer(t.length*3*4),o=new Float32Array(n),a=new Uint32Array(n);let h=0;for(let l=0;l<t.length/2;l++)o[h++]=t[l*2],o[h++]=t[l*2+1],o[h++]=e[l*2],o[h++]=e[l*2+1],a[h++]=i[l],o[h++]=s[l];this._buffer.update(n),this._indexBuffer.update(this.indicesUint16)}processFill(t){t.holes.length?lg.triangulate(t,this):Wu[t.type].triangulate(t,this)}processLine(t){dg(t,this);for(let e=0;e<t.holes.length;e++)dg(t.holes[e],this)}processHoles(t){for(let e=0;e<t.length;e++){const i=t[e];Wu[i.type].build(i),i.matrix&&this.transformPoints(i.points,i.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 i=0;i<t.length/2;i++){const s=t[i*2],n=t[i*2+1];t[i*2]=e.a*s+e.c*n+e.tx,t[i*2+1]=e.b*s+e.d*n+e.ty}}addColors(t,e,i,s,n=0){const o=Gt.shared.setValue(e).toLittleEndianNumber(),a=Gt.shared.setValue(o).toPremultiplied(i);t.length=Math.max(t.length,n+s);for(let h=0;h<s;h++)t[n+h]=a}addTextureIds(t,e,i,s=0){t.length=Math.max(t.length,s+i);for(let n=0;n<i;n++)t[s+n]=e}addUvs(t,e,i,s,n,o=null){let a=0;const h=e.length,l=i.frame;for(;a<n;){let c=t[(s+a)*2],d=t[(s+a)*2+1];if(o){const p=o.a*c+o.c*d+o.tx;d=o.b*c+o.d*d+o.ty,c=p}a++,e.push(c/l.width,d/l.height)}const u=i.baseTexture;(l.width<u.width||l.height<u.height)&&this.adjustUvs(e,i,h,n)}adjustUvs(t,e,i,s){const n=e.baseTexture,o=1e-6,a=i+s*2,h=e.frame,l=h.width/n.width,u=h.height/n.height;let c=h.x/h.width,d=h.y/h.height,p=Math.floor(t[i]+o),m=Math.floor(t[i+1]+o);for(let f=i+2;f<a;f+=2)p=Math.min(p,Math.floor(t[f]+o)),m=Math.min(m,Math.floor(t[f+1]+o));c-=p,d-=m;for(let f=i;f<a;f+=2)t[f]=(t[f]+c)*l,t[f+1]=(t[f+1]+d)*u}};fg.BATCHABLE_SIZE=100;let nS=fg;class Ha{constructor(){this.color=16777215,this.alpha=1,this.texture=rt.WHITE,this.matrix=null,this.visible=!1,this.reset()}clone(){const t=new Ha;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=rt.WHITE,this.matrix=null,this.visible=!1}destroy(){this.texture=null,this.matrix=null}}class Uu extends Ha{constructor(){super(...arguments),this.width=0,this.alignment=.5,this.native=!1,this.cap=wr.BUTT,this.join=Ze.MITER,this.miterLimit=10}clone(){const t=new Uu;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,this.cap=wr.BUTT,this.join=Ze.MITER,this.miterLimit=10}}const Xu={},Zu=class hl extends Xt{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 Ha,this._lineStyle=new Uu,this._matrix=null,this._holeMode=!1,this.state=Si.for2d(),this._geometry=t||new nS,this._geometry.refCount++,this._transformID=-1,this._tintColor=new Gt(16777215),this.blendMode=ut.NORMAL}get geometry(){return this._geometry}clone(){return this.finishPoly(),new hl(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,i,s=.5,n=!1){return typeof t=="number"&&(t={width:t,color:e,alpha:i,alignment:s,native:n}),this.lineTextureStyle(t)}lineTextureStyle(t){const e={width:0,texture:rt.WHITE,color:t!=null&&t.texture?16777215:0,matrix:null,alignment:.5,native:!1,cap:wr.BUTT,join:Ze.MITER,miterLimit:10};t=Object.assign(e,t),this.normalizeColor(t),this.currentPath&&this.startPoly();const i=t.width>0&&t.alpha>0;return i?(t.matrix&&(t.matrix=t.matrix.clone(),t.matrix.invert()),Object.assign(this._lineStyle,{visible:i},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 Yr,this.currentPath.closeStroke=!1,this.currentPath.points.push(t[e-2],t[e-1]))}else this.currentPath=new Yr,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 i=this.currentPath.points,s=i[i.length-2],n=i[i.length-1];return(s!==t||n!==e)&&i.push(t,e),this}_initCurve(t=0,e=0){this.currentPath?this.currentPath.points.length===0&&(this.currentPath.points=[t,e]):this.moveTo(t,e)}quadraticCurveTo(t,e,i,s){this._initCurve();const n=this.currentPath.points;return n.length===0&&this.moveTo(0,0),Bu.curveTo(t,e,i,s,n),this}bezierCurveTo(t,e,i,s,n,o){return this._initCurve(),Ou.curveTo(t,e,i,s,n,o,this.currentPath.points),this}arcTo(t,e,i,s,n){this._initCurve(t,e);const o=this.currentPath.points,a=ug.curveTo(t,e,i,s,n,o);if(a){const{cx:h,cy:l,radius:u,startAngle:c,endAngle:d,anticlockwise:p}=a;this.arc(h,l,u,c,d,p)}return this}arc(t,e,i,s,n,o=!1){if(s===n)return this;if(!o&&n<=s?n+=da:o&&s<=n&&(s+=da),n-s===0)return this;const a=t+Math.cos(s)*i,h=e+Math.sin(s)*i,l=this._geometry.closePointEps;let u=this.currentPath?this.currentPath.points:null;if(u){const c=Math.abs(u[u.length-2]-a),d=Math.abs(u[u.length-1]-h);c<l&&d<l||u.push(a,h)}else this.moveTo(a,h),u=this.currentPath.points;return ug.arc(a,h,t,e,i,s,n,o,u),this}beginFill(t=0,e){return this.beginTextureFill({texture:rt.WHITE,color:t,alpha:e})}normalizeColor(t){const e=Gt.shared.setValue(t.color??0);t.color=e.toNumber(),t.alpha??(t.alpha=e.alpha)}beginTextureFill(t){const e={texture:rt.WHITE,color:16777215,matrix:null};t=Object.assign(e,t),this.normalizeColor(t),this.currentPath&&this.startPoly();const i=t.alpha>0;return i?(t.matrix&&(t.matrix=t.matrix.clone(),t.matrix.invert()),Object.assign(this._fillStyle,{visible:i},t)):this._fillStyle.reset(),this}endFill(){return this.finishPoly(),this._fillStyle.reset(),this}drawRect(t,e,i,s){return this.drawShape(new ct(t,e,i,s))}drawRoundedRect(t,e,i,s,n){return this.drawShape(new ga(t,e,i,s,n))}drawCircle(t,e,i){return this.drawShape(new fa(t,e,i))}drawEllipse(t,e,i,s){return this.drawShape(new ma(t,e,i,s))}drawPolygon(...t){let e,i=!0;const s=t[0];s.points?(i=s.closeStroke,e=s.points):Array.isArray(t[0])?e=t[0]:e=t;const n=new Yr(e);return n.closeStroke=i,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 t.length===1&&t[0].shape.type===ae.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,i=t.batches.length;this.batchTint=-1,this._transformID=-1,this.batchDirty=t.batchDirty,this.batches.length=i,this.vertexData=new Float32Array(t.points);for(let s=0;s<i;s++){const n=t.batches[s],o=n.style.color,a=new Float32Array(this.vertexData.buffer,n.attribStart*4*2,n.attribSize*2),h=new Float32Array(t.uvsFloat32.buffer,n.attribStart*4*2,n.attribSize*2),l=new Uint16Array(t.indicesUint16.buffer,n.start*2,n.size),u={vertexData:a,blendMode:e,indices:l,uvs:h,_batchRGB:Gt.shared.setValue(o).toRgbArray(),_tintRGB:o,_texture:n.style.texture,alpha:n.style.alpha,worldAlpha:1};this.batches[s]=u}}_renderBatched(t){if(this.batches.length){t.batch.setObjectRenderer(t.plugins[this.pluginName]),this.calculateVertices(),this.calculateTints();for(let e=0,i=this.batches.length;e<i;e++){const s=this.batches[e];s.worldAlpha=this.worldAlpha*s.alpha,t.plugins[this.pluginName].render(s)}}}_renderDirect(t){const e=this._resolveDirectShader(t),i=this._geometry,s=this.worldAlpha,n=e.uniforms,o=i.drawCalls;n.translationMatrix=this.transform.worldTransform,Gt.shared.setValue(this._tintColor).premultiply(s).toArray(n.tint),t.shader.bind(e),t.geometry.bind(i,e),t.state.set(this.state);for(let a=0,h=o.length;a<h;a++)this._renderDrawCallDirect(t,i.drawCalls[a])}_renderDrawCallDirect(t,e){const{texArray:i,type:s,size:n,start:o}=e,a=i.count;for(let h=0;h<a;h++)t.texture.bind(i.elements[h],h);t.geometry.draw(s,n,o)}_resolveDirectShader(t){let e=this.shader;const i=this.pluginName;if(!e){if(!Xu[i]){const{maxTextures:s}=t.plugins[i],n=new Int32Array(s);for(let h=0;h<s;h++)n[h]=h;const o={tint:new Float32Array([1,1,1,1]),translationMatrix:new Nt,default:ri.from({uSamplers:n},!0)},a=t.plugins[i]._shader.program;Xu[i]=new Ei(a,o)}e=Xu[i]}return e}_calculateBounds(){this.finishPoly();const t=this._geometry;if(!t.graphicsData.length)return;const{minX:e,minY:i,maxX:s,maxY:n}=t.bounds;this._bounds.addFrame(this.transform,e,i,s,n)}containsPoint(t){return this.worldTransform.applyInverse(t,hl._TEMP_POINT),this._geometry.containsPoint(hl._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=Gt.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,i=e.a,s=e.b,n=e.c,o=e.d,a=e.tx,h=e.ty,l=this._geometry.points,u=this.vertexData;let c=0;for(let d=0;d<l.length;d+=2){const p=l[d],m=l[d+1];u[c++]=i*p+n*m+a,u[c++]=o*m+s*p+h}}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--,this._geometry.refCount===0&&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)}};Zu.curves=zs,Zu._TEMP_POINT=new lt;let qn=Zu;class oS{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 Vu=new lt,mg=new Yr,gg=class wb extends Xt{constructor(t,e,i,s=gi.TRIANGLES){super(),this.geometry=t,this.shader=e,this.state=i||Si.for2d(),this.drawMode=s,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=Q.ROUND_PIXELS,this.batchUvs=null}get geometry(){return this._geometry}set geometry(t){this._geometry!==t&&(this._geometry&&(this._geometry.refCount--,this._geometry.refCount===0&&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===gi.TRIANGLES&&e.length<wb.BATCHABLE_SIZE*2?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,i=this.shader;i.uvMatrix&&(i.uvMatrix.update(),this.calculateUvs()),this.calculateVertices(),this.indices=e.indexBuffer.data,this._tintRGB=i._tintRGB,this._texture=i.texture;const s=this.material.pluginName;t.batch.setObjectRenderer(t.plugins[s]),t.plugins[s].render(this)}calculateVertices(){const t=this.geometry.buffers[0],e=t.data,i=t._updateID;if(i===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 s=this.transform.worldTransform,n=s.a,o=s.b,a=s.c,h=s.d,l=s.tx,u=s.ty,c=this.vertexData;for(let d=0;d<c.length/2;d++){const p=e[d*2],m=e[d*2+1];c[d*2]=n*p+a*m+l,c[d*2+1]=o*p+h*m+u}if(this._roundPixels){const d=Q.RESOLUTION;for(let p=0;p<c.length;++p)c[p]=Math.round(c[p]*d)/d}this.vertexDirty=i}calculateUvs(){const t=this.geometry.buffers[1],e=this.shader;e.uvMatrix.isSimple?this.uvs=t.data:(this.batchUvs||(this.batchUvs=new oS(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,Vu);const e=this.geometry.getBuffer("aVertexPosition").data,i=mg.points,s=this.geometry.getIndex().data,n=s.length,o=this.drawMode===4?3:1;for(let a=0;a+2<n;a+=o){const h=s[a]*2,l=s[a+1]*2,u=s[a+2]*2;if(i[0]=e[h],i[1]=e[h+1],i[2]=e[l],i[3]=e[l+1],i[4]=e[u],i[5]=e[u+1],mg.contains(Vu.x,Vu.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}};gg.BATCHABLE_SIZE=100;let Hu=gg;class yg extends xr{constructor(t,e,i){super();const s=new Ht(t),n=new Ht(e,!0),o=new Ht(i,!0,!0);this.addAttribute("aVertexPosition",s,2,!1,at.FLOAT).addAttribute("aTextureCoord",n,2,!1,at.FLOAT).addIndex(o),this._updateId=-1}get vertexDirtyId(){return this.buffers[0]._updateID}}var aS=`varying vec2 vTextureCoord;
|
|
924
924
|
uniform vec4 uColor;
|
|
925
925
|
|
|
926
926
|
uniform sampler2D uSampler;
|
|
@@ -929,7 +929,7 @@ void main(void)
|
|
|
929
929
|
{
|
|
930
930
|
gl_FragColor = texture2D(uSampler, vTextureCoord) * uColor;
|
|
931
931
|
}
|
|
932
|
-
`,
|
|
932
|
+
`,hS=`attribute vec2 aVertexPosition;
|
|
933
933
|
attribute vec2 aTextureCoord;
|
|
934
934
|
|
|
935
935
|
uniform mat3 projectionMatrix;
|
|
@@ -944,7 +944,7 @@ void main(void)
|
|
|
944
944
|
|
|
945
945
|
vTextureCoord = (uTextureMatrix * vec3(aTextureCoord, 1.0)).xy;
|
|
946
946
|
}
|
|
947
|
-
`;class Ku extends
|
|
947
|
+
`;class Ku extends Ei{constructor(t,e){const i={uSampler:t,alpha:1,uTextureMatrix:Nt.IDENTITY,uColor:new Float32Array([1,1,1,1])};e=Object.assign({tint:16777215,alpha:1,pluginName:"batch"},e),e.uniforms&&Object.assign(i,e.uniforms),super(e.program||tr.from(hS,aS),i),this._colorDirty=!1,this.uvMatrix=new fm(t),this.batchable=e.program===void 0,this.pluginName=e.pluginName,this._tintColor=new Gt(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;Gt.shared.setValue(this._tintColor).premultiply(this._alpha,t).toArray(this.uniforms.uColor)}this.uvMatrix.update()&&(this.uniforms.uTextureMatrix=this.uvMatrix.mapCoord)}}class lS extends yg{constructor(t=200,e,i=0){super(new Float32Array(e.length*4),new Float32Array(e.length*4),new Uint16Array((e.length-1)*6)),this.points=e,this._width=t,this.textureScale=i,this.build()}get width(){return this._width}build(){const t=this.points;if(!t)return;const e=this.getBuffer("aVertexPosition"),i=this.getBuffer("aTextureCoord"),s=this.getIndex();if(t.length<1)return;e.data.length/4!==t.length&&(e.data=new Float32Array(t.length*4),i.data=new Float32Array(t.length*4),s.data=new Uint16Array((t.length-1)*6));const n=i.data,o=s.data;n[0]=0,n[1]=0,n[2]=0,n[3]=1;let a=0,h=t[0];const l=this._width*this.textureScale,u=t.length;for(let d=0;d<u;d++){const p=d*4;if(this.textureScale>0){const m=h.x-t[d].x,f=h.y-t[d].y,g=Math.sqrt(m*m+f*f);h=t[d],a+=g/l}else a=d/(u-1);n[p]=a,n[p+1]=0,n[p+2]=a,n[p+3]=1}let c=0;for(let d=0;d<u-1;d++){const p=d*2;o[c++]=p,o[c++]=p+1,o[c++]=p+2,o[c++]=p+2,o[c++]=p+1,o[c++]=p+3}i.update(),s.update(),this.updateVertices()}updateVertices(){const t=this.points;if(t.length<1)return;let e=t[0],i,s=0,n=0;const o=this.buffers[0].data,a=t.length,h=this.textureScale>0?this.textureScale*this._width/2:this._width/2;for(let l=0;l<a;l++){const u=t[l],c=l*4;l<t.length-1?i=t[l+1]:i=u,n=-(i.x-e.x),s=i.y-e.y;const d=Math.sqrt(s*s+n*n);d<1e-6?(s=0,n=0):(s/=d,n/=d,s*=h,n*=h),o[c]=u.x+s,o[c+1]=u.y+n,o[c+2]=u.x-s,o[c+3]=u.y-n,e=u}this.buffers[0].update()}update(){this.textureScale>0?this.build():this.updateVertices()}}class uS extends Hu{constructor(t,e,i=0){const s=new lS(t.height,e,i),n=new Ku(t);i>0&&(t.baseTexture.wrapMode=Ki.REPEAT),super(s,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)}}class bg{constructor(t,e,i){this.geometry=new xr,this.indexBuffer=null,this.size=i,this.dynamicProperties=[],this.staticProperties=[];for(let s=0;s<t.length;++s){let n=t[s];n={attributeName:n.attributeName,size:n.size,uploadFunction:n.uploadFunction,type:n.type||at.FLOAT,offset:n.offset},e[s]?this.dynamicProperties.push(n):this.staticProperties.push(n)}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 Ht(P1(this.size),!0,!0),t.addIndex(this.indexBuffer),this.dynamicStride=0;for(let o=0;o<this.dynamicProperties.length;++o){const a=this.dynamicProperties[o];a.offset=e,e+=a.size,this.dynamicStride+=a.size}const i=new ArrayBuffer(this.size*this.dynamicStride*4*4);this.dynamicData=new Float32Array(i),this.dynamicDataUint32=new Uint32Array(i),this.dynamicBuffer=new Ht(this.dynamicData,!1,!1);let s=0;this.staticStride=0;for(let o=0;o<this.staticProperties.length;++o){const a=this.staticProperties[o];a.offset=s,s+=a.size,this.staticStride+=a.size}const n=new ArrayBuffer(this.size*this.staticStride*4*4);this.staticData=new Float32Array(n),this.staticDataUint32=new Uint32Array(n),this.staticBuffer=new Ht(this.staticData,!0,!1);for(let o=0;o<this.dynamicProperties.length;++o){const a=this.dynamicProperties[o];t.addAttribute(a.attributeName,this.dynamicBuffer,0,a.type===at.UNSIGNED_BYTE,a.type,this.dynamicStride*4,a.offset*4)}for(let o=0;o<this.staticProperties.length;++o){const a=this.staticProperties[o];t.addAttribute(a.attributeName,this.staticBuffer,0,a.type===at.UNSIGNED_BYTE,a.type,this.staticStride*4,a.offset*4)}}uploadDynamic(t,e,i){for(let s=0;s<this.dynamicProperties.length;s++){const n=this.dynamicProperties[s];n.uploadFunction(t,e,i,n.type===at.UNSIGNED_BYTE?this.dynamicDataUint32:this.dynamicData,this.dynamicStride,n.offset)}this.dynamicBuffer._updateID++}uploadStatic(t,e,i){for(let s=0;s<this.staticProperties.length;s++){const n=this.staticProperties[s];n.uploadFunction(t,e,i,n.type===at.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()}}var cS=`varying vec2 vTextureCoord;
|
|
948
948
|
varying vec4 vColor;
|
|
949
949
|
|
|
950
950
|
uniform sampler2D uSampler;
|
|
@@ -952,7 +952,7 @@ uniform sampler2D uSampler;
|
|
|
952
952
|
void main(void){
|
|
953
953
|
vec4 color = texture2D(uSampler, vTextureCoord) * vColor;
|
|
954
954
|
gl_FragColor = color;
|
|
955
|
-
}`,
|
|
955
|
+
}`,dS=`attribute vec2 aVertexPosition;
|
|
956
956
|
attribute vec2 aTextureCoord;
|
|
957
957
|
attribute vec4 aColor;
|
|
958
958
|
|
|
@@ -977,8 +977,8 @@ void main(void){
|
|
|
977
977
|
vTextureCoord = aTextureCoord;
|
|
978
978
|
vColor = aColor * uColor;
|
|
979
979
|
}
|
|
980
|
-
`;class
|
|
981
|
-
`:t,t}static getFromCache(t,e,i,s){let n=i[t];return typeof n!="number"&&(n=rt._measureText(t,e,s)+e,i[t]=n),n}static collapseSpaces(t){return t==="normal"||t==="pre-line"}static collapseNewlines(t){return t==="normal"}static trimRight(t){if(typeof t!="string")return"";for(let e=t.length-1;e>=0;e--){const i=t[e];if(!rt.isBreakingSpace(i))break;t=t.slice(0,-1)}return t}static isNewline(t){return typeof t!="string"?!1:rt._newlines.includes(t.charCodeAt(0))}static isBreakingSpace(t,e){return typeof t!="string"?!1:rt._breakingSpaces.includes(t.charCodeAt(0))}static tokenize(t){const e=[];let i="";if(typeof t!="string")return e;for(let s=0;s<t.length;s++){const n=t[s],o=t[s+1];if(rt.isBreakingSpace(n,o)||rt.isNewline(n)){i!==""&&(e.push(i),i=""),e.push(n);continue}i+=n}return i!==""&&e.push(i),e}static canBreakWords(t,e){return e}static canBreakChars(t,e,i,s,n){return!0}static wordWrapSplit(t){return rt.graphemeSegmenter(t)}static measureFont(t){if(rt._fonts[t])return rt._fonts[t];const e={ascent:0,descent:0,fontSize:0},i=rt._canvas,s=rt._context;s.font=t;const n=rt.METRICS_STRING+rt.BASELINE_SYMBOL,o=Math.ceil(s.measureText(n).width);let a=Math.ceil(s.measureText(rt.BASELINE_SYMBOL).width);const h=Math.ceil(rt.HEIGHT_MULTIPLIER*a);if(a=a*rt.BASELINE_MULTIPLIER|0,o===0||h===0)return rt._fonts[t]=e,e;i.width=o,i.height=h,s.fillStyle="#f00",s.fillRect(0,0,o,h),s.font=t,s.textBaseline="alphabetic",s.fillStyle="#000",s.fillText(n,0,a);const l=s.getImageData(0,0,o,h).data,u=l.length,c=o*4;let d=0,p=0,m=!1;for(d=0;d<a;++d){for(let f=0;f<c;f+=4)if(l[p+f]!==255){m=!0;break}if(!m)p+=c;else break}for(e.ascent=a-d,p=u-c,m=!1,d=h;d>a;--d){for(let f=0;f<c;f+=4)if(l[p+f]!==255){m=!0;break}if(!m)p-=c;else break}return e.descent=d-a,e.fontSize=e.ascent+e.descent,rt._fonts[t]=e,e}static clearMetrics(t=""){t?delete rt._fonts[t]:rt._fonts={}}static get _canvas(){var t;if(!rt.__canvas){let e;try{const i=new OffscreenCanvas(0,0);if((t=i.getContext("2d",Ka))!=null&&t.measureText)return rt.__canvas=i,i;e=$.ADAPTER.createCanvas()}catch{e=$.ADAPTER.createCanvas()}e.width=e.height=10,rt.__canvas=e}return rt.__canvas}static get _context(){return rt.__context||(rt.__context=rt._canvas.getContext("2d",Ka)),rt.__context}};Ii.METRICS_STRING="|ÉqÅ",Ii.BASELINE_SYMBOL="M",Ii.BASELINE_MULTIPLIER=1.4,Ii.HEIGHT_MULTIPLIER=2,Ii.graphemeSegmenter=(()=>{if(typeof(Intl==null?void 0:Intl.Segmenter)=="function"){const r=new Intl.Segmenter;return t=>[...r.segment(t)].map(e=>e.segment)}return r=>[...r]})(),Ii.experimentalLetterSpacing=!1,Ii._fonts={},Ii._newlines=[10,13],Ii._breakingSpaces=[9,32,8192,8193,8194,8195,8196,8197,8198,8200,8201,8202,8287,12288];let Tr=Ii;const uS=["serif","sans-serif","monospace","cursive","fantasy","system-ui"],yg=class Vo{constructor(t){this.styleID=0,this.reset(),zu(this,t,t)}clone(){const t={};return zu(t,this,Vo.defaultStyle),new Vo(t)}reset(){zu(this,Vo.defaultStyle,Vo.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=Yu(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=Yu(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){cS(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=Yu(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=typeof this.fontSize=="number"?`${this.fontSize}px`:this.fontSize;let e=this.fontFamily;Array.isArray(this.fontFamily)||(e=this.fontFamily.split(","));for(let i=e.length-1;i>=0;i--){let s=e[i].trim();!/([\"\'])[^\'\"]+\1/.test(s)&&!uS.includes(s)&&(s=`"${s}"`),e[i]=s}return`${this.fontStyle} ${this.fontVariant} ${this.fontWeight} ${t} ${e.join(",")}`}};yg.defaultStyle={align:"left",breakWords:!1,dropShadow:!1,dropShadowAlpha:1,dropShadowAngle:Math.PI/6,dropShadowBlur:0,dropShadowColor:"black",dropShadowDistance:5,fill:"black",fillGradientType:Ha.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};let wr=yg;function Yu(r){const t=Lt.shared,e=i=>{const s=t.setValue(i);return s.alpha===1?s.toHex():s.toRgbaString()};return Array.isArray(r)?r.map(e):e(r)}function cS(r,t){if(!Array.isArray(r)||!Array.isArray(t)||r.length!==t.length)return!1;for(let e=0;e<r.length;++e)if(r[e]!==t[e])return!1;return!0}function zu(r,t,e){for(const i in e)Array.isArray(t[i])?r[i]=t[i].slice():r[i]=t[i]}const dS={texture:!0,children:!1,baseTexture:!0},bg=class pp extends ie{constructor(t,e,i){let s=!1;i||(i=$.ADAPTER.createCanvas(),s=!0),i.width=3,i.height=3;const n=it.from(i);n.orig=new ct,n.trim=new ct,super(n),this._ownCanvas=s,this.canvas=i,this.context=i.getContext("2d",{willReadFrequently:!0}),this._resolution=pp.defaultResolution??$.RESOLUTION,this._autoResolution=pp.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 Tr.experimentalLetterSpacing}static set experimentalLetterSpacing(t){xt("7.1.0","Text.experimentalLetterSpacing is deprecated, use TextMetrics.experimentalLetterSpacing"),Tr.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 i=this.context,s=Tr.measureText(this._text||" ",this._style,this._style.wordWrap,this.canvas),n=s.width,o=s.height,a=s.lines,h=s.lineHeight,l=s.lineWidths,u=s.maxLineWidth,c=s.fontProperties;this.canvas.width=Math.ceil(Math.ceil(Math.max(1,n)+e.padding*2)*this._resolution),this.canvas.height=Math.ceil(Math.ceil(Math.max(1,o)+e.padding*2)*this._resolution),i.scale(this._resolution,this._resolution),i.clearRect(0,0,this.canvas.width,this.canvas.height),i.font=this._font,i.lineWidth=e.strokeThickness,i.textBaseline=e.textBaseline,i.lineJoin=e.lineJoin,i.miterLimit=e.miterLimit;let d,p;const m=e.dropShadow?2:1;for(let f=0;f<m;++f){const g=e.dropShadow&&f===0,y=g?Math.ceil(Math.max(1,o)+e.padding*2):0,_=y*this._resolution;if(g){i.fillStyle="black",i.strokeStyle="black";const v=e.dropShadowColor,S=e.dropShadowBlur*this._resolution,C=e.dropShadowDistance*this._resolution;i.shadowColor=Lt.shared.setValue(v).setAlpha(e.dropShadowAlpha).toRgbaString(),i.shadowBlur=S,i.shadowOffsetX=Math.cos(e.dropShadowAngle)*C,i.shadowOffsetY=Math.sin(e.dropShadowAngle)*C+_}else i.fillStyle=this._generateFillStyle(e,a,s),i.strokeStyle=e.stroke,i.shadowColor="black",i.shadowBlur=0,i.shadowOffsetX=0,i.shadowOffsetY=0;let x=(h-c.fontSize)/2;h-c.fontSize<0&&(x=0);for(let v=0;v<a.length;v++)d=e.strokeThickness/2,p=e.strokeThickness/2+v*h+c.ascent+x,e.align==="right"?d+=u-l[v]:e.align==="center"&&(d+=(u-l[v])/2),e.stroke&&e.strokeThickness&&this.drawLetterSpacing(a[v],d+e.padding,p+e.padding-y,!0),e.fill&&this.drawLetterSpacing(a[v],d+e.padding,p+e.padding-y)}this.updateTexture()}drawLetterSpacing(t,e,i,s=!1){const n=this._style.letterSpacing;let o=!1;if(Tr.experimentalLetterSpacingSupported&&(Tr.experimentalLetterSpacing?(this.context.letterSpacing=`${n}px`,this.context.textLetterSpacing=`${n}px`,o=!0):(this.context.letterSpacing="0px",this.context.textLetterSpacing="0px")),n===0||o){s?this.context.strokeText(t,e,i):this.context.fillText(t,e,i);return}let a=e;const h=Tr.graphemeSegmenter(t);let l=this.context.measureText(t).width,u=0;for(let c=0;c<h.length;++c){const d=h[c];s?this.context.strokeText(d,a,i):this.context.fillText(d,a,i);let p="";for(let m=c+1;m<h.length;++m)p+=h[m];u=this.context.measureText(p).width,a+=l-u+n,l=u}}updateTexture(){const t=this.canvas;if(this._style.trim){const o=L1(t);o.data&&(t.width=o.width,t.height=o.height,this.context.putImageData(o.data,0,0))}const e=this._texture,i=this._style,s=i.trim?0:i.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=-s,e.trim.y=-s,e.orig.width=e._frame.width-s*2,e.orig.height=e._frame.height-s*2,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),this._textureID===-1&&(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,i){const s=t.fill;if(Array.isArray(s)){if(s.length===1)return s[0]}else return s;let n;const o=t.dropShadow?t.dropShadowDistance:0,a=t.padding||0,h=this.canvas.width/this._resolution-o-a*2,l=this.canvas.height/this._resolution-o-a*2,u=s.slice(),c=t.fillGradientStops.slice();if(!c.length){const d=u.length+1;for(let p=1;p<d;++p)c.push(p/d)}if(u.unshift(s[0]),c.unshift(0),u.push(s[s.length-1]),c.push(1),t.fillGradientType===Ha.LINEAR_VERTICAL){n=this.context.createLinearGradient(h/2,a,h/2,l+a);const d=i.fontProperties.fontSize+t.strokeThickness;for(let p=0;p<e.length;p++){const m=i.lineHeight*(p-1)+d,f=i.lineHeight*p;let g=f;p>0&&m>f&&(g=(f+m)/2);const y=f+d,_=i.lineHeight*(p+1);let x=y;p+1<e.length&&_<y&&(x=(y+_)/2);const v=(x-g)/l;for(let S=0;S<u.length;S++){let C=0;typeof c[S]=="number"?C=c[S]:C=S/u.length;let A=Math.min(1,Math.max(0,g/l+C*v));A=Number(A.toFixed(5)),n.addColorStop(A,u[S])}}}else{n=this.context.createLinearGradient(a,l/2,h+a,l/2);const d=u.length+1;let p=1;for(let m=0;m<u.length;m++){let f;typeof c[m]=="number"?f=c[m]:f=p/d,n.addColorStop(f,u[m]),p++}}return n}destroy(t){typeof t=="boolean"&&(t={children:t}),t=Object.assign({},dS,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=mr(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=mr(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||{},t instanceof wr?this._style=t:this._style=new wr(t),this.localStyleID=-1,this.dirty=!0}get text(){return this._text}set text(t){t=String(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)}};bg.defaultAutoResolution=!0;let xg=bg;class pS{constructor(t){this.maxItemsPerFrame=t,this.itemsLeft=0}beginFrame(){this.itemsLeft=this.maxItemsPerFrame}allowedToUpload(){return this.itemsLeft-- >0}}function fS(r,t){var i;let e=!1;if((i=r==null?void 0:r._textures)!=null&&i.length){for(let s=0;s<r._textures.length;s++)if(r._textures[s]instanceof it){const n=r._textures[s].baseTexture;t.includes(n)||(t.push(n),e=!0)}}return e}function mS(r,t){if(r.baseTexture instanceof ft){const e=r.baseTexture;return t.includes(e)||t.push(e),!0}return!1}function gS(r,t){if(r._texture&&r._texture instanceof it){const e=r._texture.baseTexture;return t.includes(e)||t.push(e),!0}return!1}function yS(r,t){return t instanceof xg?(t.updateText(!0),!0):!1}function bS(r,t){if(t instanceof wr){const e=t.toFontString();return Tr.measureFont(e),!0}return!1}function xS(r,t){if(r instanceof xg){t.includes(r.style)||t.push(r.style),t.includes(r)||t.push(r);const e=r._texture.baseTexture;return t.includes(e)||t.push(e),!0}return!1}function _S(r,t){return r instanceof wr?(t.includes(r)||t.push(r),!0):!1}const _g=class vb{constructor(t){this.limiter=new pS(vb.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(xS),this.registerFindHook(_S),this.registerFindHook(fS),this.registerFindHook(mS),this.registerFindHook(gS),this.registerUploadHook(yS),this.registerUploadHook(bS)}upload(t){return new Promise(e=>{t&&this.add(t),this.queue.length?(this.completes.push(e),this.ticking||(this.ticking=!0,ye.system.addOnce(this.tick,this,qr.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 i=0,s=this.uploadHooks.length;i<s;i++)if(this.uploadHooks[i](this.uploadHookHelper,t)){this.queue.shift(),e=!0;break}}e||this.queue.shift()}if(this.queue.length)ye.system.addOnce(this.tick,this,qr.UTILITY);else{this.ticking=!1;const t=this.completes.slice(0);this.completes.length=0;for(let e=0,i=t.length;e<i;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,i=this.addHooks.length;e<i&&!this.addHooks[e](t,this.queue);e++);if(t instanceof Xt)for(let e=t.children.length-1;e>=0;e--)this.add(t.children[e]);return this}destroy(){this.ticking&&ye.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}};_g.uploadsPerFrame=4;let ju=_g;Object.defineProperties($,{UPLOADS_PER_FRAME:{get(){return ju.uploadsPerFrame},set(r){xt("7.1.0","settings.UPLOADS_PER_FRAME is deprecated, use prepare.BasePrepare.uploadsPerFrame"),ju.uploadsPerFrame=r}}});function vg(r,t){return t instanceof ft?(t._glTextures[r.CONTEXT_UID]||r.texture.bind(t),!0):!1}function vS(r,t){if(!(t instanceof Qn))return!1;const{geometry:e}=t;t.finishPoly(),e.updateBatches();const{batches:i}=e;for(let s=0;s<i.length;s++){const{texture:n}=i[s].style;n&&vg(r,n.baseTexture)}return e.batchable||r.geometry.bind(e,t._resolveDirectShader(r)),!0}function TS(r,t){return r instanceof Qn?(t.push(r),!0):!1}class Tg extends ju{constructor(t){super(t),this.uploadHookHelper=this.renderer,this.registerFindHook(TS),this.registerUploadHook(vg),this.registerUploadHook(vS)}}Tg.extension={name:"prepare",type:z.RendererSystem},tt.add(Tg);var wS=`#version 300 es
|
|
980
|
+
`;class xg extends va{constructor(t){super(t),this.shader=null,this.properties=null,this.tempMatrix=new Nt,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:at.UNSIGNED_BYTE,uploadFunction:this.uploadTint,offset:0}],this.shader=Ei.from(dS,cS,{}),this.state=Si.for2d()}render(t){const e=t.children,i=t._maxSize,s=t._batchSize,n=this.renderer;let o=e.length;if(o===0)return;o>i&&!t.autoResize&&(o=i);let a=t._buffers;a||(a=t._buffers=this.generateBuffers(t));const h=e[0]._texture.baseTexture,l=h.alphaMode>0;this.state.blendMode=Df(t.blendMode,l),n.state.set(this.state);const u=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=Gt.shared.setValue(t.tintRgb).premultiply(t.worldAlpha,l).toArray(this.shader.uniforms.uColor),this.shader.uniforms.uSampler=h,this.renderer.shader.bind(this.shader);let d=!1;for(let p=0,m=0;p<o;p+=s,m+=1){let f=o-p;f>s&&(f=s),m>=a.length&&a.push(this._generateOneMoreBuffer(t));const g=a[m];g.uploadDynamic(e,p,f);const y=t._bufferUpdateIDs[m]||0;d=d||g._updateID<y,d&&(g._updateID=t._updateID,g.uploadStatic(e,p,f)),n.geometry.bind(g.geometry),u.drawElements(u.TRIANGLES,f*6,u.UNSIGNED_SHORT,0)}}generateBuffers(t){const e=[],i=t._maxSize,s=t._batchSize,n=t._properties;for(let o=0;o<i;o+=s)e.push(new bg(this.properties,n,s));return e}_generateOneMoreBuffer(t){const e=t._batchSize,i=t._properties;return new bg(this.properties,i,e)}uploadVertices(t,e,i,s,n,o){let a=0,h=0,l=0,u=0;for(let c=0;c<i;++c){const d=t[e+c],p=d._texture,m=d.scale.x,f=d.scale.y,g=p.trim,y=p.orig;g?(h=g.x-d.anchor.x*y.width,a=h+g.width,u=g.y-d.anchor.y*y.height,l=u+g.height):(a=y.width*(1-d.anchor.x),h=y.width*-d.anchor.x,l=y.height*(1-d.anchor.y),u=y.height*-d.anchor.y),s[o]=h*m,s[o+1]=u*f,s[o+n]=a*m,s[o+n+1]=u*f,s[o+n*2]=a*m,s[o+n*2+1]=l*f,s[o+n*3]=h*m,s[o+n*3+1]=l*f,o+=n*4}}uploadPosition(t,e,i,s,n,o){for(let a=0;a<i;a++){const h=t[e+a].position;s[o]=h.x,s[o+1]=h.y,s[o+n]=h.x,s[o+n+1]=h.y,s[o+n*2]=h.x,s[o+n*2+1]=h.y,s[o+n*3]=h.x,s[o+n*3+1]=h.y,o+=n*4}}uploadRotation(t,e,i,s,n,o){for(let a=0;a<i;a++){const h=t[e+a].rotation;s[o]=h,s[o+n]=h,s[o+n*2]=h,s[o+n*3]=h,o+=n*4}}uploadUvs(t,e,i,s,n,o){for(let a=0;a<i;++a){const h=t[e+a]._texture._uvs;h?(s[o]=h.x0,s[o+1]=h.y0,s[o+n]=h.x1,s[o+n+1]=h.y1,s[o+n*2]=h.x2,s[o+n*2+1]=h.y2,s[o+n*3]=h.x3,s[o+n*3+1]=h.y3,o+=n*4):(s[o]=0,s[o+1]=0,s[o+n]=0,s[o+n+1]=0,s[o+n*2]=0,s[o+n*2+1]=0,s[o+n*3]=0,s[o+n*3+1]=0,o+=n*4)}}uploadTint(t,e,i,s,n,o){for(let a=0;a<i;++a){const h=t[e+a],l=Gt.shared.setValue(h._tintRGB).toPremultiplied(h.alpha,h.texture.baseTexture.alphaMode>0);s[o]=l,s[o+n]=l,s[o+n*2]=l,s[o+n*3]=l,o+=n*4}}destroy(){super.destroy(),this.shader&&(this.shader.destroy(),this.shader=null),this.tempMatrix=null}}xg.extension={name:"particle",type:J.RendererPlugin},et.add(xg);var Ka=(r=>(r[r.LINEAR_VERTICAL=0]="LINEAR_VERTICAL",r[r.LINEAR_HORIZONTAL=1]="LINEAR_HORIZONTAL",r))(Ka||{});const Ya={willReadFrequently:!0},Ci=class st{static get experimentalLetterSpacingSupported(){let t=st._experimentalLetterSpacingSupported;if(t!==void 0){const e=Q.ADAPTER.getCanvasRenderingContext2D().prototype;t=st._experimentalLetterSpacingSupported="letterSpacing"in e||"textLetterSpacing"in e}return t}constructor(t,e,i,s,n,o,a,h,l){this.text=t,this.style=e,this.width=i,this.height=s,this.lines=n,this.lineWidths=o,this.lineHeight=a,this.maxLineWidth=h,this.fontProperties=l}static measureText(t,e,i,s=st._canvas){i=i??e.wordWrap;const n=e.toFontString(),o=st.measureFont(n);o.fontSize===0&&(o.fontSize=e.fontSize,o.ascent=e.fontSize);const a=s.getContext("2d",Ya);a.font=n;const h=(i?st.wordWrap(t,e,s):t).split(/(?:\r\n|\r|\n)/),l=new Array(h.length);let u=0;for(let m=0;m<h.length;m++){const f=st._measureText(h[m],e.letterSpacing,a);l[m]=f,u=Math.max(u,f)}let c=u+e.strokeThickness;e.dropShadow&&(c+=e.dropShadowDistance);const d=e.lineHeight||o.fontSize+e.strokeThickness;let p=Math.max(d,o.fontSize+e.strokeThickness*2)+e.leading+(h.length-1)*(d+e.leading);return e.dropShadow&&(p+=e.dropShadowDistance),new st(t,e,c,p,h,l,d+e.leading,u,o)}static _measureText(t,e,i){let s=!1;st.experimentalLetterSpacingSupported&&(st.experimentalLetterSpacing?(i.letterSpacing=`${e}px`,i.textLetterSpacing=`${e}px`,s=!0):(i.letterSpacing="0px",i.textLetterSpacing="0px"));let n=i.measureText(t).width;return n>0&&(s?n-=e:n+=(st.graphemeSegmenter(t).length-1)*e),n}static wordWrap(t,e,i=st._canvas){const s=i.getContext("2d",Ya);let n=0,o="",a="";const h=Object.create(null),{letterSpacing:l,whiteSpace:u}=e,c=st.collapseSpaces(u),d=st.collapseNewlines(u);let p=!c;const m=e.wordWrapWidth+l,f=st.tokenize(t);for(let g=0;g<f.length;g++){let y=f[g];if(st.isNewline(y)){if(!d){a+=st.addLine(o),p=!c,o="",n=0;continue}y=" "}if(c){const b=st.isBreakingSpace(y),v=st.isBreakingSpace(o[o.length-1]);if(b&&v)continue}const _=st.getFromCache(y,l,h,s);if(_>m)if(o!==""&&(a+=st.addLine(o),o="",n=0),st.canBreakWords(y,e.breakWords)){const b=st.wordWrapSplit(y);for(let v=0;v<b.length;v++){let S=b[v],E=S,A=1;for(;b[v+A];){const P=b[v+A];if(!st.canBreakChars(E,P,y,v,e.breakWords))S+=P;else break;E=P,A++}v+=A-1;const I=st.getFromCache(S,l,h,s);I+n>m&&(a+=st.addLine(o),p=!1,o="",n=0),o+=S,n+=I}}else{o.length>0&&(a+=st.addLine(o),o="",n=0);const b=g===f.length-1;a+=st.addLine(y,!b),p=!1,o="",n=0}else _+n>m&&(p=!1,a+=st.addLine(o),o="",n=0),(o.length>0||!st.isBreakingSpace(y)||p)&&(o+=y,n+=_)}return a+=st.addLine(o,!1),a}static addLine(t,e=!0){return t=st.trimRight(t),t=e?`${t}
|
|
981
|
+
`:t,t}static getFromCache(t,e,i,s){let n=i[t];return typeof n!="number"&&(n=st._measureText(t,e,s)+e,i[t]=n),n}static collapseSpaces(t){return t==="normal"||t==="pre-line"}static collapseNewlines(t){return t==="normal"}static trimRight(t){if(typeof t!="string")return"";for(let e=t.length-1;e>=0;e--){const i=t[e];if(!st.isBreakingSpace(i))break;t=t.slice(0,-1)}return t}static isNewline(t){return typeof t!="string"?!1:st._newlines.includes(t.charCodeAt(0))}static isBreakingSpace(t,e){return typeof t!="string"?!1:st._breakingSpaces.includes(t.charCodeAt(0))}static tokenize(t){const e=[];let i="";if(typeof t!="string")return e;for(let s=0;s<t.length;s++){const n=t[s],o=t[s+1];if(st.isBreakingSpace(n,o)||st.isNewline(n)){i!==""&&(e.push(i),i=""),e.push(n);continue}i+=n}return i!==""&&e.push(i),e}static canBreakWords(t,e){return e}static canBreakChars(t,e,i,s,n){return!0}static wordWrapSplit(t){return st.graphemeSegmenter(t)}static measureFont(t){if(st._fonts[t])return st._fonts[t];const e={ascent:0,descent:0,fontSize:0},i=st._canvas,s=st._context;s.font=t;const n=st.METRICS_STRING+st.BASELINE_SYMBOL,o=Math.ceil(s.measureText(n).width);let a=Math.ceil(s.measureText(st.BASELINE_SYMBOL).width);const h=Math.ceil(st.HEIGHT_MULTIPLIER*a);if(a=a*st.BASELINE_MULTIPLIER|0,o===0||h===0)return st._fonts[t]=e,e;i.width=o,i.height=h,s.fillStyle="#f00",s.fillRect(0,0,o,h),s.font=t,s.textBaseline="alphabetic",s.fillStyle="#000",s.fillText(n,0,a);const l=s.getImageData(0,0,o,h).data,u=l.length,c=o*4;let d=0,p=0,m=!1;for(d=0;d<a;++d){for(let f=0;f<c;f+=4)if(l[p+f]!==255){m=!0;break}if(!m)p+=c;else break}for(e.ascent=a-d,p=u-c,m=!1,d=h;d>a;--d){for(let f=0;f<c;f+=4)if(l[p+f]!==255){m=!0;break}if(!m)p-=c;else break}return e.descent=d-a,e.fontSize=e.ascent+e.descent,st._fonts[t]=e,e}static clearMetrics(t=""){t?delete st._fonts[t]:st._fonts={}}static get _canvas(){var t;if(!st.__canvas){let e;try{const i=new OffscreenCanvas(0,0);if((t=i.getContext("2d",Ya))!=null&&t.measureText)return st.__canvas=i,i;e=Q.ADAPTER.createCanvas()}catch{e=Q.ADAPTER.createCanvas()}e.width=e.height=10,st.__canvas=e}return st.__canvas}static get _context(){return st.__context||(st.__context=st._canvas.getContext("2d",Ya)),st.__context}};Ci.METRICS_STRING="|ÉqÅ",Ci.BASELINE_SYMBOL="M",Ci.BASELINE_MULTIPLIER=1.4,Ci.HEIGHT_MULTIPLIER=2,Ci.graphemeSegmenter=(()=>{if(typeof(Intl==null?void 0:Intl.Segmenter)=="function"){const r=new Intl.Segmenter;return t=>[...r.segment(t)].map(e=>e.segment)}return r=>[...r]})(),Ci.experimentalLetterSpacing=!1,Ci._fonts={},Ci._newlines=[10,13],Ci._breakingSpaces=[9,32,8192,8193,8194,8195,8196,8197,8198,8200,8201,8202,8287,12288];let Sr=Ci;const pS=["serif","sans-serif","monospace","cursive","fantasy","system-ui"],_g=class Ho{constructor(t){this.styleID=0,this.reset(),zu(this,t,t)}clone(){const t={};return zu(t,this,Ho.defaultStyle),new Ho(t)}reset(){zu(this,Ho.defaultStyle,Ho.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=Yu(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=Yu(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){fS(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=Yu(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=typeof this.fontSize=="number"?`${this.fontSize}px`:this.fontSize;let e=this.fontFamily;Array.isArray(this.fontFamily)||(e=this.fontFamily.split(","));for(let i=e.length-1;i>=0;i--){let s=e[i].trim();!/([\"\'])[^\'\"]+\1/.test(s)&&!pS.includes(s)&&(s=`"${s}"`),e[i]=s}return`${this.fontStyle} ${this.fontVariant} ${this.fontWeight} ${t} ${e.join(",")}`}};_g.defaultStyle={align:"left",breakWords:!1,dropShadow:!1,dropShadowAlpha:1,dropShadowAngle:Math.PI/6,dropShadowBlur:0,dropShadowColor:"black",dropShadowDistance:5,fill:"black",fillGradientType:Ka.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};let Er=_g;function Yu(r){const t=Gt.shared,e=i=>{const s=t.setValue(i);return s.alpha===1?s.toHex():s.toRgbaString()};return Array.isArray(r)?r.map(e):e(r)}function fS(r,t){if(!Array.isArray(r)||!Array.isArray(t)||r.length!==t.length)return!1;for(let e=0;e<r.length;++e)if(r[e]!==t[e])return!1;return!0}function zu(r,t,e){for(const i in e)Array.isArray(t[i])?r[i]=t[i].slice():r[i]=t[i]}const mS={texture:!0,children:!1,baseTexture:!0},vg=class gp extends ie{constructor(t,e,i){let s=!1;i||(i=Q.ADAPTER.createCanvas(),s=!0),i.width=3,i.height=3;const n=rt.from(i);n.orig=new ct,n.trim=new ct,super(n),this._ownCanvas=s,this.canvas=i,this.context=i.getContext("2d",{willReadFrequently:!0}),this._resolution=gp.defaultResolution??Q.RESOLUTION,this._autoResolution=gp.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 Sr.experimentalLetterSpacing}static set experimentalLetterSpacing(t){vt("7.1.0","Text.experimentalLetterSpacing is deprecated, use TextMetrics.experimentalLetterSpacing"),Sr.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 i=this.context,s=Sr.measureText(this._text||" ",this._style,this._style.wordWrap,this.canvas),n=s.width,o=s.height,a=s.lines,h=s.lineHeight,l=s.lineWidths,u=s.maxLineWidth,c=s.fontProperties;this.canvas.width=Math.ceil(Math.ceil(Math.max(1,n)+e.padding*2)*this._resolution),this.canvas.height=Math.ceil(Math.ceil(Math.max(1,o)+e.padding*2)*this._resolution),i.scale(this._resolution,this._resolution),i.clearRect(0,0,this.canvas.width,this.canvas.height),i.font=this._font,i.lineWidth=e.strokeThickness,i.textBaseline=e.textBaseline,i.lineJoin=e.lineJoin,i.miterLimit=e.miterLimit;let d,p;const m=e.dropShadow?2:1;for(let f=0;f<m;++f){const g=e.dropShadow&&f===0,y=g?Math.ceil(Math.max(1,o)+e.padding*2):0,_=y*this._resolution;if(g){i.fillStyle="black",i.strokeStyle="black";const v=e.dropShadowColor,S=e.dropShadowBlur*this._resolution,E=e.dropShadowDistance*this._resolution;i.shadowColor=Gt.shared.setValue(v).setAlpha(e.dropShadowAlpha).toRgbaString(),i.shadowBlur=S,i.shadowOffsetX=Math.cos(e.dropShadowAngle)*E,i.shadowOffsetY=Math.sin(e.dropShadowAngle)*E+_}else i.fillStyle=this._generateFillStyle(e,a,s),i.strokeStyle=e.stroke,i.shadowColor="black",i.shadowBlur=0,i.shadowOffsetX=0,i.shadowOffsetY=0;let b=(h-c.fontSize)/2;h-c.fontSize<0&&(b=0);for(let v=0;v<a.length;v++)d=e.strokeThickness/2,p=e.strokeThickness/2+v*h+c.ascent+b,e.align==="right"?d+=u-l[v]:e.align==="center"&&(d+=(u-l[v])/2),e.stroke&&e.strokeThickness&&this.drawLetterSpacing(a[v],d+e.padding,p+e.padding-y,!0),e.fill&&this.drawLetterSpacing(a[v],d+e.padding,p+e.padding-y)}this.updateTexture()}drawLetterSpacing(t,e,i,s=!1){const n=this._style.letterSpacing;let o=!1;if(Sr.experimentalLetterSpacingSupported&&(Sr.experimentalLetterSpacing?(this.context.letterSpacing=`${n}px`,this.context.textLetterSpacing=`${n}px`,o=!0):(this.context.letterSpacing="0px",this.context.textLetterSpacing="0px")),n===0||o){s?this.context.strokeText(t,e,i):this.context.fillText(t,e,i);return}let a=e;const h=Sr.graphemeSegmenter(t);let l=this.context.measureText(t).width,u=0;for(let c=0;c<h.length;++c){const d=h[c];s?this.context.strokeText(d,a,i):this.context.fillText(d,a,i);let p="";for(let m=c+1;m<h.length;++m)p+=h[m];u=this.context.measureText(p).width,a+=l-u+n,l=u}}updateTexture(){const t=this.canvas;if(this._style.trim){const o=F1(t);o.data&&(t.width=o.width,t.height=o.height,this.context.putImageData(o.data,0,0))}const e=this._texture,i=this._style,s=i.trim?0:i.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=-s,e.trim.y=-s,e.orig.width=e._frame.width-s*2,e.orig.height=e._frame.height-s*2,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),this._textureID===-1&&(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,i){const s=t.fill;if(Array.isArray(s)){if(s.length===1)return s[0]}else return s;let n;const o=t.dropShadow?t.dropShadowDistance:0,a=t.padding||0,h=this.canvas.width/this._resolution-o-a*2,l=this.canvas.height/this._resolution-o-a*2,u=s.slice(),c=t.fillGradientStops.slice();if(!c.length){const d=u.length+1;for(let p=1;p<d;++p)c.push(p/d)}if(u.unshift(s[0]),c.unshift(0),u.push(s[s.length-1]),c.push(1),t.fillGradientType===Ka.LINEAR_VERTICAL){n=this.context.createLinearGradient(h/2,a,h/2,l+a);const d=i.fontProperties.fontSize+t.strokeThickness;for(let p=0;p<e.length;p++){const m=i.lineHeight*(p-1)+d,f=i.lineHeight*p;let g=f;p>0&&m>f&&(g=(f+m)/2);const y=f+d,_=i.lineHeight*(p+1);let b=y;p+1<e.length&&_<y&&(b=(y+_)/2);const v=(b-g)/l;for(let S=0;S<u.length;S++){let E=0;typeof c[S]=="number"?E=c[S]:E=S/u.length;let A=Math.min(1,Math.max(0,g/l+E*v));A=Number(A.toFixed(5)),n.addColorStop(A,u[S])}}}else{n=this.context.createLinearGradient(a,l/2,h+a,l/2);const d=u.length+1;let p=1;for(let m=0;m<u.length;m++){let f;typeof c[m]=="number"?f=c[m]:f=p/d,n.addColorStop(f,u[m]),p++}}return n}destroy(t){typeof t=="boolean"&&(t={children:t}),t=Object.assign({},mS,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=yr(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=yr(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||{},t instanceof Er?this._style=t:this._style=new Er(t),this.localStyleID=-1,this.dirty=!0}get text(){return this._text}set text(t){t=String(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)}};vg.defaultAutoResolution=!0;let Tg=vg;class gS{constructor(t){this.maxItemsPerFrame=t,this.itemsLeft=0}beginFrame(){this.itemsLeft=this.maxItemsPerFrame}allowedToUpload(){return this.itemsLeft-- >0}}function yS(r,t){var i;let e=!1;if((i=r==null?void 0:r._textures)!=null&&i.length){for(let s=0;s<r._textures.length;s++)if(r._textures[s]instanceof rt){const n=r._textures[s].baseTexture;t.includes(n)||(t.push(n),e=!0)}}return e}function bS(r,t){if(r.baseTexture instanceof ft){const e=r.baseTexture;return t.includes(e)||t.push(e),!0}return!1}function xS(r,t){if(r._texture&&r._texture instanceof rt){const e=r._texture.baseTexture;return t.includes(e)||t.push(e),!0}return!1}function _S(r,t){return t instanceof Tg?(t.updateText(!0),!0):!1}function vS(r,t){if(t instanceof Er){const e=t.toFontString();return Sr.measureFont(e),!0}return!1}function TS(r,t){if(r instanceof Tg){t.includes(r.style)||t.push(r.style),t.includes(r)||t.push(r);const e=r._texture.baseTexture;return t.includes(e)||t.push(e),!0}return!1}function wS(r,t){return r instanceof Er?(t.includes(r)||t.push(r),!0):!1}const wg=class Sb{constructor(t){this.limiter=new gS(Sb.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(TS),this.registerFindHook(wS),this.registerFindHook(yS),this.registerFindHook(bS),this.registerFindHook(xS),this.registerUploadHook(_S),this.registerUploadHook(vS)}upload(t){return new Promise(e=>{t&&this.add(t),this.queue.length?(this.completes.push(e),this.ticking||(this.ticking=!0,be.system.addOnce(this.tick,this,is.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 i=0,s=this.uploadHooks.length;i<s;i++)if(this.uploadHooks[i](this.uploadHookHelper,t)){this.queue.shift(),e=!0;break}}e||this.queue.shift()}if(this.queue.length)be.system.addOnce(this.tick,this,is.UTILITY);else{this.ticking=!1;const t=this.completes.slice(0);this.completes.length=0;for(let e=0,i=t.length;e<i;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,i=this.addHooks.length;e<i&&!this.addHooks[e](t,this.queue);e++);if(t instanceof Xt)for(let e=t.children.length-1;e>=0;e--)this.add(t.children[e]);return this}destroy(){this.ticking&&be.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}};wg.uploadsPerFrame=4;let ju=wg;Object.defineProperties(Q,{UPLOADS_PER_FRAME:{get(){return ju.uploadsPerFrame},set(r){vt("7.1.0","settings.UPLOADS_PER_FRAME is deprecated, use prepare.BasePrepare.uploadsPerFrame"),ju.uploadsPerFrame=r}}});function Sg(r,t){return t instanceof ft?(t._glTextures[r.CONTEXT_UID]||r.texture.bind(t),!0):!1}function SS(r,t){if(!(t instanceof qn))return!1;const{geometry:e}=t;t.finishPoly(),e.updateBatches();const{batches:i}=e;for(let s=0;s<i.length;s++){const{texture:n}=i[s].style;n&&Sg(r,n.baseTexture)}return e.batchable||r.geometry.bind(e,t._resolveDirectShader(r)),!0}function ES(r,t){return r instanceof qn?(t.push(r),!0):!1}class Eg extends ju{constructor(t){super(t),this.uploadHookHelper=this.renderer,this.registerFindHook(ES),this.registerUploadHook(Sg),this.registerUploadHook(SS)}}Eg.extension={name:"prepare",type:J.RendererSystem},et.add(Eg);var CS=`#version 300 es
|
|
982
982
|
#define SHADER_NAME Tiling-Sprite-100
|
|
983
983
|
|
|
984
984
|
precision lowp float;
|
|
@@ -1004,7 +1004,7 @@ void main(void)
|
|
|
1004
1004
|
|
|
1005
1005
|
fragmentColor = texSample * uColor;
|
|
1006
1006
|
}
|
|
1007
|
-
`,
|
|
1007
|
+
`,IS=`#version 300 es
|
|
1008
1008
|
#define SHADER_NAME Tiling-Sprite-300
|
|
1009
1009
|
|
|
1010
1010
|
precision lowp float;
|
|
@@ -1024,7 +1024,7 @@ void main(void)
|
|
|
1024
1024
|
|
|
1025
1025
|
vTextureCoord = (uTransform * vec3(aTextureCoord, 1.0)).xy;
|
|
1026
1026
|
}
|
|
1027
|
-
`,
|
|
1027
|
+
`,AS=`#version 100
|
|
1028
1028
|
#ifdef GL_EXT_shader_texture_lod
|
|
1029
1029
|
#extension GL_EXT_shader_texture_lod : enable
|
|
1030
1030
|
#endif
|
|
@@ -1057,7 +1057,7 @@ void main(void)
|
|
|
1057
1057
|
|
|
1058
1058
|
gl_FragColor = texSample * uColor;
|
|
1059
1059
|
}
|
|
1060
|
-
`,
|
|
1060
|
+
`,Cg=`#version 100
|
|
1061
1061
|
#define SHADER_NAME Tiling-Sprite-100
|
|
1062
1062
|
|
|
1063
1063
|
precision lowp float;
|
|
@@ -1077,7 +1077,7 @@ void main(void)
|
|
|
1077
1077
|
|
|
1078
1078
|
vTextureCoord = (uTransform * vec3(aTextureCoord, 1.0)).xy;
|
|
1079
1079
|
}
|
|
1080
|
-
`,
|
|
1080
|
+
`,MS=`#version 100
|
|
1081
1081
|
#define SHADER_NAME Tiling-Sprite-Simple-100
|
|
1082
1082
|
|
|
1083
1083
|
precision lowp float;
|
|
@@ -1092,7 +1092,7 @@ void main(void)
|
|
|
1092
1092
|
vec4 texSample = texture2D(uSampler, vTextureCoord);
|
|
1093
1093
|
gl_FragColor = texSample * uColor;
|
|
1094
1094
|
}
|
|
1095
|
-
`;const Ya=new Gt;class Sg extends _a{constructor(t){super(t),t.runners.contextChange.add(this),this.quad=new om,this.state=Ei.for2d()}contextChange(){const t=this.renderer,e={globals:t.globalUniforms};this.simpleShader=Ci.from(wg,CS,e),this.shader=t.context.webGLVersion>1?Ci.from(SS,wS,e):Ci.from(wg,ES,e)}render(t){const e=this.renderer,i=this.quad;let s=i.vertices;s[0]=s[6]=t._width*-t.anchor.x,s[1]=s[3]=t._height*-t.anchor.y,s[2]=s[4]=t._width*(1-t.anchor.x),s[5]=s[7]=t._height*(1-t.anchor.y);const n=t.uvRespectAnchor?t.anchor.x:0,o=t.uvRespectAnchor?t.anchor.y:0;s=i.uvs,s[0]=s[6]=-n,s[1]=s[3]=-o,s[2]=s[4]=1-n,s[5]=s[7]=1-o,i.invalidate();const a=t._texture,h=a.baseTexture,l=h.alphaMode>0,u=t.tileTransform.localTransform,c=t.uvMatrix;let d=h.isPowerOfTwo&&a.frame.width===h.width&&a.frame.height===h.height;d&&(h._glTextures[e.CONTEXT_UID]?d=h.wrapMode!==Hi.CLAMP:h.wrapMode===Hi.CLAMP&&(h.wrapMode=Hi.REPEAT));const p=d?this.simpleShader:this.shader,m=a.width,f=a.height,g=t._width,y=t._height;Ya.set(u.a*m/g,u.b*m/y,u.c*f/g,u.d*f/y,u.tx/g,u.ty/y),Ya.invert(),d?Ya.prepend(c.mapCoord):(p.uniforms.uMapCoord=c.mapCoord.toArray(!0),p.uniforms.uClampFrame=c.uClampFrame,p.uniforms.uClampOffset=c.uClampOffset),p.uniforms.uTransform=Ya.toArray(!0),p.uniforms.uColor=Lt.shared.setValue(t.tint).premultiply(t.worldAlpha,l).toArray(p.uniforms.uColor),p.uniforms.translationMatrix=t.transform.worldTransform.toArray(!0),p.uniforms.uSampler=a,e.shader.bind(p),e.geometry.bind(i),this.state.blendMode=Gf(t.blendMode,l),e.state.set(this.state),e.geometry.draw(this.renderer.gl.TRIANGLES,6,0)}}Sg.extension={name:"tilingSprite",type:z.RendererPlugin},tt.add(Sg);const Eg=class Ho{constructor(t,e,i=null){this.linkedSheets=[],this._texture=t instanceof it?t:null,this.baseTexture=t instanceof ft?t:this._texture.baseTexture,this.textures={},this.animations={},this.data=e;const s=this.baseTexture.resource;this.resolution=this._updateResolution(i||(s?s.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 i=$i(t,null);return i===null&&(i=parseFloat(e??"1")),i!==1&&this.baseTexture.setResolution(i),i}parse(){return new Promise(t=>{this._callback=t,this._batchIndex=0,this._frameKeys.length<=Ho.BATCH_SIZE?(this._processFrames(0),this._processAnimations(),this._parseComplete()):this._nextBatch()})}_processFrames(t){let e=t;const i=Ho.BATCH_SIZE;for(;e-t<i&&e<this._frameKeys.length;){const s=this._frameKeys[e],n=this._frames[s],o=n.frame;if(o){let a=null,h=null;const l=n.trimmed!==!1&&n.sourceSize?n.sourceSize:n.frame,u=new ct(0,0,Math.floor(l.w)/this.resolution,Math.floor(l.h)/this.resolution);n.rotated?a=new ct(Math.floor(o.x)/this.resolution,Math.floor(o.y)/this.resolution,Math.floor(o.h)/this.resolution,Math.floor(o.w)/this.resolution):a=new ct(Math.floor(o.x)/this.resolution,Math.floor(o.y)/this.resolution,Math.floor(o.w)/this.resolution,Math.floor(o.h)/this.resolution),n.trimmed!==!1&&n.spriteSourceSize&&(h=new ct(Math.floor(n.spriteSourceSize.x)/this.resolution,Math.floor(n.spriteSourceSize.y)/this.resolution,Math.floor(o.w)/this.resolution,Math.floor(o.h)/this.resolution)),this.textures[s]=new it(this.baseTexture,a,u,h,n.rotated?2:0,n.anchor,n.borders),it.addToCache(this.textures[s],s.toString())}e++}}_processAnimations(){const t=this.data.animations||{};for(const e in t){this.animations[e]=[];for(let i=0;i<t[e].length;i++){const s=t[e][i];this.animations[e].push(this.textures[s])}}}_parseComplete(){const t=this._callback;this._callback=null,this._batchIndex=0,t.call(this,this.textures)}_nextBatch(){this._processFrames(this._batchIndex*Ho.BATCH_SIZE),this._batchIndex++,setTimeout(()=>{this._batchIndex*Ho.BATCH_SIZE<this._frameKeys.length?this._nextBatch():(this._processAnimations(),this._parseComplete())},0)}destroy(t=!1){var e;for(const i in this.textures)this.textures[i].destroy();this._frames=null,this._frameKeys=null,this.data=null,this.textures=null,t&&((e=this._texture)==null||e.destroy(),this.baseTexture.destroy()),this._texture=null,this.baseTexture=null,this.linkedSheets=[]}};Eg.BATCH_SIZE=1e3;let Cg=Eg;const IS=["jpg","png","jpeg","avif","webp"];function Ig(r,t,e){const i={};if(r.forEach(s=>{i[s]=t}),Object.keys(t.textures).forEach(s=>{i[s]=t.textures[s]}),!e){const s=Jt.dirname(r[0]);t.linkedSheets.forEach((n,o)=>{const a=Ig([`${s}/${t.data.meta.related_multi_packs[o]}`],n,!0);Object.assign(i,a)})}return i}const AS={extension:z.Asset,cache:{test:r=>r instanceof Cg,getCacheableAssets:(r,t)=>Ig(r,t,!1)},resolver:{test:r=>{const t=r.split("?")[0].split("."),e=t.pop(),i=t.pop();return e==="json"&&IS.includes(i)},parse:r=>{var e;const t=r.split(".");return{resolution:parseFloat(((e=$.RETINA_PREFIX.exec(r))==null?void 0:e[1])??"1"),format:t[t.length-2],src:r}}},loader:{name:"spritesheetLoader",extension:{type:z.LoadParser,priority:ni.Normal},async testParse(r,t){return Jt.extname(t.src).toLowerCase()===".json"&&!!r.frames},async parse(r,t,e){var h,l;let i=Jt.dirname(t.src);i&&i.lastIndexOf("/")!==i.length-1&&(i+="/");let s=i+r.meta.image;s=Lu(s,t.src);const n=(await e.load([s]))[s],o=new Cg(n.baseTexture,r,t.src);await o.parse();const a=(h=r==null?void 0:r.meta)==null?void 0:h.related_multi_packs;if(Array.isArray(a)){const u=[];for(const d of a){if(typeof d!="string")continue;let p=i+d;(l=t.data)!=null&&l.ignoreMultiPack||(p=Lu(p,t.src),u.push(e.load({src:p,data:{ignoreMultiPack:!0}})))}const c=await Promise.all(u);o.linkedSheets=c,c.forEach(d=>{d.linkedSheets=[o].concat(o.linkedSheets.filter(p=>p!==d))})}return o},unload(r){r.destroy(!0)}}};tt.add(AS);class za{constructor(){this.info=[],this.common=[],this.page=[],this.char=[],this.kerning=[],this.distanceField=[]}}class ja{static test(t){return typeof t=="string"&&t.startsWith("info face=")}static parse(t){const e=t.match(/^[a-z]+\s+.+$/gm),i={info:[],common:[],page:[],char:[],chars:[],kerning:[],kernings:[],distanceField:[]};for(const n in e){const o=e[n].match(/^[a-z]+/gm)[0],a=e[n].match(/[a-zA-Z]+=([^\s"']+|"([^"]*)")/gm),h={};for(const l in a){const u=a[l].split("="),c=u[0],d=u[1].replace(/"/gm,""),p=parseFloat(d),m=isNaN(p)?d:p;h[c]=m}i[o].push(h)}const s=new za;return i.info.forEach(n=>s.info.push({face:n.face,size:parseInt(n.size,10)})),i.common.forEach(n=>s.common.push({lineHeight:parseInt(n.lineHeight,10)})),i.page.forEach(n=>s.page.push({id:parseInt(n.id,10),file:n.file})),i.char.forEach(n=>s.char.push({id:parseInt(n.id,10),page:parseInt(n.page,10),x:parseInt(n.x,10),y:parseInt(n.y,10),width:parseInt(n.width,10),height:parseInt(n.height,10),xoffset:parseInt(n.xoffset,10),yoffset:parseInt(n.yoffset,10),xadvance:parseInt(n.xadvance,10)})),i.kerning.forEach(n=>s.kerning.push({first:parseInt(n.first,10),second:parseInt(n.second,10),amount:parseInt(n.amount,10)})),i.distanceField.forEach(n=>s.distanceField.push({distanceRange:parseInt(n.distanceRange,10),fieldType:n.fieldType})),s}}class Ju{static test(t){const e=t;return typeof t!="string"&&"getElementsByTagName"in t&&e.getElementsByTagName("page").length&&e.getElementsByTagName("info")[0].getAttribute("face")!==null}static parse(t){const e=new za,i=t.getElementsByTagName("info"),s=t.getElementsByTagName("common"),n=t.getElementsByTagName("page"),o=t.getElementsByTagName("char"),a=t.getElementsByTagName("kerning"),h=t.getElementsByTagName("distanceField");for(let l=0;l<i.length;l++)e.info.push({face:i[l].getAttribute("face"),size:parseInt(i[l].getAttribute("size"),10)});for(let l=0;l<s.length;l++)e.common.push({lineHeight:parseInt(s[l].getAttribute("lineHeight"),10)});for(let l=0;l<n.length;l++)e.page.push({id:parseInt(n[l].getAttribute("id"),10)||0,file:n[l].getAttribute("file")});for(let l=0;l<o.length;l++){const u=o[l];e.char.push({id:parseInt(u.getAttribute("id"),10),page:parseInt(u.getAttribute("page"),10)||0,x:parseInt(u.getAttribute("x"),10),y:parseInt(u.getAttribute("y"),10),width:parseInt(u.getAttribute("width"),10),height:parseInt(u.getAttribute("height"),10),xoffset:parseInt(u.getAttribute("xoffset"),10),yoffset:parseInt(u.getAttribute("yoffset"),10),xadvance:parseInt(u.getAttribute("xadvance"),10)})}for(let l=0;l<a.length;l++)e.kerning.push({first:parseInt(a[l].getAttribute("first"),10),second:parseInt(a[l].getAttribute("second"),10),amount:parseInt(a[l].getAttribute("amount"),10)});for(let l=0;l<h.length;l++)e.distanceField.push({fieldType:h[l].getAttribute("fieldType"),distanceRange:parseInt(h[l].getAttribute("distanceRange"),10)});return e}}class $u{static test(t){return typeof t=="string"&&t.includes("<font>")?Ju.test($.ADAPTER.parseXML(t)):!1}static parse(t){return Ju.parse($.ADAPTER.parseXML(t))}}const Qu=[ja,Ju,$u];function MS(r){for(let t=0;t<Qu.length;t++)if(Qu[t].test(r))return Qu[t];return null}function RS(r,t,e,i,s,n){const o=e.fill;if(Array.isArray(o)){if(o.length===1)return o[0]}else return o;let a;const h=e.dropShadow?e.dropShadowDistance:0,l=e.padding||0,u=r.width/i-h-l*2,c=r.height/i-h-l*2,d=o.slice(),p=e.fillGradientStops.slice();if(!p.length){const m=d.length+1;for(let f=1;f<m;++f)p.push(f/m)}if(d.unshift(o[0]),p.unshift(0),d.push(o[o.length-1]),p.push(1),e.fillGradientType===Ha.LINEAR_VERTICAL){a=t.createLinearGradient(u/2,l,u/2,c+l);let m=0;const f=(n.fontProperties.fontSize+e.strokeThickness)/c;for(let g=0;g<s.length;g++){const y=n.lineHeight*g;for(let _=0;_<d.length;_++){let x=0;typeof p[_]=="number"?x=p[_]:x=_/d.length;const v=y/c+x*f;let S=Math.max(m,v);S=Math.min(S,1),a.addColorStop(S,d[_]),m=S}}}else{a=t.createLinearGradient(l,c/2,u+l,c/2);const m=d.length+1;let f=1;for(let g=0;g<d.length;g++){let y;typeof p[g]=="number"?y=p[g]:y=f/m,a.addColorStop(y,d[g]),f++}}return a}function PS(r,t,e,i,s,n,o){const a=e.text,h=e.fontProperties;t.translate(i,s),t.scale(n,n);const l=o.strokeThickness/2,u=-(o.strokeThickness/2);if(t.font=o.toFontString(),t.lineWidth=o.strokeThickness,t.textBaseline=o.textBaseline,t.lineJoin=o.lineJoin,t.miterLimit=o.miterLimit,t.fillStyle=RS(r,t,o,n,[a],e),t.strokeStyle=o.stroke,o.dropShadow){const c=o.dropShadowColor,d=o.dropShadowBlur*n,p=o.dropShadowDistance*n;t.shadowColor=Lt.shared.setValue(c).setAlpha(o.dropShadowAlpha).toRgbaString(),t.shadowBlur=d,t.shadowOffsetX=Math.cos(o.dropShadowAngle)*p,t.shadowOffsetY=Math.sin(o.dropShadowAngle)*p}else t.shadowColor="black",t.shadowBlur=0,t.shadowOffsetX=0,t.shadowOffsetY=0;o.stroke&&o.strokeThickness&&t.strokeText(a,l,u+e.lineHeight-h.descent),o.fill&&t.fillText(a,l,u+e.lineHeight-h.descent),t.setTransform(1,0,0,1,0,0),t.fillStyle="rgba(0, 0, 0, 0)"}function Ja(r){return r.codePointAt?r.codePointAt(0):r.charCodeAt(0)}function Ag(r){return Array.from?Array.from(r):r.split("")}function LS(r){typeof r=="string"&&(r=[r]);const t=[];for(let e=0,i=r.length;e<i;e++){const s=r[e];if(Array.isArray(s)){if(s.length!==2)throw new Error(`[BitmapFont]: Invalid character range length, expecting 2 got ${s.length}.`);const n=s[0].charCodeAt(0),o=s[1].charCodeAt(0);if(o<n)throw new Error("[BitmapFont]: Invalid character range.");for(let a=n,h=o;a<=h;a++)t.push(String.fromCharCode(a))}else t.push(...Ag(s))}if(t.length===0)throw new Error("[BitmapFont]: Empty set when resolving characters.");return t}const Sr=class Xi{constructor(t,e,i){var u;const[s]=t.info,[n]=t.common,[o]=t.page,[a]=t.distanceField,h=$i(o.file),l={};this._ownsTextures=i,this.font=s.face,this.size=s.size,this.lineHeight=n.lineHeight/h,this.chars={},this.pageTextures=l;for(let c=0;c<t.page.length;c++){const{id:d,file:p}=t.page[c];l[d]=e instanceof Array?e[c]:e[p],a!=null&&a.fieldType&&a.fieldType!=="none"&&(l[d].baseTexture.alphaMode=be.NO_PREMULTIPLIED_ALPHA,l[d].baseTexture.mipmap=bi.OFF)}for(let c=0;c<t.char.length;c++){const{id:d,page:p}=t.char[c];let{x:m,y:f,width:g,height:y,xoffset:_,yoffset:x,xadvance:v}=t.char[c];m/=h,f/=h,g/=h,y/=h,_/=h,x/=h,v/=h;const S=new ct(m+l[p].frame.x/h,f+l[p].frame.y/h,g,y);this.chars[d]={xOffset:_,yOffset:x,xAdvance:v,kerning:{},texture:new it(l[p].baseTexture,S),page:p}}for(let c=0;c<t.kerning.length;c++){let{first:d,second:p,amount:m}=t.kerning[c];d/=h,p/=h,m/=h,this.chars[p]&&(this.chars[p].kerning[d]=m)}this.distanceFieldRange=a==null?void 0:a.distanceRange,this.distanceFieldType=((u=a==null?void 0:a.fieldType)==null?void 0:u.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,i){let s;if(t instanceof za)s=t;else{const o=MS(t);if(!o)throw new Error("Unrecognized data format for font.");s=o.parse(t)}e instanceof it&&(e=[e]);const n=new Xi(s,e,i);return Xi.available[n.font]=n,n}static uninstall(t){const e=Xi.available[t];if(!e)throw new Error(`No font found named '${t}'`);e.destroy(),delete Xi.available[t]}static from(t,e,i){if(!t)throw new Error("[BitmapFont] Property `name` is required.");const{chars:s,padding:n,resolution:o,textureWidth:a,textureHeight:h,...l}=Object.assign({},Xi.defaultOptions,i),u=LS(s),c=e instanceof wr?e:new wr(e),d=a,p=new za;p.info[0]={face:c.fontFamily,size:c.fontSize},p.common[0]={lineHeight:c.fontSize};let m=0,f=0,g,y,_,x=0;const v=[];for(let C=0;C<u.length;C++){g||(g=$.ADAPTER.createCanvas(),g.width=a,g.height=h,y=g.getContext("2d"),_=new ft(g,{resolution:o,...l}),v.push(new it(_)),p.page.push({id:v.length-1,file:""}));const A=u[C],I=Tr.measureText(A,c,!1,g),L=I.width,k=Math.ceil(I.height),M=Math.ceil((c.fontStyle==="italic"?2:1)*L);if(f>=h-k*o){if(f===0)throw new Error(`[BitmapFont] textureHeight ${h}px is too small (fontFamily: '${c.fontFamily}', fontSize: ${c.fontSize}px, char: '${A}')`);--C,g=null,y=null,_=null,f=0,m=0,x=0;continue}if(x=Math.max(k+I.fontProperties.descent,x),M*o+m>=d){if(m===0)throw new Error(`[BitmapFont] textureWidth ${a}px is too small (fontFamily: '${c.fontFamily}', fontSize: ${c.fontSize}px, char: '${A}')`);--C,f+=x*o,f=Math.ceil(f),m=0,x=0;continue}PS(g,y,I,m,f,o,c);const G=Ja(I.text);p.char.push({id:G,page:v.length-1,x:m/o,y:f/o,width:M,height:k,xoffset:0,yoffset:0,xadvance:L-(c.dropShadow?c.dropShadowDistance:0)-(c.stroke?c.strokeThickness:0)}),m+=(M+2*n)*o,m=Math.ceil(m)}if(!(i!=null&&i.skipKerning))for(let C=0,A=u.length;C<A;C++){const I=u[C];for(let L=0;L<A;L++){const k=u[L],M=y.measureText(I).width,G=y.measureText(k).width,E=y.measureText(I+k).width-(M+G);E&&p.kerning.push({first:Ja(I),second:Ja(k),amount:E})}}const S=new Xi(p,v,!0);return Xi.available[t]!==void 0&&Xi.uninstall(t),Xi.available[t]=S,S}};Sr.ALPHA=[["a","z"],["A","Z"]," "],Sr.NUMERIC=[["0","9"]],Sr.ALPHANUMERIC=[["a","z"],["A","Z"],["0","9"]," "],Sr.ASCII=[[" ","~"]],Sr.defaultOptions={resolution:1,textureWidth:512,textureHeight:512,padding:4,chars:Sr.ALPHANUMERIC},Sr.available={};let ai=Sr;var GS=`// Pixi texture info\r
|
|
1095
|
+
`;const za=new Nt;class Ig extends va{constructor(t){super(t),t.runners.contextChange.add(this),this.quad=new lm,this.state=Si.for2d()}contextChange(){const t=this.renderer,e={globals:t.globalUniforms};this.simpleShader=Ei.from(Cg,MS,e),this.shader=t.context.webGLVersion>1?Ei.from(IS,CS,e):Ei.from(Cg,AS,e)}render(t){const e=this.renderer,i=this.quad;let s=i.vertices;s[0]=s[6]=t._width*-t.anchor.x,s[1]=s[3]=t._height*-t.anchor.y,s[2]=s[4]=t._width*(1-t.anchor.x),s[5]=s[7]=t._height*(1-t.anchor.y);const n=t.uvRespectAnchor?t.anchor.x:0,o=t.uvRespectAnchor?t.anchor.y:0;s=i.uvs,s[0]=s[6]=-n,s[1]=s[3]=-o,s[2]=s[4]=1-n,s[5]=s[7]=1-o,i.invalidate();const a=t._texture,h=a.baseTexture,l=h.alphaMode>0,u=t.tileTransform.localTransform,c=t.uvMatrix;let d=h.isPowerOfTwo&&a.frame.width===h.width&&a.frame.height===h.height;d&&(h._glTextures[e.CONTEXT_UID]?d=h.wrapMode!==Ki.CLAMP:h.wrapMode===Ki.CLAMP&&(h.wrapMode=Ki.REPEAT));const p=d?this.simpleShader:this.shader,m=a.width,f=a.height,g=t._width,y=t._height;za.set(u.a*m/g,u.b*m/y,u.c*f/g,u.d*f/y,u.tx/g,u.ty/y),za.invert(),d?za.prepend(c.mapCoord):(p.uniforms.uMapCoord=c.mapCoord.toArray(!0),p.uniforms.uClampFrame=c.uClampFrame,p.uniforms.uClampOffset=c.uClampOffset),p.uniforms.uTransform=za.toArray(!0),p.uniforms.uColor=Gt.shared.setValue(t.tint).premultiply(t.worldAlpha,l).toArray(p.uniforms.uColor),p.uniforms.translationMatrix=t.transform.worldTransform.toArray(!0),p.uniforms.uSampler=a,e.shader.bind(p),e.geometry.bind(i),this.state.blendMode=Df(t.blendMode,l),e.state.set(this.state),e.geometry.draw(this.renderer.gl.TRIANGLES,6,0)}}Ig.extension={name:"tilingSprite",type:J.RendererPlugin},et.add(Ig);const Ag=class Ko{constructor(t,e,i=null){this.linkedSheets=[],this._texture=t instanceof rt?t:null,this.baseTexture=t instanceof ft?t:this._texture.baseTexture,this.textures={},this.animations={},this.data=e;const s=this.baseTexture.resource;this.resolution=this._updateResolution(i||(s?s.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 i=Qi(t,null);return i===null&&(i=parseFloat(e??"1")),i!==1&&this.baseTexture.setResolution(i),i}parse(){return new Promise(t=>{this._callback=t,this._batchIndex=0,this._frameKeys.length<=Ko.BATCH_SIZE?(this._processFrames(0),this._processAnimations(),this._parseComplete()):this._nextBatch()})}_processFrames(t){let e=t;const i=Ko.BATCH_SIZE;for(;e-t<i&&e<this._frameKeys.length;){const s=this._frameKeys[e],n=this._frames[s],o=n.frame;if(o){let a=null,h=null;const l=n.trimmed!==!1&&n.sourceSize?n.sourceSize:n.frame,u=new ct(0,0,Math.floor(l.w)/this.resolution,Math.floor(l.h)/this.resolution);n.rotated?a=new ct(Math.floor(o.x)/this.resolution,Math.floor(o.y)/this.resolution,Math.floor(o.h)/this.resolution,Math.floor(o.w)/this.resolution):a=new ct(Math.floor(o.x)/this.resolution,Math.floor(o.y)/this.resolution,Math.floor(o.w)/this.resolution,Math.floor(o.h)/this.resolution),n.trimmed!==!1&&n.spriteSourceSize&&(h=new ct(Math.floor(n.spriteSourceSize.x)/this.resolution,Math.floor(n.spriteSourceSize.y)/this.resolution,Math.floor(o.w)/this.resolution,Math.floor(o.h)/this.resolution)),this.textures[s]=new rt(this.baseTexture,a,u,h,n.rotated?2:0,n.anchor,n.borders),rt.addToCache(this.textures[s],s.toString())}e++}}_processAnimations(){const t=this.data.animations||{};for(const e in t){this.animations[e]=[];for(let i=0;i<t[e].length;i++){const s=t[e][i];this.animations[e].push(this.textures[s])}}}_parseComplete(){const t=this._callback;this._callback=null,this._batchIndex=0,t.call(this,this.textures)}_nextBatch(){this._processFrames(this._batchIndex*Ko.BATCH_SIZE),this._batchIndex++,setTimeout(()=>{this._batchIndex*Ko.BATCH_SIZE<this._frameKeys.length?this._nextBatch():(this._processAnimations(),this._parseComplete())},0)}destroy(t=!1){var e;for(const i in this.textures)this.textures[i].destroy();this._frames=null,this._frameKeys=null,this.data=null,this.textures=null,t&&((e=this._texture)==null||e.destroy(),this.baseTexture.destroy()),this._texture=null,this.baseTexture=null,this.linkedSheets=[]}};Ag.BATCH_SIZE=1e3;let Mg=Ag;const RS=["jpg","png","jpeg","avif","webp"];function Rg(r,t,e){const i={};if(r.forEach(s=>{i[s]=t}),Object.keys(t.textures).forEach(s=>{i[s]=t.textures[s]}),!e){const s=Jt.dirname(r[0]);t.linkedSheets.forEach((n,o)=>{const a=Rg([`${s}/${t.data.meta.related_multi_packs[o]}`],n,!0);Object.assign(i,a)})}return i}const PS={extension:J.Asset,cache:{test:r=>r instanceof Mg,getCacheableAssets:(r,t)=>Rg(r,t,!1)},resolver:{test:r=>{const t=r.split("?")[0].split("."),e=t.pop(),i=t.pop();return e==="json"&&RS.includes(i)},parse:r=>{var e;const t=r.split(".");return{resolution:parseFloat(((e=Q.RETINA_PREFIX.exec(r))==null?void 0:e[1])??"1"),format:t[t.length-2],src:r}}},loader:{name:"spritesheetLoader",extension:{type:J.LoadParser,priority:oi.Normal},async testParse(r,t){return Jt.extname(t.src).toLowerCase()===".json"&&!!r.frames},async parse(r,t,e){var h,l;let i=Jt.dirname(t.src);i&&i.lastIndexOf("/")!==i.length-1&&(i+="/");let s=i+r.meta.image;s=Lu(s,t.src);const n=(await e.load([s]))[s],o=new Mg(n.baseTexture,r,t.src);await o.parse();const a=(h=r==null?void 0:r.meta)==null?void 0:h.related_multi_packs;if(Array.isArray(a)){const u=[];for(const d of a){if(typeof d!="string")continue;let p=i+d;(l=t.data)!=null&&l.ignoreMultiPack||(p=Lu(p,t.src),u.push(e.load({src:p,data:{ignoreMultiPack:!0}})))}const c=await Promise.all(u);o.linkedSheets=c,c.forEach(d=>{d.linkedSheets=[o].concat(o.linkedSheets.filter(p=>p!==d))})}return o},unload(r){r.destroy(!0)}}};et.add(PS);class ja{constructor(){this.info=[],this.common=[],this.page=[],this.char=[],this.kerning=[],this.distanceField=[]}}class Ja{static test(t){return typeof t=="string"&&t.startsWith("info face=")}static parse(t){const e=t.match(/^[a-z]+\s+.+$/gm),i={info:[],common:[],page:[],char:[],chars:[],kerning:[],kernings:[],distanceField:[]};for(const n in e){const o=e[n].match(/^[a-z]+/gm)[0],a=e[n].match(/[a-zA-Z]+=([^\s"']+|"([^"]*)")/gm),h={};for(const l in a){const u=a[l].split("="),c=u[0],d=u[1].replace(/"/gm,""),p=parseFloat(d),m=isNaN(p)?d:p;h[c]=m}i[o].push(h)}const s=new ja;return i.info.forEach(n=>s.info.push({face:n.face,size:parseInt(n.size,10)})),i.common.forEach(n=>s.common.push({lineHeight:parseInt(n.lineHeight,10)})),i.page.forEach(n=>s.page.push({id:parseInt(n.id,10),file:n.file})),i.char.forEach(n=>s.char.push({id:parseInt(n.id,10),page:parseInt(n.page,10),x:parseInt(n.x,10),y:parseInt(n.y,10),width:parseInt(n.width,10),height:parseInt(n.height,10),xoffset:parseInt(n.xoffset,10),yoffset:parseInt(n.yoffset,10),xadvance:parseInt(n.xadvance,10)})),i.kerning.forEach(n=>s.kerning.push({first:parseInt(n.first,10),second:parseInt(n.second,10),amount:parseInt(n.amount,10)})),i.distanceField.forEach(n=>s.distanceField.push({distanceRange:parseInt(n.distanceRange,10),fieldType:n.fieldType})),s}}class Ju{static test(t){const e=t;return typeof t!="string"&&"getElementsByTagName"in t&&e.getElementsByTagName("page").length&&e.getElementsByTagName("info")[0].getAttribute("face")!==null}static parse(t){const e=new ja,i=t.getElementsByTagName("info"),s=t.getElementsByTagName("common"),n=t.getElementsByTagName("page"),o=t.getElementsByTagName("char"),a=t.getElementsByTagName("kerning"),h=t.getElementsByTagName("distanceField");for(let l=0;l<i.length;l++)e.info.push({face:i[l].getAttribute("face"),size:parseInt(i[l].getAttribute("size"),10)});for(let l=0;l<s.length;l++)e.common.push({lineHeight:parseInt(s[l].getAttribute("lineHeight"),10)});for(let l=0;l<n.length;l++)e.page.push({id:parseInt(n[l].getAttribute("id"),10)||0,file:n[l].getAttribute("file")});for(let l=0;l<o.length;l++){const u=o[l];e.char.push({id:parseInt(u.getAttribute("id"),10),page:parseInt(u.getAttribute("page"),10)||0,x:parseInt(u.getAttribute("x"),10),y:parseInt(u.getAttribute("y"),10),width:parseInt(u.getAttribute("width"),10),height:parseInt(u.getAttribute("height"),10),xoffset:parseInt(u.getAttribute("xoffset"),10),yoffset:parseInt(u.getAttribute("yoffset"),10),xadvance:parseInt(u.getAttribute("xadvance"),10)})}for(let l=0;l<a.length;l++)e.kerning.push({first:parseInt(a[l].getAttribute("first"),10),second:parseInt(a[l].getAttribute("second"),10),amount:parseInt(a[l].getAttribute("amount"),10)});for(let l=0;l<h.length;l++)e.distanceField.push({fieldType:h[l].getAttribute("fieldType"),distanceRange:parseInt(h[l].getAttribute("distanceRange"),10)});return e}}class $u{static test(t){return typeof t=="string"&&t.includes("<font>")?Ju.test(Q.ADAPTER.parseXML(t)):!1}static parse(t){return Ju.parse(Q.ADAPTER.parseXML(t))}}const Qu=[Ja,Ju,$u];function LS(r){for(let t=0;t<Qu.length;t++)if(Qu[t].test(r))return Qu[t];return null}function GS(r,t,e,i,s,n){const o=e.fill;if(Array.isArray(o)){if(o.length===1)return o[0]}else return o;let a;const h=e.dropShadow?e.dropShadowDistance:0,l=e.padding||0,u=r.width/i-h-l*2,c=r.height/i-h-l*2,d=o.slice(),p=e.fillGradientStops.slice();if(!p.length){const m=d.length+1;for(let f=1;f<m;++f)p.push(f/m)}if(d.unshift(o[0]),p.unshift(0),d.push(o[o.length-1]),p.push(1),e.fillGradientType===Ka.LINEAR_VERTICAL){a=t.createLinearGradient(u/2,l,u/2,c+l);let m=0;const f=(n.fontProperties.fontSize+e.strokeThickness)/c;for(let g=0;g<s.length;g++){const y=n.lineHeight*g;for(let _=0;_<d.length;_++){let b=0;typeof p[_]=="number"?b=p[_]:b=_/d.length;const v=y/c+b*f;let S=Math.max(m,v);S=Math.min(S,1),a.addColorStop(S,d[_]),m=S}}}else{a=t.createLinearGradient(l,c/2,u+l,c/2);const m=d.length+1;let f=1;for(let g=0;g<d.length;g++){let y;typeof p[g]=="number"?y=p[g]:y=f/m,a.addColorStop(y,d[g]),f++}}return a}function NS(r,t,e,i,s,n,o){const a=e.text,h=e.fontProperties;t.translate(i,s),t.scale(n,n);const l=o.strokeThickness/2,u=-(o.strokeThickness/2);if(t.font=o.toFontString(),t.lineWidth=o.strokeThickness,t.textBaseline=o.textBaseline,t.lineJoin=o.lineJoin,t.miterLimit=o.miterLimit,t.fillStyle=GS(r,t,o,n,[a],e),t.strokeStyle=o.stroke,o.dropShadow){const c=o.dropShadowColor,d=o.dropShadowBlur*n,p=o.dropShadowDistance*n;t.shadowColor=Gt.shared.setValue(c).setAlpha(o.dropShadowAlpha).toRgbaString(),t.shadowBlur=d,t.shadowOffsetX=Math.cos(o.dropShadowAngle)*p,t.shadowOffsetY=Math.sin(o.dropShadowAngle)*p}else t.shadowColor="black",t.shadowBlur=0,t.shadowOffsetX=0,t.shadowOffsetY=0;o.stroke&&o.strokeThickness&&t.strokeText(a,l,u+e.lineHeight-h.descent),o.fill&&t.fillText(a,l,u+e.lineHeight-h.descent),t.setTransform(1,0,0,1,0,0),t.fillStyle="rgba(0, 0, 0, 0)"}function $a(r){return r.codePointAt?r.codePointAt(0):r.charCodeAt(0)}function Pg(r){return Array.from?Array.from(r):r.split("")}function FS(r){typeof r=="string"&&(r=[r]);const t=[];for(let e=0,i=r.length;e<i;e++){const s=r[e];if(Array.isArray(s)){if(s.length!==2)throw new Error(`[BitmapFont]: Invalid character range length, expecting 2 got ${s.length}.`);const n=s[0].charCodeAt(0),o=s[1].charCodeAt(0);if(o<n)throw new Error("[BitmapFont]: Invalid character range.");for(let a=n,h=o;a<=h;a++)t.push(String.fromCharCode(a))}else t.push(...Pg(s))}if(t.length===0)throw new Error("[BitmapFont]: Empty set when resolving characters.");return t}const Cr=class Xi{constructor(t,e,i){var u;const[s]=t.info,[n]=t.common,[o]=t.page,[a]=t.distanceField,h=Qi(o.file),l={};this._ownsTextures=i,this.font=s.face,this.size=s.size,this.lineHeight=n.lineHeight/h,this.chars={},this.pageTextures=l;for(let c=0;c<t.page.length;c++){const{id:d,file:p}=t.page[c];l[d]=e instanceof Array?e[c]:e[p],a!=null&&a.fieldType&&a.fieldType!=="none"&&(l[d].baseTexture.alphaMode=xe.NO_PREMULTIPLIED_ALPHA,l[d].baseTexture.mipmap=yi.OFF)}for(let c=0;c<t.char.length;c++){const{id:d,page:p}=t.char[c];let{x:m,y:f,width:g,height:y,xoffset:_,yoffset:b,xadvance:v}=t.char[c];m/=h,f/=h,g/=h,y/=h,_/=h,b/=h,v/=h;const S=new ct(m+l[p].frame.x/h,f+l[p].frame.y/h,g,y);this.chars[d]={xOffset:_,yOffset:b,xAdvance:v,kerning:{},texture:new rt(l[p].baseTexture,S),page:p}}for(let c=0;c<t.kerning.length;c++){let{first:d,second:p,amount:m}=t.kerning[c];d/=h,p/=h,m/=h,this.chars[p]&&(this.chars[p].kerning[d]=m)}this.distanceFieldRange=a==null?void 0:a.distanceRange,this.distanceFieldType=((u=a==null?void 0:a.fieldType)==null?void 0:u.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,i){let s;if(t instanceof ja)s=t;else{const o=LS(t);if(!o)throw new Error("Unrecognized data format for font.");s=o.parse(t)}e instanceof rt&&(e=[e]);const n=new Xi(s,e,i);return Xi.available[n.font]=n,n}static uninstall(t){const e=Xi.available[t];if(!e)throw new Error(`No font found named '${t}'`);e.destroy(),delete Xi.available[t]}static from(t,e,i){if(!t)throw new Error("[BitmapFont] Property `name` is required.");const{chars:s,padding:n,resolution:o,textureWidth:a,textureHeight:h,...l}=Object.assign({},Xi.defaultOptions,i),u=FS(s),c=e instanceof Er?e:new Er(e),d=a,p=new ja;p.info[0]={face:c.fontFamily,size:c.fontSize},p.common[0]={lineHeight:c.fontSize};let m=0,f=0,g,y,_,b=0;const v=[];for(let E=0;E<u.length;E++){g||(g=Q.ADAPTER.createCanvas(),g.width=a,g.height=h,y=g.getContext("2d"),_=new ft(g,{resolution:o,...l}),v.push(new rt(_)),p.page.push({id:v.length-1,file:""}));const A=u[E],I=Sr.measureText(A,c,!1,g),P=I.width,W=Math.ceil(I.height),G=Math.ceil((c.fontStyle==="italic"?2:1)*P);if(f>=h-W*o){if(f===0)throw new Error(`[BitmapFont] textureHeight ${h}px is too small (fontFamily: '${c.fontFamily}', fontSize: ${c.fontSize}px, char: '${A}')`);--E,g=null,y=null,_=null,f=0,m=0,b=0;continue}if(b=Math.max(W+I.fontProperties.descent,b),G*o+m>=d){if(m===0)throw new Error(`[BitmapFont] textureWidth ${a}px is too small (fontFamily: '${c.fontFamily}', fontSize: ${c.fontSize}px, char: '${A}')`);--E,f+=b*o,f=Math.ceil(f),m=0,b=0;continue}NS(g,y,I,m,f,o,c);const N=$a(I.text);p.char.push({id:N,page:v.length-1,x:m/o,y:f/o,width:G,height:W,xoffset:0,yoffset:0,xadvance:P-(c.dropShadow?c.dropShadowDistance:0)-(c.stroke?c.strokeThickness:0)}),m+=(G+2*n)*o,m=Math.ceil(m)}if(!(i!=null&&i.skipKerning))for(let E=0,A=u.length;E<A;E++){const I=u[E];for(let P=0;P<A;P++){const W=u[P],G=y.measureText(I).width,N=y.measureText(W).width,C=y.measureText(I+W).width-(G+N);C&&p.kerning.push({first:$a(I),second:$a(W),amount:C})}}const S=new Xi(p,v,!0);return Xi.available[t]!==void 0&&Xi.uninstall(t),Xi.available[t]=S,S}};Cr.ALPHA=[["a","z"],["A","Z"]," "],Cr.NUMERIC=[["0","9"]],Cr.ALPHANUMERIC=[["a","z"],["A","Z"],["0","9"]," "],Cr.ASCII=[[" ","~"]],Cr.defaultOptions={resolution:1,textureWidth:512,textureHeight:512,padding:4,chars:Cr.ALPHANUMERIC},Cr.available={};let hi=Cr;var DS=`// Pixi texture info\r
|
|
1096
1096
|
varying vec2 vTextureCoord;\r
|
|
1097
1097
|
uniform sampler2D uSampler;\r
|
|
1098
1098
|
\r
|
|
@@ -1130,7 +1130,7 @@ void main(void) {\r
|
|
|
1130
1130
|
// NPM Textures, NPM outputs\r
|
|
1131
1131
|
gl_FragColor = vec4(uColor.rgb, coverage);\r
|
|
1132
1132
|
}\r
|
|
1133
|
-
`,
|
|
1133
|
+
`,kS=`// Mesh material default fragment\r
|
|
1134
1134
|
attribute vec2 aVertexPosition;\r
|
|
1135
1135
|
attribute vec2 aTextureCoord;\r
|
|
1136
1136
|
\r
|
|
@@ -1146,17 +1146,17 @@ void main(void)\r
|
|
|
1146
1146
|
\r
|
|
1147
1147
|
vTextureCoord = (uTextureMatrix * vec3(aTextureCoord, 1.0)).xy;\r
|
|
1148
1148
|
}\r
|
|
1149
|
-
`;const
|
|
1150
|
-
`)||" ",l=
|
|
1151
|
-
`){o.push(p),a.push(-1),m=Math.max(m,p),++f,++_,s.x=0,s.y+=t.lineHeight,d=null,v=0;continue}const
|
|
1152
|
-
`&&(/(?:\s)/.test(S)&&(p=y),o.push(p),m=Math.max(m,p),a.push(-1));const
|
|
1149
|
+
`;const Lg=[],Gg=[],Ng=[],Fg=class Eb extends Xt{constructor(t,e={}){super();const{align:i,tint:s,maxWidth:n,letterSpacing:o,fontName:a,fontSize:h}=Object.assign({},Eb.styleDefaults,e);if(!hi.available[a])throw new Error(`Missing BitmapFont "${a}"`);this._activePagesMeshData=[],this._textWidth=0,this._textHeight=0,this._align=i,this._tintColor=new Gt(s),this._font=void 0,this._fontName=a,this._fontSize=h,this.text=t,this._maxWidth=n,this._maxLineHeight=0,this._letterSpacing=o,this._anchor=new qi(()=>{this.dirty=!0},this,0,0),this._roundPixels=Q.ROUND_PIXELS,this.dirty=!0,this._resolution=Q.RESOLUTION,this._autoResolution=!0,this._textureCache={}}updateText(){var G;const t=hi.available[this._fontName],e=this.fontSize,i=e/t.size,s=new lt,n=[],o=[],a=[],h=this._text.replace(/(?:\r\n|\r)/g,`
|
|
1150
|
+
`)||" ",l=Pg(h),u=this._maxWidth*t.size/e,c=t.distanceFieldType==="none"?Lg:Gg;let d=null,p=0,m=0,f=0,g=-1,y=0,_=0,b=0,v=0;for(let N=0;N<l.length;N++){const C=l[N],F=$a(C);if(/(?:\s)/.test(C)&&(g=N,y=p,v++),C==="\r"||C===`
|
|
1151
|
+
`){o.push(p),a.push(-1),m=Math.max(m,p),++f,++_,s.x=0,s.y+=t.lineHeight,d=null,v=0;continue}const X=t.chars[F];if(!X)continue;d&&X.kerning[d]&&(s.x+=X.kerning[d]);const V=Ng.pop()||{texture:rt.EMPTY,line:0,charCode:0,prevSpaces:0,position:new lt};V.texture=X.texture,V.line=f,V.charCode=F,V.position.x=Math.round(s.x+X.xOffset+this._letterSpacing/2),V.position.y=Math.round(s.y+X.yOffset),V.prevSpaces=v,n.push(V),p=V.position.x+Math.max(X.xAdvance-X.xOffset,X.texture.orig.width),s.x+=X.xAdvance+this._letterSpacing,b=Math.max(b,X.yOffset+X.texture.height),d=F,g!==-1&&u>0&&s.x>u&&(++_,Us(n,1+g-_,1+N-g),N=g,g=-1,o.push(y),a.push(n.length>0?n[n.length-1].prevSpaces:0),m=Math.max(m,y),f++,s.x=0,s.y+=t.lineHeight,d=null,v=0)}const S=l[l.length-1];S!=="\r"&&S!==`
|
|
1152
|
+
`&&(/(?:\s)/.test(S)&&(p=y),o.push(p),m=Math.max(m,p),a.push(-1));const E=[];for(let N=0;N<=f;N++){let C=0;this._align==="right"?C=m-o[N]:this._align==="center"?C=(m-o[N])/2:this._align==="justify"&&(C=a[N]<0?0:(m-o[N])/a[N]),E.push(C)}const A=n.length,I={},P=[],W=this._activePagesMeshData;c.push(...W);for(let N=0;N<A;N++){const C=n[N].texture,F=C.baseTexture.uid;if(!I[F]){let X=c.pop();if(!X){const L=new yg;let k,H;t.distanceFieldType==="none"?(k=new Ku(rt.EMPTY),H=ut.NORMAL):(k=new Ku(rt.EMPTY,{program:tr.from(kS,DS),uniforms:{uFWidth:0}}),H=ut.NORMAL_NPM);const D=new Hu(L,k);D.blendMode=H,X={index:0,indexCount:0,vertexCount:0,uvsCount:0,total:0,mesh:D,vertices:null,uvs:null,indices:null}}X.index=0,X.indexCount=0,X.vertexCount=0,X.uvsCount=0,X.total=0;const{_textureCache:V}=this;V[F]=V[F]||new rt(C.baseTexture),X.mesh.texture=V[F],X.mesh.tint=this._tintColor.value,P.push(X),I[F]=X}I[F].total++}for(let N=0;N<W.length;N++)P.includes(W[N])||this.removeChild(W[N].mesh);for(let N=0;N<P.length;N++)P[N].mesh.parent!==this&&this.addChild(P[N].mesh);this._activePagesMeshData=P;for(const N in I){const C=I[N],F=C.total;if(!(((G=C.indices)==null?void 0:G.length)>6*F)||C.vertices.length<Hu.BATCHABLE_SIZE*2)C.vertices=new Float32Array(4*2*F),C.uvs=new Float32Array(4*2*F),C.indices=new Uint16Array(6*F);else{const X=C.total,V=C.vertices;for(let L=X*4*2;L<V.length;L++)V[L]=0}C.mesh.size=6*F}for(let N=0;N<A;N++){const C=n[N];let F=C.position.x+E[C.line]*(this._align==="justify"?C.prevSpaces:1);this._roundPixels&&(F=Math.round(F));const X=F*i,V=C.position.y*i,L=C.texture,k=I[L.baseTexture.uid],H=L.frame,D=L._uvs,U=k.index++;k.indices[U*6+0]=0+U*4,k.indices[U*6+1]=1+U*4,k.indices[U*6+2]=2+U*4,k.indices[U*6+3]=0+U*4,k.indices[U*6+4]=2+U*4,k.indices[U*6+5]=3+U*4,k.vertices[U*8+0]=X,k.vertices[U*8+1]=V,k.vertices[U*8+2]=X+H.width*i,k.vertices[U*8+3]=V,k.vertices[U*8+4]=X+H.width*i,k.vertices[U*8+5]=V+H.height*i,k.vertices[U*8+6]=X,k.vertices[U*8+7]=V+H.height*i,k.uvs[U*8+0]=D.x0,k.uvs[U*8+1]=D.y0,k.uvs[U*8+2]=D.x1,k.uvs[U*8+3]=D.y1,k.uvs[U*8+4]=D.x2,k.uvs[U*8+5]=D.y2,k.uvs[U*8+6]=D.x3,k.uvs[U*8+7]=D.y3}this._textWidth=m*i,this._textHeight=(s.y+t.lineHeight)*i;for(const N in I){const C=I[N];if(this.anchor.x!==0||this.anchor.y!==0){let L=0;const k=this._textWidth*this.anchor.x,H=this._textHeight*this.anchor.y;for(let D=0;D<C.total;D++)C.vertices[L++]-=k,C.vertices[L++]-=H,C.vertices[L++]-=k,C.vertices[L++]-=H,C.vertices[L++]-=k,C.vertices[L++]-=H,C.vertices[L++]-=k,C.vertices[L++]-=H}this._maxLineHeight=b*i;const F=C.mesh.geometry.getBuffer("aVertexPosition"),X=C.mesh.geometry.getBuffer("aTextureCoord"),V=C.mesh.geometry.getIndex();F.data=C.vertices,X.data=C.uvs,V.data=C.indices,F.update(),X.update(),V.update()}for(let N=0;N<n.length;N++)Ng.push(n[N]);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:i,size:s}=hi.available[this._fontName];if(i!=="none"){const{a:n,b:o,c:a,d:h}=this.worldTransform,l=Math.sqrt(n*n+o*o),u=Math.sqrt(a*a+h*h),c=(Math.abs(l)+Math.abs(u))/2,d=this.fontSize/s,p=t._view.resolution;for(const m of this._activePagesMeshData)m.mesh.shader.uniforms.uFWidth=c*e*d*p}super._render(t)}getLocalBounds(){return this.validate(),super.getLocalBounds()}validate(){const t=hi.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(!hi.available[t])throw new Error(`Missing BitmapFont "${t}"`);this._fontName!==t&&(this._fontName=t,this.dirty=!0)}get fontSize(){return this._fontSize??hi.available[this._fontName].size}set fontSize(t){this._fontSize!==t&&(this._fontSize=t,this.dirty=!0)}get anchor(){return this._anchor}set anchor(t){typeof t=="number"?this._anchor.set(t):this._anchor.copyFrom(t)}get text(){return this._text}set text(t){t=String(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,i=hi.available[this._fontName].distanceFieldType==="none"?Lg:Gg;i.push(...this._activePagesMeshData);for(const s of this._activePagesMeshData)this.removeChild(s.mesh);this._activePagesMeshData=[],i.filter(s=>e[s.mesh.texture.baseTexture.uid]).forEach(s=>{s.mesh.texture=rt.EMPTY});for(const s in e)e[s].destroy(),delete e[s];this._font=null,this._tintColor=null,this._textureCache=null,super.destroy(t)}};Fg.styleDefaults={align:"left",tint:16777215,maxWidth:0,letterSpacing:0};let OS=Fg;const BS=[".xml",".fnt"],WS={extension:{type:J.LoadParser,priority:oi.Normal},name:"loadBitmapFont",test(r){return BS.includes(Jt.extname(r).toLowerCase())},async testParse(r){return Ja.test(r)||$u.test(r)},async parse(r,t,e){const i=Ja.test(r)?Ja.parse(r):$u.parse(r),{src:s}=t,{page:n}=i,o=[];for(let l=0;l<n.length;++l){const u=n[l].file;let c=Jt.join(Jt.dirname(s),u);c=Lu(c,s),o.push(c)}const a=await e.load(o),h=o.map(l=>a[l]);return hi.install(i,h,!0)},async load(r,t){return(await Q.ADAPTER.fetch(r)).text()},unload(r){r.destroy()}};et.add(WS);const qu=class Rn extends Er{constructor(){super(...arguments),this._fonts=[],this._overrides=[],this._stylesheet="",this.fontsDirty=!1}static from(t){return new Rn(Object.keys(Rn.defaultOptions).reduce((e,i)=>({...e,[i]:t[i]}),{}))}cleanFonts(){this._fonts.length>0&&(this._fonts.forEach(t=>{URL.revokeObjectURL(t.src),t.refs--,t.refs===0&&(t.fontFace&&document.fonts.delete(t.fontFace),delete Rn.availableFonts[t.originalUrl])}),this.fontFamily="Arial",this._fonts.length=0,this.styleID++,this.fontsDirty=!0)}loadFont(t,e={}){const{availableFonts:i}=Rn;if(i[t]){const s=i[t];return this._fonts.push(s),s.refs++,this.styleID++,this.fontsDirty=!0,Promise.resolve()}return Q.ADAPTER.fetch(t).then(s=>s.blob()).then(async s=>new Promise((n,o)=>{const a=URL.createObjectURL(s),h=new FileReader;h.onload=()=>n([a,h.result]),h.onerror=o,h.readAsDataURL(s)})).then(async([s,n])=>{const o=Object.assign({family:Jt.basename(t,Jt.extname(t)),weight:"normal",style:"normal",display:"auto",src:s,dataSrc:n,refs:1,originalUrl:t,fontFace:null},e);i[t]=o,this._fonts.push(o),this.styleID++;const a=new FontFace(o.family,`url(${o.src})`,{weight:o.weight,style:o.style,display:o.display});o.fontFace=a,await a.load(),document.fonts.add(a),await document.fonts.ready,this.styleID++,this.fontsDirty=!0})}addOverride(...t){const e=t.filter(i=>!this._overrides.includes(i));e.length>0&&(this._overrides.push(...e),this.styleID++)}removeOverride(...t){const e=t.filter(i=>this._overrides.includes(i));e.length>0&&(this._overrides=this._overrides.filter(i=>!e.includes(i)),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}
|
|
1153
1153
|
@font-face {
|
|
1154
1154
|
font-family: "${e.family}";
|
|
1155
1155
|
src: url('${e.dataSrc}');
|
|
1156
1156
|
font-weight: ${e.weight};
|
|
1157
1157
|
font-style: ${e.style};
|
|
1158
1158
|
font-display: ${e.display};
|
|
1159
|
-
}`,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=
|
|
1159
|
+
}`,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=M1(t)),typeof t=="number"?A1(t):t}dropShadowToCSS(){let t=this.normalizeColor(this.dropShadowColor);const e=this.dropShadowAlpha,i=Math.round(Math.cos(this.dropShadowAngle)*this.dropShadowDistance),s=Math.round(Math.sin(this.dropShadowAngle)*this.dropShadowDistance);t.startsWith("#")&&e<1&&(t+=(e*255|0).toString(16).padStart(2,"0"));const n=`${i}px ${s}px`;return this.dropShadowBlur>0?`text-shadow: ${n} ${this.dropShadowBlur}px ${t}`:`text-shadow: ${n} ${t}`}reset(){Object.assign(this,Rn.defaultOptions)}onBeforeDraw(){const{fontsDirty:t}=this;return this.fontsDirty=!1,this.isSafari&&this._fonts.length>0&&t?new Promise(e=>setTimeout(e,100)):Promise.resolve()}get isSafari(){const{userAgent:t}=Q.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}};qu.availableFonts={},qu.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};let tc=qu;const Qa=class Pn extends ie{constructor(t="",e={}){super(rt.EMPTY),this._text=null,this._style=null,this._autoResolution=!0,this.localStyleID=-1,this.dirty=!1,this._updateID=0,this.ownsStyle=!1;const i=new Image,s=rt.from(i,{scaleMode:Q.SCALE_MODE,resourceOptions:{autoLoad:!1}});s.orig=new ct,s.trim=new ct,this.texture=s;const n="http://www.w3.org/2000/svg",o="http://www.w3.org/1999/xhtml",a=document.createElementNS(n,"svg"),h=document.createElementNS(n,"foreignObject"),l=document.createElementNS(o,"div"),u=document.createElementNS(o,"style");h.setAttribute("width","10000"),h.setAttribute("height","10000"),h.style.overflow="hidden",a.appendChild(h),this.maxWidth=Pn.defaultMaxWidth,this.maxHeight=Pn.defaultMaxHeight,this._domElement=l,this._styleElement=u,this._svgRoot=a,this._foreignObject=h,this._foreignObject.appendChild(u),this._foreignObject.appendChild(l),this._image=i,this._loadImage=new Image,this._autoResolution=Pn.defaultAutoResolution,this._resolution=Pn.defaultResolution??Q.RESOLUTION,this.text=t,this.style=e}measureText(t){var u,c;const{text:e,style:i,resolution:s}=Object.assign({text:this._text,style:this._style,resolution:this._resolution},t);Object.assign(this._domElement,{innerHTML:e,style:i.toCSS(s)}),this._styleElement.textContent=i.toGlobalCSS(),document.body.appendChild(this._svgRoot);const n=this._domElement.getBoundingClientRect();this._svgRoot.remove();const{width:o,height:a}=n;(o>this.maxWidth||a>this.maxHeight)&&console.warn("[HTMLText] Large expanse of text, increase HTMLText.maxWidth or HTMLText.maxHeight property.");const h=Math.min(this.maxWidth,Math.ceil(o)),l=Math.min(this.maxHeight,Math.ceil(a));return this._svgRoot.setAttribute("width",h.toString()),this._svgRoot.setAttribute("height",l.toString()),e!==this._text&&(this._domElement.innerHTML=this._text),i!==this._style&&(Object.assign(this._domElement,{style:(u=this._style)==null?void 0:u.toCSS(s)}),this._styleElement.textContent=(c=this._style)==null?void 0:c.toGlobalCSS()),{width:h+i.padding*2,height:l+i.padding*2}}async updateText(t=!0){const{style:e,_image:i,_loadImage:s}=this;if(this.localStyleID!==e.styleID&&(this.dirty=!0,this.localStyleID=e.styleID),!this.dirty&&t)return;const{width:n,height:o}=this.measureText();i.width=s.width=Math.ceil(Math.max(1,n)),i.height=s.height=Math.ceil(Math.max(1,o)),this._updateID++;const a=this._updateID;await new Promise(h=>{s.onload=async()=>{if(a<this._updateID){h();return}await e.onBeforeDraw(),i.src=s.src,s.onload=null,s.src="",this.updateTexture(),h()};const l=new XMLSerializer().serializeToString(this._svgRoot);s.src=`data:image/svg+xml;charset=utf8,${encodeURIComponent(l)}`})}get source(){return this._image}updateTexture(){const{style:t,texture:e,_image:i,resolution:s}=this,{padding:n}=t,{baseTexture:o}=e;e.trim.width=e._frame.width=i.width/s,e.trim.height=e._frame.height=i.height/s,e.trim.x=-n,e.trim.y=-n,e.orig.width=e._frame.width-n*2,e.orig.height=e._frame.height-n*2,this._onTextureUpdate(),o.setRealSize(i.width,i.height,s),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){var i,s,n,o,a;typeof t=="boolean"&&(t={children:t}),t=Object.assign({},Pn.defaultDestroyOptions,t),super.destroy(t);const e=null;this.ownsStyle&&((i=this._style)==null||i.cleanFonts()),this._style=e,(s=this._svgRoot)==null||s.remove(),this._svgRoot=e,(n=this._domElement)==null||n.remove(),this._domElement=e,(o=this._foreignObject)==null||o.remove(),this._foreignObject=e,(a=this._styleElement)==null||a.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=yr(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=yr(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||{},t instanceof tc?(this.ownsStyle=!1,this._style=t):t instanceof Er?(console.warn("[HTMLText] Cloning TextStyle, if this is not what you want, use HTMLTextStyle"),this.ownsStyle=!0,this._style=tc.from(t)):(this.ownsStyle=!0,this._style=new tc(t)),this.localStyleID=-1,this.dirty=!0)}get text(){return this._text}set text(t){t=String(t===""||t===null||t===void 0?" ":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(/ /gi," ")}};Qa.defaultDestroyOptions={texture:!0,children:!1,baseTexture:!0},Qa.defaultMaxWidth=2024,Qa.defaultMaxHeight=2024,Qa.defaultAutoResolution=!0;async function Dg(r,t){const e=await ge();let i,s=null;async function n(){try{s=await e.fetch(r),t(s)}catch(a){console.error(a)}s&&!s.end_time&&(i=setTimeout(()=>n(),1e3))}function o(){clearInterval(i)}return{start:n,stop:o}}function ir(r){if(r===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return r}function kg(r,t){r.prototype=Object.create(t.prototype),r.prototype.constructor=r,r.__proto__=t}/*!
|
|
1160
1160
|
* GSAP 3.12.2
|
|
1161
1161
|
* https://greensock.com
|
|
1162
1162
|
*
|
|
@@ -1164,7 +1164,7 @@ void main(void)\r
|
|
|
1164
1164
|
* Subject to the terms at https://greensock.com/standard-license or for
|
|
1165
1165
|
* Club GreenSock members, the agreement issued with that membership.
|
|
1166
1166
|
* @author: Jack Doyle, jack@greensock.com
|
|
1167
|
-
*/var Ae={autoSleep:120,force3D:"auto",nullTargetWarn:1,units:{lineHeight:""}},js={duration:.5,overwrite:!1,delay:0},ec,ce,Zt,Ze=1e8,Rt=1/Ze,ic=Math.PI*2,OS=ic/4,BS=0,Fg=Math.sqrt,WS=Math.cos,US=Math.sin,re=function(t){return typeof t=="string"},Vt=function(t){return typeof t=="function"},ir=function(t){return typeof t=="number"},rc=function(t){return typeof t>"u"},Ai=function(t){return typeof t=="object"},xe=function(t){return t!==!1},sc=function(){return typeof window<"u"},Qa=function(t){return Vt(t)||re(t)},Dg=typeof ArrayBuffer=="function"&&ArrayBuffer.isView||function(){},de=Array.isArray,nc=/(?:-?\.?\d|\.)+/gi,kg=/[-+=.]*\d+[.e\-+]*\d*[e\-+]*\d*/g,Js=/[-+=.]*\d+[.e-]*\d*[a-z%]*/g,oc=/[-+=.]*\d+\.?\d*(?:e-|e\+)?\d*/gi,Og=/[+-]=-?[.\d]+/,Bg=/[^,'"\[\]\s]+/gi,XS=/^[+\-=e\s\d]*\d+[.\d]*([a-z]*|%)\s*$/i,Bt,Ve,ac,hc,Me={},qa={},Wg,Ug=function(t){return(qa=ss(t,Me))&&we},lc=function(t,e){return console.warn("Invalid property",t,"set to",e,"Missing plugin? gsap.registerPlugin()")},th=function(t,e){return!e&&console.warn(t)},Xg=function(t,e){return t&&(Me[t]=e)&&qa&&(qa[t]=e)||Me},qn=function(){return 0},ZS={suppressEvents:!0,isStart:!0,kill:!1},eh={suppressEvents:!0,kill:!1},VS={suppressEvents:!0},uc={},Er=[],cc={},Zg,Re={},dc={},Vg=30,ih=[],pc="",fc=function(t){var e=t[0],i,s;if(Ai(e)||Vt(e)||(t=[t]),!(i=(e._gsap||{}).harness)){for(s=ih.length;s--&&!ih[s].targetTest(e););i=ih[s]}for(s=t.length;s--;)t[s]&&(t[s]._gsap||(t[s]._gsap=new x0(t[s],i)))||t.splice(s,1);return t},rs=function(t){return t._gsap||fc(Ye(t))[0]._gsap},Hg=function(t,e,i){return(i=t[e])&&Vt(i)?t[e]():rc(i)&&t.getAttribute&&t.getAttribute(e)||i},_e=function(t,e){return(t=t.split(",")).forEach(e)||t},Kt=function(t){return Math.round(t*1e5)/1e5||0},he=function(t){return Math.round(t*1e7)/1e7||0},$s=function(t,e){var i=e.charAt(0),s=parseFloat(e.substr(2));return t=parseFloat(t),i==="+"?t+s:i==="-"?t-s:i==="*"?t*s:t/s},HS=function(t,e){for(var i=e.length,s=0;t.indexOf(e[s])<0&&++s<i;);return s<i},rh=function(){var t=Er.length,e=Er.slice(0),i,s;for(cc={},Er.length=0,i=0;i<t;i++)s=e[i],s&&s._lazy&&(s.render(s._lazy[0],s._lazy[1],!0)._lazy=0)},Kg=function(t,e,i,s){Er.length&&!ce&&rh(),t.render(e,i,s||ce&&e<0&&(t._initted||t._startAt)),Er.length&&!ce&&rh()},Yg=function(t){var e=parseFloat(t);return(e||e===0)&&(t+"").match(Bg).length<2?e:re(t)?t.trim():t},zg=function(t){return t},He=function(t,e){for(var i in e)i in t||(t[i]=e[i]);return t},KS=function(t){return function(e,i){for(var s in i)s in e||s==="duration"&&t||s==="ease"||(e[s]=i[s])}},ss=function(t,e){for(var i in e)t[i]=e[i];return t},jg=function r(t,e){for(var i in e)i!=="__proto__"&&i!=="constructor"&&i!=="prototype"&&(t[i]=Ai(e[i])?r(t[i]||(t[i]={}),e[i]):e[i]);return t},sh=function(t,e){var i={},s;for(s in t)s in e||(i[s]=t[s]);return i},to=function(t){var e=t.parent||Bt,i=t.keyframes?KS(de(t.keyframes)):He;if(xe(t.inherit))for(;e;)i(t,e.vars.defaults),e=e.parent||e._dp;return t},YS=function(t,e){for(var i=t.length,s=i===e.length;s&&i--&&t[i]===e[i];);return i<0},Jg=function(t,e,i,s,n){i===void 0&&(i="_first"),s===void 0&&(s="_last");var o=t[s],a;if(n)for(a=e[n];o&&o[n]>a;)o=o._prev;return o?(e._next=o._next,o._next=e):(e._next=t[i],t[i]=e),e._next?e._next._prev=e:t[s]=e,e._prev=o,e.parent=e._dp=t,e},nh=function(t,e,i,s){i===void 0&&(i="_first"),s===void 0&&(s="_last");var n=e._prev,o=e._next;n?n._next=o:t[i]===e&&(t[i]=o),o?o._prev=n:t[s]===e&&(t[s]=n),e._next=e._prev=e.parent=null},Cr=function(t,e){t.parent&&(!e||t.parent.autoRemoveChildren)&&t.parent.remove&&t.parent.remove(t),t._act=0},ns=function(t,e){if(t&&(!e||e._end>t._dur||e._start<0))for(var i=t;i;)i._dirty=1,i=i.parent;return t},zS=function(t){for(var e=t.parent;e&&e.parent;)e._dirty=1,e.totalDuration(),e=e.parent;return t},mc=function(t,e,i,s){return t._startAt&&(ce?t._startAt.revert(eh):t.vars.immediateRender&&!t.vars.autoRevert||t._startAt.render(e,!0,s))},jS=function r(t){return!t||t._ts&&r(t.parent)},$g=function(t){return t._repeat?Qs(t._tTime,t=t.duration()+t._rDelay)*t:0},Qs=function(t,e){var i=Math.floor(t/=e);return t&&i===t?i-1:i},oh=function(t,e){return(t-e._start)*e._ts+(e._ts>=0?0:e._dirty?e.totalDuration():e._tDur)},ah=function(t){return t._end=he(t._start+(t._tDur/Math.abs(t._ts||t._rts||Rt)||0))},hh=function(t,e){var i=t._dp;return i&&i.smoothChildTiming&&t._ts&&(t._start=he(i._time-(t._ts>0?e/t._ts:((t._dirty?t.totalDuration():t._tDur)-e)/-t._ts)),ah(t),i._dirty||ns(i,t)),t},Qg=function(t,e){var i;if((e._time||!e._dur&&e._initted||e._start<t._time&&(e._dur||!e.add))&&(i=oh(t.rawTime(),e),(!e._dur||io(0,e.totalDuration(),i)-e._tTime>Rt)&&e.render(i,!0)),ns(t,e)._dp&&t._initted&&t._time>=t._dur&&t._ts){if(t._dur<t.duration())for(i=t;i._dp;)i.rawTime()>=0&&i.totalTime(i._tTime),i=i._dp;t._zTime=-Rt}},Mi=function(t,e,i,s){return e.parent&&Cr(e),e._start=he((ir(i)?i:i||t!==Bt?Ke(t,i,e):t._time)+e._delay),e._end=he(e._start+(e.totalDuration()/Math.abs(e.timeScale())||0)),Jg(t,e,"_first","_last",t._sort?"_start":0),gc(e)||(t._recent=e),s||Qg(t,e),t._ts<0&&hh(t,t._tTime),t},qg=function(t,e){return(Me.ScrollTrigger||lc("scrollTrigger",e))&&Me.ScrollTrigger.create(e,t)},t0=function(t,e,i,s,n){if(Ec(t,e,n),!t._initted)return 1;if(!i&&t._pt&&!ce&&(t._dur&&t.vars.lazy!==!1||!t._dur&&t.vars.lazy)&&Zg!==Pe.frame)return Er.push(t),t._lazy=[n,s],1},JS=function r(t){var e=t.parent;return e&&e._ts&&e._initted&&!e._lock&&(e.rawTime()<0||r(e))},gc=function(t){var e=t.data;return e==="isFromStart"||e==="isStart"},$S=function(t,e,i,s){var n=t.ratio,o=e<0||!e&&(!t._start&&JS(t)&&!(!t._initted&&gc(t))||(t._ts<0||t._dp._ts<0)&&!gc(t))?0:1,a=t._rDelay,h=0,l,u,c;if(a&&t._repeat&&(h=io(0,t._tDur,e),u=Qs(h,a),t._yoyo&&u&1&&(o=1-o),u!==Qs(t._tTime,a)&&(n=1-o,t.vars.repeatRefresh&&t._initted&&t.invalidate())),o!==n||ce||s||t._zTime===Rt||!e&&t._zTime){if(!t._initted&&t0(t,e,s,i,h))return;for(c=t._zTime,t._zTime=e||(i?Rt:0),i||(i=e&&!c),t.ratio=o,t._from&&(o=1-o),t._time=0,t._tTime=h,l=t._pt;l;)l.r(o,l.d),l=l._next;e<0&&mc(t,e,i,!0),t._onUpdate&&!i&&ze(t,"onUpdate"),h&&t._repeat&&!i&&t.parent&&ze(t,"onRepeat"),(e>=t._tDur||e<0)&&t.ratio===o&&(o&&Cr(t,1),!i&&!ce&&(ze(t,o?"onComplete":"onReverseComplete",!0),t._prom&&t._prom()))}else t._zTime||(t._zTime=e)},QS=function(t,e,i){var s;if(i>e)for(s=t._first;s&&s._start<=i;){if(s.data==="isPause"&&s._start>e)return s;s=s._next}else for(s=t._last;s&&s._start>=i;){if(s.data==="isPause"&&s._start<e)return s;s=s._prev}},qs=function(t,e,i,s){var n=t._repeat,o=he(e)||0,a=t._tTime/t._tDur;return a&&!s&&(t._time*=o/t._dur),t._dur=o,t._tDur=n?n<0?1e10:he(o*(n+1)+t._rDelay*n):o,a>0&&!s&&hh(t,t._tTime=t._tDur*a),t.parent&&ah(t),i||ns(t.parent,t),t},e0=function(t){return t instanceof ve?ns(t):qs(t,t._dur)},qS={_start:0,endTime:qn,totalDuration:qn},Ke=function r(t,e,i){var s=t.labels,n=t._recent||qS,o=t.duration()>=Ze?n.endTime(!1):t._dur,a,h,l;return re(e)&&(isNaN(e)||e in s)?(h=e.charAt(0),l=e.substr(-1)==="%",a=e.indexOf("="),h==="<"||h===">"?(a>=0&&(e=e.replace(/=/,"")),(h==="<"?n._start:n.endTime(n._repeat>=0))+(parseFloat(e.substr(1))||0)*(l?(a<0?n:i).totalDuration()/100:1)):a<0?(e in s||(s[e]=o),s[e]):(h=parseFloat(e.charAt(a-1)+e.substr(a+1)),l&&i&&(h=h/100*(de(i)?i[0]:i).totalDuration()),a>1?r(t,e.substr(0,a-1),i)+h:o+h)):e==null?o:+e},eo=function(t,e,i){var s=ir(e[1]),n=(s?2:1)+(t<2?0:1),o=e[n],a,h;if(s&&(o.duration=e[1]),o.parent=i,t){for(a=o,h=i;h&&!("immediateRender"in a);)a=h.vars.defaults||{},h=xe(h.vars.inherit)&&h.parent;o.immediateRender=xe(a.immediateRender),t<2?o.runBackwards=1:o.startAt=e[n-1]}return new zt(e[0],o,e[n+1])},Ir=function(t,e){return t||t===0?e(t):e},io=function(t,e,i){return i<t?t:i>e?e:i},pe=function(t,e){return!re(t)||!(e=XS.exec(t))?"":e[1]},tE=function(t,e,i){return Ir(i,function(s){return io(t,e,s)})},yc=[].slice,i0=function(t,e){return t&&Ai(t)&&"length"in t&&(!e&&!t.length||t.length-1 in t&&Ai(t[0]))&&!t.nodeType&&t!==Ve},eE=function(t,e,i){return i===void 0&&(i=[]),t.forEach(function(s){var n;return re(s)&&!e||i0(s,1)?(n=i).push.apply(n,Ye(s)):i.push(s)})||i},Ye=function(t,e,i){return Zt&&!e&&Zt.selector?Zt.selector(t):re(t)&&!i&&(ac||!en())?yc.call((e||hc).querySelectorAll(t),0):de(t)?eE(t,i):i0(t)?yc.call(t,0):t?[t]:[]},bc=function(t){return t=Ye(t)[0]||th("Invalid scope")||{},function(e){var i=t.current||t.nativeElement||t;return Ye(e,i.querySelectorAll?i:i===t?th("Invalid scope")||hc.createElement("div"):t)}},r0=function(t){return t.sort(function(){return .5-Math.random()})},s0=function(t){if(Vt(t))return t;var e=Ai(t)?t:{each:t},i=os(e.ease),s=e.from||0,n=parseFloat(e.base)||0,o={},a=s>0&&s<1,h=isNaN(s)||a,l=e.axis,u=s,c=s;return re(s)?u=c={center:.5,edges:.5,end:1}[s]||0:!a&&h&&(u=s[0],c=s[1]),function(d,p,m){var f=(m||e).length,g=o[f],y,_,x,v,S,C,A,I,L;if(!g){if(L=e.grid==="auto"?0:(e.grid||[1,Ze])[1],!L){for(A=-Ze;A<(A=m[L++].getBoundingClientRect().left)&&L<f;);L--}for(g=o[f]=[],y=h?Math.min(L,f)*u-.5:s%L,_=L===Ze?0:h?f*c/L-.5:s/L|0,A=0,I=Ze,C=0;C<f;C++)x=C%L-y,v=_-(C/L|0),g[C]=S=l?Math.abs(l==="y"?v:x):Fg(x*x+v*v),S>A&&(A=S),S<I&&(I=S);s==="random"&&r0(g),g.max=A-I,g.min=I,g.v=f=(parseFloat(e.amount)||parseFloat(e.each)*(L>f?f-1:l?l==="y"?f/L:L:Math.max(L,f/L))||0)*(s==="edges"?-1:1),g.b=f<0?n-f:n,g.u=pe(e.amount||e.each)||0,i=i&&f<0?g0(i):i}return f=(g[d]-g.min)/g.max||0,he(g.b+(i?i(f):f)*g.v)+g.u}},xc=function(t){var e=Math.pow(10,((t+"").split(".")[1]||"").length);return function(i){var s=he(Math.round(parseFloat(i)/t)*t*e);return(s-s%1)/e+(ir(i)?0:pe(i))}},n0=function(t,e){var i=de(t),s,n;return!i&&Ai(t)&&(s=i=t.radius||Ze,t.values?(t=Ye(t.values),(n=!ir(t[0]))&&(s*=s)):t=xc(t.increment)),Ir(e,i?Vt(t)?function(o){return n=t(o),Math.abs(n-o)<=s?n:o}:function(o){for(var a=parseFloat(n?o.x:o),h=parseFloat(n?o.y:0),l=Ze,u=0,c=t.length,d,p;c--;)n?(d=t[c].x-a,p=t[c].y-h,d=d*d+p*p):d=Math.abs(t[c]-a),d<l&&(l=d,u=c);return u=!s||l<=s?t[u]:o,n||u===o||ir(o)?u:u+pe(o)}:xc(t))},o0=function(t,e,i,s){return Ir(de(t)?!e:i===!0?!!(i=0):!s,function(){return de(t)?t[~~(Math.random()*t.length)]:(i=i||1e-5)&&(s=i<1?Math.pow(10,(i+"").length-2):1)&&Math.floor(Math.round((t-i/2+Math.random()*(e-t+i*.99))/i)*i*s)/s})},iE=function(){for(var t=arguments.length,e=new Array(t),i=0;i<t;i++)e[i]=arguments[i];return function(s){return e.reduce(function(n,o){return o(n)},s)}},rE=function(t,e){return function(i){return t(parseFloat(i))+(e||pe(i))}},sE=function(t,e,i){return h0(t,e,0,1,i)},a0=function(t,e,i){return Ir(i,function(s){return t[~~e(s)]})},nE=function r(t,e,i){var s=e-t;return de(t)?a0(t,r(0,t.length),e):Ir(i,function(n){return(s+(n-t)%s)%s+t})},oE=function r(t,e,i){var s=e-t,n=s*2;return de(t)?a0(t,r(0,t.length-1),e):Ir(i,function(o){return o=(n+(o-t)%n)%n||0,t+(o>s?n-o:o)})},ro=function(t){for(var e=0,i="",s,n,o,a;~(s=t.indexOf("random(",e));)o=t.indexOf(")",s),a=t.charAt(s+7)==="[",n=t.substr(s+7,o-s-7).match(a?Bg:nc),i+=t.substr(e,s-e)+o0(a?n:+n[0],a?0:+n[1],+n[2]||1e-5),e=o+1;return i+t.substr(e,t.length-e)},h0=function(t,e,i,s,n){var o=e-t,a=s-i;return Ir(n,function(h){return i+((h-t)/o*a||0)})},aE=function r(t,e,i,s){var n=isNaN(t+e)?0:function(p){return(1-p)*t+p*e};if(!n){var o=re(t),a={},h,l,u,c,d;if(i===!0&&(s=1)&&(i=null),o)t={p:t},e={p:e};else if(de(t)&&!de(e)){for(u=[],c=t.length,d=c-2,l=1;l<c;l++)u.push(r(t[l-1],t[l]));c--,n=function(m){m*=c;var f=Math.min(d,~~m);return u[f](m-f)},i=e}else s||(t=ss(de(t)?[]:{},t));if(!u){for(h in e)wc.call(a,t,h,"get",e[h]);n=function(m){return Ac(m,a)||(o?t.p:t)}}}return Ir(i,n)},l0=function(t,e,i){var s=t.labels,n=Ze,o,a,h;for(o in s)a=s[o]-e,a<0==!!i&&a&&n>(a=Math.abs(a))&&(h=o,n=a);return h},ze=function(t,e,i){var s=t.vars,n=s[e],o=Zt,a=t._ctx,h,l,u;if(n)return h=s[e+"Params"],l=s.callbackScope||t,i&&Er.length&&rh(),a&&(Zt=a),u=h?n.apply(l,h):n.call(l),Zt=o,u},so=function(t){return Cr(t),t.scrollTrigger&&t.scrollTrigger.kill(!!ce),t.progress()<1&&ze(t,"onInterrupt"),t},tn,u0=[],c0=function(t){if(sc()&&t){t=!t.name&&t.default||t;var e=t.name,i=Vt(t),s=e&&!i&&t.init?function(){this._props=[]}:t,n={init:qn,render:Ac,add:wc,kill:wE,modifier:TE,rawVars:0},o={targetTest:0,get:0,getSetter:Ic,aliases:{},register:0};if(en(),t!==s){if(Re[e])return;He(s,He(sh(t,n),o)),ss(s.prototype,ss(n,sh(t,o))),Re[s.prop=e]=s,t.targetTest&&(ih.push(s),uc[e]=1),e=(e==="css"?"CSS":e.charAt(0).toUpperCase()+e.substr(1))+"Plugin"}Xg(e,s),t.register&&t.register(we,s,Te)}else t&&u0.push(t)},Pt=255,no={aqua:[0,Pt,Pt],lime:[0,Pt,0],silver:[192,192,192],black:[0,0,0],maroon:[128,0,0],teal:[0,128,128],blue:[0,0,Pt],navy:[0,0,128],white:[Pt,Pt,Pt],olive:[128,128,0],yellow:[Pt,Pt,0],orange:[Pt,165,0],gray:[128,128,128],purple:[128,0,128],green:[0,128,0],red:[Pt,0,0],pink:[Pt,192,203],cyan:[0,Pt,Pt],transparent:[Pt,Pt,Pt,0]},_c=function(t,e,i){return t+=t<0?1:t>1?-1:0,(t*6<1?e+(i-e)*t*6:t<.5?i:t*3<2?e+(i-e)*(2/3-t)*6:e)*Pt+.5|0},d0=function(t,e,i){var s=t?ir(t)?[t>>16,t>>8&Pt,t&Pt]:0:no.black,n,o,a,h,l,u,c,d,p,m;if(!s){if(t.substr(-1)===","&&(t=t.substr(0,t.length-1)),no[t])s=no[t];else if(t.charAt(0)==="#"){if(t.length<6&&(n=t.charAt(1),o=t.charAt(2),a=t.charAt(3),t="#"+n+n+o+o+a+a+(t.length===5?t.charAt(4)+t.charAt(4):"")),t.length===9)return s=parseInt(t.substr(1,6),16),[s>>16,s>>8&Pt,s&Pt,parseInt(t.substr(7),16)/255];t=parseInt(t.substr(1),16),s=[t>>16,t>>8&Pt,t&Pt]}else if(t.substr(0,3)==="hsl"){if(s=m=t.match(nc),!e)h=+s[0]%360/360,l=+s[1]/100,u=+s[2]/100,o=u<=.5?u*(l+1):u+l-u*l,n=u*2-o,s.length>3&&(s[3]*=1),s[0]=_c(h+1/3,n,o),s[1]=_c(h,n,o),s[2]=_c(h-1/3,n,o);else if(~t.indexOf("="))return s=t.match(kg),i&&s.length<4&&(s[3]=1),s}else s=t.match(nc)||no.transparent;s=s.map(Number)}return e&&!m&&(n=s[0]/Pt,o=s[1]/Pt,a=s[2]/Pt,c=Math.max(n,o,a),d=Math.min(n,o,a),u=(c+d)/2,c===d?h=l=0:(p=c-d,l=u>.5?p/(2-c-d):p/(c+d),h=c===n?(o-a)/p+(o<a?6:0):c===o?(a-n)/p+2:(n-o)/p+4,h*=60),s[0]=~~(h+.5),s[1]=~~(l*100+.5),s[2]=~~(u*100+.5)),i&&s.length<4&&(s[3]=1),s},p0=function(t){var e=[],i=[],s=-1;return t.split(Ar).forEach(function(n){var o=n.match(Js)||[];e.push.apply(e,o),i.push(s+=o.length+1)}),e.c=i,e},f0=function(t,e,i){var s="",n=(t+s).match(Ar),o=e?"hsla(":"rgba(",a=0,h,l,u,c;if(!n)return t;if(n=n.map(function(d){return(d=d0(d,e,1))&&o+(e?d[0]+","+d[1]+"%,"+d[2]+"%,"+d[3]:d.join(","))+")"}),i&&(u=p0(t),h=i.c,h.join(s)!==u.c.join(s)))for(l=t.replace(Ar,"1").split(Js),c=l.length-1;a<c;a++)s+=l[a]+(~h.indexOf(a)?n.shift()||o+"0,0,0,0)":(u.length?u:n.length?n:i).shift());if(!l)for(l=t.split(Ar),c=l.length-1;a<c;a++)s+=l[a]+n[a];return s+l[c]},Ar=function(){var r="(?:\\b(?:(?:rgb|rgba|hsl|hsla)\\(.+?\\))|\\B#(?:[0-9a-f]{3,4}){1,2}\\b",t;for(t in no)r+="|"+t+"\\b";return new RegExp(r+")","gi")}(),hE=/hsl[a]?\(/,m0=function(t){var e=t.join(" "),i;if(Ar.lastIndex=0,Ar.test(e))return i=hE.test(e),t[1]=f0(t[1],i),t[0]=f0(t[0],i,p0(t[1])),!0},oo,Pe=function(){var r=Date.now,t=500,e=33,i=r(),s=i,n=1e3/240,o=n,a=[],h,l,u,c,d,p,m=function f(g){var y=r()-s,_=g===!0,x,v,S,C;if(y>t&&(i+=y-e),s+=y,S=s-i,x=S-o,(x>0||_)&&(C=++c.frame,d=S-c.time*1e3,c.time=S=S/1e3,o+=x+(x>=n?4:n-x),v=1),_||(h=l(f)),v)for(p=0;p<a.length;p++)a[p](S,d,C,g)};return c={time:0,frame:0,tick:function(){m(!0)},deltaRatio:function(g){return d/(1e3/(g||60))},wake:function(){Wg&&(!ac&&sc()&&(Ve=ac=window,hc=Ve.document||{},Me.gsap=we,(Ve.gsapVersions||(Ve.gsapVersions=[])).push(we.version),Ug(qa||Ve.GreenSockGlobals||!Ve.gsap&&Ve||{}),u=Ve.requestAnimationFrame,u0.forEach(c0)),h&&c.sleep(),l=u||function(g){return setTimeout(g,o-c.time*1e3+1|0)},oo=1,m(2))},sleep:function(){(u?Ve.cancelAnimationFrame:clearTimeout)(h),oo=0,l=qn},lagSmoothing:function(g,y){t=g||1/0,e=Math.min(y||33,t)},fps:function(g){n=1e3/(g||240),o=c.time*1e3+n},add:function(g,y,_){var x=y?function(v,S,C,A){g(v,S,C,A),c.remove(x)}:g;return c.remove(g),a[_?"unshift":"push"](x),en(),x},remove:function(g,y){~(y=a.indexOf(g))&&a.splice(y,1)&&p>=y&&p--},_listeners:a},c}(),en=function(){return!oo&&Pe.wake()},Tt={},lE=/^[\d.\-M][\d.\-,\s]/,uE=/["']/g,cE=function(t){for(var e={},i=t.substr(1,t.length-3).split(":"),s=i[0],n=1,o=i.length,a,h,l;n<o;n++)h=i[n],a=n!==o-1?h.lastIndexOf(","):h.length,l=h.substr(0,a),e[s]=isNaN(l)?l.replace(uE,"").trim():+l,s=h.substr(a+1).trim();return e},dE=function(t){var e=t.indexOf("(")+1,i=t.indexOf(")"),s=t.indexOf("(",e);return t.substring(e,~s&&s<i?t.indexOf(")",i+1):i)},pE=function(t){var e=(t+"").split("("),i=Tt[e[0]];return i&&e.length>1&&i.config?i.config.apply(null,~t.indexOf("{")?[cE(e[1])]:dE(t).split(",").map(Yg)):Tt._CE&&lE.test(t)?Tt._CE("",t):i},g0=function(t){return function(e){return 1-t(1-e)}},y0=function r(t,e){for(var i=t._first,s;i;)i instanceof ve?r(i,e):i.vars.yoyoEase&&(!i._yoyo||!i._repeat)&&i._yoyo!==e&&(i.timeline?r(i.timeline,e):(s=i._ease,i._ease=i._yEase,i._yEase=s,i._yoyo=e)),i=i._next},os=function(t,e){return t&&(Vt(t)?t:Tt[t]||pE(t))||e},as=function(t,e,i,s){i===void 0&&(i=function(h){return 1-e(1-h)}),s===void 0&&(s=function(h){return h<.5?e(h*2)/2:1-e((1-h)*2)/2});var n={easeIn:e,easeOut:i,easeInOut:s},o;return _e(t,function(a){Tt[a]=Me[a]=n,Tt[o=a.toLowerCase()]=i;for(var h in n)Tt[o+(h==="easeIn"?".in":h==="easeOut"?".out":".inOut")]=Tt[a+"."+h]=n[h]}),n},b0=function(t){return function(e){return e<.5?(1-t(1-e*2))/2:.5+t((e-.5)*2)/2}},vc=function r(t,e,i){var s=e>=1?e:1,n=(i||(t?.3:.45))/(e<1?e:1),o=n/ic*(Math.asin(1/s)||0),a=function(u){return u===1?1:s*Math.pow(2,-10*u)*US((u-o)*n)+1},h=t==="out"?a:t==="in"?function(l){return 1-a(1-l)}:b0(a);return n=ic/n,h.config=function(l,u){return r(t,l,u)},h},Tc=function r(t,e){e===void 0&&(e=1.70158);var i=function(o){return o?--o*o*((e+1)*o+e)+1:0},s=t==="out"?i:t==="in"?function(n){return 1-i(1-n)}:b0(i);return s.config=function(n){return r(t,n)},s};_e("Linear,Quad,Cubic,Quart,Quint,Strong",function(r,t){var e=t<5?t+1:t;as(r+",Power"+(e-1),t?function(i){return Math.pow(i,e)}:function(i){return i},function(i){return 1-Math.pow(1-i,e)},function(i){return i<.5?Math.pow(i*2,e)/2:1-Math.pow((1-i)*2,e)/2})}),Tt.Linear.easeNone=Tt.none=Tt.Linear.easeIn,as("Elastic",vc("in"),vc("out"),vc()),function(r,t){var e=1/t,i=2*e,s=2.5*e,n=function(a){return a<e?r*a*a:a<i?r*Math.pow(a-1.5/t,2)+.75:a<s?r*(a-=2.25/t)*a+.9375:r*Math.pow(a-2.625/t,2)+.984375};as("Bounce",function(o){return 1-n(1-o)},n)}(7.5625,2.75),as("Expo",function(r){return r?Math.pow(2,10*(r-1)):0}),as("Circ",function(r){return-(Fg(1-r*r)-1)}),as("Sine",function(r){return r===1?1:-WS(r*OS)+1}),as("Back",Tc("in"),Tc("out"),Tc()),Tt.SteppedEase=Tt.steps=Me.SteppedEase={config:function(t,e){t===void 0&&(t=1);var i=1/t,s=t+(e?0:1),n=e?1:0,o=1-Rt;return function(a){return((s*io(0,o,a)|0)+n)*i}}},js.ease=Tt["quad.out"],_e("onComplete,onUpdate,onStart,onRepeat,onReverseComplete,onInterrupt",function(r){return pc+=r+","+r+"Params,"});var x0=function(t,e){this.id=BS++,t._gsap=this,this.target=t,this.harness=e,this.get=e?e.get:Hg,this.set=e?e.getSetter:Ic},ao=function(){function r(e){this.vars=e,this._delay=+e.delay||0,(this._repeat=e.repeat===1/0?-2:e.repeat||0)&&(this._rDelay=e.repeatDelay||0,this._yoyo=!!e.yoyo||!!e.yoyoEase),this._ts=1,qs(this,+e.duration,1,1),this.data=e.data,Zt&&(this._ctx=Zt,Zt.data.push(this)),oo||Pe.wake()}var t=r.prototype;return t.delay=function(i){return i||i===0?(this.parent&&this.parent.smoothChildTiming&&this.startTime(this._start+i-this._delay),this._delay=i,this):this._delay},t.duration=function(i){return arguments.length?this.totalDuration(this._repeat>0?i+(i+this._rDelay)*this._repeat:i):this.totalDuration()&&this._dur},t.totalDuration=function(i){return arguments.length?(this._dirty=0,qs(this,this._repeat<0?i:(i-this._repeat*this._rDelay)/(this._repeat+1))):this._tDur},t.totalTime=function(i,s){if(en(),!arguments.length)return this._tTime;var n=this._dp;if(n&&n.smoothChildTiming&&this._ts){for(hh(this,i),!n._dp||n.parent||Qg(n,this);n&&n.parent;)n.parent._time!==n._start+(n._ts>=0?n._tTime/n._ts:(n.totalDuration()-n._tTime)/-n._ts)&&n.totalTime(n._tTime,!0),n=n.parent;!this.parent&&this._dp.autoRemoveChildren&&(this._ts>0&&i<this._tDur||this._ts<0&&i>0||!this._tDur&&!i)&&Mi(this._dp,this,this._start-this._delay)}return(this._tTime!==i||!this._dur&&!s||this._initted&&Math.abs(this._zTime)===Rt||!i&&!this._initted&&(this.add||this._ptLookup))&&(this._ts||(this._pTime=i),Kg(this,i,s)),this},t.time=function(i,s){return arguments.length?this.totalTime(Math.min(this.totalDuration(),i+$g(this))%(this._dur+this._rDelay)||(i?this._dur:0),s):this._time},t.totalProgress=function(i,s){return arguments.length?this.totalTime(this.totalDuration()*i,s):this.totalDuration()?Math.min(1,this._tTime/this._tDur):this.ratio},t.progress=function(i,s){return arguments.length?this.totalTime(this.duration()*(this._yoyo&&!(this.iteration()&1)?1-i:i)+$g(this),s):this.duration()?Math.min(1,this._time/this._dur):this.ratio},t.iteration=function(i,s){var n=this.duration()+this._rDelay;return arguments.length?this.totalTime(this._time+(i-1)*n,s):this._repeat?Qs(this._tTime,n)+1:1},t.timeScale=function(i){if(!arguments.length)return this._rts===-Rt?0:this._rts;if(this._rts===i)return this;var s=this.parent&&this._ts?oh(this.parent._time,this):this._tTime;return this._rts=+i||0,this._ts=this._ps||i===-Rt?0:this._rts,this.totalTime(io(-Math.abs(this._delay),this._tDur,s),!0),ah(this),zS(this)},t.paused=function(i){return arguments.length?(this._ps!==i&&(this._ps=i,i?(this._pTime=this._tTime||Math.max(-this._delay,this.rawTime()),this._ts=this._act=0):(en(),this._ts=this._rts,this.totalTime(this.parent&&!this.parent.smoothChildTiming?this.rawTime():this._tTime||this._pTime,this.progress()===1&&Math.abs(this._zTime)!==Rt&&(this._tTime-=Rt)))),this):this._ps},t.startTime=function(i){if(arguments.length){this._start=i;var s=this.parent||this._dp;return s&&(s._sort||!this.parent)&&Mi(s,this,i-this._delay),this}return this._start},t.endTime=function(i){return this._start+(xe(i)?this.totalDuration():this.duration())/Math.abs(this._ts||1)},t.rawTime=function(i){var s=this.parent||this._dp;return s?i&&(!this._ts||this._repeat&&this._time&&this.totalProgress()<1)?this._tTime%(this._dur+this._rDelay):this._ts?oh(s.rawTime(i),this):this._tTime:this._tTime},t.revert=function(i){i===void 0&&(i=VS);var s=ce;return ce=i,(this._initted||this._startAt)&&(this.timeline&&this.timeline.revert(i),this.totalTime(-.01,i.suppressEvents)),this.data!=="nested"&&i.kill!==!1&&this.kill(),ce=s,this},t.globalTime=function(i){for(var s=this,n=arguments.length?i:s.rawTime();s;)n=s._start+n/(s._ts||1),s=s._dp;return!this.parent&&this._sat?this._sat.vars.immediateRender?-1/0:this._sat.globalTime(i):n},t.repeat=function(i){return arguments.length?(this._repeat=i===1/0?-2:i,e0(this)):this._repeat===-2?1/0:this._repeat},t.repeatDelay=function(i){if(arguments.length){var s=this._time;return this._rDelay=i,e0(this),s?this.time(s):this}return this._rDelay},t.yoyo=function(i){return arguments.length?(this._yoyo=i,this):this._yoyo},t.seek=function(i,s){return this.totalTime(Ke(this,i),xe(s))},t.restart=function(i,s){return this.play().totalTime(i?-this._delay:0,xe(s))},t.play=function(i,s){return i!=null&&this.seek(i,s),this.reversed(!1).paused(!1)},t.reverse=function(i,s){return i!=null&&this.seek(i||this.totalDuration(),s),this.reversed(!0).paused(!1)},t.pause=function(i,s){return i!=null&&this.seek(i,s),this.paused(!0)},t.resume=function(){return this.paused(!1)},t.reversed=function(i){return arguments.length?(!!i!==this.reversed()&&this.timeScale(-this._rts||(i?-Rt:0)),this):this._rts<0},t.invalidate=function(){return this._initted=this._act=0,this._zTime=-Rt,this},t.isActive=function(){var i=this.parent||this._dp,s=this._start,n;return!!(!i||this._ts&&this._initted&&i.isActive()&&(n=i.rawTime(!0))>=s&&n<this.endTime(!0)-Rt)},t.eventCallback=function(i,s,n){var o=this.vars;return arguments.length>1?(s?(o[i]=s,n&&(o[i+"Params"]=n),i==="onUpdate"&&(this._onUpdate=s)):delete o[i],this):o[i]},t.then=function(i){var s=this;return new Promise(function(n){var o=Vt(i)?i:zg,a=function(){var l=s.then;s.then=null,Vt(o)&&(o=o(s))&&(o.then||o===s)&&(s.then=l),n(o),s.then=l};s._initted&&s.totalProgress()===1&&s._ts>=0||!s._tTime&&s._ts<0?a():s._prom=a})},t.kill=function(){so(this)},r}();He(ao.prototype,{_time:0,_start:0,_end:0,_tTime:0,_tDur:0,_dirty:0,_repeat:0,_yoyo:!1,parent:null,_initted:!1,_rDelay:0,_ts:1,_dp:0,ratio:0,_zTime:-Rt,_prom:0,_ps:!1,_rts:1});var ve=function(r){Ng(t,r);function t(i,s){var n;return i===void 0&&(i={}),n=r.call(this,i)||this,n.labels={},n.smoothChildTiming=!!i.smoothChildTiming,n.autoRemoveChildren=!!i.autoRemoveChildren,n._sort=xe(i.sortChildren),Bt&&Mi(i.parent||Bt,er(n),s),i.reversed&&n.reverse(),i.paused&&n.paused(!0),i.scrollTrigger&&qg(er(n),i.scrollTrigger),n}var e=t.prototype;return e.to=function(s,n,o){return eo(0,arguments,this),this},e.from=function(s,n,o){return eo(1,arguments,this),this},e.fromTo=function(s,n,o,a){return eo(2,arguments,this),this},e.set=function(s,n,o){return n.duration=0,n.parent=this,to(n).repeatDelay||(n.repeat=0),n.immediateRender=!!n.immediateRender,new zt(s,n,Ke(this,o),1),this},e.call=function(s,n,o){return Mi(this,zt.delayedCall(0,s,n),o)},e.staggerTo=function(s,n,o,a,h,l,u){return o.duration=n,o.stagger=o.stagger||a,o.onComplete=l,o.onCompleteParams=u,o.parent=this,new zt(s,o,Ke(this,h)),this},e.staggerFrom=function(s,n,o,a,h,l,u){return o.runBackwards=1,to(o).immediateRender=xe(o.immediateRender),this.staggerTo(s,n,o,a,h,l,u)},e.staggerFromTo=function(s,n,o,a,h,l,u,c){return a.startAt=o,to(a).immediateRender=xe(a.immediateRender),this.staggerTo(s,n,a,h,l,u,c)},e.render=function(s,n,o){var a=this._time,h=this._dirty?this.totalDuration():this._tDur,l=this._dur,u=s<=0?0:he(s),c=this._zTime<0!=s<0&&(this._initted||!l),d,p,m,f,g,y,_,x,v,S,C,A;if(this!==Bt&&u>h&&s>=0&&(u=h),u!==this._tTime||o||c){if(a!==this._time&&l&&(u+=this._time-a,s+=this._time-a),d=u,v=this._start,x=this._ts,y=!x,c&&(l||(a=this._zTime),(s||!n)&&(this._zTime=s)),this._repeat){if(C=this._yoyo,g=l+this._rDelay,this._repeat<-1&&s<0)return this.totalTime(g*100+s,n,o);if(d=he(u%g),u===h?(f=this._repeat,d=l):(f=~~(u/g),f&&f===u/g&&(d=l,f--),d>l&&(d=l)),S=Qs(this._tTime,g),!a&&this._tTime&&S!==f&&this._tTime-S*g-this._dur<=0&&(S=f),C&&f&1&&(d=l-d,A=1),f!==S&&!this._lock){var I=C&&S&1,L=I===(C&&f&1);if(f<S&&(I=!I),a=I?0:u%l?l:u,this._lock=1,this.render(a||(A?0:he(f*g)),n,!l)._lock=0,this._tTime=u,!n&&this.parent&&ze(this,"onRepeat"),this.vars.repeatRefresh&&!A&&(this.invalidate()._lock=1),a&&a!==this._time||y!==!this._ts||this.vars.onRepeat&&!this.parent&&!this._act)return this;if(l=this._dur,h=this._tDur,L&&(this._lock=2,a=I?l:-1e-4,this.render(a,!0),this.vars.repeatRefresh&&!A&&this.invalidate()),this._lock=0,!this._ts&&!y)return this;y0(this,A)}}if(this._hasPause&&!this._forcing&&this._lock<2&&(_=QS(this,he(a),he(d)),_&&(u-=d-(d=_._start))),this._tTime=u,this._time=d,this._act=!x,this._initted||(this._onUpdate=this.vars.onUpdate,this._initted=1,this._zTime=s,a=0),!a&&d&&!n&&!f&&(ze(this,"onStart"),this._tTime!==u))return this;if(d>=a&&s>=0)for(p=this._first;p;){if(m=p._next,(p._act||d>=p._start)&&p._ts&&_!==p){if(p.parent!==this)return this.render(s,n,o);if(p.render(p._ts>0?(d-p._start)*p._ts:(p._dirty?p.totalDuration():p._tDur)+(d-p._start)*p._ts,n,o),d!==this._time||!this._ts&&!y){_=0,m&&(u+=this._zTime=-Rt);break}}p=m}else{p=this._last;for(var k=s<0?s:d;p;){if(m=p._prev,(p._act||k<=p._end)&&p._ts&&_!==p){if(p.parent!==this)return this.render(s,n,o);if(p.render(p._ts>0?(k-p._start)*p._ts:(p._dirty?p.totalDuration():p._tDur)+(k-p._start)*p._ts,n,o||ce&&(p._initted||p._startAt)),d!==this._time||!this._ts&&!y){_=0,m&&(u+=this._zTime=k?-Rt:Rt);break}}p=m}}if(_&&!n&&(this.pause(),_.render(d>=a?0:-Rt)._zTime=d>=a?1:-1,this._ts))return this._start=v,ah(this),this.render(s,n,o);this._onUpdate&&!n&&ze(this,"onUpdate",!0),(u===h&&this._tTime>=this.totalDuration()||!u&&a)&&(v===this._start||Math.abs(x)!==Math.abs(this._ts))&&(this._lock||((s||!l)&&(u===h&&this._ts>0||!u&&this._ts<0)&&Cr(this,1),!n&&!(s<0&&!a)&&(u||a||!h)&&(ze(this,u===h&&s>=0?"onComplete":"onReverseComplete",!0),this._prom&&!(u<h&&this.timeScale()>0)&&this._prom())))}return this},e.add=function(s,n){var o=this;if(ir(n)||(n=Ke(this,n,s)),!(s instanceof ao)){if(de(s))return s.forEach(function(a){return o.add(a,n)}),this;if(re(s))return this.addLabel(s,n);if(Vt(s))s=zt.delayedCall(0,s);else return this}return this!==s?Mi(this,s,n):this},e.getChildren=function(s,n,o,a){s===void 0&&(s=!0),n===void 0&&(n=!0),o===void 0&&(o=!0),a===void 0&&(a=-Ze);for(var h=[],l=this._first;l;)l._start>=a&&(l instanceof zt?n&&h.push(l):(o&&h.push(l),s&&h.push.apply(h,l.getChildren(!0,n,o)))),l=l._next;return h},e.getById=function(s){for(var n=this.getChildren(1,1,1),o=n.length;o--;)if(n[o].vars.id===s)return n[o]},e.remove=function(s){return re(s)?this.removeLabel(s):Vt(s)?this.killTweensOf(s):(nh(this,s),s===this._recent&&(this._recent=this._last),ns(this))},e.totalTime=function(s,n){return arguments.length?(this._forcing=1,!this._dp&&this._ts&&(this._start=he(Pe.time-(this._ts>0?s/this._ts:(this.totalDuration()-s)/-this._ts))),r.prototype.totalTime.call(this,s,n),this._forcing=0,this):this._tTime},e.addLabel=function(s,n){return this.labels[s]=Ke(this,n),this},e.removeLabel=function(s){return delete this.labels[s],this},e.addPause=function(s,n,o){var a=zt.delayedCall(0,n||qn,o);return a.data="isPause",this._hasPause=1,Mi(this,a,Ke(this,s))},e.removePause=function(s){var n=this._first;for(s=Ke(this,s);n;)n._start===s&&n.data==="isPause"&&Cr(n),n=n._next},e.killTweensOf=function(s,n,o){for(var a=this.getTweensOf(s,o),h=a.length;h--;)Mr!==a[h]&&a[h].kill(s,n);return this},e.getTweensOf=function(s,n){for(var o=[],a=Ye(s),h=this._first,l=ir(n),u;h;)h instanceof zt?HS(h._targets,a)&&(l?(!Mr||h._initted&&h._ts)&&h.globalTime(0)<=n&&h.globalTime(h.totalDuration())>n:!n||h.isActive())&&o.push(h):(u=h.getTweensOf(a,n)).length&&o.push.apply(o,u),h=h._next;return o},e.tweenTo=function(s,n){n=n||{};var o=this,a=Ke(o,s),h=n,l=h.startAt,u=h.onStart,c=h.onStartParams,d=h.immediateRender,p,m=zt.to(o,He({ease:n.ease||"none",lazy:!1,immediateRender:!1,time:a,overwrite:"auto",duration:n.duration||Math.abs((a-(l&&"time"in l?l.time:o._time))/o.timeScale())||Rt,onStart:function(){if(o.pause(),!p){var g=n.duration||Math.abs((a-(l&&"time"in l?l.time:o._time))/o.timeScale());m._dur!==g&&qs(m,g,0,1).render(m._time,!0,!0),p=1}u&&u.apply(m,c||[])}},n));return d?m.render(0):m},e.tweenFromTo=function(s,n,o){return this.tweenTo(n,He({startAt:{time:Ke(this,s)}},o))},e.recent=function(){return this._recent},e.nextLabel=function(s){return s===void 0&&(s=this._time),l0(this,Ke(this,s))},e.previousLabel=function(s){return s===void 0&&(s=this._time),l0(this,Ke(this,s),1)},e.currentLabel=function(s){return arguments.length?this.seek(s,!0):this.previousLabel(this._time+Rt)},e.shiftChildren=function(s,n,o){o===void 0&&(o=0);for(var a=this._first,h=this.labels,l;a;)a._start>=o&&(a._start+=s,a._end+=s),a=a._next;if(n)for(l in h)h[l]>=o&&(h[l]+=s);return ns(this)},e.invalidate=function(s){var n=this._first;for(this._lock=0;n;)n.invalidate(s),n=n._next;return r.prototype.invalidate.call(this,s)},e.clear=function(s){s===void 0&&(s=!0);for(var n=this._first,o;n;)o=n._next,this.remove(n),n=o;return this._dp&&(this._time=this._tTime=this._pTime=0),s&&(this.labels={}),ns(this)},e.totalDuration=function(s){var n=0,o=this,a=o._last,h=Ze,l,u,c;if(arguments.length)return o.timeScale((o._repeat<0?o.duration():o.totalDuration())/(o.reversed()?-s:s));if(o._dirty){for(c=o.parent;a;)l=a._prev,a._dirty&&a.totalDuration(),u=a._start,u>h&&o._sort&&a._ts&&!o._lock?(o._lock=1,Mi(o,a,u-a._delay,1)._lock=0):h=u,u<0&&a._ts&&(n-=u,(!c&&!o._dp||c&&c.smoothChildTiming)&&(o._start+=u/o._ts,o._time-=u,o._tTime-=u),o.shiftChildren(-u,!1,-1/0),h=0),a._end>n&&a._ts&&(n=a._end),a=l;qs(o,o===Bt&&o._time>n?o._time:n,1,1),o._dirty=0}return o._tDur},t.updateRoot=function(s){if(Bt._ts&&(Kg(Bt,oh(s,Bt)),Zg=Pe.frame),Pe.frame>=Vg){Vg+=Ae.autoSleep||120;var n=Bt._first;if((!n||!n._ts)&&Ae.autoSleep&&Pe._listeners.length<2){for(;n&&!n._ts;)n=n._next;n||Pe.sleep()}}},t}(ao);He(ve.prototype,{_lock:0,_hasPause:0,_forcing:0});var fE=function(t,e,i,s,n,o,a){var h=new Te(this._pt,t,e,0,1,E0,null,n),l=0,u=0,c,d,p,m,f,g,y,_;for(h.b=i,h.e=s,i+="",s+="",(y=~s.indexOf("random("))&&(s=ro(s)),o&&(_=[i,s],o(_,t,e),i=_[0],s=_[1]),d=i.match(oc)||[];c=oc.exec(s);)m=c[0],f=s.substring(l,c.index),p?p=(p+1)%5:f.substr(-5)==="rgba("&&(p=1),m!==d[u++]&&(g=parseFloat(d[u-1])||0,h._pt={_next:h._pt,p:f||u===1?f:",",s:g,c:m.charAt(1)==="="?$s(g,m)-g:parseFloat(m)-g,m:p&&p<4?Math.round:0},l=oc.lastIndex);return h.c=l<s.length?s.substring(l,s.length):"",h.fp=a,(Og.test(s)||y)&&(h.e=0),this._pt=h,h},wc=function(t,e,i,s,n,o,a,h,l,u){Vt(s)&&(s=s(n||0,t,o));var c=t[e],d=i!=="get"?i:Vt(c)?l?t[e.indexOf("set")||!Vt(t["get"+e.substr(3)])?e:"get"+e.substr(3)](l):t[e]():c,p=Vt(c)?l?xE:w0:Cc,m;if(re(s)&&(~s.indexOf("random(")&&(s=ro(s)),s.charAt(1)==="="&&(m=$s(d,s)+(pe(d)||0),(m||m===0)&&(s=m))),!u||d!==s||Sc)return!isNaN(d*s)&&s!==""?(m=new Te(this._pt,t,e,+d||0,s-(d||0),typeof c=="boolean"?vE:S0,0,p),l&&(m.fp=l),a&&m.modifier(a,this,t),this._pt=m):(!c&&!(e in t)&&lc(e,s),fE.call(this,t,e,d,s,p,h||Ae.stringFilter,l))},mE=function(t,e,i,s,n){if(Vt(t)&&(t=ho(t,n,e,i,s)),!Ai(t)||t.style&&t.nodeType||de(t)||Dg(t))return re(t)?ho(t,n,e,i,s):t;var o={},a;for(a in t)o[a]=ho(t[a],n,e,i,s);return o},_0=function(t,e,i,s,n,o){var a,h,l,u;if(Re[t]&&(a=new Re[t]).init(n,a.rawVars?e[t]:mE(e[t],s,n,o,i),i,s,o)!==!1&&(i._pt=h=new Te(i._pt,n,t,0,1,a.render,a,0,a.priority),i!==tn))for(l=i._ptLookup[i._targets.indexOf(n)],u=a._props.length;u--;)l[a._props[u]]=h;return a},Mr,Sc,Ec=function r(t,e,i){var s=t.vars,n=s.ease,o=s.startAt,a=s.immediateRender,h=s.lazy,l=s.onUpdate,u=s.onUpdateParams,c=s.callbackScope,d=s.runBackwards,p=s.yoyoEase,m=s.keyframes,f=s.autoRevert,g=t._dur,y=t._startAt,_=t._targets,x=t.parent,v=x&&x.data==="nested"?x.vars.targets:_,S=t._overwrite==="auto"&&!ec,C=t.timeline,A,I,L,k,M,G,E,N,O,Z,U,K,ht;if(C&&(!m||!n)&&(n="none"),t._ease=os(n,js.ease),t._yEase=p?g0(os(p===!0?n:p,js.ease)):0,p&&t._yoyo&&!t._repeat&&(p=t._yEase,t._yEase=t._ease,t._ease=p),t._from=!C&&!!s.runBackwards,!C||m&&!s.stagger){if(N=_[0]?rs(_[0]).harness:0,K=N&&s[N.prop],A=sh(s,uc),y&&(y._zTime<0&&y.progress(1),e<0&&d&&a&&!f?y.render(-1,!0):y.revert(d&&g?eh:ZS),y._lazy=0),o){if(Cr(t._startAt=zt.set(_,He({data:"isStart",overwrite:!1,parent:x,immediateRender:!0,lazy:!y&&xe(h),startAt:null,delay:0,onUpdate:l,onUpdateParams:u,callbackScope:c,stagger:0},o))),t._startAt._dp=0,t._startAt._sat=t,e<0&&(ce||!a&&!f)&&t._startAt.revert(eh),a&&g&&e<=0&&i<=0){e&&(t._zTime=e);return}}else if(d&&g&&!y){if(e&&(a=!1),L=He({overwrite:!1,data:"isFromStart",lazy:a&&!y&&xe(h),immediateRender:a,stagger:0,parent:x},A),K&&(L[N.prop]=K),Cr(t._startAt=zt.set(_,L)),t._startAt._dp=0,t._startAt._sat=t,e<0&&(ce?t._startAt.revert(eh):t._startAt.render(-1,!0)),t._zTime=e,!a)r(t._startAt,Rt,Rt);else if(!e)return}for(t._pt=t._ptCache=0,h=g&&xe(h)||h&&!g,I=0;I<_.length;I++){if(M=_[I],E=M._gsap||fc(_)[I]._gsap,t._ptLookup[I]=Z={},cc[E.id]&&Er.length&&rh(),U=v===_?I:v.indexOf(M),N&&(O=new N).init(M,K||A,t,U,v)!==!1&&(t._pt=k=new Te(t._pt,M,O.name,0,1,O.render,O,0,O.priority),O._props.forEach(function(X){Z[X]=k}),O.priority&&(G=1)),!N||K)for(L in A)Re[L]&&(O=_0(L,A,t,U,M,v))?O.priority&&(G=1):Z[L]=k=wc.call(t,M,L,"get",A[L],U,v,0,s.stringFilter);t._op&&t._op[I]&&t.kill(M,t._op[I]),S&&t._pt&&(Mr=t,Bt.killTweensOf(M,Z,t.globalTime(e)),ht=!t.parent,Mr=0),t._pt&&h&&(cc[E.id]=1)}G&&C0(t),t._onInit&&t._onInit(t)}t._onUpdate=l,t._initted=(!t._op||t._pt)&&!ht,m&&e<=0&&C.render(Ze,!0,!0)},gE=function(t,e,i,s,n,o,a){var h=(t._pt&&t._ptCache||(t._ptCache={}))[e],l,u,c,d;if(!h)for(h=t._ptCache[e]=[],c=t._ptLookup,d=t._targets.length;d--;){if(l=c[d][e],l&&l.d&&l.d._pt)for(l=l.d._pt;l&&l.p!==e&&l.fp!==e;)l=l._next;if(!l)return Sc=1,t.vars[e]="+=0",Ec(t,a),Sc=0,1;h.push(l)}for(d=h.length;d--;)u=h[d],l=u._pt||u,l.s=(s||s===0)&&!n?s:l.s+(s||0)+o*l.c,l.c=i-l.s,u.e&&(u.e=Kt(i)+pe(u.e)),u.b&&(u.b=l.s+pe(u.b))},yE=function(t,e){var i=t[0]?rs(t[0]).harness:0,s=i&&i.aliases,n,o,a,h;if(!s)return e;n=ss({},e);for(o in s)if(o in n)for(h=s[o].split(","),a=h.length;a--;)n[h[a]]=n[o];return n},bE=function(t,e,i,s){var n=e.ease||s||"power1.inOut",o,a;if(de(e))a=i[t]||(i[t]=[]),e.forEach(function(h,l){return a.push({t:l/(e.length-1)*100,v:h,e:n})});else for(o in e)a=i[o]||(i[o]=[]),o==="ease"||a.push({t:parseFloat(t),v:e[o],e:n})},ho=function(t,e,i,s,n){return Vt(t)?t.call(e,i,s,n):re(t)&&~t.indexOf("random(")?ro(t):t},v0=pc+"repeat,repeatDelay,yoyo,repeatRefresh,yoyoEase,autoRevert",T0={};_e(v0+",id,stagger,delay,duration,paused,scrollTrigger",function(r){return T0[r]=1});var zt=function(r){Ng(t,r);function t(i,s,n,o){var a;typeof s=="number"&&(n.duration=s,s=n,n=null),a=r.call(this,o?s:to(s))||this;var h=a.vars,l=h.duration,u=h.delay,c=h.immediateRender,d=h.stagger,p=h.overwrite,m=h.keyframes,f=h.defaults,g=h.scrollTrigger,y=h.yoyoEase,_=s.parent||Bt,x=(de(i)||Dg(i)?ir(i[0]):"length"in s)?[i]:Ye(i),v,S,C,A,I,L,k,M;if(a._targets=x.length?fc(x):th("GSAP target "+i+" not found. https://greensock.com",!Ae.nullTargetWarn)||[],a._ptLookup=[],a._overwrite=p,m||d||Qa(l)||Qa(u)){if(s=a.vars,v=a.timeline=new ve({data:"nested",defaults:f||{},targets:_&&_.data==="nested"?_.vars.targets:x}),v.kill(),v.parent=v._dp=er(a),v._start=0,d||Qa(l)||Qa(u)){if(A=x.length,k=d&&s0(d),Ai(d))for(I in d)~v0.indexOf(I)&&(M||(M={}),M[I]=d[I]);for(S=0;S<A;S++)C=sh(s,T0),C.stagger=0,y&&(C.yoyoEase=y),M&&ss(C,M),L=x[S],C.duration=+ho(l,er(a),S,L,x),C.delay=(+ho(u,er(a),S,L,x)||0)-a._delay,!d&&A===1&&C.delay&&(a._delay=u=C.delay,a._start+=u,C.delay=0),v.to(L,C,k?k(S,L,x):0),v._ease=Tt.none;v.duration()?l=u=0:a.timeline=0}else if(m){to(He(v.vars.defaults,{ease:"none"})),v._ease=os(m.ease||s.ease||"none");var G=0,E,N,O;if(de(m))m.forEach(function(Z){return v.to(x,Z,">")}),v.duration();else{C={};for(I in m)I==="ease"||I==="easeEach"||bE(I,m[I],C,m.easeEach);for(I in C)for(E=C[I].sort(function(Z,U){return Z.t-U.t}),G=0,S=0;S<E.length;S++)N=E[S],O={ease:N.e,duration:(N.t-(S?E[S-1].t:0))/100*l},O[I]=N.v,v.to(x,O,G),G+=O.duration;v.duration()<l&&v.to({},{duration:l-v.duration()})}}l||a.duration(l=v.duration())}else a.timeline=0;return p===!0&&!ec&&(Mr=er(a),Bt.killTweensOf(x),Mr=0),Mi(_,er(a),n),s.reversed&&a.reverse(),s.paused&&a.paused(!0),(c||!l&&!m&&a._start===he(_._time)&&xe(c)&&jS(er(a))&&_.data!=="nested")&&(a._tTime=-Rt,a.render(Math.max(0,-u)||0)),g&&qg(er(a),g),a}var e=t.prototype;return e.render=function(s,n,o){var a=this._time,h=this._tDur,l=this._dur,u=s<0,c=s>h-Rt&&!u?h:s<Rt?0:s,d,p,m,f,g,y,_,x,v;if(!l)$S(this,s,n,o);else if(c!==this._tTime||!s||o||!this._initted&&this._tTime||this._startAt&&this._zTime<0!==u){if(d=c,x=this.timeline,this._repeat){if(f=l+this._rDelay,this._repeat<-1&&u)return this.totalTime(f*100+s,n,o);if(d=he(c%f),c===h?(m=this._repeat,d=l):(m=~~(c/f),m&&m===c/f&&(d=l,m--),d>l&&(d=l)),y=this._yoyo&&m&1,y&&(v=this._yEase,d=l-d),g=Qs(this._tTime,f),d===a&&!o&&this._initted)return this._tTime=c,this;m!==g&&(x&&this._yEase&&y0(x,y),this.vars.repeatRefresh&&!y&&!this._lock&&(this._lock=o=1,this.render(he(f*m),!0).invalidate()._lock=0))}if(!this._initted){if(t0(this,u?s:d,o,n,c))return this._tTime=0,this;if(a!==this._time)return this;if(l!==this._dur)return this.render(s,n,o)}if(this._tTime=c,this._time=d,!this._act&&this._ts&&(this._act=1,this._lazy=0),this.ratio=_=(v||this._ease)(d/l),this._from&&(this.ratio=_=1-_),d&&!a&&!n&&!m&&(ze(this,"onStart"),this._tTime!==c))return this;for(p=this._pt;p;)p.r(_,p.d),p=p._next;x&&x.render(s<0?s:!d&&y?-Rt:x._dur*x._ease(d/this._dur),n,o)||this._startAt&&(this._zTime=s),this._onUpdate&&!n&&(u&&mc(this,s,n,o),ze(this,"onUpdate")),this._repeat&&m!==g&&this.vars.onRepeat&&!n&&this.parent&&ze(this,"onRepeat"),(c===this._tDur||!c)&&this._tTime===c&&(u&&!this._onUpdate&&mc(this,s,!0,!0),(s||!l)&&(c===this._tDur&&this._ts>0||!c&&this._ts<0)&&Cr(this,1),!n&&!(u&&!a)&&(c||a||y)&&(ze(this,c===h?"onComplete":"onReverseComplete",!0),this._prom&&!(c<h&&this.timeScale()>0)&&this._prom()))}return this},e.targets=function(){return this._targets},e.invalidate=function(s){return(!s||!this.vars.runBackwards)&&(this._startAt=0),this._pt=this._op=this._onUpdate=this._lazy=this.ratio=0,this._ptLookup=[],this.timeline&&this.timeline.invalidate(s),r.prototype.invalidate.call(this,s)},e.resetTo=function(s,n,o,a){oo||Pe.wake(),this._ts||this.play();var h=Math.min(this._dur,(this._dp._time-this._start)*this._ts),l;return this._initted||Ec(this,h),l=this._ease(h/this._dur),gE(this,s,n,o,a,l,h)?this.resetTo(s,n,o,a):(hh(this,0),this.parent||Jg(this._dp,this,"_first","_last",this._dp._sort?"_start":0),this.render(0))},e.kill=function(s,n){if(n===void 0&&(n="all"),!s&&(!n||n==="all"))return this._lazy=this._pt=0,this.parent?so(this):this;if(this.timeline){var o=this.timeline.totalDuration();return this.timeline.killTweensOf(s,n,Mr&&Mr.vars.overwrite!==!0)._first||so(this),this.parent&&o!==this.timeline.totalDuration()&&qs(this,this._dur*this.timeline._tDur/o,0,1),this}var a=this._targets,h=s?Ye(s):a,l=this._ptLookup,u=this._pt,c,d,p,m,f,g,y;if((!n||n==="all")&&YS(a,h))return n==="all"&&(this._pt=0),so(this);for(c=this._op=this._op||[],n!=="all"&&(re(n)&&(f={},_e(n,function(_){return f[_]=1}),n=f),n=yE(a,n)),y=a.length;y--;)if(~h.indexOf(a[y])){d=l[y],n==="all"?(c[y]=n,m=d,p={}):(p=c[y]=c[y]||{},m=n);for(f in m)g=d&&d[f],g&&((!("kill"in g.d)||g.d.kill(f)===!0)&&nh(this,g,"_pt"),delete d[f]),p!=="all"&&(p[f]=1)}return this._initted&&!this._pt&&u&&so(this),this},t.to=function(s,n){return new t(s,n,arguments[2])},t.from=function(s,n){return eo(1,arguments)},t.delayedCall=function(s,n,o,a){return new t(n,0,{immediateRender:!1,lazy:!1,overwrite:!1,delay:s,onComplete:n,onReverseComplete:n,onCompleteParams:o,onReverseCompleteParams:o,callbackScope:a})},t.fromTo=function(s,n,o){return eo(2,arguments)},t.set=function(s,n){return n.duration=0,n.repeatDelay||(n.repeat=0),new t(s,n)},t.killTweensOf=function(s,n,o){return Bt.killTweensOf(s,n,o)},t}(ao);He(zt.prototype,{_targets:[],_lazy:0,_startAt:0,_op:0,_onInit:0}),_e("staggerTo,staggerFrom,staggerFromTo",function(r){zt[r]=function(){var t=new ve,e=yc.call(arguments,0);return e.splice(r==="staggerFromTo"?5:4,0,0),t[r].apply(t,e)}});var Cc=function(t,e,i){return t[e]=i},w0=function(t,e,i){return t[e](i)},xE=function(t,e,i,s){return t[e](s.fp,i)},_E=function(t,e,i){return t.setAttribute(e,i)},Ic=function(t,e){return Vt(t[e])?w0:rc(t[e])&&t.setAttribute?_E:Cc},S0=function(t,e){return e.set(e.t,e.p,Math.round((e.s+e.c*t)*1e6)/1e6,e)},vE=function(t,e){return e.set(e.t,e.p,!!(e.s+e.c*t),e)},E0=function(t,e){var i=e._pt,s="";if(!t&&e.b)s=e.b;else if(t===1&&e.e)s=e.e;else{for(;i;)s=i.p+(i.m?i.m(i.s+i.c*t):Math.round((i.s+i.c*t)*1e4)/1e4)+s,i=i._next;s+=e.c}e.set(e.t,e.p,s,e)},Ac=function(t,e){for(var i=e._pt;i;)i.r(t,i.d),i=i._next},TE=function(t,e,i,s){for(var n=this._pt,o;n;)o=n._next,n.p===s&&n.modifier(t,e,i),n=o},wE=function(t){for(var e=this._pt,i,s;e;)s=e._next,e.p===t&&!e.op||e.op===t?nh(this,e,"_pt"):e.dep||(i=1),e=s;return!i},SE=function(t,e,i,s){s.mSet(t,e,s.m.call(s.tween,i,s.mt),s)},C0=function(t){for(var e=t._pt,i,s,n,o;e;){for(i=e._next,s=n;s&&s.pr>e.pr;)s=s._next;(e._prev=s?s._prev:o)?e._prev._next=e:n=e,(e._next=s)?s._prev=e:o=e,e=i}t._pt=n},Te=function(){function r(e,i,s,n,o,a,h,l,u){this.t=i,this.s=n,this.c=o,this.p=s,this.r=a||S0,this.d=h||this,this.set=l||Cc,this.pr=u||0,this._next=e,e&&(e._prev=this)}var t=r.prototype;return t.modifier=function(i,s,n){this.mSet=this.mSet||this.set,this.set=SE,this.m=i,this.mt=n,this.tween=s},r}();_e(pc+"parent,duration,ease,delay,overwrite,runBackwards,startAt,yoyo,immediateRender,repeat,repeatDelay,data,paused,reversed,lazy,callbackScope,stringFilter,id,yoyoEase,stagger,inherit,repeatRefresh,keyframes,autoRevert,scrollTrigger",function(r){return uc[r]=1}),Me.TweenMax=Me.TweenLite=zt,Me.TimelineLite=Me.TimelineMax=ve,Bt=new ve({sortChildren:!1,defaults:js,autoRemoveChildren:!0,id:"root",smoothChildTiming:!0}),Ae.stringFilter=m0;var hs=[],lh={},EE=[],I0=0,CE=0,Mc=function(t){return(lh[t]||EE).map(function(e){return e()})},Rc=function(){var t=Date.now(),e=[];t-I0>2&&(Mc("matchMediaInit"),hs.forEach(function(i){var s=i.queries,n=i.conditions,o,a,h,l;for(a in s)o=Ve.matchMedia(s[a]).matches,o&&(h=1),o!==n[a]&&(n[a]=o,l=1);l&&(i.revert(),h&&e.push(i))}),Mc("matchMediaRevert"),e.forEach(function(i){return i.onMatch(i)}),I0=t,Mc("matchMedia"))},A0=function(){function r(e,i){this.selector=i&&bc(i),this.data=[],this._r=[],this.isReverted=!1,this.id=CE++,e&&this.add(e)}var t=r.prototype;return t.add=function(i,s,n){Vt(i)&&(n=s,s=i,i=Vt);var o=this,a=function(){var l=Zt,u=o.selector,c;return l&&l!==o&&l.data.push(o),n&&(o.selector=bc(n)),Zt=o,c=s.apply(o,arguments),Vt(c)&&o._r.push(c),Zt=l,o.selector=u,o.isReverted=!1,c};return o.last=a,i===Vt?a(o):i?o[i]=a:a},t.ignore=function(i){var s=Zt;Zt=null,i(this),Zt=s},t.getTweens=function(){var i=[];return this.data.forEach(function(s){return s instanceof r?i.push.apply(i,s.getTweens()):s instanceof zt&&!(s.parent&&s.parent.data==="nested")&&i.push(s)}),i},t.clear=function(){this._r.length=this.data.length=0},t.kill=function(i,s){var n=this;if(i){var o=this.getTweens();this.data.forEach(function(h){h.data==="isFlip"&&(h.revert(),h.getChildren(!0,!0,!1).forEach(function(l){return o.splice(o.indexOf(l),1)}))}),o.map(function(h){return{g:h.globalTime(0),t:h}}).sort(function(h,l){return l.g-h.g||-1/0}).forEach(function(h){return h.t.revert(i)}),this.data.forEach(function(h){return!(h instanceof zt)&&h.revert&&h.revert(i)}),this._r.forEach(function(h){return h(i,n)}),this.isReverted=!0}else this.data.forEach(function(h){return h.kill&&h.kill()});if(this.clear(),s)for(var a=hs.length;a--;)hs[a].id===this.id&&hs.splice(a,1)},t.revert=function(i){this.kill(i||{})},r}(),IE=function(){function r(e){this.contexts=[],this.scope=e}var t=r.prototype;return t.add=function(i,s,n){Ai(i)||(i={matches:i});var o=new A0(0,n||this.scope),a=o.conditions={},h,l,u;Zt&&!o.selector&&(o.selector=Zt.selector),this.contexts.push(o),s=o.add("onMatch",s),o.queries=i;for(l in i)l==="all"?u=1:(h=Ve.matchMedia(i[l]),h&&(hs.indexOf(o)<0&&hs.push(o),(a[l]=h.matches)&&(u=1),h.addListener?h.addListener(Rc):h.addEventListener("change",Rc)));return u&&s(o),this},t.revert=function(i){this.kill(i||{})},t.kill=function(i){this.contexts.forEach(function(s){return s.kill(i,!0)})},r}(),uh={registerPlugin:function(){for(var t=arguments.length,e=new Array(t),i=0;i<t;i++)e[i]=arguments[i];e.forEach(function(s){return c0(s)})},timeline:function(t){return new ve(t)},getTweensOf:function(t,e){return Bt.getTweensOf(t,e)},getProperty:function(t,e,i,s){re(t)&&(t=Ye(t)[0]);var n=rs(t||{}).get,o=i?zg:Yg;return i==="native"&&(i=""),t&&(e?o((Re[e]&&Re[e].get||n)(t,e,i,s)):function(a,h,l){return o((Re[a]&&Re[a].get||n)(t,a,h,l))})},quickSetter:function(t,e,i){if(t=Ye(t),t.length>1){var s=t.map(function(u){return we.quickSetter(u,e,i)}),n=s.length;return function(u){for(var c=n;c--;)s[c](u)}}t=t[0]||{};var o=Re[e],a=rs(t),h=a.harness&&(a.harness.aliases||{})[e]||e,l=o?function(u){var c=new o;tn._pt=0,c.init(t,i?u+i:u,tn,0,[t]),c.render(1,c),tn._pt&&Ac(1,tn)}:a.set(t,h);return o?l:function(u){return l(t,h,i?u+i:u,a,1)}},quickTo:function(t,e,i){var s,n=we.to(t,ss((s={},s[e]="+=0.1",s.paused=!0,s),i||{})),o=function(h,l,u){return n.resetTo(e,h,l,u)};return o.tween=n,o},isTweening:function(t){return Bt.getTweensOf(t,!0).length>0},defaults:function(t){return t&&t.ease&&(t.ease=os(t.ease,js.ease)),jg(js,t||{})},config:function(t){return jg(Ae,t||{})},registerEffect:function(t){var e=t.name,i=t.effect,s=t.plugins,n=t.defaults,o=t.extendTimeline;(s||"").split(",").forEach(function(a){return a&&!Re[a]&&!Me[a]&&th(e+" effect requires "+a+" plugin.")}),dc[e]=function(a,h,l){return i(Ye(a),He(h||{},n),l)},o&&(ve.prototype[e]=function(a,h,l){return this.add(dc[e](a,Ai(h)?h:(l=h)&&{},this),l)})},registerEase:function(t,e){Tt[t]=os(e)},parseEase:function(t,e){return arguments.length?os(t,e):Tt},getById:function(t){return Bt.getById(t)},exportRoot:function(t,e){t===void 0&&(t={});var i=new ve(t),s,n;for(i.smoothChildTiming=xe(t.smoothChildTiming),Bt.remove(i),i._dp=0,i._time=i._tTime=Bt._time,s=Bt._first;s;)n=s._next,(e||!(!s._dur&&s instanceof zt&&s.vars.onComplete===s._targets[0]))&&Mi(i,s,s._start-s._delay),s=n;return Mi(Bt,i,0),i},context:function(t,e){return t?new A0(t,e):Zt},matchMedia:function(t){return new IE(t)},matchMediaRefresh:function(){return hs.forEach(function(t){var e=t.conditions,i,s;for(s in e)e[s]&&(e[s]=!1,i=1);i&&t.revert()})||Rc()},addEventListener:function(t,e){var i=lh[t]||(lh[t]=[]);~i.indexOf(e)||i.push(e)},removeEventListener:function(t,e){var i=lh[t],s=i&&i.indexOf(e);s>=0&&i.splice(s,1)},utils:{wrap:nE,wrapYoyo:oE,distribute:s0,random:o0,snap:n0,normalize:sE,getUnit:pe,clamp:tE,splitColor:d0,toArray:Ye,selector:bc,mapRange:h0,pipe:iE,unitize:rE,interpolate:aE,shuffle:r0},install:Ug,effects:dc,ticker:Pe,updateRoot:ve.updateRoot,plugins:Re,globalTimeline:Bt,core:{PropTween:Te,globals:Xg,Tween:zt,Timeline:ve,Animation:ao,getCache:rs,_removeLinkedListItem:nh,reverting:function(){return ce},context:function(t){return t&&Zt&&(Zt.data.push(t),t._ctx=Zt),Zt},suppressOverwrites:function(t){return ec=t}}};_e("to,from,fromTo,delayedCall,set,killTweensOf",function(r){return uh[r]=zt[r]}),Pe.add(ve.updateRoot),tn=uh.to({},{duration:0});var AE=function(t,e){for(var i=t._pt;i&&i.p!==e&&i.op!==e&&i.fp!==e;)i=i._next;return i},ME=function(t,e){var i=t._targets,s,n,o;for(s in e)for(n=i.length;n--;)o=t._ptLookup[n][s],o&&(o=o.d)&&(o._pt&&(o=AE(o,s)),o&&o.modifier&&o.modifier(e[s],t,i[n],s))},Pc=function(t,e){return{name:t,rawVars:1,init:function(s,n,o){o._onInit=function(a){var h,l;if(re(n)&&(h={},_e(n,function(u){return h[u]=1}),n=h),e){h={};for(l in n)h[l]=e(n[l]);n=h}ME(a,n)}}}},we=uh.registerPlugin({name:"attr",init:function(t,e,i,s,n){var o,a,h;this.tween=i;for(o in e)h=t.getAttribute(o)||"",a=this.add(t,"setAttribute",(h||0)+"",e[o],s,n,0,0,o),a.op=o,a.b=h,this._props.push(o)},render:function(t,e){for(var i=e._pt;i;)ce?i.set(i.t,i.p,i.b,i):i.r(t,i.d),i=i._next}},{name:"endArray",init:function(t,e){for(var i=e.length;i--;)this.add(t,i,t[i]||0,e[i],0,0,0,0,0,1)}},Pc("roundProps",xc),Pc("modifiers"),Pc("snap",n0))||uh;zt.version=ve.version=we.version="3.12.2",Wg=1,sc()&&en(),Tt.Power0,Tt.Power1,Tt.Power2,Tt.Power3,Tt.Power4,Tt.Linear,Tt.Quad,Tt.Cubic,Tt.Quart,Tt.Quint,Tt.Strong,Tt.Elastic,Tt.Back,Tt.SteppedEase,Tt.Bounce,Tt.Sine,Tt.Expo,Tt.Circ;/*!
|
|
1167
|
+
*/var Me={autoSleep:120,force3D:"auto",nullTargetWarn:1,units:{lineHeight:""}},Js={duration:.5,overwrite:!1,delay:0},ec,ce,Zt,Ve=1e8,Pt=1/Ve,ic=Math.PI*2,US=ic/4,XS=0,Og=Math.sqrt,ZS=Math.cos,VS=Math.sin,re=function(t){return typeof t=="string"},Vt=function(t){return typeof t=="function"},rr=function(t){return typeof t=="number"},rc=function(t){return typeof t>"u"},Ii=function(t){return typeof t=="object"},_e=function(t){return t!==!1},sc=function(){return typeof window<"u"},qa=function(t){return Vt(t)||re(t)},Bg=typeof ArrayBuffer=="function"&&ArrayBuffer.isView||function(){},de=Array.isArray,nc=/(?:-?\.?\d|\.)+/gi,Wg=/[-+=.]*\d+[.e\-+]*\d*[e\-+]*\d*/g,$s=/[-+=.]*\d+[.e-]*\d*[a-z%]*/g,oc=/[-+=.]*\d+\.?\d*(?:e-|e\+)?\d*/gi,Ug=/[+-]=-?[.\d]+/,Xg=/[^,'"\[\]\s]+/gi,HS=/^[+\-=e\s\d]*\d+[.\d]*([a-z]*|%)\s*$/i,Bt,He,ac,hc,Re={},th={},Zg,Vg=function(t){return(th=as(t,Re))&&Se},lc=function(t,e){return console.warn("Invalid property",t,"set to",e,"Missing plugin? gsap.registerPlugin()")},eh=function(t,e){return!e&&console.warn(t)},Hg=function(t,e){return t&&(Re[t]=e)&&th&&(th[t]=e)||Re},to=function(){return 0},KS={suppressEvents:!0,isStart:!0,kill:!1},ih={suppressEvents:!0,kill:!1},YS={suppressEvents:!0},uc={},Ir=[],cc={},Kg,Pe={},dc={},Yg=30,rh=[],pc="",fc=function(t){var e=t[0],i,s;if(Ii(e)||Vt(e)||(t=[t]),!(i=(e._gsap||{}).harness)){for(s=rh.length;s--&&!rh[s].targetTest(e););i=rh[s]}for(s=t.length;s--;)t[s]&&(t[s]._gsap||(t[s]._gsap=new T0(t[s],i)))||t.splice(s,1);return t},os=function(t){return t._gsap||fc(ze(t))[0]._gsap},zg=function(t,e,i){return(i=t[e])&&Vt(i)?t[e]():rc(i)&&t.getAttribute&&t.getAttribute(e)||i},ve=function(t,e){return(t=t.split(",")).forEach(e)||t},Kt=function(t){return Math.round(t*1e5)/1e5||0},he=function(t){return Math.round(t*1e7)/1e7||0},Qs=function(t,e){var i=e.charAt(0),s=parseFloat(e.substr(2));return t=parseFloat(t),i==="+"?t+s:i==="-"?t-s:i==="*"?t*s:t/s},zS=function(t,e){for(var i=e.length,s=0;t.indexOf(e[s])<0&&++s<i;);return s<i},sh=function(){var t=Ir.length,e=Ir.slice(0),i,s;for(cc={},Ir.length=0,i=0;i<t;i++)s=e[i],s&&s._lazy&&(s.render(s._lazy[0],s._lazy[1],!0)._lazy=0)},jg=function(t,e,i,s){Ir.length&&!ce&&sh(),t.render(e,i,s||ce&&e<0&&(t._initted||t._startAt)),Ir.length&&!ce&&sh()},Jg=function(t){var e=parseFloat(t);return(e||e===0)&&(t+"").match(Xg).length<2?e:re(t)?t.trim():t},$g=function(t){return t},Ke=function(t,e){for(var i in e)i in t||(t[i]=e[i]);return t},jS=function(t){return function(e,i){for(var s in i)s in e||s==="duration"&&t||s==="ease"||(e[s]=i[s])}},as=function(t,e){for(var i in e)t[i]=e[i];return t},Qg=function r(t,e){for(var i in e)i!=="__proto__"&&i!=="constructor"&&i!=="prototype"&&(t[i]=Ii(e[i])?r(t[i]||(t[i]={}),e[i]):e[i]);return t},nh=function(t,e){var i={},s;for(s in t)s in e||(i[s]=t[s]);return i},eo=function(t){var e=t.parent||Bt,i=t.keyframes?jS(de(t.keyframes)):Ke;if(_e(t.inherit))for(;e;)i(t,e.vars.defaults),e=e.parent||e._dp;return t},JS=function(t,e){for(var i=t.length,s=i===e.length;s&&i--&&t[i]===e[i];);return i<0},qg=function(t,e,i,s,n){i===void 0&&(i="_first"),s===void 0&&(s="_last");var o=t[s],a;if(n)for(a=e[n];o&&o[n]>a;)o=o._prev;return o?(e._next=o._next,o._next=e):(e._next=t[i],t[i]=e),e._next?e._next._prev=e:t[s]=e,e._prev=o,e.parent=e._dp=t,e},oh=function(t,e,i,s){i===void 0&&(i="_first"),s===void 0&&(s="_last");var n=e._prev,o=e._next;n?n._next=o:t[i]===e&&(t[i]=o),o?o._prev=n:t[s]===e&&(t[s]=n),e._next=e._prev=e.parent=null},Ar=function(t,e){t.parent&&(!e||t.parent.autoRemoveChildren)&&t.parent.remove&&t.parent.remove(t),t._act=0},hs=function(t,e){if(t&&(!e||e._end>t._dur||e._start<0))for(var i=t;i;)i._dirty=1,i=i.parent;return t},$S=function(t){for(var e=t.parent;e&&e.parent;)e._dirty=1,e.totalDuration(),e=e.parent;return t},mc=function(t,e,i,s){return t._startAt&&(ce?t._startAt.revert(ih):t.vars.immediateRender&&!t.vars.autoRevert||t._startAt.render(e,!0,s))},QS=function r(t){return!t||t._ts&&r(t.parent)},t0=function(t){return t._repeat?qs(t._tTime,t=t.duration()+t._rDelay)*t:0},qs=function(t,e){var i=Math.floor(t/=e);return t&&i===t?i-1:i},ah=function(t,e){return(t-e._start)*e._ts+(e._ts>=0?0:e._dirty?e.totalDuration():e._tDur)},hh=function(t){return t._end=he(t._start+(t._tDur/Math.abs(t._ts||t._rts||Pt)||0))},lh=function(t,e){var i=t._dp;return i&&i.smoothChildTiming&&t._ts&&(t._start=he(i._time-(t._ts>0?e/t._ts:((t._dirty?t.totalDuration():t._tDur)-e)/-t._ts)),hh(t),i._dirty||hs(i,t)),t},e0=function(t,e){var i;if((e._time||!e._dur&&e._initted||e._start<t._time&&(e._dur||!e.add))&&(i=ah(t.rawTime(),e),(!e._dur||ro(0,e.totalDuration(),i)-e._tTime>Pt)&&e.render(i,!0)),hs(t,e)._dp&&t._initted&&t._time>=t._dur&&t._ts){if(t._dur<t.duration())for(i=t;i._dp;)i.rawTime()>=0&&i.totalTime(i._tTime),i=i._dp;t._zTime=-Pt}},Ai=function(t,e,i,s){return e.parent&&Ar(e),e._start=he((rr(i)?i:i||t!==Bt?Ye(t,i,e):t._time)+e._delay),e._end=he(e._start+(e.totalDuration()/Math.abs(e.timeScale())||0)),qg(t,e,"_first","_last",t._sort?"_start":0),gc(e)||(t._recent=e),s||e0(t,e),t._ts<0&&lh(t,t._tTime),t},i0=function(t,e){return(Re.ScrollTrigger||lc("scrollTrigger",e))&&Re.ScrollTrigger.create(e,t)},r0=function(t,e,i,s,n){if(Ec(t,e,n),!t._initted)return 1;if(!i&&t._pt&&!ce&&(t._dur&&t.vars.lazy!==!1||!t._dur&&t.vars.lazy)&&Kg!==Le.frame)return Ir.push(t),t._lazy=[n,s],1},qS=function r(t){var e=t.parent;return e&&e._ts&&e._initted&&!e._lock&&(e.rawTime()<0||r(e))},gc=function(t){var e=t.data;return e==="isFromStart"||e==="isStart"},tE=function(t,e,i,s){var n=t.ratio,o=e<0||!e&&(!t._start&&qS(t)&&!(!t._initted&&gc(t))||(t._ts<0||t._dp._ts<0)&&!gc(t))?0:1,a=t._rDelay,h=0,l,u,c;if(a&&t._repeat&&(h=ro(0,t._tDur,e),u=qs(h,a),t._yoyo&&u&1&&(o=1-o),u!==qs(t._tTime,a)&&(n=1-o,t.vars.repeatRefresh&&t._initted&&t.invalidate())),o!==n||ce||s||t._zTime===Pt||!e&&t._zTime){if(!t._initted&&r0(t,e,s,i,h))return;for(c=t._zTime,t._zTime=e||(i?Pt:0),i||(i=e&&!c),t.ratio=o,t._from&&(o=1-o),t._time=0,t._tTime=h,l=t._pt;l;)l.r(o,l.d),l=l._next;e<0&&mc(t,e,i,!0),t._onUpdate&&!i&&je(t,"onUpdate"),h&&t._repeat&&!i&&t.parent&&je(t,"onRepeat"),(e>=t._tDur||e<0)&&t.ratio===o&&(o&&Ar(t,1),!i&&!ce&&(je(t,o?"onComplete":"onReverseComplete",!0),t._prom&&t._prom()))}else t._zTime||(t._zTime=e)},eE=function(t,e,i){var s;if(i>e)for(s=t._first;s&&s._start<=i;){if(s.data==="isPause"&&s._start>e)return s;s=s._next}else for(s=t._last;s&&s._start>=i;){if(s.data==="isPause"&&s._start<e)return s;s=s._prev}},tn=function(t,e,i,s){var n=t._repeat,o=he(e)||0,a=t._tTime/t._tDur;return a&&!s&&(t._time*=o/t._dur),t._dur=o,t._tDur=n?n<0?1e10:he(o*(n+1)+t._rDelay*n):o,a>0&&!s&&lh(t,t._tTime=t._tDur*a),t.parent&&hh(t),i||hs(t.parent,t),t},s0=function(t){return t instanceof Te?hs(t):tn(t,t._dur)},iE={_start:0,endTime:to,totalDuration:to},Ye=function r(t,e,i){var s=t.labels,n=t._recent||iE,o=t.duration()>=Ve?n.endTime(!1):t._dur,a,h,l;return re(e)&&(isNaN(e)||e in s)?(h=e.charAt(0),l=e.substr(-1)==="%",a=e.indexOf("="),h==="<"||h===">"?(a>=0&&(e=e.replace(/=/,"")),(h==="<"?n._start:n.endTime(n._repeat>=0))+(parseFloat(e.substr(1))||0)*(l?(a<0?n:i).totalDuration()/100:1)):a<0?(e in s||(s[e]=o),s[e]):(h=parseFloat(e.charAt(a-1)+e.substr(a+1)),l&&i&&(h=h/100*(de(i)?i[0]:i).totalDuration()),a>1?r(t,e.substr(0,a-1),i)+h:o+h)):e==null?o:+e},io=function(t,e,i){var s=rr(e[1]),n=(s?2:1)+(t<2?0:1),o=e[n],a,h;if(s&&(o.duration=e[1]),o.parent=i,t){for(a=o,h=i;h&&!("immediateRender"in a);)a=h.vars.defaults||{},h=_e(h.vars.inherit)&&h.parent;o.immediateRender=_e(a.immediateRender),t<2?o.runBackwards=1:o.startAt=e[n-1]}return new zt(e[0],o,e[n+1])},Mr=function(t,e){return t||t===0?e(t):e},ro=function(t,e,i){return i<t?t:i>e?e:i},pe=function(t,e){return!re(t)||!(e=HS.exec(t))?"":e[1]},rE=function(t,e,i){return Mr(i,function(s){return ro(t,e,s)})},yc=[].slice,n0=function(t,e){return t&&Ii(t)&&"length"in t&&(!e&&!t.length||t.length-1 in t&&Ii(t[0]))&&!t.nodeType&&t!==He},sE=function(t,e,i){return i===void 0&&(i=[]),t.forEach(function(s){var n;return re(s)&&!e||n0(s,1)?(n=i).push.apply(n,ze(s)):i.push(s)})||i},ze=function(t,e,i){return Zt&&!e&&Zt.selector?Zt.selector(t):re(t)&&!i&&(ac||!rn())?yc.call((e||hc).querySelectorAll(t),0):de(t)?sE(t,i):n0(t)?yc.call(t,0):t?[t]:[]},bc=function(t){return t=ze(t)[0]||eh("Invalid scope")||{},function(e){var i=t.current||t.nativeElement||t;return ze(e,i.querySelectorAll?i:i===t?eh("Invalid scope")||hc.createElement("div"):t)}},o0=function(t){return t.sort(function(){return .5-Math.random()})},a0=function(t){if(Vt(t))return t;var e=Ii(t)?t:{each:t},i=ls(e.ease),s=e.from||0,n=parseFloat(e.base)||0,o={},a=s>0&&s<1,h=isNaN(s)||a,l=e.axis,u=s,c=s;return re(s)?u=c={center:.5,edges:.5,end:1}[s]||0:!a&&h&&(u=s[0],c=s[1]),function(d,p,m){var f=(m||e).length,g=o[f],y,_,b,v,S,E,A,I,P;if(!g){if(P=e.grid==="auto"?0:(e.grid||[1,Ve])[1],!P){for(A=-Ve;A<(A=m[P++].getBoundingClientRect().left)&&P<f;);P--}for(g=o[f]=[],y=h?Math.min(P,f)*u-.5:s%P,_=P===Ve?0:h?f*c/P-.5:s/P|0,A=0,I=Ve,E=0;E<f;E++)b=E%P-y,v=_-(E/P|0),g[E]=S=l?Math.abs(l==="y"?v:b):Og(b*b+v*v),S>A&&(A=S),S<I&&(I=S);s==="random"&&o0(g),g.max=A-I,g.min=I,g.v=f=(parseFloat(e.amount)||parseFloat(e.each)*(P>f?f-1:l?l==="y"?f/P:P:Math.max(P,f/P))||0)*(s==="edges"?-1:1),g.b=f<0?n-f:n,g.u=pe(e.amount||e.each)||0,i=i&&f<0?x0(i):i}return f=(g[d]-g.min)/g.max||0,he(g.b+(i?i(f):f)*g.v)+g.u}},xc=function(t){var e=Math.pow(10,((t+"").split(".")[1]||"").length);return function(i){var s=he(Math.round(parseFloat(i)/t)*t*e);return(s-s%1)/e+(rr(i)?0:pe(i))}},h0=function(t,e){var i=de(t),s,n;return!i&&Ii(t)&&(s=i=t.radius||Ve,t.values?(t=ze(t.values),(n=!rr(t[0]))&&(s*=s)):t=xc(t.increment)),Mr(e,i?Vt(t)?function(o){return n=t(o),Math.abs(n-o)<=s?n:o}:function(o){for(var a=parseFloat(n?o.x:o),h=parseFloat(n?o.y:0),l=Ve,u=0,c=t.length,d,p;c--;)n?(d=t[c].x-a,p=t[c].y-h,d=d*d+p*p):d=Math.abs(t[c]-a),d<l&&(l=d,u=c);return u=!s||l<=s?t[u]:o,n||u===o||rr(o)?u:u+pe(o)}:xc(t))},l0=function(t,e,i,s){return Mr(de(t)?!e:i===!0?!!(i=0):!s,function(){return de(t)?t[~~(Math.random()*t.length)]:(i=i||1e-5)&&(s=i<1?Math.pow(10,(i+"").length-2):1)&&Math.floor(Math.round((t-i/2+Math.random()*(e-t+i*.99))/i)*i*s)/s})},nE=function(){for(var t=arguments.length,e=new Array(t),i=0;i<t;i++)e[i]=arguments[i];return function(s){return e.reduce(function(n,o){return o(n)},s)}},oE=function(t,e){return function(i){return t(parseFloat(i))+(e||pe(i))}},aE=function(t,e,i){return c0(t,e,0,1,i)},u0=function(t,e,i){return Mr(i,function(s){return t[~~e(s)]})},hE=function r(t,e,i){var s=e-t;return de(t)?u0(t,r(0,t.length),e):Mr(i,function(n){return(s+(n-t)%s)%s+t})},lE=function r(t,e,i){var s=e-t,n=s*2;return de(t)?u0(t,r(0,t.length-1),e):Mr(i,function(o){return o=(n+(o-t)%n)%n||0,t+(o>s?n-o:o)})},so=function(t){for(var e=0,i="",s,n,o,a;~(s=t.indexOf("random(",e));)o=t.indexOf(")",s),a=t.charAt(s+7)==="[",n=t.substr(s+7,o-s-7).match(a?Xg:nc),i+=t.substr(e,s-e)+l0(a?n:+n[0],a?0:+n[1],+n[2]||1e-5),e=o+1;return i+t.substr(e,t.length-e)},c0=function(t,e,i,s,n){var o=e-t,a=s-i;return Mr(n,function(h){return i+((h-t)/o*a||0)})},uE=function r(t,e,i,s){var n=isNaN(t+e)?0:function(p){return(1-p)*t+p*e};if(!n){var o=re(t),a={},h,l,u,c,d;if(i===!0&&(s=1)&&(i=null),o)t={p:t},e={p:e};else if(de(t)&&!de(e)){for(u=[],c=t.length,d=c-2,l=1;l<c;l++)u.push(r(t[l-1],t[l]));c--,n=function(m){m*=c;var f=Math.min(d,~~m);return u[f](m-f)},i=e}else s||(t=as(de(t)?[]:{},t));if(!u){for(h in e)wc.call(a,t,h,"get",e[h]);n=function(m){return Ac(m,a)||(o?t.p:t)}}}return Mr(i,n)},d0=function(t,e,i){var s=t.labels,n=Ve,o,a,h;for(o in s)a=s[o]-e,a<0==!!i&&a&&n>(a=Math.abs(a))&&(h=o,n=a);return h},je=function(t,e,i){var s=t.vars,n=s[e],o=Zt,a=t._ctx,h,l,u;if(n)return h=s[e+"Params"],l=s.callbackScope||t,i&&Ir.length&&sh(),a&&(Zt=a),u=h?n.apply(l,h):n.call(l),Zt=o,u},no=function(t){return Ar(t),t.scrollTrigger&&t.scrollTrigger.kill(!!ce),t.progress()<1&&je(t,"onInterrupt"),t},en,p0=[],f0=function(t){if(sc()&&t){t=!t.name&&t.default||t;var e=t.name,i=Vt(t),s=e&&!i&&t.init?function(){this._props=[]}:t,n={init:to,render:Ac,add:wc,kill:CE,modifier:EE,rawVars:0},o={targetTest:0,get:0,getSetter:Ic,aliases:{},register:0};if(rn(),t!==s){if(Pe[e])return;Ke(s,Ke(nh(t,n),o)),as(s.prototype,as(n,nh(t,o))),Pe[s.prop=e]=s,t.targetTest&&(rh.push(s),uc[e]=1),e=(e==="css"?"CSS":e.charAt(0).toUpperCase()+e.substr(1))+"Plugin"}Hg(e,s),t.register&&t.register(Se,s,we)}else t&&p0.push(t)},Lt=255,oo={aqua:[0,Lt,Lt],lime:[0,Lt,0],silver:[192,192,192],black:[0,0,0],maroon:[128,0,0],teal:[0,128,128],blue:[0,0,Lt],navy:[0,0,128],white:[Lt,Lt,Lt],olive:[128,128,0],yellow:[Lt,Lt,0],orange:[Lt,165,0],gray:[128,128,128],purple:[128,0,128],green:[0,128,0],red:[Lt,0,0],pink:[Lt,192,203],cyan:[0,Lt,Lt],transparent:[Lt,Lt,Lt,0]},_c=function(t,e,i){return t+=t<0?1:t>1?-1:0,(t*6<1?e+(i-e)*t*6:t<.5?i:t*3<2?e+(i-e)*(2/3-t)*6:e)*Lt+.5|0},m0=function(t,e,i){var s=t?rr(t)?[t>>16,t>>8&Lt,t&Lt]:0:oo.black,n,o,a,h,l,u,c,d,p,m;if(!s){if(t.substr(-1)===","&&(t=t.substr(0,t.length-1)),oo[t])s=oo[t];else if(t.charAt(0)==="#"){if(t.length<6&&(n=t.charAt(1),o=t.charAt(2),a=t.charAt(3),t="#"+n+n+o+o+a+a+(t.length===5?t.charAt(4)+t.charAt(4):"")),t.length===9)return s=parseInt(t.substr(1,6),16),[s>>16,s>>8&Lt,s&Lt,parseInt(t.substr(7),16)/255];t=parseInt(t.substr(1),16),s=[t>>16,t>>8&Lt,t&Lt]}else if(t.substr(0,3)==="hsl"){if(s=m=t.match(nc),!e)h=+s[0]%360/360,l=+s[1]/100,u=+s[2]/100,o=u<=.5?u*(l+1):u+l-u*l,n=u*2-o,s.length>3&&(s[3]*=1),s[0]=_c(h+1/3,n,o),s[1]=_c(h,n,o),s[2]=_c(h-1/3,n,o);else if(~t.indexOf("="))return s=t.match(Wg),i&&s.length<4&&(s[3]=1),s}else s=t.match(nc)||oo.transparent;s=s.map(Number)}return e&&!m&&(n=s[0]/Lt,o=s[1]/Lt,a=s[2]/Lt,c=Math.max(n,o,a),d=Math.min(n,o,a),u=(c+d)/2,c===d?h=l=0:(p=c-d,l=u>.5?p/(2-c-d):p/(c+d),h=c===n?(o-a)/p+(o<a?6:0):c===o?(a-n)/p+2:(n-o)/p+4,h*=60),s[0]=~~(h+.5),s[1]=~~(l*100+.5),s[2]=~~(u*100+.5)),i&&s.length<4&&(s[3]=1),s},g0=function(t){var e=[],i=[],s=-1;return t.split(Rr).forEach(function(n){var o=n.match($s)||[];e.push.apply(e,o),i.push(s+=o.length+1)}),e.c=i,e},y0=function(t,e,i){var s="",n=(t+s).match(Rr),o=e?"hsla(":"rgba(",a=0,h,l,u,c;if(!n)return t;if(n=n.map(function(d){return(d=m0(d,e,1))&&o+(e?d[0]+","+d[1]+"%,"+d[2]+"%,"+d[3]:d.join(","))+")"}),i&&(u=g0(t),h=i.c,h.join(s)!==u.c.join(s)))for(l=t.replace(Rr,"1").split($s),c=l.length-1;a<c;a++)s+=l[a]+(~h.indexOf(a)?n.shift()||o+"0,0,0,0)":(u.length?u:n.length?n:i).shift());if(!l)for(l=t.split(Rr),c=l.length-1;a<c;a++)s+=l[a]+n[a];return s+l[c]},Rr=function(){var r="(?:\\b(?:(?:rgb|rgba|hsl|hsla)\\(.+?\\))|\\B#(?:[0-9a-f]{3,4}){1,2}\\b",t;for(t in oo)r+="|"+t+"\\b";return new RegExp(r+")","gi")}(),cE=/hsl[a]?\(/,b0=function(t){var e=t.join(" "),i;if(Rr.lastIndex=0,Rr.test(e))return i=cE.test(e),t[1]=y0(t[1],i),t[0]=y0(t[0],i,g0(t[1])),!0},ao,Le=function(){var r=Date.now,t=500,e=33,i=r(),s=i,n=1e3/240,o=n,a=[],h,l,u,c,d,p,m=function f(g){var y=r()-s,_=g===!0,b,v,S,E;if(y>t&&(i+=y-e),s+=y,S=s-i,b=S-o,(b>0||_)&&(E=++c.frame,d=S-c.time*1e3,c.time=S=S/1e3,o+=b+(b>=n?4:n-b),v=1),_||(h=l(f)),v)for(p=0;p<a.length;p++)a[p](S,d,E,g)};return c={time:0,frame:0,tick:function(){m(!0)},deltaRatio:function(g){return d/(1e3/(g||60))},wake:function(){Zg&&(!ac&&sc()&&(He=ac=window,hc=He.document||{},Re.gsap=Se,(He.gsapVersions||(He.gsapVersions=[])).push(Se.version),Vg(th||He.GreenSockGlobals||!He.gsap&&He||{}),u=He.requestAnimationFrame,p0.forEach(f0)),h&&c.sleep(),l=u||function(g){return setTimeout(g,o-c.time*1e3+1|0)},ao=1,m(2))},sleep:function(){(u?He.cancelAnimationFrame:clearTimeout)(h),ao=0,l=to},lagSmoothing:function(g,y){t=g||1/0,e=Math.min(y||33,t)},fps:function(g){n=1e3/(g||240),o=c.time*1e3+n},add:function(g,y,_){var b=y?function(v,S,E,A){g(v,S,E,A),c.remove(b)}:g;return c.remove(g),a[_?"unshift":"push"](b),rn(),b},remove:function(g,y){~(y=a.indexOf(g))&&a.splice(y,1)&&p>=y&&p--},_listeners:a},c}(),rn=function(){return!ao&&Le.wake()},St={},dE=/^[\d.\-M][\d.\-,\s]/,pE=/["']/g,fE=function(t){for(var e={},i=t.substr(1,t.length-3).split(":"),s=i[0],n=1,o=i.length,a,h,l;n<o;n++)h=i[n],a=n!==o-1?h.lastIndexOf(","):h.length,l=h.substr(0,a),e[s]=isNaN(l)?l.replace(pE,"").trim():+l,s=h.substr(a+1).trim();return e},mE=function(t){var e=t.indexOf("(")+1,i=t.indexOf(")"),s=t.indexOf("(",e);return t.substring(e,~s&&s<i?t.indexOf(")",i+1):i)},gE=function(t){var e=(t+"").split("("),i=St[e[0]];return i&&e.length>1&&i.config?i.config.apply(null,~t.indexOf("{")?[fE(e[1])]:mE(t).split(",").map(Jg)):St._CE&&dE.test(t)?St._CE("",t):i},x0=function(t){return function(e){return 1-t(1-e)}},_0=function r(t,e){for(var i=t._first,s;i;)i instanceof Te?r(i,e):i.vars.yoyoEase&&(!i._yoyo||!i._repeat)&&i._yoyo!==e&&(i.timeline?r(i.timeline,e):(s=i._ease,i._ease=i._yEase,i._yEase=s,i._yoyo=e)),i=i._next},ls=function(t,e){return t&&(Vt(t)?t:St[t]||gE(t))||e},us=function(t,e,i,s){i===void 0&&(i=function(h){return 1-e(1-h)}),s===void 0&&(s=function(h){return h<.5?e(h*2)/2:1-e((1-h)*2)/2});var n={easeIn:e,easeOut:i,easeInOut:s},o;return ve(t,function(a){St[a]=Re[a]=n,St[o=a.toLowerCase()]=i;for(var h in n)St[o+(h==="easeIn"?".in":h==="easeOut"?".out":".inOut")]=St[a+"."+h]=n[h]}),n},v0=function(t){return function(e){return e<.5?(1-t(1-e*2))/2:.5+t((e-.5)*2)/2}},vc=function r(t,e,i){var s=e>=1?e:1,n=(i||(t?.3:.45))/(e<1?e:1),o=n/ic*(Math.asin(1/s)||0),a=function(u){return u===1?1:s*Math.pow(2,-10*u)*VS((u-o)*n)+1},h=t==="out"?a:t==="in"?function(l){return 1-a(1-l)}:v0(a);return n=ic/n,h.config=function(l,u){return r(t,l,u)},h},Tc=function r(t,e){e===void 0&&(e=1.70158);var i=function(o){return o?--o*o*((e+1)*o+e)+1:0},s=t==="out"?i:t==="in"?function(n){return 1-i(1-n)}:v0(i);return s.config=function(n){return r(t,n)},s};ve("Linear,Quad,Cubic,Quart,Quint,Strong",function(r,t){var e=t<5?t+1:t;us(r+",Power"+(e-1),t?function(i){return Math.pow(i,e)}:function(i){return i},function(i){return 1-Math.pow(1-i,e)},function(i){return i<.5?Math.pow(i*2,e)/2:1-Math.pow((1-i)*2,e)/2})}),St.Linear.easeNone=St.none=St.Linear.easeIn,us("Elastic",vc("in"),vc("out"),vc()),function(r,t){var e=1/t,i=2*e,s=2.5*e,n=function(a){return a<e?r*a*a:a<i?r*Math.pow(a-1.5/t,2)+.75:a<s?r*(a-=2.25/t)*a+.9375:r*Math.pow(a-2.625/t,2)+.984375};us("Bounce",function(o){return 1-n(1-o)},n)}(7.5625,2.75),us("Expo",function(r){return r?Math.pow(2,10*(r-1)):0}),us("Circ",function(r){return-(Og(1-r*r)-1)}),us("Sine",function(r){return r===1?1:-ZS(r*US)+1}),us("Back",Tc("in"),Tc("out"),Tc()),St.SteppedEase=St.steps=Re.SteppedEase={config:function(t,e){t===void 0&&(t=1);var i=1/t,s=t+(e?0:1),n=e?1:0,o=1-Pt;return function(a){return((s*ro(0,o,a)|0)+n)*i}}},Js.ease=St["quad.out"],ve("onComplete,onUpdate,onStart,onRepeat,onReverseComplete,onInterrupt",function(r){return pc+=r+","+r+"Params,"});var T0=function(t,e){this.id=XS++,t._gsap=this,this.target=t,this.harness=e,this.get=e?e.get:zg,this.set=e?e.getSetter:Ic},ho=function(){function r(e){this.vars=e,this._delay=+e.delay||0,(this._repeat=e.repeat===1/0?-2:e.repeat||0)&&(this._rDelay=e.repeatDelay||0,this._yoyo=!!e.yoyo||!!e.yoyoEase),this._ts=1,tn(this,+e.duration,1,1),this.data=e.data,Zt&&(this._ctx=Zt,Zt.data.push(this)),ao||Le.wake()}var t=r.prototype;return t.delay=function(i){return i||i===0?(this.parent&&this.parent.smoothChildTiming&&this.startTime(this._start+i-this._delay),this._delay=i,this):this._delay},t.duration=function(i){return arguments.length?this.totalDuration(this._repeat>0?i+(i+this._rDelay)*this._repeat:i):this.totalDuration()&&this._dur},t.totalDuration=function(i){return arguments.length?(this._dirty=0,tn(this,this._repeat<0?i:(i-this._repeat*this._rDelay)/(this._repeat+1))):this._tDur},t.totalTime=function(i,s){if(rn(),!arguments.length)return this._tTime;var n=this._dp;if(n&&n.smoothChildTiming&&this._ts){for(lh(this,i),!n._dp||n.parent||e0(n,this);n&&n.parent;)n.parent._time!==n._start+(n._ts>=0?n._tTime/n._ts:(n.totalDuration()-n._tTime)/-n._ts)&&n.totalTime(n._tTime,!0),n=n.parent;!this.parent&&this._dp.autoRemoveChildren&&(this._ts>0&&i<this._tDur||this._ts<0&&i>0||!this._tDur&&!i)&&Ai(this._dp,this,this._start-this._delay)}return(this._tTime!==i||!this._dur&&!s||this._initted&&Math.abs(this._zTime)===Pt||!i&&!this._initted&&(this.add||this._ptLookup))&&(this._ts||(this._pTime=i),jg(this,i,s)),this},t.time=function(i,s){return arguments.length?this.totalTime(Math.min(this.totalDuration(),i+t0(this))%(this._dur+this._rDelay)||(i?this._dur:0),s):this._time},t.totalProgress=function(i,s){return arguments.length?this.totalTime(this.totalDuration()*i,s):this.totalDuration()?Math.min(1,this._tTime/this._tDur):this.ratio},t.progress=function(i,s){return arguments.length?this.totalTime(this.duration()*(this._yoyo&&!(this.iteration()&1)?1-i:i)+t0(this),s):this.duration()?Math.min(1,this._time/this._dur):this.ratio},t.iteration=function(i,s){var n=this.duration()+this._rDelay;return arguments.length?this.totalTime(this._time+(i-1)*n,s):this._repeat?qs(this._tTime,n)+1:1},t.timeScale=function(i){if(!arguments.length)return this._rts===-Pt?0:this._rts;if(this._rts===i)return this;var s=this.parent&&this._ts?ah(this.parent._time,this):this._tTime;return this._rts=+i||0,this._ts=this._ps||i===-Pt?0:this._rts,this.totalTime(ro(-Math.abs(this._delay),this._tDur,s),!0),hh(this),$S(this)},t.paused=function(i){return arguments.length?(this._ps!==i&&(this._ps=i,i?(this._pTime=this._tTime||Math.max(-this._delay,this.rawTime()),this._ts=this._act=0):(rn(),this._ts=this._rts,this.totalTime(this.parent&&!this.parent.smoothChildTiming?this.rawTime():this._tTime||this._pTime,this.progress()===1&&Math.abs(this._zTime)!==Pt&&(this._tTime-=Pt)))),this):this._ps},t.startTime=function(i){if(arguments.length){this._start=i;var s=this.parent||this._dp;return s&&(s._sort||!this.parent)&&Ai(s,this,i-this._delay),this}return this._start},t.endTime=function(i){return this._start+(_e(i)?this.totalDuration():this.duration())/Math.abs(this._ts||1)},t.rawTime=function(i){var s=this.parent||this._dp;return s?i&&(!this._ts||this._repeat&&this._time&&this.totalProgress()<1)?this._tTime%(this._dur+this._rDelay):this._ts?ah(s.rawTime(i),this):this._tTime:this._tTime},t.revert=function(i){i===void 0&&(i=YS);var s=ce;return ce=i,(this._initted||this._startAt)&&(this.timeline&&this.timeline.revert(i),this.totalTime(-.01,i.suppressEvents)),this.data!=="nested"&&i.kill!==!1&&this.kill(),ce=s,this},t.globalTime=function(i){for(var s=this,n=arguments.length?i:s.rawTime();s;)n=s._start+n/(s._ts||1),s=s._dp;return!this.parent&&this._sat?this._sat.vars.immediateRender?-1/0:this._sat.globalTime(i):n},t.repeat=function(i){return arguments.length?(this._repeat=i===1/0?-2:i,s0(this)):this._repeat===-2?1/0:this._repeat},t.repeatDelay=function(i){if(arguments.length){var s=this._time;return this._rDelay=i,s0(this),s?this.time(s):this}return this._rDelay},t.yoyo=function(i){return arguments.length?(this._yoyo=i,this):this._yoyo},t.seek=function(i,s){return this.totalTime(Ye(this,i),_e(s))},t.restart=function(i,s){return this.play().totalTime(i?-this._delay:0,_e(s))},t.play=function(i,s){return i!=null&&this.seek(i,s),this.reversed(!1).paused(!1)},t.reverse=function(i,s){return i!=null&&this.seek(i||this.totalDuration(),s),this.reversed(!0).paused(!1)},t.pause=function(i,s){return i!=null&&this.seek(i,s),this.paused(!0)},t.resume=function(){return this.paused(!1)},t.reversed=function(i){return arguments.length?(!!i!==this.reversed()&&this.timeScale(-this._rts||(i?-Pt:0)),this):this._rts<0},t.invalidate=function(){return this._initted=this._act=0,this._zTime=-Pt,this},t.isActive=function(){var i=this.parent||this._dp,s=this._start,n;return!!(!i||this._ts&&this._initted&&i.isActive()&&(n=i.rawTime(!0))>=s&&n<this.endTime(!0)-Pt)},t.eventCallback=function(i,s,n){var o=this.vars;return arguments.length>1?(s?(o[i]=s,n&&(o[i+"Params"]=n),i==="onUpdate"&&(this._onUpdate=s)):delete o[i],this):o[i]},t.then=function(i){var s=this;return new Promise(function(n){var o=Vt(i)?i:$g,a=function(){var l=s.then;s.then=null,Vt(o)&&(o=o(s))&&(o.then||o===s)&&(s.then=l),n(o),s.then=l};s._initted&&s.totalProgress()===1&&s._ts>=0||!s._tTime&&s._ts<0?a():s._prom=a})},t.kill=function(){no(this)},r}();Ke(ho.prototype,{_time:0,_start:0,_end:0,_tTime:0,_tDur:0,_dirty:0,_repeat:0,_yoyo:!1,parent:null,_initted:!1,_rDelay:0,_ts:1,_dp:0,ratio:0,_zTime:-Pt,_prom:0,_ps:!1,_rts:1});var Te=function(r){kg(t,r);function t(i,s){var n;return i===void 0&&(i={}),n=r.call(this,i)||this,n.labels={},n.smoothChildTiming=!!i.smoothChildTiming,n.autoRemoveChildren=!!i.autoRemoveChildren,n._sort=_e(i.sortChildren),Bt&&Ai(i.parent||Bt,ir(n),s),i.reversed&&n.reverse(),i.paused&&n.paused(!0),i.scrollTrigger&&i0(ir(n),i.scrollTrigger),n}var e=t.prototype;return e.to=function(s,n,o){return io(0,arguments,this),this},e.from=function(s,n,o){return io(1,arguments,this),this},e.fromTo=function(s,n,o,a){return io(2,arguments,this),this},e.set=function(s,n,o){return n.duration=0,n.parent=this,eo(n).repeatDelay||(n.repeat=0),n.immediateRender=!!n.immediateRender,new zt(s,n,Ye(this,o),1),this},e.call=function(s,n,o){return Ai(this,zt.delayedCall(0,s,n),o)},e.staggerTo=function(s,n,o,a,h,l,u){return o.duration=n,o.stagger=o.stagger||a,o.onComplete=l,o.onCompleteParams=u,o.parent=this,new zt(s,o,Ye(this,h)),this},e.staggerFrom=function(s,n,o,a,h,l,u){return o.runBackwards=1,eo(o).immediateRender=_e(o.immediateRender),this.staggerTo(s,n,o,a,h,l,u)},e.staggerFromTo=function(s,n,o,a,h,l,u,c){return a.startAt=o,eo(a).immediateRender=_e(a.immediateRender),this.staggerTo(s,n,a,h,l,u,c)},e.render=function(s,n,o){var a=this._time,h=this._dirty?this.totalDuration():this._tDur,l=this._dur,u=s<=0?0:he(s),c=this._zTime<0!=s<0&&(this._initted||!l),d,p,m,f,g,y,_,b,v,S,E,A;if(this!==Bt&&u>h&&s>=0&&(u=h),u!==this._tTime||o||c){if(a!==this._time&&l&&(u+=this._time-a,s+=this._time-a),d=u,v=this._start,b=this._ts,y=!b,c&&(l||(a=this._zTime),(s||!n)&&(this._zTime=s)),this._repeat){if(E=this._yoyo,g=l+this._rDelay,this._repeat<-1&&s<0)return this.totalTime(g*100+s,n,o);if(d=he(u%g),u===h?(f=this._repeat,d=l):(f=~~(u/g),f&&f===u/g&&(d=l,f--),d>l&&(d=l)),S=qs(this._tTime,g),!a&&this._tTime&&S!==f&&this._tTime-S*g-this._dur<=0&&(S=f),E&&f&1&&(d=l-d,A=1),f!==S&&!this._lock){var I=E&&S&1,P=I===(E&&f&1);if(f<S&&(I=!I),a=I?0:u%l?l:u,this._lock=1,this.render(a||(A?0:he(f*g)),n,!l)._lock=0,this._tTime=u,!n&&this.parent&&je(this,"onRepeat"),this.vars.repeatRefresh&&!A&&(this.invalidate()._lock=1),a&&a!==this._time||y!==!this._ts||this.vars.onRepeat&&!this.parent&&!this._act)return this;if(l=this._dur,h=this._tDur,P&&(this._lock=2,a=I?l:-1e-4,this.render(a,!0),this.vars.repeatRefresh&&!A&&this.invalidate()),this._lock=0,!this._ts&&!y)return this;_0(this,A)}}if(this._hasPause&&!this._forcing&&this._lock<2&&(_=eE(this,he(a),he(d)),_&&(u-=d-(d=_._start))),this._tTime=u,this._time=d,this._act=!b,this._initted||(this._onUpdate=this.vars.onUpdate,this._initted=1,this._zTime=s,a=0),!a&&d&&!n&&!f&&(je(this,"onStart"),this._tTime!==u))return this;if(d>=a&&s>=0)for(p=this._first;p;){if(m=p._next,(p._act||d>=p._start)&&p._ts&&_!==p){if(p.parent!==this)return this.render(s,n,o);if(p.render(p._ts>0?(d-p._start)*p._ts:(p._dirty?p.totalDuration():p._tDur)+(d-p._start)*p._ts,n,o),d!==this._time||!this._ts&&!y){_=0,m&&(u+=this._zTime=-Pt);break}}p=m}else{p=this._last;for(var W=s<0?s:d;p;){if(m=p._prev,(p._act||W<=p._end)&&p._ts&&_!==p){if(p.parent!==this)return this.render(s,n,o);if(p.render(p._ts>0?(W-p._start)*p._ts:(p._dirty?p.totalDuration():p._tDur)+(W-p._start)*p._ts,n,o||ce&&(p._initted||p._startAt)),d!==this._time||!this._ts&&!y){_=0,m&&(u+=this._zTime=W?-Pt:Pt);break}}p=m}}if(_&&!n&&(this.pause(),_.render(d>=a?0:-Pt)._zTime=d>=a?1:-1,this._ts))return this._start=v,hh(this),this.render(s,n,o);this._onUpdate&&!n&&je(this,"onUpdate",!0),(u===h&&this._tTime>=this.totalDuration()||!u&&a)&&(v===this._start||Math.abs(b)!==Math.abs(this._ts))&&(this._lock||((s||!l)&&(u===h&&this._ts>0||!u&&this._ts<0)&&Ar(this,1),!n&&!(s<0&&!a)&&(u||a||!h)&&(je(this,u===h&&s>=0?"onComplete":"onReverseComplete",!0),this._prom&&!(u<h&&this.timeScale()>0)&&this._prom())))}return this},e.add=function(s,n){var o=this;if(rr(n)||(n=Ye(this,n,s)),!(s instanceof ho)){if(de(s))return s.forEach(function(a){return o.add(a,n)}),this;if(re(s))return this.addLabel(s,n);if(Vt(s))s=zt.delayedCall(0,s);else return this}return this!==s?Ai(this,s,n):this},e.getChildren=function(s,n,o,a){s===void 0&&(s=!0),n===void 0&&(n=!0),o===void 0&&(o=!0),a===void 0&&(a=-Ve);for(var h=[],l=this._first;l;)l._start>=a&&(l instanceof zt?n&&h.push(l):(o&&h.push(l),s&&h.push.apply(h,l.getChildren(!0,n,o)))),l=l._next;return h},e.getById=function(s){for(var n=this.getChildren(1,1,1),o=n.length;o--;)if(n[o].vars.id===s)return n[o]},e.remove=function(s){return re(s)?this.removeLabel(s):Vt(s)?this.killTweensOf(s):(oh(this,s),s===this._recent&&(this._recent=this._last),hs(this))},e.totalTime=function(s,n){return arguments.length?(this._forcing=1,!this._dp&&this._ts&&(this._start=he(Le.time-(this._ts>0?s/this._ts:(this.totalDuration()-s)/-this._ts))),r.prototype.totalTime.call(this,s,n),this._forcing=0,this):this._tTime},e.addLabel=function(s,n){return this.labels[s]=Ye(this,n),this},e.removeLabel=function(s){return delete this.labels[s],this},e.addPause=function(s,n,o){var a=zt.delayedCall(0,n||to,o);return a.data="isPause",this._hasPause=1,Ai(this,a,Ye(this,s))},e.removePause=function(s){var n=this._first;for(s=Ye(this,s);n;)n._start===s&&n.data==="isPause"&&Ar(n),n=n._next},e.killTweensOf=function(s,n,o){for(var a=this.getTweensOf(s,o),h=a.length;h--;)Pr!==a[h]&&a[h].kill(s,n);return this},e.getTweensOf=function(s,n){for(var o=[],a=ze(s),h=this._first,l=rr(n),u;h;)h instanceof zt?zS(h._targets,a)&&(l?(!Pr||h._initted&&h._ts)&&h.globalTime(0)<=n&&h.globalTime(h.totalDuration())>n:!n||h.isActive())&&o.push(h):(u=h.getTweensOf(a,n)).length&&o.push.apply(o,u),h=h._next;return o},e.tweenTo=function(s,n){n=n||{};var o=this,a=Ye(o,s),h=n,l=h.startAt,u=h.onStart,c=h.onStartParams,d=h.immediateRender,p,m=zt.to(o,Ke({ease:n.ease||"none",lazy:!1,immediateRender:!1,time:a,overwrite:"auto",duration:n.duration||Math.abs((a-(l&&"time"in l?l.time:o._time))/o.timeScale())||Pt,onStart:function(){if(o.pause(),!p){var g=n.duration||Math.abs((a-(l&&"time"in l?l.time:o._time))/o.timeScale());m._dur!==g&&tn(m,g,0,1).render(m._time,!0,!0),p=1}u&&u.apply(m,c||[])}},n));return d?m.render(0):m},e.tweenFromTo=function(s,n,o){return this.tweenTo(n,Ke({startAt:{time:Ye(this,s)}},o))},e.recent=function(){return this._recent},e.nextLabel=function(s){return s===void 0&&(s=this._time),d0(this,Ye(this,s))},e.previousLabel=function(s){return s===void 0&&(s=this._time),d0(this,Ye(this,s),1)},e.currentLabel=function(s){return arguments.length?this.seek(s,!0):this.previousLabel(this._time+Pt)},e.shiftChildren=function(s,n,o){o===void 0&&(o=0);for(var a=this._first,h=this.labels,l;a;)a._start>=o&&(a._start+=s,a._end+=s),a=a._next;if(n)for(l in h)h[l]>=o&&(h[l]+=s);return hs(this)},e.invalidate=function(s){var n=this._first;for(this._lock=0;n;)n.invalidate(s),n=n._next;return r.prototype.invalidate.call(this,s)},e.clear=function(s){s===void 0&&(s=!0);for(var n=this._first,o;n;)o=n._next,this.remove(n),n=o;return this._dp&&(this._time=this._tTime=this._pTime=0),s&&(this.labels={}),hs(this)},e.totalDuration=function(s){var n=0,o=this,a=o._last,h=Ve,l,u,c;if(arguments.length)return o.timeScale((o._repeat<0?o.duration():o.totalDuration())/(o.reversed()?-s:s));if(o._dirty){for(c=o.parent;a;)l=a._prev,a._dirty&&a.totalDuration(),u=a._start,u>h&&o._sort&&a._ts&&!o._lock?(o._lock=1,Ai(o,a,u-a._delay,1)._lock=0):h=u,u<0&&a._ts&&(n-=u,(!c&&!o._dp||c&&c.smoothChildTiming)&&(o._start+=u/o._ts,o._time-=u,o._tTime-=u),o.shiftChildren(-u,!1,-1/0),h=0),a._end>n&&a._ts&&(n=a._end),a=l;tn(o,o===Bt&&o._time>n?o._time:n,1,1),o._dirty=0}return o._tDur},t.updateRoot=function(s){if(Bt._ts&&(jg(Bt,ah(s,Bt)),Kg=Le.frame),Le.frame>=Yg){Yg+=Me.autoSleep||120;var n=Bt._first;if((!n||!n._ts)&&Me.autoSleep&&Le._listeners.length<2){for(;n&&!n._ts;)n=n._next;n||Le.sleep()}}},t}(ho);Ke(Te.prototype,{_lock:0,_hasPause:0,_forcing:0});var yE=function(t,e,i,s,n,o,a){var h=new we(this._pt,t,e,0,1,A0,null,n),l=0,u=0,c,d,p,m,f,g,y,_;for(h.b=i,h.e=s,i+="",s+="",(y=~s.indexOf("random("))&&(s=so(s)),o&&(_=[i,s],o(_,t,e),i=_[0],s=_[1]),d=i.match(oc)||[];c=oc.exec(s);)m=c[0],f=s.substring(l,c.index),p?p=(p+1)%5:f.substr(-5)==="rgba("&&(p=1),m!==d[u++]&&(g=parseFloat(d[u-1])||0,h._pt={_next:h._pt,p:f||u===1?f:",",s:g,c:m.charAt(1)==="="?Qs(g,m)-g:parseFloat(m)-g,m:p&&p<4?Math.round:0},l=oc.lastIndex);return h.c=l<s.length?s.substring(l,s.length):"",h.fp=a,(Ug.test(s)||y)&&(h.e=0),this._pt=h,h},wc=function(t,e,i,s,n,o,a,h,l,u){Vt(s)&&(s=s(n||0,t,o));var c=t[e],d=i!=="get"?i:Vt(c)?l?t[e.indexOf("set")||!Vt(t["get"+e.substr(3)])?e:"get"+e.substr(3)](l):t[e]():c,p=Vt(c)?l?TE:C0:Cc,m;if(re(s)&&(~s.indexOf("random(")&&(s=so(s)),s.charAt(1)==="="&&(m=Qs(d,s)+(pe(d)||0),(m||m===0)&&(s=m))),!u||d!==s||Sc)return!isNaN(d*s)&&s!==""?(m=new we(this._pt,t,e,+d||0,s-(d||0),typeof c=="boolean"?SE:I0,0,p),l&&(m.fp=l),a&&m.modifier(a,this,t),this._pt=m):(!c&&!(e in t)&&lc(e,s),yE.call(this,t,e,d,s,p,h||Me.stringFilter,l))},bE=function(t,e,i,s,n){if(Vt(t)&&(t=lo(t,n,e,i,s)),!Ii(t)||t.style&&t.nodeType||de(t)||Bg(t))return re(t)?lo(t,n,e,i,s):t;var o={},a;for(a in t)o[a]=lo(t[a],n,e,i,s);return o},w0=function(t,e,i,s,n,o){var a,h,l,u;if(Pe[t]&&(a=new Pe[t]).init(n,a.rawVars?e[t]:bE(e[t],s,n,o,i),i,s,o)!==!1&&(i._pt=h=new we(i._pt,n,t,0,1,a.render,a,0,a.priority),i!==en))for(l=i._ptLookup[i._targets.indexOf(n)],u=a._props.length;u--;)l[a._props[u]]=h;return a},Pr,Sc,Ec=function r(t,e,i){var s=t.vars,n=s.ease,o=s.startAt,a=s.immediateRender,h=s.lazy,l=s.onUpdate,u=s.onUpdateParams,c=s.callbackScope,d=s.runBackwards,p=s.yoyoEase,m=s.keyframes,f=s.autoRevert,g=t._dur,y=t._startAt,_=t._targets,b=t.parent,v=b&&b.data==="nested"?b.vars.targets:_,S=t._overwrite==="auto"&&!ec,E=t.timeline,A,I,P,W,G,N,C,F,X,V,L,k,H;if(E&&(!m||!n)&&(n="none"),t._ease=ls(n,Js.ease),t._yEase=p?x0(ls(p===!0?n:p,Js.ease)):0,p&&t._yoyo&&!t._repeat&&(p=t._yEase,t._yEase=t._ease,t._ease=p),t._from=!E&&!!s.runBackwards,!E||m&&!s.stagger){if(F=_[0]?os(_[0]).harness:0,k=F&&s[F.prop],A=nh(s,uc),y&&(y._zTime<0&&y.progress(1),e<0&&d&&a&&!f?y.render(-1,!0):y.revert(d&&g?ih:KS),y._lazy=0),o){if(Ar(t._startAt=zt.set(_,Ke({data:"isStart",overwrite:!1,parent:b,immediateRender:!0,lazy:!y&&_e(h),startAt:null,delay:0,onUpdate:l,onUpdateParams:u,callbackScope:c,stagger:0},o))),t._startAt._dp=0,t._startAt._sat=t,e<0&&(ce||!a&&!f)&&t._startAt.revert(ih),a&&g&&e<=0&&i<=0){e&&(t._zTime=e);return}}else if(d&&g&&!y){if(e&&(a=!1),P=Ke({overwrite:!1,data:"isFromStart",lazy:a&&!y&&_e(h),immediateRender:a,stagger:0,parent:b},A),k&&(P[F.prop]=k),Ar(t._startAt=zt.set(_,P)),t._startAt._dp=0,t._startAt._sat=t,e<0&&(ce?t._startAt.revert(ih):t._startAt.render(-1,!0)),t._zTime=e,!a)r(t._startAt,Pt,Pt);else if(!e)return}for(t._pt=t._ptCache=0,h=g&&_e(h)||h&&!g,I=0;I<_.length;I++){if(G=_[I],C=G._gsap||fc(_)[I]._gsap,t._ptLookup[I]=V={},cc[C.id]&&Ir.length&&sh(),L=v===_?I:v.indexOf(G),F&&(X=new F).init(G,k||A,t,L,v)!==!1&&(t._pt=W=new we(t._pt,G,X.name,0,1,X.render,X,0,X.priority),X._props.forEach(function(D){V[D]=W}),X.priority&&(N=1)),!F||k)for(P in A)Pe[P]&&(X=w0(P,A,t,L,G,v))?X.priority&&(N=1):V[P]=W=wc.call(t,G,P,"get",A[P],L,v,0,s.stringFilter);t._op&&t._op[I]&&t.kill(G,t._op[I]),S&&t._pt&&(Pr=t,Bt.killTweensOf(G,V,t.globalTime(e)),H=!t.parent,Pr=0),t._pt&&h&&(cc[C.id]=1)}N&&M0(t),t._onInit&&t._onInit(t)}t._onUpdate=l,t._initted=(!t._op||t._pt)&&!H,m&&e<=0&&E.render(Ve,!0,!0)},xE=function(t,e,i,s,n,o,a){var h=(t._pt&&t._ptCache||(t._ptCache={}))[e],l,u,c,d;if(!h)for(h=t._ptCache[e]=[],c=t._ptLookup,d=t._targets.length;d--;){if(l=c[d][e],l&&l.d&&l.d._pt)for(l=l.d._pt;l&&l.p!==e&&l.fp!==e;)l=l._next;if(!l)return Sc=1,t.vars[e]="+=0",Ec(t,a),Sc=0,1;h.push(l)}for(d=h.length;d--;)u=h[d],l=u._pt||u,l.s=(s||s===0)&&!n?s:l.s+(s||0)+o*l.c,l.c=i-l.s,u.e&&(u.e=Kt(i)+pe(u.e)),u.b&&(u.b=l.s+pe(u.b))},_E=function(t,e){var i=t[0]?os(t[0]).harness:0,s=i&&i.aliases,n,o,a,h;if(!s)return e;n=as({},e);for(o in s)if(o in n)for(h=s[o].split(","),a=h.length;a--;)n[h[a]]=n[o];return n},vE=function(t,e,i,s){var n=e.ease||s||"power1.inOut",o,a;if(de(e))a=i[t]||(i[t]=[]),e.forEach(function(h,l){return a.push({t:l/(e.length-1)*100,v:h,e:n})});else for(o in e)a=i[o]||(i[o]=[]),o==="ease"||a.push({t:parseFloat(t),v:e[o],e:n})},lo=function(t,e,i,s,n){return Vt(t)?t.call(e,i,s,n):re(t)&&~t.indexOf("random(")?so(t):t},S0=pc+"repeat,repeatDelay,yoyo,repeatRefresh,yoyoEase,autoRevert",E0={};ve(S0+",id,stagger,delay,duration,paused,scrollTrigger",function(r){return E0[r]=1});var zt=function(r){kg(t,r);function t(i,s,n,o){var a;typeof s=="number"&&(n.duration=s,s=n,n=null),a=r.call(this,o?s:eo(s))||this;var h=a.vars,l=h.duration,u=h.delay,c=h.immediateRender,d=h.stagger,p=h.overwrite,m=h.keyframes,f=h.defaults,g=h.scrollTrigger,y=h.yoyoEase,_=s.parent||Bt,b=(de(i)||Bg(i)?rr(i[0]):"length"in s)?[i]:ze(i),v,S,E,A,I,P,W,G;if(a._targets=b.length?fc(b):eh("GSAP target "+i+" not found. https://greensock.com",!Me.nullTargetWarn)||[],a._ptLookup=[],a._overwrite=p,m||d||qa(l)||qa(u)){if(s=a.vars,v=a.timeline=new Te({data:"nested",defaults:f||{},targets:_&&_.data==="nested"?_.vars.targets:b}),v.kill(),v.parent=v._dp=ir(a),v._start=0,d||qa(l)||qa(u)){if(A=b.length,W=d&&a0(d),Ii(d))for(I in d)~S0.indexOf(I)&&(G||(G={}),G[I]=d[I]);for(S=0;S<A;S++)E=nh(s,E0),E.stagger=0,y&&(E.yoyoEase=y),G&&as(E,G),P=b[S],E.duration=+lo(l,ir(a),S,P,b),E.delay=(+lo(u,ir(a),S,P,b)||0)-a._delay,!d&&A===1&&E.delay&&(a._delay=u=E.delay,a._start+=u,E.delay=0),v.to(P,E,W?W(S,P,b):0),v._ease=St.none;v.duration()?l=u=0:a.timeline=0}else if(m){eo(Ke(v.vars.defaults,{ease:"none"})),v._ease=ls(m.ease||s.ease||"none");var N=0,C,F,X;if(de(m))m.forEach(function(V){return v.to(b,V,">")}),v.duration();else{E={};for(I in m)I==="ease"||I==="easeEach"||vE(I,m[I],E,m.easeEach);for(I in E)for(C=E[I].sort(function(V,L){return V.t-L.t}),N=0,S=0;S<C.length;S++)F=C[S],X={ease:F.e,duration:(F.t-(S?C[S-1].t:0))/100*l},X[I]=F.v,v.to(b,X,N),N+=X.duration;v.duration()<l&&v.to({},{duration:l-v.duration()})}}l||a.duration(l=v.duration())}else a.timeline=0;return p===!0&&!ec&&(Pr=ir(a),Bt.killTweensOf(b),Pr=0),Ai(_,ir(a),n),s.reversed&&a.reverse(),s.paused&&a.paused(!0),(c||!l&&!m&&a._start===he(_._time)&&_e(c)&&QS(ir(a))&&_.data!=="nested")&&(a._tTime=-Pt,a.render(Math.max(0,-u)||0)),g&&i0(ir(a),g),a}var e=t.prototype;return e.render=function(s,n,o){var a=this._time,h=this._tDur,l=this._dur,u=s<0,c=s>h-Pt&&!u?h:s<Pt?0:s,d,p,m,f,g,y,_,b,v;if(!l)tE(this,s,n,o);else if(c!==this._tTime||!s||o||!this._initted&&this._tTime||this._startAt&&this._zTime<0!==u){if(d=c,b=this.timeline,this._repeat){if(f=l+this._rDelay,this._repeat<-1&&u)return this.totalTime(f*100+s,n,o);if(d=he(c%f),c===h?(m=this._repeat,d=l):(m=~~(c/f),m&&m===c/f&&(d=l,m--),d>l&&(d=l)),y=this._yoyo&&m&1,y&&(v=this._yEase,d=l-d),g=qs(this._tTime,f),d===a&&!o&&this._initted)return this._tTime=c,this;m!==g&&(b&&this._yEase&&_0(b,y),this.vars.repeatRefresh&&!y&&!this._lock&&(this._lock=o=1,this.render(he(f*m),!0).invalidate()._lock=0))}if(!this._initted){if(r0(this,u?s:d,o,n,c))return this._tTime=0,this;if(a!==this._time)return this;if(l!==this._dur)return this.render(s,n,o)}if(this._tTime=c,this._time=d,!this._act&&this._ts&&(this._act=1,this._lazy=0),this.ratio=_=(v||this._ease)(d/l),this._from&&(this.ratio=_=1-_),d&&!a&&!n&&!m&&(je(this,"onStart"),this._tTime!==c))return this;for(p=this._pt;p;)p.r(_,p.d),p=p._next;b&&b.render(s<0?s:!d&&y?-Pt:b._dur*b._ease(d/this._dur),n,o)||this._startAt&&(this._zTime=s),this._onUpdate&&!n&&(u&&mc(this,s,n,o),je(this,"onUpdate")),this._repeat&&m!==g&&this.vars.onRepeat&&!n&&this.parent&&je(this,"onRepeat"),(c===this._tDur||!c)&&this._tTime===c&&(u&&!this._onUpdate&&mc(this,s,!0,!0),(s||!l)&&(c===this._tDur&&this._ts>0||!c&&this._ts<0)&&Ar(this,1),!n&&!(u&&!a)&&(c||a||y)&&(je(this,c===h?"onComplete":"onReverseComplete",!0),this._prom&&!(c<h&&this.timeScale()>0)&&this._prom()))}return this},e.targets=function(){return this._targets},e.invalidate=function(s){return(!s||!this.vars.runBackwards)&&(this._startAt=0),this._pt=this._op=this._onUpdate=this._lazy=this.ratio=0,this._ptLookup=[],this.timeline&&this.timeline.invalidate(s),r.prototype.invalidate.call(this,s)},e.resetTo=function(s,n,o,a){ao||Le.wake(),this._ts||this.play();var h=Math.min(this._dur,(this._dp._time-this._start)*this._ts),l;return this._initted||Ec(this,h),l=this._ease(h/this._dur),xE(this,s,n,o,a,l,h)?this.resetTo(s,n,o,a):(lh(this,0),this.parent||qg(this._dp,this,"_first","_last",this._dp._sort?"_start":0),this.render(0))},e.kill=function(s,n){if(n===void 0&&(n="all"),!s&&(!n||n==="all"))return this._lazy=this._pt=0,this.parent?no(this):this;if(this.timeline){var o=this.timeline.totalDuration();return this.timeline.killTweensOf(s,n,Pr&&Pr.vars.overwrite!==!0)._first||no(this),this.parent&&o!==this.timeline.totalDuration()&&tn(this,this._dur*this.timeline._tDur/o,0,1),this}var a=this._targets,h=s?ze(s):a,l=this._ptLookup,u=this._pt,c,d,p,m,f,g,y;if((!n||n==="all")&&JS(a,h))return n==="all"&&(this._pt=0),no(this);for(c=this._op=this._op||[],n!=="all"&&(re(n)&&(f={},ve(n,function(_){return f[_]=1}),n=f),n=_E(a,n)),y=a.length;y--;)if(~h.indexOf(a[y])){d=l[y],n==="all"?(c[y]=n,m=d,p={}):(p=c[y]=c[y]||{},m=n);for(f in m)g=d&&d[f],g&&((!("kill"in g.d)||g.d.kill(f)===!0)&&oh(this,g,"_pt"),delete d[f]),p!=="all"&&(p[f]=1)}return this._initted&&!this._pt&&u&&no(this),this},t.to=function(s,n){return new t(s,n,arguments[2])},t.from=function(s,n){return io(1,arguments)},t.delayedCall=function(s,n,o,a){return new t(n,0,{immediateRender:!1,lazy:!1,overwrite:!1,delay:s,onComplete:n,onReverseComplete:n,onCompleteParams:o,onReverseCompleteParams:o,callbackScope:a})},t.fromTo=function(s,n,o){return io(2,arguments)},t.set=function(s,n){return n.duration=0,n.repeatDelay||(n.repeat=0),new t(s,n)},t.killTweensOf=function(s,n,o){return Bt.killTweensOf(s,n,o)},t}(ho);Ke(zt.prototype,{_targets:[],_lazy:0,_startAt:0,_op:0,_onInit:0}),ve("staggerTo,staggerFrom,staggerFromTo",function(r){zt[r]=function(){var t=new Te,e=yc.call(arguments,0);return e.splice(r==="staggerFromTo"?5:4,0,0),t[r].apply(t,e)}});var Cc=function(t,e,i){return t[e]=i},C0=function(t,e,i){return t[e](i)},TE=function(t,e,i,s){return t[e](s.fp,i)},wE=function(t,e,i){return t.setAttribute(e,i)},Ic=function(t,e){return Vt(t[e])?C0:rc(t[e])&&t.setAttribute?wE:Cc},I0=function(t,e){return e.set(e.t,e.p,Math.round((e.s+e.c*t)*1e6)/1e6,e)},SE=function(t,e){return e.set(e.t,e.p,!!(e.s+e.c*t),e)},A0=function(t,e){var i=e._pt,s="";if(!t&&e.b)s=e.b;else if(t===1&&e.e)s=e.e;else{for(;i;)s=i.p+(i.m?i.m(i.s+i.c*t):Math.round((i.s+i.c*t)*1e4)/1e4)+s,i=i._next;s+=e.c}e.set(e.t,e.p,s,e)},Ac=function(t,e){for(var i=e._pt;i;)i.r(t,i.d),i=i._next},EE=function(t,e,i,s){for(var n=this._pt,o;n;)o=n._next,n.p===s&&n.modifier(t,e,i),n=o},CE=function(t){for(var e=this._pt,i,s;e;)s=e._next,e.p===t&&!e.op||e.op===t?oh(this,e,"_pt"):e.dep||(i=1),e=s;return!i},IE=function(t,e,i,s){s.mSet(t,e,s.m.call(s.tween,i,s.mt),s)},M0=function(t){for(var e=t._pt,i,s,n,o;e;){for(i=e._next,s=n;s&&s.pr>e.pr;)s=s._next;(e._prev=s?s._prev:o)?e._prev._next=e:n=e,(e._next=s)?s._prev=e:o=e,e=i}t._pt=n},we=function(){function r(e,i,s,n,o,a,h,l,u){this.t=i,this.s=n,this.c=o,this.p=s,this.r=a||I0,this.d=h||this,this.set=l||Cc,this.pr=u||0,this._next=e,e&&(e._prev=this)}var t=r.prototype;return t.modifier=function(i,s,n){this.mSet=this.mSet||this.set,this.set=IE,this.m=i,this.mt=n,this.tween=s},r}();ve(pc+"parent,duration,ease,delay,overwrite,runBackwards,startAt,yoyo,immediateRender,repeat,repeatDelay,data,paused,reversed,lazy,callbackScope,stringFilter,id,yoyoEase,stagger,inherit,repeatRefresh,keyframes,autoRevert,scrollTrigger",function(r){return uc[r]=1}),Re.TweenMax=Re.TweenLite=zt,Re.TimelineLite=Re.TimelineMax=Te,Bt=new Te({sortChildren:!1,defaults:Js,autoRemoveChildren:!0,id:"root",smoothChildTiming:!0}),Me.stringFilter=b0;var cs=[],uh={},AE=[],R0=0,ME=0,Mc=function(t){return(uh[t]||AE).map(function(e){return e()})},Rc=function(){var t=Date.now(),e=[];t-R0>2&&(Mc("matchMediaInit"),cs.forEach(function(i){var s=i.queries,n=i.conditions,o,a,h,l;for(a in s)o=He.matchMedia(s[a]).matches,o&&(h=1),o!==n[a]&&(n[a]=o,l=1);l&&(i.revert(),h&&e.push(i))}),Mc("matchMediaRevert"),e.forEach(function(i){return i.onMatch(i)}),R0=t,Mc("matchMedia"))},P0=function(){function r(e,i){this.selector=i&&bc(i),this.data=[],this._r=[],this.isReverted=!1,this.id=ME++,e&&this.add(e)}var t=r.prototype;return t.add=function(i,s,n){Vt(i)&&(n=s,s=i,i=Vt);var o=this,a=function(){var l=Zt,u=o.selector,c;return l&&l!==o&&l.data.push(o),n&&(o.selector=bc(n)),Zt=o,c=s.apply(o,arguments),Vt(c)&&o._r.push(c),Zt=l,o.selector=u,o.isReverted=!1,c};return o.last=a,i===Vt?a(o):i?o[i]=a:a},t.ignore=function(i){var s=Zt;Zt=null,i(this),Zt=s},t.getTweens=function(){var i=[];return this.data.forEach(function(s){return s instanceof r?i.push.apply(i,s.getTweens()):s instanceof zt&&!(s.parent&&s.parent.data==="nested")&&i.push(s)}),i},t.clear=function(){this._r.length=this.data.length=0},t.kill=function(i,s){var n=this;if(i){var o=this.getTweens();this.data.forEach(function(h){h.data==="isFlip"&&(h.revert(),h.getChildren(!0,!0,!1).forEach(function(l){return o.splice(o.indexOf(l),1)}))}),o.map(function(h){return{g:h.globalTime(0),t:h}}).sort(function(h,l){return l.g-h.g||-1/0}).forEach(function(h){return h.t.revert(i)}),this.data.forEach(function(h){return!(h instanceof zt)&&h.revert&&h.revert(i)}),this._r.forEach(function(h){return h(i,n)}),this.isReverted=!0}else this.data.forEach(function(h){return h.kill&&h.kill()});if(this.clear(),s)for(var a=cs.length;a--;)cs[a].id===this.id&&cs.splice(a,1)},t.revert=function(i){this.kill(i||{})},r}(),RE=function(){function r(e){this.contexts=[],this.scope=e}var t=r.prototype;return t.add=function(i,s,n){Ii(i)||(i={matches:i});var o=new P0(0,n||this.scope),a=o.conditions={},h,l,u;Zt&&!o.selector&&(o.selector=Zt.selector),this.contexts.push(o),s=o.add("onMatch",s),o.queries=i;for(l in i)l==="all"?u=1:(h=He.matchMedia(i[l]),h&&(cs.indexOf(o)<0&&cs.push(o),(a[l]=h.matches)&&(u=1),h.addListener?h.addListener(Rc):h.addEventListener("change",Rc)));return u&&s(o),this},t.revert=function(i){this.kill(i||{})},t.kill=function(i){this.contexts.forEach(function(s){return s.kill(i,!0)})},r}(),ch={registerPlugin:function(){for(var t=arguments.length,e=new Array(t),i=0;i<t;i++)e[i]=arguments[i];e.forEach(function(s){return f0(s)})},timeline:function(t){return new Te(t)},getTweensOf:function(t,e){return Bt.getTweensOf(t,e)},getProperty:function(t,e,i,s){re(t)&&(t=ze(t)[0]);var n=os(t||{}).get,o=i?$g:Jg;return i==="native"&&(i=""),t&&(e?o((Pe[e]&&Pe[e].get||n)(t,e,i,s)):function(a,h,l){return o((Pe[a]&&Pe[a].get||n)(t,a,h,l))})},quickSetter:function(t,e,i){if(t=ze(t),t.length>1){var s=t.map(function(u){return Se.quickSetter(u,e,i)}),n=s.length;return function(u){for(var c=n;c--;)s[c](u)}}t=t[0]||{};var o=Pe[e],a=os(t),h=a.harness&&(a.harness.aliases||{})[e]||e,l=o?function(u){var c=new o;en._pt=0,c.init(t,i?u+i:u,en,0,[t]),c.render(1,c),en._pt&&Ac(1,en)}:a.set(t,h);return o?l:function(u){return l(t,h,i?u+i:u,a,1)}},quickTo:function(t,e,i){var s,n=Se.to(t,as((s={},s[e]="+=0.1",s.paused=!0,s),i||{})),o=function(h,l,u){return n.resetTo(e,h,l,u)};return o.tween=n,o},isTweening:function(t){return Bt.getTweensOf(t,!0).length>0},defaults:function(t){return t&&t.ease&&(t.ease=ls(t.ease,Js.ease)),Qg(Js,t||{})},config:function(t){return Qg(Me,t||{})},registerEffect:function(t){var e=t.name,i=t.effect,s=t.plugins,n=t.defaults,o=t.extendTimeline;(s||"").split(",").forEach(function(a){return a&&!Pe[a]&&!Re[a]&&eh(e+" effect requires "+a+" plugin.")}),dc[e]=function(a,h,l){return i(ze(a),Ke(h||{},n),l)},o&&(Te.prototype[e]=function(a,h,l){return this.add(dc[e](a,Ii(h)?h:(l=h)&&{},this),l)})},registerEase:function(t,e){St[t]=ls(e)},parseEase:function(t,e){return arguments.length?ls(t,e):St},getById:function(t){return Bt.getById(t)},exportRoot:function(t,e){t===void 0&&(t={});var i=new Te(t),s,n;for(i.smoothChildTiming=_e(t.smoothChildTiming),Bt.remove(i),i._dp=0,i._time=i._tTime=Bt._time,s=Bt._first;s;)n=s._next,(e||!(!s._dur&&s instanceof zt&&s.vars.onComplete===s._targets[0]))&&Ai(i,s,s._start-s._delay),s=n;return Ai(Bt,i,0),i},context:function(t,e){return t?new P0(t,e):Zt},matchMedia:function(t){return new RE(t)},matchMediaRefresh:function(){return cs.forEach(function(t){var e=t.conditions,i,s;for(s in e)e[s]&&(e[s]=!1,i=1);i&&t.revert()})||Rc()},addEventListener:function(t,e){var i=uh[t]||(uh[t]=[]);~i.indexOf(e)||i.push(e)},removeEventListener:function(t,e){var i=uh[t],s=i&&i.indexOf(e);s>=0&&i.splice(s,1)},utils:{wrap:hE,wrapYoyo:lE,distribute:a0,random:l0,snap:h0,normalize:aE,getUnit:pe,clamp:rE,splitColor:m0,toArray:ze,selector:bc,mapRange:c0,pipe:nE,unitize:oE,interpolate:uE,shuffle:o0},install:Vg,effects:dc,ticker:Le,updateRoot:Te.updateRoot,plugins:Pe,globalTimeline:Bt,core:{PropTween:we,globals:Hg,Tween:zt,Timeline:Te,Animation:ho,getCache:os,_removeLinkedListItem:oh,reverting:function(){return ce},context:function(t){return t&&Zt&&(Zt.data.push(t),t._ctx=Zt),Zt},suppressOverwrites:function(t){return ec=t}}};ve("to,from,fromTo,delayedCall,set,killTweensOf",function(r){return ch[r]=zt[r]}),Le.add(Te.updateRoot),en=ch.to({},{duration:0});var PE=function(t,e){for(var i=t._pt;i&&i.p!==e&&i.op!==e&&i.fp!==e;)i=i._next;return i},LE=function(t,e){var i=t._targets,s,n,o;for(s in e)for(n=i.length;n--;)o=t._ptLookup[n][s],o&&(o=o.d)&&(o._pt&&(o=PE(o,s)),o&&o.modifier&&o.modifier(e[s],t,i[n],s))},Pc=function(t,e){return{name:t,rawVars:1,init:function(s,n,o){o._onInit=function(a){var h,l;if(re(n)&&(h={},ve(n,function(u){return h[u]=1}),n=h),e){h={};for(l in n)h[l]=e(n[l]);n=h}LE(a,n)}}}},Se=ch.registerPlugin({name:"attr",init:function(t,e,i,s,n){var o,a,h;this.tween=i;for(o in e)h=t.getAttribute(o)||"",a=this.add(t,"setAttribute",(h||0)+"",e[o],s,n,0,0,o),a.op=o,a.b=h,this._props.push(o)},render:function(t,e){for(var i=e._pt;i;)ce?i.set(i.t,i.p,i.b,i):i.r(t,i.d),i=i._next}},{name:"endArray",init:function(t,e){for(var i=e.length;i--;)this.add(t,i,t[i]||0,e[i],0,0,0,0,0,1)}},Pc("roundProps",xc),Pc("modifiers"),Pc("snap",h0))||ch;zt.version=Te.version=Se.version="3.12.2",Zg=1,sc()&&rn(),St.Power0,St.Power1,St.Power2,St.Power3,St.Power4,St.Linear,St.Quad,St.Cubic,St.Quart,St.Quint,St.Strong,St.Elastic,St.Back,St.SteppedEase,St.Bounce,St.Sine,St.Expo,St.Circ;/*!
|
|
1168
1168
|
* CSSPlugin 3.12.2
|
|
1169
1169
|
* https://greensock.com
|
|
1170
1170
|
*
|
|
@@ -1172,6 +1172,6 @@ void main(void)\r
|
|
|
1172
1172
|
* Subject to the terms at https://greensock.com/standard-license or for
|
|
1173
1173
|
* Club GreenSock members, the agreement issued with that membership.
|
|
1174
1174
|
* @author: Jack Doyle, jack@greensock.com
|
|
1175
|
-
*/var M0,Rr,rn,Lc,ls,R0,Gc,RE=function(){return typeof window<"u"},rr={},us=180/Math.PI,sn=Math.PI/180,nn=Math.atan2,P0=1e8,Nc=/([A-Z])/g,PE=/(left|right|width|margin|padding|x)/i,LE=/[\s,\(]\S/,Ri={autoAlpha:"opacity,visibility",scale:"scaleX,scaleY",alpha:"opacity"},Fc=function(t,e){return e.set(e.t,e.p,Math.round((e.s+e.c*t)*1e4)/1e4+e.u,e)},GE=function(t,e){return e.set(e.t,e.p,t===1?e.e:Math.round((e.s+e.c*t)*1e4)/1e4+e.u,e)},NE=function(t,e){return e.set(e.t,e.p,t?Math.round((e.s+e.c*t)*1e4)/1e4+e.u:e.b,e)},FE=function(t,e){var i=e.s+e.c*t;e.set(e.t,e.p,~~(i+(i<0?-.5:.5))+e.u,e)},L0=function(t,e){return e.set(e.t,e.p,t?e.e:e.b,e)},G0=function(t,e){return e.set(e.t,e.p,t!==1?e.b:e.e,e)},DE=function(t,e,i){return t.style[e]=i},kE=function(t,e,i){return t.style.setProperty(e,i)},OE=function(t,e,i){return t._gsap[e]=i},BE=function(t,e,i){return t._gsap.scaleX=t._gsap.scaleY=i},WE=function(t,e,i,s,n){var o=t._gsap;o.scaleX=o.scaleY=i,o.renderTransform(n,o)},UE=function(t,e,i,s,n){var o=t._gsap;o[e]=i,o.renderTransform(n,o)},Wt="transform",hi=Wt+"Origin",XE=function r(t,e){var i=this,s=this.target,n=s.style;if(t in rr&&n){if(this.tfm=this.tfm||{},t!=="transform")t=Ri[t]||t,~t.indexOf(",")?t.split(",").forEach(function(o){return i.tfm[o]=sr(s,o)}):this.tfm[t]=s._gsap.x?s._gsap[t]:sr(s,t);else return Ri.transform.split(",").forEach(function(o){return r.call(i,o,e)});if(this.props.indexOf(Wt)>=0)return;s._gsap.svg&&(this.svgo=s.getAttribute("data-svg-origin"),this.props.push(hi,e,"")),t=Wt}(n||e)&&this.props.push(t,e,n[t])},N0=function(t){t.translate&&(t.removeProperty("translate"),t.removeProperty("scale"),t.removeProperty("rotate"))},ZE=function(){var t=this.props,e=this.target,i=e.style,s=e._gsap,n,o;for(n=0;n<t.length;n+=3)t[n+1]?e[t[n]]=t[n+2]:t[n+2]?i[t[n]]=t[n+2]:i.removeProperty(t[n].substr(0,2)==="--"?t[n]:t[n].replace(Nc,"-$1").toLowerCase());if(this.tfm){for(o in this.tfm)s[o]=this.tfm[o];s.svg&&(s.renderTransform(),e.setAttribute("data-svg-origin",this.svgo||"")),n=Gc(),(!n||!n.isStart)&&!i[Wt]&&(N0(i),s.uncache=1)}},F0=function(t,e){var i={target:t,props:[],revert:ZE,save:XE};return t._gsap||we.core.getCache(t),e&&e.split(",").forEach(function(s){return i.save(s)}),i},D0,Dc=function(t,e){var i=Rr.createElementNS?Rr.createElementNS((e||"http://www.w3.org/1999/xhtml").replace(/^https/,"http"),t):Rr.createElement(t);return i.style?i:Rr.createElement(t)},Pi=function r(t,e,i){var s=getComputedStyle(t);return s[e]||s.getPropertyValue(e.replace(Nc,"-$1").toLowerCase())||s.getPropertyValue(e)||!i&&r(t,on(e)||e,1)||""},k0="O,Moz,ms,Ms,Webkit".split(","),on=function(t,e,i){var s=e||ls,n=s.style,o=5;if(t in n&&!i)return t;for(t=t.charAt(0).toUpperCase()+t.substr(1);o--&&!(k0[o]+t in n););return o<0?null:(o===3?"ms":o>=0?k0[o]:"")+t},kc=function(){RE()&&window.document&&(M0=window,Rr=M0.document,rn=Rr.documentElement,ls=Dc("div")||{style:{}},Dc("div"),Wt=on(Wt),hi=Wt+"Origin",ls.style.cssText="border-width:0;line-height:0;position:absolute;padding:0",D0=!!on("perspective"),Gc=we.core.reverting,Lc=1)},Oc=function r(t){var e=Dc("svg",this.ownerSVGElement&&this.ownerSVGElement.getAttribute("xmlns")||"http://www.w3.org/2000/svg"),i=this.parentNode,s=this.nextSibling,n=this.style.cssText,o;if(rn.appendChild(e),e.appendChild(this),this.style.display="block",t)try{o=this.getBBox(),this._gsapBBox=this.getBBox,this.getBBox=r}catch{}else this._gsapBBox&&(o=this._gsapBBox());return i&&(s?i.insertBefore(this,s):i.appendChild(this)),rn.removeChild(e),this.style.cssText=n,o},O0=function(t,e){for(var i=e.length;i--;)if(t.hasAttribute(e[i]))return t.getAttribute(e[i])},B0=function(t){var e;try{e=t.getBBox()}catch{e=Oc.call(t,!0)}return e&&(e.width||e.height)||t.getBBox===Oc||(e=Oc.call(t,!0)),e&&!e.width&&!e.x&&!e.y?{x:+O0(t,["x","cx","x1"])||0,y:+O0(t,["y","cy","y1"])||0,width:0,height:0}:e},W0=function(t){return!!(t.getCTM&&(!t.parentNode||t.ownerSVGElement)&&B0(t))},lo=function(t,e){if(e){var i=t.style;e in rr&&e!==hi&&(e=Wt),i.removeProperty?((e.substr(0,2)==="ms"||e.substr(0,6)==="webkit")&&(e="-"+e),i.removeProperty(e.replace(Nc,"-$1").toLowerCase())):i.removeAttribute(e)}},Pr=function(t,e,i,s,n,o){var a=new Te(t._pt,e,i,0,1,o?G0:L0);return t._pt=a,a.b=s,a.e=n,t._props.push(i),a},U0={deg:1,rad:1,turn:1},VE={grid:1,flex:1},Lr=function r(t,e,i,s){var n=parseFloat(i)||0,o=(i+"").trim().substr((n+"").length)||"px",a=ls.style,h=PE.test(e),l=t.tagName.toLowerCase()==="svg",u=(l?"client":"offset")+(h?"Width":"Height"),c=100,d=s==="px",p=s==="%",m,f,g,y;return s===o||!n||U0[s]||U0[o]?n:(o!=="px"&&!d&&(n=r(t,e,i,"px")),y=t.getCTM&&W0(t),(p||o==="%")&&(rr[e]||~e.indexOf("adius"))?(m=y?t.getBBox()[h?"width":"height"]:t[u],Kt(p?n/m*c:n/100*m)):(a[h?"width":"height"]=c+(d?o:s),f=~e.indexOf("adius")||s==="em"&&t.appendChild&&!l?t:t.parentNode,y&&(f=(t.ownerSVGElement||{}).parentNode),(!f||f===Rr||!f.appendChild)&&(f=Rr.body),g=f._gsap,g&&p&&g.width&&h&&g.time===Pe.time&&!g.uncache?Kt(n/g.width*c):((p||o==="%")&&!VE[Pi(f,"display")]&&(a.position=Pi(t,"position")),f===t&&(a.position="static"),f.appendChild(ls),m=ls[u],f.removeChild(ls),a.position="absolute",h&&p&&(g=rs(f),g.time=Pe.time,g.width=f[u]),Kt(d?m*n/c:m&&n?c/m*n:0))))},sr=function(t,e,i,s){var n;return Lc||kc(),e in Ri&&e!=="transform"&&(e=Ri[e],~e.indexOf(",")&&(e=e.split(",")[0])),rr[e]&&e!=="transform"?(n=co(t,s),n=e!=="transformOrigin"?n[e]:n.svg?n.origin:dh(Pi(t,hi))+" "+n.zOrigin+"px"):(n=t.style[e],(!n||n==="auto"||s||~(n+"").indexOf("calc("))&&(n=ch[e]&&ch[e](t,e,i)||Pi(t,e)||Hg(t,e)||(e==="opacity"?1:0))),i&&!~(n+"").trim().indexOf(" ")?Lr(t,e,n,i)+i:n},HE=function(t,e,i,s){if(!i||i==="none"){var n=on(e,t,1),o=n&&Pi(t,n,1);o&&o!==i?(e=n,i=o):e==="borderColor"&&(i=Pi(t,"borderTopColor"))}var a=new Te(this._pt,t.style,e,0,1,E0),h=0,l=0,u,c,d,p,m,f,g,y,_,x,v,S;if(a.b=i,a.e=s,i+="",s+="",s==="auto"&&(t.style[e]=s,s=Pi(t,e)||s,t.style[e]=i),u=[i,s],m0(u),i=u[0],s=u[1],d=i.match(Js)||[],S=s.match(Js)||[],S.length){for(;c=Js.exec(s);)g=c[0],_=s.substring(h,c.index),m?m=(m+1)%5:(_.substr(-5)==="rgba("||_.substr(-5)==="hsla(")&&(m=1),g!==(f=d[l++]||"")&&(p=parseFloat(f)||0,v=f.substr((p+"").length),g.charAt(1)==="="&&(g=$s(p,g)+v),y=parseFloat(g),x=g.substr((y+"").length),h=Js.lastIndex-x.length,x||(x=x||Ae.units[e]||v,h===s.length&&(s+=x,a.e+=x)),v!==x&&(p=Lr(t,e,f,x)||0),a._pt={_next:a._pt,p:_||l===1?_:",",s:p,c:y-p,m:m&&m<4||e==="zIndex"?Math.round:0});a.c=h<s.length?s.substring(h,s.length):""}else a.r=e==="display"&&s==="none"?G0:L0;return Og.test(s)&&(a.e=0),this._pt=a,a},X0={top:"0%",bottom:"100%",left:"0%",right:"100%",center:"50%"},KE=function(t){var e=t.split(" "),i=e[0],s=e[1]||"50%";return(i==="top"||i==="bottom"||s==="left"||s==="right")&&(t=i,i=s,s=t),e[0]=X0[i]||i,e[1]=X0[s]||s,e.join(" ")},YE=function(t,e){if(e.tween&&e.tween._time===e.tween._dur){var i=e.t,s=i.style,n=e.u,o=i._gsap,a,h,l;if(n==="all"||n===!0)s.cssText="",h=1;else for(n=n.split(","),l=n.length;--l>-1;)a=n[l],rr[a]&&(h=1,a=a==="transformOrigin"?hi:Wt),lo(i,a);h&&(lo(i,Wt),o&&(o.svg&&i.removeAttribute("transform"),co(i,1),o.uncache=1,N0(s)))}},ch={clearProps:function(t,e,i,s,n){if(n.data!=="isFromStart"){var o=t._pt=new Te(t._pt,e,i,0,0,YE);return o.u=s,o.pr=-10,o.tween=n,t._props.push(i),1}}},uo=[1,0,0,1,0,0],Z0={},V0=function(t){return t==="matrix(1, 0, 0, 1, 0, 0)"||t==="none"||!t},H0=function(t){var e=Pi(t,Wt);return V0(e)?uo:e.substr(7).match(kg).map(Kt)},Bc=function(t,e){var i=t._gsap||rs(t),s=t.style,n=H0(t),o,a,h,l;return i.svg&&t.getAttribute("transform")?(h=t.transform.baseVal.consolidate().matrix,n=[h.a,h.b,h.c,h.d,h.e,h.f],n.join(",")==="1,0,0,1,0,0"?uo:n):(n===uo&&!t.offsetParent&&t!==rn&&!i.svg&&(h=s.display,s.display="block",o=t.parentNode,(!o||!t.offsetParent)&&(l=1,a=t.nextElementSibling,rn.appendChild(t)),n=H0(t),h?s.display=h:lo(t,"display"),l&&(a?o.insertBefore(t,a):o?o.appendChild(t):rn.removeChild(t))),e&&n.length>6?[n[0],n[1],n[4],n[5],n[12],n[13]]:n)},Wc=function(t,e,i,s,n,o){var a=t._gsap,h=n||Bc(t,!0),l=a.xOrigin||0,u=a.yOrigin||0,c=a.xOffset||0,d=a.yOffset||0,p=h[0],m=h[1],f=h[2],g=h[3],y=h[4],_=h[5],x=e.split(" "),v=parseFloat(x[0])||0,S=parseFloat(x[1])||0,C,A,I,L;i?h!==uo&&(A=p*g-m*f)&&(I=v*(g/A)+S*(-f/A)+(f*_-g*y)/A,L=v*(-m/A)+S*(p/A)-(p*_-m*y)/A,v=I,S=L):(C=B0(t),v=C.x+(~x[0].indexOf("%")?v/100*C.width:v),S=C.y+(~(x[1]||x[0]).indexOf("%")?S/100*C.height:S)),s||s!==!1&&a.smooth?(y=v-l,_=S-u,a.xOffset=c+(y*p+_*f)-y,a.yOffset=d+(y*m+_*g)-_):a.xOffset=a.yOffset=0,a.xOrigin=v,a.yOrigin=S,a.smooth=!!s,a.origin=e,a.originIsAbsolute=!!i,t.style[hi]="0px 0px",o&&(Pr(o,a,"xOrigin",l,v),Pr(o,a,"yOrigin",u,S),Pr(o,a,"xOffset",c,a.xOffset),Pr(o,a,"yOffset",d,a.yOffset)),t.setAttribute("data-svg-origin",v+" "+S)},co=function(t,e){var i=t._gsap||new x0(t);if("x"in i&&!e&&!i.uncache)return i;var s=t.style,n=i.scaleX<0,o="px",a="deg",h=getComputedStyle(t),l=Pi(t,hi)||"0",u,c,d,p,m,f,g,y,_,x,v,S,C,A,I,L,k,M,G,E,N,O,Z,U,K,ht,X,W,j,q,pt,at;return u=c=d=f=g=y=_=x=v=0,p=m=1,i.svg=!!(t.getCTM&&W0(t)),h.translate&&((h.translate!=="none"||h.scale!=="none"||h.rotate!=="none")&&(s[Wt]=(h.translate!=="none"?"translate3d("+(h.translate+" 0 0").split(" ").slice(0,3).join(", ")+") ":"")+(h.rotate!=="none"?"rotate("+h.rotate+") ":"")+(h.scale!=="none"?"scale("+h.scale.split(" ").join(",")+") ":"")+(h[Wt]!=="none"?h[Wt]:"")),s.scale=s.rotate=s.translate="none"),A=Bc(t,i.svg),i.svg&&(i.uncache?(K=t.getBBox(),l=i.xOrigin-K.x+"px "+(i.yOrigin-K.y)+"px",U=""):U=!e&&t.getAttribute("data-svg-origin"),Wc(t,U||l,!!U||i.originIsAbsolute,i.smooth!==!1,A)),S=i.xOrigin||0,C=i.yOrigin||0,A!==uo&&(M=A[0],G=A[1],E=A[2],N=A[3],u=O=A[4],c=Z=A[5],A.length===6?(p=Math.sqrt(M*M+G*G),m=Math.sqrt(N*N+E*E),f=M||G?nn(G,M)*us:0,_=E||N?nn(E,N)*us+f:0,_&&(m*=Math.abs(Math.cos(_*sn))),i.svg&&(u-=S-(S*M+C*E),c-=C-(S*G+C*N))):(at=A[6],q=A[7],X=A[8],W=A[9],j=A[10],pt=A[11],u=A[12],c=A[13],d=A[14],I=nn(at,j),g=I*us,I&&(L=Math.cos(-I),k=Math.sin(-I),U=O*L+X*k,K=Z*L+W*k,ht=at*L+j*k,X=O*-k+X*L,W=Z*-k+W*L,j=at*-k+j*L,pt=q*-k+pt*L,O=U,Z=K,at=ht),I=nn(-E,j),y=I*us,I&&(L=Math.cos(-I),k=Math.sin(-I),U=M*L-X*k,K=G*L-W*k,ht=E*L-j*k,pt=N*k+pt*L,M=U,G=K,E=ht),I=nn(G,M),f=I*us,I&&(L=Math.cos(I),k=Math.sin(I),U=M*L+G*k,K=O*L+Z*k,G=G*L-M*k,Z=Z*L-O*k,M=U,O=K),g&&Math.abs(g)+Math.abs(f)>359.9&&(g=f=0,y=180-y),p=Kt(Math.sqrt(M*M+G*G+E*E)),m=Kt(Math.sqrt(Z*Z+at*at)),I=nn(O,Z),_=Math.abs(I)>2e-4?I*us:0,v=pt?1/(pt<0?-pt:pt):0),i.svg&&(U=t.getAttribute("transform"),i.forceCSS=t.setAttribute("transform","")||!V0(Pi(t,Wt)),U&&t.setAttribute("transform",U))),Math.abs(_)>90&&Math.abs(_)<270&&(n?(p*=-1,_+=f<=0?180:-180,f+=f<=0?180:-180):(m*=-1,_+=_<=0?180:-180)),e=e||i.uncache,i.x=u-((i.xPercent=u&&(!e&&i.xPercent||(Math.round(t.offsetWidth/2)===Math.round(-u)?-50:0)))?t.offsetWidth*i.xPercent/100:0)+o,i.y=c-((i.yPercent=c&&(!e&&i.yPercent||(Math.round(t.offsetHeight/2)===Math.round(-c)?-50:0)))?t.offsetHeight*i.yPercent/100:0)+o,i.z=d+o,i.scaleX=Kt(p),i.scaleY=Kt(m),i.rotation=Kt(f)+a,i.rotationX=Kt(g)+a,i.rotationY=Kt(y)+a,i.skewX=_+a,i.skewY=x+a,i.transformPerspective=v+o,(i.zOrigin=parseFloat(l.split(" ")[2])||0)&&(s[hi]=dh(l)),i.xOffset=i.yOffset=0,i.force3D=Ae.force3D,i.renderTransform=i.svg?jE:D0?K0:zE,i.uncache=0,i},dh=function(t){return(t=t.split(" "))[0]+" "+t[1]},Uc=function(t,e,i){var s=pe(e);return Kt(parseFloat(e)+parseFloat(Lr(t,"x",i+"px",s)))+s},zE=function(t,e){e.z="0px",e.rotationY=e.rotationX="0deg",e.force3D=0,K0(t,e)},cs="0deg",po="0px",ds=") ",K0=function(t,e){var i=e||this,s=i.xPercent,n=i.yPercent,o=i.x,a=i.y,h=i.z,l=i.rotation,u=i.rotationY,c=i.rotationX,d=i.skewX,p=i.skewY,m=i.scaleX,f=i.scaleY,g=i.transformPerspective,y=i.force3D,_=i.target,x=i.zOrigin,v="",S=y==="auto"&&t&&t!==1||y===!0;if(x&&(c!==cs||u!==cs)){var C=parseFloat(u)*sn,A=Math.sin(C),I=Math.cos(C),L;C=parseFloat(c)*sn,L=Math.cos(C),o=Uc(_,o,A*L*-x),a=Uc(_,a,-Math.sin(C)*-x),h=Uc(_,h,I*L*-x+x)}g!==po&&(v+="perspective("+g+ds),(s||n)&&(v+="translate("+s+"%, "+n+"%) "),(S||o!==po||a!==po||h!==po)&&(v+=h!==po||S?"translate3d("+o+", "+a+", "+h+") ":"translate("+o+", "+a+ds),l!==cs&&(v+="rotate("+l+ds),u!==cs&&(v+="rotateY("+u+ds),c!==cs&&(v+="rotateX("+c+ds),(d!==cs||p!==cs)&&(v+="skew("+d+", "+p+ds),(m!==1||f!==1)&&(v+="scale("+m+", "+f+ds),_.style[Wt]=v||"translate(0, 0)"},jE=function(t,e){var i=e||this,s=i.xPercent,n=i.yPercent,o=i.x,a=i.y,h=i.rotation,l=i.skewX,u=i.skewY,c=i.scaleX,d=i.scaleY,p=i.target,m=i.xOrigin,f=i.yOrigin,g=i.xOffset,y=i.yOffset,_=i.forceCSS,x=parseFloat(o),v=parseFloat(a),S,C,A,I,L;h=parseFloat(h),l=parseFloat(l),u=parseFloat(u),u&&(u=parseFloat(u),l+=u,h+=u),h||l?(h*=sn,l*=sn,S=Math.cos(h)*c,C=Math.sin(h)*c,A=Math.sin(h-l)*-d,I=Math.cos(h-l)*d,l&&(u*=sn,L=Math.tan(l-u),L=Math.sqrt(1+L*L),A*=L,I*=L,u&&(L=Math.tan(u),L=Math.sqrt(1+L*L),S*=L,C*=L)),S=Kt(S),C=Kt(C),A=Kt(A),I=Kt(I)):(S=c,I=d,C=A=0),(x&&!~(o+"").indexOf("px")||v&&!~(a+"").indexOf("px"))&&(x=Lr(p,"x",o,"px"),v=Lr(p,"y",a,"px")),(m||f||g||y)&&(x=Kt(x+m-(m*S+f*A)+g),v=Kt(v+f-(m*C+f*I)+y)),(s||n)&&(L=p.getBBox(),x=Kt(x+s/100*L.width),v=Kt(v+n/100*L.height)),L="matrix("+S+","+C+","+A+","+I+","+x+","+v+")",p.setAttribute("transform",L),_&&(p.style[Wt]=L)},JE=function(t,e,i,s,n){var o=360,a=re(n),h=parseFloat(n)*(a&&~n.indexOf("rad")?us:1),l=h-s,u=s+l+"deg",c,d;return a&&(c=n.split("_")[1],c==="short"&&(l%=o,l!==l%(o/2)&&(l+=l<0?o:-o)),c==="cw"&&l<0?l=(l+o*P0)%o-~~(l/o)*o:c==="ccw"&&l>0&&(l=(l-o*P0)%o-~~(l/o)*o)),t._pt=d=new Te(t._pt,e,i,s,l,GE),d.e=u,d.u="deg",t._props.push(i),d},Y0=function(t,e){for(var i in e)t[i]=e[i];return t},$E=function(t,e,i){var s=Y0({},i._gsap),n="perspective,force3D,transformOrigin,svgOrigin",o=i.style,a,h,l,u,c,d,p,m;s.svg?(l=i.getAttribute("transform"),i.setAttribute("transform",""),o[Wt]=e,a=co(i,1),lo(i,Wt),i.setAttribute("transform",l)):(l=getComputedStyle(i)[Wt],o[Wt]=e,a=co(i,1),o[Wt]=l);for(h in rr)l=s[h],u=a[h],l!==u&&n.indexOf(h)<0&&(p=pe(l),m=pe(u),c=p!==m?Lr(i,h,l,m):parseFloat(l),d=parseFloat(u),t._pt=new Te(t._pt,a,h,c,d-c,Fc),t._pt.u=m||0,t._props.push(h));Y0(a,s)};_e("padding,margin,Width,Radius",function(r,t){var e="Top",i="Right",s="Bottom",n="Left",o=(t<3?[e,i,s,n]:[e+n,e+i,s+i,s+n]).map(function(a){return t<2?r+a:"border"+a+r});ch[t>1?"border"+r:r]=function(a,h,l,u,c){var d,p;if(arguments.length<4)return d=o.map(function(m){return sr(a,m,l)}),p=d.join(" "),p.split(d[0]).length===5?d[0]:p;d=(u+"").split(" "),p={},o.forEach(function(m,f){return p[m]=d[f]=d[f]||d[(f-1)/2|0]}),a.init(h,p,c)}});var z0={name:"css",register:kc,targetTest:function(t){return t.style&&t.nodeType},init:function(t,e,i,s,n){var o=this._props,a=t.style,h=i.vars.startAt,l,u,c,d,p,m,f,g,y,_,x,v,S,C,A,I;Lc||kc(),this.styles=this.styles||F0(t),I=this.styles.props,this.tween=i;for(f in e)if(f!=="autoRound"&&(u=e[f],!(Re[f]&&_0(f,e,i,s,t,n)))){if(p=typeof u,m=ch[f],p==="function"&&(u=u.call(i,s,t,n),p=typeof u),p==="string"&&~u.indexOf("random(")&&(u=ro(u)),m)m(this,t,f,u,i)&&(A=1);else if(f.substr(0,2)==="--")l=(getComputedStyle(t).getPropertyValue(f)+"").trim(),u+="",Ar.lastIndex=0,Ar.test(l)||(g=pe(l),y=pe(u)),y?g!==y&&(l=Lr(t,f,l,y)+y):g&&(u+=g),this.add(a,"setProperty",l,u,s,n,0,0,f),o.push(f),I.push(f,0,a[f]);else if(p!=="undefined"){if(h&&f in h?(l=typeof h[f]=="function"?h[f].call(i,s,t,n):h[f],re(l)&&~l.indexOf("random(")&&(l=ro(l)),pe(l+"")||(l+=Ae.units[f]||pe(sr(t,f))||""),(l+"").charAt(1)==="="&&(l=sr(t,f))):l=sr(t,f),d=parseFloat(l),_=p==="string"&&u.charAt(1)==="="&&u.substr(0,2),_&&(u=u.substr(2)),c=parseFloat(u),f in Ri&&(f==="autoAlpha"&&(d===1&&sr(t,"visibility")==="hidden"&&c&&(d=0),I.push("visibility",0,a.visibility),Pr(this,a,"visibility",d?"inherit":"hidden",c?"inherit":"hidden",!c)),f!=="scale"&&f!=="transform"&&(f=Ri[f],~f.indexOf(",")&&(f=f.split(",")[0]))),x=f in rr,x){if(this.styles.save(f),v||(S=t._gsap,S.renderTransform&&!e.parseTransform||co(t,e.parseTransform),C=e.smoothOrigin!==!1&&S.smooth,v=this._pt=new Te(this._pt,a,Wt,0,1,S.renderTransform,S,0,-1),v.dep=1),f==="scale")this._pt=new Te(this._pt,S,"scaleY",S.scaleY,(_?$s(S.scaleY,_+c):c)-S.scaleY||0,Fc),this._pt.u=0,o.push("scaleY",f),f+="X";else if(f==="transformOrigin"){I.push(hi,0,a[hi]),u=KE(u),S.svg?Wc(t,u,0,C,0,this):(y=parseFloat(u.split(" ")[2])||0,y!==S.zOrigin&&Pr(this,S,"zOrigin",S.zOrigin,y),Pr(this,a,f,dh(l),dh(u)));continue}else if(f==="svgOrigin"){Wc(t,u,1,C,0,this);continue}else if(f in Z0){JE(this,S,f,d,_?$s(d,_+u):u);continue}else if(f==="smoothOrigin"){Pr(this,S,"smooth",S.smooth,u);continue}else if(f==="force3D"){S[f]=u;continue}else if(f==="transform"){$E(this,u,t);continue}}else f in a||(f=on(f)||f);if(x||(c||c===0)&&(d||d===0)&&!LE.test(u)&&f in a)g=(l+"").substr((d+"").length),c||(c=0),y=pe(u)||(f in Ae.units?Ae.units[f]:g),g!==y&&(d=Lr(t,f,l,y)),this._pt=new Te(this._pt,x?S:a,f,d,(_?$s(d,_+c):c)-d,!x&&(y==="px"||f==="zIndex")&&e.autoRound!==!1?FE:Fc),this._pt.u=y||0,g!==y&&y!=="%"&&(this._pt.b=l,this._pt.r=NE);else if(f in a)HE.call(this,t,f,l,_?_+u:u);else if(f in t)this.add(t,f,l||t[f],_?_+u:u,s,n);else if(f!=="parseTransform"){lc(f,u);continue}x||(f in a?I.push(f,0,a[f]):I.push(f,1,l||t[f])),o.push(f)}}A&&C0(this)},render:function(t,e){if(e.tween._time||!Gc())for(var i=e._pt;i;)i.r(t,i.d),i=i._next;else e.styles.revert()},get:sr,aliases:Ri,getSetter:function(t,e,i){var s=Ri[e];return s&&s.indexOf(",")<0&&(e=s),e in rr&&e!==hi&&(t._gsap.x||sr(t,"x"))?i&&R0===i?e==="scale"?BE:OE:(R0=i||{})&&(e==="scale"?WE:UE):t.style&&!rc(t.style[e])?DE:~e.indexOf("-")?kE:Ic(t,e)},core:{_removeProperty:lo,_getMatrix:Bc}};we.utils.checkPrefix=on,we.core.getStyleSaver=F0,function(r,t,e,i){var s=_e(r+","+t+","+e,function(n){rr[n]=1});_e(t,function(n){Ae.units[n]="deg",Z0[n]=1}),Ri[s[13]]=r+","+t,_e(i,function(n){var o=n.split(":");Ri[o[1]]=s[o[0]]})}("x,y,z,scale,scaleX,scaleY,xPercent,yPercent","rotation,rotationX,rotationY,skewX,skewY","transform,transformOrigin,svgOrigin,force3D,smoothOrigin,transformPerspective","0:translateX,1:translateY,2:translateZ,8:rotate,8:rotationZ,8:rotateZ,9:rotateX,10:rotateY"),_e("x,y,z,top,right,bottom,left,width,height,fontSize,padding,margin,perspective",function(r){Ae.units[r]="px"}),we.registerPlugin(z0);var j0=we.registerPlugin(z0)||we;j0.core.Tween;const ps=new ct;class QE{constructor(t={}){this._recursive=typeof t.recursive=="boolean"?t.recursive:!0,this._toggle=t.toggle||"visible",this._targetList=new Set}add(t){return this._targetList.add(t),this}addAll(t){for(let e=0,i=t.length;e<i;e++)this._targetList.add(t[e]);return this}remove(t){return this._targetList.delete(t),this}removeAll(t){for(let e=0,i=t.length;e<i;e++)this._targetList.delete(t[e]);return this}clear(){return this._targetList.clear(),this}cull(t,e=!1){return e||this.uncull(),this._targetList.forEach(i=>{e||i.getBounds(!1,ps),this._recursive?this.cullRecursive(t,i,e):(e&&i._bounds.getRectangle(t),i[this._toggle]=ps.right>t.left&&ps.left<t.right&&ps.bottom>t.top&&ps.top<t.bottom)}),this}uncull(){return this._targetList.forEach(t=>{this._recursive?this.uncullRecursive(t):t[this._toggle]=!1}),this}cullRecursive(t,e,i){const s=i?e._bounds.getRectangle(ps):e.getBounds(!0,ps);if(e[this._toggle]=s.right>t.left&&s.left<t.right&&s.bottom>t.top&&s.top<t.bottom,!(s.left>=t.left&&s.top>=t.top&&s.right<=t.right&&s.bottom<=t.bottom)&&e[this._toggle]&&e.children&&e.children.length){const o=e.children;for(let a=0,h=o.length;a<h;a++)this.cullRecursive(t,o[a])}}uncullRecursive(t){if(t[this._toggle]=!0,t.children&&t.children.length){const e=t.children;for(let i=0,s=e.length;i<s;i++)this.uncullRecursive(e[i])}}}let Li=null;const J0=new ResizeObserver(()=>{Li&&Ct.emit("stageUpdated",Li)});function qE(r){Li=r,J0.observe(Li),Ct.emit("stageCreated",Li)}function tC(){Li&&J0.unobserve(Li),Li=null}async function Xc(){return Li||await Be("stageCreated")}let Le=null;async function eC(){const r=await Xc();rC(r),Ct.on("stageUpdated",sC)}function iC(){Le&&(Le.destroy(!0,{children:!0}),Le=null)}function rC(r){Le=new Km({backgroundAlpha:0,resizeTo:r,antialias:!0,resolution:window.devicePixelRatio}),Le.stage.sortableChildren=!0,r.appendChild(Le.view),Ct.emit("applicationCreated",Le),process.env.NODE_ENV==="development"&&(globalThis.__PIXI_APP__=Le)}async function li(){return Le||await Be("applicationCreated")}function sC(r){Le&&(Le.resizeTo=r,Ct.emit("applicationResized",Le))}var ph={exports:{}};ph.exports,function(r,t){var e=200,i="__lodash_hash_undefined__",s=1,n=2,o=9007199254740991,a="[object Arguments]",h="[object Array]",l="[object AsyncFunction]",u="[object Boolean]",c="[object Date]",d="[object Error]",p="[object Function]",m="[object GeneratorFunction]",f="[object Map]",g="[object Number]",y="[object Null]",_="[object Object]",x="[object Promise]",v="[object Proxy]",S="[object RegExp]",C="[object Set]",A="[object String]",I="[object Symbol]",L="[object Undefined]",k="[object WeakMap]",M="[object ArrayBuffer]",G="[object DataView]",E="[object Float32Array]",N="[object Float64Array]",O="[object Int8Array]",Z="[object Int16Array]",U="[object Int32Array]",K="[object Uint8Array]",ht="[object Uint8ClampedArray]",X="[object Uint16Array]",W="[object Uint32Array]",j=/[\\^$.*+?()[\]{}|]/g,q=/^\[object .+?Constructor\]$/,pt=/^(?:0|[1-9]\d*)$/,at={};at[E]=at[N]=at[O]=at[Z]=at[U]=at[K]=at[ht]=at[X]=at[W]=!0,at[a]=at[h]=at[M]=at[u]=at[G]=at[c]=at[d]=at[p]=at[f]=at[g]=at[_]=at[S]=at[C]=at[A]=at[k]=!1;var It=typeof qe=="object"&&qe&&qe.Object===Object&&qe,Nt=typeof self=="object"&&self&&self.Object===Object&&self,wt=It||Nt||Function("return this")(),Y=t&&!t.nodeType&&t,et=Y&&!0&&r&&!r.nodeType&&r,Q=et&&et.exports===Y,F=Q&&It.process,yt=function(){try{return F&&F.binding&&F.binding("util")}catch{}}(),mt=yt&&yt.isTypedArray;function Mt(T,R){for(var b=-1,w=T==null?0:T.length,P=0,B=[];++b<w;){var ot=T[b];R(ot,b,T)&&(B[P++]=ot)}return B}function Ut(T,R){for(var b=-1,w=R.length,P=T.length;++b<w;)T[P+b]=R[b];return T}function Fe(T,R){for(var b=-1,w=T==null?0:T.length;++b<w;)if(R(T[b],b,T))return!0;return!1}function ci(T,R){for(var b=-1,w=Array(T);++b<T;)w[b]=R(b);return w}function Sd(T){return function(R){return T(R)}}function gn(T,R){return T.has(R)}function Io(T,R){return T==null?void 0:T[R]}function yn(T){var R=-1,b=Array(T.size);return T.forEach(function(w,P){b[++R]=[P,w]}),b}function di(T,R){return function(b){return T(R(b))}}function kh(T){var R=-1,b=Array(T.size);return T.forEach(function(w){b[++R]=w}),b}var Oh=Array.prototype,Ed=Function.prototype,bn=Object.prototype,Nr=wt["__core-js_shared__"],Ao=Ed.toString,De=bn.hasOwnProperty,Mo=function(){var T=/[^.]+$/.exec(Nr&&Nr.keys&&Nr.keys.IE_PROTO||"");return T?"Symbol(src)_1."+T:""}(),Ro=bn.toString,Bh=RegExp("^"+Ao.call(De).replace(j,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Wh=Q?wt.Buffer:void 0,xn=wt.Symbol,ki=wt.Uint8Array,vs=bn.propertyIsEnumerable,Cd=Oh.splice,Oi=xn?xn.toStringTag:void 0,Uh=Object.getOwnPropertySymbols,Xh=Wh?Wh.isBuffer:void 0,Ts=di(Object.keys,Object),Po=cr(wt,"DataView"),ke=cr(wt,"Map"),Lo=cr(wt,"Promise"),Go=cr(wt,"Set"),No=cr(wt,"WeakMap"),ws=cr(Object,"create"),Id=fi(Po),pi=fi(ke),Ad=fi(Lo),Md=fi(Go),Rd=fi(No),Zh=xn?xn.prototype:void 0,Fo=Zh?Zh.valueOf:void 0;function Ee(T){var R=-1,b=T==null?0:T.length;for(this.clear();++R<b;){var w=T[R];this.set(w[0],w[1])}}function Pd(){this.__data__=ws?ws(null):{},this.size=0}function Ld(T){var R=this.has(T)&&delete this.__data__[T];return this.size-=R?1:0,R}function Gd(T){var R=this.__data__;if(ws){var b=R[T];return b===i?void 0:b}return De.call(R,T)?R[T]:void 0}function Nd(T){var R=this.__data__;return ws?R[T]!==void 0:De.call(R,T)}function Fd(T,R){var b=this.__data__;return this.size+=this.has(T)?0:1,b[T]=ws&&R===void 0?i:R,this}Ee.prototype.clear=Pd,Ee.prototype.delete=Ld,Ee.prototype.get=Gd,Ee.prototype.has=Nd,Ee.prototype.set=Fd;function fe(T){var R=-1,b=T==null?0:T.length;for(this.clear();++R<b;){var w=T[R];this.set(w[0],w[1])}}function Dd(){this.__data__=[],this.size=0}function kd(T){var R=this.__data__,b=vn(R,T);if(b<0)return!1;var w=R.length-1;return b==w?R.pop():Cd.call(R,b,1),--this.size,!0}function Od(T){var R=this.__data__,b=vn(R,T);return b<0?void 0:R[b][1]}function Bd(T){return vn(this.__data__,T)>-1}function Wd(T,R){var b=this.__data__,w=vn(b,T);return w<0?(++this.size,b.push([T,R])):b[w][1]=R,this}fe.prototype.clear=Dd,fe.prototype.delete=kd,fe.prototype.get=Od,fe.prototype.has=Bd,fe.prototype.set=Wd;function lr(T){var R=-1,b=T==null?0:T.length;for(this.clear();++R<b;){var w=T[R];this.set(w[0],w[1])}}function Do(){this.size=0,this.__data__={hash:new Ee,map:new(ke||fe),string:new Ee}}function Ud(T){var R=wn(this,T).delete(T);return this.size-=R?1:0,R}function _n(T){return wn(this,T).get(T)}function ko(T){return wn(this,T).has(T)}function Xd(T,R){var b=wn(this,T),w=b.size;return b.set(T,R),this.size+=b.size==w?0:1,this}lr.prototype.clear=Do,lr.prototype.delete=Ud,lr.prototype.get=_n,lr.prototype.has=ko,lr.prototype.set=Xd;function ur(T){var R=-1,b=T==null?0:T.length;for(this.__data__=new lr;++R<b;)this.add(T[R])}function Vh(T){return this.__data__.set(T,i),this}function Zd(T){return this.__data__.has(T)}ur.prototype.add=ur.prototype.push=Vh,ur.prototype.has=Zd;function Bi(T){var R=this.__data__=new fe(T);this.size=R.size}function Vd(){this.__data__=new fe,this.size=0}function Hh(T){var R=this.__data__,b=R.delete(T);return this.size=R.size,b}function Hd(T){return this.__data__.get(T)}function Kd(T){return this.__data__.has(T)}function Yd(T,R){var b=this.__data__;if(b instanceof fe){var w=b.__data__;if(!ke||w.length<e-1)return w.push([T,R]),this.size=++b.size,this;b=this.__data__=new lr(w)}return b.set(T,R),this.size=b.size,this}Bi.prototype.clear=Vd,Bi.prototype.delete=Hh,Bi.prototype.get=Hd,Bi.prototype.has=Kd,Bi.prototype.set=Yd;function zd(T,R){var b=Cn(T),w=!b&&Wo(T),P=!b&&!w&&Es(T),B=!b&&!w&&!P&&tl(T),ot=b||w||P||B,dt=ot?ci(T.length,String):[],gt=dt.length;for(var st in T)(R||De.call(T,st))&&!(ot&&(st=="length"||P&&(st=="offset"||st=="parent")||B&&(st=="buffer"||st=="byteLength"||st=="byteOffset")||Bo(st,gt)))&&dt.push(st);return dt}function vn(T,R){for(var b=T.length;b--;)if(En(T[b][0],R))return b;return-1}function jd(T,R,b){var w=R(T);return Cn(T)?w:Ut(w,b(T))}function Ss(T){return T==null?T===void 0?L:y:Oi&&Oi in Object(T)?qd(T):Sn(T)}function Kh(T){return Dr(T)&&Ss(T)==a}function Yh(T,R,b,w,P){return T===R?!0:T==null||R==null||!Dr(T)&&!Dr(R)?T!==T&&R!==R:Jd(T,R,b,w,Yh,P)}function Jd(T,R,b,w,P,B){var ot=Cn(T),dt=Cn(R),gt=ot?h:Wi(T),st=dt?h:Wi(R);gt=gt==a?_:gt,st=st==a?_:st;var bt=gt==_,Ft=st==_,At=gt==st;if(At&&Es(T)){if(!Es(R))return!1;ot=!0,bt=!1}if(At&&!bt)return B||(B=new Bi),ot||tl(T)?zh(T,R,b,w,P,B):jh(T,R,gt,b,w,P,B);if(!(b&s)){var ne=bt&&De.call(T,"__wrapped__"),me=Ft&&De.call(R,"__wrapped__");if(ne||me){var $e=ne?T.value():T,Qe=me?R.value():R;return B||(B=new Bi),P($e,Qe,b,w,B)}}return At?(B||(B=new Bi),Qd(T,R,b,w,P,B)):!1}function Tn(T){if(!qh(T)||ip(T))return!1;var R=Ui(T)?Bh:q;return R.test(fi(T))}function Oo(T){return Dr(T)&&Fr(T.length)&&!!at[Ss(T)]}function $d(T){if(!rp(T))return Ts(T);var R=[];for(var b in Object(T))De.call(T,b)&&b!="constructor"&&R.push(b);return R}function zh(T,R,b,w,P,B){var ot=b&s,dt=T.length,gt=R.length;if(dt!=gt&&!(ot&>>dt))return!1;var st=B.get(T);if(st&&B.get(R))return st==R;var bt=-1,Ft=!0,At=b&n?new ur:void 0;for(B.set(T,R),B.set(R,T);++bt<dt;){var ne=T[bt],me=R[bt];if(w)var $e=ot?w(me,ne,bt,R,T,B):w(ne,me,bt,T,R,B);if($e!==void 0){if($e)continue;Ft=!1;break}if(At){if(!Fe(R,function(Qe,Cs){if(!gn(At,Cs)&&(ne===Qe||P(ne,Qe,b,w,B)))return At.push(Cs)})){Ft=!1;break}}else if(!(ne===me||P(ne,me,b,w,B))){Ft=!1;break}}return B.delete(T),B.delete(R),Ft}function jh(T,R,b,w,P,B,ot){switch(b){case G:if(T.byteLength!=R.byteLength||T.byteOffset!=R.byteOffset)return!1;T=T.buffer,R=R.buffer;case M:return!(T.byteLength!=R.byteLength||!B(new ki(T),new ki(R)));case u:case c:case g:return En(+T,+R);case d:return T.name==R.name&&T.message==R.message;case S:case A:return T==R+"";case f:var dt=yn;case C:var gt=w&s;if(dt||(dt=kh),T.size!=R.size&&!gt)return!1;var st=ot.get(T);if(st)return st==R;w|=n,ot.set(T,R);var bt=zh(dt(T),dt(R),w,P,B,ot);return ot.delete(T),bt;case I:if(Fo)return Fo.call(T)==Fo.call(R)}return!1}function Qd(T,R,b,w,P,B){var ot=b&s,dt=Jh(T),gt=dt.length,st=Jh(R),bt=st.length;if(gt!=bt&&!ot)return!1;for(var Ft=gt;Ft--;){var At=dt[Ft];if(!(ot?At in R:De.call(R,At)))return!1}var ne=B.get(T);if(ne&&B.get(R))return ne==R;var me=!0;B.set(T,R),B.set(R,T);for(var $e=ot;++Ft<gt;){At=dt[Ft];var Qe=T[At],Cs=R[At];if(w)var bb=ot?w(Cs,Qe,At,R,T,B):w(Qe,Cs,At,T,R,B);if(!(bb===void 0?Qe===Cs||P(Qe,Cs,b,w,B):bb)){me=!1;break}$e||($e=At=="constructor")}if(me&&!$e){var il=T.constructor,rl=R.constructor;il!=rl&&"constructor"in T&&"constructor"in R&&!(typeof il=="function"&&il instanceof il&&typeof rl=="function"&&rl instanceof rl)&&(me=!1)}return B.delete(T),B.delete(R),me}function Jh(T){return jd(T,el,tp)}function wn(T,R){var b=T.__data__;return ep(R)?b[typeof R=="string"?"string":"hash"]:b.map}function cr(T,R){var b=Io(T,R);return Tn(b)?b:void 0}function qd(T){var R=De.call(T,Oi),b=T[Oi];try{T[Oi]=void 0;var w=!0}catch{}var P=Ro.call(T);return w&&(R?T[Oi]=b:delete T[Oi]),P}var tp=Uh?function(T){return T==null?[]:(T=Object(T),Mt(Uh(T),function(R){return vs.call(T,R)}))}:sp,Wi=Ss;(Po&&Wi(new Po(new ArrayBuffer(1)))!=G||ke&&Wi(new ke)!=f||Lo&&Wi(Lo.resolve())!=x||Go&&Wi(new Go)!=C||No&&Wi(new No)!=k)&&(Wi=function(T){var R=Ss(T),b=R==_?T.constructor:void 0,w=b?fi(b):"";if(w)switch(w){case Id:return G;case pi:return f;case Ad:return x;case Md:return C;case Rd:return k}return R});function Bo(T,R){return R=R??o,!!R&&(typeof T=="number"||pt.test(T))&&T>-1&&T%1==0&&T<R}function ep(T){var R=typeof T;return R=="string"||R=="number"||R=="symbol"||R=="boolean"?T!=="__proto__":T===null}function ip(T){return!!Mo&&Mo in T}function rp(T){var R=T&&T.constructor,b=typeof R=="function"&&R.prototype||bn;return T===b}function Sn(T){return Ro.call(T)}function fi(T){if(T!=null){try{return Ao.call(T)}catch{}try{return T+""}catch{}}return""}function En(T,R){return T===R||T!==T&&R!==R}var Wo=Kh(function(){return arguments}())?Kh:function(T){return Dr(T)&&De.call(T,"callee")&&!vs.call(T,"callee")},Cn=Array.isArray;function $h(T){return T!=null&&Fr(T.length)&&!Ui(T)}var Es=Xh||np;function Qh(T,R){return Yh(T,R)}function Ui(T){if(!qh(T))return!1;var R=Ss(T);return R==p||R==m||R==l||R==v}function Fr(T){return typeof T=="number"&&T>-1&&T%1==0&&T<=o}function qh(T){var R=typeof T;return T!=null&&(R=="object"||R=="function")}function Dr(T){return T!=null&&typeof T=="object"}var tl=mt?Sd(mt):Oo;function el(T){return $h(T)?zd(T):$d(T)}function sp(){return[]}function np(){return!1}r.exports=Qh}(ph,ph.exports);var nC=ph.exports;const $0=Ln(nC);var oC=Object.defineProperty,aC=(r,t,e)=>t in r?oC(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,D=(r,t,e)=>(aC(r,typeof t!="symbol"?t+"":t,e),e);class je{constructor(t){D(this,"parent"),D(this,"paused"),this.parent=t,this.paused=!1}destroy(){}down(t){return!1}move(t){return!1}up(t){return!1}wheel(t){return!1}update(t){}resize(){}reset(){}pause(){this.paused=!0}resume(){this.paused=!1}}var hC=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},Q0={exports:{}};(function(r,t){(function(){var e,i;i=function(s){return r.exports=s},e={linear:function(s,n,o,a){return o*s/a+n},easeInQuad:function(s,n,o,a){return o*(s/=a)*s+n},easeOutQuad:function(s,n,o,a){return-o*(s/=a)*(s-2)+n},easeInOutQuad:function(s,n,o,a){return(s/=a/2)<1?o/2*s*s+n:-o/2*(--s*(s-2)-1)+n},easeInCubic:function(s,n,o,a){return o*(s/=a)*s*s+n},easeOutCubic:function(s,n,o,a){return o*((s=s/a-1)*s*s+1)+n},easeInOutCubic:function(s,n,o,a){return(s/=a/2)<1?o/2*s*s*s+n:o/2*((s-=2)*s*s+2)+n},easeInQuart:function(s,n,o,a){return o*(s/=a)*s*s*s+n},easeOutQuart:function(s,n,o,a){return-o*((s=s/a-1)*s*s*s-1)+n},easeInOutQuart:function(s,n,o,a){return(s/=a/2)<1?o/2*s*s*s*s+n:-o/2*((s-=2)*s*s*s-2)+n},easeInQuint:function(s,n,o,a){return o*(s/=a)*s*s*s*s+n},easeOutQuint:function(s,n,o,a){return o*((s=s/a-1)*s*s*s*s+1)+n},easeInOutQuint:function(s,n,o,a){return(s/=a/2)<1?o/2*s*s*s*s*s+n:o/2*((s-=2)*s*s*s*s+2)+n},easeInSine:function(s,n,o,a){return-o*Math.cos(s/a*(Math.PI/2))+o+n},easeOutSine:function(s,n,o,a){return o*Math.sin(s/a*(Math.PI/2))+n},easeInOutSine:function(s,n,o,a){return-o/2*(Math.cos(Math.PI*s/a)-1)+n},easeInExpo:function(s,n,o,a){return s===0?n:o*Math.pow(2,10*(s/a-1))+n},easeOutExpo:function(s,n,o,a){return s===a?n+o:o*(-Math.pow(2,-10*s/a)+1)+n},easeInOutExpo:function(s,n,o,a){return(s/=a/2)<1?o/2*Math.pow(2,10*(s-1))+n:o/2*(-Math.pow(2,-10*--s)+2)+n},easeInCirc:function(s,n,o,a){return-o*(Math.sqrt(1-(s/=a)*s)-1)+n},easeOutCirc:function(s,n,o,a){return o*Math.sqrt(1-(s=s/a-1)*s)+n},easeInOutCirc:function(s,n,o,a){return(s/=a/2)<1?-o/2*(Math.sqrt(1-s*s)-1)+n:o/2*(Math.sqrt(1-(s-=2)*s)+1)+n},easeInElastic:function(s,n,o,a){var h,l,u;return u=1.70158,l=0,h=o,s===0||(s/=a),l||(l=a*.3),h<Math.abs(o)?(h=o,u=l/4):u=l/(2*Math.PI)*Math.asin(o/h),-(h*Math.pow(2,10*(s-=1))*Math.sin((s*a-u)*(2*Math.PI)/l))+n},easeOutElastic:function(s,n,o,a){var h,l,u;return u=1.70158,l=0,h=o,s===0||(s/=a),l||(l=a*.3),h<Math.abs(o)?(h=o,u=l/4):u=l/(2*Math.PI)*Math.asin(o/h),h*Math.pow(2,-10*s)*Math.sin((s*a-u)*(2*Math.PI)/l)+o+n},easeInOutElastic:function(s,n,o,a){var h,l,u;return u=1.70158,l=0,h=o,s===0||(s/=a/2),l||(l=a*(.3*1.5)),h<Math.abs(o)?(h=o,u=l/4):u=l/(2*Math.PI)*Math.asin(o/h),s<1?-.5*(h*Math.pow(2,10*(s-=1))*Math.sin((s*a-u)*(2*Math.PI)/l))+n:h*Math.pow(2,-10*(s-=1))*Math.sin((s*a-u)*(2*Math.PI)/l)*.5+o+n},easeInBack:function(s,n,o,a,h){return h===void 0&&(h=1.70158),o*(s/=a)*s*((h+1)*s-h)+n},easeOutBack:function(s,n,o,a,h){return h===void 0&&(h=1.70158),o*((s=s/a-1)*s*((h+1)*s+h)+1)+n},easeInOutBack:function(s,n,o,a,h){return h===void 0&&(h=1.70158),(s/=a/2)<1?o/2*(s*s*(((h*=1.525)+1)*s-h))+n:o/2*((s-=2)*s*(((h*=1.525)+1)*s+h)+2)+n},easeInBounce:function(s,n,o,a){var h;return h=e.easeOutBounce(a-s,0,o,a),o-h+n},easeOutBounce:function(s,n,o,a){return(s/=a)<1/2.75?o*(7.5625*s*s)+n:s<2/2.75?o*(7.5625*(s-=1.5/2.75)*s+.75)+n:s<2.5/2.75?o*(7.5625*(s-=2.25/2.75)*s+.9375)+n:o*(7.5625*(s-=2.625/2.75)*s+.984375)+n},easeInOutBounce:function(s,n,o,a){var h;return s<a/2?(h=e.easeInBounce(s*2,0,o,a),h*.5+n):(h=e.easeOutBounce(s*2-a,0,o,a),h*.5+o*.5+n)}},i(e)}).call(hC)})(Q0);const q0=Q0.exports;function fh(r,t){if(r){if(typeof r=="function")return r;if(typeof r=="string")return q0[r]}else return q0[t]}const lC={removeOnInterrupt:!1,ease:"linear",time:1e3};class uC extends je{constructor(t,e={}){super(t),D(this,"options"),D(this,"startX"),D(this,"startY"),D(this,"deltaX"),D(this,"deltaY"),D(this,"keepCenter"),D(this,"startWidth",null),D(this,"startHeight",null),D(this,"deltaWidth",null),D(this,"deltaHeight",null),D(this,"width",null),D(this,"height",null),D(this,"time",0),this.options=Object.assign({},lC,e),this.options.ease=fh(this.options.ease),this.setupPosition(),this.setupZoom(),this.time=0}setupPosition(){typeof this.options.position<"u"?(this.startX=this.parent.center.x,this.startY=this.parent.center.y,this.deltaX=this.options.position.x-this.parent.center.x,this.deltaY=this.options.position.y-this.parent.center.y,this.keepCenter=!1):this.keepCenter=!0}setupZoom(){this.width=null,this.height=null,typeof this.options.scale<"u"?this.width=this.parent.screenWidth/this.options.scale:typeof this.options.scaleX<"u"||typeof this.options.scaleY<"u"?(typeof this.options.scaleX<"u"&&(this.width=this.parent.screenWidth/this.options.scaleX),typeof this.options.scaleY<"u"&&(this.height=this.parent.screenHeight/this.options.scaleY)):(typeof this.options.width<"u"&&(this.width=this.options.width),typeof this.options.height<"u"&&(this.height=this.options.height)),this.width!==null&&(this.startWidth=this.parent.screenWidthInWorldPixels,this.deltaWidth=this.width-this.startWidth),this.height!==null&&(this.startHeight=this.parent.screenHeightInWorldPixels,this.deltaHeight=this.height-this.startHeight)}down(){return this.options.removeOnInterrupt&&this.parent.plugins.remove("animate"),!1}complete(){this.parent.plugins.remove("animate"),this.width!==null&&this.parent.fitWidth(this.width,this.keepCenter,this.height===null),this.height!==null&&this.parent.fitHeight(this.height,this.keepCenter,this.width===null),!this.keepCenter&&this.options.position&&this.parent.moveCenter(this.options.position),this.parent.emit("animate-end",this.parent),this.options.callbackOnComplete&&this.options.callbackOnComplete(this.parent)}update(t){if(this.paused)return;this.time+=t;const e=new lt(this.parent.scale.x,this.parent.scale.y);if(this.time>=this.options.time){const i=this.parent.width,s=this.parent.height;this.complete(),(i!==this.parent.width||s!==this.parent.height)&&this.parent.emit("zoomed",{viewport:this.parent,original:e,type:"animate"})}else{const i=this.options.ease(this.time,0,1,this.options.time);if(this.width!==null){const s=this.startWidth,n=this.deltaWidth;this.parent.fitWidth(s+n*i,this.keepCenter,this.height===null)}if(this.height!==null){const s=this.startHeight,n=this.deltaHeight;this.parent.fitHeight(s+n*i,this.keepCenter,this.width===null)}if(this.width===null?this.parent.scale.x=this.parent.scale.y:this.height===null&&(this.parent.scale.y=this.parent.scale.x),!this.keepCenter){const s=this.startX,n=this.startY,o=this.deltaX,a=this.deltaY,h=new lt(this.parent.x,this.parent.y);this.parent.moveCenter(s+o*i,n+a*i),this.parent.emit("moved",{viewport:this.parent,original:h,type:"animate"})}(this.width||this.height)&&this.parent.emit("zoomed",{viewport:this.parent,original:e,type:"animate"})}}}const cC={sides:"all",friction:.5,time:150,ease:"easeInOutSine",underflow:"center",bounceBox:null};class dC extends je{constructor(t,e={}){super(t),D(this,"options"),D(this,"left"),D(this,"top"),D(this,"right"),D(this,"bottom"),D(this,"underflowX"),D(this,"underflowY"),D(this,"ease"),D(this,"toX"),D(this,"toY"),this.options=Object.assign({},cC,e),this.ease=fh(this.options.ease,"easeInOutSine"),this.options.sides?this.options.sides==="all"?this.top=this.bottom=this.left=this.right=!0:this.options.sides==="horizontal"?(this.right=this.left=!0,this.top=this.bottom=!1):this.options.sides==="vertical"?(this.left=this.right=!1,this.top=this.bottom=!0):(this.top=this.options.sides.indexOf("top")!==-1,this.bottom=this.options.sides.indexOf("bottom")!==-1,this.left=this.options.sides.indexOf("left")!==-1,this.right=this.options.sides.indexOf("right")!==-1):this.left=this.top=this.right=this.bottom=!1;const i=this.options.underflow.toLowerCase();i==="center"?(this.underflowX=0,this.underflowY=0):(this.underflowX=i.indexOf("left")!==-1?-1:i.indexOf("right")!==-1?1:0,this.underflowY=i.indexOf("top")!==-1?-1:i.indexOf("bottom")!==-1?1:0),this.reset()}isActive(){return this.toX!==null||this.toY!==null}down(){return this.toX=this.toY=null,!1}up(){return this.bounce(),!1}update(t){if(!this.paused){if(this.bounce(),this.toX){const e=this.toX;e.time+=t,this.parent.emit("moved",{viewport:this.parent,type:"bounce-x"}),e.time>=this.options.time?(this.parent.x=e.end,this.toX=null,this.parent.emit("bounce-x-end",this.parent)):this.parent.x=this.ease(e.time,e.start,e.delta,this.options.time)}if(this.toY){const e=this.toY;e.time+=t,this.parent.emit("moved",{viewport:this.parent,type:"bounce-y"}),e.time>=this.options.time?(this.parent.y=e.end,this.toY=null,this.parent.emit("bounce-y-end",this.parent)):this.parent.y=this.ease(e.time,e.start,e.delta,this.options.time)}}}calcUnderflowX(){let t;switch(this.underflowX){case-1:t=0;break;case 1:t=this.parent.screenWidth-this.parent.screenWorldWidth;break;default:t=(this.parent.screenWidth-this.parent.screenWorldWidth)/2}return t}calcUnderflowY(){let t;switch(this.underflowY){case-1:t=0;break;case 1:t=this.parent.screenHeight-this.parent.screenWorldHeight;break;default:t=(this.parent.screenHeight-this.parent.screenWorldHeight)/2}return t}oob(){const t=this.options.bounceBox;if(t){const e=typeof t.x>"u"?0:t.x,i=typeof t.y>"u"?0:t.y,s=typeof t.width>"u"?this.parent.worldWidth:t.width,n=typeof t.height>"u"?this.parent.worldHeight:t.height;return{left:this.parent.left<e,right:this.parent.right>s,top:this.parent.top<i,bottom:this.parent.bottom>n,topLeft:new lt(e*this.parent.scale.x,i*this.parent.scale.y),bottomRight:new lt(s*this.parent.scale.x-this.parent.screenWidth,n*this.parent.scale.y-this.parent.screenHeight)}}return{left:this.parent.left<0,right:this.parent.right>this.parent.worldWidth,top:this.parent.top<0,bottom:this.parent.bottom>this.parent.worldHeight,topLeft:new lt(0,0),bottomRight:new lt(this.parent.worldWidth*this.parent.scale.x-this.parent.screenWidth,this.parent.worldHeight*this.parent.scale.y-this.parent.screenHeight)}}bounce(){var t,e;if(this.paused)return;let i,s=this.parent.plugins.get("decelerate",!0);s&&(s.x||s.y)&&(s.x&&s.percentChangeX===((t=s.options)==null?void 0:t.friction)||s.y&&s.percentChangeY===((e=s.options)==null?void 0:e.friction))&&(i=this.oob(),(i.left&&this.left||i.right&&this.right)&&(s.percentChangeX=this.options.friction),(i.top&&this.top||i.bottom&&this.bottom)&&(s.percentChangeY=this.options.friction));const n=this.parent.plugins.get("drag",!0)||{},o=this.parent.plugins.get("pinch",!0)||{};if(s=s||{},!(n!=null&&n.active)&&!(o!=null&&o.active)&&(!this.toX||!this.toY)&&(!s.x||!s.y)){i=i||this.oob();const a=i.topLeft,h=i.bottomRight;if(!this.toX&&!s.x){let l=null;i.left&&this.left?l=this.parent.screenWorldWidth<this.parent.screenWidth?this.calcUnderflowX():-a.x:i.right&&this.right&&(l=this.parent.screenWorldWidth<this.parent.screenWidth?this.calcUnderflowX():-h.x),l!==null&&this.parent.x!==l&&(this.toX={time:0,start:this.parent.x,delta:l-this.parent.x,end:l},this.parent.emit("bounce-x-start",this.parent))}if(!this.toY&&!s.y){let l=null;i.top&&this.top?l=this.parent.screenWorldHeight<this.parent.screenHeight?this.calcUnderflowY():-a.y:i.bottom&&this.bottom&&(l=this.parent.screenWorldHeight<this.parent.screenHeight?this.calcUnderflowY():-h.y),l!==null&&this.parent.y!==l&&(this.toY={time:0,start:this.parent.y,delta:l-this.parent.y,end:l},this.parent.emit("bounce-y-start",this.parent))}}}reset(){this.toX=this.toY=null,this.bounce()}}const pC={left:!1,right:!1,top:!1,bottom:!1,direction:null,underflow:"center"};class fC extends je{constructor(t,e={}){super(t),D(this,"options"),D(this,"last"),D(this,"noUnderflow"),D(this,"underflowX"),D(this,"underflowY"),this.options=Object.assign({},pC,e),this.options.direction&&(this.options.left=this.options.direction==="x"||this.options.direction==="all"?!0:null,this.options.right=this.options.direction==="x"||this.options.direction==="all"?!0:null,this.options.top=this.options.direction==="y"||this.options.direction==="all"?!0:null,this.options.bottom=this.options.direction==="y"||this.options.direction==="all"?!0:null),this.parseUnderflow(),this.last={x:null,y:null,scaleX:null,scaleY:null},this.update()}parseUnderflow(){const t=this.options.underflow.toLowerCase();t==="none"?this.noUnderflow=!0:t==="center"?(this.underflowX=this.underflowY=0,this.noUnderflow=!1):(this.underflowX=t.indexOf("left")!==-1?-1:t.indexOf("right")!==-1?1:0,this.underflowY=t.indexOf("top")!==-1?-1:t.indexOf("bottom")!==-1?1:0,this.noUnderflow=!1)}move(){return this.update(),!1}update(){if(this.paused||this.parent.x===this.last.x&&this.parent.y===this.last.y&&this.parent.scale.x===this.last.scaleX&&this.parent.scale.y===this.last.scaleY)return;const t=new lt(this.parent.x,this.parent.y),e=this.parent.plugins.decelerate||{};if(this.options.left!==null||this.options.right!==null){let i=!1;if(!this.noUnderflow&&this.parent.screenWorldWidth<this.parent.screenWidth)switch(this.underflowX){case-1:this.parent.x!==0&&(this.parent.x=0,i=!0);break;case 1:this.parent.x!==this.parent.screenWidth-this.parent.screenWorldWidth&&(this.parent.x=this.parent.screenWidth-this.parent.screenWorldWidth,i=!0);break;default:this.parent.x!==(this.parent.screenWidth-this.parent.screenWorldWidth)/2&&(this.parent.x=(this.parent.screenWidth-this.parent.screenWorldWidth)/2,i=!0)}else this.options.left!==null&&this.parent.left<(this.options.left===!0?0:this.options.left)&&(this.parent.x=-(this.options.left===!0?0:this.options.left)*this.parent.scale.x,e.x=0,i=!0),this.options.right!==null&&this.parent.right>(this.options.right===!0?this.parent.worldWidth:this.options.right)&&(this.parent.x=-(this.options.right===!0?this.parent.worldWidth:this.options.right)*this.parent.scale.x+this.parent.screenWidth,e.x=0,i=!0);i&&this.parent.emit("moved",{viewport:this.parent,original:t,type:"clamp-x"})}if(this.options.top!==null||this.options.bottom!==null){let i=!1;if(!this.noUnderflow&&this.parent.screenWorldHeight<this.parent.screenHeight)switch(this.underflowY){case-1:this.parent.y!==0&&(this.parent.y=0,i=!0);break;case 1:this.parent.y!==this.parent.screenHeight-this.parent.screenWorldHeight&&(this.parent.y=this.parent.screenHeight-this.parent.screenWorldHeight,i=!0);break;default:this.parent.y!==(this.parent.screenHeight-this.parent.screenWorldHeight)/2&&(this.parent.y=(this.parent.screenHeight-this.parent.screenWorldHeight)/2,i=!0)}else this.options.top!==null&&this.parent.top<(this.options.top===!0?0:this.options.top)&&(this.parent.y=-(this.options.top===!0?0:this.options.top)*this.parent.scale.y,e.y=0,i=!0),this.options.bottom!==null&&this.parent.bottom>(this.options.bottom===!0?this.parent.worldHeight:this.options.bottom)&&(this.parent.y=-(this.options.bottom===!0?this.parent.worldHeight:this.options.bottom)*this.parent.scale.y+this.parent.screenHeight,e.y=0,i=!0);i&&this.parent.emit("moved",{viewport:this.parent,original:t,type:"clamp-y"})}this.last.x=this.parent.x,this.last.y=this.parent.y,this.last.scaleX=this.parent.scale.x,this.last.scaleY=this.parent.scale.y}reset(){this.update()}}const mC={minWidth:null,minHeight:null,maxWidth:null,maxHeight:null,minScale:null,maxScale:null};class gC extends je{constructor(t,e={}){super(t),D(this,"options"),this.options=Object.assign({},mC,e),this.clamp()}resize(){this.clamp()}clamp(){if(!this.paused){if(this.options.minWidth||this.options.minHeight||this.options.maxWidth||this.options.maxHeight){let t=this.parent.worldScreenWidth,e=this.parent.worldScreenHeight;if(this.options.minWidth!==null&&t<this.options.minWidth){const i=this.parent.scale.x;this.parent.fitWidth(this.options.minWidth,!1,!1,!0),this.parent.scale.y*=this.parent.scale.x/i,t=this.parent.worldScreenWidth,e=this.parent.worldScreenHeight,this.parent.emit("zoomed",{viewport:this.parent,type:"clamp-zoom"})}if(this.options.maxWidth!==null&&t>this.options.maxWidth){const i=this.parent.scale.x;this.parent.fitWidth(this.options.maxWidth,!1,!1,!0),this.parent.scale.y*=this.parent.scale.x/i,t=this.parent.worldScreenWidth,e=this.parent.worldScreenHeight,this.parent.emit("zoomed",{viewport:this.parent,type:"clamp-zoom"})}if(this.options.minHeight!==null&&e<this.options.minHeight){const i=this.parent.scale.y;this.parent.fitHeight(this.options.minHeight,!1,!1,!0),this.parent.scale.x*=this.parent.scale.y/i,t=this.parent.worldScreenWidth,e=this.parent.worldScreenHeight,this.parent.emit("zoomed",{viewport:this.parent,type:"clamp-zoom"})}if(this.options.maxHeight!==null&&e>this.options.maxHeight){const i=this.parent.scale.y;this.parent.fitHeight(this.options.maxHeight,!1,!1,!0),this.parent.scale.x*=this.parent.scale.y/i,this.parent.emit("zoomed",{viewport:this.parent,type:"clamp-zoom"})}}else if(this.options.minScale||this.options.maxScale){const t={x:null,y:null},e={x:null,y:null};if(typeof this.options.minScale=="number")t.x=this.options.minScale,t.y=this.options.minScale;else if(this.options.minScale!==null){const n=this.options.minScale;t.x=typeof n.x>"u"?null:n.x,t.y=typeof n.y>"u"?null:n.y}if(typeof this.options.maxScale=="number")e.x=this.options.maxScale,e.y=this.options.maxScale;else if(this.options.maxScale!==null){const n=this.options.maxScale;e.x=typeof n.x>"u"?null:n.x,e.y=typeof n.y>"u"?null:n.y}let i=this.parent.scale.x,s=this.parent.scale.y;t.x!==null&&i<t.x&&(i=t.x),e.x!==null&&i>e.x&&(i=e.x),t.y!==null&&s<t.y&&(s=t.y),e.y!==null&&s>e.y&&(s=e.y),(i!==this.parent.scale.x||s!==this.parent.scale.y)&&(this.parent.scale.set(i,s),this.parent.emit("zoomed",{viewport:this.parent,type:"clamp-zoom"}))}}}reset(){this.clamp()}}const yC={friction:.98,bounce:.8,minSpeed:.01},Gr=16;class bC extends je{constructor(t,e={}){super(t),D(this,"options"),D(this,"x"),D(this,"y"),D(this,"percentChangeX"),D(this,"percentChangeY"),D(this,"saved"),D(this,"timeSinceRelease"),this.options=Object.assign({},yC,e),this.saved=[],this.timeSinceRelease=0,this.reset(),this.parent.on("moved",i=>this.handleMoved(i))}down(){return this.saved=[],this.x=this.y=null,!1}isActive(){return!!(this.x||this.y)}move(){if(this.paused)return!1;const t=this.parent.input.count();return(t===1||t>1&&!this.parent.plugins.get("pinch",!0))&&(this.saved.push({x:this.parent.x,y:this.parent.y,time:performance.now()}),this.saved.length>60&&this.saved.splice(0,30)),!1}handleMoved(t){if(this.saved.length){const e=this.saved[this.saved.length-1];t.type==="clamp-x"&&t.original?e.x===t.original.x&&(e.x=this.parent.x):t.type==="clamp-y"&&t.original&&e.y===t.original.y&&(e.y=this.parent.y)}}up(){if(this.parent.input.count()===0&&this.saved.length){const t=performance.now();for(const e of this.saved)if(e.time>=t-100){const i=t-e.time;this.x=(this.parent.x-e.x)/i,this.y=(this.parent.y-e.y)/i,this.percentChangeX=this.percentChangeY=this.options.friction,this.timeSinceRelease=0;break}}return!1}activate(t){t=t||{},typeof t.x<"u"&&(this.x=t.x,this.percentChangeX=this.options.friction),typeof t.y<"u"&&(this.y=t.y,this.percentChangeY=this.options.friction)}update(t){if(this.paused)return;const e=this.x||this.y,i=this.timeSinceRelease,s=this.timeSinceRelease+t;if(this.x){const n=this.percentChangeX,o=Math.log(n);this.parent.x+=this.x*Gr/o*(Math.pow(n,s/Gr)-Math.pow(n,i/Gr)),this.x*=Math.pow(this.percentChangeX,t/Gr)}if(this.y){const n=this.percentChangeY,o=Math.log(n);this.parent.y+=this.y*Gr/o*(Math.pow(n,s/Gr)-Math.pow(n,i/Gr)),this.y*=Math.pow(this.percentChangeY,t/Gr)}this.timeSinceRelease+=t,this.x&&this.y?Math.abs(this.x)<this.options.minSpeed&&Math.abs(this.y)<this.options.minSpeed&&(this.x=0,this.y=0):(Math.abs(this.x||0)<this.options.minSpeed&&(this.x=0),Math.abs(this.y||0)<this.options.minSpeed&&(this.y=0)),e&&this.parent.emit("moved",{viewport:this.parent,type:"decelerate"})}reset(){this.x=this.y=null}}const xC={direction:"all",pressDrag:!0,wheel:!0,wheelScroll:1,reverse:!1,clampWheel:!1,underflow:"center",factor:1,mouseButtons:"all",keyToPress:null,ignoreKeyToPressOnTouch:!1,lineHeight:20,wheelSwapAxes:!1};class _C extends je{constructor(t,e={}){super(t),D(this,"options"),D(this,"moved"),D(this,"reverse"),D(this,"xDirection"),D(this,"yDirection"),D(this,"keyIsPressed"),D(this,"mouse"),D(this,"underflowX"),D(this,"underflowY"),D(this,"last"),D(this,"current"),D(this,"windowEventHandlers",[]),this.options=Object.assign({},xC,e),this.moved=!1,this.reverse=this.options.reverse?1:-1,this.xDirection=!this.options.direction||this.options.direction==="all"||this.options.direction==="x",this.yDirection=!this.options.direction||this.options.direction==="all"||this.options.direction==="y",this.keyIsPressed=!1,this.parseUnderflow(),this.mouseButtons(this.options.mouseButtons),this.options.keyToPress&&this.handleKeyPresses(this.options.keyToPress)}handleKeyPresses(t){const e=s=>{t.includes(s.code)&&(this.keyIsPressed=!0)},i=s=>{t.includes(s.code)&&(this.keyIsPressed=!1)};this.addWindowEventHandler("keyup",i),this.addWindowEventHandler("keydown",e)}addWindowEventHandler(t,e){window.addEventListener(t,e),this.windowEventHandlers.push({event:t,handler:e})}destroy(){this.windowEventHandlers.forEach(({event:t,handler:e})=>{window.removeEventListener(t,e)})}mouseButtons(t){!t||t==="all"?this.mouse=[!0,!0,!0]:this.mouse=[t.indexOf("left")!==-1,t.indexOf("middle")!==-1,t.indexOf("right")!==-1]}parseUnderflow(){const t=this.options.underflow.toLowerCase();t==="center"?(this.underflowX=0,this.underflowY=0):(t.includes("left")?this.underflowX=-1:t.includes("right")?this.underflowX=1:this.underflowX=0,t.includes("top")?this.underflowY=-1:t.includes("bottom")?this.underflowY=1:this.underflowY=0)}checkButtons(t){const e=t.pointerType==="mouse",i=this.parent.input.count();return!!((i===1||i>1&&!this.parent.plugins.get("pinch",!0))&&(!e||this.mouse[t.button]))}checkKeyPress(t){return!this.options.keyToPress||this.keyIsPressed||this.options.ignoreKeyToPressOnTouch&&t.data.pointerType==="touch"}down(t){return this.paused||!this.options.pressDrag?!1:this.checkButtons(t)&&this.checkKeyPress(t)?(this.last={x:t.global.x,y:t.global.y},this.current=t.pointerId,!0):(this.last=null,!1)}get active(){return this.moved}move(t){if(this.paused||!this.options.pressDrag)return!1;if(this.last&&this.current===t.data.pointerId){const e=t.global.x,i=t.global.y,s=this.parent.input.count();if(s===1||s>1&&!this.parent.plugins.get("pinch",!0)){const n=e-this.last.x,o=i-this.last.y;if(this.moved||this.xDirection&&this.parent.input.checkThreshold(n)||this.yDirection&&this.parent.input.checkThreshold(o)){const a={x:e,y:i};return this.xDirection&&(this.parent.x+=(a.x-this.last.x)*this.options.factor),this.yDirection&&(this.parent.y+=(a.y-this.last.y)*this.options.factor),this.last=a,this.moved||this.parent.emit("drag-start",{event:t,screen:new lt(this.last.x,this.last.y),world:this.parent.toWorld(new lt(this.last.x,this.last.y)),viewport:this.parent}),this.moved=!0,this.parent.emit("moved",{viewport:this.parent,type:"drag"}),!0}}else this.moved=!1}return!1}up(t){if(this.paused)return!1;const e=this.parent.input.touches;if(e.length===1){const i=e[0];return i.last&&(this.last={x:i.last.x,y:i.last.y},this.current=i.id),this.moved=!1,!0}else if(this.last&&this.moved){const i=new lt(this.last.x,this.last.y);return this.parent.emit("drag-end",{event:t,screen:i,world:this.parent.toWorld(i),viewport:this.parent}),this.last=null,this.moved=!1,!0}return!1}wheel(t){if(this.paused)return!1;if(this.options.wheel){const e=this.parent.plugins.get("wheel",!0);if(!e||!e.options.wheelZoom&&!t.ctrlKey){const i=t.deltaMode?this.options.lineHeight:1,s=[t.deltaX,t.deltaY],[n,o]=this.options.wheelSwapAxes?s.reverse():s;return this.xDirection&&(this.parent.x+=n*i*this.options.wheelScroll*this.reverse),this.yDirection&&(this.parent.y+=o*i*this.options.wheelScroll*this.reverse),this.options.clampWheel&&this.clamp(),this.parent.emit("wheel-scroll",this.parent),this.parent.emit("moved",{viewport:this.parent,type:"wheel"}),this.parent.options.passiveWheel||t.preventDefault(),this.parent.options.stopPropagation&&t.stopPropagation(),!0}}return!1}resume(){this.last=null,this.paused=!1}clamp(){const t=this.parent.plugins.get("decelerate",!0)||{};if(this.options.clampWheel!=="y")if(this.parent.screenWorldWidth<this.parent.screenWidth)switch(this.underflowX){case-1:this.parent.x=0;break;case 1:this.parent.x=this.parent.screenWidth-this.parent.screenWorldWidth;break;default:this.parent.x=(this.parent.screenWidth-this.parent.screenWorldWidth)/2}else this.parent.left<0?(this.parent.x=0,t.x=0):this.parent.right>this.parent.worldWidth&&(this.parent.x=-this.parent.worldWidth*this.parent.scale.x+this.parent.screenWidth,t.x=0);if(this.options.clampWheel!=="x")if(this.parent.screenWorldHeight<this.parent.screenHeight)switch(this.underflowY){case-1:this.parent.y=0;break;case 1:this.parent.y=this.parent.screenHeight-this.parent.screenWorldHeight;break;default:this.parent.y=(this.parent.screenHeight-this.parent.screenWorldHeight)/2}else this.parent.top<0&&(this.parent.y=0,t.y=0),this.parent.bottom>this.parent.worldHeight&&(this.parent.y=-this.parent.worldHeight*this.parent.scale.y+this.parent.screenHeight,t.y=0)}}const vC={speed:0,acceleration:null,radius:null};class TC extends je{constructor(t,e,i={}){super(t),D(this,"options"),D(this,"target"),D(this,"velocity"),this.target=e,this.options=Object.assign({},vC,i),this.velocity={x:0,y:0}}update(t){if(this.paused)return;const e=this.parent.center;let i=this.target.x,s=this.target.y;if(this.options.radius)if(Math.sqrt(Math.pow(this.target.y-e.y,2)+Math.pow(this.target.x-e.x,2))>this.options.radius){const a=Math.atan2(this.target.y-e.y,this.target.x-e.x);i=this.target.x-Math.cos(a)*this.options.radius,s=this.target.y-Math.sin(a)*this.options.radius}else return;const n=i-e.x,o=s-e.y;if(n||o)if(this.options.speed)if(this.options.acceleration){const a=Math.atan2(s-e.y,i-e.x),h=Math.sqrt(Math.pow(n,2)+Math.pow(o,2));if(h){const l=(Math.pow(this.velocity.x,2)+Math.pow(this.velocity.y,2))/(2*this.options.acceleration);h>l?this.velocity={x:Math.min(this.velocity.x+(this.options.acceleration*t,this.options.speed)),y:Math.min(this.velocity.y+(this.options.acceleration*t,this.options.speed))}:this.velocity={x:Math.max(this.velocity.x-this.options.acceleration*this.options.speed,0),y:Math.max(this.velocity.y-this.options.acceleration*this.options.speed,0)};const u=Math.cos(a)*this.velocity.x,c=Math.sin(a)*this.velocity.y,d=Math.abs(u)>Math.abs(n)?i:e.x+u,p=Math.abs(c)>Math.abs(o)?s:e.y+c;this.parent.moveCenter(d,p),this.parent.emit("moved",{viewport:this.parent,type:"follow"})}}else{const a=Math.atan2(s-e.y,i-e.x),h=Math.cos(a)*this.options.speed,l=Math.sin(a)*this.options.speed,u=Math.abs(h)>Math.abs(n)?i:e.x+h,c=Math.abs(l)>Math.abs(o)?s:e.y+l;this.parent.moveCenter(u,c),this.parent.emit("moved",{viewport:this.parent,type:"follow"})}else this.parent.moveCenter(i,s),this.parent.emit("moved",{viewport:this.parent,type:"follow"})}}const wC={radius:null,distance:null,top:null,bottom:null,left:null,right:null,speed:8,reverse:!1,noDecelerate:!1,linear:!1,allowButtons:!1};class SC extends je{constructor(t,e={}){super(t),D(this,"options"),D(this,"reverse"),D(this,"radiusSquared"),D(this,"left"),D(this,"top"),D(this,"right"),D(this,"bottom"),D(this,"horizontal"),D(this,"vertical"),this.options=Object.assign({},wC,e),this.reverse=this.options.reverse?1:-1,this.radiusSquared=typeof this.options.radius=="number"?Math.pow(this.options.radius,2):null,this.resize()}resize(){const t=this.options.distance;t!==null?(this.left=t,this.top=t,this.right=this.parent.screenWidth-t,this.bottom=this.parent.screenHeight-t):this.options.radius||(this.left=this.options.left,this.top=this.options.top,this.right=this.options.right===null?null:this.parent.screenWidth-this.options.right,this.bottom=this.options.bottom===null?null:this.parent.screenHeight-this.options.bottom)}down(){return this.paused||this.options.allowButtons||(this.horizontal=this.vertical=null),!1}move(t){if(this.paused||t.pointerType!=="mouse"&&t.pointerId!==1||!this.options.allowButtons&&t.buttons!==0)return!1;const e=t.global.x,i=t.global.y;if(this.radiusSquared){const s=this.parent.toScreen(this.parent.center);if(Math.pow(s.x-e,2)+Math.pow(s.y-i,2)>=this.radiusSquared){const n=Math.atan2(s.y-i,s.x-e);this.options.linear?(this.horizontal=Math.round(Math.cos(n))*this.options.speed*this.reverse*(60/1e3),this.vertical=Math.round(Math.sin(n))*this.options.speed*this.reverse*(60/1e3)):(this.horizontal=Math.cos(n)*this.options.speed*this.reverse*(60/1e3),this.vertical=Math.sin(n)*this.options.speed*this.reverse*(60/1e3))}else this.horizontal&&this.decelerateHorizontal(),this.vertical&&this.decelerateVertical(),this.horizontal=this.vertical=0}else this.left!==null&&e<this.left?this.horizontal=Number(this.reverse)*this.options.speed*(60/1e3):this.right!==null&&e>this.right?this.horizontal=-1*this.reverse*this.options.speed*(60/1e3):(this.decelerateHorizontal(),this.horizontal=0),this.top!==null&&i<this.top?this.vertical=Number(this.reverse)*this.options.speed*(60/1e3):this.bottom!==null&&i>this.bottom?this.vertical=-1*this.reverse*this.options.speed*(60/1e3):(this.decelerateVertical(),this.vertical=0);return!1}decelerateHorizontal(){const t=this.parent.plugins.get("decelerate",!0);this.horizontal&&t&&!this.options.noDecelerate&&t.activate({x:this.horizontal*this.options.speed*this.reverse/(1e3/60)})}decelerateVertical(){const t=this.parent.plugins.get("decelerate",!0);this.vertical&&t&&!this.options.noDecelerate&&t.activate({y:this.vertical*this.options.speed*this.reverse/(1e3/60)})}up(){return this.paused||(this.horizontal&&this.decelerateHorizontal(),this.vertical&&this.decelerateVertical(),this.horizontal=this.vertical=null),!1}update(){if(!this.paused&&(this.horizontal||this.vertical)){const t=this.parent.center;this.horizontal&&(t.x+=this.horizontal*this.options.speed),this.vertical&&(t.y+=this.vertical*this.options.speed),this.parent.moveCenter(t),this.parent.emit("moved",{viewport:this.parent,type:"mouse-edges"})}}}const EC={noDrag:!1,percent:1,center:null,factor:1,axis:"all"};class CC extends je{constructor(t,e={}){super(t),D(this,"options"),D(this,"active",!1),D(this,"pinching",!1),D(this,"moved",!1),D(this,"lastCenter"),this.options=Object.assign({},EC,e)}down(){return this.parent.input.count()>=2?(this.active=!0,!0):!1}isAxisX(){return["all","x"].includes(this.options.axis)}isAxisY(){return["all","y"].includes(this.options.axis)}move(t){if(this.paused||!this.active)return!1;const e=t.global.x,i=t.global.y,s=this.parent.input.touches;if(s.length>=2){const n=s[0],o=s[1],a=n.last&&o.last?Math.sqrt(Math.pow(o.last.x-n.last.x,2)+Math.pow(o.last.y-n.last.y,2)):null;if(n.id===t.pointerId?n.last={x:e,y:i,data:t}:o.id===t.pointerId&&(o.last={x:e,y:i,data:t}),a){let h;const l=new lt(n.last.x+(o.last.x-n.last.x)/2,n.last.y+(o.last.y-n.last.y)/2);this.options.center||(h=this.parent.toLocal(l));let u=Math.sqrt(Math.pow(o.last.x-n.last.x,2)+Math.pow(o.last.y-n.last.y,2));u=u===0?u=1e-10:u;const c=(1-a/u)*this.options.percent*(this.isAxisX()?this.parent.scale.x:this.parent.scale.y);this.isAxisX()&&(this.parent.scale.x+=c),this.isAxisY()&&(this.parent.scale.y+=c),this.parent.emit("zoomed",{viewport:this.parent,type:"pinch",center:l});const d=this.parent.plugins.get("clamp-zoom",!0);if(d&&d.clamp(),this.options.center)this.parent.moveCenter(this.options.center);else{const p=this.parent.toGlobal(h);this.parent.x+=(l.x-p.x)*this.options.factor,this.parent.y+=(l.y-p.y)*this.options.factor,this.parent.emit("moved",{viewport:this.parent,type:"pinch"})}!this.options.noDrag&&this.lastCenter&&(this.parent.x+=(l.x-this.lastCenter.x)*this.options.factor,this.parent.y+=(l.y-this.lastCenter.y)*this.options.factor,this.parent.emit("moved",{viewport:this.parent,type:"pinch"})),this.lastCenter=l,this.moved=!0}else this.pinching||(this.parent.emit("pinch-start",this.parent),this.pinching=!0);return!0}return!1}up(){return this.pinching&&this.parent.input.touches.length<=1?(this.active=!1,this.lastCenter=null,this.pinching=!1,this.moved=!1,this.parent.emit("pinch-end",this.parent),!0):!1}}const IC={topLeft:!1,friction:.8,time:1e3,ease:"easeInOutSine",interrupt:!0,removeOnComplete:!1,removeOnInterrupt:!1,forceStart:!1};class AC extends je{constructor(t,e,i,s={}){super(t),D(this,"options"),D(this,"ease"),D(this,"x"),D(this,"y"),D(this,"percent"),D(this,"snapping"),D(this,"deltaX"),D(this,"deltaY"),D(this,"startX"),D(this,"startY"),this.options=Object.assign({},IC,s),this.ease=fh(s.ease,"easeInOutSine"),this.x=e,this.y=i,this.options.forceStart&&this.snapStart()}snapStart(){this.percent=0,this.snapping={time:0};const t=this.options.topLeft?this.parent.corner:this.parent.center;this.deltaX=this.x-t.x,this.deltaY=this.y-t.y,this.startX=t.x,this.startY=t.y,this.parent.emit("snap-start",this.parent)}wheel(){return this.options.removeOnInterrupt&&this.parent.plugins.remove("snap"),!1}down(){return this.options.removeOnInterrupt?this.parent.plugins.remove("snap"):this.options.interrupt&&(this.snapping=null),!1}up(){if(this.parent.input.count()===0){const t=this.parent.plugins.get("decelerate",!0);t&&(t.x||t.y)&&(t.percentChangeX=t.percentChangeY=this.options.friction)}return!1}update(t){if(!this.paused&&!(this.options.interrupt&&this.parent.input.count()!==0))if(this.snapping){const e=this.snapping;e.time+=t;let i,s,n;const o=this.startX,a=this.startY,h=this.deltaX,l=this.deltaY;if(e.time>this.options.time)i=!0,s=o+h,n=a+l;else{const u=this.ease(e.time,0,1,this.options.time);s=o+h*u,n=a+l*u}this.options.topLeft?this.parent.moveCorner(s,n):this.parent.moveCenter(s,n),this.parent.emit("moved",{viewport:this.parent,type:"snap"}),i&&(this.options.removeOnComplete&&this.parent.plugins.remove("snap"),this.parent.emit("snap-end",this.parent),this.snapping=null)}else{const e=this.options.topLeft?this.parent.corner:this.parent.center;(e.x!==this.x||e.y!==this.y)&&this.snapStart()}}}const MC={width:0,height:0,time:1e3,ease:"easeInOutSine",center:null,interrupt:!0,removeOnComplete:!1,removeOnInterrupt:!1,forceStart:!1,noMove:!1};class RC extends je{constructor(t,e={}){super(t),D(this,"options"),D(this,"ease"),D(this,"xScale"),D(this,"yScale"),D(this,"xIndependent"),D(this,"yIndependent"),D(this,"snapping"),this.options=Object.assign({},MC,e),this.ease=fh(this.options.ease),this.xIndependent=!1,this.yIndependent=!1,this.xScale=0,this.yScale=0,this.options.width>0&&(this.xScale=t.screenWidth/this.options.width,this.xIndependent=!0),this.options.height>0&&(this.yScale=t.screenHeight/this.options.height,this.yIndependent=!0),this.xScale=this.xIndependent?this.xScale:this.yScale,this.yScale=this.yIndependent?this.yScale:this.xScale,this.options.time===0?(t.container.scale.x=this.xScale,t.container.scale.y=this.yScale,this.options.removeOnComplete&&this.parent.plugins.remove("snap-zoom")):e.forceStart&&this.createSnapping()}createSnapping(){const t=this.parent.worldScreenWidth,e=this.parent.worldScreenHeight,i=this.parent.screenWidth/this.xScale,s=this.parent.screenHeight/this.yScale;this.snapping={time:0,startX:t,startY:e,deltaX:i-t,deltaY:s-e},this.parent.emit("snap-zoom-start",this.parent)}resize(){this.snapping=null,this.options.width>0&&(this.xScale=this.parent.screenWidth/this.options.width),this.options.height>0&&(this.yScale=this.parent.screenHeight/this.options.height),this.xScale=this.xIndependent?this.xScale:this.yScale,this.yScale=this.yIndependent?this.yScale:this.xScale}wheel(){return this.options.removeOnInterrupt&&this.parent.plugins.remove("snap-zoom"),!1}down(){return this.options.removeOnInterrupt?this.parent.plugins.remove("snap-zoom"):this.options.interrupt&&(this.snapping=null),!1}update(t){if(this.paused||this.options.interrupt&&this.parent.input.count()!==0)return;let e;if(!this.options.center&&!this.options.noMove&&(e=this.parent.center),!this.snapping)(this.parent.scale.x!==this.xScale||this.parent.scale.y!==this.yScale)&&this.createSnapping();else if(this.snapping){const i=this.snapping;if(i.time+=t,i.time>=this.options.time)this.parent.scale.set(this.xScale,this.yScale),this.options.removeOnComplete&&this.parent.plugins.remove("snap-zoom"),this.parent.emit("snap-zoom-end",this.parent),this.snapping=null;else{const n=this.snapping,o=this.ease(n.time,n.startX,n.deltaX,this.options.time),a=this.ease(n.time,n.startY,n.deltaY,this.options.time);this.parent.scale.x=this.parent.screenWidth/o,this.parent.scale.y=this.parent.screenHeight/a}const s=this.parent.plugins.get("clamp-zoom",!0);s&&s.clamp(),this.options.noMove||(this.options.center?this.parent.moveCenter(this.options.center):this.parent.moveCenter(e))}}resume(){this.snapping=null,super.resume()}}const PC={percent:.1,smooth:!1,interrupt:!0,reverse:!1,center:null,lineHeight:20,axis:"all",keyToPress:null,trackpadPinch:!1,wheelZoom:!0};class LC extends je{constructor(t,e={}){super(t),D(this,"options"),D(this,"smoothing"),D(this,"smoothingCenter"),D(this,"smoothingCount"),D(this,"keyIsPressed"),this.options=Object.assign({},PC,e),this.keyIsPressed=!1,this.options.keyToPress&&this.handleKeyPresses(this.options.keyToPress)}handleKeyPresses(t){window.addEventListener("keydown",e=>{t.includes(e.code)&&(this.keyIsPressed=!0)}),window.addEventListener("keyup",e=>{t.includes(e.code)&&(this.keyIsPressed=!1)})}checkKeyPress(){return!this.options.keyToPress||this.keyIsPressed}down(){return this.options.interrupt&&(this.smoothing=null),!1}isAxisX(){return["all","x"].includes(this.options.axis)}isAxisY(){return["all","y"].includes(this.options.axis)}update(){if(this.smoothing){const t=this.smoothingCenter,e=this.smoothing;let i;this.options.center||(i=this.parent.toLocal(t)),this.isAxisX()&&(this.parent.scale.x+=e.x),this.isAxisY()&&(this.parent.scale.y+=e.y),this.parent.emit("zoomed",{viewport:this.parent,type:"wheel"});const s=this.parent.plugins.get("clamp-zoom",!0);if(s&&s.clamp(),this.options.center)this.parent.moveCenter(this.options.center);else{const n=this.parent.toGlobal(i);this.parent.x+=t.x-n.x,this.parent.y+=t.y-n.y}this.parent.emit("moved",{viewport:this.parent,type:"wheel"}),this.smoothingCount++,this.smoothingCount>=this.options.smooth&&(this.smoothing=null)}}pinch(t){if(this.paused)return;const e=this.parent.input.getPointerPosition(t),i=-t.deltaY*(t.deltaMode?this.options.lineHeight:1)/200,s=Math.pow(2,(1+this.options.percent)*i);let n;this.options.center||(n=this.parent.toLocal(e)),this.isAxisX()&&(this.parent.scale.x*=s),this.isAxisY()&&(this.parent.scale.y*=s),this.parent.emit("zoomed",{viewport:this.parent,type:"wheel"});const o=this.parent.plugins.get("clamp-zoom",!0);if(o&&o.clamp(),this.options.center)this.parent.moveCenter(this.options.center);else{const a=this.parent.toGlobal(n);this.parent.x+=e.x-a.x,this.parent.y+=e.y-a.y}this.parent.emit("moved",{viewport:this.parent,type:"wheel"}),this.parent.emit("wheel-start",{event:t,viewport:this.parent})}wheel(t){if(this.paused||!this.checkKeyPress())return!1;if(t.ctrlKey&&this.options.trackpadPinch)this.pinch(t);else if(this.options.wheelZoom){const e=this.parent.input.getPointerPosition(t),i=(this.options.reverse?-1:1)*-t.deltaY*(t.deltaMode?this.options.lineHeight:1)/500,s=Math.pow(2,(1+this.options.percent)*i);if(this.options.smooth){const n={x:this.smoothing?this.smoothing.x*(this.options.smooth-this.smoothingCount):0,y:this.smoothing?this.smoothing.y*(this.options.smooth-this.smoothingCount):0};this.smoothing={x:((this.parent.scale.x+n.x)*s-this.parent.scale.x)/this.options.smooth,y:((this.parent.scale.y+n.y)*s-this.parent.scale.y)/this.options.smooth},this.smoothingCount=0,this.smoothingCenter=e}else{let n;this.options.center||(n=this.parent.toLocal(e)),this.isAxisX()&&(this.parent.scale.x*=s),this.isAxisY()&&(this.parent.scale.y*=s),this.parent.emit("zoomed",{viewport:this.parent,type:"wheel"});const o=this.parent.plugins.get("clamp-zoom",!0);if(o&&o.clamp(),this.options.center)this.parent.moveCenter(this.options.center);else{const a=this.parent.toGlobal(n);this.parent.x+=e.x-a.x,this.parent.y+=e.y-a.y}}this.parent.emit("moved",{viewport:this.parent,type:"wheel"}),this.parent.emit("wheel-start",{event:t,viewport:this.parent})}return!this.parent.options.passiveWheel}}class GC{constructor(t){D(this,"viewport"),D(this,"clickedAvailable"),D(this,"isMouseDown"),D(this,"last"),D(this,"wheelFunction"),D(this,"touches"),this.viewport=t,this.touches=[],this.addListeners()}addListeners(){this.viewport.eventMode="static",this.viewport.forceHitArea||(this.viewport.hitArea=new ct(0,0,this.viewport.worldWidth,this.viewport.worldHeight)),this.viewport.on("pointerdown",this.down,this),this.viewport.options.allowPreserveDragOutside?this.viewport.on("globalpointermove",this.move,this):this.viewport.on("pointermove",this.move,this),this.viewport.on("pointerup",this.up,this),this.viewport.on("pointerupoutside",this.up,this),this.viewport.on("pointercancel",this.up,this),this.viewport.options.allowPreserveDragOutside||this.viewport.on("pointerleave",this.up,this),this.wheelFunction=t=>this.handleWheel(t),this.viewport.options.events.domElement.addEventListener("wheel",this.wheelFunction,{passive:this.viewport.options.passiveWheel}),this.isMouseDown=!1}destroy(){this.viewport.options.events.domElement.removeEventListener("wheel",this.wheelFunction)}down(t){if(!(this.viewport.pause||!this.viewport.worldVisible)){if(t.pointerType==="mouse"?this.isMouseDown=!0:this.get(t.pointerId)||this.touches.push({id:t.pointerId,last:null}),this.count()===1){this.last=t.global.clone();const e=this.viewport.plugins.get("decelerate",!0),i=this.viewport.plugins.get("bounce",!0);(!e||!e.isActive())&&(!i||!i.isActive())?this.clickedAvailable=!0:this.clickedAvailable=!1}else this.clickedAvailable=!1;this.viewport.plugins.down(t)&&this.viewport.options.stopPropagation&&t.stopPropagation()}}clear(){this.isMouseDown=!1,this.touches=[],this.last=null}checkThreshold(t){return Math.abs(t)>=this.viewport.threshold}move(t){if(this.viewport.pause||!this.viewport.worldVisible)return;const e=this.viewport.plugins.move(t);if(this.clickedAvailable&&this.last){const i=t.global.x-this.last.x,s=t.global.y-this.last.y;(this.checkThreshold(i)||this.checkThreshold(s))&&(this.clickedAvailable=!1)}e&&this.viewport.options.stopPropagation&&t.stopPropagation()}up(t){if(this.viewport.pause||!this.viewport.worldVisible)return;t.pointerType==="mouse"&&(this.isMouseDown=!1),t.pointerType!=="mouse"&&this.remove(t.pointerId);const e=this.viewport.plugins.up(t);this.clickedAvailable&&this.count()===0&&this.last&&(this.viewport.emit("clicked",{event:t,screen:this.last,world:this.viewport.toWorld(this.last),viewport:this.viewport}),this.clickedAvailable=!1),e&&this.viewport.options.stopPropagation&&t.stopPropagation()}getPointerPosition(t){const e=new lt;return this.viewport.options.events.mapPositionToPoint(e,t.clientX,t.clientY),e}handleWheel(t){if(this.viewport.pause||!this.viewport.worldVisible)return;const e=this.viewport.toLocal(this.getPointerPosition(t));this.viewport.left<=e.x&&e.x<=this.viewport.right&&this.viewport.top<=e.y&&e.y<=this.viewport.bottom&&this.viewport.plugins.wheel(t)&&!this.viewport.options.passiveWheel&&t.preventDefault()}pause(){this.touches=[],this.isMouseDown=!1}get(t){for(const e of this.touches)if(e.id===t)return e;return null}remove(t){for(let e=0;e<this.touches.length;e++)if(this.touches[e].id===t){this.touches.splice(e,1);return}}count(){return(this.isMouseDown?1:0)+this.touches.length}}const fo=["drag","pinch","wheel","follow","mouse-edges","decelerate","animate","bounce","snap-zoom","clamp-zoom","snap","clamp"];class NC{constructor(t){D(this,"plugins"),D(this,"list"),D(this,"viewport"),this.viewport=t,this.list=[],this.plugins={}}add(t,e,i=fo.length){const s=this.plugins[t];s&&s.destroy(),this.plugins[t]=e;const n=fo.indexOf(t);n!==-1&&fo.splice(n,1),fo.splice(i,0,t),this.sort()}get(t,e){var i;return e&&(i=this.plugins[t])!=null&&i.paused?null:this.plugins[t]}update(t){for(const e of this.list)e.update(t)}resize(){for(const t of this.list)t.resize()}reset(){for(const t of this.list)t.reset()}removeAll(){this.list.forEach(t=>{t.destroy()}),this.plugins={},this.sort()}remove(t){var e;this.plugins[t]&&((e=this.plugins[t])==null||e.destroy(),delete this.plugins[t],this.viewport.emit("plugin-remove",t),this.sort())}pause(t){var e;(e=this.plugins[t])==null||e.pause()}resume(t){var e;(e=this.plugins[t])==null||e.resume()}sort(){this.list=[];for(const t of fo)this.plugins[t]&&this.list.push(this.plugins[t])}down(t){let e=!1;for(const i of this.list)i.down(t)&&(e=!0);return e}move(t){let e=!1;for(const i of this.viewport.plugins.list)i.move(t)&&(e=!0);return e}up(t){let e=!1;for(const i of this.list)i.up(t)&&(e=!0);return e}wheel(t){let e=!1;for(const i of this.list)i.wheel(t)&&(e=!0);return e}}const FC={screenWidth:window.innerWidth,screenHeight:window.innerHeight,worldWidth:null,worldHeight:null,threshold:5,passiveWheel:!0,stopPropagation:!1,forceHitArea:null,noTicker:!1,disableOnContextMenu:!1,ticker:ye.shared,allowPreserveDragOutside:!1};class DC extends Xt{constructor(t){super(),D(this,"moving"),D(this,"screenWidth"),D(this,"screenHeight"),D(this,"threshold"),D(this,"input"),D(this,"plugins"),D(this,"zooming"),D(this,"lastViewport"),D(this,"options"),D(this,"_dirty"),D(this,"_forceHitArea"),D(this,"_hitAreaDefault"),D(this,"_pause"),D(this,"tickerFunction"),D(this,"_worldWidth"),D(this,"_worldHeight"),D(this,"_disableOnContextMenu",e=>e.preventDefault()),this.options={...FC,...t},this.screenWidth=this.options.screenWidth,this.screenHeight=this.options.screenHeight,this._worldWidth=this.options.worldWidth,this._worldHeight=this.options.worldHeight,this.forceHitArea=this.options.forceHitArea,this.threshold=this.options.threshold,this.options.disableOnContextMenu&&this.options.events.domElement.addEventListener("contextmenu",this._disableOnContextMenu),this.options.noTicker||(this.tickerFunction=()=>this.update(this.options.ticker.elapsedMS),this.options.ticker.add(this.tickerFunction)),this.input=new GC(this),this.plugins=new NC(this)}destroy(t){!this.options.noTicker&&this.tickerFunction&&this.options.ticker.remove(this.tickerFunction),this.options.disableOnContextMenu&&this.options.events.domElement.removeEventListener("contextmenu",this._disableOnContextMenu),this.input.destroy(),super.destroy(t)}update(t){this.pause||(this.plugins.update(t),this.lastViewport&&(this.lastViewport.x!==this.x||this.lastViewport.y!==this.y?this.moving=!0:this.moving&&(this.emit("moved-end",this),this.moving=!1),this.lastViewport.scaleX!==this.scale.x||this.lastViewport.scaleY!==this.scale.y?this.zooming=!0:this.zooming&&(this.emit("zoomed-end",this),this.zooming=!1)),this.forceHitArea||(this._hitAreaDefault=new ct(this.left,this.top,this.worldScreenWidth,this.worldScreenHeight),this.hitArea=this._hitAreaDefault),this._dirty=this._dirty||!this.lastViewport||this.lastViewport.x!==this.x||this.lastViewport.y!==this.y||this.lastViewport.scaleX!==this.scale.x||this.lastViewport.scaleY!==this.scale.y,this.lastViewport={x:this.x,y:this.y,scaleX:this.scale.x,scaleY:this.scale.y},this.emit("frame-end",this))}resize(t=window.innerWidth,e=window.innerHeight,i,s){this.screenWidth=t,this.screenHeight=e,typeof i<"u"&&(this._worldWidth=i),typeof s<"u"&&(this._worldHeight=s),this.plugins.resize(),this.dirty=!0}get worldWidth(){return this._worldWidth?this._worldWidth:this.width/this.scale.x}set worldWidth(t){this._worldWidth=t,this.plugins.resize()}get worldHeight(){return this._worldHeight?this._worldHeight:this.height/this.scale.y}set worldHeight(t){this._worldHeight=t,this.plugins.resize()}getVisibleBounds(){return new ct(this.left,this.top,this.worldScreenWidth,this.worldScreenHeight)}toWorld(t,e){return arguments.length===2?this.toLocal(new lt(t,e)):this.toLocal(t)}toScreen(t,e){return arguments.length===2?this.toGlobal(new lt(t,e)):this.toGlobal(t)}get worldScreenWidth(){return this.screenWidth/this.scale.x}get worldScreenHeight(){return this.screenHeight/this.scale.y}get screenWorldWidth(){return this.worldWidth*this.scale.x}get screenWorldHeight(){return this.worldHeight*this.scale.y}get center(){return new lt(this.worldScreenWidth/2-this.x/this.scale.x,this.worldScreenHeight/2-this.y/this.scale.y)}set center(t){this.moveCenter(t)}moveCenter(...t){let e,i;typeof t[0]=="number"?(e=t[0],i=t[1]):(e=t[0].x,i=t[0].y);const s=(this.worldScreenWidth/2-e)*this.scale.x,n=(this.worldScreenHeight/2-i)*this.scale.y;return(this.x!==s||this.y!==n)&&(this.position.set(s,n),this.plugins.reset(),this.dirty=!0),this}get corner(){return new lt(-this.x/this.scale.x,-this.y/this.scale.y)}set corner(t){this.moveCorner(t)}moveCorner(...t){let e,i;return t.length===1?(e=-t[0].x*this.scale.x,i=-t[0].y*this.scale.y):(e=-t[0]*this.scale.x,i=-t[1]*this.scale.y),(e!==this.x||i!==this.y)&&(this.position.set(e,i),this.plugins.reset(),this.dirty=!0),this}get screenWidthInWorldPixels(){return this.screenWidth/this.scale.x}get screenHeightInWorldPixels(){return this.screenHeight/this.scale.y}findFitWidth(t){return this.screenWidth/t}findFitHeight(t){return this.screenHeight/t}findFit(t,e){const i=this.screenWidth/t,s=this.screenHeight/e;return Math.min(i,s)}findCover(t,e){const i=this.screenWidth/t,s=this.screenHeight/e;return Math.max(i,s)}fitWidth(t=this.worldWidth,e,i=!0,s){let n;e&&(n=this.center),this.scale.x=this.screenWidth/t,i&&(this.scale.y=this.scale.x);const o=this.plugins.get("clamp-zoom",!0);return!s&&o&&o.clamp(),e&&n&&this.moveCenter(n),this}fitHeight(t=this.worldHeight,e,i=!0,s){let n;e&&(n=this.center),this.scale.y=this.screenHeight/t,i&&(this.scale.x=this.scale.y);const o=this.plugins.get("clamp-zoom",!0);return!s&&o&&o.clamp(),e&&n&&this.moveCenter(n),this}fitWorld(t){let e;t&&(e=this.center),this.scale.x=this.screenWidth/this.worldWidth,this.scale.y=this.screenHeight/this.worldHeight,this.scale.x<this.scale.y?this.scale.y=this.scale.x:this.scale.x=this.scale.y;const i=this.plugins.get("clamp-zoom",!0);return i&&i.clamp(),t&&e&&this.moveCenter(e),this}fit(t,e=this.worldWidth,i=this.worldHeight){let s;t&&(s=this.center),this.scale.x=this.screenWidth/e,this.scale.y=this.screenHeight/i,this.scale.x<this.scale.y?this.scale.y=this.scale.x:this.scale.x=this.scale.y;const n=this.plugins.get("clamp-zoom",!0);return n&&n.clamp(),t&&s&&this.moveCenter(s),this}setZoom(t,e){let i;e&&(i=this.center),this.scale.set(t);const s=this.plugins.get("clamp-zoom",!0);return s&&s.clamp(),e&&i&&this.moveCenter(i),this}zoomPercent(t,e){return this.setZoom(this.scale.x+this.scale.x*t,e)}zoom(t,e){return this.fitWidth(t+this.worldScreenWidth,e),this}get scaled(){return this.scale.x}set scaled(t){this.setZoom(t,!0)}snapZoom(t){return this.plugins.add("snap-zoom",new RC(this,t)),this}OOB(){return{left:this.left<0,right:this.right>this.worldWidth,top:this.top<0,bottom:this.bottom>this.worldHeight,cornerPoint:new lt(this.worldWidth*this.scale.x-this.screenWidth,this.worldHeight*this.scale.y-this.screenHeight)}}get right(){return-this.x/this.scale.x+this.worldScreenWidth}set right(t){this.x=-t*this.scale.x+this.screenWidth,this.plugins.reset()}get left(){return-this.x/this.scale.x}set left(t){this.x=-t*this.scale.x,this.plugins.reset()}get top(){return-this.y/this.scale.y}set top(t){this.y=-t*this.scale.y,this.plugins.reset()}get bottom(){return-this.y/this.scale.y+this.worldScreenHeight}set bottom(t){this.y=-t*this.scale.y+this.screenHeight,this.plugins.reset()}get dirty(){return!!this._dirty}set dirty(t){this._dirty=t}get forceHitArea(){return this._forceHitArea}set forceHitArea(t){t?(this._forceHitArea=t,this.hitArea=t):(this._forceHitArea=null,this.hitArea=new ct(0,0,this.worldWidth,this.worldHeight))}drag(t){return this.plugins.add("drag",new _C(this,t)),this}clamp(t){return this.plugins.add("clamp",new fC(this,t)),this}decelerate(t){return this.plugins.add("decelerate",new bC(this,t)),this}bounce(t){return this.plugins.add("bounce",new dC(this,t)),this}pinch(t){return this.plugins.add("pinch",new CC(this,t)),this}snap(t,e,i){return this.plugins.add("snap",new AC(this,t,e,i)),this}follow(t,e){return this.plugins.add("follow",new TC(this,t,e)),this}wheel(t){return this.plugins.add("wheel",new LC(this,t)),this}animate(t){return this.plugins.add("animate",new uC(this,t)),this}clampZoom(t){return this.plugins.add("clamp-zoom",new gC(this,t)),this}mouseEdges(t){return this.plugins.add("mouse-edges",new SC(this,t)),this}get pause(){return!!this._pause}set pause(t){this._pause=t,this.lastViewport=null,this.moving=!1,this.zooming=!1,t&&this.input.pause()}ensureVisible(t,e,i,s,n){n&&(i>this.worldScreenWidth||s>this.worldScreenHeight)&&(this.fit(!0,i,s),this.emit("zoomed",{viewport:this,type:"ensureVisible"}));let o=!1;t<this.left?(this.left=t,o=!0):t+i>this.right&&(this.right=t+i,o=!0),e<this.top?(this.top=e,o=!0):e+s>this.bottom&&(this.bottom=e+s,o=!0),o&&this.emit("moved",{viewport:this,type:"ensureVisible"})}}function mh(r,t){return r==null||t==null?NaN:r<t?-1:r>t?1:r>=t?0:NaN}function kC(r,t){return r==null||t==null?NaN:t<r?-1:t>r?1:t>=r?0:NaN}function Zc(r){let t,e,i;r.length!==2?(t=mh,e=(a,h)=>mh(r(a),h),i=(a,h)=>r(a)-h):(t=r===mh||r===kC?r:OC,e=r,i=r);function s(a,h,l=0,u=a.length){if(l<u){if(t(h,h)!==0)return u;do{const c=l+u>>>1;e(a[c],h)<0?l=c+1:u=c}while(l<u)}return l}function n(a,h,l=0,u=a.length){if(l<u){if(t(h,h)!==0)return u;do{const c=l+u>>>1;e(a[c],h)<=0?l=c+1:u=c}while(l<u)}return l}function o(a,h,l=0,u=a.length){const c=s(a,h,l,u-1);return c>l&&i(a[c-1],h)>-i(a[c],h)?c-1:c}return{left:s,center:o,right:n}}function OC(){return 0}function BC(r){return r===null?NaN:+r}const WC=Zc(mh).right;Zc(BC).center;const UC=WC,XC=Math.sqrt(50),ZC=Math.sqrt(10),VC=Math.sqrt(2);function gh(r,t,e){const i=(t-r)/Math.max(0,e),s=Math.floor(Math.log10(i)),n=i/Math.pow(10,s),o=n>=XC?10:n>=ZC?5:n>=VC?2:1;let a,h,l;return s<0?(l=Math.pow(10,-s)/o,a=Math.round(r*l),h=Math.round(t*l),a/l<r&&++a,h/l>t&&--h,l=-l):(l=Math.pow(10,s)*o,a=Math.round(r/l),h=Math.round(t/l),a*l<r&&++a,h*l>t&&--h),h<a&&.5<=e&&e<2?gh(r,t,e*2):[a,h,l]}function HC(r,t,e){if(t=+t,r=+r,e=+e,!(e>0))return[];if(r===t)return[r];const i=t<r,[s,n,o]=i?gh(t,r,e):gh(r,t,e);if(!(n>=s))return[];const a=n-s+1,h=new Array(a);if(i)if(o<0)for(let l=0;l<a;++l)h[l]=(n-l)/-o;else for(let l=0;l<a;++l)h[l]=(n-l)*o;else if(o<0)for(let l=0;l<a;++l)h[l]=(s+l)/-o;else for(let l=0;l<a;++l)h[l]=(s+l)*o;return h}function Vc(r,t,e){return t=+t,r=+r,e=+e,gh(r,t,e)[2]}function Hc(r,t,e){t=+t,r=+r,e=+e;const i=t<r,s=i?Vc(t,r,e):Vc(r,t,e);return(i?-1:1)*(s<0?1/-s:s)}function Kc(r,t,e){r.prototype=t.prototype=e,e.constructor=r}function ty(r,t){var e=Object.create(r.prototype);for(var i in t)e[i]=t[i];return e}function mo(){}var go=.7,yh=1/go,an="\\s*([+-]?\\d+)\\s*",yo="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",Gi="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",KC=/^#([0-9a-f]{3,8})$/,YC=new RegExp(`^rgb\\(${an},${an},${an}\\)$`),zC=new RegExp(`^rgb\\(${Gi},${Gi},${Gi}\\)$`),jC=new RegExp(`^rgba\\(${an},${an},${an},${yo}\\)$`),JC=new RegExp(`^rgba\\(${Gi},${Gi},${Gi},${yo}\\)$`),$C=new RegExp(`^hsl\\(${yo},${Gi},${Gi}\\)$`),QC=new RegExp(`^hsla\\(${yo},${Gi},${Gi},${yo}\\)$`),ey={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};Kc(mo,bo,{copy(r){return Object.assign(new this.constructor,this,r)},displayable(){return this.rgb().displayable()},hex:iy,formatHex:iy,formatHex8:qC,formatHsl:tI,formatRgb:ry,toString:ry});function iy(){return this.rgb().formatHex()}function qC(){return this.rgb().formatHex8()}function tI(){return hy(this).formatHsl()}function ry(){return this.rgb().formatRgb()}function bo(r){var t,e;return r=(r+"").trim().toLowerCase(),(t=KC.exec(r))?(e=t[1].length,t=parseInt(t[1],16),e===6?sy(t):e===3?new Se(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):e===8?bh(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):e===4?bh(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=YC.exec(r))?new Se(t[1],t[2],t[3],1):(t=zC.exec(r))?new Se(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=jC.exec(r))?bh(t[1],t[2],t[3],t[4]):(t=JC.exec(r))?bh(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=$C.exec(r))?ay(t[1],t[2]/100,t[3]/100,1):(t=QC.exec(r))?ay(t[1],t[2]/100,t[3]/100,t[4]):ey.hasOwnProperty(r)?sy(ey[r]):r==="transparent"?new Se(NaN,NaN,NaN,0):null}function sy(r){return new Se(r>>16&255,r>>8&255,r&255,1)}function bh(r,t,e,i){return i<=0&&(r=t=e=NaN),new Se(r,t,e,i)}function eI(r){return r instanceof mo||(r=bo(r)),r?(r=r.rgb(),new Se(r.r,r.g,r.b,r.opacity)):new Se}function Yc(r,t,e,i){return arguments.length===1?eI(r):new Se(r,t,e,i??1)}function Se(r,t,e,i){this.r=+r,this.g=+t,this.b=+e,this.opacity=+i}Kc(Se,Yc,ty(mo,{brighter(r){return r=r==null?yh:Math.pow(yh,r),new Se(this.r*r,this.g*r,this.b*r,this.opacity)},darker(r){return r=r==null?go:Math.pow(go,r),new Se(this.r*r,this.g*r,this.b*r,this.opacity)},rgb(){return this},clamp(){return new Se(fs(this.r),fs(this.g),fs(this.b),xh(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:ny,formatHex:ny,formatHex8:iI,formatRgb:oy,toString:oy}));function ny(){return`#${ms(this.r)}${ms(this.g)}${ms(this.b)}`}function iI(){return`#${ms(this.r)}${ms(this.g)}${ms(this.b)}${ms((isNaN(this.opacity)?1:this.opacity)*255)}`}function oy(){const r=xh(this.opacity);return`${r===1?"rgb(":"rgba("}${fs(this.r)}, ${fs(this.g)}, ${fs(this.b)}${r===1?")":`, ${r})`}`}function xh(r){return isNaN(r)?1:Math.max(0,Math.min(1,r))}function fs(r){return Math.max(0,Math.min(255,Math.round(r)||0))}function ms(r){return r=fs(r),(r<16?"0":"")+r.toString(16)}function ay(r,t,e,i){return i<=0?r=t=e=NaN:e<=0||e>=1?r=t=NaN:t<=0&&(r=NaN),new ui(r,t,e,i)}function hy(r){if(r instanceof ui)return new ui(r.h,r.s,r.l,r.opacity);if(r instanceof mo||(r=bo(r)),!r)return new ui;if(r instanceof ui)return r;r=r.rgb();var t=r.r/255,e=r.g/255,i=r.b/255,s=Math.min(t,e,i),n=Math.max(t,e,i),o=NaN,a=n-s,h=(n+s)/2;return a?(t===n?o=(e-i)/a+(e<i)*6:e===n?o=(i-t)/a+2:o=(t-e)/a+4,a/=h<.5?n+s:2-n-s,o*=60):a=h>0&&h<1?0:o,new ui(o,a,h,r.opacity)}function rI(r,t,e,i){return arguments.length===1?hy(r):new ui(r,t,e,i??1)}function ui(r,t,e,i){this.h=+r,this.s=+t,this.l=+e,this.opacity=+i}Kc(ui,rI,ty(mo,{brighter(r){return r=r==null?yh:Math.pow(yh,r),new ui(this.h,this.s,this.l*r,this.opacity)},darker(r){return r=r==null?go:Math.pow(go,r),new ui(this.h,this.s,this.l*r,this.opacity)},rgb(){var r=this.h%360+(this.h<0)*360,t=isNaN(r)||isNaN(this.s)?0:this.s,e=this.l,i=e+(e<.5?e:1-e)*t,s=2*e-i;return new Se(zc(r>=240?r-240:r+120,s,i),zc(r,s,i),zc(r<120?r+240:r-120,s,i),this.opacity)},clamp(){return new ui(ly(this.h),_h(this.s),_h(this.l),xh(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const r=xh(this.opacity);return`${r===1?"hsl(":"hsla("}${ly(this.h)}, ${_h(this.s)*100}%, ${_h(this.l)*100}%${r===1?")":`, ${r})`}`}}));function ly(r){return r=(r||0)%360,r<0?r+360:r}function _h(r){return Math.max(0,Math.min(1,r||0))}function zc(r,t,e){return(r<60?t+(e-t)*r/60:r<180?e:r<240?t+(e-t)*(240-r)/60:t)*255}const jc=r=>()=>r;function sI(r,t){return function(e){return r+e*t}}function nI(r,t,e){return r=Math.pow(r,e),t=Math.pow(t,e)-r,e=1/e,function(i){return Math.pow(r+i*t,e)}}function oI(r){return(r=+r)==1?uy:function(t,e){return e-t?nI(t,e,r):jc(isNaN(t)?e:t)}}function uy(r,t){var e=t-r;return e?sI(r,e):jc(isNaN(r)?t:r)}const cy=function r(t){var e=oI(t);function i(s,n){var o=e((s=Yc(s)).r,(n=Yc(n)).r),a=e(s.g,n.g),h=e(s.b,n.b),l=uy(s.opacity,n.opacity);return function(u){return s.r=o(u),s.g=a(u),s.b=h(u),s.opacity=l(u),s+""}}return i.gamma=r,i}(1);function aI(r,t){t||(t=[]);var e=r?Math.min(t.length,r.length):0,i=t.slice(),s;return function(n){for(s=0;s<e;++s)i[s]=r[s]*(1-n)+t[s]*n;return i}}function hI(r){return ArrayBuffer.isView(r)&&!(r instanceof DataView)}function lI(r,t){var e=t?t.length:0,i=r?Math.min(e,r.length):0,s=new Array(i),n=new Array(e),o;for(o=0;o<i;++o)s[o]=Qc(r[o],t[o]);for(;o<e;++o)n[o]=t[o];return function(a){for(o=0;o<i;++o)n[o]=s[o](a);return n}}function uI(r,t){var e=new Date;return r=+r,t=+t,function(i){return e.setTime(r*(1-i)+t*i),e}}function vh(r,t){return r=+r,t=+t,function(e){return r*(1-e)+t*e}}function cI(r,t){var e={},i={},s;(r===null||typeof r!="object")&&(r={}),(t===null||typeof t!="object")&&(t={});for(s in t)s in r?e[s]=Qc(r[s],t[s]):i[s]=t[s];return function(n){for(s in e)i[s]=e[s](n);return i}}var Jc=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,$c=new RegExp(Jc.source,"g");function dI(r){return function(){return r}}function pI(r){return function(t){return r(t)+""}}function fI(r,t){var e=Jc.lastIndex=$c.lastIndex=0,i,s,n,o=-1,a=[],h=[];for(r=r+"",t=t+"";(i=Jc.exec(r))&&(s=$c.exec(t));)(n=s.index)>e&&(n=t.slice(e,n),a[o]?a[o]+=n:a[++o]=n),(i=i[0])===(s=s[0])?a[o]?a[o]+=s:a[++o]=s:(a[++o]=null,h.push({i:o,x:vh(i,s)})),e=$c.lastIndex;return e<t.length&&(n=t.slice(e),a[o]?a[o]+=n:a[++o]=n),a.length<2?h[0]?pI(h[0].x):dI(t):(t=h.length,function(l){for(var u=0,c;u<t;++u)a[(c=h[u]).i]=c.x(l);return a.join("")})}function Qc(r,t){var e=typeof t,i;return t==null||e==="boolean"?jc(t):(e==="number"?vh:e==="string"?(i=bo(t))?(t=i,cy):fI:t instanceof bo?cy:t instanceof Date?uI:hI(t)?aI:Array.isArray(t)?lI:typeof t.valueOf!="function"&&typeof t.toString!="function"||isNaN(t)?cI:vh)(r,t)}function mI(r,t){return r=+r,t=+t,function(e){return Math.round(r*(1-e)+t*e)}}function gI(r){return Math.abs(r=Math.round(r))>=1e21?r.toLocaleString("en").replace(/,/g,""):r.toString(10)}function Th(r,t){if((e=(r=t?r.toExponential(t-1):r.toExponential()).indexOf("e"))<0)return null;var e,i=r.slice(0,e);return[i.length>1?i[0]+i.slice(2):i,+r.slice(e+1)]}function hn(r){return r=Th(Math.abs(r)),r?r[1]:NaN}function yI(r,t){return function(e,i){for(var s=e.length,n=[],o=0,a=r[0],h=0;s>0&&a>0&&(h+a+1>i&&(a=Math.max(1,i-h)),n.push(e.substring(s-=a,s+a)),!((h+=a+1)>i));)a=r[o=(o+1)%r.length];return n.reverse().join(t)}}function bI(r){return function(t){return t.replace(/[0-9]/g,function(e){return r[+e]})}}var xI=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function wh(r){if(!(t=xI.exec(r)))throw new Error("invalid format: "+r);var t;return new qc({fill:t[1],align:t[2],sign:t[3],symbol:t[4],zero:t[5],width:t[6],comma:t[7],precision:t[8]&&t[8].slice(1),trim:t[9],type:t[10]})}wh.prototype=qc.prototype;function qc(r){this.fill=r.fill===void 0?" ":r.fill+"",this.align=r.align===void 0?">":r.align+"",this.sign=r.sign===void 0?"-":r.sign+"",this.symbol=r.symbol===void 0?"":r.symbol+"",this.zero=!!r.zero,this.width=r.width===void 0?void 0:+r.width,this.comma=!!r.comma,this.precision=r.precision===void 0?void 0:+r.precision,this.trim=!!r.trim,this.type=r.type===void 0?"":r.type+""}qc.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(this.width===void 0?"":Math.max(1,this.width|0))+(this.comma?",":"")+(this.precision===void 0?"":"."+Math.max(0,this.precision|0))+(this.trim?"~":"")+this.type};function _I(r){t:for(var t=r.length,e=1,i=-1,s;e<t;++e)switch(r[e]){case".":i=s=e;break;case"0":i===0&&(i=e),s=e;break;default:if(!+r[e])break t;i>0&&(i=0);break}return i>0?r.slice(0,i)+r.slice(s+1):r}var dy;function vI(r,t){var e=Th(r,t);if(!e)return r+"";var i=e[0],s=e[1],n=s-(dy=Math.max(-8,Math.min(8,Math.floor(s/3)))*3)+1,o=i.length;return n===o?i:n>o?i+new Array(n-o+1).join("0"):n>0?i.slice(0,n)+"."+i.slice(n):"0."+new Array(1-n).join("0")+Th(r,Math.max(0,t+n-1))[0]}function py(r,t){var e=Th(r,t);if(!e)return r+"";var i=e[0],s=e[1];return s<0?"0."+new Array(-s).join("0")+i:i.length>s+1?i.slice(0,s+1)+"."+i.slice(s+1):i+new Array(s-i.length+2).join("0")}const fy={"%":(r,t)=>(r*100).toFixed(t),b:r=>Math.round(r).toString(2),c:r=>r+"",d:gI,e:(r,t)=>r.toExponential(t),f:(r,t)=>r.toFixed(t),g:(r,t)=>r.toPrecision(t),o:r=>Math.round(r).toString(8),p:(r,t)=>py(r*100,t),r:py,s:vI,X:r=>Math.round(r).toString(16).toUpperCase(),x:r=>Math.round(r).toString(16)};function my(r){return r}var gy=Array.prototype.map,yy=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function TI(r){var t=r.grouping===void 0||r.thousands===void 0?my:yI(gy.call(r.grouping,Number),r.thousands+""),e=r.currency===void 0?"":r.currency[0]+"",i=r.currency===void 0?"":r.currency[1]+"",s=r.decimal===void 0?".":r.decimal+"",n=r.numerals===void 0?my:bI(gy.call(r.numerals,String)),o=r.percent===void 0?"%":r.percent+"",a=r.minus===void 0?"−":r.minus+"",h=r.nan===void 0?"NaN":r.nan+"";function l(c){c=wh(c);var d=c.fill,p=c.align,m=c.sign,f=c.symbol,g=c.zero,y=c.width,_=c.comma,x=c.precision,v=c.trim,S=c.type;S==="n"?(_=!0,S="g"):fy[S]||(x===void 0&&(x=12),v=!0,S="g"),(g||d==="0"&&p==="=")&&(g=!0,d="0",p="=");var C=f==="$"?e:f==="#"&&/[boxX]/.test(S)?"0"+S.toLowerCase():"",A=f==="$"?i:/[%p]/.test(S)?o:"",I=fy[S],L=/[defgprs%]/.test(S);x=x===void 0?6:/[gprs]/.test(S)?Math.max(1,Math.min(21,x)):Math.max(0,Math.min(20,x));function k(M){var G=C,E=A,N,O,Z;if(S==="c")E=I(M)+E,M="";else{M=+M;var U=M<0||1/M<0;if(M=isNaN(M)?h:I(Math.abs(M),x),v&&(M=_I(M)),U&&+M==0&&m!=="+"&&(U=!1),G=(U?m==="("?m:a:m==="-"||m==="("?"":m)+G,E=(S==="s"?yy[8+dy/3]:"")+E+(U&&m==="("?")":""),L){for(N=-1,O=M.length;++N<O;)if(Z=M.charCodeAt(N),48>Z||Z>57){E=(Z===46?s+M.slice(N+1):M.slice(N))+E,M=M.slice(0,N);break}}}_&&!g&&(M=t(M,1/0));var K=G.length+M.length+E.length,ht=K<y?new Array(y-K+1).join(d):"";switch(_&&g&&(M=t(ht+M,ht.length?y-E.length:1/0),ht=""),p){case"<":M=G+M+E+ht;break;case"=":M=G+ht+M+E;break;case"^":M=ht.slice(0,K=ht.length>>1)+G+M+E+ht.slice(K);break;default:M=ht+G+M+E;break}return n(M)}return k.toString=function(){return c+""},k}function u(c,d){var p=l((c=wh(c),c.type="f",c)),m=Math.max(-8,Math.min(8,Math.floor(hn(d)/3)))*3,f=Math.pow(10,-m),g=yy[8+m/3];return function(y){return p(f*y)+g}}return{format:l,formatPrefix:u}}var Sh,by,xy;wI({thousands:",",grouping:[3],currency:["$",""]});function wI(r){return Sh=TI(r),by=Sh.format,xy=Sh.formatPrefix,Sh}function SI(r){return Math.max(0,-hn(Math.abs(r)))}function EI(r,t){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(hn(t)/3)))*3-hn(Math.abs(r)))}function CI(r,t){return r=Math.abs(r),t=Math.abs(t)-r,Math.max(0,hn(t)-hn(r))+1}function _y(r,t){switch(arguments.length){case 0:break;case 1:this.range(r);break;default:this.range(t).domain(r);break}return this}function II(r){return function(){return r}}function AI(r){return+r}var vy=[0,1];function ln(r){return r}function td(r,t){return(t-=r=+r)?function(e){return(e-r)/t}:II(isNaN(t)?NaN:.5)}function MI(r,t){var e;return r>t&&(e=r,r=t,t=e),function(i){return Math.max(r,Math.min(t,i))}}function RI(r,t,e){var i=r[0],s=r[1],n=t[0],o=t[1];return s<i?(i=td(s,i),n=e(o,n)):(i=td(i,s),n=e(n,o)),function(a){return n(i(a))}}function PI(r,t,e){var i=Math.min(r.length,t.length)-1,s=new Array(i),n=new Array(i),o=-1;for(r[i]<r[0]&&(r=r.slice().reverse(),t=t.slice().reverse());++o<i;)s[o]=td(r[o],r[o+1]),n[o]=e(t[o],t[o+1]);return function(a){var h=UC(r,a,1,i)-1;return n[h](s[h](a))}}function Ty(r,t){return t.domain(r.domain()).range(r.range()).interpolate(r.interpolate()).clamp(r.clamp()).unknown(r.unknown())}function LI(){var r=vy,t=vy,e=Qc,i,s,n,o=ln,a,h,l;function u(){var d=Math.min(r.length,t.length);return o!==ln&&(o=MI(r[0],r[d-1])),a=d>2?PI:RI,h=l=null,c}function c(d){return d==null||isNaN(d=+d)?n:(h||(h=a(r.map(i),t,e)))(i(o(d)))}return c.invert=function(d){return o(s((l||(l=a(t,r.map(i),vh)))(d)))},c.domain=function(d){return arguments.length?(r=Array.from(d,AI),u()):r.slice()},c.range=function(d){return arguments.length?(t=Array.from(d),u()):t.slice()},c.rangeRound=function(d){return t=Array.from(d),e=mI,u()},c.clamp=function(d){return arguments.length?(o=d?!0:ln,u()):o!==ln},c.interpolate=function(d){return arguments.length?(e=d,u()):e},c.unknown=function(d){return arguments.length?(n=d,c):n},function(d,p){return i=d,s=p,u()}}function wy(){return LI()(ln,ln)}function GI(r,t,e,i){var s=Hc(r,t,e),n;switch(i=wh(i??",f"),i.type){case"s":{var o=Math.max(Math.abs(r),Math.abs(t));return i.precision==null&&!isNaN(n=EI(s,o))&&(i.precision=n),xy(i,o)}case"":case"e":case"g":case"p":case"r":{i.precision==null&&!isNaN(n=CI(s,Math.max(Math.abs(r),Math.abs(t))))&&(i.precision=n-(i.type==="e"));break}case"f":case"%":{i.precision==null&&!isNaN(n=SI(s))&&(i.precision=n-(i.type==="%")*2);break}}return by(i)}function NI(r){var t=r.domain;return r.ticks=function(e){var i=t();return HC(i[0],i[i.length-1],e??10)},r.tickFormat=function(e,i){var s=t();return GI(s[0],s[s.length-1],e??10,i)},r.nice=function(e){e==null&&(e=10);var i=t(),s=0,n=i.length-1,o=i[s],a=i[n],h,l,u=10;for(a<o&&(l=o,o=a,a=l,l=s,s=n,n=l);u-- >0;){if(l=Vc(o,a,e),l===h)return i[s]=o,i[n]=a,t(i);if(l>0)o=Math.floor(o/l)*l,a=Math.ceil(a/l)*l;else if(l<0)o=Math.ceil(o*l)/l,a=Math.floor(a*l)/l;else break;h=l}return r},r}function Sy(){var r=wy();return r.copy=function(){return Ty(r,Sy())},_y.apply(r,arguments),NI(r)}function FI(r,t){r=r.slice();var e=0,i=r.length-1,s=r[e],n=r[i],o;return n<s&&(o=e,e=i,i=o,o=s,s=n,n=o),r[e]=t.floor(s),r[i]=t.ceil(n),r}const ed=new Date,id=new Date;function $t(r,t,e,i){function s(n){return r(n=arguments.length===0?new Date:new Date(+n)),n}return s.floor=n=>(r(n=new Date(+n)),n),s.ceil=n=>(r(n=new Date(n-1)),t(n,1),r(n),n),s.round=n=>{const o=s(n),a=s.ceil(n);return n-o<a-n?o:a},s.offset=(n,o)=>(t(n=new Date(+n),o==null?1:Math.floor(o)),n),s.range=(n,o,a)=>{const h=[];if(n=s.ceil(n),a=a==null?1:Math.floor(a),!(n<o)||!(a>0))return h;let l;do h.push(l=new Date(+n)),t(n,a),r(n);while(l<n&&n<o);return h},s.filter=n=>$t(o=>{if(o>=o)for(;r(o),!n(o);)o.setTime(o-1)},(o,a)=>{if(o>=o)if(a<0)for(;++a<=0;)for(;t(o,-1),!n(o););else for(;--a>=0;)for(;t(o,1),!n(o););}),e&&(s.count=(n,o)=>(ed.setTime(+n),id.setTime(+o),r(ed),r(id),Math.floor(e(ed,id))),s.every=n=>(n=Math.floor(n),!isFinite(n)||!(n>0)?null:n>1?s.filter(i?o=>i(o)%n===0:o=>s.count(0,o)%n===0):s)),s}const Eh=$t(()=>{},(r,t)=>{r.setTime(+r+t)},(r,t)=>t-r);Eh.every=r=>(r=Math.floor(r),!isFinite(r)||!(r>0)?null:r>1?$t(t=>{t.setTime(Math.floor(t/r)*r)},(t,e)=>{t.setTime(+t+e*r)},(t,e)=>(e-t)/r):Eh),Eh.range;const nr=1e3,Je=nr*60,or=Je*60,ar=or*24,rd=ar*7,Ey=ar*30,sd=ar*365,un=$t(r=>{r.setTime(r-r.getMilliseconds())},(r,t)=>{r.setTime(+r+t*nr)},(r,t)=>(t-r)/nr,r=>r.getUTCSeconds());un.range;const nd=$t(r=>{r.setTime(r-r.getMilliseconds()-r.getSeconds()*nr)},(r,t)=>{r.setTime(+r+t*Je)},(r,t)=>(t-r)/Je,r=>r.getMinutes());nd.range,$t(r=>{r.setUTCSeconds(0,0)},(r,t)=>{r.setTime(+r+t*Je)},(r,t)=>(t-r)/Je,r=>r.getUTCMinutes()).range;const od=$t(r=>{r.setTime(r-r.getMilliseconds()-r.getSeconds()*nr-r.getMinutes()*Je)},(r,t)=>{r.setTime(+r+t*or)},(r,t)=>(t-r)/or,r=>r.getHours());od.range,$t(r=>{r.setUTCMinutes(0,0,0)},(r,t)=>{r.setTime(+r+t*or)},(r,t)=>(t-r)/or,r=>r.getUTCHours()).range;const xo=$t(r=>r.setHours(0,0,0,0),(r,t)=>r.setDate(r.getDate()+t),(r,t)=>(t-r-(t.getTimezoneOffset()-r.getTimezoneOffset())*Je)/ar,r=>r.getDate()-1);xo.range;const ad=$t(r=>{r.setUTCHours(0,0,0,0)},(r,t)=>{r.setUTCDate(r.getUTCDate()+t)},(r,t)=>(t-r)/ar,r=>r.getUTCDate()-1);ad.range,$t(r=>{r.setUTCHours(0,0,0,0)},(r,t)=>{r.setUTCDate(r.getUTCDate()+t)},(r,t)=>(t-r)/ar,r=>Math.floor(r/ar)).range;function gs(r){return $t(t=>{t.setDate(t.getDate()-(t.getDay()+7-r)%7),t.setHours(0,0,0,0)},(t,e)=>{t.setDate(t.getDate()+e*7)},(t,e)=>(e-t-(e.getTimezoneOffset()-t.getTimezoneOffset())*Je)/rd)}const Ch=gs(0),Ih=gs(1),DI=gs(2),kI=gs(3),cn=gs(4),OI=gs(5),BI=gs(6);Ch.range,Ih.range,DI.range,kI.range,cn.range,OI.range,BI.range;function ys(r){return $t(t=>{t.setUTCDate(t.getUTCDate()-(t.getUTCDay()+7-r)%7),t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCDate(t.getUTCDate()+e*7)},(t,e)=>(e-t)/rd)}const Cy=ys(0),Ah=ys(1),WI=ys(2),UI=ys(3),dn=ys(4),XI=ys(5),ZI=ys(6);Cy.range,Ah.range,WI.range,UI.range,dn.range,XI.range,ZI.range;const hd=$t(r=>{r.setDate(1),r.setHours(0,0,0,0)},(r,t)=>{r.setMonth(r.getMonth()+t)},(r,t)=>t.getMonth()-r.getMonth()+(t.getFullYear()-r.getFullYear())*12,r=>r.getMonth());hd.range,$t(r=>{r.setUTCDate(1),r.setUTCHours(0,0,0,0)},(r,t)=>{r.setUTCMonth(r.getUTCMonth()+t)},(r,t)=>t.getUTCMonth()-r.getUTCMonth()+(t.getUTCFullYear()-r.getUTCFullYear())*12,r=>r.getUTCMonth()).range;const hr=$t(r=>{r.setMonth(0,1),r.setHours(0,0,0,0)},(r,t)=>{r.setFullYear(r.getFullYear()+t)},(r,t)=>t.getFullYear()-r.getFullYear(),r=>r.getFullYear());hr.every=r=>!isFinite(r=Math.floor(r))||!(r>0)?null:$t(t=>{t.setFullYear(Math.floor(t.getFullYear()/r)*r),t.setMonth(0,1),t.setHours(0,0,0,0)},(t,e)=>{t.setFullYear(t.getFullYear()+e*r)}),hr.range;const bs=$t(r=>{r.setUTCMonth(0,1),r.setUTCHours(0,0,0,0)},(r,t)=>{r.setUTCFullYear(r.getUTCFullYear()+t)},(r,t)=>t.getUTCFullYear()-r.getUTCFullYear(),r=>r.getUTCFullYear());bs.every=r=>!isFinite(r=Math.floor(r))||!(r>0)?null:$t(t=>{t.setUTCFullYear(Math.floor(t.getUTCFullYear()/r)*r),t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCFullYear(t.getUTCFullYear()+e*r)}),bs.range;function VI(r,t,e,i,s,n){const o=[[un,1,nr],[un,5,5*nr],[un,15,15*nr],[un,30,30*nr],[n,1,Je],[n,5,5*Je],[n,15,15*Je],[n,30,30*Je],[s,1,or],[s,3,3*or],[s,6,6*or],[s,12,12*or],[i,1,ar],[i,2,2*ar],[e,1,rd],[t,1,Ey],[t,3,3*Ey],[r,1,sd]];function a(l,u,c){const d=u<l;d&&([l,u]=[u,l]);const p=c&&typeof c.range=="function"?c:h(l,u,c),m=p?p.range(l,+u+1):[];return d?m.reverse():m}function h(l,u,c){const d=Math.abs(u-l)/c,p=Zc(([,,g])=>g).right(o,d);if(p===o.length)return r.every(Hc(l/sd,u/sd,c));if(p===0)return Eh.every(Math.max(Hc(l,u,c),1));const[m,f]=o[d/o[p-1][2]<o[p][2]/d?p-1:p];return m.every(f)}return[a,h]}const[HI,KI]=VI(hr,hd,Ch,xo,od,nd);function ld(r){if(0<=r.y&&r.y<100){var t=new Date(-1,r.m,r.d,r.H,r.M,r.S,r.L);return t.setFullYear(r.y),t}return new Date(r.y,r.m,r.d,r.H,r.M,r.S,r.L)}function ud(r){if(0<=r.y&&r.y<100){var t=new Date(Date.UTC(-1,r.m,r.d,r.H,r.M,r.S,r.L));return t.setUTCFullYear(r.y),t}return new Date(Date.UTC(r.y,r.m,r.d,r.H,r.M,r.S,r.L))}function _o(r,t,e){return{y:r,m:t,d:e,H:0,M:0,S:0,L:0}}function YI(r){var t=r.dateTime,e=r.date,i=r.time,s=r.periods,n=r.days,o=r.shortDays,a=r.months,h=r.shortMonths,l=vo(s),u=To(s),c=vo(n),d=To(n),p=vo(o),m=To(o),f=vo(a),g=To(a),y=vo(h),_=To(h),x={a:U,A:K,b:ht,B:X,c:null,d:Ly,e:Ly,f:gA,g:CA,G:AA,H:pA,I:fA,j:mA,L:Gy,m:yA,M:bA,p:W,q:j,Q:By,s:Wy,S:xA,u:_A,U:vA,V:TA,w:wA,W:SA,x:null,X:null,y:EA,Y:IA,Z:MA,"%":Oy},v={a:q,A:pt,b:at,B:It,c:null,d:Fy,e:Fy,f:GA,g:ZA,G:HA,H:RA,I:PA,j:LA,L:Dy,m:NA,M:FA,p:Nt,q:wt,Q:By,s:Wy,S:DA,u:kA,U:OA,V:BA,w:WA,W:UA,x:null,X:null,y:XA,Y:VA,Z:KA,"%":Oy},S={a:k,A:M,b:G,B:E,c:N,d:Ry,e:Ry,f:lA,g:My,G:Ay,H:Py,I:Py,j:nA,L:hA,m:sA,M:oA,p:L,q:rA,Q:cA,s:dA,S:aA,u:QI,U:qI,V:tA,w:$I,W:eA,x:O,X:Z,y:My,Y:Ay,Z:iA,"%":uA};x.x=C(e,x),x.X=C(i,x),x.c=C(t,x),v.x=C(e,v),v.X=C(i,v),v.c=C(t,v);function C(Y,et){return function(Q){var F=[],yt=-1,mt=0,Mt=Y.length,Ut,Fe,ci;for(Q instanceof Date||(Q=new Date(+Q));++yt<Mt;)Y.charCodeAt(yt)===37&&(F.push(Y.slice(mt,yt)),(Fe=Iy[Ut=Y.charAt(++yt)])!=null?Ut=Y.charAt(++yt):Fe=Ut==="e"?" ":"0",(ci=et[Ut])&&(Ut=ci(Q,Fe)),F.push(Ut),mt=yt+1);return F.push(Y.slice(mt,yt)),F.join("")}}function A(Y,et){return function(Q){var F=_o(1900,void 0,1),yt=I(F,Y,Q+="",0),mt,Mt;if(yt!=Q.length)return null;if("Q"in F)return new Date(F.Q);if("s"in F)return new Date(F.s*1e3+("L"in F?F.L:0));if(et&&!("Z"in F)&&(F.Z=0),"p"in F&&(F.H=F.H%12+F.p*12),F.m===void 0&&(F.m="q"in F?F.q:0),"V"in F){if(F.V<1||F.V>53)return null;"w"in F||(F.w=1),"Z"in F?(mt=ud(_o(F.y,0,1)),Mt=mt.getUTCDay(),mt=Mt>4||Mt===0?Ah.ceil(mt):Ah(mt),mt=ad.offset(mt,(F.V-1)*7),F.y=mt.getUTCFullYear(),F.m=mt.getUTCMonth(),F.d=mt.getUTCDate()+(F.w+6)%7):(mt=ld(_o(F.y,0,1)),Mt=mt.getDay(),mt=Mt>4||Mt===0?Ih.ceil(mt):Ih(mt),mt=xo.offset(mt,(F.V-1)*7),F.y=mt.getFullYear(),F.m=mt.getMonth(),F.d=mt.getDate()+(F.w+6)%7)}else("W"in F||"U"in F)&&("w"in F||(F.w="u"in F?F.u%7:"W"in F?1:0),Mt="Z"in F?ud(_o(F.y,0,1)).getUTCDay():ld(_o(F.y,0,1)).getDay(),F.m=0,F.d="W"in F?(F.w+6)%7+F.W*7-(Mt+5)%7:F.w+F.U*7-(Mt+6)%7);return"Z"in F?(F.H+=F.Z/100|0,F.M+=F.Z%100,ud(F)):ld(F)}}function I(Y,et,Q,F){for(var yt=0,mt=et.length,Mt=Q.length,Ut,Fe;yt<mt;){if(F>=Mt)return-1;if(Ut=et.charCodeAt(yt++),Ut===37){if(Ut=et.charAt(yt++),Fe=S[Ut in Iy?et.charAt(yt++):Ut],!Fe||(F=Fe(Y,Q,F))<0)return-1}else if(Ut!=Q.charCodeAt(F++))return-1}return F}function L(Y,et,Q){var F=l.exec(et.slice(Q));return F?(Y.p=u.get(F[0].toLowerCase()),Q+F[0].length):-1}function k(Y,et,Q){var F=p.exec(et.slice(Q));return F?(Y.w=m.get(F[0].toLowerCase()),Q+F[0].length):-1}function M(Y,et,Q){var F=c.exec(et.slice(Q));return F?(Y.w=d.get(F[0].toLowerCase()),Q+F[0].length):-1}function G(Y,et,Q){var F=y.exec(et.slice(Q));return F?(Y.m=_.get(F[0].toLowerCase()),Q+F[0].length):-1}function E(Y,et,Q){var F=f.exec(et.slice(Q));return F?(Y.m=g.get(F[0].toLowerCase()),Q+F[0].length):-1}function N(Y,et,Q){return I(Y,t,et,Q)}function O(Y,et,Q){return I(Y,e,et,Q)}function Z(Y,et,Q){return I(Y,i,et,Q)}function U(Y){return o[Y.getDay()]}function K(Y){return n[Y.getDay()]}function ht(Y){return h[Y.getMonth()]}function X(Y){return a[Y.getMonth()]}function W(Y){return s[+(Y.getHours()>=12)]}function j(Y){return 1+~~(Y.getMonth()/3)}function q(Y){return o[Y.getUTCDay()]}function pt(Y){return n[Y.getUTCDay()]}function at(Y){return h[Y.getUTCMonth()]}function It(Y){return a[Y.getUTCMonth()]}function Nt(Y){return s[+(Y.getUTCHours()>=12)]}function wt(Y){return 1+~~(Y.getUTCMonth()/3)}return{format:function(Y){var et=C(Y+="",x);return et.toString=function(){return Y},et},parse:function(Y){var et=A(Y+="",!1);return et.toString=function(){return Y},et},utcFormat:function(Y){var et=C(Y+="",v);return et.toString=function(){return Y},et},utcParse:function(Y){var et=A(Y+="",!0);return et.toString=function(){return Y},et}}}var Iy={"-":"",_:" ",0:"0"},se=/^\s*\d+/,zI=/^%/,jI=/[\\^$*+?|[\]().{}]/g;function Et(r,t,e){var i=r<0?"-":"",s=(i?-r:r)+"",n=s.length;return i+(n<e?new Array(e-n+1).join(t)+s:s)}function JI(r){return r.replace(jI,"\\$&")}function vo(r){return new RegExp("^(?:"+r.map(JI).join("|")+")","i")}function To(r){return new Map(r.map((t,e)=>[t.toLowerCase(),e]))}function $I(r,t,e){var i=se.exec(t.slice(e,e+1));return i?(r.w=+i[0],e+i[0].length):-1}function QI(r,t,e){var i=se.exec(t.slice(e,e+1));return i?(r.u=+i[0],e+i[0].length):-1}function qI(r,t,e){var i=se.exec(t.slice(e,e+2));return i?(r.U=+i[0],e+i[0].length):-1}function tA(r,t,e){var i=se.exec(t.slice(e,e+2));return i?(r.V=+i[0],e+i[0].length):-1}function eA(r,t,e){var i=se.exec(t.slice(e,e+2));return i?(r.W=+i[0],e+i[0].length):-1}function Ay(r,t,e){var i=se.exec(t.slice(e,e+4));return i?(r.y=+i[0],e+i[0].length):-1}function My(r,t,e){var i=se.exec(t.slice(e,e+2));return i?(r.y=+i[0]+(+i[0]>68?1900:2e3),e+i[0].length):-1}function iA(r,t,e){var i=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(t.slice(e,e+6));return i?(r.Z=i[1]?0:-(i[2]+(i[3]||"00")),e+i[0].length):-1}function rA(r,t,e){var i=se.exec(t.slice(e,e+1));return i?(r.q=i[0]*3-3,e+i[0].length):-1}function sA(r,t,e){var i=se.exec(t.slice(e,e+2));return i?(r.m=i[0]-1,e+i[0].length):-1}function Ry(r,t,e){var i=se.exec(t.slice(e,e+2));return i?(r.d=+i[0],e+i[0].length):-1}function nA(r,t,e){var i=se.exec(t.slice(e,e+3));return i?(r.m=0,r.d=+i[0],e+i[0].length):-1}function Py(r,t,e){var i=se.exec(t.slice(e,e+2));return i?(r.H=+i[0],e+i[0].length):-1}function oA(r,t,e){var i=se.exec(t.slice(e,e+2));return i?(r.M=+i[0],e+i[0].length):-1}function aA(r,t,e){var i=se.exec(t.slice(e,e+2));return i?(r.S=+i[0],e+i[0].length):-1}function hA(r,t,e){var i=se.exec(t.slice(e,e+3));return i?(r.L=+i[0],e+i[0].length):-1}function lA(r,t,e){var i=se.exec(t.slice(e,e+6));return i?(r.L=Math.floor(i[0]/1e3),e+i[0].length):-1}function uA(r,t,e){var i=zI.exec(t.slice(e,e+1));return i?e+i[0].length:-1}function cA(r,t,e){var i=se.exec(t.slice(e));return i?(r.Q=+i[0],e+i[0].length):-1}function dA(r,t,e){var i=se.exec(t.slice(e));return i?(r.s=+i[0],e+i[0].length):-1}function Ly(r,t){return Et(r.getDate(),t,2)}function pA(r,t){return Et(r.getHours(),t,2)}function fA(r,t){return Et(r.getHours()%12||12,t,2)}function mA(r,t){return Et(1+xo.count(hr(r),r),t,3)}function Gy(r,t){return Et(r.getMilliseconds(),t,3)}function gA(r,t){return Gy(r,t)+"000"}function yA(r,t){return Et(r.getMonth()+1,t,2)}function bA(r,t){return Et(r.getMinutes(),t,2)}function xA(r,t){return Et(r.getSeconds(),t,2)}function _A(r){var t=r.getDay();return t===0?7:t}function vA(r,t){return Et(Ch.count(hr(r)-1,r),t,2)}function Ny(r){var t=r.getDay();return t>=4||t===0?cn(r):cn.ceil(r)}function TA(r,t){return r=Ny(r),Et(cn.count(hr(r),r)+(hr(r).getDay()===4),t,2)}function wA(r){return r.getDay()}function SA(r,t){return Et(Ih.count(hr(r)-1,r),t,2)}function EA(r,t){return Et(r.getFullYear()%100,t,2)}function CA(r,t){return r=Ny(r),Et(r.getFullYear()%100,t,2)}function IA(r,t){return Et(r.getFullYear()%1e4,t,4)}function AA(r,t){var e=r.getDay();return r=e>=4||e===0?cn(r):cn.ceil(r),Et(r.getFullYear()%1e4,t,4)}function MA(r){var t=r.getTimezoneOffset();return(t>0?"-":(t*=-1,"+"))+Et(t/60|0,"0",2)+Et(t%60,"0",2)}function Fy(r,t){return Et(r.getUTCDate(),t,2)}function RA(r,t){return Et(r.getUTCHours(),t,2)}function PA(r,t){return Et(r.getUTCHours()%12||12,t,2)}function LA(r,t){return Et(1+ad.count(bs(r),r),t,3)}function Dy(r,t){return Et(r.getUTCMilliseconds(),t,3)}function GA(r,t){return Dy(r,t)+"000"}function NA(r,t){return Et(r.getUTCMonth()+1,t,2)}function FA(r,t){return Et(r.getUTCMinutes(),t,2)}function DA(r,t){return Et(r.getUTCSeconds(),t,2)}function kA(r){var t=r.getUTCDay();return t===0?7:t}function OA(r,t){return Et(Cy.count(bs(r)-1,r),t,2)}function ky(r){var t=r.getUTCDay();return t>=4||t===0?dn(r):dn.ceil(r)}function BA(r,t){return r=ky(r),Et(dn.count(bs(r),r)+(bs(r).getUTCDay()===4),t,2)}function WA(r){return r.getUTCDay()}function UA(r,t){return Et(Ah.count(bs(r)-1,r),t,2)}function XA(r,t){return Et(r.getUTCFullYear()%100,t,2)}function ZA(r,t){return r=ky(r),Et(r.getUTCFullYear()%100,t,2)}function VA(r,t){return Et(r.getUTCFullYear()%1e4,t,4)}function HA(r,t){var e=r.getUTCDay();return r=e>=4||e===0?dn(r):dn.ceil(r),Et(r.getUTCFullYear()%1e4,t,4)}function KA(){return"+0000"}function Oy(){return"%"}function By(r){return+r}function Wy(r){return Math.floor(+r/1e3)}var pn,Uy;YA({dateTime:"%x, %X",date:"%-m/%-d/%Y",time:"%-I:%M:%S %p",periods:["AM","PM"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]});function YA(r){return pn=YI(r),Uy=pn.format,pn.parse,pn.utcFormat,pn.utcParse,pn}function zA(r){return new Date(r)}function jA(r){return r instanceof Date?+r:+new Date(+r)}function Xy(r,t,e,i,s,n,o,a,h,l){var u=wy(),c=u.invert,d=u.domain,p=l(".%L"),m=l(":%S"),f=l("%I:%M"),g=l("%I %p"),y=l("%a %d"),_=l("%b %d"),x=l("%B"),v=l("%Y");function S(C){return(h(C)<C?p:a(C)<C?m:o(C)<C?f:n(C)<C?g:i(C)<C?s(C)<C?y:_:e(C)<C?x:v)(C)}return u.invert=function(C){return new Date(c(C))},u.domain=function(C){return arguments.length?d(Array.from(C,jA)):d().map(zA)},u.ticks=function(C){var A=d();return r(A[0],A[A.length-1],C??10)},u.tickFormat=function(C,A){return A==null?S:l(A)},u.nice=function(C){var A=d();return(!C||typeof C.range!="function")&&(C=t(A[0],A[A.length-1],C??10)),C?d(FI(A,C)):u},u.copy=function(){return Ty(u,Xy(r,t,e,i,s,n,o,a,h,l))},u}function JA(){return _y.apply(Xy(HI,KI,hr,hd,Ch,xo,od,nd,un,Uy).domain([new Date(2e3,0,1),new Date(2e3,0,2)]),arguments)}function wo(r,t,e){this.k=r,this.x=t,this.y=e}wo.prototype={constructor:wo,scale:function(r){return r===1?this:new wo(this.k*r,this.x,this.y)},translate:function(r,t){return r===0&t===0?this:new wo(this.k,this.x+this.k*r,this.y+this.k*t)},apply:function(r){return[r[0]*this.k+this.x,r[1]*this.k+this.y]},applyX:function(r){return r*this.k+this.x},applyY:function(r){return r*this.k+this.y},invert:function(r){return[(r[0]-this.x)/this.k,(r[1]-this.y)/this.k]},invertX:function(r){return(r-this.x)/this.k},invertY:function(r){return(r-this.y)/this.k},rescaleX:function(r){return r.copy().domain(r.range().map(this.invertX,this).map(r.invert,r))},rescaleY:function(r){return r.copy().domain(r.range().map(this.invertY,this).map(r.invert,r))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}},wo.prototype;function Zy(r){return r.mode==="temporal"?$A(r):QA(r)}function $A({domain:r,range:t}){return JA().domain(r).range(t)}function QA({domain:r,range:t}){return Sy().domain(r).range(t)}function cd(r){return{mode:_t.horizontal,range:nR(),domain:oR(r)}}function qA(){return{mode:_t.vertical}}let fn=null;async function tM(){const r=await gb();Vy(r.start_time),Ct.on("layoutSettingsUpdated",()=>Vy(r.start_time))}function eM(){fn=null}async function Mh(){return fn||await Be("scaleCreated")}async function Vy(r){await _s();const t=fn?"scaleUpdated":"scaleCreated",e=cd(r);fn=Zy(e),Ct.emit(t,fn)}let Ge=null,dd=null;async function iM(){const r=await li(),t=await Xc();Ge=new DC({screenHeight:t.clientHeight,screenWidth:t.clientWidth,events:r.renderer.events,passiveWheel:!1,ticker:r.ticker}),Ge.zIndex=1,Ge.drag().pinch().wheel({trackpadPinch:!0}).decelerate({friction:.9}),r.stage.addChild(Ge),Ct.emit("viewportCreated",Ge),Ct.on("applicationResized",aM),Ct.on("scaleUpdated",()=>Rh()),nM()}function rM(){Ge=null,dd=null}async function pd({animate:r}={}){const t=await Ne(),e=await Ce(),i=t.getChildByName(fp);if(!i)throw new Error("Nodes container not found");uM();const{x:s,y:n,width:o,height:a}=i.getLocalBounds(),h=o+e.styles.columnGap*2,l=a+e.styles.rowGap*2,u=t.findFit(h,l);!o||!a||t.animate({position:{x:s+o/2,y:n+a/2},scale:u,time:r?e.animationDuration:0,ease:"easeInOutQuad",removeOnInterrupt:!0,callbackOnComplete:()=>{fd(),Rh()}})}async function Ne(){return Ge||await Be("viewportCreated")}function Hy(r){$0(dd,r)||(dd=r,Ct.emit("viewportDateRangeUpdated",r))}function sM({xOffset:r,yOffset:t}){if(!Ge)return;const{x:e,y:i}=Ge.transform.position;Ge.setTransform(e+r,i+t,Ge.transform.scale.x,Ge.transform.scale.y)}async function nM(){const r=await Ne();Rh(),r.on("moved",()=>Rh())}async function Rh(){const r=await Ky();r&&Hy(r)}async function Ky(){const r=await Ne(),t=await Mh(),e=t.invert(r.left),i=t.invert(r.right);return e instanceof Date&&i instanceof Date?[e,i]:null}async function oM(r){const t=await Ky(),e=await _s();if(r===void 0||e.isDependency()||$0(r,t))return;const i=await Ne(),s=await Mh(),[n,o]=r,a=s(n),h=s(o),l=a+(h-a)/2;Hy(r),i.fitWidth(h-a,!0),i.moveCenter(l,i.center.y)}async function aM(){const r=await li(),t=await Ne(),e=await Xc(),i=t.screenWidth,s=t.screenHeight,n=e.clientWidth,o=e.clientHeight,a=(n-i)/2,h=(o-s)/2;t.resize(r.screen.width,r.screen.height),sM({xOffset:a,yOffset:h})}let Ni=null;async function hM(){const r=await Ne(),t=await li();Ni=new QE({toggle:"renderable"}),t.ticker.add(()=>{r.dirty&&(Ni==null||Ni.cull(t.renderer.screen),r.dirty=!1)}),Ct.emit("cullCreated",Ni)}function lM(){Ni=null}async function fd(){const r=await Ne();r.dirty=!0}function uM(){Ni&&Ni.uncull()}async function md(){return Ni||await Be("cullCreated")}async function Yy(){const r=await _s(),t=await Ce();function e(i,s,n){const a=r.disableAnimations||n?0:t.animationDuration/1e3;return j0.to(i,{...s,duration:a,ease:"power1.out",onUpdate:()=>{fd()}})}return{animate:e}}async function cM({size:r,stroke:t=1,radius:e=0}){const i=await li(),s=new Qn;return s.lineStyle(t,"#fff",1,0),s.drawRoundedRect(0,0,r*2,r*2,e),i.renderer.generateTexture(s,{region:new ct(0,0,r,r),resolution:10})}async function zy(r){return(await gi.useSubscription(cM,[r]).promise()).response}var Ph=(r=>(r[r.Up=0]="Up",r[r.Down=180]="Down",r[r.Left=270]="Left",r[r.Right=90]="Right",r))(Ph||{});function jy(){const r=new ie;async function t(e){const{rotate:i=0}=e,s={size:e.size,radius:e.radius,stroke:e.stroke},n=await zy(s);return r.texture=n,r.anchor.set(.5,.5),r.angle=45+i,r}return{element:r,render:t}}class Jy{constructor(){op(this,"status","visible");op(this,"labels",new Set)}get visible(){return this.status==="visible"}get hidden(){return this.status==="hidden"}show(){if(this.status!=="visible"){for(const t of this.labels)t.visible=!0;this.status="visible"}}hide(){if(this.status!=="hidden"){for(const t of this.labels)t.visible=!1;this.status="hidden"}}toggle(t){t?this.show():this.hide()}add(t){this.labels.add(t),t.visible=this.visible}clear(){this.labels.clear()}}let Fi=null;async function dM(){const r=await Ne(),t=await li();Fi=new Jy,t.ticker.add(()=>{if(r.dirty){const e=r.scale.x>.1;Fi==null||Fi.toggle(e)}})}function pM(){Fi==null||Fi.clear(),Fi=null}async function fM(){return Fi||await Be("edgeCullCreated")}async function mM(){const r=await li(),t=new Qn;return t.beginFill("#fff"),t.drawRect(0,0,1,1),t.endFill(),r.renderer.generateTexture(t)}async function gd(){return(await gi.useSubscription(mM).promise()).response}function yd(r,t){return Array.from({length:r},(e,i)=>t(i))}const gM=8,yM=2;async function bM(){const r=await Ce(),t=await md(),e=await fM(),{animate:i}=await Yy(),s=new Xt,{element:n,render:o}=await jy(),a=await gd(),h=yd(20,()=>new lt),l=new aS(a,h);let u=!1;s.name=Sb,s.addChild(n),s.addChild(l),t.addAll([n,l]),e.add(s);async function c(){return await o({size:10,rotate:Ph.Right}),n.tint=r.styles.edgeColor,l.tint=r.styles.edgeColor,s}async function d(m,f){const g=p(f);u||await c();for(const[y,_]of h.entries()){const{x,y:v}=g[y];i(_,{x,y:v},!u)}i(s,{x:m.x,y:m.y},!u),i(n,{x:f.x-gM,y:f.y},!u),u=!0}function p({x:m,y:f}){const g=[],y={x:0,y:0},_={x:m-yM,y:f},x={x:$y(y.x,{source:y,target:_}),y:y.y},v={x:$y(_.x,{source:y,target:_},!0),y:_.y};for(const[S]of h.entries()){if(S===h.length-1){g[S]=_;continue}const C=xM(S,{source:y,target:_,sourceBezier:x,targetBezier:v});g[S]=C}return g}return{element:s,render:c,setPosition:d}}function $y(r,{source:t,target:e},i){const s=(e.x-t.x)/2;return r+(s>64?s:64)*(i?-1:1)}function xM(r,t){const e=r/20,{source:i,target:s,sourceBezier:n,targetBezier:o}=t,a=i.x+(n.x-i.x)*e,h=i.y+(n.y-i.y)*e,l=n.x+(o.x-n.x)*e,u=n.y+(o.y-n.y)*e,c=o.x+(s.x-o.x)*e,d=o.y+(s.y-o.y)*e,p=a+(l-a)*e,m=h+(u-h)*e,f=l+(c-l)*e,g=u+(d-u)*e,y=p+(f-p)*e,_=m+(g-m)*e;return{x:y,y:_}}function bd(){const r=new Xt,t=new ie,e=new ie,i=new ie,s=new ie,n=new ie,o=new ie,a=new ie,h=new ie;t.name="border-corner-top-left",e.name="border-corner-top-right",i.name="border-corner-bottom-left",s.name="border-corner-bottom-right",n.name="border-corner-left",o.name="border-corner-right",a.name="border-corner-top",h.name="border-corner-bottom",e.anchor.x=1,e.scale.x=-1,i.anchor.y=1,i.scale.y=-1,s.anchor.x=1,s.scale.x=-1,s.anchor.y=1,s.scale.y=-1,r.addChild(t),r.addChild(e),r.addChild(i),r.addChild(s),r.addChild(n),r.addChild(o),r.addChild(a),r.addChild(h);async function l(p){const{radius:m=0,color:f="#fff",stroke:g,width:y,height:_}=p,x=Math.min(y,_),v=m*2>x?x/2:m,C=await zy({size:v,radius:m,stroke:g}),A=await gd();return u({texture:C,width:y,height:_,size:v}),c({texture:A,width:y,height:_,size:v,stroke:g}),d(f),r}function u({texture:p,width:m,height:f,size:g}){t.texture=p,e.texture=p,i.texture=p,s.texture=p,t.position.set(0,0),e.position.set(m-g,0),i.position.set(0,f-g),s.position.set(m-g,f-g)}function c({texture:p,size:m,width:f,height:g,stroke:y}){const _=Math.max(g-m*2,0),x=Math.max(f-m*2,0);a.texture=p,n.texture=p,o.texture=p,h.texture=p,n.position.set(0,m),n.height=_,n.width=y,o.position.set(f-y,m),o.height=_,o.width=y,a.position.set(m,0),a.width=x,a.height=y,h.position.set(m,g-y),h.width=x,h.height=y}function d(p){t.tint=p,e.tint=p,i.tint=p,s.tint=p,a.tint=p,n.tint=p,o.tint=p,h.tint=p}return{element:r,render:l}}var Qy={exports:{}};(function(r){(function(){function t(f,g){document.addEventListener?f.addEventListener("scroll",g,!1):f.attachEvent("scroll",g)}function e(f){document.body?f():document.addEventListener?document.addEventListener("DOMContentLoaded",function g(){document.removeEventListener("DOMContentLoaded",g),f()}):document.attachEvent("onreadystatechange",function g(){(document.readyState=="interactive"||document.readyState=="complete")&&(document.detachEvent("onreadystatechange",g),f())})}function i(f){this.g=document.createElement("div"),this.g.setAttribute("aria-hidden","true"),this.g.appendChild(document.createTextNode(f)),this.h=document.createElement("span"),this.i=document.createElement("span"),this.m=document.createElement("span"),this.j=document.createElement("span"),this.l=-1,this.h.style.cssText="max-width:none;display:inline-block;position:absolute;height:100%;width:100%;overflow:scroll;font-size:16px;",this.i.style.cssText="max-width:none;display:inline-block;position:absolute;height:100%;width:100%;overflow:scroll;font-size:16px;",this.j.style.cssText="max-width:none;display:inline-block;position:absolute;height:100%;width:100%;overflow:scroll;font-size:16px;",this.m.style.cssText="display:inline-block;width:200%;height:200%;font-size:16px;max-width:none;",this.h.appendChild(this.m),this.i.appendChild(this.j),this.g.appendChild(this.h),this.g.appendChild(this.i)}function s(f,g){f.g.style.cssText="max-width:none;min-width:20px;min-height:20px;display:inline-block;overflow:hidden;position:absolute;width:auto;margin:0;padding:0;top:-999px;white-space:nowrap;font-synthesis:none;font:"+g+";"}function n(f){var g=f.g.offsetWidth,y=g+100;return f.j.style.width=y+"px",f.i.scrollLeft=y,f.h.scrollLeft=f.h.scrollWidth+100,f.l!==g?(f.l=g,!0):!1}function o(f,g){function y(){var x=_;n(x)&&x.g.parentNode!==null&&g(x.l)}var _=f;t(f.h,y),t(f.i,y),n(f)}function a(f,g,y){g=g||{},y=y||window,this.family=f,this.style=g.style||"normal",this.weight=g.weight||"normal",this.stretch=g.stretch||"normal",this.context=y}var h=null,l=null,u=null,c=null;function d(f){return l===null&&(p(f)&&/Apple/.test(window.navigator.vendor)?(f=/AppleWebKit\/([0-9]+)(?:\.([0-9]+))(?:\.([0-9]+))/.exec(window.navigator.userAgent),l=!!f&&603>parseInt(f[1],10)):l=!1),l}function p(f){return c===null&&(c=!!f.document.fonts),c}function m(f,g){var y=f.style,_=f.weight;if(u===null){var x=document.createElement("div");try{x.style.font="condensed 100px sans-serif"}catch{}u=x.style.font!==""}return[y,_,u?f.stretch:"","100px",g].join(" ")}a.prototype.load=function(f,g){var y=this,_=f||"BESbswy",x=0,v=g||3e3,S=new Date().getTime();return new Promise(function(C,A){if(p(y.context)&&!d(y.context)){var I=new Promise(function(k,M){function G(){new Date().getTime()-S>=v?M(Error(""+v+"ms timeout exceeded")):y.context.document.fonts.load(m(y,'"'+y.family+'"'),_).then(function(E){1<=E.length?k():setTimeout(G,25)},M)}G()}),L=new Promise(function(k,M){x=setTimeout(function(){M(Error(""+v+"ms timeout exceeded"))},v)});Promise.race([L,I]).then(function(){clearTimeout(x),C(y)},A)}else e(function(){function k(){var j;(j=O!=-1&&Z!=-1||O!=-1&&U!=-1||Z!=-1&&U!=-1)&&((j=O!=Z&&O!=U&&Z!=U)||(h===null&&(j=/AppleWebKit\/([0-9]+)(?:\.([0-9]+))/.exec(window.navigator.userAgent),h=!!j&&(536>parseInt(j[1],10)||parseInt(j[1],10)===536&&11>=parseInt(j[2],10))),j=h&&(O==K&&Z==K&&U==K||O==ht&&Z==ht&&U==ht||O==X&&Z==X&&U==X)),j=!j),j&&(W.parentNode!==null&&W.parentNode.removeChild(W),clearTimeout(x),C(y))}function M(){if(new Date().getTime()-S>=v)W.parentNode!==null&&W.parentNode.removeChild(W),A(Error(""+v+"ms timeout exceeded"));else{var j=y.context.document.hidden;(j===!0||j===void 0)&&(O=G.g.offsetWidth,Z=E.g.offsetWidth,U=N.g.offsetWidth,k()),x=setTimeout(M,50)}}var G=new i(_),E=new i(_),N=new i(_),O=-1,Z=-1,U=-1,K=-1,ht=-1,X=-1,W=document.createElement("div");W.dir="ltr",s(G,m(y,"sans-serif")),s(E,m(y,"serif")),s(N,m(y,"monospace")),W.appendChild(G.g),W.appendChild(E.g),W.appendChild(N.g),y.context.document.body.appendChild(W),K=G.g.offsetWidth,ht=E.g.offsetWidth,X=N.g.offsetWidth,M(),o(G,function(j){O=j,k()}),s(G,m(y,'"'+y.family+'",sans-serif')),o(E,function(j){Z=j,k()}),s(E,m(y,'"'+y.family+'",serif')),o(N,function(j){U=j,k()}),s(N,m(y,'"'+y.family+'",monospace'))})})},r.exports=a})()})(Qy);var _M=Qy.exports;const vM=Ln(_M),qy={inter:{fontFamily:"InterVariable",fontSize:16,lineHeight:20,fill:16777215}},tb={resolution:4,chars:ai.ASCII},eb="sans-serif",ib={inter:EM(qy.inter)};let xd=!1;async function TM(){const r=Object.values(qy);await Promise.all(r.map(t=>wM(t))),xd=!0,Ct.emit("fontsLoaded",ib)}async function wM(r){const{fontFamily:t,...e}=r,i=new vM(t);try{await i.load()}catch(s){console.error(s),console.warn(`fonts: font ${t} failed to load, falling back to ${eb}`),ai.from(t,{fontFamily:eb,...e},tb);return}ai.from(t,r,tb)}function SM(){xd=!1}async function rb(){return xd?ib:await Be("fontsLoaded")}function EM(r){const{fontFamily:t,...e}=r,i={fontName:t,...e};return s=>new FS(s,i)}let Di=null;async function CM(){const r=await Ne(),t=await li();Di=new Jy,t.ticker.add(()=>{if(r.dirty){const e=r.scale.x>.2;Di==null||Di.toggle(e)}})}function IM(){Di==null||Di.clear(),Di=null}async function AM(){return Di||await Be("labelCullCreated")}async function sb(){const{inter:r}=await rb(),t=await AM(),e=r("");t.add(e);async function i(s){return e.text=s.label,await e}return{element:e,render:i}}async function MM({height:r,radius:t}){const e=await li(),i=new Qn;return i.beginFill("#fff"),i.drawRoundedRect(0,0,t*2,r,t),i.endFill(),e.renderer.generateTexture(i,{region:new ct(0,0,t,r),resolution:10})}async function RM(r){return(await gi.useSubscription(MM,[r]).promise()).response}function PM(){const r=new ie,t=new ie;async function e(i){const s=await RM(i);return r.texture=s,t.texture=s,t.anchor.x=1,t.scale.x=-1,{left:r,right:t}}return{left:r,right:t,render:e}}async function nb(){const r=await gd();return new ie(r)}async function ob(){const r=new Xt,t=await nb(),{left:e,right:i,render:s}=await PM();r.addChild(t),r.addChild(e),r.addChild(i);async function n(h){const{width:l,x:u,visible:c}=a(h);return await s({height:h.height,radius:h.radius}),t.visible=c,t.width=l,t.height=h.height,t.x=u,e.visible=o(h.capLeft,h.radius),i.visible=o(h.capRight,h.radius),i.x=h.radius+l,t.tint=h.background,e.tint=h.background,i.tint=h.background,r}function o(h,l){return l===0?!1:h??!0}function a(h){const l=o(h.capLeft,h.radius),u=o(h.capRight,h.radius);let c=0;l&&(c+=h.radius),u&&(c+=h.radius);const d=Math.max(h.width-c,0),p=d>0,m=l?h.radius:0;return{width:d,visible:p,x:m}}return{element:r,render:n}}async function LM(){const r=await Ce(),t=new Xt,{element:e,render:i}=await jy(),{element:s,render:n}=await ob(),{element:o,render:a}=await bd(),h=new Ra;t.eventMode="static",t.cursor="pointer",t.addChild(s),t.addChild(e),t.addChild(o),t.on("mouseover",u),t.on("mouseout",c),s.filters=[h],o.visible=!1;async function l({inside:d,isOpen:p,background:m}){const f={size:10,stroke:2,rotate:p?Ph.Up:Ph.Down},g=await i(f),y={width:r.styles.nodeToggleSize,height:r.styles.nodeToggleSize,background:d?m:"#333",radius:r.styles.nodeToggleBorderRadius},_=await n(y),x=await a({width:y.width,height:y.height,radius:y.radius,stroke:1,color:r.styles.nodeToggleBorderColor});x.alpha=d?0:1;const v={y:_.height/2,x:_.width/2},S=f.size/4;return g.x=v.x,g.y=p?v.y+S:v.y-S,t}function u(){h.brightness(.5,!1),o.visible=!0}function c(){h.brightness(1,!1),o.visible=!1}return{element:t,render:l}}let So=null,Lh=!1;async function GM(){const r=await Ne();r.on("click",()=>_d(null)),r.on("drag-start",()=>{Lh=!0}),r.on("drag-end",()=>{setTimeout(()=>{Lh=!1})})}function NM(){So=null,Lh=!1}function _d(r){if(Lh||vd(r))return;if(So=r,r===null){Ct.emit("nodeSelected",null);return}const{id:t,kind:e}=r;Ct.emit("nodeSelected",{id:t,kind:e})}function vd(r){return(r==null?void 0:r.id)===(So==null?void 0:So.id)}const Gh=4,FM=2;async function ab(){const r=await Ce(),t=new Xt,{element:e,render:i}=await ob(),{element:s,render:n}=await bd();t.addChild(e),s.position.set(-Gh,-Gh);async function o(l){const{background:u="#fff"}=r.styles.node(l),{nodeHeight:c,nodeRadius:d}=r.styles,p=h(l,d),m=l.state_type!=="RUNNING";return await i({width:p,height:c,radius:d,background:u,capRight:m}),await a(l,p,c),e}async function a(l,u,c){if(!vd(l)){t.removeChild(s);return}t.addChild(s),await n({stroke:FM,radius:r.styles.nodeBorderRadius,width:u+Gh*2,height:c+Gh*2,color:r.styles.nodeSelectedBorderColor})}function h(l,u){const c=Td();if(_t.isTemporal()){const d=l.start_time,p=l.end_time??new Date,f=yp(p,d)/Ib*c;return Math.max(f,u*2)}return c}return{element:t,render:o}}class hb extends Xt{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)this.children[t].updateTransform()}calculateBounds(){this._bounds.clear(),this._calculateBounds();for(const t of this.children)if(t.calculateBounds(),t._mask){const e=t._mask.isMaskData?t._mask.maskObject:t._mask;e?(e.calculateBounds(),this._bounds.addBoundsMask(t._bounds,e._bounds)):this._bounds.addBounds(t._bounds)}else t.filterArea?this._bounds.addBoundsArea(t._bounds,t.filterArea):this._bounds.addBounds(t._bounds);this._bounds.updateID=this._boundsID}}async function DM(r){const t=new hb,e=await Ce(),{element:i,render:s}=await ab(),{element:n,render:o}=await sb(),{element:a,render:h,getSize:l}=await mb(),{element:u,render:c}=await LM(),{element:d,render:p}=await bd(),{start:m,stop:f}=await Gg(r.id,M=>{h(M)});let g=r,y=!1;t.addChild(d),t.addChild(i),t.addChild(n),t.addChild(u),u.on("click",M=>{M.stopPropagation(),x()}),a.position={x:0,y:e.styles.nodeHeight+e.styles.nodesPadding},a.on("rendered",()=>{fd(),L()});async function _(M){return g=M,await s(M),await A(M),await I(M),await v(M),t}async function x(){y?await C():await S()}async function v(M){const{background:G="#fff"}=e.styles.node(M),E=4,{width:N,height:O}=l(),Z=O+e.styles.nodeHeight+e.styles.nodesPadding*2+E*2,U=e.styles.nodeHeight,K=y?-E:E,ht=Math.max(i.width,N),X=y?ht+E*2:i.width-E*2;(await p({width:X,height:y?Z:U,stroke:y?2:1,radius:e.styles.nodeBorderRadius,color:G})).position.set(K,K)}async function S(){y=!0,t.addChild(a),await Promise.all([m(),_(g)]),L()}async function C(){y=!1,t.removeChild(a),await Promise.all([f(),_(g)]),L()}async function A(M){const G=e.styles.nodeToggleSize,E=e.styles.nodeHeight-G,N=i.width>G,{background:O="#fff"}=e.styles.node(M),Z=await c({background:O,inside:N,isOpen:y});return Z.x=N?E/2:i.width+e.styles.nodePadding,Z.y=E/2,Z}async function I(M){const G=await o(M),E=e.styles.nodePadding,N=u.x+u.width+E,O=i.width+E,Z=i.width>N+G.width+E,U=e.styles.nodeHeight/2-G.height/2,K=Z?N:Math.max(O,N);return G.position={x:K,y:U},G}function L(){v(g);const M=k();t.emit("resized",M)}function k(){const M=l(),G=y?M.height+e.styles.nodesPadding*2:0,E=y?M.width:0;return{height:e.styles.nodeHeight+G,width:Math.max(E,t.width)}}return{kind:"flow-run",element:t,bar:i,render:_}}async function kM(){const r=new hb,{element:t,render:e}=await sb(),{element:i,render:s}=await ab();r.addChild(i),r.addChild(t);async function n(a){const h=await e(a),l=await s(a);return h.position=await o(h,l),r}async function o(a,h){const u=(await Ce()).styles.nodePadding,c=h.width>u+a.width+u,d=h.height/2-a.height/2;return c?{x:u,y:d}:{x:h.width+u,y:d}}return{kind:"task-run",element:r,render:n,bar:i}}async function OM(){const r=await li(),t=await Ne(),e=await _s(),i=await md(),s=await Ce(),{inter:n}=await rb(),o=new Xt;i.add(o);const a=await nb();o.addChild(a);const h=n("");o.addChild(h);let l=await Mh(),u,c;Ct.on("scaleUpdated",g=>l=g),r.ticker.add(()=>{e.disableGuides||(f(),o.height!==r.screen.height&&p())});function d(g,y){u=g,c=y,p(),m(g)}function p(){a.width=s.styles.guideLineWidth,a.height=r.screen.height,a.tint=s.styles.guideLineColor}function m(g){h.text=c(g),h.fontSize=s.styles.guideTextSize,h.tint=s.styles.guideTextColor,h.position.set(s.styles.guideTextLeftPadding,s.styles.guideTextTopPadding)}function f(){u!==void 0&&(o.position.x=l(u)*t.scale._x+t.worldTransform.tx)}return{element:o,render:d}}class lb extends Error{constructor(){super("Layout is not temporal")}}function BM(r){return r.toLocaleTimeString()}function ub(r){const t=navigator.language;return new Intl.DateTimeFormat(t,{timeStyle:"short"}).format(r)}function WM(r){const t=navigator.language;return new Intl.DateTimeFormat(t,{dateStyle:"short"}).format(r)}function UM(r){return r.getHours()===0&&r.getMinutes()===0?`${Nh.date(r)}
|
|
1176
|
-
${ub(r)}`:ub(r)}const Nh={timeBySeconds:BM,timeByMinutesWithDates:UM,date:WM},Qt={seconds:"seconds",minutes:"minutes",date:"date"},Eo={day:r=>{const t=new Date(r.getTime());return t.setHours(0,0,0,0),t.getTime()},week:r=>{const t=new Date(r.getTime());return t.setHours(0,0,0,0),t.setDate(r.getDate()-r.getDay()+1),t.getTime()}},St={second:1e3,minute:1e3*60,hour:1e3*60*60,day:1e3*60*60*24,week:1e3*60*60*24*7},cb=[{ceiling:St.second*4,increment:St.second,labelFormat:Qt.seconds},{ceiling:St.second*8,increment:St.second*5,labelFormat:Qt.seconds},{ceiling:St.second*13,increment:St.second*10,labelFormat:Qt.seconds},{ceiling:St.second*20,increment:St.second*15,labelFormat:Qt.seconds},{ceiling:St.second*45,increment:St.second*30,labelFormat:Qt.seconds},{ceiling:St.minute*4,increment:St.minute,labelFormat:Qt.minutes},{ceiling:St.minute*8,increment:St.minute*5,labelFormat:Qt.minutes},{ceiling:St.minute*13,increment:St.minute*10,labelFormat:Qt.minutes},{ceiling:St.minute*28,increment:St.minute*15,labelFormat:Qt.minutes},{ceiling:St.hour*1.24,increment:St.minute*30,labelFormat:Qt.minutes},{ceiling:St.hour*3,increment:St.hour,labelFormat:Qt.minutes},{ceiling:St.hour*8,increment:St.hour*2,getAnchor:Eo.day,labelFormat:Qt.minutes},{ceiling:St.hour*13,increment:St.hour*6,getAnchor:Eo.day,labelFormat:Qt.minutes},{ceiling:St.hour*22,increment:St.hour*12,getAnchor:Eo.day,labelFormat:Qt.minutes},{ceiling:St.day*4,increment:St.day,getAnchor:Eo.day,labelFormat:Qt.date},{ceiling:St.week*2,increment:St.week,getAnchor:Eo.week,labelFormat:Qt.date},{ceiling:1/0,increment:St.week*4,labelFormat:Qt.date}],XM=300;async function ZM(){const r=await Ne(),t=await _s(),e=new Xt,i=new Map;let s=await Mh();Ct.on("scaleUpdated",d=>s=d),await o();function n(){if(e.visible=!t.disableGuides,!t.disableGuides)try{const{anchor:d,increment:p,labelFormat:m}=a(),f=c(d,p);u(f,m)}catch(d){if(d instanceof lb)return;console.error(d)}}async function o(){const d=[];yd(30,async p=>{const m=OM();d.push(m);const f=await m;e.addChild(f.element),i.set(p,f)}),await Promise.all(d)}function a(){const d=r.left-XM,p=s.invert(d),m=s.invert(d+260/r.scale.x);if(!(p instanceof Date)||!(m instanceof Date))throw new lb;const f=m.getTime()-p.getTime(),{increment:g,getAnchor:y,labelFormat:_}=h(f);return{anchor:y(p),increment:g,labelFormat:l(_)}}function h(d){const p=cb.find(m=>m.ceiling>d)??cb[0];return p.getAnchor||(p.getAnchor=m=>Math.floor(m.getTime()/p.increment)*p.increment),p}function l(d){switch(d){case Qt.minutes:return Nh.timeByMinutesWithDates;case Qt.date:return Nh.date;default:return Nh.timeBySeconds}}function u(d,p){const m=new Map(i.entries()),f=Array.from(m.keys()).filter(g=>!d.includes(g));i.clear();for(const g of d){if(m.has(g)){const _=m.get(g);i.set(g,_);continue}const y=m.get(f.pop()??-1);if(y===void 0){console.warn("Guides: No unused guides available to render.");continue}y.render(new Date(g),p),i.set(g,y)}}function c(d,p){return yd(30,m=>d+p*m)}return{element:e,render:n}}async function VM(){const r=await li(),{element:t,render:e}=await ZM();r.stage.addChild(t),e(),Ct.on("viewportDateRangeUpdated",()=>e()),Ct.on("layoutSettingsUpdated",()=>e())}function HM({stage:r,props:t}){eC(),iM(),tM(),VM(),$M(),Fb(),TM(),qE(r),Bb(t),hM(),CM(),dM(),rR(),GM()}function KM(){Ct.clear(),iC(),rM(),eM(),tC(),QM(),Wb(),Db(),SM(),lM(),IM(),pM(),sR(),NM()}async function YM(r){const t=await li(),e=await md(),{animate:i}=await Yy(),{element:s,render:n,bar:o}=await f(r);let a=r,h=null,l=!1,u=!1;e.add(s),s.eventMode="static",s.cursor="pointer",s.name=wb,s.on("click",_=>{_.stopPropagation(),_d(a)}),r.end_time||d(),Ct.on("nodeSelected",()=>{const _=vd(r);_!==l&&(l=_,n(a))});async function c(_){a=_;const x=g(_);return x===h||(h=x,await n(_),_.end_time&&p()),s}function d(){t.ticker.add(m)}function p(){t.ticker.remove(m)}function m(){c(r)}async function f(_){const{kind:x}=_;switch(x){case"task-run":return await kM();case"flow-run":return await DM(_);default:const v=x;throw new Error(`switch does not have case for value: ${v}`)}}function g(_){const x=_.end_time??new Date;return`${_.state_type},${x.getTime()},${_t.horizontal}`}function y({x:_,y:x}){i(s,{x:_,y:x},!u),u=!0}return{element:s,render:c,bar:o,setPosition:y}}function db({gap:r=0,minimum:t=0}={}){const e=new Map;function i(l){const u=e.get(l)??[];return Math.max(...u.values(),H.toValue(t))+H.toValue(r)}function s(l){let u=0;for(let c=0;c<l;c++)u+=i(c);return u}function n(l){return s(l+1)-H.toValue(r)}function o({axis:l,nodeId:u,offset:c}){const d=e.get(l)??new Map;d.set(u,c),e.set(l,d)}function a({axis:l,nodeId:u}){var c;(c=e.get(l))==null||c.delete(u)}function h(){e.clear()}return{getOffset:i,getTotalOffset:s,getTotalValue:n,setOffset:o,removeOffset:a,clear:h}}function zM(r){throw new Error(`switch does not have case for value: ${r}`)}const pb="KGZ1bmN0aW9uKCl7InVzZSBzdHJpY3QiO2Z1bmN0aW9uIEtlKG4pe3Rocm93IG5ldyBFcnJvcihgc3dpdGNoIGRvZXMgbm90IGhhdmUgY2FzZSBmb3IgdmFsdWU6ICR7bn1gKX1mdW5jdGlv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XRhLm5vZGVzKWUuc2V0KHIsdCsrKTtyZXR1cm4gZX1vbm1lc3NhZ2U9Tm87ZnVuY3Rpb24gTm8oe2RhdGE6bn0pe2NvbnN0e3R5cGU6ZX09bjtzd2l0Y2goZSl7Y2FzZSJsYXlvdXQiOkRvKG4pO3JldHVybjtkZWZhdWx0OktlKGUpfX1mdW5jdGlvbiBVbyhuKXtwb3N0TWVzc2FnZShuKX1hc3luYyBmdW5jdGlvbiBEbyhuKXtjb25zdHtkYXRhOmV9PW4sdD13byhuKSxyPWF3YWl0IFRvKG4sdCksbz1uZXcgTWFwO2xldCBpPTAsYT0wO2Zvcihjb25zdFt1LGxdb2YgZS5ub2Rlcyl7Y29uc3QgZj10LmdldCh1KSxnPXIuZ2V0KHUpO2lmKGY9PT12b2lkIDApe2NvbnNvbGUud2FybihgTm9kZUlkIG5vdCBmb3VuZCBpbiBob3Jpem9udGFsIGxheW91dDogU2tpcHBpbmcgJHtsLmxhYmVsfWApO2NvbnRpbnVlfWlmKGc9PT12b2lkIDApe2NvbnNvbGUud2FybihgTm9kZUlkIG5vdCBmb3VuZCBpbiB2ZXJ0aWNhbCBsYXlvdXQ6IFNraXBwaW5nICR7bC5sYWJlbH1gKTtjb250aW51ZX1pPU1hdGgubWF4KGksZyksYT1NYXRoLm1heChhLGYuY29sdW1uKSxvLnNldCh1LHsuLi5mLHk6Zyxyb3c6Z30pfVVvKHt0eXBlOiJsYXlvdXQiLGxheW91dDp7bWF4Um93OmksbWF4Q29sdW1uOmEscG9zaXRpb25zOm99fSl9fSkoKTsKLy8jIHNvdXJjZU1hcHBpbmdVUkw9cnVuR3JhcGgud29ya2VyLTU3ODU4YTNiLmpzLm1hcAo=",fb=typeof window<"u"&&window.Blob&&new Blob([atob(pb)],{type:"text/javascript;charset=utf-8"});function jM(){let r;try{if(r=fb&&(window.URL||window.webkitURL).createObjectURL(fb),!r)throw"";return new Worker(r)}catch{return new Worker("data:application/javascript;base64,"+pb)}finally{r&&(window.URL||window.webkitURL).revokeObjectURL(r)}}function JM(r){const t=new jM;return t.onmessage=r,t}async function mb(){const r=JM(L),t=new Map,e=new Map,i=new Xt,s=new Xt,n=await Ce(),o=db({gap:()=>n.styles.rowGap,minimum:()=>n.styles.nodeHeight}),a=db({gap:()=>n.styles.columnGap,minimum:()=>Td()});let h=null,l=null;i.name=fp,Ct.on("layoutSettingsUpdated",()=>{l&&i.parent&&u(l)});async function u(M){l=M,h=null,o.clear(),a.clear(),await Promise.all([c(M),p(M)]),f(M)}async function c(M){const G=[];for(const E of M.nodes.values())G.push(d(E));await Promise.all(G)}async function d(M){const{render:G}=await _(M);return await G(M)}async function p(M){if((await _s()).disableEdges){i.removeChild(s);return}i.addChildAt(s,0);const E=[];for(const[N,{children:O}]of M.nodes)for(const{id:Z}of O)E.push(m(N,Z));await Promise.all(E)}async function m(M,G){const E=`${M}_${G}`;if(e.has(E))return;const N=await bM();e.has(E)||(e.set(E,N),s.addChild(N.element))}function f(M){const G=new Map;for(const[E,{element:N}]of t)G.set(E,N.width);r.postMessage({type:"layout",data:M,widths:G,horizontalSettings:cd(M.start_time),verticalSettings:qA()})}function g(){if(h)for(const[M,G]of e){const[E,N]=M.split("_"),O=h.positions.get(E),Z=h.positions.get(N),U=t.get(E);if(!O||!Z){console.warn(`Could not find edge in layout: Skipping ${M}`);continue}if(!U){console.warn(`Could not find parent node in nodes: Skipping ${E}`);continue}const K=U.bar.width,ht=v(O),X={x:ht.x+K,y:ht.y+n.styles.nodeHeight/2},W=v(Z),j={x:W.x-X.x,y:W.y-X.y+n.styles.nodeHeight/2};G.setPosition(X,j)}}function y(){if(h){for(const[M,G]of t){const E=h.positions.get(M);if(!E){console.warn(`Could not find node in layout: Skipping ${M}`);continue}const N=v(E);G.setPosition(N)}g(),i.emit("rendered"),i.emit("resized",I())}}async function _(M){const G=t.get(M.id);if(G)return G;const E=await YM(M);return E.element.on("resized",N=>x(M.id,N)),t.set(M.id,E),i.addChild(E.element),E}function x(M,G){if(!h)return;const E=t.get(M),N=h.positions.get(M);!E||!N||(o.setOffset({nodeId:M,axis:N.y,offset:G.height}),a.setOffset({nodeId:M,axis:N.column,offset:G.width}),y())}function v(M){const G=o.getTotalOffset(M.y);return{x:S(M),y:G}}function S(M){return _t.isDependency()?a.getTotalOffset(M.column):M.x}function C(){return h?o.getTotalValue(h.maxRow):0}function A(){if(!h||!l)return 0;if(_t.isDependency())return a.getTotalValue(h.maxColumn);const M=cd(l.start_time),G=Zy(M),E=G(l.end_time??new Date),N=G(l.start_time);return E-N}function I(){return{width:A(),height:C()}}function L({data:M}){const{type:G}=M;switch(G){case"layout":k(M);return;default:zM(G)}}function k(M){h=M.layout,y()}return{element:i,getSize:I,render:u}}let Co=null,mn=null,xs=null;async function $M(){const r=await Ne(),t=await Ce(),{element:e,render:i}=await mb();r.addChild(e),e.alpha=0;const s=await Gg(t.runId,async n=>{const o=mn?"runDataUpdated":"runDataCreated";mn=n,Ct.emit(o,mn),await _s(),i(n)});xs=e,Co=s.stop,xs.once("rendered",()=>qM()),Ct.on("layoutUpdated",()=>tR()),s.start()}function QM(){Co==null||Co(),Co=null,xs=null,mn=null}async function gb(){return mn||await Be("runDataCreated")}function qM(){pd(),ye.shared.addOnce(()=>{xs&&(xs.alpha=1)})}async function tR(){if(!xs)return;const r=await Ce();xs.once("rendered",()=>{setTimeout(()=>{pd({animate:!0})},r.animationDuration)})}function eR(r){let t=0;for(const[,{children:e}]of r)t+=e.length;return t}function iR({start_time:r,end_time:t}){const e=Rb(t??new Date,r);return e<gp?2:e<gp*6?1:.1}async function rR(){const r=await gb(),t=await Ce(),e=iR(r);Fh(e,!0),r.nodes.size>t.disableAnimationsThreshold&&(_t.disableAnimations=!0),eR(r.nodes)>t.disableEdgesThreshold&&(_t.disableEdges=!0)}function sR(){_t.horizontalScaleMultiplierDefault=0,_t.horizontalScaleMultiplier=0}const _t=H.reactive({horizontal:"temporal",vertical:"nearest-parent",horizontalScaleMultiplierDefault:0,horizontalScaleMultiplier:0,disableAnimations:!1,disableEdges:!1,disableGuides:!1,isTemporal(){return this.horizontal==="temporal"},isDependency(){return this.horizontal==="dependency"},isWaterfall(){return this.vertical==="waterfall"},isNearestParent(){return this.vertical==="nearest-parent"}});async function _s(){return wd()?_t:await Be("layoutSettingsCreated")}function Td(){return _t.isDependency()?200:20*_t.horizontalScaleMultiplier}function nR(){return[0,Td()]}function oR(r){if(_t.isDependency())return[0,1];const t=r,e=Cb(t,1);return[t,e]}function Fh(r,t=!1){if(_t.horizontalScaleMultiplier===r)return;const e=Dh();_t.horizontalScaleMultiplier=r,t&&(_t.horizontalScaleMultiplierDefault=r),e()}function aR(){Fh(_t.horizontalScaleMultiplierDefault)}function hR(r){if(_t.horizontal===r)return;const t=Dh();_t.horizontal=r,_t.disableGuides=_t.isDependency(),t()}function lR(r){if(_t.vertical===r)return;const t=Dh();_t.vertical=r,t()}function uR(r){if(_t.disableEdges===r)return;const t=Dh();_t.disableEdges=r,t()}function Dh(){const r=wd()?"layoutSettingsUpdated":"layoutSettingsCreated",{horizontal:t,vertical:e}=_t;return()=>{wd()&&Ct.emit(r,_t),(t!==_t.horizontal||e!==_t.vertical)&&Ct.emit("layoutUpdated")}}function wd(){return _t.horizontalScaleMultiplier!==0}const cR={class:"flex items-center gap-2"},dR=H.defineComponent({__name:"RunGraphSettings",setup(r){const t=[Zi.positions.topRight,Zi.positions.bottomRight,Zi.positions.topLeft,Zi.positions.bottomLeft],e=[{value:"dependency",label:"Dependency"},{value:"temporal",label:"Temporal"}],i=H.computed({get(){return _t.horizontal},set(u){hR(u)}}),s=[{value:"waterfall",label:"Waterfall"},{value:"nearest-parent",label:"Nearest Parent"}],n=H.computed({get(){return _t.vertical},set(u){lR(u)}}),o=H.computed({get(){return _t.disableEdges},set(u){uR(u)}});function a(){const c=_t.horizontalScaleMultiplier*1.25;Fh(c)}function h(){const u=Math.abs(-.75),c=_t.horizontalScaleMultiplier*u;Fh(c)}function l(){aR()}return(u,c)=>{const d=H.resolveComponent("p-radio-group"),p=H.resolveComponent("p-label"),m=H.resolveComponent("p-divider"),f=H.resolveComponent("p-checkbox"),g=H.resolveComponent("p-overflow-menu");return H.openBlock(),H.createBlock(H.unref(Zi.PPopOver),{class:"run-graph-settings","auto-close":"",placement:t},{target:H.withCtx(({toggle:y})=>[H.createVNode(H.unref(Zi.PButton),{"aria-label":"Run Graph Options",icon:"CogIcon",flat:"",onClick:y},null,8,["onClick"])]),default:H.withCtx(()=>[H.createVNode(g,{class:"run-graph-settings__menu"},{default:H.withCtx(()=>[H.createVNode(p,{label:"View"},{default:H.withCtx(()=>[H.createVNode(d,{modelValue:i.value,"onUpdate:modelValue":c[0]||(c[0]=y=>i.value=y),options:e},{label:H.withCtx(({option:y})=>[H.createTextVNode(H.toDisplayString(y.label),1)]),_:1},8,["modelValue"])]),_:1}),H.unref(_t).isTemporal()?(H.openBlock(),H.createBlock(p,{key:0,label:"Scaling",class:"mt-4"},{default:H.withCtx(()=>[H.createElementVNode("div",cR,[H.createVNode(H.unref(Zi.PButton),{small:"",icon:"MinusIcon",onClick:h}),H.createVNode(H.unref(Zi.PButton),{small:"",icon:"PlusIcon",onClick:a}),H.createVNode(H.unref(Zi.PButton),{small:"",onClick:l},{default:H.withCtx(()=>[H.createTextVNode(" Reset ")]),_:1})])]),_:1})):H.createCommentVNode("",!0),H.createVNode(m),H.createVNode(p,{label:"Layout"},{default:H.withCtx(()=>[H.createVNode(d,{modelValue:n.value,"onUpdate:modelValue":c[1]||(c[1]=y=>n.value=y),options:s},{label:H.withCtx(({option:y})=>[H.createTextVNode(H.toDisplayString(y.label),1)]),_:1},8,["modelValue"])]),_:1}),H.createVNode(m),H.createVNode(f,{modelValue:o.value,"onUpdate:modelValue":c[2]||(c[2]=y=>o.value=y),label:"Hide dependency arrows"},null,8,["modelValue"])]),_:1})]),_:1})}}}),BR="";function pR(r){if(!(r instanceof HTMLElement))return!1;const t=r.tagName.toLowerCase();return["input","textarea"].includes(t)}const fR={class:"run-graph__actions"},mR=H.defineComponent({__name:"RunGraph",props:{config:{},viewport:{},fullscreen:{type:[Boolean,null],default:null},selected:{default:null}},emits:["update:viewport","update:fullscreen","update:selected"],setup(r,{emit:t}){const e=r,i=H.ref(),s=H.ref(!1),n=H.computed({get(){return e.fullscreen??s.value},set(u){s.value=u,t("update:fullscreen",u)}});H.watch(()=>e.selected,u=>_d(u)),Ct.on("nodeSelected",u=>t("update:selected",u)),H.watch(()=>e.viewport,u=>oM(u));const o=H.computed(()=>({root:{"run-graph--fullscreen":n.value}}));Ct.on("viewportDateRangeUpdated",u=>t("update:viewport",u));function a(){pd({animate:!0})}function h(){n.value=!n.value}H.onMounted(()=>{if(!i.value)throw new Error("Stage does not exist");HM({stage:i.value,props:e})}),H.onBeforeUnmount(()=>{KM()}),gi.useKeyDown(["c","f","Escape"],l);function l(u){if(!pR(u.target))switch(u.key){case"c":a();break;case"f":h();break;case"Escape":n.value&&h();break}}return(u,c)=>{const d=H.resolveComponent("p-button");return H.openBlock(),H.createElementBlock("div",{class:H.normalizeClass(["run-graph",o.value.root])},[H.createElementVNode("div",{ref_key:"stage",ref:i,class:"run-graph__stage"},null,512),H.createElementVNode("div",fR,[H.createVNode(d,{title:"Recenter Timeline",icon:"Target",flat:"",onClick:a}),H.createVNode(d,{title:"View Timeline in Fullscreen",icon:"ArrowsPointingOutIcon",flat:"",onClick:h}),H.createVNode(dR)])],2)}}}),WR="",yb=["flow-run","task-run"];function gR(r){return yb.includes(r)}oe.RunGraph=mR,oe.isRunGraphNodeType=gR,oe.runGraphNodeKinds=yb,Object.defineProperty(oe,Symbol.toStringTag,{value:"Module"})});
|
|
1175
|
+
*/var L0,Lr,sn,Lc,ds,G0,Gc,GE=function(){return typeof window<"u"},sr={},ps=180/Math.PI,nn=Math.PI/180,on=Math.atan2,N0=1e8,Nc=/([A-Z])/g,NE=/(left|right|width|margin|padding|x)/i,FE=/[\s,\(]\S/,Mi={autoAlpha:"opacity,visibility",scale:"scaleX,scaleY",alpha:"opacity"},Fc=function(t,e){return e.set(e.t,e.p,Math.round((e.s+e.c*t)*1e4)/1e4+e.u,e)},DE=function(t,e){return e.set(e.t,e.p,t===1?e.e:Math.round((e.s+e.c*t)*1e4)/1e4+e.u,e)},kE=function(t,e){return e.set(e.t,e.p,t?Math.round((e.s+e.c*t)*1e4)/1e4+e.u:e.b,e)},OE=function(t,e){var i=e.s+e.c*t;e.set(e.t,e.p,~~(i+(i<0?-.5:.5))+e.u,e)},F0=function(t,e){return e.set(e.t,e.p,t?e.e:e.b,e)},D0=function(t,e){return e.set(e.t,e.p,t!==1?e.b:e.e,e)},BE=function(t,e,i){return t.style[e]=i},WE=function(t,e,i){return t.style.setProperty(e,i)},UE=function(t,e,i){return t._gsap[e]=i},XE=function(t,e,i){return t._gsap.scaleX=t._gsap.scaleY=i},ZE=function(t,e,i,s,n){var o=t._gsap;o.scaleX=o.scaleY=i,o.renderTransform(n,o)},VE=function(t,e,i,s,n){var o=t._gsap;o[e]=i,o.renderTransform(n,o)},Wt="transform",li=Wt+"Origin",HE=function r(t,e){var i=this,s=this.target,n=s.style;if(t in sr&&n){if(this.tfm=this.tfm||{},t!=="transform")t=Mi[t]||t,~t.indexOf(",")?t.split(",").forEach(function(o){return i.tfm[o]=nr(s,o)}):this.tfm[t]=s._gsap.x?s._gsap[t]:nr(s,t);else return Mi.transform.split(",").forEach(function(o){return r.call(i,o,e)});if(this.props.indexOf(Wt)>=0)return;s._gsap.svg&&(this.svgo=s.getAttribute("data-svg-origin"),this.props.push(li,e,"")),t=Wt}(n||e)&&this.props.push(t,e,n[t])},k0=function(t){t.translate&&(t.removeProperty("translate"),t.removeProperty("scale"),t.removeProperty("rotate"))},KE=function(){var t=this.props,e=this.target,i=e.style,s=e._gsap,n,o;for(n=0;n<t.length;n+=3)t[n+1]?e[t[n]]=t[n+2]:t[n+2]?i[t[n]]=t[n+2]:i.removeProperty(t[n].substr(0,2)==="--"?t[n]:t[n].replace(Nc,"-$1").toLowerCase());if(this.tfm){for(o in this.tfm)s[o]=this.tfm[o];s.svg&&(s.renderTransform(),e.setAttribute("data-svg-origin",this.svgo||"")),n=Gc(),(!n||!n.isStart)&&!i[Wt]&&(k0(i),s.uncache=1)}},O0=function(t,e){var i={target:t,props:[],revert:KE,save:HE};return t._gsap||Se.core.getCache(t),e&&e.split(",").forEach(function(s){return i.save(s)}),i},B0,Dc=function(t,e){var i=Lr.createElementNS?Lr.createElementNS((e||"http://www.w3.org/1999/xhtml").replace(/^https/,"http"),t):Lr.createElement(t);return i.style?i:Lr.createElement(t)},Ri=function r(t,e,i){var s=getComputedStyle(t);return s[e]||s.getPropertyValue(e.replace(Nc,"-$1").toLowerCase())||s.getPropertyValue(e)||!i&&r(t,an(e)||e,1)||""},W0="O,Moz,ms,Ms,Webkit".split(","),an=function(t,e,i){var s=e||ds,n=s.style,o=5;if(t in n&&!i)return t;for(t=t.charAt(0).toUpperCase()+t.substr(1);o--&&!(W0[o]+t in n););return o<0?null:(o===3?"ms":o>=0?W0[o]:"")+t},kc=function(){GE()&&window.document&&(L0=window,Lr=L0.document,sn=Lr.documentElement,ds=Dc("div")||{style:{}},Dc("div"),Wt=an(Wt),li=Wt+"Origin",ds.style.cssText="border-width:0;line-height:0;position:absolute;padding:0",B0=!!an("perspective"),Gc=Se.core.reverting,Lc=1)},Oc=function r(t){var e=Dc("svg",this.ownerSVGElement&&this.ownerSVGElement.getAttribute("xmlns")||"http://www.w3.org/2000/svg"),i=this.parentNode,s=this.nextSibling,n=this.style.cssText,o;if(sn.appendChild(e),e.appendChild(this),this.style.display="block",t)try{o=this.getBBox(),this._gsapBBox=this.getBBox,this.getBBox=r}catch{}else this._gsapBBox&&(o=this._gsapBBox());return i&&(s?i.insertBefore(this,s):i.appendChild(this)),sn.removeChild(e),this.style.cssText=n,o},U0=function(t,e){for(var i=e.length;i--;)if(t.hasAttribute(e[i]))return t.getAttribute(e[i])},X0=function(t){var e;try{e=t.getBBox()}catch{e=Oc.call(t,!0)}return e&&(e.width||e.height)||t.getBBox===Oc||(e=Oc.call(t,!0)),e&&!e.width&&!e.x&&!e.y?{x:+U0(t,["x","cx","x1"])||0,y:+U0(t,["y","cy","y1"])||0,width:0,height:0}:e},Z0=function(t){return!!(t.getCTM&&(!t.parentNode||t.ownerSVGElement)&&X0(t))},uo=function(t,e){if(e){var i=t.style;e in sr&&e!==li&&(e=Wt),i.removeProperty?((e.substr(0,2)==="ms"||e.substr(0,6)==="webkit")&&(e="-"+e),i.removeProperty(e.replace(Nc,"-$1").toLowerCase())):i.removeAttribute(e)}},Gr=function(t,e,i,s,n,o){var a=new we(t._pt,e,i,0,1,o?D0:F0);return t._pt=a,a.b=s,a.e=n,t._props.push(i),a},V0={deg:1,rad:1,turn:1},YE={grid:1,flex:1},Nr=function r(t,e,i,s){var n=parseFloat(i)||0,o=(i+"").trim().substr((n+"").length)||"px",a=ds.style,h=NE.test(e),l=t.tagName.toLowerCase()==="svg",u=(l?"client":"offset")+(h?"Width":"Height"),c=100,d=s==="px",p=s==="%",m,f,g,y;return s===o||!n||V0[s]||V0[o]?n:(o!=="px"&&!d&&(n=r(t,e,i,"px")),y=t.getCTM&&Z0(t),(p||o==="%")&&(sr[e]||~e.indexOf("adius"))?(m=y?t.getBBox()[h?"width":"height"]:t[u],Kt(p?n/m*c:n/100*m)):(a[h?"width":"height"]=c+(d?o:s),f=~e.indexOf("adius")||s==="em"&&t.appendChild&&!l?t:t.parentNode,y&&(f=(t.ownerSVGElement||{}).parentNode),(!f||f===Lr||!f.appendChild)&&(f=Lr.body),g=f._gsap,g&&p&&g.width&&h&&g.time===Le.time&&!g.uncache?Kt(n/g.width*c):((p||o==="%")&&!YE[Ri(f,"display")]&&(a.position=Ri(t,"position")),f===t&&(a.position="static"),f.appendChild(ds),m=ds[u],f.removeChild(ds),a.position="absolute",h&&p&&(g=os(f),g.time=Le.time,g.width=f[u]),Kt(d?m*n/c:m&&n?c/m*n:0))))},nr=function(t,e,i,s){var n;return Lc||kc(),e in Mi&&e!=="transform"&&(e=Mi[e],~e.indexOf(",")&&(e=e.split(",")[0])),sr[e]&&e!=="transform"?(n=po(t,s),n=e!=="transformOrigin"?n[e]:n.svg?n.origin:ph(Ri(t,li))+" "+n.zOrigin+"px"):(n=t.style[e],(!n||n==="auto"||s||~(n+"").indexOf("calc("))&&(n=dh[e]&&dh[e](t,e,i)||Ri(t,e)||zg(t,e)||(e==="opacity"?1:0))),i&&!~(n+"").trim().indexOf(" ")?Nr(t,e,n,i)+i:n},zE=function(t,e,i,s){if(!i||i==="none"){var n=an(e,t,1),o=n&&Ri(t,n,1);o&&o!==i?(e=n,i=o):e==="borderColor"&&(i=Ri(t,"borderTopColor"))}var a=new we(this._pt,t.style,e,0,1,A0),h=0,l=0,u,c,d,p,m,f,g,y,_,b,v,S;if(a.b=i,a.e=s,i+="",s+="",s==="auto"&&(t.style[e]=s,s=Ri(t,e)||s,t.style[e]=i),u=[i,s],b0(u),i=u[0],s=u[1],d=i.match($s)||[],S=s.match($s)||[],S.length){for(;c=$s.exec(s);)g=c[0],_=s.substring(h,c.index),m?m=(m+1)%5:(_.substr(-5)==="rgba("||_.substr(-5)==="hsla(")&&(m=1),g!==(f=d[l++]||"")&&(p=parseFloat(f)||0,v=f.substr((p+"").length),g.charAt(1)==="="&&(g=Qs(p,g)+v),y=parseFloat(g),b=g.substr((y+"").length),h=$s.lastIndex-b.length,b||(b=b||Me.units[e]||v,h===s.length&&(s+=b,a.e+=b)),v!==b&&(p=Nr(t,e,f,b)||0),a._pt={_next:a._pt,p:_||l===1?_:",",s:p,c:y-p,m:m&&m<4||e==="zIndex"?Math.round:0});a.c=h<s.length?s.substring(h,s.length):""}else a.r=e==="display"&&s==="none"?D0:F0;return Ug.test(s)&&(a.e=0),this._pt=a,a},H0={top:"0%",bottom:"100%",left:"0%",right:"100%",center:"50%"},jE=function(t){var e=t.split(" "),i=e[0],s=e[1]||"50%";return(i==="top"||i==="bottom"||s==="left"||s==="right")&&(t=i,i=s,s=t),e[0]=H0[i]||i,e[1]=H0[s]||s,e.join(" ")},JE=function(t,e){if(e.tween&&e.tween._time===e.tween._dur){var i=e.t,s=i.style,n=e.u,o=i._gsap,a,h,l;if(n==="all"||n===!0)s.cssText="",h=1;else for(n=n.split(","),l=n.length;--l>-1;)a=n[l],sr[a]&&(h=1,a=a==="transformOrigin"?li:Wt),uo(i,a);h&&(uo(i,Wt),o&&(o.svg&&i.removeAttribute("transform"),po(i,1),o.uncache=1,k0(s)))}},dh={clearProps:function(t,e,i,s,n){if(n.data!=="isFromStart"){var o=t._pt=new we(t._pt,e,i,0,0,JE);return o.u=s,o.pr=-10,o.tween=n,t._props.push(i),1}}},co=[1,0,0,1,0,0],K0={},Y0=function(t){return t==="matrix(1, 0, 0, 1, 0, 0)"||t==="none"||!t},z0=function(t){var e=Ri(t,Wt);return Y0(e)?co:e.substr(7).match(Wg).map(Kt)},Bc=function(t,e){var i=t._gsap||os(t),s=t.style,n=z0(t),o,a,h,l;return i.svg&&t.getAttribute("transform")?(h=t.transform.baseVal.consolidate().matrix,n=[h.a,h.b,h.c,h.d,h.e,h.f],n.join(",")==="1,0,0,1,0,0"?co:n):(n===co&&!t.offsetParent&&t!==sn&&!i.svg&&(h=s.display,s.display="block",o=t.parentNode,(!o||!t.offsetParent)&&(l=1,a=t.nextElementSibling,sn.appendChild(t)),n=z0(t),h?s.display=h:uo(t,"display"),l&&(a?o.insertBefore(t,a):o?o.appendChild(t):sn.removeChild(t))),e&&n.length>6?[n[0],n[1],n[4],n[5],n[12],n[13]]:n)},Wc=function(t,e,i,s,n,o){var a=t._gsap,h=n||Bc(t,!0),l=a.xOrigin||0,u=a.yOrigin||0,c=a.xOffset||0,d=a.yOffset||0,p=h[0],m=h[1],f=h[2],g=h[3],y=h[4],_=h[5],b=e.split(" "),v=parseFloat(b[0])||0,S=parseFloat(b[1])||0,E,A,I,P;i?h!==co&&(A=p*g-m*f)&&(I=v*(g/A)+S*(-f/A)+(f*_-g*y)/A,P=v*(-m/A)+S*(p/A)-(p*_-m*y)/A,v=I,S=P):(E=X0(t),v=E.x+(~b[0].indexOf("%")?v/100*E.width:v),S=E.y+(~(b[1]||b[0]).indexOf("%")?S/100*E.height:S)),s||s!==!1&&a.smooth?(y=v-l,_=S-u,a.xOffset=c+(y*p+_*f)-y,a.yOffset=d+(y*m+_*g)-_):a.xOffset=a.yOffset=0,a.xOrigin=v,a.yOrigin=S,a.smooth=!!s,a.origin=e,a.originIsAbsolute=!!i,t.style[li]="0px 0px",o&&(Gr(o,a,"xOrigin",l,v),Gr(o,a,"yOrigin",u,S),Gr(o,a,"xOffset",c,a.xOffset),Gr(o,a,"yOffset",d,a.yOffset)),t.setAttribute("data-svg-origin",v+" "+S)},po=function(t,e){var i=t._gsap||new T0(t);if("x"in i&&!e&&!i.uncache)return i;var s=t.style,n=i.scaleX<0,o="px",a="deg",h=getComputedStyle(t),l=Ri(t,li)||"0",u,c,d,p,m,f,g,y,_,b,v,S,E,A,I,P,W,G,N,C,F,X,V,L,k,H,D,U,j,q,dt,nt;return u=c=d=f=g=y=_=b=v=0,p=m=1,i.svg=!!(t.getCTM&&Z0(t)),h.translate&&((h.translate!=="none"||h.scale!=="none"||h.rotate!=="none")&&(s[Wt]=(h.translate!=="none"?"translate3d("+(h.translate+" 0 0").split(" ").slice(0,3).join(", ")+") ":"")+(h.rotate!=="none"?"rotate("+h.rotate+") ":"")+(h.scale!=="none"?"scale("+h.scale.split(" ").join(",")+") ":"")+(h[Wt]!=="none"?h[Wt]:"")),s.scale=s.rotate=s.translate="none"),A=Bc(t,i.svg),i.svg&&(i.uncache?(k=t.getBBox(),l=i.xOrigin-k.x+"px "+(i.yOrigin-k.y)+"px",L=""):L=!e&&t.getAttribute("data-svg-origin"),Wc(t,L||l,!!L||i.originIsAbsolute,i.smooth!==!1,A)),S=i.xOrigin||0,E=i.yOrigin||0,A!==co&&(G=A[0],N=A[1],C=A[2],F=A[3],u=X=A[4],c=V=A[5],A.length===6?(p=Math.sqrt(G*G+N*N),m=Math.sqrt(F*F+C*C),f=G||N?on(N,G)*ps:0,_=C||F?on(C,F)*ps+f:0,_&&(m*=Math.abs(Math.cos(_*nn))),i.svg&&(u-=S-(S*G+E*C),c-=E-(S*N+E*F))):(nt=A[6],q=A[7],D=A[8],U=A[9],j=A[10],dt=A[11],u=A[12],c=A[13],d=A[14],I=on(nt,j),g=I*ps,I&&(P=Math.cos(-I),W=Math.sin(-I),L=X*P+D*W,k=V*P+U*W,H=nt*P+j*W,D=X*-W+D*P,U=V*-W+U*P,j=nt*-W+j*P,dt=q*-W+dt*P,X=L,V=k,nt=H),I=on(-C,j),y=I*ps,I&&(P=Math.cos(-I),W=Math.sin(-I),L=G*P-D*W,k=N*P-U*W,H=C*P-j*W,dt=F*W+dt*P,G=L,N=k,C=H),I=on(N,G),f=I*ps,I&&(P=Math.cos(I),W=Math.sin(I),L=G*P+N*W,k=X*P+V*W,N=N*P-G*W,V=V*P-X*W,G=L,X=k),g&&Math.abs(g)+Math.abs(f)>359.9&&(g=f=0,y=180-y),p=Kt(Math.sqrt(G*G+N*N+C*C)),m=Kt(Math.sqrt(V*V+nt*nt)),I=on(X,V),_=Math.abs(I)>2e-4?I*ps:0,v=dt?1/(dt<0?-dt:dt):0),i.svg&&(L=t.getAttribute("transform"),i.forceCSS=t.setAttribute("transform","")||!Y0(Ri(t,Wt)),L&&t.setAttribute("transform",L))),Math.abs(_)>90&&Math.abs(_)<270&&(n?(p*=-1,_+=f<=0?180:-180,f+=f<=0?180:-180):(m*=-1,_+=_<=0?180:-180)),e=e||i.uncache,i.x=u-((i.xPercent=u&&(!e&&i.xPercent||(Math.round(t.offsetWidth/2)===Math.round(-u)?-50:0)))?t.offsetWidth*i.xPercent/100:0)+o,i.y=c-((i.yPercent=c&&(!e&&i.yPercent||(Math.round(t.offsetHeight/2)===Math.round(-c)?-50:0)))?t.offsetHeight*i.yPercent/100:0)+o,i.z=d+o,i.scaleX=Kt(p),i.scaleY=Kt(m),i.rotation=Kt(f)+a,i.rotationX=Kt(g)+a,i.rotationY=Kt(y)+a,i.skewX=_+a,i.skewY=b+a,i.transformPerspective=v+o,(i.zOrigin=parseFloat(l.split(" ")[2])||0)&&(s[li]=ph(l)),i.xOffset=i.yOffset=0,i.force3D=Me.force3D,i.renderTransform=i.svg?QE:B0?j0:$E,i.uncache=0,i},ph=function(t){return(t=t.split(" "))[0]+" "+t[1]},Uc=function(t,e,i){var s=pe(e);return Kt(parseFloat(e)+parseFloat(Nr(t,"x",i+"px",s)))+s},$E=function(t,e){e.z="0px",e.rotationY=e.rotationX="0deg",e.force3D=0,j0(t,e)},fs="0deg",fo="0px",ms=") ",j0=function(t,e){var i=e||this,s=i.xPercent,n=i.yPercent,o=i.x,a=i.y,h=i.z,l=i.rotation,u=i.rotationY,c=i.rotationX,d=i.skewX,p=i.skewY,m=i.scaleX,f=i.scaleY,g=i.transformPerspective,y=i.force3D,_=i.target,b=i.zOrigin,v="",S=y==="auto"&&t&&t!==1||y===!0;if(b&&(c!==fs||u!==fs)){var E=parseFloat(u)*nn,A=Math.sin(E),I=Math.cos(E),P;E=parseFloat(c)*nn,P=Math.cos(E),o=Uc(_,o,A*P*-b),a=Uc(_,a,-Math.sin(E)*-b),h=Uc(_,h,I*P*-b+b)}g!==fo&&(v+="perspective("+g+ms),(s||n)&&(v+="translate("+s+"%, "+n+"%) "),(S||o!==fo||a!==fo||h!==fo)&&(v+=h!==fo||S?"translate3d("+o+", "+a+", "+h+") ":"translate("+o+", "+a+ms),l!==fs&&(v+="rotate("+l+ms),u!==fs&&(v+="rotateY("+u+ms),c!==fs&&(v+="rotateX("+c+ms),(d!==fs||p!==fs)&&(v+="skew("+d+", "+p+ms),(m!==1||f!==1)&&(v+="scale("+m+", "+f+ms),_.style[Wt]=v||"translate(0, 0)"},QE=function(t,e){var i=e||this,s=i.xPercent,n=i.yPercent,o=i.x,a=i.y,h=i.rotation,l=i.skewX,u=i.skewY,c=i.scaleX,d=i.scaleY,p=i.target,m=i.xOrigin,f=i.yOrigin,g=i.xOffset,y=i.yOffset,_=i.forceCSS,b=parseFloat(o),v=parseFloat(a),S,E,A,I,P;h=parseFloat(h),l=parseFloat(l),u=parseFloat(u),u&&(u=parseFloat(u),l+=u,h+=u),h||l?(h*=nn,l*=nn,S=Math.cos(h)*c,E=Math.sin(h)*c,A=Math.sin(h-l)*-d,I=Math.cos(h-l)*d,l&&(u*=nn,P=Math.tan(l-u),P=Math.sqrt(1+P*P),A*=P,I*=P,u&&(P=Math.tan(u),P=Math.sqrt(1+P*P),S*=P,E*=P)),S=Kt(S),E=Kt(E),A=Kt(A),I=Kt(I)):(S=c,I=d,E=A=0),(b&&!~(o+"").indexOf("px")||v&&!~(a+"").indexOf("px"))&&(b=Nr(p,"x",o,"px"),v=Nr(p,"y",a,"px")),(m||f||g||y)&&(b=Kt(b+m-(m*S+f*A)+g),v=Kt(v+f-(m*E+f*I)+y)),(s||n)&&(P=p.getBBox(),b=Kt(b+s/100*P.width),v=Kt(v+n/100*P.height)),P="matrix("+S+","+E+","+A+","+I+","+b+","+v+")",p.setAttribute("transform",P),_&&(p.style[Wt]=P)},qE=function(t,e,i,s,n){var o=360,a=re(n),h=parseFloat(n)*(a&&~n.indexOf("rad")?ps:1),l=h-s,u=s+l+"deg",c,d;return a&&(c=n.split("_")[1],c==="short"&&(l%=o,l!==l%(o/2)&&(l+=l<0?o:-o)),c==="cw"&&l<0?l=(l+o*N0)%o-~~(l/o)*o:c==="ccw"&&l>0&&(l=(l-o*N0)%o-~~(l/o)*o)),t._pt=d=new we(t._pt,e,i,s,l,DE),d.e=u,d.u="deg",t._props.push(i),d},J0=function(t,e){for(var i in e)t[i]=e[i];return t},tC=function(t,e,i){var s=J0({},i._gsap),n="perspective,force3D,transformOrigin,svgOrigin",o=i.style,a,h,l,u,c,d,p,m;s.svg?(l=i.getAttribute("transform"),i.setAttribute("transform",""),o[Wt]=e,a=po(i,1),uo(i,Wt),i.setAttribute("transform",l)):(l=getComputedStyle(i)[Wt],o[Wt]=e,a=po(i,1),o[Wt]=l);for(h in sr)l=s[h],u=a[h],l!==u&&n.indexOf(h)<0&&(p=pe(l),m=pe(u),c=p!==m?Nr(i,h,l,m):parseFloat(l),d=parseFloat(u),t._pt=new we(t._pt,a,h,c,d-c,Fc),t._pt.u=m||0,t._props.push(h));J0(a,s)};ve("padding,margin,Width,Radius",function(r,t){var e="Top",i="Right",s="Bottom",n="Left",o=(t<3?[e,i,s,n]:[e+n,e+i,s+i,s+n]).map(function(a){return t<2?r+a:"border"+a+r});dh[t>1?"border"+r:r]=function(a,h,l,u,c){var d,p;if(arguments.length<4)return d=o.map(function(m){return nr(a,m,l)}),p=d.join(" "),p.split(d[0]).length===5?d[0]:p;d=(u+"").split(" "),p={},o.forEach(function(m,f){return p[m]=d[f]=d[f]||d[(f-1)/2|0]}),a.init(h,p,c)}});var $0={name:"css",register:kc,targetTest:function(t){return t.style&&t.nodeType},init:function(t,e,i,s,n){var o=this._props,a=t.style,h=i.vars.startAt,l,u,c,d,p,m,f,g,y,_,b,v,S,E,A,I;Lc||kc(),this.styles=this.styles||O0(t),I=this.styles.props,this.tween=i;for(f in e)if(f!=="autoRound"&&(u=e[f],!(Pe[f]&&w0(f,e,i,s,t,n)))){if(p=typeof u,m=dh[f],p==="function"&&(u=u.call(i,s,t,n),p=typeof u),p==="string"&&~u.indexOf("random(")&&(u=so(u)),m)m(this,t,f,u,i)&&(A=1);else if(f.substr(0,2)==="--")l=(getComputedStyle(t).getPropertyValue(f)+"").trim(),u+="",Rr.lastIndex=0,Rr.test(l)||(g=pe(l),y=pe(u)),y?g!==y&&(l=Nr(t,f,l,y)+y):g&&(u+=g),this.add(a,"setProperty",l,u,s,n,0,0,f),o.push(f),I.push(f,0,a[f]);else if(p!=="undefined"){if(h&&f in h?(l=typeof h[f]=="function"?h[f].call(i,s,t,n):h[f],re(l)&&~l.indexOf("random(")&&(l=so(l)),pe(l+"")||(l+=Me.units[f]||pe(nr(t,f))||""),(l+"").charAt(1)==="="&&(l=nr(t,f))):l=nr(t,f),d=parseFloat(l),_=p==="string"&&u.charAt(1)==="="&&u.substr(0,2),_&&(u=u.substr(2)),c=parseFloat(u),f in Mi&&(f==="autoAlpha"&&(d===1&&nr(t,"visibility")==="hidden"&&c&&(d=0),I.push("visibility",0,a.visibility),Gr(this,a,"visibility",d?"inherit":"hidden",c?"inherit":"hidden",!c)),f!=="scale"&&f!=="transform"&&(f=Mi[f],~f.indexOf(",")&&(f=f.split(",")[0]))),b=f in sr,b){if(this.styles.save(f),v||(S=t._gsap,S.renderTransform&&!e.parseTransform||po(t,e.parseTransform),E=e.smoothOrigin!==!1&&S.smooth,v=this._pt=new we(this._pt,a,Wt,0,1,S.renderTransform,S,0,-1),v.dep=1),f==="scale")this._pt=new we(this._pt,S,"scaleY",S.scaleY,(_?Qs(S.scaleY,_+c):c)-S.scaleY||0,Fc),this._pt.u=0,o.push("scaleY",f),f+="X";else if(f==="transformOrigin"){I.push(li,0,a[li]),u=jE(u),S.svg?Wc(t,u,0,E,0,this):(y=parseFloat(u.split(" ")[2])||0,y!==S.zOrigin&&Gr(this,S,"zOrigin",S.zOrigin,y),Gr(this,a,f,ph(l),ph(u)));continue}else if(f==="svgOrigin"){Wc(t,u,1,E,0,this);continue}else if(f in K0){qE(this,S,f,d,_?Qs(d,_+u):u);continue}else if(f==="smoothOrigin"){Gr(this,S,"smooth",S.smooth,u);continue}else if(f==="force3D"){S[f]=u;continue}else if(f==="transform"){tC(this,u,t);continue}}else f in a||(f=an(f)||f);if(b||(c||c===0)&&(d||d===0)&&!FE.test(u)&&f in a)g=(l+"").substr((d+"").length),c||(c=0),y=pe(u)||(f in Me.units?Me.units[f]:g),g!==y&&(d=Nr(t,f,l,y)),this._pt=new we(this._pt,b?S:a,f,d,(_?Qs(d,_+c):c)-d,!b&&(y==="px"||f==="zIndex")&&e.autoRound!==!1?OE:Fc),this._pt.u=y||0,g!==y&&y!=="%"&&(this._pt.b=l,this._pt.r=kE);else if(f in a)zE.call(this,t,f,l,_?_+u:u);else if(f in t)this.add(t,f,l||t[f],_?_+u:u,s,n);else if(f!=="parseTransform"){lc(f,u);continue}b||(f in a?I.push(f,0,a[f]):I.push(f,1,l||t[f])),o.push(f)}}A&&M0(this)},render:function(t,e){if(e.tween._time||!Gc())for(var i=e._pt;i;)i.r(t,i.d),i=i._next;else e.styles.revert()},get:nr,aliases:Mi,getSetter:function(t,e,i){var s=Mi[e];return s&&s.indexOf(",")<0&&(e=s),e in sr&&e!==li&&(t._gsap.x||nr(t,"x"))?i&&G0===i?e==="scale"?XE:UE:(G0=i||{})&&(e==="scale"?ZE:VE):t.style&&!rc(t.style[e])?BE:~e.indexOf("-")?WE:Ic(t,e)},core:{_removeProperty:uo,_getMatrix:Bc}};Se.utils.checkPrefix=an,Se.core.getStyleSaver=O0,function(r,t,e,i){var s=ve(r+","+t+","+e,function(n){sr[n]=1});ve(t,function(n){Me.units[n]="deg",K0[n]=1}),Mi[s[13]]=r+","+t,ve(i,function(n){var o=n.split(":");Mi[o[1]]=s[o[0]]})}("x,y,z,scale,scaleX,scaleY,xPercent,yPercent","rotation,rotationX,rotationY,skewX,skewY","transform,transformOrigin,svgOrigin,force3D,smoothOrigin,transformPerspective","0:translateX,1:translateY,2:translateZ,8:rotate,8:rotationZ,8:rotateZ,9:rotateX,10:rotateY"),ve("x,y,z,top,right,bottom,left,width,height,fontSize,padding,margin,perspective",function(r){Me.units[r]="px"}),Se.registerPlugin($0);var Q0=Se.registerPlugin($0)||Se;Q0.core.Tween;const gs=new ct;class eC{constructor(t={}){this._recursive=typeof t.recursive=="boolean"?t.recursive:!0,this._toggle=t.toggle||"visible",this._targetList=new Set}add(t){return this._targetList.add(t),this}addAll(t){for(let e=0,i=t.length;e<i;e++)this._targetList.add(t[e]);return this}remove(t){return this._targetList.delete(t),this}removeAll(t){for(let e=0,i=t.length;e<i;e++)this._targetList.delete(t[e]);return this}clear(){return this._targetList.clear(),this}cull(t,e=!1){return e||this.uncull(),this._targetList.forEach(i=>{e||i.getBounds(!1,gs),this._recursive?this.cullRecursive(t,i,e):(e&&i._bounds.getRectangle(t),i[this._toggle]=gs.right>t.left&&gs.left<t.right&&gs.bottom>t.top&&gs.top<t.bottom)}),this}uncull(){return this._targetList.forEach(t=>{this._recursive?this.uncullRecursive(t):t[this._toggle]=!1}),this}cullRecursive(t,e,i){const s=i?e._bounds.getRectangle(gs):e.getBounds(!0,gs);if(e[this._toggle]=s.right>t.left&&s.left<t.right&&s.bottom>t.top&&s.top<t.bottom,!(s.left>=t.left&&s.top>=t.top&&s.right<=t.right&&s.bottom<=t.bottom)&&e[this._toggle]&&e.children&&e.children.length){const o=e.children;for(let a=0,h=o.length;a<h;a++)this.cullRecursive(t,o[a])}}uncullRecursive(t){if(t[this._toggle]=!0,t.children&&t.children.length){const e=t.children;for(let i=0,s=e.length;i<s;i++)this.uncullRecursive(e[i])}}}let Pi=null;const q0=new ResizeObserver(()=>{Pi&&_t.emit("stageUpdated",Pi)});function iC(r){Pi=r,q0.observe(Pi),_t.emit("stageCreated",Pi)}function rC(){Pi&&q0.unobserve(Pi),Pi=null}async function Xc(){return Pi||await We("stageCreated")}let Ge=null;async function sC(){const r=await Xc();oC(r),_t.on("stageUpdated",aC)}function nC(){Ge&&(Ge.destroy(!0,{children:!0}),Ge=null)}function oC(r){Ge=new jm({backgroundAlpha:0,resizeTo:r,antialias:!0,resolution:window.devicePixelRatio}),Ge.stage.sortableChildren=!0,r.appendChild(Ge.view),_t.emit("applicationCreated",Ge),process.env.NODE_ENV==="development"&&(globalThis.__PIXI_APP__=Ge)}async function Ne(){return Ge||await We("applicationCreated")}function aC(r){Ge&&(Ge.resizeTo=r,_t.emit("applicationResized",Ge))}var fh={exports:{}};fh.exports,function(r,t){var e=200,i="__lodash_hash_undefined__",s=1,n=2,o=9007199254740991,a="[object Arguments]",h="[object Array]",l="[object AsyncFunction]",u="[object Boolean]",c="[object Date]",d="[object Error]",p="[object Function]",m="[object GeneratorFunction]",f="[object Map]",g="[object Number]",y="[object Null]",_="[object Object]",b="[object Promise]",v="[object Proxy]",S="[object RegExp]",E="[object Set]",A="[object String]",I="[object Symbol]",P="[object Undefined]",W="[object WeakMap]",G="[object ArrayBuffer]",N="[object DataView]",C="[object Float32Array]",F="[object Float64Array]",X="[object Int8Array]",V="[object Int16Array]",L="[object Int32Array]",k="[object Uint8Array]",H="[object Uint8ClampedArray]",D="[object Uint16Array]",U="[object Uint32Array]",j=/[\\^$.*+?()[\]{}|]/g,q=/^\[object .+?Constructor\]$/,dt=/^(?:0|[1-9]\d*)$/,nt={};nt[C]=nt[F]=nt[X]=nt[V]=nt[L]=nt[k]=nt[H]=nt[D]=nt[U]=!0,nt[a]=nt[h]=nt[G]=nt[u]=nt[N]=nt[c]=nt[d]=nt[p]=nt[f]=nt[g]=nt[_]=nt[S]=nt[E]=nt[A]=nt[W]=!1;var Et=typeof ti=="object"&&ti&&ti.Object===Object&&ti,Mt=typeof self=="object"&&self&&self.Object===Object&&self,wt=Et||Mt||Function("return this")(),z=t&&!t.nodeType&&t,it=z&&!0&&r&&!r.nodeType&&r,tt=it&&it.exports===z,O=tt&&Et.process,yt=function(){try{return O&&O.binding&&O.binding("util")}catch{}}(),mt=yt&&yt.isTypedArray;function Rt(T,M){for(var x=-1,w=T==null?0:T.length,R=0,Z=[];++x<w;){var ht=T[x];M(ht,x,T)&&(Z[R++]=ht)}return Z}function Ut(T,M){for(var x=-1,w=M.length,R=T.length;++x<w;)T[R+x]=M[x];return T}function De(T,M){for(var x=-1,w=T==null?0:T.length;++x<w;)if(M(T[x],x,T))return!0;return!1}function ci(T,M){for(var x=-1,w=Array(T);++x<T;)w[x]=M(x);return w}function Id(T){return function(M){return T(M)}}function yn(T,M){return T.has(M)}function Ao(T,M){return T==null?void 0:T[M]}function bn(T){var M=-1,x=Array(T.size);return T.forEach(function(w,R){x[++M]=[R,w]}),x}function di(T,M){return function(x){return T(M(x))}}function kh(T){var M=-1,x=Array(T.size);return T.forEach(function(w){x[++M]=w}),x}var Oh=Array.prototype,Ad=Function.prototype,xn=Object.prototype,kr=wt["__core-js_shared__"],Mo=Ad.toString,ke=xn.hasOwnProperty,Ro=function(){var T=/[^.]+$/.exec(kr&&kr.keys&&kr.keys.IE_PROTO||"");return T?"Symbol(src)_1."+T:""}(),Po=xn.toString,Bh=RegExp("^"+Mo.call(ke).replace(j,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Wh=tt?wt.Buffer:void 0,_n=wt.Symbol,ki=wt.Uint8Array,ws=xn.propertyIsEnumerable,Md=Oh.splice,Oi=_n?_n.toStringTag:void 0,Uh=Object.getOwnPropertySymbols,Xh=Wh?Wh.isBuffer:void 0,Ss=di(Object.keys,Object),Lo=dr(wt,"DataView"),Oe=dr(wt,"Map"),Go=dr(wt,"Promise"),No=dr(wt,"Set"),Fo=dr(wt,"WeakMap"),Es=dr(Object,"create"),Rd=fi(Lo),pi=fi(Oe),Pd=fi(Go),Ld=fi(No),Gd=fi(Fo),Zh=_n?_n.prototype:void 0,Do=Zh?Zh.valueOf:void 0;function Ie(T){var M=-1,x=T==null?0:T.length;for(this.clear();++M<x;){var w=T[M];this.set(w[0],w[1])}}function Nd(){this.__data__=Es?Es(null):{},this.size=0}function Fd(T){var M=this.has(T)&&delete this.__data__[T];return this.size-=M?1:0,M}function Dd(T){var M=this.__data__;if(Es){var x=M[T];return x===i?void 0:x}return ke.call(M,T)?M[T]:void 0}function kd(T){var M=this.__data__;return Es?M[T]!==void 0:ke.call(M,T)}function Od(T,M){var x=this.__data__;return this.size+=this.has(T)?0:1,x[T]=Es&&M===void 0?i:M,this}Ie.prototype.clear=Nd,Ie.prototype.delete=Fd,Ie.prototype.get=Dd,Ie.prototype.has=kd,Ie.prototype.set=Od;function fe(T){var M=-1,x=T==null?0:T.length;for(this.clear();++M<x;){var w=T[M];this.set(w[0],w[1])}}function Bd(){this.__data__=[],this.size=0}function Wd(T){var M=this.__data__,x=Tn(M,T);if(x<0)return!1;var w=M.length-1;return x==w?M.pop():Md.call(M,x,1),--this.size,!0}function Ud(T){var M=this.__data__,x=Tn(M,T);return x<0?void 0:M[x][1]}function Xd(T){return Tn(this.__data__,T)>-1}function Zd(T,M){var x=this.__data__,w=Tn(x,T);return w<0?(++this.size,x.push([T,M])):x[w][1]=M,this}fe.prototype.clear=Bd,fe.prototype.delete=Wd,fe.prototype.get=Ud,fe.prototype.has=Xd,fe.prototype.set=Zd;function ur(T){var M=-1,x=T==null?0:T.length;for(this.clear();++M<x;){var w=T[M];this.set(w[0],w[1])}}function ko(){this.size=0,this.__data__={hash:new Ie,map:new(Oe||fe),string:new Ie}}function Vd(T){var M=Sn(this,T).delete(T);return this.size-=M?1:0,M}function vn(T){return Sn(this,T).get(T)}function Oo(T){return Sn(this,T).has(T)}function Hd(T,M){var x=Sn(this,T),w=x.size;return x.set(T,M),this.size+=x.size==w?0:1,this}ur.prototype.clear=ko,ur.prototype.delete=Vd,ur.prototype.get=vn,ur.prototype.has=Oo,ur.prototype.set=Hd;function cr(T){var M=-1,x=T==null?0:T.length;for(this.__data__=new ur;++M<x;)this.add(T[M])}function Vh(T){return this.__data__.set(T,i),this}function Kd(T){return this.__data__.has(T)}cr.prototype.add=cr.prototype.push=Vh,cr.prototype.has=Kd;function Bi(T){var M=this.__data__=new fe(T);this.size=M.size}function Yd(){this.__data__=new fe,this.size=0}function Hh(T){var M=this.__data__,x=M.delete(T);return this.size=M.size,x}function zd(T){return this.__data__.get(T)}function jd(T){return this.__data__.has(T)}function Jd(T,M){var x=this.__data__;if(x instanceof fe){var w=x.__data__;if(!Oe||w.length<e-1)return w.push([T,M]),this.size=++x.size,this;x=this.__data__=new ur(w)}return x.set(T,M),this.size=x.size,this}Bi.prototype.clear=Yd,Bi.prototype.delete=Hh,Bi.prototype.get=zd,Bi.prototype.has=jd,Bi.prototype.set=Jd;function $d(T,M){var x=In(T),w=!x&&Uo(T),R=!x&&!w&&Is(T),Z=!x&&!w&&!R&&tl(T),ht=x||w||R||Z,pt=ht?ci(T.length,String):[],gt=pt.length;for(var ot in T)(M||ke.call(T,ot))&&!(ht&&(ot=="length"||R&&(ot=="offset"||ot=="parent")||Z&&(ot=="buffer"||ot=="byteLength"||ot=="byteOffset")||Wo(ot,gt)))&&pt.push(ot);return pt}function Tn(T,M){for(var x=T.length;x--;)if(Cn(T[x][0],M))return x;return-1}function Qd(T,M,x){var w=M(T);return In(T)?w:Ut(w,x(T))}function Cs(T){return T==null?T===void 0?P:y:Oi&&Oi in Object(T)?ip(T):En(T)}function Kh(T){return Br(T)&&Cs(T)==a}function Yh(T,M,x,w,R){return T===M?!0:T==null||M==null||!Br(T)&&!Br(M)?T!==T&&M!==M:qd(T,M,x,w,Yh,R)}function qd(T,M,x,w,R,Z){var ht=In(T),pt=In(M),gt=ht?h:Wi(T),ot=pt?h:Wi(M);gt=gt==a?_:gt,ot=ot==a?_:ot;var xt=gt==_,Ft=ot==_,At=gt==ot;if(At&&Is(T)){if(!Is(M))return!1;ht=!0,xt=!1}if(At&&!xt)return Z||(Z=new Bi),ht||tl(T)?zh(T,M,x,w,R,Z):jh(T,M,gt,x,w,R,Z);if(!(x&s)){var ne=xt&&ke.call(T,"__wrapped__"),me=Ft&&ke.call(M,"__wrapped__");if(ne||me){var Qe=ne?T.value():T,qe=me?M.value():M;return Z||(Z=new Bi),R(Qe,qe,x,w,Z)}}return At?(Z||(Z=new Bi),ep(T,M,x,w,R,Z)):!1}function wn(T){if(!qh(T)||np(T))return!1;var M=Ui(T)?Bh:q;return M.test(fi(T))}function Bo(T){return Br(T)&&Or(T.length)&&!!nt[Cs(T)]}function tp(T){if(!op(T))return Ss(T);var M=[];for(var x in Object(T))ke.call(T,x)&&x!="constructor"&&M.push(x);return M}function zh(T,M,x,w,R,Z){var ht=x&s,pt=T.length,gt=M.length;if(pt!=gt&&!(ht&>>pt))return!1;var ot=Z.get(T);if(ot&&Z.get(M))return ot==M;var xt=-1,Ft=!0,At=x&n?new cr:void 0;for(Z.set(T,M),Z.set(M,T);++xt<pt;){var ne=T[xt],me=M[xt];if(w)var Qe=ht?w(me,ne,xt,M,T,Z):w(ne,me,xt,T,M,Z);if(Qe!==void 0){if(Qe)continue;Ft=!1;break}if(At){if(!De(M,function(qe,As){if(!yn(At,As)&&(ne===qe||R(ne,qe,x,w,Z)))return At.push(As)})){Ft=!1;break}}else if(!(ne===me||R(ne,me,x,w,Z))){Ft=!1;break}}return Z.delete(T),Z.delete(M),Ft}function jh(T,M,x,w,R,Z,ht){switch(x){case N:if(T.byteLength!=M.byteLength||T.byteOffset!=M.byteOffset)return!1;T=T.buffer,M=M.buffer;case G:return!(T.byteLength!=M.byteLength||!Z(new ki(T),new ki(M)));case u:case c:case g:return Cn(+T,+M);case d:return T.name==M.name&&T.message==M.message;case S:case A:return T==M+"";case f:var pt=bn;case E:var gt=w&s;if(pt||(pt=kh),T.size!=M.size&&!gt)return!1;var ot=ht.get(T);if(ot)return ot==M;w|=n,ht.set(T,M);var xt=zh(pt(T),pt(M),w,R,Z,ht);return ht.delete(T),xt;case I:if(Do)return Do.call(T)==Do.call(M)}return!1}function ep(T,M,x,w,R,Z){var ht=x&s,pt=Jh(T),gt=pt.length,ot=Jh(M),xt=ot.length;if(gt!=xt&&!ht)return!1;for(var Ft=gt;Ft--;){var At=pt[Ft];if(!(ht?At in M:ke.call(M,At)))return!1}var ne=Z.get(T);if(ne&&Z.get(M))return ne==M;var me=!0;Z.set(T,M),Z.set(M,T);for(var Qe=ht;++Ft<gt;){At=pt[Ft];var qe=T[At],As=M[At];if(w)var vb=ht?w(As,qe,At,M,T,Z):w(qe,As,At,T,M,Z);if(!(vb===void 0?qe===As||R(qe,As,x,w,Z):vb)){me=!1;break}Qe||(Qe=At=="constructor")}if(me&&!Qe){var il=T.constructor,rl=M.constructor;il!=rl&&"constructor"in T&&"constructor"in M&&!(typeof il=="function"&&il instanceof il&&typeof rl=="function"&&rl instanceof rl)&&(me=!1)}return Z.delete(T),Z.delete(M),me}function Jh(T){return Qd(T,el,rp)}function Sn(T,M){var x=T.__data__;return sp(M)?x[typeof M=="string"?"string":"hash"]:x.map}function dr(T,M){var x=Ao(T,M);return wn(x)?x:void 0}function ip(T){var M=ke.call(T,Oi),x=T[Oi];try{T[Oi]=void 0;var w=!0}catch{}var R=Po.call(T);return w&&(M?T[Oi]=x:delete T[Oi]),R}var rp=Uh?function(T){return T==null?[]:(T=Object(T),Rt(Uh(T),function(M){return ws.call(T,M)}))}:ap,Wi=Cs;(Lo&&Wi(new Lo(new ArrayBuffer(1)))!=N||Oe&&Wi(new Oe)!=f||Go&&Wi(Go.resolve())!=b||No&&Wi(new No)!=E||Fo&&Wi(new Fo)!=W)&&(Wi=function(T){var M=Cs(T),x=M==_?T.constructor:void 0,w=x?fi(x):"";if(w)switch(w){case Rd:return N;case pi:return f;case Pd:return b;case Ld:return E;case Gd:return W}return M});function Wo(T,M){return M=M??o,!!M&&(typeof T=="number"||dt.test(T))&&T>-1&&T%1==0&&T<M}function sp(T){var M=typeof T;return M=="string"||M=="number"||M=="symbol"||M=="boolean"?T!=="__proto__":T===null}function np(T){return!!Ro&&Ro in T}function op(T){var M=T&&T.constructor,x=typeof M=="function"&&M.prototype||xn;return T===x}function En(T){return Po.call(T)}function fi(T){if(T!=null){try{return Mo.call(T)}catch{}try{return T+""}catch{}}return""}function Cn(T,M){return T===M||T!==T&&M!==M}var Uo=Kh(function(){return arguments}())?Kh:function(T){return Br(T)&&ke.call(T,"callee")&&!ws.call(T,"callee")},In=Array.isArray;function $h(T){return T!=null&&Or(T.length)&&!Ui(T)}var Is=Xh||hp;function Qh(T,M){return Yh(T,M)}function Ui(T){if(!qh(T))return!1;var M=Cs(T);return M==p||M==m||M==l||M==v}function Or(T){return typeof T=="number"&&T>-1&&T%1==0&&T<=o}function qh(T){var M=typeof T;return T!=null&&(M=="object"||M=="function")}function Br(T){return T!=null&&typeof T=="object"}var tl=mt?Id(mt):Bo;function el(T){return $h(T)?$d(T):tp(T)}function ap(){return[]}function hp(){return!1}r.exports=Qh}(fh,fh.exports);var hC=fh.exports;const ty=Gn(hC);var lC=Object.defineProperty,uC=(r,t,e)=>t in r?lC(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,B=(r,t,e)=>(uC(r,typeof t!="symbol"?t+"":t,e),e);class Je{constructor(t){B(this,"parent"),B(this,"paused"),this.parent=t,this.paused=!1}destroy(){}down(t){return!1}move(t){return!1}up(t){return!1}wheel(t){return!1}update(t){}resize(){}reset(){}pause(){this.paused=!0}resume(){this.paused=!1}}var cC=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},ey={exports:{}};(function(r,t){(function(){var e,i;i=function(s){return r.exports=s},e={linear:function(s,n,o,a){return o*s/a+n},easeInQuad:function(s,n,o,a){return o*(s/=a)*s+n},easeOutQuad:function(s,n,o,a){return-o*(s/=a)*(s-2)+n},easeInOutQuad:function(s,n,o,a){return(s/=a/2)<1?o/2*s*s+n:-o/2*(--s*(s-2)-1)+n},easeInCubic:function(s,n,o,a){return o*(s/=a)*s*s+n},easeOutCubic:function(s,n,o,a){return o*((s=s/a-1)*s*s+1)+n},easeInOutCubic:function(s,n,o,a){return(s/=a/2)<1?o/2*s*s*s+n:o/2*((s-=2)*s*s+2)+n},easeInQuart:function(s,n,o,a){return o*(s/=a)*s*s*s+n},easeOutQuart:function(s,n,o,a){return-o*((s=s/a-1)*s*s*s-1)+n},easeInOutQuart:function(s,n,o,a){return(s/=a/2)<1?o/2*s*s*s*s+n:-o/2*((s-=2)*s*s*s-2)+n},easeInQuint:function(s,n,o,a){return o*(s/=a)*s*s*s*s+n},easeOutQuint:function(s,n,o,a){return o*((s=s/a-1)*s*s*s*s+1)+n},easeInOutQuint:function(s,n,o,a){return(s/=a/2)<1?o/2*s*s*s*s*s+n:o/2*((s-=2)*s*s*s*s+2)+n},easeInSine:function(s,n,o,a){return-o*Math.cos(s/a*(Math.PI/2))+o+n},easeOutSine:function(s,n,o,a){return o*Math.sin(s/a*(Math.PI/2))+n},easeInOutSine:function(s,n,o,a){return-o/2*(Math.cos(Math.PI*s/a)-1)+n},easeInExpo:function(s,n,o,a){return s===0?n:o*Math.pow(2,10*(s/a-1))+n},easeOutExpo:function(s,n,o,a){return s===a?n+o:o*(-Math.pow(2,-10*s/a)+1)+n},easeInOutExpo:function(s,n,o,a){return(s/=a/2)<1?o/2*Math.pow(2,10*(s-1))+n:o/2*(-Math.pow(2,-10*--s)+2)+n},easeInCirc:function(s,n,o,a){return-o*(Math.sqrt(1-(s/=a)*s)-1)+n},easeOutCirc:function(s,n,o,a){return o*Math.sqrt(1-(s=s/a-1)*s)+n},easeInOutCirc:function(s,n,o,a){return(s/=a/2)<1?-o/2*(Math.sqrt(1-s*s)-1)+n:o/2*(Math.sqrt(1-(s-=2)*s)+1)+n},easeInElastic:function(s,n,o,a){var h,l,u;return u=1.70158,l=0,h=o,s===0||(s/=a),l||(l=a*.3),h<Math.abs(o)?(h=o,u=l/4):u=l/(2*Math.PI)*Math.asin(o/h),-(h*Math.pow(2,10*(s-=1))*Math.sin((s*a-u)*(2*Math.PI)/l))+n},easeOutElastic:function(s,n,o,a){var h,l,u;return u=1.70158,l=0,h=o,s===0||(s/=a),l||(l=a*.3),h<Math.abs(o)?(h=o,u=l/4):u=l/(2*Math.PI)*Math.asin(o/h),h*Math.pow(2,-10*s)*Math.sin((s*a-u)*(2*Math.PI)/l)+o+n},easeInOutElastic:function(s,n,o,a){var h,l,u;return u=1.70158,l=0,h=o,s===0||(s/=a/2),l||(l=a*(.3*1.5)),h<Math.abs(o)?(h=o,u=l/4):u=l/(2*Math.PI)*Math.asin(o/h),s<1?-.5*(h*Math.pow(2,10*(s-=1))*Math.sin((s*a-u)*(2*Math.PI)/l))+n:h*Math.pow(2,-10*(s-=1))*Math.sin((s*a-u)*(2*Math.PI)/l)*.5+o+n},easeInBack:function(s,n,o,a,h){return h===void 0&&(h=1.70158),o*(s/=a)*s*((h+1)*s-h)+n},easeOutBack:function(s,n,o,a,h){return h===void 0&&(h=1.70158),o*((s=s/a-1)*s*((h+1)*s+h)+1)+n},easeInOutBack:function(s,n,o,a,h){return h===void 0&&(h=1.70158),(s/=a/2)<1?o/2*(s*s*(((h*=1.525)+1)*s-h))+n:o/2*((s-=2)*s*(((h*=1.525)+1)*s+h)+2)+n},easeInBounce:function(s,n,o,a){var h;return h=e.easeOutBounce(a-s,0,o,a),o-h+n},easeOutBounce:function(s,n,o,a){return(s/=a)<1/2.75?o*(7.5625*s*s)+n:s<2/2.75?o*(7.5625*(s-=1.5/2.75)*s+.75)+n:s<2.5/2.75?o*(7.5625*(s-=2.25/2.75)*s+.9375)+n:o*(7.5625*(s-=2.625/2.75)*s+.984375)+n},easeInOutBounce:function(s,n,o,a){var h;return s<a/2?(h=e.easeInBounce(s*2,0,o,a),h*.5+n):(h=e.easeOutBounce(s*2-a,0,o,a),h*.5+o*.5+n)}},i(e)}).call(cC)})(ey);const iy=ey.exports;function mh(r,t){if(r){if(typeof r=="function")return r;if(typeof r=="string")return iy[r]}else return iy[t]}const dC={removeOnInterrupt:!1,ease:"linear",time:1e3};class pC extends Je{constructor(t,e={}){super(t),B(this,"options"),B(this,"startX"),B(this,"startY"),B(this,"deltaX"),B(this,"deltaY"),B(this,"keepCenter"),B(this,"startWidth",null),B(this,"startHeight",null),B(this,"deltaWidth",null),B(this,"deltaHeight",null),B(this,"width",null),B(this,"height",null),B(this,"time",0),this.options=Object.assign({},dC,e),this.options.ease=mh(this.options.ease),this.setupPosition(),this.setupZoom(),this.time=0}setupPosition(){typeof this.options.position<"u"?(this.startX=this.parent.center.x,this.startY=this.parent.center.y,this.deltaX=this.options.position.x-this.parent.center.x,this.deltaY=this.options.position.y-this.parent.center.y,this.keepCenter=!1):this.keepCenter=!0}setupZoom(){this.width=null,this.height=null,typeof this.options.scale<"u"?this.width=this.parent.screenWidth/this.options.scale:typeof this.options.scaleX<"u"||typeof this.options.scaleY<"u"?(typeof this.options.scaleX<"u"&&(this.width=this.parent.screenWidth/this.options.scaleX),typeof this.options.scaleY<"u"&&(this.height=this.parent.screenHeight/this.options.scaleY)):(typeof this.options.width<"u"&&(this.width=this.options.width),typeof this.options.height<"u"&&(this.height=this.options.height)),this.width!==null&&(this.startWidth=this.parent.screenWidthInWorldPixels,this.deltaWidth=this.width-this.startWidth),this.height!==null&&(this.startHeight=this.parent.screenHeightInWorldPixels,this.deltaHeight=this.height-this.startHeight)}down(){return this.options.removeOnInterrupt&&this.parent.plugins.remove("animate"),!1}complete(){this.parent.plugins.remove("animate"),this.width!==null&&this.parent.fitWidth(this.width,this.keepCenter,this.height===null),this.height!==null&&this.parent.fitHeight(this.height,this.keepCenter,this.width===null),!this.keepCenter&&this.options.position&&this.parent.moveCenter(this.options.position),this.parent.emit("animate-end",this.parent),this.options.callbackOnComplete&&this.options.callbackOnComplete(this.parent)}update(t){if(this.paused)return;this.time+=t;const e=new lt(this.parent.scale.x,this.parent.scale.y);if(this.time>=this.options.time){const i=this.parent.width,s=this.parent.height;this.complete(),(i!==this.parent.width||s!==this.parent.height)&&this.parent.emit("zoomed",{viewport:this.parent,original:e,type:"animate"})}else{const i=this.options.ease(this.time,0,1,this.options.time);if(this.width!==null){const s=this.startWidth,n=this.deltaWidth;this.parent.fitWidth(s+n*i,this.keepCenter,this.height===null)}if(this.height!==null){const s=this.startHeight,n=this.deltaHeight;this.parent.fitHeight(s+n*i,this.keepCenter,this.width===null)}if(this.width===null?this.parent.scale.x=this.parent.scale.y:this.height===null&&(this.parent.scale.y=this.parent.scale.x),!this.keepCenter){const s=this.startX,n=this.startY,o=this.deltaX,a=this.deltaY,h=new lt(this.parent.x,this.parent.y);this.parent.moveCenter(s+o*i,n+a*i),this.parent.emit("moved",{viewport:this.parent,original:h,type:"animate"})}(this.width||this.height)&&this.parent.emit("zoomed",{viewport:this.parent,original:e,type:"animate"})}}}const fC={sides:"all",friction:.5,time:150,ease:"easeInOutSine",underflow:"center",bounceBox:null};class mC extends Je{constructor(t,e={}){super(t),B(this,"options"),B(this,"left"),B(this,"top"),B(this,"right"),B(this,"bottom"),B(this,"underflowX"),B(this,"underflowY"),B(this,"ease"),B(this,"toX"),B(this,"toY"),this.options=Object.assign({},fC,e),this.ease=mh(this.options.ease,"easeInOutSine"),this.options.sides?this.options.sides==="all"?this.top=this.bottom=this.left=this.right=!0:this.options.sides==="horizontal"?(this.right=this.left=!0,this.top=this.bottom=!1):this.options.sides==="vertical"?(this.left=this.right=!1,this.top=this.bottom=!0):(this.top=this.options.sides.indexOf("top")!==-1,this.bottom=this.options.sides.indexOf("bottom")!==-1,this.left=this.options.sides.indexOf("left")!==-1,this.right=this.options.sides.indexOf("right")!==-1):this.left=this.top=this.right=this.bottom=!1;const i=this.options.underflow.toLowerCase();i==="center"?(this.underflowX=0,this.underflowY=0):(this.underflowX=i.indexOf("left")!==-1?-1:i.indexOf("right")!==-1?1:0,this.underflowY=i.indexOf("top")!==-1?-1:i.indexOf("bottom")!==-1?1:0),this.reset()}isActive(){return this.toX!==null||this.toY!==null}down(){return this.toX=this.toY=null,!1}up(){return this.bounce(),!1}update(t){if(!this.paused){if(this.bounce(),this.toX){const e=this.toX;e.time+=t,this.parent.emit("moved",{viewport:this.parent,type:"bounce-x"}),e.time>=this.options.time?(this.parent.x=e.end,this.toX=null,this.parent.emit("bounce-x-end",this.parent)):this.parent.x=this.ease(e.time,e.start,e.delta,this.options.time)}if(this.toY){const e=this.toY;e.time+=t,this.parent.emit("moved",{viewport:this.parent,type:"bounce-y"}),e.time>=this.options.time?(this.parent.y=e.end,this.toY=null,this.parent.emit("bounce-y-end",this.parent)):this.parent.y=this.ease(e.time,e.start,e.delta,this.options.time)}}}calcUnderflowX(){let t;switch(this.underflowX){case-1:t=0;break;case 1:t=this.parent.screenWidth-this.parent.screenWorldWidth;break;default:t=(this.parent.screenWidth-this.parent.screenWorldWidth)/2}return t}calcUnderflowY(){let t;switch(this.underflowY){case-1:t=0;break;case 1:t=this.parent.screenHeight-this.parent.screenWorldHeight;break;default:t=(this.parent.screenHeight-this.parent.screenWorldHeight)/2}return t}oob(){const t=this.options.bounceBox;if(t){const e=typeof t.x>"u"?0:t.x,i=typeof t.y>"u"?0:t.y,s=typeof t.width>"u"?this.parent.worldWidth:t.width,n=typeof t.height>"u"?this.parent.worldHeight:t.height;return{left:this.parent.left<e,right:this.parent.right>s,top:this.parent.top<i,bottom:this.parent.bottom>n,topLeft:new lt(e*this.parent.scale.x,i*this.parent.scale.y),bottomRight:new lt(s*this.parent.scale.x-this.parent.screenWidth,n*this.parent.scale.y-this.parent.screenHeight)}}return{left:this.parent.left<0,right:this.parent.right>this.parent.worldWidth,top:this.parent.top<0,bottom:this.parent.bottom>this.parent.worldHeight,topLeft:new lt(0,0),bottomRight:new lt(this.parent.worldWidth*this.parent.scale.x-this.parent.screenWidth,this.parent.worldHeight*this.parent.scale.y-this.parent.screenHeight)}}bounce(){var t,e;if(this.paused)return;let i,s=this.parent.plugins.get("decelerate",!0);s&&(s.x||s.y)&&(s.x&&s.percentChangeX===((t=s.options)==null?void 0:t.friction)||s.y&&s.percentChangeY===((e=s.options)==null?void 0:e.friction))&&(i=this.oob(),(i.left&&this.left||i.right&&this.right)&&(s.percentChangeX=this.options.friction),(i.top&&this.top||i.bottom&&this.bottom)&&(s.percentChangeY=this.options.friction));const n=this.parent.plugins.get("drag",!0)||{},o=this.parent.plugins.get("pinch",!0)||{};if(s=s||{},!(n!=null&&n.active)&&!(o!=null&&o.active)&&(!this.toX||!this.toY)&&(!s.x||!s.y)){i=i||this.oob();const a=i.topLeft,h=i.bottomRight;if(!this.toX&&!s.x){let l=null;i.left&&this.left?l=this.parent.screenWorldWidth<this.parent.screenWidth?this.calcUnderflowX():-a.x:i.right&&this.right&&(l=this.parent.screenWorldWidth<this.parent.screenWidth?this.calcUnderflowX():-h.x),l!==null&&this.parent.x!==l&&(this.toX={time:0,start:this.parent.x,delta:l-this.parent.x,end:l},this.parent.emit("bounce-x-start",this.parent))}if(!this.toY&&!s.y){let l=null;i.top&&this.top?l=this.parent.screenWorldHeight<this.parent.screenHeight?this.calcUnderflowY():-a.y:i.bottom&&this.bottom&&(l=this.parent.screenWorldHeight<this.parent.screenHeight?this.calcUnderflowY():-h.y),l!==null&&this.parent.y!==l&&(this.toY={time:0,start:this.parent.y,delta:l-this.parent.y,end:l},this.parent.emit("bounce-y-start",this.parent))}}}reset(){this.toX=this.toY=null,this.bounce()}}const gC={left:!1,right:!1,top:!1,bottom:!1,direction:null,underflow:"center"};class yC extends Je{constructor(t,e={}){super(t),B(this,"options"),B(this,"last"),B(this,"noUnderflow"),B(this,"underflowX"),B(this,"underflowY"),this.options=Object.assign({},gC,e),this.options.direction&&(this.options.left=this.options.direction==="x"||this.options.direction==="all"?!0:null,this.options.right=this.options.direction==="x"||this.options.direction==="all"?!0:null,this.options.top=this.options.direction==="y"||this.options.direction==="all"?!0:null,this.options.bottom=this.options.direction==="y"||this.options.direction==="all"?!0:null),this.parseUnderflow(),this.last={x:null,y:null,scaleX:null,scaleY:null},this.update()}parseUnderflow(){const t=this.options.underflow.toLowerCase();t==="none"?this.noUnderflow=!0:t==="center"?(this.underflowX=this.underflowY=0,this.noUnderflow=!1):(this.underflowX=t.indexOf("left")!==-1?-1:t.indexOf("right")!==-1?1:0,this.underflowY=t.indexOf("top")!==-1?-1:t.indexOf("bottom")!==-1?1:0,this.noUnderflow=!1)}move(){return this.update(),!1}update(){if(this.paused||this.parent.x===this.last.x&&this.parent.y===this.last.y&&this.parent.scale.x===this.last.scaleX&&this.parent.scale.y===this.last.scaleY)return;const t=new lt(this.parent.x,this.parent.y),e=this.parent.plugins.decelerate||{};if(this.options.left!==null||this.options.right!==null){let i=!1;if(!this.noUnderflow&&this.parent.screenWorldWidth<this.parent.screenWidth)switch(this.underflowX){case-1:this.parent.x!==0&&(this.parent.x=0,i=!0);break;case 1:this.parent.x!==this.parent.screenWidth-this.parent.screenWorldWidth&&(this.parent.x=this.parent.screenWidth-this.parent.screenWorldWidth,i=!0);break;default:this.parent.x!==(this.parent.screenWidth-this.parent.screenWorldWidth)/2&&(this.parent.x=(this.parent.screenWidth-this.parent.screenWorldWidth)/2,i=!0)}else this.options.left!==null&&this.parent.left<(this.options.left===!0?0:this.options.left)&&(this.parent.x=-(this.options.left===!0?0:this.options.left)*this.parent.scale.x,e.x=0,i=!0),this.options.right!==null&&this.parent.right>(this.options.right===!0?this.parent.worldWidth:this.options.right)&&(this.parent.x=-(this.options.right===!0?this.parent.worldWidth:this.options.right)*this.parent.scale.x+this.parent.screenWidth,e.x=0,i=!0);i&&this.parent.emit("moved",{viewport:this.parent,original:t,type:"clamp-x"})}if(this.options.top!==null||this.options.bottom!==null){let i=!1;if(!this.noUnderflow&&this.parent.screenWorldHeight<this.parent.screenHeight)switch(this.underflowY){case-1:this.parent.y!==0&&(this.parent.y=0,i=!0);break;case 1:this.parent.y!==this.parent.screenHeight-this.parent.screenWorldHeight&&(this.parent.y=this.parent.screenHeight-this.parent.screenWorldHeight,i=!0);break;default:this.parent.y!==(this.parent.screenHeight-this.parent.screenWorldHeight)/2&&(this.parent.y=(this.parent.screenHeight-this.parent.screenWorldHeight)/2,i=!0)}else this.options.top!==null&&this.parent.top<(this.options.top===!0?0:this.options.top)&&(this.parent.y=-(this.options.top===!0?0:this.options.top)*this.parent.scale.y,e.y=0,i=!0),this.options.bottom!==null&&this.parent.bottom>(this.options.bottom===!0?this.parent.worldHeight:this.options.bottom)&&(this.parent.y=-(this.options.bottom===!0?this.parent.worldHeight:this.options.bottom)*this.parent.scale.y+this.parent.screenHeight,e.y=0,i=!0);i&&this.parent.emit("moved",{viewport:this.parent,original:t,type:"clamp-y"})}this.last.x=this.parent.x,this.last.y=this.parent.y,this.last.scaleX=this.parent.scale.x,this.last.scaleY=this.parent.scale.y}reset(){this.update()}}const bC={minWidth:null,minHeight:null,maxWidth:null,maxHeight:null,minScale:null,maxScale:null};class xC extends Je{constructor(t,e={}){super(t),B(this,"options"),this.options=Object.assign({},bC,e),this.clamp()}resize(){this.clamp()}clamp(){if(!this.paused){if(this.options.minWidth||this.options.minHeight||this.options.maxWidth||this.options.maxHeight){let t=this.parent.worldScreenWidth,e=this.parent.worldScreenHeight;if(this.options.minWidth!==null&&t<this.options.minWidth){const i=this.parent.scale.x;this.parent.fitWidth(this.options.minWidth,!1,!1,!0),this.parent.scale.y*=this.parent.scale.x/i,t=this.parent.worldScreenWidth,e=this.parent.worldScreenHeight,this.parent.emit("zoomed",{viewport:this.parent,type:"clamp-zoom"})}if(this.options.maxWidth!==null&&t>this.options.maxWidth){const i=this.parent.scale.x;this.parent.fitWidth(this.options.maxWidth,!1,!1,!0),this.parent.scale.y*=this.parent.scale.x/i,t=this.parent.worldScreenWidth,e=this.parent.worldScreenHeight,this.parent.emit("zoomed",{viewport:this.parent,type:"clamp-zoom"})}if(this.options.minHeight!==null&&e<this.options.minHeight){const i=this.parent.scale.y;this.parent.fitHeight(this.options.minHeight,!1,!1,!0),this.parent.scale.x*=this.parent.scale.y/i,t=this.parent.worldScreenWidth,e=this.parent.worldScreenHeight,this.parent.emit("zoomed",{viewport:this.parent,type:"clamp-zoom"})}if(this.options.maxHeight!==null&&e>this.options.maxHeight){const i=this.parent.scale.y;this.parent.fitHeight(this.options.maxHeight,!1,!1,!0),this.parent.scale.x*=this.parent.scale.y/i,this.parent.emit("zoomed",{viewport:this.parent,type:"clamp-zoom"})}}else if(this.options.minScale||this.options.maxScale){const t={x:null,y:null},e={x:null,y:null};if(typeof this.options.minScale=="number")t.x=this.options.minScale,t.y=this.options.minScale;else if(this.options.minScale!==null){const n=this.options.minScale;t.x=typeof n.x>"u"?null:n.x,t.y=typeof n.y>"u"?null:n.y}if(typeof this.options.maxScale=="number")e.x=this.options.maxScale,e.y=this.options.maxScale;else if(this.options.maxScale!==null){const n=this.options.maxScale;e.x=typeof n.x>"u"?null:n.x,e.y=typeof n.y>"u"?null:n.y}let i=this.parent.scale.x,s=this.parent.scale.y;t.x!==null&&i<t.x&&(i=t.x),e.x!==null&&i>e.x&&(i=e.x),t.y!==null&&s<t.y&&(s=t.y),e.y!==null&&s>e.y&&(s=e.y),(i!==this.parent.scale.x||s!==this.parent.scale.y)&&(this.parent.scale.set(i,s),this.parent.emit("zoomed",{viewport:this.parent,type:"clamp-zoom"}))}}}reset(){this.clamp()}}const _C={friction:.98,bounce:.8,minSpeed:.01},Fr=16;class vC extends Je{constructor(t,e={}){super(t),B(this,"options"),B(this,"x"),B(this,"y"),B(this,"percentChangeX"),B(this,"percentChangeY"),B(this,"saved"),B(this,"timeSinceRelease"),this.options=Object.assign({},_C,e),this.saved=[],this.timeSinceRelease=0,this.reset(),this.parent.on("moved",i=>this.handleMoved(i))}down(){return this.saved=[],this.x=this.y=null,!1}isActive(){return!!(this.x||this.y)}move(){if(this.paused)return!1;const t=this.parent.input.count();return(t===1||t>1&&!this.parent.plugins.get("pinch",!0))&&(this.saved.push({x:this.parent.x,y:this.parent.y,time:performance.now()}),this.saved.length>60&&this.saved.splice(0,30)),!1}handleMoved(t){if(this.saved.length){const e=this.saved[this.saved.length-1];t.type==="clamp-x"&&t.original?e.x===t.original.x&&(e.x=this.parent.x):t.type==="clamp-y"&&t.original&&e.y===t.original.y&&(e.y=this.parent.y)}}up(){if(this.parent.input.count()===0&&this.saved.length){const t=performance.now();for(const e of this.saved)if(e.time>=t-100){const i=t-e.time;this.x=(this.parent.x-e.x)/i,this.y=(this.parent.y-e.y)/i,this.percentChangeX=this.percentChangeY=this.options.friction,this.timeSinceRelease=0;break}}return!1}activate(t){t=t||{},typeof t.x<"u"&&(this.x=t.x,this.percentChangeX=this.options.friction),typeof t.y<"u"&&(this.y=t.y,this.percentChangeY=this.options.friction)}update(t){if(this.paused)return;const e=this.x||this.y,i=this.timeSinceRelease,s=this.timeSinceRelease+t;if(this.x){const n=this.percentChangeX,o=Math.log(n);this.parent.x+=this.x*Fr/o*(Math.pow(n,s/Fr)-Math.pow(n,i/Fr)),this.x*=Math.pow(this.percentChangeX,t/Fr)}if(this.y){const n=this.percentChangeY,o=Math.log(n);this.parent.y+=this.y*Fr/o*(Math.pow(n,s/Fr)-Math.pow(n,i/Fr)),this.y*=Math.pow(this.percentChangeY,t/Fr)}this.timeSinceRelease+=t,this.x&&this.y?Math.abs(this.x)<this.options.minSpeed&&Math.abs(this.y)<this.options.minSpeed&&(this.x=0,this.y=0):(Math.abs(this.x||0)<this.options.minSpeed&&(this.x=0),Math.abs(this.y||0)<this.options.minSpeed&&(this.y=0)),e&&this.parent.emit("moved",{viewport:this.parent,type:"decelerate"})}reset(){this.x=this.y=null}}const TC={direction:"all",pressDrag:!0,wheel:!0,wheelScroll:1,reverse:!1,clampWheel:!1,underflow:"center",factor:1,mouseButtons:"all",keyToPress:null,ignoreKeyToPressOnTouch:!1,lineHeight:20,wheelSwapAxes:!1};class wC extends Je{constructor(t,e={}){super(t),B(this,"options"),B(this,"moved"),B(this,"reverse"),B(this,"xDirection"),B(this,"yDirection"),B(this,"keyIsPressed"),B(this,"mouse"),B(this,"underflowX"),B(this,"underflowY"),B(this,"last"),B(this,"current"),B(this,"windowEventHandlers",[]),this.options=Object.assign({},TC,e),this.moved=!1,this.reverse=this.options.reverse?1:-1,this.xDirection=!this.options.direction||this.options.direction==="all"||this.options.direction==="x",this.yDirection=!this.options.direction||this.options.direction==="all"||this.options.direction==="y",this.keyIsPressed=!1,this.parseUnderflow(),this.mouseButtons(this.options.mouseButtons),this.options.keyToPress&&this.handleKeyPresses(this.options.keyToPress)}handleKeyPresses(t){const e=s=>{t.includes(s.code)&&(this.keyIsPressed=!0)},i=s=>{t.includes(s.code)&&(this.keyIsPressed=!1)};this.addWindowEventHandler("keyup",i),this.addWindowEventHandler("keydown",e)}addWindowEventHandler(t,e){window.addEventListener(t,e),this.windowEventHandlers.push({event:t,handler:e})}destroy(){this.windowEventHandlers.forEach(({event:t,handler:e})=>{window.removeEventListener(t,e)})}mouseButtons(t){!t||t==="all"?this.mouse=[!0,!0,!0]:this.mouse=[t.indexOf("left")!==-1,t.indexOf("middle")!==-1,t.indexOf("right")!==-1]}parseUnderflow(){const t=this.options.underflow.toLowerCase();t==="center"?(this.underflowX=0,this.underflowY=0):(t.includes("left")?this.underflowX=-1:t.includes("right")?this.underflowX=1:this.underflowX=0,t.includes("top")?this.underflowY=-1:t.includes("bottom")?this.underflowY=1:this.underflowY=0)}checkButtons(t){const e=t.pointerType==="mouse",i=this.parent.input.count();return!!((i===1||i>1&&!this.parent.plugins.get("pinch",!0))&&(!e||this.mouse[t.button]))}checkKeyPress(t){return!this.options.keyToPress||this.keyIsPressed||this.options.ignoreKeyToPressOnTouch&&t.data.pointerType==="touch"}down(t){return this.paused||!this.options.pressDrag?!1:this.checkButtons(t)&&this.checkKeyPress(t)?(this.last={x:t.global.x,y:t.global.y},this.current=t.pointerId,!0):(this.last=null,!1)}get active(){return this.moved}move(t){if(this.paused||!this.options.pressDrag)return!1;if(this.last&&this.current===t.data.pointerId){const e=t.global.x,i=t.global.y,s=this.parent.input.count();if(s===1||s>1&&!this.parent.plugins.get("pinch",!0)){const n=e-this.last.x,o=i-this.last.y;if(this.moved||this.xDirection&&this.parent.input.checkThreshold(n)||this.yDirection&&this.parent.input.checkThreshold(o)){const a={x:e,y:i};return this.xDirection&&(this.parent.x+=(a.x-this.last.x)*this.options.factor),this.yDirection&&(this.parent.y+=(a.y-this.last.y)*this.options.factor),this.last=a,this.moved||this.parent.emit("drag-start",{event:t,screen:new lt(this.last.x,this.last.y),world:this.parent.toWorld(new lt(this.last.x,this.last.y)),viewport:this.parent}),this.moved=!0,this.parent.emit("moved",{viewport:this.parent,type:"drag"}),!0}}else this.moved=!1}return!1}up(t){if(this.paused)return!1;const e=this.parent.input.touches;if(e.length===1){const i=e[0];return i.last&&(this.last={x:i.last.x,y:i.last.y},this.current=i.id),this.moved=!1,!0}else if(this.last&&this.moved){const i=new lt(this.last.x,this.last.y);return this.parent.emit("drag-end",{event:t,screen:i,world:this.parent.toWorld(i),viewport:this.parent}),this.last=null,this.moved=!1,!0}return!1}wheel(t){if(this.paused)return!1;if(this.options.wheel){const e=this.parent.plugins.get("wheel",!0);if(!e||!e.options.wheelZoom&&!t.ctrlKey){const i=t.deltaMode?this.options.lineHeight:1,s=[t.deltaX,t.deltaY],[n,o]=this.options.wheelSwapAxes?s.reverse():s;return this.xDirection&&(this.parent.x+=n*i*this.options.wheelScroll*this.reverse),this.yDirection&&(this.parent.y+=o*i*this.options.wheelScroll*this.reverse),this.options.clampWheel&&this.clamp(),this.parent.emit("wheel-scroll",this.parent),this.parent.emit("moved",{viewport:this.parent,type:"wheel"}),this.parent.options.passiveWheel||t.preventDefault(),this.parent.options.stopPropagation&&t.stopPropagation(),!0}}return!1}resume(){this.last=null,this.paused=!1}clamp(){const t=this.parent.plugins.get("decelerate",!0)||{};if(this.options.clampWheel!=="y")if(this.parent.screenWorldWidth<this.parent.screenWidth)switch(this.underflowX){case-1:this.parent.x=0;break;case 1:this.parent.x=this.parent.screenWidth-this.parent.screenWorldWidth;break;default:this.parent.x=(this.parent.screenWidth-this.parent.screenWorldWidth)/2}else this.parent.left<0?(this.parent.x=0,t.x=0):this.parent.right>this.parent.worldWidth&&(this.parent.x=-this.parent.worldWidth*this.parent.scale.x+this.parent.screenWidth,t.x=0);if(this.options.clampWheel!=="x")if(this.parent.screenWorldHeight<this.parent.screenHeight)switch(this.underflowY){case-1:this.parent.y=0;break;case 1:this.parent.y=this.parent.screenHeight-this.parent.screenWorldHeight;break;default:this.parent.y=(this.parent.screenHeight-this.parent.screenWorldHeight)/2}else this.parent.top<0&&(this.parent.y=0,t.y=0),this.parent.bottom>this.parent.worldHeight&&(this.parent.y=-this.parent.worldHeight*this.parent.scale.y+this.parent.screenHeight,t.y=0)}}const SC={speed:0,acceleration:null,radius:null};class EC extends Je{constructor(t,e,i={}){super(t),B(this,"options"),B(this,"target"),B(this,"velocity"),this.target=e,this.options=Object.assign({},SC,i),this.velocity={x:0,y:0}}update(t){if(this.paused)return;const e=this.parent.center;let i=this.target.x,s=this.target.y;if(this.options.radius)if(Math.sqrt(Math.pow(this.target.y-e.y,2)+Math.pow(this.target.x-e.x,2))>this.options.radius){const a=Math.atan2(this.target.y-e.y,this.target.x-e.x);i=this.target.x-Math.cos(a)*this.options.radius,s=this.target.y-Math.sin(a)*this.options.radius}else return;const n=i-e.x,o=s-e.y;if(n||o)if(this.options.speed)if(this.options.acceleration){const a=Math.atan2(s-e.y,i-e.x),h=Math.sqrt(Math.pow(n,2)+Math.pow(o,2));if(h){const l=(Math.pow(this.velocity.x,2)+Math.pow(this.velocity.y,2))/(2*this.options.acceleration);h>l?this.velocity={x:Math.min(this.velocity.x+(this.options.acceleration*t,this.options.speed)),y:Math.min(this.velocity.y+(this.options.acceleration*t,this.options.speed))}:this.velocity={x:Math.max(this.velocity.x-this.options.acceleration*this.options.speed,0),y:Math.max(this.velocity.y-this.options.acceleration*this.options.speed,0)};const u=Math.cos(a)*this.velocity.x,c=Math.sin(a)*this.velocity.y,d=Math.abs(u)>Math.abs(n)?i:e.x+u,p=Math.abs(c)>Math.abs(o)?s:e.y+c;this.parent.moveCenter(d,p),this.parent.emit("moved",{viewport:this.parent,type:"follow"})}}else{const a=Math.atan2(s-e.y,i-e.x),h=Math.cos(a)*this.options.speed,l=Math.sin(a)*this.options.speed,u=Math.abs(h)>Math.abs(n)?i:e.x+h,c=Math.abs(l)>Math.abs(o)?s:e.y+l;this.parent.moveCenter(u,c),this.parent.emit("moved",{viewport:this.parent,type:"follow"})}else this.parent.moveCenter(i,s),this.parent.emit("moved",{viewport:this.parent,type:"follow"})}}const CC={radius:null,distance:null,top:null,bottom:null,left:null,right:null,speed:8,reverse:!1,noDecelerate:!1,linear:!1,allowButtons:!1};class IC extends Je{constructor(t,e={}){super(t),B(this,"options"),B(this,"reverse"),B(this,"radiusSquared"),B(this,"left"),B(this,"top"),B(this,"right"),B(this,"bottom"),B(this,"horizontal"),B(this,"vertical"),this.options=Object.assign({},CC,e),this.reverse=this.options.reverse?1:-1,this.radiusSquared=typeof this.options.radius=="number"?Math.pow(this.options.radius,2):null,this.resize()}resize(){const t=this.options.distance;t!==null?(this.left=t,this.top=t,this.right=this.parent.screenWidth-t,this.bottom=this.parent.screenHeight-t):this.options.radius||(this.left=this.options.left,this.top=this.options.top,this.right=this.options.right===null?null:this.parent.screenWidth-this.options.right,this.bottom=this.options.bottom===null?null:this.parent.screenHeight-this.options.bottom)}down(){return this.paused||this.options.allowButtons||(this.horizontal=this.vertical=null),!1}move(t){if(this.paused||t.pointerType!=="mouse"&&t.pointerId!==1||!this.options.allowButtons&&t.buttons!==0)return!1;const e=t.global.x,i=t.global.y;if(this.radiusSquared){const s=this.parent.toScreen(this.parent.center);if(Math.pow(s.x-e,2)+Math.pow(s.y-i,2)>=this.radiusSquared){const n=Math.atan2(s.y-i,s.x-e);this.options.linear?(this.horizontal=Math.round(Math.cos(n))*this.options.speed*this.reverse*(60/1e3),this.vertical=Math.round(Math.sin(n))*this.options.speed*this.reverse*(60/1e3)):(this.horizontal=Math.cos(n)*this.options.speed*this.reverse*(60/1e3),this.vertical=Math.sin(n)*this.options.speed*this.reverse*(60/1e3))}else this.horizontal&&this.decelerateHorizontal(),this.vertical&&this.decelerateVertical(),this.horizontal=this.vertical=0}else this.left!==null&&e<this.left?this.horizontal=Number(this.reverse)*this.options.speed*(60/1e3):this.right!==null&&e>this.right?this.horizontal=-1*this.reverse*this.options.speed*(60/1e3):(this.decelerateHorizontal(),this.horizontal=0),this.top!==null&&i<this.top?this.vertical=Number(this.reverse)*this.options.speed*(60/1e3):this.bottom!==null&&i>this.bottom?this.vertical=-1*this.reverse*this.options.speed*(60/1e3):(this.decelerateVertical(),this.vertical=0);return!1}decelerateHorizontal(){const t=this.parent.plugins.get("decelerate",!0);this.horizontal&&t&&!this.options.noDecelerate&&t.activate({x:this.horizontal*this.options.speed*this.reverse/(1e3/60)})}decelerateVertical(){const t=this.parent.plugins.get("decelerate",!0);this.vertical&&t&&!this.options.noDecelerate&&t.activate({y:this.vertical*this.options.speed*this.reverse/(1e3/60)})}up(){return this.paused||(this.horizontal&&this.decelerateHorizontal(),this.vertical&&this.decelerateVertical(),this.horizontal=this.vertical=null),!1}update(){if(!this.paused&&(this.horizontal||this.vertical)){const t=this.parent.center;this.horizontal&&(t.x+=this.horizontal*this.options.speed),this.vertical&&(t.y+=this.vertical*this.options.speed),this.parent.moveCenter(t),this.parent.emit("moved",{viewport:this.parent,type:"mouse-edges"})}}}const AC={noDrag:!1,percent:1,center:null,factor:1,axis:"all"};class MC extends Je{constructor(t,e={}){super(t),B(this,"options"),B(this,"active",!1),B(this,"pinching",!1),B(this,"moved",!1),B(this,"lastCenter"),this.options=Object.assign({},AC,e)}down(){return this.parent.input.count()>=2?(this.active=!0,!0):!1}isAxisX(){return["all","x"].includes(this.options.axis)}isAxisY(){return["all","y"].includes(this.options.axis)}move(t){if(this.paused||!this.active)return!1;const e=t.global.x,i=t.global.y,s=this.parent.input.touches;if(s.length>=2){const n=s[0],o=s[1],a=n.last&&o.last?Math.sqrt(Math.pow(o.last.x-n.last.x,2)+Math.pow(o.last.y-n.last.y,2)):null;if(n.id===t.pointerId?n.last={x:e,y:i,data:t}:o.id===t.pointerId&&(o.last={x:e,y:i,data:t}),a){let h;const l=new lt(n.last.x+(o.last.x-n.last.x)/2,n.last.y+(o.last.y-n.last.y)/2);this.options.center||(h=this.parent.toLocal(l));let u=Math.sqrt(Math.pow(o.last.x-n.last.x,2)+Math.pow(o.last.y-n.last.y,2));u=u===0?u=1e-10:u;const c=(1-a/u)*this.options.percent*(this.isAxisX()?this.parent.scale.x:this.parent.scale.y);this.isAxisX()&&(this.parent.scale.x+=c),this.isAxisY()&&(this.parent.scale.y+=c),this.parent.emit("zoomed",{viewport:this.parent,type:"pinch",center:l});const d=this.parent.plugins.get("clamp-zoom",!0);if(d&&d.clamp(),this.options.center)this.parent.moveCenter(this.options.center);else{const p=this.parent.toGlobal(h);this.parent.x+=(l.x-p.x)*this.options.factor,this.parent.y+=(l.y-p.y)*this.options.factor,this.parent.emit("moved",{viewport:this.parent,type:"pinch"})}!this.options.noDrag&&this.lastCenter&&(this.parent.x+=(l.x-this.lastCenter.x)*this.options.factor,this.parent.y+=(l.y-this.lastCenter.y)*this.options.factor,this.parent.emit("moved",{viewport:this.parent,type:"pinch"})),this.lastCenter=l,this.moved=!0}else this.pinching||(this.parent.emit("pinch-start",this.parent),this.pinching=!0);return!0}return!1}up(){return this.pinching&&this.parent.input.touches.length<=1?(this.active=!1,this.lastCenter=null,this.pinching=!1,this.moved=!1,this.parent.emit("pinch-end",this.parent),!0):!1}}const RC={topLeft:!1,friction:.8,time:1e3,ease:"easeInOutSine",interrupt:!0,removeOnComplete:!1,removeOnInterrupt:!1,forceStart:!1};class PC extends Je{constructor(t,e,i,s={}){super(t),B(this,"options"),B(this,"ease"),B(this,"x"),B(this,"y"),B(this,"percent"),B(this,"snapping"),B(this,"deltaX"),B(this,"deltaY"),B(this,"startX"),B(this,"startY"),this.options=Object.assign({},RC,s),this.ease=mh(s.ease,"easeInOutSine"),this.x=e,this.y=i,this.options.forceStart&&this.snapStart()}snapStart(){this.percent=0,this.snapping={time:0};const t=this.options.topLeft?this.parent.corner:this.parent.center;this.deltaX=this.x-t.x,this.deltaY=this.y-t.y,this.startX=t.x,this.startY=t.y,this.parent.emit("snap-start",this.parent)}wheel(){return this.options.removeOnInterrupt&&this.parent.plugins.remove("snap"),!1}down(){return this.options.removeOnInterrupt?this.parent.plugins.remove("snap"):this.options.interrupt&&(this.snapping=null),!1}up(){if(this.parent.input.count()===0){const t=this.parent.plugins.get("decelerate",!0);t&&(t.x||t.y)&&(t.percentChangeX=t.percentChangeY=this.options.friction)}return!1}update(t){if(!this.paused&&!(this.options.interrupt&&this.parent.input.count()!==0))if(this.snapping){const e=this.snapping;e.time+=t;let i,s,n;const o=this.startX,a=this.startY,h=this.deltaX,l=this.deltaY;if(e.time>this.options.time)i=!0,s=o+h,n=a+l;else{const u=this.ease(e.time,0,1,this.options.time);s=o+h*u,n=a+l*u}this.options.topLeft?this.parent.moveCorner(s,n):this.parent.moveCenter(s,n),this.parent.emit("moved",{viewport:this.parent,type:"snap"}),i&&(this.options.removeOnComplete&&this.parent.plugins.remove("snap"),this.parent.emit("snap-end",this.parent),this.snapping=null)}else{const e=this.options.topLeft?this.parent.corner:this.parent.center;(e.x!==this.x||e.y!==this.y)&&this.snapStart()}}}const LC={width:0,height:0,time:1e3,ease:"easeInOutSine",center:null,interrupt:!0,removeOnComplete:!1,removeOnInterrupt:!1,forceStart:!1,noMove:!1};class GC extends Je{constructor(t,e={}){super(t),B(this,"options"),B(this,"ease"),B(this,"xScale"),B(this,"yScale"),B(this,"xIndependent"),B(this,"yIndependent"),B(this,"snapping"),this.options=Object.assign({},LC,e),this.ease=mh(this.options.ease),this.xIndependent=!1,this.yIndependent=!1,this.xScale=0,this.yScale=0,this.options.width>0&&(this.xScale=t.screenWidth/this.options.width,this.xIndependent=!0),this.options.height>0&&(this.yScale=t.screenHeight/this.options.height,this.yIndependent=!0),this.xScale=this.xIndependent?this.xScale:this.yScale,this.yScale=this.yIndependent?this.yScale:this.xScale,this.options.time===0?(t.container.scale.x=this.xScale,t.container.scale.y=this.yScale,this.options.removeOnComplete&&this.parent.plugins.remove("snap-zoom")):e.forceStart&&this.createSnapping()}createSnapping(){const t=this.parent.worldScreenWidth,e=this.parent.worldScreenHeight,i=this.parent.screenWidth/this.xScale,s=this.parent.screenHeight/this.yScale;this.snapping={time:0,startX:t,startY:e,deltaX:i-t,deltaY:s-e},this.parent.emit("snap-zoom-start",this.parent)}resize(){this.snapping=null,this.options.width>0&&(this.xScale=this.parent.screenWidth/this.options.width),this.options.height>0&&(this.yScale=this.parent.screenHeight/this.options.height),this.xScale=this.xIndependent?this.xScale:this.yScale,this.yScale=this.yIndependent?this.yScale:this.xScale}wheel(){return this.options.removeOnInterrupt&&this.parent.plugins.remove("snap-zoom"),!1}down(){return this.options.removeOnInterrupt?this.parent.plugins.remove("snap-zoom"):this.options.interrupt&&(this.snapping=null),!1}update(t){if(this.paused||this.options.interrupt&&this.parent.input.count()!==0)return;let e;if(!this.options.center&&!this.options.noMove&&(e=this.parent.center),!this.snapping)(this.parent.scale.x!==this.xScale||this.parent.scale.y!==this.yScale)&&this.createSnapping();else if(this.snapping){const i=this.snapping;if(i.time+=t,i.time>=this.options.time)this.parent.scale.set(this.xScale,this.yScale),this.options.removeOnComplete&&this.parent.plugins.remove("snap-zoom"),this.parent.emit("snap-zoom-end",this.parent),this.snapping=null;else{const n=this.snapping,o=this.ease(n.time,n.startX,n.deltaX,this.options.time),a=this.ease(n.time,n.startY,n.deltaY,this.options.time);this.parent.scale.x=this.parent.screenWidth/o,this.parent.scale.y=this.parent.screenHeight/a}const s=this.parent.plugins.get("clamp-zoom",!0);s&&s.clamp(),this.options.noMove||(this.options.center?this.parent.moveCenter(this.options.center):this.parent.moveCenter(e))}}resume(){this.snapping=null,super.resume()}}const NC={percent:.1,smooth:!1,interrupt:!0,reverse:!1,center:null,lineHeight:20,axis:"all",keyToPress:null,trackpadPinch:!1,wheelZoom:!0};class FC extends Je{constructor(t,e={}){super(t),B(this,"options"),B(this,"smoothing"),B(this,"smoothingCenter"),B(this,"smoothingCount"),B(this,"keyIsPressed"),this.options=Object.assign({},NC,e),this.keyIsPressed=!1,this.options.keyToPress&&this.handleKeyPresses(this.options.keyToPress)}handleKeyPresses(t){window.addEventListener("keydown",e=>{t.includes(e.code)&&(this.keyIsPressed=!0)}),window.addEventListener("keyup",e=>{t.includes(e.code)&&(this.keyIsPressed=!1)})}checkKeyPress(){return!this.options.keyToPress||this.keyIsPressed}down(){return this.options.interrupt&&(this.smoothing=null),!1}isAxisX(){return["all","x"].includes(this.options.axis)}isAxisY(){return["all","y"].includes(this.options.axis)}update(){if(this.smoothing){const t=this.smoothingCenter,e=this.smoothing;let i;this.options.center||(i=this.parent.toLocal(t)),this.isAxisX()&&(this.parent.scale.x+=e.x),this.isAxisY()&&(this.parent.scale.y+=e.y),this.parent.emit("zoomed",{viewport:this.parent,type:"wheel"});const s=this.parent.plugins.get("clamp-zoom",!0);if(s&&s.clamp(),this.options.center)this.parent.moveCenter(this.options.center);else{const n=this.parent.toGlobal(i);this.parent.x+=t.x-n.x,this.parent.y+=t.y-n.y}this.parent.emit("moved",{viewport:this.parent,type:"wheel"}),this.smoothingCount++,this.smoothingCount>=this.options.smooth&&(this.smoothing=null)}}pinch(t){if(this.paused)return;const e=this.parent.input.getPointerPosition(t),i=-t.deltaY*(t.deltaMode?this.options.lineHeight:1)/200,s=Math.pow(2,(1+this.options.percent)*i);let n;this.options.center||(n=this.parent.toLocal(e)),this.isAxisX()&&(this.parent.scale.x*=s),this.isAxisY()&&(this.parent.scale.y*=s),this.parent.emit("zoomed",{viewport:this.parent,type:"wheel"});const o=this.parent.plugins.get("clamp-zoom",!0);if(o&&o.clamp(),this.options.center)this.parent.moveCenter(this.options.center);else{const a=this.parent.toGlobal(n);this.parent.x+=e.x-a.x,this.parent.y+=e.y-a.y}this.parent.emit("moved",{viewport:this.parent,type:"wheel"}),this.parent.emit("wheel-start",{event:t,viewport:this.parent})}wheel(t){if(this.paused||!this.checkKeyPress())return!1;if(t.ctrlKey&&this.options.trackpadPinch)this.pinch(t);else if(this.options.wheelZoom){const e=this.parent.input.getPointerPosition(t),i=(this.options.reverse?-1:1)*-t.deltaY*(t.deltaMode?this.options.lineHeight:1)/500,s=Math.pow(2,(1+this.options.percent)*i);if(this.options.smooth){const n={x:this.smoothing?this.smoothing.x*(this.options.smooth-this.smoothingCount):0,y:this.smoothing?this.smoothing.y*(this.options.smooth-this.smoothingCount):0};this.smoothing={x:((this.parent.scale.x+n.x)*s-this.parent.scale.x)/this.options.smooth,y:((this.parent.scale.y+n.y)*s-this.parent.scale.y)/this.options.smooth},this.smoothingCount=0,this.smoothingCenter=e}else{let n;this.options.center||(n=this.parent.toLocal(e)),this.isAxisX()&&(this.parent.scale.x*=s),this.isAxisY()&&(this.parent.scale.y*=s),this.parent.emit("zoomed",{viewport:this.parent,type:"wheel"});const o=this.parent.plugins.get("clamp-zoom",!0);if(o&&o.clamp(),this.options.center)this.parent.moveCenter(this.options.center);else{const a=this.parent.toGlobal(n);this.parent.x+=e.x-a.x,this.parent.y+=e.y-a.y}}this.parent.emit("moved",{viewport:this.parent,type:"wheel"}),this.parent.emit("wheel-start",{event:t,viewport:this.parent})}return!this.parent.options.passiveWheel}}class DC{constructor(t){B(this,"viewport"),B(this,"clickedAvailable"),B(this,"isMouseDown"),B(this,"last"),B(this,"wheelFunction"),B(this,"touches"),this.viewport=t,this.touches=[],this.addListeners()}addListeners(){this.viewport.eventMode="static",this.viewport.forceHitArea||(this.viewport.hitArea=new ct(0,0,this.viewport.worldWidth,this.viewport.worldHeight)),this.viewport.on("pointerdown",this.down,this),this.viewport.options.allowPreserveDragOutside?this.viewport.on("globalpointermove",this.move,this):this.viewport.on("pointermove",this.move,this),this.viewport.on("pointerup",this.up,this),this.viewport.on("pointerupoutside",this.up,this),this.viewport.on("pointercancel",this.up,this),this.viewport.options.allowPreserveDragOutside||this.viewport.on("pointerleave",this.up,this),this.wheelFunction=t=>this.handleWheel(t),this.viewport.options.events.domElement.addEventListener("wheel",this.wheelFunction,{passive:this.viewport.options.passiveWheel}),this.isMouseDown=!1}destroy(){this.viewport.options.events.domElement.removeEventListener("wheel",this.wheelFunction)}down(t){if(!(this.viewport.pause||!this.viewport.worldVisible)){if(t.pointerType==="mouse"?this.isMouseDown=!0:this.get(t.pointerId)||this.touches.push({id:t.pointerId,last:null}),this.count()===1){this.last=t.global.clone();const e=this.viewport.plugins.get("decelerate",!0),i=this.viewport.plugins.get("bounce",!0);(!e||!e.isActive())&&(!i||!i.isActive())?this.clickedAvailable=!0:this.clickedAvailable=!1}else this.clickedAvailable=!1;this.viewport.plugins.down(t)&&this.viewport.options.stopPropagation&&t.stopPropagation()}}clear(){this.isMouseDown=!1,this.touches=[],this.last=null}checkThreshold(t){return Math.abs(t)>=this.viewport.threshold}move(t){if(this.viewport.pause||!this.viewport.worldVisible)return;const e=this.viewport.plugins.move(t);if(this.clickedAvailable&&this.last){const i=t.global.x-this.last.x,s=t.global.y-this.last.y;(this.checkThreshold(i)||this.checkThreshold(s))&&(this.clickedAvailable=!1)}e&&this.viewport.options.stopPropagation&&t.stopPropagation()}up(t){if(this.viewport.pause||!this.viewport.worldVisible)return;t.pointerType==="mouse"&&(this.isMouseDown=!1),t.pointerType!=="mouse"&&this.remove(t.pointerId);const e=this.viewport.plugins.up(t);this.clickedAvailable&&this.count()===0&&this.last&&(this.viewport.emit("clicked",{event:t,screen:this.last,world:this.viewport.toWorld(this.last),viewport:this.viewport}),this.clickedAvailable=!1),e&&this.viewport.options.stopPropagation&&t.stopPropagation()}getPointerPosition(t){const e=new lt;return this.viewport.options.events.mapPositionToPoint(e,t.clientX,t.clientY),e}handleWheel(t){if(this.viewport.pause||!this.viewport.worldVisible)return;const e=this.viewport.toLocal(this.getPointerPosition(t));this.viewport.left<=e.x&&e.x<=this.viewport.right&&this.viewport.top<=e.y&&e.y<=this.viewport.bottom&&this.viewport.plugins.wheel(t)&&!this.viewport.options.passiveWheel&&t.preventDefault()}pause(){this.touches=[],this.isMouseDown=!1}get(t){for(const e of this.touches)if(e.id===t)return e;return null}remove(t){for(let e=0;e<this.touches.length;e++)if(this.touches[e].id===t){this.touches.splice(e,1);return}}count(){return(this.isMouseDown?1:0)+this.touches.length}}const mo=["drag","pinch","wheel","follow","mouse-edges","decelerate","animate","bounce","snap-zoom","clamp-zoom","snap","clamp"];class kC{constructor(t){B(this,"plugins"),B(this,"list"),B(this,"viewport"),this.viewport=t,this.list=[],this.plugins={}}add(t,e,i=mo.length){const s=this.plugins[t];s&&s.destroy(),this.plugins[t]=e;const n=mo.indexOf(t);n!==-1&&mo.splice(n,1),mo.splice(i,0,t),this.sort()}get(t,e){var i;return e&&(i=this.plugins[t])!=null&&i.paused?null:this.plugins[t]}update(t){for(const e of this.list)e.update(t)}resize(){for(const t of this.list)t.resize()}reset(){for(const t of this.list)t.reset()}removeAll(){this.list.forEach(t=>{t.destroy()}),this.plugins={},this.sort()}remove(t){var e;this.plugins[t]&&((e=this.plugins[t])==null||e.destroy(),delete this.plugins[t],this.viewport.emit("plugin-remove",t),this.sort())}pause(t){var e;(e=this.plugins[t])==null||e.pause()}resume(t){var e;(e=this.plugins[t])==null||e.resume()}sort(){this.list=[];for(const t of mo)this.plugins[t]&&this.list.push(this.plugins[t])}down(t){let e=!1;for(const i of this.list)i.down(t)&&(e=!0);return e}move(t){let e=!1;for(const i of this.viewport.plugins.list)i.move(t)&&(e=!0);return e}up(t){let e=!1;for(const i of this.list)i.up(t)&&(e=!0);return e}wheel(t){let e=!1;for(const i of this.list)i.wheel(t)&&(e=!0);return e}}const OC={screenWidth:window.innerWidth,screenHeight:window.innerHeight,worldWidth:null,worldHeight:null,threshold:5,passiveWheel:!0,stopPropagation:!1,forceHitArea:null,noTicker:!1,disableOnContextMenu:!1,ticker:be.shared,allowPreserveDragOutside:!1};class BC extends Xt{constructor(t){super(),B(this,"moving"),B(this,"screenWidth"),B(this,"screenHeight"),B(this,"threshold"),B(this,"input"),B(this,"plugins"),B(this,"zooming"),B(this,"lastViewport"),B(this,"options"),B(this,"_dirty"),B(this,"_forceHitArea"),B(this,"_hitAreaDefault"),B(this,"_pause"),B(this,"tickerFunction"),B(this,"_worldWidth"),B(this,"_worldHeight"),B(this,"_disableOnContextMenu",e=>e.preventDefault()),this.options={...OC,...t},this.screenWidth=this.options.screenWidth,this.screenHeight=this.options.screenHeight,this._worldWidth=this.options.worldWidth,this._worldHeight=this.options.worldHeight,this.forceHitArea=this.options.forceHitArea,this.threshold=this.options.threshold,this.options.disableOnContextMenu&&this.options.events.domElement.addEventListener("contextmenu",this._disableOnContextMenu),this.options.noTicker||(this.tickerFunction=()=>this.update(this.options.ticker.elapsedMS),this.options.ticker.add(this.tickerFunction)),this.input=new DC(this),this.plugins=new kC(this)}destroy(t){!this.options.noTicker&&this.tickerFunction&&this.options.ticker.remove(this.tickerFunction),this.options.disableOnContextMenu&&this.options.events.domElement.removeEventListener("contextmenu",this._disableOnContextMenu),this.input.destroy(),super.destroy(t)}update(t){this.pause||(this.plugins.update(t),this.lastViewport&&(this.lastViewport.x!==this.x||this.lastViewport.y!==this.y?this.moving=!0:this.moving&&(this.emit("moved-end",this),this.moving=!1),this.lastViewport.scaleX!==this.scale.x||this.lastViewport.scaleY!==this.scale.y?this.zooming=!0:this.zooming&&(this.emit("zoomed-end",this),this.zooming=!1)),this.forceHitArea||(this._hitAreaDefault=new ct(this.left,this.top,this.worldScreenWidth,this.worldScreenHeight),this.hitArea=this._hitAreaDefault),this._dirty=this._dirty||!this.lastViewport||this.lastViewport.x!==this.x||this.lastViewport.y!==this.y||this.lastViewport.scaleX!==this.scale.x||this.lastViewport.scaleY!==this.scale.y,this.lastViewport={x:this.x,y:this.y,scaleX:this.scale.x,scaleY:this.scale.y},this.emit("frame-end",this))}resize(t=window.innerWidth,e=window.innerHeight,i,s){this.screenWidth=t,this.screenHeight=e,typeof i<"u"&&(this._worldWidth=i),typeof s<"u"&&(this._worldHeight=s),this.plugins.resize(),this.dirty=!0}get worldWidth(){return this._worldWidth?this._worldWidth:this.width/this.scale.x}set worldWidth(t){this._worldWidth=t,this.plugins.resize()}get worldHeight(){return this._worldHeight?this._worldHeight:this.height/this.scale.y}set worldHeight(t){this._worldHeight=t,this.plugins.resize()}getVisibleBounds(){return new ct(this.left,this.top,this.worldScreenWidth,this.worldScreenHeight)}toWorld(t,e){return arguments.length===2?this.toLocal(new lt(t,e)):this.toLocal(t)}toScreen(t,e){return arguments.length===2?this.toGlobal(new lt(t,e)):this.toGlobal(t)}get worldScreenWidth(){return this.screenWidth/this.scale.x}get worldScreenHeight(){return this.screenHeight/this.scale.y}get screenWorldWidth(){return this.worldWidth*this.scale.x}get screenWorldHeight(){return this.worldHeight*this.scale.y}get center(){return new lt(this.worldScreenWidth/2-this.x/this.scale.x,this.worldScreenHeight/2-this.y/this.scale.y)}set center(t){this.moveCenter(t)}moveCenter(...t){let e,i;typeof t[0]=="number"?(e=t[0],i=t[1]):(e=t[0].x,i=t[0].y);const s=(this.worldScreenWidth/2-e)*this.scale.x,n=(this.worldScreenHeight/2-i)*this.scale.y;return(this.x!==s||this.y!==n)&&(this.position.set(s,n),this.plugins.reset(),this.dirty=!0),this}get corner(){return new lt(-this.x/this.scale.x,-this.y/this.scale.y)}set corner(t){this.moveCorner(t)}moveCorner(...t){let e,i;return t.length===1?(e=-t[0].x*this.scale.x,i=-t[0].y*this.scale.y):(e=-t[0]*this.scale.x,i=-t[1]*this.scale.y),(e!==this.x||i!==this.y)&&(this.position.set(e,i),this.plugins.reset(),this.dirty=!0),this}get screenWidthInWorldPixels(){return this.screenWidth/this.scale.x}get screenHeightInWorldPixels(){return this.screenHeight/this.scale.y}findFitWidth(t){return this.screenWidth/t}findFitHeight(t){return this.screenHeight/t}findFit(t,e){const i=this.screenWidth/t,s=this.screenHeight/e;return Math.min(i,s)}findCover(t,e){const i=this.screenWidth/t,s=this.screenHeight/e;return Math.max(i,s)}fitWidth(t=this.worldWidth,e,i=!0,s){let n;e&&(n=this.center),this.scale.x=this.screenWidth/t,i&&(this.scale.y=this.scale.x);const o=this.plugins.get("clamp-zoom",!0);return!s&&o&&o.clamp(),e&&n&&this.moveCenter(n),this}fitHeight(t=this.worldHeight,e,i=!0,s){let n;e&&(n=this.center),this.scale.y=this.screenHeight/t,i&&(this.scale.x=this.scale.y);const o=this.plugins.get("clamp-zoom",!0);return!s&&o&&o.clamp(),e&&n&&this.moveCenter(n),this}fitWorld(t){let e;t&&(e=this.center),this.scale.x=this.screenWidth/this.worldWidth,this.scale.y=this.screenHeight/this.worldHeight,this.scale.x<this.scale.y?this.scale.y=this.scale.x:this.scale.x=this.scale.y;const i=this.plugins.get("clamp-zoom",!0);return i&&i.clamp(),t&&e&&this.moveCenter(e),this}fit(t,e=this.worldWidth,i=this.worldHeight){let s;t&&(s=this.center),this.scale.x=this.screenWidth/e,this.scale.y=this.screenHeight/i,this.scale.x<this.scale.y?this.scale.y=this.scale.x:this.scale.x=this.scale.y;const n=this.plugins.get("clamp-zoom",!0);return n&&n.clamp(),t&&s&&this.moveCenter(s),this}setZoom(t,e){let i;e&&(i=this.center),this.scale.set(t);const s=this.plugins.get("clamp-zoom",!0);return s&&s.clamp(),e&&i&&this.moveCenter(i),this}zoomPercent(t,e){return this.setZoom(this.scale.x+this.scale.x*t,e)}zoom(t,e){return this.fitWidth(t+this.worldScreenWidth,e),this}get scaled(){return this.scale.x}set scaled(t){this.setZoom(t,!0)}snapZoom(t){return this.plugins.add("snap-zoom",new GC(this,t)),this}OOB(){return{left:this.left<0,right:this.right>this.worldWidth,top:this.top<0,bottom:this.bottom>this.worldHeight,cornerPoint:new lt(this.worldWidth*this.scale.x-this.screenWidth,this.worldHeight*this.scale.y-this.screenHeight)}}get right(){return-this.x/this.scale.x+this.worldScreenWidth}set right(t){this.x=-t*this.scale.x+this.screenWidth,this.plugins.reset()}get left(){return-this.x/this.scale.x}set left(t){this.x=-t*this.scale.x,this.plugins.reset()}get top(){return-this.y/this.scale.y}set top(t){this.y=-t*this.scale.y,this.plugins.reset()}get bottom(){return-this.y/this.scale.y+this.worldScreenHeight}set bottom(t){this.y=-t*this.scale.y+this.screenHeight,this.plugins.reset()}get dirty(){return!!this._dirty}set dirty(t){this._dirty=t}get forceHitArea(){return this._forceHitArea}set forceHitArea(t){t?(this._forceHitArea=t,this.hitArea=t):(this._forceHitArea=null,this.hitArea=new ct(0,0,this.worldWidth,this.worldHeight))}drag(t){return this.plugins.add("drag",new wC(this,t)),this}clamp(t){return this.plugins.add("clamp",new yC(this,t)),this}decelerate(t){return this.plugins.add("decelerate",new vC(this,t)),this}bounce(t){return this.plugins.add("bounce",new mC(this,t)),this}pinch(t){return this.plugins.add("pinch",new MC(this,t)),this}snap(t,e,i){return this.plugins.add("snap",new PC(this,t,e,i)),this}follow(t,e){return this.plugins.add("follow",new EC(this,t,e)),this}wheel(t){return this.plugins.add("wheel",new FC(this,t)),this}animate(t){return this.plugins.add("animate",new pC(this,t)),this}clampZoom(t){return this.plugins.add("clamp-zoom",new xC(this,t)),this}mouseEdges(t){return this.plugins.add("mouse-edges",new IC(this,t)),this}get pause(){return!!this._pause}set pause(t){this._pause=t,this.lastViewport=null,this.moving=!1,this.zooming=!1,t&&this.input.pause()}ensureVisible(t,e,i,s,n){n&&(i>this.worldScreenWidth||s>this.worldScreenHeight)&&(this.fit(!0,i,s),this.emit("zoomed",{viewport:this,type:"ensureVisible"}));let o=!1;t<this.left?(this.left=t,o=!0):t+i>this.right&&(this.right=t+i,o=!0),e<this.top?(this.top=e,o=!0):e+s>this.bottom&&(this.bottom=e+s,o=!0),o&&this.emit("moved",{viewport:this,type:"ensureVisible"})}}function gh(r,t){return r==null||t==null?NaN:r<t?-1:r>t?1:r>=t?0:NaN}function WC(r,t){return r==null||t==null?NaN:t<r?-1:t>r?1:t>=r?0:NaN}function Zc(r){let t,e,i;r.length!==2?(t=gh,e=(a,h)=>gh(r(a),h),i=(a,h)=>r(a)-h):(t=r===gh||r===WC?r:UC,e=r,i=r);function s(a,h,l=0,u=a.length){if(l<u){if(t(h,h)!==0)return u;do{const c=l+u>>>1;e(a[c],h)<0?l=c+1:u=c}while(l<u)}return l}function n(a,h,l=0,u=a.length){if(l<u){if(t(h,h)!==0)return u;do{const c=l+u>>>1;e(a[c],h)<=0?l=c+1:u=c}while(l<u)}return l}function o(a,h,l=0,u=a.length){const c=s(a,h,l,u-1);return c>l&&i(a[c-1],h)>-i(a[c],h)?c-1:c}return{left:s,center:o,right:n}}function UC(){return 0}function XC(r){return r===null?NaN:+r}const ZC=Zc(gh).right;Zc(XC).center;const VC=ZC,HC=Math.sqrt(50),KC=Math.sqrt(10),YC=Math.sqrt(2);function yh(r,t,e){const i=(t-r)/Math.max(0,e),s=Math.floor(Math.log10(i)),n=i/Math.pow(10,s),o=n>=HC?10:n>=KC?5:n>=YC?2:1;let a,h,l;return s<0?(l=Math.pow(10,-s)/o,a=Math.round(r*l),h=Math.round(t*l),a/l<r&&++a,h/l>t&&--h,l=-l):(l=Math.pow(10,s)*o,a=Math.round(r/l),h=Math.round(t/l),a*l<r&&++a,h*l>t&&--h),h<a&&.5<=e&&e<2?yh(r,t,e*2):[a,h,l]}function zC(r,t,e){if(t=+t,r=+r,e=+e,!(e>0))return[];if(r===t)return[r];const i=t<r,[s,n,o]=i?yh(t,r,e):yh(r,t,e);if(!(n>=s))return[];const a=n-s+1,h=new Array(a);if(i)if(o<0)for(let l=0;l<a;++l)h[l]=(n-l)/-o;else for(let l=0;l<a;++l)h[l]=(n-l)*o;else if(o<0)for(let l=0;l<a;++l)h[l]=(s+l)/-o;else for(let l=0;l<a;++l)h[l]=(s+l)*o;return h}function Vc(r,t,e){return t=+t,r=+r,e=+e,yh(r,t,e)[2]}function Hc(r,t,e){t=+t,r=+r,e=+e;const i=t<r,s=i?Vc(t,r,e):Vc(r,t,e);return(i?-1:1)*(s<0?1/-s:s)}function Kc(r,t,e){r.prototype=t.prototype=e,e.constructor=r}function ry(r,t){var e=Object.create(r.prototype);for(var i in t)e[i]=t[i];return e}function go(){}var yo=.7,bh=1/yo,hn="\\s*([+-]?\\d+)\\s*",bo="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",Li="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",jC=/^#([0-9a-f]{3,8})$/,JC=new RegExp(`^rgb\\(${hn},${hn},${hn}\\)$`),$C=new RegExp(`^rgb\\(${Li},${Li},${Li}\\)$`),QC=new RegExp(`^rgba\\(${hn},${hn},${hn},${bo}\\)$`),qC=new RegExp(`^rgba\\(${Li},${Li},${Li},${bo}\\)$`),tI=new RegExp(`^hsl\\(${bo},${Li},${Li}\\)$`),eI=new RegExp(`^hsla\\(${bo},${Li},${Li},${bo}\\)$`),sy={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};Kc(go,xo,{copy(r){return Object.assign(new this.constructor,this,r)},displayable(){return this.rgb().displayable()},hex:ny,formatHex:ny,formatHex8:iI,formatHsl:rI,formatRgb:oy,toString:oy});function ny(){return this.rgb().formatHex()}function iI(){return this.rgb().formatHex8()}function rI(){return cy(this).formatHsl()}function oy(){return this.rgb().formatRgb()}function xo(r){var t,e;return r=(r+"").trim().toLowerCase(),(t=jC.exec(r))?(e=t[1].length,t=parseInt(t[1],16),e===6?ay(t):e===3?new Ee(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):e===8?xh(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):e===4?xh(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=JC.exec(r))?new Ee(t[1],t[2],t[3],1):(t=$C.exec(r))?new Ee(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=QC.exec(r))?xh(t[1],t[2],t[3],t[4]):(t=qC.exec(r))?xh(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=tI.exec(r))?uy(t[1],t[2]/100,t[3]/100,1):(t=eI.exec(r))?uy(t[1],t[2]/100,t[3]/100,t[4]):sy.hasOwnProperty(r)?ay(sy[r]):r==="transparent"?new Ee(NaN,NaN,NaN,0):null}function ay(r){return new Ee(r>>16&255,r>>8&255,r&255,1)}function xh(r,t,e,i){return i<=0&&(r=t=e=NaN),new Ee(r,t,e,i)}function sI(r){return r instanceof go||(r=xo(r)),r?(r=r.rgb(),new Ee(r.r,r.g,r.b,r.opacity)):new Ee}function Yc(r,t,e,i){return arguments.length===1?sI(r):new Ee(r,t,e,i??1)}function Ee(r,t,e,i){this.r=+r,this.g=+t,this.b=+e,this.opacity=+i}Kc(Ee,Yc,ry(go,{brighter(r){return r=r==null?bh:Math.pow(bh,r),new Ee(this.r*r,this.g*r,this.b*r,this.opacity)},darker(r){return r=r==null?yo:Math.pow(yo,r),new Ee(this.r*r,this.g*r,this.b*r,this.opacity)},rgb(){return this},clamp(){return new Ee(ys(this.r),ys(this.g),ys(this.b),_h(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:hy,formatHex:hy,formatHex8:nI,formatRgb:ly,toString:ly}));function hy(){return`#${bs(this.r)}${bs(this.g)}${bs(this.b)}`}function nI(){return`#${bs(this.r)}${bs(this.g)}${bs(this.b)}${bs((isNaN(this.opacity)?1:this.opacity)*255)}`}function ly(){const r=_h(this.opacity);return`${r===1?"rgb(":"rgba("}${ys(this.r)}, ${ys(this.g)}, ${ys(this.b)}${r===1?")":`, ${r})`}`}function _h(r){return isNaN(r)?1:Math.max(0,Math.min(1,r))}function ys(r){return Math.max(0,Math.min(255,Math.round(r)||0))}function bs(r){return r=ys(r),(r<16?"0":"")+r.toString(16)}function uy(r,t,e,i){return i<=0?r=t=e=NaN:e<=0||e>=1?r=t=NaN:t<=0&&(r=NaN),new ui(r,t,e,i)}function cy(r){if(r instanceof ui)return new ui(r.h,r.s,r.l,r.opacity);if(r instanceof go||(r=xo(r)),!r)return new ui;if(r instanceof ui)return r;r=r.rgb();var t=r.r/255,e=r.g/255,i=r.b/255,s=Math.min(t,e,i),n=Math.max(t,e,i),o=NaN,a=n-s,h=(n+s)/2;return a?(t===n?o=(e-i)/a+(e<i)*6:e===n?o=(i-t)/a+2:o=(t-e)/a+4,a/=h<.5?n+s:2-n-s,o*=60):a=h>0&&h<1?0:o,new ui(o,a,h,r.opacity)}function oI(r,t,e,i){return arguments.length===1?cy(r):new ui(r,t,e,i??1)}function ui(r,t,e,i){this.h=+r,this.s=+t,this.l=+e,this.opacity=+i}Kc(ui,oI,ry(go,{brighter(r){return r=r==null?bh:Math.pow(bh,r),new ui(this.h,this.s,this.l*r,this.opacity)},darker(r){return r=r==null?yo:Math.pow(yo,r),new ui(this.h,this.s,this.l*r,this.opacity)},rgb(){var r=this.h%360+(this.h<0)*360,t=isNaN(r)||isNaN(this.s)?0:this.s,e=this.l,i=e+(e<.5?e:1-e)*t,s=2*e-i;return new Ee(zc(r>=240?r-240:r+120,s,i),zc(r,s,i),zc(r<120?r+240:r-120,s,i),this.opacity)},clamp(){return new ui(dy(this.h),vh(this.s),vh(this.l),_h(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const r=_h(this.opacity);return`${r===1?"hsl(":"hsla("}${dy(this.h)}, ${vh(this.s)*100}%, ${vh(this.l)*100}%${r===1?")":`, ${r})`}`}}));function dy(r){return r=(r||0)%360,r<0?r+360:r}function vh(r){return Math.max(0,Math.min(1,r||0))}function zc(r,t,e){return(r<60?t+(e-t)*r/60:r<180?e:r<240?t+(e-t)*(240-r)/60:t)*255}const jc=r=>()=>r;function aI(r,t){return function(e){return r+e*t}}function hI(r,t,e){return r=Math.pow(r,e),t=Math.pow(t,e)-r,e=1/e,function(i){return Math.pow(r+i*t,e)}}function lI(r){return(r=+r)==1?py:function(t,e){return e-t?hI(t,e,r):jc(isNaN(t)?e:t)}}function py(r,t){var e=t-r;return e?aI(r,e):jc(isNaN(r)?t:r)}const fy=function r(t){var e=lI(t);function i(s,n){var o=e((s=Yc(s)).r,(n=Yc(n)).r),a=e(s.g,n.g),h=e(s.b,n.b),l=py(s.opacity,n.opacity);return function(u){return s.r=o(u),s.g=a(u),s.b=h(u),s.opacity=l(u),s+""}}return i.gamma=r,i}(1);function uI(r,t){t||(t=[]);var e=r?Math.min(t.length,r.length):0,i=t.slice(),s;return function(n){for(s=0;s<e;++s)i[s]=r[s]*(1-n)+t[s]*n;return i}}function cI(r){return ArrayBuffer.isView(r)&&!(r instanceof DataView)}function dI(r,t){var e=t?t.length:0,i=r?Math.min(e,r.length):0,s=new Array(i),n=new Array(e),o;for(o=0;o<i;++o)s[o]=Qc(r[o],t[o]);for(;o<e;++o)n[o]=t[o];return function(a){for(o=0;o<i;++o)n[o]=s[o](a);return n}}function pI(r,t){var e=new Date;return r=+r,t=+t,function(i){return e.setTime(r*(1-i)+t*i),e}}function Th(r,t){return r=+r,t=+t,function(e){return r*(1-e)+t*e}}function fI(r,t){var e={},i={},s;(r===null||typeof r!="object")&&(r={}),(t===null||typeof t!="object")&&(t={});for(s in t)s in r?e[s]=Qc(r[s],t[s]):i[s]=t[s];return function(n){for(s in e)i[s]=e[s](n);return i}}var Jc=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,$c=new RegExp(Jc.source,"g");function mI(r){return function(){return r}}function gI(r){return function(t){return r(t)+""}}function yI(r,t){var e=Jc.lastIndex=$c.lastIndex=0,i,s,n,o=-1,a=[],h=[];for(r=r+"",t=t+"";(i=Jc.exec(r))&&(s=$c.exec(t));)(n=s.index)>e&&(n=t.slice(e,n),a[o]?a[o]+=n:a[++o]=n),(i=i[0])===(s=s[0])?a[o]?a[o]+=s:a[++o]=s:(a[++o]=null,h.push({i:o,x:Th(i,s)})),e=$c.lastIndex;return e<t.length&&(n=t.slice(e),a[o]?a[o]+=n:a[++o]=n),a.length<2?h[0]?gI(h[0].x):mI(t):(t=h.length,function(l){for(var u=0,c;u<t;++u)a[(c=h[u]).i]=c.x(l);return a.join("")})}function Qc(r,t){var e=typeof t,i;return t==null||e==="boolean"?jc(t):(e==="number"?Th:e==="string"?(i=xo(t))?(t=i,fy):yI:t instanceof xo?fy:t instanceof Date?pI:cI(t)?uI:Array.isArray(t)?dI:typeof t.valueOf!="function"&&typeof t.toString!="function"||isNaN(t)?fI:Th)(r,t)}function bI(r,t){return r=+r,t=+t,function(e){return Math.round(r*(1-e)+t*e)}}function xI(r){return Math.abs(r=Math.round(r))>=1e21?r.toLocaleString("en").replace(/,/g,""):r.toString(10)}function wh(r,t){if((e=(r=t?r.toExponential(t-1):r.toExponential()).indexOf("e"))<0)return null;var e,i=r.slice(0,e);return[i.length>1?i[0]+i.slice(2):i,+r.slice(e+1)]}function ln(r){return r=wh(Math.abs(r)),r?r[1]:NaN}function _I(r,t){return function(e,i){for(var s=e.length,n=[],o=0,a=r[0],h=0;s>0&&a>0&&(h+a+1>i&&(a=Math.max(1,i-h)),n.push(e.substring(s-=a,s+a)),!((h+=a+1)>i));)a=r[o=(o+1)%r.length];return n.reverse().join(t)}}function vI(r){return function(t){return t.replace(/[0-9]/g,function(e){return r[+e]})}}var TI=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function Sh(r){if(!(t=TI.exec(r)))throw new Error("invalid format: "+r);var t;return new qc({fill:t[1],align:t[2],sign:t[3],symbol:t[4],zero:t[5],width:t[6],comma:t[7],precision:t[8]&&t[8].slice(1),trim:t[9],type:t[10]})}Sh.prototype=qc.prototype;function qc(r){this.fill=r.fill===void 0?" ":r.fill+"",this.align=r.align===void 0?">":r.align+"",this.sign=r.sign===void 0?"-":r.sign+"",this.symbol=r.symbol===void 0?"":r.symbol+"",this.zero=!!r.zero,this.width=r.width===void 0?void 0:+r.width,this.comma=!!r.comma,this.precision=r.precision===void 0?void 0:+r.precision,this.trim=!!r.trim,this.type=r.type===void 0?"":r.type+""}qc.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(this.width===void 0?"":Math.max(1,this.width|0))+(this.comma?",":"")+(this.precision===void 0?"":"."+Math.max(0,this.precision|0))+(this.trim?"~":"")+this.type};function wI(r){t:for(var t=r.length,e=1,i=-1,s;e<t;++e)switch(r[e]){case".":i=s=e;break;case"0":i===0&&(i=e),s=e;break;default:if(!+r[e])break t;i>0&&(i=0);break}return i>0?r.slice(0,i)+r.slice(s+1):r}var my;function SI(r,t){var e=wh(r,t);if(!e)return r+"";var i=e[0],s=e[1],n=s-(my=Math.max(-8,Math.min(8,Math.floor(s/3)))*3)+1,o=i.length;return n===o?i:n>o?i+new Array(n-o+1).join("0"):n>0?i.slice(0,n)+"."+i.slice(n):"0."+new Array(1-n).join("0")+wh(r,Math.max(0,t+n-1))[0]}function gy(r,t){var e=wh(r,t);if(!e)return r+"";var i=e[0],s=e[1];return s<0?"0."+new Array(-s).join("0")+i:i.length>s+1?i.slice(0,s+1)+"."+i.slice(s+1):i+new Array(s-i.length+2).join("0")}const yy={"%":(r,t)=>(r*100).toFixed(t),b:r=>Math.round(r).toString(2),c:r=>r+"",d:xI,e:(r,t)=>r.toExponential(t),f:(r,t)=>r.toFixed(t),g:(r,t)=>r.toPrecision(t),o:r=>Math.round(r).toString(8),p:(r,t)=>gy(r*100,t),r:gy,s:SI,X:r=>Math.round(r).toString(16).toUpperCase(),x:r=>Math.round(r).toString(16)};function by(r){return r}var xy=Array.prototype.map,_y=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function EI(r){var t=r.grouping===void 0||r.thousands===void 0?by:_I(xy.call(r.grouping,Number),r.thousands+""),e=r.currency===void 0?"":r.currency[0]+"",i=r.currency===void 0?"":r.currency[1]+"",s=r.decimal===void 0?".":r.decimal+"",n=r.numerals===void 0?by:vI(xy.call(r.numerals,String)),o=r.percent===void 0?"%":r.percent+"",a=r.minus===void 0?"−":r.minus+"",h=r.nan===void 0?"NaN":r.nan+"";function l(c){c=Sh(c);var d=c.fill,p=c.align,m=c.sign,f=c.symbol,g=c.zero,y=c.width,_=c.comma,b=c.precision,v=c.trim,S=c.type;S==="n"?(_=!0,S="g"):yy[S]||(b===void 0&&(b=12),v=!0,S="g"),(g||d==="0"&&p==="=")&&(g=!0,d="0",p="=");var E=f==="$"?e:f==="#"&&/[boxX]/.test(S)?"0"+S.toLowerCase():"",A=f==="$"?i:/[%p]/.test(S)?o:"",I=yy[S],P=/[defgprs%]/.test(S);b=b===void 0?6:/[gprs]/.test(S)?Math.max(1,Math.min(21,b)):Math.max(0,Math.min(20,b));function W(G){var N=E,C=A,F,X,V;if(S==="c")C=I(G)+C,G="";else{G=+G;var L=G<0||1/G<0;if(G=isNaN(G)?h:I(Math.abs(G),b),v&&(G=wI(G)),L&&+G==0&&m!=="+"&&(L=!1),N=(L?m==="("?m:a:m==="-"||m==="("?"":m)+N,C=(S==="s"?_y[8+my/3]:"")+C+(L&&m==="("?")":""),P){for(F=-1,X=G.length;++F<X;)if(V=G.charCodeAt(F),48>V||V>57){C=(V===46?s+G.slice(F+1):G.slice(F))+C,G=G.slice(0,F);break}}}_&&!g&&(G=t(G,1/0));var k=N.length+G.length+C.length,H=k<y?new Array(y-k+1).join(d):"";switch(_&&g&&(G=t(H+G,H.length?y-C.length:1/0),H=""),p){case"<":G=N+G+C+H;break;case"=":G=N+H+G+C;break;case"^":G=H.slice(0,k=H.length>>1)+N+G+C+H.slice(k);break;default:G=H+N+G+C;break}return n(G)}return W.toString=function(){return c+""},W}function u(c,d){var p=l((c=Sh(c),c.type="f",c)),m=Math.max(-8,Math.min(8,Math.floor(ln(d)/3)))*3,f=Math.pow(10,-m),g=_y[8+m/3];return function(y){return p(f*y)+g}}return{format:l,formatPrefix:u}}var Eh,vy,Ty;CI({thousands:",",grouping:[3],currency:["$",""]});function CI(r){return Eh=EI(r),vy=Eh.format,Ty=Eh.formatPrefix,Eh}function II(r){return Math.max(0,-ln(Math.abs(r)))}function AI(r,t){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(ln(t)/3)))*3-ln(Math.abs(r)))}function MI(r,t){return r=Math.abs(r),t=Math.abs(t)-r,Math.max(0,ln(t)-ln(r))+1}function wy(r,t){switch(arguments.length){case 0:break;case 1:this.range(r);break;default:this.range(t).domain(r);break}return this}function RI(r){return function(){return r}}function PI(r){return+r}var Sy=[0,1];function un(r){return r}function td(r,t){return(t-=r=+r)?function(e){return(e-r)/t}:RI(isNaN(t)?NaN:.5)}function LI(r,t){var e;return r>t&&(e=r,r=t,t=e),function(i){return Math.max(r,Math.min(t,i))}}function GI(r,t,e){var i=r[0],s=r[1],n=t[0],o=t[1];return s<i?(i=td(s,i),n=e(o,n)):(i=td(i,s),n=e(n,o)),function(a){return n(i(a))}}function NI(r,t,e){var i=Math.min(r.length,t.length)-1,s=new Array(i),n=new Array(i),o=-1;for(r[i]<r[0]&&(r=r.slice().reverse(),t=t.slice().reverse());++o<i;)s[o]=td(r[o],r[o+1]),n[o]=e(t[o],t[o+1]);return function(a){var h=VC(r,a,1,i)-1;return n[h](s[h](a))}}function Ey(r,t){return t.domain(r.domain()).range(r.range()).interpolate(r.interpolate()).clamp(r.clamp()).unknown(r.unknown())}function FI(){var r=Sy,t=Sy,e=Qc,i,s,n,o=un,a,h,l;function u(){var d=Math.min(r.length,t.length);return o!==un&&(o=LI(r[0],r[d-1])),a=d>2?NI:GI,h=l=null,c}function c(d){return d==null||isNaN(d=+d)?n:(h||(h=a(r.map(i),t,e)))(i(o(d)))}return c.invert=function(d){return o(s((l||(l=a(t,r.map(i),Th)))(d)))},c.domain=function(d){return arguments.length?(r=Array.from(d,PI),u()):r.slice()},c.range=function(d){return arguments.length?(t=Array.from(d),u()):t.slice()},c.rangeRound=function(d){return t=Array.from(d),e=bI,u()},c.clamp=function(d){return arguments.length?(o=d?!0:un,u()):o!==un},c.interpolate=function(d){return arguments.length?(e=d,u()):e},c.unknown=function(d){return arguments.length?(n=d,c):n},function(d,p){return i=d,s=p,u()}}function Cy(){return FI()(un,un)}function DI(r,t,e,i){var s=Hc(r,t,e),n;switch(i=Sh(i??",f"),i.type){case"s":{var o=Math.max(Math.abs(r),Math.abs(t));return i.precision==null&&!isNaN(n=AI(s,o))&&(i.precision=n),Ty(i,o)}case"":case"e":case"g":case"p":case"r":{i.precision==null&&!isNaN(n=MI(s,Math.max(Math.abs(r),Math.abs(t))))&&(i.precision=n-(i.type==="e"));break}case"f":case"%":{i.precision==null&&!isNaN(n=II(s))&&(i.precision=n-(i.type==="%")*2);break}}return vy(i)}function kI(r){var t=r.domain;return r.ticks=function(e){var i=t();return zC(i[0],i[i.length-1],e??10)},r.tickFormat=function(e,i){var s=t();return DI(s[0],s[s.length-1],e??10,i)},r.nice=function(e){e==null&&(e=10);var i=t(),s=0,n=i.length-1,o=i[s],a=i[n],h,l,u=10;for(a<o&&(l=o,o=a,a=l,l=s,s=n,n=l);u-- >0;){if(l=Vc(o,a,e),l===h)return i[s]=o,i[n]=a,t(i);if(l>0)o=Math.floor(o/l)*l,a=Math.ceil(a/l)*l;else if(l<0)o=Math.ceil(o*l)/l,a=Math.floor(a*l)/l;else break;h=l}return r},r}function Iy(){var r=Cy();return r.copy=function(){return Ey(r,Iy())},wy.apply(r,arguments),kI(r)}function OI(r,t){r=r.slice();var e=0,i=r.length-1,s=r[e],n=r[i],o;return n<s&&(o=e,e=i,i=o,o=s,s=n,n=o),r[e]=t.floor(s),r[i]=t.ceil(n),r}const ed=new Date,id=new Date;function $t(r,t,e,i){function s(n){return r(n=arguments.length===0?new Date:new Date(+n)),n}return s.floor=n=>(r(n=new Date(+n)),n),s.ceil=n=>(r(n=new Date(n-1)),t(n,1),r(n),n),s.round=n=>{const o=s(n),a=s.ceil(n);return n-o<a-n?o:a},s.offset=(n,o)=>(t(n=new Date(+n),o==null?1:Math.floor(o)),n),s.range=(n,o,a)=>{const h=[];if(n=s.ceil(n),a=a==null?1:Math.floor(a),!(n<o)||!(a>0))return h;let l;do h.push(l=new Date(+n)),t(n,a),r(n);while(l<n&&n<o);return h},s.filter=n=>$t(o=>{if(o>=o)for(;r(o),!n(o);)o.setTime(o-1)},(o,a)=>{if(o>=o)if(a<0)for(;++a<=0;)for(;t(o,-1),!n(o););else for(;--a>=0;)for(;t(o,1),!n(o););}),e&&(s.count=(n,o)=>(ed.setTime(+n),id.setTime(+o),r(ed),r(id),Math.floor(e(ed,id))),s.every=n=>(n=Math.floor(n),!isFinite(n)||!(n>0)?null:n>1?s.filter(i?o=>i(o)%n===0:o=>s.count(0,o)%n===0):s)),s}const Ch=$t(()=>{},(r,t)=>{r.setTime(+r+t)},(r,t)=>t-r);Ch.every=r=>(r=Math.floor(r),!isFinite(r)||!(r>0)?null:r>1?$t(t=>{t.setTime(Math.floor(t/r)*r)},(t,e)=>{t.setTime(+t+e*r)},(t,e)=>(e-t)/r):Ch),Ch.range;const or=1e3,$e=or*60,ar=$e*60,hr=ar*24,rd=hr*7,Ay=hr*30,sd=hr*365,cn=$t(r=>{r.setTime(r-r.getMilliseconds())},(r,t)=>{r.setTime(+r+t*or)},(r,t)=>(t-r)/or,r=>r.getUTCSeconds());cn.range;const nd=$t(r=>{r.setTime(r-r.getMilliseconds()-r.getSeconds()*or)},(r,t)=>{r.setTime(+r+t*$e)},(r,t)=>(t-r)/$e,r=>r.getMinutes());nd.range,$t(r=>{r.setUTCSeconds(0,0)},(r,t)=>{r.setTime(+r+t*$e)},(r,t)=>(t-r)/$e,r=>r.getUTCMinutes()).range;const od=$t(r=>{r.setTime(r-r.getMilliseconds()-r.getSeconds()*or-r.getMinutes()*$e)},(r,t)=>{r.setTime(+r+t*ar)},(r,t)=>(t-r)/ar,r=>r.getHours());od.range,$t(r=>{r.setUTCMinutes(0,0,0)},(r,t)=>{r.setTime(+r+t*ar)},(r,t)=>(t-r)/ar,r=>r.getUTCHours()).range;const _o=$t(r=>r.setHours(0,0,0,0),(r,t)=>r.setDate(r.getDate()+t),(r,t)=>(t-r-(t.getTimezoneOffset()-r.getTimezoneOffset())*$e)/hr,r=>r.getDate()-1);_o.range;const ad=$t(r=>{r.setUTCHours(0,0,0,0)},(r,t)=>{r.setUTCDate(r.getUTCDate()+t)},(r,t)=>(t-r)/hr,r=>r.getUTCDate()-1);ad.range,$t(r=>{r.setUTCHours(0,0,0,0)},(r,t)=>{r.setUTCDate(r.getUTCDate()+t)},(r,t)=>(t-r)/hr,r=>Math.floor(r/hr)).range;function xs(r){return $t(t=>{t.setDate(t.getDate()-(t.getDay()+7-r)%7),t.setHours(0,0,0,0)},(t,e)=>{t.setDate(t.getDate()+e*7)},(t,e)=>(e-t-(e.getTimezoneOffset()-t.getTimezoneOffset())*$e)/rd)}const Ih=xs(0),Ah=xs(1),BI=xs(2),WI=xs(3),dn=xs(4),UI=xs(5),XI=xs(6);Ih.range,Ah.range,BI.range,WI.range,dn.range,UI.range,XI.range;function _s(r){return $t(t=>{t.setUTCDate(t.getUTCDate()-(t.getUTCDay()+7-r)%7),t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCDate(t.getUTCDate()+e*7)},(t,e)=>(e-t)/rd)}const My=_s(0),Mh=_s(1),ZI=_s(2),VI=_s(3),pn=_s(4),HI=_s(5),KI=_s(6);My.range,Mh.range,ZI.range,VI.range,pn.range,HI.range,KI.range;const hd=$t(r=>{r.setDate(1),r.setHours(0,0,0,0)},(r,t)=>{r.setMonth(r.getMonth()+t)},(r,t)=>t.getMonth()-r.getMonth()+(t.getFullYear()-r.getFullYear())*12,r=>r.getMonth());hd.range,$t(r=>{r.setUTCDate(1),r.setUTCHours(0,0,0,0)},(r,t)=>{r.setUTCMonth(r.getUTCMonth()+t)},(r,t)=>t.getUTCMonth()-r.getUTCMonth()+(t.getUTCFullYear()-r.getUTCFullYear())*12,r=>r.getUTCMonth()).range;const lr=$t(r=>{r.setMonth(0,1),r.setHours(0,0,0,0)},(r,t)=>{r.setFullYear(r.getFullYear()+t)},(r,t)=>t.getFullYear()-r.getFullYear(),r=>r.getFullYear());lr.every=r=>!isFinite(r=Math.floor(r))||!(r>0)?null:$t(t=>{t.setFullYear(Math.floor(t.getFullYear()/r)*r),t.setMonth(0,1),t.setHours(0,0,0,0)},(t,e)=>{t.setFullYear(t.getFullYear()+e*r)}),lr.range;const vs=$t(r=>{r.setUTCMonth(0,1),r.setUTCHours(0,0,0,0)},(r,t)=>{r.setUTCFullYear(r.getUTCFullYear()+t)},(r,t)=>t.getUTCFullYear()-r.getUTCFullYear(),r=>r.getUTCFullYear());vs.every=r=>!isFinite(r=Math.floor(r))||!(r>0)?null:$t(t=>{t.setUTCFullYear(Math.floor(t.getUTCFullYear()/r)*r),t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCFullYear(t.getUTCFullYear()+e*r)}),vs.range;function YI(r,t,e,i,s,n){const o=[[cn,1,or],[cn,5,5*or],[cn,15,15*or],[cn,30,30*or],[n,1,$e],[n,5,5*$e],[n,15,15*$e],[n,30,30*$e],[s,1,ar],[s,3,3*ar],[s,6,6*ar],[s,12,12*ar],[i,1,hr],[i,2,2*hr],[e,1,rd],[t,1,Ay],[t,3,3*Ay],[r,1,sd]];function a(l,u,c){const d=u<l;d&&([l,u]=[u,l]);const p=c&&typeof c.range=="function"?c:h(l,u,c),m=p?p.range(l,+u+1):[];return d?m.reverse():m}function h(l,u,c){const d=Math.abs(u-l)/c,p=Zc(([,,g])=>g).right(o,d);if(p===o.length)return r.every(Hc(l/sd,u/sd,c));if(p===0)return Ch.every(Math.max(Hc(l,u,c),1));const[m,f]=o[d/o[p-1][2]<o[p][2]/d?p-1:p];return m.every(f)}return[a,h]}const[zI,jI]=YI(lr,hd,Ih,_o,od,nd);function ld(r){if(0<=r.y&&r.y<100){var t=new Date(-1,r.m,r.d,r.H,r.M,r.S,r.L);return t.setFullYear(r.y),t}return new Date(r.y,r.m,r.d,r.H,r.M,r.S,r.L)}function ud(r){if(0<=r.y&&r.y<100){var t=new Date(Date.UTC(-1,r.m,r.d,r.H,r.M,r.S,r.L));return t.setUTCFullYear(r.y),t}return new Date(Date.UTC(r.y,r.m,r.d,r.H,r.M,r.S,r.L))}function vo(r,t,e){return{y:r,m:t,d:e,H:0,M:0,S:0,L:0}}function JI(r){var t=r.dateTime,e=r.date,i=r.time,s=r.periods,n=r.days,o=r.shortDays,a=r.months,h=r.shortMonths,l=To(s),u=wo(s),c=To(n),d=wo(n),p=To(o),m=wo(o),f=To(a),g=wo(a),y=To(h),_=wo(h),b={a:L,A:k,b:H,B:D,c:null,d:Fy,e:Fy,f:xA,g:MA,G:PA,H:gA,I:yA,j:bA,L:Dy,m:_A,M:vA,p:U,q:j,Q:Xy,s:Zy,S:TA,u:wA,U:SA,V:EA,w:CA,W:IA,x:null,X:null,y:AA,Y:RA,Z:LA,"%":Uy},v={a:q,A:dt,b:nt,B:Et,c:null,d:Oy,e:Oy,f:DA,g:KA,G:zA,H:GA,I:NA,j:FA,L:By,m:kA,M:OA,p:Mt,q:wt,Q:Xy,s:Zy,S:BA,u:WA,U:UA,V:XA,w:ZA,W:VA,x:null,X:null,y:HA,Y:YA,Z:jA,"%":Uy},S={a:W,A:G,b:N,B:C,c:F,d:Gy,e:Gy,f:dA,g:Ly,G:Py,H:Ny,I:Ny,j:hA,L:cA,m:aA,M:lA,p:P,q:oA,Q:fA,s:mA,S:uA,u:eA,U:iA,V:rA,w:tA,W:sA,x:X,X:V,y:Ly,Y:Py,Z:nA,"%":pA};b.x=E(e,b),b.X=E(i,b),b.c=E(t,b),v.x=E(e,v),v.X=E(i,v),v.c=E(t,v);function E(z,it){return function(tt){var O=[],yt=-1,mt=0,Rt=z.length,Ut,De,ci;for(tt instanceof Date||(tt=new Date(+tt));++yt<Rt;)z.charCodeAt(yt)===37&&(O.push(z.slice(mt,yt)),(De=Ry[Ut=z.charAt(++yt)])!=null?Ut=z.charAt(++yt):De=Ut==="e"?" ":"0",(ci=it[Ut])&&(Ut=ci(tt,De)),O.push(Ut),mt=yt+1);return O.push(z.slice(mt,yt)),O.join("")}}function A(z,it){return function(tt){var O=vo(1900,void 0,1),yt=I(O,z,tt+="",0),mt,Rt;if(yt!=tt.length)return null;if("Q"in O)return new Date(O.Q);if("s"in O)return new Date(O.s*1e3+("L"in O?O.L:0));if(it&&!("Z"in O)&&(O.Z=0),"p"in O&&(O.H=O.H%12+O.p*12),O.m===void 0&&(O.m="q"in O?O.q:0),"V"in O){if(O.V<1||O.V>53)return null;"w"in O||(O.w=1),"Z"in O?(mt=ud(vo(O.y,0,1)),Rt=mt.getUTCDay(),mt=Rt>4||Rt===0?Mh.ceil(mt):Mh(mt),mt=ad.offset(mt,(O.V-1)*7),O.y=mt.getUTCFullYear(),O.m=mt.getUTCMonth(),O.d=mt.getUTCDate()+(O.w+6)%7):(mt=ld(vo(O.y,0,1)),Rt=mt.getDay(),mt=Rt>4||Rt===0?Ah.ceil(mt):Ah(mt),mt=_o.offset(mt,(O.V-1)*7),O.y=mt.getFullYear(),O.m=mt.getMonth(),O.d=mt.getDate()+(O.w+6)%7)}else("W"in O||"U"in O)&&("w"in O||(O.w="u"in O?O.u%7:"W"in O?1:0),Rt="Z"in O?ud(vo(O.y,0,1)).getUTCDay():ld(vo(O.y,0,1)).getDay(),O.m=0,O.d="W"in O?(O.w+6)%7+O.W*7-(Rt+5)%7:O.w+O.U*7-(Rt+6)%7);return"Z"in O?(O.H+=O.Z/100|0,O.M+=O.Z%100,ud(O)):ld(O)}}function I(z,it,tt,O){for(var yt=0,mt=it.length,Rt=tt.length,Ut,De;yt<mt;){if(O>=Rt)return-1;if(Ut=it.charCodeAt(yt++),Ut===37){if(Ut=it.charAt(yt++),De=S[Ut in Ry?it.charAt(yt++):Ut],!De||(O=De(z,tt,O))<0)return-1}else if(Ut!=tt.charCodeAt(O++))return-1}return O}function P(z,it,tt){var O=l.exec(it.slice(tt));return O?(z.p=u.get(O[0].toLowerCase()),tt+O[0].length):-1}function W(z,it,tt){var O=p.exec(it.slice(tt));return O?(z.w=m.get(O[0].toLowerCase()),tt+O[0].length):-1}function G(z,it,tt){var O=c.exec(it.slice(tt));return O?(z.w=d.get(O[0].toLowerCase()),tt+O[0].length):-1}function N(z,it,tt){var O=y.exec(it.slice(tt));return O?(z.m=_.get(O[0].toLowerCase()),tt+O[0].length):-1}function C(z,it,tt){var O=f.exec(it.slice(tt));return O?(z.m=g.get(O[0].toLowerCase()),tt+O[0].length):-1}function F(z,it,tt){return I(z,t,it,tt)}function X(z,it,tt){return I(z,e,it,tt)}function V(z,it,tt){return I(z,i,it,tt)}function L(z){return o[z.getDay()]}function k(z){return n[z.getDay()]}function H(z){return h[z.getMonth()]}function D(z){return a[z.getMonth()]}function U(z){return s[+(z.getHours()>=12)]}function j(z){return 1+~~(z.getMonth()/3)}function q(z){return o[z.getUTCDay()]}function dt(z){return n[z.getUTCDay()]}function nt(z){return h[z.getUTCMonth()]}function Et(z){return a[z.getUTCMonth()]}function Mt(z){return s[+(z.getUTCHours()>=12)]}function wt(z){return 1+~~(z.getUTCMonth()/3)}return{format:function(z){var it=E(z+="",b);return it.toString=function(){return z},it},parse:function(z){var it=A(z+="",!1);return it.toString=function(){return z},it},utcFormat:function(z){var it=E(z+="",v);return it.toString=function(){return z},it},utcParse:function(z){var it=A(z+="",!0);return it.toString=function(){return z},it}}}var Ry={"-":"",_:" ",0:"0"},se=/^\s*\d+/,$I=/^%/,QI=/[\\^$*+?|[\]().{}]/g;function It(r,t,e){var i=r<0?"-":"",s=(i?-r:r)+"",n=s.length;return i+(n<e?new Array(e-n+1).join(t)+s:s)}function qI(r){return r.replace(QI,"\\$&")}function To(r){return new RegExp("^(?:"+r.map(qI).join("|")+")","i")}function wo(r){return new Map(r.map((t,e)=>[t.toLowerCase(),e]))}function tA(r,t,e){var i=se.exec(t.slice(e,e+1));return i?(r.w=+i[0],e+i[0].length):-1}function eA(r,t,e){var i=se.exec(t.slice(e,e+1));return i?(r.u=+i[0],e+i[0].length):-1}function iA(r,t,e){var i=se.exec(t.slice(e,e+2));return i?(r.U=+i[0],e+i[0].length):-1}function rA(r,t,e){var i=se.exec(t.slice(e,e+2));return i?(r.V=+i[0],e+i[0].length):-1}function sA(r,t,e){var i=se.exec(t.slice(e,e+2));return i?(r.W=+i[0],e+i[0].length):-1}function Py(r,t,e){var i=se.exec(t.slice(e,e+4));return i?(r.y=+i[0],e+i[0].length):-1}function Ly(r,t,e){var i=se.exec(t.slice(e,e+2));return i?(r.y=+i[0]+(+i[0]>68?1900:2e3),e+i[0].length):-1}function nA(r,t,e){var i=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(t.slice(e,e+6));return i?(r.Z=i[1]?0:-(i[2]+(i[3]||"00")),e+i[0].length):-1}function oA(r,t,e){var i=se.exec(t.slice(e,e+1));return i?(r.q=i[0]*3-3,e+i[0].length):-1}function aA(r,t,e){var i=se.exec(t.slice(e,e+2));return i?(r.m=i[0]-1,e+i[0].length):-1}function Gy(r,t,e){var i=se.exec(t.slice(e,e+2));return i?(r.d=+i[0],e+i[0].length):-1}function hA(r,t,e){var i=se.exec(t.slice(e,e+3));return i?(r.m=0,r.d=+i[0],e+i[0].length):-1}function Ny(r,t,e){var i=se.exec(t.slice(e,e+2));return i?(r.H=+i[0],e+i[0].length):-1}function lA(r,t,e){var i=se.exec(t.slice(e,e+2));return i?(r.M=+i[0],e+i[0].length):-1}function uA(r,t,e){var i=se.exec(t.slice(e,e+2));return i?(r.S=+i[0],e+i[0].length):-1}function cA(r,t,e){var i=se.exec(t.slice(e,e+3));return i?(r.L=+i[0],e+i[0].length):-1}function dA(r,t,e){var i=se.exec(t.slice(e,e+6));return i?(r.L=Math.floor(i[0]/1e3),e+i[0].length):-1}function pA(r,t,e){var i=$I.exec(t.slice(e,e+1));return i?e+i[0].length:-1}function fA(r,t,e){var i=se.exec(t.slice(e));return i?(r.Q=+i[0],e+i[0].length):-1}function mA(r,t,e){var i=se.exec(t.slice(e));return i?(r.s=+i[0],e+i[0].length):-1}function Fy(r,t){return It(r.getDate(),t,2)}function gA(r,t){return It(r.getHours(),t,2)}function yA(r,t){return It(r.getHours()%12||12,t,2)}function bA(r,t){return It(1+_o.count(lr(r),r),t,3)}function Dy(r,t){return It(r.getMilliseconds(),t,3)}function xA(r,t){return Dy(r,t)+"000"}function _A(r,t){return It(r.getMonth()+1,t,2)}function vA(r,t){return It(r.getMinutes(),t,2)}function TA(r,t){return It(r.getSeconds(),t,2)}function wA(r){var t=r.getDay();return t===0?7:t}function SA(r,t){return It(Ih.count(lr(r)-1,r),t,2)}function ky(r){var t=r.getDay();return t>=4||t===0?dn(r):dn.ceil(r)}function EA(r,t){return r=ky(r),It(dn.count(lr(r),r)+(lr(r).getDay()===4),t,2)}function CA(r){return r.getDay()}function IA(r,t){return It(Ah.count(lr(r)-1,r),t,2)}function AA(r,t){return It(r.getFullYear()%100,t,2)}function MA(r,t){return r=ky(r),It(r.getFullYear()%100,t,2)}function RA(r,t){return It(r.getFullYear()%1e4,t,4)}function PA(r,t){var e=r.getDay();return r=e>=4||e===0?dn(r):dn.ceil(r),It(r.getFullYear()%1e4,t,4)}function LA(r){var t=r.getTimezoneOffset();return(t>0?"-":(t*=-1,"+"))+It(t/60|0,"0",2)+It(t%60,"0",2)}function Oy(r,t){return It(r.getUTCDate(),t,2)}function GA(r,t){return It(r.getUTCHours(),t,2)}function NA(r,t){return It(r.getUTCHours()%12||12,t,2)}function FA(r,t){return It(1+ad.count(vs(r),r),t,3)}function By(r,t){return It(r.getUTCMilliseconds(),t,3)}function DA(r,t){return By(r,t)+"000"}function kA(r,t){return It(r.getUTCMonth()+1,t,2)}function OA(r,t){return It(r.getUTCMinutes(),t,2)}function BA(r,t){return It(r.getUTCSeconds(),t,2)}function WA(r){var t=r.getUTCDay();return t===0?7:t}function UA(r,t){return It(My.count(vs(r)-1,r),t,2)}function Wy(r){var t=r.getUTCDay();return t>=4||t===0?pn(r):pn.ceil(r)}function XA(r,t){return r=Wy(r),It(pn.count(vs(r),r)+(vs(r).getUTCDay()===4),t,2)}function ZA(r){return r.getUTCDay()}function VA(r,t){return It(Mh.count(vs(r)-1,r),t,2)}function HA(r,t){return It(r.getUTCFullYear()%100,t,2)}function KA(r,t){return r=Wy(r),It(r.getUTCFullYear()%100,t,2)}function YA(r,t){return It(r.getUTCFullYear()%1e4,t,4)}function zA(r,t){var e=r.getUTCDay();return r=e>=4||e===0?pn(r):pn.ceil(r),It(r.getUTCFullYear()%1e4,t,4)}function jA(){return"+0000"}function Uy(){return"%"}function Xy(r){return+r}function Zy(r){return Math.floor(+r/1e3)}var fn,Vy;JA({dateTime:"%x, %X",date:"%-m/%-d/%Y",time:"%-I:%M:%S %p",periods:["AM","PM"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]});function JA(r){return fn=JI(r),Vy=fn.format,fn.parse,fn.utcFormat,fn.utcParse,fn}function $A(r){return new Date(r)}function QA(r){return r instanceof Date?+r:+new Date(+r)}function Hy(r,t,e,i,s,n,o,a,h,l){var u=Cy(),c=u.invert,d=u.domain,p=l(".%L"),m=l(":%S"),f=l("%I:%M"),g=l("%I %p"),y=l("%a %d"),_=l("%b %d"),b=l("%B"),v=l("%Y");function S(E){return(h(E)<E?p:a(E)<E?m:o(E)<E?f:n(E)<E?g:i(E)<E?s(E)<E?y:_:e(E)<E?b:v)(E)}return u.invert=function(E){return new Date(c(E))},u.domain=function(E){return arguments.length?d(Array.from(E,QA)):d().map($A)},u.ticks=function(E){var A=d();return r(A[0],A[A.length-1],E??10)},u.tickFormat=function(E,A){return A==null?S:l(A)},u.nice=function(E){var A=d();return(!E||typeof E.range!="function")&&(E=t(A[0],A[A.length-1],E??10)),E?d(OI(A,E)):u},u.copy=function(){return Ey(u,Hy(r,t,e,i,s,n,o,a,h,l))},u}function qA(){return wy.apply(Hy(zI,jI,lr,hd,Ih,_o,od,nd,cn,Vy).domain([new Date(2e3,0,1),new Date(2e3,0,2)]),arguments)}function So(r,t,e){this.k=r,this.x=t,this.y=e}So.prototype={constructor:So,scale:function(r){return r===1?this:new So(this.k*r,this.x,this.y)},translate:function(r,t){return r===0&t===0?this:new So(this.k,this.x+this.k*r,this.y+this.k*t)},apply:function(r){return[r[0]*this.k+this.x,r[1]*this.k+this.y]},applyX:function(r){return r*this.k+this.x},applyY:function(r){return r*this.k+this.y},invert:function(r){return[(r[0]-this.x)/this.k,(r[1]-this.y)/this.k]},invertX:function(r){return(r-this.x)/this.k},invertY:function(r){return(r-this.y)/this.k},rescaleX:function(r){return r.copy().domain(r.range().map(this.invertX,this).map(r.invert,r))},rescaleY:function(r){return r.copy().domain(r.range().map(this.invertY,this).map(r.invert,r))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}},So.prototype;function Ky(r){return r.mode==="temporal"?tM(r):eM(r)}function tM({domain:r,range:t}){return qA().domain(r).range(t)}function eM({domain:r,range:t}){return Iy().domain(r).range(t)}function cd(r){return{mode:bt.horizontal,range:pR(),domain:fR(r)}}function iM(){return{mode:bt.vertical}}let mn=null;async function rM(){const r=await Sd();Yy(r.start_time),_t.on("layoutSettingsUpdated",()=>Yy(r.start_time))}function sM(){mn=null}async function Eo(){return mn||await We("scaleCreated")}async function Yy(r){await Di();const t=mn?"scaleUpdated":"scaleCreated",e=cd(r);mn=Ky(e),_t.emit(t,mn)}let Fe=null,dd=null;async function nM(){const r=await Ne(),t=await Xc();Fe=new BC({screenHeight:t.clientHeight,screenWidth:t.clientWidth,events:r.renderer.events,passiveWheel:!1}),Fe.zIndex=1,Fe.drag().pinch().wheel({trackpadPinch:!0}).decelerate({friction:.9}).clampZoom({minWidth:t.clientWidth/2}),r.stage.addChild(Fe),_t.emit("viewportCreated",Fe),_t.on("applicationResized",uM),_t.on("scaleUpdated",()=>Rh()),hM()}function oM(){Fe=null,dd=null}async function pd({animate:r}={}){const t=await Ce(),e=await ge(),i=t.getChildByName(yp);if(!i)throw new Error("Nodes container not found");const s=e.styles.guideTextSize+e.styles.guideTextTopPadding;pM();const{x:n,y:o,width:a,height:h}=i.getLocalBounds(),l=a+e.styles.columnGap*2,u=h+e.styles.rowGap*2+s*2,c=t.findFit(l,u);!a||!h||t.animate({position:{x:n+a/2,y:o+h/2-s},scale:c,time:r?e.animationDuration:0,ease:"easeInOutQuad",removeOnInterrupt:!0,callbackOnComplete:()=>{fd(),Rh()}})}async function Ce(){return Fe||await We("viewportCreated")}function zy(r){ty(dd,r)||(dd=r,_t.emit("viewportDateRangeUpdated",r))}function aM({xOffset:r,yOffset:t}){if(!Fe)return;const{x:e,y:i}=Fe.transform.position;Fe.setTransform(e+r,i+t,Fe.transform.scale.x,Fe.transform.scale.y)}async function hM(){const r=await Ce();Rh(),r.on("moved",()=>Rh())}async function Rh(){const r=await jy();r&&zy(r)}async function jy(){const r=await Ce(),t=await Eo(),e=t.invert(r.left),i=t.invert(r.right);return e instanceof Date&&i instanceof Date?[e,i]:null}async function lM(r){const t=await jy(),e=await Di();if(r===void 0||e.isDependency()||ty(r,t))return;const i=await Ce(),s=await Eo(),[n,o]=r,a=s(n),h=s(o),l=a+(h-a)/2;zy(r),i.fitWidth(h-a,!0),i.moveCenter(l,i.center.y)}async function uM(){const r=await Ne(),t=await Ce(),e=await Xc(),i=t.screenWidth,s=t.screenHeight,n=e.clientWidth,o=e.clientHeight,a=(n-i)/2,h=(o-s)/2;t.resize(r.screen.width,r.screen.height),aM({xOffset:a,yOffset:h})}let Gi=null;async function cM(){const r=await Ce(),t=await Ne();Gi=new eC({toggle:"renderable"}),t.ticker.add(()=>{r.dirty&&(Gi==null||Gi.cull(t.renderer.screen),r.dirty=!1)}),_t.emit("cullCreated",Gi)}function dM(){Gi=null}async function fd(){const r=await Ce();r.dirty=!0}function pM(){Gi&&Gi.uncull()}async function Jy(){return Gi||await We("cullCreated")}async function $y(){const r=await Di(),t=await ge();function e(i,s,n){const a=r.disableAnimations||n?0:t.animationDuration/1e3;return Q0.to(i,{...s,duration:a,ease:"power1.out",onUpdate:()=>{fd()}})}return{animate:e}}let md=[];function fM(){md.forEach(r=>r.unsubscribe()),md=[]}async function gd(r,t){const e=Zi.useSubscription(r,t);return md.push(e),await e.promise(),e.response}async function mM({size:r,stroke:t=1,radius:e=0}){const i=await Ne(),s=new qn;return s.lineStyle(t,"#fff",1,0),s.drawRoundedRect(0,0,r*2,r*2,e),i.renderer.generateTexture(s,{region:new ct(0,0,r,r),resolution:10})}async function Qy(r){return await gd(mM,[r])}var Ph=(r=>(r[r.Up=0]="Up",r[r.Down=180]="Down",r[r.Left=270]="Left",r[r.Right=90]="Right",r))(Ph||{});function qy(){const r=new ie;async function t(e){const{rotate:i=0}=e,s={size:e.size,radius:e.radius,stroke:e.stroke},n=await Qy(s);return r.texture=n,r.anchor.set(.5,.5),r.angle=45+i,r}return{element:r,render:t}}class tb{constructor(){lp(this,"status","visible");lp(this,"labels",new Set)}get visible(){return this.status==="visible"}get hidden(){return this.status==="hidden"}show(){if(this.status!=="visible"){for(const t of this.labels)t.visible=!0;this.status="visible"}}hide(){if(this.status!=="hidden"){for(const t of this.labels)t.visible=!1;this.status="hidden"}}toggle(t){t?this.show():this.hide()}add(t){this.labels.add(t),t.visible=this.visible}clear(){this.labels.clear()}}let Ni=null;async function gM(){const r=await Ce(),t=await Ne();Ni=new tb,t.ticker.add(()=>{if(r.dirty){const e=r.scale.x>.1;Ni==null||Ni.toggle(e)}})}function yM(){Ni==null||Ni.clear(),Ni=null}async function bM(){return Ni||await We("edgeCullCreated")}async function xM(){const r=await Ne(),t=new qn;return t.beginFill("#fff"),t.drawRect(0,0,1,1),t.endFill(),r.renderer.generateTexture(t)}async function yd(){return await gd(xM,[])}function bd(r,t){return Array.from({length:r},(e,i)=>t(i))}const _M=8,vM=2;async function TM(){const r=await ge(),t=await Jy(),e=await bM(),{animate:i}=await $y(),s=new Xt,{element:n,render:o}=await qy(),a=await yd(),h=bd(20,()=>new lt),l=new uS(a,h);let u=!1;s.name=Ib,s.addChild(n),s.addChild(l),t.addAll([n,l]),e.add(s);async function c(){return await o({size:10,rotate:Ph.Right}),n.tint=r.styles.edgeColor,l.tint=r.styles.edgeColor,s}async function d(m,f){const g=p(f);u||await c();for(const[y,_]of h.entries()){const{x:b,y:v}=g[y];i(_,{x:b,y:v},!u)}i(s,{x:m.x,y:m.y},!u),i(n,{x:f.x-_M,y:f.y},!u),u=!0}function p({x:m,y:f}){const g=[],y={x:0,y:0},_={x:m-vM,y:f},b={x:eb(y.x,{source:y,target:_}),y:y.y},v={x:eb(_.x,{source:y,target:_},!0),y:_.y};for(const[S]of h.entries()){if(S===h.length-1){g[S]=_;continue}const E=wM(S,{source:y,target:_,sourceBezier:b,targetBezier:v});g[S]=E}return g}return{element:s,render:c,setPosition:d}}function eb(r,{source:t,target:e},i){const s=(e.x-t.x)/2;return r+(s>64?s:64)*(i?-1:1)}function wM(r,t){const e=r/20,{source:i,target:s,sourceBezier:n,targetBezier:o}=t,a=i.x+(n.x-i.x)*e,h=i.y+(n.y-i.y)*e,l=n.x+(o.x-n.x)*e,u=n.y+(o.y-n.y)*e,c=o.x+(s.x-o.x)*e,d=o.y+(s.y-o.y)*e,p=a+(l-a)*e,m=h+(u-h)*e,f=l+(c-l)*e,g=u+(d-u)*e,y=p+(f-p)*e,_=m+(g-m)*e;return{x:y,y:_}}function xd(){const r=new Xt,t=new ie,e=new ie,i=new ie,s=new ie,n=new ie,o=new ie,a=new ie,h=new ie;t.name="border-corner-top-left",e.name="border-corner-top-right",i.name="border-corner-bottom-left",s.name="border-corner-bottom-right",n.name="border-corner-left",o.name="border-corner-right",a.name="border-corner-top",h.name="border-corner-bottom",e.anchor.x=1,e.scale.x=-1,i.anchor.y=1,i.scale.y=-1,s.anchor.x=1,s.scale.x=-1,s.anchor.y=1,s.scale.y=-1,r.addChild(t),r.addChild(e),r.addChild(i),r.addChild(s),r.addChild(n),r.addChild(o),r.addChild(a),r.addChild(h);async function l(p){const{radius:m=0,color:f="#fff",stroke:g,width:y,height:_}=p,b=Math.min(y,_),v=m*2>b?b/2:m,E=await Qy({size:v,radius:m,stroke:g}),A=await yd();return u({texture:E,width:y,height:_,size:v}),c({texture:A,width:y,height:_,size:v,stroke:g}),d(f),r}function u({texture:p,width:m,height:f,size:g}){t.texture=p,e.texture=p,i.texture=p,s.texture=p,t.position.set(0,0),e.position.set(m-g,0),i.position.set(0,f-g),s.position.set(m-g,f-g)}function c({texture:p,size:m,width:f,height:g,stroke:y}){const _=Math.max(g-m*2,0),b=Math.max(f-m*2,0);a.texture=p,n.texture=p,o.texture=p,h.texture=p,n.position.set(0,m),n.height=_,n.width=y,o.position.set(f-y,m),o.height=_,o.width=y,a.position.set(m,0),a.width=b,a.height=y,h.position.set(m,g-y),h.width=b,h.height=y}function d(p){t.tint=p,e.tint=p,i.tint=p,s.tint=p,a.tint=p,n.tint=p,o.tint=p,h.tint=p}return{element:r,render:l}}var ib={exports:{}};(function(r){(function(){function t(f,g){document.addEventListener?f.addEventListener("scroll",g,!1):f.attachEvent("scroll",g)}function e(f){document.body?f():document.addEventListener?document.addEventListener("DOMContentLoaded",function g(){document.removeEventListener("DOMContentLoaded",g),f()}):document.attachEvent("onreadystatechange",function g(){(document.readyState=="interactive"||document.readyState=="complete")&&(document.detachEvent("onreadystatechange",g),f())})}function i(f){this.g=document.createElement("div"),this.g.setAttribute("aria-hidden","true"),this.g.appendChild(document.createTextNode(f)),this.h=document.createElement("span"),this.i=document.createElement("span"),this.m=document.createElement("span"),this.j=document.createElement("span"),this.l=-1,this.h.style.cssText="max-width:none;display:inline-block;position:absolute;height:100%;width:100%;overflow:scroll;font-size:16px;",this.i.style.cssText="max-width:none;display:inline-block;position:absolute;height:100%;width:100%;overflow:scroll;font-size:16px;",this.j.style.cssText="max-width:none;display:inline-block;position:absolute;height:100%;width:100%;overflow:scroll;font-size:16px;",this.m.style.cssText="display:inline-block;width:200%;height:200%;font-size:16px;max-width:none;",this.h.appendChild(this.m),this.i.appendChild(this.j),this.g.appendChild(this.h),this.g.appendChild(this.i)}function s(f,g){f.g.style.cssText="max-width:none;min-width:20px;min-height:20px;display:inline-block;overflow:hidden;position:absolute;width:auto;margin:0;padding:0;top:-999px;white-space:nowrap;font-synthesis:none;font:"+g+";"}function n(f){var g=f.g.offsetWidth,y=g+100;return f.j.style.width=y+"px",f.i.scrollLeft=y,f.h.scrollLeft=f.h.scrollWidth+100,f.l!==g?(f.l=g,!0):!1}function o(f,g){function y(){var b=_;n(b)&&b.g.parentNode!==null&&g(b.l)}var _=f;t(f.h,y),t(f.i,y),n(f)}function a(f,g,y){g=g||{},y=y||window,this.family=f,this.style=g.style||"normal",this.weight=g.weight||"normal",this.stretch=g.stretch||"normal",this.context=y}var h=null,l=null,u=null,c=null;function d(f){return l===null&&(p(f)&&/Apple/.test(window.navigator.vendor)?(f=/AppleWebKit\/([0-9]+)(?:\.([0-9]+))(?:\.([0-9]+))/.exec(window.navigator.userAgent),l=!!f&&603>parseInt(f[1],10)):l=!1),l}function p(f){return c===null&&(c=!!f.document.fonts),c}function m(f,g){var y=f.style,_=f.weight;if(u===null){var b=document.createElement("div");try{b.style.font="condensed 100px sans-serif"}catch{}u=b.style.font!==""}return[y,_,u?f.stretch:"","100px",g].join(" ")}a.prototype.load=function(f,g){var y=this,_=f||"BESbswy",b=0,v=g||3e3,S=new Date().getTime();return new Promise(function(E,A){if(p(y.context)&&!d(y.context)){var I=new Promise(function(W,G){function N(){new Date().getTime()-S>=v?G(Error(""+v+"ms timeout exceeded")):y.context.document.fonts.load(m(y,'"'+y.family+'"'),_).then(function(C){1<=C.length?W():setTimeout(N,25)},G)}N()}),P=new Promise(function(W,G){b=setTimeout(function(){G(Error(""+v+"ms timeout exceeded"))},v)});Promise.race([P,I]).then(function(){clearTimeout(b),E(y)},A)}else e(function(){function W(){var j;(j=X!=-1&&V!=-1||X!=-1&&L!=-1||V!=-1&&L!=-1)&&((j=X!=V&&X!=L&&V!=L)||(h===null&&(j=/AppleWebKit\/([0-9]+)(?:\.([0-9]+))/.exec(window.navigator.userAgent),h=!!j&&(536>parseInt(j[1],10)||parseInt(j[1],10)===536&&11>=parseInt(j[2],10))),j=h&&(X==k&&V==k&&L==k||X==H&&V==H&&L==H||X==D&&V==D&&L==D)),j=!j),j&&(U.parentNode!==null&&U.parentNode.removeChild(U),clearTimeout(b),E(y))}function G(){if(new Date().getTime()-S>=v)U.parentNode!==null&&U.parentNode.removeChild(U),A(Error(""+v+"ms timeout exceeded"));else{var j=y.context.document.hidden;(j===!0||j===void 0)&&(X=N.g.offsetWidth,V=C.g.offsetWidth,L=F.g.offsetWidth,W()),b=setTimeout(G,50)}}var N=new i(_),C=new i(_),F=new i(_),X=-1,V=-1,L=-1,k=-1,H=-1,D=-1,U=document.createElement("div");U.dir="ltr",s(N,m(y,"sans-serif")),s(C,m(y,"serif")),s(F,m(y,"monospace")),U.appendChild(N.g),U.appendChild(C.g),U.appendChild(F.g),y.context.document.body.appendChild(U),k=N.g.offsetWidth,H=C.g.offsetWidth,D=F.g.offsetWidth,G(),o(N,function(j){X=j,W()}),s(N,m(y,'"'+y.family+'",sans-serif')),o(C,function(j){V=j,W()}),s(C,m(y,'"'+y.family+'",serif')),o(F,function(j){L=j,W()}),s(F,m(y,'"'+y.family+'",monospace'))})})},r.exports=a})()})(ib);var SM=ib.exports;const EM=Gn(SM),rb={inter:{fontFamily:"InterVariable",fontSize:16,lineHeight:20,fill:16777215}},sb={resolution:4,chars:hi.ASCII},nb="sans-serif",ob={inter:MM(rb.inter)};let _d=!1;async function CM(){const r=Object.values(rb);await Promise.all(r.map(t=>IM(t))),_d=!0,_t.emit("fontsLoaded",ob)}async function IM(r){const{fontFamily:t,...e}=r,i=new EM(t);try{await i.load()}catch(s){console.error(s),console.warn(`fonts: font ${t} failed to load, falling back to ${nb}`),hi.from(t,{fontFamily:nb,...e},sb);return}hi.from(t,r,sb)}function AM(){_d=!1}async function ab(){return _d?ob:await We("fontsLoaded")}function MM(r){const{fontFamily:t,...e}=r,i={fontName:t,...e};return s=>new OS(s,i)}let Fi=null;async function RM(){const r=await Ce(),t=await Ne();Fi=new tb,t.ticker.add(()=>{if(r.dirty){const e=r.scale.x>.2;Fi==null||Fi.toggle(e)}})}function PM(){Fi==null||Fi.clear(),Fi=null}async function LM(){return Fi||await We("labelCullCreated")}async function hb(){const{inter:r}=await ab(),t=await LM(),e=r("");t.add(e);async function i(s){return e.text=s,await e}return{element:e,render:i}}async function GM({height:r,radius:t}){const e=await Ne(),i=new qn;return i.beginFill("#fff"),i.drawRoundedRect(0,0,t*2,r,t),i.endFill(),e.renderer.generateTexture(i,{region:new ct(0,0,t,r),resolution:10})}async function NM(r){return await gd(GM,[r])}function FM(){const r=new ie,t=new ie;async function e(i){const s=await NM(i);return r.texture=s,t.texture=s,t.anchor.x=1,t.scale.x=-1,{left:r,right:t}}return{left:r,right:t,render:e}}async function vd(){const r=await yd();return new ie(r)}async function lb(){const r=new Xt,t=await vd(),{left:e,right:i,render:s}=await FM();r.addChild(t),r.addChild(e),r.addChild(i);async function n(h){const{width:l,x:u,visible:c}=a(h);return await s({height:h.height,radius:h.radius}),t.visible=c,t.width=l,t.height=h.height,t.x=u,e.visible=o(h.capLeft,h.radius),i.visible=o(h.capRight,h.radius),i.x=h.radius+l,t.tint=h.background,e.tint=h.background,i.tint=h.background,r}function o(h,l){return l===0?!1:h??!0}function a(h){const l=o(h.capLeft,h.radius),u=o(h.capRight,h.radius);let c=0;l&&(c+=h.radius),u&&(c+=h.radius);const d=Math.max(h.width-c,0),p=d>0,m=l?h.radius:0;return{width:d,visible:p,x:m}}return{element:r,render:n}}async function DM(){const r=await ge(),t=new Xt,{element:e,render:i}=await qy(),{element:s,render:n}=await lb(),{element:o,render:a}=await xd(),h=new Pa;t.eventMode="static",t.cursor="pointer",t.addChild(s),t.addChild(e),t.addChild(o),t.on("mouseover",u),t.on("mouseout",c),s.filters=[h],o.visible=!1;async function l({inside:d,isOpen:p,background:m}){const f={size:10,stroke:2,rotate:p?Ph.Up:Ph.Down},g=await i(f),y={width:r.styles.nodeToggleSize,height:r.styles.nodeToggleSize,background:d?m:"#333",radius:r.styles.nodeToggleBorderRadius},_=await n(y),b=await a({width:y.width,height:y.height,radius:y.radius,stroke:1,color:r.styles.nodeToggleBorderColor});b.alpha=d?0:1;const v={y:_.height/2,x:_.width/2},S=f.size/4;return g.x=v.x,g.y=p?v.y+S:v.y-S,t}function u(){h.brightness(.5,!1),o.visible=!0}function c(){h.brightness(1,!1),o.visible=!1}return{element:t,render:l}}let gn=null,Lh=!1;async function kM(){const r=await Ce();r.on("click",()=>Td(null)),r.on("drag-start",()=>{Lh=!0}),r.on("drag-end",()=>{setTimeout(()=>{Lh=!1})})}function OM(){gn=null,Lh=!1}function Td(r){if(Lh||wd(r))return;if(gn=r,r===null){_t.emit("nodeSelected",null);return}const{id:t,kind:e}=r;_t.emit("nodeSelected",{id:t,kind:e})}function wd(r){return(r==null?void 0:r.id)===(gn==null?void 0:gn.id)}function BM(){return gn}const Gh=4,WM=2;async function ub(){const r=await ge(),t=await Di(),e=new Xt,{element:i,render:s}=await lb(),{element:n,render:o}=await xd();e.addChild(i),n.position.set(-Gh,-Gh);async function a(u){const{background:c="#fff"}=r.styles.node(u),{nodeHeight:d,nodeRadius:p}=r.styles,m=l(u,p),f=u.state_type!=="RUNNING"||t.isDependency();return await s({width:m,height:d,radius:p,background:c,capRight:f}),await h(u,m,d),i}async function h(u,c,d){if(!wd(u)){e.removeChild(n);return}e.addChild(n),await o({stroke:WM,radius:r.styles.nodeBorderRadius,width:c+Gh*2,height:d+Gh*2,color:r.styles.nodeSelectedBorderColor})}function l(u,c){const d=Ed();if(bt.isTemporal()){const p=u.start_time,m=u.end_time??new Date,g=_p(m,p)/Rb*d;return Math.max(g,c*2)}return d}return{element:e,render:a}}class cb extends Xt{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)this.children[t].updateTransform()}calculateBounds(){this._bounds.clear(),this._calculateBounds();for(const t of this.children)if(t.calculateBounds(),t._mask){const e=t._mask.isMaskData?t._mask.maskObject:t._mask;e?(e.calculateBounds(),this._bounds.addBoundsMask(t._bounds,e._bounds)):this._bounds.addBounds(t._bounds)}else t.filterArea?this._bounds.addBoundsArea(t._bounds,t.filterArea):this._bounds.addBounds(t._bounds);this._bounds.updateID=this._boundsID}}async function UM(r){const t=new cb,e=await ge(),{element:i,render:s}=await ub(),{element:n,render:o}=await hb(),{element:a,render:h,getSize:l}=await bb(),{element:u,render:c}=await DM(),{element:d,render:p}=await xd(),{start:m,stop:f}=await Dg(r.id,G=>{h(G)});let g=r,y=!1;t.addChild(d),t.addChild(i),t.addChild(n),t.addChild(u),u.on("click",G=>{G.stopPropagation(),b()}),a.position={x:0,y:e.styles.nodeHeight+e.styles.nodesPadding},a.on("rendered",()=>{fd(),P()});async function _(G){return g=G,await s(G),await A(G),await I(G),await v(G),t}async function b(){y?await E():await S()}async function v(G){const{background:N="#fff"}=e.styles.node(G),C=4,{width:F,height:X}=l(),V=X+e.styles.nodeHeight+e.styles.nodesPadding*2+C*2,L=e.styles.nodeHeight,k=y?-C:C,H=Math.max(i.width,F),D=y?H+C*2:i.width-C*2;(await p({width:D,height:y?V:L,stroke:y?2:1,radius:e.styles.nodeBorderRadius,color:N})).position.set(k,k)}async function S(){y=!0,t.addChild(a),await Promise.all([m(),_(g)]),P()}async function E(){y=!1,t.removeChild(a),await Promise.all([f(),_(g)]),P()}async function A(G){const N=e.styles.nodeToggleSize,C=e.styles.nodeHeight-N,F=i.width>N,{background:X="#fff"}=e.styles.node(G),V=await c({background:X,inside:F,isOpen:y});return V.x=F?C/2:i.width+e.styles.nodePadding,V.y=C/2,V}async function I(G){const N=await o(G.label),C=e.styles.colorMode==="dark"?e.styles.textDefault:e.styles.textInverse,F=e.styles.nodePadding,X=u.x+u.width+F,V=i.width+F,L=i.width>X+N.width+F,k=e.styles.nodeHeight/2-N.height/2,H=L?X:Math.max(V,X);return N.position={x:H,y:k},N.tint=L?C:e.styles.textDefault,N}function P(){v(g);const G=W();t.emit("resized",G)}function W(){const G=l(),N=y?G.height+e.styles.nodesPadding*2:0,C=y?G.width:0;return{height:e.styles.nodeHeight+N,width:Math.max(C,t.width)}}return{kind:"flow-run",element:t,bar:i,render:_}}async function XM(){const r=await ge(),t=new cb,{element:e,render:i}=await hb(),{element:s,render:n}=await ub();t.addChild(s),t.addChild(e);async function o(h){return await Promise.all([n(h),i(h.label)]),a(),t}function a(){const h=r.styles.colorMode==="dark"?r.styles.textDefault:r.styles.textInverse,l=r.styles.nodePadding,u=s.width>l+e.width+l,c=u?l:s.width+l,d=r.styles.nodeHeight/2-e.height/2;e.position={x:c,y:d},e.tint=u?h:r.styles.textDefault}return{kind:"task-run",element:t,render:o,bar:s}}async function ZM(){const r=await Ne(),t=await Ce(),e=await Di(),i=await ge(),{inter:s}=await ab(),n=new Xt,o=await vd();n.addChild(o);const a=s("");n.addChild(a);let h=await Eo(),l,u;_t.on("scaleUpdated",f=>h=f),r.ticker.add(()=>{e.disableGuides||(m(),n.height!==r.screen.height&&d())});function c(f,g){l=f,u=g,d(),p(f)}function d(){o.width=i.styles.guideLineWidth,o.height=r.screen.height,o.tint=i.styles.guideLineColor}function p(f){a.text=u(f),a.fontSize=i.styles.guideTextSize,a.tint=i.styles.guideTextColor,a.position.set(i.styles.guideTextLeftPadding,i.styles.guideTextTopPadding)}function m(){l!==void 0&&(n.position.x=h(l)*t.scale._x+t.worldTransform.tx)}return{element:n,render:c}}class db extends Error{constructor(){super("Layout is not temporal")}}function VM(r){return r.toLocaleTimeString()}function pb(r){const t=navigator.language;return new Intl.DateTimeFormat(t,{timeStyle:"short"}).format(r)}function HM(r){const t=navigator.language;return new Intl.DateTimeFormat(t,{dateStyle:"short"}).format(r)}function KM(r){return r.getHours()===0&&r.getMinutes()===0?`${Nh.date(r)}
|
|
1176
|
+
${pb(r)}`:pb(r)}const Nh={timeBySeconds:VM,timeByMinutesWithDates:KM,date:HM},Qt={seconds:"seconds",minutes:"minutes",date:"date"},Co={day:r=>{const t=new Date(r.getTime());return t.setHours(0,0,0,0),t.getTime()},week:r=>{const t=new Date(r.getTime());return t.setHours(0,0,0,0),t.setDate(r.getDate()-r.getDay()+1),t.getTime()}},Ct={second:1e3,minute:1e3*60,hour:1e3*60*60,day:1e3*60*60*24,week:1e3*60*60*24*7},fb=[{ceiling:Ct.second*4,increment:Ct.second,labelFormat:Qt.seconds},{ceiling:Ct.second*8,increment:Ct.second*5,labelFormat:Qt.seconds},{ceiling:Ct.second*13,increment:Ct.second*10,labelFormat:Qt.seconds},{ceiling:Ct.second*20,increment:Ct.second*15,labelFormat:Qt.seconds},{ceiling:Ct.second*45,increment:Ct.second*30,labelFormat:Qt.seconds},{ceiling:Ct.minute*4,increment:Ct.minute,labelFormat:Qt.minutes},{ceiling:Ct.minute*8,increment:Ct.minute*5,labelFormat:Qt.minutes},{ceiling:Ct.minute*13,increment:Ct.minute*10,labelFormat:Qt.minutes},{ceiling:Ct.minute*28,increment:Ct.minute*15,labelFormat:Qt.minutes},{ceiling:Ct.hour*1.24,increment:Ct.minute*30,labelFormat:Qt.minutes},{ceiling:Ct.hour*3,increment:Ct.hour,labelFormat:Qt.minutes},{ceiling:Ct.hour*8,increment:Ct.hour*2,getAnchor:Co.day,labelFormat:Qt.minutes},{ceiling:Ct.hour*13,increment:Ct.hour*6,getAnchor:Co.day,labelFormat:Qt.minutes},{ceiling:Ct.hour*22,increment:Ct.hour*12,getAnchor:Co.day,labelFormat:Qt.minutes},{ceiling:Ct.day*4,increment:Ct.day,getAnchor:Co.day,labelFormat:Qt.date},{ceiling:Ct.week*2,increment:Ct.week,getAnchor:Co.week,labelFormat:Qt.date},{ceiling:1/0,increment:Ct.week*4,labelFormat:Qt.date}],YM=300;async function zM(){const r=await Ce(),t=await Di(),e=new Xt,i=new Map;let s=await Eo();_t.on("scaleUpdated",d=>s=d),await o();function n(){if(e.visible=!t.disableGuides,!t.disableGuides)try{const{anchor:d,increment:p,labelFormat:m}=a(),f=c(d,p);u(f,m)}catch(d){if(d instanceof db)return;console.error(d)}}async function o(){const d=[];bd(30,async p=>{const m=ZM();d.push(m);const f=await m;e.addChild(f.element),i.set(p,f)}),await Promise.all(d)}function a(){const d=r.left-YM,p=s.invert(d),m=s.invert(d+260/r.scale.x);if(!(p instanceof Date)||!(m instanceof Date))throw new db;const f=m.getTime()-p.getTime(),{increment:g,getAnchor:y,labelFormat:_}=h(f);return{anchor:y(p),increment:g,labelFormat:l(_)}}function h(d){const p=fb.find(m=>m.ceiling>d)??fb[0];return p.getAnchor||(p.getAnchor=m=>Math.floor(m.getTime()/p.increment)*p.increment),p}function l(d){switch(d){case Qt.minutes:return Nh.timeByMinutesWithDates;case Qt.date:return Nh.date;default:return Nh.timeBySeconds}}function u(d,p){const m=new Map(i.entries()),f=Array.from(m.keys()).filter(g=>!d.includes(g));i.clear();for(const g of d){if(m.has(g)){const _=m.get(g);i.set(g,_),_.render(new Date(g),p);continue}const y=m.get(f.pop()??-1);if(y===void 0){console.warn("Guides: No unused guides available to render.");continue}y.render(new Date(g),p),i.set(g,y)}}function c(d,p){return bd(30,m=>d+p*m)}return{element:e,render:n}}async function jM(){const r=await Ne(),{element:t,render:e}=await zM();r.stage.addChild(t),e(),_t.on("viewportDateRangeUpdated",()=>e()),_t.on("layoutSettingsUpdated",()=>e()),_t.on("configUpdated",()=>e())}function KR(){}const JM=80;async function $M(){const r=await Ne(),t=await Ce(),e=await Di(),i=await ge(),s=await vd();let n=await Eo();_t.on("scaleUpdated",h=>n=h);function o(){if(!e.isTemporal()){s.visible=!1;return}console.log("tick"),s.width=i.styles.playheadWidth,s.height=r.stage.height,s.tint=i.styles.playheadColor,s.position.x=n(new Date)*t.scale.x+t.worldTransform.tx,a()}function a(){if(t.moving||!(s.position.x>0&&s.position.x<r.screen.width)||!(s.position.x>r.screen.width-JM))return;const u=t.left;t.zoomPercent(-.1,!0),t.left=u}return{element:s,render:o}}async function QM(){const r=await Ne(),t=await Sd(),{element:e,render:i}=await $M();t.end_time||(r.stage.addChild(e),r.ticker.add(i)),_t.on("runDataUpdated",({end_time:s})=>{s&&(r.ticker.remove(i),r.stage.removeChild(e))})}function YR(){}function qM({stage:r,props:t}){sC(),nM(),rM(),jM(),nR(),QM(),Ob(),CM(),iC(r),Xb(t),cM(),RM(),gM(),cR(),kM()}function tR(){_t.clear();try{nC(),oM(),sM(),rC(),oR(),Zb(),Bb(),AM(),dM(),PM(),yM(),dR(),OM(),fM()}catch(r){console.error(r)}}async function eR(r){const t=await ge(),e=await Ne(),i=await Jy(),{animate:s}=await $y(),{element:n,render:o,bar:a}=await g(r);let h=r,l=null,u=!1,c=!1;i.add(n),n.eventMode="static",n.cursor="pointer",n.name=Cb,n.on("click",b=>{b.stopPropagation(),Td(h)}),r.end_time||p(),_t.on("nodeSelected",()=>{const b=wd(r);b!==u&&(u=b,o(h))});async function d(b){h=b;const v=y(b);return v===l||(l=v,await o(b),b.end_time&&m()),n}function p(){e.ticker.add(f)}function m(){e.ticker.remove(f)}function f(){d(r)}async function g(b){const{kind:v}=b;switch(v){case"task-run":return await XM();case"flow-run":return await UM(b);default:const S=v;throw new Error(`switch does not have case for value: ${S}`)}}function y(b){const v=b.end_time??new Date;return[b.state_type,v.getTime(),bt.horizontal,bt.horizontalScaleMultiplier,t.styles.colorMode].join("-")}function _({x:b,y:v}){s(n,{x:b,y:v},!c),c=!0}return{element:n,render:d,bar:a,setPosition:_}}function mb({gap:r=0,minimum:t=0}={}){const e=new Map;function i(l){const u=e.get(l)??[];return Math.max(...u.values(),Y.toValue(t))+Y.toValue(r)}function s(l){let u=0;for(let c=0;c<l;c++)u+=i(c);return u}function n(l){return s(l+1)-Y.toValue(r)}function o({axis:l,nodeId:u,offset:c}){const d=e.get(l)??new Map;d.set(u,c),e.set(l,d)}function a({axis:l,nodeId:u}){var c;(c=e.get(l))==null||c.delete(u)}function h(){e.clear()}return{getOffset:i,getTotalOffset:s,getTotalValue:n,setOffset:o,removeOffset:a,clear:h}}function iR(r){throw new Error(`switch does not have case for value: ${r}`)}const gb="KGZ1bmN0aW9uKCl7InVzZSBzdHJpY3QiO2Z1bmN0aW9uIEtlKG4pe3Rocm93IG5ldyBFcnJvcihgc3dpdGNoIGRvZXMgbm90IGhhdmUgY2FzZSBmb3IgdmFsdWU6ICR7bn1gKX1mdW5jdGl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YXRhLm5vZGVzKWUuc2V0KHIsdCsrKTtyZXR1cm4gZX1vbm1lc3NhZ2U9Tm87ZnVuY3Rpb24gTm8oe2RhdGE6bn0pe2NvbnN0e3R5cGU6ZX09bjtzd2l0Y2goZSl7Y2FzZSJsYXlvdXQiOkRvKG4pO3JldHVybjtkZWZhdWx0OktlKGUpfX1mdW5jdGlvbiBVbyhuKXtwb3N0TWVzc2FnZShuKX1hc3luYyBmdW5jdGlvbiBEbyhuKXtjb25zdHtkYXRhOmV9PW4sdD13byhuKSxyPWF3YWl0IFRvKG4sdCksbz1uZXcgTWFwO2xldCBpPTAsYT0wO2Zvcihjb25zdFt1LGxdb2YgZS5ub2Rlcyl7Y29uc3QgZj10LmdldCh1KSxnPXIuZ2V0KHUpO2lmKGY9PT12b2lkIDApe2NvbnNvbGUud2FybihgTm9kZUlkIG5vdCBmb3VuZCBpbiBob3Jpem9udGFsIGxheW91dDogU2tpcHBpbmcgJHtsLmxhYmVsfWApO2NvbnRpbnVlfWlmKGc9PT12b2lkIDApe2NvbnNvbGUud2FybihgTm9kZUlkIG5vdCBmb3VuZCBpbiB2ZXJ0aWNhbCBsYXlvdXQ6IFNraXBwaW5nICR7bC5sYWJlbH1gKTtjb250aW51ZX1pPU1hdGgubWF4KGksZyksYT1NYXRoLm1heChhLGYuY29sdW1uKSxvLnNldCh1LHsuLi5mLHk6Zyxyb3c6Z30pfVVvKHt0eXBlOiJsYXlvdXQiLGxheW91dDp7bWF4Um93OmksbWF4Q29sdW1uOmEscG9zaXRpb25zOm99fSl9fSkoKTsKLy8jIHNvdXJjZU1hcHBpbmdVUkw9cnVuR3JhcGgud29ya2VyLTU3ODU4YTNiLmpzLm1hcAo=",yb=typeof window<"u"&&window.Blob&&new Blob([atob(gb)],{type:"text/javascript;charset=utf-8"});function rR(){let r;try{if(r=yb&&(window.URL||window.webkitURL).createObjectURL(yb),!r)throw"";return new Worker(r)}catch{return new Worker("data:application/javascript;base64,"+gb)}finally{r&&(window.URL||window.webkitURL).revokeObjectURL(r)}}function sR(r){const t=new rR;return t.onmessage=r,t}async function bb(){const r=sR(P),t=new Map,e=new Map,i=new Xt,s=new Xt,n=await ge(),o=mb({gap:()=>n.styles.rowGap,minimum:()=>n.styles.nodeHeight}),a=mb({gap:()=>n.styles.columnGap,minimum:()=>Ed()});let h=null,l=null;i.name=yp,_t.on("layoutSettingsUpdated",async()=>{l&&i.parent&&(o.clear(),a.clear(),await u(l)),G()}),_t.on("nodeSelected",()=>{G()});async function u(L){l=L,h=null,await Promise.all([c(L),p(L)]),f(L)}async function c(L){const k=[];for(const H of L.nodes.values())k.push(d(H));await Promise.all(k)}async function d(L){const{render:k}=await _(L);return await k(L)}async function p(L){if((await Di()).disableEdges){i.removeChild(s);return}i.addChildAt(s,0);const H=[];for(const[D,{children:U}]of L.nodes)for(const{id:j}of U)H.push(m(D,j));await Promise.all(H)}async function m(L,k){const H=`${L}_${k}`;if(e.has(H))return;const D=await TM();e.has(H)||(e.set(H,D),s.addChild(D.element))}function f(L){const k=new Map;for(const[H,{element:D}]of t)k.set(H,D.width);r.postMessage({type:"layout",data:L,widths:k,horizontalSettings:cd(L.start_time),verticalSettings:iM()})}function g(){if(h)for(const[L,k]of e){const[H,D]=L.split("_"),U=h.positions.get(H),j=h.positions.get(D),q=t.get(H);if(!U||!j){console.warn(`Could not find edge in layout: Skipping ${L}`);continue}if(!q){console.warn(`Could not find parent node in nodes: Skipping ${H}`);continue}const dt=q.bar.width,nt=v(U),Et={x:nt.x+dt,y:nt.y+n.styles.nodeHeight/2},Mt=v(j),wt={x:Mt.x-Et.x,y:Mt.y-Et.y+n.styles.nodeHeight/2};k.setPosition(Et,wt)}}function y(){if(h){for(const[L,k]of t){const H=h.positions.get(L);if(!H){console.warn(`Could not find node in layout: Skipping ${L}`);continue}const D=v(H);k.setPosition(D)}g(),i.emit("rendered"),i.emit("resized",I())}}async function _(L){const k=t.get(L.id);if(k)return k;const H=await eR(L);return H.element.on("resized",D=>b(L.id,D)),t.set(L.id,H),i.addChild(H.element),H}function b(L,k){if(!h)return;const H=t.get(L),D=h.positions.get(L);!H||!D||(o.setOffset({nodeId:L,axis:D.y,offset:k.height}),a.setOffset({nodeId:L,axis:D.column,offset:k.width}),y())}function v(L){const k=o.getTotalOffset(L.y);return{x:S(L),y:k}}function S(L){return bt.isDependency()?a.getTotalOffset(L.column):L.x}function E(){return h?o.getTotalValue(h.maxRow):0}function A(){if(!h||!l)return 0;if(bt.isDependency())return a.getTotalValue(h.maxColumn);const L=cd(l.start_time),k=Ky(L),H=k(l.end_time??new Date),D=k(l.start_time);return H-D}function I(){return{width:A(),height:E()}}function P({data:L}){const{type:k}=L;switch(k){case"layout":W(L);return;default:iR(k)}}function W(L){h=L.layout,y()}async function G(){const L=await Di(),k=BM();if(!k||L.disableEdges){N([]);return}const H=X(k.id);N(H)}function N(L){C(L),F(L)}function C(L){for(const[k,{element:H}]of t){if(L.length===0||L.includes(k)){H.alpha=1;continue}H.alpha=n.styles.nodeUnselectedAlpha}}function F(L){for(const[k,{element:H}]of e){const[D,U]=k.split("_");if(L.length===0||L.includes(D)&&L.includes(U)){H.alpha=1;continue}H.alpha=n.styles.nodeUnselectedAlpha}}function X(L){const k=V(L,"parents"),H=V(L,"children");return[L,...k,...H]}function V(L,k){const H=l==null?void 0:l.nodes.get(L);if(!H)return[];const D=[];for(const{id:U}of H[k])D.push(U),D.push(...V(U,k));return D}return{element:i,getSize:I,render:u}}let Io=null,Dr=null,Ts=null;async function nR(){const r=await Ce(),t=await ge(),{element:e,render:i}=await bb();r.addChild(e),e.alpha=0;const s=await Dg(t.runId,async n=>{const o=Dr?"runDataUpdated":"runDataCreated";Dr=n,_t.emit(o,Dr),await Di(),i(n)});_t.on("configUpdated",()=>{Dr&&i(Dr)}),Ts=e,Io=s.stop,Ts.once("rendered",()=>aR()),_t.on("layoutUpdated",()=>hR()),s.start()}function oR(){Io==null||Io(),Io=null,Ts=null,Dr=null}async function Sd(){return Dr||await We("runDataCreated")}function aR(){pd(),be.shared.addOnce(()=>{Ts&&(Ts.alpha=1)})}async function hR(){if(!Ts)return;const r=await ge();Ts.once("rendered",()=>{setTimeout(()=>{pd({animate:!0})},r.animationDuration)})}function lR(r){let t=0;for(const[,{children:e}]of r)t+=e.length;return t}function uR({start_time:r,end_time:t}){const e=Gb(t??new Date,r);return e<xp?2:e<xp*6?1:.1}async function cR(){const r=await Sd(),t=await ge(),e=uR(r);Fh(e,!0),r.nodes.size>t.disableAnimationsThreshold&&(bt.disableAnimations=!0),lR(r.nodes)>t.disableEdgesThreshold&&(bt.disableEdges=!0)}function dR(){bt.horizontalScaleMultiplierDefault=0,bt.horizontalScaleMultiplier=0}const bt=Y.reactive({horizontal:"temporal",vertical:"nearest-parent",horizontalScaleMultiplierDefault:0,horizontalScaleMultiplier:0,disableAnimations:!1,disableEdges:!1,disableGuides:!1,isTemporal(){return this.horizontal==="temporal"},isDependency(){return this.horizontal==="dependency"},isWaterfall(){return this.vertical==="waterfall"},isNearestParent(){return this.vertical==="nearest-parent"}});async function Di(){return Cd()?bt:await We("layoutSettingsCreated")}function Ed(){return bt.isDependency()?200:20*bt.horizontalScaleMultiplier}function pR(){return[0,Ed()]}function fR(r){if(bt.isDependency())return[0,1];const t=r,e=Mb(t,1);return[t,e]}function Fh(r,t=!1){if(bt.horizontalScaleMultiplier===r)return;const e=Dh();bt.horizontalScaleMultiplier=r,t&&(bt.horizontalScaleMultiplierDefault=r),e()}function mR(){Fh(bt.horizontalScaleMultiplierDefault)}function gR(r){if(bt.horizontal===r)return;const t=Dh();bt.horizontal=r,bt.disableGuides=bt.isDependency(),t()}function yR(r){if(bt.vertical===r)return;const t=Dh();bt.vertical=r,t()}function bR(r){if(bt.disableEdges===r)return;const t=Dh();bt.disableEdges=r,t()}function Dh(){const r=Cd()?"layoutSettingsUpdated":"layoutSettingsCreated",{horizontal:t,vertical:e}=bt;return()=>{Cd()&&_t.emit(r,bt),(t!==bt.horizontal||e!==bt.vertical)&&_t.emit("layoutUpdated")}}function Cd(){return bt.horizontalScaleMultiplier!==0}function xb(r){if(!(r instanceof HTMLElement))return!1;const t=r.tagName.toLowerCase();return["input","textarea"].includes(t)}const xR={class:"flex items-center gap-2"},_R=Y.defineComponent({__name:"RunGraphSettings",setup(r){const t=[Vi.positions.topRight,Vi.positions.bottomRight,Vi.positions.topLeft,Vi.positions.bottomLeft],e=[{value:"dependency",label:"Dependency"},{value:"temporal",label:"Temporal"}],i=Y.computed({get(){return bt.horizontal},set(c){gR(c)}}),s=[{value:"waterfall",label:"Waterfall"},{value:"nearest-parent",label:"Nearest Parent"}],n=Y.computed({get(){return bt.vertical},set(c){yR(c)}}),o=Y.computed({get(){return bt.disableEdges},set(c){bR(c)}});function a(){const d=bt.horizontalScaleMultiplier*1.25;Fh(d)}function h(){const c=Math.abs(-.75),d=bt.horizontalScaleMultiplier*c;Fh(d)}Zi.useKeyDown(["-","="],l);function l(c){if(!(xb(c.target)||c.metaKey||c.ctrlKey))switch(c.key){case"-":h();break;case"=":a();break}}function u(){mR()}return(c,d)=>{const p=Y.resolveComponent("p-radio-group"),m=Y.resolveComponent("p-label"),f=Y.resolveComponent("p-divider"),g=Y.resolveComponent("p-checkbox"),y=Y.resolveComponent("p-overflow-menu");return Y.openBlock(),Y.createBlock(Y.unref(Vi.PPopOver),{class:"run-graph-settings","auto-close":"",placement:t},{target:Y.withCtx(({toggle:_})=>[Y.createVNode(Y.unref(Vi.PButton),{"aria-label":"Run Graph Options",icon:"CogIcon",flat:"",onClick:_},null,8,["onClick"])]),default:Y.withCtx(()=>[Y.createVNode(y,{class:"run-graph-settings__menu"},{default:Y.withCtx(()=>[Y.createVNode(m,{label:"View"},{default:Y.withCtx(()=>[Y.createVNode(p,{modelValue:i.value,"onUpdate:modelValue":d[0]||(d[0]=_=>i.value=_),options:e},{label:Y.withCtx(({option:_})=>[Y.createTextVNode(Y.toDisplayString(_.label),1)]),_:1},8,["modelValue"])]),_:1}),Y.unref(bt).isTemporal()?(Y.openBlock(),Y.createBlock(m,{key:0,label:"Scaling",class:"mt-4"},{default:Y.withCtx(()=>[Y.createElementVNode("div",xR,[Y.createVNode(Y.unref(Vi.PButton),{title:"Decrease scale (-)",small:"",icon:"MinusIcon",onClick:h}),Y.createVNode(Y.unref(Vi.PButton),{title:"Increase scale (+)",small:"",icon:"PlusIcon",onClick:a}),Y.createVNode(Y.unref(Vi.PButton),{small:"",onClick:u},{default:Y.withCtx(()=>[Y.createTextVNode(" Reset ")]),_:1})])]),_:1})):Y.createCommentVNode("",!0),Y.createVNode(f),Y.createVNode(m,{label:"Layout"},{default:Y.withCtx(()=>[Y.createVNode(p,{modelValue:n.value,"onUpdate:modelValue":d[1]||(d[1]=_=>n.value=_),options:s},{label:Y.withCtx(({option:_})=>[Y.createTextVNode(Y.toDisplayString(_.label),1)]),_:1},8,["modelValue"])]),_:1}),Y.createVNode(f),Y.createVNode(g,{modelValue:o.value,"onUpdate:modelValue":d[2]||(d[2]=_=>o.value=_),label:"Hide dependency arrows"},null,8,["modelValue"])]),_:1})]),_:1})}}}),zR="",vR={class:"run-graph__actions"},TR=Y.defineComponent({__name:"RunGraph",props:{config:{},viewport:{},fullscreen:{type:[Boolean,null],default:null},selected:{default:null}},emits:["update:viewport","update:fullscreen","update:selected"],setup(r,{emit:t}){const e=r,i=Y.ref(),s=Y.ref(!1),n=Y.computed({get(){return e.fullscreen??s.value},set(u){s.value=u,t("update:fullscreen",u)}});Y.watch(()=>e.selected,u=>Td(u)),_t.on("nodeSelected",u=>t("update:selected",u)),Y.watch(()=>e.viewport,u=>lM(u));const o=Y.computed(()=>({root:{"run-graph--fullscreen":n.value}}));_t.on("viewportDateRangeUpdated",u=>t("update:viewport",u));function a(){pd({animate:!0})}function h(){n.value=!n.value}Y.onMounted(()=>{if(!i.value)throw new Error("Stage does not exist");qM({stage:i.value,props:e})}),Y.onBeforeUnmount(()=>{tR()}),Zi.useKeyDown(["c","f","Escape"],l);function l(u){if(!(xb(u.target)||u.metaKey||u.ctrlKey))switch(u.key){case"c":a();break;case"f":h();break;case"Escape":n.value&&h();break}}return(u,c)=>{const d=Y.resolveComponent("p-button");return Y.openBlock(),Y.createElementBlock("div",{class:Y.normalizeClass(["run-graph",o.value.root])},[Y.createElementVNode("div",{ref_key:"stage",ref:i,class:"run-graph__stage"},null,512),Y.createElementVNode("div",vR,[Y.createVNode(d,{title:"Recenter graph (c)",icon:"Target",flat:"",onClick:a}),Y.createVNode(d,{title:"Toggle fullscreen (f)",icon:"ArrowsPointingOutIcon",flat:"",onClick:h}),Y.createVNode(_R)])],2)}}}),jR="",_b=["flow-run","task-run"];function wR(r){return _b.includes(r)}oe.RunGraph=TR,oe.isRunGraphNodeType=wR,oe.runGraphNodeKinds=_b,Object.defineProperty(oe,Symbol.toStringTag,{value:"Module"})});
|
|
1177
1177
|
//# sourceMappingURL=graphs.umd.js.map
|