diff --git a/package.json b/package.json index 9a112dd0..be8a5b92 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "route-graphics", - "version": "1.7.5", + "version": "1.8.0", "description": "A 2D graphics rendering interface that takes JSON input and renders pixels using PixiJS", "main": "dist/RouteGraphics.js", "type": "module", diff --git a/playground/data/templates.yaml b/playground/data/templates.yaml index 47d846b8..8521497b 100644 --- a/playground/data/templates.yaml +++ b/playground/data/templates.yaml @@ -106,7 +106,8 @@ width: 220 height: 240 direction: vertical - gap: 12 + gapX: 12 + gapY: 12 children: - id: vertical-1 type: rect @@ -130,7 +131,8 @@ width: 280 height: 90 direction: horizontal - gap: 10 + gapX: 10 + gapY: 10 children: - id: horizontal-1 type: rect diff --git a/playground/pages/docs/nodes/container.md b/playground/pages/docs/nodes/container.md index c4c321a6..3f40cc3f 100644 --- a/playground/pages/docs/nodes/container.md +++ b/playground/pages/docs/nodes/container.md @@ -15,31 +15,33 @@ Try it in the [Playground](/playground/?template=container-layout). ## Field Reference -| Field | Type | Required | Default | Notes | -| ------------ | ---------------------------------------- | ------------------- | ------------------------ | ------------------------------------------------------- | -| `id` | string | Yes | - | Element id. | -| `type` | string | Yes | - | Must be `container`. | -| `x` | number | Yes (public schema) | `0` at runtime | Position before anchor transform. | -| `y` | number | Yes (public schema) | `0` at runtime | Position before anchor transform. | -| `width` | number | No | auto | Derived from children if omitted. | -| `height` | number | No | auto | Derived from children if omitted. | -| `anchorX` | number | No | `0` | For containers, use `0`, `0.5`, or `1`. | -| `anchorY` | number | No | `0` | For containers, use `0`, `0.5`, or `1`. | -| `alpha` | number | No | `1` | Opacity `0..1`. | -| `children` | array | No | `[]` | Any registered element plugin type can be nested. | -| `direction` | `absolute` \| `horizontal` \| `vertical` | No | `""` (absolute behavior) | Auto-positioning for children in non-absolute modes. | -| `gap` | number | No | `0` | Space between children in layout mode. | -| `rotation` | number | No | `0` | Degrees. | -| `scroll` | boolean | No | `false` | Enables clipping and wheel scrolling for overflow. | -| `scrollbar` | object | No | - | Optional custom vertical scrollbar chrome for overflow. | -| `hover` | object | No | - | Hover event config. Supports `inheritToChildren`. | -| `click` | object | No | - | Click event config. Supports `inheritToChildren`. | -| `rightClick` | object | No | - | Right click event config. Supports `inheritToChildren`. | +| Field | Type | Required | Default | Notes | +| ------------ | ---------------------------------------- | ------------------- | ------------------------ | ------------------------------------------------------------------- | +| `id` | string | Yes | - | Element id. | +| `type` | string | Yes | - | Must be `container`. | +| `x` | number | Yes (public schema) | `0` at runtime | Position before anchor transform. | +| `y` | number | Yes (public schema) | `0` at runtime | Position before anchor transform. | +| `width` | number | No | auto | Derived from children if omitted. | +| `height` | number | No | auto | Derived from children if omitted. | +| `anchorX` | number | No | `0` | For containers, use `0`, `0.5`, or `1`. | +| `anchorY` | number | No | `0` | For containers, use `0`, `0.5`, or `1`. | +| `alpha` | number | No | `1` | Opacity `0..1`. | +| `children` | array | No | `[]` | Any registered element plugin type can be nested. | +| `direction` | `absolute` \| `horizontal` \| `vertical` | No | `""` (absolute behavior) | Auto-positioning for children in non-absolute modes. | +| `gapX` | number | No | `0` | Horizontal spacing between children, and between wrapped columns. | +| `gapY` | number | No | `0` | Vertical spacing between children, and between wrapped rows. | +| `rotation` | number | No | `0` | Degrees. | +| `scroll` | boolean | No | `false` | Enables clipping and wheel scrolling for overflow. | +| `scrollbar` | object | No | - | Optional custom vertical scrollbar chrome for overflow. | +| `hover` | object | No | - | Hover event config. Supports `inheritToChildren`. | +| `click` | object | No | - | Click event config. Supports `inheritToChildren`. | +| `rightClick` | object | No | - | Right click event config. Supports `inheritToChildren`. | ## Layout Behavior Notes - `absolute`: child `x`/`y` are used as-is. - `horizontal` / `vertical`: parser repositions children and can wrap by container `width`/`height` when provided and `scroll` is false. +- `gapX` controls horizontal spacing. `gapY` controls vertical spacing. Legacy `gap` is not supported. - Child nodes are parsed with the active parser plugin set. - `scrollbar.vertical` renders on top of the viewport edge. It syncs with wheel scrolling, thumb dragging, track clicks, and optional start/end buttons. @@ -136,7 +138,8 @@ elements: x: 120 y: 120 direction: vertical - gap: 10 + gapX: 10 + gapY: 10 children: - id: btn-start type: rect @@ -166,7 +169,8 @@ elements: width: 420 height: 560 direction: vertical - gap: 8 + gapX: 8 + gapY: 8 scroll: true children: - id: item-1 @@ -197,7 +201,8 @@ elements: width: 420 height: 560 direction: vertical - gap: 8 + gapX: 8 + gapY: 8 scroll: true scrollbar: vertical: diff --git a/playground/static/RouteGraphics.js b/playground/static/RouteGraphics.js index 998b1b66..a021f434 100644 --- a/playground/static/RouteGraphics.js +++ b/playground/static/RouteGraphics.js @@ -3,7 +3,7 @@ Deprecated since v${r}`):(i=i.split(` `).splice(t).join(` `),console.groupCollapsed?(console.groupCollapsed("%cPixiJS Deprecation Warning: %c%s","color:#614108;background:#fffbe6","font-weight:normal;color:#614108;background:#fffbe6",`${e} Deprecated since v${r}`),console.warn(i),console.groupEnd()):(console.warn("PixiJS Deprecation Warning: ",`${e} -Deprecated since v${r}`),console.warn(i))),tv[e]=!0}var tv,ie,rv,Xe=y(()=>{"use strict";tv={},ie="8.0.0",rv="8.3.4"});var ps,jp=y(()=>{"use strict";ps=class{constructor(e,t){this._pool=[],this._count=0,this._index=0,this._classType=e,t&&this.prepopulate(t)}prepopulate(e){for(let t=0;t0?t=this._pool[--this._index]:t=new this._classType,t.init?.(e),t}return(e){e.reset?.(),this._pool[this._index++]=e}get totalSize(){return this._count}get totalFree(){return this._index}get totalUsed(){return this._count-this._index}clear(){this._pool.length=0,this._index=0}}});var Yp,se,Gt=y(()=>{jp();Yp=class{constructor(){this._poolsByClass=new Map}prepopulate(e,t){this.getPool(e).prepopulate(t)}get(e,t){return this.getPool(e).get(t)}return(e){this.getPool(e.constructor).return(e)}getPool(e){return this._poolsByClass.has(e)||this._poolsByClass.set(e,new ps(e)),this._poolsByClass.get(e)}stats(){let e={};return this._poolsByClass.forEach(t=>{let i=e[t._classType.name]?t._classType.name+t._classType.ID:t._classType.name;e[i]={free:t.totalFree,used:t.totalUsed,size:t.totalSize}}),e}},se=new Yp});var iv,sv=y(()=>{Xe();iv={get isCachedAsTexture(){return!!this.renderGroup?.isCachedAsTexture},cacheAsTexture(r){typeof r=="boolean"&&r===!1?this.disableRenderGroup():(this.enableRenderGroup(),this.renderGroup.enableCacheAsTexture(r===!0?{}:r))},updateCacheTexture(){this.renderGroup?.updateCacheTexture()},get cacheAsBitmap(){return this.isCachedAsTexture},set cacheAsBitmap(r){X("v8.6.0","cacheAsBitmap is deprecated, use cacheAsTexture instead."),this.cacheAsTexture(r)}}});function Mu(r,e,t){let i=r.length,s;if(e>=i||t===0)return;t=e+t>i?i-e:t;let o=i-t;for(s=e;s{"use strict"});var ov,nv=y(()=>{qp();Xe();ov={allowChildren:!0,removeChildren(r=0,e){let t=e??this.children.length,i=t-r,s=[];if(i>0&&i<=t){for(let n=t-1;n>=r;n--){let a=this.children[n];a&&(s.push(a),a.parent=null)}Mu(this.children,r,t);let o=this.renderGroup||this.parentRenderGroup;o&&o.removeChildren(s);for(let n=0;n0&&this._didViewChangeTick++,s}else if(i===0&&this.children.length===0)return s;throw new RangeError("removeChildren: numeric values are outside the acceptable range.")},removeChildAt(r){let e=this.getChildAt(r);return this.removeChild(e)},getChildAt(r){if(r<0||r>=this.children.length)throw new Error(`getChildAt: Index (${r}) does not exist.`);return this.children[r]},setChildIndex(r,e){if(e<0||e>=this.children.length)throw new Error(`The index ${e} supplied is out of bounds ${this.children.length}`);this.getChildIndex(r),this.addChildAt(r,e)},getChildIndex(r){let e=this.children.indexOf(r);if(e===-1)throw new Error("The supplied Container must be a child of the caller");return e},addChildAt(r,e){this.allowChildren||X(ie,"addChildAt: Only Containers will be allowed to add children in v8.0.0");let{children:t}=this;if(e<0||e>t.length)throw new Error(`${r}addChildAt: The index ${e} supplied is out of bounds ${t.length}`);if(r.parent){let s=r.parent.children.indexOf(r);if(r.parent===this&&s===e)return r;s!==-1&&r.parent.children.splice(s,1)}e===t.length?t.push(r):t.splice(e,0,r),r.parent=this,r.didChange=!0,r._updateFlags=15;let i=this.renderGroup||this.parentRenderGroup;return i&&i.addChild(r),this.sortableChildren&&(this.sortDirty=!0),this.emit("childAdded",r,this,e),r.emit("added",this),r},swapChildren(r,e){if(r===e)return;let t=this.getChildIndex(r),i=this.getChildIndex(e);this.children[t]=e,this.children[i]=r;let s=this.renderGroup||this.parentRenderGroup;s&&(s.structureDidChange=!0),this._didContainerChangeTick++},removeFromParent(){this.parent?.removeChild(this)},reparentChild(...r){return r.length===1?this.reparentChildAt(r[0],this.children.length):(r.forEach(e=>this.reparentChildAt(e,this.children.length)),r[0])},reparentChildAt(r,e){if(r.parent===this)return this.setChildIndex(r,e),r;let t=r.worldTransform.clone();r.removeFromParent(),this.addChildAt(r,e);let i=this.worldTransform.clone();return i.invert(),t.prepend(i),r.setFromMatrix(t),r}}});var av,lv=y(()=>{"use strict";av={collectRenderables(r,e,t){this.parentRenderLayer&&this.parentRenderLayer!==t||this.globalDisplayStatus<7||!this.includeInBuild||(this.sortableChildren&&this.sortChildren(),this.isSimple?this.collectRenderablesSimple(r,e,t):this.renderGroup?e.renderPipes.renderGroup.addRenderGroup(this.renderGroup,r):this.collectRenderablesWithEffects(r,e,t))},collectRenderablesSimple(r,e,t){let i=this.children,s=i.length;for(let o=0;o=0;s--){let o=this.effects[s];i[o.pipe].pop(o,this,r)}}}});var hi,Ru=y(()=>{"use strict";hi=class{constructor(){this.pipe="filter",this.priority=1}destroy(){for(let e=0;e{U();Gt();Kp=class{constructor(){this._effectClasses=[],this._tests=[],this._initialized=!1}init(){this._initialized||(this._initialized=!0,this._effectClasses.forEach(e=>{this.add({test:e.test,maskClass:e})}))}add(e){this._tests.push(e)}getMaskEffect(e){this._initialized||this.init();for(let t=0;t{Ru();cv();uv={_maskEffect:null,_maskOptions:{inverse:!1},_filterEffect:null,effects:[],_markStructureAsChanged(){let r=this.renderGroup||this.parentRenderGroup;r&&(r.structureDidChange=!0)},addEffect(r){this.effects.indexOf(r)===-1&&(this.effects.push(r),this.effects.sort((t,i)=>t.priority-i.priority),this._markStructureAsChanged(),this._updateIsSimple())},removeEffect(r){let e=this.effects.indexOf(r);e!==-1&&(this.effects.splice(e,1),this._markStructureAsChanged(),this._updateIsSimple())},set mask(r){let e=this._maskEffect;e?.mask!==r&&(e&&(this.removeEffect(e),Iu.returnMaskEffect(e),this._maskEffect=null),r!=null&&(this._maskEffect=Iu.getMaskEffect(r),this.addEffect(this._maskEffect)))},setMask(r){this._maskOptions={...this._maskOptions,...r},r.mask&&(this.mask=r.mask),this._markStructureAsChanged()},get mask(){return this._maskEffect?.mask},set filters(r){!Array.isArray(r)&&r&&(r=[r]);let e=this._filterEffect||(this._filterEffect=new hi);r=r;let t=r?.length>0,i=e.filters?.length>0,s=t!==i;r=Array.isArray(r)?r.slice(0):r,e.filters=Object.freeze(r),s&&(t?this.addEffect(e):(this.removeEffect(e),e.filters=r??null))},get filters(){return this._filterEffect?.filters},set filterArea(r){this._filterEffect||(this._filterEffect=new hi),this._filterEffect.filterArea=r},get filterArea(){return this._filterEffect?.filterArea}}});var dv,fv=y(()=>{Xe();dv={label:null,get name(){return X(ie,"Container.name property has been removed, use Container.label instead"),this.label},set name(r){X(ie,"Container.name property has been removed, use Container.label instead"),this.label=r},getChildByName(r,e=!1){return this.getChildByLabel(r,e)},getChildByLabel(r,e=!1){let t=this.children;for(let i=0;i{fr();Bu=[new de,new de,new de,new de],Q=class r{constructor(e=0,t=0,i=0,s=0){this.type="rectangle",this.x=Number(e),this.y=Number(t),this.width=Number(i),this.height=Number(s)}get left(){return this.x}get right(){return this.x+this.width}get top(){return this.y}get bottom(){return this.y+this.height}isEmpty(){return this.left===this.right||this.top===this.bottom}static get EMPTY(){return new r(0,0,0,0)}clone(){return new r(this.x,this.y,this.width,this.height)}copyFromBounds(e){return this.x=e.minX,this.y=e.minY,this.width=e.maxX-e.minX,this.height=e.maxY-e.minY,this}copyFrom(e){return this.x=e.x,this.y=e.y,this.width=e.width,this.height=e.height,this}copyTo(e){return e.copyFrom(this),e}contains(e,t){return this.width<=0||this.height<=0?!1:e>=this.x&&e=this.y&&t=h&&e<=d&&t>=f&&t<=p&&!(e>m&&e_&&te.right?e.right:this.right)<=I)return!1;let C=this.ye.bottom?e.bottom:this.bottom)>C}let i=this.left,s=this.right,o=this.top,n=this.bottom;if(s<=i||n<=o)return!1;let a=Bu[0].set(e.left,e.top),l=Bu[1].set(e.left,e.bottom),c=Bu[2].set(e.right,e.top),u=Bu[3].set(e.right,e.bottom);if(c.x<=a.x||l.y<=a.y)return!1;let h=Math.sign(t.a*t.d-t.b*t.c);if(h===0||(t.apply(a,a),t.apply(l,l),t.apply(c,c),t.apply(u,u),Math.max(a.x,l.x,c.x,u.x)<=i||Math.min(a.x,l.x,c.x,u.x)>=s||Math.max(a.y,l.y,c.y,u.y)<=o||Math.min(a.y,l.y,c.y,u.y)>=n))return!1;let d=h*(l.y-a.y),f=h*(a.x-l.x),p=d*i+f*o,m=d*s+f*o,g=d*i+f*n,_=d*s+f*n;if(Math.max(p,m,g,_)<=d*a.x+f*a.y||Math.min(p,m,g,_)>=d*u.x+f*u.y)return!1;let v=h*(a.y-c.y),x=h*(c.x-a.x),T=v*i+x*o,b=v*s+x*o,w=v*i+x*n,E=v*s+x*n;return!(Math.max(T,b,w,E)<=v*a.x+x*a.y||Math.min(T,b,w,E)>=v*u.x+x*u.y)}pad(e=0,t=e){return this.x-=e,this.y-=t,this.width+=e*2,this.height+=t*2,this}fit(e){let t=Math.max(this.x,e.x),i=Math.min(this.x+this.width,e.x+e.width),s=Math.max(this.y,e.y),o=Math.min(this.y+this.height,e.y+e.height);return this.x=t,this.width=Math.max(i-t,0),this.y=s,this.height=Math.max(o-s,0),this}ceil(e=1,t=.001){let i=Math.ceil((this.x+this.width-t)*e)/e,s=Math.ceil((this.y+this.height-t)*e)/e;return this.x=Math.floor((this.x+t)*e)/e,this.y=Math.floor((this.y+t)*e)/e,this.width=i-this.x,this.height=s-this.y,this}enlarge(e){let t=Math.min(this.x,e.x),i=Math.max(this.x+this.width,e.x+e.width),s=Math.min(this.y,e.y),o=Math.max(this.y+this.height,e.y+e.height);return this.x=t,this.width=i-t,this.y=s,this.height=o-s,this}getBounds(e){return e||(e=new r),e.copyFrom(this),e}containsRect(e){if(this.width<=0||this.height<=0)return!1;let t=e.x,i=e.y,s=e.x+e.width,o=e.y+e.height;return t>=this.x&&t=this.y&&i=this.x&&s=this.y&&o{ge();ut();pv=new G,Ee=class r{constructor(e=1/0,t=1/0,i=-1/0,s=-1/0){this.minX=1/0,this.minY=1/0,this.maxX=-1/0,this.maxY=-1/0,this.matrix=pv,this.minX=e,this.minY=t,this.maxX=i,this.maxY=s}isEmpty(){return this.minX>this.maxX||this.minY>this.maxY}get rectangle(){this._rectangle||(this._rectangle=new Q);let e=this._rectangle;return this.minX>this.maxX||this.minY>this.maxY?(e.x=0,e.y=0,e.width=0,e.height=0):e.copyFromBounds(this),e}clear(){return this.minX=1/0,this.minY=1/0,this.maxX=-1/0,this.maxY=-1/0,this.matrix=pv,this}set(e,t,i,s){this.minX=e,this.minY=t,this.maxX=i,this.maxY=s}addFrame(e,t,i,s,o){o||(o=this.matrix);let n=o.a,a=o.b,l=o.c,c=o.d,u=o.tx,h=o.ty,d=this.minX,f=this.minY,p=this.maxX,m=this.maxY,g=n*e+l*t+u,_=a*e+c*t+h;gp&&(p=g),_>m&&(m=_),g=n*i+l*t+u,_=a*i+c*t+h,gp&&(p=g),_>m&&(m=_),g=n*e+l*s+u,_=a*e+c*s+h,gp&&(p=g),_>m&&(m=_),g=n*i+l*s+u,_=a*i+c*s+h,gp&&(p=g),_>m&&(m=_),this.minX=d,this.minY=f,this.maxX=p,this.maxY=m}addRect(e,t){this.addFrame(e.x,e.y,e.x+e.width,e.y+e.height,t)}addBounds(e,t){this.addFrame(e.minX,e.minY,e.maxX,e.maxY,t)}addBoundsMask(e){this.minX=this.minX>e.minX?this.minX:e.minX,this.minY=this.minY>e.minY?this.minY:e.minY,this.maxX=this.maxXthis.maxX?d:this.maxX,this.maxY=f>this.maxY?f:this.maxY,d=n*t+l*o+u,f=a*t+c*o+h,this.minX=dthis.maxX?d:this.maxX,this.maxY=f>this.maxY?f:this.maxY,d=n*s+l*o+u,f=a*s+c*o+h,this.minX=dthis.maxX?d:this.maxX,this.maxY=f>this.maxY?f:this.maxY}fit(e){return this.minXe.right&&(this.maxX=e.right),this.minYe.bottom&&(this.maxY=e.bottom),this}fitBounds(e,t,i,s){return this.minXt&&(this.maxX=t),this.minYs&&(this.maxY=s),this}pad(e,t=e){return this.minX-=e,this.maxX+=e,this.minY-=t,this.maxY+=t,this}ceil(){return this.minX=Math.floor(this.minX),this.minY=Math.floor(this.minY),this.maxX=Math.ceil(this.maxX),this.maxY=Math.ceil(this.maxY),this}clone(){return new r(this.minX,this.minY,this.maxX,this.maxY)}scale(e,t=e){return this.minX*=e,this.minY*=t,this.maxX*=e,this.maxY*=t,this}get x(){return this.minX}set x(e){let t=this.maxX-this.minX;this.minX=e,this.maxX=e+t}get y(){return this.minY}set y(e){let t=this.maxY-this.minY;this.minY=e,this.maxY=e+t}get width(){return this.maxX-this.minX}set width(e){this.maxX=this.minX+e}get height(){return this.maxY-this.minY}set height(e){this.maxY=this.minY+e}get left(){return this.minX}get right(){return this.maxX}get top(){return this.minY}get bottom(){return this.maxY}get isPositive(){return this.maxX-this.minX>0&&this.maxY-this.minY>0}get isValid(){return this.minX+this.minY!==1/0}addVertexData(e,t,i,s){let o=this.minX,n=this.minY,a=this.maxX,l=this.maxY;s||(s=this.matrix);let c=s.a,u=s.b,h=s.c,d=s.d,f=s.tx,p=s.ty;for(let m=t;ma?v:a,l=x>l?x:l}this.minX=o,this.minY=n,this.maxX=a,this.maxY=l}containsPoint(e,t){return this.minX<=e&&this.minY<=t&&this.maxX>=e&&this.maxY>=t}toString(){return`[pixi.js:Bounds minX=${this.minX} minY=${this.minY} maxX=${this.maxX} maxY=${this.maxY} width=${this.width} height=${this.height}]`}copyFrom(e){return this.minX=e.minX,this.minY=e.minY,this.maxX=e.maxX,this.maxY=e.maxY,this}}});var st,er,ms=y(()=>{ge();jp();$t();st=new ps(G),er=new ps(Ee)});var u2,mv,gv=y(()=>{ge();$t();ms();u2=new G,mv={getFastGlobalBounds(r,e){e||(e=new Ee),e.clear(),this._getGlobalBoundsRecursive(!!r,e,this.parentRenderLayer),e.isValid||e.set(0,0,0,0);let t=this.renderGroup||this.parentRenderGroup;return e.applyMatrix(t.worldTransform),e},_getGlobalBoundsRecursive(r,e,t){let i=e;if(r&&this.parentRenderLayer&&this.parentRenderLayer!==t||this.localDisplayStatus!==7||!this.measurable)return;let s=!!this.effects.length;if((this.renderGroup||s)&&(i=er.get().clear()),this.boundsArea)e.addRect(this.boundsArea,this.worldTransform);else{if(this.renderPipeId){let n=this.bounds;i.addFrame(n.minX,n.minY,n.maxX,n.maxY,this.groupTransform)}let o=this.children;for(let n=0;n{ge();ms()});function Fu(r,e){if(r===16777215||!e)return e;if(e===16777215||!r)return r;let t=r>>16&255,i=r>>8&255,s=r&255,o=e>>16&255,n=e>>8&255,a=e&255,l=t*o/255|0,c=i*n/255|0,u=s*a/255|0;return(l<<16)+(c<<8)+u}var Zp=y(()=>{"use strict"});function go(r,e){return r===yv?e:e===yv?r:Fu(r,e)}var yv,Qp=y(()=>{Zp();yv=16777215});function xa(r){return((r&255)<<16)+(r&65280)+(r>>16&255)}var _v,bv=y(()=>{ga();ms();Qp();_v={getGlobalAlpha(r){if(r)return this.renderGroup?this.renderGroup.worldAlpha:this.parentRenderGroup?this.parentRenderGroup.worldAlpha*this.alpha:this.alpha;let e=this.alpha,t=this.parent;for(;t;)e*=t.alpha,t=t.parent;return e},getGlobalTransform(r,e){if(e)return r.copyFrom(this.worldTransform);this.updateLocalTransform();let t=ku(this,st.get().identity());return r.appendFrom(this.localTransform,t),st.return(t),r},getGlobalTint(r){if(r)return this.renderGroup?xa(this.renderGroup.worldColor):this.parentRenderGroup?xa(go(this.localColor,this.parentRenderGroup.worldColor)):this.tint;let e=this.localColor,t=this.parent;for(;t;)e=go(e,t.localColor),t=t.parent;return xa(e)}}});function W(...r){Jp!==vv&&(Jp++,Jp===vv?console.warn("PixiJS Warning: too many warnings, no more warnings will be reported to the console by PixiJS."):console.warn("PixiJS Warning: ",...r))}var Jp,vv,Ae=y(()=>{"use strict";Jp=0,vv=500});function xo(r,e,t){return e.clear(),t||(t=G.IDENTITY),Tv(r,e,t,r,!0),e.isValid||e.set(0,0,0,0),e}function Tv(r,e,t,i,s){let o;if(s)o=st.get(),o=t.copyTo(o);else{if(!r.visible||!r.measurable)return;r.updateLocalTransform();let l=r.localTransform;o=st.get(),o.appendFrom(l,t)}let n=e,a=!!r.effects.length;if(a&&(e=er.get().clear()),r.boundsArea)e.addRect(r.boundsArea,o);else{r.renderPipeId&&(e.matrix=o,e.addBounds(r.bounds));let l=r.children;for(let c=0;c{ge();ms()});function em(r,e){let t=r.children;for(let i=0;i{"use strict"});var h2,wv,Ev=y(()=>{ge();$t();ga();Ou();Sv();h2=new G,wv={_localBoundsCacheId:-1,_localBoundsCacheData:null,_setWidth(r,e){let t=Math.sign(this.scale.x)||1;e!==0?this.scale.x=r/e*t:this.scale.x=t},_setHeight(r,e){let t=Math.sign(this.scale.y)||1;e!==0?this.scale.y=r/e*t:this.scale.y=t},getLocalBounds(){this._localBoundsCacheData||(this._localBoundsCacheData={data:[],index:1,didChange:!1,localBounds:new Ee});let r=this._localBoundsCacheData;return r.index=1,r.didChange=!1,r.data[0]!==this._didViewChangeTick&&(r.didChange=!0,r.data[0]=this._didViewChangeTick),em(this,r),r.didChange&&xo(this,r.localBounds,h2),r.localBounds},getBounds(r,e){return mo(this,r,e||new Ee)}}});var Av,Pv=y(()=>{"use strict";Av={_onRender:null,set onRender(r){let e=this.renderGroup||this.parentRenderGroup;if(!r){this._onRender&&e?.removeOnRender(this),this._onRender=null;return}this._onRender||e?.addOnRender(this),this._onRender=r},get onRender(){return this._onRender}}});function d2(r,e){return r._zIndex-e._zIndex}var Cv,Mv=y(()=>{"use strict";Cv={_zIndex:0,sortDirty:!1,sortableChildren:!1,get zIndex(){return this._zIndex},set zIndex(r){this._zIndex!==r&&(this._zIndex=r,this.depthOfChildModified())},depthOfChildModified(){this.parent&&(this.parent.sortableChildren=!0,this.parent.sortDirty=!0),this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=!0)},sortChildren(){this.sortDirty&&(this.sortDirty=!1,this.children.sort(d2))}}});var Rv,Iv=y(()=>{fr();ms();Rv={getGlobalPosition(r=new de,e=!1){return this.parent?this.parent.toGlobal(this._position,r,e):(r.x=this._position.x,r.y=this._position.y),r},toGlobal(r,e,t=!1){let i=this.getGlobalTransform(st.get(),t);return e=i.apply(r,e),st.return(i),e},toLocal(r,e,t,i){e&&(r=e.toGlobal(r,t,i));let s=this.getGlobalTransform(st.get(),i);return t=s.applyInverse(r,t),st.return(s),t}}});var yo,tm=y(()=>{wt();yo=class{constructor(){this.uid=he("instructionSet"),this.instructions=[],this.instructionSize=0,this.renderables=[],this.gcTick=0}reset(){this.instructionSize=0}add(e){this.instructions[this.instructionSize++]=e}log(){this.instructions.length=this.instructionSize,console.table(this.instructions,["type","action"])}}});function di(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 rm(r){return!(r&r-1)&&!!r}var ya=y(()=>{"use strict"});function Uu(r){let e={};for(let t in r)r[t]!==void 0&&(e[t]=r[t]);return e}var im=y(()=>{"use strict"});function f2(r){let e=Bv[r];return e===void 0&&(Bv[r]=he("resource")),e}var Bv,kv,Gu,sm=y(()=>{Mt();wt();Xe();Bv=Object.create(null);kv=class Fv extends Ce{constructor(e={}){super(),this._resourceType="textureSampler",this._touched=0,this._maxAnisotropy=1,this.destroyed=!1,e={...Fv.defaultOptions,...e},this.addressMode=e.addressMode,this.addressModeU=e.addressModeU??this.addressModeU,this.addressModeV=e.addressModeV??this.addressModeV,this.addressModeW=e.addressModeW??this.addressModeW,this.scaleMode=e.scaleMode,this.magFilter=e.magFilter??this.magFilter,this.minFilter=e.minFilter??this.minFilter,this.mipmapFilter=e.mipmapFilter??this.mipmapFilter,this.lodMinClamp=e.lodMinClamp,this.lodMaxClamp=e.lodMaxClamp,this.compare=e.compare,this.maxAnisotropy=e.maxAnisotropy??1}set addressMode(e){this.addressModeU=e,this.addressModeV=e,this.addressModeW=e}get addressMode(){return this.addressModeU}set wrapMode(e){X(ie,"TextureStyle.wrapMode is now TextureStyle.addressMode"),this.addressMode=e}get wrapMode(){return this.addressMode}set scaleMode(e){this.magFilter=e,this.minFilter=e,this.mipmapFilter=e}get scaleMode(){return this.magFilter}set maxAnisotropy(e){this._maxAnisotropy=Math.min(e,16),this._maxAnisotropy>1&&(this.scaleMode="linear")}get maxAnisotropy(){return this._maxAnisotropy}get _resourceId(){return this._sharedResourceId||this._generateResourceId()}update(){this.emit("change",this),this._sharedResourceId=null}_generateResourceId(){let e=`${this.addressModeU}-${this.addressModeV}-${this.addressModeW}-${this.magFilter}-${this.minFilter}-${this.mipmapFilter}-${this.lodMinClamp}-${this.lodMaxClamp}-${this.compare}-${this._maxAnisotropy}`;return this._sharedResourceId=f2(e),this._resourceId}destroy(){this.destroyed=!0,this.emit("destroy",this),this.emit("change",this),this.removeAllListeners()}};kv.defaultOptions={addressMode:"clamp-to-edge",scaleMode:"linear"};Gu=kv});var Ov,we,Xt=y(()=>{Mt();ya();im();wt();sm();Ov=class Uv extends Ce{constructor(e={}){super(),this.options=e,this.uid=he("textureSource"),this._resourceType="textureSource",this._resourceId=he("resource"),this.uploadMethodId="unknown",this._resolution=1,this.pixelWidth=1,this.pixelHeight=1,this.width=1,this.height=1,this.sampleCount=1,this.mipLevelCount=1,this.autoGenerateMipmaps=!1,this.format="rgba8unorm",this.dimension="2d",this.antialias=!1,this._touched=0,this._batchTick=-1,this._textureBindLocation=-1,e={...Uv.defaultOptions,...e},this.label=e.label??"",this.resource=e.resource,this.autoGarbageCollect=e.autoGarbageCollect,this._resolution=e.resolution,e.width?this.pixelWidth=e.width*this._resolution:this.pixelWidth=this.resource?this.resourceWidth??1:1,e.height?this.pixelHeight=e.height*this._resolution:this.pixelHeight=this.resource?this.resourceHeight??1:1,this.width=this.pixelWidth/this._resolution,this.height=this.pixelHeight/this._resolution,this.format=e.format,this.dimension=e.dimensions,this.mipLevelCount=e.mipLevelCount,this.autoGenerateMipmaps=e.autoGenerateMipmaps,this.sampleCount=e.sampleCount,this.antialias=e.antialias,this.alphaMode=e.alphaMode,this.style=new Gu(Uu(e)),this.destroyed=!1,this._refreshPOT()}get source(){return this}get style(){return this._style}set style(e){this.style!==e&&(this._style?.off("change",this._onStyleChange,this),this._style=e,this._style?.on("change",this._onStyleChange,this),this._onStyleChange())}get addressMode(){return this._style.addressMode}set addressMode(e){this._style.addressMode=e}get repeatMode(){return this._style.addressMode}set repeatMode(e){this._style.addressMode=e}get magFilter(){return this._style.magFilter}set magFilter(e){this._style.magFilter=e}get minFilter(){return this._style.minFilter}set minFilter(e){this._style.minFilter=e}get mipmapFilter(){return this._style.mipmapFilter}set mipmapFilter(e){this._style.mipmapFilter=e}get lodMinClamp(){return this._style.lodMinClamp}set lodMinClamp(e){this._style.lodMinClamp=e}get lodMaxClamp(){return this._style.lodMaxClamp}set lodMaxClamp(e){this._style.lodMaxClamp=e}_onStyleChange(){this.emit("styleChange",this)}update(){if(this.resource){let e=this._resolution;if(this.resize(this.resourceWidth/e,this.resourceHeight/e))return}this.emit("update",this)}destroy(){this.destroyed=!0,this.emit("destroy",this),this.emit("change",this),this._style&&(this._style.destroy(),this._style=null),this.uploadMethodId=null,this.resource=null,this.removeAllListeners()}unload(){this._resourceId=he("resource"),this.emit("change",this),this.emit("unload",this)}get resourceWidth(){let{resource:e}=this;return e.naturalWidth||e.videoWidth||e.displayWidth||e.width}get resourceHeight(){let{resource:e}=this;return e.naturalHeight||e.videoHeight||e.displayHeight||e.height}get resolution(){return this._resolution}set resolution(e){this._resolution!==e&&(this._resolution=e,this.width=this.pixelWidth/e,this.height=this.pixelHeight/e)}resize(e,t,i){i||(i=this._resolution),e||(e=this.width),t||(t=this.height);let s=Math.round(e*i),o=Math.round(t*i);return this.width=s/i,this.height=o/i,this._resolution=i,this.pixelWidth===s&&this.pixelHeight===o?!1:(this._refreshPOT(),this.pixelWidth=s,this.pixelHeight=o,this.emit("resize",this),this._resourceId=he("resource"),this.emit("change",this),!0)}updateMipmaps(){this.autoGenerateMipmaps&&this.mipLevelCount>1&&this.emit("updateMipmaps",this)}set wrapMode(e){this._style.wrapMode=e}get wrapMode(){return this._style.wrapMode}set scaleMode(e){this._style.scaleMode=e}get scaleMode(){return this._style.scaleMode}_refreshPOT(){this.isPowerOfTwo=rm(this.pixelWidth)&&rm(this.pixelHeight)}static test(e){throw new Error("Unimplemented")}};Ov.defaultOptions={resolution:1,format:"bgra8unorm",alphaMode:"premultiply-alpha-on-upload",dimensions:"2d",mipLevelCount:1,autoGenerateMipmaps:!1,sampleCount:1,antialias:!1,autoGarbageCollect:!1};we=Ov});function p2(){for(let r=0;r<16;r++){let e=[];om.push(e);for(let t=0;t<16;t++){let i=Lu(gs[r]*gs[t]+ys[r]*xs[t]),s=Lu(xs[r]*gs[t]+_s[r]*xs[t]),o=Lu(gs[r]*ys[t]+ys[r]*_s[t]),n=Lu(xs[r]*ys[t]+_s[r]*_s[t]);for(let a=0;a<16;a++)if(gs[a]===i&&xs[a]===s&&ys[a]===o&&_s[a]===n){e.push(a);break}}}for(let r=0;r<16;r++){let e=new G;e.set(gs[r],xs[r],ys[r],_s[r],0,0),Gv.push(e)}}var gs,xs,ys,_s,om,Gv,Lu,He,Lv=y(()=>{ge();gs=[1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1,0,1],xs=[0,1,1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1],ys=[0,-1,-1,-1,0,1,1,1,0,1,1,1,0,-1,-1,-1],_s=[1,1,0,-1,-1,-1,0,1,-1,-1,0,1,1,1,0,-1],om=[],Gv=[],Lu=Math.sign;p2();He={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=>gs[r],uY:r=>xs[r],vX:r=>ys[r],vY:r=>_s[r],inv:r=>r&8?r&15:-r&7,add:(r,e)=>om[r][e],sub:(r,e)=>om[r][He.inv(e)],rotate180:r=>r^4,isVertical:r=>(r&3)===2,byDirection:(r,e)=>Math.abs(r)*2<=Math.abs(e)?e>=0?He.S:He.N:Math.abs(e)*2<=Math.abs(r)?r>0?He.E:He.W:e>0?r>0?He.SE:He.SW:r>0?He.NE:He.NW,matrixAppendRotationInv:(r,e,t=0,i=0)=>{let s=Gv[He.inv(e)];s.tx=t,s.ty=i,r.append(s)}}});var nm,Dv=y(()=>{"use strict";nm=()=>{}});var bs,am=y(()=>{U();Xt();bs=class extends we{constructor(e){let t=e.resource||new Float32Array(e.width*e.height*4),i=e.format;i||(t instanceof Float32Array?i="rgba32float":t instanceof Int32Array||t instanceof Uint32Array?i="rgba32uint":t instanceof Int16Array||t instanceof Uint16Array?i="rgba16uint":(t instanceof Int8Array,i="bgra8unorm")),super({...e,resource:t,format:i}),this.uploadMethodId="buffer"}static test(e){return e instanceof Int8Array||e instanceof Uint8Array||e instanceof Uint8ClampedArray||e instanceof Int16Array||e instanceof Uint16Array||e instanceof Int32Array||e instanceof Uint32Array||e instanceof Float32Array}};bs.extension=S.TextureSource});var Nv,_o,lm=y(()=>{ge();Nv=new G,_o=class{constructor(e,t){this.mapCoord=new G,this.uClampFrame=new Float32Array(4),this.uClampOffset=new Float32Array(2),this._textureID=-1,this._updateID=0,this.clampOffset=0,typeof t>"u"?this.clampMargin=e.width<10?0:.5:this.clampMargin=t,this.isSimple=!1,this.texture=e}get texture(){return this._texture}set texture(e){this.texture!==e&&(this._texture?.removeListener("update",this.update,this),this._texture=e,this._texture.addListener("update",this.update,this),this.update())}multiplyUvs(e,t){t===void 0&&(t=e);let i=this.mapCoord;for(let s=0;s{Mt();Lv();ut();wt();Xe();Dv();am();Xt();lm();k=class extends Ce{constructor({source:e,label:t,frame:i,orig:s,trim:o,defaultAnchor:n,defaultBorders:a,rotate:l,dynamic:c}={}){if(super(),this.uid=he("texture"),this.uvs={x0:0,y0:0,x1:0,y1:0,x2:0,y2:0,x3:0,y3:0},this.frame=new Q,this.noFrame=!1,this.dynamic=!1,this.isTexture=!0,this.label=t,this.source=e?.source??new we,this.noFrame=!i,i)this.frame.copyFrom(i);else{let{width:u,height:h}=this._source;this.frame.width=u,this.frame.height=h}this.orig=s||this.frame,this.trim=o,this.rotate=l??0,this.defaultAnchor=n,this.defaultBorders=a,this.destroyed=!1,this.dynamic=c||!1,this.updateUvs()}set source(e){this._source&&this._source.off("resize",this.update,this),this._source=e,e.on("resize",this.update,this),this.emit("update",this)}get source(){return this._source}get textureMatrix(){return this._textureMatrix||(this._textureMatrix=new _o(this)),this._textureMatrix}get width(){return this.orig.width}get height(){return this.orig.height}updateUvs(){let{uvs:e,frame:t}=this,{width:i,height:s}=this._source,o=t.x/i,n=t.y/s,a=t.width/i,l=t.height/s,c=this.rotate;if(c){let u=a/2,h=l/2,d=o+u,f=n+h;c=He.add(c,He.NW),e.x0=d+u*He.uX(c),e.y0=f+h*He.uY(c),c=He.add(c,2),e.x1=d+u*He.uX(c),e.y1=f+h*He.uY(c),c=He.add(c,2),e.x2=d+u*He.uX(c),e.y2=f+h*He.uY(c),c=He.add(c,2),e.x3=d+u*He.uX(c),e.y3=f+h*He.uY(c)}else e.x0=o,e.y0=n,e.x1=o+a,e.y1=n,e.x2=o+a,e.y2=n+l,e.x3=o,e.y3=n+l}destroy(e=!1){this._source&&e&&(this._source.destroy(),this._source=null),this._textureMatrix=null,this.destroyed=!0,this.emit("destroy",this),this.removeAllListeners()}update(){this.noFrame&&(this.frame.width=this._source.width,this.frame.height=this._source.height),this.updateUvs(),this.emit("update",this)}get baseTexture(){return X(ie,"Texture.baseTexture is now Texture.source"),this._source}};k.EMPTY=new k({label:"EMPTY",source:new we({label:"EMPTY"})});k.EMPTY.destroy=nm;k.WHITE=new k({source:new bs({resource:new Uint8Array([255,255,255,255]),width:1,height:1,alphaMode:"premultiply-alpha-on-upload",label:"WHITE"}),label:"WHITE"});k.WHITE.destroy=nm});var m2,cm,je,Oi=y(()=>{ya();Xt();ve();m2=0,cm=class{constructor(e){this._poolKeyHash=Object.create(null),this._texturePool={},this.textureOptions=e||{},this.enableFullScreen=!1}createTexture(e,t,i){let s=new we({...this.textureOptions,width:e,height:t,resolution:1,antialias:i,autoGarbageCollect:!1});return new k({source:s,label:`texturePool_${m2++}`})}getOptimalTexture(e,t,i=1,s){let o=Math.ceil(e*i-1e-6),n=Math.ceil(t*i-1e-6);o=di(o),n=di(n);let a=(o<<17)+(n<<1)+(s?1:0);this._texturePool[a]||(this._texturePool[a]=[]);let l=this._texturePool[a].pop();return l||(l=this.createTexture(o,n,s)),l.source._resolution=i,l.source.width=o/i,l.source.height=n/i,l.source.pixelWidth=o,l.source.pixelHeight=n,l.frame.x=0,l.frame.y=0,l.frame.width=e,l.frame.height=t,l.updateUvs(),this._poolKeyHash[l.uid]=a,l}getSameSizeTexture(e,t=!1){let i=e.source;return this.getOptimalTexture(e.width,e.height,i._resolution,t)}returnTexture(e){let t=this._poolKeyHash[e.uid];this._texturePool[t].push(e)}clear(e){if(e=e!==!1,e)for(let t in this._texturePool){let i=this._texturePool[t];if(i)for(let s=0;s{ge();tm();Oi();Du=class{constructor(){this.renderPipeId="renderGroup",this.root=null,this.canBundle=!1,this.renderGroupParent=null,this.renderGroupChildren=[],this.worldTransform=new G,this.worldColorAlpha=4294967295,this.worldColor=16777215,this.worldAlpha=1,this.childrenToUpdate=Object.create(null),this.updateTick=0,this.gcTick=0,this.childrenRenderablesToUpdate={list:[],index:0},this.structureDidChange=!0,this.instructionSet=new yo,this._onRenderContainers=[],this.textureNeedsUpdate=!0,this.isCachedAsTexture=!1,this._matrixDirty=7}init(e){this.root=e,e._onRender&&this.addOnRender(e),e.didChange=!0;let t=e.children;for(let i=0;i-1&&this.renderGroupChildren.splice(t,1),e.renderGroupParent=null}addChild(e){if(this.structureDidChange=!0,e.parentRenderGroup=this,e.updateTick=-1,e.parent===this.root?e.relativeRenderGroupDepth=1:e.relativeRenderGroupDepth=e.parent.relativeRenderGroupDepth+1,e.didChange=!0,this.onChildUpdate(e),e.renderGroup){this.addRenderGroupChild(e.renderGroup);return}e._onRender&&this.addOnRender(e);let t=e.children;for(let i=0;i0}addOnRender(e){this._onRenderContainers.push(e)}removeOnRender(e){this._onRenderContainers.splice(this._onRenderContainers.indexOf(e),1)}runOnRender(e){for(let t=0;t{"use strict"});var um,hm,dm,bo,_a,vs,te,Pr=y(()=>{Mt();Tt();Zb();U();ge();zp();Cu();wt();Xe();Gt();sv();nv();lv();hv();fv();gv();bv();Ev();Pv();Mv();Iv();Hv();Wv();um=new St(null),hm=new St(null),dm=new St(null,1,1),bo=1,_a=2,vs=4,te=class r extends Ce{constructor(e={}){super(),this.uid=he("renderable"),this._updateFlags=15,this.renderGroup=null,this.parentRenderGroup=null,this.parentRenderGroupIndex=0,this.didChange=!1,this.didViewUpdate=!1,this.relativeRenderGroupDepth=0,this.children=[],this.parent=null,this.includeInBuild=!0,this.measurable=!0,this.isSimple=!0,this.updateTick=-1,this.localTransform=new G,this.relativeGroupTransform=new G,this.groupTransform=this.relativeGroupTransform,this.destroyed=!1,this._position=new St(this,0,0),this._scale=dm,this._pivot=hm,this._skew=um,this._cx=1,this._sx=0,this._cy=0,this._sy=1,this._rotation=0,this.localColor=16777215,this.localAlpha=1,this.groupAlpha=1,this.groupColor=16777215,this.groupColorAlpha=4294967295,this.localBlendMode="inherit",this.groupBlendMode="normal",this.localDisplayStatus=7,this.globalDisplayStatus=7,this._didContainerChangeTick=0,this._didViewChangeTick=0,this._didLocalTransformChangeId=-1,this.effects=[],Vv(this,e,{children:!0,parent:!0,effects:!0}),e.children?.forEach(t=>this.addChild(t)),e.parent?.addChild(this)}static mixin(e){X("8.8.0","Container.mixin is deprecated, please use extensions.mixin instead."),V.mixin(r,e)}set _didChangeId(e){this._didViewChangeTick=e>>12&4095,this._didContainerChangeTick=e&4095}get _didChangeId(){return this._didContainerChangeTick&4095|(this._didViewChangeTick&4095)<<12}addChild(...e){if(this.allowChildren||X(ie,"addChild: Only Containers will be allowed to add children in v8.0.0"),e.length>1){for(let s=0;s1){for(let s=0;s-1&&(this._didViewChangeTick++,this.children.splice(i,1),this.renderGroup?this.renderGroup.removeChild(t):this.parentRenderGroup&&this.parentRenderGroup.removeChild(t),t.parentRenderLayer&&t.parentRenderLayer.detach(t),t.parent=null,this.emit("childRemoved",t,this,i),t.emit("removed",this)),t}_onUpdate(e){e&&e===this._skew&&this._updateSkew(),this._didContainerChangeTick++,!this.didChange&&(this.didChange=!0,this.parentRenderGroup&&this.parentRenderGroup.onChildUpdate(this))}set isRenderGroup(e){!!this.renderGroup!==e&&(e?this.enableRenderGroup():this.disableRenderGroup())}get isRenderGroup(){return!!this.renderGroup}enableRenderGroup(){if(this.renderGroup)return;let e=this.parentRenderGroup;e?.removeChild(this),this.renderGroup=se.get(Du,this),this.groupTransform=G.IDENTITY,e?.addChild(this),this._updateIsSimple()}disableRenderGroup(){if(!this.renderGroup)return;let e=this.parentRenderGroup;e?.removeChild(this),se.return(this.renderGroup),this.renderGroup=null,this.groupTransform=this.relativeGroupTransform,e?.addChild(this),this._updateIsSimple()}_updateIsSimple(){this.isSimple=!this.renderGroup&&this.effects.length===0}get worldTransform(){return this._worldTransform||(this._worldTransform=new G),this.renderGroup?this._worldTransform.copyFrom(this.renderGroup.worldTransform):this.parentRenderGroup&&this._worldTransform.appendFrom(this.relativeGroupTransform,this.parentRenderGroup.worldTransform),this._worldTransform}get x(){return this._position.x}set x(e){this._position.x=e}get y(){return this._position.y}set y(e){this._position.y=e}get position(){return this._position}set position(e){this._position.copyFrom(e)}get rotation(){return this._rotation}set rotation(e){this._rotation!==e&&(this._rotation=e,this._onUpdate(this._skew))}get angle(){return this.rotation*Jb}set angle(e){this.rotation=e*ev}get pivot(){return this._pivot===hm&&(this._pivot=new St(this,0,0)),this._pivot}set pivot(e){this._pivot===hm&&(this._pivot=new St(this,0,0)),typeof e=="number"?this._pivot.set(e):this._pivot.copyFrom(e)}get skew(){return this._skew===um&&(this._skew=new St(this,0,0)),this._skew}set skew(e){this._skew===um&&(this._skew=new St(this,0,0)),this._skew.copyFrom(e)}get scale(){return this._scale===dm&&(this._scale=new St(this,1,1)),this._scale}set scale(e){this._scale===dm&&(this._scale=new St(this,0,0)),typeof e=="number"?this._scale.set(e):this._scale.copyFrom(e)}get width(){return Math.abs(this.scale.x*this.getLocalBounds().width)}set width(e){let t=this.getLocalBounds().width;this._setWidth(e,t)}get height(){return Math.abs(this.scale.y*this.getLocalBounds().height)}set height(e){let t=this.getLocalBounds().height;this._setHeight(e,t)}getSize(e){e||(e={});let t=this.getLocalBounds();return e.width=Math.abs(this.scale.x*t.width),e.height=Math.abs(this.scale.y*t.height),e}setSize(e,t){let i=this.getLocalBounds();typeof e=="object"?(t=e.height??e.width,e=e.width):t??(t=e),e!==void 0&&this._setWidth(e,i.width),t!==void 0&&this._setHeight(t,i.height)}_updateSkew(){let e=this._rotation,t=this._skew;this._cx=Math.cos(e+t._y),this._sx=Math.sin(e+t._y),this._cy=-Math.sin(e-t._x),this._sy=Math.cos(e-t._x)}updateTransform(e){return this.position.set(typeof e.x=="number"?e.x:this.position.x,typeof e.y=="number"?e.y:this.position.y),this.scale.set(typeof e.scaleX=="number"?e.scaleX||1:this.scale.x,typeof e.scaleY=="number"?e.scaleY||1:this.scale.y),this.rotation=typeof e.rotation=="number"?e.rotation:this.rotation,this.skew.set(typeof e.skewX=="number"?e.skewX:this.skew.x,typeof e.skewY=="number"?e.skewY:this.skew.y),this.pivot.set(typeof e.pivotX=="number"?e.pivotX:this.pivot.x,typeof e.pivotY=="number"?e.pivotY:this.pivot.y),this}setFromMatrix(e){e.decompose(this)}updateLocalTransform(){let e=this._didContainerChangeTick;if(this._didLocalTransformChangeId===e)return;this._didLocalTransformChangeId=e;let t=this.localTransform,i=this._scale,s=this._pivot,o=this._position,n=i._x,a=i._y,l=s._x,c=s._y;t.a=this._cx*n,t.b=this._sx*n,t.c=this._cy*a,t.d=this._sy*a,t.tx=o._x-(l*t.a+c*t.c),t.ty=o._y-(l*t.b+c*t.d)}set alpha(e){e!==this.localAlpha&&(this.localAlpha=e,this._updateFlags|=bo,this._onUpdate())}get alpha(){return this.localAlpha}set tint(e){let i=oe.shared.setValue(e??16777215).toBgrNumber();i!==this.localColor&&(this.localColor=i,this._updateFlags|=bo,this._onUpdate())}get tint(){return xa(this.localColor)}set blendMode(e){this.localBlendMode!==e&&(this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=!0),this._updateFlags|=_a,this.localBlendMode=e,this._onUpdate())}get blendMode(){return this.localBlendMode}get visible(){return!!(this.localDisplayStatus&2)}set visible(e){let t=e?2:0;(this.localDisplayStatus&2)!==t&&(this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=!0),this._updateFlags|=vs,this.localDisplayStatus^=2,this._onUpdate())}get culled(){return!(this.localDisplayStatus&4)}set culled(e){let t=e?0:4;(this.localDisplayStatus&4)!==t&&(this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=!0),this._updateFlags|=vs,this.localDisplayStatus^=4,this._onUpdate())}get renderable(){return!!(this.localDisplayStatus&1)}set renderable(e){let t=e?1:0;(this.localDisplayStatus&1)!==t&&(this._updateFlags|=vs,this.localDisplayStatus^=1,this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=!0),this._onUpdate())}get isRenderable(){return this.localDisplayStatus===7&&this.groupAlpha>0}destroy(e=!1){if(this.destroyed)return;this.destroyed=!0;let t;if(this.children.length&&(t=this.removeChildren(0,this.children.length)),this.removeFromParent(),this.parent=null,this._maskEffect=null,this._filterEffect=null,this.effects=null,this._position=null,this._scale=null,this._pivot=null,this._skew=null,this.emit("destroyed",this),this.removeAllListeners(),(typeof e=="boolean"?e:e?.children)&&t)for(let s=0;s{fr();Ui=class r{constructor(e){this.bubbles=!0,this.cancelBubble=!0,this.cancelable=!1,this.composed=!1,this.defaultPrevented=!1,this.eventPhase=r.prototype.NONE,this.propagationStopped=!1,this.propagationImmediatelyStopped=!1,this.layer=new de,this.page=new de,this.NONE=0,this.CAPTURING_PHASE=1,this.AT_TARGET=2,this.BUBBLING_PHASE=3,this.manager=e}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(e,t,i){throw new Error("initEvent() is a legacy DOM API. It is not implemented in the Federated Events API.")}initUIEvent(e,t,i,s,o){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}}});function g2(r){return function(e){return e.test(r)}}function Gi(r){var e={userAgent:"",platform:"",maxTouchPoints:0};!r&&typeof navigator<"u"?e={userAgent:navigator.userAgent,platform:navigator.platform,maxTouchPoints:navigator.maxTouchPoints||0}:typeof r=="string"?e.userAgent=r:r&&r.userAgent&&(e={userAgent:r.userAgent,platform:r.platform,maxTouchPoints:r.maxTouchPoints||0});var t=e.userAgent,i=t.split("[FBAN");typeof i[1]<"u"&&(t=i[0]),i=t.split("Twitter"),typeof i[1]<"u"&&(t=i[0]);var s=g2(t),o={apple:{phone:s(fm)&&!s(fi),ipod:s(zv),tablet:!s(fm)&&(s($v)||e0(e))&&!s(fi),universal:s(Xv),device:(s(fm)||s(zv)||s($v)||s(Xv)||e0(e))&&!s(fi)},amazon:{phone:s(vo),tablet:!s(vo)&&s(Hu),device:s(vo)||s(Hu)},android:{phone:!s(fi)&&s(vo)||!s(fi)&&s(pm),tablet:!s(fi)&&!s(vo)&&!s(pm)&&(s(Hu)||s(jv)),device:!s(fi)&&(s(vo)||s(Hu)||s(pm)||s(jv))||s(/\bokhttp\b/i)},windows:{phone:s(fi),tablet:s(Yv),device:s(fi)||s(Yv)},other:{blackberry:s(qv),blackberry10:s(Kv),opera:s(Zv),firefox:s(Jv),chrome:s(Qv),device:s(qv)||s(Kv)||s(Zv)||s(Jv)||s(Qv)},any:!1,phone:!1,tablet:!1};return o.any=o.apple.device||o.android.device||o.windows.device||o.other.device,o.phone=o.apple.phone||o.android.phone||o.windows.phone,o.tablet=o.apple.tablet||o.android.tablet||o.windows.tablet,o}var fm,zv,$v,Xv,pm,jv,vo,Hu,fi,Yv,qv,Kv,Zv,Qv,Jv,e0,mm=y(()=>{fm=/iPhone/i,zv=/iPod/i,$v=/iPad/i,Xv=/\biOS-universal(?:.+)Mac\b/i,pm=/\bAndroid(?:.+)Mobile\b/i,jv=/Android/i,vo=/(?:SD4930UR|\bSilk(?:.+)Mobile\b)/i,Hu=/Silk/i,fi=/Windows Phone/i,Yv=/\bWindows(?:.+)ARM\b/i,qv=/BlackBerry/i,Kv=/BB10/i,Zv=/Opera Mini/i,Qv=/\b(CriOS|Chrome)(?:.+)Mobile/i,Jv=/Mobile(?:.+)Firefox\b/i,e0=function(r){return typeof r<"u"&&r.platform==="MacIntel"&&typeof r.maxTouchPoints=="number"&&r.maxTouchPoints>1&&typeof MSStream>"u"}});var gm=y(()=>{mm();mm()});var x2,t0,r0=y(()=>{gm();x2=Gi.default??Gi,t0=x2(globalThis.navigator)});var y2,Vu,_2,b2,i0,s0,v2,T2,S2,xm,n0,a0=y(()=>{Nu();U();r0();qp();y2=9,Vu=100,_2=0,b2=0,i0=2,s0=1,v2=-1e3,T2=-1e3,S2=2,xm=class o0{constructor(e,t=t0){this._mobileInfo=t,this.debug=!1,this._activateOnTab=!0,this._deactivateOnMouseMove=!0,this._isActive=!1,this._isMobileAccessibility=!1,this._div=null,this._pool=[],this._renderId=0,this._children=[],this._androidUpdateCount=0,this._androidUpdateFrequency=500,this._hookDiv=null,(t.tablet||t.phone)&&this._createTouchHook(),this._renderer=e}get isActive(){return this._isActive}get isMobileAccessibility(){return this._isMobileAccessibility}get hookDiv(){return this._hookDiv}_createTouchHook(){let e=document.createElement("button");e.style.width=`${s0}px`,e.style.height=`${s0}px`,e.style.position="absolute",e.style.top=`${v2}px`,e.style.left=`${T2}px`,e.style.zIndex=S2.toString(),e.style.backgroundColor="#FF0000",e.title="select to enable accessibility for this content",e.addEventListener("focus",()=>{this._isMobileAccessibility=!0,this._activate(),this._destroyTouchHook()}),document.body.appendChild(e),this._hookDiv=e}_destroyTouchHook(){this._hookDiv&&(document.body.removeChild(this._hookDiv),this._hookDiv=null)}_activate(){if(this._isActive)return;this._isActive=!0,this._div||(this._div=document.createElement("div"),this._div.style.width=`${Vu}px`,this._div.style.height=`${Vu}px`,this._div.style.position="absolute",this._div.style.top=`${_2}px`,this._div.style.left=`${b2}px`,this._div.style.zIndex=i0.toString(),this._div.style.pointerEvents="none"),this._activateOnTab&&(this._onKeyDown=this._onKeyDown.bind(this),globalThis.addEventListener("keydown",this._onKeyDown,!1)),this._deactivateOnMouseMove&&(this._onMouseMove=this._onMouseMove.bind(this),globalThis.document.addEventListener("mousemove",this._onMouseMove,!0));let e=this._renderer.view.canvas;if(e.parentNode)e.parentNode.appendChild(this._div),this._initAccessibilitySetup();else{let t=new MutationObserver(()=>{e.parentNode&&(e.parentNode.appendChild(this._div),t.disconnect(),this._initAccessibilitySetup())});t.observe(document.body,{childList:!0,subtree:!0})}}_initAccessibilitySetup(){this._renderer.runners.postrender.add(this),this._renderer.lastObjectRendered&&this._updateAccessibleObjects(this._renderer.lastObjectRendered)}_deactivate(){if(!(!this._isActive||this._isMobileAccessibility)){this._isActive=!1,globalThis.document.removeEventListener("mousemove",this._onMouseMove,!0),this._activateOnTab&&globalThis.addEventListener("keydown",this._onKeyDown,!1),this._renderer.runners.postrender.remove(this);for(let e of this._children)e._accessibleDiv&&e._accessibleDiv.parentNode&&(e._accessibleDiv.parentNode.removeChild(e._accessibleDiv),e._accessibleDiv=null),e._accessibleActive=!1;this._pool.forEach(e=>{e.parentNode&&e.parentNode.removeChild(e)}),this._div&&this._div.parentNode&&this._div.parentNode.removeChild(this._div),this._pool=[],this._children=[]}}_updateAccessibleObjects(e){if(!e.visible||!e.accessibleChildren)return;e.accessible&&(e._accessibleActive||this._addChild(e),e._renderId=this._renderId);let t=e.children;if(t)for(let i=0;i=0;i--){let s=this._children[i];t.has(i)||(s._accessibleDiv&&s._accessibleDiv.parentNode&&(s._accessibleDiv.parentNode.removeChild(s._accessibleDiv),this._pool.push(s._accessibleDiv),s._accessibleDiv=null),s._accessibleActive=!1,Mu(this._children,i,1))}if(this._renderer.renderingToScreen){let{x:i,y:s,width:o,height:n}=this._renderer.screen,a=this._div;a.style.left=`${i}px`,a.style.top=`${s}px`,a.style.width=`${o}px`,a.style.height=`${n}px`}for(let i=0;i title : ${e.title}
tabIndex: ${e.tabIndex}`}_capHitArea(e){e.x<0&&(e.width+=e.x,e.x=0),e.y<0&&(e.height+=e.y,e.y=0);let{width:t,height:i}=this._renderer;e.x+e.width>t&&(e.width=t-e.x),e.y+e.height>i&&(e.height=i-e.y)}_addChild(e){let t=this._pool.pop();t||(e.accessibleType==="button"?t=document.createElement("button"):(t=document.createElement(e.accessibleType),t.style.cssText=` +Deprecated since v${r}`),console.warn(i))),tv[e]=!0}var tv,ie,rv,Xe=y(()=>{"use strict";tv={},ie="8.0.0",rv="8.3.4"});var ps,jp=y(()=>{"use strict";ps=class{constructor(e,t){this._pool=[],this._count=0,this._index=0,this._classType=e,t&&this.prepopulate(t)}prepopulate(e){for(let t=0;t0?t=this._pool[--this._index]:t=new this._classType,t.init?.(e),t}return(e){e.reset?.(),this._pool[this._index++]=e}get totalSize(){return this._count}get totalFree(){return this._index}get totalUsed(){return this._count-this._index}clear(){this._pool.length=0,this._index=0}}});var Yp,se,Gt=y(()=>{jp();Yp=class{constructor(){this._poolsByClass=new Map}prepopulate(e,t){this.getPool(e).prepopulate(t)}get(e,t){return this.getPool(e).get(t)}return(e){this.getPool(e.constructor).return(e)}getPool(e){return this._poolsByClass.has(e)||this._poolsByClass.set(e,new ps(e)),this._poolsByClass.get(e)}stats(){let e={};return this._poolsByClass.forEach(t=>{let i=e[t._classType.name]?t._classType.name+t._classType.ID:t._classType.name;e[i]={free:t.totalFree,used:t.totalUsed,size:t.totalSize}}),e}},se=new Yp});var iv,sv=y(()=>{Xe();iv={get isCachedAsTexture(){return!!this.renderGroup?.isCachedAsTexture},cacheAsTexture(r){typeof r=="boolean"&&r===!1?this.disableRenderGroup():(this.enableRenderGroup(),this.renderGroup.enableCacheAsTexture(r===!0?{}:r))},updateCacheTexture(){this.renderGroup?.updateCacheTexture()},get cacheAsBitmap(){return this.isCachedAsTexture},set cacheAsBitmap(r){X("v8.6.0","cacheAsBitmap is deprecated, use cacheAsTexture instead."),this.cacheAsTexture(r)}}});function Mu(r,e,t){let i=r.length,s;if(e>=i||t===0)return;t=e+t>i?i-e:t;let o=i-t;for(s=e;s{"use strict"});var ov,nv=y(()=>{qp();Xe();ov={allowChildren:!0,removeChildren(r=0,e){let t=e??this.children.length,i=t-r,s=[];if(i>0&&i<=t){for(let n=t-1;n>=r;n--){let a=this.children[n];a&&(s.push(a),a.parent=null)}Mu(this.children,r,t);let o=this.renderGroup||this.parentRenderGroup;o&&o.removeChildren(s);for(let n=0;n0&&this._didViewChangeTick++,s}else if(i===0&&this.children.length===0)return s;throw new RangeError("removeChildren: numeric values are outside the acceptable range.")},removeChildAt(r){let e=this.getChildAt(r);return this.removeChild(e)},getChildAt(r){if(r<0||r>=this.children.length)throw new Error(`getChildAt: Index (${r}) does not exist.`);return this.children[r]},setChildIndex(r,e){if(e<0||e>=this.children.length)throw new Error(`The index ${e} supplied is out of bounds ${this.children.length}`);this.getChildIndex(r),this.addChildAt(r,e)},getChildIndex(r){let e=this.children.indexOf(r);if(e===-1)throw new Error("The supplied Container must be a child of the caller");return e},addChildAt(r,e){this.allowChildren||X(ie,"addChildAt: Only Containers will be allowed to add children in v8.0.0");let{children:t}=this;if(e<0||e>t.length)throw new Error(`${r}addChildAt: The index ${e} supplied is out of bounds ${t.length}`);if(r.parent){let s=r.parent.children.indexOf(r);if(r.parent===this&&s===e)return r;s!==-1&&r.parent.children.splice(s,1)}e===t.length?t.push(r):t.splice(e,0,r),r.parent=this,r.didChange=!0,r._updateFlags=15;let i=this.renderGroup||this.parentRenderGroup;return i&&i.addChild(r),this.sortableChildren&&(this.sortDirty=!0),this.emit("childAdded",r,this,e),r.emit("added",this),r},swapChildren(r,e){if(r===e)return;let t=this.getChildIndex(r),i=this.getChildIndex(e);this.children[t]=e,this.children[i]=r;let s=this.renderGroup||this.parentRenderGroup;s&&(s.structureDidChange=!0),this._didContainerChangeTick++},removeFromParent(){this.parent?.removeChild(this)},reparentChild(...r){return r.length===1?this.reparentChildAt(r[0],this.children.length):(r.forEach(e=>this.reparentChildAt(e,this.children.length)),r[0])},reparentChildAt(r,e){if(r.parent===this)return this.setChildIndex(r,e),r;let t=r.worldTransform.clone();r.removeFromParent(),this.addChildAt(r,e);let i=this.worldTransform.clone();return i.invert(),t.prepend(i),r.setFromMatrix(t),r}}});var av,lv=y(()=>{"use strict";av={collectRenderables(r,e,t){this.parentRenderLayer&&this.parentRenderLayer!==t||this.globalDisplayStatus<7||!this.includeInBuild||(this.sortableChildren&&this.sortChildren(),this.isSimple?this.collectRenderablesSimple(r,e,t):this.renderGroup?e.renderPipes.renderGroup.addRenderGroup(this.renderGroup,r):this.collectRenderablesWithEffects(r,e,t))},collectRenderablesSimple(r,e,t){let i=this.children,s=i.length;for(let o=0;o=0;s--){let o=this.effects[s];i[o.pipe].pop(o,this,r)}}}});var hi,Ru=y(()=>{"use strict";hi=class{constructor(){this.pipe="filter",this.priority=1}destroy(){for(let e=0;e{U();Gt();Kp=class{constructor(){this._effectClasses=[],this._tests=[],this._initialized=!1}init(){this._initialized||(this._initialized=!0,this._effectClasses.forEach(e=>{this.add({test:e.test,maskClass:e})}))}add(e){this._tests.push(e)}getMaskEffect(e){this._initialized||this.init();for(let t=0;t{Ru();cv();uv={_maskEffect:null,_maskOptions:{inverse:!1},_filterEffect:null,effects:[],_markStructureAsChanged(){let r=this.renderGroup||this.parentRenderGroup;r&&(r.structureDidChange=!0)},addEffect(r){this.effects.indexOf(r)===-1&&(this.effects.push(r),this.effects.sort((t,i)=>t.priority-i.priority),this._markStructureAsChanged(),this._updateIsSimple())},removeEffect(r){let e=this.effects.indexOf(r);e!==-1&&(this.effects.splice(e,1),this._markStructureAsChanged(),this._updateIsSimple())},set mask(r){let e=this._maskEffect;e?.mask!==r&&(e&&(this.removeEffect(e),Iu.returnMaskEffect(e),this._maskEffect=null),r!=null&&(this._maskEffect=Iu.getMaskEffect(r),this.addEffect(this._maskEffect)))},setMask(r){this._maskOptions={...this._maskOptions,...r},r.mask&&(this.mask=r.mask),this._markStructureAsChanged()},get mask(){return this._maskEffect?.mask},set filters(r){!Array.isArray(r)&&r&&(r=[r]);let e=this._filterEffect||(this._filterEffect=new hi);r=r;let t=r?.length>0,i=e.filters?.length>0,s=t!==i;r=Array.isArray(r)?r.slice(0):r,e.filters=Object.freeze(r),s&&(t?this.addEffect(e):(this.removeEffect(e),e.filters=r??null))},get filters(){return this._filterEffect?.filters},set filterArea(r){this._filterEffect||(this._filterEffect=new hi),this._filterEffect.filterArea=r},get filterArea(){return this._filterEffect?.filterArea}}});var dv,fv=y(()=>{Xe();dv={label:null,get name(){return X(ie,"Container.name property has been removed, use Container.label instead"),this.label},set name(r){X(ie,"Container.name property has been removed, use Container.label instead"),this.label=r},getChildByName(r,e=!1){return this.getChildByLabel(r,e)},getChildByLabel(r,e=!1){let t=this.children;for(let i=0;i{fr();Bu=[new de,new de,new de,new de],Q=class r{constructor(e=0,t=0,i=0,s=0){this.type="rectangle",this.x=Number(e),this.y=Number(t),this.width=Number(i),this.height=Number(s)}get left(){return this.x}get right(){return this.x+this.width}get top(){return this.y}get bottom(){return this.y+this.height}isEmpty(){return this.left===this.right||this.top===this.bottom}static get EMPTY(){return new r(0,0,0,0)}clone(){return new r(this.x,this.y,this.width,this.height)}copyFromBounds(e){return this.x=e.minX,this.y=e.minY,this.width=e.maxX-e.minX,this.height=e.maxY-e.minY,this}copyFrom(e){return this.x=e.x,this.y=e.y,this.width=e.width,this.height=e.height,this}copyTo(e){return e.copyFrom(this),e}contains(e,t){return this.width<=0||this.height<=0?!1:e>=this.x&&e=this.y&&t=h&&e<=d&&t>=f&&t<=p&&!(e>m&&e_&&te.right?e.right:this.right)<=I)return!1;let C=this.ye.bottom?e.bottom:this.bottom)>C}let i=this.left,s=this.right,o=this.top,n=this.bottom;if(s<=i||n<=o)return!1;let a=Bu[0].set(e.left,e.top),l=Bu[1].set(e.left,e.bottom),c=Bu[2].set(e.right,e.top),u=Bu[3].set(e.right,e.bottom);if(c.x<=a.x||l.y<=a.y)return!1;let h=Math.sign(t.a*t.d-t.b*t.c);if(h===0||(t.apply(a,a),t.apply(l,l),t.apply(c,c),t.apply(u,u),Math.max(a.x,l.x,c.x,u.x)<=i||Math.min(a.x,l.x,c.x,u.x)>=s||Math.max(a.y,l.y,c.y,u.y)<=o||Math.min(a.y,l.y,c.y,u.y)>=n))return!1;let d=h*(l.y-a.y),f=h*(a.x-l.x),p=d*i+f*o,m=d*s+f*o,g=d*i+f*n,_=d*s+f*n;if(Math.max(p,m,g,_)<=d*a.x+f*a.y||Math.min(p,m,g,_)>=d*u.x+f*u.y)return!1;let v=h*(a.y-c.y),x=h*(c.x-a.x),T=v*i+x*o,b=v*s+x*o,E=v*i+x*n,w=v*s+x*n;return!(Math.max(T,b,E,w)<=v*a.x+x*a.y||Math.min(T,b,E,w)>=v*u.x+x*u.y)}pad(e=0,t=e){return this.x-=e,this.y-=t,this.width+=e*2,this.height+=t*2,this}fit(e){let t=Math.max(this.x,e.x),i=Math.min(this.x+this.width,e.x+e.width),s=Math.max(this.y,e.y),o=Math.min(this.y+this.height,e.y+e.height);return this.x=t,this.width=Math.max(i-t,0),this.y=s,this.height=Math.max(o-s,0),this}ceil(e=1,t=.001){let i=Math.ceil((this.x+this.width-t)*e)/e,s=Math.ceil((this.y+this.height-t)*e)/e;return this.x=Math.floor((this.x+t)*e)/e,this.y=Math.floor((this.y+t)*e)/e,this.width=i-this.x,this.height=s-this.y,this}enlarge(e){let t=Math.min(this.x,e.x),i=Math.max(this.x+this.width,e.x+e.width),s=Math.min(this.y,e.y),o=Math.max(this.y+this.height,e.y+e.height);return this.x=t,this.width=i-t,this.y=s,this.height=o-s,this}getBounds(e){return e||(e=new r),e.copyFrom(this),e}containsRect(e){if(this.width<=0||this.height<=0)return!1;let t=e.x,i=e.y,s=e.x+e.width,o=e.y+e.height;return t>=this.x&&t=this.y&&i=this.x&&s=this.y&&o{ge();ut();pv=new G,Ee=class r{constructor(e=1/0,t=1/0,i=-1/0,s=-1/0){this.minX=1/0,this.minY=1/0,this.maxX=-1/0,this.maxY=-1/0,this.matrix=pv,this.minX=e,this.minY=t,this.maxX=i,this.maxY=s}isEmpty(){return this.minX>this.maxX||this.minY>this.maxY}get rectangle(){this._rectangle||(this._rectangle=new Q);let e=this._rectangle;return this.minX>this.maxX||this.minY>this.maxY?(e.x=0,e.y=0,e.width=0,e.height=0):e.copyFromBounds(this),e}clear(){return this.minX=1/0,this.minY=1/0,this.maxX=-1/0,this.maxY=-1/0,this.matrix=pv,this}set(e,t,i,s){this.minX=e,this.minY=t,this.maxX=i,this.maxY=s}addFrame(e,t,i,s,o){o||(o=this.matrix);let n=o.a,a=o.b,l=o.c,c=o.d,u=o.tx,h=o.ty,d=this.minX,f=this.minY,p=this.maxX,m=this.maxY,g=n*e+l*t+u,_=a*e+c*t+h;gp&&(p=g),_>m&&(m=_),g=n*i+l*t+u,_=a*i+c*t+h,gp&&(p=g),_>m&&(m=_),g=n*e+l*s+u,_=a*e+c*s+h,gp&&(p=g),_>m&&(m=_),g=n*i+l*s+u,_=a*i+c*s+h,gp&&(p=g),_>m&&(m=_),this.minX=d,this.minY=f,this.maxX=p,this.maxY=m}addRect(e,t){this.addFrame(e.x,e.y,e.x+e.width,e.y+e.height,t)}addBounds(e,t){this.addFrame(e.minX,e.minY,e.maxX,e.maxY,t)}addBoundsMask(e){this.minX=this.minX>e.minX?this.minX:e.minX,this.minY=this.minY>e.minY?this.minY:e.minY,this.maxX=this.maxXthis.maxX?d:this.maxX,this.maxY=f>this.maxY?f:this.maxY,d=n*t+l*o+u,f=a*t+c*o+h,this.minX=dthis.maxX?d:this.maxX,this.maxY=f>this.maxY?f:this.maxY,d=n*s+l*o+u,f=a*s+c*o+h,this.minX=dthis.maxX?d:this.maxX,this.maxY=f>this.maxY?f:this.maxY}fit(e){return this.minXe.right&&(this.maxX=e.right),this.minYe.bottom&&(this.maxY=e.bottom),this}fitBounds(e,t,i,s){return this.minXt&&(this.maxX=t),this.minYs&&(this.maxY=s),this}pad(e,t=e){return this.minX-=e,this.maxX+=e,this.minY-=t,this.maxY+=t,this}ceil(){return this.minX=Math.floor(this.minX),this.minY=Math.floor(this.minY),this.maxX=Math.ceil(this.maxX),this.maxY=Math.ceil(this.maxY),this}clone(){return new r(this.minX,this.minY,this.maxX,this.maxY)}scale(e,t=e){return this.minX*=e,this.minY*=t,this.maxX*=e,this.maxY*=t,this}get x(){return this.minX}set x(e){let t=this.maxX-this.minX;this.minX=e,this.maxX=e+t}get y(){return this.minY}set y(e){let t=this.maxY-this.minY;this.minY=e,this.maxY=e+t}get width(){return this.maxX-this.minX}set width(e){this.maxX=this.minX+e}get height(){return this.maxY-this.minY}set height(e){this.maxY=this.minY+e}get left(){return this.minX}get right(){return this.maxX}get top(){return this.minY}get bottom(){return this.maxY}get isPositive(){return this.maxX-this.minX>0&&this.maxY-this.minY>0}get isValid(){return this.minX+this.minY!==1/0}addVertexData(e,t,i,s){let o=this.minX,n=this.minY,a=this.maxX,l=this.maxY;s||(s=this.matrix);let c=s.a,u=s.b,h=s.c,d=s.d,f=s.tx,p=s.ty;for(let m=t;ma?v:a,l=x>l?x:l}this.minX=o,this.minY=n,this.maxX=a,this.maxY=l}containsPoint(e,t){return this.minX<=e&&this.minY<=t&&this.maxX>=e&&this.maxY>=t}toString(){return`[pixi.js:Bounds minX=${this.minX} minY=${this.minY} maxX=${this.maxX} maxY=${this.maxY} width=${this.width} height=${this.height}]`}copyFrom(e){return this.minX=e.minX,this.minY=e.minY,this.maxX=e.maxX,this.maxY=e.maxY,this}}});var st,er,ms=y(()=>{ge();jp();$t();st=new ps(G),er=new ps(Ee)});var u2,mv,gv=y(()=>{ge();$t();ms();u2=new G,mv={getFastGlobalBounds(r,e){e||(e=new Ee),e.clear(),this._getGlobalBoundsRecursive(!!r,e,this.parentRenderLayer),e.isValid||e.set(0,0,0,0);let t=this.renderGroup||this.parentRenderGroup;return e.applyMatrix(t.worldTransform),e},_getGlobalBoundsRecursive(r,e,t){let i=e;if(r&&this.parentRenderLayer&&this.parentRenderLayer!==t||this.localDisplayStatus!==7||!this.measurable)return;let s=!!this.effects.length;if((this.renderGroup||s)&&(i=er.get().clear()),this.boundsArea)e.addRect(this.boundsArea,this.worldTransform);else{if(this.renderPipeId){let n=this.bounds;i.addFrame(n.minX,n.minY,n.maxX,n.maxY,this.groupTransform)}let o=this.children;for(let n=0;n{ge();ms()});function Fu(r,e){if(r===16777215||!e)return e;if(e===16777215||!r)return r;let t=r>>16&255,i=r>>8&255,s=r&255,o=e>>16&255,n=e>>8&255,a=e&255,l=t*o/255|0,c=i*n/255|0,u=s*a/255|0;return(l<<16)+(c<<8)+u}var Zp=y(()=>{"use strict"});function go(r,e){return r===yv?e:e===yv?r:Fu(r,e)}var yv,Qp=y(()=>{Zp();yv=16777215});function xa(r){return((r&255)<<16)+(r&65280)+(r>>16&255)}var _v,bv=y(()=>{ga();ms();Qp();_v={getGlobalAlpha(r){if(r)return this.renderGroup?this.renderGroup.worldAlpha:this.parentRenderGroup?this.parentRenderGroup.worldAlpha*this.alpha:this.alpha;let e=this.alpha,t=this.parent;for(;t;)e*=t.alpha,t=t.parent;return e},getGlobalTransform(r,e){if(e)return r.copyFrom(this.worldTransform);this.updateLocalTransform();let t=ku(this,st.get().identity());return r.appendFrom(this.localTransform,t),st.return(t),r},getGlobalTint(r){if(r)return this.renderGroup?xa(this.renderGroup.worldColor):this.parentRenderGroup?xa(go(this.localColor,this.parentRenderGroup.worldColor)):this.tint;let e=this.localColor,t=this.parent;for(;t;)e=go(e,t.localColor),t=t.parent;return xa(e)}}});function W(...r){Jp!==vv&&(Jp++,Jp===vv?console.warn("PixiJS Warning: too many warnings, no more warnings will be reported to the console by PixiJS."):console.warn("PixiJS Warning: ",...r))}var Jp,vv,Ae=y(()=>{"use strict";Jp=0,vv=500});function xo(r,e,t){return e.clear(),t||(t=G.IDENTITY),Tv(r,e,t,r,!0),e.isValid||e.set(0,0,0,0),e}function Tv(r,e,t,i,s){let o;if(s)o=st.get(),o=t.copyTo(o);else{if(!r.visible||!r.measurable)return;r.updateLocalTransform();let l=r.localTransform;o=st.get(),o.appendFrom(l,t)}let n=e,a=!!r.effects.length;if(a&&(e=er.get().clear()),r.boundsArea)e.addRect(r.boundsArea,o);else{r.renderPipeId&&(e.matrix=o,e.addBounds(r.bounds));let l=r.children;for(let c=0;c{ge();ms()});function em(r,e){let t=r.children;for(let i=0;i{"use strict"});var h2,wv,Ev=y(()=>{ge();$t();ga();Ou();Sv();h2=new G,wv={_localBoundsCacheId:-1,_localBoundsCacheData:null,_setWidth(r,e){let t=Math.sign(this.scale.x)||1;e!==0?this.scale.x=r/e*t:this.scale.x=t},_setHeight(r,e){let t=Math.sign(this.scale.y)||1;e!==0?this.scale.y=r/e*t:this.scale.y=t},getLocalBounds(){this._localBoundsCacheData||(this._localBoundsCacheData={data:[],index:1,didChange:!1,localBounds:new Ee});let r=this._localBoundsCacheData;return r.index=1,r.didChange=!1,r.data[0]!==this._didViewChangeTick&&(r.didChange=!0,r.data[0]=this._didViewChangeTick),em(this,r),r.didChange&&xo(this,r.localBounds,h2),r.localBounds},getBounds(r,e){return mo(this,r,e||new Ee)}}});var Av,Pv=y(()=>{"use strict";Av={_onRender:null,set onRender(r){let e=this.renderGroup||this.parentRenderGroup;if(!r){this._onRender&&e?.removeOnRender(this),this._onRender=null;return}this._onRender||e?.addOnRender(this),this._onRender=r},get onRender(){return this._onRender}}});function d2(r,e){return r._zIndex-e._zIndex}var Cv,Mv=y(()=>{"use strict";Cv={_zIndex:0,sortDirty:!1,sortableChildren:!1,get zIndex(){return this._zIndex},set zIndex(r){this._zIndex!==r&&(this._zIndex=r,this.depthOfChildModified())},depthOfChildModified(){this.parent&&(this.parent.sortableChildren=!0,this.parent.sortDirty=!0),this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=!0)},sortChildren(){this.sortDirty&&(this.sortDirty=!1,this.children.sort(d2))}}});var Rv,Iv=y(()=>{fr();ms();Rv={getGlobalPosition(r=new de,e=!1){return this.parent?this.parent.toGlobal(this._position,r,e):(r.x=this._position.x,r.y=this._position.y),r},toGlobal(r,e,t=!1){let i=this.getGlobalTransform(st.get(),t);return e=i.apply(r,e),st.return(i),e},toLocal(r,e,t,i){e&&(r=e.toGlobal(r,t,i));let s=this.getGlobalTransform(st.get(),i);return t=s.applyInverse(r,t),st.return(s),t}}});var yo,tm=y(()=>{wt();yo=class{constructor(){this.uid=he("instructionSet"),this.instructions=[],this.instructionSize=0,this.renderables=[],this.gcTick=0}reset(){this.instructionSize=0}add(e){this.instructions[this.instructionSize++]=e}log(){this.instructions.length=this.instructionSize,console.table(this.instructions,["type","action"])}}});function di(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 rm(r){return!(r&r-1)&&!!r}var ya=y(()=>{"use strict"});function Uu(r){let e={};for(let t in r)r[t]!==void 0&&(e[t]=r[t]);return e}var im=y(()=>{"use strict"});function f2(r){let e=Bv[r];return e===void 0&&(Bv[r]=he("resource")),e}var Bv,kv,Gu,sm=y(()=>{Mt();wt();Xe();Bv=Object.create(null);kv=class Fv extends Ce{constructor(e={}){super(),this._resourceType="textureSampler",this._touched=0,this._maxAnisotropy=1,this.destroyed=!1,e={...Fv.defaultOptions,...e},this.addressMode=e.addressMode,this.addressModeU=e.addressModeU??this.addressModeU,this.addressModeV=e.addressModeV??this.addressModeV,this.addressModeW=e.addressModeW??this.addressModeW,this.scaleMode=e.scaleMode,this.magFilter=e.magFilter??this.magFilter,this.minFilter=e.minFilter??this.minFilter,this.mipmapFilter=e.mipmapFilter??this.mipmapFilter,this.lodMinClamp=e.lodMinClamp,this.lodMaxClamp=e.lodMaxClamp,this.compare=e.compare,this.maxAnisotropy=e.maxAnisotropy??1}set addressMode(e){this.addressModeU=e,this.addressModeV=e,this.addressModeW=e}get addressMode(){return this.addressModeU}set wrapMode(e){X(ie,"TextureStyle.wrapMode is now TextureStyle.addressMode"),this.addressMode=e}get wrapMode(){return this.addressMode}set scaleMode(e){this.magFilter=e,this.minFilter=e,this.mipmapFilter=e}get scaleMode(){return this.magFilter}set maxAnisotropy(e){this._maxAnisotropy=Math.min(e,16),this._maxAnisotropy>1&&(this.scaleMode="linear")}get maxAnisotropy(){return this._maxAnisotropy}get _resourceId(){return this._sharedResourceId||this._generateResourceId()}update(){this.emit("change",this),this._sharedResourceId=null}_generateResourceId(){let e=`${this.addressModeU}-${this.addressModeV}-${this.addressModeW}-${this.magFilter}-${this.minFilter}-${this.mipmapFilter}-${this.lodMinClamp}-${this.lodMaxClamp}-${this.compare}-${this._maxAnisotropy}`;return this._sharedResourceId=f2(e),this._resourceId}destroy(){this.destroyed=!0,this.emit("destroy",this),this.emit("change",this),this.removeAllListeners()}};kv.defaultOptions={addressMode:"clamp-to-edge",scaleMode:"linear"};Gu=kv});var Ov,we,Xt=y(()=>{Mt();ya();im();wt();sm();Ov=class Uv extends Ce{constructor(e={}){super(),this.options=e,this.uid=he("textureSource"),this._resourceType="textureSource",this._resourceId=he("resource"),this.uploadMethodId="unknown",this._resolution=1,this.pixelWidth=1,this.pixelHeight=1,this.width=1,this.height=1,this.sampleCount=1,this.mipLevelCount=1,this.autoGenerateMipmaps=!1,this.format="rgba8unorm",this.dimension="2d",this.antialias=!1,this._touched=0,this._batchTick=-1,this._textureBindLocation=-1,e={...Uv.defaultOptions,...e},this.label=e.label??"",this.resource=e.resource,this.autoGarbageCollect=e.autoGarbageCollect,this._resolution=e.resolution,e.width?this.pixelWidth=e.width*this._resolution:this.pixelWidth=this.resource?this.resourceWidth??1:1,e.height?this.pixelHeight=e.height*this._resolution:this.pixelHeight=this.resource?this.resourceHeight??1:1,this.width=this.pixelWidth/this._resolution,this.height=this.pixelHeight/this._resolution,this.format=e.format,this.dimension=e.dimensions,this.mipLevelCount=e.mipLevelCount,this.autoGenerateMipmaps=e.autoGenerateMipmaps,this.sampleCount=e.sampleCount,this.antialias=e.antialias,this.alphaMode=e.alphaMode,this.style=new Gu(Uu(e)),this.destroyed=!1,this._refreshPOT()}get source(){return this}get style(){return this._style}set style(e){this.style!==e&&(this._style?.off("change",this._onStyleChange,this),this._style=e,this._style?.on("change",this._onStyleChange,this),this._onStyleChange())}get addressMode(){return this._style.addressMode}set addressMode(e){this._style.addressMode=e}get repeatMode(){return this._style.addressMode}set repeatMode(e){this._style.addressMode=e}get magFilter(){return this._style.magFilter}set magFilter(e){this._style.magFilter=e}get minFilter(){return this._style.minFilter}set minFilter(e){this._style.minFilter=e}get mipmapFilter(){return this._style.mipmapFilter}set mipmapFilter(e){this._style.mipmapFilter=e}get lodMinClamp(){return this._style.lodMinClamp}set lodMinClamp(e){this._style.lodMinClamp=e}get lodMaxClamp(){return this._style.lodMaxClamp}set lodMaxClamp(e){this._style.lodMaxClamp=e}_onStyleChange(){this.emit("styleChange",this)}update(){if(this.resource){let e=this._resolution;if(this.resize(this.resourceWidth/e,this.resourceHeight/e))return}this.emit("update",this)}destroy(){this.destroyed=!0,this.emit("destroy",this),this.emit("change",this),this._style&&(this._style.destroy(),this._style=null),this.uploadMethodId=null,this.resource=null,this.removeAllListeners()}unload(){this._resourceId=he("resource"),this.emit("change",this),this.emit("unload",this)}get resourceWidth(){let{resource:e}=this;return e.naturalWidth||e.videoWidth||e.displayWidth||e.width}get resourceHeight(){let{resource:e}=this;return e.naturalHeight||e.videoHeight||e.displayHeight||e.height}get resolution(){return this._resolution}set resolution(e){this._resolution!==e&&(this._resolution=e,this.width=this.pixelWidth/e,this.height=this.pixelHeight/e)}resize(e,t,i){i||(i=this._resolution),e||(e=this.width),t||(t=this.height);let s=Math.round(e*i),o=Math.round(t*i);return this.width=s/i,this.height=o/i,this._resolution=i,this.pixelWidth===s&&this.pixelHeight===o?!1:(this._refreshPOT(),this.pixelWidth=s,this.pixelHeight=o,this.emit("resize",this),this._resourceId=he("resource"),this.emit("change",this),!0)}updateMipmaps(){this.autoGenerateMipmaps&&this.mipLevelCount>1&&this.emit("updateMipmaps",this)}set wrapMode(e){this._style.wrapMode=e}get wrapMode(){return this._style.wrapMode}set scaleMode(e){this._style.scaleMode=e}get scaleMode(){return this._style.scaleMode}_refreshPOT(){this.isPowerOfTwo=rm(this.pixelWidth)&&rm(this.pixelHeight)}static test(e){throw new Error("Unimplemented")}};Ov.defaultOptions={resolution:1,format:"bgra8unorm",alphaMode:"premultiply-alpha-on-upload",dimensions:"2d",mipLevelCount:1,autoGenerateMipmaps:!1,sampleCount:1,antialias:!1,autoGarbageCollect:!1};we=Ov});function p2(){for(let r=0;r<16;r++){let e=[];om.push(e);for(let t=0;t<16;t++){let i=Lu(gs[r]*gs[t]+ys[r]*xs[t]),s=Lu(xs[r]*gs[t]+_s[r]*xs[t]),o=Lu(gs[r]*ys[t]+ys[r]*_s[t]),n=Lu(xs[r]*ys[t]+_s[r]*_s[t]);for(let a=0;a<16;a++)if(gs[a]===i&&xs[a]===s&&ys[a]===o&&_s[a]===n){e.push(a);break}}}for(let r=0;r<16;r++){let e=new G;e.set(gs[r],xs[r],ys[r],_s[r],0,0),Gv.push(e)}}var gs,xs,ys,_s,om,Gv,Lu,He,Lv=y(()=>{ge();gs=[1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1,0,1],xs=[0,1,1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1],ys=[0,-1,-1,-1,0,1,1,1,0,1,1,1,0,-1,-1,-1],_s=[1,1,0,-1,-1,-1,0,1,-1,-1,0,1,1,1,0,-1],om=[],Gv=[],Lu=Math.sign;p2();He={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=>gs[r],uY:r=>xs[r],vX:r=>ys[r],vY:r=>_s[r],inv:r=>r&8?r&15:-r&7,add:(r,e)=>om[r][e],sub:(r,e)=>om[r][He.inv(e)],rotate180:r=>r^4,isVertical:r=>(r&3)===2,byDirection:(r,e)=>Math.abs(r)*2<=Math.abs(e)?e>=0?He.S:He.N:Math.abs(e)*2<=Math.abs(r)?r>0?He.E:He.W:e>0?r>0?He.SE:He.SW:r>0?He.NE:He.NW,matrixAppendRotationInv:(r,e,t=0,i=0)=>{let s=Gv[He.inv(e)];s.tx=t,s.ty=i,r.append(s)}}});var nm,Dv=y(()=>{"use strict";nm=()=>{}});var bs,am=y(()=>{U();Xt();bs=class extends we{constructor(e){let t=e.resource||new Float32Array(e.width*e.height*4),i=e.format;i||(t instanceof Float32Array?i="rgba32float":t instanceof Int32Array||t instanceof Uint32Array?i="rgba32uint":t instanceof Int16Array||t instanceof Uint16Array?i="rgba16uint":(t instanceof Int8Array,i="bgra8unorm")),super({...e,resource:t,format:i}),this.uploadMethodId="buffer"}static test(e){return e instanceof Int8Array||e instanceof Uint8Array||e instanceof Uint8ClampedArray||e instanceof Int16Array||e instanceof Uint16Array||e instanceof Int32Array||e instanceof Uint32Array||e instanceof Float32Array}};bs.extension=S.TextureSource});var Nv,_o,lm=y(()=>{ge();Nv=new G,_o=class{constructor(e,t){this.mapCoord=new G,this.uClampFrame=new Float32Array(4),this.uClampOffset=new Float32Array(2),this._textureID=-1,this._updateID=0,this.clampOffset=0,typeof t>"u"?this.clampMargin=e.width<10?0:.5:this.clampMargin=t,this.isSimple=!1,this.texture=e}get texture(){return this._texture}set texture(e){this.texture!==e&&(this._texture?.removeListener("update",this.update,this),this._texture=e,this._texture.addListener("update",this.update,this),this.update())}multiplyUvs(e,t){t===void 0&&(t=e);let i=this.mapCoord;for(let s=0;s{Mt();Lv();ut();wt();Xe();Dv();am();Xt();lm();k=class extends Ce{constructor({source:e,label:t,frame:i,orig:s,trim:o,defaultAnchor:n,defaultBorders:a,rotate:l,dynamic:c}={}){if(super(),this.uid=he("texture"),this.uvs={x0:0,y0:0,x1:0,y1:0,x2:0,y2:0,x3:0,y3:0},this.frame=new Q,this.noFrame=!1,this.dynamic=!1,this.isTexture=!0,this.label=t,this.source=e?.source??new we,this.noFrame=!i,i)this.frame.copyFrom(i);else{let{width:u,height:h}=this._source;this.frame.width=u,this.frame.height=h}this.orig=s||this.frame,this.trim=o,this.rotate=l??0,this.defaultAnchor=n,this.defaultBorders=a,this.destroyed=!1,this.dynamic=c||!1,this.updateUvs()}set source(e){this._source&&this._source.off("resize",this.update,this),this._source=e,e.on("resize",this.update,this),this.emit("update",this)}get source(){return this._source}get textureMatrix(){return this._textureMatrix||(this._textureMatrix=new _o(this)),this._textureMatrix}get width(){return this.orig.width}get height(){return this.orig.height}updateUvs(){let{uvs:e,frame:t}=this,{width:i,height:s}=this._source,o=t.x/i,n=t.y/s,a=t.width/i,l=t.height/s,c=this.rotate;if(c){let u=a/2,h=l/2,d=o+u,f=n+h;c=He.add(c,He.NW),e.x0=d+u*He.uX(c),e.y0=f+h*He.uY(c),c=He.add(c,2),e.x1=d+u*He.uX(c),e.y1=f+h*He.uY(c),c=He.add(c,2),e.x2=d+u*He.uX(c),e.y2=f+h*He.uY(c),c=He.add(c,2),e.x3=d+u*He.uX(c),e.y3=f+h*He.uY(c)}else e.x0=o,e.y0=n,e.x1=o+a,e.y1=n,e.x2=o+a,e.y2=n+l,e.x3=o,e.y3=n+l}destroy(e=!1){this._source&&e&&(this._source.destroy(),this._source=null),this._textureMatrix=null,this.destroyed=!0,this.emit("destroy",this),this.removeAllListeners()}update(){this.noFrame&&(this.frame.width=this._source.width,this.frame.height=this._source.height),this.updateUvs(),this.emit("update",this)}get baseTexture(){return X(ie,"Texture.baseTexture is now Texture.source"),this._source}};k.EMPTY=new k({label:"EMPTY",source:new we({label:"EMPTY"})});k.EMPTY.destroy=nm;k.WHITE=new k({source:new bs({resource:new Uint8Array([255,255,255,255]),width:1,height:1,alphaMode:"premultiply-alpha-on-upload",label:"WHITE"}),label:"WHITE"});k.WHITE.destroy=nm});var m2,cm,je,Oi=y(()=>{ya();Xt();ve();m2=0,cm=class{constructor(e){this._poolKeyHash=Object.create(null),this._texturePool={},this.textureOptions=e||{},this.enableFullScreen=!1}createTexture(e,t,i){let s=new we({...this.textureOptions,width:e,height:t,resolution:1,antialias:i,autoGarbageCollect:!1});return new k({source:s,label:`texturePool_${m2++}`})}getOptimalTexture(e,t,i=1,s){let o=Math.ceil(e*i-1e-6),n=Math.ceil(t*i-1e-6);o=di(o),n=di(n);let a=(o<<17)+(n<<1)+(s?1:0);this._texturePool[a]||(this._texturePool[a]=[]);let l=this._texturePool[a].pop();return l||(l=this.createTexture(o,n,s)),l.source._resolution=i,l.source.width=o/i,l.source.height=n/i,l.source.pixelWidth=o,l.source.pixelHeight=n,l.frame.x=0,l.frame.y=0,l.frame.width=e,l.frame.height=t,l.updateUvs(),this._poolKeyHash[l.uid]=a,l}getSameSizeTexture(e,t=!1){let i=e.source;return this.getOptimalTexture(e.width,e.height,i._resolution,t)}returnTexture(e){let t=this._poolKeyHash[e.uid];this._texturePool[t].push(e)}clear(e){if(e=e!==!1,e)for(let t in this._texturePool){let i=this._texturePool[t];if(i)for(let s=0;s{ge();tm();Oi();Du=class{constructor(){this.renderPipeId="renderGroup",this.root=null,this.canBundle=!1,this.renderGroupParent=null,this.renderGroupChildren=[],this.worldTransform=new G,this.worldColorAlpha=4294967295,this.worldColor=16777215,this.worldAlpha=1,this.childrenToUpdate=Object.create(null),this.updateTick=0,this.gcTick=0,this.childrenRenderablesToUpdate={list:[],index:0},this.structureDidChange=!0,this.instructionSet=new yo,this._onRenderContainers=[],this.textureNeedsUpdate=!0,this.isCachedAsTexture=!1,this._matrixDirty=7}init(e){this.root=e,e._onRender&&this.addOnRender(e),e.didChange=!0;let t=e.children;for(let i=0;i-1&&this.renderGroupChildren.splice(t,1),e.renderGroupParent=null}addChild(e){if(this.structureDidChange=!0,e.parentRenderGroup=this,e.updateTick=-1,e.parent===this.root?e.relativeRenderGroupDepth=1:e.relativeRenderGroupDepth=e.parent.relativeRenderGroupDepth+1,e.didChange=!0,this.onChildUpdate(e),e.renderGroup){this.addRenderGroupChild(e.renderGroup);return}e._onRender&&this.addOnRender(e);let t=e.children;for(let i=0;i0}addOnRender(e){this._onRenderContainers.push(e)}removeOnRender(e){this._onRenderContainers.splice(this._onRenderContainers.indexOf(e),1)}runOnRender(e){for(let t=0;t{"use strict"});var um,hm,dm,bo,_a,vs,te,Pr=y(()=>{Mt();Tt();Zb();U();ge();zp();Cu();wt();Xe();Gt();sv();nv();lv();hv();fv();gv();bv();Ev();Pv();Mv();Iv();Hv();Wv();um=new St(null),hm=new St(null),dm=new St(null,1,1),bo=1,_a=2,vs=4,te=class r extends Ce{constructor(e={}){super(),this.uid=he("renderable"),this._updateFlags=15,this.renderGroup=null,this.parentRenderGroup=null,this.parentRenderGroupIndex=0,this.didChange=!1,this.didViewUpdate=!1,this.relativeRenderGroupDepth=0,this.children=[],this.parent=null,this.includeInBuild=!0,this.measurable=!0,this.isSimple=!0,this.updateTick=-1,this.localTransform=new G,this.relativeGroupTransform=new G,this.groupTransform=this.relativeGroupTransform,this.destroyed=!1,this._position=new St(this,0,0),this._scale=dm,this._pivot=hm,this._skew=um,this._cx=1,this._sx=0,this._cy=0,this._sy=1,this._rotation=0,this.localColor=16777215,this.localAlpha=1,this.groupAlpha=1,this.groupColor=16777215,this.groupColorAlpha=4294967295,this.localBlendMode="inherit",this.groupBlendMode="normal",this.localDisplayStatus=7,this.globalDisplayStatus=7,this._didContainerChangeTick=0,this._didViewChangeTick=0,this._didLocalTransformChangeId=-1,this.effects=[],Vv(this,e,{children:!0,parent:!0,effects:!0}),e.children?.forEach(t=>this.addChild(t)),e.parent?.addChild(this)}static mixin(e){X("8.8.0","Container.mixin is deprecated, please use extensions.mixin instead."),V.mixin(r,e)}set _didChangeId(e){this._didViewChangeTick=e>>12&4095,this._didContainerChangeTick=e&4095}get _didChangeId(){return this._didContainerChangeTick&4095|(this._didViewChangeTick&4095)<<12}addChild(...e){if(this.allowChildren||X(ie,"addChild: Only Containers will be allowed to add children in v8.0.0"),e.length>1){for(let s=0;s1){for(let s=0;s-1&&(this._didViewChangeTick++,this.children.splice(i,1),this.renderGroup?this.renderGroup.removeChild(t):this.parentRenderGroup&&this.parentRenderGroup.removeChild(t),t.parentRenderLayer&&t.parentRenderLayer.detach(t),t.parent=null,this.emit("childRemoved",t,this,i),t.emit("removed",this)),t}_onUpdate(e){e&&e===this._skew&&this._updateSkew(),this._didContainerChangeTick++,!this.didChange&&(this.didChange=!0,this.parentRenderGroup&&this.parentRenderGroup.onChildUpdate(this))}set isRenderGroup(e){!!this.renderGroup!==e&&(e?this.enableRenderGroup():this.disableRenderGroup())}get isRenderGroup(){return!!this.renderGroup}enableRenderGroup(){if(this.renderGroup)return;let e=this.parentRenderGroup;e?.removeChild(this),this.renderGroup=se.get(Du,this),this.groupTransform=G.IDENTITY,e?.addChild(this),this._updateIsSimple()}disableRenderGroup(){if(!this.renderGroup)return;let e=this.parentRenderGroup;e?.removeChild(this),se.return(this.renderGroup),this.renderGroup=null,this.groupTransform=this.relativeGroupTransform,e?.addChild(this),this._updateIsSimple()}_updateIsSimple(){this.isSimple=!this.renderGroup&&this.effects.length===0}get worldTransform(){return this._worldTransform||(this._worldTransform=new G),this.renderGroup?this._worldTransform.copyFrom(this.renderGroup.worldTransform):this.parentRenderGroup&&this._worldTransform.appendFrom(this.relativeGroupTransform,this.parentRenderGroup.worldTransform),this._worldTransform}get x(){return this._position.x}set x(e){this._position.x=e}get y(){return this._position.y}set y(e){this._position.y=e}get position(){return this._position}set position(e){this._position.copyFrom(e)}get rotation(){return this._rotation}set rotation(e){this._rotation!==e&&(this._rotation=e,this._onUpdate(this._skew))}get angle(){return this.rotation*Jb}set angle(e){this.rotation=e*ev}get pivot(){return this._pivot===hm&&(this._pivot=new St(this,0,0)),this._pivot}set pivot(e){this._pivot===hm&&(this._pivot=new St(this,0,0)),typeof e=="number"?this._pivot.set(e):this._pivot.copyFrom(e)}get skew(){return this._skew===um&&(this._skew=new St(this,0,0)),this._skew}set skew(e){this._skew===um&&(this._skew=new St(this,0,0)),this._skew.copyFrom(e)}get scale(){return this._scale===dm&&(this._scale=new St(this,1,1)),this._scale}set scale(e){this._scale===dm&&(this._scale=new St(this,0,0)),typeof e=="number"?this._scale.set(e):this._scale.copyFrom(e)}get width(){return Math.abs(this.scale.x*this.getLocalBounds().width)}set width(e){let t=this.getLocalBounds().width;this._setWidth(e,t)}get height(){return Math.abs(this.scale.y*this.getLocalBounds().height)}set height(e){let t=this.getLocalBounds().height;this._setHeight(e,t)}getSize(e){e||(e={});let t=this.getLocalBounds();return e.width=Math.abs(this.scale.x*t.width),e.height=Math.abs(this.scale.y*t.height),e}setSize(e,t){let i=this.getLocalBounds();typeof e=="object"?(t=e.height??e.width,e=e.width):t??(t=e),e!==void 0&&this._setWidth(e,i.width),t!==void 0&&this._setHeight(t,i.height)}_updateSkew(){let e=this._rotation,t=this._skew;this._cx=Math.cos(e+t._y),this._sx=Math.sin(e+t._y),this._cy=-Math.sin(e-t._x),this._sy=Math.cos(e-t._x)}updateTransform(e){return this.position.set(typeof e.x=="number"?e.x:this.position.x,typeof e.y=="number"?e.y:this.position.y),this.scale.set(typeof e.scaleX=="number"?e.scaleX||1:this.scale.x,typeof e.scaleY=="number"?e.scaleY||1:this.scale.y),this.rotation=typeof e.rotation=="number"?e.rotation:this.rotation,this.skew.set(typeof e.skewX=="number"?e.skewX:this.skew.x,typeof e.skewY=="number"?e.skewY:this.skew.y),this.pivot.set(typeof e.pivotX=="number"?e.pivotX:this.pivot.x,typeof e.pivotY=="number"?e.pivotY:this.pivot.y),this}setFromMatrix(e){e.decompose(this)}updateLocalTransform(){let e=this._didContainerChangeTick;if(this._didLocalTransformChangeId===e)return;this._didLocalTransformChangeId=e;let t=this.localTransform,i=this._scale,s=this._pivot,o=this._position,n=i._x,a=i._y,l=s._x,c=s._y;t.a=this._cx*n,t.b=this._sx*n,t.c=this._cy*a,t.d=this._sy*a,t.tx=o._x-(l*t.a+c*t.c),t.ty=o._y-(l*t.b+c*t.d)}set alpha(e){e!==this.localAlpha&&(this.localAlpha=e,this._updateFlags|=bo,this._onUpdate())}get alpha(){return this.localAlpha}set tint(e){let i=oe.shared.setValue(e??16777215).toBgrNumber();i!==this.localColor&&(this.localColor=i,this._updateFlags|=bo,this._onUpdate())}get tint(){return xa(this.localColor)}set blendMode(e){this.localBlendMode!==e&&(this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=!0),this._updateFlags|=_a,this.localBlendMode=e,this._onUpdate())}get blendMode(){return this.localBlendMode}get visible(){return!!(this.localDisplayStatus&2)}set visible(e){let t=e?2:0;(this.localDisplayStatus&2)!==t&&(this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=!0),this._updateFlags|=vs,this.localDisplayStatus^=2,this._onUpdate())}get culled(){return!(this.localDisplayStatus&4)}set culled(e){let t=e?0:4;(this.localDisplayStatus&4)!==t&&(this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=!0),this._updateFlags|=vs,this.localDisplayStatus^=4,this._onUpdate())}get renderable(){return!!(this.localDisplayStatus&1)}set renderable(e){let t=e?1:0;(this.localDisplayStatus&1)!==t&&(this._updateFlags|=vs,this.localDisplayStatus^=1,this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=!0),this._onUpdate())}get isRenderable(){return this.localDisplayStatus===7&&this.groupAlpha>0}destroy(e=!1){if(this.destroyed)return;this.destroyed=!0;let t;if(this.children.length&&(t=this.removeChildren(0,this.children.length)),this.removeFromParent(),this.parent=null,this._maskEffect=null,this._filterEffect=null,this.effects=null,this._position=null,this._scale=null,this._pivot=null,this._skew=null,this.emit("destroyed",this),this.removeAllListeners(),(typeof e=="boolean"?e:e?.children)&&t)for(let s=0;s{fr();Ui=class r{constructor(e){this.bubbles=!0,this.cancelBubble=!0,this.cancelable=!1,this.composed=!1,this.defaultPrevented=!1,this.eventPhase=r.prototype.NONE,this.propagationStopped=!1,this.propagationImmediatelyStopped=!1,this.layer=new de,this.page=new de,this.NONE=0,this.CAPTURING_PHASE=1,this.AT_TARGET=2,this.BUBBLING_PHASE=3,this.manager=e}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(e,t,i){throw new Error("initEvent() is a legacy DOM API. It is not implemented in the Federated Events API.")}initUIEvent(e,t,i,s,o){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}}});function g2(r){return function(e){return e.test(r)}}function Gi(r){var e={userAgent:"",platform:"",maxTouchPoints:0};!r&&typeof navigator<"u"?e={userAgent:navigator.userAgent,platform:navigator.platform,maxTouchPoints:navigator.maxTouchPoints||0}:typeof r=="string"?e.userAgent=r:r&&r.userAgent&&(e={userAgent:r.userAgent,platform:r.platform,maxTouchPoints:r.maxTouchPoints||0});var t=e.userAgent,i=t.split("[FBAN");typeof i[1]<"u"&&(t=i[0]),i=t.split("Twitter"),typeof i[1]<"u"&&(t=i[0]);var s=g2(t),o={apple:{phone:s(fm)&&!s(fi),ipod:s(zv),tablet:!s(fm)&&(s($v)||e0(e))&&!s(fi),universal:s(Xv),device:(s(fm)||s(zv)||s($v)||s(Xv)||e0(e))&&!s(fi)},amazon:{phone:s(vo),tablet:!s(vo)&&s(Hu),device:s(vo)||s(Hu)},android:{phone:!s(fi)&&s(vo)||!s(fi)&&s(pm),tablet:!s(fi)&&!s(vo)&&!s(pm)&&(s(Hu)||s(jv)),device:!s(fi)&&(s(vo)||s(Hu)||s(pm)||s(jv))||s(/\bokhttp\b/i)},windows:{phone:s(fi),tablet:s(Yv),device:s(fi)||s(Yv)},other:{blackberry:s(qv),blackberry10:s(Kv),opera:s(Zv),firefox:s(Jv),chrome:s(Qv),device:s(qv)||s(Kv)||s(Zv)||s(Jv)||s(Qv)},any:!1,phone:!1,tablet:!1};return o.any=o.apple.device||o.android.device||o.windows.device||o.other.device,o.phone=o.apple.phone||o.android.phone||o.windows.phone,o.tablet=o.apple.tablet||o.android.tablet||o.windows.tablet,o}var fm,zv,$v,Xv,pm,jv,vo,Hu,fi,Yv,qv,Kv,Zv,Qv,Jv,e0,mm=y(()=>{fm=/iPhone/i,zv=/iPod/i,$v=/iPad/i,Xv=/\biOS-universal(?:.+)Mac\b/i,pm=/\bAndroid(?:.+)Mobile\b/i,jv=/Android/i,vo=/(?:SD4930UR|\bSilk(?:.+)Mobile\b)/i,Hu=/Silk/i,fi=/Windows Phone/i,Yv=/\bWindows(?:.+)ARM\b/i,qv=/BlackBerry/i,Kv=/BB10/i,Zv=/Opera Mini/i,Qv=/\b(CriOS|Chrome)(?:.+)Mobile/i,Jv=/Mobile(?:.+)Firefox\b/i,e0=function(r){return typeof r<"u"&&r.platform==="MacIntel"&&typeof r.maxTouchPoints=="number"&&r.maxTouchPoints>1&&typeof MSStream>"u"}});var gm=y(()=>{mm();mm()});var x2,t0,r0=y(()=>{gm();x2=Gi.default??Gi,t0=x2(globalThis.navigator)});var y2,Vu,_2,b2,i0,s0,v2,T2,S2,xm,n0,a0=y(()=>{Nu();U();r0();qp();y2=9,Vu=100,_2=0,b2=0,i0=2,s0=1,v2=-1e3,T2=-1e3,S2=2,xm=class o0{constructor(e,t=t0){this._mobileInfo=t,this.debug=!1,this._activateOnTab=!0,this._deactivateOnMouseMove=!0,this._isActive=!1,this._isMobileAccessibility=!1,this._div=null,this._pool=[],this._renderId=0,this._children=[],this._androidUpdateCount=0,this._androidUpdateFrequency=500,this._hookDiv=null,(t.tablet||t.phone)&&this._createTouchHook(),this._renderer=e}get isActive(){return this._isActive}get isMobileAccessibility(){return this._isMobileAccessibility}get hookDiv(){return this._hookDiv}_createTouchHook(){let e=document.createElement("button");e.style.width=`${s0}px`,e.style.height=`${s0}px`,e.style.position="absolute",e.style.top=`${v2}px`,e.style.left=`${T2}px`,e.style.zIndex=S2.toString(),e.style.backgroundColor="#FF0000",e.title="select to enable accessibility for this content",e.addEventListener("focus",()=>{this._isMobileAccessibility=!0,this._activate(),this._destroyTouchHook()}),document.body.appendChild(e),this._hookDiv=e}_destroyTouchHook(){this._hookDiv&&(document.body.removeChild(this._hookDiv),this._hookDiv=null)}_activate(){if(this._isActive)return;this._isActive=!0,this._div||(this._div=document.createElement("div"),this._div.style.width=`${Vu}px`,this._div.style.height=`${Vu}px`,this._div.style.position="absolute",this._div.style.top=`${_2}px`,this._div.style.left=`${b2}px`,this._div.style.zIndex=i0.toString(),this._div.style.pointerEvents="none"),this._activateOnTab&&(this._onKeyDown=this._onKeyDown.bind(this),globalThis.addEventListener("keydown",this._onKeyDown,!1)),this._deactivateOnMouseMove&&(this._onMouseMove=this._onMouseMove.bind(this),globalThis.document.addEventListener("mousemove",this._onMouseMove,!0));let e=this._renderer.view.canvas;if(e.parentNode)e.parentNode.appendChild(this._div),this._initAccessibilitySetup();else{let t=new MutationObserver(()=>{e.parentNode&&(e.parentNode.appendChild(this._div),t.disconnect(),this._initAccessibilitySetup())});t.observe(document.body,{childList:!0,subtree:!0})}}_initAccessibilitySetup(){this._renderer.runners.postrender.add(this),this._renderer.lastObjectRendered&&this._updateAccessibleObjects(this._renderer.lastObjectRendered)}_deactivate(){if(!(!this._isActive||this._isMobileAccessibility)){this._isActive=!1,globalThis.document.removeEventListener("mousemove",this._onMouseMove,!0),this._activateOnTab&&globalThis.addEventListener("keydown",this._onKeyDown,!1),this._renderer.runners.postrender.remove(this);for(let e of this._children)e._accessibleDiv&&e._accessibleDiv.parentNode&&(e._accessibleDiv.parentNode.removeChild(e._accessibleDiv),e._accessibleDiv=null),e._accessibleActive=!1;this._pool.forEach(e=>{e.parentNode&&e.parentNode.removeChild(e)}),this._div&&this._div.parentNode&&this._div.parentNode.removeChild(this._div),this._pool=[],this._children=[]}}_updateAccessibleObjects(e){if(!e.visible||!e.accessibleChildren)return;e.accessible&&(e._accessibleActive||this._addChild(e),e._renderId=this._renderId);let t=e.children;if(t)for(let i=0;i=0;i--){let s=this._children[i];t.has(i)||(s._accessibleDiv&&s._accessibleDiv.parentNode&&(s._accessibleDiv.parentNode.removeChild(s._accessibleDiv),this._pool.push(s._accessibleDiv),s._accessibleDiv=null),s._accessibleActive=!1,Mu(this._children,i,1))}if(this._renderer.renderingToScreen){let{x:i,y:s,width:o,height:n}=this._renderer.screen,a=this._div;a.style.left=`${i}px`,a.style.top=`${s}px`,a.style.width=`${o}px`,a.style.height=`${n}px`}for(let i=0;i title : ${e.title}
tabIndex: ${e.tabIndex}`}_capHitArea(e){e.x<0&&(e.width+=e.x,e.x=0),e.y<0&&(e.height+=e.y,e.y=0);let{width:t,height:i}=this._renderer;e.x+e.width>t&&(e.width=t-e.x),e.y+e.height>i&&(e.height=i-e.y)}_addChild(e){let t=this._pool.pop();t||(e.accessibleType==="button"?t=document.createElement("button"):(t=document.createElement(e.accessibleType),t.style.cssText=` color: transparent; pointer-events: none; padding: 0; @@ -250,7 +250,7 @@ ${s.join(` { return (floor(((position * 0.5 + 0.5) * targetSize) + 0.5) / targetSize) * 2.0 - 1.0; } - `}}});var rg,XT,jT=y(()=>{"use strict";rg=["f32","i32","vec2","vec3","vec4","mat2x2","mat3x3","mat4x4","mat3x2","mat4x2","mat2x3","mat4x3","mat2x4","mat3x4","vec2","vec3","vec4"],XT=rg.reduce((r,e)=>(r[e]=!0,r),{})});function YT(r,e){switch(r){case"f32":return 0;case"vec2":return new Float32Array(2*e);case"vec3":return new Float32Array(3*e);case"vec4":return new Float32Array(4*e);case"mat2x2":return new Float32Array([1,0,0,1]);case"mat3x3":return new Float32Array([1,0,0,0,1,0,0,0,1]);case"mat4x4":return new Float32Array([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])}return null}var qT=y(()=>{"use strict"});var KT,be,It=y(()=>{wt();Ua();jT();qT();KT=class ZT{constructor(e,t){this._touched=0,this.uid=he("uniform"),this._resourceType="uniformGroup",this._resourceId=he("resource"),this.isUniformGroup=!0,this._dirtyId=0,this.destroyed=!1,t={...ZT.defaultOptions,...t},this.uniformStructures=e;let i={};for(let s in e){let o=e[s];if(o.name=s,o.size=o.size??1,!XT[o.type])throw new Error(`Uniform type ${o.type} is not supported. Supported uniform types are: ${rg.join(", ")}`);o.value??(o.value=YT(o.type,o.size)),i[s]=o.value}this.uniforms=i,this._dirtyId=1,this.ubo=t.ubo,this.isStatic=t.isStatic,this._signature=xi(Object.keys(i).map(s=>`${s}-${e[s].type}`).join("-"),"uniform-group")}update(){this._dirtyId++}};KT.defaultOptions={ubo:!1,isStatic:!1};be=KT});function Go(r){let e=QT[r];if(e)return e;let t=new Int32Array(r);for(let i=0;i{It();QT={}});var ot,jr=y(()=>{"use strict";ot=(r=>(r[r.WEBGL=1]="WEBGL",r[r.WEBGPU=2]="WEBGPU",r[r.BOTH=3]="BOTH",r))(ot||{})});var Ze,Mr=y(()=>{Mt();wt();As();Vi();Bo();jr();It();Ze=class r extends Ce{constructor(e){super(),this.uid=he("shader"),this._uniformBindMap=Object.create(null),this._ownedBindGroups=[];let{gpuProgram:t,glProgram:i,groups:s,resources:o,compatibleRenderers:n,groupMap:a}=e;this.gpuProgram=t,this.glProgram=i,n===void 0&&(n=0,t&&(n|=ot.WEBGPU),i&&(n|=ot.WEBGL)),this.compatibleRenderers=n;let l={};if(!o&&!s&&(o={}),o&&s)throw new Error("[Shader] Cannot have both resources and groups");if(!t&&s&&!a)throw new Error("[Shader] No group map or WebGPU shader provided - consider using resources instead.");if(!t&&s&&a)for(let c in a)for(let u in a[c]){let h=a[c][u];l[h]={group:c,binding:u,name:h}}else if(t&&s&&!a){let c=t.structsAndGroups.groups;a={},c.forEach(u=>{a[u.group]=a[u.group]||{},a[u.group][u.binding]=u.name,l[u.name]=u})}else if(o){s={},a={},t&&t.structsAndGroups.groups.forEach(h=>{a[h.group]=a[h.group]||{},a[h.group][h.binding]=h.name,l[h.name]=h});let c=0;for(let u in o)l[u]||(s[99]||(s[99]=new gt,this._ownedBindGroups.push(s[99])),l[u]={group:99,binding:c,name:u},a[99]=a[99]||{},a[99][c]=u,c++);for(let u in o){let h=u,d=o[u];!d.source&&!d._resourceType&&(d=new be(d));let f=l[h];f&&(s[f.group]||(s[f.group]=new gt,this._ownedBindGroups.push(s[f.group])),s[f.group].setResource(d,f.binding))}}this.groups=s,this._uniformBindMap=a,this.resources=this._buildResourceAccessor(s,l)}addResource(e,t,i){var s,o;(s=this._uniformBindMap)[t]||(s[t]={}),(o=this._uniformBindMap[t])[i]||(o[i]=e),this.groups[t]||(this.groups[t]=new gt,this._ownedBindGroups.push(this.groups[t]))}_buildResourceAccessor(e,t){let i={};for(let s in t){let o=t[s];Object.defineProperty(i,o.name,{get(){return e[o.group].getResource(o.binding)},set(n){e[o.group].setResource(n,o.binding)}})}return i}destroy(e=!1){this.emit("destroy",this),e&&(this.gpuProgram?.destroy(),this.glProgram?.destroy()),this.gpuProgram=null,this.glProgram=null,this.removeAllListeners(),this._uniformBindMap=null,this._ownedBindGroups.forEach(t=>{t.destroy()}),this._ownedBindGroups=null,this.resources=null,this.groups=null}static from(e){let{gpu:t,gl:i,...s}=e,o,n;return t&&(o=xr.from(t)),i&&(n=gr.from(i)),new r({gpuProgram:o,glProgram:n,...s})}}});var uh,JT=y(()=>{$i();Ga();La();Xi();ch();Mr();uh=class extends Ze{constructor(e){let t=zr({name:"batch",bits:[Fo,Uo(e),Xr]}),i=Wr({name:"batch",bits:[ko,Oo(e),$r]});super({glProgram:t,gpuProgram:i,resources:{batchSamplers:Go(e)}})}}});var eS,tS,Da,ig=y(()=>{U();q0();J0();JT();eS=null,tS=class rS extends Y0{constructor(){super(...arguments),this.geometry=new nh,this.shader=eS||(eS=new uh(this.maxTextures)),this.name=rS.extension.name,this.vertexSize=6}packAttributes(e,t,i,s,o){let n=o<<16|e.roundPixels&65535,a=e.transform,l=a.a,c=a.b,u=a.c,h=a.d,d=a.tx,f=a.ty,{positions:p,uvs:m}=e,g=e.color,_=e.attributeOffset,v=_+e.attributeSize;for(let x=_;x{"use strict"});function sg(r,e,t,i,s){let o=e.a,n=e.b,a=e.c,l=e.d,c=e.tx,u=e.ty;t||(t=0),i||(i=2),s||(s=r.length/i-t);let h=t*i;for(let d=0;d{"use strict"});var Z2,Cs,og=y(()=>{ge();Zp();Z2=new G,Cs=class{constructor(){this.packAsQuad=!1,this.batcherName="default",this.topology="triangle-list",this.applyTransform=!0,this.roundPixels=0,this._batcher=null,this._batch=null}get uvs(){return this.geometryData.uvs}get positions(){return this.geometryData.vertices}get indices(){return this.geometryData.indices}get blendMode(){return this.applyTransform?this.renderable.groupBlendMode:"normal"}get color(){let e=this.baseColor,t=e>>16|e&65280|(e&255)<<16,i=this.renderable;return i?Fu(t,i.groupColor)+(this.alpha*i.groupAlpha*255<<24):t+(this.alpha*255<<24)}get transform(){return this.renderable?.groupTransform||Z2}copyTo(e){e.indexOffset=this.indexOffset,e.indexSize=this.indexSize,e.attributeOffset=this.attributeOffset,e.attributeSize=this.attributeSize,e.baseColor=this.baseColor,e.alpha=this.alpha,e.texture=this.texture,e.geometryData=this.geometryData,e.topology=this.topology}reset(){this.applyTransform=!0,this.renderable=null,this.topology="triangle-list"}}});var Lo,aS,lS,cS=y(()=>{U();Lo={extension:{type:S.ShapeBuilder,name:"circle"},build(r,e){let t,i,s,o,n,a;if(r.type==="circle"){let T=r;t=T.x,i=T.y,n=a=T.radius,s=o=0}else if(r.type==="ellipse"){let T=r;t=T.x,i=T.y,n=T.halfWidth,a=T.halfHeight,s=o=0}else{let T=r,b=T.width/2,w=T.height/2;t=T.x+b,i=T.y+w,n=a=Math.max(0,Math.min(T.radius,Math.min(b,w))),s=b-n,o=w-a}if(!(n>=0&&a>=0&&s>=0&&o>=0))return e;let l=Math.ceil(2.3*Math.sqrt(n+a)),c=l*8+(s?4:0)+(o?4:0);if(c===0)return e;if(l===0)return e[0]=e[6]=t+s,e[1]=e[3]=i+o,e[2]=e[4]=t-s,e[5]=e[7]=i-o,e;let u=0,h=l*4+(s?2:0)+2,d=h,f=c,p=s+n,m=o,g=t+p,_=t-p,v=i+m;if(e[u++]=g,e[u++]=v,e[--h]=v,e[--h]=_,o){let T=i-m;e[d++]=_,e[d++]=T,e[--f]=T,e[--f]=g}for(let T=1;T0&&(s[o++]=l,s[o++]=c,s[o++]=l-1),l++;s[o++]=c+1,s[o++]=c,s[o++]=l-1}},aS={...Lo,extension:{...Lo.extension,name:"ellipse"}},lS={...Lo,extension:{...Lo.extension,name:"roundedRectangle"}}});function uS(r){let e=r.length;if(e<6)return 1;let t=0;for(let i=0,s=r[e-2],o=r[e-1];i{"use strict"});function dS(r,e,t,i,s,o,n,a){let l=r-t*s,c=e-i*s,u=r+t*o,h=e+i*o,d,f;n?(d=i,f=-t):(d=-i,f=t);let p=l+d,m=c+f,g=u+d,_=h+f;return a.push(p,m),a.push(g,_),2}function Ms(r,e,t,i,s,o,n,a){let l=t-r,c=i-e,u=Math.atan2(l,c),h=Math.atan2(s-r,o-e);a&&uh&&(h+=Math.PI*2);let d=u,f=h-u,p=Math.abs(f),m=Math.sqrt(l*l+c*c),g=(15*p*Math.sqrt(m)/Math.PI>>0)+1,_=f/g;if(d+=_,a){n.push(r,e),n.push(t,i);for(let v=1,x=d;v=0&&(a.join==="round"?m+=Ms(w,E,w-C*O,E-A*O,w-P*O,E-R*O,f,!1)+4:m+=2,f.push(w-P*D,E-R*D),f.push(w+P*O,E+R*O));continue}let it=(-C+T)*(-A+E)-(-C+w)*(-A+b),bt=(-P+I)*(-R+E)-(-P+w)*(-R+B),Le=(Y*bt-J*it)/Me,vt=(Be*it-ue*bt)/Me,Ft=(Le-w)*(Le-w)+(vt-E)*(vt-E),Pt=w+(Le-w)*O,Ot=E+(vt-E)*O,Ar=w-(Le-w)*D,ds=E-(vt-E)*D,zF=Math.min(Y*Y+ue*ue,J*J+Be*Be),Ob=$e?O:D,$F=zF+Ob*Ob*v;Ft<=$F?a.join==="bevel"||Ft/v>x?($e?(f.push(Pt,Ot),f.push(w+C*D,E+A*D),f.push(Pt,Ot),f.push(w+P*D,E+R*D)):(f.push(w-C*O,E-A*O),f.push(Ar,ds),f.push(w-P*O,E-R*O),f.push(Ar,ds)),m+=2):a.join==="round"?$e?(f.push(Pt,Ot),f.push(w+C*D,E+A*D),m+=Ms(w,E,w+C*D,E+A*D,w+P*D,E+R*D,f,!0)+4,f.push(Pt,Ot),f.push(w+P*D,E+R*D)):(f.push(w-C*O,E-A*O),f.push(Ar,ds),m+=Ms(w,E,w-C*O,E-A*O,w-P*O,E-R*O,f,!1)+4,f.push(w-P*O,E-R*O),f.push(Ar,ds)):(f.push(Pt,Ot),f.push(Ar,ds)):(f.push(w-C*O,E-A*O),f.push(w+C*D,E+A*D),a.join==="round"?$e?m+=Ms(w,E,w+C*D,E+A*D,w+P*D,E+R*D,f,!0)+2:m+=Ms(w,E,w-C*O,E-A*O,w-P*O,E-R*O,f,!1)+2:a.join==="miter"&&Ft/v<=x&&($e?(f.push(Ar,ds),f.push(Ar,ds)):(f.push(Pt,Ot),f.push(Pt,Ot)),m+=2),f.push(w-P*O,E-R*O),f.push(w+P*D,E+R*D),m+=2)}T=r[(p-2)*2],b=r[(p-2)*2+1],w=r[(p-1)*2],E=r[(p-1)*2+1],C=-(b-E),A=T-w,M=Math.sqrt(C*C+A*A),C/=M,A/=M,C*=_,A*=_,f.push(w-C*O,E-A*O),f.push(w+C*D,E+A*D),h||(a.cap==="round"?m+=Ms(w-C*(O-D)*.5,E-A*(O-D)*.5,w-C*O,E-A*O,w+C*D,E+A*D,f,!1)+2:a.cap==="square"&&(m+=dS(w,E,C,A,O,D,!1,f)));let N=1e-4*1e-4;for(let L=g;L{fr();hS()});function mS(r,e,t,i){let s=1e-4;if(r.length===0)return;let o=r[0],n=r[1],a=r[r.length-2],l=r[r.length-1],c=e||Math.abs(o-a){});var mh=ee((nj,cg)=>{"use strict";cg.exports=fh;cg.exports.default=fh;function fh(r,e,t){t=t||2;var i=e&&e.length,s=i?e[0]*t:r.length,o=yS(r,0,s,t,!0),n=[];if(!o||o.next===o.prev)return n;var a,l,c,u,h,d,f;if(i&&(o=sO(r,e,o,t)),r.length>80*t){a=c=r[0],l=u=r[1];for(var p=t;pc&&(c=h),d>u&&(u=d);f=Math.max(c-a,u-l),f=f!==0?32767/f:0}return Na(o,n,t,a,l,f,0),n}function yS(r,e,t,i,s){var o,n;if(s===lg(r,e,t,i)>0)for(o=e;o=e;o-=i)n=xS(o,r[o],r[o+1],n);return n&&ph(n,n.next)&&(Va(n),n=n.next),n}function Rs(r,e){if(!r)return r;e||(e=r);var t=r,i;do if(i=!1,!t.steiner&&(ph(t,t.next)||Ye(t.prev,t,t.next)===0)){if(Va(t),t=e=t.prev,t===t.next)break;i=!0}else t=t.next;while(i||t!==e);return e}function Na(r,e,t,i,s,o,n){if(r){!n&&o&&cO(r,i,s,o);for(var a=r,l,c;r.prev!==r.next;){if(l=r.prev,c=r.next,o?tO(r,i,s,o):eO(r)){e.push(l.i/t|0),e.push(r.i/t|0),e.push(c.i/t|0),Va(r),r=c.next,a=c.next;continue}if(r=c,r===a){n?n===1?(r=rO(Rs(r),e,t),Na(r,e,t,i,s,o,2)):n===2&&iO(r,e,t,i,s,o):Na(Rs(r),e,t,i,s,o,1);break}}}}function eO(r){var e=r.prev,t=r,i=r.next;if(Ye(e,t,i)>=0)return!1;for(var s=e.x,o=t.x,n=i.x,a=e.y,l=t.y,c=i.y,u=so?s>n?s:n:o>n?o:n,f=a>l?a>c?a:c:l>c?l:c,p=i.next;p!==e;){if(p.x>=u&&p.x<=d&&p.y>=h&&p.y<=f&&Do(s,a,o,l,n,c,p.x,p.y)&&Ye(p.prev,p,p.next)>=0)return!1;p=p.next}return!0}function tO(r,e,t,i){var s=r.prev,o=r,n=r.next;if(Ye(s,o,n)>=0)return!1;for(var a=s.x,l=o.x,c=n.x,u=s.y,h=o.y,d=n.y,f=al?a>c?a:c:l>c?l:c,g=u>h?u>d?u:d:h>d?h:d,_=ng(f,p,e,t,i),v=ng(m,g,e,t,i),x=r.prevZ,T=r.nextZ;x&&x.z>=_&&T&&T.z<=v;){if(x.x>=f&&x.x<=m&&x.y>=p&&x.y<=g&&x!==s&&x!==n&&Do(a,u,l,h,c,d,x.x,x.y)&&Ye(x.prev,x,x.next)>=0||(x=x.prevZ,T.x>=f&&T.x<=m&&T.y>=p&&T.y<=g&&T!==s&&T!==n&&Do(a,u,l,h,c,d,T.x,T.y)&&Ye(T.prev,T,T.next)>=0))return!1;T=T.nextZ}for(;x&&x.z>=_;){if(x.x>=f&&x.x<=m&&x.y>=p&&x.y<=g&&x!==s&&x!==n&&Do(a,u,l,h,c,d,x.x,x.y)&&Ye(x.prev,x,x.next)>=0)return!1;x=x.prevZ}for(;T&&T.z<=v;){if(T.x>=f&&T.x<=m&&T.y>=p&&T.y<=g&&T!==s&&T!==n&&Do(a,u,l,h,c,d,T.x,T.y)&&Ye(T.prev,T,T.next)>=0)return!1;T=T.nextZ}return!0}function rO(r,e,t){var i=r;do{var s=i.prev,o=i.next.next;!ph(s,o)&&_S(s,i,i.next,o)&&Ha(s,o)&&Ha(o,s)&&(e.push(s.i/t|0),e.push(i.i/t|0),e.push(o.i/t|0),Va(i),Va(i.next),i=r=o),i=i.next}while(i!==r);return Rs(i)}function iO(r,e,t,i,s,o){var n=r;do{for(var a=n.next.next;a!==n.prev;){if(n.i!==a.i&&dO(n,a)){var l=bS(n,a);n=Rs(n,n.next),l=Rs(l,l.next),Na(n,e,t,i,s,o,0),Na(l,e,t,i,s,o,0);return}a=a.next}n=n.next}while(n!==r)}function sO(r,e,t,i){var s=[],o,n,a,l,c;for(o=0,n=e.length;o=t.next.y&&t.next.y!==t.y){var a=t.x+(s-t.y)*(t.next.x-t.x)/(t.next.y-t.y);if(a<=i&&a>o&&(o=a,n=t.x=t.x&&t.x>=c&&i!==t.x&&Do(sn.x||t.x===n.x&&lO(n,t)))&&(n=t,h=d)),t=t.next;while(t!==l);return n}function lO(r,e){return Ye(r.prev,r,e.prev)<0&&Ye(e.next,r,r.next)<0}function cO(r,e,t,i){var s=r;do s.z===0&&(s.z=ng(s.x,s.y,e,t,i)),s.prevZ=s.prev,s.nextZ=s.next,s=s.next;while(s!==r);s.prevZ.nextZ=null,s.prevZ=null,uO(s)}function uO(r){var e,t,i,s,o,n,a,l,c=1;do{for(t=r,r=null,o=null,n=0;t;){for(n++,i=t,a=0,e=0;e0||l>0&&i;)a!==0&&(l===0||!i||t.z<=i.z)?(s=t,t=t.nextZ,a--):(s=i,i=i.nextZ,l--),o?o.nextZ=s:r=s,s.prevZ=o,o=s;t=i}o.nextZ=null,c*=2}while(n>1);return r}function ng(r,e,t,i,s){return r=(r-t)*s|0,e=(e-i)*s|0,r=(r|r<<8)&16711935,r=(r|r<<4)&252645135,r=(r|r<<2)&858993459,r=(r|r<<1)&1431655765,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,r|e<<1}function hO(r){var e=r,t=r;do(e.x=(r-n)*(o-a)&&(r-n)*(i-a)>=(t-n)*(e-a)&&(t-n)*(o-a)>=(s-n)*(i-a)}function dO(r,e){return r.next.i!==e.i&&r.prev.i!==e.i&&!fO(r,e)&&(Ha(r,e)&&Ha(e,r)&&pO(r,e)&&(Ye(r.prev,r,e.prev)||Ye(r,e.prev,e))||ph(r,e)&&Ye(r.prev,r,r.next)>0&&Ye(e.prev,e,e.next)>0)}function Ye(r,e,t){return(e.y-r.y)*(t.x-e.x)-(e.x-r.x)*(t.y-e.y)}function ph(r,e){return r.x===e.x&&r.y===e.y}function _S(r,e,t,i){var s=dh(Ye(r,e,t)),o=dh(Ye(r,e,i)),n=dh(Ye(t,i,r)),a=dh(Ye(t,i,e));return!!(s!==o&&n!==a||s===0&&hh(r,t,e)||o===0&&hh(r,i,e)||n===0&&hh(t,r,i)||a===0&&hh(t,e,i))}function hh(r,e,t){return e.x<=Math.max(r.x,t.x)&&e.x>=Math.min(r.x,t.x)&&e.y<=Math.max(r.y,t.y)&&e.y>=Math.min(r.y,t.y)}function dh(r){return r>0?1:r<0?-1:0}function fO(r,e){var t=r;do{if(t.i!==r.i&&t.next.i!==r.i&&t.i!==e.i&&t.next.i!==e.i&&_S(t,t.next,r,e))return!0;t=t.next}while(t!==r);return!1}function Ha(r,e){return Ye(r.prev,r,r.next)<0?Ye(r,e,r.next)>=0&&Ye(r,r.prev,e)>=0:Ye(r,e,r.prev)<0||Ye(r,r.next,e)<0}function pO(r,e){var t=r,i=!1,s=(r.x+e.x)/2,o=(r.y+e.y)/2;do t.y>o!=t.next.y>o&&t.next.y!==t.y&&s<(t.next.x-t.x)*(o-t.y)/(t.next.y-t.y)+t.x&&(i=!i),t=t.next;while(t!==r);return i}function bS(r,e){var t=new ag(r.i,r.x,r.y),i=new ag(e.i,e.x,e.y),s=r.next,o=e.prev;return r.next=e,e.prev=r,t.next=s,s.prev=t,i.next=t,t.prev=i,o.next=i,i.prev=o,i}function xS(r,e,t,i){var s=new ag(r,e,t);return i?(s.next=i.next,s.prev=i,i.next.prev=s,i.next=s):(s.prev=s,s.next=s),s}function Va(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 ag(r,e,t){this.i=r,this.x=e,this.y=t,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}fh.deviation=function(r,e,t,i){var s=e&&e.length,o=s?e[0]*t:r.length,n=Math.abs(lg(r,0,o,t));if(s)for(var a=0,l=e.length;a0&&(i+=r[s-1].length,t.holes.push(i))}return t}});function gh(r,e,t,i,s,o,n){let a=(0,vS.default)(r,e,2);if(!a)return;for(let c=0;c{vS=fs(mh(),1)});var mO,TS,SS=y(()=>{U();ug();mO=[],TS={extension:{type:S.ShapeBuilder,name:"polygon"},build(r,e){for(let t=0;t{U();wS={extension:{type:S.ShapeBuilder,name:"rectangle"},build(r,e){let t=r,i=t.x,s=t.y,o=t.width,n=t.height;return o>=0&&n>=0&&(e[0]=i,e[1]=s,e[2]=i+o,e[3]=s,e[4]=i+o,e[5]=s+n,e[6]=i,e[7]=s+n),e},triangulate(r,e,t,i,s,o){let n=0;i*=t,e[i+n]=r[0],e[i+n+1]=r[1],n+=t,e[i+n]=r[2],e[i+n+1]=r[3],n+=t,e[i+n]=r[6],e[i+n+1]=r[7],n+=t,e[i+n]=r[4],e[i+n+1]=r[5],n+=t;let a=i/t;s[o++]=a,s[o++]=a+1,s[o++]=a+2,s[o++]=a+1,s[o++]=a+3,s[o++]=a+2}}});var AS,PS=y(()=>{U();AS={extension:{type:S.ShapeBuilder,name:"triangle"},build(r,e){return e[0]=r.x,e[1]=r.y,e[2]=r.x2,e[3]=r.y2,e[4]=r.x3,e[5]=r.y3,e},triangulate(r,e,t,i,s,o){let n=0;i*=t,e[i+n]=r[0],e[i+n+1]=r[1],n+=t,e[i+n]=r[2],e[i+n+1]=r[3],n+=t,e[i+n]=r[4],e[i+n+1]=r[5];let a=i/t;s[o++]=a,s[o++]=a+1,s[o++]=a+2}}});function MS(r,e){for(let t=0;t{Tt();Re();ge();Ao();ve();wt();Xe();im();CS=[{offset:0,color:"white"},{offset:1,color:"black"}],dg=class hg{constructor(...e){this.uid=he("fillGradient"),this.type="linear",this.colorStops=[];let t=gO(e);t={...t.type==="radial"?hg.defaultRadialOptions:hg.defaultLinearOptions,...Uu(t)},this._textureSize=t.textureSize,this._wrapMode=t.wrapMode,t.type==="radial"?(this.center=t.center,this.outerCenter=t.outerCenter??this.center,this.innerRadius=t.innerRadius,this.outerRadius=t.outerRadius,this.scale=t.scale,this.rotation=t.rotation):(this.start=t.start,this.end=t.end),this.textureSpace=t.textureSpace,this.type=t.type,t.colorStops.forEach(s=>{this.addColorStop(s.offset,s.color)})}addColorStop(e,t){return this.colorStops.push({offset:e,color:oe.shared.setValue(t).toHexa()}),this}buildLinearGradient(){if(this.texture)return;let{x:e,y:t}=this.start,{x:i,y:s}=this.end,o=i-e,n=s-t,a=o<0||n<0;if(this._wrapMode==="clamp-to-edge"){if(o<0){let g=e;e=i,i=g,o*=-1}if(n<0){let g=t;t=s,s=g,n*=-1}}let l=this.colorStops.length?this.colorStops:CS,c=this._textureSize,{canvas:u,context:h}=RS(c,1),d=a?h.createLinearGradient(this._textureSize,0,0,0):h.createLinearGradient(0,0,this._textureSize,0);MS(d,l),h.fillStyle=d,h.fillRect(0,0,c,1),this.texture=new k({source:new jt({resource:u,addressMode:this._wrapMode})});let f=Math.sqrt(o*o+n*n),p=Math.atan2(n,o),m=new G;m.scale(f/c,1),m.rotate(p),m.translate(e,t),this.textureSpace==="local"&&m.scale(c,c),this.transform=m}buildGradient(){this.type==="linear"?this.buildLinearGradient():this.buildRadialGradient()}buildRadialGradient(){if(this.texture)return;let e=this.colorStops.length?this.colorStops:CS,t=this._textureSize,{canvas:i,context:s}=RS(t,t),{x:o,y:n}=this.center,{x:a,y:l}=this.outerCenter,c=this.innerRadius,u=this.outerRadius,h=a-u,d=l-u,f=t/(u*2),p=(o-h)*f,m=(n-d)*f,g=s.createRadialGradient(p,m,c*f,(a-h)*f,(l-d)*f,u*f);MS(g,e),s.fillStyle=e[e.length-1].color,s.fillRect(0,0,t,t),s.fillStyle=g,s.translate(p,m),s.rotate(this.rotation),s.scale(1,this.scale),s.translate(-p,-m),s.fillRect(0,0,t,t),this.texture=new k({source:new jt({resource:i,addressMode:this._wrapMode})});let _=new G;_.scale(1/f,1/f),_.translate(h,d),this.textureSpace==="local"&&_.scale(t,t),this.transform=_}get styleKey(){return this.uid}destroy(){this.texture?.destroy(!0),this.texture=null}};dg.defaultLinearOptions={start:{x:0,y:0},end:{x:0,y:1},colorStops:[],textureSpace:"local",type:"linear",textureSize:256,wrapMode:"clamp-to-edge"};dg.defaultRadialOptions={center:{x:.5,y:.5},innerRadius:0,outerRadius:.5,colorStops:[],scale:1,textureSpace:"local",type:"radial",textureSize:256,wrapMode:"clamp-to-edge"};qt=dg});function IS(r,e,t,i){let s=e.matrix?r.copyFrom(e.matrix).invert():r.identity();if(e.textureSpace==="local"){let n=t.getBounds(yO);e.width&&n.pad(e.width);let{x:a,y:l}=n,c=1/n.width,u=1/n.height,h=-a*c,d=-l*u,f=s.a,p=s.b,m=s.c,g=s.d;s.a*=c,s.b*=c,s.c*=u,s.d*=u,s.tx=h*f+d*m+s.tx,s.ty=h*p+d*g+s.ty}else s.translate(e.texture.frame.x,e.texture.frame.y),s.scale(1/e.texture.source.width,1/e.texture.source.height);let o=e.texture.source.style;return!(e.fill instanceof qt)&&o.addressMode==="clamp-to-edge"&&(o.addressMode="repeat",o.update()),i&&s.append(xO.copyFrom(i).invert()),s}var xO,yO,BS=y(()=>{ge();ut();No();xO=new G,yO=new Q});function FS(r,e){let{geometryData:t,batches:i}=e;i.length=0,t.indices.length=0,t.vertices.length=0,t.uvs.length=0;for(let s=0;s{let h=a.length,d=o.length/2,f=[],p=xh[l.type],m="triangle-list";if(p.build(l,f),c&&sg(f,c),t){let x=l.closePath??!0,T=e;T.pixelLine?(mS(f,x,o,a),m="line-list"):fS(f,T,!1,x,o,a)}else if(u){let x=[],T=f.slice();TO(u).forEach(w=>{x.push(T.length/2),T.push(...w)}),gh(T,x,o,2,d,a,h)}else p.triangulate(f,o,2,d,a,h);let g=n.length/2,_=e.texture;if(_!==k.WHITE){let x=IS(bO,e,l,c);iS(o,2,d,n,g,2,o.length/2-d,x)}else sS(n,g,2,o.length/2-d);let v=se.get(Cs);v.indexOffset=h,v.indexSize=a.length-h,v.attributeOffset=d,v.attributeSize=o.length/2-d,v.baseColor=e.color,v.alpha=e.alpha,v.texture=_,v.geometryData=s,v.topology=m,i.push(v)})}function TO(r){let e=[];for(let t=0;t{U();ge();ut();oS();nS();ve();Gt();og();cS();pS();gS();SS();ES();PS();BS();ug();xh={};V.handleByMap(S.ShapeBuilder,xh);V.add(wS,TS,AS,Lo,aS,lS);_O=new Q,bO=new G});var fg,pg,gg,Ho,yh=y(()=>{U();ih();ig();tm();Xe();Gt();OS();fg=class{constructor(){this.batches=[],this.geometryData={vertices:[],uvs:[],indices:[]}}},pg=class{constructor(){this.batcher=new Da,this.instructions=new yo}init(){this.instructions.reset()}get geometry(){return X(rv,"GraphicsContextRenderData#geometry is deprecated, please use batcher.geometry instead."),this.batcher.geometry}},gg=class mg{constructor(e){this._gpuContextHash={},this._graphicsDataContextHash=Object.create(null),e.renderableGC.addManagedHash(this,"_gpuContextHash"),e.renderableGC.addManagedHash(this,"_graphicsDataContextHash")}init(e){mg.defaultOptions.bezierSmoothness=e?.bezierSmoothness??mg.defaultOptions.bezierSmoothness}getContextRenderData(e){return this._graphicsDataContextHash[e.uid]||this._initContextRenderData(e)}updateGpuContext(e){let t=this._gpuContextHash[e.uid]||this._initContext(e);if(e.dirty){t?this._cleanGraphicsContextData(e):t=this._initContext(e),FS(e,t);let i=e.batchMode;e.customShader||i==="no-batch"?t.isBatchable=!1:i==="auto"&&(t.isBatchable=t.geometryData.vertices.length<400),e.dirty=!1}return t}getGpuContext(e){return this._gpuContextHash[e.uid]||this._initContext(e)}_initContextRenderData(e){let t=se.get(pg),{batches:i,geometryData:s}=this._gpuContextHash[e.uid],o=s.vertices.length,n=s.indices.length;for(let u=0;u{se.return(i)})}destroy(){for(let e in this._gpuContextHash)this._gpuContextHash[e]&&this.onGraphicsContextDestroy(this._gpuContextHash[e].context)}};gg.extension={type:[S.WebGLSystem,S.WebGPUSystem,S.CanvasSystem],name:"graphicsContext"};gg.defaultOptions={bezierSmoothness:.5};Ho=gg});var SO,xg,yg,_g,bg,vg,Tg,Sg,Je,Rr=y(()=>{"use strict";SO={normal:0,add:1,multiply:2,screen:3,overlay:4,erase:5,"normal-npm":6,"add-npm":7,"screen-npm":8,min:9,max:10},xg=0,yg=1,_g=2,bg=3,vg=4,Tg=5,Sg=class US{constructor(){this.data=0,this.blendMode="normal",this.polygonOffset=0,this.blend=!0,this.depthMask=!0}get blend(){return!!(this.data&1<>24&255)/255;e[t++]=(r&255)/255*i,e[t++]=(r>>8&255)/255*i,e[t++]=(r>>16&255)/255*i,e[t++]=i}var Vo=y(()=>{"use strict"});var Wa,GS=y(()=>{U();Rr();Gt();Vo();og();Wa=class{constructor(e,t){this.state=Je.for2d(),this._graphicsBatchesHash=Object.create(null),this._destroyRenderableBound=this.destroyRenderable.bind(this),this.renderer=e,this._adaptor=t,this._adaptor.init(),this.renderer.renderableGC.addManagedHash(this,"_graphicsBatchesHash")}validateRenderable(e){let t=e.context,i=!!this._graphicsBatchesHash[e.uid],s=this.renderer.graphicsContext.updateGpuContext(t);return!!(s.isBatchable||i!==s.isBatchable)}addRenderable(e,t){let i=this.renderer.graphicsContext.updateGpuContext(e.context);e.didViewUpdate&&this._rebuild(e),i.isBatchable?this._addToBatcher(e,t):(this.renderer.renderPipes.batch.break(t),t.add(e))}updateRenderable(e){let t=this._graphicsBatchesHash[e.uid];if(t)for(let i=0;i{let a=se.get(Cs);return n.copyTo(a),a.renderable=e,a.roundPixels=s,a});return this._graphicsBatchesHash[e.uid]===void 0&&e.on("destroyed",this._destroyRenderableBound),this._graphicsBatchesHash[e.uid]=o,o}_removeBatchForRenderable(e){this._graphicsBatchesHash[e].forEach(t=>{se.return(t)}),this._graphicsBatchesHash[e]=null}destroy(){this.renderer=null,this._adaptor.destroy(),this._adaptor=null,this.state=null;for(let e in this._graphicsBatchesHash)this._removeBatchForRenderable(e);this._graphicsBatchesHash=null}};Wa.extension={type:[S.WebGLPipes,S.WebGPUPipes,S.CanvasPipes],name:"graphics"}});var wg=y(()=>{U();yh();GS();V.add(Wa);V.add(Ho)});var ji,_h=y(()=>{"use strict";ji=class{constructor(){this.batcherName="default",this.packAsQuad=!1,this.indexOffset=0,this.attributeOffset=0,this.roundPixels=0,this._batcher=null,this._batch=null,this._textureMatrixUpdateId=-1,this._uvUpdateId=-1}get blendMode(){return this.renderable.groupBlendMode}get topology(){return this._topology||this.geometry.topology}set topology(e){this._topology=e}reset(){this.renderable=null,this.texture=null,this._batcher=null,this._batch=null,this.geometry=null,this._uvUpdateId=-1,this._textureMatrixUpdateId=-1}setTexture(e){this.texture!==e&&(this.texture=e,this._textureMatrixUpdateId=-1)}get uvs(){let t=this.geometry.getBuffer("aUV"),i=t.data,s=i,o=this.texture.textureMatrix;return o.isSimple||(s=this._transformedUvs,(this._textureMatrixUpdateId!==o._updateID||this._uvUpdateId!==t._updateID)&&((!s||s.length{U();ge();Vi();It();Fa();Gt();Vo();_h();za=class{constructor(e,t){this.localUniforms=new be({uTransformMatrix:{value:new G,type:"mat3x3"},uColor:{value:new Float32Array([1,1,1,1]),type:"vec4"},uRound:{value:0,type:"f32"}}),this.localUniformsBindGroup=new gt({0:this.localUniforms}),this._meshDataHash=Object.create(null),this._gpuBatchableMeshHash=Object.create(null),this._destroyRenderableBound=this.destroyRenderable.bind(this),this.renderer=e,this._adaptor=t,this._adaptor.init(),e.renderableGC.addManagedHash(this,"_gpuBatchableMeshHash"),e.renderableGC.addManagedHash(this,"_meshDataHash")}validateRenderable(e){let t=this._getMeshData(e),i=t.batched,s=e.batched;if(t.batched=s,i!==s)return!0;if(s){let o=e._geometry;if(o.indices.length!==t.indexSize||o.positions.length!==t.vertexSize)return t.indexSize=o.indices.length,t.vertexSize=o.positions.length,!0;let n=this._getBatchableMesh(e);return n.texture.uid!==e._texture.uid&&(n._textureMatrixUpdateId=-1),!n._batcher.checkAndUpdateTexture(n,e._texture)}return!1}addRenderable(e,t){let i=this.renderer.renderPipes.batch,{batched:s}=this._getMeshData(e);if(s){let o=this._getBatchableMesh(e);o.setTexture(e._texture),o.geometry=e._geometry,i.addToBatch(o,t)}else i.break(t),t.add(e)}updateRenderable(e){if(e.batched){let t=this._gpuBatchableMeshHash[e.uid];t.setTexture(e._texture),t.geometry=e._geometry,t._batcher.updateElement(t)}}destroyRenderable(e){this._meshDataHash[e.uid]=null;let t=this._gpuBatchableMeshHash[e.uid];t&&(se.return(t),this._gpuBatchableMeshHash[e.uid]=null),e.off("destroyed",this._destroyRenderableBound)}execute(e){if(!e.isRenderable)return;e.state.blendMode=mi(e.groupBlendMode,e.texture._source);let t=this.localUniforms;t.uniforms.uTransformMatrix=e.groupTransform,t.uniforms.uRound=this.renderer._roundPixels|e._roundPixels,t.update(),Yr(e.groupColorAlpha,t.uniforms.uColor,0),this._adaptor.execute(this,e)}_getMeshData(e){return this._meshDataHash[e.uid]||this._initMeshData(e)}_initMeshData(e){return this._meshDataHash[e.uid]={batched:e.batched,indexSize:e._geometry.indices?.length,vertexSize:e._geometry.positions?.length},e.on("destroyed",this._destroyRenderableBound),this._meshDataHash[e.uid]}_getBatchableMesh(e){return this._gpuBatchableMeshHash[e.uid]||this._initBatchableMesh(e)}_initBatchableMesh(e){let t=se.get(ji);return t.renderable=e,t.setTexture(e._texture),t.transform=e.groupTransform,t.roundPixels=this.renderer._roundPixels|e._roundPixels,this._gpuBatchableMeshHash[e.uid]=t,t}destroy(){for(let e in this._gpuBatchableMeshHash)this._gpuBatchableMeshHash[e]&&se.return(this._gpuBatchableMeshHash[e]);this._gpuBatchableMeshHash=null,this._meshDataHash=null,this.localUniforms=null,this.localUniformsBindGroup=null,this._adaptor.destroy(),this._adaptor=null,this.renderer=null}};za.extension={type:[S.WebGLPipes,S.WebGPUPipes,S.CanvasPipes],name:"mesh"}});var Eg=y(()=>{U();LS();V.add(za)});var bh,DS=y(()=>{"use strict";bh=class{execute(e,t){let i=e.state,s=e.renderer,o=t.shader||e.defaultShader;o.resources.uTexture=t.texture._source,o.resources.uniforms=e.localUniforms;let n=s.gl,a=e.getBuffers(t);s.shader.bind(o),s.state.set(i),s.geometry.bind(a.geometry,o.glProgram);let c=a.geometry.indexBuffer.data.BYTES_PER_ELEMENT===2?n.UNSIGNED_SHORT:n.UNSIGNED_INT;n.drawElements(n.TRIANGLES,t.particleChildren.length*6,c,0)}}});function Ag(r,e=null){let t=r*6;if(t>65535?e||(e=new Uint32Array(t)):e||(e=new Uint16Array(t)),e.length!==t)throw new Error(`Out buffer length is incorrect, got ${e.length} and expected ${t}`);for(let i=0,s=0;i{"use strict"});function VS(r){return{dynamicUpdate:HS(r,!0),staticUpdate:HS(r,!1)}}function HS(r,e){let t=[];t.push(` + `}}});var rg,XT,jT=y(()=>{"use strict";rg=["f32","i32","vec2","vec3","vec4","mat2x2","mat3x3","mat4x4","mat3x2","mat4x2","mat2x3","mat4x3","mat2x4","mat3x4","vec2","vec3","vec4"],XT=rg.reduce((r,e)=>(r[e]=!0,r),{})});function YT(r,e){switch(r){case"f32":return 0;case"vec2":return new Float32Array(2*e);case"vec3":return new Float32Array(3*e);case"vec4":return new Float32Array(4*e);case"mat2x2":return new Float32Array([1,0,0,1]);case"mat3x3":return new Float32Array([1,0,0,0,1,0,0,0,1]);case"mat4x4":return new Float32Array([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])}return null}var qT=y(()=>{"use strict"});var KT,be,It=y(()=>{wt();Ua();jT();qT();KT=class ZT{constructor(e,t){this._touched=0,this.uid=he("uniform"),this._resourceType="uniformGroup",this._resourceId=he("resource"),this.isUniformGroup=!0,this._dirtyId=0,this.destroyed=!1,t={...ZT.defaultOptions,...t},this.uniformStructures=e;let i={};for(let s in e){let o=e[s];if(o.name=s,o.size=o.size??1,!XT[o.type])throw new Error(`Uniform type ${o.type} is not supported. Supported uniform types are: ${rg.join(", ")}`);o.value??(o.value=YT(o.type,o.size)),i[s]=o.value}this.uniforms=i,this._dirtyId=1,this.ubo=t.ubo,this.isStatic=t.isStatic,this._signature=xi(Object.keys(i).map(s=>`${s}-${e[s].type}`).join("-"),"uniform-group")}update(){this._dirtyId++}};KT.defaultOptions={ubo:!1,isStatic:!1};be=KT});function Go(r){let e=QT[r];if(e)return e;let t=new Int32Array(r);for(let i=0;i{It();QT={}});var ot,jr=y(()=>{"use strict";ot=(r=>(r[r.WEBGL=1]="WEBGL",r[r.WEBGPU=2]="WEBGPU",r[r.BOTH=3]="BOTH",r))(ot||{})});var Ze,Mr=y(()=>{Mt();wt();As();Vi();Bo();jr();It();Ze=class r extends Ce{constructor(e){super(),this.uid=he("shader"),this._uniformBindMap=Object.create(null),this._ownedBindGroups=[];let{gpuProgram:t,glProgram:i,groups:s,resources:o,compatibleRenderers:n,groupMap:a}=e;this.gpuProgram=t,this.glProgram=i,n===void 0&&(n=0,t&&(n|=ot.WEBGPU),i&&(n|=ot.WEBGL)),this.compatibleRenderers=n;let l={};if(!o&&!s&&(o={}),o&&s)throw new Error("[Shader] Cannot have both resources and groups");if(!t&&s&&!a)throw new Error("[Shader] No group map or WebGPU shader provided - consider using resources instead.");if(!t&&s&&a)for(let c in a)for(let u in a[c]){let h=a[c][u];l[h]={group:c,binding:u,name:h}}else if(t&&s&&!a){let c=t.structsAndGroups.groups;a={},c.forEach(u=>{a[u.group]=a[u.group]||{},a[u.group][u.binding]=u.name,l[u.name]=u})}else if(o){s={},a={},t&&t.structsAndGroups.groups.forEach(h=>{a[h.group]=a[h.group]||{},a[h.group][h.binding]=h.name,l[h.name]=h});let c=0;for(let u in o)l[u]||(s[99]||(s[99]=new gt,this._ownedBindGroups.push(s[99])),l[u]={group:99,binding:c,name:u},a[99]=a[99]||{},a[99][c]=u,c++);for(let u in o){let h=u,d=o[u];!d.source&&!d._resourceType&&(d=new be(d));let f=l[h];f&&(s[f.group]||(s[f.group]=new gt,this._ownedBindGroups.push(s[f.group])),s[f.group].setResource(d,f.binding))}}this.groups=s,this._uniformBindMap=a,this.resources=this._buildResourceAccessor(s,l)}addResource(e,t,i){var s,o;(s=this._uniformBindMap)[t]||(s[t]={}),(o=this._uniformBindMap[t])[i]||(o[i]=e),this.groups[t]||(this.groups[t]=new gt,this._ownedBindGroups.push(this.groups[t]))}_buildResourceAccessor(e,t){let i={};for(let s in t){let o=t[s];Object.defineProperty(i,o.name,{get(){return e[o.group].getResource(o.binding)},set(n){e[o.group].setResource(n,o.binding)}})}return i}destroy(e=!1){this.emit("destroy",this),e&&(this.gpuProgram?.destroy(),this.glProgram?.destroy()),this.gpuProgram=null,this.glProgram=null,this.removeAllListeners(),this._uniformBindMap=null,this._ownedBindGroups.forEach(t=>{t.destroy()}),this._ownedBindGroups=null,this.resources=null,this.groups=null}static from(e){let{gpu:t,gl:i,...s}=e,o,n;return t&&(o=xr.from(t)),i&&(n=gr.from(i)),new r({gpuProgram:o,glProgram:n,...s})}}});var uh,JT=y(()=>{$i();Ga();La();Xi();ch();Mr();uh=class extends Ze{constructor(e){let t=zr({name:"batch",bits:[Fo,Uo(e),Xr]}),i=Wr({name:"batch",bits:[ko,Oo(e),$r]});super({glProgram:t,gpuProgram:i,resources:{batchSamplers:Go(e)}})}}});var eS,tS,Da,ig=y(()=>{U();q0();J0();JT();eS=null,tS=class rS extends Y0{constructor(){super(...arguments),this.geometry=new nh,this.shader=eS||(eS=new uh(this.maxTextures)),this.name=rS.extension.name,this.vertexSize=6}packAttributes(e,t,i,s,o){let n=o<<16|e.roundPixels&65535,a=e.transform,l=a.a,c=a.b,u=a.c,h=a.d,d=a.tx,f=a.ty,{positions:p,uvs:m}=e,g=e.color,_=e.attributeOffset,v=_+e.attributeSize;for(let x=_;x{"use strict"});function sg(r,e,t,i,s){let o=e.a,n=e.b,a=e.c,l=e.d,c=e.tx,u=e.ty;t||(t=0),i||(i=2),s||(s=r.length/i-t);let h=t*i;for(let d=0;d{"use strict"});var Z2,Cs,og=y(()=>{ge();Zp();Z2=new G,Cs=class{constructor(){this.packAsQuad=!1,this.batcherName="default",this.topology="triangle-list",this.applyTransform=!0,this.roundPixels=0,this._batcher=null,this._batch=null}get uvs(){return this.geometryData.uvs}get positions(){return this.geometryData.vertices}get indices(){return this.geometryData.indices}get blendMode(){return this.applyTransform?this.renderable.groupBlendMode:"normal"}get color(){let e=this.baseColor,t=e>>16|e&65280|(e&255)<<16,i=this.renderable;return i?Fu(t,i.groupColor)+(this.alpha*i.groupAlpha*255<<24):t+(this.alpha*255<<24)}get transform(){return this.renderable?.groupTransform||Z2}copyTo(e){e.indexOffset=this.indexOffset,e.indexSize=this.indexSize,e.attributeOffset=this.attributeOffset,e.attributeSize=this.attributeSize,e.baseColor=this.baseColor,e.alpha=this.alpha,e.texture=this.texture,e.geometryData=this.geometryData,e.topology=this.topology}reset(){this.applyTransform=!0,this.renderable=null,this.topology="triangle-list"}}});var Lo,aS,lS,cS=y(()=>{U();Lo={extension:{type:S.ShapeBuilder,name:"circle"},build(r,e){let t,i,s,o,n,a;if(r.type==="circle"){let T=r;t=T.x,i=T.y,n=a=T.radius,s=o=0}else if(r.type==="ellipse"){let T=r;t=T.x,i=T.y,n=T.halfWidth,a=T.halfHeight,s=o=0}else{let T=r,b=T.width/2,E=T.height/2;t=T.x+b,i=T.y+E,n=a=Math.max(0,Math.min(T.radius,Math.min(b,E))),s=b-n,o=E-a}if(!(n>=0&&a>=0&&s>=0&&o>=0))return e;let l=Math.ceil(2.3*Math.sqrt(n+a)),c=l*8+(s?4:0)+(o?4:0);if(c===0)return e;if(l===0)return e[0]=e[6]=t+s,e[1]=e[3]=i+o,e[2]=e[4]=t-s,e[5]=e[7]=i-o,e;let u=0,h=l*4+(s?2:0)+2,d=h,f=c,p=s+n,m=o,g=t+p,_=t-p,v=i+m;if(e[u++]=g,e[u++]=v,e[--h]=v,e[--h]=_,o){let T=i-m;e[d++]=_,e[d++]=T,e[--f]=T,e[--f]=g}for(let T=1;T0&&(s[o++]=l,s[o++]=c,s[o++]=l-1),l++;s[o++]=c+1,s[o++]=c,s[o++]=l-1}},aS={...Lo,extension:{...Lo.extension,name:"ellipse"}},lS={...Lo,extension:{...Lo.extension,name:"roundedRectangle"}}});function uS(r){let e=r.length;if(e<6)return 1;let t=0;for(let i=0,s=r[e-2],o=r[e-1];i{"use strict"});function dS(r,e,t,i,s,o,n,a){let l=r-t*s,c=e-i*s,u=r+t*o,h=e+i*o,d,f;n?(d=i,f=-t):(d=-i,f=t);let p=l+d,m=c+f,g=u+d,_=h+f;return a.push(p,m),a.push(g,_),2}function Ms(r,e,t,i,s,o,n,a){let l=t-r,c=i-e,u=Math.atan2(l,c),h=Math.atan2(s-r,o-e);a&&uh&&(h+=Math.PI*2);let d=u,f=h-u,p=Math.abs(f),m=Math.sqrt(l*l+c*c),g=(15*p*Math.sqrt(m)/Math.PI>>0)+1,_=f/g;if(d+=_,a){n.push(r,e),n.push(t,i);for(let v=1,x=d;v=0&&(a.join==="round"?m+=Ms(E,w,E-C*O,w-A*O,E-P*O,w-R*O,f,!1)+4:m+=2,f.push(E-P*D,w-R*D),f.push(E+P*O,w+R*O));continue}let it=(-C+T)*(-A+w)-(-C+E)*(-A+b),bt=(-P+I)*(-R+w)-(-P+E)*(-R+B),Le=(Y*bt-J*it)/Me,vt=(Be*it-ue*bt)/Me,Ft=(Le-E)*(Le-E)+(vt-w)*(vt-w),Pt=E+(Le-E)*O,Ot=w+(vt-w)*O,Ar=E-(Le-E)*D,ds=w-(vt-w)*D,zF=Math.min(Y*Y+ue*ue,J*J+Be*Be),Ob=$e?O:D,$F=zF+Ob*Ob*v;Ft<=$F?a.join==="bevel"||Ft/v>x?($e?(f.push(Pt,Ot),f.push(E+C*D,w+A*D),f.push(Pt,Ot),f.push(E+P*D,w+R*D)):(f.push(E-C*O,w-A*O),f.push(Ar,ds),f.push(E-P*O,w-R*O),f.push(Ar,ds)),m+=2):a.join==="round"?$e?(f.push(Pt,Ot),f.push(E+C*D,w+A*D),m+=Ms(E,w,E+C*D,w+A*D,E+P*D,w+R*D,f,!0)+4,f.push(Pt,Ot),f.push(E+P*D,w+R*D)):(f.push(E-C*O,w-A*O),f.push(Ar,ds),m+=Ms(E,w,E-C*O,w-A*O,E-P*O,w-R*O,f,!1)+4,f.push(E-P*O,w-R*O),f.push(Ar,ds)):(f.push(Pt,Ot),f.push(Ar,ds)):(f.push(E-C*O,w-A*O),f.push(E+C*D,w+A*D),a.join==="round"?$e?m+=Ms(E,w,E+C*D,w+A*D,E+P*D,w+R*D,f,!0)+2:m+=Ms(E,w,E-C*O,w-A*O,E-P*O,w-R*O,f,!1)+2:a.join==="miter"&&Ft/v<=x&&($e?(f.push(Ar,ds),f.push(Ar,ds)):(f.push(Pt,Ot),f.push(Pt,Ot)),m+=2),f.push(E-P*O,w-R*O),f.push(E+P*D,w+R*D),m+=2)}T=r[(p-2)*2],b=r[(p-2)*2+1],E=r[(p-1)*2],w=r[(p-1)*2+1],C=-(b-w),A=T-E,M=Math.sqrt(C*C+A*A),C/=M,A/=M,C*=_,A*=_,f.push(E-C*O,w-A*O),f.push(E+C*D,w+A*D),h||(a.cap==="round"?m+=Ms(E-C*(O-D)*.5,w-A*(O-D)*.5,E-C*O,w-A*O,E+C*D,w+A*D,f,!1)+2:a.cap==="square"&&(m+=dS(E,w,C,A,O,D,!1,f)));let N=1e-4*1e-4;for(let L=g;L{fr();hS()});function mS(r,e,t,i){let s=1e-4;if(r.length===0)return;let o=r[0],n=r[1],a=r[r.length-2],l=r[r.length-1],c=e||Math.abs(o-a){});var mh=ee((nj,cg)=>{"use strict";cg.exports=fh;cg.exports.default=fh;function fh(r,e,t){t=t||2;var i=e&&e.length,s=i?e[0]*t:r.length,o=yS(r,0,s,t,!0),n=[];if(!o||o.next===o.prev)return n;var a,l,c,u,h,d,f;if(i&&(o=sO(r,e,o,t)),r.length>80*t){a=c=r[0],l=u=r[1];for(var p=t;pc&&(c=h),d>u&&(u=d);f=Math.max(c-a,u-l),f=f!==0?32767/f:0}return Na(o,n,t,a,l,f,0),n}function yS(r,e,t,i,s){var o,n;if(s===lg(r,e,t,i)>0)for(o=e;o=e;o-=i)n=xS(o,r[o],r[o+1],n);return n&&ph(n,n.next)&&(Va(n),n=n.next),n}function Rs(r,e){if(!r)return r;e||(e=r);var t=r,i;do if(i=!1,!t.steiner&&(ph(t,t.next)||Ye(t.prev,t,t.next)===0)){if(Va(t),t=e=t.prev,t===t.next)break;i=!0}else t=t.next;while(i||t!==e);return e}function Na(r,e,t,i,s,o,n){if(r){!n&&o&&cO(r,i,s,o);for(var a=r,l,c;r.prev!==r.next;){if(l=r.prev,c=r.next,o?tO(r,i,s,o):eO(r)){e.push(l.i/t|0),e.push(r.i/t|0),e.push(c.i/t|0),Va(r),r=c.next,a=c.next;continue}if(r=c,r===a){n?n===1?(r=rO(Rs(r),e,t),Na(r,e,t,i,s,o,2)):n===2&&iO(r,e,t,i,s,o):Na(Rs(r),e,t,i,s,o,1);break}}}}function eO(r){var e=r.prev,t=r,i=r.next;if(Ye(e,t,i)>=0)return!1;for(var s=e.x,o=t.x,n=i.x,a=e.y,l=t.y,c=i.y,u=so?s>n?s:n:o>n?o:n,f=a>l?a>c?a:c:l>c?l:c,p=i.next;p!==e;){if(p.x>=u&&p.x<=d&&p.y>=h&&p.y<=f&&Do(s,a,o,l,n,c,p.x,p.y)&&Ye(p.prev,p,p.next)>=0)return!1;p=p.next}return!0}function tO(r,e,t,i){var s=r.prev,o=r,n=r.next;if(Ye(s,o,n)>=0)return!1;for(var a=s.x,l=o.x,c=n.x,u=s.y,h=o.y,d=n.y,f=al?a>c?a:c:l>c?l:c,g=u>h?u>d?u:d:h>d?h:d,_=ng(f,p,e,t,i),v=ng(m,g,e,t,i),x=r.prevZ,T=r.nextZ;x&&x.z>=_&&T&&T.z<=v;){if(x.x>=f&&x.x<=m&&x.y>=p&&x.y<=g&&x!==s&&x!==n&&Do(a,u,l,h,c,d,x.x,x.y)&&Ye(x.prev,x,x.next)>=0||(x=x.prevZ,T.x>=f&&T.x<=m&&T.y>=p&&T.y<=g&&T!==s&&T!==n&&Do(a,u,l,h,c,d,T.x,T.y)&&Ye(T.prev,T,T.next)>=0))return!1;T=T.nextZ}for(;x&&x.z>=_;){if(x.x>=f&&x.x<=m&&x.y>=p&&x.y<=g&&x!==s&&x!==n&&Do(a,u,l,h,c,d,x.x,x.y)&&Ye(x.prev,x,x.next)>=0)return!1;x=x.prevZ}for(;T&&T.z<=v;){if(T.x>=f&&T.x<=m&&T.y>=p&&T.y<=g&&T!==s&&T!==n&&Do(a,u,l,h,c,d,T.x,T.y)&&Ye(T.prev,T,T.next)>=0)return!1;T=T.nextZ}return!0}function rO(r,e,t){var i=r;do{var s=i.prev,o=i.next.next;!ph(s,o)&&_S(s,i,i.next,o)&&Ha(s,o)&&Ha(o,s)&&(e.push(s.i/t|0),e.push(i.i/t|0),e.push(o.i/t|0),Va(i),Va(i.next),i=r=o),i=i.next}while(i!==r);return Rs(i)}function iO(r,e,t,i,s,o){var n=r;do{for(var a=n.next.next;a!==n.prev;){if(n.i!==a.i&&dO(n,a)){var l=bS(n,a);n=Rs(n,n.next),l=Rs(l,l.next),Na(n,e,t,i,s,o,0),Na(l,e,t,i,s,o,0);return}a=a.next}n=n.next}while(n!==r)}function sO(r,e,t,i){var s=[],o,n,a,l,c;for(o=0,n=e.length;o=t.next.y&&t.next.y!==t.y){var a=t.x+(s-t.y)*(t.next.x-t.x)/(t.next.y-t.y);if(a<=i&&a>o&&(o=a,n=t.x=t.x&&t.x>=c&&i!==t.x&&Do(sn.x||t.x===n.x&&lO(n,t)))&&(n=t,h=d)),t=t.next;while(t!==l);return n}function lO(r,e){return Ye(r.prev,r,e.prev)<0&&Ye(e.next,r,r.next)<0}function cO(r,e,t,i){var s=r;do s.z===0&&(s.z=ng(s.x,s.y,e,t,i)),s.prevZ=s.prev,s.nextZ=s.next,s=s.next;while(s!==r);s.prevZ.nextZ=null,s.prevZ=null,uO(s)}function uO(r){var e,t,i,s,o,n,a,l,c=1;do{for(t=r,r=null,o=null,n=0;t;){for(n++,i=t,a=0,e=0;e0||l>0&&i;)a!==0&&(l===0||!i||t.z<=i.z)?(s=t,t=t.nextZ,a--):(s=i,i=i.nextZ,l--),o?o.nextZ=s:r=s,s.prevZ=o,o=s;t=i}o.nextZ=null,c*=2}while(n>1);return r}function ng(r,e,t,i,s){return r=(r-t)*s|0,e=(e-i)*s|0,r=(r|r<<8)&16711935,r=(r|r<<4)&252645135,r=(r|r<<2)&858993459,r=(r|r<<1)&1431655765,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,r|e<<1}function hO(r){var e=r,t=r;do(e.x=(r-n)*(o-a)&&(r-n)*(i-a)>=(t-n)*(e-a)&&(t-n)*(o-a)>=(s-n)*(i-a)}function dO(r,e){return r.next.i!==e.i&&r.prev.i!==e.i&&!fO(r,e)&&(Ha(r,e)&&Ha(e,r)&&pO(r,e)&&(Ye(r.prev,r,e.prev)||Ye(r,e.prev,e))||ph(r,e)&&Ye(r.prev,r,r.next)>0&&Ye(e.prev,e,e.next)>0)}function Ye(r,e,t){return(e.y-r.y)*(t.x-e.x)-(e.x-r.x)*(t.y-e.y)}function ph(r,e){return r.x===e.x&&r.y===e.y}function _S(r,e,t,i){var s=dh(Ye(r,e,t)),o=dh(Ye(r,e,i)),n=dh(Ye(t,i,r)),a=dh(Ye(t,i,e));return!!(s!==o&&n!==a||s===0&&hh(r,t,e)||o===0&&hh(r,i,e)||n===0&&hh(t,r,i)||a===0&&hh(t,e,i))}function hh(r,e,t){return e.x<=Math.max(r.x,t.x)&&e.x>=Math.min(r.x,t.x)&&e.y<=Math.max(r.y,t.y)&&e.y>=Math.min(r.y,t.y)}function dh(r){return r>0?1:r<0?-1:0}function fO(r,e){var t=r;do{if(t.i!==r.i&&t.next.i!==r.i&&t.i!==e.i&&t.next.i!==e.i&&_S(t,t.next,r,e))return!0;t=t.next}while(t!==r);return!1}function Ha(r,e){return Ye(r.prev,r,r.next)<0?Ye(r,e,r.next)>=0&&Ye(r,r.prev,e)>=0:Ye(r,e,r.prev)<0||Ye(r,r.next,e)<0}function pO(r,e){var t=r,i=!1,s=(r.x+e.x)/2,o=(r.y+e.y)/2;do t.y>o!=t.next.y>o&&t.next.y!==t.y&&s<(t.next.x-t.x)*(o-t.y)/(t.next.y-t.y)+t.x&&(i=!i),t=t.next;while(t!==r);return i}function bS(r,e){var t=new ag(r.i,r.x,r.y),i=new ag(e.i,e.x,e.y),s=r.next,o=e.prev;return r.next=e,e.prev=r,t.next=s,s.prev=t,i.next=t,t.prev=i,o.next=i,i.prev=o,i}function xS(r,e,t,i){var s=new ag(r,e,t);return i?(s.next=i.next,s.prev=i,i.next.prev=s,i.next=s):(s.prev=s,s.next=s),s}function Va(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 ag(r,e,t){this.i=r,this.x=e,this.y=t,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}fh.deviation=function(r,e,t,i){var s=e&&e.length,o=s?e[0]*t:r.length,n=Math.abs(lg(r,0,o,t));if(s)for(var a=0,l=e.length;a0&&(i+=r[s-1].length,t.holes.push(i))}return t}});function gh(r,e,t,i,s,o,n){let a=(0,vS.default)(r,e,2);if(!a)return;for(let c=0;c{vS=fs(mh(),1)});var mO,TS,SS=y(()=>{U();ug();mO=[],TS={extension:{type:S.ShapeBuilder,name:"polygon"},build(r,e){for(let t=0;t{U();wS={extension:{type:S.ShapeBuilder,name:"rectangle"},build(r,e){let t=r,i=t.x,s=t.y,o=t.width,n=t.height;return o>=0&&n>=0&&(e[0]=i,e[1]=s,e[2]=i+o,e[3]=s,e[4]=i+o,e[5]=s+n,e[6]=i,e[7]=s+n),e},triangulate(r,e,t,i,s,o){let n=0;i*=t,e[i+n]=r[0],e[i+n+1]=r[1],n+=t,e[i+n]=r[2],e[i+n+1]=r[3],n+=t,e[i+n]=r[6],e[i+n+1]=r[7],n+=t,e[i+n]=r[4],e[i+n+1]=r[5],n+=t;let a=i/t;s[o++]=a,s[o++]=a+1,s[o++]=a+2,s[o++]=a+1,s[o++]=a+3,s[o++]=a+2}}});var AS,PS=y(()=>{U();AS={extension:{type:S.ShapeBuilder,name:"triangle"},build(r,e){return e[0]=r.x,e[1]=r.y,e[2]=r.x2,e[3]=r.y2,e[4]=r.x3,e[5]=r.y3,e},triangulate(r,e,t,i,s,o){let n=0;i*=t,e[i+n]=r[0],e[i+n+1]=r[1],n+=t,e[i+n]=r[2],e[i+n+1]=r[3],n+=t,e[i+n]=r[4],e[i+n+1]=r[5];let a=i/t;s[o++]=a,s[o++]=a+1,s[o++]=a+2}}});function MS(r,e){for(let t=0;t{Tt();Re();ge();Ao();ve();wt();Xe();im();CS=[{offset:0,color:"white"},{offset:1,color:"black"}],dg=class hg{constructor(...e){this.uid=he("fillGradient"),this.type="linear",this.colorStops=[];let t=gO(e);t={...t.type==="radial"?hg.defaultRadialOptions:hg.defaultLinearOptions,...Uu(t)},this._textureSize=t.textureSize,this._wrapMode=t.wrapMode,t.type==="radial"?(this.center=t.center,this.outerCenter=t.outerCenter??this.center,this.innerRadius=t.innerRadius,this.outerRadius=t.outerRadius,this.scale=t.scale,this.rotation=t.rotation):(this.start=t.start,this.end=t.end),this.textureSpace=t.textureSpace,this.type=t.type,t.colorStops.forEach(s=>{this.addColorStop(s.offset,s.color)})}addColorStop(e,t){return this.colorStops.push({offset:e,color:oe.shared.setValue(t).toHexa()}),this}buildLinearGradient(){if(this.texture)return;let{x:e,y:t}=this.start,{x:i,y:s}=this.end,o=i-e,n=s-t,a=o<0||n<0;if(this._wrapMode==="clamp-to-edge"){if(o<0){let g=e;e=i,i=g,o*=-1}if(n<0){let g=t;t=s,s=g,n*=-1}}let l=this.colorStops.length?this.colorStops:CS,c=this._textureSize,{canvas:u,context:h}=RS(c,1),d=a?h.createLinearGradient(this._textureSize,0,0,0):h.createLinearGradient(0,0,this._textureSize,0);MS(d,l),h.fillStyle=d,h.fillRect(0,0,c,1),this.texture=new k({source:new jt({resource:u,addressMode:this._wrapMode})});let f=Math.sqrt(o*o+n*n),p=Math.atan2(n,o),m=new G;m.scale(f/c,1),m.rotate(p),m.translate(e,t),this.textureSpace==="local"&&m.scale(c,c),this.transform=m}buildGradient(){this.type==="linear"?this.buildLinearGradient():this.buildRadialGradient()}buildRadialGradient(){if(this.texture)return;let e=this.colorStops.length?this.colorStops:CS,t=this._textureSize,{canvas:i,context:s}=RS(t,t),{x:o,y:n}=this.center,{x:a,y:l}=this.outerCenter,c=this.innerRadius,u=this.outerRadius,h=a-u,d=l-u,f=t/(u*2),p=(o-h)*f,m=(n-d)*f,g=s.createRadialGradient(p,m,c*f,(a-h)*f,(l-d)*f,u*f);MS(g,e),s.fillStyle=e[e.length-1].color,s.fillRect(0,0,t,t),s.fillStyle=g,s.translate(p,m),s.rotate(this.rotation),s.scale(1,this.scale),s.translate(-p,-m),s.fillRect(0,0,t,t),this.texture=new k({source:new jt({resource:i,addressMode:this._wrapMode})});let _=new G;_.scale(1/f,1/f),_.translate(h,d),this.textureSpace==="local"&&_.scale(t,t),this.transform=_}get styleKey(){return this.uid}destroy(){this.texture?.destroy(!0),this.texture=null}};dg.defaultLinearOptions={start:{x:0,y:0},end:{x:0,y:1},colorStops:[],textureSpace:"local",type:"linear",textureSize:256,wrapMode:"clamp-to-edge"};dg.defaultRadialOptions={center:{x:.5,y:.5},innerRadius:0,outerRadius:.5,colorStops:[],scale:1,textureSpace:"local",type:"radial",textureSize:256,wrapMode:"clamp-to-edge"};qt=dg});function IS(r,e,t,i){let s=e.matrix?r.copyFrom(e.matrix).invert():r.identity();if(e.textureSpace==="local"){let n=t.getBounds(yO);e.width&&n.pad(e.width);let{x:a,y:l}=n,c=1/n.width,u=1/n.height,h=-a*c,d=-l*u,f=s.a,p=s.b,m=s.c,g=s.d;s.a*=c,s.b*=c,s.c*=u,s.d*=u,s.tx=h*f+d*m+s.tx,s.ty=h*p+d*g+s.ty}else s.translate(e.texture.frame.x,e.texture.frame.y),s.scale(1/e.texture.source.width,1/e.texture.source.height);let o=e.texture.source.style;return!(e.fill instanceof qt)&&o.addressMode==="clamp-to-edge"&&(o.addressMode="repeat",o.update()),i&&s.append(xO.copyFrom(i).invert()),s}var xO,yO,BS=y(()=>{ge();ut();No();xO=new G,yO=new Q});function FS(r,e){let{geometryData:t,batches:i}=e;i.length=0,t.indices.length=0,t.vertices.length=0,t.uvs.length=0;for(let s=0;s{let h=a.length,d=o.length/2,f=[],p=xh[l.type],m="triangle-list";if(p.build(l,f),c&&sg(f,c),t){let x=l.closePath??!0,T=e;T.pixelLine?(mS(f,x,o,a),m="line-list"):fS(f,T,!1,x,o,a)}else if(u){let x=[],T=f.slice();TO(u).forEach(E=>{x.push(T.length/2),T.push(...E)}),gh(T,x,o,2,d,a,h)}else p.triangulate(f,o,2,d,a,h);let g=n.length/2,_=e.texture;if(_!==k.WHITE){let x=IS(bO,e,l,c);iS(o,2,d,n,g,2,o.length/2-d,x)}else sS(n,g,2,o.length/2-d);let v=se.get(Cs);v.indexOffset=h,v.indexSize=a.length-h,v.attributeOffset=d,v.attributeSize=o.length/2-d,v.baseColor=e.color,v.alpha=e.alpha,v.texture=_,v.geometryData=s,v.topology=m,i.push(v)})}function TO(r){let e=[];for(let t=0;t{U();ge();ut();oS();nS();ve();Gt();og();cS();pS();gS();SS();ES();PS();BS();ug();xh={};V.handleByMap(S.ShapeBuilder,xh);V.add(wS,TS,AS,Lo,aS,lS);_O=new Q,bO=new G});var fg,pg,gg,Ho,yh=y(()=>{U();ih();ig();tm();Xe();Gt();OS();fg=class{constructor(){this.batches=[],this.geometryData={vertices:[],uvs:[],indices:[]}}},pg=class{constructor(){this.batcher=new Da,this.instructions=new yo}init(){this.instructions.reset()}get geometry(){return X(rv,"GraphicsContextRenderData#geometry is deprecated, please use batcher.geometry instead."),this.batcher.geometry}},gg=class mg{constructor(e){this._gpuContextHash={},this._graphicsDataContextHash=Object.create(null),e.renderableGC.addManagedHash(this,"_gpuContextHash"),e.renderableGC.addManagedHash(this,"_graphicsDataContextHash")}init(e){mg.defaultOptions.bezierSmoothness=e?.bezierSmoothness??mg.defaultOptions.bezierSmoothness}getContextRenderData(e){return this._graphicsDataContextHash[e.uid]||this._initContextRenderData(e)}updateGpuContext(e){let t=this._gpuContextHash[e.uid]||this._initContext(e);if(e.dirty){t?this._cleanGraphicsContextData(e):t=this._initContext(e),FS(e,t);let i=e.batchMode;e.customShader||i==="no-batch"?t.isBatchable=!1:i==="auto"&&(t.isBatchable=t.geometryData.vertices.length<400),e.dirty=!1}return t}getGpuContext(e){return this._gpuContextHash[e.uid]||this._initContext(e)}_initContextRenderData(e){let t=se.get(pg),{batches:i,geometryData:s}=this._gpuContextHash[e.uid],o=s.vertices.length,n=s.indices.length;for(let u=0;u{se.return(i)})}destroy(){for(let e in this._gpuContextHash)this._gpuContextHash[e]&&this.onGraphicsContextDestroy(this._gpuContextHash[e].context)}};gg.extension={type:[S.WebGLSystem,S.WebGPUSystem,S.CanvasSystem],name:"graphicsContext"};gg.defaultOptions={bezierSmoothness:.5};Ho=gg});var SO,xg,yg,_g,bg,vg,Tg,Sg,Je,Rr=y(()=>{"use strict";SO={normal:0,add:1,multiply:2,screen:3,overlay:4,erase:5,"normal-npm":6,"add-npm":7,"screen-npm":8,min:9,max:10},xg=0,yg=1,_g=2,bg=3,vg=4,Tg=5,Sg=class US{constructor(){this.data=0,this.blendMode="normal",this.polygonOffset=0,this.blend=!0,this.depthMask=!0}get blend(){return!!(this.data&1<>24&255)/255;e[t++]=(r&255)/255*i,e[t++]=(r>>8&255)/255*i,e[t++]=(r>>16&255)/255*i,e[t++]=i}var Vo=y(()=>{"use strict"});var Wa,GS=y(()=>{U();Rr();Gt();Vo();og();Wa=class{constructor(e,t){this.state=Je.for2d(),this._graphicsBatchesHash=Object.create(null),this._destroyRenderableBound=this.destroyRenderable.bind(this),this.renderer=e,this._adaptor=t,this._adaptor.init(),this.renderer.renderableGC.addManagedHash(this,"_graphicsBatchesHash")}validateRenderable(e){let t=e.context,i=!!this._graphicsBatchesHash[e.uid],s=this.renderer.graphicsContext.updateGpuContext(t);return!!(s.isBatchable||i!==s.isBatchable)}addRenderable(e,t){let i=this.renderer.graphicsContext.updateGpuContext(e.context);e.didViewUpdate&&this._rebuild(e),i.isBatchable?this._addToBatcher(e,t):(this.renderer.renderPipes.batch.break(t),t.add(e))}updateRenderable(e){let t=this._graphicsBatchesHash[e.uid];if(t)for(let i=0;i{let a=se.get(Cs);return n.copyTo(a),a.renderable=e,a.roundPixels=s,a});return this._graphicsBatchesHash[e.uid]===void 0&&e.on("destroyed",this._destroyRenderableBound),this._graphicsBatchesHash[e.uid]=o,o}_removeBatchForRenderable(e){this._graphicsBatchesHash[e].forEach(t=>{se.return(t)}),this._graphicsBatchesHash[e]=null}destroy(){this.renderer=null,this._adaptor.destroy(),this._adaptor=null,this.state=null;for(let e in this._graphicsBatchesHash)this._removeBatchForRenderable(e);this._graphicsBatchesHash=null}};Wa.extension={type:[S.WebGLPipes,S.WebGPUPipes,S.CanvasPipes],name:"graphics"}});var wg=y(()=>{U();yh();GS();V.add(Wa);V.add(Ho)});var ji,_h=y(()=>{"use strict";ji=class{constructor(){this.batcherName="default",this.packAsQuad=!1,this.indexOffset=0,this.attributeOffset=0,this.roundPixels=0,this._batcher=null,this._batch=null,this._textureMatrixUpdateId=-1,this._uvUpdateId=-1}get blendMode(){return this.renderable.groupBlendMode}get topology(){return this._topology||this.geometry.topology}set topology(e){this._topology=e}reset(){this.renderable=null,this.texture=null,this._batcher=null,this._batch=null,this.geometry=null,this._uvUpdateId=-1,this._textureMatrixUpdateId=-1}setTexture(e){this.texture!==e&&(this.texture=e,this._textureMatrixUpdateId=-1)}get uvs(){let t=this.geometry.getBuffer("aUV"),i=t.data,s=i,o=this.texture.textureMatrix;return o.isSimple||(s=this._transformedUvs,(this._textureMatrixUpdateId!==o._updateID||this._uvUpdateId!==t._updateID)&&((!s||s.length{U();ge();Vi();It();Fa();Gt();Vo();_h();za=class{constructor(e,t){this.localUniforms=new be({uTransformMatrix:{value:new G,type:"mat3x3"},uColor:{value:new Float32Array([1,1,1,1]),type:"vec4"},uRound:{value:0,type:"f32"}}),this.localUniformsBindGroup=new gt({0:this.localUniforms}),this._meshDataHash=Object.create(null),this._gpuBatchableMeshHash=Object.create(null),this._destroyRenderableBound=this.destroyRenderable.bind(this),this.renderer=e,this._adaptor=t,this._adaptor.init(),e.renderableGC.addManagedHash(this,"_gpuBatchableMeshHash"),e.renderableGC.addManagedHash(this,"_meshDataHash")}validateRenderable(e){let t=this._getMeshData(e),i=t.batched,s=e.batched;if(t.batched=s,i!==s)return!0;if(s){let o=e._geometry;if(o.indices.length!==t.indexSize||o.positions.length!==t.vertexSize)return t.indexSize=o.indices.length,t.vertexSize=o.positions.length,!0;let n=this._getBatchableMesh(e);return n.texture.uid!==e._texture.uid&&(n._textureMatrixUpdateId=-1),!n._batcher.checkAndUpdateTexture(n,e._texture)}return!1}addRenderable(e,t){let i=this.renderer.renderPipes.batch,{batched:s}=this._getMeshData(e);if(s){let o=this._getBatchableMesh(e);o.setTexture(e._texture),o.geometry=e._geometry,i.addToBatch(o,t)}else i.break(t),t.add(e)}updateRenderable(e){if(e.batched){let t=this._gpuBatchableMeshHash[e.uid];t.setTexture(e._texture),t.geometry=e._geometry,t._batcher.updateElement(t)}}destroyRenderable(e){this._meshDataHash[e.uid]=null;let t=this._gpuBatchableMeshHash[e.uid];t&&(se.return(t),this._gpuBatchableMeshHash[e.uid]=null),e.off("destroyed",this._destroyRenderableBound)}execute(e){if(!e.isRenderable)return;e.state.blendMode=mi(e.groupBlendMode,e.texture._source);let t=this.localUniforms;t.uniforms.uTransformMatrix=e.groupTransform,t.uniforms.uRound=this.renderer._roundPixels|e._roundPixels,t.update(),Yr(e.groupColorAlpha,t.uniforms.uColor,0),this._adaptor.execute(this,e)}_getMeshData(e){return this._meshDataHash[e.uid]||this._initMeshData(e)}_initMeshData(e){return this._meshDataHash[e.uid]={batched:e.batched,indexSize:e._geometry.indices?.length,vertexSize:e._geometry.positions?.length},e.on("destroyed",this._destroyRenderableBound),this._meshDataHash[e.uid]}_getBatchableMesh(e){return this._gpuBatchableMeshHash[e.uid]||this._initBatchableMesh(e)}_initBatchableMesh(e){let t=se.get(ji);return t.renderable=e,t.setTexture(e._texture),t.transform=e.groupTransform,t.roundPixels=this.renderer._roundPixels|e._roundPixels,this._gpuBatchableMeshHash[e.uid]=t,t}destroy(){for(let e in this._gpuBatchableMeshHash)this._gpuBatchableMeshHash[e]&&se.return(this._gpuBatchableMeshHash[e]);this._gpuBatchableMeshHash=null,this._meshDataHash=null,this.localUniforms=null,this.localUniformsBindGroup=null,this._adaptor.destroy(),this._adaptor=null,this.renderer=null}};za.extension={type:[S.WebGLPipes,S.WebGPUPipes,S.CanvasPipes],name:"mesh"}});var Eg=y(()=>{U();LS();V.add(za)});var bh,DS=y(()=>{"use strict";bh=class{execute(e,t){let i=e.state,s=e.renderer,o=t.shader||e.defaultShader;o.resources.uTexture=t.texture._source,o.resources.uniforms=e.localUniforms;let n=s.gl,a=e.getBuffers(t);s.shader.bind(o),s.state.set(i),s.geometry.bind(a.geometry,o.glProgram);let c=a.geometry.indexBuffer.data.BYTES_PER_ELEMENT===2?n.UNSIGNED_SHORT:n.UNSIGNED_INT;n.drawElements(n.TRIANGLES,t.particleChildren.length*6,c,0)}}});function Ag(r,e=null){let t=r*6;if(t>65535?e||(e=new Uint32Array(t)):e||(e=new Uint16Array(t)),e.length!==t)throw new Error(`Out buffer length is incorrect, got ${e.length} and expected ${t}`);for(let i=0,s=0;i{"use strict"});function VS(r){return{dynamicUpdate:HS(r,!0),staticUpdate:HS(r,!1)}}function HS(r,e){let t=[];t.push(` var index = 0; @@ -364,8 +364,8 @@ fn mainFragment( var sample = textureSample(uTexture, uSampler, uv) * color; return sample; -}`});var Th,KS=y(()=>{Tt();ge();As();Bo();Mr();ve();sm();XS();YS();qS();Th=class extends Ze{constructor(){let e=gr.from({vertex:jS,fragment:$S}),t=xr.from({fragment:{source:Pg,entryPoint:"mainFragment"},vertex:{source:Pg,entryPoint:"mainVertex"}});super({glProgram:e,gpuProgram:t,resources:{uTexture:k.WHITE.source,uSampler:new Gu({}),uniforms:{uTranslationMatrix:{value:new G,type:"mat3x3"},uColor:{value:new oe(16777215),type:"vec4"},uRound:{value:1,type:"f32"},uResolution:{value:[0,0],type:"vec2"}}}})}}});var Wo,Cg=y(()=>{ge();It();Fa();Rr();Vo();zS();KS();Wo=class{constructor(e,t){this.state=Je.for2d(),this._gpuBufferHash=Object.create(null),this._destroyRenderableBound=this.destroyRenderable.bind(this),this.localUniforms=new be({uTranslationMatrix:{value:new G,type:"mat3x3"},uColor:{value:new Float32Array(4),type:"vec4"},uRound:{value:1,type:"f32"},uResolution:{value:[0,0],type:"vec2"}}),this.renderer=e,this.adaptor=t,this.defaultShader=new Th,this.state=Je.for2d()}validateRenderable(e){return!1}addRenderable(e,t){this.renderer.renderPipes.batch.break(t),t.add(e)}getBuffers(e){return this._gpuBufferHash[e.uid]||this._initBuffer(e)}_initBuffer(e){return this._gpuBufferHash[e.uid]=new vh({size:e.particleChildren.length,properties:e._properties}),e.on("destroyed",this._destroyRenderableBound),this._gpuBufferHash[e.uid]}updateRenderable(e){}destroyRenderable(e){this._gpuBufferHash[e.uid].destroy(),this._gpuBufferHash[e.uid]=null,e.off("destroyed",this._destroyRenderableBound)}execute(e){let t=e.particleChildren;if(t.length===0)return;let i=this.renderer,s=this.getBuffers(e);e.texture||(e.texture=t[0].texture);let o=this.state;s.update(t,e._childrenDirty),e._childrenDirty=!1,o.blendMode=mi(e.blendMode,e.texture._source);let n=this.localUniforms.uniforms,a=n.uTranslationMatrix;e.worldTransform.copyTo(a),a.prepend(i.globalUniforms.globalUniformData.projectionMatrix),n.uResolution=i.globalUniforms.globalUniformData.resolution,n.uRound=i._roundPixels|e._roundPixels,Yr(e.groupColorAlpha,n.uColor,0),this.adaptor.execute(this,e)}destroy(){this.defaultShader&&(this.defaultShader.destroy(),this.defaultShader=null)}}});var $a,ZS=y(()=>{U();DS();Cg();$a=class extends Wo{constructor(e){super(e,new bh)}};$a.extension={type:[S.WebGLPipes],name:"particle"}});var Sh,QS=y(()=>{"use strict";Sh=class{execute(e,t){let i=e.renderer,s=t.shader||e.defaultShader;s.groups[0]=i.renderPipes.uniformBatch.getUniformBindGroup(e.localUniforms,!0),s.groups[1]=i.texture.getTextureBindGroup(t.texture);let o=e.state,n=e.getBuffers(t);i.encoder.draw({geometry:n.geometry,shader:t.shader||e.defaultShader,state:o,size:t.particleChildren.length*6})}}});var Xa,JS=y(()=>{U();QS();Cg();Xa=class extends Wo{constructor(e){super(e,new Sh)}};Xa.extension={type:[S.WebGPUPipes],name:"particle"}});var Mg=y(()=>{U();ZS();JS();V.add($a);V.add(Xa)});var qr,ja=y(()=>{"use strict";qr=class{constructor(){this.batcherName="default",this.topology="triangle-list",this.attributeSize=4,this.indexSize=6,this.packAsQuad=!0,this.roundPixels=0,this._attributeStart=0,this._batcher=null,this._batch=null}get blendMode(){return this.renderable.groupBlendMode}get color(){return this.renderable.groupColorAlpha}reset(){this.renderable=null,this.texture=null,this._batcher=null,this._batch=null,this.bounds=null}}});function Ya(r,e){let{texture:t,bounds:i}=r;qu(i,e._anchor,t);let s=e._style.padding;i.minX-=s,i.minY-=s,i.maxX-=s,i.maxY-=s}var Rg=y(()=>{Cm()});var qa,ew=y(()=>{U();Gt();ja();Rg();qa=class{constructor(e){this._gpuText=Object.create(null),this._destroyRenderableBound=this.destroyRenderable.bind(this),this._renderer=e,this._renderer.runners.resolutionChange.add(this),this._renderer.renderableGC.addManagedHash(this,"_gpuText")}resolutionChange(){for(let e in this._gpuText){let t=this._gpuText[e];if(!t)continue;let i=t.batchableSprite.renderable;i._autoResolution&&(i._resolution=this._renderer.resolution,i.onViewUpdate())}}validateRenderable(e){let t=this._getGpuText(e),i=e._getKey();return t.currentKey!==i}addRenderable(e,t){let s=this._getGpuText(e).batchableSprite;e._didTextUpdate&&this._updateText(e),this._renderer.renderPipes.batch.addToBatch(s,t)}updateRenderable(e){let i=this._getGpuText(e).batchableSprite;e._didTextUpdate&&this._updateText(e),i._batcher.updateElement(i)}destroyRenderable(e){e.off("destroyed",this._destroyRenderableBound),this._destroyRenderableById(e.uid)}_destroyRenderableById(e){let t=this._gpuText[e];this._renderer.canvasText.decreaseReferenceCount(t.currentKey),se.return(t.batchableSprite),this._gpuText[e]=null}_updateText(e){let t=e._getKey(),i=this._getGpuText(e),s=i.batchableSprite;i.currentKey!==t&&this._updateGpuText(e),e._didTextUpdate=!1,Ya(s,e)}_updateGpuText(e){let t=this._getGpuText(e),i=t.batchableSprite;t.texture&&this._renderer.canvasText.decreaseReferenceCount(t.currentKey),t.texture=i.texture=this._renderer.canvasText.getManagedTexture(e),t.currentKey=e._getKey(),i.texture=t.texture}_getGpuText(e){return this._gpuText[e.uid]||this.initGpuText(e)}initGpuText(e){let t={texture:null,currentKey:"--",batchableSprite:se.get(qr)};return t.batchableSprite.renderable=e,t.batchableSprite.transform=e.groupTransform,t.batchableSprite.bounds={minX:0,maxX:1,minY:0,maxY:0},t.batchableSprite.roundPixels=this._renderer._roundPixels|e._roundPixels,this._gpuText[e.uid]=t,e._resolution=e._autoResolution?this._renderer.resolution:e.resolution,this._updateText(e),e.on("destroyed",this._destroyRenderableBound),t}destroy(){for(let e in this._gpuText)this._destroyRenderableById(e);this._gpuText=null,this._renderer=null}};qa.extension={type:[S.WebGLPipes,S.WebGPUPipes,S.CanvasPipes],name:"text"}});var Ig,Kt,zo=y(()=>{Re();ya();Ig=class{constructor(e){this._canvasPool=Object.create(null),this.canvasOptions=e||{},this.enableFullScreen=!1}_createCanvasAndContext(e,t){let i=j.get().createCanvas();i.width=e,i.height=t;let s=i.getContext("2d");return{canvas:i,context:s}}getOptimalCanvasAndContext(e,t,i=1){e=Math.ceil(e*i-1e-6),t=Math.ceil(t*i-1e-6),e=di(e),t=di(t);let s=(e<<17)+(t<<1);this._canvasPool[s]||(this._canvasPool[s]=[]);let o=this._canvasPool[s].pop();return o||(o=this._createCanvasAndContext(e,t)),o}returnCanvasAndContext(e){let t=e.canvas,{width:i,height:s}=t,o=(i<<17)+(s<<1);e.context.clearRect(0,0,i,s),this._canvasPool[o].push(e)}clear(){this._canvasPool={}}},Kt=new Ig});function tw(r,e,t){for(let i=0,s=4*t*e;i{ut()});var ow,yi,wh=y(()=>{ge();wt();ow={repeat:{addressModeU:"repeat",addressModeV:"repeat"},"repeat-x":{addressModeU:"repeat",addressModeV:"clamp-to-edge"},"repeat-y":{addressModeU:"clamp-to-edge",addressModeV:"repeat"},"no-repeat":{addressModeU:"clamp-to-edge",addressModeV:"clamp-to-edge"}},yi=class{constructor(e,t){this.uid=he("fillPattern"),this.transform=new G,this._styleKey=null,this.texture=e,this.transform.scale(1/e.frame.width,1/e.frame.height),t&&(e.source.style.addressModeU=ow[t].addressModeU,e.source.style.addressModeV=ow[t].addressModeV)}setTransform(e){let t=this.texture;this.transform.copyFrom(e),this.transform.invert(),this.transform.scale(1/t.frame.width,1/t.frame.height),this._styleKey=null}get styleKey(){return this._styleKey?this._styleKey:(this._styleKey=`fill-pattern-${this.uid}-${this.texture.uid}-${this.transform.toArray().join("-")}`,this._styleKey)}}});var aw=ee((Rq,nw)=>{nw.exports=AO;var Bg={a:7,c:6,h:1,l:2,m:2,q:4,s:4,t:2,v:1,z:0},EO=/([astvzqmhlc])([^astvzqmhlc]*)/ig;function AO(r){var e=[];return r.replace(EO,function(t,i,s){var o=i.toLowerCase();for(s=CO(s),o=="m"&&s.length>2&&(e.push([i].concat(s.splice(0,2))),o="l",i=i=="m"?"l":"L");;){if(s.length==Bg[o])return s.unshift(i),e.push(s);if(s.length0&&(s=i.pop(),s?(o=s.startX,n=s.startY):(o=0,n=0)),s=null;break;default:W(`Unknown SVG path command: ${c}`)}c!=="Z"&&c!=="z"&&s===null&&(s={startX:o,startY:n},i.push(s))}return e}var lw,uw=y(()=>{lw=fs(aw(),1);Ae()});var Eh,hw=y(()=>{ut();Eh=class r{constructor(e=0,t=0,i=0){this.type="circle",this.x=e,this.y=t,this.radius=i}clone(){return new r(this.x,this.y,this.radius)}contains(e,t){if(this.radius<=0)return!1;let i=this.radius*this.radius,s=this.x-e,o=this.y-t;return s*=s,o*=o,s+o<=i}strokeContains(e,t,i,s=.5){if(this.radius===0)return!1;let o=this.x-e,n=this.y-t,a=this.radius,l=(1-s)*i,c=Math.sqrt(o*o+n*n);return c<=a+l&&c>a-(i-l)}getBounds(e){return e||(e=new Q),e.x=this.x-this.radius,e.y=this.y-this.radius,e.width=this.radius*2,e.height=this.radius*2,e}copyFrom(e){return this.x=e.x,this.y=e.y,this.radius=e.radius,this}copyTo(e){return e.copyFrom(this),e}toString(){return`[pixi.js/math:Circle x=${this.x} y=${this.y} radius=${this.radius}]`}}});var Ah,dw=y(()=>{ut();Ah=class r{constructor(e=0,t=0,i=0,s=0){this.type="ellipse",this.x=e,this.y=t,this.halfWidth=i,this.halfHeight=s}clone(){return new r(this.x,this.y,this.halfWidth,this.halfHeight)}contains(e,t){if(this.halfWidth<=0||this.halfHeight<=0)return!1;let i=(e-this.x)/this.halfWidth,s=(t-this.y)/this.halfHeight;return i*=i,s*=s,i+s<=1}strokeContains(e,t,i,s=.5){let{halfWidth:o,halfHeight:n}=this;if(o<=0||n<=0)return!1;let a=i*(1-s),l=i-a,c=o-l,u=n-l,h=o+a,d=n+a,f=e-this.x,p=t-this.y,m=f*f/(c*c)+p*p/(u*u),g=f*f/(h*h)+p*p/(d*d);return m>1&&g<=1}getBounds(e){return e||(e=new Q),e.x=this.x-this.halfWidth,e.y=this.y-this.halfHeight,e.width=this.halfWidth*2,e.height=this.halfHeight*2,e}copyFrom(e){return this.x=e.x,this.y=e.y,this.halfWidth=e.halfWidth,this.halfHeight=e.halfHeight,this}copyTo(e){return e.copyFrom(this),e}toString(){return`[pixi.js/math:Ellipse x=${this.x} y=${this.y} halfWidth=${this.halfWidth} halfHeight=${this.halfHeight}]`}}});function fw(r,e,t,i,s,o){let n=r-t,a=e-i,l=s-t,c=o-i,u=n*l+a*c,h=l*l+c*c,d=-1;h!==0&&(d=u/h);let f,p;d<0?(f=t,p=i):d>1?(f=s,p=o):(f=t+d*l,p=i+d*c);let m=r-f,g=e-p;return m*m+g*g}var pw=y(()=>{"use strict"});var MO,RO,$o,mw=y(()=>{pw();ut();$o=class r{constructor(...e){this.type="polygon";let t=Array.isArray(e[0])?e[0]:e;if(typeof t[0]!="number"){let i=[];for(let s=0,o=t.length;st!=u>t&&e<(c-a)*((t-l)/(u-l))+a&&(i=!i)}return i}strokeContains(e,t,i,s=.5){let o=i*i,n=o*(1-s),a=o-n,{points:l}=this,c=l.length-(this.closePath?0:2);for(let u=0;us?c:s,o=un?u:n}return e.x=i,e.width=s-i,e.y=o,e.height=n-o,e}copyFrom(e){return this.points=e.points.slice(),this.closePath=e.closePath,this}copyTo(e){return e.copyFrom(this),e}toString(){return`[pixi.js/math:PolygoncloseStroke=${this.closePath}points=${this.points.reduce((e,t)=>`${e}, ${t}`,"")}]`}get lastX(){return this.points[this.points.length-2]}get lastY(){return this.points[this.points.length-1]}get x(){return this.points[this.points.length-2]}get y(){return this.points[this.points.length-1]}}});var Ph,Ch,gw=y(()=>{ut();Ph=(r,e,t,i,s,o,n)=>{let a=r-t,l=e-i,c=Math.sqrt(a*a+l*l);return c>=s-o&&c<=s+n},Ch=class r{constructor(e=0,t=0,i=0,s=0,o=20){this.type="roundedRectangle",this.x=e,this.y=t,this.width=i,this.height=s,this.radius=o}getBounds(e){return e||(e=new Q),e.x=this.x,e.y=this.y,e.width=this.width,e.height=this.height,e}clone(){return new r(this.x,this.y,this.width,this.height,this.radius)}copyFrom(e){return this.x=e.x,this.y=e.y,this.width=e.width,this.height=e.height,this}copyTo(e){return e.copyFrom(this),e}contains(e,t){if(this.width<=0||this.height<=0)return!1;if(e>=this.x&&e<=this.x+this.width&&t>=this.y&&t<=this.y+this.height){let i=Math.max(0,Math.min(this.radius,Math.min(this.width,this.height)/2));if(t>=this.y+i&&t<=this.y+this.height-i||e>=this.x+i&&e<=this.x+this.width-i)return!0;let s=e-(this.x+i),o=t-(this.y+i),n=i*i;if(s*s+o*o<=n||(s=e-(this.x+this.width-i),s*s+o*o<=n)||(o=t-(this.y+this.height-i),s*s+o*o<=n)||(s=e-(this.x+i),s*s+o*o<=n))return!0}return!1}strokeContains(e,t,i,s=.5){let{x:o,y:n,width:a,height:l,radius:c}=this,u=i*(1-s),h=i-u,d=o+c,f=n+c,p=a-c*2,m=l-c*2,g=o+a,_=n+l;return(e>=o-u&&e<=o+h||e>=g-h&&e<=g+u)&&t>=f&&t<=f+m||(t>=n-u&&t<=n+h||t>=_-h&&t<=_+u)&&e>=d&&e<=d+p?!0:eg-c&&tg-c&&t>_-c&&Ph(e,t,g-c,_-c,c,h,u)||e_-c&&Ph(e,t,d,_-c,c,h,u)}toString(){return`[pixi.js/math:RoundedRectangle x=${this.x} y=${this.y}width=${this.width} height=${this.height} radius=${this.radius}]`}}});function Rh(r,e,t,i,s,o,n,a,l,c){let h=Math.min(.99,Math.max(0,c??Ho.defaultOptions.bezierSmoothness)),d=(BO-h)/1;return d*=d,kO(e,t,i,s,o,n,a,l,r,d),r}function kO(r,e,t,i,s,o,n,a,l,c){Fg(r,e,t,i,s,o,n,a,l,c,0),l.push(n,a)}function Fg(r,e,t,i,s,o,n,a,l,c,u){if(u>IO)return;let h=Math.PI,d=(r+t)/2,f=(e+i)/2,p=(t+s)/2,m=(i+o)/2,g=(s+n)/2,_=(o+a)/2,v=(d+p)/2,x=(f+m)/2,T=(p+g)/2,b=(m+_)/2,w=(v+T)/2,E=(x+b)/2;if(u>0){let I=n-r,B=a-e,C=Math.abs((t-n)*B-(i-a)*I),A=Math.abs((s-n)*B-(o-a)*I),P,R;if(C>Mh&&A>Mh){if((C+A)*(C+A)<=c*(I*I+B*B)){if(Xo=h&&(P=2*h-P),R>=h&&(R=2*h-R),P+RIs){l.push(t,i);return}if(R>Is){l.push(s,o);return}}}}else if(C>Mh){if(C*C<=c*(I*I+B*B)){if(Xo=h&&(P=2*h-P),PIs){l.push(t,i);return}}}else if(A>Mh){if(A*A<=c*(I*I+B*B)){if(Xo=h&&(P=2*h-P),PIs){l.push(s,o);return}}}else if(I=w-(r+n)/2,B=E-(e+a)/2,I*I+B*B<=c){l.push(w,E);return}}Fg(r,e,d,f,v,x,w,E,l,c,u+1),Fg(w,E,T,b,g,_,n,a,l,c,u+1)}var IO,Mh,BO,kg,Xo,Is,Og=y(()=>{yh();IO=8,Mh=11920929e-14,BO=1,kg=.01,Xo=0,Is=0});function yw(r,e,t,i,s,o,n,a){let c=Math.min(.99,Math.max(0,a??Ho.defaultOptions.bezierSmoothness)),u=(UO-c)/1;return u*=u,LO(e,t,i,s,o,n,r,u),r}function LO(r,e,t,i,s,o,n,a){Ug(n,r,e,t,i,s,o,a,0),n.push(s,o)}function Ug(r,e,t,i,s,o,n,a,l){if(l>FO)return;let c=Math.PI,u=(e+i)/2,h=(t+s)/2,d=(i+o)/2,f=(s+n)/2,p=(u+d)/2,m=(h+f)/2,g=o-e,_=n-t,v=Math.abs((i-o)*_-(s-n)*g);if(v>OO){if(v*v<=a*(g*g+_*_)){if(xw=c&&(x=2*c-x),x{yh();FO=8,OO=11920929e-14,UO=1,GO=.01,xw=0});function Ih(r,e,t,i,s,o,n,a){let l=Math.abs(s-o);(!n&&s>o||n&&o>s)&&(l=2*Math.PI-l),a||(a=Math.max(6,Math.floor(6*Math.pow(i,1/3)*(l/Math.PI)))),a=Math.max(a,3);let c=l/a,u=s;c*=n?-1:1;for(let h=0;h{"use strict"});function bw(r,e,t,i,s,o){let n=r[r.length-2],l=r[r.length-1]-t,c=n-e,u=s-t,h=i-e,d=Math.abs(l*h-c*u);if(d<1e-8||o===0){(r[r.length-2]!==e||r[r.length-1]!==t)&&r.push(e,t);return}let f=l*l+c*c,p=u*u+h*h,m=l*u+c*h,g=o*Math.sqrt(f)/d,_=o*Math.sqrt(p)/d,v=g*m/f,x=_*m/p,T=g*h+_*c,b=g*u+_*l,w=c*(_+v),E=l*(_+v),I=h*(g+x),B=u*(g+x),C=Math.atan2(E-b,w-T),A=Math.atan2(B-b,I-T);Ih(r,T+e,b+t,o,C,A,c*u>h*l)}var vw=y(()=>{Gg()});function DO(r,e){let t=e===-1.5707963267948966?-.551915024494:1.3333333333333333*Math.tan(e/4),i=e===1.5707963267948966?.551915024494:t,s=Math.cos(r),o=Math.sin(r),n=Math.cos(r+e),a=Math.sin(r+e);return[{x:s-o*i,y:o+s*i},{x:n+a*i,y:a-n*i},{x:n,y:a}]}function Sw(r,e,t,i,s,o,n,a=0,l=0,c=0){if(o===0||n===0)return;let u=Math.sin(a*Ka/360),h=Math.cos(a*Ka/360),d=h*(e-i)/2+u*(t-s)/2,f=-u*(e-i)/2+h*(t-s)/2;if(d===0&&f===0)return;o=Math.abs(o),n=Math.abs(n);let p=Math.pow(d,2)/Math.pow(o,2)+Math.pow(f,2)/Math.pow(n,2);p>1&&(o*=Math.sqrt(p),n*=Math.sqrt(p)),NO(e,t,i,s,o,n,l,c,u,h,d,f,Lg);let{ang1:m,ang2:g}=Lg,{centerX:_,centerY:v}=Lg,x=Math.abs(g)/(Ka/4);Math.abs(1-x)<1e-7&&(x=1);let T=Math.max(Math.ceil(x),1);g/=T;let b=r[r.length-2],w=r[r.length-1],E={x:0,y:0};for(let I=0;I{Og();Ka=Math.PI*2,Lg={centerX:0,centerY:0,ang1:0,ang2:0},Dg=({x:r,y:e},t,i,s,o,n,a,l)=>{r*=t,e*=i;let c=s*r-o*e,u=o*r+s*e;return l.x=c+n,l.y=u+a,l};Tw=(r,e,t,i)=>{let s=r*i-e*t<0?-1:1,o=r*t+e*i;return o>1&&(o=1),o<-1&&(o=-1),s*Math.acos(o)},NO=(r,e,t,i,s,o,n,a,l,c,u,h,d)=>{let f=Math.pow(s,2),p=Math.pow(o,2),m=Math.pow(u,2),g=Math.pow(h,2),_=f*p-f*g-p*m;_<0&&(_=0),_/=f*g+p*m,_=Math.sqrt(_)*(n===a?-1:1);let v=_*s/o*h,x=_*-o/s*u,T=c*v-l*x+(r+t)/2,b=l*v+c*x+(e+i)/2,w=(u-v)/s,E=(h-x)/o,I=(-u-v)/s,B=(-h-x)/o,C=Tw(1,0,w,E),A=Tw(w,E,I,B);a===0&&A>0&&(A-=Ka),a===1&&A<0&&(A+=Ka),d.centerX=T,d.centerY=b,d.ang1=C,d.ang2=A}});function Ew(r,e,t){let i=(n,a)=>{let l=a.x-n.x,c=a.y-n.y,u=Math.sqrt(l*l+c*c),h=l/u,d=c/u;return{len:u,nx:h,ny:d}},s=(n,a)=>{n===0?r.moveTo(a.x,a.y):r.lineTo(a.x,a.y)},o=e[e.length-1];for(let n=0;n0&&(f=-1,p=!0);let m=d/2,g,_=Math.abs(Math.cos(m)*l/Math.sin(m));_>Math.min(u.len/2,h.len/2)?(_=Math.min(u.len/2,h.len/2),g=Math.abs(_*Math.sin(m)/Math.cos(m))):g=l;let v=a.x+h.nx*_+-h.ny*g*f,x=a.y+h.ny*_+h.nx*g*f,T=Math.atan2(u.ny,u.nx)+Math.PI/2*f,b=Math.atan2(h.ny,h.nx)-Math.PI/2*f;n===0&&r.moveTo(v+Math.cos(T)*g,x+Math.sin(T)*g),r.arc(v,x,g,T,b,p),o=a}}function Aw(r,e,t,i){let s=(a,l)=>Math.sqrt((a.x-l.x)**2+(a.y-l.y)**2),o=(a,l,c)=>({x:a.x+(l.x-a.x)*c,y:a.y+(l.y-a.y)*c}),n=e.length;for(let a=0;a{"use strict"});var HO,Bh,Cw=y(()=>{hw();dw();mw();ut();gw();$t();Og();_w();Gg();vw();ww();Pw();HO=new Q,Bh=class{constructor(e){this.shapePrimitives=[],this._currentPoly=null,this._bounds=new Ee,this._graphicsPath2D=e,this.signed=e.checkForHoles}moveTo(e,t){return this.startPoly(e,t),this}lineTo(e,t){this._ensurePoly();let i=this._currentPoly.points,s=i[i.length-2],o=i[i.length-1];return(s!==e||o!==t)&&i.push(e,t),this}arc(e,t,i,s,o,n){this._ensurePoly(!1);let a=this._currentPoly.points;return Ih(a,e,t,i,s,o,n),this}arcTo(e,t,i,s,o){this._ensurePoly();let n=this._currentPoly.points;return bw(n,e,t,i,s,o),this}arcToSvg(e,t,i,s,o,n,a){let l=this._currentPoly.points;return Sw(l,this._currentPoly.lastX,this._currentPoly.lastY,n,a,e,t,i,s,o),this}bezierCurveTo(e,t,i,s,o,n,a){this._ensurePoly();let l=this._currentPoly;return Rh(this._currentPoly.points,l.lastX,l.lastY,e,t,i,s,o,n,a),this}quadraticCurveTo(e,t,i,s,o){this._ensurePoly();let n=this._currentPoly;return yw(this._currentPoly.points,n.lastX,n.lastY,e,t,i,s,o),this}closePath(){return this.endPoly(!0),this}addPath(e,t){this.endPoly(),t&&!t.isIdentity()&&(e=e.clone(!0),e.transform(t));let i=this.shapePrimitives,s=i.length;for(let o=0;o1){let o=null;for(let n=s;n=2;h-=2)u[h]===u[h-2]&&u[h-1]===u[h-3]&&u.splice(h-1,2);return this.poly(u,!0,n)}ellipse(e,t,i,s,o){return this.drawShape(new Ah(e,t,i,s),o),this}roundRect(e,t,i,s,o,n){return this.drawShape(new Ch(e,t,i,s,o),n),this}drawShape(e,t){return this.endPoly(),this.shapePrimitives.push({shape:e,transform:t}),this}startPoly(e,t){let i=this._currentPoly;return i&&this.endPoly(),i=new $o,i.points.push(e,t),this._currentPoly=i,this}endPoly(e=!1){let t=this._currentPoly;return t&&t.points.length>2&&(t.closePath=e,this.shapePrimitives.push({shape:t})),this._currentPoly=null,this}_ensurePoly(e=!0){if(!this._currentPoly&&(this._currentPoly=new $o,e)){let t=this.shapePrimitives[this.shapePrimitives.length-1];if(t){let i=t.shape.x,s=t.shape.y;if(t.transform&&!t.transform.isIdentity()){let o=t.transform,n=i;i=o.a*i+o.c*s+o.tx,s=o.b*n+o.d*s+o.ty}this._currentPoly.points.push(i,s)}else this._currentPoly.points.push(0,0)}}buildPath(){let e=this._graphicsPath2D;this.shapePrimitives.length=0,this._currentPoly=null;for(let t=0;t{fr();wt();Ae();uw();Cw();Yi=class r{constructor(e,t=!1){this.instructions=[],this.uid=he("graphicsPath"),this._dirty=!0,this.checkForHoles=t,typeof e=="string"?cw(e,this):this.instructions=e?.slice()??[]}get shapePath(){return this._shapePath||(this._shapePath=new Bh(this)),this._dirty&&(this._dirty=!1,this._shapePath.buildPath()),this._shapePath}addPath(e,t){return e=e.clone(),this.instructions.push({action:"addPath",data:[e,t]}),this._dirty=!0,this}arc(...e){return this.instructions.push({action:"arc",data:e}),this._dirty=!0,this}arcTo(...e){return this.instructions.push({action:"arcTo",data:e}),this._dirty=!0,this}arcToSvg(...e){return this.instructions.push({action:"arcToSvg",data:e}),this._dirty=!0,this}bezierCurveTo(...e){return this.instructions.push({action:"bezierCurveTo",data:e}),this._dirty=!0,this}bezierCurveToShort(e,t,i,s,o){let n=this.instructions[this.instructions.length-1],a=this.getLastPoint(de.shared),l=0,c=0;if(!n||n.action!=="bezierCurveTo")l=a.x,c=a.y;else{l=n.data[2],c=n.data[3];let u=a.x,h=a.y;l=u+(u-l),c=h+(h-c)}return this.instructions.push({action:"bezierCurveTo",data:[l,c,e,t,i,s,o]}),this._dirty=!0,this}closePath(){return this.instructions.push({action:"closePath",data:[]}),this._dirty=!0,this}ellipse(...e){return this.instructions.push({action:"ellipse",data:e}),this._dirty=!0,this}lineTo(...e){return this.instructions.push({action:"lineTo",data:e}),this._dirty=!0,this}moveTo(...e){return this.instructions.push({action:"moveTo",data:e}),this}quadraticCurveTo(...e){return this.instructions.push({action:"quadraticCurveTo",data:e}),this._dirty=!0,this}quadraticCurveToShort(e,t,i){let s=this.instructions[this.instructions.length-1],o=this.getLastPoint(de.shared),n=0,a=0;if(!s||s.action!=="quadraticCurveTo")n=o.x,a=o.y;else{n=s.data[0],a=s.data[1];let l=o.x,c=o.y;n=l+(l-n),a=c+(c-a)}return this.instructions.push({action:"quadraticCurveTo",data:[n,a,e,t,i]}),this._dirty=!0,this}rect(e,t,i,s,o){return this.instructions.push({action:"rect",data:[e,t,i,s,o]}),this._dirty=!0,this}circle(e,t,i,s){return this.instructions.push({action:"circle",data:[e,t,i,s]}),this._dirty=!0,this}roundRect(...e){return this.instructions.push({action:"roundRect",data:e}),this._dirty=!0,this}poly(...e){return this.instructions.push({action:"poly",data:e}),this._dirty=!0,this}regularPoly(...e){return this.instructions.push({action:"regularPoly",data:e}),this._dirty=!0,this}roundPoly(...e){return this.instructions.push({action:"roundPoly",data:e}),this._dirty=!0,this}roundShape(...e){return this.instructions.push({action:"roundShape",data:e}),this._dirty=!0,this}filletRect(...e){return this.instructions.push({action:"filletRect",data:e}),this._dirty=!0,this}chamferRect(...e){return this.instructions.push({action:"chamferRect",data:e}),this._dirty=!0,this}star(e,t,i,s,o,n,a){o||(o=s/2);let l=-1*Math.PI/2+n,c=i*2,u=Math.PI*2/c,h=[];for(let d=0;d{"use strict"});function Mw(r,e){let t=r.querySelectorAll("defs");for(let i=0;i{Tt();Ae();No();Hg()});function Vg(r){let e=r.match(/url\s*\(\s*['"]?\s*#([^'"\s)]+)\s*['"]?\s*\)/i);return e?e[1]:""}var Iw=y(()=>{"use strict"});function Wg(r,e){let t=r.getAttribute("style"),i={},s={},o={strokeStyle:i,fillStyle:s,useFill:!1,useStroke:!1};for(let n in Bw){let a=r.getAttribute(n);a&&kw(e,o,n,a.trim())}if(t){let n=t.split(";");for(let a=0;a{Tt();Iw();Bw={fill:{type:"paint",default:0},"fill-opacity":{type:"number",default:1},stroke:{type:"paint",default:0},"stroke-width":{type:"number",default:1},"stroke-opacity":{type:"number",default:1},"stroke-linecap":{type:"string",default:"butt"},"stroke-linejoin":{type:"string",default:"miter"},"stroke-miterlimit":{type:"number",default:10},"stroke-dasharray":{type:"string",default:"none"},"stroke-dashoffset":{type:"number",default:0},opacity:{type:"number",default:1}}});function Ow(r,e){if(typeof r=="string"){let n=document.createElement("div");n.innerHTML=r.trim(),r=n.querySelector("svg")}let t={context:e,defs:{},path:new Yi};Mw(r,t);let i=r.children,{fillStyle:s,strokeStyle:o}=Wg(r,t);for(let n=0;nparseInt(B,10)),e.context.poly(x,!0),t&&e.context.fill(t),i&&e.context.stroke(i);break;case"polyline":T=r.getAttribute("points"),x=T.match(/\d+/g).map(B=>parseInt(B,10)),e.context.poly(x,!1),i&&e.context.stroke(i);break;case"g":case"svg":break;default:{W(`[SVG parser] <${r.nodeName}> elements unsupported`);break}}a&&(t=null);for(let B=0;B{Ae();Ng();Rw();Hg();Fw()});function zO(r){return oe.isColorLike(r)}function Lw(r){return r instanceof yi}function Dw(r){return r instanceof qt}function $O(r){return r instanceof k}function XO(r,e,t){let i=oe.shared.setValue(e??0);return r.color=i.toNumber(),r.alpha=i.alpha===1?t.alpha:i.alpha,r.texture=k.WHITE,{...t,...r}}function jO(r,e,t){return r.texture=e,{...t,...r}}function Nw(r,e,t){return r.fill=e,r.color=16777215,r.texture=e.texture,r.matrix=e.transform,{...t,...r}}function Hw(r,e,t){return e.buildGradient(),r.fill=e,r.color=16777215,r.texture=e.texture,r.matrix=e.transform,r.textureSpace=e.textureSpace,{...t,...r}}function YO(r,e){let t={...e,...r},i=oe.shared.setValue(t.color);return t.alpha*=i.alpha,t.color=i.toNumber(),t}function _i(r,e){if(r==null)return null;let t={},i=r;return zO(r)?XO(t,r,e):$O(r)?jO(t,r,e):Lw(r)?Nw(t,r,e):Dw(r)?Hw(t,r,e):i.fill&&Lw(i.fill)?Nw(i,i.fill,e):i.fill&&Dw(i.fill)?Hw(i,i.fill,e):YO(i,e)}function jo(r,e){let{width:t,alignment:i,miterLimit:s,cap:o,join:n,pixelLine:a,...l}=e,c=_i(r,l);return c?{width:t,alignment:i,miterLimit:s,cap:o,join:n,pixelLine:a,...c}:null}var zg=y(()=>{Tt();ve();No();wh()});var qO,Vw,$g,Ht,kh=y(()=>{Mt();Tt();ge();fr();ve();wt();Xe();$t();Ng();Gw();zg();qO=new de,Vw=new G,$g=class Kr extends Ce{constructor(){super(...arguments),this.uid=he("graphicsContext"),this.dirty=!0,this.batchMode="auto",this.instructions=[],this._activePath=new Yi,this._transform=new G,this._fillStyle={...Kr.defaultFillStyle},this._strokeStyle={...Kr.defaultStrokeStyle},this._stateStack=[],this._tick=0,this._bounds=new Ee,this._boundsDirty=!0}clone(){let e=new Kr;return e.batchMode=this.batchMode,e.instructions=this.instructions.slice(),e._activePath=this._activePath.clone(),e._transform=this._transform.clone(),e._fillStyle={...this._fillStyle},e._strokeStyle={...this._strokeStyle},e._stateStack=this._stateStack.slice(),e._bounds=this._bounds.clone(),e._boundsDirty=!0,e}get fillStyle(){return this._fillStyle}set fillStyle(e){this._fillStyle=_i(e,Kr.defaultFillStyle)}get strokeStyle(){return this._strokeStyle}set strokeStyle(e){this._strokeStyle=jo(e,Kr.defaultStrokeStyle)}setFillStyle(e){return this._fillStyle=_i(e,Kr.defaultFillStyle),this}setStrokeStyle(e){return this._strokeStyle=_i(e,Kr.defaultStrokeStyle),this}texture(e,t,i,s,o,n){return this.instructions.push({action:"texture",data:{image:e,dx:i||0,dy:s||0,dw:o||e.frame.width,dh:n||e.frame.height,transform:this._transform.clone(),alpha:this._fillStyle.alpha,style:t?oe.shared.setValue(t).toNumber():16777215}}),this.onUpdate(),this}beginPath(){return this._activePath=new Yi,this}fill(e,t){let i,s=this.instructions[this.instructions.length-1];return this._tick===0&&s&&s.action==="stroke"?i=s.data.path:i=this._activePath.clone(),i?(e!=null&&(t!==void 0&&typeof e=="number"&&(X(ie,"GraphicsContext.fill(color, alpha) is deprecated, use GraphicsContext.fill({ color, alpha }) instead"),e={color:e,alpha:t}),this._fillStyle=_i(e,Kr.defaultFillStyle)),this.instructions.push({action:"fill",data:{style:this.fillStyle,path:i}}),this.onUpdate(),this._initNextPathLocation(),this._tick=0,this):this}_initNextPathLocation(){let{x:e,y:t}=this._activePath.getLastPoint(de.shared);this._activePath.clear(),this._activePath.moveTo(e,t)}stroke(e){let t,i=this.instructions[this.instructions.length-1];return this._tick===0&&i&&i.action==="fill"?t=i.data.path:t=this._activePath.clone(),t?(e!=null&&(this._strokeStyle=jo(e,Kr.defaultStrokeStyle)),this.instructions.push({action:"stroke",data:{style:this.strokeStyle,path:t}}),this.onUpdate(),this._initNextPathLocation(),this._tick=0,this):this}cut(){for(let e=0;e<2;e++){let t=this.instructions[this.instructions.length-1-e],i=this._activePath.clone();if(t&&(t.action==="stroke"||t.action==="fill"))if(t.data.hole)t.data.hole.addPath(i);else{t.data.hole=i;break}}return this._initNextPathLocation(),this}arc(e,t,i,s,o,n){this._tick++;let a=this._transform;return this._activePath.arc(a.a*e+a.c*t+a.tx,a.b*e+a.d*t+a.ty,i,s,o,n),this}arcTo(e,t,i,s,o){this._tick++;let n=this._transform;return this._activePath.arcTo(n.a*e+n.c*t+n.tx,n.b*e+n.d*t+n.ty,n.a*i+n.c*s+n.tx,n.b*i+n.d*s+n.ty,o),this}arcToSvg(e,t,i,s,o,n,a){this._tick++;let l=this._transform;return this._activePath.arcToSvg(e,t,i,s,o,l.a*n+l.c*a+l.tx,l.b*n+l.d*a+l.ty),this}bezierCurveTo(e,t,i,s,o,n,a){this._tick++;let l=this._transform;return this._activePath.bezierCurveTo(l.a*e+l.c*t+l.tx,l.b*e+l.d*t+l.ty,l.a*i+l.c*s+l.tx,l.b*i+l.d*s+l.ty,l.a*o+l.c*n+l.tx,l.b*o+l.d*n+l.ty,a),this}closePath(){return this._tick++,this._activePath?.closePath(),this}ellipse(e,t,i,s){return this._tick++,this._activePath.ellipse(e,t,i,s,this._transform.clone()),this}circle(e,t,i){return this._tick++,this._activePath.circle(e,t,i,this._transform.clone()),this}path(e){return this._tick++,this._activePath.addPath(e,this._transform.clone()),this}lineTo(e,t){this._tick++;let i=this._transform;return this._activePath.lineTo(i.a*e+i.c*t+i.tx,i.b*e+i.d*t+i.ty),this}moveTo(e,t){this._tick++;let i=this._transform,s=this._activePath.instructions,o=i.a*e+i.c*t+i.tx,n=i.b*e+i.d*t+i.ty;return s.length===1&&s[0].action==="moveTo"?(s[0].data[0]=o,s[0].data[1]=n,this):(this._activePath.moveTo(o,n),this)}quadraticCurveTo(e,t,i,s,o){this._tick++;let n=this._transform;return this._activePath.quadraticCurveTo(n.a*e+n.c*t+n.tx,n.b*e+n.d*t+n.ty,n.a*i+n.c*s+n.tx,n.b*i+n.d*s+n.ty,o),this}rect(e,t,i,s){return this._tick++,this._activePath.rect(e,t,i,s,this._transform.clone()),this}roundRect(e,t,i,s,o){return this._tick++,this._activePath.roundRect(e,t,i,s,o,this._transform.clone()),this}poly(e,t){return this._tick++,this._activePath.poly(e,t,this._transform.clone()),this}regularPoly(e,t,i,s,o=0,n){return this._tick++,this._activePath.regularPoly(e,t,i,s,o,n),this}roundPoly(e,t,i,s,o,n){return this._tick++,this._activePath.roundPoly(e,t,i,s,o,n),this}roundShape(e,t,i,s){return this._tick++,this._activePath.roundShape(e,t,i,s),this}filletRect(e,t,i,s,o){return this._tick++,this._activePath.filletRect(e,t,i,s,o),this}chamferRect(e,t,i,s,o,n){return this._tick++,this._activePath.chamferRect(e,t,i,s,o,n),this}star(e,t,i,s,o=0,n=0){return this._tick++,this._activePath.star(e,t,i,s,o,n,this._transform.clone()),this}svg(e){return this._tick++,Ow(e,this),this}restore(){let e=this._stateStack.pop();return e&&(this._transform=e.transform,this._fillStyle=e.fillStyle,this._strokeStyle=e.strokeStyle),this}save(){return this._stateStack.push({transform:this._transform.clone(),fillStyle:{...this._fillStyle},strokeStyle:{...this._strokeStyle}}),this}getTransform(){return this._transform}resetTransform(){return this._transform.identity(),this}rotate(e){return this._transform.rotate(e),this}scale(e,t=e){return this._transform.scale(e,t),this}setTransform(e,t,i,s,o,n){return e instanceof G?(this._transform.set(e.a,e.b,e.c,e.d,e.tx,e.ty),this):(this._transform.set(e,t,i,s,o,n),this)}transform(e,t,i,s,o,n){return e instanceof G?(this._transform.append(e),this):(Vw.set(e,t,i,s,o,n),this._transform.append(Vw),this)}translate(e,t=e){return this._transform.translate(e,t),this}clear(){return this._activePath.clear(),this.instructions.length=0,this.resetTransform(),this.onUpdate(),this}onUpdate(){this.dirty||(this.emit("update",this,16),this.dirty=!0,this._boundsDirty=!0)}get bounds(){if(!this._boundsDirty)return this._bounds;let e=this._bounds;e.clear();for(let t=0;t{Tt();Ww=["align","breakWords","cssOverrides","fontVariant","fontWeight","leading","letterSpacing","lineHeight","padding","textBaseline","trim","whiteSpace","wordWrap","wordWrapWidth","fontFamily","fontStyle","fontSize"]});function QO(r){let e=r;if(typeof e.dropShadow=="boolean"&&e.dropShadow){let t=Oe.defaultDropShadow;r.dropShadow={alpha:e.dropShadowAlpha??t.alpha,angle:e.dropShadowAngle??t.angle,blur:e.dropShadowBlur??t.blur,color:e.dropShadowColor??t.color,distance:e.dropShadowDistance??t.distance}}if(e.strokeThickness!==void 0){X(ie,"strokeThickness is now a part of stroke");let t=e.stroke,i={};if(oe.isColorLike(t))i.color=t;else if(t instanceof qt||t instanceof yi)i.fill=t;else if(Object.hasOwnProperty.call(t,"color")||Object.hasOwnProperty.call(t,"fill"))i=t;else throw new Error("Invalid stroke value.");r.stroke={...i,width:e.strokeThickness}}if(Array.isArray(e.fillGradientStops)){X(ie,"gradient fill is now a fill pattern: `new FillGradient(...)`");let t;r.fontSize==null?r.fontSize=Oe.defaultTextStyle.fontSize:typeof r.fontSize=="string"?t=parseInt(r.fontSize,10):t=r.fontSize;let i=new qt({start:{x:0,y:0},end:{x:0,y:(t||0)*1.7}}),s=e.fillGradientStops.map(o=>oe.shared.setValue(o).toNumber());s.forEach((o,n)=>{let a=n/(s.length-1);i.addColorStop(a,o)}),r.fill={fill:i}}}var jg,Oe,Bs=y(()=>{Mt();Tt();Xe();No();wh();kh();zg();Xg();jg=class Yo extends Ce{constructor(e={}){super(),QO(e);let t={...Yo.defaultTextStyle,...e};for(let i in t){let s=i;this[s]=t[i]}this.update()}get align(){return this._align}set align(e){this._align=e,this.update()}get breakWords(){return this._breakWords}set breakWords(e){this._breakWords=e,this.update()}get dropShadow(){return this._dropShadow}set dropShadow(e){e!==null&&typeof e=="object"?this._dropShadow=this._createProxy({...Yo.defaultDropShadow,...e}):this._dropShadow=e?this._createProxy({...Yo.defaultDropShadow}):null,this.update()}get fontFamily(){return this._fontFamily}set fontFamily(e){this._fontFamily=e,this.update()}get fontSize(){return this._fontSize}set fontSize(e){typeof e=="string"?this._fontSize=parseInt(e,10):this._fontSize=e,this.update()}get fontStyle(){return this._fontStyle}set fontStyle(e){this._fontStyle=e.toLowerCase(),this.update()}get fontVariant(){return this._fontVariant}set fontVariant(e){this._fontVariant=e,this.update()}get fontWeight(){return this._fontWeight}set fontWeight(e){this._fontWeight=e,this.update()}get leading(){return this._leading}set leading(e){this._leading=e,this.update()}get letterSpacing(){return this._letterSpacing}set letterSpacing(e){this._letterSpacing=e,this.update()}get lineHeight(){return this._lineHeight}set lineHeight(e){this._lineHeight=e,this.update()}get padding(){return this._padding}set padding(e){this._padding=e,this.update()}get trim(){return this._trim}set trim(e){this._trim=e,this.update()}get textBaseline(){return this._textBaseline}set textBaseline(e){this._textBaseline=e,this.update()}get whiteSpace(){return this._whiteSpace}set whiteSpace(e){this._whiteSpace=e,this.update()}get wordWrap(){return this._wordWrap}set wordWrap(e){this._wordWrap=e,this.update()}get wordWrapWidth(){return this._wordWrapWidth}set wordWrapWidth(e){this._wordWrapWidth=e,this.update()}get fill(){return this._originalFill}set fill(e){e!==this._originalFill&&(this._originalFill=e,this._isFillStyle(e)&&(this._originalFill=this._createProxy({...Ht.defaultFillStyle,...e},()=>{this._fill=_i({...this._originalFill},Ht.defaultFillStyle)})),this._fill=_i(e===0?"black":e,Ht.defaultFillStyle),this.update())}get stroke(){return this._originalStroke}set stroke(e){e!==this._originalStroke&&(this._originalStroke=e,this._isFillStyle(e)&&(this._originalStroke=this._createProxy({...Ht.defaultStrokeStyle,...e},()=>{this._stroke=jo({...this._originalStroke},Ht.defaultStrokeStyle)})),this._stroke=jo(e,Ht.defaultStrokeStyle),this.update())}_generateKey(){return this._styleKey=Fh(this),this._styleKey}update(){this._styleKey=null,this.emit("update",this)}reset(){let e=Yo.defaultTextStyle;for(let t in e)this[t]=e[t]}get styleKey(){return this._styleKey||this._generateKey()}clone(){return new Yo({align:this.align,breakWords:this.breakWords,dropShadow:this._dropShadow?{...this._dropShadow}:null,fill:this._fill,fontFamily:this.fontFamily,fontSize:this.fontSize,fontStyle:this.fontStyle,fontVariant:this.fontVariant,fontWeight:this.fontWeight,leading:this.leading,letterSpacing:this.letterSpacing,lineHeight:this.lineHeight,padding:this.padding,stroke:this._stroke,textBaseline:this.textBaseline,whiteSpace:this.whiteSpace,wordWrap:this.wordWrap,wordWrapWidth:this.wordWrapWidth})}destroy(e=!1){if(this.removeAllListeners(),typeof e=="boolean"?e:e?.texture){let i=typeof e=="boolean"?e:e?.textureSource;this._fill?.texture&&this._fill.texture.destroy(i),this._originalFill?.texture&&this._originalFill.texture.destroy(i),this._stroke?.texture&&this._stroke.texture.destroy(i),this._originalStroke?.texture&&this._originalStroke.texture.destroy(i)}this._fill=null,this._stroke=null,this.dropShadow=null,this._originalStroke=null,this._originalFill=null}_createProxy(e,t){return new Proxy(e,{set:(i,s,o)=>(i[s]=o,t?.(s,o),this.update(),!0)})}_isFillStyle(e){return(e??null)!==null&&!(oe.isColorLike(e)||e instanceof qt||e instanceof yi)}};jg.defaultDropShadow={alpha:1,angle:Math.PI/6,blur:0,color:"black",distance:5};jg.defaultTextStyle={align:"left",breakWords:!1,dropShadow:null,fill:"black",fontFamily:"Arial",fontSize:26,fontStyle:"normal",fontVariant:"normal",fontWeight:"normal",leading:0,letterSpacing:0,lineHeight:0,padding:0,stroke:null,textBaseline:"alphabetic",trim:!1,whiteSpace:"pre",wordWrap:!1,wordWrapWidth:100};Oe=jg});function Oh(r,e,t,i){let s=JO;s.minX=0,s.minY=0,s.maxX=r.width/i|0,s.maxY=r.height/i|0;let o=je.getOptimalTexture(s.width,s.height,i,!1);return o.source.uploadMethodId="image",o.source.resource=r,o.source.alphaMode="premultiply-alpha-on-upload",o.frame.width=e/i,o.frame.height=t/i,o.source.emit("update",o.source),o.updateUvs(),o}var JO,Yg=y(()=>{Oi();$t();JO=new Ee});function ks(r){let e=typeof r.fontSize=="number"?`${r.fontSize}px`:r.fontSize,t=r.fontFamily;Array.isArray(r.fontFamily)||(t=r.fontFamily.split(","));for(let i=t.length-1;i>=0;i--){let s=t[i].trim();!/([\"\'])[^\'\"]+\1/.test(s)&&!eU.includes(s)&&(s=`"${s}"`),t[i]=s}return`${r.fontStyle} ${r.fontVariant} ${r.fontWeight} ${e} ${t.join(",")}`}var eU,Uh=y(()=>{"use strict";eU=["serif","sans-serif","monospace","cursive","fantasy","system-ui"]});var qg,Ir,De,Qa=y(()=>{Re();Uh();qg={willReadFrequently:!0},Ir=class q{static get experimentalLetterSpacingSupported(){let e=q._experimentalLetterSpacingSupported;if(e!==void 0){let t=j.get().getCanvasRenderingContext2D().prototype;e=q._experimentalLetterSpacingSupported="letterSpacing"in t||"textLetterSpacing"in t}return e}constructor(e,t,i,s,o,n,a,l,c){this.text=e,this.style=t,this.width=i,this.height=s,this.lines=o,this.lineWidths=n,this.lineHeight=a,this.maxLineWidth=l,this.fontProperties=c}static measureText(e=" ",t,i=q._canvas,s=t.wordWrap){let o=`${e}:${t.styleKey}`;if(q._measurementCache[o])return q._measurementCache[o];let n=ks(t),a=q.measureFont(n);a.fontSize===0&&(a.fontSize=t.fontSize,a.ascent=t.fontSize);let l=q.__context;l.font=n;let u=(s?q._wordWrap(e,t,i):e).split(/(?:\r\n|\r|\n)/),h=new Array(u.length),d=0;for(let v=0;v0)if(s)n-=t,c-=t;else{let u=(q.graphemeSegmenter(e).length-1)*t;n+=u,c+=u}return Math.max(n,c)}static _wordWrap(e,t,i=q._canvas){let s=i.getContext("2d",qg),o=0,n="",a="",l=Object.create(null),{letterSpacing:c,whiteSpace:u}=t,h=q._collapseSpaces(u),d=q._collapseNewlines(u),f=!h,p=t.wordWrapWidth+c,m=q._tokenize(e);for(let g=0;gp)if(n!==""&&(a+=q._addLine(n),n="",o=0),q.canBreakWords(_,t.breakWords)){let x=q.wordWrapSplit(_);for(let T=0;Tp&&(a+=q._addLine(n),f=!1,n="",o=0),n+=b,o+=I}}else{n.length>0&&(a+=q._addLine(n),n="",o=0);let x=g===m.length-1;a+=q._addLine(_,!x),f=!1,n="",o=0}else v+o>p&&(f=!1,a+=q._addLine(n),n="",o=0),(n.length>0||!q.isBreakingSpace(_)||f)&&(n+=_,o+=v)}return a+=q._addLine(n,!1),a}static _addLine(e,t=!0){return e=q._trimRight(e),e=t?`${e} -`:e,e}static _getFromCache(e,t,i,s){let o=i[e];return typeof o!="number"&&(o=q._measureText(e,t,s)+t,i[e]=o),o}static _collapseSpaces(e){return e==="normal"||e==="pre-line"}static _collapseNewlines(e){return e==="normal"}static _trimRight(e){if(typeof e!="string")return"";for(let t=e.length-1;t>=0;t--){let i=e[t];if(!q.isBreakingSpace(i))break;e=e.slice(0,-1)}return e}static _isNewline(e){return typeof e!="string"?!1:q._newlines.includes(e.charCodeAt(0))}static isBreakingSpace(e,t){return typeof e!="string"?!1:q._breakingSpaces.includes(e.charCodeAt(0))}static _tokenize(e){let t=[],i="";if(typeof e!="string")return t;for(let s=0;s{if(typeof Intl?.Segmenter=="function"){let r=new Intl.Segmenter;return e=>[...r.segment(e)].map(t=>t.segment)}return r=>[...r]})();Ir.experimentalLetterSpacing=!1;Ir._fonts={};Ir._newlines=[10,13];Ir._breakingSpaces=[9,32,8192,8193,8194,8195,8196,8197,8198,8200,8201,8202,8287,12288];Ir._measurementCache={};De=Ir});function qo(r,e,t,i=0){if(r.texture===k.WHITE&&!r.fill)return oe.shared.setValue(r.color).setAlpha(r.alpha??1).toHexa();if(r.fill){if(r.fill instanceof yi){let s=r.fill,o=e.createPattern(s.texture.source.resource,"repeat"),n=s.transform.copyTo(G.shared);return n.scale(s.texture.frame.width,s.texture.frame.height),o.setTransform(n),o}else if(r.fill instanceof qt){let s=r.fill,o=s.type==="linear",n=s.textureSpace==="local",a=1,l=1;n&&t&&(a=t.width+i,l=t.height+i);let c,u=!1;if(o){let{start:h,end:d}=s;c=e.createLinearGradient(h.x*a,h.y*l,d.x*a,d.y*l),u=Math.abs(d.x-h.x){let m=f+p.offset*h;c.addColorStop(Math.floor(m*$w)/$w,oe.shared.setValue(p.color).toHex())})}}else s.colorStops.forEach(h=>{c.addColorStop(h.offset,oe.shared.setValue(h.color).toHex())});return c}}else{let s=e.createPattern(r.texture.source.resource,"repeat"),o=r.matrix.copyTo(G.shared);return o.scale(r.texture.frame.width,r.texture.frame.height),s.setTransform(o),s}return W("FillStyle not recognised",r),"red"}var $w,Kg=y(()=>{Tt();ge();ve();Ae();No();wh();$w=1e5});var Ja,Xw=y(()=>{Tt();U();ya();zo();Oi();sw();Xe();Bs();Yg();Qa();Uh();Kg();Ja=class{constructor(e){this._activeTextures={},this._renderer=e}getTextureSize(e,t,i){let s=De.measureText(e||" ",i),o=Math.ceil(Math.ceil(Math.max(1,s.width)+i.padding*2)*t),n=Math.ceil(Math.ceil(Math.max(1,s.height)+i.padding*2)*t);return o=Math.ceil(o-1e-6),n=Math.ceil(n-1e-6),o=di(o),n=di(n),{width:o,height:n}}getTexture(e,t,i,s){typeof e=="string"&&(X("8.0.0","CanvasTextSystem.getTexture: Use object TextOptions instead of separate arguments"),e={text:e,style:i,resolution:t}),e.style instanceof Oe||(e.style=new Oe(e.style));let{texture:o,canvasAndContext:n}=this.createTextureAndCanvas(e);return this._renderer.texture.initSource(o._source),Kt.returnCanvasAndContext(n),o}createTextureAndCanvas(e){let{text:t,style:i}=e,s=e.resolution??this._renderer.resolution,o=De.measureText(t||" ",i),n=Math.ceil(Math.ceil(Math.max(1,o.width)+i.padding*2)*s),a=Math.ceil(Math.ceil(Math.max(1,o.height)+i.padding*2)*s),l=Kt.getOptimalCanvasAndContext(n,a),{canvas:c}=l;this.renderTextToCanvas(t,i,s,l);let u=Oh(c,n,a,s);if(i.trim){let h=iw(c,s);u.frame.copyFrom(h),u.updateUvs()}return{texture:u,canvasAndContext:l}}getManagedTexture(e){e._resolution=e._autoResolution?this._renderer.resolution:e.resolution;let t=e._getKey();if(this._activeTextures[t])return this._increaseReferenceCount(t),this._activeTextures[t].texture;let{texture:i,canvasAndContext:s}=this.createTextureAndCanvas(e);return this._activeTextures[t]={canvasAndContext:s,texture:i,usageCount:1},i}_increaseReferenceCount(e){this._activeTextures[e].usageCount++}returnTexture(e){let t=e.source;t.resource=null,t.uploadMethodId="unknown",t.alphaMode="no-premultiply-alpha",je.returnTexture(e)}decreaseReferenceCount(e){let t=this._activeTextures[e];t.usageCount--,t.usageCount===0&&(Kt.returnCanvasAndContext(t.canvasAndContext),this.returnTexture(t.texture),this._activeTextures[e]=null)}getReferenceCount(e){return this._activeTextures[e].usageCount}renderTextToCanvas(e,t,i,s){let{canvas:o,context:n}=s,a=ks(t),l=De.measureText(e||" ",t),c=l.lines,u=l.lineHeight,h=l.lineWidths,d=l.maxLineWidth,f=l.fontProperties,p=o.height;if(n.resetTransform(),n.scale(i,i),n.textBaseline=t.textBaseline,t._stroke?.width){let v=t._stroke;n.lineWidth=v.width,n.miterLimit=v.miterLimit,n.lineJoin=v.join,n.lineCap=v.cap}n.font=a;let m,g,_=t.dropShadow?2:1;for(let v=0;v<_;++v){let x=t.dropShadow&&v===0,T=x?Math.ceil(Math.max(1,p)+t.padding*2):0,b=T*i;if(x){n.fillStyle="black",n.strokeStyle="black";let I=t.dropShadow,B=I.color,C=I.alpha;n.shadowColor=oe.shared.setValue(B).setAlpha(C).toRgbaString();let A=I.blur*i,P=I.distance*i;n.shadowBlur=A,n.shadowOffsetX=Math.cos(I.angle)*P,n.shadowOffsetY=Math.sin(I.angle)*P+b}else{if(n.fillStyle=t._fill?qo(t._fill,n,l):null,t._stroke?.width){let I=t._stroke.width*t._stroke.alignment;n.strokeStyle=qo(t._stroke,n,l,I)}n.shadowColor="black"}let w=(u-f.fontSize)/2;u-f.fontSize<0&&(w=0);let E=t._stroke?.width??0;for(let I=0;I{U();ew();Xw();V.add(Ja);V.add(qa)});var Ue,Qg=y(()=>{Xe();Xu();kh();Ue=class r extends Li{constructor(e){e instanceof Ht&&(e={context:e});let{context:t,roundPixels:i,...s}=e||{};super({label:"Graphics",...s}),this.renderPipeId="graphics",t?this._context=t:this._context=this._ownedContext=new Ht,this._context.on("update",this.onViewUpdate,this),this.allowChildren=!1,this.roundPixels=i??!1}set context(e){e!==this._context&&(this._context.off("update",this.onViewUpdate,this),this._context=e,this._context.on("update",this.onViewUpdate,this),this.onViewUpdate())}get context(){return this._context}get bounds(){return this._context.bounds}updateBounds(){}containsPoint(e){return this._context.containsPoint(e)}destroy(e){this._ownedContext&&!e?this._ownedContext.destroy(e):(e===!0||e?.context===!0)&&this._context.destroy(e),this._ownedContext=null,this._context=null,super.destroy(e)}_callContextMethod(e,t){return this.context[e](...t),this}setFillStyle(...e){return this._callContextMethod("setFillStyle",e)}setStrokeStyle(...e){return this._callContextMethod("setStrokeStyle",e)}fill(...e){return this._callContextMethod("fill",e)}stroke(...e){return this._callContextMethod("stroke",e)}texture(...e){return this._callContextMethod("texture",e)}beginPath(){return this._callContextMethod("beginPath",[])}cut(){return this._callContextMethod("cut",[])}arc(...e){return this._callContextMethod("arc",e)}arcTo(...e){return this._callContextMethod("arcTo",e)}arcToSvg(...e){return this._callContextMethod("arcToSvg",e)}bezierCurveTo(...e){return this._callContextMethod("bezierCurveTo",e)}closePath(){return this._callContextMethod("closePath",[])}ellipse(...e){return this._callContextMethod("ellipse",e)}circle(...e){return this._callContextMethod("circle",e)}path(...e){return this._callContextMethod("path",e)}lineTo(...e){return this._callContextMethod("lineTo",e)}moveTo(...e){return this._callContextMethod("moveTo",e)}quadraticCurveTo(...e){return this._callContextMethod("quadraticCurveTo",e)}rect(...e){return this._callContextMethod("rect",e)}roundRect(...e){return this._callContextMethod("roundRect",e)}poly(...e){return this._callContextMethod("poly",e)}regularPoly(...e){return this._callContextMethod("regularPoly",e)}roundPoly(...e){return this._callContextMethod("roundPoly",e)}roundShape(...e){return this._callContextMethod("roundShape",e)}filletRect(...e){return this._callContextMethod("filletRect",e)}chamferRect(...e){return this._callContextMethod("chamferRect",e)}star(...e){return this._callContextMethod("star",e)}svg(...e){return this._callContextMethod("svg",e)}restore(...e){return this._callContextMethod("restore",e)}save(){return this._callContextMethod("save",[])}getTransform(){return this.context.getTransform()}resetTransform(){return this._callContextMethod("resetTransform",[])}rotateTransform(...e){return this._callContextMethod("rotate",e)}scaleTransform(...e){return this._callContextMethod("scale",e)}setTransform(...e){return this._callContextMethod("setTransform",e)}transform(...e){return this._callContextMethod("transform",e)}translateTransform(...e){return this._callContextMethod("translate",e)}clear(){return this._callContextMethod("clear",[])}get fillStyle(){return this._context.fillStyle}set fillStyle(e){this._context.fillStyle=e}get strokeStyle(){return this._context.strokeStyle}set strokeStyle(e){this._context.strokeStyle=e}clone(e=!1){return e?new r(this._context.clone()):(this._ownedContext=null,new r(this._context))}lineStyle(e,t,i){X(ie,"Graphics#lineStyle is no longer needed. Use Graphics#setStrokeStyle to set the stroke style.");let s={};return e&&(s.width=e),t&&(s.color=t),i&&(s.alpha=i),this.context.strokeStyle=s,this}beginFill(e,t){X(ie,"Graphics#beginFill is no longer needed. Use Graphics#fill to fill the shape with the desired style.");let i={};return e!==void 0&&(i.color=e),t!==void 0&&(i.alpha=t),this.context.fillStyle=i,this}endFill(){X(ie,"Graphics#endFill is no longer needed. Use Graphics#fill to fill the shape with the desired style."),this.context.fill();let e=this.context.strokeStyle;return(e.width!==Ht.defaultStrokeStyle.width||e.color!==Ht.defaultStrokeStyle.color||e.alpha!==Ht.defaultStrokeStyle.alpha)&&this.context.stroke(),this}drawCircle(...e){return X(ie,"Graphics#drawCircle has been renamed to Graphics#circle"),this._callContextMethod("circle",e)}drawEllipse(...e){return X(ie,"Graphics#drawEllipse has been renamed to Graphics#ellipse"),this._callContextMethod("ellipse",e)}drawPolygon(...e){return X(ie,"Graphics#drawPolygon has been renamed to Graphics#poly"),this._callContextMethod("poly",e)}drawRect(...e){return X(ie,"Graphics#drawRect has been renamed to Graphics#rect"),this._callContextMethod("rect",e)}drawRoundedRect(...e){return X(ie,"Graphics#drawRoundedRect has been renamed to Graphics#roundRect"),this._callContextMethod("roundRect",e)}drawStar(...e){return X(ie,"Graphics#drawStar has been renamed to Graphics#star"),this._callContextMethod("star",e)}}});var jw,Yw,qw=y(()=>{"use strict";jw={name:"local-uniform-msdf-bit",vertex:{header:` +}`});var Th,KS=y(()=>{Tt();ge();As();Bo();Mr();ve();sm();XS();YS();qS();Th=class extends Ze{constructor(){let e=gr.from({vertex:jS,fragment:$S}),t=xr.from({fragment:{source:Pg,entryPoint:"mainFragment"},vertex:{source:Pg,entryPoint:"mainVertex"}});super({glProgram:e,gpuProgram:t,resources:{uTexture:k.WHITE.source,uSampler:new Gu({}),uniforms:{uTranslationMatrix:{value:new G,type:"mat3x3"},uColor:{value:new oe(16777215),type:"vec4"},uRound:{value:1,type:"f32"},uResolution:{value:[0,0],type:"vec2"}}}})}}});var Wo,Cg=y(()=>{ge();It();Fa();Rr();Vo();zS();KS();Wo=class{constructor(e,t){this.state=Je.for2d(),this._gpuBufferHash=Object.create(null),this._destroyRenderableBound=this.destroyRenderable.bind(this),this.localUniforms=new be({uTranslationMatrix:{value:new G,type:"mat3x3"},uColor:{value:new Float32Array(4),type:"vec4"},uRound:{value:1,type:"f32"},uResolution:{value:[0,0],type:"vec2"}}),this.renderer=e,this.adaptor=t,this.defaultShader=new Th,this.state=Je.for2d()}validateRenderable(e){return!1}addRenderable(e,t){this.renderer.renderPipes.batch.break(t),t.add(e)}getBuffers(e){return this._gpuBufferHash[e.uid]||this._initBuffer(e)}_initBuffer(e){return this._gpuBufferHash[e.uid]=new vh({size:e.particleChildren.length,properties:e._properties}),e.on("destroyed",this._destroyRenderableBound),this._gpuBufferHash[e.uid]}updateRenderable(e){}destroyRenderable(e){this._gpuBufferHash[e.uid].destroy(),this._gpuBufferHash[e.uid]=null,e.off("destroyed",this._destroyRenderableBound)}execute(e){let t=e.particleChildren;if(t.length===0)return;let i=this.renderer,s=this.getBuffers(e);e.texture||(e.texture=t[0].texture);let o=this.state;s.update(t,e._childrenDirty),e._childrenDirty=!1,o.blendMode=mi(e.blendMode,e.texture._source);let n=this.localUniforms.uniforms,a=n.uTranslationMatrix;e.worldTransform.copyTo(a),a.prepend(i.globalUniforms.globalUniformData.projectionMatrix),n.uResolution=i.globalUniforms.globalUniformData.resolution,n.uRound=i._roundPixels|e._roundPixels,Yr(e.groupColorAlpha,n.uColor,0),this.adaptor.execute(this,e)}destroy(){this.defaultShader&&(this.defaultShader.destroy(),this.defaultShader=null)}}});var $a,ZS=y(()=>{U();DS();Cg();$a=class extends Wo{constructor(e){super(e,new bh)}};$a.extension={type:[S.WebGLPipes],name:"particle"}});var Sh,QS=y(()=>{"use strict";Sh=class{execute(e,t){let i=e.renderer,s=t.shader||e.defaultShader;s.groups[0]=i.renderPipes.uniformBatch.getUniformBindGroup(e.localUniforms,!0),s.groups[1]=i.texture.getTextureBindGroup(t.texture);let o=e.state,n=e.getBuffers(t);i.encoder.draw({geometry:n.geometry,shader:t.shader||e.defaultShader,state:o,size:t.particleChildren.length*6})}}});var Xa,JS=y(()=>{U();QS();Cg();Xa=class extends Wo{constructor(e){super(e,new Sh)}};Xa.extension={type:[S.WebGPUPipes],name:"particle"}});var Mg=y(()=>{U();ZS();JS();V.add($a);V.add(Xa)});var qr,ja=y(()=>{"use strict";qr=class{constructor(){this.batcherName="default",this.topology="triangle-list",this.attributeSize=4,this.indexSize=6,this.packAsQuad=!0,this.roundPixels=0,this._attributeStart=0,this._batcher=null,this._batch=null}get blendMode(){return this.renderable.groupBlendMode}get color(){return this.renderable.groupColorAlpha}reset(){this.renderable=null,this.texture=null,this._batcher=null,this._batch=null,this.bounds=null}}});function Ya(r,e){let{texture:t,bounds:i}=r;qu(i,e._anchor,t);let s=e._style.padding;i.minX-=s,i.minY-=s,i.maxX-=s,i.maxY-=s}var Rg=y(()=>{Cm()});var qa,ew=y(()=>{U();Gt();ja();Rg();qa=class{constructor(e){this._gpuText=Object.create(null),this._destroyRenderableBound=this.destroyRenderable.bind(this),this._renderer=e,this._renderer.runners.resolutionChange.add(this),this._renderer.renderableGC.addManagedHash(this,"_gpuText")}resolutionChange(){for(let e in this._gpuText){let t=this._gpuText[e];if(!t)continue;let i=t.batchableSprite.renderable;i._autoResolution&&(i._resolution=this._renderer.resolution,i.onViewUpdate())}}validateRenderable(e){let t=this._getGpuText(e),i=e._getKey();return t.currentKey!==i}addRenderable(e,t){let s=this._getGpuText(e).batchableSprite;e._didTextUpdate&&this._updateText(e),this._renderer.renderPipes.batch.addToBatch(s,t)}updateRenderable(e){let i=this._getGpuText(e).batchableSprite;e._didTextUpdate&&this._updateText(e),i._batcher.updateElement(i)}destroyRenderable(e){e.off("destroyed",this._destroyRenderableBound),this._destroyRenderableById(e.uid)}_destroyRenderableById(e){let t=this._gpuText[e];this._renderer.canvasText.decreaseReferenceCount(t.currentKey),se.return(t.batchableSprite),this._gpuText[e]=null}_updateText(e){let t=e._getKey(),i=this._getGpuText(e),s=i.batchableSprite;i.currentKey!==t&&this._updateGpuText(e),e._didTextUpdate=!1,Ya(s,e)}_updateGpuText(e){let t=this._getGpuText(e),i=t.batchableSprite;t.texture&&this._renderer.canvasText.decreaseReferenceCount(t.currentKey),t.texture=i.texture=this._renderer.canvasText.getManagedTexture(e),t.currentKey=e._getKey(),i.texture=t.texture}_getGpuText(e){return this._gpuText[e.uid]||this.initGpuText(e)}initGpuText(e){let t={texture:null,currentKey:"--",batchableSprite:se.get(qr)};return t.batchableSprite.renderable=e,t.batchableSprite.transform=e.groupTransform,t.batchableSprite.bounds={minX:0,maxX:1,minY:0,maxY:0},t.batchableSprite.roundPixels=this._renderer._roundPixels|e._roundPixels,this._gpuText[e.uid]=t,e._resolution=e._autoResolution?this._renderer.resolution:e.resolution,this._updateText(e),e.on("destroyed",this._destroyRenderableBound),t}destroy(){for(let e in this._gpuText)this._destroyRenderableById(e);this._gpuText=null,this._renderer=null}};qa.extension={type:[S.WebGLPipes,S.WebGPUPipes,S.CanvasPipes],name:"text"}});var Ig,Kt,zo=y(()=>{Re();ya();Ig=class{constructor(e){this._canvasPool=Object.create(null),this.canvasOptions=e||{},this.enableFullScreen=!1}_createCanvasAndContext(e,t){let i=j.get().createCanvas();i.width=e,i.height=t;let s=i.getContext("2d");return{canvas:i,context:s}}getOptimalCanvasAndContext(e,t,i=1){e=Math.ceil(e*i-1e-6),t=Math.ceil(t*i-1e-6),e=di(e),t=di(t);let s=(e<<17)+(t<<1);this._canvasPool[s]||(this._canvasPool[s]=[]);let o=this._canvasPool[s].pop();return o||(o=this._createCanvasAndContext(e,t)),o}returnCanvasAndContext(e){let t=e.canvas,{width:i,height:s}=t,o=(i<<17)+(s<<1);e.context.clearRect(0,0,i,s),this._canvasPool[o].push(e)}clear(){this._canvasPool={}}},Kt=new Ig});function tw(r,e,t){for(let i=0,s=4*t*e;i{ut()});var ow,yi,wh=y(()=>{ge();wt();ow={repeat:{addressModeU:"repeat",addressModeV:"repeat"},"repeat-x":{addressModeU:"repeat",addressModeV:"clamp-to-edge"},"repeat-y":{addressModeU:"clamp-to-edge",addressModeV:"repeat"},"no-repeat":{addressModeU:"clamp-to-edge",addressModeV:"clamp-to-edge"}},yi=class{constructor(e,t){this.uid=he("fillPattern"),this.transform=new G,this._styleKey=null,this.texture=e,this.transform.scale(1/e.frame.width,1/e.frame.height),t&&(e.source.style.addressModeU=ow[t].addressModeU,e.source.style.addressModeV=ow[t].addressModeV)}setTransform(e){let t=this.texture;this.transform.copyFrom(e),this.transform.invert(),this.transform.scale(1/t.frame.width,1/t.frame.height),this._styleKey=null}get styleKey(){return this._styleKey?this._styleKey:(this._styleKey=`fill-pattern-${this.uid}-${this.texture.uid}-${this.transform.toArray().join("-")}`,this._styleKey)}}});var aw=ee((Rq,nw)=>{nw.exports=AO;var Bg={a:7,c:6,h:1,l:2,m:2,q:4,s:4,t:2,v:1,z:0},EO=/([astvzqmhlc])([^astvzqmhlc]*)/ig;function AO(r){var e=[];return r.replace(EO,function(t,i,s){var o=i.toLowerCase();for(s=CO(s),o=="m"&&s.length>2&&(e.push([i].concat(s.splice(0,2))),o="l",i=i=="m"?"l":"L");;){if(s.length==Bg[o])return s.unshift(i),e.push(s);if(s.length0&&(s=i.pop(),s?(o=s.startX,n=s.startY):(o=0,n=0)),s=null;break;default:W(`Unknown SVG path command: ${c}`)}c!=="Z"&&c!=="z"&&s===null&&(s={startX:o,startY:n},i.push(s))}return e}var lw,uw=y(()=>{lw=fs(aw(),1);Ae()});var Eh,hw=y(()=>{ut();Eh=class r{constructor(e=0,t=0,i=0){this.type="circle",this.x=e,this.y=t,this.radius=i}clone(){return new r(this.x,this.y,this.radius)}contains(e,t){if(this.radius<=0)return!1;let i=this.radius*this.radius,s=this.x-e,o=this.y-t;return s*=s,o*=o,s+o<=i}strokeContains(e,t,i,s=.5){if(this.radius===0)return!1;let o=this.x-e,n=this.y-t,a=this.radius,l=(1-s)*i,c=Math.sqrt(o*o+n*n);return c<=a+l&&c>a-(i-l)}getBounds(e){return e||(e=new Q),e.x=this.x-this.radius,e.y=this.y-this.radius,e.width=this.radius*2,e.height=this.radius*2,e}copyFrom(e){return this.x=e.x,this.y=e.y,this.radius=e.radius,this}copyTo(e){return e.copyFrom(this),e}toString(){return`[pixi.js/math:Circle x=${this.x} y=${this.y} radius=${this.radius}]`}}});var Ah,dw=y(()=>{ut();Ah=class r{constructor(e=0,t=0,i=0,s=0){this.type="ellipse",this.x=e,this.y=t,this.halfWidth=i,this.halfHeight=s}clone(){return new r(this.x,this.y,this.halfWidth,this.halfHeight)}contains(e,t){if(this.halfWidth<=0||this.halfHeight<=0)return!1;let i=(e-this.x)/this.halfWidth,s=(t-this.y)/this.halfHeight;return i*=i,s*=s,i+s<=1}strokeContains(e,t,i,s=.5){let{halfWidth:o,halfHeight:n}=this;if(o<=0||n<=0)return!1;let a=i*(1-s),l=i-a,c=o-l,u=n-l,h=o+a,d=n+a,f=e-this.x,p=t-this.y,m=f*f/(c*c)+p*p/(u*u),g=f*f/(h*h)+p*p/(d*d);return m>1&&g<=1}getBounds(e){return e||(e=new Q),e.x=this.x-this.halfWidth,e.y=this.y-this.halfHeight,e.width=this.halfWidth*2,e.height=this.halfHeight*2,e}copyFrom(e){return this.x=e.x,this.y=e.y,this.halfWidth=e.halfWidth,this.halfHeight=e.halfHeight,this}copyTo(e){return e.copyFrom(this),e}toString(){return`[pixi.js/math:Ellipse x=${this.x} y=${this.y} halfWidth=${this.halfWidth} halfHeight=${this.halfHeight}]`}}});function fw(r,e,t,i,s,o){let n=r-t,a=e-i,l=s-t,c=o-i,u=n*l+a*c,h=l*l+c*c,d=-1;h!==0&&(d=u/h);let f,p;d<0?(f=t,p=i):d>1?(f=s,p=o):(f=t+d*l,p=i+d*c);let m=r-f,g=e-p;return m*m+g*g}var pw=y(()=>{"use strict"});var MO,RO,$o,mw=y(()=>{pw();ut();$o=class r{constructor(...e){this.type="polygon";let t=Array.isArray(e[0])?e[0]:e;if(typeof t[0]!="number"){let i=[];for(let s=0,o=t.length;st!=u>t&&e<(c-a)*((t-l)/(u-l))+a&&(i=!i)}return i}strokeContains(e,t,i,s=.5){let o=i*i,n=o*(1-s),a=o-n,{points:l}=this,c=l.length-(this.closePath?0:2);for(let u=0;us?c:s,o=un?u:n}return e.x=i,e.width=s-i,e.y=o,e.height=n-o,e}copyFrom(e){return this.points=e.points.slice(),this.closePath=e.closePath,this}copyTo(e){return e.copyFrom(this),e}toString(){return`[pixi.js/math:PolygoncloseStroke=${this.closePath}points=${this.points.reduce((e,t)=>`${e}, ${t}`,"")}]`}get lastX(){return this.points[this.points.length-2]}get lastY(){return this.points[this.points.length-1]}get x(){return this.points[this.points.length-2]}get y(){return this.points[this.points.length-1]}}});var Ph,Ch,gw=y(()=>{ut();Ph=(r,e,t,i,s,o,n)=>{let a=r-t,l=e-i,c=Math.sqrt(a*a+l*l);return c>=s-o&&c<=s+n},Ch=class r{constructor(e=0,t=0,i=0,s=0,o=20){this.type="roundedRectangle",this.x=e,this.y=t,this.width=i,this.height=s,this.radius=o}getBounds(e){return e||(e=new Q),e.x=this.x,e.y=this.y,e.width=this.width,e.height=this.height,e}clone(){return new r(this.x,this.y,this.width,this.height,this.radius)}copyFrom(e){return this.x=e.x,this.y=e.y,this.width=e.width,this.height=e.height,this}copyTo(e){return e.copyFrom(this),e}contains(e,t){if(this.width<=0||this.height<=0)return!1;if(e>=this.x&&e<=this.x+this.width&&t>=this.y&&t<=this.y+this.height){let i=Math.max(0,Math.min(this.radius,Math.min(this.width,this.height)/2));if(t>=this.y+i&&t<=this.y+this.height-i||e>=this.x+i&&e<=this.x+this.width-i)return!0;let s=e-(this.x+i),o=t-(this.y+i),n=i*i;if(s*s+o*o<=n||(s=e-(this.x+this.width-i),s*s+o*o<=n)||(o=t-(this.y+this.height-i),s*s+o*o<=n)||(s=e-(this.x+i),s*s+o*o<=n))return!0}return!1}strokeContains(e,t,i,s=.5){let{x:o,y:n,width:a,height:l,radius:c}=this,u=i*(1-s),h=i-u,d=o+c,f=n+c,p=a-c*2,m=l-c*2,g=o+a,_=n+l;return(e>=o-u&&e<=o+h||e>=g-h&&e<=g+u)&&t>=f&&t<=f+m||(t>=n-u&&t<=n+h||t>=_-h&&t<=_+u)&&e>=d&&e<=d+p?!0:eg-c&&tg-c&&t>_-c&&Ph(e,t,g-c,_-c,c,h,u)||e_-c&&Ph(e,t,d,_-c,c,h,u)}toString(){return`[pixi.js/math:RoundedRectangle x=${this.x} y=${this.y}width=${this.width} height=${this.height} radius=${this.radius}]`}}});function Rh(r,e,t,i,s,o,n,a,l,c){let h=Math.min(.99,Math.max(0,c??Ho.defaultOptions.bezierSmoothness)),d=(BO-h)/1;return d*=d,kO(e,t,i,s,o,n,a,l,r,d),r}function kO(r,e,t,i,s,o,n,a,l,c){Fg(r,e,t,i,s,o,n,a,l,c,0),l.push(n,a)}function Fg(r,e,t,i,s,o,n,a,l,c,u){if(u>IO)return;let h=Math.PI,d=(r+t)/2,f=(e+i)/2,p=(t+s)/2,m=(i+o)/2,g=(s+n)/2,_=(o+a)/2,v=(d+p)/2,x=(f+m)/2,T=(p+g)/2,b=(m+_)/2,E=(v+T)/2,w=(x+b)/2;if(u>0){let I=n-r,B=a-e,C=Math.abs((t-n)*B-(i-a)*I),A=Math.abs((s-n)*B-(o-a)*I),P,R;if(C>Mh&&A>Mh){if((C+A)*(C+A)<=c*(I*I+B*B)){if(Xo=h&&(P=2*h-P),R>=h&&(R=2*h-R),P+RIs){l.push(t,i);return}if(R>Is){l.push(s,o);return}}}}else if(C>Mh){if(C*C<=c*(I*I+B*B)){if(Xo=h&&(P=2*h-P),PIs){l.push(t,i);return}}}else if(A>Mh){if(A*A<=c*(I*I+B*B)){if(Xo=h&&(P=2*h-P),PIs){l.push(s,o);return}}}else if(I=E-(r+n)/2,B=w-(e+a)/2,I*I+B*B<=c){l.push(E,w);return}}Fg(r,e,d,f,v,x,E,w,l,c,u+1),Fg(E,w,T,b,g,_,n,a,l,c,u+1)}var IO,Mh,BO,kg,Xo,Is,Og=y(()=>{yh();IO=8,Mh=11920929e-14,BO=1,kg=.01,Xo=0,Is=0});function yw(r,e,t,i,s,o,n,a){let c=Math.min(.99,Math.max(0,a??Ho.defaultOptions.bezierSmoothness)),u=(UO-c)/1;return u*=u,LO(e,t,i,s,o,n,r,u),r}function LO(r,e,t,i,s,o,n,a){Ug(n,r,e,t,i,s,o,a,0),n.push(s,o)}function Ug(r,e,t,i,s,o,n,a,l){if(l>FO)return;let c=Math.PI,u=(e+i)/2,h=(t+s)/2,d=(i+o)/2,f=(s+n)/2,p=(u+d)/2,m=(h+f)/2,g=o-e,_=n-t,v=Math.abs((i-o)*_-(s-n)*g);if(v>OO){if(v*v<=a*(g*g+_*_)){if(xw=c&&(x=2*c-x),x{yh();FO=8,OO=11920929e-14,UO=1,GO=.01,xw=0});function Ih(r,e,t,i,s,o,n,a){let l=Math.abs(s-o);(!n&&s>o||n&&o>s)&&(l=2*Math.PI-l),a||(a=Math.max(6,Math.floor(6*Math.pow(i,1/3)*(l/Math.PI)))),a=Math.max(a,3);let c=l/a,u=s;c*=n?-1:1;for(let h=0;h{"use strict"});function bw(r,e,t,i,s,o){let n=r[r.length-2],l=r[r.length-1]-t,c=n-e,u=s-t,h=i-e,d=Math.abs(l*h-c*u);if(d<1e-8||o===0){(r[r.length-2]!==e||r[r.length-1]!==t)&&r.push(e,t);return}let f=l*l+c*c,p=u*u+h*h,m=l*u+c*h,g=o*Math.sqrt(f)/d,_=o*Math.sqrt(p)/d,v=g*m/f,x=_*m/p,T=g*h+_*c,b=g*u+_*l,E=c*(_+v),w=l*(_+v),I=h*(g+x),B=u*(g+x),C=Math.atan2(w-b,E-T),A=Math.atan2(B-b,I-T);Ih(r,T+e,b+t,o,C,A,c*u>h*l)}var vw=y(()=>{Gg()});function DO(r,e){let t=e===-1.5707963267948966?-.551915024494:1.3333333333333333*Math.tan(e/4),i=e===1.5707963267948966?.551915024494:t,s=Math.cos(r),o=Math.sin(r),n=Math.cos(r+e),a=Math.sin(r+e);return[{x:s-o*i,y:o+s*i},{x:n+a*i,y:a-n*i},{x:n,y:a}]}function Sw(r,e,t,i,s,o,n,a=0,l=0,c=0){if(o===0||n===0)return;let u=Math.sin(a*Ka/360),h=Math.cos(a*Ka/360),d=h*(e-i)/2+u*(t-s)/2,f=-u*(e-i)/2+h*(t-s)/2;if(d===0&&f===0)return;o=Math.abs(o),n=Math.abs(n);let p=Math.pow(d,2)/Math.pow(o,2)+Math.pow(f,2)/Math.pow(n,2);p>1&&(o*=Math.sqrt(p),n*=Math.sqrt(p)),NO(e,t,i,s,o,n,l,c,u,h,d,f,Lg);let{ang1:m,ang2:g}=Lg,{centerX:_,centerY:v}=Lg,x=Math.abs(g)/(Ka/4);Math.abs(1-x)<1e-7&&(x=1);let T=Math.max(Math.ceil(x),1);g/=T;let b=r[r.length-2],E=r[r.length-1],w={x:0,y:0};for(let I=0;I{Og();Ka=Math.PI*2,Lg={centerX:0,centerY:0,ang1:0,ang2:0},Dg=({x:r,y:e},t,i,s,o,n,a,l)=>{r*=t,e*=i;let c=s*r-o*e,u=o*r+s*e;return l.x=c+n,l.y=u+a,l};Tw=(r,e,t,i)=>{let s=r*i-e*t<0?-1:1,o=r*t+e*i;return o>1&&(o=1),o<-1&&(o=-1),s*Math.acos(o)},NO=(r,e,t,i,s,o,n,a,l,c,u,h,d)=>{let f=Math.pow(s,2),p=Math.pow(o,2),m=Math.pow(u,2),g=Math.pow(h,2),_=f*p-f*g-p*m;_<0&&(_=0),_/=f*g+p*m,_=Math.sqrt(_)*(n===a?-1:1);let v=_*s/o*h,x=_*-o/s*u,T=c*v-l*x+(r+t)/2,b=l*v+c*x+(e+i)/2,E=(u-v)/s,w=(h-x)/o,I=(-u-v)/s,B=(-h-x)/o,C=Tw(1,0,E,w),A=Tw(E,w,I,B);a===0&&A>0&&(A-=Ka),a===1&&A<0&&(A+=Ka),d.centerX=T,d.centerY=b,d.ang1=C,d.ang2=A}});function Ew(r,e,t){let i=(n,a)=>{let l=a.x-n.x,c=a.y-n.y,u=Math.sqrt(l*l+c*c),h=l/u,d=c/u;return{len:u,nx:h,ny:d}},s=(n,a)=>{n===0?r.moveTo(a.x,a.y):r.lineTo(a.x,a.y)},o=e[e.length-1];for(let n=0;n0&&(f=-1,p=!0);let m=d/2,g,_=Math.abs(Math.cos(m)*l/Math.sin(m));_>Math.min(u.len/2,h.len/2)?(_=Math.min(u.len/2,h.len/2),g=Math.abs(_*Math.sin(m)/Math.cos(m))):g=l;let v=a.x+h.nx*_+-h.ny*g*f,x=a.y+h.ny*_+h.nx*g*f,T=Math.atan2(u.ny,u.nx)+Math.PI/2*f,b=Math.atan2(h.ny,h.nx)-Math.PI/2*f;n===0&&r.moveTo(v+Math.cos(T)*g,x+Math.sin(T)*g),r.arc(v,x,g,T,b,p),o=a}}function Aw(r,e,t,i){let s=(a,l)=>Math.sqrt((a.x-l.x)**2+(a.y-l.y)**2),o=(a,l,c)=>({x:a.x+(l.x-a.x)*c,y:a.y+(l.y-a.y)*c}),n=e.length;for(let a=0;a{"use strict"});var HO,Bh,Cw=y(()=>{hw();dw();mw();ut();gw();$t();Og();_w();Gg();vw();ww();Pw();HO=new Q,Bh=class{constructor(e){this.shapePrimitives=[],this._currentPoly=null,this._bounds=new Ee,this._graphicsPath2D=e,this.signed=e.checkForHoles}moveTo(e,t){return this.startPoly(e,t),this}lineTo(e,t){this._ensurePoly();let i=this._currentPoly.points,s=i[i.length-2],o=i[i.length-1];return(s!==e||o!==t)&&i.push(e,t),this}arc(e,t,i,s,o,n){this._ensurePoly(!1);let a=this._currentPoly.points;return Ih(a,e,t,i,s,o,n),this}arcTo(e,t,i,s,o){this._ensurePoly();let n=this._currentPoly.points;return bw(n,e,t,i,s,o),this}arcToSvg(e,t,i,s,o,n,a){let l=this._currentPoly.points;return Sw(l,this._currentPoly.lastX,this._currentPoly.lastY,n,a,e,t,i,s,o),this}bezierCurveTo(e,t,i,s,o,n,a){this._ensurePoly();let l=this._currentPoly;return Rh(this._currentPoly.points,l.lastX,l.lastY,e,t,i,s,o,n,a),this}quadraticCurveTo(e,t,i,s,o){this._ensurePoly();let n=this._currentPoly;return yw(this._currentPoly.points,n.lastX,n.lastY,e,t,i,s,o),this}closePath(){return this.endPoly(!0),this}addPath(e,t){this.endPoly(),t&&!t.isIdentity()&&(e=e.clone(!0),e.transform(t));let i=this.shapePrimitives,s=i.length;for(let o=0;o1){let o=null;for(let n=s;n=2;h-=2)u[h]===u[h-2]&&u[h-1]===u[h-3]&&u.splice(h-1,2);return this.poly(u,!0,n)}ellipse(e,t,i,s,o){return this.drawShape(new Ah(e,t,i,s),o),this}roundRect(e,t,i,s,o,n){return this.drawShape(new Ch(e,t,i,s,o),n),this}drawShape(e,t){return this.endPoly(),this.shapePrimitives.push({shape:e,transform:t}),this}startPoly(e,t){let i=this._currentPoly;return i&&this.endPoly(),i=new $o,i.points.push(e,t),this._currentPoly=i,this}endPoly(e=!1){let t=this._currentPoly;return t&&t.points.length>2&&(t.closePath=e,this.shapePrimitives.push({shape:t})),this._currentPoly=null,this}_ensurePoly(e=!0){if(!this._currentPoly&&(this._currentPoly=new $o,e)){let t=this.shapePrimitives[this.shapePrimitives.length-1];if(t){let i=t.shape.x,s=t.shape.y;if(t.transform&&!t.transform.isIdentity()){let o=t.transform,n=i;i=o.a*i+o.c*s+o.tx,s=o.b*n+o.d*s+o.ty}this._currentPoly.points.push(i,s)}else this._currentPoly.points.push(0,0)}}buildPath(){let e=this._graphicsPath2D;this.shapePrimitives.length=0,this._currentPoly=null;for(let t=0;t{fr();wt();Ae();uw();Cw();Yi=class r{constructor(e,t=!1){this.instructions=[],this.uid=he("graphicsPath"),this._dirty=!0,this.checkForHoles=t,typeof e=="string"?cw(e,this):this.instructions=e?.slice()??[]}get shapePath(){return this._shapePath||(this._shapePath=new Bh(this)),this._dirty&&(this._dirty=!1,this._shapePath.buildPath()),this._shapePath}addPath(e,t){return e=e.clone(),this.instructions.push({action:"addPath",data:[e,t]}),this._dirty=!0,this}arc(...e){return this.instructions.push({action:"arc",data:e}),this._dirty=!0,this}arcTo(...e){return this.instructions.push({action:"arcTo",data:e}),this._dirty=!0,this}arcToSvg(...e){return this.instructions.push({action:"arcToSvg",data:e}),this._dirty=!0,this}bezierCurveTo(...e){return this.instructions.push({action:"bezierCurveTo",data:e}),this._dirty=!0,this}bezierCurveToShort(e,t,i,s,o){let n=this.instructions[this.instructions.length-1],a=this.getLastPoint(de.shared),l=0,c=0;if(!n||n.action!=="bezierCurveTo")l=a.x,c=a.y;else{l=n.data[2],c=n.data[3];let u=a.x,h=a.y;l=u+(u-l),c=h+(h-c)}return this.instructions.push({action:"bezierCurveTo",data:[l,c,e,t,i,s,o]}),this._dirty=!0,this}closePath(){return this.instructions.push({action:"closePath",data:[]}),this._dirty=!0,this}ellipse(...e){return this.instructions.push({action:"ellipse",data:e}),this._dirty=!0,this}lineTo(...e){return this.instructions.push({action:"lineTo",data:e}),this._dirty=!0,this}moveTo(...e){return this.instructions.push({action:"moveTo",data:e}),this}quadraticCurveTo(...e){return this.instructions.push({action:"quadraticCurveTo",data:e}),this._dirty=!0,this}quadraticCurveToShort(e,t,i){let s=this.instructions[this.instructions.length-1],o=this.getLastPoint(de.shared),n=0,a=0;if(!s||s.action!=="quadraticCurveTo")n=o.x,a=o.y;else{n=s.data[0],a=s.data[1];let l=o.x,c=o.y;n=l+(l-n),a=c+(c-a)}return this.instructions.push({action:"quadraticCurveTo",data:[n,a,e,t,i]}),this._dirty=!0,this}rect(e,t,i,s,o){return this.instructions.push({action:"rect",data:[e,t,i,s,o]}),this._dirty=!0,this}circle(e,t,i,s){return this.instructions.push({action:"circle",data:[e,t,i,s]}),this._dirty=!0,this}roundRect(...e){return this.instructions.push({action:"roundRect",data:e}),this._dirty=!0,this}poly(...e){return this.instructions.push({action:"poly",data:e}),this._dirty=!0,this}regularPoly(...e){return this.instructions.push({action:"regularPoly",data:e}),this._dirty=!0,this}roundPoly(...e){return this.instructions.push({action:"roundPoly",data:e}),this._dirty=!0,this}roundShape(...e){return this.instructions.push({action:"roundShape",data:e}),this._dirty=!0,this}filletRect(...e){return this.instructions.push({action:"filletRect",data:e}),this._dirty=!0,this}chamferRect(...e){return this.instructions.push({action:"chamferRect",data:e}),this._dirty=!0,this}star(e,t,i,s,o,n,a){o||(o=s/2);let l=-1*Math.PI/2+n,c=i*2,u=Math.PI*2/c,h=[];for(let d=0;d{"use strict"});function Mw(r,e){let t=r.querySelectorAll("defs");for(let i=0;i{Tt();Ae();No();Hg()});function Vg(r){let e=r.match(/url\s*\(\s*['"]?\s*#([^'"\s)]+)\s*['"]?\s*\)/i);return e?e[1]:""}var Iw=y(()=>{"use strict"});function Wg(r,e){let t=r.getAttribute("style"),i={},s={},o={strokeStyle:i,fillStyle:s,useFill:!1,useStroke:!1};for(let n in Bw){let a=r.getAttribute(n);a&&kw(e,o,n,a.trim())}if(t){let n=t.split(";");for(let a=0;a{Tt();Iw();Bw={fill:{type:"paint",default:0},"fill-opacity":{type:"number",default:1},stroke:{type:"paint",default:0},"stroke-width":{type:"number",default:1},"stroke-opacity":{type:"number",default:1},"stroke-linecap":{type:"string",default:"butt"},"stroke-linejoin":{type:"string",default:"miter"},"stroke-miterlimit":{type:"number",default:10},"stroke-dasharray":{type:"string",default:"none"},"stroke-dashoffset":{type:"number",default:0},opacity:{type:"number",default:1}}});function Ow(r,e){if(typeof r=="string"){let n=document.createElement("div");n.innerHTML=r.trim(),r=n.querySelector("svg")}let t={context:e,defs:{},path:new Yi};Mw(r,t);let i=r.children,{fillStyle:s,strokeStyle:o}=Wg(r,t);for(let n=0;nparseInt(B,10)),e.context.poly(x,!0),t&&e.context.fill(t),i&&e.context.stroke(i);break;case"polyline":T=r.getAttribute("points"),x=T.match(/\d+/g).map(B=>parseInt(B,10)),e.context.poly(x,!1),i&&e.context.stroke(i);break;case"g":case"svg":break;default:{W(`[SVG parser] <${r.nodeName}> elements unsupported`);break}}a&&(t=null);for(let B=0;B{Ae();Ng();Rw();Hg();Fw()});function zO(r){return oe.isColorLike(r)}function Lw(r){return r instanceof yi}function Dw(r){return r instanceof qt}function $O(r){return r instanceof k}function XO(r,e,t){let i=oe.shared.setValue(e??0);return r.color=i.toNumber(),r.alpha=i.alpha===1?t.alpha:i.alpha,r.texture=k.WHITE,{...t,...r}}function jO(r,e,t){return r.texture=e,{...t,...r}}function Nw(r,e,t){return r.fill=e,r.color=16777215,r.texture=e.texture,r.matrix=e.transform,{...t,...r}}function Hw(r,e,t){return e.buildGradient(),r.fill=e,r.color=16777215,r.texture=e.texture,r.matrix=e.transform,r.textureSpace=e.textureSpace,{...t,...r}}function YO(r,e){let t={...e,...r},i=oe.shared.setValue(t.color);return t.alpha*=i.alpha,t.color=i.toNumber(),t}function _i(r,e){if(r==null)return null;let t={},i=r;return zO(r)?XO(t,r,e):$O(r)?jO(t,r,e):Lw(r)?Nw(t,r,e):Dw(r)?Hw(t,r,e):i.fill&&Lw(i.fill)?Nw(i,i.fill,e):i.fill&&Dw(i.fill)?Hw(i,i.fill,e):YO(i,e)}function jo(r,e){let{width:t,alignment:i,miterLimit:s,cap:o,join:n,pixelLine:a,...l}=e,c=_i(r,l);return c?{width:t,alignment:i,miterLimit:s,cap:o,join:n,pixelLine:a,...c}:null}var zg=y(()=>{Tt();ve();No();wh()});var qO,Vw,$g,Ht,kh=y(()=>{Mt();Tt();ge();fr();ve();wt();Xe();$t();Ng();Gw();zg();qO=new de,Vw=new G,$g=class Kr extends Ce{constructor(){super(...arguments),this.uid=he("graphicsContext"),this.dirty=!0,this.batchMode="auto",this.instructions=[],this._activePath=new Yi,this._transform=new G,this._fillStyle={...Kr.defaultFillStyle},this._strokeStyle={...Kr.defaultStrokeStyle},this._stateStack=[],this._tick=0,this._bounds=new Ee,this._boundsDirty=!0}clone(){let e=new Kr;return e.batchMode=this.batchMode,e.instructions=this.instructions.slice(),e._activePath=this._activePath.clone(),e._transform=this._transform.clone(),e._fillStyle={...this._fillStyle},e._strokeStyle={...this._strokeStyle},e._stateStack=this._stateStack.slice(),e._bounds=this._bounds.clone(),e._boundsDirty=!0,e}get fillStyle(){return this._fillStyle}set fillStyle(e){this._fillStyle=_i(e,Kr.defaultFillStyle)}get strokeStyle(){return this._strokeStyle}set strokeStyle(e){this._strokeStyle=jo(e,Kr.defaultStrokeStyle)}setFillStyle(e){return this._fillStyle=_i(e,Kr.defaultFillStyle),this}setStrokeStyle(e){return this._strokeStyle=_i(e,Kr.defaultStrokeStyle),this}texture(e,t,i,s,o,n){return this.instructions.push({action:"texture",data:{image:e,dx:i||0,dy:s||0,dw:o||e.frame.width,dh:n||e.frame.height,transform:this._transform.clone(),alpha:this._fillStyle.alpha,style:t?oe.shared.setValue(t).toNumber():16777215}}),this.onUpdate(),this}beginPath(){return this._activePath=new Yi,this}fill(e,t){let i,s=this.instructions[this.instructions.length-1];return this._tick===0&&s&&s.action==="stroke"?i=s.data.path:i=this._activePath.clone(),i?(e!=null&&(t!==void 0&&typeof e=="number"&&(X(ie,"GraphicsContext.fill(color, alpha) is deprecated, use GraphicsContext.fill({ color, alpha }) instead"),e={color:e,alpha:t}),this._fillStyle=_i(e,Kr.defaultFillStyle)),this.instructions.push({action:"fill",data:{style:this.fillStyle,path:i}}),this.onUpdate(),this._initNextPathLocation(),this._tick=0,this):this}_initNextPathLocation(){let{x:e,y:t}=this._activePath.getLastPoint(de.shared);this._activePath.clear(),this._activePath.moveTo(e,t)}stroke(e){let t,i=this.instructions[this.instructions.length-1];return this._tick===0&&i&&i.action==="fill"?t=i.data.path:t=this._activePath.clone(),t?(e!=null&&(this._strokeStyle=jo(e,Kr.defaultStrokeStyle)),this.instructions.push({action:"stroke",data:{style:this.strokeStyle,path:t}}),this.onUpdate(),this._initNextPathLocation(),this._tick=0,this):this}cut(){for(let e=0;e<2;e++){let t=this.instructions[this.instructions.length-1-e],i=this._activePath.clone();if(t&&(t.action==="stroke"||t.action==="fill"))if(t.data.hole)t.data.hole.addPath(i);else{t.data.hole=i;break}}return this._initNextPathLocation(),this}arc(e,t,i,s,o,n){this._tick++;let a=this._transform;return this._activePath.arc(a.a*e+a.c*t+a.tx,a.b*e+a.d*t+a.ty,i,s,o,n),this}arcTo(e,t,i,s,o){this._tick++;let n=this._transform;return this._activePath.arcTo(n.a*e+n.c*t+n.tx,n.b*e+n.d*t+n.ty,n.a*i+n.c*s+n.tx,n.b*i+n.d*s+n.ty,o),this}arcToSvg(e,t,i,s,o,n,a){this._tick++;let l=this._transform;return this._activePath.arcToSvg(e,t,i,s,o,l.a*n+l.c*a+l.tx,l.b*n+l.d*a+l.ty),this}bezierCurveTo(e,t,i,s,o,n,a){this._tick++;let l=this._transform;return this._activePath.bezierCurveTo(l.a*e+l.c*t+l.tx,l.b*e+l.d*t+l.ty,l.a*i+l.c*s+l.tx,l.b*i+l.d*s+l.ty,l.a*o+l.c*n+l.tx,l.b*o+l.d*n+l.ty,a),this}closePath(){return this._tick++,this._activePath?.closePath(),this}ellipse(e,t,i,s){return this._tick++,this._activePath.ellipse(e,t,i,s,this._transform.clone()),this}circle(e,t,i){return this._tick++,this._activePath.circle(e,t,i,this._transform.clone()),this}path(e){return this._tick++,this._activePath.addPath(e,this._transform.clone()),this}lineTo(e,t){this._tick++;let i=this._transform;return this._activePath.lineTo(i.a*e+i.c*t+i.tx,i.b*e+i.d*t+i.ty),this}moveTo(e,t){this._tick++;let i=this._transform,s=this._activePath.instructions,o=i.a*e+i.c*t+i.tx,n=i.b*e+i.d*t+i.ty;return s.length===1&&s[0].action==="moveTo"?(s[0].data[0]=o,s[0].data[1]=n,this):(this._activePath.moveTo(o,n),this)}quadraticCurveTo(e,t,i,s,o){this._tick++;let n=this._transform;return this._activePath.quadraticCurveTo(n.a*e+n.c*t+n.tx,n.b*e+n.d*t+n.ty,n.a*i+n.c*s+n.tx,n.b*i+n.d*s+n.ty,o),this}rect(e,t,i,s){return this._tick++,this._activePath.rect(e,t,i,s,this._transform.clone()),this}roundRect(e,t,i,s,o){return this._tick++,this._activePath.roundRect(e,t,i,s,o,this._transform.clone()),this}poly(e,t){return this._tick++,this._activePath.poly(e,t,this._transform.clone()),this}regularPoly(e,t,i,s,o=0,n){return this._tick++,this._activePath.regularPoly(e,t,i,s,o,n),this}roundPoly(e,t,i,s,o,n){return this._tick++,this._activePath.roundPoly(e,t,i,s,o,n),this}roundShape(e,t,i,s){return this._tick++,this._activePath.roundShape(e,t,i,s),this}filletRect(e,t,i,s,o){return this._tick++,this._activePath.filletRect(e,t,i,s,o),this}chamferRect(e,t,i,s,o,n){return this._tick++,this._activePath.chamferRect(e,t,i,s,o,n),this}star(e,t,i,s,o=0,n=0){return this._tick++,this._activePath.star(e,t,i,s,o,n,this._transform.clone()),this}svg(e){return this._tick++,Ow(e,this),this}restore(){let e=this._stateStack.pop();return e&&(this._transform=e.transform,this._fillStyle=e.fillStyle,this._strokeStyle=e.strokeStyle),this}save(){return this._stateStack.push({transform:this._transform.clone(),fillStyle:{...this._fillStyle},strokeStyle:{...this._strokeStyle}}),this}getTransform(){return this._transform}resetTransform(){return this._transform.identity(),this}rotate(e){return this._transform.rotate(e),this}scale(e,t=e){return this._transform.scale(e,t),this}setTransform(e,t,i,s,o,n){return e instanceof G?(this._transform.set(e.a,e.b,e.c,e.d,e.tx,e.ty),this):(this._transform.set(e,t,i,s,o,n),this)}transform(e,t,i,s,o,n){return e instanceof G?(this._transform.append(e),this):(Vw.set(e,t,i,s,o,n),this._transform.append(Vw),this)}translate(e,t=e){return this._transform.translate(e,t),this}clear(){return this._activePath.clear(),this.instructions.length=0,this.resetTransform(),this.onUpdate(),this}onUpdate(){this.dirty||(this.emit("update",this,16),this.dirty=!0,this._boundsDirty=!0)}get bounds(){if(!this._boundsDirty)return this._bounds;let e=this._bounds;e.clear();for(let t=0;t{Tt();Ww=["align","breakWords","cssOverrides","fontVariant","fontWeight","leading","letterSpacing","lineHeight","padding","textBaseline","trim","whiteSpace","wordWrap","wordWrapWidth","fontFamily","fontStyle","fontSize"]});function QO(r){let e=r;if(typeof e.dropShadow=="boolean"&&e.dropShadow){let t=Oe.defaultDropShadow;r.dropShadow={alpha:e.dropShadowAlpha??t.alpha,angle:e.dropShadowAngle??t.angle,blur:e.dropShadowBlur??t.blur,color:e.dropShadowColor??t.color,distance:e.dropShadowDistance??t.distance}}if(e.strokeThickness!==void 0){X(ie,"strokeThickness is now a part of stroke");let t=e.stroke,i={};if(oe.isColorLike(t))i.color=t;else if(t instanceof qt||t instanceof yi)i.fill=t;else if(Object.hasOwnProperty.call(t,"color")||Object.hasOwnProperty.call(t,"fill"))i=t;else throw new Error("Invalid stroke value.");r.stroke={...i,width:e.strokeThickness}}if(Array.isArray(e.fillGradientStops)){X(ie,"gradient fill is now a fill pattern: `new FillGradient(...)`");let t;r.fontSize==null?r.fontSize=Oe.defaultTextStyle.fontSize:typeof r.fontSize=="string"?t=parseInt(r.fontSize,10):t=r.fontSize;let i=new qt({start:{x:0,y:0},end:{x:0,y:(t||0)*1.7}}),s=e.fillGradientStops.map(o=>oe.shared.setValue(o).toNumber());s.forEach((o,n)=>{let a=n/(s.length-1);i.addColorStop(a,o)}),r.fill={fill:i}}}var jg,Oe,Bs=y(()=>{Mt();Tt();Xe();No();wh();kh();zg();Xg();jg=class Yo extends Ce{constructor(e={}){super(),QO(e);let t={...Yo.defaultTextStyle,...e};for(let i in t){let s=i;this[s]=t[i]}this.update()}get align(){return this._align}set align(e){this._align=e,this.update()}get breakWords(){return this._breakWords}set breakWords(e){this._breakWords=e,this.update()}get dropShadow(){return this._dropShadow}set dropShadow(e){e!==null&&typeof e=="object"?this._dropShadow=this._createProxy({...Yo.defaultDropShadow,...e}):this._dropShadow=e?this._createProxy({...Yo.defaultDropShadow}):null,this.update()}get fontFamily(){return this._fontFamily}set fontFamily(e){this._fontFamily=e,this.update()}get fontSize(){return this._fontSize}set fontSize(e){typeof e=="string"?this._fontSize=parseInt(e,10):this._fontSize=e,this.update()}get fontStyle(){return this._fontStyle}set fontStyle(e){this._fontStyle=e.toLowerCase(),this.update()}get fontVariant(){return this._fontVariant}set fontVariant(e){this._fontVariant=e,this.update()}get fontWeight(){return this._fontWeight}set fontWeight(e){this._fontWeight=e,this.update()}get leading(){return this._leading}set leading(e){this._leading=e,this.update()}get letterSpacing(){return this._letterSpacing}set letterSpacing(e){this._letterSpacing=e,this.update()}get lineHeight(){return this._lineHeight}set lineHeight(e){this._lineHeight=e,this.update()}get padding(){return this._padding}set padding(e){this._padding=e,this.update()}get trim(){return this._trim}set trim(e){this._trim=e,this.update()}get textBaseline(){return this._textBaseline}set textBaseline(e){this._textBaseline=e,this.update()}get whiteSpace(){return this._whiteSpace}set whiteSpace(e){this._whiteSpace=e,this.update()}get wordWrap(){return this._wordWrap}set wordWrap(e){this._wordWrap=e,this.update()}get wordWrapWidth(){return this._wordWrapWidth}set wordWrapWidth(e){this._wordWrapWidth=e,this.update()}get fill(){return this._originalFill}set fill(e){e!==this._originalFill&&(this._originalFill=e,this._isFillStyle(e)&&(this._originalFill=this._createProxy({...Ht.defaultFillStyle,...e},()=>{this._fill=_i({...this._originalFill},Ht.defaultFillStyle)})),this._fill=_i(e===0?"black":e,Ht.defaultFillStyle),this.update())}get stroke(){return this._originalStroke}set stroke(e){e!==this._originalStroke&&(this._originalStroke=e,this._isFillStyle(e)&&(this._originalStroke=this._createProxy({...Ht.defaultStrokeStyle,...e},()=>{this._stroke=jo({...this._originalStroke},Ht.defaultStrokeStyle)})),this._stroke=jo(e,Ht.defaultStrokeStyle),this.update())}_generateKey(){return this._styleKey=Fh(this),this._styleKey}update(){this._styleKey=null,this.emit("update",this)}reset(){let e=Yo.defaultTextStyle;for(let t in e)this[t]=e[t]}get styleKey(){return this._styleKey||this._generateKey()}clone(){return new Yo({align:this.align,breakWords:this.breakWords,dropShadow:this._dropShadow?{...this._dropShadow}:null,fill:this._fill,fontFamily:this.fontFamily,fontSize:this.fontSize,fontStyle:this.fontStyle,fontVariant:this.fontVariant,fontWeight:this.fontWeight,leading:this.leading,letterSpacing:this.letterSpacing,lineHeight:this.lineHeight,padding:this.padding,stroke:this._stroke,textBaseline:this.textBaseline,whiteSpace:this.whiteSpace,wordWrap:this.wordWrap,wordWrapWidth:this.wordWrapWidth})}destroy(e=!1){if(this.removeAllListeners(),typeof e=="boolean"?e:e?.texture){let i=typeof e=="boolean"?e:e?.textureSource;this._fill?.texture&&this._fill.texture.destroy(i),this._originalFill?.texture&&this._originalFill.texture.destroy(i),this._stroke?.texture&&this._stroke.texture.destroy(i),this._originalStroke?.texture&&this._originalStroke.texture.destroy(i)}this._fill=null,this._stroke=null,this.dropShadow=null,this._originalStroke=null,this._originalFill=null}_createProxy(e,t){return new Proxy(e,{set:(i,s,o)=>(i[s]=o,t?.(s,o),this.update(),!0)})}_isFillStyle(e){return(e??null)!==null&&!(oe.isColorLike(e)||e instanceof qt||e instanceof yi)}};jg.defaultDropShadow={alpha:1,angle:Math.PI/6,blur:0,color:"black",distance:5};jg.defaultTextStyle={align:"left",breakWords:!1,dropShadow:null,fill:"black",fontFamily:"Arial",fontSize:26,fontStyle:"normal",fontVariant:"normal",fontWeight:"normal",leading:0,letterSpacing:0,lineHeight:0,padding:0,stroke:null,textBaseline:"alphabetic",trim:!1,whiteSpace:"pre",wordWrap:!1,wordWrapWidth:100};Oe=jg});function Oh(r,e,t,i){let s=JO;s.minX=0,s.minY=0,s.maxX=r.width/i|0,s.maxY=r.height/i|0;let o=je.getOptimalTexture(s.width,s.height,i,!1);return o.source.uploadMethodId="image",o.source.resource=r,o.source.alphaMode="premultiply-alpha-on-upload",o.frame.width=e/i,o.frame.height=t/i,o.source.emit("update",o.source),o.updateUvs(),o}var JO,Yg=y(()=>{Oi();$t();JO=new Ee});function ks(r){let e=typeof r.fontSize=="number"?`${r.fontSize}px`:r.fontSize,t=r.fontFamily;Array.isArray(r.fontFamily)||(t=r.fontFamily.split(","));for(let i=t.length-1;i>=0;i--){let s=t[i].trim();!/([\"\'])[^\'\"]+\1/.test(s)&&!eU.includes(s)&&(s=`"${s}"`),t[i]=s}return`${r.fontStyle} ${r.fontVariant} ${r.fontWeight} ${e} ${t.join(",")}`}var eU,Uh=y(()=>{"use strict";eU=["serif","sans-serif","monospace","cursive","fantasy","system-ui"]});var qg,Ir,De,Qa=y(()=>{Re();Uh();qg={willReadFrequently:!0},Ir=class q{static get experimentalLetterSpacingSupported(){let e=q._experimentalLetterSpacingSupported;if(e!==void 0){let t=j.get().getCanvasRenderingContext2D().prototype;e=q._experimentalLetterSpacingSupported="letterSpacing"in t||"textLetterSpacing"in t}return e}constructor(e,t,i,s,o,n,a,l,c){this.text=e,this.style=t,this.width=i,this.height=s,this.lines=o,this.lineWidths=n,this.lineHeight=a,this.maxLineWidth=l,this.fontProperties=c}static measureText(e=" ",t,i=q._canvas,s=t.wordWrap){let o=`${e}:${t.styleKey}`;if(q._measurementCache[o])return q._measurementCache[o];let n=ks(t),a=q.measureFont(n);a.fontSize===0&&(a.fontSize=t.fontSize,a.ascent=t.fontSize);let l=q.__context;l.font=n;let u=(s?q._wordWrap(e,t,i):e).split(/(?:\r\n|\r|\n)/),h=new Array(u.length),d=0;for(let v=0;v0)if(s)n-=t,c-=t;else{let u=(q.graphemeSegmenter(e).length-1)*t;n+=u,c+=u}return Math.max(n,c)}static _wordWrap(e,t,i=q._canvas){let s=i.getContext("2d",qg),o=0,n="",a="",l=Object.create(null),{letterSpacing:c,whiteSpace:u}=t,h=q._collapseSpaces(u),d=q._collapseNewlines(u),f=!h,p=t.wordWrapWidth+c,m=q._tokenize(e);for(let g=0;gp)if(n!==""&&(a+=q._addLine(n),n="",o=0),q.canBreakWords(_,t.breakWords)){let x=q.wordWrapSplit(_);for(let T=0;Tp&&(a+=q._addLine(n),f=!1,n="",o=0),n+=b,o+=I}}else{n.length>0&&(a+=q._addLine(n),n="",o=0);let x=g===m.length-1;a+=q._addLine(_,!x),f=!1,n="",o=0}else v+o>p&&(f=!1,a+=q._addLine(n),n="",o=0),(n.length>0||!q.isBreakingSpace(_)||f)&&(n+=_,o+=v)}return a+=q._addLine(n,!1),a}static _addLine(e,t=!0){return e=q._trimRight(e),e=t?`${e} +`:e,e}static _getFromCache(e,t,i,s){let o=i[e];return typeof o!="number"&&(o=q._measureText(e,t,s)+t,i[e]=o),o}static _collapseSpaces(e){return e==="normal"||e==="pre-line"}static _collapseNewlines(e){return e==="normal"}static _trimRight(e){if(typeof e!="string")return"";for(let t=e.length-1;t>=0;t--){let i=e[t];if(!q.isBreakingSpace(i))break;e=e.slice(0,-1)}return e}static _isNewline(e){return typeof e!="string"?!1:q._newlines.includes(e.charCodeAt(0))}static isBreakingSpace(e,t){return typeof e!="string"?!1:q._breakingSpaces.includes(e.charCodeAt(0))}static _tokenize(e){let t=[],i="";if(typeof e!="string")return t;for(let s=0;s{if(typeof Intl?.Segmenter=="function"){let r=new Intl.Segmenter;return e=>[...r.segment(e)].map(t=>t.segment)}return r=>[...r]})();Ir.experimentalLetterSpacing=!1;Ir._fonts={};Ir._newlines=[10,13];Ir._breakingSpaces=[9,32,8192,8193,8194,8195,8196,8197,8198,8200,8201,8202,8287,12288];Ir._measurementCache={};De=Ir});function qo(r,e,t,i=0){if(r.texture===k.WHITE&&!r.fill)return oe.shared.setValue(r.color).setAlpha(r.alpha??1).toHexa();if(r.fill){if(r.fill instanceof yi){let s=r.fill,o=e.createPattern(s.texture.source.resource,"repeat"),n=s.transform.copyTo(G.shared);return n.scale(s.texture.frame.width,s.texture.frame.height),o.setTransform(n),o}else if(r.fill instanceof qt){let s=r.fill,o=s.type==="linear",n=s.textureSpace==="local",a=1,l=1;n&&t&&(a=t.width+i,l=t.height+i);let c,u=!1;if(o){let{start:h,end:d}=s;c=e.createLinearGradient(h.x*a,h.y*l,d.x*a,d.y*l),u=Math.abs(d.x-h.x){let m=f+p.offset*h;c.addColorStop(Math.floor(m*$w)/$w,oe.shared.setValue(p.color).toHex())})}}else s.colorStops.forEach(h=>{c.addColorStop(h.offset,oe.shared.setValue(h.color).toHex())});return c}}else{let s=e.createPattern(r.texture.source.resource,"repeat"),o=r.matrix.copyTo(G.shared);return o.scale(r.texture.frame.width,r.texture.frame.height),s.setTransform(o),s}return W("FillStyle not recognised",r),"red"}var $w,Kg=y(()=>{Tt();ge();ve();Ae();No();wh();$w=1e5});var Ja,Xw=y(()=>{Tt();U();ya();zo();Oi();sw();Xe();Bs();Yg();Qa();Uh();Kg();Ja=class{constructor(e){this._activeTextures={},this._renderer=e}getTextureSize(e,t,i){let s=De.measureText(e||" ",i),o=Math.ceil(Math.ceil(Math.max(1,s.width)+i.padding*2)*t),n=Math.ceil(Math.ceil(Math.max(1,s.height)+i.padding*2)*t);return o=Math.ceil(o-1e-6),n=Math.ceil(n-1e-6),o=di(o),n=di(n),{width:o,height:n}}getTexture(e,t,i,s){typeof e=="string"&&(X("8.0.0","CanvasTextSystem.getTexture: Use object TextOptions instead of separate arguments"),e={text:e,style:i,resolution:t}),e.style instanceof Oe||(e.style=new Oe(e.style));let{texture:o,canvasAndContext:n}=this.createTextureAndCanvas(e);return this._renderer.texture.initSource(o._source),Kt.returnCanvasAndContext(n),o}createTextureAndCanvas(e){let{text:t,style:i}=e,s=e.resolution??this._renderer.resolution,o=De.measureText(t||" ",i),n=Math.ceil(Math.ceil(Math.max(1,o.width)+i.padding*2)*s),a=Math.ceil(Math.ceil(Math.max(1,o.height)+i.padding*2)*s),l=Kt.getOptimalCanvasAndContext(n,a),{canvas:c}=l;this.renderTextToCanvas(t,i,s,l);let u=Oh(c,n,a,s);if(i.trim){let h=iw(c,s);u.frame.copyFrom(h),u.updateUvs()}return{texture:u,canvasAndContext:l}}getManagedTexture(e){e._resolution=e._autoResolution?this._renderer.resolution:e.resolution;let t=e._getKey();if(this._activeTextures[t])return this._increaseReferenceCount(t),this._activeTextures[t].texture;let{texture:i,canvasAndContext:s}=this.createTextureAndCanvas(e);return this._activeTextures[t]={canvasAndContext:s,texture:i,usageCount:1},i}_increaseReferenceCount(e){this._activeTextures[e].usageCount++}returnTexture(e){let t=e.source;t.resource=null,t.uploadMethodId="unknown",t.alphaMode="no-premultiply-alpha",je.returnTexture(e)}decreaseReferenceCount(e){let t=this._activeTextures[e];t.usageCount--,t.usageCount===0&&(Kt.returnCanvasAndContext(t.canvasAndContext),this.returnTexture(t.texture),this._activeTextures[e]=null)}getReferenceCount(e){return this._activeTextures[e].usageCount}renderTextToCanvas(e,t,i,s){let{canvas:o,context:n}=s,a=ks(t),l=De.measureText(e||" ",t),c=l.lines,u=l.lineHeight,h=l.lineWidths,d=l.maxLineWidth,f=l.fontProperties,p=o.height;if(n.resetTransform(),n.scale(i,i),n.textBaseline=t.textBaseline,t._stroke?.width){let v=t._stroke;n.lineWidth=v.width,n.miterLimit=v.miterLimit,n.lineJoin=v.join,n.lineCap=v.cap}n.font=a;let m,g,_=t.dropShadow?2:1;for(let v=0;v<_;++v){let x=t.dropShadow&&v===0,T=x?Math.ceil(Math.max(1,p)+t.padding*2):0,b=T*i;if(x){n.fillStyle="black",n.strokeStyle="black";let I=t.dropShadow,B=I.color,C=I.alpha;n.shadowColor=oe.shared.setValue(B).setAlpha(C).toRgbaString();let A=I.blur*i,P=I.distance*i;n.shadowBlur=A,n.shadowOffsetX=Math.cos(I.angle)*P,n.shadowOffsetY=Math.sin(I.angle)*P+b}else{if(n.fillStyle=t._fill?qo(t._fill,n,l):null,t._stroke?.width){let I=t._stroke.width*t._stroke.alignment;n.strokeStyle=qo(t._stroke,n,l,I)}n.shadowColor="black"}let E=(u-f.fontSize)/2;u-f.fontSize<0&&(E=0);let w=t._stroke?.width??0;for(let I=0;I{U();ew();Xw();V.add(Ja);V.add(qa)});var Ue,Qg=y(()=>{Xe();Xu();kh();Ue=class r extends Li{constructor(e){e instanceof Ht&&(e={context:e});let{context:t,roundPixels:i,...s}=e||{};super({label:"Graphics",...s}),this.renderPipeId="graphics",t?this._context=t:this._context=this._ownedContext=new Ht,this._context.on("update",this.onViewUpdate,this),this.allowChildren=!1,this.roundPixels=i??!1}set context(e){e!==this._context&&(this._context.off("update",this.onViewUpdate,this),this._context=e,this._context.on("update",this.onViewUpdate,this),this.onViewUpdate())}get context(){return this._context}get bounds(){return this._context.bounds}updateBounds(){}containsPoint(e){return this._context.containsPoint(e)}destroy(e){this._ownedContext&&!e?this._ownedContext.destroy(e):(e===!0||e?.context===!0)&&this._context.destroy(e),this._ownedContext=null,this._context=null,super.destroy(e)}_callContextMethod(e,t){return this.context[e](...t),this}setFillStyle(...e){return this._callContextMethod("setFillStyle",e)}setStrokeStyle(...e){return this._callContextMethod("setStrokeStyle",e)}fill(...e){return this._callContextMethod("fill",e)}stroke(...e){return this._callContextMethod("stroke",e)}texture(...e){return this._callContextMethod("texture",e)}beginPath(){return this._callContextMethod("beginPath",[])}cut(){return this._callContextMethod("cut",[])}arc(...e){return this._callContextMethod("arc",e)}arcTo(...e){return this._callContextMethod("arcTo",e)}arcToSvg(...e){return this._callContextMethod("arcToSvg",e)}bezierCurveTo(...e){return this._callContextMethod("bezierCurveTo",e)}closePath(){return this._callContextMethod("closePath",[])}ellipse(...e){return this._callContextMethod("ellipse",e)}circle(...e){return this._callContextMethod("circle",e)}path(...e){return this._callContextMethod("path",e)}lineTo(...e){return this._callContextMethod("lineTo",e)}moveTo(...e){return this._callContextMethod("moveTo",e)}quadraticCurveTo(...e){return this._callContextMethod("quadraticCurveTo",e)}rect(...e){return this._callContextMethod("rect",e)}roundRect(...e){return this._callContextMethod("roundRect",e)}poly(...e){return this._callContextMethod("poly",e)}regularPoly(...e){return this._callContextMethod("regularPoly",e)}roundPoly(...e){return this._callContextMethod("roundPoly",e)}roundShape(...e){return this._callContextMethod("roundShape",e)}filletRect(...e){return this._callContextMethod("filletRect",e)}chamferRect(...e){return this._callContextMethod("chamferRect",e)}star(...e){return this._callContextMethod("star",e)}svg(...e){return this._callContextMethod("svg",e)}restore(...e){return this._callContextMethod("restore",e)}save(){return this._callContextMethod("save",[])}getTransform(){return this.context.getTransform()}resetTransform(){return this._callContextMethod("resetTransform",[])}rotateTransform(...e){return this._callContextMethod("rotate",e)}scaleTransform(...e){return this._callContextMethod("scale",e)}setTransform(...e){return this._callContextMethod("setTransform",e)}transform(...e){return this._callContextMethod("transform",e)}translateTransform(...e){return this._callContextMethod("translate",e)}clear(){return this._callContextMethod("clear",[])}get fillStyle(){return this._context.fillStyle}set fillStyle(e){this._context.fillStyle=e}get strokeStyle(){return this._context.strokeStyle}set strokeStyle(e){this._context.strokeStyle=e}clone(e=!1){return e?new r(this._context.clone()):(this._ownedContext=null,new r(this._context))}lineStyle(e,t,i){X(ie,"Graphics#lineStyle is no longer needed. Use Graphics#setStrokeStyle to set the stroke style.");let s={};return e&&(s.width=e),t&&(s.color=t),i&&(s.alpha=i),this.context.strokeStyle=s,this}beginFill(e,t){X(ie,"Graphics#beginFill is no longer needed. Use Graphics#fill to fill the shape with the desired style.");let i={};return e!==void 0&&(i.color=e),t!==void 0&&(i.alpha=t),this.context.fillStyle=i,this}endFill(){X(ie,"Graphics#endFill is no longer needed. Use Graphics#fill to fill the shape with the desired style."),this.context.fill();let e=this.context.strokeStyle;return(e.width!==Ht.defaultStrokeStyle.width||e.color!==Ht.defaultStrokeStyle.color||e.alpha!==Ht.defaultStrokeStyle.alpha)&&this.context.stroke(),this}drawCircle(...e){return X(ie,"Graphics#drawCircle has been renamed to Graphics#circle"),this._callContextMethod("circle",e)}drawEllipse(...e){return X(ie,"Graphics#drawEllipse has been renamed to Graphics#ellipse"),this._callContextMethod("ellipse",e)}drawPolygon(...e){return X(ie,"Graphics#drawPolygon has been renamed to Graphics#poly"),this._callContextMethod("poly",e)}drawRect(...e){return X(ie,"Graphics#drawRect has been renamed to Graphics#rect"),this._callContextMethod("rect",e)}drawRoundedRect(...e){return X(ie,"Graphics#drawRoundedRect has been renamed to Graphics#roundRect"),this._callContextMethod("roundRect",e)}drawStar(...e){return X(ie,"Graphics#drawStar has been renamed to Graphics#star"),this._callContextMethod("star",e)}}});var jw,Yw,qw=y(()=>{"use strict";jw={name:"local-uniform-msdf-bit",vertex:{header:` struct LocalUniforms { uColor:vec4, uTransformMatrix:mat3x3, @@ -462,8 +462,8 @@ fn mainFragment( return coverage; } - `}}});var Jg,ex,Gh,Jw=y(()=>{ge();ws();$i();Ga();La();Xi();ch();Mr();It();qw();Qw();Gh=class extends Ze{constructor(){let e=new be({uColor:{value:new Float32Array([1,1,1,1]),type:"vec4"},uTransformMatrix:{value:new G,type:"mat3x3"},uDistance:{value:4,type:"f32"},uRound:{value:0,type:"f32"}}),t=pr();Jg??(Jg=Wr({name:"sdf-shader",bits:[ko,Oo(t),jw,Kw,$r]})),ex??(ex=zr({name:"sdf-shader",bits:[Fo,Uo(t),Yw,Zw,Xr]})),super({glProgram:ex,gpuProgram:Jg,resources:{localUniforms:e,batchSamplers:Go(t)}})}}});var Ko,tx=y(()=>{Mt();Xe();Ko=class extends Ce{constructor(){super(...arguments),this.chars=Object.create(null),this.lineHeight=0,this.fontFamily="",this.fontMetrics={fontSize:0,ascent:0,descent:0},this.baseLineOffset=0,this.distanceField={type:"none",range:0},this.pages=[],this.applyFillAsTint=!0,this.baseMeasurementFontSize=100,this.baseRenderedFontSize=100}get font(){return X(ie,"BitmapFont.font is deprecated, please use BitmapFont.fontFamily instead."),this.fontFamily}get pageTextures(){return X(ie,"BitmapFont.pageTextures is deprecated, please use BitmapFont.pages instead."),this.pages}get size(){return X(ie,"BitmapFont.size is deprecated, please use BitmapFont.fontMetrics.fontSize instead."),this.fontMetrics.fontSize}get distanceFieldRange(){return X(ie,"BitmapFont.distanceFieldRange is deprecated, please use BitmapFont.distanceField.range instead."),this.distanceField.range}get distanceFieldType(){return X(ie,"BitmapFont.distanceFieldType is deprecated, please use BitmapFont.distanceField.type instead."),this.distanceField.type}destroy(e=!1){this.emit("destroy",this),this.removeAllListeners();for(let t in this.chars)this.chars[t].texture?.destroy();this.chars=null,e&&(this.pages.forEach(t=>t.texture.destroy(!0)),this.pages=null)}}});function Lh(r){if(r==="")return[];typeof r=="string"&&(r=[r]);let e=[];for(let t=0,i=r.length;t{"use strict"});var eE,ix,rE=y(()=>{Tt();ut();zo();Ao();ve();Xe();Qa();Uh();Kg();Bs();tx();rx();eE=class tE extends Ko{constructor(e){super(),this.resolution=1,this.pages=[],this._padding=0,this._measureCache=Object.create(null),this._currentChars=[],this._currentX=0,this._currentY=0,this._currentPageIndex=-1,this._skipKerning=!1;let t={...tE.defaultOptions,...e};this._textureSize=t.textureSize,this._mipmap=t.mipmap;let i=t.style.clone();t.overrideFill&&(i._fill.color=16777215,i._fill.alpha=1,i._fill.texture=k.WHITE,i._fill.fill=null),this.applyFillAsTint=t.overrideFill;let s=i.fontSize;i.fontSize=this.baseMeasurementFontSize;let o=ks(i);t.overrideSize?i._stroke&&(i._stroke.width*=this.baseRenderedFontSize/s):i.fontSize=this.baseRenderedFontSize=s,this._style=i,this._skipKerning=t.skipKerning??!1,this.resolution=t.resolution??1,this._padding=t.padding??4,this.fontMetrics=De.measureFont(o),this.lineHeight=i.lineHeight||this.fontMetrics.fontSize||i.fontSize}ensureCharacters(e){let t=Lh(e).filter(g=>!this._currentChars.includes(g)).filter((g,_,v)=>v.indexOf(g)===_);if(!t.length)return;this._currentChars=[...this._currentChars,...t];let i;this._currentPageIndex===-1?i=this._nextPage():i=this.pages[this._currentPageIndex];let{canvas:s,context:o}=i.canvasAndContext,n=i.texture.source,a=this._style,l=this._currentX,c=this._currentY,u=this.baseRenderedFontSize/this.baseMeasurementFontSize,h=this._padding*u,d=0,f=!1,p=s.width/this.resolution,m=s.height/this.resolution;for(let g=0;gp&&(c+=d,d=E,l=0,c+d>m)){n.update();let B=this._nextPage();s=B.canvasAndContext.canvas,o=B.canvasAndContext.context,n=B.texture.source,c=0}let I=x/u-(a.dropShadow?.distance??0)-(a._stroke?.width??0);if(this.chars[_]={id:_.codePointAt(0),xOffset:-this._padding,yOffset:-this._padding,xAdvance:I,kerning:{}},f){this._drawGlyph(o,v,l+h,c+h,u,a);let B=n.width*u,C=n.height*u,A=new Q(l/B*n.width,c/C*n.height,w/B*n.width,E/C*n.height);this.chars[_].texture=new k({source:n,frame:A}),l+=Math.ceil(w)}}n.update(),this._currentX=l,this._currentY=c,this._skipKerning&&this._applyKerning(t,o)}get pageTextures(){return X(ie,"BitmapFont.pageTextures is deprecated, please use BitmapFont.pages instead."),this.pages}_applyKerning(e,t){let i=this._measureCache;for(let s=0;s{let m=o.width;for(let g=0;g{let p=o.chars.length-1;if(i){let m=o.chars[p];for(;m===" ";)o.width-=t.chars[m].xAdvance,m=o.chars[--p]}s.width=Math.max(s.width,o.width),o={width:0,charPositions:[],chars:[],spaceWidth:0,spacesIndex:[]},a=!0,s.lines.push(o),s.height+=t.lineHeight},h=t.baseMeasurementFontSize/e.fontSize,d=e.letterSpacing*h,f=e.wordWrapWidth*h;for(let p=0;p{ge();ws();$i();Ga();La();Xi();ch();Mr();It();qw();Qw();Gh=class extends Ze{constructor(){let e=new be({uColor:{value:new Float32Array([1,1,1,1]),type:"vec4"},uTransformMatrix:{value:new G,type:"mat3x3"},uDistance:{value:4,type:"f32"},uRound:{value:0,type:"f32"}}),t=pr();Jg??(Jg=Wr({name:"sdf-shader",bits:[ko,Oo(t),jw,Kw,$r]})),ex??(ex=zr({name:"sdf-shader",bits:[Fo,Uo(t),Yw,Zw,Xr]})),super({glProgram:ex,gpuProgram:Jg,resources:{localUniforms:e,batchSamplers:Go(t)}})}}});var Ko,tx=y(()=>{Mt();Xe();Ko=class extends Ce{constructor(){super(...arguments),this.chars=Object.create(null),this.lineHeight=0,this.fontFamily="",this.fontMetrics={fontSize:0,ascent:0,descent:0},this.baseLineOffset=0,this.distanceField={type:"none",range:0},this.pages=[],this.applyFillAsTint=!0,this.baseMeasurementFontSize=100,this.baseRenderedFontSize=100}get font(){return X(ie,"BitmapFont.font is deprecated, please use BitmapFont.fontFamily instead."),this.fontFamily}get pageTextures(){return X(ie,"BitmapFont.pageTextures is deprecated, please use BitmapFont.pages instead."),this.pages}get size(){return X(ie,"BitmapFont.size is deprecated, please use BitmapFont.fontMetrics.fontSize instead."),this.fontMetrics.fontSize}get distanceFieldRange(){return X(ie,"BitmapFont.distanceFieldRange is deprecated, please use BitmapFont.distanceField.range instead."),this.distanceField.range}get distanceFieldType(){return X(ie,"BitmapFont.distanceFieldType is deprecated, please use BitmapFont.distanceField.type instead."),this.distanceField.type}destroy(e=!1){this.emit("destroy",this),this.removeAllListeners();for(let t in this.chars)this.chars[t].texture?.destroy();this.chars=null,e&&(this.pages.forEach(t=>t.texture.destroy(!0)),this.pages=null)}}});function Lh(r){if(r==="")return[];typeof r=="string"&&(r=[r]);let e=[];for(let t=0,i=r.length;t{"use strict"});var eE,ix,rE=y(()=>{Tt();ut();zo();Ao();ve();Xe();Qa();Uh();Kg();Bs();tx();rx();eE=class tE extends Ko{constructor(e){super(),this.resolution=1,this.pages=[],this._padding=0,this._measureCache=Object.create(null),this._currentChars=[],this._currentX=0,this._currentY=0,this._currentPageIndex=-1,this._skipKerning=!1;let t={...tE.defaultOptions,...e};this._textureSize=t.textureSize,this._mipmap=t.mipmap;let i=t.style.clone();t.overrideFill&&(i._fill.color=16777215,i._fill.alpha=1,i._fill.texture=k.WHITE,i._fill.fill=null),this.applyFillAsTint=t.overrideFill;let s=i.fontSize;i.fontSize=this.baseMeasurementFontSize;let o=ks(i);t.overrideSize?i._stroke&&(i._stroke.width*=this.baseRenderedFontSize/s):i.fontSize=this.baseRenderedFontSize=s,this._style=i,this._skipKerning=t.skipKerning??!1,this.resolution=t.resolution??1,this._padding=t.padding??4,this.fontMetrics=De.measureFont(o),this.lineHeight=i.lineHeight||this.fontMetrics.fontSize||i.fontSize}ensureCharacters(e){let t=Lh(e).filter(g=>!this._currentChars.includes(g)).filter((g,_,v)=>v.indexOf(g)===_);if(!t.length)return;this._currentChars=[...this._currentChars,...t];let i;this._currentPageIndex===-1?i=this._nextPage():i=this.pages[this._currentPageIndex];let{canvas:s,context:o}=i.canvasAndContext,n=i.texture.source,a=this._style,l=this._currentX,c=this._currentY,u=this.baseRenderedFontSize/this.baseMeasurementFontSize,h=this._padding*u,d=0,f=!1,p=s.width/this.resolution,m=s.height/this.resolution;for(let g=0;gp&&(c+=d,d=w,l=0,c+d>m)){n.update();let B=this._nextPage();s=B.canvasAndContext.canvas,o=B.canvasAndContext.context,n=B.texture.source,c=0}let I=x/u-(a.dropShadow?.distance??0)-(a._stroke?.width??0);if(this.chars[_]={id:_.codePointAt(0),xOffset:-this._padding,yOffset:-this._padding,xAdvance:I,kerning:{}},f){this._drawGlyph(o,v,l+h,c+h,u,a);let B=n.width*u,C=n.height*u,A=new Q(l/B*n.width,c/C*n.height,E/B*n.width,w/C*n.height);this.chars[_].texture=new k({source:n,frame:A}),l+=Math.ceil(E)}}n.update(),this._currentX=l,this._currentY=c,this._skipKerning&&this._applyKerning(t,o)}get pageTextures(){return X(ie,"BitmapFont.pageTextures is deprecated, please use BitmapFont.pages instead."),this.pages}_applyKerning(e,t){let i=this._measureCache;for(let s=0;s{let m=o.width;for(let g=0;g{let p=o.chars.length-1;if(i){let m=o.chars[p];for(;m===" ";)o.width-=t.chars[m].xAdvance,m=o.chars[--p]}s.width=Math.max(s.width,o.width),o={width:0,charPositions:[],chars:[],spaceWidth:0,spacesIndex:[]},a=!0,s.lines.push(o),s.height+=t.lineHeight},h=t.baseMeasurementFontSize/e.fontSize,d=e.letterSpacing*h,f=e.wordWrapWidth*h;for(let p=0;pf?(u(),c(l),g||o.charPositions.push(0)):(l.start=o.width,c(l),g||o.charPositions.push(0)),m==="\r"||m===` `)o.width!==0&&u();else if(!g){let b=_.xAdvance+(_.kerning[n]||0)+d;o.width+=b,o.spaceWidth=b,o.spacesIndex.push(o.charPositions.length),o.chars.push(m)}}else{let T=_.kerning[n]||0,b=_.xAdvance+T+d;l.positions[l.index++]=l.width+T,l.chars.push(m),l.width+=b}n=m}return u(),e.align==="center"?tU(s):e.align==="right"?rU(s):e.align==="justify"&&iU(s),s}function tU(r){for(let e=0;e{"use strict"});var Nh,ox,el,nx=y(()=>{Hi();Xe();Ae();Bs();rE();sx();rx();Nh=0,ox=class{constructor(){this.ALPHA=[["a","z"],["A","Z"]," "],this.NUMERIC=[["0","9"]],this.ALPHANUMERIC=[["a","z"],["A","Z"],["0","9"]," "],this.ASCII=[[" ","~"]],this.defaultOptions={chars:this.ALPHANUMERIC,resolution:1,padding:4,skipKerning:!1}}getFont(e,t){let i=`${t.fontFamily}-bitmap`,s=!0;if(t._fill.fill&&!t._stroke)i+=t._fill.fill.styleKey,s=!1;else if(t._stroke||t.dropShadow){let n=t.styleKey;n=n.substring(0,n.lastIndexOf("-")),i=`${n}-bitmap`,s=!1}if(!Se.has(i)){let n=new ix({style:t,overrideFill:s,overrideSize:!0,...this.defaultOptions});Nh++,Nh>50&&W("BitmapText",`You have dynamically created ${Nh} bitmap fonts, this can be inefficient. Try pre installing your font styles using \`BitmapFont.install({name:"style1", style})\``),n.once("destroy",()=>{Nh--,Se.remove(i)}),Se.set(i,n)}let o=Se.get(i);return o.ensureCharacters?.(e),o}getLayout(e,t,i=!0){let s=this.getFont(e,t);return Dh([...e],t,s,i)}measureText(e,t,i=!0){return this.getLayout(e,t,i)}install(...e){let t=e[0];typeof t=="string"&&(t={name:t,style:e[1],chars:e[2]?.chars,resolution:e[2]?.resolution,padding:e[2]?.padding,skipKerning:e[2]?.skipKerning},X(ie,"BitmapFontManager.install(name, style, options) is deprecated, use BitmapFontManager.install({name, style, ...options})"));let i=t?.name;if(!i)throw new Error("[BitmapFontManager] Property `name` is required.");t={...this.defaultOptions,...t};let s=t.style,o=s instanceof Oe?s:new Oe(s),n=o._fill.fill!==null&&o._fill.fill!==void 0,a=new ix({style:o,overrideFill:n,skipKerning:t.skipKerning,padding:t.padding,resolution:t.resolution,overrideSize:!1}),l=Lh(t.chars);return a.ensureCharacters(l.join("")),Se.set(`${i}-bitmap`,a),a.once("destroy",()=>Se.remove(`${i}-bitmap`)),a}uninstall(e){let t=`${e}-bitmap`,i=Se.get(t);i&&i.destroy()}},el=new ox});function iE(r,e){e.groupTransform=r.groupTransform,e.groupColorAlpha=r.groupColorAlpha,e.groupColor=r.groupColor,e.groupBlendMode=r.groupBlendMode,e.globalDisplayStatus=r.globalDisplayStatus,e.groupTransform=r.groupTransform,e.localDisplayStatus=r.localDisplayStatus,e.groupAlpha=r.groupAlpha,e._roundPixels=r._roundPixels}var tl,sE=y(()=>{Hi();U();Gt();Qg();Jw();nx();sx();tl=class{constructor(e){this._gpuBitmapText={},this._destroyRenderableBound=this.destroyRenderable.bind(this),this._renderer=e,this._renderer.renderableGC.addManagedHash(this,"_gpuBitmapText")}validateRenderable(e){let t=this._getGpuBitmapText(e);return e._didTextUpdate&&(e._didTextUpdate=!1,this._updateContext(e,t)),this._renderer.renderPipes.graphics.validateRenderable(t)}addRenderable(e,t){let i=this._getGpuBitmapText(e);iE(e,i),e._didTextUpdate&&(e._didTextUpdate=!1,this._updateContext(e,i)),this._renderer.renderPipes.graphics.addRenderable(i,t),i.context.customShader&&this._updateDistanceField(e)}destroyRenderable(e){e.off("destroyed",this._destroyRenderableBound),this._destroyRenderableByUid(e.uid)}_destroyRenderableByUid(e){let t=this._gpuBitmapText[e].context;t.customShader&&(se.return(t.customShader),t.customShader=null),se.return(this._gpuBitmapText[e]),this._gpuBitmapText[e]=null}updateRenderable(e){let t=this._getGpuBitmapText(e);iE(e,t),this._renderer.renderPipes.graphics.updateRenderable(t),t.context.customShader&&this._updateDistanceField(e)}_updateContext(e,t){let{context:i}=t,s=el.getFont(e.text,e._style);i.clear(),s.distanceField.type!=="none"&&(i.customShader||(i.customShader=se.get(Gh)));let o=Array.from(e.text),n=e._style,a=s.baseLineOffset,l=Dh(o,n,s,!0),c=0,u=n.padding,h=l.scale,d=l.width,f=l.height+l.offsetY;n._stroke&&(d+=n._stroke.width/h,f+=n._stroke.width/h),i.translate(-e._anchor._x*d-u,-e._anchor._y*f-u).scale(h,h);let p=s.applyFillAsTint?n._fill.color:16777215;for(let m=0;m{U();sE();V.add(tl)});var rl,oE=y(()=>{U();ve();Gt();ja();Rg();rl=class{constructor(e){this._gpuText=Object.create(null),this._destroyRenderableBound=this.destroyRenderable.bind(this),this._renderer=e,this._renderer.runners.resolutionChange.add(this),this._renderer.renderableGC.addManagedHash(this,"_gpuText")}resolutionChange(){for(let e in this._gpuText){let t=this._gpuText[e];if(!t)continue;let i=t.batchableSprite.renderable;i._autoResolution&&(i._resolution=this._renderer.resolution,i.onViewUpdate())}}validateRenderable(e){let t=this._getGpuText(e),i=e._getKey();return t.textureNeedsUploading?(t.textureNeedsUploading=!1,!0):t.currentKey!==i}addRenderable(e,t){let s=this._getGpuText(e).batchableSprite;e._didTextUpdate&&this._updateText(e),this._renderer.renderPipes.batch.addToBatch(s,t)}updateRenderable(e){let i=this._getGpuText(e).batchableSprite;e._didTextUpdate&&this._updateText(e),i._batcher.updateElement(i)}destroyRenderable(e){e.off("destroyed",this._destroyRenderableBound),this._destroyRenderableById(e.uid)}_destroyRenderableById(e){let t=this._gpuText[e];this._renderer.htmlText.decreaseReferenceCount(t.currentKey),se.return(t.batchableSprite),this._gpuText[e]=null}_updateText(e){let t=e._getKey(),i=this._getGpuText(e),s=i.batchableSprite;i.currentKey!==t&&this._updateGpuText(e).catch(o=>{console.error(o)}),e._didTextUpdate=!1,Ya(s,e)}async _updateGpuText(e){e._didTextUpdate=!1;let t=this._getGpuText(e);if(t.generatingTexture)return;let i=e._getKey();this._renderer.htmlText.decreaseReferenceCount(t.currentKey),t.generatingTexture=!0,t.currentKey=i;let s=e.resolution??this._renderer.resolution,o=await this._renderer.htmlText.getManagedTexture(e.text,s,e._style,e._getKey()),n=t.batchableSprite;n.texture=t.texture=o,t.generatingTexture=!1,t.textureNeedsUploading=!0,e.onViewUpdate(),Ya(n,e)}_getGpuText(e){return this._gpuText[e.uid]||this.initGpuText(e)}initGpuText(e){let t={texture:k.EMPTY,currentKey:"--",batchableSprite:se.get(qr),textureNeedsUploading:!1,generatingTexture:!1},i=t.batchableSprite;return i.renderable=e,i.transform=e.groupTransform,i.texture=k.EMPTY,i.bounds={minX:0,maxX:1,minY:0,maxY:0},i.roundPixels=this._renderer._roundPixels|e._roundPixels,e._resolution=e._autoResolution?this._renderer.resolution:e.resolution,this._gpuText[e.uid]=t,e.on("destroyed",this._destroyRenderableBound),t}destroy(){for(let e in this._gpuText)this._destroyRenderableById(e);this._gpuText=null,this._renderer=null}};rl.extension={type:[S.WebGLPipes,S.WebGPUPipes,S.CanvasPipes],name:"htmlText"}});function nE(){let{userAgent:r}=j.get().getNavigator();return/^((?!chrome|android).)*safari/i.test(r)}var aE=y(()=>{Re()});var lE,cE,Zo,lx=y(()=>{"use strict";lE="http://www.w3.org/2000/svg",cE="http://www.w3.org/1999/xhtml",Zo=class{constructor(){this.svgRoot=document.createElementNS(lE,"svg"),this.foreignObject=document.createElementNS(lE,"foreignObject"),this.domElement=document.createElementNS(cE,"div"),this.styleElement=document.createElementNS(cE,"style"),this.image=new Image;let{foreignObject:e,svgRoot:t,styleElement:i,domElement:s}=this;e.setAttribute("width","10000"),e.setAttribute("height","10000"),e.style.overflow="hidden",t.appendChild(e),e.appendChild(i),e.appendChild(s)}}});function dE(r){let e=r._stroke,t=r._fill,s=[`div { ${[`color: ${oe.shared.setValue(t.color).toHex()}`,`font-size: ${r.fontSize}px`,`font-family: ${r.fontFamily}`,`font-weight: ${r.fontWeight}`,`font-style: ${r.fontStyle}`,`font-variant: ${r.fontVariant}`,`letter-spacing: ${r.letterSpacing}px`,`text-align: ${r.align}`,`padding: ${r.padding}px`,`white-space: ${r.whiteSpace==="pre"&&r.wordWrap?"pre-wrap":r.whiteSpace}`,...r.lineHeight?[`line-height: ${r.lineHeight}px`]:[],...r.wordWrap?[`word-wrap: ${r.breakWords?"break-all":"break-word"}`,`max-width: ${r.wordWrapWidth}px`]:[],...e?[pE(e)]:[],...r.dropShadow?[fE(r.dropShadow)]:[],...r.cssOverrides].join(";")} }`];return sU(r.tagStyles,s),s.join(" ")}function fE(r){let e=oe.shared.setValue(r.color).setAlpha(r.alpha).toHexa(),t=Math.round(Math.cos(r.angle)*r.distance),i=Math.round(Math.sin(r.angle)*r.distance),s=`${t}px ${i}px`;return r.blur>0?`text-shadow: ${s} ${r.blur}px ${e}`:`text-shadow: ${s} ${e}`}function pE(r){return[`-webkit-text-stroke-width: ${r.width}px`,`-webkit-text-stroke-color: ${oe.shared.setValue(r.color).toHex()}`,`text-stroke-width: ${r.width}px`,`text-stroke-color: ${oe.shared.setValue(r.color).toHex()}`,"paint-order: stroke"].join(";")}function sU(r,e){for(let t in r){let i=r[t],s=[];for(let o in i)hE[o]?s.push(hE[o](i[o])):uE[o]&&s.push(uE[o].replace("{{VALUE}}",i[o]));e.push(`${t} { ${s.join(";")} }`)}}var uE,hE,mE=y(()=>{Tt();uE={fontSize:"font-size: {{VALUE}}px",fontFamily:"font-family: {{VALUE}}",fontWeight:"font-weight: {{VALUE}}",fontStyle:"font-style: {{VALUE}}",fontVariant:"font-variant: {{VALUE}}",letterSpacing:"letter-spacing: {{VALUE}}px",align:"text-align: {{VALUE}}",padding:"padding: {{VALUE}}px",whiteSpace:"white-space: {{VALUE}}",lineHeight:"line-height: {{VALUE}}px",wordWrapWidth:"max-width: {{VALUE}}px"},hE={fill:r=>`color: ${oe.shared.setValue(r).toHex()}`,breakWords:r=>`word-wrap: ${r?"break-all":"break-word"}`,stroke:pE,dropShadow:fE}});var Hh,gE=y(()=>{Ae();Bs();Xg();mE();Hh=class r extends Oe{constructor(e={}){super(e),this._cssOverrides=[],this.cssOverrides??(this.cssOverrides=e.cssOverrides),this.tagStyles=e.tagStyles??{}}set cssOverrides(e){this._cssOverrides=e instanceof Array?e:[e],this.update()}get cssOverrides(){return this._cssOverrides}_generateKey(){return this._styleKey=Fh(this)+this._cssOverrides.join("-"),this._styleKey}update(){this._cssStyle=null,super.update()}clone(){return new r({align:this.align,breakWords:this.breakWords,dropShadow:this.dropShadow?{...this.dropShadow}:null,fill:this._fill,fontFamily:this.fontFamily,fontSize:this.fontSize,fontStyle:this.fontStyle,fontVariant:this.fontVariant,fontWeight:this.fontWeight,letterSpacing:this.letterSpacing,lineHeight:this.lineHeight,padding:this.padding,stroke:this._stroke,whiteSpace:this.whiteSpace,wordWrap:this.wordWrap,wordWrapWidth:this.wordWrapWidth,cssOverrides:this.cssOverrides})}get cssStyle(){return this._cssStyle||(this._cssStyle=dE(this)),this._cssStyle}addOverride(...e){let t=e.filter(i=>!this.cssOverrides.includes(i));t.length>0&&(this.cssOverrides.push(...t),this.update())}removeOverride(...e){let t=e.filter(i=>this.cssOverrides.includes(i));t.length>0&&(this.cssOverrides=this.cssOverrides.filter(i=>!t.includes(i)),this.update())}set fill(e){typeof e!="string"&&typeof e!="number"&&W("[HTMLTextStyle] only color fill is not supported by HTMLText"),super.fill=e}set stroke(e){e&&typeof e!="string"&&typeof e!="number"&&W("[HTMLTextStyle] only color stroke is not supported by HTMLText"),super.stroke=e}}});function xE(r,e){let t=e.fontFamily,i=[],s={},o=/font-family:([^;"\s]+)/g,n=r.match(o);function a(l){s[l]||(i.push(l),s[l]=!0)}if(Array.isArray(t))for(let l=0;l{let c=l.split(":")[1].trim();a(c)});for(let l in e.tagStyles){let c=e.tagStyles[l].fontFamily;a(c)}return i}var yE=y(()=>{"use strict"});async function _E(r){let t=await(await j.get().fetch(r)).blob(),i=new FileReader;return await new Promise((o,n)=>{i.onloadend=()=>o(i.result),i.onerror=n,i.readAsDataURL(t)})}var bE=y(()=>{Re()});async function cx(r,e){let t=await _E(e);return`@font-face { font-family: "${r.fontFamily}"; @@ -566,7 +566,7 @@ fn mainFragment( outColor = texture(uTexture, coord, unclamped == coord ? 0.0 : -32.0);// lod-bias very negative to force lod 0 - `}}});var hx,dx,zh,NE=y(()=>{ge();$i();tn();Xi();Mr();It();ve();DE();zh=class extends Ze{constructor(){hx??(hx=Wr({name:"tiling-sprite-shader",bits:[Fs,GE,$r]})),dx??(dx=zr({name:"tiling-sprite-shader",bits:[en,LE,Xr]}));let e=new be({uMapCoord:{value:new G,type:"mat3x3"},uClampFrame:{value:new Float32Array([0,0,1,1]),type:"vec4"},uClampOffset:{value:new Float32Array([0,0]),type:"vec2"},uTextureTransform:{value:new G,type:"mat3x3"},uSizeAnchor:{value:new Float32Array([100,100,.5,.5]),type:"vec4"}});super({glProgram:dx,gpuProgram:hx,resources:{localUniforms:new be({uTransformMatrix:{value:new G,type:"mat3x3"},uColor:{value:new Float32Array([1,1,1,1]),type:"vec4"},uRound:{value:0,type:"f32"}}),tilingUniforms:e,uTexture:k.EMPTY.source,uSampler:k.EMPTY.source.style}})}updateUniforms(e,t,i,s,o,n){let a=this.resources.tilingUniforms,l=n.width,c=n.height,u=n.textureMatrix,h=a.uniforms.uTextureTransform;h.set(i.a*l/e,i.b*l/t,i.c*c/e,i.d*c/t,i.tx/e,i.ty/t),h.invert(),a.uniforms.uMapCoord=u.mapCoord,a.uniforms.uClampFrame=u.uClampFrame,a.uniforms.uClampOffset=u.uClampOffset,a.uniforms.uTextureTransform=h,a.uniforms.uSizeAnchor[0]=e,a.uniforms.uSizeAnchor[1]=t,a.uniforms.uSizeAnchor[2]=s,a.uniforms.uSizeAnchor[3]=o,n&&(this.resources.uTexture=n.source,this.resources.uSampler=n.source.style)}}});var $h,HE=y(()=>{Wh();$h=class extends Jo{constructor(){super({positions:new Float32Array([0,0,1,0,1,1,0,1]),uvs:new Float32Array([0,0,1,0,1,1,0,1]),indices:new Uint32Array([0,1,2,0,2,3])})}}});function VE(r,e){let t=r.anchor.x,i=r.anchor.y;e[0]=-t*r.width,e[1]=-i*r.height,e[2]=(1-t)*r.width,e[3]=-i*r.height,e[4]=(1-t)*r.width,e[5]=(1-i)*r.height,e[6]=-t*r.width,e[7]=(1-i)*r.height}var WE=y(()=>{"use strict"});function zE(r,e,t,i){let s=0,o=r.length/(e||2),n=i.a,a=i.b,l=i.c,c=i.d,u=i.tx,h=i.ty;for(t*=e;s{"use strict"});function XE(r,e){let t=r.texture,i=t.frame.width,s=t.frame.height,o=0,n=0;r.applyAnchorToTexture&&(o=r.anchor.x,n=r.anchor.y),e[0]=e[6]=-o,e[2]=e[4]=1-o,e[1]=e[3]=-n,e[5]=e[7]=1-n;let a=G.shared;a.copyFrom(r._tileTransform.matrix),a.tx/=r.width,a.ty/=r.height,a.invert(),a.scale(r.width/i,r.height/s),zE(e,2,0,a)}var jE=y(()=>{ge();$E()});var Xh,il,YE=y(()=>{U();Fa();Rr();jr();Vo();_h();Wh();NE();HE();WE();jE();Xh=new $h,il=class{constructor(e){this._state=Je.default2d,this._tilingSpriteDataHash=Object.create(null),this._destroyRenderableBound=this.destroyRenderable.bind(this),this._renderer=e,this._renderer.renderableGC.addManagedHash(this,"_tilingSpriteDataHash")}validateRenderable(e){let t=this._getTilingSpriteData(e),i=t.canBatch;this._updateCanBatch(e);let s=t.canBatch;if(s&&s===i){let{batchableMesh:o}=t;return!o._batcher.checkAndUpdateTexture(o,e.texture)}return i!==s}addRenderable(e,t){let i=this._renderer.renderPipes.batch;this._updateCanBatch(e);let s=this._getTilingSpriteData(e),{geometry:o,canBatch:n}=s;if(n){s.batchableMesh||(s.batchableMesh=new ji);let a=s.batchableMesh;e.didViewUpdate&&(this._updateBatchableMesh(e),a.geometry=o,a.renderable=e,a.transform=e.groupTransform,a.setTexture(e._texture)),a.roundPixels=this._renderer._roundPixels|e._roundPixels,i.addToBatch(a,t)}else i.break(t),s.shader||(s.shader=new zh),this.updateRenderable(e),t.add(e)}execute(e){let{shader:t}=this._tilingSpriteDataHash[e.uid];t.groups[0]=this._renderer.globalUniforms.bindGroup;let i=t.resources.localUniforms.uniforms;i.uTransformMatrix=e.groupTransform,i.uRound=this._renderer._roundPixels|e._roundPixels,Yr(e.groupColorAlpha,i.uColor,0),this._state.blendMode=mi(e.groupBlendMode,e.texture._source),this._renderer.encoder.draw({geometry:Xh,shader:t,state:this._state})}updateRenderable(e){let t=this._getTilingSpriteData(e),{canBatch:i}=t;if(i){let{batchableMesh:s}=t;e.didViewUpdate&&this._updateBatchableMesh(e),s._batcher.updateElement(s)}else if(e.didViewUpdate){let{shader:s}=t;s.updateUniforms(e.width,e.height,e._tileTransform.matrix,e.anchor.x,e.anchor.y,e.texture)}}destroyRenderable(e){let t=this._getTilingSpriteData(e);t.batchableMesh=null,t.shader?.destroy(),this._tilingSpriteDataHash[e.uid]=null,e.off("destroyed",this._destroyRenderableBound)}_getTilingSpriteData(e){return this._tilingSpriteDataHash[e.uid]||this._initTilingSpriteData(e)}_initTilingSpriteData(e){let t=new Jo({indices:Xh.indices,positions:Xh.positions.slice(),uvs:Xh.uvs.slice()});return this._tilingSpriteDataHash[e.uid]={canBatch:!0,renderable:e,geometry:t},e.on("destroyed",this._destroyRenderableBound),this._tilingSpriteDataHash[e.uid]}_updateBatchableMesh(e){let t=this._getTilingSpriteData(e),{geometry:i}=t,s=e.texture.source.style;s.addressMode!=="repeat"&&(s.addressMode="repeat",s.update()),XE(e,i.uvs),VE(e,i.positions)}destroy(){for(let e in this._tilingSpriteDataHash)this.destroyRenderable(this._tilingSpriteDataHash[e].renderable);this._tilingSpriteDataHash=null,this._renderer=null}_updateCanBatch(e){let t=this._getTilingSpriteData(e),i=e.texture,s=!0;return this._renderer.type===ot.WEBGL&&(s=this._renderer.context.supports.nonPowOf2wrapping),t.canBatch=i.textureMatrix.isSimple&&(s||i.source.isPowerOfTwo),t.canBatch}};il.extension={type:[S.WebGLPipes,S.WebGPUPipes,S.CanvasPipes],name:"tilingSprite"}});var fx=y(()=>{U();YE();V.add(il)});var qE,ZE,QE=y(()=>{Xe();Wh();qE=class KE extends Jo{constructor(...e){super({});let t=e[0]??{};typeof t=="number"&&(X(ie,"PlaneGeometry constructor changed please use { width, height, verticesX, verticesY } instead"),t={width:t,height:e[1],verticesX:e[2],verticesY:e[3]}),this.build(t)}build(e){e={...KE.defaultOptions,...e},this.verticesX=this.verticesX??e.verticesX,this.verticesY=this.verticesY??e.verticesY,this.width=this.width??e.width,this.height=this.height??e.height;let t=this.verticesX*this.verticesY,i=[],s=[],o=[],n=this.verticesX-1,a=this.verticesY-1,l=this.width/n,c=this.height/a;for(let h=0;h{QE();JE=class eA extends ZE{constructor(e={}){e={...eA.defaultOptions,...e},super({width:e.width,height:e.height,verticesX:4,verticesY:4}),this.update(e)}update(e){this.width=e.width??this.width,this.height=e.height??this.height,this._originalWidth=e.originalWidth??this._originalWidth,this._originalHeight=e.originalHeight??this._originalHeight,this._leftWidth=e.leftWidth??this._leftWidth,this._rightWidth=e.rightWidth??this._rightWidth,this._topHeight=e.topHeight??this._topHeight,this._bottomHeight=e.bottomHeight??this._bottomHeight,this._anchorX=e.anchor?.x,this._anchorY=e.anchor?.y,this.updateUvs(),this.updatePositions()}updatePositions(){let e=this.positions,{width:t,height:i,_leftWidth:s,_rightWidth:o,_topHeight:n,_bottomHeight:a,_anchorX:l,_anchorY:c}=this,u=s+o,h=t>u?1:t/u,d=n+a,f=i>d?1:i/d,p=Math.min(h,f),m=l*t,g=c*i;e[0]=e[8]=e[16]=e[24]=-m,e[2]=e[10]=e[18]=e[26]=s*p-m,e[4]=e[12]=e[20]=e[28]=t-o*p-m,e[6]=e[14]=e[22]=e[30]=t-m,e[1]=e[3]=e[5]=e[7]=-g,e[9]=e[11]=e[13]=e[15]=n*p-g,e[17]=e[19]=e[21]=e[23]=i-a*p-g,e[25]=e[27]=e[29]=e[31]=i-g,this.getBuffer("aPosition").update()}updateUvs(){let e=this.uvs;e[0]=e[8]=e[16]=e[24]=0,e[1]=e[3]=e[5]=e[7]=0,e[6]=e[14]=e[22]=e[30]=1,e[25]=e[27]=e[29]=e[31]=1;let t=1/this._originalWidth,i=1/this._originalHeight;e[2]=e[10]=e[18]=e[26]=t*this._leftWidth,e[9]=e[11]=e[13]=e[15]=i*this._topHeight,e[4]=e[12]=e[20]=e[28]=1-t*this._rightWidth,e[17]=e[19]=e[21]=e[23]=1-i*this._bottomHeight,this.getBuffer("aUV").update()}};JE.defaultOptions={width:100,height:100,leftWidth:10,topHeight:10,rightWidth:10,bottomHeight:10,originalWidth:100,originalHeight:100};tA=JE});var sl,iA=y(()=>{U();Gt();_h();rA();sl=class{constructor(e){this._gpuSpriteHash=Object.create(null),this._destroyRenderableBound=this.destroyRenderable.bind(this),this._renderer=e,this._renderer.renderableGC.addManagedHash(this,"_gpuSpriteHash")}addRenderable(e,t){let i=this._getGpuSprite(e);e.didViewUpdate&&this._updateBatchableSprite(e,i),this._renderer.renderPipes.batch.addToBatch(i,t)}updateRenderable(e){let t=this._gpuSpriteHash[e.uid];e.didViewUpdate&&this._updateBatchableSprite(e,t),t._batcher.updateElement(t)}validateRenderable(e){let t=this._getGpuSprite(e);return!t._batcher.checkAndUpdateTexture(t,e._texture)}destroyRenderable(e){let t=this._gpuSpriteHash[e.uid];se.return(t.geometry),se.return(t),this._gpuSpriteHash[e.uid]=null,e.off("destroyed",this._destroyRenderableBound)}_updateBatchableSprite(e,t){t.geometry.update(e),t.setTexture(e._texture)}_getGpuSprite(e){return this._gpuSpriteHash[e.uid]||this._initGPUSprite(e)}_initGPUSprite(e){let t=se.get(ji);return t.geometry=se.get(tA),t.renderable=e,t.transform=e.groupTransform,t.texture=e._texture,t.roundPixels=this._renderer._roundPixels|e._roundPixels,this._gpuSpriteHash[e.uid]=t,e.didViewUpdate||this._updateBatchableSprite(e,t),e.on("destroyed",this._destroyRenderableBound),t}destroy(){for(let e in this._gpuSpriteHash)this._gpuSpriteHash[e].geometry.destroy();this._gpuSpriteHash=null,this._renderer=null}};sl.extension={type:[S.WebGLPipes,S.WebGPUPipes,S.CanvasPipes],name:"nineSliceSprite"}});var px=y(()=>{U();iA();V.add(sl)});var ol,sA=y(()=>{U();ol=class{constructor(e){this._renderer=e}push(e,t,i){this._renderer.renderPipes.batch.break(i),i.add({renderPipeId:"filter",canBundle:!1,action:"pushFilter",container:t,filterEffect:e})}pop(e,t,i){this._renderer.renderPipes.batch.break(i),i.add({renderPipeId:"filter",action:"popFilter",canBundle:!1})}execute(e){e.action==="pushFilter"?this._renderer.filter.push(e):e.action==="popFilter"&&this._renderer.filter.pop()}destroy(){this._renderer=null}};ol.extension={type:[S.WebGLPipes,S.WebGPUPipes,S.CanvasPipes],name:"filter"}});function oA(r,e){e.clear();let t=e.matrix;for(let i=0;i{"use strict"});var oU,nl,aA=y(()=>{U();ge();fr();Vi();Ro();It();ve();Oi();jr();$t();nA();Ae();oU=new mr({attributes:{aPosition:{buffer:new Float32Array([0,0,1,0,1,1,0,1]),format:"float32x2",stride:2*4,offset:0}},indexBuffer:new Uint32Array([0,1,2,0,2,3])}),nl=class{constructor(e){this._filterStackIndex=0,this._filterStack=[],this._filterGlobalUniforms=new be({uInputSize:{value:new Float32Array(4),type:"vec4"},uInputPixel:{value:new Float32Array(4),type:"vec4"},uInputClamp:{value:new Float32Array(4),type:"vec4"},uOutputFrame:{value:new Float32Array(4),type:"vec4"},uGlobalFrame:{value:new Float32Array(4),type:"vec4"},uOutputTexture:{value:new Float32Array(4),type:"vec4"}}),this._globalFilterBindGroup=new gt({}),this.renderer=e}get activeBackTexture(){return this._activeFilterData?.backTexture}push(e){let t=this.renderer,i=e.filterEffect.filters;this._filterStack[this._filterStackIndex]||(this._filterStack[this._filterStackIndex]=this._getFilterData());let s=this._filterStack[this._filterStackIndex];if(this._filterStackIndex++,i.length===0){s.skip=!0;return}let o=s.bounds;if(e.renderables?oA(e.renderables,o):e.filterEffect.filterArea?(o.clear(),o.addRect(e.filterEffect.filterArea),o.applyMatrix(e.container.worldTransform)):e.container.getFastGlobalBounds(!0,o),e.container){let p=(e.container.renderGroup||e.container.parentRenderGroup).cacheToLocalTransform;p&&o.applyMatrix(p)}let n=t.renderTarget.renderTarget.colorTexture.source,a=1/0,l=0,c=!0,u=!1,h=!1,d=!0;for(let f=0;f0?this._filterStack[this._filterStackIndex-1].bounds:null,l=e.renderTarget.getRenderTarget(t.previousRenderSurface);o=this.getBackTexture(l,s,a)}t.backTexture=o;let n=t.filterEffect.filters;if(this._globalFilterBindGroup.setResource(i.source.style,2),this._globalFilterBindGroup.setResource(o.source,3),e.globalUniforms.pop(),n.length===1)n[0].apply(this,i,t.previousRenderSurface,!1),je.returnTexture(i);else{let a=t.inputTexture,l=je.getOptimalTexture(s.width,s.height,a.source._resolution,!1),c=0;for(c=0;c0&&this._filterStack[d].skip;)--d;d>0&&(h=this._filterStack[d].inputTexture.source._resolution);let f=this._filterGlobalUniforms,p=f.uniforms,m=p.uOutputFrame,g=p.uInputSize,_=p.uInputPixel,v=p.uInputClamp,x=p.uGlobalFrame,T=p.uOutputTexture;if(u){let E=this._filterStackIndex;for(;E>0;){E--;let I=this._filterStack[this._filterStackIndex-1];if(!I.skip){l.x=I.bounds.minX,l.y=I.bounds.minY;break}}m[0]=a.minX-l.x,m[1]=a.minY-l.y}else m[0]=0,m[1]=0;m[2]=t.frame.width,m[3]=t.frame.height,g[0]=t.source.width,g[1]=t.source.height,g[2]=1/g[0],g[3]=1/g[1],_[0]=t.source.pixelWidth,_[1]=t.source.pixelHeight,_[2]=1/_[0],_[3]=1/_[1],v[0]=.5*_[2],v[1]=.5*_[3],v[2]=t.frame.width*g[2]-.5*_[2],v[3]=t.frame.height*g[3]-.5*_[3];let b=this.renderer.renderTarget.rootRenderTarget.colorTexture;x[0]=l.x*h,x[1]=l.y*h,x[2]=b.source.width*h,x[3]=b.source.height*h;let w=this.renderer.renderTarget.getRenderTarget(i);if(o.renderTarget.bind(i,!!s),i instanceof k?(T[0]=i.frame.width,T[1]=i.frame.height):(T[0]=w.width,T[1]=w.height),T[2]=w.isRoot?-1:1,f.update(),o.renderPipes.uniformBatch){let E=o.renderPipes.uniformBatch.getUboResource(f);this._globalFilterBindGroup.setResource(E,0)}else this._globalFilterBindGroup.setResource(f,0);this._globalFilterBindGroup.setResource(t.source,1),this._globalFilterBindGroup.setResource(t.source.style,2),e.groups[0]=this._globalFilterBindGroup,o.encoder.draw({geometry:oU,shader:e,state:e._state,topology:"triangle-list"}),o.type===ot.WEBGL&&o.renderTarget.finishRenderPass()}_getFilterData(){return{skip:!1,inputTexture:null,bounds:new Ee,container:null,filterEffect:null,blendRequired:!1,previousRenderSurface:null}}calculateSpriteMatrix(e,t){let i=this._activeFilterData,s=e.set(i.inputTexture._source.width,0,0,i.inputTexture._source.height,i.bounds.minX,i.bounds.minY),o=t.worldTransform.copyTo(G.shared),n=t.renderGroup||t.parentRenderGroup;return n&&n.cacheToLocalTransform&&o.prepend(n.cacheToLocalTransform),o.invert(),s.prepend(o),s.scale(1/t.texture.frame.width,1/t.texture.frame.height),s.translate(t.anchor.x,t.anchor.y),s}};nl.extension={type:[S.WebGLSystem,S.WebGPUSystem],name:"filter"}});var mx=y(()=>{U();sA();aA();V.add(nl);V.add(ol)});var nU={};var lA=y(()=>{u0();ym();y0();b0();Yu();eh();wg();Eg();Mg();Zg();ax();ux();fx();px();mx()});var aU={};var uA=y(()=>{ym();Yu();eh();wg();Eg();Mg();Zg();ax();ux();fx();px();mx()});var dA,rn,xx=y(()=>{As();Bo();Mr();Rr();dA=class gx extends Ze{constructor(e){e={...gx.defaultOptions,...e},super(e),this.enabled=!0,this._state=Je.for2d(),this.blendMode=e.blendMode,this.padding=e.padding,typeof e.antialias=="boolean"?this.antialias=e.antialias?"on":"off":this.antialias=e.antialias,this.resolution=e.resolution,this.blendRequired=e.blendRequired,this.clipToViewport=e.clipToViewport,this.addResource("uTexture",0,1)}apply(e,t,i,s){e.applyFilter(this,t,i,s)}get blendMode(){return this._state.blendMode}set blendMode(e){this._state.blendMode=e}static from(e){let{gpu:t,gl:i,...s}=e,o,n;return t&&(o=xr.from(t)),i&&(n=gr.from(i)),new gx({gpuProgram:o,glProgram:n,...s})}};dA.defaultOptions={blendMode:"normal",resolution:1,padding:0,antialias:"off",blendRequired:!1,clipToViewport:!0};rn=dA});async function fA(r){if(!r)for(let e=0;e{U();yx=[];V.handleByNamedList(S.Environment,yx)});function jh(){if(typeof al=="boolean")return al;try{al=new Function("param1","param2","param3","return param1[param2] === param3;")({a:"b"},"a","b")===!0}catch{al=!1}return al}var al,_x=y(()=>{"use strict"});var xt,sn=y(()=>{"use strict";xt=(r=>(r[r.NONE=0]="NONE",r[r.COLOR=16384]="COLOR",r[r.STENCIL=1024]="STENCIL",r[r.DEPTH=256]="DEPTH",r[r.COLOR_DEPTH=16640]="COLOR_DEPTH",r[r.COLOR_STENCIL=17408]="COLOR_STENCIL",r[r.DEPTH_STENCIL=1280]="DEPTH_STENCIL",r[r.ALL=17664]="ALL",r))(xt||{})});var on,bx=y(()=>{"use strict";on=class{constructor(e){this.items=[],this._name=e}emit(e,t,i,s,o,n,a,l){let{name:c,items:u}=this;for(let h=0,d=u.length;h{Tt();pA();Pr();_x();Xe();sn();bx();Mt();lU=["init","destroy","contextChange","resolutionChange","resetState","renderEnd","renderStart","render","update","postrender","prerender"],mA=class gA extends Ce{constructor(e){super(),this.runners=Object.create(null),this.renderPipes=Object.create(null),this._initOptions={},this._systemsHash=Object.create(null),this.type=e.type,this.name=e.name,this.config=e;let t=[...lU,...this.config.runners??[]];this._addRunners(...t),this._unsafeEvalCheck()}async init(e={}){let t=e.skipExtensionImports===!0?!0:e.manageImports===!1;await fA(t),this._addSystems(this.config.systems),this._addPipes(this.config.renderPipes,this.config.renderPipeAdaptors);for(let i in this._systemsHash)e={...this._systemsHash[i].constructor.defaultOptions,...e};e={...gA.defaultOptions,...e},this._roundPixels=e.roundPixels?1:0;for(let i=0;i{this.runners[t]=new on(t)})}_addSystems(e){let t;for(t in e){let i=e[t];this._addSystem(i.value,i.name)}}_addSystem(e,t){let i=new e(this);if(this[t])throw new Error(`Whoops! The name "${t}" is already in use`);this[t]=i,this._systemsHash[t]=i;for(let s in this.runners)this.runners[s].add(i);return this}_addPipes(e,t){let i=t.reduce((s,o)=>(s[o.name]=o.value,s),{});e.forEach(s=>{let o=s.value,n=s.name,a=i[n];this.renderPipes[n]=new o(this,a?new a:null)})}destroy(e=!1){this.runners.destroy.items.reverse(),this.runners.destroy.emit(e),Object.values(this.runners).forEach(t=>{t.destroy()}),this._systemsHash=null,this.renderPipes=null}generateTexture(e){return this.textureGenerator.generateTexture(e)}get roundPixels(){return!!this._roundPixels}_unsafeEvalCheck(){if(!jh())throw new Error("Current environment does not allow unsafe-eval, please use pixi.js/unsafe-eval module to enable support.")}resetState(){this.runners.resetState.emit()}};mA.defaultOptions={resolution:1,failIfMajorPerformanceCaveat:!1,roundPixels:!1};qi=mA});var cl,_A=y(()=>{U();ge();ws();ih();$i();Ga();La();tn();Xi();Mr();It();cl=class{init(){let e=new be({uTransformMatrix:{value:new G,type:"mat3x3"},uColor:{value:new Float32Array([1,1,1,1]),type:"vec4"},uRound:{value:0,type:"f32"}}),t=Wr({name:"graphics",bits:[ko,Oo(pr()),UE,$r]});this.shader=new Ze({gpuProgram:t,resources:{localUniforms:e}})}execute(e,t){let i=t.context,s=i.customShader||this.shader,o=e.renderer,n=o.graphicsContext,{batcher:a,instructions:l}=n.getContextRenderData(i),c=o.encoder;c.setGeometry(a.geometry,s.gpuProgram);let u=o.globalUniforms.bindGroup;c.setBindGroup(0,u,s.gpuProgram);let h=o.renderPipes.uniformBatch.getUniformBindGroup(s.resources.localUniforms,!0);c.setBindGroup(2,h,s.gpuProgram);let d=l.instructions,f=null;for(let p=0;p{"use strict";bA={name:"texture-bit",vertex:{header:` + `}}});var hx,dx,zh,NE=y(()=>{ge();$i();tn();Xi();Mr();It();ve();DE();zh=class extends Ze{constructor(){hx??(hx=Wr({name:"tiling-sprite-shader",bits:[Fs,GE,$r]})),dx??(dx=zr({name:"tiling-sprite-shader",bits:[en,LE,Xr]}));let e=new be({uMapCoord:{value:new G,type:"mat3x3"},uClampFrame:{value:new Float32Array([0,0,1,1]),type:"vec4"},uClampOffset:{value:new Float32Array([0,0]),type:"vec2"},uTextureTransform:{value:new G,type:"mat3x3"},uSizeAnchor:{value:new Float32Array([100,100,.5,.5]),type:"vec4"}});super({glProgram:dx,gpuProgram:hx,resources:{localUniforms:new be({uTransformMatrix:{value:new G,type:"mat3x3"},uColor:{value:new Float32Array([1,1,1,1]),type:"vec4"},uRound:{value:0,type:"f32"}}),tilingUniforms:e,uTexture:k.EMPTY.source,uSampler:k.EMPTY.source.style}})}updateUniforms(e,t,i,s,o,n){let a=this.resources.tilingUniforms,l=n.width,c=n.height,u=n.textureMatrix,h=a.uniforms.uTextureTransform;h.set(i.a*l/e,i.b*l/t,i.c*c/e,i.d*c/t,i.tx/e,i.ty/t),h.invert(),a.uniforms.uMapCoord=u.mapCoord,a.uniforms.uClampFrame=u.uClampFrame,a.uniforms.uClampOffset=u.uClampOffset,a.uniforms.uTextureTransform=h,a.uniforms.uSizeAnchor[0]=e,a.uniforms.uSizeAnchor[1]=t,a.uniforms.uSizeAnchor[2]=s,a.uniforms.uSizeAnchor[3]=o,n&&(this.resources.uTexture=n.source,this.resources.uSampler=n.source.style)}}});var $h,HE=y(()=>{Wh();$h=class extends Jo{constructor(){super({positions:new Float32Array([0,0,1,0,1,1,0,1]),uvs:new Float32Array([0,0,1,0,1,1,0,1]),indices:new Uint32Array([0,1,2,0,2,3])})}}});function VE(r,e){let t=r.anchor.x,i=r.anchor.y;e[0]=-t*r.width,e[1]=-i*r.height,e[2]=(1-t)*r.width,e[3]=-i*r.height,e[4]=(1-t)*r.width,e[5]=(1-i)*r.height,e[6]=-t*r.width,e[7]=(1-i)*r.height}var WE=y(()=>{"use strict"});function zE(r,e,t,i){let s=0,o=r.length/(e||2),n=i.a,a=i.b,l=i.c,c=i.d,u=i.tx,h=i.ty;for(t*=e;s{"use strict"});function XE(r,e){let t=r.texture,i=t.frame.width,s=t.frame.height,o=0,n=0;r.applyAnchorToTexture&&(o=r.anchor.x,n=r.anchor.y),e[0]=e[6]=-o,e[2]=e[4]=1-o,e[1]=e[3]=-n,e[5]=e[7]=1-n;let a=G.shared;a.copyFrom(r._tileTransform.matrix),a.tx/=r.width,a.ty/=r.height,a.invert(),a.scale(r.width/i,r.height/s),zE(e,2,0,a)}var jE=y(()=>{ge();$E()});var Xh,il,YE=y(()=>{U();Fa();Rr();jr();Vo();_h();Wh();NE();HE();WE();jE();Xh=new $h,il=class{constructor(e){this._state=Je.default2d,this._tilingSpriteDataHash=Object.create(null),this._destroyRenderableBound=this.destroyRenderable.bind(this),this._renderer=e,this._renderer.renderableGC.addManagedHash(this,"_tilingSpriteDataHash")}validateRenderable(e){let t=this._getTilingSpriteData(e),i=t.canBatch;this._updateCanBatch(e);let s=t.canBatch;if(s&&s===i){let{batchableMesh:o}=t;return!o._batcher.checkAndUpdateTexture(o,e.texture)}return i!==s}addRenderable(e,t){let i=this._renderer.renderPipes.batch;this._updateCanBatch(e);let s=this._getTilingSpriteData(e),{geometry:o,canBatch:n}=s;if(n){s.batchableMesh||(s.batchableMesh=new ji);let a=s.batchableMesh;e.didViewUpdate&&(this._updateBatchableMesh(e),a.geometry=o,a.renderable=e,a.transform=e.groupTransform,a.setTexture(e._texture)),a.roundPixels=this._renderer._roundPixels|e._roundPixels,i.addToBatch(a,t)}else i.break(t),s.shader||(s.shader=new zh),this.updateRenderable(e),t.add(e)}execute(e){let{shader:t}=this._tilingSpriteDataHash[e.uid];t.groups[0]=this._renderer.globalUniforms.bindGroup;let i=t.resources.localUniforms.uniforms;i.uTransformMatrix=e.groupTransform,i.uRound=this._renderer._roundPixels|e._roundPixels,Yr(e.groupColorAlpha,i.uColor,0),this._state.blendMode=mi(e.groupBlendMode,e.texture._source),this._renderer.encoder.draw({geometry:Xh,shader:t,state:this._state})}updateRenderable(e){let t=this._getTilingSpriteData(e),{canBatch:i}=t;if(i){let{batchableMesh:s}=t;e.didViewUpdate&&this._updateBatchableMesh(e),s._batcher.updateElement(s)}else if(e.didViewUpdate){let{shader:s}=t;s.updateUniforms(e.width,e.height,e._tileTransform.matrix,e.anchor.x,e.anchor.y,e.texture)}}destroyRenderable(e){let t=this._getTilingSpriteData(e);t.batchableMesh=null,t.shader?.destroy(),this._tilingSpriteDataHash[e.uid]=null,e.off("destroyed",this._destroyRenderableBound)}_getTilingSpriteData(e){return this._tilingSpriteDataHash[e.uid]||this._initTilingSpriteData(e)}_initTilingSpriteData(e){let t=new Jo({indices:Xh.indices,positions:Xh.positions.slice(),uvs:Xh.uvs.slice()});return this._tilingSpriteDataHash[e.uid]={canBatch:!0,renderable:e,geometry:t},e.on("destroyed",this._destroyRenderableBound),this._tilingSpriteDataHash[e.uid]}_updateBatchableMesh(e){let t=this._getTilingSpriteData(e),{geometry:i}=t,s=e.texture.source.style;s.addressMode!=="repeat"&&(s.addressMode="repeat",s.update()),XE(e,i.uvs),VE(e,i.positions)}destroy(){for(let e in this._tilingSpriteDataHash)this.destroyRenderable(this._tilingSpriteDataHash[e].renderable);this._tilingSpriteDataHash=null,this._renderer=null}_updateCanBatch(e){let t=this._getTilingSpriteData(e),i=e.texture,s=!0;return this._renderer.type===ot.WEBGL&&(s=this._renderer.context.supports.nonPowOf2wrapping),t.canBatch=i.textureMatrix.isSimple&&(s||i.source.isPowerOfTwo),t.canBatch}};il.extension={type:[S.WebGLPipes,S.WebGPUPipes,S.CanvasPipes],name:"tilingSprite"}});var fx=y(()=>{U();YE();V.add(il)});var qE,ZE,QE=y(()=>{Xe();Wh();qE=class KE extends Jo{constructor(...e){super({});let t=e[0]??{};typeof t=="number"&&(X(ie,"PlaneGeometry constructor changed please use { width, height, verticesX, verticesY } instead"),t={width:t,height:e[1],verticesX:e[2],verticesY:e[3]}),this.build(t)}build(e){e={...KE.defaultOptions,...e},this.verticesX=this.verticesX??e.verticesX,this.verticesY=this.verticesY??e.verticesY,this.width=this.width??e.width,this.height=this.height??e.height;let t=this.verticesX*this.verticesY,i=[],s=[],o=[],n=this.verticesX-1,a=this.verticesY-1,l=this.width/n,c=this.height/a;for(let h=0;h{QE();JE=class eA extends ZE{constructor(e={}){e={...eA.defaultOptions,...e},super({width:e.width,height:e.height,verticesX:4,verticesY:4}),this.update(e)}update(e){this.width=e.width??this.width,this.height=e.height??this.height,this._originalWidth=e.originalWidth??this._originalWidth,this._originalHeight=e.originalHeight??this._originalHeight,this._leftWidth=e.leftWidth??this._leftWidth,this._rightWidth=e.rightWidth??this._rightWidth,this._topHeight=e.topHeight??this._topHeight,this._bottomHeight=e.bottomHeight??this._bottomHeight,this._anchorX=e.anchor?.x,this._anchorY=e.anchor?.y,this.updateUvs(),this.updatePositions()}updatePositions(){let e=this.positions,{width:t,height:i,_leftWidth:s,_rightWidth:o,_topHeight:n,_bottomHeight:a,_anchorX:l,_anchorY:c}=this,u=s+o,h=t>u?1:t/u,d=n+a,f=i>d?1:i/d,p=Math.min(h,f),m=l*t,g=c*i;e[0]=e[8]=e[16]=e[24]=-m,e[2]=e[10]=e[18]=e[26]=s*p-m,e[4]=e[12]=e[20]=e[28]=t-o*p-m,e[6]=e[14]=e[22]=e[30]=t-m,e[1]=e[3]=e[5]=e[7]=-g,e[9]=e[11]=e[13]=e[15]=n*p-g,e[17]=e[19]=e[21]=e[23]=i-a*p-g,e[25]=e[27]=e[29]=e[31]=i-g,this.getBuffer("aPosition").update()}updateUvs(){let e=this.uvs;e[0]=e[8]=e[16]=e[24]=0,e[1]=e[3]=e[5]=e[7]=0,e[6]=e[14]=e[22]=e[30]=1,e[25]=e[27]=e[29]=e[31]=1;let t=1/this._originalWidth,i=1/this._originalHeight;e[2]=e[10]=e[18]=e[26]=t*this._leftWidth,e[9]=e[11]=e[13]=e[15]=i*this._topHeight,e[4]=e[12]=e[20]=e[28]=1-t*this._rightWidth,e[17]=e[19]=e[21]=e[23]=1-i*this._bottomHeight,this.getBuffer("aUV").update()}};JE.defaultOptions={width:100,height:100,leftWidth:10,topHeight:10,rightWidth:10,bottomHeight:10,originalWidth:100,originalHeight:100};tA=JE});var sl,iA=y(()=>{U();Gt();_h();rA();sl=class{constructor(e){this._gpuSpriteHash=Object.create(null),this._destroyRenderableBound=this.destroyRenderable.bind(this),this._renderer=e,this._renderer.renderableGC.addManagedHash(this,"_gpuSpriteHash")}addRenderable(e,t){let i=this._getGpuSprite(e);e.didViewUpdate&&this._updateBatchableSprite(e,i),this._renderer.renderPipes.batch.addToBatch(i,t)}updateRenderable(e){let t=this._gpuSpriteHash[e.uid];e.didViewUpdate&&this._updateBatchableSprite(e,t),t._batcher.updateElement(t)}validateRenderable(e){let t=this._getGpuSprite(e);return!t._batcher.checkAndUpdateTexture(t,e._texture)}destroyRenderable(e){let t=this._gpuSpriteHash[e.uid];se.return(t.geometry),se.return(t),this._gpuSpriteHash[e.uid]=null,e.off("destroyed",this._destroyRenderableBound)}_updateBatchableSprite(e,t){t.geometry.update(e),t.setTexture(e._texture)}_getGpuSprite(e){return this._gpuSpriteHash[e.uid]||this._initGPUSprite(e)}_initGPUSprite(e){let t=se.get(ji);return t.geometry=se.get(tA),t.renderable=e,t.transform=e.groupTransform,t.texture=e._texture,t.roundPixels=this._renderer._roundPixels|e._roundPixels,this._gpuSpriteHash[e.uid]=t,e.didViewUpdate||this._updateBatchableSprite(e,t),e.on("destroyed",this._destroyRenderableBound),t}destroy(){for(let e in this._gpuSpriteHash)this._gpuSpriteHash[e].geometry.destroy();this._gpuSpriteHash=null,this._renderer=null}};sl.extension={type:[S.WebGLPipes,S.WebGPUPipes,S.CanvasPipes],name:"nineSliceSprite"}});var px=y(()=>{U();iA();V.add(sl)});var ol,sA=y(()=>{U();ol=class{constructor(e){this._renderer=e}push(e,t,i){this._renderer.renderPipes.batch.break(i),i.add({renderPipeId:"filter",canBundle:!1,action:"pushFilter",container:t,filterEffect:e})}pop(e,t,i){this._renderer.renderPipes.batch.break(i),i.add({renderPipeId:"filter",action:"popFilter",canBundle:!1})}execute(e){e.action==="pushFilter"?this._renderer.filter.push(e):e.action==="popFilter"&&this._renderer.filter.pop()}destroy(){this._renderer=null}};ol.extension={type:[S.WebGLPipes,S.WebGPUPipes,S.CanvasPipes],name:"filter"}});function oA(r,e){e.clear();let t=e.matrix;for(let i=0;i{"use strict"});var oU,nl,aA=y(()=>{U();ge();fr();Vi();Ro();It();ve();Oi();jr();$t();nA();Ae();oU=new mr({attributes:{aPosition:{buffer:new Float32Array([0,0,1,0,1,1,0,1]),format:"float32x2",stride:2*4,offset:0}},indexBuffer:new Uint32Array([0,1,2,0,2,3])}),nl=class{constructor(e){this._filterStackIndex=0,this._filterStack=[],this._filterGlobalUniforms=new be({uInputSize:{value:new Float32Array(4),type:"vec4"},uInputPixel:{value:new Float32Array(4),type:"vec4"},uInputClamp:{value:new Float32Array(4),type:"vec4"},uOutputFrame:{value:new Float32Array(4),type:"vec4"},uGlobalFrame:{value:new Float32Array(4),type:"vec4"},uOutputTexture:{value:new Float32Array(4),type:"vec4"}}),this._globalFilterBindGroup=new gt({}),this.renderer=e}get activeBackTexture(){return this._activeFilterData?.backTexture}push(e){let t=this.renderer,i=e.filterEffect.filters;this._filterStack[this._filterStackIndex]||(this._filterStack[this._filterStackIndex]=this._getFilterData());let s=this._filterStack[this._filterStackIndex];if(this._filterStackIndex++,i.length===0){s.skip=!0;return}let o=s.bounds;if(e.renderables?oA(e.renderables,o):e.filterEffect.filterArea?(o.clear(),o.addRect(e.filterEffect.filterArea),o.applyMatrix(e.container.worldTransform)):e.container.getFastGlobalBounds(!0,o),e.container){let p=(e.container.renderGroup||e.container.parentRenderGroup).cacheToLocalTransform;p&&o.applyMatrix(p)}let n=t.renderTarget.renderTarget.colorTexture.source,a=1/0,l=0,c=!0,u=!1,h=!1,d=!0;for(let f=0;f0?this._filterStack[this._filterStackIndex-1].bounds:null,l=e.renderTarget.getRenderTarget(t.previousRenderSurface);o=this.getBackTexture(l,s,a)}t.backTexture=o;let n=t.filterEffect.filters;if(this._globalFilterBindGroup.setResource(i.source.style,2),this._globalFilterBindGroup.setResource(o.source,3),e.globalUniforms.pop(),n.length===1)n[0].apply(this,i,t.previousRenderSurface,!1),je.returnTexture(i);else{let a=t.inputTexture,l=je.getOptimalTexture(s.width,s.height,a.source._resolution,!1),c=0;for(c=0;c0&&this._filterStack[d].skip;)--d;d>0&&(h=this._filterStack[d].inputTexture.source._resolution);let f=this._filterGlobalUniforms,p=f.uniforms,m=p.uOutputFrame,g=p.uInputSize,_=p.uInputPixel,v=p.uInputClamp,x=p.uGlobalFrame,T=p.uOutputTexture;if(u){let w=this._filterStackIndex;for(;w>0;){w--;let I=this._filterStack[this._filterStackIndex-1];if(!I.skip){l.x=I.bounds.minX,l.y=I.bounds.minY;break}}m[0]=a.minX-l.x,m[1]=a.minY-l.y}else m[0]=0,m[1]=0;m[2]=t.frame.width,m[3]=t.frame.height,g[0]=t.source.width,g[1]=t.source.height,g[2]=1/g[0],g[3]=1/g[1],_[0]=t.source.pixelWidth,_[1]=t.source.pixelHeight,_[2]=1/_[0],_[3]=1/_[1],v[0]=.5*_[2],v[1]=.5*_[3],v[2]=t.frame.width*g[2]-.5*_[2],v[3]=t.frame.height*g[3]-.5*_[3];let b=this.renderer.renderTarget.rootRenderTarget.colorTexture;x[0]=l.x*h,x[1]=l.y*h,x[2]=b.source.width*h,x[3]=b.source.height*h;let E=this.renderer.renderTarget.getRenderTarget(i);if(o.renderTarget.bind(i,!!s),i instanceof k?(T[0]=i.frame.width,T[1]=i.frame.height):(T[0]=E.width,T[1]=E.height),T[2]=E.isRoot?-1:1,f.update(),o.renderPipes.uniformBatch){let w=o.renderPipes.uniformBatch.getUboResource(f);this._globalFilterBindGroup.setResource(w,0)}else this._globalFilterBindGroup.setResource(f,0);this._globalFilterBindGroup.setResource(t.source,1),this._globalFilterBindGroup.setResource(t.source.style,2),e.groups[0]=this._globalFilterBindGroup,o.encoder.draw({geometry:oU,shader:e,state:e._state,topology:"triangle-list"}),o.type===ot.WEBGL&&o.renderTarget.finishRenderPass()}_getFilterData(){return{skip:!1,inputTexture:null,bounds:new Ee,container:null,filterEffect:null,blendRequired:!1,previousRenderSurface:null}}calculateSpriteMatrix(e,t){let i=this._activeFilterData,s=e.set(i.inputTexture._source.width,0,0,i.inputTexture._source.height,i.bounds.minX,i.bounds.minY),o=t.worldTransform.copyTo(G.shared),n=t.renderGroup||t.parentRenderGroup;return n&&n.cacheToLocalTransform&&o.prepend(n.cacheToLocalTransform),o.invert(),s.prepend(o),s.scale(1/t.texture.frame.width,1/t.texture.frame.height),s.translate(t.anchor.x,t.anchor.y),s}};nl.extension={type:[S.WebGLSystem,S.WebGPUSystem],name:"filter"}});var mx=y(()=>{U();sA();aA();V.add(nl);V.add(ol)});var nU={};var lA=y(()=>{u0();ym();y0();b0();Yu();eh();wg();Eg();Mg();Zg();ax();ux();fx();px();mx()});var aU={};var uA=y(()=>{ym();Yu();eh();wg();Eg();Mg();Zg();ax();ux();fx();px();mx()});var dA,rn,xx=y(()=>{As();Bo();Mr();Rr();dA=class gx extends Ze{constructor(e){e={...gx.defaultOptions,...e},super(e),this.enabled=!0,this._state=Je.for2d(),this.blendMode=e.blendMode,this.padding=e.padding,typeof e.antialias=="boolean"?this.antialias=e.antialias?"on":"off":this.antialias=e.antialias,this.resolution=e.resolution,this.blendRequired=e.blendRequired,this.clipToViewport=e.clipToViewport,this.addResource("uTexture",0,1)}apply(e,t,i,s){e.applyFilter(this,t,i,s)}get blendMode(){return this._state.blendMode}set blendMode(e){this._state.blendMode=e}static from(e){let{gpu:t,gl:i,...s}=e,o,n;return t&&(o=xr.from(t)),i&&(n=gr.from(i)),new gx({gpuProgram:o,glProgram:n,...s})}};dA.defaultOptions={blendMode:"normal",resolution:1,padding:0,antialias:"off",blendRequired:!1,clipToViewport:!0};rn=dA});async function fA(r){if(!r)for(let e=0;e{U();yx=[];V.handleByNamedList(S.Environment,yx)});function jh(){if(typeof al=="boolean")return al;try{al=new Function("param1","param2","param3","return param1[param2] === param3;")({a:"b"},"a","b")===!0}catch{al=!1}return al}var al,_x=y(()=>{"use strict"});var xt,sn=y(()=>{"use strict";xt=(r=>(r[r.NONE=0]="NONE",r[r.COLOR=16384]="COLOR",r[r.STENCIL=1024]="STENCIL",r[r.DEPTH=256]="DEPTH",r[r.COLOR_DEPTH=16640]="COLOR_DEPTH",r[r.COLOR_STENCIL=17408]="COLOR_STENCIL",r[r.DEPTH_STENCIL=1280]="DEPTH_STENCIL",r[r.ALL=17664]="ALL",r))(xt||{})});var on,bx=y(()=>{"use strict";on=class{constructor(e){this.items=[],this._name=e}emit(e,t,i,s,o,n,a,l){let{name:c,items:u}=this;for(let h=0,d=u.length;h{Tt();pA();Pr();_x();Xe();sn();bx();Mt();lU=["init","destroy","contextChange","resolutionChange","resetState","renderEnd","renderStart","render","update","postrender","prerender"],mA=class gA extends Ce{constructor(e){super(),this.runners=Object.create(null),this.renderPipes=Object.create(null),this._initOptions={},this._systemsHash=Object.create(null),this.type=e.type,this.name=e.name,this.config=e;let t=[...lU,...this.config.runners??[]];this._addRunners(...t),this._unsafeEvalCheck()}async init(e={}){let t=e.skipExtensionImports===!0?!0:e.manageImports===!1;await fA(t),this._addSystems(this.config.systems),this._addPipes(this.config.renderPipes,this.config.renderPipeAdaptors);for(let i in this._systemsHash)e={...this._systemsHash[i].constructor.defaultOptions,...e};e={...gA.defaultOptions,...e},this._roundPixels=e.roundPixels?1:0;for(let i=0;i{this.runners[t]=new on(t)})}_addSystems(e){let t;for(t in e){let i=e[t];this._addSystem(i.value,i.name)}}_addSystem(e,t){let i=new e(this);if(this[t])throw new Error(`Whoops! The name "${t}" is already in use`);this[t]=i,this._systemsHash[t]=i;for(let s in this.runners)this.runners[s].add(i);return this}_addPipes(e,t){let i=t.reduce((s,o)=>(s[o.name]=o.value,s),{});e.forEach(s=>{let o=s.value,n=s.name,a=i[n];this.renderPipes[n]=new o(this,a?new a:null)})}destroy(e=!1){this.runners.destroy.items.reverse(),this.runners.destroy.emit(e),Object.values(this.runners).forEach(t=>{t.destroy()}),this._systemsHash=null,this.renderPipes=null}generateTexture(e){return this.textureGenerator.generateTexture(e)}get roundPixels(){return!!this._roundPixels}_unsafeEvalCheck(){if(!jh())throw new Error("Current environment does not allow unsafe-eval, please use pixi.js/unsafe-eval module to enable support.")}resetState(){this.runners.resetState.emit()}};mA.defaultOptions={resolution:1,failIfMajorPerformanceCaveat:!1,roundPixels:!1};qi=mA});var cl,_A=y(()=>{U();ge();ws();ih();$i();Ga();La();tn();Xi();Mr();It();cl=class{init(){let e=new be({uTransformMatrix:{value:new G,type:"mat3x3"},uColor:{value:new Float32Array([1,1,1,1]),type:"vec4"},uRound:{value:0,type:"f32"}}),t=Wr({name:"graphics",bits:[ko,Oo(pr()),UE,$r]});this.shader=new Ze({gpuProgram:t,resources:{localUniforms:e}})}execute(e,t){let i=t.context,s=i.customShader||this.shader,o=e.renderer,n=o.graphicsContext,{batcher:a,instructions:l}=n.getContextRenderData(i),c=o.encoder;c.setGeometry(a.geometry,s.gpuProgram);let u=o.globalUniforms.bindGroup;c.setBindGroup(0,u,s.gpuProgram);let h=o.renderPipes.uniformBatch.getUniformBindGroup(s.resources.localUniforms,!0);c.setBindGroup(2,h,s.gpuProgram);let d=l.instructions,f=null;for(let p=0;p{"use strict";bA={name:"texture-bit",vertex:{header:` struct TextureUniforms { uTextureMatrix:mat3x3, @@ -1086,11 +1086,11 @@ fn mainFragment( cv = cu.value; v = uv["${i}"]; ${a};`)}}return new Function("ud","uv","renderer","syncData",t.join(` -`))}var eC=y(()=>{rd();It();Vx();QP()});var tc,tC=y(()=>{U();eC();tc=class{constructor(e){this._cache={},this._uniformGroupSyncHash={},this._renderer=e,this.gl=null,this._cache={}}contextChange(e){this.gl=e}updateUniformGroup(e,t,i){let s=this._renderer.shader._getProgramData(t);(!e.isStatic||e._dirtyId!==s.uniformDirtyGroups[e.uid])&&(s.uniformDirtyGroups[e.uid]=e._dirtyId,this._getUniformSyncFunction(e,t)(s.uniformData,e.uniforms,this._renderer,i))}_getUniformSyncFunction(e,t){return this._uniformGroupSyncHash[e._signature]?.[t._key]||this._createUniformSyncFunction(e,t)}_createUniformSyncFunction(e,t){let i=this._uniformGroupSyncHash[e._signature]||(this._uniformGroupSyncHash[e._signature]={}),s=this._getSignature(e,t._uniformData,"u");return this._cache[s]||(this._cache[s]=this._generateUniformsSync(e,t._uniformData)),i[t._key]=this._cache[s],i[t._key]}_generateUniformsSync(e,t){return JP(e,t)}_getSignature(e,t,i){let s=e.uniforms,o=[`${i}-`];for(let n in s)o.push(n),t[n]&&o.push(t[n].type);return o.join("-")}destroy(){this._renderer=null,this._cache=null}};tc.extension={type:[S.WebGLSystem],name:"uniformGroup"}});function rC(r){let e={};if(e.normal=[r.ONE,r.ONE_MINUS_SRC_ALPHA],e.add=[r.ONE,r.ONE],e.multiply=[r.DST_COLOR,r.ONE_MINUS_SRC_ALPHA,r.ONE,r.ONE_MINUS_SRC_ALPHA],e.screen=[r.ONE,r.ONE_MINUS_SRC_COLOR,r.ONE,r.ONE_MINUS_SRC_ALPHA],e.none=[0,0],e["normal-npm"]=[r.SRC_ALPHA,r.ONE_MINUS_SRC_ALPHA,r.ONE,r.ONE_MINUS_SRC_ALPHA],e["add-npm"]=[r.SRC_ALPHA,r.ONE,r.ONE,r.ONE],e["screen-npm"]=[r.SRC_ALPHA,r.ONE_MINUS_SRC_COLOR,r.ONE,r.ONE_MINUS_SRC_ALPHA],e.erase=[r.ZERO,r.ONE_MINUS_SRC_ALPHA],!(r instanceof j.get().getWebGLRenderingContext()))e.min=[r.ONE,r.ONE,r.ONE,r.ONE,r.MIN,r.MIN],e.max=[r.ONE,r.ONE,r.ONE,r.ONE,r.MAX,r.MAX];else{let i=r.getExtension("EXT_blend_minmax");i&&(e.min=[r.ONE,r.ONE,r.ONE,r.ONE,i.MIN_EXT,i.MIN_EXT],e.max=[r.ONE,r.ONE,r.ONE,r.ONE,i.MAX_EXT,i.MAX_EXT])}return e}var iC=y(()=>{Re()});var RU,IU,BU,kU,FU,OU,sC,oC,nC=y(()=>{U();Rr();iC();RU=0,IU=1,BU=2,kU=3,FU=4,OU=5,sC=class cy{constructor(e){this._invertFrontFace=!1,this.gl=null,this.stateId=0,this.polygonOffset=0,this.blendMode="none",this._blendEq=!1,this.map=[],this.map[RU]=this.setBlend,this.map[IU]=this.setOffset,this.map[BU]=this.setCullFace,this.map[kU]=this.setDepthTest,this.map[FU]=this.setFrontFace,this.map[OU]=this.setDepthMask,this.checks=[],this.defaultState=Je.for2d(),e.renderTarget.onRenderTargetChange.add(this)}onRenderTargetChange(e){this._invertFrontFace=!e.isRoot,this._cullFace?this.setFrontFace(this._frontFace):this._frontFaceDirty=!0}contextChange(e){this.gl=e,this.blendModesMap=rC(e),this.resetState()}set(e){if(e||(e=this.defaultState),this.stateId!==e.data){let t=this.stateId^e.data,i=0;for(;t;)t&1&&this.map[i].call(this,!!(e.data&1<>=1,i++;this.stateId=e.data}for(let t=0;t{ey();xd=class{constructor(e){this.target=Jx.TEXTURE_2D,this.texture=e,this.width=-1,this.height=-1,this.type=ye.UNSIGNED_BYTE,this.internalFormat=ud.RGBA,this.format=ud.RGBA,this.samplerType=0}}});var lC,cC=y(()=>{"use strict";lC={id:"buffer",upload(r,e,t){e.width===r.width||e.height===r.height?t.texSubImage2D(t.TEXTURE_2D,0,0,0,r.width,r.height,e.format,e.type,r.resource):t.texImage2D(e.target,0,e.internalFormat,r.width,r.height,0,e.format,e.type,r.resource),e.width=r.width,e.height=r.height}}});var UU,uC,hC=y(()=>{"use strict";UU={"bc1-rgba-unorm":!0,"bc1-rgba-unorm-srgb":!0,"bc2-rgba-unorm":!0,"bc2-rgba-unorm-srgb":!0,"bc3-rgba-unorm":!0,"bc3-rgba-unorm-srgb":!0,"bc4-r-unorm":!0,"bc4-r-snorm":!0,"bc5-rg-unorm":!0,"bc5-rg-snorm":!0,"bc6h-rgb-ufloat":!0,"bc6h-rgb-float":!0,"bc7-rgba-unorm":!0,"bc7-rgba-unorm-srgb":!0,"etc2-rgb8unorm":!0,"etc2-rgb8unorm-srgb":!0,"etc2-rgb8a1unorm":!0,"etc2-rgb8a1unorm-srgb":!0,"etc2-rgba8unorm":!0,"etc2-rgba8unorm-srgb":!0,"eac-r11unorm":!0,"eac-r11snorm":!0,"eac-rg11unorm":!0,"eac-rg11snorm":!0,"astc-4x4-unorm":!0,"astc-4x4-unorm-srgb":!0,"astc-5x4-unorm":!0,"astc-5x4-unorm-srgb":!0,"astc-5x5-unorm":!0,"astc-5x5-unorm-srgb":!0,"astc-6x5-unorm":!0,"astc-6x5-unorm-srgb":!0,"astc-6x6-unorm":!0,"astc-6x6-unorm-srgb":!0,"astc-8x5-unorm":!0,"astc-8x5-unorm-srgb":!0,"astc-8x6-unorm":!0,"astc-8x6-unorm-srgb":!0,"astc-8x8-unorm":!0,"astc-8x8-unorm-srgb":!0,"astc-10x5-unorm":!0,"astc-10x5-unorm-srgb":!0,"astc-10x6-unorm":!0,"astc-10x6-unorm-srgb":!0,"astc-10x8-unorm":!0,"astc-10x8-unorm-srgb":!0,"astc-10x10-unorm":!0,"astc-10x10-unorm-srgb":!0,"astc-12x10-unorm":!0,"astc-12x10-unorm-srgb":!0,"astc-12x12-unorm":!0,"astc-12x12-unorm-srgb":!0},uC={id:"compressed",upload(r,e,t){t.pixelStorei(t.UNPACK_ALIGNMENT,4);let i=r.pixelWidth,s=r.pixelHeight,o=!!UU[r.format];for(let n=0;n>1,1),s=Math.max(s>>1,1)}}}});var yd,uy=y(()=>{"use strict";yd={id:"image",upload(r,e,t,i){let s=e.width,o=e.height,n=r.pixelWidth,a=r.pixelHeight,l=r.resourceWidth,c=r.resourceHeight;l{uy();dC={id:"video",upload(r,e,t,i){if(!r.isValid){t.texImage2D(e.target,0,e.internalFormat,1,1,0,e.format,e.type,null);return}yd.upload(r,e,t,i)}}});var hy,pC,_d,mC,gC=y(()=>{"use strict";hy={linear:9729,nearest:9728},pC={linear:{linear:9987,nearest:9985},nearest:{linear:9986,nearest:9984}},_d={"clamp-to-edge":33071,repeat:10497,"mirror-repeat":33648},mC={never:512,less:513,equal:514,"less-equal":515,greater:516,"not-equal":517,"greater-equal":518,always:519}});function dy(r,e,t,i,s,o,n,a){let l=o;if(!a||r.addressModeU!=="repeat"||r.addressModeV!=="repeat"||r.addressModeW!=="repeat"){let c=_d[n?"clamp-to-edge":r.addressModeU],u=_d[n?"clamp-to-edge":r.addressModeV],h=_d[n?"clamp-to-edge":r.addressModeW];e[s](l,e.TEXTURE_WRAP_S,c),e[s](l,e.TEXTURE_WRAP_T,u),e.TEXTURE_WRAP_R&&e[s](l,e.TEXTURE_WRAP_R,h)}if((!a||r.magFilter!=="linear")&&e[s](l,e.TEXTURE_MAG_FILTER,hy[r.magFilter]),t){if(!a||r.mipmapFilter!=="linear"){let c=pC[r.minFilter][r.mipmapFilter];e[s](l,e.TEXTURE_MIN_FILTER,c)}}else e[s](l,e.TEXTURE_MIN_FILTER,hy[r.minFilter]);if(i&&r.maxAnisotropy>1){let c=Math.min(r.maxAnisotropy,e.getParameter(i.MAX_TEXTURE_MAX_ANISOTROPY_EXT));e[s](l,i.TEXTURE_MAX_ANISOTROPY_EXT,c)}r.compare&&e[s](l,e.TEXTURE_COMPARE_FUNC,mC[r.compare])}var xC=y(()=>{gC()});function yC(r){return{r8unorm:r.RED,r8snorm:r.RED,r8uint:r.RED,r8sint:r.RED,r16uint:r.RED,r16sint:r.RED,r16float:r.RED,rg8unorm:r.RG,rg8snorm:r.RG,rg8uint:r.RG,rg8sint:r.RG,r32uint:r.RED,r32sint:r.RED,r32float:r.RED,rg16uint:r.RG,rg16sint:r.RG,rg16float:r.RG,rgba8unorm:r.RGBA,"rgba8unorm-srgb":r.RGBA,rgba8snorm:r.RGBA,rgba8uint:r.RGBA,rgba8sint:r.RGBA,bgra8unorm:r.RGBA,"bgra8unorm-srgb":r.RGBA,rgb9e5ufloat:r.RGB,rgb10a2unorm:r.RGBA,rg11b10ufloat:r.RGB,rg32uint:r.RG,rg32sint:r.RG,rg32float:r.RG,rgba16uint:r.RGBA,rgba16sint:r.RGBA,rgba16float:r.RGBA,rgba32uint:r.RGBA,rgba32sint:r.RGBA,rgba32float:r.RGBA,stencil8:r.STENCIL_INDEX8,depth16unorm:r.DEPTH_COMPONENT,depth24plus:r.DEPTH_COMPONENT,"depth24plus-stencil8":r.DEPTH_STENCIL,depth32float:r.DEPTH_COMPONENT,"depth32float-stencil8":r.DEPTH_STENCIL}}var _C=y(()=>{"use strict"});function bC(r,e){let t={},i=r.RGBA;return r instanceof j.get().getWebGLRenderingContext()?e.srgb&&(t={"rgba8unorm-srgb":e.srgb.SRGB8_ALPHA8_EXT,"bgra8unorm-srgb":e.srgb.SRGB8_ALPHA8_EXT}):(t={"rgba8unorm-srgb":r.SRGB8_ALPHA8,"bgra8unorm-srgb":r.SRGB8_ALPHA8},i=r.RGBA8),{r8unorm:r.R8,r8snorm:r.R8_SNORM,r8uint:r.R8UI,r8sint:r.R8I,r16uint:r.R16UI,r16sint:r.R16I,r16float:r.R16F,rg8unorm:r.RG8,rg8snorm:r.RG8_SNORM,rg8uint:r.RG8UI,rg8sint:r.RG8I,r32uint:r.R32UI,r32sint:r.R32I,r32float:r.R32F,rg16uint:r.RG16UI,rg16sint:r.RG16I,rg16float:r.RG16F,rgba8unorm:r.RGBA,...t,rgba8snorm:r.RGBA8_SNORM,rgba8uint:r.RGBA8UI,rgba8sint:r.RGBA8I,bgra8unorm:i,rgb9e5ufloat:r.RGB9_E5,rgb10a2unorm:r.RGB10_A2,rg11b10ufloat:r.R11F_G11F_B10F,rg32uint:r.RG32UI,rg32sint:r.RG32I,rg32float:r.RG32F,rgba16uint:r.RGBA16UI,rgba16sint:r.RGBA16I,rgba16float:r.RGBA16F,rgba32uint:r.RGBA32UI,rgba32sint:r.RGBA32I,rgba32float:r.RGBA32F,stencil8:r.STENCIL_INDEX8,depth16unorm:r.DEPTH_COMPONENT16,depth24plus:r.DEPTH_COMPONENT24,"depth24plus-stencil8":r.DEPTH24_STENCIL8,depth32float:r.DEPTH_COMPONENT32F,"depth32float-stencil8":r.DEPTH32F_STENCIL8,...e.s3tc?{"bc1-rgba-unorm":e.s3tc.COMPRESSED_RGBA_S3TC_DXT1_EXT,"bc2-rgba-unorm":e.s3tc.COMPRESSED_RGBA_S3TC_DXT3_EXT,"bc3-rgba-unorm":e.s3tc.COMPRESSED_RGBA_S3TC_DXT5_EXT}:{},...e.s3tc_sRGB?{"bc1-rgba-unorm-srgb":e.s3tc_sRGB.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT,"bc2-rgba-unorm-srgb":e.s3tc_sRGB.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT,"bc3-rgba-unorm-srgb":e.s3tc_sRGB.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}:{},...e.rgtc?{"bc4-r-unorm":e.rgtc.COMPRESSED_RED_RGTC1_EXT,"bc4-r-snorm":e.rgtc.COMPRESSED_SIGNED_RED_RGTC1_EXT,"bc5-rg-unorm":e.rgtc.COMPRESSED_RED_GREEN_RGTC2_EXT,"bc5-rg-snorm":e.rgtc.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}:{},...e.bptc?{"bc6h-rgb-float":e.bptc.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT,"bc6h-rgb-ufloat":e.bptc.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT,"bc7-rgba-unorm":e.bptc.COMPRESSED_RGBA_BPTC_UNORM_EXT,"bc7-rgba-unorm-srgb":e.bptc.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT}:{},...e.etc?{"etc2-rgb8unorm":e.etc.COMPRESSED_RGB8_ETC2,"etc2-rgb8unorm-srgb":e.etc.COMPRESSED_SRGB8_ETC2,"etc2-rgb8a1unorm":e.etc.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2,"etc2-rgb8a1unorm-srgb":e.etc.COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2,"etc2-rgba8unorm":e.etc.COMPRESSED_RGBA8_ETC2_EAC,"etc2-rgba8unorm-srgb":e.etc.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC,"eac-r11unorm":e.etc.COMPRESSED_R11_EAC,"eac-rg11unorm":e.etc.COMPRESSED_SIGNED_RG11_EAC}:{},...e.astc?{"astc-4x4-unorm":e.astc.COMPRESSED_RGBA_ASTC_4x4_KHR,"astc-4x4-unorm-srgb":e.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR,"astc-5x4-unorm":e.astc.COMPRESSED_RGBA_ASTC_5x4_KHR,"astc-5x4-unorm-srgb":e.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR,"astc-5x5-unorm":e.astc.COMPRESSED_RGBA_ASTC_5x5_KHR,"astc-5x5-unorm-srgb":e.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR,"astc-6x5-unorm":e.astc.COMPRESSED_RGBA_ASTC_6x5_KHR,"astc-6x5-unorm-srgb":e.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR,"astc-6x6-unorm":e.astc.COMPRESSED_RGBA_ASTC_6x6_KHR,"astc-6x6-unorm-srgb":e.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR,"astc-8x5-unorm":e.astc.COMPRESSED_RGBA_ASTC_8x5_KHR,"astc-8x5-unorm-srgb":e.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR,"astc-8x6-unorm":e.astc.COMPRESSED_RGBA_ASTC_8x6_KHR,"astc-8x6-unorm-srgb":e.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR,"astc-8x8-unorm":e.astc.COMPRESSED_RGBA_ASTC_8x8_KHR,"astc-8x8-unorm-srgb":e.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR,"astc-10x5-unorm":e.astc.COMPRESSED_RGBA_ASTC_10x5_KHR,"astc-10x5-unorm-srgb":e.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR,"astc-10x6-unorm":e.astc.COMPRESSED_RGBA_ASTC_10x6_KHR,"astc-10x6-unorm-srgb":e.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR,"astc-10x8-unorm":e.astc.COMPRESSED_RGBA_ASTC_10x8_KHR,"astc-10x8-unorm-srgb":e.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR,"astc-10x10-unorm":e.astc.COMPRESSED_RGBA_ASTC_10x10_KHR,"astc-10x10-unorm-srgb":e.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR,"astc-12x10-unorm":e.astc.COMPRESSED_RGBA_ASTC_12x10_KHR,"astc-12x10-unorm-srgb":e.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR,"astc-12x12-unorm":e.astc.COMPRESSED_RGBA_ASTC_12x12_KHR,"astc-12x12-unorm-srgb":e.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR}:{}}}var vC=y(()=>{Re()});function TC(r){return{r8unorm:r.UNSIGNED_BYTE,r8snorm:r.BYTE,r8uint:r.UNSIGNED_BYTE,r8sint:r.BYTE,r16uint:r.UNSIGNED_SHORT,r16sint:r.SHORT,r16float:r.HALF_FLOAT,rg8unorm:r.UNSIGNED_BYTE,rg8snorm:r.BYTE,rg8uint:r.UNSIGNED_BYTE,rg8sint:r.BYTE,r32uint:r.UNSIGNED_INT,r32sint:r.INT,r32float:r.FLOAT,rg16uint:r.UNSIGNED_SHORT,rg16sint:r.SHORT,rg16float:r.HALF_FLOAT,rgba8unorm:r.UNSIGNED_BYTE,"rgba8unorm-srgb":r.UNSIGNED_BYTE,rgba8snorm:r.BYTE,rgba8uint:r.UNSIGNED_BYTE,rgba8sint:r.BYTE,bgra8unorm:r.UNSIGNED_BYTE,"bgra8unorm-srgb":r.UNSIGNED_BYTE,rgb9e5ufloat:r.UNSIGNED_INT_5_9_9_9_REV,rgb10a2unorm:r.UNSIGNED_INT_2_10_10_10_REV,rg11b10ufloat:r.UNSIGNED_INT_10F_11F_11F_REV,rg32uint:r.UNSIGNED_INT,rg32sint:r.INT,rg32float:r.FLOAT,rgba16uint:r.UNSIGNED_SHORT,rgba16sint:r.SHORT,rgba16float:r.HALF_FLOAT,rgba32uint:r.UNSIGNED_INT,rgba32sint:r.INT,rgba32float:r.FLOAT,stencil8:r.UNSIGNED_BYTE,depth16unorm:r.UNSIGNED_SHORT,depth24plus:r.UNSIGNED_INT,"depth24plus-stencil8":r.UNSIGNED_INT_24_8,depth32float:r.FLOAT,"depth32float-stencil8":r.FLOAT_32_UNSIGNED_INT_24_8_REV}}var SC=y(()=>{"use strict"});var GU,rc,wC=y(()=>{Re();U();ve();aC();cC();hC();uy();fC();xC();_C();vC();SC();GU=4,rc=class{constructor(e){this.managedTextures=[],this._glTextures=Object.create(null),this._glSamplers=Object.create(null),this._boundTextures=[],this._activeTextureLocation=-1,this._boundSamplers=Object.create(null),this._uploads={image:yd,buffer:lC,video:dC,compressed:uC},this._premultiplyAlpha=!1,this._useSeparateSamplers=!1,this._renderer=e,this._renderer.renderableGC.addManagedHash(this,"_glTextures"),this._renderer.renderableGC.addManagedHash(this,"_glSamplers")}contextChange(e){this._gl=e,this._mapFormatToInternalFormat||(this._mapFormatToInternalFormat=bC(e,this._renderer.context.extensions),this._mapFormatToType=TC(e),this._mapFormatToFormat=yC(e)),this._glTextures=Object.create(null),this._glSamplers=Object.create(null),this._boundSamplers=Object.create(null),this._premultiplyAlpha=!1;for(let t=0;t<16;t++)this.bind(k.EMPTY,t)}initSource(e){this.bind(e)}bind(e,t=0){let i=e.source;e?(this.bindSource(i,t),this._useSeparateSamplers&&this._bindSampler(i.style,t)):(this.bindSource(null,t),this._useSeparateSamplers&&this._bindSampler(null,t))}bindSource(e,t=0){let i=this._gl;if(e._touched=this._renderer.textureGC.count,this._boundTextures[t]!==e){this._boundTextures[t]=e,this._activateLocation(t),e||(e=k.EMPTY.source);let s=this.getGlSource(e);i.bindTexture(s.target,s.texture)}}_bindSampler(e,t=0){let i=this._gl;if(!e){this._boundSamplers[t]=null,i.bindSampler(t,null);return}let s=this._getGlSampler(e);this._boundSamplers[t]!==s&&(this._boundSamplers[t]=s,i.bindSampler(t,s))}unbind(e){let t=e.source,i=this._boundTextures,s=this._gl;for(let o=0;o1,this._renderer.context.extensions.anisotropicFiltering,"texParameteri",i.TEXTURE_2D,!this._renderer.context.supports.nonPowOf2wrapping&&!e.isPowerOfTwo,t)}onSourceUnload(e){let t=this._glTextures[e.uid];t&&(this.unbind(e),this._glTextures[e.uid]=null,this._gl.deleteTexture(t.texture))}onSourceUpdate(e){let t=this._gl,i=this.getGlSource(e);t.bindTexture(t.TEXTURE_2D,i.texture),this._boundTextures[this._activeTextureLocation]=e;let s=e.alphaMode==="premultiply-alpha-on-upload";this._premultiplyAlpha!==s&&(this._premultiplyAlpha=s,t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,s)),this._uploads[e.uploadMethodId]?this._uploads[e.uploadMethodId].upload(e,i,t,this._renderer.context.webGLVersion):t.texImage2D(t.TEXTURE_2D,0,t.RGBA,e.pixelWidth,e.pixelHeight,0,t.RGBA,t.UNSIGNED_BYTE,null),e.autoGenerateMipmaps&&e.mipLevelCount>1&&this.onUpdateMipmaps(e,!1)}onUpdateMipmaps(e,t=!0){t&&this.bindSource(e,0);let i=this.getGlSource(e);this._gl.generateMipmap(i.target)}onSourceDestroy(e){e.off("destroy",this.onSourceDestroy,this),e.off("update",this.onSourceUpdate,this),e.off("resize",this.onSourceUpdate,this),e.off("unload",this.onSourceUnload,this),e.off("styleChange",this.onStyleChange,this),e.off("updateMipmaps",this.onUpdateMipmaps,this),this.managedTextures.splice(this.managedTextures.indexOf(e),1),this.onSourceUnload(e)}_initSampler(e){let t=this._gl,i=this._gl.createSampler();return this._glSamplers[e._resourceId]=i,dy(e,t,this._boundTextures[this._activeTextureLocation].mipLevelCount>1,this._renderer.context.extensions.anisotropicFiltering,"samplerParameteri",i,!1,!0),this._glSamplers[e._resourceId]}_getGlSampler(e){return this._glSamplers[e._resourceId]||this._initSampler(e)}getGlSource(e){return this._glTextures[e.uid]||this._initSource(e)}generateCanvas(e){let{pixels:t,width:i,height:s}=this.getPixels(e),o=j.get().createCanvas();o.width=i,o.height=s;let n=o.getContext("2d");if(n){let a=n.createImageData(i,s);a.data.set(t),n.putImageData(a,0,0)}return o}getPixels(e){let t=e.source.resolution,i=e.frame,s=Math.max(Math.round(i.width*t),1),o=Math.max(Math.round(i.height*t),1),n=new Uint8Array(GU*s*o),a=this._renderer,l=a.renderTarget.getRenderTarget(e),c=a.renderTarget.getGpuRenderTarget(l),u=a.gl;return u.bindFramebuffer(u.FRAMEBUFFER,c.resolveTargetFramebuffer),u.readPixels(Math.round(i.x*t),Math.round(i.y*t),s,o,u.RGBA,u.UNSIGNED_BYTE,n),{pixels:new Uint8ClampedArray(n.buffer),width:s,height:o}}destroy(){this.managedTextures.slice().forEach(e=>this.onSourceDestroy(e)),this.managedTextures=null,this._renderer=null}resetState(){this._activeTextureLocation=-1,this._boundTextures.fill(k.EMPTY.source),this._boundSamplers=Object.create(null);let e=this._gl;this._premultiplyAlpha=!1,e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,this._premultiplyAlpha)}};rc.extension={type:[S.WebGLSystem],name:"texture"}});var CC={};Ub(CC,{WebGLRenderer:()=>fy});var LU,DU,NU,EC,AC,PC,fy,MC=y(()=>{U();sP();oP();nP();ll();Dx();jr();cP();dP();gP();_P();bP();vP();TP();CP();IP();qP();tC();nC();wC();LU=[...Jh,Ql,yP,hP,jl,rc,Jl,Yl,tc,ec,Kl,oC,Zl,ql],DU=[...ed],NU=[$l,zl,Wl],EC=[],AC=[],PC=[];V.handleByNamedList(S.WebGLSystem,EC);V.handleByNamedList(S.WebGLPipes,AC);V.handleByNamedList(S.WebGLPipesAdaptor,PC);V.add(...LU,...DU,...NU);fy=class extends qi{constructor(){let e={name:"webgl",type:ot.WEBGL,systems:EC,renderPipes:AC,renderPipeAdaptors:PC};super(e)}}});var xI=ee((y_e,u_)=>{"use strict";var eN=Object.prototype.hasOwnProperty,zt="~";function Ec(){}Object.create&&(Ec.prototype=Object.create(null),new Ec().__proto__||(zt=!1));function tN(r,e,t){this.fn=r,this.context=e,this.once=t||!1}function gI(r,e,t,i,s){if(typeof t!="function")throw new TypeError("The listener must be a function");var o=new tN(t,i||r,s),n=zt?zt+e:e;return r._events[n]?r._events[n].fn?r._events[n]=[r._events[n],o]:r._events[n].push(o):(r._events[n]=o,r._eventsCount++),r}function Nf(r,e){--r._eventsCount===0?r._events=new Ec:delete r._events[e]}function kt(){this._events=new Ec,this._eventsCount=0}kt.prototype.eventNames=function(){var e=[],t,i;if(this._eventsCount===0)return e;for(i in t=this._events)eN.call(t,i)&&e.push(zt?i.slice(1):i);return Object.getOwnPropertySymbols?e.concat(Object.getOwnPropertySymbols(t)):e};kt.prototype.listeners=function(e){var t=zt?zt+e:e,i=this._events[t];if(!i)return[];if(i.fn)return[i.fn];for(var s=0,o=i.length,n=new Array(o);s{(function(r){var e=typeof kn=="object"&&kn&&!kn.nodeType&&kn,t=typeof Fn=="object"&&Fn&&!Fn.nodeType&&Fn,i=typeof global=="object"&&global;(i.global===i||i.window===i||i.self===i)&&(r=i);var s,o=2147483647,n=36,a=1,l=26,c=38,u=700,h=72,d=128,f="-",p=/^xn--/,m=/[^\x20-\x7E]/,g=/[\x2E\u3002\uFF0E\uFF61]/g,_={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},v=n-a,x=Math.floor,T=String.fromCharCode,b;function w(N){throw new RangeError(_[N])}function E(N,L){for(var Y=N.length,ue=[];Y--;)ue[Y]=L(N[Y]);return ue}function I(N,L){var Y=N.split("@"),ue="";Y.length>1&&(ue=Y[0]+"@",N=Y[1]),N=N.replace(g,".");var J=N.split("."),Be=E(J,L).join(".");return ue+Be}function B(N){for(var L=[],Y=0,ue=N.length,J,Be;Y=55296&&J<=56319&&Y65535&&(L-=65536,Y+=T(L>>>10&1023|55296),L=56320|L&1023),Y+=T(L),Y}).join("")}function A(N){return N-48<10?N-22:N-65<26?N-65:N-97<26?N-97:n}function P(N,L){return N+22+75*(N<26)-((L!=0)<<5)}function R(N,L,Y){var ue=0;for(N=Y?x(N/u):N>>1,N+=x(N/L);N>v*l>>1;ue+=n)N=x(N/v);return x(ue+(v+1)*N/(N+c))}function M(N){var L=[],Y=N.length,ue,J=0,Be=d,ke=h,Me,$e,it,bt,Le,vt,Ft,Pt,Ot;for(Me=N.lastIndexOf(f),Me<0&&(Me=0),$e=0;$e=128&&w("not-basic"),L.push(N.charCodeAt($e));for(it=Me>0?Me+1:0;it=Y&&w("invalid-input"),Ft=A(N.charCodeAt(it++)),(Ft>=n||Ft>x((o-J)/Le))&&w("overflow"),J+=Ft*Le,Pt=vt<=ke?a:vt>=ke+l?l:vt-ke,!(Ftx(o/Ot)&&w("overflow"),Le*=Ot;ue=L.length+1,ke=R(J-bt,ue,bt==0),x(J/ue)>o-Be&&w("overflow"),Be+=x(J/ue),J%=ue,L.splice(J++,0,Be)}return C(L)}function F(N){var L,Y,ue,J,Be,ke,Me,$e,it,bt,Le,vt=[],Ft,Pt,Ot,Ar;for(N=B(N),Ft=N.length,L=d,Y=0,Be=h,ke=0;ke=L&&Lex((o-Y)/Pt)&&w("overflow"),Y+=(Me-L)*Pt,L=Me,ke=0;keo&&w("overflow"),Le==L){for($e=Y,it=n;bt=it<=Be?a:it>=Be+l?l:it-Be,!($e{"use strict";_I.exports=TypeError});var bI=ee(()=>{});var Rc=ee((T_e,NI)=>{var b_=typeof Map=="function"&&Map.prototype,h_=Object.getOwnPropertyDescriptor&&b_?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,Vf=b_&&h_&&typeof h_.get=="function"?h_.get:null,vI=b_&&Map.prototype.forEach,v_=typeof Set=="function"&&Set.prototype,d_=Object.getOwnPropertyDescriptor&&v_?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,Wf=v_&&d_&&typeof d_.get=="function"?d_.get:null,TI=v_&&Set.prototype.forEach,rN=typeof WeakMap=="function"&&WeakMap.prototype,Pc=rN?WeakMap.prototype.has:null,iN=typeof WeakSet=="function"&&WeakSet.prototype,Cc=iN?WeakSet.prototype.has:null,sN=typeof WeakRef=="function"&&WeakRef.prototype,SI=sN?WeakRef.prototype.deref:null,oN=Boolean.prototype.valueOf,nN=Object.prototype.toString,aN=Function.prototype.toString,lN=String.prototype.match,T_=String.prototype.slice,as=String.prototype.replace,cN=String.prototype.toUpperCase,wI=String.prototype.toLowerCase,kI=RegExp.prototype.test,EI=Array.prototype.concat,ti=Array.prototype.join,uN=Array.prototype.slice,AI=Math.floor,m_=typeof BigInt=="function"?BigInt.prototype.valueOf:null,f_=Object.getOwnPropertySymbols,g_=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Symbol.prototype.toString:null,On=typeof Symbol=="function"&&typeof Symbol.iterator=="object",Mc=typeof Symbol=="function"&&Symbol.toStringTag&&(typeof Symbol.toStringTag===On||!0)?Symbol.toStringTag:null,FI=Object.prototype.propertyIsEnumerable,PI=(typeof Reflect=="function"?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(r){return r.__proto__}:null);function CI(r,e){if(r===1/0||r===-1/0||r!==r||r&&r>-1e3&&r<1e3||kI.call(/e/,e))return e;var t=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if(typeof r=="number"){var i=r<0?-AI(-r):AI(r);if(i!==r){var s=String(i),o=T_.call(e,s.length+1);return as.call(s,t,"$&_")+"."+as.call(as.call(o,/([0-9]{3})/g,"$&_"),/_$/,"")}}return as.call(e,t,"$&_")}var x_=bI(),MI=x_.custom,RI=GI(MI)?MI:null,OI={__proto__:null,double:'"',single:"'"},hN={__proto__:null,double:/(["\\])/g,single:/(['\\])/g};NI.exports=function r(e,t,i,s){var o=t||{};if(Ei(o,"quoteStyle")&&!Ei(OI,o.quoteStyle))throw new TypeError('option "quoteStyle" must be "single" or "double"');if(Ei(o,"maxStringLength")&&(typeof o.maxStringLength=="number"?o.maxStringLength<0&&o.maxStringLength!==1/0:o.maxStringLength!==null))throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`');var n=Ei(o,"customInspect")?o.customInspect:!0;if(typeof n!="boolean"&&n!=="symbol")throw new TypeError("option \"customInspect\", if provided, must be `true`, `false`, or `'symbol'`");if(Ei(o,"indent")&&o.indent!==null&&o.indent!==" "&&!(parseInt(o.indent,10)===o.indent&&o.indent>0))throw new TypeError('option "indent" must be "\\t", an integer > 0, or `null`');if(Ei(o,"numericSeparator")&&typeof o.numericSeparator!="boolean")throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`');var a=o.numericSeparator;if(typeof e>"u")return"undefined";if(e===null)return"null";if(typeof e=="boolean")return e?"true":"false";if(typeof e=="string")return DI(e,o);if(typeof e=="number"){if(e===0)return 1/0/e>0?"0":"-0";var l=String(e);return a?CI(e,l):l}if(typeof e=="bigint"){var c=String(e)+"n";return a?CI(e,c):c}var u=typeof o.depth>"u"?5:o.depth;if(typeof i>"u"&&(i=0),i>=u&&u>0&&typeof e=="object")return y_(e)?"[Array]":"[Object]";var h=MN(o,i);if(typeof s>"u")s=[];else if(LI(s,e)>=0)return"[Circular]";function d(R,M,F){if(M&&(s=uN.call(s),s.push(M)),F){var O={depth:o.depth};return Ei(o,"quoteStyle")&&(O.quoteStyle=o.quoteStyle),r(R,O,i+1,s)}return r(R,o,i+1,s)}if(typeof e=="function"&&!II(e)){var f=bN(e),p=Hf(e,d);return"[Function"+(f?": "+f:" (anonymous)")+"]"+(p.length>0?" { "+ti.call(p,", ")+" }":"")}if(GI(e)){var m=On?as.call(String(e),/^(Symbol\(.*\))_[^)]*$/,"$1"):g_.call(e);return typeof e=="object"&&!On?Ac(m):m}if(AN(e)){for(var g="<"+wI.call(String(e.nodeName)),_=e.attributes||[],v=0;v<_.length;v++)g+=" "+_[v].name+"="+UI(dN(_[v].value),"double",o);return g+=">",e.childNodes&&e.childNodes.length&&(g+="..."),g+="",g}if(y_(e)){if(e.length===0)return"[]";var x=Hf(e,d);return h&&!CN(x)?"["+__(x,h)+"]":"[ "+ti.call(x,", ")+" ]"}if(pN(e)){var T=Hf(e,d);return!("cause"in Error.prototype)&&"cause"in e&&!FI.call(e,"cause")?"{ ["+String(e)+"] "+ti.call(EI.call("[cause]: "+d(e.cause),T),", ")+" }":T.length===0?"["+String(e)+"]":"{ ["+String(e)+"] "+ti.call(T,", ")+" }"}if(typeof e=="object"&&n){if(RI&&typeof e[RI]=="function"&&x_)return x_(e,{depth:u-i});if(n!=="symbol"&&typeof e.inspect=="function")return e.inspect()}if(vN(e)){var b=[];return vI&&vI.call(e,function(R,M){b.push(d(M,e,!0)+" => "+d(R,e))}),BI("Map",Vf.call(e),b,h)}if(wN(e)){var w=[];return TI&&TI.call(e,function(R){w.push(d(R,e))}),BI("Set",Wf.call(e),w,h)}if(TN(e))return p_("WeakMap");if(EN(e))return p_("WeakSet");if(SN(e))return p_("WeakRef");if(gN(e))return Ac(d(Number(e)));if(yN(e))return Ac(d(m_.call(e)));if(xN(e))return Ac(oN.call(e));if(mN(e))return Ac(d(String(e)));if(typeof window<"u"&&e===window)return"{ [object Window] }";if(typeof globalThis<"u"&&e===globalThis||typeof global<"u"&&e===global)return"{ [object globalThis] }";if(!fN(e)&&!II(e)){var E=Hf(e,d),I=PI?PI(e)===Object.prototype:e instanceof Object||e.constructor===Object,B=e instanceof Object?"":"null prototype",C=!I&&Mc&&Object(e)===e&&Mc in e?T_.call(ls(e),8,-1):B?"Object":"",A=I||typeof e.constructor!="function"?"":e.constructor.name?e.constructor.name+" ":"",P=A+(C||B?"["+ti.call(EI.call([],C||[],B||[]),": ")+"] ":"");return E.length===0?P+"{}":h?P+"{"+__(E,h)+"}":P+"{ "+ti.call(E,", ")+" }"}return String(e)};function UI(r,e,t){var i=t.quoteStyle||e,s=OI[i];return s+r+s}function dN(r){return as.call(String(r),/"/g,""")}function Xs(r){return!Mc||!(typeof r=="object"&&(Mc in r||typeof r[Mc]<"u"))}function y_(r){return ls(r)==="[object Array]"&&Xs(r)}function fN(r){return ls(r)==="[object Date]"&&Xs(r)}function II(r){return ls(r)==="[object RegExp]"&&Xs(r)}function pN(r){return ls(r)==="[object Error]"&&Xs(r)}function mN(r){return ls(r)==="[object String]"&&Xs(r)}function gN(r){return ls(r)==="[object Number]"&&Xs(r)}function xN(r){return ls(r)==="[object Boolean]"&&Xs(r)}function GI(r){if(On)return r&&typeof r=="object"&&r instanceof Symbol;if(typeof r=="symbol")return!0;if(!r||typeof r!="object"||!g_)return!1;try{return g_.call(r),!0}catch{}return!1}function yN(r){if(!r||typeof r!="object"||!m_)return!1;try{return m_.call(r),!0}catch{}return!1}var _N=Object.prototype.hasOwnProperty||function(r){return r in this};function Ei(r,e){return _N.call(r,e)}function ls(r){return nN.call(r)}function bN(r){if(r.name)return r.name;var e=lN.call(aN.call(r),/^function\s*([\w$]+)/);return e?e[1]:null}function LI(r,e){if(r.indexOf)return r.indexOf(e);for(var t=0,i=r.length;te.maxStringLength){var t=r.length-e.maxStringLength,i="... "+t+" more character"+(t>1?"s":"");return DI(T_.call(r,0,e.maxStringLength),e)+i}var s=hN[e.quoteStyle||"single"];s.lastIndex=0;var o=as.call(as.call(r,s,"\\$1"),/[\x00-\x1f]/g,PN);return UI(o,"single",e)}function PN(r){var e=r.charCodeAt(0),t={8:"b",9:"t",10:"n",12:"f",13:"r"}[e];return t?"\\"+t:"\\x"+(e<16?"0":"")+cN.call(e.toString(16))}function Ac(r){return"Object("+r+")"}function p_(r){return r+" { ? }"}function BI(r,e,t,i){var s=i?__(t,i):ti.call(t,", ");return r+" ("+e+") {"+s+"}"}function CN(r){for(var e=0;e{rd();It();Vx();QP()});var tc,tC=y(()=>{U();eC();tc=class{constructor(e){this._cache={},this._uniformGroupSyncHash={},this._renderer=e,this.gl=null,this._cache={}}contextChange(e){this.gl=e}updateUniformGroup(e,t,i){let s=this._renderer.shader._getProgramData(t);(!e.isStatic||e._dirtyId!==s.uniformDirtyGroups[e.uid])&&(s.uniformDirtyGroups[e.uid]=e._dirtyId,this._getUniformSyncFunction(e,t)(s.uniformData,e.uniforms,this._renderer,i))}_getUniformSyncFunction(e,t){return this._uniformGroupSyncHash[e._signature]?.[t._key]||this._createUniformSyncFunction(e,t)}_createUniformSyncFunction(e,t){let i=this._uniformGroupSyncHash[e._signature]||(this._uniformGroupSyncHash[e._signature]={}),s=this._getSignature(e,t._uniformData,"u");return this._cache[s]||(this._cache[s]=this._generateUniformsSync(e,t._uniformData)),i[t._key]=this._cache[s],i[t._key]}_generateUniformsSync(e,t){return JP(e,t)}_getSignature(e,t,i){let s=e.uniforms,o=[`${i}-`];for(let n in s)o.push(n),t[n]&&o.push(t[n].type);return o.join("-")}destroy(){this._renderer=null,this._cache=null}};tc.extension={type:[S.WebGLSystem],name:"uniformGroup"}});function rC(r){let e={};if(e.normal=[r.ONE,r.ONE_MINUS_SRC_ALPHA],e.add=[r.ONE,r.ONE],e.multiply=[r.DST_COLOR,r.ONE_MINUS_SRC_ALPHA,r.ONE,r.ONE_MINUS_SRC_ALPHA],e.screen=[r.ONE,r.ONE_MINUS_SRC_COLOR,r.ONE,r.ONE_MINUS_SRC_ALPHA],e.none=[0,0],e["normal-npm"]=[r.SRC_ALPHA,r.ONE_MINUS_SRC_ALPHA,r.ONE,r.ONE_MINUS_SRC_ALPHA],e["add-npm"]=[r.SRC_ALPHA,r.ONE,r.ONE,r.ONE],e["screen-npm"]=[r.SRC_ALPHA,r.ONE_MINUS_SRC_COLOR,r.ONE,r.ONE_MINUS_SRC_ALPHA],e.erase=[r.ZERO,r.ONE_MINUS_SRC_ALPHA],!(r instanceof j.get().getWebGLRenderingContext()))e.min=[r.ONE,r.ONE,r.ONE,r.ONE,r.MIN,r.MIN],e.max=[r.ONE,r.ONE,r.ONE,r.ONE,r.MAX,r.MAX];else{let i=r.getExtension("EXT_blend_minmax");i&&(e.min=[r.ONE,r.ONE,r.ONE,r.ONE,i.MIN_EXT,i.MIN_EXT],e.max=[r.ONE,r.ONE,r.ONE,r.ONE,i.MAX_EXT,i.MAX_EXT])}return e}var iC=y(()=>{Re()});var RU,IU,BU,kU,FU,OU,sC,oC,nC=y(()=>{U();Rr();iC();RU=0,IU=1,BU=2,kU=3,FU=4,OU=5,sC=class cy{constructor(e){this._invertFrontFace=!1,this.gl=null,this.stateId=0,this.polygonOffset=0,this.blendMode="none",this._blendEq=!1,this.map=[],this.map[RU]=this.setBlend,this.map[IU]=this.setOffset,this.map[BU]=this.setCullFace,this.map[kU]=this.setDepthTest,this.map[FU]=this.setFrontFace,this.map[OU]=this.setDepthMask,this.checks=[],this.defaultState=Je.for2d(),e.renderTarget.onRenderTargetChange.add(this)}onRenderTargetChange(e){this._invertFrontFace=!e.isRoot,this._cullFace?this.setFrontFace(this._frontFace):this._frontFaceDirty=!0}contextChange(e){this.gl=e,this.blendModesMap=rC(e),this.resetState()}set(e){if(e||(e=this.defaultState),this.stateId!==e.data){let t=this.stateId^e.data,i=0;for(;t;)t&1&&this.map[i].call(this,!!(e.data&1<>=1,i++;this.stateId=e.data}for(let t=0;t{ey();xd=class{constructor(e){this.target=Jx.TEXTURE_2D,this.texture=e,this.width=-1,this.height=-1,this.type=ye.UNSIGNED_BYTE,this.internalFormat=ud.RGBA,this.format=ud.RGBA,this.samplerType=0}}});var lC,cC=y(()=>{"use strict";lC={id:"buffer",upload(r,e,t){e.width===r.width||e.height===r.height?t.texSubImage2D(t.TEXTURE_2D,0,0,0,r.width,r.height,e.format,e.type,r.resource):t.texImage2D(e.target,0,e.internalFormat,r.width,r.height,0,e.format,e.type,r.resource),e.width=r.width,e.height=r.height}}});var UU,uC,hC=y(()=>{"use strict";UU={"bc1-rgba-unorm":!0,"bc1-rgba-unorm-srgb":!0,"bc2-rgba-unorm":!0,"bc2-rgba-unorm-srgb":!0,"bc3-rgba-unorm":!0,"bc3-rgba-unorm-srgb":!0,"bc4-r-unorm":!0,"bc4-r-snorm":!0,"bc5-rg-unorm":!0,"bc5-rg-snorm":!0,"bc6h-rgb-ufloat":!0,"bc6h-rgb-float":!0,"bc7-rgba-unorm":!0,"bc7-rgba-unorm-srgb":!0,"etc2-rgb8unorm":!0,"etc2-rgb8unorm-srgb":!0,"etc2-rgb8a1unorm":!0,"etc2-rgb8a1unorm-srgb":!0,"etc2-rgba8unorm":!0,"etc2-rgba8unorm-srgb":!0,"eac-r11unorm":!0,"eac-r11snorm":!0,"eac-rg11unorm":!0,"eac-rg11snorm":!0,"astc-4x4-unorm":!0,"astc-4x4-unorm-srgb":!0,"astc-5x4-unorm":!0,"astc-5x4-unorm-srgb":!0,"astc-5x5-unorm":!0,"astc-5x5-unorm-srgb":!0,"astc-6x5-unorm":!0,"astc-6x5-unorm-srgb":!0,"astc-6x6-unorm":!0,"astc-6x6-unorm-srgb":!0,"astc-8x5-unorm":!0,"astc-8x5-unorm-srgb":!0,"astc-8x6-unorm":!0,"astc-8x6-unorm-srgb":!0,"astc-8x8-unorm":!0,"astc-8x8-unorm-srgb":!0,"astc-10x5-unorm":!0,"astc-10x5-unorm-srgb":!0,"astc-10x6-unorm":!0,"astc-10x6-unorm-srgb":!0,"astc-10x8-unorm":!0,"astc-10x8-unorm-srgb":!0,"astc-10x10-unorm":!0,"astc-10x10-unorm-srgb":!0,"astc-12x10-unorm":!0,"astc-12x10-unorm-srgb":!0,"astc-12x12-unorm":!0,"astc-12x12-unorm-srgb":!0},uC={id:"compressed",upload(r,e,t){t.pixelStorei(t.UNPACK_ALIGNMENT,4);let i=r.pixelWidth,s=r.pixelHeight,o=!!UU[r.format];for(let n=0;n>1,1),s=Math.max(s>>1,1)}}}});var yd,uy=y(()=>{"use strict";yd={id:"image",upload(r,e,t,i){let s=e.width,o=e.height,n=r.pixelWidth,a=r.pixelHeight,l=r.resourceWidth,c=r.resourceHeight;l{uy();dC={id:"video",upload(r,e,t,i){if(!r.isValid){t.texImage2D(e.target,0,e.internalFormat,1,1,0,e.format,e.type,null);return}yd.upload(r,e,t,i)}}});var hy,pC,_d,mC,gC=y(()=>{"use strict";hy={linear:9729,nearest:9728},pC={linear:{linear:9987,nearest:9985},nearest:{linear:9986,nearest:9984}},_d={"clamp-to-edge":33071,repeat:10497,"mirror-repeat":33648},mC={never:512,less:513,equal:514,"less-equal":515,greater:516,"not-equal":517,"greater-equal":518,always:519}});function dy(r,e,t,i,s,o,n,a){let l=o;if(!a||r.addressModeU!=="repeat"||r.addressModeV!=="repeat"||r.addressModeW!=="repeat"){let c=_d[n?"clamp-to-edge":r.addressModeU],u=_d[n?"clamp-to-edge":r.addressModeV],h=_d[n?"clamp-to-edge":r.addressModeW];e[s](l,e.TEXTURE_WRAP_S,c),e[s](l,e.TEXTURE_WRAP_T,u),e.TEXTURE_WRAP_R&&e[s](l,e.TEXTURE_WRAP_R,h)}if((!a||r.magFilter!=="linear")&&e[s](l,e.TEXTURE_MAG_FILTER,hy[r.magFilter]),t){if(!a||r.mipmapFilter!=="linear"){let c=pC[r.minFilter][r.mipmapFilter];e[s](l,e.TEXTURE_MIN_FILTER,c)}}else e[s](l,e.TEXTURE_MIN_FILTER,hy[r.minFilter]);if(i&&r.maxAnisotropy>1){let c=Math.min(r.maxAnisotropy,e.getParameter(i.MAX_TEXTURE_MAX_ANISOTROPY_EXT));e[s](l,i.TEXTURE_MAX_ANISOTROPY_EXT,c)}r.compare&&e[s](l,e.TEXTURE_COMPARE_FUNC,mC[r.compare])}var xC=y(()=>{gC()});function yC(r){return{r8unorm:r.RED,r8snorm:r.RED,r8uint:r.RED,r8sint:r.RED,r16uint:r.RED,r16sint:r.RED,r16float:r.RED,rg8unorm:r.RG,rg8snorm:r.RG,rg8uint:r.RG,rg8sint:r.RG,r32uint:r.RED,r32sint:r.RED,r32float:r.RED,rg16uint:r.RG,rg16sint:r.RG,rg16float:r.RG,rgba8unorm:r.RGBA,"rgba8unorm-srgb":r.RGBA,rgba8snorm:r.RGBA,rgba8uint:r.RGBA,rgba8sint:r.RGBA,bgra8unorm:r.RGBA,"bgra8unorm-srgb":r.RGBA,rgb9e5ufloat:r.RGB,rgb10a2unorm:r.RGBA,rg11b10ufloat:r.RGB,rg32uint:r.RG,rg32sint:r.RG,rg32float:r.RG,rgba16uint:r.RGBA,rgba16sint:r.RGBA,rgba16float:r.RGBA,rgba32uint:r.RGBA,rgba32sint:r.RGBA,rgba32float:r.RGBA,stencil8:r.STENCIL_INDEX8,depth16unorm:r.DEPTH_COMPONENT,depth24plus:r.DEPTH_COMPONENT,"depth24plus-stencil8":r.DEPTH_STENCIL,depth32float:r.DEPTH_COMPONENT,"depth32float-stencil8":r.DEPTH_STENCIL}}var _C=y(()=>{"use strict"});function bC(r,e){let t={},i=r.RGBA;return r instanceof j.get().getWebGLRenderingContext()?e.srgb&&(t={"rgba8unorm-srgb":e.srgb.SRGB8_ALPHA8_EXT,"bgra8unorm-srgb":e.srgb.SRGB8_ALPHA8_EXT}):(t={"rgba8unorm-srgb":r.SRGB8_ALPHA8,"bgra8unorm-srgb":r.SRGB8_ALPHA8},i=r.RGBA8),{r8unorm:r.R8,r8snorm:r.R8_SNORM,r8uint:r.R8UI,r8sint:r.R8I,r16uint:r.R16UI,r16sint:r.R16I,r16float:r.R16F,rg8unorm:r.RG8,rg8snorm:r.RG8_SNORM,rg8uint:r.RG8UI,rg8sint:r.RG8I,r32uint:r.R32UI,r32sint:r.R32I,r32float:r.R32F,rg16uint:r.RG16UI,rg16sint:r.RG16I,rg16float:r.RG16F,rgba8unorm:r.RGBA,...t,rgba8snorm:r.RGBA8_SNORM,rgba8uint:r.RGBA8UI,rgba8sint:r.RGBA8I,bgra8unorm:i,rgb9e5ufloat:r.RGB9_E5,rgb10a2unorm:r.RGB10_A2,rg11b10ufloat:r.R11F_G11F_B10F,rg32uint:r.RG32UI,rg32sint:r.RG32I,rg32float:r.RG32F,rgba16uint:r.RGBA16UI,rgba16sint:r.RGBA16I,rgba16float:r.RGBA16F,rgba32uint:r.RGBA32UI,rgba32sint:r.RGBA32I,rgba32float:r.RGBA32F,stencil8:r.STENCIL_INDEX8,depth16unorm:r.DEPTH_COMPONENT16,depth24plus:r.DEPTH_COMPONENT24,"depth24plus-stencil8":r.DEPTH24_STENCIL8,depth32float:r.DEPTH_COMPONENT32F,"depth32float-stencil8":r.DEPTH32F_STENCIL8,...e.s3tc?{"bc1-rgba-unorm":e.s3tc.COMPRESSED_RGBA_S3TC_DXT1_EXT,"bc2-rgba-unorm":e.s3tc.COMPRESSED_RGBA_S3TC_DXT3_EXT,"bc3-rgba-unorm":e.s3tc.COMPRESSED_RGBA_S3TC_DXT5_EXT}:{},...e.s3tc_sRGB?{"bc1-rgba-unorm-srgb":e.s3tc_sRGB.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT,"bc2-rgba-unorm-srgb":e.s3tc_sRGB.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT,"bc3-rgba-unorm-srgb":e.s3tc_sRGB.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}:{},...e.rgtc?{"bc4-r-unorm":e.rgtc.COMPRESSED_RED_RGTC1_EXT,"bc4-r-snorm":e.rgtc.COMPRESSED_SIGNED_RED_RGTC1_EXT,"bc5-rg-unorm":e.rgtc.COMPRESSED_RED_GREEN_RGTC2_EXT,"bc5-rg-snorm":e.rgtc.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}:{},...e.bptc?{"bc6h-rgb-float":e.bptc.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT,"bc6h-rgb-ufloat":e.bptc.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT,"bc7-rgba-unorm":e.bptc.COMPRESSED_RGBA_BPTC_UNORM_EXT,"bc7-rgba-unorm-srgb":e.bptc.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT}:{},...e.etc?{"etc2-rgb8unorm":e.etc.COMPRESSED_RGB8_ETC2,"etc2-rgb8unorm-srgb":e.etc.COMPRESSED_SRGB8_ETC2,"etc2-rgb8a1unorm":e.etc.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2,"etc2-rgb8a1unorm-srgb":e.etc.COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2,"etc2-rgba8unorm":e.etc.COMPRESSED_RGBA8_ETC2_EAC,"etc2-rgba8unorm-srgb":e.etc.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC,"eac-r11unorm":e.etc.COMPRESSED_R11_EAC,"eac-rg11unorm":e.etc.COMPRESSED_SIGNED_RG11_EAC}:{},...e.astc?{"astc-4x4-unorm":e.astc.COMPRESSED_RGBA_ASTC_4x4_KHR,"astc-4x4-unorm-srgb":e.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR,"astc-5x4-unorm":e.astc.COMPRESSED_RGBA_ASTC_5x4_KHR,"astc-5x4-unorm-srgb":e.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR,"astc-5x5-unorm":e.astc.COMPRESSED_RGBA_ASTC_5x5_KHR,"astc-5x5-unorm-srgb":e.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR,"astc-6x5-unorm":e.astc.COMPRESSED_RGBA_ASTC_6x5_KHR,"astc-6x5-unorm-srgb":e.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR,"astc-6x6-unorm":e.astc.COMPRESSED_RGBA_ASTC_6x6_KHR,"astc-6x6-unorm-srgb":e.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR,"astc-8x5-unorm":e.astc.COMPRESSED_RGBA_ASTC_8x5_KHR,"astc-8x5-unorm-srgb":e.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR,"astc-8x6-unorm":e.astc.COMPRESSED_RGBA_ASTC_8x6_KHR,"astc-8x6-unorm-srgb":e.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR,"astc-8x8-unorm":e.astc.COMPRESSED_RGBA_ASTC_8x8_KHR,"astc-8x8-unorm-srgb":e.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR,"astc-10x5-unorm":e.astc.COMPRESSED_RGBA_ASTC_10x5_KHR,"astc-10x5-unorm-srgb":e.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR,"astc-10x6-unorm":e.astc.COMPRESSED_RGBA_ASTC_10x6_KHR,"astc-10x6-unorm-srgb":e.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR,"astc-10x8-unorm":e.astc.COMPRESSED_RGBA_ASTC_10x8_KHR,"astc-10x8-unorm-srgb":e.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR,"astc-10x10-unorm":e.astc.COMPRESSED_RGBA_ASTC_10x10_KHR,"astc-10x10-unorm-srgb":e.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR,"astc-12x10-unorm":e.astc.COMPRESSED_RGBA_ASTC_12x10_KHR,"astc-12x10-unorm-srgb":e.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR,"astc-12x12-unorm":e.astc.COMPRESSED_RGBA_ASTC_12x12_KHR,"astc-12x12-unorm-srgb":e.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR}:{}}}var vC=y(()=>{Re()});function TC(r){return{r8unorm:r.UNSIGNED_BYTE,r8snorm:r.BYTE,r8uint:r.UNSIGNED_BYTE,r8sint:r.BYTE,r16uint:r.UNSIGNED_SHORT,r16sint:r.SHORT,r16float:r.HALF_FLOAT,rg8unorm:r.UNSIGNED_BYTE,rg8snorm:r.BYTE,rg8uint:r.UNSIGNED_BYTE,rg8sint:r.BYTE,r32uint:r.UNSIGNED_INT,r32sint:r.INT,r32float:r.FLOAT,rg16uint:r.UNSIGNED_SHORT,rg16sint:r.SHORT,rg16float:r.HALF_FLOAT,rgba8unorm:r.UNSIGNED_BYTE,"rgba8unorm-srgb":r.UNSIGNED_BYTE,rgba8snorm:r.BYTE,rgba8uint:r.UNSIGNED_BYTE,rgba8sint:r.BYTE,bgra8unorm:r.UNSIGNED_BYTE,"bgra8unorm-srgb":r.UNSIGNED_BYTE,rgb9e5ufloat:r.UNSIGNED_INT_5_9_9_9_REV,rgb10a2unorm:r.UNSIGNED_INT_2_10_10_10_REV,rg11b10ufloat:r.UNSIGNED_INT_10F_11F_11F_REV,rg32uint:r.UNSIGNED_INT,rg32sint:r.INT,rg32float:r.FLOAT,rgba16uint:r.UNSIGNED_SHORT,rgba16sint:r.SHORT,rgba16float:r.HALF_FLOAT,rgba32uint:r.UNSIGNED_INT,rgba32sint:r.INT,rgba32float:r.FLOAT,stencil8:r.UNSIGNED_BYTE,depth16unorm:r.UNSIGNED_SHORT,depth24plus:r.UNSIGNED_INT,"depth24plus-stencil8":r.UNSIGNED_INT_24_8,depth32float:r.FLOAT,"depth32float-stencil8":r.FLOAT_32_UNSIGNED_INT_24_8_REV}}var SC=y(()=>{"use strict"});var GU,rc,wC=y(()=>{Re();U();ve();aC();cC();hC();uy();fC();xC();_C();vC();SC();GU=4,rc=class{constructor(e){this.managedTextures=[],this._glTextures=Object.create(null),this._glSamplers=Object.create(null),this._boundTextures=[],this._activeTextureLocation=-1,this._boundSamplers=Object.create(null),this._uploads={image:yd,buffer:lC,video:dC,compressed:uC},this._premultiplyAlpha=!1,this._useSeparateSamplers=!1,this._renderer=e,this._renderer.renderableGC.addManagedHash(this,"_glTextures"),this._renderer.renderableGC.addManagedHash(this,"_glSamplers")}contextChange(e){this._gl=e,this._mapFormatToInternalFormat||(this._mapFormatToInternalFormat=bC(e,this._renderer.context.extensions),this._mapFormatToType=TC(e),this._mapFormatToFormat=yC(e)),this._glTextures=Object.create(null),this._glSamplers=Object.create(null),this._boundSamplers=Object.create(null),this._premultiplyAlpha=!1;for(let t=0;t<16;t++)this.bind(k.EMPTY,t)}initSource(e){this.bind(e)}bind(e,t=0){let i=e.source;e?(this.bindSource(i,t),this._useSeparateSamplers&&this._bindSampler(i.style,t)):(this.bindSource(null,t),this._useSeparateSamplers&&this._bindSampler(null,t))}bindSource(e,t=0){let i=this._gl;if(e._touched=this._renderer.textureGC.count,this._boundTextures[t]!==e){this._boundTextures[t]=e,this._activateLocation(t),e||(e=k.EMPTY.source);let s=this.getGlSource(e);i.bindTexture(s.target,s.texture)}}_bindSampler(e,t=0){let i=this._gl;if(!e){this._boundSamplers[t]=null,i.bindSampler(t,null);return}let s=this._getGlSampler(e);this._boundSamplers[t]!==s&&(this._boundSamplers[t]=s,i.bindSampler(t,s))}unbind(e){let t=e.source,i=this._boundTextures,s=this._gl;for(let o=0;o1,this._renderer.context.extensions.anisotropicFiltering,"texParameteri",i.TEXTURE_2D,!this._renderer.context.supports.nonPowOf2wrapping&&!e.isPowerOfTwo,t)}onSourceUnload(e){let t=this._glTextures[e.uid];t&&(this.unbind(e),this._glTextures[e.uid]=null,this._gl.deleteTexture(t.texture))}onSourceUpdate(e){let t=this._gl,i=this.getGlSource(e);t.bindTexture(t.TEXTURE_2D,i.texture),this._boundTextures[this._activeTextureLocation]=e;let s=e.alphaMode==="premultiply-alpha-on-upload";this._premultiplyAlpha!==s&&(this._premultiplyAlpha=s,t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,s)),this._uploads[e.uploadMethodId]?this._uploads[e.uploadMethodId].upload(e,i,t,this._renderer.context.webGLVersion):t.texImage2D(t.TEXTURE_2D,0,t.RGBA,e.pixelWidth,e.pixelHeight,0,t.RGBA,t.UNSIGNED_BYTE,null),e.autoGenerateMipmaps&&e.mipLevelCount>1&&this.onUpdateMipmaps(e,!1)}onUpdateMipmaps(e,t=!0){t&&this.bindSource(e,0);let i=this.getGlSource(e);this._gl.generateMipmap(i.target)}onSourceDestroy(e){e.off("destroy",this.onSourceDestroy,this),e.off("update",this.onSourceUpdate,this),e.off("resize",this.onSourceUpdate,this),e.off("unload",this.onSourceUnload,this),e.off("styleChange",this.onStyleChange,this),e.off("updateMipmaps",this.onUpdateMipmaps,this),this.managedTextures.splice(this.managedTextures.indexOf(e),1),this.onSourceUnload(e)}_initSampler(e){let t=this._gl,i=this._gl.createSampler();return this._glSamplers[e._resourceId]=i,dy(e,t,this._boundTextures[this._activeTextureLocation].mipLevelCount>1,this._renderer.context.extensions.anisotropicFiltering,"samplerParameteri",i,!1,!0),this._glSamplers[e._resourceId]}_getGlSampler(e){return this._glSamplers[e._resourceId]||this._initSampler(e)}getGlSource(e){return this._glTextures[e.uid]||this._initSource(e)}generateCanvas(e){let{pixels:t,width:i,height:s}=this.getPixels(e),o=j.get().createCanvas();o.width=i,o.height=s;let n=o.getContext("2d");if(n){let a=n.createImageData(i,s);a.data.set(t),n.putImageData(a,0,0)}return o}getPixels(e){let t=e.source.resolution,i=e.frame,s=Math.max(Math.round(i.width*t),1),o=Math.max(Math.round(i.height*t),1),n=new Uint8Array(GU*s*o),a=this._renderer,l=a.renderTarget.getRenderTarget(e),c=a.renderTarget.getGpuRenderTarget(l),u=a.gl;return u.bindFramebuffer(u.FRAMEBUFFER,c.resolveTargetFramebuffer),u.readPixels(Math.round(i.x*t),Math.round(i.y*t),s,o,u.RGBA,u.UNSIGNED_BYTE,n),{pixels:new Uint8ClampedArray(n.buffer),width:s,height:o}}destroy(){this.managedTextures.slice().forEach(e=>this.onSourceDestroy(e)),this.managedTextures=null,this._renderer=null}resetState(){this._activeTextureLocation=-1,this._boundTextures.fill(k.EMPTY.source),this._boundSamplers=Object.create(null);let e=this._gl;this._premultiplyAlpha=!1,e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,this._premultiplyAlpha)}};rc.extension={type:[S.WebGLSystem],name:"texture"}});var CC={};Ub(CC,{WebGLRenderer:()=>fy});var LU,DU,NU,EC,AC,PC,fy,MC=y(()=>{U();sP();oP();nP();ll();Dx();jr();cP();dP();gP();_P();bP();vP();TP();CP();IP();qP();tC();nC();wC();LU=[...Jh,Ql,yP,hP,jl,rc,Jl,Yl,tc,ec,Kl,oC,Zl,ql],DU=[...ed],NU=[$l,zl,Wl],EC=[],AC=[],PC=[];V.handleByNamedList(S.WebGLSystem,EC);V.handleByNamedList(S.WebGLPipes,AC);V.handleByNamedList(S.WebGLPipesAdaptor,PC);V.add(...LU,...DU,...NU);fy=class extends qi{constructor(){let e={name:"webgl",type:ot.WEBGL,systems:EC,renderPipes:AC,renderPipeAdaptors:PC};super(e)}}});var xI=ee((y_e,u_)=>{"use strict";var eN=Object.prototype.hasOwnProperty,zt="~";function Ec(){}Object.create&&(Ec.prototype=Object.create(null),new Ec().__proto__||(zt=!1));function tN(r,e,t){this.fn=r,this.context=e,this.once=t||!1}function gI(r,e,t,i,s){if(typeof t!="function")throw new TypeError("The listener must be a function");var o=new tN(t,i||r,s),n=zt?zt+e:e;return r._events[n]?r._events[n].fn?r._events[n]=[r._events[n],o]:r._events[n].push(o):(r._events[n]=o,r._eventsCount++),r}function Nf(r,e){--r._eventsCount===0?r._events=new Ec:delete r._events[e]}function kt(){this._events=new Ec,this._eventsCount=0}kt.prototype.eventNames=function(){var e=[],t,i;if(this._eventsCount===0)return e;for(i in t=this._events)eN.call(t,i)&&e.push(zt?i.slice(1):i);return Object.getOwnPropertySymbols?e.concat(Object.getOwnPropertySymbols(t)):e};kt.prototype.listeners=function(e){var t=zt?zt+e:e,i=this._events[t];if(!i)return[];if(i.fn)return[i.fn];for(var s=0,o=i.length,n=new Array(o);s{(function(r){var e=typeof kn=="object"&&kn&&!kn.nodeType&&kn,t=typeof Fn=="object"&&Fn&&!Fn.nodeType&&Fn,i=typeof global=="object"&&global;(i.global===i||i.window===i||i.self===i)&&(r=i);var s,o=2147483647,n=36,a=1,l=26,c=38,u=700,h=72,d=128,f="-",p=/^xn--/,m=/[^\x20-\x7E]/,g=/[\x2E\u3002\uFF0E\uFF61]/g,_={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},v=n-a,x=Math.floor,T=String.fromCharCode,b;function E(N){throw new RangeError(_[N])}function w(N,L){for(var Y=N.length,ue=[];Y--;)ue[Y]=L(N[Y]);return ue}function I(N,L){var Y=N.split("@"),ue="";Y.length>1&&(ue=Y[0]+"@",N=Y[1]),N=N.replace(g,".");var J=N.split("."),Be=w(J,L).join(".");return ue+Be}function B(N){for(var L=[],Y=0,ue=N.length,J,Be;Y=55296&&J<=56319&&Y65535&&(L-=65536,Y+=T(L>>>10&1023|55296),L=56320|L&1023),Y+=T(L),Y}).join("")}function A(N){return N-48<10?N-22:N-65<26?N-65:N-97<26?N-97:n}function P(N,L){return N+22+75*(N<26)-((L!=0)<<5)}function R(N,L,Y){var ue=0;for(N=Y?x(N/u):N>>1,N+=x(N/L);N>v*l>>1;ue+=n)N=x(N/v);return x(ue+(v+1)*N/(N+c))}function M(N){var L=[],Y=N.length,ue,J=0,Be=d,ke=h,Me,$e,it,bt,Le,vt,Ft,Pt,Ot;for(Me=N.lastIndexOf(f),Me<0&&(Me=0),$e=0;$e=128&&E("not-basic"),L.push(N.charCodeAt($e));for(it=Me>0?Me+1:0;it=Y&&E("invalid-input"),Ft=A(N.charCodeAt(it++)),(Ft>=n||Ft>x((o-J)/Le))&&E("overflow"),J+=Ft*Le,Pt=vt<=ke?a:vt>=ke+l?l:vt-ke,!(Ftx(o/Ot)&&E("overflow"),Le*=Ot;ue=L.length+1,ke=R(J-bt,ue,bt==0),x(J/ue)>o-Be&&E("overflow"),Be+=x(J/ue),J%=ue,L.splice(J++,0,Be)}return C(L)}function F(N){var L,Y,ue,J,Be,ke,Me,$e,it,bt,Le,vt=[],Ft,Pt,Ot,Ar;for(N=B(N),Ft=N.length,L=d,Y=0,Be=h,ke=0;ke=L&&Lex((o-Y)/Pt)&&E("overflow"),Y+=(Me-L)*Pt,L=Me,ke=0;keo&&E("overflow"),Le==L){for($e=Y,it=n;bt=it<=Be?a:it>=Be+l?l:it-Be,!($e{"use strict";_I.exports=TypeError});var bI=ee(()=>{});var Rc=ee((T_e,NI)=>{var b_=typeof Map=="function"&&Map.prototype,h_=Object.getOwnPropertyDescriptor&&b_?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,Vf=b_&&h_&&typeof h_.get=="function"?h_.get:null,vI=b_&&Map.prototype.forEach,v_=typeof Set=="function"&&Set.prototype,d_=Object.getOwnPropertyDescriptor&&v_?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,Wf=v_&&d_&&typeof d_.get=="function"?d_.get:null,TI=v_&&Set.prototype.forEach,rN=typeof WeakMap=="function"&&WeakMap.prototype,Pc=rN?WeakMap.prototype.has:null,iN=typeof WeakSet=="function"&&WeakSet.prototype,Cc=iN?WeakSet.prototype.has:null,sN=typeof WeakRef=="function"&&WeakRef.prototype,SI=sN?WeakRef.prototype.deref:null,oN=Boolean.prototype.valueOf,nN=Object.prototype.toString,aN=Function.prototype.toString,lN=String.prototype.match,T_=String.prototype.slice,as=String.prototype.replace,cN=String.prototype.toUpperCase,wI=String.prototype.toLowerCase,kI=RegExp.prototype.test,EI=Array.prototype.concat,ti=Array.prototype.join,uN=Array.prototype.slice,AI=Math.floor,m_=typeof BigInt=="function"?BigInt.prototype.valueOf:null,f_=Object.getOwnPropertySymbols,g_=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Symbol.prototype.toString:null,On=typeof Symbol=="function"&&typeof Symbol.iterator=="object",Mc=typeof Symbol=="function"&&Symbol.toStringTag&&(typeof Symbol.toStringTag===On||!0)?Symbol.toStringTag:null,FI=Object.prototype.propertyIsEnumerable,PI=(typeof Reflect=="function"?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(r){return r.__proto__}:null);function CI(r,e){if(r===1/0||r===-1/0||r!==r||r&&r>-1e3&&r<1e3||kI.call(/e/,e))return e;var t=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if(typeof r=="number"){var i=r<0?-AI(-r):AI(r);if(i!==r){var s=String(i),o=T_.call(e,s.length+1);return as.call(s,t,"$&_")+"."+as.call(as.call(o,/([0-9]{3})/g,"$&_"),/_$/,"")}}return as.call(e,t,"$&_")}var x_=bI(),MI=x_.custom,RI=GI(MI)?MI:null,OI={__proto__:null,double:'"',single:"'"},hN={__proto__:null,double:/(["\\])/g,single:/(['\\])/g};NI.exports=function r(e,t,i,s){var o=t||{};if(Ei(o,"quoteStyle")&&!Ei(OI,o.quoteStyle))throw new TypeError('option "quoteStyle" must be "single" or "double"');if(Ei(o,"maxStringLength")&&(typeof o.maxStringLength=="number"?o.maxStringLength<0&&o.maxStringLength!==1/0:o.maxStringLength!==null))throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`');var n=Ei(o,"customInspect")?o.customInspect:!0;if(typeof n!="boolean"&&n!=="symbol")throw new TypeError("option \"customInspect\", if provided, must be `true`, `false`, or `'symbol'`");if(Ei(o,"indent")&&o.indent!==null&&o.indent!==" "&&!(parseInt(o.indent,10)===o.indent&&o.indent>0))throw new TypeError('option "indent" must be "\\t", an integer > 0, or `null`');if(Ei(o,"numericSeparator")&&typeof o.numericSeparator!="boolean")throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`');var a=o.numericSeparator;if(typeof e>"u")return"undefined";if(e===null)return"null";if(typeof e=="boolean")return e?"true":"false";if(typeof e=="string")return DI(e,o);if(typeof e=="number"){if(e===0)return 1/0/e>0?"0":"-0";var l=String(e);return a?CI(e,l):l}if(typeof e=="bigint"){var c=String(e)+"n";return a?CI(e,c):c}var u=typeof o.depth>"u"?5:o.depth;if(typeof i>"u"&&(i=0),i>=u&&u>0&&typeof e=="object")return y_(e)?"[Array]":"[Object]";var h=MN(o,i);if(typeof s>"u")s=[];else if(LI(s,e)>=0)return"[Circular]";function d(R,M,F){if(M&&(s=uN.call(s),s.push(M)),F){var O={depth:o.depth};return Ei(o,"quoteStyle")&&(O.quoteStyle=o.quoteStyle),r(R,O,i+1,s)}return r(R,o,i+1,s)}if(typeof e=="function"&&!II(e)){var f=bN(e),p=Hf(e,d);return"[Function"+(f?": "+f:" (anonymous)")+"]"+(p.length>0?" { "+ti.call(p,", ")+" }":"")}if(GI(e)){var m=On?as.call(String(e),/^(Symbol\(.*\))_[^)]*$/,"$1"):g_.call(e);return typeof e=="object"&&!On?Ac(m):m}if(AN(e)){for(var g="<"+wI.call(String(e.nodeName)),_=e.attributes||[],v=0;v<_.length;v++)g+=" "+_[v].name+"="+UI(dN(_[v].value),"double",o);return g+=">",e.childNodes&&e.childNodes.length&&(g+="..."),g+="",g}if(y_(e)){if(e.length===0)return"[]";var x=Hf(e,d);return h&&!CN(x)?"["+__(x,h)+"]":"[ "+ti.call(x,", ")+" ]"}if(pN(e)){var T=Hf(e,d);return!("cause"in Error.prototype)&&"cause"in e&&!FI.call(e,"cause")?"{ ["+String(e)+"] "+ti.call(EI.call("[cause]: "+d(e.cause),T),", ")+" }":T.length===0?"["+String(e)+"]":"{ ["+String(e)+"] "+ti.call(T,", ")+" }"}if(typeof e=="object"&&n){if(RI&&typeof e[RI]=="function"&&x_)return x_(e,{depth:u-i});if(n!=="symbol"&&typeof e.inspect=="function")return e.inspect()}if(vN(e)){var b=[];return vI&&vI.call(e,function(R,M){b.push(d(M,e,!0)+" => "+d(R,e))}),BI("Map",Vf.call(e),b,h)}if(wN(e)){var E=[];return TI&&TI.call(e,function(R){E.push(d(R,e))}),BI("Set",Wf.call(e),E,h)}if(TN(e))return p_("WeakMap");if(EN(e))return p_("WeakSet");if(SN(e))return p_("WeakRef");if(gN(e))return Ac(d(Number(e)));if(yN(e))return Ac(d(m_.call(e)));if(xN(e))return Ac(oN.call(e));if(mN(e))return Ac(d(String(e)));if(typeof window<"u"&&e===window)return"{ [object Window] }";if(typeof globalThis<"u"&&e===globalThis||typeof global<"u"&&e===global)return"{ [object globalThis] }";if(!fN(e)&&!II(e)){var w=Hf(e,d),I=PI?PI(e)===Object.prototype:e instanceof Object||e.constructor===Object,B=e instanceof Object?"":"null prototype",C=!I&&Mc&&Object(e)===e&&Mc in e?T_.call(ls(e),8,-1):B?"Object":"",A=I||typeof e.constructor!="function"?"":e.constructor.name?e.constructor.name+" ":"",P=A+(C||B?"["+ti.call(EI.call([],C||[],B||[]),": ")+"] ":"");return w.length===0?P+"{}":h?P+"{"+__(w,h)+"}":P+"{ "+ti.call(w,", ")+" }"}return String(e)};function UI(r,e,t){var i=t.quoteStyle||e,s=OI[i];return s+r+s}function dN(r){return as.call(String(r),/"/g,""")}function Xs(r){return!Mc||!(typeof r=="object"&&(Mc in r||typeof r[Mc]<"u"))}function y_(r){return ls(r)==="[object Array]"&&Xs(r)}function fN(r){return ls(r)==="[object Date]"&&Xs(r)}function II(r){return ls(r)==="[object RegExp]"&&Xs(r)}function pN(r){return ls(r)==="[object Error]"&&Xs(r)}function mN(r){return ls(r)==="[object String]"&&Xs(r)}function gN(r){return ls(r)==="[object Number]"&&Xs(r)}function xN(r){return ls(r)==="[object Boolean]"&&Xs(r)}function GI(r){if(On)return r&&typeof r=="object"&&r instanceof Symbol;if(typeof r=="symbol")return!0;if(!r||typeof r!="object"||!g_)return!1;try{return g_.call(r),!0}catch{}return!1}function yN(r){if(!r||typeof r!="object"||!m_)return!1;try{return m_.call(r),!0}catch{}return!1}var _N=Object.prototype.hasOwnProperty||function(r){return r in this};function Ei(r,e){return _N.call(r,e)}function ls(r){return nN.call(r)}function bN(r){if(r.name)return r.name;var e=lN.call(aN.call(r),/^function\s*([\w$]+)/);return e?e[1]:null}function LI(r,e){if(r.indexOf)return r.indexOf(e);for(var t=0,i=r.length;te.maxStringLength){var t=r.length-e.maxStringLength,i="... "+t+" more character"+(t>1?"s":"");return DI(T_.call(r,0,e.maxStringLength),e)+i}var s=hN[e.quoteStyle||"single"];s.lastIndex=0;var o=as.call(as.call(r,s,"\\$1"),/[\x00-\x1f]/g,PN);return UI(o,"single",e)}function PN(r){var e=r.charCodeAt(0),t={8:"b",9:"t",10:"n",12:"f",13:"r"}[e];return t?"\\"+t:"\\x"+(e<16?"0":"")+cN.call(e.toString(16))}function Ac(r){return"Object("+r+")"}function p_(r){return r+" { ? }"}function BI(r,e,t,i){var s=i?__(t,i):ti.call(t,", ");return r+" ("+e+") {"+s+"}"}function CN(r){for(var e=0;e=0)return!1;return!0}function MN(r,e){var t;if(r.indent===" ")t=" ";else if(typeof r.indent=="number"&&r.indent>0)t=ti.call(Array(r.indent+1)," ");else return null;return{base:t,prev:ti.call(Array(e+1),t)}}function __(r,e){if(r.length===0)return"";var t=` `+e.prev+e.base;return t+ti.call(r,","+t)+` -`+e.prev}function Hf(r,e){var t=y_(r),i=[];if(t){i.length=r.length;for(var s=0;s{"use strict";var RN=Rc(),IN=$s(),zf=function(r,e,t){for(var i=r,s;(s=i.next)!=null;i=s)if(s.key===e)return i.next=s.next,t||(s.next=r.next,r.next=s),s},BN=function(r,e){if(r){var t=zf(r,e);return t&&t.value}},kN=function(r,e,t){var i=zf(r,e);i?i.value=t:r.next={key:e,next:r.next,value:t}},FN=function(r,e){return r?!!zf(r,e):!1},ON=function(r,e){if(r)return zf(r,e,!0)};HI.exports=function(){var e,t={assert:function(i){if(!t.has(i))throw new IN("Side channel does not contain "+RN(i))},delete:function(i){var s=e&&e.next,o=ON(e,i);return o&&s&&s===o&&(e=void 0),!!o},get:function(i){return BN(e,i)},has:function(i){return FN(e,i)},set:function(i,s){e||(e={next:void 0}),kN(e,i,s)}};return t}});var S_=ee((w_e,WI)=>{"use strict";WI.exports=Object});var $I=ee((E_e,zI)=>{"use strict";zI.exports=Error});var jI=ee((A_e,XI)=>{"use strict";XI.exports=EvalError});var qI=ee((P_e,YI)=>{"use strict";YI.exports=RangeError});var ZI=ee((C_e,KI)=>{"use strict";KI.exports=ReferenceError});var JI=ee((M_e,QI)=>{"use strict";QI.exports=SyntaxError});var tB=ee((R_e,eB)=>{"use strict";eB.exports=URIError});var iB=ee((I_e,rB)=>{"use strict";rB.exports=Math.abs});var oB=ee((B_e,sB)=>{"use strict";sB.exports=Math.floor});var aB=ee((k_e,nB)=>{"use strict";nB.exports=Math.max});var cB=ee((F_e,lB)=>{"use strict";lB.exports=Math.min});var hB=ee((O_e,uB)=>{"use strict";uB.exports=Math.pow});var fB=ee((U_e,dB)=>{"use strict";dB.exports=Math.round});var mB=ee((G_e,pB)=>{"use strict";pB.exports=Number.isNaN||function(e){return e!==e}});var xB=ee((L_e,gB)=>{"use strict";var UN=mB();gB.exports=function(e){return UN(e)||e===0?e:e<0?-1:1}});var _B=ee((D_e,yB)=>{"use strict";yB.exports=Object.getOwnPropertyDescriptor});var w_=ee((N_e,bB)=>{"use strict";var $f=_B();if($f)try{$f([],"length")}catch{$f=null}bB.exports=$f});var TB=ee((H_e,vB)=>{"use strict";var Xf=Object.defineProperty||!1;if(Xf)try{Xf({},"a",{value:1})}catch{Xf=!1}vB.exports=Xf});var wB=ee((V_e,SB)=>{"use strict";SB.exports=function(){if(typeof Symbol!="function"||typeof Object.getOwnPropertySymbols!="function")return!1;if(typeof Symbol.iterator=="symbol")return!0;var e={},t=Symbol("test"),i=Object(t);if(typeof t=="string"||Object.prototype.toString.call(t)!=="[object Symbol]"||Object.prototype.toString.call(i)!=="[object Symbol]")return!1;var s=42;e[t]=s;for(var o in e)return!1;if(typeof Object.keys=="function"&&Object.keys(e).length!==0||typeof Object.getOwnPropertyNames=="function"&&Object.getOwnPropertyNames(e).length!==0)return!1;var n=Object.getOwnPropertySymbols(e);if(n.length!==1||n[0]!==t||!Object.prototype.propertyIsEnumerable.call(e,t))return!1;if(typeof Object.getOwnPropertyDescriptor=="function"){var a=Object.getOwnPropertyDescriptor(e,t);if(a.value!==s||a.enumerable!==!0)return!1}return!0}});var PB=ee((W_e,AB)=>{"use strict";var EB=typeof Symbol<"u"&&Symbol,GN=wB();AB.exports=function(){return typeof EB!="function"||typeof Symbol!="function"||typeof EB("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:GN()}});var E_=ee((z_e,CB)=>{"use strict";CB.exports=typeof Reflect<"u"&&Reflect.getPrototypeOf||null});var A_=ee(($_e,MB)=>{"use strict";var LN=S_();MB.exports=LN.getPrototypeOf||null});var BB=ee((X_e,IB)=>{"use strict";var DN="Function.prototype.bind called on incompatible ",NN=Object.prototype.toString,HN=Math.max,VN="[object Function]",RB=function(e,t){for(var i=[],s=0;s{"use strict";var $N=BB();kB.exports=Function.prototype.bind||$N});var jf=ee((Y_e,FB)=>{"use strict";FB.exports=Function.prototype.call});var P_=ee((q_e,OB)=>{"use strict";OB.exports=Function.prototype.apply});var GB=ee((K_e,UB)=>{"use strict";UB.exports=typeof Reflect<"u"&&Reflect&&Reflect.apply});var DB=ee((Z_e,LB)=>{"use strict";var XN=Ic(),jN=P_(),YN=jf(),qN=GB();LB.exports=qN||XN.call(YN,jN)});var C_=ee((Q_e,NB)=>{"use strict";var KN=Ic(),ZN=$s(),QN=jf(),JN=DB();NB.exports=function(e){if(e.length<1||typeof e[0]!="function")throw new ZN("a function is required");return JN(KN,QN,e)}});var XB=ee((J_e,$B)=>{"use strict";var e3=C_(),HB=w_(),WB;try{WB=[].__proto__===Array.prototype}catch(r){if(!r||typeof r!="object"||!("code"in r)||r.code!=="ERR_PROTO_ACCESS")throw r}var M_=!!WB&&HB&&HB(Object.prototype,"__proto__"),zB=Object,VB=zB.getPrototypeOf;$B.exports=M_&&typeof M_.get=="function"?e3([M_.get]):typeof VB=="function"?function(e){return VB(e==null?e:zB(e))}:!1});var ZB=ee((ebe,KB)=>{"use strict";var jB=E_(),YB=A_(),qB=XB();KB.exports=jB?function(e){return jB(e)}:YB?function(e){if(!e||typeof e!="object"&&typeof e!="function")throw new TypeError("getProto: not an object");return YB(e)}:qB?function(e){return qB(e)}:null});var JB=ee((tbe,QB)=>{"use strict";var t3=Function.prototype.call,r3=Object.prototype.hasOwnProperty,i3=Ic();QB.exports=i3.call(t3,r3)});var Kf=ee((rbe,ok)=>{"use strict";var me,s3=S_(),o3=$I(),n3=jI(),a3=qI(),l3=ZI(),Dn=JI(),Ln=$s(),c3=tB(),u3=iB(),h3=oB(),d3=aB(),f3=cB(),p3=hB(),m3=fB(),g3=xB(),ik=Function,R_=function(r){try{return ik('"use strict"; return ('+r+").constructor;")()}catch{}},Bc=w_(),x3=TB(),I_=function(){throw new Ln},y3=Bc?function(){try{return arguments.callee,I_}catch{try{return Bc(arguments,"callee").get}catch{return I_}}}():I_,Un=PB()(),_t=ZB(),_3=A_(),b3=E_(),sk=P_(),kc=jf(),Gn={},v3=typeof Uint8Array>"u"||!_t?me:_t(Uint8Array),js={__proto__:null,"%AggregateError%":typeof AggregateError>"u"?me:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?me:ArrayBuffer,"%ArrayIteratorPrototype%":Un&&_t?_t([][Symbol.iterator]()):me,"%AsyncFromSyncIteratorPrototype%":me,"%AsyncFunction%":Gn,"%AsyncGenerator%":Gn,"%AsyncGeneratorFunction%":Gn,"%AsyncIteratorPrototype%":Gn,"%Atomics%":typeof Atomics>"u"?me:Atomics,"%BigInt%":typeof BigInt>"u"?me:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?me:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?me:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?me:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":o3,"%eval%":eval,"%EvalError%":n3,"%Float16Array%":typeof Float16Array>"u"?me:Float16Array,"%Float32Array%":typeof Float32Array>"u"?me:Float32Array,"%Float64Array%":typeof Float64Array>"u"?me:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?me:FinalizationRegistry,"%Function%":ik,"%GeneratorFunction%":Gn,"%Int8Array%":typeof Int8Array>"u"?me:Int8Array,"%Int16Array%":typeof Int16Array>"u"?me:Int16Array,"%Int32Array%":typeof Int32Array>"u"?me:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":Un&&_t?_t(_t([][Symbol.iterator]())):me,"%JSON%":typeof JSON=="object"?JSON:me,"%Map%":typeof Map>"u"?me:Map,"%MapIteratorPrototype%":typeof Map>"u"||!Un||!_t?me:_t(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":s3,"%Object.getOwnPropertyDescriptor%":Bc,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?me:Promise,"%Proxy%":typeof Proxy>"u"?me:Proxy,"%RangeError%":a3,"%ReferenceError%":l3,"%Reflect%":typeof Reflect>"u"?me:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?me:Set,"%SetIteratorPrototype%":typeof Set>"u"||!Un||!_t?me:_t(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?me:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":Un&&_t?_t(""[Symbol.iterator]()):me,"%Symbol%":Un?Symbol:me,"%SyntaxError%":Dn,"%ThrowTypeError%":y3,"%TypedArray%":v3,"%TypeError%":Ln,"%Uint8Array%":typeof Uint8Array>"u"?me:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?me:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?me:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?me:Uint32Array,"%URIError%":c3,"%WeakMap%":typeof WeakMap>"u"?me:WeakMap,"%WeakRef%":typeof WeakRef>"u"?me:WeakRef,"%WeakSet%":typeof WeakSet>"u"?me:WeakSet,"%Function.prototype.call%":kc,"%Function.prototype.apply%":sk,"%Object.defineProperty%":x3,"%Object.getPrototypeOf%":_3,"%Math.abs%":u3,"%Math.floor%":h3,"%Math.max%":d3,"%Math.min%":f3,"%Math.pow%":p3,"%Math.round%":m3,"%Math.sign%":g3,"%Reflect.getPrototypeOf%":b3};if(_t)try{null.error}catch(r){ek=_t(_t(r)),js["%Error.prototype%"]=ek}var ek,T3=function r(e){var t;if(e==="%AsyncFunction%")t=R_("async function () {}");else if(e==="%GeneratorFunction%")t=R_("function* () {}");else if(e==="%AsyncGeneratorFunction%")t=R_("async function* () {}");else if(e==="%AsyncGenerator%"){var i=r("%AsyncGeneratorFunction%");i&&(t=i.prototype)}else if(e==="%AsyncIteratorPrototype%"){var s=r("%AsyncGenerator%");s&&_t&&(t=_t(s.prototype))}return js[e]=t,t},tk={__proto__:null,"%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"]},Fc=Ic(),Yf=JB(),S3=Fc.call(kc,Array.prototype.concat),w3=Fc.call(sk,Array.prototype.splice),rk=Fc.call(kc,String.prototype.replace),qf=Fc.call(kc,String.prototype.slice),E3=Fc.call(kc,RegExp.prototype.exec),A3=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,P3=/\\(\\)?/g,C3=function(e){var t=qf(e,0,1),i=qf(e,-1);if(t==="%"&&i!=="%")throw new Dn("invalid intrinsic syntax, expected closing `%`");if(i==="%"&&t!=="%")throw new Dn("invalid intrinsic syntax, expected opening `%`");var s=[];return rk(e,A3,function(o,n,a,l){s[s.length]=a?rk(l,P3,"$1"):n||o}),s},M3=function(e,t){var i=e,s;if(Yf(tk,i)&&(s=tk[i],i="%"+s[0]+"%"),Yf(js,i)){var o=js[i];if(o===Gn&&(o=T3(i)),typeof o>"u"&&!t)throw new Ln("intrinsic "+e+" exists, but is not available. Please file an issue!");return{alias:s,name:i,value:o}}throw new Dn("intrinsic "+e+" does not exist!")};ok.exports=function(e,t){if(typeof e!="string"||e.length===0)throw new Ln("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof t!="boolean")throw new Ln('"allowMissing" argument must be a boolean');if(E3(/^%?[^%]*%?$/,e)===null)throw new Dn("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var i=C3(e),s=i.length>0?i[0]:"",o=M3("%"+s+"%",t),n=o.name,a=o.value,l=!1,c=o.alias;c&&(s=c[0],w3(i,S3([0,1],c)));for(var u=1,h=!0;u=i.length){var m=Bc(a,d);h=!!m,h&&"get"in m&&!("originalValue"in m.get)?a=m.get:a=a[d]}else h=Yf(a,d),a=a[d];h&&!l&&(js[n]=a)}}return a}});var B_=ee((ibe,lk)=>{"use strict";var nk=Kf(),ak=C_(),R3=ak([nk("%String.prototype.indexOf%")]);lk.exports=function(e,t){var i=nk(e,!!t);return typeof i=="function"&&R3(e,".prototype.")>-1?ak([i]):i}});var k_=ee((sbe,uk)=>{"use strict";var I3=Kf(),Oc=B_(),B3=Rc(),k3=$s(),ck=I3("%Map%",!0),F3=Oc("Map.prototype.get",!0),O3=Oc("Map.prototype.set",!0),U3=Oc("Map.prototype.has",!0),G3=Oc("Map.prototype.delete",!0),L3=Oc("Map.prototype.size",!0);uk.exports=!!ck&&function(){var e,t={assert:function(i){if(!t.has(i))throw new k3("Side channel does not contain "+B3(i))},delete:function(i){if(e){var s=G3(e,i);return L3(e)===0&&(e=void 0),s}return!1},get:function(i){if(e)return F3(e,i)},has:function(i){return e?U3(e,i):!1},set:function(i,s){e||(e=new ck),O3(e,i,s)}};return t}});var dk=ee((obe,hk)=>{"use strict";var D3=Kf(),Qf=B_(),N3=Rc(),Zf=k_(),H3=$s(),Nn=D3("%WeakMap%",!0),V3=Qf("WeakMap.prototype.get",!0),W3=Qf("WeakMap.prototype.set",!0),z3=Qf("WeakMap.prototype.has",!0),$3=Qf("WeakMap.prototype.delete",!0);hk.exports=Nn?function(){var e,t,i={assert:function(s){if(!i.has(s))throw new H3("Side channel does not contain "+N3(s))},delete:function(s){if(Nn&&s&&(typeof s=="object"||typeof s=="function")){if(e)return $3(e,s)}else if(Zf&&t)return t.delete(s);return!1},get:function(s){return Nn&&s&&(typeof s=="object"||typeof s=="function")&&e?V3(e,s):t&&t.get(s)},has:function(s){return Nn&&s&&(typeof s=="object"||typeof s=="function")&&e?z3(e,s):!!t&&t.has(s)},set:function(s,o){Nn&&s&&(typeof s=="object"||typeof s=="function")?(e||(e=new Nn),W3(e,s,o)):Zf&&(t||(t=Zf()),t.set(s,o))}};return i}:Zf});var pk=ee((nbe,fk)=>{"use strict";var X3=$s(),j3=Rc(),Y3=VI(),q3=k_(),K3=dk(),Z3=K3||q3||Y3;fk.exports=function(){var e,t={assert:function(i){if(!t.has(i))throw new X3("Side channel does not contain "+j3(i))},delete:function(i){return!!e&&e.delete(i)},get:function(i){return e&&e.get(i)},has:function(i){return!!e&&e.has(i)},set:function(i,s){e||(e=Z3()),e.set(i,s)}};return t}});var Jf=ee((abe,mk)=>{"use strict";var Q3=String.prototype.replace,J3=/%20/g,F_={RFC1738:"RFC1738",RFC3986:"RFC3986"};mk.exports={default:F_.RFC3986,formatters:{RFC1738:function(r){return Q3.call(r,J3,"+")},RFC3986:function(r){return String(r)}},RFC1738:F_.RFC1738,RFC3986:F_.RFC3986}});var G_=ee((lbe,xk)=>{"use strict";var eH=Jf(),O_=Object.prototype.hasOwnProperty,Ys=Array.isArray,ri=function(){for(var r=[],e=0;e<256;++e)r.push("%"+((e<16?"0":"")+e.toString(16)).toUpperCase());return r}(),tH=function(e){for(;e.length>1;){var t=e.pop(),i=t.obj[t.prop];if(Ys(i)){for(var s=[],o=0;o=U_?n.slice(l,l+U_):n,u=[],h=0;h=48&&d<=57||d>=65&&d<=90||d>=97&&d<=122||o===eH.RFC1738&&(d===40||d===41)){u[u.length]=c.charAt(h);continue}if(d<128){u[u.length]=ri[d];continue}if(d<2048){u[u.length]=ri[192|d>>6]+ri[128|d&63];continue}if(d<55296||d>=57344){u[u.length]=ri[224|d>>12]+ri[128|d>>6&63]+ri[128|d&63];continue}h+=1,d=65536+((d&1023)<<10|c.charCodeAt(h)&1023),u[u.length]=ri[240|d>>18]+ri[128|d>>12&63]+ri[128|d>>6&63]+ri[128|d&63]}a+=u.join("")}return a},nH=function(e){for(var t=[{obj:{o:e},prop:"o"}],i=[],s=0;s{"use strict";var _k=pk(),ep=G_(),Uc=Jf(),hH=Object.prototype.hasOwnProperty,bk={brackets:function(e){return e+"[]"},comma:"comma",indices:function(e,t){return e+"["+t+"]"},repeat:function(e){return e}},ii=Array.isArray,dH=Array.prototype.push,vk=function(r,e){dH.apply(r,ii(e)?e:[e])},fH=Date.prototype.toISOString,yk=Uc.default,ft={addQueryPrefix:!1,allowDots:!1,allowEmptyArrays:!1,arrayFormat:"indices",charset:"utf-8",charsetSentinel:!1,commaRoundTrip:!1,delimiter:"&",encode:!0,encodeDotInKeys:!1,encoder:ep.encode,encodeValuesOnly:!1,filter:void 0,format:yk,formatter:Uc.formatters[yk],indices:!1,serializeDate:function(e){return fH.call(e)},skipNulls:!1,strictNullHandling:!1},pH=function(e){return typeof e=="string"||typeof e=="number"||typeof e=="boolean"||typeof e=="symbol"||typeof e=="bigint"},L_={},mH=function r(e,t,i,s,o,n,a,l,c,u,h,d,f,p,m,g,_,v){for(var x=e,T=v,b=0,w=!1;(T=T.get(L_))!==void 0&&!w;){var E=T.get(e);if(b+=1,typeof E<"u"){if(E===b)throw new RangeError("Cyclic object value");w=!0}typeof T.get(L_)>"u"&&(b=0)}if(typeof u=="function"?x=u(t,x):x instanceof Date?x=f(x):i==="comma"&&ii(x)&&(x=ep.maybeMap(x,function(Y){return Y instanceof Date?f(Y):Y})),x===null){if(n)return c&&!g?c(t,ft.encoder,_,"key",p):t;x=""}if(pH(x)||ep.isBuffer(x)){if(c){var I=g?t:c(t,ft.encoder,_,"key",p);return[m(I)+"="+m(c(x,ft.encoder,_,"value",p))]}return[m(t)+"="+m(String(x))]}var B=[];if(typeof x>"u")return B;var C;if(i==="comma"&&ii(x))g&&c&&(x=ep.maybeMap(x,c)),C=[{value:x.length>0?x.join(",")||null:void 0}];else if(ii(u))C=u;else{var A=Object.keys(x);C=h?A.sort(h):A}var P=l?String(t).replace(/\./g,"%2E"):String(t),R=s&&ii(x)&&x.length===1?P+"[]":P;if(o&&ii(x)&&x.length===0)return R+"[]";for(var M=0;M"u"?e.encodeDotInKeys===!0?!0:ft.allowDots:!!e.allowDots;return{addQueryPrefix:typeof e.addQueryPrefix=="boolean"?e.addQueryPrefix:ft.addQueryPrefix,allowDots:a,allowEmptyArrays:typeof e.allowEmptyArrays=="boolean"?!!e.allowEmptyArrays:ft.allowEmptyArrays,arrayFormat:n,charset:t,charsetSentinel:typeof e.charsetSentinel=="boolean"?e.charsetSentinel:ft.charsetSentinel,commaRoundTrip:!!e.commaRoundTrip,delimiter:typeof e.delimiter>"u"?ft.delimiter:e.delimiter,encode:typeof e.encode=="boolean"?e.encode:ft.encode,encodeDotInKeys:typeof e.encodeDotInKeys=="boolean"?e.encodeDotInKeys:ft.encodeDotInKeys,encoder:typeof e.encoder=="function"?e.encoder:ft.encoder,encodeValuesOnly:typeof e.encodeValuesOnly=="boolean"?e.encodeValuesOnly:ft.encodeValuesOnly,filter:o,format:i,formatter:s,serializeDate:typeof e.serializeDate=="function"?e.serializeDate:ft.serializeDate,skipNulls:typeof e.skipNulls=="boolean"?e.skipNulls:ft.skipNulls,sort:typeof e.sort=="function"?e.sort:null,strictNullHandling:typeof e.strictNullHandling=="boolean"?e.strictNullHandling:ft.strictNullHandling}};Tk.exports=function(r,e){var t=r,i=gH(e),s,o;typeof i.filter=="function"?(o=i.filter,t=o("",t)):ii(i.filter)&&(o=i.filter,s=o);var n=[];if(typeof t!="object"||t===null)return"";var a=bk[i.arrayFormat],l=a==="comma"&&i.commaRoundTrip;s||(s=Object.keys(t)),i.sort&&s.sort(i.sort);for(var c=_k(),u=0;u0?p+f:""}});var Pk=ee((ube,Ak)=>{"use strict";var qs=G_(),D_=Object.prototype.hasOwnProperty,wk=Array.isArray,Qe={allowDots:!1,allowEmptyArrays:!1,allowPrototypes:!1,allowSparse:!1,arrayLimit:20,charset:"utf-8",charsetSentinel:!1,comma:!1,decodeDotInKeys:!1,decoder:qs.decode,delimiter:"&",depth:5,duplicates:"combine",ignoreQueryPrefix:!1,interpretNumericEntities:!1,parameterLimit:1e3,parseArrays:!0,plainObjects:!1,strictDepth:!1,strictNullHandling:!1,throwOnLimitExceeded:!1},xH=function(r){return r.replace(/&#(\d+);/g,function(e,t){return String.fromCharCode(parseInt(t,10))})},Ek=function(r,e,t){if(r&&typeof r=="string"&&e.comma&&r.indexOf(",")>-1)return r.split(",");if(e.throwOnLimitExceeded&&t>=e.arrayLimit)throw new RangeError("Array limit exceeded. Only "+e.arrayLimit+" element"+(e.arrayLimit===1?"":"s")+" allowed in an array.");return r},yH="utf8=%26%2310003%3B",_H="utf8=%E2%9C%93",bH=function(e,t){var i={__proto__:null},s=t.ignoreQueryPrefix?e.replace(/^\?/,""):e;s=s.replace(/%5B/gi,"[").replace(/%5D/gi,"]");var o=t.parameterLimit===1/0?void 0:t.parameterLimit,n=s.split(t.delimiter,t.throwOnLimitExceeded?o+1:o);if(t.throwOnLimitExceeded&&n.length>o)throw new RangeError("Parameter limit exceeded. Only "+o+" parameter"+(o===1?"":"s")+" allowed.");var a=-1,l,c=t.charset;if(t.charsetSentinel)for(l=0;l-1&&(p=wk(p)?[p]:p);var m=D_.call(i,f);m&&t.duplicates==="combine"?i[f]=qs.combine(i[f],p):(!m||t.duplicates==="last")&&(i[f]=p)}return i},vH=function(r,e,t,i){var s=0;if(r.length>0&&r[r.length-1]==="[]"){var o=r.slice(0,-1).join("");s=Array.isArray(e)&&e[o]?e[o].length:0}for(var n=i?e:Ek(e,t,s),a=r.length-1;a>=0;--a){var l,c=r[a];if(c==="[]"&&t.parseArrays)l=t.allowEmptyArrays&&(n===""||t.strictNullHandling&&n===null)?[]:qs.combine([],n);else{l=t.plainObjects?{__proto__:null}:{};var u=c.charAt(0)==="["&&c.charAt(c.length-1)==="]"?c.slice(1,-1):c,h=t.decodeDotInKeys?u.replace(/%2E/g,"."):u,d=parseInt(h,10);!t.parseArrays&&h===""?l={0:n}:!isNaN(d)&&c!==h&&String(d)===h&&d>=0&&t.parseArrays&&d<=t.arrayLimit?(l=[],l[d]=n):h!=="__proto__"&&(l[h]=n)}n=l}return n},TH=function(e,t,i,s){if(e){var o=i.allowDots?e.replace(/\.([^.[]+)/g,"[$1]"):e,n=/(\[[^[\]]*])/,a=/(\[[^[\]]*])/g,l=i.depth>0&&n.exec(o),c=l?o.slice(0,l.index):o,u=[];if(c){if(!i.plainObjects&&D_.call(Object.prototype,c)&&!i.allowPrototypes)return;u.push(c)}for(var h=0;i.depth>0&&(l=a.exec(o))!==null&&h"u"?Qe.charset:e.charset,i=typeof e.duplicates>"u"?Qe.duplicates:e.duplicates;if(i!=="combine"&&i!=="first"&&i!=="last")throw new TypeError("The duplicates option must be either combine, first, or last");var s=typeof e.allowDots>"u"?e.decodeDotInKeys===!0?!0:Qe.allowDots:!!e.allowDots;return{allowDots:s,allowEmptyArrays:typeof e.allowEmptyArrays=="boolean"?!!e.allowEmptyArrays:Qe.allowEmptyArrays,allowPrototypes:typeof e.allowPrototypes=="boolean"?e.allowPrototypes:Qe.allowPrototypes,allowSparse:typeof e.allowSparse=="boolean"?e.allowSparse:Qe.allowSparse,arrayLimit:typeof e.arrayLimit=="number"?e.arrayLimit:Qe.arrayLimit,charset:t,charsetSentinel:typeof e.charsetSentinel=="boolean"?e.charsetSentinel:Qe.charsetSentinel,comma:typeof e.comma=="boolean"?e.comma:Qe.comma,decodeDotInKeys:typeof e.decodeDotInKeys=="boolean"?e.decodeDotInKeys:Qe.decodeDotInKeys,decoder:typeof e.decoder=="function"?e.decoder:Qe.decoder,delimiter:typeof e.delimiter=="string"||qs.isRegExp(e.delimiter)?e.delimiter:Qe.delimiter,depth:typeof e.depth=="number"||e.depth===!1?+e.depth:Qe.depth,duplicates:i,ignoreQueryPrefix:e.ignoreQueryPrefix===!0,interpretNumericEntities:typeof e.interpretNumericEntities=="boolean"?e.interpretNumericEntities:Qe.interpretNumericEntities,parameterLimit:typeof e.parameterLimit=="number"?e.parameterLimit:Qe.parameterLimit,parseArrays:e.parseArrays!==!1,plainObjects:typeof e.plainObjects=="boolean"?e.plainObjects:Qe.plainObjects,strictDepth:typeof e.strictDepth=="boolean"?!!e.strictDepth:Qe.strictDepth,strictNullHandling:typeof e.strictNullHandling=="boolean"?e.strictNullHandling:Qe.strictNullHandling,throwOnLimitExceeded:typeof e.throwOnLimitExceeded=="boolean"?e.throwOnLimitExceeded:!1}};Ak.exports=function(r,e){var t=SH(e);if(r===""||r===null||typeof r>"u")return t.plainObjects?{__proto__:null}:{};for(var i=typeof r=="string"?bH(r,t):r,s=t.plainObjects?{__proto__:null}:{},o=Object.keys(i),n=0;n{"use strict";var wH=Sk(),EH=Pk(),AH=Jf();Ck.exports={formats:AH,parse:EH,stringify:wH}});var kk=ee(Vn=>{"use strict";var PH=yI();function Tr(){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 CH=/^([a-z0-9.+-]+:)/i,MH=/:[0-9]*$/,RH=/^(\/\/?(?!\/)[^?\s]*)(\?[^\s]*)?$/,IH=["<",">",'"',"`"," ","\r",` -`," "],BH=["{","}","|","\\","^","`"].concat(IH),N_=["'"].concat(BH),Rk=["%","/","?",";","#"].concat(N_),Ik=["/","?","#"],kH=255,Bk=/^[+a-z0-9A-Z_-]{0,63}$/,FH=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,OH={javascript:!0,"javascript:":!0},H_={javascript:!0,"javascript:":!0},Hn={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},V_=Mk();function Gc(r,e,t){if(r&&typeof r=="object"&&r instanceof Tr)return r;var i=new Tr;return i.parse(r,e,t),i}Tr.prototype.parse=function(r,e,t){if(typeof r!="string")throw new TypeError("Parameter 'url' must be a string, not "+typeof r);var i=r.indexOf("?"),s=i!==-1&&i127?b+="x":b+=T[w];if(!b.match(Bk)){var I=v.slice(0,f),B=v.slice(f+1),C=T.match(FH);C&&(I.push(C[1]),B.unshift(C[2])),B.length&&(a="/"+B.join(".")+a),this.hostname=I.join(".");break}}}this.hostname.length>kH?this.hostname="":this.hostname=this.hostname.toLowerCase(),_||(this.hostname=PH.toASCII(this.hostname));var A=this.port?":"+this.port:"",P=this.hostname||"";this.host=P+A,this.href+=this.host,_&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),a[0]!=="/"&&(a="/"+a))}if(!OH[u])for(var f=0,x=N_.length;f0?t.host.split("@"):!1;b&&(t.auth=b.shift(),t.hostname=b.shift(),t.host=t.hostname)}return t.search=r.search,t.query=r.query,(t.pathname!==null||t.search!==null)&&(t.path=(t.pathname?t.pathname:"")+(t.search?t.search:"")),t.href=t.format(),t}if(!v.length)return t.pathname=null,t.search?t.path="/"+t.search:t.path=null,t.href=t.format(),t;for(var w=v.slice(-1)[0],E=(t.host||r.host||v.length>1)&&(w==="."||w==="..")||w==="",I=0,B=v.length;B>=0;B--)w=v[B],w==="."?v.splice(B,1):w===".."?(v.splice(B,1),I++):I&&(v.splice(B,1),I--);if(!g&&!_)for(;I--;I)v.unshift("..");g&&v[0]!==""&&(!v[0]||v[0].charAt(0)!=="/")&&v.unshift(""),E&&v.join("/").substr(-1)!=="/"&&v.push("");var C=v[0]===""||v[0]&&v[0].charAt(0)==="/";if(T){t.hostname=C?"":v.length?v.shift():"",t.host=t.hostname;var b=t.host&&t.host.indexOf("@")>0?t.host.split("@"):!1;b&&(t.auth=b.shift(),t.hostname=b.shift(),t.host=t.hostname)}return g=g||t.host&&v.length,g&&!C&&v.unshift(""),v.length>0?t.pathname=v.join("/"):(t.pathname=null,t.path=null),(t.pathname!==null||t.search!==null)&&(t.path=(t.pathname?t.pathname:"")+(t.search?t.search:"")),t.auth=r.auth||t.auth,t.slashes=t.slashes||r.slashes,t.href=t.format(),t};Tr.prototype.parseHost=function(){var r=this.host,e=MH.exec(r);e&&(e=e[0],e!==":"&&(this.port=e.substr(1)),r=r.substr(0,r.length-e.length)),r&&(this.hostname=r)};Vn.parse=Gc;Vn.resolve=GH;Vn.resolveObject=LH;Vn.format=UH;Vn.Url=Tr});var QF=()=>{let r=new Map,e=l=>typeof l=="string"&&l.startsWith("blob:"),t=l=>typeof l?.type=="string"&&(l.type.startsWith("image/")||l.type.startsWith("video/"))&&typeof l?.url=="string"&&!e(l.url);return{load:async l=>{let c=[];for(let[u,h]of Object.entries(l))r.has(u)||c.push([u,h]);c.length>0&&await Promise.all(c.map(async([u,h])=>{if(t(h)){r.set(u,{url:h.url,type:h.type,source:"url"});return}let p={buffer:await(await fetch(h.url)).arrayBuffer(),type:h.type,source:"buffer"};r.set(u,p)}))},getBufferMap:()=>{let l={};for(let[c,u]of r.entries())l[c]=u;return l},clear:()=>r.clear(),size:()=>r.size,has:l=>r.has(l)}};U();var cA={extension:{type:S.Environment,name:"browser",priority:-1},test:()=>!0,load:async()=>{await Promise.resolve().then(()=>(lA(),nU))}};U();var hA={extension:{type:S.Environment,name:"webworker",priority:0},test:()=>typeof self<"u"&&self.WorkerGlobalScope!==void 0,load:async()=>{await Promise.resolve().then(()=>(uA(),aU))}};U();eh();Yu();U();Re();ll();var Yh;function xA(r){return Yh!==void 0||(Yh=(()=>{let e={stencil:!0,failIfMajorPerformanceCaveat:r??qi.defaultOptions.failIfMajorPerformanceCaveat};try{if(!j.get().getWebGLRenderingContext())return!1;let i=j.get().createCanvas().getContext("webgl",e),s=!!i?.getContextAttributes()?.stencil;if(i){let o=i.getExtension("WEBGL_lose_context");o&&o.loseContext()}return i=null,s}catch{return!1}})()),Yh}Re();var qh;async function yA(r={}){return qh!==void 0||(qh=await(async()=>{let e=j.get().getNavigator().gpu;if(!e)return!1;try{return await(await e.requestAdapter(r)).requestDevice(),!0}catch{return!1}})()),qh}ll();var RC=["webgl","webgpu","canvas"];async function IC(r){let e=[];r.preference?(e.push(r.preference),RC.forEach(o=>{o!==r.preference&&e.push(o)})):e=RC.slice();let t,i={};for(let o=0;o(iP(),rP));t=a,i={...r,...r.webgpu};break}else if(n==="webgl"&&xA(r.failIfMajorPerformanceCaveat??qi.defaultOptions.failIfMajorPerformanceCaveat)){let{WebGLRenderer:a}=await Promise.resolve().then(()=>(MC(),CC));t=a,i={...r,...r.webgl};break}else if(n==="canvas")throw i={...r},new Error("CanvasRenderer is not yet implemented")}if(delete i.webgpu,delete i.webgl,!t)throw new Error("No available renderer for the current environment");let s=new t;return await s.init(i),s}Pr();Ax();Xe();var BC=class py{constructor(...e){this.stage=new te,e[0]!==void 0&&X(ie,"Application constructor options are deprecated, please use Application.init() instead.")}async init(e){e={...e},this.renderer=await IC(e),py._plugins.forEach(t=>{t.init.call(this,e)})}render(){this.renderer.render({container:this.stage})}get canvas(){return this.renderer.canvas}get view(){return X(ie,"Application.view is deprecated, please use Application.canvas instead."),this.renderer.canvas}get screen(){return this.renderer.screen}destroy(e=!1,t=!1){let i=py._plugins.slice(0);i.reverse(),i.forEach(s=>{s.destroy.call(this)}),this.stage.destroy(t),this.stage=null,this.renderer.destroy(e),this.renderer=null}};BC._plugins=[];var ic=BC;V.handleByList(S.Application,ic._plugins);V.add(yl);U();Di();Am();Re();U();Ts();ut();ve();tx();nx();var sc=class extends Ko{constructor(e,t){super();let{textures:i,data:s}=e;Object.keys(s.pages).forEach(o=>{let n=s.pages[parseInt(o,10)],a=i[n.id];this.pages.push({texture:a})}),Object.keys(s.chars).forEach(o=>{let n=s.chars[o],{frame:a,source:l}=i[n.page],c=new Q(n.x+a.x,n.y+a.y,n.width,n.height),u=new k({source:l,frame:c});this.chars[o]={id:o.codePointAt(0),xOffset:n.xOffset,yOffset:n.yOffset,xAdvance:n.xAdvance,kerning:n.kerning??{},texture:u}}),this.baseRenderedFontSize=s.fontSize,this.baseMeasurementFontSize=s.fontSize,this.fontMetrics={ascent:0,descent:0,fontSize:s.fontSize},this.baseLineOffset=s.baseLineOffset,this.lineHeight=s.lineHeight,this.fontFamily=s.fontFamily,this.distanceField=s.distanceField??{type:"none",range:0},this.url=t}destroy(){super.destroy();for(let e=0;e")?my.test(j.get().parseXML(r)):!1},parse(r){return my.parse(j.get().parseXML(r))}};var HU=[".xml",".fnt"],kC={extension:{type:S.CacheParser,name:"cacheBitmapFont"},test:r=>r instanceof sc,getCacheableAssets(r,e){let t={};return r.forEach(i=>{t[i]=e,t[`${i}-bitmap`]=e}),t[`${e.fontFamily}-bitmap`]=e,t}},FC={extension:{type:S.LoadParser,priority:Dt.Normal},name:"loadBitmapFont",test(r){return HU.includes(dt.extname(r).toLowerCase())},async testParse(r){return bd.test(r)||gy.test(r)},async parse(r,e,t){let i=bd.test(r)?bd.parse(r):gy.parse(r),{src:s}=e,{pages:o}=i,n=[],a=i.distanceField?{scaleMode:"linear",alphaMode:"premultiply-alpha-on-upload",autoGenerateMipmaps:!1,resolution:1}:{};for(let h=0;hl[h.src]);return new sc({data:i,textures:c},s)},async load(r,e){return await(await j.get().fetch(r)).text()},async unload(r,e,t){await Promise.all(r.pages.map(i=>t.unload(i.texture.source._sourceOrigin))),r.destroy()}};Ae();var vd=class{constructor(e,t=!1){this._loader=e,this._assetList=[],this._isLoading=!1,this._maxConcurrent=1,this.verbose=t}add(e){e.forEach(t=>{this._assetList.push(t)}),this.verbose&&console.log("[BackgroundLoader] assets: ",this._assetList),this._isActive&&!this._isLoading&&this._next()}async _next(){if(this._assetList.length&&this._isActive){this._isLoading=!0;let e=[],t=Math.min(this._assetList.length,this._maxConcurrent);for(let i=0;iArray.isArray(r)&&r.every(e=>e instanceof k),getCacheableAssets:(r,e)=>{let t={};return r.forEach(i=>{e.forEach((s,o)=>{t[i+(o===0?"":o+1)]=s})}),t}};U();async function Td(r){if("Image"in globalThis)return new Promise(e=>{let t=new Image;t.onload=()=>{e(!0)},t.onerror=()=>{e(!1)},t.src=r});if("createImageBitmap"in globalThis&&"fetch"in globalThis){try{let e=await(await fetch(r)).blob();await createImageBitmap(e)}catch{return!1}return!0}return!1}var UC={extension:{type:S.DetectionParser,priority:1},test:async()=>Td("data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAAB0AAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAIAAAACAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQ0MAAAAABNjb2xybmNseAACAAIAAYAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAACVtZGF0EgAKCBgANogQEAwgMg8f8D///8WfhwB8+ErK42A="),add:async r=>[...r,"avif"],remove:async r=>r.filter(e=>e!=="avif")};U();var GC=["png","jpg","jpeg"],LC={extension:{type:S.DetectionParser,priority:-1},test:()=>Promise.resolve(!0),add:async r=>[...r,...GC],remove:async r=>r.filter(e=>!GC.includes(e))};U();var VU="WorkerGlobalScope"in globalThis&&globalThis instanceof globalThis.WorkerGlobalScope;function dn(r){return VU?!1:document.createElement("video").canPlayType(r)!==""}var DC={extension:{type:S.DetectionParser,priority:0},test:async()=>dn("video/mp4"),add:async r=>[...r,"mp4","m4v"],remove:async r=>r.filter(e=>e!=="mp4"&&e!=="m4v")};U();var NC={extension:{type:S.DetectionParser,priority:0},test:async()=>dn("video/ogg"),add:async r=>[...r,"ogv"],remove:async r=>r.filter(e=>e!=="ogv")};U();var HC={extension:{type:S.DetectionParser,priority:0},test:async()=>dn("video/webm"),add:async r=>[...r,"webm"],remove:async r=>r.filter(e=>e!=="webm")};U();var VC={extension:{type:S.DetectionParser,priority:0},test:async()=>Td("data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAAAAAAfQ//73v/+BiOh/AAA="),add:async r=>[...r,"webp"],remove:async r=>r.filter(e=>e!=="webp")};Ae();Ts();Aa();ju();var Sd=class{constructor(){this._parsers=[],this._parsersValidated=!1,this.parsers=new Proxy(this._parsers,{set:(e,t,i)=>(this._parsersValidated=!1,e[t]=i,!0)}),this.promiseCache={}}reset(){this._parsersValidated=!1,this.promiseCache={}}_getLoadPromiseAndParser(e,t){let i={promise:null,parser:null};return i.promise=(async()=>{let s=null,o=null;if(t.loadParser&&(o=this._parserHash[t.loadParser],o||W(`[Assets] specified load parser "${t.loadParser}" not found while loading ${e}`)),!o){for(let n=0;n({alias:[c],src:c,data:{}})),a=n.length,l=n.map(async c=>{let u=dt.toAbsolute(c.src);if(!s[c.src])try{this.promiseCache[u]||(this.promiseCache[u]=this._getLoadPromiseAndParser(u,c)),s[c.src]=await this.promiseCache[u].promise,t&&t(++i/a)}catch(h){throw delete this.promiseCache[u],delete s[c.src],new Error(`[Loader.load] Failed to load ${u}. +`+e.prev}function Hf(r,e){var t=y_(r),i=[];if(t){i.length=r.length;for(var s=0;s{"use strict";var RN=Rc(),IN=$s(),zf=function(r,e,t){for(var i=r,s;(s=i.next)!=null;i=s)if(s.key===e)return i.next=s.next,t||(s.next=r.next,r.next=s),s},BN=function(r,e){if(r){var t=zf(r,e);return t&&t.value}},kN=function(r,e,t){var i=zf(r,e);i?i.value=t:r.next={key:e,next:r.next,value:t}},FN=function(r,e){return r?!!zf(r,e):!1},ON=function(r,e){if(r)return zf(r,e,!0)};HI.exports=function(){var e,t={assert:function(i){if(!t.has(i))throw new IN("Side channel does not contain "+RN(i))},delete:function(i){var s=e&&e.next,o=ON(e,i);return o&&s&&s===o&&(e=void 0),!!o},get:function(i){return BN(e,i)},has:function(i){return FN(e,i)},set:function(i,s){e||(e={next:void 0}),kN(e,i,s)}};return t}});var S_=ee((w_e,WI)=>{"use strict";WI.exports=Object});var $I=ee((E_e,zI)=>{"use strict";zI.exports=Error});var jI=ee((A_e,XI)=>{"use strict";XI.exports=EvalError});var qI=ee((P_e,YI)=>{"use strict";YI.exports=RangeError});var ZI=ee((C_e,KI)=>{"use strict";KI.exports=ReferenceError});var JI=ee((M_e,QI)=>{"use strict";QI.exports=SyntaxError});var tB=ee((R_e,eB)=>{"use strict";eB.exports=URIError});var iB=ee((I_e,rB)=>{"use strict";rB.exports=Math.abs});var oB=ee((B_e,sB)=>{"use strict";sB.exports=Math.floor});var aB=ee((k_e,nB)=>{"use strict";nB.exports=Math.max});var cB=ee((F_e,lB)=>{"use strict";lB.exports=Math.min});var hB=ee((O_e,uB)=>{"use strict";uB.exports=Math.pow});var fB=ee((U_e,dB)=>{"use strict";dB.exports=Math.round});var mB=ee((G_e,pB)=>{"use strict";pB.exports=Number.isNaN||function(e){return e!==e}});var xB=ee((L_e,gB)=>{"use strict";var UN=mB();gB.exports=function(e){return UN(e)||e===0?e:e<0?-1:1}});var _B=ee((D_e,yB)=>{"use strict";yB.exports=Object.getOwnPropertyDescriptor});var w_=ee((N_e,bB)=>{"use strict";var $f=_B();if($f)try{$f([],"length")}catch{$f=null}bB.exports=$f});var TB=ee((H_e,vB)=>{"use strict";var Xf=Object.defineProperty||!1;if(Xf)try{Xf({},"a",{value:1})}catch{Xf=!1}vB.exports=Xf});var wB=ee((V_e,SB)=>{"use strict";SB.exports=function(){if(typeof Symbol!="function"||typeof Object.getOwnPropertySymbols!="function")return!1;if(typeof Symbol.iterator=="symbol")return!0;var e={},t=Symbol("test"),i=Object(t);if(typeof t=="string"||Object.prototype.toString.call(t)!=="[object Symbol]"||Object.prototype.toString.call(i)!=="[object Symbol]")return!1;var s=42;e[t]=s;for(var o in e)return!1;if(typeof Object.keys=="function"&&Object.keys(e).length!==0||typeof Object.getOwnPropertyNames=="function"&&Object.getOwnPropertyNames(e).length!==0)return!1;var n=Object.getOwnPropertySymbols(e);if(n.length!==1||n[0]!==t||!Object.prototype.propertyIsEnumerable.call(e,t))return!1;if(typeof Object.getOwnPropertyDescriptor=="function"){var a=Object.getOwnPropertyDescriptor(e,t);if(a.value!==s||a.enumerable!==!0)return!1}return!0}});var PB=ee((W_e,AB)=>{"use strict";var EB=typeof Symbol<"u"&&Symbol,GN=wB();AB.exports=function(){return typeof EB!="function"||typeof Symbol!="function"||typeof EB("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:GN()}});var E_=ee((z_e,CB)=>{"use strict";CB.exports=typeof Reflect<"u"&&Reflect.getPrototypeOf||null});var A_=ee(($_e,MB)=>{"use strict";var LN=S_();MB.exports=LN.getPrototypeOf||null});var BB=ee((X_e,IB)=>{"use strict";var DN="Function.prototype.bind called on incompatible ",NN=Object.prototype.toString,HN=Math.max,VN="[object Function]",RB=function(e,t){for(var i=[],s=0;s{"use strict";var $N=BB();kB.exports=Function.prototype.bind||$N});var jf=ee((Y_e,FB)=>{"use strict";FB.exports=Function.prototype.call});var P_=ee((q_e,OB)=>{"use strict";OB.exports=Function.prototype.apply});var GB=ee((K_e,UB)=>{"use strict";UB.exports=typeof Reflect<"u"&&Reflect&&Reflect.apply});var DB=ee((Z_e,LB)=>{"use strict";var XN=Ic(),jN=P_(),YN=jf(),qN=GB();LB.exports=qN||XN.call(YN,jN)});var C_=ee((Q_e,NB)=>{"use strict";var KN=Ic(),ZN=$s(),QN=jf(),JN=DB();NB.exports=function(e){if(e.length<1||typeof e[0]!="function")throw new ZN("a function is required");return JN(KN,QN,e)}});var XB=ee((J_e,$B)=>{"use strict";var e3=C_(),HB=w_(),WB;try{WB=[].__proto__===Array.prototype}catch(r){if(!r||typeof r!="object"||!("code"in r)||r.code!=="ERR_PROTO_ACCESS")throw r}var M_=!!WB&&HB&&HB(Object.prototype,"__proto__"),zB=Object,VB=zB.getPrototypeOf;$B.exports=M_&&typeof M_.get=="function"?e3([M_.get]):typeof VB=="function"?function(e){return VB(e==null?e:zB(e))}:!1});var ZB=ee((ebe,KB)=>{"use strict";var jB=E_(),YB=A_(),qB=XB();KB.exports=jB?function(e){return jB(e)}:YB?function(e){if(!e||typeof e!="object"&&typeof e!="function")throw new TypeError("getProto: not an object");return YB(e)}:qB?function(e){return qB(e)}:null});var JB=ee((tbe,QB)=>{"use strict";var t3=Function.prototype.call,r3=Object.prototype.hasOwnProperty,i3=Ic();QB.exports=i3.call(t3,r3)});var Kf=ee((rbe,ok)=>{"use strict";var me,s3=S_(),o3=$I(),n3=jI(),a3=qI(),l3=ZI(),Dn=JI(),Ln=$s(),c3=tB(),u3=iB(),h3=oB(),d3=aB(),f3=cB(),p3=hB(),m3=fB(),g3=xB(),ik=Function,R_=function(r){try{return ik('"use strict"; return ('+r+").constructor;")()}catch{}},Bc=w_(),x3=TB(),I_=function(){throw new Ln},y3=Bc?function(){try{return arguments.callee,I_}catch{try{return Bc(arguments,"callee").get}catch{return I_}}}():I_,Un=PB()(),_t=ZB(),_3=A_(),b3=E_(),sk=P_(),kc=jf(),Gn={},v3=typeof Uint8Array>"u"||!_t?me:_t(Uint8Array),js={__proto__:null,"%AggregateError%":typeof AggregateError>"u"?me:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?me:ArrayBuffer,"%ArrayIteratorPrototype%":Un&&_t?_t([][Symbol.iterator]()):me,"%AsyncFromSyncIteratorPrototype%":me,"%AsyncFunction%":Gn,"%AsyncGenerator%":Gn,"%AsyncGeneratorFunction%":Gn,"%AsyncIteratorPrototype%":Gn,"%Atomics%":typeof Atomics>"u"?me:Atomics,"%BigInt%":typeof BigInt>"u"?me:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?me:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?me:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?me:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":o3,"%eval%":eval,"%EvalError%":n3,"%Float16Array%":typeof Float16Array>"u"?me:Float16Array,"%Float32Array%":typeof Float32Array>"u"?me:Float32Array,"%Float64Array%":typeof Float64Array>"u"?me:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?me:FinalizationRegistry,"%Function%":ik,"%GeneratorFunction%":Gn,"%Int8Array%":typeof Int8Array>"u"?me:Int8Array,"%Int16Array%":typeof Int16Array>"u"?me:Int16Array,"%Int32Array%":typeof Int32Array>"u"?me:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":Un&&_t?_t(_t([][Symbol.iterator]())):me,"%JSON%":typeof JSON=="object"?JSON:me,"%Map%":typeof Map>"u"?me:Map,"%MapIteratorPrototype%":typeof Map>"u"||!Un||!_t?me:_t(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":s3,"%Object.getOwnPropertyDescriptor%":Bc,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?me:Promise,"%Proxy%":typeof Proxy>"u"?me:Proxy,"%RangeError%":a3,"%ReferenceError%":l3,"%Reflect%":typeof Reflect>"u"?me:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?me:Set,"%SetIteratorPrototype%":typeof Set>"u"||!Un||!_t?me:_t(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?me:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":Un&&_t?_t(""[Symbol.iterator]()):me,"%Symbol%":Un?Symbol:me,"%SyntaxError%":Dn,"%ThrowTypeError%":y3,"%TypedArray%":v3,"%TypeError%":Ln,"%Uint8Array%":typeof Uint8Array>"u"?me:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?me:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?me:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?me:Uint32Array,"%URIError%":c3,"%WeakMap%":typeof WeakMap>"u"?me:WeakMap,"%WeakRef%":typeof WeakRef>"u"?me:WeakRef,"%WeakSet%":typeof WeakSet>"u"?me:WeakSet,"%Function.prototype.call%":kc,"%Function.prototype.apply%":sk,"%Object.defineProperty%":x3,"%Object.getPrototypeOf%":_3,"%Math.abs%":u3,"%Math.floor%":h3,"%Math.max%":d3,"%Math.min%":f3,"%Math.pow%":p3,"%Math.round%":m3,"%Math.sign%":g3,"%Reflect.getPrototypeOf%":b3};if(_t)try{null.error}catch(r){ek=_t(_t(r)),js["%Error.prototype%"]=ek}var ek,T3=function r(e){var t;if(e==="%AsyncFunction%")t=R_("async function () {}");else if(e==="%GeneratorFunction%")t=R_("function* () {}");else if(e==="%AsyncGeneratorFunction%")t=R_("async function* () {}");else if(e==="%AsyncGenerator%"){var i=r("%AsyncGeneratorFunction%");i&&(t=i.prototype)}else if(e==="%AsyncIteratorPrototype%"){var s=r("%AsyncGenerator%");s&&_t&&(t=_t(s.prototype))}return js[e]=t,t},tk={__proto__:null,"%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"]},Fc=Ic(),Yf=JB(),S3=Fc.call(kc,Array.prototype.concat),w3=Fc.call(sk,Array.prototype.splice),rk=Fc.call(kc,String.prototype.replace),qf=Fc.call(kc,String.prototype.slice),E3=Fc.call(kc,RegExp.prototype.exec),A3=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,P3=/\\(\\)?/g,C3=function(e){var t=qf(e,0,1),i=qf(e,-1);if(t==="%"&&i!=="%")throw new Dn("invalid intrinsic syntax, expected closing `%`");if(i==="%"&&t!=="%")throw new Dn("invalid intrinsic syntax, expected opening `%`");var s=[];return rk(e,A3,function(o,n,a,l){s[s.length]=a?rk(l,P3,"$1"):n||o}),s},M3=function(e,t){var i=e,s;if(Yf(tk,i)&&(s=tk[i],i="%"+s[0]+"%"),Yf(js,i)){var o=js[i];if(o===Gn&&(o=T3(i)),typeof o>"u"&&!t)throw new Ln("intrinsic "+e+" exists, but is not available. Please file an issue!");return{alias:s,name:i,value:o}}throw new Dn("intrinsic "+e+" does not exist!")};ok.exports=function(e,t){if(typeof e!="string"||e.length===0)throw new Ln("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof t!="boolean")throw new Ln('"allowMissing" argument must be a boolean');if(E3(/^%?[^%]*%?$/,e)===null)throw new Dn("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var i=C3(e),s=i.length>0?i[0]:"",o=M3("%"+s+"%",t),n=o.name,a=o.value,l=!1,c=o.alias;c&&(s=c[0],w3(i,S3([0,1],c)));for(var u=1,h=!0;u=i.length){var m=Bc(a,d);h=!!m,h&&"get"in m&&!("originalValue"in m.get)?a=m.get:a=a[d]}else h=Yf(a,d),a=a[d];h&&!l&&(js[n]=a)}}return a}});var B_=ee((ibe,lk)=>{"use strict";var nk=Kf(),ak=C_(),R3=ak([nk("%String.prototype.indexOf%")]);lk.exports=function(e,t){var i=nk(e,!!t);return typeof i=="function"&&R3(e,".prototype.")>-1?ak([i]):i}});var k_=ee((sbe,uk)=>{"use strict";var I3=Kf(),Oc=B_(),B3=Rc(),k3=$s(),ck=I3("%Map%",!0),F3=Oc("Map.prototype.get",!0),O3=Oc("Map.prototype.set",!0),U3=Oc("Map.prototype.has",!0),G3=Oc("Map.prototype.delete",!0),L3=Oc("Map.prototype.size",!0);uk.exports=!!ck&&function(){var e,t={assert:function(i){if(!t.has(i))throw new k3("Side channel does not contain "+B3(i))},delete:function(i){if(e){var s=G3(e,i);return L3(e)===0&&(e=void 0),s}return!1},get:function(i){if(e)return F3(e,i)},has:function(i){return e?U3(e,i):!1},set:function(i,s){e||(e=new ck),O3(e,i,s)}};return t}});var dk=ee((obe,hk)=>{"use strict";var D3=Kf(),Qf=B_(),N3=Rc(),Zf=k_(),H3=$s(),Nn=D3("%WeakMap%",!0),V3=Qf("WeakMap.prototype.get",!0),W3=Qf("WeakMap.prototype.set",!0),z3=Qf("WeakMap.prototype.has",!0),$3=Qf("WeakMap.prototype.delete",!0);hk.exports=Nn?function(){var e,t,i={assert:function(s){if(!i.has(s))throw new H3("Side channel does not contain "+N3(s))},delete:function(s){if(Nn&&s&&(typeof s=="object"||typeof s=="function")){if(e)return $3(e,s)}else if(Zf&&t)return t.delete(s);return!1},get:function(s){return Nn&&s&&(typeof s=="object"||typeof s=="function")&&e?V3(e,s):t&&t.get(s)},has:function(s){return Nn&&s&&(typeof s=="object"||typeof s=="function")&&e?z3(e,s):!!t&&t.has(s)},set:function(s,o){Nn&&s&&(typeof s=="object"||typeof s=="function")?(e||(e=new Nn),W3(e,s,o)):Zf&&(t||(t=Zf()),t.set(s,o))}};return i}:Zf});var pk=ee((nbe,fk)=>{"use strict";var X3=$s(),j3=Rc(),Y3=VI(),q3=k_(),K3=dk(),Z3=K3||q3||Y3;fk.exports=function(){var e,t={assert:function(i){if(!t.has(i))throw new X3("Side channel does not contain "+j3(i))},delete:function(i){return!!e&&e.delete(i)},get:function(i){return e&&e.get(i)},has:function(i){return!!e&&e.has(i)},set:function(i,s){e||(e=Z3()),e.set(i,s)}};return t}});var Jf=ee((abe,mk)=>{"use strict";var Q3=String.prototype.replace,J3=/%20/g,F_={RFC1738:"RFC1738",RFC3986:"RFC3986"};mk.exports={default:F_.RFC3986,formatters:{RFC1738:function(r){return Q3.call(r,J3,"+")},RFC3986:function(r){return String(r)}},RFC1738:F_.RFC1738,RFC3986:F_.RFC3986}});var G_=ee((lbe,xk)=>{"use strict";var eH=Jf(),O_=Object.prototype.hasOwnProperty,Ys=Array.isArray,ri=function(){for(var r=[],e=0;e<256;++e)r.push("%"+((e<16?"0":"")+e.toString(16)).toUpperCase());return r}(),tH=function(e){for(;e.length>1;){var t=e.pop(),i=t.obj[t.prop];if(Ys(i)){for(var s=[],o=0;o=U_?n.slice(l,l+U_):n,u=[],h=0;h=48&&d<=57||d>=65&&d<=90||d>=97&&d<=122||o===eH.RFC1738&&(d===40||d===41)){u[u.length]=c.charAt(h);continue}if(d<128){u[u.length]=ri[d];continue}if(d<2048){u[u.length]=ri[192|d>>6]+ri[128|d&63];continue}if(d<55296||d>=57344){u[u.length]=ri[224|d>>12]+ri[128|d>>6&63]+ri[128|d&63];continue}h+=1,d=65536+((d&1023)<<10|c.charCodeAt(h)&1023),u[u.length]=ri[240|d>>18]+ri[128|d>>12&63]+ri[128|d>>6&63]+ri[128|d&63]}a+=u.join("")}return a},nH=function(e){for(var t=[{obj:{o:e},prop:"o"}],i=[],s=0;s{"use strict";var _k=pk(),ep=G_(),Uc=Jf(),hH=Object.prototype.hasOwnProperty,bk={brackets:function(e){return e+"[]"},comma:"comma",indices:function(e,t){return e+"["+t+"]"},repeat:function(e){return e}},ii=Array.isArray,dH=Array.prototype.push,vk=function(r,e){dH.apply(r,ii(e)?e:[e])},fH=Date.prototype.toISOString,yk=Uc.default,ft={addQueryPrefix:!1,allowDots:!1,allowEmptyArrays:!1,arrayFormat:"indices",charset:"utf-8",charsetSentinel:!1,commaRoundTrip:!1,delimiter:"&",encode:!0,encodeDotInKeys:!1,encoder:ep.encode,encodeValuesOnly:!1,filter:void 0,format:yk,formatter:Uc.formatters[yk],indices:!1,serializeDate:function(e){return fH.call(e)},skipNulls:!1,strictNullHandling:!1},pH=function(e){return typeof e=="string"||typeof e=="number"||typeof e=="boolean"||typeof e=="symbol"||typeof e=="bigint"},L_={},mH=function r(e,t,i,s,o,n,a,l,c,u,h,d,f,p,m,g,_,v){for(var x=e,T=v,b=0,E=!1;(T=T.get(L_))!==void 0&&!E;){var w=T.get(e);if(b+=1,typeof w<"u"){if(w===b)throw new RangeError("Cyclic object value");E=!0}typeof T.get(L_)>"u"&&(b=0)}if(typeof u=="function"?x=u(t,x):x instanceof Date?x=f(x):i==="comma"&&ii(x)&&(x=ep.maybeMap(x,function(Y){return Y instanceof Date?f(Y):Y})),x===null){if(n)return c&&!g?c(t,ft.encoder,_,"key",p):t;x=""}if(pH(x)||ep.isBuffer(x)){if(c){var I=g?t:c(t,ft.encoder,_,"key",p);return[m(I)+"="+m(c(x,ft.encoder,_,"value",p))]}return[m(t)+"="+m(String(x))]}var B=[];if(typeof x>"u")return B;var C;if(i==="comma"&&ii(x))g&&c&&(x=ep.maybeMap(x,c)),C=[{value:x.length>0?x.join(",")||null:void 0}];else if(ii(u))C=u;else{var A=Object.keys(x);C=h?A.sort(h):A}var P=l?String(t).replace(/\./g,"%2E"):String(t),R=s&&ii(x)&&x.length===1?P+"[]":P;if(o&&ii(x)&&x.length===0)return R+"[]";for(var M=0;M"u"?e.encodeDotInKeys===!0?!0:ft.allowDots:!!e.allowDots;return{addQueryPrefix:typeof e.addQueryPrefix=="boolean"?e.addQueryPrefix:ft.addQueryPrefix,allowDots:a,allowEmptyArrays:typeof e.allowEmptyArrays=="boolean"?!!e.allowEmptyArrays:ft.allowEmptyArrays,arrayFormat:n,charset:t,charsetSentinel:typeof e.charsetSentinel=="boolean"?e.charsetSentinel:ft.charsetSentinel,commaRoundTrip:!!e.commaRoundTrip,delimiter:typeof e.delimiter>"u"?ft.delimiter:e.delimiter,encode:typeof e.encode=="boolean"?e.encode:ft.encode,encodeDotInKeys:typeof e.encodeDotInKeys=="boolean"?e.encodeDotInKeys:ft.encodeDotInKeys,encoder:typeof e.encoder=="function"?e.encoder:ft.encoder,encodeValuesOnly:typeof e.encodeValuesOnly=="boolean"?e.encodeValuesOnly:ft.encodeValuesOnly,filter:o,format:i,formatter:s,serializeDate:typeof e.serializeDate=="function"?e.serializeDate:ft.serializeDate,skipNulls:typeof e.skipNulls=="boolean"?e.skipNulls:ft.skipNulls,sort:typeof e.sort=="function"?e.sort:null,strictNullHandling:typeof e.strictNullHandling=="boolean"?e.strictNullHandling:ft.strictNullHandling}};Tk.exports=function(r,e){var t=r,i=gH(e),s,o;typeof i.filter=="function"?(o=i.filter,t=o("",t)):ii(i.filter)&&(o=i.filter,s=o);var n=[];if(typeof t!="object"||t===null)return"";var a=bk[i.arrayFormat],l=a==="comma"&&i.commaRoundTrip;s||(s=Object.keys(t)),i.sort&&s.sort(i.sort);for(var c=_k(),u=0;u0?p+f:""}});var Pk=ee((ube,Ak)=>{"use strict";var qs=G_(),D_=Object.prototype.hasOwnProperty,wk=Array.isArray,Qe={allowDots:!1,allowEmptyArrays:!1,allowPrototypes:!1,allowSparse:!1,arrayLimit:20,charset:"utf-8",charsetSentinel:!1,comma:!1,decodeDotInKeys:!1,decoder:qs.decode,delimiter:"&",depth:5,duplicates:"combine",ignoreQueryPrefix:!1,interpretNumericEntities:!1,parameterLimit:1e3,parseArrays:!0,plainObjects:!1,strictDepth:!1,strictNullHandling:!1,throwOnLimitExceeded:!1},xH=function(r){return r.replace(/&#(\d+);/g,function(e,t){return String.fromCharCode(parseInt(t,10))})},Ek=function(r,e,t){if(r&&typeof r=="string"&&e.comma&&r.indexOf(",")>-1)return r.split(",");if(e.throwOnLimitExceeded&&t>=e.arrayLimit)throw new RangeError("Array limit exceeded. Only "+e.arrayLimit+" element"+(e.arrayLimit===1?"":"s")+" allowed in an array.");return r},yH="utf8=%26%2310003%3B",_H="utf8=%E2%9C%93",bH=function(e,t){var i={__proto__:null},s=t.ignoreQueryPrefix?e.replace(/^\?/,""):e;s=s.replace(/%5B/gi,"[").replace(/%5D/gi,"]");var o=t.parameterLimit===1/0?void 0:t.parameterLimit,n=s.split(t.delimiter,t.throwOnLimitExceeded?o+1:o);if(t.throwOnLimitExceeded&&n.length>o)throw new RangeError("Parameter limit exceeded. Only "+o+" parameter"+(o===1?"":"s")+" allowed.");var a=-1,l,c=t.charset;if(t.charsetSentinel)for(l=0;l-1&&(p=wk(p)?[p]:p);var m=D_.call(i,f);m&&t.duplicates==="combine"?i[f]=qs.combine(i[f],p):(!m||t.duplicates==="last")&&(i[f]=p)}return i},vH=function(r,e,t,i){var s=0;if(r.length>0&&r[r.length-1]==="[]"){var o=r.slice(0,-1).join("");s=Array.isArray(e)&&e[o]?e[o].length:0}for(var n=i?e:Ek(e,t,s),a=r.length-1;a>=0;--a){var l,c=r[a];if(c==="[]"&&t.parseArrays)l=t.allowEmptyArrays&&(n===""||t.strictNullHandling&&n===null)?[]:qs.combine([],n);else{l=t.plainObjects?{__proto__:null}:{};var u=c.charAt(0)==="["&&c.charAt(c.length-1)==="]"?c.slice(1,-1):c,h=t.decodeDotInKeys?u.replace(/%2E/g,"."):u,d=parseInt(h,10);!t.parseArrays&&h===""?l={0:n}:!isNaN(d)&&c!==h&&String(d)===h&&d>=0&&t.parseArrays&&d<=t.arrayLimit?(l=[],l[d]=n):h!=="__proto__"&&(l[h]=n)}n=l}return n},TH=function(e,t,i,s){if(e){var o=i.allowDots?e.replace(/\.([^.[]+)/g,"[$1]"):e,n=/(\[[^[\]]*])/,a=/(\[[^[\]]*])/g,l=i.depth>0&&n.exec(o),c=l?o.slice(0,l.index):o,u=[];if(c){if(!i.plainObjects&&D_.call(Object.prototype,c)&&!i.allowPrototypes)return;u.push(c)}for(var h=0;i.depth>0&&(l=a.exec(o))!==null&&h"u"?Qe.charset:e.charset,i=typeof e.duplicates>"u"?Qe.duplicates:e.duplicates;if(i!=="combine"&&i!=="first"&&i!=="last")throw new TypeError("The duplicates option must be either combine, first, or last");var s=typeof e.allowDots>"u"?e.decodeDotInKeys===!0?!0:Qe.allowDots:!!e.allowDots;return{allowDots:s,allowEmptyArrays:typeof e.allowEmptyArrays=="boolean"?!!e.allowEmptyArrays:Qe.allowEmptyArrays,allowPrototypes:typeof e.allowPrototypes=="boolean"?e.allowPrototypes:Qe.allowPrototypes,allowSparse:typeof e.allowSparse=="boolean"?e.allowSparse:Qe.allowSparse,arrayLimit:typeof e.arrayLimit=="number"?e.arrayLimit:Qe.arrayLimit,charset:t,charsetSentinel:typeof e.charsetSentinel=="boolean"?e.charsetSentinel:Qe.charsetSentinel,comma:typeof e.comma=="boolean"?e.comma:Qe.comma,decodeDotInKeys:typeof e.decodeDotInKeys=="boolean"?e.decodeDotInKeys:Qe.decodeDotInKeys,decoder:typeof e.decoder=="function"?e.decoder:Qe.decoder,delimiter:typeof e.delimiter=="string"||qs.isRegExp(e.delimiter)?e.delimiter:Qe.delimiter,depth:typeof e.depth=="number"||e.depth===!1?+e.depth:Qe.depth,duplicates:i,ignoreQueryPrefix:e.ignoreQueryPrefix===!0,interpretNumericEntities:typeof e.interpretNumericEntities=="boolean"?e.interpretNumericEntities:Qe.interpretNumericEntities,parameterLimit:typeof e.parameterLimit=="number"?e.parameterLimit:Qe.parameterLimit,parseArrays:e.parseArrays!==!1,plainObjects:typeof e.plainObjects=="boolean"?e.plainObjects:Qe.plainObjects,strictDepth:typeof e.strictDepth=="boolean"?!!e.strictDepth:Qe.strictDepth,strictNullHandling:typeof e.strictNullHandling=="boolean"?e.strictNullHandling:Qe.strictNullHandling,throwOnLimitExceeded:typeof e.throwOnLimitExceeded=="boolean"?e.throwOnLimitExceeded:!1}};Ak.exports=function(r,e){var t=SH(e);if(r===""||r===null||typeof r>"u")return t.plainObjects?{__proto__:null}:{};for(var i=typeof r=="string"?bH(r,t):r,s=t.plainObjects?{__proto__:null}:{},o=Object.keys(i),n=0;n{"use strict";var wH=Sk(),EH=Pk(),AH=Jf();Ck.exports={formats:AH,parse:EH,stringify:wH}});var kk=ee(Vn=>{"use strict";var PH=yI();function Tr(){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 CH=/^([a-z0-9.+-]+:)/i,MH=/:[0-9]*$/,RH=/^(\/\/?(?!\/)[^?\s]*)(\?[^\s]*)?$/,IH=["<",">",'"',"`"," ","\r",` +`," "],BH=["{","}","|","\\","^","`"].concat(IH),N_=["'"].concat(BH),Rk=["%","/","?",";","#"].concat(N_),Ik=["/","?","#"],kH=255,Bk=/^[+a-z0-9A-Z_-]{0,63}$/,FH=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,OH={javascript:!0,"javascript:":!0},H_={javascript:!0,"javascript:":!0},Hn={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},V_=Mk();function Gc(r,e,t){if(r&&typeof r=="object"&&r instanceof Tr)return r;var i=new Tr;return i.parse(r,e,t),i}Tr.prototype.parse=function(r,e,t){if(typeof r!="string")throw new TypeError("Parameter 'url' must be a string, not "+typeof r);var i=r.indexOf("?"),s=i!==-1&&i127?b+="x":b+=T[E];if(!b.match(Bk)){var I=v.slice(0,f),B=v.slice(f+1),C=T.match(FH);C&&(I.push(C[1]),B.unshift(C[2])),B.length&&(a="/"+B.join(".")+a),this.hostname=I.join(".");break}}}this.hostname.length>kH?this.hostname="":this.hostname=this.hostname.toLowerCase(),_||(this.hostname=PH.toASCII(this.hostname));var A=this.port?":"+this.port:"",P=this.hostname||"";this.host=P+A,this.href+=this.host,_&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),a[0]!=="/"&&(a="/"+a))}if(!OH[u])for(var f=0,x=N_.length;f0?t.host.split("@"):!1;b&&(t.auth=b.shift(),t.hostname=b.shift(),t.host=t.hostname)}return t.search=r.search,t.query=r.query,(t.pathname!==null||t.search!==null)&&(t.path=(t.pathname?t.pathname:"")+(t.search?t.search:"")),t.href=t.format(),t}if(!v.length)return t.pathname=null,t.search?t.path="/"+t.search:t.path=null,t.href=t.format(),t;for(var E=v.slice(-1)[0],w=(t.host||r.host||v.length>1)&&(E==="."||E==="..")||E==="",I=0,B=v.length;B>=0;B--)E=v[B],E==="."?v.splice(B,1):E===".."?(v.splice(B,1),I++):I&&(v.splice(B,1),I--);if(!g&&!_)for(;I--;I)v.unshift("..");g&&v[0]!==""&&(!v[0]||v[0].charAt(0)!=="/")&&v.unshift(""),w&&v.join("/").substr(-1)!=="/"&&v.push("");var C=v[0]===""||v[0]&&v[0].charAt(0)==="/";if(T){t.hostname=C?"":v.length?v.shift():"",t.host=t.hostname;var b=t.host&&t.host.indexOf("@")>0?t.host.split("@"):!1;b&&(t.auth=b.shift(),t.hostname=b.shift(),t.host=t.hostname)}return g=g||t.host&&v.length,g&&!C&&v.unshift(""),v.length>0?t.pathname=v.join("/"):(t.pathname=null,t.path=null),(t.pathname!==null||t.search!==null)&&(t.path=(t.pathname?t.pathname:"")+(t.search?t.search:"")),t.auth=r.auth||t.auth,t.slashes=t.slashes||r.slashes,t.href=t.format(),t};Tr.prototype.parseHost=function(){var r=this.host,e=MH.exec(r);e&&(e=e[0],e!==":"&&(this.port=e.substr(1)),r=r.substr(0,r.length-e.length)),r&&(this.hostname=r)};Vn.parse=Gc;Vn.resolve=GH;Vn.resolveObject=LH;Vn.format=UH;Vn.Url=Tr});var QF=()=>{let r=new Map,e=l=>typeof l=="string"&&l.startsWith("blob:"),t=l=>typeof l?.type=="string"&&(l.type.startsWith("image/")||l.type.startsWith("video/"))&&typeof l?.url=="string"&&!e(l.url);return{load:async l=>{let c=[];for(let[u,h]of Object.entries(l))r.has(u)||c.push([u,h]);c.length>0&&await Promise.all(c.map(async([u,h])=>{if(t(h)){r.set(u,{url:h.url,type:h.type,source:"url"});return}let p={buffer:await(await fetch(h.url)).arrayBuffer(),type:h.type,source:"buffer"};r.set(u,p)}))},getBufferMap:()=>{let l={};for(let[c,u]of r.entries())l[c]=u;return l},clear:()=>r.clear(),size:()=>r.size,has:l=>r.has(l)}};U();var cA={extension:{type:S.Environment,name:"browser",priority:-1},test:()=>!0,load:async()=>{await Promise.resolve().then(()=>(lA(),nU))}};U();var hA={extension:{type:S.Environment,name:"webworker",priority:0},test:()=>typeof self<"u"&&self.WorkerGlobalScope!==void 0,load:async()=>{await Promise.resolve().then(()=>(uA(),aU))}};U();eh();Yu();U();Re();ll();var Yh;function xA(r){return Yh!==void 0||(Yh=(()=>{let e={stencil:!0,failIfMajorPerformanceCaveat:r??qi.defaultOptions.failIfMajorPerformanceCaveat};try{if(!j.get().getWebGLRenderingContext())return!1;let i=j.get().createCanvas().getContext("webgl",e),s=!!i?.getContextAttributes()?.stencil;if(i){let o=i.getExtension("WEBGL_lose_context");o&&o.loseContext()}return i=null,s}catch{return!1}})()),Yh}Re();var qh;async function yA(r={}){return qh!==void 0||(qh=await(async()=>{let e=j.get().getNavigator().gpu;if(!e)return!1;try{return await(await e.requestAdapter(r)).requestDevice(),!0}catch{return!1}})()),qh}ll();var RC=["webgl","webgpu","canvas"];async function IC(r){let e=[];r.preference?(e.push(r.preference),RC.forEach(o=>{o!==r.preference&&e.push(o)})):e=RC.slice();let t,i={};for(let o=0;o(iP(),rP));t=a,i={...r,...r.webgpu};break}else if(n==="webgl"&&xA(r.failIfMajorPerformanceCaveat??qi.defaultOptions.failIfMajorPerformanceCaveat)){let{WebGLRenderer:a}=await Promise.resolve().then(()=>(MC(),CC));t=a,i={...r,...r.webgl};break}else if(n==="canvas")throw i={...r},new Error("CanvasRenderer is not yet implemented")}if(delete i.webgpu,delete i.webgl,!t)throw new Error("No available renderer for the current environment");let s=new t;return await s.init(i),s}Pr();Ax();Xe();var BC=class py{constructor(...e){this.stage=new te,e[0]!==void 0&&X(ie,"Application constructor options are deprecated, please use Application.init() instead.")}async init(e){e={...e},this.renderer=await IC(e),py._plugins.forEach(t=>{t.init.call(this,e)})}render(){this.renderer.render({container:this.stage})}get canvas(){return this.renderer.canvas}get view(){return X(ie,"Application.view is deprecated, please use Application.canvas instead."),this.renderer.canvas}get screen(){return this.renderer.screen}destroy(e=!1,t=!1){let i=py._plugins.slice(0);i.reverse(),i.forEach(s=>{s.destroy.call(this)}),this.stage.destroy(t),this.stage=null,this.renderer.destroy(e),this.renderer=null}};BC._plugins=[];var ic=BC;V.handleByList(S.Application,ic._plugins);V.add(yl);U();Di();Am();Re();U();Ts();ut();ve();tx();nx();var sc=class extends Ko{constructor(e,t){super();let{textures:i,data:s}=e;Object.keys(s.pages).forEach(o=>{let n=s.pages[parseInt(o,10)],a=i[n.id];this.pages.push({texture:a})}),Object.keys(s.chars).forEach(o=>{let n=s.chars[o],{frame:a,source:l}=i[n.page],c=new Q(n.x+a.x,n.y+a.y,n.width,n.height),u=new k({source:l,frame:c});this.chars[o]={id:o.codePointAt(0),xOffset:n.xOffset,yOffset:n.yOffset,xAdvance:n.xAdvance,kerning:n.kerning??{},texture:u}}),this.baseRenderedFontSize=s.fontSize,this.baseMeasurementFontSize=s.fontSize,this.fontMetrics={ascent:0,descent:0,fontSize:s.fontSize},this.baseLineOffset=s.baseLineOffset,this.lineHeight=s.lineHeight,this.fontFamily=s.fontFamily,this.distanceField=s.distanceField??{type:"none",range:0},this.url=t}destroy(){super.destroy();for(let e=0;e")?my.test(j.get().parseXML(r)):!1},parse(r){return my.parse(j.get().parseXML(r))}};var HU=[".xml",".fnt"],kC={extension:{type:S.CacheParser,name:"cacheBitmapFont"},test:r=>r instanceof sc,getCacheableAssets(r,e){let t={};return r.forEach(i=>{t[i]=e,t[`${i}-bitmap`]=e}),t[`${e.fontFamily}-bitmap`]=e,t}},FC={extension:{type:S.LoadParser,priority:Dt.Normal},name:"loadBitmapFont",test(r){return HU.includes(dt.extname(r).toLowerCase())},async testParse(r){return bd.test(r)||gy.test(r)},async parse(r,e,t){let i=bd.test(r)?bd.parse(r):gy.parse(r),{src:s}=e,{pages:o}=i,n=[],a=i.distanceField?{scaleMode:"linear",alphaMode:"premultiply-alpha-on-upload",autoGenerateMipmaps:!1,resolution:1}:{};for(let h=0;hl[h.src]);return new sc({data:i,textures:c},s)},async load(r,e){return await(await j.get().fetch(r)).text()},async unload(r,e,t){await Promise.all(r.pages.map(i=>t.unload(i.texture.source._sourceOrigin))),r.destroy()}};Ae();var vd=class{constructor(e,t=!1){this._loader=e,this._assetList=[],this._isLoading=!1,this._maxConcurrent=1,this.verbose=t}add(e){e.forEach(t=>{this._assetList.push(t)}),this.verbose&&console.log("[BackgroundLoader] assets: ",this._assetList),this._isActive&&!this._isLoading&&this._next()}async _next(){if(this._assetList.length&&this._isActive){this._isLoading=!0;let e=[],t=Math.min(this._assetList.length,this._maxConcurrent);for(let i=0;iArray.isArray(r)&&r.every(e=>e instanceof k),getCacheableAssets:(r,e)=>{let t={};return r.forEach(i=>{e.forEach((s,o)=>{t[i+(o===0?"":o+1)]=s})}),t}};U();async function Td(r){if("Image"in globalThis)return new Promise(e=>{let t=new Image;t.onload=()=>{e(!0)},t.onerror=()=>{e(!1)},t.src=r});if("createImageBitmap"in globalThis&&"fetch"in globalThis){try{let e=await(await fetch(r)).blob();await createImageBitmap(e)}catch{return!1}return!0}return!1}var UC={extension:{type:S.DetectionParser,priority:1},test:async()=>Td("data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAAB0AAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAIAAAACAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQ0MAAAAABNjb2xybmNseAACAAIAAYAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAACVtZGF0EgAKCBgANogQEAwgMg8f8D///8WfhwB8+ErK42A="),add:async r=>[...r,"avif"],remove:async r=>r.filter(e=>e!=="avif")};U();var GC=["png","jpg","jpeg"],LC={extension:{type:S.DetectionParser,priority:-1},test:()=>Promise.resolve(!0),add:async r=>[...r,...GC],remove:async r=>r.filter(e=>!GC.includes(e))};U();var VU="WorkerGlobalScope"in globalThis&&globalThis instanceof globalThis.WorkerGlobalScope;function dn(r){return VU?!1:document.createElement("video").canPlayType(r)!==""}var DC={extension:{type:S.DetectionParser,priority:0},test:async()=>dn("video/mp4"),add:async r=>[...r,"mp4","m4v"],remove:async r=>r.filter(e=>e!=="mp4"&&e!=="m4v")};U();var NC={extension:{type:S.DetectionParser,priority:0},test:async()=>dn("video/ogg"),add:async r=>[...r,"ogv"],remove:async r=>r.filter(e=>e!=="ogv")};U();var HC={extension:{type:S.DetectionParser,priority:0},test:async()=>dn("video/webm"),add:async r=>[...r,"webm"],remove:async r=>r.filter(e=>e!=="webm")};U();var VC={extension:{type:S.DetectionParser,priority:0},test:async()=>Td("data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAAAAAAfQ//73v/+BiOh/AAA="),add:async r=>[...r,"webp"],remove:async r=>r.filter(e=>e!=="webp")};Ae();Ts();Aa();ju();var Sd=class{constructor(){this._parsers=[],this._parsersValidated=!1,this.parsers=new Proxy(this._parsers,{set:(e,t,i)=>(this._parsersValidated=!1,e[t]=i,!0)}),this.promiseCache={}}reset(){this._parsersValidated=!1,this.promiseCache={}}_getLoadPromiseAndParser(e,t){let i={promise:null,parser:null};return i.promise=(async()=>{let s=null,o=null;if(t.loadParser&&(o=this._parserHash[t.loadParser],o||W(`[Assets] specified load parser "${t.loadParser}" not found while loading ${e}`)),!o){for(let n=0;n({alias:[c],src:c,data:{}})),a=n.length,l=n.map(async c=>{let u=dt.toAbsolute(c.src);if(!s[c.src])try{this.promiseCache[u]||(this.promiseCache[u]=this._getLoadPromiseAndParser(u,c)),s[c.src]=await this.promiseCache[u].promise,t&&t(++i/a)}catch(h){throw delete this.promiseCache[u],delete s[c.src],new Error(`[Loader.load] Failed to load ${u}. ${h}`)}});return await Promise.all(l),o?s[n[0].src]:s}async unload(e){let i=Nt(e,s=>({alias:[s],src:s})).map(async s=>{let o=dt.toAbsolute(s.src),n=this.promiseCache[o];if(n){let a=await n.promise;delete this.promiseCache[o],await n.parser?.unload?.(a,s,this)}});await Promise.all(i)}_validateParsers(){this._parsersValidated=!0,this._parserHash=this._parsers.filter(e=>e.name).reduce((e,t)=>(t.name?e[t.name]&&W(`[Assets] loadParser name conflict "${t.name}"`):W("[Assets] loadParser should have a name"),{...e,[t.name]:t}),{})}};Re();U();function yr(r,e){if(Array.isArray(e)){for(let t of e)if(r.startsWith(`data:${t}`))return!0;return!1}return r.startsWith(`data:${e}`)}Ts();function _r(r,e){let t=r.split("?")[0],i=dt.extname(t).toLowerCase();return Array.isArray(e)?e.includes(i):i===e}Di();var WU=".json",zU="application/json",WC={extension:{type:S.LoadParser,priority:Dt.Low},name:"loadJson",test(r){return yr(r,zU)||_r(r,WU)},async load(r){return await(await j.get().fetch(r)).json()}};Re();U();Di();var $U=".txt",XU="text/plain",zC={name:"loadTxt",extension:{type:S.LoadParser,priority:Dt.Low,name:"loadTxt"},test(r){return yr(r,XU)||_r(r,$U)},async load(r){return await(await j.get().fetch(r)).text()}};Re();U();Ae();Ts();Hi();Di();var jU=["normal","bold","100","200","300","400","500","600","700","800","900"],YU=[".ttf",".otf",".woff",".woff2"],qU=["font/ttf","font/otf","font/woff","font/woff2"],KU=/^(--|-?[A-Z_])[0-9A-Z_-]*$/i;function ZU(r){let e=dt.extname(r),s=dt.basename(r,e).replace(/(-|_)/g," ").toLowerCase().split(" ").map(a=>a.charAt(0).toUpperCase()+a.slice(1)),o=s.length>0;for(let a of s)if(!a.match(KU)){o=!1;break}let n=s.join(" ");return o||(n=`"${n.replace(/[\\"]/g,"\\$&")}"`),n}var QU=/^[0-9A-Za-z%:/?#\[\]@!\$&'()\*\+,;=\-._~]*$/;function JU(r){return QU.test(r)?r:encodeURI(r)}var $C={extension:{type:S.LoadParser,priority:Dt.Low},name:"loadWebFont",test(r){return yr(r,qU)||_r(r,YU)},async load(r,e){let t=j.get().getFontFaceSet();if(t){let i=[],s=e.data?.family??ZU(r),o=e.data?.weights?.filter(a=>jU.includes(a))??["normal"],n=e.data??{};for(let a=0;a{Se.remove(`${e.family}-and-url`),j.get().getFontFaceSet().delete(e)})}};Re();U();Ao();kh();wo();function fn(r,e=1){let t=rr.RETINA_PREFIX?.exec(r);return t?parseFloat(t[1]):e}Di();ve();Ae();Hi();function pn(r,e,t){r.label=t,r._sourceOrigin=t;let i=new k({source:r,label:t}),s=()=>{delete e.promiseCache[t],Se.has(t)&&Se.remove(t)};return i.source.once("destroy",()=>{e.promiseCache[t]&&(W("[Assets] A TextureSource managed by Assets was destroyed instead of unloaded! Use Assets.unload() instead of destroying the TextureSource."),s())}),i.once("destroy",()=>{r.destroyed||(W("[Assets] A Texture managed by Assets was destroyed instead of unloaded! Use Assets.unload() instead of destroying the Texture."),s())}),i}var eG=".svg",tG="image/svg+xml",XC={extension:{type:S.LoadParser,priority:Dt.Low,name:"loadSVG"},name:"loadSVG",config:{crossOrigin:"anonymous",parseAsGraphicsContext:!1},test(r){return yr(r,tG)||_r(r,eG)},async load(r,e,t){return e.data?.parseAsGraphicsContext??this.config.parseAsGraphicsContext?iG(r):rG(r,e,t,this.config.crossOrigin)},unload(r){r.destroy(!0)}};async function rG(r,e,t,i){let o=await(await j.get().fetch(r)).blob(),n=URL.createObjectURL(o),a=new Image;a.src=n,a.crossOrigin=i,await a.decode(),URL.revokeObjectURL(n);let l=document.createElement("canvas"),c=l.getContext("2d"),u=e.data?.resolution||fn(r),h=e.data?.width??a.width,d=e.data?.height??a.height;l.width=h*u,l.height=d*u,c.drawImage(a,0,0,h*u,d*u);let{parseAsGraphicsContext:f,...p}=e.data??{},m=new jt({resource:l,alphaMode:"premultiply-alpha-on-upload",resolution:u,...p});return pn(m,t,r)}async function iG(r){let t=await(await j.get().fetch(r)).text(),i=new Ht;return i.svg(t),i}Re();U();Ao();var sG=`(function () { 'use strict'; @@ -1141,11 +1141,11 @@ ${h}`)}});return await Promise.all(l),o?s[n[0].src]:s}async unload(e){let i=Nt(e }; })(); -`,xn=null,oc=class{constructor(){xn||(xn=URL.createObjectURL(new Blob([oG],{type:"application/javascript"}))),this.worker=new Worker(xn)}};oc.revokeObjectURL=function(){xn&&(URL.revokeObjectURL(xn),xn=null)};var jC=0,xy,yy=class{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(e=>{let{worker:t}=new gn;t.addEventListener("message",i=>{t.terminate(),gn.revokeObjectURL(),e(i.data)})}),this._isImageBitmapSupported)}loadImageBitmap(e,t){return this._run("loadImageBitmap",[e,t?.data?.alphaMode])}async _initWorkers(){this._initialized||(this._initialized=!0)}_getWorker(){xy===void 0&&(xy=navigator.hardwareConcurrency||4);let e=this._workerPool.pop();return!e&&this._createdWorkers{this._complete(t.data),this._returnWorker(t.target),this._next()})),e}_returnWorker(e){this._workerPool.push(e)}_complete(e){e.error!==void 0?this._resolveHash[e.uuid].reject(e.error):this._resolveHash[e.uuid].resolve(e.data),this._resolveHash[e.uuid]=null}async _run(e,t){await this._initWorkers();let i=new Promise((s,o)=>{this._queue.push({id:e,arguments:t,resolve:s,reject:o})});return this._next(),i}_next(){if(!this._queue.length)return;let e=this._getWorker();if(!e)return;let t=this._queue.pop(),i=t.id;this._resolveHash[jC]={resolve:t.resolve,reject:t.reject},e.postMessage({data:t.arguments,uuid:jC++,id:i})}},_y=new yy;Di();var nG=[".jpeg",".jpg",".png",".webp",".avif"],aG=["image/jpeg","image/png","image/webp","image/avif"];async function lG(r,e){let t=await j.get().fetch(r);if(!t.ok)throw new Error(`[loadImageBitmap] Failed to fetch ${r}: ${t.status} ${t.statusText}`);let i=await t.blob();return e?.data?.alphaMode==="premultiplied-alpha"?createImageBitmap(i,{premultiplyAlpha:"none"}):createImageBitmap(i)}var wd={name:"loadTextures",extension:{type:S.LoadParser,priority:Dt.High,name:"loadTextures"},config:{preferWorkers:!0,preferCreateImageBitmap:!0,crossOrigin:"anonymous"},test(r){return yr(r,aG)||_r(r,nG)},async load(r,e,t){let i=null;globalThis.createImageBitmap&&this.config.preferCreateImageBitmap?this.config.preferWorkers&&await _y.isImageBitmapSupported()?i=await _y.loadImageBitmap(r,e):i=await lG(r,e):i=await new Promise((o,n)=>{i=new Image,i.crossOrigin=this.config.crossOrigin,i.src=r,i.complete?o(i):(i.onload=()=>{o(i)},i.onerror=n)});let s=new jt({resource:i,alphaMode:"premultiply-alpha-on-upload",resolution:e.data?.resolution||fn(r),...e.data});return pn(s,t,r)},unload(r){r.destroy(!0)}};U();km();Bm();var YC=[".mp4",".m4v",".webm",".ogg",".ogv",".h264",".avi",".mov"],cG=YC.map(r=>`video/${r.substring(1)}`);function uG(r,e,t){t===void 0&&!e.startsWith("data:")?r.crossOrigin=dG(e):t!==!1&&(r.crossOrigin=typeof t=="string"?t:"anonymous")}function hG(r){return new Promise((e,t)=>{r.addEventListener("canplaythrough",i),r.addEventListener("error",s),r.load();function i(){o(),e()}function s(n){o(),t(n)}function o(){r.removeEventListener("canplaythrough",i),r.removeEventListener("error",s)}})}function dG(r,e=globalThis.location){if(r.startsWith("data:"))return"";e||(e=globalThis.location);let t=new URL(r,document.baseURI);return t.hostname!==e.hostname||t.port!==e.port||t.protocol!==e.protocol?"anonymous":""}var qC={name:"loadVideo",extension:{type:S.LoadParser,name:"loadVideo"},test(r){let e=yr(r,cG),t=_r(r,YC);return e||t},async load(r,e,t){let i={...Po.defaultOptions,resolution:e.data?.resolution||fn(r),alphaMode:e.data?.alphaMode||await Qu(),...e.data},s=document.createElement("video"),o={preload:i.autoLoad!==!1?"auto":void 0,"webkit-playsinline":i.playsinline!==!1?"":void 0,playsinline:i.playsinline!==!1?"":void 0,muted:i.muted===!0?"":void 0,loop:i.loop===!0?"":void 0,autoplay:i.autoPlay!==!1?"":void 0};Object.keys(o).forEach(l=>{let c=o[l];c!==void 0&&s.setAttribute(l,c)}),i.muted===!0&&(s.muted=!0),uG(s,r,i.crossorigin);let n=document.createElement("source"),a;if(r.startsWith("data:"))a=r.slice(5,r.indexOf(";"));else if(!r.startsWith("blob:")){let l=r.split("?")[0].slice(r.lastIndexOf(".")+1).toLowerCase();a=Po.MIME_TYPES[l]||`video/${l}`}return n.src=r,a&&(n.type=a),new Promise(l=>{let c=async()=>{let u=new Po({...i,resource:s});s.removeEventListener("canplay",c),e.data.preload&&await hG(s),l(pn(u,t,r))};s.addEventListener("canplay",c),s.appendChild(n)})},unload(r){r.destroy(!0)}};U();wo();U();wo();var Ed={extension:{type:S.ResolveParser,name:"resolveTexture"},test:wd.test,parse:r=>({resolution:parseFloat(rr.RETINA_PREFIX.exec(r)?.[1]??"1"),format:r.split(".").pop(),src:r})};var KC={extension:{type:S.ResolveParser,priority:-2,name:"resolveJson"},test:r=>rr.RETINA_PREFIX.test(r)&&r.endsWith(".json"),parse:Ed.parse};wo();Aa();ju();var Ad=class{constructor(){this._detections=[],this._initialized=!1,this.resolver=new rr,this.loader=new Sd,this.cache=Se,this._backgroundLoader=new vd(this.loader),this._backgroundLoader.active=!0,this.reset()}async init(e={}){if(this._initialized){W("[Assets]AssetManager already initialized, did you load before calling this Assets.init()?");return}if(this._initialized=!0,e.defaultSearchParams&&this.resolver.setDefaultSearchParams(e.defaultSearchParams),e.basePath&&(this.resolver.basePath=e.basePath),e.bundleIdentifier&&this.resolver.setBundleIdentifier(e.bundleIdentifier),e.manifest){let o=e.manifest;typeof o=="string"&&(o=await this.load(o)),this.resolver.addManifest(o)}let t=e.texturePreference?.resolution??1,i=typeof t=="number"?[t]:t,s=await this._detectFormats({preferredFormats:e.texturePreference?.format,skipDetections:e.skipDetections,detections:this._detections});this.resolver.prefer({params:{format:s,resolution:i}}),e.preferences&&this.setPreferences(e.preferences)}add(e){this.resolver.add(e)}async load(e,t){this._initialized||await this.init();let i=Ss(e),s=Nt(e).map(a=>{if(typeof a!="string"){let l=this.resolver.getAlias(a);return l.some(c=>!this.resolver.hasKey(c))&&this.add(a),Array.isArray(l)?l[0]:l}return this.resolver.hasKey(a)||this.add({alias:a,src:a}),a}),o=this.resolver.resolve(s),n=await this._mapLoadToResolve(o,t);return i?n[s[0]]:n}addBundle(e,t){this.resolver.addBundle(e,t)}async loadBundle(e,t){this._initialized||await this.init();let i=!1;typeof e=="string"&&(i=!0,e=[e]);let s=this.resolver.resolveBundle(e),o={},n=Object.keys(s),a=0,l=0,c=()=>{t?.(++a/l)},u=n.map(h=>{let d=s[h];return l+=Object.keys(d).length,this._mapLoadToResolve(d,c).then(f=>{o[h]=f})});return await Promise.all(u),i?o[e[0]]:o}async backgroundLoad(e){this._initialized||await this.init(),typeof e=="string"&&(e=[e]);let t=this.resolver.resolve(e);this._backgroundLoader.add(Object.values(t))}async backgroundLoadBundle(e){this._initialized||await this.init(),typeof e=="string"&&(e=[e]);let t=this.resolver.resolveBundle(e);Object.values(t).forEach(i=>{this._backgroundLoader.add(Object.values(i))})}reset(){this.resolver.reset(),this.loader.reset(),this.cache.reset(),this._initialized=!1}get(e){if(typeof e=="string")return Se.get(e);let t={};for(let i=0;i{let a=s[n.src],l=[n.src];n.alias&&l.push(...n.alias),l.forEach(c=>{o[c]=a}),Se.set(l,a)}),o}async unload(e){this._initialized||await this.init();let t=Nt(e).map(s=>typeof s!="string"?s.src:s),i=this.resolver.resolve(t);await this._unloadFromResolved(i)}async unloadBundle(e){this._initialized||await this.init(),e=Nt(e);let t=this.resolver.resolveBundle(e),i=Object.keys(t).map(s=>this._unloadFromResolved(t[s]));await Promise.all(i)}async _unloadFromResolved(e){let t=Object.values(e);t.forEach(i=>{Se.remove(i.src)}),await this.loader.unload(t)}async _detectFormats(e){let t=[];e.preferredFormats&&(t=Array.isArray(e.preferredFormats)?e.preferredFormats:[e.preferredFormats]);for(let i of e.detections)e.skipDetections||await i.test()?t=await i.add(t):e.skipDetections||(t=await i.remove(t));return t=t.filter((i,s)=>t.indexOf(i)===s),t}get detections(){return this._detections}setPreferences(e){this.loader.parsers.forEach(t=>{t.config&&Object.keys(t.config).filter(i=>i in e).forEach(i=>{t.config[i]=e[i]})})}},br=new Ad;V.handleByList(S.LoadParser,br.loader.parsers).handleByList(S.ResolveParser,br.resolver.parsers).handleByList(S.CacheParser,br.cache.parsers).handleByList(S.DetectionParser,br.detections);V.add(OC,LC,UC,VC,DC,NC,HC,WC,zC,$C,XC,wd,qC,FC,kC,Ed,KC);var ZC={loader:S.LoadParser,resolver:S.ResolveParser,cache:S.CacheParser,detection:S.DetectionParser};V.handle(S.Asset,r=>{let e=r.ref;Object.entries(ZC).filter(([t])=>!!e[t]).forEach(([t,i])=>V.add(Object.assign(e[t],{extension:e[t].extension??i})))},r=>{let e=r.ref;Object.keys(ZC).filter(t=>!!e[t]).forEach(t=>V.remove(e[t]))});ve();va();So();Ma();var nc=class r extends Te{constructor(...e){let t=e[0];Array.isArray(e[0])&&(t={textures:e[0],autoUpdate:e[1]});let{animationSpeed:i=1,autoPlay:s=!1,autoUpdate:o=!0,loop:n=!0,onComplete:a=null,onFrameChange:l=null,onLoop:c=null,textures:u,updateAnchor:h=!1,...d}=t,[f]=u;super({...d,texture:f instanceof k?f:f.texture}),this._textures=null,this._durations=null,this._autoUpdate=o,this._isConnectedToTicker=!1,this.animationSpeed=i,this.loop=n,this.updateAnchor=h,this.onComplete=a,this.onFrameChange=l,this.onLoop=c,this._currentTime=0,this._playing=!1,this._previousFrame=null,this.textures=u,s&&this.play()}stop(){this._playing&&(this._playing=!1,this._autoUpdate&&this._isConnectedToTicker&&(ht.shared.remove(this.update,this),this._isConnectedToTicker=!1))}play(){this._playing||(this._playing=!0,this._autoUpdate&&!this._isConnectedToTicker&&(ht.shared.add(this.update,this,Dr.HIGH),this._isConnectedToTicker=!0))}gotoAndStop(e){this.stop(),this.currentFrame=e}gotoAndPlay(e){this.currentFrame=e,this.play()}update(e){if(!this._playing)return;let t=e.deltaTime,i=this.animationSpeed*t,s=this.currentFrame;if(this._durations!==null){let o=this._currentTime%1*this._durations[this.currentFrame];for(o+=i/60*1e3;o<0;)this._currentTime--,o+=this._durations[this.currentFrame];let n=Math.sign(this.animationSpeed*t);for(this._currentTime=Math.floor(this._currentTime);o>=this._durations[this.currentFrame];)o-=this._durations[this.currentFrame]*n,this._currentTime+=n;this._currentTime+=o/this._durations[this.currentFrame]}else this._currentTime+=i;this._currentTime<0&&!this.loop?(this.gotoAndStop(0),this.onComplete&&this.onComplete()):this._currentTime>=this._textures.length&&!this.loop?(this.gotoAndStop(this._textures.length-1),this.onComplete&&this.onComplete()):s!==this.currentFrame&&(this.loop&&this.onLoop&&(this.animationSpeed>0&&this.currentFrames)&&this.onLoop(),this._updateTexture())}_updateTexture(){let e=this.currentFrame;this._previousFrame!==e&&(this._previousFrame=e,this.texture=this._textures[e],this.updateAnchor&&this.texture.defaultAnchor&&this.anchor.copyFrom(this.texture.defaultAnchor),this.onFrameChange&&this.onFrameChange(this.currentFrame))}destroy(){this.stop(),super.destroy(),this.onComplete=null,this.onFrameChange=null,this.onLoop=null}static fromFrames(e){let t=[];for(let i=0;ithis.totalFrames-1)throw new Error(`[AnimatedSprite]: Invalid frame index value ${e}, expected to be between 0 and totalFrames ${this.totalFrames}.`);let t=this.currentFrame;this._currentTime=e,t!==this.currentFrame&&this._updateTexture()}get playing(){return this._playing}get autoUpdate(){return this._autoUpdate}set autoUpdate(e){e!==this._autoUpdate&&(this._autoUpdate=e,!this._autoUpdate&&this._isConnectedToTicker?(ht.shared.remove(this.update,this),this._isConnectedToTicker=!1):this._autoUpdate&&!this._isConnectedToTicker&&this._playing&&(ht.shared.add(this.update,this),this._isConnectedToTicker=!0))}};Cu();Xe();Xu();var Pd=class extends Li{constructor(e,t){let{text:i,resolution:s,style:o,anchor:n,width:a,height:l,roundPixels:c,...u}=e;super({...u}),this.batched=!0,this._resolution=null,this._autoResolution=!0,this._didTextUpdate=!0,this._styleClass=t,this.text=i??"",this.style=o,this.resolution=s??null,this.allowChildren=!1,this._anchor=new St({_onUpdate:()=>{this.onViewUpdate()}}),n&&(this.anchor=n),this.roundPixels=c??!1,a!==void 0&&(this.width=a),l!==void 0&&(this.height=l)}get anchor(){return this._anchor}set anchor(e){typeof e=="number"?this._anchor.set(e):this._anchor.copyFrom(e)}set text(e){e=e.toString(),this._text!==e&&(this._text=e,this.onViewUpdate())}get text(){return this._text}set resolution(e){this._autoResolution=e===null,this._resolution=e,this.onViewUpdate()}get resolution(){return this._resolution}get style(){return this._style}set style(e){e||(e={}),this._style?.off("update",this.onViewUpdate,this),e instanceof this._styleClass?this._style=e:this._style=new this._styleClass(e),this._style.on("update",this.onViewUpdate,this),this.onViewUpdate()}get width(){return Math.abs(this.scale.x)*this.bounds.width}set width(e){this._setWidth(e,this.bounds.width)}get height(){return Math.abs(this.scale.y)*this.bounds.height}set height(e){this._setHeight(e,this.bounds.height)}getSize(e){return e||(e={}),e.width=Math.abs(this.scale.x)*this.bounds.width,e.height=Math.abs(this.scale.y)*this.bounds.height,e}setSize(e,t){typeof e=="object"?(t=e.height??e.width,e=e.width):t??(t=e),e!==void 0&&this._setWidth(e,this.bounds.width),t!==void 0&&this._setHeight(t,this.bounds.height)}containsPoint(e){let t=this.bounds.width,i=this.bounds.height,s=-t*this.anchor.x,o=0;return e.x>=s&&e.x<=s+t&&(o=-i*this.anchor.y,e.y>=o&&e.y<=o+i)}onViewUpdate(){this.didViewUpdate||(this._didTextUpdate=!0),super.onViewUpdate()}_getKey(){return`${this.text}:${this._style.styleKey}:${this._resolution}`}destroy(e=!1){super.destroy(e),this.owner=null,this._bounds=null,this._anchor=null,(typeof e=="boolean"?e:e?.style)&&this._style.destroy(e),this._style=null,this._text=null}};function QC(r,e){let t=r[0]??{};return(typeof t=="string"||r[1])&&(X(ie,`use new ${e}({ text: "hi!", style }) instead`),t={text:t,style:r[1]}),t}Qa();Bs();var Br=class extends Pd{constructor(...e){let t=QC(e,"Text");super(t,Oe),this.renderPipeId="text"}updateBounds(){let e=this._bounds,t=this._anchor,i=De.measureText(this._text,this._style),{width:s,height:o}=i;e.minX=-t._x*s,e.maxX=e.minX+s,e.minY=-t._y*o,e.maxY=e.minY+o}};xx();ge();ut();It();Fx();ve();Qh();Um();Pr();Qg();Ma();Qa();Bs();Pm();Mt();var fG=fs(mh(),1);V.add(cA,hA);var pG=new(window.AudioContext||window.webkitAudioContext),by={},mG=async(r,e)=>{if(!by[r]&&e.byteLength!==0)try{let t=await pG.decodeAudioData(e);by[r]=t}catch(t){console.error(`AudioAsset.load: Failed to decode ${r}:`,t)}},gG=r=>by[r],yn={load:mG,getAsset:gG};var et=({type:r,add:e,update:t,delete:i,parse:s,shouldUpdateUnchanged:o})=>({type:r,add:e,update:t,delete:i,parse:s,shouldUpdateUnchanged:o});var vy=({type:r})=>({type:r});var Ty=({type:r,add:e,update:t,delete:i})=>({type:r,add:e,update:t,delete:i});var Cd={alpha:"alpha",x:"x",y:"y",scaleX:"scaleX",scaleY:"scaleY",rotation:"rotation"};var Md={scaleX:["scale","x"],scaleY:["scale","y"],x:["x"],y:["y"],alpha:["alpha"],rotation:["rotation"]};var Us={RECT:"rect",TEXT:"text",INPUT:"input",CONTAINER:"container",SPRITE:"sprite",TEXT_REVEALING:"text-revealing",SLIDER:"slider",PARTICLES:"particles",SPRITESHEET_ANIMATION:"spritesheet-animation",VIDEO:"video"};var Ge={fill:"black",fontFamily:"Arial",fontSize:16,align:"left",lineHeight:1.2,wordWrap:!1,breakWords:!1,strokeColor:"transparent",strokeWidth:0,wordWrapWidth:0};var xG=(r={})=>{let e=typeof r.stroke=="object"&&r.stroke!==null?r.stroke:{};return{...e,color:r.strokeColor??e.color??Ge.strokeColor,width:r.strokeWidth??e.width??Ge.strokeWidth}},ir=(r={})=>{let{strokeColor:e,strokeWidth:t,stroke:i,...s}=r;return{...s,stroke:xG({strokeColor:e,strokeWidth:t,stroke:i})}};var Qr=(r,e)=>{let t={fill:e?.fill??Ge.fill,fontFamily:e?.fontFamily??Ge.fontFamily,fontSize:e?.fontSize??Ge.fontSize,align:e?.align??Ge.align,lineHeight:e?.lineHeight??Ge.lineHeight,wordWrap:e?.wordWrap??Ge.wordWrap,breakWords:e?.breakWords??Ge.breakWords,strokeColor:e?.strokeColor??Ge.strokeColor,strokeWidth:e?.strokeWidth??Ge.strokeWidth,wordWrapWidth:e?.wordWrapWidth??Ge.wordWrapWidth};r.style=ir(t)};var We=(r,e=100)=>Math.min(Math.max(r??e,0),100)/100;var yG=(r,e)=>typeof e!="string"?e:r[e]??e,_G=(r,e,t,i)=>{let s=yG(t,e);if(typeof s=="string")return r[s]=i,r;let o=r;for(let n=0;n{for(let i of e)for(let[s,o]of Object.entries(i.tween)){if(!Cd[s])throw new Error(`${s} is not a supported property for animation.`);o.initialValue!==void 0&&_G(r,s,t,o.initialValue)}},Rd=({animations:r,animationBus:e,completionTracker:t,element:i,targetState:s,onComplete:o})=>{for(let n of r){for(let[l,c]of Object.entries(n.tween))if(c.auto&&(!s||!Object.prototype.hasOwnProperty.call(s,l)))throw new Error(`Animation "${n.id}" cannot auto-resolve property "${l}" from targetState.`);let a=t.getVersion();t.track(a),e.dispatch({type:"START",payload:{id:n.id,element:i,properties:n.tween,targetState:s,onComplete:()=>{t.complete(a),o?.(n)}}})}};function Id(r,e){let t=r.text.substring(0,e),s=De.measureText(t,r.style).width;return r.x+s}var bG=async(r,e)=>new Promise((t,i)=>{if(e?.aborted)return i(new DOMException("The operation was aborted.","AbortError"));let s,o=()=>{s&&e?.removeEventListener("abort",s)},n=setTimeout(()=>{o(),t()},r);s=()=>{clearTimeout(n),o(),i(e.reason)},e?.addEventListener("abort",s,{once:!0})}),Sy=bG;var vi=Symbol("textRevealRuntime"),kd=Symbol("textRevealSnapshot"),vG=18,TG=64,SG=1.25,Ey=50,wG=0,Ay=100,wy=Ay-1,eM=10,EG=120,AG=.9,rM=(r=Ey)=>typeof r!="number"||!Number.isFinite(r)?Ey:Math.max(wG,Math.min(Ay,r)),PG=r=>rM(r)>=Ay,iM=r=>{let e=Math.min(rM(r),wy),i=(wy>0?e/wy:0)**AG;return eM*(EG/eM)**i},CG=r=>r?.revealEffect==="softWipe"?"softWipe":"typewriter",_n=r=>r?.revealEffect==="none"||PG(r?.speed??Ey),MG=r=>{let e=new Te(k.EMPTY);if(r?.indicator?.revealing?.src){let t=k.from(r.indicator.revealing.src);e=new Te(t),e.width=r.indicator.revealing.width??t.width,e.height=r.indicator.revealing.height??t.height}return e},lc=(r,e)=>{if(!e?.indicator?.complete?.src)return;let t=k.from(e.indicator.complete.src);r.texture=t,r.width=e.indicator.complete.width??t.width,r.height=e.indicator.complete.height??t.height},cc=(r,e,t)=>{r.x=t,r.y=e?e.y+(e.lineMaxHeight-r.height):0},Bd=(r,e,t)=>{if(!e||e.text.length===0){r.x=t;return}r.x=Id(e,e.text.length-1)+t},RG=(r,e)=>{if(r[vi]){let t=r[vi];delete r[vi],t()}r[vi]=e},IG=r=>r?.[kd]??null,ac=(r,e)=>r?e?(r[kd]=e,e):(delete r[kd],null):null,sM=r=>{let e=IG(r);return!e||e.mode!=="typewriter"||e.completed===!0?null:e},oM=r=>!!sM(r),Py=r=>{if(r[vi]){let t=r[vi];delete r[vi],t()}delete r[kd],r.onRender=void 0,r.removeChildren().forEach(t=>{t.destroy({children:!0})})},nM=(r,e="",t="")=>{let i=new Oe(ir(r.textStyle)),s=new Br({text:e,style:i,x:Math.round(r.x),y:Math.round(r.y)}),o=null;if(r.furigana){let n=new Oe(ir(r.furigana.textStyle));o=new Br({text:t,style:n,x:Math.round(r.furigana.x),y:Math.round(r.furigana.y)})}return{text:s,furiganaText:o}},aM=(r,e)=>{let t=null,i=null,s=0,o=0,n=[];for(let a=0;a0){let f=c.getLocalBounds();n.push({chunk:l,container:c,lastTextObject:h,totalCharacters:d,bounds:{x:f.x,y:f.y,width:f.width,height:f.height}})}else c.destroy()}return{lines:n,lastTextObject:t,lastChunk:i,totalCharacters:s,maxLineHeight:o,bounds:r.getLocalBounds()}},tM=({contentContainer:r,indicatorSprite:e,element:t})=>{let i=t?.indicator?.offset??12,{lastTextObject:s,lastChunk:o}=aM(r,t);cc(e,o,i),Bd(e,s,i),lc(e,t)},BG=({indicatorSprite:r,element:e})=>{let t=e?.indicator?.offset??12,i=e.content[0]??null;cc(r,i,t)},kG=async({contentContainer:r,indicatorSprite:e,element:t,signal:i,startAtCharacter:s=0,snapshot:o=null})=>{let n=iM(t.speed??50),a=t?.indicator?.offset??12,l=Math.max(1,Math.floor(1e3/n)),c=Math.max(1,Math.floor(4e3/n)),u=Math.max(0,Math.floor(s));o&&(o.revealedCharacters=u,o.completed=!1);for(let h=0;h0?Math.round(b/v.length*T):0;g.text=v.substring(0,b),_&&(_.text=x.substring(0,w)),u-=b,b>0&&(e.x=Id(g,b-1)+a);for(let E=b;E{let n=i?.indicator?.offset??12,a=iM(i.speed??50),{lines:l,lastTextObject:c,lastChunk:u,totalCharacters:h,maxLineHeight:d,bounds:f}=aM(e,i);if(cc(t,u,n),l.length===0||h===0||!l.some(C=>C.bounds.width>0&&C.bounds.height>0)||!globalThis.document||!s)return Bd(t,c,n),lc(t,i),!1;let p=Math.max(vG,Math.min(TG,Math.round(d*SG))),m=Math.max(1,Math.round(h/a*1e3)),g=l.map(C=>{let A=Math.max(1,C.totalCharacters),P=1+p/Math.max(1,C.bounds.width);return A*P}),_=g.reduce((C,A)=>C+A,0),v=[],x=0;for(let C=0;C0?x/_:0;x+=A,v.push({...l[C],startProgress:P,endProgress:_>0?x/_:1})}let T=o.getVersion(),b=`${i.id}-soft-wipe`,w=v.map(C=>{let A=document.createElement("canvas");A.width=Math.max(1,Math.ceil(C.bounds.width+p)),A.height=Math.max(1,Math.ceil(C.bounds.height));let P=A.getContext("2d");if(!P)return null;let R=Os(A),M=new Te(R);return M.x=Math.floor(C.bounds.x-p),M.y=Math.floor(C.bounds.y),C.container.mask=M,e.addChild(M),{canvas:A,context:P,texture:R,sprite:M,line:C}});if(w.some(C=>C===null))return w.forEach(C=>{C&&(C.line.container.mask===C.sprite&&(C.line.container.mask=null),C.sprite.parent&&C.sprite.parent.removeChild(C.sprite),C.sprite.destroy(),C.texture.destroy(!0))}),Bd(t,c,n),lc(t,i),!1;let E=!1,I=C=>{E||(E=!0,r[vi]===B&&delete r[vi],w.forEach(A=>{A.line.container.mask===A.sprite&&(A.line.container.mask=null),A.sprite.parent&&A.sprite.parent.removeChild(A.sprite),A.sprite.destroy(),A.texture.destroy(!0)}),C&&(Bd(t,c,n),lc(t,i)))},B=()=>{s.dispatch({type:"CANCEL",id:b}),I(!1)};return RG(r,B),o.track(T),s.dispatch({type:"START",payload:{id:b,driver:"custom",duration:m,applyFrame:C=>{let A=m>0?Math.min(C/m,1):1,P=v[0],R=0;for(let M=0;MJ&&(L.fillStyle="#ffffff",L.fillRect(J,Be,Math.min($e-J,F.bounds.width),F.bounds.height));let it=Math.max(J,Me-p),bt=Math.min(J+F.bounds.width,Me);if(bt>it){let Le=L.createLinearGradient(it,0,bt,0);Le.addColorStop(0,"rgba(255, 255, 255, 1)"),Le.addColorStop(1,"rgba(255, 255, 255, 0)"),L.fillStyle=Le,L.fillRect(it,Be,bt-it,F.bounds.height)}ue.source.update(),(N<1||M===v.length-1)&&(P=F,R=Math.min(1,(Me-J)/Math.max(1,F.bounds.width)))}cc(t,P.chunk,n),t.x=P.bounds.x+Math.min(P.bounds.width,P.bounds.width*R)+n},applyTargetState:()=>{I(!1)},onComplete:()=>{o.complete(T),I(!0)},onCancel:()=>{o.complete(T),I(!1)},isValid:()=>!!r&&!r.destroyed&&!e.destroyed&&!t.destroyed}}),!0},Ti=async({container:r,element:e,completionTracker:t,animationBus:i,zIndex:s,signal:o,playback:n="autoplay"})=>{if(o?.aborted||r.destroyed)return;let a=_n(e),l=n==="resume"?sM(r):null;if(n==="resume"&&!l)return;Py(r),r.zIndex=s;let c=new te({label:`${e.id}-content`}),u=MG(e);r.addChild(c),r.addChild(u);try{if(n==="paused-initial"){a||ac(r,{mode:CG(e),revealedCharacters:0,completed:!1}),a?(ac(r,{mode:"none",completed:!0}),tM({contentContainer:c,indicatorSprite:u,element:e})):BG({indicatorSprite:u,element:e});return}let h=t.getVersion(),d=!1;if(a)t.track(h),ac(r,{mode:"none",completed:!0}),tM({contentContainer:c,indicatorSprite:u,element:e}),d=!0;else if(e.revealEffect==="softWipe")if(ac(r,{mode:"softWipe",completed:!1}),!FG({container:r,contentContainer:c,indicatorSprite:u,element:e,animationBus:i,completionTracker:t})&&!o?.aborted&&!r.destroyed)t.track(h),d=!0;else return;else{t.track(h);let f=ac(r,{mode:"typewriter",revealedCharacters:l?.revealedCharacters??0,completed:!1});d=await kG({contentContainer:c,indicatorSprite:u,element:e,signal:o,startAtCharacter:l?.revealedCharacters??0,snapshot:f})}d&&!o?.aborted&&!r.destroyed&&t.complete(h)}catch(h){if(h?.name!=="AbortError"&&!o?.aborted)throw h}};var Fd=({suppressAnimations:r=!1,deferredMountOperations:e=[]}={})=>({suppressAnimations:r,deferredMountOperations:e}),lM=r=>{switch(r?.type){case"play-animated-sprite":r.animatedSprite?.destroyed||r.animatedSprite?.play();return;case"play-video":r.video?.play();return;case"start-particles":if(r.app?.debug){let e=t=>{if(r.emitter.destroyed){window.removeEventListener("snapShotKeyFrame",e);return}t?.detail?.deltaMS&&(r.emitter.update(Number(t.detail.deltaMS)/1e3),typeof r.app?.render=="function"&&r.app.render())};window.addEventListener("snapShotKeyFrame",e),r.container.customTickerHandler=e;return}r.app.ticker.add(r.tickerCallback);return;case"autoplay-text-reveal":Ti({container:r.container,element:r.element,completionTracker:r.completionTracker,animationBus:r.animationBus,zIndex:r.zIndex,signal:r.signal,playback:"autoplay"});return;case"start-update-animations":if(!r.element||r.element.destroyed)return;Rd({animations:r.animations,animationBus:r.animationBus,completionTracker:r.completionTracker,element:r.element,targetState:r.targetState});return}},uc=(r,e)=>{if(e?.type){if(!r?.suppressAnimations){lM(e);return}r.deferredMountOperations.push(e)}},Od=r=>{r?.deferredMountOperations&&(r.deferredMountOperations.length=0)},cM=(r,e)=>uc(r,{type:"play-animated-sprite",animatedSprite:e}),uM=(r,e)=>uc(r,{type:"play-video",video:e}),hM=(r,{app:e,emitter:t,container:i,tickerCallback:s})=>uc(r,{type:"start-particles",app:e,emitter:t,container:i,tickerCallback:s}),Ud=(r,{container:e,element:t,completionTracker:i,animationBus:s,zIndex:o,signal:n})=>uc(r,{type:"autoplay-text-reveal",container:e,element:t,completionTracker:i,animationBus:s,zIndex:o,signal:n}),dM=(r,{animations:e,animationBus:t,completionTracker:i,element:s,targetState:o})=>uc(r,{type:"start-update-animations",animations:e,animationBus:t,completionTracker:i,element:s,targetState:o}),fM=r=>{if(!r?.deferredMountOperations?.length)return;let e=r.deferredMountOperations.splice(0);for(let t of e)lM(t)};var pM=(r=[])=>{if(r instanceof Map)return r;let e=new Map;for(let t of r)e.has(t.targetId)||e.set(t.targetId,[]),e.get(t.targetId).push(t);return e},Gd=(r,e)=>r instanceof Map?r.get(e)??[]:r.filter(t=>t.targetId===e),OG=(r,e)=>Gd(r,e).filter(t=>t.type==="update"),Ld=(r,e)=>Gd(r,e).find(t=>t.type==="transition")??null,UG=({animations:r,targetId:e,animationBus:t,completionTracker:i,element:s,targetState:o,onComplete:n,renderContext:a})=>{let l=OG(r,e);if(l.length===0)return!1;if(a?.suppressAnimations){if(n)throw new Error("Deferred update animations do not support onComplete hooks.");return JC(s,l),dM(a,{animations:l,animationBus:t,completionTracker:i,element:s,targetState:o}),!0}return Rd({animations:l,animationBus:t,completionTracker:i,element:s,targetState:o,onComplete:n}),!0};var ne=UG;var xM=Symbol("routeGraphicsTextAnchorRatios"),yM=Symbol("routeGraphicsTextLayoutState"),mM=(r,e)=>typeof r!="number"||r===0?0:e/r,Cy=r=>r?.align??Ge.align,gM=r=>{let e=r[yM];return e?.fixedWidth&&typeof e.layoutWidth=="number"?e.layoutWidth:r.width},My=(r,e,t)=>{let i=Math.max(0,r-e);return t==="center"?i/2:t==="right"?i:0},hc=r=>{let e=r.measuredWidth??r.width,t=My(r.width,e,Cy(r.textStyle));return{x:r.x+t,y:r.y}},Dd=(r,e)=>{let t=e.__fixedWidth&&typeof e.width=="number"?e.width:r.width||e.width,i=r.height||e.height,s=typeof e.__anchorXRatio=="number"?e.__anchorXRatio:mM(t,e.originX),o=typeof e.__anchorYRatio=="number"?e.__anchorYRatio:mM(i,e.originY);r[xM]={x:s,y:o},r[yM]={fixedWidth:!!e.__fixedWidth,layoutWidth:e.width}},GG=r=>typeof r?.fontSize!="number"||r.fontSize===0||typeof r?.lineHeight!="number"?Ge.lineHeight:r.lineHeight/r.fontSize,LG=(r,e)=>{if(!e)return r;let t={...r,...e};if(e.fontSize!==void 0||e.lineHeight!==void 0){let i=e.lineHeight??GG(r);t.lineHeight=Math.round(t.fontSize*i)}return t},Jr=(r,e,t)=>{let i=r[xM],s=gM(r),o=LG(e,t);if(!i){Qr(r,o);return}let n=My(s,r.width,Cy(r.style)),l=r.x-n+s*i.x,c=r.y+r.height*i.y;Qr(r,o);let u=gM(r),h=My(u,r.width,Cy(r.style));r.x=l-u*i.x+h,r.y=c-r.height*i.y},Nd=(r,e)=>{let t=hc({...e,measuredWidth:r.width,width:e.__fixedWidth&&typeof e.width=="number"?e.width:r.width});r.x=t.x,r.y=t.y};var _M=r=>{if(!(!r||typeof r!="object")){if(typeof r.button=="number")return r.button;if(typeof r.data?.button=="number")return r.data.button;if(typeof r.nativeEvent?.button=="number")return r.nativeEvent.button}},nt=r=>{let e=_M(r);return e===void 0||e===0},bM=r=>_M(r)===2;var Ry=Symbol.for("routeGraphics.setInheritedHover"),vM=Symbol.for("routeGraphics.treeInheritedHoverActive"),Iy=Symbol.for("routeGraphics.setInheritedPress"),TM=Symbol.for("routeGraphics.treeInheritedPressActive"),By=Symbol.for("routeGraphics.setInheritedRightPress"),SM=Symbol.for("routeGraphics.treeInheritedRightPressActive"),bn=r=>Array.isArray(r?.children)?r.children:[],ky=({displayObject:r,symbol:e,source:t,isActive:i})=>{let s=r?.[e];typeof s=="function"&&s(t,i)},Hd=({displayObject:r,symbol:e})=>{r&&e in r&&delete r[e]},Fy=({displayObject:r,symbol:e,onStateChange:t})=>{let i=!1,s=new Set,o=({nextDirectActive:n=i,onInheritedChange:a})=>{let l=i||s.size>0;i=n,a?.(s);let c=i||s.size>0;return l!==c&&t(c),c};return r[e]=(n,a)=>o({onInheritedChange:l=>{if(n){if(a){l.add(n);return}l.delete(n)}}}),{setDirectState:n=>o({nextDirectActive:n}),isActive:()=>i||s.size>0,destroy:()=>{Hd({displayObject:r,symbol:e})}}},vn=r=>Hd({displayObject:r,symbol:Ry}),Vd=r=>Hd({displayObject:r,symbol:Iy}),Wd=r=>Hd({displayObject:r,symbol:By}),ei=({displayObject:r,onHoverChange:e})=>{let t=Fy({displayObject:r,symbol:Ry,onStateChange:e});return{setDirectHover:t.setDirectState,isHovering:t.isActive,destroy:t.destroy}},Ji=({displayObject:r,onPressChange:e})=>{let t=Fy({displayObject:r,symbol:Iy,onStateChange:e});return{setDirectPress:t.setDirectState,isPressed:t.isActive,destroy:t.destroy}},es=({displayObject:r,onPressChange:e})=>{let t=Fy({displayObject:r,symbol:By,onStateChange:e});return{setDirectPress:t.setDirectState,isPressed:t.isActive,destroy:t.destroy}},Oy=r=>r?.[vM]===!0,Uy=r=>r?.[TM]===!0,Gy=r=>r?.[SM]===!0,Tn=({root:r,isHovered:e})=>{if(!r)return;r[vM]=e;let t=[...bn(r)];for(;t.length>0;){let i=t.pop();ky({displayObject:i,symbol:Ry,source:r,isActive:e}),t.push(...bn(i))}},Gs=({root:r,isPressed:e})=>{if(!r)return;r[TM]=e;let t=[...bn(r)];for(;t.length>0;){let i=t.pop();ky({displayObject:i,symbol:Iy,source:r,isActive:e}),t.push(...bn(i))}},Si=({root:r,isPressed:e})=>{if(!r)return;r[SM]=e;let t=[...bn(r)];for(;t.length>0;){let i=t.pop();ky({displayObject:i,symbol:By,source:r,isActive:e}),t.push(...bn(i))}};var wM=({app:r,parent:e,element:t,animations:i,eventHandler:s,animationBus:o,completionTracker:n,renderContext:a,zIndex:l})=>{let c=new Br({label:t.id});c.zIndex=l,c.text=t.content,Qr(c,t.textStyle),Dd(c,t),c.alpha=t.alpha,Nd(c,t);let u=t?.hover,h=t?.click,d=t?.rightClick,f=null,p=null,m=null,g=()=>{let _=f?.isHovering()??!1,v=p?.isPressed()??!1;(m?.isPressed()??!1)&&d?.textStyle?Jr(c,t.textStyle,d.textStyle):v&&h?.textStyle?Jr(c,t.textStyle,h.textStyle):_&&u?.textStyle?Jr(c,t.textStyle,u.textStyle):Jr(c,t.textStyle)};if(u){let{cursor:_,soundSrc:v,payload:x}=u;c.eventMode="static",f=ei({displayObject:c,onHoverChange:g});let T=()=>{f.setDirectHover(!0),x&&s&&s("hover",{_event:{id:c.label},...x}),_&&(c.cursor=_),v&&r.audioStage.add({id:`hover-${Date.now()}`,url:v,loop:!1})},b=()=>{f.setDirectHover(!1),c.cursor="auto"};c.on("pointerover",T),c.on("pointerout",b)}if(h){let{soundSrc:_,soundVolume:v,payload:x}=h;c.eventMode="static",p=Ji({displayObject:c,onPressChange:g});let T=E=>{nt(E)&&p.setDirectPress(!0)},b=E=>{nt(E)&&(p.setDirectPress(!1),x&&s&&s("click",{_event:{id:c.label},...x}),_&&r.audioStage.add({id:`click-${Date.now()}`,url:_,loop:!1,volume:We(v)}))},w=()=>{p.setDirectPress(!1)};c.on("pointerdown",T),c.on("pointerup",b),c.on("pointerupoutside",w)}if(d){let{soundSrc:_,payload:v}=d;c.eventMode="static",m=es({displayObject:c,onPressChange:g});let x=()=>{m.setDirectPress(!0)},T=()=>{m.setDirectPress(!1)},b=()=>{m.setDirectPress(!1),v&&s&&s("rightClick",{_event:{id:c.label},...v}),_&&r.audioStage.add({id:`rightClick-${Date.now()}`,url:_,loop:!1})},w=()=>{m.setDirectPress(!1)};c.on("rightdown",x),c.on("rightup",T),c.on("rightclick",b),c.on("rightupoutside",w)}e.addChild(c),ne({animations:i,targetId:t.id,animationBus:o,completionTracker:n,element:c,targetState:{...hc(t),alpha:t.alpha},renderContext:a})};var DG=Object.prototype.hasOwnProperty,pe=(r,e)=>{if(Object.is(r,e))return!0;if(r===null||e===null||typeof r!="object"||typeof e!="object")return!1;let t=Array.isArray(r),i=Array.isArray(e);if(t!==i)return!1;if(t&&i){if(r.length!==e.length)return!1;for(let n=0;n{let c=e.children.find(f=>f.label===t.id);if(!c)return;c.zIndex=l;let{alpha:u}=i,h=()=>{if(!pe(t,i)){c.text=i.content,Qr(c,i.textStyle),Dd(c,i),Nd(c,i),c.alpha=u,c.removeAllListeners("pointerover"),c.removeAllListeners("pointerout"),c.removeAllListeners("pointerdown"),c.removeAllListeners("pointerupoutside"),c.removeAllListeners("pointerup"),c.removeAllListeners("rightdown"),c.removeAllListeners("rightclick"),c.removeAllListeners("rightup"),c.removeAllListeners("rightupoutside"),vn(c),Vd(c),Wd(c);let f=i?.hover,p=i?.click,m=i?.rightClick,g=null,_=null,v=null,x=()=>{let T=g?.isHovering()??!1,b=_?.isPressed()??!1;(v?.isPressed()??!1)&&m?.textStyle?Jr(c,i.textStyle,m.textStyle):b&&p?.textStyle?Jr(c,i.textStyle,p.textStyle):T&&f?.textStyle?Jr(c,i.textStyle,f.textStyle):Jr(c,i.textStyle)};if(f){let{cursor:T,soundSrc:b,payload:w}=f;c.eventMode="static",g=ei({displayObject:c,onHoverChange:x});let E=()=>{g.setDirectHover(!0),w&&s&&s("hover",{_event:{id:c.label},...w}),T&&(c.cursor=T),b&&r.audioStage.add({id:`hover-${Date.now()}`,url:b,loop:!1})},I=()=>{g.setDirectHover(!1),c.cursor="auto"};c.on("pointerover",E),c.on("pointerout",I)}if(p){let{soundSrc:T,soundVolume:b,payload:w}=p;c.eventMode="static",_=Ji({displayObject:c,onPressChange:x});let E=C=>{nt(C)&&_.setDirectPress(!0)},I=C=>{nt(C)&&(_.setDirectPress(!1),w&&s&&s("click",{_event:{id:c.label},...w}),T&&r.audioStage.add({id:`click-${Date.now()}`,url:T,loop:!1,volume:We(b)}))},B=()=>{_.setDirectPress(!1)};c.on("pointerdown",E),c.on("pointerup",I),c.on("pointerupoutside",B)}if(m){let{soundSrc:T,payload:b}=m;c.eventMode="static",v=es({displayObject:c,onPressChange:x});let w=()=>{v.setDirectPress(!0)},E=()=>{v.setDirectPress(!1)},I=()=>{v.setDirectPress(!1),b&&s&&s("rightClick",{_event:{id:c.label},...b}),T&&r.audioStage.add({id:`rightClick-${Date.now()}`,url:T,loop:!1})},B=()=>{v.setDirectPress(!1)};c.on("rightdown",w),c.on("rightup",E),c.on("rightclick",I),c.on("rightupoutside",B)}}};ne({animations:o,targetId:t.id,animationBus:n,completionTracker:a,element:c,targetState:{...hc(i),alpha:u},onComplete:()=>{h()}})||h()};var AM=({parent:r,element:e,animations:t,animationBus:i,completionTracker:s})=>{let o=r.getChildByLabel(e.id);if(!o)return;ne({animations:t,targetId:e.id,animationBus:i,completionTracker:s,element:o,targetState:null,onComplete:()=>{o&&!o.destroyed&&o.destroy()}})||o.destroy()};var PM=({positionX:r=0,positionY:e=0,width:t,height:i,anchorX:s=0,anchorY:o=0})=>{if(typeof t!="number"||typeof i!="number")throw new Error("Input Error: Width or height is missing");let n={x:t*s,y:i*o},a=r-n.x,l=e-n.y;return{x:a,y:l,originX:n.x,originY:n.y}};var yt=r=>{if(typeof r.width!="number"||typeof r.height!="number")throw new Error("Input Error: Width or height is missing");if(!Object.values(Us).includes(r.type))throw new Error("Input Error: Type must be one of "+Object.values(Us).join(", "));if(!r.id)throw new Error("Input Error: Id is missing");let e=r.scaleX?r.scaleX*r.width:r.width,t=r.scaleY?r.scaleY*r.height:r.height;r.type===Us.CONTAINER&&(e=r.width,t=r.height);let{x:i,y:s,originX:o,originY:n}=PM({positionX:r.x,positionY:r.y,width:e,height:t,anchorX:r.anchorX,anchorY:r.anchorY}),a={id:r.id,type:r.type,width:Math.round(e),height:Math.round(t),x:Math.round(i),y:Math.round(s),originX:Math.round(o),originY:Math.round(n),alpha:r.alpha??1};return r.hover&&(a.hover=r.hover),r.click&&(a.click=r.click),a};var CM=({state:r})=>{let e={...Ge,...r.textStyle};e.lineHeight=Math.round(e.fontSize*e.lineHeight),typeof r.width=="number"&&(e.wordWrapWidth=r.width,e.wordWrap=!0);let t=String(r.content??""),{width:i,height:s}=De.measureText(t,new Oe(ir(e))),o=Math.round(i),n=Math.round(s),a=typeof r.width=="number"?Math.round(r.width):o,c={...yt({...r,width:a,height:n}),content:t,measuredWidth:o,textStyle:{...e},...r.hover&&{hover:r.hover},...r.click&&{click:r.click},...r.rightClick&&{rightClick:r.rightClick}};return Object.defineProperties(c,{__anchorXRatio:{value:r.anchorX??0,enumerable:!1},__anchorYRatio:{value:r.anchorY??0,enumerable:!1},__fixedWidth:{value:typeof r.width=="number",enumerable:!1}}),c};var NG=et({type:"text",add:wM,update:EM,delete:AM,parse:CM});var MM="__rtglRectScrollHandled",zd=({canvas:r,rect:e,width:t,height:i,scrollUpEvent:s,scrollDownEvent:o,eventHandler:n})=>{if(!s&&!o)return;let a=!1;e.eventMode="static",e.hitArea=new Q(0,0,Math.round(t),Math.round(i));let l=(f,p)=>{p?.[MM]||(p&&(p[MM]=!0),f<0&&s?.payload&&n?n("scrollUp",{_event:{id:e.label},...s.payload}):f>0&&o?.payload&&n&&n("scrollDown",{_event:{id:e.label},...o.payload}))},c=()=>{a=!0},u=()=>{a=!1},h=f=>{f.preventDefault?.(),l(f.deltaY,f.nativeEvent)},d=f=>{a&&(f.preventDefault(),l(f.deltaY,f))};e.on("pointerover",c),e.on("pointerout",u),e.on("wheel",h),r?.addEventListener("wheel",d,{passive:!1}),e._cleanupScrollInteraction=()=>{a=!1,e.off("pointerover",c),e.off("pointerout",u),e.off("wheel",h),r?.removeEventListener("wheel",d),e.hitArea=null,delete e._cleanupScrollInteraction}};var HG=r=>r==null||r===""||r==="transparent"?{color:0,alpha:0}:r,RM=({app:r,parent:e,element:t,animations:i,animationBus:s,eventHandler:o,zIndex:n,completionTracker:a,renderContext:l})=>{let{id:c,x:u,y:h,width:d,height:f,fill:p,border:m,alpha:g,scaleX:_,scaleY:v}=t,x=new Ue;x.label=c,x.zIndex=n;let T={x:u,y:h,alpha:g};_!==void 0&&(T.scaleX=_),v!==void 0&&(T.scaleY=v),(()=>{x.clear(),x.rect(0,0,Math.round(d),Math.round(f)).fill(HG(p)),x.x=Math.round(u),x.y=Math.round(h),x.alpha=g,x.scale.x=1,x.scale.y=1,m&&x.stroke({color:m.color,alpha:m.alpha,width:Math.round(m.width)})})();let w=t?.hover,E=t?.click,I=t?.rightClick,B=t?.scrollUp,C=t?.scrollDown,A=t?.drag;if(w){let{cursor:P,soundSrc:R,payload:M}=w;x.eventMode="static";let F=()=>{M&&o&&o("hover",{_event:{id:x.label},...M}),P&&(x.cursor=P),R&&r.audioStage.add({id:`hover-${Date.now()}`,url:R,loop:!1})},O=()=>{x.cursor="auto"};x.on("pointerover",F),x.on("pointerout",O)}if(E){let{soundSrc:P,soundVolume:R,payload:M}=E;x.eventMode="static";let F=O=>{nt(O)&&(M&&o&&o("click",{_event:{id:x.label},...M}),P&&r.audioStage.add({id:`click-${Date.now()}`,url:P,loop:!1,volume:We(R)}))};x.on("pointerup",F)}if(I){let{soundSrc:P,payload:R}=I;x.eventMode="static";let M=()=>{R&&o&&o("rightClick",{_event:{id:x.label},...R}),P&&r.audioStage.add({id:`rightClick-${Date.now()}`,url:P,loop:!1})};x.on("rightclick",M)}if((B||C)&&zd({canvas:r.canvas,rect:x,width:d,height:f,scrollUpEvent:B,scrollDownEvent:C,eventHandler:o}),A){let{start:P,end:R,move:M}=A;x.eventMode="static";let F=()=>{x._isDragging=!0,P&&o&&o("dragStart",{_event:{id:x.label},...typeof P?.payload=="object"?P.payload:{}})},O=()=>{x._isDragging=!1,R&&o&&o("dragEnd",{_event:{id:x.label},...typeof R?.payload=="object"?R.payload:{}})},D=N=>{M&&o&&x._isDragging&&o("dragMove",{_event:{id:x.label,x:N.global.x,y:N.global.y},...typeof M?.payload=="object"?M.payload:{}})};x.on("pointerdown",F),x.on("pointerup",O),x.on("globalpointermove",D),x.on("pointerupoutside",O)}e.addChild(x),ne({animations:i,targetId:c,animationBus:s,completionTracker:a,element:x,targetState:T,renderContext:l})};var VG=r=>r==null||r===""||r==="transparent"?{color:0,alpha:0}:r,IM=({app:r,parent:e,prevElement:t,nextElement:i,animations:s,animationBus:o,eventHandler:n,zIndex:a,completionTracker:l})=>{let c=e.children.find(w=>w.label===t.id);if(!c)return;c.zIndex=a;let{x:u,y:h,width:d,height:f,fill:p,border:m,alpha:g,scaleX:_,scaleY:v}=i,x={x:u,y:h,alpha:g};_!==void 0&&(x.scaleX=_),v!==void 0&&(x.scaleY=v);let T=()=>{if(!pe(t,i)){c._cleanupScrollInteraction?.(),c.clear(),c.rect(0,0,Math.round(d),Math.round(f)).fill(VG(p)),c.x=Math.round(u),c.y=Math.round(h),c.alpha=g,c.scale.x=1,c.scale.y=1,m&&c.stroke({color:m.color,alpha:m.alpha,width:Math.round(m.width)}),c.removeAllListeners("pointerover"),c.removeAllListeners("pointerout"),c.removeAllListeners("pointerup"),c.removeAllListeners("rightclick"),c.removeAllListeners("wheel"),c.removeAllListeners("pointerdown"),c.removeAllListeners("globalpointermove"),c.removeAllListeners("pointerupoutside");let w=i?.hover,E=i?.click,I=i?.rightClick,B=i?.scrollUp,C=i?.scrollDown,A=i?.drag;if(w){let{cursor:P,soundSrc:R,payload:M}=w;c.eventMode="static";let F=()=>{M&&n&&n("hover",{_event:{id:c.label},...M}),P&&(c.cursor=P),R&&r.audioStage.add({id:`hover-${Date.now()}`,url:R,loop:!1})},O=()=>{c.cursor="auto"};c.on("pointerover",F),c.on("pointerout",O)}if(E){let{soundSrc:P,soundVolume:R,payload:M}=E;c.eventMode="static";let F=O=>{nt(O)&&(M&&n&&n("click",{_event:{id:c.label},...M}),P&&r.audioStage.add({id:`click-${Date.now()}`,url:P,loop:!1,volume:We(R)}))};c.on("pointerup",F)}if(I){let{soundSrc:P,payload:R}=I;c.eventMode="static";let M=()=>{R&&n&&n("rightClick",{_event:{id:c.label},...R}),P&&r.audioStage.add({id:`rightClick-${Date.now()}`,url:P,loop:!1})};c.on("rightclick",M)}if((B||C)&&zd({canvas:r.canvas,rect:c,width:d,height:f,scrollUpEvent:B,scrollDownEvent:C,eventHandler:n}),A){let{start:P,end:R,move:M}=A;c.eventMode="static";let F=()=>{c._isDragging=!0,P&&n&&n("dragStart",{_event:{id:c.label},...typeof P?.payload=="object"?P.payload:{}})},O=()=>{c._isDragging=!1,R&&n&&n("dragEnd",{_event:{id:c.label},...typeof R?.payload=="object"?R.payload:{}})},D=N=>{M&&n&&c._isDragging&&n("dragMove",{_event:{id:c.label,x:N.global.x,y:N.global.y},...typeof M?.payload=="object"?M.payload:{}})};c.on("pointerdown",F),c.on("pointerup",O),c.on("globalpointermove",D),c.on("pointerupoutside",O)}}};ne({animations:s,targetId:t.id,animationBus:o,completionTracker:l,element:c,targetState:x,onComplete:()=>{T()}})||T()};var BM=({parent:r,element:e,animations:t,animationBus:i,completionTracker:s})=>{let o=r.getChildByLabel(e.id);if(!o)return;ne({animations:t,targetId:e.id,animationBus:i,completionTracker:s,element:o,targetState:null,onComplete:()=>{o&&!o.destroyed&&(o._cleanupScrollInteraction?.(),o.destroy())}})||(o._cleanupScrollInteraction?.(),o.destroy())};var kM=({state:r})=>{let e=yt(r),t=r.border?.width,i=e;return typeof t=="number"&&t>0&&(i={...e,border:{alpha:r.border?.alpha??1,color:r.border?.color??"black",width:t}}),{...i,...r.fill!==void 0?{fill:r.fill}:{},...r.scaleX!==void 0?{scaleX:r.scaleX}:{},...r.scaleY!==void 0?{scaleY:r.scaleY}:{},rotation:r.rotation??0,...r.drag&&{drag:r.drag},...r.rightClick&&{rightClick:r.rightClick},...r.scrollUp&&{scrollUp:r.scrollUp},...r.scrollDown&&{scrollDown:r.scrollDown}}};var WG=et({type:"rect",add:RM,update:IM,delete:BM,parse:kM});var FM=({app:r,parent:e,element:t,animations:i,eventHandler:s,animationBus:o,completionTracker:n,renderContext:a,zIndex:l})=>{let{id:c,x:u,y:h,width:d,height:f,src:p,alpha:m}=t,g=p?k.from(p):k.EMPTY,_=new Te(g);_.label=c,_.zIndex=l,_.x=Math.round(u),_.y=Math.round(h),_.width=Math.round(d),_.height=Math.round(f),_.alpha=m;let v=t?.hover,x=t?.click,T=t?.rightClick,b=null,w=null,E=null,I=()=>{let B=b?.isHovering()??!1,C=w?.isPressed()??!1;if((E?.isPressed()??!1)&&T?.src){let P=k.from(T.src);_.texture=P}else if(C&&x?.src){let P=k.from(x.src);_.texture=P}else if(B&&v?.src){let P=k.from(v.src);_.texture=P}else _.texture=g};if(v){let{cursor:B,soundSrc:C,payload:A}=v;_.eventMode="static",b=ei({displayObject:_,onHoverChange:I});let P=()=>{b.setDirectHover(!0),A&&s&&s("hover",{_event:{id:_.label},...A}),B&&(_.cursor=B),C&&r.audioStage.add({id:`hover-${Date.now()}`,url:C,loop:!1})},R=()=>{b.setDirectHover(!1),_.cursor="auto"};_.on("pointerover",P),_.on("pointerout",R)}if(x){let{soundSrc:B,soundVolume:C,payload:A}=x;_.eventMode="static",w=Ji({displayObject:_,onPressChange:I});let P=F=>{nt(F)&&w.setDirectPress(!0)},R=F=>{nt(F)&&(w.setDirectPress(!1),A&&s&&s("click",{_event:{id:_.label},...A}),B&&r.audioStage.add({id:`click-${Date.now()}`,url:B,loop:!1,volume:We(C)}))},M=()=>{w.setDirectPress(!1)};_.on("pointerdown",P),_.on("pointerup",R),_.on("pointerupoutside",M)}if(T){let{soundSrc:B,payload:C}=T;_.eventMode="static",E=es({displayObject:_,onPressChange:I});let A=()=>{E.setDirectPress(!0)},P=()=>{E.setDirectPress(!1)},R=()=>{E.setDirectPress(!1),C&&s&&s("rightClick",{_event:{id:_.label},...C}),B&&r.audioStage.add({id:`rightClick-${Date.now()}`,url:B,loop:!1})},M=()=>{E.setDirectPress(!1)};_.on("rightdown",A),_.on("rightup",P),_.on("rightclick",R),_.on("rightupoutside",M)}e.addChild(_),ne({animations:i,targetId:c,animationBus:o,completionTracker:n,element:_,targetState:{x:u,y:h,width:d,height:f,alpha:m},renderContext:a})};var OM=({app:r,parent:e,prevElement:t,nextElement:i,animations:s,animationBus:o,completionTracker:n,eventHandler:a,zIndex:l})=>{let c=e.children.find(x=>x.label===t.id);if(!c)return;c.zIndex=l;let{id:u,x:h,y:d,width:f,height:p,src:m,alpha:g}=i,_=()=>{if(!pe(t,i)){let x=m?k.from(m):k.EMPTY;c.texture=x,c.x=Math.round(h),c.y=Math.round(d),c.width=Math.round(f),c.height=Math.round(p),c.alpha=g,c.removeAllListeners("pointerover"),c.removeAllListeners("pointerout"),c.removeAllListeners("pointerdown"),c.removeAllListeners("pointerupoutside"),c.removeAllListeners("pointerup"),c.removeAllListeners("rightdown"),c.removeAllListeners("rightclick"),c.removeAllListeners("rightup"),c.removeAllListeners("rightupoutside"),vn(c),Vd(c),Wd(c);let T=i?.hover,b=i?.click,w=i?.rightClick,E=null,I=null,B=null,C=()=>{let A=E?.isHovering()??!1,P=I?.isPressed()??!1;if((B?.isPressed()??!1)&&w?.src){let M=k.from(w.src);c.texture=M}else if(P&&b?.src){let M=k.from(b.src);c.texture=M}else if(A&&T?.src){let M=k.from(T.src);c.texture=M}else c.texture=x};if(T){let{cursor:A,soundSrc:P,payload:R}=T;c.eventMode="static",E=ei({displayObject:c,onHoverChange:C});let M=()=>{E.setDirectHover(!0),R&&a&&a("hover",{_event:{id:c.label},...R}),A&&(c.cursor=A),P&&r.audioStage.add({id:`hover-${Date.now()}`,url:P,loop:!1})},F=()=>{E.setDirectHover(!1),c.cursor="auto"};c.on("pointerover",M),c.on("pointerout",F)}if(b){let{soundSrc:A,soundVolume:P,payload:R}=b;c.eventMode="static",I=Ji({displayObject:c,onPressChange:C});let M=D=>{nt(D)&&I.setDirectPress(!0)},F=D=>{nt(D)&&(I.setDirectPress(!1),R&&a&&a("click",{_event:{id:c.label},...R}),A&&r.audioStage.add({id:`click-${Date.now()}`,url:A,loop:!1,volume:We(P)}))},O=()=>{I.setDirectPress(!1)};c.on("pointerdown",M),c.on("pointerup",F),c.on("pointerupoutside",O)}if(w){let{soundSrc:A,payload:P}=w;c.eventMode="static",B=es({displayObject:c,onPressChange:C});let R=()=>{B.setDirectPress(!0)},M=()=>{B.setDirectPress(!1)},F=()=>{B.setDirectPress(!1),P&&a&&a("rightClick",{_event:{id:c.label},...P}),A&&r.audioStage.add({id:`rightClick-${Date.now()}`,url:A,loop:!1})},O=()=>{B.setDirectPress(!1)};c.on("rightdown",R),c.on("rightup",M),c.on("rightclick",F),c.on("rightupoutside",O)}}};ne({animations:s,targetId:t.id,animationBus:o,completionTracker:n,element:c,targetState:{x:h,y:d,width:f,height:p,alpha:g},onComplete:()=>{_()}})||_()};var UM=({parent:r,element:e,animations:t,animationBus:i,completionTracker:s})=>{let o=r.children.find(a=>a.label===e.id);if(!o)return;ne({animations:t,targetId:e.id,animationBus:i,completionTracker:s,element:o,targetState:null,onComplete:()=>{o&&!o.destroyed&&o.destroy()}})||o.destroy()};var GM=({state:r})=>({...yt(r),src:r.src??"",alpha:r.alpha??1,...r.hover&&{hover:r.hover},...r.click&&{click:r.click},...r.rightClick&&{rightClick:r.rightClick}});var zG=et({type:"sprite",add:FM,update:OM,delete:UM,parse:GM});var $G=r=>!r||r.ended?!0:Number.isFinite(r.duration)&&r.duration>0&&r.currentTime>=r.duration,Ly=({videoElement:r,video:e})=>{e&&r?._videoEndedListener&&e.removeEventListener("ended",r._videoEndedListener),r&&(r._videoEndedListener=void 0,r._playbackStateVersion=null)},$d=({videoElement:r,video:e,loop:t,completionTracker:i})=>{if(Ly({videoElement:r,video:e}),(t??!1)||$G(e))return;let s=i.getVersion();i.track(s);let o=()=>{i.complete(s)};e.addEventListener("ended",o),r._videoEndedListener=o,r._playbackStateVersion=s};var LM=({parent:r,element:e,renderContext:t,completionTracker:i,zIndex:s})=>{let{id:o,x:n,y:a,width:l,height:c,src:u,volume:h,loop:d,alpha:f}=e,p=k.from(u),m=p.source.resource;m.pause(),m.currentTime=0,m.loop=d??!1,m.volume=We(h),m.muted=!1;let g=new Te(p);g.label=o,g.zIndex=s,g._videoEndedListener=void 0,g._playbackStateVersion=null,g.x=Math.round(n),g.y=Math.round(a),g.width=Math.round(l),g.height=Math.round(c),g.alpha=f??1,$d({videoElement:g,video:m,loop:d,completionTracker:i}),uM(t,m),r.addChild(g)};var DM=({parent:r,prevElement:e,nextElement:t,animations:i,animationBus:s,eventHandler:o,completionTracker:n,zIndex:a})=>{let l=r.children.find(g=>g.label===e.id);if(!l)return;l.zIndex=a;let{x:c,y:u,width:h,height:d,alpha:f}=t,p=()=>{if(!pe(e,t)){l.x=Math.round(c),l.y=Math.round(u),l.width=Math.round(h),l.height=Math.round(d),l.alpha=f??1;let g=l.texture.source.resource;if(e.src!==t.src){let _=g;Ly({videoElement:l,video:_}),_&&_.pause();let v=k.from(t.src);l.texture=v,g=v.source.resource,g.muted=!1,g.pause(),g.currentTime=0}$d({videoElement:l,video:g,loop:t.loop,completionTracker:n}),g.volume=We(t.volume),g.loop=t.loop??!1,e.src!==t.src&&g.play()}};ne({animations:i,targetId:e.id,animationBus:s,completionTracker:n,element:l,targetState:{x:c,y:u,width:h,height:d,alpha:f??1},onComplete:p})||p()};var NM=({parent:r,element:e,animations:t,animationBus:i,completionTracker:s})=>{let o=r.children.find(l=>l.label===e.id);if(!o)return;let n=()=>{if(o&&!o.destroyed){o._playbackStateVersion!==null&&s.complete(o._playbackStateVersion);let l=o.texture.source.resource;l&&(o._videoEndedListener&&l.removeEventListener("ended",o._videoEndedListener),l.pause()),r.removeChild(o),o.destroy()}};ne({animations:t,targetId:e.id,animationBus:i,completionTracker:s,element:o,targetState:null,onComplete:n})||n()};var HM=({state:r})=>({...yt(r),src:r.src,volume:r.volume??100,loop:r.loop??!1});var XG=et({type:"video",add:LM,update:DM,delete:NM,parse:HM});var VM=0,WM=16,jG=(r,e)=>r!==null&&typeof r=="object"&&Object.prototype.hasOwnProperty.call(r,e),Ny=r=>Math.max(0,Math.min(1,r)),Ls=r=>r?k.from(r):k.EMPTY,Sn=r=>({bar:`${r}-bar`,inactiveBar:`${r}-inactive-bar`,barMask:`${r}-bar-mask`,thumb:`${r}-thumb`}),$M=({sliderContainer:r,fromId:e,toId:t})=>{if(e===t)return;let i=Sn(e),s=Sn(t);for(let[o,n]of Object.entries(i)){let a=r.getChildByLabel(n);a&&(a.label=s[o])}},wn=({sliderContainer:r,id:e})=>{let t=Sn(e);return{bar:r.getChildByLabel(t.bar),inactiveBar:r.getChildByLabel(t.inactiveBar),barMask:r.getChildByLabel(t.barMask),thumb:r.getChildByLabel(t.thumb)}},Dy=({baseValue:r,override:e,key:t})=>jG(e,t)?e[t]??"":r??"",YG=(r,e=null)=>({thumbSrc:Dy({baseValue:r.thumbSrc,override:e,key:"thumbSrc"}),barSrc:Dy({baseValue:r.barSrc,override:e,key:"barSrc"}),inactiveBarSrc:Dy({baseValue:r.inactiveBarSrc,override:e,key:"inactiveBarSrc"})}),qG=r=>{let e=new Te(k.EMPTY);return e.label=r,e.eventMode="static",e.zIndex=0,e},KG=r=>{let e=new Ue;return e.label=r,e.zIndex=0,e},ZG=({sliderContainer:r,id:e,bar:t})=>{let i=Sn(e),{inactiveBar:s,barMask:o}=wn({sliderContainer:r,id:e});return s||(s=qG(i.inactiveBar),r.addChild(s)),o||(o=KG(i.barMask),r.addChild(o)),t.mask=o,{inactiveBar:s,barMask:o}},QG=({sliderContainer:r,id:e,bar:t})=>{let{inactiveBar:i,barMask:s}=wn({sliderContainer:r,id:e});t?.mask===s&&(t.mask=null),i&&(r.removeChild(i),i.destroy()),s&&(r.removeChild(s),s.destroy())},XM=({currentValue:r,min:e,max:t})=>{let i=t-e;return i<=0?0:Ny((r-e)/i)},JG=({barMask:r,direction:e,width:t,height:i,currentValue:s,min:o,max:n})=>{if(!r)return;let a=XM({currentValue:s,min:o,max:n}),l=Math.round(e==="horizontal"?t*a:t),c=Math.round(e==="horizontal"?i:i*a);r.clear(),!(l<=0||c<=0)&&r.rect(0,0,l,c).fill({color:16777215,alpha:0})},eL=({thumb:r,direction:e,currentValue:t,min:i,max:s,trackWidth:o,trackHeight:n})=>{let a=XM({currentValue:t,min:i,max:s});if(e==="horizontal"){r.x=a*(o-r.width),r.y=(n-r.height)/2;return}r.x=(o-r.width)/2,r.y=a*(n-r.height)},Xd=({thumb:r,thumbSrc:e,direction:t,trackWidth:i,trackHeight:s})=>{let o=t==="horizontal"?s-VM*2:i-VM*2,n=Ls(e),a=n.width||WM,l=n.height||WM,c=o/a,u=o/l,h=Math.min(c,u);r.width=a*h,r.height=l*h},dc=({sliderContainer:r,sliderComputedNode:e,thumb:t,currentValue:i,hoverOverride:s=null})=>{let{id:o,width:n,height:a,direction:l,min:c,max:u}=e,{barSrc:h,inactiveBarSrc:d,thumbSrc:f}=YG(e,s),{bar:p}=wn({sliderContainer:r,id:o});if(p){if(p.texture=Ls(h),p.width=n,p.height=a,t.texture=Ls(f),d){let{inactiveBar:m,barMask:g}=ZG({sliderContainer:r,id:o,bar:p});m.texture=Ls(d),m.width=n,m.height=a,JG({barMask:g,direction:l,width:n,height:a,currentValue:i,min:c,max:u})}else QG({sliderContainer:r,id:o,bar:p});eL({thumb:t,direction:l,currentValue:i,min:c,max:u,trackWidth:n,trackHeight:a})}},tL=({position:r,thumb:e,direction:t,min:i,max:s,step:o,trackWidth:n,trackHeight:a})=>{let l=s-i,c;if(t==="horizontal"){let h=r.x-e.width/2,d=Math.max(n-e.width,1);c=Ny(h/d)}else{let h=r.y-e.height/2,d=Math.max(a-e.height,1);c=Ny(h/d)}let u=i+c*l;return o>0&&(u=Math.round((u-i)/o)*o+i,u=Math.max(i,Math.min(s,u))),u},zM=({sliderContainer:r,sliderComputedNode:e,cursor:t})=>{let i=t??"auto",{bar:s,inactiveBar:o,thumb:n}=wn({sliderContainer:r,id:e.id});r.cursor=i,s&&(s.cursor=i),o&&(o.cursor=i),n&&(n.cursor=i)},jd=({app:r,sliderContainer:e,sliderComputedNode:t,thumb:i,eventHandler:s})=>{vn(e);let{id:o,hover:n,change:a,min:l,max:c,step:u,direction:h,initialValue:d,width:f,height:p}=t,m=d??l,g=!1,_=null,v=()=>{dc({sliderContainer:e,sliderComputedNode:t,thumb:i,currentValue:m,hoverOverride:_?.isHovering()?n:null})},x=B=>{let C=e.toLocal(B.global),A=tL({position:C,thumb:i,direction:h,min:l,max:c,step:u,trackWidth:f,trackHeight:p});A!==m&&(m=A,v(),a?.payload&&s&&s("change",{_event:{id:o,value:m},...a.payload}))},T=B=>{g=!0,x(B)},b=B=>{g&&x(B)},w=()=>{g&&(g=!1)};if(e.on("pointerdown",T),e.on("globalpointermove",b),e.on("pointerup",w),e.on("pointerupoutside",w),!n)return;_=ei({displayObject:e,onHoverChange:v});let E=()=>{_.setDirectHover(!0),v(),zM({sliderContainer:e,sliderComputedNode:t,cursor:n.cursor}),n.soundSrc&&r.audioStage.add({id:`hover-${Date.now()}`,url:n.soundSrc,loop:!1})},I=()=>{g||(_.setDirectHover(!1),v(),zM({sliderContainer:e,sliderComputedNode:t,cursor:null}))};e.on("pointerover",E),e.on("pointerout",I),e.on("pointerupoutside",I)};var jM=({app:r,parent:e,element:t,animations:i,animationBus:s,completionTracker:o,eventHandler:n,renderContext:a,zIndex:l})=>{let{id:c,x:u,y:h,width:d,height:f,alpha:p,thumbSrc:m,barSrc:g,initialValue:_,min:v}=t,x=new te;x.label=c,x.zIndex=l,x.x=u,x.y=h,x.alpha=p,x.sortableChildren=!0,x.eventMode="static";let T=Sn(c),b=new Te(Ls(g));b.label=T.bar,b.eventMode="static",b.zIndex=1;let w=new Te(Ls(m));w.label=T.thumb,w.eventMode="static",w.zIndex=2;let E=_??v;Xd({thumb:w,thumbSrc:m,direction:t.direction,trackWidth:d,trackHeight:f}),x.addChild(b),x.addChild(w),dc({sliderContainer:x,sliderComputedNode:t,thumb:w,currentValue:E}),jd({app:r,sliderContainer:x,sliderComputedNode:t,thumb:w,eventHandler:n}),e.addChild(x),ne({animations:i,targetId:c,animationBus:s,completionTracker:o,element:x,targetState:{x:u,y:h,alpha:p},renderContext:a})};var YM=({app:r,parent:e,prevElement:t,nextElement:i,animations:s,animationBus:o,completionTracker:n,eventHandler:a,zIndex:l})=>{let c=e.children.find(m=>m.label===t.id);if(!c)return;c.zIndex=l;let u=()=>{if(!pe(t,i)){c.x=i.x,c.y=i.y,c.alpha=i.alpha,c.label=i.id,c.pivot.set(i.originX,i.originY),$M({sliderContainer:c,fromId:t.id,toId:i.id});let{bar:m,thumb:g}=wn({sliderContainer:c,id:i.id}),_=!pe(t.hover,i.hover)||!pe(t.change,i.change)||t.min!==i.min||t.max!==i.max||t.step!==i.step||t.direction!==i.direction||t.initialValue!==i.initialValue||t.thumbSrc!==i.thumbSrc||t.barSrc!==i.barSrc||t.inactiveBarSrc!==i.inactiveBarSrc||t.width!==i.width||t.height!==i.height||t.id!==i.id;if(m&&g&&(Xd({thumb:g,thumbSrc:i.thumbSrc,direction:i.direction,trackWidth:i.width,trackHeight:i.height}),dc({sliderContainer:c,sliderComputedNode:i,thumb:g,currentValue:i.initialValue})),!m||!g)return;_&&(c.removeAllListeners("pointerover"),c.removeAllListeners("pointerout"),c.removeAllListeners("pointerup"),c.removeAllListeners("pointerupoutside"),c.removeAllListeners("pointerdown"),c.removeAllListeners("globalpointermove")),_&&jd({app:r,sliderContainer:c,sliderComputedNode:i,thumb:g,eventHandler:a})}},{x:h,y:d,alpha:f}=i;ne({animations:s,targetId:t.id,animationBus:o,completionTracker:n,element:c,targetState:{x:h,y:d,alpha:f},onComplete:u})||u()};var qM=({app:r,parent:e,element:t,animations:i,animationBus:s,completionTracker:o})=>{let n=e.getChildByLabel(t.id);if(!n)return;let a=()=>{n&&!n.destroyed&&n.destroy({children:!0})};ne({animations:i,targetId:t.id,animationBus:s,completionTracker:o,element:n,targetState:null,onComplete:a})||a()};var KM=({state:r})=>{let e=yt(r),t=r.min??0,i=r.max??100;if(i<=t)throw new Error("Input error: the max value of a slider must be larger than the min value");if(r.initialValue===void 0)throw new Error("Input error: slider initialValue is required");if(typeof r.initialValue!="number"||Number.isNaN(r.initialValue))throw new Error("Input error: slider initialValue must be a valid number");if(r.initialValuei)throw new Error("Input error: slider initialValue must be between min and max");return{...e,direction:r.direction??"horizontal",thumbSrc:r.thumbSrc??"",barSrc:r.barSrc??"",...r.inactiveBarSrc!==void 0&&{inactiveBarSrc:r.inactiveBarSrc??""},alpha:r.alpha??1,min:t,max:i,step:r.step??1,initialValue:r.initialValue,...r.hover&&{hover:r.hover},...r.change&&{change:r.change}}};var rL=et({type:"slider",add:jM,update:YM,delete:qM,parse:KM});var Pn=Symbol("routeGraphicsInputRuntime"),Yd={top:10,right:12,bottom:10,left:12},En={fill:"#FFFFFF",fillAlpha:1,strokeColor:"#2E2E2E",strokeWidth:1,strokeAlpha:1},qd={strokeColor:"#4A89FF",strokeWidth:2,strokeAlpha:1},ZM={fill:"#4A89FF",alpha:.3},Hy={fill:"#111111",width:2},iL=(r={})=>{let e=r.fontSize??Ge.fontSize,t=r.lineHeight??Ge.lineHeight;return typeof t!="number"?Math.round(e*Ge.lineHeight):t>8?Math.round(t):Math.round(e*t)},Jd=(r={},e={})=>({...Ge,...r,align:r.align??"left",lineHeight:iL(r),wordWrap:!1,breakWords:!1,wordWrapWidth:e.wordWrapWidth??0,whiteSpace:"pre"}),Vy=r=>typeof r=="number"?{top:r,right:r,bottom:r,left:r}:Array.isArray(r)?{top:r[0]??0,right:r[1]??r[0]??0,bottom:r[2]??r[0]??0,left:r[3]??r[1]??r[0]??0}:{top:r?.top??Yd.top,right:r?.right??Yd.right,bottom:r?.bottom??Yd.bottom,left:r?.left??Yd.left},An=r=>String(r??"").replace(/\r\n/g,` +`,xn=null,oc=class{constructor(){xn||(xn=URL.createObjectURL(new Blob([oG],{type:"application/javascript"}))),this.worker=new Worker(xn)}};oc.revokeObjectURL=function(){xn&&(URL.revokeObjectURL(xn),xn=null)};var jC=0,xy,yy=class{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(e=>{let{worker:t}=new gn;t.addEventListener("message",i=>{t.terminate(),gn.revokeObjectURL(),e(i.data)})}),this._isImageBitmapSupported)}loadImageBitmap(e,t){return this._run("loadImageBitmap",[e,t?.data?.alphaMode])}async _initWorkers(){this._initialized||(this._initialized=!0)}_getWorker(){xy===void 0&&(xy=navigator.hardwareConcurrency||4);let e=this._workerPool.pop();return!e&&this._createdWorkers{this._complete(t.data),this._returnWorker(t.target),this._next()})),e}_returnWorker(e){this._workerPool.push(e)}_complete(e){e.error!==void 0?this._resolveHash[e.uuid].reject(e.error):this._resolveHash[e.uuid].resolve(e.data),this._resolveHash[e.uuid]=null}async _run(e,t){await this._initWorkers();let i=new Promise((s,o)=>{this._queue.push({id:e,arguments:t,resolve:s,reject:o})});return this._next(),i}_next(){if(!this._queue.length)return;let e=this._getWorker();if(!e)return;let t=this._queue.pop(),i=t.id;this._resolveHash[jC]={resolve:t.resolve,reject:t.reject},e.postMessage({data:t.arguments,uuid:jC++,id:i})}},_y=new yy;Di();var nG=[".jpeg",".jpg",".png",".webp",".avif"],aG=["image/jpeg","image/png","image/webp","image/avif"];async function lG(r,e){let t=await j.get().fetch(r);if(!t.ok)throw new Error(`[loadImageBitmap] Failed to fetch ${r}: ${t.status} ${t.statusText}`);let i=await t.blob();return e?.data?.alphaMode==="premultiplied-alpha"?createImageBitmap(i,{premultiplyAlpha:"none"}):createImageBitmap(i)}var wd={name:"loadTextures",extension:{type:S.LoadParser,priority:Dt.High,name:"loadTextures"},config:{preferWorkers:!0,preferCreateImageBitmap:!0,crossOrigin:"anonymous"},test(r){return yr(r,aG)||_r(r,nG)},async load(r,e,t){let i=null;globalThis.createImageBitmap&&this.config.preferCreateImageBitmap?this.config.preferWorkers&&await _y.isImageBitmapSupported()?i=await _y.loadImageBitmap(r,e):i=await lG(r,e):i=await new Promise((o,n)=>{i=new Image,i.crossOrigin=this.config.crossOrigin,i.src=r,i.complete?o(i):(i.onload=()=>{o(i)},i.onerror=n)});let s=new jt({resource:i,alphaMode:"premultiply-alpha-on-upload",resolution:e.data?.resolution||fn(r),...e.data});return pn(s,t,r)},unload(r){r.destroy(!0)}};U();km();Bm();var YC=[".mp4",".m4v",".webm",".ogg",".ogv",".h264",".avi",".mov"],cG=YC.map(r=>`video/${r.substring(1)}`);function uG(r,e,t){t===void 0&&!e.startsWith("data:")?r.crossOrigin=dG(e):t!==!1&&(r.crossOrigin=typeof t=="string"?t:"anonymous")}function hG(r){return new Promise((e,t)=>{r.addEventListener("canplaythrough",i),r.addEventListener("error",s),r.load();function i(){o(),e()}function s(n){o(),t(n)}function o(){r.removeEventListener("canplaythrough",i),r.removeEventListener("error",s)}})}function dG(r,e=globalThis.location){if(r.startsWith("data:"))return"";e||(e=globalThis.location);let t=new URL(r,document.baseURI);return t.hostname!==e.hostname||t.port!==e.port||t.protocol!==e.protocol?"anonymous":""}var qC={name:"loadVideo",extension:{type:S.LoadParser,name:"loadVideo"},test(r){let e=yr(r,cG),t=_r(r,YC);return e||t},async load(r,e,t){let i={...Po.defaultOptions,resolution:e.data?.resolution||fn(r),alphaMode:e.data?.alphaMode||await Qu(),...e.data},s=document.createElement("video"),o={preload:i.autoLoad!==!1?"auto":void 0,"webkit-playsinline":i.playsinline!==!1?"":void 0,playsinline:i.playsinline!==!1?"":void 0,muted:i.muted===!0?"":void 0,loop:i.loop===!0?"":void 0,autoplay:i.autoPlay!==!1?"":void 0};Object.keys(o).forEach(l=>{let c=o[l];c!==void 0&&s.setAttribute(l,c)}),i.muted===!0&&(s.muted=!0),uG(s,r,i.crossorigin);let n=document.createElement("source"),a;if(r.startsWith("data:"))a=r.slice(5,r.indexOf(";"));else if(!r.startsWith("blob:")){let l=r.split("?")[0].slice(r.lastIndexOf(".")+1).toLowerCase();a=Po.MIME_TYPES[l]||`video/${l}`}return n.src=r,a&&(n.type=a),new Promise(l=>{let c=async()=>{let u=new Po({...i,resource:s});s.removeEventListener("canplay",c),e.data.preload&&await hG(s),l(pn(u,t,r))};s.addEventListener("canplay",c),s.appendChild(n)})},unload(r){r.destroy(!0)}};U();wo();U();wo();var Ed={extension:{type:S.ResolveParser,name:"resolveTexture"},test:wd.test,parse:r=>({resolution:parseFloat(rr.RETINA_PREFIX.exec(r)?.[1]??"1"),format:r.split(".").pop(),src:r})};var KC={extension:{type:S.ResolveParser,priority:-2,name:"resolveJson"},test:r=>rr.RETINA_PREFIX.test(r)&&r.endsWith(".json"),parse:Ed.parse};wo();Aa();ju();var Ad=class{constructor(){this._detections=[],this._initialized=!1,this.resolver=new rr,this.loader=new Sd,this.cache=Se,this._backgroundLoader=new vd(this.loader),this._backgroundLoader.active=!0,this.reset()}async init(e={}){if(this._initialized){W("[Assets]AssetManager already initialized, did you load before calling this Assets.init()?");return}if(this._initialized=!0,e.defaultSearchParams&&this.resolver.setDefaultSearchParams(e.defaultSearchParams),e.basePath&&(this.resolver.basePath=e.basePath),e.bundleIdentifier&&this.resolver.setBundleIdentifier(e.bundleIdentifier),e.manifest){let o=e.manifest;typeof o=="string"&&(o=await this.load(o)),this.resolver.addManifest(o)}let t=e.texturePreference?.resolution??1,i=typeof t=="number"?[t]:t,s=await this._detectFormats({preferredFormats:e.texturePreference?.format,skipDetections:e.skipDetections,detections:this._detections});this.resolver.prefer({params:{format:s,resolution:i}}),e.preferences&&this.setPreferences(e.preferences)}add(e){this.resolver.add(e)}async load(e,t){this._initialized||await this.init();let i=Ss(e),s=Nt(e).map(a=>{if(typeof a!="string"){let l=this.resolver.getAlias(a);return l.some(c=>!this.resolver.hasKey(c))&&this.add(a),Array.isArray(l)?l[0]:l}return this.resolver.hasKey(a)||this.add({alias:a,src:a}),a}),o=this.resolver.resolve(s),n=await this._mapLoadToResolve(o,t);return i?n[s[0]]:n}addBundle(e,t){this.resolver.addBundle(e,t)}async loadBundle(e,t){this._initialized||await this.init();let i=!1;typeof e=="string"&&(i=!0,e=[e]);let s=this.resolver.resolveBundle(e),o={},n=Object.keys(s),a=0,l=0,c=()=>{t?.(++a/l)},u=n.map(h=>{let d=s[h];return l+=Object.keys(d).length,this._mapLoadToResolve(d,c).then(f=>{o[h]=f})});return await Promise.all(u),i?o[e[0]]:o}async backgroundLoad(e){this._initialized||await this.init(),typeof e=="string"&&(e=[e]);let t=this.resolver.resolve(e);this._backgroundLoader.add(Object.values(t))}async backgroundLoadBundle(e){this._initialized||await this.init(),typeof e=="string"&&(e=[e]);let t=this.resolver.resolveBundle(e);Object.values(t).forEach(i=>{this._backgroundLoader.add(Object.values(i))})}reset(){this.resolver.reset(),this.loader.reset(),this.cache.reset(),this._initialized=!1}get(e){if(typeof e=="string")return Se.get(e);let t={};for(let i=0;i{let a=s[n.src],l=[n.src];n.alias&&l.push(...n.alias),l.forEach(c=>{o[c]=a}),Se.set(l,a)}),o}async unload(e){this._initialized||await this.init();let t=Nt(e).map(s=>typeof s!="string"?s.src:s),i=this.resolver.resolve(t);await this._unloadFromResolved(i)}async unloadBundle(e){this._initialized||await this.init(),e=Nt(e);let t=this.resolver.resolveBundle(e),i=Object.keys(t).map(s=>this._unloadFromResolved(t[s]));await Promise.all(i)}async _unloadFromResolved(e){let t=Object.values(e);t.forEach(i=>{Se.remove(i.src)}),await this.loader.unload(t)}async _detectFormats(e){let t=[];e.preferredFormats&&(t=Array.isArray(e.preferredFormats)?e.preferredFormats:[e.preferredFormats]);for(let i of e.detections)e.skipDetections||await i.test()?t=await i.add(t):e.skipDetections||(t=await i.remove(t));return t=t.filter((i,s)=>t.indexOf(i)===s),t}get detections(){return this._detections}setPreferences(e){this.loader.parsers.forEach(t=>{t.config&&Object.keys(t.config).filter(i=>i in e).forEach(i=>{t.config[i]=e[i]})})}},br=new Ad;V.handleByList(S.LoadParser,br.loader.parsers).handleByList(S.ResolveParser,br.resolver.parsers).handleByList(S.CacheParser,br.cache.parsers).handleByList(S.DetectionParser,br.detections);V.add(OC,LC,UC,VC,DC,NC,HC,WC,zC,$C,XC,wd,qC,FC,kC,Ed,KC);var ZC={loader:S.LoadParser,resolver:S.ResolveParser,cache:S.CacheParser,detection:S.DetectionParser};V.handle(S.Asset,r=>{let e=r.ref;Object.entries(ZC).filter(([t])=>!!e[t]).forEach(([t,i])=>V.add(Object.assign(e[t],{extension:e[t].extension??i})))},r=>{let e=r.ref;Object.keys(ZC).filter(t=>!!e[t]).forEach(t=>V.remove(e[t]))});ve();va();So();Ma();var nc=class r extends Te{constructor(...e){let t=e[0];Array.isArray(e[0])&&(t={textures:e[0],autoUpdate:e[1]});let{animationSpeed:i=1,autoPlay:s=!1,autoUpdate:o=!0,loop:n=!0,onComplete:a=null,onFrameChange:l=null,onLoop:c=null,textures:u,updateAnchor:h=!1,...d}=t,[f]=u;super({...d,texture:f instanceof k?f:f.texture}),this._textures=null,this._durations=null,this._autoUpdate=o,this._isConnectedToTicker=!1,this.animationSpeed=i,this.loop=n,this.updateAnchor=h,this.onComplete=a,this.onFrameChange=l,this.onLoop=c,this._currentTime=0,this._playing=!1,this._previousFrame=null,this.textures=u,s&&this.play()}stop(){this._playing&&(this._playing=!1,this._autoUpdate&&this._isConnectedToTicker&&(ht.shared.remove(this.update,this),this._isConnectedToTicker=!1))}play(){this._playing||(this._playing=!0,this._autoUpdate&&!this._isConnectedToTicker&&(ht.shared.add(this.update,this,Dr.HIGH),this._isConnectedToTicker=!0))}gotoAndStop(e){this.stop(),this.currentFrame=e}gotoAndPlay(e){this.currentFrame=e,this.play()}update(e){if(!this._playing)return;let t=e.deltaTime,i=this.animationSpeed*t,s=this.currentFrame;if(this._durations!==null){let o=this._currentTime%1*this._durations[this.currentFrame];for(o+=i/60*1e3;o<0;)this._currentTime--,o+=this._durations[this.currentFrame];let n=Math.sign(this.animationSpeed*t);for(this._currentTime=Math.floor(this._currentTime);o>=this._durations[this.currentFrame];)o-=this._durations[this.currentFrame]*n,this._currentTime+=n;this._currentTime+=o/this._durations[this.currentFrame]}else this._currentTime+=i;this._currentTime<0&&!this.loop?(this.gotoAndStop(0),this.onComplete&&this.onComplete()):this._currentTime>=this._textures.length&&!this.loop?(this.gotoAndStop(this._textures.length-1),this.onComplete&&this.onComplete()):s!==this.currentFrame&&(this.loop&&this.onLoop&&(this.animationSpeed>0&&this.currentFrames)&&this.onLoop(),this._updateTexture())}_updateTexture(){let e=this.currentFrame;this._previousFrame!==e&&(this._previousFrame=e,this.texture=this._textures[e],this.updateAnchor&&this.texture.defaultAnchor&&this.anchor.copyFrom(this.texture.defaultAnchor),this.onFrameChange&&this.onFrameChange(this.currentFrame))}destroy(){this.stop(),super.destroy(),this.onComplete=null,this.onFrameChange=null,this.onLoop=null}static fromFrames(e){let t=[];for(let i=0;ithis.totalFrames-1)throw new Error(`[AnimatedSprite]: Invalid frame index value ${e}, expected to be between 0 and totalFrames ${this.totalFrames}.`);let t=this.currentFrame;this._currentTime=e,t!==this.currentFrame&&this._updateTexture()}get playing(){return this._playing}get autoUpdate(){return this._autoUpdate}set autoUpdate(e){e!==this._autoUpdate&&(this._autoUpdate=e,!this._autoUpdate&&this._isConnectedToTicker?(ht.shared.remove(this.update,this),this._isConnectedToTicker=!1):this._autoUpdate&&!this._isConnectedToTicker&&this._playing&&(ht.shared.add(this.update,this),this._isConnectedToTicker=!0))}};Cu();Xe();Xu();var Pd=class extends Li{constructor(e,t){let{text:i,resolution:s,style:o,anchor:n,width:a,height:l,roundPixels:c,...u}=e;super({...u}),this.batched=!0,this._resolution=null,this._autoResolution=!0,this._didTextUpdate=!0,this._styleClass=t,this.text=i??"",this.style=o,this.resolution=s??null,this.allowChildren=!1,this._anchor=new St({_onUpdate:()=>{this.onViewUpdate()}}),n&&(this.anchor=n),this.roundPixels=c??!1,a!==void 0&&(this.width=a),l!==void 0&&(this.height=l)}get anchor(){return this._anchor}set anchor(e){typeof e=="number"?this._anchor.set(e):this._anchor.copyFrom(e)}set text(e){e=e.toString(),this._text!==e&&(this._text=e,this.onViewUpdate())}get text(){return this._text}set resolution(e){this._autoResolution=e===null,this._resolution=e,this.onViewUpdate()}get resolution(){return this._resolution}get style(){return this._style}set style(e){e||(e={}),this._style?.off("update",this.onViewUpdate,this),e instanceof this._styleClass?this._style=e:this._style=new this._styleClass(e),this._style.on("update",this.onViewUpdate,this),this.onViewUpdate()}get width(){return Math.abs(this.scale.x)*this.bounds.width}set width(e){this._setWidth(e,this.bounds.width)}get height(){return Math.abs(this.scale.y)*this.bounds.height}set height(e){this._setHeight(e,this.bounds.height)}getSize(e){return e||(e={}),e.width=Math.abs(this.scale.x)*this.bounds.width,e.height=Math.abs(this.scale.y)*this.bounds.height,e}setSize(e,t){typeof e=="object"?(t=e.height??e.width,e=e.width):t??(t=e),e!==void 0&&this._setWidth(e,this.bounds.width),t!==void 0&&this._setHeight(t,this.bounds.height)}containsPoint(e){let t=this.bounds.width,i=this.bounds.height,s=-t*this.anchor.x,o=0;return e.x>=s&&e.x<=s+t&&(o=-i*this.anchor.y,e.y>=o&&e.y<=o+i)}onViewUpdate(){this.didViewUpdate||(this._didTextUpdate=!0),super.onViewUpdate()}_getKey(){return`${this.text}:${this._style.styleKey}:${this._resolution}`}destroy(e=!1){super.destroy(e),this.owner=null,this._bounds=null,this._anchor=null,(typeof e=="boolean"?e:e?.style)&&this._style.destroy(e),this._style=null,this._text=null}};function QC(r,e){let t=r[0]??{};return(typeof t=="string"||r[1])&&(X(ie,`use new ${e}({ text: "hi!", style }) instead`),t={text:t,style:r[1]}),t}Qa();Bs();var Br=class extends Pd{constructor(...e){let t=QC(e,"Text");super(t,Oe),this.renderPipeId="text"}updateBounds(){let e=this._bounds,t=this._anchor,i=De.measureText(this._text,this._style),{width:s,height:o}=i;e.minX=-t._x*s,e.maxX=e.minX+s,e.minY=-t._y*o,e.maxY=e.minY+o}};xx();ge();ut();It();Fx();ve();Qh();Um();Pr();Qg();Ma();Qa();Bs();Pm();Mt();var fG=fs(mh(),1);V.add(cA,hA);var pG=new(window.AudioContext||window.webkitAudioContext),by={},mG=async(r,e)=>{if(!by[r]&&e.byteLength!==0)try{let t=await pG.decodeAudioData(e);by[r]=t}catch(t){console.error(`AudioAsset.load: Failed to decode ${r}:`,t)}},gG=r=>by[r],yn={load:mG,getAsset:gG};var et=({type:r,add:e,update:t,delete:i,parse:s,shouldUpdateUnchanged:o})=>({type:r,add:e,update:t,delete:i,parse:s,shouldUpdateUnchanged:o});var vy=({type:r})=>({type:r});var Ty=({type:r,add:e,update:t,delete:i})=>({type:r,add:e,update:t,delete:i});var Cd={alpha:"alpha",x:"x",y:"y",scaleX:"scaleX",scaleY:"scaleY",rotation:"rotation"};var Md={scaleX:["scale","x"],scaleY:["scale","y"],x:["x"],y:["y"],alpha:["alpha"],rotation:["rotation"]};var Us={RECT:"rect",TEXT:"text",INPUT:"input",CONTAINER:"container",SPRITE:"sprite",TEXT_REVEALING:"text-revealing",SLIDER:"slider",PARTICLES:"particles",SPRITESHEET_ANIMATION:"spritesheet-animation",VIDEO:"video"};var Ge={fill:"black",fontFamily:"Arial",fontSize:16,align:"left",lineHeight:1.2,wordWrap:!1,breakWords:!1,strokeColor:"transparent",strokeWidth:0,wordWrapWidth:0};var xG=(r={})=>{let e=typeof r.stroke=="object"&&r.stroke!==null?r.stroke:{};return{...e,color:r.strokeColor??e.color??Ge.strokeColor,width:r.strokeWidth??e.width??Ge.strokeWidth}},ir=(r={})=>{let{strokeColor:e,strokeWidth:t,stroke:i,...s}=r;return{...s,stroke:xG({strokeColor:e,strokeWidth:t,stroke:i})}};var Qr=(r,e)=>{let t={fill:e?.fill??Ge.fill,fontFamily:e?.fontFamily??Ge.fontFamily,fontSize:e?.fontSize??Ge.fontSize,align:e?.align??Ge.align,lineHeight:e?.lineHeight??Ge.lineHeight,wordWrap:e?.wordWrap??Ge.wordWrap,breakWords:e?.breakWords??Ge.breakWords,strokeColor:e?.strokeColor??Ge.strokeColor,strokeWidth:e?.strokeWidth??Ge.strokeWidth,wordWrapWidth:e?.wordWrapWidth??Ge.wordWrapWidth};r.style=ir(t)};var We=(r,e=100)=>Math.min(Math.max(r??e,0),100)/100;var yG=(r,e)=>typeof e!="string"?e:r[e]??e,_G=(r,e,t,i)=>{let s=yG(t,e);if(typeof s=="string")return r[s]=i,r;let o=r;for(let n=0;n{for(let i of e)for(let[s,o]of Object.entries(i.tween)){if(!Cd[s])throw new Error(`${s} is not a supported property for animation.`);o.initialValue!==void 0&&_G(r,s,t,o.initialValue)}},Rd=({animations:r,animationBus:e,completionTracker:t,element:i,targetState:s,onComplete:o})=>{for(let n of r){for(let[l,c]of Object.entries(n.tween))if(c.auto&&(!s||!Object.prototype.hasOwnProperty.call(s,l)))throw new Error(`Animation "${n.id}" cannot auto-resolve property "${l}" from targetState.`);let a=t.getVersion();t.track(a),e.dispatch({type:"START",payload:{id:n.id,element:i,properties:n.tween,targetState:s,onComplete:()=>{t.complete(a),o?.(n)}}})}};function Id(r,e){let t=r.text.substring(0,e),s=De.measureText(t,r.style).width;return r.x+s}var bG=async(r,e)=>new Promise((t,i)=>{if(e?.aborted)return i(new DOMException("The operation was aborted.","AbortError"));let s,o=()=>{s&&e?.removeEventListener("abort",s)},n=setTimeout(()=>{o(),t()},r);s=()=>{clearTimeout(n),o(),i(e.reason)},e?.addEventListener("abort",s,{once:!0})}),Sy=bG;var vi=Symbol("textRevealRuntime"),kd=Symbol("textRevealSnapshot"),vG=18,TG=64,SG=1.25,Ey=50,wG=0,Ay=100,wy=Ay-1,eM=10,EG=120,AG=.9,rM=(r=Ey)=>typeof r!="number"||!Number.isFinite(r)?Ey:Math.max(wG,Math.min(Ay,r)),PG=r=>rM(r)>=Ay,iM=r=>{let e=Math.min(rM(r),wy),i=(wy>0?e/wy:0)**AG;return eM*(EG/eM)**i},CG=r=>r?.revealEffect==="softWipe"?"softWipe":"typewriter",_n=r=>r?.revealEffect==="none"||PG(r?.speed??Ey),MG=r=>{let e=new Te(k.EMPTY);if(r?.indicator?.revealing?.src){let t=k.from(r.indicator.revealing.src);e=new Te(t),e.width=r.indicator.revealing.width??t.width,e.height=r.indicator.revealing.height??t.height}return e},lc=(r,e)=>{if(!e?.indicator?.complete?.src)return;let t=k.from(e.indicator.complete.src);r.texture=t,r.width=e.indicator.complete.width??t.width,r.height=e.indicator.complete.height??t.height},cc=(r,e,t)=>{r.x=t,r.y=e?e.y+(e.lineMaxHeight-r.height):0},Bd=(r,e,t)=>{if(!e||e.text.length===0){r.x=t;return}r.x=Id(e,e.text.length-1)+t},RG=(r,e)=>{if(r[vi]){let t=r[vi];delete r[vi],t()}r[vi]=e},IG=r=>r?.[kd]??null,ac=(r,e)=>r?e?(r[kd]=e,e):(delete r[kd],null):null,sM=r=>{let e=IG(r);return!e||e.mode!=="typewriter"||e.completed===!0?null:e},oM=r=>!!sM(r),Py=r=>{if(r[vi]){let t=r[vi];delete r[vi],t()}delete r[kd],r.onRender=void 0,r.removeChildren().forEach(t=>{t.destroy({children:!0})})},nM=(r,e="",t="")=>{let i=new Oe(ir(r.textStyle)),s=new Br({text:e,style:i,x:Math.round(r.x),y:Math.round(r.y)}),o=null;if(r.furigana){let n=new Oe(ir(r.furigana.textStyle));o=new Br({text:t,style:n,x:Math.round(r.furigana.x),y:Math.round(r.furigana.y)})}return{text:s,furiganaText:o}},aM=(r,e)=>{let t=null,i=null,s=0,o=0,n=[];for(let a=0;a0){let f=c.getLocalBounds();n.push({chunk:l,container:c,lastTextObject:h,totalCharacters:d,bounds:{x:f.x,y:f.y,width:f.width,height:f.height}})}else c.destroy()}return{lines:n,lastTextObject:t,lastChunk:i,totalCharacters:s,maxLineHeight:o,bounds:r.getLocalBounds()}},tM=({contentContainer:r,indicatorSprite:e,element:t})=>{let i=t?.indicator?.offset??12,{lastTextObject:s,lastChunk:o}=aM(r,t);cc(e,o,i),Bd(e,s,i),lc(e,t)},BG=({indicatorSprite:r,element:e})=>{let t=e?.indicator?.offset??12,i=e.content[0]??null;cc(r,i,t)},kG=async({contentContainer:r,indicatorSprite:e,element:t,signal:i,startAtCharacter:s=0,snapshot:o=null})=>{let n=iM(t.speed??50),a=t?.indicator?.offset??12,l=Math.max(1,Math.floor(1e3/n)),c=Math.max(1,Math.floor(4e3/n)),u=Math.max(0,Math.floor(s));o&&(o.revealedCharacters=u,o.completed=!1);for(let h=0;h0?Math.round(b/v.length*T):0;g.text=v.substring(0,b),_&&(_.text=x.substring(0,E)),u-=b,b>0&&(e.x=Id(g,b-1)+a);for(let w=b;w{let n=i?.indicator?.offset??12,a=iM(i.speed??50),{lines:l,lastTextObject:c,lastChunk:u,totalCharacters:h,maxLineHeight:d,bounds:f}=aM(e,i);if(cc(t,u,n),l.length===0||h===0||!l.some(C=>C.bounds.width>0&&C.bounds.height>0)||!globalThis.document||!s)return Bd(t,c,n),lc(t,i),!1;let p=Math.max(vG,Math.min(TG,Math.round(d*SG))),m=Math.max(1,Math.round(h/a*1e3)),g=l.map(C=>{let A=Math.max(1,C.totalCharacters),P=1+p/Math.max(1,C.bounds.width);return A*P}),_=g.reduce((C,A)=>C+A,0),v=[],x=0;for(let C=0;C0?x/_:0;x+=A,v.push({...l[C],startProgress:P,endProgress:_>0?x/_:1})}let T=o.getVersion(),b=`${i.id}-soft-wipe`,E=v.map(C=>{let A=document.createElement("canvas");A.width=Math.max(1,Math.ceil(C.bounds.width+p)),A.height=Math.max(1,Math.ceil(C.bounds.height));let P=A.getContext("2d");if(!P)return null;let R=Os(A),M=new Te(R);return M.x=Math.floor(C.bounds.x-p),M.y=Math.floor(C.bounds.y),C.container.mask=M,e.addChild(M),{canvas:A,context:P,texture:R,sprite:M,line:C}});if(E.some(C=>C===null))return E.forEach(C=>{C&&(C.line.container.mask===C.sprite&&(C.line.container.mask=null),C.sprite.parent&&C.sprite.parent.removeChild(C.sprite),C.sprite.destroy(),C.texture.destroy(!0))}),Bd(t,c,n),lc(t,i),!1;let w=!1,I=C=>{w||(w=!0,r[vi]===B&&delete r[vi],E.forEach(A=>{A.line.container.mask===A.sprite&&(A.line.container.mask=null),A.sprite.parent&&A.sprite.parent.removeChild(A.sprite),A.sprite.destroy(),A.texture.destroy(!0)}),C&&(Bd(t,c,n),lc(t,i)))},B=()=>{s.dispatch({type:"CANCEL",id:b}),I(!1)};return RG(r,B),o.track(T),s.dispatch({type:"START",payload:{id:b,driver:"custom",duration:m,applyFrame:C=>{let A=m>0?Math.min(C/m,1):1,P=v[0],R=0;for(let M=0;MJ&&(L.fillStyle="#ffffff",L.fillRect(J,Be,Math.min($e-J,F.bounds.width),F.bounds.height));let it=Math.max(J,Me-p),bt=Math.min(J+F.bounds.width,Me);if(bt>it){let Le=L.createLinearGradient(it,0,bt,0);Le.addColorStop(0,"rgba(255, 255, 255, 1)"),Le.addColorStop(1,"rgba(255, 255, 255, 0)"),L.fillStyle=Le,L.fillRect(it,Be,bt-it,F.bounds.height)}ue.source.update(),(N<1||M===v.length-1)&&(P=F,R=Math.min(1,(Me-J)/Math.max(1,F.bounds.width)))}cc(t,P.chunk,n),t.x=P.bounds.x+Math.min(P.bounds.width,P.bounds.width*R)+n},applyTargetState:()=>{I(!1)},onComplete:()=>{o.complete(T),I(!0)},onCancel:()=>{o.complete(T),I(!1)},isValid:()=>!!r&&!r.destroyed&&!e.destroyed&&!t.destroyed}}),!0},Ti=async({container:r,element:e,completionTracker:t,animationBus:i,zIndex:s,signal:o,playback:n="autoplay"})=>{if(o?.aborted||r.destroyed)return;let a=_n(e),l=n==="resume"?sM(r):null;if(n==="resume"&&!l)return;Py(r),r.zIndex=s;let c=new te({label:`${e.id}-content`}),u=MG(e);r.addChild(c),r.addChild(u);try{if(n==="paused-initial"){a||ac(r,{mode:CG(e),revealedCharacters:0,completed:!1}),a?(ac(r,{mode:"none",completed:!0}),tM({contentContainer:c,indicatorSprite:u,element:e})):BG({indicatorSprite:u,element:e});return}let h=t.getVersion(),d=!1;if(a)t.track(h),ac(r,{mode:"none",completed:!0}),tM({contentContainer:c,indicatorSprite:u,element:e}),d=!0;else if(e.revealEffect==="softWipe")if(ac(r,{mode:"softWipe",completed:!1}),!FG({container:r,contentContainer:c,indicatorSprite:u,element:e,animationBus:i,completionTracker:t})&&!o?.aborted&&!r.destroyed)t.track(h),d=!0;else return;else{t.track(h);let f=ac(r,{mode:"typewriter",revealedCharacters:l?.revealedCharacters??0,completed:!1});d=await kG({contentContainer:c,indicatorSprite:u,element:e,signal:o,startAtCharacter:l?.revealedCharacters??0,snapshot:f})}d&&!o?.aborted&&!r.destroyed&&t.complete(h)}catch(h){if(h?.name!=="AbortError"&&!o?.aborted)throw h}};var Fd=({suppressAnimations:r=!1,deferredMountOperations:e=[]}={})=>({suppressAnimations:r,deferredMountOperations:e}),lM=r=>{switch(r?.type){case"play-animated-sprite":r.animatedSprite?.destroyed||r.animatedSprite?.play();return;case"play-video":r.video?.play();return;case"start-particles":if(r.app?.debug){let e=t=>{if(r.emitter.destroyed){window.removeEventListener("snapShotKeyFrame",e);return}t?.detail?.deltaMS&&(r.emitter.update(Number(t.detail.deltaMS)/1e3),typeof r.app?.render=="function"&&r.app.render())};window.addEventListener("snapShotKeyFrame",e),r.container.customTickerHandler=e;return}r.app.ticker.add(r.tickerCallback);return;case"autoplay-text-reveal":Ti({container:r.container,element:r.element,completionTracker:r.completionTracker,animationBus:r.animationBus,zIndex:r.zIndex,signal:r.signal,playback:"autoplay"});return;case"start-update-animations":if(!r.element||r.element.destroyed)return;Rd({animations:r.animations,animationBus:r.animationBus,completionTracker:r.completionTracker,element:r.element,targetState:r.targetState});return}},uc=(r,e)=>{if(e?.type){if(!r?.suppressAnimations){lM(e);return}r.deferredMountOperations.push(e)}},Od=r=>{r?.deferredMountOperations&&(r.deferredMountOperations.length=0)},cM=(r,e)=>uc(r,{type:"play-animated-sprite",animatedSprite:e}),uM=(r,e)=>uc(r,{type:"play-video",video:e}),hM=(r,{app:e,emitter:t,container:i,tickerCallback:s})=>uc(r,{type:"start-particles",app:e,emitter:t,container:i,tickerCallback:s}),Ud=(r,{container:e,element:t,completionTracker:i,animationBus:s,zIndex:o,signal:n})=>uc(r,{type:"autoplay-text-reveal",container:e,element:t,completionTracker:i,animationBus:s,zIndex:o,signal:n}),dM=(r,{animations:e,animationBus:t,completionTracker:i,element:s,targetState:o})=>uc(r,{type:"start-update-animations",animations:e,animationBus:t,completionTracker:i,element:s,targetState:o}),fM=r=>{if(!r?.deferredMountOperations?.length)return;let e=r.deferredMountOperations.splice(0);for(let t of e)lM(t)};var pM=(r=[])=>{if(r instanceof Map)return r;let e=new Map;for(let t of r)e.has(t.targetId)||e.set(t.targetId,[]),e.get(t.targetId).push(t);return e},Gd=(r,e)=>r instanceof Map?r.get(e)??[]:r.filter(t=>t.targetId===e),OG=(r,e)=>Gd(r,e).filter(t=>t.type==="update"),Ld=(r,e)=>Gd(r,e).find(t=>t.type==="transition")??null,UG=({animations:r,targetId:e,animationBus:t,completionTracker:i,element:s,targetState:o,onComplete:n,renderContext:a})=>{let l=OG(r,e);if(l.length===0)return!1;if(a?.suppressAnimations){if(n)throw new Error("Deferred update animations do not support onComplete hooks.");return JC(s,l),dM(a,{animations:l,animationBus:t,completionTracker:i,element:s,targetState:o}),!0}return Rd({animations:l,animationBus:t,completionTracker:i,element:s,targetState:o,onComplete:n}),!0};var ne=UG;var xM=Symbol("routeGraphicsTextAnchorRatios"),yM=Symbol("routeGraphicsTextLayoutState"),mM=(r,e)=>typeof r!="number"||r===0?0:e/r,Cy=r=>r?.align??Ge.align,gM=r=>{let e=r[yM];return e?.fixedWidth&&typeof e.layoutWidth=="number"?e.layoutWidth:r.width},My=(r,e,t)=>{let i=Math.max(0,r-e);return t==="center"?i/2:t==="right"?i:0},hc=r=>{let e=r.measuredWidth??r.width,t=My(r.width,e,Cy(r.textStyle));return{x:r.x+t,y:r.y}},Dd=(r,e)=>{let t=e.__fixedWidth&&typeof e.width=="number"?e.width:r.width||e.width,i=r.height||e.height,s=typeof e.__anchorXRatio=="number"?e.__anchorXRatio:mM(t,e.originX),o=typeof e.__anchorYRatio=="number"?e.__anchorYRatio:mM(i,e.originY);r[xM]={x:s,y:o},r[yM]={fixedWidth:!!e.__fixedWidth,layoutWidth:e.width}},GG=r=>typeof r?.fontSize!="number"||r.fontSize===0||typeof r?.lineHeight!="number"?Ge.lineHeight:r.lineHeight/r.fontSize,LG=(r,e)=>{if(!e)return r;let t={...r,...e};if(e.fontSize!==void 0||e.lineHeight!==void 0){let i=e.lineHeight??GG(r);t.lineHeight=Math.round(t.fontSize*i)}return t},Jr=(r,e,t)=>{let i=r[xM],s=gM(r),o=LG(e,t);if(!i){Qr(r,o);return}let n=My(s,r.width,Cy(r.style)),l=r.x-n+s*i.x,c=r.y+r.height*i.y;Qr(r,o);let u=gM(r),h=My(u,r.width,Cy(r.style));r.x=l-u*i.x+h,r.y=c-r.height*i.y},Nd=(r,e)=>{let t=hc({...e,measuredWidth:r.width,width:e.__fixedWidth&&typeof e.width=="number"?e.width:r.width});r.x=t.x,r.y=t.y};var _M=r=>{if(!(!r||typeof r!="object")){if(typeof r.button=="number")return r.button;if(typeof r.data?.button=="number")return r.data.button;if(typeof r.nativeEvent?.button=="number")return r.nativeEvent.button}},nt=r=>{let e=_M(r);return e===void 0||e===0},bM=r=>_M(r)===2;var Ry=Symbol.for("routeGraphics.setInheritedHover"),vM=Symbol.for("routeGraphics.treeInheritedHoverActive"),Iy=Symbol.for("routeGraphics.setInheritedPress"),TM=Symbol.for("routeGraphics.treeInheritedPressActive"),By=Symbol.for("routeGraphics.setInheritedRightPress"),SM=Symbol.for("routeGraphics.treeInheritedRightPressActive"),bn=r=>Array.isArray(r?.children)?r.children:[],ky=({displayObject:r,symbol:e,source:t,isActive:i})=>{let s=r?.[e];typeof s=="function"&&s(t,i)},Hd=({displayObject:r,symbol:e})=>{r&&e in r&&delete r[e]},Fy=({displayObject:r,symbol:e,onStateChange:t})=>{let i=!1,s=new Set,o=({nextDirectActive:n=i,onInheritedChange:a})=>{let l=i||s.size>0;i=n,a?.(s);let c=i||s.size>0;return l!==c&&t(c),c};return r[e]=(n,a)=>o({onInheritedChange:l=>{if(n){if(a){l.add(n);return}l.delete(n)}}}),{setDirectState:n=>o({nextDirectActive:n}),isActive:()=>i||s.size>0,destroy:()=>{Hd({displayObject:r,symbol:e})}}},vn=r=>Hd({displayObject:r,symbol:Ry}),Vd=r=>Hd({displayObject:r,symbol:Iy}),Wd=r=>Hd({displayObject:r,symbol:By}),ei=({displayObject:r,onHoverChange:e})=>{let t=Fy({displayObject:r,symbol:Ry,onStateChange:e});return{setDirectHover:t.setDirectState,isHovering:t.isActive,destroy:t.destroy}},Ji=({displayObject:r,onPressChange:e})=>{let t=Fy({displayObject:r,symbol:Iy,onStateChange:e});return{setDirectPress:t.setDirectState,isPressed:t.isActive,destroy:t.destroy}},es=({displayObject:r,onPressChange:e})=>{let t=Fy({displayObject:r,symbol:By,onStateChange:e});return{setDirectPress:t.setDirectState,isPressed:t.isActive,destroy:t.destroy}},Oy=r=>r?.[vM]===!0,Uy=r=>r?.[TM]===!0,Gy=r=>r?.[SM]===!0,Tn=({root:r,isHovered:e})=>{if(!r)return;r[vM]=e;let t=[...bn(r)];for(;t.length>0;){let i=t.pop();ky({displayObject:i,symbol:Ry,source:r,isActive:e}),t.push(...bn(i))}},Gs=({root:r,isPressed:e})=>{if(!r)return;r[TM]=e;let t=[...bn(r)];for(;t.length>0;){let i=t.pop();ky({displayObject:i,symbol:Iy,source:r,isActive:e}),t.push(...bn(i))}},Si=({root:r,isPressed:e})=>{if(!r)return;r[SM]=e;let t=[...bn(r)];for(;t.length>0;){let i=t.pop();ky({displayObject:i,symbol:By,source:r,isActive:e}),t.push(...bn(i))}};var wM=({app:r,parent:e,element:t,animations:i,eventHandler:s,animationBus:o,completionTracker:n,renderContext:a,zIndex:l})=>{let c=new Br({label:t.id});c.zIndex=l,c.text=t.content,Qr(c,t.textStyle),Dd(c,t),c.alpha=t.alpha,Nd(c,t);let u=t?.hover,h=t?.click,d=t?.rightClick,f=null,p=null,m=null,g=()=>{let _=f?.isHovering()??!1,v=p?.isPressed()??!1;(m?.isPressed()??!1)&&d?.textStyle?Jr(c,t.textStyle,d.textStyle):v&&h?.textStyle?Jr(c,t.textStyle,h.textStyle):_&&u?.textStyle?Jr(c,t.textStyle,u.textStyle):Jr(c,t.textStyle)};if(u){let{cursor:_,soundSrc:v,payload:x}=u;c.eventMode="static",f=ei({displayObject:c,onHoverChange:g});let T=()=>{f.setDirectHover(!0),x&&s&&s("hover",{_event:{id:c.label},...x}),_&&(c.cursor=_),v&&r.audioStage.add({id:`hover-${Date.now()}`,url:v,loop:!1})},b=()=>{f.setDirectHover(!1),c.cursor="auto"};c.on("pointerover",T),c.on("pointerout",b)}if(h){let{soundSrc:_,soundVolume:v,payload:x}=h;c.eventMode="static",p=Ji({displayObject:c,onPressChange:g});let T=w=>{nt(w)&&p.setDirectPress(!0)},b=w=>{nt(w)&&(p.setDirectPress(!1),x&&s&&s("click",{_event:{id:c.label},...x}),_&&r.audioStage.add({id:`click-${Date.now()}`,url:_,loop:!1,volume:We(v)}))},E=()=>{p.setDirectPress(!1)};c.on("pointerdown",T),c.on("pointerup",b),c.on("pointerupoutside",E)}if(d){let{soundSrc:_,payload:v}=d;c.eventMode="static",m=es({displayObject:c,onPressChange:g});let x=()=>{m.setDirectPress(!0)},T=()=>{m.setDirectPress(!1)},b=()=>{m.setDirectPress(!1),v&&s&&s("rightClick",{_event:{id:c.label},...v}),_&&r.audioStage.add({id:`rightClick-${Date.now()}`,url:_,loop:!1})},E=()=>{m.setDirectPress(!1)};c.on("rightdown",x),c.on("rightup",T),c.on("rightclick",b),c.on("rightupoutside",E)}e.addChild(c),ne({animations:i,targetId:t.id,animationBus:o,completionTracker:n,element:c,targetState:{...hc(t),alpha:t.alpha},renderContext:a})};var DG=Object.prototype.hasOwnProperty,pe=(r,e)=>{if(Object.is(r,e))return!0;if(r===null||e===null||typeof r!="object"||typeof e!="object")return!1;let t=Array.isArray(r),i=Array.isArray(e);if(t!==i)return!1;if(t&&i){if(r.length!==e.length)return!1;for(let n=0;n{let c=e.children.find(f=>f.label===t.id);if(!c)return;c.zIndex=l;let{alpha:u}=i,h=()=>{if(!pe(t,i)){c.text=i.content,Qr(c,i.textStyle),Dd(c,i),Nd(c,i),c.alpha=u,c.removeAllListeners("pointerover"),c.removeAllListeners("pointerout"),c.removeAllListeners("pointerdown"),c.removeAllListeners("pointerupoutside"),c.removeAllListeners("pointerup"),c.removeAllListeners("rightdown"),c.removeAllListeners("rightclick"),c.removeAllListeners("rightup"),c.removeAllListeners("rightupoutside"),vn(c),Vd(c),Wd(c);let f=i?.hover,p=i?.click,m=i?.rightClick,g=null,_=null,v=null,x=()=>{let T=g?.isHovering()??!1,b=_?.isPressed()??!1;(v?.isPressed()??!1)&&m?.textStyle?Jr(c,i.textStyle,m.textStyle):b&&p?.textStyle?Jr(c,i.textStyle,p.textStyle):T&&f?.textStyle?Jr(c,i.textStyle,f.textStyle):Jr(c,i.textStyle)};if(f){let{cursor:T,soundSrc:b,payload:E}=f;c.eventMode="static",g=ei({displayObject:c,onHoverChange:x});let w=()=>{g.setDirectHover(!0),E&&s&&s("hover",{_event:{id:c.label},...E}),T&&(c.cursor=T),b&&r.audioStage.add({id:`hover-${Date.now()}`,url:b,loop:!1})},I=()=>{g.setDirectHover(!1),c.cursor="auto"};c.on("pointerover",w),c.on("pointerout",I)}if(p){let{soundSrc:T,soundVolume:b,payload:E}=p;c.eventMode="static",_=Ji({displayObject:c,onPressChange:x});let w=C=>{nt(C)&&_.setDirectPress(!0)},I=C=>{nt(C)&&(_.setDirectPress(!1),E&&s&&s("click",{_event:{id:c.label},...E}),T&&r.audioStage.add({id:`click-${Date.now()}`,url:T,loop:!1,volume:We(b)}))},B=()=>{_.setDirectPress(!1)};c.on("pointerdown",w),c.on("pointerup",I),c.on("pointerupoutside",B)}if(m){let{soundSrc:T,payload:b}=m;c.eventMode="static",v=es({displayObject:c,onPressChange:x});let E=()=>{v.setDirectPress(!0)},w=()=>{v.setDirectPress(!1)},I=()=>{v.setDirectPress(!1),b&&s&&s("rightClick",{_event:{id:c.label},...b}),T&&r.audioStage.add({id:`rightClick-${Date.now()}`,url:T,loop:!1})},B=()=>{v.setDirectPress(!1)};c.on("rightdown",E),c.on("rightup",w),c.on("rightclick",I),c.on("rightupoutside",B)}}};ne({animations:o,targetId:t.id,animationBus:n,completionTracker:a,element:c,targetState:{...hc(i),alpha:u},onComplete:()=>{h()}})||h()};var AM=({parent:r,element:e,animations:t,animationBus:i,completionTracker:s})=>{let o=r.getChildByLabel(e.id);if(!o)return;ne({animations:t,targetId:e.id,animationBus:i,completionTracker:s,element:o,targetState:null,onComplete:()=>{o&&!o.destroyed&&o.destroy()}})||o.destroy()};var PM=({positionX:r=0,positionY:e=0,width:t,height:i,anchorX:s=0,anchorY:o=0})=>{if(typeof t!="number"||typeof i!="number")throw new Error("Input Error: Width or height is missing");let n={x:t*s,y:i*o},a=r-n.x,l=e-n.y;return{x:a,y:l,originX:n.x,originY:n.y}};var yt=r=>{if(typeof r.width!="number"||typeof r.height!="number")throw new Error("Input Error: Width or height is missing");if(!Object.values(Us).includes(r.type))throw new Error("Input Error: Type must be one of "+Object.values(Us).join(", "));if(!r.id)throw new Error("Input Error: Id is missing");let e=r.scaleX?r.scaleX*r.width:r.width,t=r.scaleY?r.scaleY*r.height:r.height;r.type===Us.CONTAINER&&(e=r.width,t=r.height);let{x:i,y:s,originX:o,originY:n}=PM({positionX:r.x,positionY:r.y,width:e,height:t,anchorX:r.anchorX,anchorY:r.anchorY}),a={id:r.id,type:r.type,width:Math.round(e),height:Math.round(t),x:Math.round(i),y:Math.round(s),originX:Math.round(o),originY:Math.round(n),alpha:r.alpha??1};return r.hover&&(a.hover=r.hover),r.click&&(a.click=r.click),a};var CM=({state:r})=>{let e={...Ge,...r.textStyle};e.lineHeight=Math.round(e.fontSize*e.lineHeight),typeof r.width=="number"&&(e.wordWrapWidth=r.width,e.wordWrap=!0);let t=String(r.content??""),{width:i,height:s}=De.measureText(t,new Oe(ir(e))),o=Math.round(i),n=Math.round(s),a=typeof r.width=="number"?Math.round(r.width):o,c={...yt({...r,width:a,height:n}),content:t,measuredWidth:o,textStyle:{...e},...r.hover&&{hover:r.hover},...r.click&&{click:r.click},...r.rightClick&&{rightClick:r.rightClick}};return Object.defineProperties(c,{__anchorXRatio:{value:r.anchorX??0,enumerable:!1},__anchorYRatio:{value:r.anchorY??0,enumerable:!1},__fixedWidth:{value:typeof r.width=="number",enumerable:!1}}),c};var NG=et({type:"text",add:wM,update:EM,delete:AM,parse:CM});var MM="__rtglRectScrollHandled",zd=({canvas:r,rect:e,width:t,height:i,scrollUpEvent:s,scrollDownEvent:o,eventHandler:n})=>{if(!s&&!o)return;let a=!1;e.eventMode="static",e.hitArea=new Q(0,0,Math.round(t),Math.round(i));let l=(f,p)=>{p?.[MM]||(p&&(p[MM]=!0),f<0&&s?.payload&&n?n("scrollUp",{_event:{id:e.label},...s.payload}):f>0&&o?.payload&&n&&n("scrollDown",{_event:{id:e.label},...o.payload}))},c=()=>{a=!0},u=()=>{a=!1},h=f=>{f.preventDefault?.(),l(f.deltaY,f.nativeEvent)},d=f=>{a&&(f.preventDefault(),l(f.deltaY,f))};e.on("pointerover",c),e.on("pointerout",u),e.on("wheel",h),r?.addEventListener("wheel",d,{passive:!1}),e._cleanupScrollInteraction=()=>{a=!1,e.off("pointerover",c),e.off("pointerout",u),e.off("wheel",h),r?.removeEventListener("wheel",d),e.hitArea=null,delete e._cleanupScrollInteraction}};var HG=r=>r==null||r===""||r==="transparent"?{color:0,alpha:0}:r,RM=({app:r,parent:e,element:t,animations:i,animationBus:s,eventHandler:o,zIndex:n,completionTracker:a,renderContext:l})=>{let{id:c,x:u,y:h,width:d,height:f,fill:p,border:m,alpha:g,scaleX:_,scaleY:v}=t,x=new Ue;x.label=c,x.zIndex=n;let T={x:u,y:h,alpha:g};_!==void 0&&(T.scaleX=_),v!==void 0&&(T.scaleY=v),(()=>{x.clear(),x.rect(0,0,Math.round(d),Math.round(f)).fill(HG(p)),x.x=Math.round(u),x.y=Math.round(h),x.alpha=g,x.scale.x=1,x.scale.y=1,m&&x.stroke({color:m.color,alpha:m.alpha,width:Math.round(m.width)})})();let E=t?.hover,w=t?.click,I=t?.rightClick,B=t?.scrollUp,C=t?.scrollDown,A=t?.drag;if(E){let{cursor:P,soundSrc:R,payload:M}=E;x.eventMode="static";let F=()=>{M&&o&&o("hover",{_event:{id:x.label},...M}),P&&(x.cursor=P),R&&r.audioStage.add({id:`hover-${Date.now()}`,url:R,loop:!1})},O=()=>{x.cursor="auto"};x.on("pointerover",F),x.on("pointerout",O)}if(w){let{soundSrc:P,soundVolume:R,payload:M}=w;x.eventMode="static";let F=O=>{nt(O)&&(M&&o&&o("click",{_event:{id:x.label},...M}),P&&r.audioStage.add({id:`click-${Date.now()}`,url:P,loop:!1,volume:We(R)}))};x.on("pointerup",F)}if(I){let{soundSrc:P,payload:R}=I;x.eventMode="static";let M=()=>{R&&o&&o("rightClick",{_event:{id:x.label},...R}),P&&r.audioStage.add({id:`rightClick-${Date.now()}`,url:P,loop:!1})};x.on("rightclick",M)}if((B||C)&&zd({canvas:r.canvas,rect:x,width:d,height:f,scrollUpEvent:B,scrollDownEvent:C,eventHandler:o}),A){let{start:P,end:R,move:M}=A;x.eventMode="static";let F=()=>{x._isDragging=!0,P&&o&&o("dragStart",{_event:{id:x.label},...typeof P?.payload=="object"?P.payload:{}})},O=()=>{x._isDragging=!1,R&&o&&o("dragEnd",{_event:{id:x.label},...typeof R?.payload=="object"?R.payload:{}})},D=N=>{M&&o&&x._isDragging&&o("dragMove",{_event:{id:x.label,x:N.global.x,y:N.global.y},...typeof M?.payload=="object"?M.payload:{}})};x.on("pointerdown",F),x.on("pointerup",O),x.on("globalpointermove",D),x.on("pointerupoutside",O)}e.addChild(x),ne({animations:i,targetId:c,animationBus:s,completionTracker:a,element:x,targetState:T,renderContext:l})};var VG=r=>r==null||r===""||r==="transparent"?{color:0,alpha:0}:r,IM=({app:r,parent:e,prevElement:t,nextElement:i,animations:s,animationBus:o,eventHandler:n,zIndex:a,completionTracker:l})=>{let c=e.children.find(E=>E.label===t.id);if(!c)return;c.zIndex=a;let{x:u,y:h,width:d,height:f,fill:p,border:m,alpha:g,scaleX:_,scaleY:v}=i,x={x:u,y:h,alpha:g};_!==void 0&&(x.scaleX=_),v!==void 0&&(x.scaleY=v);let T=()=>{if(!pe(t,i)){c._cleanupScrollInteraction?.(),c.clear(),c.rect(0,0,Math.round(d),Math.round(f)).fill(VG(p)),c.x=Math.round(u),c.y=Math.round(h),c.alpha=g,c.scale.x=1,c.scale.y=1,m&&c.stroke({color:m.color,alpha:m.alpha,width:Math.round(m.width)}),c.removeAllListeners("pointerover"),c.removeAllListeners("pointerout"),c.removeAllListeners("pointerup"),c.removeAllListeners("rightclick"),c.removeAllListeners("wheel"),c.removeAllListeners("pointerdown"),c.removeAllListeners("globalpointermove"),c.removeAllListeners("pointerupoutside");let E=i?.hover,w=i?.click,I=i?.rightClick,B=i?.scrollUp,C=i?.scrollDown,A=i?.drag;if(E){let{cursor:P,soundSrc:R,payload:M}=E;c.eventMode="static";let F=()=>{M&&n&&n("hover",{_event:{id:c.label},...M}),P&&(c.cursor=P),R&&r.audioStage.add({id:`hover-${Date.now()}`,url:R,loop:!1})},O=()=>{c.cursor="auto"};c.on("pointerover",F),c.on("pointerout",O)}if(w){let{soundSrc:P,soundVolume:R,payload:M}=w;c.eventMode="static";let F=O=>{nt(O)&&(M&&n&&n("click",{_event:{id:c.label},...M}),P&&r.audioStage.add({id:`click-${Date.now()}`,url:P,loop:!1,volume:We(R)}))};c.on("pointerup",F)}if(I){let{soundSrc:P,payload:R}=I;c.eventMode="static";let M=()=>{R&&n&&n("rightClick",{_event:{id:c.label},...R}),P&&r.audioStage.add({id:`rightClick-${Date.now()}`,url:P,loop:!1})};c.on("rightclick",M)}if((B||C)&&zd({canvas:r.canvas,rect:c,width:d,height:f,scrollUpEvent:B,scrollDownEvent:C,eventHandler:n}),A){let{start:P,end:R,move:M}=A;c.eventMode="static";let F=()=>{c._isDragging=!0,P&&n&&n("dragStart",{_event:{id:c.label},...typeof P?.payload=="object"?P.payload:{}})},O=()=>{c._isDragging=!1,R&&n&&n("dragEnd",{_event:{id:c.label},...typeof R?.payload=="object"?R.payload:{}})},D=N=>{M&&n&&c._isDragging&&n("dragMove",{_event:{id:c.label,x:N.global.x,y:N.global.y},...typeof M?.payload=="object"?M.payload:{}})};c.on("pointerdown",F),c.on("pointerup",O),c.on("globalpointermove",D),c.on("pointerupoutside",O)}}};ne({animations:s,targetId:t.id,animationBus:o,completionTracker:l,element:c,targetState:x,onComplete:()=>{T()}})||T()};var BM=({parent:r,element:e,animations:t,animationBus:i,completionTracker:s})=>{let o=r.getChildByLabel(e.id);if(!o)return;ne({animations:t,targetId:e.id,animationBus:i,completionTracker:s,element:o,targetState:null,onComplete:()=>{o&&!o.destroyed&&(o._cleanupScrollInteraction?.(),o.destroy())}})||(o._cleanupScrollInteraction?.(),o.destroy())};var kM=({state:r})=>{let e=yt(r),t=r.border?.width,i=e;return typeof t=="number"&&t>0&&(i={...e,border:{alpha:r.border?.alpha??1,color:r.border?.color??"black",width:t}}),{...i,...r.fill!==void 0?{fill:r.fill}:{},...r.scaleX!==void 0?{scaleX:r.scaleX}:{},...r.scaleY!==void 0?{scaleY:r.scaleY}:{},rotation:r.rotation??0,...r.drag&&{drag:r.drag},...r.rightClick&&{rightClick:r.rightClick},...r.scrollUp&&{scrollUp:r.scrollUp},...r.scrollDown&&{scrollDown:r.scrollDown}}};var WG=et({type:"rect",add:RM,update:IM,delete:BM,parse:kM});var FM=({app:r,parent:e,element:t,animations:i,eventHandler:s,animationBus:o,completionTracker:n,renderContext:a,zIndex:l})=>{let{id:c,x:u,y:h,width:d,height:f,src:p,alpha:m}=t,g=p?k.from(p):k.EMPTY,_=new Te(g);_.label=c,_.zIndex=l,_.x=Math.round(u),_.y=Math.round(h),_.width=Math.round(d),_.height=Math.round(f),_.alpha=m;let v=t?.hover,x=t?.click,T=t?.rightClick,b=null,E=null,w=null,I=()=>{let B=b?.isHovering()??!1,C=E?.isPressed()??!1;if((w?.isPressed()??!1)&&T?.src){let P=k.from(T.src);_.texture=P}else if(C&&x?.src){let P=k.from(x.src);_.texture=P}else if(B&&v?.src){let P=k.from(v.src);_.texture=P}else _.texture=g};if(v){let{cursor:B,soundSrc:C,payload:A}=v;_.eventMode="static",b=ei({displayObject:_,onHoverChange:I});let P=()=>{b.setDirectHover(!0),A&&s&&s("hover",{_event:{id:_.label},...A}),B&&(_.cursor=B),C&&r.audioStage.add({id:`hover-${Date.now()}`,url:C,loop:!1})},R=()=>{b.setDirectHover(!1),_.cursor="auto"};_.on("pointerover",P),_.on("pointerout",R)}if(x){let{soundSrc:B,soundVolume:C,payload:A}=x;_.eventMode="static",E=Ji({displayObject:_,onPressChange:I});let P=F=>{nt(F)&&E.setDirectPress(!0)},R=F=>{nt(F)&&(E.setDirectPress(!1),A&&s&&s("click",{_event:{id:_.label},...A}),B&&r.audioStage.add({id:`click-${Date.now()}`,url:B,loop:!1,volume:We(C)}))},M=()=>{E.setDirectPress(!1)};_.on("pointerdown",P),_.on("pointerup",R),_.on("pointerupoutside",M)}if(T){let{soundSrc:B,payload:C}=T;_.eventMode="static",w=es({displayObject:_,onPressChange:I});let A=()=>{w.setDirectPress(!0)},P=()=>{w.setDirectPress(!1)},R=()=>{w.setDirectPress(!1),C&&s&&s("rightClick",{_event:{id:_.label},...C}),B&&r.audioStage.add({id:`rightClick-${Date.now()}`,url:B,loop:!1})},M=()=>{w.setDirectPress(!1)};_.on("rightdown",A),_.on("rightup",P),_.on("rightclick",R),_.on("rightupoutside",M)}e.addChild(_),ne({animations:i,targetId:c,animationBus:o,completionTracker:n,element:_,targetState:{x:u,y:h,width:d,height:f,alpha:m},renderContext:a})};var OM=({app:r,parent:e,prevElement:t,nextElement:i,animations:s,animationBus:o,completionTracker:n,eventHandler:a,zIndex:l})=>{let c=e.children.find(x=>x.label===t.id);if(!c)return;c.zIndex=l;let{id:u,x:h,y:d,width:f,height:p,src:m,alpha:g}=i,_=()=>{if(!pe(t,i)){let x=m?k.from(m):k.EMPTY;c.texture=x,c.x=Math.round(h),c.y=Math.round(d),c.width=Math.round(f),c.height=Math.round(p),c.alpha=g,c.removeAllListeners("pointerover"),c.removeAllListeners("pointerout"),c.removeAllListeners("pointerdown"),c.removeAllListeners("pointerupoutside"),c.removeAllListeners("pointerup"),c.removeAllListeners("rightdown"),c.removeAllListeners("rightclick"),c.removeAllListeners("rightup"),c.removeAllListeners("rightupoutside"),vn(c),Vd(c),Wd(c);let T=i?.hover,b=i?.click,E=i?.rightClick,w=null,I=null,B=null,C=()=>{let A=w?.isHovering()??!1,P=I?.isPressed()??!1;if((B?.isPressed()??!1)&&E?.src){let M=k.from(E.src);c.texture=M}else if(P&&b?.src){let M=k.from(b.src);c.texture=M}else if(A&&T?.src){let M=k.from(T.src);c.texture=M}else c.texture=x};if(T){let{cursor:A,soundSrc:P,payload:R}=T;c.eventMode="static",w=ei({displayObject:c,onHoverChange:C});let M=()=>{w.setDirectHover(!0),R&&a&&a("hover",{_event:{id:c.label},...R}),A&&(c.cursor=A),P&&r.audioStage.add({id:`hover-${Date.now()}`,url:P,loop:!1})},F=()=>{w.setDirectHover(!1),c.cursor="auto"};c.on("pointerover",M),c.on("pointerout",F)}if(b){let{soundSrc:A,soundVolume:P,payload:R}=b;c.eventMode="static",I=Ji({displayObject:c,onPressChange:C});let M=D=>{nt(D)&&I.setDirectPress(!0)},F=D=>{nt(D)&&(I.setDirectPress(!1),R&&a&&a("click",{_event:{id:c.label},...R}),A&&r.audioStage.add({id:`click-${Date.now()}`,url:A,loop:!1,volume:We(P)}))},O=()=>{I.setDirectPress(!1)};c.on("pointerdown",M),c.on("pointerup",F),c.on("pointerupoutside",O)}if(E){let{soundSrc:A,payload:P}=E;c.eventMode="static",B=es({displayObject:c,onPressChange:C});let R=()=>{B.setDirectPress(!0)},M=()=>{B.setDirectPress(!1)},F=()=>{B.setDirectPress(!1),P&&a&&a("rightClick",{_event:{id:c.label},...P}),A&&r.audioStage.add({id:`rightClick-${Date.now()}`,url:A,loop:!1})},O=()=>{B.setDirectPress(!1)};c.on("rightdown",R),c.on("rightup",M),c.on("rightclick",F),c.on("rightupoutside",O)}}};ne({animations:s,targetId:t.id,animationBus:o,completionTracker:n,element:c,targetState:{x:h,y:d,width:f,height:p,alpha:g},onComplete:()=>{_()}})||_()};var UM=({parent:r,element:e,animations:t,animationBus:i,completionTracker:s})=>{let o=r.children.find(a=>a.label===e.id);if(!o)return;ne({animations:t,targetId:e.id,animationBus:i,completionTracker:s,element:o,targetState:null,onComplete:()=>{o&&!o.destroyed&&o.destroy()}})||o.destroy()};var GM=({state:r})=>({...yt(r),src:r.src??"",alpha:r.alpha??1,...r.hover&&{hover:r.hover},...r.click&&{click:r.click},...r.rightClick&&{rightClick:r.rightClick}});var zG=et({type:"sprite",add:FM,update:OM,delete:UM,parse:GM});var $G=r=>!r||r.ended?!0:Number.isFinite(r.duration)&&r.duration>0&&r.currentTime>=r.duration,Ly=({videoElement:r,video:e})=>{e&&r?._videoEndedListener&&e.removeEventListener("ended",r._videoEndedListener),r&&(r._videoEndedListener=void 0,r._playbackStateVersion=null)},$d=({videoElement:r,video:e,loop:t,completionTracker:i})=>{if(Ly({videoElement:r,video:e}),(t??!1)||$G(e))return;let s=i.getVersion();i.track(s);let o=()=>{i.complete(s)};e.addEventListener("ended",o),r._videoEndedListener=o,r._playbackStateVersion=s};var LM=({parent:r,element:e,renderContext:t,completionTracker:i,zIndex:s})=>{let{id:o,x:n,y:a,width:l,height:c,src:u,volume:h,loop:d,alpha:f}=e,p=k.from(u),m=p.source.resource;m.pause(),m.currentTime=0,m.loop=d??!1,m.volume=We(h),m.muted=!1;let g=new Te(p);g.label=o,g.zIndex=s,g._videoEndedListener=void 0,g._playbackStateVersion=null,g.x=Math.round(n),g.y=Math.round(a),g.width=Math.round(l),g.height=Math.round(c),g.alpha=f??1,$d({videoElement:g,video:m,loop:d,completionTracker:i}),uM(t,m),r.addChild(g)};var DM=({parent:r,prevElement:e,nextElement:t,animations:i,animationBus:s,eventHandler:o,completionTracker:n,zIndex:a})=>{let l=r.children.find(g=>g.label===e.id);if(!l)return;l.zIndex=a;let{x:c,y:u,width:h,height:d,alpha:f}=t,p=()=>{if(!pe(e,t)){l.x=Math.round(c),l.y=Math.round(u),l.width=Math.round(h),l.height=Math.round(d),l.alpha=f??1;let g=l.texture.source.resource;if(e.src!==t.src){let _=g;Ly({videoElement:l,video:_}),_&&_.pause();let v=k.from(t.src);l.texture=v,g=v.source.resource,g.muted=!1,g.pause(),g.currentTime=0}$d({videoElement:l,video:g,loop:t.loop,completionTracker:n}),g.volume=We(t.volume),g.loop=t.loop??!1,e.src!==t.src&&g.play()}};ne({animations:i,targetId:e.id,animationBus:s,completionTracker:n,element:l,targetState:{x:c,y:u,width:h,height:d,alpha:f??1},onComplete:p})||p()};var NM=({parent:r,element:e,animations:t,animationBus:i,completionTracker:s})=>{let o=r.children.find(l=>l.label===e.id);if(!o)return;let n=()=>{if(o&&!o.destroyed){o._playbackStateVersion!==null&&s.complete(o._playbackStateVersion);let l=o.texture.source.resource;l&&(o._videoEndedListener&&l.removeEventListener("ended",o._videoEndedListener),l.pause()),r.removeChild(o),o.destroy()}};ne({animations:t,targetId:e.id,animationBus:i,completionTracker:s,element:o,targetState:null,onComplete:n})||n()};var HM=({state:r})=>({...yt(r),src:r.src,volume:r.volume??100,loop:r.loop??!1});var XG=et({type:"video",add:LM,update:DM,delete:NM,parse:HM});var VM=0,WM=16,jG=(r,e)=>r!==null&&typeof r=="object"&&Object.prototype.hasOwnProperty.call(r,e),Ny=r=>Math.max(0,Math.min(1,r)),Ls=r=>r?k.from(r):k.EMPTY,Sn=r=>({bar:`${r}-bar`,inactiveBar:`${r}-inactive-bar`,barMask:`${r}-bar-mask`,thumb:`${r}-thumb`}),$M=({sliderContainer:r,fromId:e,toId:t})=>{if(e===t)return;let i=Sn(e),s=Sn(t);for(let[o,n]of Object.entries(i)){let a=r.getChildByLabel(n);a&&(a.label=s[o])}},wn=({sliderContainer:r,id:e})=>{let t=Sn(e);return{bar:r.getChildByLabel(t.bar),inactiveBar:r.getChildByLabel(t.inactiveBar),barMask:r.getChildByLabel(t.barMask),thumb:r.getChildByLabel(t.thumb)}},Dy=({baseValue:r,override:e,key:t})=>jG(e,t)?e[t]??"":r??"",YG=(r,e=null)=>({thumbSrc:Dy({baseValue:r.thumbSrc,override:e,key:"thumbSrc"}),barSrc:Dy({baseValue:r.barSrc,override:e,key:"barSrc"}),inactiveBarSrc:Dy({baseValue:r.inactiveBarSrc,override:e,key:"inactiveBarSrc"})}),qG=r=>{let e=new Te(k.EMPTY);return e.label=r,e.eventMode="static",e.zIndex=0,e},KG=r=>{let e=new Ue;return e.label=r,e.zIndex=0,e},ZG=({sliderContainer:r,id:e,bar:t})=>{let i=Sn(e),{inactiveBar:s,barMask:o}=wn({sliderContainer:r,id:e});return s||(s=qG(i.inactiveBar),r.addChild(s)),o||(o=KG(i.barMask),r.addChild(o)),t.mask=o,{inactiveBar:s,barMask:o}},QG=({sliderContainer:r,id:e,bar:t})=>{let{inactiveBar:i,barMask:s}=wn({sliderContainer:r,id:e});t?.mask===s&&(t.mask=null),i&&(r.removeChild(i),i.destroy()),s&&(r.removeChild(s),s.destroy())},XM=({currentValue:r,min:e,max:t})=>{let i=t-e;return i<=0?0:Ny((r-e)/i)},JG=({barMask:r,direction:e,width:t,height:i,currentValue:s,min:o,max:n})=>{if(!r)return;let a=XM({currentValue:s,min:o,max:n}),l=Math.round(e==="horizontal"?t*a:t),c=Math.round(e==="horizontal"?i:i*a);r.clear(),!(l<=0||c<=0)&&r.rect(0,0,l,c).fill({color:16777215,alpha:0})},eL=({thumb:r,direction:e,currentValue:t,min:i,max:s,trackWidth:o,trackHeight:n})=>{let a=XM({currentValue:t,min:i,max:s});if(e==="horizontal"){r.x=a*(o-r.width),r.y=(n-r.height)/2;return}r.x=(o-r.width)/2,r.y=a*(n-r.height)},Xd=({thumb:r,thumbSrc:e,direction:t,trackWidth:i,trackHeight:s})=>{let o=t==="horizontal"?s-VM*2:i-VM*2,n=Ls(e),a=n.width||WM,l=n.height||WM,c=o/a,u=o/l,h=Math.min(c,u);r.width=a*h,r.height=l*h},dc=({sliderContainer:r,sliderComputedNode:e,thumb:t,currentValue:i,hoverOverride:s=null})=>{let{id:o,width:n,height:a,direction:l,min:c,max:u}=e,{barSrc:h,inactiveBarSrc:d,thumbSrc:f}=YG(e,s),{bar:p}=wn({sliderContainer:r,id:o});if(p){if(p.texture=Ls(h),p.width=n,p.height=a,t.texture=Ls(f),d){let{inactiveBar:m,barMask:g}=ZG({sliderContainer:r,id:o,bar:p});m.texture=Ls(d),m.width=n,m.height=a,JG({barMask:g,direction:l,width:n,height:a,currentValue:i,min:c,max:u})}else QG({sliderContainer:r,id:o,bar:p});eL({thumb:t,direction:l,currentValue:i,min:c,max:u,trackWidth:n,trackHeight:a})}},tL=({position:r,thumb:e,direction:t,min:i,max:s,step:o,trackWidth:n,trackHeight:a})=>{let l=s-i,c;if(t==="horizontal"){let h=r.x-e.width/2,d=Math.max(n-e.width,1);c=Ny(h/d)}else{let h=r.y-e.height/2,d=Math.max(a-e.height,1);c=Ny(h/d)}let u=i+c*l;return o>0&&(u=Math.round((u-i)/o)*o+i,u=Math.max(i,Math.min(s,u))),u},zM=({sliderContainer:r,sliderComputedNode:e,cursor:t})=>{let i=t??"auto",{bar:s,inactiveBar:o,thumb:n}=wn({sliderContainer:r,id:e.id});r.cursor=i,s&&(s.cursor=i),o&&(o.cursor=i),n&&(n.cursor=i)},jd=({app:r,sliderContainer:e,sliderComputedNode:t,thumb:i,eventHandler:s})=>{vn(e);let{id:o,hover:n,change:a,min:l,max:c,step:u,direction:h,initialValue:d,width:f,height:p}=t,m=d??l,g=!1,_=null,v=()=>{dc({sliderContainer:e,sliderComputedNode:t,thumb:i,currentValue:m,hoverOverride:_?.isHovering()?n:null})},x=B=>{let C=e.toLocal(B.global),A=tL({position:C,thumb:i,direction:h,min:l,max:c,step:u,trackWidth:f,trackHeight:p});A!==m&&(m=A,v(),a?.payload&&s&&s("change",{_event:{id:o,value:m},...a.payload}))},T=B=>{g=!0,x(B)},b=B=>{g&&x(B)},E=()=>{g&&(g=!1)};if(e.on("pointerdown",T),e.on("globalpointermove",b),e.on("pointerup",E),e.on("pointerupoutside",E),!n)return;_=ei({displayObject:e,onHoverChange:v});let w=()=>{_.setDirectHover(!0),v(),zM({sliderContainer:e,sliderComputedNode:t,cursor:n.cursor}),n.soundSrc&&r.audioStage.add({id:`hover-${Date.now()}`,url:n.soundSrc,loop:!1})},I=()=>{g||(_.setDirectHover(!1),v(),zM({sliderContainer:e,sliderComputedNode:t,cursor:null}))};e.on("pointerover",w),e.on("pointerout",I),e.on("pointerupoutside",I)};var jM=({app:r,parent:e,element:t,animations:i,animationBus:s,completionTracker:o,eventHandler:n,renderContext:a,zIndex:l})=>{let{id:c,x:u,y:h,width:d,height:f,alpha:p,thumbSrc:m,barSrc:g,initialValue:_,min:v}=t,x=new te;x.label=c,x.zIndex=l,x.x=u,x.y=h,x.alpha=p,x.sortableChildren=!0,x.eventMode="static";let T=Sn(c),b=new Te(Ls(g));b.label=T.bar,b.eventMode="static",b.zIndex=1;let E=new Te(Ls(m));E.label=T.thumb,E.eventMode="static",E.zIndex=2;let w=_??v;Xd({thumb:E,thumbSrc:m,direction:t.direction,trackWidth:d,trackHeight:f}),x.addChild(b),x.addChild(E),dc({sliderContainer:x,sliderComputedNode:t,thumb:E,currentValue:w}),jd({app:r,sliderContainer:x,sliderComputedNode:t,thumb:E,eventHandler:n}),e.addChild(x),ne({animations:i,targetId:c,animationBus:s,completionTracker:o,element:x,targetState:{x:u,y:h,alpha:p},renderContext:a})};var YM=({app:r,parent:e,prevElement:t,nextElement:i,animations:s,animationBus:o,completionTracker:n,eventHandler:a,zIndex:l})=>{let c=e.children.find(m=>m.label===t.id);if(!c)return;c.zIndex=l;let u=()=>{if(!pe(t,i)){c.x=i.x,c.y=i.y,c.alpha=i.alpha,c.label=i.id,c.pivot.set(i.originX,i.originY),$M({sliderContainer:c,fromId:t.id,toId:i.id});let{bar:m,thumb:g}=wn({sliderContainer:c,id:i.id}),_=!pe(t.hover,i.hover)||!pe(t.change,i.change)||t.min!==i.min||t.max!==i.max||t.step!==i.step||t.direction!==i.direction||t.initialValue!==i.initialValue||t.thumbSrc!==i.thumbSrc||t.barSrc!==i.barSrc||t.inactiveBarSrc!==i.inactiveBarSrc||t.width!==i.width||t.height!==i.height||t.id!==i.id;if(m&&g&&(Xd({thumb:g,thumbSrc:i.thumbSrc,direction:i.direction,trackWidth:i.width,trackHeight:i.height}),dc({sliderContainer:c,sliderComputedNode:i,thumb:g,currentValue:i.initialValue})),!m||!g)return;_&&(c.removeAllListeners("pointerover"),c.removeAllListeners("pointerout"),c.removeAllListeners("pointerup"),c.removeAllListeners("pointerupoutside"),c.removeAllListeners("pointerdown"),c.removeAllListeners("globalpointermove")),_&&jd({app:r,sliderContainer:c,sliderComputedNode:i,thumb:g,eventHandler:a})}},{x:h,y:d,alpha:f}=i;ne({animations:s,targetId:t.id,animationBus:o,completionTracker:n,element:c,targetState:{x:h,y:d,alpha:f},onComplete:u})||u()};var qM=({app:r,parent:e,element:t,animations:i,animationBus:s,completionTracker:o})=>{let n=e.getChildByLabel(t.id);if(!n)return;let a=()=>{n&&!n.destroyed&&n.destroy({children:!0})};ne({animations:i,targetId:t.id,animationBus:s,completionTracker:o,element:n,targetState:null,onComplete:a})||a()};var KM=({state:r})=>{let e=yt(r),t=r.min??0,i=r.max??100;if(i<=t)throw new Error("Input error: the max value of a slider must be larger than the min value");if(r.initialValue===void 0)throw new Error("Input error: slider initialValue is required");if(typeof r.initialValue!="number"||Number.isNaN(r.initialValue))throw new Error("Input error: slider initialValue must be a valid number");if(r.initialValuei)throw new Error("Input error: slider initialValue must be between min and max");return{...e,direction:r.direction??"horizontal",thumbSrc:r.thumbSrc??"",barSrc:r.barSrc??"",...r.inactiveBarSrc!==void 0&&{inactiveBarSrc:r.inactiveBarSrc??""},alpha:r.alpha??1,min:t,max:i,step:r.step??1,initialValue:r.initialValue,...r.hover&&{hover:r.hover},...r.change&&{change:r.change}}};var rL=et({type:"slider",add:jM,update:YM,delete:qM,parse:KM});var Pn=Symbol("routeGraphicsInputRuntime"),Yd={top:10,right:12,bottom:10,left:12},En={fill:"#FFFFFF",fillAlpha:1,strokeColor:"#2E2E2E",strokeWidth:1,strokeAlpha:1},qd={strokeColor:"#4A89FF",strokeWidth:2,strokeAlpha:1},ZM={fill:"#4A89FF",alpha:.3},Hy={fill:"#111111",width:2},iL=(r={})=>{let e=r.fontSize??Ge.fontSize,t=r.lineHeight??Ge.lineHeight;return typeof t!="number"?Math.round(e*Ge.lineHeight):t>8?Math.round(t):Math.round(e*t)},Jd=(r={},e={})=>({...Ge,...r,align:r.align??"left",lineHeight:iL(r),wordWrap:!1,breakWords:!1,wordWrapWidth:e.wordWrapWidth??0,whiteSpace:"pre"}),Vy=r=>typeof r=="number"?{top:r,right:r,bottom:r,left:r}:Array.isArray(r)?{top:r[0]??0,right:r[1]??r[0]??0,bottom:r[2]??r[0]??0,left:r[3]??r[1]??r[0]??0}:{top:r?.top??Yd.top,right:r?.right??Yd.right,bottom:r?.bottom??Yd.bottom,left:r?.left??Yd.left},An=r=>String(r??"").replace(/\r\n/g,` `).replace(/\r/g,` `),sL=(r,e,t)=>{let i=Math.max(0,r-e);return t==="center"?i/2:t==="right"?i:0},eR=r=>new Oe(ir(r)),Zt=(r,e)=>De.measureText(r,eR(e)).width,ts=(r,e,t)=>Math.max(e,Math.min(t,r)),QM=({text:r,style:e,targetX:t})=>{let i=Number.isFinite(t)?t:0;if(i<=0||r.length===0)return 0;let s=Zt(r,e);if(i>=s)return r.length;for(let o=1;o<=r.length;o+=1){let n=Zt(r.slice(0,o-1),e),a=Zt(r.slice(0,o),e),l=n+(a-n)/2;if(i{let t=Math.max(r.x,e.x),i=Math.max(r.y,e.y),s=Math.min(r.x+r.width,e.x+e.width),o=Math.min(r.y+r.height,e.y+e.height),n=s-t,a=o-i;return n<=0||a<=0?null:{x:t,y:i,width:n,height:a}},oL=r=>{let e=r?.mask;if(!e?.getBounds)return null;let t=e.getBounds();return!t||t.width<=0||t.height<=0?null:{x:t.x,y:t.y,width:t.width,height:t.height}},nL=({app:r,container:e,fallbackElement:t})=>{if(!e||e.destroyed)return null;let i=e.getBounds?.(),s=i?{x:i.x,y:i.y,width:i.width,height:i.height}:{x:e.x??t.x,y:e.y??t.y,width:t.width,height:t.height};if(s.width<=0||s.height<=0)return null;let o={...s},n=e;for(;n;){if(n.visible===!1||n.renderable===!1)return{fullBounds:s,visibleBounds:null};let l=oL(n);if(l&&(o=JM(o,l),!o))return{fullBounds:s,visibleBounds:null};n=n.parent}let a=r?.renderer?{x:0,y:0,width:r.renderer.width,height:r.renderer.height}:null;return a&&(o=JM(o,a)),{fullBounds:s,visibleBounds:o}},aL=(r,e)=>e?{top:Math.max(0,e.y-r.y),right:Math.max(0,r.x+r.width-(e.x+e.width)),bottom:Math.max(0,r.y+r.height-(e.y+e.height)),left:Math.max(0,e.x-r.x)}:{top:r.height,right:0,bottom:0,left:0},lL=({displayedValue:r,textStyle:e})=>{let t=Zt(r,e);return{lines:[{text:r,width:t,startIndex:0}],lineHeight:e.lineHeight,totalHeight:e.lineHeight,maxLineWidth:t,textValue:r}},cL=({displayedValue:r,textStyle:e})=>{let t=An(r),i=t.split(` `),s=i.map((a,l)=>({text:a,width:Zt(a,e),startIndex:l===0?0:i.slice(0,l).reduce((c,u)=>c+u.length+1,0)})),o=s.reduce((a,l)=>Math.max(a,l.width),0),n=e.lineHeight;return{lines:s,lineHeight:n,totalHeight:s.length*n,maxLineWidth:o,textValue:t}},uL=({element:r,displayedValue:e,textStyle:t})=>r.multiline?cL({displayedValue:e,textStyle:t}):lL({displayedValue:e,textStyle:t}),Kd=({value:r,index:e})=>{let t=An(r),i=ts(e,0,t.length),s=0,o=0;for(let n=0;nsL(r,e,t),hL=r=>new Br({label:r,text:""}),dL=(r,e)=>{for(;r.textNodes.lengthe;){let t=r.textNodes.pop();t?.removeFromParent(),t?.destroy()}},Zd=({contentWidth:r,lineWidth:e,align:t,scrollOffsetX:i})=>e>r?-i:Wy({contentWidth:r,lineWidth:e,align:t}),tR=({contentWidth:r,lineWidth:e,align:t})=>Wy({contentWidth:r,lineWidth:e,align:t}),Qd=({padding:r,contentWidth:e,lineWidth:t,align:i,scrollOffsetX:s})=>r.left+tR({contentWidth:e,lineWidth:t,align:i})-s,rR=r=>{let e=new Ue;e.label=`${r.id}-background`;let t=new Ue;t.label=`${r.id}-selection`;let i=new te;i.label=`${r.id}-text`;let s=new Br({label:`${r.id}-placeholder`,text:r.placeholder}),o=new Ue;o.label=`${r.id}-caret`;let n=new Ue;return n.label=`${r.id}-clip`,i.mask=n,s.mask=n,t.mask=n,o.mask=n,{background:e,selection:t,text:i,placeholder:s,caret:o,clip:n}},iR=({app:r,container:e,display:t,element:i})=>({app:r,container:e,...t,value:An(i.value??""),selectionStart:An(i.value??"").length,selectionEnd:An(i.value??"").length,focused:!1,nativeFocused:!1,composing:!1,blinkVisible:!0,blinkTick:0,scrollOffsetX:0,scrollOffsetY:0,selectionAnchor:null,draggingSelection:!1,textNodes:[],layoutState:null,lastExternalValue:An(i.value??""),tickerListener:null,element:i}),ef=(r,e,t)=>{let i=nL({app:r,container:e,fallbackElement:t});if(!i)return null;let{fullBounds:s,visibleBounds:o}=i,n=aL(s,o);return{x:s.x,y:s.y,width:s.width,height:s.height,visible:!!o&&e.visible!==!1&&e.renderable!==!1,clipInsets:n}},tt=(r,e)=>{let t=Vy(e.padding),i=Math.max(0,e.width-t.left-t.right),s=Math.max(0,e.height-t.top-t.bottom),o=Jd(e.textStyle,{wordWrapWidth:i}),n=Jd({...e.textStyle,fill:"#7A7A7A"},{wordWrapWidth:i}),a=String(r.value??""),l=uL({element:e,displayedValue:a,textStyle:o}),c=o.align??"left",u=ts(Math.min(r.selectionStart,r.selectionEnd),0,a.length),h=ts(Math.max(r.selectionStart,r.selectionEnd),0,a.length),d=ts(r.selectionEnd??a.length,0,a.length);if(r.layoutState={padding:t,contentWidth:i,contentHeight:s,textStyle:o,placeholderStyle:n,displayedValue:a,layout:l,align:c},dL(r,l.lines.length),r.textNodes.forEach((p,m)=>{let g=l.lines[m]??{text:"",width:0};Qr(p,o),p.text=g.text}),Qr(r.placeholder,n),r.placeholder.text=e.placeholder??"",e.multiline){let p=Kd({value:a,index:d}),m=l.lines[p.line]??l.lines.at(-1),g=m?.width??0,_=Zt((m?.text??"").slice(0,p.column),o),v=l.totalHeight,x=p.line*l.lineHeight,T=x+l.lineHeight;if(g<=i)r.scrollOffsetX=0;else if(r.focused){let w=Math.max(0,g-i);_-r.scrollOffsetX>i-8?r.scrollOffsetX=_-(i-8):_-r.scrollOffsetX<8&&(r.scrollOffsetX=_-8),r.scrollOffsetX=ts(r.scrollOffsetX,0,w)}else r.scrollOffsetX=0;if(v<=s)r.scrollOffsetY=0;else if(r.focused){let b=Math.max(0,v-s);T-r.scrollOffsetY>s?r.scrollOffsetY=T-s:x-r.scrollOffsetY<0&&(r.scrollOffsetY=x),r.scrollOffsetY=ts(r.scrollOffsetY,0,b)}else r.scrollOffsetY=0}else{let p=l.lines[0],m=Zt(p.text.slice(0,d),o);if(p.width<=i)r.scrollOffsetX=0;else if(r.focused){let _=Math.max(0,p.width-i);m-r.scrollOffsetX>i-8?r.scrollOffsetX=m-(i-8):m-r.scrollOffsetX<8&&(r.scrollOffsetX=m-8),r.scrollOffsetX=ts(r.scrollOffsetX,0,_)}else r.scrollOffsetX=0;r.scrollOffsetY=0}if(e.multiline)r.text.x=t.left-r.scrollOffsetX,r.text.y=t.top-r.scrollOffsetY,r.textNodes.forEach((p,m)=>{let g=l.lines[m]??{width:0};p.x=tR({contentWidth:i,lineWidth:g.width,align:c}),p.y=m*l.lineHeight});else{let p=l.lines[0],m=r.textNodes[0],g=Zd({contentWidth:i,lineWidth:p.width,align:c,scrollOffsetX:r.scrollOffsetX});m.x=0,m.y=0,r.text.x=t.left+g,r.text.y=t.top+Math.max(0,(s-m.height)/2)}let f=De.measureText(r.placeholder.text,eR(n));if(r.placeholder.x=t.left,r.placeholder.y=e.multiline?t.top:t.top+Math.max(0,(s-r.placeholder.height)/2),f.width<=i&&(r.placeholder.x+=Wy({contentWidth:i,lineWidth:f.width,align:c})),r.placeholder.visible=r.value.length===0&&r.composing!==!0,r.background.clear(),r.background.rect(0,0,e.width,e.height),r.background.fill({color:En.fill,alpha:En.fillAlpha}),En.strokeWidth>0&&r.background.stroke({color:En.strokeColor,alpha:En.strokeAlpha,width:En.strokeWidth}),r.focused&&qd.strokeWidth>0&&e.disabled!==!0&&r.background.stroke({color:qd.strokeColor,alpha:qd.strokeAlpha,width:qd.strokeWidth}),r.clip.clear(),r.clip.rect(t.left,t.top,i,Math.max(0,s)),r.clip.fill({color:16777215,alpha:1}),r.selection.clear(),r.focused&&u!==h&&e.disabled!==!0){if(e.multiline){let p=Kd({value:a,index:u}),m=Kd({value:a,index:h});for(let g=p.line;g<=m.line;g+=1){let _=l.lines[g];if(!_)continue;let v=g===p.line?p.column:0,x=g===m.line?m.column:_.text.length,T=Qd({padding:t,contentWidth:i,lineWidth:_.width,align:c,scrollOffsetX:r.scrollOffsetX})+Zt(_.text.slice(0,v),o),b=Qd({padding:t,contentWidth:i,lineWidth:_.width,align:c,scrollOffsetX:r.scrollOffsetX})+Zt(_.text.slice(0,x),o),w=t.top+g*l.lineHeight-r.scrollOffsetY;r.selection.rect(T,w,Math.max(b-T,1),l.lineHeight)}}else{let p=l.lines[0],m=Zd({contentWidth:i,lineWidth:p.width,align:c,scrollOffsetX:r.scrollOffsetX}),g=t.left+m+Zt(p.text.slice(0,u),o),_=t.left+m+Zt(p.text.slice(0,h),o),v=t.top+Math.max(0,(s-r.text.height)/2);r.selection.rect(g,v,Math.max(_-g,1),Math.max(r.text.height,o.lineHeight))}r.selection.fill({color:ZM.fill,alpha:ZM.alpha})}if(r.caret.clear(),r.focused&&r.selectionStart===r.selectionEnd&&r.blinkVisible!==!1&&e.disabled!==!0){if(e.multiline){let p=Kd({value:a,index:d}),m=l.lines[p.line]??l.lines.at(-1),g=Qd({padding:t,contentWidth:i,lineWidth:m?.width??0,align:c,scrollOffsetX:r.scrollOffsetX})+Zt((m?.text??"").slice(0,p.column),o),_=t.top+p.line*l.lineHeight-r.scrollOffsetY;r.caret.rect(g,_,Hy.width,l.lineHeight)}else{let p=l.lines[0],m=Zd({contentWidth:i,lineWidth:p.width,align:c,scrollOffsetX:r.scrollOffsetX}),g=t.left+m+Zt(p.text.slice(0,d),o),_=t.top+Math.max(0,(s-r.text.height)/2);r.caret.rect(g,_,Hy.width,Math.max(r.text.height,o.lineHeight))}r.caret.fill({color:Hy.fill,alpha:1})}},zy=(r,e)=>{let t=r.layoutState;if(!t)return 0;let{padding:i,contentWidth:s,textStyle:o,displayedValue:n,layout:a,align:l}=t,c=e?.x??0,u=e?.y??0;if(!r.element.multiline){let m=a.lines[0]??{text:n,width:Zt(n,o)},g=Zd({contentWidth:s,lineWidth:m.width,align:l,scrollOffsetX:r.scrollOffsetX}),_=i.left+g;return QM({text:m.text,style:o,targetX:c-_})}let h=a.lineHeight||o.lineHeight||1,d=ts(Math.floor((u-i.top+r.scrollOffsetY)/h),0,Math.max(a.lines.length-1,0)),f=a.lines[d]??{text:"",startIndex:0},p=QM({text:f.text,style:o,targetX:c-Qd({padding:i,contentWidth:s,lineWidth:f.width??0,align:l,scrollOffsetX:r.scrollOffsetX})});return f.startIndex+p};var rs=({eventHandler:r,eventName:e,element:t,eventConfig:i,snapshot:s})=>{!r||!i||r(e,{_event:{id:t.id,value:s.value,selectionStart:s.selectionStart,selectionEnd:s.selectionEnd,composing:s.composing},...i.payload??{}})},fL=({app:r,container:e,element:t,runtime:i,eventHandler:s})=>({onValueChange:o=>{i.value=o.value,i.selectionStart=o.selectionStart,i.selectionEnd=o.selectionEnd,i.lastExternalValue=o.value,tt(i,t),rs({eventHandler:s,eventName:"change",element:t,eventConfig:t.change,snapshot:o})},onFocus:o=>{let n=i.nativeFocused===!0;i.nativeFocused=!0,i.focused=!0,i.selectionStart=o.selectionStart,i.selectionEnd=o.selectionEnd,i.selectionAnchor=o.selectionStart===o.selectionEnd?o.selectionEnd:i.selectionAnchor,i.blinkVisible=!0,i.blinkTick=0,tt(i,t),!n&&rs({eventHandler:s,eventName:"focus",element:t,eventConfig:t.focusEvent,snapshot:o})},onBlur:o=>{i.nativeFocused=!1,i.focused=!1,i.selectionStart=o.selectionStart,i.selectionEnd=o.selectionEnd,i.blinkVisible=!1,i.composing=!1,tt(i,t),rs({eventHandler:s,eventName:"blur",element:t,eventConfig:t.blurEvent,snapshot:o})},onSelectionChange:o=>{i.nativeFocused=o.focused,i.focused=o.focused,i.selectionStart=o.selectionStart,i.selectionEnd=o.selectionEnd,o.selectionStart===o.selectionEnd&&(i.selectionAnchor=o.selectionEnd),tt(i,t),rs({eventHandler:s,eventName:"selectionChange",element:t,eventConfig:t.selectionChange,snapshot:o})},onSubmit:o=>{rs({eventHandler:s,eventName:"submit",element:t,eventConfig:t.submit,snapshot:o})},onCompositionStart:o=>{i.composing=!0,tt(i,t),rs({eventHandler:s,eventName:"compositionStart",element:t,eventConfig:t.compositionStart,snapshot:o})},onCompositionUpdate:o=>{i.composing=!0,i.selectionStart=o.selectionStart,i.selectionEnd=o.selectionEnd,tt(i,t),rs({eventHandler:s,eventName:"compositionUpdate",element:t,eventConfig:t.compositionUpdate,snapshot:o})},onCompositionEnd:o=>{i.composing=!1,i.value=o.value,i.selectionStart=o.selectionStart,i.selectionEnd=o.selectionEnd,tt(i,t),rs({eventHandler:s,eventName:"compositionEnd",element:t,eventConfig:t.compositionEnd,snapshot:o})}}),sR=({app:r,parent:e,element:t,eventHandler:i,zIndex:s})=>{if(!r.inputDomBridge?.mount||!r.inputDomBridge?.focus||!r.inputDomBridge?.setSelection)throw new Error("Input plugin requires app.inputDomBridge to be initialized");let o=new te({label:t.id});o.zIndex=s,o.sortableChildren=!0,o.eventMode="static",o.cursor=t.disabled?"default":"text",o.x=Math.round(t.x),o.y=Math.round(t.y),o.alpha=t.alpha;let n=rR(t),a=iR({app:r,container:o,display:n,element:t});o.addChild(a.background,a.selection,a.text,a.placeholder,a.caret,a.clip),a.tickerListener=f=>{if(!a.focused){if(a.blinkVisible===!1)return;a.blinkVisible=!1,tt(a,a.element);return}a.blinkTick+=f.deltaMS??f.deltaTime??16,a.blinkTick>=530&&(a.blinkTick=0,a.blinkVisible=!a.blinkVisible,tt(a,a.element))},r.ticker?.add?.(a.tickerListener);let l=({start:f,end:p,shouldFocus:m=!1})=>{if(m){r.inputDomBridge.focus(t.id,{selectionStart:f,selectionEnd:p});return}r.inputDomBridge.setSelection(t.id,f,p)},c=({start:f,end:p,shouldFocus:m=!1,anchor:g=a.selectionAnchor})=>{a.focused=!0,a.selectionStart=f,a.selectionEnd=p,a.selectionAnchor=g,a.blinkVisible=!0,a.blinkTick=0,tt(a,a.element),l({start:f,end:p,shouldFocus:m})},u=f=>{if(a.element.disabled===!0)return;let p=o.toLocal(f.global),m=zy(a,p),g=!!f.shiftKey&&a.focused,_=g?a.selectionAnchor??(a.selectionStart!==a.selectionEnd?a.selectionStart:a.selectionEnd):m,v=g?Math.min(_,m):m,x=g?Math.max(_,m):m;a.draggingSelection=!0,c({start:v,end:x,shouldFocus:!0,anchor:_})},h=f=>{if(!a.draggingSelection||a.element.disabled===!0)return;let p=o.toLocal(f.global),m=zy(a,p),g=a.selectionAnchor??m,_=Math.min(g,m),v=Math.max(g,m);c({start:_,end:v,anchor:g})},d=()=>{a.draggingSelection=!1};o.on("pointerdown",u),o.on("globalpointermove",h),o.on("pointerup",d),o.on("pointerupoutside",d),o.on("pointerup",()=>{a.element.disabled!==!0&&r.inputDomBridge.focus(t.id,{selectionStart:a.selectionStart,selectionEnd:a.selectionEnd})}),o[Pn]=a,tt(a,t),r.inputDomBridge.mount(t.id,{...t,value:a.value,callbacks:fL({app:r,container:o,element:t,runtime:a,eventHandler:i}),getGeometry:()=>ef(r,o,t)}),e.addChild(o)};var is=({eventHandler:r,eventName:e,element:t,eventConfig:i,snapshot:s})=>{!r||!i||r(e,{_event:{id:t.id,value:s.value,selectionStart:s.selectionStart,selectionEnd:s.selectionEnd,composing:s.composing},...i.payload??{}})},pL=({element:r,runtime:e,eventHandler:t})=>({onValueChange:i=>{e.value=i.value,e.selectionStart=i.selectionStart,e.selectionEnd=i.selectionEnd,e.lastExternalValue=i.value,tt(e,r),is({eventHandler:t,eventName:"change",element:r,eventConfig:r.change,snapshot:i})},onFocus:i=>{let s=e.nativeFocused===!0;e.nativeFocused=!0,e.focused=!0,e.selectionStart=i.selectionStart,e.selectionEnd=i.selectionEnd,e.selectionAnchor=i.selectionStart===i.selectionEnd?i.selectionEnd:e.selectionAnchor,e.blinkVisible=!0,e.blinkTick=0,tt(e,r),!s&&is({eventHandler:t,eventName:"focus",element:r,eventConfig:r.focusEvent,snapshot:i})},onBlur:i=>{e.nativeFocused=!1,e.focused=!1,e.selectionStart=i.selectionStart,e.selectionEnd=i.selectionEnd,e.blinkVisible=!1,e.composing=!1,tt(e,r),is({eventHandler:t,eventName:"blur",element:r,eventConfig:r.blurEvent,snapshot:i})},onSelectionChange:i=>{e.nativeFocused=i.focused,e.focused=i.focused,e.selectionStart=i.selectionStart,e.selectionEnd=i.selectionEnd,i.selectionStart===i.selectionEnd&&(e.selectionAnchor=i.selectionEnd),tt(e,r),is({eventHandler:t,eventName:"selectionChange",element:r,eventConfig:r.selectionChange,snapshot:i})},onSubmit:i=>{is({eventHandler:t,eventName:"submit",element:r,eventConfig:r.submit,snapshot:i})},onCompositionStart:i=>{e.composing=!0,tt(e,r),is({eventHandler:t,eventName:"compositionStart",element:r,eventConfig:r.compositionStart,snapshot:i})},onCompositionUpdate:i=>{e.composing=!0,e.selectionStart=i.selectionStart,e.selectionEnd=i.selectionEnd,tt(e,r),is({eventHandler:t,eventName:"compositionUpdate",element:r,eventConfig:r.compositionUpdate,snapshot:i})},onCompositionEnd:i=>{e.composing=!1,e.value=i.value,e.selectionStart=i.selectionStart,e.selectionEnd=i.selectionEnd,tt(e,r),is({eventHandler:t,eventName:"compositionEnd",element:r,eventConfig:r.compositionEnd,snapshot:i})}}),oR=({app:r,parent:e,prevElement:t,nextElement:i,eventHandler:s,zIndex:o})=>{let n=e.children.find(u=>u.label===t.id);if(!n)return;if(!r.inputDomBridge?.update)throw new Error("Input plugin requires app.inputDomBridge to be initialized");n.zIndex=o;let a=n[Pn];if(!a)return;let l={...i},c=a.focused!==!0||i.value!==t.value;c&&a.composing!==!0?(a.value=i.value,a.lastExternalValue=i.value):l.value=a.value,a.element=l,n.label=i.id,n.cursor=i.disabled?"default":"text",n.x=Math.round(i.x),n.y=Math.round(i.y),n.alpha=i.alpha,i.disabled===!0&&(a.draggingSelection=!1),(!pe(t,i)||c)&&tt(a,l),r.inputDomBridge.update(i.id,{...l,value:a.value,callbacks:pL({element:l,runtime:a,eventHandler:s}),getGeometry:()=>ef(r,n,l)})};var nR=({app:r,parent:e,element:t})=>{let i=e.getChildByLabel(t.id);if(!i)return;if(!r.inputDomBridge?.unmount)throw new Error("Input plugin requires app.inputDomBridge to be initialized");let s=i[Pn];s?.tickerListener&&r.ticker?.remove?.(s.tickerListener),r.inputDomBridge.unmount(t.id),i.destroy({children:!0})};var aR=({state:r})=>{let e=yt(r),t=String(r.value??""),i=String(r.placeholder??"");return delete e.originX,delete e.originY,{...e,value:t,placeholder:i,multiline:r.multiline===!0,disabled:r.disabled===!0,...typeof r.maxLength=="number"&&{maxLength:Math.round(r.maxLength)},textStyle:Jd(r.textStyle),padding:Vy(r.padding),...r.change&&{change:r.change},...r.submit&&{submit:r.submit},...r.focusEvent&&{focusEvent:r.focusEvent},...r.blurEvent&&{blurEvent:r.blurEvent},...r.selectionChange&&{selectionChange:r.selectionChange},...r.compositionStart&&{compositionStart:r.compositionStart},...r.compositionUpdate&&{compositionUpdate:r.compositionUpdate},...r.compositionEnd&&{compositionEnd:r.compositionEnd}}};var mL=et({type:"input",add:sR,update:oR,delete:nR,parse:aR});var gL=24,xL=24,Ds=(r,e,t)=>Math.min(t,Math.max(e,r)),uR=r=>Ds(r,0,1),Cn=r=>{r?.stopPropagation?.()},yL=r=>r?k.from(r):k.EMPTY,tf=({label:r})=>{let e=new Te(k.EMPTY);return e.label=r,e.eventMode="static",e.cursor="pointer",e},_L=({config:r,state:e})=>r?e?.pressed&&r.pressSrc?r.pressSrc:e?.hovered&&r.hoverSrc?r.hoverSrc:r.src??"":"",rf=({sprite:r,config:e,state:t,width:i,height:s})=>{r&&(r.texture=yL(_L({config:e,state:t})),r.width=Math.max(i,0),r.height=Math.max(s,0),r.visible=r.width>0&&r.height>0,r.eventMode=r.visible?"static":"none")},bL=r=>({root:`${r}-scrollbar-vertical`,track:`${r}-scrollbar-vertical-track`,thumb:`${r}-scrollbar-vertical-thumb`,startButton:`${r}-scrollbar-vertical-start-button`,endButton:`${r}-scrollbar-vertical-end-button`}),lR=(r,e)=>Math.abs(r-e)<.5,cR=({hasOverflow:r,minScroll:e,previousOffset:t,wasAtEnd:i,anchorToEnd:s})=>r?s&&(t===void 0||i)?e:typeof t=="number"?Ds(t,e,0):0:0,vL=({controller:r})=>{let e=bL(r.container.label),t=r.element.scrollbar?.vertical;if(!t)return null;let i=new te({label:e.root});i.eventMode="static",i.cursor="pointer";let s=tf({label:e.track}),o=tf({label:e.thumb}),n={config:t,root:i,track:s,thumb:o,startButton:null,endButton:null,states:{track:{hovered:!1,pressed:!1},thumb:{hovered:!1,pressed:!1,dragging:!1},startButton:{hovered:!1,pressed:!1},endButton:{hovered:!1,pressed:!1}},dragOffsetY:0};i.addChild(s),i.addChild(o),t.startButton&&(n.startButton=tf({label:e.startButton}),i.addChild(n.startButton)),t.endButton&&(n.endButton=tf({label:e.endButton}),i.addChild(n.endButton));let a=()=>{hR({controller:r})};s.on("pointerover",()=>{n.states.track.hovered=!0,a()}),s.on("pointerout",()=>{n.states.track.hovered=!1,a()}),s.on("pointerdown",h=>{Cn(h),n.states.track.pressed=!0,a();let d=i.toLocal(h.global),{thumb:f}=n,p=r.viewportHeight;d.yf.y+f.height&&r.setScrollOffsets({y:r.scrollYOffset-p,source:"track"})});let l=h=>{Cn(h),n.states.track.pressed=!1,a()};s.on("pointerup",l),s.on("pointerupoutside",l),o.on("pointerover",()=>{n.states.thumb.hovered=!0,a()}),o.on("pointerout",()=>{n.states.thumb.hovered=!1,n.states.thumb.dragging||a()}),o.on("pointerdown",h=>{Cn(h);let d=i.toLocal(h.global);n.states.thumb.pressed=!0,n.states.thumb.dragging=!0,n.dragOffsetY=d.y-n.thumb.y,a()});let c=h=>{if(Cn(h),!n.states.thumb.dragging){n.states.thumb.pressed=!1,a();return}n.states.thumb.dragging=!1,n.states.thumb.pressed=!1,a()};i.on("globalpointermove",h=>{if(!n.states.thumb.dragging)return;let d=i.toLocal(h.global),f=n.track.y,p=Math.max(n.track.height-n.thumb.height,0);if(p<=0||r.minScrollY===0){r.setScrollOffsets({y:0,source:"thumb"});return}let m=Ds(d.y-n.dragOffsetY,f,f+p),g=uR((m-f)/p);r.setScrollOffsets({y:r.minScrollY*g,source:"thumb"})}),o.on("pointerup",c),o.on("pointerupoutside",c),i.on("pointerup",c),i.on("pointerupoutside",c);let u=({sprite:h,config:d,state:f,deltaDirection:p})=>{if(!h||!d)return;h.on("pointerover",()=>{f.hovered=!0,a()}),h.on("pointerout",()=>{f.hovered=!1,a()}),h.on("pointerdown",g=>{Cn(g),f.pressed=!0,a(),r.setScrollOffsets({y:r.scrollYOffset+p*Math.max(d.step??gL,0),source:"button"})});let m=g=>{Cn(g),f.pressed=!1,a()};h.on("pointerup",m),h.on("pointerupoutside",m)};return u({sprite:n.startButton,config:t.startButton,state:n.states.startButton,deltaDirection:1}),u({sprite:n.endButton,config:t.endButton,state:n.states.endButton,deltaDirection:-1}),r.container.addChild(i),n},hR=({controller:r})=>{let e=r.verticalScrollbar;if(!e)return;let{config:t,root:i,track:s,thumb:o,startButton:n,endButton:a,states:l}=e,c=Math.max(t.thickness??0,0),u=n?Math.max(t.startButton?.size??c,0):0,h=a?Math.max(t.endButton?.size??c,0):0,d=Math.max(r.viewportHeight-u-h,0),f=Math.min(xL,d),p=t.thumb?.length,m=typeof p=="number"?p:r.totalHeight>0?Math.round(r.viewportHeight/r.totalHeight*d):d,g=d>0?typeof p=="number"?Ds(m,0,d):Ds(m,f,d):0,_=Math.max(d-g,0),v=r.minScrollY===0?0:uR(r.scrollYOffset/r.minScrollY);i.visible=r.hasVerticalOverflow&&r.element.scroll&&c>0&&r.viewportHeight>0,i.x=Math.max(r.viewportWidth-c,0),i.y=0,s.x=0,s.y=u,rf({sprite:s,config:t.track,state:l.track,width:c,height:d}),o.x=0,o.y=u+_*v,rf({sprite:o,config:t.thumb,state:l.thumb,width:c,height:g}),n&&(n.x=0,n.y=0,rf({sprite:n,config:t.startButton,state:l.startButton,width:c,height:u})),a&&(a.x=0,a.y=r.viewportHeight-h,rf({sprite:a,config:t.endButton,state:l.endButton,width:c,height:h}))},dR=({container:r})=>{let e=r.__routeGraphicsScrollController;return e?{scrollXOffset:e.scrollXOffset,scrollYOffset:e.scrollYOffset,wasAtHorizontalEnd:e.hasHorizontalOverflow&&lR(e.scrollXOffset,e.minScrollX),wasAtVerticalEnd:e.hasVerticalOverflow&&lR(e.scrollYOffset,e.minScrollY)}:null},fc=({container:r,element:e,interactive:t=!0,allowViewportWithoutScroll:i=!1,previousState:s=null})=>{let o=0,n=0;e.children.forEach(u=>{o=Math.max(u.width+u.x,o),n=Math.max(u.height+u.y,n)});let a=!!(e.height&&n>e.height),l=!!(e.width&&o>e.width);if((e.scroll||i)&&(a||l)){let u=new te({label:`${r.label}-content`});[...r.children].forEach(g=>{u.addChild(g)}),r.addChild(u);let d=new Ue({label:`${r.label}-clip`}).rect(0,0,e.width||o,e.height||n).fill({color:16711680,alpha:0});r.addChild(d),u.mask=d;let f=-(n-(e.height||n)),p=-(o-(e.width||o)),m={container:r,contentContainer:u,clip:d,element:e,totalWidth:o,totalHeight:n,viewportWidth:e.width||o,viewportHeight:e.height||n,hasHorizontalOverflow:l,hasVerticalOverflow:a,minScrollX:p,minScrollY:f,scrollXOffset:cR({hasOverflow:l,minScroll:p,previousOffset:s?.scrollXOffset,wasAtEnd:s?.wasAtHorizontalEnd,anchorToEnd:!!e.anchorToBottom}),scrollYOffset:cR({hasOverflow:a,minScroll:f,previousOffset:s?.scrollYOffset,wasAtEnd:s?.wasAtVerticalEnd,anchorToEnd:!!e.anchorToBottom}),verticalScrollbar:null,setScrollOffsets:({x:g,y:_})=>{let v=g??m.scrollXOffset,x=_??m.scrollYOffset;m.scrollXOffset=m.hasHorizontalOverflow?Ds(v,m.minScrollX,0):0,m.scrollYOffset=m.hasVerticalOverflow?Ds(x,m.minScrollY,0):0,m.contentContainer.x=m.scrollXOffset,m.contentContainer.y=m.scrollYOffset,hR({controller:m})}};r.__routeGraphicsScrollController=m,m.verticalScrollbar=vL({controller:m}),m.setScrollOffsets({x:m.scrollXOffset,y:m.scrollYOffset,source:"initial"}),t&&(r.eventMode="static",r.hitArea=new Q(0,0,e.width||o,e.height||n),r.on("wheel",g=>{if(g.preventDefault(),a&&g.deltaY!==0&&m.setScrollOffsets({y:m.scrollYOffset-g.deltaY,source:"wheel"}),l&&(g.deltaX!==0||g.shiftKey&&g.deltaY!==0)){let _=g.deltaX!==0?g.deltaX:g.deltaY;m.setScrollOffsets({x:m.scrollXOffset-_,source:"wheel"})}}))}},$y=({container:r})=>{let e=r.__routeGraphicsScrollController,t=r.children.find(o=>o.label&&o.label.endsWith("-content")),i=r.children.find(o=>o.label&&o.label.endsWith("-clip")),s=r.children.find(o=>o.label&&o.label.endsWith("-scrollbar-vertical"));t&&([...t.children].forEach(n=>{n.mask=null,r.addChild(n)}),r.removeChild(t),t.destroy({children:!1})),i&&(r.removeChild(i),i.destroy()),s&&(r.removeChild(s),s.destroy({children:!0})),r.eventMode="auto",r.hitArea=null,r.removeAllListeners("wheel"),e&&(r.__routeGraphicsScrollController=void 0)};var Xy=({container:r,element:e,enabled:t})=>{let i=Number.isFinite(e?.width)?e.width:0,s=Number.isFinite(e?.height)?e.height:0;if(t&&i>0&&s>0){r.hitArea=new Q(0,0,i,s);return}r.hitArea=null},fR=(r,e)=>{let t=e??null;for(;t;){if(t===r)return!0;t=t.parent??null}return!1},Ns=(r,e)=>{let t=e??null;for(;t;){if(t===r)return!1;if(typeof t.label=="string"&&t.label.startsWith(`${r.label}-scrollbar-`))return!0;t=t.parent??null}return!1},TL=(r,e)=>{if(!e||typeof e.x!="number"||typeof e.y!="number")return!1;let t=r.toLocal(e),i=r.hitArea;return i?.contains?i.contains(t.x,t.y):!1},sf=({app:r,container:e,element:t,eventHandler:i})=>{let s=Oy(e),o=Uy(e),n=Gy(e),a=s;Tn({root:e,isHovered:!1}),Gs({root:e,isPressed:!1}),Si({root:e,isPressed:!1}),e.removeAllListeners("pointerover"),e.removeAllListeners("pointerout"),e.removeAllListeners("pointerdown"),e.removeAllListeners("pointerup"),e.removeAllListeners("pointerupoutside"),e.removeAllListeners("rightdown"),e.removeAllListeners("rightup"),e.removeAllListeners("rightupoutside"),e.removeAllListeners("rightclick"),e.cursor="auto",t.scroll||(e.eventMode="auto",Xy({container:e,element:t,enabled:!1}));let l=t?.hover,c=t?.click,u=t?.rightClick;if(!!(l||c||u)&&(e.eventMode="static",t.scroll?e.hitArea||Xy({container:e,element:t,enabled:!0}):Xy({container:e,element:t,enabled:!0})),l){let{cursor:d,soundSrc:f,payload:p,inheritToChildren:m}=l,g=v=>{fR(e,v?.relatedTarget)||a||(a=!0,p&&i&&i("hover",{_event:{id:e.label},...p}),d&&(e.cursor=d),f&&r.audioStage.add({id:`hover-${Date.now()}`,url:f,loop:!1}),m&&Tn({root:e,isHovered:!0}))},_=v=>{fR(e,v?.relatedTarget)||TL(e,v?.global)||a&&(a=!1,e.cursor="auto",m&&Tn({root:e,isHovered:!1}))};e.on("pointerover",g),e.on("pointerout",_)}if(c){let{soundSrc:d,soundVolume:f,payload:p,inheritToChildren:m}=c,g=x=>{nt(x)&&(Ns(e,x?.target)||m&&Gs({root:e,isPressed:!0}))},_=x=>{nt(x)&&(Ns(e,x?.target)||(m&&Gs({root:e,isPressed:!1}),p&&i&&i("click",{_event:{id:e.label},...p}),d&&r.audioStage.add({id:`click-${Date.now()}`,url:d,loop:!1,volume:We(f)})))},v=x=>{nt(x)&&(Ns(e,x?.target)||m&&Gs({root:e,isPressed:!1}))};e.on("pointerdown",g),e.on("pointerup",_),e.on("pointerupoutside",v)}if(u){let{soundSrc:d,payload:f,inheritToChildren:p}=u,m=T=>{Ns(e,T?.target)||p&&Si({root:e,isPressed:!0})},g=T=>{Ns(e,T?.target)||p&&Si({root:e,isPressed:!1})},_=T=>{bM(T)&&(Ns(e,T?.target)||p&&Si({root:e,isPressed:!1}))},v=T=>{Ns(e,T?.target)||(p&&Si({root:e,isPressed:!1}),f&&i&&i("rightClick",{_event:{id:e.label},...f}),d&&r.audioStage.add({id:`rightClick-${Date.now()}`,url:d,loop:!1}))},x=()=>{p&&Si({root:e,isPressed:!1})};e.on("rightdown",m),e.on("rightup",g),e.on("pointerup",_),e.on("rightclick",v),e.on("pointerupoutside",_),e.on("rightupoutside",x)}l?.inheritToChildren&&s&&Tn({root:e,isHovered:!0}),c?.inheritToChildren&&o&&Gs({root:e,isPressed:!0}),u?.inheritToChildren&&n&&Si({root:e,isPressed:!0})},pR=({container:r})=>{Oy(r)&&Tn({root:r,isHovered:!0})},mR=({container:r})=>{Uy(r)&&Gs({root:r,isPressed:!0})},gR=({container:r})=>{Gy(r)&&Si({root:r,isPressed:!0})};var pc=r=>{let e=new Set;if(r.id&&e.add(r.id),r.children&&Array.isArray(r.children))for(let t of r.children)for(let i of pc(t))e.add(i);return e};var xR=(r,e,t=[])=>{let i=new Set,s=new Map,o=new Map,n=[],a=[],l=[];for(let c of r)i.add(c.id),s.set(c.id,c);for(let c of e)i.add(c.id),o.set(c.id,c);for(let c of i){let u=s.get(c),h=o.get(c);if(!u&&h)n.push(h);else if(u&&!h)a.push(u);else{let d=pc(h),f=t instanceof Map?Array.from(t.keys()).some(p=>d.has(p)):t.find(p=>d.has(p.targetId));(!pe(u,h)||f)&&l.push({prev:u,next:h})}}return{toAddElement:n,toDeleteElement:a,toUpdateElement:l}};var of=r=>r<.36363636363636365?7.5625*r*r:r<.7272727272727273?7.5625*(r-=.5454545454545454)*r+.75:r<.9090909090909091?7.5625*(r-=.8181818181818182)*r+.9375:7.5625*(r-=.9545454545454546)*r+.984375,SL=r=>r,wL=r=>r*r,EL=r=>1-(1-r)*(1-r),AL=r=>r<.5?2*r*r:1-Math.pow(-2*r+2,2)/2,yR=Object.freeze({linear:SL,easeInQuad:wL,easeOutQuad:EL,easeInOutQuad:AL,easeInCubic:r=>r*r*r,easeOutCubic:r=>1-Math.pow(1-r,3),easeInOutCubic:r=>r<.5?4*r*r*r:1-Math.pow(-2*r+2,3)/2,easeInQuart:r=>r*r*r*r,easeOutQuart:r=>1-Math.pow(1-r,4),easeInOutQuart:r=>r<.5?8*r*r*r*r:1-Math.pow(-2*r+2,4)/2,easeInQuint:r=>r*r*r*r*r,easeOutQuint:r=>1-Math.pow(1-r,5),easeInOutQuint:r=>r<.5?16*r*r*r*r*r:1-Math.pow(-2*r+2,5)/2,easeInSine:r=>1-Math.cos(r*Math.PI/2),easeOutSine:r=>Math.sin(r*Math.PI/2),easeInOutSine:r=>-(Math.cos(Math.PI*r)-1)/2,easeInExpo:r=>r===0?0:Math.pow(2,10*r-10),easeOutExpo:r=>r===1?1:1-Math.pow(2,-10*r),easeInOutExpo:r=>r===0?0:r===1?1:r<.5?Math.pow(2,20*r-10)/2:(2-Math.pow(2,-20*r+10))/2,easeInCirc:r=>1-Math.sqrt(1-Math.pow(r,2)),easeOutCirc:r=>Math.sqrt(1-Math.pow(r-1,2)),easeInOutCirc:r=>r<.5?(1-Math.sqrt(1-Math.pow(2*r,2)))/2:(Math.sqrt(1-Math.pow(-2*r+2,2))+1)/2,easeInBack:r=>2.70158*r*r*r-1.70158*r*r,easeOutBack:r=>1+2.70158*Math.pow(r-1,3)+1.70158*Math.pow(r-1,2),easeInOutBack:r=>{let t=2.5949095;return r<.5?Math.pow(2*r,2)*((t+1)*2*r-t)/2:(Math.pow(2*r-2,2)*((t+1)*(r*2-2)+t)+2)/2},easeInBounce:r=>1-of(1-r),easeOutBounce:of,easeInOutBounce:r=>r<.5?(1-of(1-2*r))/2:(1+of(2*r-1))/2,easeInElastic:r=>{let e=2*Math.PI/3;return r===0?0:r===1?1:-Math.pow(2,10*r-10)*Math.sin((r*10-10.75)*e)},easeOutElastic:r=>{let e=2*Math.PI/3;return r===0?0:r===1?1:Math.pow(2,-10*r)*Math.sin((r*10-.75)*e)+1},easeInOutElastic:r=>{let e=2*Math.PI/4.5;return r===0?0:r===1?1:r<.5?-(Math.pow(2,20*r-10)*Math.sin((20*r-11.125)*e))/2:Math.pow(2,-20*r+10)*Math.sin((20*r-11.125)*e)/2+1}}),nf=Object.freeze(Object.keys(yR)),PL=(r="linear")=>{let e=yR[r];if(!e)throw new Error(`Unsupported easing: ${r}`);return e},Mn=r=>{let e=[],t=0,i;return r.forEach(({value:s,duration:o,easing:n="linear",relative:a},l)=>{if(l===0){i=s,e.push({time:t,value:s,easing:"linear"});return}o!==void 0&&(t+=o,i=a?i+s:s,e.push({time:t,value:i,easing:n}))}),e},mc=r=>{let e=0;for(let{timeline:t}of r){let i=t[t.length-1];i&&i.time>e&&(e=i.time)}return e},gc=(r,e)=>{if(r.length===0)return 0;if(e<=r[0].time)return r[0].value;if(e>=r[r.length-1].time)return r[r.length-1].value;for(let t=0;t=i&&e<=n){let l=(e-i)/(n-i);return s+(a-s)*PL(o)(l)}}return r[r.length-1].value};var CL={translateX:0,translateY:0,alpha:1,scaleX:1,scaleY:1,rotation:0},qy=r=>Math.min(1,Math.max(0,r));var SR=r=>r.getLocalBounds().rectangle.clone(),wR=r=>(r.width=Math.max(1,Math.ceil(r.width)),r.height=Math.max(1,Math.ceil(r.height)),r),_R=(r,e)=>{let t=wR(SR(e)),i=r.renderer.generateTexture({target:e,frame:t}),s=new Te(i);s.x=t.x,s.y=t.y;let o=new te;return o.x=e.x??0,o.y=e.y??0,o.scale.set(e.scale?.x??1,e.scale?.y??1),o.rotation=e.rotation??0,o.alpha=e.alpha??1,o.addChild(s),{wrapper:o,texture:i}},ML=(r={})=>Object.entries(r).map(([e,t])=>({property:e,timeline:Mn([{value:t.initialValue??CL[e]??0},...t.keyframes])})),cf=(r,e,t)=>{if(!r||!e)return{duration:0,apply:()=>{}};let i=ML(e),s={x:r.x,y:r.y,alpha:r.alpha,scaleX:r.scale.x,scaleY:r.scale.y,rotation:r.rotation};return{duration:mc(i),apply:o=>{r.x=s.x,r.y=s.y,r.alpha=s.alpha,r.scale.x=s.scaleX,r.scale.y=s.scaleY,r.rotation=s.rotation;for(let{property:n,timeline:a}of i){let l=gc(a,o);switch(n){case"translateX":r.x=s.x+l*t.renderer.width;break;case"translateY":r.y=s.y+l*t.renderer.height;break;case"alpha":r.alpha=s.alpha*l;break;case"scaleX":r.scale.x=s.scaleX*l;break;case"scaleY":r.scale.y=s.scaleY*l;break;case"rotation":r.rotation=s.rotation+l;break}}}}},RL=r=>Mn([{value:r?.progress?.initialValue??0},...r?.progress?.keyframes??[]]),ER=` +`){s+=1,o=0;continue}o+=1}return{line:s,column:o}},Wy=({contentWidth:r,lineWidth:e,align:t})=>sL(r,e,t),hL=r=>new Br({label:r,text:""}),dL=(r,e)=>{for(;r.textNodes.lengthe;){let t=r.textNodes.pop();t?.removeFromParent(),t?.destroy()}},Zd=({contentWidth:r,lineWidth:e,align:t,scrollOffsetX:i})=>e>r?-i:Wy({contentWidth:r,lineWidth:e,align:t}),tR=({contentWidth:r,lineWidth:e,align:t})=>Wy({contentWidth:r,lineWidth:e,align:t}),Qd=({padding:r,contentWidth:e,lineWidth:t,align:i,scrollOffsetX:s})=>r.left+tR({contentWidth:e,lineWidth:t,align:i})-s,rR=r=>{let e=new Ue;e.label=`${r.id}-background`;let t=new Ue;t.label=`${r.id}-selection`;let i=new te;i.label=`${r.id}-text`;let s=new Br({label:`${r.id}-placeholder`,text:r.placeholder}),o=new Ue;o.label=`${r.id}-caret`;let n=new Ue;return n.label=`${r.id}-clip`,i.mask=n,s.mask=n,t.mask=n,o.mask=n,{background:e,selection:t,text:i,placeholder:s,caret:o,clip:n}},iR=({app:r,container:e,display:t,element:i})=>({app:r,container:e,...t,value:An(i.value??""),selectionStart:An(i.value??"").length,selectionEnd:An(i.value??"").length,focused:!1,nativeFocused:!1,composing:!1,blinkVisible:!0,blinkTick:0,scrollOffsetX:0,scrollOffsetY:0,selectionAnchor:null,draggingSelection:!1,textNodes:[],layoutState:null,lastExternalValue:An(i.value??""),tickerListener:null,element:i}),ef=(r,e,t)=>{let i=nL({app:r,container:e,fallbackElement:t});if(!i)return null;let{fullBounds:s,visibleBounds:o}=i,n=aL(s,o);return{x:s.x,y:s.y,width:s.width,height:s.height,visible:!!o&&e.visible!==!1&&e.renderable!==!1,clipInsets:n}},tt=(r,e)=>{let t=Vy(e.padding),i=Math.max(0,e.width-t.left-t.right),s=Math.max(0,e.height-t.top-t.bottom),o=Jd(e.textStyle,{wordWrapWidth:i}),n=Jd({...e.textStyle,fill:"#7A7A7A"},{wordWrapWidth:i}),a=String(r.value??""),l=uL({element:e,displayedValue:a,textStyle:o}),c=o.align??"left",u=ts(Math.min(r.selectionStart,r.selectionEnd),0,a.length),h=ts(Math.max(r.selectionStart,r.selectionEnd),0,a.length),d=ts(r.selectionEnd??a.length,0,a.length);if(r.layoutState={padding:t,contentWidth:i,contentHeight:s,textStyle:o,placeholderStyle:n,displayedValue:a,layout:l,align:c},dL(r,l.lines.length),r.textNodes.forEach((p,m)=>{let g=l.lines[m]??{text:"",width:0};Qr(p,o),p.text=g.text}),Qr(r.placeholder,n),r.placeholder.text=e.placeholder??"",e.multiline){let p=Kd({value:a,index:d}),m=l.lines[p.line]??l.lines.at(-1),g=m?.width??0,_=Zt((m?.text??"").slice(0,p.column),o),v=l.totalHeight,x=p.line*l.lineHeight,T=x+l.lineHeight;if(g<=i)r.scrollOffsetX=0;else if(r.focused){let E=Math.max(0,g-i);_-r.scrollOffsetX>i-8?r.scrollOffsetX=_-(i-8):_-r.scrollOffsetX<8&&(r.scrollOffsetX=_-8),r.scrollOffsetX=ts(r.scrollOffsetX,0,E)}else r.scrollOffsetX=0;if(v<=s)r.scrollOffsetY=0;else if(r.focused){let b=Math.max(0,v-s);T-r.scrollOffsetY>s?r.scrollOffsetY=T-s:x-r.scrollOffsetY<0&&(r.scrollOffsetY=x),r.scrollOffsetY=ts(r.scrollOffsetY,0,b)}else r.scrollOffsetY=0}else{let p=l.lines[0],m=Zt(p.text.slice(0,d),o);if(p.width<=i)r.scrollOffsetX=0;else if(r.focused){let _=Math.max(0,p.width-i);m-r.scrollOffsetX>i-8?r.scrollOffsetX=m-(i-8):m-r.scrollOffsetX<8&&(r.scrollOffsetX=m-8),r.scrollOffsetX=ts(r.scrollOffsetX,0,_)}else r.scrollOffsetX=0;r.scrollOffsetY=0}if(e.multiline)r.text.x=t.left-r.scrollOffsetX,r.text.y=t.top-r.scrollOffsetY,r.textNodes.forEach((p,m)=>{let g=l.lines[m]??{width:0};p.x=tR({contentWidth:i,lineWidth:g.width,align:c}),p.y=m*l.lineHeight});else{let p=l.lines[0],m=r.textNodes[0],g=Zd({contentWidth:i,lineWidth:p.width,align:c,scrollOffsetX:r.scrollOffsetX});m.x=0,m.y=0,r.text.x=t.left+g,r.text.y=t.top+Math.max(0,(s-m.height)/2)}let f=De.measureText(r.placeholder.text,eR(n));if(r.placeholder.x=t.left,r.placeholder.y=e.multiline?t.top:t.top+Math.max(0,(s-r.placeholder.height)/2),f.width<=i&&(r.placeholder.x+=Wy({contentWidth:i,lineWidth:f.width,align:c})),r.placeholder.visible=r.value.length===0&&r.composing!==!0,r.background.clear(),r.background.rect(0,0,e.width,e.height),r.background.fill({color:En.fill,alpha:En.fillAlpha}),En.strokeWidth>0&&r.background.stroke({color:En.strokeColor,alpha:En.strokeAlpha,width:En.strokeWidth}),r.focused&&qd.strokeWidth>0&&e.disabled!==!0&&r.background.stroke({color:qd.strokeColor,alpha:qd.strokeAlpha,width:qd.strokeWidth}),r.clip.clear(),r.clip.rect(t.left,t.top,i,Math.max(0,s)),r.clip.fill({color:16777215,alpha:1}),r.selection.clear(),r.focused&&u!==h&&e.disabled!==!0){if(e.multiline){let p=Kd({value:a,index:u}),m=Kd({value:a,index:h});for(let g=p.line;g<=m.line;g+=1){let _=l.lines[g];if(!_)continue;let v=g===p.line?p.column:0,x=g===m.line?m.column:_.text.length,T=Qd({padding:t,contentWidth:i,lineWidth:_.width,align:c,scrollOffsetX:r.scrollOffsetX})+Zt(_.text.slice(0,v),o),b=Qd({padding:t,contentWidth:i,lineWidth:_.width,align:c,scrollOffsetX:r.scrollOffsetX})+Zt(_.text.slice(0,x),o),E=t.top+g*l.lineHeight-r.scrollOffsetY;r.selection.rect(T,E,Math.max(b-T,1),l.lineHeight)}}else{let p=l.lines[0],m=Zd({contentWidth:i,lineWidth:p.width,align:c,scrollOffsetX:r.scrollOffsetX}),g=t.left+m+Zt(p.text.slice(0,u),o),_=t.left+m+Zt(p.text.slice(0,h),o),v=t.top+Math.max(0,(s-r.text.height)/2);r.selection.rect(g,v,Math.max(_-g,1),Math.max(r.text.height,o.lineHeight))}r.selection.fill({color:ZM.fill,alpha:ZM.alpha})}if(r.caret.clear(),r.focused&&r.selectionStart===r.selectionEnd&&r.blinkVisible!==!1&&e.disabled!==!0){if(e.multiline){let p=Kd({value:a,index:d}),m=l.lines[p.line]??l.lines.at(-1),g=Qd({padding:t,contentWidth:i,lineWidth:m?.width??0,align:c,scrollOffsetX:r.scrollOffsetX})+Zt((m?.text??"").slice(0,p.column),o),_=t.top+p.line*l.lineHeight-r.scrollOffsetY;r.caret.rect(g,_,Hy.width,l.lineHeight)}else{let p=l.lines[0],m=Zd({contentWidth:i,lineWidth:p.width,align:c,scrollOffsetX:r.scrollOffsetX}),g=t.left+m+Zt(p.text.slice(0,d),o),_=t.top+Math.max(0,(s-r.text.height)/2);r.caret.rect(g,_,Hy.width,Math.max(r.text.height,o.lineHeight))}r.caret.fill({color:Hy.fill,alpha:1})}},zy=(r,e)=>{let t=r.layoutState;if(!t)return 0;let{padding:i,contentWidth:s,textStyle:o,displayedValue:n,layout:a,align:l}=t,c=e?.x??0,u=e?.y??0;if(!r.element.multiline){let m=a.lines[0]??{text:n,width:Zt(n,o)},g=Zd({contentWidth:s,lineWidth:m.width,align:l,scrollOffsetX:r.scrollOffsetX}),_=i.left+g;return QM({text:m.text,style:o,targetX:c-_})}let h=a.lineHeight||o.lineHeight||1,d=ts(Math.floor((u-i.top+r.scrollOffsetY)/h),0,Math.max(a.lines.length-1,0)),f=a.lines[d]??{text:"",startIndex:0},p=QM({text:f.text,style:o,targetX:c-Qd({padding:i,contentWidth:s,lineWidth:f.width??0,align:l,scrollOffsetX:r.scrollOffsetX})});return f.startIndex+p};var rs=({eventHandler:r,eventName:e,element:t,eventConfig:i,snapshot:s})=>{!r||!i||r(e,{_event:{id:t.id,value:s.value,selectionStart:s.selectionStart,selectionEnd:s.selectionEnd,composing:s.composing},...i.payload??{}})},fL=({app:r,container:e,element:t,runtime:i,eventHandler:s})=>({onValueChange:o=>{i.value=o.value,i.selectionStart=o.selectionStart,i.selectionEnd=o.selectionEnd,i.lastExternalValue=o.value,tt(i,t),rs({eventHandler:s,eventName:"change",element:t,eventConfig:t.change,snapshot:o})},onFocus:o=>{let n=i.nativeFocused===!0;i.nativeFocused=!0,i.focused=!0,i.selectionStart=o.selectionStart,i.selectionEnd=o.selectionEnd,i.selectionAnchor=o.selectionStart===o.selectionEnd?o.selectionEnd:i.selectionAnchor,i.blinkVisible=!0,i.blinkTick=0,tt(i,t),!n&&rs({eventHandler:s,eventName:"focus",element:t,eventConfig:t.focusEvent,snapshot:o})},onBlur:o=>{i.nativeFocused=!1,i.focused=!1,i.selectionStart=o.selectionStart,i.selectionEnd=o.selectionEnd,i.blinkVisible=!1,i.composing=!1,tt(i,t),rs({eventHandler:s,eventName:"blur",element:t,eventConfig:t.blurEvent,snapshot:o})},onSelectionChange:o=>{i.nativeFocused=o.focused,i.focused=o.focused,i.selectionStart=o.selectionStart,i.selectionEnd=o.selectionEnd,o.selectionStart===o.selectionEnd&&(i.selectionAnchor=o.selectionEnd),tt(i,t),rs({eventHandler:s,eventName:"selectionChange",element:t,eventConfig:t.selectionChange,snapshot:o})},onSubmit:o=>{rs({eventHandler:s,eventName:"submit",element:t,eventConfig:t.submit,snapshot:o})},onCompositionStart:o=>{i.composing=!0,tt(i,t),rs({eventHandler:s,eventName:"compositionStart",element:t,eventConfig:t.compositionStart,snapshot:o})},onCompositionUpdate:o=>{i.composing=!0,i.selectionStart=o.selectionStart,i.selectionEnd=o.selectionEnd,tt(i,t),rs({eventHandler:s,eventName:"compositionUpdate",element:t,eventConfig:t.compositionUpdate,snapshot:o})},onCompositionEnd:o=>{i.composing=!1,i.value=o.value,i.selectionStart=o.selectionStart,i.selectionEnd=o.selectionEnd,tt(i,t),rs({eventHandler:s,eventName:"compositionEnd",element:t,eventConfig:t.compositionEnd,snapshot:o})}}),sR=({app:r,parent:e,element:t,eventHandler:i,zIndex:s})=>{if(!r.inputDomBridge?.mount||!r.inputDomBridge?.focus||!r.inputDomBridge?.setSelection)throw new Error("Input plugin requires app.inputDomBridge to be initialized");let o=new te({label:t.id});o.zIndex=s,o.sortableChildren=!0,o.eventMode="static",o.cursor=t.disabled?"default":"text",o.x=Math.round(t.x),o.y=Math.round(t.y),o.alpha=t.alpha;let n=rR(t),a=iR({app:r,container:o,display:n,element:t});o.addChild(a.background,a.selection,a.text,a.placeholder,a.caret,a.clip),a.tickerListener=f=>{if(!a.focused){if(a.blinkVisible===!1)return;a.blinkVisible=!1,tt(a,a.element);return}a.blinkTick+=f.deltaMS??f.deltaTime??16,a.blinkTick>=530&&(a.blinkTick=0,a.blinkVisible=!a.blinkVisible,tt(a,a.element))},r.ticker?.add?.(a.tickerListener);let l=({start:f,end:p,shouldFocus:m=!1})=>{if(m){r.inputDomBridge.focus(t.id,{selectionStart:f,selectionEnd:p});return}r.inputDomBridge.setSelection(t.id,f,p)},c=({start:f,end:p,shouldFocus:m=!1,anchor:g=a.selectionAnchor})=>{a.focused=!0,a.selectionStart=f,a.selectionEnd=p,a.selectionAnchor=g,a.blinkVisible=!0,a.blinkTick=0,tt(a,a.element),l({start:f,end:p,shouldFocus:m})},u=f=>{if(a.element.disabled===!0)return;let p=o.toLocal(f.global),m=zy(a,p),g=!!f.shiftKey&&a.focused,_=g?a.selectionAnchor??(a.selectionStart!==a.selectionEnd?a.selectionStart:a.selectionEnd):m,v=g?Math.min(_,m):m,x=g?Math.max(_,m):m;a.draggingSelection=!0,c({start:v,end:x,shouldFocus:!0,anchor:_})},h=f=>{if(!a.draggingSelection||a.element.disabled===!0)return;let p=o.toLocal(f.global),m=zy(a,p),g=a.selectionAnchor??m,_=Math.min(g,m),v=Math.max(g,m);c({start:_,end:v,anchor:g})},d=()=>{a.draggingSelection=!1};o.on("pointerdown",u),o.on("globalpointermove",h),o.on("pointerup",d),o.on("pointerupoutside",d),o.on("pointerup",()=>{a.element.disabled!==!0&&r.inputDomBridge.focus(t.id,{selectionStart:a.selectionStart,selectionEnd:a.selectionEnd})}),o[Pn]=a,tt(a,t),r.inputDomBridge.mount(t.id,{...t,value:a.value,callbacks:fL({app:r,container:o,element:t,runtime:a,eventHandler:i}),getGeometry:()=>ef(r,o,t)}),e.addChild(o)};var is=({eventHandler:r,eventName:e,element:t,eventConfig:i,snapshot:s})=>{!r||!i||r(e,{_event:{id:t.id,value:s.value,selectionStart:s.selectionStart,selectionEnd:s.selectionEnd,composing:s.composing},...i.payload??{}})},pL=({element:r,runtime:e,eventHandler:t})=>({onValueChange:i=>{e.value=i.value,e.selectionStart=i.selectionStart,e.selectionEnd=i.selectionEnd,e.lastExternalValue=i.value,tt(e,r),is({eventHandler:t,eventName:"change",element:r,eventConfig:r.change,snapshot:i})},onFocus:i=>{let s=e.nativeFocused===!0;e.nativeFocused=!0,e.focused=!0,e.selectionStart=i.selectionStart,e.selectionEnd=i.selectionEnd,e.selectionAnchor=i.selectionStart===i.selectionEnd?i.selectionEnd:e.selectionAnchor,e.blinkVisible=!0,e.blinkTick=0,tt(e,r),!s&&is({eventHandler:t,eventName:"focus",element:r,eventConfig:r.focusEvent,snapshot:i})},onBlur:i=>{e.nativeFocused=!1,e.focused=!1,e.selectionStart=i.selectionStart,e.selectionEnd=i.selectionEnd,e.blinkVisible=!1,e.composing=!1,tt(e,r),is({eventHandler:t,eventName:"blur",element:r,eventConfig:r.blurEvent,snapshot:i})},onSelectionChange:i=>{e.nativeFocused=i.focused,e.focused=i.focused,e.selectionStart=i.selectionStart,e.selectionEnd=i.selectionEnd,i.selectionStart===i.selectionEnd&&(e.selectionAnchor=i.selectionEnd),tt(e,r),is({eventHandler:t,eventName:"selectionChange",element:r,eventConfig:r.selectionChange,snapshot:i})},onSubmit:i=>{is({eventHandler:t,eventName:"submit",element:r,eventConfig:r.submit,snapshot:i})},onCompositionStart:i=>{e.composing=!0,tt(e,r),is({eventHandler:t,eventName:"compositionStart",element:r,eventConfig:r.compositionStart,snapshot:i})},onCompositionUpdate:i=>{e.composing=!0,e.selectionStart=i.selectionStart,e.selectionEnd=i.selectionEnd,tt(e,r),is({eventHandler:t,eventName:"compositionUpdate",element:r,eventConfig:r.compositionUpdate,snapshot:i})},onCompositionEnd:i=>{e.composing=!1,e.value=i.value,e.selectionStart=i.selectionStart,e.selectionEnd=i.selectionEnd,tt(e,r),is({eventHandler:t,eventName:"compositionEnd",element:r,eventConfig:r.compositionEnd,snapshot:i})}}),oR=({app:r,parent:e,prevElement:t,nextElement:i,eventHandler:s,zIndex:o})=>{let n=e.children.find(u=>u.label===t.id);if(!n)return;if(!r.inputDomBridge?.update)throw new Error("Input plugin requires app.inputDomBridge to be initialized");n.zIndex=o;let a=n[Pn];if(!a)return;let l={...i},c=a.focused!==!0||i.value!==t.value;c&&a.composing!==!0?(a.value=i.value,a.lastExternalValue=i.value):l.value=a.value,a.element=l,n.label=i.id,n.cursor=i.disabled?"default":"text",n.x=Math.round(i.x),n.y=Math.round(i.y),n.alpha=i.alpha,i.disabled===!0&&(a.draggingSelection=!1),(!pe(t,i)||c)&&tt(a,l),r.inputDomBridge.update(i.id,{...l,value:a.value,callbacks:pL({element:l,runtime:a,eventHandler:s}),getGeometry:()=>ef(r,n,l)})};var nR=({app:r,parent:e,element:t})=>{let i=e.getChildByLabel(t.id);if(!i)return;if(!r.inputDomBridge?.unmount)throw new Error("Input plugin requires app.inputDomBridge to be initialized");let s=i[Pn];s?.tickerListener&&r.ticker?.remove?.(s.tickerListener),r.inputDomBridge.unmount(t.id),i.destroy({children:!0})};var aR=({state:r})=>{let e=yt(r),t=String(r.value??""),i=String(r.placeholder??"");return delete e.originX,delete e.originY,{...e,value:t,placeholder:i,multiline:r.multiline===!0,disabled:r.disabled===!0,...typeof r.maxLength=="number"&&{maxLength:Math.round(r.maxLength)},textStyle:Jd(r.textStyle),padding:Vy(r.padding),...r.change&&{change:r.change},...r.submit&&{submit:r.submit},...r.focusEvent&&{focusEvent:r.focusEvent},...r.blurEvent&&{blurEvent:r.blurEvent},...r.selectionChange&&{selectionChange:r.selectionChange},...r.compositionStart&&{compositionStart:r.compositionStart},...r.compositionUpdate&&{compositionUpdate:r.compositionUpdate},...r.compositionEnd&&{compositionEnd:r.compositionEnd}}};var mL=et({type:"input",add:sR,update:oR,delete:nR,parse:aR});var gL=24,xL=24,Ds=(r,e,t)=>Math.min(t,Math.max(e,r)),uR=r=>Ds(r,0,1),Cn=r=>{r?.stopPropagation?.()},yL=r=>r?k.from(r):k.EMPTY,tf=({label:r})=>{let e=new Te(k.EMPTY);return e.label=r,e.eventMode="static",e.cursor="pointer",e},_L=({config:r,state:e})=>r?e?.pressed&&r.pressSrc?r.pressSrc:e?.hovered&&r.hoverSrc?r.hoverSrc:r.src??"":"",rf=({sprite:r,config:e,state:t,width:i,height:s})=>{r&&(r.texture=yL(_L({config:e,state:t})),r.width=Math.max(i,0),r.height=Math.max(s,0),r.visible=r.width>0&&r.height>0,r.eventMode=r.visible?"static":"none")},bL=r=>({root:`${r}-scrollbar-vertical`,track:`${r}-scrollbar-vertical-track`,thumb:`${r}-scrollbar-vertical-thumb`,startButton:`${r}-scrollbar-vertical-start-button`,endButton:`${r}-scrollbar-vertical-end-button`}),lR=(r,e)=>Math.abs(r-e)<.5,cR=({hasOverflow:r,minScroll:e,previousOffset:t,wasAtEnd:i,anchorToEnd:s})=>r?s&&(t===void 0||i)?e:typeof t=="number"?Ds(t,e,0):0:0,vL=({controller:r})=>{let e=bL(r.container.label),t=r.element.scrollbar?.vertical;if(!t)return null;let i=new te({label:e.root});i.eventMode="static",i.cursor="pointer";let s=tf({label:e.track}),o=tf({label:e.thumb}),n={config:t,root:i,track:s,thumb:o,startButton:null,endButton:null,states:{track:{hovered:!1,pressed:!1},thumb:{hovered:!1,pressed:!1,dragging:!1},startButton:{hovered:!1,pressed:!1},endButton:{hovered:!1,pressed:!1}},dragOffsetY:0};i.addChild(s),i.addChild(o),t.startButton&&(n.startButton=tf({label:e.startButton}),i.addChild(n.startButton)),t.endButton&&(n.endButton=tf({label:e.endButton}),i.addChild(n.endButton));let a=()=>{hR({controller:r})};s.on("pointerover",()=>{n.states.track.hovered=!0,a()}),s.on("pointerout",()=>{n.states.track.hovered=!1,a()}),s.on("pointerdown",h=>{Cn(h),n.states.track.pressed=!0,a();let d=i.toLocal(h.global),{thumb:f}=n,p=r.viewportHeight;d.yf.y+f.height&&r.setScrollOffsets({y:r.scrollYOffset-p,source:"track"})});let l=h=>{Cn(h),n.states.track.pressed=!1,a()};s.on("pointerup",l),s.on("pointerupoutside",l),o.on("pointerover",()=>{n.states.thumb.hovered=!0,a()}),o.on("pointerout",()=>{n.states.thumb.hovered=!1,n.states.thumb.dragging||a()}),o.on("pointerdown",h=>{Cn(h);let d=i.toLocal(h.global);n.states.thumb.pressed=!0,n.states.thumb.dragging=!0,n.dragOffsetY=d.y-n.thumb.y,a()});let c=h=>{if(Cn(h),!n.states.thumb.dragging){n.states.thumb.pressed=!1,a();return}n.states.thumb.dragging=!1,n.states.thumb.pressed=!1,a()};i.on("globalpointermove",h=>{if(!n.states.thumb.dragging)return;let d=i.toLocal(h.global),f=n.track.y,p=Math.max(n.track.height-n.thumb.height,0);if(p<=0||r.minScrollY===0){r.setScrollOffsets({y:0,source:"thumb"});return}let m=Ds(d.y-n.dragOffsetY,f,f+p),g=uR((m-f)/p);r.setScrollOffsets({y:r.minScrollY*g,source:"thumb"})}),o.on("pointerup",c),o.on("pointerupoutside",c),i.on("pointerup",c),i.on("pointerupoutside",c);let u=({sprite:h,config:d,state:f,deltaDirection:p})=>{if(!h||!d)return;h.on("pointerover",()=>{f.hovered=!0,a()}),h.on("pointerout",()=>{f.hovered=!1,a()}),h.on("pointerdown",g=>{Cn(g),f.pressed=!0,a(),r.setScrollOffsets({y:r.scrollYOffset+p*Math.max(d.step??gL,0),source:"button"})});let m=g=>{Cn(g),f.pressed=!1,a()};h.on("pointerup",m),h.on("pointerupoutside",m)};return u({sprite:n.startButton,config:t.startButton,state:n.states.startButton,deltaDirection:1}),u({sprite:n.endButton,config:t.endButton,state:n.states.endButton,deltaDirection:-1}),r.container.addChild(i),n},hR=({controller:r})=>{let e=r.verticalScrollbar;if(!e)return;let{config:t,root:i,track:s,thumb:o,startButton:n,endButton:a,states:l}=e,c=Math.max(t.thickness??0,0),u=n?Math.max(t.startButton?.size??c,0):0,h=a?Math.max(t.endButton?.size??c,0):0,d=Math.max(r.viewportHeight-u-h,0),f=Math.min(xL,d),p=t.thumb?.length,m=typeof p=="number"?p:r.totalHeight>0?Math.round(r.viewportHeight/r.totalHeight*d):d,g=d>0?typeof p=="number"?Ds(m,0,d):Ds(m,f,d):0,_=Math.max(d-g,0),v=r.minScrollY===0?0:uR(r.scrollYOffset/r.minScrollY);i.visible=r.hasVerticalOverflow&&r.element.scroll&&c>0&&r.viewportHeight>0,i.x=Math.max(r.viewportWidth-c,0),i.y=0,s.x=0,s.y=u,rf({sprite:s,config:t.track,state:l.track,width:c,height:d}),o.x=0,o.y=u+_*v,rf({sprite:o,config:t.thumb,state:l.thumb,width:c,height:g}),n&&(n.x=0,n.y=0,rf({sprite:n,config:t.startButton,state:l.startButton,width:c,height:u})),a&&(a.x=0,a.y=r.viewportHeight-h,rf({sprite:a,config:t.endButton,state:l.endButton,width:c,height:h}))},dR=({container:r})=>{let e=r.__routeGraphicsScrollController;return e?{scrollXOffset:e.scrollXOffset,scrollYOffset:e.scrollYOffset,wasAtHorizontalEnd:e.hasHorizontalOverflow&&lR(e.scrollXOffset,e.minScrollX),wasAtVerticalEnd:e.hasVerticalOverflow&&lR(e.scrollYOffset,e.minScrollY)}:null},fc=({container:r,element:e,interactive:t=!0,allowViewportWithoutScroll:i=!1,previousState:s=null})=>{let o=0,n=0;e.children.forEach(u=>{o=Math.max(u.width+u.x,o),n=Math.max(u.height+u.y,n)});let a=!!(e.height&&n>e.height),l=!!(e.width&&o>e.width);if((e.scroll||i)&&(a||l)){let u=new te({label:`${r.label}-content`});[...r.children].forEach(g=>{u.addChild(g)}),r.addChild(u);let d=new Ue({label:`${r.label}-clip`}).rect(0,0,e.width||o,e.height||n).fill({color:16711680,alpha:0});r.addChild(d),u.mask=d;let f=-(n-(e.height||n)),p=-(o-(e.width||o)),m={container:r,contentContainer:u,clip:d,element:e,totalWidth:o,totalHeight:n,viewportWidth:e.width||o,viewportHeight:e.height||n,hasHorizontalOverflow:l,hasVerticalOverflow:a,minScrollX:p,minScrollY:f,scrollXOffset:cR({hasOverflow:l,minScroll:p,previousOffset:s?.scrollXOffset,wasAtEnd:s?.wasAtHorizontalEnd,anchorToEnd:!!e.anchorToBottom}),scrollYOffset:cR({hasOverflow:a,minScroll:f,previousOffset:s?.scrollYOffset,wasAtEnd:s?.wasAtVerticalEnd,anchorToEnd:!!e.anchorToBottom}),verticalScrollbar:null,setScrollOffsets:({x:g,y:_})=>{let v=g??m.scrollXOffset,x=_??m.scrollYOffset;m.scrollXOffset=m.hasHorizontalOverflow?Ds(v,m.minScrollX,0):0,m.scrollYOffset=m.hasVerticalOverflow?Ds(x,m.minScrollY,0):0,m.contentContainer.x=m.scrollXOffset,m.contentContainer.y=m.scrollYOffset,hR({controller:m})}};r.__routeGraphicsScrollController=m,m.verticalScrollbar=vL({controller:m}),m.setScrollOffsets({x:m.scrollXOffset,y:m.scrollYOffset,source:"initial"}),t&&(r.eventMode="static",r.hitArea=new Q(0,0,e.width||o,e.height||n),r.on("wheel",g=>{if(g.preventDefault(),a&&g.deltaY!==0&&m.setScrollOffsets({y:m.scrollYOffset-g.deltaY,source:"wheel"}),l&&(g.deltaX!==0||g.shiftKey&&g.deltaY!==0)){let _=g.deltaX!==0?g.deltaX:g.deltaY;m.setScrollOffsets({x:m.scrollXOffset-_,source:"wheel"})}}))}},$y=({container:r})=>{let e=r.__routeGraphicsScrollController,t=r.children.find(o=>o.label&&o.label.endsWith("-content")),i=r.children.find(o=>o.label&&o.label.endsWith("-clip")),s=r.children.find(o=>o.label&&o.label.endsWith("-scrollbar-vertical"));t&&([...t.children].forEach(n=>{n.mask=null,r.addChild(n)}),r.removeChild(t),t.destroy({children:!1})),i&&(r.removeChild(i),i.destroy()),s&&(r.removeChild(s),s.destroy({children:!0})),r.eventMode="auto",r.hitArea=null,r.removeAllListeners("wheel"),e&&(r.__routeGraphicsScrollController=void 0)};var Xy=({container:r,element:e,enabled:t})=>{let i=Number.isFinite(e?.width)?e.width:0,s=Number.isFinite(e?.height)?e.height:0;if(t&&i>0&&s>0){r.hitArea=new Q(0,0,i,s);return}r.hitArea=null},fR=(r,e)=>{let t=e??null;for(;t;){if(t===r)return!0;t=t.parent??null}return!1},Ns=(r,e)=>{let t=e??null;for(;t;){if(t===r)return!1;if(typeof t.label=="string"&&t.label.startsWith(`${r.label}-scrollbar-`))return!0;t=t.parent??null}return!1},TL=(r,e)=>{if(!e||typeof e.x!="number"||typeof e.y!="number")return!1;let t=r.toLocal(e),i=r.hitArea;return i?.contains?i.contains(t.x,t.y):!1},sf=({app:r,container:e,element:t,eventHandler:i})=>{let s=Oy(e),o=Uy(e),n=Gy(e),a=s;Tn({root:e,isHovered:!1}),Gs({root:e,isPressed:!1}),Si({root:e,isPressed:!1}),e.removeAllListeners("pointerover"),e.removeAllListeners("pointerout"),e.removeAllListeners("pointerdown"),e.removeAllListeners("pointerup"),e.removeAllListeners("pointerupoutside"),e.removeAllListeners("rightdown"),e.removeAllListeners("rightup"),e.removeAllListeners("rightupoutside"),e.removeAllListeners("rightclick"),e.cursor="auto",t.scroll||(e.eventMode="auto",Xy({container:e,element:t,enabled:!1}));let l=t?.hover,c=t?.click,u=t?.rightClick;if(!!(l||c||u)&&(e.eventMode="static",t.scroll?e.hitArea||Xy({container:e,element:t,enabled:!0}):Xy({container:e,element:t,enabled:!0})),l){let{cursor:d,soundSrc:f,payload:p,inheritToChildren:m}=l,g=v=>{fR(e,v?.relatedTarget)||a||(a=!0,p&&i&&i("hover",{_event:{id:e.label},...p}),d&&(e.cursor=d),f&&r.audioStage.add({id:`hover-${Date.now()}`,url:f,loop:!1}),m&&Tn({root:e,isHovered:!0}))},_=v=>{fR(e,v?.relatedTarget)||TL(e,v?.global)||a&&(a=!1,e.cursor="auto",m&&Tn({root:e,isHovered:!1}))};e.on("pointerover",g),e.on("pointerout",_)}if(c){let{soundSrc:d,soundVolume:f,payload:p,inheritToChildren:m}=c,g=x=>{nt(x)&&(Ns(e,x?.target)||m&&Gs({root:e,isPressed:!0}))},_=x=>{nt(x)&&(Ns(e,x?.target)||(m&&Gs({root:e,isPressed:!1}),p&&i&&i("click",{_event:{id:e.label},...p}),d&&r.audioStage.add({id:`click-${Date.now()}`,url:d,loop:!1,volume:We(f)})))},v=x=>{nt(x)&&(Ns(e,x?.target)||m&&Gs({root:e,isPressed:!1}))};e.on("pointerdown",g),e.on("pointerup",_),e.on("pointerupoutside",v)}if(u){let{soundSrc:d,payload:f,inheritToChildren:p}=u,m=T=>{Ns(e,T?.target)||p&&Si({root:e,isPressed:!0})},g=T=>{Ns(e,T?.target)||p&&Si({root:e,isPressed:!1})},_=T=>{bM(T)&&(Ns(e,T?.target)||p&&Si({root:e,isPressed:!1}))},v=T=>{Ns(e,T?.target)||(p&&Si({root:e,isPressed:!1}),f&&i&&i("rightClick",{_event:{id:e.label},...f}),d&&r.audioStage.add({id:`rightClick-${Date.now()}`,url:d,loop:!1}))},x=()=>{p&&Si({root:e,isPressed:!1})};e.on("rightdown",m),e.on("rightup",g),e.on("pointerup",_),e.on("rightclick",v),e.on("pointerupoutside",_),e.on("rightupoutside",x)}l?.inheritToChildren&&s&&Tn({root:e,isHovered:!0}),c?.inheritToChildren&&o&&Gs({root:e,isPressed:!0}),u?.inheritToChildren&&n&&Si({root:e,isPressed:!0})},pR=({container:r})=>{Oy(r)&&Tn({root:r,isHovered:!0})},mR=({container:r})=>{Uy(r)&&Gs({root:r,isPressed:!0})},gR=({container:r})=>{Gy(r)&&Si({root:r,isPressed:!0})};var pc=r=>{let e=new Set;if(r.id&&e.add(r.id),r.children&&Array.isArray(r.children))for(let t of r.children)for(let i of pc(t))e.add(i);return e};var xR=(r,e,t=[])=>{let i=new Set,s=new Map,o=new Map,n=[],a=[],l=[];for(let c of r)i.add(c.id),s.set(c.id,c);for(let c of e)i.add(c.id),o.set(c.id,c);for(let c of i){let u=s.get(c),h=o.get(c);if(!u&&h)n.push(h);else if(u&&!h)a.push(u);else{let d=pc(h),f=t instanceof Map?Array.from(t.keys()).some(p=>d.has(p)):t.find(p=>d.has(p.targetId));(!pe(u,h)||f)&&l.push({prev:u,next:h})}}return{toAddElement:n,toDeleteElement:a,toUpdateElement:l}};var of=r=>r<.36363636363636365?7.5625*r*r:r<.7272727272727273?7.5625*(r-=.5454545454545454)*r+.75:r<.9090909090909091?7.5625*(r-=.8181818181818182)*r+.9375:7.5625*(r-=.9545454545454546)*r+.984375,SL=r=>r,wL=r=>r*r,EL=r=>1-(1-r)*(1-r),AL=r=>r<.5?2*r*r:1-Math.pow(-2*r+2,2)/2,yR=Object.freeze({linear:SL,easeInQuad:wL,easeOutQuad:EL,easeInOutQuad:AL,easeInCubic:r=>r*r*r,easeOutCubic:r=>1-Math.pow(1-r,3),easeInOutCubic:r=>r<.5?4*r*r*r:1-Math.pow(-2*r+2,3)/2,easeInQuart:r=>r*r*r*r,easeOutQuart:r=>1-Math.pow(1-r,4),easeInOutQuart:r=>r<.5?8*r*r*r*r:1-Math.pow(-2*r+2,4)/2,easeInQuint:r=>r*r*r*r*r,easeOutQuint:r=>1-Math.pow(1-r,5),easeInOutQuint:r=>r<.5?16*r*r*r*r*r:1-Math.pow(-2*r+2,5)/2,easeInSine:r=>1-Math.cos(r*Math.PI/2),easeOutSine:r=>Math.sin(r*Math.PI/2),easeInOutSine:r=>-(Math.cos(Math.PI*r)-1)/2,easeInExpo:r=>r===0?0:Math.pow(2,10*r-10),easeOutExpo:r=>r===1?1:1-Math.pow(2,-10*r),easeInOutExpo:r=>r===0?0:r===1?1:r<.5?Math.pow(2,20*r-10)/2:(2-Math.pow(2,-20*r+10))/2,easeInCirc:r=>1-Math.sqrt(1-Math.pow(r,2)),easeOutCirc:r=>Math.sqrt(1-Math.pow(r-1,2)),easeInOutCirc:r=>r<.5?(1-Math.sqrt(1-Math.pow(2*r,2)))/2:(Math.sqrt(1-Math.pow(-2*r+2,2))+1)/2,easeInBack:r=>2.70158*r*r*r-1.70158*r*r,easeOutBack:r=>1+2.70158*Math.pow(r-1,3)+1.70158*Math.pow(r-1,2),easeInOutBack:r=>{let t=2.5949095;return r<.5?Math.pow(2*r,2)*((t+1)*2*r-t)/2:(Math.pow(2*r-2,2)*((t+1)*(r*2-2)+t)+2)/2},easeInBounce:r=>1-of(1-r),easeOutBounce:of,easeInOutBounce:r=>r<.5?(1-of(1-2*r))/2:(1+of(2*r-1))/2,easeInElastic:r=>{let e=2*Math.PI/3;return r===0?0:r===1?1:-Math.pow(2,10*r-10)*Math.sin((r*10-10.75)*e)},easeOutElastic:r=>{let e=2*Math.PI/3;return r===0?0:r===1?1:Math.pow(2,-10*r)*Math.sin((r*10-.75)*e)+1},easeInOutElastic:r=>{let e=2*Math.PI/4.5;return r===0?0:r===1?1:r<.5?-(Math.pow(2,20*r-10)*Math.sin((20*r-11.125)*e))/2:Math.pow(2,-20*r+10)*Math.sin((20*r-11.125)*e)/2+1}}),nf=Object.freeze(Object.keys(yR)),PL=(r="linear")=>{let e=yR[r];if(!e)throw new Error(`Unsupported easing: ${r}`);return e},Mn=r=>{let e=[],t=0,i;return r.forEach(({value:s,duration:o,easing:n="linear",relative:a},l)=>{if(l===0){i=s,e.push({time:t,value:s,easing:"linear"});return}o!==void 0&&(t+=o,i=a?i+s:s,e.push({time:t,value:i,easing:n}))}),e},mc=r=>{let e=0;for(let{timeline:t}of r){let i=t[t.length-1];i&&i.time>e&&(e=i.time)}return e},gc=(r,e)=>{if(r.length===0)return 0;if(e<=r[0].time)return r[0].value;if(e>=r[r.length-1].time)return r[r.length-1].value;for(let t=0;t=i&&e<=n){let l=(e-i)/(n-i);return s+(a-s)*PL(o)(l)}}return r[r.length-1].value};var CL={translateX:0,translateY:0,alpha:1,scaleX:1,scaleY:1,rotation:0},qy=r=>Math.min(1,Math.max(0,r));var SR=r=>r.getLocalBounds().rectangle.clone(),wR=r=>(r.width=Math.max(1,Math.ceil(r.width)),r.height=Math.max(1,Math.ceil(r.height)),r),_R=(r,e)=>{let t=wR(SR(e)),i=r.renderer.generateTexture({target:e,frame:t}),s=new Te(i);s.x=t.x,s.y=t.y;let o=new te;return o.x=e.x??0,o.y=e.y??0,o.scale.set(e.scale?.x??1,e.scale?.y??1),o.rotation=e.rotation??0,o.alpha=e.alpha??1,o.addChild(s),{wrapper:o,texture:i}},ML=(r={})=>Object.entries(r).map(([e,t])=>({property:e,timeline:Mn([{value:t.initialValue??CL[e]??0},...t.keyframes])})),cf=(r,e,t)=>{if(!r||!e)return{duration:0,apply:()=>{}};let i=ML(e),s={x:r.x,y:r.y,alpha:r.alpha,scaleX:r.scale.x,scaleY:r.scale.y,rotation:r.rotation};return{duration:mc(i),apply:o=>{r.x=s.x,r.y=s.y,r.alpha=s.alpha,r.scale.x=s.scaleX,r.scale.y=s.scaleY,r.rotation=s.rotation;for(let{property:n,timeline:a}of i){let l=gc(a,o);switch(n){case"translateX":r.x=s.x+l*t.renderer.width;break;case"translateY":r.y=s.y+l*t.renderer.height;break;case"alpha":r.alpha=s.alpha*l;break;case"scaleX":r.scale.x=s.scaleX*l;break;case"scaleY":r.scale.y=s.scaleY*l;break;case"rotation":r.rotation=s.rotation+l;break}}}}},RL=r=>Mn([{value:r?.progress?.initialValue??0},...r?.progress?.keyframes??[]]),ER=` in vec2 aPosition; out vec2 vTextureCoord; out vec2 vSecondaryCoord; @@ -1412,16 +1412,16 @@ fn mainFragment(@location(0) uv: vec2) -> @location(0) vec4 return vec4(outputValue, outputValue, outputValue, 1.0); } -`,kL=(r,e)=>{let t=document.createElement("canvas");t.width=r,t.height=e;let i=t.getContext("2d",{willReadFrequently:!0});if(!i)throw new Error("Replace mask composition could not create a 2D canvas.");return{canvas:t,context:i}},FL=(r,e,t="red")=>{switch(t){case"green":return r[e+1];case"blue":return r[e+2];case"alpha":return r[e+3];default:return r[e]}},OL=({app:r,texture:e,width:t,height:i,channel:s="red",invert:o=!1})=>{let n=new Uint8ClampedArray(t*i),a=new Te(k.from(e));a.width=t,a.height=i;let l=new te;l.addChild(a);let c=Ki.create({width:t,height:i});r.renderer.render({container:l,target:c,clear:!0});let u=r.renderer.extract.pixels(c).pixels;for(let h=0,d=0;h{let s=null;for(let o of e.items){let n=OL({app:r,texture:o.texture,width:t,height:i,channel:o.channel??"red",invert:o.invert??!1});if(!s){s=n;continue}for(let a=0;a{switch(r){case"green":return new Float32Array([0,1,0,0]);case"blue":return new Float32Array([0,0,1,0]);case"alpha":return new Float32Array([0,0,0,1]);default:return new Float32Array([1,0,0,0])}},jy=lf("red"),Yy=(r,e)=>Ki.create({width:r,height:e,resolution:1}),GL=(r,e)=>{let t=new be({uMaskInvert:{value:e?1:0,type:"f32"},uMaskChannelWeights:{value:r,type:"vec4"}});return{filter:rn.from({gpu:{vertex:{source:vR,entryPoint:"mainVertex"},fragment:{source:vR,entryPoint:"mainFragment"}},gl:{vertex:ER,fragment:BL,name:"replace-mask-channel-filter"},resources:{maskChannelUniforms:t}}),maskChannelUniforms:t}},TR=({app:r,texture:e,width:t,height:i,channelWeights:s,invert:o=!1})=>{let n=k.from(e),a=new Te(n);a.width=t,a.height=i,a.filterArea=new Q(0,0,t,i);let l=new te;l.addChild(a);let c=Yy(t,i),{filter:u}=GL(s,o);return a.filters=[u],r.renderer.render({container:l,target:c,clear:!0}),a.filters=[],l.destroy({children:!0}),u.destroy(),c},LL=(r,e,t)=>{let{canvas:i,context:s}=kL(r,e),o=s.createImageData(r,e),n=o.data;for(let a=0,l=0;a{if(!e)return{textures:[k.WHITE.source],channelWeights:lf("red"),invert:0,destroy:()=>{}};if(e.kind==="single"){let o=TR({app:r,texture:e.texture,width:t,height:i,channelWeights:lf(e.channel??"red"),invert:e.invert??!1});return{textures:[o.source],channelWeights:jy,invert:0,destroy:()=>{o.destroy(!0)}}}if(e.kind==="sequence"){let o=e.textures.map(n=>TR({app:r,texture:n,width:t,height:i,channelWeights:lf(e.channel??"red"),invert:e.invert??!1}));return{textures:o.map(n=>n.source),channelWeights:jy,invert:0,destroy:()=>{for(let n of o)n.destroy(!0)}}}let s=LL(t,i,UL(r,e,t,i));return{textures:[s.source],channelWeights:jy,invert:0,destroy:()=>{s.destroyed||s.destroy(!0)}}},NL=()=>{let r=new be({uProgress:{value:0,type:"f32"},uSoftness:{value:.001,type:"f32"},uMaskMix:{value:0,type:"f32"},uMaskInvert:{value:0,type:"f32"},uMaskChannelWeights:{value:new Float32Array([1,0,0,0]),type:"vec4"},uSecondaryMatrix:{value:new G,type:"mat3x3"},uSecondaryClamp:{value:new Float32Array([0,0,1,1]),type:"vec4"}});return{filter:rn.from({gpu:{vertex:{source:bR,entryPoint:"mainVertex"},fragment:{source:bR,entryPoint:"mainFragment"}},gl:{vertex:ER,fragment:IL,name:"replace-mask-filter"},resources:{replaceMaskUniforms:r,uNextTexture:k.EMPTY.source,uMaskTextureA:k.EMPTY.source,uMaskTextureB:k.EMPTY.source}}),replaceMaskUniforms:r}},HL=({progress:r=0,frameCount:e=0,sampleMode:t="hold"}={})=>{if(e<=1)return{fromIndex:0,toIndex:0,mix:0};let i=qy(r)*Math.max(0,e-1);if(t==="linear"){let o=Math.floor(i),n=Math.min(e-1,o+1);return{fromIndex:o,toIndex:n,mix:i-o}}let s=Math.min(e-1,Math.max(0,Math.round(i)));return{fromIndex:s,toIndex:s,mix:0}},VL=(r,e,t,i,s)=>{let o=RL(e),n=mc([{timeline:o}]),a=Math.max(e?.softness??.001,1e-4),{textures:l,channelWeights:c,invert:u,destroy:h}=DL(r,e,t,i),d=s.resources.replaceMaskUniforms,f=-1,p=-1;return{duration:n,progressTimeline:o,apply:m=>{let g=e?.kind==="sequence"?HL({progress:m,frameCount:l.length,sampleMode:e.sample??"hold"}):{fromIndex:0,toIndex:0,mix:0};g.fromIndex!==f&&(s.resources.uMaskTextureA=l[g.fromIndex]??k.EMPTY.source,f=g.fromIndex),g.toIndex!==p&&(s.resources.uMaskTextureB=l[g.toIndex]??k.EMPTY.source,p=g.toIndex),d.uniforms.uProgress=qy(m),d.uniforms.uSoftness=a,d.uniforms.uMaskMix=g.mix,d.uniforms.uMaskInvert=u,d.uniforms.uMaskChannelWeights=c,d.update()},destroy:h}},WL=(r,e)=>{let t=Math.max(1,r),i=Math.max(1,e);return new Float32Array([.5/t,.5/i,1-.5/t,1-.5/i])},zL=r=>{let e=new te;for(let t of r)t?.wrapper&&e.addChild(t.wrapper);return wR(SR(e))},af=({app:r,container:e,target:t,frame:i})=>{r.renderer.render({container:e,target:t,clear:!0,transform:new G(1,0,0,1,-i.x,-i.y)})},Hs=r=>{r?.wrapper&&!r.wrapper.destroyed&&r.wrapper.destroy({children:!0}),r?.texture?.destroy(!0)},$L=({prevElement:r,nextElement:e,animation:t,prevSubject:i,nextSubject:s})=>{if(!i||!s||r?.id!==e?.id)return{prevSubject:i,nextSubject:s};let o=i,n=s;return t.mask!==void 0&&t.prev===void 0&&t.next===void 0?{prevSubject:o,nextSubject:n}:(t.prev===void 0&&(o=null),t.next===void 0&&(n=null),{prevSubject:o,nextSubject:n})},XL=({app:r,animation:e,prevSubject:t,nextSubject:i,zIndex:s})=>{let o=new te;o.zIndex=s,t?.wrapper&&o.addChild(t.wrapper),i?.wrapper&&o.addChild(i.wrapper);let n=cf(t?.wrapper??null,e.prev?.tween,r),a=cf(i?.wrapper??null,e.next?.tween,r);return{overlay:o,duration:Math.max(n.duration,a.duration),apply:l=>{n.apply(l),a.apply(l)},destroy:()=>{o.removeFromParent(),o.destroy({children:!0}),Hs(t),Hs(i)}}},jL=({app:r,animation:e,prevSubject:t,nextSubject:i,zIndex:s})=>{let o=zL([t,i]),n=new te,a=new te;t?.wrapper&&n.addChild(t.wrapper),i?.wrapper&&a.addChild(i.wrapper);let l=Yy(o.width,o.height),c=Yy(o.width,o.height),u=new te;u.zIndex=s;let h=new Te(l);h.x=o.x,h.y=o.y,h.filterArea=new Q(0,0,o.width,o.height),u.addChild(h);let{filter:d}=NL();d.resources.uNextTexture=c.source,h.filters=[d];let f=WL(o.width,o.height),p=typeof d.apply=="function"?d.apply.bind(d):(T,b,w,E)=>{T.applyFilter(d,b,w,E)};d.apply=(T,b,w,E)=>{let I=d.resources.replaceMaskUniforms;T.calculateSpriteMatrix(I.uniforms.uSecondaryMatrix,h),I.uniforms.uSecondaryClamp=f,I.update(),p(T,b,w,E)};let m=VL(r,e.mask,o.width,o.height,d),g=cf(t?.wrapper??null,e.prev?.tween,r),_=cf(i?.wrapper??null,e.next?.tween,r),v=!1,x=!1;return t?.wrapper||af({app:r,container:n,target:l,frame:o}),i?.wrapper||af({app:r,container:a,target:c,frame:o}),{overlay:u,duration:Math.max(g.duration,_.duration,m.duration),apply:T=>{g.apply(T),_.apply(T),t?.wrapper&&(g.duration>0||!v)&&(af({app:r,container:n,target:l,frame:o}),v=!0),i?.wrapper&&(_.duration>0||!x)&&(af({app:r,container:a,target:c,frame:o}),x=!0);let b=qy(gc(m.progressTimeline,T));m.apply(b)},destroy:()=>{u.removeFromParent(),h.filters=[],d.destroy(),u.destroy({children:!0}),n.destroy({children:!0}),a.destroy({children:!0}),l.destroy(!0),c.destroy(!0),Hs(t),Hs(i),m.destroy()}}},YL=({app:r,animation:e,prevSubject:t,nextSubject:i,zIndex:s})=>e.mask?jL({app:r,animation:e,prevSubject:t,nextSubject:i,zIndex:s}):XL({app:r,animation:e,prevSubject:t,nextSubject:i,zIndex:s}),qL=({app:r,parent:e,nextElement:t,plugin:i,animations:s,eventHandler:o,animationBus:n,completionTracker:a,elementPlugins:l,renderContext:c,zIndex:u,signal:h})=>{if(!t)return null;let d=i.add({app:r,parent:e,element:t,animations:s,eventHandler:o,animationBus:n,completionTracker:a,elementPlugins:l,renderContext:c,zIndex:u,signal:h});return d&&typeof d.then=="function"?d.then(()=>h?.aborted||e.destroyed?null:e.children.find(f=>f.label===t.id)??null):h?.aborted||e.destroyed?null:e.children.find(f=>f.label===t.id)??null},KL=async r=>r&&typeof r.then=="function"?r:r??null,uf=({app:r,parent:e,prevElement:t,nextElement:i,animation:s,animations:o,animationBus:n,completionTracker:a,eventHandler:l,elementPlugins:c,renderContext:u,plugin:h,zIndex:d,signal:f})=>{if(!t&&!i)throw new Error(`Replace animation "${s.id}" must receive prevElement and/or nextElement.`);if(f?.aborted||e.destroyed)return;let p=t?e.children.find(P=>P.label===t.id)??null:null;if(t&&!p)throw new Error(`Transition animation "${s.id}" could not find the previous element "${t.id}".`);let m=p?_R(r,p):null,g=new te,_=Fd({suppressAnimations:!0}),v=a.getVersion(),x=!1,T=()=>{x||(a.track(v),x=!0)},b=()=>{x&&(a.complete(v),x=!1)},w=({flushDeferredEffects:P})=>{if(!B){if(B=!0,E.value&&!E.value.destroyed&&(E.value.visible=!0),I.value?.destroy(),P){fM(_);return}Od(_)}},E={value:null},I={value:null},B=!1;T();let C=P=>{if(f?.aborted||e.destroyed){Od(_),g.destroy({children:!0}),Hs(m),b();return}if(i&&!P)throw Od(_),b(),new Error(`Transition animation "${s.id}" could not create the next element "${i.id}".`);E.value=P;let R=P?_R(r,P):null,M=$L({prevElement:t,nextElement:i,animation:s,prevSubject:m,nextSubject:R});M.prevSubject!==m&&Hs(m),M.nextSubject!==R&&Hs(R),g.destroy({children:!1}),p&&h.delete({app:r,parent:e,element:t,animations:[],animationBus:n,completionTracker:a,eventHandler:l,elementPlugins:c,renderContext:u,signal:f}),P&&(P.zIndex=d,e.addChild(P),P.visible=!1);let F=YL({app:r,animation:s,prevSubject:M.prevSubject,nextSubject:M.nextSubject,zIndex:d});I.value=F,e.addChild(F.overlay),n.dispatch({type:"START",payload:{id:s.id,driver:"custom",duration:F.duration,applyFrame:F.apply,applyTargetState:()=>{w({flushDeferredEffects:!1})},onComplete:()=>{try{w({flushDeferredEffects:!0})}finally{b()}},onCancel:()=>{b()},isValid:()=>!!F.overlay&&!F.overlay.destroyed&&(!P||!P.destroyed)}})},A=i?qL({app:r,parent:g,nextElement:i,plugin:h,animations:o,eventHandler:l,animationBus:n,completionTracker:a,elementPlugins:c,renderContext:_,zIndex:d,signal:f}):null;if(A&&typeof A.then=="function"){KL(A).then(C);return}C(A??null)};var Vs=({app:r,parent:e,prevComputedTree:t,nextComputedTree:i,animations:s,animationBus:o,completionTracker:n,eventHandler:a,elementPlugins:l,renderContext:c=Fd(),signal:u})=>{e.sortableChildren=!0;let h=new Map(l.map(b=>[b.type,b])),d=pM(s),f=new Map,p=new Map;for(let b of t)f.set(b.id,b);for(let b=0;bb.id)),x=b=>{let w=h.get(b);if(!w)throw new Error(`No plugin found for element type: ${b}`);return w},T=b=>e.children.find(w=>w.label===b)?.zIndex??-1;for(let b of i){let w=f.get(b.id);!w||v.has(b.id)||!pe(w,b)||x(b.type).shouldUpdateUnchanged?.({app:r,parent:e,prevElement:w,nextElement:b,animations:d,animationBus:o,completionTracker:n,eventHandler:a,elementPlugins:l,renderContext:c,zIndex:p.get(b.id)??-1,signal:u})!==!0||(_.push({prev:w,next:b}),v.add(b.id))}for(let b of e.children){let w=p.get(b.label);w!==void 0&&(b.zIndex=w)}for(let b of g){let w=c.suppressAnimations?null:Ld(d,b.id),E=x(b.type);if(w){uf({app:r,parent:e,prevElement:b,nextElement:null,animation:w,animations:d,animationBus:o,completionTracker:n,eventHandler:a,elementPlugins:l,renderContext:c,plugin:E,zIndex:T(b.id),signal:u});continue}E.delete({app:r,parent:e,element:b,animations:[],animationBus:o,completionTracker:n,eventHandler:a,elementPlugins:l,renderContext:c,signal:u})}for(let b of m){let w=c.suppressAnimations?null:Ld(d,b.id),E=x(b.type),I=p.get(b.id)??-1;if(w){uf({app:r,parent:e,prevElement:null,nextElement:b,animation:w,animations:d,animationBus:o,completionTracker:n,eventHandler:a,elementPlugins:l,renderContext:c,plugin:E,zIndex:I,signal:u});continue}E.add({app:r,parent:e,element:b,animations:d,eventHandler:a,animationBus:o,completionTracker:n,elementPlugins:l,renderContext:c,zIndex:I,signal:u})}for(let{prev:b,next:w}of _){let E=x(w.type),I=p.get(w.id)??-1,B=c.suppressAnimations?null:Ld(d,w.id);if(B){uf({app:r,parent:e,prevElement:b,nextElement:w,animation:B,animations:d,animationBus:o,completionTracker:n,eventHandler:a,elementPlugins:l,renderContext:c,plugin:E,zIndex:I,signal:u});continue}E.update({app:r,parent:e,prevElement:b,nextElement:w,animations:d,animationBus:o,completionTracker:n,eventHandler:a,elementPlugins:l,renderContext:c,zIndex:I,signal:u})}};var ZL=(r=[])=>{let e=new Set;for(let t of r)if(t?.id){if(e.has(t.id))return!0;e.add(t.id)}return!1},QL=({app:r,container:e,children:t,eventHandler:i,animationBus:s,elementPlugins:o,renderContext:n,completionTracker:a,signal:l})=>{for(let c of t){let u=o.find(h=>h.type===c.type);if(!u)throw new Error(`No plugin found for child element type: ${c.type}`);u.add({app:r,parent:e,element:c,animations:[],eventHandler:i,animationBus:s,elementPlugins:o,renderContext:n,completionTracker:a,signal:l})}},AR=({app:r,parent:e,element:t,animations:i,eventHandler:s,animationBus:o,elementPlugins:n,renderContext:a,zIndex:l,completionTracker:c,signal:u})=>{let{id:h,x:d,y:f,children:p,scroll:m,alpha:g}=t,_=new te;_.label=h,_.zIndex=l,_.x=Math.round(d),_.y=Math.round(f),_.alpha=g,e.addChild(_),p&&p.length>0&&(ZL(p)?QL({app:r,container:_,children:p,eventHandler:s,animationBus:o,elementPlugins:n,renderContext:a,completionTracker:c,signal:u}):Vs({app:r,parent:_,prevComputedTree:[],nextComputedTree:p,animations:i,animationBus:o,completionTracker:c,eventHandler:s,elementPlugins:n,renderContext:a,signal:u})),(m||t.anchorToBottom)&&fc({container:_,element:t,interactive:!!m,allowViewportWithoutScroll:!!t.anchorToBottom}),sf({app:r,container:_,element:t,eventHandler:s})};var PR=({app:r,parent:e,prevElement:t,nextElement:i,eventHandler:s,animations:o,animationBus:n,elementPlugins:a,renderContext:l,zIndex:c,completionTracker:u,signal:h})=>{let d=e.children.find(v=>v.label===t.id);if(!d)return;d.zIndex=c;let{x:f,y:p,alpha:m}=i,g=()=>{if(!pe(t,i)){d.x=Math.round(f),d.y=Math.round(p),d.label=i.id,d.alpha=m,d.scale.x=1,d.scale.y=1;let b=t.scroll||t.anchorToBottom,w=i.scroll||i.anchorToBottom,E=w?dR({container:d}):null;b!==w?w?fc({container:d,element:i,interactive:!!i.scroll,allowViewportWithoutScroll:!!i.anchorToBottom,previousState:E}):$y({container:d}):w&&($y({container:d}),fc({container:d,element:i,interactive:!!i.scroll,allowViewportWithoutScroll:!!i.anchorToBottom,previousState:E})),sf({app:r,container:d,element:i,eventHandler:s})}let v=!pe(t.children,i.children),x=pc({children:i.children}),T=Array.from(x).some(b=>Gd(o,b).length>0);if(v||T){let w=d.children.find(E=>E.label===`${i.id}-content`)||d;Vs({app:r,parent:w,nextComputedTree:i.children,prevComputedTree:t.children,eventHandler:s,elementPlugins:a,animations:o,animationBus:n,completionTracker:u,renderContext:l,signal:h}),pR({container:d}),mR({container:d}),gR({container:d})}};ne({animations:o,targetId:t.id,animationBus:n,completionTracker:u,element:d,targetState:{x:f,y:p,alpha:m},onComplete:()=>{g()}})||g()};var CR=({app:r,parent:e,element:t,animationBus:i,animations:s,eventHandler:o,completionTracker:n})=>{let a=e.getChildByLabel(t.id);if(!a)return;let l=()=>{a&&!a.destroyed&&(e.removeChild(a),a.destroy({children:!0}))};ne({animations:s,targetId:t.id,animationBus:i,completionTracker:n,element:a,targetState:null,onComplete:l})||l()};var MR=({state:r,parserPlugins:e=[]})=>{let t=r.direction??"",i=!!r.scroll,s=r.gap||0,o=structuredClone(r.children||[]),n=[],a=0,l=0,c=0,u=0,h=0,d=0,f=0,p=0,m=0,g=0;for(let x=0;x0?t==="horizontal"?(b.x=c,b.y=f):t==="vertical"&&(b.x=p,b.y=u):(t==="horizontal"||t==="vertical")&&(b.x=0,b.y=0);let w=e.find(E=>E.type===b.type);if(w){let E=b.scaleX!==void 0||r.scaleX!==void 0,I=b.scaleY!==void 0||r.scaleY!==void 0,B=(b.scaleX??1)*(r.scaleX??1),C=(b.scaleY??1)*(r.scaleY??1);b=w.parse({state:{...b,...E?{scaleX:B}:{},...I?{scaleY:C}:{}},parserPlugins:e})}t==="horizontal"?(r.width&&b.width+m>r.width&&!i&&!r.anchorToBottom?(c=0,m=0,f+=h+s,h=b.height,b.x=0,b.y=f):h=Math.max(h,b.height),c+=b.width+T,m=b.x+b.width,a=Math.max(c,a),l=Math.max(b.height+b.y,l)):t==="vertical"?(r.height&&b.height+g>r.height&&!i&&!r.anchorToBottom?(u=0,g=0,p+=d+s,d=b.width,b.x=p,b.y=0):d=Math.max(d,b.width),u+=b.height+T,g=b.y+b.height,a=Math.max(b.width+b.x,a),l=Math.max(u,l)):(a=Math.max(b.width+b.x,a),l=Math.max(b.height+b.y,l)),n.push(b)}let v={...yt({...r,width:r.width?r.width:a,height:r.height?r.height:l}),children:n,direction:t,gap:s,scroll:i,...r.anchorToBottom&&{anchorToBottom:!0},...r.scrollbar&&{scrollbar:structuredClone(r.scrollbar)},rotation:r.rotation??0};return r.rightClick&&(v.rightClick=r.rightClick),v};var JL=et({type:"container",add:AR,update:PR,delete:CR,parse:MR});var RR=async({parent:r,element:e,animationBus:t,renderContext:i,completionTracker:s,zIndex:o,signal:n})=>{if(n?.aborted)return;let a=new te;if(a.label=e.id,a.zIndex=o,e.x!==void 0&&(a.x=Math.round(e.x)),e.y!==void 0&&(a.y=Math.round(e.y)),e.alpha!==void 0&&(a.alpha=e.alpha),r.addChild(a),i?.suppressAnimations&&!_n(e)){await Ti({container:a,element:e,completionTracker:s,animationBus:t,zIndex:o,signal:n,playback:"paused-initial"}),Ud(i,{container:a,element:e,completionTracker:s,animationBus:t,zIndex:o,signal:n});return}await Ti({container:a,element:e,completionTracker:s,animationBus:t,zIndex:o,signal:n,playback:"autoplay"})};var IR=(r={})=>JSON.stringify({content:r.content??null,revealEffect:r.revealEffect??"typewriter",speed:r.speed??50,width:r.width??null,indicator:r.indicator??null,x:r.x??null,y:r.y??null,alpha:r.alpha??1}),eD=(r,e)=>IR(r)!==IR(e),BR=async({parent:r,prevElement:e,nextElement:t,animations:i,animationBus:s,renderContext:o,completionTracker:n,zIndex:a,signal:l})=>{if(l?.aborted)return;let c=r.children.find(d=>d.label===e.id);if(!c)return;let u=async()=>{if(t.x!==void 0&&(c.x=t.x),t.y!==void 0&&(c.y=t.y),t.alpha!==void 0&&(c.alpha=t.alpha),!eD(e,t)){o?.suppressAnimations!==!0&&!_n(t)&&await Ti({container:c,element:t,completionTracker:n,animationBus:s,zIndex:a,signal:l,playback:"resume"});return}if(o?.suppressAnimations===!0&&!_n(t)){await Ti({container:c,element:t,completionTracker:n,animationBus:s,zIndex:a,signal:l,playback:"paused-initial"}),Ud(o,{container:c,element:t,completionTracker:n,animationBus:s,zIndex:a,signal:l});return}await Ti({container:c,element:t,completionTracker:n,animationBus:s,zIndex:a,signal:l,playback:"autoplay"})};ne({animations:i,targetId:e.id,animationBus:s,completionTracker:n,element:c,targetState:{x:t.x??c.x,y:t.y??c.y,alpha:t.alpha??c.alpha},onComplete:()=>{u()}})||await u()};var kR=({parent:r,element:e,animations:t,animationBus:i,completionTracker:s})=>{let o=r.getChildByLabel(e.id);if(!o||o.destroyed)return;let n=()=>{o&&!o.destroyed&&(Py(o),o.destroy({children:!0}))};ne({animations:t,targetId:e.id,animationBus:i,completionTracker:s,element:o,targetState:null,onComplete:n})||n()};var tD=r=>r===` +`,kL=(r,e)=>{let t=document.createElement("canvas");t.width=r,t.height=e;let i=t.getContext("2d",{willReadFrequently:!0});if(!i)throw new Error("Replace mask composition could not create a 2D canvas.");return{canvas:t,context:i}},FL=(r,e,t="red")=>{switch(t){case"green":return r[e+1];case"blue":return r[e+2];case"alpha":return r[e+3];default:return r[e]}},OL=({app:r,texture:e,width:t,height:i,channel:s="red",invert:o=!1})=>{let n=new Uint8ClampedArray(t*i),a=new Te(k.from(e));a.width=t,a.height=i;let l=new te;l.addChild(a);let c=Ki.create({width:t,height:i});r.renderer.render({container:l,target:c,clear:!0});let u=r.renderer.extract.pixels(c).pixels;for(let h=0,d=0;h{let s=null;for(let o of e.items){let n=OL({app:r,texture:o.texture,width:t,height:i,channel:o.channel??"red",invert:o.invert??!1});if(!s){s=n;continue}for(let a=0;a{switch(r){case"green":return new Float32Array([0,1,0,0]);case"blue":return new Float32Array([0,0,1,0]);case"alpha":return new Float32Array([0,0,0,1]);default:return new Float32Array([1,0,0,0])}},jy=lf("red"),Yy=(r,e)=>Ki.create({width:r,height:e,resolution:1}),GL=(r,e)=>{let t=new be({uMaskInvert:{value:e?1:0,type:"f32"},uMaskChannelWeights:{value:r,type:"vec4"}});return{filter:rn.from({gpu:{vertex:{source:vR,entryPoint:"mainVertex"},fragment:{source:vR,entryPoint:"mainFragment"}},gl:{vertex:ER,fragment:BL,name:"replace-mask-channel-filter"},resources:{maskChannelUniforms:t}}),maskChannelUniforms:t}},TR=({app:r,texture:e,width:t,height:i,channelWeights:s,invert:o=!1})=>{let n=k.from(e),a=new Te(n);a.width=t,a.height=i,a.filterArea=new Q(0,0,t,i);let l=new te;l.addChild(a);let c=Yy(t,i),{filter:u}=GL(s,o);return a.filters=[u],r.renderer.render({container:l,target:c,clear:!0}),a.filters=[],l.destroy({children:!0}),u.destroy(),c},LL=(r,e,t)=>{let{canvas:i,context:s}=kL(r,e),o=s.createImageData(r,e),n=o.data;for(let a=0,l=0;a{if(!e)return{textures:[k.WHITE.source],channelWeights:lf("red"),invert:0,destroy:()=>{}};if(e.kind==="single"){let o=TR({app:r,texture:e.texture,width:t,height:i,channelWeights:lf(e.channel??"red"),invert:e.invert??!1});return{textures:[o.source],channelWeights:jy,invert:0,destroy:()=>{o.destroy(!0)}}}if(e.kind==="sequence"){let o=e.textures.map(n=>TR({app:r,texture:n,width:t,height:i,channelWeights:lf(e.channel??"red"),invert:e.invert??!1}));return{textures:o.map(n=>n.source),channelWeights:jy,invert:0,destroy:()=>{for(let n of o)n.destroy(!0)}}}let s=LL(t,i,UL(r,e,t,i));return{textures:[s.source],channelWeights:jy,invert:0,destroy:()=>{s.destroyed||s.destroy(!0)}}},NL=()=>{let r=new be({uProgress:{value:0,type:"f32"},uSoftness:{value:.001,type:"f32"},uMaskMix:{value:0,type:"f32"},uMaskInvert:{value:0,type:"f32"},uMaskChannelWeights:{value:new Float32Array([1,0,0,0]),type:"vec4"},uSecondaryMatrix:{value:new G,type:"mat3x3"},uSecondaryClamp:{value:new Float32Array([0,0,1,1]),type:"vec4"}});return{filter:rn.from({gpu:{vertex:{source:bR,entryPoint:"mainVertex"},fragment:{source:bR,entryPoint:"mainFragment"}},gl:{vertex:ER,fragment:IL,name:"replace-mask-filter"},resources:{replaceMaskUniforms:r,uNextTexture:k.EMPTY.source,uMaskTextureA:k.EMPTY.source,uMaskTextureB:k.EMPTY.source}}),replaceMaskUniforms:r}},HL=({progress:r=0,frameCount:e=0,sampleMode:t="hold"}={})=>{if(e<=1)return{fromIndex:0,toIndex:0,mix:0};let i=qy(r)*Math.max(0,e-1);if(t==="linear"){let o=Math.floor(i),n=Math.min(e-1,o+1);return{fromIndex:o,toIndex:n,mix:i-o}}let s=Math.min(e-1,Math.max(0,Math.round(i)));return{fromIndex:s,toIndex:s,mix:0}},VL=(r,e,t,i,s)=>{let o=RL(e),n=mc([{timeline:o}]),a=Math.max(e?.softness??.001,1e-4),{textures:l,channelWeights:c,invert:u,destroy:h}=DL(r,e,t,i),d=s.resources.replaceMaskUniforms,f=-1,p=-1;return{duration:n,progressTimeline:o,apply:m=>{let g=e?.kind==="sequence"?HL({progress:m,frameCount:l.length,sampleMode:e.sample??"hold"}):{fromIndex:0,toIndex:0,mix:0};g.fromIndex!==f&&(s.resources.uMaskTextureA=l[g.fromIndex]??k.EMPTY.source,f=g.fromIndex),g.toIndex!==p&&(s.resources.uMaskTextureB=l[g.toIndex]??k.EMPTY.source,p=g.toIndex),d.uniforms.uProgress=qy(m),d.uniforms.uSoftness=a,d.uniforms.uMaskMix=g.mix,d.uniforms.uMaskInvert=u,d.uniforms.uMaskChannelWeights=c,d.update()},destroy:h}},WL=(r,e)=>{let t=Math.max(1,r),i=Math.max(1,e);return new Float32Array([.5/t,.5/i,1-.5/t,1-.5/i])},zL=r=>{let e=new te;for(let t of r)t?.wrapper&&e.addChild(t.wrapper);return wR(SR(e))},af=({app:r,container:e,target:t,frame:i})=>{r.renderer.render({container:e,target:t,clear:!0,transform:new G(1,0,0,1,-i.x,-i.y)})},Hs=r=>{r?.wrapper&&!r.wrapper.destroyed&&r.wrapper.destroy({children:!0}),r?.texture?.destroy(!0)},$L=({prevElement:r,nextElement:e,animation:t,prevSubject:i,nextSubject:s})=>{if(!i||!s||r?.id!==e?.id)return{prevSubject:i,nextSubject:s};let o=i,n=s;return t.mask!==void 0&&t.prev===void 0&&t.next===void 0?{prevSubject:o,nextSubject:n}:(t.prev===void 0&&(o=null),t.next===void 0&&(n=null),{prevSubject:o,nextSubject:n})},XL=({app:r,animation:e,prevSubject:t,nextSubject:i,zIndex:s})=>{let o=new te;o.zIndex=s,t?.wrapper&&o.addChild(t.wrapper),i?.wrapper&&o.addChild(i.wrapper);let n=cf(t?.wrapper??null,e.prev?.tween,r),a=cf(i?.wrapper??null,e.next?.tween,r);return{overlay:o,duration:Math.max(n.duration,a.duration),apply:l=>{n.apply(l),a.apply(l)},destroy:()=>{o.removeFromParent(),o.destroy({children:!0}),Hs(t),Hs(i)}}},jL=({app:r,animation:e,prevSubject:t,nextSubject:i,zIndex:s})=>{let o=zL([t,i]),n=new te,a=new te;t?.wrapper&&n.addChild(t.wrapper),i?.wrapper&&a.addChild(i.wrapper);let l=Yy(o.width,o.height),c=Yy(o.width,o.height),u=new te;u.zIndex=s;let h=new Te(l);h.x=o.x,h.y=o.y,h.filterArea=new Q(0,0,o.width,o.height),u.addChild(h);let{filter:d}=NL();d.resources.uNextTexture=c.source,h.filters=[d];let f=WL(o.width,o.height),p=typeof d.apply=="function"?d.apply.bind(d):(T,b,E,w)=>{T.applyFilter(d,b,E,w)};d.apply=(T,b,E,w)=>{let I=d.resources.replaceMaskUniforms;T.calculateSpriteMatrix(I.uniforms.uSecondaryMatrix,h),I.uniforms.uSecondaryClamp=f,I.update(),p(T,b,E,w)};let m=VL(r,e.mask,o.width,o.height,d),g=cf(t?.wrapper??null,e.prev?.tween,r),_=cf(i?.wrapper??null,e.next?.tween,r),v=!1,x=!1;return t?.wrapper||af({app:r,container:n,target:l,frame:o}),i?.wrapper||af({app:r,container:a,target:c,frame:o}),{overlay:u,duration:Math.max(g.duration,_.duration,m.duration),apply:T=>{g.apply(T),_.apply(T),t?.wrapper&&(g.duration>0||!v)&&(af({app:r,container:n,target:l,frame:o}),v=!0),i?.wrapper&&(_.duration>0||!x)&&(af({app:r,container:a,target:c,frame:o}),x=!0);let b=qy(gc(m.progressTimeline,T));m.apply(b)},destroy:()=>{u.removeFromParent(),h.filters=[],d.destroy(),u.destroy({children:!0}),n.destroy({children:!0}),a.destroy({children:!0}),l.destroy(!0),c.destroy(!0),Hs(t),Hs(i),m.destroy()}}},YL=({app:r,animation:e,prevSubject:t,nextSubject:i,zIndex:s})=>e.mask?jL({app:r,animation:e,prevSubject:t,nextSubject:i,zIndex:s}):XL({app:r,animation:e,prevSubject:t,nextSubject:i,zIndex:s}),qL=({app:r,parent:e,nextElement:t,plugin:i,animations:s,eventHandler:o,animationBus:n,completionTracker:a,elementPlugins:l,renderContext:c,zIndex:u,signal:h})=>{if(!t)return null;let d=i.add({app:r,parent:e,element:t,animations:s,eventHandler:o,animationBus:n,completionTracker:a,elementPlugins:l,renderContext:c,zIndex:u,signal:h});return d&&typeof d.then=="function"?d.then(()=>h?.aborted||e.destroyed?null:e.children.find(f=>f.label===t.id)??null):h?.aborted||e.destroyed?null:e.children.find(f=>f.label===t.id)??null},KL=async r=>r&&typeof r.then=="function"?r:r??null,uf=({app:r,parent:e,prevElement:t,nextElement:i,animation:s,animations:o,animationBus:n,completionTracker:a,eventHandler:l,elementPlugins:c,renderContext:u,plugin:h,zIndex:d,signal:f})=>{if(!t&&!i)throw new Error(`Replace animation "${s.id}" must receive prevElement and/or nextElement.`);if(f?.aborted||e.destroyed)return;let p=t?e.children.find(P=>P.label===t.id)??null:null;if(t&&!p)throw new Error(`Transition animation "${s.id}" could not find the previous element "${t.id}".`);let m=p?_R(r,p):null,g=new te,_=Fd({suppressAnimations:!0}),v=a.getVersion(),x=!1,T=()=>{x||(a.track(v),x=!0)},b=()=>{x&&(a.complete(v),x=!1)},E=({flushDeferredEffects:P})=>{if(!B){if(B=!0,w.value&&!w.value.destroyed&&(w.value.visible=!0),I.value?.destroy(),P){fM(_);return}Od(_)}},w={value:null},I={value:null},B=!1;T();let C=P=>{if(f?.aborted||e.destroyed){Od(_),g.destroy({children:!0}),Hs(m),b();return}if(i&&!P)throw Od(_),b(),new Error(`Transition animation "${s.id}" could not create the next element "${i.id}".`);w.value=P;let R=P?_R(r,P):null,M=$L({prevElement:t,nextElement:i,animation:s,prevSubject:m,nextSubject:R});M.prevSubject!==m&&Hs(m),M.nextSubject!==R&&Hs(R),g.destroy({children:!1}),p&&h.delete({app:r,parent:e,element:t,animations:[],animationBus:n,completionTracker:a,eventHandler:l,elementPlugins:c,renderContext:u,signal:f}),P&&(P.zIndex=d,e.addChild(P),P.visible=!1);let F=YL({app:r,animation:s,prevSubject:M.prevSubject,nextSubject:M.nextSubject,zIndex:d});I.value=F,e.addChild(F.overlay),n.dispatch({type:"START",payload:{id:s.id,driver:"custom",duration:F.duration,applyFrame:F.apply,applyTargetState:()=>{E({flushDeferredEffects:!1})},onComplete:()=>{try{E({flushDeferredEffects:!0})}finally{b()}},onCancel:()=>{b()},isValid:()=>!!F.overlay&&!F.overlay.destroyed&&(!P||!P.destroyed)}})},A=i?qL({app:r,parent:g,nextElement:i,plugin:h,animations:o,eventHandler:l,animationBus:n,completionTracker:a,elementPlugins:c,renderContext:_,zIndex:d,signal:f}):null;if(A&&typeof A.then=="function"){KL(A).then(C);return}C(A??null)};var Vs=({app:r,parent:e,prevComputedTree:t,nextComputedTree:i,animations:s,animationBus:o,completionTracker:n,eventHandler:a,elementPlugins:l,renderContext:c=Fd(),signal:u})=>{e.sortableChildren=!0;let h=new Map(l.map(b=>[b.type,b])),d=pM(s),f=new Map,p=new Map;for(let b of t)f.set(b.id,b);for(let b=0;bb.id)),x=b=>{let E=h.get(b);if(!E)throw new Error(`No plugin found for element type: ${b}`);return E},T=b=>e.children.find(E=>E.label===b)?.zIndex??-1;for(let b of i){let E=f.get(b.id);!E||v.has(b.id)||!pe(E,b)||x(b.type).shouldUpdateUnchanged?.({app:r,parent:e,prevElement:E,nextElement:b,animations:d,animationBus:o,completionTracker:n,eventHandler:a,elementPlugins:l,renderContext:c,zIndex:p.get(b.id)??-1,signal:u})!==!0||(_.push({prev:E,next:b}),v.add(b.id))}for(let b of e.children){let E=p.get(b.label);E!==void 0&&(b.zIndex=E)}for(let b of g){let E=c.suppressAnimations?null:Ld(d,b.id),w=x(b.type);if(E){uf({app:r,parent:e,prevElement:b,nextElement:null,animation:E,animations:d,animationBus:o,completionTracker:n,eventHandler:a,elementPlugins:l,renderContext:c,plugin:w,zIndex:T(b.id),signal:u});continue}w.delete({app:r,parent:e,element:b,animations:[],animationBus:o,completionTracker:n,eventHandler:a,elementPlugins:l,renderContext:c,signal:u})}for(let b of m){let E=c.suppressAnimations?null:Ld(d,b.id),w=x(b.type),I=p.get(b.id)??-1;if(E){uf({app:r,parent:e,prevElement:null,nextElement:b,animation:E,animations:d,animationBus:o,completionTracker:n,eventHandler:a,elementPlugins:l,renderContext:c,plugin:w,zIndex:I,signal:u});continue}w.add({app:r,parent:e,element:b,animations:d,eventHandler:a,animationBus:o,completionTracker:n,elementPlugins:l,renderContext:c,zIndex:I,signal:u})}for(let{prev:b,next:E}of _){let w=x(E.type),I=p.get(E.id)??-1,B=c.suppressAnimations?null:Ld(d,E.id);if(B){uf({app:r,parent:e,prevElement:b,nextElement:E,animation:B,animations:d,animationBus:o,completionTracker:n,eventHandler:a,elementPlugins:l,renderContext:c,plugin:w,zIndex:I,signal:u});continue}w.update({app:r,parent:e,prevElement:b,nextElement:E,animations:d,animationBus:o,completionTracker:n,eventHandler:a,elementPlugins:l,renderContext:c,zIndex:I,signal:u})}};var ZL=(r=[])=>{let e=new Set;for(let t of r)if(t?.id){if(e.has(t.id))return!0;e.add(t.id)}return!1},QL=({app:r,container:e,children:t,eventHandler:i,animationBus:s,elementPlugins:o,renderContext:n,completionTracker:a,signal:l})=>{for(let c of t){let u=o.find(h=>h.type===c.type);if(!u)throw new Error(`No plugin found for child element type: ${c.type}`);u.add({app:r,parent:e,element:c,animations:[],eventHandler:i,animationBus:s,elementPlugins:o,renderContext:n,completionTracker:a,signal:l})}},AR=({app:r,parent:e,element:t,animations:i,eventHandler:s,animationBus:o,elementPlugins:n,renderContext:a,zIndex:l,completionTracker:c,signal:u})=>{let{id:h,x:d,y:f,children:p,scroll:m,alpha:g}=t,_=new te;_.label=h,_.zIndex=l,_.x=Math.round(d),_.y=Math.round(f),_.alpha=g,e.addChild(_),p&&p.length>0&&(ZL(p)?QL({app:r,container:_,children:p,eventHandler:s,animationBus:o,elementPlugins:n,renderContext:a,completionTracker:c,signal:u}):Vs({app:r,parent:_,prevComputedTree:[],nextComputedTree:p,animations:i,animationBus:o,completionTracker:c,eventHandler:s,elementPlugins:n,renderContext:a,signal:u})),(m||t.anchorToBottom)&&fc({container:_,element:t,interactive:!!m,allowViewportWithoutScroll:!!t.anchorToBottom}),sf({app:r,container:_,element:t,eventHandler:s})};var PR=({app:r,parent:e,prevElement:t,nextElement:i,eventHandler:s,animations:o,animationBus:n,elementPlugins:a,renderContext:l,zIndex:c,completionTracker:u,signal:h})=>{let d=e.children.find(v=>v.label===t.id);if(!d)return;d.zIndex=c;let{x:f,y:p,alpha:m}=i,g=()=>{if(!pe(t,i)){d.x=Math.round(f),d.y=Math.round(p),d.label=i.id,d.alpha=m,d.scale.x=1,d.scale.y=1;let b=t.scroll||t.anchorToBottom,E=i.scroll||i.anchorToBottom,w=E?dR({container:d}):null;b!==E?E?fc({container:d,element:i,interactive:!!i.scroll,allowViewportWithoutScroll:!!i.anchorToBottom,previousState:w}):$y({container:d}):E&&($y({container:d}),fc({container:d,element:i,interactive:!!i.scroll,allowViewportWithoutScroll:!!i.anchorToBottom,previousState:w})),sf({app:r,container:d,element:i,eventHandler:s})}let v=!pe(t.children,i.children),x=pc({children:i.children}),T=Array.from(x).some(b=>Gd(o,b).length>0);if(v||T){let E=d.children.find(w=>w.label===`${i.id}-content`)||d;Vs({app:r,parent:E,nextComputedTree:i.children,prevComputedTree:t.children,eventHandler:s,elementPlugins:a,animations:o,animationBus:n,completionTracker:u,renderContext:l,signal:h}),pR({container:d}),mR({container:d}),gR({container:d})}};ne({animations:o,targetId:t.id,animationBus:n,completionTracker:u,element:d,targetState:{x:f,y:p,alpha:m},onComplete:()=>{g()}})||g()};var CR=({app:r,parent:e,element:t,animationBus:i,animations:s,eventHandler:o,completionTracker:n})=>{let a=e.getChildByLabel(t.id);if(!a)return;let l=()=>{a&&!a.destroyed&&(e.removeChild(a),a.destroy({children:!0}))};ne({animations:s,targetId:t.id,animationBus:i,completionTracker:n,element:a,targetState:null,onComplete:l})||l()};var MR=({state:r,parserPlugins:e=[]})=>{let t=r.direction??"",i=!!r.scroll,s=r.gapX??0,o=r.gapY??0,n=structuredClone(r.children||[]),a=[];if(r.gap!==void 0)throw new Error("Input Error: container.gap is no longer supported. Use gapX and gapY.");let l=0,c=0,u=0,h=0,d=0,f=0,p=0,m=0,g=0,_=0;for(let T=0;T0?t==="horizontal"?(b.x=u,b.y=p):t==="vertical"&&(b.x=m,b.y=h):(t==="horizontal"||t==="vertical")&&(b.x=0,b.y=0);let E=e.find(w=>w.type===b.type);if(E){let w=b.scaleX!==void 0||r.scaleX!==void 0,I=b.scaleY!==void 0||r.scaleY!==void 0,B=(b.scaleX??1)*(r.scaleX??1),C=(b.scaleY??1)*(r.scaleY??1);b=E.parse({state:{...b,...w?{scaleX:B}:{},...I?{scaleY:C}:{}},parserPlugins:e})}if(t==="horizontal"){let w=Tr.width&&!i&&!r.anchorToBottom?(u=0,g=0,p+=d+o,d=b.height,b.x=0,b.y=p):d=Math.max(d,b.height),u+=b.width+w,g=b.x+b.width,l=Math.max(u,l),c=Math.max(b.height+b.y,c)}else if(t==="vertical"){let w=Tr.height&&!i&&!r.anchorToBottom?(h=0,_=0,m+=f+s,f=b.width,b.x=m,b.y=0):f=Math.max(f,b.width),h+=b.height+w,_=b.y+b.height,l=Math.max(b.width+b.x,l),c=Math.max(h,c)}else l=Math.max(b.width+b.x,l),c=Math.max(b.height+b.y,c);a.push(b)}let x={...yt({...r,width:r.width?r.width:l,height:r.height?r.height:c}),children:a,direction:t,gapX:s,gapY:o,scroll:i,...r.anchorToBottom&&{anchorToBottom:!0},...r.scrollbar&&{scrollbar:structuredClone(r.scrollbar)},rotation:r.rotation??0};return r.rightClick&&(x.rightClick=r.rightClick),x};var JL=et({type:"container",add:AR,update:PR,delete:CR,parse:MR});var RR=async({parent:r,element:e,animationBus:t,renderContext:i,completionTracker:s,zIndex:o,signal:n})=>{if(n?.aborted)return;let a=new te;if(a.label=e.id,a.zIndex=o,e.x!==void 0&&(a.x=Math.round(e.x)),e.y!==void 0&&(a.y=Math.round(e.y)),e.alpha!==void 0&&(a.alpha=e.alpha),r.addChild(a),i?.suppressAnimations&&!_n(e)){await Ti({container:a,element:e,completionTracker:s,animationBus:t,zIndex:o,signal:n,playback:"paused-initial"}),Ud(i,{container:a,element:e,completionTracker:s,animationBus:t,zIndex:o,signal:n});return}await Ti({container:a,element:e,completionTracker:s,animationBus:t,zIndex:o,signal:n,playback:"autoplay"})};var IR=(r={})=>JSON.stringify({content:r.content??null,revealEffect:r.revealEffect??"typewriter",speed:r.speed??50,width:r.width??null,indicator:r.indicator??null,x:r.x??null,y:r.y??null,alpha:r.alpha??1}),eD=(r,e)=>IR(r)!==IR(e),BR=async({parent:r,prevElement:e,nextElement:t,animations:i,animationBus:s,renderContext:o,completionTracker:n,zIndex:a,signal:l})=>{if(l?.aborted)return;let c=r.children.find(d=>d.label===e.id);if(!c)return;let u=async()=>{if(t.x!==void 0&&(c.x=t.x),t.y!==void 0&&(c.y=t.y),t.alpha!==void 0&&(c.alpha=t.alpha),!eD(e,t)){o?.suppressAnimations!==!0&&!_n(t)&&await Ti({container:c,element:t,completionTracker:n,animationBus:s,zIndex:a,signal:l,playback:"resume"});return}if(o?.suppressAnimations===!0&&!_n(t)){await Ti({container:c,element:t,completionTracker:n,animationBus:s,zIndex:a,signal:l,playback:"paused-initial"}),Ud(o,{container:c,element:t,completionTracker:n,animationBus:s,zIndex:a,signal:l});return}await Ti({container:c,element:t,completionTracker:n,animationBus:s,zIndex:a,signal:l,playback:"autoplay"})};ne({animations:i,targetId:e.id,animationBus:s,completionTracker:n,element:c,targetState:{x:t.x??c.x,y:t.y??c.y,alpha:t.alpha??c.alpha},onComplete:()=>{u()}})||await u()};var kR=({parent:r,element:e,animations:t,animationBus:i,completionTracker:s})=>{let o=r.getChildByLabel(e.id);if(!o||o.destroyed)return;let n=()=>{o&&!o.destroyed&&(Py(o),o.destroy({children:!0}))};ne({animations:t,targetId:e.id,animationBus:i,completionTracker:s,element:o,targetState:null,onComplete:n})||n()};var tD=r=>r===` `||r==="\r",rD=r=>typeof r=="string"&&De.isBreakingSpace(r),iD=(r,e,t)=>{let i=0,s=0;for(;i{let t=[],i=[],s=0,o=0,n=0,a=0,l=0,c=[...r],u=new WeakSet,h=Math.max(10,r.reduce((p,m)=>p+(m?.text?.length??0),0)*4),d=()=>{t.push({lineParts:[...i],y:o,lineMaxHeight:n}),s=0,o+=n,n=0,i=[]};for(;c.length>0;){if(l+=1,l>h)throw new Error("[parseTextRevealing] Failed to make progress while wrapping text.");let p=c[0];if(!p.text||p.text.length===0){c.shift();continue}let m=p.text,g=Math.max(1,Math.round(e-s)),_={...p.textStyle,wordWrapWidth:g},v=De.measureText(p.text,new Oe(ir(_)));if(v.lineWidths[0]>g&&i.length>0){d();continue}let x=v.lines[0]??"",T=v.lines.length>1,b="",w=!1;if(v.lines.length===1&&p.text.endsWith(" ")&&!x.endsWith(" ")&&(x+=" "),x.length>0){let C=iD(m,x,T);b=C.remainingText,w=C.consumedExplicitNewline}if(x.length===0&&m.length>0){let C=m.match(/^\s+/)?.[0]??"";x=C.length>0?C:m[0],b=m.slice(x.length)}if(b===m){let C=m.match(/^\s+/)?.[0]??m[0]??"";if(C.length===0)throw new Error("[parseTextRevealing] Failed to consume text while wrapping.");x=C,b=m.slice(C.length)}let E=De.measureText(x,new Oe({...ir(p.textStyle),wordWrap:!1,breakWords:!1})),I=Math.max(0,Math.round(E.width??v.lineWidths[0]??0)),B={text:x,textStyle:_,height:E.height,x:s,y:o};if(p.furigana&&!u.has(p)){u.add(p);let C=De.measureText(p.furigana.text,new Oe(ir(p.furigana.textStyle))),A=-C.height+o+2,P={text:p.furigana.text,textStyle:p.furigana.textStyle,x:Math.round(s+(I-C.width)/2),y:A};B.furigana=P}i.push(B),n=Math.max(n,E.height),s+=I,a=Math.max(a,s),b&&b.length>0?p.text=b:c.shift(),(T||w)&&s>0&&d()}i.length>0&&t.push({lineParts:i,y:o,lineMaxHeight:n});for(let p=0;p{let _=g.height;g.height&&delete g.height;let v=g.y+(m-_),x=g.furigana;return x&&(x.y=x.y-g.y+v),{...g,...x&&{furigana:x},y:v}})}let f=t.length>0?t[t.length-1].y+t[t.length-1].lineMaxHeight:0;return{chunks:t,width:Math.max(a,e),height:f}},FR=({state:r})=>{let e={...Ge,wordWrap:!0,...r.textStyle||{}},t=(r.content||[]).map(u=>{let h={...e,...u.textStyle||{}};h.lineHeight=Math.round(h.lineHeight*h.fontSize),r.width&&(h.wordWrapWidth=r.width,h.wordWrap=!0);let d=null;if(u.furigana){let p={...e,...u.furigana.textStyle||{}};p.lineHeight=Math.round(p.lineHeight*p.fontSize),r.width&&(p.wordWrapWidth=r.width,p.wordWrap=!0),d={text:String(u.furigana.text),textStyle:p}}return{text:String(u.text).replace(/ +$/,p=>"\xA0".repeat(p.length)),textStyle:h,...d&&{furigana:d}}}),i=r.width||500,{chunks:s,width:o,height:n}=sD(t,i),a=r.width||o,c=yt({...r,width:a,height:n});if(c.alpha=r.alpha??1,r.indicator){let u=r.indicator;c.indicator={revealing:{src:u.revealing?.src??"",width:u.revealing?.width??12,height:u.revealing?.height??12},complete:{src:u.complete?.src??"",width:u.complete?.width??12,height:u.complete?.height??12},offset:u.offset??12}}return{...c,content:s,textStyle:{...e,...r.textStyle||{}},speed:r.speed??50,revealEffect:r.revealEffect??"typewriter",...r.width!==void 0&&{width:r.width},...r.complete&&{complete:r.complete}}};var oD=et({type:"text-revealing",add:RR,update:BR,delete:kR,parse:FR,shouldUpdateUnchanged:({parent:r,nextElement:e})=>oM(r.children.find(t=>t.label===e.id))});var hf=(r,e,t,i)=>{if(!t)return;let s=o=>{o?.detail?.elementId===e&&typeof o?.detail?.frameIndex=="number"&&(r.gotoAndStop(o?.detail?.frameIndex),i?.())};window.addEventListener("snapShotAnimatedSpriteFrame",s),r._snapShotKeyFrameHandler=s},df=r=>{r._snapShotKeyFrameHandler&&(window.removeEventListener("snapShotAnimatedSpriteFrame",r._snapShotKeyFrameHandler),delete r._snapShotKeyFrameHandler)};var OR=(r={})=>{if(r.frame){let n=r.frame.w??0,a=r.frame.h??0,l=r.sourceSize?.w??n,c=r.sourceSize?.h??a,u={frame:{x:r.frame.x??0,y:r.frame.y??0,w:n,h:a},rotated:r.rotated??!1,trimmed:r.trimmed??!1,spriteSourceSize:{x:r.spriteSourceSize?.x??0,y:r.spriteSourceSize?.y??0,w:r.spriteSourceSize?.w??n,h:r.spriteSourceSize?.h??a},sourceSize:{w:l,h:c}};return r.anchor?u.anchor={x:r.anchor.x??0,y:r.anchor.y??0}:r.pivot&&(u.anchor={x:r.pivot.x??0,y:r.pivot.y??0}),r.borders&&(u.borders={...r.borders}),u}let e=r.width??r.w??0,t=r.height??r.h??0,i=r.sourceWidth??e,s=r.sourceHeight??t,o={frame:{x:r.x??0,y:r.y??0,w:e,h:t},rotated:r.rotated??!1,trimmed:r.trimmed??!1,spriteSourceSize:{x:r.offsetX??0,y:r.offsetY??0,w:e,h:t},sourceSize:{w:i,h:s}};return r.anchor?o.anchor={x:r.anchor.x??0,y:r.anchor.y??0}:r.pivot&&(o.anchor={x:r.pivot.x??0,y:r.pivot.y??0}),r.borders&&(o.borders={...r.borders}),o},Ky=(r={})=>!r||typeof r!="object"?{}:Object.fromEntries(Object.entries(r).map(([e,t])=>[e,Array.isArray(t)?t.map(i=>String(i)):[]])),nD=(r,e={})=>{let t=Math.max(0,Number(e.from??0)),i=Math.min(r.length-1,Number(e.to??t));if(!Number.isFinite(t)||!Number.isFinite(i)||i!Array.isArray(r)||e.length===0?{}:Object.fromEntries(r.map(t=>{let i=typeof t?.name=="string"?t.name:"";return i?[i,nD(e,t)]:null}).filter(Boolean)),Rn=(r={})=>{let e=r??{},t=Ky(e.animations);return{frames:Array.isArray(e.frames)?Object.fromEntries(e.frames.map(s=>{let o=s?.filename??s?.name;return typeof o!="string"||o.length===0?null:[o,OR(s)]}).filter(Boolean)):Object.fromEntries(Object.entries(e.frames??{}).map(([s,o])=>[s,OR(o)])),...Object.keys(t).length>0?{animations:t}:{},meta:{...e.meta??{},scale:String(e.scale??e.meta?.scale??1),...e.width!=null||e.height!=null?{size:{w:e.width??e.meta?.size?.w??0,h:e.height??e.meta?.size?.h??0}}:{}}}},In=(r={},e={},t={},i=[])=>({...aD(t?.frameTags,i),...Ky(e),...Ky(r)}),lD=(r,e)=>{if(!Array.isArray(e?.frames))return[];let t=Object.keys(r.frames??{});return e.frames.map(i=>typeof i=="number"?t[i]:String(i)).filter(Boolean)},Ws=({atlas:r={frames:{}},clips:e={},playback:t,legacyAnimation:i})=>{let s=t??i??{},o={fps:s.fps??null,loop:s.loop??!0,autoplay:s.autoplay??!0};return typeof s.clip=="string"&&s.clip.length>0&&(o.clip=s.clip),Array.isArray(s.frames)?o.frames=s.frames.map(n=>typeof n=="number"?Object.keys(r.frames??{})[n]:String(n)).filter(Boolean):o.clip||(o.frames=lD(r,i)),o.fps==null&&(typeof s.animationSpeed=="number"?o.fps=s.animationSpeed*60:o.fps=30),o.clip&&(!Array.isArray(o.frames)||o.frames.length===0)&&(o.frames=Array.isArray(e[o.clip])?[...e[o.clip]]:[]),Array.isArray(o.frames)||(o.frames=[]),o},ff=({spritesheet:r,atlas:e,clips:t={},playback:i,legacyAnimation:s})=>{let o=Ws({atlas:e,clips:t,playback:i,legacyAnimation:s});return{frameTextures:o.frames.map(a=>r.textures[a]),playback:o}},pf=r=>typeof r=="number"?r/60:.5;var UR=async({app:r,parent:e,element:t,renderContext:i,completionTracker:s,zIndex:o,signal:n})=>{if(n?.aborted)return;let{id:a,x:l,y:c,width:u,height:h,src:d,atlas:f,clips:p,playback:m,alpha:g}=t,_=Rn(f),v=In(p,f?.animations,f?.meta,Object.keys(_.frames??{})),x=Ws({atlas:_,clips:v,playback:m}),T=s?.getVersion?.();s?.track?.(T);try{let b=new Ni(k.from(d),_);if(await b.parse(),n?.aborted||e.destroyed)return;let{frameTextures:w}=ff({spritesheet:b,atlas:_,clips:v,playback:x}),E=new nc(w);E.label=a,E.zIndex=o,E.animationSpeed=pf(x.fps),E.loop=x.loop,r.debug?hf(E,a,r.debug,()=>{typeof r.render=="function"&&r.render()}):x.autoplay&&cM(i,E),E.x=Math.round(l),E.y=Math.round(c),E.width=Math.round(u),E.height=Math.round(h),E.alpha=g,e.addChild(E),typeof r.render=="function"&&r.render()}finally{s?.complete?.(T)}};var GR=async({app:r,parent:e,prevElement:t,nextElement:i,animations:s,animationBus:o,completionTracker:n,zIndex:a,signal:l})=>{if(l?.aborted)return;let c=e.children.find(_=>_.label===t.id);if(!c)return;c.zIndex=a;let u=async()=>{if(!(l?.aborted||c.destroyed)&&!pe(t,i)){let _=i.src,v=Rn(i.atlas),x=In(i.clips,i.atlas?.animations,i.atlas?.meta,Object.keys(v.frames??{})),T=Ws({atlas:v,clips:x,playback:i.playback});c.x=Math.round(i.x),c.y=Math.round(i.y),c.width=Math.round(i.width),c.height=Math.round(i.height),c.alpha=i.alpha;let b=!pe(t.playback,i.playback),w=!pe(t.clips,i.clips),E=t.src!==_||!pe(t.atlas,i.atlas);if(c.animationSpeed=pf(T.fps),c.loop=T.loop,b||w||E){let I=n?.getVersion?.();n?.track?.(I);try{let B=new Ni(k.from(_),v);if(await B.parse(),l?.aborted||c.destroyed)return;let{frameTextures:C}=ff({spritesheet:B,atlas:v,clips:x,playback:T});c.textures=C,typeof r.render=="function"&&r.render(),!r.debug&&T.autoplay?c.play():(r.debug||c.stop?.(),t.id!==i.id&&(df(c),hf(c,i.id,r.debug,()=>{typeof r.render=="function"&&r.render()})))}finally{n?.complete?.(I)}}}},{x:h,y:d,width:f,height:p,alpha:m}=i;ne({animations:s,targetId:t.id,animationBus:o,completionTracker:n,element:c,targetState:{x:h,y:d,width:f,height:p,alpha:m},onComplete:()=>{u()}})||await u()};var LR=({app:r,parent:e,element:t,animations:i,animationBus:s,completionTracker:o})=>{let n=e.children.find(c=>c.label===t.id);if(!n)return;let a=()=>{r.debug&&df(n),n&&!n.destroyed&&(n.stop(),n.destroy())};ne({animations:i,targetId:t.id,animationBus:s,completionTracker:o,element:n,targetState:null,onComplete:a})||a()};var DR=({state:r})=>{let e=yt(r),t=r.atlas,i=Rn(t),s=In(r.clips,t?.animations,t?.meta,Object.keys(i.frames??{})),o=Ws({atlas:i,clips:s,playback:r.playback});return{...e,type:"spritesheet-animation",src:r.src??"",atlas:i,clips:s,playback:o,alpha:r.alpha??1}};var NR=et({type:"spritesheet-animation",add:UR,update:GR,delete:LR,parse:DR}),cD=NR;var uD=vy({type:"tween"});var zs=new Map,hD=r=>({id:r.id,url:r.src,loop:r.loop??!1,volume:We(r.volume,80)}),HR=r=>zs.has(r),xc=r=>{let e=zs.get(r);e!==void 0&&(clearTimeout(e),zs.delete(r))},Zy=({app:r,element:e})=>{let t=hD(e);if(xc(t.id),e.delay&&e.delay>0){let i=setTimeout(()=>{zs.delete(t.id),r.audioStage.add(t)},e.delay);zs.set(t.id,i);return}r.audioStage.add(t)},Qy=()=>{for(let r of zs.values())clearTimeout(r);zs.clear()},VR=({app:r,element:e})=>{Zy({app:r,element:e})};var WR=({app:r,prevElement:e,nextElement:t})=>{let i=e.id;if((t.delay??0)>0){r.audioStage.remove(i),Zy({app:r,element:t});return}if(HR(i)){xc(i),r.audioStage.add({id:i,url:t.src,loop:t.loop??!1,volume:We(t.volume,80)});return}let o=r.audioStage.getById(i);if(!o){r.audioStage.add({id:i,url:t.src,loop:t.loop??!1,volume:We(t.volume,80)});return}o.url=t.src,o.loop=t.loop??!1,o.volume=We(t.volume,80)};var zR=({app:r,element:e})=>{xc(e.id),r.audioStage.remove(e.id)};var dD=Ty({type:"sound",add:VR,update:WR,delete:zR});var yc=class extends Te{emitter=null;maxLife=0;age=0;oneOverLife=0;get agePercent(){return this.age*this.oneOverLife}velocity={x:0,y:0};rotationSpeed=0;config={};next=null;prev=null;constructor(e){super(),this.emitter=e,this.anchor.set(.5,.5)}init(e){this.maxLife=e,this.age=0,this.oneOverLife=1/e,this.rotation=0,this.position.set(0,0),this.scale.set(1,1),this.tint=16777215,this.alpha=1,this.visible=!0,this.velocity.x=0,this.velocity.y=0,this.rotationSpeed=0,this.config={}}kill(){this.emitter.recycle(this)}destroy(){this.parent&&this.parent.removeChild(this),this.emitter=null,this.next=null,this.prev=null,super.destroy()}};function Jy(r){let e=new Ue;return e.circle(0,0,3),e.fill({color:16777215}),r.renderer.generateTexture(e)}function e_(r){let e=new Ue;return e.rect(0,0,1,8),e.fill({color:8965375}),r.renderer.generateTexture(e)}function t_(r){let e=new Ue;return e.circle(0,0,4),e.fill({color:16777215}),r.renderer.generateTexture(e)}function _c(r,e,t){return r+(e-r)*t}function gf(r){if(typeof r=="number")return r;let e=r.replace(/^(#|0x)/,"");return parseInt(e,16)}function $R(r,e,t){let i=r>>16&255,s=r>>8&255,o=r&255,n=e>>16&255,a=e>>8&255,l=e&255,c=Math.round(_c(i,n,t)),u=Math.round(_c(s,a,t)),h=Math.round(_c(o,l,t));return c<<16|u<<8|h}var mf=class r{constructor(e,t,i=!1){this.value=i?gf(e):e,this.time=t,this.next=null}static createList(e,t=!1){let i=[...e].sort((n,a)=>n.time-a.time),s=new r(i[0].value,i[0].time,t),o=s;for(let n=1;n=t.next.time)return t.next?t.next.value:t.value;let i=(e-t.time)/(t.next.time-t.time);return this.isColor?$R(t.value,t.next.value,i):_c(t.value,t.next.value,i)}};var xf=class{static type="alpha";constructor(e){this.list=new kr(!1),this.list.reset(e.list)}initParticles(e){let t=e,i=this.list.getValue(0);for(;t;)t.alpha=i,t=t.next}updateParticle(e,t){e.alpha=this.list.getValue(e.agePercent)}},yf=class{static type="alphaStatic";constructor(e){this.alpha=e.alpha}initParticles(e){let t=e;for(;t;)t.alpha=this.alpha,t=t.next}updateParticle(e,t){}};function XR(r,e,t){return Math.min(Math.max(r,e),t)}function Bt(r,e){if(typeof e=="number")return e;let t=e.min,i=e.max??e.min;if(t===i)return t;let s=e.distribution;return!s||s.kind==="uniform"?t+r()*(i-t):s.kind==="bias"?t+fD(r,s)*(i-t):s.kind==="normal"?pD(r,t,i,s):t+r()*(i-t)}function fD(r,e){let t=e.toward??"min",i=XR(e.strength??.5,0,1),s=1+i*4;if(t==="max")return 1-Math.pow(1-r(),s);if(t==="center"){let o=(r()+r())/2;return r()*(1-i)+o*i}return Math.pow(r(),s)}function pD(r,e,t,i){let s=i.mean??(e+t)/2,o=i.deviation??(t-e)/6,n=Math.max(r(),1e-7),a=r(),l=Math.sqrt(-2*Math.log(n))*Math.cos(2*Math.PI*a);return XR(s+l*o,e,t)}var _f=class{static type="scale";constructor(e){this.list=new kr(!1),this.list.reset(e.list),this.minMult=e.minMult??1}initParticles(e){let t=e;for(;t;){let i=this.minMult<1?t.emitter.random()*(1-this.minMult)+this.minMult:1;t.config.scaleMult=i;let s=this.list.getValue(0)*i;t.scale.set(s,s),t=t.next}}updateParticle(e,t){let i=this.list.getValue(e.agePercent)*e.config.scaleMult;e.scale.set(i,i)}},bf=class{static type="scaleStatic";constructor(e){this.min=e.min,this.max=e.max,this.distribution=e.distribution}initParticles(e){let t=e;for(;t;){let i=Bt(t.emitter.random.bind(t.emitter),{min:this.min,max:this.max,distribution:this.distribution});t.scale.set(i,i),t=t.next}}updateParticle(e,t){}};var mD=Math.PI/180,vf=class{static type="speed";constructor(e){this.list=new kr(!1),this.list.reset(e.list),this.minMult=e.minMult??1}initParticles(e){let t=e;for(;t;){let i=this.minMult<1?t.emitter.random()*(1-this.minMult)+this.minMult:1;t.config.speedMult=i;let s=this.list.getValue(0)*i;t.velocity.x=Math.cos(t.rotation)*s,t.velocity.y=Math.sin(t.rotation)*s,t=t.next}}updateParticle(e,t){let i=this.list.getValue(e.agePercent)*e.config.speedMult,s=Math.sqrt(e.velocity.x*e.velocity.x+e.velocity.y*e.velocity.y);s>0&&(e.velocity.x=e.velocity.x/s*i,e.velocity.y=e.velocity.y/s*i),e.x+=e.velocity.x*t,e.y+=e.velocity.y*t}},Tf=class{static type="speedStatic";constructor(e){this.min=e.min,this.max=e.max,this.distribution=e.distribution}initParticles(e){let t=e;for(;t;){let i=Bt(t.emitter.random.bind(t.emitter),{min:this.min,max:this.max,distribution:this.distribution});t.velocity.x=Math.cos(t.rotation)*i,t.velocity.y=Math.sin(t.rotation)*i,t=t.next}}updateParticle(e,t){e.x+=e.velocity.x*t,e.y+=e.velocity.y*t}},Sf=class{static type="movePoint";constructor(e){this.speed={min:e.speed.min,max:e.speed.max??e.speed.min,distribution:e.speed.distribution},this.direction=e.direction}initParticles(e){let t=e;for(;t;){let i=Bt(t.emitter.random.bind(t.emitter),this.speed),s=Bt(t.emitter.random.bind(t.emitter),this.direction)*mD;t.velocity.x=Math.cos(s)*i,t.velocity.y=Math.sin(s)*i,t=t.next}}updateParticle(e,t){e.x+=e.velocity.x*t,e.y+=e.velocity.y*t}};var tye=Math.PI/180,wf=class{static type="acceleration";constructor(e){this.accelX=e.accel.x,this.accelY=e.accel.y,this.minStart=e.minStart,this.maxStart=e.maxStart,this.rotate=e.rotate??!1,this.maxSpeed=e.maxSpeed??0}initParticles(e){let t=e;for(;t;){let i=t.emitter.random()*(this.maxStart-this.minStart)+this.minStart;t.velocity.x=Math.cos(t.rotation)*i,t.velocity.y=Math.sin(t.rotation)*i,t=t.next}}updateParticle(e,t){let i=e.velocity,s=i.x,o=i.y;if(i.x+=this.accelX*t,i.y+=this.accelY*t,this.maxSpeed>0){let n=Math.sqrt(i.x*i.x+i.y*i.y);if(n>this.maxSpeed){let a=this.maxSpeed/n;i.x*=a,i.y*=a}}e.x+=(s+i.x)/2*t,e.y+=(o+i.y)/2*t,this.rotate&&(e.rotation=Math.atan2(i.y,i.x))}},Ef=class{static type="gravity";constructor(e){this.gravity=e.gravity}initParticles(e){}updateParticle(e,t){e.velocity.y+=this.gravity*t,e.x+=e.velocity.x*t,e.y+=e.velocity.y*t}};var bc=Math.PI/180,Af=class{static type="rotation";constructor(e){this.startRange={min:e.minStart,max:e.maxStart??e.minStart,distribution:e.startDistribution},this.speedRange={min:e.minSpeed,max:e.maxSpeed??e.minSpeed,distribution:e.speedDistribution},this.accel=(e.accel??0)*bc}initParticles(e){let t=e;for(;t;)t.rotation=Bt(t.emitter.random.bind(t.emitter),this.startRange)*bc,t.rotationSpeed=Bt(t.emitter.random.bind(t.emitter),this.speedRange)*bc,t=t.next}updateParticle(e,t){if(this.accel!==0){let i=e.rotationSpeed;e.rotationSpeed+=this.accel*t,e.rotation+=(i+e.rotationSpeed)/2*t}else e.rotation+=e.rotationSpeed*t}},Pf=class{static type="rotationStatic";constructor(e){this.range={min:e.min,max:e.max??e.min,distribution:e.distribution}}initParticles(e){let t=e;for(;t;)t.rotation=Bt(t.emitter.random.bind(t.emitter),this.range)*bc,t=t.next}updateParticle(e,t){}},Cf=class{static type="noRotation";constructor(e){this.rotation=(e.rotation??0)*bc}initParticles(e){let t=e;for(;t;)t.rotation=this.rotation,t=t.next}updateParticle(e,t){e.rotation=this.rotation}};var Mf=class{static type="color";constructor(e){this.list=new kr(!0),this.list.reset(e.list)}initParticles(e){let t=e,i=this.list.getValue(0);for(;t;)t.tint=i,t=t.next}updateParticle(e,t){e.tint=this.list.getValue(e.agePercent)}},Rf=class{static type="colorStatic";constructor(e){this.color=gf(e.color)}initParticles(e){let t=e;for(;t;)t.tint=this.color,t=t.next}updateParticle(e,t){}};var If=class{constructor(e){this.x=e.x,this.y=e.y,this.w=e.w,this.h=e.h}getRandPos(e,t){e.x=this.x+t.random()*this.w,e.y=this.y+t.random()*this.h}},Bf=class{constructor(e){this.x=e.x,this.y=e.y,this.radius=e.radius,this.innerRadius=e.innerRadius??0,this.affectRotation=e.affectRotation??!1}getRandPos(e,t){let i=t.random()*Math.PI*2,s=this.radius-this.innerRadius,o=t.random()*s+this.innerRadius;e.x=this.x+Math.cos(i)*o,e.y=this.y+Math.sin(i)*o,this.affectRotation&&(e.rotation=i)}},r_=class{constructor(e){this.x=e.x,this.y=e.y}getRandPos(e,t){e.x=this.x,e.y=this.y}},i_=class{constructor(e){this.x1=e.x1,this.y1=e.y1,this.x2=e.x2,this.y2=e.y2}getRandPos(e,t){let i=t.random();e.x=this.x1+(this.x2-this.x1)*i,e.y=this.y1+(this.y2-this.y1)*i}},gD={rect:If,rectangle:If,torus:Bf,circle:Bf,point:r_,line:i_};var kf=class{static type="spawnShape";constructor(e){let t=gD[e.type];if(!t)throw new Error(`Unknown spawn shape type: ${e.type}`);this.shape=new t(e.data)}initParticles(e){let t=e,i={x:0,y:0,rotation:void 0};for(;t;)this.shape.getRandPos(i,t.emitter),t.x=i.x,t.y=i.y,i.rotation!==void 0&&(t.rotation=i.rotation),t=t.next}updateParticle(e,t){}},Ff=class{static type="spawnBurst";constructor(e){this.x=e.x,this.y=e.y,this.spacing=(e.spacing??0)*Math.PI/180,this.startAngle=(e.startAngle??0)*Math.PI/180}initParticles(e){let t=e,i=this.startAngle;for(;t;)t.x=this.x,t.y=this.y,t.rotation=i,i+=this.spacing,t=t.next}updateParticle(e,t){}};var jR=Math.PI/180,Of=class{static type="movement";constructor(e={}){this.velocity=e.velocity??null,this.accelX=e.acceleration?.x??0,this.accelY=e.acceleration?.y??0,this.maxSpeed=e.maxSpeed??0,this.faceVelocity=e.faceVelocity??!1}initParticles(e){let t=e;for(;t;){if(this.velocity){let i=this.#t(t.emitter.random.bind(t.emitter)),s=Bt(t.emitter.random.bind(t.emitter),this.velocity.speed);t.velocity.x=Math.cos(i)*s,t.velocity.y=Math.sin(i)*s,this.faceVelocity&&s>0&&(t.rotation=i)}t=t.next}}updateParticle(e,t){let i=e.velocity;if(this.accelX!==0||this.accelY!==0){let o=i.x,n=i.y;i.x+=this.accelX*t,i.y+=this.accelY*t,this.#e(i),e.x+=(o+i.x)/2*t,e.y+=(n+i.y)/2*t}else this.#e(i),e.x+=i.x*t,e.y+=i.y*t;this.faceVelocity&&Math.sqrt(i.x*i.x+i.y*i.y)>0&&(e.rotation=Math.atan2(i.y,i.x))}#t(e){return this.velocity?this.velocity.kind==="radial"?Bt(e,this.velocity.angle??{min:0,max:360})*jR:Bt(e,this.velocity.direction??0)*jR:0}#e(e){if(this.maxSpeed<=0)return;let t=Math.sqrt(e.x*e.x+e.y*e.y);if(t>this.maxSpeed&&t>0){let i=this.maxSpeed/t;e.x*=i,e.y*=i}}};var YR=new Map,qR=new Map;function s_(r,e){YR.set(r,e)}function Et(r){qR.set(r.type,r)}function KR(r,e){let t=YR.get(r);return t?t(e):null}function ZR(r){return qR.get(r)}s_("circle",t_);s_("snowflake",Jy);s_("raindrop",e_);Et(xf);Et(yf);Et(_f);Et(bf);Et(vf);Et(Tf);Et(Sf);Et(wf);Et(Ef);Et(Af);Et(Pf);Et(Cf);Et(Mf);Et(Rf);Et(kf);Et(Ff);Et(Of);var Uf=class{constructor(e){this.seed=e,this.state=e}next(){let e=this.state+=1831565813;return e=Math.imul(e^e>>>15,e|1),e^=e+Math.imul(e^e>>>7,e|61),((e^e>>>14)>>>0)/4294967296}reset(){this.state=this.seed}};function xD(r){return typeof r=="object"&&r!==null&&!Array.isArray(r)&&typeof r.mode=="string"&&Array.isArray(r.items)}var vc=class{container=null;texture=null;textureSelector=null;_textureCycleIndex=0;_activeFirst=null;_activeLast=null;_poolFirst=null;particleCount=0;maxParticles=1e3;lifetime={min:1,max:2};frequency=.1;particlesPerWave=1;_spawnTimer=0;emitterLifetime=-1;_emitterAge=0;emit=!0;destroyed=!1;initBehaviors=[];updateBehaviors=[];recycleBehaviors=[];spawnBounds=null;recycleOnBounds=!1;rng=null;constructor(e,t){this.container=e,this.init(t)}init(e){if(this.rng=e.seed!==void 0&&e.seed!==null?new Uf(e.seed):null,e.texture&&(xD(e.texture)?(this.textureSelector=e.texture,this.texture=e.texture.items[0]?.texture??null):(this.textureSelector=null,this.texture=e.texture)),this._textureCycleIndex=0,e.lifetime&&(this.lifetime.min=e.lifetime.min??1,this.lifetime.max=e.lifetime.max??e.lifetime.min??2,this.lifetime.distribution=e.lifetime.distribution),this.frequency=e.frequency??.1,this.particlesPerWave=e.particlesPerWave??1,this.maxParticles=e.maxParticles??1e3,this.emitterLifetime=e.emitterLifetime??-1,this.spawnBounds=null,this.recycleOnBounds=!1,e.spawnBounds&&(this.spawnBounds=e.spawnBounds,this.recycleOnBounds=e.recycleOnBounds??!1),this.initBehaviors=[],this.updateBehaviors=[],this.recycleBehaviors=[],e.behaviors)for(let t of e.behaviors){let i=ZR(t.type);if(!i){console.warn(`Unknown behavior type: ${t.type}`);continue}let s=new i(t.config);s.initParticles&&this.initBehaviors.push(s),s.updateParticle&&this.updateBehaviors.push(s),s.recycleParticle&&this.recycleBehaviors.push(s)}this._spawnTimer=0,this._emitterAge=0,this.emit=e.emit??!0}_createParticle(){let e;return this._poolFirst?(e=this._poolFirst,this._poolFirst=e.next,e.next=null):e=new yc(this),e}spawn(e){if(this.destroyed||e<=0)return null;let t=this.maxParticles-this.particleCount;if(e=Math.min(e,t),e<=0)return null;let i=this.textureSelector?.pick==="perWave"?this._pickTexture():null,s=null,o=null;for(let n=0;n0&&(this._emitterAge+=e,this._emitterAge>=this.emitterLifetime&&(this.emit=!1)),this.emit)if(this.frequency<=0)this.spawn(this.particlesPerWave),this.emit=!1;else for(this._spawnTimer+=e;this._spawnTimer>=this.frequency;)this._spawnTimer-=this.frequency,this.spawn(this.particlesPerWave);let t=this._activeFirst;for(;t;){let i=t.next;if(t.age+=e,t.age>=t.maxLife){this.recycle(t),t=i;continue}if(this.recycleOnBounds&&this.spawnBounds){let s=this.spawnBounds;if(t.xs.x+s.width||t.ys.y+s.height){this.recycle(t),t=i;continue}}for(let s of this.updateBehaviors)s.updateParticle(t,e);t=i}}stop(e=!1){if(this.emit=!1,e)for(;this._activeFirst;)this.recycle(this._activeFirst)}restart(){this._emitterAge=0,this._spawnTimer=0,this.emit=!0}random(){return this.rng?this.rng.next():Math.random()}_pickTexture(){if(!this.textureSelector)return this.texture;let{mode:e,items:t}=this.textureSelector;if(!t.length)return this.texture;if(e==="cycle"){let i=t[this._textureCycleIndex%t.length];return this._textureCycleIndex+=1,i.texture}if(e==="random"){let i=t.reduce((o,n)=>o+(n.weight??1),0),s=this.random()*i;for(let o of t)if(s-=o.weight??1,s<=0)return o.texture;return t[t.length-1].texture}return t[0].texture}destroy(){if(this.destroyed)return;this.destroyed=!0,this.emit=!1;let e=this._activeFirst;for(;e;){let t=e.next;e.destroy(),e=t}for(e=this._poolFirst;e;){let t=e.next;e.destroy(),e=t}this._activeFirst=null,this._activeLast=null,this._poolFirst=null,this.initBehaviors=[],this.updateBehaviors=[],this.recycleBehaviors=[]}};function yD(r){return typeof r=="object"&&r!==null&&!Array.isArray(r)&&typeof r.mode=="string"&&Array.isArray(r.items)}function _D(r,e){let t=new Ue,i=e.color??"#ffffff";switch(e.shape){case"circle":{let s=e.radius??3;t.circle(0,0,s),t.fill({color:i});break}case"ellipse":{let s=e.width??2,o=e.height??6;t.ellipse(0,0,s/2,o/2),t.fill({color:i});break}case"rect":{let s=e.width??4,o=e.height??4;t.rect(-s/2,-o/2,s,o),t.fill({color:i});break}default:t.circle(0,0,3),t.fill({color:i})}return r.renderer.generateTexture(t)}function QR(r,e){if(typeof e=="object"&&e?.shape)return _D(r,e);let t=e??"circle",i=KR(t,r);if(!i)try{i=k.from(t)}catch{return console.warn(`Failed to load particle texture: ${t}`),null}return i}function bD(r,e){let t=[];for(let i of e.items){let s=i.src?i.src:i,o=QR(r,s);if(!o)return null;t.push(i.weight===void 0?{texture:o}:{texture:o,weight:i.weight})}return{mode:e.mode,pick:e.pick??"perParticle",items:t}}var Tc=({app:r,parent:e,element:t,renderContext:i,zIndex:s})=>{let o=new te;o.label=t.id,o.zIndex=s,e.addChild(o);let n=t.width,a=t.height;o.x=t.x??0,o.y=t.y??0;let l={lifetime:t.emitter?.lifetime??{min:1,max:2},frequency:t.emitter?.frequency??.1,particlesPerWave:t.emitter?.particlesPerWave??1,maxParticles:t.emitter?.maxParticles??t.count??100,emitterLifetime:t.emitter?.emitterLifetime??-1,spawnBounds:t.emitter?.spawnBounds,recycleOnBounds:t.emitter?.recycleOnBounds??!1,seed:t.emitter?.seed,behaviors:t.behaviors},c=yD(t.texture)?bD(r,t.texture):QR(r,t.texture);if(!c)return;l.texture=c;let u=new vc(o,l);o.emitter=u;let h=l.frequency<=0;if(h){u.emitNow(),u.emit=!1;let f=p=>{if(!p.length)return;let[m,...g]=p;(m===0&&typeof requestAnimationFrame=="function"?requestAnimationFrame:v=>setTimeout(v,m))(()=>{u.destroyed||u.particleCount>0||(u.emitNow(),f(g))})};f([0,50,150])}if(l.recycleOnBounds&&!h){let f=Math.min(t.count??100,l.maxParticles);u.spawn(f);let p=u._activeFirst;for(;p;)p.y=u.random()*a,p.age=u.random()*p.maxLife*.8,p=p.next}let d=f=>{if(u.destroyed){r.ticker.remove(d);return}let p=Math.min(typeof f.deltaMS=="number"?f.deltaMS/1e3:f.deltaTime/60,.1);u.update(p)};o.tickerCallback=d,hM(i,{app:r,emitter:u,container:o,tickerCallback:d}),t.alpha!==void 0&&(o.alpha=t.alpha)};var Gf=({app:r,parent:e,element:t,animationBus:i,animations:s,completionTracker:o})=>{let n=e.getChildByLabel(t.id);if(!n)return;let a=()=>{n&&!n.destroyed&&(n.emitter&&n.emitter.destroy(),n.tickerCallback&&r.ticker.remove(n.tickerCallback),n.customTickerHandler&&window.removeEventListener("snapShotKeyFrame",n.customTickerHandler),n.destroy({children:!0}))};ne({animations:s,targetId:t.id,animationBus:i,completionTracker:o,element:n,targetState:null,onComplete:a})||a()};var JR=({app:r,parent:e,prevElement:t,nextElement:i,animations:s,animationBus:o,completionTracker:n,renderContext:a,zIndex:l})=>{let c=e.children.find(h=>h.label===t.id);if(!c){Tc({app:r,parent:e,element:i,animations:s,animationBus:o,completionTracker:n,renderContext:a,zIndex:l});return}if(c.zIndex=l,vD(t,i))Gf({app:r,parent:e,element:t,animations:s,animationBus:o,completionTracker:n}),Tc({app:r,parent:e,element:i,animations:s,animationBus:o,completionTracker:n,renderContext:a,zIndex:l});else{let h=()=>{i.alpha!==void 0&&(c.alpha=i.alpha),i.x!==void 0&&(c.x=i.x),i.y!==void 0&&(c.y=i.y)};ne({animations:s,targetId:t.id,animationBus:o,completionTracker:n,element:c,targetState:{x:i.x??c.x,y:i.y??c.y,alpha:i.alpha??c.alpha},onComplete:h})||h()}};function vD(r,e){return r.count!==e.count||!pe(r.texture,e.texture)||!pe(r.behaviors,e.behaviors)||!pe(r.emitter,e.emitter)||r.width!==e.width||r.height!==e.height}function o_(r){if(!r.id)throw new Error("Input Error: Id is missing");if(!Object.values(Us).includes(r.type))throw new Error("Input Error: Type must be one of "+Object.values(Us).join(", "));if(typeof r.width!="number"||typeof r.height!="number")throw new Error("Input Error: Width and height must be numbers");if(r.width<=0||r.height<=0)throw new Error("Input Error: Width and height must be positive")}function eI(r){if(!r.texture)throw new Error("Input Error: Particles require 'texture'");let e=typeof r.texture=="string",t=typeof r.texture=="object"&&r.texture!==null&&!Array.isArray(r.texture);if(!e&&!t)throw new Error("Input Error: texture must be a string or shape object");if(t){if(!r.texture.shape)throw new Error("Input Error: texture object must have 'shape' property");if(!["circle","ellipse","rect"].includes(r.texture.shape))throw new Error(`Input Error: texture.shape must be 'circle', 'ellipse', or 'rect', got '${r.texture.shape}'`)}}function tI(r){if(!r.behaviors)throw new Error("Input Error: Particles require 'behaviors'");if(!Array.isArray(r.behaviors))throw new Error("Input Error: 'behaviors' must be an array");if(r.behaviors.length===0)throw new Error("Input Error: 'behaviors' array cannot be empty");for(let e=0;er.emitter.lifetime.max)throw new Error("Input Error: emitter.lifetime.min cannot be greater than max")}function iI(r){if(r.emitter.frequency!==void 0){if(typeof r.emitter.frequency!="number")throw new Error("Input Error: emitter.frequency must be a number");if(r.emitter.frequency<0)throw new Error("Input Error: emitter.frequency must be non-negative")}if(r.emitter.particlesPerWave!==void 0){if(typeof r.emitter.particlesPerWave!="number")throw new Error("Input Error: emitter.particlesPerWave must be a number");if(r.emitter.particlesPerWave<=0)throw new Error("Input Error: emitter.particlesPerWave must be positive");if(!Number.isInteger(r.emitter.particlesPerWave))throw new Error("Input Error: emitter.particlesPerWave must be an integer")}if(r.emitter.maxParticles!==void 0){if(typeof r.emitter.maxParticles!="number")throw new Error("Input Error: emitter.maxParticles must be a number");if(r.emitter.maxParticles<=0)throw new Error("Input Error: emitter.maxParticles must be positive");if(!Number.isInteger(r.emitter.maxParticles))throw new Error("Input Error: emitter.maxParticles must be an integer")}}function sI(r){if(r.count!==void 0){if(typeof r.count!="number")throw new Error("Input Error: count must be a number");if(r.count<=0)throw new Error("Input Error: count must be positive");if(!Number.isInteger(r.count))throw new Error("Input Error: count must be an integer")}if(r.alpha!==void 0){if(typeof r.alpha!="number")throw new Error("Input Error: alpha must be a number");if(r.alpha<0||r.alpha>1)throw new Error("Input Error: alpha must be between 0 and 1")}if(r.x!==void 0&&typeof r.x!="number")throw new Error("Input Error: x must be a number");if(r.y!==void 0&&typeof r.y!="number")throw new Error("Input Error: y must be a number")}var TD=new Set(["continuous","burst"]),SD=new Set(["point","rect","circle","line"]),wD=new Set(["single","random","cycle"]),ED=new Set(["perParticle","perWave"]),oI=new Set(["uniform","normal","bias"]),nI=new Set(["min","max","center"]),AD=new Set(["none","fixed","random","spin"]);function uI(r){if(PD(r),!r.modules||typeof r.modules!="object"||Array.isArray(r.modules))throw new Error("Input Error: Particles require 'modules'");let{emission:e,movement:t,appearance:i,bounds:s}=r.modules;if(!e||typeof e!="object"||Array.isArray(e))throw new Error("Input Error: modules.emission must be an object");if(!i||typeof i!="object"||Array.isArray(i))throw new Error("Input Error: modules.appearance must be an object");CD(e),RD(t,i),ID(i),UD(s)}function PD(r){if(r.texture!==void 0||r.behaviors!==void 0||r.emitter!==void 0)throw new Error("Input Error: Structured particles cannot mix 'modules' with legacy texture/behaviors/emitter fields");if(r.count!==void 0)throw new Error("Input Error: Structured particles do not support legacy 'count'");if(r.alpha!==void 0&&(ce(r.alpha,"alpha"),r.alpha<0||r.alpha>1))throw new Error("Input Error: alpha must be between 0 and 1");r.x!==void 0&&ce(r.x,"x"),r.y!==void 0&&ce(r.y,"y"),r.seed!==void 0&&ce(r.seed,"seed")}function CD(r){if(!TD.has(r.mode))throw new Error("Input Error: modules.emission.mode must be 'continuous' or 'burst'");if(r.mode==="continuous"){if(ce(r.rate,"modules.emission.rate"),r.rate<=0)throw new Error("Input Error: modules.emission.rate must be positive")}else if(cI(r.burstCount,"modules.emission.burstCount"),r.burstCount<=0)throw new Error("Input Error: modules.emission.burstCount must be positive");if(r.maxActive!==void 0&&(cI(r.maxActive,"modules.emission.maxActive"),r.maxActive<=0))throw new Error("Input Error: modules.emission.maxActive must be positive");if(r.duration!==void 0&&r.duration!=="infinite"&&(ce(r.duration,"modules.emission.duration"),r.duration<0))throw new Error("Input Error: modules.emission.duration must be non-negative");if(ss(r.particleLifetime,"modules.emission.particleLifetime",{allowNegative:!1}),!r.source||typeof r.source!="object"||Array.isArray(r.source))throw new Error("Input Error: modules.emission.source must be an object");if(!SD.has(r.source.kind))throw new Error("Input Error: modules.emission.source.kind must be one of point, rect, circle, line");if(!r.source.data||typeof r.source.data!="object"||Array.isArray(r.source.data))throw new Error("Input Error: modules.emission.source.data must be an object");MD(r.source.kind,r.source.data)}function MD(r,e){if(r==="point"){ce(e.x,"modules.emission.source.data.x"),ce(e.y,"modules.emission.source.data.y");return}if(r==="rect"){if(ce(e.x,"modules.emission.source.data.x"),ce(e.y,"modules.emission.source.data.y"),ce(e.width,"modules.emission.source.data.width"),ce(e.height,"modules.emission.source.data.height"),e.width<=0||e.height<=0)throw new Error("Input Error: modules.emission.source.data.width and height must be positive");return}if(r==="circle"){if(ce(e.x,"modules.emission.source.data.x"),ce(e.y,"modules.emission.source.data.y"),ce(e.radius,"modules.emission.source.data.radius"),e.radius<=0)throw new Error("Input Error: modules.emission.source.data.radius must be positive");if(e.innerRadius!==void 0&&(ce(e.innerRadius,"modules.emission.source.data.innerRadius"),e.innerRadius<0||e.innerRadius>e.radius))throw new Error("Input Error: modules.emission.source.data.innerRadius must be between 0 and radius");if(e.affectRotation!==void 0&&typeof e.affectRotation!="boolean")throw new Error("Input Error: modules.emission.source.data.affectRotation must be a boolean");return}ce(e.x1,"modules.emission.source.data.x1"),ce(e.y1,"modules.emission.source.data.y1"),ce(e.x2,"modules.emission.source.data.x2"),ce(e.y2,"modules.emission.source.data.y2")}function RD(r,e){if(r!==void 0){if(!r||typeof r!="object"||Array.isArray(r))throw new Error("Input Error: modules.movement must be an object");if(r.velocity!==void 0){if(!r.velocity||typeof r.velocity!="object"||Array.isArray(r.velocity))throw new Error("Input Error: modules.movement.velocity must be an object");let{velocity:t}=r;if(t.kind!=="directional"&&t.kind!=="radial")throw new Error("Input Error: modules.movement.velocity.kind must be 'directional' or 'radial'");ss(t.speed,"modules.movement.velocity.speed",{allowNegative:!1}),t.kind==="directional"?ss(t.direction,"modules.movement.velocity.direction",{allowNegative:!0}):t.angle!==void 0&&ss(t.angle,"modules.movement.velocity.angle",{allowNegative:!0})}if(r.acceleration!==void 0){if(!r.acceleration||typeof r.acceleration!="object"||Array.isArray(r.acceleration))throw new Error("Input Error: modules.movement.acceleration must be an object");ce(r.acceleration.x,"modules.movement.acceleration.x"),ce(r.acceleration.y,"modules.movement.acceleration.y")}if(r.maxSpeed!==void 0&&(ce(r.maxSpeed,"modules.movement.maxSpeed"),r.maxSpeed<0))throw new Error("Input Error: modules.movement.maxSpeed must be non-negative");if(r.faceVelocity!==void 0&&typeof r.faceVelocity!="boolean")throw new Error("Input Error: modules.movement.faceVelocity must be a boolean");if(!r.velocity&&!r.acceleration)throw new Error("Input Error: modules.movement must define velocity, acceleration, or both");if(r.faceVelocity&&e?.rotation&&e.rotation.mode!=="none")throw new Error("Input Error: modules.appearance.rotation cannot be combined with modules.movement.faceVelocity")}}function ID(r){BD(r.texture),r.scale!==void 0&&aI(r.scale,"modules.appearance.scale",{allowNegative:!1,modes:["single","range","curve"]}),r.alpha!==void 0&&aI(r.alpha,"modules.appearance.alpha",{min:0,max:1,modes:["single","curve"]}),r.color!==void 0&&FD(r.color,"modules.appearance.color"),r.rotation!==void 0&&OD(r.rotation)}function BD(r){if(r===void 0)throw new Error("Input Error: modules.appearance.texture is required");if(typeof r!="string"){if(!r||typeof r!="object"||Array.isArray(r))throw new Error("Input Error: modules.appearance.texture must be a string or object");if(r.shape){hI(r,"modules.appearance.texture");return}if(!wD.has(r.mode))throw new Error("Input Error: modules.appearance.texture.mode must be 'single', 'random', or 'cycle'");if(r.pick!==void 0&&!ED.has(r.pick))throw new Error("Input Error: modules.appearance.texture.pick must be 'perParticle' or 'perWave'");if(!Array.isArray(r.items)||r.items.length===0)throw new Error("Input Error: modules.appearance.texture.items must be a non-empty array");if(r.mode==="single"&&r.items.length!==1)throw new Error("Input Error: modules.appearance.texture.mode 'single' requires exactly one item");for(let e=0;e1)throw new Error(`Input Error: ${e}.keys[${s}].time must be between 0 and 1`);if(o.time1)throw new Error(`Input Error: ${e}.keys[${i}].time must be between 0 and 1`);if(s.time(r.max??r.min))throw new Error(`Input Error: ${e}.min cannot be greater than max`);r.distribution!==void 0&&LD(r.distribution,`${e}.distribution`)}function Sc(r,e,t={}){if(ce(r,e),!t.allowNegative&&r<0)throw new Error(`Input Error: ${e} must be non-negative`);if(t.min!==void 0&&rt.max)throw new Error(`Input Error: ${e} must be at most ${t.max}`)}function LD(r,e){if(!r||typeof r!="object"||Array.isArray(r))throw new Error(`Input Error: ${e} must be an object`);if(!oI.has(r.kind))throw new Error(`Input Error: ${e}.kind must be one of ${[...oI].join(", ")}`);if(r.kind==="bias"){if(!nI.has(r.toward??"min"))throw new Error(`Input Error: ${e}.toward must be one of ${[...nI].join(", ")}`);r.strength!==void 0&&ce(r.strength,`${e}.strength`)}r.kind==="normal"&&(r.mean!==void 0&&ce(r.mean,`${e}.mean`),r.deviation!==void 0&&ce(r.deviation,`${e}.deviation`))}function ce(r,e){if(typeof r!="number"||Number.isNaN(r))throw new Error(`Input Error: ${e} must be a number`)}function cI(r,e){if(ce(r,e),!Number.isInteger(r))throw new Error(`Input Error: ${e} must be an integer`)}function dI(r){let e=DD(r),t=[];t.push(ND(r.modules.emission.source));let i=VD(r.modules.movement);i&&t.push(i),t.push(...WD(r.modules.appearance));let s=KD(r.modules.bounds,r.width,r.height);s&&(e.spawnBounds=s.spawnBounds,e.recycleOnBounds=!0);let o=zD(r.modules.appearance.texture),n=e.maxParticles;return{id:r.id,type:r.type,count:n,texture:o,behaviors:t,emitter:e,x:r.x??0,y:r.y??0,width:r.width,height:r.height,alpha:r.alpha??1}}function DD(r){let{emission:e}=r.modules,t={lifetime:os(e.particleLifetime),maxParticles:e.mode==="burst"?Math.max(e.maxActive??e.burstCount,e.burstCount):e.maxActive??100,emitterLifetime:e.duration===void 0||e.duration==="infinite"?-1:e.duration,seed:r.seed};return e.mode==="continuous"?(t.frequency=1/e.rate,t.particlesPerWave=1):(t.frequency=0,t.particlesPerWave=e.burstCount),t}function ND(r){return{type:"spawnShape",config:{type:r.kind,data:HD(r.kind,r.data)}}}function HD(r,e){return r==="rect"?{x:e.x,y:e.y,w:e.width,h:e.height}:{...e}}function VD(r){if(!r)return null;let e={maxSpeed:r.maxSpeed??0,faceVelocity:r.faceVelocity??!1};return r.velocity&&(e.velocity={kind:r.velocity.kind,speed:os(r.velocity.speed)},r.velocity.kind==="directional"?e.velocity.direction=os(r.velocity.direction):e.velocity.angle=os(r.velocity.angle??{min:0,max:360})),r.acceleration&&(e.acceleration={x:r.acceleration.x,y:r.acceleration.y}),{type:"movement",config:e}}function WD(r){let e=[];if(r.scale&&e.push(XD(r.scale)),r.alpha&&e.push(jD(r.alpha)),r.color&&e.push(YD(r.color)),r.rotation){let t=qD(r.rotation);t&&e.push(t)}return e}function zD(r){if(typeof r=="string")return r;if(r.shape)return{...r};let e={mode:r.mode,pick:r.pick??"perParticle",items:r.items.map($D)};if(e.mode==="single"&&e.items.length===1){let[t]=e.items;return t.src??fI(t)}return e}function $D(r){if(r.src)return r.weight===void 0?{src:r.src}:{src:r.src,weight:r.weight};let e=fI(r);return r.weight!==void 0&&(e.weight=r.weight),e}function fI(r){return{shape:r.shape,...r.radius!==void 0?{radius:r.radius}:{},...r.width!==void 0?{width:r.width}:{},...r.height!==void 0?{height:r.height}:{},...r.color!==void 0?{color:r.color}:{}}}function XD(r){return r.mode==="curve"?{type:"scale",config:{list:n_(r.keys)}}:{type:"scaleStatic",config:r.mode==="single"?{min:r.value,max:r.value}:os(r)}}function jD(r){return r.mode==="curve"?{type:"alpha",config:{list:n_(r.keys)}}:{type:"alphaStatic",config:{alpha:r.value}}}function YD(r){return r.mode==="gradient"?{type:"color",config:{list:n_(r.keys)}}:{type:"colorStatic",config:{color:r.value}}}function qD(r){if(r.mode==="none")return null;if(r.mode==="fixed")return{type:"noRotation",config:{rotation:r.value}};if(r.mode==="random"){let i=os(r);return{type:"rotationStatic",config:{min:i.min,max:i.max,distribution:i.distribution}}}let e=os(r.start),t=os(r.speed);return{type:"rotation",config:{minStart:e.min,maxStart:e.max,startDistribution:e.distribution,minSpeed:t.min,maxSpeed:t.max,speedDistribution:t.distribution,accel:r.accel??0}}}function KD(r,e,t){if(!r||r.mode==="none")return null;if(r.source==="custom")return{spawnBounds:{...r.custom}};let i=ZD(r.padding??0);return{spawnBounds:{x:-i.left,y:-i.top,width:e+i.left+i.right,height:t+i.top+i.bottom}}}function ZD(r){return typeof r=="number"?{top:r,right:r,bottom:r,left:r}:{top:r.top,right:r.right,bottom:r.bottom,left:r.left}}function n_(r){return r.map(e=>({time:e.time,value:e.value}))}function os(r){return typeof r=="number"?{min:r,max:r}:{min:r.min,max:r.max??r.min,...r.distribution!==void 0?{distribution:{...r.distribution}}:{}}}var pI=({state:r})=>{if(r.modules)return o_(r),uI(r),dI(r);o_(r),eI(r),tI(r),rI(r),iI(r),sI(r);let e=r.emitter?.maxParticles??r.count??100,t=r.emitter;return t&&t.maxParticles===void 0&&r.count!==void 0&&(t={...t,maxParticles:e}),{id:r.id,type:r.type,count:e,texture:r.texture,behaviors:r.behaviors,emitter:t,x:r.x??0,y:r.y??0,width:r.width,height:r.height,alpha:r.alpha??1}};var QD=et({type:"particles",add:Tc,update:JR,delete:Gf,parse:pI});var mI=(r=[],e=[])=>{let t=new Set,i=new Map,s=new Map,o=[],n=[],a=[];for(let l of r)t.add(l.id),i.set(l.id,l);for(let l of e)t.add(l.id),s.set(l.id,l);for(let l of t){let c=i.get(l),u=s.get(l);!c&&u?o.push(u):c&&!u?n.push(c):(c.src!==u.src||c.volume!==u.volume||c.loop!==u.loop||c.delay!==u.delay)&&a.push({prev:c,next:u})}return{toAddElement:o,toDeleteElement:n,toUpdateElement:a}};var a_=({app:r,prevAudioTree:e,nextAudioTree:t,audioPlugins:i})=>{let{toAddElement:s,toDeleteElement:o,toUpdateElement:n}=mI(e,t);for(let a of o){let l=i.find(c=>c.type===a.type);if(!l)throw new Error(`No audio plugin found for type: ${a.type}`);l.delete({app:r,element:a})}for(let a of s){let l=i.find(c=>c.type===a.type);if(!l)throw new Error(`No audio plugin found for type: ${a.type}`);l.add({app:r,element:a})}for(let{prev:a,next:l}of n){let c=i.find(u=>u.type===l.type);if(!c)throw new Error(`No audio plugin found for type: ${l.type}`);c.update({app:r,prevElement:a,nextElement:l})}};var sr=(r=>(r[r.WEBGL_LEGACY=0]="WEBGL_LEGACY",r[r.WEBGL=1]="WEBGL",r[r.WEBGL2=2]="WEBGL2",r))(sr||{}),l_=(r=>(r[r.UNKNOWN=0]="UNKNOWN",r[r.WEBGL=1]="WEBGL",r[r.CANVAS=2]="CANVAS",r))(l_||{}),Lf=(r=>(r[r.COLOR=16384]="COLOR",r[r.DEPTH=256]="DEPTH",r[r.STENCIL=1024]="STENCIL",r))(Lf||{}),re=(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))(re||{}),Bn=(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))(Bn||{}),H=(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))(H||{}),wi=(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))(wi||{}),ae=(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))(ae||{}),z=(r=>(r[r.FLOAT=0]="FLOAT",r[r.INT=1]="INT",r[r.UINT=2]="UINT",r))(z||{}),vr=(r=>(r[r.NEAREST=0]="NEAREST",r[r.LINEAR=1]="LINEAR",r))(vr||{}),wc=(r=>(r[r.CLAMP=33071]="CLAMP",r[r.REPEAT=10497]="REPEAT",r[r.MIRRORED_REPEAT=33648]="MIRRORED_REPEAT",r))(wc||{}),Fr=(r=>(r[r.OFF=0]="OFF",r[r.POW2=1]="POW2",r[r.ON=2]="ON",r[r.ON_MANUAL=3]="ON_MANUAL",r))(Fr||{}),or=(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))(or||{}),ns=(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))(ns||{}),Df=(r=>(r[r.AUTO=0]="AUTO",r[r.MANUAL=1]="MANUAL",r))(Df||{}),Wt=(r=>(r.LOW="lowp",r.MEDIUM="mediump",r.HIGH="highp",r))(Wt||{}),at=(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))(at||{});var Pe=(r=>(r[r.NONE=0]="NONE",r[r.LOW=2]="LOW",r[r.MEDIUM=4]="MEDIUM",r[r.HIGH=8]="HIGH",r))(Pe||{}),Qt=(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))(Qt||{});var c_={createCanvas:(r,e)=>{let t=document.createElement("canvas");return t.width=r,t.height=e,t},getCanvasRenderingContext2D:()=>CanvasRenderingContext2D,getWebGLRenderingContext:()=>WebGLRenderingContext,getNavigator:()=>navigator,getBaseUrl:()=>document.baseURI??window.location.href,getFontFaceSet:()=>document.fonts,fetch:(r,e)=>fetch(r,e),parseXML:r=>new DOMParser().parseFromString(r,"text/xml")};var K={ADAPTER:c_,RESOLUTION:1,CREATE_IMAGE_BITMAP:!1,ROUND_PIXELS:!1};gm();var JD=Gi.default??Gi,Or=JD(globalThis.navigator);K.RETINA_PREFIX=/@([0-9\.]+)x/;K.FAIL_IF_MAJOR_PERFORMANCE_CAVEAT=!1;var Zs=fs(xI(),1),zH=fs(mh(),1);var W_=fs(kk(),1);var Fk={};function fe(r,e,t=3){if(Fk[e])return;let i=new Error().stack;typeof i>"u"?console.warn("PixiJS Deprecation Warning: ",`${e} +`&&(a+=1),{remainingText:r.slice(a),consumedExplicitNewline:!0}}return t?{remainingText:r.slice(n),consumedExplicitNewline:!1}:{remainingText:r.slice(o),consumedExplicitNewline:!1}},sD=(r,e)=>{let t=[],i=[],s=0,o=0,n=0,a=0,l=0,c=[...r],u=new WeakSet,h=Math.max(10,r.reduce((p,m)=>p+(m?.text?.length??0),0)*4),d=()=>{t.push({lineParts:[...i],y:o,lineMaxHeight:n}),s=0,o+=n,n=0,i=[]};for(;c.length>0;){if(l+=1,l>h)throw new Error("[parseTextRevealing] Failed to make progress while wrapping text.");let p=c[0];if(!p.text||p.text.length===0){c.shift();continue}let m=p.text,g=Math.max(1,Math.round(e-s)),_={...p.textStyle,wordWrapWidth:g},v=De.measureText(p.text,new Oe(ir(_)));if(v.lineWidths[0]>g&&i.length>0){d();continue}let x=v.lines[0]??"",T=v.lines.length>1,b="",E=!1;if(v.lines.length===1&&p.text.endsWith(" ")&&!x.endsWith(" ")&&(x+=" "),x.length>0){let C=iD(m,x,T);b=C.remainingText,E=C.consumedExplicitNewline}if(x.length===0&&m.length>0){let C=m.match(/^\s+/)?.[0]??"";x=C.length>0?C:m[0],b=m.slice(x.length)}if(b===m){let C=m.match(/^\s+/)?.[0]??m[0]??"";if(C.length===0)throw new Error("[parseTextRevealing] Failed to consume text while wrapping.");x=C,b=m.slice(C.length)}let w=De.measureText(x,new Oe({...ir(p.textStyle),wordWrap:!1,breakWords:!1})),I=Math.max(0,Math.round(w.width??v.lineWidths[0]??0)),B={text:x,textStyle:_,height:w.height,x:s,y:o};if(p.furigana&&!u.has(p)){u.add(p);let C=De.measureText(p.furigana.text,new Oe(ir(p.furigana.textStyle))),A=-C.height+o+2,P={text:p.furigana.text,textStyle:p.furigana.textStyle,x:Math.round(s+(I-C.width)/2),y:A};B.furigana=P}i.push(B),n=Math.max(n,w.height),s+=I,a=Math.max(a,s),b&&b.length>0?p.text=b:c.shift(),(T||E)&&s>0&&d()}i.length>0&&t.push({lineParts:i,y:o,lineMaxHeight:n});for(let p=0;p{let _=g.height;g.height&&delete g.height;let v=g.y+(m-_),x=g.furigana;return x&&(x.y=x.y-g.y+v),{...g,...x&&{furigana:x},y:v}})}let f=t.length>0?t[t.length-1].y+t[t.length-1].lineMaxHeight:0;return{chunks:t,width:Math.max(a,e),height:f}},FR=({state:r})=>{let e={...Ge,wordWrap:!0,...r.textStyle||{}},t=(r.content||[]).map(u=>{let h={...e,...u.textStyle||{}};h.lineHeight=Math.round(h.lineHeight*h.fontSize),r.width&&(h.wordWrapWidth=r.width,h.wordWrap=!0);let d=null;if(u.furigana){let p={...e,...u.furigana.textStyle||{}};p.lineHeight=Math.round(p.lineHeight*p.fontSize),r.width&&(p.wordWrapWidth=r.width,p.wordWrap=!0),d={text:String(u.furigana.text),textStyle:p}}return{text:String(u.text).replace(/ +$/,p=>"\xA0".repeat(p.length)),textStyle:h,...d&&{furigana:d}}}),i=r.width||500,{chunks:s,width:o,height:n}=sD(t,i),a=r.width||o,c=yt({...r,width:a,height:n});if(c.alpha=r.alpha??1,r.indicator){let u=r.indicator;c.indicator={revealing:{src:u.revealing?.src??"",width:u.revealing?.width??12,height:u.revealing?.height??12},complete:{src:u.complete?.src??"",width:u.complete?.width??12,height:u.complete?.height??12},offset:u.offset??12}}return{...c,content:s,textStyle:{...e,...r.textStyle||{}},speed:r.speed??50,revealEffect:r.revealEffect??"typewriter",...r.width!==void 0&&{width:r.width},...r.complete&&{complete:r.complete}}};var oD=et({type:"text-revealing",add:RR,update:BR,delete:kR,parse:FR,shouldUpdateUnchanged:({parent:r,nextElement:e})=>oM(r.children.find(t=>t.label===e.id))});var hf=(r,e,t,i)=>{if(!t)return;let s=o=>{o?.detail?.elementId===e&&typeof o?.detail?.frameIndex=="number"&&(r.gotoAndStop(o?.detail?.frameIndex),i?.())};window.addEventListener("snapShotAnimatedSpriteFrame",s),r._snapShotKeyFrameHandler=s},df=r=>{r._snapShotKeyFrameHandler&&(window.removeEventListener("snapShotAnimatedSpriteFrame",r._snapShotKeyFrameHandler),delete r._snapShotKeyFrameHandler)};var OR=(r={})=>{if(r.frame){let n=r.frame.w??0,a=r.frame.h??0,l=r.sourceSize?.w??n,c=r.sourceSize?.h??a,u={frame:{x:r.frame.x??0,y:r.frame.y??0,w:n,h:a},rotated:r.rotated??!1,trimmed:r.trimmed??!1,spriteSourceSize:{x:r.spriteSourceSize?.x??0,y:r.spriteSourceSize?.y??0,w:r.spriteSourceSize?.w??n,h:r.spriteSourceSize?.h??a},sourceSize:{w:l,h:c}};return r.anchor?u.anchor={x:r.anchor.x??0,y:r.anchor.y??0}:r.pivot&&(u.anchor={x:r.pivot.x??0,y:r.pivot.y??0}),r.borders&&(u.borders={...r.borders}),u}let e=r.width??r.w??0,t=r.height??r.h??0,i=r.sourceWidth??e,s=r.sourceHeight??t,o={frame:{x:r.x??0,y:r.y??0,w:e,h:t},rotated:r.rotated??!1,trimmed:r.trimmed??!1,spriteSourceSize:{x:r.offsetX??0,y:r.offsetY??0,w:e,h:t},sourceSize:{w:i,h:s}};return r.anchor?o.anchor={x:r.anchor.x??0,y:r.anchor.y??0}:r.pivot&&(o.anchor={x:r.pivot.x??0,y:r.pivot.y??0}),r.borders&&(o.borders={...r.borders}),o},Ky=(r={})=>!r||typeof r!="object"?{}:Object.fromEntries(Object.entries(r).map(([e,t])=>[e,Array.isArray(t)?t.map(i=>String(i)):[]])),nD=(r,e={})=>{let t=Math.max(0,Number(e.from??0)),i=Math.min(r.length-1,Number(e.to??t));if(!Number.isFinite(t)||!Number.isFinite(i)||i!Array.isArray(r)||e.length===0?{}:Object.fromEntries(r.map(t=>{let i=typeof t?.name=="string"?t.name:"";return i?[i,nD(e,t)]:null}).filter(Boolean)),Rn=(r={})=>{let e=r??{},t=Ky(e.animations);return{frames:Array.isArray(e.frames)?Object.fromEntries(e.frames.map(s=>{let o=s?.filename??s?.name;return typeof o!="string"||o.length===0?null:[o,OR(s)]}).filter(Boolean)):Object.fromEntries(Object.entries(e.frames??{}).map(([s,o])=>[s,OR(o)])),...Object.keys(t).length>0?{animations:t}:{},meta:{...e.meta??{},scale:String(e.scale??e.meta?.scale??1),...e.width!=null||e.height!=null?{size:{w:e.width??e.meta?.size?.w??0,h:e.height??e.meta?.size?.h??0}}:{}}}},In=(r={},e={},t={},i=[])=>({...aD(t?.frameTags,i),...Ky(e),...Ky(r)}),lD=(r,e)=>{if(!Array.isArray(e?.frames))return[];let t=Object.keys(r.frames??{});return e.frames.map(i=>typeof i=="number"?t[i]:String(i)).filter(Boolean)},Ws=({atlas:r={frames:{}},clips:e={},playback:t,legacyAnimation:i})=>{let s=t??i??{},o={fps:s.fps??null,loop:s.loop??!0,autoplay:s.autoplay??!0};return typeof s.clip=="string"&&s.clip.length>0&&(o.clip=s.clip),Array.isArray(s.frames)?o.frames=s.frames.map(n=>typeof n=="number"?Object.keys(r.frames??{})[n]:String(n)).filter(Boolean):o.clip||(o.frames=lD(r,i)),o.fps==null&&(typeof s.animationSpeed=="number"?o.fps=s.animationSpeed*60:o.fps=30),o.clip&&(!Array.isArray(o.frames)||o.frames.length===0)&&(o.frames=Array.isArray(e[o.clip])?[...e[o.clip]]:[]),Array.isArray(o.frames)||(o.frames=[]),o},ff=({spritesheet:r,atlas:e,clips:t={},playback:i,legacyAnimation:s})=>{let o=Ws({atlas:e,clips:t,playback:i,legacyAnimation:s});return{frameTextures:o.frames.map(a=>r.textures[a]),playback:o}},pf=r=>typeof r=="number"?r/60:.5;var UR=async({app:r,parent:e,element:t,renderContext:i,completionTracker:s,zIndex:o,signal:n})=>{if(n?.aborted)return;let{id:a,x:l,y:c,width:u,height:h,src:d,atlas:f,clips:p,playback:m,alpha:g}=t,_=Rn(f),v=In(p,f?.animations,f?.meta,Object.keys(_.frames??{})),x=Ws({atlas:_,clips:v,playback:m}),T=s?.getVersion?.();s?.track?.(T);try{let b=new Ni(k.from(d),_);if(await b.parse(),n?.aborted||e.destroyed)return;let{frameTextures:E}=ff({spritesheet:b,atlas:_,clips:v,playback:x}),w=new nc(E);w.label=a,w.zIndex=o,w.animationSpeed=pf(x.fps),w.loop=x.loop,r.debug?hf(w,a,r.debug,()=>{typeof r.render=="function"&&r.render()}):x.autoplay&&cM(i,w),w.x=Math.round(l),w.y=Math.round(c),w.width=Math.round(u),w.height=Math.round(h),w.alpha=g,e.addChild(w),typeof r.render=="function"&&r.render()}finally{s?.complete?.(T)}};var GR=async({app:r,parent:e,prevElement:t,nextElement:i,animations:s,animationBus:o,completionTracker:n,zIndex:a,signal:l})=>{if(l?.aborted)return;let c=e.children.find(_=>_.label===t.id);if(!c)return;c.zIndex=a;let u=async()=>{if(!(l?.aborted||c.destroyed)&&!pe(t,i)){let _=i.src,v=Rn(i.atlas),x=In(i.clips,i.atlas?.animations,i.atlas?.meta,Object.keys(v.frames??{})),T=Ws({atlas:v,clips:x,playback:i.playback});c.x=Math.round(i.x),c.y=Math.round(i.y),c.width=Math.round(i.width),c.height=Math.round(i.height),c.alpha=i.alpha;let b=!pe(t.playback,i.playback),E=!pe(t.clips,i.clips),w=t.src!==_||!pe(t.atlas,i.atlas);if(c.animationSpeed=pf(T.fps),c.loop=T.loop,b||E||w){let I=n?.getVersion?.();n?.track?.(I);try{let B=new Ni(k.from(_),v);if(await B.parse(),l?.aborted||c.destroyed)return;let{frameTextures:C}=ff({spritesheet:B,atlas:v,clips:x,playback:T});c.textures=C,typeof r.render=="function"&&r.render(),!r.debug&&T.autoplay?c.play():(r.debug||c.stop?.(),t.id!==i.id&&(df(c),hf(c,i.id,r.debug,()=>{typeof r.render=="function"&&r.render()})))}finally{n?.complete?.(I)}}}},{x:h,y:d,width:f,height:p,alpha:m}=i;ne({animations:s,targetId:t.id,animationBus:o,completionTracker:n,element:c,targetState:{x:h,y:d,width:f,height:p,alpha:m},onComplete:()=>{u()}})||await u()};var LR=({app:r,parent:e,element:t,animations:i,animationBus:s,completionTracker:o})=>{let n=e.children.find(c=>c.label===t.id);if(!n)return;let a=()=>{r.debug&&df(n),n&&!n.destroyed&&(n.stop(),n.destroy())};ne({animations:i,targetId:t.id,animationBus:s,completionTracker:o,element:n,targetState:null,onComplete:a})||a()};var DR=({state:r})=>{let e=yt(r),t=r.atlas,i=Rn(t),s=In(r.clips,t?.animations,t?.meta,Object.keys(i.frames??{})),o=Ws({atlas:i,clips:s,playback:r.playback});return{...e,type:"spritesheet-animation",src:r.src??"",atlas:i,clips:s,playback:o,alpha:r.alpha??1}};var NR=et({type:"spritesheet-animation",add:UR,update:GR,delete:LR,parse:DR}),cD=NR;var uD=vy({type:"tween"});var zs=new Map,hD=r=>({id:r.id,url:r.src,loop:r.loop??!1,volume:We(r.volume,80)}),HR=r=>zs.has(r),xc=r=>{let e=zs.get(r);e!==void 0&&(clearTimeout(e),zs.delete(r))},Zy=({app:r,element:e})=>{let t=hD(e);if(xc(t.id),e.delay&&e.delay>0){let i=setTimeout(()=>{zs.delete(t.id),r.audioStage.add(t)},e.delay);zs.set(t.id,i);return}r.audioStage.add(t)},Qy=()=>{for(let r of zs.values())clearTimeout(r);zs.clear()},VR=({app:r,element:e})=>{Zy({app:r,element:e})};var WR=({app:r,prevElement:e,nextElement:t})=>{let i=e.id;if((t.delay??0)>0){r.audioStage.remove(i),Zy({app:r,element:t});return}if(HR(i)){xc(i),r.audioStage.add({id:i,url:t.src,loop:t.loop??!1,volume:We(t.volume,80)});return}let o=r.audioStage.getById(i);if(!o){r.audioStage.add({id:i,url:t.src,loop:t.loop??!1,volume:We(t.volume,80)});return}o.url=t.src,o.loop=t.loop??!1,o.volume=We(t.volume,80)};var zR=({app:r,element:e})=>{xc(e.id),r.audioStage.remove(e.id)};var dD=Ty({type:"sound",add:VR,update:WR,delete:zR});var yc=class extends Te{emitter=null;maxLife=0;age=0;oneOverLife=0;get agePercent(){return this.age*this.oneOverLife}velocity={x:0,y:0};rotationSpeed=0;config={};next=null;prev=null;constructor(e){super(),this.emitter=e,this.anchor.set(.5,.5)}init(e){this.maxLife=e,this.age=0,this.oneOverLife=1/e,this.rotation=0,this.position.set(0,0),this.scale.set(1,1),this.tint=16777215,this.alpha=1,this.visible=!0,this.velocity.x=0,this.velocity.y=0,this.rotationSpeed=0,this.config={}}kill(){this.emitter.recycle(this)}destroy(){this.parent&&this.parent.removeChild(this),this.emitter=null,this.next=null,this.prev=null,super.destroy()}};function Jy(r){let e=new Ue;return e.circle(0,0,3),e.fill({color:16777215}),r.renderer.generateTexture(e)}function e_(r){let e=new Ue;return e.rect(0,0,1,8),e.fill({color:8965375}),r.renderer.generateTexture(e)}function t_(r){let e=new Ue;return e.circle(0,0,4),e.fill({color:16777215}),r.renderer.generateTexture(e)}function _c(r,e,t){return r+(e-r)*t}function gf(r){if(typeof r=="number")return r;let e=r.replace(/^(#|0x)/,"");return parseInt(e,16)}function $R(r,e,t){let i=r>>16&255,s=r>>8&255,o=r&255,n=e>>16&255,a=e>>8&255,l=e&255,c=Math.round(_c(i,n,t)),u=Math.round(_c(s,a,t)),h=Math.round(_c(o,l,t));return c<<16|u<<8|h}var mf=class r{constructor(e,t,i=!1){this.value=i?gf(e):e,this.time=t,this.next=null}static createList(e,t=!1){let i=[...e].sort((n,a)=>n.time-a.time),s=new r(i[0].value,i[0].time,t),o=s;for(let n=1;n=t.next.time)return t.next?t.next.value:t.value;let i=(e-t.time)/(t.next.time-t.time);return this.isColor?$R(t.value,t.next.value,i):_c(t.value,t.next.value,i)}};var xf=class{static type="alpha";constructor(e){this.list=new kr(!1),this.list.reset(e.list)}initParticles(e){let t=e,i=this.list.getValue(0);for(;t;)t.alpha=i,t=t.next}updateParticle(e,t){e.alpha=this.list.getValue(e.agePercent)}},yf=class{static type="alphaStatic";constructor(e){this.alpha=e.alpha}initParticles(e){let t=e;for(;t;)t.alpha=this.alpha,t=t.next}updateParticle(e,t){}};function XR(r,e,t){return Math.min(Math.max(r,e),t)}function Bt(r,e){if(typeof e=="number")return e;let t=e.min,i=e.max??e.min;if(t===i)return t;let s=e.distribution;return!s||s.kind==="uniform"?t+r()*(i-t):s.kind==="bias"?t+fD(r,s)*(i-t):s.kind==="normal"?pD(r,t,i,s):t+r()*(i-t)}function fD(r,e){let t=e.toward??"min",i=XR(e.strength??.5,0,1),s=1+i*4;if(t==="max")return 1-Math.pow(1-r(),s);if(t==="center"){let o=(r()+r())/2;return r()*(1-i)+o*i}return Math.pow(r(),s)}function pD(r,e,t,i){let s=i.mean??(e+t)/2,o=i.deviation??(t-e)/6,n=Math.max(r(),1e-7),a=r(),l=Math.sqrt(-2*Math.log(n))*Math.cos(2*Math.PI*a);return XR(s+l*o,e,t)}var _f=class{static type="scale";constructor(e){this.list=new kr(!1),this.list.reset(e.list),this.minMult=e.minMult??1}initParticles(e){let t=e;for(;t;){let i=this.minMult<1?t.emitter.random()*(1-this.minMult)+this.minMult:1;t.config.scaleMult=i;let s=this.list.getValue(0)*i;t.scale.set(s,s),t=t.next}}updateParticle(e,t){let i=this.list.getValue(e.agePercent)*e.config.scaleMult;e.scale.set(i,i)}},bf=class{static type="scaleStatic";constructor(e){this.min=e.min,this.max=e.max,this.distribution=e.distribution}initParticles(e){let t=e;for(;t;){let i=Bt(t.emitter.random.bind(t.emitter),{min:this.min,max:this.max,distribution:this.distribution});t.scale.set(i,i),t=t.next}}updateParticle(e,t){}};var mD=Math.PI/180,vf=class{static type="speed";constructor(e){this.list=new kr(!1),this.list.reset(e.list),this.minMult=e.minMult??1}initParticles(e){let t=e;for(;t;){let i=this.minMult<1?t.emitter.random()*(1-this.minMult)+this.minMult:1;t.config.speedMult=i;let s=this.list.getValue(0)*i;t.velocity.x=Math.cos(t.rotation)*s,t.velocity.y=Math.sin(t.rotation)*s,t=t.next}}updateParticle(e,t){let i=this.list.getValue(e.agePercent)*e.config.speedMult,s=Math.sqrt(e.velocity.x*e.velocity.x+e.velocity.y*e.velocity.y);s>0&&(e.velocity.x=e.velocity.x/s*i,e.velocity.y=e.velocity.y/s*i),e.x+=e.velocity.x*t,e.y+=e.velocity.y*t}},Tf=class{static type="speedStatic";constructor(e){this.min=e.min,this.max=e.max,this.distribution=e.distribution}initParticles(e){let t=e;for(;t;){let i=Bt(t.emitter.random.bind(t.emitter),{min:this.min,max:this.max,distribution:this.distribution});t.velocity.x=Math.cos(t.rotation)*i,t.velocity.y=Math.sin(t.rotation)*i,t=t.next}}updateParticle(e,t){e.x+=e.velocity.x*t,e.y+=e.velocity.y*t}},Sf=class{static type="movePoint";constructor(e){this.speed={min:e.speed.min,max:e.speed.max??e.speed.min,distribution:e.speed.distribution},this.direction=e.direction}initParticles(e){let t=e;for(;t;){let i=Bt(t.emitter.random.bind(t.emitter),this.speed),s=Bt(t.emitter.random.bind(t.emitter),this.direction)*mD;t.velocity.x=Math.cos(s)*i,t.velocity.y=Math.sin(s)*i,t=t.next}}updateParticle(e,t){e.x+=e.velocity.x*t,e.y+=e.velocity.y*t}};var tye=Math.PI/180,wf=class{static type="acceleration";constructor(e){this.accelX=e.accel.x,this.accelY=e.accel.y,this.minStart=e.minStart,this.maxStart=e.maxStart,this.rotate=e.rotate??!1,this.maxSpeed=e.maxSpeed??0}initParticles(e){let t=e;for(;t;){let i=t.emitter.random()*(this.maxStart-this.minStart)+this.minStart;t.velocity.x=Math.cos(t.rotation)*i,t.velocity.y=Math.sin(t.rotation)*i,t=t.next}}updateParticle(e,t){let i=e.velocity,s=i.x,o=i.y;if(i.x+=this.accelX*t,i.y+=this.accelY*t,this.maxSpeed>0){let n=Math.sqrt(i.x*i.x+i.y*i.y);if(n>this.maxSpeed){let a=this.maxSpeed/n;i.x*=a,i.y*=a}}e.x+=(s+i.x)/2*t,e.y+=(o+i.y)/2*t,this.rotate&&(e.rotation=Math.atan2(i.y,i.x))}},Ef=class{static type="gravity";constructor(e){this.gravity=e.gravity}initParticles(e){}updateParticle(e,t){e.velocity.y+=this.gravity*t,e.x+=e.velocity.x*t,e.y+=e.velocity.y*t}};var bc=Math.PI/180,Af=class{static type="rotation";constructor(e){this.startRange={min:e.minStart,max:e.maxStart??e.minStart,distribution:e.startDistribution},this.speedRange={min:e.minSpeed,max:e.maxSpeed??e.minSpeed,distribution:e.speedDistribution},this.accel=(e.accel??0)*bc}initParticles(e){let t=e;for(;t;)t.rotation=Bt(t.emitter.random.bind(t.emitter),this.startRange)*bc,t.rotationSpeed=Bt(t.emitter.random.bind(t.emitter),this.speedRange)*bc,t=t.next}updateParticle(e,t){if(this.accel!==0){let i=e.rotationSpeed;e.rotationSpeed+=this.accel*t,e.rotation+=(i+e.rotationSpeed)/2*t}else e.rotation+=e.rotationSpeed*t}},Pf=class{static type="rotationStatic";constructor(e){this.range={min:e.min,max:e.max??e.min,distribution:e.distribution}}initParticles(e){let t=e;for(;t;)t.rotation=Bt(t.emitter.random.bind(t.emitter),this.range)*bc,t=t.next}updateParticle(e,t){}},Cf=class{static type="noRotation";constructor(e){this.rotation=(e.rotation??0)*bc}initParticles(e){let t=e;for(;t;)t.rotation=this.rotation,t=t.next}updateParticle(e,t){e.rotation=this.rotation}};var Mf=class{static type="color";constructor(e){this.list=new kr(!0),this.list.reset(e.list)}initParticles(e){let t=e,i=this.list.getValue(0);for(;t;)t.tint=i,t=t.next}updateParticle(e,t){e.tint=this.list.getValue(e.agePercent)}},Rf=class{static type="colorStatic";constructor(e){this.color=gf(e.color)}initParticles(e){let t=e;for(;t;)t.tint=this.color,t=t.next}updateParticle(e,t){}};var If=class{constructor(e){this.x=e.x,this.y=e.y,this.w=e.w,this.h=e.h}getRandPos(e,t){e.x=this.x+t.random()*this.w,e.y=this.y+t.random()*this.h}},Bf=class{constructor(e){this.x=e.x,this.y=e.y,this.radius=e.radius,this.innerRadius=e.innerRadius??0,this.affectRotation=e.affectRotation??!1}getRandPos(e,t){let i=t.random()*Math.PI*2,s=this.radius-this.innerRadius,o=t.random()*s+this.innerRadius;e.x=this.x+Math.cos(i)*o,e.y=this.y+Math.sin(i)*o,this.affectRotation&&(e.rotation=i)}},r_=class{constructor(e){this.x=e.x,this.y=e.y}getRandPos(e,t){e.x=this.x,e.y=this.y}},i_=class{constructor(e){this.x1=e.x1,this.y1=e.y1,this.x2=e.x2,this.y2=e.y2}getRandPos(e,t){let i=t.random();e.x=this.x1+(this.x2-this.x1)*i,e.y=this.y1+(this.y2-this.y1)*i}},gD={rect:If,rectangle:If,torus:Bf,circle:Bf,point:r_,line:i_};var kf=class{static type="spawnShape";constructor(e){let t=gD[e.type];if(!t)throw new Error(`Unknown spawn shape type: ${e.type}`);this.shape=new t(e.data)}initParticles(e){let t=e,i={x:0,y:0,rotation:void 0};for(;t;)this.shape.getRandPos(i,t.emitter),t.x=i.x,t.y=i.y,i.rotation!==void 0&&(t.rotation=i.rotation),t=t.next}updateParticle(e,t){}},Ff=class{static type="spawnBurst";constructor(e){this.x=e.x,this.y=e.y,this.spacing=(e.spacing??0)*Math.PI/180,this.startAngle=(e.startAngle??0)*Math.PI/180}initParticles(e){let t=e,i=this.startAngle;for(;t;)t.x=this.x,t.y=this.y,t.rotation=i,i+=this.spacing,t=t.next}updateParticle(e,t){}};var jR=Math.PI/180,Of=class{static type="movement";constructor(e={}){this.velocity=e.velocity??null,this.accelX=e.acceleration?.x??0,this.accelY=e.acceleration?.y??0,this.maxSpeed=e.maxSpeed??0,this.faceVelocity=e.faceVelocity??!1}initParticles(e){let t=e;for(;t;){if(this.velocity){let i=this.#t(t.emitter.random.bind(t.emitter)),s=Bt(t.emitter.random.bind(t.emitter),this.velocity.speed);t.velocity.x=Math.cos(i)*s,t.velocity.y=Math.sin(i)*s,this.faceVelocity&&s>0&&(t.rotation=i)}t=t.next}}updateParticle(e,t){let i=e.velocity;if(this.accelX!==0||this.accelY!==0){let o=i.x,n=i.y;i.x+=this.accelX*t,i.y+=this.accelY*t,this.#e(i),e.x+=(o+i.x)/2*t,e.y+=(n+i.y)/2*t}else this.#e(i),e.x+=i.x*t,e.y+=i.y*t;this.faceVelocity&&Math.sqrt(i.x*i.x+i.y*i.y)>0&&(e.rotation=Math.atan2(i.y,i.x))}#t(e){return this.velocity?this.velocity.kind==="radial"?Bt(e,this.velocity.angle??{min:0,max:360})*jR:Bt(e,this.velocity.direction??0)*jR:0}#e(e){if(this.maxSpeed<=0)return;let t=Math.sqrt(e.x*e.x+e.y*e.y);if(t>this.maxSpeed&&t>0){let i=this.maxSpeed/t;e.x*=i,e.y*=i}}};var YR=new Map,qR=new Map;function s_(r,e){YR.set(r,e)}function Et(r){qR.set(r.type,r)}function KR(r,e){let t=YR.get(r);return t?t(e):null}function ZR(r){return qR.get(r)}s_("circle",t_);s_("snowflake",Jy);s_("raindrop",e_);Et(xf);Et(yf);Et(_f);Et(bf);Et(vf);Et(Tf);Et(Sf);Et(wf);Et(Ef);Et(Af);Et(Pf);Et(Cf);Et(Mf);Et(Rf);Et(kf);Et(Ff);Et(Of);var Uf=class{constructor(e){this.seed=e,this.state=e}next(){let e=this.state+=1831565813;return e=Math.imul(e^e>>>15,e|1),e^=e+Math.imul(e^e>>>7,e|61),((e^e>>>14)>>>0)/4294967296}reset(){this.state=this.seed}};function xD(r){return typeof r=="object"&&r!==null&&!Array.isArray(r)&&typeof r.mode=="string"&&Array.isArray(r.items)}var vc=class{container=null;texture=null;textureSelector=null;_textureCycleIndex=0;_activeFirst=null;_activeLast=null;_poolFirst=null;particleCount=0;maxParticles=1e3;lifetime={min:1,max:2};frequency=.1;particlesPerWave=1;_spawnTimer=0;emitterLifetime=-1;_emitterAge=0;emit=!0;destroyed=!1;initBehaviors=[];updateBehaviors=[];recycleBehaviors=[];spawnBounds=null;recycleOnBounds=!1;rng=null;constructor(e,t){this.container=e,this.init(t)}init(e){if(this.rng=e.seed!==void 0&&e.seed!==null?new Uf(e.seed):null,e.texture&&(xD(e.texture)?(this.textureSelector=e.texture,this.texture=e.texture.items[0]?.texture??null):(this.textureSelector=null,this.texture=e.texture)),this._textureCycleIndex=0,e.lifetime&&(this.lifetime.min=e.lifetime.min??1,this.lifetime.max=e.lifetime.max??e.lifetime.min??2,this.lifetime.distribution=e.lifetime.distribution),this.frequency=e.frequency??.1,this.particlesPerWave=e.particlesPerWave??1,this.maxParticles=e.maxParticles??1e3,this.emitterLifetime=e.emitterLifetime??-1,this.spawnBounds=null,this.recycleOnBounds=!1,e.spawnBounds&&(this.spawnBounds=e.spawnBounds,this.recycleOnBounds=e.recycleOnBounds??!1),this.initBehaviors=[],this.updateBehaviors=[],this.recycleBehaviors=[],e.behaviors)for(let t of e.behaviors){let i=ZR(t.type);if(!i){console.warn(`Unknown behavior type: ${t.type}`);continue}let s=new i(t.config);s.initParticles&&this.initBehaviors.push(s),s.updateParticle&&this.updateBehaviors.push(s),s.recycleParticle&&this.recycleBehaviors.push(s)}this._spawnTimer=0,this._emitterAge=0,this.emit=e.emit??!0}_createParticle(){let e;return this._poolFirst?(e=this._poolFirst,this._poolFirst=e.next,e.next=null):e=new yc(this),e}spawn(e){if(this.destroyed||e<=0)return null;let t=this.maxParticles-this.particleCount;if(e=Math.min(e,t),e<=0)return null;let i=this.textureSelector?.pick==="perWave"?this._pickTexture():null,s=null,o=null;for(let n=0;n0&&(this._emitterAge+=e,this._emitterAge>=this.emitterLifetime&&(this.emit=!1)),this.emit)if(this.frequency<=0)this.spawn(this.particlesPerWave),this.emit=!1;else for(this._spawnTimer+=e;this._spawnTimer>=this.frequency;)this._spawnTimer-=this.frequency,this.spawn(this.particlesPerWave);let t=this._activeFirst;for(;t;){let i=t.next;if(t.age+=e,t.age>=t.maxLife){this.recycle(t),t=i;continue}if(this.recycleOnBounds&&this.spawnBounds){let s=this.spawnBounds;if(t.xs.x+s.width||t.ys.y+s.height){this.recycle(t),t=i;continue}}for(let s of this.updateBehaviors)s.updateParticle(t,e);t=i}}stop(e=!1){if(this.emit=!1,e)for(;this._activeFirst;)this.recycle(this._activeFirst)}restart(){this._emitterAge=0,this._spawnTimer=0,this.emit=!0}random(){return this.rng?this.rng.next():Math.random()}_pickTexture(){if(!this.textureSelector)return this.texture;let{mode:e,items:t}=this.textureSelector;if(!t.length)return this.texture;if(e==="cycle"){let i=t[this._textureCycleIndex%t.length];return this._textureCycleIndex+=1,i.texture}if(e==="random"){let i=t.reduce((o,n)=>o+(n.weight??1),0),s=this.random()*i;for(let o of t)if(s-=o.weight??1,s<=0)return o.texture;return t[t.length-1].texture}return t[0].texture}destroy(){if(this.destroyed)return;this.destroyed=!0,this.emit=!1;let e=this._activeFirst;for(;e;){let t=e.next;e.destroy(),e=t}for(e=this._poolFirst;e;){let t=e.next;e.destroy(),e=t}this._activeFirst=null,this._activeLast=null,this._poolFirst=null,this.initBehaviors=[],this.updateBehaviors=[],this.recycleBehaviors=[]}};function yD(r){return typeof r=="object"&&r!==null&&!Array.isArray(r)&&typeof r.mode=="string"&&Array.isArray(r.items)}function _D(r,e){let t=new Ue,i=e.color??"#ffffff";switch(e.shape){case"circle":{let s=e.radius??3;t.circle(0,0,s),t.fill({color:i});break}case"ellipse":{let s=e.width??2,o=e.height??6;t.ellipse(0,0,s/2,o/2),t.fill({color:i});break}case"rect":{let s=e.width??4,o=e.height??4;t.rect(-s/2,-o/2,s,o),t.fill({color:i});break}default:t.circle(0,0,3),t.fill({color:i})}return r.renderer.generateTexture(t)}function QR(r,e){if(typeof e=="object"&&e?.shape)return _D(r,e);let t=e??"circle",i=KR(t,r);if(!i)try{i=k.from(t)}catch{return console.warn(`Failed to load particle texture: ${t}`),null}return i}function bD(r,e){let t=[];for(let i of e.items){let s=i.src?i.src:i,o=QR(r,s);if(!o)return null;t.push(i.weight===void 0?{texture:o}:{texture:o,weight:i.weight})}return{mode:e.mode,pick:e.pick??"perParticle",items:t}}var Tc=({app:r,parent:e,element:t,renderContext:i,zIndex:s})=>{let o=new te;o.label=t.id,o.zIndex=s,e.addChild(o);let n=t.width,a=t.height;o.x=t.x??0,o.y=t.y??0;let l={lifetime:t.emitter?.lifetime??{min:1,max:2},frequency:t.emitter?.frequency??.1,particlesPerWave:t.emitter?.particlesPerWave??1,maxParticles:t.emitter?.maxParticles??t.count??100,emitterLifetime:t.emitter?.emitterLifetime??-1,spawnBounds:t.emitter?.spawnBounds,recycleOnBounds:t.emitter?.recycleOnBounds??!1,seed:t.emitter?.seed,behaviors:t.behaviors},c=yD(t.texture)?bD(r,t.texture):QR(r,t.texture);if(!c)return;l.texture=c;let u=new vc(o,l);o.emitter=u;let h=l.frequency<=0;if(h){u.emitNow(),u.emit=!1;let f=p=>{if(!p.length)return;let[m,...g]=p;(m===0&&typeof requestAnimationFrame=="function"?requestAnimationFrame:v=>setTimeout(v,m))(()=>{u.destroyed||u.particleCount>0||(u.emitNow(),f(g))})};f([0,50,150])}if(l.recycleOnBounds&&!h){let f=Math.min(t.count??100,l.maxParticles);u.spawn(f);let p=u._activeFirst;for(;p;)p.y=u.random()*a,p.age=u.random()*p.maxLife*.8,p=p.next}let d=f=>{if(u.destroyed){r.ticker.remove(d);return}let p=Math.min(typeof f.deltaMS=="number"?f.deltaMS/1e3:f.deltaTime/60,.1);u.update(p)};o.tickerCallback=d,hM(i,{app:r,emitter:u,container:o,tickerCallback:d}),t.alpha!==void 0&&(o.alpha=t.alpha)};var Gf=({app:r,parent:e,element:t,animationBus:i,animations:s,completionTracker:o})=>{let n=e.getChildByLabel(t.id);if(!n)return;let a=()=>{n&&!n.destroyed&&(n.emitter&&n.emitter.destroy(),n.tickerCallback&&r.ticker.remove(n.tickerCallback),n.customTickerHandler&&window.removeEventListener("snapShotKeyFrame",n.customTickerHandler),n.destroy({children:!0}))};ne({animations:s,targetId:t.id,animationBus:i,completionTracker:o,element:n,targetState:null,onComplete:a})||a()};var JR=({app:r,parent:e,prevElement:t,nextElement:i,animations:s,animationBus:o,completionTracker:n,renderContext:a,zIndex:l})=>{let c=e.children.find(h=>h.label===t.id);if(!c){Tc({app:r,parent:e,element:i,animations:s,animationBus:o,completionTracker:n,renderContext:a,zIndex:l});return}if(c.zIndex=l,vD(t,i))Gf({app:r,parent:e,element:t,animations:s,animationBus:o,completionTracker:n}),Tc({app:r,parent:e,element:i,animations:s,animationBus:o,completionTracker:n,renderContext:a,zIndex:l});else{let h=()=>{i.alpha!==void 0&&(c.alpha=i.alpha),i.x!==void 0&&(c.x=i.x),i.y!==void 0&&(c.y=i.y)};ne({animations:s,targetId:t.id,animationBus:o,completionTracker:n,element:c,targetState:{x:i.x??c.x,y:i.y??c.y,alpha:i.alpha??c.alpha},onComplete:h})||h()}};function vD(r,e){return r.count!==e.count||!pe(r.texture,e.texture)||!pe(r.behaviors,e.behaviors)||!pe(r.emitter,e.emitter)||r.width!==e.width||r.height!==e.height}function o_(r){if(!r.id)throw new Error("Input Error: Id is missing");if(!Object.values(Us).includes(r.type))throw new Error("Input Error: Type must be one of "+Object.values(Us).join(", "));if(typeof r.width!="number"||typeof r.height!="number")throw new Error("Input Error: Width and height must be numbers");if(r.width<=0||r.height<=0)throw new Error("Input Error: Width and height must be positive")}function eI(r){if(!r.texture)throw new Error("Input Error: Particles require 'texture'");let e=typeof r.texture=="string",t=typeof r.texture=="object"&&r.texture!==null&&!Array.isArray(r.texture);if(!e&&!t)throw new Error("Input Error: texture must be a string or shape object");if(t){if(!r.texture.shape)throw new Error("Input Error: texture object must have 'shape' property");if(!["circle","ellipse","rect"].includes(r.texture.shape))throw new Error(`Input Error: texture.shape must be 'circle', 'ellipse', or 'rect', got '${r.texture.shape}'`)}}function tI(r){if(!r.behaviors)throw new Error("Input Error: Particles require 'behaviors'");if(!Array.isArray(r.behaviors))throw new Error("Input Error: 'behaviors' must be an array");if(r.behaviors.length===0)throw new Error("Input Error: 'behaviors' array cannot be empty");for(let e=0;er.emitter.lifetime.max)throw new Error("Input Error: emitter.lifetime.min cannot be greater than max")}function iI(r){if(r.emitter.frequency!==void 0){if(typeof r.emitter.frequency!="number")throw new Error("Input Error: emitter.frequency must be a number");if(r.emitter.frequency<0)throw new Error("Input Error: emitter.frequency must be non-negative")}if(r.emitter.particlesPerWave!==void 0){if(typeof r.emitter.particlesPerWave!="number")throw new Error("Input Error: emitter.particlesPerWave must be a number");if(r.emitter.particlesPerWave<=0)throw new Error("Input Error: emitter.particlesPerWave must be positive");if(!Number.isInteger(r.emitter.particlesPerWave))throw new Error("Input Error: emitter.particlesPerWave must be an integer")}if(r.emitter.maxParticles!==void 0){if(typeof r.emitter.maxParticles!="number")throw new Error("Input Error: emitter.maxParticles must be a number");if(r.emitter.maxParticles<=0)throw new Error("Input Error: emitter.maxParticles must be positive");if(!Number.isInteger(r.emitter.maxParticles))throw new Error("Input Error: emitter.maxParticles must be an integer")}}function sI(r){if(r.count!==void 0){if(typeof r.count!="number")throw new Error("Input Error: count must be a number");if(r.count<=0)throw new Error("Input Error: count must be positive");if(!Number.isInteger(r.count))throw new Error("Input Error: count must be an integer")}if(r.alpha!==void 0){if(typeof r.alpha!="number")throw new Error("Input Error: alpha must be a number");if(r.alpha<0||r.alpha>1)throw new Error("Input Error: alpha must be between 0 and 1")}if(r.x!==void 0&&typeof r.x!="number")throw new Error("Input Error: x must be a number");if(r.y!==void 0&&typeof r.y!="number")throw new Error("Input Error: y must be a number")}var TD=new Set(["continuous","burst"]),SD=new Set(["point","rect","circle","line"]),wD=new Set(["single","random","cycle"]),ED=new Set(["perParticle","perWave"]),oI=new Set(["uniform","normal","bias"]),nI=new Set(["min","max","center"]),AD=new Set(["none","fixed","random","spin"]);function uI(r){if(PD(r),!r.modules||typeof r.modules!="object"||Array.isArray(r.modules))throw new Error("Input Error: Particles require 'modules'");let{emission:e,movement:t,appearance:i,bounds:s}=r.modules;if(!e||typeof e!="object"||Array.isArray(e))throw new Error("Input Error: modules.emission must be an object");if(!i||typeof i!="object"||Array.isArray(i))throw new Error("Input Error: modules.appearance must be an object");CD(e),RD(t,i),ID(i),UD(s)}function PD(r){if(r.texture!==void 0||r.behaviors!==void 0||r.emitter!==void 0)throw new Error("Input Error: Structured particles cannot mix 'modules' with legacy texture/behaviors/emitter fields");if(r.count!==void 0)throw new Error("Input Error: Structured particles do not support legacy 'count'");if(r.alpha!==void 0&&(ce(r.alpha,"alpha"),r.alpha<0||r.alpha>1))throw new Error("Input Error: alpha must be between 0 and 1");r.x!==void 0&&ce(r.x,"x"),r.y!==void 0&&ce(r.y,"y"),r.seed!==void 0&&ce(r.seed,"seed")}function CD(r){if(!TD.has(r.mode))throw new Error("Input Error: modules.emission.mode must be 'continuous' or 'burst'");if(r.mode==="continuous"){if(ce(r.rate,"modules.emission.rate"),r.rate<=0)throw new Error("Input Error: modules.emission.rate must be positive")}else if(cI(r.burstCount,"modules.emission.burstCount"),r.burstCount<=0)throw new Error("Input Error: modules.emission.burstCount must be positive");if(r.maxActive!==void 0&&(cI(r.maxActive,"modules.emission.maxActive"),r.maxActive<=0))throw new Error("Input Error: modules.emission.maxActive must be positive");if(r.duration!==void 0&&r.duration!=="infinite"&&(ce(r.duration,"modules.emission.duration"),r.duration<0))throw new Error("Input Error: modules.emission.duration must be non-negative");if(ss(r.particleLifetime,"modules.emission.particleLifetime",{allowNegative:!1}),!r.source||typeof r.source!="object"||Array.isArray(r.source))throw new Error("Input Error: modules.emission.source must be an object");if(!SD.has(r.source.kind))throw new Error("Input Error: modules.emission.source.kind must be one of point, rect, circle, line");if(!r.source.data||typeof r.source.data!="object"||Array.isArray(r.source.data))throw new Error("Input Error: modules.emission.source.data must be an object");MD(r.source.kind,r.source.data)}function MD(r,e){if(r==="point"){ce(e.x,"modules.emission.source.data.x"),ce(e.y,"modules.emission.source.data.y");return}if(r==="rect"){if(ce(e.x,"modules.emission.source.data.x"),ce(e.y,"modules.emission.source.data.y"),ce(e.width,"modules.emission.source.data.width"),ce(e.height,"modules.emission.source.data.height"),e.width<=0||e.height<=0)throw new Error("Input Error: modules.emission.source.data.width and height must be positive");return}if(r==="circle"){if(ce(e.x,"modules.emission.source.data.x"),ce(e.y,"modules.emission.source.data.y"),ce(e.radius,"modules.emission.source.data.radius"),e.radius<=0)throw new Error("Input Error: modules.emission.source.data.radius must be positive");if(e.innerRadius!==void 0&&(ce(e.innerRadius,"modules.emission.source.data.innerRadius"),e.innerRadius<0||e.innerRadius>e.radius))throw new Error("Input Error: modules.emission.source.data.innerRadius must be between 0 and radius");if(e.affectRotation!==void 0&&typeof e.affectRotation!="boolean")throw new Error("Input Error: modules.emission.source.data.affectRotation must be a boolean");return}ce(e.x1,"modules.emission.source.data.x1"),ce(e.y1,"modules.emission.source.data.y1"),ce(e.x2,"modules.emission.source.data.x2"),ce(e.y2,"modules.emission.source.data.y2")}function RD(r,e){if(r!==void 0){if(!r||typeof r!="object"||Array.isArray(r))throw new Error("Input Error: modules.movement must be an object");if(r.velocity!==void 0){if(!r.velocity||typeof r.velocity!="object"||Array.isArray(r.velocity))throw new Error("Input Error: modules.movement.velocity must be an object");let{velocity:t}=r;if(t.kind!=="directional"&&t.kind!=="radial")throw new Error("Input Error: modules.movement.velocity.kind must be 'directional' or 'radial'");ss(t.speed,"modules.movement.velocity.speed",{allowNegative:!1}),t.kind==="directional"?ss(t.direction,"modules.movement.velocity.direction",{allowNegative:!0}):t.angle!==void 0&&ss(t.angle,"modules.movement.velocity.angle",{allowNegative:!0})}if(r.acceleration!==void 0){if(!r.acceleration||typeof r.acceleration!="object"||Array.isArray(r.acceleration))throw new Error("Input Error: modules.movement.acceleration must be an object");ce(r.acceleration.x,"modules.movement.acceleration.x"),ce(r.acceleration.y,"modules.movement.acceleration.y")}if(r.maxSpeed!==void 0&&(ce(r.maxSpeed,"modules.movement.maxSpeed"),r.maxSpeed<0))throw new Error("Input Error: modules.movement.maxSpeed must be non-negative");if(r.faceVelocity!==void 0&&typeof r.faceVelocity!="boolean")throw new Error("Input Error: modules.movement.faceVelocity must be a boolean");if(!r.velocity&&!r.acceleration)throw new Error("Input Error: modules.movement must define velocity, acceleration, or both");if(r.faceVelocity&&e?.rotation&&e.rotation.mode!=="none")throw new Error("Input Error: modules.appearance.rotation cannot be combined with modules.movement.faceVelocity")}}function ID(r){BD(r.texture),r.scale!==void 0&&aI(r.scale,"modules.appearance.scale",{allowNegative:!1,modes:["single","range","curve"]}),r.alpha!==void 0&&aI(r.alpha,"modules.appearance.alpha",{min:0,max:1,modes:["single","curve"]}),r.color!==void 0&&FD(r.color,"modules.appearance.color"),r.rotation!==void 0&&OD(r.rotation)}function BD(r){if(r===void 0)throw new Error("Input Error: modules.appearance.texture is required");if(typeof r!="string"){if(!r||typeof r!="object"||Array.isArray(r))throw new Error("Input Error: modules.appearance.texture must be a string or object");if(r.shape){hI(r,"modules.appearance.texture");return}if(!wD.has(r.mode))throw new Error("Input Error: modules.appearance.texture.mode must be 'single', 'random', or 'cycle'");if(r.pick!==void 0&&!ED.has(r.pick))throw new Error("Input Error: modules.appearance.texture.pick must be 'perParticle' or 'perWave'");if(!Array.isArray(r.items)||r.items.length===0)throw new Error("Input Error: modules.appearance.texture.items must be a non-empty array");if(r.mode==="single"&&r.items.length!==1)throw new Error("Input Error: modules.appearance.texture.mode 'single' requires exactly one item");for(let e=0;e1)throw new Error(`Input Error: ${e}.keys[${s}].time must be between 0 and 1`);if(o.time1)throw new Error(`Input Error: ${e}.keys[${i}].time must be between 0 and 1`);if(s.time(r.max??r.min))throw new Error(`Input Error: ${e}.min cannot be greater than max`);r.distribution!==void 0&&LD(r.distribution,`${e}.distribution`)}function Sc(r,e,t={}){if(ce(r,e),!t.allowNegative&&r<0)throw new Error(`Input Error: ${e} must be non-negative`);if(t.min!==void 0&&rt.max)throw new Error(`Input Error: ${e} must be at most ${t.max}`)}function LD(r,e){if(!r||typeof r!="object"||Array.isArray(r))throw new Error(`Input Error: ${e} must be an object`);if(!oI.has(r.kind))throw new Error(`Input Error: ${e}.kind must be one of ${[...oI].join(", ")}`);if(r.kind==="bias"){if(!nI.has(r.toward??"min"))throw new Error(`Input Error: ${e}.toward must be one of ${[...nI].join(", ")}`);r.strength!==void 0&&ce(r.strength,`${e}.strength`)}r.kind==="normal"&&(r.mean!==void 0&&ce(r.mean,`${e}.mean`),r.deviation!==void 0&&ce(r.deviation,`${e}.deviation`))}function ce(r,e){if(typeof r!="number"||Number.isNaN(r))throw new Error(`Input Error: ${e} must be a number`)}function cI(r,e){if(ce(r,e),!Number.isInteger(r))throw new Error(`Input Error: ${e} must be an integer`)}function dI(r){let e=DD(r),t=[];t.push(ND(r.modules.emission.source));let i=VD(r.modules.movement);i&&t.push(i),t.push(...WD(r.modules.appearance));let s=KD(r.modules.bounds,r.width,r.height);s&&(e.spawnBounds=s.spawnBounds,e.recycleOnBounds=!0);let o=zD(r.modules.appearance.texture),n=e.maxParticles;return{id:r.id,type:r.type,count:n,texture:o,behaviors:t,emitter:e,x:r.x??0,y:r.y??0,width:r.width,height:r.height,alpha:r.alpha??1}}function DD(r){let{emission:e}=r.modules,t={lifetime:os(e.particleLifetime),maxParticles:e.mode==="burst"?Math.max(e.maxActive??e.burstCount,e.burstCount):e.maxActive??100,emitterLifetime:e.duration===void 0||e.duration==="infinite"?-1:e.duration,seed:r.seed};return e.mode==="continuous"?(t.frequency=1/e.rate,t.particlesPerWave=1):(t.frequency=0,t.particlesPerWave=e.burstCount),t}function ND(r){return{type:"spawnShape",config:{type:r.kind,data:HD(r.kind,r.data)}}}function HD(r,e){return r==="rect"?{x:e.x,y:e.y,w:e.width,h:e.height}:{...e}}function VD(r){if(!r)return null;let e={maxSpeed:r.maxSpeed??0,faceVelocity:r.faceVelocity??!1};return r.velocity&&(e.velocity={kind:r.velocity.kind,speed:os(r.velocity.speed)},r.velocity.kind==="directional"?e.velocity.direction=os(r.velocity.direction):e.velocity.angle=os(r.velocity.angle??{min:0,max:360})),r.acceleration&&(e.acceleration={x:r.acceleration.x,y:r.acceleration.y}),{type:"movement",config:e}}function WD(r){let e=[];if(r.scale&&e.push(XD(r.scale)),r.alpha&&e.push(jD(r.alpha)),r.color&&e.push(YD(r.color)),r.rotation){let t=qD(r.rotation);t&&e.push(t)}return e}function zD(r){if(typeof r=="string")return r;if(r.shape)return{...r};let e={mode:r.mode,pick:r.pick??"perParticle",items:r.items.map($D)};if(e.mode==="single"&&e.items.length===1){let[t]=e.items;return t.src??fI(t)}return e}function $D(r){if(r.src)return r.weight===void 0?{src:r.src}:{src:r.src,weight:r.weight};let e=fI(r);return r.weight!==void 0&&(e.weight=r.weight),e}function fI(r){return{shape:r.shape,...r.radius!==void 0?{radius:r.radius}:{},...r.width!==void 0?{width:r.width}:{},...r.height!==void 0?{height:r.height}:{},...r.color!==void 0?{color:r.color}:{}}}function XD(r){return r.mode==="curve"?{type:"scale",config:{list:n_(r.keys)}}:{type:"scaleStatic",config:r.mode==="single"?{min:r.value,max:r.value}:os(r)}}function jD(r){return r.mode==="curve"?{type:"alpha",config:{list:n_(r.keys)}}:{type:"alphaStatic",config:{alpha:r.value}}}function YD(r){return r.mode==="gradient"?{type:"color",config:{list:n_(r.keys)}}:{type:"colorStatic",config:{color:r.value}}}function qD(r){if(r.mode==="none")return null;if(r.mode==="fixed")return{type:"noRotation",config:{rotation:r.value}};if(r.mode==="random"){let i=os(r);return{type:"rotationStatic",config:{min:i.min,max:i.max,distribution:i.distribution}}}let e=os(r.start),t=os(r.speed);return{type:"rotation",config:{minStart:e.min,maxStart:e.max,startDistribution:e.distribution,minSpeed:t.min,maxSpeed:t.max,speedDistribution:t.distribution,accel:r.accel??0}}}function KD(r,e,t){if(!r||r.mode==="none")return null;if(r.source==="custom")return{spawnBounds:{...r.custom}};let i=ZD(r.padding??0);return{spawnBounds:{x:-i.left,y:-i.top,width:e+i.left+i.right,height:t+i.top+i.bottom}}}function ZD(r){return typeof r=="number"?{top:r,right:r,bottom:r,left:r}:{top:r.top,right:r.right,bottom:r.bottom,left:r.left}}function n_(r){return r.map(e=>({time:e.time,value:e.value}))}function os(r){return typeof r=="number"?{min:r,max:r}:{min:r.min,max:r.max??r.min,...r.distribution!==void 0?{distribution:{...r.distribution}}:{}}}var pI=({state:r})=>{if(r.modules)return o_(r),uI(r),dI(r);o_(r),eI(r),tI(r),rI(r),iI(r),sI(r);let e=r.emitter?.maxParticles??r.count??100,t=r.emitter;return t&&t.maxParticles===void 0&&r.count!==void 0&&(t={...t,maxParticles:e}),{id:r.id,type:r.type,count:e,texture:r.texture,behaviors:r.behaviors,emitter:t,x:r.x??0,y:r.y??0,width:r.width,height:r.height,alpha:r.alpha??1}};var QD=et({type:"particles",add:Tc,update:JR,delete:Gf,parse:pI});var mI=(r=[],e=[])=>{let t=new Set,i=new Map,s=new Map,o=[],n=[],a=[];for(let l of r)t.add(l.id),i.set(l.id,l);for(let l of e)t.add(l.id),s.set(l.id,l);for(let l of t){let c=i.get(l),u=s.get(l);!c&&u?o.push(u):c&&!u?n.push(c):(c.src!==u.src||c.volume!==u.volume||c.loop!==u.loop||c.delay!==u.delay)&&a.push({prev:c,next:u})}return{toAddElement:o,toDeleteElement:n,toUpdateElement:a}};var a_=({app:r,prevAudioTree:e,nextAudioTree:t,audioPlugins:i})=>{let{toAddElement:s,toDeleteElement:o,toUpdateElement:n}=mI(e,t);for(let a of o){let l=i.find(c=>c.type===a.type);if(!l)throw new Error(`No audio plugin found for type: ${a.type}`);l.delete({app:r,element:a})}for(let a of s){let l=i.find(c=>c.type===a.type);if(!l)throw new Error(`No audio plugin found for type: ${a.type}`);l.add({app:r,element:a})}for(let{prev:a,next:l}of n){let c=i.find(u=>u.type===l.type);if(!c)throw new Error(`No audio plugin found for type: ${l.type}`);c.update({app:r,prevElement:a,nextElement:l})}};var sr=(r=>(r[r.WEBGL_LEGACY=0]="WEBGL_LEGACY",r[r.WEBGL=1]="WEBGL",r[r.WEBGL2=2]="WEBGL2",r))(sr||{}),l_=(r=>(r[r.UNKNOWN=0]="UNKNOWN",r[r.WEBGL=1]="WEBGL",r[r.CANVAS=2]="CANVAS",r))(l_||{}),Lf=(r=>(r[r.COLOR=16384]="COLOR",r[r.DEPTH=256]="DEPTH",r[r.STENCIL=1024]="STENCIL",r))(Lf||{}),re=(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))(re||{}),Bn=(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))(Bn||{}),H=(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))(H||{}),wi=(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))(wi||{}),ae=(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))(ae||{}),z=(r=>(r[r.FLOAT=0]="FLOAT",r[r.INT=1]="INT",r[r.UINT=2]="UINT",r))(z||{}),vr=(r=>(r[r.NEAREST=0]="NEAREST",r[r.LINEAR=1]="LINEAR",r))(vr||{}),wc=(r=>(r[r.CLAMP=33071]="CLAMP",r[r.REPEAT=10497]="REPEAT",r[r.MIRRORED_REPEAT=33648]="MIRRORED_REPEAT",r))(wc||{}),Fr=(r=>(r[r.OFF=0]="OFF",r[r.POW2=1]="POW2",r[r.ON=2]="ON",r[r.ON_MANUAL=3]="ON_MANUAL",r))(Fr||{}),or=(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))(or||{}),ns=(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))(ns||{}),Df=(r=>(r[r.AUTO=0]="AUTO",r[r.MANUAL=1]="MANUAL",r))(Df||{}),Wt=(r=>(r.LOW="lowp",r.MEDIUM="mediump",r.HIGH="highp",r))(Wt||{}),at=(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))(at||{});var Pe=(r=>(r[r.NONE=0]="NONE",r[r.LOW=2]="LOW",r[r.MEDIUM=4]="MEDIUM",r[r.HIGH=8]="HIGH",r))(Pe||{}),Qt=(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))(Qt||{});var c_={createCanvas:(r,e)=>{let t=document.createElement("canvas");return t.width=r,t.height=e,t},getCanvasRenderingContext2D:()=>CanvasRenderingContext2D,getWebGLRenderingContext:()=>WebGLRenderingContext,getNavigator:()=>navigator,getBaseUrl:()=>document.baseURI??window.location.href,getFontFaceSet:()=>document.fonts,fetch:(r,e)=>fetch(r,e),parseXML:r=>new DOMParser().parseFromString(r,"text/xml")};var K={ADAPTER:c_,RESOLUTION:1,CREATE_IMAGE_BITMAP:!1,ROUND_PIXELS:!1};gm();var JD=Gi.default??Gi,Or=JD(globalThis.navigator);K.RETINA_PREFIX=/@([0-9\.]+)x/;K.FAIL_IF_MAJOR_PERFORMANCE_CAVEAT=!1;var Zs=fs(xI(),1),zH=fs(mh(),1);var W_=fs(kk(),1);var Fk={};function fe(r,e,t=3){if(Fk[e])return;let i=new Error().stack;typeof i>"u"?console.warn("PixiJS Deprecation Warning: ",`${e} Deprecated since v${r}`):(i=i.split(` `).splice(t).join(` `),console.groupCollapsed?(console.groupCollapsed("%cPixiJS Deprecation Warning: %c%s","color:#614108;background:#fffbe6","font-weight:normal;color:#614108;background:#fffbe6",`${e} Deprecated since v${r}`),console.warn(i),console.groupEnd()):(console.warn("PixiJS Deprecation Warning: ",`${e} Deprecated since v${r}`),console.warn(i))),Fk[e]=!0}var z_;function $_(){return typeof z_>"u"&&(z_=function(){let r={stencil:!0,failIfMajorPerformanceCaveat:K.FAIL_IF_MAJOR_PERFORMANCE_CAVEAT};try{if(!K.ADAPTER.getWebGLRenderingContext())return!1;let e=K.ADAPTER.createCanvas(),t=e.getContext("webgl",r)||e.getContext("experimental-webgl",r),i=!!t?.getContextAttributes()?.stencil;if(t){let s=t.getExtension("WEBGL_lose_context");s&&s.loseContext()}return t=null,i}catch{return!1}}()),z_}Vp();Wp();Au([Pu]);var Wn=class tp{constructor(e=16777215){this._value=null,this._components=new Float32Array(4),this._components.fill(1),this._int=16777215,this.value=e}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(e){return this.value=e,this}set value(e){if(e instanceof tp)this._value=this.cloneSource(e._value),this._int=e._int,this._components.set(e._components);else{if(e===null)throw new Error("Cannot set PIXI.Color#value to null");(this._value===null||!this.isSourceEqual(this._value,e))&&(this.normalize(e),this._value=this.cloneSource(e))}}get value(){return this._value}cloneSource(e){return typeof e=="string"||typeof e=="number"||e instanceof Number||e===null?e:Array.isArray(e)||ArrayBuffer.isView(e)?e.slice(0):typeof e=="object"&&e!==null?{...e}:e}isSourceEqual(e,t){let i=typeof e;if(i!==typeof t)return!1;if(i==="number"||i==="string"||e instanceof Number)return e===t;if(Array.isArray(e)&&Array.isArray(t)||ArrayBuffer.isView(e)&&ArrayBuffer.isView(t))return e.length!==t.length?!1:e.every((s,o)=>s===t[o]);if(e!==null&&t!==null){let s=Object.keys(e),o=Object.keys(t);return s.length!==o.length?!1:s.every(n=>e[n]===t[n])}return e===t}toRgba(){let[e,t,i,s]=this._components;return{r:e,g:t,b:i,a:s}}toRgb(){let[e,t,i]=this._components;return{r:e,g:t,b:i}}toRgbaString(){let[e,t,i]=this.toUint8RgbArray();return`rgba(${e},${t},${i},${this.alpha})`}toUint8RgbArray(e){let[t,i,s]=this._components;return e=e??[],e[0]=Math.round(t*255),e[1]=Math.round(i*255),e[2]=Math.round(s*255),e}toRgbArray(e){e=e??[];let[t,i,s]=this._components;return e[0]=t,e[1]=i,e[2]=s,e}toNumber(){return this._int}toLittleEndianNumber(){let e=this._int;return(e>>16)+(e&65280)+((e&255)<<16)}multiply(e){let[t,i,s,o]=tp.temp.setValue(e)._components;return this._components[0]*=t,this._components[1]*=i,this._components[2]*=s,this._components[3]*=o,this.refreshInt(),this._value=null,this}premultiply(e,t=!0){return t&&(this._components[0]*=e,this._components[1]*=e,this._components[2]*=e),this._components[3]=e,this.refreshInt(),this._value=null,this}toPremultiplied(e,t=!0){if(e===1)return(255<<24)+this._int;if(e===0)return t?0:this._int;let i=this._int>>16&255,s=this._int>>8&255,o=this._int&255;return t&&(i=i*e+.5|0,s=s*e+.5|0,o=o*e+.5|0),(e*255<<24)+(i<<16)+(s<<8)+o}toHex(){let e=this._int.toString(16);return`#${"000000".substring(0,6-e.length)+e}`}toHexa(){let e=Math.round(this._components[3]*255).toString(16);return this.toHex()+"00".substring(0,2-e.length)+e}setAlpha(e){return this._components[3]=this._clamp(e),this}round(e){let[t,i,s]=this._components;return this._components[0]=Math.round(t*e)/e,this._components[1]=Math.round(i*e)/e,this._components[2]=Math.round(s*e)/e,this.refreshInt(),this._value=null,this}toArray(e){e=e??[];let[t,i,s,o]=this._components;return e[0]=t,e[1]=i,e[2]=s,e[3]=o,e}normalize(e){let t,i,s,o;if((typeof e=="number"||e instanceof Number)&&e>=0&&e<=16777215){let n=e;t=(n>>16&255)/255,i=(n>>8&255)/255,s=(n&255)/255,o=1}else if((Array.isArray(e)||e instanceof Float32Array)&&e.length>=3&&e.length<=4)e=this._clamp(e),[t,i,s,o=1]=e;else if((e instanceof Uint8Array||e instanceof Uint8ClampedArray)&&e.length>=3&&e.length<=4)e=this._clamp(e,0,255),[t,i,s,o=255]=e,t/=255,i/=255,s/=255,o/=255;else if(typeof e=="string"||typeof e=="object"){if(typeof e=="string"){let a=tp.HEX_PATTERN.exec(e);a&&(e=`#${a[2]}`)}let n=Jt(e);n.isValid()&&({r:t,g:i,b:s,a:o}=n.rgba,t/=255,i/=255,s/=255)}if(t!==void 0)this._components[0]=t,this._components[1]=i,this._components[2]=s,this._components[3]=o,this.refreshInt();else throw new Error(`Unable to convert color ${e}`)}refreshInt(){this._clamp(this._components);let[e,t,i]=this._components;this._int=(e*255<<16)+(t*255<<8)+(i*255|0)}_clamp(e,t=0,i=1){return typeof e=="number"?Math.min(Math.max(e,t),i):(e.forEach((s,o)=>{e[o]=Math.min(Math.max(s,t),i)}),e)}};Wn.shared=new Wn,Wn.temp=new Wn,Wn.HEX_PATTERN=/^(#|0x)?(([a-f0-9]{3}){1,2}([a-f0-9]{2})?)$/i;var Ur=Wn;function DH(){let r=[],e=[];for(let i=0;i<32;i++)r[i]=i,e[i]=i;r[re.NORMAL_NPM]=re.NORMAL,r[re.ADD_NPM]=re.ADD,r[re.SCREEN_NPM]=re.SCREEN,e[re.NORMAL]=re.NORMAL_NPM,e[re.ADD]=re.ADD_NPM,e[re.SCREEN]=re.SCREEN_NPM;let t=[];return t.push(e),t.push(r),t}var X_=DH();function zn(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 Ks(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 rp(r){return!(r&r-1)&&!!r}function ip(r){let e=(r>65535?1:0)<<4;r>>>=e;let t=(r>255?1:0)<<3;return r>>>=t,e|=t,t=(r>15?1:0)<<2,r>>>=t,e|=t,t=(r>3?1:0)<<1,r>>>=t,e|=t,e|r>>1}function j_(r,e,t){let i=r.length,s;if(e>=i||t===0)return;t=e+t>i?i-e:t;let o=i-t;for(s=e;s(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))($||{}),q_=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},Gk=(r,e)=>q_(r).priority??e,Z={_addHandlers:{},_removeHandlers:{},_queue:{},remove(...r){return r.map(q_).forEach(e=>{e.type.forEach(t=>this._removeHandlers[t]?.(e))}),this},add(...r){return r.map(q_).forEach(e=>{e.type.forEach(t=>{let i=this._addHandlers,s=this._queue;i[t]?i[t]?.(e):(s[t]=s[t]||[],s[t]?.push(e))})}),this},handle(r,e,t){let i=this._addHandlers,s=this._removeHandlers;if(i[r]||s[r])throw new Error(`Extension type ${r} already has a handler`);i[r]=e,s[r]=t;let o=this._queue;return o[r]&&(o[r]?.forEach(n=>e(n)),delete o[r]),this},handleByMap(r,e){return this.handle(r,t=>{t.name&&(e[t.name]=t.ref)},t=>{t.name&&delete e[t.name]})},handleByList(r,e,t=-1){return this.handle(r,i=>{e.includes(i.ref)||(e.push(i.ref),e.sort((s,o)=>Gk(o,t)-Gk(s,t)))},i=>{let s=e.indexOf(i.ref);s!==-1&&e.splice(s,1)})}};var Lc=class{constructor(e){typeof e=="number"?this.rawBinaryData=new ArrayBuffer(e):e instanceof Uint8Array?this.rawBinaryData=e.buffer:this.rawBinaryData=e,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(e){return this[`${e}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(e){switch(e){case"int8":case"uint8":return 1;case"int16":case"uint16":return 2;case"int32":case"uint32":case"float32":return 4;default:throw new Error(`${e} isn't a valid view type`)}}};var $H=["precision mediump float;","void main(void){","float test = 0.1;","%forloop%","gl_FragColor = vec4(0.0);","}"].join(` `);function XH(r){let e="";for(let t=0;t0&&(e+=` -else `),t=0;--i){let s=Dc[i];if(s.test&&s.test(r,t))return new s(r,e)}throw new Error("Unrecognized source type to auto-detect Resource")}var rt=class{constructor(e){this.items=[],this._name=e,this._aliasCount=0}emit(e,t,i,s,o,n,a,l){if(arguments.length>8)throw new Error("max arguments reached");let{name:c,items:u}=this;this._aliasCount++;for(let h=0,d=u.length;h0&&this.items.length>1&&(this._aliasCount=0,this.items=this.items.slice(0))}add(e){return e[this._name]&&(this.ensureNonAliasedItems(),this.remove(e),this.items.push(e)),this}remove(e){let t=this.items.indexOf(e);return t!==-1&&(this.ensureNonAliasedItems(),this.items.splice(t,1)),this}contains(e){return this.items.includes(e)}removeAll(){return this.ensureNonAliasedItems(),this.items.length=0,this}destroy(){this.removeAll(),this.items.length=0,this._name=""}get empty(){return this.items.length===0}get name(){return this._name}};Object.defineProperties(rt.prototype,{dispatch:{value:rt.prototype.emit},run:{value:rt.prototype.emit}});var ar=class{constructor(e=0,t=0){this._width=e,this._height=t,this.destroyed=!1,this.internal=!1,this.onResize=new rt("setRealSize"),this.onUpdate=new rt("update"),this.onError=new rt("onError")}bind(e){this.onResize.add(e),this.onUpdate.add(e),this.onError.add(e),(this._width||this._height)&&this.onResize.emit(this._width,this._height)}unbind(e){this.onResize.remove(e),this.onUpdate.remove(e),this.onError.remove(e)}resize(e,t){(e!==this._width||t!==this._height)&&(this._width=e,this._height=t,this.onResize.emit(e,t))}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(e,t,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(e,t){return!1}};var Qs=class extends ar{constructor(e,t){let{width:i,height:s}=t||{};if(!i||!s)throw new Error("BufferResource width or height invalid");super(i,s),this.data=e,this.unpackAlignment=t.unpackAlignment??4}upload(e,t,i){let s=e.gl;s.pixelStorei(s.UNPACK_ALIGNMENT,this.unpackAlignment),s.pixelStorei(s.UNPACK_PREMULTIPLY_ALPHA_WEBGL,t.alphaMode===or.UNPACK);let o=t.realWidth,n=t.realHeight;return i.width===o&&i.height===n?s.texSubImage2D(t.target,0,0,0,o,n,t.format,i.type,this.data):(i.width=o,i.height=n,s.texImage2D(t.target,0,i.internalFormat,o,n,0,t.format,i.type,this.data)),!0}dispose(){this.data=null}static test(e){return e===null||e instanceof Int8Array||e instanceof Uint8Array||e instanceof Uint8ClampedArray||e instanceof Int16Array||e instanceof Uint16Array||e instanceof Int32Array||e instanceof Uint32Array||e instanceof Float32Array}};var jH={scaleMode:vr.NEAREST,alphaMode:or.NPM},rb=class Xn extends Zs.default{constructor(e=null,t=null){super(),t=Object.assign({},Xn.defaultOptions,t);let{alphaMode:i,mipmap:s,anisotropicLevel:o,scaleMode:n,width:a,height:l,wrapMode:c,format:u,type:h,target:d,resolution:f,resourceOptions:p}=t;e&&!(e instanceof ar)&&(e=$n(e,p),e.internal=!0),this.resolution=f||K.RESOLUTION,this.width=Math.round((a||0)*this.resolution)/this.resolution,this.height=Math.round((l||0)*this.resolution)/this.resolution,this._mipmap=s,this.anisotropicLevel=o,this._wrapMode=c,this._scaleMode=n,this.format=u,this.type=h,this.target=d,this.alphaMode=i,this.uid=Ai(),this.touched=0,this.isPowerOfTwo=!1,this._refreshPOT(),this._glTextures={},this.dirtyId=0,this.dirtyStyleId=0,this.cacheId=null,this.valid=a>0&&l>0,this.textureCacheIds=[],this.destroyed=!1,this.resource=null,this._batchEnabled=0,this._batchLocation=0,this.parentTextureArray=null,this.setResource(e)}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(e){this._mipmap!==e&&(this._mipmap=e,this.dirtyStyleId++)}get scaleMode(){return this._scaleMode}set scaleMode(e){this._scaleMode!==e&&(this._scaleMode=e,this.dirtyStyleId++)}get wrapMode(){return this._wrapMode}set wrapMode(e){this._wrapMode!==e&&(this._wrapMode=e,this.dirtyStyleId++)}setStyle(e,t){let i;return e!==void 0&&e!==this.scaleMode&&(this.scaleMode=e,i=!0),t!==void 0&&t!==this.mipmap&&(this.mipmap=t,i=!0),i&&this.dirtyStyleId++,this}setSize(e,t,i){return i=i||this.resolution,this.setRealSize(e*i,t*i,i)}setRealSize(e,t,i){return this.resolution=i||this.resolution,this.width=Math.round(e)/this.resolution,this.height=Math.round(t)/this.resolution,this._refreshPOT(),this.update(),this}_refreshPOT(){this.isPowerOfTwo=rp(this.realWidth)&&rp(this.realHeight)}setResolution(e){let t=this.resolution;return t===e?this:(this.resolution=e,this.valid&&(this.width=Math.round(this.width*t)/e,this.height=Math.round(this.height*t)/e,this.emit("update",this)),this._refreshPOT(),this)}setResource(e){if(this.resource===e)return this;if(this.resource)throw new Error("Resource can be set only once");return e.bind(this),this.resource=e,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(e){this.emit("error",this,e)}destroy(){this.resource&&(this.resource.unbind(this),this.resource.internal&&this.resource.destroy(),this.resource=null),this.cacheId&&(delete si[this.cacheId],delete nr[this.cacheId],this.cacheId=null),this.valid=!1,this.dispose(),Xn.removeFromCache(this),this.textureCacheIds=null,this.destroyed=!0,this.emit("destroyed",this),this.removeAllListeners()}dispose(){this.emit("dispose",this)}castToBaseTexture(){return this}static from(e,t,i=K.STRICT_TEXTURE_CACHE){let s=typeof e=="string",o=null;if(s)o=e;else{if(!e._pixiId){let a=t?.pixiIdPrefix||"pixiid";e._pixiId=`${a}_${Ai()}`}o=e._pixiId}let n=si[o];if(s&&i&&!n)throw new Error(`The cacheId "${o}" does not exist in BaseTextureCache.`);return n||(n=new Xn(e,t),n.cacheId=o,Xn.addToCache(n,o)),n}static fromBuffer(e,t,i,s){e=e||new Float32Array(t*i*4);let o=new Qs(e,{width:t,height:i,...s?.resourceOptions}),n,a;return e instanceof Float32Array?(n=H.RGBA,a=ae.FLOAT):e instanceof Int32Array?(n=H.RGBA_INTEGER,a=ae.INT):e instanceof Uint32Array?(n=H.RGBA_INTEGER,a=ae.UNSIGNED_INT):e instanceof Int16Array?(n=H.RGBA_INTEGER,a=ae.SHORT):e instanceof Uint16Array?(n=H.RGBA_INTEGER,a=ae.UNSIGNED_SHORT):e instanceof Int8Array?(n=H.RGBA,a=ae.BYTE):(n=H.RGBA,a=ae.UNSIGNED_BYTE),o.internal=!0,new Xn(o,Object.assign({},jH,{type:a,format:n},s))}static addToCache(e,t){t&&(e.textureCacheIds.includes(t)||e.textureCacheIds.push(t),si[t]&&si[t]!==e&&console.warn(`BaseTexture added to the cache with an id [${t}] that already had an entry`),si[t]=e)}static removeFromCache(e){if(typeof e=="string"){let t=si[e];if(t){let i=t.textureCacheIds.indexOf(e);return i>-1&&t.textureCacheIds.splice(i,1),delete si[e],t}}else if(e?.textureCacheIds){for(let t=0;t1){for(let h=0;h(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))(Sr||{});var ct=class r{constructor(e=0,t=0){this.x=0,this.y=0,this.x=e,this.y=t}clone(){return new r(this.x,this.y)}copyFrom(e){return this.set(e.x,e.y),this}copyTo(e){return e.set(this.x,this.y),e}equals(e){return e.x===this.x&&e.y===this.y}set(e=0,t=e){return this.x=e,this.y=t,this}};ct.prototype.toString=function(){return`[@pixi/math:Point x=${this.x} y=${this.y}]`};var ap=[new ct,new ct,new ct,new ct],_e=class r{constructor(e=0,t=0,i=0,s=0){this.x=Number(e),this.y=Number(t),this.width=Number(i),this.height=Number(s),this.type=Sr.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 r(0,0,0,0)}clone(){return new r(this.x,this.y,this.width,this.height)}copyFrom(e){return this.x=e.x,this.y=e.y,this.width=e.width,this.height=e.height,this}copyTo(e){return e.x=this.x,e.y=this.y,e.width=this.width,e.height=this.height,e}contains(e,t){return this.width<=0||this.height<=0?!1:e>=this.x&&e=this.y&&te.right?e.right:this.right)<=I)return!1;let B=this.ye.bottom?e.bottom:this.bottom)>B}let i=this.left,s=this.right,o=this.top,n=this.bottom;if(s<=i||n<=o)return!1;let a=ap[0].set(e.left,e.top),l=ap[1].set(e.left,e.bottom),c=ap[2].set(e.right,e.top),u=ap[3].set(e.right,e.bottom);if(c.x<=a.x||l.y<=a.y)return!1;let h=Math.sign(t.a*t.d-t.b*t.c);if(h===0||(t.apply(a,a),t.apply(l,l),t.apply(c,c),t.apply(u,u),Math.max(a.x,l.x,c.x,u.x)<=i||Math.min(a.x,l.x,c.x,u.x)>=s||Math.max(a.y,l.y,c.y,u.y)<=o||Math.min(a.y,l.y,c.y,u.y)>=n))return!1;let d=h*(l.y-a.y),f=h*(a.x-l.x),p=d*i+f*o,m=d*s+f*o,g=d*i+f*n,_=d*s+f*n;if(Math.max(p,m,g,_)<=d*a.x+f*a.y||Math.min(p,m,g,_)>=d*u.x+f*u.y)return!1;let v=h*(a.y-c.y),x=h*(c.x-a.x),T=v*i+x*o,b=v*s+x*o,w=v*i+x*n,E=v*s+x*n;return!(Math.max(T,b,w,E)<=v*a.x+x*a.y||Math.min(T,b,w,E)>=v*u.x+x*u.y)}pad(e=0,t=e){return this.x-=e,this.y-=t,this.width+=e*2,this.height+=t*2,this}fit(e){let t=Math.max(this.x,e.x),i=Math.min(this.x+this.width,e.x+e.width),s=Math.max(this.y,e.y),o=Math.min(this.y+this.height,e.y+e.height);return this.x=t,this.width=Math.max(i-t,0),this.y=s,this.height=Math.max(o-s,0),this}ceil(e=1,t=.001){let i=Math.ceil((this.x+this.width-t)*e)/e,s=Math.ceil((this.y+this.height-t)*e)/e;return this.x=Math.floor((this.x+t)*e)/e,this.y=Math.floor((this.y+t)*e)/e,this.width=i-this.x,this.height=s-this.y,this}enlarge(e){let t=Math.min(this.x,e.x),i=Math.max(this.x+this.width,e.x+e.width),s=Math.min(this.y,e.y),o=Math.max(this.y+this.height,e.y+e.height);return this.x=t,this.width=i-t,this.y=s,this.height=o-s,this}};_e.prototype.toString=function(){return`[@pixi/math:Rectangle x=${this.x} y=${this.y} width=${this.width} height=${this.height}]`};var lp=class r{constructor(e=0,t=0,i=0){this.x=e,this.y=t,this.radius=i,this.type=Sr.CIRC}clone(){return new r(this.x,this.y,this.radius)}contains(e,t){if(this.radius<=0)return!1;let i=this.radius*this.radius,s=this.x-e,o=this.y-t;return s*=s,o*=o,s+o<=i}getBounds(){return new _e(this.x-this.radius,this.y-this.radius,this.radius*2,this.radius*2)}};lp.prototype.toString=function(){return`[@pixi/math:Circle x=${this.x} y=${this.y} radius=${this.radius}]`};var cp=class r{constructor(e=0,t=0,i=0,s=0){this.x=e,this.y=t,this.width=i,this.height=s,this.type=Sr.ELIP}clone(){return new r(this.x,this.y,this.width,this.height)}contains(e,t){if(this.width<=0||this.height<=0)return!1;let i=(e-this.x)/this.width,s=(t-this.y)/this.height;return i*=i,s*=s,i+s<=1}getBounds(){return new _e(this.x-this.width,this.y-this.height,this.width,this.height)}};cp.prototype.toString=function(){return`[@pixi/math:Ellipse x=${this.x} y=${this.y} width=${this.width} height=${this.height}]`};var up=class r{constructor(...e){let t=Array.isArray(e[0])?e[0]:e;if(typeof t[0]!="number"){let i=[];for(let s=0,o=t.length;st!=u>t&&e<(c-a)*((t-l)/(u-l))+a&&(i=!i)}return i}};up.prototype.toString=function(){return`[@pixi/math:PolygoncloseStroke=${this.closeStroke}points=${this.points.reduce((r,e)=>`${r}, ${e}`,"")}]`};var hp=class r{constructor(e=0,t=0,i=0,s=0,o=20){this.x=e,this.y=t,this.width=i,this.height=s,this.radius=o,this.type=Sr.RREC}clone(){return new r(this.x,this.y,this.width,this.height,this.radius)}contains(e,t){if(this.width<=0||this.height<=0)return!1;if(e>=this.x&&e<=this.x+this.width&&t>=this.y&&t<=this.y+this.height){let i=Math.max(0,Math.min(this.radius,Math.min(this.width,this.height)/2));if(t>=this.y+i&&t<=this.y+this.height-i||e>=this.x+i&&e<=this.x+this.width-i)return!0;let s=e-(this.x+i),o=t-(this.y+i),n=i*i;if(s*s+o*o<=n||(s=e-(this.x+this.width-i),s*s+o*o<=n)||(o=t-(this.y+this.height-i),s*s+o*o<=n)||(s=e-(this.x+i),s*s+o*o<=n))return!0}return!1}};hp.prototype.toString=function(){return`[@pixi/math:RoundedRectangle x=${this.x} y=${this.y}width=${this.width} height=${this.height} radius=${this.radius}]`};var Ie=class r{constructor(e=1,t=0,i=0,s=1,o=0,n=0){this.array=null,this.a=e,this.b=t,this.c=i,this.d=s,this.tx=o,this.ty=n}fromArray(e){this.a=e[0],this.b=e[1],this.c=e[3],this.d=e[4],this.tx=e[2],this.ty=e[5]}set(e,t,i,s,o,n){return this.a=e,this.b=t,this.c=i,this.d=s,this.tx=o,this.ty=n,this}toArray(e,t){this.array||(this.array=new Float32Array(9));let i=t||this.array;return e?(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(e,t){t=t||new ct;let i=e.x,s=e.y;return t.x=this.a*i+this.c*s+this.tx,t.y=this.b*i+this.d*s+this.ty,t}applyInverse(e,t){t=t||new ct;let i=1/(this.a*this.d+this.c*-this.b),s=e.x,o=e.y;return t.x=this.d*i*s+-this.c*i*o+(this.ty*this.c-this.tx*this.d)*i,t.y=this.a*i*o+-this.b*i*s+(-this.ty*this.a+this.tx*this.b)*i,t}translate(e,t){return this.tx+=e,this.ty+=t,this}scale(e,t){return this.a*=e,this.d*=t,this.c*=e,this.b*=t,this.tx*=e,this.ty*=t,this}rotate(e){let t=Math.cos(e),i=Math.sin(e),s=this.a,o=this.c,n=this.tx;return this.a=s*t-this.b*i,this.b=s*i+this.b*t,this.c=o*t-this.d*i,this.d=o*i+this.d*t,this.tx=n*t-this.ty*i,this.ty=n*i+this.ty*t,this}append(e){let t=this.a,i=this.b,s=this.c,o=this.d;return this.a=e.a*t+e.b*s,this.b=e.a*i+e.b*o,this.c=e.c*t+e.d*s,this.d=e.c*i+e.d*o,this.tx=e.tx*t+e.ty*s+this.tx,this.ty=e.tx*i+e.ty*o+this.ty,this}setTransform(e,t,i,s,o,n,a,l,c){return this.a=Math.cos(a+c)*o,this.b=Math.sin(a+c)*o,this.c=-Math.sin(a-l)*n,this.d=Math.cos(a-l)*n,this.tx=e-(i*this.a+s*this.c),this.ty=t-(i*this.b+s*this.d),this}prepend(e){let t=this.tx;if(e.a!==1||e.b!==0||e.c!==0||e.d!==1){let i=this.a,s=this.c;this.a=i*e.a+this.b*e.c,this.b=i*e.b+this.b*e.d,this.c=s*e.a+this.d*e.c,this.d=s*e.b+this.d*e.d}return this.tx=t*e.a+this.ty*e.c+e.tx,this.ty=t*e.b+this.ty*e.d+e.ty,this}decompose(e){let t=this.a,i=this.b,s=this.c,o=this.d,n=e.pivot,a=-Math.atan2(-s,o),l=Math.atan2(i,t),c=Math.abs(a+l);return c<1e-5||Math.abs(ib-c)<1e-5?(e.rotation=l,e.skew.x=e.skew.y=0):(e.rotation=0,e.skew.x=a,e.skew.y=l),e.scale.x=Math.sqrt(t*t+i*i),e.scale.y=Math.sqrt(s*s+o*o),e.position.x=this.tx+(n.x*t+n.y*s),e.position.y=this.ty+(n.x*i+n.y*o),e}invert(){let e=this.a,t=this.b,i=this.c,s=this.d,o=this.tx,n=e*s-t*i;return this.a=s/n,this.b=-t/n,this.c=-i/n,this.d=e/n,this.tx=(i*this.ty-s*o)/n,this.ty=-(e*this.ty-t*o)/n,this}identity(){return this.a=1,this.b=0,this.c=0,this.d=1,this.tx=0,this.ty=0,this}clone(){let e=new r;return e.a=this.a,e.b=this.b,e.c=this.c,e.d=this.d,e.tx=this.tx,e.ty=this.ty,e}copyTo(e){return e.a=this.a,e.b=this.b,e.c=this.c,e.d=this.d,e.tx=this.tx,e.ty=this.ty,e}copyFrom(e){return this.a=e.a,this.b=e.b,this.c=e.c,this.d=e.d,this.tx=e.tx,this.ty=e.ty,this}static get IDENTITY(){return new r}static get TEMP_MATRIX(){return new r}};Ie.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}]`};var Js=[1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1,0,1],eo=[0,1,1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1],to=[0,-1,-1,-1,0,1,1,1,0,1,1,1,0,-1,-1,-1],ro=[1,1,0,-1,-1,-1,0,1,-1,-1,0,1,1,1,0,-1],sb=[],Nk=[],dp=Math.sign;function eV(){for(let r=0;r<16;r++){let e=[];sb.push(e);for(let t=0;t<16;t++){let i=dp(Js[r]*Js[t]+to[r]*eo[t]),s=dp(eo[r]*Js[t]+ro[r]*eo[t]),o=dp(Js[r]*to[t]+to[r]*ro[t]),n=dp(eo[r]*to[t]+ro[r]*ro[t]);for(let a=0;a<16;a++)if(Js[a]===i&&eo[a]===s&&to[a]===o&&ro[a]===n){e.push(a);break}}}for(let r=0;r<16;r++){let e=new Ie;e.set(Js[r],eo[r],to[r],ro[r],0,0),Nk.push(e)}}eV();var Ne={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=>Js[r],uY:r=>eo[r],vX:r=>to[r],vY:r=>ro[r],inv:r=>r&8?r&15:-r&7,add:(r,e)=>sb[r][e],sub:(r,e)=>sb[r][Ne.inv(e)],rotate180:r=>r^4,isVertical:r=>(r&3)===2,byDirection:(r,e)=>Math.abs(r)*2<=Math.abs(e)?e>=0?Ne.S:Ne.N:Math.abs(e)*2<=Math.abs(r)?r>0?Ne.E:Ne.W:e>0?r>0?Ne.SE:Ne.SW:r>0?Ne.NE:Ne.NW,matrixAppendRotationInv:(r,e,t=0,i=0)=>{let s=Nk[Ne.inv(e)];s.tx=t,s.ty=i,r.append(s)}};var Ci=class r{constructor(e,t,i=0,s=0){this._x=i,this._y=s,this.cb=e,this.scope=t}clone(e=this.cb,t=this.scope){return new r(e,t,this._x,this._y)}set(e=0,t=e){return(this._x!==e||this._y!==t)&&(this._x=e,this._y=t,this.cb.call(this.scope)),this}copyFrom(e){return(this._x!==e.x||this._y!==e.y)&&(this._x=e.x,this._y=e.y,this.cb.call(this.scope)),this}copyTo(e){return e.set(this._x,this._y),e}equals(e){return e.x===this._x&&e.y===this._y}get x(){return this._x}set x(e){this._x!==e&&(this._x=e,this.cb.call(this.scope))}get y(){return this._y}set y(e){this._y!==e&&(this._y=e,this.cb.call(this.scope))}};Ci.prototype.toString=function(){return`[@pixi/math:ObservablePoint x=${this.x} y=${this.y} scope=${this.scope}]`};var ob=class{constructor(){this.worldTransform=new Ie,this.localTransform=new Ie,this.position=new Ci(this.onChange,this,0,0),this.scale=new Ci(this.onChange,this,1,1),this.pivot=new Ci(this.onChange,this,0,0),this.skew=new Ci(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(){let 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){let e=this.localTransform;if(this._localID!==this._currentLocalID&&(e.a=this._cx*this.scale.x,e.b=this._sx*this.scale.x,e.c=this._cy*this.scale.y,e.d=this._sy*this.scale.y,e.tx=this.position.x-(this.pivot.x*e.a+this.pivot.y*e.c),e.ty=this.position.y-(this.pivot.x*e.b+this.pivot.y*e.d),this._currentLocalID=this._localID,this._parentID=-1),this._parentID!==r._worldID){let t=r.worldTransform,i=this.worldTransform;i.a=e.a*t.a+e.b*t.c,i.b=e.a*t.b+e.b*t.d,i.c=e.c*t.a+e.d*t.c,i.d=e.c*t.b+e.d*t.d,i.tx=e.tx*t.a+e.ty*t.c+t.tx,i.ty=e.tx*t.b+e.ty*t.d+t.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())}};ob.IDENTITY=new ob;var fp=ob;fp.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 Hk=`varying vec2 vTextureCoord; +else `),t=0;--i){let s=Dc[i];if(s.test&&s.test(r,t))return new s(r,e)}throw new Error("Unrecognized source type to auto-detect Resource")}var rt=class{constructor(e){this.items=[],this._name=e,this._aliasCount=0}emit(e,t,i,s,o,n,a,l){if(arguments.length>8)throw new Error("max arguments reached");let{name:c,items:u}=this;this._aliasCount++;for(let h=0,d=u.length;h0&&this.items.length>1&&(this._aliasCount=0,this.items=this.items.slice(0))}add(e){return e[this._name]&&(this.ensureNonAliasedItems(),this.remove(e),this.items.push(e)),this}remove(e){let t=this.items.indexOf(e);return t!==-1&&(this.ensureNonAliasedItems(),this.items.splice(t,1)),this}contains(e){return this.items.includes(e)}removeAll(){return this.ensureNonAliasedItems(),this.items.length=0,this}destroy(){this.removeAll(),this.items.length=0,this._name=""}get empty(){return this.items.length===0}get name(){return this._name}};Object.defineProperties(rt.prototype,{dispatch:{value:rt.prototype.emit},run:{value:rt.prototype.emit}});var ar=class{constructor(e=0,t=0){this._width=e,this._height=t,this.destroyed=!1,this.internal=!1,this.onResize=new rt("setRealSize"),this.onUpdate=new rt("update"),this.onError=new rt("onError")}bind(e){this.onResize.add(e),this.onUpdate.add(e),this.onError.add(e),(this._width||this._height)&&this.onResize.emit(this._width,this._height)}unbind(e){this.onResize.remove(e),this.onUpdate.remove(e),this.onError.remove(e)}resize(e,t){(e!==this._width||t!==this._height)&&(this._width=e,this._height=t,this.onResize.emit(e,t))}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(e,t,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(e,t){return!1}};var Qs=class extends ar{constructor(e,t){let{width:i,height:s}=t||{};if(!i||!s)throw new Error("BufferResource width or height invalid");super(i,s),this.data=e,this.unpackAlignment=t.unpackAlignment??4}upload(e,t,i){let s=e.gl;s.pixelStorei(s.UNPACK_ALIGNMENT,this.unpackAlignment),s.pixelStorei(s.UNPACK_PREMULTIPLY_ALPHA_WEBGL,t.alphaMode===or.UNPACK);let o=t.realWidth,n=t.realHeight;return i.width===o&&i.height===n?s.texSubImage2D(t.target,0,0,0,o,n,t.format,i.type,this.data):(i.width=o,i.height=n,s.texImage2D(t.target,0,i.internalFormat,o,n,0,t.format,i.type,this.data)),!0}dispose(){this.data=null}static test(e){return e===null||e instanceof Int8Array||e instanceof Uint8Array||e instanceof Uint8ClampedArray||e instanceof Int16Array||e instanceof Uint16Array||e instanceof Int32Array||e instanceof Uint32Array||e instanceof Float32Array}};var jH={scaleMode:vr.NEAREST,alphaMode:or.NPM},rb=class Xn extends Zs.default{constructor(e=null,t=null){super(),t=Object.assign({},Xn.defaultOptions,t);let{alphaMode:i,mipmap:s,anisotropicLevel:o,scaleMode:n,width:a,height:l,wrapMode:c,format:u,type:h,target:d,resolution:f,resourceOptions:p}=t;e&&!(e instanceof ar)&&(e=$n(e,p),e.internal=!0),this.resolution=f||K.RESOLUTION,this.width=Math.round((a||0)*this.resolution)/this.resolution,this.height=Math.round((l||0)*this.resolution)/this.resolution,this._mipmap=s,this.anisotropicLevel=o,this._wrapMode=c,this._scaleMode=n,this.format=u,this.type=h,this.target=d,this.alphaMode=i,this.uid=Ai(),this.touched=0,this.isPowerOfTwo=!1,this._refreshPOT(),this._glTextures={},this.dirtyId=0,this.dirtyStyleId=0,this.cacheId=null,this.valid=a>0&&l>0,this.textureCacheIds=[],this.destroyed=!1,this.resource=null,this._batchEnabled=0,this._batchLocation=0,this.parentTextureArray=null,this.setResource(e)}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(e){this._mipmap!==e&&(this._mipmap=e,this.dirtyStyleId++)}get scaleMode(){return this._scaleMode}set scaleMode(e){this._scaleMode!==e&&(this._scaleMode=e,this.dirtyStyleId++)}get wrapMode(){return this._wrapMode}set wrapMode(e){this._wrapMode!==e&&(this._wrapMode=e,this.dirtyStyleId++)}setStyle(e,t){let i;return e!==void 0&&e!==this.scaleMode&&(this.scaleMode=e,i=!0),t!==void 0&&t!==this.mipmap&&(this.mipmap=t,i=!0),i&&this.dirtyStyleId++,this}setSize(e,t,i){return i=i||this.resolution,this.setRealSize(e*i,t*i,i)}setRealSize(e,t,i){return this.resolution=i||this.resolution,this.width=Math.round(e)/this.resolution,this.height=Math.round(t)/this.resolution,this._refreshPOT(),this.update(),this}_refreshPOT(){this.isPowerOfTwo=rp(this.realWidth)&&rp(this.realHeight)}setResolution(e){let t=this.resolution;return t===e?this:(this.resolution=e,this.valid&&(this.width=Math.round(this.width*t)/e,this.height=Math.round(this.height*t)/e,this.emit("update",this)),this._refreshPOT(),this)}setResource(e){if(this.resource===e)return this;if(this.resource)throw new Error("Resource can be set only once");return e.bind(this),this.resource=e,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(e){this.emit("error",this,e)}destroy(){this.resource&&(this.resource.unbind(this),this.resource.internal&&this.resource.destroy(),this.resource=null),this.cacheId&&(delete si[this.cacheId],delete nr[this.cacheId],this.cacheId=null),this.valid=!1,this.dispose(),Xn.removeFromCache(this),this.textureCacheIds=null,this.destroyed=!0,this.emit("destroyed",this),this.removeAllListeners()}dispose(){this.emit("dispose",this)}castToBaseTexture(){return this}static from(e,t,i=K.STRICT_TEXTURE_CACHE){let s=typeof e=="string",o=null;if(s)o=e;else{if(!e._pixiId){let a=t?.pixiIdPrefix||"pixiid";e._pixiId=`${a}_${Ai()}`}o=e._pixiId}let n=si[o];if(s&&i&&!n)throw new Error(`The cacheId "${o}" does not exist in BaseTextureCache.`);return n||(n=new Xn(e,t),n.cacheId=o,Xn.addToCache(n,o)),n}static fromBuffer(e,t,i,s){e=e||new Float32Array(t*i*4);let o=new Qs(e,{width:t,height:i,...s?.resourceOptions}),n,a;return e instanceof Float32Array?(n=H.RGBA,a=ae.FLOAT):e instanceof Int32Array?(n=H.RGBA_INTEGER,a=ae.INT):e instanceof Uint32Array?(n=H.RGBA_INTEGER,a=ae.UNSIGNED_INT):e instanceof Int16Array?(n=H.RGBA_INTEGER,a=ae.SHORT):e instanceof Uint16Array?(n=H.RGBA_INTEGER,a=ae.UNSIGNED_SHORT):e instanceof Int8Array?(n=H.RGBA,a=ae.BYTE):(n=H.RGBA,a=ae.UNSIGNED_BYTE),o.internal=!0,new Xn(o,Object.assign({},jH,{type:a,format:n},s))}static addToCache(e,t){t&&(e.textureCacheIds.includes(t)||e.textureCacheIds.push(t),si[t]&&si[t]!==e&&console.warn(`BaseTexture added to the cache with an id [${t}] that already had an entry`),si[t]=e)}static removeFromCache(e){if(typeof e=="string"){let t=si[e];if(t){let i=t.textureCacheIds.indexOf(e);return i>-1&&t.textureCacheIds.splice(i,1),delete si[e],t}}else if(e?.textureCacheIds){for(let t=0;t1){for(let h=0;h(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))(Sr||{});var ct=class r{constructor(e=0,t=0){this.x=0,this.y=0,this.x=e,this.y=t}clone(){return new r(this.x,this.y)}copyFrom(e){return this.set(e.x,e.y),this}copyTo(e){return e.set(this.x,this.y),e}equals(e){return e.x===this.x&&e.y===this.y}set(e=0,t=e){return this.x=e,this.y=t,this}};ct.prototype.toString=function(){return`[@pixi/math:Point x=${this.x} y=${this.y}]`};var ap=[new ct,new ct,new ct,new ct],_e=class r{constructor(e=0,t=0,i=0,s=0){this.x=Number(e),this.y=Number(t),this.width=Number(i),this.height=Number(s),this.type=Sr.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 r(0,0,0,0)}clone(){return new r(this.x,this.y,this.width,this.height)}copyFrom(e){return this.x=e.x,this.y=e.y,this.width=e.width,this.height=e.height,this}copyTo(e){return e.x=this.x,e.y=this.y,e.width=this.width,e.height=this.height,e}contains(e,t){return this.width<=0||this.height<=0?!1:e>=this.x&&e=this.y&&te.right?e.right:this.right)<=I)return!1;let B=this.ye.bottom?e.bottom:this.bottom)>B}let i=this.left,s=this.right,o=this.top,n=this.bottom;if(s<=i||n<=o)return!1;let a=ap[0].set(e.left,e.top),l=ap[1].set(e.left,e.bottom),c=ap[2].set(e.right,e.top),u=ap[3].set(e.right,e.bottom);if(c.x<=a.x||l.y<=a.y)return!1;let h=Math.sign(t.a*t.d-t.b*t.c);if(h===0||(t.apply(a,a),t.apply(l,l),t.apply(c,c),t.apply(u,u),Math.max(a.x,l.x,c.x,u.x)<=i||Math.min(a.x,l.x,c.x,u.x)>=s||Math.max(a.y,l.y,c.y,u.y)<=o||Math.min(a.y,l.y,c.y,u.y)>=n))return!1;let d=h*(l.y-a.y),f=h*(a.x-l.x),p=d*i+f*o,m=d*s+f*o,g=d*i+f*n,_=d*s+f*n;if(Math.max(p,m,g,_)<=d*a.x+f*a.y||Math.min(p,m,g,_)>=d*u.x+f*u.y)return!1;let v=h*(a.y-c.y),x=h*(c.x-a.x),T=v*i+x*o,b=v*s+x*o,E=v*i+x*n,w=v*s+x*n;return!(Math.max(T,b,E,w)<=v*a.x+x*a.y||Math.min(T,b,E,w)>=v*u.x+x*u.y)}pad(e=0,t=e){return this.x-=e,this.y-=t,this.width+=e*2,this.height+=t*2,this}fit(e){let t=Math.max(this.x,e.x),i=Math.min(this.x+this.width,e.x+e.width),s=Math.max(this.y,e.y),o=Math.min(this.y+this.height,e.y+e.height);return this.x=t,this.width=Math.max(i-t,0),this.y=s,this.height=Math.max(o-s,0),this}ceil(e=1,t=.001){let i=Math.ceil((this.x+this.width-t)*e)/e,s=Math.ceil((this.y+this.height-t)*e)/e;return this.x=Math.floor((this.x+t)*e)/e,this.y=Math.floor((this.y+t)*e)/e,this.width=i-this.x,this.height=s-this.y,this}enlarge(e){let t=Math.min(this.x,e.x),i=Math.max(this.x+this.width,e.x+e.width),s=Math.min(this.y,e.y),o=Math.max(this.y+this.height,e.y+e.height);return this.x=t,this.width=i-t,this.y=s,this.height=o-s,this}};_e.prototype.toString=function(){return`[@pixi/math:Rectangle x=${this.x} y=${this.y} width=${this.width} height=${this.height}]`};var lp=class r{constructor(e=0,t=0,i=0){this.x=e,this.y=t,this.radius=i,this.type=Sr.CIRC}clone(){return new r(this.x,this.y,this.radius)}contains(e,t){if(this.radius<=0)return!1;let i=this.radius*this.radius,s=this.x-e,o=this.y-t;return s*=s,o*=o,s+o<=i}getBounds(){return new _e(this.x-this.radius,this.y-this.radius,this.radius*2,this.radius*2)}};lp.prototype.toString=function(){return`[@pixi/math:Circle x=${this.x} y=${this.y} radius=${this.radius}]`};var cp=class r{constructor(e=0,t=0,i=0,s=0){this.x=e,this.y=t,this.width=i,this.height=s,this.type=Sr.ELIP}clone(){return new r(this.x,this.y,this.width,this.height)}contains(e,t){if(this.width<=0||this.height<=0)return!1;let i=(e-this.x)/this.width,s=(t-this.y)/this.height;return i*=i,s*=s,i+s<=1}getBounds(){return new _e(this.x-this.width,this.y-this.height,this.width,this.height)}};cp.prototype.toString=function(){return`[@pixi/math:Ellipse x=${this.x} y=${this.y} width=${this.width} height=${this.height}]`};var up=class r{constructor(...e){let t=Array.isArray(e[0])?e[0]:e;if(typeof t[0]!="number"){let i=[];for(let s=0,o=t.length;st!=u>t&&e<(c-a)*((t-l)/(u-l))+a&&(i=!i)}return i}};up.prototype.toString=function(){return`[@pixi/math:PolygoncloseStroke=${this.closeStroke}points=${this.points.reduce((r,e)=>`${r}, ${e}`,"")}]`};var hp=class r{constructor(e=0,t=0,i=0,s=0,o=20){this.x=e,this.y=t,this.width=i,this.height=s,this.radius=o,this.type=Sr.RREC}clone(){return new r(this.x,this.y,this.width,this.height,this.radius)}contains(e,t){if(this.width<=0||this.height<=0)return!1;if(e>=this.x&&e<=this.x+this.width&&t>=this.y&&t<=this.y+this.height){let i=Math.max(0,Math.min(this.radius,Math.min(this.width,this.height)/2));if(t>=this.y+i&&t<=this.y+this.height-i||e>=this.x+i&&e<=this.x+this.width-i)return!0;let s=e-(this.x+i),o=t-(this.y+i),n=i*i;if(s*s+o*o<=n||(s=e-(this.x+this.width-i),s*s+o*o<=n)||(o=t-(this.y+this.height-i),s*s+o*o<=n)||(s=e-(this.x+i),s*s+o*o<=n))return!0}return!1}};hp.prototype.toString=function(){return`[@pixi/math:RoundedRectangle x=${this.x} y=${this.y}width=${this.width} height=${this.height} radius=${this.radius}]`};var Ie=class r{constructor(e=1,t=0,i=0,s=1,o=0,n=0){this.array=null,this.a=e,this.b=t,this.c=i,this.d=s,this.tx=o,this.ty=n}fromArray(e){this.a=e[0],this.b=e[1],this.c=e[3],this.d=e[4],this.tx=e[2],this.ty=e[5]}set(e,t,i,s,o,n){return this.a=e,this.b=t,this.c=i,this.d=s,this.tx=o,this.ty=n,this}toArray(e,t){this.array||(this.array=new Float32Array(9));let i=t||this.array;return e?(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(e,t){t=t||new ct;let i=e.x,s=e.y;return t.x=this.a*i+this.c*s+this.tx,t.y=this.b*i+this.d*s+this.ty,t}applyInverse(e,t){t=t||new ct;let i=1/(this.a*this.d+this.c*-this.b),s=e.x,o=e.y;return t.x=this.d*i*s+-this.c*i*o+(this.ty*this.c-this.tx*this.d)*i,t.y=this.a*i*o+-this.b*i*s+(-this.ty*this.a+this.tx*this.b)*i,t}translate(e,t){return this.tx+=e,this.ty+=t,this}scale(e,t){return this.a*=e,this.d*=t,this.c*=e,this.b*=t,this.tx*=e,this.ty*=t,this}rotate(e){let t=Math.cos(e),i=Math.sin(e),s=this.a,o=this.c,n=this.tx;return this.a=s*t-this.b*i,this.b=s*i+this.b*t,this.c=o*t-this.d*i,this.d=o*i+this.d*t,this.tx=n*t-this.ty*i,this.ty=n*i+this.ty*t,this}append(e){let t=this.a,i=this.b,s=this.c,o=this.d;return this.a=e.a*t+e.b*s,this.b=e.a*i+e.b*o,this.c=e.c*t+e.d*s,this.d=e.c*i+e.d*o,this.tx=e.tx*t+e.ty*s+this.tx,this.ty=e.tx*i+e.ty*o+this.ty,this}setTransform(e,t,i,s,o,n,a,l,c){return this.a=Math.cos(a+c)*o,this.b=Math.sin(a+c)*o,this.c=-Math.sin(a-l)*n,this.d=Math.cos(a-l)*n,this.tx=e-(i*this.a+s*this.c),this.ty=t-(i*this.b+s*this.d),this}prepend(e){let t=this.tx;if(e.a!==1||e.b!==0||e.c!==0||e.d!==1){let i=this.a,s=this.c;this.a=i*e.a+this.b*e.c,this.b=i*e.b+this.b*e.d,this.c=s*e.a+this.d*e.c,this.d=s*e.b+this.d*e.d}return this.tx=t*e.a+this.ty*e.c+e.tx,this.ty=t*e.b+this.ty*e.d+e.ty,this}decompose(e){let t=this.a,i=this.b,s=this.c,o=this.d,n=e.pivot,a=-Math.atan2(-s,o),l=Math.atan2(i,t),c=Math.abs(a+l);return c<1e-5||Math.abs(ib-c)<1e-5?(e.rotation=l,e.skew.x=e.skew.y=0):(e.rotation=0,e.skew.x=a,e.skew.y=l),e.scale.x=Math.sqrt(t*t+i*i),e.scale.y=Math.sqrt(s*s+o*o),e.position.x=this.tx+(n.x*t+n.y*s),e.position.y=this.ty+(n.x*i+n.y*o),e}invert(){let e=this.a,t=this.b,i=this.c,s=this.d,o=this.tx,n=e*s-t*i;return this.a=s/n,this.b=-t/n,this.c=-i/n,this.d=e/n,this.tx=(i*this.ty-s*o)/n,this.ty=-(e*this.ty-t*o)/n,this}identity(){return this.a=1,this.b=0,this.c=0,this.d=1,this.tx=0,this.ty=0,this}clone(){let e=new r;return e.a=this.a,e.b=this.b,e.c=this.c,e.d=this.d,e.tx=this.tx,e.ty=this.ty,e}copyTo(e){return e.a=this.a,e.b=this.b,e.c=this.c,e.d=this.d,e.tx=this.tx,e.ty=this.ty,e}copyFrom(e){return this.a=e.a,this.b=e.b,this.c=e.c,this.d=e.d,this.tx=e.tx,this.ty=e.ty,this}static get IDENTITY(){return new r}static get TEMP_MATRIX(){return new r}};Ie.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}]`};var Js=[1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1,0,1],eo=[0,1,1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1],to=[0,-1,-1,-1,0,1,1,1,0,1,1,1,0,-1,-1,-1],ro=[1,1,0,-1,-1,-1,0,1,-1,-1,0,1,1,1,0,-1],sb=[],Nk=[],dp=Math.sign;function eV(){for(let r=0;r<16;r++){let e=[];sb.push(e);for(let t=0;t<16;t++){let i=dp(Js[r]*Js[t]+to[r]*eo[t]),s=dp(eo[r]*Js[t]+ro[r]*eo[t]),o=dp(Js[r]*to[t]+to[r]*ro[t]),n=dp(eo[r]*to[t]+ro[r]*ro[t]);for(let a=0;a<16;a++)if(Js[a]===i&&eo[a]===s&&to[a]===o&&ro[a]===n){e.push(a);break}}}for(let r=0;r<16;r++){let e=new Ie;e.set(Js[r],eo[r],to[r],ro[r],0,0),Nk.push(e)}}eV();var Ne={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=>Js[r],uY:r=>eo[r],vX:r=>to[r],vY:r=>ro[r],inv:r=>r&8?r&15:-r&7,add:(r,e)=>sb[r][e],sub:(r,e)=>sb[r][Ne.inv(e)],rotate180:r=>r^4,isVertical:r=>(r&3)===2,byDirection:(r,e)=>Math.abs(r)*2<=Math.abs(e)?e>=0?Ne.S:Ne.N:Math.abs(e)*2<=Math.abs(r)?r>0?Ne.E:Ne.W:e>0?r>0?Ne.SE:Ne.SW:r>0?Ne.NE:Ne.NW,matrixAppendRotationInv:(r,e,t=0,i=0)=>{let s=Nk[Ne.inv(e)];s.tx=t,s.ty=i,r.append(s)}};var Ci=class r{constructor(e,t,i=0,s=0){this._x=i,this._y=s,this.cb=e,this.scope=t}clone(e=this.cb,t=this.scope){return new r(e,t,this._x,this._y)}set(e=0,t=e){return(this._x!==e||this._y!==t)&&(this._x=e,this._y=t,this.cb.call(this.scope)),this}copyFrom(e){return(this._x!==e.x||this._y!==e.y)&&(this._x=e.x,this._y=e.y,this.cb.call(this.scope)),this}copyTo(e){return e.set(this._x,this._y),e}equals(e){return e.x===this._x&&e.y===this._y}get x(){return this._x}set x(e){this._x!==e&&(this._x=e,this.cb.call(this.scope))}get y(){return this._y}set y(e){this._y!==e&&(this._y=e,this.cb.call(this.scope))}};Ci.prototype.toString=function(){return`[@pixi/math:ObservablePoint x=${this.x} y=${this.y} scope=${this.scope}]`};var ob=class{constructor(){this.worldTransform=new Ie,this.localTransform=new Ie,this.position=new Ci(this.onChange,this,0,0),this.scale=new Ci(this.onChange,this,1,1),this.pivot=new Ci(this.onChange,this,0,0),this.skew=new Ci(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(){let 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){let e=this.localTransform;if(this._localID!==this._currentLocalID&&(e.a=this._cx*this.scale.x,e.b=this._sx*this.scale.x,e.c=this._cy*this.scale.y,e.d=this._sy*this.scale.y,e.tx=this.position.x-(this.pivot.x*e.a+this.pivot.y*e.c),e.ty=this.position.y-(this.pivot.x*e.b+this.pivot.y*e.d),this._currentLocalID=this._localID,this._parentID=-1),this._parentID!==r._worldID){let t=r.worldTransform,i=this.worldTransform;i.a=e.a*t.a+e.b*t.c,i.b=e.a*t.b+e.b*t.d,i.c=e.c*t.a+e.d*t.c,i.d=e.c*t.b+e.d*t.d,i.tx=e.tx*t.a+e.ty*t.c+t.tx,i.ty=e.tx*t.b+e.ty*t.d+t.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())}};ob.IDENTITY=new ob;var fp=ob;fp.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 Hk=`varying vec2 vTextureCoord; uniform sampler2D uSampler; @@ -1898,7 +1898,7 @@ void main(void) `)}}return o.push(` renderer.buffer.update(buffer); `),{size:s,syncFunc:new Function("ud","uv","renderer","syncData","buffer",o.join(` -`))}}var uV=0,Ep={textureCount:0,uboCount:0},us=class{constructor(e){this.destroyed=!1,this.renderer=e,this.systemCheck(),this.gl=null,this.shader=null,this.program=null,this.cache={},this._uboCache={},this.id=uV++}systemCheck(){if(!bp())throw new Error("Current environment does not allow unsafe-eval, please use @pixi/unsafe-eval module to enable support.")}contextChange(e){this.gl=e,this.reset()}bind(e,t){e.disposeRunner.add(this),e.uniforms.globals=this.renderer.globalUniforms;let i=e.program,s=i.glPrograms[this.renderer.CONTEXT_UID]||this.generateProgram(e);return this.shader=e,this.program!==i&&(this.program=i,this.gl.useProgram(s.program)),t||(Ep.textureCount=0,Ep.uboCount=0,this.syncUniformGroup(e.uniformGroup,Ep)),s}setUniforms(e){let t=this.shader.program,i=t.glPrograms[this.renderer.CONTEXT_UID];t.syncUniforms(i.uniformData,e,this.renderer)}syncUniformGroup(e,t){let i=this.getGlProgram();(!e.static||e.dirtyId!==i.uniformDirtyGroups[e.id])&&(i.uniformDirtyGroups[e.id]=e.dirtyId,this.syncUniforms(e,i,t))}syncUniforms(e,t,i){(e.syncUniforms[this.shader.program.id]||this.createSyncGroups(e))(t.uniformData,e.uniforms,this.renderer,i)}createSyncGroups(e){let t=this.getSignature(e,this.shader.program.uniformData,"u");return this.cache[t]||(this.cache[t]=ab(e,this.shader.program.uniformData)),e.syncUniforms[this.shader.program.id]=this.cache[t],e.syncUniforms[this.shader.program.id]}syncUniformBufferGroup(e,t){let i=this.getGlProgram();if(!e.static||e.dirtyId!==0||!i.uniformGroups[e.id]){e.dirtyId=0;let s=i.uniformGroups[e.id]||this.createSyncBufferGroup(e,i,t);e.buffer.update(),s(i.uniformData,e.uniforms,this.renderer,Ep,e.buffer)}this.renderer.buffer.bindBufferBase(e.buffer,i.uniformBufferBindings[t])}createSyncBufferGroup(e,t,i){let{gl:s}=this.renderer;this.renderer.buffer.bind(e.buffer);let o=this.gl.getUniformBlockIndex(t.program,i);t.uniformBufferBindings[i]=this.shader.uniformBindCount,s.uniformBlockBinding(t.program,o,this.shader.uniformBindCount),this.shader.uniformBindCount++;let n=this.getSignature(e,this.shader.program.uniformData,"ubo"),a=this._uboCache[n];if(a||(a=this._uboCache[n]=gb(e,this.shader.program.uniformData)),e.autoManage){let l=new Float32Array(a.size/4);e.buffer.update(l)}return t.uniformGroups[e.id]=a.syncFunc,t.uniformGroups[e.id]}getSignature(e,t,i){let s=e.uniforms,o=[`${i}-`];for(let n in s)o.push(n),t[n]&&o.push(t[n].type);return o.join("-")}getGlProgram(){return this.shader?this.shader.program.glPrograms[this.renderer.CONTEXT_UID]:null}generateProgram(e){let t=this.gl,i=e.program,s=mb(t,i);return i.glPrograms[this.renderer.CONTEXT_UID]=s,s}reset(){this.program=null,this.shader=null}disposeShader(e){this.shader===e&&(this.shader=null)}destroy(){this.renderer=null,this.destroyed=!0}};us.extension={type:$.RendererSystem,name:"shader"};Z.add(us);var Bi=class{constructor(e){this.renderer=e}run(e){let{renderer:t}=this;t.runners.init.emit(t.options),e.hello&&console.log(`PixiJS 7.4.3 - ${t.rendererLogId} - https://pixijs.com`),t.resize(t.screen.width,t.screen.height)}destroy(){}};Bi.defaultOptions={hello:!1},Bi.extension={type:[$.RendererSystem,$.CanvasRendererSystem],name:"startup"};Z.add(Bi);function dF(r,e=[]){return e[re.NORMAL]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],e[re.ADD]=[r.ONE,r.ONE],e[re.MULTIPLY]=[r.DST_COLOR,r.ONE_MINUS_SRC_ALPHA,r.ONE,r.ONE_MINUS_SRC_ALPHA],e[re.SCREEN]=[r.ONE,r.ONE_MINUS_SRC_COLOR,r.ONE,r.ONE_MINUS_SRC_ALPHA],e[re.OVERLAY]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],e[re.DARKEN]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],e[re.LIGHTEN]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],e[re.COLOR_DODGE]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],e[re.COLOR_BURN]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],e[re.HARD_LIGHT]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],e[re.SOFT_LIGHT]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],e[re.DIFFERENCE]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],e[re.EXCLUSION]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],e[re.HUE]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],e[re.SATURATION]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],e[re.COLOR]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],e[re.LUMINOSITY]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],e[re.NONE]=[0,0],e[re.NORMAL_NPM]=[r.SRC_ALPHA,r.ONE_MINUS_SRC_ALPHA,r.ONE,r.ONE_MINUS_SRC_ALPHA],e[re.ADD_NPM]=[r.SRC_ALPHA,r.ONE,r.ONE,r.ONE],e[re.SCREEN_NPM]=[r.SRC_ALPHA,r.ONE_MINUS_SRC_COLOR,r.ONE,r.ONE_MINUS_SRC_ALPHA],e[re.SRC_IN]=[r.DST_ALPHA,r.ZERO],e[re.SRC_OUT]=[r.ONE_MINUS_DST_ALPHA,r.ZERO],e[re.SRC_ATOP]=[r.DST_ALPHA,r.ONE_MINUS_SRC_ALPHA],e[re.DST_OVER]=[r.ONE_MINUS_DST_ALPHA,r.ONE],e[re.DST_IN]=[r.ZERO,r.SRC_ALPHA],e[re.DST_OUT]=[r.ZERO,r.ONE_MINUS_SRC_ALPHA],e[re.DST_ATOP]=[r.ONE_MINUS_DST_ALPHA,r.SRC_ALPHA],e[re.XOR]=[r.ONE_MINUS_DST_ALPHA,r.ONE_MINUS_SRC_ALPHA],e[re.SUBTRACT]=[r.ONE,r.ONE,r.ONE,r.ONE,r.FUNC_REVERSE_SUBTRACT,r.FUNC_ADD],e}var hV=0,dV=1,fV=2,pV=3,mV=4,gV=5,fF=class xb{constructor(){this.gl=null,this.stateId=0,this.polygonOffset=0,this.blendMode=re.NONE,this._blendEq=!1,this.map=[],this.map[hV]=this.setBlend,this.map[dV]=this.setOffset,this.map[fV]=this.setCullFace,this.map[pV]=this.setDepthTest,this.map[mV]=this.setFrontFace,this.map[gV]=this.setDepthMask,this.checks=[],this.defaultState=new oi,this.defaultState.blend=!0}contextChange(e){this.gl=e,this.blendModes=dF(e),this.set(this.defaultState),this.reset()}set(e){if(e=e||this.defaultState,this.stateId!==e.data){let t=this.stateId^e.data,i=0;for(;t;)t&1&&this.map[i].call(this,!!(e.data&1<>1,i++;this.stateId=e.data}for(let t=0;te.systems[s]),i=[...t,...Object.keys(e.systems).filter(s=>!t.includes(s))];for(let s of i)this.addSystem(e.systems[s],s)}addRunners(...e){e.forEach(t=>{this.runners[t]=new rt(t)})}addSystem(e,t){let i=new e(this);if(this[t])throw new Error(`Whoops! The name "${t}" is already in use`);this[t]=i,this._systemsHash[t]=i;for(let s in this.runners)this.runners[s].add(i);return this}emitWithCustomOptions(e,t){let i=Object.keys(this._systemsHash);e.items.forEach(s=>{let o=i.find(n=>this._systemsHash[n]===s);s[e.name](t[o])})}destroy(){Object.values(this.runners).forEach(e=>{e.destroy()}),this._systemsHash={}}};var nu=class Ap{constructor(e){this.renderer=e,this.count=0,this.checkCount=0,this.maxIdle=Ap.defaultMaxIdle,this.checkCountMax=Ap.defaultCheckCountMax,this.mode=Ap.defaultMode}postrender(){this.renderer.objectRenderer.renderingToScreen&&(this.count++,this.mode!==Df.MANUAL&&(this.checkCount++,this.checkCount>this.checkCountMax&&(this.checkCount=0,this.run())))}run(){let e=this.renderer.texture,t=e.managedTextures,i=!1;for(let s=0;sthis.maxIdle&&(e.destroyTexture(o,!0),t[s]=null,i=!0)}if(i){let s=0;for(let o=0;o=0;s--)this.unload(e.children[s])}destroy(){this.renderer=null}};nu.defaultMode=Df.AUTO,nu.defaultMaxIdle=60*60,nu.defaultCheckCountMax=60*10,nu.extension={type:$.RendererSystem,name:"textureGC"};var li=nu;Z.add(li);var uo=class{constructor(e){this.texture=e,this.width=-1,this.height=-1,this.dirtyId=-1,this.dirtyStyleId=-1,this.mipmap=!1,this.wrapMode=33071,this.type=ae.UNSIGNED_BYTE,this.internalFormat=H.RGBA,this.samplerType=0}};function pF(r){let e;return"WebGL2RenderingContext"in globalThis&&r instanceof globalThis.WebGL2RenderingContext?e={[r.RGB]:z.FLOAT,[r.RGBA]:z.FLOAT,[r.ALPHA]:z.FLOAT,[r.LUMINANCE]:z.FLOAT,[r.LUMINANCE_ALPHA]:z.FLOAT,[r.R8]:z.FLOAT,[r.R8_SNORM]:z.FLOAT,[r.RG8]:z.FLOAT,[r.RG8_SNORM]:z.FLOAT,[r.RGB8]:z.FLOAT,[r.RGB8_SNORM]:z.FLOAT,[r.RGB565]:z.FLOAT,[r.RGBA4]:z.FLOAT,[r.RGB5_A1]:z.FLOAT,[r.RGBA8]:z.FLOAT,[r.RGBA8_SNORM]:z.FLOAT,[r.RGB10_A2]:z.FLOAT,[r.RGB10_A2UI]:z.FLOAT,[r.SRGB8]:z.FLOAT,[r.SRGB8_ALPHA8]:z.FLOAT,[r.R16F]:z.FLOAT,[r.RG16F]:z.FLOAT,[r.RGB16F]:z.FLOAT,[r.RGBA16F]:z.FLOAT,[r.R32F]:z.FLOAT,[r.RG32F]:z.FLOAT,[r.RGB32F]:z.FLOAT,[r.RGBA32F]:z.FLOAT,[r.R11F_G11F_B10F]:z.FLOAT,[r.RGB9_E5]:z.FLOAT,[r.R8I]:z.INT,[r.R8UI]:z.UINT,[r.R16I]:z.INT,[r.R16UI]:z.UINT,[r.R32I]:z.INT,[r.R32UI]:z.UINT,[r.RG8I]:z.INT,[r.RG8UI]:z.UINT,[r.RG16I]:z.INT,[r.RG16UI]:z.UINT,[r.RG32I]:z.INT,[r.RG32UI]:z.UINT,[r.RGB8I]:z.INT,[r.RGB8UI]:z.UINT,[r.RGB16I]:z.INT,[r.RGB16UI]:z.UINT,[r.RGB32I]:z.INT,[r.RGB32UI]:z.UINT,[r.RGBA8I]:z.INT,[r.RGBA8UI]:z.UINT,[r.RGBA16I]:z.INT,[r.RGBA16UI]:z.UINT,[r.RGBA32I]:z.INT,[r.RGBA32UI]:z.UINT,[r.DEPTH_COMPONENT16]:z.FLOAT,[r.DEPTH_COMPONENT24]:z.FLOAT,[r.DEPTH_COMPONENT32F]:z.FLOAT,[r.DEPTH_STENCIL]:z.FLOAT,[r.DEPTH24_STENCIL8]:z.FLOAT,[r.DEPTH32F_STENCIL8]:z.FLOAT}:e={[r.RGB]:z.FLOAT,[r.RGBA]:z.FLOAT,[r.ALPHA]:z.FLOAT,[r.LUMINANCE]:z.FLOAT,[r.LUMINANCE_ALPHA]:z.FLOAT,[r.DEPTH_STENCIL]:z.FLOAT},e}function mF(r){let e;return"WebGL2RenderingContext"in globalThis&&r instanceof globalThis.WebGL2RenderingContext?e={[ae.UNSIGNED_BYTE]:{[H.RGBA]:r.RGBA8,[H.RGB]:r.RGB8,[H.RG]:r.RG8,[H.RED]:r.R8,[H.RGBA_INTEGER]:r.RGBA8UI,[H.RGB_INTEGER]:r.RGB8UI,[H.RG_INTEGER]:r.RG8UI,[H.RED_INTEGER]:r.R8UI,[H.ALPHA]:r.ALPHA,[H.LUMINANCE]:r.LUMINANCE,[H.LUMINANCE_ALPHA]:r.LUMINANCE_ALPHA},[ae.BYTE]:{[H.RGBA]:r.RGBA8_SNORM,[H.RGB]:r.RGB8_SNORM,[H.RG]:r.RG8_SNORM,[H.RED]:r.R8_SNORM,[H.RGBA_INTEGER]:r.RGBA8I,[H.RGB_INTEGER]:r.RGB8I,[H.RG_INTEGER]:r.RG8I,[H.RED_INTEGER]:r.R8I},[ae.UNSIGNED_SHORT]:{[H.RGBA_INTEGER]:r.RGBA16UI,[H.RGB_INTEGER]:r.RGB16UI,[H.RG_INTEGER]:r.RG16UI,[H.RED_INTEGER]:r.R16UI,[H.DEPTH_COMPONENT]:r.DEPTH_COMPONENT16},[ae.SHORT]:{[H.RGBA_INTEGER]:r.RGBA16I,[H.RGB_INTEGER]:r.RGB16I,[H.RG_INTEGER]:r.RG16I,[H.RED_INTEGER]:r.R16I},[ae.UNSIGNED_INT]:{[H.RGBA_INTEGER]:r.RGBA32UI,[H.RGB_INTEGER]:r.RGB32UI,[H.RG_INTEGER]:r.RG32UI,[H.RED_INTEGER]:r.R32UI,[H.DEPTH_COMPONENT]:r.DEPTH_COMPONENT24},[ae.INT]:{[H.RGBA_INTEGER]:r.RGBA32I,[H.RGB_INTEGER]:r.RGB32I,[H.RG_INTEGER]:r.RG32I,[H.RED_INTEGER]:r.R32I},[ae.FLOAT]:{[H.RGBA]:r.RGBA32F,[H.RGB]:r.RGB32F,[H.RG]:r.RG32F,[H.RED]:r.R32F,[H.DEPTH_COMPONENT]:r.DEPTH_COMPONENT32F},[ae.HALF_FLOAT]:{[H.RGBA]:r.RGBA16F,[H.RGB]:r.RGB16F,[H.RG]:r.RG16F,[H.RED]:r.R16F},[ae.UNSIGNED_SHORT_5_6_5]:{[H.RGB]:r.RGB565},[ae.UNSIGNED_SHORT_4_4_4_4]:{[H.RGBA]:r.RGBA4},[ae.UNSIGNED_SHORT_5_5_5_1]:{[H.RGBA]:r.RGB5_A1},[ae.UNSIGNED_INT_2_10_10_10_REV]:{[H.RGBA]:r.RGB10_A2,[H.RGBA_INTEGER]:r.RGB10_A2UI},[ae.UNSIGNED_INT_10F_11F_11F_REV]:{[H.RGB]:r.R11F_G11F_B10F},[ae.UNSIGNED_INT_5_9_9_9_REV]:{[H.RGB]:r.RGB9_E5},[ae.UNSIGNED_INT_24_8]:{[H.DEPTH_STENCIL]:r.DEPTH24_STENCIL8},[ae.FLOAT_32_UNSIGNED_INT_24_8_REV]:{[H.DEPTH_STENCIL]:r.DEPTH32F_STENCIL8}}:e={[ae.UNSIGNED_BYTE]:{[H.RGBA]:r.RGBA,[H.RGB]:r.RGB,[H.ALPHA]:r.ALPHA,[H.LUMINANCE]:r.LUMINANCE,[H.LUMINANCE_ALPHA]:r.LUMINANCE_ALPHA},[ae.UNSIGNED_SHORT_5_6_5]:{[H.RGB]:r.RGB},[ae.UNSIGNED_SHORT_4_4_4_4]:{[H.RGBA]:r.RGBA},[ae.UNSIGNED_SHORT_5_5_5_1]:{[H.RGBA]:r.RGBA}},e}var la=class{constructor(e){this.renderer=e,this.boundTextures=[],this.currentLocation=-1,this.managedTextures=[],this._unknownBoundTextures=!1,this.unknownTexture=new xe,this.hasIntegerTextures=!1}contextChange(){let e=this.gl=this.renderer.gl;this.CONTEXT_UID=this.renderer.CONTEXT_UID,this.webGLVersion=this.renderer.context.webGLVersion,this.internalFormats=mF(e),this.samplerTypes=pF(e);let t=e.getParameter(e.MAX_TEXTURE_IMAGE_UNITS);this.boundTextures.length=t;for(let s=0;s=0;--o){let n=t[o];n&&n._glTextures[s].samplerType!==z.FLOAT&&this.renderer.texture.unbind(n)}}initTexture(e){let t=new uo(this.gl.createTexture());return t.dirtyId=-1,e._glTextures[this.CONTEXT_UID]=t,this.managedTextures.push(e),e.on("dispose",this.destroyTexture,this),t}initTextureType(e,t){t.internalFormat=this.internalFormats[e.type]?.[e.format]??e.format,t.samplerType=this.samplerTypes[t.internalFormat]??z.FLOAT,this.webGLVersion===2&&e.type===ae.HALF_FLOAT?t.type=this.gl.HALF_FLOAT:t.type=e.type}updateTexture(e){let t=e._glTextures[this.CONTEXT_UID];if(!t)return;let i=this.renderer;if(this.initTextureType(e,t),e.resource?.upload(i,e,t))t.samplerType!==z.FLOAT&&(this.hasIntegerTextures=!0);else{let s=e.realWidth,o=e.realHeight,n=i.gl;(t.width!==s||t.height!==o||t.dirtyId<0)&&(t.width=s,t.height=o,n.texImage2D(e.target,0,t.internalFormat,s,o,0,e.format,t.type,null))}e.dirtyStyleId!==t.dirtyStyleId&&this.updateTextureStyle(e),t.dirtyId=e.dirtyId}destroyTexture(e,t){let{gl:i}=this;if(e=e.castToBaseTexture(),e._glTextures[this.CONTEXT_UID]&&(this.unbind(e),i.deleteTexture(e._glTextures[this.CONTEXT_UID].texture),e.off("dispose",this.destroyTexture,this),delete e._glTextures[this.CONTEXT_UID],!t)){let s=this.managedTextures.indexOf(e);s!==-1&&j_(this.managedTextures,s,1)}}updateTextureStyle(e){let t=e._glTextures[this.CONTEXT_UID];t&&((e.mipmap===Fr.POW2||this.webGLVersion!==2)&&!e.isPowerOfTwo?t.mipmap=!1:t.mipmap=e.mipmap>=1,this.webGLVersion!==2&&!e.isPowerOfTwo?t.wrapMode=wc.CLAMP:t.wrapMode=e.wrapMode,e.resource?.style(this.renderer,e,t)||this.setStyle(e,t),t.dirtyStyleId=e.dirtyStyleId)}setStyle(e,t){let i=this.gl;if(t.mipmap&&e.mipmap!==Fr.ON_MANUAL&&i.generateMipmap(e.target),i.texParameteri(e.target,i.TEXTURE_WRAP_S,t.wrapMode),i.texParameteri(e.target,i.TEXTURE_WRAP_T,t.wrapMode),t.mipmap){i.texParameteri(e.target,i.TEXTURE_MIN_FILTER,e.scaleMode===vr.LINEAR?i.LINEAR_MIPMAP_LINEAR:i.NEAREST_MIPMAP_NEAREST);let s=this.renderer.context.extensions.anisotropicFiltering;if(s&&e.anisotropicLevel>0&&e.scaleMode===vr.LINEAR){let o=Math.min(e.anisotropicLevel,i.getParameter(s.MAX_TEXTURE_MAX_ANISOTROPY_EXT));i.texParameterf(e.target,s.TEXTURE_MAX_ANISOTROPY_EXT,o)}}else i.texParameteri(e.target,i.TEXTURE_MIN_FILTER,e.scaleMode===vr.LINEAR?i.LINEAR:i.NEAREST);i.texParameteri(e.target,i.TEXTURE_MAG_FILTER,e.scaleMode===vr.LINEAR?i.LINEAR:i.NEAREST)}destroy(){this.renderer=null}};la.extension={type:$.RendererSystem,name:"texture"};Z.add(la);var ca=class{constructor(e){this.renderer=e}contextChange(){this.gl=this.renderer.gl,this.CONTEXT_UID=this.renderer.CONTEXT_UID}bind(e){let{gl:t,CONTEXT_UID:i}=this,s=e._glTransformFeedbacks[i]||this.createGLTransformFeedback(e);t.bindTransformFeedback(t.TRANSFORM_FEEDBACK,s)}unbind(){let{gl:e}=this;e.bindTransformFeedback(e.TRANSFORM_FEEDBACK,null)}beginTransformFeedback(e,t){let{gl:i,renderer:s}=this;t&&s.shader.bind(t),i.beginTransformFeedback(e)}endTransformFeedback(){let{gl:e}=this;e.endTransformFeedback()}createGLTransformFeedback(e){let{gl:t,renderer:i,CONTEXT_UID:s}=this,o=t.createTransformFeedback();e._glTransformFeedbacks[s]=o,t.bindTransformFeedback(t.TRANSFORM_FEEDBACK,o);for(let n=0;n(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))(ho||{});var ua=class{constructor(e,t=null,i=0,s=!1){this.next=null,this.previous=null,this._destroyed=!1,this.fn=e,this.context=t,this.priority=i,this.once=s}match(e,t=null){return this.fn===e&&this.context===t}emit(e){this.fn&&(this.context?this.fn.call(this.context,e):this.fn(e));let t=this.next;return this.once&&this.destroy(!0),this._destroyed&&(this.next=null),t}connect(e){this.previous=e,e.next&&(e.next.previous=this),this.next=e.next,e.next=this}destroy(e=!1){this._destroyed=!0,this.fn=null,this.context=null,this.previous&&(this.previous.next=this.next),this.next&&(this.next.previous=this.previous);let t=this.next;return this.next=e?null:t,this.previous=null,t}};var gF=class cr{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 ua(null,null,1/0),this.deltaMS=1/cr.targetFPMS,this.elapsedMS=1/cr.targetFPMS,this._tick=e=>{this._requestId=null,this.started&&(this.update(e),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(e,t,i=ho.NORMAL){return this._addListener(new ua(e,t,i))}addOnce(e,t,i=ho.NORMAL){return this._addListener(new ua(e,t,i,!0))}_addListener(e){let t=this._head.next,i=this._head;if(!t)e.connect(i);else{for(;t;){if(e.priority>t.priority){e.connect(i);break}i=t,t=t.next}e.previous||e.connect(i)}return this._startIfPossible(),this}remove(e,t){let i=this._head.next;for(;i;)i.match(e,t)?i=i.destroy():i=i.next;return this._head.next||this._cancelIfNeeded(),this}get count(){if(!this._head)return 0;let e=0,t=this._head;for(;t=t.next;)e++;return e}start(){this.started||(this.started=!0,this._requestIfNeeded())}stop(){this.started&&(this.started=!1,this._cancelIfNeeded())}destroy(){if(!this._protected){this.stop();let e=this._head.next;for(;e;)e=e.destroy(!0);this._head.destroy(),this._head=null}}update(e=performance.now()){let t;if(e>this.lastTime){if(t=this.elapsedMS=e-this.lastTime,t>this._maxElapsedMS&&(t=this._maxElapsedMS),t*=this.speed,this._minElapsedMS){let o=e-this._lastFrame|0;if(o{this._ticker.stop()},this.start=()=>{this._ticker.start()},this._ticker=null,this.ticker=e.sharedTicker?Er.shared:new Er,e.autoStart&&this.start()}static destroy(){if(this._ticker){let e=this._ticker;this.ticker=null,e.destroy()}}};au.extension=$.Application;Z.add(au);var xV=[];Z.handleByList($.Renderer,xV);var lu=class{constructor(e){this.renderer=e}contextChange(e){let t;if(this.renderer.context.webGLVersion===1){let i=e.getParameter(e.FRAMEBUFFER_BINDING);e.bindFramebuffer(e.FRAMEBUFFER,null),t=e.getParameter(e.SAMPLES),e.bindFramebuffer(e.FRAMEBUFFER,i)}else{let i=e.getParameter(e.DRAW_FRAMEBUFFER_BINDING);e.bindFramebuffer(e.DRAW_FRAMEBUFFER,null),t=e.getParameter(e.SAMPLES),e.bindFramebuffer(e.DRAW_FRAMEBUFFER,i)}t>=Pe.HIGH?this.multisample=Pe.HIGH:t>=Pe.MEDIUM?this.multisample=Pe.MEDIUM:t>=Pe.LOW?this.multisample=Pe.LOW:this.multisample=Pe.NONE}destroy(){}};lu.extension={type:$.RendererSystem,name:"_multisample"};Z.add(lu);var Pp=class{constructor(e){this.buffer=e||null,this.updateID=-1,this.byteLength=-1,this.refCount=0}};var cu=class{constructor(e){this.renderer=e,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(e){let{gl:t,CONTEXT_UID:i}=this,s=e._glBuffers[i]||this.createGLBuffer(e);t.bindBuffer(e.type,s.buffer)}unbind(e){let{gl:t}=this;t.bindBuffer(e,null)}bindBufferBase(e,t){let{gl:i,CONTEXT_UID:s}=this;if(this.boundBufferBases[t]!==e){let o=e._glBuffers[s]||this.createGLBuffer(e);this.boundBufferBases[t]=e,i.bindBufferBase(i.UNIFORM_BUFFER,t,o.buffer)}}bindBufferRange(e,t,i){let{gl:s,CONTEXT_UID:o}=this;i=i||0;let n=e._glBuffers[o]||this.createGLBuffer(e);s.bindBufferRange(s.UNIFORM_BUFFER,t||0,n.buffer,i*256,256)}update(e){let{gl:t,CONTEXT_UID:i}=this,s=e._glBuffers[i]||this.createGLBuffer(e);if(e._updateID!==s.updateID)if(s.updateID=e._updateID,t.bindBuffer(e.type,s.buffer),s.byteLength>=e.data.byteLength)t.bufferSubData(e.type,0,e.data);else{let o=e.static?t.STATIC_DRAW:t.DYNAMIC_DRAW;s.byteLength=e.data.byteLength,t.bufferData(e.type,e.data,o)}}dispose(e,t){if(!this.managedBuffers[e.id])return;delete this.managedBuffers[e.id];let i=e._glBuffers[this.CONTEXT_UID],s=this.gl;e.disposeRunner.remove(this),i&&(t||s.deleteBuffer(i.buffer),delete e._glBuffers[this.CONTEXT_UID])}disposeAll(e){let t=Object.keys(this.managedBuffers);for(let i=0;it.resource).filter(t=>t).map(t=>t.load());return this._load=Promise.all(e).then(()=>{let{realWidth:t,realHeight:i}=this.items[0];return this.resize(t,i),this.update(),Promise.resolve(this)}),this._load}};var hu=class extends hs{constructor(e,t){let{width:i,height:s}=t||{},o,n;Array.isArray(e)?(o=e,n=e.length):n=e,super(n,{width:i,height:s}),o&&this.initFromArray(o,t)}addBaseTextureAt(e,t){if(e.resource)this.addResourceAt(e.resource,t);else throw new Error("ArrayResource does not support RenderTexture");return this}bind(e){super.bind(e),e.target=wi.TEXTURE_2D_ARRAY}upload(e,t,i){let{length:s,itemDirtyIds:o,items:n}=this,{gl:a}=e;i.dirtyId<0&&a.texImage3D(a.TEXTURE_2D_ARRAY,0,i.internalFormat,this._width,this._height,s,0,t.format,i.type,null);for(let l=0;l0)if(e.resource)this.addResourceAt(e.resource,t);else throw new Error("CubeResource does not support copying of renderTexture.");else e.target=wi.TEXTURE_CUBE_MAP_POSITIVE_X+t,e.parentTextureArray=this.baseTexture,this.items[t]=e;return e.valid&&!this.valid&&this.resize(e.realWidth,e.realHeight),this.items[t]=e,this}upload(e,t,i){let s=this.itemDirtyIds;for(let o=0;o{if(this.url===null){e(this);return}try{let i=await K.ADAPTER.fetch(this.url,{mode:this.crossOrigin?"cors":"no-cors"});if(this.destroyed)return;let s=await i.blob();if(this.destroyed)return;let o=await createImageBitmap(s,{premultiplyAlpha:this.alphaMode===null||this.alphaMode===or.UNPACK?"premultiply":"none"});if(this.destroyed){o.close();return}this.source=o,this.update(),e(this)}catch(i){if(this.destroyed)return;t(i),this.onError.emit(i)}}),this._load)}upload(e,t,i){return this.source instanceof ImageBitmap?(typeof this.alphaMode=="number"&&(t.alphaMode=this.alphaMode),super.upload(e,t,i)):(this.load(),!1)}dispose(){this.ownsImageBitmap&&this.source instanceof ImageBitmap&&this.source.close(),super.dispose(),this._load=null}static test(e){return!!globalThis.createImageBitmap&&typeof ImageBitmap<"u"&&(typeof e=="string"||e instanceof ImageBitmap)}static get EMPTY(){return r._EMPTY=r._EMPTY??K.ADAPTER.createCanvas(0,0),r._EMPTY}};var vb=class Rp extends pt{constructor(e,t){t=t||{},super(K.ADAPTER.createCanvas()),this._width=0,this._height=0,this.svg=e,this.scale=t.scale||1,this._overrideWidth=t.width,this._overrideHeight=t.height,this._resolve=null,this._crossorigin=t.crossorigin,this._load=null,t.autoLoad!==!1&&this.load()}load(){return this._load?this._load:(this._load=new Promise(e=>{if(this._resolve=()=>{this.update(),e(this)},Rp.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(){let e=new Image;pt.crossOrigin(e,this.svg,this._crossorigin),e.src=this.svg,e.onerror=t=>{this._resolve&&(e.onerror=null,this.onError.emit(t))},e.onload=()=>{if(!this._resolve)return;let t=e.width,i=e.height;if(!t||!i)throw new Error("The SVG image must have width and height defined (in pixels), canvas API needs them.");let s=t*this.scale,o=i*this.scale;(this._overrideWidth||this._overrideHeight)&&(s=this._overrideWidth||this._overrideHeight/i*t,o=this._overrideHeight||this._overrideWidth/t*i),s=Math.round(s),o=Math.round(o);let n=this.source;n.width=s,n.height=o,n._pixiId=`canvas_${Ai()}`,n.getContext("2d").drawImage(e,0,0,t,i,0,0,s,o),this._resolve(),this._resolve=null}}static getSize(e){let t=Rp.SVG_SIZE.exec(e),i={};return t&&(i[t[1]]=Math.round(parseFloat(t[3])),i[t[5]]=Math.round(parseFloat(t[7]))),i}dispose(){super.dispose(),this._resolve=null,this._crossorigin=null}static test(e,t){return t==="svg"||typeof e=="string"&&e.startsWith("data:image/svg+xml")||typeof e=="string"&&Rp.SVG_XML.test(e)}};vb.SVG_XML=/^(<\?xml[^?]+\?>)?\s*()]*-->)?\s*\]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*>/i;var Tb=vb;var Ip=class extends pt{constructor(e){super(e)}static test(e){return!!globalThis.VideoFrame&&e instanceof globalThis.VideoFrame}};var Sb=class wb extends pt{constructor(e,t){if(t=t||{},!(e instanceof HTMLVideoElement)){let i=document.createElement("video");t.autoLoad!==!1&&i.setAttribute("preload","auto"),t.playsinline!==!1&&(i.setAttribute("webkit-playsinline",""),i.setAttribute("playsinline","")),t.muted===!0&&(i.setAttribute("muted",""),i.muted=!0),t.loop===!0&&i.setAttribute("loop",""),t.autoPlay!==!1&&i.setAttribute("autoplay",""),typeof e=="string"&&(e=[e]);let s=e[0].src||e[0];pt.crossOrigin(i,s,t.crossorigin);for(let o=0;o{this.valid?t(this):(this._resolve=t,this._reject=i,e.load())}),this._load}_onError(e){this.source.removeEventListener("error",this._onError,!0),this.onError.emit(e),this._reject&&(this._reject(e),this._reject=null,this._resolve=null)}_isSourcePlaying(){let e=this.source;return!e.paused&&!e.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(){let e=this.source;e.removeEventListener("canplay",this._onCanPlay),e.removeEventListener("canplaythrough",this._onCanPlay);let t=this.valid;this._msToNextUpdate=0,this.update(),this._msToNextUpdate=0,!t&&this._resolve&&(this._resolve(this),this._resolve=null,this._reject=null),this._isSourcePlaying()?this._onPlayStart():this.autoPlay&&e.play()}dispose(){this._configureAutoUpdate();let e=this.source;e&&(e.removeEventListener("play",this._onPlayStart),e.removeEventListener("pause",this._onPlayStop),e.removeEventListener("seeked",this._onSeeked),e.removeEventListener("canplay",this._onCanPlay),e.removeEventListener("canplaythrough",this._onCanPlay),e.removeEventListener("error",this._onError,!0),e.pause(),e.src="",e.load()),super.dispose()}get autoUpdate(){return this._autoUpdate}set autoUpdate(e){e!==this._autoUpdate&&(this._autoUpdate=e,this._configureAutoUpdate())}get updateFPS(){return this._updateFPS}set updateFPS(e){e!==this._updateFPS&&(this._updateFPS=e,this._configureAutoUpdate())}_configureAutoUpdate(){this._autoUpdate&&this._isSourcePlaying()?!this._updateFPS&&this.source.requestVideoFrameCallback?(this._isConnectedToTicker&&(Er.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||(Er.shared.add(this.update,this),this._isConnectedToTicker=!0,this._msToNextUpdate=0)):(this._videoFrameRequestCallbackHandle!==null&&(this.source.cancelVideoFrameCallback(this._videoFrameRequestCallbackHandle),this._videoFrameRequestCallbackHandle=null),this._isConnectedToTicker&&(Er.shared.remove(this.update,this),this._isConnectedToTicker=!1,this._msToNextUpdate=0))}static test(e,t){return globalThis.HTMLVideoElement&&e instanceof HTMLVideoElement||wb.TYPES.includes(t)}};Sb.TYPES=["mp4","m4v","webm","ogg","ogv","h264","avi","mov"],Sb.MIME_TYPES={ogv:"video/ogg",mov:"video/quicktime",m4v:"video/mp4"};var Eb=Sb;Dc.push(pu,no,du,Eb,Ip,Tb,Qs,bb,hu);var yV={vec3(r,e,t,i){(t[0]!==i[0]||t[1]!==i[1]||t[2]!==i[2])&&(t[0]=i[0],t[1]=i[1],t[2]=i[2],r.uniform3f(e,i[0],i[1],i[2]))},int(r,e,t,i){r.uniform1i(e,i)},ivec2(r,e,t,i){r.uniform2i(e,i[0],i[1])},ivec3(r,e,t,i){r.uniform3i(e,i[0],i[1],i[2])},ivec4(r,e,t,i){r.uniform4i(e,i[0],i[1],i[2],i[3])},uint(r,e,t,i){r.uniform1ui(e,i)},uvec2(r,e,t,i){r.uniform2ui(e,i[0],i[1])},uvec3(r,e,t,i){r.uniform3ui(e,i[0],i[1],i[2])},uvec4(r,e,t,i){r.uniform4ui(e,i[0],i[1],i[2],i[3])},bvec2(r,e,t,i){r.uniform2i(e,i[0],i[1])},bvec3(r,e,t,i){r.uniform3i(e,i[0],i[1],i[2])},bvec4(r,e,t,i){r.uniform4i(e,i[0],i[1],i[2],i[3])},mat2(r,e,t,i){r.uniformMatrix2fv(e,!1,i)},mat4(r,e,t,i){r.uniformMatrix4fv(e,!1,i)}},_V={float(r,e,t,i){r.uniform1fv(e,i)},vec2(r,e,t,i){r.uniform2fv(e,i)},vec3(r,e,t,i){r.uniform3fv(e,i)},vec4(r,e,t,i){r.uniform4fv(e,i)},int(r,e,t,i){r.uniform1iv(e,i)},ivec2(r,e,t,i){r.uniform2iv(e,i)},ivec3(r,e,t,i){r.uniform3iv(e,i)},ivec4(r,e,t,i){r.uniform4iv(e,i)},uint(r,e,t,i){r.uniform1uiv(e,i)},uvec2(r,e,t,i){r.uniform2uiv(e,i)},uvec3(r,e,t,i){r.uniform3uiv(e,i)},uvec4(r,e,t,i){r.uniform4uiv(e,i)},bool(r,e,t,i){r.uniform1iv(e,i)},bvec2(r,e,t,i){r.uniform2iv(e,i)},bvec3(r,e,t,i){r.uniform3iv(e,i)},bvec4(r,e,t,i){r.uniform4iv(e,i)},sampler2D(r,e,t,i){r.uniform1iv(e,i)},samplerCube(r,e,t,i){r.uniform1iv(e,i)},sampler2DArray(r,e,t,i){r.uniform1iv(e,i)}};function yF(r,e,t,i,s){let o=0,n=null,a=null,l=s.gl;for(let c in r.uniforms){let u=e[c],h=i[c],d=t[c],f=r.uniforms[c];if(!u){f.group===!0&&s.shader.syncUniformGroup(h);continue}u.type==="float"&&u.size===1&&!u.isArray?h!==d.value&&(d.value=h,l.uniform1f(d.location,h)):u.type==="bool"&&u.size===1&&!u.isArray?h!==d.value&&(d.value=h,l.uniform1i(d.location,Number(h))):(u.type==="sampler2D"||u.type==="samplerCube"||u.type==="sampler2DArray")&&u.size===1&&!u.isArray?(s.texture.bind(h,o),d.value!==o&&(d.value=o,l.uniform1i(d.location,o)),o++):u.type==="mat3"&&u.size===1&&!u.isArray?f.a!==void 0?l.uniformMatrix3fv(d.location,!1,h.toArray(!0)):l.uniformMatrix3fv(d.location,!1,h):u.type==="vec2"&&u.size===1&&!u.isArray?f.x!==void 0?(a=d.value,n=h,(a[0]!==n.x||a[1]!==n.y)&&(a[0]=n.x,a[1]=n.y,l.uniform2f(d.location,n.x,n.y))):(a=d.value,n=h,(a[0]!==n[0]||a[1]!==n[1])&&(a[0]=n[0],a[1]=n[1],l.uniform2f(d.location,n[0],n[1]))):u.type==="vec4"&&u.size===1&&!u.isArray?f.width!==void 0?(a=d.value,n=h,(a[0]!==n.x||a[1]!==n.y||a[2]!==n.width||a[3]!==n.height)&&(a[0]=n.x,a[1]=n.y,a[2]=n.width,a[3]=n.height,l.uniform4f(d.location,n.x,n.y,n.width,n.height))):(a=d.value,n=h,(a[0]!==n[0]||a[1]!==n[1]||a[2]!==n[2]||a[3]!==n[3])&&(a[0]=n[0],a[1]=n[1],a[2]=n[2],a[3]=n[3],l.uniform4f(d.location,n[0],n[1],n[2],n[3]))):(u.size===1&&!u.isArray?yV:_V)[u.type].call(null,l,d.location,d.value,h)}}function bV(){Object.assign(us.prototype,{systemCheck(){},syncUniforms(r,e){let{shader:t,renderer:i}=this;yF(r,t.program.uniformData,e.uniformData,r.uniforms,i)}})}bV();var mu=new(window.AudioContext||window.webkitAudioContext),vV=(r,e)=>{let t,i=mu.createGain();i.gain.value=e.volume??1,i.connect(mu.destination);let s={id:r,url:e.url,loop:e.loop||!1,volume:e.volume??1};return{play:()=>{let m=yn.getAsset(s.url);if(!m){console.warn("AudioPlayer.play: Asset not found",s.url);return}t=mu.createBufferSource(),t.buffer=m,t.loop=s.loop,i.gain.setValueAtTime(s.volume,mu.currentTime),t.connect(i),t.start(0)},stop:()=>{t&&(t.stop(),t.disconnect(),i.disconnect(),i.connect(mu.destination))},update:m=>{s={...s,...m}},getId:()=>s.id,getUrl:()=>s.url,getLoop:()=>s.loop,getVolume:()=>s.volume,setUrl:m=>{s.url=m},setLoop:m=>{s.loop=m},setVolume:m=>{s.volume=m,i.gain.value=m},get id(){return s.id},get url(){return s.url},get loop(){return s.loop},get volume(){return s.volume},gainNode:i}},_F=()=>{let r=[],e=[];return{add:a=>{e.push(a)},remove:a=>{e=e.filter(l=>l.id!==a)},getById:a=>e.find(l=>l.id===a),tick:()=>{for(let l of e){let c=r.find(u=>u.id===l.id);if(!c){let u=vV(l.id,{url:l.url,loop:l.loop,volume:l.volume??1});r.push(u),u.play();continue}(c.url!==l.url||c.loop!==l.loop)&&(c.stop(),c.setUrl(l.url),c.setLoop(l.loop??!1),c.play()),c.getVolume()!==(l.volume??1)&&c.setVolume(l.volume??1)}let a=[];for(let l of r)e.find(c=>c.id===l.id)||(l.stop(),a.push(l.id));r=r.filter(l=>!a.includes(l.id))},destroy:()=>{for(let a of r)a.stop();r=[],e=[]}}};var TV=({JSONObject:r,parserPlugins:e=[]})=>r.map(i=>{let s=e.find(o=>o.type===i.type);if(!s)throw new Error(`No parser plugin found for element type: ${i.type} (id: ${i.id??"unknown"})`);return s.parse({state:i,parserPlugins:e})});var Ab=TV;var bF=({type:r,parse:e})=>({type:r,parse:e});var Pb=typeof navigator<"u"?navigator.userAgent.toLowerCase().indexOf("firefox")>0:!1;function Cb(r,e,t,i){r.addEventListener?r.addEventListener(e,t,i):r.attachEvent&&r.attachEvent(`on${e}`,t)}function gu(r,e,t,i){r&&(r.removeEventListener?r.removeEventListener(e,t,i):r.detachEvent&&r.detachEvent(`on${e}`,t))}function SF(r,e){let t=e.slice(0,e.length-1),i=[];for(let s=0;s=0;)e[t-1]+=",",e.splice(t,1),t=e.lastIndexOf("");return e}function SV(r,e){let t=r.length>=e.length?r:e,i=r.length>=e.length?e:r,s=!0;for(let o=0;o_u[r.toLowerCase()]||Lr[r.toLowerCase()]||r.toUpperCase().charCodeAt(0),wV=r=>Object.keys(_u).find(e=>_u[e]===r),EV=r=>Object.keys(Lr).find(e=>Lr[e]===r),PF=r=>{AF=r||"all"},bu=()=>AF||"all",AV=()=>ze.slice(0),PV=()=>ze.map(r=>wV(r)||EV(r)||String.fromCharCode(r)),CV=()=>{let r=[];return Object.keys(qe).forEach(e=>{qe[e].forEach(({key:t,scope:i,mods:s,shortcut:o})=>{r.push({scope:i,shortcut:o,mods:s,keys:t.split("+").map(n=>ha(n))})})}),r},CF=r=>{let e=r.target||r.srcElement,{tagName:t}=e,i=!0,s=t==="INPUT"&&!["checkbox","radio","range","button","file","reset","submit","color"].includes(e.type);return(e.isContentEditable||(s||t==="TEXTAREA"||t==="SELECT")&&!e.readOnly)&&(i=!1),i},MV=r=>(typeof r=="string"&&(r=ha(r)),ze.indexOf(r)!==-1),RV=(r,e)=>{let t,i;r||(r=bu());for(let s in qe)if(Object.prototype.hasOwnProperty.call(qe,s))for(t=qe[s],i=0;iRb(o)):i++;bu()===r&&PF(e||"all")};function IV(r){let e=EF(r);r.key&&r.key.toLowerCase()==="capslock"&&(e=ha(r.key));let t=ze.indexOf(e);if(t>=0&&ze.splice(t,1),r.key&&r.key.toLowerCase()==="meta"&&ze.splice(0,ze.length),(e===93||e===224)&&(e=91),e in At){At[e]=!1;for(let i in Lr)Lr[i]===e&&(ur[i]=!1)}}var MF=(r,...e)=>{if(typeof r>"u")Object.keys(qe).forEach(t=>{Array.isArray(qe[t])&&qe[t].forEach(i=>Bp(i)),delete qe[t]}),Rb(null);else if(Array.isArray(r))r.forEach(t=>{t.key&&Bp(t)});else if(typeof r=="object")r.key&&Bp(r);else if(typeof r=="string"){let[t,i]=e;typeof t=="function"&&(i=t,t=""),Bp({key:r,scope:t,method:i,splitKey:"+"})}},Bp=({key:r,scope:e,method:t,splitKey:i="+"})=>{wF(r).forEach(s=>{let o=s.split(i),n=o.length,a=o[n-1],l=a==="*"?"*":ha(a);if(!qe[l])return;e||(e=bu());let c=n>1?SF(Lr,o):[],u=[];qe[l]=qe[l].filter(h=>{let d=(t?h.method===t:!0)&&h.scope===e&&SV(h.mods,c);return d&&u.push(h.element),!d}),u.forEach(h=>Rb(h))})};function vF(r,e,t,i){if(e.element!==i)return;let s;if(e.scope===t||e.scope==="all"){s=e.mods.length>0;for(let o in At)Object.prototype.hasOwnProperty.call(At,o)&&(!At[o]&&e.mods.indexOf(+o)>-1||At[o]&&e.mods.indexOf(+o)===-1)&&(s=!1);(e.mods.length===0&&!At[16]&&!At[18]&&!At[17]&&!At[91]||s||e.shortcut==="*")&&(e.keys=[],e.keys=e.keys.concat(ze),e.method(r,e)===!1&&(r.preventDefault?r.preventDefault():r.returnValue=!1,r.stopPropagation&&r.stopPropagation(),r.cancelBubble&&(r.cancelBubble=!0)))}}function TF(r,e){let t=qe["*"],i=EF(r);if(r.key&&r.key.toLowerCase()==="capslock"||!(ur.filter||CF).call(this,r))return;if((i===93||i===224)&&(i=91),ze.indexOf(i)===-1&&i!==229&&ze.push(i),["metaKey","ctrlKey","altKey","shiftKey"].forEach(a=>{let l=xu[a];r[a]&&ze.indexOf(l)===-1?ze.push(l):!r[a]&&ze.indexOf(l)>-1?ze.splice(ze.indexOf(l),1):a==="metaKey"&&r[a]&&(ze=ze.filter(c=>c in xu||c===i))}),i in At){At[i]=!0;for(let a in Lr)if(Object.prototype.hasOwnProperty.call(Lr,a)){let l=xu[Lr[a]];ur[a]=r[l]}if(!t)return}for(let a in At)Object.prototype.hasOwnProperty.call(At,a)&&(At[a]=r[xu[a]]);r.getModifierState&&!(r.altKey&&!r.ctrlKey)&&r.getModifierState("AltGraph")&&(ze.indexOf(17)===-1&&ze.push(17),ze.indexOf(18)===-1&&ze.push(18),At[17]=!0,At[18]=!0);let s=bu();if(t)for(let a=0;a1&&(s=SF(Lr,f));let p=f[f.length-1];p=p==="*"?"*":ha(p),p in qe||(qe[p]=[]),qe[p].push({keyup:l,keydown:c,scope:o,mods:s,shortcut:i[a],method:t,key:i[a],splitKey:u,element:n})}if(typeof n<"u"&&typeof window<"u"){if(!Fi.has(n)){let f=(m=window.event)=>TF(m,n),p=(m=window.event)=>{TF(m,n),IV(m)};Fi.set(n,{keydownListener:f,keyupListenr:p,capture:h}),Cb(n,"keydown",f,h),Cb(n,"keyup",p,h)}if(!yu){let f=()=>{ze=[]};yu={listener:f,capture:h},Cb(window,"focus",f,h)}}};function BV(r,e="all"){Object.keys(qe).forEach(t=>{qe[t].filter(i=>i.scope===e&&i.shortcut===r).forEach(i=>{i&&i.method&&i.method({},i)})})}function Rb(r){let e=Object.values(qe).flat();if(e.findIndex(({element:t})=>t===r)<0&&r){let{keydownListener:t,keyupListenr:i,capture:s}=Fi.get(r)||{};t&&i&&(gu(r,"keyup",i,s),gu(r,"keydown",t,s),Fi.delete(r))}if((e.length<=0||Fi.size<=0)&&(Array.from(Fi.keys()).forEach(t=>{let{keydownListener:i,keyupListenr:s,capture:o}=Fi.get(t)||{};i&&s&&(gu(t,"keyup",s,o),gu(t,"keydown",i,o),Fi.delete(t))}),Fi.clear(),Object.keys(qe).forEach(t=>delete qe[t]),yu)){let{listener:t,capture:i}=yu;gu(window,"focus",t,i),yu=null}}var Mb={getPressedKeyString:PV,setScope:PF,getScope:bu,deleteScope:RV,getPressedKeyCodes:AV,getAllKeyCodes:CV,isPressed:MV,filter:CF,trigger:BV,unbind:MF,keyMap:_u,modifier:Lr,modifierMap:xu};for(let r in Mb){let e=r;Object.prototype.hasOwnProperty.call(Mb,e)&&(ur[e]=Mb[e])}if(typeof window<"u"){let r=window.hotkeys;ur.noConflict=e=>(e&&window.hotkeys===ur&&(window.hotkeys=r),ur),window.hotkeys=ur}var kV=Object.prototype.hasOwnProperty,RF=r=>{let e=new Map;return{registerHotkeys:(s={})=>{if(typeof s!="object"||s===null)return;let o=[],n=[],a=[];Object.keys(s).forEach(l=>{let c=e.get(l);c?pe(c.payload,s[l].payload)||(n.push(l),ur.unbind(l)):o.push(l)}),e.forEach((l,c)=>{kV.call(s,c)||a.push(c)}),a.forEach(l=>{ur.unbind(l),e.delete(l)}),[...o,...n].forEach(l=>{let u=s[l].payload??{};ur(l,()=>{r&&r("keydown",{_event:{key:l},...u})}),e.set(l,{value:l,payload:u})})},destroy:()=>{for(let s of e.keys())ur.unbind(s);e.clear()}}};var BF=(r,e)=>typeof e!="string"?e:r[e]??e,FV=(r,e,t,i)=>{let s=BF(t,e);if(typeof s=="string"){let n=r[s];return n===void 0?i:n}let o=r;for(let n of s){if(o==null)return i;o=o[n]}return o===void 0?i:o},IF=(r,e,t,i)=>{let s=BF(t,e);if(typeof s=="string")return r[s]=i,r;let o=r;for(let n=0;n{if(!r||!Object.prototype.hasOwnProperty.call(r,e))throw new Error(`Animation "${t}" cannot auto-resolve property "${e}" from targetState.`);return r[e]},UV=(r,e,t,i,s)=>Object.entries(e).map(([o,n])=>{if(!Cd[o])throw new Error(`${o} is not a supported property for animation.`);let a=FV(r,o,t,0);if(n.auto){let u=OV(i,o,s);if(a===u)return null;let h=Mn([{value:a},{duration:n.auto.duration,value:u,easing:n.auto.easing}]);return{property:o,timeline:h}}let l=n.initialValue??a,c=Mn([{value:l},...n.keyframes]);return{property:o,timeline:c}}).filter(Boolean),kF=()=>{let r=[],e=new Map,t=new Map,i=0,s=null,o=!1,n=(M,F)=>Math.min(Math.max(M,0),Math.max(F??0,0)),a=(M,F)=>{let O=n(F,M.duration);return M.currentTime=O,M.applyFrame(O),O>=M.duration},l=(M,F)=>{t.get(M)?.forEach(O=>{try{O(F)}catch{}})},c=M=>{if(l("completed",{id:M.id}),M.onComplete)try{M.onComplete()}catch{}},u=M=>{M.applyFrame(0),e.set(M.id,M);let F=s!==null&&a(M,s);l("started",{id:M.id}),F&&(c(M),e.delete(M.id))},h=M=>{let{id:F,element:O,properties:D,targetState:N,onComplete:L,onCancel:Y,propertyPathMap:ue=Md}=M,J=UV(O,D,ue,N,F);if(J.length===0){c({id:F,onComplete:L});return}let Be={id:F,kind:"property",element:O,timelines:J,duration:mc(J),currentTime:0,stateVersion:i,targetState:N,onComplete:L,onCancel:Y,applyFrame:ke=>{for(let{property:Me,timeline:$e}of J){let it=gc($e,ke);try{IF(O,Me,ue,it)}catch{}}},applyTargetState:()=>{if(!(!O||O.destroyed)){if(N===null){O.destroy();return}if(N)for(let[ke,Me]of Object.entries(N))try{IF(O,ke,ue,Me)}catch{}}},isValid:()=>!!O&&!O.destroyed};u(Be)},d=M=>{let F={id:M.id,kind:"custom",duration:M.duration??0,currentTime:0,stateVersion:i,onComplete:M.onComplete,onCancel:M.onCancel,applyFrame:M.applyFrame??(()=>{}),applyTargetState:M.applyTargetState??(()=>{}),isValid:M.isValid??(()=>!0)};u(F)},f=M=>{if(M.driver==="custom"){d(M);return}h(M)},p=M=>{try{M.applyTargetState?.()}catch{}if(M.onCancel)try{M.onCancel()}catch{}},m=M=>{switch(M.type){case"START":f(M.payload);break;case"CANCEL":v(M.id);break}},g=()=>{let M=r.splice(0);for(let F of M)m(F)},_=()=>{s===null||o||(o=!0,queueMicrotask(()=>{o=!1,s!==null&&g()}))},v=M=>{let F=e.get(M);F&&(p(F),e.delete(M),l("cancelled",{id:M}))},x=M=>{r.push(M),_()},T=()=>{for(let[M,F]of e)p(F),l("cancelled",{id:M});e.clear(),i++},b=M=>{g();let F=[];for(let[O,D]of e){if(D.stateVersion!==i){F.push(O);continue}if(!D.isValid()){F.push(O);continue}if(D.currentTime+=M,D.currentTime>=D.duration){D.applyFrame(D.duration),c(D),F.push(O);continue}D.applyFrame(D.currentTime)}for(let O of F)e.delete(O)},w=M=>{s=M,g();let F=[];for(let[O,D]of e){if(D.stateVersion!==i){F.push(O);continue}if(!D.isValid()){F.push(O);continue}a(D,M)&&(c(D),F.push(O))}for(let O of F)e.delete(O)},E=()=>{s=null},I=()=>{g()},B=(M,F)=>(t.has(M)||t.set(M,new Set),t.get(M).add(F),()=>C(M,F)),C=(M,F)=>{t.get(M)?.delete(F)};return{dispatch:x,cancelAll:T,flush:I,tick:b,setTime:w,clearTime:E,on:B,off:C,getState:()=>({stateVersion:i,activeCount:e.size,animations:Array.from(e.entries()).map(([M,F])=>({id:M,currentTime:F.currentTime,duration:F.duration,progress:F.duration>0?F.currentTime/F.duration:0}))}),isAnimating:M=>e.has(M),destroy:()=>{T(),t.clear()}}};var FF=r=>{let e=0,t=0,i=null,s=!1,o=!1,n=d=>{o||(o=!0,r?.("renderComplete",d))};return{reset:d=>{e>0&&i!==null&&!o&&r?.("renderComplete",{id:i,aborted:!0}),t++,e=0,i=d,s=!0,o=!1},track:d=>{d===t&&e++},complete:d=>{d!==t||e===0||(e--,e===0&&!s&&n({id:i,aborted:!1}))},getVersion:()=>t,completeIfEmpty:()=>{s=!1,e===0&&n({id:i,aborted:!1})}}};var OF=new Set(["update","transition"]),GV=new Set(["alpha","x","y","scaleX","scaleY","rotation"]),LV=new Set(["translateX","translateY","alpha","scaleX","scaleY","rotation"]),UF=new Set(["single","sequence","composite"]),kp=new Set(["red","green","blue","alpha"]),GF=new Set(["max","min","multiply","add"]),DF=new Set(nf),ci=(r,e)=>{if(!r||typeof r!="object"||Array.isArray(r))throw new Error(`${e} must be an object.`)},fo=(r,e)=>{if(typeof r!="string"||r.length===0)throw new Error(`${e} must be a non-empty string.`)},vu=(r,e)=>{if(typeof r!="number"||Number.isNaN(r))throw new Error(`${e} must be a number.`)},DV=(r,e)=>{if(ci(r,e),vu(r.duration,`${e}.duration`),r.easing!==void 0&&typeof r.easing!="string")throw new Error(`${e}.easing must be a string.`);if(r.easing!==void 0&&!DF.has(r.easing))throw new Error(`${e}.easing must be one of: ${nf.join(", ")}.`);return{duration:r.duration,easing:r.easing??"linear"}},Bb=(r,e)=>{ci(r,e);let t={};if(r.initialValue!==void 0&&(vu(r.initialValue,`${e}.initialValue`),t.initialValue=r.initialValue),!Array.isArray(r.keyframes)||r.keyframes.length===0)throw new Error(`${e}.keyframes must be a non-empty array.`);return t.keyframes=r.keyframes.map((i,s)=>{let o=`${e}.keyframes[${s}]`;if(ci(i,o),vu(i.value,`${o}.value`),vu(i.duration,`${o}.duration`),i.easing!==void 0&&typeof i.easing!="string")throw new Error(`${o}.easing must be a string.`);if(i.easing!==void 0&&!DF.has(i.easing))throw new Error(`${o}.easing must be one of: ${nf.join(", ")}.`);if(i.relative!==void 0&&typeof i.relative!="boolean")throw new Error(`${o}.relative must be a boolean.`);return{value:i.value,duration:i.duration,easing:i.easing??"linear",...i.relative!==void 0?{relative:i.relative}:{}}}),t},NV=(r,e)=>{ci(r,e);let t=r.keyframes!==void 0,i=r.auto!==void 0;if(t&&i)throw new Error(`${e} cannot define both keyframes and auto.`);if(!t&&!i)throw new Error(`${e} must define keyframes or auto.`);if(i){if(r.initialValue!==void 0)throw new Error(`${e}.initialValue is not valid when auto is defined.`);return{auto:DV(r.auto,`${e}.auto`)}}return Bb(r,e)},NF=(r,e,t,i=Bb)=>{ci(r,e);let s=Object.entries(r).map(([o,n])=>{if(!t.has(o))throw new Error(`${e}.${o} is not a supported animation property.`);return[o,i(n,`${e}.${o}`)]});if(s.length===0)throw new Error(`${e} must define at least one property.`);return Object.fromEntries(s)},HV=(r,e)=>{if(ci(r,e),fo(r.texture,`${e}.texture`),r.channel!==void 0&&!kp.has(r.channel))throw new Error(`${e}.channel must be one of: ${Array.from(kp).join(", ")}.`);if(r.invert!==void 0&&typeof r.invert!="boolean")throw new Error(`${e}.invert must be a boolean.`);return{texture:r.texture,...r.channel?{channel:r.channel}:{},...r.invert!==void 0?{invert:r.invert}:{}}},VV=(r,e)=>{if(ci(r,e),!UF.has(r.kind))throw new Error(`${e}.kind must be one of: ${Array.from(UF).join(", ")}.`);let t={kind:r.kind};if(r.channel!==void 0){if(!kp.has(r.channel))throw new Error(`${e}.channel must be one of: ${Array.from(kp).join(", ")}.`);t.channel=r.channel}if(r.softness!==void 0&&(vu(r.softness,`${e}.softness`),t.softness=r.softness),r.invert!==void 0){if(typeof r.invert!="boolean")throw new Error(`${e}.invert must be a boolean.`);t.invert=r.invert}if(r.progress!==void 0&&(t.progress=Bb(r.progress,`${e}.progress`)),r.kind==="single"&&(fo(r.texture,`${e}.texture`),t.texture=r.texture),r.kind==="sequence"){if(!Array.isArray(r.textures)||r.textures.length===0)throw new Error(`${e}.textures must be a non-empty array.`);t.textures=r.textures.map((i,s)=>(fo(i,`${e}.textures[${s}]`),i)),r.sample!==void 0&&(fo(r.sample,`${e}.sample`),t.sample=r.sample)}if(r.kind==="composite"){if(!GF.has(r.combine??"max"))throw new Error(`${e}.combine must be one of: ${Array.from(GF).join(", ")}.`);if(!Array.isArray(r.items)||r.items.length===0)throw new Error(`${e}.items must be a non-empty array.`);t.combine=r.combine??"max",t.items=r.items.map((i,s)=>HV(i,`${e}.items[${s}]`))}return t.progress||(t.progress={initialValue:0,keyframes:[{duration:0,value:1,easing:"linear"}]}),t},LF=(r,e)=>{if(ci(r,e),r.mask!==void 0)throw new Error(`${e}.mask is not valid. Define mask on ${e}.`);let t={};if(r.tween!==void 0&&(t.tween=NF(r.tween,`${e}.tween`,LV)),Object.keys(t).length===0)throw new Error(`${e} must define tween.`);return t},WV=(r,e)=>{let t={};if(r.shader!==void 0)throw new Error(`${e}.shader is not supported.`);if(r.prev!==void 0&&(t.prev=LF(r.prev,`${e}.prev`)),r.next!==void 0&&(t.next=LF(r.next,`${e}.next`)),r.mask!==void 0&&(t.mask=VV(r.mask,`${e}.mask`)),t.prev===void 0&&t.next===void 0&&t.mask===void 0)throw new Error(`${e} must define prev, next, or mask.`);return t},Ib=(r,e,t)=>{if(r!==void 0)throw new Error(`${e} ${t}`)},HF=(r=[])=>{if(!Array.isArray(r))throw new Error("Input error: `animations` must be an array.");let e=r.map((i,s)=>{let o=`animations[${s}]`;if(ci(i,o),fo(i.id,`${o}.id`),fo(i.targetId,`${o}.targetId`),fo(i.type,`${o}.type`),!OF.has(i.type))throw new Error(`${o}.type must be one of: ${Array.from(OF).join(", ")}.`);let n={id:i.id,targetId:i.targetId,type:i.type};if(i.complete!==void 0&&(ci(i.complete,`${o}.complete`),n.complete=i.complete),Ib(i.operation,`${o}.operation`,"is no longer supported. Use `type: update | transition` instead."),Ib(i.properties,`${o}.properties`,"is no longer supported. Use `tween` instead."),Ib(i.subjects,`${o}.subjects`,"is no longer supported. Use `prev` / `next` instead."),i.type==="update"){if(n.tween=NF(i.tween,`${o}.tween`,GV,NV),i.replace!==void 0)throw new Error(`${o}.replace is no longer supported. Define \`prev\`, \`next\`, or \`mask\` directly on the animation.`);if(i.prev!==void 0)throw new Error(`${o}.prev is only valid for transition animations.`);if(i.next!==void 0)throw new Error(`${o}.next is only valid for transition animations.`);if(i.mask!==void 0)throw new Error(`${o}.mask is only valid for transition animations.`);if(i.shader!==void 0)throw new Error(`${o}.shader is not supported.`);return n}if(i.tween!==void 0)throw new Error(`${o}.tween is not valid for transition animations.`);if(i.replace!==void 0)throw new Error(`${o}.replace is no longer supported. Define \`prev\`, \`next\`, or \`mask\` directly on the animation.`);let a=WV(i,o);return a.prev!==void 0&&(n.prev=a.prev),a.next!==void 0&&(n.next=a.next),a.mask!==void 0&&(n.mask=a.mask),n}),t=new Map;for(let i of e){let s=t.get(i.targetId)??new Set;s.add(i.type),t.set(i.targetId,s)}for(let[i,s]of t)if(s.has("transition")&&s.size>1)throw new Error(`Animations targeting "${i}" cannot mix update and transition types in the same state.`);return e};var kb=(r={})=>{if(r===null||typeof r!="object")throw new Error("Input error: render state must be an object.");if(r.transitions!==void 0)throw new Error("Input error: `transitions` is no longer supported. Use `animations` instead.");let e={...r,elements:r.elements??[],animations:r.animations??[],audio:r.audio??[]};if(!Array.isArray(e.elements))throw new Error("Input error: `elements` must be an array.");if(!Array.isArray(e.animations))throw new Error("Input error: `animations` must be an array.");if(!Array.isArray(e.audio))throw new Error("Input error: `audio` must be an array.");return e.animations=HF(e.animations),e};var zV="0",da=(r,e)=>{let t=r?.[e];return typeof t=="number"?t:0},hr=r=>({value:r.element.value??"",selectionStart:da(r.element,"selectionStart"),selectionEnd:da(r.element,"selectionEnd"),focused:document.activeElement===r.element,composing:r.composing===!0}),$V=(r,e)=>!r||!e?!1:r.value===e.value&&r.selectionStart===e.selectionStart&&r.selectionEnd===e.selectionEnd&&r.focused===e.focused&&r.composing===e.composing,XV=r=>r instanceof HTMLInputElement||r instanceof HTMLTextAreaElement,Tu=r=>{r.element.style.pointerEvents="none"},Fb=(r,e,t)=>{if(typeof r?.setSelectionRange=="function")try{r.setSelectionRange(e,t)}catch{}},jV=({app:r,geometry:e})=>{let t=r.canvas;if(!e||!t||e.visible===!1)return null;let i=t.getBoundingClientRect(),s=r.renderer?.width||i.width||1,o=r.renderer?.height||i.height||1,n=i.width/s,a=i.height/o,l=e.clipInsets??{top:0,right:0,bottom:0,left:0},c=i.left+(e.x+l.left)*n,u=i.top+(e.y+l.top)*a,h=i.left+(e.x+e.width-l.right)*n,d=i.top+(e.y+e.height-l.bottom)*a;return h<=c||d<=u?null:{left:c,top:u,right:h,bottom:d}},YV=({app:r,entry:e,event:t})=>{let i=e.options.getGeometry?.(),s=jV({app:r,geometry:i}),o=t.clientX,n=t.clientY;return!!s&&Number.isFinite(o)&&Number.isFinite(n)&&o>=s.left&&o<=s.right&&n>=s.top&&n<=s.bottom},VF=({app:r})=>{let e=new Map,t,i=null,s=()=>{t||(t=document.createElement("div"),t.dataset.routeGraphicsInputBridge="true",t.style.position="fixed",t.style.left="0",t.style.top="0",t.style.pointerEvents="none",t.style.zIndex="1000",t.style.width="0",t.style.height="0");let x=r.canvas?.parentNode??document.body;t.isConnected||x.appendChild(t)},o=(x,T=x.lastSnapshot)=>{let b=hr(x);b.focused&&i!==x.id?i=x.id:!b.focused&&i===x.id&&(i=null),Tu(x,i),T?.value!==b.value&&x.callbacks.onValueChange?.(b),(T?.selectionStart!==b.selectionStart||T?.selectionEnd!==b.selectionEnd||T?.focused!==b.focused||T?.composing!==b.composing)&&x.callbacks.onSelectionChange?.(b),x.lastSnapshot=b},n=x=>{let{disabled:T=!1,multiline:b=!1,maxLength:w,textStyle:E,padding:I,placeholder:B="",autocomplete:C="off",autocapitalize:A="off",spellcheck:P=!1}=x.options,{element:R}=x;R instanceof HTMLInputElement&&(R.type="text"),R.disabled=T,R.placeholder=B,R.autocomplete=C,R.autocapitalize=A,R.spellcheck=!!P,R.style.opacity=zV,R.style.color="transparent",R.style.caretColor="transparent",R.style.background="transparent",R.style.paddingTop=`${I.top}px`,R.style.paddingRight=`${I.right}px`,R.style.paddingBottom=`${I.bottom}px`,R.style.paddingLeft=`${I.left}px`,R.style.fontFamily=E?.fontFamily??"Arial",R.style.fontSize=`${E?.fontSize??16}px`,R.style.fontWeight=E?.fontWeight??"400",R.style.textAlign=E?.align??"left",R.style.lineHeight=typeof E?.lineHeight=="number"?`${E.lineHeight}px`:"normal",R.style.whiteSpace=b?"pre":"nowrap",R.style.overflowWrap="normal",R.style.resize="none",R.style.overflow="hidden",typeof w=="number"?R.maxLength=w:R.removeAttribute("maxLength"),R.tabIndex=-1,b&&R instanceof HTMLTextAreaElement&&(R.wrap="off",R.rows=1),Tu(x,i)},a=x=>{s();let T=r.canvas,b=x.options.getGeometry?.();if(!T||!b||b.visible===!1){x.element.style.display="none";return}let w=T.getBoundingClientRect(),E=r.renderer?.width||w.width||1,I=r.renderer?.height||w.height||1,B=w.width/E,C=w.height/I,A=b.clipInsets??{top:0,right:0,bottom:0,left:0},P={top:A.top*C,right:A.right*B,bottom:A.bottom*C,left:A.left*B};x.element.style.display="block",x.element.style.left=`${w.left+b.x*B}px`,x.element.style.top=`${w.top+b.y*C}px`,x.element.style.width=`${b.width*B}px`,x.element.style.height=`${b.height*C}px`;let R=Object.values(P).some(M=>M>0);x.element.style.clipPath=R?`inset(${P.top}px ${P.right}px ${P.bottom}px ${P.left}px)`:"none"},l=x=>{if(!i)return;let T=e.get(i),b=x.target;!T||b===T.element||T.element.contains(b)||XV(b)&&t?.contains(b)||YV({app:r,entry:T,event:x})||T.element.blur()},c=()=>{for(let x of e.values()){if(a(x),!x.lastSnapshot){x.lastSnapshot=hr(x);continue}let T=hr(x);$V(T,x.lastSnapshot)||o(x,x.lastSnapshot)}},u=({id:x,options:T})=>{let b=T.multiline===!0?document.createElement("textarea"):document.createElement("input");return b.dataset.routeGraphicsInputId=x,b.style.position="fixed",b.style.border="none",b.style.outline="none",b.style.margin="0",b.style.boxSizing="border-box",b.style.borderRadius="0",b.style.transformOrigin="top left",b.style.appearance="none",b.style.boxShadow="none",b.style.userSelect="none",b.style.webkitUserSelect="none",b},h=x=>{let{id:T,element:b}=x,w=()=>{o(x)};b.addEventListener("focus",()=>{x.pendingBlurTimer&&(clearTimeout(x.pendingBlurTimer),x.pendingBlurTimer=null),i=T,Tu(x,i);let E=hr(x);x.lastSnapshot=E,x.callbacks.onFocus?.(E),x.callbacks.onSelectionChange?.(E)}),b.addEventListener("blur",()=>{i===T&&(i=null),Tu(x,i),x.pendingBlurTimer=setTimeout(()=>{x.pendingBlurTimer=null;let E=hr(x);if(E.focused){x.lastSnapshot=E;return}x.lastSnapshot=E,x.callbacks.onBlur?.(E),x.callbacks.onSelectionChange?.(E)},0)}),b.addEventListener("input",w),b.addEventListener("select",w),b.addEventListener("click",()=>queueMicrotask(w)),b.addEventListener("keyup",()=>queueMicrotask(w)),b.addEventListener("keydown",E=>{let I=E.key==="Enter"&&x.options.multiline!==!0&&!E.shiftKey,B=E.key==="Enter"&&x.options.multiline===!0&&(E.ctrlKey||E.metaKey);(I||B)&&(E.preventDefault(),x.callbacks.onSubmit?.(hr(x),E)),E.key==="Escape"&&b.blur(),queueMicrotask(w)}),b.addEventListener("compositionstart",()=>{x.composing=!0;let E=hr(x);x.lastSnapshot=E,x.callbacks.onCompositionStart?.(E),x.callbacks.onSelectionChange?.(E)}),b.addEventListener("compositionupdate",()=>{let E=hr(x);x.lastSnapshot=E,x.callbacks.onCompositionUpdate?.(E),x.callbacks.onSelectionChange?.(E)}),b.addEventListener("compositionend",()=>{x.composing=!1,w(),x.callbacks.onCompositionEnd?.(hr(x))})};document.addEventListener("pointerdown",l,!0),r.ticker?.add?.(c);let d=(x,T)=>{s();let b=e.get(x);if(b)return b.options=T,b.callbacks=T.callbacks??{},n(b),a(b),typeof T.value=="string"&&b.element.value!==T.value&&(b.element.value=T.value),b.lastSnapshot=hr(b),b.element;let w={id:x,element:u({id:x,options:T}),options:T,callbacks:T.callbacks??{},composing:!1,pendingBlurTimer:null,lastSnapshot:null};return h(w),typeof T.value=="string"&&(w.element.value=T.value),n(w),t.appendChild(w.element),e.set(x,w),a(w),w.lastSnapshot=hr(w),w.element};return{mount:d,update:(x,T)=>{let b=e.get(x);if(!b)return d(x,T);let w=T.multiline===!0!=b.element instanceof HTMLTextAreaElement;if(b.options=T,b.callbacks=T.callbacks??{},w){let E=b.element,I=document.activeElement===E,B=da(E,"selectionStart"),C=da(E,"selectionEnd");return b.element=u({id:x,options:T}),h(b),E.replaceWith(b.element),b.element.value=typeof T.value=="string"?T.value:E.value,n(b),a(b),b.lastSnapshot=hr(b),I&&!T.disabled&&queueMicrotask(()=>{b.element.focus(),Fb(b.element,B,C)}),b.element}return typeof T.value=="string"&&T.value!==b.element.value&&b.composing!==!0&&(b.element.value=T.value),n(b),a(b),b.lastSnapshot=hr(b),b.element},focus:(x,{selectAll:T=!1,selectionStart:b,selectionEnd:w}={})=>{let E=e.get(x);if(!E||E.element.disabled)return;let I=document.activeElement===E.element;if(i=x,Tu(E,i),I||E.element.focus(),T){E.element.select?.(),o(E,E.lastSnapshot);return}if(typeof b=="number"||typeof w=="number"){let B=typeof b=="number"?b:da(E.element,"selectionStart"),C=typeof w=="number"?w:typeof b=="number"?b:da(E.element,"selectionEnd");Fb(E.element,B,C)}o(E,E.lastSnapshot)},setSelection:(x,T,b=T,{focus:w=!1}={})=>{let E=e.get(x);if(!E||E.element.disabled)return;let I=()=>{Fb(E.element,T,b),o(E,E.lastSnapshot)};if(w&&document.activeElement!==E.element){E.element.focus(),I();return}I()},blur:x=>{e.get(x)?.element.blur()},unmount:x=>{let T=e.get(x);T&&(i===x&&(i=null),T.pendingBlurTimer&&(clearTimeout(T.pendingBlurTimer),T.pendingBlurTimer=null),T.element.remove(),e.delete(x),e.size===0&&t?.remove())},destroy:()=>{document.removeEventListener("pointerdown",l,!0),r.ticker?.remove?.(c);for(let x of e.values())x.pendingBlurTimer&&(clearTimeout(x.pendingBlurTimer),x.pendingBlurTimer=null),x.element.remove();e.clear(),i=null,t?.remove(),t=void 0}}};var qV=()=>{let r=A=>{if(A!=="auto"&&A!=="manual")throw new Error(`Invalid animation playback mode "${A}". Expected "auto" or "manual".`)},e,t=_F(),i={elements:[],animations:[],audio:[]},s,o={animations:[],elements:[],audio:[],parsers:[]},n,a,l,c,u=!1,h,d,f,p="auto",m=null,g=[],_,v=new Map,x,T=(A,P,R,M)=>{A.clear(),A.rect(0,0,P,R),A.fill(M??0)},b=A=>A?A.startsWith("audio/")?"audio":A.startsWith("font/")||["application/font-woff","application/font-woff2","application/x-font-ttf","application/x-font-otf"].includes(A)?"font":A.startsWith("video/")?"video":"texture":"texture",w=(A,P,{revokable:R=!1}={})=>{v.set(A,{url:P,revokable:R})},E=()=>{for(let A of v.values())A?.revokable===!0&&typeof A?.url=="string"&&URL.revokeObjectURL(A.url);v.clear()},I=(A,P,R)=>{n&&n.registerHotkeys(R?.keyboard??{}),A.renderer.events.cursorStyles||(A.renderer.events.cursorStyles={}),A.renderer.events.cursorStyles.default||(A.renderer.events.cursorStyles.default="default"),A.renderer.events.cursorStyles.hover||(A.renderer.events.cursorStyles.hover="pointer");let M=P?.cursorStyles,F=R?.cursorStyles;pe(M,F)||(F?(F.default&&(A.renderer.events.cursorStyles.default=F.default,A.canvas.style.cursor=F.default),F.hover&&(A.renderer.events.cursorStyles.hover=F.hover)):M&&(A.renderer.events.cursorStyles.default="default",A.renderer.events.cursorStyles.hover="pointer"))},B=(A,P,R,M)=>{if(pe(i,R)){typeof A.render=="function"&&A.render();return}h&&h.abort(),h=new AbortController;let F=h.signal;l.reset(R.id),I(A,i.global,R.global),a.cancelAll(),Vs({app:A,parent:P,prevComputedTree:i.elements,nextComputedTree:R.elements,animations:R.animations,elementPlugins:o.elements,animationBus:a,completionTracker:l,eventHandler:M,signal:F}),a.flush(),p==="manual"&&m!==null&&a.setTime(m),a_({app:A,prevAudioTree:i.audio,nextAudioTree:R.audio,audioPlugins:o.audio}),i=R,typeof A.render=="function"&&A.render(),l.completeIfEmpty(),u||(u=!0,c&&c())},C={rendererName:"pixi",get canvas(){return e.canvas},findElementByLabel:A=>e.stage.getChildByLabel(A,!0)??null,extractBase64:async A=>{typeof e.render=="function"&&e.render();let P=new Q(0,0,e.renderer.width,e.renderer.height);if(!A)return await e.renderer.extract.base64({target:e.stage,frame:P});let R=e.stage.getChildByLabel(A,!0);if(!R)throw new Error(`Element with label '${A}' not found`);return await e.renderer.extract.base64({target:R,frame:P})},assignStageEvent:(A,P)=>{e.stage.eventMode="static",e.stage.on(A,P)},setAnimationPlaybackMode:A=>{r(A),p=A,p!=="manual"&&(m=null,a?.clearTime?.())},setAnimationTime:A=>{let P=Number(A);if(!Number.isFinite(P))throw new Error("Animation time must be a finite number.");p==="manual"&&(m=P),a.flush(),a.setTime(P),p!=="manual"&&(m=null,a.clearTime()),typeof e.render=="function"&&e.render()},init:async A=>{let{eventHandler:P,plugins:R,width:M,height:F,backgroundColor:O,debug:D=!1,onFirstRender:N,animationPlaybackMode:L="auto"}=A;c=N,r(L),p=L,m=null,g.forEach(J=>J()),g=[];let Y=[];R?.elements?.forEach(J=>{J?.parse&&Y.push(bF({type:J.type,parse:J.parse}))}),o={animations:R?.animations??[],elements:R?.elements??[],audio:R?.audio??[],parsers:Y},s=P,n=RF(P),l=FF(P),e=new ic,e.audioStage=t,await e.init({width:M,height:F,backgroundColor:O,preference:"webgl",preserveDrawingBuffer:D===!0}),typeof e.ticker?.remove=="function"&&e.ticker.remove(e.render,e),e.debug=D,e.inputDomBridge=VF({app:e}),_=J=>{J.preventDefault()},e.canvas.addEventListener("contextmenu",_),x=new Ue,x.label="__route_graphics_background__",T(x,M,F,O),e.stage.addChild(x),e.stage.width=M,e.stage.height=F,e.ticker.add(e.audioStage.tick),a=kF();let ue=()=>{p==="manual"&&typeof e.render=="function"&&e.render()};return g=[a.on("started",ue),a.on("completed",ue),a.on("cancelled",ue)],D?(d=J=>{p==="auto"&&J?.detail?.deltaMS&&(a.tick(Number(J.detail.deltaMS)),typeof e.render=="function"&&e.render())},window.addEventListener("snapShotKeyFrame",d)):(f=J=>{p==="auto"&&(a.tick(J.deltaMS),typeof e.render=="function"&&e.render())},e.ticker.add(f)),C},destroy:()=>{h&&(h.abort(),h=void 0),d&&(window.removeEventListener("snapShotKeyFrame",d),d=void 0),f&&typeof e?.ticker?.remove=="function"&&(e.ticker.remove(f),f=void 0),_&&e?.canvas&&(e.canvas.removeEventListener("contextmenu",_),_=void 0),e?.inputDomBridge?.destroy?.(),n?.destroy(),Qy(),g.forEach(P=>P()),g=[],a&&a.destroy(),e?.audioStage&&e.audioStage.destroy();let A=P=>{for(let R of P.children){let M=R.texture?.source?.resource;M instanceof HTMLVideoElement&&M.pause(),R.children&&A(R)}};e?.stage&&A(e.stage),e&&e.destroy(),p="auto",m=null,x=void 0,E()},loadAssets:async A=>{if(!A)throw new Error("assetBufferMap is required");let P={audio:{},font:{},video:{},texture:{}};for(let[F,O]of Object.entries(A)){let D=b(O.type);P[D][F]=O}await Promise.all(Object.entries(P.audio).map(([F,O])=>yn.load(F,O.buffer))),await Promise.all(Object.entries(P.font).map(async([F,O])=>{let D=new Blob([O.buffer],{type:O.type}),N=URL.createObjectURL(D),L=new FontFace(F,`url(${N})`);try{await L.load(),document.fonts.add(L)}catch(Y){console.error(`Failed to load font ${F}:`,Y)}finally{URL.revokeObjectURL(N)}}));let R=Object.entries(P.texture).map(async([F,O])=>{if(br.cache.has(F))return br.cache.get(F);if(O?.source==="url"&&typeof O?.url=="string")return br.load({alias:F,src:O.url,parser:"loadTextures"});let D=new Blob([O.buffer],{type:O.type}),N=await createImageBitmap(D),L=k.from(N);return br.cache.set(F,L),L}),M=Object.entries(P.video).map(async([F,O])=>{let D=O?.source==="url"&&typeof O?.url=="string"?O.url:URL.createObjectURL(new Blob([O.buffer],{type:O.type})),N=O?.source!=="url";w(F,D,{revokable:N});let L={alias:F,src:D,parser:"loadVideo",data:{}};return typeof O?.type=="string"&&O.type.length>0&&(L.data.mime=O.type),br.load(L).then(Y=>Y).catch(Y=>{throw v.delete(F),N&&URL.revokeObjectURL(D),Y})});return Promise.all([...R,...M])},loadAudioAssets:async A=>Promise.all(A.map(async P=>{let M=await(await fetch(P)).arrayBuffer();return yn.load(P,M)})),updatedBackgroundColor:A=>{e.renderer.background.color=A,x&&T(x,e.renderer.width,e.renderer.height,A),typeof e.render=="function"&&e.render()},render:A=>{let P=kb(A),R=Ab({JSONObject:P.elements,parserPlugins:o.parsers}),M={...P,elements:R};B(e,e.stage,M,s)},parse:A=>{let P=kb(A),R=Ab({JSONObject:P.elements,parserPlugins:o.parsers});return{...P,elements:R}}};return C},WF=qV;var wIe=WF;export{ic as Application,br as Assets,yn as AudioAsset,cD as animatedSpritePlugin,JL as containerPlugin,vy as createAnimationPlugin,QF as createAssetBufferManager,Ty as createAudioPlugin,et as createElementPlugin,wIe as default,mL as inputPlugin,QD as particlesPlugin,WG as rectPlugin,a_ as renderAudio,Vs as renderElements,rL as sliderPlugin,dD as soundPlugin,zG as spritePlugin,NR as spritesheetAnimationPlugin,NG as textPlugin,oD as textRevealingPlugin,uD as tweenPlugin,XG as videoPlugin}; +`))}}var uV=0,Ep={textureCount:0,uboCount:0},us=class{constructor(e){this.destroyed=!1,this.renderer=e,this.systemCheck(),this.gl=null,this.shader=null,this.program=null,this.cache={},this._uboCache={},this.id=uV++}systemCheck(){if(!bp())throw new Error("Current environment does not allow unsafe-eval, please use @pixi/unsafe-eval module to enable support.")}contextChange(e){this.gl=e,this.reset()}bind(e,t){e.disposeRunner.add(this),e.uniforms.globals=this.renderer.globalUniforms;let i=e.program,s=i.glPrograms[this.renderer.CONTEXT_UID]||this.generateProgram(e);return this.shader=e,this.program!==i&&(this.program=i,this.gl.useProgram(s.program)),t||(Ep.textureCount=0,Ep.uboCount=0,this.syncUniformGroup(e.uniformGroup,Ep)),s}setUniforms(e){let t=this.shader.program,i=t.glPrograms[this.renderer.CONTEXT_UID];t.syncUniforms(i.uniformData,e,this.renderer)}syncUniformGroup(e,t){let i=this.getGlProgram();(!e.static||e.dirtyId!==i.uniformDirtyGroups[e.id])&&(i.uniformDirtyGroups[e.id]=e.dirtyId,this.syncUniforms(e,i,t))}syncUniforms(e,t,i){(e.syncUniforms[this.shader.program.id]||this.createSyncGroups(e))(t.uniformData,e.uniforms,this.renderer,i)}createSyncGroups(e){let t=this.getSignature(e,this.shader.program.uniformData,"u");return this.cache[t]||(this.cache[t]=ab(e,this.shader.program.uniformData)),e.syncUniforms[this.shader.program.id]=this.cache[t],e.syncUniforms[this.shader.program.id]}syncUniformBufferGroup(e,t){let i=this.getGlProgram();if(!e.static||e.dirtyId!==0||!i.uniformGroups[e.id]){e.dirtyId=0;let s=i.uniformGroups[e.id]||this.createSyncBufferGroup(e,i,t);e.buffer.update(),s(i.uniformData,e.uniforms,this.renderer,Ep,e.buffer)}this.renderer.buffer.bindBufferBase(e.buffer,i.uniformBufferBindings[t])}createSyncBufferGroup(e,t,i){let{gl:s}=this.renderer;this.renderer.buffer.bind(e.buffer);let o=this.gl.getUniformBlockIndex(t.program,i);t.uniformBufferBindings[i]=this.shader.uniformBindCount,s.uniformBlockBinding(t.program,o,this.shader.uniformBindCount),this.shader.uniformBindCount++;let n=this.getSignature(e,this.shader.program.uniformData,"ubo"),a=this._uboCache[n];if(a||(a=this._uboCache[n]=gb(e,this.shader.program.uniformData)),e.autoManage){let l=new Float32Array(a.size/4);e.buffer.update(l)}return t.uniformGroups[e.id]=a.syncFunc,t.uniformGroups[e.id]}getSignature(e,t,i){let s=e.uniforms,o=[`${i}-`];for(let n in s)o.push(n),t[n]&&o.push(t[n].type);return o.join("-")}getGlProgram(){return this.shader?this.shader.program.glPrograms[this.renderer.CONTEXT_UID]:null}generateProgram(e){let t=this.gl,i=e.program,s=mb(t,i);return i.glPrograms[this.renderer.CONTEXT_UID]=s,s}reset(){this.program=null,this.shader=null}disposeShader(e){this.shader===e&&(this.shader=null)}destroy(){this.renderer=null,this.destroyed=!0}};us.extension={type:$.RendererSystem,name:"shader"};Z.add(us);var Bi=class{constructor(e){this.renderer=e}run(e){let{renderer:t}=this;t.runners.init.emit(t.options),e.hello&&console.log(`PixiJS 7.4.3 - ${t.rendererLogId} - https://pixijs.com`),t.resize(t.screen.width,t.screen.height)}destroy(){}};Bi.defaultOptions={hello:!1},Bi.extension={type:[$.RendererSystem,$.CanvasRendererSystem],name:"startup"};Z.add(Bi);function dF(r,e=[]){return e[re.NORMAL]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],e[re.ADD]=[r.ONE,r.ONE],e[re.MULTIPLY]=[r.DST_COLOR,r.ONE_MINUS_SRC_ALPHA,r.ONE,r.ONE_MINUS_SRC_ALPHA],e[re.SCREEN]=[r.ONE,r.ONE_MINUS_SRC_COLOR,r.ONE,r.ONE_MINUS_SRC_ALPHA],e[re.OVERLAY]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],e[re.DARKEN]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],e[re.LIGHTEN]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],e[re.COLOR_DODGE]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],e[re.COLOR_BURN]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],e[re.HARD_LIGHT]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],e[re.SOFT_LIGHT]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],e[re.DIFFERENCE]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],e[re.EXCLUSION]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],e[re.HUE]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],e[re.SATURATION]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],e[re.COLOR]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],e[re.LUMINOSITY]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],e[re.NONE]=[0,0],e[re.NORMAL_NPM]=[r.SRC_ALPHA,r.ONE_MINUS_SRC_ALPHA,r.ONE,r.ONE_MINUS_SRC_ALPHA],e[re.ADD_NPM]=[r.SRC_ALPHA,r.ONE,r.ONE,r.ONE],e[re.SCREEN_NPM]=[r.SRC_ALPHA,r.ONE_MINUS_SRC_COLOR,r.ONE,r.ONE_MINUS_SRC_ALPHA],e[re.SRC_IN]=[r.DST_ALPHA,r.ZERO],e[re.SRC_OUT]=[r.ONE_MINUS_DST_ALPHA,r.ZERO],e[re.SRC_ATOP]=[r.DST_ALPHA,r.ONE_MINUS_SRC_ALPHA],e[re.DST_OVER]=[r.ONE_MINUS_DST_ALPHA,r.ONE],e[re.DST_IN]=[r.ZERO,r.SRC_ALPHA],e[re.DST_OUT]=[r.ZERO,r.ONE_MINUS_SRC_ALPHA],e[re.DST_ATOP]=[r.ONE_MINUS_DST_ALPHA,r.SRC_ALPHA],e[re.XOR]=[r.ONE_MINUS_DST_ALPHA,r.ONE_MINUS_SRC_ALPHA],e[re.SUBTRACT]=[r.ONE,r.ONE,r.ONE,r.ONE,r.FUNC_REVERSE_SUBTRACT,r.FUNC_ADD],e}var hV=0,dV=1,fV=2,pV=3,mV=4,gV=5,fF=class xb{constructor(){this.gl=null,this.stateId=0,this.polygonOffset=0,this.blendMode=re.NONE,this._blendEq=!1,this.map=[],this.map[hV]=this.setBlend,this.map[dV]=this.setOffset,this.map[fV]=this.setCullFace,this.map[pV]=this.setDepthTest,this.map[mV]=this.setFrontFace,this.map[gV]=this.setDepthMask,this.checks=[],this.defaultState=new oi,this.defaultState.blend=!0}contextChange(e){this.gl=e,this.blendModes=dF(e),this.set(this.defaultState),this.reset()}set(e){if(e=e||this.defaultState,this.stateId!==e.data){let t=this.stateId^e.data,i=0;for(;t;)t&1&&this.map[i].call(this,!!(e.data&1<>1,i++;this.stateId=e.data}for(let t=0;te.systems[s]),i=[...t,...Object.keys(e.systems).filter(s=>!t.includes(s))];for(let s of i)this.addSystem(e.systems[s],s)}addRunners(...e){e.forEach(t=>{this.runners[t]=new rt(t)})}addSystem(e,t){let i=new e(this);if(this[t])throw new Error(`Whoops! The name "${t}" is already in use`);this[t]=i,this._systemsHash[t]=i;for(let s in this.runners)this.runners[s].add(i);return this}emitWithCustomOptions(e,t){let i=Object.keys(this._systemsHash);e.items.forEach(s=>{let o=i.find(n=>this._systemsHash[n]===s);s[e.name](t[o])})}destroy(){Object.values(this.runners).forEach(e=>{e.destroy()}),this._systemsHash={}}};var nu=class Ap{constructor(e){this.renderer=e,this.count=0,this.checkCount=0,this.maxIdle=Ap.defaultMaxIdle,this.checkCountMax=Ap.defaultCheckCountMax,this.mode=Ap.defaultMode}postrender(){this.renderer.objectRenderer.renderingToScreen&&(this.count++,this.mode!==Df.MANUAL&&(this.checkCount++,this.checkCount>this.checkCountMax&&(this.checkCount=0,this.run())))}run(){let e=this.renderer.texture,t=e.managedTextures,i=!1;for(let s=0;sthis.maxIdle&&(e.destroyTexture(o,!0),t[s]=null,i=!0)}if(i){let s=0;for(let o=0;o=0;s--)this.unload(e.children[s])}destroy(){this.renderer=null}};nu.defaultMode=Df.AUTO,nu.defaultMaxIdle=60*60,nu.defaultCheckCountMax=60*10,nu.extension={type:$.RendererSystem,name:"textureGC"};var li=nu;Z.add(li);var uo=class{constructor(e){this.texture=e,this.width=-1,this.height=-1,this.dirtyId=-1,this.dirtyStyleId=-1,this.mipmap=!1,this.wrapMode=33071,this.type=ae.UNSIGNED_BYTE,this.internalFormat=H.RGBA,this.samplerType=0}};function pF(r){let e;return"WebGL2RenderingContext"in globalThis&&r instanceof globalThis.WebGL2RenderingContext?e={[r.RGB]:z.FLOAT,[r.RGBA]:z.FLOAT,[r.ALPHA]:z.FLOAT,[r.LUMINANCE]:z.FLOAT,[r.LUMINANCE_ALPHA]:z.FLOAT,[r.R8]:z.FLOAT,[r.R8_SNORM]:z.FLOAT,[r.RG8]:z.FLOAT,[r.RG8_SNORM]:z.FLOAT,[r.RGB8]:z.FLOAT,[r.RGB8_SNORM]:z.FLOAT,[r.RGB565]:z.FLOAT,[r.RGBA4]:z.FLOAT,[r.RGB5_A1]:z.FLOAT,[r.RGBA8]:z.FLOAT,[r.RGBA8_SNORM]:z.FLOAT,[r.RGB10_A2]:z.FLOAT,[r.RGB10_A2UI]:z.FLOAT,[r.SRGB8]:z.FLOAT,[r.SRGB8_ALPHA8]:z.FLOAT,[r.R16F]:z.FLOAT,[r.RG16F]:z.FLOAT,[r.RGB16F]:z.FLOAT,[r.RGBA16F]:z.FLOAT,[r.R32F]:z.FLOAT,[r.RG32F]:z.FLOAT,[r.RGB32F]:z.FLOAT,[r.RGBA32F]:z.FLOAT,[r.R11F_G11F_B10F]:z.FLOAT,[r.RGB9_E5]:z.FLOAT,[r.R8I]:z.INT,[r.R8UI]:z.UINT,[r.R16I]:z.INT,[r.R16UI]:z.UINT,[r.R32I]:z.INT,[r.R32UI]:z.UINT,[r.RG8I]:z.INT,[r.RG8UI]:z.UINT,[r.RG16I]:z.INT,[r.RG16UI]:z.UINT,[r.RG32I]:z.INT,[r.RG32UI]:z.UINT,[r.RGB8I]:z.INT,[r.RGB8UI]:z.UINT,[r.RGB16I]:z.INT,[r.RGB16UI]:z.UINT,[r.RGB32I]:z.INT,[r.RGB32UI]:z.UINT,[r.RGBA8I]:z.INT,[r.RGBA8UI]:z.UINT,[r.RGBA16I]:z.INT,[r.RGBA16UI]:z.UINT,[r.RGBA32I]:z.INT,[r.RGBA32UI]:z.UINT,[r.DEPTH_COMPONENT16]:z.FLOAT,[r.DEPTH_COMPONENT24]:z.FLOAT,[r.DEPTH_COMPONENT32F]:z.FLOAT,[r.DEPTH_STENCIL]:z.FLOAT,[r.DEPTH24_STENCIL8]:z.FLOAT,[r.DEPTH32F_STENCIL8]:z.FLOAT}:e={[r.RGB]:z.FLOAT,[r.RGBA]:z.FLOAT,[r.ALPHA]:z.FLOAT,[r.LUMINANCE]:z.FLOAT,[r.LUMINANCE_ALPHA]:z.FLOAT,[r.DEPTH_STENCIL]:z.FLOAT},e}function mF(r){let e;return"WebGL2RenderingContext"in globalThis&&r instanceof globalThis.WebGL2RenderingContext?e={[ae.UNSIGNED_BYTE]:{[H.RGBA]:r.RGBA8,[H.RGB]:r.RGB8,[H.RG]:r.RG8,[H.RED]:r.R8,[H.RGBA_INTEGER]:r.RGBA8UI,[H.RGB_INTEGER]:r.RGB8UI,[H.RG_INTEGER]:r.RG8UI,[H.RED_INTEGER]:r.R8UI,[H.ALPHA]:r.ALPHA,[H.LUMINANCE]:r.LUMINANCE,[H.LUMINANCE_ALPHA]:r.LUMINANCE_ALPHA},[ae.BYTE]:{[H.RGBA]:r.RGBA8_SNORM,[H.RGB]:r.RGB8_SNORM,[H.RG]:r.RG8_SNORM,[H.RED]:r.R8_SNORM,[H.RGBA_INTEGER]:r.RGBA8I,[H.RGB_INTEGER]:r.RGB8I,[H.RG_INTEGER]:r.RG8I,[H.RED_INTEGER]:r.R8I},[ae.UNSIGNED_SHORT]:{[H.RGBA_INTEGER]:r.RGBA16UI,[H.RGB_INTEGER]:r.RGB16UI,[H.RG_INTEGER]:r.RG16UI,[H.RED_INTEGER]:r.R16UI,[H.DEPTH_COMPONENT]:r.DEPTH_COMPONENT16},[ae.SHORT]:{[H.RGBA_INTEGER]:r.RGBA16I,[H.RGB_INTEGER]:r.RGB16I,[H.RG_INTEGER]:r.RG16I,[H.RED_INTEGER]:r.R16I},[ae.UNSIGNED_INT]:{[H.RGBA_INTEGER]:r.RGBA32UI,[H.RGB_INTEGER]:r.RGB32UI,[H.RG_INTEGER]:r.RG32UI,[H.RED_INTEGER]:r.R32UI,[H.DEPTH_COMPONENT]:r.DEPTH_COMPONENT24},[ae.INT]:{[H.RGBA_INTEGER]:r.RGBA32I,[H.RGB_INTEGER]:r.RGB32I,[H.RG_INTEGER]:r.RG32I,[H.RED_INTEGER]:r.R32I},[ae.FLOAT]:{[H.RGBA]:r.RGBA32F,[H.RGB]:r.RGB32F,[H.RG]:r.RG32F,[H.RED]:r.R32F,[H.DEPTH_COMPONENT]:r.DEPTH_COMPONENT32F},[ae.HALF_FLOAT]:{[H.RGBA]:r.RGBA16F,[H.RGB]:r.RGB16F,[H.RG]:r.RG16F,[H.RED]:r.R16F},[ae.UNSIGNED_SHORT_5_6_5]:{[H.RGB]:r.RGB565},[ae.UNSIGNED_SHORT_4_4_4_4]:{[H.RGBA]:r.RGBA4},[ae.UNSIGNED_SHORT_5_5_5_1]:{[H.RGBA]:r.RGB5_A1},[ae.UNSIGNED_INT_2_10_10_10_REV]:{[H.RGBA]:r.RGB10_A2,[H.RGBA_INTEGER]:r.RGB10_A2UI},[ae.UNSIGNED_INT_10F_11F_11F_REV]:{[H.RGB]:r.R11F_G11F_B10F},[ae.UNSIGNED_INT_5_9_9_9_REV]:{[H.RGB]:r.RGB9_E5},[ae.UNSIGNED_INT_24_8]:{[H.DEPTH_STENCIL]:r.DEPTH24_STENCIL8},[ae.FLOAT_32_UNSIGNED_INT_24_8_REV]:{[H.DEPTH_STENCIL]:r.DEPTH32F_STENCIL8}}:e={[ae.UNSIGNED_BYTE]:{[H.RGBA]:r.RGBA,[H.RGB]:r.RGB,[H.ALPHA]:r.ALPHA,[H.LUMINANCE]:r.LUMINANCE,[H.LUMINANCE_ALPHA]:r.LUMINANCE_ALPHA},[ae.UNSIGNED_SHORT_5_6_5]:{[H.RGB]:r.RGB},[ae.UNSIGNED_SHORT_4_4_4_4]:{[H.RGBA]:r.RGBA},[ae.UNSIGNED_SHORT_5_5_5_1]:{[H.RGBA]:r.RGBA}},e}var la=class{constructor(e){this.renderer=e,this.boundTextures=[],this.currentLocation=-1,this.managedTextures=[],this._unknownBoundTextures=!1,this.unknownTexture=new xe,this.hasIntegerTextures=!1}contextChange(){let e=this.gl=this.renderer.gl;this.CONTEXT_UID=this.renderer.CONTEXT_UID,this.webGLVersion=this.renderer.context.webGLVersion,this.internalFormats=mF(e),this.samplerTypes=pF(e);let t=e.getParameter(e.MAX_TEXTURE_IMAGE_UNITS);this.boundTextures.length=t;for(let s=0;s=0;--o){let n=t[o];n&&n._glTextures[s].samplerType!==z.FLOAT&&this.renderer.texture.unbind(n)}}initTexture(e){let t=new uo(this.gl.createTexture());return t.dirtyId=-1,e._glTextures[this.CONTEXT_UID]=t,this.managedTextures.push(e),e.on("dispose",this.destroyTexture,this),t}initTextureType(e,t){t.internalFormat=this.internalFormats[e.type]?.[e.format]??e.format,t.samplerType=this.samplerTypes[t.internalFormat]??z.FLOAT,this.webGLVersion===2&&e.type===ae.HALF_FLOAT?t.type=this.gl.HALF_FLOAT:t.type=e.type}updateTexture(e){let t=e._glTextures[this.CONTEXT_UID];if(!t)return;let i=this.renderer;if(this.initTextureType(e,t),e.resource?.upload(i,e,t))t.samplerType!==z.FLOAT&&(this.hasIntegerTextures=!0);else{let s=e.realWidth,o=e.realHeight,n=i.gl;(t.width!==s||t.height!==o||t.dirtyId<0)&&(t.width=s,t.height=o,n.texImage2D(e.target,0,t.internalFormat,s,o,0,e.format,t.type,null))}e.dirtyStyleId!==t.dirtyStyleId&&this.updateTextureStyle(e),t.dirtyId=e.dirtyId}destroyTexture(e,t){let{gl:i}=this;if(e=e.castToBaseTexture(),e._glTextures[this.CONTEXT_UID]&&(this.unbind(e),i.deleteTexture(e._glTextures[this.CONTEXT_UID].texture),e.off("dispose",this.destroyTexture,this),delete e._glTextures[this.CONTEXT_UID],!t)){let s=this.managedTextures.indexOf(e);s!==-1&&j_(this.managedTextures,s,1)}}updateTextureStyle(e){let t=e._glTextures[this.CONTEXT_UID];t&&((e.mipmap===Fr.POW2||this.webGLVersion!==2)&&!e.isPowerOfTwo?t.mipmap=!1:t.mipmap=e.mipmap>=1,this.webGLVersion!==2&&!e.isPowerOfTwo?t.wrapMode=wc.CLAMP:t.wrapMode=e.wrapMode,e.resource?.style(this.renderer,e,t)||this.setStyle(e,t),t.dirtyStyleId=e.dirtyStyleId)}setStyle(e,t){let i=this.gl;if(t.mipmap&&e.mipmap!==Fr.ON_MANUAL&&i.generateMipmap(e.target),i.texParameteri(e.target,i.TEXTURE_WRAP_S,t.wrapMode),i.texParameteri(e.target,i.TEXTURE_WRAP_T,t.wrapMode),t.mipmap){i.texParameteri(e.target,i.TEXTURE_MIN_FILTER,e.scaleMode===vr.LINEAR?i.LINEAR_MIPMAP_LINEAR:i.NEAREST_MIPMAP_NEAREST);let s=this.renderer.context.extensions.anisotropicFiltering;if(s&&e.anisotropicLevel>0&&e.scaleMode===vr.LINEAR){let o=Math.min(e.anisotropicLevel,i.getParameter(s.MAX_TEXTURE_MAX_ANISOTROPY_EXT));i.texParameterf(e.target,s.TEXTURE_MAX_ANISOTROPY_EXT,o)}}else i.texParameteri(e.target,i.TEXTURE_MIN_FILTER,e.scaleMode===vr.LINEAR?i.LINEAR:i.NEAREST);i.texParameteri(e.target,i.TEXTURE_MAG_FILTER,e.scaleMode===vr.LINEAR?i.LINEAR:i.NEAREST)}destroy(){this.renderer=null}};la.extension={type:$.RendererSystem,name:"texture"};Z.add(la);var ca=class{constructor(e){this.renderer=e}contextChange(){this.gl=this.renderer.gl,this.CONTEXT_UID=this.renderer.CONTEXT_UID}bind(e){let{gl:t,CONTEXT_UID:i}=this,s=e._glTransformFeedbacks[i]||this.createGLTransformFeedback(e);t.bindTransformFeedback(t.TRANSFORM_FEEDBACK,s)}unbind(){let{gl:e}=this;e.bindTransformFeedback(e.TRANSFORM_FEEDBACK,null)}beginTransformFeedback(e,t){let{gl:i,renderer:s}=this;t&&s.shader.bind(t),i.beginTransformFeedback(e)}endTransformFeedback(){let{gl:e}=this;e.endTransformFeedback()}createGLTransformFeedback(e){let{gl:t,renderer:i,CONTEXT_UID:s}=this,o=t.createTransformFeedback();e._glTransformFeedbacks[s]=o,t.bindTransformFeedback(t.TRANSFORM_FEEDBACK,o);for(let n=0;n(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))(ho||{});var ua=class{constructor(e,t=null,i=0,s=!1){this.next=null,this.previous=null,this._destroyed=!1,this.fn=e,this.context=t,this.priority=i,this.once=s}match(e,t=null){return this.fn===e&&this.context===t}emit(e){this.fn&&(this.context?this.fn.call(this.context,e):this.fn(e));let t=this.next;return this.once&&this.destroy(!0),this._destroyed&&(this.next=null),t}connect(e){this.previous=e,e.next&&(e.next.previous=this),this.next=e.next,e.next=this}destroy(e=!1){this._destroyed=!0,this.fn=null,this.context=null,this.previous&&(this.previous.next=this.next),this.next&&(this.next.previous=this.previous);let t=this.next;return this.next=e?null:t,this.previous=null,t}};var gF=class cr{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 ua(null,null,1/0),this.deltaMS=1/cr.targetFPMS,this.elapsedMS=1/cr.targetFPMS,this._tick=e=>{this._requestId=null,this.started&&(this.update(e),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(e,t,i=ho.NORMAL){return this._addListener(new ua(e,t,i))}addOnce(e,t,i=ho.NORMAL){return this._addListener(new ua(e,t,i,!0))}_addListener(e){let t=this._head.next,i=this._head;if(!t)e.connect(i);else{for(;t;){if(e.priority>t.priority){e.connect(i);break}i=t,t=t.next}e.previous||e.connect(i)}return this._startIfPossible(),this}remove(e,t){let i=this._head.next;for(;i;)i.match(e,t)?i=i.destroy():i=i.next;return this._head.next||this._cancelIfNeeded(),this}get count(){if(!this._head)return 0;let e=0,t=this._head;for(;t=t.next;)e++;return e}start(){this.started||(this.started=!0,this._requestIfNeeded())}stop(){this.started&&(this.started=!1,this._cancelIfNeeded())}destroy(){if(!this._protected){this.stop();let e=this._head.next;for(;e;)e=e.destroy(!0);this._head.destroy(),this._head=null}}update(e=performance.now()){let t;if(e>this.lastTime){if(t=this.elapsedMS=e-this.lastTime,t>this._maxElapsedMS&&(t=this._maxElapsedMS),t*=this.speed,this._minElapsedMS){let o=e-this._lastFrame|0;if(o{this._ticker.stop()},this.start=()=>{this._ticker.start()},this._ticker=null,this.ticker=e.sharedTicker?Er.shared:new Er,e.autoStart&&this.start()}static destroy(){if(this._ticker){let e=this._ticker;this.ticker=null,e.destroy()}}};au.extension=$.Application;Z.add(au);var xV=[];Z.handleByList($.Renderer,xV);var lu=class{constructor(e){this.renderer=e}contextChange(e){let t;if(this.renderer.context.webGLVersion===1){let i=e.getParameter(e.FRAMEBUFFER_BINDING);e.bindFramebuffer(e.FRAMEBUFFER,null),t=e.getParameter(e.SAMPLES),e.bindFramebuffer(e.FRAMEBUFFER,i)}else{let i=e.getParameter(e.DRAW_FRAMEBUFFER_BINDING);e.bindFramebuffer(e.DRAW_FRAMEBUFFER,null),t=e.getParameter(e.SAMPLES),e.bindFramebuffer(e.DRAW_FRAMEBUFFER,i)}t>=Pe.HIGH?this.multisample=Pe.HIGH:t>=Pe.MEDIUM?this.multisample=Pe.MEDIUM:t>=Pe.LOW?this.multisample=Pe.LOW:this.multisample=Pe.NONE}destroy(){}};lu.extension={type:$.RendererSystem,name:"_multisample"};Z.add(lu);var Pp=class{constructor(e){this.buffer=e||null,this.updateID=-1,this.byteLength=-1,this.refCount=0}};var cu=class{constructor(e){this.renderer=e,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(e){let{gl:t,CONTEXT_UID:i}=this,s=e._glBuffers[i]||this.createGLBuffer(e);t.bindBuffer(e.type,s.buffer)}unbind(e){let{gl:t}=this;t.bindBuffer(e,null)}bindBufferBase(e,t){let{gl:i,CONTEXT_UID:s}=this;if(this.boundBufferBases[t]!==e){let o=e._glBuffers[s]||this.createGLBuffer(e);this.boundBufferBases[t]=e,i.bindBufferBase(i.UNIFORM_BUFFER,t,o.buffer)}}bindBufferRange(e,t,i){let{gl:s,CONTEXT_UID:o}=this;i=i||0;let n=e._glBuffers[o]||this.createGLBuffer(e);s.bindBufferRange(s.UNIFORM_BUFFER,t||0,n.buffer,i*256,256)}update(e){let{gl:t,CONTEXT_UID:i}=this,s=e._glBuffers[i]||this.createGLBuffer(e);if(e._updateID!==s.updateID)if(s.updateID=e._updateID,t.bindBuffer(e.type,s.buffer),s.byteLength>=e.data.byteLength)t.bufferSubData(e.type,0,e.data);else{let o=e.static?t.STATIC_DRAW:t.DYNAMIC_DRAW;s.byteLength=e.data.byteLength,t.bufferData(e.type,e.data,o)}}dispose(e,t){if(!this.managedBuffers[e.id])return;delete this.managedBuffers[e.id];let i=e._glBuffers[this.CONTEXT_UID],s=this.gl;e.disposeRunner.remove(this),i&&(t||s.deleteBuffer(i.buffer),delete e._glBuffers[this.CONTEXT_UID])}disposeAll(e){let t=Object.keys(this.managedBuffers);for(let i=0;it.resource).filter(t=>t).map(t=>t.load());return this._load=Promise.all(e).then(()=>{let{realWidth:t,realHeight:i}=this.items[0];return this.resize(t,i),this.update(),Promise.resolve(this)}),this._load}};var hu=class extends hs{constructor(e,t){let{width:i,height:s}=t||{},o,n;Array.isArray(e)?(o=e,n=e.length):n=e,super(n,{width:i,height:s}),o&&this.initFromArray(o,t)}addBaseTextureAt(e,t){if(e.resource)this.addResourceAt(e.resource,t);else throw new Error("ArrayResource does not support RenderTexture");return this}bind(e){super.bind(e),e.target=wi.TEXTURE_2D_ARRAY}upload(e,t,i){let{length:s,itemDirtyIds:o,items:n}=this,{gl:a}=e;i.dirtyId<0&&a.texImage3D(a.TEXTURE_2D_ARRAY,0,i.internalFormat,this._width,this._height,s,0,t.format,i.type,null);for(let l=0;l0)if(e.resource)this.addResourceAt(e.resource,t);else throw new Error("CubeResource does not support copying of renderTexture.");else e.target=wi.TEXTURE_CUBE_MAP_POSITIVE_X+t,e.parentTextureArray=this.baseTexture,this.items[t]=e;return e.valid&&!this.valid&&this.resize(e.realWidth,e.realHeight),this.items[t]=e,this}upload(e,t,i){let s=this.itemDirtyIds;for(let o=0;o{if(this.url===null){e(this);return}try{let i=await K.ADAPTER.fetch(this.url,{mode:this.crossOrigin?"cors":"no-cors"});if(this.destroyed)return;let s=await i.blob();if(this.destroyed)return;let o=await createImageBitmap(s,{premultiplyAlpha:this.alphaMode===null||this.alphaMode===or.UNPACK?"premultiply":"none"});if(this.destroyed){o.close();return}this.source=o,this.update(),e(this)}catch(i){if(this.destroyed)return;t(i),this.onError.emit(i)}}),this._load)}upload(e,t,i){return this.source instanceof ImageBitmap?(typeof this.alphaMode=="number"&&(t.alphaMode=this.alphaMode),super.upload(e,t,i)):(this.load(),!1)}dispose(){this.ownsImageBitmap&&this.source instanceof ImageBitmap&&this.source.close(),super.dispose(),this._load=null}static test(e){return!!globalThis.createImageBitmap&&typeof ImageBitmap<"u"&&(typeof e=="string"||e instanceof ImageBitmap)}static get EMPTY(){return r._EMPTY=r._EMPTY??K.ADAPTER.createCanvas(0,0),r._EMPTY}};var vb=class Rp extends pt{constructor(e,t){t=t||{},super(K.ADAPTER.createCanvas()),this._width=0,this._height=0,this.svg=e,this.scale=t.scale||1,this._overrideWidth=t.width,this._overrideHeight=t.height,this._resolve=null,this._crossorigin=t.crossorigin,this._load=null,t.autoLoad!==!1&&this.load()}load(){return this._load?this._load:(this._load=new Promise(e=>{if(this._resolve=()=>{this.update(),e(this)},Rp.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(){let e=new Image;pt.crossOrigin(e,this.svg,this._crossorigin),e.src=this.svg,e.onerror=t=>{this._resolve&&(e.onerror=null,this.onError.emit(t))},e.onload=()=>{if(!this._resolve)return;let t=e.width,i=e.height;if(!t||!i)throw new Error("The SVG image must have width and height defined (in pixels), canvas API needs them.");let s=t*this.scale,o=i*this.scale;(this._overrideWidth||this._overrideHeight)&&(s=this._overrideWidth||this._overrideHeight/i*t,o=this._overrideHeight||this._overrideWidth/t*i),s=Math.round(s),o=Math.round(o);let n=this.source;n.width=s,n.height=o,n._pixiId=`canvas_${Ai()}`,n.getContext("2d").drawImage(e,0,0,t,i,0,0,s,o),this._resolve(),this._resolve=null}}static getSize(e){let t=Rp.SVG_SIZE.exec(e),i={};return t&&(i[t[1]]=Math.round(parseFloat(t[3])),i[t[5]]=Math.round(parseFloat(t[7]))),i}dispose(){super.dispose(),this._resolve=null,this._crossorigin=null}static test(e,t){return t==="svg"||typeof e=="string"&&e.startsWith("data:image/svg+xml")||typeof e=="string"&&Rp.SVG_XML.test(e)}};vb.SVG_XML=/^(<\?xml[^?]+\?>)?\s*()]*-->)?\s*\]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*>/i;var Tb=vb;var Ip=class extends pt{constructor(e){super(e)}static test(e){return!!globalThis.VideoFrame&&e instanceof globalThis.VideoFrame}};var Sb=class wb extends pt{constructor(e,t){if(t=t||{},!(e instanceof HTMLVideoElement)){let i=document.createElement("video");t.autoLoad!==!1&&i.setAttribute("preload","auto"),t.playsinline!==!1&&(i.setAttribute("webkit-playsinline",""),i.setAttribute("playsinline","")),t.muted===!0&&(i.setAttribute("muted",""),i.muted=!0),t.loop===!0&&i.setAttribute("loop",""),t.autoPlay!==!1&&i.setAttribute("autoplay",""),typeof e=="string"&&(e=[e]);let s=e[0].src||e[0];pt.crossOrigin(i,s,t.crossorigin);for(let o=0;o{this.valid?t(this):(this._resolve=t,this._reject=i,e.load())}),this._load}_onError(e){this.source.removeEventListener("error",this._onError,!0),this.onError.emit(e),this._reject&&(this._reject(e),this._reject=null,this._resolve=null)}_isSourcePlaying(){let e=this.source;return!e.paused&&!e.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(){let e=this.source;e.removeEventListener("canplay",this._onCanPlay),e.removeEventListener("canplaythrough",this._onCanPlay);let t=this.valid;this._msToNextUpdate=0,this.update(),this._msToNextUpdate=0,!t&&this._resolve&&(this._resolve(this),this._resolve=null,this._reject=null),this._isSourcePlaying()?this._onPlayStart():this.autoPlay&&e.play()}dispose(){this._configureAutoUpdate();let e=this.source;e&&(e.removeEventListener("play",this._onPlayStart),e.removeEventListener("pause",this._onPlayStop),e.removeEventListener("seeked",this._onSeeked),e.removeEventListener("canplay",this._onCanPlay),e.removeEventListener("canplaythrough",this._onCanPlay),e.removeEventListener("error",this._onError,!0),e.pause(),e.src="",e.load()),super.dispose()}get autoUpdate(){return this._autoUpdate}set autoUpdate(e){e!==this._autoUpdate&&(this._autoUpdate=e,this._configureAutoUpdate())}get updateFPS(){return this._updateFPS}set updateFPS(e){e!==this._updateFPS&&(this._updateFPS=e,this._configureAutoUpdate())}_configureAutoUpdate(){this._autoUpdate&&this._isSourcePlaying()?!this._updateFPS&&this.source.requestVideoFrameCallback?(this._isConnectedToTicker&&(Er.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||(Er.shared.add(this.update,this),this._isConnectedToTicker=!0,this._msToNextUpdate=0)):(this._videoFrameRequestCallbackHandle!==null&&(this.source.cancelVideoFrameCallback(this._videoFrameRequestCallbackHandle),this._videoFrameRequestCallbackHandle=null),this._isConnectedToTicker&&(Er.shared.remove(this.update,this),this._isConnectedToTicker=!1,this._msToNextUpdate=0))}static test(e,t){return globalThis.HTMLVideoElement&&e instanceof HTMLVideoElement||wb.TYPES.includes(t)}};Sb.TYPES=["mp4","m4v","webm","ogg","ogv","h264","avi","mov"],Sb.MIME_TYPES={ogv:"video/ogg",mov:"video/quicktime",m4v:"video/mp4"};var Eb=Sb;Dc.push(pu,no,du,Eb,Ip,Tb,Qs,bb,hu);var yV={vec3(r,e,t,i){(t[0]!==i[0]||t[1]!==i[1]||t[2]!==i[2])&&(t[0]=i[0],t[1]=i[1],t[2]=i[2],r.uniform3f(e,i[0],i[1],i[2]))},int(r,e,t,i){r.uniform1i(e,i)},ivec2(r,e,t,i){r.uniform2i(e,i[0],i[1])},ivec3(r,e,t,i){r.uniform3i(e,i[0],i[1],i[2])},ivec4(r,e,t,i){r.uniform4i(e,i[0],i[1],i[2],i[3])},uint(r,e,t,i){r.uniform1ui(e,i)},uvec2(r,e,t,i){r.uniform2ui(e,i[0],i[1])},uvec3(r,e,t,i){r.uniform3ui(e,i[0],i[1],i[2])},uvec4(r,e,t,i){r.uniform4ui(e,i[0],i[1],i[2],i[3])},bvec2(r,e,t,i){r.uniform2i(e,i[0],i[1])},bvec3(r,e,t,i){r.uniform3i(e,i[0],i[1],i[2])},bvec4(r,e,t,i){r.uniform4i(e,i[0],i[1],i[2],i[3])},mat2(r,e,t,i){r.uniformMatrix2fv(e,!1,i)},mat4(r,e,t,i){r.uniformMatrix4fv(e,!1,i)}},_V={float(r,e,t,i){r.uniform1fv(e,i)},vec2(r,e,t,i){r.uniform2fv(e,i)},vec3(r,e,t,i){r.uniform3fv(e,i)},vec4(r,e,t,i){r.uniform4fv(e,i)},int(r,e,t,i){r.uniform1iv(e,i)},ivec2(r,e,t,i){r.uniform2iv(e,i)},ivec3(r,e,t,i){r.uniform3iv(e,i)},ivec4(r,e,t,i){r.uniform4iv(e,i)},uint(r,e,t,i){r.uniform1uiv(e,i)},uvec2(r,e,t,i){r.uniform2uiv(e,i)},uvec3(r,e,t,i){r.uniform3uiv(e,i)},uvec4(r,e,t,i){r.uniform4uiv(e,i)},bool(r,e,t,i){r.uniform1iv(e,i)},bvec2(r,e,t,i){r.uniform2iv(e,i)},bvec3(r,e,t,i){r.uniform3iv(e,i)},bvec4(r,e,t,i){r.uniform4iv(e,i)},sampler2D(r,e,t,i){r.uniform1iv(e,i)},samplerCube(r,e,t,i){r.uniform1iv(e,i)},sampler2DArray(r,e,t,i){r.uniform1iv(e,i)}};function yF(r,e,t,i,s){let o=0,n=null,a=null,l=s.gl;for(let c in r.uniforms){let u=e[c],h=i[c],d=t[c],f=r.uniforms[c];if(!u){f.group===!0&&s.shader.syncUniformGroup(h);continue}u.type==="float"&&u.size===1&&!u.isArray?h!==d.value&&(d.value=h,l.uniform1f(d.location,h)):u.type==="bool"&&u.size===1&&!u.isArray?h!==d.value&&(d.value=h,l.uniform1i(d.location,Number(h))):(u.type==="sampler2D"||u.type==="samplerCube"||u.type==="sampler2DArray")&&u.size===1&&!u.isArray?(s.texture.bind(h,o),d.value!==o&&(d.value=o,l.uniform1i(d.location,o)),o++):u.type==="mat3"&&u.size===1&&!u.isArray?f.a!==void 0?l.uniformMatrix3fv(d.location,!1,h.toArray(!0)):l.uniformMatrix3fv(d.location,!1,h):u.type==="vec2"&&u.size===1&&!u.isArray?f.x!==void 0?(a=d.value,n=h,(a[0]!==n.x||a[1]!==n.y)&&(a[0]=n.x,a[1]=n.y,l.uniform2f(d.location,n.x,n.y))):(a=d.value,n=h,(a[0]!==n[0]||a[1]!==n[1])&&(a[0]=n[0],a[1]=n[1],l.uniform2f(d.location,n[0],n[1]))):u.type==="vec4"&&u.size===1&&!u.isArray?f.width!==void 0?(a=d.value,n=h,(a[0]!==n.x||a[1]!==n.y||a[2]!==n.width||a[3]!==n.height)&&(a[0]=n.x,a[1]=n.y,a[2]=n.width,a[3]=n.height,l.uniform4f(d.location,n.x,n.y,n.width,n.height))):(a=d.value,n=h,(a[0]!==n[0]||a[1]!==n[1]||a[2]!==n[2]||a[3]!==n[3])&&(a[0]=n[0],a[1]=n[1],a[2]=n[2],a[3]=n[3],l.uniform4f(d.location,n[0],n[1],n[2],n[3]))):(u.size===1&&!u.isArray?yV:_V)[u.type].call(null,l,d.location,d.value,h)}}function bV(){Object.assign(us.prototype,{systemCheck(){},syncUniforms(r,e){let{shader:t,renderer:i}=this;yF(r,t.program.uniformData,e.uniformData,r.uniforms,i)}})}bV();var mu=new(window.AudioContext||window.webkitAudioContext),vV=(r,e)=>{let t,i=mu.createGain();i.gain.value=e.volume??1,i.connect(mu.destination);let s={id:r,url:e.url,loop:e.loop||!1,volume:e.volume??1};return{play:()=>{let m=yn.getAsset(s.url);if(!m){console.warn("AudioPlayer.play: Asset not found",s.url);return}t=mu.createBufferSource(),t.buffer=m,t.loop=s.loop,i.gain.setValueAtTime(s.volume,mu.currentTime),t.connect(i),t.start(0)},stop:()=>{t&&(t.stop(),t.disconnect(),i.disconnect(),i.connect(mu.destination))},update:m=>{s={...s,...m}},getId:()=>s.id,getUrl:()=>s.url,getLoop:()=>s.loop,getVolume:()=>s.volume,setUrl:m=>{s.url=m},setLoop:m=>{s.loop=m},setVolume:m=>{s.volume=m,i.gain.value=m},get id(){return s.id},get url(){return s.url},get loop(){return s.loop},get volume(){return s.volume},gainNode:i}},_F=()=>{let r=[],e=[];return{add:a=>{e.push(a)},remove:a=>{e=e.filter(l=>l.id!==a)},getById:a=>e.find(l=>l.id===a),tick:()=>{for(let l of e){let c=r.find(u=>u.id===l.id);if(!c){let u=vV(l.id,{url:l.url,loop:l.loop,volume:l.volume??1});r.push(u),u.play();continue}(c.url!==l.url||c.loop!==l.loop)&&(c.stop(),c.setUrl(l.url),c.setLoop(l.loop??!1),c.play()),c.getVolume()!==(l.volume??1)&&c.setVolume(l.volume??1)}let a=[];for(let l of r)e.find(c=>c.id===l.id)||(l.stop(),a.push(l.id));r=r.filter(l=>!a.includes(l.id))},destroy:()=>{for(let a of r)a.stop();r=[],e=[]}}};var TV=({JSONObject:r,parserPlugins:e=[]})=>r.map(i=>{let s=e.find(o=>o.type===i.type);if(!s)throw new Error(`No parser plugin found for element type: ${i.type} (id: ${i.id??"unknown"})`);return s.parse({state:i,parserPlugins:e})});var Ab=TV;var bF=({type:r,parse:e})=>({type:r,parse:e});var Pb=typeof navigator<"u"?navigator.userAgent.toLowerCase().indexOf("firefox")>0:!1;function Cb(r,e,t,i){r.addEventListener?r.addEventListener(e,t,i):r.attachEvent&&r.attachEvent(`on${e}`,t)}function gu(r,e,t,i){r&&(r.removeEventListener?r.removeEventListener(e,t,i):r.detachEvent&&r.detachEvent(`on${e}`,t))}function SF(r,e){let t=e.slice(0,e.length-1),i=[];for(let s=0;s=0;)e[t-1]+=",",e.splice(t,1),t=e.lastIndexOf("");return e}function SV(r,e){let t=r.length>=e.length?r:e,i=r.length>=e.length?e:r,s=!0;for(let o=0;o_u[r.toLowerCase()]||Lr[r.toLowerCase()]||r.toUpperCase().charCodeAt(0),wV=r=>Object.keys(_u).find(e=>_u[e]===r),EV=r=>Object.keys(Lr).find(e=>Lr[e]===r),PF=r=>{AF=r||"all"},bu=()=>AF||"all",AV=()=>ze.slice(0),PV=()=>ze.map(r=>wV(r)||EV(r)||String.fromCharCode(r)),CV=()=>{let r=[];return Object.keys(qe).forEach(e=>{qe[e].forEach(({key:t,scope:i,mods:s,shortcut:o})=>{r.push({scope:i,shortcut:o,mods:s,keys:t.split("+").map(n=>ha(n))})})}),r},CF=r=>{let e=r.target||r.srcElement,{tagName:t}=e,i=!0,s=t==="INPUT"&&!["checkbox","radio","range","button","file","reset","submit","color"].includes(e.type);return(e.isContentEditable||(s||t==="TEXTAREA"||t==="SELECT")&&!e.readOnly)&&(i=!1),i},MV=r=>(typeof r=="string"&&(r=ha(r)),ze.indexOf(r)!==-1),RV=(r,e)=>{let t,i;r||(r=bu());for(let s in qe)if(Object.prototype.hasOwnProperty.call(qe,s))for(t=qe[s],i=0;iRb(o)):i++;bu()===r&&PF(e||"all")};function IV(r){let e=EF(r);r.key&&r.key.toLowerCase()==="capslock"&&(e=ha(r.key));let t=ze.indexOf(e);if(t>=0&&ze.splice(t,1),r.key&&r.key.toLowerCase()==="meta"&&ze.splice(0,ze.length),(e===93||e===224)&&(e=91),e in At){At[e]=!1;for(let i in Lr)Lr[i]===e&&(ur[i]=!1)}}var MF=(r,...e)=>{if(typeof r>"u")Object.keys(qe).forEach(t=>{Array.isArray(qe[t])&&qe[t].forEach(i=>Bp(i)),delete qe[t]}),Rb(null);else if(Array.isArray(r))r.forEach(t=>{t.key&&Bp(t)});else if(typeof r=="object")r.key&&Bp(r);else if(typeof r=="string"){let[t,i]=e;typeof t=="function"&&(i=t,t=""),Bp({key:r,scope:t,method:i,splitKey:"+"})}},Bp=({key:r,scope:e,method:t,splitKey:i="+"})=>{wF(r).forEach(s=>{let o=s.split(i),n=o.length,a=o[n-1],l=a==="*"?"*":ha(a);if(!qe[l])return;e||(e=bu());let c=n>1?SF(Lr,o):[],u=[];qe[l]=qe[l].filter(h=>{let d=(t?h.method===t:!0)&&h.scope===e&&SV(h.mods,c);return d&&u.push(h.element),!d}),u.forEach(h=>Rb(h))})};function vF(r,e,t,i){if(e.element!==i)return;let s;if(e.scope===t||e.scope==="all"){s=e.mods.length>0;for(let o in At)Object.prototype.hasOwnProperty.call(At,o)&&(!At[o]&&e.mods.indexOf(+o)>-1||At[o]&&e.mods.indexOf(+o)===-1)&&(s=!1);(e.mods.length===0&&!At[16]&&!At[18]&&!At[17]&&!At[91]||s||e.shortcut==="*")&&(e.keys=[],e.keys=e.keys.concat(ze),e.method(r,e)===!1&&(r.preventDefault?r.preventDefault():r.returnValue=!1,r.stopPropagation&&r.stopPropagation(),r.cancelBubble&&(r.cancelBubble=!0)))}}function TF(r,e){let t=qe["*"],i=EF(r);if(r.key&&r.key.toLowerCase()==="capslock"||!(ur.filter||CF).call(this,r))return;if((i===93||i===224)&&(i=91),ze.indexOf(i)===-1&&i!==229&&ze.push(i),["metaKey","ctrlKey","altKey","shiftKey"].forEach(a=>{let l=xu[a];r[a]&&ze.indexOf(l)===-1?ze.push(l):!r[a]&&ze.indexOf(l)>-1?ze.splice(ze.indexOf(l),1):a==="metaKey"&&r[a]&&(ze=ze.filter(c=>c in xu||c===i))}),i in At){At[i]=!0;for(let a in Lr)if(Object.prototype.hasOwnProperty.call(Lr,a)){let l=xu[Lr[a]];ur[a]=r[l]}if(!t)return}for(let a in At)Object.prototype.hasOwnProperty.call(At,a)&&(At[a]=r[xu[a]]);r.getModifierState&&!(r.altKey&&!r.ctrlKey)&&r.getModifierState("AltGraph")&&(ze.indexOf(17)===-1&&ze.push(17),ze.indexOf(18)===-1&&ze.push(18),At[17]=!0,At[18]=!0);let s=bu();if(t)for(let a=0;a1&&(s=SF(Lr,f));let p=f[f.length-1];p=p==="*"?"*":ha(p),p in qe||(qe[p]=[]),qe[p].push({keyup:l,keydown:c,scope:o,mods:s,shortcut:i[a],method:t,key:i[a],splitKey:u,element:n})}if(typeof n<"u"&&typeof window<"u"){if(!Fi.has(n)){let f=(m=window.event)=>TF(m,n),p=(m=window.event)=>{TF(m,n),IV(m)};Fi.set(n,{keydownListener:f,keyupListenr:p,capture:h}),Cb(n,"keydown",f,h),Cb(n,"keyup",p,h)}if(!yu){let f=()=>{ze=[]};yu={listener:f,capture:h},Cb(window,"focus",f,h)}}};function BV(r,e="all"){Object.keys(qe).forEach(t=>{qe[t].filter(i=>i.scope===e&&i.shortcut===r).forEach(i=>{i&&i.method&&i.method({},i)})})}function Rb(r){let e=Object.values(qe).flat();if(e.findIndex(({element:t})=>t===r)<0&&r){let{keydownListener:t,keyupListenr:i,capture:s}=Fi.get(r)||{};t&&i&&(gu(r,"keyup",i,s),gu(r,"keydown",t,s),Fi.delete(r))}if((e.length<=0||Fi.size<=0)&&(Array.from(Fi.keys()).forEach(t=>{let{keydownListener:i,keyupListenr:s,capture:o}=Fi.get(t)||{};i&&s&&(gu(t,"keyup",s,o),gu(t,"keydown",i,o),Fi.delete(t))}),Fi.clear(),Object.keys(qe).forEach(t=>delete qe[t]),yu)){let{listener:t,capture:i}=yu;gu(window,"focus",t,i),yu=null}}var Mb={getPressedKeyString:PV,setScope:PF,getScope:bu,deleteScope:RV,getPressedKeyCodes:AV,getAllKeyCodes:CV,isPressed:MV,filter:CF,trigger:BV,unbind:MF,keyMap:_u,modifier:Lr,modifierMap:xu};for(let r in Mb){let e=r;Object.prototype.hasOwnProperty.call(Mb,e)&&(ur[e]=Mb[e])}if(typeof window<"u"){let r=window.hotkeys;ur.noConflict=e=>(e&&window.hotkeys===ur&&(window.hotkeys=r),ur),window.hotkeys=ur}var kV=Object.prototype.hasOwnProperty,RF=r=>{let e=new Map;return{registerHotkeys:(s={})=>{if(typeof s!="object"||s===null)return;let o=[],n=[],a=[];Object.keys(s).forEach(l=>{let c=e.get(l);c?pe(c.payload,s[l].payload)||(n.push(l),ur.unbind(l)):o.push(l)}),e.forEach((l,c)=>{kV.call(s,c)||a.push(c)}),a.forEach(l=>{ur.unbind(l),e.delete(l)}),[...o,...n].forEach(l=>{let u=s[l].payload??{};ur(l,()=>{r&&r("keydown",{_event:{key:l},...u})}),e.set(l,{value:l,payload:u})})},destroy:()=>{for(let s of e.keys())ur.unbind(s);e.clear()}}};var BF=(r,e)=>typeof e!="string"?e:r[e]??e,FV=(r,e,t,i)=>{let s=BF(t,e);if(typeof s=="string"){let n=r[s];return n===void 0?i:n}let o=r;for(let n of s){if(o==null)return i;o=o[n]}return o===void 0?i:o},IF=(r,e,t,i)=>{let s=BF(t,e);if(typeof s=="string")return r[s]=i,r;let o=r;for(let n=0;n{if(!r||!Object.prototype.hasOwnProperty.call(r,e))throw new Error(`Animation "${t}" cannot auto-resolve property "${e}" from targetState.`);return r[e]},UV=(r,e,t,i,s)=>Object.entries(e).map(([o,n])=>{if(!Cd[o])throw new Error(`${o} is not a supported property for animation.`);let a=FV(r,o,t,0);if(n.auto){let u=OV(i,o,s);if(a===u)return null;let h=Mn([{value:a},{duration:n.auto.duration,value:u,easing:n.auto.easing}]);return{property:o,timeline:h}}let l=n.initialValue??a,c=Mn([{value:l},...n.keyframes]);return{property:o,timeline:c}}).filter(Boolean),kF=()=>{let r=[],e=new Map,t=new Map,i=0,s=null,o=!1,n=(M,F)=>Math.min(Math.max(M,0),Math.max(F??0,0)),a=(M,F)=>{let O=n(F,M.duration);return M.currentTime=O,M.applyFrame(O),O>=M.duration},l=(M,F)=>{t.get(M)?.forEach(O=>{try{O(F)}catch{}})},c=M=>{if(l("completed",{id:M.id}),M.onComplete)try{M.onComplete()}catch{}},u=M=>{M.applyFrame(0),e.set(M.id,M);let F=s!==null&&a(M,s);l("started",{id:M.id}),F&&(c(M),e.delete(M.id))},h=M=>{let{id:F,element:O,properties:D,targetState:N,onComplete:L,onCancel:Y,propertyPathMap:ue=Md}=M,J=UV(O,D,ue,N,F);if(J.length===0){c({id:F,onComplete:L});return}let Be={id:F,kind:"property",element:O,timelines:J,duration:mc(J),currentTime:0,stateVersion:i,targetState:N,onComplete:L,onCancel:Y,applyFrame:ke=>{for(let{property:Me,timeline:$e}of J){let it=gc($e,ke);try{IF(O,Me,ue,it)}catch{}}},applyTargetState:()=>{if(!(!O||O.destroyed)){if(N===null){O.destroy();return}if(N)for(let[ke,Me]of Object.entries(N))try{IF(O,ke,ue,Me)}catch{}}},isValid:()=>!!O&&!O.destroyed};u(Be)},d=M=>{let F={id:M.id,kind:"custom",duration:M.duration??0,currentTime:0,stateVersion:i,onComplete:M.onComplete,onCancel:M.onCancel,applyFrame:M.applyFrame??(()=>{}),applyTargetState:M.applyTargetState??(()=>{}),isValid:M.isValid??(()=>!0)};u(F)},f=M=>{if(M.driver==="custom"){d(M);return}h(M)},p=M=>{try{M.applyTargetState?.()}catch{}if(M.onCancel)try{M.onCancel()}catch{}},m=M=>{switch(M.type){case"START":f(M.payload);break;case"CANCEL":v(M.id);break}},g=()=>{let M=r.splice(0);for(let F of M)m(F)},_=()=>{s===null||o||(o=!0,queueMicrotask(()=>{o=!1,s!==null&&g()}))},v=M=>{let F=e.get(M);F&&(p(F),e.delete(M),l("cancelled",{id:M}))},x=M=>{r.push(M),_()},T=()=>{for(let[M,F]of e)p(F),l("cancelled",{id:M});e.clear(),i++},b=M=>{g();let F=[];for(let[O,D]of e){if(D.stateVersion!==i){F.push(O);continue}if(!D.isValid()){F.push(O);continue}if(D.currentTime+=M,D.currentTime>=D.duration){D.applyFrame(D.duration),c(D),F.push(O);continue}D.applyFrame(D.currentTime)}for(let O of F)e.delete(O)},E=M=>{s=M,g();let F=[];for(let[O,D]of e){if(D.stateVersion!==i){F.push(O);continue}if(!D.isValid()){F.push(O);continue}a(D,M)&&(c(D),F.push(O))}for(let O of F)e.delete(O)},w=()=>{s=null},I=()=>{g()},B=(M,F)=>(t.has(M)||t.set(M,new Set),t.get(M).add(F),()=>C(M,F)),C=(M,F)=>{t.get(M)?.delete(F)};return{dispatch:x,cancelAll:T,flush:I,tick:b,setTime:E,clearTime:w,on:B,off:C,getState:()=>({stateVersion:i,activeCount:e.size,animations:Array.from(e.entries()).map(([M,F])=>({id:M,currentTime:F.currentTime,duration:F.duration,progress:F.duration>0?F.currentTime/F.duration:0}))}),isAnimating:M=>e.has(M),destroy:()=>{T(),t.clear()}}};var FF=r=>{let e=0,t=0,i=null,s=!1,o=!1,n=d=>{o||(o=!0,r?.("renderComplete",d))};return{reset:d=>{e>0&&i!==null&&!o&&r?.("renderComplete",{id:i,aborted:!0}),t++,e=0,i=d,s=!0,o=!1},track:d=>{d===t&&e++},complete:d=>{d!==t||e===0||(e--,e===0&&!s&&n({id:i,aborted:!1}))},getVersion:()=>t,completeIfEmpty:()=>{s=!1,e===0&&n({id:i,aborted:!1})}}};var OF=new Set(["update","transition"]),GV=new Set(["alpha","x","y","scaleX","scaleY","rotation"]),LV=new Set(["translateX","translateY","alpha","scaleX","scaleY","rotation"]),UF=new Set(["single","sequence","composite"]),kp=new Set(["red","green","blue","alpha"]),GF=new Set(["max","min","multiply","add"]),DF=new Set(nf),ci=(r,e)=>{if(!r||typeof r!="object"||Array.isArray(r))throw new Error(`${e} must be an object.`)},fo=(r,e)=>{if(typeof r!="string"||r.length===0)throw new Error(`${e} must be a non-empty string.`)},vu=(r,e)=>{if(typeof r!="number"||Number.isNaN(r))throw new Error(`${e} must be a number.`)},DV=(r,e)=>{if(ci(r,e),vu(r.duration,`${e}.duration`),r.easing!==void 0&&typeof r.easing!="string")throw new Error(`${e}.easing must be a string.`);if(r.easing!==void 0&&!DF.has(r.easing))throw new Error(`${e}.easing must be one of: ${nf.join(", ")}.`);return{duration:r.duration,easing:r.easing??"linear"}},Bb=(r,e)=>{ci(r,e);let t={};if(r.initialValue!==void 0&&(vu(r.initialValue,`${e}.initialValue`),t.initialValue=r.initialValue),!Array.isArray(r.keyframes)||r.keyframes.length===0)throw new Error(`${e}.keyframes must be a non-empty array.`);return t.keyframes=r.keyframes.map((i,s)=>{let o=`${e}.keyframes[${s}]`;if(ci(i,o),vu(i.value,`${o}.value`),vu(i.duration,`${o}.duration`),i.easing!==void 0&&typeof i.easing!="string")throw new Error(`${o}.easing must be a string.`);if(i.easing!==void 0&&!DF.has(i.easing))throw new Error(`${o}.easing must be one of: ${nf.join(", ")}.`);if(i.relative!==void 0&&typeof i.relative!="boolean")throw new Error(`${o}.relative must be a boolean.`);return{value:i.value,duration:i.duration,easing:i.easing??"linear",...i.relative!==void 0?{relative:i.relative}:{}}}),t},NV=(r,e)=>{ci(r,e);let t=r.keyframes!==void 0,i=r.auto!==void 0;if(t&&i)throw new Error(`${e} cannot define both keyframes and auto.`);if(!t&&!i)throw new Error(`${e} must define keyframes or auto.`);if(i){if(r.initialValue!==void 0)throw new Error(`${e}.initialValue is not valid when auto is defined.`);return{auto:DV(r.auto,`${e}.auto`)}}return Bb(r,e)},NF=(r,e,t,i=Bb)=>{ci(r,e);let s=Object.entries(r).map(([o,n])=>{if(!t.has(o))throw new Error(`${e}.${o} is not a supported animation property.`);return[o,i(n,`${e}.${o}`)]});if(s.length===0)throw new Error(`${e} must define at least one property.`);return Object.fromEntries(s)},HV=(r,e)=>{if(ci(r,e),fo(r.texture,`${e}.texture`),r.channel!==void 0&&!kp.has(r.channel))throw new Error(`${e}.channel must be one of: ${Array.from(kp).join(", ")}.`);if(r.invert!==void 0&&typeof r.invert!="boolean")throw new Error(`${e}.invert must be a boolean.`);return{texture:r.texture,...r.channel?{channel:r.channel}:{},...r.invert!==void 0?{invert:r.invert}:{}}},VV=(r,e)=>{if(ci(r,e),!UF.has(r.kind))throw new Error(`${e}.kind must be one of: ${Array.from(UF).join(", ")}.`);let t={kind:r.kind};if(r.channel!==void 0){if(!kp.has(r.channel))throw new Error(`${e}.channel must be one of: ${Array.from(kp).join(", ")}.`);t.channel=r.channel}if(r.softness!==void 0&&(vu(r.softness,`${e}.softness`),t.softness=r.softness),r.invert!==void 0){if(typeof r.invert!="boolean")throw new Error(`${e}.invert must be a boolean.`);t.invert=r.invert}if(r.progress!==void 0&&(t.progress=Bb(r.progress,`${e}.progress`)),r.kind==="single"&&(fo(r.texture,`${e}.texture`),t.texture=r.texture),r.kind==="sequence"){if(!Array.isArray(r.textures)||r.textures.length===0)throw new Error(`${e}.textures must be a non-empty array.`);t.textures=r.textures.map((i,s)=>(fo(i,`${e}.textures[${s}]`),i)),r.sample!==void 0&&(fo(r.sample,`${e}.sample`),t.sample=r.sample)}if(r.kind==="composite"){if(!GF.has(r.combine??"max"))throw new Error(`${e}.combine must be one of: ${Array.from(GF).join(", ")}.`);if(!Array.isArray(r.items)||r.items.length===0)throw new Error(`${e}.items must be a non-empty array.`);t.combine=r.combine??"max",t.items=r.items.map((i,s)=>HV(i,`${e}.items[${s}]`))}return t.progress||(t.progress={initialValue:0,keyframes:[{duration:0,value:1,easing:"linear"}]}),t},LF=(r,e)=>{if(ci(r,e),r.mask!==void 0)throw new Error(`${e}.mask is not valid. Define mask on ${e}.`);let t={};if(r.tween!==void 0&&(t.tween=NF(r.tween,`${e}.tween`,LV)),Object.keys(t).length===0)throw new Error(`${e} must define tween.`);return t},WV=(r,e)=>{let t={};if(r.shader!==void 0)throw new Error(`${e}.shader is not supported.`);if(r.prev!==void 0&&(t.prev=LF(r.prev,`${e}.prev`)),r.next!==void 0&&(t.next=LF(r.next,`${e}.next`)),r.mask!==void 0&&(t.mask=VV(r.mask,`${e}.mask`)),t.prev===void 0&&t.next===void 0&&t.mask===void 0)throw new Error(`${e} must define prev, next, or mask.`);return t},Ib=(r,e,t)=>{if(r!==void 0)throw new Error(`${e} ${t}`)},HF=(r=[])=>{if(!Array.isArray(r))throw new Error("Input error: `animations` must be an array.");let e=r.map((i,s)=>{let o=`animations[${s}]`;if(ci(i,o),fo(i.id,`${o}.id`),fo(i.targetId,`${o}.targetId`),fo(i.type,`${o}.type`),!OF.has(i.type))throw new Error(`${o}.type must be one of: ${Array.from(OF).join(", ")}.`);let n={id:i.id,targetId:i.targetId,type:i.type};if(i.complete!==void 0&&(ci(i.complete,`${o}.complete`),n.complete=i.complete),Ib(i.operation,`${o}.operation`,"is no longer supported. Use `type: update | transition` instead."),Ib(i.properties,`${o}.properties`,"is no longer supported. Use `tween` instead."),Ib(i.subjects,`${o}.subjects`,"is no longer supported. Use `prev` / `next` instead."),i.type==="update"){if(n.tween=NF(i.tween,`${o}.tween`,GV,NV),i.replace!==void 0)throw new Error(`${o}.replace is no longer supported. Define \`prev\`, \`next\`, or \`mask\` directly on the animation.`);if(i.prev!==void 0)throw new Error(`${o}.prev is only valid for transition animations.`);if(i.next!==void 0)throw new Error(`${o}.next is only valid for transition animations.`);if(i.mask!==void 0)throw new Error(`${o}.mask is only valid for transition animations.`);if(i.shader!==void 0)throw new Error(`${o}.shader is not supported.`);return n}if(i.tween!==void 0)throw new Error(`${o}.tween is not valid for transition animations.`);if(i.replace!==void 0)throw new Error(`${o}.replace is no longer supported. Define \`prev\`, \`next\`, or \`mask\` directly on the animation.`);let a=WV(i,o);return a.prev!==void 0&&(n.prev=a.prev),a.next!==void 0&&(n.next=a.next),a.mask!==void 0&&(n.mask=a.mask),n}),t=new Map;for(let i of e){let s=t.get(i.targetId)??new Set;s.add(i.type),t.set(i.targetId,s)}for(let[i,s]of t)if(s.has("transition")&&s.size>1)throw new Error(`Animations targeting "${i}" cannot mix update and transition types in the same state.`);return e};var kb=(r={})=>{if(r===null||typeof r!="object")throw new Error("Input error: render state must be an object.");if(r.transitions!==void 0)throw new Error("Input error: `transitions` is no longer supported. Use `animations` instead.");let e={...r,elements:r.elements??[],animations:r.animations??[],audio:r.audio??[]};if(!Array.isArray(e.elements))throw new Error("Input error: `elements` must be an array.");if(!Array.isArray(e.animations))throw new Error("Input error: `animations` must be an array.");if(!Array.isArray(e.audio))throw new Error("Input error: `audio` must be an array.");return e.animations=HF(e.animations),e};var zV="0",da=(r,e)=>{let t=r?.[e];return typeof t=="number"?t:0},hr=r=>({value:r.element.value??"",selectionStart:da(r.element,"selectionStart"),selectionEnd:da(r.element,"selectionEnd"),focused:document.activeElement===r.element,composing:r.composing===!0}),$V=(r,e)=>!r||!e?!1:r.value===e.value&&r.selectionStart===e.selectionStart&&r.selectionEnd===e.selectionEnd&&r.focused===e.focused&&r.composing===e.composing,XV=r=>r instanceof HTMLInputElement||r instanceof HTMLTextAreaElement,Tu=r=>{r.element.style.pointerEvents="none"},Fb=(r,e,t)=>{if(typeof r?.setSelectionRange=="function")try{r.setSelectionRange(e,t)}catch{}},jV=({app:r,geometry:e})=>{let t=r.canvas;if(!e||!t||e.visible===!1)return null;let i=t.getBoundingClientRect(),s=r.renderer?.width||i.width||1,o=r.renderer?.height||i.height||1,n=i.width/s,a=i.height/o,l=e.clipInsets??{top:0,right:0,bottom:0,left:0},c=i.left+(e.x+l.left)*n,u=i.top+(e.y+l.top)*a,h=i.left+(e.x+e.width-l.right)*n,d=i.top+(e.y+e.height-l.bottom)*a;return h<=c||d<=u?null:{left:c,top:u,right:h,bottom:d}},YV=({app:r,entry:e,event:t})=>{let i=e.options.getGeometry?.(),s=jV({app:r,geometry:i}),o=t.clientX,n=t.clientY;return!!s&&Number.isFinite(o)&&Number.isFinite(n)&&o>=s.left&&o<=s.right&&n>=s.top&&n<=s.bottom},VF=({app:r})=>{let e=new Map,t,i=null,s=()=>{t||(t=document.createElement("div"),t.dataset.routeGraphicsInputBridge="true",t.style.position="fixed",t.style.left="0",t.style.top="0",t.style.pointerEvents="none",t.style.zIndex="1000",t.style.width="0",t.style.height="0");let x=r.canvas?.parentNode??document.body;t.isConnected||x.appendChild(t)},o=(x,T=x.lastSnapshot)=>{let b=hr(x);b.focused&&i!==x.id?i=x.id:!b.focused&&i===x.id&&(i=null),Tu(x,i),T?.value!==b.value&&x.callbacks.onValueChange?.(b),(T?.selectionStart!==b.selectionStart||T?.selectionEnd!==b.selectionEnd||T?.focused!==b.focused||T?.composing!==b.composing)&&x.callbacks.onSelectionChange?.(b),x.lastSnapshot=b},n=x=>{let{disabled:T=!1,multiline:b=!1,maxLength:E,textStyle:w,padding:I,placeholder:B="",autocomplete:C="off",autocapitalize:A="off",spellcheck:P=!1}=x.options,{element:R}=x;R instanceof HTMLInputElement&&(R.type="text"),R.disabled=T,R.placeholder=B,R.autocomplete=C,R.autocapitalize=A,R.spellcheck=!!P,R.style.opacity=zV,R.style.color="transparent",R.style.caretColor="transparent",R.style.background="transparent",R.style.paddingTop=`${I.top}px`,R.style.paddingRight=`${I.right}px`,R.style.paddingBottom=`${I.bottom}px`,R.style.paddingLeft=`${I.left}px`,R.style.fontFamily=w?.fontFamily??"Arial",R.style.fontSize=`${w?.fontSize??16}px`,R.style.fontWeight=w?.fontWeight??"400",R.style.textAlign=w?.align??"left",R.style.lineHeight=typeof w?.lineHeight=="number"?`${w.lineHeight}px`:"normal",R.style.whiteSpace=b?"pre":"nowrap",R.style.overflowWrap="normal",R.style.resize="none",R.style.overflow="hidden",typeof E=="number"?R.maxLength=E:R.removeAttribute("maxLength"),R.tabIndex=-1,b&&R instanceof HTMLTextAreaElement&&(R.wrap="off",R.rows=1),Tu(x,i)},a=x=>{s();let T=r.canvas,b=x.options.getGeometry?.();if(!T||!b||b.visible===!1){x.element.style.display="none";return}let E=T.getBoundingClientRect(),w=r.renderer?.width||E.width||1,I=r.renderer?.height||E.height||1,B=E.width/w,C=E.height/I,A=b.clipInsets??{top:0,right:0,bottom:0,left:0},P={top:A.top*C,right:A.right*B,bottom:A.bottom*C,left:A.left*B};x.element.style.display="block",x.element.style.left=`${E.left+b.x*B}px`,x.element.style.top=`${E.top+b.y*C}px`,x.element.style.width=`${b.width*B}px`,x.element.style.height=`${b.height*C}px`;let R=Object.values(P).some(M=>M>0);x.element.style.clipPath=R?`inset(${P.top}px ${P.right}px ${P.bottom}px ${P.left}px)`:"none"},l=x=>{if(!i)return;let T=e.get(i),b=x.target;!T||b===T.element||T.element.contains(b)||XV(b)&&t?.contains(b)||YV({app:r,entry:T,event:x})||T.element.blur()},c=()=>{for(let x of e.values()){if(a(x),!x.lastSnapshot){x.lastSnapshot=hr(x);continue}let T=hr(x);$V(T,x.lastSnapshot)||o(x,x.lastSnapshot)}},u=({id:x,options:T})=>{let b=T.multiline===!0?document.createElement("textarea"):document.createElement("input");return b.dataset.routeGraphicsInputId=x,b.style.position="fixed",b.style.border="none",b.style.outline="none",b.style.margin="0",b.style.boxSizing="border-box",b.style.borderRadius="0",b.style.transformOrigin="top left",b.style.appearance="none",b.style.boxShadow="none",b.style.userSelect="none",b.style.webkitUserSelect="none",b},h=x=>{let{id:T,element:b}=x,E=()=>{o(x)};b.addEventListener("focus",()=>{x.pendingBlurTimer&&(clearTimeout(x.pendingBlurTimer),x.pendingBlurTimer=null),i=T,Tu(x,i);let w=hr(x);x.lastSnapshot=w,x.callbacks.onFocus?.(w),x.callbacks.onSelectionChange?.(w)}),b.addEventListener("blur",()=>{i===T&&(i=null),Tu(x,i),x.pendingBlurTimer=setTimeout(()=>{x.pendingBlurTimer=null;let w=hr(x);if(w.focused){x.lastSnapshot=w;return}x.lastSnapshot=w,x.callbacks.onBlur?.(w),x.callbacks.onSelectionChange?.(w)},0)}),b.addEventListener("input",E),b.addEventListener("select",E),b.addEventListener("click",()=>queueMicrotask(E)),b.addEventListener("keyup",()=>queueMicrotask(E)),b.addEventListener("keydown",w=>{let I=w.key==="Enter"&&x.options.multiline!==!0&&!w.shiftKey,B=w.key==="Enter"&&x.options.multiline===!0&&(w.ctrlKey||w.metaKey);(I||B)&&(w.preventDefault(),x.callbacks.onSubmit?.(hr(x),w)),w.key==="Escape"&&b.blur(),queueMicrotask(E)}),b.addEventListener("compositionstart",()=>{x.composing=!0;let w=hr(x);x.lastSnapshot=w,x.callbacks.onCompositionStart?.(w),x.callbacks.onSelectionChange?.(w)}),b.addEventListener("compositionupdate",()=>{let w=hr(x);x.lastSnapshot=w,x.callbacks.onCompositionUpdate?.(w),x.callbacks.onSelectionChange?.(w)}),b.addEventListener("compositionend",()=>{x.composing=!1,E(),x.callbacks.onCompositionEnd?.(hr(x))})};document.addEventListener("pointerdown",l,!0),r.ticker?.add?.(c);let d=(x,T)=>{s();let b=e.get(x);if(b)return b.options=T,b.callbacks=T.callbacks??{},n(b),a(b),typeof T.value=="string"&&b.element.value!==T.value&&(b.element.value=T.value),b.lastSnapshot=hr(b),b.element;let E={id:x,element:u({id:x,options:T}),options:T,callbacks:T.callbacks??{},composing:!1,pendingBlurTimer:null,lastSnapshot:null};return h(E),typeof T.value=="string"&&(E.element.value=T.value),n(E),t.appendChild(E.element),e.set(x,E),a(E),E.lastSnapshot=hr(E),E.element};return{mount:d,update:(x,T)=>{let b=e.get(x);if(!b)return d(x,T);let E=T.multiline===!0!=b.element instanceof HTMLTextAreaElement;if(b.options=T,b.callbacks=T.callbacks??{},E){let w=b.element,I=document.activeElement===w,B=da(w,"selectionStart"),C=da(w,"selectionEnd");return b.element=u({id:x,options:T}),h(b),w.replaceWith(b.element),b.element.value=typeof T.value=="string"?T.value:w.value,n(b),a(b),b.lastSnapshot=hr(b),I&&!T.disabled&&queueMicrotask(()=>{b.element.focus(),Fb(b.element,B,C)}),b.element}return typeof T.value=="string"&&T.value!==b.element.value&&b.composing!==!0&&(b.element.value=T.value),n(b),a(b),b.lastSnapshot=hr(b),b.element},focus:(x,{selectAll:T=!1,selectionStart:b,selectionEnd:E}={})=>{let w=e.get(x);if(!w||w.element.disabled)return;let I=document.activeElement===w.element;if(i=x,Tu(w,i),I||w.element.focus(),T){w.element.select?.(),o(w,w.lastSnapshot);return}if(typeof b=="number"||typeof E=="number"){let B=typeof b=="number"?b:da(w.element,"selectionStart"),C=typeof E=="number"?E:typeof b=="number"?b:da(w.element,"selectionEnd");Fb(w.element,B,C)}o(w,w.lastSnapshot)},setSelection:(x,T,b=T,{focus:E=!1}={})=>{let w=e.get(x);if(!w||w.element.disabled)return;let I=()=>{Fb(w.element,T,b),o(w,w.lastSnapshot)};if(E&&document.activeElement!==w.element){w.element.focus(),I();return}I()},blur:x=>{e.get(x)?.element.blur()},unmount:x=>{let T=e.get(x);T&&(i===x&&(i=null),T.pendingBlurTimer&&(clearTimeout(T.pendingBlurTimer),T.pendingBlurTimer=null),T.element.remove(),e.delete(x),e.size===0&&t?.remove())},destroy:()=>{document.removeEventListener("pointerdown",l,!0),r.ticker?.remove?.(c);for(let x of e.values())x.pendingBlurTimer&&(clearTimeout(x.pendingBlurTimer),x.pendingBlurTimer=null),x.element.remove();e.clear(),i=null,t?.remove(),t=void 0}}};var qV=()=>{let r=A=>{if(A!=="auto"&&A!=="manual")throw new Error(`Invalid animation playback mode "${A}". Expected "auto" or "manual".`)},e,t=_F(),i={elements:[],animations:[],audio:[]},s,o={animations:[],elements:[],audio:[],parsers:[]},n,a,l,c,u=!1,h,d,f,p="auto",m=null,g=[],_,v=new Map,x,T=(A,P,R,M)=>{A.clear(),A.rect(0,0,P,R),A.fill(M??0)},b=A=>A?A.startsWith("audio/")?"audio":A.startsWith("font/")||["application/font-woff","application/font-woff2","application/x-font-ttf","application/x-font-otf"].includes(A)?"font":A.startsWith("video/")?"video":"texture":"texture",E=(A,P,{revokable:R=!1}={})=>{v.set(A,{url:P,revokable:R})},w=()=>{for(let A of v.values())A?.revokable===!0&&typeof A?.url=="string"&&URL.revokeObjectURL(A.url);v.clear()},I=(A,P,R)=>{n&&n.registerHotkeys(R?.keyboard??{}),A.renderer.events.cursorStyles||(A.renderer.events.cursorStyles={}),A.renderer.events.cursorStyles.default||(A.renderer.events.cursorStyles.default="default"),A.renderer.events.cursorStyles.hover||(A.renderer.events.cursorStyles.hover="pointer");let M=P?.cursorStyles,F=R?.cursorStyles;pe(M,F)||(F?(F.default&&(A.renderer.events.cursorStyles.default=F.default,A.canvas.style.cursor=F.default),F.hover&&(A.renderer.events.cursorStyles.hover=F.hover)):M&&(A.renderer.events.cursorStyles.default="default",A.renderer.events.cursorStyles.hover="pointer"))},B=(A,P,R,M)=>{if(pe(i,R)){typeof A.render=="function"&&A.render();return}h&&h.abort(),h=new AbortController;let F=h.signal;l.reset(R.id),I(A,i.global,R.global),a.cancelAll(),Vs({app:A,parent:P,prevComputedTree:i.elements,nextComputedTree:R.elements,animations:R.animations,elementPlugins:o.elements,animationBus:a,completionTracker:l,eventHandler:M,signal:F}),a.flush(),p==="manual"&&m!==null&&a.setTime(m),a_({app:A,prevAudioTree:i.audio,nextAudioTree:R.audio,audioPlugins:o.audio}),i=R,typeof A.render=="function"&&A.render(),l.completeIfEmpty(),u||(u=!0,c&&c())},C={rendererName:"pixi",get canvas(){return e.canvas},findElementByLabel:A=>e.stage.getChildByLabel(A,!0)??null,extractBase64:async A=>{typeof e.render=="function"&&e.render();let P=new Q(0,0,e.renderer.width,e.renderer.height);if(!A)return await e.renderer.extract.base64({target:e.stage,frame:P});let R=e.stage.getChildByLabel(A,!0);if(!R)throw new Error(`Element with label '${A}' not found`);return await e.renderer.extract.base64({target:R,frame:P})},assignStageEvent:(A,P)=>{e.stage.eventMode="static",e.stage.on(A,P)},setAnimationPlaybackMode:A=>{r(A),p=A,p!=="manual"&&(m=null,a?.clearTime?.())},setAnimationTime:A=>{let P=Number(A);if(!Number.isFinite(P))throw new Error("Animation time must be a finite number.");p==="manual"&&(m=P),a.flush(),a.setTime(P),p!=="manual"&&(m=null,a.clearTime()),typeof e.render=="function"&&e.render()},init:async A=>{let{eventHandler:P,plugins:R,width:M,height:F,backgroundColor:O,debug:D=!1,onFirstRender:N,animationPlaybackMode:L="auto"}=A;c=N,r(L),p=L,m=null,g.forEach(J=>J()),g=[];let Y=[];R?.elements?.forEach(J=>{J?.parse&&Y.push(bF({type:J.type,parse:J.parse}))}),o={animations:R?.animations??[],elements:R?.elements??[],audio:R?.audio??[],parsers:Y},s=P,n=RF(P),l=FF(P),e=new ic,e.audioStage=t,await e.init({width:M,height:F,backgroundColor:O,preference:"webgl",preserveDrawingBuffer:D===!0}),typeof e.ticker?.remove=="function"&&e.ticker.remove(e.render,e),e.debug=D,e.inputDomBridge=VF({app:e}),_=J=>{J.preventDefault()},e.canvas.addEventListener("contextmenu",_),x=new Ue,x.label="__route_graphics_background__",T(x,M,F,O),e.stage.addChild(x),e.stage.width=M,e.stage.height=F,e.ticker.add(e.audioStage.tick),a=kF();let ue=()=>{p==="manual"&&typeof e.render=="function"&&e.render()};return g=[a.on("started",ue),a.on("completed",ue),a.on("cancelled",ue)],D?(d=J=>{p==="auto"&&J?.detail?.deltaMS&&(a.tick(Number(J.detail.deltaMS)),typeof e.render=="function"&&e.render())},window.addEventListener("snapShotKeyFrame",d)):(f=J=>{p==="auto"&&(a.tick(J.deltaMS),typeof e.render=="function"&&e.render())},e.ticker.add(f)),C},destroy:()=>{h&&(h.abort(),h=void 0),d&&(window.removeEventListener("snapShotKeyFrame",d),d=void 0),f&&typeof e?.ticker?.remove=="function"&&(e.ticker.remove(f),f=void 0),_&&e?.canvas&&(e.canvas.removeEventListener("contextmenu",_),_=void 0),e?.inputDomBridge?.destroy?.(),n?.destroy(),Qy(),g.forEach(P=>P()),g=[],a&&a.destroy(),e?.audioStage&&e.audioStage.destroy();let A=P=>{for(let R of P.children){let M=R.texture?.source?.resource;M instanceof HTMLVideoElement&&M.pause(),R.children&&A(R)}};e?.stage&&A(e.stage),e&&e.destroy(),p="auto",m=null,x=void 0,w()},loadAssets:async A=>{if(!A)throw new Error("assetBufferMap is required");let P={audio:{},font:{},video:{},texture:{}};for(let[F,O]of Object.entries(A)){let D=b(O.type);P[D][F]=O}await Promise.all(Object.entries(P.audio).map(([F,O])=>yn.load(F,O.buffer))),await Promise.all(Object.entries(P.font).map(async([F,O])=>{let D=new Blob([O.buffer],{type:O.type}),N=URL.createObjectURL(D),L=new FontFace(F,`url(${N})`);try{await L.load(),document.fonts.add(L)}catch(Y){console.error(`Failed to load font ${F}:`,Y)}finally{URL.revokeObjectURL(N)}}));let R=Object.entries(P.texture).map(async([F,O])=>{if(br.cache.has(F))return br.cache.get(F);if(O?.source==="url"&&typeof O?.url=="string")return br.load({alias:F,src:O.url,parser:"loadTextures"});let D=new Blob([O.buffer],{type:O.type}),N=await createImageBitmap(D),L=k.from(N);return br.cache.set(F,L),L}),M=Object.entries(P.video).map(async([F,O])=>{let D=O?.source==="url"&&typeof O?.url=="string"?O.url:URL.createObjectURL(new Blob([O.buffer],{type:O.type})),N=O?.source!=="url";E(F,D,{revokable:N});let L={alias:F,src:D,parser:"loadVideo",data:{}};return typeof O?.type=="string"&&O.type.length>0&&(L.data.mime=O.type),br.load(L).then(Y=>Y).catch(Y=>{throw v.delete(F),N&&URL.revokeObjectURL(D),Y})});return Promise.all([...R,...M])},loadAudioAssets:async A=>Promise.all(A.map(async P=>{let M=await(await fetch(P)).arrayBuffer();return yn.load(P,M)})),updatedBackgroundColor:A=>{e.renderer.background.color=A,x&&T(x,e.renderer.width,e.renderer.height,A),typeof e.render=="function"&&e.render()},render:A=>{let P=kb(A),R=Ab({JSONObject:P.elements,parserPlugins:o.parsers}),M={...P,elements:R};B(e,e.stage,M,s)},parse:A=>{let P=kb(A),R=Ab({JSONObject:P.elements,parserPlugins:o.parsers});return{...P,elements:R}}};return C},WF=qV;var wIe=WF;export{ic as Application,br as Assets,yn as AudioAsset,cD as animatedSpritePlugin,JL as containerPlugin,vy as createAnimationPlugin,QF as createAssetBufferManager,Ty as createAudioPlugin,et as createElementPlugin,wIe as default,mL as inputPlugin,QD as particlesPlugin,WG as rectPlugin,a_ as renderAudio,Vs as renderElements,rL as sliderPlugin,dD as soundPlugin,zG as spritePlugin,NR as spritesheetAnimationPlugin,NG as textPlugin,oD as textRevealingPlugin,uD as tweenPlugin,XG as videoPlugin}; /*! Bundled license information: punycode/punycode.js: diff --git a/playground/static/public/playground/templates.yaml b/playground/static/public/playground/templates.yaml index 47d846b8..8521497b 100644 --- a/playground/static/public/playground/templates.yaml +++ b/playground/static/public/playground/templates.yaml @@ -106,7 +106,8 @@ width: 220 height: 240 direction: vertical - gap: 12 + gapX: 12 + gapY: 12 children: - id: vertical-1 type: rect @@ -130,7 +131,8 @@ width: 280 height: 90 direction: horizontal - gap: 10 + gapX: 10 + gapY: 10 children: - id: horizontal-1 type: rect diff --git a/spec/parser/parseContainer.test.yaml b/spec/parser/parseContainer.test.yaml index 6c5dabc6..28f82e47 100644 --- a/spec/parser/parseContainer.test.yaml +++ b/spec/parser/parseContainer.test.yaml @@ -12,7 +12,8 @@ in: id: container-1 type: container direction: horizontal - gap: 5 + gapX: 5 + gapY: 5 x: 240 "y": 240 anchorX: 0.5 @@ -47,7 +48,8 @@ out: id: container-1 type: container direction: horizontal - gap: 5 + gapX: 5 + gapY: 5 width: 322 height: 96 x: 79 @@ -121,7 +123,8 @@ out: id: hover-container type: container direction: "" - gap: 0 + gapX: 0 + gapY: 0 width: 120 height: 60 x: 10 @@ -152,7 +155,8 @@ in: id: container-1 type: container direction: vertical - gap: 5 + gapX: 5 + gapY: 5 x: 240 "y": 240 anchorX: 0.5 @@ -187,7 +191,8 @@ out: id: container-1 type: container direction: vertical - gap: 5 + gapX: 5 + gapY: 5 width: 100 height: 310 x: 190 @@ -241,7 +246,8 @@ in: type: container direction: horizontal width: 200 - gap: 5 + gapX: 5 + gapY: 5 x: 240 "y": 240 anchorX: 0.5 @@ -268,7 +274,8 @@ out: id: container-1 type: container direction: horizontal - gap: 5 + gapX: 5 + gapY: 5 width: 200 height: 181 x: 140 @@ -313,7 +320,8 @@ in: type: container direction: vertical height: 200 - gap: 5 + gapX: 5 + gapY: 5 x: 240 "y": 240 anchorX: 0.5 @@ -348,7 +356,8 @@ out: id: container-1 type: container direction: vertical - gap: 5 + gapX: 5 + gapY: 5 width: 245 height: 200 x: 118 @@ -399,6 +408,156 @@ out: rotation: 90 alpha: 1 --- +case: Test parsing horizontal container uses gapX for siblings and gapY for wrapped rows +in: + - state: + id: container-gap-axes-horizontal + type: container + direction: horizontal + width: 170 + gapX: 5 + gapY: 7 + children: + - id: rect-1 + type: rect + width: 80 + height: 20 + fill: red + - id: rect-2 + type: rect + width: 80 + height: 30 + fill: blue + - id: rect-3 + type: rect + width: 80 + height: 40 + fill: green +out: + id: container-gap-axes-horizontal + type: container + direction: horizontal + gapX: 5 + gapY: 7 + width: 170 + height: 77 + x: 0 + "y": 0 + originX: 0 + originY: 0 + scroll: false + rotation: 0 + alpha: 1 + children: + - id: rect-1 + type: rect + width: 80 + height: 20 + x: 0 + "y": 0 + originX: 0 + originY: 0 + fill: red + rotation: 0 + alpha: 1 + - id: rect-2 + type: rect + width: 80 + height: 30 + x: 85 + "y": 0 + originX: 0 + originY: 0 + fill: blue + rotation: 0 + alpha: 1 + - id: rect-3 + type: rect + width: 80 + height: 40 + x: 0 + "y": 37 + originX: 0 + originY: 0 + fill: green + rotation: 0 + alpha: 1 +--- +case: Test parsing vertical container uses gapY for siblings and gapX for wrapped columns +in: + - state: + id: container-gap-axes-vertical + type: container + direction: vertical + height: 170 + gapX: 7 + gapY: 5 + children: + - id: rect-1 + type: rect + width: 20 + height: 80 + fill: red + - id: rect-2 + type: rect + width: 30 + height: 80 + fill: blue + - id: rect-3 + type: rect + width: 40 + height: 80 + fill: green +out: + id: container-gap-axes-vertical + type: container + direction: vertical + gapX: 7 + gapY: 5 + width: 77 + height: 170 + x: 0 + "y": 0 + originX: 0 + originY: 0 + scroll: false + rotation: 0 + alpha: 1 + children: + - id: rect-1 + type: rect + width: 20 + height: 80 + x: 0 + "y": 0 + originX: 0 + originY: 0 + fill: red + rotation: 0 + alpha: 1 + - id: rect-2 + type: rect + width: 30 + height: 80 + x: 0 + "y": 85 + originX: 0 + originY: 0 + fill: blue + rotation: 0 + alpha: 1 + - id: rect-3 + type: rect + width: 40 + height: 80 + x: 37 + "y": 0 + originX: 0 + originY: 0 + fill: green + rotation: 0 + alpha: 1 +--- case: Test parsing vertical container anchors to bottom without scroll in: - state: @@ -406,7 +565,8 @@ in: type: container direction: vertical height: 200 - gap: 5 + gapX: 5 + gapY: 5 anchorToBottom: true children: - id: rect-1 @@ -428,7 +588,8 @@ out: id: container-anchor-bottom-vertical type: container direction: vertical - gap: 5 + gapX: 5 + gapY: 5 width: 100 height: 200 x: 0 @@ -481,7 +642,8 @@ in: type: container direction: horizontal width: 200 - gap: 5 + gapX: 5 + gapY: 5 anchorToBottom: true children: - id: rect-1 @@ -503,7 +665,8 @@ out: id: container-anchor-bottom-horizontal type: container direction: horizontal - gap: 5 + gapX: 5 + gapY: 5 width: 200 height: 100 x: 0 @@ -555,7 +718,8 @@ in: id: container-1 type: container direction: vertical - gap: 5 + gapX: 5 + gapY: 5 x: 240 "y": 240 anchorX: 0.5 @@ -565,7 +729,8 @@ out: id: container-1 type: container direction: vertical - gap: 5 + gapX: 5 + gapY: 5 width: 0 height: 0 x: 240 @@ -607,7 +772,8 @@ out: type: container direction: "" alpha: 1 - gap: 0 + gapX: 0 + gapY: 0 height: 100 originX: 0 originY: 0 @@ -628,7 +794,8 @@ out: originY: 100 scroll: false rotation: 0 - gap: 0 + gapX: 0 + gapY: 0 alpha: 1 children: - id: reactid @@ -651,7 +818,8 @@ in: id: container-particles type: container direction: horizontal - gap: 10 + gapX: 10 + gapY: 10 width: 500 height: 300 children: @@ -706,7 +874,8 @@ out: type: container direction: horizontal alpha: 1 - gap: 10 + gapX: 10 + gapY: 10 height: 300 originX: 0 originY: 0 @@ -778,7 +947,8 @@ in: id: container-multi-particles type: container direction: vertical - gap: 20 + gapX: 20 + gapY: 20 width: 400 height: 600 children: @@ -902,7 +1072,8 @@ out: type: container direction: vertical alpha: 1 - gap: 20 + gapX: 20 + gapY: 20 height: 600 originX: 0 originY: 0 @@ -1041,7 +1212,8 @@ in: id: container-events type: container direction: horizontal - gap: 5 + gapX: 5 + gapY: 5 x: 100 "y": 100 hover: @@ -1070,7 +1242,8 @@ out: id: container-events type: container direction: horizontal - gap: 5 + gapX: 5 + gapY: 5 width: 80 height: 100 x: 100 @@ -1109,13 +1282,26 @@ out: rotation: 0 alpha: 1 --- +case: Test parsing container throws when legacy gap is used +in: + - state: + id: legacy-gap-container + type: container + x: 0 + "y": 0 + direction: vertical + gap: 5 + children: [] +throws: "Input Error: container.gap is no longer supported. Use gapX and gapY." +--- case: Test parsing container with children no scale in: - state: id: container-scaled-children type: container direction: horizontal - gap: 5 + gapX: 5 + gapY: 5 x: 0 "y": 0 scaleX: 2 @@ -1135,7 +1321,8 @@ out: id: container-scaled-children type: container direction: horizontal - gap: 5 + gapX: 5 + gapY: 5 width: 605 height: 300 x: 0 @@ -1179,7 +1366,8 @@ in: id: container-scaled-children type: container direction: horizontal - gap: 5 + gapX: 5 + gapY: 5 x: 0 "y": 0 scaleX: 2 @@ -1203,7 +1391,8 @@ out: id: container-scaled-children type: container direction: horizontal - gap: 5 + gapX: 5 + gapY: 5 width: 1205 height: 600 x: 0 @@ -1247,7 +1436,8 @@ in: id: container-anchor-bottom type: container direction: vertical - gap: 5 + gapX: 5 + gapY: 5 width: 120 height: 120 x: 25 @@ -1264,7 +1454,8 @@ out: id: container-anchor-bottom type: container direction: vertical - gap: 5 + gapX: 5 + gapY: 5 width: 120 height: 120 x: 25 @@ -1334,7 +1525,8 @@ out: id: inventory type: container direction: "" - gap: 0 + gapX: 0 + gapY: 0 width: 200 height: 160 x: 24 diff --git a/src/plugins/elements/container/parseContainer.js b/src/plugins/elements/container/parseContainer.js index f59bf9fb..7983b212 100644 --- a/src/plugins/elements/container/parseContainer.js +++ b/src/plugins/elements/container/parseContainer.js @@ -20,10 +20,17 @@ import { parseCommonObject } from "../util/parseCommonObject.js"; export const parseContainer = ({ state, parserPlugins = [] }) => { const direction = state.direction ?? ""; const scroll = state.scroll ? true : false; - const gap = state.gap || 0; + const gapX = state.gapX ?? 0; + const gapY = state.gapY ?? 0; const children = structuredClone(state.children || []); const parsedChildren = []; + if (state.gap !== undefined) { + throw new Error( + "Input Error: container.gap is no longer supported. Use gapX and gapY.", + ); + } + let containerWidth = 0; let containerHeight = 0; let currentX = 0; @@ -36,7 +43,6 @@ export const parseContainer = ({ state, parserPlugins = [] }) => { let currentColHeight = 0; for (let i = 0; i < children.length; i++) { - const gapValue = i < children.length - 1 ? gap : 0; let child = children[i]; if (i > 0) { @@ -72,6 +78,8 @@ export const parseContainer = ({ state, parserPlugins = [] }) => { } if (direction === "horizontal") { + const gapValue = i < children.length - 1 ? gapX : 0; + if ( state.width && child.width + currentRowWidth > state.width && @@ -81,7 +89,7 @@ export const parseContainer = ({ state, parserPlugins = [] }) => { //Wrap the child currentX = 0; currentRowWidth = 0; - lastRowHeight += maxRowHeight + gap; + lastRowHeight += maxRowHeight + gapY; maxRowHeight = child.height; child.x = 0; @@ -94,6 +102,8 @@ export const parseContainer = ({ state, parserPlugins = [] }) => { containerWidth = Math.max(currentX, containerWidth); containerHeight = Math.max(child.height + child.y, containerHeight); } else if (direction === "vertical") { + const gapValue = i < children.length - 1 ? gapY : 0; + if ( state.height && child.height + currentColHeight > state.height && @@ -103,7 +113,7 @@ export const parseContainer = ({ state, parserPlugins = [] }) => { //Wrap the child currentY = 0; currentColHeight = 0; - lastColWidth += maxColWidth + gap; + lastColWidth += maxColWidth + gapX; maxColWidth = child.width; child.x = lastColWidth; @@ -133,7 +143,8 @@ export const parseContainer = ({ state, parserPlugins = [] }) => { ...containerComputed, children: parsedChildren, direction, - gap, + gapX, + gapY, scroll, ...(state.anchorToBottom && { anchorToBottom: true }), ...(state.scrollbar && { scrollbar: structuredClone(state.scrollbar) }), diff --git a/src/schemas/elements/container.computed.yaml b/src/schemas/elements/container.computed.yaml index 9d2d2e41..6e097a2a 100644 --- a/src/schemas/elements/container.computed.yaml +++ b/src/schemas/elements/container.computed.yaml @@ -13,7 +13,8 @@ required: - originY - children - direction - - gap + - gapX + - gapY - scroll - rotation properties: @@ -43,7 +44,7 @@ properties: description: Calculated origin Y coordinate based on anchor children: type: array - description: Parsed child elements with positions adjusted based on direction and gap + description: Parsed child elements with positions adjusted based on direction, gapX, and gapY items: oneOf: - $ref: "./sprite.computed.yaml" @@ -60,9 +61,13 @@ properties: minimum: 0 maximum: 1 default: 1 - gap: + gapX: type: number - description: Spacing between child elements in pixels + description: Horizontal spacing between child elements in pixels, and between wrapped columns. + default: 0 + gapY: + type: number + description: Vertical spacing between child elements in pixels, and between wrapped rows. default: 0 scroll: type: boolean diff --git a/src/schemas/elements/container.element.yaml b/src/schemas/elements/container.element.yaml index c70fa4ea..7482baef 100644 --- a/src/schemas/elements/container.element.yaml +++ b/src/schemas/elements/container.element.yaml @@ -55,9 +55,13 @@ properties: enum: [absolute, horizontal, vertical] description: Layout direction for children. Horizontal arranges left-to-right, vertical arranges top-to-bottom. default: absolute - gap: + gapX: type: number - description: Spacing between child elements in pixels + description: Horizontal spacing between child elements in pixels, and between wrapped columns. + default: 0 + gapY: + type: number + description: Vertical spacing between child elements in pixels, and between wrapped rows. default: 0 rotation: type: number diff --git a/src/types.js b/src/types.js index 8684c0d4..f87e5e64 100644 --- a/src/types.js +++ b/src/types.js @@ -307,7 +307,8 @@ * @property {'container'} type * @property {'horizontal' | 'vertical'} direction * @property {SpriteComputedNode | TextComputedNode | RectComputedNode | ContainerComputedNode} children - * @property {number} gap + * @property {number} gapX + * @property {number} gapY * @property {number} rotation * @property {boolean} scroll * @property {boolean} [anchorToBottom] diff --git a/tasks/TASK/000/TASK-027.md b/tasks/TASK/000/TASK-027.md index c7bc1be9..f6aaa526 100644 --- a/tasks/TASK/000/TASK-027.md +++ b/tasks/TASK/000/TASK-027.md @@ -27,7 +27,8 @@ elements: - id: container type: container direction: horizontal - gap: 20 + gapX: 20 + gapY: 20 x: 160 'y': 540 children: diff --git a/vt/specs/container/add-anchor-to-bottom.yaml b/vt/specs/container/add-anchor-to-bottom.yaml index bf6e97b8..7d8a584d 100644 --- a/vt/specs/container/add-anchor-to-bottom.yaml +++ b/vt/specs/container/add-anchor-to-bottom.yaml @@ -27,7 +27,8 @@ states: x: 50 "y": 50 height: 200 - gap: 5 + gapX: 5 + gapY: 5 scroll: true zIndex: 0 children: @@ -57,7 +58,8 @@ states: x: 300 "y": 50 height: 200 - gap: 5 + gapX: 5 + gapY: 5 anchorToBottom: true zIndex: 0 children: @@ -88,7 +90,8 @@ states: x: 50 "y": 50 height: 200 - gap: 5 + gapX: 5 + gapY: 5 scroll: true zIndex: 0 children: @@ -123,7 +126,8 @@ states: x: 300 "y": 50 height: 200 - gap: 5 + gapX: 5 + gapY: 5 anchorToBottom: true zIndex: 0 children: diff --git a/vt/specs/container/add-container-horizontal.yaml b/vt/specs/container/add-container-horizontal.yaml index 3f1b7b14..d40c54fb 100644 --- a/vt/specs/container/add-container-horizontal.yaml +++ b/vt/specs/container/add-container-horizontal.yaml @@ -9,7 +9,8 @@ states: - id: container-1 type: container direction: horizontal - gap: 5 + gapX: 5 + gapY: 5 zIndex: 0 children: - id: rect-1 diff --git a/vt/specs/container/add-custom-scrollbar-vertical.yaml b/vt/specs/container/add-custom-scrollbar-vertical.yaml index a3e8039d..d0209e6c 100644 --- a/vt/specs/container/add-custom-scrollbar-vertical.yaml +++ b/vt/specs/container/add-custom-scrollbar-vertical.yaml @@ -60,7 +60,8 @@ states: width: 220 height: 220 direction: vertical - gap: 8 + gapX: 8 + gapY: 8 scroll: true scrollbar: vertical: @@ -128,7 +129,8 @@ states: width: 220 height: 220 direction: vertical - gap: 8 + gapX: 8 + gapY: 8 scroll: true scrollbar: vertical: diff --git a/vt/specs/container/add-scroll.yaml b/vt/specs/container/add-scroll.yaml index 0beb029c..cb70307c 100644 --- a/vt/specs/container/add-scroll.yaml +++ b/vt/specs/container/add-scroll.yaml @@ -43,7 +43,8 @@ states: type: container direction: horizontal width: 200 - gap: 5 + gapX: 5 + gapY: 5 scroll: true zIndex: 0 children: @@ -87,7 +88,8 @@ states: direction: vertical height: 200 x: 500 - gap: 5 + gapX: 5 + gapY: 5 scroll: true zIndex: 0 children: diff --git a/vt/specs/container/interact-custom-scrollbar-vertical-fixed-thumb.yaml b/vt/specs/container/interact-custom-scrollbar-vertical-fixed-thumb.yaml index 85398496..d26cf91b 100644 --- a/vt/specs/container/interact-custom-scrollbar-vertical-fixed-thumb.yaml +++ b/vt/specs/container/interact-custom-scrollbar-vertical-fixed-thumb.yaml @@ -43,7 +43,8 @@ states: width: 220 height: 220 direction: vertical - gap: 6 + gapX: 6 + gapY: 6 scroll: true scrollbar: vertical: diff --git a/vt/specs/container/interact-custom-scrollbar-vertical-long-content.yaml b/vt/specs/container/interact-custom-scrollbar-vertical-long-content.yaml index bf0b65a9..0c3bba65 100644 --- a/vt/specs/container/interact-custom-scrollbar-vertical-long-content.yaml +++ b/vt/specs/container/interact-custom-scrollbar-vertical-long-content.yaml @@ -58,7 +58,8 @@ states: width: 220 height: 220 direction: vertical - gap: 6 + gapX: 6 + gapY: 6 scroll: true scrollbar: vertical: diff --git a/vt/specs/container/interact-custom-scrollbar-vertical.yaml b/vt/specs/container/interact-custom-scrollbar-vertical.yaml index 0997af6f..493171fb 100644 --- a/vt/specs/container/interact-custom-scrollbar-vertical.yaml +++ b/vt/specs/container/interact-custom-scrollbar-vertical.yaml @@ -64,7 +64,8 @@ states: width: 220 height: 220 direction: vertical - gap: 8 + gapX: 8 + gapY: 8 scroll: true scrollbar: vertical: diff --git a/vt/specs/container/update-add-nested-container.yaml b/vt/specs/container/update-add-nested-container.yaml index 49321368..0e4a483c 100644 --- a/vt/specs/container/update-add-nested-container.yaml +++ b/vt/specs/container/update-add-nested-container.yaml @@ -21,7 +21,8 @@ states: width: 300 height: 200 direction: horizontal - gap: 10 + gapX: 10 + gapY: 10 zIndex: 0 children: - id: rect-1 @@ -42,7 +43,8 @@ states: width: 300 height: 200 direction: horizontal - gap: 10 + gapX: 10 + gapY: 10 zIndex: 0 children: - id: rect-1 @@ -53,7 +55,8 @@ states: - id: container-2 type: container direction: vertical - gap: 5 + gapX: 5 + gapY: 5 children: - id: rect-3 type: rect diff --git a/vt/specs/container/update-container-position.yaml b/vt/specs/container/update-container-position.yaml index de9badcd..f69dcfe0 100644 --- a/vt/specs/container/update-container-position.yaml +++ b/vt/specs/container/update-container-position.yaml @@ -21,7 +21,8 @@ states: width: 300 height: 200 direction: horizontal - gap: 10 + gapX: 10 + gapY: 10 zIndex: 0 children: - id: rect-1 @@ -52,7 +53,8 @@ states: width: 300 height: 200 direction: horizontal - gap: 10 + gapX: 10 + gapY: 10 zIndex: 0 children: - id: rect-4 diff --git a/vt/specs/containerevent/event-children-click.yaml b/vt/specs/containerevent/event-children-click.yaml index 3169aa7d..6730d350 100644 --- a/vt/specs/containerevent/event-children-click.yaml +++ b/vt/specs/containerevent/event-children-click.yaml @@ -67,7 +67,8 @@ states: width: 400 height: 100 direction: horizontal - gap: 20 + gapX: 20 + gapY: 20 hover: payload: type: container-hover diff --git a/vt/specs/containertransition/container-fade-in.yaml b/vt/specs/containertransition/container-fade-in.yaml index 4d9c299f..bd0e5ba2 100644 --- a/vt/specs/containertransition/container-fade-in.yaml +++ b/vt/specs/containertransition/container-fade-in.yaml @@ -27,7 +27,8 @@ states: x: 150 'y': 100 direction: horizontal - gap: 10 + gapX: 10 + gapY: 10 alpha: 1 children: - id: rect1 diff --git a/vt/specs/containertransition/container-update-position-auto.yaml b/vt/specs/containertransition/container-update-position-auto.yaml index a9fc98df..b5c51b9b 100644 --- a/vt/specs/containertransition/container-update-position-auto.yaml +++ b/vt/specs/containertransition/container-update-position-auto.yaml @@ -26,7 +26,8 @@ states: x: 100 "y": 100 direction: horizontal - gap: 20 + gapX: 20 + gapY: 20 children: - id: rect1 type: rect @@ -44,7 +45,8 @@ states: x: 420 "y": 260 direction: horizontal - gap: 20 + gapX: 20 + gapY: 20 children: - id: rect1 type: rect diff --git a/vt/specs/containertransition/container-update-position.yaml b/vt/specs/containertransition/container-update-position.yaml index c097f198..268145d2 100644 --- a/vt/specs/containertransition/container-update-position.yaml +++ b/vt/specs/containertransition/container-update-position.yaml @@ -26,7 +26,8 @@ states: x: 100 "y": 100 direction: horizontal - gap: 20 + gapX: 20 + gapY: 20 children: - id: rect1 type: rect @@ -44,7 +45,8 @@ states: x: 400 "y": 250 direction: horizontal - gap: 20 + gapX: 20 + gapY: 20 children: - id: rect1 type: rect diff --git a/vt/specs/containertransition/container-update-scale.yaml b/vt/specs/containertransition/container-update-scale.yaml index 34270303..cfe24716 100644 --- a/vt/specs/containertransition/container-update-scale.yaml +++ b/vt/specs/containertransition/container-update-scale.yaml @@ -30,7 +30,8 @@ states: x: 300 "y": 200 direction: vertical - gap: 5 + gapX: 5 + gapY: 5 scaleX: 1 scaleY: 1 children: @@ -45,7 +46,8 @@ states: x: 300 "y": 200 direction: vertical - gap: 5 + gapX: 5 + gapY: 5 scaleX: 1.5 scaleY: 1.5 children: diff --git a/vt/specs/textrevealing/duplicate-text-after-sibling-sprite-rerender.yaml b/vt/specs/textrevealing/duplicate-text-after-sibling-sprite-rerender.yaml index efcb8acf..862faf69 100644 --- a/vt/specs/textrevealing/duplicate-text-after-sibling-sprite-rerender.yaml +++ b/vt/specs/textrevealing/duplicate-text-after-sibling-sprite-rerender.yaml @@ -75,7 +75,8 @@ states: x: 360 y: 315 direction: horizontal - gap: 32 + gapX: 32 + gapY: 32 children: - id: back-item type: text @@ -178,7 +179,8 @@ states: x: 360 y: 315 direction: horizontal - gap: 32 + gapX: 32 + gapY: 32 children: - id: back-item type: text diff --git a/vt/specs/textrevealing/text-revealing-no-animation.yaml b/vt/specs/textrevealing/text-revealing-no-animation.yaml index 607f7e04..c34b2e54 100644 --- a/vt/specs/textrevealing/text-revealing-no-animation.yaml +++ b/vt/specs/textrevealing/text-revealing-no-animation.yaml @@ -35,7 +35,8 @@ states: src: circle-green width: 8 height: 8 - gap: 15 + gapX: 15 + gapY: 15 - elements: - id: no-animation-text type: text-revealing @@ -57,4 +58,5 @@ states: src: circle-green width: 8 height: 8 - gap: 15 + gapX: 15 + gapY: 15